From 92a1d4d3c7d7bd6cbc971d3aba493a722e938cc7 Mon Sep 17 00:00:00 2001 From: dongl <2725096176@qq.com> Date: Wed, 20 Aug 2025 18:25:46 +0800 Subject: [PATCH] Initial commit --- LICENSE | 21 + README.md | 32 + h/CAN/canBoard.h | 103 + h/CAN/canController.h | 80 + h/CAN/canFixedLL.h | 104 + h/CAN/flexcan.h | 218 + h/CAN/flexcanOffsets.h | 81 + h/CAN/hcan2.h | 84 + h/CAN/hcan2Offsets.h | 126 + h/CAN/i82527.h | 77 + h/CAN/i82527Offsets.h | 67 + h/CAN/motMsCan.h | 156 + h/CAN/motMsCanOffsets.h | 164 + h/CAN/private/esd_can_pc104_200.h | 53 + h/CAN/private/esd_pci_200.h | 54 + h/CAN/private/m5282CAN.h | 48 + h/CAN/private/mpc5200Can.h | 86 + h/CAN/private/msmcan.h | 47 + h/CAN/private/ppc5xxCAN.h | 46 + h/CAN/sja1000.h | 110 + h/CAN/sja1000Offsets.h | 51 + h/CAN/toucan.h | 125 + h/CAN/toucanOffsets.h | 67 + h/CAN/wnCAN.h | 415 + h/CAN/wncanDevIO.h | 345 + h/CAN/wncan_api.h | 203 + h/ConnectionPoint.h | 311 + h/a_out.h | 200 + h/adrSpaceLib.h | 89 + h/adrSpaceShow.h | 28 + h/aimCacheLib.h | 249 + h/aimMmuBaseLib.h | 70 + h/aimMmuLib.h | 212 + h/aio.h | 91 + h/aioSysDrv.h | 48 + h/altivecLib.h | 64 + h/arch/arm/_G_configArch.h | 100 + h/arch/arm/archArm.h | 255 + h/arch/arm/archArmCommon.h | 55 + h/arch/arm/arm.h | 348 + h/arch/arm/asmArm.h | 61 + h/arch/arm/cacheArm1136jfLib.h | 73 + h/arch/arm/cacheArm926eLib.h | 58 + h/arch/arm/cacheArmArch6.h | 66 + h/arch/arm/cacheArmLib.h | 135 + h/arch/arm/cacheArmXSCALELib.h | 77 + h/arch/arm/coprocArm.h | 32 + h/arch/arm/dbgArmLib.h | 52 + h/arch/arm/dsmArmLib.h | 123 + h/arch/arm/elfArm.h | 108 + h/arch/arm/esfArm.h | 45 + h/arch/arm/excArmLib.h | 99 + h/arch/arm/fppArmLib.h | 58 + h/arch/arm/in_cksum.h | 179 + h/arch/arm/intArmLib.h | 116 + h/arch/arm/ivArm.h | 32 + h/arch/arm/mmuArm1136jfLib.h | 109 + h/arch/arm/mmuArm710aLib.h | 38 + h/arch/arm/mmuArm926eLib.h | 117 + h/arch/arm/mmuArmArch6PalLib.h | 358 + h/arch/arm/mmuArmLib.h | 85 + h/arch/arm/mmuArmPalLib.h | 429 + h/arch/arm/mmuArmXSCALELib.h | 290 + h/arch/arm/regsArm.h | 82 + h/arch/arm/sigArmCodes.h | 26 + h/arch/arm/syscallArgsarm.h | 755 ++ h/arch/arm/syscallArm.h | 72 + h/arch/i86/archI86.h | 232 + h/arch/i86/archI86Common.h | 58 + h/arch/i86/asmI86.h | 120 + h/arch/i86/cacheI86Lib.h | 64 + h/arch/i86/coprocI86.h | 31 + h/arch/i86/dbgI86Lib.h | 132 + h/arch/i86/dbgStrLib.h | 362 + h/arch/i86/dsmI86Lib.h | 647 + h/arch/i86/elfI86.h | 65 + h/arch/i86/esfI86.h | 110 + h/arch/i86/excI86Lib.h | 97 + h/arch/i86/fppI86Lib.h | 213 + h/arch/i86/in_cksum.h | 176 + h/arch/i86/instrI86.h | 86 + h/arch/i86/intI86Lib.h | 90 + h/arch/i86/ipiI86Lib.h | 71 + h/arch/i86/ivI86.h | 88 + h/arch/i86/mmuI86Lib.h | 149 + h/arch/i86/mmuPro32Lib.h | 151 + h/arch/i86/mmuPro36Lib.h | 170 + h/arch/i86/pentiumLib.h | 164 + h/arch/i86/perMonLib.h | 266 + h/arch/i86/regsI86.h | 959 ++ h/arch/i86/regsP7.h | 120 + h/arch/i86/sStepLib.h | 166 + h/arch/i86/sigI86Codes.h | 44 + h/arch/i86/syscallArgsx86.h | 755 ++ h/arch/i86/syscallI86.h | 89 + h/arch/i86/vxI86Lib.h | 86 + h/arch/mips/archMips.h | 735 ++ h/arch/mips/archMipsCommon.h | 76 + h/arch/mips/asmMips.h | 414 + h/arch/mips/cacheMipsLib.h | 147 + h/arch/mips/coprocMips.h | 38 + h/arch/mips/dbgMipsLib.h | 182 + h/arch/mips/dsmMipsLib.h | 530 + h/arch/mips/dspMipsLib.h | 100 + h/arch/mips/elfMips.h | 84 + h/arch/mips/esfMips.h | 156 + h/arch/mips/excMipsLib.h | 127 + h/arch/mips/fpSoft.h | 545 + h/arch/mips/fppMipsLib.h | 201 + h/arch/mips/in_cksum.h | 176 + h/arch/mips/intMipsLib.h | 42 + h/arch/mips/ivMips.h | 107 + h/arch/mips/mipsR2Hazards.h | 41 + h/arch/mips/mmuMipsLib.h | 499 + h/arch/mips/mti5kxHazards.h | 35 + h/arch/mips/palMipsLib.h | 94 + h/arch/mips/regsMips.h | 172 + h/arch/mips/rm9000.h | 448 + h/arch/mips/rm9xxxHazards.h | 46 + h/arch/mips/sigMipsCodes.h | 56 + h/arch/mips/syscallArgsMIPS32.h | 757 ++ h/arch/mips/syscallArgsMIPS64BE.h | 1060 ++ h/arch/mips/syscallArgsMIPS64LE.h | 958 ++ h/arch/mips/syscallMips.h | 131 + h/arch/mips/taskMipsLib.h | 106 + h/arch/mips/tx49xxHazards.h | 42 + h/arch/ppc/403gaSerial.h | 122 + h/arch/ppc/altivecPpcLib.h | 86 + h/arch/ppc/archPpc.h | 334 + h/arch/ppc/archPpcCommon.h | 49 + h/arch/ppc/asmPpc.h | 149 + h/arch/ppc/cachePpcLib.h | 38 + h/arch/ppc/compilerError2704 | 0 h/arch/ppc/compilerError4804 | 0 h/arch/ppc/coprocPpc.h | 35 + h/arch/ppc/dbgPpcLib.h | 340 + h/arch/ppc/dsmPpcLib.h | 364 + h/arch/ppc/elfPpc.h | 112 + h/arch/ppc/esfPpc.h | 266 + h/arch/ppc/exc440x5.h | 186 + h/arch/ppc/excPpcLib.h | 483 + h/arch/ppc/fppPpcLib.h | 72 + h/arch/ppc/in_cksum.h | 191 + h/arch/ppc/ivPpc.h | 74 + h/arch/ppc/mmu405Lib.h | 466 + h/arch/ppc/mmu440Lib.h | 508 + h/arch/ppc/mmu603Lib.h | 158 + h/arch/ppc/mmu800Lib.h | 230 + h/arch/ppc/mmuArchVars.h | 38 + h/arch/ppc/mmuE500Lib.h | 439 + h/arch/ppc/mmuPpcLib.h | 541 + h/arch/ppc/ppc32.h | 63 + h/arch/ppc/ppc403.h | 639 + h/arch/ppc/ppc405.h | 356 + h/arch/ppc/ppc440.h | 614 + h/arch/ppc/ppc5200.h | 966 ++ h/arch/ppc/ppc603.h | 221 + h/arch/ppc/ppc604.h | 232 + h/arch/ppc/ppc85xx.h | 445 + h/arch/ppc/ppc860.h | 258 + h/arch/ppc/ppc970.h | 428 + h/arch/ppc/private/excArchLibP.h | 171 + h/arch/ppc/regsPpc.h | 209 + h/arch/ppc/sigPpcCodes.h | 23 + h/arch/ppc/spePpcLib.h | 78 + h/arch/ppc/syscallArgsppc.h | 757 ++ h/arch/ppc/syscallPpc.h | 75 + h/arch/ppc/taskPpcLib.h | 20 + h/arch/ppc/toolPpc.h | 525 + h/arch/ppc/vxPpcLib.h | 275 + h/arch/sh/archSh.h | 243 + h/arch/sh/archShCommon.h | 46 + h/arch/sh/asmSh.h | 33 + h/arch/sh/cacheShLib.h | 175 + h/arch/sh/coprocSh.h | 33 + h/arch/sh/dbgShLib.h | 267 + h/arch/sh/dsmShLib.h | 250 + h/arch/sh/dspShLib.h | 111 + h/arch/sh/elfSh.h | 116 + h/arch/sh/esfSh.h | 49 + h/arch/sh/excShLib.h | 130 + h/arch/sh/fppShLib.h | 159 + h/arch/sh/in_cksum.h | 177 + h/arch/sh/intShLib.h | 46 + h/arch/sh/ivSh.h | 411 + h/arch/sh/mmuShLib.h | 326 + h/arch/sh/regsSh.h | 208 + h/arch/sh/sh7750.h | 295 + h/arch/sh/sh7751.h | 185 + h/arch/sh/sh7760.h | 381 + h/arch/sh/sh7770.h | 352 + h/arch/sh/sigShCodes.h | 57 + h/arch/sh/syscallArgssh4.h | 755 ++ h/arch/sh/syscallSh.h | 73 + h/arch/sh/toolSh.h | 71 + h/arch/sh/vxShLib.h | 72 + h/arch/simhppa/archSimhppa.h | 93 + h/arch/simhppa/asmSimhppa.h | 35 + h/arch/simhppa/dbgSimhppaLib.h | 35 + h/arch/simhppa/dsmSimhppaLib.h | 192 + h/arch/simhppa/esfSimhppa.h | 28 + h/arch/simhppa/excSimhppaLib.h | 57 + h/arch/simhppa/fppSimhppaLib.h | 91 + h/arch/simhppa/ivSimhppa.h | 51 + h/arch/simhppa/regsSimhppa.h | 131 + h/arch/simlinux/archSimlinux.h | 119 + h/arch/simlinux/archSimlinuxCommon.h | 68 + h/arch/simlinux/asmSimlinux.h | 120 + h/arch/simlinux/coprocSimlinux.h | 32 + h/arch/simlinux/dbgSimlinuxLib.h | 94 + h/arch/simlinux/dsmSimlinuxLib.h | 647 + h/arch/simlinux/elfI86.h | 65 + h/arch/simlinux/esfSimlinux.h | 39 + h/arch/simlinux/excSimlinuxLib.h | 51 + h/arch/simlinux/fppSimlinuxLib.h | 117 + h/arch/simlinux/in_cksum.h | 176 + h/arch/simlinux/instrI86.h | 86 + h/arch/simlinux/ivSimlinux.h | 53 + h/arch/simlinux/mmuArchLib.h | 289 + h/arch/simlinux/regsSimlinux.h | 112 + h/arch/simlinux/syscallArgsx86.h | 755 ++ h/arch/simlinux/syscallSimlinux.h | 71 + h/arch/simlinux/vxSimlinuxLib.h | 29 + h/arch/simlinux/vxsimHostArchLib.h | 63 + h/arch/simnt/archSimnt.h | 119 + h/arch/simnt/archSimntCommon.h | 68 + h/arch/simnt/asmSimnt.h | 120 + h/arch/simnt/coprocSimnt.h | 32 + h/arch/simnt/dbgSimntLib.h | 94 + h/arch/simnt/dsmSimntLib.h | 647 + h/arch/simnt/elfI86.h | 65 + h/arch/simnt/esfSimnt.h | 39 + h/arch/simnt/excSimntLib.h | 100 + h/arch/simnt/fppSimntLib.h | 117 + h/arch/simnt/in_cksum.h | 176 + h/arch/simnt/instrI86.h | 86 + h/arch/simnt/ivSimnt.h | 40 + h/arch/simnt/mmuArchLib.h | 289 + h/arch/simnt/ntcontext.h | 166 + h/arch/simnt/regsSimnt.h | 112 + h/arch/simnt/stdargGnu.h | 140 + h/arch/simnt/syscallArgsx86.h | 755 ++ h/arch/simnt/syscallSimnt.h | 71 + h/arch/simnt/va_simnt.h | 163 + h/arch/simnt/vxSimntLib.h | 29 + h/arch/simnt/vxsimArchLib.h | 18 + h/arch/simnt/vxsimHostArchLib.h | 57 + h/arch/simsolaris/archSimsolaris.h | 114 + h/arch/simsolaris/archSimsolarisCommon.h | 83 + h/arch/simsolaris/asmSimsolaris.h | 58 + h/arch/simsolaris/compilerError13053 | 0 h/arch/simsolaris/compilerError23367 | 0 h/arch/simsolaris/coprocSimsolaris.h | 32 + h/arch/simsolaris/dbgSimsolarisLib.h | 52 + h/arch/simsolaris/dsmSimsolarisLib.h | 64 + h/arch/simsolaris/elfSparc.h | 112 + h/arch/simsolaris/esfSimsolaris.h | 39 + h/arch/simsolaris/excSimsolarisLib.h | 51 + h/arch/simsolaris/fppSimsolarisLib.h | 189 + h/arch/simsolaris/in_cksum.h | 176 + h/arch/simsolaris/instrSparc.h | 1006 ++ h/arch/simsolaris/ivSimsolaris.h | 59 + h/arch/simsolaris/mmuArchLib.h | 289 + h/arch/simsolaris/regsSimsolaris.h | 128 + h/arch/simsolaris/syscallArgsPaddingsparc.h | 20 + h/arch/simsolaris/syscallArgssparc.h | 757 ++ h/arch/simsolaris/syscallSimsolaris.h | 67 + h/arch/simsolaris/ulipSimsolaris.h | 23 + h/arch/simsolaris/vxSimsolarisLib.h | 30 + h/arch/simsolaris/vxsimHostArchLib.h | 63 + h/arpLib.h | 65 + h/arpa/inet.h | 71 + h/asm.h | 102 + h/assert.h | 43 + h/auxv.h | 69 + h/avlLib.h | 71 + h/avlUintLib.h | 60 + h/b_out.h | 195 + h/blkIo.h | 52 + h/bmpLib.h | 107 + h/bootEcoffLib.h | 35 + h/bootElfLib.h | 34 + h/bootLib.h | 93 + h/bootLoadLib.h | 48 + h/bootpLib.h | 283 + h/bpfDrv.h | 42 + h/bsdSockLib.h | 89 + h/bsdSockMap.h | 46 + h/bspVersion.h | 65 + h/buf.h | 201 + h/bufLib.h | 53 + h/cacheLib.h | 303 + h/cbioLib.h | 220 + h/cdromFsLib.h | 286 + h/classLib.h | 59 + h/coff-i386.h | 253 + h/coff-pe.h | 192 + h/comAutomation.h | 203 + h/comBase.h | 243 + h/comCoreLib.h | 132 + h/comCoreTypes.h | 972 ++ h/comErr.h | 367 + h/comLib.h | 412 + h/comObjLib.h | 953 ++ h/comObjLibExt.h | 206 + h/comShow.h | 120 + h/common.h | 109 + h/connLib.h | 34 + h/coprocLib.h | 78 + h/copyright_wrs.h | 1 + h/coreDumpLib.h | 162 + h/cplusLib.h | 54 + h/cpuPwrLib.h | 136 + h/cpuPwrMgr.h | 47 + h/ctype.h | 122 + h/dbgLib.h | 107 + h/dbgRpcLib.h | 42 + h/dcacheCbio.h | 80 + h/dcomExtent.h | 47 + h/dcomLib.h | 252 + h/dcomProxy.h | 406 + h/demangler.h | 71 + h/demanglerTypes.h | 55 + h/dhcp/common.h | 375 + h/dhcp/common_subr.h | 97 + h/dhcp/copyright_dhcp.h | 48 + h/dhcp/database.h | 209 + h/dhcp/dhcp.h | 289 + h/dhcp/dhcpc.h | 350 + h/dhcp/dhcpcBoot.h | 88 + h/dhcp/dhcpcCommonLib.h | 177 + h/dhcp/dhcpcInit.h | 42 + h/dhcp/dhcpcInternal.h | 95 + h/dhcp/dhcpcShow.h | 27 + h/dhcp/dhcpcStateLib.h | 50 + h/dhcp/dhcps.h | 229 + h/dhcp/hash.h | 86 + h/dhcpcBootLib.h | 41 + h/dhcpcLib.h | 54 + h/dhcprLib.h | 52 + h/dhcpsLib.h | 173 + h/dirent.h | 79 + h/dllLib.h | 270 + h/dma.h | 57 + h/dosFsCommon.h | 111 + h/dosFsLib.h | 261 + h/dpartCbio.h | 46 + h/drv/dma/i8237Dma.h | 85 + h/drv/dma/i960Dma.h | 116 + h/drv/dma/iPIIX4Dma.h | 184 + h/drv/dma/ibmMalDma.h | 236 + h/drv/dma/l64853.h | 109 + h/drv/dma/m5200Sdma.h | 110 + h/drv/dma/m68450.h | 225 + h/drv/dma/mpc107Dma.h | 182 + h/drv/dma/we32104.h | 143 + h/drv/end/amd8111LanEnd.h | 685 + h/drv/end/auEnd.h | 312 + h/drv/end/bcm1250MacEnd.h | 169 + h/drv/end/dec21x40End.h | 1074 ++ h/drv/end/dec21x4xEnd.h | 794 ++ h/drv/end/ei82596End.h | 325 + h/drv/end/el3c90xEnd.h | 1021 ++ h/drv/end/elt3c509End.h | 384 + h/drv/end/emacEnd.h | 752 ++ h/drv/end/fei82557End.h | 738 ++ h/drv/end/gei82543End.h | 871 ++ h/drv/end/iOlicomEnd.h | 620 + h/drv/end/ln7990End.h | 225 + h/drv/end/ln7990EndCommon.h | 81 + h/drv/end/ln97xEnd.h | 485 + h/drv/end/m5200FecEnd.h | 771 ++ h/drv/end/m8260Fcc.h | 310 + h/drv/end/m8260SccEnd.h | 400 + h/drv/end/mb86960End.h | 312 + h/drv/end/mbcEnd.h | 191 + h/drv/end/motCpmEnd.h | 342 + h/drv/end/motFcc2End.h | 645 + h/drv/end/motFccEnd.h | 631 + h/drv/end/motFecEnd.h | 639 + h/drv/end/motTsecEnd.h | 1180 ++ h/drv/end/ne2000End.h | 201 + h/drv/end/nicEvbEnd.h | 242 + h/drv/end/ns83902End.h | 189 + h/drv/end/sh7615End.h | 440 + h/drv/end/simnetEnd.h | 56 + h/drv/end/smEnd.h | 255 + h/drv/end/sn83932End.h | 395 + h/drv/end/ultraEnd.h | 220 + h/drv/end/wancomEnd.h | 441 + h/drv/erf/erfLib.h | 100 + h/drv/erf/erfLibP.h | 66 + h/drv/erf/erfShow.h | 39 + h/drv/fdisk/nec765Fd.h | 158 + h/drv/hdisk/ataDrv.h | 1614 +++ h/drv/hdisk/ideDrv.h | 158 + h/drv/hdisk/m5200AtaDrv.h | 544 + h/drv/i2c/i2cLib.h | 309 + h/drv/i2c/ixp400I2c.h | 49 + h/drv/i2c/m5200I2CMaster.h | 89 + h/drv/intrCtl/hd644232.h | 80 + h/drv/intrCtl/i82378Ibc.h | 105 + h/drv/intrCtl/i8259.h | 96 + h/drv/intrCtl/i8259a.h | 73 + h/drv/intrCtl/ioApic.h | 114 + h/drv/intrCtl/ixp400IntrCtl.h | 319 + h/drv/intrCtl/loApic.h | 227 + h/drv/intrCtl/m33242j.h | 80 + h/drv/intrCtl/m5200Intr.h | 220 + h/drv/intrCtl/m68153.h | 47 + h/drv/intrCtl/m8260IntrCtl.h | 192 + h/drv/intrCtl/mpc107Epic.h | 294 + h/drv/intrCtl/ppc555Intr.h | 72 + h/drv/intrCtl/ppc860Intr.h | 127 + h/drv/intrCtl/quiccIntrCtl.h | 157 + h/drv/intrCtl/s68154.h | 51 + h/drv/intrCtl/s68155.h | 116 + h/drv/intrCtl/sa150xIntrCtl.h | 161 + h/drv/manager/device.h | 63 + h/drv/mem/amd29LV800TMem.h | 90 + h/drv/mem/flash28.h | 69 + h/drv/mem/flash29.h | 69 + h/drv/mem/flashDev.h | 81 + h/drv/mem/i28f640j3mem.h | 68 + h/drv/mem/iFlash.h | 55 + h/drv/mem/m8260Memc.h | 269 + h/drv/mem/m8260Siu.h | 98 + h/drv/mem/m82xxDpramLib.h | 58 + h/drv/mem/mcecc.h | 178 + h/drv/mem/memDev.h | 47 + h/drv/mem/mpc107MemInit.h | 453 + h/drv/mem/quiccLbc.h | 202 + h/drv/mem/unsupported/mcecc.h | 178 + h/drv/multi/auLib.h | 412 + h/drv/multi/bcm1250Lib.h | 3512 ++++++ h/drv/multi/cvmeSqsys1.h | 93 + h/drv/multi/cvmeSqsys3.h | 89 + h/drv/multi/ds1244y.h | 118 + h/drv/multi/fc68165.h | 312 + h/drv/multi/fga002.h | 498 + h/drv/multi/frcEagle01.h | 92 + h/drv/multi/frcEagle02.h | 90 + h/drv/multi/gt64120a.h | 1010 ++ h/drv/multi/i534.h | 160 + h/drv/multi/i82510.h | 239 + h/drv/multi/ivic.h | 423 + h/drv/multi/m5204.h | 190 + h/drv/multi/m5206.h | 295 + h/drv/multi/m5206e.h | 392 + h/drv/multi/m5272.h | 541 + h/drv/multi/m5307.h | 411 + h/drv/multi/m5407.h | 385 + h/drv/multi/m68230.h | 164 + h/drv/multi/m68302.h | 675 + h/drv/multi/m68332.h | 793 ++ h/drv/multi/m68340.h | 525 + h/drv/multi/m68360.h | 1204 ++ h/drv/multi/m68562.h | 612 + h/drv/multi/m68681.h | 254 + h/drv/multi/m68901.h | 254 + h/drv/multi/mcchip.h | 397 + h/drv/multi/mcecc.h | 168 + h/drv/multi/memc040.h | 113 + h/drv/multi/mpc107.h | 356 + h/drv/multi/mpc107I2c.h | 150 + h/drv/multi/mpc107Msg.h | 208 + h/drv/multi/msc01.h | 1577 +++ h/drv/multi/mz7120sp4.h | 98 + h/drv/multi/nvr4101.h | 350 + h/drv/multi/nvr4102.h | 412 + h/drv/multi/nvr4121.h | 447 + h/drv/multi/nvr4122.h | 456 + h/drv/multi/nvr4131.h | 466 + h/drv/multi/pccchip.h | 197 + h/drv/multi/pccchip2.h | 331 + h/drv/multi/ppc555Siu.h | 377 + h/drv/multi/ppc860Cpm.h | 1036 ++ h/drv/multi/ppc860Siu.h | 833 ++ h/drv/multi/smcFdc37b78x.h | 190 + h/drv/multi/stp2003.h | 99 + h/drv/multi/z8536.h | 322 + h/drv/netif/if_cpm.h | 235 + h/drv/netif/if_cs.h | 310 + h/drv/netif/if_dc.h | 646 + h/drv/netif/if_eex.h | 485 + h/drv/netif/if_eex32.h | 67 + h/drv/netif/if_ei.h | 344 + h/drv/netif/if_eihk.h | 348 + h/drv/netif/if_elc.h | 329 + h/drv/netif/if_elt.h | 438 + h/drv/netif/if_ene.h | 224 + h/drv/netif/if_esmc.h | 251 + h/drv/netif/if_fei.h | 413 + h/drv/netif/if_fn.h | 263 + h/drv/netif/if_ln.h | 227 + h/drv/netif/if_lnPci.h | 196 + h/drv/netif/if_mbc.h | 215 + h/drv/netif/if_nicEvb.h | 238 + h/drv/netif/if_sm.h | 74 + h/drv/netif/if_sn.h | 337 + h/drv/netif/if_ultra.h | 278 + h/drv/netif/netifDev.h | 50 + h/drv/netif/smNetLib.h | 117 + h/drv/parallel/lptDrv.h | 133 + h/drv/parallel/m5m82c55afp.h | 53 + h/drv/parallel/m8260IOPort.h | 113 + h/drv/pci/iPIIX4.h | 94 + h/drv/pci/iPiix4Pci.h | 122 + h/drv/pci/mpc105.h | 426 + h/drv/pci/mpc107Pci.h | 170 + h/drv/pci/pciAutoConfigLib.h | 193 + h/drv/pci/pciConfigLib.h | 411 + h/drv/pci/pciConfigShow.h | 44 + h/drv/pci/pciExpressLib.h | 250 + h/drv/pci/pciHeaderDefs.h | 141 + h/drv/pci/pciIntLib.h | 48 + h/drv/pci/pciIomapLib.h | 279 + h/drv/pci/pciLocalBus.h | 277 + h/drv/pci/pciXLib.h | 106 + h/drv/pcmcia/cisLib.h | 232 + h/drv/pcmcia/pccardLib.h | 127 + h/drv/pcmcia/pcic.h | 166 + h/drv/pcmcia/pcmciaLib.h | 248 + h/drv/pcmcia/pd67.h | 84 + h/drv/pcmcia/ricoh.h | 73 + h/drv/pcmcia/sramDrv.h | 70 + h/drv/pcmcia/tcic.h | 283 + h/drv/pcmcia/vg468.h | 75 + h/drv/rtc/hd146818.h | 86 + h/drv/rtc/n8570.h | 167 + h/drv/rtc/rtc64613.h | 79 + h/drv/rtc/s62421.h | 50 + h/drv/rtc/unsupported/hd146818.h | 86 + h/drv/rtc/unsupported/n8570.h | 167 + h/drv/rtc/unsupported/rtc64613.h | 79 + h/drv/rtc/unsupported/s62421.h | 50 + h/drv/scsi/aic7880.h | 137 + h/drv/scsi/mb87030.h | 24 + h/drv/scsi/mb87030_1.h | 245 + h/drv/scsi/ncr5390.h | 25 + h/drv/scsi/ncr5390_1.h | 257 + h/drv/scsi/ncr5390_2.h | 273 + h/drv/scsi/ncr710.h | 25 + h/drv/scsi/ncr710Script.h | 25 + h/drv/scsi/ncr710Script1.h | 236 + h/drv/scsi/ncr710Script2.h | 224 + h/drv/scsi/ncr710_1.h | 495 + h/drv/scsi/ncr710_2.h | 570 + h/drv/scsi/ncr810.h | 833 ++ h/drv/scsi/ncr810Script.h | 227 + h/drv/scsi/sym895.h | 996 ++ h/drv/scsi/wd33c93.h | 25 + h/drv/scsi/wd33c93_1.h | 266 + h/drv/scsi/wd33c93_2.h | 332 + h/drv/serial/i8042.h | 157 + h/drv/serial/m68681.h | 254 + h/drv/serial/pcConsole.h | 221 + h/drv/sio/ambaSio.h | 97 + h/drv/sio/cd2400Sio.h | 451 + h/drv/sio/coldfireSio.h | 217 + h/drv/sio/evbNs16550Sio.h | 88 + h/drv/sio/i8250Sio.h | 155 + h/drv/sio/ixp400Sio.h | 191 + h/drv/sio/ixp425Sio.h | 184 + h/drv/sio/m5200PscSio.h | 90 + h/drv/sio/m5204Sio.h | 201 + h/drv/sio/m5206Sio.h | 201 + h/drv/sio/m68302Sio.h | 109 + h/drv/sio/m68332Sio.h | 66 + h/drv/sio/m68360Sio.h | 66 + h/drv/sio/m68562Sio.h | 160 + h/drv/sio/m68681Sio.h | 395 + h/drv/sio/m68901Sio.h | 227 + h/drv/sio/m8260Brg.h | 134 + h/drv/sio/m8260Cp.h | 154 + h/drv/sio/m8260CpmMux.h | 228 + h/drv/sio/m8260Scc.h | 271 + h/drv/sio/m8260Sio.h | 116 + h/drv/sio/mb86940Sio.h | 75 + h/drv/sio/ns16552Sio.h | 214 + h/drv/sio/nvr4101DSIUSio.h | 70 + h/drv/sio/nvr4101SIUSio.h | 70 + h/drv/sio/nvr4102DSIUSio.h | 70 + h/drv/sio/ppc403Sio.h | 179 + h/drv/sio/ppc555SciSio.h | 180 + h/drv/sio/ppc860Sio.h | 686 + h/drv/sio/rm9000x2glSio.h | 212 + h/drv/sio/sa1100Sio.h | 101 + h/drv/sio/sab82532Sio.h | 113 + h/drv/sio/shSciSio.h | 225 + h/drv/sio/shScifSio.h | 147 + h/drv/sio/st16552Sio.h | 202 + h/drv/sio/templateSio.h | 78 + h/drv/sio/z8530Sio.h | 342 + h/drv/sound/ac97.h | 198 + h/drv/sound/sb16drv.h | 230 + h/drv/sound/sound_dma.h | 198 + h/drv/sound/sound_ioctl.h | 52 + h/drv/sound/soundcard.h | 1405 +++ h/drv/timer/CIOTimer.h | 51 + h/drv/timer/ambaTimer.h | 82 + h/drv/timer/amd8111Timer.h | 29 + h/drv/timer/coldfireTimer.h | 68 + h/drv/timer/dga001Timer.h | 17 + h/drv/timer/i8253.h | 41 + h/drv/timer/i8254.h | 180 + h/drv/timer/ixp400Timer.h | 71 + h/drv/timer/m5200GPTimer.h | 101 + h/drv/timer/m5200SliceTimer.h | 50 + h/drv/timer/m5m82c54fp.h | 59 + h/drv/timer/m8260Clock.h | 66 + h/drv/timer/m8260Timer.h | 123 + h/drv/timer/mc146818.h | 73 + h/drv/timer/ppc403Timer.h | 53 + h/drv/timer/ppcDecTimer.h | 52 + h/drv/timer/ppcZ8536Timer.h | 342 + h/drv/timer/quiccTimer.h | 109 + h/drv/timer/sa1100Timer.h | 31 + h/drv/timer/sa1501Timer.h | 81 + h/drv/timer/timerDev.h | 85 + h/drv/timer/timestampDev.h | 18 + h/drv/timer/z8536.h | 322 + h/drv/usb/target/usbIsp1582.h | 353 + h/drv/usb/target/usbIsp1582Debug.h | 50 + h/drv/usb/target/usbIsp1582Eval.h | 87 + h/drv/usb/target/usbIsp1582Tcd.h | 76 + h/drv/usb/target/usbNET2280.h | 427 + h/drv/usb/target/usbNET2280Tcd.h | 118 + h/drv/usb/target/usbPdiusbd12.h | 230 + h/drv/usb/target/usbPdiusbd12Debug.h | 52 + h/drv/usb/target/usbPdiusbd12Eval.h | 110 + h/drv/usb/target/usbPdiusbd12Tcd.h | 94 + h/drv/usb/target/usbTargKbdLib.h | 34 + h/drv/usb/target/usbTargMsLib.h | 78 + h/drv/usb/target/usbTargPhilipsD12EvalLib.h | 36 + h/drv/usb/target/usbTargPrnLib.h | 33 + h/drv/usb/target/usbTargRbcCmd.h | 299 + h/drv/usb/target/usbTargRbcLib.h | 33 + h/drv/usb/target/usbTcd.h | 344 + h/drv/usb/target/usbTcdIsp1582EvalLib.h | 46 + h/drv/usb/target/usbTcdNET2280Debug.h | 55 + h/drv/usb/target/usbTcdNET2280Lib.h | 48 + h/drv/usb/target/usbTcdPdiusbd12EvalLib.h | 55 + h/drv/usb/usbAcmLib.h | 350 + h/drv/usb/usbBulkDevLib.h | 351 + h/drv/usb/usbBulkDevLibP.h | 45 + h/drv/usb/usbCbiUfiDevLib.h | 322 + h/drv/usb/usbCbiUfiDevLibP.h | 43 + h/drv/usb/usbHcd.h | 327 + h/drv/usb/usbHcdOhciLib.h | 48 + h/drv/usb/usbHcdUhciLib.h | 48 + h/drv/usb/usbKeyboardLib.h | 122 + h/drv/usb/usbKlsiEnd.h | 291 + h/drv/usb/usbMouseLib.h | 127 + h/drv/usb/usbNC1080End.h | 266 + h/drv/usb/usbOhci.h | 543 + h/drv/usb/usbPegasusEnd.h | 347 + h/drv/usb/usbPrinterLib.h | 132 + h/drv/usb/usbSpeakerLib.h | 198 + h/drv/usb/usbTransUnit.h | 211 + h/drv/usb/usbTransUnitTypes.h | 34 + h/drv/usb/usbUhci.h | 416 + h/drv/vme/busLocal.h | 48 + h/drv/vme/dga001Vme.h | 529 + h/drv/vme/ivac.h | 659 + h/drv/vme/unsupported/busLocal.h | 48 + h/drv/vme/unsupported/dga001Vme.h | 529 + h/drv/vme/unsupported/ivac.h | 659 + h/drv/vme/unsupported/mb86986Vme.h | 437 + h/drv/vme/unsupported/vbic.h | 226 + h/drv/vme/unsupported/vic068.h | 701 ++ h/drv/vme/unsupported/vme2Pci.h | 112 + h/drv/vme/unsupported/vmechip.h | 333 + h/drv/vme/unsupported/vmechip2.h | 1141 ++ h/drv/vme/unsupported/vsam.h | 150 + h/drv/vme/unsupported/vsbchip2.h | 151 + h/drv/vme/vbic.h | 226 + h/drv/vme/vic068.h | 701 ++ h/drv/vme/vme2Pci.h | 112 + h/drv/vme/vmechip.h | 333 + h/drv/vme/vmechip2.h | 1141 ++ h/drv/vme/vsam.h | 150 + h/drv/vme/vsbchip2.h | 151 + h/drv/vxfusion/distIfUdp.h | 88 + h/drv/wdb/vision/visionTmdDrv.h | 52 + h/drv/wdb/vision/wdbVisionDrv.h | 131 + h/drv/wdb/vision/wdbVisionDrvIF.h | 116 + h/drv/wdb/vision/wdbVisionPktDrv.h | 89 + h/drv/wdb/wdbBdmPktDrv.h | 61 + h/drv/wdb/wdbEndPktDrv.h | 114 + h/drv/wdb/wdbNetromPktDrv.h | 63 + h/drv/wdb/wdbPipePktDrv.h | 75 + h/drv/wdb/wdbSlipPktDrv.h | 73 + h/drv/wdb/wdbTemplatePktDrv.h | 70 + h/drv/wdb/wdbUlipPktDrv.h | 56 + h/drv/wdb/wdbVioDrv.h | 40 + h/drv/wlan/dot11Bsp.h | 109 + h/drv/wlan/dot11HddLib.h | 29 + h/drv/wlan/dot11Lib.h | 2161 ++++ h/drv/wlan/dot11RsnLib.h | 80 + h/drv/wlan/dot11SmeApLib.h | 36 + h/drv/wlan/dot11SmeEssLib.h | 172 + h/drv/wlan/dot11SmeIbssLib.h | 69 + h/drv/wlan/dot11SmeLib.h | 41 + h/drv/wlan/dot11Test.h | 79 + h/drv/wlan/dot11TimerLib.h | 17 + h/drv/wlan/dot11UsrLib.h | 1033 ++ h/drv/xbd/bio.h | 50 + h/drv/xbd/xbd.h | 103 + h/dsi/backend/dsiSockLib.h | 171 + h/dsi/backend/dsiUtilLib.h | 32 + h/dsi/private/salClientP.h | 43 + h/dsi/private/salCommonP.h | 94 + h/dsi/private/salServerP.h | 64 + h/dsi/private/snsLibP.h | 390 + h/dsi/salClient.h | 47 + h/dsi/salCommon.h | 64 + h/dsi/salServer.h | 78 + h/dsi/snsLib.h | 92 + h/dsi/un/unCompLib.h | 29 + h/dsi/un/unLib.h | 38 + h/dsi/un/unShow.h | 29 + h/dsi/un/uncomp.h | 27 + h/dsi/un/uncomp_fsm.h | 36 + h/dsi/un/uncomp_var.h | 54 + h/dsmLib.h | 105 + h/dspLib.h | 89 + h/ecoff.h | 798 ++ h/ecoffSyms.h | 814 ++ h/edrErrLogLib.h | 202 + h/edrLib.h | 489 + h/edrLibCommon.h | 87 + h/elf.h | 395 + h/elftypes.h | 44 + h/end.h | 433 + h/endCommon.h | 333 + h/endLib.h | 278 + h/envLib.h | 68 + h/envoy.h | 989 ++ h/errno.h | 197 + h/errnoLib.h | 60 + h/esf.h | 95 + h/etherLib.h | 94 + h/etherMultiLib.h | 64 + h/eventLib.h | 112 + h/eventLibCommon.h | 111 + h/excLib.h | 154 + h/fcntl.h | 56 + h/fioLib.h | 75 + h/fppLib.h | 122 + h/fsEventUtilLib.h | 42 + h/fsMonitor.h | 75 + h/ftpLib.h | 192 + h/ftpdLib.h | 49 + h/generic.h | 82 + h/hashLib.h | 96 + h/hookLib.h | 123 + h/hostLib.h | 100 + h/hpAout.h | 264 + h/hrFsLib.h | 179 + h/hwif/util/hwMemLib.h | 54 + h/hwif/vxbus/busLib.h | 527 + h/hwif/vxbus/hwConf.h | 76 + h/hwif/vxbus/pciBusLib.h | 103 + h/hwif/vxbus/plbBusLib.h | 64 + h/icmpLib.h | 63 + h/ifIndexLib.h | 31 + h/ifLib.h | 83 + h/if_bp.h | 73 + h/if_sl.h | 50 + h/in.h | 26 + h/inetLib.h | 79 + h/intLib.h | 168 + h/ioLib.h | 504 + h/ioQLib.h | 108 + h/ioctl.h | 11 + h/iosLib.h | 148 + h/iosScLib.h | 39 + h/ipProto.h | 75 + h/isrLib.h | 67 + h/iv.h | 103 + h/kernelLib.h | 66 + h/ledLib.h | 132 + h/limits.h | 90 + h/loadAoutLib.h | 45 + h/loadCoffLib.h | 611 + h/loadEcoffComm.h | 54 + h/loadEcoffLib.h | 59 + h/loadElfLib.h | 100 + h/loadLib.h | 123 + h/loadPecoffLib.h | 419 + h/loadSomCoffLib.h | 58 + h/locale.h | 86 + h/logLib.h | 68 + h/loginLib.h | 80 + h/lstLib.h | 112 + h/m2IfLib.h | 26 + h/m2Lib.h | 1118 ++ h/make/README.TXT | 63 + h/make/config/comps/coreip/defs.default | 48 + h/make/config/comps/coreip/defs.docs | 29 + h/make/config/comps/coreip/defs.subdirs | 51 + h/make/config/comps/coreip/rules.default | 12 + h/make/config/comps/dot1x/defs.default | 15 + h/make/config/comps/dot1x/defs.docs | 28 + h/make/config/comps/dot1x/defs.subdirs | 23 + h/make/config/comps/dot1x/rules.default | 12 + h/make/config/comps/ipSec/defs.default | 130 + h/make/config/comps/ipSec/defs.docs | 28 + h/make/config/comps/ipSec/defs.subdirs | 23 + h/make/config/comps/ipSec/rules.default | 12 + h/make/config/comps/ppp/defs.default | 25 + h/make/config/comps/ppp/defs.docs | 25 + h/make/config/comps/ppp/defs.subdirs | 28 + h/make/config/comps/ppp/rules.default | 12 + h/make/config/comps/radius/defs.default | 15 + h/make/config/comps/radius/defs.docs | 29 + h/make/config/comps/radius/defs.subdirs | 51 + h/make/config/comps/radius/rules.default | 12 + h/make/config/comps/security/defs.default | 16 + h/make/config/comps/security/defs.docs | 28 + h/make/config/comps/security/defs.subdirs | 26 + h/make/config/comps/security/rules.default | 12 + h/make/config/comps/ssl/defs.default | 15 + h/make/config/comps/ssl/defs.docs | 27 + h/make/config/comps/ssl/defs.subdirs | 26 + h/make/config/comps/ssl/rules.default | 12 + h/make/config/comps/tipc/defs.docs | 20 + h/make/config/comps/usb/defs.docs | 35 + h/make/config/comps/wlan/defs.default | 16 + h/make/config/comps/wlan/defs.docs | 28 + h/make/config/comps/wlan/defs.subdirs | 33 + h/make/config/comps/wlan/rules.default | 12 + h/make/config/defs.version | 11 + h/make/defs.bsp | 316 + h/make/defs.default | 183 + h/make/defs.drivers | 19 + h/make/defs.library | 148 + h/make/defs.link | 135 + h/make/defs.memory | 90 + h/make/defs.option | 183 + h/make/defs.pal | 58 + h/make/defs.project | 119 + h/make/defs.singleCpuVariant | 19 + h/make/defs.sun4-solaris2 | 19 + h/make/defs.unix | 179 + h/make/defs.vxApp | 14 + h/make/defs.vxWorks | 92 + h/make/defs.vxcom | 28 + h/make/defs.x86-freebsd | 15 + h/make/defs.x86-linux2 | 19 + h/make/defs.x86-win32 | 127 + h/make/make.PENTIUM2gnu | 33 + h/make/make.PENTIUM3gnu | 33 + h/make/make.PENTIUM4gnu | 33 + h/make/make.PENTIUMgnu | 33 + h/make/make.SIMNTgnu | 33 + h/make/make.SIMSPARCSOLARISgnu | 33 + h/make/makearch.mf | 16 + h/make/rules-apps.sun4-solaris2 | 4 + h/make/rules-apps.unix | 86 + h/make/rules-apps.x86-freebsd | 4 + h/make/rules-apps.x86-linux2 | 86 + h/make/rules-apps.x86-win32 | 10 + h/make/rules-lib.sun4-solaris2 | 10 + h/make/rules-lib.unix | 258 + h/make/rules-lib.x86-freebsd | 10 + h/make/rules-lib.x86-linux2 | 258 + h/make/rules-lib.x86-win32 | 11 + h/make/rules.apps | 30 + h/make/rules.bsp | 947 ++ h/make/rules.fs | 119 + h/make/rules.gpp | 60 + h/make/rules.library | 516 + h/make/rules.memory | 29 + h/make/rules.project | 357 + h/make/rules.sun4-solaris2 | 11 + h/make/rules.unix | 162 + h/make/rules.vxApp | 45 + h/make/rules.vxWorks | 398 + h/make/rules.x86-freebsd | 10 + h/make/rules.x86-linux2 | 162 + h/make/rules.x86-win32 | 12 + h/math.h | 229 + h/mbufLib.h | 173 + h/mbufSockLib.h | 55 + h/memDrv.h | 60 + h/memLib.h | 189 + h/memLogLib.h | 118 + h/memPartLib.h | 23 + h/miiLib.h | 387 + h/mmuAttr.h | 71 + h/mmuLib.h | 118 + h/moduleLib.h | 233 + h/moduleShow.h | 42 + h/mount.h | 193 + h/mountLib.h | 27 + h/mqPxShow.h | 36 + h/mqueue.h | 52 + h/mqueueCommon.h | 70 + h/msgQEvLib.h | 43 + h/msgQLib.h | 124 + h/msgQLibCommon.h | 100 + h/msgQSmLib.h | 62 + h/muxLib.h | 198 + h/muxTkLib.h | 74 + h/namei.h | 227 + h/net/af.h | 94 + h/net/bpf.h | 275 + h/net/domain.h | 94 + h/net/if.h | 469 + h/net/if_arp.h | 120 + h/net/if_dl.h | 99 + h/net/if_llc.h | 176 + h/net/if_subr.h | 88 + h/net/if_types.h | 224 + h/net/inet.h | 11 + h/net/mbuf.h | 337 + h/net/protosw.h | 250 + h/net/radix.h | 193 + h/net/raw_cb.h | 114 + h/net/route.h | 371 + h/net/smVxLib.h | 108 + h/net/socketvar.h | 317 + h/net/systm.h | 103 + h/net/uio.h | 101 + h/net/unixLib.h | 113 + h/netBufLib.h | 533 + h/netDrv.h | 85 + h/netLib.h | 262 + h/netShow.h | 85 + h/netdb.h | 137 + h/netinet/icmp_var.h | 100 + h/netinet/if_ether.h | 333 + h/netinet/igmp.h | 126 + h/netinet/igmp_var.h | 134 + h/netinet/in.h | 357 + h/netinet/in_pcb.h | 152 + h/netinet/in_systm.h | 77 + h/netinet/in_var.h | 257 + h/netinet/ip.h | 234 + h/netinet/ip_icmp.h | 197 + h/netinet/ip_mroute.h | 322 + h/netinet/ip_var.h | 216 + h/netinet/ppp/chap.h | 123 + h/netinet/ppp/fsm.h | 140 + h/netinet/ppp/if_ppp.h | 194 + h/netinet/ppp/ipcp.h | 82 + h/netinet/ppp/lcp.h | 99 + h/netinet/ppp/magic.h | 53 + h/netinet/ppp/md5.h | 89 + h/netinet/ppp/options.h | 136 + h/netinet/ppp/ppp.h | 56 + h/netinet/ppp/pppHookLib.h | 67 + h/netinet/ppp/pppSecretLib.h | 68 + h/netinet/ppp/pppShow.h | 102 + h/netinet/ppp/ppp_auth.h | 85 + h/netinet/ppp/ppp_vxworks.h | 74 + h/netinet/ppp/pppd.h | 437 + h/netinet/ppp/random.h | 36 + h/netinet/ppp/upap.h | 107 + h/netinet/sl_compress.h | 287 + h/netinet/tcp.h | 146 + h/netinet/tcp_debug.h | 111 + h/netinet/tcp_fsm.h | 106 + h/netinet/tcp_seq.h | 88 + h/netinet/tcp_timer.h | 155 + h/netinet/tcp_var.h | 319 + h/netinet/tcpip.h | 91 + h/netinet/udp.h | 76 + h/netinet/udp_var.h | 126 + h/nfsDrv.h | 43 + h/nfsLib.h | 44 + h/nfsdLib.h | 25 + h/nmpipe.h | 36 + h/ntPassFsLib.h | 105 + h/objLib.h | 83 + h/objLibCommon.h | 57 + h/oemtypes.h | 47 + h/opc_ae.h | 461 + h/opccomn.h | 205 + h/opcda.h | 1037 ++ h/openssl/aes.h | 3 + h/openssl/asn1.h | 1230 ++ h/openssl/asn1_mac.h | 571 + h/openssl/asn1t.h | 886 ++ h/openssl/bio.h | 767 ++ h/openssl/blowfish.h | 3 + h/openssl/bn.h | 857 ++ h/openssl/buffer.h | 118 + h/openssl/cast.h | 4 + h/openssl/comp.h | 66 + h/openssl/compatibility.h | 44 + h/openssl/conf.h | 253 + h/openssl/conf_api.h | 89 + h/openssl/crypto.h | 550 + h/openssl/des.h | 4 + h/openssl/des_old.h | 4 + h/openssl/dh.h | 223 + h/openssl/dsa.h | 279 + h/openssl/dso.h | 368 + h/openssl/dtls1.h | 212 + h/openssl/e_os2.h | 285 + h/openssl/ebcdic.h | 19 + h/openssl/ec.h | 4 + h/openssl/engine.h | 4 + h/openssl/err.h | 320 + h/openssl/evp.h | 948 ++ h/openssl/hmac.h | 108 + h/openssl/idea.h | 4 + h/openssl/krb5_asn.h | 256 + h/openssl/kssl.h | 179 + h/openssl/lhash.h | 200 + h/openssl/md2.h | 4 + h/openssl/md4.h | 4 + h/openssl/md5.h | 4 + h/openssl/obj_mac.h | 3305 +++++ h/openssl/objects.h | 1049 ++ h/openssl/ocsp.h | 614 + h/openssl/opensslconf.h | 241 + h/openssl/opensslv.h | 89 + h/openssl/ossl_typ.h | 174 + h/openssl/pem.h | 737 ++ h/openssl/pem2.h | 70 + h/openssl/pkcs12.h | 333 + h/openssl/pkcs7.h | 463 + h/openssl/pq_compat.h | 147 + h/openssl/pqueue.h | 95 + h/openssl/private/e_os.h | 663 + h/openssl/rand.h | 141 + h/openssl/rc2.h | 4 + h/openssl/rc4.h | 4 + h/openssl/ripemd.h | 4 + h/openssl/rsa.h | 429 + h/openssl/safestack.h | 1784 +++ h/openssl/sha.h | 4 + h/openssl/ssl.h | 1961 +++ h/openssl/ssl2.h | 268 + h/openssl/ssl23.h | 83 + h/openssl/ssl3.h | 551 + h/openssl/stack.h | 109 + h/openssl/store.h | 554 + h/openssl/symhacks.h | 383 + h/openssl/tls1.h | 291 + h/openssl/tmdiff.h | 93 + h/openssl/txt_db.h | 109 + h/openssl/ui.h | 381 + h/openssl/ui_compat.h | 83 + h/openssl/wr_err.h | 52 + h/openssl/x509.h | 1340 ++ h/openssl/x509_vfy.h | 527 + h/openssl/x509v3.h | 759 ++ h/passFsLib.h | 71 + h/pathLib.h | 54 + h/pci.h | 56 + h/pciClass.h | 290 + h/pciVendor.h | 28 + h/pfw/pfw.h | 204 + h/pfw/pfwComponent.h | 56 + h/pfw/pfwEvent.h | 49 + h/pfw/pfwInterface.h | 72 + h/pfw/pfwLayer.h | 89 + h/pfw/pfwMemory.h | 29 + h/pfw/pfwProfile.h | 67 + h/pfw/pfwStack.h | 100 + h/pfw/pfwTable.h | 52 + h/pfw/pfwTimer.h | 67 + h/pingLib.h | 102 + h/pipeDrv.h | 37 + h/pmLib.h | 106 + h/poolLib.h | 82 + h/posixName.h | 41 + h/posixShow.h | 41 + h/ppp/bacpInterfaces.h | 101 + h/ppp/interfaces/adapterComponentInterfaces.h | 116 + h/ppp/interfaces/authInfoInterface.h | 53 + .../componentAcceptableProtocolsInterface.h | 56 + h/ppp/interfaces/framingComponentInterfaces.h | 46 + h/ppp/interfaces/ipcpInterfaces.h | 53 + h/ppp/interfaces/lcpInterfaces.h | 307 + h/ppp/interfaces/mpFramingLayerInterfaces.h | 76 + h/ppp/interfaces/pppControlLayerInterface.h | 138 + .../interfaces/pppControlProtocolInterface.h | 95 + h/ppp/interfaces/pppHcInterfaces.h | 63 + .../interfaces/pppInterfacesGroupInterfaces.h | 232 + h/ppp/interfaces/pppIpInterfaces.h | 135 + h/ppp/interfaces/pppLinkIdInterface.h | 48 + h/ppp/interfaces/pppModemInterface.h | 90 + h/ppp/interfaces/pppRadiusInterface.h | 85 + h/ppp/interfaces/pppVjcInterfaces.h | 51 + h/ppp/interfaces/pppVsidInterface.h | 52 + h/ppp/kbacpif.h | 145 + h/ppp/kppp.h | 493 + h/ppp/kstart.h | 156 + h/ppp/m2pppIpcpGroup.h | 73 + h/ppp/m2pppLib.h | 55 + h/ppp/m2pppLinkGroup.h | 92 + h/ppp/m2pppSecurityConfig.h | 49 + h/ppp/m2pppSecuritySecretsLib.h | 199 + h/ppp/magic.h | 53 + h/ppp/mp.h | 107 + h/ppp/mpAPI.h | 146 + h/ppp/portmanager.h | 72 + h/ppp/pppAdapterLayer.h | 31 + h/ppp/pppAsyncFramingComponent.h | 31 + h/ppp/pppBacpComponent.h | 86 + h/ppp/pppBitSyncFramingComponent.h | 31 + h/ppp/pppChapComponent.h | 47 + h/ppp/pppChecksum.h | 43 + h/ppp/pppControlLayer.h | 36 + h/ppp/pppFramingLayer.h | 31 + h/ppp/pppHeaderCompression.h | 112 + h/ppp/pppInterfaceLayer.h | 31 + h/ppp/pppInterfaces.h | 312 + h/ppp/pppIpcpComponent.h | 58 + h/ppp/pppIpv6cpComponent.h | 66 + h/ppp/pppLacStructures.h | 49 + h/ppp/pppLcpComponent.h | 91 + h/ppp/pppMPFramingLayer.h | 32 + h/ppp/pppMPInterfaceLayer.h | 30 + h/ppp/pppMuxAdapter.h | 78 + h/ppp/pppNetworkLayer.h | 31 + h/ppp/pppOEthernet.h | 117 + h/ppp/pppPapComponent.h | 42 + h/ppp/pppSioAdapter.h | 53 + h/ppp/pppVjcComponent.h | 31 + h/ppp/pppVsEndComponent.h | 58 + h/ppp/rasamm.h | 75 + h/ppp/snmpAgent/leaf1471.h | 90 + h/ppp/snmpAgent/leaf1472.h | 71 + h/ppp/snmpAgent/leaf1473.h | 63 + h/ppp/snmpAgent/snmp1471.h | 31 + h/ppp/snmpAgent/snmp1472.h | 33 + h/ppp/snmpAgent/snmp1473.h | 32 + h/ppp/usrPPPConfig.h | 271 + h/pppLib.h | 46 + h/private/adrSpaceLibP.h | 92 + h/private/aioPxLibP.h | 170 + h/private/assertAltern.h | 32 + h/private/bpfLibP.h | 184 + h/private/cbioLibP.h | 147 + h/private/cdromFsLibP.h | 675 + h/private/cdromFsVersionP.h | 40 + h/private/classLibP.h | 129 + h/private/connLibP.h | 39 + h/private/coprocLibP.h | 66 + h/private/coreDumpLibP.h | 295 + h/private/cplusLibP.h | 298 + h/private/cplusLoadP.h | 54 + h/private/cplusXtorsP.h | 49 + h/private/cpuPwrLibP.h | 115 + h/private/dbgLibP.h | 65 + h/private/dbgRtpLibP.h | 30 + h/private/dbgTaskLibP.h | 91 + h/private/distObjTypeP.h | 43 + h/private/dosDirLibP.h | 204 + h/private/dosFsFatP.h | 79 + h/private/dosFsLibP.h | 888 ++ h/private/dosFsVerP.h | 60 + h/private/edrLibP.h | 77 + h/private/eventLibP.h | 131 + h/private/eventP.h | 2621 ++++ h/private/eventSysCall.h | 57 + h/private/evtLogLibP.h | 81 + h/private/excLibP.h | 63 + h/private/fioLibP.h | 75 + h/private/floatioP.h | 76 + h/private/ftpLibP.h | 36 + h/private/funcBindP.h | 377 + h/private/fvwriteP.h | 85 + h/private/handleLibP.h | 90 + h/private/hashLibP.h | 42 + h/private/hrFsLibP.h | 379 + h/private/iosLibP.h | 304 + h/private/isrLibP.h | 69 + h/private/jobLibP.h | 40 + h/private/kernelBaseLibP.h | 72 + h/private/kernelLibP.h | 61 + h/private/ledLibP.h | 139 + h/private/loadElfLibP.h | 236 + h/private/loadFileLibP.h | 212 + h/private/loadLibP.h | 242 + h/private/loadRtpLibP.h | 197 + h/private/loadShareLibP.h | 40 + h/private/localeP.h | 56 + h/private/logLibP.h | 44 + h/private/m2LibP.h | 129 + h/private/mathP.h | 84 + h/private/memEdrLibP.h | 325 + h/private/memInfoP.h | 52 + h/private/memPartLibP.h | 464 + h/private/mmanP.h | 42 + h/private/mmuSoftLibP.h | 26 + h/private/moduleLibP.h | 115 + h/private/mqPxLibP.h | 92 + h/private/mqPxSysCall.h | 52 + h/private/mqueueP.h | 42 + h/private/msgQLibP.h | 123 + h/private/msgQSmLibP.h | 111 + h/private/msgQSysCall.h | 30 + h/private/mutexPxLibP.h | 43 + h/private/muxLibP.h | 136 + h/private/nbioLogLibP.h | 240 + h/private/nfsHashP.h | 38 + h/private/objLibP.h | 539 + h/private/objSysCall.h | 52 + h/private/offsetsP.h | 50 + h/private/pciIntLibP.h | 33 + h/private/pfw/pfwEventP.h | 79 + h/private/pfw/pfwInterfaceP.h | 46 + h/private/pfw/pfwMemoryP.h | 91 + h/private/pfw/pfwP.h | 74 + h/private/pfw/pfwProfileP.h | 142 + h/private/pfw/pfwStackP.h | 102 + h/private/pfw/pfwTimerP.h | 90 + h/private/pfw/pfwUtilP.h | 283 + h/private/pgMgrLibP.h | 188 + h/private/pgPoolLibP.h | 290 + h/private/pgPoolPhysLibP.h | 52 + h/private/pgPoolVirtLibP.h | 51 + h/private/poolLibP.h | 134 + h/private/ppp/bacpstate.h | 154 + h/private/ppp/bapsend.h | 65 + h/private/ppp/listutls.h | 43 + h/private/ppp/mpFramingLayerP.h | 99 + h/private/ppp/mpInterfaceLayerP.h | 61 + h/private/ppp/mpP.h | 337 + h/private/ppp/pppBacpComponentP.h | 221 + h/private/ppp/pppIpState.h | 145 + h/private/ppp/pppIpcpComponentP.h | 171 + h/private/ppp/pppIpv6cpComponentP.h | 112 + h/private/ppp/pppLcpComponentP.h | 227 + h/private/ppp/pppNcpComponentP.h | 99 + h/private/ppp/pppNcpLibP.h | 211 + h/private/ppp/pppoptn.h | 216 + h/private/ppp/pppstate.h | 116 + h/private/ppp/rasammP.h | 154 + h/private/ppp/vbacpstr.h | 193 + h/private/ppp/vbacputil.h | 74 + h/private/ppp/vbapstr.h | 470 + h/private/ppp/vlcpstr.h | 485 + h/private/ppp/vncpstr.h | 199 + h/private/ppp/vnipstr.h | 222 + h/private/ppp/vpppastr.h | 131 + h/private/ppp/vpppstr.h | 248 + h/private/print64Lib.h | 39 + h/private/pxObjSysCall.h | 69 + h/private/rtpIoLibP.h | 52 + h/private/rtpLibP.h | 320 + h/private/rtpPthreadLibP.h | 89 + h/private/rtpSigLibP.h | 258 + h/private/rtpUtilLibP.h | 95 + h/private/scMemValP.h | 28 + h/private/schedP.h | 42 + h/private/sdLibP.h | 90 + h/private/selectLibP.h | 90 + h/private/semLibP.h | 306 + h/private/semPxLibP.h | 57 + h/private/semPxSysCall.h | 43 + h/private/semSmLibP.h | 89 + h/private/semSysCall.h | 60 + h/private/seqDrvP.h | 46 + h/private/setLibP.h | 82 + h/private/shellDataLibP.h | 39 + h/private/shellInOutLibP.h | 100 + h/private/shellInternalLibP.h | 261 + h/private/shellInterpLibP.h | 57 + h/private/shellLibP.h | 165 + h/private/shellMemLibP.h | 56 + h/private/shlLibP.h | 75 + h/private/sigLibP.h | 140 + h/private/sigeventP.h | 36 + h/private/smFixBlkLibP.h | 83 + h/private/smMemLibP.h | 148 + h/private/smNameLibP.h | 88 + h/private/smObjLibP.h | 89 + h/private/stdioP.h | 164 + h/private/strStateP.h | 50 + h/private/strxfrmP.h | 56 + h/private/symLibP.h | 93 + h/private/symbolP.h | 77 + h/private/syscallLibP.h | 179 + h/private/taskLibP.h | 300 + h/private/taskMemLibP.h | 68 + h/private/taskPxLibCommonP.h | 68 + h/private/taskPxLibP.h | 38 + h/private/taskSysCall.h | 102 + h/private/taskULibP.h | 229 + h/private/taskUtilLibP.h | 285 + h/private/taskWaitShowP.h | 25 + h/private/timeP.h | 109 + h/private/timerLibP.h | 140 + h/private/timerSysCall.h | 46 + h/private/trcLibP.h | 104 + h/private/trgLibP.h | 94 + h/private/trigP.h | 270 + h/private/usrLibP.h | 50 + h/private/usrRtpLibP.h | 41 + h/private/virtualDiskLibP.h | 28 + h/private/vmInvTblLibP.h | 30 + h/private/vmLibP.h | 486 + h/private/vnodeAffLibP.h | 34 + h/private/vxmIfLibP.h | 145 + h/private/vxmIfLibP2.h | 172 + h/private/vxsimHostLibP.h | 122 + h/private/wdLibP.h | 69 + h/private/windLibP.h | 81 + h/private/windPwrLibP.h | 48 + h/private/workQLibP.h | 86 + h/private/wtxexchp.h | 52 + h/private/wtxp.h | 123 + h/private/wvBufferP.h | 60 + h/private/wvFileUploadPathLibP.h | 44 + h/private/wvHostLibP.h | 46 + h/private/wvLibP.h | 125 + h/private/wvNetEventP.h | 564 + h/private/wvSockUploadPathLibP.h | 49 + h/private/wvTsfsUploadPathLibP.h | 42 + h/private/wvUploadPathP.h | 42 + h/proxyArpLib.h | 125 + h/proxyLib.h | 38 + h/pthread.h | 375 + h/pthreadCommon.h | 33 + h/ptrace.h | 61 + h/ptyDrv.h | 65 + h/ptyLib.h | 98 + h/qClass.h | 88 + h/qFifoGLib.h | 83 + h/qFifoLib.h | 83 + h/qJobLib.h | 111 + h/qLib.h | 391 + h/qPriBMapLib.h | 122 + h/qPriDeltaLib.h | 81 + h/qPriHeapLib.h | 117 + h/qPriLTreeLib.h | 77 + h/qPriListLib.h | 117 + h/qPriNode.h | 64 + h/qPxPriBMapLib.h | 36 + h/rBuffLib.h | 360 + h/ramDiskCbio.h | 43 + h/ramDrv.h | 46 + h/rawFsLib.h | 111 + h/rdiscLib.h | 51 + h/rebootLib.h | 50 + h/reg.h | 193 + h/regex.h | 139 + h/regex2.h | 231 + h/regs.h | 122 + h/remLib.h | 84 + h/resolv/nameser.h | 284 + h/resolv/resolv.h | 184 + h/resolvLib.h | 115 + h/rip/defs.h | 234 + h/rip/interface.h | 163 + h/rip/m2RipLib.h | 146 + h/rip/rip2.h | 87 + h/rip/ripLib.h | 190 + h/rip/table.h | 179 + h/rlogLib.h | 51 + h/rngLib.h | 149 + h/romfs.h | 111 + h/romfsDrv.h | 38 + h/romfsLib.h | 56 + h/routeEnhLib.h | 242 + h/routeLib.h | 73 + h/rpc/auth.h | 216 + h/rpc/auth_unix.h | 113 + h/rpc/clnt.h | 433 + h/rpc/get_myaddr.h | 38 + h/rpc/pmap_clnt.h | 123 + h/rpc/pmap_prot.h | 132 + h/rpc/pmap_rmt.h | 94 + h/rpc/portmap.h | 41 + h/rpc/rpc.h | 106 + h/rpc/rpcGbl.h | 178 + h/rpc/rpc_msg.h | 240 + h/rpc/rpc_prot.h | 48 + h/rpc/rpcnetdb.h | 36 + h/rpc/rpctypes.h | 97 + h/rpc/svc.h | 379 + h/rpc/svc_auth.h | 82 + h/rpc/svc_auth_uni.h | 40 + h/rpc/types.h | 12 + h/rpc/xdr.h | 460 + h/rpcLib.h | 76 + h/rt11FsLib.h | 244 + h/rtpIoLib.h | 52 + h/rtpLib.h | 69 + h/rtpLibCommon.h | 137 + h/rtpVarLib.h | 38 + h/rtpVarLibCommon.h | 29 + h/scMemVal.h | 41 + h/sched.h | 72 + h/scsi1Lib.h | 599 + h/scsi2Lib.h | 1282 ++ h/scsiLib.h | 63 + h/sdLib.h | 51 + h/sdLibCommon.h | 153 + h/selectLib.h | 104 + h/semEvLib.h | 44 + h/semLib.h | 211 + h/semLibCommon.h | 152 + h/semPxShow.h | 39 + h/semSmLib.h | 47 + h/semaphore.h | 60 + h/semaphoreCommon.h | 58 + h/seqIo.h | 57 + h/setLib.h | 87 + h/setjmp.h | 79 + h/shellConfigLib.h | 62 + h/shellDataLib.h | 62 + h/shellInterpCmdLib.h | 103 + h/shellInterpLib.h | 86 + h/shellLib.h | 184 + h/shellPromptLib.h | 40 + h/shlLib.h | 44 + h/shlLibCommon.h | 71 + h/sigCodes.h | 56 + h/sigLib.h | 53 + h/sigevent.h | 39 + h/sigeventCommon.h | 47 + h/signal.h | 296 + h/simLib.h | 91 + h/sioLib.h | 126 + h/sioLibCommon.h | 154 + h/sllLib.h | 264 + h/smDllLib.h | 179 + h/smLib.h | 288 + h/smMemLib.h | 62 + h/smNameLib.h | 74 + h/smObjLib.h | 252 + h/smPktLib.h | 222 + h/smUtilLib.h | 96 + h/snark.h | 38 + h/snmpdLib.h | 110 + h/snmptalk.h | 44 + h/sntp.h | 143 + h/sntpcLib.h | 44 + h/sntpsLib.h | 71 + h/sockFunc.h | 79 + h/sockLib.h | 98 + h/socket.h | 11 + h/som_coff.h | 506 + h/speLib.h | 64 + h/spyLib.h | 61 + h/stat.h | 26 + h/stdio.h | 377 + h/stdioLib.h | 25 + h/stdlib.h | 191 + h/strLib.h | 25 + h/strSearchLib.h | 41 + h/string.h | 151 + h/sun.h | 54 + h/symLib.h | 131 + h/symSync.h | 37 + h/symSyncLib.h | 52 + h/symUtilLib.h | 56 + h/symbol.h | 102 + h/sys/fcntlcom.h | 179 + h/sys/ioctl.h | 164 + h/sys/mman.h | 89 + h/sys/resource.h | 53 + h/sys/socket.h | 384 + h/sys/stat.h | 163 + h/sys/sysctl.h | 589 + h/sys/sysctlCommon.h | 556 + h/sys/taskDefs.h | 50 + h/sys/times.h | 62 + h/sys/types.h | 56 + h/sys/un.h | 40 + h/sys/vxLibCfgDefsP.h | 162 + h/sys/wait.h | 62 + h/sysLib.h | 316 + h/sysSymTbl.h | 48 + h/syscall.h | 194 + h/syscallArgs.h | 76 + h/syscallLib.h | 68 + h/syscallTbl.h | 449 + h/systime.h | 37 + h/tapeFsLib.h | 153 + h/tarLib.h | 41 + h/taskArchLib.h | 65 + h/taskHookLib.h | 71 + h/taskLib.h | 828 ++ h/taskLibCommon.h | 240 + h/taskUtilLib.h | 81 + h/taskVarLib.h | 65 + h/taskWaitShow.h | 24 + h/telnetLib.h | 163 + h/tffs/backgrnd.h | 46 + h/tffs/dosformt.h | 227 + h/tffs/fatlite.h | 878 ++ h/tffs/flbase.h | 267 + h/tffs/flbuffer.h | 36 + h/tffs/flcustom.h | 303 + h/tffs/flflash.h | 206 + h/tffs/flsocket.h | 269 + h/tffs/flsysfun.h | 314 + h/tffs/flsystem.h | 287 + h/tffs/fltl.h | 77 + h/tffs/pcic.h | 103 + h/tffs/reedsol.h | 32 + h/tffs/stdcomp.h | 59 + h/tffs/tffsDrv.h | 204 + h/tftpLib.h | 224 + h/tftpdLib.h | 65 + h/tickLib.h | 47 + h/time.h | 164 + h/timers.h | 41 + h/timexLib.h | 65 + h/tipc/sm_media.h | 75 + h/tipc/tipc.h | 684 + h/tool/common/defs.arm | 35 + h/tool/common/defs.common | 68 + h/tool/common/defs.mips | 121 + h/tool/common/defs.ppc | 266 + h/tool/common/ldscripts/genScript.sh | 341 + h/tool/common/ldscripts/regen.sh | 98 + h/tool/diab/defs.arm | 36 + h/tool/diab/defs.diab | 366 + h/tool/diab/defs.mips | 23 + h/tool/diab/intrinsics.h | 22 + h/tool/diab/ldscripts/Makefile | 22 + h/tool/diab/ldscripts/link.DOTBOOTRAM | 93 + h/tool/diab/ldscripts/link.DOTBOOTROM | 93 + h/tool/diab/ldscripts/link.MIPSRAM | 89 + h/tool/diab/ldscripts/link.MIPSROM | 89 + h/tool/diab/ldscripts/link.RAM | 84 + h/tool/diab/ldscripts/link.ROM | 84 + h/tool/diab/limits.h | 28 + h/tool/diab/make.ARMARCH5diab | 25 + h/tool/diab/make.ARMARCH5diabbe | 22 + h/tool/diab/make.ARMARCH6diab | 19 + h/tool/diab/make.ARMARCH6diabbe | 19 + h/tool/diab/make.I80486diab | 28 + h/tool/diab/make.MIPS32sfdiab | 38 + h/tool/diab/make.MIPS32sfdiable | 38 + h/tool/diab/make.MIPS64diab | 39 + h/tool/diab/make.MIPS64diable | 40 + h/tool/diab/make.PENTIUM2diab | 34 + h/tool/diab/make.PENTIUM3diab | 35 + h/tool/diab/make.PENTIUM4diab | 34 + h/tool/diab/make.PENTIUMdiab | 30 + h/tool/diab/make.PPC32diab | 75 + h/tool/diab/make.PPC32sfdiab | 42 + h/tool/diab/make.PPC403diab | 37 + h/tool/diab/make.PPC405diab | 38 + h/tool/diab/make.PPC405sfdiab | 38 + h/tool/diab/make.PPC440diab | 35 + h/tool/diab/make.PPC440sfdiab | 35 + h/tool/diab/make.PPC603diab | 30 + h/tool/diab/make.PPC604diab | 49 + h/tool/diab/make.PPC85XXdiab | 44 + h/tool/diab/make.PPC85XXsfdiab | 44 + h/tool/diab/make.PPC860sfdiab | 28 + h/tool/diab/make.SH7750diab | 30 + h/tool/diab/make.SH7750diable | 31 + h/tool/diab/make.SIMLINUXdiab | 28 + h/tool/diab/make.SIMNTdiab | 28 + h/tool/diab/make.SIMSPARCSOLARISdiab | 28 + h/tool/diab/make.XSCALEdiab | 25 + h/tool/diab/make.XSCALEdiabbe | 22 + h/tool/diab/toolMacros.h | 130 + h/tool/gnu/defs.arm | 46 + h/tool/gnu/defs.gnu | 269 + h/tool/gnu/defs.mips | 83 + h/tool/gnu/intrinsics.h | 22 + h/tool/gnu/ldscripts/Makefile | 22 + h/tool/gnu/ldscripts/link.AOUTRAM | 104 + h/tool/gnu/ldscripts/link.AOUTROM | 104 + h/tool/gnu/ldscripts/link.DOTBOOTRAM | 146 + h/tool/gnu/ldscripts/link.DOTBOOTROM | 146 + h/tool/gnu/ldscripts/link.MIPSRAM | 142 + h/tool/gnu/ldscripts/link.MIPSROM | 142 + h/tool/gnu/ldscripts/link.OUT | 137 + h/tool/gnu/ldscripts/link.RAM | 137 + h/tool/gnu/ldscripts/link.ROM | 137 + h/tool/gnu/ldscripts/link.SIMNT | 110 + h/tool/gnu/limits.h | 98 + h/tool/gnu/make.ARMARCH5gnu | 35 + h/tool/gnu/make.ARMARCH5gnube | 39 + h/tool/gnu/make.ARMARCH6gnu | 20 + h/tool/gnu/make.ARMARCH6gnube | 20 + h/tool/gnu/make.I80486gnu | 62 + h/tool/gnu/make.MIPS32sfgnu | 40 + h/tool/gnu/make.MIPS32sfgnule | 42 + h/tool/gnu/make.MIPS64gnu | 36 + h/tool/gnu/make.MIPS64gnule | 38 + h/tool/gnu/make.PENTIUM2gnu | 44 + h/tool/gnu/make.PENTIUM3gnu | 50 + h/tool/gnu/make.PENTIUM4gnu | 49 + h/tool/gnu/make.PENTIUMgnu | 49 + h/tool/gnu/make.PPC32gnu | 72 + h/tool/gnu/make.PPC32sfgnu | 48 + h/tool/gnu/make.PPC403gnu | 62 + h/tool/gnu/make.PPC405gnu | 54 + h/tool/gnu/make.PPC405sfgnu | 54 + h/tool/gnu/make.PPC440gnu | 48 + h/tool/gnu/make.PPC440sfgnu | 48 + h/tool/gnu/make.PPC603gnu | 58 + h/tool/gnu/make.PPC604gnu | 63 + h/tool/gnu/make.PPC85XXgnu | 67 + h/tool/gnu/make.PPC85XXsfgnu | 66 + h/tool/gnu/make.PPC860sfgnu | 37 + h/tool/gnu/make.SH7750gnu | 59 + h/tool/gnu/make.SH7750gnule | 57 + h/tool/gnu/make.SIMLINUXgnu | 33 + h/tool/gnu/make.SIMNTgnu | 57 + h/tool/gnu/make.SIMSPARCSOLARISgnu | 64 + h/tool/gnu/make.XSCALEgnu | 34 + h/tool/gnu/make.XSCALEgnube | 22 + h/tool/gnu/toolMacros.h | 176 + h/transCbio.h | 157 + h/trcLib.h | 52 + h/trgLib.h | 104 + h/ttyLib.h | 33 + h/tyLib.h | 146 + h/types.h | 26 + h/types/vxANSI.h | 53 + h/types/vxArch.h | 249 + h/types/vxCpu.h | 399 + h/types/vxCpu.in | 128 + h/types/vxParams.h | 61 + h/types/vxTypes.h | 250 + h/types/vxTypesBase.h | 403 + h/types/vxTypesOld.h | 362 + h/types/vxWind.h | 90 + h/types/vxWindCommon.h | 112 + h/u_Lib.h | 420 + h/unistd.h | 150 + h/unldLib.h | 72 + h/usb/ossLib.h | 296 + h/usb/pciConstants.h | 148 + h/usb/target/usbHal.h | 93 + h/usb/target/usbHalCommon.h | 57 + h/usb/target/usbHalDebug.h | 68 + h/usb/target/usbHalLib.h | 118 + h/usb/target/usbIsaLib.h | 163 + h/usb/target/usbPeriphInstr.h | 97 + h/usb/target/usbTargLib.h | 345 + h/usb/target/usbTargPhilipsD12EvalLib.h | 36 + h/usb/target/usbTargUtil.h | 47 + h/usb/target/usbTcd.h | 322 + h/usb/target/usbTcdLib.h | 152 + h/usb/target/usbTcdPdiusbd12EvalLib.h | 58 + h/usb/tools/cmdParser.h | 205 + h/usb/tools/wavFormat.h | 90 + h/usb/usb.h | 701 ++ h/usb/usbAudio.h | 704 ++ h/usb/usbCommdevices.h | 84 + h/usb/usbDescrCopyLib.h | 71 + h/usb/usbEnet.h | 128 + h/usb/usbHandleLib.h | 115 + h/usb/usbHcdLib.h | 166 + h/usb/usbHid.h | 146 + h/usb/usbLib.h | 130 + h/usb/usbListLib.h | 129 + h/usb/usbMassStorage.h | 46 + h/usb/usbPciLib.h | 240 + h/usb/usbPlatform.h | 107 + h/usb/usbPrinter.h | 80 + h/usb/usbQueueLib.h | 125 + h/usb/usbdCoreLib.h | 513 + h/usb/usbdLib.h | 506 + h/usb/usbdStructures.h | 313 + h/usb2/BusAbstractionLayer.h | 329 + h/usb2/usbEhcdConfig.h | 60 + h/usb2/usbEhcdDataStructures.h | 1064 ++ h/usb2/usbEhcdDebug.h | 87 + h/usb2/usbEhcdEventHandler.h | 64 + h/usb2/usbEhcdHal.h | 2610 ++++ h/usb2/usbEhcdInitExit.h | 63 + h/usb2/usbEhcdInterfaces.h | 135 + h/usb2/usbEhcdRhEmulation.h | 125 + h/usb2/usbEhcdUtil.h | 989 ++ h/usb2/usbHcdInstr.h | 90 + h/usb2/usbHst.h | 1420 +++ h/usb2/usbHubBusManager.h | 83 + h/usb2/usbHubClassInterface.h | 266 + h/usb2/usbHubCommon.h | 715 ++ h/usb2/usbHubEventHandler.h | 87 + h/usb2/usbHubGlobalVariables.h | 72 + h/usb2/usbHubHostStackInterface.h | 95 + h/usb2/usbHubInitialization.h | 94 + h/usb2/usbHubMisc.h | 91 + h/usb2/usbHubPortEventHandler.h | 85 + h/usb2/usbHubTemplate.h | 82 + h/usb2/usbHubUtility.h | 425 + h/usb2/usbOhci.h | 158 + h/usb2/usbOhciRegisterInfo.h | 365 + h/usb2/usbOhciTransferManagement.h | 1297 ++ h/usb2/usbOsal.h | 781 ++ h/usb2/usbOsalDebug.h | 190 + h/usb2/usbUhcdCommon.h | 82 + h/usb2/usbUhcdRhEmulate.h | 258 + h/usb2/usbUhcdScheduleQSupport.h | 586 + h/usb2/usbUhcdScheduleQueue.h | 909 ++ h/usb2/usbUhcdSupport.h | 287 + h/usb2/usbUhci.h | 129 + h/usb2/usbd.h | 707 ++ h/usb2/usbdMisc.h | 178 + h/usrConfig.h | 436 + h/usrFdiskPartLib.h | 81 + h/usrFsLib.h | 54 + h/usrLib.h | 145 + h/usrTransLib.h | 49 + h/utfLib.h | 79 + h/utime.h | 30 + h/version.h | 93 + h/virtualDiskLib.h | 40 + h/vmLib.h | 227 + h/vmLibCommon.h | 133 + h/vme.h | 71 + h/vnode.h | 723 ++ h/vwModNum.h | 324 + h/vxBusLib.h | 90 + h/vxLib.h | 129 + h/vxStream.h | 230 + h/vxWorks.h | 129 + h/vxWorksCommon.h | 289 + h/vxfusion/distIfLib.h | 79 + h/vxfusion/distLib.h | 84 + h/vxfusion/distNameLib.h | 78 + h/vxfusion/distNetLib.h | 59 + h/vxfusion/distNodeLib.h | 45 + h/vxfusion/distStatLib.h | 70 + h/vxfusion/distTBufLib.h | 90 + h/vxfusion/msgQDistGrpLib.h | 56 + h/vxfusion/msgQDistGrpShow.h | 42 + h/vxfusion/msgQDistLib.h | 72 + h/vxfusion/msgQDistShow.h | 38 + h/vxidl.h | 112 + h/vxsimHostLib.h | 76 + h/vxwErr.h | 55 + h/vxwLoadLib.h | 342 + h/vxwLstLib.h | 364 + h/vxwMemPartLib.h | 286 + h/vxwMsgQLib.h | 435 + h/vxwMutex.h | 102 + h/vxwObject.h | 20 + h/vxwRngLib.h | 251 + h/vxwSemLib.h | 696 + h/vxwSmLib.h | 453 + h/vxwSmNameLib.h | 190 + h/vxwSymLib.h | 314 + h/vxwTaskLib.h | 1008 ++ h/vxwWdLib.h | 217 + h/wait.h | 65 + h/wdLib.h | 104 + h/wdb/dll.h | 57 + h/wdb/wdb.h | 1195 ++ h/wdb/wdbArchIfLib.h | 38 + h/wdb/wdbBpLib.h | 113 + h/wdb/wdbCommIfLib.h | 84 + h/wdb/wdbCtxIfLib.h | 187 + h/wdb/wdbDbgLib.h | 364 + h/wdb/wdbEvtLib.h | 70 + h/wdb/wdbEvtptLib.h | 53 + h/wdb/wdbGopherLib.h | 63 + h/wdb/wdbLib.h | 103 + h/wdb/wdbLibP.h | 135 + h/wdb/wdbMbufLib.h | 97 + h/wdb/wdbMemLib.h | 43 + h/wdb/wdbOsLib.h | 120 + h/wdb/wdbRegs.h | 109 + h/wdb/wdbRpcLib.h | 76 + h/wdb/wdbRtIfLib.h | 229 + h/wdb/wdbRtpLibP.h | 47 + h/wdb/wdbSvcLib.h | 59 + h/wdb/wdbTaskLib.h | 63 + h/wdb/wdbTipcSockLib.h | 38 + h/wdb/wdbTyCoDrv.h | 54 + h/wdb/wdbUdpLib.h | 43 + h/wdb/wdbUdpSockLib.h | 40 + h/wdb/wdbVioLib.h | 76 + h/win_Lib.h | 181 + h/windPwrLib.h | 89 + h/wrProxyLib.h | 41 + h/wrn/arp_if.h | 35 + h/wrn/bridge/bridge.h | 47 + h/wrn/bridge/mirrorEnd.h | 56 + h/wrn/cci/cci.h | 2849 +++++ h/wrn/coreip/IGMPv2/igmpCacheLib.h | 45 + h/wrn/coreip/IGMPv2/igmpPortLib.h | 53 + h/wrn/coreip/IGMPv2/igmpR.h | 42 + h/wrn/coreip/IGMPv2/igmpRouterLib.h | 117 + h/wrn/coreip/IGMPv2/igmp_constants.h | 159 + h/wrn/coreip/IGMPv2/igmp_display_string.h | 100 + h/wrn/coreip/IGMPv2/igmp_externs.h | 35 + h/wrn/coreip/IGMPv2/igmp_globals.h | 20 + h/wrn/coreip/IGMPv2/igmp_prototypes.h | 67 + h/wrn/coreip/IGMPv2/igmp_state_machine.h | 426 + .../IGMPv2/igmp_state_machine_structures.h | 43 + h/wrn/coreip/IGMPv2/igmp_structures.h | 195 + h/wrn/coreip/adv_net.h | 112 + h/wrn/coreip/applUtilLib.h | 642 + h/wrn/coreip/arch/arm/ansi.h | 147 + h/wrn/coreip/arch/arm/endian.h | 142 + h/wrn/coreip/arch/arm/machdep.h | 50 + h/wrn/coreip/arch/arm/param.h | 191 + h/wrn/coreip/arch/mips/ansi.h | 148 + h/wrn/coreip/arch/mips/endian.h | 142 + h/wrn/coreip/arch/mips/machdep.h | 50 + h/wrn/coreip/arch/mips/param.h | 190 + h/wrn/coreip/arch/pentium/ansi.h | 144 + h/wrn/coreip/arch/pentium/endian.h | 143 + h/wrn/coreip/arch/pentium/machdep.h | 51 + h/wrn/coreip/arch/pentium/param.h | 191 + h/wrn/coreip/arch/ppc/ansi.h | 145 + h/wrn/coreip/arch/ppc/endian.h | 124 + h/wrn/coreip/arch/ppc/machdep.h | 39 + h/wrn/coreip/arch/ppc/param.h | 187 + h/wrn/coreip/arch/sh/ansi.h | 143 + h/wrn/coreip/arch/sh/endian.h | 152 + h/wrn/coreip/arch/sh/machdep.h | 49 + h/wrn/coreip/arch/sh/param.h | 188 + h/wrn/coreip/arch/simpentium/ansi.h | 148 + h/wrn/coreip/arch/simpentium/endian.h | 151 + h/wrn/coreip/arch/simpentium/machdep.h | 53 + h/wrn/coreip/arch/simpentium/param.h | 184 + h/wrn/coreip/arch/types.h | 195 + h/wrn/coreip/arpLib.h | 67 + h/wrn/coreip/arpa/inet.h | 88 + h/wrn/coreip/bootpLib.h | 296 + h/wrn/coreip/bpfDrv.h | 48 + h/wrn/coreip/bsdSockLib.h | 119 + h/wrn/coreip/cfgDefs.h | 30 + h/wrn/coreip/dhcp/common.h | 391 + h/wrn/coreip/dhcp/common_subr.h | 106 + h/wrn/coreip/dhcp/copyright_dhcp.h | 48 + h/wrn/coreip/dhcp/database.h | 259 + h/wrn/coreip/dhcp/dhcp.h | 293 + h/wrn/coreip/dhcp/dhcpc.h | 355 + h/wrn/coreip/dhcp/dhcpcBoot.h | 91 + h/wrn/coreip/dhcp/dhcpcCommonLib.h | 198 + h/wrn/coreip/dhcp/dhcpcInit.h | 48 + h/wrn/coreip/dhcp/dhcpcInternal.h | 99 + h/wrn/coreip/dhcp/dhcpcShow.h | 27 + h/wrn/coreip/dhcp/dhcpcStateLib.h | 55 + h/wrn/coreip/dhcp/dhcps.h | 244 + h/wrn/coreip/dhcp/hash.h | 86 + h/wrn/coreip/dhcp6Lib.h | 99 + h/wrn/coreip/dhcp6cShow.h | 25 + h/wrn/coreip/dhcpcBootLib.h | 45 + h/wrn/coreip/dhcpcLib.h | 63 + h/wrn/coreip/dhcprLib.h | 91 + h/wrn/coreip/dhcpsLib.h | 198 + h/wrn/coreip/dlink/gifNpt.h | 27 + h/wrn/coreip/dlink/qosIngressLib.h | 58 + h/wrn/coreip/dlink/stfNpt.h | 27 + h/wrn/coreip/dlink/tunnelLib.h | 217 + h/wrn/coreip/dlink/vlanTagLib.h | 194 + h/wrn/coreip/etherLib.h | 43 + h/wrn/coreip/etherMultiLib.h | 72 + h/wrn/coreip/fastPath/fastPathFib.h | 184 + h/wrn/coreip/fastPath/fastPathIp.h | 56 + h/wrn/coreip/fastPath/fastPathIpLib.h | 56 + h/wrn/coreip/fastPath/fastPathLib.h | 490 + h/wrn/coreip/fastPath/fastPathMon.h | 82 + h/wrn/coreip/fastPath/fastPathPatTree.h | 246 + h/wrn/coreip/fastPath/fastPathUtil.h | 207 + h/wrn/coreip/filio.h | 90 + h/wrn/coreip/ftp6Lib.h | 177 + h/wrn/coreip/ftpLib.h | 202 + h/wrn/coreip/ftpd6Lib.h | 60 + h/wrn/coreip/ftpdLib.h | 70 + h/wrn/coreip/hostLib.h | 251 + h/wrn/coreip/icmpLib.h | 80 + h/wrn/coreip/if6Lib.h | 73 + h/wrn/coreip/ifIndexLib.h | 37 + h/wrn/coreip/ifLib.h | 61 + h/wrn/coreip/in_cksum.h | 54 + h/wrn/coreip/inetLib.h | 109 + h/wrn/coreip/ioccom.h | 104 + h/wrn/coreip/ip6Lib.h | 103 + h/wrn/coreip/ipLib.h | 116 + h/wrn/coreip/ipProto.h | 186 + h/wrn/coreip/jobQueueLib.h | 141 + h/wrn/coreip/logCategories.h | 62 + h/wrn/coreip/m2IfLib.h | 42 + h/wrn/coreip/m2Ipv6Lib.h | 454 + h/wrn/coreip/m2Lib.h | 1216 ++ h/wrn/coreip/machdep.h | 42 + h/wrn/coreip/mbufLib.h | 171 + h/wrn/coreip/mbufSockLib.h | 57 + h/wrn/coreip/md5.h | 97 + h/wrn/coreip/mib/cidrLeaf.h | 86 + h/wrn/coreip/mib/cidrMapi.h | 78 + h/wrn/coreip/mib/cidrSkel.h | 31 + h/wrn/coreip/mib/mibApi.h | 213 + h/wrn/coreip/mip6/mip6.h | 56 + h/wrn/coreip/mip6/mip6_babymdd.h | 136 + h/wrn/coreip/mip6/mip6_command.h | 90 + h/wrn/coreip/mip6/mip6_constants.h | 52 + h/wrn/coreip/mip6/mip6_had.h | 62 + h/wrn/coreip/mip6/mip6_mnd.h | 96 + h/wrn/coreip/mip6/mip6_shisad.h | 465 + h/wrn/coreip/mip6/mip6_stat.h | 109 + h/wrn/coreip/mountd.h | 154 + h/wrn/coreip/muxL2Lib.h | 285 + h/wrn/coreip/muxLib.h | 210 + h/wrn/coreip/muxTkLib.h | 94 + h/wrn/coreip/net/af.h | 100 + h/wrn/coreip/net/bpf.h | 391 + h/wrn/coreip/net/bpfdesc.h | 121 + h/wrn/coreip/net/domain.h | 104 + h/wrn/coreip/net/ethernet.h | 137 + h/wrn/coreip/net/fastUdp6Lib.h | 115 + h/wrn/coreip/net/fastUdpLib.h | 117 + h/wrn/coreip/net/if.h | 457 + h/wrn/coreip/net/if_arp.h | 177 + h/wrn/coreip/net/if_clone.h | 93 + h/wrn/coreip/net/if_dl.h | 110 + h/wrn/coreip/net/if_llc.h | 172 + h/wrn/coreip/net/if_media.h | 563 + h/wrn/coreip/net/if_mip.h | 90 + h/wrn/coreip/net/if_subr.h | 61 + h/wrn/coreip/net/if_types.h | 246 + h/wrn/coreip/net/if_var.h | 564 + h/wrn/coreip/net/if_vlan_var.h | 79 + h/wrn/coreip/net/ifaddrs.h | 73 + h/wrn/coreip/net/inet.h | 88 + h/wrn/coreip/net/mbuf.h | 568 + h/wrn/coreip/net/mipsock.h | 211 + h/wrn/coreip/net/protosw.h | 360 + h/wrn/coreip/net/radix.h | 213 + h/wrn/coreip/net/raw_cb.h | 113 + h/wrn/coreip/net/route.h | 566 + h/wrn/coreip/net/socketvar.h | 534 + h/wrn/coreip/net/systm.h | 106 + h/wrn/coreip/net/uio.h | 119 + h/wrn/coreip/net/unixLib.h | 123 + h/wrn/coreip/net/utils/ifconfig.h | 77 + h/wrn/coreip/net/utils/ip6addrctl.h | 38 + h/wrn/coreip/net/utils/l2config.h | 32 + h/wrn/coreip/net/utils/ndp.h | 56 + h/wrn/coreip/net/utils/netstat.h | 174 + h/wrn/coreip/net/utils/prefixcmd.h | 40 + h/wrn/coreip/net/utils/routeCmd.h | 38 + h/wrn/coreip/netBufLib.h | 947 ++ h/wrn/coreip/netCore.h | 40 + h/wrn/coreip/netDrv.h | 74 + h/wrn/coreip/netLib.h | 274 + h/wrn/coreip/netShow.h | 82 + h/wrn/coreip/netVersion.h | 40 + h/wrn/coreip/netconf.h | 66 + h/wrn/coreip/netdb.h | 234 + h/wrn/coreip/netffs.h | 193 + h/wrn/coreip/netinet/icmp6.h | 28 + h/wrn/coreip/netinet/icmp_var.h | 128 + h/wrn/coreip/netinet/if_ether.h | 237 + h/wrn/coreip/netinet/igmp.h | 200 + h/wrn/coreip/netinet/igmp_var.h | 212 + h/wrn/coreip/netinet/in.h | 738 ++ h/wrn/coreip/netinet/in_msf.h | 303 + h/wrn/coreip/netinet/in_pcb.h | 401 + h/wrn/coreip/netinet/in_systm.h | 90 + h/wrn/coreip/netinet/in_var.h | 396 + h/wrn/coreip/netinet/ip.h | 243 + h/wrn/coreip/netinet/ip4_ext_in.h | 121 + h/wrn/coreip/netinet/ip4_ext_out.h | 75 + h/wrn/coreip/netinet/ip6.h | 28 + h/wrn/coreip/netinet/ip6mh.h | 357 + h/wrn/coreip/netinet/ip_flow.h | 79 + h/wrn/coreip/netinet/ip_icmp.h | 239 + h/wrn/coreip/netinet/ip_mroute.h | 443 + h/wrn/coreip/netinet/ip_var.h | 318 + h/wrn/coreip/netinet/ipfw.h | 374 + h/wrn/coreip/netinet/ipprotosw.h | 126 + h/wrn/coreip/netinet/pim.h | 143 + h/wrn/coreip/netinet/pim_var.h | 108 + h/wrn/coreip/netinet/sctp.h | 317 + h/wrn/coreip/netinet/sctp_constants.h | 854 ++ h/wrn/coreip/netinet/sctp_header.h | 507 + h/wrn/coreip/netinet/sctp_uio.h | 534 + h/wrn/coreip/netinet/sl_compress.h | 291 + h/wrn/coreip/netinet/sockunion.h | 46 + h/wrn/coreip/netinet/tcp.h | 165 + h/wrn/coreip/netinet/tcp_debug.h | 135 + h/wrn/coreip/netinet/tcp_fsm.h | 118 + h/wrn/coreip/netinet/tcp_seq.h | 120 + h/wrn/coreip/netinet/tcp_timer.h | 183 + h/wrn/coreip/netinet/tcp_var.h | 680 + h/wrn/coreip/netinet/tcpip.h | 104 + h/wrn/coreip/netinet/udp.h | 78 + h/wrn/coreip/netinet/udp_var.h | 175 + h/wrn/coreip/netinet/vsArp.h | 86 + h/wrn/coreip/netinet/vsData.h | 240 + h/wrn/coreip/netinet/vsDhcps.h | 118 + h/wrn/coreip/netinet/vsFastUdp.h | 47 + h/wrn/coreip/netinet/vsHost.h | 66 + h/wrn/coreip/netinet/vsIcmp.h | 65 + h/wrn/coreip/netinet/vsIgmp.h | 72 + h/wrn/coreip/netinet/vsIgmpR.h | 80 + h/wrn/coreip/netinet/vsIp.h | 296 + h/wrn/coreip/netinet/vsLib.h | 564 + h/wrn/coreip/netinet/vsM2.h | 161 + h/wrn/coreip/netinet/vsMcast.h | 184 + h/wrn/coreip/netinet/vsNetCore.h | 118 + h/wrn/coreip/netinet/vsProxyArp.h | 74 + h/wrn/coreip/netinet/vsRadix.h | 65 + h/wrn/coreip/netinet/vsRdisc.h | 68 + h/wrn/coreip/netinet/vsRip.h | 111 + h/wrn/coreip/netinet/vsShow.h | 56 + h/wrn/coreip/netinet/vsTcp.h | 181 + h/wrn/coreip/netinet/vsUdp.h | 69 + h/wrn/coreip/netinet6/icmp6.h | 1011 ++ h/wrn/coreip/netinet6/in6.h | 821 ++ h/wrn/coreip/netinet6/in6_msf.h | 161 + h/wrn/coreip/netinet6/in6_pcb.h | 135 + h/wrn/coreip/netinet6/in6_var.h | 843 ++ h/wrn/coreip/netinet6/ip6.h | 411 + h/wrn/coreip/netinet6/ip6_ext_in.h | 80 + h/wrn/coreip/netinet6/ip6_ext_out.h | 69 + h/wrn/coreip/netinet6/ip6_mroute.h | 304 + h/wrn/coreip/netinet6/ip6_var.h | 477 + h/wrn/coreip/netinet6/mip6.h | 89 + h/wrn/coreip/netinet6/mip6_var.h | 235 + h/wrn/coreip/netinet6/nd6.h | 572 + h/wrn/coreip/netinet6/raw_ip6.h | 79 + h/wrn/coreip/netinet6/scope6_var.h | 88 + h/wrn/coreip/netinet6/tcp6_var.h | 123 + h/wrn/coreip/netinet6/udp6_var.h | 113 + h/wrn/coreip/nfs2Drv.h | 48 + h/wrn/coreip/nfs2Lib.h | 131 + h/wrn/coreip/nfs2dLib.h | 94 + h/wrn/coreip/nfs3Defines.h | 114 + h/wrn/coreip/nfs3Drv.h | 53 + h/wrn/coreip/nfs3Lib.h | 137 + h/wrn/coreip/nfs3dLib.h | 149 + h/wrn/coreip/nfsCommon.h | 217 + h/wrn/coreip/nfsDriver.h | 86 + h/wrn/coreip/nfsd.h | 115 + h/wrn/coreip/nfsdCommon.h | 66 + h/wrn/coreip/nlm4Lib.h | 75 + h/wrn/coreip/osdep.h | 524 + h/wrn/coreip/pathUtilLib.h | 38 + h/wrn/coreip/ping6Lib.h | 44 + h/wrn/coreip/pingLib.h | 107 + h/wrn/coreip/poll.h | 121 + h/wrn/coreip/private/bpfLibP.h | 188 + h/wrn/coreip/private/clarinet.h | 135 + h/wrn/coreip/private/fastPathIpP.h | 62 + h/wrn/coreip/private/fastPathLibP.h | 101 + h/wrn/coreip/private/fastPathPatTreeP.h | 104 + h/wrn/coreip/private/ftpLibP.h | 39 + h/wrn/coreip/private/gtf_core.h | 263 + h/wrn/coreip/private/gtf_util.h | 85 + h/wrn/coreip/private/gtf_wrapper.h | 57 + h/wrn/coreip/private/hostLibInt.h | 79 + h/wrn/coreip/private/jobQueueLibP.h | 91 + h/wrn/coreip/private/m2LibP.h | 136 + h/wrn/coreip/private/muxL2VlanLibP.h | 261 + h/wrn/coreip/private/muxLibP.h | 204 + h/wrn/coreip/private/qosIngressLibP.h | 133 + h/wrn/coreip/private/routeShowP.h | 58 + h/wrn/coreip/private/wvNetDEventP.h | 806 ++ h/wrn/coreip/protos/icmpv6Lib.h | 49 + h/wrn/coreip/protos/igmpLib.h | 53 + h/wrn/coreip/protos/ip6protosw.h | 186 + h/wrn/coreip/protos/mld6_var.h | 126 + h/wrn/coreip/protos/mldLib.h | 39 + h/wrn/coreip/protos/mrouteLib.h | 12 + h/wrn/coreip/protos/nd6Lib.h | 78 + h/wrn/coreip/protos/rarpLib.h | 67 + h/wrn/coreip/protos/sctpLib.h | 83 + h/wrn/coreip/protos/tcpLib.h | 111 + h/wrn/coreip/protos/udpLib.h | 52 + h/wrn/coreip/proxyArpLib.h | 169 + h/wrn/coreip/random.h | 101 + h/wrn/coreip/rdiscLib.h | 77 + h/wrn/coreip/remLib.h | 114 + h/wrn/coreip/resolv/nameser.h | 300 + h/wrn/coreip/resolv/resolv.h | 284 + h/wrn/coreip/resolvLib.h | 189 + h/wrn/coreip/rip/defs.h | 242 + h/wrn/coreip/rip/interface.h | 174 + h/wrn/coreip/rip/m2RipLeaf.h | 84 + h/wrn/coreip/rip/m2RipLib.h | 157 + h/wrn/coreip/rip/rip2.h | 94 + h/wrn/coreip/rip/ripLib.h | 239 + h/wrn/coreip/rip/table.h | 187 + h/wrn/coreip/ripngLib.h | 69 + h/wrn/coreip/rlogLib.h | 120 + h/wrn/coreip/route/avlRouteNodeLib.h | 56 + h/wrn/coreip/route/avltree.h | 213 + h/wrn/coreip/route/ipRouteLib.h | 421 + h/wrn/coreip/route/ipRouteNodeData.h | 52 + h/wrn/coreip/route/ipRouteNodeLib.h | 160 + h/wrn/coreip/route/llRouteNodeLib.h | 73 + h/wrn/coreip/route/ptRouteNodeLib.h | 100 + h/wrn/coreip/routeLib.h | 66 + h/wrn/coreip/rtadv/rtadvd.h | 242 + h/wrn/coreip/rtadv/timer.h | 98 + h/wrn/coreip/rtadvLib.h | 62 + h/wrn/coreip/rtpAppCmdLib.h | 41 + h/wrn/coreip/rtsolLib.h | 54 + h/wrn/coreip/sntp.h | 144 + h/wrn/coreip/sntpcLib.h | 61 + h/wrn/coreip/sntpsLib.h | 73 + h/wrn/coreip/sockFunc.h | 108 + h/wrn/coreip/sockLib.h | 127 + h/wrn/coreip/socket.h | 11 + h/wrn/coreip/sys/callout.h | 126 + h/wrn/coreip/sys/cdefs.h | 371 + h/wrn/coreip/sys/ds_conf.h | 366 + h/wrn/coreip/sys/fnv_hash.h | 70 + h/wrn/coreip/sys/mem_stru.h | 63 + h/wrn/coreip/sys/queue.h | 582 + h/wrn/coreip/sys/socket.h | 554 + h/wrn/coreip/sys/sockio.h | 186 + h/wrn/coreip/sysctlLib.h | 104 + h/wrn/coreip/syslog.h | 299 + h/wrn/coreip/telnetLib.h | 246 + h/wrn/coreip/tftpLib.h | 250 + h/wrn/coreip/tftpdLib.h | 87 + h/wrn/coreip/vs/vsBsdSock.h | 56 + h/wrn/coreip/vs/vsDhcpCommon.h | 62 + h/wrn/coreip/vs/vsDhcpr.h | 57 + h/wrn/coreip/vs/vsDns.h | 55 + h/wrn/coreip/vs/vsFastPath.h | 48 + h/wrn/coreip/vs/vsFastUdp6.h | 46 + h/wrn/coreip/vs/vsIcmpUtil.h | 44 + h/wrn/coreip/vs/vsIcmpv6.h | 57 + h/wrn/coreip/vs/vsIf.h | 61 + h/wrn/coreip/vs/vsIp6.h | 292 + h/wrn/coreip/vs/vsIpRoute.h | 140 + h/wrn/coreip/vs/vsLog.h | 34 + h/wrn/coreip/vs/vsMcast6.h | 109 + h/wrn/coreip/vs/vsMip6.h | 82 + h/wrn/coreip/vs/vsMld.h | 94 + h/wrn/coreip/vs/vsMroute.h | 23 + h/wrn/coreip/vs/vsNd6.h | 106 + h/wrn/coreip/vs/vsNdp.h | 41 + h/wrn/coreip/vs/vsRarp.h | 33 + h/wrn/coreip/vs/vsRaw.h | 55 + h/wrn/coreip/vs/vsRipng.h | 161 + h/wrn/coreip/vs/vsRtadv.h | 100 + h/wrn/coreip/vs/vsSoSup.h | 75 + h/wrn/coreip/vs/vsSysctl.h | 170 + h/wrn/coreip/vs/vsTunnelLib.h | 53 + h/wrn/coreip/wvNetDLib.h | 375 + h/wrn/coreip/xdr_mnt1.h | 73 + h/wrn/coreip/xdr_mnt3.h | 101 + h/wrn/coreip/xdr_mnt_common.h | 88 + h/wrn/coreip/xdr_nfs2.h | 385 + h/wrn/coreip/xdr_nfs3.h | 1380 ++ h/wrn/coreip/xdr_nfs_common.h | 79 + h/wrn/coreip/xdr_nlm4.h | 267 + h/wrn/coreip/zbufLib.h | 131 + h/wrn/coreip/zbufSockLib.h | 78 + h/wrn/dot1x/dot1xAuthLib.h | 174 + h/wrn/dot1x/dot1xAuthSvrLib.h | 89 + h/wrn/dot1x/dot1xAuthTimerLib.h | 61 + h/wrn/dot1x/dot1xCommonIoctls.h | 257 + h/wrn/dot1x/dot1xDebugLib.h | 69 + h/wrn/dot1x/dot1xDesLib.h | 51 + h/wrn/dot1x/dot1xEapLib.h | 81 + h/wrn/dot1x/dot1xEapolLib.h | 190 + h/wrn/dot1x/dot1xKeyLib.h | 78 + h/wrn/dot1x/dot1xMdLib.h | 38 + h/wrn/dot1x/dot1xMemPartLib.h | 56 + h/wrn/dot1x/dot1xMibLib.h | 365 + h/wrn/dot1x/dot1xSuppCommonLib.h | 29 + h/wrn/dot1x/dot1xSuppLib.h | 390 + h/wrn/dot1x/dot1xSuppLibP.h | 104 + h/wrn/dot1x/dot1xSuppPeapLib.h | 88 + h/wrn/dot1x/dot1xSuppTlsLib.h | 180 + h/wrn/dot1x/dot1xSuppTtlsLib.h | 137 + h/wrn/dot1x/dot1xVirtEndLib.h | 42 + h/wrn/dot1x/dot1xWb4Lib.h | 37 + h/wrn/firewall/fwLib.h | 756 ++ h/wrn/firewall/syslogcLib.h | 90 + h/wrn/global_data_types.h | 33 + h/wrn/ike/ike.h | 167 + h/wrn/ike/ikeCerts.h | 38 + h/wrn/ike/ikeInit.h | 67 + h/wrn/ike/ikeStats.h | 243 + h/wrn/ike/ike_callbacks.h | 126 + h/wrn/ip_if.h | 99 + h/wrn/ip_message_if.h | 248 + h/wrn/ip_structures.h | 95 + h/wrn/ipsec/ipsec.h | 96 + h/wrn/ipsec/ipsecInit.h | 62 + h/wrn/ipsec/ipsecLogger.h | 172 + h/wrn/ipsec/ipsecStats.h | 180 + h/wrn/ipsec/ipsec_memory_routines.h | 98 + h/wrn/ipsec/ipsec_mkm.h | 112 + h/wrn/ipsec/mkmInit.h | 35 + h/wrn/lan_driver_if.h | 32 + h/wrn/nat/natAlgApi.h | 464 + h/wrn/nat/natExtCalls.h | 107 + h/wrn/nat/natMgmt.h | 287 + h/wrn/nat/natSnmpLeaf.h | 182 + h/wrn/nat/nat_api.h | 215 + h/wrn/netVersion.h | 12 + h/wrn/ospf/ospf.h | 101 + h/wrn/ospf/ospfLib.h | 22 + h/wrn/ospf/ospf_configuration.h | 896 ++ h/wrn/ospf/ospf_constants.h | 358 + h/wrn/ospf/ospf_enums.h | 370 + h/wrn/ospf/ospf_globals.h | 64 + h/wrn/ospf/ospf_interface_state_machine.h | 129 + h/wrn/ospf/ospf_invar.h | 95 + h/wrn/ospf/ospf_ip_structures.h | 257 + h/wrn/ospf/ospf_mdLib.h | 39 + h/wrn/ospf/ospf_memory.h | 62 + h/wrn/ospf/ospf_mib_api.h | 580 + h/wrn/ospf/ospf_mib_envoy_api.h | 137 + h/wrn/ospf/ospf_mib_helper.h | 807 ++ h/wrn/ospf/ospf_mib_helper_show.h | 182 + h/wrn/ospf/ospf_mib_helper_update.h | 640 + h/wrn/ospf/ospf_mib_leaf.h | 321 + h/wrn/ospf/ospf_mib_skel.h | 67 + h/wrn/ospf/ospf_mib_wrn_helper.h | 357 + h/wrn/ospf/ospf_mib_wrn_leaf.h | 145 + h/wrn/ospf/ospf_mib_wrn_skel.h | 54 + h/wrn/ospf/ospf_neighbor_state_machine.h | 213 + h/wrn/ospf/ospf_prototypes.h | 1118 ++ h/wrn/ospf/ospf_snmp.h | 1559 +++ h/wrn/ospf/ospf_structures.h | 1771 +++ h/wrn/ospf/ospf_vnvram.h | 70 + h/wrn/ospf/ospf_vs.h | 72 + h/wrn/ospf/ospf_vs_data.h | 36 + h/wrn/ospf/ospf_vs_lib.h | 52 + h/wrn/ospfCommon/ospfCommonLib.h | 60 + h/wrn/ospfCommon/ospfCommonMemPart.h | 41 + h/wrn/ospfCommon/ospfCommonMibApi.h | 202 + h/wrn/ospfCommon/ospfCommonPrototypes.h | 51 + h/wrn/ospfCommon/ospfCommonRowStatusLib.h | 143 + h/wrn/ospfCommon/ospfCommonUtils.h | 120 + h/wrn/ospfCommon/ospfCommonVnvramStr.h | 57 + h/wrn/ospfv3/ospfv3Configuration.h | 524 + h/wrn/ospfv3/ospfv3Constants.h | 383 + h/wrn/ospfv3/ospfv3Enums.h | 367 + h/wrn/ospfv3/ospfv3EnvoySnmpApi.h | 170 + h/wrn/ospfv3/ospfv3EnvoySnmpLeaf.h | 383 + h/wrn/ospfv3/ospfv3EnvoySnmpSkel.h | 76 + h/wrn/ospfv3/ospfv3EnvoySnmpWrnLeaf.h | 53 + h/wrn/ospfv3/ospfv3EnvoySnmpWrnSkel.h | 28 + h/wrn/ospfv3/ospfv3Globals.h | 75 + h/wrn/ospfv3/ospfv3Initialize.h | 36 + h/wrn/ospfv3/ospfv3InterfaceStateMachine.h | 176 + h/wrn/ospfv3/ospfv3IpStructures.h | 267 + h/wrn/ospfv3/ospfv3Ipv6Dependencies.h | 119 + h/wrn/ospfv3/ospfv3Lib.h | 125 + h/wrn/ospfv3/ospfv3Mapi.h | 370 + h/wrn/ospfv3/ospfv3MapiHelper.h | 770 ++ h/wrn/ospfv3/ospfv3MapiHelperShow.h | 85 + h/wrn/ospfv3/ospfv3MapiHelperUpdate.h | 463 + h/wrn/ospfv3/ospfv3MapiWrnHelper.h | 88 + h/wrn/ospfv3/ospfv3Memory.h | 49 + h/wrn/ospfv3/ospfv3NeighborStateMachine.h | 239 + h/wrn/ospfv3/ospfv3Prototypes.h | 1393 ++ h/wrn/ospfv3/ospfv3Structures.h | 1788 +++ h/wrn/pppauth_if.h | 65 + h/wrn/pppctrl_if.h | 119 + h/wrn/radius/radiusCfg.h | 26 + h/wrn/radius/radiusLib.h | 19 + h/wrn/radius/radius_interface.h | 466 + h/wrn/radius/radius_utils.h | 25 + h/wrn/radius/usrBasicRadiusBSPBuildCfg.h | 125 + h/wrn/route_manager_if.h | 111 + h/wrn/rw_driver_manager_if.h | 137 + h/wrn/rwos.h | 57 + h/wrn/rwos/module_prototype.h | 27 + h/wrn/rwos/rw_host_os_interface.h | 77 + h/wrn/rwos/rw_task_functions.h | 22 + h/wrn/rwos/rw_util.h | 307 + h/wrn/rwos/rwbufferpool.h | 12 + h/wrn/rwos/rwcontainer.h | 159 + h/wrn/rwos/rwdispatcher.h | 191 + h/wrn/rwos/rwmemory.h | 57 + h/wrn/rwos/rwpacket.h | 81 + h/wrn/rwos/system.h | 120 + h/wrn/rwos_driver_manager_if.h | 41 + h/wrn/rwos_lower_layer_if.h | 47 + h/wrn/rwproto.h | 212 + h/wrn/rwutils.h | 197 + h/wrn/sadb/sadb.h | 90 + h/wrn/sadb/sadbInit.h | 47 + h/wrn/spd/spd.h | 143 + h/wrn/spd/spdInit.h | 49 + h/wrn/udp_if.h | 51 + h/wrn/v8022str.h | 313 + h/wrn/visnpstr.h | 152 + h/wrn/vnvrmstr.h | 140 + h/wrn/wm/common/backstop/common.h | 56 + h/wrn/wm/common/backstop/oemtypes.h | 68 + h/wrn/wm/common/bug.h | 302 + h/wrn/wm/common/bugdef.h | 417 + h/wrn/wm/common/cmn_init.h | 118 + h/wrn/wm/common/config.h | 82 + h/wrn/wm/common/des.h | 93 + h/wrn/wm/common/dyncfg.h | 333 + h/wrn/wm/common/fixed64.h | 77 + h/wrn/wm/common/fldmacro.h | 95 + h/wrn/wm/common/glue.h | 194 + h/wrn/wm/common/hmac.h | 109 + h/wrn/wm/common/md4.h | 99 + h/wrn/wm/common/md5.h | 127 + h/wrn/wm/common/prng.h | 80 + h/wrn/wm/common/sha.h | 97 + h/wrn/wm/common/snprintf.h | 77 + h/wrn/wm/common/stdf.h | 87 + h/wrn/wm/common/thread.h | 258 + h/wrn/wm/common/types.h | 174 + h/wrn/wm/common/weakprng.h | 87 + h/wrn/wm/demo/bpf.h | 81 + h/wrn/wm/demo/bpfdrive.h | 78 + h/wrn/wm/demo/bsdif.h | 85 + h/wrn/wm/demo/bug_conf.h | 147 + h/wrn/wm/demo/dlpi.h | 61 + h/wrn/wm/demo/dlpidrv.h | 59 + h/wrn/wm/demo/dsmemcfg.h | 142 + h/wrn/wm/demo/firewall.h | 76 + h/wrn/wm/demo/if_ether.h | 57 + h/wrn/wm/demo/keyboard.h | 77 + h/wrn/wm/demo/keyword.h | 84 + h/wrn/wm/demo/main.h | 88 + h/wrn/wm/demo/netconf.h | 114 + h/wrn/wm/demo/nit.h | 84 + h/wrn/wm/demo/nitdrive.h | 74 + h/wrn/wm/demo/nvutils.h | 604 + h/wrn/wm/demo/parse.h | 65 + h/wrn/wm/demo/pktd.h | 309 + h/wrn/wm/demo/pktd_bcc.h | 114 + h/wrn/wm/demo/pktd_msc.h | 124 + h/wrn/wm/demo/pktdrive.h | 74 + h/wrn/wm/demo/pppbsd.h | 60 + h/wrn/wm/demo/read_ini.h | 128 + h/wrn/wm/demo/relay.h | 66 + h/wrn/wm/demo/slipbsd.h | 77 + h/wrn/wm/demo/snarklib.h | 203 + h/wrn/wm/demo/snmpconf.h | 204 + h/wrn/wm/demo/snmpfunc.h | 89 + h/wrn/wm/demo/snoop.h | 85 + h/wrn/wm/demo/snoopdrv.h | 77 + h/wrn/wm/demo/strdup.h | 52 + h/wrn/wm/demo/sty.h | 218 + h/wrn/wm/demo/tasks.h | 114 + h/wrn/wm/demo/tundrive.h | 25 + h/wrn/wm/demo/vapornet.h | 69 + h/wrn/wm/snmp/engine/agentx.h | 599 + h/wrn/wm/snmp/engine/asn1.h | 257 + h/wrn/wm/snmp/engine/asn1conf.h | 403 + h/wrn/wm/snmp/engine/auxfuncs.h | 297 + h/wrn/wm/snmp/engine/auxmth.h | 409 + h/wrn/wm/snmp/engine/axapi.h | 215 + h/wrn/wm/snmp/engine/bstring.h | 62 + h/wrn/wm/snmp/engine/buffer.h | 338 + h/wrn/wm/snmp/engine/buildpkt.h | 310 + h/wrn/wm/snmp/engine/decode.h | 230 + h/wrn/wm/snmp/engine/encode.h | 183 + h/wrn/wm/snmp/engine/entlogic.h | 202 + h/wrn/wm/snmp/engine/etimer.h | 147 + h/wrn/wm/snmp/engine/localio.h | 196 + h/wrn/wm/snmp/engine/mib.h | 567 + h/wrn/wm/snmp/engine/ntfy_chk.h | 178 + h/wrn/wm/snmp/engine/objectid.h | 142 + h/wrn/wm/snmp/engine/proxy.h | 118 + h/wrn/wm/snmp/engine/proxy_tr.h | 121 + h/wrn/wm/snmp/engine/sendntfy.h | 236 + h/wrn/wm/snmp/engine/smi.h | 63 + h/wrn/wm/snmp/engine/snmp.h | 270 + h/wrn/wm/snmp/engine/snmpdefs.h | 1232 ++ h/wrn/wm/snmp/engine/snmpstat.h | 245 + h/wrn/wm/snmp/engine/tree.h | 165 + h/wrn/wm/snmp/engine/ui64.h | 318 + h/wrn/wm/snmp/engine/v3_acc.h | 285 + h/wrn/wm/snmp/engine/v3_auth.h | 239 + h/wrn/wm/snmp/engine/v3_comm.h | 234 + h/wrn/wm/snmp/engine/v3_con.h | 128 + h/wrn/wm/snmp/engine/v3_dh.h | 62 + h/wrn/wm/snmp/engine/v3_eng.h | 218 + h/wrn/wm/snmp/engine/v3_ini.h | 79 + h/wrn/wm/snmp/engine/v3_mth.h | 216 + h/wrn/wm/snmp/engine/v3_ntfy.h | 402 + h/wrn/wm/snmp/engine/v3_priv.h | 137 + h/wrn/wm/snmp/engine/v3_proxy.h | 280 + h/wrn/wm/snmp/engine/v3_trgt.h | 417 + h/wrn/wm/snmp/engine/v3_user.h | 299 + h/wrn/wm/snmp/engine/vbdefs.h | 295 + h/wrn/wm/snmp/engine/version.h | 85 + h/wrn/wm/snmp/engine/view.h | 260 + h/wrn/wm/snmp/engine/vxcmpnts.h | 84 + h/wrn/wm/snmp/engine/wkobj.h | 138 + h/wrn/wm/snmp/vxagent/axCfg.h | 128 + h/wrn/wm/snmp/vxagent/namingScopes.h | 100 + h/wrn/wm/snmp/vxagent/snmpIoLib.h | 86 + h/wrn/wm/snmp/vxagent/snmpdInit.h | 100 + h/wrn/wm/snmp/vxagent/snmpdLib.h | 160 + h/wrn/wm/snmp/vxagent/tae_sa.h | 72 + h/wrn/wm/snmp/vxagent/vxprotos.h | 111 + h/wrn/wm/util/layout/agentx.h | 549 + h/wrn/wm/util/layout/agentx.ldb | 338 + h/wrn/wm/util/layout/apple.h | 60 + h/wrn/wm/util/layout/apple.ldb | 108 + h/wrn/wm/util/layout/arp.h | 69 + h/wrn/wm/util/layout/arp.ldb | 138 + h/wrn/wm/util/layout/bgp.h | 412 + h/wrn/wm/util/layout/bgp.ldb | 273 + h/wrn/wm/util/layout/chaos.h | 125 + h/wrn/wm/util/layout/chaos.ldb | 135 + h/wrn/wm/util/layout/dhcp.h | 235 + h/wrn/wm/util/layout/dhcp.ldb | 139 + h/wrn/wm/util/layout/dns.h | 221 + h/wrn/wm/util/layout/dns.ldb | 187 + h/wrn/wm/util/layout/doc.txt | 184 + h/wrn/wm/util/layout/ethernet.h | 116 + h/wrn/wm/util/layout/ethernet.ldb | 138 + h/wrn/wm/util/layout/ip.h | 665 + h/wrn/wm/util/layout/ip.ldb | 447 + h/wrn/wm/util/layout/ip6.h | 637 + h/wrn/wm/util/layout/ip6.ldb | 452 + h/wrn/wm/util/layout/layout.cfg | 55 + h/wrn/wm/util/layout/ldbcomp/dumpit.scm | 88 + h/wrn/wm/util/layout/ldbcomp/layout.scm | 1414 +++ h/wrn/wm/util/layout/ldbcomp/lists.scm | 228 + h/wrn/wm/util/layout/ldbcomp/makefile.cfg | 22 + h/wrn/wm/util/layout/ldbcomp/match.scm | 137 + h/wrn/wm/util/layout/ldbcomp/packages.scm | 167 + h/wrn/wm/util/layout/ldbcomp/strings.scm | 302 + h/wrn/wm/util/layout/ldbcomp/utils.scm | 233 + h/wrn/wm/util/layout/ldbglue.h | 272 + h/wrn/wm/util/layout/makefile.cfg | 55 + h/wrn/wm/util/layout/netime.h | 33 + h/wrn/wm/util/layout/netime.ldb | 14 + h/wrn/wm/util/layout/ppp.h | 202 + h/wrn/wm/util/layout/ppp.ldb | 198 + h/wrn/wm/util/layout/rip.h | 137 + h/wrn/wm/util/layout/rip.ldb | 140 + h/wrn/wm/util/layout/secure.h | 63 + h/wrn/wm/util/layout/secure.ldb | 108 + h/wrn/wm/util/layout/sntp.h | 142 + h/wrn/wm/util/layout/sntp.ldb | 111 + h/wrn/wm/util/layout/test.c | 134 + h/wrn/wm/util/layout/tftp.h | 64 + h/wrn/wm/util/layout/tftp.ldb | 48 + h/wrn/wm/util/port/bsd44/attache.h | 375 + h/wrn/wm/util/port/bsd44/common.h | 73 + h/wrn/wm/util/port/bsd44/decorum.h | 195 + h/wrn/wm/util/port/bsd44/emissary.h | 109 + h/wrn/wm/util/port/bsd44/envoy.h | 209 + h/wrn/wm/util/port/bsd44/liaison.h | 48 + h/wrn/wm/util/port/bsd44/oemtypes.h | 61 + h/wrn/wm/util/port/bsd44/snark.h | 83 + h/wrn/wm/util/port/bsd44/snmptalk.h | 71 + h/wrn/wm/util/port/bsd44/sockport.h | 152 + h/wrn/wm/util/port/bsd44/telnet.h | 77 + h/wrn/wm/util/port/bsd44/thdport.h | 93 + h/wrn/wm/util/port/cygnusnt/common.h | 73 + h/wrn/wm/util/port/cygnusnt/emissary.h | 70 + h/wrn/wm/util/port/cygnusnt/envoy.h | 206 + h/wrn/wm/util/port/cygnusnt/oemtypes.h | 61 + h/wrn/wm/util/port/cygnusnt/snark.h | 78 + h/wrn/wm/util/port/cygnusnt/snmptalk.h | 71 + h/wrn/wm/util/port/envtest/envoy.h | 332 + h/wrn/wm/util/port/envtest/oemtypes.h | 77 + h/wrn/wm/util/port/generic/envoy.h | 667 + h/wrn/wm/util/port/isisnmp/arm250/drv_conf.h | 1247 ++ h/wrn/wm/util/port/isisnmp/arm250/sys_conf.h | 1126 ++ h/wrn/wm/util/port/isisnmp/common.h | 56 + h/wrn/wm/util/port/isisnmp/envoy.h | 815 ++ h/wrn/wm/util/port/isisnmp/mcf250/config.mk | 444 + h/wrn/wm/util/port/isisnmp/mcf250/drv_conf.h | 1272 ++ h/wrn/wm/util/port/isisnmp/mcf250/sys_conf.h | 979 ++ h/wrn/wm/util/port/isisnmp/oemtypes.h | 53 + h/wrn/wm/util/port/isisnmp/ppc222/config.mk | 376 + h/wrn/wm/util/port/isisnmp/ppc222/drv_conf.h | 536 + h/wrn/wm/util/port/isisnmp/ppc222/sys_conf.h | 734 ++ h/wrn/wm/util/port/isisnmp/ppc250/config.mk | 499 + h/wrn/wm/util/port/isisnmp/ppc250/drv_conf.h | 1251 ++ h/wrn/wm/util/port/isisnmp/ppc250/sys_conf.h | 1123 ++ h/wrn/wm/util/port/isisnmp/ppc300/drv_conf.h | 1239 ++ h/wrn/wm/util/port/isisnmp/ppc300/sys_conf.h | 1153 ++ h/wrn/wm/util/port/isisnmp/snmptalk.h | 51 + h/wrn/wm/util/port/isisnmp/spl250/config.mk | 611 + h/wrn/wm/util/port/isisnmp/x86226/drv_conf.h | 535 + h/wrn/wm/util/port/isisnmp/x86226/sys_conf.h | 734 ++ h/wrn/wm/util/port/isisnmp/x86250/drv_conf.h | 1267 ++ h/wrn/wm/util/port/isisnmp/x86250/sys_conf.h | 1124 ++ h/wrn/wm/util/port/mac/emissary.h | 113 + h/wrn/wm/util/port/mach386/attache.h | 297 + h/wrn/wm/util/port/mach386/common.h | 54 + h/wrn/wm/util/port/mach386/emissary.h | 129 + h/wrn/wm/util/port/mach386/envoy.h | 206 + h/wrn/wm/util/port/mach386/oemtypes.h | 69 + h/wrn/wm/util/port/mach386/snmptalk.h | 71 + h/wrn/wm/util/port/mach386/telnet.h | 64 + h/wrn/wm/util/port/msdos/attache.h | 356 + h/wrn/wm/util/port/msdos/common.h | 90 + h/wrn/wm/util/port/msdos/decorum.h | 197 + h/wrn/wm/util/port/msdos/emissary.h | 113 + h/wrn/wm/util/port/msdos/envoy.h | 228 + h/wrn/wm/util/port/msdos/liaison.h | 49 + h/wrn/wm/util/port/msdos/snark.h | 105 + h/wrn/wm/util/port/msdos/snmptalk.h | 87 + h/wrn/wm/util/port/msdos/telnet.h | 89 + h/wrn/wm/util/port/solaris/attache.h | 273 + h/wrn/wm/util/port/solaris/common.h | 80 + h/wrn/wm/util/port/solaris/decorum.h | 143 + h/wrn/wm/util/port/solaris/emissary.h | 77 + h/wrn/wm/util/port/solaris/envoy.h | 150 + h/wrn/wm/util/port/solaris/liaison.h | 46 + h/wrn/wm/util/port/solaris/oemtypes.h | 57 + h/wrn/wm/util/port/solaris/snark.h | 97 + h/wrn/wm/util/port/solaris/snmptalk.h | 51 + h/wrn/wm/util/port/solaris/sockport.h | 134 + h/wrn/wm/util/port/solaris/telnet.h | 66 + h/wrn/wm/util/port/solaris/thdport.h | 86 + h/wrn/wm/util/port/sunos/attache.h | 330 + h/wrn/wm/util/port/sunos/common.h | 107 + h/wrn/wm/util/port/sunos/decorum.h | 190 + h/wrn/wm/util/port/sunos/emissary.h | 89 + h/wrn/wm/util/port/sunos/envoy.h | 183 + h/wrn/wm/util/port/sunos/liaison.h | 49 + h/wrn/wm/util/port/sunos/oemtypes.h | 69 + h/wrn/wm/util/port/sunos/snark.h | 119 + h/wrn/wm/util/port/sunos/snmptalk.h | 72 + h/wrn/wm/util/port/sunos/telnet.h | 77 + h/wrn/wm/util/port/vxworks/common.h | 108 + h/wrn/wm/util/port/vxworks/envoy.h | 988 ++ h/wrn/wm/util/port/vxworks/oemtypes.h | 47 + h/wrn/wm/util/port/vxworks/snark.h | 39 + h/wrn/wm/util/port/vxworks/snmptalk.h | 46 + h/wrn/wm/util/port/winsock/common.h | 90 + h/wrn/wm/util/port/winsock/envoy.h | 153 + h/wrn/wm/util/port/winsock/oemtypes.h | 78 + h/wrn/wm/util/port/winsock/snark.h | 72 + h/wrn/wm/util/port/winsock/snmptalk.h | 87 + h/wtx.h | 1439 +++ h/wtxerr.h | 331 + h/wtxexch.h | 103 + h/wtxmsg.h | 1818 +++ h/wtxrpc.h | 166 + h/wtxtypes.h | 1693 +++ h/wtxxdr.h | 557 + h/wvLib.h | 150 + h/wvNetLib.h | 1032 ++ h/wvTmrLib.h | 40 + h/xbdBlkDev.h | 33 + h/xbdPartition.h | 29 + h/xbdRamDisk.h | 31 + h/xdr_bool_t.h | 40 + h/xdr_mnt.h | 23 + h/xdr_nfs.h | 23 + h/xdr_nfsserv.h | 23 + h/zbufLib.h | 133 + h/zbufSockLib.h | 77 + libc/Makefile | 15 + libc/assert/Makefile | 22 + libc/assert/ansiAssert.c | 54 + libc/assert/assert.c | 43 + libc/ctype/Makefile | 31 + libc/ctype/__ctype_tab.c | 163 + libc/ctype/ansiCtype.c | 718 ++ libc/ctype/isalnum.c | 48 + libc/ctype/isalpha.c | 49 + libc/ctype/iscntrl.c | 47 + libc/ctype/isdigit.c | 47 + libc/ctype/isgraph.c | 51 + libc/ctype/islower.c | 48 + libc/ctype/isprint.c | 48 + libc/ctype/ispunct.c | 48 + libc/ctype/isspace.c | 61 + libc/ctype/isupper.c | 49 + libc/ctype/isxdigit.c | 48 + libc/ctype/tolower.c | 52 + libc/ctype/toupper.c | 50 + libc/locale/Makefile | 26 + libc/locale/ansiLocale.c | 331 + libc/locale/localeconv.c | 175 + libc/locale/setlocale.c | 113 + libc/math/Makefile | 195 + libc/math/acosh.c | 114 + libc/math/ansiMath.c | 2726 ++++ libc/math/asincos.c | 145 + libc/math/asinh.c | 117 + libc/math/atan.c | 75 + libc/math/atan2.c | 300 + libc/math/atanh.c | 93 + libc/math/ceil.c | 71 + libc/math/cosh.c | 143 + libc/math/exp.c | 183 + libc/math/exp__E.c | 153 + libc/math/expm1.c | 188 + libc/math/fabs.c | 70 + libc/math/floor.c | 67 + libc/math/fmod.c | 174 + libc/math/frexp.c | 87 + libc/math/ldexp.c | 79 + libc/math/log.c | 186 + libc/math/log10.c | 111 + libc/math/log1p.c | 197 + libc/math/log__L.c | 128 + libc/math/modf.c | 112 + libc/math/pow.c | 277 + libc/math/sincos.c | 137 + libc/math/sinh.c | 129 + libc/math/sqrt.c | 185 + libc/math/support.c | 325 + libc/math/tan.c | 97 + libc/math/tanh.c | 115 + libc/setjmp/Makefile | 22 + libc/setjmp/ansiSetjmp.c | 115 + libc/setjmp/longjmp.c | 118 + libc/stdarg/Makefile | 22 + libc/stdarg/ansiStdarg.c | 126 + libc/stdio/Makefile | 39 + libc/stdio/ansiStdio.c | 5467 ++++++++ libc/stdio/clearerr.c | 77 + libc/stdio/fclose.c | 121 + libc/stdio/fdopen.c | 141 + libc/stdio/feof.c | 79 + libc/stdio/ferror.c | 77 + libc/stdio/fflush.c | 165 + libc/stdio/fgetc.c | 86 + libc/stdio/fgetpos.c | 56 + libc/stdio/fgets.c | 158 + libc/stdio/fileno.c | 92 + libc/stdio/flags.c | 142 + libc/stdio/fopen.c | 177 + libc/stdio/fprintf.c | 283 + libc/stdio/fputc.c | 87 + libc/stdio/fputs.c | 97 + libc/stdio/fread.c | 157 + libc/stdio/freopen.c | 193 + libc/stdio/fscanf.c | 286 + libc/stdio/fseek.c | 336 + libc/stdio/fsetpos.c | 88 + libc/stdio/ftell.c | 135 + libc/stdio/fvwrite.c | 246 + libc/stdio/fwrite.c | 109 + libc/stdio/getc.c | 98 + libc/stdio/getchar.c | 85 + libc/stdio/gets.c | 105 + libc/stdio/getw.c | 53 + libc/stdio/makebuf.c | 144 + libc/stdio/perror.c | 58 + libc/stdio/putc.c | 90 + libc/stdio/putchar.c | 87 + libc/stdio/puts.c | 97 + libc/stdio/putw.c | 47 + libc/stdio/refill.c | 183 + libc/stdio/rewind.c | 93 + libc/stdio/rget.c | 84 + libc/stdio/scanf.c | 99 + libc/stdio/setbuf.c | 88 + libc/stdio/setbuffer.c | 123 + libc/stdio/setvbuf.c | 167 + libc/stdio/stdio.c | 198 + libc/stdio/stdioLib.c | 376 + libc/stdio/stdioShow.c | 97 + libc/stdio/tmpfile.c | 42 + libc/stdio/tmpnam.c | 78 + libc/stdio/ungetc.c | 243 + libc/stdio/vfprintf.c | 160 + libc/stdio/wbuf.c | 125 + libc/stdio/wsetup.c | 121 + libc/stdlib/Makefile | 28 + libc/stdlib/abort.c | 50 + libc/stdlib/abs.c | 44 + libc/stdlib/ansiStdlib.c | 2045 +++ libc/stdlib/atexit.c | 47 + libc/stdlib/atof.c | 49 + libc/stdlib/atoi.c | 49 + libc/stdlib/atol.c | 49 + libc/stdlib/bsearch.c | 80 + libc/stdlib/div.c | 98 + libc/stdlib/labs.c | 47 + libc/stdlib/ldiv.c | 90 + libc/stdlib/multibyte.c | 145 + libc/stdlib/qsort.c | 386 + libc/stdlib/rand.c | 72 + libc/stdlib/strtod.c | 305 + libc/stdlib/strtol.c | 223 + libc/stdlib/strtoul.c | 200 + libc/stdlib/system.c | 42 + libc/string/Makefile | 32 + libc/string/ansiString.c | 1732 +++ libc/string/memchr.c | 58 + libc/string/memcmp.c | 69 + libc/string/memcpy.c | 55 + libc/string/memmove.c | 66 + libc/string/memset.c | 52 + libc/string/strcat.c | 56 + libc/string/strchr.c | 55 + libc/string/strcmp.c | 51 + libc/string/strcoll.c | 155 + libc/string/strcpy.c | 50 + libc/string/strcspn.c | 61 + libc/string/strerror.c | 143 + libc/string/string.c | 15 + libc/string/strlen.c | 49 + libc/string/strncat.c | 62 + libc/string/strncmp.c | 59 + libc/string/strncpy.c | 63 + libc/string/strpbrk.c | 65 + libc/string/strrchr.c | 56 + libc/string/strspn.c | 61 + libc/string/strstr.c | 73 + libc/string/strtok.c | 82 + libc/string/strtok_r.c | 81 + libc/string/strxfrm.c | 165 + libc/string/xstate.c | 88 + libc/time/Makefile | 27 + libc/time/ansiTime.c | 1662 +++ libc/time/asctime.c | 89 + libc/time/clock.c | 57 + libc/time/ctime.c | 88 + libc/time/difftime.c | 48 + libc/time/gmtime.c | 226 + libc/time/locTime.c | 42 + libc/time/localtime.c | 98 + libc/time/mktime.c | 188 + libc/time/strftime.c | 644 + libc/time/time.c | 63 + target/Makefile | 23 + target/config/Makefile | 114 + target/config/comps/src/dosfs2/usrAta.c | 312 + target/config/comps/src/dosfs2/usrFd.c | 120 + target/config/comps/src/usrSmObj.c | 302 + target/config/comps/src/usrVxFusion.c | 163 + target/config/comps/vxWorks/01vxmp.cdf | 78 + target/config/comps/vxWorks/02vxfusion.cdf | 79 + target/config/comps/vxWorks/10bsp.cdf | 132 + target/config/comps/vxWorks/10dosfs2.cdf | 244 + target/h/arch/ppc/ppc403.h | 622 + target/h/arch/sparc/mb86940.h | 249 + target/h/cbioLib.h | 205 + target/h/dcacheCbio.h | 74 + target/h/dosFsLib.h | 285 + target/h/dpartCbio.h | 44 + target/h/drv/usb/usbAcmLib.h | 350 + target/h/drv/usb/usbBulkDevLib.h | 259 + target/h/drv/usb/usbCbiUfiDevLib.h | 208 + target/h/drv/usb/usbHcd.h | 327 + target/h/drv/usb/usbHcdOhciLib.h | 48 + target/h/drv/usb/usbHcdUhciLib.h | 48 + target/h/drv/usb/usbKeyboardLib.h | 122 + target/h/drv/usb/usbKlsiEnd.h | 291 + target/h/drv/usb/usbMouseLib.h | 127 + target/h/drv/usb/usbNC1080End.h | 266 + target/h/drv/usb/usbOhci.h | 543 + target/h/drv/usb/usbPegasusEnd.h | 318 + target/h/drv/usb/usbPrinterLib.h | 129 + target/h/drv/usb/usbSpeakerLib.h | 198 + target/h/drv/usb/usbUhci.h | 416 + target/h/drv/vxfusion/distIfUdp.h | 88 + target/h/msgQSmLib.h | 62 + target/h/private/assertAltern.h | 32 + target/h/private/cbioLibP.h | 143 + target/h/private/dosDirLibP.h | 209 + target/h/private/dosFsFatP.h | 79 + target/h/private/dosFsLibP.h | 599 + target/h/private/dosFsVerP.h | 53 + target/h/private/msgQSmLibP.h | 111 + target/h/private/print64Lib.h | 39 + target/h/private/semSmLibP.h | 89 + target/h/private/smFixBlkLibP.h | 83 + target/h/private/smMemLibP.h | 148 + target/h/private/smNameLibP.h | 88 + target/h/private/smObjLibP.h | 89 + target/h/qFifoGLib.h | 83 + target/h/ramDiskCbio.h | 43 + target/h/rawFsLib.h | 109 + target/h/semSmLib.h | 47 + target/h/smDllLib.h | 179 + target/h/smMemLib.h | 62 + target/h/smNameLib.h | 74 + target/h/smObjLib.h | 250 + target/h/tarLib.h | 41 + target/h/usb/ossLib.h | 296 + target/h/usb/pciConstants.h | 93 + target/h/usb/tools/cmdParser.h | 205 + target/h/usb/tools/wavFormat.h | 90 + target/h/usb/usb.h | 652 + target/h/usb/usbAudio.h | 704 ++ target/h/usb/usbCommdevices.h | 84 + target/h/usb/usbDescrCopyLib.h | 71 + target/h/usb/usbEnet.h | 128 + target/h/usb/usbHandleLib.h | 115 + target/h/usb/usbHcdLib.h | 166 + target/h/usb/usbHid.h | 146 + target/h/usb/usbLib.h | 130 + target/h/usb/usbListLib.h | 129 + target/h/usb/usbMassStorage.h | 46 + target/h/usb/usbPciLib.h | 218 + target/h/usb/usbPlatform.h | 107 + target/h/usb/usbPrinter.h | 80 + target/h/usb/usbQueueLib.h | 125 + target/h/usb/usbdCoreLib.h | 513 + target/h/usb/usbdLib.h | 506 + target/h/usb/usbdStructures.h | 313 + target/h/usrFdiskPartLib.h | 81 + target/h/vxfusion/distIfLib.h | 79 + target/h/vxfusion/distLib.h | 84 + target/h/vxfusion/distNameLib.h | 78 + target/h/vxfusion/distNetLib.h | 59 + target/h/vxfusion/distNodeLib.h | 45 + target/h/vxfusion/distStatLib.h | 70 + target/h/vxfusion/distTBufLib.h | 90 + target/h/vxfusion/msgQDistGrpLib.h | 56 + target/h/vxfusion/msgQDistGrpShow.h | 42 + target/h/vxfusion/msgQDistLib.h | 72 + target/h/vxfusion/msgQDistShow.h | 38 + target/h/vxfusion/private/distIncoLibP.h | 69 + target/h/vxfusion/private/distLibP.h | 62 + target/h/vxfusion/private/distNameLibP.h | 141 + target/h/vxfusion/private/distNetLibP.h | 96 + target/h/vxfusion/private/distNodeLibP.h | 265 + target/h/vxfusion/private/distObjLibP.h | 109 + target/h/vxfusion/private/distPktLibP.h | 57 + target/h/vxfusion/private/distStatLibP.h | 34 + target/h/vxfusion/private/distTBufLibP.h | 291 + target/h/vxfusion/private/msgQDistGrpLibP.h | 371 + target/h/vxfusion/private/msgQDistLibP.h | 312 + target/src/Makefile | 358 + target/src/arch/Makefile | 130 + target/src/arch/Makefile.in | 58 + target/src/arch/arm/Makefile | 107 + target/src/arch/arm/unixALib.s | 373 + target/src/arch/doc/Makefile | 64 + target/src/arch/doc/dbgArchLib.c | 6375 ++++++++++ target/src/arch/doc/excArchLib.c | 316 + target/src/arch/doc/fppArchLib.c | 409 + target/src/arch/doc/intArchLib.c | 1249 ++ target/src/arch/doc/taskArchLib.c | 211 + target/src/arch/doc/vxLib.c | 825 ++ target/src/arch/i86/Makefile | 72 + target/src/arch/i86/bALib.s | 688 + target/src/arch/i86/cacheALib.s | 302 + target/src/arch/i86/cacheArchLib.c | 508 + target/src/arch/i86/dbgArchLib.c | 403 + target/src/arch/i86/dllALib.s | 300 + target/src/arch/i86/dsmLib.c | 2942 +++++ target/src/arch/i86/elfI86.c | 357 + target/src/arch/i86/excALib.s | 477 + target/src/arch/i86/excArchLib.c | 333 + target/src/arch/i86/excArchShow.c | 235 + target/src/arch/i86/ffsALib.s | 101 + target/src/arch/i86/fppALib.s | 352 + target/src/arch/i86/fppArchLib.c | 617 + target/src/arch/i86/intALib.s | 219 + target/src/arch/i86/intArchLib.c | 863 ++ target/src/arch/i86/ipiALib.s | 168 + target/src/arch/i86/ipiArchLib.c | 458 + target/src/arch/i86/math/Makefile | 39 + target/src/arch/i86/math/emuFncALib.s | 1129 ++ target/src/arch/i86/math/emuIncALib.s | 84 + target/src/arch/i86/math/emuMainALib.s | 1869 +++ target/src/arch/i86/math/emuOperALib.s | 1852 +++ target/src/arch/i86/math/emuSubALib.s | 650 + target/src/arch/i86/math/mathALib.s | 1365 ++ target/src/arch/i86/math/mathHardALib.s | 962 ++ target/src/arch/i86/math/mathHardLib.c | 409 + target/src/arch/i86/math/mathSoftLib.c | 57 + target/src/arch/i86/mmuI86ALib.s | 199 + target/src/arch/i86/mmuI86Lib.c | 996 ++ target/src/arch/i86/mmuPro32ALib.s | 209 + target/src/arch/i86/mmuPro32Lib.c | 1079 ++ target/src/arch/i86/mmuPro36ALib.s | 229 + target/src/arch/i86/mmuPro36Lib.c | 1364 ++ target/src/arch/i86/pentiumALib.s | 1107 ++ target/src/arch/i86/pentiumLib.c | 1201 ++ target/src/arch/i86/pentiumShow.c | 206 + target/src/arch/i86/qPriBMapALib.s | 320 + target/src/arch/i86/semALib.s | 787 ++ target/src/arch/i86/semCALib.s | 164 + target/src/arch/i86/semMALib.s | 270 + target/src/arch/i86/sigCtxALib.s | 198 + target/src/arch/i86/sigCtxLib.c | 136 + target/src/arch/i86/sllALib.s | 212 + target/src/arch/i86/taskArchLib.c | 188 + target/src/arch/i86/trcLib.c | 620 + target/src/arch/i86/unixALib.s | 176 + target/src/arch/i86/vmArch32Lib.c | 203 + target/src/arch/i86/vmArch36Lib.c | 202 + target/src/arch/i86/vmBaseArch32Lib.c | 155 + target/src/arch/i86/vmBaseArch36Lib.c | 154 + target/src/arch/i86/vxALib.s | 550 + target/src/arch/i86/vxLib.c | 281 + target/src/arch/i86/vxShow.c | 757 ++ target/src/arch/i86/vxmIfLib.c | 224 + target/src/arch/i86/wdbDbgALib.s | 318 + target/src/arch/i86/wdbDbgArchLib.c | 446 + target/src/arch/i86/windALib.s | 1276 ++ target/src/arch/i86/workQALib.s | 204 + target/src/arch/i960/Makefile | 42 + target/src/arch/i960/math/Makefile | 50 + target/src/arch/i960/unixALib.s | 171 + target/src/arch/mc68k/Makefile | 39 + target/src/arch/mc68k/math/Makefile | 61 + target/src/arch/mc68k/math/bindec.s | 947 ++ target/src/arch/mc68k/math/binstr.s | 166 + target/src/arch/mc68k/math/bugfix.s | 525 + target/src/arch/mc68k/math/decbin.s | 532 + target/src/arch/mc68k/math/do_func.s | 587 + target/src/arch/mc68k/math/excFppALib.s | 552 + target/src/arch/mc68k/math/fixunssfsi.c | 72 + target/src/arch/mc68k/math/fpsp040E.h | 380 + target/src/arch/mc68k/math/fpsp040L.h | 279 + target/src/arch/mc68k/math/gen_except.s | 503 + target/src/arch/mc68k/math/get_op.s | 701 ++ target/src/arch/mc68k/math/kernel_ex.s | 519 + target/src/arch/mc68k/math/l_do_func.s | 547 + target/src/arch/mc68k/math/l_entry.s | 6157 +++++++++ target/src/arch/mc68k/math/l_round.s | 667 + target/src/arch/mc68k/math/l_sacos.s | 143 + target/src/arch/mc68k/math/l_sasin.s | 130 + target/src/arch/mc68k/math/l_satan.s | 507 + target/src/arch/mc68k/math/l_satanh.s | 130 + target/src/arch/mc68k/math/l_scale.s | 398 + target/src/arch/mc68k/math/l_scosh.s | 158 + target/src/arch/mc68k/math/l_setox.s | 892 ++ target/src/arch/mc68k/math/l_sgetem.s | 167 + target/src/arch/mc68k/math/l_sint.s | 273 + target/src/arch/mc68k/math/l_slog2.s | 213 + target/src/arch/mc68k/math/l_slogn.s | 618 + target/src/arch/mc68k/math/l_srem_mod.s | 450 + target/src/arch/mc68k/math/l_ssin.s | 776 ++ target/src/arch/mc68k/math/l_ssinh.s | 161 + target/src/arch/mc68k/math/l_stan.s | 483 + target/src/arch/mc68k/math/l_stanh.s | 210 + target/src/arch/mc68k/math/l_stwotox.s | 452 + target/src/arch/mc68k/math/l_support.s | 388 + target/src/arch/mc68k/math/res_func.s | 2081 +++ target/src/arch/mc68k/math/round.s | 693 + target/src/arch/mc68k/math/sacos.s | 142 + target/src/arch/mc68k/math/sasin.s | 131 + target/src/arch/mc68k/math/satan.s | 506 + target/src/arch/mc68k/math/satanh.s | 130 + target/src/arch/mc68k/math/scale.s | 398 + target/src/arch/mc68k/math/scosh.s | 156 + target/src/arch/mc68k/math/setox.s | 893 ++ target/src/arch/mc68k/math/sgetem.s | 167 + target/src/arch/mc68k/math/sint.s | 272 + target/src/arch/mc68k/math/slog2.s | 214 + target/src/arch/mc68k/math/slogn.s | 618 + target/src/arch/mc68k/math/smovecr.s | 187 + target/src/arch/mc68k/math/srem_mod.s | 450 + target/src/arch/mc68k/math/ssin.s | 779 ++ target/src/arch/mc68k/math/ssinh.s | 161 + target/src/arch/mc68k/math/stan.s | 483 + target/src/arch/mc68k/math/stanh.s | 210 + target/src/arch/mc68k/math/sto_res.s | 123 + target/src/arch/mc68k/math/stwotox.s | 452 + target/src/arch/mc68k/math/tbldo.s | 576 + target/src/arch/mc68k/math/uss_dpfncs.s | 1317 ++ target/src/arch/mc68k/math/uss_dpopns.s | 1203 ++ target/src/arch/mc68k/math/uss_fpfncs.s | 1179 ++ target/src/arch/mc68k/math/uss_fpopns.s | 848 ++ target/src/arch/mc68k/math/uss_xlfncs.s | 134 + target/src/arch/mc68k/math/util.s | 835 ++ target/src/arch/mc68k/math/x_bsun.s | 82 + target/src/arch/mc68k/math/x_operr.s | 391 + target/src/arch/mc68k/math/x_ovfl.s | 221 + target/src/arch/mc68k/math/x_snan.s | 311 + target/src/arch/mc68k/math/x_store.s | 282 + target/src/arch/mc68k/math/x_unfl.s | 304 + target/src/arch/mc68k/math/x_unsupp.s | 122 + target/src/arch/mc68k/unixALib.s | 206 + target/src/arch/mips/Makefile | 245 + target/src/arch/mips/math/Makefile | 55 + target/src/arch/mips/unixALib.s | 123 + target/src/arch/ppc/Makefile | 77 + target/src/arch/ppc/math/Makefile | 55 + target/src/arch/ppc/math/motorolaLib/Makefile | 51 + .../src/arch/ppc/math/usSoftwareLib/Makefile | 41 + target/src/arch/sh/Makefile | 62 + target/src/arch/sh/unixALib.s | 347 + target/src/arch/sparc/Makefile | 40 + target/src/arch/sparc/math/Makefile | 30 + target/src/arch/sparc/math/arc32.s | 649 + target/src/arch/sparc/math/ceil32.s | 132 + target/src/arch/sparc/math/dp32.s | 1272 ++ target/src/arch/sparc/math/exp32.s | 241 + target/src/arch/sparc/math/fdmul32.s | 145 + target/src/arch/sparc/math/floor32.s | 122 + target/src/arch/sparc/math/fp32.s | 779 ++ target/src/arch/sparc/math/fparc32.s | 934 ++ target/src/arch/sparc/math/fpceil32.s | 118 + target/src/arch/sparc/math/fpexp32.s | 208 + target/src/arch/sparc/math/fpfloo32.s | 105 + target/src/arch/sparc/math/fphyp32.s | 612 + target/src/arch/sparc/math/fplog32.s | 402 + target/src/arch/sparc/math/fpmod32.s | 349 + target/src/arch/sparc/math/fppow32.s | 365 + target/src/arch/sparc/math/fpsqrt32.s | 347 + target/src/arch/sparc/math/fptrig32.s | 588 + target/src/arch/sparc/math/func32.s | 480 + target/src/arch/sparc/math/hyp32.s | 389 + target/src/arch/sparc/math/log32.s | 427 + target/src/arch/sparc/math/mod32.s | 521 + target/src/arch/sparc/math/pow32.s | 360 + target/src/arch/sparc/math/sqrt32.s | 553 + target/src/arch/sparc/math/trig32.s | 442 + target/src/arch/sparc/unixALib.s | 180 + target/src/bpf/Makefile | 23 + target/src/bpf/bpfDrv.c | 2117 ++++ target/src/bpf/bpfProto.c | 892 ++ target/src/bpf/bpf_filter.c | 582 + target/src/config/usrVxFusion.c | 166 + target/src/cplus/Makefile | 24 + target/src/cplus/rts/Makefile | 52 + target/src/cplus/rts/cplusCore.cpp | 317 + target/src/cplus/rts/cplusInit.cpp | 84 + target/src/cplus/rts/cplusLib.c | 129 + target/src/cplus/rts/cplusLibDoc.c | 480 + target/src/cplus/rts/cplusLoad.c | 154 + target/src/cplus/rts/cplusStr.cpp | 429 + target/src/cplus/rts/cplusUsr.c | 272 + target/src/cplus/rts/cplusXtors.c | 134 + target/src/cplus/rts/demangler/Makefile | 56 + target/src/cplus/rts/demangler/ansidecl.h | 233 + target/src/cplus/rts/demangler/cp-demangle.c | 28 + target/src/cplus/rts/demangler/cplus-dem.c | 5245 ++++++++ target/src/cplus/rts/demangler/cplusDem.c | 193 + target/src/cplus/rts/demangler/cplusDemStub.c | 395 + target/src/cplus/rts/demangler/demangle.h | 128 + target/src/cplus/rts/demangler/edg-decode.c | 2491 ++++ target/src/cplus/rts/demangler/libiberty.h | 239 + target/src/cplus/rts/demangler/safe-ctype.c | 163 + target/src/cplus/rts/demangler/safe-ctype.h | 100 + target/src/dhcp/Makefile | 29 + target/src/dhcp/common_subr.c | 380 + target/src/dhcp/database.c | 3994 ++++++ target/src/dhcp/delarp.c | 111 + target/src/dhcp/dhcpRelay.c | 700 ++ target/src/dhcp/dhcpc.c | 253 + target/src/dhcp/dhcpcBoot.c | 4186 +++++++ target/src/dhcp/dhcpcState1.c | 1532 +++ target/src/dhcp/dhcpcState2.c | 2224 ++++ target/src/dhcp/dhcpc_subr.c | 3525 ++++++ target/src/dhcp/dhcpr.c | 204 + target/src/dhcp/dhcps.c | 4199 +++++++ target/src/dhcp/flushroute.c | 214 + target/src/dhcp/hash.c | 365 + target/src/dhcp/interface.c | 365 + target/src/drv/Makefile | 31 + target/src/drv/pcmcia/Makefile | 47 + target/src/drv/pcmcia/cisLib.c | 1020 ++ target/src/drv/pcmcia/cisShow.c | 1848 +++ target/src/drv/pcmcia/pccardLib.c | 1264 ++ target/src/drv/pcmcia/pccardShow.c | 334 + target/src/drv/pcmcia/pcic.c | 965 ++ target/src/drv/pcmcia/pcicShow.c | 730 ++ target/src/drv/pcmcia/pcmciaLib.c | 345 + target/src/drv/pcmcia/pcmciaShow.c | 113 + target/src/drv/pcmcia/sramDrv.c | 605 + target/src/drv/pcmcia/tcic.c | 941 ++ target/src/drv/pcmcia/tcicShow.c | 492 + target/src/drv/vxfusion/Makefile | 30 + target/src/drv/vxfusion/distIfUdp.c | 596 + target/src/drv/wdb/Makefile | 37 + target/src/drv/wdb/amc500/dpconfig.h | 234 + target/src/drv/wdb/amc500/dptarget.c | 1528 +++ target/src/drv/wdb/amc500/dptarget.h | 183 + target/src/drv/wdb/amc500/dualport.h | 189 + target/src/drv/wdb/amc500/wdbNetromPktDrv.c | 326 + target/src/drv/wdb/dpconfig.h | 119 + target/src/drv/wdb/dptarget.c | 1662 +++ target/src/drv/wdb/dptarget.h | 72 + target/src/drv/wdb/dualport.h | 182 + target/src/drv/wdb/wdbBdmPktDrv.c | 370 + target/src/drv/wdb/wdbEndPktDrv.c | 953 ++ target/src/drv/wdb/wdbNetromPktDrv.c | 323 + target/src/drv/wdb/wdbPipePktDrv.c | 711 ++ target/src/drv/wdb/wdbSlipPktDrv.c | 549 + target/src/drv/wdb/wdbTemplatePktDrv.c | 367 + target/src/drv/wdb/wdbTsfsDrv.c | 1244 ++ target/src/drv/wdb/wdbUlipPktDrv.c | 201 + target/src/drv/wdb/wdbVioDrv.c | 406 + target/src/event/Makefile | 49 + target/src/event/connLib.c | 152 + target/src/event/evtLogLib.c | 1005 ++ target/src/event/seqDrv.c | 127 + target/src/event/trgLib.c | 1456 +++ target/src/event/trgShow.c | 162 + target/src/event/wvFileUploadPathLib.c | 181 + target/src/event/wvHostLib.c | 126 + target/src/event/wvLib.c | 2508 ++++ target/src/event/wvRpcSvc.c | 228 + target/src/event/wvRpc_xdr.c | 65 + target/src/event/wvServer.c | 223 + target/src/event/wvSockUploadPathLib.c | 242 + target/src/event/wvTmrLib.c | 179 + target/src/event/wvTsfsUploadPathLib.c | 193 + target/src/fs/Makefile | 46 + target/src/fs/cbioLib.c | 2552 ++++ target/src/fs/dcacheCbio.c | 2847 +++++ target/src/fs/dosChkLib.c | 1650 +++ target/src/fs/dosDirOldLib.c | 1967 +++ target/src/fs/dosFsFat.c | 2064 +++ target/src/fs/dosFsFmtLib.c | 1576 +++ target/src/fs/dosFsLib.c | 5976 +++++++++ target/src/fs/dosVDirLib.c | 3153 +++++ target/src/fs/dpartCbio.c | 879 ++ target/src/fs/print64Lib.c | 201 + target/src/fs/rawFsLib.c | 1624 +++ target/src/libc/Makefile | 15 + target/src/libc/assert/Makefile | 22 + target/src/libc/assert/ansiAssert.c | 54 + target/src/libc/assert/assert.c | 43 + target/src/libc/ctype/Makefile | 31 + target/src/libc/ctype/__ctype_tab.c | 163 + target/src/libc/ctype/ansiCtype.c | 718 ++ target/src/libc/ctype/isalnum.c | 48 + target/src/libc/ctype/isalpha.c | 49 + target/src/libc/ctype/iscntrl.c | 47 + target/src/libc/ctype/isdigit.c | 47 + target/src/libc/ctype/isgraph.c | 51 + target/src/libc/ctype/islower.c | 48 + target/src/libc/ctype/isprint.c | 48 + target/src/libc/ctype/ispunct.c | 48 + target/src/libc/ctype/isspace.c | 61 + target/src/libc/ctype/isupper.c | 49 + target/src/libc/ctype/isxdigit.c | 48 + target/src/libc/ctype/tolower.c | 52 + target/src/libc/ctype/toupper.c | 50 + target/src/libc/locale/Makefile | 26 + target/src/libc/locale/ansiLocale.c | 331 + target/src/libc/locale/localeconv.c | 175 + target/src/libc/locale/setlocale.c | 113 + target/src/libc/math/Makefile | 195 + target/src/libc/math/acosh.c | 114 + target/src/libc/math/ansiMath.c | 2726 ++++ target/src/libc/math/asincos.c | 145 + target/src/libc/math/asinh.c | 117 + target/src/libc/math/atan.c | 75 + target/src/libc/math/atan2.c | 300 + target/src/libc/math/atanh.c | 93 + target/src/libc/math/ceil.c | 71 + target/src/libc/math/cosh.c | 143 + target/src/libc/math/exp.c | 183 + target/src/libc/math/exp__E.c | 153 + target/src/libc/math/expm1.c | 188 + target/src/libc/math/fabs.c | 70 + target/src/libc/math/floor.c | 67 + target/src/libc/math/fmod.c | 174 + target/src/libc/math/frexp.c | 87 + target/src/libc/math/ldexp.c | 79 + target/src/libc/math/log.c | 186 + target/src/libc/math/log10.c | 111 + target/src/libc/math/log1p.c | 197 + target/src/libc/math/log__L.c | 128 + target/src/libc/math/modf.c | 112 + target/src/libc/math/pow.c | 277 + target/src/libc/math/sincos.c | 137 + target/src/libc/math/sinh.c | 129 + target/src/libc/math/sqrt.c | 185 + target/src/libc/math/support.c | 325 + target/src/libc/math/tan.c | 97 + target/src/libc/math/tanh.c | 115 + target/src/libc/setjmp/Makefile | 22 + target/src/libc/setjmp/ansiSetjmp.c | 115 + target/src/libc/setjmp/longjmp.c | 118 + target/src/libc/stdarg/Makefile | 22 + target/src/libc/stdarg/ansiStdarg.c | 126 + target/src/libc/stdio/Makefile | 39 + target/src/libc/stdio/ansiStdio.c | 5467 ++++++++ target/src/libc/stdio/clearerr.c | 77 + target/src/libc/stdio/fclose.c | 121 + target/src/libc/stdio/fdopen.c | 141 + target/src/libc/stdio/feof.c | 79 + target/src/libc/stdio/ferror.c | 77 + target/src/libc/stdio/fflush.c | 165 + target/src/libc/stdio/fgetc.c | 86 + target/src/libc/stdio/fgetpos.c | 56 + target/src/libc/stdio/fgets.c | 158 + target/src/libc/stdio/fileno.c | 92 + target/src/libc/stdio/flags.c | 142 + target/src/libc/stdio/fopen.c | 177 + target/src/libc/stdio/fprintf.c | 283 + target/src/libc/stdio/fputc.c | 87 + target/src/libc/stdio/fputs.c | 97 + target/src/libc/stdio/fread.c | 157 + target/src/libc/stdio/freopen.c | 193 + target/src/libc/stdio/fscanf.c | 286 + target/src/libc/stdio/fseek.c | 336 + target/src/libc/stdio/fsetpos.c | 88 + target/src/libc/stdio/ftell.c | 135 + target/src/libc/stdio/fvwrite.c | 246 + target/src/libc/stdio/fwrite.c | 109 + target/src/libc/stdio/getc.c | 98 + target/src/libc/stdio/getchar.c | 85 + target/src/libc/stdio/gets.c | 105 + target/src/libc/stdio/getw.c | 53 + target/src/libc/stdio/makebuf.c | 144 + target/src/libc/stdio/perror.c | 58 + target/src/libc/stdio/putc.c | 90 + target/src/libc/stdio/putchar.c | 87 + target/src/libc/stdio/puts.c | 97 + target/src/libc/stdio/putw.c | 47 + target/src/libc/stdio/refill.c | 183 + target/src/libc/stdio/rewind.c | 93 + target/src/libc/stdio/rget.c | 84 + target/src/libc/stdio/scanf.c | 99 + target/src/libc/stdio/setbuf.c | 88 + target/src/libc/stdio/setbuffer.c | 123 + target/src/libc/stdio/setvbuf.c | 167 + target/src/libc/stdio/stdio.c | 198 + target/src/libc/stdio/stdioLib.c | 376 + target/src/libc/stdio/stdioShow.c | 97 + target/src/libc/stdio/tmpfile.c | 42 + target/src/libc/stdio/tmpnam.c | 78 + target/src/libc/stdio/ungetc.c | 243 + target/src/libc/stdio/vfprintf.c | 160 + target/src/libc/stdio/wbuf.c | 125 + target/src/libc/stdio/wsetup.c | 121 + target/src/libc/stdlib/Makefile | 28 + target/src/libc/stdlib/abort.c | 50 + target/src/libc/stdlib/abs.c | 44 + target/src/libc/stdlib/ansiStdlib.c | 2045 +++ target/src/libc/stdlib/atexit.c | 47 + target/src/libc/stdlib/atof.c | 49 + target/src/libc/stdlib/atoi.c | 49 + target/src/libc/stdlib/atol.c | 49 + target/src/libc/stdlib/bsearch.c | 80 + target/src/libc/stdlib/div.c | 98 + target/src/libc/stdlib/labs.c | 47 + target/src/libc/stdlib/ldiv.c | 90 + target/src/libc/stdlib/multibyte.c | 145 + target/src/libc/stdlib/qsort.c | 386 + target/src/libc/stdlib/rand.c | 72 + target/src/libc/stdlib/strtod.c | 305 + target/src/libc/stdlib/strtol.c | 223 + target/src/libc/stdlib/strtoul.c | 200 + target/src/libc/stdlib/system.c | 42 + target/src/libc/string/Makefile | 32 + target/src/libc/string/ansiString.c | 1732 +++ target/src/libc/string/memchr.c | 58 + target/src/libc/string/memcmp.c | 69 + target/src/libc/string/memcpy.c | 55 + target/src/libc/string/memmove.c | 66 + target/src/libc/string/memset.c | 52 + target/src/libc/string/strcat.c | 56 + target/src/libc/string/strchr.c | 55 + target/src/libc/string/strcmp.c | 51 + target/src/libc/string/strcoll.c | 155 + target/src/libc/string/strcpy.c | 50 + target/src/libc/string/strcspn.c | 61 + target/src/libc/string/strerror.c | 143 + target/src/libc/string/string.c | 15 + target/src/libc/string/strlen.c | 49 + target/src/libc/string/strncat.c | 62 + target/src/libc/string/strncmp.c | 59 + target/src/libc/string/strncpy.c | 63 + target/src/libc/string/strpbrk.c | 65 + target/src/libc/string/strrchr.c | 56 + target/src/libc/string/strspn.c | 61 + target/src/libc/string/strstr.c | 73 + target/src/libc/string/strtok.c | 82 + target/src/libc/string/strtok_r.c | 81 + target/src/libc/string/strxfrm.c | 165 + target/src/libc/string/xstate.c | 88 + target/src/libc/time/Makefile | 27 + target/src/libc/time/ansiTime.c | 1662 +++ target/src/libc/time/asctime.c | 89 + target/src/libc/time/clock.c | 57 + target/src/libc/time/ctime.c | 88 + target/src/libc/time/difftime.c | 48 + target/src/libc/time/gmtime.c | 226 + target/src/libc/time/locTime.c | 42 + target/src/libc/time/localtime.c | 98 + target/src/libc/time/mktime.c | 188 + target/src/libc/time/strftime.c | 644 + target/src/libc/time/time.c | 63 + target/src/math/Makefile | 117 + target/src/math/cabs.c | 217 + target/src/math/cbrt.c | 124 + target/src/math/e_fmod.c | 140 + target/src/math/e_pow.c | 312 + target/src/math/e_remainder.c | 80 + target/src/math/e_sqrt.c | 452 + target/src/math/fdlibm.h | 268 + target/src/math/fpType.c | 142 + target/src/math/ieeefp.h | 49 + target/src/math/rint.c | 74 + target/src/math/s_rint.c | 86 + target/src/math/s_scalbn.c | 103 + target/src/netinet/Makefile | 31 + target/src/netinet/if.c | 1313 ++ target/src/netinet/if_ether.c | 1645 +++ target/src/netinet/if_subr.c | 1149 ++ target/src/netinet/igmp.c | 699 ++ target/src/netinet/in.c | 1218 ++ target/src/netinet/in_cksum.c | 207 + target/src/netinet/in_pcb.c | 865 ++ target/src/netinet/in_proto.c | 140 + target/src/netinet/ip_icmp.c | 1112 ++ target/src/netinet/ip_input.c | 1684 +++ target/src/netinet/ip_mroute.c | 3159 +++++ target/src/netinet/ip_output.c | 1560 +++ target/src/netinet/ppp/Makefile | 25 + target/src/netinet/ppp/auth.c | 906 ++ target/src/netinet/ppp/chap.c | 806 ++ target/src/netinet/ppp/crypt.c | 958 ++ target/src/netinet/ppp/fsm.c | 793 ++ target/src/netinet/ppp/if_ppp.c | 1989 +++ target/src/netinet/ppp/ipcp.c | 1192 ++ target/src/netinet/ppp/lcp.c | 1694 +++ target/src/netinet/ppp/magic.c | 65 + target/src/netinet/ppp/options.c | 1566 +++ target/src/netinet/ppp/pppHookLib.c | 237 + target/src/netinet/ppp/pppLib.c | 1666 +++ target/src/netinet/ppp/pppSecretLib.c | 362 + target/src/netinet/ppp/pppShow.c | 456 + target/src/netinet/ppp/ppp_md5.c | 311 + target/src/netinet/ppp/ppp_vxworks.c | 715 ++ target/src/netinet/ppp/random.c | 379 + target/src/netinet/ppp/upap.c | 559 + target/src/netinet/radix.c | 1176 ++ target/src/netinet/raw_cb.c | 269 + target/src/netinet/raw_ip.c | 687 + target/src/netinet/raw_usrreq.c | 428 + target/src/netinet/route.c | 1961 +++ target/src/netinet/rtsock.c | 1597 +++ target/src/netinet/sl_compress.c | 518 + target/src/netinet/sys_socket.c | 226 + target/src/netinet/tcp_debug.c | 304 + target/src/netinet/tcp_input.c | 2088 +++ target/src/netinet/tcp_output.c | 802 ++ target/src/netinet/tcp_subr.c | 804 ++ target/src/netinet/tcp_timer.c | 417 + target/src/netinet/tcp_usrreq.c | 703 ++ target/src/netinet/udp_usrreq.c | 1126 ++ target/src/netinet/uipc_dom.c | 331 + target/src/netinet/uipc_mbuf.c | 996 ++ target/src/netinet/uipc_sock.c | 1483 +++ target/src/netinet/uipc_sock2.c | 1036 ++ target/src/netinet/unixLib.c | 453 + target/src/netinet/vsLib.c | 903 ++ target/src/netwrs/Makefile | 87 + target/src/netwrs/arpLib.c | 570 + target/src/netwrs/bootpLib.c | 2382 ++++ target/src/netwrs/bsdSockLib.c | 2504 ++++ target/src/netwrs/dhcpcBootLib.c | 747 ++ target/src/netwrs/dhcpcCommonLib.c | 2928 +++++ target/src/netwrs/dhcpcLib.c | 3369 +++++ target/src/netwrs/dhcpcShow.c | 942 ++ target/src/netwrs/dhcprLib.c | 470 + target/src/netwrs/dhcpsLib.c | 1483 +++ target/src/netwrs/etherLib.c | 977 ++ target/src/netwrs/etherMultiLib.c | 228 + target/src/netwrs/ftpLib.c | 1629 +++ target/src/netwrs/ftpdLib.c | 2621 ++++ target/src/netwrs/hostLib.c | 691 + target/src/netwrs/icmpLib.c | 591 + target/src/netwrs/icmpShow.c | 219 + target/src/netwrs/ifIndexLib.c | 156 + target/src/netwrs/ifLib.c | 1545 +++ target/src/netwrs/igmpLib.c | 89 + target/src/netwrs/igmpShow.c | 105 + target/src/netwrs/inetLib.c | 680 + target/src/netwrs/ipFilterLib.c | 130 + target/src/netwrs/ipLib.c | 176 + target/src/netwrs/ipProto.c | 2257 ++++ target/src/netwrs/m2IcmpLib.c | 221 + target/src/netwrs/m2IfLib.c | 2905 +++++ target/src/netwrs/m2IpLib.c | 1346 ++ target/src/netwrs/m2Lib.c | 233 + target/src/netwrs/m2SysLib.c | 379 + target/src/netwrs/m2TcpLib.c | 595 + target/src/netwrs/m2UdpLib.c | 318 + target/src/netwrs/mCastRouteLib.c | 59 + target/src/netwrs/mbufLib.c | 1425 +++ target/src/netwrs/mbufSockLib.c | 437 + target/src/netwrs/mountLib.c | 1195 ++ target/src/netwrs/muxLib.c | 3379 +++++ target/src/netwrs/muxTkLib.c | 1782 +++ target/src/netwrs/netBufLib.c | 2296 ++++ target/src/netwrs/netDrv.c | 2608 ++++ target/src/netwrs/netLib.c | 439 + target/src/netwrs/netShow.c | 1892 +++ target/src/netwrs/nfsDrv.c | 1669 +++ target/src/netwrs/nfsHash.c | 931 ++ target/src/netwrs/nfsLib.c | 2123 ++++ target/src/netwrs/nfsdLib.c | 2275 ++++ target/src/netwrs/pingLib.c | 566 + target/src/netwrs/proxyArpLib.c | 1891 +++ target/src/netwrs/proxyLib.c | 407 + target/src/netwrs/rarpLib.c | 454 + target/src/netwrs/rdiscLib.c | 1013 ++ target/src/netwrs/remLib.c | 594 + target/src/netwrs/resolv/Makefile | 28 + target/src/netwrs/resolv/gethostnamadr.c | 454 + target/src/netwrs/resolv/res_comp.c | 347 + target/src/netwrs/resolv/res_debug.c | 761 ++ target/src/netwrs/resolv/res_mkquery.c | 216 + target/src/netwrs/resolv/res_query.c | 388 + target/src/netwrs/resolv/res_send.c | 479 + target/src/netwrs/resolv/resolvLib.c | 925 ++ target/src/netwrs/resolv/resolvLibDoc.c | 539 + target/src/netwrs/rlogLib.c | 882 ++ target/src/netwrs/routeCommonLib.c | 535 + target/src/netwrs/routeLib.c | 798 ++ target/src/netwrs/routeSockLib.c | 77 + target/src/netwrs/routeUtilLib.c | 799 ++ target/src/netwrs/rpcLib.c | 343 + target/src/netwrs/sntpcLib.c | 533 + target/src/netwrs/sntpsLib.c | 839 ++ target/src/netwrs/sockLib.c | 1519 +++ target/src/netwrs/tcpLib.c | 164 + target/src/netwrs/tcpShow.c | 236 + target/src/netwrs/telnetdLib.c | 1859 +++ target/src/netwrs/tftpLib.c | 1728 +++ target/src/netwrs/tftpdLib.c | 1154 ++ target/src/netwrs/udpLib.c | 122 + target/src/netwrs/udpShow.c | 118 + target/src/netwrs/wvNetLib.c | 937 ++ target/src/netwrs/xdr_bool_t.c | 33 + target/src/netwrs/xdr_nfs.c | 604 + target/src/netwrs/xdr_nfsserv.c | 139 + target/src/netwrs/zbufLib.c | 1161 ++ target/src/netwrs/zbufSockLib.c | 515 + target/src/os/Makefile | 80 + target/src/os/cacheLib.c | 977 ++ target/src/os/cdromFsLib.c | 3613 ++++++ target/src/os/classLib.c | 336 + target/src/os/classShow.c | 147 + target/src/os/clockLib.c | 340 + target/src/os/copyright.c | 26 + target/src/os/dirLib.c | 465 + target/src/os/dspLib.c | 172 + target/src/os/dspShow.c | 114 + target/src/os/envLib.c | 613 + target/src/os/errnoLib.c | 324 + target/src/os/excLib.c | 308 + target/src/os/ffsLib.c | 189 + target/src/os/fioLib.c | 2664 ++++ target/src/os/floatLib.c | 775 ++ target/src/os/fppLib.c | 291 + target/src/os/fppShow.c | 163 + target/src/os/funcBind.c | 261 + target/src/os/hashLib.c | 636 + target/src/os/intLib.c | 102 + target/src/os/ioLib.c | 1334 ++ target/src/os/iosLib.c | 1073 ++ target/src/os/iosShow.c | 150 + target/src/os/logLib.c | 601 + target/src/os/memLib.c | 936 ++ target/src/os/memPartLib.c | 990 ++ target/src/os/memShow.c | 424 + target/src/os/ntPassFsLib.c | 1001 ++ target/src/os/objLib.c | 382 + target/src/os/passFsLib.c | 875 ++ target/src/os/pathLib.c | 673 + target/src/os/pipeDrv.c | 654 + target/src/os/ptyDrv.c | 598 + target/src/os/rebootLib.c | 183 + target/src/os/rt11FsLib.c | 3163 +++++ target/src/os/scsi1Lib.c | 2666 ++++ target/src/os/scsi2Lib.c | 4199 +++++++ target/src/os/scsiCommonLib.c | 214 + target/src/os/scsiCtrlLib.c | 1691 +++ target/src/os/scsiDirectLib.c | 957 ++ target/src/os/scsiLib.c | 712 ++ target/src/os/scsiMgrLib.c | 1918 +++ target/src/os/scsiSeqLib.c | 1624 +++ target/src/os/selectLib.c | 1047 ++ target/src/os/sigLib.c | 2361 ++++ target/src/os/smLib.c | 1150 ++ target/src/os/smPktLib.c | 1599 +++ target/src/os/symLib.c | 1628 +++ target/src/os/symShow.c | 262 + target/src/os/tapeFsLib.c | 2052 +++ target/src/os/taskHookLib.c | 713 ++ target/src/os/taskHookShow.c | 209 + target/src/os/taskVarLib.c | 511 + target/src/os/timerLib.c | 896 ++ target/src/os/ttyDrv.c | 254 + target/src/os/tyLib.c | 1488 +++ target/src/os/unixDrv.c | 534 + target/src/os/vmBaseLib.c | 679 + target/src/os/vmData.c | 33 + target/src/os/vmMpuLib.c | 48 + target/src/ostool/Makefile | 69 + target/src/ostool/bootAoutLib.c | 104 + target/src/ostool/bootEcoffLib.c | 127 + target/src/ostool/bootElfLib.c | 370 + target/src/ostool/bootLoadLib.c | 75 + target/src/ostool/bootSomCoffLib.c | 71 + target/src/ostool/dbgLib.c | 2065 +++ target/src/ostool/dbgTaskLib.c | 870 ++ target/src/ostool/ledLib.c | 2114 ++++ target/src/ostool/loadAoutLib.c | 987 ++ target/src/ostool/loadCoffLib.c | 2984 +++++ target/src/ostool/loadEcoffComm.c | 171 + target/src/ostool/loadEcoffLib.c | 1994 +++ target/src/ostool/loadElfLib.c | 5215 ++++++++ target/src/ostool/loadLib.c | 1012 ++ target/src/ostool/loadPecoffLib.c | 1997 +++ target/src/ostool/loadSomCoffLib.c | 3580 ++++++ target/src/ostool/loginLib.c | 749 ++ target/src/ostool/moduleLib.c | 1524 +++ target/src/ostool/periodHost.c | 68 + target/src/ostool/remShellLib.c | 184 + target/src/ostool/repeatHost.c | 63 + target/src/ostool/shell.c | 2603 ++++ target/src/ostool/shell.slex | 818 ++ target/src/ostool/shell.yacc | 1643 +++ target/src/ostool/shellLib.c | 1096 ++ target/src/ostool/shell_slex_c | 759 ++ target/src/ostool/slex | 285 + target/src/ostool/spyLib.c | 766 ++ target/src/ostool/timexLib.c | 878 ++ target/src/ostool/ttHostLib.c | 187 + target/src/ostool/unldLib.c | 553 + target/src/posix/Makefile | 29 + target/src/posix/_pthreadLib.c | 603 + target/src/posix/_schedPxLib.c | 55 + target/src/posix/aioPxLib.c | 1872 +++ target/src/posix/aioPxShow.c | 103 + target/src/posix/aioSysDrv.c | 729 ++ target/src/posix/ftruncate.c | 79 + target/src/posix/ioQLib.c | 189 + target/src/posix/mmanPxLib.c | 114 + target/src/posix/mqPxLib.c | 1290 ++ target/src/posix/mqPxShow.c | 98 + target/src/posix/mutexPxLib.c | 403 + target/src/posix/posixNameLib.c | 72 + target/src/posix/pthreadLib.c | 3606 ++++++ target/src/posix/schedPxLib.c | 428 + target/src/posix/semPxLib.c | 888 ++ target/src/posix/semPxShow.c | 106 + target/src/posix/symTblLockLib.c | 75 + target/src/rip/Makefile | 28 + target/src/rip/af.c | 324 + target/src/rip/inet.c | 245 + target/src/rip/input.c | 1239 ++ target/src/rip/m2RipLib.c | 540 + target/src/rip/md5.c | 446 + target/src/rip/output.c | 463 + target/src/rip/ripLib.c | 5317 ++++++++ target/src/rip/ripTimer.c | 310 + target/src/rip/routed_if.c | 268 + target/src/rip/startup.c | 1133 ++ target/src/rip/tables.c | 1141 ++ target/src/rpc/Makefile | 31 + target/src/rpc/auth_none.c | 147 + target/src/rpc/auth_unix.c | 366 + target/src/rpc/authunix_pro.c | 87 + target/src/rpc/clnt_generic.c | 127 + target/src/rpc/clnt_perror.c | 339 + target/src/rpc/clnt_raw.c | 323 + target/src/rpc/clnt_simple.c | 139 + target/src/rpc/clnt_tcp.c | 533 + target/src/rpc/clnt_udp.c | 505 + target/src/rpc/get_myaddr.c | 124 + target/src/rpc/pmap_clnt.c | 154 + target/src/rpc/pmap_getmaps.c | 120 + target/src/rpc/pmap_getport.c | 129 + target/src/rpc/pmap_prot.c | 78 + target/src/rpc/pmap_prot2.c | 133 + target/src/rpc/pmap_rmt.c | 491 + target/src/rpc/portmap.c | 460 + target/src/rpc/rpc_callmsg.c | 219 + target/src/rpc/rpc_common.c | 52 + target/src/rpc/rpc_prot.c | 337 + target/src/rpc/svc.c | 536 + target/src/rpc/svc_auth.c | 136 + target/src/rpc/svc_auth_uni.c | 177 + target/src/rpc/svc_raw.c | 258 + target/src/rpc/svc_simple.c | 191 + target/src/rpc/svc_tcp.c | 470 + target/src/rpc/svc_udp.c | 535 + target/src/rpc/xdr.c | 643 + target/src/rpc/xdr_array.c | 159 + target/src/rpc/xdr_float.c | 327 + target/src/rpc/xdr_mem.c | 236 + target/src/rpc/xdr_rec.c | 626 + target/src/rpc/xdr_ref.c | 134 + target/src/tffs/Makefile | 39 + target/src/tffs/backgrnd.c | 148 + target/src/tffs/dosformt.c | 430 + target/src/tffs/fatlite.c | 3079 +++++ target/src/tffs/flbase.c | 122 + target/src/tffs/flflash.c | 414 + target/src/tffs/flparse.c | 99 + target/src/tffs/flsocket.c | 603 + target/src/tffs/fltl.c | 95 + target/src/tffs/ftllite.c | 2137 ++++ target/src/tffs/reedsol.c | 799 ++ target/src/tffs/ssfdc.c | 1854 +++ target/src/tffs/tffsDrv.c | 828 ++ target/src/tffs/tffsLib.c | 408 + target/src/tool/Makefile | 21 + target/src/tool/common/Makefile | 26 + target/src/tool/common/arm_call_via.s | 57 + target/src/tool/common/saverest.s | 297 + target/src/tool/diab/Makefile | 15 + target/src/tool/diab/defs.exclude | 109 + target/src/tool/diab/diabLibFind.tcl | 37 + target/src/tool/diab/libd/Makefile | 26 + target/src/tool/diab/libimpfp-c++/Makefile | 24 + target/src/tool/diab/libimpfp/Makefile | 25 + target/src/tool/diab/libimpl/Makefile | 25 + target/src/tool/diab/libstl/Makefile | 26 + target/src/tool/diab/libtorn/Makefile | 24 + target/src/tool/diab/rules.diab | 18 + target/src/tool/genConfig.tcl | 41 + target/src/tool/gnu/Makefile | 29 + target/src/tool/gnu/defs.exclude | 97 + target/src/tool/gnu/libg++/Makefile | 33 + target/src/tool/gnu/libg++/defs.g++ | 36 + target/src/tool/gnu/libgcc/Makefile | 58 + target/src/tool/gnu/libstdc++/Makefile | 132 + target/src/tool/gnu/rules.gnu | 27 + target/src/tool/objsExclude.tcl | 26 + target/src/tool/rules.tool | 110 + target/src/usb/Makefile | 30 + target/src/usb/ossLib.c | 999 ++ target/src/usb/tools/Makefile | 27 + target/src/usb/tools/cmdParser.c | 487 + target/src/usb/usbDescrCopyLib.c | 167 + target/src/usb/usbHandleLib.c | 377 + target/src/usb/usbHcdLib.c | 553 + target/src/usb/usbLib.c | 531 + target/src/usb/usbListLib.c | 258 + target/src/usb/usbQueueLib.c | 309 + target/src/usb/usbdCoreLib.c | 4123 ++++++ target/src/usb/usbdLib.c | 2485 ++++ target/src/usr/Makefile | 67 + target/src/usr/devSplit.c | 67 + target/src/usr/ramDiskCbio.c | 547 + target/src/usr/tarLib.c | 1166 ++ target/src/usr/usrDosFsOld.c | 595 + target/src/usr/usrFdiskPartLib.c | 1414 +++ target/src/usr/usrFsLib.c | 2078 +++ target/src/util/Makefile | 28 + target/src/util/bLib.c | 740 ++ target/src/util/bootLib.c | 1351 ++ target/src/util/bufLib.c | 180 + target/src/util/cksumLib.c | 66 + target/src/util/dllLib.c | 365 + target/src/util/inflateLib.c | 2472 ++++ target/src/util/lstLib.c | 589 + target/src/util/qFifoLib.c | 280 + target/src/util/qJobLib.c | 556 + target/src/util/qLib.c | 404 + target/src/util/qPriBMapLib.c | 574 + target/src/util/qPriDeltaLib.c | 423 + target/src/util/qPriHeapLib.c | 671 + target/src/util/qPriListLib.c | 469 + target/src/util/rBuffLib.c | 3484 +++++ target/src/util/rBuffShow.c | 278 + target/src/util/rngLib.c | 433 + target/src/util/sllLib.c | 371 + target/src/util/smUtilLib.c | 583 + target/src/util/uncompress.c | 489 + target/src/vxcom/Makefile | 46 + target/src/vxcom/com/FileRegistry.cpp | 448 + target/src/vxcom/com/Makefile | 41 + target/src/vxcom/com/MemoryStream.cpp | 229 + target/src/vxcom/com/MemoryStream.h | 159 + target/src/vxcom/com/TaskAllocator.cpp | 224 + target/src/vxcom/com/TaskAllocator.h | 51 + target/src/vxcom/com/comLib.cpp | 3182 +++++ target/src/vxcom/com/comMisc.cpp | 88 + target/src/vxcom/com/comShow.cpp | 373 + target/src/vxcom/comcore/Makefile | 29 + target/src/vxcom/comcore/comCoreLib.c | 559 + target/src/vxcom/comcore/comRegistry.c | 361 + target/src/vxcom/h/comBase.h | 243 + target/src/vxcom/h/comCoreLib.h | 132 + target/src/vxcom/h/comErr.h | 367 + target/src/vxcom/h/comLib.h | 412 + target/src/vxcom/h/comObjLib.h | 953 ++ target/src/vxcom/h/comObjLibExt.h | 206 + target/src/vxcom/h/comShow.h | 120 + target/src/vxcom/h/make/rules.library.common | 53 + target/src/vxcom/h/make/rules.library.t2 | 61 + target/src/vxcom/h/make/rules.library.unix | 99 + target/src/vxcom/h/make/rules.library.vxWorks | 128 + target/src/vxcom/h/make/unix-defs.vxcom | 16 + target/src/vxcom/h/private/DebugHooks.h | 64 + target/src/vxcom/h/private/comMisc.h | 398 + target/src/vxcom/h/private/comRegistry.h | 121 + target/src/vxcom/h/private/comStl.h | 125 + target/src/vxcom/h/private/comSysLib.h | 93 + target/src/vxcom/idl/ConnectionPoint.idl | 159 + target/src/vxcom/idl/Makefile | 103 + target/src/vxcom/idl/comAutomation.idl | 192 + target/src/vxcom/idl/comCoreTypes.idl | 604 + target/src/vxcom/idl/vxStream.idl | 132 + target/src/vxcom/idl/vxidl.idl | 79 + target/src/vxcom/os/Makefile | 14 + .../src/vxcom/os/VxWorks/comVxWorksSupport.c | 92 + target/src/vxcom/os/comSysLib.c | 130 + target/src/vxcom/os/comSysNtp.c | 154 + target/src/vxcom/os/generic/comGuidLib.c | 153 + target/src/vxcom/os/generic/comTrackLib.c | 53 + .../src/vxcom/veloce-hack/ConnectionPoint.h | 311 + .../src/vxcom/veloce-hack/ConnectionPoint_i.c | 34 + .../vxcom/veloce-hack/ConnectionPoint_ps.cpp | 665 + target/src/vxcom/veloce-hack/Makefile | 11 + target/src/vxcom/veloce-hack/OxidResolver.h | 130 + target/src/vxcom/veloce-hack/OxidResolver_i.c | 30 + .../src/vxcom/veloce-hack/OxidResolver_ps.cpp | 305 + target/src/vxcom/veloce-hack/RemUnknown.h | 102 + target/src/vxcom/veloce-hack/RemUnknown_i.c | 28 + .../src/vxcom/veloce-hack/RemUnknown_ps.cpp | 199 + .../src/vxcom/veloce-hack/RemoteActivation.h | 63 + .../vxcom/veloce-hack/RemoteActivation_i.c | 28 + .../vxcom/veloce-hack/RemoteActivation_ps.cpp | 138 + target/src/vxcom/veloce-hack/comAutomation.h | 203 + .../src/vxcom/veloce-hack/comAutomation_i.c | 26 + .../vxcom/veloce-hack/comAutomation_ps.cpp | 39 + target/src/vxcom/veloce-hack/comCoreTypes.h | 972 ++ target/src/vxcom/veloce-hack/comCoreTypes_i.c | 44 + .../src/vxcom/veloce-hack/comCoreTypes_ps.cpp | 822 ++ target/src/vxcom/veloce-hack/opc_ae.h | 461 + target/src/vxcom/veloce-hack/opc_ae_i.c | 34 + target/src/vxcom/veloce-hack/opc_ae_ps.cpp | 1542 +++ target/src/vxcom/veloce-hack/opccomn.h | 205 + target/src/vxcom/veloce-hack/opccomn_i.c | 32 + target/src/vxcom/veloce-hack/opccomn_ps.cpp | 438 + target/src/vxcom/veloce-hack/opcda.h | 1037 ++ target/src/vxcom/veloce-hack/opcda_i.c | 50 + target/src/vxcom/veloce-hack/opcda_ps.cpp | 2674 ++++ target/src/vxcom/veloce-hack/orpc.h | 359 + target/src/vxcom/veloce-hack/orpc_i.c | 32 + target/src/vxcom/veloce-hack/orpc_ps.cpp | 171 + target/src/vxcom/veloce-hack/rpcDceProto.h | 282 + target/src/vxcom/veloce-hack/rpcDceProto_i.c | 28 + target/src/vxcom/veloce-hack/vxStream.h | 230 + target/src/vxcom/veloce-hack/vxStream_i.c | 30 + target/src/vxcom/veloce-hack/vxStream_ps.cpp | 41 + target/src/vxcom/veloce-hack/vxidl.h | 112 + target/src/vxcom/veloce-hack/vxidl_i.c | 28 + target/src/vxcom/veloce-hack/vxidl_ps.cpp | 21 + target/src/vxdcom/Makefile | 47 + target/src/vxdcom/dcom/ClassFactory_ps.cpp | 138 + target/src/vxdcom/dcom/DceDispatchTable.cpp | 91 + target/src/vxdcom/dcom/DceDispatchTable.h | 74 + target/src/vxdcom/dcom/InterfaceProxy.cpp | 235 + target/src/vxdcom/dcom/InterfaceProxy.h | 119 + target/src/vxdcom/dcom/Makefile | 44 + target/src/vxdcom/dcom/NdrStreams.cpp | 412 + target/src/vxdcom/dcom/NdrStreams.h | 139 + target/src/vxdcom/dcom/NdrTypes.cpp | 2974 +++++ target/src/vxdcom/dcom/NdrTypes.h | 558 + target/src/vxdcom/dcom/ObjectExporter.cpp | 602 + target/src/vxdcom/dcom/ObjectExporter.h | 179 + target/src/vxdcom/dcom/ObjectTable.cpp | 344 + target/src/vxdcom/dcom/ObjectTable.h | 140 + target/src/vxdcom/dcom/PSFactory.cpp | 133 + target/src/vxdcom/dcom/PSFactory.h | 101 + target/src/vxdcom/dcom/RemoteOxid.cpp | 105 + target/src/vxdcom/dcom/RemoteOxid.h | 97 + target/src/vxdcom/dcom/RemoteRegistry.cpp | 312 + target/src/vxdcom/dcom/RemoteRegistry.h | 112 + target/src/vxdcom/dcom/RemoteSCM.cpp | 259 + target/src/vxdcom/dcom/RemoteSCM.h | 99 + target/src/vxdcom/dcom/SCM.cpp | 1485 +++ target/src/vxdcom/dcom/SCM.h | 245 + target/src/vxdcom/dcom/StdMarshaler.cpp | 267 + target/src/vxdcom/dcom/StdMarshaler.h | 90 + target/src/vxdcom/dcom/StdProxy.cpp | 818 ++ target/src/vxdcom/dcom/StdProxy.h | 201 + target/src/vxdcom/dcom/StdStub.cpp | 377 + target/src/vxdcom/dcom/StdStub.h | 112 + target/src/vxdcom/dcom/Stublet.cpp | 142 + target/src/vxdcom/dcom/Stublet.h | 83 + target/src/vxdcom/dcom/dcomLib.cpp | 755 ++ target/src/vxdcom/dcom/dcomShow.cpp | 1816 +++ target/src/vxdcom/dcom/ntlmssp.cpp | 895 ++ target/src/vxdcom/dcom/ntlmssp.h | 413 + target/src/vxdcom/dcom/orpcLib.cpp | 380 + target/src/vxdcom/dcom/orpcLib.h | 184 + target/src/vxdcom/dcom/vxdcomExtent.cpp | 115 + target/src/vxdcom/dcom/vxdcomExtent.h | 42 + target/src/vxdcom/dcom/vxdcomGlobals.cpp | 21 + target/src/vxdcom/h/comInit.h | 40 + target/src/vxdcom/h/dcomExtent.h | 47 + target/src/vxdcom/h/dcomLib.h | 252 + target/src/vxdcom/h/dcomProxy.h | 406 + target/src/vxdcom/h/make/rules.library.t2 | 25 + target/src/vxdcom/h/make/rules.library.unix | 12 + target/src/vxdcom/h/private/vxdcomGlobals.h | 53 + target/src/vxdcom/idl/Makefile | 109 + target/src/vxdcom/idl/OxidResolver.idl | 92 + target/src/vxdcom/idl/RemUnknown.idl | 59 + target/src/vxdcom/idl/RemoteActivation.idl | 48 + target/src/vxdcom/idl/opc_ae.idl | 382 + target/src/vxdcom/idl/opccomn.idl | 125 + target/src/vxdcom/idl/opcda.idl | 681 + target/src/vxdcom/idl/orpc.idl | 428 + target/src/vxdcom/idl/rpcDceProto.idl | 306 + target/src/vxdcom/reactor/Acceptor.h | 83 + target/src/vxdcom/reactor/Acceptor.tcc | 165 + target/src/vxdcom/reactor/Connector.h | 87 + target/src/vxdcom/reactor/Connector.tcc | 117 + target/src/vxdcom/reactor/EventHandler.cpp | 102 + target/src/vxdcom/reactor/EventHandler.h | 74 + target/src/vxdcom/reactor/HandleSet.cpp | 264 + target/src/vxdcom/reactor/HandleSet.h | 88 + target/src/vxdcom/reactor/INETSockAddr.cpp | 230 + target/src/vxdcom/reactor/INETSockAddr.h | 53 + target/src/vxdcom/reactor/Makefile | 16 + target/src/vxdcom/reactor/Reactor.cpp | 749 ++ target/src/vxdcom/reactor/Reactor.h | 209 + target/src/vxdcom/reactor/ReactorHandle.cpp | 67 + target/src/vxdcom/reactor/ReactorHandle.h | 33 + target/src/vxdcom/reactor/ReactorTypes.h | 111 + target/src/vxdcom/reactor/SockAcceptor.cpp | 111 + target/src/vxdcom/reactor/SockAcceptor.h | 65 + target/src/vxdcom/reactor/SockAddr.cpp | 48 + target/src/vxdcom/reactor/SockAddr.h | 40 + target/src/vxdcom/reactor/SockConnector.cpp | 87 + target/src/vxdcom/reactor/SockConnector.h | 44 + target/src/vxdcom/reactor/SockEP.cpp | 287 + target/src/vxdcom/reactor/SockEP.h | 79 + target/src/vxdcom/reactor/SockIO.cpp | 75 + target/src/vxdcom/reactor/SockIO.h | 47 + target/src/vxdcom/reactor/SockStream.cpp | 60 + target/src/vxdcom/reactor/SockStream.h | 69 + target/src/vxdcom/reactor/SvcHandler.h | 68 + target/src/vxdcom/reactor/SvcHandler.tcc | 109 + target/src/vxdcom/reactor/TaskQueue.h | 72 + target/src/vxdcom/reactor/TaskQueue.tcc | 165 + target/src/vxdcom/reactor/ThreadPool.cpp | 321 + target/src/vxdcom/reactor/ThreadPool.h | 107 + target/src/vxdcom/reactor/TimeValue.cpp | 279 + target/src/vxdcom/reactor/TimeValue.h | 115 + target/src/vxdcom/rpc/Makefile | 17 + target/src/vxdcom/rpc/RpcDispatchTable.h | 62 + target/src/vxdcom/rpc/RpcDispatcher.cpp | 263 + target/src/vxdcom/rpc/RpcDispatcher.h | 44 + target/src/vxdcom/rpc/RpcEventHandler.cpp | 410 + target/src/vxdcom/rpc/RpcEventHandler.h | 94 + target/src/vxdcom/rpc/RpcIfClient.cpp | 565 + target/src/vxdcom/rpc/RpcIfClient.h | 105 + target/src/vxdcom/rpc/RpcIfServer.cpp | 132 + target/src/vxdcom/rpc/RpcIfServer.h | 104 + target/src/vxdcom/rpc/RpcPdu.cpp | 869 ++ target/src/vxdcom/rpc/RpcPdu.h | 168 + target/src/vxdcom/rpc/RpcPduFactory.cpp | 394 + target/src/vxdcom/rpc/RpcPduFactory.h | 103 + target/src/vxdcom/rpc/RpcProxyMsg.cpp | 361 + target/src/vxdcom/rpc/RpcProxyMsg.h | 52 + target/src/vxdcom/rpc/RpcStringBinding.cpp | 425 + target/src/vxdcom/rpc/RpcStringBinding.h | 116 + target/src/vxfusion/Makefile | 17 + target/src/vxfusion/drv/Makefile | 25 + target/src/vxfusion/drv/distIfLib.c | 18 + target/src/vxfusion/drv/distIfShow.c | 126 + target/src/vxfusion/os/Makefile | 24 + target/src/vxfusion/os/distNameLib.c | 1544 +++ target/src/vxfusion/os/distNameShow.c | 247 + target/src/vxfusion/os/distObjLib.c | 304 + target/src/vxfusion/os/distStatLib.c | 168 + target/src/vxfusion/wind/Makefile | 28 + target/src/vxfusion/wind/distGapLib.c | 1462 +++ target/src/vxfusion/wind/distIncoLib.c | 397 + target/src/vxfusion/wind/distLib.c | 658 + target/src/vxfusion/wind/distNetLib.c | 785 ++ target/src/vxfusion/wind/distNodeLib.c | 3007 +++++ target/src/vxfusion/wind/distTBufLib.c | 289 + target/src/vxfusion/wind/msgQDistGrpLib.c | 1778 +++ target/src/vxfusion/wind/msgQDistGrpShow.c | 270 + target/src/vxfusion/wind/msgQDistLib.c | 1792 +++ target/src/vxfusion/wind/msgQDistShow.c | 252 + target/src/vxmp/Makefile | 15 + target/src/vxmp/os/Makefile | 26 + target/src/vxmp/os/smFixBlkLib.c | 331 + target/src/vxmp/os/smFixBlkShow.c | 105 + target/src/vxmp/os/smMemLib.c | 1746 +++ target/src/vxmp/os/smMemShow.c | 305 + target/src/vxmp/os/smNameLib.c | 828 ++ target/src/vxmp/os/smNameShow.c | 272 + target/src/vxmp/os/smObjLib.c | 1569 +++ target/src/vxmp/os/smObjShow.c | 279 + target/src/vxmp/util/Makefile | 21 + target/src/vxmp/util/qFifoGLib.c | 456 + target/src/vxmp/util/smDllLib.c | 486 + target/src/vxmp/wind/Makefile | 21 + target/src/vxmp/wind/msgQSmLib.c | 632 + target/src/vxmp/wind/msgQSmShow.c | 526 + target/src/vxmp/wind/semSmLib.c | 1079 ++ target/src/vxmp/wind/semSmShow.c | 323 + target/src/vxvmi/Makefile | 22 + target/src/vxvmi/vmLib.c | 1255 ++ target/src/vxvmi/vmShow.c | 296 + target/src/wdb/Makefile | 36 + target/src/wdb/wdbAltivecLib.c | 126 + target/src/wdb/wdbBpLib.c | 1043 ++ target/src/wdb/wdbCallLib.c | 184 + target/src/wdb/wdbCnctLib.c | 173 + target/src/wdb/wdbCtxExitLib.c | 170 + target/src/wdb/wdbCtxLib.c | 223 + target/src/wdb/wdbCtxStartLib.c | 215 + target/src/wdb/wdbDbgLib.c | 391 + target/src/wdb/wdbDirectCallLib.c | 67 + target/src/wdb/wdbDspLib.c | 92 + target/src/wdb/wdbEvtLib.c | 233 + target/src/wdb/wdbEvtptLib.c | 160 + target/src/wdb/wdbExcLib.c | 210 + target/src/wdb/wdbFpLib.c | 121 + target/src/wdb/wdbFuncBind.c | 22 + target/src/wdb/wdbGopherLib.c | 1075 ++ target/src/wdb/wdbLib.c | 789 ++ target/src/wdb/wdbMemCoreLib.c | 333 + target/src/wdb/wdbMemLib.c | 187 + target/src/wdb/wdbRegLib.c | 138 + target/src/wdb/wdbRpcLib.c | 298 + target/src/wdb/wdbSioTestLib.c | 204 + target/src/wdb/wdbSvcLib.c | 354 + target/src/wdb/wdbTaskBpLib.c | 278 + target/src/wdb/wdbTyCoDrv.c | 210 + target/src/wdb/wdbUdpLib.c | 390 + target/src/wdb/wdbUdpSockLib.c | 280 + target/src/wdb/wdbUserEvtLib.c | 230 + target/src/wdb/wdbVioLib.c | 122 + target/src/wdb/xdr/Makefile | 24 + target/src/wdb/xdr/ctx.c | 49 + target/src/wdb/xdr/ctxcreat.c | 86 + target/src/wdb/xdr/ctxstep.c | 60 + target/src/wdb/xdr/evtdata.c | 182 + target/src/wdb/xdr/evtpoint.c | 107 + target/src/wdb/xdr/memory.c | 98 + target/src/wdb/xdr/regs.c | 75 + target/src/wdb/xdr/rpccksum.c | 263 + target/src/wdb/xdr/tgtinfo.c | 132 + target/src/wdb/xdr/wrapper.c | 118 + target/src/wdb/xdr/xdrcore.c | 270 + target/src/wind/Makefile | 31 + target/src/wind/eventLib.c | 828 ++ target/src/wind/eventShow.c | 177 + target/src/wind/kernelLib.c | 512 + target/src/wind/msgQEvLib.c | 221 + target/src/wind/msgQLib.c | 962 ++ target/src/wind/msgQShow.c | 552 + target/src/wind/schedLib.c | 348 + target/src/wind/semBLib.c | 589 + target/src/wind/semCLib.c | 507 + target/src/wind/semEvLib.c | 261 + target/src/wind/semLib.c | 794 ++ target/src/wind/semMLib.c | 888 ++ target/src/wind/semOLib.c | 210 + target/src/wind/semShow.c | 350 + target/src/wind/taskInfo.c | 469 + target/src/wind/taskLib.c | 2149 ++++ target/src/wind/taskShow.c | 739 ++ target/src/wind/tickLib.c | 236 + target/src/wind/wdLib.c | 488 + target/src/wind/wdShow.c | 166 + target/src/wind/windLib.c | 1200 ++ target/src/wind/workQLib.c | 332 + target/src/wrn/Makefile | 20 + target/src/wrn/util/Makefile | 28 + target/src/wrn/util/avlLib.c | 1277 ++ target/src/wtx/Makefile | 26 + target/src/wtx/regcomp.c | 1880 +++ target/src/wtx/regcore.c | 1113 ++ target/src/wtx/regerror.c | 224 + target/src/wtx/regexec.c | 229 + target/src/wtx/regfree.c | 120 + target/src/wtx/symSyncLib.c | 1903 +++ target/src/wtx/wtx.c | 10458 ++++++++++++++++ target/src/wtx/wtxexch.c | 346 + target/src/wtx/wtxrpc.c | 1621 +++ target/src/wtx/xdrwtx.c | 2717 ++++ target/src/wv/Makefile | 28 + target/src/wv/classLib.c | 336 + target/src/wv/memLib.c | 936 ++ target/src/wv/memPartLib.c | 990 ++ target/src/wv/msgQLib.c | 962 ++ target/src/wv/msgQShow.c | 552 + target/src/wv/objLib.c | 382 + target/src/wv/qJobLib.c | 556 + target/src/wv/schedLib.c | 348 + target/src/wv/semBLib.c | 589 + target/src/wv/semCLib.c | 507 + target/src/wv/semLib.c | 794 ++ target/src/wv/semMLib.c | 888 ++ target/src/wv/semShow.c | 350 + target/src/wv/sigLib.c | 2361 ++++ target/src/wv/taskLib.c | 2149 ++++ target/src/wv/taskShow.c | 739 ++ target/src/wv/tickLib.c | 236 + target/src/wv/wdLib.c | 488 + target/src/wv/wdShow.c | 166 + target/src/wv/windLib.c | 1200 ++ target/src/wv/workQLib.c | 332 + 3987 files changed, 1181678 insertions(+) create mode 100644 LICENSE create mode 100644 README.md create mode 100644 h/CAN/canBoard.h create mode 100644 h/CAN/canController.h create mode 100644 h/CAN/canFixedLL.h create mode 100644 h/CAN/flexcan.h create mode 100644 h/CAN/flexcanOffsets.h create mode 100644 h/CAN/hcan2.h create mode 100644 h/CAN/hcan2Offsets.h create mode 100644 h/CAN/i82527.h create mode 100644 h/CAN/i82527Offsets.h create mode 100644 h/CAN/motMsCan.h create mode 100644 h/CAN/motMsCanOffsets.h create mode 100644 h/CAN/private/esd_can_pc104_200.h create mode 100644 h/CAN/private/esd_pci_200.h create mode 100644 h/CAN/private/m5282CAN.h create mode 100644 h/CAN/private/mpc5200Can.h create mode 100644 h/CAN/private/msmcan.h create mode 100644 h/CAN/private/ppc5xxCAN.h create mode 100644 h/CAN/sja1000.h create mode 100644 h/CAN/sja1000Offsets.h create mode 100644 h/CAN/toucan.h create mode 100644 h/CAN/toucanOffsets.h create mode 100644 h/CAN/wnCAN.h create mode 100644 h/CAN/wncanDevIO.h create mode 100644 h/CAN/wncan_api.h create mode 100644 h/ConnectionPoint.h create mode 100644 h/a_out.h create mode 100644 h/adrSpaceLib.h create mode 100644 h/adrSpaceShow.h create mode 100644 h/aimCacheLib.h create mode 100644 h/aimMmuBaseLib.h create mode 100644 h/aimMmuLib.h create mode 100644 h/aio.h create mode 100644 h/aioSysDrv.h create mode 100644 h/altivecLib.h create mode 100644 h/arch/arm/_G_configArch.h create mode 100644 h/arch/arm/archArm.h create mode 100644 h/arch/arm/archArmCommon.h create mode 100644 h/arch/arm/arm.h create mode 100644 h/arch/arm/asmArm.h create mode 100644 h/arch/arm/cacheArm1136jfLib.h create mode 100644 h/arch/arm/cacheArm926eLib.h create mode 100644 h/arch/arm/cacheArmArch6.h create mode 100644 h/arch/arm/cacheArmLib.h create mode 100644 h/arch/arm/cacheArmXSCALELib.h create mode 100644 h/arch/arm/coprocArm.h create mode 100644 h/arch/arm/dbgArmLib.h create mode 100644 h/arch/arm/dsmArmLib.h create mode 100644 h/arch/arm/elfArm.h create mode 100644 h/arch/arm/esfArm.h create mode 100644 h/arch/arm/excArmLib.h create mode 100644 h/arch/arm/fppArmLib.h create mode 100644 h/arch/arm/in_cksum.h create mode 100644 h/arch/arm/intArmLib.h create mode 100644 h/arch/arm/ivArm.h create mode 100644 h/arch/arm/mmuArm1136jfLib.h create mode 100644 h/arch/arm/mmuArm710aLib.h create mode 100644 h/arch/arm/mmuArm926eLib.h create mode 100644 h/arch/arm/mmuArmArch6PalLib.h create mode 100644 h/arch/arm/mmuArmLib.h create mode 100644 h/arch/arm/mmuArmPalLib.h create mode 100644 h/arch/arm/mmuArmXSCALELib.h create mode 100644 h/arch/arm/regsArm.h create mode 100644 h/arch/arm/sigArmCodes.h create mode 100644 h/arch/arm/syscallArgsarm.h create mode 100644 h/arch/arm/syscallArm.h create mode 100644 h/arch/i86/archI86.h create mode 100644 h/arch/i86/archI86Common.h create mode 100644 h/arch/i86/asmI86.h create mode 100644 h/arch/i86/cacheI86Lib.h create mode 100644 h/arch/i86/coprocI86.h create mode 100644 h/arch/i86/dbgI86Lib.h create mode 100644 h/arch/i86/dbgStrLib.h create mode 100644 h/arch/i86/dsmI86Lib.h create mode 100644 h/arch/i86/elfI86.h create mode 100644 h/arch/i86/esfI86.h create mode 100644 h/arch/i86/excI86Lib.h create mode 100644 h/arch/i86/fppI86Lib.h create mode 100644 h/arch/i86/in_cksum.h create mode 100644 h/arch/i86/instrI86.h create mode 100644 h/arch/i86/intI86Lib.h create mode 100644 h/arch/i86/ipiI86Lib.h create mode 100644 h/arch/i86/ivI86.h create mode 100644 h/arch/i86/mmuI86Lib.h create mode 100644 h/arch/i86/mmuPro32Lib.h create mode 100644 h/arch/i86/mmuPro36Lib.h create mode 100644 h/arch/i86/pentiumLib.h create mode 100644 h/arch/i86/perMonLib.h create mode 100644 h/arch/i86/regsI86.h create mode 100644 h/arch/i86/regsP7.h create mode 100644 h/arch/i86/sStepLib.h create mode 100644 h/arch/i86/sigI86Codes.h create mode 100644 h/arch/i86/syscallArgsx86.h create mode 100644 h/arch/i86/syscallI86.h create mode 100644 h/arch/i86/vxI86Lib.h create mode 100644 h/arch/mips/archMips.h create mode 100644 h/arch/mips/archMipsCommon.h create mode 100644 h/arch/mips/asmMips.h create mode 100644 h/arch/mips/cacheMipsLib.h create mode 100644 h/arch/mips/coprocMips.h create mode 100644 h/arch/mips/dbgMipsLib.h create mode 100644 h/arch/mips/dsmMipsLib.h create mode 100644 h/arch/mips/dspMipsLib.h create mode 100644 h/arch/mips/elfMips.h create mode 100644 h/arch/mips/esfMips.h create mode 100644 h/arch/mips/excMipsLib.h create mode 100644 h/arch/mips/fpSoft.h create mode 100644 h/arch/mips/fppMipsLib.h create mode 100644 h/arch/mips/in_cksum.h create mode 100644 h/arch/mips/intMipsLib.h create mode 100644 h/arch/mips/ivMips.h create mode 100644 h/arch/mips/mipsR2Hazards.h create mode 100644 h/arch/mips/mmuMipsLib.h create mode 100644 h/arch/mips/mti5kxHazards.h create mode 100644 h/arch/mips/palMipsLib.h create mode 100644 h/arch/mips/regsMips.h create mode 100644 h/arch/mips/rm9000.h create mode 100644 h/arch/mips/rm9xxxHazards.h create mode 100644 h/arch/mips/sigMipsCodes.h create mode 100644 h/arch/mips/syscallArgsMIPS32.h create mode 100644 h/arch/mips/syscallArgsMIPS64BE.h create mode 100644 h/arch/mips/syscallArgsMIPS64LE.h create mode 100644 h/arch/mips/syscallMips.h create mode 100644 h/arch/mips/taskMipsLib.h create mode 100644 h/arch/mips/tx49xxHazards.h create mode 100644 h/arch/ppc/403gaSerial.h create mode 100644 h/arch/ppc/altivecPpcLib.h create mode 100644 h/arch/ppc/archPpc.h create mode 100644 h/arch/ppc/archPpcCommon.h create mode 100644 h/arch/ppc/asmPpc.h create mode 100644 h/arch/ppc/cachePpcLib.h create mode 100644 h/arch/ppc/compilerError2704 create mode 100644 h/arch/ppc/compilerError4804 create mode 100644 h/arch/ppc/coprocPpc.h create mode 100644 h/arch/ppc/dbgPpcLib.h create mode 100644 h/arch/ppc/dsmPpcLib.h create mode 100644 h/arch/ppc/elfPpc.h create mode 100644 h/arch/ppc/esfPpc.h create mode 100644 h/arch/ppc/exc440x5.h create mode 100644 h/arch/ppc/excPpcLib.h create mode 100644 h/arch/ppc/fppPpcLib.h create mode 100644 h/arch/ppc/in_cksum.h create mode 100644 h/arch/ppc/ivPpc.h create mode 100644 h/arch/ppc/mmu405Lib.h create mode 100644 h/arch/ppc/mmu440Lib.h create mode 100644 h/arch/ppc/mmu603Lib.h create mode 100644 h/arch/ppc/mmu800Lib.h create mode 100644 h/arch/ppc/mmuArchVars.h create mode 100644 h/arch/ppc/mmuE500Lib.h create mode 100644 h/arch/ppc/mmuPpcLib.h create mode 100644 h/arch/ppc/ppc32.h create mode 100644 h/arch/ppc/ppc403.h create mode 100644 h/arch/ppc/ppc405.h create mode 100644 h/arch/ppc/ppc440.h create mode 100644 h/arch/ppc/ppc5200.h create mode 100644 h/arch/ppc/ppc603.h create mode 100644 h/arch/ppc/ppc604.h create mode 100644 h/arch/ppc/ppc85xx.h create mode 100644 h/arch/ppc/ppc860.h create mode 100644 h/arch/ppc/ppc970.h create mode 100644 h/arch/ppc/private/excArchLibP.h create mode 100644 h/arch/ppc/regsPpc.h create mode 100644 h/arch/ppc/sigPpcCodes.h create mode 100644 h/arch/ppc/spePpcLib.h create mode 100644 h/arch/ppc/syscallArgsppc.h create mode 100644 h/arch/ppc/syscallPpc.h create mode 100644 h/arch/ppc/taskPpcLib.h create mode 100644 h/arch/ppc/toolPpc.h create mode 100644 h/arch/ppc/vxPpcLib.h create mode 100644 h/arch/sh/archSh.h create mode 100644 h/arch/sh/archShCommon.h create mode 100644 h/arch/sh/asmSh.h create mode 100644 h/arch/sh/cacheShLib.h create mode 100644 h/arch/sh/coprocSh.h create mode 100644 h/arch/sh/dbgShLib.h create mode 100644 h/arch/sh/dsmShLib.h create mode 100644 h/arch/sh/dspShLib.h create mode 100644 h/arch/sh/elfSh.h create mode 100644 h/arch/sh/esfSh.h create mode 100644 h/arch/sh/excShLib.h create mode 100644 h/arch/sh/fppShLib.h create mode 100644 h/arch/sh/in_cksum.h create mode 100644 h/arch/sh/intShLib.h create mode 100644 h/arch/sh/ivSh.h create mode 100644 h/arch/sh/mmuShLib.h create mode 100644 h/arch/sh/regsSh.h create mode 100644 h/arch/sh/sh7750.h create mode 100644 h/arch/sh/sh7751.h create mode 100644 h/arch/sh/sh7760.h create mode 100644 h/arch/sh/sh7770.h create mode 100644 h/arch/sh/sigShCodes.h create mode 100644 h/arch/sh/syscallArgssh4.h create mode 100644 h/arch/sh/syscallSh.h create mode 100644 h/arch/sh/toolSh.h create mode 100644 h/arch/sh/vxShLib.h create mode 100644 h/arch/simhppa/archSimhppa.h create mode 100644 h/arch/simhppa/asmSimhppa.h create mode 100644 h/arch/simhppa/dbgSimhppaLib.h create mode 100644 h/arch/simhppa/dsmSimhppaLib.h create mode 100644 h/arch/simhppa/esfSimhppa.h create mode 100644 h/arch/simhppa/excSimhppaLib.h create mode 100644 h/arch/simhppa/fppSimhppaLib.h create mode 100644 h/arch/simhppa/ivSimhppa.h create mode 100644 h/arch/simhppa/regsSimhppa.h create mode 100644 h/arch/simlinux/archSimlinux.h create mode 100644 h/arch/simlinux/archSimlinuxCommon.h create mode 100644 h/arch/simlinux/asmSimlinux.h create mode 100644 h/arch/simlinux/coprocSimlinux.h create mode 100644 h/arch/simlinux/dbgSimlinuxLib.h create mode 100644 h/arch/simlinux/dsmSimlinuxLib.h create mode 100644 h/arch/simlinux/elfI86.h create mode 100644 h/arch/simlinux/esfSimlinux.h create mode 100644 h/arch/simlinux/excSimlinuxLib.h create mode 100644 h/arch/simlinux/fppSimlinuxLib.h create mode 100644 h/arch/simlinux/in_cksum.h create mode 100644 h/arch/simlinux/instrI86.h create mode 100644 h/arch/simlinux/ivSimlinux.h create mode 100644 h/arch/simlinux/mmuArchLib.h create mode 100644 h/arch/simlinux/regsSimlinux.h create mode 100644 h/arch/simlinux/syscallArgsx86.h create mode 100644 h/arch/simlinux/syscallSimlinux.h create mode 100644 h/arch/simlinux/vxSimlinuxLib.h create mode 100644 h/arch/simlinux/vxsimHostArchLib.h create mode 100644 h/arch/simnt/archSimnt.h create mode 100644 h/arch/simnt/archSimntCommon.h create mode 100644 h/arch/simnt/asmSimnt.h create mode 100644 h/arch/simnt/coprocSimnt.h create mode 100644 h/arch/simnt/dbgSimntLib.h create mode 100644 h/arch/simnt/dsmSimntLib.h create mode 100644 h/arch/simnt/elfI86.h create mode 100644 h/arch/simnt/esfSimnt.h create mode 100644 h/arch/simnt/excSimntLib.h create mode 100644 h/arch/simnt/fppSimntLib.h create mode 100644 h/arch/simnt/in_cksum.h create mode 100644 h/arch/simnt/instrI86.h create mode 100644 h/arch/simnt/ivSimnt.h create mode 100644 h/arch/simnt/mmuArchLib.h create mode 100644 h/arch/simnt/ntcontext.h create mode 100644 h/arch/simnt/regsSimnt.h create mode 100644 h/arch/simnt/stdargGnu.h create mode 100644 h/arch/simnt/syscallArgsx86.h create mode 100644 h/arch/simnt/syscallSimnt.h create mode 100644 h/arch/simnt/va_simnt.h create mode 100644 h/arch/simnt/vxSimntLib.h create mode 100644 h/arch/simnt/vxsimArchLib.h create mode 100644 h/arch/simnt/vxsimHostArchLib.h create mode 100644 h/arch/simsolaris/archSimsolaris.h create mode 100644 h/arch/simsolaris/archSimsolarisCommon.h create mode 100644 h/arch/simsolaris/asmSimsolaris.h create mode 100644 h/arch/simsolaris/compilerError13053 create mode 100644 h/arch/simsolaris/compilerError23367 create mode 100644 h/arch/simsolaris/coprocSimsolaris.h create mode 100644 h/arch/simsolaris/dbgSimsolarisLib.h create mode 100644 h/arch/simsolaris/dsmSimsolarisLib.h create mode 100644 h/arch/simsolaris/elfSparc.h create mode 100644 h/arch/simsolaris/esfSimsolaris.h create mode 100644 h/arch/simsolaris/excSimsolarisLib.h create mode 100644 h/arch/simsolaris/fppSimsolarisLib.h create mode 100644 h/arch/simsolaris/in_cksum.h create mode 100644 h/arch/simsolaris/instrSparc.h create mode 100644 h/arch/simsolaris/ivSimsolaris.h create mode 100644 h/arch/simsolaris/mmuArchLib.h create mode 100644 h/arch/simsolaris/regsSimsolaris.h create mode 100644 h/arch/simsolaris/syscallArgsPaddingsparc.h create mode 100644 h/arch/simsolaris/syscallArgssparc.h create mode 100644 h/arch/simsolaris/syscallSimsolaris.h create mode 100644 h/arch/simsolaris/ulipSimsolaris.h create mode 100644 h/arch/simsolaris/vxSimsolarisLib.h create mode 100644 h/arch/simsolaris/vxsimHostArchLib.h create mode 100644 h/arpLib.h create mode 100644 h/arpa/inet.h create mode 100644 h/asm.h create mode 100644 h/assert.h create mode 100644 h/auxv.h create mode 100644 h/avlLib.h create mode 100644 h/avlUintLib.h create mode 100644 h/b_out.h create mode 100644 h/blkIo.h create mode 100644 h/bmpLib.h create mode 100644 h/bootEcoffLib.h create mode 100644 h/bootElfLib.h create mode 100644 h/bootLib.h create mode 100644 h/bootLoadLib.h create mode 100644 h/bootpLib.h create mode 100644 h/bpfDrv.h create mode 100644 h/bsdSockLib.h create mode 100644 h/bsdSockMap.h create mode 100644 h/bspVersion.h create mode 100644 h/buf.h create mode 100644 h/bufLib.h create mode 100644 h/cacheLib.h create mode 100644 h/cbioLib.h create mode 100644 h/cdromFsLib.h create mode 100644 h/classLib.h create mode 100644 h/coff-i386.h create mode 100644 h/coff-pe.h create mode 100644 h/comAutomation.h create mode 100644 h/comBase.h create mode 100644 h/comCoreLib.h create mode 100644 h/comCoreTypes.h create mode 100644 h/comErr.h create mode 100644 h/comLib.h create mode 100644 h/comObjLib.h create mode 100644 h/comObjLibExt.h create mode 100644 h/comShow.h create mode 100644 h/common.h create mode 100644 h/connLib.h create mode 100644 h/coprocLib.h create mode 100644 h/copyright_wrs.h create mode 100644 h/coreDumpLib.h create mode 100644 h/cplusLib.h create mode 100644 h/cpuPwrLib.h create mode 100644 h/cpuPwrMgr.h create mode 100644 h/ctype.h create mode 100644 h/dbgLib.h create mode 100644 h/dbgRpcLib.h create mode 100644 h/dcacheCbio.h create mode 100644 h/dcomExtent.h create mode 100644 h/dcomLib.h create mode 100644 h/dcomProxy.h create mode 100644 h/demangler.h create mode 100644 h/demanglerTypes.h create mode 100644 h/dhcp/common.h create mode 100644 h/dhcp/common_subr.h create mode 100644 h/dhcp/copyright_dhcp.h create mode 100644 h/dhcp/database.h create mode 100644 h/dhcp/dhcp.h create mode 100644 h/dhcp/dhcpc.h create mode 100644 h/dhcp/dhcpcBoot.h create mode 100644 h/dhcp/dhcpcCommonLib.h create mode 100644 h/dhcp/dhcpcInit.h create mode 100644 h/dhcp/dhcpcInternal.h create mode 100644 h/dhcp/dhcpcShow.h create mode 100644 h/dhcp/dhcpcStateLib.h create mode 100644 h/dhcp/dhcps.h create mode 100644 h/dhcp/hash.h create mode 100644 h/dhcpcBootLib.h create mode 100644 h/dhcpcLib.h create mode 100644 h/dhcprLib.h create mode 100644 h/dhcpsLib.h create mode 100644 h/dirent.h create mode 100644 h/dllLib.h create mode 100644 h/dma.h create mode 100644 h/dosFsCommon.h create mode 100644 h/dosFsLib.h create mode 100644 h/dpartCbio.h create mode 100644 h/drv/dma/i8237Dma.h create mode 100644 h/drv/dma/i960Dma.h create mode 100644 h/drv/dma/iPIIX4Dma.h create mode 100644 h/drv/dma/ibmMalDma.h create mode 100644 h/drv/dma/l64853.h create mode 100644 h/drv/dma/m5200Sdma.h create mode 100644 h/drv/dma/m68450.h create mode 100644 h/drv/dma/mpc107Dma.h create mode 100644 h/drv/dma/we32104.h create mode 100644 h/drv/end/amd8111LanEnd.h create mode 100644 h/drv/end/auEnd.h create mode 100644 h/drv/end/bcm1250MacEnd.h create mode 100644 h/drv/end/dec21x40End.h create mode 100644 h/drv/end/dec21x4xEnd.h create mode 100644 h/drv/end/ei82596End.h create mode 100644 h/drv/end/el3c90xEnd.h create mode 100644 h/drv/end/elt3c509End.h create mode 100644 h/drv/end/emacEnd.h create mode 100644 h/drv/end/fei82557End.h create mode 100644 h/drv/end/gei82543End.h create mode 100644 h/drv/end/iOlicomEnd.h create mode 100644 h/drv/end/ln7990End.h create mode 100644 h/drv/end/ln7990EndCommon.h create mode 100644 h/drv/end/ln97xEnd.h create mode 100644 h/drv/end/m5200FecEnd.h create mode 100644 h/drv/end/m8260Fcc.h create mode 100644 h/drv/end/m8260SccEnd.h create mode 100644 h/drv/end/mb86960End.h create mode 100644 h/drv/end/mbcEnd.h create mode 100644 h/drv/end/motCpmEnd.h create mode 100644 h/drv/end/motFcc2End.h create mode 100644 h/drv/end/motFccEnd.h create mode 100644 h/drv/end/motFecEnd.h create mode 100644 h/drv/end/motTsecEnd.h create mode 100644 h/drv/end/ne2000End.h create mode 100644 h/drv/end/nicEvbEnd.h create mode 100644 h/drv/end/ns83902End.h create mode 100644 h/drv/end/sh7615End.h create mode 100644 h/drv/end/simnetEnd.h create mode 100644 h/drv/end/smEnd.h create mode 100644 h/drv/end/sn83932End.h create mode 100644 h/drv/end/ultraEnd.h create mode 100644 h/drv/end/wancomEnd.h create mode 100644 h/drv/erf/erfLib.h create mode 100644 h/drv/erf/erfLibP.h create mode 100644 h/drv/erf/erfShow.h create mode 100644 h/drv/fdisk/nec765Fd.h create mode 100644 h/drv/hdisk/ataDrv.h create mode 100644 h/drv/hdisk/ideDrv.h create mode 100644 h/drv/hdisk/m5200AtaDrv.h create mode 100644 h/drv/i2c/i2cLib.h create mode 100644 h/drv/i2c/ixp400I2c.h create mode 100644 h/drv/i2c/m5200I2CMaster.h create mode 100644 h/drv/intrCtl/hd644232.h create mode 100644 h/drv/intrCtl/i82378Ibc.h create mode 100644 h/drv/intrCtl/i8259.h create mode 100644 h/drv/intrCtl/i8259a.h create mode 100644 h/drv/intrCtl/ioApic.h create mode 100644 h/drv/intrCtl/ixp400IntrCtl.h create mode 100644 h/drv/intrCtl/loApic.h create mode 100644 h/drv/intrCtl/m33242j.h create mode 100644 h/drv/intrCtl/m5200Intr.h create mode 100644 h/drv/intrCtl/m68153.h create mode 100644 h/drv/intrCtl/m8260IntrCtl.h create mode 100644 h/drv/intrCtl/mpc107Epic.h create mode 100644 h/drv/intrCtl/ppc555Intr.h create mode 100644 h/drv/intrCtl/ppc860Intr.h create mode 100644 h/drv/intrCtl/quiccIntrCtl.h create mode 100644 h/drv/intrCtl/s68154.h create mode 100644 h/drv/intrCtl/s68155.h create mode 100644 h/drv/intrCtl/sa150xIntrCtl.h create mode 100644 h/drv/manager/device.h create mode 100644 h/drv/mem/amd29LV800TMem.h create mode 100644 h/drv/mem/flash28.h create mode 100644 h/drv/mem/flash29.h create mode 100644 h/drv/mem/flashDev.h create mode 100644 h/drv/mem/i28f640j3mem.h create mode 100644 h/drv/mem/iFlash.h create mode 100644 h/drv/mem/m8260Memc.h create mode 100644 h/drv/mem/m8260Siu.h create mode 100644 h/drv/mem/m82xxDpramLib.h create mode 100644 h/drv/mem/mcecc.h create mode 100644 h/drv/mem/memDev.h create mode 100644 h/drv/mem/mpc107MemInit.h create mode 100644 h/drv/mem/quiccLbc.h create mode 100644 h/drv/mem/unsupported/mcecc.h create mode 100644 h/drv/multi/auLib.h create mode 100644 h/drv/multi/bcm1250Lib.h create mode 100644 h/drv/multi/cvmeSqsys1.h create mode 100644 h/drv/multi/cvmeSqsys3.h create mode 100644 h/drv/multi/ds1244y.h create mode 100644 h/drv/multi/fc68165.h create mode 100644 h/drv/multi/fga002.h create mode 100644 h/drv/multi/frcEagle01.h create mode 100644 h/drv/multi/frcEagle02.h create mode 100644 h/drv/multi/gt64120a.h create mode 100644 h/drv/multi/i534.h create mode 100644 h/drv/multi/i82510.h create mode 100644 h/drv/multi/ivic.h create mode 100644 h/drv/multi/m5204.h create mode 100644 h/drv/multi/m5206.h create mode 100644 h/drv/multi/m5206e.h create mode 100644 h/drv/multi/m5272.h create mode 100644 h/drv/multi/m5307.h create mode 100644 h/drv/multi/m5407.h create mode 100644 h/drv/multi/m68230.h create mode 100644 h/drv/multi/m68302.h create mode 100644 h/drv/multi/m68332.h create mode 100644 h/drv/multi/m68340.h create mode 100644 h/drv/multi/m68360.h create mode 100644 h/drv/multi/m68562.h create mode 100644 h/drv/multi/m68681.h create mode 100644 h/drv/multi/m68901.h create mode 100644 h/drv/multi/mcchip.h create mode 100644 h/drv/multi/mcecc.h create mode 100644 h/drv/multi/memc040.h create mode 100644 h/drv/multi/mpc107.h create mode 100644 h/drv/multi/mpc107I2c.h create mode 100644 h/drv/multi/mpc107Msg.h create mode 100644 h/drv/multi/msc01.h create mode 100644 h/drv/multi/mz7120sp4.h create mode 100644 h/drv/multi/nvr4101.h create mode 100644 h/drv/multi/nvr4102.h create mode 100644 h/drv/multi/nvr4121.h create mode 100644 h/drv/multi/nvr4122.h create mode 100644 h/drv/multi/nvr4131.h create mode 100644 h/drv/multi/pccchip.h create mode 100644 h/drv/multi/pccchip2.h create mode 100644 h/drv/multi/ppc555Siu.h create mode 100644 h/drv/multi/ppc860Cpm.h create mode 100644 h/drv/multi/ppc860Siu.h create mode 100644 h/drv/multi/smcFdc37b78x.h create mode 100644 h/drv/multi/stp2003.h create mode 100644 h/drv/multi/z8536.h create mode 100644 h/drv/netif/if_cpm.h create mode 100644 h/drv/netif/if_cs.h create mode 100644 h/drv/netif/if_dc.h create mode 100644 h/drv/netif/if_eex.h create mode 100644 h/drv/netif/if_eex32.h create mode 100644 h/drv/netif/if_ei.h create mode 100644 h/drv/netif/if_eihk.h create mode 100644 h/drv/netif/if_elc.h create mode 100644 h/drv/netif/if_elt.h create mode 100644 h/drv/netif/if_ene.h create mode 100644 h/drv/netif/if_esmc.h create mode 100644 h/drv/netif/if_fei.h create mode 100644 h/drv/netif/if_fn.h create mode 100644 h/drv/netif/if_ln.h create mode 100644 h/drv/netif/if_lnPci.h create mode 100644 h/drv/netif/if_mbc.h create mode 100644 h/drv/netif/if_nicEvb.h create mode 100644 h/drv/netif/if_sm.h create mode 100644 h/drv/netif/if_sn.h create mode 100644 h/drv/netif/if_ultra.h create mode 100644 h/drv/netif/netifDev.h create mode 100644 h/drv/netif/smNetLib.h create mode 100644 h/drv/parallel/lptDrv.h create mode 100644 h/drv/parallel/m5m82c55afp.h create mode 100644 h/drv/parallel/m8260IOPort.h create mode 100644 h/drv/pci/iPIIX4.h create mode 100644 h/drv/pci/iPiix4Pci.h create mode 100644 h/drv/pci/mpc105.h create mode 100644 h/drv/pci/mpc107Pci.h create mode 100644 h/drv/pci/pciAutoConfigLib.h create mode 100644 h/drv/pci/pciConfigLib.h create mode 100644 h/drv/pci/pciConfigShow.h create mode 100644 h/drv/pci/pciExpressLib.h create mode 100644 h/drv/pci/pciHeaderDefs.h create mode 100644 h/drv/pci/pciIntLib.h create mode 100644 h/drv/pci/pciIomapLib.h create mode 100644 h/drv/pci/pciLocalBus.h create mode 100644 h/drv/pci/pciXLib.h create mode 100644 h/drv/pcmcia/cisLib.h create mode 100644 h/drv/pcmcia/pccardLib.h create mode 100644 h/drv/pcmcia/pcic.h create mode 100644 h/drv/pcmcia/pcmciaLib.h create mode 100644 h/drv/pcmcia/pd67.h create mode 100644 h/drv/pcmcia/ricoh.h create mode 100644 h/drv/pcmcia/sramDrv.h create mode 100644 h/drv/pcmcia/tcic.h create mode 100644 h/drv/pcmcia/vg468.h create mode 100644 h/drv/rtc/hd146818.h create mode 100644 h/drv/rtc/n8570.h create mode 100644 h/drv/rtc/rtc64613.h create mode 100644 h/drv/rtc/s62421.h create mode 100644 h/drv/rtc/unsupported/hd146818.h create mode 100644 h/drv/rtc/unsupported/n8570.h create mode 100644 h/drv/rtc/unsupported/rtc64613.h create mode 100644 h/drv/rtc/unsupported/s62421.h create mode 100644 h/drv/scsi/aic7880.h create mode 100644 h/drv/scsi/mb87030.h create mode 100644 h/drv/scsi/mb87030_1.h create mode 100644 h/drv/scsi/ncr5390.h create mode 100644 h/drv/scsi/ncr5390_1.h create mode 100644 h/drv/scsi/ncr5390_2.h create mode 100644 h/drv/scsi/ncr710.h create mode 100644 h/drv/scsi/ncr710Script.h create mode 100644 h/drv/scsi/ncr710Script1.h create mode 100644 h/drv/scsi/ncr710Script2.h create mode 100644 h/drv/scsi/ncr710_1.h create mode 100644 h/drv/scsi/ncr710_2.h create mode 100644 h/drv/scsi/ncr810.h create mode 100644 h/drv/scsi/ncr810Script.h create mode 100644 h/drv/scsi/sym895.h create mode 100644 h/drv/scsi/wd33c93.h create mode 100644 h/drv/scsi/wd33c93_1.h create mode 100644 h/drv/scsi/wd33c93_2.h create mode 100644 h/drv/serial/i8042.h create mode 100644 h/drv/serial/m68681.h create mode 100644 h/drv/serial/pcConsole.h create mode 100644 h/drv/sio/ambaSio.h create mode 100644 h/drv/sio/cd2400Sio.h create mode 100644 h/drv/sio/coldfireSio.h create mode 100644 h/drv/sio/evbNs16550Sio.h create mode 100644 h/drv/sio/i8250Sio.h create mode 100644 h/drv/sio/ixp400Sio.h create mode 100644 h/drv/sio/ixp425Sio.h create mode 100644 h/drv/sio/m5200PscSio.h create mode 100644 h/drv/sio/m5204Sio.h create mode 100644 h/drv/sio/m5206Sio.h create mode 100644 h/drv/sio/m68302Sio.h create mode 100644 h/drv/sio/m68332Sio.h create mode 100644 h/drv/sio/m68360Sio.h create mode 100644 h/drv/sio/m68562Sio.h create mode 100644 h/drv/sio/m68681Sio.h create mode 100644 h/drv/sio/m68901Sio.h create mode 100644 h/drv/sio/m8260Brg.h create mode 100644 h/drv/sio/m8260Cp.h create mode 100644 h/drv/sio/m8260CpmMux.h create mode 100644 h/drv/sio/m8260Scc.h create mode 100644 h/drv/sio/m8260Sio.h create mode 100644 h/drv/sio/mb86940Sio.h create mode 100644 h/drv/sio/ns16552Sio.h create mode 100644 h/drv/sio/nvr4101DSIUSio.h create mode 100644 h/drv/sio/nvr4101SIUSio.h create mode 100644 h/drv/sio/nvr4102DSIUSio.h create mode 100644 h/drv/sio/ppc403Sio.h create mode 100644 h/drv/sio/ppc555SciSio.h create mode 100644 h/drv/sio/ppc860Sio.h create mode 100644 h/drv/sio/rm9000x2glSio.h create mode 100644 h/drv/sio/sa1100Sio.h create mode 100644 h/drv/sio/sab82532Sio.h create mode 100644 h/drv/sio/shSciSio.h create mode 100644 h/drv/sio/shScifSio.h create mode 100644 h/drv/sio/st16552Sio.h create mode 100644 h/drv/sio/templateSio.h create mode 100644 h/drv/sio/z8530Sio.h create mode 100644 h/drv/sound/ac97.h create mode 100644 h/drv/sound/sb16drv.h create mode 100644 h/drv/sound/sound_dma.h create mode 100644 h/drv/sound/sound_ioctl.h create mode 100644 h/drv/sound/soundcard.h create mode 100644 h/drv/timer/CIOTimer.h create mode 100644 h/drv/timer/ambaTimer.h create mode 100644 h/drv/timer/amd8111Timer.h create mode 100644 h/drv/timer/coldfireTimer.h create mode 100644 h/drv/timer/dga001Timer.h create mode 100644 h/drv/timer/i8253.h create mode 100644 h/drv/timer/i8254.h create mode 100644 h/drv/timer/ixp400Timer.h create mode 100644 h/drv/timer/m5200GPTimer.h create mode 100644 h/drv/timer/m5200SliceTimer.h create mode 100644 h/drv/timer/m5m82c54fp.h create mode 100644 h/drv/timer/m8260Clock.h create mode 100644 h/drv/timer/m8260Timer.h create mode 100644 h/drv/timer/mc146818.h create mode 100644 h/drv/timer/ppc403Timer.h create mode 100644 h/drv/timer/ppcDecTimer.h create mode 100644 h/drv/timer/ppcZ8536Timer.h create mode 100644 h/drv/timer/quiccTimer.h create mode 100644 h/drv/timer/sa1100Timer.h create mode 100644 h/drv/timer/sa1501Timer.h create mode 100644 h/drv/timer/timerDev.h create mode 100644 h/drv/timer/timestampDev.h create mode 100644 h/drv/timer/z8536.h create mode 100644 h/drv/usb/target/usbIsp1582.h create mode 100644 h/drv/usb/target/usbIsp1582Debug.h create mode 100644 h/drv/usb/target/usbIsp1582Eval.h create mode 100644 h/drv/usb/target/usbIsp1582Tcd.h create mode 100644 h/drv/usb/target/usbNET2280.h create mode 100644 h/drv/usb/target/usbNET2280Tcd.h create mode 100644 h/drv/usb/target/usbPdiusbd12.h create mode 100644 h/drv/usb/target/usbPdiusbd12Debug.h create mode 100644 h/drv/usb/target/usbPdiusbd12Eval.h create mode 100644 h/drv/usb/target/usbPdiusbd12Tcd.h create mode 100644 h/drv/usb/target/usbTargKbdLib.h create mode 100644 h/drv/usb/target/usbTargMsLib.h create mode 100644 h/drv/usb/target/usbTargPhilipsD12EvalLib.h create mode 100644 h/drv/usb/target/usbTargPrnLib.h create mode 100644 h/drv/usb/target/usbTargRbcCmd.h create mode 100644 h/drv/usb/target/usbTargRbcLib.h create mode 100644 h/drv/usb/target/usbTcd.h create mode 100644 h/drv/usb/target/usbTcdIsp1582EvalLib.h create mode 100644 h/drv/usb/target/usbTcdNET2280Debug.h create mode 100644 h/drv/usb/target/usbTcdNET2280Lib.h create mode 100644 h/drv/usb/target/usbTcdPdiusbd12EvalLib.h create mode 100644 h/drv/usb/usbAcmLib.h create mode 100644 h/drv/usb/usbBulkDevLib.h create mode 100644 h/drv/usb/usbBulkDevLibP.h create mode 100644 h/drv/usb/usbCbiUfiDevLib.h create mode 100644 h/drv/usb/usbCbiUfiDevLibP.h create mode 100644 h/drv/usb/usbHcd.h create mode 100644 h/drv/usb/usbHcdOhciLib.h create mode 100644 h/drv/usb/usbHcdUhciLib.h create mode 100644 h/drv/usb/usbKeyboardLib.h create mode 100644 h/drv/usb/usbKlsiEnd.h create mode 100644 h/drv/usb/usbMouseLib.h create mode 100644 h/drv/usb/usbNC1080End.h create mode 100644 h/drv/usb/usbOhci.h create mode 100644 h/drv/usb/usbPegasusEnd.h create mode 100644 h/drv/usb/usbPrinterLib.h create mode 100644 h/drv/usb/usbSpeakerLib.h create mode 100644 h/drv/usb/usbTransUnit.h create mode 100644 h/drv/usb/usbTransUnitTypes.h create mode 100644 h/drv/usb/usbUhci.h create mode 100644 h/drv/vme/busLocal.h create mode 100644 h/drv/vme/dga001Vme.h create mode 100644 h/drv/vme/ivac.h create mode 100644 h/drv/vme/unsupported/busLocal.h create mode 100644 h/drv/vme/unsupported/dga001Vme.h create mode 100644 h/drv/vme/unsupported/ivac.h create mode 100644 h/drv/vme/unsupported/mb86986Vme.h create mode 100644 h/drv/vme/unsupported/vbic.h create mode 100644 h/drv/vme/unsupported/vic068.h create mode 100644 h/drv/vme/unsupported/vme2Pci.h create mode 100644 h/drv/vme/unsupported/vmechip.h create mode 100644 h/drv/vme/unsupported/vmechip2.h create mode 100644 h/drv/vme/unsupported/vsam.h create mode 100644 h/drv/vme/unsupported/vsbchip2.h create mode 100644 h/drv/vme/vbic.h create mode 100644 h/drv/vme/vic068.h create mode 100644 h/drv/vme/vme2Pci.h create mode 100644 h/drv/vme/vmechip.h create mode 100644 h/drv/vme/vmechip2.h create mode 100644 h/drv/vme/vsam.h create mode 100644 h/drv/vme/vsbchip2.h create mode 100644 h/drv/vxfusion/distIfUdp.h create mode 100644 h/drv/wdb/vision/visionTmdDrv.h create mode 100644 h/drv/wdb/vision/wdbVisionDrv.h create mode 100644 h/drv/wdb/vision/wdbVisionDrvIF.h create mode 100644 h/drv/wdb/vision/wdbVisionPktDrv.h create mode 100644 h/drv/wdb/wdbBdmPktDrv.h create mode 100644 h/drv/wdb/wdbEndPktDrv.h create mode 100644 h/drv/wdb/wdbNetromPktDrv.h create mode 100644 h/drv/wdb/wdbPipePktDrv.h create mode 100644 h/drv/wdb/wdbSlipPktDrv.h create mode 100644 h/drv/wdb/wdbTemplatePktDrv.h create mode 100644 h/drv/wdb/wdbUlipPktDrv.h create mode 100644 h/drv/wdb/wdbVioDrv.h create mode 100644 h/drv/wlan/dot11Bsp.h create mode 100644 h/drv/wlan/dot11HddLib.h create mode 100644 h/drv/wlan/dot11Lib.h create mode 100644 h/drv/wlan/dot11RsnLib.h create mode 100644 h/drv/wlan/dot11SmeApLib.h create mode 100644 h/drv/wlan/dot11SmeEssLib.h create mode 100644 h/drv/wlan/dot11SmeIbssLib.h create mode 100644 h/drv/wlan/dot11SmeLib.h create mode 100644 h/drv/wlan/dot11Test.h create mode 100644 h/drv/wlan/dot11TimerLib.h create mode 100644 h/drv/wlan/dot11UsrLib.h create mode 100644 h/drv/xbd/bio.h create mode 100644 h/drv/xbd/xbd.h create mode 100644 h/dsi/backend/dsiSockLib.h create mode 100644 h/dsi/backend/dsiUtilLib.h create mode 100644 h/dsi/private/salClientP.h create mode 100644 h/dsi/private/salCommonP.h create mode 100644 h/dsi/private/salServerP.h create mode 100644 h/dsi/private/snsLibP.h create mode 100644 h/dsi/salClient.h create mode 100644 h/dsi/salCommon.h create mode 100644 h/dsi/salServer.h create mode 100644 h/dsi/snsLib.h create mode 100644 h/dsi/un/unCompLib.h create mode 100644 h/dsi/un/unLib.h create mode 100644 h/dsi/un/unShow.h create mode 100644 h/dsi/un/uncomp.h create mode 100644 h/dsi/un/uncomp_fsm.h create mode 100644 h/dsi/un/uncomp_var.h create mode 100644 h/dsmLib.h create mode 100644 h/dspLib.h create mode 100644 h/ecoff.h create mode 100644 h/ecoffSyms.h create mode 100644 h/edrErrLogLib.h create mode 100644 h/edrLib.h create mode 100644 h/edrLibCommon.h create mode 100644 h/elf.h create mode 100644 h/elftypes.h create mode 100644 h/end.h create mode 100644 h/endCommon.h create mode 100644 h/endLib.h create mode 100644 h/envLib.h create mode 100644 h/envoy.h create mode 100644 h/errno.h create mode 100644 h/errnoLib.h create mode 100644 h/esf.h create mode 100644 h/etherLib.h create mode 100644 h/etherMultiLib.h create mode 100644 h/eventLib.h create mode 100644 h/eventLibCommon.h create mode 100644 h/excLib.h create mode 100644 h/fcntl.h create mode 100644 h/fioLib.h create mode 100644 h/fppLib.h create mode 100644 h/fsEventUtilLib.h create mode 100644 h/fsMonitor.h create mode 100644 h/ftpLib.h create mode 100644 h/ftpdLib.h create mode 100644 h/generic.h create mode 100644 h/hashLib.h create mode 100644 h/hookLib.h create mode 100644 h/hostLib.h create mode 100644 h/hpAout.h create mode 100644 h/hrFsLib.h create mode 100644 h/hwif/util/hwMemLib.h create mode 100644 h/hwif/vxbus/busLib.h create mode 100644 h/hwif/vxbus/hwConf.h create mode 100644 h/hwif/vxbus/pciBusLib.h create mode 100644 h/hwif/vxbus/plbBusLib.h create mode 100644 h/icmpLib.h create mode 100644 h/ifIndexLib.h create mode 100644 h/ifLib.h create mode 100644 h/if_bp.h create mode 100644 h/if_sl.h create mode 100644 h/in.h create mode 100644 h/inetLib.h create mode 100644 h/intLib.h create mode 100644 h/ioLib.h create mode 100644 h/ioQLib.h create mode 100644 h/ioctl.h create mode 100644 h/iosLib.h create mode 100644 h/iosScLib.h create mode 100644 h/ipProto.h create mode 100644 h/isrLib.h create mode 100644 h/iv.h create mode 100644 h/kernelLib.h create mode 100644 h/ledLib.h create mode 100644 h/limits.h create mode 100644 h/loadAoutLib.h create mode 100644 h/loadCoffLib.h create mode 100644 h/loadEcoffComm.h create mode 100644 h/loadEcoffLib.h create mode 100644 h/loadElfLib.h create mode 100644 h/loadLib.h create mode 100644 h/loadPecoffLib.h create mode 100644 h/loadSomCoffLib.h create mode 100644 h/locale.h create mode 100644 h/logLib.h create mode 100644 h/loginLib.h create mode 100644 h/lstLib.h create mode 100644 h/m2IfLib.h create mode 100644 h/m2Lib.h create mode 100644 h/make/README.TXT create mode 100644 h/make/config/comps/coreip/defs.default create mode 100644 h/make/config/comps/coreip/defs.docs create mode 100644 h/make/config/comps/coreip/defs.subdirs create mode 100644 h/make/config/comps/coreip/rules.default create mode 100644 h/make/config/comps/dot1x/defs.default create mode 100644 h/make/config/comps/dot1x/defs.docs create mode 100644 h/make/config/comps/dot1x/defs.subdirs create mode 100644 h/make/config/comps/dot1x/rules.default create mode 100644 h/make/config/comps/ipSec/defs.default create mode 100644 h/make/config/comps/ipSec/defs.docs create mode 100644 h/make/config/comps/ipSec/defs.subdirs create mode 100644 h/make/config/comps/ipSec/rules.default create mode 100644 h/make/config/comps/ppp/defs.default create mode 100644 h/make/config/comps/ppp/defs.docs create mode 100644 h/make/config/comps/ppp/defs.subdirs create mode 100644 h/make/config/comps/ppp/rules.default create mode 100644 h/make/config/comps/radius/defs.default create mode 100644 h/make/config/comps/radius/defs.docs create mode 100644 h/make/config/comps/radius/defs.subdirs create mode 100644 h/make/config/comps/radius/rules.default create mode 100644 h/make/config/comps/security/defs.default create mode 100644 h/make/config/comps/security/defs.docs create mode 100644 h/make/config/comps/security/defs.subdirs create mode 100644 h/make/config/comps/security/rules.default create mode 100644 h/make/config/comps/ssl/defs.default create mode 100644 h/make/config/comps/ssl/defs.docs create mode 100644 h/make/config/comps/ssl/defs.subdirs create mode 100644 h/make/config/comps/ssl/rules.default create mode 100644 h/make/config/comps/tipc/defs.docs create mode 100644 h/make/config/comps/usb/defs.docs create mode 100644 h/make/config/comps/wlan/defs.default create mode 100644 h/make/config/comps/wlan/defs.docs create mode 100644 h/make/config/comps/wlan/defs.subdirs create mode 100644 h/make/config/comps/wlan/rules.default create mode 100644 h/make/config/defs.version create mode 100644 h/make/defs.bsp create mode 100644 h/make/defs.default create mode 100644 h/make/defs.drivers create mode 100644 h/make/defs.library create mode 100644 h/make/defs.link create mode 100644 h/make/defs.memory create mode 100644 h/make/defs.option create mode 100644 h/make/defs.pal create mode 100644 h/make/defs.project create mode 100644 h/make/defs.singleCpuVariant create mode 100644 h/make/defs.sun4-solaris2 create mode 100644 h/make/defs.unix create mode 100644 h/make/defs.vxApp create mode 100644 h/make/defs.vxWorks create mode 100644 h/make/defs.vxcom create mode 100644 h/make/defs.x86-freebsd create mode 100644 h/make/defs.x86-linux2 create mode 100644 h/make/defs.x86-win32 create mode 100644 h/make/make.PENTIUM2gnu create mode 100644 h/make/make.PENTIUM3gnu create mode 100644 h/make/make.PENTIUM4gnu create mode 100644 h/make/make.PENTIUMgnu create mode 100644 h/make/make.SIMNTgnu create mode 100644 h/make/make.SIMSPARCSOLARISgnu create mode 100644 h/make/makearch.mf create mode 100644 h/make/rules-apps.sun4-solaris2 create mode 100644 h/make/rules-apps.unix create mode 100644 h/make/rules-apps.x86-freebsd create mode 100644 h/make/rules-apps.x86-linux2 create mode 100644 h/make/rules-apps.x86-win32 create mode 100644 h/make/rules-lib.sun4-solaris2 create mode 100644 h/make/rules-lib.unix create mode 100644 h/make/rules-lib.x86-freebsd create mode 100644 h/make/rules-lib.x86-linux2 create mode 100644 h/make/rules-lib.x86-win32 create mode 100644 h/make/rules.apps create mode 100644 h/make/rules.bsp create mode 100644 h/make/rules.fs create mode 100644 h/make/rules.gpp create mode 100644 h/make/rules.library create mode 100644 h/make/rules.memory create mode 100644 h/make/rules.project create mode 100644 h/make/rules.sun4-solaris2 create mode 100644 h/make/rules.unix create mode 100644 h/make/rules.vxApp create mode 100644 h/make/rules.vxWorks create mode 100644 h/make/rules.x86-freebsd create mode 100644 h/make/rules.x86-linux2 create mode 100644 h/make/rules.x86-win32 create mode 100644 h/math.h create mode 100644 h/mbufLib.h create mode 100644 h/mbufSockLib.h create mode 100644 h/memDrv.h create mode 100644 h/memLib.h create mode 100644 h/memLogLib.h create mode 100644 h/memPartLib.h create mode 100644 h/miiLib.h create mode 100644 h/mmuAttr.h create mode 100644 h/mmuLib.h create mode 100644 h/moduleLib.h create mode 100644 h/moduleShow.h create mode 100644 h/mount.h create mode 100644 h/mountLib.h create mode 100644 h/mqPxShow.h create mode 100644 h/mqueue.h create mode 100644 h/mqueueCommon.h create mode 100644 h/msgQEvLib.h create mode 100644 h/msgQLib.h create mode 100644 h/msgQLibCommon.h create mode 100644 h/msgQSmLib.h create mode 100644 h/muxLib.h create mode 100644 h/muxTkLib.h create mode 100644 h/namei.h create mode 100644 h/net/af.h create mode 100644 h/net/bpf.h create mode 100644 h/net/domain.h create mode 100644 h/net/if.h create mode 100644 h/net/if_arp.h create mode 100644 h/net/if_dl.h create mode 100644 h/net/if_llc.h create mode 100644 h/net/if_subr.h create mode 100644 h/net/if_types.h create mode 100644 h/net/inet.h create mode 100644 h/net/mbuf.h create mode 100644 h/net/protosw.h create mode 100644 h/net/radix.h create mode 100644 h/net/raw_cb.h create mode 100644 h/net/route.h create mode 100644 h/net/smVxLib.h create mode 100644 h/net/socketvar.h create mode 100644 h/net/systm.h create mode 100644 h/net/uio.h create mode 100644 h/net/unixLib.h create mode 100644 h/netBufLib.h create mode 100644 h/netDrv.h create mode 100644 h/netLib.h create mode 100644 h/netShow.h create mode 100644 h/netdb.h create mode 100644 h/netinet/icmp_var.h create mode 100644 h/netinet/if_ether.h create mode 100644 h/netinet/igmp.h create mode 100644 h/netinet/igmp_var.h create mode 100644 h/netinet/in.h create mode 100644 h/netinet/in_pcb.h create mode 100644 h/netinet/in_systm.h create mode 100644 h/netinet/in_var.h create mode 100644 h/netinet/ip.h create mode 100644 h/netinet/ip_icmp.h create mode 100644 h/netinet/ip_mroute.h create mode 100644 h/netinet/ip_var.h create mode 100644 h/netinet/ppp/chap.h create mode 100644 h/netinet/ppp/fsm.h create mode 100644 h/netinet/ppp/if_ppp.h create mode 100644 h/netinet/ppp/ipcp.h create mode 100644 h/netinet/ppp/lcp.h create mode 100644 h/netinet/ppp/magic.h create mode 100644 h/netinet/ppp/md5.h create mode 100644 h/netinet/ppp/options.h create mode 100644 h/netinet/ppp/ppp.h create mode 100644 h/netinet/ppp/pppHookLib.h create mode 100644 h/netinet/ppp/pppSecretLib.h create mode 100644 h/netinet/ppp/pppShow.h create mode 100644 h/netinet/ppp/ppp_auth.h create mode 100644 h/netinet/ppp/ppp_vxworks.h create mode 100644 h/netinet/ppp/pppd.h create mode 100644 h/netinet/ppp/random.h create mode 100644 h/netinet/ppp/upap.h create mode 100644 h/netinet/sl_compress.h create mode 100644 h/netinet/tcp.h create mode 100644 h/netinet/tcp_debug.h create mode 100644 h/netinet/tcp_fsm.h create mode 100644 h/netinet/tcp_seq.h create mode 100644 h/netinet/tcp_timer.h create mode 100644 h/netinet/tcp_var.h create mode 100644 h/netinet/tcpip.h create mode 100644 h/netinet/udp.h create mode 100644 h/netinet/udp_var.h create mode 100644 h/nfsDrv.h create mode 100644 h/nfsLib.h create mode 100644 h/nfsdLib.h create mode 100644 h/nmpipe.h create mode 100644 h/ntPassFsLib.h create mode 100644 h/objLib.h create mode 100644 h/objLibCommon.h create mode 100644 h/oemtypes.h create mode 100644 h/opc_ae.h create mode 100644 h/opccomn.h create mode 100644 h/opcda.h create mode 100644 h/openssl/aes.h create mode 100644 h/openssl/asn1.h create mode 100644 h/openssl/asn1_mac.h create mode 100644 h/openssl/asn1t.h create mode 100644 h/openssl/bio.h create mode 100644 h/openssl/blowfish.h create mode 100644 h/openssl/bn.h create mode 100644 h/openssl/buffer.h create mode 100644 h/openssl/cast.h create mode 100644 h/openssl/comp.h create mode 100644 h/openssl/compatibility.h create mode 100644 h/openssl/conf.h create mode 100644 h/openssl/conf_api.h create mode 100644 h/openssl/crypto.h create mode 100644 h/openssl/des.h create mode 100644 h/openssl/des_old.h create mode 100644 h/openssl/dh.h create mode 100644 h/openssl/dsa.h create mode 100644 h/openssl/dso.h create mode 100644 h/openssl/dtls1.h create mode 100644 h/openssl/e_os2.h create mode 100644 h/openssl/ebcdic.h create mode 100644 h/openssl/ec.h create mode 100644 h/openssl/engine.h create mode 100644 h/openssl/err.h create mode 100644 h/openssl/evp.h create mode 100644 h/openssl/hmac.h create mode 100644 h/openssl/idea.h create mode 100644 h/openssl/krb5_asn.h create mode 100644 h/openssl/kssl.h create mode 100644 h/openssl/lhash.h create mode 100644 h/openssl/md2.h create mode 100644 h/openssl/md4.h create mode 100644 h/openssl/md5.h create mode 100644 h/openssl/obj_mac.h create mode 100644 h/openssl/objects.h create mode 100644 h/openssl/ocsp.h create mode 100644 h/openssl/opensslconf.h create mode 100644 h/openssl/opensslv.h create mode 100644 h/openssl/ossl_typ.h create mode 100644 h/openssl/pem.h create mode 100644 h/openssl/pem2.h create mode 100644 h/openssl/pkcs12.h create mode 100644 h/openssl/pkcs7.h create mode 100644 h/openssl/pq_compat.h create mode 100644 h/openssl/pqueue.h create mode 100644 h/openssl/private/e_os.h create mode 100644 h/openssl/rand.h create mode 100644 h/openssl/rc2.h create mode 100644 h/openssl/rc4.h create mode 100644 h/openssl/ripemd.h create mode 100644 h/openssl/rsa.h create mode 100644 h/openssl/safestack.h create mode 100644 h/openssl/sha.h create mode 100644 h/openssl/ssl.h create mode 100644 h/openssl/ssl2.h create mode 100644 h/openssl/ssl23.h create mode 100644 h/openssl/ssl3.h create mode 100644 h/openssl/stack.h create mode 100644 h/openssl/store.h create mode 100644 h/openssl/symhacks.h create mode 100644 h/openssl/tls1.h create mode 100644 h/openssl/tmdiff.h create mode 100644 h/openssl/txt_db.h create mode 100644 h/openssl/ui.h create mode 100644 h/openssl/ui_compat.h create mode 100644 h/openssl/wr_err.h create mode 100644 h/openssl/x509.h create mode 100644 h/openssl/x509_vfy.h create mode 100644 h/openssl/x509v3.h create mode 100644 h/passFsLib.h create mode 100644 h/pathLib.h create mode 100644 h/pci.h create mode 100644 h/pciClass.h create mode 100644 h/pciVendor.h create mode 100644 h/pfw/pfw.h create mode 100644 h/pfw/pfwComponent.h create mode 100644 h/pfw/pfwEvent.h create mode 100644 h/pfw/pfwInterface.h create mode 100644 h/pfw/pfwLayer.h create mode 100644 h/pfw/pfwMemory.h create mode 100644 h/pfw/pfwProfile.h create mode 100644 h/pfw/pfwStack.h create mode 100644 h/pfw/pfwTable.h create mode 100644 h/pfw/pfwTimer.h create mode 100644 h/pingLib.h create mode 100644 h/pipeDrv.h create mode 100644 h/pmLib.h create mode 100644 h/poolLib.h create mode 100644 h/posixName.h create mode 100644 h/posixShow.h create mode 100644 h/ppp/bacpInterfaces.h create mode 100644 h/ppp/interfaces/adapterComponentInterfaces.h create mode 100644 h/ppp/interfaces/authInfoInterface.h create mode 100644 h/ppp/interfaces/componentAcceptableProtocolsInterface.h create mode 100644 h/ppp/interfaces/framingComponentInterfaces.h create mode 100644 h/ppp/interfaces/ipcpInterfaces.h create mode 100644 h/ppp/interfaces/lcpInterfaces.h create mode 100644 h/ppp/interfaces/mpFramingLayerInterfaces.h create mode 100644 h/ppp/interfaces/pppControlLayerInterface.h create mode 100644 h/ppp/interfaces/pppControlProtocolInterface.h create mode 100644 h/ppp/interfaces/pppHcInterfaces.h create mode 100644 h/ppp/interfaces/pppInterfacesGroupInterfaces.h create mode 100644 h/ppp/interfaces/pppIpInterfaces.h create mode 100644 h/ppp/interfaces/pppLinkIdInterface.h create mode 100644 h/ppp/interfaces/pppModemInterface.h create mode 100644 h/ppp/interfaces/pppRadiusInterface.h create mode 100644 h/ppp/interfaces/pppVjcInterfaces.h create mode 100644 h/ppp/interfaces/pppVsidInterface.h create mode 100644 h/ppp/kbacpif.h create mode 100644 h/ppp/kppp.h create mode 100644 h/ppp/kstart.h create mode 100644 h/ppp/m2pppIpcpGroup.h create mode 100644 h/ppp/m2pppLib.h create mode 100644 h/ppp/m2pppLinkGroup.h create mode 100644 h/ppp/m2pppSecurityConfig.h create mode 100644 h/ppp/m2pppSecuritySecretsLib.h create mode 100644 h/ppp/magic.h create mode 100644 h/ppp/mp.h create mode 100644 h/ppp/mpAPI.h create mode 100644 h/ppp/portmanager.h create mode 100644 h/ppp/pppAdapterLayer.h create mode 100644 h/ppp/pppAsyncFramingComponent.h create mode 100644 h/ppp/pppBacpComponent.h create mode 100644 h/ppp/pppBitSyncFramingComponent.h create mode 100644 h/ppp/pppChapComponent.h create mode 100644 h/ppp/pppChecksum.h create mode 100644 h/ppp/pppControlLayer.h create mode 100644 h/ppp/pppFramingLayer.h create mode 100644 h/ppp/pppHeaderCompression.h create mode 100644 h/ppp/pppInterfaceLayer.h create mode 100644 h/ppp/pppInterfaces.h create mode 100644 h/ppp/pppIpcpComponent.h create mode 100644 h/ppp/pppIpv6cpComponent.h create mode 100644 h/ppp/pppLacStructures.h create mode 100644 h/ppp/pppLcpComponent.h create mode 100644 h/ppp/pppMPFramingLayer.h create mode 100644 h/ppp/pppMPInterfaceLayer.h create mode 100644 h/ppp/pppMuxAdapter.h create mode 100644 h/ppp/pppNetworkLayer.h create mode 100644 h/ppp/pppOEthernet.h create mode 100644 h/ppp/pppPapComponent.h create mode 100644 h/ppp/pppSioAdapter.h create mode 100644 h/ppp/pppVjcComponent.h create mode 100644 h/ppp/pppVsEndComponent.h create mode 100644 h/ppp/rasamm.h create mode 100644 h/ppp/snmpAgent/leaf1471.h create mode 100644 h/ppp/snmpAgent/leaf1472.h create mode 100644 h/ppp/snmpAgent/leaf1473.h create mode 100644 h/ppp/snmpAgent/snmp1471.h create mode 100644 h/ppp/snmpAgent/snmp1472.h create mode 100644 h/ppp/snmpAgent/snmp1473.h create mode 100644 h/ppp/usrPPPConfig.h create mode 100644 h/pppLib.h create mode 100644 h/private/adrSpaceLibP.h create mode 100644 h/private/aioPxLibP.h create mode 100644 h/private/assertAltern.h create mode 100644 h/private/bpfLibP.h create mode 100644 h/private/cbioLibP.h create mode 100644 h/private/cdromFsLibP.h create mode 100644 h/private/cdromFsVersionP.h create mode 100644 h/private/classLibP.h create mode 100644 h/private/connLibP.h create mode 100644 h/private/coprocLibP.h create mode 100644 h/private/coreDumpLibP.h create mode 100644 h/private/cplusLibP.h create mode 100644 h/private/cplusLoadP.h create mode 100644 h/private/cplusXtorsP.h create mode 100644 h/private/cpuPwrLibP.h create mode 100644 h/private/dbgLibP.h create mode 100644 h/private/dbgRtpLibP.h create mode 100644 h/private/dbgTaskLibP.h create mode 100644 h/private/distObjTypeP.h create mode 100644 h/private/dosDirLibP.h create mode 100644 h/private/dosFsFatP.h create mode 100644 h/private/dosFsLibP.h create mode 100644 h/private/dosFsVerP.h create mode 100644 h/private/edrLibP.h create mode 100644 h/private/eventLibP.h create mode 100644 h/private/eventP.h create mode 100644 h/private/eventSysCall.h create mode 100644 h/private/evtLogLibP.h create mode 100644 h/private/excLibP.h create mode 100644 h/private/fioLibP.h create mode 100644 h/private/floatioP.h create mode 100644 h/private/ftpLibP.h create mode 100644 h/private/funcBindP.h create mode 100644 h/private/fvwriteP.h create mode 100644 h/private/handleLibP.h create mode 100644 h/private/hashLibP.h create mode 100644 h/private/hrFsLibP.h create mode 100644 h/private/iosLibP.h create mode 100644 h/private/isrLibP.h create mode 100644 h/private/jobLibP.h create mode 100644 h/private/kernelBaseLibP.h create mode 100644 h/private/kernelLibP.h create mode 100644 h/private/ledLibP.h create mode 100644 h/private/loadElfLibP.h create mode 100644 h/private/loadFileLibP.h create mode 100644 h/private/loadLibP.h create mode 100644 h/private/loadRtpLibP.h create mode 100644 h/private/loadShareLibP.h create mode 100644 h/private/localeP.h create mode 100644 h/private/logLibP.h create mode 100644 h/private/m2LibP.h create mode 100644 h/private/mathP.h create mode 100644 h/private/memEdrLibP.h create mode 100644 h/private/memInfoP.h create mode 100644 h/private/memPartLibP.h create mode 100644 h/private/mmanP.h create mode 100644 h/private/mmuSoftLibP.h create mode 100644 h/private/moduleLibP.h create mode 100644 h/private/mqPxLibP.h create mode 100644 h/private/mqPxSysCall.h create mode 100644 h/private/mqueueP.h create mode 100644 h/private/msgQLibP.h create mode 100644 h/private/msgQSmLibP.h create mode 100644 h/private/msgQSysCall.h create mode 100644 h/private/mutexPxLibP.h create mode 100644 h/private/muxLibP.h create mode 100644 h/private/nbioLogLibP.h create mode 100644 h/private/nfsHashP.h create mode 100644 h/private/objLibP.h create mode 100644 h/private/objSysCall.h create mode 100644 h/private/offsetsP.h create mode 100644 h/private/pciIntLibP.h create mode 100644 h/private/pfw/pfwEventP.h create mode 100644 h/private/pfw/pfwInterfaceP.h create mode 100644 h/private/pfw/pfwMemoryP.h create mode 100644 h/private/pfw/pfwP.h create mode 100644 h/private/pfw/pfwProfileP.h create mode 100644 h/private/pfw/pfwStackP.h create mode 100644 h/private/pfw/pfwTimerP.h create mode 100644 h/private/pfw/pfwUtilP.h create mode 100644 h/private/pgMgrLibP.h create mode 100644 h/private/pgPoolLibP.h create mode 100644 h/private/pgPoolPhysLibP.h create mode 100644 h/private/pgPoolVirtLibP.h create mode 100644 h/private/poolLibP.h create mode 100644 h/private/ppp/bacpstate.h create mode 100644 h/private/ppp/bapsend.h create mode 100644 h/private/ppp/listutls.h create mode 100644 h/private/ppp/mpFramingLayerP.h create mode 100644 h/private/ppp/mpInterfaceLayerP.h create mode 100644 h/private/ppp/mpP.h create mode 100644 h/private/ppp/pppBacpComponentP.h create mode 100644 h/private/ppp/pppIpState.h create mode 100644 h/private/ppp/pppIpcpComponentP.h create mode 100644 h/private/ppp/pppIpv6cpComponentP.h create mode 100644 h/private/ppp/pppLcpComponentP.h create mode 100644 h/private/ppp/pppNcpComponentP.h create mode 100644 h/private/ppp/pppNcpLibP.h create mode 100644 h/private/ppp/pppoptn.h create mode 100644 h/private/ppp/pppstate.h create mode 100644 h/private/ppp/rasammP.h create mode 100644 h/private/ppp/vbacpstr.h create mode 100644 h/private/ppp/vbacputil.h create mode 100644 h/private/ppp/vbapstr.h create mode 100644 h/private/ppp/vlcpstr.h create mode 100644 h/private/ppp/vncpstr.h create mode 100644 h/private/ppp/vnipstr.h create mode 100644 h/private/ppp/vpppastr.h create mode 100644 h/private/ppp/vpppstr.h create mode 100644 h/private/print64Lib.h create mode 100644 h/private/pxObjSysCall.h create mode 100644 h/private/rtpIoLibP.h create mode 100644 h/private/rtpLibP.h create mode 100644 h/private/rtpPthreadLibP.h create mode 100644 h/private/rtpSigLibP.h create mode 100644 h/private/rtpUtilLibP.h create mode 100644 h/private/scMemValP.h create mode 100644 h/private/schedP.h create mode 100644 h/private/sdLibP.h create mode 100644 h/private/selectLibP.h create mode 100644 h/private/semLibP.h create mode 100644 h/private/semPxLibP.h create mode 100644 h/private/semPxSysCall.h create mode 100644 h/private/semSmLibP.h create mode 100644 h/private/semSysCall.h create mode 100644 h/private/seqDrvP.h create mode 100644 h/private/setLibP.h create mode 100644 h/private/shellDataLibP.h create mode 100644 h/private/shellInOutLibP.h create mode 100644 h/private/shellInternalLibP.h create mode 100644 h/private/shellInterpLibP.h create mode 100644 h/private/shellLibP.h create mode 100644 h/private/shellMemLibP.h create mode 100644 h/private/shlLibP.h create mode 100644 h/private/sigLibP.h create mode 100644 h/private/sigeventP.h create mode 100644 h/private/smFixBlkLibP.h create mode 100644 h/private/smMemLibP.h create mode 100644 h/private/smNameLibP.h create mode 100644 h/private/smObjLibP.h create mode 100644 h/private/stdioP.h create mode 100644 h/private/strStateP.h create mode 100644 h/private/strxfrmP.h create mode 100644 h/private/symLibP.h create mode 100644 h/private/symbolP.h create mode 100644 h/private/syscallLibP.h create mode 100644 h/private/taskLibP.h create mode 100644 h/private/taskMemLibP.h create mode 100644 h/private/taskPxLibCommonP.h create mode 100644 h/private/taskPxLibP.h create mode 100644 h/private/taskSysCall.h create mode 100644 h/private/taskULibP.h create mode 100644 h/private/taskUtilLibP.h create mode 100644 h/private/taskWaitShowP.h create mode 100644 h/private/timeP.h create mode 100644 h/private/timerLibP.h create mode 100644 h/private/timerSysCall.h create mode 100644 h/private/trcLibP.h create mode 100644 h/private/trgLibP.h create mode 100644 h/private/trigP.h create mode 100644 h/private/usrLibP.h create mode 100644 h/private/usrRtpLibP.h create mode 100644 h/private/virtualDiskLibP.h create mode 100644 h/private/vmInvTblLibP.h create mode 100644 h/private/vmLibP.h create mode 100644 h/private/vnodeAffLibP.h create mode 100644 h/private/vxmIfLibP.h create mode 100644 h/private/vxmIfLibP2.h create mode 100644 h/private/vxsimHostLibP.h create mode 100644 h/private/wdLibP.h create mode 100644 h/private/windLibP.h create mode 100644 h/private/windPwrLibP.h create mode 100644 h/private/workQLibP.h create mode 100644 h/private/wtxexchp.h create mode 100644 h/private/wtxp.h create mode 100644 h/private/wvBufferP.h create mode 100644 h/private/wvFileUploadPathLibP.h create mode 100644 h/private/wvHostLibP.h create mode 100644 h/private/wvLibP.h create mode 100644 h/private/wvNetEventP.h create mode 100644 h/private/wvSockUploadPathLibP.h create mode 100644 h/private/wvTsfsUploadPathLibP.h create mode 100644 h/private/wvUploadPathP.h create mode 100644 h/proxyArpLib.h create mode 100644 h/proxyLib.h create mode 100644 h/pthread.h create mode 100644 h/pthreadCommon.h create mode 100644 h/ptrace.h create mode 100644 h/ptyDrv.h create mode 100644 h/ptyLib.h create mode 100644 h/qClass.h create mode 100644 h/qFifoGLib.h create mode 100644 h/qFifoLib.h create mode 100644 h/qJobLib.h create mode 100644 h/qLib.h create mode 100644 h/qPriBMapLib.h create mode 100644 h/qPriDeltaLib.h create mode 100644 h/qPriHeapLib.h create mode 100644 h/qPriLTreeLib.h create mode 100644 h/qPriListLib.h create mode 100644 h/qPriNode.h create mode 100644 h/qPxPriBMapLib.h create mode 100644 h/rBuffLib.h create mode 100644 h/ramDiskCbio.h create mode 100644 h/ramDrv.h create mode 100644 h/rawFsLib.h create mode 100644 h/rdiscLib.h create mode 100644 h/rebootLib.h create mode 100644 h/reg.h create mode 100644 h/regex.h create mode 100644 h/regex2.h create mode 100644 h/regs.h create mode 100644 h/remLib.h create mode 100644 h/resolv/nameser.h create mode 100644 h/resolv/resolv.h create mode 100644 h/resolvLib.h create mode 100644 h/rip/defs.h create mode 100644 h/rip/interface.h create mode 100644 h/rip/m2RipLib.h create mode 100644 h/rip/rip2.h create mode 100644 h/rip/ripLib.h create mode 100644 h/rip/table.h create mode 100644 h/rlogLib.h create mode 100644 h/rngLib.h create mode 100644 h/romfs.h create mode 100644 h/romfsDrv.h create mode 100644 h/romfsLib.h create mode 100644 h/routeEnhLib.h create mode 100644 h/routeLib.h create mode 100644 h/rpc/auth.h create mode 100644 h/rpc/auth_unix.h create mode 100644 h/rpc/clnt.h create mode 100644 h/rpc/get_myaddr.h create mode 100644 h/rpc/pmap_clnt.h create mode 100644 h/rpc/pmap_prot.h create mode 100644 h/rpc/pmap_rmt.h create mode 100644 h/rpc/portmap.h create mode 100644 h/rpc/rpc.h create mode 100644 h/rpc/rpcGbl.h create mode 100644 h/rpc/rpc_msg.h create mode 100644 h/rpc/rpc_prot.h create mode 100644 h/rpc/rpcnetdb.h create mode 100644 h/rpc/rpctypes.h create mode 100644 h/rpc/svc.h create mode 100644 h/rpc/svc_auth.h create mode 100644 h/rpc/svc_auth_uni.h create mode 100644 h/rpc/types.h create mode 100644 h/rpc/xdr.h create mode 100644 h/rpcLib.h create mode 100644 h/rt11FsLib.h create mode 100644 h/rtpIoLib.h create mode 100644 h/rtpLib.h create mode 100644 h/rtpLibCommon.h create mode 100644 h/rtpVarLib.h create mode 100644 h/rtpVarLibCommon.h create mode 100644 h/scMemVal.h create mode 100644 h/sched.h create mode 100644 h/scsi1Lib.h create mode 100644 h/scsi2Lib.h create mode 100644 h/scsiLib.h create mode 100644 h/sdLib.h create mode 100644 h/sdLibCommon.h create mode 100644 h/selectLib.h create mode 100644 h/semEvLib.h create mode 100644 h/semLib.h create mode 100644 h/semLibCommon.h create mode 100644 h/semPxShow.h create mode 100644 h/semSmLib.h create mode 100644 h/semaphore.h create mode 100644 h/semaphoreCommon.h create mode 100644 h/seqIo.h create mode 100644 h/setLib.h create mode 100644 h/setjmp.h create mode 100644 h/shellConfigLib.h create mode 100644 h/shellDataLib.h create mode 100644 h/shellInterpCmdLib.h create mode 100644 h/shellInterpLib.h create mode 100644 h/shellLib.h create mode 100644 h/shellPromptLib.h create mode 100644 h/shlLib.h create mode 100644 h/shlLibCommon.h create mode 100644 h/sigCodes.h create mode 100644 h/sigLib.h create mode 100644 h/sigevent.h create mode 100644 h/sigeventCommon.h create mode 100644 h/signal.h create mode 100644 h/simLib.h create mode 100644 h/sioLib.h create mode 100644 h/sioLibCommon.h create mode 100644 h/sllLib.h create mode 100644 h/smDllLib.h create mode 100644 h/smLib.h create mode 100644 h/smMemLib.h create mode 100644 h/smNameLib.h create mode 100644 h/smObjLib.h create mode 100644 h/smPktLib.h create mode 100644 h/smUtilLib.h create mode 100644 h/snark.h create mode 100644 h/snmpdLib.h create mode 100644 h/snmptalk.h create mode 100644 h/sntp.h create mode 100644 h/sntpcLib.h create mode 100644 h/sntpsLib.h create mode 100644 h/sockFunc.h create mode 100644 h/sockLib.h create mode 100644 h/socket.h create mode 100644 h/som_coff.h create mode 100644 h/speLib.h create mode 100644 h/spyLib.h create mode 100644 h/stat.h create mode 100644 h/stdio.h create mode 100644 h/stdioLib.h create mode 100644 h/stdlib.h create mode 100644 h/strLib.h create mode 100644 h/strSearchLib.h create mode 100644 h/string.h create mode 100644 h/sun.h create mode 100644 h/symLib.h create mode 100644 h/symSync.h create mode 100644 h/symSyncLib.h create mode 100644 h/symUtilLib.h create mode 100644 h/symbol.h create mode 100644 h/sys/fcntlcom.h create mode 100644 h/sys/ioctl.h create mode 100644 h/sys/mman.h create mode 100644 h/sys/resource.h create mode 100644 h/sys/socket.h create mode 100644 h/sys/stat.h create mode 100644 h/sys/sysctl.h create mode 100644 h/sys/sysctlCommon.h create mode 100644 h/sys/taskDefs.h create mode 100644 h/sys/times.h create mode 100644 h/sys/types.h create mode 100644 h/sys/un.h create mode 100644 h/sys/vxLibCfgDefsP.h create mode 100644 h/sys/wait.h create mode 100644 h/sysLib.h create mode 100644 h/sysSymTbl.h create mode 100644 h/syscall.h create mode 100644 h/syscallArgs.h create mode 100644 h/syscallLib.h create mode 100644 h/syscallTbl.h create mode 100644 h/systime.h create mode 100644 h/tapeFsLib.h create mode 100644 h/tarLib.h create mode 100644 h/taskArchLib.h create mode 100644 h/taskHookLib.h create mode 100644 h/taskLib.h create mode 100644 h/taskLibCommon.h create mode 100644 h/taskUtilLib.h create mode 100644 h/taskVarLib.h create mode 100644 h/taskWaitShow.h create mode 100644 h/telnetLib.h create mode 100644 h/tffs/backgrnd.h create mode 100644 h/tffs/dosformt.h create mode 100644 h/tffs/fatlite.h create mode 100644 h/tffs/flbase.h create mode 100644 h/tffs/flbuffer.h create mode 100644 h/tffs/flcustom.h create mode 100644 h/tffs/flflash.h create mode 100644 h/tffs/flsocket.h create mode 100644 h/tffs/flsysfun.h create mode 100644 h/tffs/flsystem.h create mode 100644 h/tffs/fltl.h create mode 100644 h/tffs/pcic.h create mode 100644 h/tffs/reedsol.h create mode 100644 h/tffs/stdcomp.h create mode 100644 h/tffs/tffsDrv.h create mode 100644 h/tftpLib.h create mode 100644 h/tftpdLib.h create mode 100644 h/tickLib.h create mode 100644 h/time.h create mode 100644 h/timers.h create mode 100644 h/timexLib.h create mode 100644 h/tipc/sm_media.h create mode 100644 h/tipc/tipc.h create mode 100644 h/tool/common/defs.arm create mode 100644 h/tool/common/defs.common create mode 100644 h/tool/common/defs.mips create mode 100644 h/tool/common/defs.ppc create mode 100644 h/tool/common/ldscripts/genScript.sh create mode 100644 h/tool/common/ldscripts/regen.sh create mode 100644 h/tool/diab/defs.arm create mode 100644 h/tool/diab/defs.diab create mode 100644 h/tool/diab/defs.mips create mode 100644 h/tool/diab/intrinsics.h create mode 100644 h/tool/diab/ldscripts/Makefile create mode 100644 h/tool/diab/ldscripts/link.DOTBOOTRAM create mode 100644 h/tool/diab/ldscripts/link.DOTBOOTROM create mode 100644 h/tool/diab/ldscripts/link.MIPSRAM create mode 100644 h/tool/diab/ldscripts/link.MIPSROM create mode 100644 h/tool/diab/ldscripts/link.RAM create mode 100644 h/tool/diab/ldscripts/link.ROM create mode 100644 h/tool/diab/limits.h create mode 100644 h/tool/diab/make.ARMARCH5diab create mode 100644 h/tool/diab/make.ARMARCH5diabbe create mode 100644 h/tool/diab/make.ARMARCH6diab create mode 100644 h/tool/diab/make.ARMARCH6diabbe create mode 100644 h/tool/diab/make.I80486diab create mode 100644 h/tool/diab/make.MIPS32sfdiab create mode 100644 h/tool/diab/make.MIPS32sfdiable create mode 100644 h/tool/diab/make.MIPS64diab create mode 100644 h/tool/diab/make.MIPS64diable create mode 100644 h/tool/diab/make.PENTIUM2diab create mode 100644 h/tool/diab/make.PENTIUM3diab create mode 100644 h/tool/diab/make.PENTIUM4diab create mode 100644 h/tool/diab/make.PENTIUMdiab create mode 100644 h/tool/diab/make.PPC32diab create mode 100644 h/tool/diab/make.PPC32sfdiab create mode 100644 h/tool/diab/make.PPC403diab create mode 100644 h/tool/diab/make.PPC405diab create mode 100644 h/tool/diab/make.PPC405sfdiab create mode 100644 h/tool/diab/make.PPC440diab create mode 100644 h/tool/diab/make.PPC440sfdiab create mode 100644 h/tool/diab/make.PPC603diab create mode 100644 h/tool/diab/make.PPC604diab create mode 100644 h/tool/diab/make.PPC85XXdiab create mode 100644 h/tool/diab/make.PPC85XXsfdiab create mode 100644 h/tool/diab/make.PPC860sfdiab create mode 100644 h/tool/diab/make.SH7750diab create mode 100644 h/tool/diab/make.SH7750diable create mode 100644 h/tool/diab/make.SIMLINUXdiab create mode 100644 h/tool/diab/make.SIMNTdiab create mode 100644 h/tool/diab/make.SIMSPARCSOLARISdiab create mode 100644 h/tool/diab/make.XSCALEdiab create mode 100644 h/tool/diab/make.XSCALEdiabbe create mode 100644 h/tool/diab/toolMacros.h create mode 100644 h/tool/gnu/defs.arm create mode 100644 h/tool/gnu/defs.gnu create mode 100644 h/tool/gnu/defs.mips create mode 100644 h/tool/gnu/intrinsics.h create mode 100644 h/tool/gnu/ldscripts/Makefile create mode 100644 h/tool/gnu/ldscripts/link.AOUTRAM create mode 100644 h/tool/gnu/ldscripts/link.AOUTROM create mode 100644 h/tool/gnu/ldscripts/link.DOTBOOTRAM create mode 100644 h/tool/gnu/ldscripts/link.DOTBOOTROM create mode 100644 h/tool/gnu/ldscripts/link.MIPSRAM create mode 100644 h/tool/gnu/ldscripts/link.MIPSROM create mode 100644 h/tool/gnu/ldscripts/link.OUT create mode 100644 h/tool/gnu/ldscripts/link.RAM create mode 100644 h/tool/gnu/ldscripts/link.ROM create mode 100644 h/tool/gnu/ldscripts/link.SIMNT create mode 100644 h/tool/gnu/limits.h create mode 100644 h/tool/gnu/make.ARMARCH5gnu create mode 100644 h/tool/gnu/make.ARMARCH5gnube create mode 100644 h/tool/gnu/make.ARMARCH6gnu create mode 100644 h/tool/gnu/make.ARMARCH6gnube create mode 100644 h/tool/gnu/make.I80486gnu create mode 100644 h/tool/gnu/make.MIPS32sfgnu create mode 100644 h/tool/gnu/make.MIPS32sfgnule create mode 100644 h/tool/gnu/make.MIPS64gnu create mode 100644 h/tool/gnu/make.MIPS64gnule create mode 100644 h/tool/gnu/make.PENTIUM2gnu create mode 100644 h/tool/gnu/make.PENTIUM3gnu create mode 100644 h/tool/gnu/make.PENTIUM4gnu create mode 100644 h/tool/gnu/make.PENTIUMgnu create mode 100644 h/tool/gnu/make.PPC32gnu create mode 100644 h/tool/gnu/make.PPC32sfgnu create mode 100644 h/tool/gnu/make.PPC403gnu create mode 100644 h/tool/gnu/make.PPC405gnu create mode 100644 h/tool/gnu/make.PPC405sfgnu create mode 100644 h/tool/gnu/make.PPC440gnu create mode 100644 h/tool/gnu/make.PPC440sfgnu create mode 100644 h/tool/gnu/make.PPC603gnu create mode 100644 h/tool/gnu/make.PPC604gnu create mode 100644 h/tool/gnu/make.PPC85XXgnu create mode 100644 h/tool/gnu/make.PPC85XXsfgnu create mode 100644 h/tool/gnu/make.PPC860sfgnu create mode 100644 h/tool/gnu/make.SH7750gnu create mode 100644 h/tool/gnu/make.SH7750gnule create mode 100644 h/tool/gnu/make.SIMLINUXgnu create mode 100644 h/tool/gnu/make.SIMNTgnu create mode 100644 h/tool/gnu/make.SIMSPARCSOLARISgnu create mode 100644 h/tool/gnu/make.XSCALEgnu create mode 100644 h/tool/gnu/make.XSCALEgnube create mode 100644 h/tool/gnu/toolMacros.h create mode 100644 h/transCbio.h create mode 100644 h/trcLib.h create mode 100644 h/trgLib.h create mode 100644 h/ttyLib.h create mode 100644 h/tyLib.h create mode 100644 h/types.h create mode 100644 h/types/vxANSI.h create mode 100644 h/types/vxArch.h create mode 100644 h/types/vxCpu.h create mode 100644 h/types/vxCpu.in create mode 100644 h/types/vxParams.h create mode 100644 h/types/vxTypes.h create mode 100644 h/types/vxTypesBase.h create mode 100644 h/types/vxTypesOld.h create mode 100644 h/types/vxWind.h create mode 100644 h/types/vxWindCommon.h create mode 100644 h/u_Lib.h create mode 100644 h/unistd.h create mode 100644 h/unldLib.h create mode 100644 h/usb/ossLib.h create mode 100644 h/usb/pciConstants.h create mode 100644 h/usb/target/usbHal.h create mode 100644 h/usb/target/usbHalCommon.h create mode 100644 h/usb/target/usbHalDebug.h create mode 100644 h/usb/target/usbHalLib.h create mode 100644 h/usb/target/usbIsaLib.h create mode 100644 h/usb/target/usbPeriphInstr.h create mode 100644 h/usb/target/usbTargLib.h create mode 100644 h/usb/target/usbTargPhilipsD12EvalLib.h create mode 100644 h/usb/target/usbTargUtil.h create mode 100644 h/usb/target/usbTcd.h create mode 100644 h/usb/target/usbTcdLib.h create mode 100644 h/usb/target/usbTcdPdiusbd12EvalLib.h create mode 100644 h/usb/tools/cmdParser.h create mode 100644 h/usb/tools/wavFormat.h create mode 100644 h/usb/usb.h create mode 100644 h/usb/usbAudio.h create mode 100644 h/usb/usbCommdevices.h create mode 100644 h/usb/usbDescrCopyLib.h create mode 100644 h/usb/usbEnet.h create mode 100644 h/usb/usbHandleLib.h create mode 100644 h/usb/usbHcdLib.h create mode 100644 h/usb/usbHid.h create mode 100644 h/usb/usbLib.h create mode 100644 h/usb/usbListLib.h create mode 100644 h/usb/usbMassStorage.h create mode 100644 h/usb/usbPciLib.h create mode 100644 h/usb/usbPlatform.h create mode 100644 h/usb/usbPrinter.h create mode 100644 h/usb/usbQueueLib.h create mode 100644 h/usb/usbdCoreLib.h create mode 100644 h/usb/usbdLib.h create mode 100644 h/usb/usbdStructures.h create mode 100644 h/usb2/BusAbstractionLayer.h create mode 100644 h/usb2/usbEhcdConfig.h create mode 100644 h/usb2/usbEhcdDataStructures.h create mode 100644 h/usb2/usbEhcdDebug.h create mode 100644 h/usb2/usbEhcdEventHandler.h create mode 100644 h/usb2/usbEhcdHal.h create mode 100644 h/usb2/usbEhcdInitExit.h create mode 100644 h/usb2/usbEhcdInterfaces.h create mode 100644 h/usb2/usbEhcdRhEmulation.h create mode 100644 h/usb2/usbEhcdUtil.h create mode 100644 h/usb2/usbHcdInstr.h create mode 100644 h/usb2/usbHst.h create mode 100644 h/usb2/usbHubBusManager.h create mode 100644 h/usb2/usbHubClassInterface.h create mode 100644 h/usb2/usbHubCommon.h create mode 100644 h/usb2/usbHubEventHandler.h create mode 100644 h/usb2/usbHubGlobalVariables.h create mode 100644 h/usb2/usbHubHostStackInterface.h create mode 100644 h/usb2/usbHubInitialization.h create mode 100644 h/usb2/usbHubMisc.h create mode 100644 h/usb2/usbHubPortEventHandler.h create mode 100644 h/usb2/usbHubTemplate.h create mode 100644 h/usb2/usbHubUtility.h create mode 100644 h/usb2/usbOhci.h create mode 100644 h/usb2/usbOhciRegisterInfo.h create mode 100644 h/usb2/usbOhciTransferManagement.h create mode 100644 h/usb2/usbOsal.h create mode 100644 h/usb2/usbOsalDebug.h create mode 100644 h/usb2/usbUhcdCommon.h create mode 100644 h/usb2/usbUhcdRhEmulate.h create mode 100644 h/usb2/usbUhcdScheduleQSupport.h create mode 100644 h/usb2/usbUhcdScheduleQueue.h create mode 100644 h/usb2/usbUhcdSupport.h create mode 100644 h/usb2/usbUhci.h create mode 100644 h/usb2/usbd.h create mode 100644 h/usb2/usbdMisc.h create mode 100644 h/usrConfig.h create mode 100644 h/usrFdiskPartLib.h create mode 100644 h/usrFsLib.h create mode 100644 h/usrLib.h create mode 100644 h/usrTransLib.h create mode 100644 h/utfLib.h create mode 100644 h/utime.h create mode 100644 h/version.h create mode 100644 h/virtualDiskLib.h create mode 100644 h/vmLib.h create mode 100644 h/vmLibCommon.h create mode 100644 h/vme.h create mode 100644 h/vnode.h create mode 100644 h/vwModNum.h create mode 100644 h/vxBusLib.h create mode 100644 h/vxLib.h create mode 100644 h/vxStream.h create mode 100644 h/vxWorks.h create mode 100644 h/vxWorksCommon.h create mode 100644 h/vxfusion/distIfLib.h create mode 100644 h/vxfusion/distLib.h create mode 100644 h/vxfusion/distNameLib.h create mode 100644 h/vxfusion/distNetLib.h create mode 100644 h/vxfusion/distNodeLib.h create mode 100644 h/vxfusion/distStatLib.h create mode 100644 h/vxfusion/distTBufLib.h create mode 100644 h/vxfusion/msgQDistGrpLib.h create mode 100644 h/vxfusion/msgQDistGrpShow.h create mode 100644 h/vxfusion/msgQDistLib.h create mode 100644 h/vxfusion/msgQDistShow.h create mode 100644 h/vxidl.h create mode 100644 h/vxsimHostLib.h create mode 100644 h/vxwErr.h create mode 100644 h/vxwLoadLib.h create mode 100644 h/vxwLstLib.h create mode 100644 h/vxwMemPartLib.h create mode 100644 h/vxwMsgQLib.h create mode 100644 h/vxwMutex.h create mode 100644 h/vxwObject.h create mode 100644 h/vxwRngLib.h create mode 100644 h/vxwSemLib.h create mode 100644 h/vxwSmLib.h create mode 100644 h/vxwSmNameLib.h create mode 100644 h/vxwSymLib.h create mode 100644 h/vxwTaskLib.h create mode 100644 h/vxwWdLib.h create mode 100644 h/wait.h create mode 100644 h/wdLib.h create mode 100644 h/wdb/dll.h create mode 100644 h/wdb/wdb.h create mode 100644 h/wdb/wdbArchIfLib.h create mode 100644 h/wdb/wdbBpLib.h create mode 100644 h/wdb/wdbCommIfLib.h create mode 100644 h/wdb/wdbCtxIfLib.h create mode 100644 h/wdb/wdbDbgLib.h create mode 100644 h/wdb/wdbEvtLib.h create mode 100644 h/wdb/wdbEvtptLib.h create mode 100644 h/wdb/wdbGopherLib.h create mode 100644 h/wdb/wdbLib.h create mode 100644 h/wdb/wdbLibP.h create mode 100644 h/wdb/wdbMbufLib.h create mode 100644 h/wdb/wdbMemLib.h create mode 100644 h/wdb/wdbOsLib.h create mode 100644 h/wdb/wdbRegs.h create mode 100644 h/wdb/wdbRpcLib.h create mode 100644 h/wdb/wdbRtIfLib.h create mode 100644 h/wdb/wdbRtpLibP.h create mode 100644 h/wdb/wdbSvcLib.h create mode 100644 h/wdb/wdbTaskLib.h create mode 100644 h/wdb/wdbTipcSockLib.h create mode 100644 h/wdb/wdbTyCoDrv.h create mode 100644 h/wdb/wdbUdpLib.h create mode 100644 h/wdb/wdbUdpSockLib.h create mode 100644 h/wdb/wdbVioLib.h create mode 100644 h/win_Lib.h create mode 100644 h/windPwrLib.h create mode 100644 h/wrProxyLib.h create mode 100644 h/wrn/arp_if.h create mode 100644 h/wrn/bridge/bridge.h create mode 100644 h/wrn/bridge/mirrorEnd.h create mode 100644 h/wrn/cci/cci.h create mode 100644 h/wrn/coreip/IGMPv2/igmpCacheLib.h create mode 100644 h/wrn/coreip/IGMPv2/igmpPortLib.h create mode 100644 h/wrn/coreip/IGMPv2/igmpR.h create mode 100644 h/wrn/coreip/IGMPv2/igmpRouterLib.h create mode 100644 h/wrn/coreip/IGMPv2/igmp_constants.h create mode 100644 h/wrn/coreip/IGMPv2/igmp_display_string.h create mode 100644 h/wrn/coreip/IGMPv2/igmp_externs.h create mode 100644 h/wrn/coreip/IGMPv2/igmp_globals.h create mode 100644 h/wrn/coreip/IGMPv2/igmp_prototypes.h create mode 100644 h/wrn/coreip/IGMPv2/igmp_state_machine.h create mode 100644 h/wrn/coreip/IGMPv2/igmp_state_machine_structures.h create mode 100644 h/wrn/coreip/IGMPv2/igmp_structures.h create mode 100644 h/wrn/coreip/adv_net.h create mode 100644 h/wrn/coreip/applUtilLib.h create mode 100644 h/wrn/coreip/arch/arm/ansi.h create mode 100644 h/wrn/coreip/arch/arm/endian.h create mode 100644 h/wrn/coreip/arch/arm/machdep.h create mode 100644 h/wrn/coreip/arch/arm/param.h create mode 100644 h/wrn/coreip/arch/mips/ansi.h create mode 100644 h/wrn/coreip/arch/mips/endian.h create mode 100644 h/wrn/coreip/arch/mips/machdep.h create mode 100644 h/wrn/coreip/arch/mips/param.h create mode 100644 h/wrn/coreip/arch/pentium/ansi.h create mode 100644 h/wrn/coreip/arch/pentium/endian.h create mode 100644 h/wrn/coreip/arch/pentium/machdep.h create mode 100644 h/wrn/coreip/arch/pentium/param.h create mode 100644 h/wrn/coreip/arch/ppc/ansi.h create mode 100644 h/wrn/coreip/arch/ppc/endian.h create mode 100644 h/wrn/coreip/arch/ppc/machdep.h create mode 100644 h/wrn/coreip/arch/ppc/param.h create mode 100644 h/wrn/coreip/arch/sh/ansi.h create mode 100644 h/wrn/coreip/arch/sh/endian.h create mode 100644 h/wrn/coreip/arch/sh/machdep.h create mode 100644 h/wrn/coreip/arch/sh/param.h create mode 100644 h/wrn/coreip/arch/simpentium/ansi.h create mode 100644 h/wrn/coreip/arch/simpentium/endian.h create mode 100644 h/wrn/coreip/arch/simpentium/machdep.h create mode 100644 h/wrn/coreip/arch/simpentium/param.h create mode 100644 h/wrn/coreip/arch/types.h create mode 100644 h/wrn/coreip/arpLib.h create mode 100644 h/wrn/coreip/arpa/inet.h create mode 100644 h/wrn/coreip/bootpLib.h create mode 100644 h/wrn/coreip/bpfDrv.h create mode 100644 h/wrn/coreip/bsdSockLib.h create mode 100644 h/wrn/coreip/cfgDefs.h create mode 100644 h/wrn/coreip/dhcp/common.h create mode 100644 h/wrn/coreip/dhcp/common_subr.h create mode 100644 h/wrn/coreip/dhcp/copyright_dhcp.h create mode 100644 h/wrn/coreip/dhcp/database.h create mode 100644 h/wrn/coreip/dhcp/dhcp.h create mode 100644 h/wrn/coreip/dhcp/dhcpc.h create mode 100644 h/wrn/coreip/dhcp/dhcpcBoot.h create mode 100644 h/wrn/coreip/dhcp/dhcpcCommonLib.h create mode 100644 h/wrn/coreip/dhcp/dhcpcInit.h create mode 100644 h/wrn/coreip/dhcp/dhcpcInternal.h create mode 100644 h/wrn/coreip/dhcp/dhcpcShow.h create mode 100644 h/wrn/coreip/dhcp/dhcpcStateLib.h create mode 100644 h/wrn/coreip/dhcp/dhcps.h create mode 100644 h/wrn/coreip/dhcp/hash.h create mode 100644 h/wrn/coreip/dhcp6Lib.h create mode 100644 h/wrn/coreip/dhcp6cShow.h create mode 100644 h/wrn/coreip/dhcpcBootLib.h create mode 100644 h/wrn/coreip/dhcpcLib.h create mode 100644 h/wrn/coreip/dhcprLib.h create mode 100644 h/wrn/coreip/dhcpsLib.h create mode 100644 h/wrn/coreip/dlink/gifNpt.h create mode 100644 h/wrn/coreip/dlink/qosIngressLib.h create mode 100644 h/wrn/coreip/dlink/stfNpt.h create mode 100644 h/wrn/coreip/dlink/tunnelLib.h create mode 100644 h/wrn/coreip/dlink/vlanTagLib.h create mode 100644 h/wrn/coreip/etherLib.h create mode 100644 h/wrn/coreip/etherMultiLib.h create mode 100644 h/wrn/coreip/fastPath/fastPathFib.h create mode 100644 h/wrn/coreip/fastPath/fastPathIp.h create mode 100644 h/wrn/coreip/fastPath/fastPathIpLib.h create mode 100644 h/wrn/coreip/fastPath/fastPathLib.h create mode 100644 h/wrn/coreip/fastPath/fastPathMon.h create mode 100644 h/wrn/coreip/fastPath/fastPathPatTree.h create mode 100644 h/wrn/coreip/fastPath/fastPathUtil.h create mode 100644 h/wrn/coreip/filio.h create mode 100644 h/wrn/coreip/ftp6Lib.h create mode 100644 h/wrn/coreip/ftpLib.h create mode 100644 h/wrn/coreip/ftpd6Lib.h create mode 100644 h/wrn/coreip/ftpdLib.h create mode 100644 h/wrn/coreip/hostLib.h create mode 100644 h/wrn/coreip/icmpLib.h create mode 100644 h/wrn/coreip/if6Lib.h create mode 100644 h/wrn/coreip/ifIndexLib.h create mode 100644 h/wrn/coreip/ifLib.h create mode 100644 h/wrn/coreip/in_cksum.h create mode 100644 h/wrn/coreip/inetLib.h create mode 100644 h/wrn/coreip/ioccom.h create mode 100644 h/wrn/coreip/ip6Lib.h create mode 100644 h/wrn/coreip/ipLib.h create mode 100644 h/wrn/coreip/ipProto.h create mode 100644 h/wrn/coreip/jobQueueLib.h create mode 100644 h/wrn/coreip/logCategories.h create mode 100644 h/wrn/coreip/m2IfLib.h create mode 100644 h/wrn/coreip/m2Ipv6Lib.h create mode 100644 h/wrn/coreip/m2Lib.h create mode 100644 h/wrn/coreip/machdep.h create mode 100644 h/wrn/coreip/mbufLib.h create mode 100644 h/wrn/coreip/mbufSockLib.h create mode 100644 h/wrn/coreip/md5.h create mode 100644 h/wrn/coreip/mib/cidrLeaf.h create mode 100644 h/wrn/coreip/mib/cidrMapi.h create mode 100644 h/wrn/coreip/mib/cidrSkel.h create mode 100644 h/wrn/coreip/mib/mibApi.h create mode 100644 h/wrn/coreip/mip6/mip6.h create mode 100644 h/wrn/coreip/mip6/mip6_babymdd.h create mode 100644 h/wrn/coreip/mip6/mip6_command.h create mode 100644 h/wrn/coreip/mip6/mip6_constants.h create mode 100644 h/wrn/coreip/mip6/mip6_had.h create mode 100644 h/wrn/coreip/mip6/mip6_mnd.h create mode 100644 h/wrn/coreip/mip6/mip6_shisad.h create mode 100644 h/wrn/coreip/mip6/mip6_stat.h create mode 100644 h/wrn/coreip/mountd.h create mode 100644 h/wrn/coreip/muxL2Lib.h create mode 100644 h/wrn/coreip/muxLib.h create mode 100644 h/wrn/coreip/muxTkLib.h create mode 100644 h/wrn/coreip/net/af.h create mode 100644 h/wrn/coreip/net/bpf.h create mode 100644 h/wrn/coreip/net/bpfdesc.h create mode 100644 h/wrn/coreip/net/domain.h create mode 100644 h/wrn/coreip/net/ethernet.h create mode 100644 h/wrn/coreip/net/fastUdp6Lib.h create mode 100644 h/wrn/coreip/net/fastUdpLib.h create mode 100644 h/wrn/coreip/net/if.h create mode 100644 h/wrn/coreip/net/if_arp.h create mode 100644 h/wrn/coreip/net/if_clone.h create mode 100644 h/wrn/coreip/net/if_dl.h create mode 100644 h/wrn/coreip/net/if_llc.h create mode 100644 h/wrn/coreip/net/if_media.h create mode 100644 h/wrn/coreip/net/if_mip.h create mode 100644 h/wrn/coreip/net/if_subr.h create mode 100644 h/wrn/coreip/net/if_types.h create mode 100644 h/wrn/coreip/net/if_var.h create mode 100644 h/wrn/coreip/net/if_vlan_var.h create mode 100644 h/wrn/coreip/net/ifaddrs.h create mode 100644 h/wrn/coreip/net/inet.h create mode 100644 h/wrn/coreip/net/mbuf.h create mode 100644 h/wrn/coreip/net/mipsock.h create mode 100644 h/wrn/coreip/net/protosw.h create mode 100644 h/wrn/coreip/net/radix.h create mode 100644 h/wrn/coreip/net/raw_cb.h create mode 100644 h/wrn/coreip/net/route.h create mode 100644 h/wrn/coreip/net/socketvar.h create mode 100644 h/wrn/coreip/net/systm.h create mode 100644 h/wrn/coreip/net/uio.h create mode 100644 h/wrn/coreip/net/unixLib.h create mode 100644 h/wrn/coreip/net/utils/ifconfig.h create mode 100644 h/wrn/coreip/net/utils/ip6addrctl.h create mode 100644 h/wrn/coreip/net/utils/l2config.h create mode 100644 h/wrn/coreip/net/utils/ndp.h create mode 100644 h/wrn/coreip/net/utils/netstat.h create mode 100644 h/wrn/coreip/net/utils/prefixcmd.h create mode 100644 h/wrn/coreip/net/utils/routeCmd.h create mode 100644 h/wrn/coreip/netBufLib.h create mode 100644 h/wrn/coreip/netCore.h create mode 100644 h/wrn/coreip/netDrv.h create mode 100644 h/wrn/coreip/netLib.h create mode 100644 h/wrn/coreip/netShow.h create mode 100644 h/wrn/coreip/netVersion.h create mode 100644 h/wrn/coreip/netconf.h create mode 100644 h/wrn/coreip/netdb.h create mode 100644 h/wrn/coreip/netffs.h create mode 100644 h/wrn/coreip/netinet/icmp6.h create mode 100644 h/wrn/coreip/netinet/icmp_var.h create mode 100644 h/wrn/coreip/netinet/if_ether.h create mode 100644 h/wrn/coreip/netinet/igmp.h create mode 100644 h/wrn/coreip/netinet/igmp_var.h create mode 100644 h/wrn/coreip/netinet/in.h create mode 100644 h/wrn/coreip/netinet/in_msf.h create mode 100644 h/wrn/coreip/netinet/in_pcb.h create mode 100644 h/wrn/coreip/netinet/in_systm.h create mode 100644 h/wrn/coreip/netinet/in_var.h create mode 100644 h/wrn/coreip/netinet/ip.h create mode 100644 h/wrn/coreip/netinet/ip4_ext_in.h create mode 100644 h/wrn/coreip/netinet/ip4_ext_out.h create mode 100644 h/wrn/coreip/netinet/ip6.h create mode 100644 h/wrn/coreip/netinet/ip6mh.h create mode 100644 h/wrn/coreip/netinet/ip_flow.h create mode 100644 h/wrn/coreip/netinet/ip_icmp.h create mode 100644 h/wrn/coreip/netinet/ip_mroute.h create mode 100644 h/wrn/coreip/netinet/ip_var.h create mode 100644 h/wrn/coreip/netinet/ipfw.h create mode 100644 h/wrn/coreip/netinet/ipprotosw.h create mode 100644 h/wrn/coreip/netinet/pim.h create mode 100644 h/wrn/coreip/netinet/pim_var.h create mode 100644 h/wrn/coreip/netinet/sctp.h create mode 100644 h/wrn/coreip/netinet/sctp_constants.h create mode 100644 h/wrn/coreip/netinet/sctp_header.h create mode 100644 h/wrn/coreip/netinet/sctp_uio.h create mode 100644 h/wrn/coreip/netinet/sl_compress.h create mode 100644 h/wrn/coreip/netinet/sockunion.h create mode 100644 h/wrn/coreip/netinet/tcp.h create mode 100644 h/wrn/coreip/netinet/tcp_debug.h create mode 100644 h/wrn/coreip/netinet/tcp_fsm.h create mode 100644 h/wrn/coreip/netinet/tcp_seq.h create mode 100644 h/wrn/coreip/netinet/tcp_timer.h create mode 100644 h/wrn/coreip/netinet/tcp_var.h create mode 100644 h/wrn/coreip/netinet/tcpip.h create mode 100644 h/wrn/coreip/netinet/udp.h create mode 100644 h/wrn/coreip/netinet/udp_var.h create mode 100644 h/wrn/coreip/netinet/vsArp.h create mode 100644 h/wrn/coreip/netinet/vsData.h create mode 100644 h/wrn/coreip/netinet/vsDhcps.h create mode 100644 h/wrn/coreip/netinet/vsFastUdp.h create mode 100644 h/wrn/coreip/netinet/vsHost.h create mode 100644 h/wrn/coreip/netinet/vsIcmp.h create mode 100644 h/wrn/coreip/netinet/vsIgmp.h create mode 100644 h/wrn/coreip/netinet/vsIgmpR.h create mode 100644 h/wrn/coreip/netinet/vsIp.h create mode 100644 h/wrn/coreip/netinet/vsLib.h create mode 100644 h/wrn/coreip/netinet/vsM2.h create mode 100644 h/wrn/coreip/netinet/vsMcast.h create mode 100644 h/wrn/coreip/netinet/vsNetCore.h create mode 100644 h/wrn/coreip/netinet/vsProxyArp.h create mode 100644 h/wrn/coreip/netinet/vsRadix.h create mode 100644 h/wrn/coreip/netinet/vsRdisc.h create mode 100644 h/wrn/coreip/netinet/vsRip.h create mode 100644 h/wrn/coreip/netinet/vsShow.h create mode 100644 h/wrn/coreip/netinet/vsTcp.h create mode 100644 h/wrn/coreip/netinet/vsUdp.h create mode 100644 h/wrn/coreip/netinet6/icmp6.h create mode 100644 h/wrn/coreip/netinet6/in6.h create mode 100644 h/wrn/coreip/netinet6/in6_msf.h create mode 100644 h/wrn/coreip/netinet6/in6_pcb.h create mode 100644 h/wrn/coreip/netinet6/in6_var.h create mode 100644 h/wrn/coreip/netinet6/ip6.h create mode 100644 h/wrn/coreip/netinet6/ip6_ext_in.h create mode 100644 h/wrn/coreip/netinet6/ip6_ext_out.h create mode 100644 h/wrn/coreip/netinet6/ip6_mroute.h create mode 100644 h/wrn/coreip/netinet6/ip6_var.h create mode 100644 h/wrn/coreip/netinet6/mip6.h create mode 100644 h/wrn/coreip/netinet6/mip6_var.h create mode 100644 h/wrn/coreip/netinet6/nd6.h create mode 100644 h/wrn/coreip/netinet6/raw_ip6.h create mode 100644 h/wrn/coreip/netinet6/scope6_var.h create mode 100644 h/wrn/coreip/netinet6/tcp6_var.h create mode 100644 h/wrn/coreip/netinet6/udp6_var.h create mode 100644 h/wrn/coreip/nfs2Drv.h create mode 100644 h/wrn/coreip/nfs2Lib.h create mode 100644 h/wrn/coreip/nfs2dLib.h create mode 100644 h/wrn/coreip/nfs3Defines.h create mode 100644 h/wrn/coreip/nfs3Drv.h create mode 100644 h/wrn/coreip/nfs3Lib.h create mode 100644 h/wrn/coreip/nfs3dLib.h create mode 100644 h/wrn/coreip/nfsCommon.h create mode 100644 h/wrn/coreip/nfsDriver.h create mode 100644 h/wrn/coreip/nfsd.h create mode 100644 h/wrn/coreip/nfsdCommon.h create mode 100644 h/wrn/coreip/nlm4Lib.h create mode 100644 h/wrn/coreip/osdep.h create mode 100644 h/wrn/coreip/pathUtilLib.h create mode 100644 h/wrn/coreip/ping6Lib.h create mode 100644 h/wrn/coreip/pingLib.h create mode 100644 h/wrn/coreip/poll.h create mode 100644 h/wrn/coreip/private/bpfLibP.h create mode 100644 h/wrn/coreip/private/clarinet.h create mode 100644 h/wrn/coreip/private/fastPathIpP.h create mode 100644 h/wrn/coreip/private/fastPathLibP.h create mode 100644 h/wrn/coreip/private/fastPathPatTreeP.h create mode 100644 h/wrn/coreip/private/ftpLibP.h create mode 100644 h/wrn/coreip/private/gtf_core.h create mode 100644 h/wrn/coreip/private/gtf_util.h create mode 100644 h/wrn/coreip/private/gtf_wrapper.h create mode 100644 h/wrn/coreip/private/hostLibInt.h create mode 100644 h/wrn/coreip/private/jobQueueLibP.h create mode 100644 h/wrn/coreip/private/m2LibP.h create mode 100644 h/wrn/coreip/private/muxL2VlanLibP.h create mode 100644 h/wrn/coreip/private/muxLibP.h create mode 100644 h/wrn/coreip/private/qosIngressLibP.h create mode 100644 h/wrn/coreip/private/routeShowP.h create mode 100644 h/wrn/coreip/private/wvNetDEventP.h create mode 100644 h/wrn/coreip/protos/icmpv6Lib.h create mode 100644 h/wrn/coreip/protos/igmpLib.h create mode 100644 h/wrn/coreip/protos/ip6protosw.h create mode 100644 h/wrn/coreip/protos/mld6_var.h create mode 100644 h/wrn/coreip/protos/mldLib.h create mode 100644 h/wrn/coreip/protos/mrouteLib.h create mode 100644 h/wrn/coreip/protos/nd6Lib.h create mode 100644 h/wrn/coreip/protos/rarpLib.h create mode 100644 h/wrn/coreip/protos/sctpLib.h create mode 100644 h/wrn/coreip/protos/tcpLib.h create mode 100644 h/wrn/coreip/protos/udpLib.h create mode 100644 h/wrn/coreip/proxyArpLib.h create mode 100644 h/wrn/coreip/random.h create mode 100644 h/wrn/coreip/rdiscLib.h create mode 100644 h/wrn/coreip/remLib.h create mode 100644 h/wrn/coreip/resolv/nameser.h create mode 100644 h/wrn/coreip/resolv/resolv.h create mode 100644 h/wrn/coreip/resolvLib.h create mode 100644 h/wrn/coreip/rip/defs.h create mode 100644 h/wrn/coreip/rip/interface.h create mode 100644 h/wrn/coreip/rip/m2RipLeaf.h create mode 100644 h/wrn/coreip/rip/m2RipLib.h create mode 100644 h/wrn/coreip/rip/rip2.h create mode 100644 h/wrn/coreip/rip/ripLib.h create mode 100644 h/wrn/coreip/rip/table.h create mode 100644 h/wrn/coreip/ripngLib.h create mode 100644 h/wrn/coreip/rlogLib.h create mode 100644 h/wrn/coreip/route/avlRouteNodeLib.h create mode 100644 h/wrn/coreip/route/avltree.h create mode 100644 h/wrn/coreip/route/ipRouteLib.h create mode 100644 h/wrn/coreip/route/ipRouteNodeData.h create mode 100644 h/wrn/coreip/route/ipRouteNodeLib.h create mode 100644 h/wrn/coreip/route/llRouteNodeLib.h create mode 100644 h/wrn/coreip/route/ptRouteNodeLib.h create mode 100644 h/wrn/coreip/routeLib.h create mode 100644 h/wrn/coreip/rtadv/rtadvd.h create mode 100644 h/wrn/coreip/rtadv/timer.h create mode 100644 h/wrn/coreip/rtadvLib.h create mode 100644 h/wrn/coreip/rtpAppCmdLib.h create mode 100644 h/wrn/coreip/rtsolLib.h create mode 100644 h/wrn/coreip/sntp.h create mode 100644 h/wrn/coreip/sntpcLib.h create mode 100644 h/wrn/coreip/sntpsLib.h create mode 100644 h/wrn/coreip/sockFunc.h create mode 100644 h/wrn/coreip/sockLib.h create mode 100644 h/wrn/coreip/socket.h create mode 100644 h/wrn/coreip/sys/callout.h create mode 100644 h/wrn/coreip/sys/cdefs.h create mode 100644 h/wrn/coreip/sys/ds_conf.h create mode 100644 h/wrn/coreip/sys/fnv_hash.h create mode 100644 h/wrn/coreip/sys/mem_stru.h create mode 100644 h/wrn/coreip/sys/queue.h create mode 100644 h/wrn/coreip/sys/socket.h create mode 100644 h/wrn/coreip/sys/sockio.h create mode 100644 h/wrn/coreip/sysctlLib.h create mode 100644 h/wrn/coreip/syslog.h create mode 100644 h/wrn/coreip/telnetLib.h create mode 100644 h/wrn/coreip/tftpLib.h create mode 100644 h/wrn/coreip/tftpdLib.h create mode 100644 h/wrn/coreip/vs/vsBsdSock.h create mode 100644 h/wrn/coreip/vs/vsDhcpCommon.h create mode 100644 h/wrn/coreip/vs/vsDhcpr.h create mode 100644 h/wrn/coreip/vs/vsDns.h create mode 100644 h/wrn/coreip/vs/vsFastPath.h create mode 100644 h/wrn/coreip/vs/vsFastUdp6.h create mode 100644 h/wrn/coreip/vs/vsIcmpUtil.h create mode 100644 h/wrn/coreip/vs/vsIcmpv6.h create mode 100644 h/wrn/coreip/vs/vsIf.h create mode 100644 h/wrn/coreip/vs/vsIp6.h create mode 100644 h/wrn/coreip/vs/vsIpRoute.h create mode 100644 h/wrn/coreip/vs/vsLog.h create mode 100644 h/wrn/coreip/vs/vsMcast6.h create mode 100644 h/wrn/coreip/vs/vsMip6.h create mode 100644 h/wrn/coreip/vs/vsMld.h create mode 100644 h/wrn/coreip/vs/vsMroute.h create mode 100644 h/wrn/coreip/vs/vsNd6.h create mode 100644 h/wrn/coreip/vs/vsNdp.h create mode 100644 h/wrn/coreip/vs/vsRarp.h create mode 100644 h/wrn/coreip/vs/vsRaw.h create mode 100644 h/wrn/coreip/vs/vsRipng.h create mode 100644 h/wrn/coreip/vs/vsRtadv.h create mode 100644 h/wrn/coreip/vs/vsSoSup.h create mode 100644 h/wrn/coreip/vs/vsSysctl.h create mode 100644 h/wrn/coreip/vs/vsTunnelLib.h create mode 100644 h/wrn/coreip/wvNetDLib.h create mode 100644 h/wrn/coreip/xdr_mnt1.h create mode 100644 h/wrn/coreip/xdr_mnt3.h create mode 100644 h/wrn/coreip/xdr_mnt_common.h create mode 100644 h/wrn/coreip/xdr_nfs2.h create mode 100644 h/wrn/coreip/xdr_nfs3.h create mode 100644 h/wrn/coreip/xdr_nfs_common.h create mode 100644 h/wrn/coreip/xdr_nlm4.h create mode 100644 h/wrn/coreip/zbufLib.h create mode 100644 h/wrn/coreip/zbufSockLib.h create mode 100644 h/wrn/dot1x/dot1xAuthLib.h create mode 100644 h/wrn/dot1x/dot1xAuthSvrLib.h create mode 100644 h/wrn/dot1x/dot1xAuthTimerLib.h create mode 100644 h/wrn/dot1x/dot1xCommonIoctls.h create mode 100644 h/wrn/dot1x/dot1xDebugLib.h create mode 100644 h/wrn/dot1x/dot1xDesLib.h create mode 100644 h/wrn/dot1x/dot1xEapLib.h create mode 100644 h/wrn/dot1x/dot1xEapolLib.h create mode 100644 h/wrn/dot1x/dot1xKeyLib.h create mode 100644 h/wrn/dot1x/dot1xMdLib.h create mode 100644 h/wrn/dot1x/dot1xMemPartLib.h create mode 100644 h/wrn/dot1x/dot1xMibLib.h create mode 100644 h/wrn/dot1x/dot1xSuppCommonLib.h create mode 100644 h/wrn/dot1x/dot1xSuppLib.h create mode 100644 h/wrn/dot1x/dot1xSuppLibP.h create mode 100644 h/wrn/dot1x/dot1xSuppPeapLib.h create mode 100644 h/wrn/dot1x/dot1xSuppTlsLib.h create mode 100644 h/wrn/dot1x/dot1xSuppTtlsLib.h create mode 100644 h/wrn/dot1x/dot1xVirtEndLib.h create mode 100644 h/wrn/dot1x/dot1xWb4Lib.h create mode 100644 h/wrn/firewall/fwLib.h create mode 100644 h/wrn/firewall/syslogcLib.h create mode 100644 h/wrn/global_data_types.h create mode 100644 h/wrn/ike/ike.h create mode 100644 h/wrn/ike/ikeCerts.h create mode 100644 h/wrn/ike/ikeInit.h create mode 100644 h/wrn/ike/ikeStats.h create mode 100644 h/wrn/ike/ike_callbacks.h create mode 100644 h/wrn/ip_if.h create mode 100644 h/wrn/ip_message_if.h create mode 100644 h/wrn/ip_structures.h create mode 100644 h/wrn/ipsec/ipsec.h create mode 100644 h/wrn/ipsec/ipsecInit.h create mode 100644 h/wrn/ipsec/ipsecLogger.h create mode 100644 h/wrn/ipsec/ipsecStats.h create mode 100644 h/wrn/ipsec/ipsec_memory_routines.h create mode 100644 h/wrn/ipsec/ipsec_mkm.h create mode 100644 h/wrn/ipsec/mkmInit.h create mode 100644 h/wrn/lan_driver_if.h create mode 100644 h/wrn/nat/natAlgApi.h create mode 100644 h/wrn/nat/natExtCalls.h create mode 100644 h/wrn/nat/natMgmt.h create mode 100644 h/wrn/nat/natSnmpLeaf.h create mode 100644 h/wrn/nat/nat_api.h create mode 100644 h/wrn/netVersion.h create mode 100644 h/wrn/ospf/ospf.h create mode 100644 h/wrn/ospf/ospfLib.h create mode 100644 h/wrn/ospf/ospf_configuration.h create mode 100644 h/wrn/ospf/ospf_constants.h create mode 100644 h/wrn/ospf/ospf_enums.h create mode 100644 h/wrn/ospf/ospf_globals.h create mode 100644 h/wrn/ospf/ospf_interface_state_machine.h create mode 100644 h/wrn/ospf/ospf_invar.h create mode 100644 h/wrn/ospf/ospf_ip_structures.h create mode 100644 h/wrn/ospf/ospf_mdLib.h create mode 100644 h/wrn/ospf/ospf_memory.h create mode 100644 h/wrn/ospf/ospf_mib_api.h create mode 100644 h/wrn/ospf/ospf_mib_envoy_api.h create mode 100644 h/wrn/ospf/ospf_mib_helper.h create mode 100644 h/wrn/ospf/ospf_mib_helper_show.h create mode 100644 h/wrn/ospf/ospf_mib_helper_update.h create mode 100644 h/wrn/ospf/ospf_mib_leaf.h create mode 100644 h/wrn/ospf/ospf_mib_skel.h create mode 100644 h/wrn/ospf/ospf_mib_wrn_helper.h create mode 100644 h/wrn/ospf/ospf_mib_wrn_leaf.h create mode 100644 h/wrn/ospf/ospf_mib_wrn_skel.h create mode 100644 h/wrn/ospf/ospf_neighbor_state_machine.h create mode 100644 h/wrn/ospf/ospf_prototypes.h create mode 100644 h/wrn/ospf/ospf_snmp.h create mode 100644 h/wrn/ospf/ospf_structures.h create mode 100644 h/wrn/ospf/ospf_vnvram.h create mode 100644 h/wrn/ospf/ospf_vs.h create mode 100644 h/wrn/ospf/ospf_vs_data.h create mode 100644 h/wrn/ospf/ospf_vs_lib.h create mode 100644 h/wrn/ospfCommon/ospfCommonLib.h create mode 100644 h/wrn/ospfCommon/ospfCommonMemPart.h create mode 100644 h/wrn/ospfCommon/ospfCommonMibApi.h create mode 100644 h/wrn/ospfCommon/ospfCommonPrototypes.h create mode 100644 h/wrn/ospfCommon/ospfCommonRowStatusLib.h create mode 100644 h/wrn/ospfCommon/ospfCommonUtils.h create mode 100644 h/wrn/ospfCommon/ospfCommonVnvramStr.h create mode 100644 h/wrn/ospfv3/ospfv3Configuration.h create mode 100644 h/wrn/ospfv3/ospfv3Constants.h create mode 100644 h/wrn/ospfv3/ospfv3Enums.h create mode 100644 h/wrn/ospfv3/ospfv3EnvoySnmpApi.h create mode 100644 h/wrn/ospfv3/ospfv3EnvoySnmpLeaf.h create mode 100644 h/wrn/ospfv3/ospfv3EnvoySnmpSkel.h create mode 100644 h/wrn/ospfv3/ospfv3EnvoySnmpWrnLeaf.h create mode 100644 h/wrn/ospfv3/ospfv3EnvoySnmpWrnSkel.h create mode 100644 h/wrn/ospfv3/ospfv3Globals.h create mode 100644 h/wrn/ospfv3/ospfv3Initialize.h create mode 100644 h/wrn/ospfv3/ospfv3InterfaceStateMachine.h create mode 100644 h/wrn/ospfv3/ospfv3IpStructures.h create mode 100644 h/wrn/ospfv3/ospfv3Ipv6Dependencies.h create mode 100644 h/wrn/ospfv3/ospfv3Lib.h create mode 100644 h/wrn/ospfv3/ospfv3Mapi.h create mode 100644 h/wrn/ospfv3/ospfv3MapiHelper.h create mode 100644 h/wrn/ospfv3/ospfv3MapiHelperShow.h create mode 100644 h/wrn/ospfv3/ospfv3MapiHelperUpdate.h create mode 100644 h/wrn/ospfv3/ospfv3MapiWrnHelper.h create mode 100644 h/wrn/ospfv3/ospfv3Memory.h create mode 100644 h/wrn/ospfv3/ospfv3NeighborStateMachine.h create mode 100644 h/wrn/ospfv3/ospfv3Prototypes.h create mode 100644 h/wrn/ospfv3/ospfv3Structures.h create mode 100644 h/wrn/pppauth_if.h create mode 100644 h/wrn/pppctrl_if.h create mode 100644 h/wrn/radius/radiusCfg.h create mode 100644 h/wrn/radius/radiusLib.h create mode 100644 h/wrn/radius/radius_interface.h create mode 100644 h/wrn/radius/radius_utils.h create mode 100644 h/wrn/radius/usrBasicRadiusBSPBuildCfg.h create mode 100644 h/wrn/route_manager_if.h create mode 100644 h/wrn/rw_driver_manager_if.h create mode 100644 h/wrn/rwos.h create mode 100644 h/wrn/rwos/module_prototype.h create mode 100644 h/wrn/rwos/rw_host_os_interface.h create mode 100644 h/wrn/rwos/rw_task_functions.h create mode 100644 h/wrn/rwos/rw_util.h create mode 100644 h/wrn/rwos/rwbufferpool.h create mode 100644 h/wrn/rwos/rwcontainer.h create mode 100644 h/wrn/rwos/rwdispatcher.h create mode 100644 h/wrn/rwos/rwmemory.h create mode 100644 h/wrn/rwos/rwpacket.h create mode 100644 h/wrn/rwos/system.h create mode 100644 h/wrn/rwos_driver_manager_if.h create mode 100644 h/wrn/rwos_lower_layer_if.h create mode 100644 h/wrn/rwproto.h create mode 100644 h/wrn/rwutils.h create mode 100644 h/wrn/sadb/sadb.h create mode 100644 h/wrn/sadb/sadbInit.h create mode 100644 h/wrn/spd/spd.h create mode 100644 h/wrn/spd/spdInit.h create mode 100644 h/wrn/udp_if.h create mode 100644 h/wrn/v8022str.h create mode 100644 h/wrn/visnpstr.h create mode 100644 h/wrn/vnvrmstr.h create mode 100644 h/wrn/wm/common/backstop/common.h create mode 100644 h/wrn/wm/common/backstop/oemtypes.h create mode 100644 h/wrn/wm/common/bug.h create mode 100644 h/wrn/wm/common/bugdef.h create mode 100644 h/wrn/wm/common/cmn_init.h create mode 100644 h/wrn/wm/common/config.h create mode 100644 h/wrn/wm/common/des.h create mode 100644 h/wrn/wm/common/dyncfg.h create mode 100644 h/wrn/wm/common/fixed64.h create mode 100644 h/wrn/wm/common/fldmacro.h create mode 100644 h/wrn/wm/common/glue.h create mode 100644 h/wrn/wm/common/hmac.h create mode 100644 h/wrn/wm/common/md4.h create mode 100644 h/wrn/wm/common/md5.h create mode 100644 h/wrn/wm/common/prng.h create mode 100644 h/wrn/wm/common/sha.h create mode 100644 h/wrn/wm/common/snprintf.h create mode 100644 h/wrn/wm/common/stdf.h create mode 100644 h/wrn/wm/common/thread.h create mode 100644 h/wrn/wm/common/types.h create mode 100644 h/wrn/wm/common/weakprng.h create mode 100644 h/wrn/wm/demo/bpf.h create mode 100644 h/wrn/wm/demo/bpfdrive.h create mode 100644 h/wrn/wm/demo/bsdif.h create mode 100644 h/wrn/wm/demo/bug_conf.h create mode 100644 h/wrn/wm/demo/dlpi.h create mode 100644 h/wrn/wm/demo/dlpidrv.h create mode 100644 h/wrn/wm/demo/dsmemcfg.h create mode 100644 h/wrn/wm/demo/firewall.h create mode 100644 h/wrn/wm/demo/if_ether.h create mode 100644 h/wrn/wm/demo/keyboard.h create mode 100644 h/wrn/wm/demo/keyword.h create mode 100644 h/wrn/wm/demo/main.h create mode 100644 h/wrn/wm/demo/netconf.h create mode 100644 h/wrn/wm/demo/nit.h create mode 100644 h/wrn/wm/demo/nitdrive.h create mode 100644 h/wrn/wm/demo/nvutils.h create mode 100644 h/wrn/wm/demo/parse.h create mode 100644 h/wrn/wm/demo/pktd.h create mode 100644 h/wrn/wm/demo/pktd_bcc.h create mode 100644 h/wrn/wm/demo/pktd_msc.h create mode 100644 h/wrn/wm/demo/pktdrive.h create mode 100644 h/wrn/wm/demo/pppbsd.h create mode 100644 h/wrn/wm/demo/read_ini.h create mode 100644 h/wrn/wm/demo/relay.h create mode 100644 h/wrn/wm/demo/slipbsd.h create mode 100644 h/wrn/wm/demo/snarklib.h create mode 100644 h/wrn/wm/demo/snmpconf.h create mode 100644 h/wrn/wm/demo/snmpfunc.h create mode 100644 h/wrn/wm/demo/snoop.h create mode 100644 h/wrn/wm/demo/snoopdrv.h create mode 100644 h/wrn/wm/demo/strdup.h create mode 100644 h/wrn/wm/demo/sty.h create mode 100644 h/wrn/wm/demo/tasks.h create mode 100644 h/wrn/wm/demo/tundrive.h create mode 100644 h/wrn/wm/demo/vapornet.h create mode 100644 h/wrn/wm/snmp/engine/agentx.h create mode 100644 h/wrn/wm/snmp/engine/asn1.h create mode 100644 h/wrn/wm/snmp/engine/asn1conf.h create mode 100644 h/wrn/wm/snmp/engine/auxfuncs.h create mode 100644 h/wrn/wm/snmp/engine/auxmth.h create mode 100644 h/wrn/wm/snmp/engine/axapi.h create mode 100644 h/wrn/wm/snmp/engine/bstring.h create mode 100644 h/wrn/wm/snmp/engine/buffer.h create mode 100644 h/wrn/wm/snmp/engine/buildpkt.h create mode 100644 h/wrn/wm/snmp/engine/decode.h create mode 100644 h/wrn/wm/snmp/engine/encode.h create mode 100644 h/wrn/wm/snmp/engine/entlogic.h create mode 100644 h/wrn/wm/snmp/engine/etimer.h create mode 100644 h/wrn/wm/snmp/engine/localio.h create mode 100644 h/wrn/wm/snmp/engine/mib.h create mode 100644 h/wrn/wm/snmp/engine/ntfy_chk.h create mode 100644 h/wrn/wm/snmp/engine/objectid.h create mode 100644 h/wrn/wm/snmp/engine/proxy.h create mode 100644 h/wrn/wm/snmp/engine/proxy_tr.h create mode 100644 h/wrn/wm/snmp/engine/sendntfy.h create mode 100644 h/wrn/wm/snmp/engine/smi.h create mode 100644 h/wrn/wm/snmp/engine/snmp.h create mode 100644 h/wrn/wm/snmp/engine/snmpdefs.h create mode 100644 h/wrn/wm/snmp/engine/snmpstat.h create mode 100644 h/wrn/wm/snmp/engine/tree.h create mode 100644 h/wrn/wm/snmp/engine/ui64.h create mode 100644 h/wrn/wm/snmp/engine/v3_acc.h create mode 100644 h/wrn/wm/snmp/engine/v3_auth.h create mode 100644 h/wrn/wm/snmp/engine/v3_comm.h create mode 100644 h/wrn/wm/snmp/engine/v3_con.h create mode 100644 h/wrn/wm/snmp/engine/v3_dh.h create mode 100644 h/wrn/wm/snmp/engine/v3_eng.h create mode 100644 h/wrn/wm/snmp/engine/v3_ini.h create mode 100644 h/wrn/wm/snmp/engine/v3_mth.h create mode 100644 h/wrn/wm/snmp/engine/v3_ntfy.h create mode 100644 h/wrn/wm/snmp/engine/v3_priv.h create mode 100644 h/wrn/wm/snmp/engine/v3_proxy.h create mode 100644 h/wrn/wm/snmp/engine/v3_trgt.h create mode 100644 h/wrn/wm/snmp/engine/v3_user.h create mode 100644 h/wrn/wm/snmp/engine/vbdefs.h create mode 100644 h/wrn/wm/snmp/engine/version.h create mode 100644 h/wrn/wm/snmp/engine/view.h create mode 100644 h/wrn/wm/snmp/engine/vxcmpnts.h create mode 100644 h/wrn/wm/snmp/engine/wkobj.h create mode 100644 h/wrn/wm/snmp/vxagent/axCfg.h create mode 100644 h/wrn/wm/snmp/vxagent/namingScopes.h create mode 100644 h/wrn/wm/snmp/vxagent/snmpIoLib.h create mode 100644 h/wrn/wm/snmp/vxagent/snmpdInit.h create mode 100644 h/wrn/wm/snmp/vxagent/snmpdLib.h create mode 100644 h/wrn/wm/snmp/vxagent/tae_sa.h create mode 100644 h/wrn/wm/snmp/vxagent/vxprotos.h create mode 100644 h/wrn/wm/util/layout/agentx.h create mode 100644 h/wrn/wm/util/layout/agentx.ldb create mode 100644 h/wrn/wm/util/layout/apple.h create mode 100644 h/wrn/wm/util/layout/apple.ldb create mode 100644 h/wrn/wm/util/layout/arp.h create mode 100644 h/wrn/wm/util/layout/arp.ldb create mode 100644 h/wrn/wm/util/layout/bgp.h create mode 100644 h/wrn/wm/util/layout/bgp.ldb create mode 100644 h/wrn/wm/util/layout/chaos.h create mode 100644 h/wrn/wm/util/layout/chaos.ldb create mode 100644 h/wrn/wm/util/layout/dhcp.h create mode 100644 h/wrn/wm/util/layout/dhcp.ldb create mode 100644 h/wrn/wm/util/layout/dns.h create mode 100644 h/wrn/wm/util/layout/dns.ldb create mode 100644 h/wrn/wm/util/layout/doc.txt create mode 100644 h/wrn/wm/util/layout/ethernet.h create mode 100644 h/wrn/wm/util/layout/ethernet.ldb create mode 100644 h/wrn/wm/util/layout/ip.h create mode 100644 h/wrn/wm/util/layout/ip.ldb create mode 100644 h/wrn/wm/util/layout/ip6.h create mode 100644 h/wrn/wm/util/layout/ip6.ldb create mode 100644 h/wrn/wm/util/layout/layout.cfg create mode 100644 h/wrn/wm/util/layout/ldbcomp/dumpit.scm create mode 100644 h/wrn/wm/util/layout/ldbcomp/layout.scm create mode 100644 h/wrn/wm/util/layout/ldbcomp/lists.scm create mode 100644 h/wrn/wm/util/layout/ldbcomp/makefile.cfg create mode 100644 h/wrn/wm/util/layout/ldbcomp/match.scm create mode 100644 h/wrn/wm/util/layout/ldbcomp/packages.scm create mode 100644 h/wrn/wm/util/layout/ldbcomp/strings.scm create mode 100644 h/wrn/wm/util/layout/ldbcomp/utils.scm create mode 100644 h/wrn/wm/util/layout/ldbglue.h create mode 100644 h/wrn/wm/util/layout/makefile.cfg create mode 100644 h/wrn/wm/util/layout/netime.h create mode 100644 h/wrn/wm/util/layout/netime.ldb create mode 100644 h/wrn/wm/util/layout/ppp.h create mode 100644 h/wrn/wm/util/layout/ppp.ldb create mode 100644 h/wrn/wm/util/layout/rip.h create mode 100644 h/wrn/wm/util/layout/rip.ldb create mode 100644 h/wrn/wm/util/layout/secure.h create mode 100644 h/wrn/wm/util/layout/secure.ldb create mode 100644 h/wrn/wm/util/layout/sntp.h create mode 100644 h/wrn/wm/util/layout/sntp.ldb create mode 100644 h/wrn/wm/util/layout/test.c create mode 100644 h/wrn/wm/util/layout/tftp.h create mode 100644 h/wrn/wm/util/layout/tftp.ldb create mode 100644 h/wrn/wm/util/port/bsd44/attache.h create mode 100644 h/wrn/wm/util/port/bsd44/common.h create mode 100644 h/wrn/wm/util/port/bsd44/decorum.h create mode 100644 h/wrn/wm/util/port/bsd44/emissary.h create mode 100644 h/wrn/wm/util/port/bsd44/envoy.h create mode 100644 h/wrn/wm/util/port/bsd44/liaison.h create mode 100644 h/wrn/wm/util/port/bsd44/oemtypes.h create mode 100644 h/wrn/wm/util/port/bsd44/snark.h create mode 100644 h/wrn/wm/util/port/bsd44/snmptalk.h create mode 100644 h/wrn/wm/util/port/bsd44/sockport.h create mode 100644 h/wrn/wm/util/port/bsd44/telnet.h create mode 100644 h/wrn/wm/util/port/bsd44/thdport.h create mode 100644 h/wrn/wm/util/port/cygnusnt/common.h create mode 100644 h/wrn/wm/util/port/cygnusnt/emissary.h create mode 100644 h/wrn/wm/util/port/cygnusnt/envoy.h create mode 100644 h/wrn/wm/util/port/cygnusnt/oemtypes.h create mode 100644 h/wrn/wm/util/port/cygnusnt/snark.h create mode 100644 h/wrn/wm/util/port/cygnusnt/snmptalk.h create mode 100644 h/wrn/wm/util/port/envtest/envoy.h create mode 100644 h/wrn/wm/util/port/envtest/oemtypes.h create mode 100644 h/wrn/wm/util/port/generic/envoy.h create mode 100644 h/wrn/wm/util/port/isisnmp/arm250/drv_conf.h create mode 100644 h/wrn/wm/util/port/isisnmp/arm250/sys_conf.h create mode 100644 h/wrn/wm/util/port/isisnmp/common.h create mode 100644 h/wrn/wm/util/port/isisnmp/envoy.h create mode 100644 h/wrn/wm/util/port/isisnmp/mcf250/config.mk create mode 100644 h/wrn/wm/util/port/isisnmp/mcf250/drv_conf.h create mode 100644 h/wrn/wm/util/port/isisnmp/mcf250/sys_conf.h create mode 100644 h/wrn/wm/util/port/isisnmp/oemtypes.h create mode 100644 h/wrn/wm/util/port/isisnmp/ppc222/config.mk create mode 100644 h/wrn/wm/util/port/isisnmp/ppc222/drv_conf.h create mode 100644 h/wrn/wm/util/port/isisnmp/ppc222/sys_conf.h create mode 100644 h/wrn/wm/util/port/isisnmp/ppc250/config.mk create mode 100644 h/wrn/wm/util/port/isisnmp/ppc250/drv_conf.h create mode 100644 h/wrn/wm/util/port/isisnmp/ppc250/sys_conf.h create mode 100644 h/wrn/wm/util/port/isisnmp/ppc300/drv_conf.h create mode 100644 h/wrn/wm/util/port/isisnmp/ppc300/sys_conf.h create mode 100644 h/wrn/wm/util/port/isisnmp/snmptalk.h create mode 100644 h/wrn/wm/util/port/isisnmp/spl250/config.mk create mode 100644 h/wrn/wm/util/port/isisnmp/x86226/drv_conf.h create mode 100644 h/wrn/wm/util/port/isisnmp/x86226/sys_conf.h create mode 100644 h/wrn/wm/util/port/isisnmp/x86250/drv_conf.h create mode 100644 h/wrn/wm/util/port/isisnmp/x86250/sys_conf.h create mode 100644 h/wrn/wm/util/port/mac/emissary.h create mode 100644 h/wrn/wm/util/port/mach386/attache.h create mode 100644 h/wrn/wm/util/port/mach386/common.h create mode 100644 h/wrn/wm/util/port/mach386/emissary.h create mode 100644 h/wrn/wm/util/port/mach386/envoy.h create mode 100644 h/wrn/wm/util/port/mach386/oemtypes.h create mode 100644 h/wrn/wm/util/port/mach386/snmptalk.h create mode 100644 h/wrn/wm/util/port/mach386/telnet.h create mode 100644 h/wrn/wm/util/port/msdos/attache.h create mode 100644 h/wrn/wm/util/port/msdos/common.h create mode 100644 h/wrn/wm/util/port/msdos/decorum.h create mode 100644 h/wrn/wm/util/port/msdos/emissary.h create mode 100644 h/wrn/wm/util/port/msdos/envoy.h create mode 100644 h/wrn/wm/util/port/msdos/liaison.h create mode 100644 h/wrn/wm/util/port/msdos/snark.h create mode 100644 h/wrn/wm/util/port/msdos/snmptalk.h create mode 100644 h/wrn/wm/util/port/msdos/telnet.h create mode 100644 h/wrn/wm/util/port/solaris/attache.h create mode 100644 h/wrn/wm/util/port/solaris/common.h create mode 100644 h/wrn/wm/util/port/solaris/decorum.h create mode 100644 h/wrn/wm/util/port/solaris/emissary.h create mode 100644 h/wrn/wm/util/port/solaris/envoy.h create mode 100644 h/wrn/wm/util/port/solaris/liaison.h create mode 100644 h/wrn/wm/util/port/solaris/oemtypes.h create mode 100644 h/wrn/wm/util/port/solaris/snark.h create mode 100644 h/wrn/wm/util/port/solaris/snmptalk.h create mode 100644 h/wrn/wm/util/port/solaris/sockport.h create mode 100644 h/wrn/wm/util/port/solaris/telnet.h create mode 100644 h/wrn/wm/util/port/solaris/thdport.h create mode 100644 h/wrn/wm/util/port/sunos/attache.h create mode 100644 h/wrn/wm/util/port/sunos/common.h create mode 100644 h/wrn/wm/util/port/sunos/decorum.h create mode 100644 h/wrn/wm/util/port/sunos/emissary.h create mode 100644 h/wrn/wm/util/port/sunos/envoy.h create mode 100644 h/wrn/wm/util/port/sunos/liaison.h create mode 100644 h/wrn/wm/util/port/sunos/oemtypes.h create mode 100644 h/wrn/wm/util/port/sunos/snark.h create mode 100644 h/wrn/wm/util/port/sunos/snmptalk.h create mode 100644 h/wrn/wm/util/port/sunos/telnet.h create mode 100644 h/wrn/wm/util/port/vxworks/common.h create mode 100644 h/wrn/wm/util/port/vxworks/envoy.h create mode 100644 h/wrn/wm/util/port/vxworks/oemtypes.h create mode 100644 h/wrn/wm/util/port/vxworks/snark.h create mode 100644 h/wrn/wm/util/port/vxworks/snmptalk.h create mode 100644 h/wrn/wm/util/port/winsock/common.h create mode 100644 h/wrn/wm/util/port/winsock/envoy.h create mode 100644 h/wrn/wm/util/port/winsock/oemtypes.h create mode 100644 h/wrn/wm/util/port/winsock/snark.h create mode 100644 h/wrn/wm/util/port/winsock/snmptalk.h create mode 100644 h/wtx.h create mode 100644 h/wtxerr.h create mode 100644 h/wtxexch.h create mode 100644 h/wtxmsg.h create mode 100644 h/wtxrpc.h create mode 100644 h/wtxtypes.h create mode 100644 h/wtxxdr.h create mode 100644 h/wvLib.h create mode 100644 h/wvNetLib.h create mode 100644 h/wvTmrLib.h create mode 100644 h/xbdBlkDev.h create mode 100644 h/xbdPartition.h create mode 100644 h/xbdRamDisk.h create mode 100644 h/xdr_bool_t.h create mode 100644 h/xdr_mnt.h create mode 100644 h/xdr_nfs.h create mode 100644 h/xdr_nfsserv.h create mode 100644 h/zbufLib.h create mode 100644 h/zbufSockLib.h create mode 100644 libc/Makefile create mode 100644 libc/assert/Makefile create mode 100644 libc/assert/ansiAssert.c create mode 100644 libc/assert/assert.c create mode 100644 libc/ctype/Makefile create mode 100644 libc/ctype/__ctype_tab.c create mode 100644 libc/ctype/ansiCtype.c create mode 100644 libc/ctype/isalnum.c create mode 100644 libc/ctype/isalpha.c create mode 100644 libc/ctype/iscntrl.c create mode 100644 libc/ctype/isdigit.c create mode 100644 libc/ctype/isgraph.c create mode 100644 libc/ctype/islower.c create mode 100644 libc/ctype/isprint.c create mode 100644 libc/ctype/ispunct.c create mode 100644 libc/ctype/isspace.c create mode 100644 libc/ctype/isupper.c create mode 100644 libc/ctype/isxdigit.c create mode 100644 libc/ctype/tolower.c create mode 100644 libc/ctype/toupper.c create mode 100644 libc/locale/Makefile create mode 100644 libc/locale/ansiLocale.c create mode 100644 libc/locale/localeconv.c create mode 100644 libc/locale/setlocale.c create mode 100644 libc/math/Makefile create mode 100644 libc/math/acosh.c create mode 100644 libc/math/ansiMath.c create mode 100644 libc/math/asincos.c create mode 100644 libc/math/asinh.c create mode 100644 libc/math/atan.c create mode 100644 libc/math/atan2.c create mode 100644 libc/math/atanh.c create mode 100644 libc/math/ceil.c create mode 100644 libc/math/cosh.c create mode 100644 libc/math/exp.c create mode 100644 libc/math/exp__E.c create mode 100644 libc/math/expm1.c create mode 100644 libc/math/fabs.c create mode 100644 libc/math/floor.c create mode 100644 libc/math/fmod.c create mode 100644 libc/math/frexp.c create mode 100644 libc/math/ldexp.c create mode 100644 libc/math/log.c create mode 100644 libc/math/log10.c create mode 100644 libc/math/log1p.c create mode 100644 libc/math/log__L.c create mode 100644 libc/math/modf.c create mode 100644 libc/math/pow.c create mode 100644 libc/math/sincos.c create mode 100644 libc/math/sinh.c create mode 100644 libc/math/sqrt.c create mode 100644 libc/math/support.c create mode 100644 libc/math/tan.c create mode 100644 libc/math/tanh.c create mode 100644 libc/setjmp/Makefile create mode 100644 libc/setjmp/ansiSetjmp.c create mode 100644 libc/setjmp/longjmp.c create mode 100644 libc/stdarg/Makefile create mode 100644 libc/stdarg/ansiStdarg.c create mode 100644 libc/stdio/Makefile create mode 100644 libc/stdio/ansiStdio.c create mode 100644 libc/stdio/clearerr.c create mode 100644 libc/stdio/fclose.c create mode 100644 libc/stdio/fdopen.c create mode 100644 libc/stdio/feof.c create mode 100644 libc/stdio/ferror.c create mode 100644 libc/stdio/fflush.c create mode 100644 libc/stdio/fgetc.c create mode 100644 libc/stdio/fgetpos.c create mode 100644 libc/stdio/fgets.c create mode 100644 libc/stdio/fileno.c create mode 100644 libc/stdio/flags.c create mode 100644 libc/stdio/fopen.c create mode 100644 libc/stdio/fprintf.c create mode 100644 libc/stdio/fputc.c create mode 100644 libc/stdio/fputs.c create mode 100644 libc/stdio/fread.c create mode 100644 libc/stdio/freopen.c create mode 100644 libc/stdio/fscanf.c create mode 100644 libc/stdio/fseek.c create mode 100644 libc/stdio/fsetpos.c create mode 100644 libc/stdio/ftell.c create mode 100644 libc/stdio/fvwrite.c create mode 100644 libc/stdio/fwrite.c create mode 100644 libc/stdio/getc.c create mode 100644 libc/stdio/getchar.c create mode 100644 libc/stdio/gets.c create mode 100644 libc/stdio/getw.c create mode 100644 libc/stdio/makebuf.c create mode 100644 libc/stdio/perror.c create mode 100644 libc/stdio/putc.c create mode 100644 libc/stdio/putchar.c create mode 100644 libc/stdio/puts.c create mode 100644 libc/stdio/putw.c create mode 100644 libc/stdio/refill.c create mode 100644 libc/stdio/rewind.c create mode 100644 libc/stdio/rget.c create mode 100644 libc/stdio/scanf.c create mode 100644 libc/stdio/setbuf.c create mode 100644 libc/stdio/setbuffer.c create mode 100644 libc/stdio/setvbuf.c create mode 100644 libc/stdio/stdio.c create mode 100644 libc/stdio/stdioLib.c create mode 100644 libc/stdio/stdioShow.c create mode 100644 libc/stdio/tmpfile.c create mode 100644 libc/stdio/tmpnam.c create mode 100644 libc/stdio/ungetc.c create mode 100644 libc/stdio/vfprintf.c create mode 100644 libc/stdio/wbuf.c create mode 100644 libc/stdio/wsetup.c create mode 100644 libc/stdlib/Makefile create mode 100644 libc/stdlib/abort.c create mode 100644 libc/stdlib/abs.c create mode 100644 libc/stdlib/ansiStdlib.c create mode 100644 libc/stdlib/atexit.c create mode 100644 libc/stdlib/atof.c create mode 100644 libc/stdlib/atoi.c create mode 100644 libc/stdlib/atol.c create mode 100644 libc/stdlib/bsearch.c create mode 100644 libc/stdlib/div.c create mode 100644 libc/stdlib/labs.c create mode 100644 libc/stdlib/ldiv.c create mode 100644 libc/stdlib/multibyte.c create mode 100644 libc/stdlib/qsort.c create mode 100644 libc/stdlib/rand.c create mode 100644 libc/stdlib/strtod.c create mode 100644 libc/stdlib/strtol.c create mode 100644 libc/stdlib/strtoul.c create mode 100644 libc/stdlib/system.c create mode 100644 libc/string/Makefile create mode 100644 libc/string/ansiString.c create mode 100644 libc/string/memchr.c create mode 100644 libc/string/memcmp.c create mode 100644 libc/string/memcpy.c create mode 100644 libc/string/memmove.c create mode 100644 libc/string/memset.c create mode 100644 libc/string/strcat.c create mode 100644 libc/string/strchr.c create mode 100644 libc/string/strcmp.c create mode 100644 libc/string/strcoll.c create mode 100644 libc/string/strcpy.c create mode 100644 libc/string/strcspn.c create mode 100644 libc/string/strerror.c create mode 100644 libc/string/string.c create mode 100644 libc/string/strlen.c create mode 100644 libc/string/strncat.c create mode 100644 libc/string/strncmp.c create mode 100644 libc/string/strncpy.c create mode 100644 libc/string/strpbrk.c create mode 100644 libc/string/strrchr.c create mode 100644 libc/string/strspn.c create mode 100644 libc/string/strstr.c create mode 100644 libc/string/strtok.c create mode 100644 libc/string/strtok_r.c create mode 100644 libc/string/strxfrm.c create mode 100644 libc/string/xstate.c create mode 100644 libc/time/Makefile create mode 100644 libc/time/ansiTime.c create mode 100644 libc/time/asctime.c create mode 100644 libc/time/clock.c create mode 100644 libc/time/ctime.c create mode 100644 libc/time/difftime.c create mode 100644 libc/time/gmtime.c create mode 100644 libc/time/locTime.c create mode 100644 libc/time/localtime.c create mode 100644 libc/time/mktime.c create mode 100644 libc/time/strftime.c create mode 100644 libc/time/time.c create mode 100644 target/Makefile create mode 100644 target/config/Makefile create mode 100644 target/config/comps/src/dosfs2/usrAta.c create mode 100644 target/config/comps/src/dosfs2/usrFd.c create mode 100644 target/config/comps/src/usrSmObj.c create mode 100644 target/config/comps/src/usrVxFusion.c create mode 100644 target/config/comps/vxWorks/01vxmp.cdf create mode 100644 target/config/comps/vxWorks/02vxfusion.cdf create mode 100644 target/config/comps/vxWorks/10bsp.cdf create mode 100644 target/config/comps/vxWorks/10dosfs2.cdf create mode 100644 target/h/arch/ppc/ppc403.h create mode 100644 target/h/arch/sparc/mb86940.h create mode 100644 target/h/cbioLib.h create mode 100644 target/h/dcacheCbio.h create mode 100644 target/h/dosFsLib.h create mode 100644 target/h/dpartCbio.h create mode 100644 target/h/drv/usb/usbAcmLib.h create mode 100644 target/h/drv/usb/usbBulkDevLib.h create mode 100644 target/h/drv/usb/usbCbiUfiDevLib.h create mode 100644 target/h/drv/usb/usbHcd.h create mode 100644 target/h/drv/usb/usbHcdOhciLib.h create mode 100644 target/h/drv/usb/usbHcdUhciLib.h create mode 100644 target/h/drv/usb/usbKeyboardLib.h create mode 100644 target/h/drv/usb/usbKlsiEnd.h create mode 100644 target/h/drv/usb/usbMouseLib.h create mode 100644 target/h/drv/usb/usbNC1080End.h create mode 100644 target/h/drv/usb/usbOhci.h create mode 100644 target/h/drv/usb/usbPegasusEnd.h create mode 100644 target/h/drv/usb/usbPrinterLib.h create mode 100644 target/h/drv/usb/usbSpeakerLib.h create mode 100644 target/h/drv/usb/usbUhci.h create mode 100644 target/h/drv/vxfusion/distIfUdp.h create mode 100644 target/h/msgQSmLib.h create mode 100644 target/h/private/assertAltern.h create mode 100644 target/h/private/cbioLibP.h create mode 100644 target/h/private/dosDirLibP.h create mode 100644 target/h/private/dosFsFatP.h create mode 100644 target/h/private/dosFsLibP.h create mode 100644 target/h/private/dosFsVerP.h create mode 100644 target/h/private/msgQSmLibP.h create mode 100644 target/h/private/print64Lib.h create mode 100644 target/h/private/semSmLibP.h create mode 100644 target/h/private/smFixBlkLibP.h create mode 100644 target/h/private/smMemLibP.h create mode 100644 target/h/private/smNameLibP.h create mode 100644 target/h/private/smObjLibP.h create mode 100644 target/h/qFifoGLib.h create mode 100644 target/h/ramDiskCbio.h create mode 100644 target/h/rawFsLib.h create mode 100644 target/h/semSmLib.h create mode 100644 target/h/smDllLib.h create mode 100644 target/h/smMemLib.h create mode 100644 target/h/smNameLib.h create mode 100644 target/h/smObjLib.h create mode 100644 target/h/tarLib.h create mode 100644 target/h/usb/ossLib.h create mode 100644 target/h/usb/pciConstants.h create mode 100644 target/h/usb/tools/cmdParser.h create mode 100644 target/h/usb/tools/wavFormat.h create mode 100644 target/h/usb/usb.h create mode 100644 target/h/usb/usbAudio.h create mode 100644 target/h/usb/usbCommdevices.h create mode 100644 target/h/usb/usbDescrCopyLib.h create mode 100644 target/h/usb/usbEnet.h create mode 100644 target/h/usb/usbHandleLib.h create mode 100644 target/h/usb/usbHcdLib.h create mode 100644 target/h/usb/usbHid.h create mode 100644 target/h/usb/usbLib.h create mode 100644 target/h/usb/usbListLib.h create mode 100644 target/h/usb/usbMassStorage.h create mode 100644 target/h/usb/usbPciLib.h create mode 100644 target/h/usb/usbPlatform.h create mode 100644 target/h/usb/usbPrinter.h create mode 100644 target/h/usb/usbQueueLib.h create mode 100644 target/h/usb/usbdCoreLib.h create mode 100644 target/h/usb/usbdLib.h create mode 100644 target/h/usb/usbdStructures.h create mode 100644 target/h/usrFdiskPartLib.h create mode 100644 target/h/vxfusion/distIfLib.h create mode 100644 target/h/vxfusion/distLib.h create mode 100644 target/h/vxfusion/distNameLib.h create mode 100644 target/h/vxfusion/distNetLib.h create mode 100644 target/h/vxfusion/distNodeLib.h create mode 100644 target/h/vxfusion/distStatLib.h create mode 100644 target/h/vxfusion/distTBufLib.h create mode 100644 target/h/vxfusion/msgQDistGrpLib.h create mode 100644 target/h/vxfusion/msgQDistGrpShow.h create mode 100644 target/h/vxfusion/msgQDistLib.h create mode 100644 target/h/vxfusion/msgQDistShow.h create mode 100644 target/h/vxfusion/private/distIncoLibP.h create mode 100644 target/h/vxfusion/private/distLibP.h create mode 100644 target/h/vxfusion/private/distNameLibP.h create mode 100644 target/h/vxfusion/private/distNetLibP.h create mode 100644 target/h/vxfusion/private/distNodeLibP.h create mode 100644 target/h/vxfusion/private/distObjLibP.h create mode 100644 target/h/vxfusion/private/distPktLibP.h create mode 100644 target/h/vxfusion/private/distStatLibP.h create mode 100644 target/h/vxfusion/private/distTBufLibP.h create mode 100644 target/h/vxfusion/private/msgQDistGrpLibP.h create mode 100644 target/h/vxfusion/private/msgQDistLibP.h create mode 100644 target/src/Makefile create mode 100644 target/src/arch/Makefile create mode 100644 target/src/arch/Makefile.in create mode 100644 target/src/arch/arm/Makefile create mode 100644 target/src/arch/arm/unixALib.s create mode 100644 target/src/arch/doc/Makefile create mode 100644 target/src/arch/doc/dbgArchLib.c create mode 100644 target/src/arch/doc/excArchLib.c create mode 100644 target/src/arch/doc/fppArchLib.c create mode 100644 target/src/arch/doc/intArchLib.c create mode 100644 target/src/arch/doc/taskArchLib.c create mode 100644 target/src/arch/doc/vxLib.c create mode 100644 target/src/arch/i86/Makefile create mode 100644 target/src/arch/i86/bALib.s create mode 100644 target/src/arch/i86/cacheALib.s create mode 100644 target/src/arch/i86/cacheArchLib.c create mode 100644 target/src/arch/i86/dbgArchLib.c create mode 100644 target/src/arch/i86/dllALib.s create mode 100644 target/src/arch/i86/dsmLib.c create mode 100644 target/src/arch/i86/elfI86.c create mode 100644 target/src/arch/i86/excALib.s create mode 100644 target/src/arch/i86/excArchLib.c create mode 100644 target/src/arch/i86/excArchShow.c create mode 100644 target/src/arch/i86/ffsALib.s create mode 100644 target/src/arch/i86/fppALib.s create mode 100644 target/src/arch/i86/fppArchLib.c create mode 100644 target/src/arch/i86/intALib.s create mode 100644 target/src/arch/i86/intArchLib.c create mode 100644 target/src/arch/i86/ipiALib.s create mode 100644 target/src/arch/i86/ipiArchLib.c create mode 100644 target/src/arch/i86/math/Makefile create mode 100644 target/src/arch/i86/math/emuFncALib.s create mode 100644 target/src/arch/i86/math/emuIncALib.s create mode 100644 target/src/arch/i86/math/emuMainALib.s create mode 100644 target/src/arch/i86/math/emuOperALib.s create mode 100644 target/src/arch/i86/math/emuSubALib.s create mode 100644 target/src/arch/i86/math/mathALib.s create mode 100644 target/src/arch/i86/math/mathHardALib.s create mode 100644 target/src/arch/i86/math/mathHardLib.c create mode 100644 target/src/arch/i86/math/mathSoftLib.c create mode 100644 target/src/arch/i86/mmuI86ALib.s create mode 100644 target/src/arch/i86/mmuI86Lib.c create mode 100644 target/src/arch/i86/mmuPro32ALib.s create mode 100644 target/src/arch/i86/mmuPro32Lib.c create mode 100644 target/src/arch/i86/mmuPro36ALib.s create mode 100644 target/src/arch/i86/mmuPro36Lib.c create mode 100644 target/src/arch/i86/pentiumALib.s create mode 100644 target/src/arch/i86/pentiumLib.c create mode 100644 target/src/arch/i86/pentiumShow.c create mode 100644 target/src/arch/i86/qPriBMapALib.s create mode 100644 target/src/arch/i86/semALib.s create mode 100644 target/src/arch/i86/semCALib.s create mode 100644 target/src/arch/i86/semMALib.s create mode 100644 target/src/arch/i86/sigCtxALib.s create mode 100644 target/src/arch/i86/sigCtxLib.c create mode 100644 target/src/arch/i86/sllALib.s create mode 100644 target/src/arch/i86/taskArchLib.c create mode 100644 target/src/arch/i86/trcLib.c create mode 100644 target/src/arch/i86/unixALib.s create mode 100644 target/src/arch/i86/vmArch32Lib.c create mode 100644 target/src/arch/i86/vmArch36Lib.c create mode 100644 target/src/arch/i86/vmBaseArch32Lib.c create mode 100644 target/src/arch/i86/vmBaseArch36Lib.c create mode 100644 target/src/arch/i86/vxALib.s create mode 100644 target/src/arch/i86/vxLib.c create mode 100644 target/src/arch/i86/vxShow.c create mode 100644 target/src/arch/i86/vxmIfLib.c create mode 100644 target/src/arch/i86/wdbDbgALib.s create mode 100644 target/src/arch/i86/wdbDbgArchLib.c create mode 100644 target/src/arch/i86/windALib.s create mode 100644 target/src/arch/i86/workQALib.s create mode 100644 target/src/arch/i960/Makefile create mode 100644 target/src/arch/i960/math/Makefile create mode 100644 target/src/arch/i960/unixALib.s create mode 100644 target/src/arch/mc68k/Makefile create mode 100644 target/src/arch/mc68k/math/Makefile create mode 100644 target/src/arch/mc68k/math/bindec.s create mode 100644 target/src/arch/mc68k/math/binstr.s create mode 100644 target/src/arch/mc68k/math/bugfix.s create mode 100644 target/src/arch/mc68k/math/decbin.s create mode 100644 target/src/arch/mc68k/math/do_func.s create mode 100644 target/src/arch/mc68k/math/excFppALib.s create mode 100644 target/src/arch/mc68k/math/fixunssfsi.c create mode 100644 target/src/arch/mc68k/math/fpsp040E.h create mode 100644 target/src/arch/mc68k/math/fpsp040L.h create mode 100644 target/src/arch/mc68k/math/gen_except.s create mode 100644 target/src/arch/mc68k/math/get_op.s create mode 100644 target/src/arch/mc68k/math/kernel_ex.s create mode 100644 target/src/arch/mc68k/math/l_do_func.s create mode 100644 target/src/arch/mc68k/math/l_entry.s create mode 100644 target/src/arch/mc68k/math/l_round.s create mode 100644 target/src/arch/mc68k/math/l_sacos.s create mode 100644 target/src/arch/mc68k/math/l_sasin.s create mode 100644 target/src/arch/mc68k/math/l_satan.s create mode 100644 target/src/arch/mc68k/math/l_satanh.s create mode 100644 target/src/arch/mc68k/math/l_scale.s create mode 100644 target/src/arch/mc68k/math/l_scosh.s create mode 100644 target/src/arch/mc68k/math/l_setox.s create mode 100644 target/src/arch/mc68k/math/l_sgetem.s create mode 100644 target/src/arch/mc68k/math/l_sint.s create mode 100644 target/src/arch/mc68k/math/l_slog2.s create mode 100644 target/src/arch/mc68k/math/l_slogn.s create mode 100644 target/src/arch/mc68k/math/l_srem_mod.s create mode 100644 target/src/arch/mc68k/math/l_ssin.s create mode 100644 target/src/arch/mc68k/math/l_ssinh.s create mode 100644 target/src/arch/mc68k/math/l_stan.s create mode 100644 target/src/arch/mc68k/math/l_stanh.s create mode 100644 target/src/arch/mc68k/math/l_stwotox.s create mode 100644 target/src/arch/mc68k/math/l_support.s create mode 100644 target/src/arch/mc68k/math/res_func.s create mode 100644 target/src/arch/mc68k/math/round.s create mode 100644 target/src/arch/mc68k/math/sacos.s create mode 100644 target/src/arch/mc68k/math/sasin.s create mode 100644 target/src/arch/mc68k/math/satan.s create mode 100644 target/src/arch/mc68k/math/satanh.s create mode 100644 target/src/arch/mc68k/math/scale.s create mode 100644 target/src/arch/mc68k/math/scosh.s create mode 100644 target/src/arch/mc68k/math/setox.s create mode 100644 target/src/arch/mc68k/math/sgetem.s create mode 100644 target/src/arch/mc68k/math/sint.s create mode 100644 target/src/arch/mc68k/math/slog2.s create mode 100644 target/src/arch/mc68k/math/slogn.s create mode 100644 target/src/arch/mc68k/math/smovecr.s create mode 100644 target/src/arch/mc68k/math/srem_mod.s create mode 100644 target/src/arch/mc68k/math/ssin.s create mode 100644 target/src/arch/mc68k/math/ssinh.s create mode 100644 target/src/arch/mc68k/math/stan.s create mode 100644 target/src/arch/mc68k/math/stanh.s create mode 100644 target/src/arch/mc68k/math/sto_res.s create mode 100644 target/src/arch/mc68k/math/stwotox.s create mode 100644 target/src/arch/mc68k/math/tbldo.s create mode 100644 target/src/arch/mc68k/math/uss_dpfncs.s create mode 100644 target/src/arch/mc68k/math/uss_dpopns.s create mode 100644 target/src/arch/mc68k/math/uss_fpfncs.s create mode 100644 target/src/arch/mc68k/math/uss_fpopns.s create mode 100644 target/src/arch/mc68k/math/uss_xlfncs.s create mode 100644 target/src/arch/mc68k/math/util.s create mode 100644 target/src/arch/mc68k/math/x_bsun.s create mode 100644 target/src/arch/mc68k/math/x_operr.s create mode 100644 target/src/arch/mc68k/math/x_ovfl.s create mode 100644 target/src/arch/mc68k/math/x_snan.s create mode 100644 target/src/arch/mc68k/math/x_store.s create mode 100644 target/src/arch/mc68k/math/x_unfl.s create mode 100644 target/src/arch/mc68k/math/x_unsupp.s create mode 100644 target/src/arch/mc68k/unixALib.s create mode 100644 target/src/arch/mips/Makefile create mode 100644 target/src/arch/mips/math/Makefile create mode 100644 target/src/arch/mips/unixALib.s create mode 100644 target/src/arch/ppc/Makefile create mode 100644 target/src/arch/ppc/math/Makefile create mode 100644 target/src/arch/ppc/math/motorolaLib/Makefile create mode 100644 target/src/arch/ppc/math/usSoftwareLib/Makefile create mode 100644 target/src/arch/sh/Makefile create mode 100644 target/src/arch/sh/unixALib.s create mode 100644 target/src/arch/sparc/Makefile create mode 100644 target/src/arch/sparc/math/Makefile create mode 100644 target/src/arch/sparc/math/arc32.s create mode 100644 target/src/arch/sparc/math/ceil32.s create mode 100644 target/src/arch/sparc/math/dp32.s create mode 100644 target/src/arch/sparc/math/exp32.s create mode 100644 target/src/arch/sparc/math/fdmul32.s create mode 100644 target/src/arch/sparc/math/floor32.s create mode 100644 target/src/arch/sparc/math/fp32.s create mode 100644 target/src/arch/sparc/math/fparc32.s create mode 100644 target/src/arch/sparc/math/fpceil32.s create mode 100644 target/src/arch/sparc/math/fpexp32.s create mode 100644 target/src/arch/sparc/math/fpfloo32.s create mode 100644 target/src/arch/sparc/math/fphyp32.s create mode 100644 target/src/arch/sparc/math/fplog32.s create mode 100644 target/src/arch/sparc/math/fpmod32.s create mode 100644 target/src/arch/sparc/math/fppow32.s create mode 100644 target/src/arch/sparc/math/fpsqrt32.s create mode 100644 target/src/arch/sparc/math/fptrig32.s create mode 100644 target/src/arch/sparc/math/func32.s create mode 100644 target/src/arch/sparc/math/hyp32.s create mode 100644 target/src/arch/sparc/math/log32.s create mode 100644 target/src/arch/sparc/math/mod32.s create mode 100644 target/src/arch/sparc/math/pow32.s create mode 100644 target/src/arch/sparc/math/sqrt32.s create mode 100644 target/src/arch/sparc/math/trig32.s create mode 100644 target/src/arch/sparc/unixALib.s create mode 100644 target/src/bpf/Makefile create mode 100644 target/src/bpf/bpfDrv.c create mode 100644 target/src/bpf/bpfProto.c create mode 100644 target/src/bpf/bpf_filter.c create mode 100644 target/src/config/usrVxFusion.c create mode 100644 target/src/cplus/Makefile create mode 100644 target/src/cplus/rts/Makefile create mode 100644 target/src/cplus/rts/cplusCore.cpp create mode 100644 target/src/cplus/rts/cplusInit.cpp create mode 100644 target/src/cplus/rts/cplusLib.c create mode 100644 target/src/cplus/rts/cplusLibDoc.c create mode 100644 target/src/cplus/rts/cplusLoad.c create mode 100644 target/src/cplus/rts/cplusStr.cpp create mode 100644 target/src/cplus/rts/cplusUsr.c create mode 100644 target/src/cplus/rts/cplusXtors.c create mode 100644 target/src/cplus/rts/demangler/Makefile create mode 100644 target/src/cplus/rts/demangler/ansidecl.h create mode 100644 target/src/cplus/rts/demangler/cp-demangle.c create mode 100644 target/src/cplus/rts/demangler/cplus-dem.c create mode 100644 target/src/cplus/rts/demangler/cplusDem.c create mode 100644 target/src/cplus/rts/demangler/cplusDemStub.c create mode 100644 target/src/cplus/rts/demangler/demangle.h create mode 100644 target/src/cplus/rts/demangler/edg-decode.c create mode 100644 target/src/cplus/rts/demangler/libiberty.h create mode 100644 target/src/cplus/rts/demangler/safe-ctype.c create mode 100644 target/src/cplus/rts/demangler/safe-ctype.h create mode 100644 target/src/dhcp/Makefile create mode 100644 target/src/dhcp/common_subr.c create mode 100644 target/src/dhcp/database.c create mode 100644 target/src/dhcp/delarp.c create mode 100644 target/src/dhcp/dhcpRelay.c create mode 100644 target/src/dhcp/dhcpc.c create mode 100644 target/src/dhcp/dhcpcBoot.c create mode 100644 target/src/dhcp/dhcpcState1.c create mode 100644 target/src/dhcp/dhcpcState2.c create mode 100644 target/src/dhcp/dhcpc_subr.c create mode 100644 target/src/dhcp/dhcpr.c create mode 100644 target/src/dhcp/dhcps.c create mode 100644 target/src/dhcp/flushroute.c create mode 100644 target/src/dhcp/hash.c create mode 100644 target/src/dhcp/interface.c create mode 100644 target/src/drv/Makefile create mode 100644 target/src/drv/pcmcia/Makefile create mode 100644 target/src/drv/pcmcia/cisLib.c create mode 100644 target/src/drv/pcmcia/cisShow.c create mode 100644 target/src/drv/pcmcia/pccardLib.c create mode 100644 target/src/drv/pcmcia/pccardShow.c create mode 100644 target/src/drv/pcmcia/pcic.c create mode 100644 target/src/drv/pcmcia/pcicShow.c create mode 100644 target/src/drv/pcmcia/pcmciaLib.c create mode 100644 target/src/drv/pcmcia/pcmciaShow.c create mode 100644 target/src/drv/pcmcia/sramDrv.c create mode 100644 target/src/drv/pcmcia/tcic.c create mode 100644 target/src/drv/pcmcia/tcicShow.c create mode 100644 target/src/drv/vxfusion/Makefile create mode 100644 target/src/drv/vxfusion/distIfUdp.c create mode 100644 target/src/drv/wdb/Makefile create mode 100644 target/src/drv/wdb/amc500/dpconfig.h create mode 100644 target/src/drv/wdb/amc500/dptarget.c create mode 100644 target/src/drv/wdb/amc500/dptarget.h create mode 100644 target/src/drv/wdb/amc500/dualport.h create mode 100644 target/src/drv/wdb/amc500/wdbNetromPktDrv.c create mode 100644 target/src/drv/wdb/dpconfig.h create mode 100644 target/src/drv/wdb/dptarget.c create mode 100644 target/src/drv/wdb/dptarget.h create mode 100644 target/src/drv/wdb/dualport.h create mode 100644 target/src/drv/wdb/wdbBdmPktDrv.c create mode 100644 target/src/drv/wdb/wdbEndPktDrv.c create mode 100644 target/src/drv/wdb/wdbNetromPktDrv.c create mode 100644 target/src/drv/wdb/wdbPipePktDrv.c create mode 100644 target/src/drv/wdb/wdbSlipPktDrv.c create mode 100644 target/src/drv/wdb/wdbTemplatePktDrv.c create mode 100644 target/src/drv/wdb/wdbTsfsDrv.c create mode 100644 target/src/drv/wdb/wdbUlipPktDrv.c create mode 100644 target/src/drv/wdb/wdbVioDrv.c create mode 100644 target/src/event/Makefile create mode 100644 target/src/event/connLib.c create mode 100644 target/src/event/evtLogLib.c create mode 100644 target/src/event/seqDrv.c create mode 100644 target/src/event/trgLib.c create mode 100644 target/src/event/trgShow.c create mode 100644 target/src/event/wvFileUploadPathLib.c create mode 100644 target/src/event/wvHostLib.c create mode 100644 target/src/event/wvLib.c create mode 100644 target/src/event/wvRpcSvc.c create mode 100644 target/src/event/wvRpc_xdr.c create mode 100644 target/src/event/wvServer.c create mode 100644 target/src/event/wvSockUploadPathLib.c create mode 100644 target/src/event/wvTmrLib.c create mode 100644 target/src/event/wvTsfsUploadPathLib.c create mode 100644 target/src/fs/Makefile create mode 100644 target/src/fs/cbioLib.c create mode 100644 target/src/fs/dcacheCbio.c create mode 100644 target/src/fs/dosChkLib.c create mode 100644 target/src/fs/dosDirOldLib.c create mode 100644 target/src/fs/dosFsFat.c create mode 100644 target/src/fs/dosFsFmtLib.c create mode 100644 target/src/fs/dosFsLib.c create mode 100644 target/src/fs/dosVDirLib.c create mode 100644 target/src/fs/dpartCbio.c create mode 100644 target/src/fs/print64Lib.c create mode 100644 target/src/fs/rawFsLib.c create mode 100644 target/src/libc/Makefile create mode 100644 target/src/libc/assert/Makefile create mode 100644 target/src/libc/assert/ansiAssert.c create mode 100644 target/src/libc/assert/assert.c create mode 100644 target/src/libc/ctype/Makefile create mode 100644 target/src/libc/ctype/__ctype_tab.c create mode 100644 target/src/libc/ctype/ansiCtype.c create mode 100644 target/src/libc/ctype/isalnum.c create mode 100644 target/src/libc/ctype/isalpha.c create mode 100644 target/src/libc/ctype/iscntrl.c create mode 100644 target/src/libc/ctype/isdigit.c create mode 100644 target/src/libc/ctype/isgraph.c create mode 100644 target/src/libc/ctype/islower.c create mode 100644 target/src/libc/ctype/isprint.c create mode 100644 target/src/libc/ctype/ispunct.c create mode 100644 target/src/libc/ctype/isspace.c create mode 100644 target/src/libc/ctype/isupper.c create mode 100644 target/src/libc/ctype/isxdigit.c create mode 100644 target/src/libc/ctype/tolower.c create mode 100644 target/src/libc/ctype/toupper.c create mode 100644 target/src/libc/locale/Makefile create mode 100644 target/src/libc/locale/ansiLocale.c create mode 100644 target/src/libc/locale/localeconv.c create mode 100644 target/src/libc/locale/setlocale.c create mode 100644 target/src/libc/math/Makefile create mode 100644 target/src/libc/math/acosh.c create mode 100644 target/src/libc/math/ansiMath.c create mode 100644 target/src/libc/math/asincos.c create mode 100644 target/src/libc/math/asinh.c create mode 100644 target/src/libc/math/atan.c create mode 100644 target/src/libc/math/atan2.c create mode 100644 target/src/libc/math/atanh.c create mode 100644 target/src/libc/math/ceil.c create mode 100644 target/src/libc/math/cosh.c create mode 100644 target/src/libc/math/exp.c create mode 100644 target/src/libc/math/exp__E.c create mode 100644 target/src/libc/math/expm1.c create mode 100644 target/src/libc/math/fabs.c create mode 100644 target/src/libc/math/floor.c create mode 100644 target/src/libc/math/fmod.c create mode 100644 target/src/libc/math/frexp.c create mode 100644 target/src/libc/math/ldexp.c create mode 100644 target/src/libc/math/log.c create mode 100644 target/src/libc/math/log10.c create mode 100644 target/src/libc/math/log1p.c create mode 100644 target/src/libc/math/log__L.c create mode 100644 target/src/libc/math/modf.c create mode 100644 target/src/libc/math/pow.c create mode 100644 target/src/libc/math/sincos.c create mode 100644 target/src/libc/math/sinh.c create mode 100644 target/src/libc/math/sqrt.c create mode 100644 target/src/libc/math/support.c create mode 100644 target/src/libc/math/tan.c create mode 100644 target/src/libc/math/tanh.c create mode 100644 target/src/libc/setjmp/Makefile create mode 100644 target/src/libc/setjmp/ansiSetjmp.c create mode 100644 target/src/libc/setjmp/longjmp.c create mode 100644 target/src/libc/stdarg/Makefile create mode 100644 target/src/libc/stdarg/ansiStdarg.c create mode 100644 target/src/libc/stdio/Makefile create mode 100644 target/src/libc/stdio/ansiStdio.c create mode 100644 target/src/libc/stdio/clearerr.c create mode 100644 target/src/libc/stdio/fclose.c create mode 100644 target/src/libc/stdio/fdopen.c create mode 100644 target/src/libc/stdio/feof.c create mode 100644 target/src/libc/stdio/ferror.c create mode 100644 target/src/libc/stdio/fflush.c create mode 100644 target/src/libc/stdio/fgetc.c create mode 100644 target/src/libc/stdio/fgetpos.c create mode 100644 target/src/libc/stdio/fgets.c create mode 100644 target/src/libc/stdio/fileno.c create mode 100644 target/src/libc/stdio/flags.c create mode 100644 target/src/libc/stdio/fopen.c create mode 100644 target/src/libc/stdio/fprintf.c create mode 100644 target/src/libc/stdio/fputc.c create mode 100644 target/src/libc/stdio/fputs.c create mode 100644 target/src/libc/stdio/fread.c create mode 100644 target/src/libc/stdio/freopen.c create mode 100644 target/src/libc/stdio/fscanf.c create mode 100644 target/src/libc/stdio/fseek.c create mode 100644 target/src/libc/stdio/fsetpos.c create mode 100644 target/src/libc/stdio/ftell.c create mode 100644 target/src/libc/stdio/fvwrite.c create mode 100644 target/src/libc/stdio/fwrite.c create mode 100644 target/src/libc/stdio/getc.c create mode 100644 target/src/libc/stdio/getchar.c create mode 100644 target/src/libc/stdio/gets.c create mode 100644 target/src/libc/stdio/getw.c create mode 100644 target/src/libc/stdio/makebuf.c create mode 100644 target/src/libc/stdio/perror.c create mode 100644 target/src/libc/stdio/putc.c create mode 100644 target/src/libc/stdio/putchar.c create mode 100644 target/src/libc/stdio/puts.c create mode 100644 target/src/libc/stdio/putw.c create mode 100644 target/src/libc/stdio/refill.c create mode 100644 target/src/libc/stdio/rewind.c create mode 100644 target/src/libc/stdio/rget.c create mode 100644 target/src/libc/stdio/scanf.c create mode 100644 target/src/libc/stdio/setbuf.c create mode 100644 target/src/libc/stdio/setbuffer.c create mode 100644 target/src/libc/stdio/setvbuf.c create mode 100644 target/src/libc/stdio/stdio.c create mode 100644 target/src/libc/stdio/stdioLib.c create mode 100644 target/src/libc/stdio/stdioShow.c create mode 100644 target/src/libc/stdio/tmpfile.c create mode 100644 target/src/libc/stdio/tmpnam.c create mode 100644 target/src/libc/stdio/ungetc.c create mode 100644 target/src/libc/stdio/vfprintf.c create mode 100644 target/src/libc/stdio/wbuf.c create mode 100644 target/src/libc/stdio/wsetup.c create mode 100644 target/src/libc/stdlib/Makefile create mode 100644 target/src/libc/stdlib/abort.c create mode 100644 target/src/libc/stdlib/abs.c create mode 100644 target/src/libc/stdlib/ansiStdlib.c create mode 100644 target/src/libc/stdlib/atexit.c create mode 100644 target/src/libc/stdlib/atof.c create mode 100644 target/src/libc/stdlib/atoi.c create mode 100644 target/src/libc/stdlib/atol.c create mode 100644 target/src/libc/stdlib/bsearch.c create mode 100644 target/src/libc/stdlib/div.c create mode 100644 target/src/libc/stdlib/labs.c create mode 100644 target/src/libc/stdlib/ldiv.c create mode 100644 target/src/libc/stdlib/multibyte.c create mode 100644 target/src/libc/stdlib/qsort.c create mode 100644 target/src/libc/stdlib/rand.c create mode 100644 target/src/libc/stdlib/strtod.c create mode 100644 target/src/libc/stdlib/strtol.c create mode 100644 target/src/libc/stdlib/strtoul.c create mode 100644 target/src/libc/stdlib/system.c create mode 100644 target/src/libc/string/Makefile create mode 100644 target/src/libc/string/ansiString.c create mode 100644 target/src/libc/string/memchr.c create mode 100644 target/src/libc/string/memcmp.c create mode 100644 target/src/libc/string/memcpy.c create mode 100644 target/src/libc/string/memmove.c create mode 100644 target/src/libc/string/memset.c create mode 100644 target/src/libc/string/strcat.c create mode 100644 target/src/libc/string/strchr.c create mode 100644 target/src/libc/string/strcmp.c create mode 100644 target/src/libc/string/strcoll.c create mode 100644 target/src/libc/string/strcpy.c create mode 100644 target/src/libc/string/strcspn.c create mode 100644 target/src/libc/string/strerror.c create mode 100644 target/src/libc/string/string.c create mode 100644 target/src/libc/string/strlen.c create mode 100644 target/src/libc/string/strncat.c create mode 100644 target/src/libc/string/strncmp.c create mode 100644 target/src/libc/string/strncpy.c create mode 100644 target/src/libc/string/strpbrk.c create mode 100644 target/src/libc/string/strrchr.c create mode 100644 target/src/libc/string/strspn.c create mode 100644 target/src/libc/string/strstr.c create mode 100644 target/src/libc/string/strtok.c create mode 100644 target/src/libc/string/strtok_r.c create mode 100644 target/src/libc/string/strxfrm.c create mode 100644 target/src/libc/string/xstate.c create mode 100644 target/src/libc/time/Makefile create mode 100644 target/src/libc/time/ansiTime.c create mode 100644 target/src/libc/time/asctime.c create mode 100644 target/src/libc/time/clock.c create mode 100644 target/src/libc/time/ctime.c create mode 100644 target/src/libc/time/difftime.c create mode 100644 target/src/libc/time/gmtime.c create mode 100644 target/src/libc/time/locTime.c create mode 100644 target/src/libc/time/localtime.c create mode 100644 target/src/libc/time/mktime.c create mode 100644 target/src/libc/time/strftime.c create mode 100644 target/src/libc/time/time.c create mode 100644 target/src/math/Makefile create mode 100644 target/src/math/cabs.c create mode 100644 target/src/math/cbrt.c create mode 100644 target/src/math/e_fmod.c create mode 100644 target/src/math/e_pow.c create mode 100644 target/src/math/e_remainder.c create mode 100644 target/src/math/e_sqrt.c create mode 100644 target/src/math/fdlibm.h create mode 100644 target/src/math/fpType.c create mode 100644 target/src/math/ieeefp.h create mode 100644 target/src/math/rint.c create mode 100644 target/src/math/s_rint.c create mode 100644 target/src/math/s_scalbn.c create mode 100644 target/src/netinet/Makefile create mode 100644 target/src/netinet/if.c create mode 100644 target/src/netinet/if_ether.c create mode 100644 target/src/netinet/if_subr.c create mode 100644 target/src/netinet/igmp.c create mode 100644 target/src/netinet/in.c create mode 100644 target/src/netinet/in_cksum.c create mode 100644 target/src/netinet/in_pcb.c create mode 100644 target/src/netinet/in_proto.c create mode 100644 target/src/netinet/ip_icmp.c create mode 100644 target/src/netinet/ip_input.c create mode 100644 target/src/netinet/ip_mroute.c create mode 100644 target/src/netinet/ip_output.c create mode 100644 target/src/netinet/ppp/Makefile create mode 100644 target/src/netinet/ppp/auth.c create mode 100644 target/src/netinet/ppp/chap.c create mode 100644 target/src/netinet/ppp/crypt.c create mode 100644 target/src/netinet/ppp/fsm.c create mode 100644 target/src/netinet/ppp/if_ppp.c create mode 100644 target/src/netinet/ppp/ipcp.c create mode 100644 target/src/netinet/ppp/lcp.c create mode 100644 target/src/netinet/ppp/magic.c create mode 100644 target/src/netinet/ppp/options.c create mode 100644 target/src/netinet/ppp/pppHookLib.c create mode 100644 target/src/netinet/ppp/pppLib.c create mode 100644 target/src/netinet/ppp/pppSecretLib.c create mode 100644 target/src/netinet/ppp/pppShow.c create mode 100644 target/src/netinet/ppp/ppp_md5.c create mode 100644 target/src/netinet/ppp/ppp_vxworks.c create mode 100644 target/src/netinet/ppp/random.c create mode 100644 target/src/netinet/ppp/upap.c create mode 100644 target/src/netinet/radix.c create mode 100644 target/src/netinet/raw_cb.c create mode 100644 target/src/netinet/raw_ip.c create mode 100644 target/src/netinet/raw_usrreq.c create mode 100644 target/src/netinet/route.c create mode 100644 target/src/netinet/rtsock.c create mode 100644 target/src/netinet/sl_compress.c create mode 100644 target/src/netinet/sys_socket.c create mode 100644 target/src/netinet/tcp_debug.c create mode 100644 target/src/netinet/tcp_input.c create mode 100644 target/src/netinet/tcp_output.c create mode 100644 target/src/netinet/tcp_subr.c create mode 100644 target/src/netinet/tcp_timer.c create mode 100644 target/src/netinet/tcp_usrreq.c create mode 100644 target/src/netinet/udp_usrreq.c create mode 100644 target/src/netinet/uipc_dom.c create mode 100644 target/src/netinet/uipc_mbuf.c create mode 100644 target/src/netinet/uipc_sock.c create mode 100644 target/src/netinet/uipc_sock2.c create mode 100644 target/src/netinet/unixLib.c create mode 100644 target/src/netinet/vsLib.c create mode 100644 target/src/netwrs/Makefile create mode 100644 target/src/netwrs/arpLib.c create mode 100644 target/src/netwrs/bootpLib.c create mode 100644 target/src/netwrs/bsdSockLib.c create mode 100644 target/src/netwrs/dhcpcBootLib.c create mode 100644 target/src/netwrs/dhcpcCommonLib.c create mode 100644 target/src/netwrs/dhcpcLib.c create mode 100644 target/src/netwrs/dhcpcShow.c create mode 100644 target/src/netwrs/dhcprLib.c create mode 100644 target/src/netwrs/dhcpsLib.c create mode 100644 target/src/netwrs/etherLib.c create mode 100644 target/src/netwrs/etherMultiLib.c create mode 100644 target/src/netwrs/ftpLib.c create mode 100644 target/src/netwrs/ftpdLib.c create mode 100644 target/src/netwrs/hostLib.c create mode 100644 target/src/netwrs/icmpLib.c create mode 100644 target/src/netwrs/icmpShow.c create mode 100644 target/src/netwrs/ifIndexLib.c create mode 100644 target/src/netwrs/ifLib.c create mode 100644 target/src/netwrs/igmpLib.c create mode 100644 target/src/netwrs/igmpShow.c create mode 100644 target/src/netwrs/inetLib.c create mode 100644 target/src/netwrs/ipFilterLib.c create mode 100644 target/src/netwrs/ipLib.c create mode 100644 target/src/netwrs/ipProto.c create mode 100644 target/src/netwrs/m2IcmpLib.c create mode 100644 target/src/netwrs/m2IfLib.c create mode 100644 target/src/netwrs/m2IpLib.c create mode 100644 target/src/netwrs/m2Lib.c create mode 100644 target/src/netwrs/m2SysLib.c create mode 100644 target/src/netwrs/m2TcpLib.c create mode 100644 target/src/netwrs/m2UdpLib.c create mode 100644 target/src/netwrs/mCastRouteLib.c create mode 100644 target/src/netwrs/mbufLib.c create mode 100644 target/src/netwrs/mbufSockLib.c create mode 100644 target/src/netwrs/mountLib.c create mode 100644 target/src/netwrs/muxLib.c create mode 100644 target/src/netwrs/muxTkLib.c create mode 100644 target/src/netwrs/netBufLib.c create mode 100644 target/src/netwrs/netDrv.c create mode 100644 target/src/netwrs/netLib.c create mode 100644 target/src/netwrs/netShow.c create mode 100644 target/src/netwrs/nfsDrv.c create mode 100644 target/src/netwrs/nfsHash.c create mode 100644 target/src/netwrs/nfsLib.c create mode 100644 target/src/netwrs/nfsdLib.c create mode 100644 target/src/netwrs/pingLib.c create mode 100644 target/src/netwrs/proxyArpLib.c create mode 100644 target/src/netwrs/proxyLib.c create mode 100644 target/src/netwrs/rarpLib.c create mode 100644 target/src/netwrs/rdiscLib.c create mode 100644 target/src/netwrs/remLib.c create mode 100644 target/src/netwrs/resolv/Makefile create mode 100644 target/src/netwrs/resolv/gethostnamadr.c create mode 100644 target/src/netwrs/resolv/res_comp.c create mode 100644 target/src/netwrs/resolv/res_debug.c create mode 100644 target/src/netwrs/resolv/res_mkquery.c create mode 100644 target/src/netwrs/resolv/res_query.c create mode 100644 target/src/netwrs/resolv/res_send.c create mode 100644 target/src/netwrs/resolv/resolvLib.c create mode 100644 target/src/netwrs/resolv/resolvLibDoc.c create mode 100644 target/src/netwrs/rlogLib.c create mode 100644 target/src/netwrs/routeCommonLib.c create mode 100644 target/src/netwrs/routeLib.c create mode 100644 target/src/netwrs/routeSockLib.c create mode 100644 target/src/netwrs/routeUtilLib.c create mode 100644 target/src/netwrs/rpcLib.c create mode 100644 target/src/netwrs/sntpcLib.c create mode 100644 target/src/netwrs/sntpsLib.c create mode 100644 target/src/netwrs/sockLib.c create mode 100644 target/src/netwrs/tcpLib.c create mode 100644 target/src/netwrs/tcpShow.c create mode 100644 target/src/netwrs/telnetdLib.c create mode 100644 target/src/netwrs/tftpLib.c create mode 100644 target/src/netwrs/tftpdLib.c create mode 100644 target/src/netwrs/udpLib.c create mode 100644 target/src/netwrs/udpShow.c create mode 100644 target/src/netwrs/wvNetLib.c create mode 100644 target/src/netwrs/xdr_bool_t.c create mode 100644 target/src/netwrs/xdr_nfs.c create mode 100644 target/src/netwrs/xdr_nfsserv.c create mode 100644 target/src/netwrs/zbufLib.c create mode 100644 target/src/netwrs/zbufSockLib.c create mode 100644 target/src/os/Makefile create mode 100644 target/src/os/cacheLib.c create mode 100644 target/src/os/cdromFsLib.c create mode 100644 target/src/os/classLib.c create mode 100644 target/src/os/classShow.c create mode 100644 target/src/os/clockLib.c create mode 100644 target/src/os/copyright.c create mode 100644 target/src/os/dirLib.c create mode 100644 target/src/os/dspLib.c create mode 100644 target/src/os/dspShow.c create mode 100644 target/src/os/envLib.c create mode 100644 target/src/os/errnoLib.c create mode 100644 target/src/os/excLib.c create mode 100644 target/src/os/ffsLib.c create mode 100644 target/src/os/fioLib.c create mode 100644 target/src/os/floatLib.c create mode 100644 target/src/os/fppLib.c create mode 100644 target/src/os/fppShow.c create mode 100644 target/src/os/funcBind.c create mode 100644 target/src/os/hashLib.c create mode 100644 target/src/os/intLib.c create mode 100644 target/src/os/ioLib.c create mode 100644 target/src/os/iosLib.c create mode 100644 target/src/os/iosShow.c create mode 100644 target/src/os/logLib.c create mode 100644 target/src/os/memLib.c create mode 100644 target/src/os/memPartLib.c create mode 100644 target/src/os/memShow.c create mode 100644 target/src/os/ntPassFsLib.c create mode 100644 target/src/os/objLib.c create mode 100644 target/src/os/passFsLib.c create mode 100644 target/src/os/pathLib.c create mode 100644 target/src/os/pipeDrv.c create mode 100644 target/src/os/ptyDrv.c create mode 100644 target/src/os/rebootLib.c create mode 100644 target/src/os/rt11FsLib.c create mode 100644 target/src/os/scsi1Lib.c create mode 100644 target/src/os/scsi2Lib.c create mode 100644 target/src/os/scsiCommonLib.c create mode 100644 target/src/os/scsiCtrlLib.c create mode 100644 target/src/os/scsiDirectLib.c create mode 100644 target/src/os/scsiLib.c create mode 100644 target/src/os/scsiMgrLib.c create mode 100644 target/src/os/scsiSeqLib.c create mode 100644 target/src/os/selectLib.c create mode 100644 target/src/os/sigLib.c create mode 100644 target/src/os/smLib.c create mode 100644 target/src/os/smPktLib.c create mode 100644 target/src/os/symLib.c create mode 100644 target/src/os/symShow.c create mode 100644 target/src/os/tapeFsLib.c create mode 100644 target/src/os/taskHookLib.c create mode 100644 target/src/os/taskHookShow.c create mode 100644 target/src/os/taskVarLib.c create mode 100644 target/src/os/timerLib.c create mode 100644 target/src/os/ttyDrv.c create mode 100644 target/src/os/tyLib.c create mode 100644 target/src/os/unixDrv.c create mode 100644 target/src/os/vmBaseLib.c create mode 100644 target/src/os/vmData.c create mode 100644 target/src/os/vmMpuLib.c create mode 100644 target/src/ostool/Makefile create mode 100644 target/src/ostool/bootAoutLib.c create mode 100644 target/src/ostool/bootEcoffLib.c create mode 100644 target/src/ostool/bootElfLib.c create mode 100644 target/src/ostool/bootLoadLib.c create mode 100644 target/src/ostool/bootSomCoffLib.c create mode 100644 target/src/ostool/dbgLib.c create mode 100644 target/src/ostool/dbgTaskLib.c create mode 100644 target/src/ostool/ledLib.c create mode 100644 target/src/ostool/loadAoutLib.c create mode 100644 target/src/ostool/loadCoffLib.c create mode 100644 target/src/ostool/loadEcoffComm.c create mode 100644 target/src/ostool/loadEcoffLib.c create mode 100644 target/src/ostool/loadElfLib.c create mode 100644 target/src/ostool/loadLib.c create mode 100644 target/src/ostool/loadPecoffLib.c create mode 100644 target/src/ostool/loadSomCoffLib.c create mode 100644 target/src/ostool/loginLib.c create mode 100644 target/src/ostool/moduleLib.c create mode 100644 target/src/ostool/periodHost.c create mode 100644 target/src/ostool/remShellLib.c create mode 100644 target/src/ostool/repeatHost.c create mode 100644 target/src/ostool/shell.c create mode 100644 target/src/ostool/shell.slex create mode 100644 target/src/ostool/shell.yacc create mode 100644 target/src/ostool/shellLib.c create mode 100644 target/src/ostool/shell_slex_c create mode 100644 target/src/ostool/slex create mode 100644 target/src/ostool/spyLib.c create mode 100644 target/src/ostool/timexLib.c create mode 100644 target/src/ostool/ttHostLib.c create mode 100644 target/src/ostool/unldLib.c create mode 100644 target/src/posix/Makefile create mode 100644 target/src/posix/_pthreadLib.c create mode 100644 target/src/posix/_schedPxLib.c create mode 100644 target/src/posix/aioPxLib.c create mode 100644 target/src/posix/aioPxShow.c create mode 100644 target/src/posix/aioSysDrv.c create mode 100644 target/src/posix/ftruncate.c create mode 100644 target/src/posix/ioQLib.c create mode 100644 target/src/posix/mmanPxLib.c create mode 100644 target/src/posix/mqPxLib.c create mode 100644 target/src/posix/mqPxShow.c create mode 100644 target/src/posix/mutexPxLib.c create mode 100644 target/src/posix/posixNameLib.c create mode 100644 target/src/posix/pthreadLib.c create mode 100644 target/src/posix/schedPxLib.c create mode 100644 target/src/posix/semPxLib.c create mode 100644 target/src/posix/semPxShow.c create mode 100644 target/src/posix/symTblLockLib.c create mode 100644 target/src/rip/Makefile create mode 100644 target/src/rip/af.c create mode 100644 target/src/rip/inet.c create mode 100644 target/src/rip/input.c create mode 100644 target/src/rip/m2RipLib.c create mode 100644 target/src/rip/md5.c create mode 100644 target/src/rip/output.c create mode 100644 target/src/rip/ripLib.c create mode 100644 target/src/rip/ripTimer.c create mode 100644 target/src/rip/routed_if.c create mode 100644 target/src/rip/startup.c create mode 100644 target/src/rip/tables.c create mode 100644 target/src/rpc/Makefile create mode 100644 target/src/rpc/auth_none.c create mode 100644 target/src/rpc/auth_unix.c create mode 100644 target/src/rpc/authunix_pro.c create mode 100644 target/src/rpc/clnt_generic.c create mode 100644 target/src/rpc/clnt_perror.c create mode 100644 target/src/rpc/clnt_raw.c create mode 100644 target/src/rpc/clnt_simple.c create mode 100644 target/src/rpc/clnt_tcp.c create mode 100644 target/src/rpc/clnt_udp.c create mode 100644 target/src/rpc/get_myaddr.c create mode 100644 target/src/rpc/pmap_clnt.c create mode 100644 target/src/rpc/pmap_getmaps.c create mode 100644 target/src/rpc/pmap_getport.c create mode 100644 target/src/rpc/pmap_prot.c create mode 100644 target/src/rpc/pmap_prot2.c create mode 100644 target/src/rpc/pmap_rmt.c create mode 100644 target/src/rpc/portmap.c create mode 100644 target/src/rpc/rpc_callmsg.c create mode 100644 target/src/rpc/rpc_common.c create mode 100644 target/src/rpc/rpc_prot.c create mode 100644 target/src/rpc/svc.c create mode 100644 target/src/rpc/svc_auth.c create mode 100644 target/src/rpc/svc_auth_uni.c create mode 100644 target/src/rpc/svc_raw.c create mode 100644 target/src/rpc/svc_simple.c create mode 100644 target/src/rpc/svc_tcp.c create mode 100644 target/src/rpc/svc_udp.c create mode 100644 target/src/rpc/xdr.c create mode 100644 target/src/rpc/xdr_array.c create mode 100644 target/src/rpc/xdr_float.c create mode 100644 target/src/rpc/xdr_mem.c create mode 100644 target/src/rpc/xdr_rec.c create mode 100644 target/src/rpc/xdr_ref.c create mode 100644 target/src/tffs/Makefile create mode 100644 target/src/tffs/backgrnd.c create mode 100644 target/src/tffs/dosformt.c create mode 100644 target/src/tffs/fatlite.c create mode 100644 target/src/tffs/flbase.c create mode 100644 target/src/tffs/flflash.c create mode 100644 target/src/tffs/flparse.c create mode 100644 target/src/tffs/flsocket.c create mode 100644 target/src/tffs/fltl.c create mode 100644 target/src/tffs/ftllite.c create mode 100644 target/src/tffs/reedsol.c create mode 100644 target/src/tffs/ssfdc.c create mode 100644 target/src/tffs/tffsDrv.c create mode 100644 target/src/tffs/tffsLib.c create mode 100644 target/src/tool/Makefile create mode 100644 target/src/tool/common/Makefile create mode 100644 target/src/tool/common/arm_call_via.s create mode 100644 target/src/tool/common/saverest.s create mode 100644 target/src/tool/diab/Makefile create mode 100644 target/src/tool/diab/defs.exclude create mode 100644 target/src/tool/diab/diabLibFind.tcl create mode 100644 target/src/tool/diab/libd/Makefile create mode 100644 target/src/tool/diab/libimpfp-c++/Makefile create mode 100644 target/src/tool/diab/libimpfp/Makefile create mode 100644 target/src/tool/diab/libimpl/Makefile create mode 100644 target/src/tool/diab/libstl/Makefile create mode 100644 target/src/tool/diab/libtorn/Makefile create mode 100644 target/src/tool/diab/rules.diab create mode 100644 target/src/tool/genConfig.tcl create mode 100644 target/src/tool/gnu/Makefile create mode 100644 target/src/tool/gnu/defs.exclude create mode 100644 target/src/tool/gnu/libg++/Makefile create mode 100644 target/src/tool/gnu/libg++/defs.g++ create mode 100644 target/src/tool/gnu/libgcc/Makefile create mode 100644 target/src/tool/gnu/libstdc++/Makefile create mode 100644 target/src/tool/gnu/rules.gnu create mode 100644 target/src/tool/objsExclude.tcl create mode 100644 target/src/tool/rules.tool create mode 100644 target/src/usb/Makefile create mode 100644 target/src/usb/ossLib.c create mode 100644 target/src/usb/tools/Makefile create mode 100644 target/src/usb/tools/cmdParser.c create mode 100644 target/src/usb/usbDescrCopyLib.c create mode 100644 target/src/usb/usbHandleLib.c create mode 100644 target/src/usb/usbHcdLib.c create mode 100644 target/src/usb/usbLib.c create mode 100644 target/src/usb/usbListLib.c create mode 100644 target/src/usb/usbQueueLib.c create mode 100644 target/src/usb/usbdCoreLib.c create mode 100644 target/src/usb/usbdLib.c create mode 100644 target/src/usr/Makefile create mode 100644 target/src/usr/devSplit.c create mode 100644 target/src/usr/ramDiskCbio.c create mode 100644 target/src/usr/tarLib.c create mode 100644 target/src/usr/usrDosFsOld.c create mode 100644 target/src/usr/usrFdiskPartLib.c create mode 100644 target/src/usr/usrFsLib.c create mode 100644 target/src/util/Makefile create mode 100644 target/src/util/bLib.c create mode 100644 target/src/util/bootLib.c create mode 100644 target/src/util/bufLib.c create mode 100644 target/src/util/cksumLib.c create mode 100644 target/src/util/dllLib.c create mode 100644 target/src/util/inflateLib.c create mode 100644 target/src/util/lstLib.c create mode 100644 target/src/util/qFifoLib.c create mode 100644 target/src/util/qJobLib.c create mode 100644 target/src/util/qLib.c create mode 100644 target/src/util/qPriBMapLib.c create mode 100644 target/src/util/qPriDeltaLib.c create mode 100644 target/src/util/qPriHeapLib.c create mode 100644 target/src/util/qPriListLib.c create mode 100644 target/src/util/rBuffLib.c create mode 100644 target/src/util/rBuffShow.c create mode 100644 target/src/util/rngLib.c create mode 100644 target/src/util/sllLib.c create mode 100644 target/src/util/smUtilLib.c create mode 100644 target/src/util/uncompress.c create mode 100644 target/src/vxcom/Makefile create mode 100644 target/src/vxcom/com/FileRegistry.cpp create mode 100644 target/src/vxcom/com/Makefile create mode 100644 target/src/vxcom/com/MemoryStream.cpp create mode 100644 target/src/vxcom/com/MemoryStream.h create mode 100644 target/src/vxcom/com/TaskAllocator.cpp create mode 100644 target/src/vxcom/com/TaskAllocator.h create mode 100644 target/src/vxcom/com/comLib.cpp create mode 100644 target/src/vxcom/com/comMisc.cpp create mode 100644 target/src/vxcom/com/comShow.cpp create mode 100644 target/src/vxcom/comcore/Makefile create mode 100644 target/src/vxcom/comcore/comCoreLib.c create mode 100644 target/src/vxcom/comcore/comRegistry.c create mode 100644 target/src/vxcom/h/comBase.h create mode 100644 target/src/vxcom/h/comCoreLib.h create mode 100644 target/src/vxcom/h/comErr.h create mode 100644 target/src/vxcom/h/comLib.h create mode 100644 target/src/vxcom/h/comObjLib.h create mode 100644 target/src/vxcom/h/comObjLibExt.h create mode 100644 target/src/vxcom/h/comShow.h create mode 100644 target/src/vxcom/h/make/rules.library.common create mode 100644 target/src/vxcom/h/make/rules.library.t2 create mode 100644 target/src/vxcom/h/make/rules.library.unix create mode 100644 target/src/vxcom/h/make/rules.library.vxWorks create mode 100644 target/src/vxcom/h/make/unix-defs.vxcom create mode 100644 target/src/vxcom/h/private/DebugHooks.h create mode 100644 target/src/vxcom/h/private/comMisc.h create mode 100644 target/src/vxcom/h/private/comRegistry.h create mode 100644 target/src/vxcom/h/private/comStl.h create mode 100644 target/src/vxcom/h/private/comSysLib.h create mode 100644 target/src/vxcom/idl/ConnectionPoint.idl create mode 100644 target/src/vxcom/idl/Makefile create mode 100644 target/src/vxcom/idl/comAutomation.idl create mode 100644 target/src/vxcom/idl/comCoreTypes.idl create mode 100644 target/src/vxcom/idl/vxStream.idl create mode 100644 target/src/vxcom/idl/vxidl.idl create mode 100644 target/src/vxcom/os/Makefile create mode 100644 target/src/vxcom/os/VxWorks/comVxWorksSupport.c create mode 100644 target/src/vxcom/os/comSysLib.c create mode 100644 target/src/vxcom/os/comSysNtp.c create mode 100644 target/src/vxcom/os/generic/comGuidLib.c create mode 100644 target/src/vxcom/os/generic/comTrackLib.c create mode 100644 target/src/vxcom/veloce-hack/ConnectionPoint.h create mode 100644 target/src/vxcom/veloce-hack/ConnectionPoint_i.c create mode 100644 target/src/vxcom/veloce-hack/ConnectionPoint_ps.cpp create mode 100644 target/src/vxcom/veloce-hack/Makefile create mode 100644 target/src/vxcom/veloce-hack/OxidResolver.h create mode 100644 target/src/vxcom/veloce-hack/OxidResolver_i.c create mode 100644 target/src/vxcom/veloce-hack/OxidResolver_ps.cpp create mode 100644 target/src/vxcom/veloce-hack/RemUnknown.h create mode 100644 target/src/vxcom/veloce-hack/RemUnknown_i.c create mode 100644 target/src/vxcom/veloce-hack/RemUnknown_ps.cpp create mode 100644 target/src/vxcom/veloce-hack/RemoteActivation.h create mode 100644 target/src/vxcom/veloce-hack/RemoteActivation_i.c create mode 100644 target/src/vxcom/veloce-hack/RemoteActivation_ps.cpp create mode 100644 target/src/vxcom/veloce-hack/comAutomation.h create mode 100644 target/src/vxcom/veloce-hack/comAutomation_i.c create mode 100644 target/src/vxcom/veloce-hack/comAutomation_ps.cpp create mode 100644 target/src/vxcom/veloce-hack/comCoreTypes.h create mode 100644 target/src/vxcom/veloce-hack/comCoreTypes_i.c create mode 100644 target/src/vxcom/veloce-hack/comCoreTypes_ps.cpp create mode 100644 target/src/vxcom/veloce-hack/opc_ae.h create mode 100644 target/src/vxcom/veloce-hack/opc_ae_i.c create mode 100644 target/src/vxcom/veloce-hack/opc_ae_ps.cpp create mode 100644 target/src/vxcom/veloce-hack/opccomn.h create mode 100644 target/src/vxcom/veloce-hack/opccomn_i.c create mode 100644 target/src/vxcom/veloce-hack/opccomn_ps.cpp create mode 100644 target/src/vxcom/veloce-hack/opcda.h create mode 100644 target/src/vxcom/veloce-hack/opcda_i.c create mode 100644 target/src/vxcom/veloce-hack/opcda_ps.cpp create mode 100644 target/src/vxcom/veloce-hack/orpc.h create mode 100644 target/src/vxcom/veloce-hack/orpc_i.c create mode 100644 target/src/vxcom/veloce-hack/orpc_ps.cpp create mode 100644 target/src/vxcom/veloce-hack/rpcDceProto.h create mode 100644 target/src/vxcom/veloce-hack/rpcDceProto_i.c create mode 100644 target/src/vxcom/veloce-hack/vxStream.h create mode 100644 target/src/vxcom/veloce-hack/vxStream_i.c create mode 100644 target/src/vxcom/veloce-hack/vxStream_ps.cpp create mode 100644 target/src/vxcom/veloce-hack/vxidl.h create mode 100644 target/src/vxcom/veloce-hack/vxidl_i.c create mode 100644 target/src/vxcom/veloce-hack/vxidl_ps.cpp create mode 100644 target/src/vxdcom/Makefile create mode 100644 target/src/vxdcom/dcom/ClassFactory_ps.cpp create mode 100644 target/src/vxdcom/dcom/DceDispatchTable.cpp create mode 100644 target/src/vxdcom/dcom/DceDispatchTable.h create mode 100644 target/src/vxdcom/dcom/InterfaceProxy.cpp create mode 100644 target/src/vxdcom/dcom/InterfaceProxy.h create mode 100644 target/src/vxdcom/dcom/Makefile create mode 100644 target/src/vxdcom/dcom/NdrStreams.cpp create mode 100644 target/src/vxdcom/dcom/NdrStreams.h create mode 100644 target/src/vxdcom/dcom/NdrTypes.cpp create mode 100644 target/src/vxdcom/dcom/NdrTypes.h create mode 100644 target/src/vxdcom/dcom/ObjectExporter.cpp create mode 100644 target/src/vxdcom/dcom/ObjectExporter.h create mode 100644 target/src/vxdcom/dcom/ObjectTable.cpp create mode 100644 target/src/vxdcom/dcom/ObjectTable.h create mode 100644 target/src/vxdcom/dcom/PSFactory.cpp create mode 100644 target/src/vxdcom/dcom/PSFactory.h create mode 100644 target/src/vxdcom/dcom/RemoteOxid.cpp create mode 100644 target/src/vxdcom/dcom/RemoteOxid.h create mode 100644 target/src/vxdcom/dcom/RemoteRegistry.cpp create mode 100644 target/src/vxdcom/dcom/RemoteRegistry.h create mode 100644 target/src/vxdcom/dcom/RemoteSCM.cpp create mode 100644 target/src/vxdcom/dcom/RemoteSCM.h create mode 100644 target/src/vxdcom/dcom/SCM.cpp create mode 100644 target/src/vxdcom/dcom/SCM.h create mode 100644 target/src/vxdcom/dcom/StdMarshaler.cpp create mode 100644 target/src/vxdcom/dcom/StdMarshaler.h create mode 100644 target/src/vxdcom/dcom/StdProxy.cpp create mode 100644 target/src/vxdcom/dcom/StdProxy.h create mode 100644 target/src/vxdcom/dcom/StdStub.cpp create mode 100644 target/src/vxdcom/dcom/StdStub.h create mode 100644 target/src/vxdcom/dcom/Stublet.cpp create mode 100644 target/src/vxdcom/dcom/Stublet.h create mode 100644 target/src/vxdcom/dcom/dcomLib.cpp create mode 100644 target/src/vxdcom/dcom/dcomShow.cpp create mode 100644 target/src/vxdcom/dcom/ntlmssp.cpp create mode 100644 target/src/vxdcom/dcom/ntlmssp.h create mode 100644 target/src/vxdcom/dcom/orpcLib.cpp create mode 100644 target/src/vxdcom/dcom/orpcLib.h create mode 100644 target/src/vxdcom/dcom/vxdcomExtent.cpp create mode 100644 target/src/vxdcom/dcom/vxdcomExtent.h create mode 100644 target/src/vxdcom/dcom/vxdcomGlobals.cpp create mode 100644 target/src/vxdcom/h/comInit.h create mode 100644 target/src/vxdcom/h/dcomExtent.h create mode 100644 target/src/vxdcom/h/dcomLib.h create mode 100644 target/src/vxdcom/h/dcomProxy.h create mode 100644 target/src/vxdcom/h/make/rules.library.t2 create mode 100644 target/src/vxdcom/h/make/rules.library.unix create mode 100644 target/src/vxdcom/h/private/vxdcomGlobals.h create mode 100644 target/src/vxdcom/idl/Makefile create mode 100644 target/src/vxdcom/idl/OxidResolver.idl create mode 100644 target/src/vxdcom/idl/RemUnknown.idl create mode 100644 target/src/vxdcom/idl/RemoteActivation.idl create mode 100644 target/src/vxdcom/idl/opc_ae.idl create mode 100644 target/src/vxdcom/idl/opccomn.idl create mode 100644 target/src/vxdcom/idl/opcda.idl create mode 100644 target/src/vxdcom/idl/orpc.idl create mode 100644 target/src/vxdcom/idl/rpcDceProto.idl create mode 100644 target/src/vxdcom/reactor/Acceptor.h create mode 100644 target/src/vxdcom/reactor/Acceptor.tcc create mode 100644 target/src/vxdcom/reactor/Connector.h create mode 100644 target/src/vxdcom/reactor/Connector.tcc create mode 100644 target/src/vxdcom/reactor/EventHandler.cpp create mode 100644 target/src/vxdcom/reactor/EventHandler.h create mode 100644 target/src/vxdcom/reactor/HandleSet.cpp create mode 100644 target/src/vxdcom/reactor/HandleSet.h create mode 100644 target/src/vxdcom/reactor/INETSockAddr.cpp create mode 100644 target/src/vxdcom/reactor/INETSockAddr.h create mode 100644 target/src/vxdcom/reactor/Makefile create mode 100644 target/src/vxdcom/reactor/Reactor.cpp create mode 100644 target/src/vxdcom/reactor/Reactor.h create mode 100644 target/src/vxdcom/reactor/ReactorHandle.cpp create mode 100644 target/src/vxdcom/reactor/ReactorHandle.h create mode 100644 target/src/vxdcom/reactor/ReactorTypes.h create mode 100644 target/src/vxdcom/reactor/SockAcceptor.cpp create mode 100644 target/src/vxdcom/reactor/SockAcceptor.h create mode 100644 target/src/vxdcom/reactor/SockAddr.cpp create mode 100644 target/src/vxdcom/reactor/SockAddr.h create mode 100644 target/src/vxdcom/reactor/SockConnector.cpp create mode 100644 target/src/vxdcom/reactor/SockConnector.h create mode 100644 target/src/vxdcom/reactor/SockEP.cpp create mode 100644 target/src/vxdcom/reactor/SockEP.h create mode 100644 target/src/vxdcom/reactor/SockIO.cpp create mode 100644 target/src/vxdcom/reactor/SockIO.h create mode 100644 target/src/vxdcom/reactor/SockStream.cpp create mode 100644 target/src/vxdcom/reactor/SockStream.h create mode 100644 target/src/vxdcom/reactor/SvcHandler.h create mode 100644 target/src/vxdcom/reactor/SvcHandler.tcc create mode 100644 target/src/vxdcom/reactor/TaskQueue.h create mode 100644 target/src/vxdcom/reactor/TaskQueue.tcc create mode 100644 target/src/vxdcom/reactor/ThreadPool.cpp create mode 100644 target/src/vxdcom/reactor/ThreadPool.h create mode 100644 target/src/vxdcom/reactor/TimeValue.cpp create mode 100644 target/src/vxdcom/reactor/TimeValue.h create mode 100644 target/src/vxdcom/rpc/Makefile create mode 100644 target/src/vxdcom/rpc/RpcDispatchTable.h create mode 100644 target/src/vxdcom/rpc/RpcDispatcher.cpp create mode 100644 target/src/vxdcom/rpc/RpcDispatcher.h create mode 100644 target/src/vxdcom/rpc/RpcEventHandler.cpp create mode 100644 target/src/vxdcom/rpc/RpcEventHandler.h create mode 100644 target/src/vxdcom/rpc/RpcIfClient.cpp create mode 100644 target/src/vxdcom/rpc/RpcIfClient.h create mode 100644 target/src/vxdcom/rpc/RpcIfServer.cpp create mode 100644 target/src/vxdcom/rpc/RpcIfServer.h create mode 100644 target/src/vxdcom/rpc/RpcPdu.cpp create mode 100644 target/src/vxdcom/rpc/RpcPdu.h create mode 100644 target/src/vxdcom/rpc/RpcPduFactory.cpp create mode 100644 target/src/vxdcom/rpc/RpcPduFactory.h create mode 100644 target/src/vxdcom/rpc/RpcProxyMsg.cpp create mode 100644 target/src/vxdcom/rpc/RpcProxyMsg.h create mode 100644 target/src/vxdcom/rpc/RpcStringBinding.cpp create mode 100644 target/src/vxdcom/rpc/RpcStringBinding.h create mode 100644 target/src/vxfusion/Makefile create mode 100644 target/src/vxfusion/drv/Makefile create mode 100644 target/src/vxfusion/drv/distIfLib.c create mode 100644 target/src/vxfusion/drv/distIfShow.c create mode 100644 target/src/vxfusion/os/Makefile create mode 100644 target/src/vxfusion/os/distNameLib.c create mode 100644 target/src/vxfusion/os/distNameShow.c create mode 100644 target/src/vxfusion/os/distObjLib.c create mode 100644 target/src/vxfusion/os/distStatLib.c create mode 100644 target/src/vxfusion/wind/Makefile create mode 100644 target/src/vxfusion/wind/distGapLib.c create mode 100644 target/src/vxfusion/wind/distIncoLib.c create mode 100644 target/src/vxfusion/wind/distLib.c create mode 100644 target/src/vxfusion/wind/distNetLib.c create mode 100644 target/src/vxfusion/wind/distNodeLib.c create mode 100644 target/src/vxfusion/wind/distTBufLib.c create mode 100644 target/src/vxfusion/wind/msgQDistGrpLib.c create mode 100644 target/src/vxfusion/wind/msgQDistGrpShow.c create mode 100644 target/src/vxfusion/wind/msgQDistLib.c create mode 100644 target/src/vxfusion/wind/msgQDistShow.c create mode 100644 target/src/vxmp/Makefile create mode 100644 target/src/vxmp/os/Makefile create mode 100644 target/src/vxmp/os/smFixBlkLib.c create mode 100644 target/src/vxmp/os/smFixBlkShow.c create mode 100644 target/src/vxmp/os/smMemLib.c create mode 100644 target/src/vxmp/os/smMemShow.c create mode 100644 target/src/vxmp/os/smNameLib.c create mode 100644 target/src/vxmp/os/smNameShow.c create mode 100644 target/src/vxmp/os/smObjLib.c create mode 100644 target/src/vxmp/os/smObjShow.c create mode 100644 target/src/vxmp/util/Makefile create mode 100644 target/src/vxmp/util/qFifoGLib.c create mode 100644 target/src/vxmp/util/smDllLib.c create mode 100644 target/src/vxmp/wind/Makefile create mode 100644 target/src/vxmp/wind/msgQSmLib.c create mode 100644 target/src/vxmp/wind/msgQSmShow.c create mode 100644 target/src/vxmp/wind/semSmLib.c create mode 100644 target/src/vxmp/wind/semSmShow.c create mode 100644 target/src/vxvmi/Makefile create mode 100644 target/src/vxvmi/vmLib.c create mode 100644 target/src/vxvmi/vmShow.c create mode 100644 target/src/wdb/Makefile create mode 100644 target/src/wdb/wdbAltivecLib.c create mode 100644 target/src/wdb/wdbBpLib.c create mode 100644 target/src/wdb/wdbCallLib.c create mode 100644 target/src/wdb/wdbCnctLib.c create mode 100644 target/src/wdb/wdbCtxExitLib.c create mode 100644 target/src/wdb/wdbCtxLib.c create mode 100644 target/src/wdb/wdbCtxStartLib.c create mode 100644 target/src/wdb/wdbDbgLib.c create mode 100644 target/src/wdb/wdbDirectCallLib.c create mode 100644 target/src/wdb/wdbDspLib.c create mode 100644 target/src/wdb/wdbEvtLib.c create mode 100644 target/src/wdb/wdbEvtptLib.c create mode 100644 target/src/wdb/wdbExcLib.c create mode 100644 target/src/wdb/wdbFpLib.c create mode 100644 target/src/wdb/wdbFuncBind.c create mode 100644 target/src/wdb/wdbGopherLib.c create mode 100644 target/src/wdb/wdbLib.c create mode 100644 target/src/wdb/wdbMemCoreLib.c create mode 100644 target/src/wdb/wdbMemLib.c create mode 100644 target/src/wdb/wdbRegLib.c create mode 100644 target/src/wdb/wdbRpcLib.c create mode 100644 target/src/wdb/wdbSioTestLib.c create mode 100644 target/src/wdb/wdbSvcLib.c create mode 100644 target/src/wdb/wdbTaskBpLib.c create mode 100644 target/src/wdb/wdbTyCoDrv.c create mode 100644 target/src/wdb/wdbUdpLib.c create mode 100644 target/src/wdb/wdbUdpSockLib.c create mode 100644 target/src/wdb/wdbUserEvtLib.c create mode 100644 target/src/wdb/wdbVioLib.c create mode 100644 target/src/wdb/xdr/Makefile create mode 100644 target/src/wdb/xdr/ctx.c create mode 100644 target/src/wdb/xdr/ctxcreat.c create mode 100644 target/src/wdb/xdr/ctxstep.c create mode 100644 target/src/wdb/xdr/evtdata.c create mode 100644 target/src/wdb/xdr/evtpoint.c create mode 100644 target/src/wdb/xdr/memory.c create mode 100644 target/src/wdb/xdr/regs.c create mode 100644 target/src/wdb/xdr/rpccksum.c create mode 100644 target/src/wdb/xdr/tgtinfo.c create mode 100644 target/src/wdb/xdr/wrapper.c create mode 100644 target/src/wdb/xdr/xdrcore.c create mode 100644 target/src/wind/Makefile create mode 100644 target/src/wind/eventLib.c create mode 100644 target/src/wind/eventShow.c create mode 100644 target/src/wind/kernelLib.c create mode 100644 target/src/wind/msgQEvLib.c create mode 100644 target/src/wind/msgQLib.c create mode 100644 target/src/wind/msgQShow.c create mode 100644 target/src/wind/schedLib.c create mode 100644 target/src/wind/semBLib.c create mode 100644 target/src/wind/semCLib.c create mode 100644 target/src/wind/semEvLib.c create mode 100644 target/src/wind/semLib.c create mode 100644 target/src/wind/semMLib.c create mode 100644 target/src/wind/semOLib.c create mode 100644 target/src/wind/semShow.c create mode 100644 target/src/wind/taskInfo.c create mode 100644 target/src/wind/taskLib.c create mode 100644 target/src/wind/taskShow.c create mode 100644 target/src/wind/tickLib.c create mode 100644 target/src/wind/wdLib.c create mode 100644 target/src/wind/wdShow.c create mode 100644 target/src/wind/windLib.c create mode 100644 target/src/wind/workQLib.c create mode 100644 target/src/wrn/Makefile create mode 100644 target/src/wrn/util/Makefile create mode 100644 target/src/wrn/util/avlLib.c create mode 100644 target/src/wtx/Makefile create mode 100644 target/src/wtx/regcomp.c create mode 100644 target/src/wtx/regcore.c create mode 100644 target/src/wtx/regerror.c create mode 100644 target/src/wtx/regexec.c create mode 100644 target/src/wtx/regfree.c create mode 100644 target/src/wtx/symSyncLib.c create mode 100644 target/src/wtx/wtx.c create mode 100644 target/src/wtx/wtxexch.c create mode 100644 target/src/wtx/wtxrpc.c create mode 100644 target/src/wtx/xdrwtx.c create mode 100644 target/src/wv/Makefile create mode 100644 target/src/wv/classLib.c create mode 100644 target/src/wv/memLib.c create mode 100644 target/src/wv/memPartLib.c create mode 100644 target/src/wv/msgQLib.c create mode 100644 target/src/wv/msgQShow.c create mode 100644 target/src/wv/objLib.c create mode 100644 target/src/wv/qJobLib.c create mode 100644 target/src/wv/schedLib.c create mode 100644 target/src/wv/semBLib.c create mode 100644 target/src/wv/semCLib.c create mode 100644 target/src/wv/semLib.c create mode 100644 target/src/wv/semMLib.c create mode 100644 target/src/wv/semShow.c create mode 100644 target/src/wv/sigLib.c create mode 100644 target/src/wv/taskLib.c create mode 100644 target/src/wv/taskShow.c create mode 100644 target/src/wv/tickLib.c create mode 100644 target/src/wv/wdLib.c create mode 100644 target/src/wv/wdShow.c create mode 100644 target/src/wv/windLib.c create mode 100644 target/src/wv/workQLib.c diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..63b4b68 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) [year] [fullname] + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..07f026b --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# vxWorks 完整æºç ä¸‹è½½ + +## 资æºä»‹ç» + +本仓库æä¾›äº†ä¸€ä»½å®Œæ•´çš„ vxWorks æºç ï¼ŒåŒ…括 `src`ã€`lib`ã€`h` 等文件,内容éžå¸¸å…¨é¢ã€‚这份æºç æ˜¯æˆ‘è´¹å°½å¿ƒæ€æ‰æ”¶é›†åˆ°çš„,希望能够帮助大家更好地学习和ç†è§£ vxWorks æ“作系统。 + +## 资æºå†…容 + +- **src**: vxWorks 的核心æºä»£ç ï¼Œæ¶µç›–了æ“作系统的å„个模å—。 +- **lib**: ç›¸å…³çš„åº“æ–‡ä»¶ï¼Œæ”¯æŒæºç çš„编译和è¿è¡Œã€‚ +- **h**: 头文件,包å«äº†å„ç§æŽ¥å£å’Œå®šä¹‰ï¼Œæ–¹ä¾¿å¼€å‘者进行二次开å‘。 + +## 适用人群 + +这份æºç é€‚åˆä»¥ä¸‹äººç¾¤ä½¿ç”¨ï¼š + +- **vxWorks åˆå­¦è€…**: å¯ä»¥é€šè¿‡é˜…读æºç ï¼Œæ·±å…¥äº†è§£ vxWorks 的内部机制。 +- **vxWorks å¼€å‘者**: å¯ä»¥ä½œä¸ºç¼–程å‚考,帮助解决开å‘过程中é‡åˆ°çš„问题。 +- **æ“作系统研究者**: å¯ä»¥ç”¨äºŽç ”究实时æ“作系统的实现原ç†ã€‚ + +## 使用建议 + +1. **环境准备**: 在开始学习或开å‘之å‰ï¼Œè¯·ç¡®ä¿ä½ å·²ç»æ­å»ºå¥½äº† vxWorks 的开å‘环境。 +2. **逿­¥å­¦ä¹ **: 建议从简å•的模å—å¼€å§‹ï¼Œé€æ­¥æ·±å…¥ï¼Œé¿å…䏀开始就陷入夿‚的代ç ä¸­ã€‚ +3. **ä»£ç æ³¨é‡Š**: 在阅读æºç æ—¶ï¼Œå¯ä»¥ç»“åˆå®˜æ–¹æ–‡æ¡£è¿›è¡Œç†è§£ï¼Œå¹¶é€‚当添加注释,方便åŽç»­å›žé¡¾ã€‚ + +## 注æ„事项 + +- 本资æºä»…供学习和研究使用,请勿用于商业用途。 +- 由于æºç è¾ƒä¸ºå¤æ‚,建议有一定编程基础的用户使用。 + +希望这份 vxWorks æºç èƒ½å¤Ÿå¯¹ä½ çš„å­¦ä¹ å’Œç ”ç©¶æœ‰æ‰€å¸®åŠ©ï¼ \ No newline at end of file diff --git a/h/CAN/canBoard.h b/h/CAN/canBoard.h new file mode 100644 index 0000000..660bb22 --- /dev/null +++ b/h/CAN/canBoard.h @@ -0,0 +1,103 @@ +/* canBoard.h - CAN board definitions for Wind River CAN Common Interface */ + +/* Copyright 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +08apr04,lsg added support for ColdFire 5282 FlexCAN +26feb04,bjn Added MPC5200 support +09nov01,dnb modified for integration into Tornado +12jul01,jac written + +*/ + +/* + +DESCRIPTION +This file contains CAN board definitions for the +CAN Common Interface. + +*/ + +#ifndef CAN_BOARD_H_ +#define CAN_BOARD_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* forward reference these datatypes */ +typedef UINT WNCAN_BoardType; +struct WNCAN_Device; + + +typedef enum +{ + _16MHZ = 16000000, + _20MHZ = 20000000, + _25MHZ = 25000000, + _33MHZ = 33000000, + _39MHZ = 39000000, + _40MHZ = 40000000, + _56MHZ = 56000000 +} XtalFreq; + + +/* Datatypes used for board's linked list */ +typedef STATUS (*pfn_Board_EstabLnks_Type)(struct WNCAN_Device*); +typedef STATUS (*pfn_Board_Close_Type)(struct WNCAN_Device*); +typedef struct WNCAN_Device* (*pfn_Board_Open_Type)(UINT, UINT); +typedef void (*pfn_Board_Show_Type)(void); + + +/* The CAN_BoardType lists the available CAN boards or modules */ +#define WNCAN_NO_BOARD_ASSIGNED 0 +#define WNCAN_ESD_PC104_200 1 +#define WNCAN_ESD_PCI_200 2 +#define WNCAN_MSMCAN 3 +#define WNCAN_PPC5XX 4 +#define WNCAN_ADLINK_7841 5 +#define WNCAN_DAYTONA 6 +#define WNCAN_SHTAHOEAMANDA 7 +#define WNCAN_SHBISCAYNE 8 +#define WNCAN_MPC5200 9 +#define WNCAN_MCF5282 10 + +struct WNCAN_Board +{ + void (*onEnterISR)(struct WNCAN_Device *); + void (*onLeaveISR)(struct WNCAN_Device *); + UCHAR (*canInByte)(struct WNCAN_Device *, unsigned int); + void (*canOutByte)(struct WNCAN_Device *, unsigned int, UCHAR); + void (*enableIrq)(struct WNCAN_Device *); + void (*disableIrq)(struct WNCAN_Device *); + + WNCAN_BoardType brdType; + UINT irq; + ULONG ioAddress; + UINT32 bar0; + UINT32 bar1; + UINT32 bar2; + XtalFreq xtalFreq; +}; + +/* function prototypes */ +STATUS WNCAN_Board_establishLinks(struct WNCAN_Device *, WNCAN_BoardType); +struct WNCAN_Device *WNCAN_Board_Open(UINT,UINT,UINT); +void WNCAN_Board_Close(struct WNCAN_Device *); +ULONG stringToUlong(const char *pStr); + + +/* define access macros for use with the board's linked list */ +#define BOARDLL_INIT() FLL_Create(&g_BoardLLRoot) +#define BOARDLL_ADD(n) FLL_Add(&g_BoardLLRoot, n) +#define BOARDLL_GET(key) ((BoardLLNode*)FLL_Find(&g_BoardLLRoot, key)) +#define BOARDLL_FIRST() ((BoardLLNode*)FLL_FirstNode(&g_BoardLLRoot)) +#define BOARDLL_NEXT(n) ((BoardLLNode*)FLL_NextNode(n)) + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* CAN_BOARD_H_ */ diff --git a/h/CAN/canController.h b/h/CAN/canController.h new file mode 100644 index 0000000..baa28ca --- /dev/null +++ b/h/CAN/canController.h @@ -0,0 +1,80 @@ +/* canController.h - CAN controller definitions for Wind River CAN Common Interface */ + +/* Copyright 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +08apr04,lsg added FlexCAN related macros +26feb04,bjn Added MPC5200 support +26dec01,lsg added TOUCAN (PPC5xx) related macros +09nov01,dnb modified for integration into Tornado +12jul01,jac written + +*/ + +/* + +DESCRIPTION +This file contains CAN controller definitions for the +CAN Common Interface. + +*/ + +#ifndef CAN_CONTROLLER_H_ +#define CAN_CONTROLLER_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +struct WNCAN_Device; +typedef UINT WNCAN_ControllerType; + +/* Datatypes used for controller's linked list */ +typedef void (*pfn_Ctrlr_EstabLnks_Type)(struct WNCAN_Device *pDev); + + +/* The CAN_ControllerType lists the available controllers */ +#define WNCAN_I82527 1 +#define WNCAN_SJA1000 2 +#define WNCAN_TOUCAN 3 +#define WNCAN_MCP2510 4 +#define WNCAN_HCAN2 5 +#define WNCAN_MOTMSCAN 6 +#define WNCAN_FLEXCAN 7 + +struct WNCAN_Controller +{ + WNCAN_ControllerType ctrlType; /* type of controller */ + UCHAR ctrlID; /* handle identifier of this controller */ + UCHAR brp; + UCHAR sjw; + UCHAR tseg1; + UCHAR tseg2; + UCHAR samples; + struct WNCAN_Device *pDev; /* pointer to parent CAN_Device structure */ + const UINT *chnType; /* number of ways a message buffer can be configured */ + UINT *chnMode; /* current way a message buffer is configured */ + UCHAR numChn; /* number of available channels */ + void *csData; /* pointer to chip-specific data */ +}; + + +/* function prototypes */ +STATUS WNCAN_Controller_establishLinks(struct WNCAN_Device *pDev, + WNCAN_ControllerType ctrlType); + + +/* define access macros for use with the controller's linked list */ +#define CONTROLLERLL_INIT() FLL_Create(&g_ControllerLLRoot) +#define CONTROLLERLL_ADD(n) FLL_Add(&g_ControllerLLRoot, n) +#define CONTROLLERLL_GET(key) ((ControllerLLNode*)FLL_Find(&g_ControllerLLRoot, key)) +#define CONTROLLERLL_FIRST() ((ControllerLLNode*)FLL_FirstNode(&g_ControllerLLRoot)) +#define CONTROLLERLL_NEXT(n) ((ControllerLLNode*)FLL_NextNode(n)) + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* CAN_CONTROLLER_H_ */ diff --git a/h/CAN/canFixedLL.h b/h/CAN/canFixedLL.h new file mode 100644 index 0000000..0eea922 --- /dev/null +++ b/h/CAN/canFixedLL.h @@ -0,0 +1,104 @@ +/* canFixedLL.h - WN-CAN fixed-node linked lists */ + +/* Copyright 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +07nov02,rgp written + +*/ + +/* + +DESCRIPTION +The file defines the fixed-node linked lists. A fixed-object linked list is +a normal linked list, except that each node in the linked is statically allocated. +Therefore, this list does not use any dynamic memory. + +As a result, there may only be limited use of the linked lists. + +In addition, since we want to use common code with what essentially +amounts to sub-classes of the nodes (i.e. specific data for each +separate linked list), define all data within this header file. + +*/ + +#ifndef CAN_FIXEDLL_H_ +#define CAN_FIXEDLL_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "CAN/wnCAN.h" +#include "CAN/canBoard.h" +#include "CAN/canController.h" + +/* Define Common Fixed-Node Data Structure */ +typedef struct _fll_node +{ + struct _fll_node *pNext; /* next node ptr */ + int key; /* identifying key value for each node */ + + /* define union for all uses of our linked list. This is effectively + ** our sub-classing of the data structure + **/ + union + { + /* board's linked list data */ + struct + { + pfn_Board_EstabLnks_Type establinks_fn; /* establishlinks function */ + pfn_Board_Open_Type open_fn; /* open function */ + pfn_Board_Close_Type close_fn; /* close function */ + pfn_Board_Show_Type show_fn; /* show function */ + } boarddata; + + /* controller's linked list data */ + struct { + pfn_Ctrlr_EstabLnks_Type establinks_fn; /* establishlinks function */ + } controllerdata; + + } nodedata; + +} FLL_NodeType; + + +/* define types for each of the supported lists */ +typedef FLL_NodeType BoardLLNode; +typedef FLL_NodeType ControllerLLNode; + + +/* define struct for an instance of the linked-list */ +typedef struct _fll_instance +{ + FLL_NodeType *pFirst; +} FLL_RootType; + + + +/* Linked List APIs */ +void FLL_Create(FLL_RootType*); +void FLL_Add(FLL_RootType*, FLL_NodeType*); +FLL_NodeType *FLL_Find(FLL_RootType*, int key); + +#define FLL_FirstNode(rootptr) ( (rootptr) ? (rootptr)->pFirst : NULL ) +#define FLL_NextNode(nodeptr) ( (nodeptr) ? (nodeptr)->pNext : NULL ) + +/***************************************************************************/ +/***************************************************************************/ +/***************************************************************************/ +/* due do the recursive includes of canboard,cancontroller and this file, +** need to declare the extern'd global variables here becase the root type +** is now fully resolved. +*/ +extern FLL_RootType g_BoardLLRoot; +extern FLL_RootType g_ControllerLLRoot; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* CAN_FIXEDLL_H_ */ diff --git a/h/CAN/flexcan.h b/h/CAN/flexcan.h new file mode 100644 index 0000000..022c341 --- /dev/null +++ b/h/CAN/flexcan.h @@ -0,0 +1,218 @@ +/* flexcan.h - definitions for Flexcan on-chip controller for Windnet CAN Interface */ + +/* Copyright 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,20may05,lsg Added workaround for chip bug for incorrect 32 bit accesses + of FlexCAN registers. This affects Filter register setting +01b,08apr04,lsg modified to support WindNet CAN 1.3 +01a,24sep03,eli support for MCF5282 (ColdFire) FlexCAN module + +*/ + +/* + + DESCRIPTION + This file contains the declarations and definitions that comprise the + register definitions and other macros for use with Windnet CAN Interface. + +*/ + +#ifndef _FLEXCAN_H_ +#define _FLEXCAN_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* Internal Memory Map Assignments + * + * This is the internal message sructure as used by the + * CAN device driver source code. The user never uses this structure + */ + +typedef struct _flexcanChannel_ { + volatile unsigned short Control; + volatile unsigned short Id; + volatile unsigned short Id2_OR_TimeStamp; + volatile unsigned char Data[8]; + volatile unsigned short No_use; + +} FlexCAN_StandardMsgType; + +#define FLEXCAN_INACTIVE_BUFFER 0x0000 +#define FLEXCAN_BUFFER_READY_TO_RX 0x0040 +#define FLEXCAN_BUFFER_FULL 0x0020 +#define FLEXCAN_BUFFER_OVERRUN 0x0060 +#define FLEXCAN_BUFFER_BUSY 0x0010 + +#define FLEXCAN_TX_NOT_READY 0x0080 +#define FLEXCAN_TX 0x00c0 +#define FLEXCAN_RESPONSE_TO_REMOTE 0x00a0 + +#define FLEXCAN_REGS_BASE 0x001c0000 +#define FLEXCAN_BUFFERS_BASE 0x001c0080 +#define FLEXCAN_LBUF_LOWEST_ID_FIRST 0 +#define FLEXCAN_TSYNC_ENABLE 1 +#define FLEXCAN_MAX_MSG_OBJ 16 +#define FLEXCAN_REG_MAX_OFFSET 0x080 +#define FLEXCAN_BUF_MAX_OFFSET 0x180 + +#define FLEXCAN_NUM_INT_SRCS 19 +#define FLEXCAN_INT_SRC_MIN_NUM 8 +#define FLEXCAN_INT_SRC_MAX_NUM 26 +/***************************************************************************** +* Register offsets +*/ + +typedef struct _flexcan_ + { + volatile unsigned short can_MCR; /* Module Configuration Register */ + volatile unsigned short can_res1; + volatile unsigned short can_res2; + volatile unsigned char can_CR0; + volatile unsigned char can_CR1; + volatile unsigned char can_PRESDIV; + volatile unsigned char can_CR2; + volatile unsigned short can_TIMER; + volatile unsigned short can_res3[2]; + volatile unsigned short can_RxGlobalMask_hi; + volatile unsigned short can_RxGlobalMask_lo; + volatile unsigned short can_RxBuff14Mask_hi; + volatile unsigned short can_RxBuff14Mask_lo; + volatile unsigned short can_RxBuff15Mask_hi; + volatile unsigned short can_RxBuff15Mask_lo; + volatile unsigned short can_res4[2]; + volatile unsigned short can_ESTAT; + volatile unsigned short can_IMASK; + volatile unsigned short can_IFLAG; + volatile unsigned char can_RxECTR; + volatile unsigned char can_TxECTR; + } _FlexCAN; /* 384 bytes total */ + +/* Module Configuration Register */ + +#define FLEXCAN_STOP 0x8000 /* Disable FlexCAN clocks */ +#define FLEXCAN_FRZ 0x4000 /* FlexCAN enabled to enter debug mode */ +#define FLEXCAN_HALT 0x1000 /* FlexCAN enters debug mode */ +#define FLEXCAN_NOTRDY 0x0800 /* FlexCAN is in low-power stop or debug mode */ +#define FLEXCAN_WAKEMSK 0x0400 /* wakeup interrupt is enabled */ +#define FLEXCAN_SOFTRST 0x0200 /* soft reset cycle initiated/completed */ +#define FLEXCAN_FRZACK 0x0100 /* FlexCAN has entered/exited debug mode */ +#define FLEXCAN_SUPV 0x0080 /* supervisor/user mode */ +#define FLEXCAN_SELFWAKE 0x0040 /* self wake enabled */ +#define FLEXCAN_APS 0x0020 /* auto-power save */ +#define FLEXCAN_STOPACK 0x0010 /* FlexCAN entered low-power stop mode */ + +/* Control Register 0 */ + +#define FLEXCAN_BOFFMSK 0x80 /* bus off interrupt enable */ +#define FLEXCAN_ERRMSK 0x40 /* error interrupt enable */ +#define FLEXCAN_RXMODE 0x04 /* CANRX pin polarity */ +#define FLEXCAN_TXMODE_POS 0x00 /* CANTX pin positive polarity */ +#define FLEXCAN_TXMODE_NEG 0x01 /* CANTX pin negative polarity */ +#define FLEXCAN_TXMODE_OPD 0x02 /* CANTX pin open drain */ + +/* Control Register 1 */ + +#define FLEXCAN_SAMP 0x80 /* sampling mode */ +#define FLEXCAN_TSYNC 0x20 /* timer synchronize mode */ +#define FLEXCAN_LBUF 0x10 /* lowest buffer transmitted first */ +#define FLEXCAN_LOM 0x08 /* listen only mode */ +#define FLEXCAN_PROPSEG 0x07 /* propagation segment time mask */ + +/* Error and Status Register (ESTAT) */ + +#define FLEXCAN_BITERR 0xc000 /* transmit bit error */ +#define FLEXCAN_ACKERR 0x2000 /* acknowlege error */ +#define FLEXCAN_CRCERR 0x1000 /* crc error */ +#define FLEXCAN_FORMERR 0x0800 /* message format error */ +#define FLEXCAN_STUFFERR 0x0400 /* bit stuff error */ +#define FLEXCAN_TXWARN 0x0200 /* transmit error status */ +#define FLEXCAN_RXWARN 0x0100 /* receive error status */ +#define FLEXCAN_FCS 0x0030 /* fault confinment state */ +#define FLEXCAN_ERR_ACTIVE 0x0000 /* confinment state ERROR ACTIVE */ +#define FLEXCAN_ERR_PASSIVE 0x0010 /* confinment state ERROR PASSIVE */ +#define FLEXCAN_BOFFINT 0x0004 /* bus off interrupt */ +#define FLEXCAN_ERRINT 0x0002 /* error interrupt */ +#define FLEXCAN_WAKEINT 0x0001 /* wake interrupt */ + +typedef struct _flexcanBuffers_ +{ + volatile FlexCAN_StandardMsgType can_MSG[FLEXCAN_MAX_MSG_OBJ]; +}_FlexCANbuffers; + +typedef volatile _FlexCAN *FlexCAN; +typedef volatile _FlexCANbuffers *FlexCANBuf; + +struct canAccess +{ + FlexCAN pFlexCanRegs; + FlexCANBuf pFlexCanBufs; + UCHAR FlexcanPropseg; + USHORT FlexCANAutoPowersSave; + USHORT FlexCANSupv; + UCHAR FlexCANTimerSync; + UCHAR FlexCANLBuf; + UCHAR FlexCANSrcIcrVal[FLEXCAN_NUM_INT_SRCS]; +}; + +/* table of regbases for each can channel */ +extern FlexCAN pFlexCanRegsBaseAdr[]; +extern FlexCANBuf pFlexCanBufsBaseAdr[]; + +/* + * Formatting identifier bits + */ +#define FLEXCAN_ID_BITS_28TO18 0xFFE0 +#define FLEXCAN_ID_BITS_17TO15 0x7 +#define FLEXCAN_IDE_EXT 0x0008 + +#define FLEXCAN_M28TO18 0xffe00000 +#define FLEXCAN_M17TO0 0x001ffff8 + +extern const UINT g_FLEXCANchnType[FLEXCAN_MAX_MSG_OBJ]; + +#define FLEXCAN_RXBUF14_MASK 14 +#define FLEXCAN_RXBUF15_MASK 15 + +/*---------------------------------------------- + * duplicate macros, added in ppcFlexcan.h after + * CAN api update + * + * FLEXCAN Control Register (FLEXCAN_CR2) + *(MSB)0 1 2 3 4 5 6 7 + * -------------------------------------------- + *| RJW | PSEG | PSEG2 | + *| | | | + * -------------------------------------------- + */ + +#ifndef FLEXCAN_RJW +#define FLEXCAN_RJW 0xC0 +#endif + +#ifndef FLEXCAN_PSEG +#define FLEXCAN_PSEG 0x38 +#endif + +#ifndef FLEXCAN_PSEG2 +#define FLEXCAN_PSEG2 0x07 +#endif + +#ifndef FLEXCAN_GetM17TO0 +#define FLEXCAN_GetM17TO0 0x0007fffe +#endif + +/*------------------------------------------------*/ + +void FlexCAN_registration(void); + +#if __cplusplus +} +#endif + +#endif /* _FLEXCAN_H_ */ diff --git a/h/CAN/flexcanOffsets.h b/h/CAN/flexcanOffsets.h new file mode 100644 index 0000000..beabe76 --- /dev/null +++ b/h/CAN/flexcanOffsets.h @@ -0,0 +1,81 @@ +/* flexcanOffsets.h - definitions for Flexcan for WNCAN Interface */ + +/* Copyright 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,08jun04,lsg created + +*/ + +/* + + DESCRIPTION + This file contains the FlexCAN register offsets + + +*/ +#ifndef FLEXCAN_OFFSETS_H_ +#define FLEXCAN_OFFSETS_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/***************************************************************************** +* Register offsets +*/ + +#define FLEXCAN_MCR_OFFSET 0x0 +#define FLEXCAN_CR0_OFFSET 0x6 +#define FLEXCAN_CR1_OFFSET 0x7 +#define FLEXCAN_PRESDIV_OFFSET 0x8 +#define FLEXCAN_CR2_OFFSET 0x9 +#define FLEXCAN_TIMER_OFFSET 0xA +#define FLEXCAN_RXGLOBALMASK_OFFSET 0x10 +#define FLEXCAN_RXBUFF14MASK_OFFSET 0x14 +#define FLEXCAN_RXBUFF15MASK_OFFSET 0x18 +#define FLEXCAN_ESTAT_OFFSET 0x20 +#define FLEXCAN_IMASK_OFFSET 0x22 +#define FLEXCAN_IFLAG_OFFSET 0x24 +#define FLEXCAN_RXECTR_OFFSET 0x26 +#define FLEXCAN_TXECTR_OFFSET 0x27 +#define FLEXCAN_REG_MAX_OFFSET 0x28 + +#define FLEXCAN_BUFF0_OFFSET 0x80 +#define FLEXCAN_BUFF1_OFFSET 0x90 +#define FLEXCAN_BUFF2_OFFSET 0xA0 +#define FLEXCAN_BUFF3_OFFSET 0xB0 +#define FLEXCAN_BUFF4_OFFSET 0xC0 +#define FLEXCAN_BUFF5_OFFSET 0xD0 +#define FLEXCAN_BUFF6_OFFSET 0xE0 +#define FLEXCAN_BUFF7_OFFSET 0xF0 +#define FLEXCAN_BUFF8_OFFSET 0x100 +#define FLEXCAN_BUFF9_OFFSET 0x110 +#define FLEXCAN_BUFF10_OFFSET 0x120 +#define FLEXCAN_BUFF11_OFFSET 0x130 +#define FLEXCAN_BUFF12_OFFSET 0x140 +#define FLEXCAN_BUFF13_OFFSET 0x150 +#define FLEXCAN_BUFF14_OFFSET 0x160 +#define FLEXCAN_BUFF15_OFFSET 0x170 +#define FLEXCAN_BUF_MAX_OFFSET 0x280 + +#define TOUCAN_BUFF_CTRLSTAT_OFFSET 0 +#define TOUCAN_BUFF_IDHI_OFFSET 2 +#define TOUCAN_BUFF_IDLO_OFFSET 4 +#define TOUCAN_BUFF_DATA0_OFFSET 6 +#define TOUCAN_BUFF_DATA1_OFFSET 7 +#define TOUCAN_BUFF_DATA2_OFFSET 8 +#define TOUCAN_BUFF_DATA3_OFFSET 9 +#define TOUCAN_BUFF_DATA4_OFFSET 0xa +#define TOUCAN_BUFF_DATA5_OFFSET 0xb +#define TOUCAN_BUFF_DATA6_OFFSET 0xc +#define TOUCAN_BUFF_DATA7_OFFSET 0xd + +#if __cplusplus +} +#endif + +#endif /* _FLEXCAN_OFFSETS_H_ */ diff --git a/h/CAN/hcan2.h b/h/CAN/hcan2.h new file mode 100644 index 0000000..45a6db9 --- /dev/null +++ b/h/CAN/hcan2.h @@ -0,0 +1,84 @@ +/* hcan_2.h - Hitachi CAN v2 header file */ + +/* Copyright 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,29mar05,lsg Fix capitalization in include +12Nov02, rgp written + +*/ + + +#ifndef _HCAN2_H_ +#define _HCAN2_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include + + +/***********************************************************************/ +/** constants regarding the HCAN controller **/ +/***********************************************************************/ + +#define HCAN2_MAX_MSG_OBJ 32 + + + +/***********************************************************************/ +/** data structures for the HCAN controller **/ +/***********************************************************************/ +struct HCan2_ChannelData +{ + WNCAN_ChannelMode chnMode[HCAN2_MAX_MSG_OBJ]; +}; + + +/* data placed into the csData of the channel datastructure */ +typedef struct _ta_ctrlrdata +{ + void *regbase; /* register base address */ + + /* since this controller can exist either on-chip or part + ** of the Tahoe-Amanda, those boards will have different + ** ways to sleep and wake the clock associated with the + ** controller. Thus, provide for functions that are board + ** specific, to wake and sleep, enable,disable + **/ + int wake_sleep_value; /* value to pass to wake/sleep fn */ + + /* board's wake and sleep functions */ + STATUS (*wakefn)(int); + STATUS (*sleepfn)(int); + + /* board's IRQ enable/disable functions */ + void (*enableirqfn)(struct WNCAN_Device *); + void (*disableirqfn)(struct WNCAN_Device *); + + +} HCan2_PvtCtrlrData; + + +/***********************************************************************/ +/** external globals for the controller **/ +/***********************************************************************/ +extern const WNCAN_ChannelType g_hcan2chnType[HCAN2_MAX_MSG_OBJ]; + + + +/***********************************************************************/ +/** external functions for the controller **/ +/***********************************************************************/ +void HCan2_registration(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + + +#endif /* _HCAN2_H_ */ diff --git a/h/CAN/hcan2Offsets.h b/h/CAN/hcan2Offsets.h new file mode 100644 index 0000000..3411d10 --- /dev/null +++ b/h/CAN/hcan2Offsets.h @@ -0,0 +1,126 @@ +/* hcan2Offsets.h */ + +/* Copyright 2002 Wind River Systems, Inc. */ + +/* +Description: Supply offsets and macros for use with te register + access APIs. + + +modification history +-------------------- +12nov02,rgp written +*/ + + +#ifndef HCAN2_OFFSETS_H_ +#define HCAN2_OFFSETS_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/********************************/ +/* controller registers offsets */ +/********************************/ +#define HCAN2_MCR_OFFSET 0x00 +#define HCAN2_GSR_OFFSET 0x02 +#define HCAN2_BCR1_OFFSET 0x04 +#define HCAN2_BCR0_OFFSET 0x06 +#define HCAN2_IRR_OFFSET 0x08 +#define HCAN2_IMM_OFFSET 0x0A +#define HCAN2_ERRCTNRS_OFFSET 0x0C +#define HCAN2_TXPR1_OFFSET 0x20 +#define HCAN2_TXPR0_OFFSET 0x22 +#define HCAN2_TXCR1_OFFSET 0x28 +#define HCAN2_TXCR0_OFFSET 0x2A +#define HCAN2_TXACK1_OFFSET 0x30 +#define HCAN2_TXACK0_OFFSET 0x32 +#define HCAN2_ABACK1_OFFSET 0x38 +#define HCAN2_ABACK0_OFFSET 0x3A +#define HCAN2_RXPR1_OFFSET 0x40 +#define HCAN2_RXPR0_OFFSET 0x42 +#define HCAN2_RFPR1_OFFSET 0x48 +#define HCAN2_RFPR0_OFFSET 0x4A +#define HCAN2_MBIMR1_OFFSET 0x50 +#define HCAN2_MBIMR0_OFFSET 0x52 +#define HCAN2_UMSR1_OFFSET 0x58 +#define HCAN2_UMSR0_OFFSET 0x5A +#define HCAN2_TCNTR_OFFSET 0x80 +#define HCAN2_TCR_OFFSET 0x82 +#define HCAN2_TSR_OFFSET 0x84 +#define HCAN2_TDCR_OFFSET 0x86 +#define HCAN2_LOSR_OFFSET 0x88 +#define HCAN2_ICR0CC_OFFSET 0x8A +#define HCAN2_ICR0TM_OFFSET 0x8C +#define HCAN2_ICR1_OFFSET 0x8E +#define HCAN2_TCMR0_OFFSET 0x90 +#define HCAN2_TCMR1_OFFSET 0x92 +#define HCAN2_TCMR2_OFFSET 0x94 +#define HCAN2_CCR_OFFSET 0x96 +#define HCAN2_CMAX_OFFSET 0x98 +#define HCAN2_TMR_OFFSET 0x9A + +#define HCAN2_ENDOFREGISTERS 0x9C + + +/************************/ +/* mailbox offsets */ +/************************/ +#define HCAN2_MB0_OFFSET 0x100 +#define HCAN2_MB1_OFFSET 0x120 +#define HCAN2_MB2_OFFSET 0x140 +#define HCAN2_MB3_OFFSET 0x160 +#define HCAN2_MB4_OFFSET 0x180 +#define HCAN2_MB5_OFFSET 0x1A0 +#define HCAN2_MB6_OFFSET 0x1C0 +#define HCAN2_MB7_OFFSET 0x1E0 +#define HCAN2_MB8_OFFSET 0x200 +#define HCAN2_MB9_OFFSET 0x220 +#define HCAN2_MB10_OFFSET 0x240 +#define HCAN2_MB11_OFFSET 0x260 +#define HCAN2_MB12_OFFSET 0x280 +#define HCAN2_MB13_OFFSET 0x2A0 +#define HCAN2_MB14_OFFSET 0x2C0 +#define HCAN2_MB15_OFFSET 0x2E0 +#define HCAN2_MB16_OFFSET 0x300 +#define HCAN2_MB17_OFFSET 0x320 +#define HCAN2_MB18_OFFSET 0x340 +#define HCAN2_MB19_OFFSET 0x360 +#define HCAN2_MB20_OFFSET 0x380 +#define HCAN2_MB21_OFFSET 0x3A0 +#define HCAN2_MB22_OFFSET 0x3C0 +#define HCAN2_MB23_OFFSET 0x3E0 +#define HCAN2_MB24_OFFSET 0x400 +#define HCAN2_MB25_OFFSET 0x420 +#define HCAN2_MB26_OFFSET 0x440 +#define HCAN2_MB27_OFFSET 0x460 +#define HCAN2_MB28_OFFSET 0x480 +#define HCAN2_MB29_OFFSET 0x4A0 +#define HCAN2_MB30_OFFSET 0x4C0 +#define HCAN2_MB31_OFFSET 0x4E0 + +#define HCAN2_ENDOFMAILBOXES 0x500 + +/*************************/ +/* mailbox field offsets */ +/*************************/ +#define HCAN2_MBCTRL0_OFFSET 0x00 +#define HCAN2_MBCTRL1_OFFSET 0x02 +#define HCAN2_MBCTRL2_OFFSET 0x04 +#define HCAN2_MBTIMESTAMP_OFFSET 0x06 +#define HCAN2_MBDATA01_OFFSET 0x08 +#define HCAN2_MBDATA23_OFFSET 0x0A +#define HCAN2_MBDATA45_OFFSET 0x0C +#define HCAN2_MBDATA67_OFFSET 0x0E +#define HCAN2_MBFILTER0_OFFSET 0x10 +#define HCAN2_MBFILTER1_OFFSET 0x12 + +#define HCAN2_ENDOFMAILBOXFIELDS 0x14 + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif diff --git a/h/CAN/i82527.h b/h/CAN/i82527.h new file mode 100644 index 0000000..1184070 --- /dev/null +++ b/h/CAN/i82527.h @@ -0,0 +1,77 @@ +/* i82527.h - definitions for Intel 82527 CAN Controller */ + +/* Copyright 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +09nov01,dnb modified for integration into Tornado +12jul01,jac written + +*/ + +/* + +DESCRIPTION +This file contains the functions declarations, specific to the +Intel 82527 CAN controller, that implement the interface defined +in the wnCAN.h header file. + + */ + +#ifndef _I82527_H_ +#define _I82527_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* max number of message objects for i82527 */ +#define I82527_MAX_MSG_OBJ 15 + +/* bit constants */ +#define I82527_B_INIT 0x01 /* is 1 after reset or busoff, must be set to 0 1st time */ +#define I82527_B_IE 0x02 /* interrupt enable, must be 1 for using msg obj int's */ +#define I82527_B_SIE 0x04 /* status interrupt enable, can be 0 */ +#define I82527_B_EIE 0x08 /* Error interrupt enable, can be 0 */ +#define I82527_B_CCE 0x40 /* config change enable, must be 0 for accessing cfg reg's*/ + +/* status register */ +#define I82527_B_LEC0 0x01 +#define I82527_B_LEC1 0x02 +#define I82527_B_LEC2 0x04 +#define I82527_B_TXOK 0x08 +#define I82527_B_RXOK 0x10 +#define I82527_B_WAKE 0x20 +#define I82527_B_WARN 0x40 /* read-only, must be 0 for bus transfer */ +#define I82527_B_BOFF 0x80 /* read-only, must be 0 for bus transfer */ + +/* CPU interface register */ +#define I82527_B_CEN 0x01 +#define I82527_B_MUX 0x04 +#define I82527_B_SLEEP 0x08 +#define I82527_B_PWD 0x10 +#define I82527_B_DMC 0x20 +#define I82527_B_DSC 0x40 +#define I82527_B_RSTST 0x80 + +struct i82527ChipSpecific +{ + BOOL busOffInt; + BOOL wakeUpInt; + BOOL errorInt; +}; + + +extern const UINT g_i82527chnType[I82527_MAX_MSG_OBJ]; + +void i82527_registration(void); +void i82527ISR(ULONG context); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _I82527_H_ */ diff --git a/h/CAN/i82527Offsets.h b/h/CAN/i82527Offsets.h new file mode 100644 index 0000000..4004885 --- /dev/null +++ b/h/CAN/i82527Offsets.h @@ -0,0 +1,67 @@ +/* + i82527Offsets.h - register offset definitions for + Intel 82527 CAN Controller + + Copyright 2001 Wind River Systems, Inc. + +*/ + +/* +modification history +-------------------- +29may02,lsg modified for CAN driver update + +*/ + +/* + +DESCRIPTION +This file contains the functions i82527 register offsets + +*/ + +#ifndef _I82527_OFFSETS_H_ +#define _I82527_OFFSETS_H_ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +#define I82527_R_CTRL 0 +#define I82527_R_SR 1 +#define I82527_R_INFR 2 +#define I82527_R_HSR 4 +#define I82527_R_GMS 6 +#define I82527_R_GME 8 +#define I82527_R_M15M 0x0C +#define I82527_R_CLKO 0x1F +#define I82527_R_BCR 0x2F +#define I82527_R_BTR0 0x3F +#define I82527_R_BTR1 0x4F +#define I82527_R_INT 0x5F +#define I82527_R_P1C 0x9F +#define I82527_R_P2C 0xAF +#define I82527_R_P1I 0xBF +#define I82527_R_P2I 0xCF +#define I82527_R_P1O 0xDF +#define I82527_R_P2O 0xEF +#define I82527_R_SRA 0xFF + +#define I82527_MAX_OFFSET 0x100 + +#define I82527_R_RCV 0xF0 +#define I82527_R_XMT 0x10 + +/* Register Offsets */ +#define I82527_OFFS_MSG 0x10 /* message address offset */ +#define I82527_OFFS_DATA 0x07 /* message offset for data bytes */ +#define I82527_OFFS_CTRL0 0x00 /* first message control register */ +#define I82527_OFFS_CTRL1 0x01 /* second message control register */ +#define I82527_OFFS_ARBIT 0x02 /* message arbitration register for setting the id*/ +#define I82527_OFFS_MCR 0x06 /* message configuration register */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /*_I82527_OFFSETS_H_*/ diff --git a/h/CAN/motMsCan.h b/h/CAN/motMsCan.h new file mode 100644 index 0000000..574f900 --- /dev/null +++ b/h/CAN/motMsCan.h @@ -0,0 +1,156 @@ +/* motMsCan.h - definitions for the Motorola MSCAN */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01c,25jun04,bjn Adding extern "C" for CPP. +01b,21apr04,bjn support DevIO interface +01a,23oct03,bjn written +*/ + +/* +DESCRIPTION +This file contains the functions declarations, specific to the +new CAN controller, that implement the interface defined +in the wnCAN.h header file. +*/ + +#ifndef _MOTMSCAN_H_ +#define _MOTMSCAN_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * Max number of message objects for Motorola MSCAN + * TX = 0,1 and 2. RX = 3. + */ + +#define MOTMSCAN_MAX_TX_MSG_OBJ (3) +#define MOTMSCAN_MAX_RX_MSG_OBJ (1) + +#define MOTMSCAN_RX_MSG_OBJ_NUM (3) + +#define MOTMSCAN_MAX_MSG_OBJ (MOTMSCAN_MAX_TX_MSG_OBJ + MOTMSCAN_MAX_RX_MSG_OBJ) + +typedef struct _mscan_dev_ + { + /* Configuration options, set before MOTMSCAN_Init() is called */ + + void * pMSCANregs; + + UCHAR CANCTL0value; + UCHAR CANCTL1value; + UCHAR CANIDACvalue; + UCHAR CANRIERvalue; + int intNum; + UINT freq; + + /* Global data for the MSCAN device driver */ + + BOOL rtr[MOTMSCAN_MAX_TX_MSG_OBJ]; + + UCHAR can_RIERshadow; + UCHAR tempDisableRXFIE; + + WNCAN_IntType txChanInt[MOTMSCAN_MAX_TX_MSG_OBJ]; + } + MSCAN_DEV; + + +/* Data structures for the controller */ + +struct MSCAN_ChannelData + { + WNCAN_ChannelMode chnMode[MOTMSCAN_MAX_MSG_OBJ]; + }; + + +/* external globals for the controller */ + +extern const UINT g_MSCANchnType[MOTMSCAN_MAX_MSG_OBJ]; + + +/* external functions for the controller */ + +void MSCAN_registration (void); +void MSCAN_ISR (ULONG context); + +/***************************************************************************** + * Register: CANCTL0 + */ + +#define CR0_RXFRM (0x80) +#define CR0_RXACT (0x40) +#define CR0_CSWAI (0x20) +#define CR0_SYNCH (0x10) +#define CR0_TIME (0x08) +#define CR0_WUPE (0x04) +#define CR0_SLPRQ (0x02) +#define CR0_INITRQ (0x01) + +/***************************************************************************** +* Register: CANCTL1 +*/ + +#define CR1_CANE (0x80) +#define CR1_CLKSRC (0x40) +#define CR1_LOOPB (0x20) +#define CR1_LISTEN (0x10) +#define CR1_WUPM (0x04) +#define CR1_SLPAK (0x02) +#define CR1_INITAK (0x01) + +/***************************************************************************** +* Register: CANRFLG/CANRIER +*/ + +#define RX_WUPIE (0x80) +#define RX_CSCIE (0x40) +#define RX_RSTATE1 (0x20) +#define RX_RSTATE0 (0x10) +#define RX_TSTATE1 (0x08) +#define RX_TSTATE0 (0x04) +#define RX_OVRIE (0x02) +#define RX_RXFIE (0x01) + +#define RX_RX_STATUS_CHANGE_0_ENB (0x00<<4) +#define RX_RX_STATUS_CHANGE_1_ENB (0x01<<4) +#define RX_RX_STATUS_CHANGE_2_ENB (0x02<<4) +#define RX_RX_STATUS_CHANGE_3_ENB (0x03<<4) + +#define RX_TX_STATUS_CHANGE_0_ENB (0x00<<2) +#define RX_TX_STATUS_CHANGE_1_ENB (0x01<<2) +#define RX_TX_STATUS_CHANGE_2_ENB (0x02<<2) +#define RX_TX_STATUS_CHANGE_3_ENB (0x03<<2) + +#define RSTATE_BITS (0x30) +#define TSTATE_BITS (0x0C) + +/***************************************************************************** +* Register: CANBTR0 +*/ + +#define BTR0_BRP_BITS (0x3f) + +#define BTR0_SJW_BS (6) + +/***************************************************************************** +* Register: CANBTR1 +*/ + +#define BTR1_TSEG1_BITS (0x0f) +#define BTR1_TSEG2_BITS (0x70) + +#define BTR1_TSEG2_BS (4) +#define BTR1_SAMP_BS (7) + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _MOTMSCAN_H_ */ diff --git a/h/CAN/motMsCanOffsets.h b/h/CAN/motMsCanOffsets.h new file mode 100644 index 0000000..46cd799 --- /dev/null +++ b/h/CAN/motMsCanOffsets.h @@ -0,0 +1,164 @@ +/* motMsCanOffsets.h - register offset definitions for the Motorola MSCAN */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01c,25jun04,bjn Adding extern "C" for CPP. +01b,05may04,bjn Removed MOTMSCAN_GetCanId, not required for external usage. +01a,23oct03,bjn written +*/ + +/* +DESCRIPTION +This file contains the functions Motorola Scalable CAN register offsets +*/ + +#ifndef _MOTMSCAN_OFFSETS_H_ +#define _MOTMSCAN_OFFSETS_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* MSCAN Base Register Offsets */ + +#define can_CR0 (0x00) +#define can_CR1 (0x01) +#define can_BTR0 (0x04) +#define can_BTR1 (0x05) +#define can_RFLG (0x08) +#define can_RIER (0x09) +#define can_TFLG (0x0C) +#define can_TIER (0x0D) +#define can_TARQ (0x10) +#define can_TAAK (0x11) +#define can_TBSEL (0x14) +#define can_IDAC (0x15) +#define can_RXERR (0x1c) +#define can_TXERR (0x1d) + +/* ID Acceptance Registers */ +#define can_IDAR0 (0x20) +#define can_IDAR1 (0x21) +#define can_IDAR2 (0x24) +#define can_IDAR3 (0x25) +#define can_IDAR4 (0x30) +#define can_IDAR5 (0x31) +#define can_IDAR6 (0x34) +#define can_IDAR7 (0x35) + +/* ID Mask Registers */ +#define can_IDMR0 (0x28) +#define can_IDMR1 (0x29) +#define can_IDMR2 (0x2C) +#define can_IDMR3 (0x2D) +#define can_IDMR4 (0x38) +#define can_IDMR5 (0x39) +#define can_IDMR6 (0x3C) +#define can_IDMR7 (0x3D) + +/* RX FG Buffer */ +#define can_RXIDR0 (0x40) +#define can_RXIDR1 (0x41) +#define can_RXIDR2 (0x44) +#define can_RXIDR3 (0x45) +#define can_RXDSR0 (0x48) +#define can_RXDSR1 (0x49) +#define can_RXDSR2 (0x4c) +#define can_RXDSR3 (0x4d) +#define can_RXDSR4 (0x50) +#define can_RXDSR5 (0x51) +#define can_RXDSR6 (0x54) +#define can_RXDSR7 (0x55) +#define can_RXDLR (0x58) +#define can_RXTIMH (0x5c) +#define can_RXTIML (0x5d) + +/* TX FG Buffer */ +#define can_TXIDR0 (0x60) +#define can_TXIDR1 (0x61) +#define can_TXIDR2 (0x64) +#define can_TXIDR3 (0x65) +#define can_TXDSR0 (0x68) +#define can_TXDSR1 (0x69) +#define can_TXDSR2 (0x6c) +#define can_TXDSR3 (0x6d) +#define can_TXDSR4 (0x70) +#define can_TXDSR5 (0x71) +#define can_TXDSR6 (0x74) +#define can_TXDSR7 (0x75) +#define can_TXDLR (0x78) +#define can_TXTBPR (0x79) +#define can_TXTIMH (0x7c) +#define can_TXTIML (0x7d) + + +/* + * Additional MSCAN API functions, provided mainly to configure + * MSCAN filters + */ + +/* + * CAN IDs for MSCAN ID Mask Registers: + * '0' bit indicates match the bit. + * '1' bit indicates don't match the bit. + */ + +#define NO_MATCH_STD_BITS (0x000007ffUL) /* 11 Bits for standard CAN */ +#define NO_MATCH_EXT_BITS (0x1fffffffUL) /* 29 Bits for extended CAN */ + +typedef union + { + struct + { + UINT32 IDR0_3; + } + id32; + + struct + { + UINT16 IDR0_1; + UINT16 IDR2_3; + } + id16; + + struct + { + UINT8 IDR0; + UINT8 IDR1; + UINT8 IDR2; + UINT8 IDR3; + } + id8; + } + MSCAN_ID_REG; + +#define SET_MSCAN_IDE_BIT (0x01) +#define SET_MSCAN_RTR_BIT (0x02) +#define SET_MSCAN_SRR_BIT (0x04) + +void MOTMSCAN_GetIdMsgBuffer (long canId, BOOL ext, UINT8 options, + MSCAN_ID_REG * pMSCAN_IDR); + +/***************************************************************************** +* Register: IDAC +*/ + +#define IDAM_BS (3) + +#define IDAM_2_32BIT_FILTERS (0x00) +#define IDAM_4_16BIT_FILTERS (0x10) +#define IDAM_8_08BIT_FILTERS (0x20) +#define IDAM_FILTER_CLOSED (0x30) + +#define IDAM_BITS (0x30) +#define IDHIT_BITS (0x07) + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _MOTMSCAN_OFFSETS_H_ */ diff --git a/h/CAN/private/esd_can_pc104_200.h b/h/CAN/private/esd_can_pc104_200.h new file mode 100644 index 0000000..e28e95e --- /dev/null +++ b/h/CAN/private/esd_can_pc104_200.h @@ -0,0 +1,53 @@ +/* esd_can_pc104_200.h - definitions for ESD CAN PC104/200 board */ + +/* Copyright 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +20dec01, dnb written + +*/ + +/* + +DESCRIPTION +This file contains definitions used only in esd_can_pc104_200.c +and esd_can_pc104_200_cfg.c + +*/ + +#ifndef ESD_CAN_PC104_200_H +#define ESD_CAN_PC104_200_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define ESD_CAN_PC104_200_MAX_CONTROLLERS (2) + +struct ESD_CAN_PC104_200_DeviceEntry +{ + ULONG ioAddress; + UINT irq; + BOOL inUse; + + struct WNCAN_Device canDevice[ESD_CAN_PC104_200_MAX_CONTROLLERS]; + struct WNCAN_Controller canControllerArray[ESD_CAN_PC104_200_MAX_CONTROLLERS]; + struct WNCAN_Board canBoardArray[ESD_CAN_PC104_200_MAX_CONTROLLERS]; + BOOL allocated[ESD_CAN_PC104_200_MAX_CONTROLLERS]; + + WNCAN_ChannelMode i82527chnMode[I82527_MAX_MSG_OBJ]; + struct i82527ChipSpecific can82527; + + WNCAN_ChannelMode sja1000chnMode[SJA1000_MAX_MSG_OBJ]; + struct TxMsg txMsg; + +}; + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* ESD_CAN_PC104_200_H */ diff --git a/h/CAN/private/esd_pci_200.h b/h/CAN/private/esd_pci_200.h new file mode 100644 index 0000000..c99f6eb --- /dev/null +++ b/h/CAN/private/esd_pci_200.h @@ -0,0 +1,54 @@ +/* esd_pci_200.h - definitions for ESD PCI/200 board */ + +/* Copyright 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +20dec01, dnb written + +*/ + +/* + +DESCRIPTION +This file contains definitions used only in esd_pci_200. +and esd_pci_200_cfg.c + +*/ +#ifndef ESD_PCI_200_H +#define ESD_PCI_200_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define ESD_PCI_200_MAX_CONTROLLERS (2) + + +struct ESD_PCI_200_ChannelData +{ + WNCAN_ChannelMode sja1000chnMode[SJA1000_MAX_MSG_OBJ]; +}; + + +struct ESD_PCI_200_DeviceEntry +{ + struct WNCAN_Device canDevice[ESD_PCI_200_MAX_CONTROLLERS]; + struct ESD_PCI_200_ChannelData chData[ESD_PCI_200_MAX_CONTROLLERS]; + struct WNCAN_Controller canControllerArray[ESD_PCI_200_MAX_CONTROLLERS]; + struct WNCAN_Board canBoard; + struct TxMsg txMsg[ESD_PCI_200_MAX_CONTROLLERS]; + int bus; + int dev; + int func; + BOOL inUse; + BOOL allocated[ESD_PCI_200_MAX_CONTROLLERS]; + BOOL intConnect; +}; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* ESD_PCI_200_H */ diff --git a/h/CAN/private/m5282CAN.h b/h/CAN/private/m5282CAN.h new file mode 100644 index 0000000..50b88c1 --- /dev/null +++ b/h/CAN/private/m5282CAN.h @@ -0,0 +1,48 @@ +/* m5282CAN.h - definitions for MCF5282 baords */ + +/* Copyright 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,08apr04,lsg Modified for supporting WindNet CAN 1.3 +01a,24sep03,eli support for MCF5282 (ColdFire) FlexCAN module + +*/ + +/* + +DESCRIPTION +This file contains the declarations and definitions that are used for +MCF5282 boards + +*/ + +#ifndef _m5282CAN_H_ +#define _m5282CAN_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/*Define the number of controllers on-board (or on-chip)*/ +#define MAX_M5282_CAN_DEVICES 1 + +struct m5282CAN_DeviceEntry + { + BOOL inUse; + struct WNCAN_Device canDevice; + struct WNCAN_Controller canController; + struct WNCAN_Board canBoard; + struct canAccess canRegAccess; + BOOL allocated; + WNCAN_ChannelMode FlexCANchnMode[FLEXCAN_MAX_MSG_OBJ]; + }; + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* _m5282CAN_H_ */ diff --git a/h/CAN/private/mpc5200Can.h b/h/CAN/private/mpc5200Can.h new file mode 100644 index 0000000..9616205 --- /dev/null +++ b/h/CAN/private/mpc5200Can.h @@ -0,0 +1,86 @@ +/* mpc5200Can.h - definitions for MPC5200 based CAN controller */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,25jun04,bjn Adding extern "C" for CPP. +01a,23oct03,bjn written +*/ + +/* +DESCRIPTION +This file contains definitions used only in mpc5200Can.c +and mpc5200Can_cfg.c +*/ + +#ifndef _MPC5200_CAN_H_ +#define _MPC5200_CAN_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "CAN/motMsCan.h" + +/* external WindNet CAN required functions */ + +/* + * Since all MSCAN devices are internal to the processor, only one + * board can exist. + */ + +#define MAX_NUM_MPC5200CAN_BOARDS (1) + +#define BRD_NDX (0) /* Only one board possible */ + +/* We need an identifier for each individual MSCAN controllers */ + +typedef enum + { + MSCAN1_CTRL, + MSCAN2_CTRL + } + MSCAN_CTRL_ID; + +/* + * Define a type to record MSCAN device instance. + * Used to pass BSP configuration data to WNCAN + */ + +typedef struct + { + MSCAN_CTRL_ID MSCANcontrollerId; /* MSCAN controller Identifier. */ + void * pDevBaseAddr; /* Base address of MSCAN device */ + VOIDFUNCPTR * pIntVec; /* Interrupt vector */ + int intNum; /* Interrupt number */ + UINT32 clockSource; /* 0=Oscillator Clock, 1=IP Bus Clock */ + UINT32 freq; /* frequency */ + } + mpc5200_mscan_instance; + +/* Defined in mpc5200Can.c */ +IMPORT STATUS mpc5200Can_init (mpc5200_mscan_instance * pMSCANboardCfg); +IMPORT STATUS mpc5200Can_establishLinks (struct WNCAN_Device *); +IMPORT struct WNCAN_Device * mpc5200Can_open (UINT, UINT); +IMPORT STATUS mpc5200Can_close (struct WNCAN_Device *); + +/* Defined in mpc5200_cfg.c */ +IMPORT BOOL mpc5200_cfgGet_inUse (UINT brdNdx); +IMPORT void mpc5200_cfgSet_inUse (UINT brdNdx, BOOL val); +IMPORT BOOL mpc5200_cfgGet_allocated (UINT brdNdx, UINT ctrlNdx); +IMPORT void mpc5200_cfgSet_allocated (UINT brdNdx, UINT ctrlNdx, BOOL val); +IMPORT struct WNCAN_Board * mpc5200_cfgGet_canBoardPtr (UINT brdNdx); +IMPORT struct WNCAN_Device * mpc5200_cfgGet_canDevicePtr (UINT brdNdx, UINT ctrlNdx); +IMPORT struct WNCAN_Controller * mpc5200_cfgGet_canControllerPtr (UINT brdNdx, UINT ctrlNdx); +IMPORT MSCAN_DEV * mpc5200_cfgGet_mscanDevPtr (UINT brdNdx, UINT ctrlNdx); +IMPORT WNCAN_ChannelMode * mpc5200_cfgGet_chModePtr (UINT brdNdx, UINT ctrlNdx); +IMPORT UINT32 mpc5200_cfgGet_NumControllers (void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _MPC5200_CAN_H_ */ diff --git a/h/CAN/private/msmcan.h b/h/CAN/private/msmcan.h new file mode 100644 index 0000000..1567358 --- /dev/null +++ b/h/CAN/private/msmcan.h @@ -0,0 +1,47 @@ +/* msmcan.h - definitions for MSMCAN PC104 board */ + +/* Copyright 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +20dec01, dnb written + +*/ + +/* + +DESCRIPTION +This file contains definitions used only in msmcan_pc104.c +and msmcan_pc104_cfg.c + +*/ +#ifndef MSMCAN_H +#define MSMCAN_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define MSMCAN_PC104_MAX_CONTROLLERS (1) + +struct MSMCAN_PC104_DeviceEntry +{ + ULONG ioAddress; + UINT irq; + BOOL inUse; + + struct WNCAN_Device canDevice; + struct WNCAN_Controller canController; + struct WNCAN_Board canBoard; + BOOL allocated; + + WNCAN_ChannelMode i82527chnMode[I82527_MAX_MSG_OBJ]; + struct i82527ChipSpecific can82527; +}; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* MSMCAN_H */ diff --git a/h/CAN/private/ppc5xxCAN.h b/h/CAN/private/ppc5xxCAN.h new file mode 100644 index 0000000..6810d6e --- /dev/null +++ b/h/CAN/private/ppc5xxCAN.h @@ -0,0 +1,46 @@ +/* ppc5xxCAN.h - definitions for PPC5xx baords */ + +/* Copyright 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +27dec01, lsg + +*/ + +/* + +DESCRIPTION +This file contains the declarations and definitions that are used for +PPC5xx boards + +*/ + +#ifndef _ppc5xxCAN_H_ +#define _ppc5xxCAN_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/*Define the number of controllers on-board (or on-chip)*/ +#define PPC5XXCAN_MAX_CONTROLLERS (1) + +struct ppc5xxCAN_DeviceEntry +{ + BOOL inUse; + struct WNCAN_Device canDevice; + struct WNCAN_Controller canController; + struct WNCAN_Board canBoard; + struct canAccess canRegAccess; + BOOL allocated; + WNCAN_ChannelMode TouCANchnMode[TOUCAN_MAX_MSG_OBJ]; + +}; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif diff --git a/h/CAN/sja1000.h b/h/CAN/sja1000.h new file mode 100644 index 0000000..6acfa2d --- /dev/null +++ b/h/CAN/sja1000.h @@ -0,0 +1,110 @@ +/* SJA1000.h - definitions for Phillips SJA1000 CAN Controller */ + +/* Copyright 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,06oct05,lsg Rename macros that are common with + target/h/arch/mips/archMips +09nov01,dnb modified for integration into Tornado +12jul01,jac written + +*/ + +/* + +DESCRIPTION +This file contains the functions declarations, specific to the +Phillips SJA1000 CAN controller, that implement the interface defined +in the windnet_can.h header file. + +*/ + +#ifndef SJA1000_H_ +#define SJA1000_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* mode register bits */ +#define MOD_RM 0x01 +#define MOD_LOM 0x02 +#define MOD_STM 0x04 +#define MOD_AFM 0x08 +#define MOD_SM 0x10 + +/* command register bits */ +#define CMR_TR 0x01 +#define CMR_AT 0x02 +#define CMR_RRB 0x04 +#define CMR_CDO 0x08 +#define CMR_SRR 0x10 + +/* status register bits */ +#define SJA1000_SR_RBS 0x01 +#define SJA1000_SR_DOS 0x02 +#define SJA1000_SR_TBS 0x04 +#define SJA1000_SR_TCS 0x08 +#define SJA1000_SR_RS 0x10 +#define SJA1000_SR_TS 0x20 +#define SJA1000_SR_ES 0x40 +#define SJA1000_SR_BS 0x80 + +/* interrupt register bits */ +#define IR_RI 0x01 +#define IR_TI 0x02 +#define IR_EI 0x04 +#define IR_DOI 0x08 +#define IR_WUI 0x10 +#define IR_EPI 0x20 +#define IR_ALI 0x40 +#define IR_BEI 0x80 + +/* interrupt enable register bits */ +#define IER_RIE 0x01 +#define IER_TIE 0x02 +#define IER_EIE 0x04 +#define IER_DOIE 0x08 +#define IER_WUIE 0x10 +#define IER_EPIE 0x20 +#define IER_ALIE 0x40 +#define IER_BEIE 0x80 + +/* error code capture register */ +#define ECC_SEG0 0x01 +#define ECC_SEG1 0x02 +#define ECC_SEG2 0x04 +#define ECC_SEG3 0x08 +#define ECC_SEG4 0x10 +#define ECC_DIR 0x20 +#define ECC_ERRC0 0x40 +#define ECC_ERCC1 0x80 + +/* max number of message objects for sja1000 */ +#define SJA1000_MAX_MSG_OBJ 2 + +/* sja1000 channel types */ +#define TX_CHN_NUM 0 +#define RX_CHN_NUM 1 + +extern const UINT g_sja1000chnType[SJA1000_MAX_MSG_OBJ]; + +struct TxMsg +{ + ULONG id; + BOOL ext; + BOOL rtr; + UCHAR len; + UCHAR data[8]; +}; + +void sja1000_registration(void); +void sja1000ISR(ULONG context); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* SJA1000_H_ */ diff --git a/h/CAN/sja1000Offsets.h b/h/CAN/sja1000Offsets.h new file mode 100644 index 0000000..5c1138e --- /dev/null +++ b/h/CAN/sja1000Offsets.h @@ -0,0 +1,51 @@ +/* + +DESCRIPTION +This file contains the sja1000 pelican register offsets + +*/ + +#ifndef SJA1000_OFFSETS_H_ +#define SJA1000_OFFSETS_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define SJA1000_MOD 0 +#define SJA1000_CMR 1 +#define SJA1000_SR 2 +#define SJA1000_IR 3 +#define SJA1000_IER 4 +#define SJA1000_BTR0 6 +#define SJA1000_BTR1 7 +#define SJA1000_OCR 8 +#define SJA1000_ALC 11 +#define SJA1000_ECC 12 +#define SJA1000_EWLR 13 +#define SJA1000_RXERR 14 +#define SJA1000_TXERR 15 +#define SJA1000_SFF 16 +#define SJA1000_EFF 16 +#define SJA1000_ACR0 16 +#define SJA1000_RXID 17 +#define SJA1000_TXID 17 +#define SJA1000_ACR1 17 +#define SJA1000_ACR2 18 +#define SJA1000_ACR3 19 +#define SJA1000_SFDATA 19 +#define SJA1000_AMR0 20 +#define SJA1000_AMR1 21 +#define SJA1000_AMR2 22 +#define SJA1000_AMR3 23 +#define SJA1000_RMC 29 +#define SJA1000_RXBSA 30 +#define SJA1000_CDR 31 + +#define SJA1000_MAX_OFFSET 31 + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif diff --git a/h/CAN/toucan.h b/h/CAN/toucan.h new file mode 100644 index 0000000..66bb8d3 --- /dev/null +++ b/h/CAN/toucan.h @@ -0,0 +1,125 @@ +#ifndef _TOUCAN_H_ +#define _TOUCAN_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include + +/***********************************************************************/ +/* MPC5XX Internal Memory Map Assignments (MC5XX) */ +/***********************************************************************/ +/* This is the internal message sructure as used by the +** CAN device driver source code. The user never uses this structure +*/ + +typedef struct _toucanChannel_ { + volatile unsigned short Control; + volatile unsigned short Id; + volatile unsigned short Id2_OR_TimeStamp; + volatile unsigned char Data[8]; + volatile unsigned short No_use; + +} TouCAN_StandardMsgType; + + +/***************************************************************************** +* Register offsets +*/ + +typedef struct _toucan_ + { + volatile unsigned short can_MCR; + volatile unsigned short can_TTR; + volatile unsigned short can_ICR; + volatile unsigned char can_CR0; + volatile unsigned char can_CR1; + volatile unsigned char can_PRESDIV; + volatile unsigned char can_CR2; + volatile unsigned short can_TIMER; + volatile unsigned short can_res1[2]; + volatile unsigned long can_RxGlobalMask; + volatile unsigned long can_RxBuff14Mask; + volatile unsigned long can_RxBuff15Mask; + volatile unsigned short can_res2[2]; + volatile unsigned short can_ESTAT; + volatile unsigned short can_IMASK; + volatile unsigned short can_IFLAG; + volatile unsigned char can_RxECTR; + volatile unsigned char can_TxECTR; + } _TouCAN; /* 384 bytes total */ + + +typedef struct _toucanBuffers_ +{ + volatile TouCAN_StandardMsgType can_MSG[TOUCAN_MAX_MSG_OBJ]; +}_TouCANbuffers; + +typedef volatile _TouCAN *TouCAN; +typedef volatile _TouCANbuffers *TouCANBuf; + +struct canAccess +{ + TouCAN pTouCanRegs; + TouCANBuf pTouCanBufs; + UCHAR ToucanPropseg; + USHORT TouCANAutoPowersSave; + USHORT TouCANSupv; + UCHAR TouCANTimerSync; + UCHAR TouCANLBuf; +}; + +/* table of regbases for each can channel */ +extern TouCAN pTouCanRegsBaseAdr[]; +extern TouCANBuf pTouCanBufsBaseAdr[]; + +/* + * Formatting identifier bits + */ +#define TOUCAN_ID_BITS_28TO18 0xFFE0 +#define TOUCAN_ID_BITS_17TO15 0x7 +#define TOUCAN_IDE_EXT 0x0008 + +extern const UINT g_TOUCANchnType[TOUCAN_MAX_MSG_OBJ]; + +#define TOUCAN_RXBUF14_MASK 14 +#define TOUCAN_RXBUF15_MASK 15 + +/*---------------------------------------------- + * duplicate macros, added in ppcToucan.h after + * CAN api update + * + * TOUCAN Control Register (TOUCAN_CR2) + *(MSB)0 1 2 3 4 5 6 7 + * -------------------------------------------- + *| RJW | PSEG | PSEG2 | + *| | | | + * -------------------------------------------- + */ + +#ifndef TOUCAN_RJW +#define TOUCAN_RJW 0xC0 +#endif + +#ifndef TOUCAN_PSEG +#define TOUCAN_PSEG 0x38 +#endif + +#ifndef TOUCAN_PSEG2 +#define TOUCAN_PSEG2 0x07 +#endif + +#ifndef TOUCAN_GetM17TO0 +#define TOUCAN_GetM17TO0 0x0007fffe +#endif + +/*------------------------------------------------*/ + +void TouCAN_registration(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _toucan_H_ */ diff --git a/h/CAN/toucanOffsets.h b/h/CAN/toucanOffsets.h new file mode 100644 index 0000000..525d2e9 --- /dev/null +++ b/h/CAN/toucanOffsets.h @@ -0,0 +1,67 @@ +/* + +DESCRIPTION +This file contains the TOUCAN register offsets + +*/ + +#ifndef TOUCAN_OFFSETS_H_ +#define TOUCAN_OFFSETS_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define TOUCAN_MCR_OFFSET 0x0 +#define TOUCAN_TTR_OFFSET 0x2 +#define TOUCAN_ICR_OFFSET 0x4 +#define TOUCAN_CR0_OFFSET 0x6 +#define TOUCAN_CR1_OFFSET 0x7 +#define TOUCAN_PRESDIV_OFFSET 0x8 +#define TOUCAN_CR2_OFFSET 0x9 +#define TOUCAN_TIMER_OFFSET 0xA +#define TOUCAN_RXGLOBALMASK_OFFSET 0x10 +#define TOUCAN_RXBUFF14MASK_OFFSET 0x14 +#define TOUCAN_RXBUFF15MASK_OFFSET 0x18 +#define TOUCAN_ESTAT_OFFSET 0x20 +#define TOUCAN_IMASK_OFFSET 0x22 +#define TOUCAN_IFLAG_OFFSET 0x24 +#define TOUCAN_RXECTR_OFFSET 0x26 +#define TOUCAN_TXECTR_OFFSET 0x27 +#define TOUCAN_REG_MAX_OFFSET 0x28 + +#define TOUCAN_BUFF0_OFFSET 0x100 +#define TOUCAN_BUFF1_OFFSET 0x110 +#define TOUCAN_BUFF2_OFFSET 0x120 +#define TOUCAN_BUFF3_OFFSET 0x130 +#define TOUCAN_BUFF4_OFFSET 0x140 +#define TOUCAN_BUFF5_OFFSET 0x150 +#define TOUCAN_BUFF6_OFFSET 0x160 +#define TOUCAN_BUFF7_OFFSET 0x170 +#define TOUCAN_BUFF8_OFFSET 0x180 +#define TOUCAN_BUFF9_OFFSET 0x190 +#define TOUCAN_BUFF10_OFFSET 0x1a0 +#define TOUCAN_BUFF11_OFFSET 0x1b0 +#define TOUCAN_BUFF12_OFFSET 0x1c0 +#define TOUCAN_BUFF13_OFFSET 0x1d0 +#define TOUCAN_BUFF14_OFFSET 0x1e0 +#define TOUCAN_BUFF15_OFFSET 0x1f0 +#define TOUCAN_BUF_MAX_OFFSET 0x200 + +#define TOUCAN_BUFF_CTRLSTAT_OFFSET 0 +#define TOUCAN_BUFF_IDHI_OFFSET 2 +#define TOUCAN_BUFF_IDLO_OFFSET 4 +#define TOUCAN_BUFF_DATA0_OFFSET 6 +#define TOUCAN_BUFF_DATA1_OFFSET 7 +#define TOUCAN_BUFF_DATA2_OFFSET 8 +#define TOUCAN_BUFF_DATA3_OFFSET 9 +#define TOUCAN_BUFF_DATA4_OFFSET 0xa +#define TOUCAN_BUFF_DATA5_OFFSET 0xb +#define TOUCAN_BUFF_DATA6_OFFSET 0xc +#define TOUCAN_BUFF_DATA7_OFFSET 0xd + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif diff --git a/h/CAN/wnCAN.h b/h/CAN/wnCAN.h new file mode 100644 index 0000000..c503353 --- /dev/null +++ b/h/CAN/wnCAN.h @@ -0,0 +1,415 @@ +/* wnCAN.h - definitions for Windnet CAN Interface */ + +/* Copyright 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,06oct05,lsg fix warning +09nov01,dnb modified for integration into Tornado +12jul01,jac written + +*/ + +/* + + DESCRIPTION + This file contains the declarations and definitions that comprise the + Windnet CAN Interface. + +*/ + +#ifndef WN_CAN_H +#define WN_CAN_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include + +typedef struct tagCANVersionInfo +{ + UCHAR major; + UCHAR minor; +} WNCAN_VersionInfo; + +#define WNCAN_ILLEGAL_CHN_NUM 0xff + +/* types of channel configurations */ +#define WNCAN_CHN_INVALID 0x00 +#define WNCAN_CHN_TRANSMIT 0x01 +#define WNCAN_CHN_RECEIVE 0x02 +#define WNCAN_CHN_TRANSMIT_RECEIVE 0x03 +#define WNCAN_CHN_INACTIVE 0x04 +#define WNCAN_CHN_RTR_REQUESTER 0x11 +#define WNCAN_CHN_RTR_RESPONDER 0x12 + +typedef UINT WNCAN_ChannelType; +typedef UINT WNCAN_ChannelMode; + +#define WNCAN_IS_CHN_RTR 0x10 + +/* CAN bus error type */ +#define WNCAN_ERR_NONE 0 +#define WNCAN_ERR_BIT 0x1 +#define WNCAN_ERR_ACK 0x2 +#define WNCAN_ERR_CRC 0x4 +#define WNCAN_ERR_FORM 0x8 +#define WNCAN_ERR_STUFF 0x10 +#define WNCAN_ERR_UNKNOWN 0x20 + +typedef UINT WNCAN_BusError; + +/* status code returned by CAN_GetBusStatus */ +#define WNCAN_BUS_OK 0 +#define WNCAN_BUS_WARN 1 +#define WNCAN_BUS_OFF 2 + +typedef UINT WNCAN_BusStatus; + +/* Interrupt status */ +#define WNCAN_INT_NONE 0 +#define WNCAN_INT_ERROR 0x1 +#define WNCAN_INT_BUS_OFF 0x2 +#define WNCAN_INT_WAKE_UP 0x4 +#define WNCAN_INT_TX 0x8 +#define WNCAN_INT_RX 0x10 +#define WNCAN_INT_RTR_RESPONSE 0x20 +#define WNCAN_INT_TXCLR 0x40 +#define WNCAN_INT_SPURIOUS 0xffffeeee +#define WNCAN_INT_ALL 0xffffffff + +typedef UINT WNCAN_IntType; + + +/*Macro definitions to be used with filtering*/ +#define COMPARE_ALL_STD_IDS 0x7FF +#define COMPARE_ALL_EXT_IDS 0x1FFFFFFF +#define ACCEPT_ALL_STD_IDS 0 +#define ACCEPT_ALL_STD_IDS 0 + +/* STATUS error codes returned by CAN interface functions */ +#define WNCAN_NOERROR 0 +#define WNCAN_BUSY 80 +#define WNCAN_NOTINITIALIZED 81 +#define WNCAN_NULL_POINTER 82 +#define WNCAN_ILLEGAL_CHANNEL_NO 83 +#define WNCAN_ILLEGAL_CONFIG 84 +#define WNCAN_ILLEGAL_CTRL_NO 85 +#define WNCAN_ILLEGAL_BOARD_INDEX 86 +#define WNCAN_NO_OP 87 +#define WNCAN_BUFFER_UNDERFLOW 89 +#define WNCAN_BUFFER_OVERFLOW 90 +#define WNCAN_ILLEGAL_DATA_LENGTH 91 +#define WNCAN_NULL_BUFFER 92 +#define WNCAN_ILLEGAL_MASK_VALUE 93 +#define WNCAN_BUS_FAULT 94 +#define WNCAN_HWFEATURE_NOT_AVAILABLE 95 +#define WNCAN_ILLEGAL_CHANNEL_MODE 96 +#define WNCAN_RTR_MODE_NOT_SUPPORTED 97 +#define WNCAN_NO_AVAIL_CHANNELS 98 +#define WNCAN_ILLEGAL_OFFSET 101 +#define WNCAN_CANNOT_SET_ERRINT 102 +#define WNCAN_CANNOT_SET_BOFFINT 104 +#define WNCAN_CANNOT_SET_WAKEUPINT 108 +#define WNCAN_INCOMPATIBLE_TYPE 109 +#define WNCAN_SLEEP_IN_RESET_MODE 110 +#define WNCAN_USE_AUTO_RESPONSE 111 +#define WNCAN_USE_RTR_REQ_CHN_MODE 112 +#define WNCAN_TSEG_ZERO 113 +#define WNCAN_NUMTQ_LT_NINE 114 +#define WNCAN_UNKNOWN_ERROR 255 + +/* defined error codes */ +#define M_wnCan (496 << 16) + +#define S_can_invalid_parameter (M_wnCan + 1) +#define S_can_unknown_controller (M_wnCan + 2) +#define S_can_invalid_timing_combination (M_wnCan + 3) +#define S_can_out_of_memory (M_wnCan + 4) +#define S_can_unknown_board (M_wnCan + 5) + +#define S_can_busy (M_wnCan + WNCAN_BUSY) +#define S_can_illegal_channel_no (M_wnCan + WNCAN_ILLEGAL_CHANNEL_NO) +#define S_can_illegal_config (M_wnCan + WNCAN_ILLEGAL_CONFIG) +#define S_can_illegal_ctrl_no (M_wnCan + WNCAN_ILLEGAL_CTRL_NO) +#define S_can_illegal_board_no (M_wnCan + WNCAN_ILLEGAL_BOARD_INDEX) +#define S_can_no_op (M_wnCan + WNCAN_NO_OP) +#define S_can_buffer_underflow (M_wnCan + WNCAN_BUFFER_UNDERFLOW) +#define S_can_buffer_overflow (M_wnCan + WNCAN_BUFFER_OVERFLOW) +#define S_can_illegal_data_length (M_wnCan + WNCAN_ILLEGAL_DATA_LENGTH) +#define S_can_null_input_buffer (M_wnCan + WNCAN_NULL_BUFFER) +#define S_can_illegal_mask_value (M_wnCan + WNCAN_ILLEGAL_MASK_VALUE) +#define S_can_bus_fault (M_wnCan + WNCAN_BUS_FAULT) +#define S_can_hwfeature_not_available (M_wnCan + WNCAN_HWFEATURE_NOT_AVAILABLE) +#define S_can_illegal_channel_mode (M_wnCan + WNCAN_ILLEGAL_CHANNEL_MODE) +#define S_can_illegal_offset (M_wnCan + WNCAN_ILLEGAL_OFFSET) +#define S_can_cannot_set_error_int (M_wnCan + WNCAN_CANNOT_SET_ERRINT) +#define S_can_cannot_set_boff_int (M_wnCan + WNCAN_CANNOT_SET_BOFFINT) +#define S_can_cannot_set_wakeup_int (M_wnCan + WNCAN_CANNOT_SET_WAKEUPINT) +#define S_can_rtr_mode_not_supported (M_wnCan + WNCAN_RTR_MODE_NOT_SUPPORTED) +#define S_can_no_available_channels (M_wnCan + WNCAN_NO_AVAIL_CHANNELS) +#define S_can_incompatible_int_type (M_wnCan + WNCAN_INCOMPATIBLE_TYPE) +#define S_can_cannot_sleep_in_reset_mode (M_wnCan + WNCAN_SLEEP_IN_RESET_MODE) +#define S_can_use_auto_response_feature (M_wnCan + WNCAN_USE_AUTO_RESPONSE) +#define S_can_use_rtr_requester_channel_mode (M_wnCan + WNCAN_USE_RTR_REQ_CHN_MODE) +#define S_can_tseg2_cannot_be_zero (M_wnCan + WNCAN_TSEG_ZERO) +#define S_can_numTq_less_than_nine (M_wnCan + WNCAN_NUMTQ_LT_NINE) +#define S_can_Unknown_Error (M_wnCan + WNCAN_UNKNOWN_ERROR) + +struct WNCAN_Controller; +struct WNCAN_Board; + +typedef struct WNCAN_Device +{ + STATUS (*Init)(struct WNCAN_Device *p); + + void (*Start)(struct WNCAN_Device *p); + + void (*Stop)(struct WNCAN_Device *p); + + STATUS (*SetIntMask)(struct WNCAN_Device *pDev, WNCAN_IntType intMask); + + void (*EnableInt)(struct WNCAN_Device *pDev); + + void (*DisableInt)(struct WNCAN_Device *pDev); + + STATUS (*SetBitTiming)(struct WNCAN_Device *pDev,UCHAR tseg1, + UCHAR tseg2,UCHAR brp,UCHAR sjw, BOOL numSamples); + + UINT (*GetBaudRate)(struct WNCAN_Device *pDev, UINT* samplePoint); + + WNCAN_BusStatus (*GetBusStatus)(struct WNCAN_Device *pDev); + + WNCAN_BusError (*GetBusError)(struct WNCAN_Device *pDev); + + WNCAN_IntType (*GetIntStatus)(struct WNCAN_Device *pDev,UCHAR *chnNum); + + long (*ReadID)(struct WNCAN_Device *pDev,UCHAR chnNum, + BOOL *ext); + + STATUS (*WriteID)(struct WNCAN_Device *pDev,UCHAR chnNum, + ULONG canID,BOOL ext); + + STATUS (*ReadData)(struct WNCAN_Device *pDev,UCHAR chnNum, + UCHAR *data,UCHAR *len,BOOL *newData); + + int (*GetMessageLength)(struct WNCAN_Device *pDev, + UCHAR chnNum); + + STATUS (*WriteData)(struct WNCAN_Device *pDev,UCHAR chnNum, + UCHAR* data,UCHAR len); + + STATUS (*Tx)(struct WNCAN_Device *pDev,UCHAR chnNum); + + STATUS (*TxMsg)(struct WNCAN_Device *pDev,UCHAR chnNum, + ULONG canId,BOOL ext,UCHAR* data,UCHAR len); + + STATUS (*SetGlobalRxFilter)(struct WNCAN_Device *pDev, + long mask,BOOL ext); + + long (*GetGlobalRxFilter)(struct WNCAN_Device *pDev, BOOL ext); + + STATUS (*SetLocalMsgFilter)(struct WNCAN_Device *pDev, + UCHAR channel, long mask, BOOL ext); + + long (*GetLocalMsgFilter)(struct WNCAN_Device *pDev, UCHAR channel, BOOL ext); + + int (*IsMessageLost)(struct WNCAN_Device *pDev, + UCHAR chnNum); + + STATUS (*ClearMessageLost)(struct WNCAN_Device *pDev, + UCHAR chnNum); + + int (*IsRTR)(struct WNCAN_Device *pDev,UCHAR chnNum); + + STATUS (*SetRTR)(struct WNCAN_Device *pDev,UCHAR chnNum, BOOL rtr); + + void (*TxAbort)(struct WNCAN_Device *pDev); + + STATUS (*Sleep)(struct WNCAN_Device *pDev); + + STATUS (*WakeUp)(struct WNCAN_Device *pDev); + + void (*pISRCallback)(struct WNCAN_Device *pDev, + WNCAN_IntType intStatus, UCHAR chnNum); + + STATUS (*EnableChannel )(struct WNCAN_Device *pDev, + UCHAR chnNum, WNCAN_IntType useInterrupts); + + STATUS (*DisableChannel )(struct WNCAN_Device *pDev, + UCHAR chnNum); + + + STATUS (*WriteReg)(struct WNCAN_Device *pDev, UINT offset, + UCHAR *data, UINT length); + + STATUS (*ReadReg)(struct WNCAN_Device *pDev, UINT offset, + UCHAR *data, UINT length); + + const char *deviceName; + UINT deviceId; + + struct WNCAN_Controller *pCtrl; + struct WNCAN_Board *pBrd; + void *userData; /* user data context pointer */ + +} WNCAN_DEVICE; + +/* function prototypes */ +STATUS CAN_InstallISRCallback(struct WNCAN_Device *pDev, + void (*pFun)(struct WNCAN_Device *pDev2, + WNCAN_IntType intStatus,UCHAR chnNum)); + +struct WNCAN_Device *WNCAN_Open(UINT,UINT,UINT); + +void WNCAN_Close(struct WNCAN_Device *); + +WNCAN_ChannelMode WNCAN_GetMode(struct WNCAN_Device *pDev, UCHAR chn); + +STATUS WNCAN_SetMode(struct WNCAN_Device *pDev, UCHAR channelNum, + WNCAN_ChannelMode mode); + +STATUS WNCAN_GetTxChannel(struct WNCAN_Device *pDev,UCHAR *chnNum); + +STATUS WNCAN_GetRxChannel(struct WNCAN_Device *pDev,UCHAR *chnNum); + +STATUS WNCAN_GetRTRRequesterChannel(struct WNCAN_Device *pDev,UCHAR *chnNum); + +STATUS WNCAN_GetRTRResponderChannel(struct WNCAN_Device *pDev,UCHAR *chnNum); + +STATUS WNCAN_FreeChannel(struct WNCAN_Device *pDev,UCHAR chnNum); + +const WNCAN_VersionInfo* WNCAN_GetVersion(void); + +void wncan_core_init(void); + +/* additional functions */ +#ifdef INCLUDE_TOUCAN +STATUS TouCAN_SetPropseg(struct WNCAN_Device *pDev, UCHAR propseg); +#endif + +#ifdef INCLUDE_FLEXCAN +STATUS FlexCAN_SetPropseg(struct WNCAN_Device *pDev, UCHAR propseg); +STATUS FlexCAN_SetIntLevel(struct WNCAN_Device *pDev, UCHAR srcNum, UCHAR intLevel, UCHAR intPriorityInLevel); +STATUS FlexCAN_GetIntLevel(struct WNCAN_Device *pDev, UCHAR srcNum, UCHAR *intLevel, UCHAR *intPriorityInLevel); +#endif + +/* The following Macros map the interface function calls to the implementation +functions set by the installation routine of the device driver. */ + +/* controller independent function prototypes */ + +#define CAN_Open(a,b,c) WNCAN_Open(a,b,c) + +#define CAN_Close(a) WNCAN_Close(a) + +#define CAN_GetMode(a,b) WNCAN_GetMode(a,b) + +#define CAN_SetMode(a,b,c) WNCAN_SetMode(a,b,c) + +#define CAN_GetTxChannel(a,b) WNCAN_GetTxChannel(a,b) + +#define CAN_GetRxChannel(a,b) WNCAN_GetRxChannel(a,b) + +#define CAN_GetRTRResponderChannel(a,b) WNCAN_GetRTRResponderChannel(a,b) + +#define CAN_GetRTRRequesterChannel(a,b) WNCAN_GetRTRRequesterChannel(a,b) + +#define CAN_FreeChannel(a,b) WNCAN_FreeChannel(a,b) + +#define CAN_GetVersion() WNCAN_GetVersion() + +/* controller dependent function prototypes */ + +#define CAN_GetBusStatus(a) a->GetBusStatus(a) + +#define CAN_GetBusError(a) a->GetBusError(a) + +#define CAN_Init(a) a->Init(a) + +#define CAN_Start(a) a->Start(a) + +#define CAN_Stop(a) a->Stop(a) + +#define CAN_SetBitTiming(a,b,c,d,e,f) a->SetBitTiming(a,b,c,d,e,f) + +#define CAN_GetBaudRate(a,b) a->GetBaudRate(a,b) + +#define CAN_SetIntMask(a,b) a->SetIntMask(a,b) + +#define CAN_EnableInt(a) a->EnableInt(a) + +#define CAN_DisableInt(a) a->DisableInt(a) + +#define CAN_ReadID(a,b,c) a->ReadID(a,b,c) + +#define CAN_WriteID(a,b,c,d) a->WriteID(a,b,c,d) + +#define CAN_ReadData(a,b,c,d,e) a->ReadData(a,b,c,d,e) + +#define CAN_GetMessageLength(a,b) a->GetMessageLength(a,b) + +#define CAN_WriteData(a,b,c,d) a->WriteData(a,b,c,d) + +#define CAN_Tx(a,b) a->Tx(a,b) + +#define CAN_TxMsg(a,b,c,d,e,f) a->TxMsg(a,b,c,d,e,f) + +#define CAN_SetGlobalRxFilter(a,b,c) a->SetGlobalRxFilter(a,b,c) + +#define CAN_GetGlobalRxFilter(a,b) a->GetGlobalRxFilter(a,b) + +#define CAN_SetLocalMsgFilter(a,b,c,d) a->SetLocalMsgFilter(a,b,c,d) + +#define CAN_GetLocalMsgFilter(a, b, c) a->GetLocalMsgFilter(a, b, c) + +#define CAN_GetIntStatus(a,b) a->GetIntStatus(a,b) + +#define CAN_IsMessageLost(a,b) a->IsMessageLost(a,b) + +#define CAN_ClearMessageLost(a,b) a->ClearMessageLost(a,b) + +#define CAN_IsRTR(a,b) a->IsRTR(a,b) + +#define CAN_SetRTR(a,b,c) a->SetRTR(a,b,c) + +#define CAN_TxAbort(a) a->TxAbort(a) + +#define CAN_Sleep(a) a->Sleep(a) + +#define CAN_WakeUp(a) a->WakeUp(a) + +#define CAN_WriteReg(a,b,c,d) a->WriteReg(a,b,c,d) + +#define CAN_ReadReg(a,b,c,d) a->ReadReg(a,b,c,d) + +#define CAN_EnableChannel(a,b,c) a->EnableChannel(a,b,c) +#define CAN_DisableChannel(a,b) a->DisableChannel(a,b) + +/* variable access */ +#define CAN_GetXtalFreq(a) a->pBrd->xtalFreq +#define CAN_GetControllerType(a) a->pCtrl->ctrlType +#define CAN_GetNumChannels(a) a->pCtrl->numChn +#define CAN_SetSjw(a,b) (a->pCtrl->sjw = b) +#define CAN_SetBrp(a,b) (a->pCtrl->brp = b) +#define CAN_SetTseg1(a,b) (a->pCtrl->tseg1 = b) +#define CAN_SetTseg2(a,b) (a->pCtrl->tseg2 = b) +#define CAN_SetNumOfSamples(a,b) (a->pCtrl->samples = b) + +/*These macros are provided for backward compatibility */ +#define I82527_SetMsgObj15RxFilter(a, b) \ +CAN_SetLocalMsgFilter(a,14,b,1) + +#define TouCAN_SetMsgObj14or15RxFilter(a,b,c,d) \ +CAN_SetLocalMsgFilter(a,d,b,c) + +#include + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* WN_CAN_H */ diff --git a/h/CAN/wncanDevIO.h b/h/CAN/wncanDevIO.h new file mode 100644 index 0000000..8e864f9 --- /dev/null +++ b/h/CAN/wncanDevIO.h @@ -0,0 +1,345 @@ +/* wncanDevIO.h - WIND NET CAN Device I/O Interface header file. */ + +/* Copyright 2002-2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01e,20sep04,lsg Gave enum to setFuncSwitch an identifier +01d,17jul04,lsg Modified _wncan_ctlrconfig to access multiple ctrlSetConfig + functions for FlexCAN +01c,08apr04,lsg Added FlexCAN related info to WNCAN_CTLRCONFIG +01b,21apr04,bjn Added WNCAN_REG, WNCAN_REG_SET and WNCAN_REG_GET +01a,19Dec02,emcw created +*/ + +/* +DESCRIPTION + +This file contains the type and function definitions of the Device I/O Interface feature +of WIND NET CAN. + +NOTE + +RESTRICTIONS + +INCLUDE FILES + + CAN/wnCAN.h +*/ + +#ifndef __INCwncanDevIOh +#define __INCwncanDevIOh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* ==== Include files ==== */ + +#include +#include +#include +#include +#include +#include +#include + + +/* ==== Constants ==== */ + +#define WNCAN_LG_BUF_SIZE 200 +#define WNCAN_MAX_DATA_LEN 8 /* max #bytes in CAN message data */ +#define WNCAN_DEFAULT_RINGBUF_SIZE 4 /* default #CAN msgs in internal buffers */ + + +/* ==== WNCAN DevIO interface ioctl() commands ==== */ + +/* Base command code */ + +#define DEVIO_CANCMD_BASE 100 + +/* Device commands */ + +#define WNCAN_HALT (DEVIO_CANCMD_BASE + 1) +#define WNCAN_SLEEP (DEVIO_CANCMD_BASE + 2) +#define WNCAN_WAKE (DEVIO_CANCMD_BASE + 3) +#define WNCAN_TX_ABORT (DEVIO_CANCMD_BASE + 4) +#define WNCAN_RXCHAN_GET (DEVIO_CANCMD_BASE + 5) +#define WNCAN_TXCHAN_GET (DEVIO_CANCMD_BASE + 6) +#define WNCAN_RTRREQCHAN_GET (DEVIO_CANCMD_BASE + 7) +#define WNCAN_RTRRESPCHAN_GET (DEVIO_CANCMD_BASE + 8) +#define WNCAN_BUSINFO_GET (DEVIO_CANCMD_BASE + 9) +#define WNCAN_CONFIG_SET (DEVIO_CANCMD_BASE + 10) +#define WNCAN_CONFIG_GET (DEVIO_CANCMD_BASE + 11) + +/* Channel commands */ + +#define WNCAN_CHNCONFIG_SET (DEVIO_CANCMD_BASE + 12) +#define WNCAN_CHNCONFIG_GET (DEVIO_CANCMD_BASE + 13) +#define WNCAN_CHN_ENABLE (DEVIO_CANCMD_BASE + 14) +#define WNCAN_CHN_TX (DEVIO_CANCMD_BASE + 15) +#define WNCAN_CHNMSGLOST_GET (DEVIO_CANCMD_BASE + 16) +#define WNCAN_CHNMSGLOST_CLEAR (DEVIO_CANCMD_BASE + 17) + +/* Controller-specific commands */ + +#define WNCAN_CTLRCONFIG_SET (DEVIO_CANCMD_BASE + 18) +#define WNCAN_CTLRCONFIG_GET (DEVIO_CANCMD_BASE + 19) +/* Additinal Device commands */ + +#define WNCAN_REG_SET (DEVIO_CANCMD_BASE + 20) +#define WNCAN_REG_GET (DEVIO_CANCMD_BASE + 21) + +/* ==== CAN configuration access options ==== */ + +/* + CAN device options + Used in flags field of WNCAN_CONFIG struct +*/ + +#define WNCAN_CFG_NONE 0 /* selects no elements */ +#define WNCAN_CFG_INFO 0x1 /* selects information elements only */ +#define WNCAN_CFG_GBLFILTER 0x2 /* selects global filter only */ +#define WNCAN_CFG_BITTIMING 0x4 /* selects bit timing only */ +#define WNCAN_CFG_ALL 0x7 /* selects all elements */ + +/* + CAN channel options + Used in flags field of WNCAN_CHNCONFIG struct +*/ + +#define WNCAN_CHNCFG_NONE 0x000 /* selects no elements */ +#define WNCAN_CHNCFG_CHANNEL 0x100 /* selects channel information only */ +#define WNCAN_CHNCFG_LCLFILTER 0x200 /* selects local filter only */ +#define WNCAN_CHNCFG_RTR 0x400 /* selects RTR bit only */ +#define WNCAN_CHNCFG_MODE 0x800 /* selects channel mode only */ +#define WNCAN_CHNCFG_ALL 0xF00 /* selects all elements */ + + +/* ==== Structures used for setting/getting CAN configuration ==== */ + +/* CAN bus information */ + +typedef struct _wncan_businfo +{ + WNCAN_BusStatus busStatus; /* bus status */ + WNCAN_BusError busError; /* bus error */ +} WNCAN_BUSINFO; + + +/* CAN device configuration options */ + +typedef struct _wncan_config +{ + UINT flags; /* access options */ + + /* read-only items */ + struct + { + WNCAN_VersionInfo version; /* WNC version */ + WNCAN_ControllerType ctrlType; /* CAN controller type */ + XtalFreq xtalfreq; /* crystal frequency */ + UCHAR numChannels; /* total # of channels */ + UINT baudRate; /* computed baudrate bits/sec */ + UINT samplePoint; /* percentage of bit time at + which the bit is sampled.*/ + } info; + + /* read/write items */ + struct + { + ULONG mask; /* filter mask */ + BOOL extended; /* extended flag */ + } filter; + + struct + { + UCHAR tseg1; /* time quanta for segment 1 */ + UCHAR tseg2; /* time quanta for segment 2 */ + UCHAR brp; /* baud rate prescaler */ + UCHAR sjw; /* syncro jump width */ + BOOL oversample; /* normal or over-sampling option */ + } bittiming; + +} WNCAN_CONFIG; + + +/* CAN device register get/set configuration */ + +typedef struct _wncan_reg +{ + UINT offset; /* Register offset from base to access */ + UCHAR * pData; /* Pointer to data buffer for read/write */ + UINT length; /* Length of data in bytes to read/write */ +} WNCAN_REG; + + +/* CAN channel configuration options */ + +typedef struct _wncan_chnconfig +{ + UINT flags; /* access options */ + + /* local filter mask */ + struct + { + ULONG mask; /* filter mask */ + BOOL extended; /* extended flag */ + } filter; + + struct + { + ULONG id; /* CAN ID */ + BOOL extId; /* is ID extended or not? */ + UCHAR len; /* length */ + UCHAR data[WNCAN_MAX_DATA_LEN]; /* message data */ + } channel; + + BOOL rtr; /* RTR bit setting */ + WNCAN_ChannelMode mode; /* channel mode */ + +} WNCAN_CHNCONFIG; + + +/* CAN controller-specific configuration options */ + +typedef struct _wncan_ctlrconfig +{ + WNCAN_ControllerType ctlrType; + + union + { + struct + { + UCHAR propseg; /* propagation segment */ + } toucanData; + + struct + { + struct intLevelInfo_t{ + UCHAR intSrcNum; /*flexcan interrupt source number, always an input for WNCAN_CTLRCONFIG_SET + and WNCAN_CTLRCONFIG_GET */ + UCHAR intLevel; /*flexcan interrupt level, for WNCAN_CTLRCONFIG_SET: input, + for WNCAN_CTLRCONFIG_GET: output */ + UCHAR intPrioLevel;/* priority within interrupt level, for WNCAN_CTLRCONFIG_SET: input, + for WNCAN_CTLRCONFIG_GET: output */ + } intLevelInfo; + + UCHAR propseg; + + enum setFuncSwitch_t{ + WNCAN_FLEXCAN_DEVIO_SET_INTLEVEL=0, + WNCAN_FLEXCAN_DEVIO_SET_PROPSEG + }setFuncSwitch; + + } flexcanData; + + /* Other controller-specific structs can be defined here */ + ULONG dummy; /* placeholder for future defs */ + + } ctlrData; + +} WNCAN_CTLRCONFIG; + +/* CAN message */ + +typedef struct _wncan_chnmsg +{ + ULONG id; /* CAN ID */ + BOOL extId; /* is ID extended or not? */ + BOOL rtr; /* remote frame transmit request */ + UCHAR len; /* message length */ + UCHAR data[WNCAN_MAX_DATA_LEN]; /* message data */ +} WNCAN_CHNMSG; + + + +/* ==== Internal Device I/O Structures (maybe move to private header file?) ==== */ + +typedef enum +{ + FD_WNCAN_NONE, + FD_WNCAN_DEVICE, + FD_WNCAN_CHANNEL +} WNCAN_FD_TYPE; + + +typedef STATUS (*CTRLRCONFIGFNTYPE)(void*, void*); + +typedef struct /* DevIO driver information */ +{ + DEV_HDR devHdr; /* standard I/O System device header */ + WNCAN_BoardType boardType; /* CAN board type */ + int boardIdx; /* CAN board index */ + int ctlrIdx; /* CAN controller index */ + int numOpenChans; /* number of open CAN channels */ + BOOL isDeviceOpen; /* whether CAN device has been init'ed; + set after CAN_Init() called */ + SEM_ID mutex; /* mutex semaphore for memory access */ + WNCAN_DEVICE *wncDevice; /* WNCAN device data structure */ + + CTRLRCONFIGFNTYPE ctrlSetConfig; /* controller-specific functions */ + CTRLRCONFIGFNTYPE ctrlGetConfig; + +} WNCAN_DEVIO_DRVINFO; + + +typedef struct _devio_fdinfo /* DevIO file descriptor table info */ +{ + WNCAN_DEVIO_DRVINFO* wnDevIODrv; /* pointer to WNCAN_DEVIO_DRVINFO struct */ + WNCAN_FD_TYPE devType; /* indicates which type of data stored here, + device or channel */ + SEL_WAKEUP_LIST selWakeupList; /* wakeup select list */ + + union + { + /* CAN device info */ + struct { + struct _devio_fdinfo **chnInfo; /* allocated channel infos */ + } device; + + /* CAN channel info */ + struct { + BOOL enabled; /* channel up and running flag */ + int flag; /* channel access flag */ + ULONG channel; /* channel identifier */ + WNCAN_IntType intType; /* interrupt status type, WNCAN_INT_TX + or WNCAN_INT_RX */ + RING_ID inputBuf; /* input data buffer */ + RING_ID outputBuf; /* output data buffer */ + } channel; + } fdtype; + +} WNCAN_DEVIO_FDINFO; + + +/* ==== Function Prototypes ==== */ + +#if defined(__STDC__) +extern STATUS wncDevIODevCreate(char*,int,int,int,WNCAN_DEVIO_DRVINFO**); +extern int wncDevIOCreate(WNCAN_DEVIO_DRVINFO*, char*, int); +extern int wncDevIODelete(WNCAN_DEVIO_DRVINFO*, char*); +extern int wncDevIOOpen(WNCAN_DEVIO_DRVINFO*, char*, int, int); +extern STATUS wncDevIOClose(WNCAN_DEVIO_FDINFO*); +extern int wncDevIOReadBuf(WNCAN_DEVIO_FDINFO*, char*, size_t); +extern int wncDevIOWriteBuf(WNCAN_DEVIO_FDINFO*, char*, size_t); +STATUS wncDevIOIoctl(WNCAN_DEVIO_FDINFO*, int, int); +#else +extern STATUS wncDevIODevCreate(); +extern int wncDevIOCreate(); +extern int wncDevIODelete(); +extern int wncDevIOOpen(); +extern STATUS wncDevIOClose(); +extern int wncDevIOReadBuf(); +extern int wncDevIOWriteBuf(); +STATUS wncDevIOIoctl(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwncanDevIOh */ diff --git a/h/CAN/wncan_api.h b/h/CAN/wncan_api.h new file mode 100644 index 0000000..63f34b7 --- /dev/null +++ b/h/CAN/wncan_api.h @@ -0,0 +1,203 @@ +/* wncan_api.h - Wind River's CAN Common API header file. */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01, 18Dec01, jac created +*/ + +/* +DESCRIPTION + +This file contains the function definitions of Wind River's CAN Common API. + +NOTE + +For normal usage, these function calls are replaced by equivalent macro +definitions in CAN/wnCAN.h + +RESTRICTIONS + +INCLUDE FILES + +CAN/wnCAN.h +CAN/canBoard.h + +*/ + +#ifndef WNCAN_API_H +#define WNCAN_API_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Uncomment the next line if you want to use actual function + definitions for the CAN Common API */ +/* #define USE_CAN_FUNCTION_DEFS */ + +#ifdef USE_CAN_FUNCTION_DEFS +#undef CAN_Open +#undef CAN_Close +#undef CAN_GetMode +#undef CAN_SetMode +#undef CAN_GetTxChannel +#undef CAN_GetRxChannel +#undef CAN_GetRTRRequesterChannel +#undef CAN_GetRTRResponderChannel +#undef CAN_FreeChannel +#undef CAN_GetVersion +#undef CAN_GetBusStatus +#undef CAN_GetBusError +#undef CAN_Init +#undef CAN_Start +#undef CAN_Stop +#undef CAN_SetBitTiming +#undef CAN_GetBaudRate +#undef CAN_SetIntMask +#undef CAN_EnableInt +#undef CAN_DisableInt +#undef CAN_ReadID +#undef CAN_WriteID +#undef CAN_ReadData +#undef CAN_GetMessageLength +#undef CAN_WriteData +#undef CAN_Tx +#undef CAN_TxMsg +#undef CAN_SetGlobalRxFilter +#undef CAN_GetGlobalRxFilter +#undef CAN_SetLocalMsgFilter +#undef CAN_GetLocalMsgFilter +#undef CAN_GetIntStatus +#undef CAN_IsMessageLost +#undef CAN_ClearMessageLost +#undef CAN_SetRTR +#undef CAN_IsRTR +#undef CAN_TxAbort +#undef CAN_Sleep +#undef CAN_WakeUp +#undef CAN_EnableChannel +#undef CAN_DisableChannel +#undef CAN_WriteReg +#undef CAN_ReadReg + +/* variable access */ +#undef CAN_GetXtalFreq +#undef CAN_GetControllerType +#undef CAN_GetNumChannels + +/* controller independent function prototypes */ +struct WNCAN_Device *CAN_Open(unsigned int brdType, unsigned int brdNdx, + unsigned int ctrlNdx); + +void CAN_Close(struct WNCAN_Device *pDev); + +WNCAN_ChannelMode CAN_GetMode(struct WNCAN_Device *pDev, UCHAR chn); + +STATUS CAN_SetMode(struct WNCAN_Device *pDev, UCHAR channelNum, + WNCAN_ChannelMode mode); + +STATUS CAN_GetTxChannel(struct WNCAN_Device *pDev, UCHAR *channelNum); + +STATUS CAN_GetRxChannel(struct WNCAN_Device *pDev, UCHAR *channelNum); + +STATUS CAN_GetRTRRequesterChannel(struct WNCAN_Device *pDev, UCHAR *channelNum); + +STATUS CAN_GetRTRResponderChannel(struct WNCAN_Device *pDev, UCHAR *channelNum); + +STATUS CAN_FreeChannel(struct WNCAN_Device *pDev, UCHAR channelNum); + +const WNCAN_VersionInfo* CAN_GetVersion(void); + +/* controller dependent function prototypes */ + +WNCAN_BusStatus CAN_GetBusStatus(struct WNCAN_Device *pDev); + +WNCAN_BusError CAN_GetBusError(struct WNCAN_Device *pDev); + +STATUS CAN_Init(struct WNCAN_Device *pDev); + +void CAN_Start(struct WNCAN_Device *pDev); + +void CAN_Stop(struct WNCAN_Device *pDev); + +STATUS CAN_SetBitTiming(struct WNCAN_Device *pDev, UCHAR tseg1, UCHAR tseg2, + UCHAR brp, UCHAR sjw, BOOL numSamples); + +UINT CAN_GetBaudRate(struct WNCAN_Device *pDev, UINT* samplePoint); + +STATUS CAN_SetIntMask(struct WNCAN_Device *pDev, WNCAN_IntType intMask); + +void CAN_EnableInt(struct WNCAN_Device *pDev); + +void CAN_DisableInt(struct WNCAN_Device *pDev); + +long CAN_ReadID(struct WNCAN_Device *pDev, UCHAR channelNum, BOOL* ext); + +STATUS CAN_WriteID(struct WNCAN_Device *pDev, UCHAR chnNum, ULONG canID, BOOL ext); + +STATUS CAN_ReadData(struct WNCAN_Device *pDev, UCHAR chnNum, UCHAR *data, + UCHAR *len, BOOL *newData); + +int CAN_GetMessageLength(struct WNCAN_Device *pDev, UCHAR channelNum); + +STATUS CAN_WriteData(struct WNCAN_Device *pDev, UCHAR channelNum, + UCHAR *data, UCHAR len); + +STATUS CAN_Tx(struct WNCAN_Device *pDev, UCHAR channelNum); + +STATUS CAN_TxMsg(struct WNCAN_Device *pDev, UCHAR channelNum, ULONG canId, + BOOL ext, UCHAR *data, UCHAR len); + +STATUS CAN_SetGlobalRxFilter(struct WNCAN_Device *pDev, long mask, BOOL ext); + +long CAN_GetGlobalRxFilter(struct WNCAN_Device *pDev, BOOL ext); + +STATUS CAN_SetLocalMsgFilter(struct WNCAN_Device *pDev, UCHAR channel, long mask, BOOL ext); + +long CAN_GetLocalMsgFilter(struct WNCAN_Device *pDev, UCHAR channel, BOOL ext); + +WNCAN_IntType CAN_GetIntStatus(struct WNCAN_Device *pDev, UCHAR *channelNum); + +int CAN_IsMessageLost(struct WNCAN_Device *pDev, UCHAR channelNum); + +STATUS CAN_ClearMessageLost(struct WNCAN_Device *pDev, UCHAR channelNum); + +STATUS CAN_SetRTR(struct WNCAN_Device *pDev, UCHAR channelNum, BOOL rtr); + +int CAN_IsRTR(struct WNCAN_Device *pDev, UCHAR channelNum); + +void CAN_TxAbort(struct WNCAN_Device *pDev); + +STATUS CAN_Sleep(struct WNCAN_Device *pDev); + +STATUS CAN_WakeUp(struct WNCAN_Device *pDev); + +STATUS CAN_EnableChannel(struct WNCAN_Device *pDev, UCHAR channelNum, + WNCAN_IntType intSetting); + +STATUS CAN_DisableChannel(struct WNCAN_Device *pDev, UCHAR channelNum); + +STATUS CAN_WriteReg(struct WNCAN_Device *pDev, UINT offset, + UCHAR *data, UINT length); + +STATUS CAN_ReadReg(struct WNCAN_Device *pDev, UINT offset, + UCHAR *data, UINT length); + +XtalFreq CAN_GetXtalFreq(struct WNCAN_Device *pDev); + +WNCAN_ControllerType CAN_GetControllerType(struct WNCAN_Device *pDev); + +UCHAR CAN_GetNumChannels(struct WNCAN_Device *pDev); + +#endif /* USE_CAN_FUNCTION_DEFS */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* WNCAN_API_H */ diff --git a/h/ConnectionPoint.h b/h/ConnectionPoint.h new file mode 100644 index 0000000..da0ec51 --- /dev/null +++ b/h/ConnectionPoint.h @@ -0,0 +1,311 @@ +/* ConnectionPoint.h generated by WIDL Version 2.2.1 on 06-Dec-01 at 11:42:32 AM */ + +#include "comBase.h" + +#ifndef __INCConnectionPoint_h +#define __INCConnectionPoint_h + + +#include "comCoreTypes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int include_ConnectionPoint (void); + +#ifndef __IConnectionPoint_FWD_DEFINED__ +#define __IConnectionPoint_FWD_DEFINED__ +typedef interface IConnectionPoint IConnectionPoint; +#endif /* __IConnectionPoint_FWD_DEFINED__ */ + +#ifndef __IConnectionPointContainer_FWD_DEFINED__ +#define __IConnectionPointContainer_FWD_DEFINED__ +typedef interface IConnectionPointContainer IConnectionPointContainer; +#endif /* __IConnectionPointContainer_FWD_DEFINED__ */ + +#ifndef __IEnumConnections_FWD_DEFINED__ +#define __IEnumConnections_FWD_DEFINED__ +typedef interface IEnumConnections IEnumConnections; +#endif /* __IEnumConnections_FWD_DEFINED__ */ + +#ifndef __IEnumConnectionPoints_FWD_DEFINED__ +#define __IEnumConnectionPoints_FWD_DEFINED__ +typedef interface IEnumConnectionPoints IEnumConnectionPoints; +#endif /* __IEnumConnectionPoints_FWD_DEFINED__ */ + +typedef IConnectionPoint* PCONNECTIONPOINT; + +typedef IConnectionPoint* LPCONNECTIONPOINT; + +typedef IConnectionPointContainer* PCONNECTIONPOINTCONTAINER; + +typedef IConnectionPointContainer* LPCONNECTIONPOINTCONTAINER; + +typedef IEnumConnections* PENUMCONNECTIONS; + +typedef IEnumConnections* LPENUMCONNECTIONS; + +struct tagCONNECTDATA +{ +IUnknown* pUnk; +DWORD dwCookie; +}; + +typedef struct tagCONNECTDATA CONNECTDATA; + +typedef struct tagCONNECTDATA* PCONNECTDATA; + +typedef struct tagCONNECTDATA* LPCONNECTDATA; + +typedef IEnumConnectionPoints* PENUMCONNECTIONPOINTS; + +typedef IEnumConnectionPoints* LPENUMCONNECTIONPOINTS; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, GetConnectionInterface, (IConnectionPoint* pThis, IID* piid)); + +#define IConnectionPoint_GetConnectionInterface(pThis, piid) pThis->lpVtbl->GetConnectionInterface(COM_ADJUST_THIS(pThis), piid) + + COM_VTBL_ENTRY (HRESULT, GetConnectionPointContainer, (IConnectionPoint* pThis, IConnectionPointContainer** ppCPC)); + +#define IConnectionPoint_GetConnectionPointContainer(pThis, ppCPC) pThis->lpVtbl->GetConnectionPointContainer(COM_ADJUST_THIS(pThis), ppCPC) + + COM_VTBL_ENTRY (HRESULT, Advise, (IConnectionPoint* pThis, IUnknown* pUnkSink, DWORD* pdwCookie)); + +#define IConnectionPoint_Advise(pThis, pUnkSink, pdwCookie) pThis->lpVtbl->Advise(COM_ADJUST_THIS(pThis), pUnkSink, pdwCookie) + + COM_VTBL_ENTRY (HRESULT, Unadvise, (IConnectionPoint* pThis, DWORD dwCookie)); + +#define IConnectionPoint_Unadvise(pThis, dwCookie) pThis->lpVtbl->Unadvise(COM_ADJUST_THIS(pThis), dwCookie) + + COM_VTBL_ENTRY (HRESULT, EnumConnections, (IConnectionPoint* pThis, IEnumConnections** ppEnum)); + +#define IConnectionPoint_EnumConnections(pThis, ppEnum) pThis->lpVtbl->EnumConnections(COM_ADJUST_THIS(pThis), ppEnum) + + COM_VTBL_END + } IConnectionPointVtbl; + +#ifdef __cplusplus + +interface IConnectionPoint : public IUnknown +{ +virtual HRESULT GetConnectionInterface (IID* piid) =0; + +virtual HRESULT GetConnectionPointContainer (IConnectionPointContainer** ppCPC) =0; + +virtual HRESULT Advise (IUnknown* pUnkSink, DWORD* pdwCookie) =0; + +virtual HRESULT Unadvise (DWORD dwCookie) =0; + +virtual HRESULT EnumConnections (IEnumConnections** ppEnum) =0; + +}; + +#else + +/* C interface definition for IConnectionPoint */ + +interface IConnectionPoint + { + const IConnectionPointVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IConnectionPoint; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, EnumConnectionPoints, (IConnectionPointContainer* pThis, IEnumConnectionPoints** ppEnum)); + +#define IConnectionPointContainer_EnumConnectionPoints(pThis, ppEnum) pThis->lpVtbl->EnumConnectionPoints(COM_ADJUST_THIS(pThis), ppEnum) + + COM_VTBL_ENTRY (HRESULT, FindConnectionPoint, (IConnectionPointContainer* pThis, REFIID riid, IConnectionPoint** ppCP)); + +#define IConnectionPointContainer_FindConnectionPoint(pThis, riid, ppCP) pThis->lpVtbl->FindConnectionPoint(COM_ADJUST_THIS(pThis), riid, ppCP) + + COM_VTBL_END + } IConnectionPointContainerVtbl; + +#ifdef __cplusplus + +interface IConnectionPointContainer : public IUnknown +{ +virtual HRESULT EnumConnectionPoints (IEnumConnectionPoints** ppEnum) =0; + +virtual HRESULT FindConnectionPoint (REFIID riid, IConnectionPoint** ppCP) =0; + +}; + +#else + +/* C interface definition for IConnectionPointContainer */ + +interface IConnectionPointContainer + { + const IConnectionPointContainerVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IConnectionPointContainer; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, Next, (IEnumConnections* pThis, ULONG cConnections, CONNECTDATA* rgcd, ULONG* lpcFetched)); + +#define IEnumConnections_Next(pThis, cConnections, rgcd, lpcFetched) pThis->lpVtbl->Next(COM_ADJUST_THIS(pThis), cConnections, rgcd, lpcFetched) + + COM_VTBL_ENTRY (HRESULT, Skip, (IEnumConnections* pThis, ULONG cConnections)); + +#define IEnumConnections_Skip(pThis, cConnections) pThis->lpVtbl->Skip(COM_ADJUST_THIS(pThis), cConnections) + + COM_VTBL_ENTRY (HRESULT, Reset, (IEnumConnections* pThis)); + +#define IEnumConnections_Reset(pThis) pThis->lpVtbl->Reset(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, Clone, (IEnumConnections* pThis, IEnumConnections** ppEnum)); + +#define IEnumConnections_Clone(pThis, ppEnum) pThis->lpVtbl->Clone(COM_ADJUST_THIS(pThis), ppEnum) + + COM_VTBL_END + } IEnumConnectionsVtbl; + +#ifdef __cplusplus + +interface IEnumConnections : public IUnknown +{ +virtual HRESULT Next (ULONG cConnections, CONNECTDATA* rgcd, ULONG* lpcFetched) =0; + +virtual HRESULT Skip (ULONG cConnections) =0; + +virtual HRESULT Reset () =0; + +virtual HRESULT Clone (IEnumConnections** ppEnum) =0; + +}; + +#else + +/* C interface definition for IEnumConnections */ + +interface IEnumConnections + { + const IEnumConnectionsVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IEnumConnections; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, Next, (IEnumConnectionPoints* pThis, ULONG cConnections, IConnectionPoint** rgpcn, ULONG* lpcFetched)); + +#define IEnumConnectionPoints_Next(pThis, cConnections, rgpcn, lpcFetched) pThis->lpVtbl->Next(COM_ADJUST_THIS(pThis), cConnections, rgpcn, lpcFetched) + + COM_VTBL_ENTRY (HRESULT, Skip, (IEnumConnectionPoints* pThis, ULONG cConnections)); + +#define IEnumConnectionPoints_Skip(pThis, cConnections) pThis->lpVtbl->Skip(COM_ADJUST_THIS(pThis), cConnections) + + COM_VTBL_ENTRY (HRESULT, Reset, (IEnumConnectionPoints* pThis)); + +#define IEnumConnectionPoints_Reset(pThis) pThis->lpVtbl->Reset(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, Clone, (IEnumConnectionPoints* pThis, IEnumConnectionPoints** ppEnum)); + +#define IEnumConnectionPoints_Clone(pThis, ppEnum) pThis->lpVtbl->Clone(COM_ADJUST_THIS(pThis), ppEnum) + + COM_VTBL_END + } IEnumConnectionPointsVtbl; + +#ifdef __cplusplus + +interface IEnumConnectionPoints : public IUnknown +{ +virtual HRESULT Next (ULONG cConnections, IConnectionPoint** rgpcn, ULONG* lpcFetched) =0; + +virtual HRESULT Skip (ULONG cConnections) =0; + +virtual HRESULT Reset () =0; + +virtual HRESULT Clone (IEnumConnectionPoints** ppEnum) =0; + +}; + +#else + +/* C interface definition for IEnumConnectionPoints */ + +interface IEnumConnectionPoints + { + const IEnumConnectionPointsVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IEnumConnectionPoints; + +#ifdef __cplusplus +} +#endif + + + +#endif /* __INCConnectionPoint_h */ + + diff --git a/h/a_out.h b/h/a_out.h new file mode 100644 index 0000000..36f4b7d --- /dev/null +++ b/h/a_out.h @@ -0,0 +1,200 @@ +/* a_out.h - a.out object module header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01p,22sep92,rrr added support for c++ +01o,04jul92,jcf cleaned up. +01n,19jun92,rrr changed UINT to unsigned to work with the hsp stuff +01m,26may92,rrr the tree shuffle + -moved define of a_machtype into else part of HOST_SUN +01l,15may92,jmm changed UINT8 bitfields to unsigned + removed a comma from SPARC enum +01k,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed TINY and UTINY to INT8 and UINT8 + -changed copyright notice +01j,03sep91,wmd removed typedef of NLIST, put back inadvertently by last revision. +01i,02aug91,ajm added mips target support +01h,21may91,jcc removed useless typedef of NLIST, identical to nlist. +01g,15may91,elr added #ifdef HOST_MOTOROLA +01f,05oct90,shl added copyright notice. + made #endif ANSI style. +01e,05oct90,lpf added N_DATOFF macro. +01d,30apr90,gae added kludge of a_machtype for HOST_HP. +01c,11sep89,shl removed some of the #ifdef HOST_SUN so vxWorks can be + made on other hosts as well. + added #ifdef HOST_ISI. +01b,19apr89,ecs conditional to reflect SunOS 4.0. +01a,16feb87,llk created. +*/ + +/* +This file reflects Unix 4.2 a.out format. +*/ + +#ifndef __INCa_outh +#define __INCa_outh + +#ifdef __cplusplus +extern "C" { +#endif + +struct exec + { +#if defined(HOST_SUN) + unsigned a_dynamic:1; /* has a __DYNAMIC */ + unsigned a_toolversion:7; /* version of toolset used to create file */ + unsigned a_machtype: 8; /* machine type */ + unsigned a_magic:16; /* magic number */ +#else + long a_magic; /* magic number */ +#define a_machtype a_magic +#endif /* HOST_SUN */ + + unsigned long a_text; /* size of text segment */ + unsigned long a_data; /* size of initialized data */ + unsigned long a_bss; /* size of uninitialized data */ + unsigned long a_syms; /* size of symbol table */ + unsigned long a_entry; /* entry point */ + unsigned long a_trsize; /* size of text relocation */ + unsigned long a_drsize; /* size of data relocation */ + }; + + +/* machine types */ + +#define M_OLDSUN2 0 /* old sun-2 (or not sun at all) */ +#define M_68010 1 /* runs on either 68010 or 68020 */ +#define M_68020 2 /* runs only on 68020 */ +#define M_SPARC 3 /* runs only on SPARC */ +#define M_R3000 4 /* runs only on R3000 */ + +#define ZMAGIC 0413 /* demand load format */ + +/* + * Macros which take exec structures as arguments and tell whether + * the file has a reasonable magic number or offsets to text|symbols|strings. + */ + +#define N_OLDOFF(x) \ + ((x).a_magic==ZMAGIC ? 0 : sizeof (struct exec)) + +#define N_TXTOFF(x) \ + (sizeof (struct exec)) + +#define N_DATOFF(x) \ + (N_TXTOFF(x) + (x).a_text) + +#define N_SYMOFF(x) \ + (N_OLDOFF(x) + (x).a_text+(x).a_data + (x).a_trsize+(x).a_drsize) + +#define N_STROFF(x) \ + (N_SYMOFF(x) + (x).a_syms) + +typedef struct /* RINFO_68K - 680X0 relocation datum (a_machtype != M_SPARC) */ { + unsigned r_address; /* address which is relocated */ + unsigned r_symbolnum:24; /* local symbol ordinal */ + unsigned r_pcrel : 1; /* was relocated pc relative already */ + unsigned r_length : 2; /* 0=byte, 1=word, 2=long */ + unsigned r_extern : 1; /* does not include value of sym referenced */ + unsigned r_baserel : 1; /* linkage table relative */ + unsigned r_jmptable : 1; /* pc-relative to jump table */ + unsigned r_relative : 1; /* relative relocation */ + unsigned : 1; /* */ + } RINFO_68K; + + +typedef enum /* RTYPE_SPARC - sparc relocation types */ + { + RELOC_8, RELOC_16, RELOC_32, /* simplest relocs */ + RELOC_DISP8, RELOC_DISP16, RELOC_DISP32, /* Disp's (pc-rel) */ + RELOC_WDISP30, RELOC_WDISP22, /* SR word disp's */ + RELOC_HI22, RELOC_22, /* SR 22-bit relocs */ + RELOC_13, RELOC_LO10, /* SR 13&10-bit relocs*/ + RELOC_SFA_BASE, RELOC_SFA_OFF13, /* SR S.F.A. relocs */ + RELOC_BASE10, RELOC_BASE13, RELOC_BASE22, /* base_relative pic */ + RELOC_PC10, RELOC_PC22, /* special pc-rel pic */ + RELOC_JMP_TBL, /* jmp_tbl_rel in pic */ + RELOC_SEGOFF16, /* ShLib offset-in-seg*/ + RELOC_GLOB_DAT, RELOC_JMP_SLOT, RELOC_RELATIVE /* rtld relocs */ + } RTYPE_SPARC; + + +typedef struct /* RINFO_SPARC - sparc reloc datum (a_machtype == M_SPARC) */ + { + unsigned r_address; /* relocation addr (offset in segment)*/ + unsigned r_index :24; /* segment index or symbol index */ + unsigned r_extern : 1; /* if F, r_index==SEG#; if T, SYM idx */ + unsigned : 2; /* */ + unsigned r_type : 5; /* type of relocation to perform */ + long r_addend; /* addend for relocation value */ + } RINFO_SPARC; + +typedef struct /* RINFO_MIPS - mips reloc datum (a_machtype == M_R3000) */ + { + int r_address; /* address which is relocated */ + unsigned int + r_symbolnum:24, /* local symbol ordinal */ + r_pcrel:1, /* was relocated pc relative already */ + r_length:2, /* 0=byte, 1=word, 2=long */ + r_extern:1, /* does not include value of sym referenced */ + r_type:4; /* relocation type */ + } RINFO_MIPS; + +/* + * Format of a symbol table entry; this file is included by + * and should be used if you aren't interested the a.out header + * or relocation information. + */ + +struct nlist + { + union + { + char *n_name; /* for use when in-core */ + long n_strx; /* index into file string table */ + } n_un; + unsigned char n_type; /* type flag, i.e. N_TEXT etc; see below */ + char n_other; /* unused */ + short n_desc; /* see */ + unsigned long n_value; /* value of this symbol (or sdb offset) */ + }; + +#define n_hash n_desc /* used internally by ld */ + +/* + * Simple values for n_type. + */ + +#define N_UNDF 0x0 /* undefined */ +#define N_ABS 0x2 /* absolute */ +#define N_TEXT 0x4 /* text */ +#define N_DATA 0x6 /* data */ +#define N_BSS 0x8 /* bss */ +#define N_COMM 0x12 /* common (internal to ld) */ +#define N_FN 0x1f /* file name symbol */ + +#define N_EXT 01 /* external bit, or'ed in */ +#define N_TYPE 0x1e /* mask for all the type bits */ + +/* + * Sdb entries have some of the N_STAB bits set. + * These are given in + */ + +#define N_STAB 0xe0 /* if any of these bits set, a SDB entry */ + +/* + * Format for namelist values. + */ + +#define N_FORMAT "%08x" + +#ifdef __cplusplus +} +#endif + +#endif /* __INCa_outh */ diff --git a/h/adrSpaceLib.h b/h/adrSpaceLib.h new file mode 100644 index 0000000..3ff2e49 --- /dev/null +++ b/h/adrSpaceLib.h @@ -0,0 +1,89 @@ +/* adrSpaceLib.h - Address Space Library header */ + +/* Copyright 1998-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01s,22sep04,zl more comments +01r,31aug04,zl moved private APIs to private header file +01q,07jun04,tam added definition for option ADR_SPACE_OPT_RTP +01p,15apr04,yp Adding sysPhysMemDesc and numElems to ADR_SPACE_INFO for + testing + Added prototype for adrSpaceRAMAddToPool() +01o,05apr04,yp reworking adrSpaceLibInit call +01n,18mar04,yp removing unused prototype adrSpaceReserve + adding the kernel virtual page pool ID to ADR_SPACE_INFO + adding adrSpaceLibInit params to ADR_SPACE_INFO +01m,25nov03,yp using reserved field in page pool options for kernel space +01m,30nov03,yp adding error ADDRESS_OUT_OF_RANGE and removing PD related + errors; fixing prototype for adrSpaceLibInit; +01l,11nov03,yp adjusting ADR_SPACE_INFO structure for base 6 +01k,16oct03,yp proted to base 6 +01j,31aug00,pfl added S_adrSpaceLib_ALLOC_UNIT_IS_INVALID +01i,17aug00,tam added ADR_SPACE_OPT_KERNEL_PD +01h,13jun99,map added master page pools to ADR_SPACE_INFO struct. +01g,27mar00,map support for shared library and IO address space. +01f,05nov99,map added support for virtual regions. +01e,30apr99,map added support for appl PD region. removed sub-region support. +01d,28apr99,wkn added #include pgPoolLibP.h +01c,06apr99,map added adrSpace options, fixed prototypes. +01b,08feb99,tam added adrSpaceBaseGet(). +01a,16sep98,map written. +*/ + +#ifndef __INCadrSpaceLibh +#define __INCadrSpaceLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" + +/* errnos */ + +#define S_adrSpaceLib_LIB_NOT_INITIALIZED (M_adrSpaceLib | 1) +#define S_adrSpaceLib_CANNOT_REINITIALIZE (M_adrSpaceLib | 2) +#define S_adrSpaceLib_PARAMETER_NOT_ALIGNED (M_adrSpaceLib | 3) +#define S_adrSpaceLib_REGION_NOT_AVAILABLE (M_adrSpaceLib | 4) +#define S_adrSpaceLib_VIRT_ADRS_NOT_ALIGNED (M_adrSpaceLib | 5) +#define S_adrSpaceLib_SIZE_IS_INVALID (M_adrSpaceLib | 6) +#define S_adrSpaceLib_INVALID_PARAMETER (M_adrSpaceLib | 7) +#define S_adrSpaceLib_VIRTUAL_OVERLAP (M_adrSpaceLib | 8) +#define S_adrSpaceLib_PHYSICAL_OVERLAP (M_adrSpaceLib | 9) +#define S_adrSpaceLib_ADDRESS_OUT_OF_RANGE (M_adrSpaceLib |10) +#define S_adrSpaceLib_INSUFFICIENT_SPACE_IN_RGN (M_adrSpaceLib |11) +#define S_adrSpaceLib_REGION_CONFLICT (M_adrSpaceLib |12) + +/* typedefs */ + +typedef struct adr_space_info + { + UINT physAllocUnit; /* physical space allocation unit */ + UINT physTotalPages; /* total system RAM physical pages*/ + UINT physFreePages; /* unmapped system RAM physical pages */ + UINT physMaxSize; /* largest unmapped system RAM block */ + UINT kernelAllocUnit; /* kernel region allocation unit */ + UINT kernelTotalPages; /* kernel region total pages */ + UINT kernelFreePages; /* kernel region unmapped pages */ + UINT kernelMaxSize; /* largest unmapped blk in kernel rgn */ + UINT userAllocUnit; /* user region allocation unit */ + UINT userTotalPages; /* user region total pages */ + UINT userFreePages; /* user region unmapped pages */ + UINT userMaxSize; /* largest unmapped blk in user rgn */ + } ADR_SPACE_INFO; + +/* function prototypes */ + +extern STATUS adrSpaceInfoGet (ADR_SPACE_INFO *pInfo); +extern STATUS adrSpaceRAMAddToPool (PHYS_ADDR startAddr, UINT size); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCadrSpaceLibh */ diff --git a/h/adrSpaceShow.h b/h/adrSpaceShow.h new file mode 100644 index 0000000..a9160ce --- /dev/null +++ b/h/adrSpaceShow.h @@ -0,0 +1,28 @@ +/* adrSpaceShow.h - address space show library header file */ + +/* Copyright 2000-1004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,31aug04,zl moved private APIs to private header file +01b,12nov03,yp adding declaration for init routine +01a,12jun00,map written. +*/ + +#ifndef __INCadrSpaceShowLibh +#define __INCadrSpaceShowLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* funtion declarations */ + +extern STATUS adrSpaceShow (UINT level); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCadrSpaceShowLibh */ diff --git a/h/aimCacheLib.h b/h/aimCacheLib.h new file mode 100644 index 0000000..73ebbc1 --- /dev/null +++ b/h/aimCacheLib.h @@ -0,0 +1,249 @@ +/* aimCacheLib.h - AIM header for Cache Functions */ + +/* + * Copyright (c) 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01g,24aug05,h_k converted INCLUDE_CACHE_xxx to arch feature. +01f,19jul05,mil Scaled out features for minimal kernel. +01e,19nov03,scm flush out cache AIM lock/unlock... +01d,22oct03,jb Incorporating changes from inspection +01d,24sep03,jb Continuing Development +01c,09jun03,jb Continue development +01b,01may03,jb Continue development +01a,04apr03,jb written +*/ + +#ifndef __INCaimCacheLibh +#define __INCaimCacheLibh + +/* Includes Section */ + +#include "cacheLib.h" +#include "vwModNum.h" + +/* Defines Section */ + +/* + * AIM cache errors + */ + +/* temporary until vwModNum.h is updated */ + +#define M_aimcacheLib (190 << 16) + +enum aimCacheErrors { + S_aimCacheLib_UNKNOWN_CACHE_TYPE = (M_aimcacheLib + 1 ), + S_aimCacheLib_UNSUPPORTED_CACHE_FUNC, + S_aimCacheLib_UNKNOWN_CACHE_OP +}; + +/* definitions of function argument types */ + +#define C_FLG_MASK 0xFFFFFF00 /* Extract function types */ +#define C_FLG_OP_MASK 0x000000FF /* Extract cache operation */ +#define C_FLG_NOOP 0x00000100 /* Operation not supported */ +#define C_FLG_MGMT 0x00000200 /* Management function, enable/disable */ +#define C_FLG_VIRT 0x00000400 /* Function takes a Virtual Address */ +#ifdef _WRS_SUPPORT_CACHE_ISPHYSICAL +#define C_FLG_PHYS 0x00000800 /* Function takes a Physical Address */ +#endif /* _WRS_SUPPORT_CACHE_ISPHYSICAL */ +#ifdef _WRS_SUPPORT_CACHE_ISINDEXED +#define C_FLG_IDX_ONED 0x00001000 /* Function operates on a Indexed, */ + /* one dimensional array */ +#define C_FLG_IDX_TWOD 0x00002000 /* Function operates on a Indexed, */ + /* two dimensional array */ +#endif /* _WRS_SUPPORT_CACHE_ISINDEXED */ +#define C_FLG_ALL 0x00004000 /* Operates on the entire cache*/ +#define C_FLG_DISP 0x00008000 /* Flush uses displacement */ +#ifdef _WRS_SUPPORT_CACHE_LOCK +#define C_FLG_LOCKPRTKT 0x00010000 /* Protect locked areas */ +#endif /* _WRS_SUPPORT_CACHE_LOCK */ +#define C_FLG_ORDER_RV 0x00020000 /* Reverse calling order from */ + /* Primary, Secondary, Tertiary */ + /* when sub caches are */ + /* supportable by AIM */ +#define C_FLG_FORCE 0x10000000 /* Top level API must call */ + /* this directly, this forces a*/ + /* passthrough to the architecture */ + /* defined routine */ + +/* Flags used within aimCacheLib.c */ + +#define CACHE_IS_VTOP 0x00100000 /* Virt to Phys needed */ +#define CACHE_IS_PTOV 0x00200000 /* Phys to Virt needed */ +#define CACHE_IS_VIRTUAL 0x00400000 /* The cache op is virtual */ +#define CACHE_IS_PHYSICAL 0x00800000 /* The cache op is physical */ +#define CACHE_IS_INDEXED 0x01000000 /* The cache op is indexed */ +#define CACHE_IS_HARVARD 0x02000000 +#define CACHE_IS_UNIFIED 0x04000000 +#define CACHE_IS_MULTISIZE 0x08000000 /* Different line sizes */ + +#define CACHE_MODE_MASK ( CACHE_IS_VIRTUAL | CACHE_IS_PHYSICAL | CACHE_IS_INDEXED) + +/* Typedefs Section */ + +/* + * enumeration of cache types + * Note: The initial enumeration is to assure compatibility + * with vxWorks 5.X + */ + +typedef enum + { + CACHE_TYPE_I = _INSTRUCTION_CACHE, /* Instruction Cache */ + CACHE_TYPE_D = _DATA_CACHE, /* Data Cache */ +#ifdef _WRS_SUPPORT_CACHE_EXTRA + CACHE_TYPE_B = _BRANCH_CACHE, /* Branch Cache */ + CACHE_TYPE_S, /* Secondary Cache */ + CACHE_TYPE_T, /* Tertiary Cache */ + CACHE_TYPE_IL, /* Instruction TLB Cache */ + CACHE_TYPE_DL, /* Data TLB Cache */ + CACHE_TYPE_A, /* Alternate Primary Cache */ + /* Xscale has a "mini-cache" */ +#endif /* _WRS_SUPPORT_CACHE_EXTRA */ + + CACHE_TYPE_MAX_SUPPORTED + }CACHETYPES; + +/* enumeration of Primitive functions */ + +typedef enum + { + CACHE_OP_NOOP, /* NO OP */ + CACHE_OP_ENABLE, /* CACHENABLE() */ + CACHE_OP_DISABLE, /* CACHEDISABLE() */ +#ifdef _WRS_SUPPORT_CACHE_LOCK + CACHE_OP_LOCK, /* CACHELOCK() */ + CACHE_OP_UNLOCK, /* CACHEUNLOCK() */ +#endif /* _WRS_SUPPORT_CACHE_LOCK */ + CACHE_OP_FLUSH, /* CACHEFLUSH() */ + CACHE_OP_INVALIDATE, /* CACHEINVALIDATE() */ + CACHE_OP_CLEAR, /* CACHECLEAR() */ + CACHE_OP_TEXTUPDATE, /* CACHETEXTUPDATE() */ + CACHE_OP_PIPEFLUSH, /* CACHEPIPEFLUSH() */ +#ifdef _WRS_SUPPORT_CACHE_XLATE + CACHE_OP_DMAVIRTOPHYS, /* VIRTUAL-TO-PHYSICAL TRANSLATION */ + CACHE_OP_DMAPHYSTOVIRT, /* PHYSICAL-TO-VIRTUAL TRANSLATION */ +#endif /* _WRS_SUPPORT_CACHE_XLATE */ +#ifdef _WRS_SUPPORT_CACHE_EXTRA + CACHE_OP_FENCE, /* Memory synchronization */ + CACHE_OP_PREFETCH, /* Prefetch a range of memory */ +#endif /* _WRS_SUPPORT_CACHE_EXTRA */ +#ifndef INCLUDE_MEM_ALLOT + CACHE_OP_DMAMALLOC, /* Allocate a dma safe buffer */ + CACHE_OP_DMAFREE, /* Free buffer allocated via DMAMALLOC */ +#endif /* !INCLUDE_MEM_ALLOT */ + CACHE_OP_ISON, /* Is Cache On */ +#ifdef _WRS_SUPPORT_CACHE_EXTRA + CACHE_OP_EXP_0, /* Architecture specific expansion */ + CACHE_OP_EXP_1, + CACHE_OP_EXP_2, + CACHE_OP_LAST = (CACHE_OP_EXP_2 + 3) /* This keeps _ALL functions */ + /* from overflowing the array */ +#else /* _WRS_SUPPORT_CACHE_EXTRA */ + CACHE_OP_LAST = (CACHE_OP_ISON + 3) +#endif /* _WRS_SUPPORT_CACHE_EXTRA */ + } CACHE_OPS; + +/* cache Attributes structure */ + +typedef struct cacheAttributes + { + CACHETYPES cacheType; /* One of CACHETYPES */ + UINT32 cacheModeDefault; /* copyback, writethrough, etc. */ + UINT32 cacheModeSupported;/* copyback, writethrough, etc. */ + UINT32 cacheSize; /* 0 for "not present" */ + UINT32 lineSize; /* in bytes */ + UINT32 lineStep; /* increment between cache lines */ + UINT32 numWays; /* number of way in the cache */ + UINT32 wayStep; /* increment between cache ways */ + UINT32 numSegs; /* number of segments in a segmented cache */ + UINT32 segStep; /* increment between segments */ + void * cacheBase; /* Index or displacement cache ops */ + } CACHEATTRIBUTES; + +/* Description of cache primitive */ + +typedef struct cacheOp + { + UINT32 opType; /* From C_FLG defines */ + FUNCPTR opPtr; /* Pointer to the Primitive */ + } CACHEOP; + + +/* Description of a cache or portion of a cache */ + +typedef struct cachePrimitive + { + CACHEATTRIBUTES cacheAttr; /* This could be a pointer */ + CACHEOP cacheOps[CACHE_OP_LAST]; + }CACHEPRIMITIVE; + +/* + * cacheConfig is the structure that encapsulates a CPU's + * cache properties. + */ + +typedef struct cacheConfig + { + UINT32 nCaches; /* Number of caches described in this struct */ + CACHEPRIMITIVE cachePrimitives[CACHE_TYPE_MAX_SUPPORTED]; + }CACHECONFIG; + +/* The following data elements are initialized and maintained */ +/* by the cache AIM based on the data passed to it via the */ +/* CACHECONFIG structure */ + +/* + * Cache attributes structure for use in cacheAimInfo. + */ + +typedef struct cacheGlobalAttr + { + UINT32 cacheExists; /* Indicates that this entry in the array is valid */ + UINT32 cacheType; /* Type of cache, I,D */ + UINT32 cacheSize; /* Size in bytes of this cache */ + UINT32 cacheLineSize; /* Line size for this cache */ + UINT32 cacheModes; /* Modes supported by this cache */ + UINT32 cacheModeCurrent; /* Current mode of this cache */ + }CACHEGLOBALATTR; + +/* + * Lock database structure. + * Keeps track of locked areas, facilitating the protection of locked areas + * from invalidates. The Lock database uses virtual addresses, a flat memory + * model allows this. + * + * Dynamically allocated by the AIM for lock management. + */ + +typedef struct cacheLockNode *lockNodePtr; +typedef struct cacheLockNode + { + lockNodePtr pNext; + lockNodePtr pPrev; + UINT32 cacheLockStart; + UINT32 cacheLockEnd; + }CACHELOCKNODE; + +/* Globally visible array of attributes */ + +extern CACHEGLOBALATTR cacheAimInfo[CACHE_TYPE_MAX_SUPPORTED]; + +extern UINT32 cacheLineSize; /* Cache line size. Used for alignment */ +extern UINT32 cacheAddrAlign; /* Increment for address alignment */ +extern UINT32 cacheLineMask; /* Mask to align to a cache line */ + +/* Forward Declarations */ + +STATUS aimCacheInit ( CACHECONFIG * cacheConfig ); + +#endif /* __INCaimCacheLibh */ diff --git a/h/aimMmuBaseLib.h b/h/aimMmuBaseLib.h new file mode 100644 index 0000000..1b77405 --- /dev/null +++ b/h/aimMmuBaseLib.h @@ -0,0 +1,70 @@ +/* aimMmuBaseLib.h - Base of the MMU Architecture Independent Manager */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,31aug04,dtr Add new attribute available for tlb locking. +01a,07jun04,sru written +*/ + +#ifndef __INCaimMmuBaseLibh +#define __INCaimMmuBaseLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + +/* typedefs */ + +/* + * MMU_ARCH_LIB_ATTRS is a data structure that is allocated by the AIM + * base library. It is filled in with MMU-specific attributes during + * the initialization of the architecture-dependent MMU library. From + * that point forward, the data structure is used by the AIM for its + * internal management. + */ + +typedef struct + { + /* fields filled in by the AD-MMU */ + + UINT pageSizeMask; + UINT lockSizeMask; + UINT contextMin; /* inclusive */ + UINT contextMax; /* inclusive */ + UINT pteSize; /* units are bytes */ + UINT contextTblAlign; + UINT regionTblNumEntries; + UINT pageTblNumEntries; + UINT tlbNumEntries; /* sum of hardware TLB resources */ + UINT tlbLockNumEntries; /* sum of hardware TLB resources available + for locking */ + UINT sizeOfRegionTbl; + UINT sizeOfPageTbl; + UINT sizeOfContextTbl; + + /* fields filled in by the AIM during initialization */ + + UINT pageSize; + UINT blockSize; + UINT regionShift; /* rightward bitshift to create region idx */ + UINT regionMask; /* post-shift mask of region idx */ + UINT pageShift; /* rightward bitshift to create page idx */ + UINT pageMask; /* post-shift mask of page idx */ + + } MMU_ARCH_LIB_ATTRS; + +/* externs */ + +extern STATUS aimMmuBaseLibInit (); +extern MMU_ARCH_LIB_ATTRS mmuArchLibAttrs; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCaimMmuBaseLibh */ diff --git a/h/aimMmuLib.h b/h/aimMmuLib.h new file mode 100644 index 0000000..13f34cf --- /dev/null +++ b/h/aimMmuLib.h @@ -0,0 +1,212 @@ +/* aimMmuLib.h - mmu library portion of the Architecture Independent Manager */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01o,29nov04,dtr Add region tbl ptr to MMU_TRANS_TBL. +01n,23nov04,dtr Mod to API for 860 support. +01m,29sep04,dtr Add Show routines externs. +01l,17sep04,sru Added 'pWritable' parameter to LOCKIMPORTFUNC. +01k,30aug04,dtr Modify allocation buffer for static TLB entries. +01j,06aug04,sru Added support for importing locked regions at startup. +01i,08jun04,sru Moved attribute definitions to mmuAimBaseLib.h. +01h,19may04,dtr Add extra function for ISR callable state. +01g,08apr04,dtr Adding in new feature support aimMmuLock/Unlock/optimization. +01f,04may04,sru add support for query of TLB size +01e,12nov03,jtp Change mmuPteSet global parameter type to BOOL +01d,07nov03,sru change model for bufferwrite +01c,04nov03,jtp change API for fine-grain PTE get +01b,30oct03,sru add AD-MMU hook for TransTblGet +01a,07apr03,sru written + +*/ + +#ifndef __INCaimMmuLibh +#define __INCaimMmuLibh + + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "aimMmuBaseLib.h" + +/* options for various AIM calls */ + +#define AIM_MMU_OPT_LOCK_NONE 0 +#define AIM_MMU_OPT_LOCK_IMPORT 1 + +/* masks for page sizes */ + +#define MMU_PAGE_MASK_1K 0x0000001 +#define MMU_PAGE_MASK_2K 0x0000002 +#define MMU_PAGE_MASK_4K 0x0000004 +#define MMU_PAGE_MASK_8K 0x0000008 +#define MMU_PAGE_MASK_16K 0x0000010 +#define MMU_PAGE_MASK_32K 0x0000020 +#define MMU_PAGE_MASK_64K 0x0000040 +#define MMU_PAGE_MASK_128K 0x0000080 +#define MMU_PAGE_MASK_256K 0x0000100 +#define MMU_PAGE_MASK_512K 0x0000200 +#define MMU_PAGE_MASK_1M 0x0000400 +#define MMU_PAGE_MASK_2M 0x0000800 +#define MMU_PAGE_MASK_4M 0x0001000 +#define MMU_PAGE_MASK_8M 0x0002000 +#define MMU_PAGE_MASK_16M 0x0004000 +#define MMU_PAGE_MASK_32M 0x0008000 +#define MMU_PAGE_MASK_64M 0x0010000 +#define MMU_PAGE_MASK_128M 0x0020000 +#define MMU_PAGE_MASK_256M 0x0040000 +#define MMU_PAGE_MASK_512M 0x0080000 +#define MMU_PAGE_MASK_1G 0x0100000 + + +#define MMU_PAGE_SIZE_MIN 1024 +#define MMU_PAGE_MASK_MIN MMU_PAGE_MASK_1K +#define BIT_SHIFT_1K 10 +#define MAX_BITS 31 +typedef char MMU_PAGE_TBL; /* placeholder */ +typedef void *MMU_REGION_TBL; +typedef MMU_REGION_TBL *MMU_CONTEXT_TBL; +typedef int MMU_CONTEXT; + +typedef struct mmuTransTblStruct + { + MMU_CONTEXT context; + MMU_REGION_TBL *regionTblPtr; + } MMU_TRANS_TBL; + +/* PTE_ATTR - a structured used to read/write PTE attribute info. */ + +typedef struct mmu_pte_attr + { + PHYS_ADDR physAddr; + VIRT_ADDR virtAddr; + UINT pageSize; + BOOL global; + UINT context; + UINT state; + BOOL valid; /* AIM-readable valid state */ + BOOL isrCallable; + } PTE_ATTR; + +typedef struct PTE_ATTR MMU_PTE_ATTR; + +/* MMU_PTE_ATTR mask bits. Used to control PTE set/get functions */ + +#define PTE_ATTR_PHYS_ADDR 0x01 +#define PTE_ATTR_PAGE_SIZE 0x02 +#define PTE_ATTR_GLOBAL 0x04 +#define PTE_ATTR_CONTEXT 0x08 +#define PTE_ATTR_STATE 0x10 +#define PTE_ATTR_VIRT_ADDR 0x20 +#define PTE_ATTR_VALID 0x40 /* AIM-readable valid state */ +#define PTE_ATTR_ISR_CALLABLE 0x80 + + +extern STATUS aimMmuLibInit (); + +typedef struct + { + VIRT_ADDR virtAddr; + int pageSize; + BOOL imported; + } STATIC_ENTRY_REGION; + + +typedef void (*TLBINVALLDYNFUNC)(void); +typedef void (*TLBINVFUNC)(int context, VIRT_ADDR); +typedef STATUS (*ENABLEFUNC)(BOOL); +typedef void (*PTESETFUNC)(void *pPte, + PHYS_ADDR, VIRT_ADDR, + UINT, BOOL, UINT, void *pRte); +typedef void (*PTEINITFUNC)(void *pPte); +typedef UINT (*PTESTATEGETFUNC)(void *pPte,void *pRte); +typedef void (*CURRENTSETFUNC)(MMU_CONTEXT_TBL *, int context); +typedef UINT (*INTPTEATTRFUNC)(void *pPte); +typedef BOOL (*BOOLPTEATTRFUNC)(void *pPte); +typedef PHYS_ADDR (*PTEPHYSATTRFUNC)(void *pPte); +typedef UINT (*INTSTATEATTRFUNC)(UINT state); +typedef BOOL (*BOOLSTATEATTRFUNC)(UINT state); +typedef VIRT_ADDR (*ADDRXLATEFUNC)(VIRT_ADDR); +typedef UINT * (*TRANSTBLGETFUNC)(MMU_CONTEXT_TBL *, int); +typedef void (*PAGEWRITEFUNC)(int context, + void *pPteSrc, VIRT_ADDR virtAddrSrc, + void *pPteDst, VIRT_ADDR virtAddrDst, + UINT numBytes); +typedef STATUS (*LOCKPTEUPDATEFUNC)(MMU_CONTEXT, + void *pPte, + VIRT_ADDR, + UINT size, + BOOL lock); + +typedef STATUS (*LOCKFUNC)(void *pPte,VIRT_ADDR,UINT); +typedef STATUS (*UNLOCKFUNC)(VIRT_ADDR); + +typedef STATUS (*SETLOCKFUNC)(void *pPte,UINT,BOOL,BOOL); + +typedef STATUS (*MODIFYLOCALPTEFUNC)(void *pPte,void *pLocalPte, + UINT,PHYS_ADDR,BOOL,BOOL); + +typedef UINT (*PTEMAXPHYSBITSFUNC)(void); +typedef UINT (*CURRENTGETFUNC)(void); +typedef BOOL (*PTEISRATTRFUNC)(void *pPte); +typedef STATUS (*LOCKIMPORTFUNC)(int index, VIRT_ADDR *pVirtAddr, + UINT32 * pSize, BOOL * pWritable); + +/* + * MMU_ARCH_LIB_FUNCS is a data structure that is allocated by the AIM + * library. It is filled in with function pointers that are exported + * by the architecture-dependent MMU library. The AIM uses these + * function pointers to implement its MMU services. + */ + +typedef struct + { + TLBINVALLDYNFUNC mmuTlbInvalidateAllDynamic; + TLBINVFUNC mmuTlbInvalidate; + ADDRXLATEFUNC kmemPtrToPageTablePtr; /*Optional*/ + ADDRXLATEFUNC pageTablePtrToKmemPtr; /*Optional*/ + ENABLEFUNC mmuEnable; + PTESETFUNC mmuPteSet; + PTEINITFUNC mmuPteInit; + PTESTATEGETFUNC mmuPteStateGet; + BOOLPTEATTRFUNC mmuPteValidGet; + BOOLPTEATTRFUNC mmuPteGlobalGet; + INTPTEATTRFUNC mmuPtePageSizeGet; + PTEPHYSATTRFUNC mmuPtePhysAddrGet; + BOOLSTATEATTRFUNC mmuStateValidGet; + INTSTATEATTRFUNC mmuStateCacheModeGet; + BOOLSTATEATTRFUNC mmuStateWriteEnabledGet; + CURRENTSETFUNC mmuCurrentSet; + CURRENTGETFUNC mmuCurrentGet; + PAGEWRITEFUNC mmuPageWrite; + FUNCPTR mmuAttrTranslate; + TRANSTBLGETFUNC mmuTransTblGet; + LOCKPTEUPDATEFUNC mmuLockPteUpdate; /*Optional vmPageOptimize*/ + LOCKFUNC mmuLock; /*Optional vmPageLock*/ + UNLOCKFUNC mmuUnlock; /*Optional vmPageUnLock*/ + BOOLPTEATTRFUNC mmuPteLockGet; /*Optional */ + SETLOCKFUNC mmuPteSetLockState; /*Optional vmLock/Unlock*/ + MODIFYLOCALPTEFUNC mmuPteSetForDynamic; /*Optional vmPageOptimize*/ + PTEMAXPHYSBITSFUNC mmuPteMaxPhysBitsGet;/*Optional */ + PTEISRATTRFUNC mmuPteIsrCallableGet;/*Optional vmPageOptimize*/ + LOCKIMPORTFUNC mmuLockImport; /*Optional */ + + } MMU_ARCH_LIB_FUNCS; + + +extern STATUS aimMmuLibInit (); +extern STATUS aimMmuShowInit(); +extern void aimMmuMapShow(UINT); +extern void aimMmuOptimizeMemShow(int); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCaimMmuLibh */ + diff --git a/h/aio.h b/h/aio.h new file mode 100644 index 0000000..cfa4b60 --- /dev/null +++ b/h/aio.h @@ -0,0 +1,91 @@ +/* aio.h - asynchronous I/O header file */ + +/* Copyright 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01f,19apr05,hya added aio_fsync. +01e,30jan04,dat Rework for RTP compatibility +01d,18jul96,dbt added aioPxLibInit() and aioShow() prototypes (SPR #3227). +01c,23jan96,tpr added ; after lio_listio () prototype definition. + added Copyright line. +01b,26jan94,kdl removed prototype for aio_fsync(); minor cleanup. +01a,04apr93,elh written. +*/ + +#ifndef __INCaioh +#define __INCaioh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "sys/types.h" +#include "signal.h" +#include "fcntl.h" +#include "private/aioPxLibP.h" /* private APIs, do not use */ + +/* defines */ + +/* aio_cancel() return values */ + +#define AIO_CANCELED 1 /* operations canceled */ +#define AIO_NOTCANCELED 2 /* operations are in progress */ +#define AIO_ALLDONE 3 /* operations complete */ + +/* lio_listio() modes */ + +#define LIO_WAIT 4 /* wait for completion */ +#define LIO_NOWAIT 5 /* don't wait for completion */ + +/* lio_listio() operations */ + /* lio op codes */ +#define LIO_READ 0 /* read operation */ +#define LIO_WRITE 1 /* write operation */ +#define LIO_NOP 2 /* no transfer operation*/ + + +/* Asynchronous I/O control block */ + +struct aiocb + { + int aio_fildes; /* file descriptor */ + off_t aio_offset; /* file offset */ + volatile void * aio_buf; /* location of buffer */ + size_t aio_nbytes; /* length of transfer */ + int aio_reqprio; /* request priority offset */ + struct sigevent aio_sigevent; /* signal number and value */ + int aio_lio_opcode; /* operation to be performed */ + + /* WRS addition */ + AIO_SYS aio_sys; /* implementation-specific */ + }; + +/* forward declarations */ + +extern int aio_read (struct aiocb *); +extern int aio_write (struct aiocb *); +extern int lio_listio (int, struct aiocb * [], int, + struct sigevent *); +extern int aio_error (const struct aiocb *); +extern size_t aio_return (struct aiocb *); +extern int aio_cancel (int, struct aiocb *); +extern int aio_suspend (const struct aiocb * [], int , + const struct timespec *); +extern STATUS aioPxLibInit (int lioMax); +extern STATUS aioShow (int notUsed); +extern int aio_fsync (int, struct aiocb *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCaioh */ diff --git a/h/aioSysDrv.h b/h/aioSysDrv.h new file mode 100644 index 0000000..b70289c --- /dev/null +++ b/h/aioSysDrv.h @@ -0,0 +1,48 @@ +/* aioSysDrv.h - AIO system driver header file */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,07feb05,hya added missing prototype +01d,30jan04,dat Rework for RTP compatibility +01c,12jan94,kdl changed name from aioSysPxLib to aioSysDrv; general cleanup. +01b,06dec93,dvs removed S_aioSysPxLib_NO_PIPES +01a,04apr93,elh written. +*/ + +#ifndef __INCaioSysDrvh +#define __INCaioSysDrvh + +/* includes */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "aio.h" + +/* defines */ + +/* project configurable AIO task parameters */ + +#define AIO_IO_TASKS_DFLT 2 /* number of I/O tasks */ +#define AIO_IO_STACK_DFLT 0x7000 /* I/O task stack size */ +#define AIO_IO_PRIO_DFLT 50 /* I/O task priority */ + +/* hardcoded parameters */ + +#define AIO_TASK_OPT 0 /* task options */ +#define AIO_WAIT_STACK 0x7000 /* wait task stack size */ + +/* forward declarations */ + +extern STATUS aioSysInit (int numTasks, int taskPrio, int taskStackSize); +extern STATUS aioSysInsert (struct aiocb *pAiocb, int prio); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCaioSysDrvh */ diff --git a/h/altivecLib.h b/h/altivecLib.h new file mode 100644 index 0000000..63e79c7 --- /dev/null +++ b/h/altivecLib.h @@ -0,0 +1,64 @@ +/* altivecLib.h - ALTIVEC coprocessor support library header */ + +/* Copyright 1984-1997 Wind River Systems, Inc. */ + +/* +modification history +-------------------- + +*/ + +#ifndef __INCaltivecLibh +#define __INCaltivecLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE +#include "taskLib.h" +#endif /* _ASMLANGUAGE */ + +#if CPU_FAMILY==PPC +#include "arch/ppc/altivecPpcLib.h" +#endif /* CPU_FAMILY==PPC */ + + +/* function declarations */ + +#ifndef _ASMLANGUAGE + +#if defined(__STDC__) || defined(__cplusplus) + +extern void altivecInit (void); +extern void altivecShowInit (void); +extern void altivecTaskRegsShow (int task); +extern STATUS altivecTaskRegsGet (int task, ALTIVECREG_SET *pAltivecRegSet); +extern STATUS altivecTaskRegsSet (int task, ALTIVECREG_SET *pAltivecRegSet); +extern STATUS altivecProbe (void); +extern void altivecRestore (ALTIVEC_CONTEXT *pAltivecContext); +extern void altivecSave (ALTIVEC_CONTEXT *pAltivecContext); +extern void altivecRegsToCtx (ALTIVECREG_SET *pAltivecRegSet, ALTIVEC_CONTEXT *pAltivecContext); +extern void altivecCtxToRegs (ALTIVEC_CONTEXT *pAltivecContext, ALTIVECREG_SET *pAltivecRegSet); + +#else + +extern void altivecInit (); +extern void altivecShowInit (); +extern void altivecTaskRegsShow (); +extern STATUS altivecTaskRegsGet (); +extern STATUS altivecTaskRegsSet (); +extern STATUS altivecProbe (); +extern void altivecRestore (); +extern void altivecSave (); +extern void altivecRegsToCtx (); +extern void altivecCtxToRegs (); + +#endif /* __STDC__ */ +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCaltivecLibh */ diff --git a/h/arch/arm/_G_configArch.h b/h/arch/arm/_G_configArch.h new file mode 100644 index 0000000..6909ef4 --- /dev/null +++ b/h/arch/arm/_G_configArch.h @@ -0,0 +1,100 @@ +/* _G_config.h - autogenerated on Tue Feb 3 10:11:41 PST 1998*/ + +/* There may be a few (VxWorks related) differences between this file and the + * corresponding one in host/$WIND_HOST_TYPE/arm-wrs-vxworks/include +*/ + +/* AUTOMATICALLY GENERATED; DO NOT EDIT! */ +#ifndef _G_config_h +#define _G_config_h +#define _G_LIB_VERSION "2.8.0" +#define _G_NAMES_HAVE_UNDERSCORE 1 +#define _G_VTABLE_LABEL_HAS_LENGTH 1 +#define _G_VTABLE_LABEL_PREFIX "__vt$" +#define _G_HAVE_ST_BLKSIZE 1 + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) +typedef int _G_int8_t __attribute__((__mode__(__QI__))); +typedef unsigned int _G_uint8_t __attribute__((__mode__(__QI__))); +typedef int _G_int16_t __attribute__((__mode__(__HI__))); +typedef unsigned int _G_uint16_t __attribute__((__mode__(__HI__))); +typedef int _G_int32_t __attribute__((__mode__(__SI__))); +typedef unsigned int _G_uint32_t __attribute__((__mode__(__SI__))); +typedef int _G_int64_t __attribute__((__mode__(__DI__))); +typedef unsigned int _G_uint64_t __attribute__((__mode__(__DI__))); +#if defined (__cplusplus) +__extension__ typedef long long _G_llong; +__extension__ typedef unsigned long long _G_ullong; +#else +typedef long long _G_llong; +typedef unsigned long long _G_ullong; +#endif +#else +typedef short /* deduced */ _G_int16_t; +typedef unsigned short /* deduced */ _G_uint16_t; +typedef long /* deduced */ _G_int32_t; +typedef unsigned long /* deduced */ _G_uint32_t; +#endif + +typedef unsigned long _G_clock_t; +typedef short _G_dev_t; +typedef long _G_fpos_t; +typedef unsigned short _G_gid_t; +typedef unsigned short _G_ino_t; +typedef int _G_mode_t; +typedef unsigned short _G_nlink_t; +typedef long _G_off_t; +typedef int _G_pid_t; +#ifndef __PTRDIFF_TYPE__ +#define __PTRDIFF_TYPE__ long int +#endif +typedef __PTRDIFF_TYPE__ _G_ptrdiff_t; +typedef unsigned long _G_sigset_t; +#ifndef __SIZE_TYPE__ +#define __SIZE_TYPE__ long unsigned int +#endif +typedef __SIZE_TYPE__ _G_size_t; +typedef long _G_time_t; +typedef unsigned short _G_uid_t; +typedef int _G_wchar_t; + +#define _G_BUFSIZ 1024 +#define _G_FOPEN_MAX 20 +#define _G_FILENAME_MAX 1024 +#if defined (__cplusplus) || defined (__STDC__) +#define _G_ARGS(ARGLIST) ARGLIST +#else +#define _G_ARGS(ARGLIST) () +#endif +#if !defined (__GNUG__) || defined (__STRICT_ANSI__) +#define _G_NO_NRV +#endif +#if !defined (__GNUG__) +#define _G_NO_EXTERN_TEMPLATES +#endif +typedef int /* default */ _G_ssize_t; +typedef int /* default */ _G_wint_t; +typedef void * _G_va_list; +#define _G_signal_return_type void +#define _G_sprintf_return_type int +#define _G_HAVE_ATEXIT 0 +#define _G_HAVE_SYS_RESOURCE 0 +#define _G_HAVE_SYS_TIMES 1 +#define _G_HAVE_SYS_SOCKET 0 +#define _G_HAVE_SYS_CDEFS 0 +#define _G_HAVE_SYS_WAIT 1 +#define _G_HAVE_UNISTD 1 +#define _G_HAVE_DIRENT 0 +#define _G_HAVE_CURSES 0 +#define _G_MATH_H_INLINES 0 +#define _G_HAVE_BOOL 1 +#define _G_HAVE_PRINTF_FP 0 +#define _G_HAVE_LONG_DOUBLE_IO 0 +#undef NULL +#ifdef __cplusplus +#define NULL __null +#else +#define NULL 0 +#endif +#include +#endif /* !_G_config_h */ diff --git a/h/arch/arm/archArm.h b/h/arch/arm/archArm.h new file mode 100644 index 0000000..4e6dec1 --- /dev/null +++ b/h/arch/arm/archArm.h @@ -0,0 +1,255 @@ +/* archArm.h - ARM specific header */ + +/* + * Copyright (c) 1996-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. +*/ + +/* +modification history +-------------------- +01t,24aug05,h_k Added _WRS_SUPPORT_CACHE_XLATE. +01s,12apr05,kk remove _WRS_OBJLIB_SUPPORT_VERIFY_TRAP macro (SPR# 106486) +01r,28mar05,scm add _ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK +01q,18feb05,dbt Moved some loader specific macros to elfArm.h. +01p,17feb05,scm add _WRS_OSM_INIT definition, and clarify + PORTABLE/NON-PORTABLE inclussion +01o,17jan05,jb Adding architecture specific objVerify support +01n,08sep04,scm move INSTR to archArmCommon.h +01m,10aug04,scm undef "OPTIMIZE", define "PORTABLE"... +01l,27apr04,cjj Defined workQLib_PORTABLE +01k,01dec03,scm clean up, SPR #90358... remove obnoxious warning... +01j,25nov03,pes Move setting of _BYTE_ORDER macro into archArmCommon.h +01i,14nov03,job Moved some blib stuff to archArmCommon.h +01h,13nov03,pes Add include of archArmCommon.h +01h,29oct03,sn gcc 3.3.2 does not currently support arm or sh +01g,27aug03,to added defines for semLib. +01f,07may03,pes PAL conditional compilation cleanup. Phase 2. +01e,29apr03,pes PAL conditional compilation cleanup. +01d,13mar01,sn SPR 73723 - define supported toolchains +01c,20jan99,cdp removed support for old ARM libraries. +01b,17aug98,cdp added big-endian and multiple cachelib support. +01a,08may96,cdp written based on archI86.h +*/ + +#ifndef __INCarchArmh +#define __INCarchArmh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* + * In the cases where vxWorks.h is not defined first... + */ +#if !defined (TRUE) +#define TRUE 1 +#endif + +#if !defined (FALSE) +#define FALSE 0 +#endif + +#undef _ARCH_SUPPORTS_GCC +#define _ARCH_SUPPORTS_DCC + +#define _DYNAMIC_BUS_SIZING FALSE /* require alignment for swap */ + +#define _ARCH_MULTIPLE_CACHELIB TRUE /* multiple cache libraries */ + +/* macros for AIM Cache */ +#define _WRS_SUPPORT_CACHE_XLATE /* cache virt-phys translate */ + +#include "arm.h" + +/* PAL additions */ + +/* moved here from h/private/eventP.h */ + +/* + * (Borrowed from PPC.) + * + * Macro for event logging of intEnt events for ARM architechtures. + * The ARM architecture is different in that there is only one external + * interrupt line coming into the CPU. At the time of the intEnt, the + * external interrupt number is unknown, meaning that logging cannot + * take place at this time. In this architechture, the logging of an + * intEnt event is deferred until the interrupt controller driver + * is exectued. + * Since the logging has to take place in drivers and/or BSP world files, + * the details of how the logging to be done has been deferred to a macro + * which is defined here. + * + * Note: This replaces the previous technique of saving the timestamp + * during the intEnt code to be used later, when the logging was done. + * SPR 21868 refers to a problem in which this can give rise to out-of-order + * timestamps in the event log. + */ +#define WV_EVT_INT_ENT(intNum) EVT_CTX_0(EVENT_INT_ENT((UINT32)intNum)) + +/* moved here from h/private/classLibP.h */ + +#define OBJ_CLASS_initRtn 0x24 /* Offsets into OBJ_CLASS */ + +/* status codes */ + +#define S_vmLib_NO_FREE_REGIONS (M_vmLib | 6) +#define S_vmLib_ADDRS_NOT_EQUAL (M_vmLib | 7) + +/* Make this architecture use the PORTABLE code set */ +#define PORTABLE + +/* from ffsLib.c */ + +#if !defined (PORTABLE) +#if (ARM_THUMB) +#define ffsLib_PORTABLE +#else +#undef ffsLib_PORTABLE +#endif /* ARM_THUMB */ +#else +#define ffsLib_PORTABLE +#endif + +#if defined (PORTABLE) +#define workQLib_PORTABLE /* use workQLib.c */ +#else +#undef workQLib_PORTABLE +#endif /* ARM_THUMB */ + +#define ffsLib_FFS_TABLE + +/* from dbgLib.c */ + +#define _WRS_FRAME_PRINT_STRING " : " + +/* from loadElfLib.c */ + +#define _WRS_USE_ELF_LOAD_FORMAT + +/* from periodHost.c, repeatHost.c, shell.c, and taskLib.c */ + +#if (ARM_THUMB) +#define _WRS_CHANGE_INSN_SET_ENABLE +#define _WRS_CHANGE_INSN_SET(p) (p) = ((FUNCPTR)(((UINT32)(p))|1)) +#define _WRS_CHANGE_INSN_SET_PTR(p) ((FUNCPTR)(((UINT32)(p))|1)) +#define _WRS_REV_INSN_SET_CHANGE(p) ((FUNCPTR)(((UINT32)(p)) & ~1)) +#endif /* ARM_THUMB */ + +/* OSM suppport for stack protection, used in sysOsmLib.c */ +#define _WRS_OSM_INIT + +/* Interrupt stack protection, used in usrDepend.c and usrKernelStack.c */ +#define _ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK + +/* if OSM support not available for stack protection, + * then support can not be available for interrupt + * stack protection. + */ +#if !defined(_WRS_OSM_INIT) +#undef _ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK +#endif + +#if defined(_ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK) +#undef _WRS_SVC_INT_STACK +#undef _WRS_IRQ_INT_STACK +#undef _WRS_DUAL_INT_STACK +#undef _WRS_SPLIT_STACKS +#else +/* + * Old split interrupt stack method..., + * not used when OSM stack protection is + * enabled... + */ + +/* from usrLib.c */ + +#define _WRS_SVC_INT_STACK +#define _WRS_IRQ_INT_STACK +#define _WRS_DUAL_INT_STACK + +/* from kernelLib.c */ + /* + * The ARM family uses 3 interrupt stacks. The ratio of the sizes of + * these stacks is dependent on the interrupt structure of the board + * and so is handled in the BSP code. Note that FIQ is now external to + * VxWorks. + */ +#define _WRS_SPLIT_STACKS {if (_func_armIntStackSplit != NULL) \ + (_func_armIntStackSplit)(vxIntStackBase, intStackSize);} +#endif /* _ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK */ + +/* from xdr_float.c */ + +#define FLOAT_NORM + +/* Set to force the use of the big-endian call to XDR_GETLONG() */ + +#define _WRS_XDR_FORCE_BE + +/* from bLib.c */ + +#if !defined (PORTABLE) +#if (ARM_THUMB) +#undef _WRS_BLIB_OPTIMIZED +#else /* ARM_THUMB */ +#define _WRS_BLIB_OPTIMIZED +#undef bLib_PORTABLE +#endif /* ARM_THUMB */ +#else +#undef _WRS_BLIB_OPTIMIZED +#define bLib_PORTABLE +#endif + +/* from windALib.s */ +/* from schedLib.c */ + +#if defined (PORTABLE) +#undef _WRS_SCHEDLIB_OPTIMIZED +#define schedLib_PORTABLE +#define _WRS_BASE6_SCHEDULER +#else +#define _WRS_SCHEDLIB_OPTIMIZED +#undef schedLib_PORTABLE +#undef _WRS_BASE6_SCHEDULER +#endif + +#define _WRS_ENABLE_IDLE_INTS {intUnlock(0);} + +/* from sem*Lib.c, semA*Lib.s */ + +#if !defined (PORTABLE) +#if !(ARM_THUMB) +#define _WRS_HAS_OPTIMIZED_SEM +#define _WRS_USE_OPTIMIZED_SEM /* XXX use optimized sem, for now */ +#undef semMLib_PORTABLE +#else +#undef _WRS_HAS_OPTIMIZED_SEM +#undef _WRS_USE_OPTIMIZED_SEM +#define semMLib_PORTABLE +#endif /* !ARM_THUMB */ +#else +#undef _WRS_HAS_OPTIMIZED_SEM +#undef _WRS_USE_OPTIMIZED_SEM +#define semMLib_PORTABLE +#endif + +/* macros for getting frame and return PC from a jmp_buf */ +#define _WRS_FRAMEP_FROM_JMP_BUF(env) ((char *) (env)[0].reg.reg_fp) +#define _WRS_RET_PC_FROM_JMP_BUF(env) ((INSTR *) (env)[0].reg.reg_pc) + + +#include "arch/arm/archArmCommon.h" + +/* End PAL */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCarchArmh */ + diff --git a/h/arch/arm/archArmCommon.h b/h/arch/arm/archArmCommon.h new file mode 100644 index 0000000..5f569b2 --- /dev/null +++ b/h/arch/arm/archArmCommon.h @@ -0,0 +1,55 @@ +/* archArmCommon.h - common Arm architecture specific header */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,08sep04,scm move INSTR from archArm.h +01e,25aug04,scm move to portable trcLib... +01d,03aug04,scm Enable Coprocessor Abstraction, disable Portable trcLib. +01c,25nov03,pes Move setting of _BYTE_ORDER macro into archArmCommon.h +01b,12nov03,job Moved some blib stuff from archArm.h +01a,11nov03,pes written. +*/ + +#ifndef __INCarchArmCommonh +#define __INCarchArmCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +/* from bLib.c */ + +#define _WRS_BLIB_ALIGNMENT 3 /* quad byte alignment mask */ +#define swab_PORTABLE +#define _WRS_IMPROVED_PORTABLE_SWAB + +#if defined(ARMEB) || defined(__ARMEB__) +#define _BYTE_ORDER _BIG_ENDIAN +#else +#define _BYTE_ORDER _LITTLE_ENDIAN +#endif + +/* Enable Coprocessor Abstraction. Must do all or none. */ + +#define _WRS_PAL_COPROC_LIB + +/* Disable Portable trcLib */ + +#define trcLib_PORTABLE + +#ifndef _ASMLANGUAGE +#if (ARM_THUMB) +typedef unsigned short INSTR; /* 16 bit instructions */ +#else /* ARM_THUMB */ +typedef unsigned long INSTR; /* 32 bit word-aligned instructions */ +#endif /* ARM_THUMB */ +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCarchArmCommonh */ diff --git a/h/arch/arm/arm.h b/h/arch/arm/arm.h new file mode 100644 index 0000000..b50c6d9 --- /dev/null +++ b/h/arch/arm/arm.h @@ -0,0 +1,348 @@ + +/* arm.h - ARM CPU flags etc */ + +/* Copyright 1996-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01o,10oct05,scm correct SPR 111664 +01n,04apr05,jb Adding ARMARCH6 and 1136 support +01m,21mar05,mdo Add define for ansiMath testing +01l,02mar05,mdo Add prototype for __ieee_status() and definitions for + exception flags +01k,10aug04,scm remove MPU support... +01j,25nov03,sn Avoid gcc 3.3.2 preprocessor token pasting error +01i,26aug03,rec remove SYS_PWR_MGMT conditional +01h,07jul03,rec revert to non-portable kernel +01g,01jul03,rec code review comments +01f,28may03,rec Power Management +01f,17dec02,jb Adding ARM10 and 926E support +01e,15jan02,m_h ARMARCH5 thumb problem +01d,05nov01,t_m remove leading underscores via FUNC/VAR macros +01c,05nov01,t_m Undo underscores +01b,19jul01,ed Fixing to be compatible with Diab compiler. +01d,17oct01,t_m Merge in DIAB +01c,10oct01,jb Enabling removal of pre-pended underscores for new compilers + (Diab/Gnu elf) +01b,23jul01,scm change XScale name to conform to coding standards... +01a,11dec00,scm replace references to ARMSA2 with XScale +01g,16oct00,scm reverse back I & F bits for SA2 +01f,01sep00,scm add sa2 support... +01e,08feb99,jpd added further MMU/CACHE types. +01d,20jan99,cdp removed support for old ARM libraries. +01c,24aug98,cdp added MMU/cache types, ARM_HAS_MPU/ARM_THUMB, ARMST16/ARMST32. +01b,21aug97,cdp added _?_FUNCTION macros and HAS_HALFWORD_ +01a,08may96,cdp written +*/ + +#ifndef __INCarmh +#define __INCarmh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Make sure excArmLib.h also has same settings */ + +/* bits in the PSR */ + +#define V_BIT (1<<28) +#define C_BIT (1<<29) +#define Z_BIT (1<<30) +#define N_BIT (1<<31) +#define I_BIT (1<<7) +#define F_BIT (1<<6) +#define T_BIT (1<<5) + + +/* mode bits */ + +#define MODE_SYSTEM32 0x1F +#define MODE_UNDEF32 0x1B +#define MODE_ABORT32 0x17 +#define MODE_SVC32 0x13 +#define MODE_IRQ32 0x12 +#define MODE_FIQ32 0x11 +#define MODE_USER32 0x10 + + +/* masks for getting bits from PSR */ + +#define MASK_MODE 0x0000003F +#define MASK_32MODE 0x0000001F +#define MASK_SUBMODE 0x0000000F +#define MASK_INT 0x000000C0 +#define MASK_CC 0xF0000000 + + +/* shifts to access bits in the PSR */ + +#define INT_MASK_SHIFT 6 + + +/* The coprocessor number of the MMU System Control Processor */ + +#define CP_MMU 15 + + +/* ARM MMU types */ + +#define ARMMMU_NONE 0 +#define ARMMMU_710A 1 +#define ARMMMU_810 2 +#define ARMMMU_SA110 3 +#define ARMMMU_940T 4 +#define ARMMMU_740T 5 +#define ARMMMU_SA1100 6 +#define ARMMMU_SA1500 7 +#define ARMMMU_720T 8 +#define ARMMMU_920T 9 +#define ARMMMU_946E 10 +#define ARMMMU_XSCALE 11 +#define ARMMMU_926E 12 +#define ARMMMU_1020E 13 +#define ARMMMU_1022E 14 +#define ARMMMU_1136JF 15 + +/* ARM cache types */ + +#define ARMCACHE_NONE 0 +#define ARMCACHE_710A 1 +#define ARMCACHE_810 2 +#define ARMCACHE_SA110 3 +#define ARMCACHE_940T 4 +#define ARMCACHE_740T 5 +#define ARMCACHE_SA1100 6 +#define ARMCACHE_SA1500 7 +#define ARMCACHE_720T 8 +#define ARMCACHE_920T 9 +#define ARMCACHE_946E 10 +#define ARMCACHE_XSCALE 11 +#define ARMCACHE_926E 12 +#define ARMCACHE_1020E 13 +#define ARMCACHE_1022E 14 +#define ARMCACHE_1136JF 15 + + +/* check CPU/cache/MMU features */ + + +/* Cache Line sizes */ + +#undef _CACHE_ALIGN_SIZE +#define _CACHE_ALIGN_SIZE 32 + + +#if (CPU == ARMARCH3) +#define ARM_HAS_HALFWORD_INSTRUCTIONS FALSE +#else +#define ARM_HAS_HALFWORD_INSTRUCTIONS TRUE +#endif + +#if 0 +#if defined(ARMMMU) && \ + ((ARMMMU == ARMMMU_940T) || (ARMMMU == ARMMMU_740T) || (ARMMMU == ARMMMU_946E)) +#define ARM_HAS_MPU TRUE +#else +#define ARM_HAS_MPU FALSE +#endif +#else +#define ARM_HAS_MPU FALSE /* remove support for MPU's */ +#endif + +#if defined(ARMMMU) && (ARMMMU == ARMMMU_NONE) +#define ARM_HAS_NO_MMU TRUE +#else +#define ARM_HAS_NO_MMU FALSE +#endif + +#if (CPU == ARMARCH4_T) || (CPU == ARMARCH5_T) +#define ARM_THUMB TRUE +#else +#define ARM_THUMB FALSE +#endif + + +/** Power management for XSCALE **/ + +#if (CPU==XSCALE) + +/* The coprocessor number of the Power Mode Register */ + +#define CP_CCLKCFG 14 + +/* OPCODE for idle */ + +#define PWRMODE_IDLE 1 + +#endif /* Power management for XSCALE */ + +/** Power management for ARM **/ + +#if (CPU==ARMARCH5) || (CPU==ARMARCH5_T) || (CPU==ARMARCH6) + +/* The coprocessor number of the Power Mode Register */ + +#define CP_CORECTL 15 + +/* OPCODE for idle */ + +#define PWRMODE_IDLE 1 + +#endif /* Power management for ARMARCH5 */ + +/* Define __ieee_status exception flags */ +#define FE_IEEE_FLUSHZERO (0x01000000) +#define FE_IEEE_ROUND_TONEAREST (0x00000000) +#define FE_IEEE_ROUND_UPWARD (0x00400000) +#define FE_IEEE_ROUND_DOWNWARD (0x00800000) +#define FE_IEEE_ROUND_TOWARDZERO (0x00C00000) +#define FE_IEEE_ROUND_MASK (0x00C00000) +#define FE_IEEE_MASK_INVALID (0x00000100) +#define FE_IEEE_MASK_DIVBYZERO (0x00000200) +#define FE_IEEE_MASK_OVERFLOW (0x00000400) +#define FE_IEEE_MASK_UNDERFLOW (0x00000800) +#define FE_IEEE_MASK_INEXACT (0x00001000) +#define FE_IEEE_MASK_ALL_EXCEPT (0x00001F00) +#define FE_IEEE_INVALID (0x00000001) +#define FE_IEEE_DIVBYZERO (0x00000002) +#define FE_IEEE_OVERFLOW (0x00000004) +#define FE_IEEE_UNDERFLOW (0x00000008) +#define FE_IEEE_INEXACT (0x00000010) +#define FE_IEEE_ALL_EXCEPT (0x0000001F) +#ifndef _ASMLANGUAGE +extern unsigned int __ieee_status (unsigned int mask, unsigned int flags); +#endif + +/* Define for ansiMath Testing */ +#define _WRS_ARM_IEEE_STATUS + +#ifdef _ASMLANGUAGE + +#if FALSE + +/* Build for old coff compiler */ +#define FUNC(a) _##a +#define VAR(name) _##name + +#define FUNC_LABEL(func) FUNC(func)##: +#define VAR_LABEL(name) VAR(name)##: + +#if ARM_THUMB +#define _ARM_FUNCTION_CALLED_FROM_C(a) \ + .code 16 ;\ + .balign 4 ;\ + .thumb_func ;\ +_##a: ;\ + BX pc ;\ + NOP ;\ + .code 32 ;\ +A_##a: +#else +#define _ARM_FUNCTION_CALLED_FROM_C(a) \ + .code 32 ;\ + .balign 4 ;\ +_##a: +#endif + +#define _ARM_FUNCTION(a) \ + .code 32 ;\ + .balign 4 ;\ +_##a: + +#if ARM_THUMB +#define _THUMB_FUNCTION(a) \ + .code 16 ;\ + .balign 2 ;\ + .thumb_func ;\ +_##a: +#endif + +#else + +/* Build for Gnu elf or Diab compiler */ +/* useful, assembly-language macros */ +#define FUNC(a) a +#define VAR(name) name + +#define FUNC_LABEL(func) func: +#define VAR_LABEL(name) name: + +#if ARM_THUMB +#define _ARM_FUNCTION_CALLED_FROM_C(a) \ + .code 16 ;\ + .balign 4 ;\ + .thumb_func ;\ +a: ;\ + BX pc ;\ + NOP ;\ + .code 32 ;\ +A##a: +#else +#define _ARM_FUNCTION_CALLED_FROM_C(a) \ + .code 32 ;\ + .balign 4 ;\ +a: +#endif + +#define _ARM_FUNCTION(a) \ + .code 32 ;\ + .balign 4 ;\ +a: + +#if ARM_THUMB +#define _THUMB_FUNCTION(a) \ + .code 16 ;\ + .balign 2 ;\ + .thumb_func ;\ +a: +#endif + +#endif /* GNU elf or DIAB*/ + +/** I80310 (coyanosa) specific helper macros **/ +#if ((CPU==XSCALE) || (CPU==ARMSA110)) +/* + * The following macro should be used when software needs to be assured that a + * CP15 update has taken effect. It may only used while in a privileged mode, + * because it accesses CP15. Ref. Coyanosa EAS 2.3.4 Additions to CP15 + * functionality + */ +#define CPWAIT(a) \ + mrc p15, 0, a, c2, c0, 0 /* arbitrary read of CP15 */ ;\ + mov a, a /* wait for it */ ;\ + sub pc, pc, IMMED4 /* branch to next instruction */ ; +#define IMMED4 #4 + +/* + * at this point, any previous CP15 writes are guaranteed + * to have taken effect + */ + + +/* + * The following macro should be used when software needs to be assure that + * BCU has finish all outstanding operations. + */ + +/* + * CAUTION: This macro should be used only from the cacheable region, or it may + * keep the BCU eternally busy fetching the code. + */ + +#define BCUWAIT(a) \ + mrc p13, 0, a, c0, c1, 0; /* Read BCUCTL,updates conditon code */ \ + submi pc, pc, IMMED12 ; /* If BCU busy (bit 31 set) try again */ +#define IMMED12 #12 + +#endif /* if CPU=XSCALE */ + + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCarmh */ diff --git a/h/arch/arm/asmArm.h b/h/arch/arm/asmArm.h new file mode 100644 index 0000000..d910c2f --- /dev/null +++ b/h/arch/arm/asmArm.h @@ -0,0 +1,61 @@ +/* asmArm.h - ARM assembler definitions header file */ + +/* Copyright 1996-1997 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,06jul04,md added function definition macros +01a,09may96,cdp created +*/ + +#ifndef __INCasmArmh +#define __INCasmArmh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Build for Gnu elf or Diab compiler */ +/* useful, assembly-language macros */ +#define FUNC(a) a +#define VAR(name) name + +#define FUNC_LABEL(func) func: +#define VAR_LABEL(name) name: + +#if ARM_THUMB +#define _ARM_FUNCTION_CALLED_FROM_C(a) \ + .code 16 ;\ + .balign 4 ;\ + .thumb_func ;\ +a: ;\ + BX pc ;\ + NOP ;\ + .code 32 ;\ +A##a: +#else +#define _ARM_FUNCTION_CALLED_FROM_C(a) \ + .code 32 ;\ + .balign 4 ;\ +a: +#endif + +#define _ARM_FUNCTION(a) \ + .code 32 ;\ + .balign 4 ;\ +a: + +#if ARM_THUMB +#define _THUMB_FUNCTION(a) \ + .code 16 ;\ + .balign 2 ;\ + .thumb_func ;\ +a: +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCasmArmh */ diff --git a/h/arch/arm/cacheArm1136jfLib.h b/h/arch/arm/cacheArm1136jfLib.h new file mode 100644 index 0000000..a1e936a --- /dev/null +++ b/h/arch/arm/cacheArm1136jfLib.h @@ -0,0 +1,73 @@ +/* cacheArm1136jfLib.h - ARM 1136JF cache library header file */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,18apr05,jb Fix for SPR 108034 +01a,07dec04,jb created +*/ + +#ifndef __INCcacheArm1136jfLibh +#define __INCcacheArm1136jfLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Include ARCH6 common defines. + */ + +#include "arch/arm/cacheArmArch6.h" + +/* + * Some cache designs (e.g. Harvard) have D-cache either fully or + * partially not coherent with I-cache + */ + +#define ARMCACHE_NOT_COHERENT TRUE + +/* + * This is a writethrough cache + */ + +#define ARMCACHE_HAS_WRITETHROUGH TRUE + +/* + * Does not have a mini-cache + */ + +#define ARMCACHE_HAS_MINICACHE FALSE + +/* + * Do not need an Instruction Memory Barrier + */ + +#define ARMCACHE_NEEDS_IMB TRUE + +/* + * Most of the cache designs are virtually addressed, but some newer + * ones have physically addressed caches. Note that this is the method of + * addressing, not whether the cache has physical address tags within + * it. + */ + +#define ARMCACHE_IS_PHYSICALLY_ADDRESSED TRUE + + +#ifndef _ASMLANGUAGE + +IMPORT void cacheArm1136jfLibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR), + PHYS_ADDR(virtToPhys) (VIRT_ADDR)); + + +#endif /* _ASMLANGUAGE */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcacheArm1136jfLibh */ diff --git a/h/arch/arm/cacheArm926eLib.h b/h/arch/arm/cacheArm926eLib.h new file mode 100644 index 0000000..fc33df0 --- /dev/null +++ b/h/arch/arm/cacheArm926eLib.h @@ -0,0 +1,58 @@ +/* cacheArm926eLib.h - ARM 926E cache library header file */ + +/* Copyright 2002-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,08feb05,rec use VIRT_ADDR and PHYS_ADDR instead of void +01c,07dec04,jb Further Palify ARM Aim cache +01b,11dec03,scm flushing out aim... +01a,09dec02,jpd created, based on cacheArm946eLib.h +*/ + +#ifndef __INCcacheArm926eLibh +#define __INCcacheArm926eLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Some cache designs (e.g. Harvard) have D-cache either fully or + * partially not coherent with I-cache + */ + +#define ARMCACHE_NOT_COHERENT TRUE + +/* + * This is a writethrough cache + */ + +#define ARMCACHE_HAS_WRITETHROUGH TRUE + +/* + * Does not have a mini-cache + */ + +#define ARMCACHE_HAS_MINICACHE FALSE + +/* + * Do not need an Instruction Memory Barrier + */ + +#define ARMCACHE_NEEDS_IMB FALSE + +#ifndef _ASMLANGUAGE + +IMPORT void cacheArm926eLibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR), + PHYS_ADDR(virtToPhys) (VIRT_ADDR)); + + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcacheArm926eLibh */ diff --git a/h/arch/arm/cacheArmArch6.h b/h/arch/arm/cacheArmArch6.h new file mode 100644 index 0000000..e4a85ca --- /dev/null +++ b/h/arch/arm/cacheArmArch6.h @@ -0,0 +1,66 @@ +/* cacheArmArch6.h - ARM ARCH6 cache library header file */ + +/* Copyright 2004-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,20apr05,jb Fix for SPR 108034 +01a,07dec04,jb created +*/ + +#ifndef __INCcacheArmArch6h +#define __INCcacheArmArch6h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* + * Common definitions for Arm Arch6 Cache support + */ + +extern STATUS cacheAimArch6IProbe (void); +extern STATUS cacheAimArch6DProbe (void); + +extern BOOL cacheAimArch6IIsOn (void); +extern BOOL cacheAimArch6DIsOn (void); + +extern STATUS cacheAimArch6TextUpdate (void * start, UINT32 count, UINT32 IcacheLineSize, UINT32 DcacheLineSize); + +extern void * cacheAimArch6DmaMalloc (size_t bytes); +extern STATUS cacheAimArch6DmaFree (void * pBuf); + +extern BOOL cacheAimArch6MmuIsOn (void); + +extern STATUS cacheAimArch6DInvalidate (void * start, void * end, UINT32 step); +extern STATUS cacheAimArch6DInvalidateAll (void); + +extern STATUS cacheAimArch6IInvalidate (void * start, void * end, UINT32 step); +extern STATUS cacheAimArch6IInvalidateAll (void); + +extern STATUS cacheAimArch6DFlush (void * start, void * end, UINT32 step); + +extern STATUS cacheAimArch6DClear (void * start, void * end, UINT32 step); + +extern STATUS cacheAimArch6PipeFlush (void); + +extern void cacheAimArch6IMB (void); + +extern void cacheAimArch6IClearDisable (void); +extern void cacheAimArch6DClearDisable (void); + +extern UINT32 cacheAimArch6Identify (void); + +extern FUNCPTR sysCacheLibInit; +extern UINT32 cacheArchState; + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcacheArmArch6h */ diff --git a/h/arch/arm/cacheArmLib.h b/h/arch/arm/cacheArmLib.h new file mode 100644 index 0000000..06f9215 --- /dev/null +++ b/h/arch/arm/cacheArmLib.h @@ -0,0 +1,135 @@ +/* cacheArmLib.h - ARM cache library header file */ + +/* Copyright 1996-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01o,28mar05,jb Adding 1136jfs Support +01n,25jan05,jb Removing in-advertant addition of 1136 +01m,07dec04,jb Restructure for Base6 +01l,01dec03,scm modify for AIM support... +01k,17dec02,jb Adding ARM10 and 926E support +01k,24jan03,jb Resolve SPR 81285 and 82533 +01j,02oct01,jpd added definitions to support simplifications in source. +01i,12nov01,to added cacheArchIntMask (merged from AE) +01h,23jul01,scm change XScale name to conform to coding standards... +01g,11dec00,scm replace references to ARMSA2 with XScale +01f,01sep00,scm add sa2 support... +01e,07sep99,jpd added ARM920T support. +01d,24nov98,jpd added ARM940T, ARMSA1100, ARMSA1500 support; + cdp restructured for multiple cache/MMU libraries. +01c,09mar98,jpd tidied. +01b,16sep97,jpd added cacheIMBRange(), 810 definitions for cacheDClear() and + cacheArchIntLock(). +01a,09may96,cdp created +*/ + +/* + * N.B. although this library contains code written for the ARM810 + * CPU, at the time of writing, this code has not been fully tested on + * that CPU. YOU HAVE BEEN WARNED. + */ + + +#ifndef __INCcacheArmLibh +#define __INCcacheArmLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* + * The way in which _CACHE_ALIGN_SIZE is defined has been changed + * somewhat and is no longer strictly related to the CPU type defined, + * but is instead related to the cache type selected. Therefore, it would + * be better if drivers that need to know the cache line size, use this + * variable, rather than the constant. The variable will be initialised + * to the appropriate cache-type-dependent value by the variant of the + * cache library initialisation code. + */ + +IMPORT UINT32 cacheArchAlignSize; + +/* + * Variable used to hold the interrupt mask used when disabling + * interrupts for lengthy cache operations such as cache flushing. This + * is preinitialised to a mask that disables IRQs and FIQs. The BSP may + * change this. Do not do so unless you are sure that you understand the + * consequences. In particular, if interrupts are allowed to occur + * during these operations, the state of the cache afterwards may be + * indeterminate. + */ + +IMPORT UINT32 cacheArchIntMask; + + +/* routine that locks interrupts according to the mask above */ + +IMPORT UINT32 cacheArchIntLock (void); +#endif /* _ASMLANGUAGE */ + +/* + * Arm Arch HW specific bits used by cache routines... + */ + +#define CACHE_MM_ENABLE (1<<0) /* MMU enable */ +#define CACHE_DC_ENABLE (1<<2) /* (data) cache enable */ +#define CACHE_WB_ENABLE (1<<3) /* write buffer enable */ +#define CACHE_IC_ENABLE (1<<12) /* Instruction cache enable */ + +/* + * Reset Architecture specific cache behavior. + * It is set with the cpu include file. + */ + +#undef ARMCACHE_NOT_COHERENT +#undef ARMCACHE_HAS_WRITETHROUGH +#undef ARMCACHE_HAS_MINICACHE +#undef ARMCACHE_NEEDS_IMB + +#if (ARMCACHE == ARMCACHE_926E) +#include "cacheArm926eLib.h" +#elif (ARMCACHE == ARMCACHE_920T) +#include "cacheArm920tLib.h" +#elif (ARMCACHE == ARMCACHE_940T) +#include "cacheArm940tLib.h" +#elif (ARMCACHE == ARMCACHE_1022E) +#include "cacheArm1022eLib.h" +#elif (ARMCACHE == ARMCACHE_1136JF) +#include "cacheArm1136jfLib.h" +#elif (ARMCACHE == ARMCACHE_XSCALE) +#include "cacheArmXSCALELib.h" +#endif /* ARMCACHE == ARMCACHE_926E */ + +#if (ARMCACHE != ARMCACHE_NONE) + +/* + * Verify the cpu has established some special attributes + */ + +#ifndef ARMCACHE_NOT_COHERENT +#error ARMCACHE value not supported in definition of ARMCACHE_NOT_COHERENT +#endif + +#ifndef ARMCACHE_HAS_WRITETHROUGH +#error ARMCACHE value not supported in definition of ARMCACHE_HAS_WRITETHROUGH +#endif + +#ifndef ARMCACHE_HAS_MINICACHE +#define ARMCACHE_HAS_MINICACHE FALSE +#endif + +#ifndef ARMCACHE_NEEDS_IMB +#error ARMCACHE value not supported in definition of ARMCACHE_NEEDS_IMB +#endif + +#endif /* ARMCACHE_NONE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcacheArmLibh */ diff --git a/h/arch/arm/cacheArmXSCALELib.h b/h/arch/arm/cacheArmXSCALELib.h new file mode 100644 index 0000000..e669500 --- /dev/null +++ b/h/arch/arm/cacheArmXSCALELib.h @@ -0,0 +1,77 @@ +/* cacheArmXSCALELib.h - ARM XScale cache library header file */ + +/* Copyright 199-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,08feb05,rec use VIRT_ADDR and PHYS_ADDR instead of void +01g,07dec04,jb Further Palify ARM Aim cache +01f,01dec03,scm flushing out aim... +01e,25jul01,scm add btbInvalidate... +01d,23jul01,scm change XScale name to conform to coding standards... +01c,09feb01,scm add support for cache & TLB locking... +01b,19dec00,scm correct cache sizes... +01a,31aug00,scm created +*/ + +#ifndef __INCcacheArmXSCALELibh +#define __INCcacheArmXSCALELibh + +#ifdef __cplusplus +extern "C" { +#endif + +#define D_CACHE_SIZE (32*1024) /* 32 kbytes DCache */ +#define I_CACHE_SIZE (32*1024) /* 32 kbytes ICache */ + +#define MINI_CACHE_SIZE (2*1024) /* 2 kbytes minicache */ +#define MINI_CACHE_LINE_SIZE 32 /* 32 bytes per line*/ + +/* + * Some cache designs (e.g. Harvard) have D-cache either fully or + * partially not coherent with I-cache + */ + +#define ARMCACHE_NOT_COHERENT TRUE + +/* + * This is a writethrough cache + */ + +#define ARMCACHE_HAS_WRITETHROUGH TRUE + +/* + * Has a mini-cache + */ + +#define ARMCACHE_HAS_MINICACHE TRUE + +/* + * Does not need an Instruction Memory Barrier + */ + +#define ARMCACHE_NEEDS_IMB FALSE + + +#ifndef _ASMLANGUAGE + +IMPORT void cacheArmXSCALELibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR), + PHYS_ADDR(virtToPhys) (VIRT_ADDR)); + + +/* definitions to allow for non-cacheAim direct calls */ + +#define cacheArmXSCALEDClearDisable cacheAimXSCALEDClearDisable +#define cacheArmXSCALEIClearDisable cacheAimXSCALEIClearDisable + +IMPORT void cacheAimXSCALEDClearDisable (void); +IMPORT void cacheAimXSCALEIClearDisable (void); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcacheArmXSCALELibh */ diff --git a/h/arch/arm/coprocArm.h b/h/arch/arm/coprocArm.h new file mode 100644 index 0000000..a113532 --- /dev/null +++ b/h/arch/arm/coprocArm.h @@ -0,0 +1,32 @@ +/* coprocArm.h - coprocessor management library header */ + +/* Copyright 2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,04aug04,scm fix permissions... +01a,03aug04,scm written based on coprocI86.h 01a. +*/ + +#ifndef __INCcoprocArmh +#define __INCcoprocArmh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "taskLib.h" + +/* defines */ + +#define VX_FP_TASK VX_COPROC1_TASK + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcoprocArmh */ diff --git a/h/arch/arm/dbgArmLib.h b/h/arch/arm/dbgArmLib.h new file mode 100644 index 0000000..3658ef7 --- /dev/null +++ b/h/arch/arm/dbgArmLib.h @@ -0,0 +1,52 @@ +/* dbgArmLib.h - header file for ARM-dependent part of debugger */ + +/* Copyright 1996-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,24feb05,jb Correct definition of SYSCALL_INST +01f,09dec04,scm resolve DBG_SYSCALL_SIZE warning, define DBG_SYSCALL_INST +01e,11feb04,elg Add syscall instruction size macro. +01d,12nov98,cdp added support for ARM generic Thumb library. +01c,20apr98,dbt modified for new breakpoint scheme +01b,24apr97,cdp added Thumb (ARM7TDMI_T) support; + changed DBG_BREAK_INST for non-Thumb processors. +01a,09may96,cdp created +*/ + +#ifndef __INCdbgArmLibh +#define __INCdbgArmLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "esf.h" + + +#define BREAK_ESF ESF +#define TRACE_ESF ESF + +#define DBG_SYSCALL_SIZE (sizeof (INSTR) / sizeof (INSTR)) +#define DBG_SYSCALL_INST 0xEF0000FA /* SWI */ + +#if ARM_THUMB +#define DBG_BREAK_INST 0xDEFE /* The undefined instruction used as a + * a breakpoint for Thumb-state */ +#define DBG_INST_ALIGN 2 +#else +#define DBG_BREAK_INST 0xE7FDDEFE /* The undefined instruction used as a + * a breakpoint for ARM-state */ +#define DBG_INST_ALIGN 4 +#endif /* ARM_THUMB */ + +#define DBG_NO_SINGLE_STEP 1 /* no hardware trace support */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdbgArmLibh */ diff --git a/h/arch/arm/dsmArmLib.h b/h/arch/arm/dsmArmLib.h new file mode 100644 index 0000000..a66a8c7 --- /dev/null +++ b/h/arch/arm/dsmArmLib.h @@ -0,0 +1,123 @@ +/* dsmArmLib.h - ARM disassembler header file */ + +/* Copyright 1996-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,14jan05,rec add print function to dsmInst +01c,09oct97.jpd added more Thumb instructions. +01b,09sep97,cdp added more instructions. +01a,09may96,cdp created. +*/ + +#ifndef __INCdsmArmLibh +#define __INCdsmArmLibh + + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "vwModNum.h" + + +/* dsmLib status codes */ + +#define S_dsmLib_UNKNOWN_INSTRUCTION (M_dsmLib | 1) + + +/* + * Macro and definitions for simple decoding of instuctions. + * To check an instruction, it is ANDed with the IMASK_ and + * the result is compared with the IOP_. The macro INSTR_IS + * does this and returns !0 to indicate a match. + */ + +#define INSTR_IS(i,o) (((i)&(IMASK_##o))==(IOP_##o)) + +#define IMASK_BL 0x0F000000 /* BL xxx */ +#define IOP_BL 0x0B000000 + +#define IMASK_STMDB_SPP_FP_IP_LR_PC 0xFFFFF800 /* STMDB sp!,{..fp,ip,lr,pc} */ +#define IOP_STMDB_SPP_FP_IP_LR_PC 0xE92DD800 + +#define IMASK_SUB_FP_IP_4 0xFFFFFFFF /* SUB fp,ip,#4 */ +#define IOP_SUB_FP_IP_4 0xE24CB004 + +#define IMASK_SUB_FP_IP_4PLUS 0xFFFFF000 /* SUB fp,ip,#4+ */ +#define IOP_SUB_FP_IP_4PLUS 0xE24CB000 + +#define IMASK_MOV_IP_SP 0xFFFFFFFF /* MOV ip,sp */ +#define IOP_MOV_IP_SP 0xE1A0C00D + +#define IMASK_MOVXX_LR_PC 0x0FFFFFFF /* MOVxx lr,pc */ +#define IOP_MOVXX_LR_PC 0x01A0E00F + +#define IMASK_STMDB_SPP_AREGS 0xFFFFFFF0 /* STMDB sp!,{a1-a4} */ +#define IOP_STMDB_SPP_AREGS 0xE92D0000 + +#define IMASK_SUB_SP_SP 0xFFFFF000 /* SUB sp,sp,#n */ +#define IOP_SUB_SP_SP 0xE24DD000 + +#define IMASK_MOVS_PC_LR 0xFFFFFFFF /* MOVS pc,lr */ +#define IOP_MOVS_PC_LR 0xE1B0F00E + + +/* Thumb instructions */ + +#define IMASK_T_BL0 0xF800 /* BL prefix */ +#define IOP_T_BL0 0xF000 + +#define IMASK_T_BL1 0xF800 /* BL */ +#define IOP_T_BL1 0xF800 + +#define IMASK_T_MOV_LR_PC 0xFFFF /* MOV lr,pc */ +#define IOP_T_MOV_LR_PC 0x46FE + +#define IMASK_T_SUB_SP_16 0xFFFF /* SUB sp,#16 */ +#define IOP_T_SUB_SP_16 0xB084 + +#define IMASK_T_MOV_FP_LO 0xFFC7 /* MOV fp,loreg */ +#define IOP_T_MOV_FP_LO 0x4683 + +#define IMASK_T_MOV_SP_LO 0xFFC7 /* MOV sp,loreg */ +#define IOP_T_MOV_SP_LO 0x4685 + +#define IMASK_T_ADD_LO_SP 0xF800 /* ADD loreg, sp, #Imm */ +#define IOP_T_ADD_LO_SP 0xA800 + +#define IMASK_T_POP_LO 0xFF00 /* POP {reglist} (not PC) */ +#define IOP_T_POP_LO 0xBC00 + +#define IMASK_T_PUSH_LO 0xFF00 /* PUSH {reglist} (not LR) */ +#define IOP_T_PUSH_LO 0xB400 + +#define IMASK_T_PUSH 0xFF00 /* PUSH {reglist} (inc LR) */ +#define IOP_T_PUSH 0xB500 + +#define IMASK_T_BX_LO 0xFFC0 /* BX loreg */ +#define IOP_T_BX_LO 0x4700 + +#define IMASK_T_MOV_LO_PC 0xFFF8 /* MOV loreg,pc */ +#define IOP_T_MOV_LO_PC 0x4678 + +#define IMASK_T_MOV_LO_FP 0xFFF8 /* MOV loreg,fp */ +#define IOP_T_MOV_LO_FP 0x4658 + + +IMPORT int dsmNbytes(FAST INSTR *binInst); +IMPORT int dsmInst(FAST INSTR *binInst, int address, VOIDFUNCPTR prtAddress, + FUNCPTR oFn, int oArg); + + +#ifndef _ASMLANGUAGE +#endif /* _ASMLANGUAGE */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdsmArmLibh */ diff --git a/h/arch/arm/elfArm.h b/h/arch/arm/elfArm.h new file mode 100644 index 0000000..953bcaf --- /dev/null +++ b/h/arch/arm/elfArm.h @@ -0,0 +1,108 @@ +/* elfArm.h - ARM-specific elf loader header */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software may be + * licensed only pursuant to the terms of an applicable Wind River license + * agreement. + */ + +/* +modification history +-------------------- +01e,25jul05,v_r Updated copyright. +01d,18feb05,dbt Cleanup. +01c,18sep04,jn Move towards shared code for host and target loaders +01b,17feb04,jn Merged version from AE. +01b,30nov01,pad Moved definitions of CHECK_FITS and SIGN_EXTEND into + loadElfLibP.h +01a,24aug01,jn created, based on vxWorksAE 1.1 + share/src/loader/elfArm.h@@/main/tor3_x/5 +*/ + +#ifndef __INCelfArmh +#define __INCelfArmh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * macro to check that a signed fits in without overflow + * i.e. that the "sign-bit" is correctly propagated into the excess high bits + */ + +#define CHECK_FITS(val,nBits) \ + ((((val) & ~((1 << ((nBits)-1))-1)) == 0) || \ + (((val) & ~((1 << ((nBits)-1))-1)) == ~(UINT32)((1 << ((nBits)-1))-1))) + +/* macros to insert the low n bits of a value into a buffer. */ + +#define LOW24_INSERT(buf,value) INSERT ((buf), (value), 0x00ffffff) + +#define LOW16_INSERT(buf,value) INSERT ((buf), (value), 0x0000ffff) + +#define LOW12_INSERT(buf,value) INSERT ((buf), (value), 0x00000fff) + +#define LOW11_INSERT(buf,value) INSERT ((buf), (value), 0x000007ff) + +#define LOW8_INSERT(buf,value) INSERT ((buf), (value), 0x000000ff) + +#define BITS6_10_INSERT(buf,value) INSERT ((buf), (value) << 6, 0x000007c0) + +#define UBIT_INSERT(buf,value) INSERT ((buf), (value) << 23 , 0x0080000) + +#define EM_ARCH_MACHINE EM_ARM +#define EM_ARCH_MACH_ALT EM_ARM /* not used */ + +/* Relocation Type Definitions */ + +#define R_ARM_NONE 0 /* No reloc */ +#define R_ARM_PC24 1 +#define R_ARM_ABS32 2 +#define R_ARM_REL32 3 +#define R_ARM_PC13 4 +#define R_ARM_ABS16 5 +#define R_ARM_ABS12 6 +#define R_ARM_THM_ABS5 7 +#define R_ARM_ABS8 8 +#define R_ARM_SBREL32 9 +#define R_ARM_THM_PC22 10 +#define R_ARM_THM_PC8 11 +#define R_ARM_AMP_VCALL9 12 +#define R_ARM_SWI24 13 +#define R_ARM_THM_SWI8 14 +#define R_ARM_XPC25 15 +#define R_ARM_THM_XPC22 16 +#define R_ARM_COPY 20 /* copy symbol at runtime */ +#define R_ARM_GLOB_DAT 21 /* create GOT entry */ +#define R_ARM_JUMP_SLOT 22 /* create PLT entry */ +#define R_ARM_RELATIVE 23 /* adjust by program base */ +#define R_ARM_GOTOFF 24 /* 32 bit offset to GOT */ +#define R_ARM_GOTPC 25 /* 32 bit PC relative offset to GOT */ +#define R_ARM_GOT32 26 /* 32 bit GOT entry */ +#define R_ARM_PLT32 27 /* 32 bit PLT address */ + +/* These are GNU extensions to enable C++ vtable garbage collection. */ + +#define R_ARM_GNU_VTENTRY 100 +#define R_ARM_GNU_VTINHERIT 101 + +#define R_ARM_THM_PC11 102 /* cygnus extension to abi: */ + /* thumb unconditional branch */ +#define R_ARM_THM_PC9 103 /* cygnus extension to abi: */ + /* thumb conditional branch */ +#define R_ARM_RXPC25 249 +#define R_ARM_RSBREL32 250 +#define R_ARM_THM_RPC22 251 +#define R_ARM_RREL32 252 +#define R_ARM_RABS32 253 +#define R_ARM_RPC24 254 +#define R_ARM_RBASE 255 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCelfArmh */ diff --git a/h/arch/arm/esfArm.h b/h/arch/arm/esfArm.h new file mode 100644 index 0000000..04b110b --- /dev/null +++ b/h/arch/arm/esfArm.h @@ -0,0 +1,45 @@ +/* esfArm.h - ARM exception stack frames */ + +/* Copyright 1996-1997 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,09sep04,scm add ttbase to ESF, so structs REG_SET & ESF overlap correctly +01a,09may96,cdp created +*/ + +#ifndef __INCesfArmh +#define __INCesfArmh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* The Exception Stack Frame + * On the ARM, this is faked by a stub and the pointer + * passed back points to the PC and CPSR at the end of the + * register structure. If that changes, so must this. + * + * I.E. REG_SET struct & ESf struct 'overlap' on last 3 + * elements of REG_SET (pc,cpsr,ttbase)... + */ + +typedef struct + { + INSTR *pc; /* program counter */ + ULONG cpsr; /* current PSR */ + ULONG ttbase; /* Trans Table Base */ + UINT32 vecAddr; /* address of exception vector => type */ + } ESF; + +#endif /* _ASMLANGUAGE */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCesfArmh */ diff --git a/h/arch/arm/excArmLib.h b/h/arch/arm/excArmLib.h new file mode 100644 index 0000000..4d0c381 --- /dev/null +++ b/h/arch/arm/excArmLib.h @@ -0,0 +1,99 @@ +/* excArmLib.h - ARM exception library header file */ + +/* Copyright 1996-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,26nov03,pes Correct _WRS_IS_SUPV_EXC macro. +01c,18nov03,pes Add _WRS_IS_SUPV_EXC macro. +01b,23jul01,scm change XScale name to conform to coding standards... +01a,11dec00,scm replace references to ARMSA2 with XScale +01c,16oct00,scm reverse back I & F bits for SA2 +01b,15sep00,scm update for SA2 support... +01a,09may96,cdp created +*/ + +#ifndef __INCexcArmLibh +#define __INCexcArmLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* + * NOTE: if this structure changes, the TCB offsets in h/private/taskLibP.h + * must be updated. See also taskLib.h. + */ +typedef struct + { + UINT32 valid; /* indicators that following fields are valid */ + UINT32 vecAddr; /* exception vector address */ + INSTR * pc; /* PC */ + UINT32 cpsr; /* CPSR */ + } EXC_INFO; + +#define _WRS_IS_SUPV_EXC() (((excInfo.cpsr & MASK_MODE) == MODE_USER32) ? FALSE : TRUE) + +extern FUNCPTR excExcepHook; /* add'l rtn to call when exceptions occur */ +extern VOIDFUNCPTR _func_excBreakpoint; /* called to handle breakpoints */ + + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS excIntConnect (VOIDFUNCPTR *, VOIDFUNCPTR); +extern void excVecSet (FUNCPTR *, FUNCPTR); +extern FUNCPTR excVecGet (FUNCPTR *); + + +#else /* __STDC__ */ + +extern STATUS excIntConnect (); +extern void excVecSet (); +extern FUNCPTR excVecGet (); + +#endif /* __STDC__ */ + +#endif /* ASMLANGUAGE */ + + +/* exception information valid bits */ + +#define EXC_INFO_VECADDR 0x01 /* vector is valid */ +#define EXC_INFO_PC 0x02 /* PC is valid */ +#define EXC_INFO_CPSR 0x04 /* CPSR is valid */ + + +/* exception vector addresses */ + +#define EXC_OFF_RESET 0x00 /* reset */ +#define EXC_OFF_UNDEF 0x04 /* undefined instruction */ +#define EXC_OFF_SWI 0x08 /* software interrupt */ +#define EXC_OFF_PREFETCH 0x0c /* prefetch abort */ +#define EXC_OFF_DATA 0x10 /* data abort */ +#define EXC_OFF_IRQ 0x18 /* interrupt */ +#define EXC_OFF_FIQ 0x1C /* fast interrupt */ + +/* Exception Vector Base */ +#define ARM_EXC_VEC_BASE 0x00 + +/* + * In coyanosa I80310 the default vector base is 0x00, + * can be relocated into 0xFFFF0000 + * + */ + +#if ((CPU==XSCALE) || (CPU==ARMSA110)) +#define ARM_EXC_VEC_BASE_RELOCATED 0xffff0000 +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCexcArmLibh */ + + + diff --git a/h/arch/arm/fppArmLib.h b/h/arch/arm/fppArmLib.h new file mode 100644 index 0000000..bc0120e --- /dev/null +++ b/h/arch/arm/fppArmLib.h @@ -0,0 +1,58 @@ +/* fppArmLib.h - ARM floating-point coprocessor support header file */ + +/* Copyright 1996-1997 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,09may96,cdp created +*/ + +#ifndef __INCfppArmLibh +#define __INCfppArmLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +typedef struct fpContext + { + int dummy; + } FP_CONTEXT; + +#define FPREG_SET FP_CONTEXT + + +/* variable declarations */ + +extern REG_INDEX fpRegName[]; /* f-point data register table */ +extern REG_INDEX fpCtlRegName[]; /* f-point control register table */ +extern WIND_TCB *pFppTaskIdPrevious; /* task id for deferred exceptions */ +extern FUNCPTR fppCreateHookRtn; /* arch dependent create hook routine */ +extern FUNCPTR fppDisplayHookRtn; /* arch dependent display routine */ + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT void fppArchInit (void); +IMPORT void fppArchTaskCreateInit (FP_CONTEXT *pFpContext); + +#else /* __STDC__ */ + +IMPORT void fppArchInit (); +IMPORT void fppArchTaskCreateInit (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfppArmLibh */ diff --git a/h/arch/arm/in_cksum.h b/h/arch/arm/in_cksum.h new file mode 100644 index 0000000..476232c --- /dev/null +++ b/h/arch/arm/in_cksum.h @@ -0,0 +1,179 @@ +/* in_cksum.h - x86 version in_cksum header file */ + +/* Copyright 2001-2002 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from tahoe: in_cksum.c 1.2 86/01/05 + * from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91 + * from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp + * $FreeBSD: src/sys/i386/include/in_cksum.h,v 1.7.2.1 2000/05/05 13:37:00 jlemon Exp $ + */ + +/* +modification history +-------------------- +01g,25aug05,dlk Add section tags. +01f,24mar04,m_h Internet Checksum +01e,18mar04,m_h move to arch/arm +01d,20nov03,niq Remove copyright_wrs.h file inclusion +01c,05nov03,rlm Ran batch header update for header re-org. +01b,25jul02,rvr removed DCC specific code +01a,13sep01,hsh Created from BSD 4.3 +*/ + + +#ifndef _MACHINE_IN_CKSUM_H_ +#define _MACHINE_IN_CKSUM_H_ 1 + +#include + +/* + * in_cksum_hdr - checksum on header only + * + * It is useful to have an Internet checksum routine which is inlineable + * and optimized specifically for the task of computing IP header checksums + * in the normal case (where there are no options and the header length is + * therefore always exactly five 32-bit words. + */ + +static __inline +u_int in_cksum_hdr + ( + const struct ip *ip + ) + { + register u_int sum = 0; + int hlen = sizeof (struct ip); + register u_short *w = (u_short *) ip; + u_short remaining = 0; + + while (hlen > 1) + { + sum += *w++; + hlen -= 2; + } + + if (hlen == 1) + { + *(u_char *) (&remaining) = *(u_char *) w; + sum += remaining; + } + + sum = (sum & 0xffff) + (sum >> 16); + if (sum > 0xffff) + sum -= 0xffff; + + return ~sum & 0xffff; + } + + +/* + * in_cksum_update + */ + +static __inline +void in_cksum_update + ( + struct ip *ip + ) + { + int __tmpsum; + __tmpsum = (int)ntohs(ip->ip_sum) + 256; + ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); + } + +/* + * in_pseudo - pre-checksum parts of pseudo-header + * + * Compute significant parts of the IPv4 checksum pseudo-header * for use in a + * delayed TCP/UDP checksum calculation. + * + * Args: + * + * src Source IP address + * dst Destination IP address + * lenproto htons(proto-hdr-len + proto-number) + */ + +static __inline +u_int16_t in_pseudo + ( + u_int32_t src, + u_int32_t dst, + u_int32_t lenproto + ) + { + u_int32_t sum; + + sum = lenproto + + (u_int16_t)(src >> 16) + + (u_int16_t)(src /*& 0xffff*/) + + (u_int16_t)(dst >> 16) + + (u_int16_t)(dst /*& 0xffff*/); + + sum = (u_int16_t)(sum >> 16) + (u_int16_t)(sum /*& 0xffff*/); + + if (sum > 0xffff) + sum -= 0xffff; + + return (sum); + } + +/* + * in_addword - Add two 16-bit workd + * + * Add the two 16-bit network-order values, carry, and return. + */ + +static __inline +u_int16_t in_addword + ( + u_int16_t a, + u_int16_t b + ) + { + u_int32_t sum = a + b; + + if (sum > 0xffff) + sum -= 0xffff; + + return (sum); + } + + +_WRS_FASTTEXT +u_short in_cksum_skip(struct mbuf *m, int len, int skip); + +#endif /* _MACHINE_IN_CKSUM_H_ */ + diff --git a/h/arch/arm/intArmLib.h b/h/arch/arm/intArmLib.h new file mode 100644 index 0000000..be3ab9b --- /dev/null +++ b/h/arch/arm/intArmLib.h @@ -0,0 +1,116 @@ +/* intArmLib.h - ARM-specific interrupt library header file */ + +/* Copyright 1997-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,22aug03,to added inline intLock()/intUnlock(). +01b,20aug98,cdp added intIFLock(), intIFUnlock(). +01a,25nov97,cdp created. +*/ + +#ifndef __INCintArmLibh +#define __INCintArmLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* interrupt model feature selection bits (OR'd together) */ + +#define INT_NON_PREEMPT_MODEL 0 +#define INT_PREEMPT_MODEL 1 +#define INT_HDWE_LOCK_LVL 2 + + +/* inline intLock()/intUnlock() */ + +#if !(ARM_THUMB) +#if defined (__DCC__) +#define _WRS_HAS_IL_INT_LOCK + +__asm volatile int __inlineIntLock () +{ +! "r1" + mrs r1,cpsr + and r0,r1,#I_BIT + orr r1,r1,#I_BIT + msr cpsr,r1 +} + +__asm volatile void __inlineIntUnlock (int key) +{ +% reg key; +! "r0", "r1" + mrs r1,cpsr + bic r1,r1,#I_BIT + and r0,key,#I_BIT + orr r1,r1,r0 + msr cpsr,r1 +} + +#elif defined (__GNUC__) +#define _WRS_HAS_IL_INT_LOCK + +/* + * magic numbers used in inline asm: + * #define I_BIT (1<<7) (from h/arch/arm/arm.h) + */ + +static __inline__ int __inlineIntLock (void) + { + int key; + __asm__ volatile ( + "mrs r1, cpsr\n\t" + "and %0, r1, #(1<<7)\n\t" + "orr r1, r1, #(1<<7)\n\t" + "msr cpsr, r1" + : "=g" (key) + : /* no input */ + : "r1"); + return key; + } + +static __inline__ void __inlineIntUnlock (int key) + { + __asm__ volatile ( + "mrs r1, cpsr\n\t" + "bic r1, r1, #(1<<7)\n\t" + "and r0, %0, #(1<<7)\n\t" + "orr r1, r1, r0\n\t" + "msr cpsr, r1" + : /* no output */ + : "g" (key) + : "r0", "r1"); + } +#else +#undef _WRS_HAS_IL_INT_LOCK +#endif /* __DCC__ */ +#else +#undef _WRS_HAS_IL_INT_LOCK +#endif /* !ARM_THUMB */ + + +/* functions in intArchLib.c */ + +extern STATUS intDisable (int); +extern STATUS intEnable (int); +extern STATUS intLibInit (int, int, int); +extern int intIFLock (void); +extern void intIFUnlock (int); + + +/* function pointers used in intArchLib.c and interrupt driver */ + +IMPORT FUNCPTR sysIntLvlVecChkRtn; +IMPORT FUNCPTR sysIntLvlVecAckRtn; +IMPORT FUNCPTR sysIntLvlChgRtn; +IMPORT FUNCPTR sysIntLvlEnableRtn; +IMPORT FUNCPTR sysIntLvlDisableRtn; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCintArmLibh */ diff --git a/h/arch/arm/ivArm.h b/h/arch/arm/ivArm.h new file mode 100644 index 0000000..911a1c0 --- /dev/null +++ b/h/arch/arm/ivArm.h @@ -0,0 +1,32 @@ +/* ivArm.h - ARM interrupt vectors */ + +/* Copyright 1996-1997 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,09may96,cdp created +*/ + +#ifndef __INCivArmh +#define __INCivArmh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* macros to convert interrupt vectors <-> interrupt numbers */ + +#define IVEC_TO_INUM(intVec) ((int) (intVec)) +#define INUM_TO_IVEC(intNum) ((VOIDFUNCPTR *) (intNum)) + + +/* interrupt vector definitions are in the BSP header files */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCivArmh */ diff --git a/h/arch/arm/mmuArm1136jfLib.h b/h/arch/arm/mmuArm1136jfLib.h new file mode 100644 index 0000000..c38b159 --- /dev/null +++ b/h/arch/arm/mmuArm1136jfLib.h @@ -0,0 +1,109 @@ +/* mmuArm1136jfLib.h - ARM 1136JF MMU library header file */ + +/* Copyright 2004-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,07dec04,jb created +*/ + +#ifndef __INCmmuArm1136jfLibh +#define __INCmmuArm1136jfLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "memLib.h" + +#define MMU_ID_ARM1136JF 0x07B360 + +#include "mmuArmArch6PalLib.h" + +/* 1136JF Specific definitions follow */ + +/* + * Values to be used when mmuEnable() is called. This will be after the MMU has + * been initialised by sysInit()/romInit() and after cacheLib has set whatever + * cache enable settings have been chosen. + * + * M 1 Enable MMU + * A 0 Disable address alignment fault + * C X ((D-)Cache Enable) Controlled by cacheLib + * W X (Write Buffer) Controlled by cacheLib + * P 1 (PROG32) should be set before this + * D 1 (DATA32) should be set before this + * L 1 (Late abort on earlier CPUs) ignore + * B X (Big/Little-endian) should be set before this + * S 1 (System) + * R 0 (ROM) + * F 0 Should be Zero + * Z X (Branch prediction enable on 810) Controlled by cacheLib + * I X (I-cache enable) Controlled by cacheLib + * + * For time being, do not enable the address alignment fault, as GCC + * currently generates unaligned accesses in its code, and switching this + * on will cause immediate faults. So, do not put it into the enable + * mask. + * + * We used to clear all the Reserved/Should Be Zero bits when the + * MMU/MPU was enabled, by including one bits for them in the definition + * of MMU_ENABLE_MASK. We no longer do this, as CPU designers may extend + * the definitions of the bits within the MMU Control Register. The MMU + * Control register is initialised within romInit()/sysInit(), as the BSP + * is the only place where the particular details of the CPU/MMU are + * actually known. In general, it will be appropriate for the BSP to + * initialise the MMUCR Reserved/Should Be Zero bits to zero. When the + * MMU is enabled, we will only change the bits we are particularly + * concerned about, by using a Read-Modify-Write strategy. + */ + + /* This defines the operating mode MMUCR_ROM, MMUCR_SYSTEM, or neither */ + + +#define MMUCR_MODE 0 /* This is specific to ARMARCH6 */ + +#define MMU_ENABLE_MASK (MMUCR_M_ENABLE | MMUCR_EXTENDED_PAGE) + +#define MMU_ENABLE_VALUE (MMUCR_M_ENABLE | MMUCR_MODE | MMUCR_EXTENDED_PAGE) + +#define MMU_MUST_SET_VALUE ( MMUCR_PROG32 | MMUCR_DATA32 | MMUCR_L_ENABLE | \ + MMUCR_W_ENABLE ) + +#if (_BYTE_ORDER == _LITTLE_ENDIAN) +#define MMU_INIT_VALUE ( MMU_MUST_SET_VALUE | MMUCR_MODE) +#else +#define MMU_INIT_VALUE ( MMU_MUST_SET_VALUE | MMUCR_BIGEND | MMUCR_MODE) +#endif + + +#ifndef _ASMLANGUAGE + +IMPORT void mmuArm1136jfLibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR), + PHYS_ADDR(virtToPhys) (VIRT_ADDR)); +IMPORT void mmuArm1136jfTtbrSet (MMU_LEVEL_1_DESC *); +IMPORT MMU_LEVEL_1_DESC * mmuArm1136jfTtbrGet ( void); +IMPORT void mmuArm1136jfDacrSet (UINT32 dacrVal); +IMPORT void mmuArm1136jfTLBIDFlushEntry (VIRT_ADDR *addr); +IMPORT void mmuArm1136jfTLBIDFlushAll (void); +IMPORT void mmuArm1136jfAEnable (UINT32 cacheState); +IMPORT void mmuArm1136jfADisable (void); +IMPORT STATUS mmuArm1136jfPBitSet ( VIRT_ADDR virtAddr, UINT32 size); +IMPORT STATUS mmuArm1136jfPBitClear ( VIRT_ADDR virtAddr, UINT32 size); +IMPORT STATUS mmuArm1136jfPBitGet ( VIRT_ADDR virtAddr ); +IMPORT STATUS mmuArm1136jfAcrGet (void ); +IMPORT void mmuArm1136jfAcrSet (UINT32 acrVal); +IMPORT STATUS mmuArm1136jfITcmrGet (void ); +IMPORT void mmuArm1136jfITcmrSet (UINT32 acrVal); +IMPORT STATUS mmuArm1136jfDTcmrGet (void ); +IMPORT void mmuArm1136jfDTcmrSet (UINT32 acrVal); + +#endif /* _ASMLANGUAGE */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmmuArm1136jfLibh */ diff --git a/h/arch/arm/mmuArm710aLib.h b/h/arch/arm/mmuArm710aLib.h new file mode 100644 index 0000000..c10e2c2 --- /dev/null +++ b/h/arch/arm/mmuArm710aLib.h @@ -0,0 +1,38 @@ +/* mmuArm710aLib.h - ARM 710a MMU library header file */ + +/* Copyright 1998-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,08feb05,rec use VIRT_ADDR and PHYS_ADDR instead of void +01b,20jan99,cdp removed support for old ARM libraries. +01a,24nov98,cdp created. +*/ + +#ifndef __INCmmuArm710aLibh +#define __INCmmuArm710aLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +IMPORT void mmuArm710aLibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR), + PHYS_ADDR(virtToPhys) (VIRT_ADDR)); +IMPORT void mmuArm710aTtbrSet (LEVEL_1_DESC *); +IMPORT void mmuArm710aDacrSet (UINT32 dacrVal); +IMPORT void mmuArm710aTLBIDFlushEntry (void *addr); +IMPORT void mmuArm710aTLBIDFlushAll (void); +IMPORT void mmuArm710aAEnable (UINT32 cacheState); +IMPORT void mmuArm710aADisable (void); + +#endif /* _ASMLANGUAGE */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmmuArm710aLibh */ diff --git a/h/arch/arm/mmuArm926eLib.h b/h/arch/arm/mmuArm926eLib.h new file mode 100644 index 0000000..f8234e3 --- /dev/null +++ b/h/arch/arm/mmuArm926eLib.h @@ -0,0 +1,117 @@ +/* mmuArm926eLib.h - ARM 926E MMU library header file */ + +/* Copyright 1998-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,18apr05,jb Fix for SPR 108034 +01d,08feb05,rec use VIRT_ADDR and PHYS_ADDR instead of void +01c,10feb05,jb Reverting to ROM mode for shared data/libraries +01b,09dec04,jb Palify Arm MMU +01a,09dec02,jpd created, based on mmuArm920tLib.h, version 01a. +*/ + +#ifndef __INCmmuArm926eLibh +#define __INCmmuArm926eLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#define MMU_ID_ARM926E 0x069260 + +#include "mmuArmPalLib.h" + +/* + * Values to be used when mmuEnable() is called. This will be after the MMU has + * been initialised by sysInit()/romInit() and after cacheLib has set whatever + * cache enable settings have been chosen. + * + * M 1 Enable MMU + * A 0 Disable address alignment fault + * C X ((D-)Cache Enable) Controlled by cacheLib + * W X (Write Buffer) Controlled by cacheLib + * P 1 (PROG32) should be set before this + * D 1 (DATA32) should be set before this + * L 1 (Late abort on earlier CPUs) ignore + * B X (Big/Little-endian) should be set before this + * S 1 (System) + * R 0 (ROM) + * F 0 Should be Zero + * Z X (Branch prediction enable on 810) Controlled by cacheLib + * I X (I-cache enable) Controlled by cacheLib + * + * For time being, do not enable the address alignment fault, as GCC + * currently generates unaligned accesses in its code, and switching this + * on will cause immediate faults. So, do not put it into the enable + * mask. + * + * We used to clear all the Reserved/Should Be Zero bits when the + * MMU/MPU was enabled, by including one bits for them in the definition + * of MMU_ENABLE_MASK. We no longer do this, as CPU designers may extend + * the definitions of the bits within the MMU Control Register. The MMU + * Control register is initialised within romInit()/sysInit(), as the BSP + * is the only place where the particular details of the CPU/MMU are + * actually known. In general, it will be appropriate for the BSP to + * initialise the MMUCR Reserved/Should Be Zero bits to zero. When the + * MMU is enabled, we will only change the bits we are particularly + * concerned about, by using a Read-Modify-Write strategy. + */ + + /* This defines the operating mode MMUCR_ROM, MMUCR_SYSTEM, or neither */ + +#define MMUCR_MODE MMUCR_ROM /* This MUST remain ROM for shared libraries */ + +#define MMUCR_L4_ENABLE (1<<15) /* L4 enable, ARMv4 behavior */ + +#define MMU_ENABLE_MASK (MMUCR_M_ENABLE | MMUCR_SYSTEM | MMUCR_ROM) + +#define MMU_ENABLE_VALUE (MMUCR_M_ENABLE | MMUCR_MODE) + + /* + * Values to be used when the MMU Control Register is initialised from + * within romInit.s or sysALib.s (before the MMU is enabled). Note that + * on 710A, this is also used to initialise the soft-copy of the MMU CR + * that we need to keep (in order to emulate Read-Modify-Write + * operations). So, the BSP *MUST* initialise the MMU CR with the value + * contained here, or else trouble will ensue. This restriction does + * not apply to non-710A BSPs, but caution must be exercised in choosing a + * value different to that defined here. + */ + +#if (_BYTE_ORDER == _LITTLE_ENDIAN) + + /* W bit is Should Be One */ +#define MMU_INIT_VALUE (MMUCR_PROG32 | MMUCR_DATA32 | MMUCR_L_ENABLE | \ + MMUCR_MODE) + +#else /* _BYTE_ORDER == _LITTLE_ENDIAN now _BIG_ENDIAN */ + + /* big endian */ + +#define MMU_INIT_VALUE (MMUCR_PROG32 | MMUCR_DATA32 | MMUCR_L_ENABLE | \ + MMUCR_BIGEND | MMUCR_MODE) + +#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ + +#ifndef _ASMLANGUAGE + +IMPORT void mmuArm926eLibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR), + PHYS_ADDR(virtToPhys) (VIRT_ADDR)); +IMPORT MMU_LEVEL_1_DESC * mmuArm926eTtbrGet ( void); +IMPORT void mmuArm926eTtbrSet (MMU_LEVEL_1_DESC *); +IMPORT void mmuArm926eDacrSet (UINT32 dacrVal); +IMPORT void mmuArm926eTLBIDFlushEntry (void *addr); +IMPORT void mmuArm926eTLBIDFlushAll (void); +IMPORT void mmuArm926eAEnable (UINT32 cacheState); +IMPORT void mmuArm926eADisable (void); + +#endif /* _ASMLANGUAGE */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmmuArm926eLibh */ diff --git a/h/arch/arm/mmuArmArch6PalLib.h b/h/arch/arm/mmuArmArch6PalLib.h new file mode 100644 index 0000000..5801ab5 --- /dev/null +++ b/h/arch/arm/mmuArmArch6PalLib.h @@ -0,0 +1,358 @@ +/* mmuArmArch6PalLib.h - ARM MMU library header file */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01s,30mar05,jb Extracted from mmuArmArch6PalLib.h, 01u +*/ + + +#ifndef __INCmmuArmArch6PalLibh +#define __INCmmuArmArch6PalLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "memLib.h" + +#endif /* _ASMLANGUAGE */ + +/* + * The page size we will use. Ignore the sub-page, Large Page and Tiny + * Page features. + */ + +#define MMU_PAGE_SIZE 4096 + +/* + * For integrator BSPs + */ + +#define PAGE_SIZE MMU_PAGE_SIZE + +/* + * The amount described by a Level 1 Descriptor, which equals the smallest + * amount of VM allocatable in VxWorks. + */ + +#define MMU_PAGE_BLOCK_SIZE 0x100000 /* 1 MByte */ + +#define MMU_ADRS_TO_L1D_INDEX_SHIFT 20 + +#define MMU_PTE_INDEX_MASK 0x000FF000 /* extract PTE index from Virt Addr */ +#define MMU_PTE_INDEX_SHIFT 12 /* shift to make that into PTE index */ + +#define MMU_L1D_TO_BASE_SHIFT 10 /* to turn L1D to PT base addr */ + +#define MMU_ADDR_PI_MASK 0x00000FFF /* extract page index from Virt Addr */ + +#define MMU_PTE_BA_MASK 0xFFFFF000 /* extract phys base address from PTE */ +#define MMU_PTE_SECA_MASK 0xFFF00000 /* extract section base address from PTE */ +#define MMU_PTE_TYPE_MASK 0x00000003 /* bits [0:1] */ +#define MMU_L1PD_PTE_MASK 0xFFFFFC00 /* extract phys PTE address from L1PD */ +#define MMU_L1PD_TYPE_MASK 0x00000003 /* type bits [0:1] */ +#define MMU_L1PD_AP_MASK 0x00000C00 /* AP bits [10:11] */ +#define MMU_L1PD_CB_MASK 0x0000000C /* CB bits [3:2] */ +#define MMU_L1PD_P_MASK 0x00000200 /* P bit [9] */ + +#define MMU_L1PD_AP_SHIFT 10 +#define MMU_L1PD_CB_SHIFT 2 +#define MMU_L1PD_P_SHIFT 9 + +#define MMU_L1PD_DOMAIN_MASK 0x000001E0 /* domain bits 5-8 */ +#define MMU_L1PD_DOMAIN_SHIFT 5 /* shift to make domain field in L1PD */ + +/* + * The Domain Access Control Register specifies the way in which access + * rights are treated for each of sixteen domains. For each domain the + * current state can be: + * + * 00 no access: all accesses generate aborts + * 01 client: access rights specified in page tables are checked. + * 10 reserved + * 11 manager: accesses not checked against page tables: all access allowed. + */ + +#define MMU_DACR_VAL_NORMAL 1 /* client of 0 */ +#define MMU_DACR_VAL_UNPROTECT 0x03 /* manager of 0 */ + +/* Level 1 Descriptor types */ + +#define MMU_DESC_TYPE_PAGE 1 + +#define MMU_DEF_L1_PAGE 0x00000011 /* domain zero, Page descriptor */ + +/* + * Section descriptors, such as might be used to set up an intermediate + * set of page tables on processors such as SA-1100/SA-1500 where this + * needs to be done from BSP initialisation, before vm(Base)Lib sets up + * a proper set of page tables. + */ + +#define MMU_RAM_SECT_DESC 0xC1E /* R/W cacheable bufferable domain 0 */ +#define MMU_MINICACHE_SECT_DESC 0xC1A /* R/W C+ B- domain 0 */ +#define MMU_OTHER_SECT_DESC 0xC12 /* R/W C- B- domain 0 */ + + +/* Level 2 Descriptor or Page Table Entry (PTE) types */ + +#define MMU_PTE_TYPE_FAULT 0 /* any access will cause a fault */ +#define MMU_PTE_TYPE_LG_PAGE 1 /* Large page descriptor */ +#define MMU_PTE_TYPE_SM_PAGE 2 /* Small page descriptor */ +#define MMU_PTE_TYPE_EX_PAGE 3 /* Extended page descriptor */ + +/* + * The Translation Table Base register (TTBR) points to a table of Level 1 + * Descriptors. these are either Invalid Section descriptors, Section + * Descriptors, or Page Table Descriptors. If Page Table Descriptors, they + * each point to a table of Level 2 Page Descriptors, or Page Table Entries + * (PTEs). + * The 32-bit (virtual) address space allows for 4096 M. Each Level 1 + * Descriptor describes a 1 M area of memory. There are therefore 4096 Level + * 1 Descriptors, and each table of 256 Level 2 Page Descriptors (PTEs) + * describes 256 4 kbyte pages. + */ + +#define MMU_NUM_L1_DESCS 4096 +#define MMU_NUM_L2_DESCS 256 +#define MMU_L1_TABLE_SIZE (MMU_NUM_L1_DESCS * sizeof(MMU_LEVEL_1_DESC)) + + +/* No. of pages a Level 1 Descriptor table takes up */ + +#define MMU_L1_DESC_PAGES (MMU_L1_TABLE_SIZE / MMU_PAGE_SIZE) + + +/* Size of a Page Table */ + +#define MMU_PAGE_TABLE_SIZE (MMU_NUM_L2_DESCS * sizeof(PTE)) + + +/* + * Architecture-dependent MMU states. These are states settable for pages and + * here they correspond to settings in the Page Table Entries (PTEs). + * + * We set Valid/Invalid by setting a Fault second-level descriptor rather + * than by using the Access Permissions within a small page second-level + * descriptor. This is because we will want to use the Access Permissions to + * control supervisor mode access and we cannot then use the AP bits + * to disallow access as the SR bits in the MMU Control register must be set + * to 10 in order to control read/write access from Supervisor mode. + */ + +#define MMU_STATE_INVALID_STATE 0xFFFFFFFF + +#define MMU_STATE_MASK_VALID 0x00000003 /* 2nd level desc type*/ + +#define MMU_STATE_MASK_WRITABLE 0x00000230 /* All APn bits */ + +#define MMU_STATE_MASK_CACHEABLE 0x0000000C /* CB bits */ +#define MMU_STATE_MASK_BUFFERABLE 0x00000004 + +#define MMU_STATE_VALID MMU_PTE_TYPE_SM_PAGE /* set to page type */ +#define MMU_STATE_VALID_NOT MMU_PTE_TYPE_FAULT /* set to type fault */ + +#define MMU_STATE_MASK_PROTECTION 0x00000230 /* APX + APn bits */ + +#define MMU_STATE_SUP_RO 0x00000210 /* APX: 1 AP: 01 */ +#define MMU_STATE_SUP_RW 0x00000010 /* APX: 0 AP: 01 */ +#define MMU_STATE_SUP_RO_USR_RO 0x00000220 /* APX: 1 AP: 10 */ +#define MMU_STATE_SUP_RW_USR_RO 0x00000020 /* APX: 0 AP: 10 */ +#define MMU_STATE_SUP_RW_USR_RW 0x00000030 /* APX: 0 AP: 11 */ + +#define MMU_STATE_WRITABLE MMU_STATE_SUP_RW + +#define MMU_STATE_WRITABLE_NOT MMU_STATE_SUP_RO + +/* Write-through mode is only available on some CPUs */ + +#define MMU_STATE_CACHEABLE_WRITETHROUGH 0x8 + +#define MMU_STATE_CACHEABLE_COPYBACK 0xC /* write back */ + +/* + * Set the default state to be copyback. CACHEABLE_WRITETHROUGH can also be + * selected on those cache designs that permit it. + */ + +#define MMU_STATE_CACHEABLE MMU_STATE_CACHEABLE_COPYBACK + +#define MMU_STATE_CACHEABLE_NOT 0x0 + +#define MMU_STATE_BUFFERABLE 0x4 /* bufferable, not cacheable */ +#define MMU_STATE_BUFFERABLE_NOT 0x0 /* will also set not cacheable*/ + +/* + * Under VxWorks AE 1.1, when setting either of the attributes SPL_0 or SPL_1, + * using vmPgAttrSet(), it is necessary to: + * + * 1. specify MMU_ATTR_SPL_MSK ORred with MMU_ATTR_CACHE_MSK in the mask + * argument to the routine, and: + * 2. specify the appropriate cache state ORred in to the state argument + * to the routine. + * + * So, to set a page as bufferable not cacheable, it is necessary to + * specify both MMU_ATTR_SPL_0 and specify MMU_ATTR_CACHE_OFF in the + * state argument. To mark a page as cacheable in the minicache, + * MMU_ATTR_SPL_1 and MMU_ATTR_CACHE_COPYBACK must be specified in the + * state argument. In both cases, specify MMU_ATTR_SPL_MSK ORred with + * MMU_ATTR_CACHE_MSK in the mask argument. + * + * These restrictions were not present in VxWorks AE 1.0. + * + * To "unset" the special attibutes SPL_0 or SPL_1, specify + * MMU_ATTR_CACHE_MSK in the mask parameter (without MMU_ATTR_SPL_MSK), + * and specify the cacheability required in the state argument. + * + * We provide the following aliases on ARM, to make life easier. + */ + +#define MMU_ATTR_BUFFERABLE (MMU_ATTR_SPL_0) + +/* MMU Control Register bit allocations */ + +#define MMUCR_M_ENABLE (1<<0) /* MMU enable */ +#define MMUCR_A_ENABLE (1<<1) /* Address alignment fault enable */ +#define MMUCR_C_ENABLE (1<<2) /* (data) cache enable */ +#define MMUCR_W_ENABLE (1<<3) /* write buffer enable */ +#define MMUCR_PROG32 (1<<4) /* PROG32 */ +#define MMUCR_DATA32 (1<<5) /* DATA32 */ +#define MMUCR_L_ENABLE (1<<6) /* Late abort on earlier CPUs */ +#define MMUCR_BIGEND (1<<7) /* Big-endian (=1), little-endian (=0) */ +#define MMUCR_SYSTEM (1<<8) /* System bit, modifies MMU protections */ +#define MMUCR_ROM (1<<9) /* ROM bit, modifies MMU protections */ +#define MMUCR_F (1<<10) /* Should Be Zero */ +#define MMUCR_Z_ENABLE (1<<11) /* Branch prediction enable on 810 */ +#define MMUCR_I_ENABLE (1<<12) /* Instruction cache enable */ +#define MMUCR_V_ENABLE (1<<13) /* Exception vectors remap to 0xFFFF0000 */ +#define MMUCR_ALTVECT MMUCR_V_ENABLE /* alternate vector select */ +#define MMUCR_RR_ENABLE (1<<14) /* Round robin cache replacement enable */ +#define MMUCR_ROUND_ROBIN MMUCR_RR_ENABLE /* round-robin placement */ +#define MMUCR_DISABLE_TBIT (1<<15) /* disable TBIT */ +#define MMUCR_ENABLE_DTCM (1<<16) /* Enable Data TCM */ +#define MMUCR_ENABLE_ITCM (1<<18) /* Enable Instruction TCM */ +#define MMUCR_UNALIGNED_ENABLE (1<<22) /* Enable unaligned access */ +#define MMUCR_EXTENDED_PAGE (1<<23) /* Use extended PTE format */ +#define MMUCR_VECTORED_INTERRUPT (1<<24) /* Enable VIC Interface */ + +#define ADDR_TO_PAGE 12 /* shift phys address to PTE page base address*/ + +#ifndef _ASMLANGUAGE + +#if (_BYTE_ORDER == _LITTLE_ENDIAN) + +/* little-endian */ + +/* First level page descriptors */ + +typedef struct + { + UINT type : 2; /* descriptor type, 1 => page */ + UINT pad1 : 2; /* SBZ */ + UINT pad2 : 1; /* SBO */ + UINT domain : 4; /* domain number */ + UINT pbit : 1; /* 'P' bit */ + UINT addr : 22; /* base address of page table */ + } PAGE_DESC_FIELD; + + +/* Layout of Page Table Entries (PTEs), actually small page descriptors */ + +typedef struct + { + UINT type : 2; /* page type, 3 => extended small page */ + UINT cb : 2; /* cacheable/bufferable bits */ + UINT ap : 2; /* access permission */ + UINT tex : 4; /* type extension field */ + UINT sbz : 2; /* should be zero */ + UINT addr : 20; /* page base address */ + } PTE_FIELD; + +#else /* (_BYTE_ORDER == _LITTLE_ENDIAN) */ + +/* big-endian */ + +/* First level page descriptors */ + +typedef struct + { + UINT addr : 22; /* descriptor type, 1 => page */ + UINT pbit : 1; /* XSCALE 'P' bit */ + UINT domain : 4; /* domain number */ + UINT pad2 : 1; /* SBO */ + UINT pad1 : 2; /* SBZ */ + UINT type : 2; /* base address of page table */ + } PAGE_DESC_FIELD; + +/* Layout of Page Table Entries (PTEs), actually small page descriptors */ + +typedef struct + { + UINT addr : 20; /* page base address */ + UINT sbz : 2; /* should be zero */ + UINT tex : 4; /* type extension field */ + UINT ap : 2; /* access permission */ + UINT cb : 2; /* cacheable/bufferable bits */ + UINT type : 2; /* page type, 3 => extended small page */ + } PTE_FIELD; + +#endif /* (_BYTE_ORDER == _LITTLE_ENDIAN) */ + +/* First level descriptor access */ + +typedef union + { + PAGE_DESC_FIELD fields; + UINT32 bits; + } MMU_LEVEL_1_DESC; + +/* Second level descriptor access */ + +typedef union + { + PTE_FIELD fields; + UINT32 bits; + } PTE; + +/* Pointer to a First level table */ + +typedef struct mmuTransTblStruct + { + MMU_LEVEL_1_DESC *pLevel1Table; + } MMU_TRANS_TBL; +/* Externally visible mmuLib, mmuMapLib and mmuALib2 routines */ + +IMPORT UINT32 mmuReadId (void); +IMPORT PHYS_ADDR mmuVirtToPhys (VIRT_ADDR addr); +IMPORT VIRT_ADDR mmuPhysToVirt (PHYS_ADDR addr); + +IMPORT UINT32 (* mmuCrGet) (void); +IMPORT void (* mmuModifyCr) (UINT32 value, UINT32 mask); +IMPORT UINT32 mmuHardCrGet (void); +IMPORT UINT32 mmuSoftCrGet (void); +IMPORT void mmuModifyHardCr (UINT32 value, UINT32 mask); +IMPORT void mmuModifySoftCr (UINT32 value, UINT32 mask); + +/* + * Pointer to a function that can be filled in by the BSP to point to a + * function that returns a memory partition id for an area of memory to store + * the Level 1 and Level 2 page tables. This area must be big enough for all + * use. No provision is made to use that memory and then continue using + * system memory once that has been filled. + * N.B. at the time of writing, this feature has NEVER been tested at all. + */ + +IMPORT PART_ID (* _func_armPageSource) (void); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmmuArmArch6PalLibh */ diff --git a/h/arch/arm/mmuArmLib.h b/h/arch/arm/mmuArmLib.h new file mode 100644 index 0000000..ef7c644 --- /dev/null +++ b/h/arch/arm/mmuArmLib.h @@ -0,0 +1,85 @@ +/* mmuArmLib.h - ARM MMU library header file */ + +/* Copyright 1996-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01u,29mar05,jb Adding ARMARCH6 and 1136 support +01t,08feb05,rec use VIRT_ADDR and PHYS_ADDR instead of void +01s,09dec04,jb Palifying mmu + See mmuArmPalLib.h for previous contents +01r,10aug04,scm adjust for removal of MPU support, add 926E... +01q,18sep03,scm BASE 6 port... +01p,04oct01,scm add extended small page table support for XScale... +01o,23jul01,scm change XScale name to conform to coding standards... +01n,11jul01,scm add support for XScale... +01m,29mar01,jpd removed externs for mmyPhysToVirt & mmuVirtToPhys (SPR #63512). +01l,19mar01,jpd redefine MMU_ATTR_BUFFERABLE and MMU_ATTR_CACHE_MINICACHE + (SPR #64788). +01k,16aug00,jpd no longer clear MMUCR Reserved/Should Be Zero bits (SPR #33608) +01j,14jun00,jpd reworked MMU_STATE_WRITETHROUGH definition. +01i,17feb00,jpd T3: prefixed defs with MMU_; added new defs; changed SR to 10. +01h,07sep99,jpd added ARM740T, ARM920T support. +01g,20jan99,cdp removed support for old ARM libraries; + add prefix to MMU_IDs. +01f,24nov98,jpd added ARM940T support, added other CPU ids; removed + mmuIntLock/Unlock as intIFLock/Unlock to be used instead; + cdp restructured for multiple cache/MMU libraries; big-endian. +01e,09mar98,jpd added MMUCTR_ definitions for ARM810 and extra cache states. +01d,20jan98,jpd added _func_armPhysToVirt() etc. function pointers. +01c,17sep97,jpd added MMU_INIT_VALUE and mmuIntLock/Unlock definitions. +01b,24jan97,jpd modified mmuAEnable definition. +01a,09may96,cdp created. +*/ + +#ifndef __INCmmuArmLibh +#define __INCmmuArmLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#if (ARMMMU != ARMMMU_NONE) + +#if (ARMMMU == ARMMMU_710A) +#include "mmuArm710aLib.h" +#elif (ARMMMU == ARMMMU_720T) +#include "mmuArm720tLib.h" +#elif (ARMMMU == ARMMMU_740T) +#include "mmuArm740tLib.h" +#elif (ARMMMU == ARMMMU_810) +#include "mmuArm810Lib.h" +#elif (ARMMMU == ARMMMU_SA110) +#include "mmuArmSA110Lib.h" +#elif (ARMMMU == ARMMMU_SA1100) +#include "mmuArmSA1100Lib.h" +#elif (ARMMMU == ARMMMU_SA1500) +#include "mmuArmSA1500Lib.h" +#elif (ARMMMU == ARMMMU_920T) +#include "mmuArm920tLib.h" +#elif (ARMMMU == ARMMMU_926E) +#include "mmuArm926eLib.h" +#elif (ARMMMU == ARMMMU_940T) +#include "mmuArm940tLib.h" +#elif (ARMMMU == ARMMMU_946E) +#include "mmuArm946eLib.h" +#elif (ARMMMU == ARMMMU_XSCALE) +#include "mmuArmXSCALELib.h" +#elif (ARMMMU == ARMMMU_1020E) +#include "mmuArm1020eLib.h" +#elif (ARMMMU == ARMMMU_1022E) +#include "mmuArm1022eLib.h" +#elif (ARMMMU == ARMMMU_1136JF) +#include "mmuArm1136jfLib.h" +#else +#error "Unknown MMU specified" +#endif /* ARMMMU == ARMMMU_710A */ + +#endif /* (ARMMMU != ARMMMU_NONE) */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmmuArmLibh */ diff --git a/h/arch/arm/mmuArmPalLib.h b/h/arch/arm/mmuArmPalLib.h new file mode 100644 index 0000000..8f4d40a --- /dev/null +++ b/h/arch/arm/mmuArmPalLib.h @@ -0,0 +1,429 @@ +/* mmuArmPalLib.h - ARM MMU library header file */ + +/* Copyright 1996-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01v,24jun05,scm correct PAGE_DESC_FIELD for missing BE pad3 field, (SPR 110348) +01u,08feb05,rec use VIRT_ADDR and PHYS_ADDR instead of void +01t,31jan05,jb Adding OTHER_SECT_DESC to resolve bsp reference +01s,09dec04,jb Palifying mmu, extracted from mmuArmLib.h, 01r +*/ + +/* + History from mmuArmLib.h +01r,10aug04,scm adjust for removal of MPU support, add 926E... +01q,18sep03,scm BASE 6 port... +01p,04oct01,scm add extended small page table support for XScale... +01o,23jul01,scm change XScale name to conform to coding standards... +01n,11jul01,scm add support for XScale... +01m,29mar01,jpd removed externs for mmyPhysToVirt & mmuVirtToPhys (SPR #63512). +01l,19mar01,jpd redefine MMU_ATTR_BUFFERABLE and MMU_ATTR_CACHE_MINICACHE + (SPR #64788). +01k,16aug00,jpd no longer clear MMUCR Reserved/Should Be Zero bits (SPR #33608) +01j,14jun00,jpd reworked MMU_STATE_WRITETHROUGH definition. +01i,17feb00,jpd T3: prefixed defs with MMU_; added new defs; changed SR to 10. +01h,07sep99,jpd added ARM740T, ARM920T support. +01g,20jan99,cdp removed support for old ARM libraries; + add prefix to MMU_IDs. +01f,24nov98,jpd added ARM940T support, added other CPU ids; removed + mmuIntLock/Unlock as intIFLock/Unlock to be used instead; + cdp restructured for multiple cache/MMU libraries; big-endian. +01e,09mar98,jpd added MMUCTR_ definitions for ARM810 and extra cache states. +01d,20jan98,jpd added _func_armPhysToVirt() etc. function pointers. +01c,17sep97,jpd added MMU_INIT_VALUE and mmuIntLock/Unlock definitions. +01b,24jan97,jpd modified mmuAEnable definition. +01a,09may96,cdp created. +*/ + +#ifndef __INCmmuArmPalLibh +#define __INCmmuArmPalLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifndef _ASMLANGUAGE + +#include "memLib.h" + +#endif /* _ASMLANGUAGE */ + +/* + * MMUs are not fitted to all processors, and so the definitions below + * should not need to be included for processors without MMUs. + */ + +#if (ARMMMU != ARMMMU_NONE) + +/* + * The page size we will use. Ignore the sub-page, Large Page and Tiny + * Page features. + */ + +#define MMU_PAGE_SIZE 4096 + +/* + * The amount described by a Level 1 Descriptor, which equals the smallest + * amount of VM allocatable in VxWorks. + */ + +#define MMU_PAGE_BLOCK_SIZE 0x100000 /* 1 MByte */ + +#define MMU_ADRS_TO_L1D_INDEX_SHIFT 20 + +#define MMU_PTE_INDEX_MASK 0x000FF000 /* extract PTE index from Virt Addr */ +#define MMU_PTE_INDEX_SHIFT 12 /* shift to make that into PTE index */ + +#define MMU_L1D_TO_BASE_SHIFT 10 /* to turn L1D to PT base addr */ + +#define MMU_ADDR_PI_MASK 0x00000FFF /* extract page index from Virt Addr */ + +#define MMU_PTE_BA_MASK 0xFFFFF000 /* extract phys base address from PTE */ +#define MMU_PTE_SECA_MASK 0xFFF00000 /* extract section base address from PTE */ +#define MMU_PTE_TYPE_MASK 0x00000003 /* bits [0:1] */ +#define MMU_L1PD_PTE_MASK 0xFFFFFC00 /* extract phys PTE address from L1PD */ +#define MMU_L1PD_TYPE_MASK 0x00000003 /* type bits [0:1] */ +#define MMU_L1PD_AP_MASK 0x00000C00 /* AP bits [10:11] */ +#define MMU_L1PD_CB_MASK 0x0000000C /* CB bits [3:2] */ +#define MMU_L1PD_P_MASK 0x00000200 /* P bit [9] */ + +#define MMU_L1PD_AP_SHIFT 10 +#define MMU_L1PD_CB_SHIFT 2 +#define MMU_L1PD_P_SHIFT 9 + +#define MMU_L1PD_DOMAIN_MASK 0x000001E0 /* domain bits 5-8 */ +#define MMU_L1PD_DOMAIN_SHIFT 5 /* shift to make domain field in L1PD */ + +/* + * The Domain Access Control Register specifies the way in which access + * rights are treated for each of sixteen domains. For each domain the + * current state can be: + * + * 00 no access: all accesses generate aborts + * 01 client: access rights specified in page tables are checked. + * 10 reserved + * 11 manager: accesses not checked against page tables: all access allowed. + */ + +#define MMU_DACR_VAL_NORMAL 1 /* client of 0 */ +#define MMU_DACR_VAL_UNPROTECT 0x03 /* manager of 0 */ + +/* Level 1 Descriptor types */ + +#define MMU_DESC_TYPE_PAGE 1 + +#define MMU_DEF_L1_PAGE 0x00000011 /* domain zero, Page descriptor */ + +/* + * Section descriptors, such as might be used to set up an intermediate + * set of page tables on processors such as SA-1100/SA-1500 where this + * needs to be done from BSP initialisation, before vm(Base)Lib sets up + * a proper set of page tables. + */ + +#define MMU_RAM_SECT_DESC 0xC1E /* R/W cacheable bufferable domain 0 */ +#define MMU_MINICACHE_SECT_DESC 0xC1A /* R/W C+ B- domain 0 */ +#define MMU_OTHER_SECT_DESC 0xC12 /* R/W C- B- domain 0 */ + + +/* Level 2 Descriptor or Page Table Entry (PTE) types */ + +#define MMU_PTE_TYPE_FAULT 0 /* any access will cause a fault */ +#define MMU_PTE_TYPE_LG_PAGE 1 /* Large page descriptor */ +#define MMU_PTE_TYPE_SM_PAGE 2 /* Small page descriptor */ +#define MMU_PTE_TYPE_EX_PAGE 3 /* Extended page descriptor */ + +/* + * The Translation Table Base register (TTBR) points to a table of Level 1 + * Descriptors. these are either Invalid Section descriptors, Section + * Descriptors, or Page Table Descriptors. If Page Table Descriptors, they + * each point to a table of Level 2 Page Descriptors, or Page Table Entries + * (PTEs). + * The 32-bit (virtual) address space allows for 4096 M. Each Level 1 + * Descriptor describes a 1 M area of memory. There are therefore 4096 Level + * 1 Descriptors, and each table of 256 Level 2 Page Descriptors (PTEs) + * describes 256 4 kbyte pages. + */ + +#define MMU_NUM_L1_DESCS 4096 +#define MMU_NUM_L2_DESCS 256 +#define MMU_L1_TABLE_SIZE (MMU_NUM_L1_DESCS * sizeof(MMU_LEVEL_1_DESC)) + + +/* No. of pages a Level 1 Descriptor table takes up */ + +#define MMU_L1_DESC_PAGES (MMU_L1_TABLE_SIZE / MMU_PAGE_SIZE) + + +/* Size of a Page Table */ + +#define MMU_PAGE_TABLE_SIZE (MMU_NUM_L2_DESCS * sizeof(PTE)) + + +/* + * Architecture-dependent MMU states. These are states settable for pages and + * here they correspond to settings in the Page Table Entries (PTEs). + * + * We set Valid/Invalid by setting a Fault second-level descriptor rather + * than by using the Access Permissions within a small page second-level + * descriptor. This is because we will want to use the Access Permissions to + * control supervisor mode access and we cannot then use the AP bits + * to disallow access as the SR bits in the MMU Control register must be set + * to 10 in order to control read/write access from Supervisor mode. + */ + +#define MMU_STATE_INVALID_STATE 0xFFFFFFFF + +#define MMU_STATE_MASK_VALID 0x03 /* 2nd level desc type*/ + +#define MMU_STATE_MASK_WRITABLE 0x00000FF0 /* All APn bits */ + +#define MMU_STATE_MASK_CACHEABLE 0x0000000C /* CB bits */ +#define MMU_STATE_MASK_BUFFERABLE 0x00000004 + +#define MMU_STATE_VALID MMU_PTE_TYPE_SM_PAGE /* set to page type */ +#define MMU_STATE_VALID_NOT MMU_PTE_TYPE_FAULT /* set to type fault */ + +#define MMU_STATE_WRITABLE 0x00000FF0 /* APn bits to 11 */ + +#define MMU_STATE_WRITABLE_NOT 0x0 /* APn bits to 00 */ + +#define MMU_STATE_MASK_PROTECTION 0x00000FF0 /* APn bits */ + +#define MMU_STATE_SUP_RO 0x00000000 /* AP: 00 */ +#define MMU_STATE_SUP_RW 0x00000550 /* AP: 01 */ +#define MMU_STATE_USR_RO_SUP_RW 0x00000AA0 /* AP: 10 */ +#define MMU_STATE_USR_RW_SUP_RW 0x00000FF0 /* AP: 11 */ + +/* Write-through mode is only available on some CPUs */ + +#define MMU_STATE_CACHEABLE_WRITETHROUGH 0x8 + +#define MMU_STATE_CACHEABLE_COPYBACK 0xC /* write back */ + +/* + * Set the default state to be copyback. CACHEABLE_WRITETHROUGH can also be + * selected on those cache designs that permit it. + */ + +#define MMU_STATE_CACHEABLE MMU_STATE_CACHEABLE_COPYBACK + +#define MMU_STATE_CACHEABLE_NOT 0x0 + +#define MMU_STATE_BUFFERABLE 0x4 /* bufferable, not cacheable */ +#define MMU_STATE_BUFFERABLE_NOT 0x0 /* will also set not cacheable*/ + +/* + * Under VxWorks AE 1.1, when setting either of the attributes SPL_0 or SPL_1, + * using vmPgAttrSet(), it is necessary to: + * + * 1. specify MMU_ATTR_SPL_MSK ORred with MMU_ATTR_CACHE_MSK in the mask + * argument to the routine, and: + * 2. specify the appropriate cache state ORred in to the state argument + * to the routine. + * + * So, to set a page as bufferable not cacheable, it is necessary to + * specify both MMU_ATTR_SPL_0 and specify MMU_ATTR_CACHE_OFF in the + * state argument. To mark a page as cacheable in the minicache, + * MMU_ATTR_SPL_1 and MMU_ATTR_CACHE_COPYBACK must be specified in the + * state argument. In both cases, specify MMU_ATTR_SPL_MSK ORred with + * MMU_ATTR_CACHE_MSK in the mask argument. + * + * These restrictions were not present in VxWorks AE 1.0. + * + * To "unset" the special attibutes SPL_0 or SPL_1, specify + * MMU_ATTR_CACHE_MSK in the mask parameter (without MMU_ATTR_SPL_MSK), + * and specify the cacheability required in the state argument. + * + * We provide the following aliases on ARM, to make life easier. + */ + +#define MMU_ATTR_BUFFERABLE (MMU_ATTR_SPL_0) + +/* MMU Control Register bit allocations */ + +#define MMUCR_M_ENABLE (1<<0) /* MMU enable */ +#define MMUCR_A_ENABLE (1<<1) /* Address alignment fault enable */ +#define MMUCR_C_ENABLE (1<<2) /* (data) cache enable */ +#define MMUCR_W_ENABLE (1<<3) /* write buffer enable */ +#define MMUCR_PROG32 (1<<4) /* PROG32 */ +#define MMUCR_DATA32 (1<<5) /* DATA32 */ +#define MMUCR_L_ENABLE (1<<6) /* Late abort on earlier CPUs */ +#define MMUCR_BIGEND (1<<7) /* Big-endian (=1), little-endian (=0) */ +#define MMUCR_SYSTEM (1<<8) /* System bit, modifies MMU protections */ +#define MMUCR_ROM (1<<9) /* ROM bit, modifies MMU protections */ +#define MMUCR_F (1<<10) /* Should Be Zero */ +#define MMUCR_Z_ENABLE (1<<11) /* Branch prediction enable on 810 */ +#define MMUCR_I_ENABLE (1<<12) /* Instruction cache enable */ +#define MMUCR_V_ENABLE (1<<13) /* Exception vectors remap to 0xFFFF0000 */ +#define MMUCR_ALTVECT MMUCR_V_ENABLE /* alternate vector select */ +#define MMUCR_RR_ENABLE (1<<14) /* Round robin cache replacement enable */ +#define MMUCR_ROUND_ROBIN MMUCR_RR_ENABLE /* round-robin placement */ +#define MMUCR_DISABLE_TBIT (1<<15) /* disable TBIT */ + +/* The following definitions are now deprecated and may be withdrawn */ + +#ifdef MMU_ARM_ALLOW_DEPRECATED + +#define LEVEL_1_DESC MMU_LEVEL_1_DESC +#define PAGE_SIZE MMU_PAGE_SIZE +#define PAGE_BLOCK_SIZE MMU_PAGE_BLOCK_SIZE +#define PTE_INDEX_MASK MMU_PTE_INDEX_MASK +#define PTE_INDEX_SHIFT MMU_PTE_INDEX_SHIFT +#define L1D_TO_BASE_SHIFT MMU_L1D_TO_BASE_SHIFT +#define ADDR_PI_MASK MMU_ADDR_PI_MASK +#define NUM_L1_DESCS MMU_NUM_L1_DESCS +#define NUM_L2_DESCS MMU_NUM_L2_DESCS +#define L1_TABLE_SIZE MMU_L1_TABLE_SIZE +#define L1_DESC_PAGES MMU_L1_DESC_PAGES +#define PAGE_TABLE_SIZE MMU_PAGE_TABLE_SIZE +#define DESC_TYPE_PAGE MMU_DESC_TYPE_PAGE +#define DEF_L1_PAGE MMU_DEF_L1_PAGE +#define PTE_TYPE_FAULT MMU_PTE_TYPE_FAULT +#define PTE_TYPE_SM_PAGE MMU_PTE_TYPE_SM_PAGE +#define RAM_SECT_DESC MMU_RAM_SECT_DESC +#define MINICACHE_SECT_DESC MMU_MINICACHE_SECT_DESC +#define OTHER_SECT_DESC MMU_OTHER_SECT_DESC + +#else /* MMU_ARM_ALLOW_DEPRECATED */ + + /* Some BSPs still reference PAGE_SIZE */ + +#define PAGE_SIZE MMU_PAGE_SIZE + + /* Some BSPs still reference OTHER_SECT_DESC */ + +#define OTHER_SECT_DESC MMU_OTHER_SECT_DESC + +#endif /* MMU_ARM_ALLOW_DEPRECATED */ + +#define ADDR_TO_PAGE 12 /* shift phys address to PTE page base address*/ + +#ifndef _ASMLANGUAGE + +#ifndef MMU_ARCHITECTURE_DEFINES_STRUCTURES /* If using standard ARM MMU structures */ + +/* Default ARMARCH4/5 ARM MMU Structures */ + +#if (_BYTE_ORDER == _LITTLE_ENDIAN) + +/* little-endian */ + +/* First level page descriptors */ + +typedef struct + { + UINT type : 2; /* descriptor type, 1 => page */ + UINT pad1 : 2; /* SBZ */ + UINT pad2 : 1; /* SBO */ + UINT domain : 4; /* domain number */ + UINT pad3 : 1; /* SBZ */ + UINT addr : 22; /* base address of page table */ + } PAGE_DESC_FIELD; + + +/* Layout of Page Table Entries (PTEs), actually small page descriptors */ + +typedef struct + { + UINT type : 2; /* page type, 2 => small page */ + UINT cb : 2; /* cacheable/bufferable bits */ + UINT ap0 : 2; /* access permission, sub-page 0 */ + UINT ap1 : 2; /* access permission, sub-page 1 */ + UINT ap2 : 2; /* access permission, sub-page 2 */ + UINT ap3 : 2; /* access permission, sub-page 3 */ + UINT addr : 20; /* page base address */ + } PTE_FIELD; + +#else /* (_BYTE_ORDER == _LITTLE_ENDIAN) */ + +/* big-endian */ + +/* First level descriptors */ + +typedef struct + { + UINT addr : 22; /* descriptor type, 1 => page */ + UINT pad3 : 1; /* SBZ */ + UINT domain : 4; /* domain number */ + UINT pad2 : 1; /* SBO */ + UINT pad1 : 2; /* SBZ */ + UINT type : 2; /* base address of page table */ + } PAGE_DESC_FIELD; + +/* Layout of Page Table Entries (PTEs), actually small page descriptors */ + +typedef struct + { + UINT addr : 20; /* page base address */ + UINT ap3 : 2; /* access permission, sub-page 3 */ + UINT ap2 : 2; /* access permission, sub-page 2 */ + UINT ap1 : 2; /* access permission, sub-page 1 */ + UINT ap0 : 2; /* access permission, sub-page 0 */ + UINT cb : 2; /* cacheable/bufferable bits */ + UINT type : 2; /* page type, 2 => small page */ + } PTE_FIELD; + +#endif /* (_BYTE_ORDER == _LITTLE_ENDIAN) */ + +/* First level descriptor access */ + +typedef union + { + PAGE_DESC_FIELD fields; + UINT32 bits; + } MMU_LEVEL_1_DESC; + +/* Second level descriptor access */ + +typedef union + { + PTE_FIELD fields; + UINT32 bits; + } PTE; + +/* Pointer to a First level table */ + +typedef struct mmuTransTblStruct + { + MMU_LEVEL_1_DESC *pLevel1Table; + } MMU_TRANS_TBL; + +#endif /* MMU_ARCHITECTURE_DEFINES_STRUCTURES */ + +/* Externally visible mmuLib, mmuMapLib and mmuALib2 routines */ + +IMPORT UINT32 mmuReadId (void); +IMPORT PHYS_ADDR mmuVirtToPhys (VIRT_ADDR addr); +IMPORT VIRT_ADDR mmuPhysToVirt (PHYS_ADDR addr); + +IMPORT UINT32 (* mmuCrGet) (void); +IMPORT void (* mmuModifyCr) (UINT32 value, UINT32 mask); +IMPORT UINT32 mmuHardCrGet (void); +IMPORT UINT32 mmuSoftCrGet (void); +IMPORT void mmuModifyHardCr (UINT32 value, UINT32 mask); +IMPORT void mmuModifySoftCr (UINT32 value, UINT32 mask); + +/* + * Pointer to a function that can be filled in by the BSP to point to a + * function that returns a memory partition id for an area of memory to store + * the Level 1 and Level 2 page tables. This area must be big enough for all + * use. No provision is made to use that memory and then continue using + * system memory once that has been filled. + * N.B. at the time of writing, this feature has NEVER been tested at all. + */ + +IMPORT PART_ID (* _func_armPageSource) (void); + +#endif /* _ASMLANGUAGE */ + +#endif /* (ARMMMU != ARMMMU_NONE) */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmmuArmPalLibh */ diff --git a/h/arch/arm/mmuArmXSCALELib.h b/h/arch/arm/mmuArmXSCALELib.h new file mode 100644 index 0000000..6589b66 --- /dev/null +++ b/h/arch/arm/mmuArmXSCALELib.h @@ -0,0 +1,290 @@ +/* mmuArmXSCALELib.h - XScale MMU library header file */ + +/* Copyright 1998-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,08feb05,rec use VIRT_ADDR and PHYS_ADDR instead of void +01e,10feb05,jb Reverting to ROM mode for shared data/libraries +01d,09dec04,jb Palify Arm MMU +01c,08sep03,scm add P-bit support... +01b,23jul01,scm change XScale name to conform to coding standards... +01a,31aug00,scm created. +*/ + +#ifndef __INCmmuArmXSCALELibh +#define __INCmmuArmXSCALELibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "memLib.h" + +#define MMU_ID_XSCALE 0x052000 + +/* Let the Pal code know Xscale has unique structures */ + +#define MMU_ARCHITECTURE_DEFINES_STRUCTURES + +#include "mmuArmPalLib.h" + +/* Xscale specific definitions follow */ + +#undef MMU_DEF_L1_PAGE +#define MMU_DEF_L1_PAGE 0x00000001 /* domain zero, Page descriptor */ + +#undef MMU_STATE_MASK_WRITABLE +#define MMU_STATE_MASK_WRITABLE 0x00000030 /* All APn bits */ + +#define MMU_STATE_X_BIT 0x00000040 + +#define MMU_STATE_MASK_EX_BUFFERABLE (MMU_STATE_X_BIT | MMU_STATE_MASK_BUFFERABLE) +#define MMU_STATE_MASK_EX_CACHEABLE (MMU_STATE_X_BIT | MMU_STATE_MASK_CACHEABLE) + +#undef MMU_STATE_VALID +#define MMU_STATE_VALID MMU_PTE_TYPE_EX_PAGE /* set to page type */ + +#undef MMU_STATE_WRITABLE +#define MMU_STATE_WRITABLE 0x00000030 /* APn bits to 11 */ + +#undef MMU_STATE_MASK_PROTECTION +#define MMU_STATE_MASK_PROTECTION 0x00000030 /* APn bits */ + +#undef MMU_STATE_SUP_RO +#define MMU_STATE_SUP_RO 0x00000000 /* AP: 00 */ + +#undef MMU_STATE_SUP_RW +#define MMU_STATE_SUP_RW 0x00000010 /* AP: 01 */ + +#undef MMU_STATE_USR_RO_SUP_RW +#define MMU_STATE_USR_RO_SUP_RW 0x00000020 /* AP: 10 */ + +#undef MMU_STATE_USR_RW_SUP_RW +#define MMU_STATE_USR_RW_SUP_RW 0x00000030 /* AP: 11 */ + + /* only AP bits valid on extended small page tables are AP0 */ + +#define MMU_MSK_UNUSED_AP 0xfffff03f +#define MMU_MSK_CHK_APS 0x00000fc0 +#define MMU_MSK_X_BIT 0x00000040 + +#define MMU_STATE_CACHEABLE_MINICACHE 0x48 /* allocate in minicache, X=1, CB=10 */ + + /* the mini data cache attributes to the Auxiliary Control Reg */ + /* used by mmuSetMDBits... */ + +#define MD_COPYBACK 0x00000000 +#define MD_WRITEALLOCATE 0x00000010 +#define MD_WRITETHRU 0x00000020 + +#define MMU_STATE_CACHEABLE_EX_COPYBACK (MMU_STATE_X_BIT | MMU_STATE_CACHEABLE_COPYBACK) + +#define MMU_STATE_EX_CACHEABLE MMU_STATE_CACHEABLE_EX_COPYBACK + +#define MMU_STATE_EX_CACHEABLE_NOT 0x0 + + /* bufferable, not cacheable, no coalesce */ + +#define MMU_STATE_EX_BUFFERABLE (MMU_STATE_X_BIT | MMU_STATE_BUFFERABLE) +#define MMU_STATE_EX_BUFFERABLE_NOT 0x0 /* will also set not cacheable, no coalesce */ + +#define MMU_ATTR_CACHE_MINICACHE (MMU_ATTR_SPL_1 | MMU_ATTR_CACHE_COPYBACK) + + /* + * two new states with extended small page tables, bufferable no coalesce, and + * write back with read/write allocate... + */ + +#define MMU_ATTR_NO_COALESCE (MMU_ATTR_SPL_2 | MMU_ATTR_CACHE_OFF) /* Cache -- no coalesce into buffers */ +#define MMU_ATTR_WRITEALLOCATE (MMU_ATTR_SPL_3 | MMU_ATTR_CACHE_COPYBACK) /* Cache -- write allocate */ + + /* cache states determined by MD-bits of Auxilliary Control Register */ + +#define MMU_ATTR_CACHE_MINICACHE_CB (MMU_ATTR_SPL_1 | MMU_ATTR_CACHE_COPYBACK) +#define MMU_ATTR_CACHE_MINICACHE_WA (MMU_ATTR_SPL_1 | MMU_ATTR_WRITEALLOCATE) +#define MMU_ATTR_CACHE_MINICACHE_WT (MMU_ATTR_SPL_1 | MMU_ATTR_CACHE_WRITETHRU) + + /* Write-through mode is only available on some CPUs */ + +#define MMU_STATE_CACHEABLE_WRITETHROUGH 0x8 + +/* + * Values to be used when mmuEnable() is called. This will be after the MMU has + * been initialised by sysInit()/romInit() and after cacheLib has set whatever + * cache enable settings have been chosen. + * + * M 1 Enable MMU + * A 0 Disable address alignment fault + * C X ((D-)Cache Enable) Controlled by cacheLib + * W X (Write Buffer) Controlled by cacheLib + * P 1 (PROG32) should be set before this + * D 1 (DATA32) should be set before this + * L 1 (Late abort on earlier CPUs) ignore + * B X (Big/Little-endian) should be set before this + * S 1 (System) + * R 0 (ROM) + * F 0 Should be Zero + * Z X (Branch prediction enable on 810) Controlled by cacheLib + * I X (I-cache enable) Controlled by cacheLib + * + * For time being, do not enable the address alignment fault, as GCC + * currently generates unaligned accesses in its code, and switching this + * on will cause immediate faults. So, do not put it into the enable + * mask. + * + * We used to clear all the Reserved/Should Be Zero bits when the + * MMU/MPU was enabled, by including one bits for them in the definition + * of MMU_ENABLE_MASK. We no longer do this, as CPU designers may extend + * the definitions of the bits within the MMU Control Register. The MMU + * Control register is initialised within romInit()/sysInit(), as the BSP + * is the only place where the particular details of the CPU/MMU are + * actually known. In general, it will be appropriate for the BSP to + * initialise the MMUCR Reserved/Should Be Zero bits to zero. When the + * MMU is enabled, we will only change the bits we are particularly + * concerned about, by using a Read-Modify-Write strategy. + */ + + /* This defines the operating mode MMUCR_ROM, MMUCR_SYSTEM, or neither */ + +#define MMUCR_MODE MMUCR_ROM /* This MUST remain as ROM for shared libraries */ + +#define MMU_ENABLE_MASK (MMUCR_M_ENABLE | MMUCR_SYSTEM | MMUCR_ROM) + +#define MMU_ENABLE_VALUE (MMUCR_M_ENABLE | MMUCR_MODE) + +#if (_BYTE_ORDER == _LITTLE_ENDIAN) +#define MMU_INIT_VALUE (MMUCR_PROG32 | MMUCR_DATA32 | MMUCR_L_ENABLE | \ + MMUCR_MODE) +#else +#define MMU_INIT_VALUE (MMUCR_PROG32 | MMUCR_DATA32 | MMUCR_L_ENABLE | \ + MMUCR_BIGEND | MMUCR_MODE) +#endif + +#ifndef _ASMLANGUAGE + +#if (_BYTE_ORDER == _LITTLE_ENDIAN) + +/* little-endian */ + +/* First level page descriptors */ + +typedef struct + { + UINT type : 2; /* descriptor type, 1 => page */ + UINT pad1 : 2; /* SBZ */ + UINT pad2 : 1; /* SBO */ + UINT domain : 4; /* domain number */ + UINT pbit : 1; /* XSCALE 'P' bit */ + UINT addr : 22; /* base address of page table */ + } PAGE_DESC_FIELD; + + +/* Layout of Page Table Entries (PTEs), actually small page descriptors */ + +typedef struct + { + UINT type : 2; /* page type, 3 => extended small page */ + UINT cb : 2; /* cacheable/bufferable bits */ + UINT ap : 2; /* access permission */ + UINT tex : 4; /* type extension field */ + UINT sbz : 2; /* should be zero */ + UINT addr : 20; /* page base address */ + } PTE_FIELD; + +#else /* (_BYTE_ORDER == _LITTLE_ENDIAN) */ + +/* big-endian */ + +/* First level page descriptors */ + +typedef struct + { + UINT addr : 22; /* descriptor type, 1 => page */ + UINT pbit : 1; /* XSCALE 'P' bit */ + UINT domain : 4; /* domain number */ + UINT pad2 : 1; /* SBO */ + UINT pad1 : 2; /* SBZ */ + UINT type : 2; /* base address of page table */ + } PAGE_DESC_FIELD; + +/* Layout of Page Table Entries (PTEs), actually small page descriptors */ + +typedef struct + { + UINT addr : 20; /* page base address */ + UINT sbz : 2; /* should be zero */ + UINT tex : 4; /* type extension field */ + UINT ap : 2; /* access permission */ + UINT cb : 2; /* cacheable/bufferable bits */ + UINT type : 2; /* page type, 3 => extended small page */ + } PTE_FIELD; + +#endif /* (_BYTE_ORDER == _LITTLE_ENDIAN) */ + +/* First level descriptor access */ + +typedef union + { + PAGE_DESC_FIELD fields; + UINT32 bits; + } MMU_LEVEL_1_DESC; + +/* Second level descriptor access */ + +typedef union + { + PTE_FIELD fields; + UINT32 bits; + } PTE; + +/* Pointer to a First level table */ + +typedef struct mmuTransTblStruct + { + MMU_LEVEL_1_DESC *pLevel1Table; + } MMU_TRANS_TBL; + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT void mmuArmXSCALELibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR), + PHYS_ADDR(virtToPhys) (VIRT_ADDR)); +IMPORT void mmuArmXSCALETtbrSet (MMU_LEVEL_1_DESC *); +IMPORT MMU_LEVEL_1_DESC * mmuArmXSCALETtbrGet ( void); +IMPORT void mmuArmXSCALEDacrSet (UINT32 dacrVal); +IMPORT void mmuArmXSCALETLBIDFlushEntry (void *addr); +IMPORT void mmuArmXSCALETLBIDFlushAll (void); +IMPORT void mmuArmXSCALEAEnable (UINT32 cacheState); +IMPORT void mmuArmXSCALEADisable (void); +IMPORT STATUS mmuArmXSCALEPBitSet ( void * virtAddr, UINT32 size); +IMPORT STATUS mmuArmXSCALEPBitClear ( void * virtAddr, UINT32 size); +IMPORT STATUS mmuArmXSCALEPBitGet ( void * virtAddr ); +IMPORT STATUS mmuArmXSCALEAcrGet (void ); +IMPORT void mmuArmXSCALEAcrSet (UINT32 acrVal); + +#else /* __STDC__ */ + +IMPORT void mmuArmXSCALELibInstall (); +IMPORT void mmuArmXSCALETtbrSet (); +IMPORT MMU_LEVEL_1_DESC * mmuArmXSCALETtbrGet (); +IMPORT void mmuArmXSCALEDacrSet (); +IMPORT void mmuArmXSCALETLBIDFlushEntry (); +IMPORT void mmuArmXSCALETLBIDFlushAll (); +IMPORT void mmuArmXSCALEAEnable (); +IMPORT void mmuArmXSCALEADisable (); +IMPORT STATUS mmuArmXSCALEPBitSet (); +IMPORT STATUS mmuArmXSCALEPBitClear (); +IMPORT STATUS mmuArmXSCALEPBitGet (); +IMPORT STATUS mmuArmXSCALEAcrGet (); +IMPORT void mmuArmXSCALEAcrSet (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmmuArmXSCALELibh */ diff --git a/h/arch/arm/regsArm.h b/h/arch/arm/regsArm.h new file mode 100644 index 0000000..3ada8c0 --- /dev/null +++ b/h/arch/arm/regsArm.h @@ -0,0 +1,82 @@ +/* regsArm.h - ARM registers */ + +/* Copyright 1996-1997 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,25aug04,scm add lrReg alternative name +01d,18mar04,scm add usr mode rtp support... +01c,07may03,pes PAL conditional compilation cleanup. +01b,15apr98,kkk added reg_pc, reg_sp, and reg_fp. +01a,08may96,cdp written, based on I86 version +*/ + +#ifndef __INCregsArmh +#define __INCregsArmh + +#ifdef __cplusplus +extern "C" { +#endif + +#define GREG_NUM 15 /* has 15 32-bit general registers */ + +#ifndef _ASMLANGUAGE + +/* REG_SET - ARM Register set + * Note that the exception stack frame relies on the order of items + * in this so don't change this without changing the ESF and the stub + * in excALib which creates it. + */ + +typedef struct /* REG_SET - ARM register set */ + { + ULONG r[GREG_NUM]; /* general purpose registers 0-14 */ + INSTR *pc; /* program counter */ + ULONG cpsr; /* current PSR */ + ULONG ttbase; /* Trans Table Base */ + } REG_SET; + +#define fpReg r[11] /* frame pointer */ +#define spReg r[13] /* stack pointer */ +#define lrReg r[14] /* link reg pointer */ + +#define reg_pc pc /* program counter */ + +#define reg_lr lrReg /* link reg pointer */ +#define reg_sp spReg /* stack pointer */ +#define reg_fp fpReg /* frame pointer */ + +#endif /* _ASMLANGUAGE */ + +#define ARM_REG_SIZE 4 +#define REG_SET_G_REG_BASE 0x00 /* data reg's base offset to REG_SET */ +#define REG_SET_G_REG_OFFSET(n) (REG_SET_G_REG_BASE + (n)*ARM_REG_SIZE) +#define REG_SET_PC_OFFSET (REG_SET_G_REG_OFFSET(GREG_NUM)) +#define REG_SET_CPSR_OFFSET (REG_SET_PC_OFFSET + ARM_REG_SIZE) + +#define REG_SET_TTBASE_OFFSET (REG_SET_CPSR_OFFSET + ARM_REG_SIZE) + +#define PC_OFFSET REG_SET_PC_OFFSET + +/* PAL additions */ + +/* moved here from h/private/taskLibP.h */ + +#define WIND_TCB_R0 WIND_TCB_REGS +#define WIND_TCB_R1 (WIND_TCB_R0+4*1) +#define WIND_TCB_R4 (WIND_TCB_R0+4*4) +#define WIND_TCB_R5 (WIND_TCB_R0+4*5) +#define WIND_TCB_SP (WIND_TCB_R0+4*13) +#define WIND_TCB_PC (WIND_TCB_R0+4*15) +#define WIND_TCB_CPSR (WIND_TCB_PC+4) + +#define WIND_TCB_TTBASE (WIND_TCB_CPSR+4) + +/* End PAL */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCregsArmh */ diff --git a/h/arch/arm/sigArmCodes.h b/h/arch/arm/sigArmCodes.h new file mode 100644 index 0000000..db32f6e --- /dev/null +++ b/h/arch/arm/sigArmCodes.h @@ -0,0 +1,26 @@ +/* sigArmCodes.h - ARM signal facility library header file */ + +/* Copyright 1996-1997 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,09may96,cdp created +*/ + +#ifndef __INCsigArmCodesh +#define __INCsigArmCodesh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE +#endif /* _ASMLANGUAGE */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsigArmCodesh */ diff --git a/h/arch/arm/syscallArgsarm.h b/h/arch/arm/syscallArgsarm.h new file mode 100644 index 0000000..8eac580 --- /dev/null +++ b/h/arch/arm/syscallArgsarm.h @@ -0,0 +1,755 @@ +/* Aligned for arm - no alignment needed */ + + +/* THIS FILE IS AUTO_GENERATED. PLEASE DO NOT EDIT. */ + +#ifndef _ASMLANGUAGE + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct _exitScArgs + { + int status; + }; + +struct creatScArgs + { + const char * name; + mode_t flag; + }; + +struct _openScArgs + { + const char * name; + int flags; + int mode; + }; + +struct closeScArgs + { + int fd; + }; + +struct readScArgs + { + int fd; + void * buffer; + size_t maxbytes; + }; + +struct writeScArgs + { + int fd; + const void * buffer; + size_t nbytes; + }; + +struct _ioctlScArgs + { + int fd; + int function; + int arg; + }; + +struct dupScArgs + { + int fd; + }; + +struct dup2ScArgs + { + int fd; + int fd2; + }; + +struct pipeScArgs + { + int filedes[2]; + }; + +struct removeScArgs + { + const char * name; + }; + +struct selectScArgs + { + int width; + fd_set * readFds; + fd_set * writeFds; + fd_set * excFds; + struct timeval * timeout; + }; + +struct socketScArgs + { + int domain; + int type; + int protocol; + }; + +struct bindScArgs + { + int s; + struct sockaddr * name; + int namelen; + }; + +struct listenScArgs + { + int s; + int backlog; + }; + +struct acceptScArgs + { + int s; + struct sockaddr * addr; + int *addrlen; + }; + +struct connectScArgs + { + int s; + struct sockaddr * name; + int namelen; + }; + +struct sendtoScArgs + { + int s; + caddr_t buf; + int bufLen; + int flags; + struct sockaddr * to; + int tolen; + }; + +struct sendScArgs + { + int s; + const char * buf; + int bufLen; + int flags; + }; + +struct sendmsgScArgs + { + int s; + struct msghdr * mp; + int flags; + }; + +struct recvfromScArgs + { + int s; + char * buf; + int bufLen; + int flags; + struct sockaddr *from; + int * pFromLen; + }; + +struct recvScArgs + { + int s; + char * buf; + int bufLen; + int flags; + }; + +struct recvmsgScArgs + { + int s; + struct msghdr * mp; + int flags; + }; + +struct setsockoptScArgs + { + int s; + int level; + int optname; + char * optval; + int optlen; + }; + +struct getsockoptScArgs + { + int s; + int level; + int optname; + char * optval; + int * optlen; + }; + +struct getsocknameScArgs + { + int s; + struct sockaddr *name; + int * namelen; + }; + +struct getpeernameScArgs + { + int s; + struct sockaddr *name; + int *namelen; + }; + +struct shutdownScArgs + { + int s; + int how; + }; + +struct mmapScArgs + { + void * addr; + size_t len; + int prot; + int flags; + int fildes; + off_t64 off; + }; + +struct munmapScArgs + { + void * addr; + size_t len; + }; + +struct mprotectScArgs + { + void * addr; + size_t len; + int prot; + }; + +struct killScArgs + { + OBJ_HANDLE rtpId; + int signo; + }; + +struct sigpendingScArgs + { + sigset_t * pSet; + }; + +struct sigprocmaskScArgs + { + int how; + const sigset_t * pSet; + sigset_t * pOset; + }; + +struct _sigqueueScArgs + { + OBJ_HANDLE rtpId; + int signo; + const union sigval * pValue; + int sigCode; + }; + +struct sigsuspendScArgs + { + const sigset_t * pSet; + }; + +struct sigtimedwaitScArgs + { + const sigset_t * pSet; + struct siginfo * pInfo; + const struct timespec * pTime; + }; + +struct _sigactionScArgs + { + int signo; + const struct sigaction * pAct; + struct sigaction * pOact; + void * retAddr; + }; + +struct chdirScArgs + { + const char * name; + }; + +struct _getcwdScArgs + { + char * buffer; + int length; + }; + +struct waitpidScArgs + { + OBJ_HANDLE childRtpId; + int * pStatus; + int options; + }; + +struct sysctlScArgs + { + int *pName; + u_int nameLen; + void * pOld; + size_t * pOldLen; + void * pNew; + size_t newLen; + }; + +struct _schedPxInfoGetScArgs + { + BOOL * pTimeSlicingOn; + ULONG * pTimeSlicePeriod; + }; + +struct sigaltstackScArgs + { + stack_t * ss; + stack_t * oss; + }; + +struct unlinkScArgs + { + const char * name; + }; + +struct linkScArgs + { + const char * name; + const char * newname; + }; + +struct fsyncScArgs + { + int fd; + }; + +struct fdatasyncScArgs + { + int fd; + }; + +struct renameScArgs + { + const char * oldname; + const char * newname; + }; + +struct fpathconfScArgs + { + int fd; + int name; + }; + +struct pathconfScArgs + { + const char * path; + int name; + }; + +struct accessScArgs + { + const char * path; + int amode; + }; + +struct chmodScArgs + { + const char * path; + mode_t mode; + }; + +struct eventReceiveScArgs + { + UINT32 events; + UINT32 options; + int timeout; + UINT32 * pEvtsReceived; + }; + +struct eventSendScArgs + { + int taskId; + UINT32 events; + }; + +struct eventCtlScArgs + { + OBJ_HANDLE handle; + VX_EVT_CTL_CMD command; + void * pArg; + UINT * pArgSize; + }; + +struct msgQSendScArgs + { + OBJ_HANDLE handle; + char * buffer; + UINT nBytes; + int timeout; + int priority; + }; + +struct msgQReceiveScArgs + { + OBJ_HANDLE handle; + char * buffer; + UINT maxNBytes; + int timeout; + }; + +struct _msgQOpenScArgs + { + const char * name; + UINT maxMsgs; + UINT maxMsgLength; + int options; + int mode; + void * context; + }; + +struct objDeleteScArgs + { + OBJ_HANDLE handle; + int options; + }; + +struct objInfoGetScArgs + { + OBJ_HANDLE handle; + void * pInfo; + UINT * pInfoSize; + int level; + }; + +struct _semTakeScArgs + { + OBJ_HANDLE handle; + int timeout; + }; + +struct _semGiveScArgs + { + OBJ_HANDLE handle; + }; + +struct _semOpenScArgs + { + const char * name; + SEM_TYPE type; + int initState; + int options; + int mode; + void * context; + }; + +struct semCtlScArgs + { + OBJ_HANDLE handle; + VX_SEM_CTL_CMD command; + void * pArg; + UINT * pArgSize; + }; + +struct _taskOpenScArgs + { + struct vx_task_open_sc_args * pArgs; + }; + +struct taskCtlScArgs + { + int tid; + VX_TASK_CTL_CMD command; + void * pArg; + UINT * pArgSize; + }; + +struct taskDelayScArgs + { + int ticks; + }; + +struct rtpSpawnScArgs + { + const char * rtpFileName; + const char ** argv; + const char ** envp; + int priority; + int uStackSize; + int options; + int taskOptions; + }; + +struct rtpInfoGetScArgs + { + OBJ_HANDLE rtpId; + RTP_DESC * rtpStruct; + }; + +struct taskKillScArgs + { + OBJ_HANDLE taskHandle; + int signo; + }; + +struct _taskSigqueueScArgs + { + OBJ_HANDLE taskHandle; + int signo; + const union sigval * pValue; + int sigCode; + }; + +struct _timer_openScArgs + { + const char * name; + int mode; + clockid_t clockId; + struct sigevent * evp; + void * context; + }; + +struct timerCtlScArgs + { + TIMER_CTL_CMD cmdCode; + int handle; + void * pArgs; + UINT * pArgSize; + }; + +struct pxOpenScArgs + { + PX_OBJ_TYPE type; + const char * name; + int objOpenMode; + void * attr; + }; + +struct pxCloseScArgs + { + OBJ_HANDLE handle; + }; + +struct pxUnlinkScArgs + { + PX_OBJ_TYPE type; + const char * name; + }; + +struct pxCtlScArgs + { + OBJ_HANDLE handle; + PX_CTL_CMD_CODE cmdCode; + void * pArgs; + UINT * pArgSize; + }; + +struct pxMqReceiveScArgs + { + OBJ_HANDLE handle; + char * pMsg; + size_t msgLen; + unsigned int * pMsgPrio; + PX_WAIT_OPTION waitOption; + struct timespec * time_out; + }; + +struct pxMqSendScArgs + { + OBJ_HANDLE handle; + const char * pMsg; + size_t msgLen; + unsigned int msgPrio; + PX_WAIT_OPTION waitOption; + struct timespec * time_out; + }; + +struct pxSemWaitScArgs + { + OBJ_HANDLE handle; + PX_WAIT_OPTION waitOption; + struct timespec * time_out; + }; + +struct pxSemPostScArgs + { + OBJ_HANDLE handle; + }; + +struct pipeDevCreateScArgs + { + const char * name; + int nMessages; + int nBytes; + }; + +struct pipeDevDeleteScArgs + { + const char * name; + BOOL force; + }; + +struct _sdCreateScArgs + { + char * name; + int options; + UINT32 size; + off_t64 physAddress; + MMU_ATTR attr; + void ** pVirtAddress; + }; + +struct _sdOpenScArgs + { + char * name; + int options; + int mode; + UINT32 size; + off_t64 physAddress; + MMU_ATTR attr; + void ** pVirtAddress; + }; + +struct sdDeleteScArgs + { + OBJ_HANDLE handle; + int options; + }; + +struct sdMapScArgs + { + OBJ_HANDLE handle; + MMU_ATTR attr; + int options; + }; + +struct sdUnmapScArgs + { + OBJ_HANDLE handle; + int options; + }; + +struct sdProtectScArgs + { + OBJ_HANDLE handle; + MMU_ATTR attr; + }; + +struct _edrErrorInjectScArgs + { + int kind; + const char *fileName; + int lineNumber; + REG_SET *regset; + void *addr; + const char *msg; + }; + +struct resSearchNScArgs + { + const char * name; + struct res_target * target; + }; + +struct wvEventScArgs + { + int eventId; + const char * pData; + unsigned int dataSize; + }; + +struct rtpVarAddScArgs + { + void ** pVar; + void * value; + }; + +struct sdInfoGetScArgs + { + OBJ_HANDLE handle; + SD_DESC * pSdStruct; + }; + +struct _shlOpenScArgs + { + const char * name; + int options; + }; + +struct _shlUnlockScArgs + { + SHL_ID shlId; + }; + +struct _shlCloseScArgs + { + SHL_ID shlId; + }; + +struct _shlGetScArgs + { + SHL_ID shlId; + SHLINFO *pInfo; + }; + +struct _shlPutScArgs + { + SHL_ID shlId; + const SHLINFO *pInfo; + }; + +struct objUnlinkScArgs + { + const char * name; + enum windObjClassType classType; + }; + +struct getprlimitScArgs + { + int idtype; + OBJ_HANDLE handle; + int resource; + struct rlimit *rlp; + }; + +struct setprlimitScArgs + { + int idtype; + OBJ_HANDLE handle; + int resource; + struct rlimit *rlp; + }; + +struct _mctlScArgs + { + void * addr; + size_t len; + int function; + int arg; + }; + +#endif /* _ASMLANGUAGE */ diff --git a/h/arch/arm/syscallArm.h b/h/arch/arm/syscallArm.h new file mode 100644 index 0000000..568d0ca --- /dev/null +++ b/h/arch/arm/syscallArm.h @@ -0,0 +1,72 @@ +/* syscallArm.h - ARM specific System Call Infrastructure header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,04mar05,scm _SYSCALL_USER_SP_CHECK break signals alt stack option... +01d,23feb05,scm re-assign "spare" to user link reg... +01c,19nov03,cjj replaced pStackLimit by pStackEnd in _SYSCALL_USER_SP_CHECK +01b,14oct03,scm enhanced, flushed out, and debugging. +01a,03oct03,jb written. +*/ + +/* +DESCRIPTION +This header contains ARM specific definitions and constants used by +the System Call Infrastructure library. + +*/ + +#ifndef __INCsyscallArmh +#define __INCsyscallArmh + +#ifndef _ASMLANGUAGE +#include "taskLib.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define syscallDispatch_PORTABLE /* Use the portable dispatcher */ + + /* defines */ + +#define SYSCALL_ENTRY_FRAME_SIZE 52 + +#define _SYSCALL_USER_SP_CHECK(sp) + + /* typedefs */ + +#ifndef _ASMLANGUAGE + /* + * The SYSCALL_ENTRY_STATE structure defines the saved machine state + * when the system call trap is taken. This information is architecture + * specific, and is used by the system call dispatcher to restart system + * calls that have been interrupted by the occurance of signals. + * System call restart is achieved by restoring the saved state at the + * time of the system call trap, and re-issuing the system call. + * Arguments to the system call are saved on the kernel stack, and + * the address of that array is passed as an argument to the dispatcher. + * The layout of this structure must exactly match the ordering of members + * of the system call entry frame in src/arch/arm/syscallALib.s. + */ + +typedef struct syscall_entry_state + { + ULONG args[8]; /* argument list (r0-r3 and sp[0]-sp[3]) */ + ULONG scn; /* System Call Number (SCN) in r12 */ + ULONG statusReg; /* saved Status Register (spsr) */ + INSTR *pc; /* Trap return address (lr) */ + ULONG *pUStack; /* user-mode stack pointer */ + ULONG usrLnk; /* user-mode link register */ + } SYSCALL_ENTRY_STATE; +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsyscallArmh */ diff --git a/h/arch/i86/archI86.h b/h/arch/i86/archI86.h new file mode 100644 index 0000000..968c4eb --- /dev/null +++ b/h/arch/i86/archI86.h @@ -0,0 +1,232 @@ +/* archI86.h - Intel 80X86 specific header */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. +*/ + +/* +modification history +-------------------- +01x,28apr05,scm scm add _ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK +01w,12apr05,kk remove _WRS_OBJLIB_SUPPORT_VERIFY_TRAP macro (SPR# 106486) +01v,04nov04,scm add _WRS_OSM_INIT for new OSM API... +01u,01sep04,jb Adding _WRS_OBJLIB_SUPPORT_VERIFY_TRAP for objVerify support +01t,14jul04,jb Enable Portable for all functions +01s,17may04,jb Switch to PORTABLE scheduler. + Fix debug register clear on load and go problem +01r,05may04,zmm Fix diab compiler warnings. +01s,13may04,zl fixed _WRS_FRAMEP_FROM_JMP_BUF(). +01r,27apr04,cjj Defined workQLib_PORTABLE +01q,27apr04,jmp moved INSTR definition to archI86Common.h. added macros for + getting frame and return PC from a jmp_buf. +01p,03dec03,md changed to use portable scheduler +01o,25nov03,pes Move setting of _BYTE_ORDER macro into archI86Common.h. +01n,14nov03,job Moved some blib stuff to archI86Common.h +01m,13nov03,pes Add include of archI86Common.h +01l,27aug03,to added defines for semLib. +01k,07may03,pes PAL conditional compilation cleanup. Phase 2. +01j,28apr03,pes PAL conditional compilation cleanup. +01i,12nov02,hdn made CR4 initialization only for P5 or later (spr 83992) +01h,29oct02,hdn assigned reserved1 to (FP_CONTEXT *) (spr 70252) +01g,07oct02,hdn added the architecture extension of the TCB +01f,13mar01,sn SPR 73723 - define supported toolchains +01e,04oct01,hdn enclosed ARCH_REGS_INIT macro with _ASMLANGUAGE +01d,21aug01,hdn added PENTIUM4's _CACHE_ALIGN_SIZE, ARCH_REGS_INIT +01c,10aug01,hdn added PENTIUM2/3/4 support +01b,25feb99,hdn added _CACHE_ALIGN_SIZE for Pentium and PentiumPro +01a,07jun93,hdn written based on arch68k.h +*/ + +#ifndef __INCarchI86h +#define __INCarchI86h + +#ifdef __cplusplus +extern "C" { +#endif + +#define _ARCH_SUPPORTS_GCC + +#define _DYNAMIC_BUS_SIZING FALSE /* require alignment for swap */ + +#if (CPU==PENTIUM4) +#define _CACHE_ALIGN_SIZE 64 +#elif (CPU==PENTIUM || CPU==PENTIUM2 || CPU==PENTIUM3) +#define _CACHE_ALIGN_SIZE 32 +#else +#define _CACHE_ALIGN_SIZE 16 +#endif /* (CPU==PENTIUM || CPU==PENTIUM[234]) */ + + +#ifdef _ASMLANGUAGE + +/* + * system startup macros used by sysInit(sysALib.s) and romInit(romInnit.s). + * - no function calls to outside of BSP is allowed. + * - no references to the data segment is allowed. + * the CR4 is introduced in the Pentium processor. + */ + +#define ARCH_REGS_INIT \ + xorl %eax, %eax; /* zero EAX */ \ + movl %cr0, %edx; /* get CR0 */ \ + andl $0x7ffafff1, %edx; /* clear PG, AM, WP, TS, EM, MP */ \ + movl %edx, %cr0; /* set CR0 */ \ + \ + pushl %eax; /* initialize EFLAGS */ \ + popfl; + +#define ARCH_CR4_INIT \ + xorl %eax, %eax; /* zero EAX */ \ + movl %eax, %cr4; /* initialize CR4 */ + + +#else + +/* architecture extension of the TCB (pTcb->reserved2) */ + +typedef struct x86Ext /* architecture specific TCB extension */ + { + unsigned int reserved0; /* (DS_CONFIG *) */ + unsigned int reserved1; /* (FP_CONTEXT *) for FPU exception */ + unsigned int reserved2; + unsigned int reserved3; + unsigned int reserved4; + unsigned int reserved5; + unsigned int reserved6; + unsigned int reserved7; + } X86_EXT; + +/* no function declarations for makeSymTlb/symTbl.c */ + +/* macros for getting frame and return PC from a jmp_buf */ + +#define _WRS_FRAMEP_FROM_JMP_BUF(env) ((char *) (env)[0].reg.reg_fp) +#define _WRS_RET_PC_FROM_JMP_BUF(env) ((INSTR *) (env)[0].reg.reg_pc) + +#endif /* _ASMLANGUAGE */ + +/* PAL additions */ + +/* architecture-specific overrides for fppSave and fppRestore in fppLib.c */ +#if ((CPU == PENTIUM) || (CPU == PENTIUM2) || (CPU == PENTIUM3) || (CPU == PENTIUM4)) +#define FPP_SAVE(p) (*_func_fppSaveRtn)(p) +#define FPP_RESTORE(p) (*_func_fppRestoreRtn)(p) +#endif /* CPU ... */ + +/* from h/usb/target/usbIsaLib.h */ + +/* DMA controller selection */ + +#define _WRS_DMA_I8237 + +/* trigger signed IO arguments in sysLib.h */ + +#define _WRS_SIGNED_IO_ARGS +#define _WRS_SYS_IO + +/* override _WRS_SR_SIZE in taskArchLib.h */ + +#define _WRS_SR_SIZE UINT + +/* + * trigger definition of portWorkQAdd1 in trgLib.c and + * rBuffLib.c + */ + +#define _WRS_PORT_WORK_Q_ADD1 + +/* used in cacheLib.c:cacheFuncsSet() */ + +#define _WRS_EXTERN_WRITEBACK + +/* used in fppLib.c to align FP_CONTEXT */ + +/* dummy context must be in data section for now */ +#define _WRS_ALIGN_FP_CONTEXT +#define _WRS_FPP_DUMMY_CONTEXT \ +_WRS_DATA_ALIGN_BYTES(_CACHE_ALIGN_SIZE) fppDummyContext = {{{0}}} + + +/* architecture-specific overrides for fppSave and fppRestore in dbgLib.c */ +#define _WRS_SHOW_SSE_REGS +#define FPP_DBG_SAVE(p) (*_func_fppSaveRtn)(p) +#define FPP_DBG_RESTORE(p) (*_func_fppRestoreRtn)(p) + +/* from loadElfLib.c */ + +#define _WRS_USE_ELF_LOAD_FORMAT + +/* from xdr_float.c */ + +#define FLOAT_NORM + +/* from vmShow.c */ + +#define _WRS_SHOW_WBACK_STATE +#define _WRS_SHOW_GLOBAL_STATE + +/* from taskShow.c */ + +#define _WRS_SHOW_SSE_REGS + +/* Make this architecture use the PORTABLE code set */ +#define PORTABLE + +/* from rBuffLib.c */ + +#define _WRS_PORT_WORK_Q_ADD1 + +/* from bLib.c */ + +#undef _WRS_BLIB_OPTIMIZED + +/* from wdbFpLib.c */ + +#define _WRS_ALIGN_REG_SET + +/* from schedLib.c */ + +#undef _WRS_SCHEDLIB_OPTIMIZED + +#define _WRS_BASE6_SCHEDULER +#define _WRS_ENABLE_IDLE_INTS {intUnlock (-1);} + +/* from sem*Lib.c, semA*Lib.s */ + +#undef _WRS_HAS_OPTIMIZED_SEM +#undef _WRS_USE_OPTIMIZED_SEM /* XXX use optimized sem, for now */ + +/* from workQLib.c */ + +#define workQLib_PORTABLE + +/* from windALib.s */ +#define schedLib_PORTABLE + +/* from sysOsmLib.c */ + +#define _WRS_OSM_INIT + +/* Interrupt stack protection, used in usrDepend.c and usrKernelStack.c */ +#define _ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK + +/* if OSM support not available for stack protection, + * * then support can not be available for interrupt + * * stack protection. + * */ +#if !defined(_WRS_OSM_INIT) +#undef _ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK +#endif + +#include "arch/i86/archI86Common.h" + +/* end of PAL additions */ +#ifdef __cplusplus +} +#endif + +#endif /* __INCarchI86h */ diff --git a/h/arch/i86/archI86Common.h b/h/arch/i86/archI86Common.h new file mode 100644 index 0000000..89ef240 --- /dev/null +++ b/h/arch/i86/archI86Common.h @@ -0,0 +1,58 @@ +/* archI86Common.h - common I86 architecture specific header */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,13may04,zl enabled user trcLib support. +01f,27apr04,jmp added support for portable trcLib. moved INSTR definition + form archI86.h. +01e,13apr04,zmm Add coprocessor support for Pentium. +01d,25nov03,pes Move setting of _BYTE_ORDER macro into archI86Common.h +01c,17nov03,jb Adding defines for syscalls +01b,12nov03,job Moved some blib stuff from archI86.h +01a,11nov03,pes written. +*/ + +#ifndef __INCarchI86Commonh +#define __INCarchI86Commonh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Common syscall defines */ + +#define SYSCALL_SEGMENT 8 +#define SYSCALL_GATE_OFFSET 67 /* (SYSCALL_SEGMENT * sizeof(GDT) | (DPL3 > 13) ) */ + +/* from bLib.c */ + +#define _WRS_BLIB_ALIGNMENT 1 /* 2 byte alignment mask */ +#define swab_PORTABLE + +#define _BYTE_ORDER _LITTLE_ENDIAN + +#define _WRS_PAL_COPROC_LIB /* enable coprocessor abstraction */ + +/* Enable Portable trcLib */ + +#define trcLib_PORTABLE +#define _WRS_TRC_ARGS_COUNT 5 /* number of arguments to print in */ + /* stack trace */ + +#ifndef _ASMLANGUAGE +typedef unsigned char INSTR; /* char instructions */ +#endif /* _ASMLANGUAGE */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCarchI86Commonh */ + + + + diff --git a/h/arch/i86/asmI86.h b/h/arch/i86/asmI86.h new file mode 100644 index 0000000..a3be0ee --- /dev/null +++ b/h/arch/i86/asmI86.h @@ -0,0 +1,120 @@ +/* asmI86.h - i80x86 assembler definitions header file */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,04may04,dbt Added ARG8-12 and SP_ARG8-12. +01g,17nov03,jb Adding additional ARG defines +01f,01nov01,hdn added ARG8 and SP_ARG8 +01e,01oct01,pad Turn off the underscore prepending to assembly routines. +01d,14aug01,hdn imported FUNC/FUNC_LABEL GTEXT/GDATA macros from T31 ver 01i +01c,28aug98,hdn added INT_CONNECT_CODE29 for intEnt(). +01b,07jun93,hdn added support for c++ +01a,28feb92,hdn written based on TRON, 68k version. +*/ + +#ifndef __INCasmI86h +#define __INCasmI86h + +/************************************************************/ + +/* + * The following definitions are used for symbol name compatibility. + * + * When #if 1, sources are assembled assuming the compiler + * you are using does not generate global symbols prefixed by "_". + * (e.g. elf/dwarf) + * + * When #if 0, sources are assembled assuming the compiler + * you are using generates global symbols prefixed by "_". + * (e.g. coff/stabs) + */ + +#if TRUE +#define FUNC(sym) sym +#define FUNC_LABEL(sym) sym: +#else +#define FUNC(sym) _##sym +#define FUNC_LABEL(sym) _##sym: +#endif + +#define VAR(sym) FUNC(sym) + +/* + * These macros are used to declare assembly language symbols that need + * to be typed properly(func or data) to be visible to the OMF tool. + * So that the build tool could mark them as an entry point to be linked + * by another PD. This is an elfism. Use #if 0 for a.out. + */ + +#if FALSE +#define GTEXT(sym) FUNC(sym) ; .type FUNC(sym),@function +#define GDATA(sym) FUNC(sym) ; .type FUNC(sym),@object +#else +#define GTEXT(sym) FUNC(sym) +#define GDATA(sym) FUNC(sym) +#endif + +/************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/* fp offsets to arguments */ + +#define ARG1 8 +#define ARG1W 10 +#define ARG2 12 +#define ARG2W 14 +#define ARG3 16 +#define ARG3W 18 +#define ARG4 20 +#define ARG5 24 +#define ARG6 28 +#define ARG7 32 +#define ARG8 36 +#define ARG9 40 +#define ARG10 44 +#define ARG11 48 +#define ARG12 52 + +#define DARG1 8 /* double arguments */ +#define DARG1L 12 +#define DARG2 16 +#define DARG2L 20 +#define DARG3 24 +#define DARG3L 28 +#define DARG4 32 +#define DARG4L 36 + +/* sp offsets to arguments */ + +#define SP_ARG0 0 +#define SP_ARG1 4 +#define SP_ARG1W 6 +#define SP_ARG2 8 +#define SP_ARG2W 10 +#define SP_ARG3 12 +#define SP_ARG3W 14 +#define SP_ARG4 16 +#define SP_ARG5 20 +#define SP_ARG6 24 +#define SP_ARG7 28 +#define SP_ARG8 32 +#define SP_ARG9 36 +#define SP_ARG10 40 +#define SP_ARG11 44 +#define SP_ARG12 48 + +/* offset to the IRQ number in the intConnectCode[] */ + +#define INT_CONNECT_CODE29 24 /* from the return address of intEnt() */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCasmI86h */ diff --git a/h/arch/i86/cacheI86Lib.h b/h/arch/i86/cacheI86Lib.h new file mode 100644 index 0000000..196afb1 --- /dev/null +++ b/h/arch/i86/cacheI86Lib.h @@ -0,0 +1,64 @@ +/* cacheI86Lib.h - I80486 cache library header file */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01f,04jun04,mil Removed cacheArchXXX routines. +01e,07mar02,hdn added CLFLUSH related macros (spr 73360) +01d,04dec01,hdn added CACHE_TYPE parameter to cachePen4Flush/Clear +01c,23aug01,hdn renamed cache486XXX to cacheI86XXX + added PENTIUM4 support +01b,29may94,hdn deleted I80486 macro. +01a,15jun93,hdn created. +*/ + +#ifndef __INCcacheI86Libh +#define __INCcacheI86Libh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + + +#define CLFLUSH_DEF_BYTES 64 /* def bytes flushed by CLFLUSH */ +#define CLFLUSH_MAX_BYTES 255 /* max bytes flushed with CLFLUSH */ + + +#ifndef _ASMLANGUAGE + +#if defined(__STDC__) || defined(__cplusplus) + +extern void cacheI86Reset (void); +extern void cacheI86Enable (void); +extern void cacheI86Disable (void); +extern void cacheI86Lock (void); +extern void cacheI86Unlock (void); +extern void cacheI86Clear (void); +extern void cacheI86Flush (void); +extern void cachePen4Clear (CACHE_TYPE cache, void * address, size_t bytes); +extern void cachePen4Flush (CACHE_TYPE cache, void * address, size_t bytes); + +#else + +extern void cacheI86Reset (); +extern void cacheI86Enable (); +extern void cacheI86Disable (); +extern void cacheI86Lock (); +extern void cacheI86Unlock (); +extern void cacheI86Clear (); +extern void cacheI86Flush (); +extern void cachePen4Clear (); +extern void cachePen4Flush (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcacheI86Libh */ diff --git a/h/arch/i86/coprocI86.h b/h/arch/i86/coprocI86.h new file mode 100644 index 0000000..553b2b4 --- /dev/null +++ b/h/arch/i86/coprocI86.h @@ -0,0 +1,31 @@ +/* coprocI86.h - coprocessor management library header */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,13apr04,zmm written based on coprocPpc.h 01c. +*/ + +#ifndef __INCcoprocI86h +#define __INCcoprocI86h + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "taskLib.h" + +/* defines */ + +#define VX_FP_TASK VX_COPROC1_TASK + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcoprocI86h */ diff --git a/h/arch/i86/dbgI86Lib.h b/h/arch/i86/dbgI86Lib.h new file mode 100644 index 0000000..d3bdc34 --- /dev/null +++ b/h/arch/i86/dbgI86Lib.h @@ -0,0 +1,132 @@ +/* dbgI86Lib.h - header file for arch dependent portion of debugger */ + +/* + * Copyright (c) 1991-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01o,16feb05,aeg changed wdbDbgCtxXXX() prototypes (SPR #106381). +01n,14oct04,elg Rename wdbDbgCtxXXX() in wdbCtxXXX(). +01m,01sep04,elg Define context load/save for WDB. +01l,19aug04,jb Fix for SPRs 100660, 100729, and 100748 +01k,25jun04,elg Undefine WDB_CTX_LOAD() to use standard definition + (SPR #98730). +01j,27apr04,jmp adapted to share trcArchLib between VxSim/i86 and i86 arches. +01i,02mar04,jb Adding StepOverSyscall support +01h,17jul03,c_c Fixed build. +01g,16sep02,pai Updated with commonly used manifest constants. +01f,30may02,hdn added WDB_CTX_LOAD() define (spr 75694) +01e,11mar98,dbt corrected problems introduced by the SENS merge + added Copyright. +01d,13feb98,hdn fixed BRK_DATAxx macros. +01d,30dec97,dbt modified and added some defines for new breakpoint scheme. +01c,29nov93,hdn added a definition EDI - EFLAGS. +01b,27aug93,hdn added support for c++ +01a,11sep91,hdn written based on TRON version. +*/ + +#ifndef __INCI86dbgh +#define __INCI86dbgh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include "arch/i86/esfI86.h" +#include "arch/i86/regsI86.h" +#include "arch/i86/instrI86.h" + +/* defines */ + +#define BRK_INST (0x00) /* instruction hardware breakpoint */ +#define BRK_DATAW1 (0x01) /* data write 1 byte breakpoint */ +#define BRK_DATAW2 (0x05) /* data write 2 byte breakpoint */ +#define BRK_DATAW4 (0x0d) /* data write 4 byte breakpoint */ +#define BRK_DATARW1 (0x03) /* data read-write 1 byte breakpoint */ +#define BRK_DATARW2 (0x07) /* data read-write 2 byte breakpoint */ +#define BRK_DATARW4 (0x0f) /* data read-write 4 byte breakpoint */ + +#define DEFAULT_HW_BP (BRK_DATARW1) /* default hardware breakpoint */ + +#define BRK_HARDWARE (0x10) /* hardware breakpoint bit */ +#define BRK_HARDMASK (0x0f) /* hardware breakpoint mask */ + +#define SAVED_DBGREGS (0x18) /* 6 debug registers */ +#define SAVED_REGS (0x38) /* 8 + 6 registers */ + +#define TRACE_FLAG (0x0100) /* TF in EFLAGS */ +#define INT_FLAG (0x0200) /* IF in EFLAGS */ + +#define DBG_INST_ALIGN (1) +#define DBG_HARDWARE_BP 1 /* hardware breakpoint support */ + +#ifndef _ASMLANGUAGE + +#define DBG_BREAK_INST (0xcc) /* int 3 */ +#define DBG_SYSCALL_SIZE 7 +#define DBG_SYSCALL_INST 0x0000009A + +/* offsets to register fields in type REG_SET */ + +#define EDI (0) +#define ESI (1) +#define EBP (2) +#define ESP (3) +#define EBX (4) +#define EDX (5) +#define ECX (6) +#define EAX (7) +#define EFLAGS (8) + +/* context save/load for WDB */ + +#define WDB_CTX_SAVE(pRegs) (_wdbCtxSave (pRegs)) +#define WDB_CTX_LOAD(pRegs) (_wdbCtxLoad (pRegs)) + +/* macros */ + +#define DSM(addr,inst,mask) ((*(addr) & (mask)) == (inst)) + + +/* typedefs */ + +/* aliases for type */ + +typedef ESF0 BREAK_ESF; +typedef ESF0 TRACE_ESF; + +/* hardware breakpoint registers */ + +typedef struct /* DBG_REGS */ + { + unsigned int db0; /* debug register 0 */ + unsigned int db1; /* debug register 1 */ + unsigned int db2; /* debug register 2 */ + unsigned int db3; /* debug register 3 */ + unsigned int db6; /* debug register 6 */ + unsigned int db7; /* debug register 7 */ + + } DBG_REGS; + + +/* function declarations */ + +extern void _wdbCtxLoad (const REG_SET *); +extern int _wdbCtxSave (const REG_SET *); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCI86dbgh */ diff --git a/h/arch/i86/dbgStrLib.h b/h/arch/i86/dbgStrLib.h new file mode 100644 index 0000000..53dd7b1 --- /dev/null +++ b/h/arch/i86/dbgStrLib.h @@ -0,0 +1,362 @@ +/* dbgStrLib.h - Debug Store mechanism definitions header file */ + +/* Copyright 2001-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,23jul01,hdn written +*/ + +#ifndef __INCdbgStrLibh +#define __INCdbgStrLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "arch/i86/regsP7.h" + + +/* DS buffer : BTS/PEBS minimum/default/threshold size */ + +#define BTS_NBYTES_MIN 0x1000 /* 4KB minimum BTS buffer */ +#define BTS_NBYTES_DEF 0x4000 /* 16KB default BTS buffer */ +#define BTS_NBYTES_OFF 0x200 /* .5KB (max - threshold) BTS */ +#define PEBS_NBYTES_MIN 0x1000 /* 4KB minimum PEBS buffer */ +#define PEBS_NBYTES_DEF 0x4000 /* 16KB default PEBS buffer */ +#define PEBS_NBYTES_OFF 0x200 /* .5KB (max - threshold) PEBS */ +#define PEBS_DEF_RESET -1LL /* default reset counter value */ + +/* BTS : record bit */ + +#define BTS_PREDICTED 0x00000010 /* bit4: Branch Predicted */ + +/* PEBS : events */ + +#define PEBS_FRONT_END 0x01 +#define PEBS_EXECUTION 0x02 +#define PEBS_REPLAY 0x03 + +/* PEBS : metrics (Front End Event) */ + +#define PEBS_MEMORY_LOADS 0x01 +#define PEBS_MEMORY_STORES 0x02 + +/* PEBS : metrics (Execution Event) */ + +#define PEBS_PACKED_SP 0x03 +#define PEBS_PACKED_DP 0x04 +#define PEBS_SCALAR_SP 0x05 +#define PEBS_SCALAR_DP 0x06 +#define PEBS_128BIT_MMX 0x07 +#define PEBS_64BIT_MMX 0x08 +#define PEBS_X87_FP 0x09 +#define PEBS_X87_SIMD_MOVES 0x0a + +/* PEBS : metrics (Replay Event) */ + +#define PEBS_1STL_CACHE_LOAD_MISS 0x0b +#define PEBS_2NDL_CACHE_LOAD_MISS 0x0c +#define PEBS_DTLB_LOAD_MISS 0x0d +#define PEBS_DTLB_STORE_MISS 0x0e +#define PEBS_DTLB_ALL_MISS 0x0f +#define PEBS_MOB_LOAD_REPLAY 0x10 +#define PEBS_SPLIT_LOAD 0x11 +#define PEBS_SPLIT_STORE 0x12 + +/* PEBS : ESCR, CCCR definitions (Front End Event) */ + +#define ESCR_FRONT_END \ + (((0x08 << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \ + ((DS_BIT_1 << DS_SHIFT_9) & ESCR_EVENT_MASK) | \ + ESCR_TAG_ENABLE) + +#define CCCR_FRONT_END \ + (((0x05 << DS_SHIFT_13) & CCCR_ESCR_SELECT) | \ + CCCR_RSVD) + +#define ESCR_MEMORY_LOADS \ + (((0x02 << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \ + ((DS_BIT_1 << DS_SHIFT_9) & ESCR_EVENT_MASK) | \ + ESCR_TAG_ENABLE) + +#define ESCR_MEMORY_STORES \ + (((0x02 << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \ + ((DS_BIT_2 << DS_SHIFT_9) & ESCR_EVENT_MASK) | \ + ESCR_TAG_ENABLE) + +/* PEBS : ESCR, CCCR definitions (Execution Event) */ + +#define ESCR_EXECUTION \ + (((0x0c << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \ + ((DS_BIT_0 << DS_SHIFT_9) & ESCR_EVENT_MASK) | \ + ((DS_BIT_0 << DS_SHIFT_5) & ESCR_TAG_VALUE) | \ + ESCR_TAG_ENABLE) + +#define CCCR_EXECUTION \ + (((0x05 << DS_SHIFT_13) & CCCR_ESCR_SELECT) | \ + CCCR_RSVD) + +#define ESCR_PACKED_SP \ + (((0x08 << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \ + ((DS_BIT_15 << DS_SHIFT_9) & ESCR_EVENT_MASK) |\ + ((DS_BIT_0 << DS_SHIFT_5) & ESCR_TAG_VALUE) | \ + ESCR_TAG_ENABLE) + +#define ESCR_PACKED_DP \ + (((0x0c << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \ + ((DS_BIT_15 << DS_SHIFT_9) & ESCR_EVENT_MASK) |\ + ((DS_BIT_0 << DS_SHIFT_5) & ESCR_TAG_VALUE) | \ + ESCR_TAG_ENABLE) + +#define ESCR_SCALAR_SP \ + (((0x0a << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \ + ((DS_BIT_15 << DS_SHIFT_9) & ESCR_EVENT_MASK) |\ + ((DS_BIT_0 << DS_SHIFT_5) & ESCR_TAG_VALUE) | \ + ESCR_TAG_ENABLE) + +#define ESCR_SCALAR_DP \ + (((0x0e << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \ + ((DS_BIT_15 << DS_SHIFT_9) & ESCR_EVENT_MASK) |\ + ((DS_BIT_0 << DS_SHIFT_5) & ESCR_TAG_VALUE) | \ + ESCR_TAG_ENABLE) + +#define ESCR_64BIT_MMX \ + (((0x02 << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \ + ((DS_BIT_15 << DS_SHIFT_9) & ESCR_EVENT_MASK) |\ + ((DS_BIT_0 << DS_SHIFT_5) & ESCR_TAG_VALUE) | \ + ESCR_TAG_ENABLE) + +#define ESCR_128BIT_MMX \ + (((0x1a << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \ + ((DS_BIT_15 << DS_SHIFT_9) & ESCR_EVENT_MASK) |\ + ((DS_BIT_0 << DS_SHIFT_5) & ESCR_TAG_VALUE) | \ + ESCR_TAG_ENABLE) + +#define ESCR_X87_FP \ + (((0x04 << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \ + ((DS_BIT_15 << DS_SHIFT_9) & ESCR_EVENT_MASK) |\ + ((DS_BIT_0 << DS_SHIFT_5) & ESCR_TAG_VALUE) | \ + ESCR_TAG_ENABLE) + +#define ESCR_X87_SIMD_MOVES \ + (((0x2e << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \ + (((DS_BIT_3 | DS_BIT_4) << DS_SHIFT_9) & ESCR_EVENT_MASK) | \ + ((DS_BIT_0 << DS_SHIFT_5) & ESCR_TAG_VALUE) | \ + ESCR_TAG_ENABLE) + +/* PEBS : ESCR, CCCR definitions (Replay Event) */ + +#define ESCR_REPLAY \ + (((0x09 << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \ + ((DS_BIT_0 << DS_SHIFT_9) & ESCR_EVENT_MASK) | \ + ((DS_BIT_0 << DS_SHIFT_5) & ESCR_TAG_VALUE) | \ + ESCR_TAG_ENABLE) + +#define CCCR_REPLAY \ + (((0x05 << DS_SHIFT_13) & CCCR_ESCR_SELECT) | \ + CCCR_RSVD) + +#define ESCR_MOB_LOAD_REPLAY \ + (((0x03 << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \ + (((DS_BIT_4 | DS_BIT_5) << DS_SHIFT_9) & ESCR_EVENT_MASK) | \ + ESCR_TAG_ENABLE) + +#define ESCR_SPLIT_LOAD \ + (((0x04 << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \ + ((DS_BIT_1 << DS_SHIFT_9) & ESCR_EVENT_MASK) | \ + ESCR_TAG_ENABLE) + +#define ESCR_SPLIT_STORE \ + (((0x05 << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \ + ((DS_BIT_1 << DS_SHIFT_9) & ESCR_EVENT_MASK) | \ + ESCR_TAG_ENABLE) + + +/* DS : MSR(ESCR) bit definition */ + +#define DS_BIT_0 0x00000001 +#define DS_BIT_1 0x00000002 +#define DS_BIT_2 0x00000004 +#define DS_BIT_3 0x00000008 +#define DS_BIT_4 0x00000010 +#define DS_BIT_5 0x00000020 +#define DS_BIT_6 0x00000040 +#define DS_BIT_7 0x00000080 +#define DS_BIT_8 0x00000100 +#define DS_BIT_9 0x00000200 +#define DS_BIT_10 0x00000400 +#define DS_BIT_11 0x00000800 +#define DS_BIT_12 0x00001000 +#define DS_BIT_13 0x00002000 +#define DS_BIT_14 0x00004000 +#define DS_BIT_15 0x00008000 +#define DS_BIT_16 0x00010000 +#define DS_BIT_17 0x00020000 +#define DS_BIT_18 0x00040000 +#define DS_BIT_19 0x00080000 +#define DS_BIT_20 0x00100000 +#define DS_BIT_21 0x00200000 +#define DS_BIT_22 0x00400000 +#define DS_BIT_23 0x00800000 +#define DS_BIT_24 0x01000000 +#define DS_BIT_25 0x02000000 +#define DS_BIT_26 0x04000000 +#define DS_BIT_27 0x08000000 +#define DS_BIT_28 0x10000000 +#define DS_BIT_29 0x20000000 +#define DS_BIT_30 0x40000000 +#define DS_BIT_31 0x80000000 + +/* DS : MSR(ESCR, CCCR) shift count definition */ + +#define DS_SHIFT_1 1 +#define DS_SHIFT_2 2 +#define DS_SHIFT_3 3 +#define DS_SHIFT_4 4 +#define DS_SHIFT_5 5 +#define DS_SHIFT_6 6 +#define DS_SHIFT_7 7 +#define DS_SHIFT_8 8 +#define DS_SHIFT_9 9 +#define DS_SHIFT_10 10 +#define DS_SHIFT_11 11 +#define DS_SHIFT_12 12 +#define DS_SHIFT_13 13 +#define DS_SHIFT_14 14 +#define DS_SHIFT_15 15 +#define DS_SHIFT_16 16 +#define DS_SHIFT_17 17 +#define DS_SHIFT_18 18 +#define DS_SHIFT_19 19 +#define DS_SHIFT_20 20 +#define DS_SHIFT_21 21 +#define DS_SHIFT_22 22 +#define DS_SHIFT_23 23 +#define DS_SHIFT_24 24 +#define DS_SHIFT_25 25 +#define DS_SHIFT_26 26 +#define DS_SHIFT_27 27 +#define DS_SHIFT_28 28 +#define DS_SHIFT_29 29 +#define DS_SHIFT_30 30 +#define DS_SHIFT_31 31 + + +#ifndef _ASMLANGUAGE + + +typedef struct btsRec /* BTS (Branch Trace Store) record */ + { + UINT32 pcFm; /* Last Branch From */ + UINT32 pcTo; /* Last Branch To */ + UINT32 misc; /* bit4: Branch Predicted */ + } BTS_REC; + +typedef struct pebsRec /* PEBS (Precise Event Based Sampling) rec */ + { + UINT32 eflags; /* EFLAGS */ + UINT32 eip; /* Linear IP */ + UINT32 eax; /* EAX */ + UINT32 ebx; /* EBX */ + UINT32 ecx; /* ECX */ + UINT32 edx; /* EDX */ + UINT32 esi; /* ESI */ + UINT32 edi; /* EDI */ + UINT32 ebp; /* EBP */ + UINT32 esp; /* ESP */ + } PEBS_REC; + +typedef struct dsBufHeader /* DS (Debug Store) buffer management */ + { + BTS_REC * btsBase; /* BTS buffer base */ + BTS_REC * btsIndex; /* BTS index */ + UINT32 btsMax; /* BTS absolute maximum */ + UINT32 btsThreshold; /* BTS interrupt threshold */ + PEBS_REC * pebsBase; /* PEBS buffer base */ + PEBS_REC * pebsIndex; /* PEBS index */ + UINT32 pebsMax; /* PEBS absolute maximum */ + UINT32 pebsThreshold; /* PEBS interrupt threshold */ + LL_INT pebsCtr; /* PEBS counter reset value */ + UINT32 reserved[3]; /* reserved */ + } DS_BUF_HEADER; + +typedef struct dsConfig /* DS (Debug Store) configuration */ + { + UINT32 btsNbytes; /* BTS buffer size */ + BOOL btsAvailable; /* TRUE if BTS is available */ + BOOL btsEnabled; /* TRUE if BTS is enabled */ + BOOL btsIntMode; /* TRUE for interrupt mode */ + BOOL btsBufMode; /* TRUE to store BTMs */ + UINT32 pebsNbytes; /* PEBS buffer size */ + BOOL pebsAvailable; /* TRUE if PEBS is available */ + BOOL pebsEnabled; /* TRUE if PEBS is enabled */ + INT32 pebsEvent; /* PEBS event */ + INT32 pebsMetric; /* PEBS metric */ + BOOL pebsOs; /* PEBS os */ + LL_INT pebsCtr; /* PEBS counter */ + DS_BUF_HEADER * pH; /* DS buffer header */ + } DS_CONFIG; + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS dbgStrLibInit (UINT32 nBytesBts, UINT32 nBytesPebs, + BOOL sysMode); +extern DS_BUF_HEADER * dbgStrBufInit (DS_BUF_HEADER * pH, + BTS_REC * btsBufAddr, + UINT32 btsMaxOffset, + UINT32 btsIntOffset, + PEBS_REC * pebsBufAddr, + UINT32 pebsMaxOffset, + UINT32 pebsIntOffset); +extern STATUS dbgStrBufAlloc (WIND_TCB * pTcb); +extern STATUS dbgStrBufFree (WIND_TCB * pTcb); +extern STATUS dbgStrConfig (WIND_TCB * pTcb, + BOOL btsEnable, BOOL pebsEnable, + BOOL btsIntMode, BOOL btsBufMode, + INT32 pebsEvent, INT32 pebsMetric, + BOOL pebsOs, LL_INT * pPebsValue); +extern STATUS dbgStrStart (WIND_TCB * pTcb); +extern STATUS dbgStrStop (WIND_TCB * pTcb); +extern STATUS dbgStrBtsModeSet (BOOL intMode, BOOL bufMode); +extern BOOL dbgStrBtsEnable (BOOL enable); +extern STATUS dbgStrPebsModeSet (INT32 event, INT32 metric, BOOL os, + LL_INT * pValue); +extern BOOL dbgStrPebsEnable (BOOL enable); + +extern void dbgStrShowInit (void); +extern void dbgStrShow (WIND_TCB * pTcb, int type); + +#else /* __STDC__ */ + +extern STATUS dbgStrLibInit (); +extern DS_BUF_HEADER * dbgStrBufInit (); +extern STATUS dbgStrBufAlloc (); +extern STATUS dbgStrBufFree (); +extern STATUS dbgStrConfig (); +extern STATUS dbgStrStart (); +extern STATUS dbgStrStop (); +extern STATUS dbgStrBtsModeSet (); +extern BOOL dbgStrBtsEnable (); +extern STATUS dbgStrPebsModeSet (); +extern BOOL dbgStrPebsEnable (); + +extern void dbgStrShowInit (); +extern void dbgStrShow (); + +#endif /* __STDC__ */ + + +#endif /* _ASMLANGUAGE */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdbgStrLibh */ diff --git a/h/arch/i86/dsmI86Lib.h b/h/arch/i86/dsmI86Lib.h new file mode 100644 index 0000000..350d4de --- /dev/null +++ b/h/arch/i86/dsmI86Lib.h @@ -0,0 +1,647 @@ +/* dsmI86Lib.h - i80x86 disassembler header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01k,16mar04,md Add output functions to dmsData() and dsmInst() +01j,01mar03,pai Made the FORMAT_X & FORMAT_Y opcode data pointers point to + constant data. Updated Copyright. +01i,16sep02,pai Updated support for SSE2 & Pentium 4 instructions. +01h,30aug01,hdn added SIMD, sysenter/exit support. +01g,06may98,fle added P5 and P6 instructions and facilities +01f,14nov94,hdn changed D->DISR, W->WFUL, S->SEXT, P->POP, A->AX, I->IMM. + +kdl minor cleanup. +01e,29may94,hdn removed I80486 conditional. +01d,31aug93,hdn changed a type of pD, from char to UCHAR. + changed a type of 1st parameter, from char to UCHAR. +01c,07jun93,hdn added support for c++ +01b,26mar93,hdn added new instructions for 486. +01a,23jun92,hdn written. +*/ + +#ifndef __INCdsmI86Libh +#define __INCdsmI86Libh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include "vwModNum.h" + + +/* dsmLib status codes */ + +#define S_dsmLib_UNKNOWN_INSTRUCTION (M_dsmLib | 1) + + +#define DSM_BUFSIZE16 (16) +#define DSM_BUFSIZE32 (32) + +typedef struct /* INST */ + { + const char * pOpc; /* Instruction Name */ + int type; /* instruction type */ + int flag; /* instruction flag */ + int flag2; /* instruction flag2 */ + UCHAR op0; /* opcode 0 */ + UCHAR op1; /* opcode 1 */ + UCHAR op2; /* opcode 2 */ + UCHAR op3; /* opcode 3 */ + UCHAR mask0; /* mask 0 */ + UCHAR mask1; /* mask 1 */ + UCHAR mask2; /* mask 2 */ + UCHAR mask3; /* mask 3 */ + + } INST; + +typedef struct /* FORMAT_X */ + { + const INST * pI; /* pointer to an INST descriptor */ + const char * pD; /* opcode data pointer */ + const char * pOpc; /* instruction name pointer */ + char obuf [DSM_BUFSIZE16]; /* instruction name buffer */ + char a32; /* address size 0,1 */ + char d32; /* data size 0,1 */ + char lenO; /* opcode length 1,2 */ + char lenD; /* displacement length 0,1,2,4 */ + char lenI; /* immediate length 0,1,2,4 */ + char modrm; /* MODRM 0,1 */ + char sib; /* SIB 0,1 */ + char w; /* W 0,1 */ + char d; /* D 0,1 */ + char s; /* S 0,1 */ + char reg; /* register 3 bits, 8 bits */ + char mod; /* value of MODRM byte bits 6,7 */ + char rm; /* value of MODRM byte bits 0,1,2 */ + char ss; + char index; + char base; + char mf; + char st; + char fd; + + } FORMAT_X; + +typedef struct /* FORMAT_Y */ + { + const char * pD; /* opcode data pointer */ + const char * pOpc; /* instruction name pointer */ + char * pOpr0; /* output string 0 */ + char * pOpr1; /* output string 1 */ + char * pOpr2; /* output string 2 */ + int len; /* instruction length */ + int addr; /* address operand */ + char obuf [DSM_BUFSIZE16]; /* opcode buffer */ + char rbuf [DSM_BUFSIZE16]; /* register buffer */ + char mbuf [DSM_BUFSIZE32]; /* memory buffer */ + char temp [DSM_BUFSIZE32]; /* temporary buffer */ + char ibuf [DSM_BUFSIZE16]; /* immediate buffer */ + char dbuf [DSM_BUFSIZE16]; /* displacement buffer */ + + } FORMAT_Y; + +/* bit definitions of flag */ + +/* jhw: MSB of flag byte is not included in switch statement used + * to format the output. + */ + +/* MODRM must be defined if REG, MMXREG, XMMREG are defined */ + +#define SF (0x10000000) +#define OP1 (0x20000000) +#define OP2 (0x40000000) +#define OP3 (0x80000000) +#define WFUL (0x01000000) /* operand size bit */ +#define SEXT (0x02000000) /* sign extend flag */ +#define DISR (0x04000000) /* data direction info encoded in opcode */ +#define TTT (0x08000000) /* hack to look for rotate instructions */ + +#define TTTN (0x00100000) /* opcode least significant byte + * bits 0-4 = condition test field */ +#define MF (0x00200000) /* opcode bits 1-2 are = register size info */ +#define POP (0x00400000) /* cat a "P" to end of instruction name */ + +#define IMM (0x00000001) +#define I8 (0x00000002) /* imm8 byte exists */ +#define DIS (0x00000004) /* displacement info */ +#define D8 (0x00000008) /* displacement info */ +#define D16 (0x00000010) /* displacement info */ +#define AX (0x00000020) /* store into AX register */ +#define CL (0x00000040) /* cat "CL" to end of operands */ +#define REG (0x00000080) /* modrm bits 3-5 = register specifier */ +#define SREG2 (0x00000100) /* modrm bits 3-4 = 2 bit segment register */ +#define SREG3 (0x00000200) /* modrm bits 3-5 = 3 bit segment register */ +#define MODRM (0x00000400) /* modrm byte exists */ +#define EEE (0x00000800) /* modrm bits 3-5 = control/debug register */ +#define REGRM (0x00001000) /* modrm bits 0-2 = register specifier */ +#define PORT (0x00002000) /* use a port as an operand */ +#define OFFSEL (0x00004000) /* jump or call offset */ +#define D16L8 (0x00008000) /* displacement info */ +#define FD (0x00010000) /* stack element is destination */ +#define ST (0x00020000) /* stack element is operand */ +#define MMXRM (0x00040000) /* modrm bits 0-2 = MMX register */ +#define MMXREG (0x00080000) /* modrm bits 3-5 = MMX register */ +#define GG (0x00800000) /* least sign opcode byte + * bits 0-1 = MMX granularity */ + +/* bit definitions of flag2 */ + +#define XMMRM (0x00000001) /* modrm bits 0-2 = XMM register */ +#define XMMREG (0x00000002) /* modrm bits 3-5 = XMM register */ + +#define ESC (0xd8) /* for co-processor instructions */ + +/* instruction types */ + +#define itAaa 1 +#define itAad 2 +#define itAam 3 +#define itAas 4 +#define itAddItoA 5 +#define itAddItoRM 6 +#define itAddRMtoRM 7 +#define itAndItoA 8 +#define itAndItoRM 9 +#define itAndRMtoRM 10 +#define itArpl 11 +#define itAsize 12 +#define itBound 13 +#define itBsf 14 +#define itBsr 15 +#define itBtI 16 +#define itBtR 17 +#define itBtcI 18 +#define itBtcR 19 +#define itBtrI 20 +#define itBtrR 21 +#define itBtsI 22 +#define itBtsR 23 +#define itCall 24 +#define itCallRM 25 +#define itCallSeg 26 +#define itCallSegRM 27 +#define itCbw 28 +#define itCjmp 29 +#define itClc 30 +#define itCld 31 +#define itCli 32 +#define itClts 33 +#define itCmc 34 +#define itCmpIwiA 35 +#define itCmpIwiRM 36 +#define itCmpRMwiRM 37 +#define itCmps 38 +#define itCs 39 +#define itCset 40 +#define itCwd 41 +#define itDaa 42 +#define itDas 43 +#define itDecR 44 +#define itDecRM 45 +#define itDiv 46 +#define itDs 47 +#define itEnter 48 +#define itEs 49 +#define itFs 50 +#define itGs 51 +#define itHlt 52 +#define itIdiv 53 +#define itImulAwiRM 54 +#define itImulRMwiI 55 +#define itImulRwiRM 56 +#define itInF 57 +#define itInV 58 +#define itIncR 59 +#define itIncRM 60 +#define itIns 61 +#define itInt 62 +#define itInt3 63 +#define itInto 64 +#define itIret 65 +#define itJcxz 66 +#define itJmpD 67 +#define itJmpRM 68 +#define itJmpS 69 +#define itJmpSeg 70 +#define itJmpSegRM 71 +#define itLahf 72 +#define itLar 73 +#define itLds 74 +#define itLea 75 +#define itLeave 76 +#define itLes 77 +#define itLfs 78 +#define itLgdt 79 +#define itLgs 80 +#define itLidt 81 +#define itLldt 82 +#define itLmsw 83 +#define itLock 84 +#define itLods 85 +#define itLoop 86 +#define itLoopnz 87 +#define itLoopz 88 +#define itLsl 89 +#define itLss 90 +#define itLtr 91 +#define itMovAMtoMA 92 +#define itMovC 93 +#define itMovD 94 +#define itMovItoR 95 +#define itMovItoRM 96 +#define itMovRMtoMR 97 +#define itMovRMtoS 98 +#define itMovRtoRM 99 +#define itMovStoRM 100 +#define itMovT 101 +#define itMovs 102 +#define itMovsx 103 +#define itMovzx 104 +#define itMulAwiRM 105 +#define itNeg 106 +#define itNop 107 +#define itNot 108 +#define itOrItoA 109 + +#define itOrItoRM 111 + +#define itOrRMtoRM 113 + +#define itOsize 115 +#define itOutF 116 +#define itOutV 117 +#define itOuts 118 +#define itPopR 119 +#define itPopRM 120 +#define itPopS 121 +#define itPopa 122 +#define itPopf 123 +#define itPushI 124 +#define itPushR 125 +#define itPushRM 126 +#define itPushS 127 +#define itPusha 128 +#define itPushf 129 +#define itRNcmps 130 +#define itRNscas 131 +#define itRcmps 132 +#define itRet 133 +#define itRetI 134 +#define itRetSeg 135 +#define itRetSegI 136 +#define itRins 137 +#define itRlods 138 +#define itRmovs 139 +#define itRolRMby1 140 +#define itRolRMbyCL 141 +#define itRolRMbyI 142 +#define itRouts 143 +#define itRscas 144 +#define itRstos 145 +#define itSahf 146 +#define itSbbIfrA 147 +#define itSbbIfrRM 148 +#define itSbbRMfrRM 149 +#define itScas 150 +#define itSgdt 151 +#define itShldRMbyCL 152 +#define itShldRMbyI 153 +#define itShrdRMbyCL 154 +#define itShrdRMbyI 155 +#define itSmsw 156 +#define itSs 157 +#define itStc 158 +#define itStd 159 +#define itSti 160 +#define itStos 161 +#define itStr 162 + +#define itSubIfrA 164 +#define itSubIfrRM 165 +#define itSubRMfrRM 166 +#define itTestIanA 167 +#define itTestIanRM 168 +#define itTestRManR 169 +#define itWait 170 +#define itXchgA 171 +#define itXchgRM 172 +#define itXlat 173 + +/* instructions for 387 */ + +#define itF2xm1 174 +#define itFabs 175 +#define itFaddIRM 176 +#define itFaddST 177 +#define itFchs 178 +#define itFclex 179 +#define itFcomIRM 180 +#define itFcomST 181 +#define itFcompIRM 182 +#define itFcompST 183 +#define itFcompp 184 +#define itFcos 185 +#define itFdecstp 186 +#define itFdivIRM 187 +#define itFdivST 188 +#define itFfree 189 +#define itFincstp 190 +#define itFinit 191 +#define itFld1 192 +#define itFldBCDM 193 +#define itFldERM 194 +#define itFldIRM 195 +#define itFldL2E 196 +#define itFldL2T 197 +#define itFldLG2 198 +#define itFldLIM 199 +#define itFldLN2 200 +#define itFldPI 201 +#define itFldST 202 +#define itFldZ 203 +#define itFldcw 204 +#define itFldenv 205 +#define itFmulIRM 206 +#define itFmulST 207 +#define itFnop 208 +#define itFpatan 209 +#define itFprem 210 +#define itFprem1 211 +#define itFptan 212 +#define itFrndint 213 +#define itFrstor 214 +#define itFsave 215 +#define itFscale 216 +#define itFsin 217 +#define itFsincos 218 +#define itFsqrt 219 +#define itFstIRM 220 +#define itFstST 221 +#define itFstcw 222 +#define itFstenv 223 +#define itFstpBCDM 224 +#define itFstpERM 225 +#define itFstpIRM 226 +#define itFstpLIM 227 +#define itFstpST 228 +#define itFstsw 229 +#define itFstswA 230 +#define itFsubIRM 231 +#define itFsubST 232 +#define itFtst 233 +#define itFucom 234 +#define itFucomp 235 +#define itFucompp 236 +#define itFxam 237 +#define itFxch 238 +#define itFxtract 239 +#define itFyl2x 240 +#define itFyl2xp1 241 +#define itFcmovb 242 +#define itFcmove 243 +#define itFcmovbe 244 +#define itFcmovu 245 +#define itFcmovnb 246 +#define itFcmovne 247 +#define itFcmovnbe 248 +#define itFcmovnu 249 +#define itFcomi 250 + + +/* addendum */ + +#define itSidt 300 +#define itSldt 301 +#define itVerr 302 +#define itVerw 303 +#define itXorItoRM 304 +#define itAdcItoRM 305 +#define itXorItoA 306 +#define itAdcItoA 307 +#define itXorRMtoRM 308 +#define itAdcRMtoRM 309 +#define itRep 310 +#define itRepNe 311 + +/* 80486 instructions */ + +#define itBswap 400 +#define itCmpxchg 401 +#define itXadd 402 +#define itInvd 403 +#define itWbinvd 404 +#define itInvlpg 405 + +/* P5 instructions */ + +#define itCmpxchg8b 500 +#define itCpuid 501 +#define itRdtsc 502 +#define itRdmsr 503 +#define itWrmsr 504 +#define itRsm 505 + +/* P6 instructions */ + +#define itCmovcc 600 +#define itRdpmc 601 +#define itUd2 602 +#define itSysenter 603 +#define itSysexit 604 + +/* MMX/SSE2 instructions */ + +#define itEmms 700 +#define itMovd 701 +#define itMovq 702 +#define itPackssdw 703 +#define itPacksswb 704 +#define itPackuswb 705 +#define itPadd 706 +#define itPadds 707 +#define itPaddus 708 +#define itPand 709 +#define itPandn 710 +#define itPcmpeq 711 +#define itPcmpgt 712 +#define itPmadd 713 +#define itPmulh 714 +#define itPmull 715 +#define itPor 716 +#define itPsll 717 +#define itPsra 718 +#define itPsrl 719 +#define itPsub 720 +#define itPsubs 721 +#define itPsubus 722 +#define itPunpckh 723 +#define itPunpckl 724 +#define itPxor 725 + +/* SSE/SSE2 instructions */ + +#define itAddpd 800 +#define itAddps 801 +#define itAddsd 802 +#define itAddss 803 +#define itAndnpd 804 +#define itAndnps 805 +#define itAndpd 806 +#define itAndps 807 + +#define itCmppd 821 +#define itCmpps 822 +#define itCmpsd 823 +#define itCmpss 824 + +#define itComiss 827 +#define itCvtdq2pd 828 +#define itCvtdq2ps 829 +#define itCvtpd2dq 830 +#define itCvtpd2ps 831 +#define itCvtpi2pd 832 +#define itCvtpi2ps 833 +#define itCvtps2dq 834 +#define itCvtps2pd 835 +#define itCvtps2pi 836 +#define itCvtsd2si 837 +#define itCvtsd2ss 838 +#define itCvtsi2sd 839 +#define itCvtsi2ss 840 +#define itCvtss2sd 841 +#define itCvtss2si 842 +#define itCvttpd2dq 843 +#define itCvttpd2pi 844 +#define itCvttps2dq 845 +#define itCvttps2pi 846 +#define itCvttsd2si 847 +#define itCvttss2si 848 +#define itDivpd 849 +#define itDivps 850 +#define itDivsd 851 +#define itDivss 852 +#define itFxrstor 853 +#define itFxsave 854 +#define itLdmxcsr 855 +#define itMaskmovdqu 856 +#define itMaskmovq 857 +#define itMaxpd 858 +#define itMaxps 859 +#define itMaxsd 860 +#define itMaxss 861 +#define itMinpd 862 +#define itMinps 863 +#define itMinsd 864 +#define itMinss 865 +#define itMovapd 866 +#define itMovaps 867 +#define itMovdq2q 868 +#define itMovdqa 869 +#define itMovdqu 870 +#define itMovhlps 871 +#define itMovhpd 872 +#define itMovhps 873 +#define itMovlhps 874 +#define itMovlpd 875 +#define itMovlps 876 +#define itMovmskpd 877 +#define itMovmskps 878 +#define itMovntdq 879 +#define itMovntpd 880 +#define itMovntps 881 +#define itMovntq 882 +#define itMovq2dq 883 +#define itMovsd 884 +#define itMovss 885 +#define itMovupd 886 +#define itMovups 887 +#define itMulpd 888 +#define itMulps 889 +#define itMulsd 890 +#define itMulss 891 +#define itOrpd 892 +#define itOrps 893 +#define itPavgb 894 +#define itPavgw 895 +#define itPextrw 896 +#define itPinsrw 897 +#define itPmaxsw 898 +#define itPmaxub 899 +#define itPminsw 900 +#define itPminub 901 +#define itPmovmskb 902 +#define itPmulhuw 903 +#define itPmuludq 904 +#define itPrefetchnta 905 +#define itPrefetcht0 906 +#define itPrefetcht1 907 +#define itPrefetcht2 908 +#define itPsadbw 909 +#define itPshufd 910 +#define itPshufhw 911 +#define itPshuflw 912 +#define itPshufw 913 +#define itPslldq 914 +#define itPsrldq 915 +#define itPunpckhqdq 916 +#define itPunpcklqdq 917 +#define itRcpps 918 +#define itRcpss 919 +#define itRsqrtps 920 +#define itRsqrtss 921 +#define itSfence 922 +#define itShufps 923 +#define itSqrtpd 924 +#define itSqrtps 925 +#define itSqrtsd 926 +#define itSqrtss 927 +#define itStmxcsr 928 +#define itSubpd 929 +#define itSubps 930 +#define itSubsd 931 +#define itSubss 932 +#define itUcomisd 933 +#define itUcomiss 934 +#define itUnpckhpd 935 +#define itUnpckhps 936 +#define itUnpcklpd 937 +#define itUnpcklps 938 +#define itXorpd 939 +#define itXorps 940 + +/* Pentium 4 instructions */ + +#define itClflush 1000 +#define itLfence 1001 +#define itMfence 1002 +#define itMovnti 1003 +#define itPause 1004 + + +/* function declarations */ + +#if defined (__STDC__) || defined (__cplusplus) + +IMPORT int dsmData (UCHAR *, int, FUNCPTR, int); +IMPORT int dsmInst (UCHAR *, int, VOIDFUNCPTR, FUNCPTR, int); +IMPORT int dsmNbytes (UCHAR *); + +#else + +IMPORT int dsmData (); +IMPORT int dsmInst (); +IMPORT int dsmNbytes (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdsmI86Libh */ diff --git a/h/arch/i86/elfI86.h b/h/arch/i86/elfI86.h new file mode 100644 index 0000000..d839657 --- /dev/null +++ b/h/arch/i86/elfI86.h @@ -0,0 +1,65 @@ +/* elfI86.h - i86-specific ELF loader header */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software may be + * licensed only pursuant to the terms of an applicable Wind River license + * agreement. + */ + +/* +modification history +-------------------- +01c,25jul05,v_r Updated copyright. +01b,27feb04,pad Renamed relocation type R_386_JUMP_SLOT as R_386_JMP_SLOT as + per ABI. +01a,12sep01,pad Backported from TAE 3.1 to T2.2 with necessary adaptations + (base version: elfI86.h@@/main/tor3_x/1). +*/ + +#ifndef __INCelfI86h +#define __INCelfI86h + +#ifdef __cplusplus +extern "C" { +#endif + +#define EM_ARCH_MACHINE EM_386 +#define EM_ARCH_MACH_ALT EM_486 /* not used */ + +/* + * Relocation Type Definitions + * The only ones that appear in vxWorks archives are "1" and "2" + */ + +#define R_386_NONE 0 /* No reloc */ +#define R_386_32 1 /* Direct 32 bit */ +#define R_386_PC32 2 /* PC relative 32 bit */ +#define R_386_GOT32 3 /* 32 bit GOT entry */ +#define R_386_PLT32 4 /* 32 bit PLT address */ +#define R_386_COPY 5 /* Copy symbol at runtime */ +#define R_386_GLOB_DAT 6 /* Create GOT entry */ +#define R_386_JMP_SLOT 7 /* Create PLT entry */ +#define R_386_RELATIVE 8 /* Adjust by program base */ +#define R_386_GOTOFF 9 /* 32 bit offset to GOT */ +#define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */ + +/* These 16-bit and 8-bit relocs should never show up */ + +#define R_386_16 20 +#define R_386_PC16 21 +#define R_386_8 22 +#define R_386_PC8 23 +#define R_386_max 24 + +/* These are GNU extensions to enable C++ vtable garbage collection. */ + +#define R_386_GNU_VTINHERIT 250 +#define R_386_GNU_VTENTRY 251 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCelfI86h */ diff --git a/h/arch/i86/esfI86.h b/h/arch/i86/esfI86.h new file mode 100644 index 0000000..04447c5 --- /dev/null +++ b/h/arch/i86/esfI86.h @@ -0,0 +1,110 @@ +/* esfI86.h - I80x86 exception stack frames */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,31aug01,hdn added ESF[123] macros and its offset/size. +01b,08jun93,hdn added support for c++. updated to 5.1. +01a,28feb92,hdn written based on TRON, 68k version. +*/ + +#ifndef __INCesfI86h +#define __INCesfI86h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* Exception stack frames. Most of these can happen only for one + CPU or another, but they are all defined for all CPU's */ + +/* Format-0 - no privilege change, no error code */ + +typedef struct + { + INSTR * pc; /* 0x00 : PC */ + unsigned short cs; /* 0x04 : code segment */ + unsigned short pad0; /* 0x06 : padding */ + unsigned long eflags; /* 0x08 : EFLAGS */ + } ESF0; /* sizeof(ESF0) -> 0x0c */ + +/* Format-1 - no privilege change, error code */ + +typedef struct + { + unsigned long errCode; /* 0x00 : error code */ + INSTR * pc; /* 0x04 : PC */ + unsigned short cs; /* 0x08 : code segment */ + unsigned short pad0; /* 0x0a : padding */ + unsigned long eflags; /* 0x0c : EFLAGS */ + } ESF1; /* sizeof(ESF1) -> 0x10 */ + +/* Format-2 - privilege change, no error code */ + +typedef struct + { + INSTR * pc; /* 0x00 : PC */ + unsigned short cs; /* 0x04 : code segment */ + unsigned short pad0; /* 0x06 : padding */ + unsigned long eflags; /* 0x08 : EFLAGS */ + unsigned long esp; /* 0x0c : ESP */ + unsigned long ss; /* 0x10 : SS */ + } ESF2; /* sizeof(ESF2) -> 0x14 */ + +/* Format-3 - privilege change, error code */ + +typedef struct + { + unsigned long errCode; /* 0x00 : error code */ + INSTR * pc; /* 0x04 : PC */ + unsigned short cs; /* 0x08 : code segment */ + unsigned short pad0; /* 0x0a : padding */ + unsigned long eflags; /* 0x0c : EFLAGS */ + unsigned long esp; /* 0x10 : ESP */ + unsigned long ss; /* 0x14 : SS */ + } ESF3; /* sizeof(ESF3) -> 0x18 */ + +#endif /* _ASMLANGUAGE */ + + +#define ESF0_EIP 0x00 /* 0x00 : PC */ +#define ESF0_CS 0x04 /* 0x04 : CS */ +#define ESF0_EFLAGS 0x08 /* 0x08 : EFLAGS */ + +#define ESF1_ERROR 0x00 /* 0x00 : ERROR */ +#define ESF1_EIP 0x04 /* 0x04 : PC */ +#define ESF1_CS 0x08 /* 0x08 : CS */ +#define ESF1_EFLAGS 0x0c /* 0x0c : EFLAGS */ + +#define ESF2_EIP 0x00 /* 0x00 : PC */ +#define ESF2_CS 0x04 /* 0x04 : CS */ +#define ESF2_EFLAGS 0x08 /* 0x08 : EFLAGS */ +#define ESF2_ESP 0x0c /* 0x0c : ESP */ +#define ESF2_SS 0x10 /* 0x10 : SS */ + +#define ESF3_ERROR 0x00 /* 0x00 : ERROR */ +#define ESF3_EIP 0x04 /* 0x04 : PC */ +#define ESF3_CS 0x08 /* 0x08 : CS */ +#define ESF3_EFLAGS 0x0c /* 0x0c : EFLAGS */ +#define ESF3_ESP 0x10 /* 0x10 : ESP */ +#define ESF3_SS 0x14 /* 0x14 : SS */ + +#define ESF0_NBYTES 0x0c /* sizeof(ESF0) */ +#define ESF1_NBYTES 0x10 /* sizeof(ESF1) */ +#define ESF2_NBYTES 0x14 /* sizeof(ESF2) */ +#define ESF3_NBYTES 0x18 /* sizeof(ESF3) */ + +#define ESF0_NLONGS 0x03 /* sizeof(ESF0) / sizeof(int) */ +#define ESF1_NLONGS 0x04 /* sizeof(ESF1) / sizeof(int) */ +#define ESF2_NLONGS 0x05 /* sizeof(ESF2) / sizeof(int) */ +#define ESF3_NLONGS 0x06 /* sizeof(ESF3) / sizeof(int) */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCesfI86h */ diff --git a/h/arch/i86/excI86Lib.h b/h/arch/i86/excI86Lib.h new file mode 100644 index 0000000..6120a26 --- /dev/null +++ b/h/arch/i86/excI86Lib.h @@ -0,0 +1,97 @@ +/* excLib.h - exception library header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,26nov03,pes Correct _WRS_IS_SUPV_EXC macro. +01f,18nov03,pes Add _WRS_IS_SUPV_EXC macro. +01e,22oct02,hdn added EXC_FP_CONTEXT for FPU exception (spr 70252) +01d,29aug01,hdn added _ASMLANGUAGE conditional macro + added esp0, cr2, cr3, esp0[07] to EXC_INFO. +01c,14nov93,hdn added excExcepHook. +01b,08jun93,hdn added support for c++. updated to 5.1. +01a,28feb92,hdn written based on TRON, 68k version. +*/ + +#ifndef __INCexcI86Libh +#define __INCexcI86Libh + +#ifdef __cplusplus +extern "C" { +#endif + +/* lowest and highest vector number to initialize */ + +#define LOW_VEC 0 /* lowest initialized vector */ +#define HIGH_VEC 0xff /* highest initialized vector */ + + +#ifndef _ASMLANGUAGE + +typedef struct + { + UINT16 valid; /* indicators that following fields are valid */ + UINT16 vecNum; /* vector number */ + ULONG errCode; /* error code */ + INSTR * pc; /* program counter */ + ULONG eflags; /* eflags register */ + UINT16 cs; /* code segment register */ + UINT16 pad; /* pad to four byte boundary */ + ULONG esp; /* stack pointer in the ESF */ + ULONG ss; /* stack segment in the ESF */ + ULONG esp0; /* supervisor (PL0) stack pointer */ + ULONG cr2; /* CR2 */ + ULONG cr3; /* CR3 */ + ULONG esp00; /* content of the stack *(esp0 + 0) */ + ULONG esp01; /* content of the stack *(esp0 + 1) */ + ULONG esp02; /* content of the stack *(esp0 + 2) */ + ULONG esp03; /* content of the stack *(esp0 + 3) */ + ULONG esp04; /* content of the stack *(esp0 + 4) */ + ULONG esp05; /* content of the stack *(esp0 + 5) */ + ULONG esp06; /* content of the stack *(esp0 + 6) */ + ULONG esp07; /* content of the stack *(esp0 + 7) */ + ULONG reserved0; /* reserved 0 */ + ULONG reserved1; /* reserved 1 */ + ULONG reserved2; /* reserved 2 */ + ULONG reserved3; /* reserved 3 */ + } EXC_INFO; + +#define _WRS_IS_SUPV_EXC() (((excInfo.eflags & EFLAGS_IOPL) == 0) ? TRUE : FALSE) + +/* exception info valid bits */ + +#define EXC_VEC_NUM 0x01 /* vector number valid */ +#define EXC_ERROR_CODE 0x02 /* error code valid */ +#define EXC_ESP_SS 0x04 /* ESP and SS valid */ +#define EXC_CR2 0x08 /* CR2 valid */ +#define EXC_FP_CONTEXT 0x10 /* FP_CONTEXT valid */ +#define EXC_INVALID_TYPE 0x80 /* special indicator: ESF type was bad; + * type is in funcCode field */ + +/* variable declarations */ + +extern FUNCPTR excExcepHook; /* add'l rtn to call when exceptions occur */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void excStub (void); +extern void excIntStub (void); + +#else /* __STDC__ */ + +extern void excStub (); +extern void excIntStub (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCexcI86Libh */ diff --git a/h/arch/i86/fppI86Lib.h b/h/arch/i86/fppI86Lib.h new file mode 100644 index 0000000..75dd8d5 --- /dev/null +++ b/h/arch/i86/fppI86Lib.h @@ -0,0 +1,213 @@ +/* fppLib.h - floating-point coprocessor support library header */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,25mar02,hdn added two APIs to detect illegal FPU usage (spr 70187) +01f,21nov01,hdn derived xmm[] from the reserved res2[] in FPX_CONTEXT +01e,21aug01,hdn imported SSE support from T31 ver 01g +01d,02sep93,hdn deleted a macro FPX. +01c,08jun93,hdn added support for c++. updated to 5.1. +01b,29sep92,hdn changed UTINY to UCHAR. +01a,07apr92,hdn written based on TRON version. +*/ + +#ifndef __INCfppI86Libh +#define __INCfppI86Libh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* control register: defines for control word */ + +#define FPCR_IM 0x0001 /* IM exc-mask invalid operation */ +#define FPCR_DM 0x0002 /* DM exc-mask denormalized operand */ +#define FPCR_ZM 0x0004 /* ZM exc-mask zero divide */ +#define FPCR_OM 0x0008 /* OM exc-mask overflow */ +#define FPCR_UM 0x0010 /* UM exc-mask underflow */ +#define FPCR_PM 0x0020 /* PM exc-mask precision */ +#define FPCR_PC_SINGLE 0x0000 /* PC single precision(24 bits) */ +#define FPCR_PC_DOUBLE 0x0200 /* PC double precision(53 bits) */ +#define FPCR_PC_EXTENDED 0x0300 /* PC extended precision(64 bits) */ +#define FPCR_PC_MASK 0xfcff /* PC extended precision(64 bits) */ +#define FPCR_RC_NEAREST 0x0000 /* RC round to nearest */ +#define FPCR_RC_DOWN 0x0400 /* RC round down */ +#define FPCR_RC_UP 0x0800 /* RC round up */ +#define FPCR_RC_ZERO 0x0c00 /* RC round to zero */ +#define FPCR_RC_MASK 0xf3ff /* RC round bits mask */ +#define FPCR_X 0x1000 /* X infinity control */ + +/* status register: defines for status word */ + +#define FPSR_IE 0x0001 /* IE exc-flag invalid operation */ +#define FPSR_DE 0x0002 /* DE exc-flag denormalized operand */ +#define FPSR_ZE 0x0004 /* ZE exc-flag zero divide */ +#define FPSR_OE 0x0008 /* OE exc-flag overflow */ +#define FPSR_UE 0x0010 /* UE exc-flag underflow */ +#define FPSR_PE 0x0020 /* PE exc-flag precision */ +#define FPSR_SF 0x0040 /* SF stack fault */ +#define FPSR_ES 0x0080 /* ES error summary status */ +#define FPSR_C0 0x0100 /* C0 condition code */ +#define FPSR_C1 0x0200 /* C1 condition code */ +#define FPSR_C2 0x0400 /* C2 condition code */ +#define FPSR_TOP 0x3800 /* TOP top of stack pointer */ +#define FPSR_C3 0x4000 /* C3 condition code */ +#define FPSR_B 0x8000 /* FPU busy */ + +/* number of FP/MM and XMM registers on coprocessor */ + +#define FP_NUM_REGS 8 /* number of FP/MM registers */ +#define XMM_NUM_REGS 8 /* number of XMM registers */ +#define FP_NUM_RESERVED 14 /* reserved area in FPX_CONTEXT */ + +/* maximum size of floating-point coprocessor state frame */ + +#define FPO_STATE_FRAME_SIZE 108 /* nBytes of FPO_CONTEXT */ +#define FPX_STATE_FRAME_SIZE 512 /* nBytes of FPX_CONTEXT */ + +/* FPREG_SET structure offsets */ + +#define FPREG_FPCR 0x00 /* offset to FPCR in FPREG_SET */ +#define FPREG_FPSR 0x04 /* offset to FPSR in FPREG_SET */ +#define FPREG_FPTAG 0x08 /* offset to FPTAG in FPREG_SET */ +#define FPREG_OP 0x0c /* offset to OP in FPREG_SET */ +#define FPREG_IP 0x10 /* offset to IP in FPREG_SET */ +#define FPREG_CS 0x14 /* offset to CS in FPREG_SET */ +#define FPREG_DP 0x18 /* offset to DP in FPREG_SET */ +#define FPREG_DS 0x1c /* offset to DS in FPREG_SET */ +#define FPREG_FPX(n) (0x20 + (n)*sizeof(DOUBLEX)) /* offset to FPX(n) */ + + +#ifndef _ASMLANGUAGE + +/* DOUBLEX - double extended precision */ + +typedef struct + { + UCHAR f[10]; /* ST[0-7] or MM[0-7] */ + } DOUBLEX; + +/* DOUBLEX_SSE - double extended precision used in FPX_CONTEXT for SSE */ + +typedef struct + { + UCHAR f[10]; /* ST[0-7] or MM[0-7] */ + UCHAR r[6]; /* reserved */ + } DOUBLEX_SSE; + +/* FPREG_SET - FP register set that is different from FP_CONTEXT */ + +typedef struct fpregSet + { + int fpcr; /* control word */ + int fpsr; /* status word */ + int fptag; /* tag word */ + int op; /* last FP instruction op code */ + int ip; /* instruction pointer */ + int cs; /* instruction pointer selector */ + int dp; /* data pointer */ + int ds; /* data pointer selector */ + DOUBLEX fpx[FP_NUM_REGS]; /* FR[0-7] non-TOS rel. order */ + } FPREG_SET; + +/* FPO_CONTEXT - Old FP context used by fsave/frstor instruction */ + +typedef struct fpOcontext + { + int fpcr; /* 4 control word */ + int fpsr; /* 4 status word */ + int fptag; /* 4 tag word */ + int ip; /* 4 instruction pointer */ + short cs; /* 2 instruction pointer selector */ + short op; /* 2 last FP instruction op code */ + int dp; /* 4 data pointer */ + int ds; /* 4 data pointer selector */ + DOUBLEX fpx[FP_NUM_REGS]; /* 8*10 FR[0-7] non-TOS rel. order */ + } FPO_CONTEXT; /* 108 bytes total */ + +/* FPX_CONTEXT - New FP context used by fxsave/fxrstor instruction */ + +typedef struct fpXcontext + { + short fpcr; /* 2 control word */ + short fpsr; /* 2 status word */ + short fptag; /* 2 tag word */ + short op; /* 2 last FP instruction op code */ + int ip; /* 4 instruction pointer */ + int cs; /* 4 instruction pointer selector */ + int dp; /* 4 data pointer */ + int ds; /* 4 data pointer selector */ + int reserved0; /* 4 reserved */ + int reserved1; /* 4 reserved */ + DOUBLEX_SSE fpx[FP_NUM_REGS]; /* 8*16 FR[0-7] non-TOS rel. order */ + DOUBLEX_SSE xmm[XMM_NUM_REGS]; /* 8*16 XMM[0-7] */ + DOUBLEX_SSE res2[FP_NUM_RESERVED]; /* 14*16 reserved */ + } FPX_CONTEXT; /* 512 bytes total */ + +/* FP_CONTEXT - Common FP context */ + +typedef struct fpContext + { + union u + { + FPO_CONTEXT o; /* old FPO_CONTEXT for fsave/frstor */ + FPX_CONTEXT x; /* new FPX_CONTEXT for fxsave/fxrstor */ + } u; + } FP_CONTEXT; + + +/* variable declarations */ + +extern REG_INDEX fpRegName[]; /* f-point data register table */ +extern REG_INDEX fpCtlRegName[]; /* f-point control register table */ +extern WIND_TCB *pFppTaskIdPrevious; /* task id for deferred exceptions */ +extern FUNCPTR fppCreateHookRtn; /* arch dependent create hook routine */ +extern FUNCPTR fppDisplayHookRtn; /* arch dependent display routine */ +extern VOIDFUNCPTR _func_fppSaveRtn; /* fppSave or fppXsave */ +extern VOIDFUNCPTR _func_fppRestoreRtn; /* fppRestore or fppXrestore */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void fppArchInit (void); +extern void fppArchTaskCreateInit (FP_CONTEXT *pFpContext); +extern STATUS fppProbeSup (void); +extern void fppProbeTrap (void); +extern void fppDtoDx (DOUBLEX *pDx, double *pDouble); +extern void fppDxtoD (double *pDouble, DOUBLEX *pDx); +extern void fppXrestore (FP_CONTEXT *pFpContext); +extern void fppXsave (FP_CONTEXT *pFpContext); +extern void fppXregsToCtx (FPREG_SET *pFpRegSet, FP_CONTEXT *pFpContext); +extern void fppXctxToRegs (FP_CONTEXT *pFpContext, FPREG_SET *pFpRegSet); +extern void fppArchSwitchHook (WIND_TCB * pOldTcb, WIND_TCB * pNewTcb); +extern STATUS fppArchSwitchHookEnable (BOOL enable); + +#else + +extern void fppArchInit (); +extern void fppArchTaskCreateInit (); +extern STATUS fppProbeSup (); +extern void fppProbeTrap (); +extern void fppDtoDx (); +extern void fppDxtoD (); +extern void fppXrestore (); +extern void fppXsave (); +extern void fppXregsToCtx (); +extern void fppXctxToRegs (); +extern void fppArchSwitchHook (); +extern STATUS fppArchSwitchHookEnable (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfppI86Libh */ diff --git a/h/arch/i86/in_cksum.h b/h/arch/i86/in_cksum.h new file mode 100644 index 0000000..838cc06 --- /dev/null +++ b/h/arch/i86/in_cksum.h @@ -0,0 +1,176 @@ +/* in_cksum.h - x86 version in_cksum header file */ + +/* Copyright 2001-2002 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from tahoe: in_cksum.c 1.2 86/01/05 + * from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91 + * from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp + * $FreeBSD: src/sys/i386/include/in_cksum.h,v 1.7.2.1 2000/05/05 13:37:00 jlemon Exp $ + */ + +/* +modification history +-------------------- +01f,25aug05,dlk Add section tags. +01e,24mar04,m_h Internet Checksum +01d,18mar04,m_h moved to arch/i86 +01c,20nov03,niq Remove copyright_wrs.h file inclusion +01c,18nov03,rp updated header file path +01b,25jul02,rvr removed DCC specific code +01a,13sep01,hsh Created from BSD 4.3 +*/ + + +#ifndef _MACHINE_IN_CKSUM_H_ +#define _MACHINE_IN_CKSUM_H_ 1 + +#include + +/* + * in_cksum_hdr - checksum on header only + * + * It is useful to have an Internet checksum routine which is inlineable + * and optimized specifically for the task of computing IP header checksums + * in the normal case (where there are no options and the header length is + * therefore always exactly five 32-bit words. + */ + +static __inline u_int +in_cksum_hdr + ( + const struct ip *ip + ) + { + register u_int sum = 0; + int hlen = sizeof (struct ip); + register u_short *w = (u_short *) ip; + u_short remaining = 0; + + while (hlen > 1) + { + sum += *w++; + hlen -= 2; + } + + if (hlen == 1) + { + *(u_char *) (&remaining) = *(u_char *) w; + sum += remaining; + } + + sum = (sum & 0xffff) + (sum >> 16); + if (sum > 0xffff) + sum -= 0xffff; + + return ~sum & 0xffff; + } + +/* + * in_cksum_update + */ + +static __inline void +in_cksum_update + ( + struct ip *ip + ) + { + int __tmpsum; + __tmpsum = (int)ntohs(ip->ip_sum) + 256; + ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); + } + +/* + * in_pseudo - pre-checksum parts of pseudo-header + * + * Compute significant parts of the IPv4 checksum pseudo-header * for use in a + * delayed TCP/UDP checksum calculation. + * + * Args: + * + * src Source IP address + * dst Destination IP address + * lenproto htons(proto-hdr-len + proto-number) + */ + +static __inline u_int16_t in_pseudo + ( + u_int32_t src, + u_int32_t dst, + u_int32_t lenproto + ) + { + u_int32_t sum; + + sum = lenproto + + (u_int16_t)(src >> 16) + + (u_int16_t)(src /*& 0xffff*/) + + (u_int16_t)(dst >> 16) + + (u_int16_t)(dst /*& 0xffff*/); + + sum = (u_int16_t)(sum >> 16) + (u_int16_t)(sum /*& 0xffff*/); + + if (sum > 0xffff) + sum -= 0xffff; + + return (sum); + } + +/* + * in_addword - Add two 16-bit workd + * + * Add the two 16-bit network-order values, carry, and return. + */ + +static __inline u_int16_t in_addword + ( + u_int16_t a, + u_int16_t b + ) + { + u_int32_t sum = a + b; + + if (sum > 0xffff) + sum -= 0xffff; + + return (sum); + } + +_WRS_FASTTEXT +u_short in_cksum_skip(struct mbuf *m, int len, int skip); + +#endif /* _MACHINE_IN_CKSUM_H_ */ + + diff --git a/h/arch/i86/instrI86.h b/h/arch/i86/instrI86.h new file mode 100644 index 0000000..8a264af --- /dev/null +++ b/h/arch/i86/instrI86.h @@ -0,0 +1,86 @@ +/* instrI86.h - header for I86 instruction fields */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,26apr04,jmp created from target/h/dbgI86Lib.h +*/ + +/* + * WARNING: This file is shared between i86 and VxSim/i86 arches, + * and between Kernel and User sides. + * Please make sure that any modifications to this file + * does not break other arches. + */ + +#ifndef __INCinstrI86h +#define __INCinstrI86h + +/* defines */ + +#define ADDI08_0 (0x83) +#define ADDI08_1 (0xc4) +#define ADDI32_0 (0x81) +#define ADDI32_1 (0xc4) +#define LEAD08_0 (0x8d) +#define LEAD08_1 (0x64) +#define LEAD08_2 (0x24) +#define LEAD32_0 (0x8d) +#define LEAD32_1 (0xa4) +#define LEAD32_2 (0x24) +#define JMPD08 (0xeb) +#define JMPD32 (0xe9) +#define ENTER (0xc8) +#define PUSH_EBX (0x53) +#define PUSH_EBP (0x55) +#define PUSH_ESI (0x56) +#define MOV_ESP0 (0x89) +#define MOV_ESP1 (0xe5) +#define MOV_ESP_ESI (0xe689) +#define LEAVE (0xc9) +#define RET (0xc3) +#define RETADD (0xc2) +#define CALL_DIR (0xe8) +#define CALL_INDIR0 (0xff) +#define CALL_INDIR1 (0x10) +#define CALL_INDIR_REG_EAX (0xd0) +#define CALL_INDIR_REG_ECX (0xd1) +#define CALL_INDIR_REG_EDX (0xd2) +#define CALL_INDIR_REG_EBX (0xd3) +#define MOV_ECX (0x0d8b) +#define MOV_EDX (0x158b) +#define MOV_EBP_ESP (0xe589) + +#define ADDI08_0_MASK (0xff) +#define ADDI08_1_MASK (0xff) +#define ADDI32_0_MASK (0xff) +#define ADDI32_1_MASK (0xff) +#define LEAD08_0_MASK (0xff) +#define LEAD08_1_MASK (0xff) +#define LEAD08_2_MASK (0xff) +#define LEAD32_0_MASK (0xff) +#define LEAD32_1_MASK (0xff) +#define LEAD32_2_MASK (0xff) +#define JMPD08_MASK (0xff) +#define JMPD32_MASK (0xff) +#define ENTER_MASK (0xff) +#define PUSH_EBX_MASK (0xff) +#define PUSH_EBP_MASK (0xff) +#define PUSH_ESI_MASK (0xff) +#define MOV_ESP0_MASK (0xff) +#define MOV_ESP1_MASK (0xff) +#define MOV_ESP_ESI_MASK (0xffff) +#define LEAVE_MASK (0xff) +#define RET_MASK (0xff) +#define RETADD_MASK (0xff) +#define CALL_DIR_MASK (0xff) +#define CALL_INDIR0_MASK (0xff) +#define CALL_INDIR1_MASK (0x38) +#define CALL_INDIR_REG_MASK (0xdf) +#define MOV_ECX_MASK (0xffff) +#define MOV_EDX_MASK (0xffff) +#define MOV_EBP_ESP_MASK (0xffff) + +#endif /* __INCinstrI86h */ diff --git a/h/arch/i86/intI86Lib.h b/h/arch/i86/intI86Lib.h new file mode 100644 index 0000000..5d023ac --- /dev/null +++ b/h/arch/i86/intI86Lib.h @@ -0,0 +1,90 @@ +/* intI86Lib.h - I86-specific interrupt library header file */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,12oct04,jb Add interrupt lockout for automatic stack switch +01d,04dec03,jb Removing info message +01c,22aug03,to added inline intLock()/intUnlock(). + deleted K&R style prototypes. +01b,09nov01,hdn added intConnectCode offset macros +01a,29aug01,hdn taken from T31 ver 01b. +*/ + +#ifndef __INCintI86Libh +#define __INCintI86Libh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* offset macro for stuff in the intConnect code */ + +#define ICC_INT_BASE 1 +#define ICC_INT_ENT ICC_INT_BASE + 1 /* intConnectCode[1] */ +#define ICC_BOI_PUSH ICC_INT_ENT + 7 /* intConnectCode[8] */ +#define ICC_BOI_PARAM ICC_BOI_PUSH + 1 /* intConnectCode[9] */ +#define ICC_BOI_ROUTN ICC_BOI_PARAM + 5 /* intConnectCode[14] */ +#define ICC_INT_PARAM ICC_BOI_ROUTN + 5 /* intConnectCode[19] */ +#define ICC_INT_ROUTN ICC_INT_PARAM + 5 /* intConnectCode[24] */ +#define ICC_EOI_PARAM ICC_INT_ROUTN + 5 /* intConnectCode[29] */ +#define ICC_EOI_CALL ICC_EOI_PARAM + 4 /* intConnectCode[33] */ +#define ICC_EOI_ROUTN ICC_EOI_CALL + 1 /* intConnectCode[34] */ +#define ICC_ADD_N ICC_EOI_ROUTN + 6 /* intConnectCode[40] */ +#define ICC_INT_EXIT ICC_ADD_N + 5 /* intConnectCode[45] */ + + +/* inline intLock()/intUnlock() */ + +#if defined (__DCC__) +#undef _WRS_HAS_IL_INT_LOCK +#if 0 +#info "WARNING!! inline intLock() is not implemented for DCC!!" +#endif +#elif defined (__GNUC__) +#define _WRS_HAS_IL_INT_LOCK + +/* + * magic numbers used in inline asm: + * #define EFLAGS_IF 0x200 (from h/arch/i86/regsI86.h) + */ + +static __inline__ int __inlineIntLock (void) + { + int key; + __asm__ volatile ( + "pushf; popl %0; andl $0x200,%0; cli" + : "=g" (key) : /* no input */ ); + return key; + } + +static __inline__ void __inlineIntUnlock (int key) + { + __asm__ volatile ( + "testl $0x200,%0; jz 0f; sti;0:" + : /* no output */ : "g" (key) ); + } +#else +#undef _WRS_HAS_IL_INT_LOCK +#endif /* __DCC__ */ + + +/* function declarations */ + +extern FUNCPTR intHandlerCreateI86 (FUNCPTR routine, int parameter, + FUNCPTR routineBoi, int parameterBoi, + FUNCPTR routineEoi, int parameterEoi); +extern void intVecSet2 (FUNCPTR * vector, FUNCPTR function, + int idtGate, int idtSelector); +extern void intVecGet2 (FUNCPTR * vector, FUNCPTR * pFunction, + int * pIdtGate, int * pIdtSelector); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCintI86Libh */ diff --git a/h/arch/i86/ipiI86Lib.h b/h/arch/i86/ipiI86Lib.h new file mode 100644 index 0000000..94d1b98 --- /dev/null +++ b/h/arch/i86/ipiI86Lib.h @@ -0,0 +1,71 @@ +/* ipiI86Lib.h - I80X86 IPI library header */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,28feb02,hdn took IPI_MAX_XXX macros from ipiArchLib.c +01b,27feb02,hdn renamed ipiStubShutdown() to ipiShutdownSup() +01a,20feb02,hdn written +*/ + +#ifndef __INCipiI86Libh +#define __INCipiI86Libh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* defines */ + +#define IPI_MAX_HANDLERS 8 /* max number of handlers */ +#define IPI_MAX_RETRIES 3 /* max number of retries */ + + +#ifndef _ASMLANGUAGE + +/* variable declarations */ + +IMPORT char ipiCallTbl []; /* table of IPI stub calls */ + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void ipiVecInit (UINT32 intNum); +extern void ipiHandler (UINT32 index); +extern STATUS ipiConnect (UINT32 intNum, VOIDFUNCPTR routine); +extern STATUS ipiStartup (UINT32 apicId, UINT32 vector, UINT32 nTimes); +extern STATUS ipiShutdown (UINT32 apicId, UINT32 vector); +extern void ipiStub (void); +extern void ipiShutdownSup (void); +extern void ipiHandlerTlbFlush (void); +extern void ipiHandlerTscReset (void); +extern void ipiHandlerShutdown (void); + +#else /* __STDC__ */ + +extern void ipiVecInit (); +extern void ipiHandler (); +extern STATUS ipiConnect (); +extern STATUS ipiStartup (); +extern STATUS ipiShutdown (); +extern void ipiStub (); +extern void ipiShutdownSup (); +extern void ipiHandlerTlbFlush (); +extern void ipiHandlerTscReset (); +extern void ipiHandlerShutdown (); + +#endif /* __STDC__ */ + + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCipiI86Libh */ diff --git a/h/arch/i86/ivI86.h b/h/arch/i86/ivI86.h new file mode 100644 index 0000000..eb16a61 --- /dev/null +++ b/h/arch/i86/ivI86.h @@ -0,0 +1,88 @@ +/* ivI86.h - I80x86 interrupt vectors */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,29aug01,hdn added support for streaming SIMD exception. +01d,29may94,hdn removed I80486 conditional. +01c,08jun93,hdn added support for c++. updated to 5.1. +01b,26mar93,hdn added a new vector for 486. +01a,28feb92,hdn written based on TRON, 68k version. +*/ + +#ifndef __INCivI86h +#define __INCivI86h + +#ifdef __cplusplus +extern "C" { +#endif + + +/* 0 - 19 exception vector number */ + +#define IN_DIVIDE_ERROR 0 +#define IN_DEBUG 1 +#define IN_NON_MASKABLE 2 +#define IN_BREAKPOINT 3 +#define IN_OVERFLOW 4 +#define IN_BOUND 5 +#define IN_INVALID_OPCODE 6 +#define IN_NO_DEVICE 7 +#define IN_DOUBLE_FAULT 8 +#define IN_CP_OVERRUN 9 +#define IN_INVALID_TSS 10 +#define IN_NO_SEGMENT 11 +#define IN_STACK_FAULT 12 +#define IN_PROTECTION_FAULT 13 +#define IN_PAGE_FAULT 14 +#define IN_RESERVED 15 +#define IN_CP_ERROR 16 +#define IN_ALIGNMENT 17 +#define IN_MACHINE_CHECK 18 +#define IN_SIMD 19 + +/* 20 - 31 unassigned, Intel reserved exceptions */ + +/* 32 - 255 user defined interrupt vectors */ + + +#ifndef _ASMLANGUAGE + +/* macros to convert interrupt vectors <-> interrupt numbers */ + +#define IVEC_TO_INUM(intVec) ((int) (intVec) >> 3) +#define INUM_TO_IVEC(intNum) ((VOIDFUNCPTR *) ((intNum) << 3)) + +/* exception vector address/offset */ + +#define IV_DIVIDE_ERROR INUM_TO_IVEC (IN_DIVIDE_ERROR) +#define IV_DEBUG INUM_TO_IVEC (IN_DEBUG) +#define IV_NON_MASKABLE INUM_TO_IVEC (IN_NON_MASKABLE) +#define IV_BREAKPOINT INUM_TO_IVEC (IN_BREAKPOINT) +#define IV_OVERFLOW INUM_TO_IVEC (IN_OVERFLOW) +#define IV_BOUND INUM_TO_IVEC (IN_BOUND) +#define IV_INVALID_OPCODE INUM_TO_IVEC (IN_INVALID_OPCODE) +#define IV_NO_DEVICE INUM_TO_IVEC (IN_NO_DEVICE) +#define IV_DOUBLE_FAULT INUM_TO_IVEC (IN_DOUBLE_FAULT) +#define IV_CP_OVERRUN INUM_TO_IVEC (IN_CP_OVERRUN) +#define IV_INVALID_TSS INUM_TO_IVEC (IN_INVALID_TSS) +#define IV_NO_SEGMENT INUM_TO_IVEC (IN_NO_SEGMENT) +#define IV_STACK_FAULT INUM_TO_IVEC (IN_STACK_FAULT) +#define IV_PROTECTION_FAULT INUM_TO_IVEC (IN_PROTECTION_FAULT) +#define IV_PAGE_FAULT INUM_TO_IVEC (IN_PAGE_FAULT) +#define IV_RESERVED INUM_TO_IVEC (IN_RESERVED) +#define IV_CP_ERROR INUM_TO_IVEC (IN_CP_ERROR) +#define IV_ALIGNMENT INUM_TO_IVEC (IN_ALIGNMENT) +#define IV_MACHINE_CHECK INUM_TO_IVEC (IN_MACHINE_CHECK) +#define IV_SIMD INUM_TO_IVEC (IN_SIMD) + +#endif /* _ASMLANGUAGE */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCivI86h */ diff --git a/h/arch/i86/mmuI86Lib.h b/h/arch/i86/mmuI86Lib.h new file mode 100644 index 0000000..c4a8153 --- /dev/null +++ b/h/arch/i86/mmuI86Lib.h @@ -0,0 +1,149 @@ +/* mmuI86Lib.h - mmuI86Lib header for i86. */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,24jun04,zmm Ported from mmuPro32Lib.h version 01f to P5 MMU. +01f,12jun02,hdn added arch specific VM library APIs' prototype +01e,22aug01,hdn moved GDT and GDT_ENTRIES to regsI86.h +01d,13may98,hdn added PAGE_SIZE_XXX and _ASMLANGUAGE macros. +01c,07jan95,hdn added GDT and GDT_ENTRIES. +01b,01nov94,hdn added MMU_STATE_CACHEABLE_WT for Pentium. +01a,26jul93,hdn written based on mc68k's version. +*/ + +#ifndef __INCmmuI86Libh +#define __INCmmuI86Libh + +#ifdef __cplusplus +extern "C" { +#endif + + +#define PAGE_SIZE 0x1000 +#define PAGE_BLOCK_SIZE 0x400000 +#define PAGE_SIZE_4KB 0x1000 +#define PAGE_SIZE_4MB 0x400000 +#define N_PTES 1024 +#define N_PDES 1024 + +#define DIRECTORY_BITS 0xffc00000 +#define TABLE_BITS 0x003ff000 +#define OFFSET_BITS_4KB 0x00000fff +#define DIRECTORY_INDEX 22 +#define TABLE_INDEX 12 +#define PTE_TO_ADDR_4KB 0xfffff000 +#define PTE_INVALID PTE_TO_ADDR_4KB +#define PDE_INVALID PTE_INVALID + +#define ADDR_TO_PAGE 12 +#define ADDR_TO_PAGEBASE 0xffc00000 + +#ifndef _ASMLANGUAGE + +typedef struct + { + unsigned present:1; + unsigned rw:1; + unsigned us:1; + unsigned pwt:1; + unsigned pcd:1; + unsigned access:1; + unsigned dirty:1; + unsigned zero:2; + unsigned avail:3; + unsigned page:20; + } PTE_FIELD; + +typedef union pte + { + PTE_FIELD field; + unsigned int bits; + } PTE; + +typedef struct mmuTransTblStruct + { + PTE *pDirectoryTable; + INT32 pageSize; /* Fixed size 4K or 4M if !mixed */ + BOOL mixed; /* TRUE if mixed size pages */ + } MMU_TRANS_TBL; + +#define MMU_STATE_MASK_VALID 0x001 +#define MMU_STATE_MASK_WRITABLE 0x002 +#define MMU_STATE_MASK_USER 0x004 +#define MMU_STATE_MASK_PROTECTION 0x006 + +#define MMU_STATE_MASK_WRITETHROUGH 0x008 +#define MMU_STATE_MASK_WBACK 0x008 +#define MMU_STATE_MASK_CACHEABLE 0x018 /* 0x018 was 0x10 in AE version */ + +#define MMU_STATE_MASK_GLOBAL 0x100 +#define MMU_STATE_MASK_STATE 0x11f + +#define MMU_STATE_VALID 0x001 +#define MMU_STATE_VALID_NOT 0x000 +#define MMU_STATE_WRITABLE 0x002 +#define MMU_STATE_WRITABLE_NOT 0x000 +#define MMU_STATE_USER 0x004 +#define MMU_STATE_USER_NOT 0x000 +#define MMU_STATE_WRITETHROUGH 0x008 +#define MMU_STATE_WBACK 0x000 + +#define MMU_STATE_COPYBACK 0x000 +#define MMU_STATE_CACHEABLE_NOT 0x018 /* 0x18 was 0x10 in AE version */ +#define MMU_STATE_WBACK_NOT MMU_STATE_CACHEABLE_NOT + +#define MMU_STATE_CACHEABLE 0x000 +#define MMU_STATE_GLOBAL 0x100 +#define MMU_STATE_GLOBAL_NOT 0x000 + + +#define MMU_STATE_SUP_RO (MMU_STATE_USER_NOT | MMU_STATE_WRITABLE_NOT) /* 0x0 */ +#define MMU_STATE_USR_RO (MMU_STATE_USER | MMU_STATE_WRITABLE_NOT) /* 0x4 */ +#define MMU_STATE_SUP_RW (MMU_STATE_USER_NOT | MMU_STATE_WRITABLE) /* 0x2 */ +#define MMU_STATE_USR_RW (MMU_STATE_USER | MMU_STATE_WRITABLE) /* 0x6 */ + +/* wpOff is used to temporarily override supervisor write-protection. + * When using wpOff, interrupts should + * be locked because this disables write-protection system wide! + * Before unlocking interrupts, be sure to do a wpOn(). + */ + +#define wpOff() vxCr0Set (vxCr0Get() & 0xfffeffff) +#define wpOn() vxCr0Set (vxCr0Get() | 0x00010000) + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS mmuI86LibInit (int pageSize); +extern STATUS mmuI86Enable (BOOL enable); +extern void mmuI86On (); +extern void mmuI86Off (); +extern void mmuI86TLBFlush (); +extern void mmuI86PdbrSet (MMU_TRANS_TBL *transTbl); +extern void mmuI86Show (MMU_TRANS_TBL *transTbl, void * vaddr); +extern MMU_TRANS_TBL *mmuI86PdbrGet (); + +#else /* __STDC__ */ + +extern STATUS mmuI86LibInit (); +extern STATUS mmuI86Enable (); +extern void mmuI86On (); +extern void mmuI86Off (); +extern void mmuI86TLBFlush (); +extern void mmuI86PdbrSet (); +extern void mmuI86Show (); +extern MMU_TRANS_TBL *mmuI86PdbrGet (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmmuI86Libh */ diff --git a/h/arch/i86/mmuPro32Lib.h b/h/arch/i86/mmuPro32Lib.h new file mode 100644 index 0000000..c2b6305 --- /dev/null +++ b/h/arch/i86/mmuPro32Lib.h @@ -0,0 +1,151 @@ +/* mmuPro32Lib.h - mmuPpro32Lib header for i86. */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,09dec03,zmm Ported to Base6 from AE version of mmuPro32Lib.h 01f,30nov99 +01e,12jun02,hdn added arch specific VM library APIs' prototype +01d,23may02,hdn replaced PAGE_SIZE with PD_SIZE and PT_SIZE +01c,22aug01,hdn moved GDT and GDT_ENTRIES to regsI86.h +01b,13may98,hdn added _ASMLANGUAGE macro. +01a,11apr97,hdn written. +*/ + +#ifndef __INCmmuPro32Libh +#define __INCmmuPro32Libh + +#ifdef __cplusplus +extern "C" { +#endif + + +#define PAGE_SIZE 0x1000 +#define PAGE_BLOCK_SIZE 0x400000 +#define PAGE_SIZE_4KB 0x1000 +#define PAGE_SIZE_4MB 0x400000 +#define N_PTES 1024 +#define N_PDES 1024 + +#define DIRECTORY_BITS 0xffc00000 +#define TABLE_BITS 0x003ff000 +#define OFFSET_BITS_4KB 0x00000fff +#define OFFSET_BITS_4MB 0x003fffff +#define DIRECTORY_INDEX 22 +#define TABLE_INDEX 12 +#define PTE_TO_ADDR_4KB 0xfffff000 +#define PTE_TO_ADDR_4MB 0xffc00000 +#define PTE_INVALID PTE_TO_ADDR_4KB +#define PDE_INVALID PTE_INVALID + +#define ADDR_TO_PAGE 12 +#define ADDR_TO_PAGEBASE 0xffc00000 + +#ifndef _ASMLANGUAGE + +typedef struct + { + unsigned present:1; + unsigned rw:1; + unsigned us:1; + unsigned pwt:1; + unsigned pcd:1; + unsigned access:1; + unsigned dirty:1; + unsigned pagesize:1; + unsigned global:1; + unsigned avail:3; + unsigned page:20; + } PTE_FIELD; + +typedef union pte + { + PTE_FIELD field; + unsigned int bits; + } PTE; + +typedef struct mmuTransTblStruct + { + PTE *pDirectoryTable; + INT32 pageSize; /* Fixed size 4K or 4M if !mixed */ + BOOL mixed; /* TRUE if mixed size pages */ + } MMU_TRANS_TBL; + +#define MMU_STATE_MASK_VALID 0x001 +#define MMU_STATE_MASK_WRITABLE 0x002 +#define MMU_STATE_MASK_USER 0x004 +#define MMU_STATE_MASK_PROTECTION 0x006 + +#define MMU_STATE_MASK_WRITETHROUGH 0x008 +#define MMU_STATE_MASK_WBACK 0x008 +#define MMU_STATE_MASK_CACHEABLE 0x018 /* 0x018 was 0x10 in AE version */ + +#define MMU_STATE_MASK_GLOBAL 0x100 +#define MMU_STATE_MASK_STATE 0x11f + +#define MMU_STATE_VALID 0x001 +#define MMU_STATE_VALID_NOT 0x000 +#define MMU_STATE_WRITABLE 0x002 +#define MMU_STATE_WRITABLE_NOT 0x000 +#define MMU_STATE_USER 0x004 +#define MMU_STATE_USER_NOT 0x000 +#define MMU_STATE_WRITETHROUGH 0x008 +#define MMU_STATE_WBACK 0x000 + +#define MMU_STATE_COPYBACK 0x000 +#define MMU_STATE_CACHEABLE_NOT 0x018 /* 0x18 was 0x10 in AE version */ +#define MMU_STATE_WBACK_NOT MMU_STATE_CACHEABLE_NOT + +#define MMU_STATE_CACHEABLE 0x000 +#define MMU_STATE_GLOBAL 0x100 +#define MMU_STATE_GLOBAL_NOT 0x000 + + +#define MMU_STATE_SUP_RO (MMU_STATE_USER_NOT | MMU_STATE_WRITABLE_NOT) /* 0x0 */ +#define MMU_STATE_USR_RO (MMU_STATE_USER | MMU_STATE_WRITABLE_NOT) /* 0x4 */ +#define MMU_STATE_SUP_RW (MMU_STATE_USER_NOT | MMU_STATE_WRITABLE) /* 0x2 */ +#define MMU_STATE_USR_RW (MMU_STATE_USER | MMU_STATE_WRITABLE) /* 0x6 */ + +/* wpOff is used to temporarily override supervisor write-protection. + * When using wpOff, interrupts should + * be locked because this disables write-protection system wide! + * Before unlocking interrupts, be sure to do a wpOn(). + */ + +#define wpOff() vxCr0Set (vxCr0Get() & 0xfffeffff) +#define wpOn() vxCr0Set (vxCr0Get() | 0x00010000) + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS mmuPro32LibInit (int pageSize); +extern STATUS mmuPro32Enable (BOOL enable); +extern void mmuPro32On (); +extern void mmuPro32Off (); +extern void mmuPro32TLBFlush (); +extern void mmuPro32PdbrSet (MMU_TRANS_TBL *transTbl); +extern void mmuPro32Show (MMU_TRANS_TBL *transTbl, void * vaddr); +extern MMU_TRANS_TBL *mmuPro32PdbrGet (); + +#else /* __STDC__ */ + +extern STATUS mmuPro32LibInit (); +extern STATUS mmuPro32Enable (); +extern void mmuPro32On (); +extern void mmuPro32Off (); +extern void mmuPro32TLBFlush (); +extern void mmuPro32PdbrSet (); +extern void mmuPro32Show (); +extern MMU_TRANS_TBL *mmuPro32PdbrGet (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmmuPro32Libh */ diff --git a/h/arch/i86/mmuPro36Lib.h b/h/arch/i86/mmuPro36Lib.h new file mode 100644 index 0000000..12a9f0c --- /dev/null +++ b/h/arch/i86/mmuPro36Lib.h @@ -0,0 +1,170 @@ +/* mmuPro36Lib.h - mmuPro36Lib header for i86. */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,07apr04,scm Ported to Base6 ... +01e,12jun02,hdn added arch specific VM library APIs' prototype +01d,06jun02,hdn replaced PAGE_SIZE with PD_SIZE and PT_SIZE +01c,22aug01,hdn moved GDT and GDT_ENTRIES to regsI86.h +01b,13may98,hdn added _ASMLANGUAGE macro. +01a,11apr97,hdn written. +*/ + +#ifndef __INCmmuPro36Libh +#define __INCmmuPro36Libh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "arch/i86/pentiumLib.h" + +#define PAGE_SIZE_4KB 0x1000 +#define PAGE_SIZE_2MB 0x200000 + +#define PAGE_BLOCK_SIZE 0x200000 + +#define N_PTPTRS 4 +#define N_PTES 512 +#define N_PDES 512 + +#define DIR_PTR_BITS 0xc0000000 +#define DIR_BITS 0x3fe00000 +#define TBL_BITS 0x001ff000 + +#define OFFSET_BITS_4KB 0x00000fff +#define OFFSET_BITS_2MB 0x001fffff + +#define DIR_PTR_BITS 0xc0000000 +#define DIR_BITS 0x3fe00000 +#define TBL_BITS 0x001ff000 + +#define DIR_PTR_INDEX 30 +#define DIR_INDEX 21 +#define TBL_INDEX 12 + +#define PTE_TO_ADDR_4KB 0xfffff000 +#define PTE_TO_ADDR_2MB 0xffe00000 +#define PDP_TO_ADDR 0xfffff000 + +#define PTE_INVALID PTE_TO_ADDR_4KB +#define PDE_INVALID PTE_INVALID + +#define ADDR_TO_PAGE 12 +#define ADDR_TO_PAGEBASE 0xffe00000 + +#ifndef _ASMLANGUAGE + +typedef struct + { + unsigned present:1; + unsigned rw:1; + unsigned us:1; + unsigned pwt:1; + unsigned pcd:1; + unsigned access:1; + unsigned dirty:1; + unsigned pagesize:1; + unsigned global:1; + unsigned avail:3; + unsigned page:20; + unsigned page36:4; + unsigned reserved:28; + } PTE_FIELD; + +typedef union pte + { + PTE_FIELD field; + UINT bits[2]; + } PTE; + +typedef struct mmuTransTblStruct + { + PTE * pDirectoryPtrTable; /* pointer to dir ptr tbl */ + INT32 pageSize; /* 4K, 2M */ + } MMU_TRANS_TBL; + +#define MMU_STATE_MASK_VALID 0x001 +#define MMU_STATE_MASK_WRITABLE 0x002 +#define MMU_STATE_MASK_USER 0x004 +#define MMU_STATE_MASK_PROTECTION 0x006 + +#define MMU_STATE_MASK_WRITETHROUGH 0x008 +#define MMU_STATE_MASK_WBACK 0x008 +#define MMU_STATE_MASK_CACHEABLE 0x018 /* 0x018 was 0x10 in AE version */ + +#define MMU_STATE_MASK_GLOBAL 0x100 +#define MMU_STATE_MASK_STATE 0x11f + +#define MMU_STATE_VALID 0x001 +#define MMU_STATE_VALID_NOT 0x000 +#define MMU_STATE_WRITABLE 0x002 +#define MMU_STATE_WRITABLE_NOT 0x000 +#define MMU_STATE_USER 0x004 +#define MMU_STATE_USER_NOT 0x000 +#define MMU_STATE_WRITETHROUGH 0x008 +#define MMU_STATE_WBACK 0x000 + +#define MMU_STATE_COPYBACK 0x000 +#define MMU_STATE_CACHEABLE_NOT 0x018 /* 0x18 was 0x10 in AE version */ +#define MMU_STATE_WBACK_NOT MMU_STATE_CACHEABLE_NOT + +#define MMU_STATE_CACHEABLE 0x000 +#define MMU_STATE_GLOBAL 0x100 +#define MMU_STATE_GLOBAL_NOT 0x000 + + +#define MMU_STATE_SUP_RO (MMU_STATE_USER_NOT | MMU_STATE_WRITABLE_NOT) /* 0x0 */ +#define MMU_STATE_USR_RO (MMU_STATE_USER | MMU_STATE_WRITABLE_NOT) /* 0x4 */ +#define MMU_STATE_SUP_RW (MMU_STATE_USER_NOT | MMU_STATE_WRITABLE) /* 0x2 */ +#define MMU_STATE_USR_RW (MMU_STATE_USER | MMU_STATE_WRITABLE) /* 0x6 */ + +/* wpOff is used to temporarily override supervisor write-protection. + * When using wpOff, interrupts should + * be locked because this disables write-protection system wide! + * Before unlocking interrupts, be sure to do a wpOn(). + */ + +#define wpOff() vxCr0Set (vxCr0Get() & 0xfffeffff) +#define wpOn() vxCr0Set (vxCr0Get() | 0x00010000) + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS mmuPro36LibInit (int pageSize); +extern STATUS mmuPro36Enable (BOOL enable); + +extern void mmuPro36On (); +extern void mmuPro36Off (); +extern void mmuPro36TLBFlush (); +extern void mmuPro36PdbrSet (MMU_TRANS_TBL *transTbl); +extern void mmuPro36Show (MMU_TRANS_TBL *transTbl, VIRT_ADDR vaddr); + +extern MMU_TRANS_TBL *mmuPro36PdbrGet (); + +#else /* __STDC__ */ + +extern STATUS mmuPro36LibInit (); +extern STATUS mmuPro36Enable (); + +extern void mmuPro36On (); +extern void mmuPro36Off (); +extern void mmuPro36TLBFlush (); +extern void mmuPro36PdbrSet (); +extern void mmuPro36Show (); + +extern MMU_TRANS_TBL *mmuPro36PdbrGet (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmmuPro36Libh */ diff --git a/h/arch/i86/pentiumLib.h b/h/arch/i86/pentiumLib.h new file mode 100644 index 0000000..a26359a --- /dev/null +++ b/h/arch/i86/pentiumLib.h @@ -0,0 +1,164 @@ +/* pentiumLib.h - system dependent routines header */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,15jun02,hdn added LL_UNION typedef for 36bit MMU support +01c,01nov01,hdn added PENTIUM_MSR, pentiumMsrInit/Show's prototype +01b,21aug01,hdn included regs.h for MTRR_ID. + added P5/P6 PMC routines. +01a,09jul97,hdn written +*/ + +#ifndef __INCpentiumLibh +#define __INCpentiumLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "regs.h" + + +/* typedefs */ + +typedef long long int LL_INT; +typedef union llUnion + { + long long int i64; /* 64bit integer */ + int i32[2]; /* 32bit integer * 2 */ + } LL_UNION; + +typedef struct pentiumMsr + { + INT32 addr; /* address of the MSR */ + INT8 * name; /* name of the MSR */ + } PENTIUM_MSR; + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern int pentiumCr4Get (void); +extern void pentiumCr4Set (int cr4); +extern STATUS pentiumPmcStart (int pmcEvtSel0, int pmcEvtSel1); +extern STATUS pentiumPmcStart0 (int pmcEvtSel0); +extern STATUS pentiumPmcStart1 (int pmcEvtSel1); +extern void pentiumPmcStop (void); +extern void pentiumPmcStop0 (void); +extern void pentiumPmcStop1 (void); +extern void pentiumPmcGet (long long int * pPmc0, + long long int * pPmc1); +extern void pentiumPmcGet0 (long long int * pPmc0); +extern void pentiumPmcGet1 (long long int * pPmc1); +extern void pentiumPmcReset (void); +extern void pentiumPmcReset0 (void); +extern void pentiumPmcReset1 (void); +extern STATUS pentiumP6PmcStart (int pmcEvtSel0, int pmcEvtSel1); +extern void pentiumP6PmcStop (void); +extern void pentiumP6PmcStop1 (void); +extern void pentiumP6PmcGet (long long int * pPmc0, + long long int * pPmc1); +extern void pentiumP6PmcGet0 (long long int * pPmc0); +extern void pentiumP6PmcGet1 (long long int * pPmc1); +extern void pentiumP6PmcReset (void); +extern void pentiumP6PmcReset0 (void); +extern void pentiumP6PmcReset1 (void); +extern STATUS pentiumP5PmcStart0 (int cesr); +extern STATUS pentiumP5PmcStart1 (int cesr); +extern void pentiumP5PmcStop0 (void); +extern void pentiumP5PmcStop1 (void); +extern void pentiumP5PmcGet (long long int * pPmc0, + long long int * pPmc1); +extern void pentiumP5PmcGet0 (long long int * pPmc0); +extern void pentiumP5PmcGet1 (long long int * pPmc1); +extern void pentiumP5PmcReset (void); +extern void pentiumP5PmcReset0 (void); +extern void pentiumP5PmcReset1 (void); +extern void pentiumTscGet64 (long long int * pTsc); +extern UINT32 pentiumTscGet32 (void); +extern void pentiumTscReset (void); +extern void pentiumMsrGet (int addr, long long int * pData); +extern void pentiumMsrSet (int addr, long long int * pData); +extern void pentiumTlbFlush (void); +extern void pentiumSerialize (void); +extern STATUS pentiumBts (char * pFlag); +extern STATUS pentiumBtc (char * pFlag); +extern void pentiumMtrrEnable (void); +extern void pentiumMtrrDisable (void); +extern STATUS pentiumMtrrGet (MTRR_ID pMtrr); +extern STATUS pentiumMtrrSet (MTRR_ID pMtrr); +extern void pentiumPmcShow (BOOL zap); +extern STATUS pentiumMsrInit (void); +extern void pentiumMsrShow (void); +extern void pentiumMcaEnable (BOOL enable); +extern void pentiumMcaShow (void); + +#else /* __STDC__ */ + +extern int pentiumCr4Get (); +extern void pentiumCr4Set (); +extern STATUS pentiumPmcStart (); +extern STATUS pentiumPmcStart0 (); +extern STATUS pentiumPmcStart1 (); +extern void pentiumPmcStop (); +extern void pentiumPmcStop0 (); +extern void pentiumPmcStop1 (); +extern void pentiumPmcGet (); +extern void pentiumPmcGet0 (); +extern void pentiumPmcGet1 (); +extern void pentiumPmcReset (); +extern void pentiumPmcReset0 (); +extern void pentiumPmcReset1 (); +extern STATUS pentiumP6PmcStart (); +extern void pentiumP6PmcStop (); +extern void pentiumP6PmcStop1 (); +extern void pentiumP6PmcGet (); +extern void pentiumP6PmcGet0 (); +extern void pentiumP6PmcGet1 (); +extern void pentiumP6PmcReset (); +extern void pentiumP6PmcReset0 (); +extern void pentiumP6PmcReset1 (); +extern STATUS pentiumP5PmcStart0 (); +extern STATUS pentiumP5PmcStart1 (); +extern void pentiumP5PmcStop0 (); +extern void pentiumP5PmcStop1 (); +extern void pentiumP5PmcGet (); +extern void pentiumP5PmcGet0 (); +extern void pentiumP5PmcGet0 (); +extern void pentiumP5PmcGet1 (); +extern void pentiumP5PmcReset (); +extern void pentiumP5PmcReset0 (); +extern void pentiumTscGet64 (); +extern UINT32 pentiumTscGet32 (); +extern void pentiumTscReset (); +extern void pentiumMsrGet (); +extern void pentiumMsrSet (); +extern void pentiumTlbFlush (); +extern void pentiumSerialize (); +extern STATUS pentiumBts (); +extern STATUS pentiumBtc (); +extern void pentiumMtrrEnable (); +extern void pentiumMtrrDisable (); +extern STATUS pentiumMtrrGet (); +extern STATUS pentiumMtrrSet (); +extern void pentiumPmcShow (); +extern STATUS pentiumMsrInit (); +extern void pentiumMsrShow (); +extern void pentiumMcaEnable (); +extern void pentiumMcaShow (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpentiumLibh */ diff --git a/h/arch/i86/perMonLib.h b/h/arch/i86/perMonLib.h new file mode 100644 index 0000000..f3f9dbe --- /dev/null +++ b/h/arch/i86/perMonLib.h @@ -0,0 +1,266 @@ +/* perMonLib.h - Performance Monitoring mechanism definitions header file */ + +/* Copyright 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,30jul01,hdn written +*/ + +#ifndef __INCperMonLibh +#define __INCperMonLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* performance monitoring, number of counters, etc */ + +#define PM_N_COUNTER 18 +#define EVENT_N_ESCR 2 +#define EVENT_N_COUNTER 3 +#define MSR_N_ESCR 8 + +/* performance monitoring event name/no */ + +#define PM_BRANCH_RETIRED 0 +#define PM_MISPRED_BRANCH_RETIRED 1 +#define PM_TC_DELIVER_MODE 2 +#define PM_BPU_FETCH_REQUEST 3 +#define PM_ITLB_REFERENCE 4 +#define PM_MEMORY_CANCEL 5 +#define PM_MEMORY_COMPLETE 6 +#define PM_LOAD_PORT_REPLAY 7 +#define PM_STORE_PORT_REPLAY 8 +#define PM_MOB_LOAD_REPLAY 9 +#define PM_PAGE_WALK_TYPE 10 +#define PM_BSQ_2NDL_CACHE_REF 11 +#define PM_IOQ_ALLOCATION 12 +#define PM_FSB_DATA_ACTIVITY 13 +#define PM_BSQ_ALLOCATION 14 +#define PM_X87_ASSIST 15 +#define PM_SSE_INPUT_ASSIST 16 +#define PM_PACKED_SP_UOP 17 +#define PM_PACKED_DP_UOP 18 +#define PM_SCALAR_SP_UOP 19 +#define PM_SCALAR_DP_UOP 20 +#define PM_64BIT_MMX_UOP 21 +#define PM_128BIT_MMX_UOP 22 +#define PM_X87_FP_UOP 23 +#define PM_X87_SIMD_MOVES_UOP 24 +#define PM_MACHINE_CLEAR 25 +#define PM_FRONT_END_EVENT 26 +#define PM_EXECUTION_EVENT 27 +#define PM_REPLAY_EVENT 28 +#define PM_INSTR_RETIRED 29 +#define PM_UOPS_RETIRED 30 + +/* metrics available for Front_end Tagging */ + +#define FRONT_MEMORY_LOADS 0 +#define FRONT_MEMORY_STORES 1 + +/* metrics available for Execution Tagging */ + +#define EXEC_PACKED_SP_RETIRED 0 +#define EXEC_PACKED_DP_RETIRED 1 +#define EXEC_SCALAR_SP_RETIRED 2 +#define EXEC_SCALAR_DP_RETIRED 3 +#define EXEC_128BIT_MMX_RETIRED 4 +#define EXEC_64BIT_MMX_RETIRED 5 +#define EXEC_X87_FP_RETIRED 6 +#define EXEC_X87_SIMD_MM_RETIRED 7 + +/* metrics available for Replay Tagging */ + +#define REPLAY_1CACHE_LOAD_MISS_RETIRED 0 +#define REPLAY_2CACHE_LOAD_MISS_RETIRED 1 +#define REPLAY_DTLB_LOAD_MISS_RETIRED 2 +#define REPLAY_DTLB_STORE_MISS_RETIRED 3 +#define REPLAY_DTLB_ALL_MISS_RETIRED 4 +#define REPLAY_MOB_LOAD_REPLAY_RETIRED 5 +#define REPLAY_SPLIT_LOAD_RETIRED 6 +#define REPLAY_SPLIT_STORE_RETIRED 7 + +/* event mask available for Replay Tagging */ + +#define PARTIAL_DATA 0x10 +#define UNALIGN_ADDR 0x20 +#define SPLIT_LD 0x02 +#define SPLIT_ST 0x02 + +/* CCCR bit definitions */ + +#define CCCR_ENABLE 0x00001000 +#define CCCR_ENABLE_NOT 0xffffefff +#define CCCR_ESCR_SELECT 0x0000e000 +#define CCCR_RSVD 0x00030000 +#define CCCR_COMPARE 0x00040000 +#define CCCR_COMPLIMENT 0x00080000 +#define CCCR_THRESHOLD 0x00f00000 +#define CCCR_EDGE 0x01000000 +#define CCCR_FORCE_OVF 0x02000000 +#define CCCR_OVF_PMI 0x04000000 +#define CCCR_CASCADE 0x40000000 +#define CCCR_OVF 0x80000000 + +/* ESCR bit definitions */ + +#define ESCR_USR 0x00000004 +#define ESCR_OS 0x00000008 +#define ESCR_TAG_ENABLE 0x00000010 +#define ESCR_TAG_VALUE 0x000001e0 +#define ESCR_EVENT_MASK 0x01fffe00 +#define ESCR_EVENT_SELECT 0x7e000000 + +/* Replay Event Mask definitions */ + +#define REPLAY_NBOGUS 0x00000001 +#define REPLAY_BOGUS 0x00000002 + +/* Execution Event Mask definitions */ + +#define EXEC_NBOGUS0 0x00000001 +#define EXEC_NBOGUS1 0x00000002 +#define EXEC_NBOGUS2 0x00000004 +#define EXEC_NBOGUS3 0x00000008 +#define EXEC_BOGUS0 0x00000010 +#define EXEC_BOGUS1 0x00000020 +#define EXEC_BOGUS2 0x00000040 +#define EXEC_BOGUS3 0x00000080 + + +#ifndef _ASMLANGUAGE + +typedef struct perMonMsr /* PM CCCR-ESCR table */ + { + short counter; + short cccr; + short escr[MSR_N_ESCR]; + } PER_MON_MSR; + +typedef struct perMonMsrUse /* PM MSRs selected and its value */ + { + BOOL used; + int escrMsr; + int counterValue; + int cccrValue; + int escrValue; + int pebsEnable; + int pebsMatrix; + } PER_MON_MSR_USE; + +typedef struct perMonEvent /* PM event table */ + { + char * name; + short escr[EVENT_N_ESCR]; + char counterNo[EVENT_N_ESCR][EVENT_N_COUNTER]; + int eventSelect; + int eventMask; + int cccrSelect; + BOOL pebs; + } PER_MON_EVENT; + +typedef struct perMonReplayTag /* Replay Tagging Metrics table */ + { + char * name; + int pebsEnable; + int pebsMatrix; + int upEvent; + int upEventMask; + int eventMask; + } PER_MON_REPLAY_TAG; + +typedef struct perMonExecTag /* Execution Tagging Metrics table */ + { + char * name; + int upEvent; + int upEventMask; + int upTagValue; + int eventMask; + } PER_MON_EXEC_TAG; + + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void perMonLibInit (void); +extern STATUS perMonInt (void); +extern int perMonCget32 (int counterNo); +extern long long int perMonCget40 (int counterNo); +extern void perMonCenable (int cccr); +extern void perMonCdisable (int cccr); + +extern void perMonIntEnable (void); +extern void perMonIntDisable (void); +extern int perMonCccrGet (int counterNo, PER_MON_MSR_USE * pMsrUse); +extern void perMonCccrSet (int counterNo, int value, + PER_MON_MSR_USE *pMsrUse); +extern int perMonEscrGet (int counterNo, PER_MON_MSR_USE *pMsrUse); +extern void perMonEscrSet (int counterNo, int value, + PER_MON_MSR_USE *pMsrUse); +extern void perMonOsSet (int counterNo, PER_MON_MSR_USE * pMsrUse); +extern void perMonUsrSet (int counterNo, PER_MON_MSR_USE * pMsrUse); +extern void perMonIntSet (int counterNo, PER_MON_MSR_USE * pMsrUse); +extern void perMonIntClear (int counterNo, PER_MON_MSR_USE * pMsrUse); +extern void perMonCset (int counterNo, long long int * pValue); +extern void perMonCstart (int counterNo); +extern void perMonCstop (int counterNo); +extern STATUS perMonEventSelect (int event, int escrMsr, int counterNo, + int eventMask, int * pCounterMsr, + int * pCccrMsr, int * pCccrValue, + int * pEscrValue); +extern STATUS perMonReplaySelect (int metric, int * pUpEvent, int * pUpEventM, + int * pPebsEnable, int * pPebsMatrix, + int * pEventMask); +extern STATUS perMonExecSelect (int metric, int * pUpEvent, int * pUpEventM, + int * pUpTagValue, int * pEventMask); +extern STATUS perMonEventSet (int event, int escrMsr, int counterNo, + int eventMask, int metric, int upEventNo, + int upEscrMsr, int upCounterNo, + PER_MON_MSR_USE * pMsrUse); +extern STATUS perMonMsrSet (PER_MON_MSR_USE * pMsrUse); + +#else /* __STDC__ */ + +extern void perMonLibInit (); +extern STATUS perMonInt (); +extern int perMonCget32 (); +extern long long int perMonCget40 (); +extern void perMonCenable (); +extern void perMonCdisable (); + +extern void perMonIntEnable (); +extern void perMonIntDisable (); +extern int perMonCccrGet (); +extern void perMonCccrSet (); +extern int perMonEscrGet (); +extern void perMonEscrSet (); +extern void perMonOsSet (); +extern void perMonUsrSet (); +extern void perMonIntSet (); +extern void perMonIntClear (); +extern void perMonCset (); +extern void perMonCstart (); +extern void perMonCstop (); +extern STATUS perMonEventSelect (); +extern STATUS perMonReplaySelect (); +extern STATUS perMonExecSelect (); +extern STATUS perMonEventSet (); +extern STATUS perMonMsrSet (); + +#endif /* __STDC__ */ + + +#endif /* _ASMLANGUAGE */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCperMonLibh */ diff --git a/h/arch/i86/regsI86.h b/h/arch/i86/regsI86.h new file mode 100644 index 0000000..1f34fbc --- /dev/null +++ b/h/arch/i86/regsI86.h @@ -0,0 +1,959 @@ +/* regsI86.h - I80x86 registers */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. +*/ + +/* +modification history +-------------------- +01q,11aug05,mmi update CTX_SET . +01p,10mar05,kk updated WIND_TCB_CTXSET since WIND_TCB has been updated +01o,21apr04,scm add TASKGATE typedef... +01n,09mar04,jb Rename PAD +01m,17dec03,jb Adding reference to PAD in TCB +01l,02aug03,pes Rename REG_PC macro as REG_SET_PC. +01k,26aug02,hdn added Thermal Monitor and Geyserville III support +01j,07mar02,hdn added Pentium4 HTT support (spr 73359) +01i,14aug01,hdn added Pentium2/3/4 support + removed CODE_SELECTOR (use sysCsSuper instead) + moved WIND_TCB_XXX offsets from taskLibP.h + added INT_LOCK/UNLOCK macro +01h,16apr98,hdn added support for Pentium, PentiumPro. +01g,30dec97,dbt added common names for registers +01f,21sep95,hdn added X86CPU_NS486. +01e,01nov94,hdn added X86CPU_386, X86CPU_486, X86CPU_PENTIUM. +01d,27oct94,hdn added CR0_CD_NOT and CR0_NW_NOT. +01c,08jun93,hdn added support for c++. updated to 5.1. +01b,26mar93,hdn added some defines for 486. +01a,28feb92,hdn written based on TRON, 68k version. +*/ + +#ifndef __INCregsI86h +#define __INCregsI86h + +#ifdef __cplusplus +extern "C" { +#endif + +#define IO_BMAP_SIZE 32 /* IO bitmap for port 0x000 - 0x3ff */ + +#ifndef _ASMLANGUAGE + +#define GREG_NUM 8 /* has 8 32-bit general registers */ + +typedef struct /* REG_SET - 80x86 register set */ + { + ULONG edi; /* general register */ + ULONG esi; /* general register */ + ULONG ebp; /* frame pointer register */ + ULONG esp; /* stack pointer register */ + ULONG ebx; /* general register */ + ULONG edx; /* general register */ + ULONG ecx; /* general register */ + ULONG eax; /* general register */ + ULONG eflags; /* status register (must be second to last) */ + INSTR *pc; /* program counter (must be last) */ + } REG_SET; + +typedef struct + { + ULONG cr3; + ULONG cs; + ULONG ds; + ULONG ssp; + } CTX_SET; + + +typedef struct cpuid /* CPUID - 80x86 cpuid version/feature */ + { + int highestValue; /* EAX=0: highest integer value */ + int vendorId[3]; /* EAX=0: vendor identification string */ + int signature; /* EAX=1: processor signature */ + int featuresEbx; /* EAX=1: feature flags EBX */ + int featuresEcx; /* EAX=1: feature flags ECX */ + int featuresEdx; /* EAX=1: feature flags EDX */ + int cacheEax; /* EAX=2: config parameters EAX */ + int cacheEbx; /* EAX=2: config parameters EBX */ + int cacheEcx; /* EAX=2: config parameters ECX */ + int cacheEdx; /* EAX=2: config parameters EDX */ + int serialNo64[2]; /* EAX=3: lower 64 of 96 bit serial no */ + int brandString[12]; /* EAX=0x8000000[234]: brand strings */ + } CPUID; + +typedef struct mtrr_fix /* MTRR - fixed range register */ + { + char type[8]; + } MTRR_FIX; + +typedef struct mtrr_var /* MTRR - variable range register */ + { + long long int base; + long long int mask; + } MTRR_VAR; + +typedef struct mtrr /* MTRR */ + { + int cap[2]; /* MTRR cap register */ + int deftype[2]; /* MTRR defType register */ + MTRR_FIX fix[11]; /* MTRR fixed range registers */ + MTRR_VAR var[8]; /* MTRR variable range registers */ + } MTRR; +typedef MTRR * MTRR_ID; + +typedef struct gdt /* GDT */ + { + unsigned short limit00; + unsigned short base00; + unsigned char base01; + unsigned char type; + unsigned char limit01; + unsigned char base02; + } GDT; + +typedef union Gdtptr + { + UINT8 cGdtr[6]; + UINT16 wGdtr[4]; + UINT32 lGdtr[2]; + } GDTPTR; + +typedef struct tss /* TSS - 80x86 Task State Segment */ + { + UINT16 link; /* link to previous task */ + UINT16 link_pad; + UINT32 esp0; /* privilege level 0 SP */ + UINT16 ss0; /* '' SS */ + UINT16 ss0_pad; + UINT32 esp1; /* privilege level 1 SP */ + UINT16 ss1; /* '' SS */ + UINT16 ss1_pad; + UINT32 esp2; /* privilege level 2 SP */ + UINT16 ss2; /* '' SS */ + UINT16 ss2_pad; + UINT32 cr3; /* control register CR3 */ + INSTR * eip; /* program counter EIP */ + UINT32 eflags; /* status register EFLAGS */ + UINT32 eax; /* general register EAX */ + UINT32 ecx; /* general register ECX */ + UINT32 edx; /* general register EDX */ + UINT32 ebx; /* general register EBX */ + UINT32 esp; /* stack pointer register ESP */ + UINT32 ebp; /* frame pointer register EBP */ + UINT32 esi; /* general register ESI */ + UINT32 edi; /* general register EDI */ + UINT16 es; /* segment selector ES */ + UINT16 es_pad; + UINT16 cs; /* segment selector CS */ + UINT16 cs_pad; + UINT16 ss; /* segment selector SS */ + UINT16 ss_pad; + UINT16 ds; /* segment selector DS */ + UINT16 ds_pad; + UINT16 fs; /* segment selector FS */ + UINT16 fs_pad; + UINT16 gs; /* segment selector GS */ + UINT16 gs_pad; + UINT16 ldt; /* segment selector LDT */ + UINT16 ldt_pad; + UINT16 tflag; /* debug trap flag T */ + UINT16 iomapb; /* IO map base address */ + UINT32 iobmap[IO_BMAP_SIZE + 1]; + UINT32 reserved0; /* TSS selector */ + UINT32 reserved1; + UINT32 reserved2; + UINT32 reserved3; + UINT32 reserved4; + UINT32 reserved5; + UINT32 reserved6; + UINT32 reserved7; + } TSS; + +typedef struct segdesc /* segment descriptor */ + { + UINT16 limitLW; /* limit 15:00 */ + UINT16 baseLW; /* base address 15:00 */ + UCHAR baseMB; /* base address 23:16 */ + UCHAR type; /* P, DPL, S, Type */ + UCHAR limitUB; /* G, DB, 0, AVL, limit 23:16 */ + UCHAR baseUB; /* base address 31:24 */ + } SEGDESC; + +typedef struct taskGate /* task gate */ + { + UINT16 reserved1; /* reserved1 15:00 */ + UINT16 selector; /* TSS segment selector 31:16 */ + UCHAR reserved2; /* reserved2 07:00 */ + UCHAR type; /* P, DPL, S, Type 15:08 */ + UINT16 reserved3; /* reserved3 31:16 */ + } TASKGATE; + +typedef struct callGate /* call gate */ + { + UINT16 offsetLo; + UINT16 selector; + UCHAR params; + UCHAR type; + UINT16 offsetHi; + } CALL_GATE; + + +/* some common names for registers */ + +#define fpReg ebp /* frame pointer */ +#define spReg esp /* stack pointer */ +#define reg_pc pc /* program counter */ +#define reg_sp spReg /* stack pointer */ +#define reg_fp fpReg /* frame pointer */ + +#define G_REG_BASE 0x00 /* data reg's base offset to REG_SET */ +#define G_REG_OFFSET(n) (G_REG_BASE + (n)*sizeof(ULONG)) +#define SR_OFFSET G_REG_OFFSET(GREG_NUM) +#define PC_OFFSET (SR_OFFSET + sizeof(ULONG)) + +#endif /* _ASMLANGUAGE */ + +/* CPU FAMILY & FPU type */ + +#define X86CPU_386 0 /* CPU FAMILY: 80386 */ +#define X86CPU_486 1 /* CPU FAMILY: 80486 */ +#define X86CPU_PENTIUM 2 /* CPU FAMILY: Pentium/P5 */ +#define X86CPU_NS486 3 /* CPU FAMILY: NS486 */ +#define X86CPU_PENTIUMPRO 4 /* CPU FAMILY: Pentiumpro/P6 */ +#define X86CPU_PENTIUM4 5 /* CPU FAMILY: Pentium4/P7 */ +#define X86FPU_387 1 /* FPU: 80387 */ +#define X86FPU_487 2 /* FPU: 80487 */ + +/* offset to registers in REG_SET */ + +#define REG_EDI 0x00 +#define REG_ESI 0x04 +#define REG_EBP 0x08 +#define REG_ESP 0x0c +#define REG_EBX 0x10 +#define REG_EDX 0x14 +#define REG_ECX 0x18 +#define REG_EAX 0x1c +#define REG_EFLAGS 0x20 +#define REG_SET_PC 0x24 + +/* offset to pad in TCB */ +#define WIND_TCB_CTXSET WIND_TCB_REGS - 4 /* No accouting for padding */ + +#define CTX_SET_SIZE 16 /* sizeof(CTX_SET) */ + +/* offset to Context registers */ +#define WIND_TCB_CTX_CR3 0x0 +#define WIND_TCB_CTX_CS 0x4 +#define WIND_TCB_CTX_DS 0x8 +#define WIND_TCB_CTX_SSP 0xC + +/* offset to registers in REG_SET in TCB */ + +#define WIND_TCB_EDI WIND_TCB_REGS + REG_EDI +#define WIND_TCB_ESI WIND_TCB_REGS + REG_ESI +#define WIND_TCB_EBP WIND_TCB_REGS + REG_EBP +#define WIND_TCB_ESP WIND_TCB_REGS + REG_ESP +#define WIND_TCB_EBX WIND_TCB_REGS + REG_EBX +#define WIND_TCB_EDX WIND_TCB_REGS + REG_EDX +#define WIND_TCB_ECX WIND_TCB_REGS + REG_ECX +#define WIND_TCB_EAX WIND_TCB_REGS + REG_EAX +#define WIND_TCB_EFLAGS WIND_TCB_REGS + REG_EFLAGS +#define WIND_TCB_PC WIND_TCB_REGS + REG_SET_PC + +/* bits on EFLAGS */ + +#define EFLAGS_BRANDNEW 0x00000200 /* brand new EFLAGS */ +#define EFLAGS_N_MASK 0xffffbfff /* N(nested task flag) bit mask */ +#define EFLAGS_TF_MASK 0xfffffeff /* TF(trap flag) bit mask */ +#define EFLAGS_TF 0x00000100 /* TF(trap flag) bit */ +#define EFLAGS_IF 0x00000200 /* IF(interrupt enable flag) bit */ +#define EFLAGS_IOPL 0x00003000 /* IOPL(IO privilege level) bits */ +#define EFLAGS_NT 0x00004000 /* NT(nested task flag) bit */ +#define EFLAGS_RF 0x00010000 /* RF(resume flag) bit */ +#define EFLAGS_VM 0x00020000 /* VM(virtual 8086 mode) bit */ +#define EFLAGS_AC 0x00040000 /* AC(alignment check) bit */ +#define EFLAGS_VIF 0x00080000 /* VIF(virtual int flag) bit */ +#define EFLAGS_VIP 0x00100000 /* VIP(virtual int pending) bit */ +#define EFLAGS_ID 0x00200000 /* ID(identification flag) bit */ + +/* control and test registers */ + +#define CR0 1 +#define CR1 2 +#define CR2 3 +#define CR3 4 +#define TR3 5 +#define TR4 6 +#define TR5 7 +#define TR6 8 +#define TR7 9 + +/* bits on CR0 */ + +#define CR0_PE 0x00000001 /* protection enable */ +#define CR0_MP 0x00000002 /* math present */ +#define CR0_EM 0x00000004 /* emulation */ +#define CR0_TS 0x00000008 /* task switch */ +#define CR0_NE 0x00000020 /* numeric error */ +#define CR0_WP 0x00010000 /* write protect */ +#define CR0_AM 0x00040000 /* alignment mask */ +#define CR0_NW 0x20000000 /* not write through */ +#define CR0_CD 0x40000000 /* cache disable */ +#define CR0_PG 0x80000000 /* paging */ +#define CR0_NW_NOT 0xdfffffff /* write through */ +#define CR0_CD_NOT 0xbfffffff /* cache disable */ + +/* bits on CR4 */ + +#define CR4_VME 0x00000001 /* virtual-8086 mode extensions */ +#define CR4_PVI 0x00000002 /* protected-mode virtual interrupts */ +#define CR4_TSD 0x00000004 /* timestamp disable */ +#define CR4_DE 0x00000008 /* debugging extensions */ +#define CR4_PSE 0x00000010 /* page size extensions */ +#define CR4_PAE 0x00000020 /* physical address extension */ +#define CR4_MCE 0x00000040 /* machine check enable */ +#define CR4_PGE 0x00000080 /* page global enable */ +#define CR4_PCE 0x00000100 /* performance-monitoring enable */ +#define CR4_OSFXSR 0x00000200 /* use fxsave/fxrstor instructions */ +#define CR4_OSXMMEXCEPT 0x00000400 /* streaming SIMD exception */ + +/* CPUID: signature bit definitions */ + +#define CPUID_STEPID 0x0000000f /* processor stepping id mask */ +#define CPUID_MODEL 0x000000f0 /* processor model mask */ +#define CPUID_FAMILY 0x00000f00 /* processor family mask */ +#define CPUID_TYPE 0x00003000 /* processor type mask */ +#define CPUID_EXT_MODEL 0x000f0000 /* processor extended model mask */ +#define CPUID_EXT_FAMILY 0x0ff00000 /* processor extended family mask */ +#define CPUID_486 0x00000400 /* family: 486 */ +#define CPUID_PENTIUM 0x00000500 /* family: Pentium */ +#define CPUID_PENTIUMPRO 0x00000600 /* family: Pentium PRO */ +#define CPUID_EXTENDED 0x00000f00 /* family: Extended */ +#define CPUID_PENTIUM4 0x00000000 /* extended family: PENTIUM4 */ +#define CPUID_ORIG 0x00000000 /* type: original OEM */ +#define CPUID_OVERD 0x00001000 /* type: overdrive */ +#define CPUID_DUAL 0x00002000 /* type: dual */ +#define CPUID_CHUNKS 0x0000ff00 /* bytes flushed by CLFLUSH mask */ + +/* CPUID: feature bit definitions */ + +#define CPUID_FPU 0x00000001 /* FPU on chip */ +#define CPUID_VME 0x00000002 /* virtual 8086 mode enhancement */ +#define CPUID_DE 0x00000004 /* debugging extensions */ +#define CPUID_PSE 0x00000008 /* page size extension */ +#define CPUID_TSC 0x00000010 /* time stamp counter */ +#define CPUID_MSR 0x00000020 /* RDMSR and WRMSR support */ +#define CPUID_PAE 0x00000040 /* physical address extensions */ +#define CPUID_MCE 0x00000080 /* machine check exception */ +#define CPUID_CXS 0x00000100 /* CMPXCHG8 inst */ +#define CPUID_APIC 0x00000200 /* APIC on chip */ +#define CPUID_SEP 0x00000800 /* SEP, Fast System Call */ +#define CPUID_MTRR 0x00001000 /* MTRR */ +#define CPUID_PGE 0x00002000 /* PTE global bit */ +#define CPUID_MCA 0x00004000 /* machine check arch. */ +#define CPUID_CMOV 0x00008000 /* cond. move/cmp. inst */ +#define CPUID_PAT 0x00010000 /* page attribute table */ +#define CPUID_PSE36 0x00020000 /* 36 bit page size extension */ +#define CPUID_PSNUM 0x00040000 /* processor serial number */ +#define CPUID_CLFLUSH 0x00080000 /* CLFLUSH inst supported */ +#define CPUID_DTS 0x00200000 /* Debug Store */ +#define CPUID_ACPI 0x00400000 /* TM and SCC supported */ +#define CPUID_MMX 0x00800000 /* MMX technology supported */ +#define CPUID_FXSR 0x01000000 /* fast FP save and restore */ +#define CPUID_SSE 0x02000000 /* SSE supported */ +#define CPUID_SSE2 0x04000000 /* SSE2 supported */ +#define CPUID_SS 0x08000000 /* Self Snoop supported */ +#define CPUID_HTT 0x10000000 /* Hyper Threading Technology */ +#define CPUID_TM 0x20000000 /* Thermal Monitor supported */ + +/* CPUID: extended feature bit definitions */ + +#define CPUID_GV3 0x00000080 /* Geyserville 3 supported */ +#define CPUID_TM2 0x00000100 /* Thermal Monitor 2 supported */ + +/* CPUID: offset in CPUID structure */ + +#define CPUID_HIGHVALUE 0 /* offset to highestValue */ +#define CPUID_VENDORID 4 /* offset to vendorId */ +#define CPUID_SIGNATURE 16 /* offset to signature */ +#define CPUID_FEATURES_EBX 20 /* offset to featuresEbx */ +#define CPUID_FEATURES_ECX 24 /* offset to featuresEcx */ +#define CPUID_FEATURES_EDX 28 /* offset to featuresEdx */ +#define CPUID_CACHE_EAX 32 /* offset to cacheEax */ +#define CPUID_CACHE_EBX 36 /* offset to cacheEbx */ +#define CPUID_CACHE_ECX 40 /* offset to cacheEcx */ +#define CPUID_CACHE_EDX 44 /* offset to cacheEdx */ +#define CPUID_SERIALNO 48 /* offset to serialNo64 */ +#define CPUID_BRAND_STR 56 /* offset to brandString[0] */ + +/* MSR, Model Specific Registers */ + +/* MSR, P5 only */ + +#define MSR_P5_MC_ADDR 0x0000 +#define MSR_P5_MC_TYPE 0x0001 +#define MSR_TSC 0x0010 +#define MSR_CESR 0x0011 +#define MSR_CTR0 0x0012 +#define MSR_CTR1 0x0013 + +/* MSR, P5 and P6 */ + +#define MSR_APICBASE 0x001b +#define MSR_EBL_CR_POWERON 0x002a +#define MSR_TEST_CTL 0x0033 +#define MSR_BIOS_UPDT_TRIG 0x0079 +#define MSR_BBL_CR_D0 0x0088 /* P6 only */ +#define MSR_BBL_CR_D1 0x0089 /* P6 only */ +#define MSR_BBL_CR_D2 0x008a /* P6 only */ +#define MSR_BIOS_SIGN 0x008b +#define MSR_PERFCTR0 0x00c1 +#define MSR_PERFCTR1 0x00c2 +#define MSR_MTRR_CAP 0x00fe +#define MSR_BBL_CR_ADDR 0x0116 /* P6 only */ +#define MSR_BBL_CR_DECC 0x0118 /* P6 only */ +#define MSR_BBL_CR_CTL 0x0119 /* P6 only */ +#define MSR_BBL_CR_TRIG 0x011a /* P6 only */ +#define MSR_BBL_CR_BUSY 0x011b /* P6 only */ +#define MSR_BBL_CR_CTL3 0x011e /* P6 only */ +#define MSR_SYSENTER_CS 0x0174 /* P6 + SEP only */ +#define MSR_SYSENTER_ESP 0x0175 /* P6 + SEP only */ +#define MSR_SYSENTER_EIP 0x0176 /* P6 + SEP only */ +#define MSR_MCG_CAP 0x0179 +#define MSR_MCG_STATUS 0x017a +#define MSR_MCG_CTL 0x017b +#define MSR_EVNTSEL0 0x0186 +#define MSR_EVNTSEL1 0x0187 +#define MSR_DEBUGCTLMSR 0x01d9 +#define MSR_LASTBRANCH_FROMIP 0x01db +#define MSR_LASTBRANCH_TOIP 0x01dc +#define MSR_LASTINT_FROMIP 0x01dd +#define MSR_LASTINT_TOIP 0x01de +#define MSR_ROB_CR_BKUPTMPDR6 0x01e0 +#define MSR_MTRR_PHYS_BASE0 0x0200 +#define MSR_MTRR_PHYS_MASK0 0x0201 +#define MSR_MTRR_PHYS_BASE1 0x0202 +#define MSR_MTRR_PHYS_MASK1 0x0203 +#define MSR_MTRR_PHYS_BASE2 0x0204 +#define MSR_MTRR_PHYS_MASK2 0x0205 +#define MSR_MTRR_PHYS_BASE3 0x0206 +#define MSR_MTRR_PHYS_MASK3 0x0207 +#define MSR_MTRR_PHYS_BASE4 0x0208 +#define MSR_MTRR_PHYS_MASK4 0x0209 +#define MSR_MTRR_PHYS_BASE5 0x020a +#define MSR_MTRR_PHYS_MASK5 0x020b +#define MSR_MTRR_PHYS_BASE6 0x020c +#define MSR_MTRR_PHYS_MASK6 0x020d +#define MSR_MTRR_PHYS_BASE7 0x020e +#define MSR_MTRR_PHYS_MASK7 0x020f +#define MSR_MTRR_FIX_00000 0x0250 +#define MSR_MTRR_FIX_80000 0x0258 +#define MSR_MTRR_FIX_A0000 0x0259 +#define MSR_MTRR_FIX_C0000 0x0268 +#define MSR_MTRR_FIX_C8000 0x0269 +#define MSR_MTRR_FIX_D0000 0x026a +#define MSR_MTRR_FIX_D8000 0x026b +#define MSR_MTRR_FIX_E0000 0x026c +#define MSR_MTRR_FIX_E8000 0x026d +#define MSR_MTRR_FIX_F0000 0x026e +#define MSR_MTRR_FIX_F8000 0x026f +#define MSR_MTRR_DEFTYPE 0x02ff +#define MSR_MC0_CTL 0x0400 +#define MSR_MC0_STATUS 0x0401 +#define MSR_MC0_ADDR 0x0402 +#define MSR_MC0_MISC 0x0403 +#define MSR_MC1_CTL 0x0404 +#define MSR_MC1_STATUS 0x0405 +#define MSR_MC1_ADDR 0x0406 +#define MSR_MC1_MISC 0x0407 +#define MSR_MC2_CTL 0x0408 +#define MSR_MC2_STATUS 0x0409 +#define MSR_MC2_ADDR 0x040a +#define MSR_MC2_MISC 0x040b +#define MSR_MC4_CTL 0x040c +#define MSR_MC4_STATUS 0x040d +#define MSR_MC4_ADDR 0x040e +#define MSR_MC4_MISC 0x040f +#define MSR_MC3_CTL 0x0410 +#define MSR_MC3_STATUS 0x0411 +#define MSR_MC3_ADDR 0x0412 +#define MSR_MC3_MISC 0x0413 + +/* MSR, Architectural MSRs (common MSRs in IA32) */ + +#define IA32_P5_MC_ADDR MSR_P5_MC_ADDR /* P5 */ +#define IA32_P5_MC_TYPE MSR_P5_MC_TYPE /* P5 */ +#define IA32_TIME_STAMP_COUNTER MSR_TSC /* P5 */ +#define IA32_PLATFORM_ID 0x0017 /* P6 */ +#define IA32_APIC_BASE MSR_APICBASE /* P6 */ +#define IA32_BIOS_UPDT_TRIG MSR_BIOS_UPDT_TRIG /* P6 */ +#define IA32_BIOS_SIGN_ID MSR_BIOS_SIGN /* P6 */ +#define IA32_MTRRCAP MSR_MTRR_CAP /* P6 */ +#define IA32_MISC_CTL MSR_BBL_CR_CTL /* P6 */ +#define IA32_SYSENTER_CS MSR_SYSENTER_CS /* P6 */ +#define IA32_SYSENTER_ESP MSR_SYSENTER_ESP /* P6 */ +#define IA32_SYSENTER_EIP MSR_SYSENTER_EIP /* P6 */ +#define IA32_MCG_CAP MSR_MCG_CAP /* P6 */ +#define IA32_MCG_STATUS MSR_MCG_STATUS /* P6 */ +#define IA32_MCG_CTL MSR_MCG_CTL /* P6 */ +#define IA32_MCG_EAX 0x0180 /* Pentium4 */ +#define IA32_MCG_EBX 0x0181 /* Pentium4 */ +#define IA32_MCG_ECX 0x0182 /* Pentium4 */ +#define IA32_MCG_EDX 0x0183 /* Pentium4 */ +#define IA32_MCG_ESI 0x0184 /* Pentium4 */ +#define IA32_MCG_EDI 0x0185 /* Pentium4 */ +#define IA32_MCG_EBP 0x0186 /* Pentium4 */ +#define IA32_MCG_ESP 0x0187 /* Pentium4 */ +#define IA32_MCG_EFLAGS 0x0188 /* Pentium4 */ +#define IA32_MCG_EIP 0x0189 /* Pentium4 */ +#define IA32_MCG_MISC 0x018a /* Pentium4 */ +#define IA32_THERM_CONTROL 0x019a /* Pentium4 */ +#define IA32_THERM_INTERRUPT 0x019b /* Pentium4 */ +#define IA32_THERM_STATUS 0x019c /* Pentium4 */ +#define IA32_MISC_ENABLE 0x01a0 /* Pentium4 */ +#define IA32_DEBUGCTL MSR_DEBUGCTLMSR /* P6 */ +#define IA32_MTRR_PHYSBASE0 MSR_MTRR_PHYS_BASE0 /* P6 */ +#define IA32_MTRR_PHYSMASK0 MSR_MTRR_PHYS_MASK0 /* P6 */ +#define IA32_MTRR_PHYSBASE1 MSR_MTRR_PHYS_BASE1 /* P6 */ +#define IA32_MTRR_PHYSMASK1 MSR_MTRR_PHYS_MASK1 /* P6 */ +#define IA32_MTRR_PHYSBASE2 MSR_MTRR_PHYS_BASE2 /* P6 */ +#define IA32_MTRR_PHYSMASK2 MSR_MTRR_PHYS_MASK2 /* P6 */ +#define IA32_MTRR_PHYSBASE3 MSR_MTRR_PHYS_BASE3 /* P6 */ +#define IA32_MTRR_PHYSMASK3 MSR_MTRR_PHYS_MASK3 /* P6 */ +#define IA32_MTRR_PHYSBASE4 MSR_MTRR_PHYS_BASE4 /* P6 */ +#define IA32_MTRR_PHYSMASK4 MSR_MTRR_PHYS_MASK4 /* P6 */ +#define IA32_MTRR_PHYSBASE5 MSR_MTRR_PHYS_BASE5 /* P6 */ +#define IA32_MTRR_PHYSMASK5 MSR_MTRR_PHYS_MASK5 /* P6 */ +#define IA32_MTRR_PHYSBASE6 MSR_MTRR_PHYS_BASE6 /* P6 */ +#define IA32_MTRR_PHYSMASK6 MSR_MTRR_PHYS_MASK6 /* P6 */ +#define IA32_MTRR_PHYSBASE7 MSR_MTRR_PHYS_BASE7 /* P6 */ +#define IA32_MTRR_PHYSMASK7 MSR_MTRR_PHYS_MASK7 /* P6 */ +#define IA32_MTRR_FIX64K_00000 MSR_MTRR_FIX_00000 /* P6 */ +#define IA32_MTRR_FIX16K_80000 MSR_MTRR_FIX_80000 /* P6 */ +#define IA32_MTRR_FIX16K_A0000 MSR_MTRR_FIX_A0000 /* P6 */ +#define IA32_MTRR_FIX4K_C0000 MSR_MTRR_FIX_C0000 /* P6 */ +#define IA32_MTRR_FIX4K_C8000 MSR_MTRR_FIX_C8000 /* P6 */ +#define IA32_MTRR_FIX4K_D0000 MSR_MTRR_FIX_D0000 /* P6 */ +#define IA32_MTRR_FIX4K_D8000 MSR_MTRR_FIX_D8000 /* P6 */ +#define IA32_MTRR_FIX4K_E0000 MSR_MTRR_FIX_E0000 /* P6 */ +#define IA32_MTRR_FIX4K_E8000 MSR_MTRR_FIX_E8000 /* P6 */ +#define IA32_MTRR_FIX4K_F0000 MSR_MTRR_FIX_F0000 /* P6 */ +#define IA32_MTRR_FIX4K_F8000 MSR_MTRR_FIX_F8000 /* P6 */ +#define IA32_CR_PAT 0x0277 /* P6 */ +#define IA32_MTRR_DEF_TYPE MSR_MTRR_DEFTYPE /* P6 */ +#define IA32_PEBS_ENABLE 0x03f1 /* Pentium4 */ +#define IA32_MC0_CTL MSR_MC0_CTL /* P6 */ +#define IA32_MC0_STATUS MSR_MC0_STATUS /* P6 */ +#define IA32_MC0_ADDR MSR_MC0_ADDR /* P6 */ +#define IA32_MC0_MISC MSR_MC0_MISC /* P6 */ +#define IA32_MC1_CTL MSR_MC1_CTL /* P6 */ +#define IA32_MC1_STATUS MSR_MC1_STATUS /* P6 */ +#define IA32_MC1_ADDR MSR_MC1_ADDR /* P6 */ +#define IA32_MC1_MISC MSR_MC1_MISC /* P6 */ +#define IA32_MC2_CTL MSR_MC2_CTL /* P6 */ +#define IA32_MC2_STATUS MSR_MC2_STATUS /* P6 */ +#define IA32_MC2_ADDR MSR_MC2_ADDR /* P6 */ +#define IA32_MC2_MISC MSR_MC2_MISC /* P6 */ +#define IA32_MC3_CTL 0x040c /* P6, addr changed */ +#define IA32_MC3_STATUS 0x040d /* P6, addr changed */ +#define IA32_MC3_ADDR 0x040e /* P6, addr changed */ +#define IA32_MC3_MISC 0x040f /* P6, addr changed */ +#define IA32_DS_AREA 0x0600 /* Pentium4 */ + +/* MSR, IA32_DEBUGCTL, in Pentium4, bits */ + +#define DBG_P7_LBR 0x00000001 +#define DBG_P7_BTF 0x00000002 +#define DBG_P7_TR 0x00000004 +#define DBG_P7_BTS 0x00000008 +#define DBG_P7_BTINT 0x00000010 + +/* MSR, IA32_DEBUGCTL, in P6, bits */ + +#define DBG_P6_LBR 0x00000001 +#define DBG_P6_BTF 0x00000002 +#define DBG_P6_PB0 0x00000004 +#define DBG_P6_PB1 0x00000008 +#define DBG_P6_PB2 0x00000010 +#define DBG_P6_PB3 0x00000020 +#define DBG_P6_TR 0x00000040 + +/* MSR, MSR_LASTBRANCH_TOS, in Pentium4, bits */ + +#define TOS_MASK 0x00000003 + +/* MSR, IA32_MISC_ENABLE bits */ + +#define MSC_FAST_STRING_ENABLE 0x00000001 +#define MSC_FOPCODE_ENABLE 0x00000004 +#define MSC_THERMAL_MON_ENABLE 0x00000008 +#define MSC_SPLIT_LOCK_DISABLE 0x00000010 +#define MSC_PMON_AVAILABLE 0x00000080 +#define MSC_BTS_UNAVAILABLE 0x00000800 +#define MSC_PEBS_UNAVAILABLE 0x00001000 +#define MSC_GV1_EN 0x00008000 +#define MSC_GV3_EN 0x00010000 +#define MSC_GV_SEL_LOCK 0x00100000 + +/* MSR, IA32_PEBS_ENABLE bits */ + +#define PEBS_METRICS 0x00001fff +#define PEBS_UOP_TAG 0x01000000 +#define PEBS_ENABLE 0x02000000 + +/* MSR, IA32_PLATFORM_ID bits (upper 32) */ + +#define PFM_PLATFORM_ID 0x001c0000 +#define PFM_MOBILE_GV 0x00040000 + +/* MSR, IA32_PLATFORM_ID bits (lower 32) */ + +#define PFM_MAX_VID 0x0000003f +#define PFM_MAX_FREQ 0x00000f80 +#define PFM_RATIO_LOCKED 0x00008000 +#define PFM_GV3_TM_DISABLED 0x00010000 +#define PFM_GV3_DISABLED 0x00020000 +#define PFM_GV1_DISABLED 0x00040000 +#define PFM_TM_DISABLED 0x00080000 +#define PFM_L2_CACHE_SIZE 0x06000000 +#define PFM_SAMPLE 0x08000000 + +/* MSR, IA32_THERM_CONTROL bits */ + +#define THERM_DUTY_CYCLE 0x0000000e +#define THERM_TCC_EN 0x00000010 + +/* MSR, IA32_THERM_STATUS bits */ + +#define THERM_HOT_NOW 0x00000001 +#define THERM_HOT_LOG 0x00000002 + +/* MSR, IA32_THERM_INTERRUPT bits */ + +#define THERM_HOT_INT_EN 0x00000001 +#define THERM_COLD_INT_EN 0x00000002 + + +/* PMC, Performance Monitoring Event Select MSR bits */ + +/* P5 specific */ + +#define P5PMC_PC 0x00000200 +#define P5PMC_CC_DISABLE 0x00000000 +#define P5PMC_CC_EVT_CPL012 0x00000040 +#define P5PMC_CC_EVT_CPL3 0x00000080 +#define P5PMC_CC_EVT 0x000000C0 +#define P5PMC_CC_CLK_CPL012 0x00000140 +#define P5PMC_CC_CLK_CPL3 0x00000180 +#define P5PMC_CC_CLK 0x000001C0 + +/* P6 specific */ + +#define PMC_USR 0x00010000 +#define PMC_OS 0x00020000 +#define PMC_E 0x00040000 +#define PMC_PC 0x00080000 +#define PMC_INT 0x00100000 +#define PMC_EN 0x00400000 +#define PMC_INV 0x00800000 + +/* PMC, Performance Monitoring Events */ + +/* P5 PMC event list */ + +#define P5PMC_DATA_RD 0x00 +#define P5PMC_DATA_WR 0x01 +#define P5PMC_DATA_TBL_MISS 0x02 +#define P5PMC_DATA_RD_MISS 0x03 +#define P5PMC_DATA_WR_MISS 0x04 +#define P5PMC_WR_HIT_M_E_STATE_LINE 0x05 +#define P5PMC_DCACHE_WR_BACK 0x06 +#define P5PMC_EXT_SNOOPS 0x07 +#define P5PMC_EXT_DCACHE_SNOOPS_HIT 0x08 +#define P5PMC_MEM_ACCESS_BOTH_PIPES 0x09 +#define P5PMC_BANK_CONFLICT 0x0A +#define P5PMC_MISC_DMEM_IO_REF 0x0B +#define P5PMC_CODE_RD 0x0C +#define P5PMC_CODE_TBL_MISS 0x0D +#define P5PMC_CODE_CACHE_MISS 0x0E +#define P5PMC_SEGMENT_REG_LOAD 0x0F +#define P5PMC_BRANCH 0x12 +#define P5PMC_BTB_HIT 0x13 +#define P5PMC_TAKEN_BRANCH_BTB_HIT 0x14 +#define P5PMC_PIPELINE_FLUSH 0x15 +#define P5PMC_INST_EXECUTED 0x16 +#define P5PMC_INST_EXECUTED_VPIPE 0x17 +#define P5PMC_BUS_CYC_DURATION 0x18 +#define P5PMC_WR_BUF_FULL_STALL_DURATION 0x19 +#define P5PMC_WAIT_MEM_RD_STALL_DURATION 0x1A +#define P5PMC_STALL_ON_WR_M_E_STATE_LINE 0x1B +#define P5PMC_LOCKED_BUS_CYC 0x1C +#define P5PMC_IO_RD_WR_CYC 0x1D +#define P5PMC_NONCACHE_MEM_RD 0x1E +#define P5PMC_PIPELINE_AGI_STALL 0x1F +#define P5PMC_FLOPS 0x22 +#define P5PMC_BK_MATCH_DR0 0x23 +#define P5PMC_BK_MATCH_DR1 0x24 +#define P5PMC_BK_MATCH_DR2 0x25 +#define P5PMC_BK_MATCH_DR3 0x26 +#define P5PMC_HW_INT 0x27 +#define P5PMC_DATA_RD_WR 0x28 +#define P5PMC_DATA_RD_WR_MISS 0x29 +#define P5PMC_BUS_OWNER_LATENCY 0x2A +#define P5PMC_BUS_OWNER_TRANSFER 0x2A +#define P5PMC_MMX_INST_UPIPE 0x2B +#define P5PMC_MMX_INST_VPIPE 0x2B +#define P5PMC_CACHE_M_LINE_SHARE 0x2C +#define P5PMC_CACHE_LINE_SHARE 0x2C +#define P5PMC_EMMS_INTS_EXECUTED 0x2D +#define P5PMC_TRANS_MMX_FP_INST 0x2D +#define P5PMC_BUS_UTIL_PROCESSOR_ACT 0x2D +#define P5PMC_WR_NOCACHEABLE_MEM 0x2E +#define P5PMC_SATURATING_MMX_INST 0x2F +#define P5PMC_SATURATION_PERFORMED 0x2F +#define P5PMC_NUM_CYC_NOT_HALT_STATE 0x30 +#define P5PMC_DCACHE_TLB_MISS_STALL_DUR 0x30 +#define P5PMC_MMX_INST_DATA_RD 0x31 +#define P5PMC_MMX_INST_DATA_RD_MISS 0x31 +#define P5PMC_FP_STALL_DUR 0x32 +#define P5PMC_TAKEN_BRANCH 0x32 +#define P5PMC_D1_STARV_FIFO_EMPTY 0x33 +#define P5PMC_D1_STARV_ONE_INST_FIFO 0x33 +#define P5PMC_MMX_INST_DATA_WR 0x34 +#define P5PMC_MMX_INST_DATA_WR_MISS 0x34 +#define P5PMC_PL_FLUSH_WRONG_BR_PREDIC 0x35 +#define P5PMC_PL_FLUSH_WRONG_BR_PREDIC_WB 0x35 +#define P5PMC_MISALIGN_DMEM_REF_MMX 0x36 +#define P5PMC_PL_STALL_MMX_DMEM_RD 0x36 +#define P5PMC_MISPREDIC_UNPREDIC_RET 0x37 +#define P5PMC_PREDICED_RETURN 0x37 +#define P5PMC_MMX_MUL_UNIT_INTERLOCK 0x38 +#define P5PMC_MOVD_MOVQ_STALL_PREV_MMX 0x38 +#define P5PMC_RETURN 0x39 +#define P5PMC_BTB_FALSE_ENTRY 0x3A +#define P5PMC_BTB_MISS_PREDIC_NOT_TAKEN_BR 0x3A +#define P5PMC_FULL_WR_BUF_STALL_MMX 0x3B +#define P5PMC_STALL_MMX_WR_E_M_STATE_LINE 0x3B + +/* P6 PMC event list */ + +#define PMC_DATA_MEM_REFS 0x43 +#define PMC_DCU_LINES_IN 0x45 +#define PMC_DCU_M_LINES_IN 0x46 +#define PMC_DCU_M_LINES_OUT 0x47 +#define PMC_DCU_MISS_OUTSTANDING 0x48 +#define PMC_IFU_IFETCH 0x80 +#define PMC_IFU_IFETCH_MISS 0x81 +#define PMC_ITLB_MISS 0x85 +#define PMC_IFU_MEM_STALL 0x86 +#define PMC_IDL_STALL 0x87 +#define PMC_L2_IFETCH 0x28 +#define PMC_L2_LD 0x29 +#define PMC_L2_ST 0x2a +#define PMC_L2_LINES_IN 0x24 +#define PMC_L2_LINES_OUT 0x26 +#define PMC_L2_M_LINES_INM 0x25 +#define PMC_L2_M_LINES_OUTM 0x27 +#define PMC_L2_RQSTS 0x2e +#define PMC_L2_ADS 0x21 +#define PMC_L2_DBUS_BUSY 0x22 +#define PMC_L2_DBUS_BUSY_RD 0x23 +#define PMC_BUS_DRDY_CLOCKS 0x62 +#define PMC_BUS_LOCK_CLOCKS 0x63 +#define PMC_BUS_REQ_OUTSTANDING 0x60 +#define PMC_BUS_TRAN_BRD 0x65 +#define PMC_BUS_TRAN_RFO 0x66 +#define PMC_BUS_TRANS_WB 0x67 +#define PMC_BUS_TRAN_IFETCH 0x68 +#define PMC_BUS_TRAN_INVAL 0x69 +#define PMC_BUS_TRAN_PWR 0x6a +#define PMC_BUS_TRANS_P 0x6b +#define PMC_BUS_TRANS_IO 0x6c +#define PMC_BUS_TRAN_DEF 0x6d +#define PMC_BUS_TRAN_BURST 0x6e +#define PMC_BUS_TRAN_ANY 0x70 +#define PMC_BUS_TRAN_MEM 0x6f +#define PMC_BUS_DATA_RCV 0x64 +#define PMC_BUS_BNR_DRV 0x61 +#define PMC_BUS_HIT_DRV 0x7a +#define PMC_BUS_HITM_DRV 0x7b +#define PMC_BUS_SNOOP_STALL 0x7e +#define PMC_FLOPS 0xc1 +#define PMC_FP_COMP_OPS_EXE 0x10 +#define PMC_FP_ASSIST 0x11 +#define PMC_MUL 0x12 +#define PMC_DIV 0x13 +#define PMC_CYCLES_DIV_BUSY 0x14 +#define PMC_LD_BLOCKS 0x03 +#define PMC_SB_DRAINS 0x04 +#define PMC_MISALIGN_MEM_REF 0x05 +#define PMC_INST_RETIRED 0xc0 +#define PMC_UOPS_RETIRED 0xc2 +#define PMC_INST_DECODER 0xd0 +#define PMC_HW_INT_RX 0xc8 +#define PMC_CYCLES_INT_MASKED 0xc6 +#define PMC_CYCLES_INT_PENDING_AND_MASKED 0xc7 +#define PMC_BR_INST_RETIRED 0xc4 +#define PMC_BR_MISS_PRED_RETIRED 0xc5 +#define PMC_BR_TAKEN_RETIRED 0xc9 +#define PMC_BR_MISS_PRED_TAKEN_RETIRED 0xca +#define PMC_BR_INST_DECODED 0xe0 +#define PMC_BTB_MISSES 0xe2 +#define PMC_BR_BOGUS 0xe4 +#define PMC_BACLEARS 0xe6 +#define PMC_RESOURCE_STALLS 0xa2 +#define PMC_PARTIAL_RAT_STALLS 0xd2 +#define PMC_SEGMENT_REG_LOADS 0x06 +#define PMC_CPU_CLK_UNHALTED 0x79 +#define PMC_UMASK_00 0x00 +#define PMC_UMASK_0F 0x0f +#define PMC_UMASK_SELF 0x00 +#define PMC_UMASK_ANY 0x20 + +/* MTRR related defines */ + +#define MTRR_UC 0x00 +#define MTRR_WC 0x01 +#define MTRR_WT 0x04 +#define MTRR_WP 0x05 +#define MTRR_WB 0x06 +#define MTRR_E 0x00000800 +#define MTRR_FE 0x00000400 +#define MTRR_VCNT 0x000000FF +#define MTRR_FIX_SUPPORT 0x00000100 +#define MTRR_WC_SUPPORT 0x00000400 + +/* MCA related defines */ + +#define MCG_CTL_P 0x00000100 +#define MCG_COUNT 0x000000ff +#define MCG_MCIP 0x00000004 +#define MCG_EIPV 0x00000002 +#define MCG_RIPV 0x00000001 +#define MCI_VAL 0x80000000 +#define MCI_OVER 0x40000000 +#define MCI_UC 0x20000000 +#define MCI_EN 0x10000000 +#define MCI_MISCV 0x08000000 +#define MCI_ADDRV 0x04000000 +#define MCI_PCC 0x02000000 + +/* segment descriptor: types for application code, data segment */ + +#define SEG_DATA_RO_U 0x00000000 /* read only */ +#define SEG_DATA_RW_U 0x00000200 /* read write */ +#define SEG_DATA_RO_D 0x00000400 /* read only expand down */ +#define SEG_DATA_RW_D 0x00000600 /* read write expand down */ +#define SEG_CODE_EO 0x00000800 /* exec only */ +#define SEG_CODE_ER 0x00000a00 /* exec read */ +#define SEG_CODE_EO_C 0x00000c00 /* exec only conform. */ +#define SEG_CODE_ERO_C 0x00000e00 /* exec read only conform. */ + +/* segment descriptor: types for system segment and gate */ + +#define SEG_LDT 0x00000200 /* LDT */ +#define TASK_GATE 0x00000500 /* Task Gate */ +#define TSS32 0x00000900 /* 32 bit TSS (available) */ +#define CALL_GATE32 0x00000c00 /* 32 bit CALL gate */ +#define INT_GATE32 0x00000e00 /* 32 bit INT gate */ +#define TRAP_GATE32 0x00000f00 /* 32 bit TRAP gate */ + +/* segment descriptor: descriptor type */ + +#define SYS_DESC 0x00000000 /* system descriptors */ +#define APP_DESC 0x00001000 /* application descriptors */ + +/* segment descriptor: privilege level */ + +#define DPL0 0x00000000 /* privilege level 0 */ +#define DPL1 0x00002000 /* privilege level 1 */ +#define DPL2 0x00004000 /* privilege level 2 */ +#define DPL3 0x00006000 /* privilege level 3 */ + +/* segment descriptor: privilege level */ + +#define SEG_P 0x00008000 /* present */ + +/* segment descriptor: default operation size */ + +#define DB_16 0x00000000 /* 16 bit segment */ +#define DB_32 0x00400000 /* 32 bit segment */ + +/* segment descriptor: granularity */ + +#define G_BYTE 0x00000000 /* byte granularity */ +#define G_4K 0x00800000 /* 4K byte granularity */ + +/* segment descriptor: mask bits for attribute */ + +#define SEG_ATTR_MASK 0x00f0ff00 /* mask bits */ + +/* segment descriptor: pSegdesc->type: present and busy bit */ + +#define SEG_PRESENT 0x80 /* present bit */ +#define SEG_BUSY 0x02 /* busy bit */ + +/* GDT related macros */ +#define GDT_ENTRIES 5 + +/* IDT related macros */ +#define IDT_TASK_GATE 0x0000e500 /* task gate: P=1, DPL=3, task id */ + +#define IDT_TRAP_GATE 0x0000ef00 /* trap gate: P=1, DPL=3, trap id */ +#define IDT_INT_GATE 0x0000ee00 /* int gate: P=1, DPL=3, int id */ + +/* TSS related macros */ + +#define TSS_LINK 0 /* offset: link to previous task */ +#define TSS_ESP0 4 /* offset: privilege level 0 SP */ +#define TSS_SS0 8 /* offset: '' SS */ +#define TSS_ESP1 12 /* offset: privilege level 1 SP */ +#define TSS_SS1 16 /* offset: '' SS */ +#define TSS_ESP2 20 /* offset: privilege level 2 SP */ +#define TSS_SS2 24 /* offset: '' SS */ +#define TSS_CR3 28 /* offset: control register CR3 */ +#define TSS_EIP 32 /* offset: program counter EIP */ +#define TSS_EFLAGS 36 /* offset: status register EFLAGS */ +#define TSS_EAX 40 /* offset: general register EAX */ +#define TSS_ECX 44 /* offset: general register ECX */ +#define TSS_EDX 48 /* offset: general register EDX */ +#define TSS_EBX 52 /* offset: general register EBX */ +#define TSS_ESP 56 /* offset: stack pointer ESP */ +#define TSS_EBP 60 /* offset: frame pointer EBP */ +#define TSS_ESI 64 /* offset: general register ESI */ +#define TSS_EDI 68 /* offset: general register EDI */ +#define TSS_ES 72 /* offset: segment selector ES */ +#define TSS_CS 76 /* offset: segment selector CS */ +#define TSS_SS 80 /* offset: segment selector SS */ +#define TSS_DS 84 /* offset: segment selector DS */ +#define TSS_FS 88 /* offset: segment selector FS */ +#define TSS_GS 92 /* offset: segment selector GS */ +#define TSS_LDT 96 /* offset: segment selector LDT */ +#define TSS_TFLAG 100 /* offset: debug trap flag T */ +#define TSS_IOMAPB 102 /* offset: IO map base address */ +#define TSS_IOBMAP 104 /* offset: IO bit map array */ + +#define TSS_BUSY_MASK 0xfffffdff /* TSS descriptor BUSY bit mask */ + + +/* inline version of intLock()/intUnlock() : used in mmuI86Lib.c */ + +#define INT_LOCK(oldLevel) \ + WRS_ASM ("pushf ; popl %0 ; andl $0x00000200, %0 ; cli" \ + : "=rm" (oldLevel) : /* no input */ : "memory") + +#define INT_UNLOCK(oldLevel) \ + WRS_ASM ("testl $0x00000200, %0 ; jz 0f ; sti ; 0:" \ + : /* no output */ : "rm" (oldLevel) : "memory") + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCregsI86h */ diff --git a/h/arch/i86/regsP7.h b/h/arch/i86/regsP7.h new file mode 100644 index 0000000..e5c2b3d --- /dev/null +++ b/h/arch/i86/regsP7.h @@ -0,0 +1,120 @@ +/* regsP7.h - Pentium4 architecture specific registers */ + +/* Copyright 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,02sep02,hdn written +*/ + +#ifndef __INCregsP7h +#define __INCregsP7h + +#ifdef __cplusplus +extern "C" { +#endif + + +/* MSR, Pentium4 specific */ + +#define MSR_EBC_HARD_POWERON 0x002a +#define MSR_EBC_SOFT_POWERON 0x002b +#define MSR_EBC_FREQUENCY_ID 0x002c +#define MSR_LER_FROM_LIP 0x01d7 +#define MSR_LER_TO_LIP 0x01d8 +#define MSR_LASTBRANCH_TOS 0x01da +#define MSR_LASTBRANCH_0 0x01db +#define MSR_LASTBRANCH_1 0x01dc +#define MSR_LASTBRANCH_2 0x01dd +#define MSR_LASTBRANCH_3 0x01de +#define MSR_BPU_COUNTER0 0x0300 +#define MSR_BPU_COUNTER1 0x0301 +#define MSR_BPU_COUNTER2 0x0302 +#define MSR_BPU_COUNTER3 0x0303 +#define MSR_MS_COUNTER0 0x0304 +#define MSR_MS_COUNTER1 0x0305 +#define MSR_MS_COUNTER2 0x0306 +#define MSR_MS_COUNTER3 0x0307 +#define MSR_FLAME_COUNTER0 0x0308 +#define MSR_FLAME_COUNTER1 0x0309 +#define MSR_FLAME_COUNTER2 0x030a +#define MSR_FLAME_COUNTER3 0x030b +#define MSR_IQ_COUNTER0 0x030c +#define MSR_IQ_COUNTER1 0x030d +#define MSR_IQ_COUNTER2 0x030e +#define MSR_IQ_COUNTER3 0x030f +#define MSR_IQ_COUNTER4 0x0310 +#define MSR_IQ_COUNTER5 0x0311 +#define MSR_BPU_CCCR0 0x0360 +#define MSR_BPU_CCCR1 0x0361 +#define MSR_BPU_CCCR2 0x0362 +#define MSR_BPU_CCCR3 0x0363 +#define MSR_MS_CCCR0 0x0364 +#define MSR_MS_CCCR1 0x0365 +#define MSR_MS_CCCR2 0x0366 +#define MSR_MS_CCCR3 0x0367 +#define MSR_FLAME_CCCR0 0x0368 +#define MSR_FLAME_CCCR1 0x0369 +#define MSR_FLAME_CCCR2 0x036a +#define MSR_FLAME_CCCR3 0x036b +#define MSR_IQ_CCCR0 0x036c +#define MSR_IQ_CCCR1 0x036d +#define MSR_IQ_CCCR2 0x036e +#define MSR_IQ_CCCR3 0x036f +#define MSR_IQ_CCCR4 0x0370 +#define MSR_IQ_CCCR5 0x0371 +#define MSR_BSU_ESCR0 0x03a0 +#define MSR_BSU_ESCR1 0x03a1 +#define MSR_FSB_ESCR0 0x03a2 +#define MSR_FSB_ESCR1 0x03a3 +#define MSR_FIRM_ESCR0 0x03a4 +#define MSR_FIRM_ESCR1 0x03a5 +#define MSR_FLAME_ESCR0 0x03a6 +#define MSR_FLAME_ESCR1 0x03a7 +#define MSR_DAC_ESCR0 0x03a8 +#define MSR_DAC_ESCR1 0x03a9 +#define MSR_MOB_ESCR0 0x03aa +#define MSR_MOB_ESCR1 0x03ab +#define MSR_PMH_ESCR0 0x03ac +#define MSR_PMH_ESCR1 0x03ad +#define MSR_SAAT_ESCR0 0x03ae +#define MSR_SAAT_ESCR1 0x03af +#define MSR_U2L_ESCR0 0x03b0 +#define MSR_U2L_ESCR1 0x03b1 +#define MSR_BPU_ESCR0 0x03b2 +#define MSR_BPU_ESCR1 0x03b3 +#define MSR_IS_ESCR0 0x03b4 +#define MSR_IS_ESCR1 0x03b5 +#define MSR_ITLB_ESCR0 0x03b6 +#define MSR_ITLB_ESCR1 0x03b7 +#define MSR_CRU_ESCR0 0x03b8 +#define MSR_CRU_ESCR1 0x03b9 +#define MSR_IQ_ESCR0 0x03ba +#define MSR_IQ_ESCR1 0x03bb +#define MSR_RAT_ESCR0 0x03bc +#define MSR_RAT_ESCR1 0x03bd +#define MSR_SSU_ESCR0 0x03be +#define MSR_MS_ESCR0 0x03c0 +#define MSR_MS_ESCR1 0x03c1 +#define MSR_TBPU_ESCR0 0x03c2 +#define MSR_TBPU_ESCR1 0x03c3 +#define MSR_TC_ESCR0 0x03c4 +#define MSR_TC_ESCR1 0x03c5 +#define MSR_IX_ESCR0 0x03c8 +#define MSR_IX_ESCR1 0x03c9 +#define MSR_ALF_ESCR0 0x03ca +#define MSR_ALF_ESCR1 0x03cb +#define MSR_CRU_ESCR2 0x03cc +#define MSR_CRU_ESCR3 0x03cd +#define MSR_CRU_ESCR4 0x03e0 +#define MSR_CRU_ESCR5 0x03e1 +#define MSR_TC_PRECISE_EVENT 0x03f0 +#define MSR_PEBS_MATRIX_VERT 0x03f2 + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCregsP7h */ diff --git a/h/arch/i86/sStepLib.h b/h/arch/i86/sStepLib.h new file mode 100644 index 0000000..ff4f19d --- /dev/null +++ b/h/arch/i86/sStepLib.h @@ -0,0 +1,166 @@ +/* sStepLib.h - SpeedStep (Geyserville III) Technology registers */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01b,28Sep05,mmi mods copyrights and WR coding standard compliance +01a,05Aug05,mmi created +*/ + +#ifndef __INCsStepLibh +#define __INCsStepLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* sStepLib.c initialization status flags */ + +#define SSTEP_INIT_NOT_DONE 0x0001 /* gv3Lib initialization not done */ +#define SSTEP_ERR_NO_TM 0x0002 /* no Thermal Monitor exist */ +#define SSTEP_OK_NO_GV 0x0004 /* no GV1+ or GV3 exist */ +#define SSTEP_OK_GV3 0x0008 /* GV3 exist */ +#define SSTEP_OK_NO_MATCH 0x0010 /* no matching FREQ_VID table */ +#define SSTEP_OK_TM2 0x0020 /* GV3 TM2 exist */ +#define SSTEP_OK_TM1 0x0040 /* TM1 exist */ +#define SSTEP_OK_AC 0x0080 /* power source is AC */ +#define SSTEP_OK_BATT 0x0100 /* power source is Battery */ + +/* User Thermal Monitor Mode Configuration */ + +#define SSTEP_MAX_PERF 0x1 /* max performance */ +#define SSTEP_OPT_BATT 0x2 /* battery optimized performance */ +#define SSTEP_MAX_BATT 0x3 /* max battery */ +#define SSTEP_AUTO 0x4 /* automatic */ +#define SSTEP_DEFAULT 0x5 /* default */ + +/* SSTEP Thermal Monitor Mode Used */ + +#define SSTEP_TM1_OK 0x1 /* Thermal Monitor 1 */ +#define SSTEP_TM2_OK 0x2 /* Thermal Monitor 2 */ + + +/* Geyserville III specific MSRs */ + +#define MSR_EBL_CR_POWERON 0x002a /* Power On Configuration */ +#define MSR_BBL_CR_CTL 0x0119 /* Control Register */ +#define MSR_BBL_CR_CTL3 0x011e /* Control Register 3 */ +#define MSR_CLOCK_FLEX_MAX 0x0194 /* Flexible Bus Ratio/VID Control */ +#define MSR_PERF_STS 0x0198 /* Performance (Geyserville) Status */ +#define MSR_PERF_CTL 0x0199 /* Performance (Geyserville) Control */ +#define MSR_GV_THERM 0x019d /* Geyserville Thermal Control */ +#define MSR_GV1P_REG_PTR 0x019e /* Geyserville 1+ Pointer */ + +/* MSR_EBL_CR_POWERON bit difinition */ + +#define EBL_RATIO 0x07c00000 /* RO Core Clock to System Bus Ratio */ +#define EBL_AGENT_ID 0x00300000 /* RO Agent ID */ +#define EBL_BUS_FREQ 0x00040000 /* RO System Bus Frequency */ +#define EBL_APIC_ID 0x00030000 /* RO APIC Cluster ID */ +#define EBL_PO_RESET 0x00004000 /* RO 1M Power On Reset */ +#define EBL_IOQ_DEP 0x00002000 /* RO In Order Queue Depth */ +#define EBL_BINI_OBS_EN 0x00001000 /* RO BINIT# Observation Enabled */ +#define EBL_AERR_OBS_EN 0x00000400 /* RO AERR# Observation Enabled */ +#define EBL_BIST 0x00000200 /* RO Execute BIST */ +#define EBL_TRI_STATE 0x00000100 /* RO Output Tri-state Enable */ +#define EBL_BINI_EN 0x00000080 /* RW BINIT# Enable */ +#define EBL_BERR_IE_EN 0x00000040 /* RW BERR# Enable, Internal Err */ +#define EBL_QUICK 0x00000020 /* RO Quickstart Mode */ +#define EBL_BERR_BR_EN 0x00000010 /* RW BERR# Enable, Bus Request */ +#define EBL_AERR_EN 0x00000008 /* RW AERR# Enable */ +#define EBL_RESP_CHK_EN 0x00000004 /* RW Response Error Check Enable */ +#define EBL_DATA_CHK_EN 0x00000002 /* RW Data Error Check Enable */ + +/* MSR_BBL_CR_CTL3 bit difinition */ + +#define BBL_L2_NOT 0x00800000 /* RO L2 Not Present */ +#define BBL_L2_RANGE 0x00700000 /* RO L2 Physical Address Range */ +#define BBL_L2_EN 0x00000100 /* RW L2 Enabled */ +#define BBL_L2_ECC_EN 0x00000020 /* RO L2 ECC Check Enabled */ +#define BBL_L2_HARD_EN 0x00000001 /* RO L2 Hardware Enabled */ + +/* MSR_CLOCK_FLEX_MAX bit difinition */ + +#define FLEX_EN 0x00010000 /* RW Flex Enable */ +#define FLEX_RATIO 0x00001f00 /* RW Flex Ratio */ +#define FLEX_VID 0x0000003f /* RW Flex VID */ + +/* MSR_GV1P_REG_PTR bit difinition */ + +#define GV1P_REG_PTR 0x0000ffff /* RW GV1P pointer register */ + +/* MSR_PERF_CTL bit difinition */ + +#define BUS_RATIO_SEL 0x00001f00 /* RW Bus Ratio Selection */ +#define GV_VID_SEL 0x0000003f /* RW VID Selection */ + +/* MSR_PERF_STS bit difinition (upper 32) */ + +#define BUS_RATIO_BOOT 0x1f000000 /* RO Boot Bus Ratio */ +#define GV_VID_BOOT 0x003f0000 /* RO Boot VID */ +#define BUS_RATIO_MAX 0x00001f00 /* RO Max Bus Ratio */ +#define GV_VID_MAX 0x0000003f /* RO Max VID */ + +/* MSR_PERF_STS bit difinition (lower 32) */ + +#define BUS_RATIO_MIN 0x1f000000 /* RO Min Bus Ratio */ +#define GV_TS 0x00200000 /* RO SSTEP Transition Started */ +#define GV_CMD_SEEK 0x00100000 /* RO SSTEP Transition Performing */ +#define GV_THERM_THROT 0x00080000 /* RO SSTEP Thermal Throttle */ +#define GV_TT 0x00040000 /* RO Thermal Trip Active */ +#define GV_VIP 0x00020000 /* RO Voltage Transition Pending */ +#define GV_FIP 0x00010000 /* RO Frequency Change Pending */ +#define BUS_RATIO_STS 0x00001f00 /* RO Current Bus Ratio */ +#define GV_VID_STS 0x0000003f /* RO Current VID */ + +/* MSR_GV_THERM bit difinition */ + +#define GV_THROT_SEL 0x00010000 /* RW Thermal Management Mode */ +#define BUS_RATIO_THROT 0x00001f00 /* RW Throttling Bus Ratio */ +#define GV_VID_THROT 0x0000003f /* RW Throttling VID */ + +/* High/Low temperature thresholds */ + +#define CPU_HOT_TEMP (100) +#define CPU_COLD_TEMP (-4) + +#ifndef _ASMLANGUAGE + +/* frequency - VID table : state entry */ + +typedef struct freqVidState + { + UINT16 vid; /* VID_SEL value in MSR_PERF_CTL */ + UINT16 ratio; /* BUS_RATIO_SEL value in MSR_PERF_CTL */ + UINT16 power; /* power(mW) consumed by CPU in this state */ + } FREQ_VID_STATE; + +/* frequency - VID table : header */ + +typedef struct freqVidHeader + { + UINT32 cpuId; /* CPU family-model-stepping value */ + UINT8 maxVid; /* VID_MAX value in MSR_PERF_STS */ + UINT8 maxRatio; /* BUS_RATIO_MAX value in MSR_PERF_STS */ + UINT8 nState; /* no of states supported by this CPU */ + FREQ_VID_STATE * pState; + } FREQ_VID_HEADER; + +extern STATUS sStepLibInit (CPU_PWR_FRAME_WORK_PTR); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsStepLibh */ diff --git a/h/arch/i86/sigI86Codes.h b/h/arch/i86/sigI86Codes.h new file mode 100644 index 0000000..04367e0 --- /dev/null +++ b/h/arch/i86/sigI86Codes.h @@ -0,0 +1,44 @@ +/* sigI86Codes.h - signal facility library header */ + +/* Copyright 1984-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,29may94,hdn removed I80486 conditional. +01a,08jun93,hdn written. +*/ + +#ifndef __INCsigI86Codesh +#define __INCsigI86Codesh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "iv.h" + +#define ILL_DIVIDE_ERROR IV_DIVIDE_ERROR +#define ILL_NON_MASKABLE IV_NON_MASKABLE +#define ILL_OVERFLOW IV_OVERFLOW +#define ILL_BOUND IV_BOUND +#define ILL_INVALID_OPCODE IV_INVALID_OPCODE +#define ILL_DOUBLE_FAULT IV_DOUBLE_FAULT +#define ILL_INVALID_TSS IV_INVALID_TSS +#define ILL_PROTECTION_FAULT IV_PROTECTION_FAULT +#define ILL_RESERVED IV_RESERVED +#define EMT_DEBUG IV_DEBUG +#define EMT_BREAKPOINT IV_BREAKPOINT +#define FPE_NO_DEVICE IV_NO_DEVICE +#define FPE_CP_OVERRUN IV_CP_OVERRUN +#define FPE_CP_ERROR IV_CP_ERROR +#define BUS_NO_SEGMENT IV_NO_SEGMENT +#define BUS_STACK_FAULT IV_STACK_FAULT +#define BUS_PAGE_FAULT IV_PAGE_FAULT +#define BUS_ALIGNMENT IV_ALIGNMENT + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsigI86Codesh */ diff --git a/h/arch/i86/syscallArgsx86.h b/h/arch/i86/syscallArgsx86.h new file mode 100644 index 0000000..ebbdcf9 --- /dev/null +++ b/h/arch/i86/syscallArgsx86.h @@ -0,0 +1,755 @@ +/* Aligned for x86 - no alignment needed */ + + +/* THIS FILE IS AUTO_GENERATED. PLEASE DO NOT EDIT. */ + +#ifndef _ASMLANGUAGE + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct _exitScArgs + { + int status; + }; + +struct creatScArgs + { + const char * name; + mode_t flag; + }; + +struct _openScArgs + { + const char * name; + int flags; + int mode; + }; + +struct closeScArgs + { + int fd; + }; + +struct readScArgs + { + int fd; + void * buffer; + size_t maxbytes; + }; + +struct writeScArgs + { + int fd; + const void * buffer; + size_t nbytes; + }; + +struct _ioctlScArgs + { + int fd; + int function; + int arg; + }; + +struct dupScArgs + { + int fd; + }; + +struct dup2ScArgs + { + int fd; + int fd2; + }; + +struct pipeScArgs + { + int filedes[2]; + }; + +struct removeScArgs + { + const char * name; + }; + +struct selectScArgs + { + int width; + fd_set * readFds; + fd_set * writeFds; + fd_set * excFds; + struct timeval * timeout; + }; + +struct socketScArgs + { + int domain; + int type; + int protocol; + }; + +struct bindScArgs + { + int s; + struct sockaddr * name; + int namelen; + }; + +struct listenScArgs + { + int s; + int backlog; + }; + +struct acceptScArgs + { + int s; + struct sockaddr * addr; + int *addrlen; + }; + +struct connectScArgs + { + int s; + struct sockaddr * name; + int namelen; + }; + +struct sendtoScArgs + { + int s; + caddr_t buf; + int bufLen; + int flags; + struct sockaddr * to; + int tolen; + }; + +struct sendScArgs + { + int s; + const char * buf; + int bufLen; + int flags; + }; + +struct sendmsgScArgs + { + int s; + struct msghdr * mp; + int flags; + }; + +struct recvfromScArgs + { + int s; + char * buf; + int bufLen; + int flags; + struct sockaddr *from; + int * pFromLen; + }; + +struct recvScArgs + { + int s; + char * buf; + int bufLen; + int flags; + }; + +struct recvmsgScArgs + { + int s; + struct msghdr * mp; + int flags; + }; + +struct setsockoptScArgs + { + int s; + int level; + int optname; + char * optval; + int optlen; + }; + +struct getsockoptScArgs + { + int s; + int level; + int optname; + char * optval; + int * optlen; + }; + +struct getsocknameScArgs + { + int s; + struct sockaddr *name; + int * namelen; + }; + +struct getpeernameScArgs + { + int s; + struct sockaddr *name; + int *namelen; + }; + +struct shutdownScArgs + { + int s; + int how; + }; + +struct mmapScArgs + { + void * addr; + size_t len; + int prot; + int flags; + int fildes; + off_t64 off; + }; + +struct munmapScArgs + { + void * addr; + size_t len; + }; + +struct mprotectScArgs + { + void * addr; + size_t len; + int prot; + }; + +struct killScArgs + { + OBJ_HANDLE rtpId; + int signo; + }; + +struct sigpendingScArgs + { + sigset_t * pSet; + }; + +struct sigprocmaskScArgs + { + int how; + const sigset_t * pSet; + sigset_t * pOset; + }; + +struct _sigqueueScArgs + { + OBJ_HANDLE rtpId; + int signo; + const union sigval * pValue; + int sigCode; + }; + +struct sigsuspendScArgs + { + const sigset_t * pSet; + }; + +struct sigtimedwaitScArgs + { + const sigset_t * pSet; + struct siginfo * pInfo; + const struct timespec * pTime; + }; + +struct _sigactionScArgs + { + int signo; + const struct sigaction * pAct; + struct sigaction * pOact; + void * retAddr; + }; + +struct chdirScArgs + { + const char * name; + }; + +struct _getcwdScArgs + { + char * buffer; + int length; + }; + +struct waitpidScArgs + { + OBJ_HANDLE childRtpId; + int * pStatus; + int options; + }; + +struct sysctlScArgs + { + int *pName; + u_int nameLen; + void * pOld; + size_t * pOldLen; + void * pNew; + size_t newLen; + }; + +struct _schedPxInfoGetScArgs + { + BOOL * pTimeSlicingOn; + ULONG * pTimeSlicePeriod; + }; + +struct sigaltstackScArgs + { + stack_t * ss; + stack_t * oss; + }; + +struct unlinkScArgs + { + const char * name; + }; + +struct linkScArgs + { + const char * name; + const char * newname; + }; + +struct fsyncScArgs + { + int fd; + }; + +struct fdatasyncScArgs + { + int fd; + }; + +struct renameScArgs + { + const char * oldname; + const char * newname; + }; + +struct fpathconfScArgs + { + int fd; + int name; + }; + +struct pathconfScArgs + { + const char * path; + int name; + }; + +struct accessScArgs + { + const char * path; + int amode; + }; + +struct chmodScArgs + { + const char * path; + mode_t mode; + }; + +struct eventReceiveScArgs + { + UINT32 events; + UINT32 options; + int timeout; + UINT32 * pEvtsReceived; + }; + +struct eventSendScArgs + { + int taskId; + UINT32 events; + }; + +struct eventCtlScArgs + { + OBJ_HANDLE handle; + VX_EVT_CTL_CMD command; + void * pArg; + UINT * pArgSize; + }; + +struct msgQSendScArgs + { + OBJ_HANDLE handle; + char * buffer; + UINT nBytes; + int timeout; + int priority; + }; + +struct msgQReceiveScArgs + { + OBJ_HANDLE handle; + char * buffer; + UINT maxNBytes; + int timeout; + }; + +struct _msgQOpenScArgs + { + const char * name; + UINT maxMsgs; + UINT maxMsgLength; + int options; + int mode; + void * context; + }; + +struct objDeleteScArgs + { + OBJ_HANDLE handle; + int options; + }; + +struct objInfoGetScArgs + { + OBJ_HANDLE handle; + void * pInfo; + UINT * pInfoSize; + int level; + }; + +struct _semTakeScArgs + { + OBJ_HANDLE handle; + int timeout; + }; + +struct _semGiveScArgs + { + OBJ_HANDLE handle; + }; + +struct _semOpenScArgs + { + const char * name; + SEM_TYPE type; + int initState; + int options; + int mode; + void * context; + }; + +struct semCtlScArgs + { + OBJ_HANDLE handle; + VX_SEM_CTL_CMD command; + void * pArg; + UINT * pArgSize; + }; + +struct _taskOpenScArgs + { + struct vx_task_open_sc_args * pArgs; + }; + +struct taskCtlScArgs + { + int tid; + VX_TASK_CTL_CMD command; + void * pArg; + UINT * pArgSize; + }; + +struct taskDelayScArgs + { + int ticks; + }; + +struct rtpSpawnScArgs + { + const char * rtpFileName; + const char ** argv; + const char ** envp; + int priority; + int uStackSize; + int options; + int taskOptions; + }; + +struct rtpInfoGetScArgs + { + OBJ_HANDLE rtpId; + RTP_DESC * rtpStruct; + }; + +struct taskKillScArgs + { + OBJ_HANDLE taskHandle; + int signo; + }; + +struct _taskSigqueueScArgs + { + OBJ_HANDLE taskHandle; + int signo; + const union sigval * pValue; + int sigCode; + }; + +struct _timer_openScArgs + { + const char * name; + int mode; + clockid_t clockId; + struct sigevent * evp; + void * context; + }; + +struct timerCtlScArgs + { + TIMER_CTL_CMD cmdCode; + int handle; + void * pArgs; + UINT * pArgSize; + }; + +struct pxOpenScArgs + { + PX_OBJ_TYPE type; + const char * name; + int objOpenMode; + void * attr; + }; + +struct pxCloseScArgs + { + OBJ_HANDLE handle; + }; + +struct pxUnlinkScArgs + { + PX_OBJ_TYPE type; + const char * name; + }; + +struct pxCtlScArgs + { + OBJ_HANDLE handle; + PX_CTL_CMD_CODE cmdCode; + void * pArgs; + UINT * pArgSize; + }; + +struct pxMqReceiveScArgs + { + OBJ_HANDLE handle; + char * pMsg; + size_t msgLen; + unsigned int * pMsgPrio; + PX_WAIT_OPTION waitOption; + struct timespec * time_out; + }; + +struct pxMqSendScArgs + { + OBJ_HANDLE handle; + const char * pMsg; + size_t msgLen; + unsigned int msgPrio; + PX_WAIT_OPTION waitOption; + struct timespec * time_out; + }; + +struct pxSemWaitScArgs + { + OBJ_HANDLE handle; + PX_WAIT_OPTION waitOption; + struct timespec * time_out; + }; + +struct pxSemPostScArgs + { + OBJ_HANDLE handle; + }; + +struct pipeDevCreateScArgs + { + const char * name; + int nMessages; + int nBytes; + }; + +struct pipeDevDeleteScArgs + { + const char * name; + BOOL force; + }; + +struct _sdCreateScArgs + { + char * name; + int options; + UINT32 size; + off_t64 physAddress; + MMU_ATTR attr; + void ** pVirtAddress; + }; + +struct _sdOpenScArgs + { + char * name; + int options; + int mode; + UINT32 size; + off_t64 physAddress; + MMU_ATTR attr; + void ** pVirtAddress; + }; + +struct sdDeleteScArgs + { + OBJ_HANDLE handle; + int options; + }; + +struct sdMapScArgs + { + OBJ_HANDLE handle; + MMU_ATTR attr; + int options; + }; + +struct sdUnmapScArgs + { + OBJ_HANDLE handle; + int options; + }; + +struct sdProtectScArgs + { + OBJ_HANDLE handle; + MMU_ATTR attr; + }; + +struct _edrErrorInjectScArgs + { + int kind; + const char *fileName; + int lineNumber; + REG_SET *regset; + void *addr; + const char *msg; + }; + +struct resSearchNScArgs + { + const char * name; + struct res_target * target; + }; + +struct wvEventScArgs + { + int eventId; + const char * pData; + unsigned int dataSize; + }; + +struct rtpVarAddScArgs + { + void ** pVar; + void * value; + }; + +struct sdInfoGetScArgs + { + OBJ_HANDLE handle; + SD_DESC * pSdStruct; + }; + +struct _shlOpenScArgs + { + const char * name; + int options; + }; + +struct _shlUnlockScArgs + { + SHL_ID shlId; + }; + +struct _shlCloseScArgs + { + SHL_ID shlId; + }; + +struct _shlGetScArgs + { + SHL_ID shlId; + SHLINFO *pInfo; + }; + +struct _shlPutScArgs + { + SHL_ID shlId; + const SHLINFO *pInfo; + }; + +struct objUnlinkScArgs + { + const char * name; + enum windObjClassType classType; + }; + +struct getprlimitScArgs + { + int idtype; + OBJ_HANDLE handle; + int resource; + struct rlimit *rlp; + }; + +struct setprlimitScArgs + { + int idtype; + OBJ_HANDLE handle; + int resource; + struct rlimit *rlp; + }; + +struct _mctlScArgs + { + void * addr; + size_t len; + int function; + int arg; + }; + +#endif /* _ASMLANGUAGE */ diff --git a/h/arch/i86/syscallI86.h b/h/arch/i86/syscallI86.h new file mode 100644 index 0000000..8e4d8d7 --- /dev/null +++ b/h/arch/i86/syscallI86.h @@ -0,0 +1,89 @@ +/* syscallI86.h - I86 specific System Call Infrastructure header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,05may05,zmm Fix SYSCALL_ENTRY_FRAME_SIZE. SPR 108825 +01c,02feb04,jb Fix SPR 93500 +01b,04jan04,jb Adding context to syscall_entry_state +01a,18sep03,jb written. +*/ + +/* +DESCRIPTION +This header contains I86-specific definitions and constants used by +the System Call Infrastructure library. + +*/ + +#ifndef __INCsyscallI86h +#define __INCsyscallI86h + +#ifndef _ASMLANGUAGE +#include "taskLib.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define syscallDispatch_PORTABLE /* Use the portable dispatcher */ + + /* defines */ + +#define SYSCALL_ENTRY_FRAME_SIZE 68 + +#define SYSCALL_STACK_ARGS 8 + +#ifndef _ASMLANGUAGE + + +/* The call gate/Tss mechanism does the copy for us, this is not needed */ + +#define _SYSCALL_USER_SP_CHECK(sp) + + /* typedefs */ + + /* + * The SYSCALL_ENTRY_STATE structure defines the saved machine state + * when the system call trap is taken. This information is architecture + * specific, and is used by the system call dispatcher to restart system + * calls that have been interrupted by the occurance of signals. + * System call restart is achieved by restoring the saved state at the + * time of the system call trap, and re-issuing the system call. + * + * All arguments to the system call are saved on the kernel stack, and + * the address of that array is passed as an argument to the dispatcher. + * The layout of this structure must exactly match the ordering of members + * of the system call entry frame in src/arch/I86/syscallALib.s. + * + */ + +typedef struct syscall_entry_state + { + int ebx; /* Save reg */ + int ecx; /* Save reg */ + int edx; /* Save reg */ + void * pc; /* return address instruction pointer */ + int cs; /* return address code segment */ + int scn; /* System Call Number - Also temp error storage */ + int upc; /* return to caller pc */ + int args[8]; /* argument list */ + int * pUStack; /* user-mode stack pointer */ + int ss; /* user stack segment */ + } SYSCALL_ENTRY_STATE; + + +/* Prototype */ +UINT32 sysModGdt (UINT32 offset, UINT32 limit, UINT32 base, UINT32 priority); + + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsyscallI86h */ diff --git a/h/arch/i86/vxI86Lib.h b/h/arch/i86/vxI86Lib.h new file mode 100644 index 0000000..eaa8827 --- /dev/null +++ b/h/arch/i86/vxI86Lib.h @@ -0,0 +1,86 @@ +/* vxI86Lib.h - header for arch/board dependent routines for the I80X86 */ + +/* + * Copyright (c) 2001-2003, 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + + +/* +modification history +-------------------- +01h,16feb05,aeg added various function prototypes (SPR #106381). +01g,24dec03,jb Adding prototype for vxDsGet +01f,04sep02,hdn added vxIdleHookAdd(), vxIdleShow() prototype. +01e,11apr02,pai Added vxCpuShow(), vxDrShow(), and vxSseShow() prototypes. +01d,26mar02,pai Added vxShowInit() prototype (SPR 74103). +01c,13nov01,ahm Added rudimentary support for power management (SPR#32599) +01b,26oct01,hdn added vxDr[SG]et(), vxTss[GS]et() prototype. +01a,22aug01,hdn written. +*/ + +#ifndef __INCvxI86Libh +#define __INCvxI86Libh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* power management mode definitions - used by vxPowerModeSet/Get */ + +#define VX_POWER_MODE_DISABLE (0x1) /* power mgt disable: loop when idle*/ +#define VX_POWER_MODE_AUTOHALT (0x4) /* AutoHalt power management mode */ + +/* function declarations */ + +#ifndef _ASMLANGUAGE + +extern void vxMemProbeTrap (void); +extern STATUS vxMemProbeSup (int length, char * adrs, char * pVal); +extern int vxCr0Get (void); +extern void vxCr0Set (int cr0); +extern int vxCr2Get (void); +extern void vxCr2Set (int cr2); +extern int vxCr3Get (void); +extern void vxCr3Set (int cr3); +extern int vxCr4Get (void); +extern void vxCr4Set (int cr4); +extern int vxCsGet (void); +extern int vxDsGet (void); +extern int vxSsGet (void); +extern int vxEflagsGet (void); +extern void vxEflagsSet (int eflags); +extern void vxDrGet (int * pDr0, int * pDr1, int * pDr2, + int * pDr3, int * pDr4, int * pDr5, + int * pDr6, int * pDr7); +extern void vxDrSet (int dr0, int dr1, int dr2, int dr3, + int dr4, int dr5, int dr6, int dr7); +extern int vxTssGet (void); +extern void vxTssSet (int value); +extern void vxGdtrGet (long long int * pGdtr); +extern void vxIdtrGet (long long int * pIdtr); +extern void vxLdtrGet (long long int * pLdtr); +IMPORT STATUS vxPowerModeSet (UINT32 mode); +IMPORT UINT32 vxPowerModeGet (void); +extern STATUS vxIdleHookAdd (FUNCPTR entHook, FUNCPTR exitHook); +extern VOID vxIdleEntHookRtn (void); +extern VOID vxIdleExtHookRtn (void); +extern UINT32 vxIdleUtilGet (void); + +extern void vxShowInit (void); +extern void vxCpuShow (void); +extern void vxDrShow (void); +extern void vxSseShow (int); +extern void vxIdleShow (BOOL debug); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvxI86Libh */ diff --git a/h/arch/mips/archMips.h b/h/arch/mips/archMips.h new file mode 100644 index 0000000..da27c87 --- /dev/null +++ b/h/arch/mips/archMips.h @@ -0,0 +1,735 @@ +/* archMips.h - MIPS architecture specific header */ + +/* + * Copyright (c) 1992, 1993, 1995-1997, 1999-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + + +/* + * This file has been developed or significantly modified by the + * MIPS Center of Excellence Dedicated Engineering Staff. + * This notice is as per the MIPS Center of Excellence Master Partner + * Agreement, do not remove this notice without checking first with + * WR/Platforms MIPS Center of Excellence engineering management. + */ + +/* +modification history +-------------------- +02y,29aug05,h_k added _WRS_SUPPORT_CACHE_XLATE and _WRS_SUPPORT_CACHE_LOCK. +02x,12aug05,pes Add SR_MX bit, define _WRS_DSP_SUPPORT. +02w,12apr05,kk remove _WRS_OBJLIB_SUPPORT_VERIFY_TRAP macro (SPR# 106486) +02v,24feb05,slk SPR 102772: add _ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK + and _WRS_STACK_PROTECT_REQUIRES_MMU macros. +02u,10dec04,slk SPR 104530. Add define for PM_MMULESS_PAGE_SIZE used by + pmLib.c. This needs to be changed for MIPS to 8192 so the + ED&R area is created on an 8K boundary. +02t,09dec04,pes SPR 103585 et.al.: Added _WRS_NONGLOBAL_NULL_PAGE define. + Triggers conditional code in aimMmuLib.c. +02s,01nov04,slk SPR 92598: Add support for OSM event handling +02r,15oct04,pes Corrected copyright notice. Add definition of BEV_VEC +02q,01oct04,tam moved definition of _TYPE_PHYS_ADDR from shared file to + kernel header +02p,17sep04,pes Move _TYPE_PHYS_ADDDR and _WRS_PHYS_ADDR_IS_64_BITS to + archMipsCommon.h. +02o,02sep04,pes Add definition of _WRS_LINKER_DATA_SEG_ALIGN +02n,18may04,mem Remove R3k. +02m,28apr04,pes Switch to portable scheduler. +02m,27apr04,cjj Defined workQLib_PORTABLE +02l,22mar04,zl moved trcLib_PORTABLE, _RType and INSTR to archMipsCommon.h; + added _WRS_FRAMEP_FROM_JMP_BUF and _WRS_RET_PC_FROM_JMP_BUF. +02k,26mar04,slk Add configuration 1 register definitions +02j,10mar04,pes *Really* finish implementation of 02h. +02i,10mar04,pes Finish implementation of 02h. +02h,10mar04,pes Change _STACK_ALIGN_SIZE to 8 to match compiler behavior. +02g,13feb04,pes Add typedef override for _TYPE_PHYS_ADDR. Define + trcLib_PORTABLE. +02f,07dec03,pes Removed definitions of _ARCH_LONG_MIN and _ARCH_INT_MIN in + favor of those in vxTypesBase.h +02e,25nov03,pes Moved definition of _BYTE_ORDER to archMipsCommon.h. +02d,14nov03,job Moved some blib stuff to archMipsCommon.h +02c,13nov03,pes Add include of archMipsCommon.h +02c,29oct03,pes Adjust Address mapping macros for greater flexibility. +02b,28oct03,pcm enabled base 6 scheduler +02a,27aug03,to added defines for semLib. +01z,07may03,pes More conditional compilation cleanup. +01y,29apr03,pes PAL conditional compilation cleanup. +01x,03oct02,jmt Allow for override of _CACHE_ALIGN_SIZE +01w,13mar01,sn SPR 73723 - define supported toolchains +01v,09jan02,tlc Remove inappropriate TLB definitions. +01u,04oct01,agf add TLB definitions and constants +01t,16jul01,ros add CofE comment +01s,07jun01,mem Re-introduce optimized kernel. +01r,13feb01,pes Add support for RM7000 extended interrupts +01q,05jan01,mem Remove decl of _wdbDbgCtx routines. +01p,04jan01,agf Adding TLB_ENTRIES define +01o,03jan01,pes Remove definition of IS_KSEGM. This is not supported in + Tornado 2. +01n,20dec00,pes Merge some definitions from target/h/arch/r4000.h. +01m,12oct99,yvp Merge from .../tor2_0_0.coretools-baseline branch to make + Tor2 code work with T3 main/LATEST compiler +01l,07sep99,myz added CW4000_16 compiler switch +01k,22jan97,alp added CW4000 and CW4010 support. +01l,11nov99,dra Updated for T3 toolchain. +01k,18oct99,dra added CW4000, CW4011, VR4100, VR5000 and VR5400 support. + added test for both MIPSEB and MIPSEL defined. +01k,00oct00,sn removed varargs/typedefs for GNUC +01j,14oct96,kkk added R4650 support. +01i,05aug96,kkk Changed _ALLOC_ALIGN_SIZE & _STACK_ALIGN_SIZE to 16. +01i,27jun96,kkk undo 01h. +01h,30apr96,mem fixed varargs support for R4000, use 64 bit stack slots. +01g,27may95,cd switched from MIPSE[BL] to _BYTE_ORDER for ansi compliance +01f,15oct93,cd added support for R4000, SDE compiler and 64 bit kernel. +01e,22sep92,rrr added support for c++ +01d,07jun92,ajm added _ARCH_MULTIPLE_CACHES for cache init +01c,03jun92,ajm updated file name referenced to match real name +01b,26may92,rrr the tree shuffle +01a,22apr92,yao written. +*/ + +#ifndef __INCarchMipsh +#define __INCarchMipsh + +#ifdef __cplusplus +extern "C" { +#endif + +#define _ARCH_SUPPORTS_GCC +#define _ARCH_SUPPORTS_DCC + +#define _ARCH_MULTIPLE_CACHELIB TRUE + +#define _WRS_SUPPORT_CACHE_XLATE /* cache virt-phys translate */ +#define _WRS_SUPPORT_CACHE_LOCK /* cache lock feature */ + +#define _DYNAMIC_BUS_SIZING FALSE /* no dynamic bus sizing */ +#define _ALLOC_ALIGN_SIZE 16 +#define _STACK_ALIGN_SIZE 8 + +#ifdef _WRS_MIPS_CPU_TX79XX +#define _CACHE_ALIGN_SIZE 64 /* max cache line size */ +#else /* _WRS_CPU_TX79XX */ +#define _CACHE_ALIGN_SIZE 32 /* max cache line size */ +#endif /* _WRS_CPU_TX79XX */ + +#if (CPU == MIPS32) + +#define _WRS_INT_REGISTER_SIZE 4 +#define _WRS_INT_REGISTER_SHIFT 2 +#define _WRS_FP_REGISTER_SIZE 4 +#define _WRS_FP_REGISTER_SHIFT 2 + +#elif (CPU == MIPS64) + +#define _WRS_INT_REGISTER_SIZE 8 +#define _WRS_INT_REGISTER_SHIFT 3 +#define _WRS_FP_REGISTER_SIZE 8 +#define _WRS_FP_REGISTER_SHIFT 3 + +#else /* CPU */ +#error "Invalid CPU value" +#endif /* CPU */ + +#define _WRS_DSP_SUPPORT + +#define RTP_SPAWN_MEMORY_LEAK_FIX /* remove when temp code is removed */ + +#define _RTypeSize _WRS_INT_REGISTER_SIZE + +#define SR_INT_ENABLE SR_IE /* interrupt enable bit */ + +#define POP_SR(p) ((p) & ~SR_EXL) + +/* + * Segment base addresses and sizes + */ + +#define K0BASE 0x80000000 +#define K0SIZE 0x20000000 +#define K1BASE 0xA0000000 +#define K1SIZE 0x20000000 + +#define KMBASE "Do not use" /* 0xC0000000 *//* mapped kernel space */ +#define KMSIZE "Do not use" /* 0x40000000 */ + +#define KSBASE "Do not use" /* 0xC0000000 */ +#define KSSIZE "Do not use" /* 0x20000000 */ +#define K2BASE 0xC0000000 +#define K2SIZE 0x20000000 +#define K3BASE 0xE0000000 +#define K3SIZE 0x20000000 + +/* + * Address conversion macros + */ + +/*#define KSEG2_TO_KSEG0_MASK (~(1<<30)) */ /* Do not use */ + +#define K0_TO_K1(x) ((unsigned)(x)|0xA0000000) /* kseg0 to kseg1 */ +#define K1_TO_K0(x) ((unsigned)(x)&0x9FFFFFFF) /* kseg1 to kseg0 */ + +#define K0_TO_PHYS(x) ((unsigned)(x)&0x1FFFFFFF) /* kseg0 to physical */ +#define K1_TO_PHYS(x) ((unsigned)(x)&0x1FFFFFFF) /* kseg1 to physical */ + +#define PHYS_TO_K0(x) ((unsigned)(x)|0x80000000) /* physical to kseg0 */ +#define PHYS_TO_K1(x) ((unsigned)(x)|0xA0000000) /* physical to kseg1 */ + +/* + * The "KM" conversion macros only work for limited sections of the + * mapped kernel space. + * + */ + +#define ADDRESS_SPACE_MASK (~(7<<29)) +#define KM_TO_K0(x) (((unsigned)(x) & ADDRESS_SPACE_MASK) | K0BASE) +#define KM_TO_K1(x) (((unsigned)(x) & ADDRESS_SPACE_MASK) | K1BASE) +#define KM_TO_PHYS(x) ((unsigned)(x)&0x1FFFFFFF) +#define PHYS_TO_KM(x) ((unsigned)(x) | K2BASE) + +/* + * Address predicates + */ + +#define IS_KSEG0(x) ((unsigned)(x) >= K0BASE && (unsigned)(x) < K1BASE) +#define IS_KSEG1(x) ((unsigned)(x) >= K1BASE && (unsigned)(x) < K2BASE) +#define IS_KUSEG(x) ((unsigned)(x) < K0BASE) + +#define IS_UNMAPPED(x) (((unsigned)(x) & 0xc0000000) == 0x80000000) +#define IS_KSEGM(x) (!(IS_UNMAPPED(x))) + +/* PAL additions */ +#define FLOAT_NORM /* xdr */ + +#define PORTABLE +#define ffsLib_PORTABLE /* ffsLib.c */ +#define workQLib_PORTABLE /* workQLib.c */ + +#define STK_PAGE_GUARD_ATTR PAGE_MGR_OPTS_SUP_DATA_RO +#define _WRS_ARCH_BLIB +#define LOGICAL_TO_VIRT(X) PHYS_TO_KM(K0_TO_PHYS(X)) +#define _WRS_DUAL_MAPPED_SYS_PAGE +#define _WRS_VIRTUALLY_INDEXED_CACHES +#define _WRS_CACHE_PAL /* cache library has been PAL-ified */ + +/* vxwTaskLib.h */ +#define _WRS_NEED_SRSET /* target/h/vxwTaskLib.h */ +#ifndef _WRS_SRSET_ARG_TYPE +#define _WRS_SRSET_ARG_TYPE UINT32 /* argument to SRSet */ +#endif /* _WRS_SRSET_ARG_TYPE */ + +/* wdbDbgLib.h */ +#define WDB_CTX_LOAD(pRegs) _wdbDbgCtxLoad (pRegs) +#define WDB_CTX_SAVE(pRegs) _wdbDbgCtxSave (pRegs) + +#ifndef _WRS_SPY_TASK_SIZE +#define _WRS_SPY_TASK_SIZE 10000 /* spyLib.c */ +#endif /* _WRS_SPY_TASK_SIZE */ + +#define _WRS_ARCH_LOADELF LOADELF_MIPS_MODEL /* loadElf.c */ + +#define _WRS_CHECK_REGISTER_WIDTH /* for register display */ + +/* Target shell support */ +#define _WRS_SHELL_DATA_TYPES SHELL_ALL_DATA_SUPPORT + +/* + * Exception vectors + */ + +#define T_VEC K0BASE /* tlbmiss vector */ +#define X_VEC (K0BASE+0x80) /* xtlbmiss vector */ +#define C_VEC (K1BASE+0x100) /* cache exception vector */ +#define E_VEC (K0BASE+0x180) /* exception vector */ + +#define R_VEC (K1BASE+0x1fc00000) /* reset vector */ +#define BEV_VEC (K1BASE+0x1fc00380) /* boot exception vector */ +/* + * Cache alignment macros + * + * NOTE: These definitions may migrate to vxWorks.h in a future release. + */ +#define CACHE_ROUND_UP(x) ROUND_UP(x, _CACHE_ALIGN_SIZE) +#define CACHE_ROUND_DOWN(x) ROUND_DOWN(x, _CACHE_ALIGN_SIZE) + +/* +* Cache size constants +*/ + +#define R4KMINCACHE +(1*1024) /* leading plus for mas's benefit */ +#define R4KMAXCACHE +(256*1024) /* leading plus for mas's benefit */ + +/* + * Cause bit definitions + */ +#define CAUSE_BD 0x80000000 /* Branch delay slot */ +#define CAUSE_CEMASK 0x30000000 /* coprocessor error */ +#define CAUSE_CESHIFT 28 + +#define CAUSE_IP8 0x00008000 /* External level 8 pending */ +#define CAUSE_IP7 0x00004000 /* External level 7 pending */ +#define CAUSE_IP6 0x00002000 /* External level 6 pending */ +#define CAUSE_IP5 0x00001000 /* External level 5 pending */ +#define CAUSE_IP4 0x00000800 /* External level 4 pending */ +#define CAUSE_IP3 0x00000400 /* External level 3 pending */ +#define CAUSE_SW2 0x00000200 /* Software level 2 pending */ +#define CAUSE_SW1 0x00000100 /* Software level 1 pending */ + +/* extended interrupt cause bits (e.g., RM7000) */ +#define CAUSE_IP16 0x00800000 /* RESERVED */ +#define CAUSE_IP15 0x00400000 /* RESERVED */ +#define CAUSE_IP14 0x00200000 /* Perf counter */ +#define CAUSE_IP13 0x00100000 /* Alt Timer */ +#define CAUSE_IP12 0x00080000 /* External level 12 pending */ +#define CAUSE_IP11 0x00040000 /* External level 11 pending */ +#define CAUSE_IP10 0x00020000 /* External level 10 pending */ +#define CAUSE_IP9 0x00010000 /* External level 9 pending */ + +/* Note: mask includes extended interrupt bit positions */ +#define CAUSE_IPMASK 0x00FFFF00 /* Pending interrupt mask */ +#define CAUSE_IPSHIFT 8 + +#define CAUSE_EXCMASK 0x0000007C /* Cause code bits */ +#define CAUSE_EXCSHIFT 2 + +/* + * Status definition bits + */ +#define SR_CUMASK 0xf0000000 /* coproc usable bits */ +#define SR_CU3 0x80000000 /* Coprocessor 3 usable */ +#define SR_CU2 0x40000000 /* Coprocessor 2 usable */ +#define SR_CU1 0x20000000 /* Coprocessor 1 usable */ +#define SR_CU0 0x10000000 /* Coprocessor 0 usable */ +#define SR_RP 0x08000000 /* Use reduced power mode */ +#define SR_FR 0x04000000 /* Enable extra floating point regs */ +#define SR_RE 0x02000000 /* Reverse endian in user mode */ +#define SR_MX 0x01000000 /* Enable DSP/MX extensions */ +#define SR_BEV 0x00400000 /* use boot exception vectors */ +#define SR_TS 0x00200000 /* TLB shutdown */ +#define SR_SR 0x00100000 /* soft reset occurred */ +#define SR_CH 0x00040000 /* cache hit */ +#define SR_CE 0x00020000 /* use ECC reg */ +#define SR_DE 0x00010000 /* disable cache errors */ +#define SR_IMASK 0x0000ff00 /* Interrupt mask */ +#define SR_IMASK8 0x00000000 /* mask level 8 */ +#define SR_IMASK7 0x00008000 /* mask level 7 */ +#define SR_IMASK6 0x0000c000 /* mask level 6 */ +#define SR_IMASK5 0x0000e000 /* mask level 5 */ +#define SR_IMASK4 0x0000f000 /* mask level 4 */ +#define SR_IMASK3 0x0000f800 /* mask level 3 */ +#define SR_IMASK2 0x0000fc00 /* mask level 2 */ +#define SR_IMASK1 0x0000fe00 /* mask level 1 */ +#define SR_IMASK0 0x0000ff00 /* mask level 0 */ +#define SR_IBIT8 0x00008000 /* bit level 8 */ +#define SR_IBIT7 0x00004000 /* bit level 7 */ +#define SR_IBIT6 0x00002000 /* bit level 6 */ +#define SR_IBIT5 0x00001000 /* bit level 5 */ +#define SR_IBIT4 0x00000800 /* bit level 4 */ +#define SR_IBIT3 0x00000400 /* bit level 3 */ +#define SR_IBIT2 0x00000200 /* bit level 2 */ +#define SR_IBIT1 0x00000100 /* bit level 1 */ + +#define SR_IMASKSHIFT 8 + +/* R4K specific */ +#define SR_KX 0x00000080 /* enable kernel 64bit addresses */ +#define SR_SX 0x00000040 /* enable supervisor 64bit addresses */ +#define SR_UX 0x00000020 /* enable user 64bit addresses */ +#define SR_KSUMASK 0x00000018 /* mode mask */ +#define SR_KSU_K 0x00000000 /* kernel mode */ +#define SR_KSU_S 0x00000008 /* supervisor mode */ +#define SR_KSU_U 0x00000010 /* user mode */ +#define SR_ERL 0x00000004 /* Error Level */ +#define SR_EXL 0x00000002 /* Exception Level */ +#define SR_IE 0x00000001 /* interrupt enable, 1 => enable */ + +/* + * fpa definitions + */ + +#define FP_ROUND 0x3 /* r4010 round mode mask */ +#define FP_STICKY 0x7c /* r4010 sticky bits mask */ +#define FP_ENABLE 0xf80 /* r4010 enable mode mask */ +#define FP_EXC 0x3f000 /* r4010 exception mask */ + +#define FP_ROUND_N 0x0 /* round to nearest */ +#define FP_ROUND_Z 0x1 /* round to zero */ +#define FP_ROUND_P 0x2 /* round to + infinity */ +#define FP_ROUND_M 0x3 /* round to - infinity */ + +#define FP_STICKY_I 0x4 /* sticky inexact operation */ +#define FP_STICKY_U 0x8 /* sticky underflow */ +#define FP_STICKY_O 0x10 /* sticky overflow */ +#define FP_STICKY_Z 0x20 /* sticky divide by zero */ +#define FP_STICKY_V 0x40 /* sticky invalid operation */ + +#define FP_ENABLE_I 0x80 /* enable inexact operation */ +#define FP_ENABLE_U 0x100 /* enable underflow exc */ +#define FP_ENABLE_O 0x200 /* enable overflow exc */ +#define FP_ENABLE_Z 0x400 /* enable divide by zero exc */ +#define FP_ENABLE_V 0x800 /* enable invalid operation exc */ + +#define FP_EXC_I 0x1000 /* inexact operation */ +#define FP_EXC_U 0x2000 /* underflow */ +#define FP_EXC_O 0x4000 /* overflow */ +#define FP_EXC_Z 0x8000 /* divide by zero */ +#define FP_EXC_V 0x10000 /* invalid operation */ +#define FP_EXC_E 0x20000 /* unimplemented operation */ + +#define FP_COND 0x800000 /* condition bit */ +#define FP_FS 0x1000000 /* flush denormalised results to zero */ + +#define FP_EXC_SHIFT 12 +#define FP_ENABLE_SHIFT 7 +#define FP_EXC_MASK (FP_EXC_I|FP_EXC_U|FP_EXC_O|FP_EXC_Z|FP_EXC_V|FP_EXC_E) +#define FP_ENABLE_MASK (FP_ENABLE_I|FP_ENABLE_U|FP_ENABLE_O|FP_ENABLE_Z| \ + FP_ENABLE_V) +#define FP_TASK_STATUS (FP_FS) /* all FP exceptions are disabled + we only attempt to hide denormalised + results for signals (see fppALib.s + and spr #7665) */ + +/* + * R4000 Config Register + */ +#define CFG_CM 0x80000000 /* Master-Checker mode */ +#define CFG_ECMASK 0x70000000 /* System Clock Ratio */ +#define CFG_ECBY2 0x00000000 /* divide by 2 */ +#define CFG_ECBY3 0x00000000 /* divide by 3 */ +#define CFG_ECBY4 0x00000000 /* divide by 4 */ +#define CFG_EPMASK 0x0f000000 /* Transmit data pattern */ +#define CFG_EPD 0x00000000 /* D */ +#define CFG_EPDDX 0x01000000 /* DDX */ +#define CFG_EPDDXX 0x02000000 /* DDXX */ +#define CFG_EPDXDX 0x03000000 /* DXDX */ +#define CFG_EPDDXXX 0x04000000 /* DDXXX */ +#define CFG_EPDDXXXX 0x05000000 /* DDXXXX */ +#define CFG_EPDXXDXX 0x06000000 /* DXXDXX */ +#define CFG_EPDDXXXXX 0x07000000 /* DDXXXXX */ +#define CFG_EPDXXXDXXX 0x08000000 /* DXXXDXXX */ +#define CFG_SBMASK 0x00c00000 /* Secondary cache block size */ +#define CFG_SBSHIFT 22 +#define CFG_SB4 0x00000000 /* 4 words */ +#define CFG_SB8 0x00400000 /* 8 words */ +#define CFG_SB16 0x00800000 /* 16 words */ +#define CFG_SB32 0x00c00000 /* 32 words */ +#define CFG_SS 0x00200000 /* Split secondary cache */ +#define CFG_SW 0x00100000 /* Secondary cache port width */ +#define CFG_EWMASK 0x000c0000 /* System port width */ +#define CFG_EWSHIFT 18 +#define CFG_EW64 0x00000000 /* 64 bit */ +#define CFG_EW32 0x00010000 /* 32 bit */ +#define CFG_SC 0x00020000 /* Secondary cache absent */ +#define CFG_SM 0x00010000 /* Dirty Shared mode disabled */ +#define CFG_BE 0x00008000 /* Big Endian */ +#define CFG_EM 0x00004000 /* ECC mode enable */ +#define CFG_EB 0x00002000 /* Block ordering */ +#define CFG_ICMASK 0x00000e00 /* Instruction cache size */ +#define CFG_ICSHIFT 9 +#define CFG_DCMASK 0x000001c0 /* Data cache size */ +#define CFG_DCSHIFT 6 +#define CFG_IB 0x00000020 /* Instruction cache block size */ +#define CFG_DB 0x00000010 /* Data cache block size */ +#define CFG_CU 0x00000008 /* Update on Store Conditional */ +#define CFG_K0MASK 0x00000007 /* KSEG0 coherency algorithm */ + +/* + * Primary cache mode + */ +#define CFG_C_UNCACHED 2 +#define CFG_C_NONCOHERENT 3 +#define CFG_C_COHERENTXCL 4 +#define CFG_C_COHERENTXCLW 5 +#define CFG_C_COHERENTUPD 6 + +/* + * Primary Cache TagLo + */ +#define TAG_PTAG_MASK 0xffffff00 /* Primary Tag */ +#define TAG_PTAG_SHIFT 0x00000008 +#define TAG_PSTATE_MASK 0x000000c0 /* Primary Cache State */ +#define TAG_PSTATE_SHIFT 0x00000006 +#define TAG_PARITY_MASK 0x0000000f /* Primary Tag Parity */ +#define TAG_PARITY_SHIFT 0x00000000 + + +/* + * Secondary Cache TagLo + */ +#define TAG_STAG_MASK 0xffffe000 /* Secondary Tag */ +#define TAG_STAG_SHIFT 0x0000000d +#define TAG_SSTATE_MASK 0x00001c00 /* Secondary Cache State */ +#define TAG_SSTATE_SHIFT 0x0000000a +#define TAG_VINDEX_MASK 0x00000380 /* Secondary Virtual Index */ +#define TAG_VINDEX_SHIFT 0x00000007 +#define TAG_ECC_MASK 0x0000007f /* Secondary Tag ECC */ +#define TAG_ECC_SHIFT 0x00000000 +#define TAG_STAG_SIZE 19 /* Secondary Tag Width */ + +/* MIPS32/MIPS64 CP0 Register 16 Select 1 defines */ + +#define CFG1_MMUMASK 0x7e000000 /* MMU size field */ +#define CFG1_MMUSHIFT 25 +#define CFG1_ISMASK 0x01c00000 /* icache sets per way */ +#define CFG1_ISSHIFT 22 +#define CFG1_ILMASK 0x00380000 /* icache line size */ +#define CFG1_ILSHIFT 19 +#define CFG1_IAMASK 0x00070000 /* icache associativity */ +#define CFG1_IASHIFT 16 +#define CFG1_DSMASK 0x0000e000 /* dcache sets per way */ +#define CFG1_DSSHIFT 13 +#define CFG1_DLMASK 0x00001c00 /* dcache line size */ +#define CFG1_DLSHIFT 10 +#define CFG1_DAMASK 0x00000380 /* dcache associativity */ +#define CFG1_DASHIFT 7 +#define CFG1_PC 0x00000010 /* perf counter implemented */ +#define CFG1_WR 0x00000008 /* watch reg implemented */ +#define CFG1_CA 0x00000004 /* code compression implemented */ +#define CFG1_EP 0x00000002 /* EJTAG implemented */ +#define CFG1_FP 0x00000001 /* FPU implemented */ +#define CFG1_CACHE_SETS_PER_WAY 64 /* base size for sets per way shifted + * left by the value in the CFG1 + * sets per way field + */ + +#define CFG1_CACHE_LINE_SIZE 2 /* base cache size shifted left by + * the value in the CFG1 cache line + * size field + */ + + +/* + * CacheErr register + */ +#define CACHEERR_TYPE 0x80000000 /* reference type: + 0=Instr, 1=Data */ +#define CACHEERR_LEVEL 0x40000000 /* cache level: + 0=Primary, 1=Secondary */ +#define CACHEERR_DATA 0x20000000 /* data field: + 0=No error, 1=Error */ +#define CACHEERR_TAG 0x10000000 /* tag field: + 0=No error, 1=Error */ +#define CACHEERR_REQ 0x08000000 /* request type: + 0=Internal, 1=External */ +#define CACHEERR_BUS 0x04000000 /* error on bus: + 0=No, 1=Yes */ +#define CACHEERR_BOTH 0x02000000 /* Data & Instruction error: + 0=No, 1=Yes */ +#define CACHEERR_ECC 0x01000000 /* ECC error : + 0=No, 1=Yes */ +#define CACHEERR_SIDX_MASK 0x003ffff8 /* PADDR(21..3) */ +#define CACHEERR_SIDX_SHIFT 3 +#define CACHEERR_PIDX_MASK 0x00000007 /* VADDR(14..12) */ +#define CACHEERR_PIDX_SHIFT 12 + + +/* + * Cache operations + */ +#define Index_Invalidate_I 0x0 /* 0 0 */ +#define Index_Writeback_Inv_D 0x1 /* 0 1 */ +#define Index_Invalidate_SI 0x2 /* 0 2 */ +#define Index_Writeback_Inv_SD 0x3 /* 0 3 */ +#define Index_Load_Tag_I 0x4 /* 1 0 */ +#define Index_Load_Tag_D 0x5 /* 1 1 */ +#define Index_Load_Tag_SI 0x6 /* 1 2 */ +#define Index_Load_Tag_SD 0x7 /* 1 3 */ +#define Index_Store_Tag_I 0x8 /* 2 0 */ +#define Index_Store_Tag_D 0x9 /* 2 1 */ +#define Index_Store_Tag_SI 0xA /* 2 2 */ +#define Index_Store_Tag_SD 0xB /* 2 3 */ +#define Create_Dirty_Exc_D 0xD /* 3 1 */ +#define Create_Dirty_Exc_SD 0xF /* 3 3 */ +#define Hit_Invalidate_I 0x10 /* 4 0 */ +#define Hit_Invalidate_D 0x11 /* 4 1 */ +#define Hit_Invalidate_SI 0x12 /* 4 2 */ +#define Hit_Invalidate_SD 0x13 /* 4 3 */ +#define Hit_Writeback_Inv_D 0x15 /* 5 1 */ +#define Hit_Writeback_Inv_SD 0x17 /* 5 3 */ +#define Fill_I 0x14 /* 5 0 */ +#define Hit_Writeback_D 0x19 /* 6 1 */ +#define Hit_Writeback_SD 0x1B /* 6 3 */ +#define Hit_Writeback_I 0x18 /* 6 0 */ +#define Lock_I 0x1C /* 7 0 */ +#define Lock_D 0x1D /* 7 1 */ +#define Hit_Set_Virtual_SI 0x1E /* 7 2 */ +#define Hit_Set_Virtual_SD 0x1F /* 7 3 */ + +/* + * Coprocessor 0 operations + */ +#define C0_READI 0x1 /* read ITLB entry addressed by C0_INDEX */ +#define C0_WRITEI 0x2 /* write ITLB entry addressed by C0_INDEX */ +#define C0_WRITER 0x6 /* write ITLB entry addressed by C0_RAND */ +#define C0_PROBE 0x8 /* probe for ITLB entry addressed by TLBHI */ +#define C0_ERET 0x18 /* restore for exception */ + +/* + * TLB definitions + */ +#define TLB_ENTRIES 64 /* set to size of largest supported core */ + +/* + * macros used in fppShow.c to word swap the 32 bit FP reg pair before printing + * double value if _WRS_FP_REGISTER_SIZE == 4 (e.g., MIPS32 hardware float). + */ +#if (_WRS_FP_REGISTER_SIZE == 4) +#define _WRS_NEED_DOUBLE_TMP + +/* word swap the 32 bits FP Reg. pair before printing double value. */ +#define _WRS_FP_REG_TEMP(ix) { \ + *(UINT32 *) fpDoubleTmp = \ + *(UINT32 *) (((UINT32)&fpRegSet + fpRegName[ix].regOff + sizeof(UINT32))); \ + *(UINT32 *) ((UINT32) fpDoubleTmp + sizeof(UINT32)) = \ + *(UINT32 *) (((UINT32)&fpRegSet + fpRegName[ix].regOff)); \ + fpTmp = fpDoubleTmp; \ + } +#endif /* _WRS_FP_REGISTER_SIZE == 4 */ + +/* moved here from h/private/javaLibP.h */ + +#define JAVA_C_SYM_PREFIX "" + +/* moved here from h/private/loadElfLibP.h */ + +/* Check whether the value fits in n bits */ + +#define CHECK_FITS(val,nBits) (((val) & ~(MASK(nBits))) == 0) + + +/* moved here from h/types/vxtypesOld.h */ + +#ifndef _ASMLANGUAGE +/* physical addresses are represented on 64-bit for all MIPS CPUs */ + +# define _TYPE_PHYS_ADDR typedef UINT64 PHYS_ADDR +#endif + +#define _WRS_PHYS_ADDR_IS_64_BITS + +#define CHAR_FROM_CONST(x) (char *)(x) +#define VOID_FROM_CONST(x) (void *)(x) + +/* trigger generation of regWidth field of the REG_INDEX struct in h/regs.h. */ + +#define _WRS_REG_INDEX_REGWIDTH + +/* from vmBaseLib.c */ + +/* #define _WRS_DISABLE_BASEVM */ + +/* from dbgTaskLib.c and wdbBpLib.c */ + + /* + * On MIPS CPUs, when a breakpoint exception occurs in a branch delay slot, + * the PC has been changed in the breakpoint handler to match with the + * breakpoint address. + * Once the matching has been made, the PC is modified to have its normal + * value (the preceding jump instruction). + */ + +#define _WRS_ADJUST_PC_FOR_BRANCH_DELAY(p) \ + {if ((p)->cause & CAUSE_BD) \ + (p)->reg_pc--;} + +/* from loadElfLib.c */ + +#define _WRS_USE_ELF_LOAD_FORMAT + +/* from spyLib.c */ + +#define _WRS_SPY_TASK_SIZE 10000 /* MIPS specific spy task size */ + +/* from usrLib.c */ + +#define _WRS_TASK_REG_WIDTH taskRegName[ix].regWidth +#define _WRS_FPCTL_REG_WIDTH fpCtlRegName[ix].regWidth + +/* from xdr_float.c */ + +#define FLOAT_NORM + +/* from vmShow.c */ + +/* #define _WRS_DISABLE_VM */ + +/* from taskShow.c */ + +#define _WRS_CUSTOM_TASK_ARCH_REGS_SHOW + +/* from bLib.c */ + +/*#define _WRS_BLIB_OPTIMIZED*/ + +/* from schedLib.c */ + +/*#define _WRS_SCHEDLIB_OPTIMIZED*/ +#define _WRS_BASE6_SCHEDULER + +/* + * Let the idle loop look like a real task by turning all ints on. + * Without this if a task locks interrupts and suspends itself, and + * there are no ready tasks, we will lockup. + */ + +#define _WRS_ENABLE_IDLE_INTS {intSRSet (taskSrDefault);} + +/* from sem*Lib.c, semA*Lib.s */ + +#define _WRS_HAS_OPTIMIZED_SEM +/*#define _WRS_USE_OPTIMIZED_SEM */ /* XXX use optimized sem, for now */ + +/* macros for getting frame and return PC from a jmp_buf */ + +#define _WRS_FRAMEP_FROM_JMP_BUF(env) ((char *) (env)[0].reg.spReg) +#define _WRS_RET_PC_FROM_JMP_BUF(env) ((INSTR *) (env)[0].reg.raReg) + +/* + * specify that MIPS architecture uses the linker to achieve data + * segment alignment. + */ +#define _WRS_LINKER_DATA_SEG_ALIGN + +/* Enable possibility of including OSM detection if mapped kernel */ + +#if defined(INCLUDE_MAPPED_KERNEL) +#define _WRS_OSM_INIT +#endif /* defined(INCLUDE_MAPPED_KERNEL) */ + +/* Trigger use of non-global null page. For an explanation, see the + * description in aimMmuLib.c in the function header for aimMmuLibInit. + */ + +#define _WRS_NONGLOBAL_NULL_PAGE + +/* Add define for PM_MMULESS_PAGE_SIZE. needed by pmLib.c so + * the ED&R area is created on a 8K boundary in all cases. the 8k + * boundary size specifies for MIPS the minimum page size. + */ + +#define PM_MMULESS_PAGE_SIZE 8192 + +/* define _ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK indicating support + * for guard pages on the interrupt stack + */ + +#define _ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK + +/* define _WRS_STACK_PROTECT_REQUIRES_MMU to indicate all stack + * protection support features require MMU support on MIPS + */ + +#define _WRS_STACK_PROTECT_REQUIRES_MMU + +#include "arch/mips/archMipsCommon.h" + +/* END PAL */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCarchMipsh */ diff --git a/h/arch/mips/archMipsCommon.h b/h/arch/mips/archMipsCommon.h new file mode 100644 index 0000000..74ecf25 --- /dev/null +++ b/h/arch/mips/archMipsCommon.h @@ -0,0 +1,76 @@ +/* archMipsCommon.h - common Mips architecture specific header */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* + * This file has been developed or significantly modified by the + * MIPS Center of Excellence Dedicated Engineering Staff. + * This notice is as per the MIPS Center of Excellence Master Partner + * Agreement, do not remove this notice without checking first with + * WR/Platforms MIPS Center of Excellence engineering management. + */ + +/* +modification history +-------------------- +01h,30sep04,pes added define of _WRS_NO_BITS_PHYS_ADDR +01g,01oct04,tam moved definition of _TYPE_PHYS_ADDR to the kernel + architecture scpecific header +01f,17sep04,pes moved _TYPE_PHYS_ADDDR and _WRS_PHYS_ADDR_IS_64_BITS here + from archMips.h +01e,22mar04,zl moved trcLib_PORTABLE, _RType and INSTR definitions here. +01d,17mar04,pes Enable Coprocessor Abstraction +01c,25nov03,pes Moved definition of _BYTE_ORDER to archMipsCommon.h. +01b,12nov03,job Moved some blib stuff from archMips.h +01a,11nov03,pes written. +*/ + +#ifndef __INCarchMipsCommonh +#define __INCarchMipsCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +#define _WRS_PAL_COPROC_LIB /* enable coprocessor abstraction */ + +/* from bLib.c */ + +#define _WRS_BLIB_ALIGNMENT 3 /* quad byte alignment mask */ +#define swab_PORTABLE + +#define trcLib_PORTABLE /* dbgTrcLib.c */ + +#ifndef _ASMLANGUAGE +typedef unsigned long INSTR; /* 32 bit word-aligned instructions */ + +#if (CPU == MIPS32) +typedef unsigned long _RType; /* registers are 32 bits */ +#elif (CPU == MIPS64) +typedef unsigned long long _RType; /* registers are 64 bits */ +#else /* CPU */ +#error "Invalid CPU value" +#endif /* CPU */ + +#endif /* _ASMLANGUAGE */ +#define _WRS_NO_BITS_PHYS_ADDR 64 + +#if defined(MIPSEB) || defined(__MIPSEB__) +#undef _BYTE_ORDER +#define _BYTE_ORDER _BIG_ENDIAN +#elif defined(MIPSEL) || defined(__MIPSEL__) +#undef _BYTE_ORDER +#define _BYTE_ORDER _LITTLE_ENDIAN +#else +#warning "One of MIPSEL or MIPSEB must be defined" +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCarchMipsCommonh */ + + + + diff --git a/h/arch/mips/asmMips.h b/h/arch/mips/asmMips.h new file mode 100644 index 0000000..38fb437 --- /dev/null +++ b/h/arch/mips/asmMips.h @@ -0,0 +1,414 @@ +/* asmMips.h - assembler definitions header file */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* + * This file has been developed or significantly modified by the + * MIPS Center of Excellence Dedicated Engineering Staff. + * This notice is as per the MIPS Center of Excellence Master Partner + * Agreement, do not remove this notice without checking first with + * WR/Platforms MIPS Center of Excellence engineering management. + */ + +/* +modification history +-------------------- +01t,17jun04,pes Add definition of _RTypeSize. +01s,05may04,pes Correct build failures caused by 01r. +01r,28apr04,pes Adjusting hazard include file mechanism. +01q,23oct02,jmt Modified to handle Arch Specific hazards +01p,01aug01,mem Changes to support diab. +01o,16jul01,ros add CofE comment +01n,20apr01,roz Added SWC1/LWC1 +01m,09apr01,mem Correct stack frame macros for MIPS64 +01l,09feb01,tlc Introduce HAZARD macro definitions. +01k,03jan01,pes Added GTEXT and GDATA for declaring functions and data +01j,19jan99,dra added CW4000, CW4011, VR4100, VR5000 and VR5400 support. + fixed SETFRAME macro to keep stack 8-byte aligned. +01i,18apr97,kkk added C0_PRID for R3000. (SPR# 8321) +01h,22nov96,kkk add back C0_TLBHI for R3000. +01g,21nov96,kkk enabled SW/LW for R4650. +01g,14oct96,kkk added R4650 support. +01f,15oct93,cd added R4000 support; defined frame macros. +01e,22sep92,rrr added support for c++ +01d,03jun92,ajm updated file name referenced to match real name +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -changed copyright notice +01a,21feb91,ajm written. +*/ + +#ifndef __INCasmMipsh +#define __INCasmMipsh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The LEADING_UNDERSCORE macro should be defined to TRUE for toolchains + * that do NOT prefix a leading underscore character, i.e. "_", to + * symbols. Define the macro to FALSE when using a toolchain that + * does add a leading underscore character to symbols. + */ + +#define LEADING_UNDERSCORE FALSE + +#if (LEADING_UNDERSCORE == TRUE) +#define FUNC(func) _##func +#define FUNC_LABEL(func) _##func: +#else +#define FUNC(func) func +#define FUNC_LABEL(func) func: +#endif + +#define FUNC_DECL(range,func) +#define VAR_DECL(var) var +#define VAR(var) var(r0) + +/* + * These macros are used to declare assembly language symbols that need + * to be typed properly(func or data) to be visible to the OMF tool. + * So that the build tool could mark them as an entry point to be linked + * by another PD. + */ + +#define GTEXT(sym) FUNC(sym) ; .type FUNC(sym),@function +#define GDATA(sym) FUNC(sym) ; .type FUNC(sym),@object + +#define FUNCREF(func) func + + +/* +* MIPS register definitions +*/ + +#define zero $0 /* wired zero */ +#define AT $at /* assembler temp */ +#define v0 $2 /* return reg 0 */ +#define v1 $3 /* return reg 1 */ +#define a0 $4 /* arg reg 0 */ +#define a1 $5 /* arg reg 1 */ +#define a2 $6 /* arg reg 2 */ +#define a3 $7 /* arg reg 3 */ +#define t0 $8 /* caller saved 0 */ +#define t1 $9 /* caller saved 1 */ +#define t2 $10 /* caller saved 2 */ +#define t3 $11 /* caller saved 3 */ +#define t4 $12 /* caller saved 4 */ +#define t5 $13 /* caller saved 5 */ +#define t6 $14 /* caller saved 6 */ +#define t7 $15 /* caller saved 7 */ +#define s0 $16 /* callee saved 0 */ +#define s1 $17 /* callee saved 1 */ +#define s2 $18 /* callee saved 2 */ +#define s3 $19 /* callee saved 3 */ +#define s4 $20 /* callee saved 4 */ +#define s5 $21 /* callee saved 5 */ +#define s6 $22 /* callee saved 6 */ +#define s7 $23 /* callee saved 7 */ +#define t8 $24 /* caller saved 8 */ +#define t9 $25 /* caller saved 9 */ +#define k0 $26 /* kernel temp 0 */ +#define k1 $27 /* kernel temp 1 */ +#define gp $28 /* global pointer */ +#define sp $29 /* stack pointer */ +#define s8 $30 /* callee saved 8 */ +#define ra $31 /* return address */ + +/* +* MIPS Coprocessor 0 regs +*/ +#define C0_IBASE $0 /* R4650: instruction base xlate address */ +#define C0_IBOUND $1 /* R4650: instruction xlate address bound */ +#define C0_DBASE $2 /* R4650: data base xlate address */ +#define C0_DBOUND $3 /* R4650: data xlate address bound */ +#define C0_INX $0 /* tlb index */ +#define C0_RAND $1 /* tlb random */ + +/* Begin CPUs: R3000, CW4000, CW4011 */ +#define C0_TLBLO $2 /* tlb entry low */ +/* End R3000, CW4000, CW4011 */ + +/* Begin CPUs: R4000, VR5000, VR5400, VR4100 */ +#define C0_TLBLO0 $2 /* tlb entry low 0 */ +#define C0_TLBLO1 $3 /* tlb entry low 1 */ +/* End R4000, VR5000, VR5400, VR4100 */ + +#define C0_CTXT $4 /* tlb context */ + +/* Begin CPUs: R4000, VR5000, VR5400, VR4100 */ +#define C0_PAGEMASK $5 /* page mask */ +#define C0_WIRED $6 /* lb wired entries */ +/* End R4000, VR5000, VR5400, VR4100 */ + +#define C0_BADVADDR $8 /* bad virtual address */ + +/* Begin CPUs: R4000, R4650, VR5000, VR5400, CW4011, VR4100 */ +#define C0_COUNT $9 /* count */ +/* End R4000, R4650, VR5000, VR5400, CW4011, VR4100 */ + +/* Begin CPUs: R4000, VR5000, VR5400, R3000, CW4000, CW4011, VR4100 */ +#define C0_TLBHI $10 /* tlb entry hi */ +/* End R4000, VR5000, VR5400, R3000, CW4000, CW4011, VR4100 */ + +/* Begin CPUs: R4000, VR5000, VR5400, R4650, CW4011, VR4100 */ +#define C0_COMPARE $11 /* compare */ +/* End R4000, VR5000, VR5400, R4650, CW4011, VR4100*/ + +#define C0_SR $12 /* status register */ +#define C0_CAUSE $13 /* exception cause */ +#define C0_EPC $14 /* exception pc */ + +#define C0_PRID $15 + +/* Begin CPUs: R4000, R4650, VR5000, VR5400, VR4100, CW4011 */ +#define C0_CONFIG $16 + +#define C0_CALG $17 /* R4650: cache algorithm register */ +#define C0_LLADDR $17 + +#define C0_IWATCH $18 /* R4650: instruction virt addr for watch */ +#define C0_WATCHLO $18 + +#define C0_DWATCH $19 /* R4650: data virt addr for watch */ +#define C0_WATCHHI $19 + +#define C0_ECC $26 +#define C0_CACHEERR $27 +#define C0_TAGLO $28 + +/* Begin CPUs: R4000, VR5000, VR5400, VR4100 */ +#define C0_TAGHI $29 +/* End R4000, VR5000, VR5400, VR4100 */ + +#define C0_ERRPC $30 +/* End R4000, R4650, VR5000, VR5400, VR4100, CW4011 */ + +/* +* MIPS floating point coprocessor register definitions +*/ + +#define fp0 $f0 /* return reg 0 */ +#define fp1 $f1 /* return reg 1 */ +#define fp2 $f2 /* return reg 2 */ +#define fp3 $f3 /* return reg 3 */ +#define fp4 $f4 /* caller saved 0 */ +#define fp5 $f5 /* caller saved 1 */ +#define fp6 $f6 /* caller saved 2 */ +#define fp7 $f7 /* caller saved 3 */ +#define fp8 $f8 /* caller saved 4 */ +#define fp9 $f9 /* caller saved 5 */ +#define fp10 $f10 /* caller saved 6 */ +#define fp11 $f11 /* caller saved 7 */ +#define fp12 $f12 /* arg reg 0 */ +#define fp13 $f13 /* arg reg 1 */ +#define fp14 $f14 /* arg reg 2 */ +#define fp15 $f15 /* arg reg 3 */ +#define fp16 $f16 /* caller saved 8 */ +#define fp17 $f17 /* caller saved 9 */ +#define fp18 $f18 /* caller saved 10 */ +#define fp19 $f19 /* caller saved 11 */ +#define fp20 $f20 /* callee saved 0 */ +#define fp21 $f21 /* callee saved 1 */ +#define fp22 $f22 /* callee saved 2 */ +#define fp23 $f23 /* callee saved 3 */ +#define fp24 $f24 /* callee saved 4 */ +#define fp25 $f25 /* callee saved 5 */ +#define fp26 $f26 /* callee saved 6 */ +#define fp27 $f27 /* callee saved 7 */ +#define fp28 $f28 /* callee saved 8 */ +#define fp29 $f29 /* callee saved 9 */ +#define fp30 $f30 /* callee saved 10 */ +#define fp31 $f31 /* callee saved 11 */ + +#define C1_IR $0 /* implementation/revision reg */ +#define C1_SR $31 /* control/status reg */ + +/* +* define aliases for operations that are different in 64bit mode +*/ +#if (_WRS_INT_REGISTER_SIZE == 4) +#define SW sw +#define LW lw +#define MFC0 mfc0 +#define MTC0 mtc0 +#elif (_WRS_INT_REGISTER_SIZE == 8) +#define SW sd /* storing machine registers */ +#define LW ld /* loading machine registers */ +#define MFC0 dmfc0 /* reading wide cop0 register */ +#define MTC0 dmtc0 /* writing wide cop0 register */ +#else /* _WRS_INT_REGISTER_SIZE */ +#error "invalid _WRS_INT_REGISTER_SIZE value" +#endif /* _WRS_INT_REGISTER_SIZE */ + +#define _RTypeSize _WRS_INT_REGISTER_SIZE + +#if (_WRS_FP_REGISTER_SIZE == 4) +#define SWC1 swc1 +#define LWC1 lwc1 +#define MFC1 mfc1 +#define MTC1 mtc1 +#elif (_WRS_FP_REGISTER_SIZE == 8) +#define SWC1 sdc1 +#define LWC1 ldc1 +#define MFC1 dmfc1 /* reading wide fp register */ +#define MTC1 dmtc1 /* writing wide fp register */ +#elif /* _WRS_FP_REGISTER_SIZE */ +#error "invalid _WRS_FP_REGISTER_SIZE value" +#endif /* _WRS_FP_REGISTER_SIZE */ + +/* Hazard definitions */ + +/* A MIPS Hazard is defined as any combination of instructions which + * would cause unpredictable behavior in terms of pipeline delays, + * cache misses, and exceptions. Hazards are defined by the number + * of CPU cycles that must pass between certain combinations of + * instructions. Because some MIPS CPUs single-issue nop instructions + * while others dual-issue, the CPU cycles defined below are done so + * according to the instruction issue mechanism available. + */ +#define SINGLE_ISSUE 0 +#define DUAL_ISSUE 1 +#define CPU_CYCLES DUAL_ISSUE + +/* Using the issue mechanism definitions above, the MIPS CPU cycles + * are defined below. + */ + +#define ssnop .word 0x00000040 + +#if (CPU_CYCLES == SINGLE_ISSUE) +#define CPU_CYCLES_ONE ssnop +#define CPU_CYCLES_TWO ssnop; ssnop +#elif (CPU_CYCLES == DUAL_ISSUE) +#define CPU_CYCLES_ONE ssnop; ssnop +#define CPU_CYCLES_TWO ssnop; ssnop; ssnop; ssnop +#endif + +/* Sixteen instructions are required to handle the VR5432 errata in + * order to fill its instruction prefetch. See HAZARD_VR5400 macro + * for details. + */ +#define CPU_CYCLES_SIXTEEN ssnop; ssnop; ssnop; ssnop; \ + ssnop; ssnop; ssnop; ssnop; \ + ssnop; ssnop; ssnop; ssnop; \ + ssnop; ssnop; ssnop; ssnop + +/* To assist with handling MIPS hazards, a number of categories of + * hazards have been defined here. + * + * HAZARD_TLB After modifying tlb CP0 registers, do not use the + * TLB for two CPU cycles. + * HAZARD_ERET After modifying the SR, do not return from an + * exception for two CPU cycles. + * HAZARD_INTERRUPT After modifying the SR, interrupts do not lock + * for two CPU cycles. + * HAZARD_CP_READ After a read from a Coprocessor register, the + * result is not available for one CPU cycle. + * HAZARD_CP_WRITE After a write to a Coprocessor register, the + * result is not effective for two CPU cycles. + * HAZARD_CACHE_TAG Cache TAG load and store instructions should + * not be used withing one CPU cycle of modifying + * the TAG registers. + * HAZARD_CACHE Cache instructions should not be used within 2 + * CPU cycles of each other. + * HAZARD_VR5400 For the VR5432 CPU only. Serialized instructions + * (mtc0, ctc0, mfc0, cfc0, etc) must not appear within + * 16 instructions after a conditional branch or label. + * + * These hazard macros are intended for use with MIPS architecture- + * dependent assembly files which require handling hazards. For example, + * suppose interrupts are being locked, to address the hazard, please + * do the following: + * + * mtc0 t0, C0_SR + * HAZARD_INTERRUPT + * lw t0, 0(a0) + * + * Similarly, when reading from a coprocessor register, please do the + * following: + * + * mfc0 t0, C0_SR + * HAZARD_CP_READ + * and t0, t0, t1 + * mtc0 t0, C0_SR + * HAZARD_CP_WRITE + * + * + * For more details on these categories, please refer to MIPS hazard + * documentation. + */ + +/* Hazard macros */ +/* If this arch requires non-standard Hazard defs, include the hazard file + * defined for this arch. Otherwise, use the defaults. + */ + +#define HAZARD_STRINGIFY(x) #x +#define HAZARD_HDR(file) HAZARD_STRINGIFY(arch/mips/file) +#define HAZARD_INCLUDE(file) HAZARD_HDR(HAZARD_FILE) + +#ifdef HAZARD_FILE +#include HAZARD_INCLUDE(file) +#else +#define HAZARD_TLB CPU_CYCLES_TWO +#define HAZARD_ERET CPU_CYCLES_TWO +#define HAZARD_CP_READ CPU_CYCLES_ONE +#define HAZARD_CP_WRITE CPU_CYCLES_TWO +#define HAZARD_CACHE_TAG CPU_CYCLES_ONE +#define HAZARD_CACHE CPU_CYCLES_TWO +#define HAZARD_INTERRUPT CPU_CYCLES_TWO +#endif + +#ifdef _WRS_MIPS_VR5400_ERRATA +#define HAZARD_VR5400 CPU_CYCLES_SIXTEEN +#else +#define HAZARD_VR5400 +#endif + +/* + * Stack frame allocation. + * These macros are used in assembly language routines to automate the + * allocation and use of stack frames. + */ + +/* Return the size of the frame for the named routine */ +#define FRAMESZ(routine) _##routine##Fsize +/* + * Calculate the frame size for the named routine + * 4 register slots allocated for subroutines to store argument registers + * 8 bytes are allocated for saving RA (independent of register size). + * nregs register locations are reserved for storing locally used registers. + * stack is kept 8-byte aligned. + */ +#define SETFRAME_EXTRA(routine,nregs,extra) \ + FRAMESZ(routine) = ((((_RTypeSize)*(4+(nregs)))+8+(extra)+7) & ~0x07) +#define SETFRAME(routine,nregs) \ + SETFRAME_EXTRA(routine,nregs,0) + +/* The location at which to store the return address */ +#define FRAMERA(routine) \ + (FRAMESZ(routine)-8) + +/* Locations at which to store locally used registers */ +#define FRAMER(routine,regn) \ + ((_RTypeSize)*(4+(regn))) +#define FRAMER0(routine) FRAMER(routine,0) +#define FRAMER1(routine) FRAMER(routine,1) +#define FRAMER2(routine) FRAMER(routine,2) +#define FRAMER3(routine) FRAMER(routine,3) + +/* Locations at which to store argument registers */ +#define FRAMEA(routine, regn) \ + (FRAMESZ(routine)+(_RTypeSize)*(regn)) +#define FRAMEA0(routine) FRAMEA(routine,0) +#define FRAMEA1(routine) FRAMEA(routine,1) +#define FRAMEA2(routine) FRAMEA(routine,2) +#define FRAMEA3(routine) FRAMEA(routine,3) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCasmMipsh */ diff --git a/h/arch/mips/cacheMipsLib.h b/h/arch/mips/cacheMipsLib.h new file mode 100644 index 0000000..3a27e14 --- /dev/null +++ b/h/arch/mips/cacheMipsLib.h @@ -0,0 +1,147 @@ +/* cacheMipsLib.h - MIPS cache library header file */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* + * This file has been developed or significantly modified by the + * MIPS Center of Excellence Dedicated Engineering Staff. + * This notice is as per the MIPS Center of Excellence Master Partner + * Agreement, do not remove this notice without checking first with + * WR/Platforms MIPS Center of Excellence engineering management. + */ + +/* +modification history +-------------------- +01l,27may03,jmt Modify after cache library review +01k,07may03,jmt Add mti20kx family support +01j,01oct02,jmt added tx79xx support and made mods for comments from + design review +01i,17may02,zmm Global au1000 name changes. SPR 77333. +01i,14may02,jmt Added Tx49xx cache library support +01h,13dec01,sru add prototype for Vr4131 cache lib +01g,16jul01,ros add CofE comment +01f,09jul01,mem Added generic MIPS cache op prototypes. +01e,19jan99,dra added CW4000, CW4011, VR4100, VR5000 and VR5400 support. +01d,15jul96,kkk added R4650 support +01c,15oct93,cd added R4000 supoort. +01b,22sep92,rrr added support for c++ +01a,07jul92,ajm created. +*/ + +#ifndef __INCcacheMipsLibh +#define __INCcacheMipsLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "cacheLib.h" + +#ifndef _ASMLANGUAGE + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT void * cacheMipsMalloc (size_t bytes); +IMPORT STATUS cacheMipsFree (void * pBuf); +IMPORT void * cacheMipsVirtToPhys (void * address); +IMPORT void * cacheMipsPhysToVirt (void * address); +IMPORT STATUS cacheMipsPipeFlush (void); + +IMPORT STATUS cache4kcLibInit (CACHE_MODE instMode, CACHE_MODE dataMode, + UINT32 iCacheSize, UINT32 iCacheLineSize, + UINT32 dCacheSize, UINT32 dCacheLineSize); + +IMPORT STATUS cache20kxLibInit (CACHE_MODE instMode, CACHE_MODE dataMode, + UINT32 iCacheSize, UINT32 iCacheLineSize, + UINT32 dCacheSize, UINT32 dCacheLineSize, + UINT32 sCacheSize, UINT32 sCacheLineSize, + UINT32 tCacheSize, UINT32 tCacheLineSize); + +IMPORT STATUS cacheAuLibInit (CACHE_MODE instMode, CACHE_MODE dataMode, + UINT32 iCacheSize, UINT32 iCacheLineSize, + UINT32 dCacheSize, UINT32 dCacheLineSize); + +IMPORT STATUS cacheCW400xLibInit (CACHE_MODE instMode, CACHE_MODE dataMode); + +IMPORT STATUS cacheCW4011LibInit (CACHE_MODE instMode, CACHE_MODE dataMode); + +IMPORT STATUS cacheR32kLibInit (CACHE_MODE instMode, CACHE_MODE dataMode); + +IMPORT STATUS cacheR33kLibInit (CACHE_MODE instMode, CACHE_MODE dataMode, + UINT32 iCacheSize, UINT32 iCacheLineSize, + UINT32 dCacheSize, UINT32 dCacheLineSize); + +IMPORT STATUS cacheR3kLibInit (CACHE_MODE instMode, CACHE_MODE dataMode); + +IMPORT STATUS cacheR4kLibInit (CACHE_MODE instMode, CACHE_MODE dataMode, + UINT32 iCacheSize, UINT32 iCacheLineSize, + UINT32 dCacheSize, UINT32 dCacheLineSize, + UINT32 sCacheSize, UINT32 sCacheLineSize); + +IMPORT STATUS cacheR5kLibInit (CACHE_MODE instMode, CACHE_MODE dataMode, + UINT32 iCacheSize, UINT32 iCacheLineSize, + UINT32 dCacheSize, UINT32 dCacheLineSize, + UINT32 sCacheSize, UINT32 sCacheLineSize); + +IMPORT STATUS cacheR7kLibInit (CACHE_MODE instMode, CACHE_MODE dataMode, + UINT32 iCacheSize, UINT32 iCacheLineSize, + UINT32 dCacheSize, UINT32 dCacheLineSize, + UINT32 sCacheSize, UINT32 sCacheLineSize, + UINT32 tCacheSize, UINT32 tCacheLineSize); + +IMPORT STATUS cacheR10kLibInit (CACHE_MODE instMode, CACHE_MODE dataMode, + UINT32 iCacheSize, UINT32 iCacheLineSize, + UINT32 dCacheSize, UINT32 dCacheLineSize, + UINT32 sCacheSize, UINT32 sCacheLineSize); + +IMPORT STATUS cacheTx49LibInit (CACHE_MODE instMode, CACHE_MODE dataMode, + UINT32 iCacheSize, UINT32 iCacheLineSize, + UINT32 dCacheSize, UINT32 dCacheLineSize); + +IMPORT STATUS cacheTx79LibInit (CACHE_MODE instMode, CACHE_MODE dataMode, + UINT32 iCacheSize, UINT32 iCacheLineSize, + UINT32 dCacheSize, UINT32 dCacheLineSize); + +IMPORT STATUS cacheVr4131LibInit (CACHE_MODE instMode, CACHE_MODE dataMode, + UINT32 iCacheSize, UINT32 iCacheLineSize, + UINT32 dCacheSize, UINT32 dCacheLineSize, + UINT32 sCacheSize, UINT32 sCacheLineSize); + + +#else /* __STDC__ */ + +IMPORT void * cacheMipsMalloc (); +IMPORT STATUS cacheMipsFree (); +IMPORT void * cacheMipsVirtToPhys (); +IMPORT void * cacheMipsPhysToVirt (); +IMPORT STATUS cacheMipsPipeFlush (); + +IMPORT STATUS cache4kcLibInit (); +IMPORT STATUS cache20kxLibInit (); +IMPORT STATUS cacheAuLibInit (); +IMPORT STATUS cacheCW400xLibInit (); +IMPORT STATUS cacheCW4011LibInit (); +IMPORT STATUS cacheR32kLibInit (); +IMPORT STATUS cacheR33kLibInit (); +IMPORT STATUS cacheR3kLibInit (); +IMPORT STATUS cacheR4kLibInit (); +IMPORT STATUS cacheR5kLibInit (); +IMPORT STATUS cacheR7kLibInit (); +IMPORT STATUS cacheR10kLibInit (); +IMPORT STATUS cacheTx49LibInit (); +IMPORT STATUS cacheTx79LibInit (); +IMPORT STATUS cacheVr4131LibInit (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcacheMipsLibh */ diff --git a/h/arch/mips/coprocMips.h b/h/arch/mips/coprocMips.h new file mode 100644 index 0000000..fb2867b --- /dev/null +++ b/h/arch/mips/coprocMips.h @@ -0,0 +1,38 @@ +/* coprocMips.h - coprocessor management library header */ + +/* + * Copyright (C) 2003, 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01b,27jul05,pes Add define for VX_DSP_TASK +01a,11apr03,pes Created +*/ + +#ifndef __INCcoprocMipsh +#define __INCcoprocMipsh + +#ifdef __cplusplus +extern "C" { +#endif + +/* inlcudes */ + +#include "taskLib.h" + +/* defines */ + +#define VX_FP_TASK VX_COPROC1_TASK +#define VX_DSP_TASK VX_COPROC2_TASK + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcoprocMipsh */ diff --git a/h/arch/mips/dbgMipsLib.h b/h/arch/mips/dbgMipsLib.h new file mode 100644 index 0000000..ba2c913 --- /dev/null +++ b/h/arch/mips/dbgMipsLib.h @@ -0,0 +1,182 @@ +/* dbgMipsLib.h - MIPS debugger header */ + +/* + * Copyright 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* + * This file has been developed or significantly modified by the + * MIPS Center of Excellence Dedicated Engineering Staff. + * This notice is as per the MIPS Center of Excellence Master Partner + * Agreement, do not remove this notice without checking first with + * WR/Platforms MIPS Center of Excellence engineering management. + */ + + +/* +modification history +-------------------- +01m,23aug05,rlg modifications for MIPS 32/64 compliant cores - hw breakpoints +01l,01mar04,pes Add definition of DBG_SYSCALL_SIZE. +01k,12may03,pes PAL conditional compilation cleanup. Phase 2. +01j,16jul01,ros add CofE comment +01i,08sep99,myz added a few macros for CW4000_16 +01h,17mar98,dbt added definition of DBG_CRET (no cret() support). +01g,30dec97,dbt modified for new breakpoint scheme +01f,15jul96,kkk added R4650 support +01e,27sep93,cd added R4000 support, including hardware breakpoint. +01d,25jul93,caf removed definition of DBG_TT. tt() is now supported. +01c,05aug93,jwt removed DBG_SAVE structure - not used; copyright 1993. +01b,22sep92,rrr added support for c++ +01a,05may92,yao written based on sparc/dbgLib.c. +*/ + +#ifndef __INCdbgMipsLibh +#define __INCdbgMipsLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "dsmLib.h" +#include "iv.h" +#include "esf.h" + +#define DBG_TRAP_NUM IV_BP_VEC +#define DBG_BREAK_INST 0x0000000d +#define DBG_NO_SINGLE_STEP 1 /* no single step support */ +#define DBG_CRET FALSE /* no cret support */ + + +#define DBG_BREAK_INST 0x0000000d +#define DBG_SYSCALL_SIZE 1 + +#if defined(_WRS_MIPS16) + +#define DBG_BREAK_INST_16 0xe805 /* mips16 break instruction */ +#define DBG_INST_ALIGN 2 + +#define WDB_NPC_SIZE_GET(pRegs) wdbNpcSizeGet(pRegs) + +extern int wdbNpcSizeGet(REG_SET *); + +#endif /* _WRS_MIPS16 */ + +#define DBG_HARDWARE_BP 1 /* support of hardware breakpoint */ +/* +* modifications for MIPS 32/64 compliant cores - hw breakpoints +*/ +#define MAX_WATCH 8 /* # of bp regs for 32/64 compliancy */ +/* +* offsets for indexing into the watch array +*/ + +#define DBG_WATCHLO_0 0 +#define DBG_WATCHHI_0 DBG_WATCHLO_0 + _WRS_INT_REGISTER_SIZE + +#define DBG_WATCHLO_1 DBG_WATCHHI_0 + _WRS_INT_REGISTER_SIZE +#define DBG_WATCHHI_1 DBG_WATCHLO_1 + _WRS_INT_REGISTER_SIZE + + +#define DBG_WATCHLO_2 DBG_WATCHHI_1 + _WRS_INT_REGISTER_SIZE +#define DBG_WATCHHI_2 DBG_WATCHLO_2 + _WRS_INT_REGISTER_SIZE + +#define DBG_WATCHLO_3 DBG_WATCHHI_2 + _WRS_INT_REGISTER_SIZE +#define DBG_WATCHHI_3 DBG_WATCHLO_3 + _WRS_INT_REGISTER_SIZE + +#define DBG_WATCHLO_4 DBG_WATCHHI_3 + _WRS_INT_REGISTER_SIZE +#define DBG_WATCHHI_4 DBG_WATCHLO_4 + _WRS_INT_REGISTER_SIZE + +#define DBG_WATCHLO_5 DBG_WATCHHI_4 + _WRS_INT_REGISTER_SIZE +#define DBG_WATCHHI_5 DBG_WATCHLO_5 + _WRS_INT_REGISTER_SIZE + +#define DBG_WATCHLO_6 DBG_WATCHHI_5 + _WRS_INT_REGISTER_SIZE +#define DBG_WATCHHI_6 DBG_WATCHLO_6 + _WRS_INT_REGISTER_SIZE + +#define DBG_WATCHLO_7 DBG_WATCHHI_6 + _WRS_INT_REGISTER_SIZE +#define DBG_WATCHHI_7 DBG_WATCHLO_7 + _WRS_INT_REGISTER_SIZE + +/* +* offsets for wdbRegisterType +*/ +#define WDB_REGTYPE_0 0 +#define WDB_REGTYPE_1 WDB_REGTYPE_0 + 4 /* add 32 bit offset */ +#define WDB_REGTYPE_2 WDB_REGTYPE_1 + 4 /* to each location */ +#define WDB_REGTYPE_3 WDB_REGTYPE_2 + 4 +#define WDB_REGTYPE_4 WDB_REGTYPE_3 + 4 +#define WDB_REGTYPE_5 WDB_REGTYPE_4 + 4 +#define WDB_REGTYPE_6 WDB_REGTYPE_5 + 4 +#define WDB_REGTYPE_7 WDB_REGTYPE_6 + 4 + + +#ifndef _ASMLANGUAGE + +typedef struct + { +/* +* new struct for mips32/64 compliant hw break points +* can have up to max of 8 register pairs +*/ + struct _watch + { + _RType watchLo_reg; /* watch low register */ + UINT32 watchHi_reg; /* watch high register */ + }watch[MAX_WATCH]; +/* +* special defines for non compliant hw break points +* allows old code to work +*/ +#define watchLo watch[0].watchLo_reg +#define watchHi watch[0].watchHi_reg + UINT32 cause; /* cause register */ +/* +* new for compliant hw break points +*/ + INSTR *epc; + VOID *badVaddr; + } DBG_REGS; + + +/* for R4650 */ +#define iWatch watchLo +#define dWatch watchHi + + +#endif /* _ASMLANGUAGE */ + +#define BRK_INST 0x0 /* hardware instruction breakpoint */ +#define BRK_WRITE 0x1 /* hardware data breakpoint for write */ +#define BRK_READ 0x2 /* hardware data breakpoint for read */ +#define BRK_RW 0x3 /* hardware data breakpoint for read/write */ +#define WDB_BRK_INST 0x4 /* hardware instruction type watch reg for */ + /* mips 32/64 compliant hardware */ +#define WDB_BRK_DATA 0x3 /* hardware data type watch regs for */ + /* mips 32/64 compliant hardware */ +#define WDB_BRK_BOTH 0x7 /* both data and instruction type reg */ + /* for mips 32/64 compliant */ + +#define WDB_REG_CHK 0x80000000 /* mask for msb - used to determine */ + /* if more watchLo and watchHi present */ +#define WDB_REG_WP_CLR 0xffbfffff /* mask for watch point bit in cause reg */ + +#define DEFAULT_HW_BP BRK_RW /* default hardware breakpoint */ + +#define BRK_HARDWARE 0x10 /* hardware breakpoint bit */ +#define BRK_HARDMASK 0x03 /* hardware breakpoint mask */ + +#ifndef _ASMLANGUAGE +#define WDB_CTX_LOAD(pRegs) _wdbDbgCtxLoad (pRegs) +#define WDB_CTX_SAVE(pRegs) _wdbDbgCtxSave (pRegs) +extern void _wdbDbgCtxLoad(); +extern int _wdbDbgCtxSave(); +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdbgMipsLibh */ diff --git a/h/arch/mips/dsmMipsLib.h b/h/arch/mips/dsmMipsLib.h new file mode 100644 index 0000000..4f12aa8 --- /dev/null +++ b/h/arch/mips/dsmMipsLib.h @@ -0,0 +1,530 @@ +/* dsmMipsLib.h - definitions for MIPS IV disassembler */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* + * This file has been developed or significantly modified by the + * MIPS Center of Excellence Dedicated Engineering Staff. + * This notice is as per the MIPS Center of Excellence Master Partner + * Agreement, do not remove this notice without checking first with + * WR/Platforms MIPS Center of Excellence engineering management. + */ + +/* +modification history +-------------------- +02g,02mar04,pes Add opcode for syscall instruction. +02f,16jul01,ros add CofE comment +02e,12jul00,dra add mask for branch instructions +02d,23sep99,myz added mips16 instruction related macros. +02e,30apr99,dra added vtype for VR5400 multimedia insn support. +02e,10feb99,kab added cpumask to INST struct. +02d,10mar97,sub added MIPS IV Support for VR5000. +02c,27may95,cd switched from MIPSE[BL] to _BYTE_ORDER for ansi compliance +02b,03jan95,cd removed enianess dependencies +02a,09oct93,cd modified for MIPSIII disassembler +01g,22sep92,rrr added support for c++ +01f,12sep92,ajm changed OPCODE_MASK and OFFSET_MASK due to name space conflict +01e,03jun92,ajm updated file name referenced to match real name +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01b,22jun90,rtp corrected COPZ mask and number COP0 opcodes. +01a,31may90,rtp created for MIPS R3000 disassembler. +*/ + +#ifndef __INCdsmMipsLibh +#define __INCdsmMipsLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" + +/* dsmLib status codes */ + +#define S_dsmLib_UNKNOWN_INSTRUCTION (M_dsmLib | 1) + +/* instruction types */ + +#ifndef _ASMLANGUAGE + +/* + * Structure describing an instruction used to disassemble instruction. + * An instruction matches an entry when the instruction ANDed with the + * mask matches op. The instruction operands are decoded using the + * operand description string. + */ + +typedef struct + { + char * name; /* mnemonic */ + unsigned long op; /* op-code to match */ + unsigned long mask; /* mask used to match with op */ + char * operands; /* operand format */ + unsigned long cpumask; /* cpu type(s) where inst is valid */ + } INST; + +/* + * Union describing all instruction formats + */ +typedef union + { + unsigned int code; + struct + { +#if _BYTE_ORDER == _BIG_ENDIAN + unsigned int op : 6; + unsigned int target : 26; +#endif +#if _BYTE_ORDER == _LITTLE_ENDIAN + unsigned int target : 26; + unsigned int op : 6; +#endif + } jtype; + struct + { +#if _BYTE_ORDER == _BIG_ENDIAN + unsigned int op : 6; + unsigned int rs : 5; + unsigned int rt : 5; + int i : 16; +#endif +#if _BYTE_ORDER == _LITTLE_ENDIAN + int i : 16; + unsigned int rt : 5; + unsigned int rs : 5; + unsigned int op : 6; +#endif + } itype; + struct + { +#if _BYTE_ORDER == _BIG_ENDIAN + unsigned int op : 6; + unsigned int rs : 5; + unsigned int rt : 5; + unsigned int u : 16; +#endif +#if _BYTE_ORDER == _LITTLE_ENDIAN + unsigned int u : 16; + unsigned int rt : 5; + unsigned int rs : 5; + unsigned int op : 6; +#endif + } utype; + struct + { +#if _BYTE_ORDER == _BIG_ENDIAN + unsigned int op : 6; + unsigned int rs : 5; + unsigned int rt : 5; + unsigned int rd : 5; + unsigned int s : 5; + unsigned int func : 6; +#endif +#if _BYTE_ORDER == _LITTLE_ENDIAN + unsigned int func : 6; + unsigned int s : 5; + unsigned int rd : 5; + unsigned int rt : 5; + unsigned int rs : 5; + unsigned int op : 6; +#endif + } rtype; + struct + { +#if _BYTE_ORDER == _BIG_ENDIAN + unsigned int op : 6; + unsigned int : 1; + unsigned int fmt : 4; + unsigned int ft : 5; + unsigned int fs : 5; + unsigned int fd : 5; + unsigned int func : 6; +#endif +#if _BYTE_ORDER == _LITTLE_ENDIAN + unsigned int func : 6; + unsigned int fd : 5; + unsigned int fs : 5; + unsigned int ft : 5; + unsigned int fmt : 4; + unsigned int : 1; + unsigned int op : 6; +#endif + } ftype; + struct + { +#if _BYTE_ORDER == _BIG_ENDIAN + unsigned int op : 6; + unsigned int fr: 5; + unsigned int ft : 5; + unsigned int fs : 5; + unsigned int fd : 5; + unsigned int func: 3; + unsigned int fmt : 3; +#endif +#if _BYTE_ORDER == _LITTLE_ENDIAN + unsigned int fmt : 3; + unsigned int func: 3; + unsigned int fd : 5; + unsigned int fs : 5; + unsigned int ft : 5; + unsigned int fr: 5; + unsigned int op : 6; +#endif + } fmips4type; + struct + { +#if _BYTE_ORDER == _BIG_ENDIAN + unsigned int media : 6; + unsigned int sel : 4; + unsigned int : 1; + unsigned int vt : 5; + unsigned int vs : 5; + unsigned int vd : 5; + unsigned int op : 6; +#endif +#if _BYTE_ORDER == _LITTLE_ENDIAN + unsigned int op : 6; + unsigned int vd : 5; + unsigned int vs : 5; + unsigned int vt : 5; + unsigned int : 1; + unsigned int sel : 4; + unsigned int media : 6; +#endif + } vtype; + + + + struct + { +#if _BYTE_ORDER == _BIG_ENDIAN + unsigned int op : 6; + unsigned int co : 1; + unsigned int cofun : 25; +#endif +#if _BYTE_ORDER == _LITTLE_ENDIAN + unsigned int cofun : 25; + unsigned int co : 1; + unsigned int op : 6; +#endif + } ctype; + struct + { +#if _BYTE_ORDER == _BIG_ENDIAN + unsigned int op : 6; + unsigned int code : 20; + unsigned int func : 6; +#endif +#if _BYTE_ORDER == _LITTLE_ENDIAN + unsigned int func : 6; + unsigned int code : 20; + unsigned int op : 6; +#endif + } ttype; + + struct + { +#if _BYTE_ORDER == _BIG_ENDIAN + unsigned int : 11; + unsigned int cc : 3; + unsigned int : 18; +#endif +#if _BYTE_ORDER == _LITTLE_ENDIAN + unsigned int : 18; + unsigned int cc : 3; + unsigned int : 11; +#endif + }readCCtype; + struct + { +#if _BYTE_ORDER == _BIG_ENDIAN + unsigned int : 21; + unsigned int cc : 3; + unsigned int : 8; +#endif +#if _BYTE_ORDER == _LITTLE_ENDIAN + unsigned int : 8; + unsigned int cc : 3; + unsigned int : 21; +#endif + }writeCCtype; + } mipsInst; + +typedef struct + { +#if _BYTE_ORDER == _BIG_ENDIAN + unsigned op : 6; + unsigned rs : 5; + unsigned rt : 5; + unsigned immediate : 16; +#endif +#if _BYTE_ORDER == _LITTLE_ENDIAN + unsigned immediate : 16; + unsigned rt : 5; + unsigned rs : 5; + unsigned op : 6; +#endif + } IMMEDIATETYPE; + +typedef struct + { +#if _BYTE_ORDER == _BIG_ENDIAN + unsigned op : 6; + unsigned target : 26; +#endif +#if _BYTE_ORDER == _LITTLE_ENDIAN + unsigned target : 26; + unsigned op : 6; +#endif + } JUMPTYPE; + +typedef struct + { +#if _BYTE_ORDER == _BIG_ENDIAN + unsigned op : 6; + unsigned rs : 5; + unsigned rt : 5; + unsigned rd : 5; + unsigned shamt : 5; + unsigned funct : 6; +#endif +#if _BYTE_ORDER == _LITTLE_ENDIAN + unsigned funct : 6; + unsigned shamt : 5; + unsigned rd : 5; + unsigned rt : 5; + unsigned rs : 5; + unsigned op : 6; +#endif + } REGISTERTYPE; + +typedef struct + { +#if _BYTE_ORDER == _BIG_ENDIAN + unsigned op : 6; + unsigned notOpcode : 26; +#endif +#if _BYTE_ORDER == _LITTLE_ENDIAN + unsigned notOpcode : 26; + unsigned op : 6; +#endif + } UFOTYPEINST; + +typedef struct + { +#if _BYTE_ORDER == _BIG_ENDIAN + unsigned op : 6; + unsigned co : 1; + unsigned cofun : 25; +#endif +#if _BYTE_ORDER == _LITTLE_ENDIAN + unsigned cofun : 25; + unsigned co : 1; + unsigned op : 6; +#endif + } COPZSUBTYPE; + +typedef struct + { +#if _BYTE_ORDER == _BIG_ENDIAN + unsigned op : 6; + unsigned z : 1; + unsigned fmt : 4; + unsigned ft : 5; + unsigned fs : 5; + unsigned fd : 5; + unsigned func : 6; +#endif +#if _BYTE_ORDER == _LITTLE_ENDIAN + unsigned func : 6; + unsigned fd : 5; + unsigned fs : 5; + unsigned ft : 5; + unsigned fmt : 4; + unsigned z : 1; + unsigned op : 6; +#endif + } FPCPSUBTYPE; + +typedef struct + { +#if _BYTE_ORDER == _BIG_ENDIAN + unsigned op : 6; + unsigned rs : 5; + unsigned rt : 5; + unsigned offset : 16; +#endif +#if _BYTE_ORDER == _LITTLE_ENDIAN + unsigned offset : 16; + unsigned rt : 5; + unsigned rs : 5; + unsigned op : 6; +#endif + } BCONDSUBTYPE; + +typedef struct + { +#if _BYTE_ORDER == _BIG_ENDIAN + unsigned op : 6; + unsigned brknumber : 10; /* this is a MIPS SW convention */ + unsigned code : 10; /* available but not used ?? */ + unsigned func : 6; +#endif +#if _BYTE_ORDER == _LITTLE_ENDIAN + unsigned func : 6; + unsigned code : 10; /* available but not used ?? */ + unsigned brknumber : 10; /* this is a MIPS SW convention */ + unsigned op : 6; +#endif + } BREAKSUBTYPE; + +#endif /* !_ASMLANGUAGE */ + +/* instruction and sub-instruction opcode masks */ + +#define GENERAL_OPCODE_MASK (077<<26) +#define SPECIAL_OPCODE_MASK 077 /* and FPCP function mask */ +#define BCOND_OPCODE_MASK (0x1f<<16) +#define COPZ_OPCODE_MASK (0x1f<<21) +#define COP0_OPCODE_MASK 0x1f +#define COP1_OPCODE_MASK (0xf<<22) +#define SHAMT_MASK (0x1f<<6) +#define RT_POS 16 /* bit position */ +#define RT_MASK (0x1f<> M16_RX_SHIFTER) + +/* extraction of mips16 jal(x) immediate */ + +#define M16_JALX_IMM(x) \ + ( ((((x) & 0x3e00000) >> 5) | ((x & 0x1f0000) << 5) | (x & 0xffff))<<2) + +/* extraction of mips16 instruction opcode */ + +#define M16_INSTR_OPCODE(instr) \ + (((instr) & M16_OPCODE_MASK) >> M16_OPCODE_SHIFTER) + +/* extraction of extend immediate field */ + +#define M16_EXTEND_IMM(instr) ((((instr) & 0x1f) << 11) | ((instr) & 0x7e0)) + +/* sign extended to 32 bit for a 16 bit value */ + +#define SIGN_EXTEND_32BIT(value) \ + if (value & 0x8000) \ + value |= 0xffff0000 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdsmMipsLibh */ diff --git a/h/arch/mips/dspMipsLib.h b/h/arch/mips/dspMipsLib.h new file mode 100644 index 0000000..9219c2b --- /dev/null +++ b/h/arch/mips/dspMipsLib.h @@ -0,0 +1,100 @@ +/* dspMipsLib.h - MIPS DSP ASE Header */ + +/* + * Copyright (C) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01a,27jul05,pes Created +*/ + +#ifndef __INCdspMipsLibh +#define __INCdspMipsLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE +typedef struct dspContext /* DSP_CONTEXT */ + { + struct + { + UINT32 hi; + UINT32 lo; + } accum[3]; + UINT32 dspcr; + UINT32 pad; /* pad size to doubleword boundary */ + } DSP_CONTEXT; + +#define DSPREG_SET DSP_CONTEXT + +/* variable declarations */ + +/* function declarations */ + +IMPORT void dspArchUnitInit (void); +IMPORT void dspInitialize (void); +IMPORT DSP_CONTEXT * dspCtxCreate (int); +IMPORT STATUS dspCtxDelete (DSP_CONTEXT *); +IMPORT void dspEnable(void); +IMPORT void dspDisable(void); + +IMPORT FUNCPTR _func_dspInitializeHook; +IMPORT FUNCPTR _func_dspSaveHook; +IMPORT FUNCPTR _func_dspRestoreHook; + +#endif /* _ASMLANGUAGE */ + +/* DSP_CONTEXT structure offsets */ +#define DSP_CTX_HI1 0x0 /* OFFSET(dsp.accum[0].hi) */ +#define DSP_CTX_LO1 0x4 /* OFFSET(dsp.accum[0].lo) */ +#define DSP_CTX_HI2 0x8 /* OFFSET(dsp.accum[1].hi) */ +#define DSP_CTX_LO2 0xc /* OFFSET(dsp.accum[1].lo) */ +#define DSP_CTX_HI3 0x10 /* OFFSET(dsp.accum[2].hi) */ +#define DSP_CTX_LO3 0x14 /* OFFSET(dsp.accum[2].lo) */ +#define DSP_CTX_DSPCR 0x18 /* OFFSET(dsp.dspcr) */ + +/* DSP Present bit in CONFIG3 register */ +#define CFG3_DSPP 0x400 + +#ifdef _ASMLANGUAGE +/* Macros to synthesize the new DSP instructions */ +#if defined (_WRS_MIPS_ENABLE_R2_ISA) +#define R2_MFHI(rd,ac) \ + mfhi $rd,ac +#define R2_MFLO(rd,ac) \ + mflo $rd,ac +#define R2_MTHI(rs,ac) \ + mthi $rs,ac +#define R2_MTLO(rs,ac) \ + mtlo $rs,ac +#define R2_RDDSP(rd) \ + rddsp $rd +#else /* _WRS_MIPS_ENABLE_R2_ISA */ +#define R2_MFHI(rd,ac) \ + .word (0x00000010 + ((ac) << 21) + ((rd) << 11)) +#define R2_MFLO(rd,ac) \ + .word (0x00000012 + ((ac) << 21) + ((rd) << 11)) +#define R2_MTHI(rs,ac) \ + .word (0x00000011 + (rs << 21) + (ac << 11)) +#define R2_MTLO(rs,ac) \ + .word (0x00000013 + (rs << 21) + (ac << 11)) +#define R2_RDDSP(rd) \ + .word (0x7fff04b8 + (rd << 11)) +#define R2_WRDSP(rs) \ + .word (0x7c1ffcf8 + (rs << 21)) +#endif /* _WRS_MIPS_EANBLE_R2_ISA */ +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdspMipsLibh */ diff --git a/h/arch/mips/elfMips.h b/h/arch/mips/elfMips.h new file mode 100644 index 0000000..7e3d04a --- /dev/null +++ b/h/arch/mips/elfMips.h @@ -0,0 +1,84 @@ +/* elfMips.h - Mips specific Extended Load Format header */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* + * This file has been developed or significantly modified by the MIPS Center of + * Excellence Dedicated Engineering Staff. This notice is as per the MIPS + * Center of Excellence Master Partner Agreement, do not remove this notice + * without checking first with WR/Platforms MIPS Center of Excellence + * engineering management. + */ + +/* +modification history +-------------------- +01h,26jul05,v_r Linked target/h/arch/mips to this one (as for all other shared + ELF headers). +01g,03oct04,jn Skip relocations used by shared library +01f,04nov03,jn Temporarily expose some internals of elf mips for RTP loader +01e,11dec01,pad Removed all unnecessary types and definitions. +01d,16jul01,ros Add CofE comment +01c,14sep99,myz Added a new relocation type R_MIPS16_26 for mips16 +01b,17nov95,kkk Added two new special section numbers +01a,28sep93,cd Derived from elfSparc.h. +*/ + +#ifndef __INCelfMipsh +#define __INCelfMipsh + +#ifdef __cplusplus +extern "C" { +#endif + +/* MIPS ABI relocation types */ + +#define R_MIPS_NONE 0 +#define R_MIPS_16 1 +#define R_MIPS_32 2 +#define R_MIPS_REL32 3 /* unsupported in VxWorks */ +#define R_MIPS_26 4 +#define R_MIPS_HI16 5 +#define R_MIPS_LO16 6 +#define R_MIPS_GPREL16 7 /* unsupported in VxWorks */ +#define R_MIPS_LITERAL 8 /* unsupported in VxWorks */ +#define R_MIPS_GOT16 9 /* unsupported in VxWorks */ +#define R_MIPS_PC16 10 /* unsupported in VxWorks */ +#define R_MIPS_CALL16 11 /* unsupported in VxWorks */ +#define R_MIPS_GPREL32 12 /* unsupported in VxWorks */ + +/* + * These relocation types are not ABI defined. They are required for + * our compilers' shared library implementation (as per the VxWorks + * Shared Library EABI). + */ +#define R_MIPS_COPY 126 +#define R_MIPS_JMP_SLOT 127 + +#define EM_ARCH_MACHINE EM_MIPS +#define EI_ARCH_CLASS ELFCLASS32 +#define EI_ARCH_DATA ELFDATE2MSB + +/* + * The HI16_RELOC_INFO type provides a way for elfMipsAddrHi16Reloc() to + * communicate details to elfMipsAddrLo16Reloc() when SHT_REL-type relocation + * entries are used. + * + * Note: the structure should be allocated on the stack to be thread-safe. + * + * XXX Temporarily move this structure here from elfMips.c, to allow use by + * the RTP loader. + */ + +typedef struct hi16RelocInfo { + void * pSymAdrs; /* address of symbol involved in relocation */ + UINT32 instruction; /* content of instruction being relocated */ + void * pRelocAdrs; /* address of field being relocated */ + BOOL relocated; /* TRUE if the relocation work is done */ +} HI16_RELOC_INFO; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCelfMipsh */ diff --git a/h/arch/mips/esfMips.h b/h/arch/mips/esfMips.h new file mode 100644 index 0000000..2343bda --- /dev/null +++ b/h/arch/mips/esfMips.h @@ -0,0 +1,156 @@ +/* esfMips.h - exception stack frame for MIPS architecture */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* + * This file has been developed or significantly modified by the + * MIPS Center of Excellence Dedicated Engineering Staff. + * This notice is as per the MIPS Center of Excellence Master Partner + * Agreement, do not remove this notice without checking first with + * WR/Platforms MIPS Center of Excellence engineering management. + */ + +/* +modification history +-------------------- +01p,14jul04,agf Replace _pad with previousEsf ptr +01o,11sep03,jmt Modify Exception Stack for Base 6 +01n,26aug03,jmt Add TLBHI registers to E_STK +01m,16jul01,ros add CofE comment +01l,12feb96,mem Added cause and fpscr to REG_SET. +0ik,22oct93,cd added R4000 support, added 64bit support. +01j,22sep92,rrr added support for c++ +01i,19jul92,rrr changed ESFR3K member errno to _errno so it would compile +01h,03jun92,ajm updated file name referenced to match real name +01g,26may92,rrr the tree shuffle + -changed includes to have absolute path from h/ +01f,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01e,27may91,ajm reordered ESF to model REG_SET +01d,19sep90,ajm merged in space for fpcsr +01c,08may90,ajm added stack space for call with up to four parameters +01b,16apr90,ajm moved epc and sp to top of stack for use by + windALib.s +01a,13apr90,ajm written +*/ + +#ifndef __INCesfMipsh +#define __INCesfMipsh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "arch/mips/regsMips.h" + +/* +* Exception stack frame. Since done in common software routine, +* there exists merely one frame. Notice the coordination of +* stack frame definitions for assembler routines, and the +* order of the structure ESFMIPS!!! +* +*/ + +/* ESFMIPS - all inclusive stack frame */ + +#ifndef _ASMLANGUAGE + +typedef struct + { + ULONG param1; /* space for param 1 */ + ULONG param2; /* space for param 2 */ + ULONG param3; /* space for param 3 */ + ULONG param4; /* space for param 3 */ + ULONG _errno; /* errno */ + ULONG cause; /* cause register */ + ULONG cntxt; /* context reg */ + ULONG fpcsr; /* float status register */ + ULONG badva; /* bad virtual address reg */ + ULONG * previousEsf; /* pointer to nested ESF */ + REG_SET esfRegs; /* general register set */ + } ESFMIPS; + +#endif /* _ASMLANGUAGE */ + +/* +* The following list of definitions tell me where I saved state on +* the process stack. See excALib.s +* +*/ + +#define E_STK_PARAM1 (0*4) /* saved for param 1 */ +#define E_STK_PARAM2 (1*4) /* saved for param 2 */ +#define E_STK_PARAM3 (2*4) /* saved for param 3 */ +#define E_STK_PARAM4 (3*4) /* saved for param 4 */ +#define E_ERRNO (4*4) /* errno */ +#define E_STK_CAUSE (5*4) /* cause register */ +#define E_STK_CTX (6*4) /* context reg */ +#define E_STK_FPCSR (7*4) /* float status register */ +#define E_STK_BADVADDR (8*4) /* bad virtual address reg */ +#define E_STK_PREVESF (9*4) /* pointer to nested stack frame */ + +#define E_STK_SR (10*4) /* status register */ +#define E_STK_EPC (11*4) /* calculated epc */ + +#define E_STK_LO (12*4+0*_RTypeSize) /* mul/div low */ +#define E_STK_HI (12*4+1*_RTypeSize) /* mul/div hi */ +#define E_STK_GREG_BASE (12*4+2*_RTypeSize) +#define E_STK_GREG_OFFSET(n) (E_STK_GREG_BASE + (n)*_RTypeSize) +#define E_STK_ZERO E_STK_GREG_OFFSET(0) /* just for kicks, always zero */ +#define E_STK_AT E_STK_GREG_OFFSET(1) /* assembler temporary */ +#define E_STK_V0 E_STK_GREG_OFFSET(2) /* return value 1 */ +#define E_STK_V1 E_STK_GREG_OFFSET(3) /* return value 2 */ +#define E_STK_A0 E_STK_GREG_OFFSET(4) /* passed parameter 1 */ +#define E_STK_A1 E_STK_GREG_OFFSET(5) /* passed parameter 2 */ +#define E_STK_A2 E_STK_GREG_OFFSET(6) /* passed parameter 3 */ +#define E_STK_A3 E_STK_GREG_OFFSET(7) /* passed parameter 4 */ +#define E_STK_T0 E_STK_GREG_OFFSET(8) /* temp reg t0 */ +#define E_STK_T1 E_STK_GREG_OFFSET(9) /* temp reg t1 */ +#define E_STK_T2 E_STK_GREG_OFFSET(10) /* temp reg t2 */ +#define E_STK_T3 E_STK_GREG_OFFSET(11) /* temp reg t3 */ +#define E_STK_T4 E_STK_GREG_OFFSET(12) /* temp reg t4 */ +#define E_STK_T5 E_STK_GREG_OFFSET(13) /* temp reg t5 */ +#define E_STK_T6 E_STK_GREG_OFFSET(14) /* temp reg t6 */ +#define E_STK_T7 E_STK_GREG_OFFSET(15) /* temp reg t7 */ +#define E_STK_S0 E_STK_GREG_OFFSET(16) /* saved reg s0 */ +#define E_STK_S1 E_STK_GREG_OFFSET(17) /* saved reg s1 */ +#define E_STK_S2 E_STK_GREG_OFFSET(18) /* saved reg s2 */ +#define E_STK_S3 E_STK_GREG_OFFSET(19) /* saved reg s3 */ +#define E_STK_S4 E_STK_GREG_OFFSET(20) /* saved reg s4 */ +#define E_STK_S5 E_STK_GREG_OFFSET(21) /* saved reg s5 */ +#define E_STK_S6 E_STK_GREG_OFFSET(22) /* saved reg s6 */ +#define E_STK_S7 E_STK_GREG_OFFSET(23) /* saved reg s7 */ +#define E_STK_T8 E_STK_GREG_OFFSET(24) /* temp reg t8 */ +#define E_STK_T9 E_STK_GREG_OFFSET(25) /* temp reg t9 */ +#define E_STK_K0 E_STK_GREG_OFFSET(26) /* kernel reg 0 */ +#define E_STK_K1 E_STK_GREG_OFFSET(27) /* kernel reg 1, not saved */ +#define E_STK_GP E_STK_GREG_OFFSET(28) /* global pointer */ +#define E_STK_SP E_STK_GREG_OFFSET(29) /* stack pointer */ +#define E_STK_FP E_STK_GREG_OFFSET(30) /* saved reg */ +#define E_STK_RA E_STK_GREG_OFFSET(31) /* return addr reg */ + +#define E_STK_GREG_END (E_STK_GREG_BASE + 32*_RTypeSize) + +#define E_STK_WDB_CAUSE (E_STK_GREG_END + 0*4) +#define E_STK_WDB_FPCSR (E_STK_GREG_END + 1*4) + +#define E_STK_INTCTRL (E_STK_GREG_END + 2*4) /* Ext Intr Ctrl */ +#define E_STK_ULEXTRA1 (E_STK_GREG_END + 3*4) /* extra, 4 bytes for padding */ +#define E_STK_TLBHI (E_STK_GREG_END + 4*4 + 0*_RTypeSize) /* addr space storage */ +#define E_STK_RTEXTRA2 (E_STK_GREG_END + 4*4 + 1*_RTypeSize) /* extra */ +#define E_STK_RTEXTRA3 (E_STK_GREG_END + 4*4 + 2*_RTypeSize) /* extra */ +#define E_STK_RTEXTRA4 (E_STK_GREG_END + 4*4 + 3*_RTypeSize) /* extra */ +#define E_STK_RTEXTRA5 (E_STK_GREG_END + 4*4 + 4*_RTypeSize) /* extra */ +#define E_STK_RTEXTRA6 (E_STK_GREG_END + 4*4 + 5*_RTypeSize) /* extra */ +#define E_STK_RTEXTRA7 (E_STK_GREG_END + 4*4 + 6*_RTypeSize) /* extra */ +#define E_STK_RTEXTRA8 (E_STK_GREG_END + 4*4 + 7*_RTypeSize) /* extra */ + +#define ESTKSIZE (E_STK_GREG_END + 4*4 + 8*_RTypeSize) /* exception stack frame size */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCesfMipsh */ diff --git a/h/arch/mips/excMipsLib.h b/h/arch/mips/excMipsLib.h new file mode 100644 index 0000000..5708423 --- /dev/null +++ b/h/arch/mips/excMipsLib.h @@ -0,0 +1,127 @@ +/* excMipsLib.h - header for exception library */ + +/* + * This file has been developed or significantly modified by the + * MIPS Center of Excellence Dedicated Engineering Staff. + * This notice is as per the MIPS Center of Excellence Master Partner + * Agreement, do not remove this notice without checking first with + * WR/Platforms MIPS Center of Excellence engineering management. + */ + +/* +modification history +-------------------- +02q,26nov03,pes Correct _WRS_IS_SUPV_EXC macro. +02p,18nov03,pes Add _WRS_IS_SUPV_EXC macro. +02o,16jul01,ros add CofE comment +02n,19jan99,dra added CW4000, CW4011, VR4100, VR5000 and VR5400 support. +02m,18dec96,tam added defines for break instruction. +02l,15jul96,cah added support for R4650 +02k,30may96,kkk added exception codes for R3000/R4000. +02j,15oct93,cd added R4000 support. +02i,13aug93,yao added exception code. added ifndef _ASMLANGUAGE. +02h,08jul93,yao added one more instruction to exception vector for saving + cause register (SPR #2362). updated document for the vector + structure. +02g,18aug93,jmm added external declaration for excExcepHook +02f,22sep92,rrr added support for c++ +02e,03jun92,ajm updated file name referenced to match real name +02d,26may92,rrr the tree shuffle +02c,04oct91,rrr passed through the ansification filter + -changed copyright notice +02b,20sep90,ajm added floating point status reg, and error address and + and id regs +02a,28may90,ajm ported to MIPS r3000 +01a,28may88,dnw written +*/ + +#ifndef __INCexcMipsLibh +#define __INCexcMipsLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE +/* variable declarations */ + +extern FUNCPTR excExcepHook; /* add'l rtn to call when exceptions occur */ + +/* generic exception information - + * kept in the tcb of tasks that have caused exceptions */ + +typedef struct + { + USHORT valid; /* indicators that following fields are valid */ + USHORT vecNum; /* vector number */ + USHORT eid; /* error id number */ + USHORT pad; /* word alignment pad */ + INSTR *epc; /* exception program counter */ + ULONG badVa; /* access address */ + ULONG statusReg; /* status register */ + ULONG causeReg; /* cause register */ + ULONG fpcsr; /* float status register */ + ULONG ear; /* error address register */ + } EXC_INFO; + + +#define _WRS_IS_SUPV_EXC() (((excInfo.statusReg & SR_KSUMASK) == SR_KSU_K) ? TRUE : FALSE) + +#endif + +/* exception info valid bits */ + +#define EXC_VEC_NUM 0x01 /* vector number valid */ +#define EXC_EPC 0x02 /* pc valid */ +#define EXC_ACCESS_ADDR 0x04 /* access address valid */ +#define EXC_STATUS_REG 0x08 /* status register valid */ +#define EXC_CAUSE_REG 0x10 /* cause register valid */ +#define EXC_FP_STATUS_REG 0x20 /* fp status register valid */ +#define EXC_ERROR_ADDR 0x40 /* error address valid */ + +/* exception code */ + +#define EXC_CODE_INT 0 /* externel interrupt */ +#define EXC_CODE_TLBM 1 /* TLB modification exception */ + +#define EXC_CODE_TLBL 2 /* TLB miss exception (load or + * instruction fetch) */ +#define EXC_CODE_IBND 2 /* R4650: IBound exception */ +#define EXC_CODE_TLBS 3 /* TLB miss exception (store) */ +#define EXC_CODE_DBND 3 /* R4650: DBound exception */ + +#define EXC_CODE_ADEL 4 /* address error exception (load/ + * instruction fetch ) */ +#define EXC_CODE_ADES 5 /* address error exception (store) */ +#define EXC_CODE_BEI 6 /* bus error(for instruction fetch) */ +#define EXC_CODE_BED 7 /* bus error (data load or store) */ +#define EXC_CODE_SYS 8 /* system call exception */ +#define EXC_CODE_BP 9 /* breakpoint exception */ +#define EXC_CODE_RI 10 /* reserved instruction exception */ +#define EXC_CODE_FPU 11 /* coprocessor unusable exception */ +#define EXC_CODE_OVF 12 /* arithmetic overflow exception */ + +#define EXC_CODE_TRAP 13 /* trap exception */ +#define EXC_CODE_VCEI 14 /* instr virtual coherency exception */ +#define EXC_CODE_FPE 15 /* floating point exception */ +#define EXC_CODE_WATCH 23 /* watchpoint exception */ +#define EXC_CODE_VCED 31 /* data virtual coherency exception */ + +#define EXC_CODE_FPE_INVALID 55 /* invalid fpe operation */ +#define EXC_CODE_FPE_DIV0 56 /* divide by zero */ +#define EXC_CODE_FPE_OVERFLOW 57 /* overflow */ +#define EXC_CODE_FPE_UNDERFLOW 58 /* underflow */ +#define EXC_CODE_FPE_INEXACT 59 /* inexact result */ + +/* break instruction info */ + +#define EXC_BRK_CODE_MSK 0x03ffffc0 /* break code field mask */ +#define EXC_BRK_DIV_BY_ZERO 0x1c00 /* integer div. by zero */ +#define EXC_BRK_INT_OVF 0x1800 /* integer overflow */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCexcMipsLibh */ diff --git a/h/arch/mips/fpSoft.h b/h/arch/mips/fpSoft.h new file mode 100644 index 0000000..99a411b --- /dev/null +++ b/h/arch/mips/fpSoft.h @@ -0,0 +1,545 @@ +/* fpSoft.h - constants for MIPS R3010 software floating point emulation */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* + * This file has been developed or significantly modified by the + * MIPS Center of Excellence Dedicated Engineering Staff. + * This notice is as per the MIPS Center of Excellence Master Partner + * Agreement, do not remove this notice without checking first with + * WR/Platforms MIPS Center of Excellence engineering management. + */ + +/* +modification history +-------------------- +01k,16jul01,ros add CofE comment +01j,28feb00,dra updated explicit conversion opcodes for .L format. +01i,27may95,cd switched from MIPSE[BL] to _BYTE_ORDER for ansi compliance +01h,03apr95,ism added 'int' to the 'signed' and 'unsigned' bit field types +01g,01sep93,yao added constant definitions for fpu load/store instruction. +01f,22sep92,rrr added support for c++ +01e,12sep92,ajm changed OPCODE_MASK for name clash +01d,03jun92,ajm updated file name referenced to match real name +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01a,22jul91,ajm wrs-ized from MIPS code +*/ + +/* |-----------------------------------------------------------| + * | Copyright (c) 1990 MIPS Computer Systems, Inc. | + * | All Rights Reserved | + * |-----------------------------------------------------------| + * | Restricted Rights Legend | + * | Use, duplication, or disclosure by the Government is | + * | subject to restrictions as set forth in | + * | subparagraph (c)(1)(ii) of the Rights in Technical | + * | Data and Computer Software Clause of DFARS 52.227-7013. | + * | MIPS Computer Systems, Inc. | + * | 928 Arques Avenue | + * | Sunnyvale, CA 94086 | + * |-----------------------------------------------------------| + */ + +#ifndef __INCfpSofth +#define __INCfpSofth + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The _MASK's are used to get a the specified field after it has been + * shifted by _SHIFT and then bit patterns (like _COPN) can be used to test + * the field. + */ +/* constants for the OPCODE field for some general instructions */ +#define OPCODE_SHIFT 26 +#define OPCODE_GMASK 0x3f +#define OPCODE_SPECIAL 0x00 +#define OPCODE_BCOND 0x01 +#define OPCODE_REGIMM 0x01 +#define OPCODE_J 0x02 +#define OPCODE_JAL 0x03 +#define OPCODE_BEQ 0x04 +#define OPCODE_C1 0x11 + +/* constants for the emulating jump or jump and link instructions */ +#define TARGET_MASK 0x03ffffff +#define PC_JMP_MASK 0xf0000000 + +/* constants for the FUNC field for some general instructions */ +#define FUNC_MASK 0x3f +#define FUNC_JR 0x08 +#define FUNC_JALR 0x09 + +/* + * constants for the OPCODE field for detecting all general branch + * (beq,bne,blez,bgtz) instructions and all coprocessor instructions. + */ +#define BRANCH_MASK 0x3c +#define OPCODE_BRANCHES 0x04 +#define OPCODE_BRANCH_LIKELIES 0x14 +#define COPN_MASK 0x3c +#define OPCODE_COPN 0x10 + +/* + * constants for the RegisterImmediate instructions + */ +#define REGIMM_SHIFT 0x16 +#define REGIMM_BRANCH_MASK 0x1c +#define REGIMM_BCOND 0x00 /* bltz, bgez, bltzl, bgezl */ +#define REGIMM_BAL 0x10 /* bltzal, bgezal, etc. */ + +/* constants for load/store COPN instructions */ +#define OP_LSWCOPNMASK 0x33 +#define OP_LSWCOPN 0x31 +#define OP_LSBITMASK 0x8 /* store vs load */ +#define OP_LSDBITMASK 0x4 /* doubleword vs singleword */ +#define OP_LBIT 0x0 + +/* constants for branch on COPN condition instructions */ +#define COPN_BCSHIFT 24 +#define COPN_BCMASK 0x3 +#define COPN_BC 0x1 +#define BC_TFBITSHIFT 16 +#define BC_TFBITMASK 0x1 +#define BC_FBIT 0x0 + +/* constants for move to/from COPN instructions */ +#define COPN_MTFSHIFT 25 +#define COPN_MTFMASK 0x1 +#define COPN_MTF 0x0 +#define COPN_MTFBITSHIFT 23 +#define COPN_MTFBITMASK 0x1 +#define COPN_MFBIT 0x0 + +/* constants for move control registers to/from CP1 instructions */ +#define M_CONBITSHIFT 22 +#define M_CONBITMASK 0x1 + +#define FPR_REV 0 +#define FPR_EIR 30 +#define FPR_CSR 31 +#define SOFTFP_REVWORD 0x0 + +/* + * These constants refer to the fields of coprocessor instructions not + * cpu instructions (ie the RS and RD fields are different). + */ +#define BASE_SHIFT 21 +#define BASE_MASK 0x1f +#define RT_SHIFT 16 +#define RT_MASK 0x1f +#define RT_FPRMASK 0x1e +#define RS_SHIFT 11 +#define RS_MASK 0x1f +#define RS_FPRMASK 0x1e +#define RD_SHIFT 6 +#define RD_MASK 0x1f +#define RD_FPRMASK 0x1e + +#define IMMED_SHIFT 16 + +#define C1_FMT_SHIFT 21 +#define C1_FMT_MASK 0xf +#define C1_FMT_SINGLE 0 +#define C1_FMT_DOUBLE 1 +#define C1_FMT_EXTENDED 2 +#define C1_FMT_QUAD 3 +#define C1_FMT_WORD 4 +#define C1_FMT_MAX 5 + +#define C1_FUNC_MASK 0x3f +#define C1_FUNC_DIV 3 +#define C1_FUNC_NEG 7 +#define C1_FUNC_ROUNDL 8 +#define C1_FUNC_FLOORL 0x0b +#define C1_FUNC_ROUNDW 0x0c +#define C1_FUNC_FLOORW 0x0f +#define C1_FUNC_CVTS 0x20 +#define C1_FUNC_CVTD 0x21 +#define C1_FUNC_CVTW 0x24 +#define C1_FUNC_CVTL 0x25 +#define C1_FUNC_1stCMP 0x30 + +#define COND_UN_MASK 0x1 +#define COND_EQ_MASK 0x2 +#define COND_LT_MASK 0x4 +#define COND_IN_MASK 0x8 + +/* + * These constants refer to the fields of coprocessor store/load instructions. + */ + +#define FPU_TYPE_SHIFT 16 /* shift instruction 16 bits to right */ +#define FPU_I_INST_MASK 0x03c0 /* I-type instruction mask */ +#define FPU_TYPE_MASK 0x0200 /* I-type instruction mask */ +#define FPU_INST_MFC 0x0000 /* mfc1 instructio */ +#define FPU_INST_MTC 0x0080 /* mtc1 instructio */ +#define FPU_INST_CFC 0x0040 /* cfc1 instructio */ +#define FPU_INST_CTC 0x00c0 /* ctc1 instructio */ +#define FPU_I_RT_MASK 0x001f /* rt bits */ +#define FPU_I_RS_MASK 0xf800 /* rs bits */ +#define FPU_STLD1_MASK 0xfc00 /* swc1/lwc1 code mask 16 bit right + * shifted */ +#define FPU_SW_INSTR 0xe400 /* swc1 instruction */ +#define FPU_LW_INSTR 0xc400 /* lwc1 instruction */ +#define OFFSET_MASK 0xffff /* offset mask for I-type instruction */ +#define SLW_BASE_MASK 0x03e0 /* base maske for I-type instruction */ + +/* + * These constants refer to fields in the floating-point status and control + * register. + */ +#define CSR_CBITSHIFT 23 +#define CSR_CBITMASK 0x1 +#define CSR_CBITSET 0x00800000 +#define CSR_CBITCLEAR 0xff7fffff + +#define CSR_EXCEPT 0x0003f000 +#define UNIMP_EXC 0x00020000 +#define INVALID_EXC 0x00010040 +#define DIVIDE0_EXC 0x00008020 +#define OVERFLOW_EXC 0x00004010 +#define UNDERFLOW_EXC 0x00002008 +#define INEXACT_EXC 0x00001004 + +#define CSR_ENABLE 0x00000f80 +#define INVALID_ENABLE 0x00000800 +#define DIVIDE0_ENABLE 0x00000400 +#define OVERFLOW_ENABLE 0x00000200 +#define UNDERFLOW_ENABLE 0x00000100 +#define INEXACT_ENABLE 0x00000080 + +#define CSR_RM_MASK 0x3 +#define CSR_RM_RN 0 +#define CSR_RM_RZ 1 +#define CSR_RM_RPI 2 +#define CSR_RM_RMI 3 + +/* + * These constants refer to floating-point values for all formats + */ +#define SIGNBIT 0x80000000 + +#define GUARDBIT 0x80000000 +#define STKBIT 0x20000000 + +/* + * These constants refer to word values + */ +#define WORD_MIN 0x80000000 +#define WORD_MAX 0x7fffffff +#define WEXP_MIN -1 +#define WEXP_MAX 30 +#define WQUIETNAN_LEAST 0x7fffffff + +/* + * These constants refer to 64-bit long values + */ +#define LONG_MIN_HIGH 0x80000000 +#define LONG_MIN_LOW 0x00000000 +#define LONG_MAX_HIGH 0x7fffffff +#define LONG_MAX_LOW 0xffffffff +#define LEXP_MIN -1 +#define LEXP_MAX 62 +#define LQUIETNAN_LEAST_HIGH 0x7fffffff +#define LQUIETNAN_LEAST_LOW 0xffffffff + +/* + * These constants refer to single format floating-point values + */ +#define SEXP_SHIFT 23 +#define SEXP_MASK 0xff +#define SEXP_NAN 0xff +#define SEXP_INF 0xff +#define SEXP_BIAS 127 +#define SEXP_MAX 127 +#define SEXP_MIN -126 +#define SEXP_OU_ADJ 192 +#define SIMP_1BIT 0x00800000 +#define SFRAC_LEAD0S 8 +#define SFRAC_BITS 23 +#define SFRAC_MASK 0x007fffff +#define SFRAC_LEAST_MAX 0x007fffff + +#define SSNANBIT_MASK 0x00400000 +#define SQUIETNAN_LEAST 0x7fbfffff + +/* + * These constants refer to double format floating-point values + */ +#define DEXP_SHIFT 20 +#define DEXP_MASK 0x7ff +#define DEXP_NAN 0x7ff +#define DEXP_INF 0x7ff +#define DEXP_BIAS 1023 +#define DEXP_MAX 1023 +#define DEXP_MIN -1022 +#define DEXP_OU_ADJ 1536 +#define DIMP_1BIT 0x00100000 +#define DFRAC_LEAD0S 11 +#define DFRAC_BITS 52 +#define DFRAC_MASK 0x000fffff +#define DFRAC_LESS_MAX 0x000fffff +#define DFRAC_LEAST_MAX 0xffffffff + +#define DSNANBIT_MASK 0x00080000 +#define DQUIETNAN_LESS 0x7ff7ffff +#define DQUIETNAN_LEAST 0xffffffff + +#ifndef _ASMLANGUAGE +/* + * Structure and constant definisions for floating-point instructions. + */ +union fpu_instr { + unsigned long instr; + + struct { +#if _BYTE_ORDER==_BIG_ENDIAN + unsigned int op : 6; + unsigned int base : 5; + unsigned int rt : 5; + signed int immed : 16; +#endif /* _BYTE_ORDER==_BIG_ENDIAN */ +#if _BYTE_ORDER==_LITTLE_ENDIAN + signed int immed : 16; + unsigned int rt : 5; + unsigned int base : 5; + unsigned int op : 6; +#endif /* _BYTE_ORDER==_LITTLE_ENDIAN */ + } itype; + + struct { +#if _BYTE_ORDER==_BIG_ENDIAN + unsigned int op : 6; + unsigned int sub : 5; + unsigned int rt : 5; + unsigned int rs : 5; + unsigned int : 11; +#endif /* _BYTE_ORDER==_BIG_ENDIAN */ +#if _BYTE_ORDER==_LITTLE_ENDIAN + unsigned int : 11; + unsigned int rs : 5; + unsigned int rt : 5; + unsigned int sub : 5; + unsigned int op : 6; +#endif /* _BYTE_ORDER==_LITTLE_ENDIAN */ + } mtype; + + struct { +#if _BYTE_ORDER==_BIG_ENDIAN + unsigned int op : 6; + unsigned int one : 1; + unsigned int fmt : 4; + unsigned int rt : 5; + unsigned int rs : 5; + unsigned int rd : 5; + unsigned int func : 6; +#endif /* _BYTE_ORDER==_BIG_ENDIAN */ +#if _BYTE_ORDER==_LITTLE_ENDIAN + unsigned int func : 6; + unsigned int rd : 5; + unsigned int rs : 5; + unsigned int rt : 5; + unsigned int fmt : 4; + unsigned int one : 1; + unsigned int op : 6; +#endif /* _BYTE_ORDER==_LITTLE_ENDIAN */ + } rtype; +}; +#endif /* _ASMLANGUAGE */ + +#define FMT_SINGLE 0 +#define FMT_DOUBLE 1 +#define FMT_EXTENDED 2 +#define FMT_QUAD 3 +#define FMT_WORD 4 +#define FMT_MAX 4 + +#define FUNC_ADD 0 +#define FUNC_SUB 1 +#define FUNC_MUL 2 +#define FUNC_DIV 3 + +#define FUNC_SQRT 4 +#define FUNC_ABS 5 +#define FUNC_MOV 6 +#define FUNC_NEG 7 + +#define FUNC_CVTS 0x20 +#define FUNC_CVTD 0x21 +#define FUNC_CVTE 0x22 +#define FUNC_CVTQ 0x23 +#define FUNC_CVTW 0x24 + +/* + * The func field of floating-point compare opcodes are FUNC_FC with + * some combination of conditions (COND_*). + */ + +#define FUNC_FC 0x30 +#define COND_UN_MASK 0x1 +#define COND_EQ_MASK 0x2 +#define COND_LT_MASK 0x4 +#define COND_IN_MASK 0x8 + +/* + * The _MASK's are used to get a the specified field after it has been + * shifted by _SHIFT and then bit patterns above can be used to test + * the field. These are useful in assembly code. + */ + +#define FPU_BASE_SHIFT 21 +#define FPU_BASE_MASK 0x1f +#define FPU_FMT_SHIFT 21 +#define FPU_FMT_MASK 0xf +#define FPU_RT_SHIFT 16 +#define FPU_RT_MASK 0x1f +#define FPU_RT_FPRMASK 0x1e +#define FPU_RS_SHIFT 11 +#define FPU_RS_MASK 0x1f +#define FPU_RS_FPRMASK 0x1e +#define FPU_RD_SHIFT 6 +#define FPU_RD_MASK 0x1f +#define FPU_RD_FPRMASK 0x1e + +#ifndef _ASMLANGUAGE + +/* + * Structure and constant definisions for the floating-point control + * implementation and revision register (fpc_irr). + */ +union fpc_irr { + unsigned long fi_word; + struct { +#if _BYTE_ORDER==_BIG_ENDIAN + unsigned int reserved : 16; + unsigned int implementation : 8; + unsigned int revision : 8; +#endif /* _BYTE_ORDER==_BIG_ENDIAN */ +#if _BYTE_ORDER==_LITTLE_ENDIAN + unsigned int revision : 8; + unsigned int implementation : 8; + unsigned int reserved : 16; +#endif /* _BYTE_ORDER==_LITTLE_ENDIAN */ + } fi_struct; +}; +#endif /* _ASMLANGUAGE */ + +/* + * Constants for the implementation fieid of the fpc_irr structure for the + * known implementations. + */ +#define IMPLEMENTATION_NONE 0 /* software */ +#define IMPLEMENTATION_R2360 1 /* board */ +#define IMPLEMENTATION_R2010 2 /* chip */ + +/* + * The constant IRR_IMP_MASK is to get at the implementation fieid of the + * implementation and revision register. The other constants (IRR_IMP_*) + * are constants for the known implementations. + */ +#define IRR_IMP_MASK 0x0000ff00 + +#define IRR_IMP_NONE 0x00000000 +#define IRR_IMP_R2360 0x00000100 +#define IRR_IMP_R2010 0x00000200 +#define IRR_IMP_R3010 0x00000300 +#define IRR_IMP_R6010 0x00000400 + +/* + * Structure and constant definisions for the floating-point control + * control and status register (fpc_csr). + */ +#ifndef _ASMLANGUAGE +union fpc_csr { + unsigned long fc_word; + struct { +#if _BYTE_ORDER==_BIG_ENDIAN + unsigned int reserved0 : 8; + unsigned int condition : 1; + unsigned int reserved1 : 5; + + unsigned int ex_unimplemented : 1; + unsigned int ex_invalid : 1; + unsigned int ex_divide0 : 1; + unsigned int ex_overflow : 1; + unsigned int ex_underflow : 1; + unsigned int ex_inexact : 1; + + unsigned int en_invalid : 1; + unsigned int en_divide0 : 1; + unsigned int en_overflow : 1; + unsigned int en_underflow : 1; + unsigned int en_inexact : 1; + + unsigned int se_invalid : 1; + unsigned int se_divide0 : 1; + unsigned int se_overflow : 1; + unsigned int se_underflow : 1; + unsigned int se_inexact : 1; + + unsigned int rounding_mode : 2; +#endif /* _BYTE_ORDER==_BIG_ENDIAN */ +#if _BYTE_ORDER==_LITTLE_ENDIAN + unsigned int rounding_mode : 2; + + unsigned int se_inexact : 1; + unsigned int se_underflow : 1; + unsigned int se_overflow : 1; + unsigned int se_divide0 : 1; + unsigned int se_invalid : 1; + + unsigned int en_inexact : 1; + unsigned int en_underflow : 1; + unsigned int en_overflow : 1; + unsigned int en_divide0 : 1; + unsigned int en_invalid : 1; + + unsigned int ex_inexact : 1; + unsigned int ex_underflow : 1; + unsigned int ex_overflow : 1; + unsigned int ex_divide0 : 1; + unsigned int ex_invalid : 1; + unsigned int ex_unimplemented : 1; + + unsigned int reserved1 : 5; + unsigned int condition : 1; + unsigned int reserved0 : 8; +#endif /* _BYTE_ORDER==_LITTLE_ENDIAN */ + } fc_struct; +}; +#endif /* _ASMLANGUAGE */ + +/* + * Constants for the rounding_mode field of the fpc_csr + */ +#define ROUND_TO_NEAREST 0 +#define ROUND_TO_ZERO 1 +#define ROUND_TO_PLUS_INFINITY 2 +#define ROUND_TO_MINUS_INFINITY 3 + +/* Masks to get at the unimplemented exception */ +#define FPCSR_UNIMP 0x00020000 +#define FPCSR_EXCEPTIONS 0x0003f000 /* all exceptions */ +#define FPCSR_ENABLES 0x00000f80 /* all enables */ + +/* + * fpc_parity bits + */ +#define FPPARITY_FRF 0x00800000 /* force reg file parity error */ +#define FPPARITY_IRF 0x00020000 /* inhibit reg file parity error */ +#define FPPARITY_IIB 0x00010000 /* inhibit icache bus parity error */ +#define FPPARITY_RF 0x00000002 /* reg file parity error */ +#define FPPARITY_IB 0x00000001 /* icache bus parity error */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfpSofth */ diff --git a/h/arch/mips/fppMipsLib.h b/h/arch/mips/fppMipsLib.h new file mode 100644 index 0000000..1e0013f --- /dev/null +++ b/h/arch/mips/fppMipsLib.h @@ -0,0 +1,201 @@ +/* fppMipsLib.h - R3010 floating-point coprocessor support library header */ + +/* + * This file has been developed or significantly modified by the + * MIPS Center of Excellence Dedicated Engineering Staff. + * This notice is as per the MIPS Center of Excellence Master Partner + * Agreement, do not remove this notice without checking first with + * WR/Platforms MIPS Center of Excellence engineering management. + */ + +/* +modification history +-------------------- +01q,07dec03,pes Cleanup Compiler warnings. +01p,31may02,tpw Fix typo in offset of f29. SPR 78188. +01o,16jul01,ros add CofE comment +01n,05jun01,mem Add FPEXTRA +01m,05jun01,tlc Add IMPORT declaration for fppArchUnitInit(); +01l,05oct99,dra Added 32 FP reg mode support. +01k,25nov96,kkk added prototypes for math routines. +01j,22sep92,rrr added support for c++ +01i,04jul92,jcf added variable declarations; changed fp*RegIndex to fp*RegName +01h,03jun92,ajm updated file name referenced to match real name +01g,26may92,rrr the tree shuffle +01f,23feb92,yao added FPREG_SET. renamed FP_NUM_REGS to FP_NUM_DREGS. +01e,04oct91,rrr passed through the ansification filter + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01d,01aug91,ajm added definitions for assembler language +01c,04may90,dcb added MIPS R3000 support +01b,18mar88,gae boosted FP_STATE_FRAME_SIZE by 32 for MC68882. +01a,12aug87,gae written. +*/ + +#ifndef __INCfppMipsLibh +#define __INCfppMipsLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* extra space for expansion: e.g., vr5400 ACC */ +#define FP_EXTRA 8 + +/* maximum size of floating-point coprocessor state frame */ +#define FP_STATE_FRAME_SIZE \ + ((FP_NUM_REGS * _WRS_FP_REGISTER_SIZE) + ((FP_EXTRA + 1) * 4)) + +/* 32 bit FP support */ +#if (_WRS_FP_REGISTER_SIZE == 4) + +/* number of fp registers on coprocessor */ + +#define FP_NUM_DREGS 16 + +/* 64 bit FP support */ +#elif (_WRS_FP_REGISTER_SIZE == 8) + +/* number of fp registers on coprocessor */ + +#define FP_NUM_DREGS 32 + +#else /* _WRS_FP_REGISTER_SIZE */ +#error "invalid _WRS_FP_REGISTER_SIZE value" +#endif /* _WRS_FP_REGISTER_SIZE */ + +#ifndef _ASMLANGUAGE + +typedef struct fpContext /* FP_CONTEXT */ + { + double fpx[FP_NUM_DREGS]; /* fp registers */ + int fpcsr; /* control/statu */ + int pad; /* padding */ + int fpxtra[FP_EXTRA]; /* ACC, etc */ + } FP_CONTEXT; + +#define FPREG_SET FP_CONTEXT + +#endif /* _ASMLANGUAGE */ + +/* variable declarations */ + + +#ifndef _ASMLANGUAGE + +extern REG_INDEX fpRegName[]; /* f-point data register table */ +extern REG_INDEX fpCtlRegName[]; /* f-point control register table */ +extern WIND_TCB *pFppTaskIdPrevious; /* task id for deferred exceptions */ +extern FUNCPTR fppCreateHookRtn; /* arch dependent create hook routine */ +extern FUNCPTR fppDisplayHookRtn; /* arch dependent display routine */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT void fppArchInit (void); +IMPORT void fppArchTaskCreateInit (FP_CONTEXT *pFpContext); +IMPORT void fppInitialize(void); +IMPORT void fppArgsToRegs (double *dblPtr); +IMPORT ULONG fppClearFloat(void); +IMPORT void fppArchUnitInit(void); + +#else /* __STDC__ */ + +IMPORT void fppArchInit (); +IMPORT void fppArchTaskCreateInit (); +IMPORT void fppInitialize(); +IMPORT void fppArgsToRegs (); +IMPORT ULONG fppClearFloat(); +IMPORT void fppArchUnitInit(); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +/* FP_CONTEXT structure offsets */ +#if (_WRS_FP_REGISTER_SIZE==4) + +#define FPX 0x0 /* OFFSET(FP_CONTEXT, fpx[0]) */ +#define FP0 0x0 /* OFFSET(fpx[0]) */ +#define FP1 0x4 /* OFFSET(fpx[1]) */ +#define FP2 0x8 /* OFFSET(fpx[2]) */ +#define FP3 0xc /* OFFSET(fpx[3]) */ +#define FP4 0x10 /* OFFSET(fpx[4]) */ +#define FP5 0x14 /* OFFSET(fpx[5]) */ +#define FP6 0x18 /* OFFSET(fpx[6]) */ +#define FP7 0x1c /* OFFSET(fpx[7]) */ +#define FP8 0x20 /* OFFSET(fpx[8]) */ +#define FP9 0x24 /* OFFSET(fpx[9]) */ +#define FP10 0x28 /* OFFSET(fpx[10]) */ +#define FP11 0x2c /* OFFSET(fpx[11]) */ +#define FP12 0x30 /* OFFSET(fpx[12]) */ +#define FP13 0x34 /* OFFSET(fpx[13]) */ +#define FP14 0x38 /* OFFSET(fpx[14]) */ +#define FP15 0x3c /* OFFSET(fpx[15]) */ +#define FP16 0x40 /* OFFSET(fpx[16]) */ +#define FP17 0x44 /* OFFSET(fpx[17]) */ +#define FP18 0x48 /* OFFSET(fpx[18]) */ +#define FP19 0x4c /* OFFSET(fpx[19]) */ +#define FP20 0x50 /* OFFSET(fpx[20]) */ +#define FP21 0x54 /* OFFSET(fpx[21]) */ +#define FP22 0x58 /* OFFSET(fpx[22]) */ +#define FP23 0x5c /* OFFSET(fpx[23]) */ +#define FP24 0x60 /* OFFSET(fpx[24]) */ +#define FP25 0x64 /* OFFSET(fpx[25]) */ +#define FP26 0x68 /* OFFSET(fpx[26]) */ +#define FP27 0x6c /* OFFSET(fpx[27]) */ +#define FP28 0x70 /* OFFSET(fpx[28]) */ +#define FP29 0x74 /* OFFSET(fpx[29]) */ +#define FP30 0x78 /* OFFSET(fpx[30]) */ +#define FP31 0x7c /* OFFSET(fpx[31]) */ +#define FPCSR 0x80 /* OFFSET(FP_CONTEXT, fpcsr) */ +#define FPEXTRA 0x88 /* OFFSET(FP_CONTEXT, fpxtra) */ + +#elif ( _WRS_FP_REGISTER_SIZE==8) + +#define FPX 0x0 /* OFFSET(FP_CONTEXT, fpx[0]) */ +#define FP0 0x0 /* OFFSET(fpx[0]) */ +#define FP1 0x8 /* OFFSET(fpx[1]) */ +#define FP2 0x10 /* OFFSET(fpx[2]) */ +#define FP3 0x18 /* OFFSET(fpx[3]) */ +#define FP4 0x20 /* OFFSET(fpx[4]) */ +#define FP5 0x28 /* OFFSET(fpx[5]) */ +#define FP6 0x30 /* OFFSET(fpx[6]) */ +#define FP7 0x38 /* OFFSET(fpx[7]) */ +#define FP8 0x40 /* OFFSET(fpx[8]) */ +#define FP9 0x48 /* OFFSET(fpx[9]) */ +#define FP10 0x50 /* OFFSET(fpx[10]) */ +#define FP11 0x58 /* OFFSET(fpx[11]) */ +#define FP12 0x60 /* OFFSET(fpx[12]) */ +#define FP13 0x68 /* OFFSET(fpx[13]) */ +#define FP14 0x70 /* OFFSET(fpx[14]) */ +#define FP15 0x78 /* OFFSET(fpx[15]) */ +#define FP16 0x80 /* OFFSET(fpx[16]) */ +#define FP17 0x88 /* OFFSET(fpx[17]) */ +#define FP18 0x90 /* OFFSET(fpx[18]) */ +#define FP19 0x98 /* OFFSET(fpx[19]) */ +#define FP20 0xa0 /* OFFSET(fpx[20]) */ +#define FP21 0xa8 /* OFFSET(fpx[21]) */ +#define FP22 0xb0 /* OFFSET(fpx[22]) */ +#define FP23 0xb8 /* OFFSET(fpx[23]) */ +#define FP24 0xc0 /* OFFSET(fpx[24]) */ +#define FP25 0xc8 /* OFFSET(fpx[25]) */ +#define FP26 0xd0 /* OFFSET(fpx[26]) */ +#define FP27 0xd8 /* OFFSET(fpx[27]) */ +#define FP28 0xe0 /* OFFSET(fpx[28]) */ +#define FP29 0xe8 /* OFFSET(fpx[29]) */ +#define FP30 0xf0 /* OFFSET(fpx[30]) */ +#define FP31 0xf8 /* OFFSET(fpx[31]) */ +#define FPCSR 0x100 /* OFFSET(FP_CONTEXT, fpcsr) */ +#define FPEXTRA 0x108 /* OFFSET(FP_CONTEXT, fpxtra) */ + +#else /* _WRS_FP_REGISTER_SIZE */ +#error "invalid _WRS_FP_REGISTER_SIZE value" +#endif /* _WRS_FP_REGISTER_SIZE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfppMipsLibh */ diff --git a/h/arch/mips/in_cksum.h b/h/arch/mips/in_cksum.h new file mode 100644 index 0000000..3f73298 --- /dev/null +++ b/h/arch/mips/in_cksum.h @@ -0,0 +1,176 @@ +/* in_cksum.h - x86 version in_cksum header file */ + +/* Copyright 2001-2002 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from tahoe: in_cksum.c 1.2 86/01/05 + * from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91 + * from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp + * $FreeBSD: src/sys/i386/include/in_cksum.h,v 1.7.2.1 2000/05/05 13:37:00 jlemon Exp $ + */ + +/* +modification history +-------------------- +01f,25aug05,dlk Add section tags. +01e,24mar04,m_h Internet Checksum +01d,20nov03,niq Remove copyright_wrs.h file inclusion +01c,05nov03,rlm Ran batch header update for header re-org. +01b,25jul02,rvr removed DCC specific code +01a,13sep01,hsh Created from BSD 4.3 +*/ + + +#ifndef _MACHINE_IN_CKSUM_H_ +#define _MACHINE_IN_CKSUM_H_ 1 + +#include + +/* + * in_cksum_hdr - checksum on header only + * + * It is useful to have an Internet checksum routine which is inlineable + * and optimized specifically for the task of computing IP header checksums + * in the normal case (where there are no options and the header length is + * therefore always exactly five 32-bit words. + */ + +static __inline +u_int in_cksum_hdr + ( + const struct ip *ip + ) + { + register u_int sum = 0; + int hlen = sizeof (struct ip); + register u_short *w = (u_short *) ip; + u_short remaining = 0; + + while (hlen > 1) + { + sum += *w++; + hlen -= 2; + } + + if (hlen == 1) + { + *(u_char *) (&remaining) = *(u_char *) w; + sum += remaining; + } + + sum = (sum & 0xffff) + (sum >> 16); + if (sum > 0xffff) + sum -= 0xffff; + + return ~sum & 0xffff; + } + +/* + * in_cksum_update + */ + +static __inline +void in_cksum_update + ( + struct ip *ip + ) + { + int __tmpsum; + __tmpsum = (int)ntohs(ip->ip_sum) + 256; + ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); + } + +/* + * in_pseudo - pre-checksum parts of pseudo-header + * + * Compute significant parts of the IPv4 checksum pseudo-header * for use in a + * delayed TCP/UDP checksum calculation. + * + * Args: + * + * src Source IP address + * dst Destination IP address + * lenproto htons(proto-hdr-len + proto-number) + */ + +static __inline +u_int16_t in_pseudo + ( + u_int32_t src, + u_int32_t dst, + u_int32_t lenproto + ) + { + u_int32_t sum; + + sum = lenproto + + (u_int16_t)(src >> 16) + + (u_int16_t)(src /*& 0xffff*/) + + (u_int16_t)(dst >> 16) + + (u_int16_t)(dst /*& 0xffff*/); + + sum = (u_int16_t)(sum >> 16) + (u_int16_t)(sum /*& 0xffff*/); + + if (sum > 0xffff) + sum -= 0xffff; + + return (sum); + } + +/* + * in_addword - Add two 16-bit workd + * + * Add the two 16-bit network-order values, carry, and return. + */ + +static __inline +u_int16_t in_addword + ( + u_int16_t a, + u_int16_t b + ) + { + u_int32_t sum = a + b; + + if (sum > 0xffff) + sum -= 0xffff; + + return (sum); + } + +_WRS_FASTTEXT +u_short in_cksum_skip(struct mbuf *m, int len, int skip); + +#endif /* _MACHINE_IN_CKSUM_H_ */ + diff --git a/h/arch/mips/intMipsLib.h b/h/arch/mips/intMipsLib.h new file mode 100644 index 0000000..47abc7d --- /dev/null +++ b/h/arch/mips/intMipsLib.h @@ -0,0 +1,42 @@ +/* intMipsLib.h - MIPS-specific interrupt library header file */ + +/* Copyright 1984-1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,26oct99,dra created. +*/ + +#ifndef __INCintMipsLibh +#define __INCintMipsLibh + +#if defined(__STDC__) || defined(__cplusplus) + +#ifdef __cplusplus +extern "C" { +#endif + +extern int intCRGet (void); +extern void intCRSet (int value); +extern int intSRGet (void); +extern int intSRSet (int value); +extern int intDisable (int); +extern int intEnable (int); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#else /* defined(__STDC__) || defined(__cplusplus) */ + +extern int intCRGet (); +extern void intCRSet (); +extern int intSRGet (); +extern int intSRSet (); +extern int intDisable (); +extern int intEnable (); + +#endif /* defined(__STDC__) || defined(__cplusplus) */ + +#endif /* __INCintMipsLibh */ diff --git a/h/arch/mips/ivMips.h b/h/arch/mips/ivMips.h new file mode 100644 index 0000000..9e8b5ec --- /dev/null +++ b/h/arch/mips/ivMips.h @@ -0,0 +1,107 @@ +/* ivMips.h - interrupt vectors for MIPS architecture CPUs */ + +/* Copyright 1990-1993, 1996, 1999, 2001, 2004 Wind River Systems, Inc. */ + +/* + * This file has been developed or significantly modified by the + * MIPS Center of Excellence Dedicated Engineering Staff. + * This notice is as per the MIPS Center of Excellence Master Partner + * Agreement, do not remove this notice without checking first with + * WR/Platforms MIPS Center of Excellence engineering management. + */ + +/* +modification history +-------------------- +01n,14oct04,pes Correct copyright notice, add definition for Machine + Check vector +01m,16jul01,ros add CofE comment +01l,10sep99,myz added CW4000_16 support. +01k,12jul99,alp added CW4000 support +01k,19jan99,dra added CW4000, CW4011, VR4100, VR5000 and VR5400 support. +01j,13jul96,kkk added R4650 CPU type definitions +01i,18apr96,rml added definitions for R4650 specific exceptions +01h,18oct93,cd added R4000 support. +01g,29apr93,caf changed INUM_TO_IVEC to return VOIDFUNCPTR * for intConnect(). +01f,22sep92,rrr added support for c++ +01e,03jun92,ajm merged 5.0.5 +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -changed copyright notice +01b,20dec90,ajm reordered VME interrupt definitions +01a,20apr90,ajm defined vector defintions for MIPS R3000. +*/ + +#ifndef __INCivMipsh +#define __INCivMipsh + +#ifdef __cplusplus +extern "C" { +#endif + +/* macros to convert interrupt vectors <-> interrupt numbers */ + +#define IVEC_TO_INUM(intVec) ((int) (intVec) >> 2) +#define INUM_TO_IVEC(intNum) ((VOIDFUNCPTR *) ((intNum) << 2)) + + +/* vector numbers of specific MIPS exceptions */ + +#define IV_LOW_VEC 0 /* lowest vector initialized */ +#define IV_TLBMOD_VEC 1 /* tlb mod vector */ +#define IV_TLBL_VEC 2 /* tlb load vector */ +#define IV_TLBS_VEC 3 /* tlb store vector */ +#define IV_ADEL_VEC 4 /* address load vector */ +#define IV_ADES_VEC 5 /* address store vector */ +#define IV_IBUS_VEC 6 /* instr. bus error vector */ +#define IV_DBUS_VEC 7 /* data bus error vector */ +#define IV_SYSCALL_VEC 8 /* system call vector */ +#define IV_BP_VEC 9 /* break point vector */ +#define IV_RESVDINST_VEC 10 /* rsvd instruction vector */ +#define IV_CPU_VEC 11 /* coprocessor unusable vector */ +#define IV_OVF_VEC 12 /* overflow vector */ +#define IV_TRAP_VEC 13 /* trap vector */ +#define IV_VCEI_VEC 14 /* virtual coherency inst. vec */ +#define IV_FPE_VEC 15 /* floating point vector */ + +#define IV_RESVD16_VEC 16 /* reserved entry */ +#define IV_RESVD17_VEC 17 /* reserved entry */ +#define IV_RESVD18_VEC 18 /* reserved entry */ +#define IV_RESVD19_VEC 19 /* reserved entry */ +#define IV_RESVD20_VEC 20 /* reserved entry */ +#define IV_RESVD21_VEC 21 /* reserved entry */ +#define IV_RESVD22_VEC 22 /* reserved entry */ +#define IV_WATCH_VEC 23 /* watchpoint vector */ +#define IV_MCHECK_VEC 24 /* machine check */ +#define IV_RESVD25_VEC 25 /* reserved entry */ +#define IV_RESVD26_VEC 26 /* reserved entry */ +#define IV_RESVD27_VEC 27 /* reserved entry */ +#define IV_RESVD28_VEC 28 /* reserved entry */ +#define IV_RESVD29_VEC 29 /* reserved entry */ +#define IV_RESVD30_VEC 30 /* reserved entry */ +#define IV_VCED_VEC 31 /* virtual coherency data vec */ +#define IV_SWTRAP0_VEC 32 /* software trap 0 */ +#define IV_SWTRAP1_VEC 33 /* software trap 1 */ +#define IV_FPA_UNIMP_VEC 54 /* unimplemented FPA oper */ +#define IV_FPA_INV_VEC 55 /* invalid FPA operation */ +#define IV_FPA_DIV0_VEC 56 /* FPA div by zero */ +#define IV_FPA_OVF_VEC 57 /* FPA overflow exception */ +#define IV_FPA_UFL_VEC 58 /* FPA underflow exception */ +#define IV_FPA_PREC_VEC 59 /* FPA inexact operation */ +#define IV_BUS_ERROR_VEC 60 /* bus error vector */ +#define USER_VEC_START 32 /* start of user interrupt vectors */ +#define LOW_VEC 32 /* lowest autovector initialized */ +#define HIGH_VEC 255 /* highest autovector initialized */ +#define IV_FPA_BASE_VEC IV_FPA_UNIMP_VEC + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCivMipsh */ + + + + + diff --git a/h/arch/mips/mipsR2Hazards.h b/h/arch/mips/mipsR2Hazards.h new file mode 100644 index 0000000..32af939 --- /dev/null +++ b/h/arch/mips/mipsR2Hazards.h @@ -0,0 +1,41 @@ +/* mipsR2Hazards.h - assembler definitions header file */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,11apr05,d_c rename mti24kxHazards.h to mipsR2Hazards.h +01b,24feb05,pes Modified to use the 'ehb' instruction, either by + macro or actual instruction (if supported by assembler) +01a,16feb05,pes Created from mti5kxHazards.h +*/ + +/* These hazard macros are intended for use with MIPS architecture- + * dependent assembly files which require handling hazards. + * These macros support release 2 ISA cores + * This file is included by the asmMips.h file when the HAZARD_FILE macro + * is defined using + * #define HAZARD_FILE "mipsR2Hazards.h" + */ + +#ifndef __INCmipsR2Hazardsh +#define __INCmipsR2Hazardsh + +/* Hazard macros */ +#if defined (_WRS_MIPS_ENABLE_R2_ISA) +#define EHB ehb +#else +#define EHB .word 0x000000c0 /* ehb opcode */ +#endif /* _WRS_MIPS_ENABLE_R2_ISA */ + +#define HAZARD_TLB EHB +#define HAZARD_ERET EHB +#define HAZARD_CP_READ EHB +#define HAZARD_CP_WRITE EHB +#define HAZARD_CACHE_TAG EHB +#define HAZARD_CACHE EHB +#define HAZARD_INTERRUPT EHB + +#endif /* __INCmipsR2Hazardsh */ + diff --git a/h/arch/mips/mmuMipsLib.h b/h/arch/mips/mmuMipsLib.h new file mode 100644 index 0000000..56c1e2e --- /dev/null +++ b/h/arch/mips/mmuMipsLib.h @@ -0,0 +1,499 @@ +/* mmuMipsLib.h - Memory Management Unit Library for MIPS */ + +/* Copyright (c) 1999-2000, 2003-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01y,23feb05,d_c SPR 103891: Add bit to arch-dependent state word to + indicate user has access. Add bit to PTE to indicate + page is in kuseg. Corrected copyright. +01x,09dec04,pes Remove setting the 8K page size bit in MMU_PTE_INIT_STATE. + This is an artifact of old code that encoded entryLo1 instead + of entryLo0. +01w,01nov04,slk Add define for OSM error stack pointer +01v,22oct04,slk SPR 92598: Add support for OSM handler and guard page size + storage in the exception page scratch area +01u,21sep04,sru Added comment describing rationale for 8K MMU page size. +01t,15sep04,sru Made MMU_PAGE_SIZE a simple constant, so that it can be + used as a parameter to the _WRS_DATA_ALIGN_BYTES directive. +01s,06aug04,sru Add bitfields to pageMask portion of TLB. Create TLB + structure for reading TLB hardware; update page masks. +01r,24mar04,slk Modify definition of MMU_VA_TO_PFN_MASK for 16M rather than + 4K page size. Also rename MMU_VA_TO_PFN_MASK to + MMU_VA_TO_PFN_16M_MASK. +01q,02mar04,pes Correct conditional expression for determining definition of + MMU_PTE_TLBLO0_OFFSET. +01p,17feb04,pes Adjust offset to tlblo0 in PTE to deal with big-endian 32-bit + hosts. +01o,11dec03,jmt Code Review changes +01n,08dec03,jmt Incorporate Code Review changes +01m,02dec03,jmt Continued Testing of MIPS AIM AD-MMU code +01l,19nov03,jmt Continue development of MIPS AD-MMU code +01k,30oct03,jmt rewrite as architecture-dependent portion of AIM MMU library +01j,16sep03,jmt Modify TLB Handling for Base 6 +01i,10sep03,jmt Merge code from AE to Base 6 +01h,12sep00,dra Cleanup. +01g,30aug00,dra Updated ASID fields. +01f,14jun00,dra generalize the mmuMipsUnMap flush of virtual page address to + all Mips archs +01e,19apr00,dra Expand MMU_MIPS_CONFIG to allow write protection of page + tables. Add support for page unmap address flush. +01d,13apr00,dra Added support for xTLB vector. +01c,24jan00,dra Added pointer to mmuMipsConfig struct for + mmuMipsContextSet routine. +01b,15sep99,dra Updated MMU_STATE macros. +01a,30jul99,dra Created. +*/ + +/* +DESCRIPTION: + +The MIPS family of devices range from the Toshiba TX3907 to the NEC VR4100 +resulting in a wide range of implementations of memory management units. +This library contains the constant declarations, structures, and globals +that are generic to all of these devices. + +The MIPS mmu library is a two-part library made from the generic library +module and a device-specific module; mmuMipsLib and mmuMipsxxxLib respectively. +This header file contains the data structure MMU_MIPS_CONFIG used to +interface the generic module to the device-specific one. It also contains +declarations of all of the device-specific library initialization functions +as well as the generic one. + +*/ + +#ifndef __INCmmuMipsLibh +#define __INCmmuMipsLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE +#include "aimMmuLib.h" +#endif + +/* Defines */ + +/* + * Table Entry Definitions + * These are definitions for the indexes for the cache, protection + * and mask tables defined for every device-dependent library + */ + +/* Protection Table Indexes */ + +#define MMU_READWRITE 3 +#define MMU_NO_WRITE 2 +#define MMU_WRITE 32 + +/* Cache Table Indexes */ + +#define MMU_INVALID 0 +#define MMU_CACHEOFF 1 +#define MMU_CPYBACK 2 +#define MMU_WRTHRU 3 +#define MMU_COHRNT 4 + +/* Mask Table Indexes */ + +#define MMU_PMASK 1 +#define MMU_VMASK 2 +#define MMU_PVMASK 3 +#define MMU_CMASK 4 +#define MMU_PCMASK 5 +#define MMU_VCMASK 6 +#define MMU_PVCMASK 7 + +/* Temporary Storage offsets */ + +/* Exc page virtual base addrs */ + +#define EXCPAGE_VIRT_BASE_ADRS 0xFFFFE000 + +/* Exc scratch area when an Exc page is mapped in the TLB */ + +#define EXCPAGE_EXCSTUB_BASE (-0x100) +#define EXCPAGE_EXCSTUB_AT (EXCPAGE_EXCSTUB_BASE-0x08) +#define EXCPAGE_EXCSTUB_K0 (EXCPAGE_EXCSTUB_BASE-0x10) +#define EXCPAGE_EXCSTUB_K1 (EXCPAGE_EXCSTUB_BASE-0x18) +#define EXCPAGE_EXCSTUB_T0 (EXCPAGE_EXCSTUB_BASE-0x20) +#define EXCPAGE_EXCSTUB_T1 (EXCPAGE_EXCSTUB_BASE-0x28) +#define EXCPAGE_EXCSTUB_T2 (EXCPAGE_EXCSTUB_BASE-0x30) +#define EXCPAGE_EXCSTUB_T3 (EXCPAGE_EXCSTUB_BASE-0x38) +#define EXCPAGE_EXCSTUB_T4 (EXCPAGE_EXCSTUB_BASE-0x40) +#define EXCPAGE_EXCSTUB_T5 (EXCPAGE_EXCSTUB_BASE-0x48) +#define EXCPAGE_EXCSTUB_T6 (EXCPAGE_EXCSTUB_BASE-0x50) +#define EXCPAGE_EXCSTUB_T7 (EXCPAGE_EXCSTUB_BASE-0x58) +#define EXCPAGE_EXCSTUB_T8 (EXCPAGE_EXCSTUB_BASE-0x60) +#define EXCPAGE_EXCSTUB_T9 (EXCPAGE_EXCSTUB_BASE-0x68) +#define EXCPAGE_EXCSTUB_BVA (EXCPAGE_EXCSTUB_BASE-0x70) +#define EXCPAGE_EXCSTUB_PC (EXCPAGE_EXCSTUB_BASE-0x78) +#define EXCPAGE_EXCSTUB_TLBHI (EXCPAGE_EXCSTUB_BASE-0x80) +#define EXCPAGE_EXCSTUB_CR (EXCPAGE_EXCSTUB_BASE-0x88) +#define EXCPAGE_EXCSTUB_SR (EXCPAGE_EXCSTUB_BASE-0x90) +#define EXCPAGE_EXCSTUB_SP (EXCPAGE_EXCSTUB_BASE-0x98) + +/* sigCtx scratch area when an Exc page is mapped in the TLB */ + +#define EXCPAGE_SIGCTX_BASE (-0x200) +#define EXCPAGE_SIGCTX_T1 (EXCPAGE_SIGCTX_BASE-0x08) +#define EXCPAGE_SIGCTX_SR (EXCPAGE_SIGCTX_BASE-0x10) +#define EXCPAGE_SIGCTX_PC (EXCPAGE_SIGCTX_BASE-0x18) + +/* MMU Miss handling scratch area when an Exc page is mapped in the TLB */ + +#define EXCPAGE_MMU_BASE (-0x300) +#define EXCPAGE_MMU_HANDLER (EXCPAGE_MMU_BASE-0x08) +#define EXCPAGE_MMU_CNTXT_TBL (EXCPAGE_MMU_BASE-0x10) +#define EXCPAGE_MMU_VADDR_MASK (EXCPAGE_MMU_BASE-0x18) +#define EXCPAGE_MMU_VADDR_SHIFT (EXCPAGE_MMU_BASE-0x20) +#define EXCPAGE_MMU_MISS_COUNT (EXCPAGE_MMU_BASE-0x28) +#define EXCPAGE_MMU_MISS_COUNT_INS (EXCPAGE_MMU_BASE-0x30) + +/* OSM handler support defines */ + +#define EXCPAGE_OSM_BASE (-0x400) +#define EXCPAGE_OSM_HANDLER (EXCPAGE_OSM_BASE-0x08) +#define EXCPAGE_OSM_GUARDPAGE_SIZE (EXCPAGE_OSM_BASE-0x10) + +/* + * The MIPS MMU supports a hardware page size of 4K. However, the MMU + * library treats each TLB register group as an entity for a single + * virtual->physical mapping. So, the EntryLo0 and EntryLo1 registers + * are always configured to map adjacent physical pages. For this reason, + * the de facto hardware page size is 2 * 4k, or 8K. + */ + +#define MMU_PAGE_SIZE 0x2000 /* used in _WRS_ALIGN... directive */ + +/* TLB scratch area when an Exc page is mapped in the TLB */ + +#define TLB_EXCPAGE_AT (-0x08) +#define TLB_EXCPAGE_K0 (-0x10) +#define TLB_EXCPAGE_K1 (-0x18) +#define TLB_EXCPAGE_T0 (-0x20) +#define TLB_EXCPAGE_T1 (-0x28) +#define TLB_EXCPAGE_T2 (-0x30) +#define TLB_EXCPAGE_T3 (-0x38) +#define TLB_EXCPAGE_T4 (-0x40) +#define TLB_EXCPAGE_T5 (-0x48) +#define TLB_EXCPAGE_T6 (-0x50) +#define TLB_EXCPAGE_T7 (-0x58) +#define TLB_EXCPAGE_T8 (-0x60) + +/* MIPS common masks */ + +#define MIPS_R_ENTRY_MASK 0xFFC00000 /* Mask off top-10 bits in BVaddr */ +#define MIPS_R_ENTRY_SHIFT 22 +#define MIPS_P_ENTRY_MASK 0x003FE000 /* Mask off middle-9 bits in BVaddr */ + +/* Context table information */ + +#define MMU_GLOBAL_CONTEXT 0 +#define MMU_FIRST_LOCAL_CONTEXT 1 +#define MMU_LAST_LOCAL_CONTEXT 255 + +/* Page size support information */ + +/* MMU_PAGE_SIZES_STANDARD are page sizes supported by standard MIPS h/w */ + +#define MMU_PAGE_SIZES_STANDARD (MMU_PAGE_MASK_8K | \ + MMU_PAGE_MASK_32K | \ + MMU_PAGE_MASK_128K | \ + MMU_PAGE_MASK_512K | \ + MMU_PAGE_MASK_2M | \ + MMU_PAGE_MASK_8M | \ + MMU_PAGE_MASK_32M) + +/* MMU_PAGE_SIZES_ALLOWED are page sizes supported by the MIPS AD-MMU */ + +#define MMU_PAGE_SIZES_ALLOWED (MMU_PAGE_MASK_8K | \ + MMU_PAGE_MASK_32K | \ + MMU_PAGE_MASK_128K | \ + MMU_PAGE_MASK_512K | \ + MMU_PAGE_MASK_2M) + +#define MMU_MAX_PAGE_SIZES 5 + + +/* R4K Hardware TLB definitions */ + +#define TLB_4K_PAGE_SIZE 0x00001000 +#define TLB_16K_PAGE_SIZE 0x00004000 +#define TLB_64K_PAGE_SIZE 0x00010000 +#define TLB_256K_PAGE_SIZE 0x00040000 +#define TLB_1M_PAGE_SIZE 0x00100000 +#define TLB_4M_PAGE_SIZE 0x00400000 +#define TLB_16M_PAGE_SIZE 0x01000000 + +#define TLB_4K_PAGE_SIZE_MASK 0x00000000 +#define TLB_16K_PAGE_SIZE_MASK 0x00006000 +#define TLB_64K_PAGE_SIZE_MASK 0x0001E000 +#define TLB_256K_PAGE_SIZE_MASK 0x0007E000 +#define TLB_1M_PAGE_SIZE_MASK 0x001FE000 +#define TLB_4M_PAGE_SIZE_MASK 0x007FE000 +#define TLB_16M_PAGE_SIZE_MASK 0x01FFE000 + +#define TLB_PAGE_MASK_SHIFT 13 /* lower 13 bits must be 0 */ + +/* R4K TLB definitions + * - does not match hardware definitions + * The software will use page sizes twice the Hardware TLB page size + * The page size mask does not change. + */ + +#define TLB_8K_PAGE_SIZE (2*TLB_4K_PAGE_SIZE) +#define TLB_32K_PAGE_SIZE (2*TLB_16K_PAGE_SIZE) +#define TLB_128K_PAGE_SIZE (2*TLB_64K_PAGE_SIZE) +#define TLB_512K_PAGE_SIZE (2*TLB_256K_PAGE_SIZE) +#define TLB_2M_PAGE_SIZE (2*TLB_1M_PAGE_SIZE) +#define TLB_8M_PAGE_SIZE (2*TLB_4M_PAGE_SIZE) +#define TLB_32M_PAGE_SIZE (2*TLB_16M_PAGE_SIZE) + +#define TLB_8K_PAGE_SIZE_MASK TLB_4K_PAGE_SIZE_MASK +#define TLB_32K_PAGE_SIZE_MASK TLB_16K_PAGE_SIZE_MASK +#define TLB_128K_PAGE_SIZE_MASK TLB_64K_PAGE_SIZE_MASK +#define TLB_512K_PAGE_SIZE_MASK TLB_256K_PAGE_SIZE_MASK +#define TLB_2M_PAGE_SIZE_MASK TLB_1M_PAGE_SIZE_MASK +#define TLB_8M_PAGE_SIZE_MASK TLB_4M_PAGE_SIZE_MASK +#define TLB_32M_PAGE_SIZE_MASK TLB_16M_PAGE_SIZE_MASK + +#define TLB_8K_PFN_MASK 0x3FFFFF80 +#define TLB_32K_PFN_MASK 0x3FFFFE00 +#define TLB_128K_PFN_MASK 0x3FFFF800 +#define TLB_512K_PFN_MASK 0x3FFFE000 +#define TLB_2M_PFN_MASK 0x3FFF8000 +#define TLB_8M_PFN_MASK 0x3FFE0000 +#define TLB_32M_PFN_MASK 0x3FF80000 + +#define TLB_2M_VADDR_MASK 0x00200000 +#define TLB_512K_VADDR_MASK 0x00380000 +#define TLB_128K_VADDR_MASK 0x003E0000 +#define TLB_32K_VADDR_MASK 0x003F8000 +#define TLB_8K_VADDR_MASK 0x003FE000 + +#define TLB_2M_VADDR_SHIFT (21 - MMU_PTE_SIZE_SHIFT) +#define TLB_512K_VADDR_SHIFT (19 - MMU_PTE_SIZE_SHIFT) +#define TLB_128K_VADDR_SHIFT (17 - MMU_PTE_SIZE_SHIFT) +#define TLB_32K_VADDR_SHIFT (15 - MMU_PTE_SIZE_SHIFT) +#define TLB_8K_VADDR_SHIFT (13 - MMU_PTE_SIZE_SHIFT) + +/* Page Table Size defines + * These define the page table size for each of the page sizes. + * Use the smallest page size supported + */ +#define TLB_2M_TABLE_SIZE 2 +#define TLB_512K_TABLE_SIZE (4 * TLB_2M_TABLE_SIZE) +#define TLB_128K_TABLE_SIZE (4 * TLB_512K_TABLE_SIZE) +#define TLB_32K_TABLE_SIZE (4 * TLB_128K_TABLE_SIZE) +#define TLB_8K_TABLE_SIZE (4 * TLB_32K_TABLE_SIZE) + +/* State Defines */ + +#define MMU_BASE_STATE 0x00000000 + +/* EntryLo Defines */ + +#define MMU_R4K_4K_PFN_MASK 0x3FFFFFC0 +#define MMU_R4K_4K_PFN2_MASK 0x3FFFFF80 /* mask for 2 pages */ +#define MMU_R4K_VPN2_SHIFT 13 /* right shift justify VPN of + * address + */ +#define MMU_R4K_PFN_SHIFT 6 /* left shift for PFN loc */ +#define MMU_R4K_STATE_VALID 0x00000002 /* V flag set */ +#define MMU_R4K_STATE_VALID_NOT 0x00000000 /* V flag reset */ +#define MMU_R4K_STATE_WRITABLE 0x00000004 /* D flag set */ +#define MMU_R4K_STATE_WRITABLE_NOT 0x00000000 /* D flag reset */ +#define MMU_R4K_STATE_INVALID_STATE 0xC0000000 /* Invalid State */ +#define MMU_R4K_STATE_GLOBAL 0x00000001 /* G flag set */ +#define MMU_R4K_UNCACHED 0x00000010 +#define MMU_R4K_CACHED 0x00000018 + +#define MMU_R4K_GLOBAL_START 0 /* Start point of global bit */ +#define MMU_R4K_VALID_START 1 /* Start point of valid bit */ +#define MMU_R4K_DIRTY_START 2 /* Start point of dirty bit */ +#define MMU_R4K_CACHE_START 3 /* Start point of cache field*/ + +/* Masks */ + +#define MMU_R4K_STATE_MASK_VALID 0x00000002 +#define MMU_R4K_STATE_MASK_WRITABLE 0x00000004 +#define MMU_R4K_STATE_MASK_CACHEABLE 0x00000038 +#define MMU_R4K_TLBLO_MODE_MASK 0x0000003e + +/* State and mask definitions for attributes maintained within PageMask */ + +#define MMU_STATE_MASK_LOCKED 0x00000100 +#define MMU_STATE_LOCKED 0x00000100 +#define MMU_STATE_MASK_ISR_CALLABLE 0x00000200 +#define MMU_STATE_ISR_CALLABLE 0x00000200 +#define MMU_STATE_MASK_USER_ACCESS 0x00000400 +#define MMU_STATE_USER_ACCESS 0x00000400 +#define MMU_STATE_USER_ACCESS_NOT 0x00000000 + +/* EntryHi Defines */ + +#define MMU_R4K_VPN2_MASK 0xffffe000 /* page no mask */ +#define MMU_R4K_ASID_MASK 0x000000ff +#define MMU_VA_TO_PFN_16M_MASK 0x1e000000 /* 16M page mask */ +#define MMU_NUM_ASID 256 +#define MMU_R4K_PAGE_SHIFT 12 /* convert VM pagenum to VA */ + +/* + * Table Entry Definitions + * These are definitions for the indexes for the cache, protection + * and mask tables defined for every device-dependent library + */ + +/* Protection Table Indexes */ + +#define MMU_READWRITE 3 +#define MMU_NO_WRITE 2 +#define MMU_WRITE 32 + +/* Cache Table Indexes */ + +#define MMU_INVALID 0 +#define MMU_CACHEOFF 1 +#define MMU_CPYBACK 2 +#define MMU_WRTHRU 3 +#define MMU_COHRNT 4 + +/* Mask Table Indexes */ + +#define MMU_PMASK 1 +#define MMU_VMASK 2 +#define MMU_PVMASK 3 +#define MMU_CMASK 4 +#define MMU_PCMASK 5 +#define MMU_VCMASK 6 +#define MMU_PVCMASK 7 + +/* TLB Miss Setup Structure offsets */ + +#define MMU_SETUP_VADDR_MASK_OFFSET 0x0 +#define MMU_SETUP_PAGE_MASK_OFFSET 0x4 +#define MMU_SETUP_ENTRYLO0_OR_OFFSET 0x8 +#define MMU_SETUP_TABLE_SIZE_OFFSET 0xc +#define MMU_SETUP_VADDR_SHIFT_OFFSET 0x10 + +/* PTE Defines */ + +#define MMU_BYTES_PER_ENTRY 16 /* Num bytes per page table entry */ +#define MMU_PTE_SIZE_SHIFT 4 +#define MMU_PTE_PAGE_MASK_OFFSET 0x00 +#define MMU_PTE_ENTRYLO1_OR_OFFSET 0x04 +#if defined (_WRS_PHYS_ADDR_IS_64_BITS) && (_BYTE_ORDER == _BIG_ENDIAN) && (_WRS_INT_REGISTER_SIZE == 4) +#define MMU_PTE_TLBLO0_OFFSET 0x0c +#else /* _WRS_PHYS_ADDR_IS_64_BITS) && (_BYTE_ORDER == _BIG_ENDIAN) */ +#define MMU_PTE_TLBLO0_OFFSET 0x08 +#endif /* _WRS_PHYS_ADDR_IS_64_BITS) && (_BYTE_ORDER == _BIG_ENDIAN) */ + +#define MMU_PTE_TBLPTR_MASK 0xFFFFFFFE +#define MMU_PTE_TERM_MASK 0x00000001 +#define MMU_PTE_NOT_TERM 0x00000000 +#define MMU_PTE_TERM 0x00000001 + +#define MMU_TEMP_TLB_STATE (MMU_R4K_STATE_VALID | MMU_R4K_CACHED | \ + MMU_R4K_STATE_WRITABLE | MMU_R4K_STATE_GLOBAL) +#define MMU_PTE_INIT_STATE (MMU_R4K_UNCACHED | MMU_R4K_STATE_WRITABLE) + + +#ifndef _ASMLANGUAGE + +/* The Page-Table Entry (PTE) Structure */ + +typedef struct + { +#if (_BYTE_ORDER == _BIG_ENDIAN) + UINT32 pageMask:19; + UINT32 reserved:10; + UINT32 isKuseg:1; + UINT32 isr:1; + UINT32 locked:1; /* LSB */ +#else /* _BYTE_ORDER == _BIG_ENDIAN */ + UINT32 locked:1; /* LSB */ + UINT32 isr:1; + UINT32 isKuseg:1; + UINT32 reserved:10; + UINT32 pageMask:19; +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + UINT32 entryLo1OrValue; + PHYS_ADDR entryLo0; + } PTE; + +/* Define the TLB Structure. ASM code assumes this is 24 bytes. */ + +typedef struct + { +#if (_WRS_INT_REGISTER_SIZE == 8) + UINT64 entryHi; +#else /* (_WRS_INT_REGISTER_SIZE != 8) */ + UINT32 entryHi; + UINT32 pad1; +#endif /* (_WRS_INT_REGISTER_SIZE != 8) */ + UINT32 entryLo0; + UINT32 entryLo1; + UINT32 pageMask; + UINT32 pad2; + } MIPS_TLB_ENTRY; + + +typedef void (*MMUMIPSTLBCLRFUNC)(UINT, UINT, VIRT_ADDR); +typedef void (*MMUMIPSTLBCLRALLFUNC)(UINT); +typedef void (*MMUMIPSTLBWIREDENTRYSETFUNC)(UINT32, PTE *); +typedef void (*MMUMIPSTLBENABLEFUNC)(UINT,UINT,UINT,FUNCPTR); +typedef void (*MMUMIPSTLBVECFUNC)(void); + +/* + * TLB Setup structure for Miss handler + * + * This structure holds the information needed by the TLB Miss Handler + * to setup the TLB entry. + */ + +typedef struct + { + UINT32 vAddrMask; + UINT32 pageMask; + UINT32 entryLo0OrValue; + UINT32 tableSize; + UINT32 vAddrShift; + } MIPS_TLB_SETUP_STRUCT; + +/* + * This is the structure used to configure the mmu library + * for the varying MIPS architectures. + */ + +typedef struct mmuMipsConfigStruct + { + int nTlbEntries; /* Number of Entries in TLB */ + + UINT minPageSize; /* minimum size of pages, 8k or greater */ + + UINT tlbVector; /* Value of TLB vector for device */ + UINT xtlbVector; /* Value of XTLB vector for device */ + + /* Pointers to subroutines for MIPS device-specific needs */ + + MMUMIPSTLBCLRFUNC ptrMmuInvalidateRtn; /* Invalidate Entry */ + MMUMIPSTLBCLRALLFUNC ptrMmuInvalidateAllRtn; /* Invalidate All */ + } MMU_MIPS_CONFIG; + +IMPORT MMU_MIPS_CONFIG mmuMipsConfig; + +/* Prototypes for MIPS supported MMU Initialization routines */ + +IMPORT STATUS mmuMipsLibInit (); + + +#endif /* ifndef _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmmuMipsLibh */ diff --git a/h/arch/mips/mti5kxHazards.h b/h/arch/mips/mti5kxHazards.h new file mode 100644 index 0000000..79fdc97 --- /dev/null +++ b/h/arch/mips/mti5kxHazards.h @@ -0,0 +1,35 @@ +/* mti5kxHazards.h - assembler definitions header file */ + +/* Copyright 1999-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,14sep05,rlg SPR 110832 - fix the hazards +01b,25feb05,pes Added copyright notice. +01a,07apr04,mem Modified to handle mti5kx hazards +*/ + +/* These hazard macros are intended for use with MIPS architecture- + * dependent assembly files which require handling hazards. + * These macros support the MTI 5kx cores + * This file is included by the asmMips.h file when the HAZARD_FILE macro + * is defined using + * #define HAZARD_FILE "mti5kxHazards.h" + */ + +#ifndef __INCmti5kxHazardsh +#define __INCmti5kxHazardsh + +/* Hazard macros */ + +#define HAZARD_TLB ssnop; ssnop; ssnop +#define HAZARD_ERET ssnop; ssnop +#define HAZARD_CP_READ /* Fully interlocked on read */ +#define HAZARD_CP_WRITE ssnop; ssnop; ssnop +#define HAZARD_CACHE_TAG ssnop +#define HAZARD_CACHE ssnop; ssnop +#define HAZARD_INTERRUPT ssnop; ssnop; ssnop + +#endif /* __INCmti5kxHazardsh */ + diff --git a/h/arch/mips/palMipsLib.h b/h/arch/mips/palMipsLib.h new file mode 100644 index 0000000..afa5fdd --- /dev/null +++ b/h/arch/mips/palMipsLib.h @@ -0,0 +1,94 @@ +/* palMipsLib.h - PAL sundry definitions for MIPS */ + +/* Copyright 2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01c,20sep04,pes Added prototype for palInit(). +01b,16aug04,sru Added prototype for _mipsTlbSizeGet. +01a,26may04,agf Created. +*/ + +/* +DESCRIPTION: + +This file contains the various strutures and macros required for the PAL +processor description for MIPS. + +*/ + +#ifndef __INCpalMipsLibh +#define __INCpalMipsLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifndef _ASMLANGUAGE + +/* externals */ +IMPORT void palInit (void); + +/* typedefs */ + +typedef struct + { + VIRT_ADDR * vectorAddr; /* typically [T,X,C,E]_Vec */ + VIRT_ADDR * excHandler; /* typically exc[Tlb,Xtlb,Cache,Norm]Vec */ + UINT excSize; /* size of handler copied to vectorAddr */ + } MIPS_EXC_VECTOR; + +typedef struct + { + UINT nEntries; /* number of rows in the TLB hardware */ + int supportedPageSizes; + int mmuCacheable; + int mmuUncacheable; + int mmuCacheCopyback; + int mmuCacheWritethrough; + int mmuCacheCoherency; + } MIPS_MMU_INFO; + +typedef struct + { + BOOL present; + UINT lineSize; /* line size in bytes */ + UINT ways; /* Number of ways */ + UINT wayStep; /* Steps between ways */ + UINT sets; /* Number of sets/way */ + UINT modes; /* Supported modes */ + } MIPS_CACHE_INFO; + +typedef struct + { + char *version; /* PAL version string */ + int coreNum; /* processor number */ + MIPS_EXC_VECTOR tVec; + MIPS_EXC_VECTOR xVec; + MIPS_EXC_VECTOR cVec; + MIPS_EXC_VECTOR eVec; + MIPS_MMU_INFO tlb; + MIPS_CACHE_INFO iCache; + MIPS_CACHE_INFO dCache; + MIPS_CACHE_INFO l2Cache; + MIPS_CACHE_INFO l3Cache; + } MIPS_PAL_DESC; + +/* externals */ + +IMPORT MIPS_PAL_DESC palDesc; + +/* function declarations */ + +IMPORT UINT32 _mipsTlbSizeGet (void); + +#endif /* ifndef _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpalMipsLibh */ diff --git a/h/arch/mips/regsMips.h b/h/arch/mips/regsMips.h new file mode 100644 index 0000000..bfd0710 --- /dev/null +++ b/h/arch/mips/regsMips.h @@ -0,0 +1,172 @@ +/* regsMips.h - MIPS registers */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* + * This file has been developed or significantly modified by the + * MIPS Center of Excellence Dedicated Engineering Staff. + * This notice is as per the MIPS Center of Excellence Master Partner + * Agreement, do not remove this notice without checking first with + * WR/Platforms MIPS Center of Excellence engineering management. + */ + +/* +modification history +-------------------- +01n,11sep03,jmt Modify Register Set for Base 6 +01m,22aug03,jmt Add MMU Support +01l,16jul01,ros add CofE comment +01k,30dec97,dbt added common names for registers +01j,16jan96,mem added cause and fpcsr to REG_SET. +01i,18oct93,cd added R4000 support. +01h,22sep92,rrr added support for c++ +01g,09jul92,ajm added defines for ASMLANGUAGE signals +01f,03jun92,ajm updated file name references to match real name +01e,26may92,rrr the tree shuffle +01d,12mar92,yao added SR_OFFSET, PC_OFFSET, GREG_BASE,GREG_OFFSET. +01c,04oct91,rrr passed through the ansification filter + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01b,27may91,ajm reordered REG_SET to mirror R3KESF +01a,01apr91,ajm derived from 01d of 68K. +*/ + +#ifndef __INCregsMipsh +#define __INCregsMipsh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +typedef struct /* REG_SET - MIPS architecture register set */ + { + ULONG sr; /* process status register */ + INSTR *pc; /* program counter - really epc! */ + _RType lo; /* divide lo register */ + _RType hi; /* divide hi register */ + _RType gpreg[32]; /* data registers */ + + /* cause & fpcsr are only set for wdb traps, from ESFMIPS */ + + ULONG cause; /* cause reg for branch bit in getNpc() */ + ULONG fpcsr; /* fp cause reg for getNpc() */ + + ULONG intCtrl; /* extended interrupt control */ + ULONG _ULextra1; /* extra */ + _RType tlbhi; /* current address space storage */ + _RType _RTextra2; /* extra */ + _RType _RTextra3; /* extra */ + _RType _RTextra4; /* extra */ + _RType _RTextra5; /* extra */ + _RType _RTextra6; /* extra */ + _RType _RTextra7; /* extra */ + _RType _RTextra8; /* extra */ + } REG_SET; + +/* some common names for registers */ + +#define zeroReg gpreg[0] /* wired zero */ +#define atReg gpreg[1] /* assembler temp */ +#define v0Reg gpreg[2] /* function return 0 */ +#define v1Reg gpreg[3] /* function return 1 */ +#define a0Reg gpreg[4] /* parameter 0 */ +#define a1Reg gpreg[5] /* parameter 1 */ +#define a2Reg gpreg[6] /* parameter 2 */ +#define a3Reg gpreg[7] /* parameter 3 */ +#define t0Reg gpreg[8] /* caller saved 0 */ +#define t1Reg gpreg[9] /* caller saved 1 */ +#define t2Reg gpreg[10] /* caller saved 2 */ +#define t3Reg gpreg[11] /* caller saved 3 */ +#define t4Reg gpreg[12] /* caller saved 4 */ +#define t5Reg gpreg[13] /* caller saved 5 */ +#define t6Reg gpreg[14] /* caller saved 6 */ +#define t7Reg gpreg[15] /* caller saved 7 */ +#define s0Reg gpreg[16] /* callee saved 0 */ +#define s1Reg gpreg[17] /* callee saved 1 */ +#define s2Reg gpreg[18] /* callee saved 2 */ +#define s3Reg gpreg[19] /* callee saved 3 */ +#define s4Reg gpreg[20] /* callee saved 4 */ +#define s5Reg gpreg[21] /* callee saved 5 */ +#define s6Reg gpreg[22] /* callee saved 6 */ +#define s7Reg gpreg[23] /* callee saved 7 */ +#define t8Reg gpreg[24] /* caller saved 8 */ +#define t9Reg gpreg[25] /* caller saved 8 */ +#define k0Reg gpreg[26] /* kernal reserved 0 */ +#define k1Reg gpreg[27] /* kernal reserved 1 */ +#define gpReg gpreg[28] /* global pointer */ +#define spReg gpreg[29] /* stack pointer */ +#define s8Reg gpreg[30] /* callee saved 8 */ +#define fpReg s8Reg /* gcc says this is frame pointer */ +#define raReg gpreg[31] /* return address */ +#define reg_pc pc /* program counter */ +#define reg_sp spReg /* stack pointer */ +#define reg_fp fpReg /* frame pointer */ + +#define SR_OFFSET (0*4) /* sr register offset */ +#define PC_OFFSET (1*4) /* pc register offset */ + +#endif /* _ASMLANGUAGE */ + +#define GREG_BASE (2*4+2*_RTypeSize) +#define GREG_OFFSET(n) (GREG_BASE + (n)*_RTypeSize) + +#define SRREG (0*4) /* process status register */ +#define PCREG (1*4) /* program counter */ +#define LOREG (2*4+0*_RTypeSize) /* lo register */ +#define HIREG (2*4+1*_RTypeSize) /* hi register */ +#define ZEROREG GREG_OFFSET(0) /* wired zero */ +#define ATREG GREG_OFFSET(1) /* assembler temp */ +#define V0REG GREG_OFFSET(2) /* function return 0 */ +#define V1REG GREG_OFFSET(3) /* function return 1 */ +#define A0REG GREG_OFFSET(4) /* parameter 0 */ +#define A1REG GREG_OFFSET(5) /* parameter 1 */ +#define A2REG GREG_OFFSET(6) /* parameter 2 */ +#define A3REG GREG_OFFSET(7) /* parameter 3 */ +#define T0REG GREG_OFFSET(8) /* caller saved 0 */ +#define T1REG GREG_OFFSET(9) /* caller saved 1 */ +#define T2REG GREG_OFFSET(10) /* caller saved 2 */ +#define T3REG GREG_OFFSET(11) /* caller saved 3 */ +#define T4REG GREG_OFFSET(12) /* caller saved 4 */ +#define T5REG GREG_OFFSET(13) /* caller saved 5 */ +#define T6REG GREG_OFFSET(14) /* caller saved 6 */ +#define T7REG GREG_OFFSET(15) /* caller saved 7 */ +#define S0REG GREG_OFFSET(16) /* callee saved 0 */ +#define S1REG GREG_OFFSET(17) /* callee saved 1 */ +#define S2REG GREG_OFFSET(18) /* callee saved 2 */ +#define S3REG GREG_OFFSET(19) /* callee saved 3 */ +#define S4REG GREG_OFFSET(20) /* callee saved 4 */ +#define S5REG GREG_OFFSET(21) /* callee saved 5 */ +#define S6REG GREG_OFFSET(22) /* callee saved 6 */ +#define S7REG GREG_OFFSET(23) /* callee saved 7 */ +#define T8REG GREG_OFFSET(24) /* caller saved 8 */ +#define T9REG GREG_OFFSET(25) /* caller saved 8 */ +#define K0REG GREG_OFFSET(26) /* kernal reserved 0 */ +#define K1REG GREG_OFFSET(27) /* kernal reserved 1 */ +#define GPREG GREG_OFFSET(28) /* global pointer */ +#define SPREG GREG_OFFSET(29) /* stack pointer */ +#define S8REG GREG_OFFSET(30) /* callee saved 8 */ +#define RAREG GREG_OFFSET(31) /* return address */ +#define GREG_END (GREG_BASE+32*_RTypeSize) + +#define WDBCAUSEREG (GREG_END+0*4) /* Cause reg (for wdb) */ +#define WDBFPCSRREG (GREG_END+1*4) /* FPCSR reg (for wdb) */ +#define INTCTRLREG (GREG_END+2*4) /* ext intr control reg */ +#define ULEXTRA1 (GREG_END+3*4) /* extra - 4 bytes pad */ +#define TLBHIREG (GREG_END+4*4+0*_RTypeSize) /* adrs spc id reg */ +#define RTEXTRA2 (GREG_END+4*4+1*_RTypeSize) /* extra */ +#define RTEXTRA3 (GREG_END+4*4+2*_RTypeSize) /* extra */ +#define RTEXTRA4 (GREG_END+4*4+3*_RTypeSize) /* extra */ +#define RTEXTRA5 (GREG_END+4*4+4*_RTypeSize) /* extra */ +#define RTEXTRA6 (GREG_END+4*4+5*_RTypeSize) /* extra */ +#define RTEXTRA7 (GREG_END+4*4+6*_RTypeSize) /* extra */ +#define RTEXTRA8 (GREG_END+4*4+7*_RTypeSize) /* extra */ + +#define REG_SET_SIZE (GREG_END+4*4+8*_RTypeSize) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCregsMipsh */ diff --git a/h/arch/mips/rm9000.h b/h/arch/mips/rm9000.h new file mode 100644 index 0000000..167e28c --- /dev/null +++ b/h/arch/mips/rm9000.h @@ -0,0 +1,448 @@ +/* rm9000.h - PMC-Sierra RM9000 CPU header */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* + * This file has been developed or significantly modified by the + * MIPS Center of Excellence Dedicated Engineering Staff. + * This notice is as per the MIPS Center of Excellence Master Partner + * Agreement, do not remove this notice without checking first with + * WR/Platforms MIPS Center of Excellence engineering management. + */ + +/* +modification history +-------------------- +01a,14apr05,rlg created for yosemite bsp based off of yosemite 5.5 bsp +*/ + +/* +This file contains I/O addresses and related constants for the +PMC-Sierra RM9000 CPU core. +*/ + +#ifndef __INCrm9000h +#define __INCrm9000h + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + + +/* Config Register Defines */ + +#define RM9000_CFG_K0_CACHE_WRITETHROUGH 0x00000001 +#define RM9000_CFG_K0_CACHE_UNCACHE_BLOCK 0x00000002 +#define RM9000_CFG_K0_CACHE_WRITEBACK 0x00000003 +#define RM9000_CFG_K0_CACHE_COH_WRITEBACK_EXC 0x00000004 +#define RM9000_CFG_K0_CACHE_COH_WRITEBACK 0x00000005 +#define RM9000_CFG_K0_CACHE_UNCACHE_NONBLOCK 0x00000006 +#define RM9000_CFG_K0_CACHE_FAST_PACKET 0x00000007 +#define RM9000_CFG_SEC_CACHE_ENABLE 0x00000008 + + +/* On Chip Device (OCD) Registers - Base Address */ + +#ifndef RM9000x2_OCD_BASE_ADDR +#define RM9000x2_OCD_BASE_ADDR 0xBB000000 +#endif + + +#define RM9000_REG_ADDR(x) (RM9000x2_OCD_BASE_ADDR + x) + +#ifndef _ASMLANGUAGE + +/* rm9000x2 register read and write macros */ + +#define RM9000_REG_READ(offset) \ + *(volatile UINT32 *)(RM9000_REG_ADDR(offset)) +#define RM9000_REG_WRITE(offset,regdata) \ + *(volatile UINT32 *)(RM9000_REG_ADDR(offset)) = regdata + +#define RM9K_REG_READ32(offset) \ + *(volatile UINT32 *)(RM9000_REG_ADDR(offset)) +#define RM9K_REG_WRITE32(offset,regdata) \ + *(volatile UINT32 *)(RM9000_REG_ADDR(offset)) = regdata + +#define RM9K_REG_READ16(offset) \ + *(volatile UINT16 *)(RM9000_REG_ADDR(offset)) +#define RM9K_REG_WRITE16(offset,regdata) \ + *(volatile UINT16 *)(RM9000_REG_ADDR(offset)) = regdata + +#define RM9K_REG_READ8(offset) \ + *(volatile UINT8 *)(RM9000_REG_ADDR(offset)) +#define RM9K_REG_WRITE8(offset,regdata) \ + *(volatile UINT8 *)(RM9000_REG_ADDR(offset)) = regdata + + +#define RM9K_REG_SET32(offset,regdata) \ + *(volatile UINT32 *)(RM9000_REG_ADDR(offset)) = (*(volatile UINT32 *)(RM9000_REG_ADDR(offset))) | regdata + +#define RM9K_REG_CLEAR32(offset,regdata) \ + *(volatile UINT32 *)(RM9000_REG_ADDR(offset)) = (*(volatile UINT32 *)(RM9000_REG_ADDR(offset))) & ~regdata + + + +#endif /* _ASMLANGUAGE */ + + +/* Memory defines */ + +#define DRAM_CACHE_VIRT_BASE K0BASE +#define DRAM_NONCACHE_VIRT_BASE K1BASE +#define KSU_MASK 0xE0000000 /* Memory window selection bits */ + +/* On Chip Device (OCD) Registers */ + +#define RM9000x2_OCD_OCDINFO 0x0000 +#define RM9000x2_OCD_XCAUFL 0x0010 + +#define RM9000x2_OCD_UPENR 0x00f0 /* Micro Periph Enable */ +#define RM9000x2_OCD_CPURSLMT 0x00f8 /* CPU Resource Limit */ + +#define RM9000x2_OCD_LKB0 0x0100 /* Bank 0 Base Addr */ +#define RM9000x2_OCD_LKM0 0x0104 /* Bank 0 Addr Mask */ +#define RM9000x2_OCD_LKB1 0x0108 /* Bank 1 Base Addr */ +#define RM9000x2_OCD_LKM1 0x010C /* Bank 1 Addr Mask */ +#define RM9000x2_OCD_LKB2 0x0110 /* Bank 2 Base Addr */ +#define RM9000x2_OCD_LKM2 0x0114 /* Bank 2 Addr Mask */ +#define RM9000x2_OCD_LKB3 0x0118 /* Bank 3 Base Addr */ +#define RM9000x2_OCD_LKM3 0x011C /* Bank 3 Addr Mask */ +#define RM9000x2_OCD_LKB4 0x0120 /* Bank 4 Base Addr */ +#define RM9000x2_OCD_LKM4 0x0124 /* Bank 4 Addr Mask */ +#define RM9000x2_OCD_LKB5 0x0128 /* Bank 5 Base Addr */ +#define RM9000x2_OCD_LKM5 0x012C /* Bank 5 Addr Mask */ +#define RM9000x2_OCD_LKB6 0x0130 /* Bank 6 Base Addr */ +#define RM9000x2_OCD_LKM6 0x0134 /* Bank 6 Addr Mask */ +#define RM9000x2_OCD_LKB7 0x0138 /* Bank 7 Base Addr */ +#define RM9000x2_OCD_LKM7 0x013C /* Bank 7 Addr Mask */ +#define RM9000x2_OCD_LKB8 0x0140 /* Bank 8 Base Addr */ +#define RM9000x2_OCD_LKM8 0x0144 /* Bank 8 Addr Mask */ +#define RM9000x2_OCD_LKB9 0x0148 /* Bank 9 Base Addr */ +#define RM9000x2_OCD_LKM9 0x014C /* Bank 9 Addr Mask */ +#define RM9000x2_OCD_LKB10 0x0150 /* Bank 10 Base Addr */ +#define RM9000x2_OCD_LKM10 0x0154 /* Bank 10 Addr Mask */ +#define RM9000x2_OCD_LKB11 0x0158 /* Bank 11 Base Addr */ +#define RM9000x2_OCD_LKM11 0x015C /* Bank 11 Addr Mask */ +#define RM9000x2_OCD_LKB12 0x0160 /* Bank 12 Base Addr */ +#define RM9000x2_OCD_LKM12 0x0164 /* Bank 12 Addr Mask */ +#define RM9000x2_OCD_LKB13 0x0168 /* Bank 13 Base Addr */ +#define RM9000x2_OCD_LKM13 0x016C /* Bank 13 Addr Mask */ + +#define RM9000x2_OCD_LDP0 0x0200 +#define RM9000x2_OCD_LDP1 0x0210 +#define RM9000x2_OCD_LDP2 0x0220 +#define RM9000x2_OCD_LDP3 0x0230 + +#define RM9000x2_OCD_RSTSTATUS 0x0A20 /* Reset Status */ +#define RM9000x2_OCD_RSTSET 0x0A24 /* Reset Set */ +#define RM9000x2_OCD_RSTCLEAR 0x0A28 /* Reset Clear */ + +#define RM9000x2_OCD_SEM 0x0A60 /* Semaphore Register */ +#define RM9000x2_OCD_SEMSET 0x0A64 /* Semaphore Set */ +#define RM9000x2_OCD_SEMCLR 0x0A68 /* Semaphore Clear */ + +/* + * MAC subsytem registers + */ + +/* MAC Subsystem */ +#define RM9000_GE_DEVICE_ID_REG 0x0000 +#define RM9000_GE_RESET 0x0004 +#define RM9000_GE_DLL_STATUS 0x0008 +#define RM9000_TSB_CONTROL_0 0x000c +#define RM9000_TSB_CONTROL_1 0x0010 +#define RM9000_PRIORITY_CHECKSUM_PORT_0 0x1038 +#define RM9000_PRIORITY_CHECKSUM_PORT_1 0x2038 +#define RM9000_PRIORITY_CHECKSUM_PORT_2 0x3038 + +/* + * SCMB subsystem + */ +#define RM9000_SCMB_0_CONTROL 0x0180 /* SCMB 0 Control */ +#define RM9000_SCMB_0_CLKA 0x0184 /* SCMB 0 Clock A */ +#define RM9000_SCMB_0_CLKB 0x0188 /* SCMB 0 Clock B */ +#define RM9000_MDIO_0_COMMAND 0x0190 /* MDIO 0 Command */ +#define RM9000_MDIO_0_DEVICE_PORT_ADDRESS 0x0194 /* MDIO 0 Device and Port addrs */ +#define RM9000_MDIO_0_DATA 0x0198 /* MDIO 0 Data */ +#define RM9000_MDIO_0_INTERRUPTS 0x019c /* MDIO 0 Interrupts */ + +#define RM9000_2BI_0_CONFIG 0x01a0 /* 2BI 0 Configuration */ +#define RM9000_2BI_0_COMMAND 0x01a4 /* 2BI 0 Command */ +#define RM9000_2BI_0_ADDRESS 0x01a8 /* 2BI 0 Address */ +#define RM9000_2BI_0_DATA0 0x01ac /* 2BI 0 Data bits 15:0 */ +#define RM9000_2BI_0_DATA1 0x01b0 /* 2BI 0 Data bits 31:16 */ +#define RM9000_2BI_0_DATA2 0x01b4 /* 2BI 0 Data bits 47:32 */ +#define RM9000_2BI_0_DATA3 0x01b8 /* 2BI 0 Data bits 63:48 */ +#define RM9000_2BI_0_INTERRUPTS 0x01bc /* 2BI 0 Interrupts */ + + +/* RM9000 SDRAM Register Defines */ + +#define RM9000_SDRAM_GEN_CONFIG_REG 0x0300 +#define RM9000_SDRAM_MODE_REG 0x0304 +#define RM9000_SDRAM_BANK0_CONFIG_REG 0x0340 +#define RM9000_SDRAM_BANK1_CONFIG_REG 0x0350 +#define RM9000_SDRAM_BANK2_CONFIG_REG 0x0360 +#define RM9000_SDRAM_BANK3_CONFIG_REG 0x0370 +#define RM9000_SDRAM_BANK0_TIMING_REG 0x0344 +#define RM9000_SDRAM_BANK1_TIMING_REG 0x0354 +#define RM9000_SDRAM_BANK2_TIMING_REG 0x0364 +#define RM9000_SDRAM_BANK3_TIMING_REG 0x0374 + +/* (PRId) Processor Revision Identifier Register definitions */ + +#define RM9000x2_IMP_NUM 0x34 /* RM9000x2 */ +#define RM9000x2_PRID_REV_MASK 0x000000FF +#define RM9000x2_PRID_REV_SHIFT 0 +#define RM9000x2_PRID_IMP_NUM_MASK 0x0000FF00 +#define RM9000x2_PRID_IMP_NUM_SHIFT 8 +#define RM9000x2_PRID_CPU_NUM_MASK 0x07000000 +#define RM9000x2_PRID_CPU_NUM_SHIFT 24 + +/* (UPENR) Microprocessor Peripherals Enable definitions */ + +#define RM9000x2_RESET_CONTROL_ENABLE 0x01 +#define RM9000x2_RESET_CONTROL_DISABLE 0x00 + +/* (RSTSTATUS, RSTSET, RSTCLEAR) Reset Register definitions */ + +#define RM9000x2_RESET_PROC_0 0x01 +#define RM9000x2_RESET_PROC_1 0x02 +#define RM9000x2_RESET_SEC_PROC 0x02 /* reset Secondary Procs */ + +/* (SEM, SEMSET, SEMCLR) Semaphore Register definitions */ + +#define RM9000_ROM_SEM_BIT 0x00000001 /* sem bit to use by rm9000Init.s */ + +/* Cache Defines */ + +#define RM9000x2_L2_CACHE_SIZE 0x00040000 /* 256 KBytes */ +#define RM9000x2_L3_CACHE_SIZE 0x00000000 /* No L3 cache */ +#define RM9000x2_CACHE_LINE_SIZE 32 + +/* Interrupt Priority Control Register bit defines */ + +#define RM9000x2_IPC_VEC_SPACING_MASK 0x0000001F +#define RM9000x2_IPC_IM15 0x00008000 /* MASK OCD Fault int */ +#define RM9000x2_IPC_IM14 0x00004000 /* MASK OCD Flag int */ +#define RM9000x2_IPC_IM13 0x00002000 /* MASK Perf counter */ +#define RM9000x2_IPC_IM12 0x00001000 /* MASK alt timer int */ +#define RM9000x2_IPC_IM11 0x00000800 /* MASK level 9 int */ +#define RM9000x2_IPC_IM10 0x00000400 /* MASK level 8 int */ +#define RM9000x2_IPC_IM9 0x00000200 /* MASK level 7 int */ +#define RM9000x2_IPC_IM8 0x00000100 /* MASK level 6 int */ +#define RM9000x2_IPC_TIMER_EXCL_IPL12 0x00000080 /* timer on int 12 */ +#define RM9000x2_IPC_IM_MASK 0x0000FF00 /* extended int mask */ + +/* External Interrupt Pin (n) Configuration registers */ + +#define RM9000x2_EXT_INTPIN0_CONFIG 0x0A40 +#define RM9000x2_EXT_INTPIN1_CONFIG 0x0A44 +#define RM9000x2_EXT_INTPIN2_CONFIG 0x0A48 +#define RM9000x2_EXT_INTPIN3_CONFIG 0x0A4C +#define RM9000x2_EXT_INTPIN4_CONFIG 0x0A50 +#define RM9000x2_EXT_INTPIN5_CONFIG 0x0A54 +#define RM9000x2_EXT_INTPIN6_CONFIG 0x0A58 +#define RM9000x2_EXT_INTPIN7_CONFIG 0x0A5C + +/* External Interrupt Pin (n) register defines */ + +#define RM9000x2_VECTOR_MASK 0x00FF0000 /* level & status bit */ +#define RM9000x2_VECTOR_SHIFT 16 +#define RM9000x2_PROC_INT_MASK 0x00E00000 /* int level */ +#define RM9000x2_PROC_INT_SHIFT 21 +#define RM9000x2_INT_STATUS_BIT_MASK 0x001F0000 /* bit in status reg */ +#define RM9000x2_INT_STATUS_BIT_SHIFT 16 +#define RM9000x2_MESSAGE_TYPE_MASK 0x00000700 /* msg type */ +#define RM9000x2_MESSAGE_TYPE_SHIFT 8 +#define RM9000x2_INTERRUPT_DEST_MASK 0x00000003 /* proc 0 or 1 */ +#define RM9000x2_INTERRUPT_DEST_PROC0 1 /* proc 0 select */ +#define RM9000x2_INTERRUPT_DEST_PROC1 2 /* proc 1 select */ + +/* Processor 0 Interrupt Status, Mask, Set and Clear registers */ + +#define RM9000x2_INTP0_STATUS_0 0x1B00 +#define RM9000x2_INTP0_MASK_0 0x1B04 +#define RM9000x2_INTP0_SET_0 0x1B08 +#define RM9000x2_INTP0_CLEAR_0 0x1B0C +#define RM9000x2_INTP0_STATUS_1 0x1B10 +#define RM9000x2_INTP0_MASK_1 0x1B14 +#define RM9000x2_INTP0_SET_1 0x1B18 +#define RM9000x2_INTP0_CLEAR_1 0x1B1C +#define RM9000x2_INTP0_STATUS_2 0x1B20 +#define RM9000x2_INTP0_MASK_2 0x1B24 +#define RM9000x2_INTP0_SET_2 0x1B28 +#define RM9000x2_INTP0_CLEAR_2 0x1B2C +#define RM9000x2_INTP0_STATUS_3 0x1B30 +#define RM9000x2_INTP0_MASK_3 0x1B34 +#define RM9000x2_INTP0_SET_3 0x1B38 +#define RM9000x2_INTP0_CLEAR_3 0x1B3C +#define RM9000x2_INTP0_STATUS_4 0x1B40 +#define RM9000x2_INTP0_MASK_4 0x1B44 +#define RM9000x2_INTP0_SET_4 0x1B48 +#define RM9000x2_INTP0_CLEAR_4 0x1B4C +#define RM9000x2_INTP0_STATUS_5 0x1B50 +#define RM9000x2_INTP0_MASK_5 0x1B54 +#define RM9000x2_INTP0_SET_5 0x1B58 +#define RM9000x2_INTP0_CLEAR_5 0x1B5C +#define RM9000x2_INTP0_STATUS_6 0x1B60 +#define RM9000x2_INTP0_MASK_6 0x1B64 +#define RM9000x2_INTP0_SET_6 0x1B68 +#define RM9000x2_INTP0_CLEAR_6 0x1B6C +#define RM9000x2_INTP0_STATUS_7 0x1B70 +#define RM9000x2_INTP0_MASK_7 0x1B74 +#define RM9000x2_INTP0_SET_7 0x1B78 +#define RM9000x2_INTP0_CLEAR_7 0x1B7C + +/* Processor 1 Interrupt Status, Mask, Set and Clear registers */ + +#define RM9000x2_INTP1_STATUS_0 0x2B00 +#define RM9000x2_INTP1_MASK_0 0x2B04 +#define RM9000x2_INTP1_SET_0 0x2B08 +#define RM9000x2_INTP1_CLEAR_0 0x2B0C +#define RM9000x2_INTP1_STATUS_1 0x2B10 +#define RM9000x2_INTP1_MASK_1 0x2B14 +#define RM9000x2_INTP1_SET_1 0x2B18 +#define RM9000x2_INTP1_CLEAR_1 0x2B1C +#define RM9000x2_INTP1_STATUS_2 0x2B20 +#define RM9000x2_INTP1_MASK_2 0x2B24 +#define RM9000x2_INTP1_SET_2 0x2B28 +#define RM9000x2_INTP1_CLEAR_2 0x2B2C +#define RM9000x2_INTP1_STATUS_3 0x2B30 +#define RM9000x2_INTP1_MASK_3 0x2B34 +#define RM9000x2_INTP1_SET_3 0x2B38 +#define RM9000x2_INTP1_CLEAR_3 0x2B3C +#define RM9000x2_INTP1_STATUS_4 0x2B40 +#define RM9000x2_INTP1_MASK_4 0x2B44 +#define RM9000x2_INTP1_SET_4 0x2B48 +#define RM9000x2_INTP1_CLEAR_4 0x2B4C +#define RM9000x2_INTP1_STATUS_5 0x2B50 +#define RM9000x2_INTP1_MASK_5 0x2B54 +#define RM9000x2_INTP1_SET_5 0x2B58 +#define RM9000x2_INTP1_CLEAR_5 0x2B5C +#define RM9000x2_INTP1_STATUS_6 0x2B60 +#define RM9000x2_INTP1_MASK_6 0x2B64 +#define RM9000x2_INTP1_SET_6 0x2B68 +#define RM9000x2_INTP1_CLEAR_6 0x2B6C +#define RM9000x2_INTP1_STATUS_7 0x2B70 +#define RM9000x2_INTP1_MASK_7 0x2B74 +#define RM9000x2_INTP1_SET_7 0x2B78 +#define RM9000x2_INTP1_CLEAR_7 0x2B7C + +/* base vector number for user programmable vectors */ + + +/* TLB Defines */ + +#undef TLB_ENTRIES +#define TLB_ENTRIES 64 +#define TLB_4K_PAGE_SIZE_MASK 0x00000000 +#define TLB_16K_PAGE_SIZE_MASK 0x00006000 +#define TLB_64K_PAGE_SIZE_MASK 0x0001E000 +#define TLB_256K_PAGE_SIZE_MASK 0x0007E000 +#define TLB_1M_PAGE_SIZE_MASK 0x001FE000 +#define TLB_4M_PAGE_SIZE_MASK 0x007FE000 +#define TLB_16M_PAGE_SIZE_MASK 0x01FFE000 +#define TLB_64M_PAGE_SIZE_MASK 0x07FFE000 +#define TLB_256M_PAGE_SIZE_MASK 0x1FFFE000 +#define TLB_PG_SVPN 0xfffff000 /* SW page no mask */ +#define TLB_PG_SHIFT 6 +#define TLB_PG_FRAME 0x3fffffc0 +#define TLB_P_ENTRY_SHIFT 12 /* convert VM pagenum to VA */ + +#define TLB_PG_G 0x00000001 /* HW */ +#define TLB_PG_V 0x00000002 +#define TLB_PG_NV 0x00000000 +#define TLB_PG_M 0x00000004 +#define TLB_PG_ATTR 0x0000003f +#define TLB_PG_UNCACHED 0x00000010 +#define TLB_PG_CACHED 0x00000018 +#define TLB_PG_CACHEMODE 0x00000038 +#define TLB_PG_IOPAGE (TLB_PG_G | TLB_PG_V | TLB_PG_M | TLB_PG_UNCACHED) + +#define TLBLO_MODE TLB_PG_IOPAGE +#define TLBLO_PFNMASK TLB_PG_FRAME +#define TLBHI_VPN2MASK 0xffffe000 +#define TLBLO_PAGEMASK TLB_256M_PAGE_SIZE_MASK +#define TLBLO_PAGEMASK_SIZE (TLBLO_PAGEMASK | TLB_PG_IOPAGE | 0x1000) +#define TLBLO_LO1_OFFSET 0x2000 + + +/* Interrupt Level bit defines to their respective register */ + +/* interrupt priority control register */ + +#define INT_LVL_OCD_FAULT SR_IBIT8 /* OCD Fault */ +#define INT_LVL_OCD_FLAG SR_IBIT7 /* OCD Flag (DMA complete) */ +#define INT_LVL_PERF SR_IBIT6 /* Performance Counter */ +#define INT_LVL_ALT_TIMER SR_IBIT5 /* alt timer interrupt */ +#define INT_LVL_EXT_INT_9 SR_IBIT4 /* ext interrupt 9 */ +#define INT_LVL_EXT_INT_8 SR_IBIT3 /* ext interrupt 8 */ +#define INT_LVL_EXT_INT_7 SR_IBIT2 /* ext interrupt 7 */ +#define INT_LVL_EXT_INT_6 SR_IBIT1 /* ext interrupt 6 */ + +/* status register bit definitions */ + +#define INT_LVL_EXT_INT_5 0x00008000 /* ext interrupt 5 */ +#define INT_LVL_EXT_INT_4 0x00004000 /* ext interrupt 4 */ +#define INT_LVL_EXT_INT_3 0x00002000 /* ext interrupt 3 */ +#define INT_LVL_EXT_INT_2 0x00001000 /* ext interrupt 2 */ +#define INT_LVL_EXT_INT_1 0x00000800 /* ext interrupt 1 */ +#define INT_LVL_EXT_INT_0 0x00000400 /* ext interrupt 0 */ +#define INT_LVL_SW1 0x00000200 /* sw interrupt 1 (fixed) */ +#define INT_LVL_SW0 0x00000100 /* sw interrupt 0 (fixed) */ + +/* Exception Vector Table offset values */ + +#define RM9000_CPU1_VEC_OFFSET 0x08000000 /* offset for CPU1 Exc Vec Tbl */ + + +/* + * RM9000 Interrupt Controller Notes + * There are 32 interrupt sources for each of the 8 interrupt levels (0-7) + * SW Interrupts are generated via the set register for the level + * SW Interrupts are cleared via the clear register for the level + * (processor 0 registers 0x1B00 - 0x1B7C + * and Processor 1 registers 0x2B00 - 0x2B7C). + * One external interrupt can be mapped per interrupt level for the externally + * generated h/w interrupt. + */ + +/* and 8 levels internal to rm9000x2 it can set and clear */ + +#define RM9000x2_INT_LVLS_INTERNAL 8 +#define RM9000x2_INT_SRCS_INTERNAL 32 + +/* Exception Table Defines +* +* moved from yosemiteRm9k.h to here +* this will also work for the jaguuar +* +*/ + +#define RM9K_CPU1_TLB_EXC_ADDR 0x88000000 +#define RM9K_CPU1_XTLB_EXC_ADDR 0x88000080 +#define RM9K_CPU1_CACHE_EXC_ADDR 0x88000100 +#define RM9K_CPU1_NORM_EXC_ADDR 0x88000180 + +/* +* defines for romInit.s +* when building bootroms +*/ + +#define RM9K_CONF000 0x00d0 +#define RM9K_CONF032 0x00d4 +#define RM9K_CONF064 0x00d8 +#define RM9K_CONF096 0x00dc +#define RM9K_CONF128 0x00e0 +#define RM9K_CONF160 0x00e4 +#define RM9K_CONF192 0x00e8 +#define RM9K_CONF224 0x00ec + +#ifdef __cplusplus +} +#endif +#endif /* __INCrm9000h */ diff --git a/h/arch/mips/rm9xxxHazards.h b/h/arch/mips/rm9xxxHazards.h new file mode 100644 index 0000000..e3df6b9 --- /dev/null +++ b/h/arch/mips/rm9xxxHazards.h @@ -0,0 +1,46 @@ +/* rm9xxxHazards.h - assembler hazards definitions header file */ + +/* + * This file has been developed or significantly modified by the + * MIPS Center of Excellence Dedicated Engineering Staff. + * This notice is as per the MIPS Center of Excellence Master Partner + * Agreement, do not remove this notice without checking first with + * WR/Platforms MIPS Center of Excellence engineering management. + */ + +/* +modification history +-------------------- +01a,14nov02,jmt Modified to handle RM9xxx hazards +*/ + +/* These hazard macros are intended for use with MIPS architecture- + * dependent assembly files which require handling hazards. + * These macros support the PMC-Sierra RM9000 core + * This file is included by the asmMips.h file when the HAZARD_FILE macro + * is defined using + * #define HAZARD_FILE + */ + +#ifndef __INCrm9xxxHazardsh +#define __INCrm9xxxHazardsh + +/* Hazard macros */ + +#define CPU_CYCLES_FOUR ssnop; ssnop; ssnop; ssnop; \ + ssnop; ssnop; ssnop; ssnop +#define CPU_CYCLES_SEVEN ssnop; ssnop; ssnop; ssnop; \ + ssnop; ssnop; ssnop; ssnop; \ + ssnop; ssnop; ssnop; ssnop; \ + ssnop; ssnop + +#define HAZARD_TLB CPU_CYCLES_SEVEN +#define HAZARD_ERET CPU_CYCLES_TWO +#define HAZARD_CP_READ CPU_CYCLES_ONE +#define HAZARD_CP_WRITE CPU_CYCLES_FOUR +#define HAZARD_CACHE_TAG CPU_CYCLES_ONE +#define HAZARD_CACHE CPU_CYCLES_TWO +#define HAZARD_INTERRUPT CPU_CYCLES_TWO + +#endif /* __INCrm9xxxHazardsh */ + diff --git a/h/arch/mips/sigMipsCodes.h b/h/arch/mips/sigMipsCodes.h new file mode 100644 index 0000000..3cf9b51 --- /dev/null +++ b/h/arch/mips/sigMipsCodes.h @@ -0,0 +1,56 @@ +/* sigMipsCodes.h - Mips codes sent to signal handlers */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* + * This file has been developed or significantly modified by the + * MIPS Center of Excellence Dedicated Engineering Staff. + * This notice is as per the MIPS Center of Excellence Master Partner + * Agreement, do not remove this notice without checking first with + * WR/Platforms MIPS Center of Excellence engineering management. + */ + +/* +modification history +-------------------- +01e,16jul01,ros add CofE comment +01d,18apr96,rml add definitions for R4650 specific exception types +01c,10feb93,rdc fixed ILL_COPROC_UNUSABLE macro. +01b,22sep92,rrr added support for c++ +01a,31aug92,rrr written +*/ + +#ifndef __INCsigMipsCodesh +#define __INCsigMipsCodesh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "iv.h" + +#define BUS_IBND IV_IBND_VEC /* R4650: instr bound */ +#define BUS_DBND IV_DBND_VEC /* R4650: data bound */ +#define BUS_TLBMOD IV_TLBMOD_VEC /* tlb mod */ +#define BUS_TLBL IV_TLBL_VEC /* tlb load */ +#define BUS_TLBS IV_TLBS_VEC /* tlb store */ +#define BUS_ADEL IV_ADEL_VEC /* address load */ +#define BUS_ADES IV_ADES_VEC /* address store */ +#define SEGV_IBUS IV_IBUS_VEC /* instr. bus error */ +#define SEGV_DBUS IV_DBUS_VEC /* data bus error */ +#define TRAP_SYSCALL IV_SYSCALL_VEC /* system call */ +#define TRAP_BP IV_BP_VEC /* break point */ +#define ILL_ILLINSTR_FAULT IV_RESVDINST_VEC /* rsvd instruction */ +#define ILL_COPROC_UNUSABLE IV_CPU_VEC /* coproc unusable */ +#define FPE_FPA_UIO IV_FPA_UNIMP_VEC /* unimplemented op */ +#define FPE_FLTNAN_TRAP IV_FPA_INV_VEC /* invalid op */ +#define FPE_FLTDIV_TRAP IV_FPA_DIV0_VEC /* FPA div by zero */ +#define FPE_FLTOVF_TRAP IV_FPA_OVF_VEC /* FPA overflow */ +#define FPE_FLTUND_TRAP IV_FPA_UFL_VEC /* FPA underflow */ +#define FPE_FLTINEX_TRAP IV_FPA_PREC_VEC /* FPA inexact */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsigMipsCodesh */ diff --git a/h/arch/mips/syscallArgsMIPS32.h b/h/arch/mips/syscallArgsMIPS32.h new file mode 100644 index 0000000..659b285 --- /dev/null +++ b/h/arch/mips/syscallArgsMIPS32.h @@ -0,0 +1,757 @@ +/* Aligned for MIPS32 - align 64-bit elements */ + + +/* THIS FILE IS AUTO_GENERATED. PLEASE DO NOT EDIT. */ + +#ifndef _ASMLANGUAGE + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct _exitScArgs + { + int status; + }; + +struct creatScArgs + { + const char * name; + mode_t flag; + }; + +struct _openScArgs + { + const char * name; + int flags; + int mode; + }; + +struct closeScArgs + { + int fd; + }; + +struct readScArgs + { + int fd; + void * buffer; + size_t maxbytes; + }; + +struct writeScArgs + { + int fd; + const void * buffer; + size_t nbytes; + }; + +struct _ioctlScArgs + { + int fd; + int function; + int arg; + }; + +struct dupScArgs + { + int fd; + }; + +struct dup2ScArgs + { + int fd; + int fd2; + }; + +struct pipeScArgs + { + int filedes[2]; + }; + +struct removeScArgs + { + const char * name; + }; + +struct selectScArgs + { + int width; + fd_set * readFds; + fd_set * writeFds; + fd_set * excFds; + struct timeval * timeout; + }; + +struct socketScArgs + { + int domain; + int type; + int protocol; + }; + +struct bindScArgs + { + int s; + struct sockaddr * name; + int namelen; + }; + +struct listenScArgs + { + int s; + int backlog; + }; + +struct acceptScArgs + { + int s; + struct sockaddr * addr; + int *addrlen; + }; + +struct connectScArgs + { + int s; + struct sockaddr * name; + int namelen; + }; + +struct sendtoScArgs + { + int s; + caddr_t buf; + int bufLen; + int flags; + struct sockaddr * to; + int tolen; + }; + +struct sendScArgs + { + int s; + const char * buf; + int bufLen; + int flags; + }; + +struct sendmsgScArgs + { + int s; + struct msghdr * mp; + int flags; + }; + +struct recvfromScArgs + { + int s; + char * buf; + int bufLen; + int flags; + struct sockaddr *from; + int * pFromLen; + }; + +struct recvScArgs + { + int s; + char * buf; + int bufLen; + int flags; + }; + +struct recvmsgScArgs + { + int s; + struct msghdr * mp; + int flags; + }; + +struct setsockoptScArgs + { + int s; + int level; + int optname; + char * optval; + int optlen; + }; + +struct getsockoptScArgs + { + int s; + int level; + int optname; + char * optval; + int * optlen; + }; + +struct getsocknameScArgs + { + int s; + struct sockaddr *name; + int * namelen; + }; + +struct getpeernameScArgs + { + int s; + struct sockaddr *name; + int *namelen; + }; + +struct shutdownScArgs + { + int s; + int how; + }; + +struct mmapScArgs + { + void * addr; + size_t len; + int prot; + int flags; + int fildes; + int offPad; + off_t64 off; + }; + +struct munmapScArgs + { + void * addr; + size_t len; + }; + +struct mprotectScArgs + { + void * addr; + size_t len; + int prot; + }; + +struct killScArgs + { + OBJ_HANDLE rtpId; + int signo; + }; + +struct sigpendingScArgs + { + sigset_t * pSet; + }; + +struct sigprocmaskScArgs + { + int how; + const sigset_t * pSet; + sigset_t * pOset; + }; + +struct _sigqueueScArgs + { + OBJ_HANDLE rtpId; + int signo; + const union sigval * pValue; + int sigCode; + }; + +struct sigsuspendScArgs + { + const sigset_t * pSet; + }; + +struct sigtimedwaitScArgs + { + const sigset_t * pSet; + struct siginfo * pInfo; + const struct timespec * pTime; + }; + +struct _sigactionScArgs + { + int signo; + const struct sigaction * pAct; + struct sigaction * pOact; + void * retAddr; + }; + +struct chdirScArgs + { + const char * name; + }; + +struct _getcwdScArgs + { + char * buffer; + int length; + }; + +struct waitpidScArgs + { + OBJ_HANDLE childRtpId; + int * pStatus; + int options; + }; + +struct sysctlScArgs + { + int *pName; + u_int nameLen; + void * pOld; + size_t * pOldLen; + void * pNew; + size_t newLen; + }; + +struct _schedPxInfoGetScArgs + { + BOOL * pTimeSlicingOn; + ULONG * pTimeSlicePeriod; + }; + +struct sigaltstackScArgs + { + stack_t * ss; + stack_t * oss; + }; + +struct unlinkScArgs + { + const char * name; + }; + +struct linkScArgs + { + const char * name; + const char * newname; + }; + +struct fsyncScArgs + { + int fd; + }; + +struct fdatasyncScArgs + { + int fd; + }; + +struct renameScArgs + { + const char * oldname; + const char * newname; + }; + +struct fpathconfScArgs + { + int fd; + int name; + }; + +struct pathconfScArgs + { + const char * path; + int name; + }; + +struct accessScArgs + { + const char * path; + int amode; + }; + +struct chmodScArgs + { + const char * path; + mode_t mode; + }; + +struct eventReceiveScArgs + { + UINT32 events; + UINT32 options; + int timeout; + UINT32 * pEvtsReceived; + }; + +struct eventSendScArgs + { + int taskId; + UINT32 events; + }; + +struct eventCtlScArgs + { + OBJ_HANDLE handle; + VX_EVT_CTL_CMD command; + void * pArg; + UINT * pArgSize; + }; + +struct msgQSendScArgs + { + OBJ_HANDLE handle; + char * buffer; + UINT nBytes; + int timeout; + int priority; + }; + +struct msgQReceiveScArgs + { + OBJ_HANDLE handle; + char * buffer; + UINT maxNBytes; + int timeout; + }; + +struct _msgQOpenScArgs + { + const char * name; + UINT maxMsgs; + UINT maxMsgLength; + int options; + int mode; + void * context; + }; + +struct objDeleteScArgs + { + OBJ_HANDLE handle; + int options; + }; + +struct objInfoGetScArgs + { + OBJ_HANDLE handle; + void * pInfo; + UINT * pInfoSize; + int level; + }; + +struct _semTakeScArgs + { + OBJ_HANDLE handle; + int timeout; + }; + +struct _semGiveScArgs + { + OBJ_HANDLE handle; + }; + +struct _semOpenScArgs + { + const char * name; + SEM_TYPE type; + int initState; + int options; + int mode; + void * context; + }; + +struct semCtlScArgs + { + OBJ_HANDLE handle; + VX_SEM_CTL_CMD command; + void * pArg; + UINT * pArgSize; + }; + +struct _taskOpenScArgs + { + struct vx_task_open_sc_args * pArgs; + }; + +struct taskCtlScArgs + { + int tid; + VX_TASK_CTL_CMD command; + void * pArg; + UINT * pArgSize; + }; + +struct taskDelayScArgs + { + int ticks; + }; + +struct rtpSpawnScArgs + { + const char * rtpFileName; + const char ** argv; + const char ** envp; + int priority; + int uStackSize; + int options; + int taskOptions; + }; + +struct rtpInfoGetScArgs + { + OBJ_HANDLE rtpId; + RTP_DESC * rtpStruct; + }; + +struct taskKillScArgs + { + OBJ_HANDLE taskHandle; + int signo; + }; + +struct _taskSigqueueScArgs + { + OBJ_HANDLE taskHandle; + int signo; + const union sigval * pValue; + int sigCode; + }; + +struct _timer_openScArgs + { + const char * name; + int mode; + clockid_t clockId; + struct sigevent * evp; + void * context; + }; + +struct timerCtlScArgs + { + TIMER_CTL_CMD cmdCode; + int handle; + void * pArgs; + UINT * pArgSize; + }; + +struct pxOpenScArgs + { + PX_OBJ_TYPE type; + const char * name; + int objOpenMode; + void * attr; + }; + +struct pxCloseScArgs + { + OBJ_HANDLE handle; + }; + +struct pxUnlinkScArgs + { + PX_OBJ_TYPE type; + const char * name; + }; + +struct pxCtlScArgs + { + OBJ_HANDLE handle; + PX_CTL_CMD_CODE cmdCode; + void * pArgs; + UINT * pArgSize; + }; + +struct pxMqReceiveScArgs + { + OBJ_HANDLE handle; + char * pMsg; + size_t msgLen; + unsigned int * pMsgPrio; + PX_WAIT_OPTION waitOption; + struct timespec * time_out; + }; + +struct pxMqSendScArgs + { + OBJ_HANDLE handle; + const char * pMsg; + size_t msgLen; + unsigned int msgPrio; + PX_WAIT_OPTION waitOption; + struct timespec * time_out; + }; + +struct pxSemWaitScArgs + { + OBJ_HANDLE handle; + PX_WAIT_OPTION waitOption; + struct timespec * time_out; + }; + +struct pxSemPostScArgs + { + OBJ_HANDLE handle; + }; + +struct pipeDevCreateScArgs + { + const char * name; + int nMessages; + int nBytes; + }; + +struct pipeDevDeleteScArgs + { + const char * name; + BOOL force; + }; + +struct _sdCreateScArgs + { + char * name; + int options; + UINT32 size; + int physAddressPad; + off_t64 physAddress; + MMU_ATTR attr; + void ** pVirtAddress; + }; + +struct _sdOpenScArgs + { + char * name; + int options; + int mode; + UINT32 size; + off_t64 physAddress; + MMU_ATTR attr; + void ** pVirtAddress; + }; + +struct sdDeleteScArgs + { + OBJ_HANDLE handle; + int options; + }; + +struct sdMapScArgs + { + OBJ_HANDLE handle; + MMU_ATTR attr; + int options; + }; + +struct sdUnmapScArgs + { + OBJ_HANDLE handle; + int options; + }; + +struct sdProtectScArgs + { + OBJ_HANDLE handle; + MMU_ATTR attr; + }; + +struct _edrErrorInjectScArgs + { + int kind; + const char *fileName; + int lineNumber; + REG_SET *regset; + void *addr; + const char *msg; + }; + +struct resSearchNScArgs + { + const char * name; + struct res_target * target; + }; + +struct wvEventScArgs + { + int eventId; + const char * pData; + unsigned int dataSize; + }; + +struct rtpVarAddScArgs + { + void ** pVar; + void * value; + }; + +struct sdInfoGetScArgs + { + OBJ_HANDLE handle; + SD_DESC * pSdStruct; + }; + +struct _shlOpenScArgs + { + const char * name; + int options; + }; + +struct _shlUnlockScArgs + { + SHL_ID shlId; + }; + +struct _shlCloseScArgs + { + SHL_ID shlId; + }; + +struct _shlGetScArgs + { + SHL_ID shlId; + SHLINFO *pInfo; + }; + +struct _shlPutScArgs + { + SHL_ID shlId; + const SHLINFO *pInfo; + }; + +struct objUnlinkScArgs + { + const char * name; + enum windObjClassType classType; + }; + +struct getprlimitScArgs + { + int idtype; + OBJ_HANDLE handle; + int resource; + struct rlimit *rlp; + }; + +struct setprlimitScArgs + { + int idtype; + OBJ_HANDLE handle; + int resource; + struct rlimit *rlp; + }; + +struct _mctlScArgs + { + void * addr; + size_t len; + int function; + int arg; + }; + +#endif /* _ASMLANGUAGE */ diff --git a/h/arch/mips/syscallArgsMIPS64BE.h b/h/arch/mips/syscallArgsMIPS64BE.h new file mode 100644 index 0000000..d9b46cd --- /dev/null +++ b/h/arch/mips/syscallArgsMIPS64BE.h @@ -0,0 +1,1060 @@ +/* Aligned for MIPS64BE - MIPS64 Big-Endian */ + + +/* THIS FILE IS AUTO_GENERATED. PLEASE DO NOT EDIT. */ + +#ifndef _ASMLANGUAGE + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct _exitScArgs + { + UINT32 statusPad; + int status; + }; + +struct creatScArgs + { + UINT32 namePad; + const char * name; + UINT32 flagPad; + mode_t flag; + }; + +struct _openScArgs + { + UINT32 namePad; + const char * name; + UINT32 flagsPad; + int flags; + UINT32 modePad; + int mode; + }; + +struct closeScArgs + { + UINT32 fdPad; + int fd; + }; + +struct readScArgs + { + UINT32 fdPad; + int fd; + UINT32 bufferPad; + void * buffer; + UINT32 maxbytesPad; + size_t maxbytes; + }; + +struct writeScArgs + { + UINT32 fdPad; + int fd; + UINT32 bufferPad; + const void * buffer; + UINT32 nbytesPad; + size_t nbytes; + }; + +struct _ioctlScArgs + { + UINT32 fdPad; + int fd; + UINT32 functionPad; + int function; + UINT32 argPad; + int arg; + }; + +struct dupScArgs + { + UINT32 fdPad; + int fd; + }; + +struct dup2ScArgs + { + UINT32 fdPad; + int fd; + UINT32 fd2Pad; + int fd2; + }; + +struct pipeScArgs + { + int filedes[2]; + }; + +struct removeScArgs + { + UINT32 namePad; + const char * name; + }; + +struct selectScArgs + { + UINT32 widthPad; + int width; + UINT32 readFdsPad; + fd_set * readFds; + UINT32 writeFdsPad; + fd_set * writeFds; + UINT32 excFdsPad; + fd_set * excFds; + UINT32 timeoutPad; + struct timeval * timeout; + }; + +struct socketScArgs + { + UINT32 domainPad; + int domain; + UINT32 typePad; + int type; + UINT32 protocolPad; + int protocol; + }; + +struct bindScArgs + { + UINT32 sPad; + int s; + UINT32 namePad; + struct sockaddr * name; + UINT32 namelenPad; + int namelen; + }; + +struct listenScArgs + { + UINT32 sPad; + int s; + UINT32 backlogPad; + int backlog; + }; + +struct acceptScArgs + { + UINT32 sPad; + int s; + UINT32 addrPad; + struct sockaddr * addr; + UINT32 addrlenPad; + int *addrlen; + }; + +struct connectScArgs + { + UINT32 sPad; + int s; + UINT32 namePad; + struct sockaddr * name; + UINT32 namelenPad; + int namelen; + }; + +struct sendtoScArgs + { + UINT32 sPad; + int s; + UINT32 bufPad; + caddr_t buf; + UINT32 bufLenPad; + int bufLen; + UINT32 flagsPad; + int flags; + UINT32 toPad; + struct sockaddr * to; + UINT32 tolenPad; + int tolen; + }; + +struct sendScArgs + { + UINT32 sPad; + int s; + UINT32 bufPad; + const char * buf; + UINT32 bufLenPad; + int bufLen; + UINT32 flagsPad; + int flags; + }; + +struct sendmsgScArgs + { + UINT32 sPad; + int s; + UINT32 mpPad; + struct msghdr * mp; + UINT32 flagsPad; + int flags; + }; + +struct recvfromScArgs + { + UINT32 sPad; + int s; + UINT32 bufPad; + char * buf; + UINT32 bufLenPad; + int bufLen; + UINT32 flagsPad; + int flags; + UINT32 fromPad; + struct sockaddr *from; + UINT32 pFromLenPad; + int * pFromLen; + }; + +struct recvScArgs + { + UINT32 sPad; + int s; + UINT32 bufPad; + char * buf; + UINT32 bufLenPad; + int bufLen; + UINT32 flagsPad; + int flags; + }; + +struct recvmsgScArgs + { + UINT32 sPad; + int s; + UINT32 mpPad; + struct msghdr * mp; + UINT32 flagsPad; + int flags; + }; + +struct setsockoptScArgs + { + UINT32 sPad; + int s; + UINT32 levelPad; + int level; + UINT32 optnamePad; + int optname; + UINT32 optvalPad; + char * optval; + UINT32 optlenPad; + int optlen; + }; + +struct getsockoptScArgs + { + UINT32 sPad; + int s; + UINT32 levelPad; + int level; + UINT32 optnamePad; + int optname; + UINT32 optvalPad; + char * optval; + UINT32 optlenPad; + int * optlen; + }; + +struct getsocknameScArgs + { + UINT32 sPad; + int s; + UINT32 namePad; + struct sockaddr *name; + UINT32 namelenPad; + int * namelen; + }; + +struct getpeernameScArgs + { + UINT32 sPad; + int s; + UINT32 namePad; + struct sockaddr *name; + UINT32 namelenPad; + int *namelen; + }; + +struct shutdownScArgs + { + UINT32 sPad; + int s; + UINT32 howPad; + int how; + }; + +struct mmapScArgs + { + UINT32 addrPad; + void * addr; + UINT32 lenPad; + size_t len; + UINT32 protPad; + int prot; + UINT32 flagsPad; + int flags; + UINT32 fildesPad; + int fildes; + off_t64 off; + }; + +struct munmapScArgs + { + UINT32 addrPad; + void * addr; + UINT32 lenPad; + size_t len; + }; + +struct mprotectScArgs + { + UINT32 addrPad; + void * addr; + UINT32 lenPad; + size_t len; + UINT32 protPad; + int prot; + }; + +struct killScArgs + { + UINT32 rtpIdPad; + OBJ_HANDLE rtpId; + UINT32 signoPad; + int signo; + }; + +struct sigpendingScArgs + { + UINT32 pSetPad; + sigset_t * pSet; + }; + +struct sigprocmaskScArgs + { + UINT32 howPad; + int how; + UINT32 pSetPad; + const sigset_t * pSet; + UINT32 pOsetPad; + sigset_t * pOset; + }; + +struct _sigqueueScArgs + { + UINT32 rtpIdPad; + OBJ_HANDLE rtpId; + UINT32 signoPad; + int signo; + UINT32 pValuePad; + const union sigval * pValue; + UINT32 sigCodePad; + int sigCode; + }; + +struct sigsuspendScArgs + { + UINT32 pSetPad; + const sigset_t * pSet; + }; + +struct sigtimedwaitScArgs + { + UINT32 pSetPad; + const sigset_t * pSet; + UINT32 pInfoPad; + struct siginfo * pInfo; + UINT32 pTimePad; + const struct timespec * pTime; + }; + +struct _sigactionScArgs + { + UINT32 signoPad; + int signo; + UINT32 pActPad; + const struct sigaction * pAct; + UINT32 pOactPad; + struct sigaction * pOact; + UINT32 retAddrPad; + void * retAddr; + }; + +struct chdirScArgs + { + UINT32 namePad; + const char * name; + }; + +struct _getcwdScArgs + { + UINT32 bufferPad; + char * buffer; + UINT32 lengthPad; + int length; + }; + +struct waitpidScArgs + { + UINT32 childRtpIdPad; + OBJ_HANDLE childRtpId; + UINT32 pStatusPad; + int * pStatus; + UINT32 optionsPad; + int options; + }; + +struct sysctlScArgs + { + UINT32 pNamePad; + int *pName; + UINT32 nameLenPad; + u_int nameLen; + UINT32 pOldPad; + void * pOld; + UINT32 pOldLenPad; + size_t * pOldLen; + UINT32 pNewPad; + void * pNew; + UINT32 newLenPad; + size_t newLen; + }; + +struct _schedPxInfoGetScArgs + { + UINT32 pTimeSlicingOnPad; + BOOL * pTimeSlicingOn; + UINT32 pTimeSlicePeriodPad; + ULONG * pTimeSlicePeriod; + }; + +struct sigaltstackScArgs + { + UINT32 ssPad; + stack_t * ss; + UINT32 ossPad; + stack_t * oss; + }; + +struct unlinkScArgs + { + UINT32 namePad; + const char * name; + }; + +struct linkScArgs + { + UINT32 namePad; + const char * name; + UINT32 newnamePad; + const char * newname; + }; + +struct fsyncScArgs + { + UINT32 fdPad; + int fd; + }; + +struct fdatasyncScArgs + { + UINT32 fdPad; + int fd; + }; + +struct renameScArgs + { + UINT32 oldnamePad; + const char * oldname; + UINT32 newnamePad; + const char * newname; + }; + +struct fpathconfScArgs + { + UINT32 fdPad; + int fd; + UINT32 namePad; + int name; + }; + +struct pathconfScArgs + { + UINT32 pathPad; + const char * path; + UINT32 namePad; + int name; + }; + +struct accessScArgs + { + UINT32 pathPad; + const char * path; + UINT32 amodePad; + int amode; + }; + +struct chmodScArgs + { + UINT32 pathPad; + const char * path; + UINT32 modePad; + mode_t mode; + }; + +struct eventReceiveScArgs + { + UINT32 eventsPad; + UINT32 events; + UINT32 optionsPad; + UINT32 options; + UINT32 timeoutPad; + int timeout; + UINT32 pEvtsReceivedPad; + UINT32 * pEvtsReceived; + }; + +struct eventSendScArgs + { + UINT32 taskIdPad; + int taskId; + UINT32 eventsPad; + UINT32 events; + }; + +struct eventCtlScArgs + { + UINT32 handlePad; + OBJ_HANDLE handle; + UINT32 commandPad; + VX_EVT_CTL_CMD command; + UINT32 pArgPad; + void * pArg; + UINT32 pArgSizePad; + UINT * pArgSize; + }; + +struct msgQSendScArgs + { + UINT32 handlePad; + OBJ_HANDLE handle; + UINT32 bufferPad; + char * buffer; + UINT32 nBytesPad; + UINT nBytes; + UINT32 timeoutPad; + int timeout; + UINT32 priorityPad; + int priority; + }; + +struct msgQReceiveScArgs + { + UINT32 handlePad; + OBJ_HANDLE handle; + UINT32 bufferPad; + char * buffer; + UINT32 maxNBytesPad; + UINT maxNBytes; + UINT32 timeoutPad; + int timeout; + }; + +struct _msgQOpenScArgs + { + UINT32 namePad; + const char * name; + UINT32 maxMsgsPad; + UINT maxMsgs; + UINT32 maxMsgLengthPad; + UINT maxMsgLength; + UINT32 optionsPad; + int options; + UINT32 modePad; + int mode; + UINT32 contextPad; + void * context; + }; + +struct objDeleteScArgs + { + UINT32 handlePad; + OBJ_HANDLE handle; + UINT32 optionsPad; + int options; + }; + +struct objInfoGetScArgs + { + UINT32 handlePad; + OBJ_HANDLE handle; + UINT32 pInfoPad; + void * pInfo; + UINT32 pInfoSizePad; + UINT * pInfoSize; + UINT32 levelPad; + int level; + }; + +struct _semTakeScArgs + { + UINT32 handlePad; + OBJ_HANDLE handle; + UINT32 timeoutPad; + int timeout; + }; + +struct _semGiveScArgs + { + UINT32 handlePad; + OBJ_HANDLE handle; + }; + +struct _semOpenScArgs + { + UINT32 namePad; + const char * name; + UINT32 typePad; + SEM_TYPE type; + UINT32 initStatePad; + int initState; + UINT32 optionsPad; + int options; + UINT32 modePad; + int mode; + UINT32 contextPad; + void * context; + }; + +struct semCtlScArgs + { + UINT32 handlePad; + OBJ_HANDLE handle; + UINT32 commandPad; + VX_SEM_CTL_CMD command; + UINT32 pArgPad; + void * pArg; + UINT32 pArgSizePad; + UINT * pArgSize; + }; + +struct _taskOpenScArgs + { + UINT32 pArgsPad; + struct vx_task_open_sc_args * pArgs; + }; + +struct taskCtlScArgs + { + UINT32 tidPad; + int tid; + UINT32 commandPad; + VX_TASK_CTL_CMD command; + UINT32 pArgPad; + void * pArg; + UINT32 pArgSizePad; + UINT * pArgSize; + }; + +struct taskDelayScArgs + { + UINT32 ticksPad; + int ticks; + }; + +struct rtpSpawnScArgs + { + UINT32 rtpFileNamePad; + const char * rtpFileName; + UINT32 argvPad; + const char ** argv; + UINT32 envpPad; + const char ** envp; + UINT32 priorityPad; + int priority; + UINT32 uStackSizePad; + int uStackSize; + UINT32 optionsPad; + int options; + UINT32 taskOptionsPad; + int taskOptions; + }; + +struct rtpInfoGetScArgs + { + UINT32 rtpIdPad; + OBJ_HANDLE rtpId; + UINT32 rtpStructPad; + RTP_DESC * rtpStruct; + }; + +struct taskKillScArgs + { + UINT32 taskHandlePad; + OBJ_HANDLE taskHandle; + UINT32 signoPad; + int signo; + }; + +struct _taskSigqueueScArgs + { + UINT32 taskHandlePad; + OBJ_HANDLE taskHandle; + UINT32 signoPad; + int signo; + UINT32 pValuePad; + const union sigval * pValue; + UINT32 sigCodePad; + int sigCode; + }; + +struct _timer_openScArgs + { + UINT32 namePad; + const char * name; + UINT32 modePad; + int mode; + UINT32 clockIdPad; + clockid_t clockId; + UINT32 evpPad; + struct sigevent * evp; + UINT32 contextPad; + void * context; + }; + +struct timerCtlScArgs + { + UINT32 cmdCodePad; + TIMER_CTL_CMD cmdCode; + UINT32 handlePad; + int handle; + UINT32 pArgsPad; + void * pArgs; + UINT32 pArgSizePad; + UINT * pArgSize; + }; + +struct pxOpenScArgs + { + UINT32 typePad; + PX_OBJ_TYPE type; + UINT32 namePad; + const char * name; + UINT32 objOpenModePad; + int objOpenMode; + UINT32 attrPad; + void * attr; + }; + +struct pxCloseScArgs + { + UINT32 handlePad; + OBJ_HANDLE handle; + }; + +struct pxUnlinkScArgs + { + UINT32 typePad; + PX_OBJ_TYPE type; + UINT32 namePad; + const char * name; + }; + +struct pxCtlScArgs + { + UINT32 handlePad; + OBJ_HANDLE handle; + UINT32 cmdCodePad; + PX_CTL_CMD_CODE cmdCode; + UINT32 pArgsPad; + void * pArgs; + UINT32 pArgSizePad; + UINT * pArgSize; + }; + +struct pxMqReceiveScArgs + { + UINT32 handlePad; + OBJ_HANDLE handle; + UINT32 pMsgPad; + char * pMsg; + UINT32 msgLenPad; + size_t msgLen; + UINT32 pMsgPrioPad; + unsigned int * pMsgPrio; + UINT32 waitOptionPad; + PX_WAIT_OPTION waitOption; + UINT32 time_outPad; + struct timespec * time_out; + }; + +struct pxMqSendScArgs + { + UINT32 handlePad; + OBJ_HANDLE handle; + UINT32 pMsgPad; + const char * pMsg; + UINT32 msgLenPad; + size_t msgLen; + UINT32 msgPrioPad; + unsigned int msgPrio; + UINT32 waitOptionPad; + PX_WAIT_OPTION waitOption; + UINT32 time_outPad; + struct timespec * time_out; + }; + +struct pxSemWaitScArgs + { + UINT32 handlePad; + OBJ_HANDLE handle; + UINT32 waitOptionPad; + PX_WAIT_OPTION waitOption; + UINT32 time_outPad; + struct timespec * time_out; + }; + +struct pxSemPostScArgs + { + UINT32 handlePad; + OBJ_HANDLE handle; + }; + +struct pipeDevCreateScArgs + { + UINT32 namePad; + const char * name; + UINT32 nMessagesPad; + int nMessages; + UINT32 nBytesPad; + int nBytes; + }; + +struct pipeDevDeleteScArgs + { + UINT32 namePad; + const char * name; + UINT32 forcePad; + BOOL force; + }; + +struct _sdCreateScArgs + { + UINT32 namePad; + char * name; + UINT32 optionsPad; + int options; + UINT32 sizePad; + UINT32 size; + off_t64 physAddress; + UINT32 attrPad; + MMU_ATTR attr; + UINT32 pVirtAddressPad; + void ** pVirtAddress; + }; + +struct _sdOpenScArgs + { + UINT32 namePad; + char * name; + UINT32 optionsPad; + int options; + UINT32 modePad; + int mode; + UINT32 sizePad; + UINT32 size; + off_t64 physAddress; + UINT32 attrPad; + MMU_ATTR attr; + UINT32 pVirtAddressPad; + void ** pVirtAddress; + }; + +struct sdDeleteScArgs + { + UINT32 handlePad; + OBJ_HANDLE handle; + UINT32 optionsPad; + int options; + }; + +struct sdMapScArgs + { + UINT32 handlePad; + OBJ_HANDLE handle; + UINT32 attrPad; + MMU_ATTR attr; + UINT32 optionsPad; + int options; + }; + +struct sdUnmapScArgs + { + UINT32 handlePad; + OBJ_HANDLE handle; + UINT32 optionsPad; + int options; + }; + +struct sdProtectScArgs + { + UINT32 handlePad; + OBJ_HANDLE handle; + UINT32 attrPad; + MMU_ATTR attr; + }; + +struct _edrErrorInjectScArgs + { + UINT32 kindPad; + int kind; + UINT32 fileNamePad; + const char *fileName; + UINT32 lineNumberPad; + int lineNumber; + UINT32 regsetPad; + REG_SET *regset; + UINT32 addrPad; + void *addr; + UINT32 msgPad; + const char *msg; + }; + +struct resSearchNScArgs + { + UINT32 namePad; + const char * name; + UINT32 targetPad; + struct res_target * target; + }; + +struct wvEventScArgs + { + UINT32 eventIdPad; + int eventId; + UINT32 pDataPad; + const char * pData; + UINT32 dataSizePad; + unsigned int dataSize; + }; + +struct rtpVarAddScArgs + { + UINT32 pVarPad; + void ** pVar; + UINT32 valuePad; + void * value; + }; + +struct sdInfoGetScArgs + { + UINT32 handlePad; + OBJ_HANDLE handle; + UINT32 pSdStructPad; + SD_DESC * pSdStruct; + }; + +struct _shlOpenScArgs + { + UINT32 namePad; + const char * name; + UINT32 optionsPad; + int options; + }; + +struct _shlUnlockScArgs + { + UINT32 shlIdPad; + SHL_ID shlId; + }; + +struct _shlCloseScArgs + { + UINT32 shlIdPad; + SHL_ID shlId; + }; + +struct _shlGetScArgs + { + UINT32 shlIdPad; + SHL_ID shlId; + UINT32 pInfoPad; + SHLINFO *pInfo; + }; + +struct _shlPutScArgs + { + UINT32 shlIdPad; + SHL_ID shlId; + UINT32 pInfoPad; + const SHLINFO *pInfo; + }; + +struct objUnlinkScArgs + { + UINT32 namePad; + const char * name; + UINT32 classTypePad; + enum windObjClassType classType; + }; + +struct getprlimitScArgs + { + UINT32 idtypePad; + int idtype; + UINT32 handlePad; + OBJ_HANDLE handle; + UINT32 resourcePad; + int resource; + UINT32 rlpPad; + struct rlimit *rlp; + }; + +struct setprlimitScArgs + { + UINT32 idtypePad; + int idtype; + UINT32 handlePad; + OBJ_HANDLE handle; + UINT32 resourcePad; + int resource; + UINT32 rlpPad; + struct rlimit *rlp; + }; + +struct _mctlScArgs + { + UINT32 addrPad; + void * addr; + UINT32 lenPad; + size_t len; + UINT32 functionPad; + int function; + UINT32 argPad; + int arg; + }; + +#endif /* _ASMLANGUAGE */ diff --git a/h/arch/mips/syscallArgsMIPS64LE.h b/h/arch/mips/syscallArgsMIPS64LE.h new file mode 100644 index 0000000..95dda04 --- /dev/null +++ b/h/arch/mips/syscallArgsMIPS64LE.h @@ -0,0 +1,958 @@ +/* Aligned for MIPS64LE - MIPS64 Little-Endian */ + + +/* THIS FILE IS AUTO_GENERATED. PLEASE DO NOT EDIT. */ + +#ifndef _ASMLANGUAGE + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct _exitScArgs + { + int status; + }; + +struct creatScArgs + { + const char * name; + UINT32 flagPad; + mode_t flag; + }; + +struct _openScArgs + { + const char * name; + UINT32 flagsPad; + int flags; + UINT32 modePad; + int mode; + }; + +struct closeScArgs + { + int fd; + }; + +struct readScArgs + { + int fd; + UINT32 bufferPad; + void * buffer; + UINT32 maxbytesPad; + size_t maxbytes; + }; + +struct writeScArgs + { + int fd; + UINT32 bufferPad; + const void * buffer; + UINT32 nbytesPad; + size_t nbytes; + }; + +struct _ioctlScArgs + { + int fd; + UINT32 functionPad; + int function; + UINT32 argPad; + int arg; + }; + +struct dupScArgs + { + int fd; + }; + +struct dup2ScArgs + { + int fd; + UINT32 fd2Pad; + int fd2; + }; + +struct pipeScArgs + { + int filedes[2]; + }; + +struct removeScArgs + { + const char * name; + }; + +struct selectScArgs + { + int width; + UINT32 readFdsPad; + fd_set * readFds; + UINT32 writeFdsPad; + fd_set * writeFds; + UINT32 excFdsPad; + fd_set * excFds; + UINT32 timeoutPad; + struct timeval * timeout; + }; + +struct socketScArgs + { + int domain; + UINT32 typePad; + int type; + UINT32 protocolPad; + int protocol; + }; + +struct bindScArgs + { + int s; + UINT32 namePad; + struct sockaddr * name; + UINT32 namelenPad; + int namelen; + }; + +struct listenScArgs + { + int s; + UINT32 backlogPad; + int backlog; + }; + +struct acceptScArgs + { + int s; + UINT32 addrPad; + struct sockaddr * addr; + UINT32 addrlenPad; + int *addrlen; + }; + +struct connectScArgs + { + int s; + UINT32 namePad; + struct sockaddr * name; + UINT32 namelenPad; + int namelen; + }; + +struct sendtoScArgs + { + int s; + UINT32 bufPad; + caddr_t buf; + UINT32 bufLenPad; + int bufLen; + UINT32 flagsPad; + int flags; + UINT32 toPad; + struct sockaddr * to; + UINT32 tolenPad; + int tolen; + }; + +struct sendScArgs + { + int s; + UINT32 bufPad; + const char * buf; + UINT32 bufLenPad; + int bufLen; + UINT32 flagsPad; + int flags; + }; + +struct sendmsgScArgs + { + int s; + UINT32 mpPad; + struct msghdr * mp; + UINT32 flagsPad; + int flags; + }; + +struct recvfromScArgs + { + int s; + UINT32 bufPad; + char * buf; + UINT32 bufLenPad; + int bufLen; + UINT32 flagsPad; + int flags; + UINT32 fromPad; + struct sockaddr *from; + UINT32 pFromLenPad; + int * pFromLen; + }; + +struct recvScArgs + { + int s; + UINT32 bufPad; + char * buf; + UINT32 bufLenPad; + int bufLen; + UINT32 flagsPad; + int flags; + }; + +struct recvmsgScArgs + { + int s; + UINT32 mpPad; + struct msghdr * mp; + UINT32 flagsPad; + int flags; + }; + +struct setsockoptScArgs + { + int s; + UINT32 levelPad; + int level; + UINT32 optnamePad; + int optname; + UINT32 optvalPad; + char * optval; + UINT32 optlenPad; + int optlen; + }; + +struct getsockoptScArgs + { + int s; + UINT32 levelPad; + int level; + UINT32 optnamePad; + int optname; + UINT32 optvalPad; + char * optval; + UINT32 optlenPad; + int * optlen; + }; + +struct getsocknameScArgs + { + int s; + UINT32 namePad; + struct sockaddr *name; + UINT32 namelenPad; + int * namelen; + }; + +struct getpeernameScArgs + { + int s; + UINT32 namePad; + struct sockaddr *name; + UINT32 namelenPad; + int *namelen; + }; + +struct shutdownScArgs + { + int s; + UINT32 howPad; + int how; + }; + +struct mmapScArgs + { + void * addr; + UINT32 lenPad; + size_t len; + UINT32 protPad; + int prot; + UINT32 flagsPad; + int flags; + UINT32 fildesPad; + int fildes; + UINT32 offPad; + off_t64 off; + }; + +struct munmapScArgs + { + void * addr; + UINT32 lenPad; + size_t len; + }; + +struct mprotectScArgs + { + void * addr; + UINT32 lenPad; + size_t len; + UINT32 protPad; + int prot; + }; + +struct killScArgs + { + OBJ_HANDLE rtpId; + UINT32 signoPad; + int signo; + }; + +struct sigpendingScArgs + { + sigset_t * pSet; + }; + +struct sigprocmaskScArgs + { + int how; + UINT32 pSetPad; + const sigset_t * pSet; + UINT32 pOsetPad; + sigset_t * pOset; + }; + +struct _sigqueueScArgs + { + OBJ_HANDLE rtpId; + UINT32 signoPad; + int signo; + UINT32 pValuePad; + const union sigval * pValue; + UINT32 sigCodePad; + int sigCode; + }; + +struct sigsuspendScArgs + { + const sigset_t * pSet; + }; + +struct sigtimedwaitScArgs + { + const sigset_t * pSet; + UINT32 pInfoPad; + struct siginfo * pInfo; + UINT32 pTimePad; + const struct timespec * pTime; + }; + +struct _sigactionScArgs + { + int signo; + UINT32 pActPad; + const struct sigaction * pAct; + UINT32 pOactPad; + struct sigaction * pOact; + UINT32 retAddrPad; + void * retAddr; + }; + +struct chdirScArgs + { + const char * name; + }; + +struct _getcwdScArgs + { + char * buffer; + UINT32 lengthPad; + int length; + }; + +struct waitpidScArgs + { + OBJ_HANDLE childRtpId; + UINT32 pStatusPad; + int * pStatus; + UINT32 optionsPad; + int options; + }; + +struct sysctlScArgs + { + int *pName; + UINT32 nameLenPad; + u_int nameLen; + UINT32 pOldPad; + void * pOld; + UINT32 pOldLenPad; + size_t * pOldLen; + UINT32 pNewPad; + void * pNew; + UINT32 newLenPad; + size_t newLen; + }; + +struct _schedPxInfoGetScArgs + { + BOOL * pTimeSlicingOn; + UINT32 pTimeSlicePeriodPad; + ULONG * pTimeSlicePeriod; + }; + +struct sigaltstackScArgs + { + stack_t * ss; + UINT32 ossPad; + stack_t * oss; + }; + +struct unlinkScArgs + { + const char * name; + }; + +struct linkScArgs + { + const char * name; + UINT32 newnamePad; + const char * newname; + }; + +struct fsyncScArgs + { + int fd; + }; + +struct fdatasyncScArgs + { + int fd; + }; + +struct renameScArgs + { + const char * oldname; + UINT32 newnamePad; + const char * newname; + }; + +struct fpathconfScArgs + { + int fd; + UINT32 namePad; + int name; + }; + +struct pathconfScArgs + { + const char * path; + UINT32 namePad; + int name; + }; + +struct accessScArgs + { + const char * path; + UINT32 amodePad; + int amode; + }; + +struct chmodScArgs + { + const char * path; + UINT32 modePad; + mode_t mode; + }; + +struct eventReceiveScArgs + { + UINT32 events; + UINT32 optionsPad; + UINT32 options; + UINT32 timeoutPad; + int timeout; + UINT32 pEvtsReceivedPad; + UINT32 * pEvtsReceived; + }; + +struct eventSendScArgs + { + int taskId; + UINT32 eventsPad; + UINT32 events; + }; + +struct eventCtlScArgs + { + OBJ_HANDLE handle; + UINT32 commandPad; + VX_EVT_CTL_CMD command; + UINT32 pArgPad; + void * pArg; + UINT32 pArgSizePad; + UINT * pArgSize; + }; + +struct msgQSendScArgs + { + OBJ_HANDLE handle; + UINT32 bufferPad; + char * buffer; + UINT32 nBytesPad; + UINT nBytes; + UINT32 timeoutPad; + int timeout; + UINT32 priorityPad; + int priority; + }; + +struct msgQReceiveScArgs + { + OBJ_HANDLE handle; + UINT32 bufferPad; + char * buffer; + UINT32 maxNBytesPad; + UINT maxNBytes; + UINT32 timeoutPad; + int timeout; + }; + +struct _msgQOpenScArgs + { + const char * name; + UINT32 maxMsgsPad; + UINT maxMsgs; + UINT32 maxMsgLengthPad; + UINT maxMsgLength; + UINT32 optionsPad; + int options; + UINT32 modePad; + int mode; + UINT32 contextPad; + void * context; + }; + +struct objDeleteScArgs + { + OBJ_HANDLE handle; + UINT32 optionsPad; + int options; + }; + +struct objInfoGetScArgs + { + OBJ_HANDLE handle; + UINT32 pInfoPad; + void * pInfo; + UINT32 pInfoSizePad; + UINT * pInfoSize; + UINT32 levelPad; + int level; + }; + +struct _semTakeScArgs + { + OBJ_HANDLE handle; + UINT32 timeoutPad; + int timeout; + }; + +struct _semGiveScArgs + { + OBJ_HANDLE handle; + }; + +struct _semOpenScArgs + { + const char * name; + UINT32 typePad; + SEM_TYPE type; + UINT32 initStatePad; + int initState; + UINT32 optionsPad; + int options; + UINT32 modePad; + int mode; + UINT32 contextPad; + void * context; + }; + +struct semCtlScArgs + { + OBJ_HANDLE handle; + UINT32 commandPad; + VX_SEM_CTL_CMD command; + UINT32 pArgPad; + void * pArg; + UINT32 pArgSizePad; + UINT * pArgSize; + }; + +struct _taskOpenScArgs + { + struct vx_task_open_sc_args * pArgs; + }; + +struct taskCtlScArgs + { + int tid; + UINT32 commandPad; + VX_TASK_CTL_CMD command; + UINT32 pArgPad; + void * pArg; + UINT32 pArgSizePad; + UINT * pArgSize; + }; + +struct taskDelayScArgs + { + int ticks; + }; + +struct rtpSpawnScArgs + { + const char * rtpFileName; + UINT32 argvPad; + const char ** argv; + UINT32 envpPad; + const char ** envp; + UINT32 priorityPad; + int priority; + UINT32 uStackSizePad; + int uStackSize; + UINT32 optionsPad; + int options; + UINT32 taskOptionsPad; + int taskOptions; + }; + +struct rtpInfoGetScArgs + { + OBJ_HANDLE rtpId; + UINT32 rtpStructPad; + RTP_DESC * rtpStruct; + }; + +struct taskKillScArgs + { + OBJ_HANDLE taskHandle; + UINT32 signoPad; + int signo; + }; + +struct _taskSigqueueScArgs + { + OBJ_HANDLE taskHandle; + UINT32 signoPad; + int signo; + UINT32 pValuePad; + const union sigval * pValue; + UINT32 sigCodePad; + int sigCode; + }; + +struct _timer_openScArgs + { + const char * name; + UINT32 modePad; + int mode; + UINT32 clockIdPad; + clockid_t clockId; + UINT32 evpPad; + struct sigevent * evp; + UINT32 contextPad; + void * context; + }; + +struct timerCtlScArgs + { + TIMER_CTL_CMD cmdCode; + UINT32 handlePad; + int handle; + UINT32 pArgsPad; + void * pArgs; + UINT32 pArgSizePad; + UINT * pArgSize; + }; + +struct pxOpenScArgs + { + PX_OBJ_TYPE type; + UINT32 namePad; + const char * name; + UINT32 objOpenModePad; + int objOpenMode; + UINT32 attrPad; + void * attr; + }; + +struct pxCloseScArgs + { + OBJ_HANDLE handle; + }; + +struct pxUnlinkScArgs + { + PX_OBJ_TYPE type; + UINT32 namePad; + const char * name; + }; + +struct pxCtlScArgs + { + OBJ_HANDLE handle; + UINT32 cmdCodePad; + PX_CTL_CMD_CODE cmdCode; + UINT32 pArgsPad; + void * pArgs; + UINT32 pArgSizePad; + UINT * pArgSize; + }; + +struct pxMqReceiveScArgs + { + OBJ_HANDLE handle; + UINT32 pMsgPad; + char * pMsg; + UINT32 msgLenPad; + size_t msgLen; + UINT32 pMsgPrioPad; + unsigned int * pMsgPrio; + UINT32 waitOptionPad; + PX_WAIT_OPTION waitOption; + UINT32 time_outPad; + struct timespec * time_out; + }; + +struct pxMqSendScArgs + { + OBJ_HANDLE handle; + UINT32 pMsgPad; + const char * pMsg; + UINT32 msgLenPad; + size_t msgLen; + UINT32 msgPrioPad; + unsigned int msgPrio; + UINT32 waitOptionPad; + PX_WAIT_OPTION waitOption; + UINT32 time_outPad; + struct timespec * time_out; + }; + +struct pxSemWaitScArgs + { + OBJ_HANDLE handle; + UINT32 waitOptionPad; + PX_WAIT_OPTION waitOption; + UINT32 time_outPad; + struct timespec * time_out; + }; + +struct pxSemPostScArgs + { + OBJ_HANDLE handle; + }; + +struct pipeDevCreateScArgs + { + const char * name; + UINT32 nMessagesPad; + int nMessages; + UINT32 nBytesPad; + int nBytes; + }; + +struct pipeDevDeleteScArgs + { + const char * name; + UINT32 forcePad; + BOOL force; + }; + +struct _sdCreateScArgs + { + char * name; + UINT32 optionsPad; + int options; + UINT32 sizePad; + UINT32 size; + UINT32 physAddressPad; + off_t64 physAddress; + MMU_ATTR attr; + UINT32 pVirtAddressPad; + void ** pVirtAddress; + }; + +struct _sdOpenScArgs + { + char * name; + UINT32 optionsPad; + int options; + UINT32 modePad; + int mode; + UINT32 sizePad; + UINT32 size; + UINT32 physAddressPad; + off_t64 physAddress; + MMU_ATTR attr; + UINT32 pVirtAddressPad; + void ** pVirtAddress; + }; + +struct sdDeleteScArgs + { + OBJ_HANDLE handle; + UINT32 optionsPad; + int options; + }; + +struct sdMapScArgs + { + OBJ_HANDLE handle; + UINT32 attrPad; + MMU_ATTR attr; + UINT32 optionsPad; + int options; + }; + +struct sdUnmapScArgs + { + OBJ_HANDLE handle; + UINT32 optionsPad; + int options; + }; + +struct sdProtectScArgs + { + OBJ_HANDLE handle; + UINT32 attrPad; + MMU_ATTR attr; + }; + +struct _edrErrorInjectScArgs + { + int kind; + UINT32 fileNamePad; + const char *fileName; + UINT32 lineNumberPad; + int lineNumber; + UINT32 regsetPad; + REG_SET *regset; + UINT32 addrPad; + void *addr; + UINT32 msgPad; + const char *msg; + }; + +struct resSearchNScArgs + { + const char * name; + UINT32 targetPad; + struct res_target * target; + }; + +struct wvEventScArgs + { + int eventId; + UINT32 pDataPad; + const char * pData; + UINT32 dataSizePad; + unsigned int dataSize; + }; + +struct rtpVarAddScArgs + { + void ** pVar; + UINT32 valuePad; + void * value; + }; + +struct sdInfoGetScArgs + { + OBJ_HANDLE handle; + UINT32 pSdStructPad; + SD_DESC * pSdStruct; + }; + +struct _shlOpenScArgs + { + const char * name; + UINT32 optionsPad; + int options; + }; + +struct _shlUnlockScArgs + { + SHL_ID shlId; + }; + +struct _shlCloseScArgs + { + SHL_ID shlId; + }; + +struct _shlGetScArgs + { + SHL_ID shlId; + UINT32 pInfoPad; + SHLINFO *pInfo; + }; + +struct _shlPutScArgs + { + SHL_ID shlId; + UINT32 pInfoPad; + const SHLINFO *pInfo; + }; + +struct objUnlinkScArgs + { + const char * name; + UINT32 classTypePad; + enum windObjClassType classType; + }; + +struct getprlimitScArgs + { + int idtype; + UINT32 handlePad; + OBJ_HANDLE handle; + UINT32 resourcePad; + int resource; + UINT32 rlpPad; + struct rlimit *rlp; + }; + +struct setprlimitScArgs + { + int idtype; + UINT32 handlePad; + OBJ_HANDLE handle; + UINT32 resourcePad; + int resource; + UINT32 rlpPad; + struct rlimit *rlp; + }; + +struct _mctlScArgs + { + void * addr; + UINT32 lenPad; + size_t len; + UINT32 functionPad; + int function; + UINT32 argPad; + int arg; + }; + +#endif /* _ASMLANGUAGE */ diff --git a/h/arch/mips/syscallMips.h b/h/arch/mips/syscallMips.h new file mode 100644 index 0000000..a8d60aa --- /dev/null +++ b/h/arch/mips/syscallMips.h @@ -0,0 +1,131 @@ +/* syscallMips.h - MIPS specific System Call Infrastructure header */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,19aug04,pes Remove stack pointer range checking until another validation + strategy can be identified. +01g,10mar04,pes *Really* finish implementation of 01e. +01f,10mar04,pes Finish implementation of 01e. +01e,10mar04,pes _STACK_ALIGN_SIZE has been re-defined to 8, so we no longer + need a custom vlue for the stack alignment test. +01d,12jan04,pes Modify stack alignment test. _STACK_ALIGN_SIZE is 16 bytes, + but in practice only 64-bit (8 byte) alignment is enforced. +01c,30oct03,pcm implemented changes from code review +01b,21oct03,pcm changed pStackLimit to pStackEnd +01a,18sep03,pes written. +*/ + +/* +DESCRIPTION +This header contains MIPS-specific definitions and constants used by +the System Call Infrastructure library. + +*/ + +#ifndef __INCsyscallMipsh +#define __INCsyscallMipsh + +#ifndef _ASMLANGUAGE +#include "taskLib.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define syscallDispatch_PORTABLE /* Use the portable dispatcher */ + + /* defines */ + +#if (_WRS_INT_REGISTER_SIZE == 4) +#define SYSCALL_ENTRY_FRAME_SIZE 56 +#elif (_WRS_INT_REGISTER_SIZE == 8) +#define SYSCALL_ENTRY_FRAME_SIZE 88 +#else +#error "_WRS_INT_REGISTER_SIZE not defined." +#endif + +#ifndef _ASMLANGUAGE + + +typedef struct sycall_mips_stack_args + { + _RType args[4]; + } SYSCALL_MIPS_STACK_ARGS; + +/* + * this macro is used to validate the stack pointer and copy necessary + * arguments from the user stack to the kernel stack only after such + * validation has been successfully completed. XXX This needs _WRS. PES + */ + +#if defined (_WRS_USER_SP_RANGE_CHECK) +#define _SYSCALL_USER_SP_CHECK(sp) \ + { \ + register SYSCALL_MIPS_STACK_ARGS *src; \ + register SYSCALL_MIPS_STACK_ARGS *dst; \ + if (((UINT32)(sp) < (UINT32)(taskIdCurrent->pStackEnd)) || \ + ((UINT32)(sp) > (UINT32)(taskIdCurrent->pStackBase)) || \ + ((UINT32)(sp) & (_STACK_ALIGN_SIZE - 1))) \ + { \ + errnoSet (S_syscallLib_INVALID_USER_SP); \ + return (ERROR); \ + } \ + src = (SYSCALL_MIPS_STACK_ARGS *)&(((SYSCALL_ENTRY_STATE *)(sp))->args[4]); \ + dst = (SYSCALL_MIPS_STACK_ARGS *)&(pState->args[4]); \ + *dst = *src; \ + } +#else /* _WRS_USER_SP_RANGE_CHECK */ +#define _SYSCALL_USER_SP_CHECK(sp) \ + { \ + register SYSCALL_MIPS_STACK_ARGS *src; \ + register SYSCALL_MIPS_STACK_ARGS *dst; \ + if (((UINT32)(sp) & (_STACK_ALIGN_SIZE - 1))) \ + { \ + errnoSet (S_syscallLib_INVALID_USER_SP); \ + return (ERROR); \ + } \ + src = (SYSCALL_MIPS_STACK_ARGS *)&(((SYSCALL_ENTRY_STATE *)(sp))->args[4]); \ + dst = (SYSCALL_MIPS_STACK_ARGS *)&(pState->args[4]); \ + *dst = *src; \ + } +#endif /* _WRS_USER_SP_RANGE_CHECK */ + + /* typedefs */ + + /* + * The SYSCALL_ENTRY_STATE structure defines the saved machine state + * when the system call trap is taken. This information is architecture + * specific, and is used by the system call dispatcher to restart system + * calls that have been interrupted by the occurance of signals. + * System call restart is achieved by restoring the saved state at the + * time of the system call trap, and re-issuing the system call. + * + * All arguments to the system call are saved on the kernel stack, and + * the address of that array is passed as an argument to the dispatcher. + * The layout of this structure must exactly match the ordering of members + * of the system call entry frame in src/arch/Mips/syscallALib.s. + * + */ + +typedef struct syscall_entry_state + { + _RType args[8]; /* argument list (a0-a3, user stack) */ + int scn; /* System Call Number (SCN) in v0 */ + int * pUStack; /* user-mode stack pointer */ + void * pSdata; /* small data pointer (gp) */ + void * pc; /* Trap return address (EPC) */ + void * ra; /* saved return address register */ + int statusReg; /* saved Status Register (SR) */ + } SYSCALL_ENTRY_STATE; + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsyscallMipsh */ diff --git a/h/arch/mips/taskMipsLib.h b/h/arch/mips/taskMipsLib.h new file mode 100644 index 0000000..6864212 --- /dev/null +++ b/h/arch/mips/taskMipsLib.h @@ -0,0 +1,106 @@ +/* taskMipsLib.h - generic kernel interface header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* + * This file has been developed or significantly modified by the + * MIPS Center of Excellence Dedicated Engineering Staff. + * This notice is as per the MIPS Center of Excellence Master Partner + * Agreement, do not remove this notice without checking first with + * WR/Platforms MIPS Center of Excellence engineering management. + */ + +/* +modification history +-------------------- +01k,11sep03,jmt Modify Exception Stack for Base 6 +01j,22aug03,jmt Add MMU Support +01i,16jul01,ros add CofE comment +01h,18oct93,cd added R4000 support. +01g,02apr93,caf prototyped taskSRInit(). +01f,22sep92,rrr added support for c++ +01e,03jun92,ajm updated file name references to match real name +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01b,28may91,ajm reordered WIND_TCB_REGS order due to REG_SET change +01a,01may91,ajm split/derived from 68k version 01k. +*/ + +#ifndef __INCtaskMipsLibh +#define __INCtaskMipsLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#define WIND_TCB_GREG_BASE (WIND_TCB_REGS+2*4+2*_RTypeSize) +#define WIND_TCB_GREG_OFFSET(n) (WIND_TCB_GREG_BASE + (n)*_RTypeSize) +#define WIND_TCB_SR (WIND_TCB_REGS + 0*4) +#define WIND_TCB_PC (WIND_TCB_REGS + 1*4) +#define WIND_TCB_LO (WIND_TCB_REGS + 2*4+0*_RTypeSize) +#define WIND_TCB_HI (WIND_TCB_REGS + 2*4+1*_RTypeSize) +#define WIND_TCB_ZERO WIND_TCB_GREG_OFFSET(0) +#define WIND_TCB_AT WIND_TCB_GREG_OFFSET(1) +#define WIND_TCB_V0 WIND_TCB_GREG_OFFSET(2) +#define WIND_TCB_V1 WIND_TCB_GREG_OFFSET(3) +#define WIND_TCB_A0 WIND_TCB_GREG_OFFSET(4) +#define WIND_TCB_A1 WIND_TCB_GREG_OFFSET(5) +#define WIND_TCB_A2 WIND_TCB_GREG_OFFSET(6) +#define WIND_TCB_A3 WIND_TCB_GREG_OFFSET(7) +#define WIND_TCB_T0 WIND_TCB_GREG_OFFSET(8) +#define WIND_TCB_T1 WIND_TCB_GREG_OFFSET(9) +#define WIND_TCB_T2 WIND_TCB_GREG_OFFSET(10) +#define WIND_TCB_T3 WIND_TCB_GREG_OFFSET(11) +#define WIND_TCB_T4 WIND_TCB_GREG_OFFSET(12) +#define WIND_TCB_T5 WIND_TCB_GREG_OFFSET(13) +#define WIND_TCB_T6 WIND_TCB_GREG_OFFSET(14) +#define WIND_TCB_T7 WIND_TCB_GREG_OFFSET(15) +#define WIND_TCB_S0 WIND_TCB_GREG_OFFSET(16) +#define WIND_TCB_S1 WIND_TCB_GREG_OFFSET(17) +#define WIND_TCB_S2 WIND_TCB_GREG_OFFSET(18) +#define WIND_TCB_S3 WIND_TCB_GREG_OFFSET(19) +#define WIND_TCB_S4 WIND_TCB_GREG_OFFSET(20) +#define WIND_TCB_S5 WIND_TCB_GREG_OFFSET(21) +#define WIND_TCB_S6 WIND_TCB_GREG_OFFSET(22) +#define WIND_TCB_S7 WIND_TCB_GREG_OFFSET(23) +#define WIND_TCB_T8 WIND_TCB_GREG_OFFSET(24) +#define WIND_TCB_T9 WIND_TCB_GREG_OFFSET(25) +#define WIND_TCB_K0 WIND_TCB_GREG_OFFSET(26) +#define WIND_TCB_K1 WIND_TCB_GREG_OFFSET(27) +#define WIND_TCB_GP WIND_TCB_GREG_OFFSET(28) +#define WIND_TCB_SP WIND_TCB_GREG_OFFSET(29) +#define WIND_TCB_S8 WIND_TCB_GREG_OFFSET(30) +#define WIND_TCB_RA WIND_TCB_GREG_OFFSET(31) +#define WIND_TCB_GREG_END (WIND_TCB_GREG_BASE+32*_RTypeSize) +#define WIND_TCB_WDB_CAUSE (WIND_TCB_GREG_END + 0*4) +#define WIND_TCB_WDB_FPCSR (WIND_TCB_GREG_END + 1*4) +#define WIND_TCB_INTCTRL (WIND_TCB_GREG_END + 2*4) +#define WIND_TCB_EXTRA1 (WIND_TCB_GREG_END + 3*4) +#define WIND_TCB_TLBHI (WIND_TCB_GREG_END + 4*4 + 0*_RTypeSize) +#define WIND_TCB_EXTRA2 (WIND_TCB_GREG_END + 4*4 + 1*_RTypeSize) +#define WIND_TCB_EXTRA3 (WIND_TCB_GREG_END + 4*4 + 2*_RTypeSize) +#define WIND_TCB_EXTRA4 (WIND_TCB_GREG_END + 4*4 + 3*_RTypeSize) +#define WIND_TCB_EXTRA5 (WIND_TCB_GREG_END + 4*4 + 4*_RTypeSize) +#define WIND_TCB_EXTRA6 (WIND_TCB_GREG_END + 4*4 + 5*_RTypeSize) +#define WIND_TCB_EXTRA7 (WIND_TCB_GREG_END + 4*4 + 6*_RTypeSize) +#define WIND_TCB_EXTRA8 (WIND_TCB_GREG_END + 4*4 + 7*_RTypeSize) + +#ifndef _ASMLANGUAGE +#if defined(__STDC__) || defined(__cplusplus) + +extern ULONG taskSRInit (ULONG newValue); + +#else /* __STDC__ */ + +extern ULONG taskSRInit (); + +#endif /* __STDC__ */ +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtaskMipsLibh */ diff --git a/h/arch/mips/tx49xxHazards.h b/h/arch/mips/tx49xxHazards.h new file mode 100644 index 0000000..b385486 --- /dev/null +++ b/h/arch/mips/tx49xxHazards.h @@ -0,0 +1,42 @@ +/* tx49xxHazards.h - assembler hazards definitions header file */ + +/* Copyright 1999-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,13sep05,rlg Modified to handle tx49xx hazards +*/ + +/* These hazard macros are intended for use with MIPS architecture- + * dependent assembly files which require handling hazards. + * These macros support the tx4938 core + * This file is included by the asmMips.h file when the HAZARD_FILE macro + * is defined using + * #define HAZARD_FILE + */ + +#ifndef __INCtx49xxHazardsh +#define __INCtx49xxHazardsh + +#define SINGLE_ISSUE 0 +#define DUAL_ISSUE 1 +#define CPU_CYCLES DUAL_ISSUE + +/* Using the issue mechanism definitions above, the MIPS CPU cycles + * are defined below. + */ + +#define ssnop .word 0x00000040 + +/* Hazard macros */ +#define HAZARD_TLB ssnop; ssnop; ssnop; ssnop; sync +#define HAZARD_ERET ssnop; ssnop; ssnop; ssnop +#define HAZARD_CP_READ ssnop; ssnop +#define HAZARD_CP_WRITE ssnop; ssnop; ssnop; ssnop +#define HAZARD_CACHE_TAG ssnop; ssnop +#define HAZARD_CACHE ssnop; ssnop; ssnop; ssnop +#define HAZARD_INTERRUPT ssnop; ssnop; ssnop; ssnop + +#endif /* __INCtx49xxHazardsh */ + diff --git a/h/arch/ppc/403gaSerial.h b/h/arch/ppc/403gaSerial.h new file mode 100644 index 0000000..9c5385f --- /dev/null +++ b/h/arch/ppc/403gaSerial.h @@ -0,0 +1,122 @@ +/* 403gaSerial.h - 403ga on chip serial i/o header */ + +/* Copyright 1984-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,02feb95,yao added _SPLS_RX_ERR. +01a,02sep94,yao written. +*/ + +#ifndef __INC403gaSerialh +#define __INC403gaSerialh + +#ifdef __cplusplus +extern "C" { +#endif + +/* memory mapped i/o registers */ + +#define _PPC403GA_SPLS 0x40000000 /* line status register read/clear */ +#define _PPC403GA_SPHS 0x40000002 /* handshake status register r/clear */ +#define _PPC403GA_BRDH 0x40000004 /* baudrate divisor high reg r/w */ +#define _PPC403GA_BRDL 0x40000005 /* baudrate divisor low reg r/w */ +#define _PPC403GA_SPCTL 0x40000006 /* control register r/w */ +#define _PPC403GA_SPRC 0x40000007 /* receiver command register r/w */ +#define _PPC403GA_SPTC 0x40000008 /* transmitter command register r/w */ +#define _PPC403GA_SPRB 0x40000009 /* receive buffer r */ +#define _PPC403GA_SPTB 0x40000009 /* transmit buffer w */ + +/* masks and definitions for serial port control register */ + +#define _SPCTL_LM_MASK 0xc0 /* loop back modes */ +#define _SPCTL_DTR_MASK 0x20 /* data terminal ready 0-inactive */ +#define _SPCTL_RTS_MASK 0x10 /* request to send 0-inactive */ +#define _SPCTL_DB_MASK 0x08 /* data bits mask */ +#define _SPCTL_PE_MASK 0x04 /* parity enable */ +#define _SPCTL_PTY_MASK 0x02 /* parity */ +#define _SPCTL_SB_MASK 0x01 /* stop bit mask */ + +#define _SPCTL_LM_NORM 0x00 /* normal operation */ +#define _SPCTL_LM_LOOP 0x40 /* internal loopback mode */ +#define _SPCTL_LM_ECHO 0x80 /* automatic echo mode */ +#define _SPCTL_LM_RES 0xc0 /* reserved */ + +#define _SPCTL_DTR_ACTIVE _SPCTL_DTR_MASK /* DTR is active */ +#define _SPCTL_RTS_ACTIVE _SPCTL_RTS_MASK /* RTS is active */ +#define _SPCTL_DB_8_BITS _SPCTL_DB_MASK /* 8 data bits */ +#define _SPCTL_DB_7_BITS 0x00 /* 7 data bits */ +#define _SPCTL_PE_ENABLE _SPCTL_PE_MASK /* parity enabled */ +#define _SPCTL_PTY_EVEN 0x00 /* even parity */ +#define _SPCTL_PTY_ODD _SPCTL_PTY_MASK /* odd parity */ +#define _SPCTL_SB_1_BIT 0x00 /* one stop bit */ +#define _SPCTL_SB_2_BIT _SPCTL_SB_MASK /* two stop bit */ + +/* serial port handshake register */ + +#define _SPHS_DIS_MASK 0x80 /* DSR input inactive error mask */ +#define _SPHS_CS_MASK 0x40 /* CTS input inactive error mask */ +#define _SPHS_DIS_ACT 0x00 /* dsr input is active */ +#define _SPHS_DIS_INACT _SPHS_DIS_MASK /* dsr input is inactive */ +#define _SPHS_CS_ACT 0x00 /* cts input is active */ +#define _SPHS_CS_INACT _SPHS_CS_MASK /* cts input is active */ + +/* serial port line status register */ + +#define _SPLS_RBR_MASK 0x80 /* receive buffer ready mask */ +#define _SPLS_FE_MASK 0x40 /* framing error */ +#define _SPLS_OE_MASK 0x20 /* overrun error */ +#define _SPLS_PE_MASK 0x10 /* parity error */ +#define _SPLS_LB_MASK 0x08 /* line break */ +#define _SPLS_TBR_MASK 0x04 /* transmit buffer ready */ +#define _SPLS_TSR_MASK 0x02 /* transmit shift register ready */ + +#define _SPLS_RBR_FULL _SPLS_RBR_MASK /* receive buffer is full */ +#define _SPLS_FE_ERROR _SPLS_FE_MASK /* framing error detected */ +#define _SPLS_OE_ERROR _SPLS_OE_MASK /* overrun error detected */ +#define _SPLS_PE_ERROR _SPLS_PE_MASK /* parity error detected */ +#define _SPLS_LB_BREAK _SPLS_LB_MASK /* line break detected */ +#define _SPLS_TBR_EMPTY _SPLS_TBR_MASK /* transmit buffer is ready */ +#define _SPLS_TSR_EMPTY _SPLS_TSR_MASK /* transmit shift register is empty */ + +#define _SPLS_RX_ERR (_SPLS_LB_BREAK | _SPLS_FE_MASK | _SPLS_OE_MASK | \ + _SPLS_PE_MASK) + +/* serial port reciever command register */ + +#define _SPRC_ER_MASK 0x80 /* enable receiver mask */ +#define _SPRC_DME_MASK 0x60 /* dma mode */ +#define _SPRC_EIE_MASK 0x10 /* error interrupt enable mask */ +#define _SPRC_PME_MASK 0x08 /* pause mode mask */ + +#define _SPRC_ER_ENABLE _SPRC_ER_MASK /* receiver enabled */ +#define _SPRC_DME_DISABLE 0x00 /* dma disabled */ +#define _SPRC_DME_RXRDY 0x20 /* dma disabled, RxRDY interrupt enabled */ +#define _SPRC_DME_ENABLE2 0x40 /* dma enabled,receiver src channel 2 */ +#define _SPRC_DME_ENABLE3 0x60 /* dma enabled,receiver src channel 3 */ +#define _SPRC_PME_HARD _SPRC_PME_MASK /* RTS controlled by hardware */ +#define _SPRC_PME_SOFT 0x00 /* RTS controlled by software */ + +/* serial port transmit command register */ + +#define _SPTC_ET_MASK 0x80 /* transmiter enable mask */ +#define _SPTC_DME_MASK 0x60 /* dma mode mask */ +#define _SPTC_TIE_MASK 0x10 /* empty interrupt enable mask */ +#define _SPTC_EIE_MASK 0x08 /* error interrupt enable mask */ +#define _SPTC_SPE_MASK 0x04 /* stop/pause mask */ +#define _SPTC_TB_MASK 0x02 /* transmit break mask */ + +#define _SPTC_ET_ENABLE _SPTC_ET_MASK /* transmiter enabled */ +#define _SPTC_DME_DISABLE 0x00 /* transmiter disabled, TBR intr disabled */ +#define _SPTC_DME_TBR 0x20 /* transmiter disabled, TBR intr enabled */ +#define _SPTC_DME_CHAN_2 0x40 /* dma enabled, destination chann 2 */ +#define _SPTC_DME_CHAN_3 0x60 /* dma enabled, destination chann 3 */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INC403gaSerialh */ + diff --git a/h/arch/ppc/altivecPpcLib.h b/h/arch/ppc/altivecPpcLib.h new file mode 100644 index 0000000..2f42d1f --- /dev/null +++ b/h/arch/ppc/altivecPpcLib.h @@ -0,0 +1,86 @@ +/* altivecPpcLib.h - PowerPC Altivec coprocessor support library header */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01c,21feb05,asa Fix SPR#102393: removed #if def 0 around altivec register tables + updated copyright to 2005. + removed if def(__STDC__) || def(__cplusplus) false branch +01b,04oct01,yvp Fix SPR69306: Changed Altivec context pointer from spare4 to + pCoprocCtx. +01a,29mar01,pcs Implement code review suggestions. +*/ + +#ifndef __INCaltivecPpcLibh +#define __INCaltivecPpcLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + +#define VRSAVE_REG 256 /* VRSAVE Register */ + +/* Altivec exceptions */ + +#define _EXC_ALTIVEC_UNAVAILABLE 0xF20 /* altivec unavailable */ +#define _EXC_ALTIVEC_ASSIST 0x1600 /* altivec assist */ + + +/* number of floating-point data registers */ + +#define ALTIVEC_NUM_REGS 32 + +#ifndef _ASMLANGUAGE + +typedef UINT32 VEC_REG[4]; /* 128 bit vector register */ + +typedef struct altivecContext + { + VEC_REG vrfile[ALTIVEC_NUM_REGS]; /* VRFILE: 32 Vector Registers */ + UINT32 vscr[4]; /* VSCR: vec status and control reg */ + UINT32 vrsave; /* VRSAVE: SPR 256 */ + UINT32 pad1; /* pad to 16 byte boundary. */ + UINT32 pad2; + UINT32 pad3; + } ALTIVEC_CONTEXT; + + +#define ALTIVECREG_SET ALTIVEC_CONTEXT + + +#define ALTIVEC_CONTEXT_GET(pTcb) (ALTIVEC_CONTEXT *)(pTcb->pCoprocCtx) +#define ALTIVEC_CONTEXT_SET(pTcb,X) (pTcb->pCoprocCtx=(int)(X)) + +/* variable declarations */ +extern REG_INDEX altivecRegName[]; /* altivec data register table */ +extern REG_INDEX altivecCtlRegName[]; /* altivec control register table */ + +extern WIND_TCB *pAltivecTaskIdPrevious; /* task id for deferred exceptions */ +extern FUNCPTR altivecCreateHookRtn; /* arch dependent create hook routine */ +extern FUNCPTR altivecDisplayHookRtn; /* arch dependent display routine */ + +/* function declarations */ + +IMPORT void altivecArchInit (void); +IMPORT void altivecArchTaskCreateInit (ALTIVEC_CONTEXT *pAltivecContext); + + + +#endif /* _ASMLANGUAGE */ + +/* define offsets in ALTIVEC_CONTEXT structure */ + +#define AVX 0x0 +#define AVX_OFFSET(n) (AVX + (n)*16) +#define VSCR_OFFSET (AVX + (ALTIVEC_NUM_REGS)*16) /* offset == 0x200 */ +#define VRSAVE_OFFSET (VSCR_OFFSET + 16) /* offset == 0x210 */ +#define AVCONTEXT_SIZE 16*(ALTIVEC_NUM_REGS + 2) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCaltivecPpcLibh */ diff --git a/h/arch/ppc/archPpc.h b/h/arch/ppc/archPpc.h new file mode 100644 index 0000000..eeff829 --- /dev/null +++ b/h/arch/ppc/archPpc.h @@ -0,0 +1,334 @@ +/* archPpc.h - PowerPC specific header */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. +*/ + +/* +modification history +-------------------- +02j,11apr05,kk removed _WRS_OBJLIB_SUPPORT_VERIFY_TRAP macro (SPR# 106486) +02i,10feb05,pch SPR 102772: add _ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK +02h,22apr04,to define RFI only for _ASMLANGUAGE +02g,18mar04,rec merge in PPC970 changes +02f,01nov04,pch SPR 92598: Add _WRS_OSM_INIT +02e,01oct04,tam moved definition of _TYPE_PHYS_ADDR from shared file to + kernel header +02d,23aug04,aeg added _WRS_OBJLIB_SUPPORT_VERIFY_TRAP +02c,11aug04,pch cleanup +02b,11may04,tam removed _WRS_KERNEL_TEXT_START_ADRS definition +02a,22mar04,zl moved trcLib_PORTABLE and INSTR definitions to archPpcCommon.h; + added _WRS_FRAMEP_FROM_JMP_BUF and _WRS_RET_PC_FROM_JMP_BUF. +01z,18feb04,zl defined trcLib_PORTABLE +01y,03feb04,aeg moved _WRS_PAL_COPROC_LIB to archPpcCommon.h +01x,27jan04,gls moved _TYPE_PHYS_ADDR definition to archPpcCommon.h +01w,18dec03,dat temp fix for va_addr macro +01v,14nov03,job Moved some blib stuff to archPpcCommon.h + Added missing include of archPpcCommon.h +01u,13nov03,pes Added include of archPpcCommon.h +01t,14oct03,sru define 64-bit PHYS_ADDR type +01s,10sep03,cjj removed dual definition of _WRS_ENABLE_IDLE_INTS +01r,23apr03,pch Add generic PPC32 support +01r,07may03,pes More conditional compilation cleanups. +01q,02may03,pes PAL conditional compilation cleanup. +01p,11apr03,pes Add define to trigger PAL Coprocessor Abstraction +01o,09jul03,tam added macro _WRS_KERNEL_TEXT_START_ADRS +01q,03dec02,mil Removed inclusion of ppc603.h for PPC85XX. +01p,04sep02,dtr Adding 85XX header file. +01o,02aug02,pcs Add support for PPC85XX and make it the same as PPC603 for + the present. +01n,13mar02,sn SPR 73723 - define supported toolchains +01m,25sep01,yvp SPR62760 fix: Added default text segment alignment. +01l,14aug01,pch Add PPC440 support +01k,25oct00,s_m renamed PPC405 cpu types +01j,12jun00,alp Added PPC405 support +01i,12mar99,zl added PPC509 and PPC555 support. +01h,18aug98,tpr added PowerPC EC 603 support. +01g,10feb97,tam added FPSCR bit definition macros. +01f,08oct96,tam added MSR bit definition macros. +01e,11apr96,tpr added PPC505, PPC602 and PPC860. +01d,14feb96,tpr added PPC604. +01c,21mar95,caf moved _STACK_ALIGN_SIZE to toolPpc.h. +01b,07nov94,yao changed PPC403GA to PPC403. +01a,17mar94,yao written. +*/ + +#ifndef __INCarchPpch +#define __INCarchPpch + +#ifdef __cplusplus +extern "C" { +#endif + +#define _ARCH_SUPPORTS_GCC +#define _ARCH_SUPPORTS_DCC + +#if (CPU != PPC403) +/* Used in usrDepend.c and usrKernelStack.c */ +#define _ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK +#endif /* PPC403 */ + +#if (CPU != PPC32) +/* upper Machine State Register (MSR) mask */ + +#define _PPC_MSR_SF_U 0x8000 /* sixty-four bit mode (not + * implemented for 32-bit machine) */ +#define _PPC_MSR_POW_U 0x0004 /* power managemnet enable */ +#define _PPC_MSR_ILE_U 0x0001 /* little endian mode */ + +/* lower Machine State Register (MSR) mask */ + +#define _PPC_MSR_EE 0x8000 /* external interrupt enable */ +#define _PPC_MSR_PR 0x4000 /* privilege level */ +#define _PPC_MSR_FP 0x2000 /* floating-point available */ +#define _PPC_MSR_ME 0x1000 /* machine check enable */ +#define _PPC_MSR_FE0 0x0800 /* floating-point exception mode 0 */ +#define _PPC_MSR_SE 0x0400 /* single-step trace enable */ +#define _PPC_MSR_BE 0x0200 /* branch trace enable */ +#define _PPC_MSR_FE1 0x0100 /* floating-point exception mode 1 */ +#define _PPC_MSR_IP 0x0040 /* exception prefix */ +#define _PPC_MSR_IR 0x0020 /* instruction address translation */ +#define _PPC_MSR_DR 0x0010 /* data address translation */ +#define _PPC_MSR_RI 0x0002 /* recoverable interrupt */ +#define _PPC_MSR_LE 0x0001 /* little-endian mode */ + +#define _PPC_MSR_POWERUP 0x0040 /* state of MSR at powerup */ + +/* MSR bit definitions common to all PPC arch. */ + +#define _PPC_MSR_BIT_EE 16 /* MSR Ext. Intr. Enable bit - EE */ +#define _PPC_MSR_BIT_PR 17 /* MSR Privilege Level bit - PR */ +#define _PPC_MSR_BIT_ME 19 /* MSR Machine Check Enable bit - ME */ +#define _PPC_MSR_BIT_LE 31 /* MSR Little Endian mode bit - LE */ + +/* FPSCR bit definitions (valid for the PPC60X familly) */ + +#define _PPC_FPSCR_FX 0x80000000 /* FP exception summary */ +#define _PPC_FPSCR_FEX 0x40000000 /* FP enabled exception summary */ +#define _PPC_FPSCR_VX 0x20000000 /* FP invalid exception summary */ +#define _PPC_FPSCR_OX 0x10000000 /* FP overflow exception */ +#define _PPC_FPSCR_UX 0x08000000 /* FP underflow exception */ +#define _PPC_FPSCR_ZX 0x04000000 /* FP divide by zero exception */ +#define _PPC_FPSCR_XX 0x02000000 /* FP inexact exception */ +#define _PPC_FPSCR_VXSNAN 0x01000000 /* FP invalid exception for SNAN */ +#define _PPC_FPSCR_VXISI 0x00800000 /* FP invalid exc. for INF-INF */ +#define _PPC_FPSCR_VXIDI 0x00400000 /* FP invalid exc. for INF/INF */ +#define _PPC_FPSCR_VXZDZ 0x00200000 /* FP invalid exc. for 0/0 */ +#define _PPC_FPSCR_VXIMZ 0x00100000 /* FP invalid exc. for INF*0 */ +#define _PPC_FPSCR_VXVC 0x00080000 /* FP inval. exc. for invalid comp.*/ +#define _PPC_FPSCR_FR 0x00040000 /* FP fraction rounded */ +#define _PPC_FPSCR_FI 0x00020000 /* FP fraction inexact */ +#define _PPC_FPSCR_FPRF 0x0001F000 /* FP result flags */ +#define _PPC_FPSCR_VXSOFT 0x00000400 /* FP inval. exc. for soft. request*/ +#define _PPC_FPSCR_VXSQRT 0x00000200 /* FP inval. exc. for sqrt */ +#define _PPC_FPSCR_VXCVI 0x00000100 /* FP inval. exc. for int convert */ +#define _PPC_FPSCR_VE 0x00000080 /* FP invalid exc. enable */ +#define _PPC_FPSCR_OE 0x00000040 /* FP overflow exc. enable */ +#define _PPC_FPSCR_UE 0x00000020 /* FP underflow exc. enable */ +#define _PPC_FPSCR_ZE 0x00000010 /* FP divide by zero exc. enable */ +#define _PPC_FPSCR_XE 0x00000008 /* FP iinexact exc. enable */ +#define _PPC_FPSCR_NI 0x00000004 /* FP non-IEEE mode enable */ +#define _PPC_FPSCR_RN(n) (n) /* FP rounding control value */ + +#define _PPC_FPSCR_RN_MSK 0x00000003 /* FP rounding control bits mask */ +#define _PPC_FPSCR_EXC_MASK 0x1ff80700 /* FP exception status bits mask */ +#define _PPC_FPSCR_CTRL_MASK 0x000000ff /* FP exception control bits mask */ + +/* FPSCR init value for tasks spawned with VX_FP_TASK (PPC60X only) */ + +#define _PPC_FPSCR_INIT (_PPC_FPSCR_OE | _PPC_FPSCR_UE | _PPC_FPSCR_ZE \ + | _PPC_FPSCR_RN(0)) +#endif /* CPU != PPC32 */ + +#ifndef _ASMLANGUAGE +typedef unsigned int _RType; /* default register type */ + +/* macros for getting frame and return PC from a jmp_buf */ + +#define _WRS_FRAMEP_FROM_JMP_BUF(env) ((char *) (env)[0].reg.spReg) +#define _WRS_RET_PC_FROM_JMP_BUF(env) ((INSTR *) (env)[0].reg.lr) + +/* physical addresses are represented on 64-bit for all PowerPC CPUs */ + +#define _TYPE_PHYS_ADDR typedef UINT64 PHYS_ADDR +#endif /* _ASMLANGUAGE */ + +#define _WRS_PHYS_ADDR_IS_64_BITS + +#define _ARCH_MULTIPLE_CACHELIB FALSE + +#define _DYNAMIC_BUS_SIZING FALSE /* require alignment for swap */ + +#define _PPC_REG_SIZE 4 /* default register size */ + +#define _PPC_TEXT_SEG_ALIGN 4 /* 4 byte text segment alignment */ + +#ifdef _ASMLANGUAGE +#define RFI rfi +#endif /* _ASMLANGUAGE */ + +#define RFI_OPCODE 0x4c000064 + +/* PAL additions */ + +/* moved here from h/private/eventP.h */ + +/* + * Macro for event logging of intEnt events for PPC architechtures. + * The PPC architecture is different in that there is only one external + * interrupt line coming into the CPU. At the time of the intEnt, the + * external interrupt number is unknown, meaning that logging cannot + * take place at this time. In this architechture, the logging of an + * intEnt event is deferred until the interrupt controller driver + * is exectued. + * Since the logging has to take place in drivers and/or BSP world files, + * the details of how the logging to be done has been deferred to a macro + * which is defined here. + * + * Note: This replaces the previous technique of saving the timestamp + * during the intEnt code to be used later, when the logging was done. + * SPR 21868 refers to a problem in which this can give rise to out-of-order + * timestamps in the event log. + */ +#define WV_EVT_INT_ENT(intNum) EVT_CTX_0(EVENT_INT_ENT((UINT32)intNum)) + + + +/* moved here from h/private/javaLibP.h */ + +#define JAVA_C_SYM_PREFIX "" + +/* moved here from h/private/loadElfLibP.h */ + +#define LOW24_INSERT(buf,value) INSERT ((buf), (value), 0x03fffffc) + +/* define to pick up sysI/O function declarations in sysLib.h */ + +#define _WRS_SYS_IO + +/* define to insert the evtLogT1_noTS() function into evtLogLib.c */ + +#define _WRS_EVTLOGT1_NOTS + +/* temp fix for va_addr support (See SPR 92721) */ + +#define _WRS_VA_ADDR(x) ((va_list *)x) + +/* from bootElfLib.c */ + +#define _WRS_CHECK_MACHINE_TYPE \ + if (pHdr->e_machine != EM_ARCH_MACHINE && pHdr->e_machine != EM_ARCH_MACH_ALT) \ + return (ERROR) + +/* from loadElfLib.c */ + +#define _WRS_USE_ELF_LOAD_FORMAT + +/* from xdr_float.c */ + +#define FLOAT_NORM + +/* from qPriBMapLib.c */ + +#define qPriBMapLib_PORTABLE + +/* from bLib.c */ + +#define _WRS_BLIB_OPTIMIZED +#define _WRS_SWAB_OPTIMIZED + +/* from schedLib.c */ + +#define _WRS_TASK_MSR_DEFAULT +#define _WRS_VXLIB_SUPPORT + +/* temporary macro to ensure PPC uses the new scheduling algorithm */ +#define _WRS_BASE6_SCHEDULER + +/* used by reschedule() when the kernel is idle */ +#define _WRS_ENABLE_IDLE_INTS {intUnlock (taskMsrDefault);} + +/* PPC arch always requires OSM init if stack guard pages are enabled */ + +#define _WRS_OSM_INIT + +/* End PAL */ + +#if (CPU == PPC32) +#include "ppc32.h" +#endif /* CPU == PPC32) */ + +#if (CPU == PPC403) +#include "ppc403.h" +#endif /* CPU == PPC403) */ + +#if ((CPU == PPC405) || (CPU == PPC405F)) +#include "ppc405.h" +#endif /* CPU == PPC405) || (CPU == PPC405F) */ + +#if (CPU == PPC440) +#include "ppc440.h" +#endif /* CPU == PPC440 */ + +#if (CPU == PPC509) +#include "ppc509.h" +#endif /* CPU == PPC509) */ + +#if (CPU == PPC555) +#include "ppc555.h" +#endif /* CPU == PPC555) */ + +#if (CPU == PPC601) +#include "ppc601.h" +#endif /* CPU == PPC601) */ + +#if (CPU == PPC602) +#include "ppc602.h" +#endif /* CPU == PPC602) */ + +#if ((CPU == PPC603) || (CPU == PPCEC603)) +#include "ppc603.h" +#endif /* ((CPU == PPC603) || (CPU == PPCEC603)) */ + +#if (CPU == PPC85XX) +#include "ppc85xx.h" +#endif /* CPU == PPC85XX */ + +#if (CPU == PPC604) +#include "ppc604.h" +#endif /* CPU == PPC604) */ + +#if (CPU == PPC860) +#include "ppc860.h" +#endif /* CPU == PPC860) */ + +#if (CPU == PPC970) +#include "ppc970.h" +#endif /* CPU == PPC970 */ + +/* + * Use constant size if known (when building for a specific CPU type) + * else fetch from a global variable (when building for generic PPC32) + */ +#undef _CACHE_ALIGN_SIZE +#ifdef _CPU_CACHE_ALIGN_SIZE +#define _CACHE_ALIGN_SIZE _CPU_CACHE_ALIGN_SIZE +#else /* _CPU_CACHE_ALIGN_SIZE */ +# ifndef _ASMLANGUAGE +# define _CACHE_ALIGN_SIZE _ppcCacheLineSize + extern int _ppcCacheLineSize; +# endif /* _ASMLANGUAGE */ +#endif /* _CPU_CACHE_ALIGN_SIZE */ + +#include "arch/ppc/archPpcCommon.h" + +#include "toolPpc.h" +#ifdef __cplusplus +} +#endif + +#endif /* __INCarchPpch */ diff --git a/h/arch/ppc/archPpcCommon.h b/h/arch/ppc/archPpcCommon.h new file mode 100644 index 0000000..6858900 --- /dev/null +++ b/h/arch/ppc/archPpcCommon.h @@ -0,0 +1,49 @@ +/* archPpcCommon.h - common Ppc architecture specific header */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,01oct04,tam moved definition of _TYPE_PHYS_ADDR to the kernel + architecture scpecific header +01e,22mar04,zl moved trcLib_PORTABLE and INSTR definitions here. +01d,03feb04,aeg added _WRS_PAL_COPROC_LIB from archPpc.h +01c,27jan04,gls added definition of _TYPE_PHYS_ADDR +01b,12nov03,job Moved some blib stuff from archPpc.h +01a,11nov03,pes written. +*/ + +#ifndef __INCarchPpcCommonh +#define __INCarchPpcCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +/* from bLib.c */ + +#define _WRS_BLIB_ALIGNMENT 3 /* quad byte alignment mask */ + +/* from archPpc.h */ + +/* Enable Coprocessor Abstraction. For PPC32, must do all or none. */ + +#define _WRS_PAL_COPROC_LIB + +/* from trcLib.c */ + +#define trcLib_PORTABLE + +/* moved here from h/types/vxTypesOld.h */ + +#ifndef _ASMLANGUAGE +typedef unsigned long INSTR; /* 32 bit word-aligned instructions */ +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCarchPpcCommonh */ + diff --git a/h/arch/ppc/asmPpc.h b/h/arch/ppc/asmPpc.h new file mode 100644 index 0000000..1b909e0 --- /dev/null +++ b/h/arch/ppc/asmPpc.h @@ -0,0 +1,149 @@ +/* asmPpc.h - PowerPC assembler definitions header file */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01u,01nov04,pch SPR 83004: move SPRG[4-7] definitions from asmPpc.h to ppc405.h +01t,10dec03,pch TEMPORARY HACK for msync/mbar in PPC440gnu +01s,03dec03,jtp Add MMU_MASK operation +01r,09sep03,yvp Removed definition of the SYSCALL_PROLOG macro. +01q,03sep03,yvp Added system call trap stub definition. +01p,12dec02,pch Add generic PPC32 support +01o,26mar02,pcs Add defines for I & D BAT's 4-7. +01n,02may01,pch Documentation cleanup +01m,25oct00,s_m renamed PPC405 cpu types +01l,12jun00,alp Added PPC405 Support +01k,18mar97,tam made INT_MASK definition conditional. +01j,08apr96,tpr move implementation specific definition in ppcXXX.h. +01i,04mar96,tam added some SPR definitions for the PPC403. +01h,26feb96,kkk added HID0 for PPC601. +01g,14feb96,tpr added PPC604 support. +01f,09feb95,yao added RFCI, MTBESR_P0 macro for PPC403. +01e,30jan95,yao added DBCR for PPC403. fixed mtdcr macros for PPC403. +01d,06jan95,vin corrected HID0 (was 8, now 1008). +01c,15nov94,caf moved register defines to toolPpc.h. +01b,04nov94,yao changed PPC403GA to PPC403. moved tool related macros + to tools.h. +01a,25may94,yao written. +*/ + +#ifndef __INCasmPpch +#define __INCasmPpch + +#ifdef __cplusplus +extern "C" { +#endif + +/* TEMPORARY HACK for msync/mbar in PPC440gnu */ +#if (CPU == PPC440 && defined(_GNU_TOOL)) +#define msync sync +#define mbar eieio +#endif + +/* special purpose register encoding */ + +#define XER 1 /* external exception register */ +#define LR 8 /* link register (return address) */ +#define CTR 9 /* counter register */ + +#if (CPU != PPC32) +#define DSISR 18 /* data storage interrupt status */ +#define DAR 19 /* data address register */ +#define DEC 22 /* decrement register */ +#define SDR1 25 /* storage description register 1 */ +#endif /* CPU != PPC32 */ + +#define SRR0 26 /* save and restore register 0 */ +#define SRR1 27 /* save and restore register 1 */ + +#define SPRG0 272 /* software program register 0 */ +#define SPRG1 273 /* software program register 1 */ +#define SPRG2 274 /* software program register 2 */ +#define SPRG3 275 /* software program register 3 */ + +#if (CPU != PPC32) +#define ASR 280 /* address space register + * (64 bit implementation only) */ +#define EAR 282 /* external address register */ + +#define TBL 284 /* lower time base register */ +#define TBU 285 /* upper time base register */ +#endif /* CPU != PPC32 */ + +#define PVR 287 /* processor version register */ + +#if (CPU != PPC32) +#define IBAT0U 528 /* instruction BAT register */ +#define IBAT0L 529 /* instruction BAT register */ +#define IBAT1U 530 /* instruction BAT register */ +#define IBAT1L 531 /* instruction BAT register */ +#define IBAT2U 532 /* instruction BAT register */ +#define IBAT2L 533 /* instruction BAT register */ +#define IBAT3U 534 /* instruction BAT register */ +#define IBAT3L 535 /* instruction BAT register */ + +#define DBAT0U 536 /* data BAT register */ +#define DBAT0L 537 /* data BAT register */ +#define DBAT1U 538 /* data BAT register */ +#define DBAT1L 539 /* data BAT register */ +#define DBAT2U 540 /* data BAT register */ +#define DBAT2L 541 /* data BAT register */ +#define DBAT3U 542 /* data BAT register */ +#define DBAT3L 543 /* data BAT register */ + +#define IBAT4U 560 /* instruction BAT register */ +#define IBAT4L 561 /* instruction BAT register */ +#define IBAT5U 562 /* instruction BAT register */ +#define IBAT5L 563 /* instruction BAT register */ +#define IBAT6U 564 /* instruction BAT register */ +#define IBAT6L 565 /* instruction BAT register */ +#define IBAT7U 566 /* instruction BAT register */ +#define IBAT7L 567 /* instruction BAT register */ + +#define DBAT4U 568 /* data BAT register */ +#define DBAT4L 569 /* data BAT register */ +#define DBAT5U 570 /* data BAT register */ +#define DBAT5L 571 /* data BAT register */ +#define DBAT6U 572 /* data BAT register */ +#define DBAT6L 573 /* data BAT register */ +#define DBAT7U 574 /* data BAT register */ +#define DBAT7L 575 /* data BAT register */ +#endif /* CPU != PPC32 */ + +#define BO_dCTR_NZERO_AND_NOT 0 +#define BO_dCTR_ZERO_AND_NOT 2 +#define BO_IF_NOT 4 +#define BO_dCTR_ZERO_AND 10 +#define BO_IF 12 +#define BO_dCTR_NZERO 16 +#define BO_dCTR_ZERO 18 +#define BO_ALWAYS 20 +#define CR0_LT 8 + +#if (CPU != PPC32) +/* macros to mask one bit off using rotate left word immediate then and + * with mask instruction by setting SH to zero, MB to n+1, ME to n-1. */ + +#ifndef INT_MASK +#define INT_MASK(src, des) rlwinm des, src, 0, 17, 15 +#endif /* INT_MASK */ + +#ifndef MMU_MASK +#define MMU_MASK(src, des) rlwinm des, src, 0, 28, 25 +#endif /* MMU_MASK */ + +#define RI_MASK(src, des) rlwinm des, src, 0, 31, 29 + +#define SE_MASK(src, des) rlwinm des, src, 0, 22, 20 + +#define IC_MASK(src, des) rlwinm des, src, 0, 5, 3 +#endif /* CPU != PPC32 */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCasmPpch */ diff --git a/h/arch/ppc/cachePpcLib.h b/h/arch/ppc/cachePpcLib.h new file mode 100644 index 0000000..eb2d966 --- /dev/null +++ b/h/arch/ppc/cachePpcLib.h @@ -0,0 +1,38 @@ +/* cachePpcLib.h - PowerPC cache library header file */ + +/* Copyright 1984-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,14oct04,mil Changed CACHE_FLUSH_LOAD_INIT value. +01b,27sep04,dtr Add some global defines. SPR 100373 +01a,06nov96,tpr added CACHE_CMD_XXX macros for PPC860. +*/ + +#ifndef __INCcachePpcLibh +#define __INCcachePpcLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + +#define CACHE_CMD_ENABLE 0x02000000 /* Enable the cache */ +#define CACHE_CMD_DISABLE 0x04000000 /* Disable the cache */ +#define CACHE_CMD_LOAD_LOCK 0x06000000 /* Load and Lock */ +#define CACHE_CMD_UNLOCK_LINE 0x08000000 /* Unlock a cache line */ +#define CACHE_CMD_UNLOCK_ALL 0x0a000000 /* Unlock all the cache */ +#define CACHE_CMD_INVALIDATE 0x0c000000 /* Invalidate all the cache */ + + +#define CACHE_FLUSH_LOAD_ADRS 0x10000 /* default address */ +#define CACHE_FLUSH_LOAD_INIT (CACHE_FLUSH_LOAD_ADRS + _CPU_CACHE_ALIGN_SIZE) + /* initial magic value */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcachePpcLibh */ diff --git a/h/arch/ppc/compilerError2704 b/h/arch/ppc/compilerError2704 new file mode 100644 index 0000000..e69de29 diff --git a/h/arch/ppc/compilerError4804 b/h/arch/ppc/compilerError4804 new file mode 100644 index 0000000..e69de29 diff --git a/h/arch/ppc/coprocPpc.h b/h/arch/ppc/coprocPpc.h new file mode 100644 index 0000000..7c33767 --- /dev/null +++ b/h/arch/ppc/coprocPpc.h @@ -0,0 +1,35 @@ +/* coprocPpc.h - coprocessor management library header */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,23jan04,dtr Adding in SPE support. +01b,04feb04,aeg removed include of altivecLib.h +01a,?????03,??? written. +*/ + +#ifndef __INCcoprocPpch +#define __INCcoprocPpch + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "taskLib.h" + +/* defines */ + +#define VX_FP_TASK VX_COPROC1_TASK +#define VX_ALTIVEC_TASK VX_COPROC2_TASK +#define VX_SPE_TASK VX_COPROC3_TASK + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcoprocPpch */ diff --git a/h/arch/ppc/dbgPpcLib.h b/h/arch/ppc/dbgPpcLib.h new file mode 100644 index 0000000..62c1ff0 --- /dev/null +++ b/h/arch/ppc/dbgPpcLib.h @@ -0,0 +1,340 @@ +/* dbgPpcLib.h - header file for arch dependent portion of debugger */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01r,28mar05,dtr Add support for 83xx and g2le +01q,25feb05,pch handle PPC970 hardware breakpoints +01p,11feb04,elg Add syscall instruction size macro. +01o,09feb04,elg Remove DBG_SYSCALL_CHECK() definition. +01n,13jan04,elg Add system call check support. +01o,02dec02,mil Updated support for PPC85XX. +01n,02aug02,pcs Add support for PPC85XX and make it the same as PPC603 for + the present. +01m,14mar02,pch SPR 74270: make 440 bh types consistent with 5xx/604/860 +01l,23aug01,pch Separate PPC440 from PPC405, cleanup. +01k,16aug01,pch Add PPC440 support +01j,30oct00,s_m separated PPC405 support from PPC403 +01i,27oct00,s_m updated for CPU == PPC405F +01h,25oct00,s_m renamed PPC405 cpu types +01g,13jun00,alp Added PPC405 Support +01f,19apr99,zl added support for PPC509 and PPC555 +01e,14oct98,elg added hardware breakpoints for PPC603 and PPC604 +01d,27jul98,elg added hardware breakpoints +01c,24dec97,dbt modified for new breakpoint scheme. +01b,24oct95,kdl added DBG_TRACE=FALSE for PPC403; added mod hist. +01a,14feb95,yao created. +*/ + +#ifndef __INCdbgPpcLibh +#define __INCdbgPpcLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "esf.h" +#include "reg.h" +#ifndef _ASMLANGUAGE +#include "dsmLib.h" +#endif /* _ASMLANGUAGE */ +#include "iv.h" + +#define BREAK_ESF ESFPPC /* XXX */ + +#define DBG_BREAK_INST 0x7fe00008 /* trap 31, 0, 0 */ +#define DBG_SYSCALL_SIZE (sizeof (INSTR) / sizeof (INSTR)) + +#ifndef _PPC_MSR_SE +/* + * Tell generic code it must simulate single-step using breakpoints. + * This setting causes wdbDbgArchLib.c to export wdbDbgGetNpc(), + * and to call wdbDbgTrap() instead of wdbDbgBreakpoint(). + * + * XXX - PPC4xx have no SE bit in MSR, but do provide an "instruction + * XXX - completion" debug event which has a similar effect and could + * XXX - perhaps be used instead of doing this. + */ +#define DBG_NO_SINGLE_STEP 1 /* no trace support */ +#endif /* _PPC_MSR_SE */ + +/* definition for HID1 register for 601 */ +#define HID1_RUN_MODE(x) (((x)&0x70000000)>>28) +#define HID1_RUN_NORM +#define HID1_RUN_UNDEF +#define HID1_RUN_UNDEF + +/* + * Set DBG_HARDWARE_BP for CPUs which support hardware breakpoints, and + * define the breakpoint types. + * + * If defined, BRK_INST will be handled by generic code in wdb/wdbBpLib.c + * and ostool/dbgTaskLib.c. Other breakpoint types are CPU-specific, and + * are used primarily in wdbDbgArchLib.c. The help text and type-display + * code in dbgArchLib.c should also match the definitions here. + * + * BRK_HARDMASK is used to extract the type from bp_flags. It must be + * at least large enough to cover all defined types, and must not overlap + * with BRK_HARDWARE, nor with the flag bits (BP_INSTALLED, BP_HOST, BP_SO, + * BP_STEP, BP_EVENT) defined in wdb/wdbDbgLib.h. + */ + +#if (CPU == PPC509) || (CPU == PPC555) || (CPU == PPC603) || \ + (CPU == PPCEC603) || (CPU == PPC604) || (CPU == PPC860) + +#define DBG_HARDWARE_BP 1 + +#define BRK_INST 0x0 /* hardware instruction breakpoint */ +#define BRK_RW 0x1 /* hardware data breakpoint for read or write */ +#define BRK_READ 0x2 /* hardware data breakpoint for read */ +#define BRK_WRITE 0x3 /* hardware data breakpoint for write */ + +#define DEFAULT_HW_BP BRK_RW /* default hardware breakpoint */ + +#define BRK_HARDWARE 0x10 /* hardware breakpoint bit */ +#define BRK_HARDMASK 0x0f /* hardware breakpoint mask */ + +#elif (CPU == PPC403) + +#define DBG_HARDWARE_BP 1 + +#define BRK_INST 0x0 /* hardware instruction breakpoint */ +#define BRK_DATAW1 0x1 /* data breakpoint for write one byte */ +#define BRK_DATAR1 0x2 /* data breakpoint for read one byte */ +#define BRK_DATARW1 0x3 /* data breakpoint for read/write one byte */ +#define BRK_DATAW2 0x5 /* data breakpoint for write 2 bytes */ +#define BRK_DATAR2 0x6 /* data breakpoint for read 2 bytes */ +#define BRK_DATARW2 0x7 /* data breakpoint for read/write 2 bytes */ +#define BRK_DATAW4 0x9 /* data breakpoint for write 4 bytes */ +#define BRK_DATAR4 0xA /* data breakpoint for read 4 bytes */ +#define BRK_DATARW4 0xB /* data breakpoint for read/write 4 bytes */ +#define BRK_DATAW16 0xD /* data breakpoint for write 16 bytes */ +#define BRK_DATAR16 0xE /* data breakpoint for read 16 bytes */ +#define BRK_DATARW16 0xF /* data breakpoint for read/write 16 bytes */ + +#define DEFAULT_HW_BP BRK_DATAW1 /* default hardware breakpoint */ + +#define BRK_HARDWARE 0x10 /* hardware breakpoint bit */ +#define BRK_HARDMASK 0x0f /* hardware breakpoint mask */ + +#elif ((CPU == PPC405) || (CPU == PPC405F)) + +#define DBG_HARDWARE_BP 1 + +#define BRK_INST 0x0 /* hardware instruction breakpoint */ +#define BRK_DATAW1 0x1 /* data breakpoint for write one byte */ +#define BRK_DATAR1 0x2 /* data breakpoint for read one byte */ +#define BRK_DATARW1 0x3 /* data breakpoint for read/write one byte */ +#define BRK_DATAW2 0x4 /* data breakpoint for write 2 bytes */ +#define BRK_DATAR2 0x5 /* data breakpoint for read 2 bytes */ +#define BRK_DATARW2 0x6 /* data breakpoint for read/write 2 bytes */ +#define BRK_DATAW4 0x7 /* data breakpoint for write 4 bytes */ +#define BRK_DATAR4 0x8 /* data breakpoint for read 4 bytes */ +#define BRK_DATARW4 0x9 /* data breakpoint for read/write 4 bytes */ +#define BRK_DATAW32 0xA /* data breakpoint for write cache line size */ +#define BRK_DATAR32 0xB /* data breakpoint for read 16 bytes */ +#define BRK_DATARW32 0xC /* data breakpoint for read/write 16 bytes */ + +#define DEFAULT_HW_BP BRK_DATAW1 /* default hardware breakpoint */ + +#define BRK_HARDWARE 0x10 /* hardware breakpoint bit */ +#define BRK_HARDMASK 0x0f /* hardware breakpoint mask */ + +#elif ((CPU == PPC440) || (CPU == PPC85XX)) + +#define DBG_HARDWARE_BP 1 + +#define BRK_INST 0x0 /* hardware instruction breakpoint */ +#define BRK_DATARW 0x1 /* data breakpoint for read/write */ +#define BRK_DATAR 0x2 /* data breakpoint for read */ +#define BRK_DATAW 0x3 /* data breakpoint for write */ + +/* XXX - 440 has 4 IAC registers (each pair usable as a range), and + * XXX - 2 DAC registers (usable as a range); also DVC, BRT, ICMP, + * XXX - IRPT, TRAP, and RET events. How much of this to support? + * XXX - ditto to 85XX, which doesn't have IAC3 and IAC4 + */ + +#define DEFAULT_HW_BP BRK_DATAW /* default hardware breakpoint */ + +#define BRK_HARDWARE 0x10 /* hardware breakpoint bit */ +#define BRK_HARDMASK 0x0f /* hardware breakpoint mask */ + +#endif /* 509 555 603 EC603 604 860 : 403 : 405 405F : 440 85XX */ +/* End of hardware breakpoint type definitions */ + +#if DBG_HARDWARE_BP + +#ifndef _ASMLANGUAGE + +/* + * The DBG_REGS structure specifies the values to be + * loaded into the hardware breakpoint registers. + */ +typedef struct + { +#if ((CPU == PPC509) || (CPU == PPC555) || (CPU == PPC860)) + UINT32 cmpa; /* comparator A value register */ + UINT32 cmpb; /* comparator B value register */ + UINT32 cmpc; /* comparator C value register */ + UINT32 cmpd; /* comparator D value register */ + UINT32 counta; /* breakpoint counter value register A */ + UINT32 countb; /* breakpoint counter value register B */ + UINT32 cmpe; /* comparator E value register */ + UINT32 cmpf; /* comparator F value register */ + UINT32 cmpg; /* comparator G value register */ + UINT32 cmph; /* comparator H value register */ + UINT32 lctrl1; /* load/store support comparators control reg */ + UINT32 lctrl2; /* load/store support AND-OR control register */ + UINT32 ictrl; /* instruction support control register */ + UINT32 bar; /* breakpoint address register */ + +#elif CPU == PPC603 || CPU == PPCEC603 || CPU == PPC604 || CPU == PPC970 +# if CPU != PPC970 + UINT32 iabr; /* instruction address breakpoint register */ +# endif /* !PPC_970 */ +# if CPU == PPC604 || CPU == PPC970 + UINT32 dabr; /* data address breakpoint register */ + UINT32 dar; /* data address register */ +# endif /* 604 || 970 */ +#if (defined PPC_83xx || defined (PPC_g2le)) + UINT32 iabr2; + UINT32 ibcr; + UINT32 dabr; + UINT32 dabr2; + UINT32 dbcr; + UINT32 dar; /* data address register */ +#endif /* PPC_83xx | PPC_g2le */ +#elif (CPU == PPC403) + UINT32 dbcr; /* debug control register */ + UINT32 dbsr; /* debug status register */ + UINT32 dac1; /* data address compare register 1 */ + UINT32 dac2; /* data address compare register 2 */ + UINT32 iac1; /* instruction address compare register 1 */ + UINT32 iac2; /* instruction address compare register 2 */ + UINT32 msr; /* machine state register */ +#elif ((CPU == PPC405) || (CPU == PPC405F) || (CPU == PPC440) || \ + (CPU == PPC85XX)) + UINT32 dbcr0; /* debug control register 0 */ + UINT32 dbcr1; /* debug control register 1 */ +# if ((CPU == PPC440) || (CPU == PPC85XX)) + UINT32 dbcr2; /* debug control register 2 */ +# endif /* CPU == PPC440, PPC85XX */ +# if (CPU == PPC440) + UINT32 dbdr; /* debug data register */ +# endif /* CPU == PPC440 */ + UINT32 dbsr; /* debug status register */ + UINT32 dac1; /* data address compare register 1 */ + UINT32 dac2; /* data address compare register 2 */ + UINT32 iac1; /* instruction address compare register 1 */ + UINT32 iac2; /* instruction address compare register 2 */ +# if (CPU != PPC85XX) + UINT32 iac3; /* instruction address compare register 3 */ + UINT32 iac4; /* instruction address compare register 4 */ +# endif /* CPU != PPC85XX */ + UINT32 msr; /* machine state register */ +#endif /* 509 555 860 : 603 EC603 604 : 403 : 405 405F 440 85XX */ + + } DBG_REGS; + +/* Prototypes for hardware breakpoint register access functions */ + +# if ((CPU == PPC509) || (CPU == PPC555) || (CPU == PPC860)) +extern void dbgCmpaSet (int value); +extern void dbgCmpbSet (int value); +extern void dbgCmpcSet (int value); +extern void dbgCmpdSet (int value); +extern void dbgCmpeSet (int value); +extern void dbgCmpfSet (int value); +extern void dbgLctrl1Set (int value); +extern void dbgLctrl2Set (int value); +extern void dbgIctrlSet (int value); +extern int dbgCmpaGet (void) ; +extern int dbgCmpbGet (void) ; +extern int dbgCmpcGet (void) ; +extern int dbgCmpdGet (void) ; +extern int dbgCmpeGet (void) ; +extern int dbgCmpfGet (void) ; +extern int dbgLctrl1Get (void) ; +extern int dbgLctrl2Get (void) ; +extern int dbgIctrlGet (void) ; + +# elif CPU == PPC603 || CPU == PPCEC603 || CPU == PPC604 || CPU == PPC970 +# if CPU != PPC970 +extern void wdbDbgIabrSet (int value); +extern int wdbDbgIabrGet (void); +# endif /* !PPC_970 */ +# if CPU == PPC604 || CPU == PPC970 +extern void wdbDbgDabrSet (int value); +extern int wdbDbgDabrGet (void); +extern int wdbDbgDarGet (void); +# endif /* 604 || 970 */ +# if (defined (PPC_83xx) || defined (PPC_g2le)) +extern int wdbDbgDarGet (void); +extern void wdbDbgIabr2Set (int value); +extern int wdbDbgIabr2Get (void); +extern void wdbDbgIbcrSet (int value); +extern int wdbDbgIbcrGet (void); +extern void wdbDbgDabrSet (int value); +extern int wdbDbgDabrGet (void); +extern void wdbDbgDabr2Set (int value); +extern int wdbDbgDabr2Get (void); +extern void wdbDbgDbcrSet (int value); +extern int wdbDbgDbcrGet (void); +# endif /* PPC_83xx || PPC_g2le */ +# elif (CPU == PPC403) +extern void wdbDbgDbcrSet (int value); +extern int wdbDbgDbcrGet (void); +extern void wdbDbgDbsrSet (int value); +extern int wdbDbgDbsrGet (void); +extern void wdbDbgDac1Set (int value); +extern int wdbDbgDac1Get (void); +extern void wdbDbgDac2Set (int value); +extern int wdbDbgDac2Get (void); +extern void wdbDbgIac1Set (int value); +extern int wdbDbgIac1Get (void); +extern void wdbDbgIac2Set (int value); +extern int wdbDbgIac2Get (void); + +# elif ((CPU == PPC405) || (CPU == PPC405F) || (CPU == PPC440) || \ + (CPU == PPC85XX)) +extern void wdbDbgDbcr0Set (int value); +extern int wdbDbgDbcr0Get (void); +extern void wdbDbgDbcr1Set (int value); +extern int wdbDbgDbcr1Get (void); +# if ((CPU == PPC440) || (CPU == PPC85XX)) +extern void wdbDbgDbcr2Set (int value); +extern int wdbDbgDbcr2Get (void); +# endif /* CPU == PPC440, PPC85XX */ +# if (CPU == PPC440) +extern void wdbDbgDbdrSet (int value); +extern int wdbDbgDbdrGet (void); +# endif /* (CPU == PPC440) */ +extern void wdbDbgDbsrSet (int value); +extern int wdbDbgDbsrGet (void); +extern void wdbDbgDac1Set (int value); +extern int wdbDbgDac1Get (void); +extern void wdbDbgDac2Set (int value); +extern int wdbDbgDac2Get (void); +extern void wdbDbgIac1Set (int value); +extern int wdbDbgIac1Get (void); +extern void wdbDbgIac2Set (int value); +extern int wdbDbgIac2Get (void); +# if (CPU != PPC85XX) +extern void wdbDbgIac3Set (int value); +extern int wdbDbgIac3Get (void); +extern void wdbDbgIac4Set (int value); +extern int wdbDbgIac4Get (void); +# endif /* CPU != PPC85XX */ +# endif /* 509 555 860 : 603 EC603 604 : 403 : 405 405F 440 85XX */ + +#endif /* _ASMLANGUAGE */ +#endif /* DBG_HARDWARE_BP */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdbgPpcLibh */ diff --git a/h/arch/ppc/dsmPpcLib.h b/h/arch/ppc/dsmPpcLib.h new file mode 100644 index 0000000..f57b42a --- /dev/null +++ b/h/arch/ppc/dsmPpcLib.h @@ -0,0 +1,364 @@ +/* dsmPpc.h - PowerPC disassembler header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,19oct04,to fix SPR#75831 +01e,18dec03,elg Add definition of sc instruction. +01d,19feb03,x_p Fix host build +01e,08oct03,mil Fixed typo for _ESOP on host. +01d,16jun03,mil Added E500 instructions. +01c,23jan03,pch Add isel for 440x5 core (440GX) +01b,05dec02,pch SPR 84100: correctly decode WS field for 4xx tlbre/tlbwe +01a,18sep01,pch created by merging target/h/arch/ppc/dsmPpcLib.h vn 01o + and host/src/tgtsvr/disassembler/dsmPpc.h vn 02j + Also added selective handling of processor-specific SPR's + and instructions in the host disassembler based on the + cpuType of the currently-connected target. + +Following are the history entries from the merged files + + 07sep01,pch Improve comments, cleanup; remove MAX_SPR_LEN (no longer used) + 01jun01,dtr Adding IFORM_VA1B which is needed because input vectors + swapped in PIM for two instructions vmaddfp,vnmsubfp. + 29may01,dtr IFORM_VA_1&2 in the wrong place. + 02may01,kab Fix duplicate case after merge. + 30apr01,dtr Correcting merge problems. + 14dec00,s_m changed IFIELD_WS4 to IFIELD_WS + 09dec00,jrs Fix WS field. + 07dec00,dtr Support for Altivec Instruction set. + 05dec00,jrs Add field type for 405 TLB instructions. + 30nov00,jrs Add IBM 405 MAC and TLB instructions. + 17nov00,jrs Add PPC405GP changes. + 20apr98,fle functions renaming + 03sep97,fle Modified for being used by the WTX_MEM_DISASSEMBLE service. + 26jul96,tam added definition for MAX_SPR_LEN, DSTRING_BUF_MAX_SIZE + and _IFORM_D_9. + 18jun96,tam added definition for MAX_SPR_LEN and _IFORM_D_9. + 07jun96,kkk added endian argument to dsmXXXInst and dsmXXXNbytes + 02feb96,ms fixed INST_STWU_SP. + 02jan96,elp adapted for Tornado. + 13feb95,caf added sign extension to branch displacement (_IFIELD_BD). + 10feb95,caf added PPC403 support. + 31jan95,yao added more macros for branch instructions. + 07nov94,yao added macros for instructions used by dbgLib and trcLib. + 19aug94,caf created. +*/ + +#ifdef HOST +#include "wtxtypes.h" +#endif /* HOST */ + +#ifndef __INCdsmPpch +#define __INCdsmPpch + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef HOST +#include "vwModNum.h" +#endif /* HOST */ + +/* typedefs */ + +typedef struct /* instruction descriptor */ + { + char * name; /* mnemonic */ + UINT32 op; /* fixed bits */ + UINT16 form; /* form: major classifier, index into mask[] */ + UINT16 flags; /* classification flags: _IFLAG_* */ + } INST; + +typedef struct /* SPR/DCR/PMR descriptor */ + { + int code; /* number */ + char * name; /* name */ + } SPR; + +/* defines */ + +#ifdef HOST +# define _OP(opcd, xo) ((UINT32) ((opcd << 26) + (xo << 1))) +# define _VOP(opcd, xo) ((UINT32) ((opcd << 26) + xo)) +# define _ESOP(opcd, xo) ((UINT32) ((opcd << 26) + (xo << 3))) +#else /* HOST */ +# define S_dsmLib_UNKNOWN_INSTRUCTION (M_dsmLib | 1) +# define _OP(opcd, xo) ((opcd << 26) + (xo << 1)) +# define _VOP(opcd, xo) ((opcd << 26) + xo) /* altivec/spe specific */ +# define _ESOP(opcd, xo) ((opcd << 26) + (xo << 3)) /* evsel */ +#endif /* HOST */ + +/* instruction forms */ + +#define _IFORM_I_1 0 +#define _IFORM_B_1 1 +#define _IFORM_SC_1 2 +#define _IFORM_D_1 3 +#define _IFORM_D_2 4 +#define _IFORM_D_3 5 +#define _IFORM_D_4 6 +#define _IFORM_D_5 7 +#define _IFORM_D_6 8 +#define _IFORM_D_7 9 +#define _IFORM_D_8 10 +#define _IFORM_X_1 11 +#define _IFORM_X_2 12 +#define _IFORM_X_3 13 +#define _IFORM_X_4 14 +#define _IFORM_X_5 15 +#define _IFORM_X_6 16 +#define _IFORM_X_7 17 +#define _IFORM_X_8 18 +#define _IFORM_X_9 19 +#define _IFORM_X_10 20 +#define _IFORM_X_11 21 +#define _IFORM_X_12 22 +#define _IFORM_X_13 23 +#define _IFORM_X_14 24 +#define _IFORM_X_15 25 +#define _IFORM_X_16 26 +#define _IFORM_X_17 27 +#define _IFORM_X_18 28 +#define _IFORM_X_19 29 +#define _IFORM_X_20 30 +#define _IFORM_X_21 31 +#define _IFORM_X_22 32 +#define _IFORM_X_23 33 +#define _IFORM_X_24 34 +#define _IFORM_X_25 35 +#define _IFORM_X_26 36 +#define _IFORM_X_27 37 +#define _IFORM_XL_1 38 +#define _IFORM_XL_2 39 +#define _IFORM_XL_3 40 +#define _IFORM_XL_4 41 +#define _IFORM_XFX_1 42 +#define _IFORM_XFX_2 43 +#define _IFORM_XFX_3 44 +#define _IFORM_XFX_4 45 +#define _IFORM_XFL_1 46 +#define _IFORM_XO_1 47 +#define _IFORM_XO_2 48 +#define _IFORM_XO_3 49 +#define _IFORM_A_1 50 +#define _IFORM_A_2 51 +#define _IFORM_A_3 52 +#define _IFORM_A_4 53 +#define _IFORM_M_1 54 +#define _IFORM_M_2 55 +#define _IFORM_D_9 56 +#define _IFORM_400_1 57 /* mfdcr (PPC4xx only) */ +#define _IFORM_400_2 58 /* mtdcr (PPC4xx only) */ +#define _IFORM_400_3 59 /* wrteei (PPC4xx only) */ +#define _IFORM_405_TLB 60 /* tlbre, tlbwe (PPC405/440 only) */ +#define _IFORM_405_SX 61 /* tlbsx (PPC405/440 only) */ +#define _IFORM_VA_1 62 /* altivec only */ +#define _IFORM_VA_2 63 /* altivec only */ +#define _IFORM_VX_1 64 /* altivec only */ +#define _IFORM_VX_2 65 /* altivec only */ +#define _IFORM_VX_3 66 /* altivec only */ +#define _IFORM_VX_4 67 /* altivec only */ +#define _IFORM_VX_5 68 /* altivec only */ +#define _IFORM_VX_6 69 /* altivec only */ +#define _IFORM_X_28 70 /* altivec only */ +#define _IFORM_X_29 71 /* altivec only */ +#define _IFORM_X_30 72 /* altivec only */ +#define _IFORM_X_31 73 /* altivec only */ +#define _IFORM_X_32 74 /* altivec only */ +#define _IFORM_X_33 75 /* altivec only */ +#define _IFORM_VXR_1 76 /* altivec only */ +#define _IFORM_VA_1B 77 /* altivec only */ +#define _IFORM_M_3 78 /* isel (440x5/85xx) */ +#define _IFORM_X_34 79 /* e500 mbar with MO field */ +#define _IFORM_X_35 80 /* e500 wrteei */ +#define _IFORM_X_36 81 /* e500 tlbivax */ +#define _IFORM_X_37 82 /* e500 tlbsx */ +#define _IFORM_X_38 83 /* e500 tlbre */ +#define _IFORM_XFX_5 84 /* e500 mfpmr */ +#define _IFORM_XFX_6 85 /* e500 mtpmr */ +#define _IFORM_EVS_1 86 /* evsel (e500 spe version of isel) */ +#define _IFORM_EFX_1 87 /* e500 spe only */ +#define _IFORM_EFX_2 88 /* e500 spe only */ +#define _IFORM_EFX_3 89 /* e500 spe only */ +#define _IFORM_EFX_4 90 /* e500 spe only */ +#define _IFORM_EVX_1 91 /* e500 spe only */ +#define _IFORM_EVX_2 92 /* e500 spe only */ +#define _IFORM_EVX_3 93 /* e500 spe only */ +#define _IFORM_EVX_4 94 /* e500 spe only */ +#define _IFORM_EVX_5 95 /* e500 spe only */ +#define _IFORM_EVX_6 96 /* e500 spe only */ +#define _IFORM_EVX_7 97 /* e500 spe only */ +#define _IFORM_EVX_8 98 /* e500 spe only */ +#define _IFORM_EVX_9 99 /* e500 spe only */ +#define _IFORM_EVX_10 100 /* e500 spe only */ +#define _IFORM_EVX_11 101 /* e500 spe only */ +#define _IFORM_EVX_12 102 /* e500 spe only */ +#define _IFORM_EVX_13 103 /* e500 spe only */ +#define _IFORM_EVX_14 104 /* e500 spe only */ + +/* instruction classification flags: append char to opcode if bit is set */ + +#define _IFLAG_OE 0x0001 /* includes XER bit 'o' */ +#define _IFLAG_RC 0x0002 /* includes record bit '.' */ +#define _IFLAG_AA 0x0004 /* includes absolute bit 'a' */ +#define _IFLAG_LK 0x0008 /* includes link bit 'l' */ +#define _IFLAG_VRC 0x0200 /* includes altivec record bit '.' */ + +/* Flags for processor-specific instructions */ +#define _IFLAG_601_SPEC 0x0010 /* 601-specific */ +#define _IFLAG_603_SPEC 0x0020 /* 603-specific */ +#define _IFLAG_604_SPEC 0x0040 /* 604-specific */ +#define _IFLAG_403_SPEC 0x0080 /* 403-specific */ +#define _IFLAG_405_SPEC 0x0100 /* 405-specific */ +#define _IFLAG_AV_SPEC 0x0400 /* altivec-specific */ +#define _IFLAG_440_SPEC 0x0800 /* 440-specific */ +#define _IFLAG_FP_SPEC 0x1000 /* floating point */ +#define _IFLAG_E500_SPEC 0x2000 /* E500-specific */ + +/* shorthand for table construction */ +#define _IFLAG_6XX_SPEC (_IFLAG_601_SPEC | _IFLAG_603_SPEC | _IFLAG_604_SPEC) +#define _IFLAG_4XX_SPEC (_IFLAG_403_SPEC | _IFLAG_405_SPEC | _IFLAG_440_SPEC) + +/* TLB handling as in 405 and 440 */ +#define _IFLAG_4XTLB (_IFLAG_405_SPEC | _IFLAG_440_SPEC) + +/* MAC instructions as in 405 and 440 */ +#define _IFLAG_MAC (_IFLAG_405_SPEC | _IFLAG_440_SPEC) + +/* If any are set, instruction is not generic */ +#define _IFLAG_SPEC (_IFLAG_4XX_SPEC | _IFLAG_6XX_SPEC | _IFLAG_AV_SPEC | \ + _IFLAG_E500_SPEC | _IFLAG_FP_SPEC) + +/* instruction fields */ + +#define _IFIELD_AA(x) ((0x00000002 & x) >> 1) /* absolute address */ +#define _IFIELD_BD(x) ((0x00008000 & x) ? (0xffff0000 | (x & ~3)) : \ + (0x0000fffc & x)) + /* ^ signed branch displ */ +#define _IFIELD_BI(x) ((0x001f0000 & x) >> 16) /* branch condition */ +#define _IFIELD_BO(x) ((0x03e00000 & x) >> 21) /* branch options */ +#define _IFIELD_CRBA(x) ((0x001f0000 & x) >> 16) /* source CR bit */ +#define _IFIELD_CRBB(x) ((0x0000f800 & x) >> 11) /* source CR bit */ +#define _IFIELD_CRBD(x) ((0x03e00000 & x) >> 21) /* dest [FPS]CR bit */ +#define _IFIELD_CRFD(x) ((0x03800000 & x) >> 23) /* dest [FPS]CR field */ +#define _IFIELD_CRFS(x) ((0x001c0000 & x) >> 18) /* source [FPS]CR field */ +#define _IFIELD_CRM(x) ((0x000ff000 & x) >> 12) /* CR field mask */ +#define _IFIELD_D(x) ((0x0000ffff & x)) /* ^ signed 16b integer */ +#define _IFIELD_D_S(x) ((0x00008000 & x) ? (0xffff0000 | x) : \ + (0x0000ffff & x)) + /* ^ signed 16b integer */ +#define _IFIELD_FM(x) ((0x01fe0000 & x) >> 17) /* FPSCR field mask */ +#define _IFIELD_FRA(x) ((0x001f0000 & x) >> 16) /* source FPR */ +#define _IFIELD_FRB(x) ((0x0000f800 & x) >> 11) /* source FPR */ +#define _IFIELD_FRC(x) ((0x000007c0 & x) >> 6) /* source FPR */ +#define _IFIELD_FRD(x) ((0x03e00000 & x) >> 21) /* dest FPR */ +#define _IFIELD_FRS(x) ((0x03e00000 & x) >> 21) /* source FPR */ +#define _IFIELD_IMM(x) ((0x0000f000 & x) >> 12) /* data for FPSCR */ +#define _IFIELD_L(x) ((0x00200000 & x) >> 21) /* 64-bit flag (ignored) */ +#define _IFIELD_LI(x) ((0x02000000 & x) ? ((0xf6000000 | x) & ~3) : \ + ((0x03fffffc & x) & ~3)) + /* ^ signed 24b integer */ +#define _IFIELD_LK(x) ((0x00000001 & x) >> 0) /* link */ +#define _IFIELD_MB(x) ((0x000007c0 & x) >> 6) /* mask begin (split) */ +#define _IFIELD_ME(x) ((0x0000003e & x) >> 1) /* mask end (split) */ +#define _IFIELD_NB(x) ((0x0000f800 & x) >> 11) /* number of bytes */ +#define _IFIELD_OE(x) ((0x00000400 & x) >> 10) /* enable setting OV, SO */ +#define _IFIELD_OPCD(x) ((0xfc000000 & x) >> 26) /* primary opcode */ +#define _IFIELD_RA(x) ((0x001f0000 & x) >> 16) /* source or dest GPR */ +#define _IFIELD_VA(x) ((0x001f0000 & x) >> 16) /* source VR */ + +#define _IFIELD_RB(x) ((0x0000f800 & x) >> 11) /* source GPR */ +#define _IFIELD_WS(x) ((0x0000f800 & x) >> 11) /* 4xx tlbre/tlbwe WS fld */ +#define _IFIELD_VB(x) ((0x0000f800 & x) >> 11) /* source VR */ +#define _IFIELD_VC(x) ((0x000007c0 & x) >> 6) /* source VR */ +#define _IFIELD_RC(x) ((0x00000001 & x) >> 0) /* record */ +#define _IFIELD_VRC(x) ((0x00000400 & x) >> 10) /* record */ +#define _IFIELD_RD(x) ((0x03e00000 & x) >> 21) /* dest GPR */ +#define _IFIELD_VD(x) ((0x03e00000 & x) >> 21) /* destination VR */ +#define _IFIELD_RS(x) ((0x03e00000 & x) >> 21) /* source GPR */ +#define _IFIELD_VS(x) ((0x03e00000 & x) >> 21) /* source VR */ +#define _IFIELD_SH(x) ((0x0000f800 & x) >> 11) /* shift amount (split) */ +#define _IFIELD_VSH(x) ((0x000003c0 & x) >> 6) /* shift amount for vector */ +#define _IFIELD_SIMM(x) ((0x0000ffff & x)) +#define _IFIELD_SIMM_S(x) ((0x00008000 & x) ? (0xffff0000 | x) : \ + (0x0000ffff & x)) + /* ^ signed 16b integer */ +#define _IFIELD_VSIMM(x) ((0x00100000 & x) ? (0xffffffe0 | (x>>16)) : \ + (0x0000001f & (x>>16))) + /* ^ signed 5b integer */ +#define _IFIELD_SPR(x) (((0x001f0000 & x) >> 16) | \ + ((0x0000f800 & x) >> 6)) /* mtspr, mfspr (split) */ +#define _IFIELD_SR(x) ((0x000f0000 & x) >> 16) /* segment register */ +#define _IFIELD_TBR(x) ((0x001ff800 & x) >> 11) /* TBL, TBU (split) */ +#define _IFIELD_TO(x) ((0x03e00000 & x) >> 21) /* trap conditions */ +#define _IFIELD_UIMM(x) ((0x0000ffff & x) >> 0) /* unsigned 16b integer */ +#define _IFIELD_VUIMM(x) ((0x001f0000 & x)>> 16) /* unsigned 5b integer */ + +#define _IFIELD_XO_1(x) ((0x000007fe & x) >> 1) /* extended op 1 (21-30) */ +#define _IFIELD_XO_2(x) ((0x000003fe & x) >> 1) /* extended op 2 (22-30) */ +#define _IFIELD_XO_3(x) ((0x0000003e & x) >> 1) /* extended op 3 (26-30) */ + +#define _IFIELD_STRM(x) ((0x00600000 & x) >> 21) /* Data stream ID */ + +#define _IFIELD_CRFE(x) ((0x00000007 & x)) /* crfS for evsel */ +#define _IFIELD_MO(x) ((0x03e00000 & x) >> 21) /* MO for mbar */ +#define _IFIELD_EE(x) ((0x00008000 & x) >> 15) /* EE bit 16 for wrtee */ + +#define INST_B _OP(18, 0) +#define INST_BC _OP(16, 0) +#define INST_BCCTR _OP(19, 528) +#define INST_BCLR _OP(19, 16) +#define INST_BL (_OP(18, 0) | 1) +#define INST_BCL (_OP(16, 0) | 1) +#define INST_SC _OP(17, 1) +#define INST_B_MASK 0xfc000000 +#define INST_BL_MASK 0xfc000001 +#define INST_BCR_MASK 0xfc00fffe +#define INST_BCLRL 0x4c000021 +#define INST_BCLRL_MASK 0xfc00ffff +#define INST_SC_MASK 0xfc000002 + +#define INST_MFLR 0x7c0802a6 +#define INST_MFLR_R0 INST_MFLR +#define INST_MTLR 0x7c0803a6 +#define INST_ADDI_SP 0x38210000 +#define INST_STWU_SP 0x94210000 +#define INST_STW_SP 0x90010000 +#define INST_STW_R0_SP INST_STW_SP +#define INST_LWZ_SP 0x80010000 +#define INST_LWZU_SP 0x84010000 + +#define INST_MTSPR_MASK 0xfc1fffff +#define INST_HIGH_MASK 0xffff0000 +#define INST_BCLR_MASK 0xfc00ffff +#define INST_STW_SP_MASK 0xfc1f0000 + +#ifdef HOST +/* function declarations */ + +extern DLL_EXPORT int dsmPpcInstGet + ( + UINT32 * binInst, /* Pointer to the instruction */ + int endian, /* endianness of data in buffer */ + TGT_ADDR_T address, /* Address prepended to instruction */ + VOIDFUNCPTR prtAddress, /* printing function address */ + char * pString, /* where to write disassembled inst. */ + BOOL32 printAddr, /* if address has to be appened */ + BOOL32 printOpcodes /* if opcodes have to be appened */ + ); + +extern DLL_EXPORT int dsmPpcInstSizeGet + ( + UINT32 * binInst, /* pointer to the instruction */ + int endian /* endianness of data in buffer */ + ); +#endif /* HOST */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdsmPpch */ diff --git a/h/arch/ppc/elfPpc.h b/h/arch/ppc/elfPpc.h new file mode 100644 index 0000000..8734f7d --- /dev/null +++ b/h/arch/ppc/elfPpc.h @@ -0,0 +1,112 @@ +/* elfPpc.h - PowerPC specific elf loader header */ + +/* + * Copyright (c) 1994-2004 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software may be + * licensed only pursuant to the terms of an applicable Wind River license + * agreement. + */ + +/* +modification history +-------------------- +01g,25jul05,v_r Updated copyright. +01f,18sep04,jn Move towards shared code between host and target loaders +01e,12jul04,jn Source sanitization +01d,12apr04,jn Cleaning up header files after merge of AE loader work into + Base 6 +01e,08mar04,pad Renamed the relocation type R_PPC_PLT24 into R_PPC_PLTREL24 + to match the ABI. +01d,27feb04,pad Renamed relocation type R_PPC_SDAREL into R_PPC_SDAREL16 to + match ABI. +01c,31mar95,yao added greenhill bug related definitions. +01b,24mar95,yao updated relocation type to EABI version 1.0. rename the + definitions conflicted with 1.0 in draft1.1 from + R_PPC_XXX to R_PPC_XXX_OLD. +01a,06dec94,yao created. +*/ + +#ifndef __INCelfPpch +#define __INCelfPpch + +#ifdef __cplusplus +extern "C" { +#endif + +#define EM_ARCH_MACHINE EM_PPC +#define EM_ARCH_MACH_ALT EM_PPC_OLD + +/* The following defines which if the compiler conforms with EABI + * release. LD_NO_BUGS - use the EABI standard, LD_OLD_VER_BUG - use + * the old EABI draft 1.1, and the incorrect relocation information + * is generated with the old machine magic value EM_PPC_OLD(17), + * the correct relocation information is genreated with the updated + * machine magic number EM_PPC(20). LD_ALWAYS_BUG - the compiler always + * generate the incorrect relocation information. This should be + * removed finally when the compiler venders do the job correctly. + */ + +#define LD_NO_BUGS 0 +#define LD_OLD_VER_BUG 1 +#define LD_ALWAYS_BUG 2 + +/* relocation type definition */ + +#define R_PPC_NONE 0 +#define R_PPC_ADDR32 1 +#define R_PPC_ADDR24 2 +#define R_PPC_ADDR16 3 +#define R_PPC_ADDR16_LO 4 +#define R_PPC_ADDR16_HI 5 +#define R_PPC_ADDR16_HA 6 +#define R_PPC_ADDR14 7 +#define R_PPC_ADDR14_BRTAKEN 8 +#define R_PPC_ADDR14_BRNTAKEN 9 +#define R_PPC_REL24 10 +#define R_PPC_REL14 11 +#define R_PPC_REL14_BRTAKEN 12 +#define R_PPC_REL14_BRNTAKEN 13 +#define R_PPC_GOT16 14 +#define R_PPC_GOT16_LO 15 +#define R_PPC_GOT16_HI 16 +#define R_PPC_GOT16_HA 17 +#define R_PPC_PLTREL24 18 +#define R_PPC_COPY 19 +#define R_PPC_JMP_SLOT 21 +#define R_PPC_RELATIVE 22 +#define R_PPC_LOCAL24PC 23 +#define R_PPC_UADDR32 24 +#define R_PPC_UADDR16 25 +#define R_PPC_REL32 26 +#define R_PPC_PLT32 27 +#define R_PPC_PLTREL32 28 +#define R_PPC_PLT16_LO 29 +#define R_PPC_PLT16_HI 30 +#define R_PPC_PLT16_HA 31 +#define R_PPC_SDAREL16 32 + +/* EABI relocation types */ + +#define R_PPC_EMB_NADDR32 101 +#define R_PPC_EMB_NADDR16 102 +#define R_PPC_EMB_NADDR16_LO 103 +#define R_PPC_EMB_NADDR16_HI 104 +#define R_PPC_EMB_NADDR16_HA 105 +#define R_PPC_EMB_SDAI16 106 +#define R_PPC_EMB_SDA2I16 107 +#define R_PPC_EMB_SDA2REL 108 +#define R_PPC_EMB_SDA21 109 +#define R_PPC_EMB_MRKREF 110 +#define R_PPC_EMB_RELSEC16 111 +#define R_PPC_EMB_RELST_LO 112 +#define R_PPC_EMB_RELST_HI 113 +#define R_PPC_EMB_RELST_HA 114 +#define R_PPC_EMB_BIT_FLD 115 +#define R_PPC_EMB_RELSDA 116 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCelfPpcLibh */ diff --git a/h/arch/ppc/esfPpc.h b/h/arch/ppc/esfPpc.h new file mode 100644 index 0000000..ad24a22 --- /dev/null +++ b/h/arch/ppc/esfPpc.h @@ -0,0 +1,266 @@ +/* esfPpc.h - PowerPC exception stack frames */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01o,23aug04,pch SPR 78780: split vecOffset into two UINT16's to make space + to handle CI frameless nesting case +01n,09jun04,pch add support for PPC440 with hard FP +01m,12feb04,jtp Apply _WRS_MMU_CLASS_* macros. +01l,13aug03,mil Consolidated esr and mcsr as well as dear and mcar for e500. +01k,11nov02,mil Added E500 registers to ESF. +01j,03oct02,dtr Adding spefscr register offset to regset in ESF. +01l,01dec03,jtp PPC440/405 context switching support; size & offset cleanup +01k,09oct03,pcs Add the context related register offset on exception stack. +01j,14jan03,pch Add support for 440x5 core (PPC440GX) +01i,22aug01,pch Replace "sizeof(UINT32)" with SIZ_UINT32 because the + assembler barfs on the former. +01h,15aug01,pch Add PPC440, remove an old "#if 0" block +01g,25oct00,s_m renamed PPC405 cpu types +01f,31aug00,sm added cases for PPC405 and PPC405F +01e,04mar96,tam added support for PPC403. +01d,20apr95,yao add padding word that esf stack size are same + for all cpu variations. +01c,06oct94,yao changed to put sp on the top of the stack. +01b,29sep94,yao fixed register offset on the exception stack in + correct order. +01a,07jul94,yao written. +*/ + +#ifndef __INCesfPpch +#define __INCesfPpch + +#ifdef __cplusplus +extern "C" { +#endif + +#include "regs.h" + +/* + * excALib.s treats resumeOffset and vecOffset together as a 32-bit fullword, + * thereby setting resumeOffset to zero. The only time when resumeOffset + * is non-zero is when intCrtEnt detects frameless nesting of a critical + * interrupt within the first few instructions of a normal event vector; in + * this case resumeOffset is used to record the offset of the interrupted + * normal vector so that it can be resumed properly after the critical + * interrupt has been serviced. See comments in intCrtEnt for further + * details. + * + * All C code now accesses vecOffset as a 16-bit halfword. Only assembly + * code uses resumeOffset. + */ + +#ifndef _ASMLANGUAGE + +typedef struct + { + _RType spCopy; /* unused - redundant copy of regSet.gpr[1] */ + UINT16 resumeOffset; /* resume offset for CI frameless nesting */ + UINT16 vecOffset; /* vector offset */ + UINT32 _errno; /* error number */ + +# if ((CPU == PPC403) || (CPU == PPC405) || (CPU == PPC405F)) + _RType dear; /* data exception address register */ + UINT32 bear; /* bus error address register */ + UINT32 besr; /* bus error syndrome register */ +# elif (CPU == PPC440) + _RType dear; /* data exception address register */ +# ifdef _PPC_MSR_FP + UINT32 fpcsr; /* floating-point control and status register */ +# else /* _PPC_MSR_FP */ + UINT32 pad3; +# endif /* _PPC_MSR_FP */ +# ifdef PPC_440x5 + UINT32 mcsr; /* machine check status register */ +# else /* PPC_440x5 */ + UINT32 pad4; +# endif /* PPC_440x5 */ +# elif (CPU == PPC85XX) + _RType dear; /* data exception address register and MCAR */ + UINT32 esr; /* exception syndrome register and MCSR/DBSR */ + UINT32 iarr; /* instruction address resume register */ +# else /* CPU == PPC4xx/PPC85xx */ + _RType dar; /* data address register */ + UINT32 dsisr; /* data storage interrupt status register */ + UINT32 fpcsr; /* floating-point control and status register */ +# endif /* CPU == PPC4xx/PPC85xx */ + + REG_SET regSet; /* register set */ + +# if (CPU == PPC440 && defined(PPC_440x5)) + UINT32 besr; /* bus error syndrome register */ + UINT32 bear_h; /* bus error address register (high) */ + UINT32 bear_l; /* bus error address register (low) */ +# else /* PPC440 && PPC_440x5 */ +# if (CPU == PPC405F) + UINT32 fpcsr; /* floating-point control and status register */ +# else /* CPU == PPC405F */ + UINT32 pad0; +# endif /* CPU == PPC405F */ + UINT32 pad1; + UINT32 pad2; +# endif /* PPC440 && PPC_440x5 */ + } ESFPPC; + +#endif /* _ASMLANGUAGE */ + +/* _PPC_ESF_SIZE provides sizeof(ESFPPC) for assembly language code */ +#define _PPC_ESF_SIZE (9 * _PPC_REG_SIZE + _PPC_REG_SET_SIZE) + +/* _PPC_ESF_STK_SIZE provides a stack-aligned ESFPPC allocation size */ +#define _PPC_ESF_STK_SIZE ((_PPC_ESF_SIZE + _STACK_ALIGN_SIZE - 1) & \ + ~(_STACK_ALIGN_SIZE - 1)) + +/* register offset on exception stack */ + +/* Assembler barfs on sizeof(), so do it this way instead */ +#define SIZ_UINT32 4 /* sizeof(UINT32) */ +#define SIZ_UINT16 2 /* sizeof(UINT16) */ + +#define _PPC_ESF_SP_OFF (0) +#define _PPC_ESF_VEC_OFF (_PPC_ESF_SP_OFF + _PPC_REG_SIZE) /* fullword */ +#define _PPC_ESF_RES_OFF_H (_PPC_ESF_VEC_OFF + 0) /* halfword */ +#define _PPC_ESF_VEC_OFF_H (_PPC_ESF_VEC_OFF + SIZ_UINT16) /* halfword */ +#define _PPC_ESF_ERRNO (_PPC_ESF_VEC_OFF + SIZ_UINT32) +#if ((CPU == PPC403) || (CPU == PPC405) || (CPU == PPC405F)) +# define _PPC_ESF_DEAR (_PPC_ESF_ERRNO + SIZ_UINT32) +# define _PPC_ESF_BEAR (_PPC_ESF_DEAR + _PPC_REG_SIZE) +# define _PPC_ESF_BESR (_PPC_ESF_BEAR + SIZ_UINT32) +# define _PPC_ESF_REG_BASE (_PPC_ESF_BESR + SIZ_UINT32) +#elif (CPU == PPC440) +# define _PPC_ESF_DEAR (_PPC_ESF_ERRNO + SIZ_UINT32) +# ifdef _PPC_MSR_FP +# define _PPC_ESF_FPCSR (_PPC_ESF_DEAR + _PPC_REG_SIZE) +# else /* _PPC_MSR_FP */ +# define _PPC_ESF_PAD3 (_PPC_ESF_DEAR + _PPC_REG_SIZE) +# endif /* _PPC_MSR_FP */ +# ifdef PPC_440x5 +# define _PPC_ESF_MCSR (_PPC_ESF_DEAR + _PPC_REG_SIZE + SIZ_UINT32) +# define _PPC_ESF_REG_BASE (_PPC_ESF_MCSR + SIZ_UINT32) +# else /* PPC_440x5 */ +# define _PPC_ESF_PAD4 (_PPC_ESF_DEAR + _PPC_REG_SIZE + SIZ_UINT32) +# define _PPC_ESF_REG_BASE (_PPC_ESF_PAD4 + SIZ_UINT32) +# endif /* PPC_440x5 */ +#elif (CPU == PPC85XX) +# define _PPC_ESF_DEAR (_PPC_ESF_ERRNO + SIZ_UINT32) +# define _PPC_ESF_ESR (_PPC_ESF_DEAR + _PPC_REG_SIZE) +# define _PPC_ESF_IARR (_PPC_ESF_ESR + SIZ_UINT32) +# define _PPC_ESF_REG_BASE (_PPC_ESF_IARR + SIZ_UINT32) +#else /* CPU == PPC4xx/PPC85xx */ +# define _PPC_ESF_DAR (_PPC_ESF_ERRNO + SIZ_UINT32) +# define _PPC_ESF_DSISR (_PPC_ESF_DAR + _PPC_REG_SIZE) +# define _PPC_ESF_FPCSR (_PPC_ESF_DSISR + SIZ_UINT32) +# define _PPC_ESF_REG_BASE (_PPC_ESF_FPCSR + SIZ_UINT32) +#endif /* CPU == PPC4xx/PPC85xx */ +#if (CPU == PPC440 && defined(PPC_440x5)) +# define _PPC_ESF_BESR (_PPC_ESF_REG_BASE + _PPC_REG_SET_SIZE) +# define _PPC_ESF_BEAR_H (_PPC_ESF_BESR + SIZ_UINT32) +# define _PPC_ESF_BEAR_L (_PPC_ESF_BEAR_H + SIZ_UINT32) +#else /* PPC440 && PPC_440x5 */ +# if (CPU == PPC405F) +# define _PPC_ESF_FPCSR (_PPC_ESF_REG_BASE + _PPC_REG_SET_SIZE) +# define _PPC_ESF_PAD1 (_PPC_ESF_FPCSR + SIZ_UINT32) +# else /* CPU == PPC405F */ +# define _PPC_ESF_PAD0 (_PPC_ESF_REG_BASE + _PPC_REG_SET_SIZE) +# define _PPC_ESF_PAD1 (_PPC_ESF_PAD0 + SIZ_UINT32) +# endif /* CPU == PPC405F */ +# define _PPC_ESF_PAD2 (_PPC_ESF_PAD1 + SIZ_UINT32) +#endif /* PPC440 && PPC_440x5*/ + +#define _PPC_ESF_R(n) (_PPC_ESF_REG_BASE + (n) * _PPC_REG_SIZE) + +#define _PPC_ESF_MSR _PPC_ESF_R(GREG_NUM) +#define _PPC_ESF_LR _PPC_ESF_R(GREG_NUM + 1) +#define _PPC_ESF_CTR _PPC_ESF_R(GREG_NUM + 2) +#define _PPC_ESF_PC _PPC_ESF_R(GREG_NUM + 3) +#define _PPC_ESF_CR _PPC_ESF_R(GREG_NUM + 4) +#define _PPC_ESF_XER (_PPC_ESF_CR + 4) +#if (CPU == PPC601) +#define _PPC_ESF_MQ (_PPC_ESF_XER + 4) +#else /* (CPU == PPC601) */ +#define _PPC_ESF_PG_TBL_PTR (_PPC_ESF_XER + 4) +#endif /* (CPU == PPC601) */ + +#if defined(_WRS_MMU_CLASS_SR_REGS) +#define _PPC_ESF_SC_SR_TBL_PTR (_PPC_ESF_PG_TBL_PTR + 4) +#define _PPC_ESF_SR_TBL_PTR (_PPC_ESF_SC_SR_TBL_PTR + 4) +#elif defined(_WRS_MMU_CLASS_PID_REG) +#define _PPC_ESF_ASID (_PPC_ESF_PG_TBL_PTR + 4) +#if (CPU == PPC85XX) +#define _PPC_ESF_SPEFSCR (_PPC_ESF_ASID + 4) +#endif /* CPU == PPC85XX */ +#endif /* _WRS_MMU_CLASS_* */ + +#define _PPC_ESF_R0 _PPC_ESF_R(0) +#define _PPC_ESF_R1 _PPC_ESF_R(1) +#define _PPC_ESF_R2 _PPC_ESF_R(2) +#define _PPC_ESF_R3 _PPC_ESF_R(3) +#define _PPC_ESF_R4 _PPC_ESF_R(4) +#define _PPC_ESF_R5 _PPC_ESF_R(5) +#define _PPC_ESF_R6 _PPC_ESF_R(6) +#define _PPC_ESF_R7 _PPC_ESF_R(7) +#define _PPC_ESF_R8 _PPC_ESF_R(8) +#define _PPC_ESF_R9 _PPC_ESF_R(9) +#define _PPC_ESF_R10 _PPC_ESF_R(10) +#define _PPC_ESF_R11 _PPC_ESF_R(11) +#define _PPC_ESF_R12 _PPC_ESF_R(12) +#define _PPC_ESF_R13 _PPC_ESF_R(13) +#define _PPC_ESF_R14 _PPC_ESF_R(14) +#define _PPC_ESF_R15 _PPC_ESF_R(15) +#define _PPC_ESF_R16 _PPC_ESF_R(16) +#define _PPC_ESF_R17 _PPC_ESF_R(17) +#define _PPC_ESF_R18 _PPC_ESF_R(18) +#define _PPC_ESF_R19 _PPC_ESF_R(19) +#define _PPC_ESF_R20 _PPC_ESF_R(20) +#define _PPC_ESF_R21 _PPC_ESF_R(21) +#define _PPC_ESF_R22 _PPC_ESF_R(22) +#define _PPC_ESF_R23 _PPC_ESF_R(23) +#define _PPC_ESF_R24 _PPC_ESF_R(24) +#define _PPC_ESF_R25 _PPC_ESF_R(25) +#define _PPC_ESF_R26 _PPC_ESF_R(26) +#define _PPC_ESF_R27 _PPC_ESF_R(27) +#define _PPC_ESF_R28 _PPC_ESF_R(28) +#define _PPC_ESF_R29 _PPC_ESF_R(29) +#define _PPC_ESF_R30 _PPC_ESF_R(30) +#define _PPC_ESF_R31 _PPC_ESF_R(31) + +#define _PPC_ESF_P0 _PPC_ESF_R3 +#define _PPC_ESF_P1 _PPC_ESF_R4 +#define _PPC_ESF_P2 _PPC_ESF_R5 +#define _PPC_ESF_P3 _PPC_ESF_R6 +#define _PPC_ESF_P4 _PPC_ESF_R7 +#define _PPC_ESF_P5 _PPC_ESF_R8 +#define _PPC_ESF_P6 _PPC_ESF_R9 +#define _PPC_ESF_P7 _PPC_ESF_R10 + +#define _PPC_ESF_T0 _PPC_ESF_R14 +#define _PPC_ESF_T1 _PPC_ESF_R15 +#define _PPC_ESF_T2 _PPC_ESF_R16 +#define _PPC_ESF_T3 _PPC_ESF_R17 +#define _PPC_ESF_T4 _PPC_ESF_R18 +#define _PPC_ESF_T5 _PPC_ESF_R19 +#define _PPC_ESF_T6 _PPC_ESF_R20 +#define _PPC_ESF_T7 _PPC_ESF_R21 +#define _PPC_ESF_T8 _PPC_ESF_R22 +#define _PPC_ESF_T9 _PPC_ESF_R23 +#define _PPC_ESF_T10 _PPC_ESF_R24 +#define _PPC_ESF_T11 _PPC_ESF_R25 +#define _PPC_ESF_T12 _PPC_ESF_R26 +#define _PPC_ESF_T13 _PPC_ESF_R27 +#define _PPC_ESF_T14 _PPC_ESF_R28 +#define _PPC_ESF_T15 _PPC_ESF_R29 +#define _PPC_ESF_T16 _PPC_ESF_R30 +#define _PPC_ESF_T17 _PPC_ESF_R31 + +#define _PPC_ESF_SP _PPC_ESF_R1 + +#ifdef _AIX_TOOL +#define _PPC_ESF_RTOC _PPC_ESF_R(2) +#endif /* _AIX_TOOL */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCesfPpch */ diff --git a/h/arch/ppc/exc440x5.h b/h/arch/ppc/exc440x5.h new file mode 100644 index 0000000..4e8932f --- /dev/null +++ b/h/arch/ppc/exc440x5.h @@ -0,0 +1,186 @@ +/* exc440x5.h - Layout of PPC440GX Machine Check Handler Save Area */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,24sep04,dtr Add new typedef. Part of SPR 100373. +01e,27apr04,cjj Defined _PPC_440X5_MCH_LOG_USE_POLLING +01d,17nov03,pch move definition of MCHSA_BASE_REG from ppc440.h + and adjust for Diab +01c,11nov03,pch Update for Base 6 AIM MMU +01b,09jun03,pch log recovered 440x5 Machine Check events. +01a,29may03,pch initial release. +*/ + +#ifndef __INCexc440x5h +#define __INCexc440x5h + +#ifdef __cplusplus +extern "C" { +#endif + +#include "arch/ppc/mmu440Lib.h" + +/* + * Register for the Machine Check handler to use as a base for addressing its + * save area. If 0, the save area is at address 0 and no base register is + * needed. If non-zero, the save area can be anywhere within the address + * space mapped by the TLB entry that covers the vector table, and the Machine + * Check handler must save the base register before use. See exc440x5ALib.s + * for details. + * + * XXX - This definition must be an integer specifying the register number + * XXX - (or 0). It may not be a symbolic register name, because the symbols + * XXX - are not known to the preprocessor when using the Diab assembler or + * XXX - either C compiler. + */ +#define MCHSA_BASE_REG 10 /* p7 = r10 */ + +/* + * This is a dedicated memory area used to save and restore registers during + * Machine Check handling. Using a memory save area reduces the need to use + * processor core registers for saving state, without impairing reliability + * or functionality: + * + * 1. The TLB entry which maps the Machine Check handler is presumed to be + * uncorrupted: if not, the handler would fail attempting to fetch its + * first instruction. No additional vulnerability arises from using the + * same TLB entry to access the save area. + * + * 2. If configured, data cache recovery is performed before the save area + * is accessed. Alternatively, when configured for maximum robustness + * (with a TLB entry dedicated to the Machine Check handler and refreshed + * periodically), the dedicated TLB entry will be set to inhibit cacheing. + * + * 3. Use of a dedicated memory save area does not sacrifice reenterability, + * because this handler cannot be reenterable anyway: critical state + * saved in MCSRR0 and MCSRR1 would be lost if a second Machine Check + * interrupt occurred during its execution. Additional Machine Check + * interrupts are disabled when the hardware takes the first one, and they + * remain disabled until an rfmci is executed (after recovery is complete, + * or the Machine Check has been identified as non-recoverable). + * + * Since we must establish addressability to the save area anyway, we'll also + * arrange for initialization to store copies of the static TLB entries there + * for use in recovery from a TLB parity error. The timer service routine + * will also use this to periodically refresh TLB 0. + */ + +/* + * Defining _PPC_440X5_MCH_LOG_USE_POLLING during arch build will cause the + * TLB 0 refresh function (part of the timer ISR) to poll for Machine Check + * events which need to be logged. Undefining it will cause the Machine Check + * Handler to invoke the logger via the kernel workQ instead. Using the workQ + * improves overall efficiency by avoiding a special-purpose polling operation + * at each timer tick, but introduces a dependency on the workQ implementation + * (which may change in future kernel releases). + */ + +/* + * The kernel work queue was modified therefore polling MUST be used + * to check for Machine Check events until exc440x5ALib.s is modified + * iaw the work queue mods. + */ +#define _PPC_440X5_MCH_LOG_USE_POLLING + +/* + * Defining _PPC_440X5_MCH_SUPPORT_CB_DCACHE during arch build will include + * support for limited recovery of a copyback data cache. If this support + * is included in the arch build, the system can be configured to operate + * in writethrough mode, providing recovery from all Dcache parity errors; + * in copyback mode, providing recovery from only those Dcache parity errors + * which occur in unmodified lines and therefore do not lose data; or with + * no data cache recovery. If this support is omitted from the arch build, + * the Machine Check handler will be smaller but only the writethrough and + * no-recovery configurations will be available. + */ +#undef _PPC_440X5_MCH_SUPPORT_CB_DCACHE + +#ifndef _ASMLANGUAGE +typedef struct + { + UINT32 count; /* Count of Machine Checks encountered */ + UINT32 mcsr; /* MCSR value which precipitated this event */ + } PPC440X5_MCH_LOG_DATA; + +typedef struct + { +#if (MCHSA_BASE_REG != 0) + UINT32 mch_base; /* save base register */ +#endif /* MCHSA_BASE_REG != 0 */ + UINT32 mch_rY; /* save rY */ + UINT32 mch_cr; /* save CR */ + UINT32 mch_mcsr; /* MCSR (set for every MC) */ + UINT32 mch_count; /* counter incremented for every MC */ + UINT32 mch_fatalMcsr; /* MCSR (set only for non-recoverable MC) */ + UINT32 mch_fatalCount; /* counter incremented for fatal MC */ + FUNCPTR mch_logger; /* function to log recovered MC, or NULL */ +#ifdef _PPC_440X5_MCH_SUPPORT_CB_DCACHE + UINT32 mch_dcrSel; /* selector of failed Dcache line per dcread */ + UINT32 mch_dcdbtrl; /* DCDBTRL from failed Dcache line */ + UINT32 mch_dcdbtrh; /* DCDBTRH from failed Dcache line */ + UINT32 mch_dcvaddr; /* virtual addr for failed Dcache line */ + UINT32 mch_dcsrrZ; /* work space during Dcache recovery */ + UINT32 mch_dcPmask; /* work space during Dcache recovery */ + UINT32 mch_reserved[2]; /* reserved for future use */ +#else /* _PPC_440X5_MCH_SUPPORT_CB_DCACHE != 0 */ + UINT32 mch_reserved[8]; /* reserved for future use */ +#endif /* _PPC_440X5_MCH_SUPPORT_CB_DCACHE */ +/* following entries are used for TLB recovery */ + UINT32 mch_rZ; /* save rZ */ + UINT32 mch_ctr; /* save CTR */ + UINT32 mch_mmucr; /* save MMUCR */ + UINT32 mch_rX; /* save rX */ + UINT32 mch_numStat; /* # of static TLB entries */ + UINT32 mch_cacheEnab; /* Cache is enabled? */ + UINT32 mch_res_tlb[2]; /* reserved for future use */ +/* + * XXX - sizeof(PPC_MCHSA) should not be believed, because the dimension + * of mch_statTlb[] is variable, set by sysStaticTlbDescNumEnt in the BSP. + * Using 4 here since it is difficult to envision a configuration using + * fewer static TLB entries, but the actual value will likely be around 25. + */ + MMU440_PTE mch_statTlb[4]; /* Copies of static TLB entries */ + } PPC_MCHSA; +#else /* _ASMLANGUAGE */ +# if (MCHSA_BASE_REG == 0) +# define MCHSA_PFX_SIZE _EXC_OFF_MCHSA +# else /* MCHSA_BASE_REG == 0 */ +# define MCHSA_BR_OFFSET 0 /* save base register */ +# define MCHSA_PFX_SIZE 4 /* sizeof(UINT32) */ +# endif /* MCHSA_BASE_REG == 0 */ +#define MCHSA_RY_OFFSET (MCHSA_PFX_SIZE+0) /* save rY */ +#define MCHSA_CR_OFFSET (MCHSA_PFX_SIZE+4) /* save CR */ +#define MCHSA_MCSR_OFFSET (MCHSA_PFX_SIZE+8) /* MCSR (every MC) */ +#define MCHSA_COUNT_OFFSET (MCHSA_PFX_SIZE+12) /* count of all MC */ +#define MCHSA_FATAL_MCSR_OFFSET (MCHSA_PFX_SIZE+16) /* MCSR (only fatal MC) */ +#define MCHSA_FATAL_COUNT_OFFSET (MCHSA_PFX_SIZE+20) /* count of fatal MC */ +#define MCHSA_LOGGER_OFFSET (MCHSA_PFX_SIZE+24) /* log function */ +#ifdef _PPC_440X5_MCH_SUPPORT_CB_DCACHE +#define MCHSA_DCRSEL_OFFSET (MCHSA_PFX_SIZE+28) /* Dcache line selector */ +#define MCHSA_DCDBTRL_OFFSET (MCHSA_PFX_SIZE+32) /* DCDBTRL value */ +#define MCHSA_DCDBTRH_OFFSET (MCHSA_PFX_SIZE+36) /* DCDBTRH value */ +#define MCHSA_DCVADDR_OFFSET (MCHSA_PFX_SIZE+40) /* v addr for bad line */ +#define MCHSA_DCSRRZ_OFFSET (MCHSA_PFX_SIZE+44) /* work space */ +#define MCHSA_DCPMASK_OFFSET (MCHSA_PFX_SIZE+48) /* work space */ +#endif /* _PPC_440X5_MCH_SUPPORT_CB_DCACHE */ +/* following entries are used for TLB recovery */ +#define MCHSA_RZ_OFFSET (MCHSA_PFX_SIZE+60) /* save rZ */ +#define MCHSA_CTR_OFFSET (MCHSA_PFX_SIZE+64) /* save CTR */ +#define MCHSA_MMUCR_OFFSET (MCHSA_PFX_SIZE+68) /* save MMUCR */ +#define MCHSA_RX_OFFSET (MCHSA_PFX_SIZE+72) /* save rX */ +#define MCHSA_NUMSTAT_OFFSET (MCHSA_PFX_SIZE+76)/* # of static TLB entries */ +#define MCHSA_CACHENAB_OFFSET (MCHSA_PFX_SIZE+80) /* Cache is enabled? */ +#define MCHSA_STAT_TLB_OFFSET (MCHSA_PFX_SIZE+92) /* Static TLB entries */ + /* sizeof(MMU440_PTE) == 16 not 12! */ +#define MCHSA_FIXED_SIZE MCHSA_STAT_TLB_OFFSET + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCexc440x5h */ diff --git a/h/arch/ppc/excPpcLib.h b/h/arch/ppc/excPpcLib.h new file mode 100644 index 0000000..0fd2a7b --- /dev/null +++ b/h/arch/ppc/excPpcLib.h @@ -0,0 +1,483 @@ +/* excPpcLib.h - PowerPC exception library header */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +02d,15jul05,mil General clean up. +02c,22apr04,to PPC970 cleanup +02b,18mar04,rec merge PPC970 changes +02a,26aug04,pch SPR 78780: add notes concerning vector locations. +01z,09jun04,pch add support for PPC440 with hard FP +01y,03may04,dtr Add exception message exchandler install struct. +01x,24mar04,dtr Adding in new struct to support generic TLB and parity + exception handlers. +01w,25feb04,pch SPR 92351: define _EXC_OFF_END for all PPC +01s,07nov02,mil Added support for PPC85XX. +01v,10dec03,jtp Code inspection update: 405 TLB Miss handler relocation +01v,26nov03,pes Correct _WRS_IS_SUPV_EXC macro. +01u,18nov03,pes Add _WRS_IS_SUPV_EXC macro. +01t,10jun03,pch move 440x5 MC handler & save area to not clobber bootline +01s,08jan03,pch Add support for 440x5 core (PPC440GX) +01r,13nov01,yvp Changed _EXC_NEW_OFF_FIT to 0x01180 to make room for extended + vectors. +01q,27aug01,pch Only define _EXC_INFO_* if the corresponding members of + EXC_INFO exist; utilize IVPR/IVOR where available. +01p,15aug01,pch Add PPC440; cleanup +01o,30nov00,s_m fixed bus error handling for 405 +01n,25oct00,s_m renamed PPC405 cpu types +01m,13oct00,sm removed bear and besr from EXC_INFO for 405 since it doesn't + have these regs +01l,30aug00,sm added cases for PPC405 and PPC405F +01k,12mar99,zl added PowerPC 509 and PowerPC 555 support +01j,18aug98,tpr added PowerPC EC 603 support. +01i,06aug97,tam added macro _EXC_NEW_OFF_PIT and _EXC_NEW_OFF_FIT. +01h,20mar97,tam added prototype for excIntCrtConnect (PPC403 specific). +01g,26feb97,tam added support for the 403GC and 403GCX cpus. +01f,20apr96,tpr added excConnect(), excIntConnect(),excVecSet(),excVecGet(), + excVecBaseSet() and excVecBaseGet() prototype. +01e,04mar96,tam added PPC403 support. +01d,14feb96,tpr added PPC604 support. +01c,09feb95,yao added excCrtStub () for PPC403. +01b,07nov94,yao changed PPC403GA to PPC403. cleanup. +01a,07jul94,yao written. +*/ + +#ifndef __INCexcPcLibh +#define __INCexcPcLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* exception information valid bits */ + +#define _EXC_INFO_VEC 0x001 /* vector offset valid */ +#define _EXC_INFO_CIA 0x002 /* curent exception address(pc) valid */ +#define _EXC_INFO_MSR 0x004 /* machine status register valid */ + +#if ((CPU == PPC403) || (CPU == PPC405) || (CPU == PPC405F) || \ + (CPU == PPC440) || (CPU == PPC85XX)) +#define _EXC_INFO_DEAR 0x008 /* data exception address register valid */ +#else /* CPU == PPC4xx, PPC85XX */ +#define _EXC_INFO_DAR 0x008 /* data access register valid */ +#endif /* CPU == PPC4xx, PPC85XX */ + +#define _EXC_INFO_XER 0x010 /* fixed point register valid */ +#define _EXC_INFO_CR 0x020 /* condition register valid */ + +#if ((CPU == PPC403) || (CPU == PPC405)) +#define _EXC_INFO_BEAR 0x040 /* bus error address register valid */ +#define _EXC_INFO_BESR 0x080 /* bus error syndrome register valid */ +#elif (CPU == PPC405F) + /* This setting of _EXC_INFO_BEAR is a change from that used in + * the 405F release, where it was the same as _EXC_INFO_FPCSR + * (clearly broken). + */ +#define _EXC_INFO_FPCSR 0x040 /* fp status register valid */ +#define _EXC_INFO_BEAR 0x080 /* bus error address register valid */ +#elif (CPU == PPC440) + /* Just padding for the 440, unless it has hard FP or is an x5. */ +# ifdef _PPC_MSR_FP +# define _EXC_INFO_FPCSR 0x040 /* fp status register valid */ +# endif /* _PPC_MSR_FP */ +# ifdef PPC_440x5 +# define _EXC_INFO_MCSR 0x080 /* machine check status register valid */ +# define _EXC_INFO_BESR 0x100 /* bus error syndrome register valid */ +# define _EXC_INFO_BEAR 0x200 /* bus error address register valid */ +# endif /* PPC_440x5 */ +#elif (CPU == PPC85XX) +#define _EXC_INFO_SPEFSCR 0x040 /* SPE fp status valid */ +#define _EXC_INFO_ESR 0x080 /* exception syndrome valid */ +#define _EXC_INFO_MCSR 0x100 /* machine chk syndrome valid */ +#else /* CPU == PPC4xx */ +#define _EXC_INFO_FPCSR 0x040 /* fp status register valid */ +#define _EXC_INFO_DSISR 0x080 /* data storage interrupt status reg valid */ +#endif /* CPU == PPC4xx */ + +#define _EXC_INFO_NIA 0x8000 /* pc saved in cia is nia */ + +#define _EXC_INFO_DEFAULT (_EXC_INFO_VEC|_EXC_INFO_CIA|_EXC_INFO_MSR| \ + _EXC_INFO_CR) + +#ifndef _ASMLANGUAGE + +typedef struct + { + UINT32 valid; /* 0x118: indicators that following fields + * are valid */ + UINT32 vecOff; /* 0x11c: vector offset */ + _RType cia; /* 0x120: save/restore reg0 - exception + * address */ + _RType msr; /* 0x124/0x128: save/restore register1 - msr */ + +# ifdef _EXC_INFO_DEAR + _RType dear; /* data exception address register */ + /* 440x5 MC uses this for bear_l */ +# else /* _EXC_INFO_DEAR */ + _RType dar; /* 0x128/0x130: data access register */ +# endif /* _EXC_INFO_DEAR */ + + UINT32 cr; /* 0x12c/0x134: condition register */ + UINT32 xer; /* 0x130/0x138: fixed point exception reg */ + /* 440x5 MC uses this for bear_h */ +# if ((CPU == PPC403) || (CPU == PPC405)) + UINT32 bear; /* bus error address register */ + UINT32 besr; /* bus error syndrome register */ + /* XXX - handling of bus errors is implementation specific on the PPC405 */ +# elif (CPU == PPC405F) + UINT32 fpcsr; /* floating point status reg */ + UINT32 bear; +# elif (CPU == PPC440) + UINT32 pad3; /* 440x5 MC uses this for besr */ + /* 440 w/ FPU uses it for fpcsr unless handling an MC */ +# ifdef PPC_440x5 + UINT32 mcsr; +# else /* PPC_440x5 */ + UINT32 pad4; +# endif /* PPC_440x5 */ + +# elif (CPU == PPC85XX) /* excluding MCSR */ + UINT32 spefscr; /* SPE float-pt status reg */ + UINT32 mcesr; /* MCSR or ESR for either syndrome regs */ +# else /* CPU == PPC4xx */ + UINT32 fpcsr; /* 0x134/0x13c: floating point status reg */ + UINT32 dsisr; /* 0x138/0x140: data storage interrupt + * status reg */ +# endif /* CPU == PPC4xx */ + + } EXC_INFO; + +#define _WRS_IS_SUPV_EXC() \ + (((excInfo.msr & _PPC_MSR_PR) == _PPC_MSR_PR) ? FALSE : TRUE) + +typedef struct genericLayeredExcInstallDesc { + UINT32 excOffset; + UINT32 errExcOffset; + VOIDFUNCPTR funcStart; + VOIDFUNCPTR funcEnd; + char * hdlrCodeBase; + char * hdlrBase; + BOOL forceBase; + char * excMsg; +} GENERIC_LAYERED_EXC_INSTALL_DESC; + +STATUS genericLayeredExcHdlrInstall ( + GENERIC_LAYERED_EXC_INSTALL_DESC * installDesc); + +#endif /* _ASMLANGUAGE */ + +#define _EXC_CODE_SIZE 16 /* size of exc code */ + +#define EXC_VEC_LOW 0x00000 /* lowest vector entry */ +#define EXC_VEC_HIGH 0x02fff /* highest vector entry */ + +#define _PPC_EXC_VEC_BASE_LOW 0x00000000 +#define _PPC_EXC_VEC_BASE_HIGH 0xfff00000 + +/* exception vector offset */ + +#ifdef IVPR +/* + * This processor implements the Book E Interrupt Vector Prefix Register + * and Interrupt Vector Offset Registers, instead of the Exception Vector + * Prefix Register used (with fixed offsets) in older designs. The new + * architecture enables us to locate exception vectors "anywhere". + * + * NOTE: The frameless nesting code in intALib.s requires that "normal" + * (as opposed to "critical") vectors on processors which implement critical + * interrupts be at addresses divisible by 0x0080. + */ +#define _EXC_OFF_CRTL 0x0100 /* Critical Input */ +#define _EXC_OFF_MACH 0x0200 /* Machine Check */ +#define _EXC_OFF_DATA 0x0300 /* Data Storage */ +#define _EXC_OFF_INST 0x0400 /* Instruction Storage */ +#define _EXC_OFF_INTR 0x0500 /* External Input */ +#define _EXC_OFF_ALIGN 0x0600 /* Alignment */ +#define _EXC_OFF_PROG 0x0700 /* Program */ +#define _EXC_OFF_FPU 0x0800 /* Floating Point Unavailable */ +#define _EXC_OFF_SYSCALL 0x0900 /* System Call */ +#define _EXC_OFF_APU 0x0a00 /* Auxiliary Processor Unavailable */ +#define _EXC_OFF_DECR 0x0b00 /* Decrementer */ +#define _EXC_OFF_FIT 0x0c00 /* Fixed Interval Timer */ +#define _EXC_OFF_WD 0x0d00 /* Watchdog Timer */ +#define _EXC_OFF_DATA_MISS 0x0e00 /* Data TLB Error */ +#define _EXC_OFF_INST_MISS 0x0f00 /* Instruction TLB Error */ +#define _EXC_OFF_DBG 0x1000 /* Debug exception */ +#if (CPU == PPC85XX) +#define _EXC_OFF_SPE 0x1100 /* SPE */ +#define _EXC_OFF_VEC_DATA 0x1200 /* vect fp data */ +#define _EXC_OFF_VEC_RND 0x1300 /* vect fp round */ +#define _EXC_OFF_PERF_MON 0x1400 /* performance monitor */ +#define _EXC_OFF_L1_PARITY 0x1500 /* modify IVOR1 here for L1 parity */ +#define _EXC_OFF_END 0x1600 /* end of vectors */ +#else /* CPU == PPC85xx */ +#define _EXC_OFF_END 0x1100 /* end of vectors */ +#endif +#ifdef PPC_440x5 +/* + * Put the handler for the 440x5 core's recoverable Machine Checks at 24KB, + * and its save area at 26KB, so they can be in a different page than the + * other handlers. (16KB -- 0x4000 -- is already in use for the bootline, + * SM anchor, and message area.) Unrecoverable Machine Checks will continue + * to be serviced by the previous handler at 0x0200. + */ +#define _EXC_OFF_MCRECOV 0x6000 /* recoverable Machine Check */ +#define _EXC_OFF_MCHSA 0x6800 /* Machine Check Handler Save Area */ +#endif /* PPC_440x5 */ + +/* Mappings between vector names and corresponding IVORs, for excALib.s */ +#define IVOR0_VAL _EXC_OFF_CRTL /* Critical Input */ +#ifdef PPC_440x5 +#define IVOR1_VAL _EXC_OFF_MCRECOV /* recoverable Machine Check */ +#else /* PPC_440x5 */ +#define IVOR1_VAL _EXC_OFF_MACH /* Machine Check */ +#endif /* PPC_440x5 */ +#define IVOR2_VAL _EXC_OFF_DATA /* Data Storage */ +#define IVOR3_VAL _EXC_OFF_INST /* Instruction Storage */ +#define IVOR4_VAL _EXC_OFF_INTR /* External Input */ +#define IVOR5_VAL _EXC_OFF_ALIGN /* Alignment */ +#define IVOR6_VAL _EXC_OFF_PROG /* Program */ +#define IVOR7_VAL _EXC_OFF_FPU /* Floating Point Unavailable */ +#define IVOR8_VAL _EXC_OFF_SYSCALL /* System Call */ +#define IVOR9_VAL _EXC_OFF_APU /* Auxiliary Processor Unavailable */ +#define IVOR10_VAL _EXC_OFF_DECR /* Decrementer */ +#define IVOR11_VAL _EXC_OFF_FIT /* Fixed Interval Timer */ +#define IVOR12_VAL _EXC_OFF_WD /* Watchdog Timer */ +#define IVOR13_VAL _EXC_OFF_DATA_MISS /* Data TLB Error */ +#define IVOR14_VAL _EXC_OFF_INST_MISS /* Instruction TLB Error */ +#define IVOR15_VAL _EXC_OFF_DBG /* Debug exception */ +#if (CPU == PPC85XX) +#define IVOR32_VAL _EXC_OFF_SPE /* SPE */ +#define IVOR33_VAL _EXC_OFF_VEC_DATA /* vect fp data */ +#define IVOR34_VAL _EXC_OFF_VEC_RND /* vect fp round */ +#define IVOR35_VAL _EXC_OFF_PERF_MON /* performance monitor */ +#endif /* CPU == PPC85xx */ + +#else /* IVPR */ + +#define _EXC_OFF_RES0 0x00000 /* reserved */ +#define _EXC_OFF_RESET 0x00100 /* system reset */ +#define _EXC_OFF_MACH 0x00200 /* machine check */ +#define _EXC_OFF_DATA 0x00300 /* data access */ +#define _EXC_OFF_INST 0x00400 /* instruction access */ +#define _EXC_OFF_INTR 0x00500 /* external interrupt */ +#define _EXC_OFF_ALIGN 0x00600 /* alignment */ +#define _EXC_OFF_PROG 0x00700 /* program */ +#define _EXC_OFF_FPU 0x00800 /* floating point unavailable */ +#define _EXC_OFF_DECR 0x00900 /* decrementer */ +#define _EXC_OFF_RES1 0x00a00 /* reserved */ +#define _EXC_OFF_RES2 0x00b00 /* reserved */ +#define _EXC_OFF_SYSCALL 0x00c00 /* system call */ +#define _EXC_OFF_TRACE 0x00d00 /* trace */ +#define _EXC_OFF_RES3 0x00e00 /* reserved */ + /* exception for PPC601) */ +# if (CPU == PPC860) +#define _EXC_OFF_END 0x01000 /* end of vectors */ +# endif /* (CPU == PPC860) */ + +# if (CPU == PPC970) +#define _EXC_OFF_DATA_SEG 0x00380 /* data segment fault */ +#define _EXC_OFF_INST_SEG 0x00480 /* instruction segment fault */ +#define _EXC_OFF_HYPV_DECR 0x00980 /* hypervisor decrementer */ +#define _EXC_OFF_PERF_MON 0x00f00 /* performance monitor */ +#define _EXC_OFF_INST_BRK 0x01300 /* instruction breakpoint */ +#define _EXC_OFF_SYS_MNG 0x01400 /* system management exception */ +#define _EXC_OFF_SOFT_PATCH 0x01500 /* soft patch */ +#define _EXC_OFF_MAINTENANCE 0x01600 /* maintenance */ +#define _EXC_OFF_VMX_ASSIST 0x01700 /* VMX assist */ +#define _EXC_OFF_THERMAL 0x01800 /* thermal interrupt */ +#define _EXC_OFF_INSTRUMENT 0x02000 /* instrumentation interrupt */ +#define _EXC_OFF_END 0x02100 /* end of vectors */ +# endif /* (CPU == PPC970) */ + +# if (CPU == PPC509) +#undef _EXC_OFF_DATA +#undef _EXC_OFF_INST +#undef _EXC_OFF_RES3 +#define _EXC_OFF_FPA 0x00e00 /* floating point assist */ +#define _EXC_OFF_SW_EMUL 0x01000 /* Software Emulation */ +#define _EXC_OFF_DATA_BKPT 0x01c00 /* Data Breakpoint */ +#define _EXC_OFF_INST_BKPT 0x01d00 /* Instruction Breakpoint */ +#define _EXC_OFF_PERI_BKPT 0x01e00 /* Maskable Dev. Port or + Peripheral Breakpoint */ +#define _EXC_OFF_NM_DEV_PORT 0x01f00 /* Non Maskable develop. port */ +#define _EXC_OFF_END 0x02000 /* end of vectors */ +# endif /* (CPU == PPC509) */ + +# if (CPU == PPC555) +#undef _EXC_OFF_DATA +#undef _EXC_OFF_INST +#undef _EXC_OFF_RES3 +#define _EXC_OFF_FPA 0x00e00 /* floating point assist */ +#define _EXC_OFF_SW_EMUL 0x01000 /* Software Emulation */ +#define _EXC_OFF_IPE 0x01300 /* Instruction protection error */ +#define _EXC_OFF_DPE 0x01400 /* Data protection error */ +#define _EXC_OFF_DATA_BKPT 0x01c00 /* Data Breakpoint */ +#define _EXC_OFF_INST_BKPT 0x01d00 /* Instruction Breakpoint */ +#define _EXC_OFF_PERI_BKPT 0x01e00 /* Maskable Dev. Port or */ + /* Peripheral Breakpoint */ +#define _EXC_OFF_NM_DEV_PORT 0x01f00 /* Non Maskable develop. port */ +#define _EXC_OFF_END 0x02000 /* end of vectors */ +# endif /* (CPU == PPC555) */ + +# if (CPU == PPC601) +#undef _EXC_OFF_RES1 +#define _EXC_OFF_IOERR 0x00a00 /* I/O controller interface error */ +#undef _EXC_OFF_TRACE +#define _EXC_OFF_RES4 0x00d00 /* reserved for mpc601 */ +#define _EXC_OFF_RUN_TRACE 0x02000 /* run-mode/trace exception */ +#define _EXC_OFF_END 0x02100 /* end of vectors */ +# endif /* (CPU == PPC601) */ + +# if ((CPU == PPC603) || (CPU == PPCEC603)) +#define _EXC_OFF_INST_MISS 0x01000 /* instruction translation miss */ +#define _EXC_OFF_LOAD_MISS 0x01100 /* data load translation miss */ +#define _EXC_OFF_STORE_MISS 0x01200 /* data store translation miss */ +# endif /* ((CPU == PPC603) || (CPU == PPCEC603)) */ + +# if ((CPU == PPC603) || (CPU == PPCEC603) || (CPU == PPC604)) +#define _EXC_OFF_INST_BRK 0x01300 /* instruction breakpoint exception */ +#define _EXC_OFF_SYS_MNG 0x01400 /* system management exception */ +#define _EXC_OFF_END 0x01500 /* end of vectors */ +# endif /* ((CPU == PPC603) || (CPU == PPCEC603) || (CPU == PPC604)) */ + +# if ((CPU == PPC403) || (CPU == PPC405) || (CPU == PPC405F)) +#undef _EXC_OFF_RESET +#undef _EXC_OFF_DATA +#undef _EXC_OFF_DECR +#undef _EXC_OFF_TRACE + +#define _EXC_OFF_CRTL 0x00100 /* critical interrupt */ +#define _EXC_OFF_PROT 0x00300 /* protection violation exception */ +#define _EXC_OFF_PIT 0x01000 /* programmable interval timer */ +#define _EXC_OFF_FIT 0x01010 /* fixed interval timer */ +#define _EXC_OFF_WD 0x01020 /* watchdog timer */ +#define _EXC_OFF_DBG 0x02000 /* debug exception */ +#define _EXC_OFF_DATA_MISS 0x01100 /* data translation miss */ +#define _EXC_OFF_INST_MISS 0x01200 /* instruction translation miss */ +#define _EXC_OFF_END 0x01300 /* end of vectors */ + +/* + * The FIT and PIT excConnectCode stubs won't fit at their default locations + * so we need to put them where we've got some available space and jump to + * them from _EXC_OFF_PIT and _EXC_OFF_FIT. + * + * NOTE: The frameless nesting code in intALib.s contains special-case + * handling for relocated "normal" (as opposed to "critical") vectors. + * All relocated normal vectors on processors which implement critical + * interrupts must be handled individually there, and their relocated + * stubs must be at addresses divisible by 0x0080. + */ + +#define _EXC_NEW_OFF_PIT 0x01080 /* programmable interval timer */ +#define _EXC_NEW_OFF_FIT 0x01180 /* fixed interval timer */ +# endif /* CPU == PPC40x */ + +#endif /* IVPR */ + +#ifndef _EXC_OFF_TRACE +/* Processors having no Trace exception handle single step differently */ + +#define BRANCH_MASK 0xF0000000 +#define OP_BRANCH 0x40000000 +#define BCCTR_MASK 0xFC0007FE +#define BCLR_MASK 0xFC0007FE +#define AA_MASK 0x00000002 + +#define BO_NB_BIT 5 /* nb bits of BO field */ +#define CR_NB_BIT 32 /* nb bits of CR register */ + +#define _OP(opcd, xo) ((opcd << 26) + (xo << 1)) + +#define INST_BCCTR _OP(19, 528) /* BCCTR instruction opcode */ +#define INST_BCLR _OP(19, 16) /* BCLR instruction opcode */ + +#define _IFIELD_LI(x) ((0x02000000 & x) ? ((0xf6000000 | x) & ~3) : \ + ((0x03fffffc & x) & ~3)) +#define _IFIELD_BD(x) ((0x00008000 & x) ? (0xffff0000 | (x & ~3)) : \ + (0x0000fffc & x)) + /* ^ signed branch displ */ +#define _IFIELD_BO(x) ((0x03e00000 & x) >> 21) /* branch options */ +#define _IFIELD_BI(x) ((0x001f0000 & x) >> 16) /* branch condition */ + +#define _REG32_BIT(reg, no) (0x00000001 & (reg >> (no))) + /* value of no th bit of the 32 bits register reg */ + /* bit 0 is the LSB */ +#endif /* _EXC_OFF_TRACE */ + +/* SRR1 bit definition for program exception */ + +#ifdef _PPC_MSR_FP +# define _EXC_PROG_SRR1_FPU 0x00100000 /* floating-point enabled */ +#endif /* _PPC_MSR_FP */ +#define _EXC_PROG_SRR1_ILL 0x00080000 /* illegal instruction */ +#define _EXC_PROG_SRR1_PRIV 0x00040000 /* privileged instruction */ +#define _EXC_PROG_SRR1_TRAP 0x00020000 /* trap exception */ +#define _EXC_PROG_SRR1_NIA 0x00010000 /* SRR0 has nia (else cia) */ + +#ifdef _PPC_MSR_CE +/* + * This processor implements "critical" exceptions, + * which use different SRR's than other exceptions. + * Abstract the names of those registers, since they are + * different in the 440 and 85XX than in previous 40x processors. + */ +# ifdef CSRR0 +# define SRR_CI_PC CSRR0 +# else /* CSRR0 */ +# define SRR_CI_PC SRR2 +# endif /* CSRR0 */ + +# ifdef CSRR1 +# define SRR_CI_MSR CSRR1 +# else /* CSRR1 */ +# define SRR_CI_MSR SRR3 +# endif /* CSRR1 */ + +/* Retain earlier names for compatibility */ +# define CRIT_SAVE_PC SRR_CI_PC +# define CRIT_SAVE_MSR SRR_CI_MSR + +#endif /* _PPC_MSR_CE */ + +#ifndef _ASMLANGUAGE + +/* variable declarations */ + +extern FUNCPTR excExcepHook; /* add'l rtn to call when exceptions occur */ + +/* function declarations */ + +extern STATUS excConnect (VOIDFUNCPTR *, VOIDFUNCPTR); +extern STATUS excIntConnect (VOIDFUNCPTR *, VOIDFUNCPTR); +extern void excVecSet (FUNCPTR *, FUNCPTR); +extern FUNCPTR excVecGet (FUNCPTR *); +extern void excVecBaseSet (FUNCPTR *); +extern FUNCPTR * excVecBaseGet (void); + +# ifdef _PPC_MSR_CE +extern STATUS excCrtConnect (VOIDFUNCPTR *, VOIDFUNCPTR); +extern STATUS excIntCrtConnect (VOIDFUNCPTR *, VOIDFUNCPTR); +extern STATUS excIntConnectTimer (VOIDFUNCPTR *, VOIDFUNCPTR); + +# ifdef _PPC_MSR_MCE +extern STATUS excMchkConnect (VOIDFUNCPTR *, VOIDFUNCPTR); +# endif /* _PPC_MSR_MCE */ +# endif /* _PPC_MSR_CE */ + + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCexcPpcLibh */ diff --git a/h/arch/ppc/fppPpcLib.h b/h/arch/ppc/fppPpcLib.h new file mode 100644 index 0000000..54f3573 --- /dev/null +++ b/h/arch/ppc/fppPpcLib.h @@ -0,0 +1,72 @@ +/* fppPpcLib.h - PowerPC floating-point coprocessor support library header */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01d,15sep04,dr changed pad to fpcsrCopy to solve alignment problem in 440EP. +01c,20apr95,yao added padding word to fpContext. added copyright note. +01b,12jan95,caf fixed to reflect 32 registers of 64 bits each. +01a,XXXXXXX,yao written. +*/ + +#ifndef __INCfppPpcLibh +#define __INCfppPpcLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* number of floating-point data registers */ + +#define FP_NUM_DREGS 32 + +#ifndef _ASMLANGUAGE + +typedef struct fpContext /* FP_CONTEXT */ + { + double fpr[FP_NUM_DREGS]; /* 32 doubles : 256 bytes */ + int fpcsr; /* control/status : 4 bytes */ + int fpcsrCopy; /* Control/status reg. copy : 4 bytes */ + } FP_CONTEXT; /* TOTAL : 260 bytes */ + +#define FPREG_SET FP_CONTEXT + +/* variable declarations */ + +extern REG_INDEX fpRegName[]; /* f-point data register table */ +extern REG_INDEX fpCtlRegName[]; /* f-point control register table */ +extern WIND_TCB *pFppTaskIdPrevious; /* task id for deferred exceptions */ +extern FUNCPTR fppCreateHookRtn; /* arch dependent create hook routine */ +extern FUNCPTR fppDisplayHookRtn; /* arch dependent display routine */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT void fppArchInit (void); +IMPORT void fppArchTaskCreateInit (FP_CONTEXT *pFpContext); + +#else /* __STDC__ */ + +IMPORT void fppArchInit (); +IMPORT void fppArchTaskCreateInit (); + +#endif /* __STDC__ */ + + +#endif /* _ASMLANGUAGE */ + +/* define offsets in FP_CONTEXT structure */ + +#define FPX 0x0 +#define FPX_OFFSET(n) (FPX + (n)*8) +#define FPCSR_OFFSET (FPX + (FP_NUM_DREGS)*8) /* offset == 0x100 */ +#define FPCSR_COPY_OFFSET (FPCSR_OFFSET + 4) +#define FPCONTEXT_SIZE 8*(FPNUM_DREGS + 1) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfppPpcLibh */ diff --git a/h/arch/ppc/in_cksum.h b/h/arch/ppc/in_cksum.h new file mode 100644 index 0000000..2fc32cd --- /dev/null +++ b/h/arch/ppc/in_cksum.h @@ -0,0 +1,191 @@ +/* in_cksum.h - ppc version in_cksum routines */ + +/* Copyright 2001-2002 Wind River Systems, Inc. */ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from tahoe: in_cksum.c 1.2 86/01/05 + * from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91 + * from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp + * $FreeBSD: src/sys/ppc/include/in_cksum.h,v 1.5 2000/05/06 18:18:31 jlemon Exp $ + */ +/* +modification history +-------------------- +01e,25aug05,dlk Add section tags. +01d,24mar04,m_h Internet Checksum +01c,17mar04,m_h move to h/arch/ppc, move misc funcs from in_cksum.c +01b,05nov03,rlm Ran batch header update for header re-org. +01a,11jul02,hsh Created from BSD 4.3 +*/ + +#ifndef _MACHINE_IN_CKSUM_H_ +#define _MACHINE_IN_CKSUM_H_ 1 + +#include + +union in_cksum_l_util { + u_int16_t s[2]; + u_int32_t l; +}; + +union in_cksum_q_util { + u_int16_t s[4]; + u_int32_t l[2]; + u_int64_t q; +}; + +#define IN_CKSUM_ADDCARRY(x) (x > 65535 ? x -= 65535 : x) + +#define IN_CKSUM_REDUCE16 \ + { \ + in_cksum_q_util.q = sum; \ + in_cksum_l_util.l = in_cksum_q_util.s[0] + in_cksum_q_util.s[1] + \ + in_cksum_q_util.s[2] + in_cksum_q_util.s[3]; \ + sum = in_cksum_l_util.s[0] + in_cksum_l_util.s[1]; \ + IN_CKSUM_ADDCARRY(sum); \ + } + +#define IN_CKSUM_REDUCE2 {in_cksum_l_util.l = sum; \ + sum = in_cksum_l_util.s[0] + in_cksum_l_util.s[1]; \ + IN_CKSUM_ADDCARRY(sum);} + +/* + * in_addword - Add two 16-bit workd + * + * Add the two 16-bit network-order values, carry, and return. + */ + +static __inline +u_short in_addword + ( + u_short a, + u_short b + ) + { + u_int64_t sum = a + b; + + IN_CKSUM_ADDCARRY(sum); + return (sum); + } + +/* + * in_pseudo - pre-checksum parts of pseudo-header + * + * Compute significant parts of the IPv4 checksum pseudo-header * for use in a + * delayed TCP/UDP checksum calculation. + * + * Args: + * + * src Source IP address + * dst Destination IP address + * lenproto htons(proto-hdr-len + proto-number) + */ + +static __inline +u_short in_pseudo + ( + u_int32_t a, + u_int32_t b, + u_int32_t c + ) + { + u_int64_t sum; + union in_cksum_q_util in_cksum_q_util; + union in_cksum_l_util in_cksum_l_util; + + sum = (u_int64_t) a + b + c; + IN_CKSUM_REDUCE16; + return (sum); + } + + +/* + * in_cksum_update + */ + +static __inline +void in_cksum_update + ( + struct ip *ip + ) + { + int __tmpsum; + __tmpsum = (int)ntohs(ip->ip_sum) + 256; + ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); + } + +/* + * in_cksum_hdr - checksum on header only + * + * It is useful to have an Internet checksum routine which is inlineable + * and optimized specifically for the task of computing IP header checksums + * in the normal case (where there are no options and the header length is + * therefore always exactly five 32-bit words. + */ + +static __inline +u_int in_cksum_hdr + ( + const struct ip *ip + ) + { + register u_int sum = 0; + register u_short *w; + union in_cksum_l_util in_cksum_l_util; + + w = (u_short*) ip; + + sum += w[0]; + sum += w[1]; + sum += w[2]; + sum += w[3]; + sum += w[4]; + + IN_CKSUM_REDUCE2; + + sum += w[5]; + sum += w[6]; + sum += w[7]; + sum += w[8]; + sum += w[9]; + + IN_CKSUM_REDUCE2; + + return ~sum & 0xffff; + + } + +_WRS_FASTTEXT +u_short in_cksum_skip(struct mbuf *m, int len, int skip); + +#endif /* _MACHINE_IN_CKSUM_H_ */ diff --git a/h/arch/ppc/ivPpc.h b/h/arch/ppc/ivPpc.h new file mode 100644 index 0000000..67c7864 --- /dev/null +++ b/h/arch/ppc/ivPpc.h @@ -0,0 +1,74 @@ +/* ivPpc.h - PowerPC interrupt vectors */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,04nov03,kam ISR Object code inspection mods +01e,09dec96,tpr changed _func_intEnableRtn() & _func_intDisableRtn() return + type from void to int. +01d,17jun96,tpr added _func_intXXX prototype. +01c,17jun96,tam used "INUM_TO_IVEC" instead of "IVEC_TO_INUM" for the PPC403 + interrupt vector definitions (spr #6017). +01b,02feb95,yao added vector definition for PPC403. +01a,29may87,yao written. +*/ + +#ifndef __INCivPpch +#define __INCivPpch + +#ifdef __cplusplus +extern "C" { +#endif + +/* macros to convert exception vectors <-> exception numbers */ + +#define EVEC_TO_ENUM(excVec) ((int)(excVec)) +#define ENUM_TO_EVEC(excNum) ((VOIDFUNCPTR *) (excNum)) + +/* macros to convert interrupt vectors <-> interrupt numbers */ + +#define IVEC_TO_INUM(intVec) ((int) (intVec)) +#define INUM_TO_IVEC(intNum) ((VOIDFUNCPTR *) (intNum)) + +/* interrupt vector definitions */ + +#if (CPU==PPC403) +#define _IV_403_CI INUM_TO_IVEC(0) /* critical interrupt */ +#define _IV_403_SRI INUM_TO_IVEC(4) /* serial port receiver int. */ +#define _IV_403_STI INUM_TO_IVEC(5) /* serial port transmiter int.*/ +#define _IV_403_JRI INUM_TO_IVEC(6) /* jtag receiver interrupt */ +#define _IV_403_JTI INUM_TO_IVEC(7) /* jtag transmiter interrupt */ +#define _IV_403_D0I INUM_TO_IVEC(8) /* dma channel 0 interrupt */ +#define _IV_403_D1I INUM_TO_IVEC(9) /* dma channel 1 interrupt */ +#define _IV_403_D2I INUM_TO_IVEC(10) /* dma channel 2 interrupt */ +#define _IV_403_D3I INUM_TO_IVEC(11) /* dma channel 3 interrupt */ +#define _IV_403_E0I INUM_TO_IVEC(27) /* external interrupt 0 */ +#define _IV_403_E1I INUM_TO_IVEC(28) /* external interrupt 1 */ +#define _IV_403_E2I INUM_TO_IVEC(29) /* external interrupt 2 */ +#define _IV_403_E3I INUM_TO_IVEC(30) /* external interrupt 3 */ +#define _IV_403_E4I INUM_TO_IVEC(31) /* external interrupt 4 */ +#endif /* CPU==PPC403 */ + +#ifndef _ASMLANGUAGE + +/* function declarations */ + +IMPORT STATUS (* _func_intConnectRtn) (VOIDFUNCPTR *, VOIDFUNCPTR, int); +IMPORT STATUS (* _func_intDisconnectRtn) (VOIDFUNCPTR *, VOIDFUNCPTR, int); +IMPORT void (* _func_intVecSetRtn) (FUNCPTR *, FUNCPTR ); +IMPORT FUNCPTR (* _func_intVecGetRtn) (FUNCPTR *); +IMPORT void (* _func_intVecBaseSetRtn) (FUNCPTR *); +IMPORT FUNCPTR *(* _func_intVecBaseGetRtn) (void); +IMPORT int (* _func_intLevelSetRtn) (int); +IMPORT int (* _func_intEnableRtn) (int); +IMPORT int (* _func_intDisableRtn) (int); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCivPpch */ diff --git a/h/arch/ppc/mmu405Lib.h b/h/arch/ppc/mmu405Lib.h new file mode 100644 index 0000000..1988626 --- /dev/null +++ b/h/arch/ppc/mmu405Lib.h @@ -0,0 +1,466 @@ +/* mmu405Lib.h - mmu library for PowerPc 405 series */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,19may04,dtr Add additional support for AIM. +01f,09dec03,jtp Code inspection modifications +01e,01dec03,jtp Identify range of valid ASIDs +01d,14nov03,jtp Support variable minimum page size in miss handler & page + tables +01c,12nov03,jtp Parameterize REGION and PAGE table size and offset; + move miss handler parameter support here. +01b,28oct03,jtp Support Base 6 AIM MMU +01a,18jul00,sm written. +*/ + +/* +DESCRIPTION + +This header contains the public interface to the PowerPC 405 Core Memory +Management Library. It also defines private (internal) structures and +macros used to manipulate the 405 MMU. + +Theory: the vmBaseLib and vmLib provide an application programmer +interface to the memory management and protection features of the 405 +MMU. With the help of the aimMmuLib and mmu405Lib layers, a data +structure is maintained which stores per-page attributes: validity, +protection, cacheability, and address translation. This data structure +represents each page as a page table entry (PTE). + +The 405 MMU hardware maintains a cache of 64 Unified Translation +Lookaside Buffer (TLB) Entry registers. When the processor accesses a +memory location and fails to find matching TLB entry, it calls an +interrupt handler to establish a mapping. That miss handler walks the +data structure and copies a PTE into a TLB Entry register. + +This file provides data needed to coordinate the mmu405Lib layer with +the aimMmuLib and vmLib/vmBaseLib layers. + +See also: + VxWorks PowerPC Architecture Supplement, WindRiver + IBM PowerPC 405GP User's Manual, IBM + IBM PowerPC 405CR User's Manual, IBM + IBM PowerPC Npe405H/L User's Manual, IBM + +*/ + +#ifndef __INCmmuPpc405Libh +#define __INCmmuPpc405Libh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +/* + * Number of TLB Entry registers, expressed both as a power of two + * as well as an integer. + */ + +#define N_TLB_ENTRIES_BITS 6 +#define N_TLB_ENTRIES (1 << N_TLB_ENTRIES_BITS) + +/* + * MMU_I_ADDR_TRANS and MMU_D_ADDR_TRANS are used in the mmu405Lib / + * mmuPpcALib & cacheALib call interface. They are not useful at the + * application programming level. + */ + +#define MMU_I_ADDR_TRANS 0 +#define MMU_D_ADDR_TRANS 1 + +/* + * MMU_INST and MMU_DATA are used at the usrMmuInit / mmu405Lib call + * interface. They are not useful at the application programming + * level. + */ + +#define MMU_INST 0x01 +#define MMU_DATA 0x02 + +/* + * MMU_STATE attributes cover, at a minumum, validity, cacheability, and + * protection. In PowerPC the attributes also include guarded (forbids + * speculative access) and memory coherency tagging. + * + * The PowerPC 405GP does not support memory coherency, so setting this + * bit is irrelevant. However, other versions of the 405 core may choose + * to add support. The 405 hardware also supports U0 and E bits but the + * 405 MMU library does not utilize them. + * + * Note: the GLOBAL bit is used for the miss handler and is not used by the + * hardware. + */ + +#define MMU_STATE_VALID 0x00000400 +#define MMU_STATE_VALID_NOT 0x00000000 +#define MMU_STATE_GLOBAL 0x00000800 +#define MMU_STATE_GLOBAL_NOT 0x00000000 +#define MMU_STATE_CACHEABLE 0x00000000 +#define MMU_STATE_CACHEABLE_NOT 0x00000004 +#define MMU_STATE_CACHEABLE_WRITETHROUGH 0x00000008 +#define MMU_STATE_CACHEABLE_COPYBACK 0x00000000 +#define MMU_STATE_MEM_COHERENCY 0x00000002 +#define MMU_STATE_MEM_COHERENCY_NOT 0x00000000 +#define MMU_STATE_GUARDED 0x00000001 +#define MMU_STATE_GUARDED_NOT 0x00000000 +#define MMU_STATE_ENDIAN_LITTLE 0x00001000 +#define MMU_STATE_ISR_CALLABLE 0x00080000 + +#define MMU_STATE_MASK_VALID 0x00000400 +#define MMU_STATE_MASK_GLOBAL 0x00000800 +#define MMU_STATE_MASK_CACHEABLE 0x0000000c +#define MMU_STATE_MASK_MEM_COHERENCY 0x00000002 +#define MMU_STATE_MASK_GUARDED 0x00000001 +#define MMU_STATE_MASK_PROTECTION 0x000003f0 +#define MMU_STATE_MASK_ISR_CALLABLE 0x00080000 + +/* + * Protection Bits + * + * Each TLB entry controls access to one page of memory. The + * protection mode is controlled by 6 bits in the TLB word, split + * into 3 fields. These fields are: + * + * EX - Executable. 1 bit. if 1, page may be executable + * WR - Writable. 1 bit. if 1, page is writable + * ZSEL - Zone Select. 4 bits. Indexes into the Zone Protection Regsiter + * + * The Zone Protection Register (ZPR) is a 32 bit register consisting of + * 16 2-bit fields. It is indexed by a TLB entry's ZSEL field. The value + * of each 2-bit field may be: + * + * 0 - access is Supervisor only, controlled by the EX and WR bits. + * 1 - access is both Supervisor and User, controlled by the EX and WR + * bits. + * 2 - acess is Supervisor RWX, and User controlled by the EX and WR + * bits. + * 3 - access is Supervisor RWX, User RWX. The EX and WR bits are + * ignored. + * + * The 405 MMU also allows any valid page to be read in supervisor mode. + * + * The VxWorks mmu405Lib implementation applies the above TLB entry + * fields and the ZPR register to support page protection. + * + * The ZPR is initialized to have four valid zones, indexed by ZSEL + * values 0, 1, 2, and 3, and containing values of 0, 1, 2, and 3. + * + * The Selected Zone Protection Register bitfields (looked up via the + * TLB ZSEL field) in cooperation with the TLB EX and WR bits, + * implement the following (and only the following) page protections: + * + * EX WR ZPR SupUsr + * 0 0 00 r----- + * 0 1 00 rw---- + * 1 0 00 r-x--- + * 1 1 00 rwx--- + * 0 0 01 r--r-- + * 0 1 01 rw-rw- + * 1 0 01 r-xr-x + * 1 1 01 rwxrwx + * 0 0 10 rwxr-- + * 0 1 10 rwxrw- + * 1 0 10 rwxr-x + * 1 1 10 rwxrwx + * - - 11 rwxrwx + * + * Note that some page protection settings cannot be supported with the + * 405 MMU, in general, the supervisor mode always has more access + * rights than the user mode. + * + * These protection bits (EX, WR, ZSEL 0-3 mapping to ZPR fields 0-3) + * are mapped directly into MMU_STATE_* macros, defined below: + */ + +/* MMU_STATE_* protection mode sub-fields, mapping 1:1 with hardware */ + +#define _MMU_EX 0x00000200 /* executable, modified by ZSEL */ +#define _MMU_WR 0x00000100 /* writable, modified by ZSEL */ +#define _MMU_ZSEL_0 0x00000000 /* SUP (only) R + EX + WR */ +#define _MMU_ZSEL_1 0x00000010 /* SUP & USR both R + EX + WR */ +#define _MMU_ZSEL_2 0x00000020 /* SUP RWX. USR R + EX + WR */ +#define _MMU_ZSEL_3 0x00000030 /* SUP RWX. USR RWX. */ + +#define _MMU_ZSEL_MASK 0x000000f0 /* mask for ZSEL field */ + +/* MMU_STATE_* protection modes macros */ + +#define MMU_STATE_SUP_R (_MMU_ZSEL_0 ) +#define MMU_STATE_SUP_RW (_MMU_ZSEL_0 | _MMU_WR ) +#define MMU_STATE_SUP_RX (_MMU_ZSEL_0 | _MMU_EX) +#define MMU_STATE_SUP_RWX (_MMU_ZSEL_0 | _MMU_WR | _MMU_EX) + +#define MMU_STATE_SUP_R_USR_R (_MMU_ZSEL_1 ) +/* #define MMU_STATE_SUP_RW_USR_R /@ mode not supported */ +/* #define MMU_STATE_SUP_RX_USR_R /@ mode not supported */ +#define MMU_STATE_SUP_RWX_USR_R (_MMU_ZSEL_2 ) + +/* #define MMU_STATE_SUP_R_USR_W /@ mode not supported */ +/* #define MMU_STATE_SUP_RW_USR_W /@ mode not supported */ +/* #define MMU_STATE_SUP_RX_USR_W /@ mode not supported */ +/* #define MMU_STATE_SUP_RWX_USR_W /@ mode not supported */ + +/* #define MMU_STATE_SUP_R_USR_RW /@ mode not supported */ +#define MMU_STATE_SUP_RW_USR_RW (_MMU_ZSEL_1 | _MMU_WR ) +/* #define MMU_STATE_SUP_RX_USR_RW /@ mode not supported */ +#define MMU_STATE_SUP_RWX_USR_RW (_MMU_ZSEL_2 | _MMU_WR ) + +/* #define MMU_STATE_SUP_R_USR_X /@ mode not supported */ +/* #define MMU_STATE_SUP_RW_USR_X /@ mode not supported */ +/* #define MMU_STATE_SUP_RX_USR_X /@ mode not supported */ +/* #define MMU_STATE_SUP_RWX_USR_X /@ mode not supported */ + +/* #define MMU_STATE_SUP_R_USR_RX /@ mode not supported */ +/* #define MMU_STATE_SUP_RW_USR_RX /@ mode not supported */ +#define MMU_STATE_SUP_RX_USR_RX (_MMU_ZSEL_1 | _MMU_EX) +#define MMU_STATE_SUP_RWX_USR_RX (_MMU_ZSEL_2 | _MMU_EX) + +/* #define MMU_STATE_SUP_R_USR_WX /@ mode not supported */ +/* #define MMU_STATE_SUP_RW_USR_WX /@ mode not supported */ +/* #define MMU_STATE_SUP_RX_USR_WX /@ mode not supported */ +/* #define MMU_STATE_SUP_RWX_USR_WX /@ mode not supported */ + +/* #define MMU_STATE_SUP_R_USR_RWX /@ mode not supported */ +/* #define MMU_STATE_SUP_RW_USR_RWX /@ mode not supported */ +/* #define MMU_STATE_SUP_RX_USR_RWX /@ mode not supported */ +#define MMU_STATE_SUP_RWX_USR_RWX (_MMU_ZSEL_3 ) + +/* + * Initial value of the ZPR. + * + * The ZPR, in collusion with the EX and WR bits, is used to set + * MMU page protection attributes. + * + * - Zone 0 is SUP only, controlled by the EX and WR bits. + * - Zone 1 is SUP and USR, controlled by the EX and WR bits. + * - Zone 2 is SUP RWX, and USR controlled by the EX and WR bits. + * - Zone 3 is SUP RWX, USR RWX. + * - Zone 4..15 is SUP only, controlled by the EX and WR bits. + */ + +#define MMU_ZPR_INIT_VAL \ + (0 << 30) | (1 << 28) | (2 << 26) | (3 << 24) | \ + (0 << 22) | (0 << 20) | (0 << 18) | (0 << 16) | \ + (0 << 14) | (0 << 12) | (0 << 10) | (0 << 8) | \ + (0 << 6) | (0 << 4) | (0 << 2) | (0 << 0) + +/* + * MMU_RPN_SHIFT. The 405 TLB entry contains Real Page Number (RPN) and + * Effective Page Number (EPN) fields which store the physical and + * virtual page bits. These fields always begin at the most significant + * bit of the TLB word they are stored in, and the number of significant + * bits depends on the TLB Page Size field. The 405 MMU code only + * supports page sizes that are a multiple of MMU_PAGE_SIZE_4XX_MIN + * bytes. The bit offset to convert a Real or Effective Page Number + * field into a page base address is MMU_RPN_SHIFT. It must also match + * the size of the rpn and epn bitfields in the MMU405_PTE structure, + * below. + */ + +#define MMU_RPN_SHIFT MMU_PAGE_BITS_MIN + + +/* + * Each context's MMU pages are mapped using a two-level page table + * scheme. The level 1 table is called the REGION table and the level + * 2 table is called a PAGE table. + * + * The most significant MMU_REGION_INDEX_BITS bits of the virtual + * address are used as an index into the Region Table. Each entry is of + * size 2 ^ MMU_REGION_ENTRY_BITS, typically a pointer to a PAGE table. + */ + +#define MMU_REGION_INDEX_BITS 10 /* number of bits in index */ +#define MMU_REGION_TBL_ENTRIES (0x1 << MMU_REGION_INDEX_BITS) + /* number of regions in table */ +#define MMU_REGION_ENTRY_BITS 2 /* size in bytes as pwr of 2 */ + +/* + * The next most significant bits of the virtual address are used as an + * index into the Page Table. Note that MMU_PAGE_INDEX_BITS_MAX + * describes the maximum number of bits to be used as a index to look up + * an entry in the page table. Fewer bits may be used if the + * mmu405PageSizeMin is set to a larger hardware-TLB-supported page + * size. + * + * Each entry is of size 2 ^ MMU_PAGE_ENTRY_BITS, which is the size of + * an MMU405_PTE. + */ + +#define MMU_PAGE_INDEX_BITS_MAX 10 /* number of bits in index */ +#define MMU_PAGE_TBL_ENTRIES_MAX (0x1 << MMU_PAGE_INDEX_BITS_MAX) + /* max number of page table entries */ +#define MMU_PAGE_ENTRY_BITS 3 /* MMU405_PTE size in bytes as pwr of 2 */ + +/* + * The remaining bits are the "offset" portion of a virtual address. All + * the most significant bits have been translated as part of the + * virtual->real page number lookup. + * + * The page size is at least MMU_PAGE_SIZE_4XX_MIN, but may be larger if + * mmu405PageSizeMin is set to a larger hardware-TLB-supported page + * size. + */ + +#define MMU_PAGE_BITS_MIN (32 - (MMU_REGION_INDEX_BITS + \ + MMU_PAGE_INDEX_BITS_MAX )) +#define MMU_PAGE_SIZE_4XX_MIN (0x1 << MMU_PAGE_BITS_MIN) + +/* Range of hardware context numbers (PID register & TLB TID field) */ + +#define MMU_ASID_MIN 1 +#define MMU_ASID_MAX 255 +#define MMU_ASID_GLOBAL MMU_ASID_MIN + +/* TLB Miss Handler information */ + +/* Support for miss handler */ + +#define TLB_V_BIT 25 /* valid bit is at bit 25 of word 0 */ +#define TLB_GLOBAL_BIT 28 /* global page map bit is at bit 28 of word 0 */ +#define TLB_LOCK_BIT 29 /* lock page map bit is at bit 29 of word 0 */ +#define TLB_ISR_CALL_BIT 30 /* isr callable bit is at bit 30 of word 0 */ +#define TLB_N_WORDS 2 /* two TLB words, hi (0) and lo (1) */ + +#define TLB_MIN_SUPPORT /* use TLB indexes from 0 to max */ +#undef CACHE_STATE_VAR /* no mod to W, I bits in miss handler */ +#define TID_SOURCE PID /* PID is source of TLB Entry TID field */ +#define MMU405_NUM_LOCKED_ENTRIES 0x6 + +/* page sizes */ + +#define _MMU_TLB_SZ_1K 0x00000000 /* 1KB page size */ +#define _MMU_TLB_SZ_4K 0x00000080 /* 4KB page size */ +#define _MMU_TLB_SZ_16K 0x00000100 /* 16KB page size */ +#define _MMU_TLB_SZ_64K 0x00000180 /* 64KB page size */ +#define _MMU_TLB_SZ_256K 0x00000200 /* 256KB page size */ +#define _MMU_TLB_SZ_1M 0x00000280 /* 1MB page size */ +#define _MMU_TLB_SZ_4M 0x00000300 /* 4MB page size */ +#define _MMU_TLB_SZ_16M 0x00000380 /* 16MB page size */ +#define _MMU_TLB_SZ_MASK 0x00000380 /* mask for page size field */ +#define _MMU_TLB_SZ_SHIFT 7 /* offset of page size field */ + +/****************************************************************************** +* +* Page Table Entry descriptor definition +* +* This PTE stores most of the fields needed to update a TLB entry. Note +* that we store only the 20 most significant bits of the EPN and RPN, +* since we support a minimum page size of 4K. +* +* TLB fields are from ch. 6. PPC405GP Embedded Processor User's Manual, +* Sixth Preliminary Edition (June 2000) +* +* TLB Word 0 (aka TLBHI): +* +* 0 8 16 21 24 26 28 31 +* +---------------.---------------.-----------+---.-+-+-+-+-+-----+ +* | EPN |SIZE |V|E|U|G|-----| +* | | | | |0|L|-----| +* +---------------'---------------'-----------+---'-+-+-+-+-+-----+ +* +* EPN - Effective (Virtual) address Page Number +* SIZE - Page Size - mmu405Lib maps pages of size MMU_PAGE_SIZE. Larger +* sized pages are set up in static TLB mappings in the BSP, +* or may be automatically managed by the AIM MMU for optimized +* mappings. +* V - Valid page bit +* E,U0 - Unused by mmu405Lib and set to zero +* GL - global bit, set to 1 in a page table entry to inform the TLB +* Miss handler that this page is global; i.e. mapped in all +* contexts, that is, a TID=0. This bit is set to 0 before +* writing to the hardware TLB Entry +* +* TLB Word 1 (aka TLBLO): +* +* 0 8 16 21 24 28 31 +* +---------------.---------------.-----------+-+-+-------+-+-+-+-+ +* | RPN |E|W| ZSEL |W|I|M|G| +* | |X|R| | | | | | +* +---------------'---------------'-----------+-+-+-------+-+-+-+-+ +* +* RPN - Real (Physical) address Page Number +* EX - EXecutable, unless altered by zone protection +* WR - WRitable bit, unless altered by zone protection +* ZSEL - Zone SELect - select protection zone bit pairs from ZPR register +* W - Write-Through +* I - Caching Inhibited +* M - Unused by mmu405Lib and 405 hardware, and set to zero +* G - Guarded (Avoid speculative access) +* +*/ + +#ifndef _ASMLANGUAGE + +typedef union mmu405_pte /* Page Table Entry format */ + { + struct /* Bit field desciption */ + { + /* hi word */ + UINT32 epn:20; /* effective page number */ + UINT32 rsvd1:2; /* reserved */ + UINT32 size:3; /* page size (min 4k) */ + UINT32 v:1; /* valid bit */ + UINT32 e:1; /* little endian bit */ + UINT32 u0:1; /* user attribute */ + UINT32 global:1; /* miss hdlr will map page in all contexts */ + UINT32 lock:1; + UINT32 isr:1; + UINT32 rsvd2:1; /* reserved */ + + /* lo word */ + UINT32 rpn:20; /* real page number */ + UINT32 rsvd3:2; /* reserved */ + UINT32 ex:1; /* execute protection */ + UINT32 wr:1; /* write protection */ + UINT32 zsel:4; /* zone protection */ + UINT32 w:1; /* write thru/back */ + UINT32 i:1; /* cache inhibited */ + UINT32 m:1; /* memory coherent */ + UINT32 g:1; /* memory guarded */ + + } field; + + struct + { + UINT32 word0; /* hi word */ + UINT32 word1; /* lo word */ + } words; + + } MMU405_PTE; + + + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS mmu405LibInit (int mmuType, UINT minPageSize); + +#else /* __STDC__ */ + +extern STATUS mmu405LibInit (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmmuPpc405Libh */ + + + + + + + + + + + diff --git a/h/arch/ppc/mmu440Lib.h b/h/arch/ppc/mmu440Lib.h new file mode 100644 index 0000000..e927063 --- /dev/null +++ b/h/arch/ppc/mmu440Lib.h @@ -0,0 +1,508 @@ +/* mmu440Lib.h - mmu library for PowerPc 440 series */ + +/* Copyright 2001-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01l,09feb05,mdo Documentation fix for apigen +01k,11nov04,dtr Add user permission flags for static TLBs. +01j,19may04,dtr Add support for ISR_CALLABLE state. +01i,09apr04,dtr Add in MMU_LOCK mask and bit field in Pte. +01h,09dec03,jtp Code inspection modifications +01g,01dec03,jtp Identify range of valid ASIDs +01f,17nov03,jtp Support variable minimum page size in miss handler & page + tables +01e,12nov03,jtp Parameterize REGION and PAGE table size and offset; + move miss handler parameter support here. +01d,04nov03,jtp Incorporate review feedback +01c,17oct03,sru Updates for Base 6 AIM MMU +01b,06jan03,pch Add support for 440x5 core (PPC440GX) +01a,17apr02,jtp written, based on mmu405Lib.h +*/ + +/* +DESCRIPTION + +This header contains the public interface to the PowerPC 440 Core Memory +Management Library. It also defines private (internal) structures and +macros used to manipulate the 440 MMU. + +Theory: the vmBaseLib and vmLib provide an application programmer +interface to the memory management and protection features of the 440 +MMU. With the help of the aimMmuLib and mmu440Lib layers, a data +structure is maintained which stores per-page attributes: validity, +protection, cacheability, and address translation. This data structure +represents each page as a page table entry (PTE). + +The 440 MMU hardware maintains a cache of 64 Unified Translation +Lookaside Buffer (TLB) Entry registers. When the processor accesses a +memory location and fails to find matching TLB entry, it calls an +interrupt handler to establish a mapping. That miss handler walks the +data structure and copies a PTE into a TLB Entry register. + +The 440 MMU cannot be disabled, but several TLB Entry registers are +reserved at boot time to establish a static memory mapping that supports +low-level interrupt, exception, and MMU page management activities. This +is configured in applications via the sysStaticTlbDesc[] memory array. +The remainder of the TLB Entry registers are available to the +vmLib/vmBaseLib mapping, established via sysPhysMemDesc[]. + +This file provides data needed to coordinate the mmu440Lib layer with +the aimMmuLib and vmLib/vmBaseLib layers, as well as definitions needed +to configure the sysStaticTlbDesc[] array. + +See also: + VxWorks PowerPC Architecture Supplement, WindRiver + IBM PowerPC 440GP User's Manual, IBM + IBM PowerPC 440GX User's Manual, IBM + +*/ + +#ifndef __INCmmuPpc440Libh +#define __INCmmuPpc440Libh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +/* + * Number of TLB Entry registers, expressed both as a power of two + * as well as an integer. + */ + +#define N_TLB_ENTRIES_BITS 6 +#define N_TLB_ENTRIES (1 << N_TLB_ENTRIES_BITS) + +/* + * MMU_I_ADDR_TRANS and MMU_D_ADDR_TRANS are used in the mmu440Lib / + * mmuPpcALib & cacheALib call interface. They are not useful at the + * application programming level. + */ + +#define MMU_I_ADDR_TRANS 0 +#define MMU_D_ADDR_TRANS 1 + +/* + * MMU_INST and MMU_DATA are used at the usrMmuInit / mmu405Lib call + * interface. They are not useful at the application programming + * level. + */ + +#define MMU_INST 0x01 +#define MMU_DATA 0x02 + +/* + * MMU_STATE attributes cover, at a minimum, validity, cacheability, and + * protection. In PowerPC the attributes also include guarded (forbids + * speculative access) and memory coherency tagging. + * + * The PowerPC 440 does not support memory coherency, so setting these + * bits is irrelevant. The 440 hardware also supports U0, U1, U2, U3, and + * E bits but the 440 MMU library does not utilize them. + * + * Note that all of the bits map 1-1 with actual bit offsets in TLB Word + * 2, with the exception of VALIDity bits -- which in the actual + * hardware is stored in TLB Word 0 at a different bit position (see + * MMU_STATE_VALID_SHIFT below). Also note the GLOBAL bit is used for + * the miss handler and is not used by the hardware. + */ + +#define MMU_STATE_VALID 0x00000040 +#define MMU_STATE_VALID_NOT 0x00000000 +#define MMU_STATE_GLOBAL 0x80000000 +#define MMU_STATE_GLOBAL_NOT 0x00000000 +#define MMU_STATE_LOCK 0x00800000 +#define MMU_STATE_UNLOCK 0x00000000 +#define MMU_STATE_CACHEABLE 0x00000000 +#define MMU_STATE_CACHEABLE_NOT 0x00000400 +#define MMU_STATE_CACHEABLE_WRITETHROUGH 0x00000800 +#define MMU_STATE_CACHEABLE_COPYBACK 0x00000000 +#define MMU_STATE_MEM_COHERENCY 0x00000200 +#define MMU_STATE_MEM_COHERENCY_NOT 0x00000000 +#define MMU_STATE_GUARDED 0x00000100 +#define MMU_STATE_GUARDED_NOT 0x00000000 +#define MMU_STATE_ENDIAN_LITTLE 0x00000080 +#define MMU_STATE_ISR_CALLABLE 0x00080000 + +#define MMU_STATE_MASK_VALID 0x00000040 +#define MMU_STATE_MASK_GLOBAL 0x80000000 +#define MMU_STATE_MASK_CACHEABLE 0x00000c00 +#define MMU_STATE_MASK_GUARDED 0x00000100 +#define MMU_STATE_MASK_MEM_COHERENCY 0x00000200 +#define MMU_STATE_MASK_PROTECTION 0x0000003f +#define MMU_STATE_MASK_ISR_CALLABLE 0x00080000 +/* Valid bit in mmu_state is in different bit position and in TLB Word 0 */ + +#define MMU_STATE_VALID_SHIFT 3 + + +/* + * Protection Bits + * + * Each TLB entry controls access to one page of memory. The protection + * mode is controlled by 6 bits in the TLB word, one for each of Read, + * Write, Execute for Supervisor and User. + * + * These protection bits are mapped directly into MMU_STATE_* macros, + * defined below: + */ + +/* MMU_STATE_* protection mode sub-fields, mapping 1:1 with hardware */ + +#define _MMU_UX 0x00000020 +#define _MMU_UW 0x00000010 +#define _MMU_UR 0x00000008 +#define _MMU_SX 0x00000004 +#define _MMU_SW 0x00000002 +#define _MMU_SR 0x00000001 + +#define _MMU_URWX (_MMU_UR | _MMU_UW | _MMU_UX) + +/* MMU_STATE_* protection modes macros */ + +#define MMU_STATE_SUP_R (_MMU_SR) +#define MMU_STATE_SUP_RW (_MMU_SR|_MMU_SW) +#define MMU_STATE_SUP_RX (_MMU_SR| _MMU_SX) +#define MMU_STATE_SUP_RWX (_MMU_SR|_MMU_SW|_MMU_SX) + +#define MMU_STATE_SUP_R_USR_R (MMU_STATE_SUP_R | _MMU_UR) +#define MMU_STATE_SUP_RW_USR_R (MMU_STATE_SUP_RW | _MMU_UR) +#define MMU_STATE_SUP_RX_USR_R (MMU_STATE_SUP_RX | _MMU_UR) +#define MMU_STATE_SUP_RWX_USR_R (MMU_STATE_SUP_RWX | _MMU_UR) + +#define MMU_STATE_SUP_R_USR_W (MMU_STATE_SUP_R | _MMU_UW) +#define MMU_STATE_SUP_RW_USR_W (MMU_STATE_SUP_RW | _MMU_UW) +#define MMU_STATE_SUP_RX_USR_W (MMU_STATE_SUP_RX | _MMU_UW) +#define MMU_STATE_SUP_RWX_USR_W (MMU_STATE_SUP_RWX | _MMU_UW) + +#define MMU_STATE_SUP_R_USR_RW (MMU_STATE_SUP_R | _MMU_UR | _MMU_UW) +#define MMU_STATE_SUP_RW_USR_RW (MMU_STATE_SUP_RW | _MMU_UR | _MMU_UW) +#define MMU_STATE_SUP_RX_USR_RW (MMU_STATE_SUP_RX | _MMU_UR | _MMU_UW) +#define MMU_STATE_SUP_RWX_USR_RW (MMU_STATE_SUP_RWX | _MMU_UR | _MMU_UW) + +#define MMU_STATE_SUP_R_USR_X (MMU_STATE_SUP_R | _MMU_UX) +#define MMU_STATE_SUP_RW_USR_X (MMU_STATE_SUP_RW | _MMU_UX) +#define MMU_STATE_SUP_RX_USR_X (MMU_STATE_SUP_RX | _MMU_UX) +#define MMU_STATE_SUP_RWX_USR_X (MMU_STATE_SUP_RWX | _MMU_UX) + +#define MMU_STATE_SUP_R_USR_RX (MMU_STATE_SUP_R | _MMU_UR | _MMU_UX) +#define MMU_STATE_SUP_RW_USR_RX (MMU_STATE_SUP_RW | _MMU_UR | _MMU_UX) +#define MMU_STATE_SUP_RX_USR_RX (MMU_STATE_SUP_RX | _MMU_UR | _MMU_UX) +#define MMU_STATE_SUP_RWX_USR_RX (MMU_STATE_SUP_RWX | _MMU_UR | _MMU_UX) + +#define MMU_STATE_SUP_R_USR_WX (MMU_STATE_SUP_R | _MMU_UW | _MMU_UX) +#define MMU_STATE_SUP_RW_USR_WX (MMU_STATE_SUP_RW | _MMU_UW | _MMU_UX) +#define MMU_STATE_SUP_RX_USR_WX (MMU_STATE_SUP_RX | _MMU_UW | _MMU_UX) +#define MMU_STATE_SUP_RWX_USR_WX (MMU_STATE_SUP_RWX | _MMU_UW | _MMU_UX) + +#define MMU_STATE_SUP_R_USR_RWX (MMU_STATE_SUP_R | _MMU_URWX) +#define MMU_STATE_SUP_RW_USR_RWX (MMU_STATE_SUP_RW | _MMU_URWX) +#define MMU_STATE_SUP_RX_USR_RWX (MMU_STATE_SUP_RX | _MMU_URWX) +#define MMU_STATE_SUP_RWX_USR_RWX (MMU_STATE_SUP_RWX | _MMU_URWX) + + +/* + * MMU_RPN_SHIFT. The 440 TLB entry contains Real Page Number (RPN) and + * Effective Page Number (EPN) fields which store the physical and + * virtual page bits. These fields always begin at the most significant + * bit of the TLB word they are stored in, and the number of significant + * bits depends on the TLB Page Size field. The 440 MMU code only + * supports page sizes that are a multiple of MMU_PAGE_SIZE_4XX_MIN + * bytes. The bit offset to convert a Real or Effective Page Number + * field into a page base address is MMU_RPN_SHIFT. It must also match + * the size of the rpn and epn bitfields in the MMU440_PTE structure, + * below. + */ + +#define MMU_RPN_SHIFT MMU_PAGE_BITS_MIN + + +/* + * Each context's MMU pages are mapped using a two-level page table + * scheme. The level 1 table is called the REGION table and the level + * 2 table is called a PAGE table. + * + * The most significant MMU_REGION_INDEX_BITS bits of the virtual + * address are used as an index into the Region Table. Each entry is of + * size 2 ^ MMU_REGION_ENTRY_BITS, typically a pointer to a PAGE table. + */ + +#define MMU_REGION_INDEX_BITS 10 /* number of bits in index */ +#define MMU_REGION_TBL_ENTRIES (0x1 << MMU_REGION_INDEX_BITS) + /* number of regions in table */ +#define MMU_REGION_ENTRY_BITS 2 /* size in bytes as pwr of 2 */ + +/* + * The next most significant MMU_PAGE_INDEX_BITS bits of the virtual + * address are used as an index into the Page Table. + * + * The next most significant bits of the virtual address are used as an + * index into the Page Table. Note that MMU_PAGE_INDEX_BITS_MAX + * describes the maximum number of bits to be used as a index to look up + * an entry in the page table. Fewer bits may be used if the + * mmu440PageSizeMin is set to a larger hardware-TLB-supported page + * size. + * + * Each entry is of size 2 ^ MMU_PAGE_ENTRY_BITS, which is the size of + * an MMU440_PTE. + */ + +#define MMU_PAGE_INDEX_BITS_MAX 10 /* number of bits in index */ + +/* max number of page table entries */ + +#define MMU_PAGE_TBL_ENTRIES_MAX (0x1 << MMU_PAGE_INDEX_BITS_MAX) + +/* MMU440_PTE size in bytes as pwr of 2 */ + +#define MMU_PAGE_ENTRY_BITS 4 + +#define MMU440_NO_BITS_PHYS_ADDR 36 /* VM layer needs to know size of + physical address primarily for + contextShow routines */ + +/* Must be at least one for Optimization */ + +#define MMU440_NUM_LOCKED_ENTRIES 0x6 + +/* intLock max size for write */ +#define MAX_PAGE_WRITE_BYTES 0x100 +/* + * The remaining bits are the "offset" portion of a virtual address. All + * the most significant bits have been translated as part of the + * virtual->real page number lookup. + * + * The page size is at least MMU_PAGE_SIZE_4XX_MIN, but may be larger if + * mmu440PageSizeMin is set to a larger hardware-TLB-supported page + * size. + */ + +#define MMU_PAGE_BITS_MIN (32 - (MMU_REGION_INDEX_BITS + \ + MMU_PAGE_INDEX_BITS_MAX )) +#define MMU_PAGE_SIZE_4XX_MIN (0x1 << MMU_PAGE_BITS_MIN) + +/* Range of hardware context numbers (PID register & TLB TID field) */ + +#define MMU_ASID_MIN 1 +#define MMU_ASID_MAX 255 +#define MMU_ASID_GLOBAL MMU_ASID_MIN + +/* TLB Miss Handler information */ + +#define TLB_V_BIT 22 /* valid bit is at bit 22 of word 0 */ +#define TLB_GLOBAL_BIT 0 /* global page map bit is at bit 0 of word 2 */ +#define TLB_LOCK_BIT 1 /* lock page map bit is at bit 1 of word 2 */ +#define TLB_ISR_BIT 2 /* isr bit is at bit 2 of word 2 */ +#define TLB_W_BIT 20 /* writethru bit is at bit 20 of word 2 */ +#define TLB_I_BIT 21 /* cache inhibit bit is at bit 21 of word 2 */ + +#define MMUCR_STID_BIT0 0 +#define MMUCR_STID_BIT7 7 + +#define TLB_N_WORDS 3 /* three TLB words, 0, 1, and 2 */ + +#define TLB_MIN_SUPPORT /* use TLB indexes from mmuPpcTlbMin to max */ +#define CACHE_STATE_VAR cache440Enabled /* if TRUE cache is enabled */ +#define TID_SOURCE MMUCR /* MMUCR is source of TLB Entry TID field */ + +#define MMUCR_STID_MSB 24 /* STID starts at bit 24 of MMUCR */ +#define MMUCR_STID_LSB 31 /* STID ends at bit 31 of MMUCR */ +#define MMUCR_STID_OFFSET 0 /* STID needs no offset to match PID */ + + +/* TLB_ENTRY_DESC page attributes */ + +#define _MMU_TLB_TS_0 0x00000000 /* Translation Space 0 */ +#define _MMU_TLB_TS_1 0x00010000 /* Translation Space 1 */ + +#define _MMU_TLB_SZ_1K 0x00000000 /* 1KB page size */ +#define _MMU_TLB_SZ_4K 0x00000010 /* 4KB page size */ +#define _MMU_TLB_SZ_16K 0x00000020 /* 16KB page size */ +#define _MMU_TLB_SZ_64K 0x00000030 /* 64KB page size */ +#define _MMU_TLB_SZ_256K 0x00000040 /* 256KB page size */ +#define _MMU_TLB_SZ_1M 0x00000050 /* 1MB page size */ +#define _MMU_TLB_SZ_16M 0x00000070 /* 16MB page size */ +#define _MMU_TLB_SZ_256M 0x00000090 /* 256MB page size */ +#define _MMU_TLB_SZ_MASK 0x000000f0 /* mask for page size field */ +#define _MMU_TLB_SZ_SHIFT 4 /* offset of page size field */ + +#define _MMU_TLB_ATTR_W 0x00000800 /* writethrough */ +#define _MMU_TLB_ATTR_I 0x00000400 /* inhibit caching */ +#define _MMU_TLB_ATTR_G 0x00000100 /* guarded */ + +#define _MMU_TLB_PERM_X 0x00000004 /* executable */ +#define _MMU_TLB_PERM_W 0x00000002 /* writable */ +#define _MMU_TLB_PERM_UR 0x00001000 /* user read */ +#define _MMU_TLB_PERM_UW 0x00002000 /* user writable */ +#define _MMU_TLB_PERM_UX 0x00004000 /* user executable */ + +#ifndef _ASMLANGUAGE + +/* +* +* Page Table Entry descriptor definition +* +* The PTE stores most of the fields needed to update a TLB entry. Note +* that we store only the 20 most significant bits of the EPN and RPN (*), +* since we support a minimum page size of 4K. +* +* (*) - the ERPN stores the Extended Real Page Number, which are +* the most significant 4 bits of the 36-bit physical address. +* The RPN contains the most significant 20 bits of the lower +* 32 bits of the 36-bit physical address. +* +* The structure is padded to 16 bytes to simplify calculating the PTE +* offset in the miss handler; it also cache-aligns the loaded PTE which +* may simplify the hardware's access. +* +* TLB fields are from ch. 6. PPC440GP User's Manual, version 7, March +* 2002 +* +* TLB Word 0: +* +* 0 8 16 21 24 31 +* +---------------.---------------.-----------+-+-+-------+-------+ +* | EPN |V|T| SIZE |-------| +* | | |S| |-------| +* +---------------'---------------'-----------+-+-+-------+-------+ +* +* EPN - Effective (Virtual) address Page Number +* V - Valid page bit +* TS - Translation address Space - vmLib/vmBaseLib only manages +* values of '1' -- that is, dynamic mmu page mapping only +* uses MSR[IS,DS] values of 1. TS values of zero are +* only set up in a static TLB mapping in the BSP. TS values +* of 1 may also be set up in static TLB mapping in the BSP, +* or may be set up using the sysPhysMemDesc array. +* SIZE - Page Size - mmu440Lib maps pages of size MMU_PAGE_SIZE. Larger +* sized pages are set up in static TLB mappings in the BSP, +* or may be automatically managed by the AIM MMU for optimized +* mappings. +* +* TLB Word 1: +* +* 0 8 16 21 24 31 +* +---------------.---------------.-----------+---.-------+-------+ +* | RPN |-----------| ERPN | +* | |-----------| | +* +---------------'---------------'-----------+---'-------+-------+ +* +* RPN - Real (Physical) address Page Number +* ERPN - Extended Real Page Number +* +* TLB Word 2: +* +* 0 8 16 24 31 +* +-+-------------.---------------+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +* |G| 0 |U|U|U|U|W|I|M|G|E|-|U|U|U|S|S|S| +* |L| |0|1|2|3| | | | | |-|X|W|R|X|W|R| +* +-+-------------'---------------+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +* +* GL - global bit, set to 1 in a page table entry to inform the TLB +* Miss handler that this page is global; i.e. mapped in all +* contexts, that is, a TID=0. This bit is set to 0 before +* writing to the hardware TLB Entry +* 0 - Field of zeroes +* U0-U3 - Unused by mmu440Lib and set to zero +* W - Write-Through +* I - Caching Inhibited +* M - Unused by mmu440Lib and 440 hardware, and set to zero +* G - Guarded (Avoid speculative access) +* E - Unused by mmu440Lib and set to zero +* UX - User eXecute +* UW - User Write +* UR - User Read +* SX - Supervisor eXecute +* SW - Supervisor Write +* SR - Supervisor Read +*/ + +typedef union mmu440_pte /* Page Table Entry format */ + { + struct /* Bit field description */ + { + /* word 0 */ + UINT32 epn:20; /* effective page number */ + UINT32 rsvd1:2; /* reserved */ + UINT32 v:1; /* valid bit */ + UINT32 ts:1; /* translation space bit */ + UINT32 size:4; /* page size */ + UINT32 rsvd2:4; /* reserved */ + + /* word 1 */ + UINT32 rpn:20; /* real page number */ + UINT32 rsvd3:8; /* reserved */ + UINT32 erpn:4; /* extended real page number */ + + /* word 2 */ + UINT32 global:1; /* miss hdlr will map page in all contexts */ + UINT32 lock:1; /* lock bit label indicating static TLB + used */ + UINT32 isr:1; /* isr bit set indicating no large page + allowed */ + UINT32 rsvd4:13; /* reserved */ + UINT32 u0:1; /* user attribute 0 */ + UINT32 u1:1; /* user attribute 1 */ + UINT32 u2:1; /* user attribute 2 */ + UINT32 u3:1; /* user attribute 3 */ + UINT32 w:1; /* write thru/back */ + UINT32 i:1; /* cache inhibited */ + UINT32 m:1; /* memory coherent */ + UINT32 g:1; /* memory guarded */ + UINT32 e:1; /* little endian bit */ + UINT32 rsvd5:1; /* reserved */ + UINT32 ux:1; /* user execute protection */ + UINT32 uw:1; /* user write protection */ + UINT32 ur:1; /* user read protection */ + UINT32 sx:1; /* supervisor execute protection */ + UINT32 sw:1; /* supervisor write protection */ + UINT32 sr:1; /* supervisor read protection */ + + UINT32 rsvd6:32; /* pad descriptor table to power of 2 */ + + } field; + + struct + { + UINT32 word0; /* word 0 */ + UINT32 word1; /* word 1 */ + UINT32 word2; /* word 2 */ + UINT32 pad0; /* pad word */ + } words; + + } MMU440_PTE; + +/* Translation Table Definition */ + +/* TLB Entry description, used for mmu initialization */ + +typedef struct + { + UINT32 effAddr; /* Effective address of base of page */ + UINT32 realAddrExt; /* 4 MSB of 36-bit real address */ + UINT32 realAddr; /* 32 LSB of 36-bit real address */ + UINT32 attr; /* page attributes */ + } TLB_ENTRY_DESC; + + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS mmu440LibInit (int mmuType, int staticTlbNum, + TLB_ENTRY_DESC * pStaticTlbDesc, UINT minPageSize); + +#else /* __STDC__ */ + +extern STATUS mmu440LibInit (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmmuPpc440Libh */ diff --git a/h/arch/ppc/mmu603Lib.h b/h/arch/ppc/mmu603Lib.h new file mode 100644 index 0000000..c81f529 --- /dev/null +++ b/h/arch/ppc/mmu603Lib.h @@ -0,0 +1,158 @@ +/* mmu603Lib.h - mmuLib header for PowerPC 603 */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,24sep04,zl fixed _MMU_UBAT_BL_MASK. +01e,29apr02,pcs Add defines for the EXTRA BAT support on MPC755/MPC7455. +01d,29sep98,fle doc : made it refgen parsable +01c,12may95,caf removed bogus typedef. +01b,15aug94,caf revised, changed name to mmu603Lib.h. +01a,21apr94,yao written. +*/ + +#ifndef _INCmmu603Libh +#define _INCmmu603Libh + +#ifdef __cplusplus +extern "C" { +#endif + + +#define PAGE_SIZE 4096 /* pages are 4K bytes */ + +#define _MMU_NUM_IBAT 4 /* 4 instr BAT registers */ +#define _MMU_NUM_DBAT 4 /* 4 data BAT registers */ + +#define _MMU_NUM_EXTRA_IBAT 4 /* 4 instr BAT registers */ +#define _MMU_NUM_EXTRA_DBAT 4 /* 4 data BAT registers */ + + +/* _MMU_UBAT Upper BAT Registers */ + +#define _MMU_UBAT_BEPI_MASK 0xfffe0000 /* effective pg index */ +#define _MMU_UBAT_BEPI_SHIFT 17 + +#define _MMU_UBAT_BL_MASK 0x0001fffc /* block size */ +#define _MMU_UBAT_BL_SHIFT 2 +#define _MMU_UBAT_BL_128K 0x00000000 /* block size 128K */ +#define _MMU_UBAT_BL_256K 0x00000004 /* block size 256K */ +#define _MMU_UBAT_BL_512K 0x0000000c /* block size 512K */ +#define _MMU_UBAT_BL_1M 0x0000001c /* block size 1M */ +#define _MMU_UBAT_BL_2M 0x0000003c /* block size 2M */ +#define _MMU_UBAT_BL_4M 0x0000007c /* block size 4M */ +#define _MMU_UBAT_BL_8M 0x000000fc /* block size 8M */ +#define _MMU_UBAT_BL_16M 0x000001fc /* block size 16M */ +#define _MMU_UBAT_BL_32M 0x000003fc /* block size 32M */ +#define _MMU_UBAT_BL_64M 0x000007fc /* block size 64M */ +#define _MMU_UBAT_BL_128M 0x00000ffc /* block size 128M */ +#define _MMU_UBAT_BL_256M 0x00001ffc /* block size 256M */ + +#define _MMU_UBAT_BL_512M 0x00003ffc /* block size 512M */ +#define _MMU_UBAT_BL_1G 0x00007ffc /* block size 1G */ +#define _MMU_UBAT_BL_2G 0x0000fffc /* block size 2G */ +#define _MMU_UBAT_BL_4G 0x0001fffc /* block size 4G */ + +#define _MMU_UBAT_VS 0x00000002 /* supervisor mode valid bit */ + +#define _MMU_UBAT_VP 0x00000001 /* user mode valid bit */ + +/* _MMU_LBAT Lower BAT Registers */ + +#define _MMU_LBAT_BRPN_MASK 0xfffe0000 /* physical block number */ +#define _MMU_LBAT_BRPN_SHIFT 17 + +#define _MMU_LBAT_WIMG_MASK 0x00000078 /* memory/cache access mode */ +#define _MMU_LBAT_WIMG_SHIFT 3 +#define _MMU_LBAT_WRITE_THROUGH 0x00000040 /* W - write-through */ +#define _MMU_LBAT_CACHE_INHIBIT 0x00000020 /* I - caching-inhibited */ +#define _MMU_LBAT_MEM_COHERENT 0x00000010 /* M - memory coherence */ +#define _MMU_LBAT_GUARDED 0x00000008 /* G - guarded (DBAT only) */ + +#define _MMU_LBAT_PP_MASK 0x00000003 /* protection bits */ +#define _MMU_LBAT_PP_SHIFT 0 +#define _MMU_LBAT_PP_NOACC 0x00000000 /* no access */ +#define _MMU_LBAT_PP_RONLY 0x00000001 /* read (b30 is don't-care) */ +#define _MMU_LBAT_PP_RW 0x00000002 /* read/write */ +#define _MMU_LBAT_PP_SHIFT 0 +#define _MMU_LBAT_PP_NOACC 0x00000000 /* no access */ + +#define _MMU_LBAT_BXPN_MASK 0x00000e00 /* Block Extended Physical Page num*/ + /* Bits 0-2 of the physical address*/ +#define _MMU_LBAT_BX_MASK 0x00000004 /* Block Extended Physical Page num*/ + /* Bit 3 of the physical address*/ +#define _MMU_LBAT_BXPN_SHIFT 9 +#define _MMU_LBAT_BX_SHIFT 2 + + +/* _MMU_SEG Segment Descriptors */ + +#define _MMU_SEG_T 0x80000000 /* T=0 for page, T=1 for I/O */ + +#define _MMU_SEG_KS 0x40000000 /* sup-state protect (T=0) */ + +#define _MMU_SEG_KP 0x20000000 /* user-state protect (T=0) */ + +#define _MMU_SEG_N 0x10000000 /* no-execute protect (T=0) */ + +#define _MMU_SEG_VSID_MASK 0x00ffffff /* virtual segment ID (T=0) */ +#define _MMU_SEG_VSID_SHIFT 0 + + +/* _MMU_PTE Page Table Entries */ + +#define _MMU_PTE0_V 0x80000000 /* entry valid (v=1) */ + +#define _MMU_PTE0_VSID_MASK 0x7fffff80 /* virtual segment ID */ +#define _MMU_PTE0_VSID_SHIFT 7 + +#define _MMU_PTE0_H 0x00000040 /* hash function identifier */ + +#define _MMU_PTE0_API_MASK 0x00000003 /* abbreviated page index */ +#define _MMU_PTE0_API_SHIFT 0 + +#define _MMU_PTE1_RPN_MASK 0xfffff000 /* physical page number */ +#define _MMU_PTE1_RPN_SHIFT 12 + +#define _MMU_PTE1_R 0x00000100 /* referenced */ + +#define _MMU_PTE1_C 0x00000080 /* changed */ + +#define _MMU_PTE1_WIMG_MASK 0x00000078 /* memory/cache access mode */ +#define _MMU_PTE1_WIMG_SHIFT 3 +#define _MMU_PTE1_WRITE_THROUGH 0x00000040 /* W - write-through */ +#define _MMU_PTE1_CACHE_INHIBIT 0x00000020 /* I - caching-inhibited */ +#define _MMU_PTE1_MEM_COHERENT 0x00000010 /* M - memory coherence */ +#define _MMU_PTE1_GUARDED 0x00000008 /* G - guarded */ + +#define _MMU_PTE1_PP_MASK 0x00000003 /* page protection */ +#define _MMU_PTE1_PP_SHIFT 0 +#define _MMU_PTE1_PP_00 0x00000000 /* PP bits = 00 */ +#define _MMU_PTE1_PP_01 0x00000001 /* PP bits = 01 */ +#define _MMU_PTE1_PP_10 0x00000002 /* PP bits = 10 */ +#define _MMU_PTE1_PP_11 0x00000003 /* PP bits = 11 */ + + +#ifndef _ASMLANGUAGE + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS mmu603LibInit (int pageSize); + +#else /* __STDC__ */ + +extern STATUS mmu603LibInit (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* _INCmmu603Libh */ diff --git a/h/arch/ppc/mmu800Lib.h b/h/arch/ppc/mmu800Lib.h new file mode 100644 index 0000000..e684f04 --- /dev/null +++ b/h/arch/ppc/mmu800Lib.h @@ -0,0 +1,230 @@ +/* mmuPpc800Lib.h - mmu library for PowerPc 800 series */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,03feb05,mig Code review changes. +01h,19jan05,mig Cleanup +01g,05jan05,mig Fix protection states +01f,22dec04,mig Fix protection states +01e,24nov04,mig Support AIM MMU in VxWorks 6.0 +01d,29nov04,dtr Fix for AIM transition. +01c,13nov03,jtp Support configAll.h change requiring MMU_PAGE_SIZE + definition. +01b,05feb97,tpr removed reserved macro (SPR 7783). +01a,27apr96,tpr written. +*/ + +#ifndef __INCmmuPpc800Libh +#define __INCmmuPpc800Libh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Number of TLB Entry registers, expressed both as a power of two + * as well as an integer. + */ + +#define N_TLB_ENTRIES_BITS 6 +#define N_TLB_ENTRIES (1 << N_TLB_ENTRIES_BITS) + +#define MMU_I_ADDR_TRANS 0 +#define MMU_D_ADDR_TRANS 1 + +#define MMU_INST 0x01 +#define MMU_DATA 0x02 + +#define MMU_ASID_MIN 0 +#define MMU_ASID_MAX 15 + +#define MMU_PAGE_SIZE_4K 0x00001000 +#define MMU_PAGE_SIZE_16K 0x00004000 +#define MMU_PAGE_SIZE_512K 0x00080000 +#define MMU_PAGE_SIZE_8M 0x00800000 +#define MMU_TLB_PAGE_SIZE_4K 0 +#define MMU_TLB_PAGE_SIZE_16K 0 +#define MMU_TLB_PAGE_SIZE_512K 1 +#define MMU_TLB_PAGE_SIZE_8M 3 + +#define MMU_PAGE_SIZE MMU_PAGE_SIZE_4K +#define MMU_PAGE_SIZE_8XX_MIN MMU_PAGE_SIZE + +#define MMU_STATE_VALID 0x00000001 +#define MMU_STATE_VALID_NOT 0x00000000 +#define MMU_STATE_WRITABLE 0x00000002 +#define MMU_STATE_WRITABLE_NOT 0x00000000 +#define MMU_STATE_CACHEABLE 0x00000000 +#define MMU_STATE_CACHEABLE_NOT 0x00000004 +#define MMU_STATE_CACHEABLE_WRITETHROUGH 0x00000008 +#define MMU_STATE_CACHEABLE_COPYBACK 0x00000000 +#define MMU_STATE_GUARDED 0x00000010 +#define MMU_STATE_GUARDED_NOT 0x00000000 + +#define MMU_STATE_MASK_VALID 0x00000001 +#define MMU_STATE_MASK_WRITABLE 0x00000002 +#define MMU_STATE_MASK_CACHEABLE 0x0000000c +#define MMU_STATE_MASK_GUARDED 0x00000010 +#define MMU_STATE_MASK_PROTECTION 0x00000700 +#define MMU_STATE_MASK_WRITEABLE_NOT 0x00000400 +#define MMU_RPN_SHIFT 0x0000000c +#define MMU_PROT_SHIFT 0x00000008 +#define MMU_PP_MASK 0x00000003 + +#define MMU_STATE_SUP_RWX 0x00000000 +#define MMU_STATE_SUP_RWX_USR_RX 0x00000100 +#define MMU_STATE_SUP_RWX_USR_RWX 0x00000200 +#define MMU_STATE_SUP_RX_USR_RX 0x00000300 +#define MMU_STATE_SUP_RX 0x00000400 + +/* + * Each context's MMU pages are mapped using a two-level page table + * scheme. The level 1 table is called the REGION table and the level + * 2 table is called a PAGE table. + * + * The most significant MMU_REGION_INDEX_BITS bits of the virtual + * address are used as an index into the Region Table. Each entry is of + * size 2 ^ MMU_REGION_ENTRY_BITS, typically a pointer to a PAGE table. + */ + +#define MMU_REGION_INDEX_BITS 10 /* number of bits in index */ +#define MMU_REGION_TBL_ENTRIES (0x1 << MMU_REGION_INDEX_BITS) + /* number of regions in table */ +#define MMU_REGION_ENTRY_BITS 2 /* size in bytes as pwr of 2 */ +#define MMU_REGION_INDEX_MASK 0xFFC00000 +#define MMU_REGION_INDEX_SHIFT 22 + +/* + * The next most significant MMU_PAGE_INDEX_BITS bits of the virtual + * address are used as an index into the Page Table. + */ + +#define MMU_PAGE_INDEX_BITS 10 /* number of bits in index */ + +/* max number of page table entries */ + +#define MMU_PAGE_TBL_ENTRIES (0x1 << MMU_PAGE_INDEX_BITS) + +#ifndef _ASMLANGUAGE + +/* Effective Address Definition */ + +typedef union effectiveAddr /* effective Address structure */ + { + struct + { + u_int l1index:10; /* Level 1 Index */ + u_int l2index:10; /* Level 2 Index */ + u_int po:12; /* Page Offset */ + } field; + + void * effAddr; + + } EFFECTIVE_ADDR; + +/* Real Address Definition */ + +typedef union realAddress /* Real Address Structure */ + { + struct /* Bit field description */ + { + u_int rpn:20; /* Real Page Number */ + u_int po:12; /* Page Offset */ + }field; + + void * realAddr; /* Real Address */ + + } REAL_ADDRESS; + +/* Level 1 Descriptor Definition */ + +typedef union level_1_desc /* Level 1 descriptor format */ + { + struct /* Bit field desciption */ + { + u_int l2ba:20; /* Level 2 table Base Address */ + u_int reserved:3; /* Reserved */ + u_int apg:4; /* Access Protection Group */ + u_int g:1; /* Guarded storage attribute for entry */ + u_int ps:2; /* Page Size level one */ + u_int wt:1; /* Write Through attribute for entry */ + u_int v:1; /* Segment Valid bit */ + } field; + + u_int l1desc; /* Level 1 descriptor */ + + } LEVEL_1_DESC; + +/* Level 1 Table pointer definition */ + +typedef union level_1_tbl_ptr /* Level 1 Table pointer structure */ + { + struct /* Bit field description */ + { + u_int l1tb:20; /* Level 1 table Base */ + u_int l1index:10; /* Level 1 table Index */ + u_int reserved:2; /* Reserved */ + } field; + + LEVEL_1_DESC * pL1Desc; /* Level 1 descriptor table pointer */ + + } LEVEL_1_TBL_PTR; + +/* Level 2 descriptor definition */ + +typedef union level_2_desc /* Level 2 descriptor format */ + { + struct /* Bit field desciption */ + { + u_int rpn:20; /* Real Page Number */ + u_int pp:2; /* Page Protection */ + u_int ppe:1; /* Page Protection encoding */ + u_int c:1; /* Change bit */ + u_int spv:4; /* Sub Page Valid */ + u_int sps:1; /* Small Page Size */ + u_int sh:1; /* Shared Page */ + u_int ci:1; /* Cache Inhibit */ + u_int v:1; /* Page Valid bit */ + } field; + + u_int l2desc; /* Level 2 descriptor */ + + } LEVEL_2_DESC; + +/* Level 2 Table pointer definition */ + +typedef union level_2_tbl_ptr /* Level 2 Table pointer structure */ + { + struct /* Bit field description */ + { + u_int l2tb:20; /* Level 2 Table Base */ + u_int l2index:10; /* Level 2 table Index */ + u_int reserved:2; /* Reserved */ + } field; + + LEVEL_2_DESC * pL2Desc; /* Level 2 descriptor table pointer */ + + } LEVEL_2_TBL_PTR; + +#define MMU8XX_PTE LEVEL_2_DESC + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS mmu800LibInit (int mmuType); + +#else /* __STDC__ */ + +extern STATUS mmu800LibInit (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmmuPpc800Libh */ diff --git a/h/arch/ppc/mmuArchVars.h b/h/arch/ppc/mmuArchVars.h new file mode 100644 index 0000000..c934e5f --- /dev/null +++ b/h/arch/ppc/mmuArchVars.h @@ -0,0 +1,38 @@ +/* mmuArchVars.h - globals for PowerPC MMU */ + +/* Cpoyright 1998 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,12nov98,elg modified to have coding conventions +01a,06nov98,elg written +*/ + +/* +DESCRIPTION +This module contains external variables declarations of MMU library that are +used by other libraries even when MMU is disabled in the BSP. +On CPUs that do not support MMU or when MMU is not used, the following variables +assume that MMU is disabled. +*/ + +#ifndef __INCmmuArchVarsh +#define __INCmmuArchVarsh + +#ifdef __cplusplus +extern "C" { +#endif + +/* externals */ + +IMPORT BOOL mmuPpcIEnabled; /* Instruction MMU Status */ +IMPORT BOOL mmuPpcDEnabled; /* Data MMU Status */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmmuArchVarsh */ diff --git a/h/arch/ppc/mmuE500Lib.h b/h/arch/ppc/mmuE500Lib.h new file mode 100644 index 0000000..3ca7757 --- /dev/null +++ b/h/arch/ppc/mmuE500Lib.h @@ -0,0 +1,439 @@ +/* mmuE500Lib.h - mmu library for PowerPC E500 series */ + +/* Copyright 2001-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,19jul05,dtr Implement 36bit rpn. +01h,11nov04,dtr Add user permission flags for static TLBs. +01g,07oct04,mdo Documentation fixes for apigen. +01f,09apr04,dtr Add in MMU_LOCK mask and bit field in Pte. +01e,18mar04,dtr Mods fixes after formal inspection. +01d,09feb04,dtr Fix protection bits. +01c,30jan04,mil Updated for Base6. +01b,13jun03,mil Added TLB sizes. +01a,07jan03,dtr Adding support for static TLB entries. +*/ + +/* +DESCRIPTION + +This header contains the public interface to the PowerPC E500 Core Memory +Management Library. It also defines private (internal) structures and +macros used to manipulate the E500 MMU. + +Theory: the vmBaseLib and vmLib provide an application programmer +interface to the memory management and protection features of the E500 +MMU. With the help of the aimMmuLib and mmuE500Lib layers, a data +structure is maintained which stores per-page attributes: validity, +protection, cacheability, and address translation. This data structure +represents each page as a page table entry (PTE). + +The E500 MMU has two levels. In level 1, instruction and data are +split, while they are unified in level 2. Level 1 is maintained by +the hardware and level 2 is maintained by the OS. The number of entries +are as follows: + +Name Level Type No of pg sizes Assoc #entries filled by +I-L1VSP L1 Instr 9 Full 4 TLB1 hit +I-L1TLB4K L1 Instr 1(4k) 4-way 64 TLB0 hit +D-L1VSP L1 Data 9 Full 4 TLB1 hit +D-L1TLB4K L1 Data 1(4k) 4-way 64 TLB0 hit +TLB1 L2 I/D 9 Full 16 s/w tlbwe +TLB0 L2 I/D 1(4k) 2-way 256 s/w tlbwe + +The VSP (variable sized page) are used as static entries like the BATs, +while the 4k page are dynamic entries that gets loaded with the PTEs. +When a TLB miss occur in TLB0, an exception occurs and the OS walks the +data structure and copies a PTE into a TLB0 entry. Hence, TLB1 is +filled with mapping from the sysStaticTlbDesc[] array, and TLB0 is +filled with mapping from the sysPhysMemDesc[] array. + +Note that the E500 MMU cannot be turned off. Translation occurs at +all time, which it uses also the IS and DS bits while deciding a hit. +Real mode is simulated with both IS and DS bits set to zero. + +This file provides data needed to coordinate the mmuE500Lib layer with +the aimMmuLib and vmLib/vmBaseLib layers, as well as definitions needed +to configure the sysStaticTlbDesc[] array. +*/ + +#ifndef __INCmmuE500Libh +#define __INCmmuE500Libh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define N_TLB_ENTRIES_BITS 8 /* # TLB0: read TLB0CFG */ +#define N_TLB_ENTRIES 256 /* # TLB0: read TLB0CFG */ + +#define MMU_PAGE_SIZE 0x1000 /* pages are 4K bytes */ + +/* + * MMU_I_ADDR_TRANS and MMU_D_ADDR_TRANS are used in the mmuE500Lib / + * mmuPpcALib & cacheALib call interface. They are not useful at the + * application programming level. + */ + +#define MMU_I_ADDR_TRANS 0 +#define MMU_D_ADDR_TRANS 1 + +/* + * MMU_INST and MMU_DATA are used at the usrMmuInit + * interface. They are not useful at the application programming + * level. + */ + +#define MMU_INST 0x01 +#define MMU_DATA 0x02 + +/* + * MMU_STATE attributes + * + */ + +/* V, WIMGE bits */ + +#define MMU_STATE_VALID 0x80000000 +#define MMU_STATE_VALID_NOT 0x00000000 +#define MMU_STATE_LOCK 0x00800000 +#define MMU_STATE_UNLOCK 0x00000000 +#define MMU_STATE_CACHEABLE_WRITETHROUGH 0x00000010 +#define MMU_STATE_CACHEABLE_COPYBACK 0x00000000 +#define MMU_STATE_CACHEABLE 0x00000000 +#define MMU_STATE_CACHEABLE_NOT 0x00000008 +#define MMU_STATE_MEM_COHERENCY 0x00000004 +#define MMU_STATE_MEM_COHERENCY_NOT 0x00000000 +#define MMU_STATE_GUARDED 0x00000002 +#define MMU_STATE_GUARDED_NOT 0x00000000 +#define MMU_STATE_ENDIAN_BIG 0x00000000 +#define MMU_STATE_ENDIAN_LITTLE 0x00000001 + +#define MMU_STATE_MASK_VALID 0x80000000 +#define MMU_STATE_MASK_LOCK 0x00800000 +#define MMU_STATE_MASK_WIMG 0x0000001F +#define MMU_STATE_MASK_WRITETHROUGH 0x00000010 +#define MMU_STATE_MASK_CACHEABLE 0x00000018 +#define MMU_STATE_MASK_MEM_COHERENCY 0x00000004 +#define MMU_STATE_MASK_GUARDED 0x00000002 +#define MMU_STATE_MASK_ENDIAN 0x00000001 + +/* UX/SX, UW/SW, UR/SR bits */ + + /* drice - need to look at these values */ +#define MMU_STATE_EXECUTE 0x00003000 +#define MMU_STATE_EXECUTE_NOT 0x00000000 +#define MMU_STATE_WRITABLE 0x00000c00 +#define MMU_STATE_WRITABLE_NOT 0x00000000 +#define MMU_STATE_MASK_EXECUTE 0x00003000 +#define MMU_STATE_MASK_WRITABLE 0x00000c00 +#define MMU_STATE_MASK_WRITABLE_EXECUTE 0x00003c00 +#define MMU_STATE_MASK_WIMG_WRITABLE_EXECUTE 0x00000000 +#define MMU_STATE_MASK_PROTECTION 0x00003f00 +#define MMU_STATE_PROTECTION_BIT_SHIFT 8 +/* + * The next most significant MMU_PAGE_INDEX_BITS bits of the virtual + * address are used as an index into the Page Table. + * + * The next most significant bits of the virtual address are used as an + * index into the Page Table. Note that MMU_PAGE_INDEX_BITS_MAX + * describes the maximum number of bits to be used as a index to look up + * an entry in the page table. + * + * Each entry is of size 2 ^ MMU_PAGE_ENTRY_BITS, which is the size of + * an MMUE500_PTE. + */ + +#define MMU_PAGE_INDEX_BITS_MAX 10 /* number of bits in index */ +#define MMU_PAGE_TBL_ENTRIES_MAX (0x1 << MMU_PAGE_INDEX_BITS_MAX) + /* max number of page table entries */ +#define MMU_PAGE_ENTRY_BITS 4 /* MMUE500_PTE size in bytes as pwr of 2 */ + +/* + * Each context's MMU pages are mapped using a two-level page table + * scheme. The level 1 table is called the REGION table and the level + * 2 table is called a PAGE table. + * + * The most significant MMU_REGION_INDEX_BITS bits of the virtual + * address are used as an index into the Region Table. Each entry is of + * size 2 ^ MMU_REGION_ENTRY_BITS, typically a pointer to a PAGE table. + */ + +#define MMU_REGION_INDEX_BITS 10 /* number of bits in index */ +#define MMU_REGION_TBL_ENTRIES (0x1 << MMU_REGION_INDEX_BITS) + /* number of regions in table */ +#define MMU_REGION_ENTRY_BITS 2 /* size in bytes as pwr of 2 */ + +#if defined(PPC_e500v2) +#define MMUE500_NO_BITS_PHYS_ADDR 36 +#endif + +/* + * Protection Bits + * + * Each TLB entry controls access to one page of memory. The protection + * mode is controlled by 6 bits in the TLB word, one for each of Read, + * Write, Execute for Supervisor and User. + * + * These protection bits are mapped directly into MMU_STATE_* macros, + * defined below: + */ + +/* MMU_STATE_* protection mode sub-fields, mapping <<8 with hardware */ + +#define _MMU_UX 0x00002000 +#define _MMU_SX 0x00001000 +#define _MMU_UW 0x00000800 +#define _MMU_SW 0x00000400 +#define _MMU_UR 0x00000200 +#define _MMU_SR 0x00000100 + +#define _MMU_URWX (_MMU_UR | _MMU_UW | _MMU_UX) + +/* MMU_STATE_* protection modes macros */ + +#define MMU_STATE_SUP_R (_MMU_SR) +#define MMU_STATE_SUP_RW (_MMU_SR|_MMU_SW) +#define MMU_STATE_SUP_RX (_MMU_SR| _MMU_SX) +#define MMU_STATE_SUP_RWX (_MMU_SR|_MMU_SW|_MMU_SX) + +#define MMU_STATE_SUP_R_USR_R (MMU_STATE_SUP_R | _MMU_UR) +#define MMU_STATE_SUP_RW_USR_R (MMU_STATE_SUP_RW | _MMU_UR) +#define MMU_STATE_SUP_RX_USR_R (MMU_STATE_SUP_RX | _MMU_UR) +#define MMU_STATE_SUP_RWX_USR_R (MMU_STATE_SUP_RWX | _MMU_UR) + +#define MMU_STATE_SUP_R_USR_W (MMU_STATE_SUP_R | _MMU_UW) +#define MMU_STATE_SUP_RW_USR_W (MMU_STATE_SUP_RW | _MMU_UW) +#define MMU_STATE_SUP_RX_USR_W (MMU_STATE_SUP_RX | _MMU_UW) +#define MMU_STATE_SUP_RWX_USR_W (MMU_STATE_SUP_RWX | _MMU_UW) + +#define MMU_STATE_SUP_R_USR_RW (MMU_STATE_SUP_R | _MMU_UR | _MMU_UW) +#define MMU_STATE_SUP_RW_USR_RW (MMU_STATE_SUP_RW | _MMU_UR | _MMU_UW) +#define MMU_STATE_SUP_RX_USR_RW (MMU_STATE_SUP_RX | _MMU_UR | _MMU_UW) +#define MMU_STATE_SUP_RWX_USR_RW (MMU_STATE_SUP_RWX | _MMU_UR | _MMU_UW) + +#define MMU_STATE_SUP_R_USR_X (MMU_STATE_SUP_R | _MMU_UX) +#define MMU_STATE_SUP_RW_USR_X (MMU_STATE_SUP_RW | _MMU_UX) +#define MMU_STATE_SUP_RX_USR_X (MMU_STATE_SUP_RX | _MMU_UX) +#define MMU_STATE_SUP_RWX_USR_X (MMU_STATE_SUP_RWX | _MMU_UX) + +#define MMU_STATE_SUP_R_USR_RX (MMU_STATE_SUP_R | _MMU_UR | _MMU_UX) +#define MMU_STATE_SUP_RW_USR_RX (MMU_STATE_SUP_RW | _MMU_UR | _MMU_UX) +#define MMU_STATE_SUP_RX_USR_RX (MMU_STATE_SUP_RX | _MMU_UR | _MMU_UX) +#define MMU_STATE_SUP_RWX_USR_RX (MMU_STATE_SUP_RWX | _MMU_UR | _MMU_UX) + +#define MMU_STATE_SUP_R_USR_WX (MMU_STATE_SUP_R | _MMU_UW | _MMU_UX) +#define MMU_STATE_SUP_RW_USR_WX (MMU_STATE_SUP_RW | _MMU_UW | _MMU_UX) +#define MMU_STATE_SUP_RX_USR_WX (MMU_STATE_SUP_RX | _MMU_UW | _MMU_UX) +#define MMU_STATE_SUP_RWX_USR_WX (MMU_STATE_SUP_RWX | _MMU_UW | _MMU_UX) + +#define MMU_STATE_SUP_R_USR_RWX (MMU_STATE_SUP_R | _MMU_URWX) +#define MMU_STATE_SUP_RW_USR_RWX (MMU_STATE_SUP_RW | _MMU_URWX) +#define MMU_STATE_SUP_RX_USR_RWX (MMU_STATE_SUP_RX | _MMU_URWX) +#define MMU_STATE_SUP_RWX_USR_RWX (MMU_STATE_SUP_RWX | _MMU_URWX) + +/* RPN field offset in TLB Word 0 (left shift this number of bits) */ + +#define MMU_RPN_SHIFT 12 + +/* TLB_ENTRY_DESC page attributes */ + +#define _MMU_TLB_TS_0 0x00000000 /* Translation Space 0 */ +#define _MMU_TLB_TS_1 0x00001000 /* Translation Space 1 */ + +#define _MMU_TLB_SZ_4K 0x00000100 /* 4KB page size */ +#define _MMU_TLB_SZ_16K 0x00000200 /* 16KB page size */ +#define _MMU_TLB_SZ_64K 0x00000300 /* 64KB page size */ +#define _MMU_TLB_SZ_256K 0x00000400 /* 256KB page size */ +#define _MMU_TLB_SZ_1M 0x00000500 /* 1MB page size */ +#define _MMU_TLB_SZ_4M 0x00000600 /* 4MB page size */ +#define _MMU_TLB_SZ_16M 0x00000700 /* 16MB page size */ +#define _MMU_TLB_SZ_64M 0x00000800 /* 64MB page size */ +#define _MMU_TLB_SZ_256M 0x00000900 /* 256MB page size */ +#define _MMU_TLB_SZ_1G 0x00000a00 /* 1GB page size */ +#define _MMU_TLB_SZ_MASK 0x00000f00 /* mask for page size field */ +#define _MMU_TLB_SZ_SHIFT 8 /* offset of page size field */ + +#define _MMU_TLB_ATTR_W 0x00000010 /* writethrough */ +#define _MMU_TLB_ATTR_I 0x00000008 /* inhibit caching */ +#define _MMU_TLB_ATTR_M 0x00000004 /* memory coherency */ +#define _MMU_TLB_ATTR_G 0x00000002 /* guarded */ +#define _MMU_TLB_ATTR_E 0x00000001 /* endianess */ + +#define _MMU_TLB_PERM_X 0x00000020 /* executable */ +#define _MMU_TLB_PERM_W 0x00000040 /* writable */ +#define _MMU_TLB_IPROT 0x00000080 /* invalidate protection */ +#define _MMU_TLB_PERM_UR 0x00010000 /* user read */ +#define _MMU_TLB_PERM_UW 0x00020000 /* user write */ +#define _MMU_TLB_PERM_UX 0x00040000 /* user execute */ + +#define TLB_GLOBAL_BIT 25 /* global page map bit is at bit 0 of word 2 */ +#define TLB_LOCK_BIT 26 /* lock page map bit is at bit 1 of word 2 */ + + +#define MMUE500_NUM_STATIC_TLB_ENTIRES 0x10 + +#ifndef _ASMLANGUAGE + + +/* +* +* E500 PTE descriptor definition +* This stores most of the fields needed to update a TLB entry. Note that +* we store only 20 bits of the epn, since we support a minimum page size +* of 4K only. ERPN and variable page sizes are currently unimplemented. +* +* TLB fields are from ch. 6. PPCE500GP User's Manual, version 7, March +* 2002 +* +* TLB Word 0: +* +* 0 1 8 16 19 20 24 31 +* 32 33 34 40 48 51 52 56 63 +* +-+-----+-+-+-+-+-+-'-+-+-+-+-+-+-+-'-+-+-+-+-+-+-+-'-+-+-+-+-+-+-+-+ +* |V|IPROT| | TID | |T| TSIZE | | +* | | | | | |S| | | +* +-+-----+-----------'---------------'---------------'-+-+-+-+-+-+-+-+ +* +* V - TLB Valid bit +* IPROT - Invalidate protect +* TID - Translation ID +* TS - Translation space +* TSIZE - Translation size +* +* +* TLB Word 1: +* +* 0 8 16 20 22 25 31 +* 32 40 48 52 54 57 63 +* +-+-+-+-+-+-+-+-'-+-+-+-+-+-+-+-'-+-+-+-+-+-+---+-'-+-+-+-+-+-+-+-+ +* | EPN | |SHA| |X|X|W|I|M|G|E| +* | | |REN| |1|0| | | | | | +* +---------------'---------------'-------+-+-+---+-'-+-+-+-+-+-+-+-+ +* +* EPN - Effective (Virtual) address Page Number +* SHAREN - Enable cache fills to use shared cache state +* X0-X1 - Implementation dependant page attribute +* W - Write-Through +* I - Caching Inhibited +* M - Memory Coherency required +* G - Guarded +* E - Endianess (Unused and set to zero.) +* +* +* TLB Word 2: +* +* 0 8 16 20 22 26 31 +* 32 40 48 52 54 58 63 +* +-+-+-+-+-+-+-+-'-+-+-+-+-+-+-+-'-+-+-+-+-+-+-+-'-+-+-+-+-+-+-+-+ +* | RPN | | U0-U3 |U|S|U|S|U|S| +* | | | |X|X|W|W|R|R| +* +---------------'---------------'-------+-+-+-+-'-+-+-+-+-+-+-+-+ +* +* RPN - Real (Physical) address Page Number +* U0-U3 - User bits +* UX - User execute permission +* SX - Supervisor execute permission +* UW - User write permission +* SW - Supervisor write permission +* UR - User read permission +* SR - Supervisor read permission +* +* +*/ + +typedef union e500_pte /* e500 pte format */ + { + struct /* Bit field description */ + { + /* word 0 */ + UINT32 v:1; /* valid bit */ + UINT32 iprot:1; /* invalidate protect bit */ + UINT32 rsvd1:6; /* reserved */ + UINT32 tid:8; /* translation ID */ + UINT32 rsvd2:3; /* reserved */ + UINT32 ts:1; /* translation space */ + UINT32 tsize:4; /* translation size */ + UINT32 rsvd3:8; /* reserved */ + + /* word 1 */ + UINT32 epn:20; /* effective page number */ + UINT32 rsvd4:2; /* reserved */ + UINT32 sharen:1; /* enables cache fills to use shared cache state */ + UINT32 rsvd5:2; /* reserved */ + UINT32 global:1; /* global bit for internal use */ + UINT32 lock:1; /* lock bit label indicating static TLB used */ + UINT32 w:1; /* write thru/back */ + UINT32 i:1; /* cache inhibited */ + UINT32 m:1; /* memory coherent */ + UINT32 g:1; /* memory guarded */ + UINT32 e:1; /* little endian bit */ + + /* word 2 */ + UINT32 rpn:20; /* real page number */ + UINT32 rsvd6:2; /* reserved */ + UINT32 u0:1; /* user attribute 0 */ + UINT32 u1:1; /* user attribute 1 */ + UINT32 u2:1; /* user attribute 2 */ + UINT32 u3:1; /* user attribute 3 */ + UINT32 ux:1; /* user execute protection */ + UINT32 sx:1; /* supervisor execute protection */ + UINT32 uw:1; /* user write protection */ + UINT32 sw:1; /* supervisor write protection */ + UINT32 ur:1; /* user read protection */ + UINT32 sr:1; /* supervisor read protection */ + /* word3 */ +#if defined(PPC_e500v2) + UINT32 rsvd7:28; /* reserved*/ + UINT32 erpn:4; /* extended real page number*/ +#else + UINT32 rsvd7:32; /* pad descriptor table to power of 2 */ +#endif + } field; + + struct + { + UINT32 word0; /* word 0 */ + UINT32 word1; /* word 1 */ + UINT32 word2; /* word 2 */ +#if defined(PPC_e500v2) + UINT32 word3; /* word3 */ +#else + UINT32 pad0; /* pad word */ +#endif + } words; + + } MMUE500_PTE; + +/* TLB Entry description, used for mmu initialization */ + +typedef struct + { + UINT32 effAddr; /* Effective address of base of page */ + UINT32 realAddrExt; /* top 4 bits of real address */ + UINT32 realAddr; /* rest of real address */ + UINT32 attr; /* page attributes */ + } TLB_ENTRY_DESC; + + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS mmuE500LibInit (int mmuType, int staticTlbNum, TLB_ENTRY_DESC * pStaticTlbDesc); + +#else /* __STDC__ */ + +extern STATUS mmuE500LibInit (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmmuPpcE500Libh */ diff --git a/h/arch/ppc/mmuPpcLib.h b/h/arch/ppc/mmuPpcLib.h new file mode 100644 index 0000000..30dfcf6 --- /dev/null +++ b/h/arch/ppc/mmuPpcLib.h @@ -0,0 +1,541 @@ +/* mmuPpcLib.h - mmu library for PowerPC */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,04aug05,pch _WRS_MMU_64BIT fixes +01d,15mar04,rec PPC970 merge from T2 +01c,11jul03,pcs Port to Base 6. +01b,07jul03,pad Added exclusion of C code for inclusion in assembly files. +01a,11sep95,tpr written. +*/ + +#ifndef __INCmmuPpcLibh +#define __INCmmuPpcLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* page table related definitions */ + +#define MMU_PG_TBL_PTE_VALID_SHIFT 29 + +#define MMU_LVL_2_DESC_NB 0x00000400 +#define MMU_LVL_1_DESC_NB MMU_LVL_2_DESC_NB + +#define MMU_LVL_1_L2BA_MSK 0xfffff000 +#define MMU_RPN_SHIFT 12 + +#if ((CPU == PPC603) || (CPU == PPCEC603)) +#define FULL_HASH_TBL_BYPASS TRUE +#else +#define FULL_HASH_TBL_BYPASS FALSE +#endif + +#define MMU_PAGE_SIZE 0x1000 /* pages are 4K bytes */ + + +#ifdef _WRS_MMU_64BIT + +/* 64-bit implementation see Programming Environments table 7-26 */ + +#define MMU_HASH_DIVISOR 0x01000000 /* 64 bit page table uses */ + +#define MMU_SDR1_HTABORG_16M 0xfffc0000 /* HTABORG value for 16M */ +#define MMU_SDR1_HTABORG_32M 0xfff80000 /* HTABORG value for 32M */ +#define MMU_SDR1_HTABORG_64M 0xfff00000 /* HTABORG value for 64M */ +#define MMU_SDR1_HTABORG_128M 0xffe00000 /* HTABORG value for 128M */ +#define MMU_SDR1_HTABORG_256M 0xffc00000 /* HTABORG value for 256M */ +#define MMU_SDR1_HTABORG_512M 0xff800000 /* HTABORG value for 512M */ +#define MMU_SDR1_HTABORG_1G 0xff000000 /* HTABORG value for 1G */ +#define MMU_SDR1_HTABORG_2G 0xfe000000 /* HTABORG value for 2G */ +#define MMU_SDR1_HTABORG_4G 0xfc000000 /* HTABORG value for 4G */ + +#define MMU_SDR1_HTABSIZE_16M 0x00000000 /* HTABSIZE value for 16M */ +#define MMU_SDR1_HTABSIZE_32M 0x00000001 /* HTABSIZE value for 32M */ +#define MMU_SDR1_HTABSIZE_64M 0x00000002 /* HTABSIZE value for 64M */ +#define MMU_SDR1_HTABSIZE_128M 0x00000003 /* HTABSIZE value for 128M */ +#define MMU_SDR1_HTABSIZE_256M 0x00000004 /* HTABSIZE value for 256M */ +#define MMU_SDR1_HTABSIZE_512M 0x00000005 /* HTABSIZE value for 512M */ +#define MMU_SDR1_HTABSIZE_1G 0x00000006 /* HTABSIZE value for 1G */ +#define MMU_SDR1_HTABSIZE_2G 0X00000007 /* HTABSIZE value for 2G */ +#define MMU_SDR1_HTABSIZE_4G 0x00000008 /* HTABSIZE value for 4G */ +#define MMU_SDR1_HTABMASK_16M MMU_SDR1_HTABSIZE_16M +#define MMU_SDR1_HTABMASK_32M MMU_SDR1_HTABSIZE_32M +#define MMU_SDR1_HTABMASK_64M MMU_SDR1_HTABSIZE_64M +#define MMU_SDR1_HTABMASK_128M MMU_SDR1_HTABSIZE_128M +#define MMU_SDR1_HTABMASK_256M MMU_SDR1_HTABSIZE_256M +#define MMU_SDR1_HTABMASK_512M MMU_SDR1_HTABSIZE_512M +#define MMU_SDR1_HTABMASK_1G MMU_SDR1_HTABSIZE_1G +#define MMU_SDR1_HTABMASK_2G MMU_SDR1_HTABSIZE_2G +#define MMU_SDR1_HTABMASK_4G MMU_SDR1_HTABSIZE_4G + + +#define MMU_PTE_MIN_SIZE_16M 0x00040000 /* 256k min size */ +#define MMU_PTE_MIN_SIZE_32M 0x00080000 /* 512k min size */ +#define MMU_PTE_MIN_SIZE_64M 0x00100000 /* 1M min size */ +#define MMU_PTE_MIN_SIZE_128M 0x00200000 /* 2M min size */ +#define MMU_PTE_MIN_SIZE_256M 0x00400000 /* 4M min size */ +#define MMU_PTE_MIN_SIZE_512M 0x00800000 /* 8M min size */ +#define MMU_PTE_MIN_SIZE_1G 0x01000000 /* 16M min size */ +#define MMU_PTE_MIN_SIZE_2G 0x02000000 /* 32M min size */ +#define MMU_PTE_MIN_SIZE_4G 0x04000000 /* 128k min size */ + +#define MMU_EA_BYTE_OFFSET 0x00000fff /* Byte Offset in E.A */ +#define MMU_EA_API 0x0000f800 /* abbreviated page index */ + /* see PEM, fig. 7-17 */ +#define MMU_EA_API_SHIFT 11 /* api shift in page index */ + +#define MMU_SR_NB_SHIFT 28 +#define MMU_EA_PAGE_INDEX 0x0ffff000 /* Page Index in E.A. */ +#define MMU_EA_PAGE_INDEX_SHIFT 12 /* Page Index shift */ + +#define MMU_VSID_PRIM_HASH 0x000fffff /* primary hash value in VSID */ + /* NOTE: this is not correct. */ + /* see PEM, fig. 7-29 */ +#define MMU_HASH_VALUE_LOW 0x000007ff + +#define MMU_HASH_VALUE_HIGH 0xfffff800 + +#define MMU_HASH_VALUE_HIGH_SHIFT 11 + +#define MMU_PTE_HASH_VALUE_HIGH_SHIFT 18 +#define MMU_PTE_HASH_VALUE_LOW_SHIFT 7 + +#define MMU_PTE_VSID_SHIFT 12 +#define MMU_PTE_API 0x00000f80 /* API field in PTE */ +#define MMU_PTE_API_SHIFT 7 /* API shift in PTE */ +#define MMU_PTE_H 0x00000002 +#define MMU_PTE_H_SHIFT 1 +#define MMU_PTE_V 0x00000001 + +#else /* not _WRS_MMU_64BIT */ + +/* 32-bit implementation see Programming Environments table 7-27 */ + +#define MMU_HASH_DIVISOR 0x00800000 +#define MMU_SDR1_HTABORG_MASK 0xffff0000 /* HTABORG mask */ +#define MMU_SDR1_HTABORG_8M 0xffff0000 /* HTABORG value for 8M */ +#define MMU_SDR1_HTABORG_16M 0xfffe0000 /* HTABORG value for 16M */ +#define MMU_SDR1_HTABORG_32M 0xfffc0000 /* HTABORG value for 32M */ +#define MMU_SDR1_HTABORG_64M 0xfff80000 /* HTABORG value for 64M */ +#define MMU_SDR1_HTABORG_128M 0xfff00000 /* HTABORG value for 128M */ +#define MMU_SDR1_HTABORG_256M 0xffe00000 /* HTABORG value for 256M */ +#define MMU_SDR1_HTABORG_512M 0xffc00000 /* HTABORG value for 512M */ +#define MMU_SDR1_HTABORG_1G 0xff800000 /* HTABORG value for 1G */ +#define MMU_SDR1_HTABORG_2G 0xff000000 /* HTABORG value for 2G */ +#define MMU_SDR1_HTABORG_4G 0xfe000000 /* HTABORG value for 4G */ + +#define MMU_SDR1_HTABMASK_MASK 0x000001ff /* HTABMASK mask */ +#define MMU_SDR1_HTABMASK_SHIFT 16 /* HTABMASK shift */ +#define MMU_SDR1_HTABMASK_8M 0x00000000 /* HTABMASK value for 8M */ +#define MMU_SDR1_HTABMASK_16M 0x00000001 /* HTABMASK value for 16M */ +#define MMU_SDR1_HTABMASK_32M 0x00000003 /* HTABMASK value for 32M */ +#define MMU_SDR1_HTABMASK_64M 0x00000007 /* HTABMASK value for 64M */ +#define MMU_SDR1_HTABMASK_128M 0x0000000f /* HTABMASK value for 128M */ +#define MMU_SDR1_HTABMASK_256M 0x0000001f /* HTABMASK value for 256M */ +#define MMU_SDR1_HTABMASK_512M 0x0000003f /* HTABMASK value for 512M */ +#define MMU_SDR1_HTABMASK_1G 0x0000007f /* HTABMASK value for 1G */ +#define MMU_SDR1_HTABMASK_2G 0x000000ff /* HTABMASK value for 2G */ +#define MMU_SDR1_HTABMASK_4G 0x000001ff /* HTABMASK value for 4G */ + +#define MMU_PTE_MIN_SIZE_8M 0x00010000 /* 64k min size */ +#define MMU_PTE_MIN_SIZE_16M 0x00020000 /* 128k min size */ +#define MMU_PTE_MIN_SIZE_32M 0x00040000 /* 256k min size */ +#define MMU_PTE_MIN_SIZE_64M 0x00080000 /* 512k min size */ +#define MMU_PTE_MIN_SIZE_128M 0x00100000 /* 1M min size */ +#define MMU_PTE_MIN_SIZE_256M 0x00200000 /* 2M min size */ +#define MMU_PTE_MIN_SIZE_512M 0x00400000 /* 4M min size */ +#define MMU_PTE_MIN_SIZE_1G 0x00800000 /* 8M min size */ +#define MMU_PTE_MIN_SIZE_2G 0x01000000 /* 16M min size */ +#define MMU_PTE_MIN_SIZE_4G 0x02000000 /* 32M min size */ + +#define MMU_EA_SR 0xf0000000 /* SR field in E.A. */ +#define MMU_EA_SR_SHIFT 28 /* */ +#define MMU_EA_PAGE_INDEX 0x0ffff000 /* Page Index in E.A. */ +#define MMU_EA_PAGE_INDEX_SHIFT 12 /* Page Index shift */ +#define MMU_EA_BYTE_OFFSET 0x00000fff /* Byte Offset in E.A */ +#define MMU_EA_API 0x0000fc00 /* abbreviated page index */ +#define MMU_EA_API_SHIFT 10 /* api shift in page index */ + +#define MMU_SR_VSID_MASK 0x00ffffff /* virtual segment ID */ +#define MMU_SR_NB_SHIFT 28 + +#define MMU_VSID_PRIM_HASH 0x000fffff /* primary hash value in VSID */ + +#define MMU_HASH_VALUE_LOW 0x000003ff + +#define MMU_HASH_VALUE_HIGH 0x0007fc00 + +#define MMU_HASH_VALUE_HIGH_SHIFT 10 + +#define MMU_PTE_HASH_VALUE_HIGH_SHIFT 16 +#define MMU_PTE_HASH_VALUE_LOW_SHIFT 6 + +#define MMU_PTE_VSID_SHIFT 7 +#define MMU_PTE_V 0x80000000 +#define MMU_PTE_H 0x00000040 +#define MMU_PTE_H_SHIFT 6 +#define MMU_PTE_API 0x0000003f /* API field in PTE */ +#define MMU_PTE_API_SHIFT 0 /* API shift in PTE */ + +#endif /* _WRS_MMU_64BIT */ + +#define MMU_PTE_RPN 0xfffff000 +#define MMU_PTE_RPN_SHIFT 12 + +#define MMU_PTE_BY_PTEG 0x08 + +#define MMU_I_ADDR_TRANS 0 +#define MMU_D_ADDR_TRANS 1 + +#define MMU_INST 0x01 +#define MMU_DATA 0x02 + +/* + * NOTE: this doesn't match with 64-bit implementations, + * but we use it as is so that valid bit doesn't override PP bits. + */ +#define MMU_STATE_VALID 0x80000000 + +#define MMU_STATE_VALID_NOT 0x00000000 +#define MMU_STATE_WRITABLE 0x00000002 +#define MMU_STATE_WRITABLE_NOT 0x00000003 +#define MMU_STATE_CACHEABLE 0x00000000 +#define MMU_STATE_CACHEABLE_COPYBACK 0x00000000 +#define MMU_STATE_CACHEABLE_WRITETHROUGH 0x00000040 +#define MMU_STATE_CACHEABLE_NOT 0x00000020 +#define MMU_STATE_MEM_COHERENCY 0x00000010 +#define MMU_STATE_MEM_COHERENCY_NOT 0x00000000 +#define MMU_STATE_GUARDED 0x00000008 +#define MMU_STATE_GUARDED_NOT 0x00000000 + +#define MMU_STATE_SUP_RWX 0x00000000 +#define MMU_STATE_USR_EXE_SUP_RWX 0x00000001 +#define MMU_STATE_USR_SUP_RWX 0x00000002 +#define MMU_STATE_USR_SUP_EXE 0x00000003 + +/* + * the 3 following mask are not supported by the MMU for now + */ +#define MMU_STATE_ACCESS_NOT 0x00000000 +#define MMU_STATE_EXECUTE 0x00000000 +#define MMU_STATE_EXECUTE_NOT 0x10000000 + +#define MMU_STATE_MASK_VALID 0x80000000 +#define MMU_STATE_MASK_WRITABLE 0x00000003 +#define MMU_STATE_MASK_PROTECTION 0x00000003 + +#define MMU_STATE_MASK_CACHEABLE 0x00000060 +#define MMU_STATE_MASK_MEM_COHERENCY 0x00000010 +#define MMU_STATE_MASK_GUARDED 0x00000008 +#define MMU_STATE_MASK_EXECUTE 0x10000000 +#define MMU_STATE_MASK_WIMG_AND_WRITABLE 0x0000007B +#define MMU_STATE_MASK_WIMG 0x00000078 +#define MMU_STATE_MASK_HASH_LEVEL 0x00000040 + +#define MMU_PPC_PAGE_SIZE 0x00001000 + + +/* Segment Registers */ + +/* Note: for 64 bit implementations, SR is accessed the same as 32 bit format */ + +#define MMU_PPC_SEG_REG_NUM 0x00000010 + +#define MMU_PPC_SR_T 0x80000000 /* T=0 for page, T=1 for I/O */ +#define MMU_PPC_SR_KS 0x40000000 /* sup-state protect (T=0) */ +#define MMU_PPC_SR_KP 0x20000000 /* user-state protect (T=0) */ +#define MMU_PPC_SR_N 0x10000000 /* no-execute protect (T=0) */ + +#define MMU_PPC_SR_VSID_MASK 0x00ffffff /* virtual segment ID (T=0) */ +#define MMU_PPC_SR_VSID_SHIFT 0 + +/* + * The 603 and 604 use a different VSID generation mechanism. This is + * because the 603 does not use a hash table, while the 604 does. For + * more information on this look in mmuPpcLib.c + */ + +#if ((CPU == PPC603) || (CPU == PPCEC603)) +#define MMU_SR_VSID_INCREMENT 0x10 +#else +#define MMU_SR_VSID_INCREMENT 0x1 +#endif + +#define MMU_KERNEL_SR0_VAL (MMU_PPC_SR_KP | (0 * MMU_SR_VSID_INCREMENT)) +#define MMU_KERNEL_SR1_VAL (MMU_PPC_SR_KP | (1 * MMU_SR_VSID_INCREMENT)) +#define MMU_KERNEL_SR2_VAL (MMU_PPC_SR_KP | (2 * MMU_SR_VSID_INCREMENT)) +#define MMU_KERNEL_SR3_VAL (MMU_PPC_SR_KP | (3 * MMU_SR_VSID_INCREMENT)) +#define MMU_KERNEL_SR4_VAL (MMU_PPC_SR_KP | (4 * MMU_SR_VSID_INCREMENT)) +#define MMU_KERNEL_SR5_VAL (MMU_PPC_SR_KP | (5 * MMU_SR_VSID_INCREMENT)) +#define MMU_KERNEL_SR6_VAL (MMU_PPC_SR_KP | (6 * MMU_SR_VSID_INCREMENT)) +#define MMU_KERNEL_SR7_VAL (MMU_PPC_SR_KP | (7 * MMU_SR_VSID_INCREMENT)) +#define MMU_KERNEL_SR8_VAL (MMU_PPC_SR_KP | (8 * MMU_SR_VSID_INCREMENT)) +#define MMU_KERNEL_SR9_VAL (MMU_PPC_SR_KP | (9 * MMU_SR_VSID_INCREMENT)) +#define MMU_KERNEL_SR10_VAL (MMU_PPC_SR_KP | (10 * MMU_SR_VSID_INCREMENT)) +#define MMU_KERNEL_SR11_VAL (MMU_PPC_SR_KP | (11 * MMU_SR_VSID_INCREMENT)) +#define MMU_KERNEL_SR12_VAL (MMU_PPC_SR_KP | (12 * MMU_SR_VSID_INCREMENT)) +#define MMU_KERNEL_SR13_VAL (MMU_PPC_SR_KP | (13 * MMU_SR_VSID_INCREMENT)) +#define MMU_KERNEL_SR14_VAL (MMU_PPC_SR_KP | (14 * MMU_SR_VSID_INCREMENT)) +#define MMU_KERNEL_SR15_VAL (MMU_PPC_SR_KP | (15 * MMU_SR_VSID_INCREMENT)) + +#define MMU_SR_INVALID_VSID 0x00ffffff + +/* + * XXX - tam - Temporary defines for VmWorks + * This should be removed when context creation routine vmCtxCreate() + * takes 2 more arguments: start of VM context and size of VM context. + */ + +#define APPL_PD_BASE_ADRS 0x20000000 +#define APPL_PD_SIZE 0x40000000 + +#define APPL_PD_END_ADRS (APPL_PD_BASE_ADRS + APPL_PD_SIZE - 1) + +#define SR_REG_NO_GET(addr) (((UINT) (addr)) >> MMU_SR_NB_SHIFT) +#define SR_REG_NO_LOW (SR_REG_NO_GET(APPL_PD_BASE_ADRS)) +#define SR_REG_NO_HIGH (SR_REG_NO_GET(APPL_PD_END_ADRS)) + +/* + * IMPORTANT: If the definition of MMU_PAGE_TBL changes so must this macro. + * Please don't ignore this! + */ + + /* #define MMU_PPC_PG_TBL_GET(pPageTbl) ((UINT *)(pPageTbl->l1TblPtr.pL1Desc)) + */ + +#define MMU_PPC_PG_TBL_GET(pPageTbl) ((UINT *)(((MMU_PAGE_TBL *) pPageTbl)->l1TblPtr.pL1Desc)) + +#define MMU_PPC_TRANS_TBL_NEXT_GET(addr) ((UINT) (addr + (MMU_PPC_SEG_REG_NUM * sizeof(int)))) + +#ifndef _ASMLANGUAGE + +/* Effective Address Definition */ + +typedef union effectiveAddr /* effective Address structure */ + { + struct + { + u_int l1index:10; /* Level 1 Index */ + u_int l2index:10; /* Level 2 Index */ + u_int po:12; /* Page Offset */ + } field; + + void * effAddr; + + } EFFECTIVE_ADDR; + +/* Real Address Definition */ + +typedef union realAddress /* Real Address Structure */ + { + struct /* Bit field description */ + { + u_int rpn:20; /* Real Page Number */ + u_int po:12; /* Page Offset */ + }field; + + void * realAddr; /* Real Address */ + + } REAL_ADDRESS; + +/* Level 1 Descriptor Definition */ + +typedef union level_1_desc /* Level 1 descriptor format */ + { + struct /* Bit field desciption */ + { + u_int l2ba:20; /* Level 2 table Base Address */ + u_int reserved:11; /* Reserved */ + u_int v:1; /* Segment Valid bit */ + } field; + + u_int l1desc; /* Level 1 descriptor */ + + } LEVEL_1_DESC; + +/* Level 1 Table pointer definition */ + +typedef union level_1_tbl_ptr /* Level 1 Table pointer structure */ + { + struct /* Bit field description */ + { + u_int l1tb:20; /* Level 1 table Base */ + u_int l1index:10; /* Level 1 table Index */ + u_int reserved:2; /* Reserved */ + } field; + + LEVEL_1_DESC * pL1Desc; /* Level 1 descriptor table pointer */ + + } LEVEL_1_TBL_PTR; + +/* Level 2 descriptor definition */ + +typedef union level_2_desc /* Level 2 descriptor format */ + { + struct /* Bit field desciption */ + { + u_int rpn:20; /* Real Page Number */ + u_int reserved:5; /* reserved */ + u_int wimg:4; /* Memory/cache control bit */ + u_int v:1; /* Page Valid bit */ + u_int pp:2; /* Page Protection */ + } field; + + u_int l2desc; /* Level 2 descriptor */ + + } LEVEL_2_DESC; + +/* Level 2 Table pointer definition */ + +typedef union level_2_tbl_ptr /* Level 2 Table pointer structure */ + { + struct /* Bit field description */ + { + u_int l2tb:20; /* Level 2 Table Base */ + u_int l2index:10; /* Level 2 table Index */ + u_int reserved:2; /* Reserved */ + } field; + + LEVEL_2_DESC * pL2Desc; /* Level 2 descriptor table pointer */ + + } LEVEL_2_TBL_PTR; + +/* Page Table Definition */ + +/* + * IMPORTANT: If the defintion of this structure changes so must the macro + * MMU_PPC_PG_TBL_GET(). + */ + +typedef struct mmuPageTblStruct + { + LEVEL_1_TBL_PTR l1TblPtr; + } MMU_PAGE_TBL; + +#ifdef _WRS_MMU_64BIT + +/* PTE for 64-bit implementations */ + +typedef union pte /* PTE structure */ + { + struct /* bit field description */ + { + u_int hvsid; /* Virtual Segment ID (high word) */ + u_int vsid:20; /* Virtual Segment ID */ + u_int api:5; /* Abbreviated page index */ + u_int reserved0:5; /* reserved */ + u_int h:1; /* Hash function identifier */ + u_int v:1; /* entry valid (v=1) or invalid (v=0) */ + u_int hrpn; /* Physical page number (high word) */ + u_int rpn:20; /* Physical page number */ + u_int reserved1:3; /* reserved */ + u_int r:1; /* Referenced bit */ + u_int c:1; /* Changed bit */ + u_int wimg:4; /* Memory/cache control bit */ + u_int reserved2:1; /* reserved */ + u_int pp:2; /* Page protection bits */ + } field; + struct /* word description */ + { + u_int hword0; /* hword 0 */ + u_int word0; /* word 0 */ + u_int hword1; /* hword 1 */ + u_int word1; /* word 1 */ + } bytes; + } PTE; +#else /* !_WRS_MMU_64BIT */ + +/* PTE for 32-bit implementations */ + +typedef union pte /* PTE structure */ + { + struct /* bit field desciption */ + { + u_int v:1; /* entry valid (v=1) or invalid (v=0) */ + u_int vsid:24; /* Virtual Segment ID */ + u_int h:1; /* Hash function identifier */ + u_int api:6; /* Abbreviated page index */ + u_int rpn:20; /* Physical page number */ + u_int reserved1:3; /* reserved */ + u_int r:1; /* Referenced bit */ + u_int c:1; /* Changed bit */ + u_int wimg:4; /* Memory/cache control bit */ + u_int reserved2:1; /* reserved */ + u_int pp:2; /* Page protection bits */ + } field; + struct /* word description */ + { + u_int word0; /* word 0 */ + u_int word1; /* word 1 */ + } bytes; + } PTE; +#endif /* _WRS_MMU_64BIT */ + +typedef struct pteg /* PTEG structure */ + { + PTE pte[MMU_PTE_BY_PTEG]; + } PTEG; +typedef union sr + { + struct + { + u_int t:1; /* SR format flag */ + u_int ks:1; /* Supervisor-state protection key */ + u_int kp:1; /* User-state protection key */ + u_int n:1; /* No-execute protection */ + u_int reserved:4; /* reserved */ + u_int vsid:24; /* Virtual segment Id */ + } bit; + u_int value; /* SR value */ + } SR; + +typedef struct mmuTransTblStruct + { + + u_int vsidBaseNum; + + /* + * XXX - tam - + * DO NOT CHANGE THE ORDER of the following array declarations. + * Some code in src/arch/ppc/ depend on scSrTable following srTable + * and pPageTbl following scSrTable. + */ + + SR srTable[MMU_PPC_SEG_REG_NUM]; /* default SR table */ + SR scSrTable[MMU_PPC_SEG_REG_NUM]; /* SR table for system calls */ + + MMU_PAGE_TBL * pageTbl; /* two level page table */ + + } MMU_TRANS_TBL; + +typedef struct mmuHashTblStruct + { + u_int hTabOrg; + u_int hTabMask; /* HTABSIZE for _WRS_MMU_64BIT */ + u_int pteTableSize; + } MMU_HASH_TBL; + + +typedef struct ea + { + u_int srSelect:4; /* SR select */ + u_int pageIndex:16; /* Page index */ + u_int byteOffset:12; /* Byte offset */ + } EA; + +void mmuPpcInstMissHandler (void); +void mmuPpcDataLoadMissHandler (void); +void mmuPpcDataStoreMissHandler (void); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmmuPpcLibh */ diff --git a/h/arch/ppc/ppc32.h b/h/arch/ppc/ppc32.h new file mode 100644 index 0000000..633e2e3 --- /dev/null +++ b/h/arch/ppc/ppc32.h @@ -0,0 +1,63 @@ +/* ppc32.h - generic 32-bit PowerPC header */ + +/* Copyright 2002-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05dec03,jtp Add _WRS_TLB_MISS_CLASS_HW +01b,04feb03,pch add _fp60x variant +01a,12dec02,pch written. +*/ + +#ifndef __INCppc32h +#define __INCppc32h + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * If compiling for a variant, the preprocessor symbol CPU_VARIANT will be + * defined as the directory suffix, e.g. _fp60x for PPC60x hardware floating + * point support (whose objects go in target/lib/ppc/PPC32/ *_fp60x). + * + * We really want something like #if ("CPU_VARIANT" == "_fp60x") + * which ANSI C does not allow. However, it does allow the expansion + * of CPU_VARIANT to be re-expanded according to another #define. + */ +#ifdef CPU_VARIANT +#define _fp60x 603 +#if (CPU_VARIANT == _fp60x) +#define PPC32_fp60x 1 +#endif /* CPU_VARIANT == _fp60x */ +#undef _fp60x +#endif /* CPU_VARIANT */ + +/* + * Tell the loader this processor can't handle any misalignment. + * This is necessary for 403; for others the loader will + * take a performance hit but it is otherwise harmless. + */ +#define _WRS_STRICT_ALIGNMENT 1 + +/* + * FP variant needs to define _PPC_MSR_FP (used elsewhere to indicate + * "FP present". Base variant should have no floating point support + * in target shell. + */ +#ifdef PPC32_fp60x +#define _PPC_MSR_FP 0x2000 /* floating-point available */ +#else /* PPC32_fp60x */ +#define _WRS_NO_TGT_SHELL_FP 1 +#endif /* PPC32_fp60x */ + +/* No MMU support in architecture library */ +#undef _WRS_TLB_MISS_CLASS_SW +#undef _WRS_TLB_MISS_CLASS_HW + +#ifdef __cplusplus +} +#endif + +#endif /* __INCppc32h */ diff --git a/h/arch/ppc/ppc403.h b/h/arch/ppc/ppc403.h new file mode 100644 index 0000000..2461215 --- /dev/null +++ b/h/arch/ppc/ppc403.h @@ -0,0 +1,639 @@ +/* ppc403.h - PowerPC 403 specific header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01s,12feb04,jtp Add _WRS_MMU_CLASS_* macro +01r,05dec03,jtp Add _WRS_TLB_MISS_CLASS_HW, _PPC_MSR_MMU_EXTRACT +01q,13mar03,pch Add PPC32 support +01p,06dec02,pch Add MSR bit number definitions +01o,13jun02,jtp identify class of MMU support (SPR #78396) +01n,22nov01,pch Add _WRS_STRICT_ALIGNMENT for target/src/ostool/loadElfLib.c, + and _WRS_NO_TGT_SHELL_FP for target/src/ostool/shell* +01m,21oct98,elg added hardware breakpoints for PPC403 +01l,18mar97,tam redefined INT_MASK to mask MSR[CE] (SPR 8192). +01k,24feb97,tam added definitions for the PPC403GC and PPC403GCX. +01j,03oct96,tam added more definitions for the bank registers. +01i,20sep96,tam added _PPC403_ICCR_DEFAULT_VAL and _PPC403_ICCR_DEFAULT_VAL. +01h,18jun96,tam added defines for the PowerPC 403 debug registers. + removed TBL/TBU and PVR macros. +01g,17jun96,tpr added defines PowerPC 403 specific. +01f,09may96,tam added missing definitions for dma chained count registers (1-3) +01e,07mar96,tam fix DMASR macro values. (spr# 6018) - added PVR definition. +01d,08feb96,kkk fix iocr macro values. (spr# 5416) +01c,17feb95,yao added macros for dma register. +01b,17jan95,yao added macros for external interrupt enable/status register. + added definitions for debug control/ status registers. +01a,17mar94,yao written. +*/ + +#ifndef __INCppc403h +#define __INCppc403h + +#ifdef __cplusplus +extern "C" { +#endif + +/* INT_MASK definition (mask EE & CE bits) : overwrite the one in asmPpc.h */ + +#undef INT_MASK +#define INT_MASK(src, des) rlwinm des, src, 0, 17, 15; \ + rlwinm des, des, 0, 15, 13 + +/* Tell the loader this processor can't handle any misalignment */ +#define _WRS_STRICT_ALIGNMENT 1 + +/* No floating point support in target shell */ +#define _WRS_NO_TGT_SHELL_FP 1 + +/* No MMU support in architecture library */ +#undef _WRS_TLB_MISS_CLASS_SW +#undef _WRS_TLB_MISS_CLASS_HW +#undef _WRS_MMU_CLASS_PID_REG +#undef _WRS_MMU_CLASS_SR_REGS +#define _WRS_MMU_CLASS_NONE 1 + +/* MSR definitions */ + +#undef _PPC_MSR_POW_U /* power managemnet not supported */ +#undef _PPC_MSR_ILE_U /* little endian mode not supported */ +#undef _PPC_MSR_SF_U /* 64 bit mode not implemented */ + +#undef _PPC_MSR_BE /* branch trace not supported */ +#undef _PPC_MSR_FE1 /* floating point not supported */ +#undef _PPC_MSR_FE0 /* floating point not supported */ +#undef _PPC_MSR_IT /* instruction address translation unsupported*/ +#undef _PPC_MSR_DT /* data address translation unsupported */ +#undef _PPC_MSR_RI /* recoverable interrupt unsupported */ +#undef _PPC_MSR_LE /* little endian mode unsupported */ +#undef _PPC_MSR_SE /* single step unsupported */ +#undef _PPC_MSR_FP /* floating point unsupported */ + +#define _PPC_MSR_WE_U 0x0004 /* wait state enable */ +#define _PPC_MSR_CE_U 0x0002 /* critical interrupt enable */ +#define _PPC_MSR_DE 0x0200 /* debug exception enable */ +#define _PPC_MSR_IR 0x0020 /* instruction relocate (403GC/GCX) */ +#define _PPC_MSR_DR 0x0010 /* data relocate (403GC/GCX) */ +#define _PPC_MSR_PE 0x0008 /* protection enable */ +#define _PPC_MSR_PX 0x0004 /* protection exclusive mode */ +#define _PPC_MSR_CE 0x00020000 /* critical interrupt enable mask */ + +/* MSR bit offsets */ +#define _PPC_MSR_BIT_IR 26 /* MSR Inst Translation bit - IR */ +#define _PPC_MSR_BIT_DR 27 /* MSR Data Translation bit - DR */ + +/* MSR MMU Bit offset and extraction macros */ + +#define _PPC_MSR_MMU_EXTRACT(src, dst) \ + rlwinm dst, src, 0, _PPC_MSR_BIT_IR, _PPC_MSR_BIT_DR + +/* Device Control Register PowerPC403 specific */ + +#undef DEC /* decrementer not supported */ + +#define BEAR 0x090 /* bus error adress register read/clear */ +#define BESR 0x091 /* bus error syndrome register read/clear */ +#define BR0 0x080 /* bank register 0 */ +#define BR1 0x081 /* bank register 1 */ +#define BR2 0x082 /* bank register 2 */ +#define BR3 0x083 /* bank register 3 */ +#define BR4 0x084 /* bank register 4 */ +#define BR5 0x085 /* bank register 5 */ +#define BR6 0x086 /* bank register 6 */ +#define BR7 0x087 /* bank register 7 */ +#define BRH0 0x070 /* bank register 0 high */ +#define BRH1 0x071 /* bank register 1 high */ +#define BRH2 0x072 /* bank register 2 high */ +#define BRH3 0x073 /* bank register 3 high */ +#define BRH4 0x074 /* bank register 4 high */ +#define BRH5 0x075 /* bank register 5 high */ +#define BRH6 0x076 /* bank register 6 high */ +#define BRH7 0x077 /* bank register 7 high */ +#define DMACC0 0xc4 /* dma chained count 0 r/w */ +#define DMACC1 0xcc /* dma chained count 1 r/w */ +#define DMACC2 0xd4 /* dma chained count 2 r/w */ +#define DMACC3 0xdc /* dma chained count 3 r/w */ +#define DMACR0 0xc0 /* dma channel control register 0 r/w */ +#define DMACR1 0xc8 /* dma channel control register 1 r/w */ +#define DMACR2 0xd0 /* dma channel control register 2 r/w */ +#define DMACR3 0xd8 /* dma channel control register 3 r/w */ +#define DMACT0 0xc1 /* dma count register 0 r/w */ +#define DMACT1 0xc9 /* dma count register 1 r/w */ +#define DMACT2 0xd1 /* dma count register 2 r/w */ +#define DMACT3 0xd9 /* dma count register 3 r/w */ +#define DMADA0 0xc2 /* dma destination address register 0 r/w */ +#define DMADA1 0xca /* dma destination address register 1 r/w */ +#define DMADA2 0xd2 /* dma destination address register 2 r/w */ +#define DMADA3 0xda /* dma destination address register 3 r/w */ +#define DMASA0 0xc3 /* dma source address register 0 r/w */ +#define DMASA1 0xcb /* dma source address register 1 r/w */ +#define DMASA2 0xd3 /* dma source address register 2 r/w */ +#define DMASA3 0xdb /* dma source address register 3 r/w */ +#define DMASR 0xe0 /* dma status register r/w */ +#define EXIER 0x42 /* external interrupt enable register r/w */ +#define EXISR 0x40 /* external interrupt status register r/c */ +#define IOCR 0x0a0 /* input/output configuration register r/w */ + +/* Special Purpose Register PowerPC403 specific */ + +#define CDBCR 0x3d7 /* cache debug control register r/w */ +#define DAC1 0x3f6 /* data adress compare register 1 r/w */ +#define DAC2 0x3f7 /* data adress compare register 2 r/w */ +#define DBSR 0x3f0 /* debug status register read/clear */ +#define DBCR 0x3f2 /* debug control register read/write */ +#define DCCR 0x3fa /* data cache control register r/w */ +#define DCWR 0x3ba /* data cache write-thru register (PPC403GC) r/w */ +#define DEAR 0x3d5 /* data exception address registers r */ +#define ESR 0x3d4 /* exception syndrom register r/w */ +#define EVPR 0x3d6 /* exception prefix register r/w */ +#define IAC1 0x3f4 /* instruction adress compare register 1 r/w */ +#define IAC2 0x3f5 /* instruction adress compare register 2 r/w */ +#define ICCR 0x3fb /* instruction cache cacheability register r/w */ +#define ICDBDR 0x3d3 /* instruction cache debug data register r */ +#define PBL1 0x3fc /* protection bound lower 1 r/w */ +#define PBL2 0x3fe /* protection bound lower 2 r/w */ +#define PBU1 0x3fd /* protection bound upper 1 r/w */ +#define PBU2 0x3ff /* protection bound upper 2 r/w */ +#define PID 0x3b1 /* process id (403GC/GCX) r */ +#define PIT 0x3db /* programmable interval timer r/w */ +#define SGR 0x3b9 /* storage guarded register (PPC403GC) r/w */ +#define SRR2 0x3de /* save/restore register 2 r/w */ +#define SRR3 0x3df /* save/restore register 3 r/w */ +#define TBLO 0x3dd /* time base low r/w */ +#define TBHI 0x3dc /* time base high r/w */ +#define TCR 0x3da /* timer control register r/w */ +#define TSR 0x3d8 /* timer status register read/clear */ +#define TSRS 0x3d9 /* timer status register set (set only) */ +#define ZPR 0x3b0 /* zone protection register (PPC403GC/GCX) r/w */ + +#define mtdcr(dcrn, rs) .long (0x7c0001c3 | (rs << 21) | (dcrf << 11)) + +#define MTDCR 0x7c0001c3 +#define MFDCR 0x7c000143 +#define _EXISR_OP 0x00001000 +#define _EXIER_OP 0x00021000 +#define MFEXISR_P0 .long 0x7c601286 +#define MTEXISR_P0 .long 0x7c601386 +#define MFEXISR_P1 .long 0x7c801286 +#define MTEXISR_P1 .long 0x7c801386 +#define MTEXIER_P0 .long 0x7c621386 +#define MFEXIER_P0 .long 0x7c621286 +#define MTEXIER_P1 .long 0x7c811386 +#define MTEXIER_P2 .long 0x7ca11386 +#define MFEXIER_P1 .long 0x7c811286 + +#define MTBESR_P0 .long 0x7c712386 +#define RFCI .long 0x4c000066 + +/* defines for cache support */ + +#undef _CPU_CACHE_ALIGN_SIZE +#define _CPU_CACHE_ALIGN_SIZE 16 /* cache line size */ + +#define _ICACHE_LINE_NUM 64 /* 64 cache lines per set */ +#define _DCACHE_LINE_NUM 32 /* 32 cache lines per set */ + +#define _PPC403_ICCR_DEFAULT_VAL 0x80000001 /* def. inst. cachability */ +#define _PPC403_DCCR_DEFAULT_VAL 0x80000001 /* def. data cachability */ + +#define CACHE_SAFE_ADRS(x) ((int) (x) | 0x80000000) +#define CACHE_ORIG_ADRS(x) ((int) (x) & 0x7fffffff) + +#define _PPC_CACHE_UNIFIED FALSE /* XXX */ + +/* 403ga specific special purpouse registers */ + +#define _PPC403_DBSR 0x3f0 /* debug status register read/clear */ +#define _PPC403_DCCR 0x3fa /* data cache control register r/w */ +#define _PPC403_DEAR 0x3d5 /* data exception address registers r */ +#define _PPC403_ESR 0x3d4 /* exception syndrom register r/w */ +#define _PPC403_EVPR 0x3d6 /* exception prefix register r/w */ +#define _PPC403_ICCR 0x3fb /* instruction cache control register r/w */ +#define _PPC403_PBL1 0x3fc /* protection bound lower 1 r/w */ +#define _PPC403_PBL2 0x3fe /* protection bound lower 2 r/w */ +#define _PPC403_PBU1 0x3fd /* protection bound upper 1 r/w */ +#define _PPC403_PBU2 0x3ff /* protection bound upper 2 r/w */ +#define _PPC403_PIT 0x3db /* programmable interval timer r/w */ +#define _PPC403_SRR2 0x3de /* save/restore register 2 r/w */ +#define _PPC403_SRR3 0x3df /* save/restore register 3 r/w */ +#define _PPC403_SGR 0x3b9 /* storage guarded register (PPC403GC) r/w */ +#define _PPC403_DCWR 0x3ba /* data cache write-thru (PPC403GC)r/w */ + +/* debug control register */ + +#define _DBCR_EDM_U 0x8000 /* external debug mode */ +#define _DBCR_IDM_U 0x4000 /* internal debug mode */ +#define _DBCR_IC_U 0x0800 /* instruction completion debug event */ +#define _DBCR_BT_U 0x0400 /* branch taken */ +#define _DBCR_EDE_U 0x0200 /* exception debug event */ +#define _DBCR_TDE_U 0x0100 /* trap debug event */ +#define _DBCR_FT_U 0x0004 /* freeze timers on debug */ +#define _DBCR_IA1_U 0x0002 /* instruction address compare 1 */ +#define _DBCR_IA2_U 0x0001 /* instruction address compare 2 */ +#define _DBCR_EDM 0x80000000 /* external debug mode */ +#define _DBCR_IDM 0x40000000 /* internal debug mode */ +#define _DBCR_IC 0x08000000 /* instruction completion debug event */ +#define _DBCR_BT 0x04000000 /* branch taken */ +#define _DBCR_EDE 0x02000000 /* exception debug event */ +#define _DBCR_TDE 0x01000000 /* trap debug event */ +#define _DBCR_FT 0x00040000 /* freeze timers on debug */ +#define _DBCR_IA1 0x00020000 /* instruction address compare 1 */ +#define _DBCR_IA2 0x00010000 /* instruction address compare 2 */ +#define _DBCR_D1R 0x00008000 /* data address compare read 1 */ +#define _DBCR_D1W 0x00004000 /* data address compare write 1 */ +#define _DBCR_D2R 0x00000800 /* data address compare read 2 */ +#define _DBCR_D2W 0x00000400 /* data address compare write 2 */ +#define _DBCR_JOI 0x00000002 /* jtag serial outbound */ +#define _DBCR_JII 0x00000001 /* jtag serial inbound */ + +/* set access from type in DBCR */ + +#define _DBCR_D1A(x) (((x) & 0x03) << 14) /* for first breakpoint */ +#define _DBCR_D2A(x) (((x) & 0x03) << 10) /* for second breakpoint */ + +/* set size from type in DBCR */ + +#define _DBCR_D1S(x) (((x) & 0x0C) << 10) /* for first breakpoint */ +#define _DBCR_D2S(x) (((x) & 0x0C) << 6) /* for first breakpoint */ + +/* get access from DBCR */ + +#define _DBCR_D1_ACCESS(x) (((x) >> 14) & 0x03) +#define _DBCR_D2_ACCESS(x) (((x) >> 10) & 0x03) + +/* get size from DBCR */ + +#define _DBCR_D1_SIZE(x) (((x) >> 10) & 0x0C) +#define _DBCR_D2_SIZE(x) (((x) >> 6) & 0x0C) + +/* debug status register */ + +#define _DBSR_IC_U 0x8000 /* instruction completion */ +#define _DBSR_BT_U 0x4000 /* branch taken */ +#define _DBSR_EXC_U 0x2000 /* exception debug */ +#define _DBSR_TIE_U 0x1000 /* trap instruction */ +#define _DBSR_UDE_U 0x0800 /* unconditional debug */ +#define _DBSR_IA1_U 0x0400 /* instruction address compare 1 */ +#define _DBSR_IA2_U 0x0200 /* instruction address compare 2 */ +#define _DBSR_DR1_U 0x0100 /* data address compare read 1 */ +#define _DBSR_DW1_U 0x0080 /* data address compare write 1 */ +#define _DBSR_DR2_U 0x0040 /* data address compare read 2 */ +#define _DBSR_DW2_U 0x0020 /* data address compare write 2 */ +#define _DBSR_IDE_U 0x0010 /* imprecise debug */ +#define _DBSR_IC 0x80000000 /* instruction completion */ +#define _DBSR_BT 0x40000000 /* branch taken */ +#define _DBSR_EXC 0x20000000 /* exception debug */ +#define _DBSR_TIE 0x10000000 /* trap instruction */ +#define _DBSR_UDE 0x08000000 /* unconditional debug */ +#define _DBSR_IA1 0x04000000 /* instruction address compare 1 */ +#define _DBSR_IA2 0x02000000 /* instruction address compare 2 */ +#define _DBSR_DR1 0x01000000 /* data address compare read 1 */ +#define _DBSR_DW1 0x00800000 /* data address compare write 1 */ +#define _DBSR_DR2 0x00400000 /* data address compare read 2 */ +#define _DBSR_DW2 0x00200000 /* data address compare write 2 */ +#define _DBSR_IDE 0x00100000 /* imprecise debug */ +#define _DBSR_MRRM 0x00000300 /* Most recent reset mask */ +#define _DBSR_MRR(n) ((n) << 8) /* Most recent reset */ +#define _DBSR_JIF 0x00000004 /* jtag serial inbound buffer full */ +#define _DBSR_JIO 0x00000002 /* jtag serial inbound buffer overrun */ +#define _DBSR_JOE 0x00000001 /* jtag serial outbound buffer empty */ + +/* mask for hardware breakpoints */ + +#define _DBSR_HWBP_MSK (_DBSR_IA1 | _DBSR_IA2 | \ + _DBSR_DR1 | _DBSR_DW1 | \ + _DBSR_DR2 | _DBSR_DW2) + +/* device control registers */ + +#define _PPC403_BEAR 0x90 /* bus error address register (read only) */ +#define _PPC403_BESR 0x91 /* bus error syndrom register (r/w) */ +#define _PPC403_BR0 0x80 /* bank register 0 (r/w) */ +#define _PPC403_BR1 0x81 /* bank register 1 (r/w) */ +#define _PPC403_BR2 0x82 /* bank register 2 (r/w) */ +#define _PPC403_BR3 0x83 /* bank register 3 (r/w) */ +#define _PPC403_BR4 0x84 /* bank register 4 (r/w) */ +#define _PPC403_BR5 0x85 /* bank register 5 (r/w) */ +#define _PPC403_BR6 0x86 /* bank register 6 (r/w) */ +#define _PPC403_BR7 0x87 /* bank register 7 (r/w) */ + +#define _PPC403_DMACC0 0xc4 /* dma chained count 0 (r/w) */ +#define _PPC403_DMACC1 0xcc /* dma chained count 1 (r/w) */ +#define _PPC403_DMACC2 0xd4 /* dma chained count 2 (r/w) */ +#define _PPC403_DMACC3 0xdc /* dma chained count 3 (r/w) */ +#define _PPC403_DMACR0 0xc0 /* dma channel control register 0 (r/w) */ +#define _PPC403_DMACR1 0xc8 /* dma channel control register 1 (r/w) */ +#define _PPC403_DMACR2 0xd0 /* dma channel control register 2 (r/w) */ +#define _PPC403_DMACR3 0xd8 /* dma channel control register 3 (r/w) */ +#define _PPC403_DMACT0 0xc1 /* dma count register 0 (r/w) */ +#define _PPC403_DMACT1 0xc9 /* dma count register 1 (r/w) */ +#define _PPC403_DMACT2 0xd1 /* dma count register 2 (r/w) */ +#define _PPC403_DMACT3 0xd9 /* dma count register 3 (r/w) */ +#define _PPC403_DMADA0 0xc2 /* dma destination address register 0 (r/w) */ +#define _PPC403_DMADA1 0xca /* dma destination address register 1 (r/w) */ +#define _PPC403_DMADA2 0xd2 /* dma destination address register 2 (r/w) */ +#define _PPC403_DMADA3 0xda /* dma destination address register 3 (r/w) */ +#define _PPC403_DMASA0 0xc3 /* dma source address register 0 (r/w) */ +#define _PPC403_DMASA1 0xcb /* dma source address register 1 (r/w) */ +#define _PPC403_DMASA2 0xd3 /* dma source address register 2 (r/w) */ +#define _PPC403_DMASA3 0xdb /* dma source address register 3 (r/w) */ +#define _PPC403_DMASR 0xe0 /* dma status register (r/w) */ + +#define _PPC403_EXISR 0x40 /* external interrupt status register (r/w) */ +#define _PPC403_EXIER 0x42 /* external interrupt enable register (r/w) */ +#define _PPC403_IOCR 0xa0 /* input/output configuration register (r/w) */ + +/* time control register */ + +#define _PPC403_TCR_WPM_U 0xc000 /* watchdog period mask */ +#define _PPC403_TCR_WRCM_U 0x3000 /* wotchdog reset control */ +#define _PPC403_TCR_WIEM_U 0x0800 /* watchdog interrupt enable */ +#define _PPC403_TCR_PIEM_U 0x0400 /* pit interupt enable */ +#define _PPC403_TCR_FPM_U 0x0300 /* fit period */ +#define _PPC403_TCR_FIEM_U 0x0080 /* fit interrupt enable */ + +/* timer control register */ + +#define _PPC403_TCR_WPM_U 0xc000 /* watchdog period */ +#define _PPC403_TCR_WRCM_U 0x3000 /* watchdog reset control */ +#define _PPC403_TCR_WIEM_U 0x0800 /* watchdog interrupt enable */ +#define _PPC403_TCR_PIEM_U 0x0400 /* pit interrupt enable */ +#define _PPC403_TCR_FP_U 0x0300 /* fit period */ +#define _PPC403_TCR_FIE_U 0x0080 /* fit interrupt enable */ +#define _PPC403_TCR_ARE_U 0x0040 /* fit auto-reload enable */ + +/* timer status register */ + +#define _PPC403_TSR_SNWM_U 0x8000 /* supress next watchdog */ +#define _PPC403_TSR_WISM_U 0x4000 /* watchdog interrupt status */ +#define _PPC403_TSR_WRSM_U 0x3000 /* watchdog reset status */ +#define _PPC403_TSR_PISM_U 0x0800 /* pit interrupt status */ +#define _PPC403_TSR_FISM_U 0x0400 /* fit interrupt status */ + + +/* defintion of external interrupt status and enable registers' mask bits */ +/* Interrupts are enabled by setting the corresponding bits in the EXIER */ +/* When interrupts occur, the corresponding bits in EXISR are set to one. */ + +#define _PPC403_EXI_CI 0x80000000 /* critical interrupt */ +#define _PPC403_EXI_SRI 0x08000000 /* serial port receiver interrupt */ +#define _PPC403_EXI_STI 0x04000000 /* serial port transmitter interrupt */ +#define _PPC403_EXI_JRI 0x02000000 /* JTAG serial port receiver */ +#define _PPC403_EXI_JTI 0x01000000 /* JTAG serial port receiver */ +#define _PPC403_EXI_D0I 0x00800000 /* dma channel 0 */ +#define _PPC403_EXI_D1I 0x00400000 /* dma channel 1 */ +#define _PPC403_EXI_D2I 0x00200000 /* dma channel 2 */ +#define _PPC403_EXI_D3I 0x00100000 /* dma channel 3 */ +#define _PPC403_EXI_E0I 0x00000010 /* external interrupt0 */ +#define _PPC403_EXI_E1I 0x00000008 /* external interrupt1 */ +#define _PPC403_EXI_E2I 0x00000004 /* external interrupt2 */ +#define _PPC403_EXI_E3I 0x00000002 /* external interrupt3 */ +#define _PPC403_EXI_E4I 0x00000001 /* external interrupt4 */ + + +#define _PPC403_IOCR_E0TM 0x80000000 /* external intr 0 triggering */ + /* 0 - level sensitive */ + /* 1 - edge triggered */ +#define _PPC403_IOCR_E0LM 0x40000000 /* external inter 0 active level */ +#define _PPC403_IOCR_E1TM 0x20000000 /* external intr 1 triggering */ +#define _PPC403_IOCR_E1LM 0x10000000 /* external intr 1 active level */ +#define _PPC403_IOCR_E2TM 0x08000000 /* external intr 2 triggering */ +#define _PPC403_IOCR_E2LM 0x04000000 /* external intr 2 active level */ +#define _PPC403_IOCR_E3TM 0x02000000 /* external intr 3 triggering */ +#define _PPC403_IOCR_E3LM 0x01000000 /* external intr 3 active level */ +#define _PPC403_IOCR_E4TM 0x00800000 /* external intr 4 triggering */ +#define _PPC403_IOCR_E4LM 0x00400000 /* external intr 4 active level */ +#define _PPC403_IOCR_EDT 0x00080000 /* enable dram tri-state (GCX) */ +#define _PPC403_IOCR_SOR 0x00040000 /* enable sampling data (GCX) */ +#define _PPC403_IOCR_EDO 0x00008000 /* EDO dram enable (GCX) */ +#define _PPC403_IOCR_2XC 0x00004000 /* clock double core enable (GCX) */ +#define _PPC403_IOCR_ATC 0x00002000 /* adress tri-state control */ +#define _PPC403_IOCR_SPD 0x00001000 /* static power disable */ +#define _PPC403_IOCR_BEM 0x00000800 /* byte enable mode SRAM accesses*/ +#define _PPC403_IOCR_PTD 0x00000400 /* device-paced mode disable SRAM */ +#define _PPC403_IOCR_ARE 0x00000080 /* asynchronous ready enable SRAM */ + +#define _PPC403_IOCR_DRCM 0x00000020 /* DRAM read on CAS */ +#define _PPC403_IOCR_RDMM 0x00000018 /* real time debug mode */ + /* b'00 - trace status output disabled */ + /* b'01 - program and bus status */ + /* b'10 - program status and trace output */ + /* b'11 - reserved */ +#define _PPC403_IOCR_RDM(n) ((n)<<3) /* real time debug mode */ +#define _PPC403_IOCR_TCSM 0x00000004 /* timer clock source */ + /* 0 - SysClk pin */ + /* 1 - TimerClk pin */ +#define _PPC403_IOCR_SCSM 0x00000002 /* serial port clock source */ + /* 0 - SysClk pin */ + /* 1 - SerClk pin */ +#define _PPC403_IOCR_SPCM 0x00000001 /* serial port configuration */ + /* 0 - DSR/DTR */ + /* 1 - CTS/RTS */ +/* exception syndrome register mask bits: + * 0 - error not occured 1 - error occured */ + +#define _PPC403_ESR_IMCPM 0x80000000 /* instr machine check protection */ +#define _PPC403_ESR_IMCNM 0x40000000 /* instr machine check non-configured */ +#define _PPC403_ESR_IMCBM 0x20000000 /* instr machine check bus error */ +#define _PPC403_ESR_IMCTM 0x10000000 /* instr machine check timeout */ +#define _PPC403_ESR_PEIM 0x08000000 /* program exception - illegal */ +#define _PPC403_ESR_PEPM 0x04000000 /* program exception - previledged */ +#define _PPC403_ESR_PETM 0x02000000 /* program exception - trap */ +#define _PPC403_ESR_DST 0x00800000 /* data storage exception - store fault */ +#define _PPC403_ESR_DIZ 0x00400000 /* data/inst storage exception - zone f.*/ + +/* bus error syndrome register mask bits: 0 - no eroor 1 - error occured */ + +#define _PPC403_BESR_DSESM 0x80000000 /* data-side error status */ +#define _PPC403_BESR_DMESM 0x40000000 /* dma error status */ +#define _PPC403_BESR_RWSM 0x20000000 /* read/write status */ + /* 0 - write error */ + /* 1 - read error */ +#define _PPC403_BESR_ETM 0x1c000000 /* error type */ + /* 000 - protection violation */ + /* 001 - parity error (GCX) */ + /* 010 - access to non configured bank */ + /* 100 - active level error on bus eroor input pin */ + /* 110 - bus time-out */ + /* 111 - reserved */ +/* exception vector prefix register */ + +#define _PPC403_EVPR_EVPM 0xffff0000 /* exception vector prefix mask */ + +/* common bits for sram and dram configuration */ + +#define _PPC403_BR_BASM 0xff000000 /* base address select mask*/ +#define _PPC403_BR_BAS(n) ((n)<<24) /* base address select */ +#define _PPC403_BR_BSM 0x00e00000 /* bank size mask */ +#define _PPC403_BR_BS_1MB 0x00000000 /* bank size : 000 - 1MB */ +#define _PPC403_BR_BS_2MB 0x00200000 /* bank size : 001 - 2MB */ +#define _PPC403_BR_BS_4MB 0x00400000 /* bank size : 010 - 4MB */ +#define _PPC403_BR_BS_8MB 0x00600000 /* bank size : 011 - 8MB */ +#define _PPC403_BR_BS_16MB 0x00800000 /* bank size : 100 - 16MB */ +#define _PPC403_BR_BS_32MB 0x00a00000 /* bank size : 101 - 32MB */ +#define _PPC403_BR_BS_64MB 0x00c00000 /* bank size : 110 - 64MB */ +#define _PPC403_BR_BUM 0x00180000 /* bank usage mask */ +#define _PPC403_BR_BU_DIS 0x00000000 /* bank usage: 00 - disable */ +#define _PPC403_BR_BU_RO 0x00080000 /* bank usage: 01 - read only */ +#define _PPC403_BR_BU_WO 0x00100000 /* bank usage: 10 - write only */ +#define _PPC403_BR_BU_RW 0x00180000 /* bank usage: 11 - read/write only */ +#define _PPC403_BR_SLFM 0x00040000 /* sram-dram sequential line fill */ +#define _PPC403_BR_BWM 0x00018000 /* bus width mask */ +#define _PPC403_BR_BW_8 0x00000000 /* bus width 00 - 8 bit */ +#define _PPC403_BR_BW_16 0x00008000 /* bus width 01 - 16 bit */ +#define _PPC403_BR_BW_32 0x00010000 /* bus width 10 - 32 bit */ +#define _PPC403_BR_BW_64 0x00018000 /* bus width 11 - 64 bit */ +#define _PPC403_BR_SDM 0x00000001 /* sram-dram selection 0-dram 1-sram */ + +/* sram configuration (br0 - br7) */ + +#define _PPC403_BRS_BMEM 0x00020000 /* burst mode enable - 0 disabled */ +#define _PPC403_BRS_REM 0x00004000 /* ready enable - 0 disabled */ +#define _PPC403_BRS_TWM 0x00003f00 /* transfer wiat-contains the number + * of wait states inserted by the + * processor into all transactions */ +#define _PPC403_BRS_TWT(n) ((n)<<8) /* transfer wait states - non-burst */ +#define _PPC403_BRS_FWM 0x00003c00 /* first wait states mask */ +#define _PPC403_BRS_FWT(n) ((N)<<10) /* first wait states - burst */ +#define _PPC403_BRS_BWM 0x00000300 /* burst wait states mask */ +#define _PPC403_BRS_BWT(n) ((N)<<10) /* burst wait states */ +#define _PPC403_BRS_CSTM 0x00000080 /* chip select on timing + * 0 - valid when address is valid + * 1 - valid one SysClk cycle after + * address is valid */ +#define _PPC403_BRS_OETM 0x00000040 /* output enable on timing + * 0 - valid when chip select is valid + * 1 - valid one SysClk cycle after + * chip select is valid */ +#define _PPC403_BRS_WBNM 0x00000020 /* write byte enable on timing + * 0 - valid one chip select is valid + * 1 - on SysClk Cycle after */ +#define _PPC403_BRS_WBFM 0x00000010 /* write byte enable off on timing + * 0 - inactive when chip select + * becomes inactive + * 1 - inactive one SysClk cycle + * before chip select becoms + * inactive */ +#define _PPC403_BRS_THM 0x0000000e /* transfer hold mask */ +#define _PPC403_BRS_TH(n) ((n)<<1) /* transfer hold */ + +/* dram configuration (br4 - br7) */ + +#define _PPC403_BRD_ERM 0x00020000 /* Early Ras Mode */ +#define _PPC403_BRD_IEM 0x00004000 /* internal/external multiplex */ +#define _PPC403_BRD_RCTM 0x00002000 /* RAS active to CAS active timing */ +#define _PPC403_BRD_ARMM 0x00001000 /* alternate refresh mode + * 0 - normal refresh + * 1 - immediate or self refresh */ +#define _PPC403_BRD_PMM 0x00000800 /* page mode + * 0 - single accesses only + * 1 - burst access supported */ +#define _PPC403_BRD_FACM 0x00000600 /* first access timing mask */ +#define _PPC403_BRD_FAC(n) ((n)<<9) /* first access timing */ +#define _PPC403_BRD_BACM 0x00000180 /* burst access timing mask */ +#define _PPC403_BRD_BAC(n) ((n)<<7) /* burst access timing */ +#define _PPC403_BRD_PPCM 0x00000040 /* precharge cycles */ +#define _PPC403_BRD_RARM 0x00000020 /* RAS active during refresh + * 0 - one and half sysclk cycle + * 1 - two and half */ +#define _PPC403_BRD_RRM 0x0000001e /* refresh interval mask */ +#define _PPC403_BRD_RR(n) ((n)<<1) /* refresh interval */ + +/* bank register high configuration (brh0 - brh7) */ + + +#define _PPC403_BRH_PCE 0x80000000 /* parity check enable */ + +/* dma channel control register */ + +#define _DMACR_CE 0x80000000 /* channel enable */ +#define _DMACR_CIE 0x40000000 /* channel interrupt enable */ +#define _DMACR_TD 0x20000000 /* transfer direction */ +#define _DMACR_PL 0x10000000 /* peripheral location */ +#define _DMACR_PW_MASK 0x0c000000 /* peripheral width */ +#define _DMACR_PW_BYTE 0x00000000 /* byte */ +#define _DMACR_PW_SHORT 0x04000000 /* halfword */ +#define _DMACR_PW_WORD 0x08000000 /* word */ +#define _DMACR_PW_RES 0x0c000000 /* reserved */ +#define _DMACR_DAI 0x02000000 /* destination address increment */ +#define _DMACR_SAI 0x01000000 /* source address increment */ +#define _DMACR_CP 0x00800000 /* channel priority */ +#define _DMACR_TM_M 0x00600000 /* transfer mode mask */ +#define _DMACR_TM_B 0x00000000 /* buffered dma */ +#define _DMACR_TM_F 0x00200000 /* fly-by dma */ +#define _DMACR_TM_S 0x00400000 /* software initiated mem-to-mem dma */ +#define _DMACR_TM_H 0x00600000 /* hardware initiated mem-to-mem dma */ +#define _DMACR_PSC_M 0x00180000 /* peripheral setup cycles mask */ +#define _DMACR_PSC_0 0x00000000 /* no cycles */ +#define _DMACR_PSC_1 0x00080000 /* one cycles */ +#define _DMACR_PSC_2 0x00100000 /* two cycles */ +#define _DMACR_PSC_3 0x00180000 /* three cycles */ +#define _DMACR_PWC_MASK 0x0007e000 /* peripheral wait cycles mask */ +#define _DMACR_PHC_MASK 0x00001c00 /* peripheral hold cycles */ +#define _DMACR_ETD 0x00000200 /* eoc/tc pin direction */ +#define _DMACR_TCE 0x00000100 /* terminal count enable + * 0 - end-of-transfer input + * 1 - terminal count output + */ +#define _DMACR_CH 0x00000080 /* chaining enable */ +#define _DMACR_BME 0x00000040 /* burst mode enable */ +#define _DMACR_ECE 0x00000020 /* EOT chain mode enable */ +#define _DMACR_TCD 0x00000010 /* TC chain mode disable */ +#define _DMACR_PCE 0x00000008 /* parity check enable */ + +/* dma status registers */ + +#define _DMASR_CS0_MASK 0x80000000 /* channel 0 terminal status */ +#define _DMASR_CS1_MASK 0x40000000 /* channel 1 terminal status */ +#define _DMASR_CS2_MASK 0x20000000 /* channel 2 terminal status */ +#define _DMASR_CS3_MASK 0x10000000 /* channel 3 terminal status */ + +#define _DMASR_TS0_MASK 0x08000000 /* channel 0 end-of-transfer status */ +#define _DMASR_TS1_MASK 0x04000000 /* channel 1 end-of-transfer status */ +#define _DMASR_TS2_MASK 0x02000000 /* channel 2 end-of-transfer status */ +#define _DMASR_TS3_MASK 0x01000000 /* channel 3 end-of-transfer status */ + +#define _DMASR_RI0_MASK 0x00800000 /* channel 0 error status */ +#define _DMASR_RI1_MASK 0x00400000 /* channel 1 error status */ +#define _DMASR_RI2_MASK 0x00200000 /* channel 2 error status */ +#define _DMASR_RI3_MASK 0x00100000 /* channel 3 error status */ + +#define _DMASR_IR0_MASK 0x00040000 /* internal dma reguest 0 */ +#define _DMASR_IR1_MASK 0x00020000 /* internal dma reguest 1 */ +#define _DMASR_IR2_MASK 0x00010000 /* internal dma reguest 2 */ +#define _DMASR_IR3_MASK 0x00008000 /* internal dma reguest 3 */ + +#define _DMASR_ER0_MASK 0x00004000 /* external dma reguest 0 */ +#define _DMASR_ER1_MASK 0x00002000 /* external dma reguest 1 */ +#define _DMASR_ER2_MASK 0x00001000 /* external dma reguest 2 */ +#define _DMASR_ER3_MASK 0x00000800 /* external dma reguest 3 */ + +#define _DMASR_CB0_MASK 0x00000400 /* channel 0 busy */ +#define _DMASR_CB1_MASK 0x00000200 /* channel 1 busy */ +#define _DMASR_CB2_MASK 0x00000100 /* channel 2 busy */ +#define _DMASR_CB3_MASK 0x00000080 /* channel 3 busy */ + +#define _DMASR_CT0_MASK 0x00080000 /* chained transfer on channel 0 */ +#define _DMASR_CT1_MASK 0x00000040 /* chained transfer on channel 1 */ +#define _DMASR_CT2_MASK 0x00000020 /* chained transfer on channel 1 */ +#define _DMASR_CT3_MASK 0x00000010 /* chained transfer on channel 1 */ + +/* PVR definition */ + +#define _PVR_FAM_MSK 0xfff00000 /* processor family mask*/ +#define _PVR_MEM_MSK 0x000f0000 /* processor family member mask */ +#define _PVR_CCF_MSK 0x0000f000 /* Core Configuration mask */ +#define _PVR_PCF_MSK 0x00000f00 /* Peripheral Configuration mask */ +#define _PVR_MAJ_MSK 0x000000f0 /* Major Change Level mask */ +#define _PVR_MIN_MSK 0x0000000f /* Minor Change Level mask */ + +#define _PVR_CONF_403GA 0x0000 /* processor conf. bits for 403GA */ +#define _PVR_CONF_403GC 0x0002 /* processor conf. bits for 403GC */ +#define _PVR_CONF_403GCX 0x0014 /* processor conf. bits for 403GCX */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCppc403h */ diff --git a/h/arch/ppc/ppc405.h b/h/arch/ppc/ppc405.h new file mode 100644 index 0000000..b48eab6 --- /dev/null +++ b/h/arch/ppc/ppc405.h @@ -0,0 +1,356 @@ +/* ppc405.h - PowerPC 405 specific header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01o,01nov04,pch SPR 83004: move SPRG[4-7] definitions from asmPpc.h to ppc405.h +01n,24sep04,pch add _PPC_MSR_DWE +01m,12feb04,jtp Add _WRS_MMU_CLASS_* macro +01l,05dec03,jtp Add _WRS_TLB_MISS_CLASS_HW, _PPC_MSR_MMU_EXTRACT +01k,29oct03,jtp SPR 77774: Support Writethru cache +01k,23oct03,pch SPR 80911: get PPC4xx cache dimensions from PVR +01j,13mar03,pch Add PPC32 support & fix SPR 83162 +01i,06dec02,pch Add MSR bit number definitions +01h,13jun02,jtp identify class of MMU support (SPR #78396) +01g,22nov01,pch Add _WRS_STRICT_ALIGNMENT for target/src/ostool/loadElfLib.c +01f,04dec00,s_m register cleanup +01e,30nov00,s_m fixed PLB error address regs +01d,30oct00,s_m changed DBCR to DBCR0 +01c,25oct00,s_m renamed PPC405 cpu types +01b,20oct00,s_m Added defines from walnut bsp ppc405.h +01a,7mar2K,alp written. +*/ + +#ifndef __INCppc405h +#define __INCppc405h + +#ifdef __cplusplus +extern "C" { +#endif + +/* INT_MASK definition (mask EE & CE bits) : overwrite the one in asmPpc.h */ + +#undef INT_MASK +#define INT_MASK(src, des) rlwinm des, src, 0, 17, 15; \ + rlwinm des, des, 0, 15, 13 + +/* + * Tell the loader this processor can't handle any misalignment. + * It's supposed to be able to, but this seems a + * worthwhile precaution considering various errata. + */ +#define _WRS_STRICT_ALIGNMENT 1 + +/* MMU supports software TLB miss handler */ +#define _WRS_TLB_MISS_CLASS_SW 1 +#undef _WRS_TLB_MISS_CLASS_HW + +/* MMU uses PID register to extend virtual address tag */ +#define _WRS_MMU_CLASS_PID_REG 1 +#undef _WRS_MMU_CLASS_SR_REGS +#undef _WRS_MMU_CLASS_NONE + +/* MMU ASID context register name for _WRS_MMU_CLASS_PID_REG */ +#define _PPC_PID_REG PID + +/* MSR definitions */ + +#undef _PPC_MSR_POW_U /* power management not supported */ +#undef _PPC_MSR_ILE_U /* little endian mode not supported */ +#undef _PPC_MSR_SF_U /* 64 bit mode not implemented */ + +#undef _PPC_MSR_BE /* branch trace not supported */ +#undef _PPC_MSR_IT /* instruction address translation unsupported*/ +#undef _PPC_MSR_DT /* data address translation unsupported */ +#undef _PPC_MSR_RI /* recoverable interrupt unsupported */ +#undef _PPC_MSR_LE /* little endian mode unsupported */ +#undef _PPC_MSR_SE /* single step unsupported */ +#undef _PPC_MSR_PE /* protection enable unsupported */ +#undef _PPC_MSR_PX /* protection exclusive mode unsupported */ + +/* PPC405F supports a FPU whereas the PPC405 does not */ +#if (CPU == PPC405) +#undef _PPC_MSR_FP /* floating point unsupported */ +#undef _PPC_MSR_FE1 /* floating point not supported */ +#undef _PPC_MSR_FE0 /* floating point not supported */ +#endif /* PPC405 */ + +#define _PPC_MSR_WE_U 0x0004 /* wait state enable */ +#define _PPC_MSR_CE_U 0x0002 /* critical interrupt enable */ +#define _PPC_MSR_DWE 0x0400 /* debug wait enable */ +#define _PPC_MSR_DE 0x0200 /* debug exception enable */ +#define _PPC_MSR_IR 0x0020 /* instruction relocate */ +#define _PPC_MSR_DR 0x0010 /* data relocate */ +#define _PPC_MSR_CE 0x00020000 /* critical interrupt enable mask */ +#define _PPC_MSR_AP_U 0x0200 /* Auxiliary Processor Unit available */ +#define _PPC_MSR_APE_U 0x0008 /* APU Exception Enable */ + +/* MSR bit number definitions */ + +#if (CPU == PPC405F) +#define _PPC_MSR_BIT_FP 18 /* MSR Floating Ponit Aval. bit - FP */ +#define _PPC_MSR_BIT_FE0 20 /* MSR FP exception mode 0 bit - FE0 */ +#define _PPC_MSR_BIT_FE1 23 /* MSR FP exception mode 1 bit - FE1 */ +#endif /* PPC405 */ +#define _PPC_MSR_BIT_IR 26 /* MSR Inst Translation bit - IR */ +#define _PPC_MSR_BIT_DR 27 /* MSR Data Translation bit - DR */ + +/* MSR MMU Bit extraction macros */ + +#define _PPC_MSR_MMU_EXTRACT(src, dst) \ + rlwinm dst, src, 0, _PPC_MSR_BIT_IR, _PPC_MSR_BIT_DR + +/* Special Purpose Registers - General */ +#define SPRG4 276 /* 0x114 */ +#define SPRG5 277 /* 0x115 */ +#define SPRG6 278 /* 0x116 */ +#define SPRG7 279 /* 0x117 */ + +/* read-only access to SPRG4-7 */ +#define SPRG4R 0x104 /* Special Purpose General 4 - read only */ +#define SPRG5R 0x105 /* Special Purpose General 5 - read only */ +#define SPRG6R 0x106 /* Special Purpose General 6 - read only */ +#define SPRG7R 0x107 /* Special Purpose General 7 - read only */ + +/* Device Control Register PowerPC405 specific */ + +#undef DEC /* decrementer not supported */ + +/* Special Purpose Register PowerPC405 specific */ + +#define CCR0 0x3b3 /* core configuration register r/w */ +#define DAC1 0x3f6 /* data adress compare register 1 r/w */ +#define DAC2 0x3f7 /* data adress compare register 2 r/w */ +#define DBCR0 0x3f2 /* debug control register read/write */ +#define DBCR1 0x3bd /* debug control register read/write */ +#define DBSR 0x3f0 /* debug status register read/clear */ +#define DCCR 0x3fa /* data cache control register r/w */ +#define DCWR 0x3ba /* data cache write-thru register (PPC405GC) r/w */ +#define DVC1 0x3b6 /* Data value compare 1 */ +#define DVC2 0x3b7 /* Data value compare 2 */ +#define DEAR 0x3d5 /* data exception address registers r */ +#define ESR 0x3d4 /* exception syndrom register r/w */ +#define EVPR 0x3d6 /* exception prefix register r/w */ +#define IAC1 0x3f4 /* instruction adress compare register 1 r/w */ +#define IAC2 0x3f5 /* instruction adress compare register 2 r/w */ +#define IAC3 0x3b4 /* instruction adress compare register 3 r/w */ +#define IAC4 0x3b5 /* instruction adress compare register 4 r/w */ +#define ICCR 0x3fb /* instruction cache cacheability register r/w */ +#define ICDBDR 0x3d3 /* instruction cache debug data register r */ +#define PID 0x3b1 /* process id r */ +#define PIT 0x3db /* programmable interval timer r/w */ +#define SGR 0x3b9 /* storage guarded register (PPC405GC) r/w */ +#define SLER 0x3bb /* Storage Little Endian Register */ +#define SRR2 0x3de /* save/restore register 2 r/w */ +#define SRR3 0x3df /* save/restore register 3 r/w */ +#define SU0R 0x3bc /* Storage User Defined 0 Register */ +#define TBLO 0x11c /* time base low r/w */ +#define TBHI 0x11d /* time base high r/w */ +#define TCR 0x3da /* timer control register r/w */ +#define TSR 0x3d8 /* timer status register read/clear */ +#define TSRS 0x3d9 /* timer status register set (set only) */ +#define ZPR 0x3b0 /* zone protection register (PPC405GC/GCX) r/w */ + +#define mtdcr(dcrn, rs) .long (0x7c0001c3 | (rs << 21) | (dcrf << 11)) + +#define MTDCR 0x7c0001c3 +#define MFDCR 0x7c000143 + +/* defines for cache support */ +#define _PPC405_ICCR_DEFAULT_VAL 0x80000001 /* def. inst. cachability */ +#define _PPC405_DCCR_DEFAULT_VAL 0x80000001 /* def. data cachability */ +#define _PPC405_DCWR_DEFAULT_VAL 0x00000000 /* def. data writethru */ + +#undef _CPU_CACHE_ALIGN_SIZE +#define _CPU_CACHE_ALIGN_SIZE 32 /* all 405 cores have 32-byte cache lines */ + +#define _PPC405_ICACHE_NWAYS 2 /* all 405 cores have 2-way Icache */ +#define _PPC405_DCACHE_NWAYS 2 /* all 405 cores have 2-way Dcache */ + +#define _CACHE_LINE_MASK 0x0000001F + +#define _PPC_CACHE_UNIFIED FALSE + +/* + * PPC4xx processors encode the L1 cache dimensions in PVR[16-21]. + * See cacheArchLib.c for the encoding. + */ +#define _PPC_PVR_CACHE_SIZE_FIELD ((vxPvrGet() >> 10) & 0x03f) + +/* 405 specific special purpose registers */ + +#define _PPC405_DBSR 0x3f0 /* debug status register read/clear */ +#define _PPC405_DCCR 0x3fa /* data cache control register r/w */ +#define _PPC405_DEAR 0x3d5 /* data exception address registers r */ +#define _PPC405_ESR 0x3d4 /* exception syndrom register r/w */ +#define _PPC405_EVPR 0x3d6 /* exception prefix register r/w */ +#define _PPC405_ICCR 0x3fb /* instruction cache control register r/w */ +#define _PPC405_PBL1 0x3fc /* protection bound lower 1 r/w */ +#define _PPC405_PBL2 0x3fe /* protection bound lower 2 r/w */ +#define _PPC405_PBU1 0x3fd /* protection bound upper 1 r/w */ +#define _PPC405_PBU2 0x3ff /* protection bound upper 2 r/w */ +#define _PPC405_PIT 0x3db /* programmable interval timer r/w */ +#define _PPC405_SRR2 0x3de /* save/restore register 2 r/w */ +#define _PPC405_SRR3 0x3df /* save/restore register 3 r/w */ +#define _PPC405_SGR 0x3b9 /* storage guarded register (PPC405GC) r/w */ +#define _PPC405_DCWR 0x3ba /* data cache write-thru (PPC405GC)r/w */ + +/* debug control register 0 */ + +#define _DBCR0_EDM_U 0x8000 /* external debug mode */ +#define _DBCR0_IDM_U 0x4000 /* internal debug mode */ +#define _DBCR0_RST_U 0x3000 /* reset */ +#define _DBCR0_IC_U 0x0800 /* instruction completion debug event */ +#define _DBCR0_BT_U 0x0400 /* branch taken */ +#define _DBCR0_EDE_U 0x0200 /* exception debug event */ +#define _DBCR0_TDE_U 0x0100 /* trap debug event */ +#define _DBCR0_IA1_U 0x0080 /* instruction address compare 1 */ +#define _DBCR0_IA2_U 0x0040 /* instruction address compare 2 */ +#define _DBCR0_IA12_U 0x0020 /* instruction address compare 1:2 */ +#define _DBCR0_IA12X_U 0x0010 /* instruction address compare 1:2 excl. */ +#define _DBCR0_IA3_U 0x0008 /* instruction address compare 3 */ +#define _DBCR0_IA4_U 0x0004 /* instruction address compare 4 */ +#define _DBCR0_IA34_U 0x0002 /* instruction address compare 3:4 */ +#define _DBCR0_IA34X_U 0x0001 /* instruction address compare 3:4 excl. */ +#define _DBCR0_EDM 0x80000000 /* external debug mode */ +#define _DBCR0_IDM 0x40000000 /* internal debug mode */ +#define _DBCR0_RST 0x30000000 /* reset */ +#define _DBCR0_IC 0x08000000 /* instruction completion debug event */ +#define _DBCR0_BT 0x04000000 /* branch taken */ +#define _DBCR0_EDE 0x02000000 /* exception debug event */ +#define _DBCR0_TDE 0x01000000 /* trap debug event */ +#define _DBCR0_IA1 0x00800000 /* instruction address compare 1 */ +#define _DBCR0_IA2 0x00400000 /* instruction address compare 2 */ +#define _DBCR0_IA12 0x00200000 /* instruction address compare 1:2 */ +#define _DBCR0_IA12X 0x00100000 /* instruction address compare 1:2 excl. */ +#define _DBCR0_IA3 0x00080000 /* instruction address compare 3 */ +#define _DBCR0_IA4 0x00040000 /* instruction address compare 4 */ +#define _DBCR0_IA34 0x00020000 /* instruction address compare 3:4 */ +#define _DBCR0_IA34X 0x00010000 /* instruction address compare 3:4 excl. */ +#define _DBCR0_FT 0x00000001 /* freeze timers on debug */ + +/* debug control register 1 */ +#define _DBCR1_D1R_U 0x8000 /* data address compare 1 read */ +#define _DBCR1_D2R_U 0x4000 /* data address compare 2 read */ +#define _DBCR1_D1W_U 0x2000 /* data address compare 1 write */ +#define _DBCR1_D2W_U 0x1000 /* data address compare 2 write */ +#define _DBCR1_D1S_U 0x0C00 /* DAC 1 size */ +#define _DBCR1_D2S_U 0x0300 /* DAC 2 size */ +#define _DBCR1_DA12_U 0x0080 /* DA range compare 1:2 */ +#define _DBCR1_DA12X_U 0x0040 /* DA range excl. compare 1:2 */ +#define _DBCR1_DV1M_U 0x000C /* Data value compare 1 mode */ +#define _DBCR1_DV2M_U 0x0003 /* Data value compare 2 mode */ +#define _DBCR1_D1R 0x80000000 /* data address compare 1 read */ +#define _DBCR1_D2R 0x40000000 /* data address compare 2 read */ +#define _DBCR1_D1W 0x20000000 /* data address compare 1 write */ +#define _DBCR1_D2W 0x10000000 /* data address compare 2 write */ +#define _DBCR1_D1S 0x0C000000 /* DAC 1 size */ +#define _DBCR1_D2S 0x03000000 /* DAC 2 size */ +#define _DBCR1_DA12 0x00800000 /* DA range compare 1:2 */ +#define _DBCR1_DA12X 0x00400000 /* DA range excl. compare 1:2 */ +#define _DBCR1_DV1M 0x000C0000 /* Data value compare 1 mode */ +#define _DBCR1_DV2M 0x00030000 /* Data value compare 2 mode */ +#define _DBCR1_DV1BE 0x0000F000 /* Data value compare 1 byte enable */ +#define _DBCR1_DV2BE 0x00000F00 /* Data value compare 2 byte enable */ + +/* data access sizes */ +#define _DBCR1_D1S_BYTE 0x00000000 /* byte address */ +#define _DBCR1_D1S_HWORD 0x04000000 /* halfword address */ +#define _DBCR1_D1S_WORD 0x08000000 /* word address */ +#define _DBCR1_D1S_CACHE_LINE 0x0C000000 /* cache line (8-word) addrs. */ + +#define _DBCR1_D2S_BYTE 0x00000000 /* byte address */ +#define _DBCR1_D2S_HWORD 0x01000000 /* halfword address */ +#define _DBCR1_D2S_WORD 0x02000000 /* word address */ +#define _DBCR1_D2S_CACHE_LINE 0x03000000 /* cache line (8-word) addrs. */ + + +/* debug status register */ + +#define _DBSR_IC_U 0x8000 /* instruction completion */ +#define _DBSR_BT_U 0x4000 /* branch taken */ +#define _DBSR_EXC_U 0x2000 /* exception debug */ +#define _DBSR_TIE_U 0x1000 /* trap instruction */ +#define _DBSR_UDE_U 0x0800 /* unconditional debug */ +#define _DBSR_IA1_U 0x0400 /* instruction address compare 1 */ +#define _DBSR_IA2_U 0x0200 /* instruction address compare 2 */ +#define _DBSR_DR1_U 0x0100 /* data address compare read 1 */ +#define _DBSR_DW1_U 0x0080 /* data address compare write 1 */ +#define _DBSR_DR2_U 0x0040 /* data address compare read 2 */ +#define _DBSR_DW2_U 0x0020 /* data address compare write 2 */ +#define _DBSR_IDE_U 0x0010 /* imprecise debug */ +#define _DBSR_IA3_U 0x0008 /* instruction address compare 3 */ +#define _DBSR_IA4_U 0x0004 /* instruction address compare 4 */ +#define _DBSR_IC 0x80000000 /* instruction completion */ +#define _DBSR_BT 0x40000000 /* branch taken */ +#define _DBSR_EXC 0x20000000 /* exception debug */ +#define _DBSR_TIE 0x10000000 /* trap instruction */ +#define _DBSR_UDE 0x08000000 /* unconditional debug */ +#define _DBSR_IA1 0x04000000 /* instruction address compare 1 */ +#define _DBSR_IA2 0x02000000 /* instruction address compare 2 */ +#define _DBSR_DR1 0x01000000 /* data address compare read 1 */ +#define _DBSR_DW1 0x00800000 /* data address compare write 1 */ +#define _DBSR_DR2 0x00400000 /* data address compare read 2 */ +#define _DBSR_DW2 0x00200000 /* data address compare write 2 */ +#define _DBSR_IDE 0x00100000 /* imprecise debug */ +#define _DBSR_IA3 0x00080000 /* instruction address compare 3 */ +#define _DBSR_IA4 0x00040000 /* instruction address compare 4 */ +#define _DBSR_MRRM 0x00000300 /* Most recent reset mask */ +#define _DBSR_MRR(n) ((n) << 8) /* Most recent reset */ + +/* mask for hardware breakpoints */ + +#define _DBSR_HWBP_MSK (_DBSR_IA1 | _DBSR_IA2 | \ + _DBSR_DR1 | _DBSR_DW1 | \ + _DBSR_DR2 | _DBSR_DW2 | \ + _DBSR_IA3 | _DBSR_IA4) + +/* timer control register */ + +#define _PPC405_TCR_WPM_U 0xc000 /* watchdog period */ +#define _PPC405_TCR_WRCM_U 0x3000 /* watchdog reset control */ +#define _PPC405_TCR_WIEM_U 0x0800 /* watchdog interrupt enable */ +#define _PPC405_TCR_PIEM_U 0x0400 /* pit interrupt enable */ +#define _PPC405_TCR_FPM_U 0x0300 /* fit period */ +#define _PPC405_TCR_FIEM_U 0x0080 /* fit interrupt enable */ +#define _PPC405_TCR_ARE_U 0x0040 /* fit auto-reload enable */ + +/* timer status register */ + +#define _PPC405_TSR_SNWM_U 0x8000 /* supress next watchdog */ +#define _PPC405_TSR_WISM_U 0x4000 /* watchdog interrupt status */ +#define _PPC405_TSR_WRSM_U 0x3000 /* watchdog reset status */ +#define _PPC405_TSR_PISM_U 0x0800 /* pit interrupt status */ +#define _PPC405_TSR_FISM_U 0x0400 /* fit interrupt status */ + + +/* exception syndrome register mask bits: + * 0 - error not occured 1 - error occured */ + +#define _PPC405_ESR_IMCOM 0x80000000 /* instr machine check occurred */ +#define _PPC405_ESR_PEIM 0x08000000 /* program exception - illegal */ +#define _PPC405_ESR_PEPM 0x04000000 /* program exception - previledged */ +#define _PPC405_ESR_PETM 0x02000000 /* program exception - trap */ +#define _PPC405_ESR_DST 0x00800000 /* data storage exception - store fault */ +#define _PPC405_ESR_DIZ 0x00400000 /* data/inst storage exception - zone f.*/ +#define _PPC405_ESR_PFP 0x00080000 /* Program exception - FPU */ +#define _PPC405_ESR_U0F 0x00008000 /* data storage exception - U0 fault */ + + +/* exception vector prefix register */ + +#define _PPC405_EVPR_EVPM 0xffff0000 /* exception vector prefix mask */ + + +/* the following defines are needed by the 403/405 cache library */ + +#define _PVR_CONF_403GA 0x0000 /* processor conf. bits for 403GA */ +#define _PVR_CONF_403GC 0x0002 /* processor conf. bits for 403GC */ +#define _PVR_CONF_403GCX 0x0014 /* processor conf. bits for 403GCX */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCppc405h */ diff --git a/h/arch/ppc/ppc440.h b/h/arch/ppc/ppc440.h new file mode 100644 index 0000000..65727a6 --- /dev/null +++ b/h/arch/ppc/ppc440.h @@ -0,0 +1,614 @@ +/* ppc440.h - PowerPC 440 specific header */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01q,15sep04,dr Define _PPC_CCR0_BIT_DAPUIB_U +01r,08jun04,pch revise FP recognition +01q,18may04,mil Added _CPU_CACHE_ALIGN_SHIFT. +01p,12feb04,jtp Add _WRS_MMU_CLASS_* macro +01o,05dec03,jtp Add _WRS_TLB_MISS_CLASS_HW, _PPC_MSR_BIT_IS/DS, + _PPC_MSR_MMU_EXTRACT +01n,17nov03,pch move definition of MCHSA_BASE_REG to exc440x5.h +01m,23oct03,pch SPR 80911: get PPC4xx cache dimensions from PVR +01l,03apr03,pch Add PPC32 support +01k,30may03,pch Revise MCHSA_BASE_REG setting +01j,30apr03,pch Add individual bit definitions for CCR1_ICDPEI field +01i,03apr03,pch Fix _PPC_CCR1_TCS definition, add _PPC_CCR1_TCS_EXT, + and rename DCDBTRL bits to match manual +01h,04mar03,pch turn off PORTABLE +01g,10jan03,jtp SPR 82770 virtual i-cache for PPC440 requires unique + invalidation +01f,13dec02,pch Add support for 440x5 core (PPC440GX) +01e,13jun02,jtp identify class of MMU support (SPR #78396) +01d,24oct01,jtp add _PPC440_TCR_DIE and ...S +01c,16aug01,pch Remove definitions which are duplicated in asmPpc.h; + add "#define PORTABLE" for initial delivery. +01b,16aug01,pch Fix typos, remove definition of DEC +01a,15aug01,pch written, from ppc405.h vn 01f and the Fifth Preliminary + Edition (June 2001) of the IBM PPC440 Core User's Manual. +*/ + +#ifndef __INCppc440h +#define __INCppc440h + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * If compiling for a variant, the preprocessor symbol CPU_VARIANT will + * be defined as the directory suffix, e.g. _x5 for the 440x5 core (used + * in the 440GX) whose objects go in target/lib/ppc/PPC440/common_x5. + * + * While _x5 is currently the only variant defined, it seems inadvisable + * to just use #ifdef CPU_VARIANT: we really want something like + * #if ("CPU_VARIANT" == "_x5") + * which ANSI C does not allow. However, it does allow the expansion + * of CPU_VARIANT to be re-expanded according to another #define. + */ +#define PPC_440x4 +#ifdef CPU_VARIANT +#define _x5 5 +#if (CPU_VARIANT == _x5) +#undef PPC_440x4 +#define PPC_440x5 +#endif /* CPU_VARIANT == _x5 */ +#undef _x5 +#endif /* CPU_VARIANT */ + +/* MMU supports software TLB miss handler */ +#define _WRS_TLB_MISS_CLASS_SW 1 +#undef _WRS_TLB_MISS_CLASS_HW + +/* MMU uses PID register to extend virtual address tag */ +#define _WRS_MMU_CLASS_PID_REG 1 +#undef _WRS_MMU_CLASS_SR_REGS +#undef _WRS_MMU_CLASS_NONE + +/* MMU ASID context register name for _WRS_MMU_CLASS_PID_REG */ +#define _PPC_PID_REG PID + +/* I-cache of 440 core is virtually tagged, requiring extra invalidation */ +#define _WRS_I_CACHE_TAG_VIRTUAL + +#define _CPU_CACHE_ALIGN_SHIFT 5 /* all 440 have 32-byte cache lines */ +#undef _CPU_CACHE_ALIGN_SIZE +#define _CPU_CACHE_ALIGN_SIZE 32 /* cannot use (1<<5) because compiler + * directive __attribute__ cant hdl */ + +#define _CACHE_LINE_MASK 0x0000001F + +#define _PPC_CACHE_UNIFIED FALSE + +/* + * PPC4xx processors encode the L1 cache dimensions in PVR[16-21]. + * See cacheArchLib.c for the encoding. + */ +#define _PPC_PVR_CACHE_SIZE_FIELD ((vxPvrGet() >> 10) & 0x03f) + +#define PPC_NO_REAL_MODE + +/* PPC440 SPR numbers */ +#define CCR0 0x3B3 /* Core Configuration Register 0 */ +#ifdef PPC_440x5 +#define CCR1 0x378 /* Core Configuration Register 1 */ +#endif /* PPC_440x5 */ +#define CSRR0 0x03A /* Critical Save/Restore Register 0 */ +#define CSRR1 0x03B /* Critical Save/Restore Register 1 */ +#define DAC1 0x13C /* Data Address Compare 1 */ +#define DAC2 0x13D /* Data Address Compare 2 */ +#define DBCR0 0x134 /* Debug Control Register 0 */ +#define DBCR1 0x135 /* Debug Control Register 1 */ +#define DBCR2 0x136 /* Debug Control Register 2 */ +#define DBDR 0x3F3 /* Debug Data Register */ +#define DBSR 0x130 /* Debug Status Register */ +#define DCDBTRH 0x39D /* Data Cache Debug Tag Register High */ +#define DCDBTRL 0x39C /* Data Cache Debug Tag Register Low */ +#define DEAR 0x03D /* Data Exception Address Register */ +/* + * Don't define DEC -- asmPpc.h has the correct value, and defining it + * here breaks C and C++ code (in target/src/zinc/common/z_int.cpp and + * target/src/os/fioLib.c) that uses DEC with OCT and HEX as members of + * an enum. + * #define DEC 0x016 /@ Decrementer @/ + * + * The following are also defined correctly in asmPpc.h. They are + * omitted here to prevent compiler warnings about redefinition. + * #define CTR 0x009 /@ Count Register @/ + * #define LR 0x008 /@ Link Register @/ + * #define PVR 0x11F /@ Processor Version Register @/ + * #define SPRG0 0x110 /@ Special Purpose Register General 0 @/ + * #define SPRG1 0x111 /@ Special Purpose Register General 1 @/ + * #define SPRG2 0x112 /@ Special Purpose Register General 2 @/ + * #define SPRG3 0x113 /@ Special Purpose Register General 3 @/ + * #define SRR0 0x01A /@ Save/Restore Register 0 @/ + * #define SRR1 0x01B /@ Save/Restore Register 1 @/ + * #define XER 0x001 /@ Integer Exception Register @/ + */ +#define DECAR 0x036 /* Decrementer Auto-Reload */ +#define DNV0 0x390 /* Data Cache Normal Victim 0 */ +#define DNV1 0x391 /* Data Cache Normal Victim 1 */ +#define DNV2 0x392 /* Data Cache Normal Victim 2 */ +#define DNV3 0x393 /* Data Cache Normal Victim 3 */ +#define DTV0 0x394 /* Data Cache Transient Victim 0 */ +#define DTV1 0x395 /* Data Cache Transient Victim 1 */ +#define DTV2 0x396 /* Data Cache Transient Victim 2 */ +#define DTV3 0x397 /* Data Cache Transient Victim 3 */ +#define DVC1 0x13E /* Data Value Compare 1 */ +#define DVC2 0x13F /* Data Value Compare 2 */ +#define DVLIM 0x398 /* Data Cache Victim Limit */ +#define ESR 0x03E /* Exception Syndrome Register */ +#define IAC1 0x138 /* Instruction Address Compare 1 */ +#define IAC2 0x139 /* Instruction Address Compare 2 */ +#define IAC3 0x13A /* Instruction Address Compare 3 */ +#define IAC4 0x13B /* Instruction Address Compare 4 */ +#define ICDBDR 0x3D3 /* Instruction Cache Debug Data Register */ +#define ICDBTRH 0x39F /* Instruction Cache Debug Tag Register High */ +#define ICDBTRL 0x39E /* Instruction Cache Debug Tag Register Low */ +#define INV0 0x370 /* Instruction Cache Normal Victim 0 */ +#define INV1 0x371 /* Instruction Cache Normal Victim 1 */ +#define INV2 0x372 /* Instruction Cache Normal Victim 2 */ +#define INV3 0x373 /* Instruction Cache Normal Victim 3 */ +#define ITV0 0x374 /* Instruction Cache Transient Victim 0 */ +#define ITV1 0x375 /* Instruction Cache Transient Victim 1 */ +#define ITV2 0x376 /* Instruction Cache Transient Victim 2 */ +#define ITV3 0x377 /* Instruction Cache Transient Victim 3 */ +#define IVLIM 0x399 /* Instruction Cache Victim Limit */ + /* Interrupt Vector Offset Registers */ +#define IVOR0 0x190 /* Critical Input */ +#define IVOR1 0x191 /* Machine Check */ +#define IVOR2 0x192 /* Data Storage */ +#define IVOR3 0x193 /* Instruction Storage */ +#define IVOR4 0x194 /* External Input */ +#define IVOR5 0x195 /* Alignment */ +#define IVOR6 0x196 /* Program */ +#define IVOR7 0x197 /* Floating Point Unavailable */ +#define IVOR8 0x198 /* System Call */ +#define IVOR9 0x199 /* Auxiliary Processor Unavailable */ +#define IVOR10 0x19A /* Decrementer */ +#define IVOR11 0x19B /* Fixed Interval Timer */ +#define IVOR12 0x19C /* Watchdog Timer */ +#define IVOR13 0x19D /* Data TLB Error */ +#define IVOR14 0x19E /* Instruction TLB Error */ +#define IVOR15 0x19F /* Debug */ +#define IVPR 0x03F /* Interrupt Vector Prefix Register */ +#ifdef PPC_440x5 +#define MCSR 0x23C /* Machine Check Status Register */ +#define MCSRR0 0x23A /* Machine Check Save/Restore Register 0 */ +#define MCSRR1 0x23B /* Machine Check Save/Restore Register 1 */ +#endif /* PPC_440x5 */ +#define MMUCR 0x3B2 /* Memory Management Unit Control Register */ +#define PID 0x030 /* Process ID */ +#define PIR 0x11E /* Processor ID Register */ +#define RSTCFG 0x39B /* Reset Configuration */ +#define SPRG4_R 0x104 /* Special Purpose Register General 4, read */ +#define SPRG4_W 0x114 /* Special Purpose Register General 4, write */ +#define SPRG5_R 0x105 /* Special Purpose Register General 5, read */ +#define SPRG5_W 0x115 /* Special Purpose Register General 5, write */ +#define SPRG6_R 0x106 /* Special Purpose Register General 6, read */ +#define SPRG6_W 0x116 /* Special Purpose Register General 6, write */ +#define SPRG7_R 0x107 /* Special Purpose Register General 7, read */ +#define SPRG7_W 0x117 /* Special Purpose Register General 7, write */ +#define TBL_R 0x10C /* Time Base Lower, read */ +#define TBL_W 0x11C /* Time Base Lower, write */ +#define TBU_R 0x10D /* Time Base Upper, read */ +#define TBU_W 0x11D /* Time Base Upper, write */ +#define TCR 0x154 /* Timer Control Register */ +#define TSR 0x150 /* Timer Status Register */ +#define USPRG0 0x100 /* User Special Purpose Register General 0 */ + +/* INT_MASK definition (mask EE & CE bits) : overwrite the one in asmPpc.h */ + +#undef INT_MASK +#define INT_MASK(src, des) rlwinm des, src, 0, 17, 15; \ + rlwinm des, des, 0, 15, 13 + +/* MSR (upper half) definitions */ +/* ppcArch.h defines a generic MSR. Here we define changes from that base */ + +#undef _PPC_MSR_SF_U /* 64 bit mode not implemented */ +#undef _PPC_MSR_POW_U /* power management not supported */ +#undef _PPC_MSR_ILE_U /* little endian mode not supported */ + +#define _PPC_MSR_WE_U 0x0004 /* wait state enable */ +#define _PPC_MSR_CE_U 0x0002 /* critical interrupt enable */ +#define _PPC_MSR_WE 0x00040000 /* wait state enable */ +#define _PPC_MSR_CE 0x00020000 /* critical interrupt enable */ + +/* MSR (lower half) definitions */ + +#undef _PPC_MSR_IR /* insn address translation (always on) */ +#undef _PPC_MSR_DR /* data address translation (always on) */ +#undef _PPC_MSR_SE /* single step unsupported */ +#undef _PPC_MSR_BE /* branch trace not supported */ +#undef _PPC_MSR_IP /* exception prefix bit not supported */ +#undef _PPC_MSR_RI /* recoverable interrupt unsupported */ +#undef _PPC_MSR_LE /* little endian mode unsupported */ +#undef _PPC_MSR_BIT_LE /* little endian mode unsupported */ + +#define _PPC_MSR_DWE 0x0400 /* debug wait enable */ +#define _PPC_MSR_DE 0x0200 /* debug exception enable */ +#define _PPC_MSR_IS 0x0020 /* insn address space selector */ +#define _PPC_MSR_DS 0x0010 /* data address space selector */ + +/* MSR bit fields */ + +#define _PPC_MSR_BIT_IS 26 /* MSR Inst Translation bit - IS */ +#define _PPC_MSR_BIT_DS 27 /* MSR Data Translation bit - DS */ + +/* MSR MMU Bit offset and extraction macros */ + +#define _PPC_MSR_MMU_EXTRACT(src, dst) \ + rlwinm dst, src, 0, _PPC_MSR_BIT_IS, _PPC_MSR_BIT_DS + +/* + * PPC440GP has no FPU, but some implementations of the PPC440 core might. + * This is ultimately controlled by the TOOL setting used to compile the + * architecture code: TOOL=gnu or TOOL=diab with CPU=PPC440 will set + * _WRS_HARDWARE_FP; TOOL=sfdiab or TOOL=sfgnu will not. + */ +#ifndef _WRS_HARDWARE_FP +#undef _PPC_MSR_FP /* floating point unsupported */ +#undef _PPC_MSR_FE1 /* floating point not supported */ +#undef _PPC_MSR_FE0 /* floating point not supported */ +#endif /* _WRS_HARDWARE_FP */ + +/* The setting in archPpc.h is wrong for the PPC440 */ +#undef _PPC_MSR_POWERUP +#define _PPC_MSR_POWERUP 0x0000 /* state of MSR at powerup */ + +/* Bits in the upper half of CCR0 */ +#ifdef PPC_440x5 +#define _PPC_CCR0_PRE_U 0x4000 /* dcache Parity Recoverability Enab */ +#define _PPC_CCR0_CRPE_U 0x0800 /* Cache Read Parity Enable */ +#endif /* PPC_440x5 */ +#define _PPC_CCR0_DSTG_U 0x0020 /* Disable Store Gathering */ +#define _PPC_CCR0_DAPUIB_U 0x0010 /* Disable APU Instruction Broadcast */ +#define _PPC_CCR0_BIT_DAPUIB_U 11 /* Disable APU Instruction Broadcast */ + +/* Bits in the lower half of CCR0 */ +#define _PPC_CCR0_DTB 0x8000 /* Disable Trace Broadcast */ +#define _PPC_CCR0_GICBT 0x4000 /* Guaranteed Insn Cache Block Touch */ +#define _PPC_CCR0_GDCBT 0x2000 /* Guaranteed Data Cache Block Touch */ +#define _PPC_CCR0_FLSTA 0x0100 /* Force Load/Store Alignment Excptn */ +#define _PPC_CCR0_ICSLC 0x000c /* Insn Cache Speculative Line Count */ +#define _PPC_CCR0_ICSLT 0x0003 /* Insn Cache Specul Line Thrshld */ + +#ifdef PPC_440x5 +/* Bits in the upper half of CCR1 */ +#define _PPC_CCR1_ICDPEI_U 0xff00 /* I-cache Data Parity Error Insert */ +#define _PPC_CCR1_ICDPEI0_U 0x8000 /* I-cache Data Parity Error Ins wd 0 */ +#define _PPC_CCR1_ICDPEI1_U 0x4000 /* I-cache Data Parity Error Ins wd 1 */ +#define _PPC_CCR1_ICDPEI2_U 0x2000 /* I-cache Data Parity Error Ins wd 2 */ +#define _PPC_CCR1_ICDPEI3_U 0x1000 /* I-cache Data Parity Error Ins wd 3 */ +#define _PPC_CCR1_ICDPEI4_U 0x0800 /* I-cache Data Parity Error Ins wd 4 */ +#define _PPC_CCR1_ICDPEI5_U 0x0400 /* I-cache Data Parity Error Ins wd 5 */ +#define _PPC_CCR1_ICDPEI6_U 0x0200 /* I-cache Data Parity Error Ins wd 6 */ +#define _PPC_CCR1_ICDPEI7_U 0x0100 /* I-cache Data Parity Error Ins wd 7 */ +#define _PPC_CCR1_ICTPEI_U 0x00c0 /* I-cache Tag Parity Error Insert */ +#define _PPC_CCR1_DCTPEI_U 0x0030 /* D-cache Tag Parity Error Insert */ +#define _PPC_CCR1_DCDPEI_U 0x0008 /* D-cache Data Parity Error Insert */ +#define _PPC_CCR1_DCUPEI_U 0x0004 /* D-cache U-bit Parity Error Insert */ +#define _PPC_CCR1_DCMPEI_U 0x0002 /* D-cache M-bit Parity Error Insert */ +#define _PPC_CCR1_FCOM_U 0x0001 /* Force Cache Operation Miss */ + +/* Bits in the lower half of CCR1 */ +#define _PPC_CCR1_MMUPEI 0xF000 /* MMU Parity Error Insert */ +#define _PPC_CCR1_FFF 0x0800 /* Force Full-line Flush */ +#define _PPC_CCR1_TCS 0x0080 /* Timer Clock Select */ +#define _PPC_CCR1_TCS_EXT 0x0080 /* set bit for external */ + +/* Bits in the upper half of MCSR */ +#define _PPC_MCSR_MCS_U 0x8000 /* Machine Check Summary */ +#define _PPC_MCSR_IPLBE_U 0x4000 /* Instruction PLB Error */ +#define _PPC_MCSR_DRPLBE_U 0x2000 /* Data Read PLB Error */ +#define _PPC_MCSR_DWPLBE_U 0x1000 /* Data Write PLB Error */ +#define _PPC_MCSR_TLBE_U 0x0800 /* TLB Error */ +#define _PPC_MCSR_ICPE_U 0x0400 /* Instruction Cache Parity Error */ +#define _PPC_MCSR_DCSPE_U 0x0200 /* Data Cache Search Parity Error */ +#define _PPC_MCSR_DCFPE_U 0x0100 /* Data Cache Flush Parity Error */ +#define _PPC_MCSR_IMCE_U 0x0080 /* Imprecise Machine Check Error */ +#define _PPC_MCSR_BIT_MCS 0 /* Machine Check Summary */ +#define _PPC_MCSR_BIT_IPLBE 1 /* Instruction PLB Error */ +#define _PPC_MCSR_BIT_DRPLBE 2 /* Data Read PLB Error */ +#define _PPC_MCSR_BIT_DWPLBE 3 /* Data Write PLB Error */ +#define _PPC_MCSR_BIT_TLBE 4 /* TLB Error */ +#define _PPC_MCSR_BIT_ICPE 5 /* Instruction Cache Parity Error */ +#define _PPC_MCSR_BIT_DCSPE 6 /* Data Cache Search Parity Error */ +#define _PPC_MCSR_BIT_DCFPE 7 /* Data Cache Flush Parity Error */ +#define _PPC_MCSR_BIT_IMCE 8 /* Imprecise Machine Check Error */ +#endif /* PPC_440x5 */ + +/* Bits in the upper half of TCR */ +#define _PPC_TCR_WP_U 0xc000 /* Watchdog Timer Period */ +#define _PPC_TCR_WRC_U 0x3000 /* Watchdog Timer Reset Control */ +#define _PPC_TCR_WIE_U 0x0800 /* Watchdog Timer Interrupt Enable */ +#define _PPC_TCR_DIE_U 0x0400 /* Decrementer Interrupt Enable */ +#define _PPC_TCR_FP_U 0x0300 /* Fixed Interval Timer Period */ +#define _PPC_TCR_FIE_U 0x0080 /* Fixed Interval Timer Interrupt Enable */ +#define _PPC_TCR_ARE_U 0x0040 /* Decrementer Auto-Reload Enable */ + +/* Bits in the upper half of TSR */ +#define _PPC_TSR_ENW_U 0x8000 /* Enable Next Watchdog Timer Exception */ +#define _PPC_TSR_WIS_U 0x4000 /* Watchdog Timer Interrupt Status */ +#define _PPC_TSR_WRS_U 0x3000 /* Watchdog Timer Reset Status */ +#define _PPC_TSR_DIS_U 0x0800 /* Decrementer Interrupt Status */ +#define _PPC_TSR_FIS_U 0x0400 /* Fixed Interval Timer Interrupt Status */ + +/* versions of the aligned for 32-bit TCR/TSR register access */ +#define _PPC440_TCR_DIE (_PPC_TCR_DIE_U << 16) +#define _PPC440_TSR_DIS (_PPC_TSR_DIS_U << 16) + +/* debug control register 0 */ +#define _DBCR0_EDM_U 0x8000 /* external debug mode */ +#define _DBCR0_IDM_U 0x4000 /* internal debug mode */ +#define _DBCR0_RST_U 0x3000 /* reset */ +#define _DBCR0_ICMP_U 0x0800 /* instruction completion debug event */ +#define _DBCR0_BRT_U 0x0400 /* branch taken debug event */ +#define _DBCR0_IRPT_U 0x0200 /* interrupt debug event */ +#define _DBCR0_TRAP_U 0x0100 /* trap debug event */ +#define _DBCR0_IAC1_U 0x0080 /* instruction address compare 1 */ +#define _DBCR0_IAC2_U 0x0040 /* instruction address compare 2 */ +#define _DBCR0_IAC3_U 0x0020 /* instruction address compare 3 */ +#define _DBCR0_IAC4_U 0x0010 /* instruction address compare 4 */ +#define _DBCR0_DAC1R_U 0x0008 /* data address compare 1 Read */ +#define _DBCR0_DAC1W_U 0x0004 /* data address compare 1 Write */ +#define _DBCR0_DAC2R_U 0x0002 /* data address compare 2 Read */ +#define _DBCR0_DAC2W_U 0x0001 /* data address compare 2 Write */ +#define _DBCR0_EDM 0x80000000 /* external debug mode */ +#define _DBCR0_IDM 0x40000000 /* internal debug mode */ +#define _DBCR0_RST 0x30000000 /* reset */ +#define _DBCR0_ICMP 0x08000000 /* instruction completion debug event */ +#define _DBCR0_BRT 0x04000000 /* branch taken */ +#define _DBCR0_IRPT 0x02000000 /* exception debug event */ +#define _DBCR0_TRAP 0x01000000 /* trap debug event */ +#define _DBCR0_IAC1 0x00800000 /* instruction address compare 1 */ +#define _DBCR0_IAC2 0x00400000 /* instruction address compare 2 */ +#define _DBCR0_IAC3 0x00200000 /* instruction address compare 3 */ +#define _DBCR0_IAC4 0x00100000 /* instruction address compare 4 */ +#define _DBCR0_DAC1R 0x00080000 /* data address compare 1 Read */ +#define _DBCR0_DAC1W 0x00040000 /* data address compare 1 Write */ +#define _DBCR0_DAC2R 0x00020000 /* data address compare 2 Read */ +#define _DBCR0_DAC2W 0x00010000 /* data address compare 2 Write */ +#define _DBCR0_RET 0x00008000 /* return debug event */ +#define _DBCR0_FT 0x00000001 /* freeze timers on debug */ + +/* debug control register 1 */ +#define _DBCR1_IAC1US_U 0xc000 /* IAC 1 User/Supervisor */ +#define _DBCR1_IAC1ER_U 0x3000 /* IAC 1 Effective/Real */ +#define _DBCR1_IAC2US_U 0x0c00 /* IAC 2 User/Supervisor */ +#define _DBCR1_IAC2ER_U 0x0300 /* IAC 2 Effective/Real */ +#define _DBCR1_IAC12M_U 0x00c0 /* IAC 1/2 Mode */ +#define _DBCR1_IAC12AT_U 0x0001 /* IAC 1/2 Auto-Toggle Enable */ +#define _DBCR1_IAC1US 0xc0000000 /* IAC 1 User/Supervisor */ +#define _DBCR1_IAC1ER 0x30000000 /* IAC 1 Effective/Real */ +#define _DBCR1_IAC2US 0x0c000000 /* IAC 2 User/Supervisor */ +#define _DBCR1_IAC2ER 0x03000000 /* IAC 2 Effective/Real */ +#define _DBCR1_IAC12M 0x00c00000 /* IAC 1/2 Mode */ +#define _DBCR1_IAC12AT 0x00010000 /* IAC 1/2 Auto-Toggle Enable */ +#define _DBCR1_IAC3US 0x0000c000 /* IAC 3 User/Supervisor */ +#define _DBCR1_IAC3ER 0x00003000 /* IAC 3 Effective/Real */ +#define _DBCR1_IAC4US 0x00000c00 /* IAC 4 User/Supervisor */ +#define _DBCR1_IAC4ER 0x00000300 /* IAC 4 Effective/Real */ +#define _DBCR1_IAC34M 0x000000c0 /* IAC 3/4 Mode */ +#define _DBCR1_IAC34AT 0x00000001 /* IAC 3/4 Auto-Toggle Enable */ + +/* debug control register 2 */ +#define _DBCR2_DAC1US_U 0xc000 /* DAC 1 User/Supervisor */ +#define _DBCR2_DAC1ER_U 0x3000 /* DAC 1 Effective/Real */ +#define _DBCR2_DAC2US_U 0x0c00 /* DAC 2 User/Supervisor */ +#define _DBCR2_DAC2ER_U 0x0300 /* DAC 2 Effective/Real */ +#define _DBCR2_DAC12M_U 0x00c0 /* DAC 1/2 Mode */ +#define _DBCR2_DAC12A_U 0x0020 /* DAC 1/2 Asynchronous */ +#define _DBCR2_DVC1M_U 0x000c /* DVC 1 Mode */ +#define _DBCR2_DVC2M_U 0x0003 /* DVC 2 Mode */ +#define _DBCR2_DAC1US 0xc0000000 /* DAC 1 User/Supervisor */ +#define _DBCR2_DAC1ER 0x30000000 /* DAC 1 Effective/Real */ +#define _DBCR2_DAC2US 0x0c000000 /* DAC 2 User/Supervisor */ +#define _DBCR2_DAC2ER 0x03000000 /* DAC 2 Effective/Real */ +#define _DBCR2_DAC12M 0x00c00000 /* DAC 1/2 Mode */ +#define _DBCR2_DAC12A 0x00200000 /* DAC 1/2 Asynchronous */ +#define _DBCR2_DVC1M 0x000c0000 /* DVC 1 Mode */ +#define _DBCR2_DVC2M 0x00030000 /* DVC 2 Mode */ +#define _DBCR2_DVC1BE 0x0000000c /* DVC 1 Byte Enables 0:3 */ +#define _DBCR2_DVC2BE 0x00000003 /* DVC 2 Byte Enables 0:3 */ + +/* debug status register */ +#define _DBSR_IDE_U 0x8000 /* Imprecise Debug Event */ +#define _DBSR_UDE_U 0x4000 /* Unconditional Debug Event */ +#define _DBSR_MRR_U 0x3000 /* Most Recent Reset */ +#define _DBSR_ICMP_U 0x0800 /* Instruction Completion Debug Event */ +#define _DBSR_BRT_U 0x0400 /* Branch Taken Debug Event */ +#define _DBSR_IRPT_U 0x0200 /* Interrupt Debug Event */ +#define _DBSR_TRAP_U 0x0100 /* Trap Debug Event */ +#define _DBSR_IAC1_U 0x0080 /* IAC 1 Debug Event */ +#define _DBSR_IAC2_U 0x0040 /* IAC 2 Debug Event */ +#define _DBSR_IAC3_U 0x0020 /* IAC 3 Debug Event */ +#define _DBSR_IAC4_U 0x0010 /* IAC 4 Debug Event */ +#define _DBSR_DAC1R_U 0x0008 /* DAC/DVC 1 Read Debug Event */ +#define _DBSR_DAC1W_U 0x0004 /* DAC/DVC 1 Write Debug Event */ +#define _DBSR_DAC2R_U 0x0002 /* DAC/DVC 2 Read Debug Event */ +#define _DBSR_DAC2W_U 0x0001 /* DAC/DVC 2 Write Debug Event */ +#define _DBSR_IDE 0x80000000 /* Imprecise Debug Event */ +#define _DBSR_UDE 0x40000000 /* Unconditional Debug Event */ +#define _DBSR_MRR 0x30000000 /* Most Recent Reset */ +#define _DBSR_ICMP 0x08000000 /* Instruction Completion Debug Event */ +#define _DBSR_BRT 0x04000000 /* Branch Taken Debug Event */ +#define _DBSR_IRPT 0x02000000 /* Interrupt Debug Event */ +#define _DBSR_TRAP 0x01000000 /* Trap Debug Event */ +#define _DBSR_IAC1 0x00800000 /* IAC 1 Debug Event */ +#define _DBSR_IAC2 0x00400000 /* IAC 2 Debug Event */ +#define _DBSR_IAC3 0x00200000 /* IAC 3 Debug Event */ +#define _DBSR_IAC4 0x00100000 /* IAC 4 Debug Event */ +#define _DBSR_DAC1R 0x00080000 /* DAC/DVC 1 Read Debug Event */ +#define _DBSR_DAC1W 0x00040000 /* DAC/DVC 1 Write Debug Event */ +#define _DBSR_DAC2R 0x00020000 /* DAC/DVC 2 Read Debug Event */ +#define _DBSR_DAC2W 0x00010000 /* DAC/DVC 2 Write Debug Event */ +#define _DBSR_RET 0x00008000 /* Return Debug Event */ +#define _DBSR_IAC12ATS 0x00000002 /* IAC 1/2 Auto-Toggle Status */ +#define _DBSR_IAC34ATS 0x00000001 /* IAC 3/4 Auto-Toggle Status */ + +/* mask for hardware breakpoints */ +#define _DBSR_HWBP_MSK ( _DBSR_IAC1 | _DBSR_IAC2 | \ + _DBSR_IAC3 | _DBSR_IAC4 | \ + _DBSR_DAC1R | _DBSR_DAC1W | \ + _DBSR_DAC2R | _DBSR_DAC2W ) + + +/* Data Cache Debug Tag Register High */ +/* + * _DCDBTRH_TRA (Tag Real Address) is bits 0:23. Due to the limitations + * of PPC immediate operands, a corresponding mask is not all that useful. + * Use rlwinm instead. + */ +#define _DCDBTRH_V 0x00000080 /* Cache Line Valid */ +#define _DCDBTRH_TERA 0x0000000f /* Tag Extended Real Address */ + +/* Data Cache Debug Tag Register Low */ +#ifdef PPC_440x5 +#define _DCDBTRL_UPAR_U 0x0004 /* U-field Parity */ +#define _DCDBTRL_TPAR_U 0x0003 /* Tag Parity */ +#define _DCDBTRL_DPAR 0x0000f000 /* Data Parity */ +#define _DCDBTRL_MPAR 0x00000f00 /* Modified (dirty) Parity */ +#endif /* PPC_440x5 */ +#define _DCDBTRL_D 0x000000f0 /* Dirty Indicators */ +#define _DCDBTRL_U0 0x00000008 /* U0 Storage Attribute */ +#define _DCDBTRL_U1 0x00000004 /* U1 Storage Attribute */ +#define _DCDBTRL_U2 0x00000002 /* U2 Storage Attribute */ +#define _DCDBTRL_U3 0x00000001 /* U3 Storage Attribute */ + +/* Data Cache Normal Victim Registers */ +#define _DNVx_VNDXA_U 0xff00 /* Victim Index A (EA[25:26] = 0b00) */ +#define _DNVx_VNDXB_U 0x00ff /* Victim Index B (EA[25:26] = 0b01) */ +#define _DNVx_VNDXA 0xff000000 /* Victim Index A (EA[25:26] = 0b00) */ +#define _DNVx_VNDXB 0x00ff0000 /* Victim Index B (EA[25:26] = 0b01) */ +#define _DNVx_VNDXC 0x0000ff00 /* Victim Index C (EA[25:26] = 0b10) */ +#define _DNVx_VNDXD 0x000000ff /* Victim Index D (EA[25:26] = 0b11) */ + +/* Data Cache Transient Victim Registers */ +#define _DTVx_VNDXA_U 0xff00 /* Victim Index A (EA[25:26] = 0b00) */ +#define _DTVx_VNDXB_U 0x00ff /* Victim Index B (EA[25:26] = 0b01) */ +#define _DTVx_VNDXA 0xff000000 /* Victim Index A (EA[25:26] = 0b00) */ +#define _DTVx_VNDXB 0x00ff0000 /* Victim Index B (EA[25:26] = 0b01) */ +#define _DTVx_VNDXC 0x0000ff00 /* Victim Index C (EA[25:26] = 0b10) */ +#define _DTVx_VNDXD 0x000000ff /* Victim Index D (EA[25:26] = 0b11) */ + +/* Data Cache Victim Limit Register */ +#define _DVLIM_TFLOOR_U 0x3fc0 /* Transient Floor */ +#define _DVLIM_TFLOOR 0x3fc00000 /* Transient Floor */ +#define _DVLIM_TCEILING 0x0007f800 /* Transient Ceiling */ +#define _DVLIM_NFLOOR 0x000000ff /* Normal Floor */ + +/* Instruction Cache Debug Tag Register High */ +/* + * _ICDBTRH_TRA (Tag Real Address) is bits 0:23. Due to the limitations + * of PPC immediate operands, a corresponding mask is not all that useful. + * Use rlwinm instead. + */ +#define _ICDBTRH_V 0x00000080 /* Cache Line Valid */ +#ifdef PPC_440x5 +#define _ICDBTRH_TPAR 0x00000060 /* Tag Parity */ +#define _ICDBTRH_DAPAR 0x00000010 /* Instruction Data Parity */ +#endif /* PPC_440x5 */ + +/* Instruction Cache Debug Tag Register Low */ +#define _ICDBTRL_TS 0x00000200 /* Translation Space */ +#define _ICDBTRL_TD 0x00000100 /* TID Disable */ +#define _ICDBTRL_TID 0x000000ff /* Translation ID */ + +/* Instruction Cache Normal Victim Registers */ +#define _INVx_VNDXA_U 0xff00 /* Victim Index A (EA[25:26] = 0b00) */ +#define _INVx_VNDXB_U 0x00ff /* Victim Index B (EA[25:26] = 0b01) */ +#define _INVx_VNDXA 0xff000000 /* Victim Index A (EA[25:26] = 0b00) */ +#define _INVx_VNDXB 0x00ff0000 /* Victim Index B (EA[25:26] = 0b01) */ +#define _INVx_VNDXC 0x0000ff00 /* Victim Index C (EA[25:26] = 0b10) */ +#define _INVx_VNDXD 0x000000ff /* Victim Index D (EA[25:26] = 0b11) */ + +/* Instruction Cache Transient Victim Registers */ +#define _ITVx_VNDXA_U 0xff00 /* Victim Index A (EA[25:26] = 0b00) */ +#define _ITVx_VNDXB_U 0x00ff /* Victim Index B (EA[25:26] = 0b01) */ +#define _ITVx_VNDXA 0xff000000 /* Victim Index A (EA[25:26] = 0b00) */ +#define _ITVx_VNDXB 0x00ff0000 /* Victim Index B (EA[25:26] = 0b01) */ +#define _ITVx_VNDXC 0x0000ff00 /* Victim Index C (EA[25:26] = 0b10) */ +#define _ITVx_VNDXD 0x000000ff /* Victim Index D (EA[25:26] = 0b11) */ + +/* Instruction Cache Victim Limit Register */ +#define _IVLIM_TFLOOR_U 0x3fc0 /* Transient Floor */ +#define _IVLIM_TFLOOR 0x3fc00000 /* Transient Floor */ +#define _IVLIM_TCEILING 0x0007f800 /* Transient Ceiling */ +#define _IVLIM_NFLOOR 0x000000ff /* Normal Floor */ + +/* Memory Management Control Register */ +#define _MMUCR_SWOA_U 0x0100 /* Store Without Allocate */ +#define _MMUCR_U1TE_U 0x0040 /* U1 Transient Enable */ +#define _MMUCR_U2SWOAE_U 0x0020 /* U2 Store without Allocate Enable */ +#define _MMUCR_DULXE_U 0x0008 /* Data Cache Unlock Exception Enable */ +#define _MMUCR_IULXE_U 0x0004 /* Insn Cache Unlock Exception Enable */ +#define _MMUCR_STS_U 0x0001 /* Search Translation Space */ +#define _MMUCR_SWOA 0x01000000 /* Store Without Allocate */ +#define _MMUCR_U1TE 0x00400000 /* U1 Transient Enable */ +#define _MMUCR_U2SWOAE 0x00200000 /* U2 Store without Allocate Enable */ +#define _MMUCR_DULXE 0x00080000 /* Data Cache Unlock Exception Enable */ +#define _MMUCR_IULXE 0x00040000 /* Insn Cache Unlock Exception Enable */ +#define _MMUCR_STS 0x00010000 /* Search Translation Space */ +#define _MMUCR_STID 0x000000ff /* Search Translation ID */ + +/* Process ID Register */ +#define _PID_PID 0x000000ff /* Process ID */ + +/* Processor Identification Register */ +#define _PIR_PIN 0x000000ff /* Processor Identification Number */ + +/* Reset Configuration Register */ +#define _RSTCFG_U0 0x00008000 /* U0 Storage Attribute */ +#define _RSTCFG_U1 0x00004000 /* U1 Storage Attribute */ +#define _RSTCFG_U2 0x00002000 /* U2 Storage Attribute */ +#define _RSTCFG_U3 0x00001000 /* U3 Storage Attribute */ +#define _RSTCFG_E 0x00000080 /* E Storage Attribute */ +#define _RSTCFG_ERPN 0x0000000f /* Extended Real Page Number */ + +/* Integer Exception Register */ +#define _XER_SO_U 0x8000 /* Summary Overflow */ +#define _XER_OV_U 0x4000 /* Overflow */ +#define _XER_CA_U 0x2000 /* Carry */ +#define _XER_SO 0x80000000 /* Summary Overflow */ +#define _XER_OV 0x40000000 /* Overflow */ +#define _XER_CA 0x20000000 /* Carry */ +#define _XER_TBC 0x0000007f /* Transfer Byte Count */ +/* + * exception syndrome register mask bits: + * 0 - error not occured 1 - error occured + */ +#define _PPC440_ESR_MCI_U 0x8000 /* Machine Check -- Insn Fetch */ +#define _PPC440_ESR_PIL_U 0x0800 /* Pgm Interrupt -- Illegal Insn */ +#define _PPC440_ESR_PPR_U 0x0400 /* Pgm Interrupt -- Previleged Insn */ +#define _PPC440_ESR_PTR_U 0x0200 /* Pgm Interrupt -- Trap */ +#define _PPC440_ESR_FP_U 0x0100 /* Floating Point Operation */ +#define _PPC440_ESR_ST_U 0x0080 /* Store Operation */ +#define _PPC440_ESR_DLK_U 0x0030 /* Data Storage Interrupt -- Locking */ +#define _PPC440_ESR_AP_U 0x0008 /* AP Operation */ +#define _PPC440_ESR_PUO_U 0x0004 /* Pgm Interrupt -- Unimplemented */ +#define _PPC440_ESR_BO_U 0x0002 /* Byte Ordering Exception */ +#define _PPC440_ESR_PIE_U 0x0001 /* Pgm Interrupt -- Imprecise */ +#define _PPC440_ESR_MCI 0x80000000 /* Machine Check -- Insn Fetch */ +#define _PPC440_ESR_PIL 0x08000000 /* Pgm Interrupt -- Illegal Insn */ +#define _PPC440_ESR_PPR 0x04000000 /* Pgm Interrupt -- Previleged Insn */ +#define _PPC440_ESR_PTR 0x02000000 /* Pgm Interrupt -- Trap */ +#define _PPC440_ESR_FP 0x01000000 /* Floating Point Operation */ +#define _PPC440_ESR_ST 0x00800000 /* Store Operation */ +#define _PPC440_ESR_DLK 0x00300000 /* Data Storage Interrupt -- Locking */ +#define _PPC440_ESR_AP 0x00080000 /* AP Operation */ +#define _PPC440_ESR_PUO 0x00040000 /* Pgm Interrupt -- Unimplemented Opn */ +#define _PPC440_ESR_BO 0x00020000 /* Byte Ordering Exception */ +#define _PPC440_ESR_PIE 0x00010000 /* Pgm Interrupt -- Imprecise */ +#define _PPC440_ESR_PCRE 0x00000010 /* Pgm Interrupt -- Condition Reg Enab */ +#define _PPC440_ESR_PCMP 0x00000008 /* Pgm Interrupt -- Compare */ +#define _PPC440_ESR_PCRF 0x00000007 /* Pgm Interrupt -- Condition Reg Field */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCppc440h */ diff --git a/h/arch/ppc/ppc5200.h b/h/arch/ppc/ppc5200.h new file mode 100644 index 0000000..654c47d --- /dev/null +++ b/h/arch/ppc/ppc5200.h @@ -0,0 +1,966 @@ +/* m5200.h - Motorola MPC5200 CPU control registers */ + +/* +modification history +--------------------, +01f,11aug05,j_b added PCI reg macros +01e,05dec03,hkh error correction: arithmetic expressions in macros has to be put between "(" and ")" + wrong shifts for EENA2, EENA3 +01d,01dec03,e_c add register definition for fast boot +01c,18nov03,pdr merge from IceCube. +01b,15sep03,pdr added register definition +01a,25Jun03,pkr written +*/ + +/* +This file contains I/O addresses and related constants for the MPC5200 +*/ + +#ifndef __INCm5200h +#define __INCm5200h + +#ifdef __cplusplus +extern "C" { +#endif + +/* additional special purpose register encoding */ + +#define SPRG4 276 /* software program register 4 */ +#define SPRG5 277 /* software program register 5 */ +#define SPRG6 278 /* software program register 6 */ +#define SPRG7 279 /* software program register 7 */ + +#define PVR 287 /* processor version register */ + +#define HID2 1011 /* Hardware Implmentation-Dependent Register 2 */ +#define MBAR 311 /* Memory Base Address Register */ + +#define MBAR_SIZE 0x40000 /* 256 KB */ + +#define MBAR_RESET_VALUE 0x80000000 + +#define MPC5200_PCI_DEVICE_ID 0x5803 +#define MPC5200_PCI_VENDOR_ID 0x1057 +#define MPC5200_PCI_ID ((MPC5200_PCI_DEVICE_ID << 16) | MPC5200_PCI_VENDOR_ID) + +/*-----------------------------------------------------------*/ +/* IPBI Peripheral registers 0x0000 */ +/*-----------------------------------------------------------*/ + +/* MBAR to IPBI */ +#define MBAR_IPBI 0x0000 + +#define IPBI_CS0_START_OFF 0x0004 +#define IPBI_CS0_STOP_OFF 0x0008 +#define IPBI_CTRL_OFF 0x0054 + +#define IPBI_SDRAM_CONF0_OFF 0x0034 +#define IPBI_SDRAM_CONF1_OFF 0x0038 + +#define IPBI_CTRL_CSBOOT 0x02000000 +#define IPBI_CTRL_CS0 0x00010000 +#define IPBI_CTRL_WSE 0x00000001 + +/*-----------------------------------------------------------*/ +/* SDRAM 0x0100 */ +/*-----------------------------------------------------------*/ + +/* MBAR to LPC */ +#define MBAR_SDRAM 0x0100 + +#define SDRAM_MODE_OFF 0x0000 +#define SDRAM_CTRL_OFF 0x0004 +#define SDRAM_CONF1_OFF 0x0008 +#define SDRAM_CONF2_OFF 0x000C + +/*-----------------------------------------------------------*/ +/* Clock Distribution Module (CDM) 0x0200 */ +/*-----------------------------------------------------------*/ + +/* MBAR to CDM */ +#define MBAR_CDM 0x0200 + +#define CDM_PORSTCFG_OFF 0x0004 /* CDM Power On Reset Configuration Register */ +#define CDM_BREAD_CRUM_OFF 0x0008 /* CDM Bread Crumb Register */ +#define CDM_CFG_OFF 0x000C /* CDM Configuration Register */ +#define CDM_DIVIDER_OFF 0x0010 /* CDM 48MHz Fractional Divider Configuration Register */ +#define CDM_CLK_ENABLE_OFF 0x0014 /* CDM Clock Enable Register */ +#define CDM_OSC_CONFIG_OFF 0x0018 /* CDM System Oscillator Configuration Register */ +#define CDM_PSC1_MCLOCK_OFF 0x0028 /* CDM PSC1 Mclock Config */ +#define CDM_PSC2_MCLOCK_OFF 0x002C /* CDM PSC2 Mclock Config */ +#define CDM_PSC3_MCLOCK_OFF 0x0030 /* CDM PSC3 Mclock Config */ +#define CDM_PSC6_MCLOCK_OFF 0x0034 /* CDM PSC6 Mclock Config */ + +#define CDM_BASE_ADRS (MBAR_VALUE + MBAR_CDM) + +#define CDM_PORSTCFG ((volatile UINT32 *)(CDM_BASE_ADRS + CDM_PORSTCFG_OFF )) +#define CDM_BREAD_CRUM ((volatile UINT32 *)(CDM_BASE_ADRS + CDM_BREAD_CRUM_OFF )) +#define CDM_CFG ((volatile UINT32 *)(CDM_BASE_ADRS + CDM_CFG_OFF )) +#define CDM_DIVIDER ((volatile UINT32 *)(CDM_BASE_ADRS + CDM_DIVIDER_OFF )) +#define CDM_CLK_ENABLE ((volatile UINT32 *)(CDM_BASE_ADRS + CDM_CLK_ENABLE_OFF )) +#define CDM_OSC_CONFIG ((volatile UINT32 *)(CDM_BASE_ADRS + CDM_OSC_CONFIG_OFF )) +#define CDM_PSC1_MCLOCK ((volatile UINT32 *)(CDM_BASE_ADRS + CDM_PSC1_MCLOCK_OFF)) +#define CDM_PSC2_MCLOCK ((volatile UINT32 *)(CDM_BASE_ADRS + CDM_PSC2_MCLOCK_OFF)) +#define CDM_PSC3_MCLOCK ((volatile UINT32 *)(CDM_BASE_ADRS + CDM_PSC3_MCLOCK_OFF)) +#define CDM_PSC6_MCLOCK ((volatile UINT32 *)(CDM_BASE_ADRS + CDM_PSC6_MCLOCK_OFF)) + +/*-----------------------------------------------------------*/ +/* LPC 0x0300 */ +/*-----------------------------------------------------------*/ + +/* MBAR to LPC */ +#define MBAR_LPC 0x0300 + +#define LPC_CS0_BOOT_CFG_OFF 0x0000 +#define LPC_CS_CTRL_OFF 0x0018 +#define LPC_CS_BURST_CTRL_OFF 0x0028 +#define LPC_CS_DEAD_CTRL_OFF 0x002C + +#define LPC_CS_CTRL_EBEE 0x8000 +#define LPC_CS_CTRL_ME 0x0100 + +/*----------------------------------------------------------- */ +/* Interrupt Controller (ICTL) 0x0500 */ +/*----------------------------------------------------------- */ + +#define MBAR_ICTL 0x0500 + + +#define ICTL_PIMR_OFF 0x0 /* ICTL Peripheral Interrupt Mask Register */ +#define ICTL_PPR_OFF 0x4 /* ICTL Peripheral Priority and HI/LO Select [3] Register */ +#define ICTL_EEETR_OFF 0x10 /* ICTL External Enable and Externals Types Register */ +#define ICTL_CPMIMR_OFF 0x14 /* ICTL Critical Priority and Main Interrupt Mask Register */ +#define ICTL_MIPR_OFF 0x18 /* ICTL Main Interrupt Priority and INT/SMI Select [2] Register */ +#define ICTL_ISR_OFF 0x24 /* ICTL PerStat, MainStat, CritStat Encoded Register */ +#define CTL_CISAR_OFF 0x28 /* ICTL Critical Interrupt Status All Register */ +#define ICTL_MISAR_OFF 0x2C /* ICTL Main Interrupt Status All Register */ +#define ICTL_PISAR_OFF 0x30 /* ICTL Peripheral Interrupt Status All Register */ +#define ICTL_BISAR_OFF 0x38 /* ICTL Bus Error Status Register */ + +#define ICTL_BASE_ADRS (MBAR_VALUE + MBAR_ICTL) + +#define ICTL_PIMR ((volatile UINT32 *)(ICTL_BASE_ADRS + ICTL_PIMR_OFF)) +#define ICTL_PPR ((volatile UINT32 *)(ICTL_BASE_ADRS + ICTL_PPR_OFF)) /* [3] */ +#define ICTL_EEETR ((volatile UINT32 *)(ICTL_BASE_ADRS + ICTL_EEETR_OFF)) +#define ICTL_CPMIMR ((volatile UINT32 *)(ICTL_BASE_ADRS + ICTL_CPMIMR_OFF)) +#define ICTL_MIPR ((volatile UINT32 *)(ICTL_BASE_ADRS + ICTL_MIPR_OFF)) /* [2] */ +#define ICTL_ISR ((volatile UINT32 *)(ICTL_BASE_ADRS + ICTL_ISR_OFF)) +#define ICTL_CISAR ((volatile UINT32 *)(ICTL_BASE_ADRS + ICTL_CISAR_OFF)) +#define ICTL_MISAR ((volatile UINT32 *)(ICTL_BASE_ADRS + ICTL_MISAR_OFF)) +#define ICTL_PISAR ((volatile UINT32 *)(ICTL_BASE_ADRS + ICTL_PISAR_OFF)) +#define ICTL_BISAR ((volatile UINT32 *)(ICTL_BASE_ADRS + ICTL_BISAR_OFF)) + + + +/* External Enable and External Types Register */ + +#define ICTL_EEETR_ECLR0_MASK (1<<27) +#define ICTL_EEETR_ECLR1_MASK (1<<26) +#define ICTL_EEETR_ECLR2_MASK (1<<25) +#define ICTL_EEETR_ECLR3_MASK (1<<24) + +#define ICTL_EEETR_ETYPE0_MASK (3<<22) +#define ICTL_EEETR_ETYPE0_LEVEL_HI (0<<22) +#define ICTL_EEETR_ETYPE0_RISING_EDGE (1<<22) +#define ICTL_EEETR_ETYPE0_FALLING_EDGE (2<<22) +#define ICTL_EEETR_ETYPE0_LEVEL_LO (3<<22) + +#define ICTL_EEETR_ETYPE1_MASK (3<<20) +#define ICTL_EEETR_ETYPE1_LEVEL_HI (0<<20) +#define ICTL_EEETR_ETYPE1_RISING_EDGE (1<<20) +#define ICTL_EEETR_ETYPE1_FALLING_EDGE (2<<20) +#define ICTL_EEETR_ETYPE1_LEVEL_LO (3<<20) + +#define ICTL_EEETR_ETYPE2_MASK (3<<18) +#define ICTL_EEETR_ETYPE2_LEVEL_HI (0<<18) +#define ICTL_EEETR_ETYPE2_RISING_EDGE (1<<18) +#define ICTL_EEETR_ETYPE2_FALLING_EDGE (2<<18) +#define ICTL_EEETR_ETYPE2_LEVEL_LO (3<<18) + +#define ICTL_EEETR_ETYPE3_MASK (3<<16) +#define ICTL_EEETR_ETYPE3_LEVEL_HI (0<<16) +#define ICTL_EEETR_ETYPE3_RISING_EDGE (1<<16) +#define ICTL_EEETR_ETYPE3_FALLING_EDGE (2<<16) +#define ICTL_EEETR_ETYPE3_LEVEL_LO (3<<16) + + +#define ICTL_EEETR_MEE (1<<12) + +#define ICTL_EEETR_EENA0_MASK (1<<11) +#define ICTL_EEETR_EENA1_MASK (1<<10) +#define ICTL_EEETR_EENA2_MASK (1<<9) +#define ICTL_EEETR_EENA3_MASK (1<<8) + +#define ICTL_EEETR_CEb (1<<0) + +/* Critical Priority and Main Interrupt Mask Register */ + +#define ICTL_CPMIMR_MAIN_MASK0 (1<<16) +#define ICTL_CPMIMR_MAIN_MASK1 (1<<15) +#define ICTL_CPMIMR_MAIN_MASK2 (1<<14) +#define ICTL_CPMIMR_MAIN_MASK3 (1<<13) +#define ICTL_CPMIMR_MAIN_MASK4 (1<<12) +#define ICTL_CPMIMR_MAIN_MASK5 (1<<11) +#define ICTL_CPMIMR_MAIN_MASK6 (1<<10) +#define ICTL_CPMIMR_MAIN_MASK7 (1<<9) +#define ICTL_CPMIMR_MAIN_MASK8 (1<<8) +#define ICTL_CPMIMR_MAIN_MASK9 (1<<7) +#define ICTL_CPMIMR_MAIN_MASK10 (1<<6) +#define ICTL_CPMIMR_MAIN_MASK11 (1<<5) +#define ICTL_CPMIMR_MAIN_MASK12 (1<<4) +#define ICTL_CPMIMR_MAIN_MASK13 (1<<3) +#define ICTL_CPMIMR_MAIN_MASK14 (1<<2) +#define ICTL_CPMIMR_MAIN_MASK15 (1<<1) +#define ICTL_CPMIMR_MAIN_MASK16 (1<<0) +#define ICTL_CPMIMR_MASK_ALL 0x0001FFFF + +/* Interrupt Status Register */ + +#define ICTL_CEbSh (1<<0) +#define ICTL_ISR_CSe_SHIFT 8 +#define ICTL_ISR_CSe_MASK (7<= 88 = 22 * 4 has enough room for _EXC_ALTIVEC_UNAVAILABLE. + */ +#define _EXC_OFF_PERF 0x0f00 /* performance monitoring intr*/ +#define _EXC_NEW_OFF_PERF 0x0f80 /* relocated perf monitor */ + +#define _EXC_OFF_INST_BKPT 0x1300 /* instruction address BP */ +#define _EXC_OFF_THERMAL 0x1700 /* performance monitoring intr*/ + +/* IABR bit definitions */ + +/* set and get address in IABR */ + +#define _PPC_IABR_ADD(x) ((x) & 0xFFFFFFFC) + +#define _PPC_IABR_BE 0x00000002 /* breakpoint enabled */ +#define _PPC_IABR_TE 0x00000001 /* translation enabled */ + +/* DABR bits definition */ + +/* set and get address in DABR */ + +#define _PPC_DABR_DAB(x) ((x) & 0xFFFFFFF8) + +#define _PPC_DABR_BT 0x00000004 /* breakpoint translation */ +#define _PPC_DABR_DW 0x00000002 /* data write enable */ +#define _PPC_DABR_DR 0x00000001 /* data read enable */ + +/* mask for read and write operations */ + +#define _PPC_DABR_D_MSK (_PPC_DABR_DW | _PPC_DABR_DR) + +/* DSISR bits definition */ + +#define _PPC_DSISR_BRK 0x00400000 /* DABR match occurs */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCppc604h */ diff --git a/h/arch/ppc/ppc85xx.h b/h/arch/ppc/ppc85xx.h new file mode 100644 index 0000000..fd2952d --- /dev/null +++ b/h/arch/ppc/ppc85xx.h @@ -0,0 +1,445 @@ +/* ppc85xx.h - PowerPC specific header */ + +/* Copyright 1984-1998 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01q,18jul05,dtr Add _e500v2 cpu variant. +01p,23sep04,pch resumeInVector support +01o,30jul04,mil Added PPC85XX_ERRATA_CPU29 workaround. +01n,10may04,mil Added _CPU_CACHE_ALIGN_SHIFT. +01m,26feb04,mil Added _WRS_MMU_CLASS_* macros. +01l,13aug03,mil Added MCAR. +01k,20jun03,mil Fixed _CACHE_ALIGN_SIZE macro. +01j,12jun03,dtr Adding CACH_ALIGN_SIZE. +01i,08apr03,dtr Adding define for E500 Fixed point support. +01h,05feb03,dtr Missed comment closure, fixed TBEN define and added HID1_ABE. +01g,07jan03,dtr Adding defines for MAS0. +01f,18dec02,dtr Adding Cache and MMU defines. +01e,08nov02,mil Added and modified registers definitions. +01d,05nov02,pcs Add defines required my the E500 MMU. +01c,17oct02,dtr _WRS_SUPPORT_SPE set to 1. +01b,03oct02,dtr Putting in more 85XX defines. +01a,17sep02,dtr written. +*/ +#ifndef __INCppc85xxh +#define __INCppc85xxh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * If compiling for a variant, the preprocessor symbol CPU_VARIANT will be + * defined as the directory suffix, e.g. _e500v2 for the MPC8548 processors + * (whose objects go in target/lib/ppc/PPC85XX/common_e500v2). + * + * We really want something like #if ("CPU_VARIANT" == "_e500v2") + * which ANSI C does not allow. However, it does allow the expansion + * of CPU_VARIANT to be re-expanded according to another #define. + */ +#ifdef CPU_VARIANT + +#define _e500v2 8548 + +#if (CPU_VARIANT == _e500v2) +#define PPC_e500v2 1 +#endif /* CPU_VARIANT == _e500v2 */ +#undef _e500v2 +#endif /* CPU_VARIANT */ + + +/* Erratum CPU29 for E500 exists on all Rev.2 cores. + * mtmsr with change to IS bit may corrupt system state. + * Workaround is to use rfi instead of mtmsr. + */ +#define PPC85XX_ERRATA_CPU29 1 + +/* Maximum cache line size for the cpu */ +#define _CPU_CACHE_ALIGN_SHIFT 5 /* cache align size = 32 */ +#undef _CPU_CACHE_ALIGN_SIZE +#define _CPU_CACHE_ALIGN_SIZE 32 /* cannot use (1<<5) because compiler + * directive __attribute__ cant hdl */ + +/* MMU supports software TLB miss handler */ +#undef _WRS_TLB_MISS_CLASS_HW +#define _WRS_TLB_MISS_CLASS_SW 1 + +/* MMU uses PID register to extend virtual address tag */ +#undef _WRS_MMU_CLASS_NONE +#undef _WRS_MMU_CLASS_SR_REGS +#define _WRS_MMU_CLASS_PID_REG 1 + +/* MMU ASID context register name for _WRS_MMU_CLASS_PID_REG */ +#define _PPC_PID_REG PID0 + +/* MMU cannot be disabled */ +#define PPC_NO_REAL_MODE + +#define _WRS_SPE_SUPPORT 1 +#define _WRS_E500_FIXED_POINT_SUPPORT 1 + +#undef _PPC_MSR_FP +#define _PPC_MSR_SPE_U 0x0200 +#define _PPC_MSR_SPE 0x02000000 +#define MSR_SPE_BIT_SHIFT 25 + +/* INT_MASK definition (mask EE & CE bits) : overwrite the one in asmPpc.h */ + +#undef INT_MASK +#define INT_MASK(src, des) rlwinm des, src, 0, 17, 15; \ + rlwinm des, des, 0, 15, 13 + +/* #define IMMR 638 * bogus hack */ + +/* Special Purpose Register (SPR) numbers */ +#define CSRR0 58 /* Critical SRR0 */ +#define CSRR1 59 /* Critical SRR1 */ +#define DEAR 61 /* Data Exception Address Register */ +#define ESR 62 /* Exception Syndrome Register */ +#define IVPR 63 /* Interrupt Vector Prefix Register */ +#define IVOR0 400 /* IVOR Critical Input */ +#define IVOR1 401 /* IVOR Machine Check */ +#define IVOR2 402 /* IVOR Data Storage */ +#define IVOR3 403 /* IVOR Instruction Storage */ +#define IVOR4 404 /* IVOR External Input */ +#define IVOR5 405 /* IVOR Alignment */ +#define IVOR6 406 /* IVOR Program */ +#define IVOR7 407 /* IVOR Floating Point Unavailable */ +#define IVOR8 408 /* IVOR System Call */ +#define IVOR9 409 /* IVOR Auxiliary Processor Unavailable */ +#define IVOR10 410 /* IVOR Decrementer */ +#define IVOR11 411 /* IVOR Fixed Interval Timer */ +#define IVOR12 412 /* IVOR Watchdog Timer */ +#define IVOR13 413 /* IVOR Data TLB Error */ +#define IVOR14 414 /* IVOR Instruction TLB Error */ +#define IVOR15 415 /* IVOR Debug */ +#define IVOR32 528 /* IVOR SPE */ +#define IVOR33 529 /* IVOR Vector FP Data */ +#define IVOR34 530 /* IVOR Vector FP Round */ +#define IVOR35 531 /* IVOR Performance Monitor */ +#define MCSRR0 570 /* Machine Check SRR0 */ +#define MCSRR1 571 /* Machine Check SRR1 */ +#define MCSR 572 /* Machine Check Syndrome Register */ +#define MCAR 573 /* Machine Check Address Register */ +#define SPEFSCR 512 /* SPE Floating-pt Status and Control Register */ +/* SPRG0-SPRG3 are defined correctly in asmPpc.h */ +#define SPRG4_R 260 /* Special Purpose Register General 4, read */ +#define SPRG4_W 276 /* Special Purpose Register General 4, write */ +#define SPRG5_R 261 /* Special Purpose Register General 5, read */ +#define SPRG5_W 277 /* Special Purpose Register General 5, write */ +#define SPRG6_R 262 /* Special Purpose Register General 6, read */ +#define SPRG6_W 278 /* Special Purpose Register General 6, write */ +#define SPRG7_R 263 /* Special Purpose Register General 7, read */ +#define SPRG7_W 279 /* Special Purpose Register General 7, write */ +#define TBL_R 268 /* Time Base Lower, read */ +#define TBL_W 284 /* Time Base Lower, write */ +#define TBU_R 269 /* Time Base Upper, read */ +#define TBU_W 285 /* Time Base Upper, write */ +#define TCR 340 /* Timer Control Register */ +#define TSR 336 /* Timer Status Register */ +#define USPRG0 256 /* User Special Purpose Register General 0 */ +#define DBCR0 308 /* Debug Control Register 0 */ +#define DBCR1 309 /* Debug Control Register 1 */ +#define DBCR2 310 /* Debug Control Register 2 */ +#define DBSR 304 /* Debug Status Register */ +#define IAC1 312 /* Instr Address Compare Register 1 */ +#define IAC2 313 /* Instr Address Compare Register 2 */ +#define DAC1 316 /* Data Address Compare Register 1 */ +#define DAC2 317 /* Data Address Compare Register 2 */ +#define L1CFG0 515 /* L1 Config Register 0 */ +#define L1CFG1 516 /* L1 Config Register 1 */ +#define L1CSR0 1010 /* L1 Control Status Register 0 */ +#define L1CSR1 1011 /* L1 Control Status Register 1 */ +#define MAS0 624 /* MMU Assist Register 0 */ +#define MAS1 625 /* MMU Assist Register 1 */ +#define MAS2 626 /* MMU Assist Register 2 */ +#define MAS3 627 /* MMU Assist Register 3 */ +#define MAS4 628 /* MMU Assist Register 4 */ +#define MAS6 630 /* MMU Assist Register 6 */ +#if defined(PPC_e500v2) +#define MAS7 944 /* MMU Assist Register 7 */ +#endif /* PPC_e500v2 */ + +#define TLB0CFG 688 /* TLB 0 Config Register */ +#define TLB1CFG 689 /* TLB 1 Config Register */ +#define MMUCSR0 1012 /* MMU Control Status Register 0 */ +#define MMUCFG 1015 /* MMU Config Register */ + +/* MSR (upper half) definitions */ +/* ppcArch.h defines a generic MSR. Here we define changes from that base */ + +#undef _PPC_MSR_SF_U /* 64 bit mode not implemented */ +#undef _PPC_MSR_POW_U /* power management not supported */ +#undef _PPC_MSR_ILE_U /* little endian mode not supported */ + +#define _PPC_MSR_WE_U 0x0004 /* wait state enable */ +#define _PPC_MSR_CE_U 0x0002 /* critical interrupt enable */ +#define _PPC_MSR_WE 0x00040000 /* wait state enable */ +#define _PPC_MSR_CE 0x00020000 /* critical interrupt enable */ + +/* MSR (lower half) definitions */ + +#undef _PPC_MSR_IR /* insn address translation (always on) */ +#undef _PPC_MSR_DR /* data address translation (always on) */ +#undef _PPC_MSR_SE /* single step unsupported */ +#undef _PPC_MSR_BE /* branch trace not supported */ +#undef _PPC_MSR_IP /* exception prefix bit not supported */ +#undef _PPC_MSR_RI /* recoverable interrupt unsupported */ +#undef _PPC_MSR_LE /* little endian mode unsupported */ +#undef _PPC_MSR_BIT_LE /* little endian mode unsupported */ + +/* + * Machine check exception class is new to PPC in E500. Although + * bit position is same as classic MSR[ME] and is named the same, + * the define of _PPC_MSR_MCE signifies the present of this + * class of exception. If present, both _PPC_MSR_MCE and + * _PPC_MSR_ME should be defined to the mask of 0x1000. + * In addition, Critical Exception Class is also a requirement. + * The critical exception code stub does not mask exceptions + * and is used for machine check exception class as well. + * Therefore, _EXC_OFF_CRTL should be defined. + */ +#define _PPC_MSR_MCE _PPC_MSR_ME /* machine check enable */ +#define _PPC_MSR_DE 0x0200 /* debug exception enable */ +#define _PPC_MSR_IS 0x0020 /* insn address space selector */ +#define _PPC_MSR_DS 0x0010 /* data address space selector */ + +#define _PPC_MSR_BIT_IS 26 +#define _PPC_MSR_BIT_DS 27 + +#define _PPC_MSR_MMU_EXTRACT(src, dst) \ + rlwinm dst, src, 0, _PPC_MSR_BIT_IS, _PPC_MSR_BIT_DS + + +#define HID0 1008 +#define HID1 1009 +#define DECAR 54 + + +/* E500core has no FPU */ +#ifndef INCLUDE_HW_FP +#undef _PPC_MSR_FP /* floating point not available */ +#undef _PPC_MSR_FE1 /* floating point not available */ +#undef _PPC_MSR_FE0 /* floating point not available */ +#undef _PPC_MSR_BIT_FP /* MSR Floating Point Aval. bit - FP */ +#undef _PPC_MSR_BIT_FE0 /* MSR FP exception mode 0 bit - FE0 */ +#undef _PPC_MSR_BIT_FE1 /* MSR FP exception mode 1 bit - FE1 */ +#undef _EXC_PROG_SRR1_FPU /* floating point not available */ +#endif /* INCLUDE_HW_FP */ + +/* + * Exception syndrome register mask bits: + * 0 - error not occured 1 - error occured + */ +#define _PPC_ESR_PIL_U 0x0800 /* Pgm Interrupt -- Illegal Insn */ +#define _PPC_ESR_PPR_U 0x0400 /* Pgm Interrupt -- Previleged Insn */ +#define _PPC_ESR_PTR_U 0x0200 /* Pgm Interrupt -- Trap */ +#define _PPC_ESR_ST_U 0x0080 /* Store Operation */ +#define _PPC_ESR_DLK_U 0x0020 /* Data Locked -- DSI occured */ +#define _PPC_ESR_ILK_U 0x0010 /* Inst Locked -- DSI occured */ +#define _PPC_ESR_AP_U 0x0008 /* AP Operation */ +#define _PPC_ESR_BO_U 0x0002 /* Byte Ordering Exception */ +#define _PPC_ESR_PIL 0x08000000 /* Pgm Interrupt -- Illegal Insn */ +#define _PPC_ESR_PPR 0x04000000 /* Pgm Interrupt -- Previleged Insn */ +#define _PPC_ESR_PTR 0x02000000 /* Pgm Interrupt -- Trap */ +#define _PPC_ESR_ST 0x00800000 /* Store Operation */ +#define _PPC_ESR_DLK 0x00200000 /* Data Storage Interrupt -- Locking */ +#define _PPC_ESR_ILK 0x00100000 /* Inst Locked -- DSI occured */ +#define _PPC_ESR_AP 0x00080000 /* AP Operation */ +#define _PPC_ESR_BO 0x00020000 /* Byte Ordering Exception */ +#define _PPC_ESR_SPE 0x00000080 /* SPE exception */ + +/* Bits in the upper half of TCR */ +#define _PPC_TCR_WP_U 0xc000 /* Watchdog Timer Period */ +#define _PPC_TCR_WRC_U 0x3000 /* Watchdog Timer Reset Control */ +#define _PPC_TCR_WIE_U 0x0800 /* Watchdog Timer Interrupt Enable */ +#define _PPC_TCR_DIE_U 0x0400 /* Decrementer Interrupt Enable */ +#define _PPC_TCR_FP_U 0x0300 /* Fixed Interval Timer Period */ +#define _PPC_TCR_FIE_U 0x0080 /* Fixed Interval Timer Interrupt Enable */ +#define _PPC_TCR_ARE_U 0x0040 /* Decrementer Auto-Reload Enable */ +#define _PPC_TCR_WPEXT_U 0x0040 /* Decrementer Auto-Reload Enable */ +#define _PPC_TCR_FPEXT_U 0x0040 /* Decrementer Auto-Reload Enable */ + +/* Bits in the upper half of TSR */ +#define _PPC_TSR_ENW_U 0x8000 /* Enable Next Watchdog Timer Exception */ +#define _PPC_TSR_WIS_U 0x4000 /* Watchdog Timer Interrupt Status */ +#define _PPC_TSR_WRS_U 0x3000 /* Watchdog Timer Reset Status */ +#define _PPC_TSR_DIS_U 0x0800 /* Decrementer Interrupt Status */ +#define _PPC_TSR_FIS_U 0x0400 /* Fixed Interval Timer Interrupt Status */ + +/* versions of the aligned for 32-bit TCR/TSR register access */ +#define _PPC_TCR_DIE (_PPC_TCR_DIE_U << 16) +#define _PPC_TSR_DIS (_PPC_TSR_DIS_U << 16) + +/* hardware dependent register 0 */ +#define _PPC_HID0_DOZE 0x00800000 /* DOZE power management mode */ +#define _PPC_HID0_NAP 0x00400000 /* NAP power management mode */ +#define _PPC_HID0_SLEEP 0x00200000 /* SLEEP power management mode */ +#define _PPC_HID0_TBEN 0x00004000 /* time base enable */ +#if defined(PPC_e500v2) +#define _PPC_HID0_MAS7EN 0x00000080 /* Enable use of MAS7 for tlbre */ +#define _PPC_HID0_DCFA 0x00000040 /* Use this bit to flush only valid entries same as 74XX */ +#define _PPC_HID0_BIT_MAS7EN 24 +#define _PPC_HID0_BIT_DCFA 25 +#define _PPC_85XX_USE_DCFA +#endif + +/* hardware dependent register 1 */ +#define _PPC_HID1_ABE 0x00001000 /* Address broadcast enable */ + +/* Cache Defines */ + +/* Instruction and Data Cache bit fields are the same */ +#define _PPC_L1CSR_E 0x00000001 /* Enable */ +#define _PPC_L1CSR_FI 0x00000002 /* Flash Invalidate */ +#define _PPC_L1CSR_FLR 0x00000100 /* Lock Bits Flash */ +#define _PPC_L1CSR_LO 0x00000200 /* Lock Overflow */ +#define _PPC_L1CSR_UL 0x00000400 /* Unable to lock - status bit */ +#define _PPC_L1CSR_UL_V(x) (x >> 10) +#define _PPC_L1CSR_SLC 0x00000800 /* Snoop lock clear - status bit */ +#define _PPC_L1CSR_SLC_V(x) (x >> 11) +#define _PPC_L1CSR_PIE 0x00008000 /* Parity Injection Enable */ +#define _PPC_L1CSR_CPE 0x00010000 /* Parity Enable */ + +/* Instruction and Datat Cache bit fields are the same */ +#define _PPC_L1CFG_SIZE_MASK 0x00000FFF +#define _PPC_L1CFG_NWAY_MASK 0x000FF000 +#define _PPC_L1CFG_NWAY_V(x) (x >> 12) +#define _PPC_L1CFG_PA_MASK 0x00100000 +#define _PPC_L1CFG_PA_V(x) (x >> 16) +#define _PPC_L1CFG_LA_MASK 0x00200000 +#define _PPC_L1CFG_LA_V(x) (x >> 17) +#define _PPC_L1CFG_REPL_MASK 0x00400000 +#define _PPC_L1CFG_REPL_V(x) (x >> 18) +#define _PPC_L1CFG_BSIZE_MASK 0x01800000 +#define _PPC_L1CFG_BSIZE_V(x) (x >> 19) +#define _PPC_L1CFG_CARCH_MASK 0xC0000000 /* L1CFG0 only */ +#define _PPC_L1CFG_CARCH_V(x) (x >> 30) + +/* MMU register defines */ + +#define PID 48 +#define PID_MASK 0x0FF +#define PID0 48 +#define PID1 633 +#define PID2 634 + +#define _PPC_MMUCSR0_L2TLB1_FI 0x00000002 +#define _PPC_MMUCSR0_L2TLB1_FI_V(x) (x >> 1) +#define _PPC_MMUCSR0_L2TLB0_FI 0x00000004 +#define _PPC_MMUCSR0_L2TLB0_FI_V(x) (x >> 2) +#define _PPC_MMUCSR0_DL1MMU_FI 0x00000008 +#define _PPC_MMUCSR0_DL1MMU_FI_V(x) (x >> 3) +#define _PPC_MMUCSR0_IL1MMU_FI 0x00000010 +#define _PPC_MMUCSR0_IL1MMU_FI_V(x) (x >> 4) + + +#define _PPC_MAS0_NV 0x00000000 +#define _PPC_MAS0_ESEL_MASK 0x03ff0000 +#define _PPC_MAS0_ESEL_BIT 16 +#define _PPC_MAS0_ESEL_V(x) (x >> _PPC_MAS0_ESEL_BIT) +#define _PPC_MAS0_TLBSEL1 0x10000000 +#define _PPC_MAS0_TLBSEL_MASK 0x30000000 + +/* Range of hardware context numbers (PID register & TLB TID field) */ + +#define MMU_ASID_MIN 1 +#define MMU_ASID_MAX 255 +#define MMU_ASID_GLOBAL MMU_ASID_MIN + +/* debug control register 0 */ +#define _DBCR0_IDM_U 0x4000 /* internal debug mode */ +#define _DBCR0_RST_U 0x3000 /* reset */ +#define _DBCR0_ICMP_U 0x0800 /* instruction completion debug event */ +#define _DBCR0_BRT_U 0x0400 /* branch taken debug event */ +#define _DBCR0_IRPT_U 0x0200 /* interrupt debug event */ +#define _DBCR0_TRAP_U 0x0100 /* trap debug event */ +#define _DBCR0_IAC1_U 0x0080 /* instruction address compare 1 */ +#define _DBCR0_IAC2_U 0x0040 /* instruction address compare 2 */ +#define _DBCR0_DAC1R_U 0x0008 /* data address compare 1 Read */ +#define _DBCR0_DAC1W_U 0x0004 /* data address compare 1 Write */ +#define _DBCR0_DAC2R_U 0x0002 /* data address compare 2 Read */ +#define _DBCR0_DAC2W_U 0x0001 /* data address compare 2 Write */ +#define _DBCR0_IDM 0x40000000 /* internal debug mode */ +#define _DBCR0_RST 0x30000000 /* reset */ +#define _DBCR0_ICMP 0x08000000 /* instruction completion debug event */ +#define _DBCR0_BRT 0x04000000 /* branch taken */ +#define _DBCR0_IRPT 0x02000000 /* exception debug event */ +#define _DBCR0_TRAP 0x01000000 /* trap debug event */ +#define _DBCR0_IAC1 0x00800000 /* instruction address compare 1 */ +#define _DBCR0_IAC2 0x00400000 /* instruction address compare 2 */ +#define _DBCR0_DAC1R 0x00080000 /* data address compare 1 Read */ +#define _DBCR0_DAC1W 0x00040000 /* data address compare 1 Write */ +#define _DBCR0_DAC2R 0x00020000 /* data address compare 2 Read */ +#define _DBCR0_DAC2W 0x00010000 /* data address compare 2 Write */ +#define _DBCR0_RET 0x00008000 /* return debug event */ +#define _DBCR0_FT 0x00000001 /* freeze timers on debug */ + +/* debug control register 1 */ +#define _DBCR1_IAC1US_U 0xc000 /* IAC 1 User/Supervisor */ +#define _DBCR1_IAC1ER_U 0x3000 /* IAC 1 Effective/Real */ +#define _DBCR1_IAC2US_U 0x0c00 /* IAC 2 User/Supervisor */ +#define _DBCR1_IAC2ER_U 0x0300 /* IAC 2 Effective/Real */ +#define _DBCR1_IAC12M_U 0x00c0 /* IAC 1/2 Mode */ +#define _DBCR1_IAC12AT_U 0x0001 /* IAC 1/2 Auto-Toggle Enable */ +#define _DBCR1_IAC1US 0xc0000000 /* IAC 1 User/Supervisor */ +#define _DBCR1_IAC1ER 0x30000000 /* IAC 1 Effective/Real */ +#define _DBCR1_IAC2US 0x0c000000 /* IAC 2 User/Supervisor */ +#define _DBCR1_IAC2ER 0x03000000 /* IAC 2 Effective/Real */ +#define _DBCR1_IAC12M 0x00c00000 /* IAC 1/2 Mode */ + +/* debug control register 2 */ +#define _DBCR2_DAC1US_U 0xc000 /* DAC 1 User/Supervisor */ +#define _DBCR2_DAC1ER_U 0x3000 /* DAC 1 Effective/Real */ +#define _DBCR2_DAC2US_U 0x0c00 /* DAC 2 User/Supervisor */ +#define _DBCR2_DAC2ER_U 0x0300 /* DAC 2 Effective/Real */ +#define _DBCR2_DAC12M_U 0x00c0 /* DAC 1/2 Mode */ +#define _DBCR2_DAC1US 0xc0000000 /* DAC 1 User/Supervisor */ +#define _DBCR2_DAC1ER 0x30000000 /* DAC 1 Effective/Real */ +#define _DBCR2_DAC2US 0x0c000000 /* DAC 2 User/Supervisor */ +#define _DBCR2_DAC2ER 0x03000000 /* DAC 2 Effective/Real */ +#define _DBCR2_DAC12M 0x00c00000 /* DAC 1/2 Mode */ + +/* debug status register */ +#define _DBSR_IDE_U 0x8000 /* Imprecise Debug Event */ +#define _DBSR_UDE_U 0x4000 /* Unconditional Debug Event */ +#define _DBSR_MRR_U 0x3000 /* Most Recent Reset */ +#define _DBSR_ICMP_U 0x0800 /* Instruction Completion Debug Event */ +#define _DBSR_BRT_U 0x0400 /* Branch Taken Debug Event */ +#define _DBSR_IRPT_U 0x0200 /* Interrupt Debug Event */ +#define _DBSR_TRAP_U 0x0100 /* Trap Debug Event */ +#define _DBSR_IAC1_U 0x0080 /* IAC 1 Debug Event */ +#define _DBSR_IAC2_U 0x0040 /* IAC 2 Debug Event */ +#define _DBSR_DAC1R_U 0x0008 /* DAC/DVC 1 Read Debug Event */ +#define _DBSR_DAC1W_U 0x0004 /* DAC/DVC 1 Write Debug Event */ +#define _DBSR_DAC2R_U 0x0002 /* DAC/DVC 2 Read Debug Event */ +#define _DBSR_DAC2W_U 0x0001 /* DAC/DVC 2 Write Debug Event */ +#define _DBSR_IDE 0x80000000 /* Imprecise Debug Event */ +#define _DBSR_UDE 0x40000000 /* Unconditional Debug Event */ +#define _DBSR_MRR 0x30000000 /* Most Recent Reset */ +#define _DBSR_ICMP 0x08000000 /* Instruction Completion Debug Event */ +#define _DBSR_BRT 0x04000000 /* Branch Taken Debug Event */ +#define _DBSR_IRPT 0x02000000 /* Interrupt Debug Event */ +#define _DBSR_TRAP 0x01000000 /* Trap Debug Event */ +#define _DBSR_IAC1 0x00800000 /* IAC 1 Debug Event */ +#define _DBSR_IAC2 0x00400000 /* IAC 2 Debug Event */ +#define _DBSR_DAC1R 0x00080000 /* DAC/DVC 1 Read Debug Event */ +#define _DBSR_DAC1W 0x00040000 /* DAC/DVC 1 Write Debug Event */ +#define _DBSR_DAC2R 0x00020000 /* DAC/DVC 2 Read Debug Event */ +#define _DBSR_DAC2W 0x00010000 /* DAC/DVC 2 Write Debug Event */ +#define _DBSR_RET 0x00008000 /* Return Debug Event */ + +/* mask for hardware breakpoints */ +#define _DBSR_HWBP_MSK ( _DBSR_IAC1 | _DBSR_IAC2 | \ + _DBSR_DAC1R | _DBSR_DAC1W | \ + _DBSR_DAC2R | _DBSR_DAC2W ) + + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCppc85xxh */ diff --git a/h/arch/ppc/ppc860.h b/h/arch/ppc/ppc860.h new file mode 100644 index 0000000..4db9e97 --- /dev/null +++ b/h/arch/ppc/ppc860.h @@ -0,0 +1,258 @@ +/* ppc860.h - PowerPC 860 specific header */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- + +01i,24jan05,mmi Add _CPU_CACHE_ALIGN_SHIFT +01h,12feb04,jtp Add _WRS_MMU_CLASS_* macro +01g,05dec03,jtp Add _WRS_TLB_MISS_CLASS_HW, _PPC_MSR_MMU_EXTRACT +01f,13mar03,pch Add PPC32 support +01e,13jun02,jtp identify class of MMU support (SPR #78396) +01d,28jul98,elg added hardware breakpoints +01c,14feb97,tam undefined _PPC_MSR_FP and removed double macro definitions. +01b,06nov96,tpr changed _CACHE_ALIGN_SIZE to 16 (SPR #7372). + + added _PPC_MSR_BIT_XXX macros. +01a,08apr96,tpr written. +*/ + +#ifndef __INCppc860h +#define __INCppc860h + +#ifdef __cplusplus +extern "C" { +#endif + +/* MMU supports software TLB miss handler */ +#define _WRS_TLB_MISS_CLASS_SW 1 +#undef _WRS_TLB_MISS_CLASS_HW + +/* MMU uses PID registers to extend virtual address */ +#define _WRS_MMU_CLASS_PID_REG 1 +#undef _WRS_MMU_CLASS_SR_REGS +#undef _WRS_MMU_CLASS_NONE + +/* MMU ASID context register name for _WRS_MMU_CLASS_PID_REG */ +#define _PPC_PID_REG M_CASID + +#define _PPC_MSR_ISF_U 0x0002 /* Implementation specific fct*/ + +#ifdef _CPU_CACHE_ALIGN_SIZE +#undef _CPU_CACHE_ALIGN_SIZE +#endif /* _CPU_CACHE_ALIGN_SIZE */ + +#define _CPU_CACHE_ALIGN_SIZE 16 /* cache line size */ +#define _CPU_CACHE_ALIGN_SHIFT 4 /* All ppc8xx have 16 bytes cache or less */ + +/* exception offset PowerPC860 specific */ + +#define _EXC_OFF_SW_EMUL 0x01000 /* Software Emulation */ +#define _EXC_OFF_INST_MISS 0x01100 /* Instruction TLB Miss */ +#define _EXC_OFF_DATA_MISS 0x01200 /* Data TLB Miss */ +#define _EXC_OFF_INST_ERROR 0x01300 /* Instruction TLB Error */ +#define _EXC_OFF_DATA_ERROR 0x01400 /* Data TLB Error */ +#define _EXC_OFF_DATA_BKPT 0x01c00 /* Data Breakpoint */ +#define _EXC_OFF_INST_BKPT 0x01d00 /* Instruction Breakpoint */ +#define _EXC_OFF_PERI_BKPT 0x01e00 /* Peripheral Breakpoint */ +#define _EXC_OFF_NM_DEV_PORT 0x01f00 /* Nom Maskable develop. port */ + +/* MSR bit definitions */ + +#undef _PPC_MSR_FP /* hardware floating point unsupported*/ + +#define _PPC_MSR_BIT_ILE 15 /* MSR Excep little endian bit - ILE */ +#define _PPC_MSR_BIT_SE 21 /* MSR Single Step Trace bit - SE */ +#define _PPC_MSR_BIT_BE 22 /* MSR Branch Trace Enable bit - BE */ +#define _PPC_MSR_BIT_IP 25 /* MSR Exception Prefix bit - EP */ +#define _PPC_MSR_BIT_IR 26 /* MSR Inst Translation bit - IR */ +#define _PPC_MSR_BIT_DR 27 /* MSR Data Translation bit - DR */ +#define _PPC_MSR_BIT_RI 30 /* MSR Exception Recoverable bit - RI */ + +/* MSR MMU Bit extraction macros */ + +#define _PPC_MSR_MMU_EXTRACT(src, dst) \ + rlwinm dst, src, 0, _PPC_MSR_BIT_IR, _PPC_MSR_BIT_DR + +/* Special Purpose Registers PowerPC860 specific */ + +#define EIE 80 /* External Interrupt Enable */ +#define EID 81 /* External Interrupt Disable */ +#define NRI 82 /* Non Recoverable Interrupt */ +#define CMPA 144 /* Comparator A value register */ +#define CMPB 145 /* Comparator B value register */ +#define CMPC 146 /* Comparator C value register */ +#define CMPD 147 /* Comparator D value register */ +#define ICR 148 /* Interrupt Cause Register */ +#define DER 149 /* Debug Enable Register*/ +#define COUNTA 150 /* Breakpoint Counter A value & control reg. */ +#define COUNTB 151 /* Breakpoint Counter B value & control reg. */ +#define CMPE 152 /* Comparator E value register */ +#define CMPF 153 /* Comparator F value register */ +#define CMPG 154 /* Comparator G value register */ +#define CMPH 155 /* Comparator H value register */ +#define LCTRL1 156 /* Load store support comparator Control reg. */ +#define LCTRL2 157 /* Load store support AND-OR Control register */ +#define ICTRL 158 /* Instruction support Control register */ +#define BAR 159 /* Breakpoint Address register */ + +#define IC_CST 560 /* Instruction Cache Control and Status reg. */ +#define IC_ADR 561 /* Instruction Cache Address register */ +#define IC_DAT 562 /* Instruction Cache Data port */ +#define DC_CST 568 /* Data Cache Control and Status register */ +#define DC_ADR 569 /* Data Cache Address register */ +#define DC_DAT 570 /* Data Cache Data port*/ + +#define DPDR 630 /* Development Port Data Register */ +#define DPIR 631 /* */ +#define IMMR 638 /* */ + +#define MI_CTR 784 /* Instruction MMU Control Register */ +#define MI_AP 786 /* Instruction MMU Access Protection Register */ +#define MI_EPN 787 /* Instruction MMU Effective Number Register */ +#define MI_TWC 789 /* Instruction MMU Tablewalk control Register */ +#define MI_RPN 790 /* Instruction MMU Real Page Number Port */ + +#define MD_CTR 792 /* Data MMU Control Register */ +#define M_CASID 793 /* CASID register */ +#define MD_AP 794 /* Data Access Protection Register */ +#define MD_EPN 795 /* Data Effective Number Register */ +#define M_TWB 796 /* MMU Tablewalk base register */ +#define MD_TWC 797 /* Data Tablewalk control Register */ +#define MD_RPN 798 /* Data Real Page Number Port */ +#define M_TW 799 /* MMU Tablewalk special register */ + +#define MI_DBCAM 816 /* Instruction MMU CAM entry read register */ +#define MI_DBRAM0 817 /* Instruction MMU RAM entry read register 0 */ +#define MI_DBRAM1 818 /* Instruction MMU RAM entry read register 1 */ +#define MD_DBCAM 824 /* Data MMU CAM entry read register */ +#define MD_DBRAM0 825 /* Data MMU RAM entry read register 0 */ +#define MD_DBRAM1 826 /* Data MMU RAM entry read register 1 */ + +/* comparators masks */ + +#define _PPC_CMP_MSK ~(0x3) + +/* LCTRL1 bit definitions */ + +/* compare types */ + +#define _PPC_LCTRL1_CT_EQ 0x4 /* compare type equal */ +#define _PPC_LCTRL1_CT_LT 0x5 /* compare type less than */ +#define _PPC_LCTRL1_CT_GT 0x6 /* compare type greater than */ +#define _PPC_LCTRL1_CT_NE 0x7 /* compare type not equal */ + +/* access to compare types */ + +#define _PPC_LCTRL1_CTE(x) (((x) << 29) & 0xE0000000) +#define _PPC_LCTRL1_CTF(x) (((x) << 26) & 0x1C000000) +#define _PPC_LCTRL1_CTG(x) (((x) << 23) & 0x03800000) +#define _PPC_LCTRL1_CTH(x) (((x) << 20) & 0x00700000) + +/* select match on read/write of comparators E and F */ + +#define _PPC_LCTRL1_CRWE(x) (((x) << 18) & 0x000C0000) +#define _PPC_LCTRL1_CRWF(x) (((x) << 16) & 0x00030000) +#define _PPC_LCTRL1_TYPE_E(x) (((x) & 0x000C0000) >> 18) +#define _PPC_LCTRL1_TYPE_F(x) (((x) & 0x00030000) >> 16) + +/* LCTRL2 bit definitions */ + +/* first load/store watchpoint */ + +#define _PPC_LCTRL2_LW0EN 0x80000000 /* watchpoint enabled */ + +#define _PPC_LCTRL2_LW0IA_IW0 0x00000000 /* IW0 selection */ +#define _PPC_LCTRL2_LW0IA_IW1 0x20000000 /* IW1 selection */ +#define _PPC_LCTRL2_LW0IA_IW2 0x40000000 /* IW2 selection */ +#define _PPC_LCTRL2_LW0IA_IW3 0x60000000 /* IW3 selection */ +#define _PPC_LCTRL2_LW0IADC 0x10000000 /* care instruction events */ + +#define _PPC_LCTRL2_LW0LA_MSK 0x0C000000 /* address event mask */ +#define _PPC_LCTRL2_LW0LA_E 0x00000000 /* match from comparator E */ +#define _PPC_LCTRL2_LW0LA_F 0x04000000 /* match from comparator F */ +#define _PPC_LCTRL2_LW0LA_E_AND_F 0x08000000 /* match from E&F */ +#define _PPC_LCTRL2_LW0LA_E_OR_F 0x0C000000 /* match from E|F */ +#define _PPC_LCTRL2_LW0LADC 0x02000000 /* care address events */ + +#define _PPC_LCTRL2_LW0LD_G 0x00000000 /* match from comparator G */ +#define _PPC_LCTRL2_LW0LD_H 0x00800000 /* match from comparator H */ +#define _PPC_LCTRL2_LW0LD_G_AND_H 0x01000000 /* match from G&H */ +#define _PPC_LCTRL2_LW0LD_G_OR_H 0x01800000 /* match from G|H */ +#define _PPC_LCTRL2_LW0LDDC 0x00400000 /* care data events */ + +#define _PPC_LCTRL2_DLW0EN 0x00000008 /* development port trap */ +#define _PPC_LCTRL2_SLW0EN 0x00000002 /* software trap enabled */ + +/* second load/store watchpoint */ + +#define _PPC_LCTRL2_LW1EN 0x00200000 /* watchpoint enabled */ + +#define _PPC_LCTRL2_LW1IA_IW0 0x00000000 /* IW0 selection */ +#define _PPC_LCTRL2_LW1IA_IW1 0x00080000 /* IW1 selection */ +#define _PPC_LCTRL2_LW1IA_IW2 0x00100000 /* IW2 selection */ +#define _PPC_LCTRL2_LW1IA_IW3 0x00180000 /* IW3 selection */ +#define _PPC_LCTRL2_LW1IADC 0x00040000 /* care instruction events */ + +#define _PPC_LCTRL2_LW1LA_E 0x00000000 /* match from comparator E */ +#define _PPC_LCTRL2_LW1LA_F 0x00010000 /* match from comparator F */ +#define _PPC_LCTRL2_LW1LA_E_AND_F 0x00020000 /* match from E&F */ +#define _PPC_LCTRL2_LW1LA_E_OR_F 0x00030000 /* match from E|F */ +#define _PPC_LCTRL2_LW1LADC 0x00008000 /* care address events */ + +#define _PPC_LCTRL2_LW1LD_G 0x00000000 /* match from comparator G */ +#define _PPC_LCTRL2_LW1LD_H 0x00002000 /* match from comparator H */ +#define _PPC_LCTRL2_LW1LD_G_AND_H 0x00004000 /* match from G&H */ +#define _PPC_LCTRL2_LW1LD_G_OR_H 0x00006000 /* match from G|H */ +#define _PPC_LCTRL2_LW1LDDC 0x00001000 /* care data events */ + +#define _PPC_LCTRL2_BRKNOMSK 0x00000800 /* nonmasked mode */ + +#define _PPC_LCTRL2_DLW1EN 0x00000004 /* development port trap */ +#define _PPC_LCTRL2_SLW1EN 0x00000001 /* software trap enabled */ + +/* ICTRL bit definitions */ + +/* the different compare types */ + +#define _PPC_ICTRL_CT_EQ 0x4 /* compare type equal */ +#define _PPC_ICTRL_CT_LT 0x5 /* compare type less than */ +#define _PPC_ICTRL_CT_GT 0x6 /* compare type greater than */ +#define _PPC_ICTRL_CT_NE 0x7 /* compare type not equal */ + +/* access to the compare types */ + +#define _PPC_ICTRL_CTA(x) (((x) << 29) & 0xE0000000) +#define _PPC_ICTRL_CTB(x) (((x) << 26) & 0x1C000000) +#define _PPC_ICTRL_CTC(x) (((x) << 23) & 0x03800000) +#define _PPC_ICTRL_CTD(x) (((x) << 20) & 0x00700000) + +/* logic operations between comparators */ + +#define _PPC_ICTRL_IW0_A 0x00080000 /* match from comparator A */ +#define _PPC_ICTRL_IW0_A_AND_B 0x000C0000 /* match from comparators A&B */ +#define _PPC_ICTRL_IW1_B 0x00020000 /* match from comparator B */ +#define _PPC_ICTRL_IW1_A_OR_B 0x00030000 /* match from comparators A|B */ +#define _PPC_ICTRL_IW2_C 0x00008000 /* match from comparator C */ +#define _PPC_ICTRL_IW2_C_AND_D 0x0000C000 /* match from comparators C&D */ +#define _PPC_ICTRL_IW3_D 0x00002000 /* match from comparator D */ +#define _PPC_ICTRL_IW3_C_OR_D 0x00003000 /* match from comparators C|D */ + +/* software trap enable selection */ + +#define _PPC_ICTRL_SIWEN_MSK 0x00000F00 /* software trap mask */ +#define _PPC_ICTRL_SIW0EN 0x00000800 /* software trap of IW0 */ +#define _PPC_ICTRL_SIW1EN 0x00000400 /* software trap of IW1 */ +#define _PPC_ICTRL_SIW2EN 0x00000200 /* software trap of IW2 */ +#define _PPC_ICTRL_SIW3EN 0x00000100 /* software trap of IW3 */ + +/* mask of used bits for hardware breakpoints */ + +#define _PPC_ICTRL_HWBP_MSK 0xFFFFFF00 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCppc860h */ diff --git a/h/arch/ppc/ppc970.h b/h/arch/ppc/ppc970.h new file mode 100644 index 0000000..aa0e5ba --- /dev/null +++ b/h/arch/ppc/ppc970.h @@ -0,0 +1,428 @@ +/* ppc970.h - PowerPC 970 specific header */ + +/* Copyright 2003-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01s,06oct05,pch add cache and SCOM definitions +01r,24feb05,pch Add _WRS_WDB_CPU_TYPE + Replace PPC970_64 placeholder with _WRS_OS_64BIT +01q,17nov04,to PPC970 does not implement mcrxr instruction. +01p,25jun04,to add _CPU_CACHE_ALIGN_SHIFT. +01o,04jun04,to define _WRS_FP_CLASS_HW. define RFI only for _ASMLANGUAGE. +01n,28may04,to define _WRS_ALTIVEC_SUPPORT. remove tmp rfid def. +01m,26apr04,to define _WRS_PPC_OEA, _WRS_PPC_64BIT macros. +01l,22apr04,to define _WRS_PPC_HAS_HV_MODE. +01k,08mar04,to define _WRS_MMU_NO_BAT. +01j,05mar04,to use _WRS_MMU_64BIT for 64-bit MMU implementations. fix typos. +01i,04mar04,rec add 64 bit SR1 and PTE +01h,01mar04,rec fix HID5 address +01g,20feb04,to define RFI and RFI_OPCODE +01f,19feb04,to remove LL from constants for assembly code. +01e,19feb04,to tmp rfid def +01d,17feb04,to misc changes. +01c,12feb04,to remove underscore from const. +01b,12feb04,rec review comments +01a,23dec03,rec written. based on ppc604.h v01n +*/ + +#ifndef __INCppc970h +#define __INCppc970h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _ASMLANGUAGE +#undef RFI +#define RFI rfid +#endif /* _ASMLANGUAGE */ + +#undef RFI_OPCODE +#define RFI_OPCODE 0x4c000024 + +/* + * Set _WRS_OS_64BIT only if building a full 64-bit OS. + * This is not currently supported. + */ +#ifdef _WRS_OS_64BIT +#undef _PPC_REG_SIZE +#define _PPC_REG_SIZE 8 +#endif /* _WRS_OS_64BIT */ + +/* 970 conforms to the PowerPC OEA */ +#define _WRS_PPC_OEA + +/* 970 is a 64-bit PowerPC implementation */ +#define _WRS_PPC_64BIT + +/* 970 implements hypervisor mode */ +#define _WRS_PPC_HAS_HV_MODE + +/* 970 implements PowerPC MMU specs for 64-bit implementations */ +#define _WRS_MMU_64BIT + +/* 970 does not implement BAT */ +#define _WRS_MMU_NO_BAT + +/* MMU supports TLB miss with hardware (not SRR0/SRR1) see 970 UM 5.2.1 */ +#undef _WRS_TLB_MISS_CLASS_SW +#define _WRS_TLB_MISS_CLASS_HW 1 + +/* MMU uses SR registers to establish contexts */ +#undef _WRS_MMU_CLASS_PID_REG +#define _WRS_MMU_CLASS_SR_REGS 1 +#undef _WRS_MMU_CLASS_NONE + +/* 970 implements FPU */ +#undef _WRS_FP_CLASS_SW +#define _WRS_FP_CLASS_HW 1 + +/* 970 does not implement mcrxr instruction */ +#define _WRS_PPC_NO_MCRXR + +/* 970 reports itself to WDB as CPU==PPC32, not as CPU==PPC970 */ +#define _WRS_WDB_CPU_TYPE PPC32 + +/* + * This is essentially a compiler switch to remove/add altivec support + * in the target src. The BSP code is controlled using INCLUDE_ALTIVEC + * in config.h + */ +#define _WRS_ALTIVEC_SUPPORT 1 + + +#define _CPU_CACHE_ALIGN_SHIFT 7 /* cache line size = 128 */ +#define _CPU_CACHE_ALIGN_SIZE 128 /* cache line size */ + +#define ICACHE_SIZE 64 * 1024 +#define ICACHE_WAYS 1 +#define DCACHE_SIZE 32 * 1024 +#define DCACHE_WAYS 2 +#define L2CACHE_SIZE 512 * 1024 +#define L2CACHE_WAYS 8 +#define BLOCK_SIZE_4MB 0x400000 + +#undef SPRG4 +#undef SPRG5 + +#define SCOMC 276 /* Scan Communications Facility */ +#define SCOMD 277 /* Scan Communications Facility */ + +#define PVR 287 /* processor version register */ + +/* LPAR registers */ +#define HSPRG0 304 /* Hypervisor SPRG 0 Register */ +#define HSPRG1 305 /* Hypervisor SPRG 1 Register */ +#define HDEC 310 /* Hypervisor Decrementer Interrupt Register */ +#define HIOR 311 /* Hypervisor Interrupt Offset Register */ +#define HSSR0 314 /* Hypervisor Save/Restore Register 1 */ +#define HSSR1 315 /* Hypervisor Save/Restore Register 2 */ + +/* Performance Monitor Registers */ +#define UPMC1 771 /* Performance Counter 1 */ +#define UPMC2 772 /* Performance Counter 2 */ +#define UPMC3 773 /* Performance Counter 3 */ +#define UPMC4 774 /* Performance Counter 4 */ +#define UPMC5 775 /* Performance Counter 5 */ +#define UPMC6 776 /* Performance Counter 6 */ +#define UPMC7 777 /* Performance Counter 7 */ +#define UPMC8 778 /* Performance Counter 8 */ + +#define UMMCR0 779 /* Monitor Control Register 0 */ +#define UMMCR1 782 /* Monitor Control Register 1 */ +#define UMMCRA 770 /* Monitor Control Register A */ + +#define USIAR 780 /* Sampled Instruction Address Register */ +#define USDAR 781 /* Sampled Data Address Register */ + + + +#define IMC 783 /* IMC Array Address */ +#define UIMC 799 /* User IMC Array Address */ + +#define MMCR0 795 /* Monitor Mode Control Register 0 */ +#define MMCR1 798 /* Monitor Mode Control Register 1 */ +#define MMCRA 786 /* Monitor Mode Control Register */ + +#define PMC1 787 /* Performance Monitor Counter Register 1 */ +#define PMC2 788 /* Performance Monitor Counter Register 2 */ +#define PMC3 789 /* Performance Monitor Counter Register 3 */ +#define PMC4 790 /* Performance Monitor Counter Register 4 */ +#define PMC5 791 /* Performance Monitor Counter Register 5 */ +#define PMC6 792 /* Performance Monitor Counter Register 6 */ +#define PMC7 793 /* Performance Monitor Counter Register 7 */ +#define PMC8 794 /* Performance Monitor Counter Register 8 */ + + +#define SIA 796 /* Sampled Instruction Address Register */ +#define SDA 797 /* Sampled Data Address Register */ + +#define TRIG0 976 /* Trigger 0 Register */ +#define TRIG1 977 /* Trigger 1 Register */ +#define TRIG2 978 /* Trigger 2 Register */ + + +#define HID0 1008 /* hardware implementation register 0 */ +#define HID1 1009 /* hardware implementation register 1 */ +#define HID4 1012 /* hardware implementation register 4 */ +#define HID5 1014 /* hardware implementation register 5 */ + +#define DABR 1013 /* Data Address Breakpoint Register */ +#define DABRX 1015 /* Data Address Breakpoint Register */ + +#define PIR 1023 /* Processor Identification Register */ + + +#ifdef _ASMLANGUAGE +#define _LL(a) a +/* XXX - temporary assists */ +#define mfscomc(x) mfspr x, SCOMC +#define mfscomd(x) mfspr x, SCOMD +#define mtscomc mtspr SCOMC, +#define mtscomd mtspr SCOMD, +#else +#define _LL(a) a##LL +#endif + +/* SCOM definitions */ + +#define SCOM_ADDR_PSR_READ 0x4080 +#define SCOM_ADDR_STS_MODE 0x0430 +#define SCOM_DATA_STS_MODE_L2_DIRECT 0x8000 + + +/* HID0 bit definitions */ + +#define _PPC_HID0_ONEPPC _LL(0x8000000000000000) /* One instruction per dispatch */ +#define _PPC_HID0_DOSINGLE _LL(0x4000000000000000) /* complete instruction then flush */ +#define _PPC_HID0_IOSYNC_SC _LL(0x2000000000000000) /* disable iosync scoreboard */ +#define _PPC_HID0_SER_GP _LL(0x1000000000000000) /* Serialize group dispatch */ +#define _PPC_HID0_DEEPNAP _LL(0x0100000000000000) /* deep nap */ +#define _PPC_HID0_NAP _LL(0x0040000000000000) /* nap */ +#define _PPC_HID0_DPM _LL(0x0010000000000000) /* dynamic power management */ +#define _PPC_HID0_TG _LL(0x0004000000000000) /* Performance monitor threshold granularity */ +#define _PPC_HID0_HANG_DIS _LL(0x0002000000000000) /* disable hang detection */ +#define _PPC_HID0_NHR _LL(0x0001000000000000) /* not hard reset */ +#define _PPC_HID0_INORDER _LL(0x0000800000000000) /* next group not issued until current done */ +#define _PPC_HID0_TB_CTRL _LL(0x0000200000000000) /* time base counts when core stopped */ +#define _PPC_HID0_EXT_TBEN _LL(0x0000100000000000) /* use external clock */ +#define _PPC_HID0_CIABR_EN _LL(0x0000020000000000) /* enable completion instruction ABR */ +#define _PPC_HID0_HDEC_EN _LL(0x0000010000000000) /* hypervisor decrementer enable */ +#define _PPC_HID0_EBPTHERM _LL(0x0000008000000000) /* enable thermal interrupt */ +#define _PPC_HID0_EN_ATTN _LL(0x0000000100000000) /* enable support processor ATTN inst */ +#define _PPC_HID0_EN_MCK _LL(0x0000000080000000) /* enable machine check interrupts */ + +/* HID1 bit definitions */ + +#define _PPC_HID1_BIT_EN_IC 5 /* HID1 enable I-cache bit */ +#define _PPC_HID1_BIT_PF0 7 /* HID1 prefetch field bit 7 */ +#define _PPC_HID1_BIT_PF1 8 /* HID1 prefetch field bit 8 */ +#define _PPC_HID1_BIT_EN_ICBI 9 /* HID1 enable icbi forced match */ +#define _PPC_HID1_BIT_EN_IFCACH 10 /* HID1 enable I-fetch cacheability */ + +#define _PPC_HID1_BHT_STAT _LL(0x0000000000000000) /* static bht prediction */ +#define _PPC_HID1_BHT_GLOB _LL(0x4000000000000000) /* global bht prediction */ +#define _PPC_HID1_BHT_LOCAL _LL(0x8000000000000000) /* local bht prediction */ +#define _PPC_HID1_BHT_FULL _LL(0xC000000000000000) /* full loc/glob bht prediction */ +#define _PPC_HID1_BHT_HIST _LL(0x6000000000000000) /* global bht prediction with history */ +#define _PPC_HID1_BHT_GSEL _LL(0xE000000000000000) /* FULL with gsel bht prediction */ +#define _PPC_HID1_EN_LS _LL(0x1000000000000000) /* enable link stack */ +#define _PPC_HID1_EN_CC _LL(0x0800000000000000) /* enable count cache */ +#define _PPC_HID1_EN_IC _LL(0x0400000000000000) /* enable instruction cache */ +#define _PPC_HID1_PF_NONE _LL(0x0000000000000000) /* no instruction prefetch */ +#define _PPC_HID1_PF_NSA _LL(0x0080000000000000) /* next sequential instruction prefetch */ +#define _PPC_HID1_PF_DNSA _LL(0x0100000000000000) /* next two sequential instruction prefetch */ +#define _PPC_HID1_PF_DIS _LL(0x0180000000000000) /* disable instruction prefetch */ +#define _PPC_HID1_EN_ICBI _LL(0x0040000000000000) /* enable forced icbi match mode */ +#define _PPC_HID1_EN_IFCACH _LL(0x0020000000000000) /* ifetch controlled by ibit */ +#define _PPC_HID1_EN_ICREC _LL(0x0010000000000000) /* enable icache parity error recovery */ +#define _PPC_HID1_EN_IDREC _LL(0x0008000000000000) /* enable i-directory parity error recovery */ +#define _PPC_HID1_EN_ERREC _LL(0x0004000000000000) /* enable I-ERAT parity error recovery */ +#define _PPC_HID1_IC_PE _LL(0x0002000000000000) /* instruction cache parity error inject */ +#define _PPC_HID1_ICD0_PE _LL(0x0001000000000000) /* i-directory 0 cache parity error inject */ +#define _PPC_HID1_IER_PE _LL(0x0000400000000000) /* I-ERAT parity error inject */ +#define _PPC_HID1_EN_SPITW _LL(0x0000200000000000) /* enable speculative table walks */ +#define _PPC_HID1_SUPERCHIX _LL(0x0000100000000000) /* super chicken safe mode */ + +/* HID4 bit definitions */ + +#define _PPC_HID4_BIT_RM_CI 23 /* HID4 real mode cache-inhibited bit */ +#define _PPC_HID4_BIT_DIS_PREF 25 /* HID4 disable data prefetch bit */ +#define _PPC_HID4_BIT_L1DC_FLSH 28 /* HID4 L1 data cache flash invalidate bit */ + +#define _PPC_HID4_RMOR_MSK _LL(0x01FFFE0000000000) /* real mode offset register mask */ +#define _PPC_HID4_RM_CI _LL(0x0000010000000000) /* real mode access cache inhibited */ +#define _PPC_HID4_FORCE_AI _LL(0x0000008000000000) /* data access real mode cache inh */ +#define _PPC_HID4_DIS_PREF _LL(0x0000004000000000) /* disable data prefetch */ +#define _PPC_HID4_RES_PREF _LL(0x0000002000000000) /* reset data prefetch */ +#define _PPC_HID4_EN_SP_DTW _LL(0x0000001000000000) /* enable speculative table walk */ +#define _PPC_HID4_L1DC_FLSH _LL(0x0000000800000000) /* L1 data cache flash invalidate */ +#define _PPC_HID4_DISDERPC0 _LL(0x0000000400000000) /* disable D-ERAT parity checking set 0 */ +#define _PPC_HID4_DISDERPC1 _LL(0x0000000200000000) /* disable D-ERAT parity checking set 1 */ +#define _PPC_HID4_DIS_DERPG _LL(0x0000000100000000) /* disable D-ERAT parity generation */ +#define _PPC_HID4_DISDERAT0 _LL(0x0000000080000000) /* disable D-ERAT set 0 */ +#define _PPC_HID4_DISDERAT1 _LL(0x0000000040000000) /* disable D-ERAT set 1 */ +#define _PPC_HID4_DISDCTPC0 _LL(0x0000000020000000) /* disable cache tag parity checking set 0 */ +#define _PPC_HID4_DISDCTPC1 _LL(0x0000000010000000) /* disable cache tag parity checking set 1 */ +#define _PPC_HID4_DIS_DCTPG _LL(0x0000000008000000) /* disable cache tag parity generation */ +#define _PPC_HID4_DISDCSET0 _LL(0x0000000004000000) /* disable data cache set 0 */ +#define _PPC_HID4_DISDCSET1 _LL(0x0000000002000000) /* disable data cache set 1 */ +#define _PPC_HID4_DIS_DCPC0 _LL(0x0000000001000000) /* disable data cache parity checking set 0 */ +#define _PPC_HID4_DIS_DCPC1 _LL(0x0000000000800000) /* disable data cache parity checking set 1 */ +#define _PPC_HID4_DIS_DCPG _LL(0x0000000000400000) /* disable data cache parity generation */ +#define _PPC_HID4DISDCRTPC0 _LL(0x0000000000200000) /* disable data cache real addr tag parity 0 */ +#define _PPC_HID4DISDCRTPC1 _LL(0x0000000000100000) /* disable data cache real addr tag parity 1 */ +#define _PPC_HID4DISTLBCHK0 _LL(0x0000000000080000) /* disable TLB parity checking set 0 */ +#define _PPC_HID4DISTLBCHK1 _LL(0x0000000000040000) /* disable TLB parity checking set 1 */ +#define _PPC_HID4DISTLBCHK2 _LL(0x0000000000020000) /* disable TLB parity checking set 2 */ +#define _PPC_HID4DISTLBCHK3 _LL(0x0000000000010000) /* disable TLB parity checking set 3 */ +#define _PPC_HID4_DIS_TLBPG _LL(0x0000000000008000) /* disable TLB parity generation */ +#define _PPC_HID4DISTLBSET0 _LL(0x0000000000004000) /* disable TLB set 0 */ +#define _PPC_HID4DISTLBSET1 _LL(0x0000000000002000) /* disable TLB set 1 */ +#define _PPC_HID4DISTLBSET2 _LL(0x0000000000001000) /* disable TLB set 2 */ +#define _PPC_HID4DISTLBSET3 _LL(0x0000000000000800) /* disable TLB set 3 */ +#define _PPC_HID4_DIS_SLBPC _LL(0x0000000000000400) /* disable SLB parity checking */ +#define _PPC_HID4_DIS_SLBPG _LL(0x0000000000000200) /* disable SLB parity generation */ +#define _PPC_HID4_MCK_INJ _LL(0x0000000000000100) /* machine check injection enable */ +#define _PPC_HID4_DIS_STFWD _LL(0x0000000000000080) /* disable store forwarding */ +#define _PPC_HID4_LPES0 _LL(0x0000000000000000) /* LPES=0 V2.00 PPC environment */ +#define _PPC_HID4_LPES1 _LL(0x1000000000000000) /* LPES=1 V2.00 PPC environment */ +#define _PPC_HID4_LPES_NEW _LL(0x1000000000000040) /* environment is new */ +#define _PPC_HID4_RMLR_16G _LL(0x2000000000000000) /* real mode limit register 16 GB */ +#define _PPC_HID4_RMLR_1G _LL(0x4000000000000000) /* real mode limit register 1 GB */ +#define _PPC_HID4_RMLR_64M _LL(0x6000000000000000) /* real mode limit register 64 MB */ +#define _PPC_HID4_RMLR256M _LL(0x0000000000000010) /* real mode limit register 256 MB */ +#define _PPC_HID4_RMLR128M _LL(0x6000000000000010) /* real mode limit register 128 MB */ +#define _PPC_HID4_DISSPLARX _LL(0x0000000000000008) /* disable speculative lwarx, ldarx */ +#define _PPC_HID4_LG_PG_EN _LL(0x0000000000000004) /* disable large page support */ +#define _PPC_HID4_LPID0 _LL(0x0000000000000002) /* LPID 0 */ +#define _PPC_HID4_LPID1 _LL(0x0000000000000001) /* LPID 1 */ +#define _PPC_HID4_LPID2 _LL(0x1000000000000000) /* LPID 2 */ +#define _PPC_HID4_LPID3 _LL(0x0800000000000000) /* LPID 3 */ +#define _PPC_HID4_LPID4 _LL(0x0400000000000000) /* LPID 4 */ +#define _PPC_HID4_LPID5 _LL(0x0200000000000000) /* LPID 5 */ + + +/* HID5 bit definitions */ + +#define _PPC_HID5_HRMOR _LL(0x00000000FFFF0000) /* mask for real mode offset register */ +#define _PPC_HID5_DC_MCK _LL(0x0000000000002000) /* machine check enable for tag parity err */ +#define _PPC_HID5_DISPWRSAV _LL(0x0000000000001000) /* disable power savings */ +#define _PPC_HID5_FORCE_G _LL(0x0000000000000800) /* force guarded load */ +#define _PPC_HID5_DC_REPL _LL(0x0000000000000400) /* data cache replacement (1=FIFO) */ +#define _PPC_HID5_HWR_STMS _LL(0x0000000000000200) /* number of HW prefetch streams 1:8, 0:4 */ +#define _PPC_HID5_DST_NOP _LL(0x0000000000000100) /* DST no-op'ed */ +#define _PPC_HID5_DCBZ_SZ _LL(0x0000000000000080) /* make DCB a 32 bit store */ +#define _PPC_HID5_DCBZ_ILL _LL(0x0000000000000040) /* DCB illegal */ +#define _PPC_HID5_TLB_MAP _LL(0x0000000000000020) /* TLB mapping 0:4-way, 1:direct */ +#define _PPC_HID5_LMQ_PORT _LL(0x0000000000000010) /* demand miss (LMQ to STS) */ +#define _PPC_HID5_LMQ_SIZE0 _LL(0x0000000000000008) /* Number of outstanding requests bit 0 */ +#define _PPC_HID5_DPFLOOD _LL(0x0000000000000004) /* data prefetch flood mode */ +#define _PPC_HID5_TCH_NOP _LL(0x0000000000000002) /* make tcbt and dcbtst act like nop */ +#define _PPC_HID5_LMQ_SIZE1 _LL(0x0000000000000001) /* Number of outstanding requests bit 1 */ + + + +/* for 64-bit implementations, registers bit positions are found in the high word */ +#ifdef _WRS_OS_64BIT +#define MODE_OFFS 32 /* 64-bit mode bit offset */ +#else /* _WRS_OS_64BIT */ +#define MODE_OFFS 0 /* 32-bit mode bit offset */ +#endif /* _WRS_OS_64BIT */ + +/* MSR bit definitions */ + +#undef _PPC_MSR_BIT_EE +#undef _PPC_MSR_BIT_PR +#undef _PPC_MSR_BIT_ME +#undef _PPC_MSR_BIT_LE + +#ifdef _WRS_OS_64BIT +#define _PPC_MSR_BIT_SF 0 /* MSR Sixty-Four bit mode */ +#define _PPC_MSR_BIT_ISF 2 /* MSR Exception Sixty-Four bit mode */ +#endif /* _WRS_OS_64BIT */ + +#define _PPC_MSR_BIT_POW (13+MODE_OFFS) /* MSR Power Management bit - POW */ +#define _PPC_MSR_BIT_EE (16+MODE_OFFS) /* MSR Ext. Intr. Enable bit - EE */ +#define _PPC_MSR_BIT_PR (17+MODE_OFFS) /* MSR Privilege Level bit - PR */ +#define _PPC_MSR_BIT_FP (18+MODE_OFFS) /* MSR Floating Point Avail. bit - FP */ +#define _PPC_MSR_BIT_ME (19+MODE_OFFS) /* MSR Machine Check Enable bit - ME */ +#define _PPC_MSR_BIT_FE0 (20+MODE_OFFS) /* MSR FP exception mode 0 bit - FE0 */ +#define _PPC_MSR_BIT_SE (21+MODE_OFFS) /* MSR Single Step Trace bit - SE */ +#define _PPC_MSR_BIT_BE (22+MODE_OFFS) /* MSR Branch Trace Enable bit - BE */ +#define _PPC_MSR_BIT_FE1 (23+MODE_OFFS) /* MSR FP exception mode 1 bit - FE1 */ +#define _PPC_MSR_BIT_IP (25+MODE_OFFS) /* MSR Exception Prefix bit - EP */ +#define _PPC_MSR_BIT_IR (26+MODE_OFFS) /* MSR Inst Translation bit - IR */ +#define _PPC_MSR_BIT_DR (27+MODE_OFFS) /* MSR Data Translation bit - DR */ +#define _PPC_MSR_BIT_RI (30+MODE_OFFS) /* MSR Exception Recoverable bit - RI */ + +#ifdef _WRS_ALTIVEC_SUPPORT +#define _PPC_MSR_VEC 0x0200 /* Bit 6 of MSR */ +#define _PPC_MSR_BIT_VEC (6+MODE_OFFS) /* MSR Altivec Available bit - VEC */ +#endif + + +/* MSR MMU Bit extraction macros */ + +#define _PPC_MSR_MMU_EXTRACT(src, dst) \ + rlwinm dst, src, 0, _PPC_MSR_BIT_IR, _PPC_MSR_BIT_DR + +/* PPC970 specific exceptions */ + +/* + * the PERF excExtConnectCode stub (extended vector) won't fit at the + * default location 0xf00 because _EXC_ALTIVEC_UNAVAILABLE is at 0x0f20, + * so we need to put them where we've got some available space and jump + * to it from _EXC_OFF_PERF. The stub being 22 long words max currently + * (including 4xx critical exception and extended vectors), 0x0f80 - 0x0f20 + * = 0x60 = 96 >= 88 = 22 * 4 has enough room for _EXC_ALTIVEC_UNAVAILABLE. + */ +#define _EXC_OFF_PERF 0x0f00 /* performance monitoring intr*/ +#define _EXC_NEW_OFF_PERF 0x0f80 /* relocated perf monitor */ + +/* + * IABR bit definitions + * + * The 970's IABR is accessible only via JTAG or the "support processor". + */ + +/* set and get address in IABR */ + +#ifdef _WRS_OS_64BIT +#define _PPC_IABR_ADD(x) ((x) & _LL(0xFFFFFFFFFFFFFFFC)) +#else /* _WRS_OS_64BIT */ +#define _PPC_IABR_ADD(x) ((x) & 0xFFFFFFFC) +#endif /* _WRS_OS_64BIT */ + +#define _PPC_IABR_BE 0x00000002 /* breakpoint enabled */ +#define _PPC_IABR_TE 0x00000001 /* translation enabled */ + +/* DABR and DABRX bits definition */ + +/* set and get address in DABR/DBRX */ + +#ifdef _WRS_OS_64BIT +#define _PPC_DABR_DAB(x) ((x) & _LL(0xFFFFFFFFFFFFFFF8)) +#else /* _WRS_OS_64BIT */ +#define _PPC_DABR_DAB(x) ((x) & 0xFFFFFFF8) +#endif /* _WRS_OS_64BIT */ + +#define _PPC_DABR_BT 0x00000004 /* breakpoint translation */ +#define _PPC_DABR_DW 0x00000002 /* data write enable */ +#define _PPC_DABR_DR 0x00000001 /* data read enable */ + +/* mask for read and write operations */ + +#define _PPC_DABR_D_MSK (_PPC_DABR_DW | _PPC_DABR_DR) + +/* DSISR bits definition */ + +#define _PPC_DSISR_BRK 0x00400000 /* DABR match occurs */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCppc970h */ diff --git a/h/arch/ppc/private/excArchLibP.h b/h/arch/ppc/private/excArchLibP.h new file mode 100644 index 0000000..637ad10 --- /dev/null +++ b/h/arch/ppc/private/excArchLibP.h @@ -0,0 +1,171 @@ +/* excArchLibP.h - PowerPC exception library private exports */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* Definitions for use only by PPC excArchLib.c and syscallArchLib.c */ + +/* +modification history +-------------------- +01d,22sep04,pch Add debug/trace capabilities (under #ifdef) +01c,06aug04,pch SPR's 78780 & 100398: support use of standard exception + vectors in MMU and syscall +01b,05may04,pch SPR 92997: use correct symbol name in multiple-include + protection +01a,08Dec03,pch extracted from excArchLib.c vn 02z +*/ + +#ifndef __INCexcArchLibPh +#define __INCexcArchLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* + * The following typedefs are used within excArchLib.c in the interest + * of clarity, to keep from making matters worse than they already are. + * (Several existing published API's are defined with types that are just + * plain wrong for the PowerPC port, however, we are stuck with them.) + */ +typedef UINT32 vecTblOffset; /* Offset in vector table, e.g. _EXC_OFF_* */ +typedef char * codeBase; /* Base address in normal code space */ +typedef char * vectorBase; /* Base address in vector execution space */ +typedef char * codePtr; /* Pointer into normal code space */ +typedef char * vectorPtr; /* Pointer into vector execution space */ + +/* + * Convert a (vectorPtr) into a (codePtr), allowing for any difference + * between excVecBase and excVecBaseAltAdrs. The distinction is critical + * during initialization, when vector execution space may not be accessible + * because the MMU has not yet been set up. + */ +#define CODE_PTR_FROM_VECTOR_PTR(vecp) \ + (codePtr)((((vectorPtr)(vecp)) - excVecBase) + excVecBaseAltAdrs) + +#endif /* _ASMLANGUAGE */ + +/* + * Word offsets to the branch instructions in + * the exc*ConnectCode arrays in excArchLib.c + * + * Changes affecting ENT_OFF or ENT_CRT_OFF will require corresponding + * changes in excALib.s:excEnt() and excCrtEnt() when calculating the + * original vector address from the LR value. + */ + +#ifdef _EXC_OFF_CRTL + +# define ENT_OFF 6 /* offset for intEnt/excEnt */ +# define ISR_OFF 9 /* offset for ISR or exc. handler */ +# define EXIT_OFF 11 /* offset for intExit/excExit */ +# define EXT_ENT_OFF 7 /* offset for ext intEnt/excEnt */ +# define EXT_ISR_OFF 12 /* offset for ext ISR or exc handler */ +# define EXT_EXIT_OFF 19 /* offset for ext intExit/excExit */ +# define EXT_ENT_CRT_OFF 3 /* offset for ext intEnt/excEnt */ +# define EXT_ISR_CRT_OFF 8 /* offset for ext ISR or exc handler */ +# define EXT_EXIT_CRT_OFF 15 /* offset for ext intExit/excExit */ +# define ENT_CRT_OFF 2 /* offset for intEnt/excEnt */ +# define ISR_CRT_OFF 5 /* offset for ISR or exc. handler */ +# define EXIT_CRT_OFF 7 /* offset for intCrtExit/excCrtExit */ + +# ifdef LOG_FRAMELESS +/* + * Logging of "frameless nesting" occurences, used only for testing purposes. + * + * Each log record consists of one word, with the record type (exit case) in + * the most-significant byte and the interrupted vector offset in the least- + * significant halfword. The round-robin log buffer pointer, and the counts + * for the three record types, are stored at addresses 0x80-0x8f. + * + * CRT_COUNT_061C is used when TRAP_DISPATCH_ADDR is also set, for debugging. + */ + +/* offsets from address zero */ +#define LOG_FML_PTR 0x80 /* where to store next log record */ +#define RIV_COUNT 0x84 /* count of resume-in-vector cases */ +#define ESF_COUNT 0x88 /* count of copy-ESF cases */ +#define STM_COUNT 0x8c /* count of syscall/TLB-miss cases */ +#define CRT_COUNT_ENT 0x90 /* count of all critical interrupt entries */ +#define CRT_COUNT_EXIT 0x94 /* count of all critical interrupt exits */ +#define CRT_COUNT_RESC 0x98 /* calls of reschedule from intCrtExit */ +#define CRT_COUNT_061C 0x9c /* dispatches of PC==0x061C in windALib */ +#define CRT_COUNT_RESV 0xa0 /* reserved for future use */ + +/* log record types */ +#define RIV_TYPE 0x5000 /* resume-in-vector */ +#define ESF_TYPE 0x6000 /* copy-ESF */ +#define STM_TYPE 0x7000 /* syscall/TLB-miss */ + +/* size of log record in bytes */ +#define LOG_FML_SIZE 4 + +/* size of log buffer in bytes, must be a power of 2 */ +#define LOG_FML_BUF_SIZE 0x1000 + +/* bit number corresponding to buffer size, used to wrap log pointer */ +#define LOG_FML_BIT 19 +# endif /* LOG_FRAMELESS */ + +#else /* _EXC_OFF_CRTL */ + +# define ENT_OFF 2 /* offset for intEnt/excEnt */ +# define ISR_OFF 5 /* offset for ISR or exc. handler */ +# define EXIT_OFF 7 /* offset for intExit/excExit */ +# define EXT_ENT_OFF 3 /* offset for ext intEnt/excEnt */ +# define EXT_ISR_OFF 8 /* offset for ext ISR or exc handler */ +# define EXT_EXIT_OFF 15 /* offset for ext intExit/excExit */ +#endif /* _EXC_OFF_CRTL */ + +#ifdef LOG_DISPATCH +/* logging of dispatch (rfi/rfci) operations, used only for debugging */ + +/* offsets from address zero */ +#define LOG_DISP_PTR 0xec /* where to store next log record */ +#define LOG_DISP_SAVE 0xe8 /* last LOG_DISP_PTR when logging suspended */ + +/* offsets in log record */ +#define LOG_DISP_ID 0x00 /* record type = dispatcher ID */ +#define LOG_DISP_LR 0x04 /* LR value (who called dispatcher) */ +#define LOG_DISP_SP_IN 0x08 /* SP value when dispatcher called */ +#define LOG_DISP_CTX 0x0c /* address context loaded from */ +#define LOG_DISP_PC 0x10 /* PC value to be loaded */ +#define LOG_DISP_MSR 0x14 /* MSR value to be loaded */ +#define LOG_DISP_SP_OUT 0x18 /* SP value to be loaded */ +#define LOG_DISP_NXT_FL 0x1c /* current value of LOG_FML_PTR */ + +/* size of log record in bytes */ +#define LOG_DISP_SIZE 32 + +/* size of log buffer in bytes, must be a power of 2 */ +#define LOG_DISP_BUF_SIZE 0x2000 + +/* bit number corresponding to buffer size, used to wrap log pointer */ +#define LOG_DISP_BIT 18 + +/* log record types */ +#define DISP_WIND 0x01 /* windLoadContext */ +#define DISP_CTXL 0x02 /* _sigCtxLoad */ +#define DISP_EXCN 0x03 /* excExit */ +#define DISP_EXCC 0x04 /* excCrtExit */ +#define DISP_INTN 0x05 /* intExit, normal case */ +#define DISP_INTP 0x06 /* intExit, preempting (reschedule) */ +#define DISP_INTI 0x07 /* intExit, idle case */ +#define DISP_INTC 0x08 /* intCrtExit, normal case */ +#define DISP_INCR 0x09 /* intCrtExit, frameless RIV case */ +#define DISP_INCI 0x0a /* intCrtExit, idle case */ +#define DISP_INCP 0x0b /* intCrtExit, preempting (reschedule) */ +#define DISP_INCF 0x0c /* intCrtExit, frameless preempting (copyESF) */ +#define DISP_DTLB 0x0d /* data TLB miss handled */ +#define DISP_ITLB 0x0e /* insn TLB miss handled */ +#define DISP_RTPI 0x0f /* rtpUserModeSwitch */ +#define DISP_SYSC 0x10 /* resume after syscall */ +#endif /* LOG_DISPATCH */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCexcArchLibPh */ diff --git a/h/arch/ppc/regsPpc.h b/h/arch/ppc/regsPpc.h new file mode 100644 index 0000000..7ae5f99 --- /dev/null +++ b/h/arch/ppc/regsPpc.h @@ -0,0 +1,209 @@ +/* regsPpc.h - PowerPC registers */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01j,12feb04,jtp Apply _WRS_MMU_CLASS_* macros. +01i,15jan04,jtp SPR 93230 - make PPC32 REG_SET struct size match other PPC. +01h,01dec03,jtp Add PPC440 ASID storage; size & offset cleanup +01g,13nov03,pcs Make the size of REG_SET the same for all CPU variants. +01f,09oct03,pcs Add context information to the REG_SET. +01f,03oct02,dtr Adding speFpscr to standard register set for 85XX. +01e,30dec97,dbt added common names for registers +01d,20apr95,yao add padding word for PPC604 and PPC603. +01c,02mar95,yao changed PPC403GA to PPC403. +01b,07nov94,yao moved tool related definition to tools.h. +xxxxxxxxxxx,yao written. +*/ + +#ifndef __INCregsPpch +#define __INCregsPpch + +#ifdef __cplusplus +extern "C" { +#endif + +#define GREG_NUM 32 /* has 32 32/64-bit data registers */ + +#ifndef _ASMLANGUAGE + +typedef struct /* REG_SET */ + { + _RType gpr[GREG_NUM]; /* general pourpose registers */ + _RType msr; /* machine state register */ + _RType lr; /* link register */ + _RType ctr; /* count register */ + _RType pc; /* program counter */ + UINT32 cr; /* condition register */ + UINT32 xer; /* fixed-point exception register */ +#if (CPU==PPC601) + UINT32 mq; /* MQ register */ +#else + UINT32 pgTblPtr; /* base of page table */ +#endif /* (CPU==PPC601) */ +#if defined(_WRS_MMU_CLASS_SR_REGS) + UINT32 scSrTblPtr; /* SR regs array ptr - kernel protection map */ + UINT32 srTblPtr; /* SR regs array ptr - user protection map */ +#elif defined(_WRS_MMU_CLASS_PID_REG) + UINT32 casid; /* PPC405, Book E PID and PPC860 M_CASID */ +# if (CPU == PPC85XX) + UINT32 spefscr; /* SPE floating-point status & ctrl reg */ +# else /* CPU == PPC85XX */ + UINT32 spare1; /* keeps struct size consistent */ +# endif /* CPU == PPC85XX */ +#else /* _WRS_MMU_CLASS_ */ + UINT32 spare0; /* keeps struct size consistent */ + UINT32 spare1; /* keeps struct size consistent */ +#endif /* _WRS_MMU_CLASS_* */ + } REG_SET; + +/* some common names for registers */ + +#undef spReg +#define spReg gpr[1] /* stack pointer */ +#undef fpReg +#define fpReg gpr[31] /* frame pointer */ +#define reg_pc pc /* program counter */ +#define reg_sp spReg /* stack pointer */ +#define reg_fp fpReg /* frame pointer */ + +#endif /* _ASMLANGUAGE */ + + +#define PPC_ARG0_REG 3 /* params start at register 3 */ +#define PPC_MAX_ARG_REGS 8 /* max # of params passed in register */ + +#define REG_SET_GRBASE 0x00 /* general purpouse register base */ +#define REG_SET_GR(n) (REG_SET_GRBASE + _PPC_REG_SIZE*(n)) +#define REG_SET_MSR (REG_SET_GR(GREG_NUM)) +#define REG_SET_LR (REG_SET_MSR + _PPC_REG_SIZE) +#define REG_SET_CTR (REG_SET_LR + _PPC_REG_SIZE) +#define REG_SET_PC (REG_SET_CTR + _PPC_REG_SIZE) +#define REG_SET_CR (REG_SET_PC + _PPC_REG_SIZE) +#define REG_SET_XER (REG_SET_CR + 4) + +#if (CPU==PPC601) +#define REG_SET_MQ (REG_SET_XER + 4) +#else /* (CPU==PPC601) */ +#define REG_SET_PG_TBL_PTR (REG_SET_XER + 4) /* ptr to pgTbl */ +#endif /* (CPU==PPC601) */ + +#if defined(_WRS_MMU_CLASS_SR_REGS) +#define REG_SET_SC_SR_TBL_PTR (REG_SET_PG_TBL_PTR + 4) +#define REG_SET_SR_TBL_PTR (REG_SET_SC_SR_TBL_PTR + 4) +#elif defined(_WRS_MMU_CLASS_PID_REG) +#define REG_SET_CASID (REG_SET_PG_TBL_PTR + 4) /* current ASID */ +#if (CPU == PPC85XX) +#define REG_SET_SPEFSCR (REG_SET_CASID + 4) +#endif /* CPU == PPC85XX */ +#endif /* _WRS_MMU_CLASS_* */ + +#define PC_OFFSET REG_SET_PC + +#define WIND_TCB_R0 (WIND_TCB_REGS + REG_SET_GR(0)) +#define WIND_TCB_R1 (WIND_TCB_REGS + REG_SET_GR(1)) +#define WIND_TCB_R2 (WIND_TCB_REGS + REG_SET_GR(2)) +#define WIND_TCB_R3 (WIND_TCB_REGS + REG_SET_GR(3)) +#define WIND_TCB_R4 (WIND_TCB_REGS + REG_SET_GR(4)) +#define WIND_TCB_R5 (WIND_TCB_REGS + REG_SET_GR(5)) +#define WIND_TCB_R6 (WIND_TCB_REGS + REG_SET_GR(6)) +#define WIND_TCB_R7 (WIND_TCB_REGS + REG_SET_GR(7)) +#define WIND_TCB_R8 (WIND_TCB_REGS + REG_SET_GR(8)) +#define WIND_TCB_R9 (WIND_TCB_REGS + REG_SET_GR(9)) +#define WIND_TCB_R10 (WIND_TCB_REGS + REG_SET_GR(10)) +#define WIND_TCB_R11 (WIND_TCB_REGS + REG_SET_GR(11)) +#define WIND_TCB_R12 (WIND_TCB_REGS + REG_SET_GR(12)) +#define WIND_TCB_R13 (WIND_TCB_REGS + REG_SET_GR(13)) +#define WIND_TCB_R14 (WIND_TCB_REGS + REG_SET_GR(14)) +#define WIND_TCB_R15 (WIND_TCB_REGS + REG_SET_GR(15)) +#define WIND_TCB_R16 (WIND_TCB_REGS + REG_SET_GR(16)) +#define WIND_TCB_R17 (WIND_TCB_REGS + REG_SET_GR(17)) +#define WIND_TCB_R18 (WIND_TCB_REGS + REG_SET_GR(18)) +#define WIND_TCB_R19 (WIND_TCB_REGS + REG_SET_GR(19)) +#define WIND_TCB_R20 (WIND_TCB_REGS + REG_SET_GR(20)) +#define WIND_TCB_R21 (WIND_TCB_REGS + REG_SET_GR(21)) +#define WIND_TCB_R22 (WIND_TCB_REGS + REG_SET_GR(22)) +#define WIND_TCB_R23 (WIND_TCB_REGS + REG_SET_GR(23)) +#define WIND_TCB_R24 (WIND_TCB_REGS + REG_SET_GR(24)) +#define WIND_TCB_R25 (WIND_TCB_REGS + REG_SET_GR(25)) +#define WIND_TCB_R26 (WIND_TCB_REGS + REG_SET_GR(26)) +#define WIND_TCB_R27 (WIND_TCB_REGS + REG_SET_GR(27)) +#define WIND_TCB_R28 (WIND_TCB_REGS + REG_SET_GR(28)) +#define WIND_TCB_R29 (WIND_TCB_REGS + REG_SET_GR(29)) +#define WIND_TCB_R30 (WIND_TCB_REGS + REG_SET_GR(30)) +#define WIND_TCB_R31 (WIND_TCB_REGS + REG_SET_GR(31)) +#define WIND_TCB_MSR (WIND_TCB_REGS + REG_SET_MSR) +#define WIND_TCB_LR (WIND_TCB_REGS + REG_SET_LR) +#define WIND_TCB_CTR (WIND_TCB_REGS + REG_SET_CTR) +#define WIND_TCB_PC (WIND_TCB_REGS + REG_SET_PC) +#define WIND_TCB_CR (WIND_TCB_REGS + REG_SET_CR) +#define WIND_TCB_XER (WIND_TCB_REGS + REG_SET_XER) +#if (CPU==PPC601) +#define WIND_TCB_MQ (WIND_TCB_REGS + REG_SET_MQ) +#else /* (CPU==PPC601) */ +#define WIND_TCB_PG_TBL_PTR (WIND_TCB_REGS + REG_SET_PG_TBL_PTR) +#endif /* (CPU==PPC601) */ + +#if defined(_WRS_MMU_CLASS_SR_REGS) +#define WIND_TCB_SC_SR_TBL_PTR (WIND_TCB_REGS + REG_SET_SC_SR_TBL_PTR) +#define WIND_TCB_SR_TBL_PTR (WIND_TCB_REGS + REG_SET_SR_TBL_PTR) +#elif defined(_WRS_MMU_CLASS_PID_REG) +#define WIND_TCB_CASID (WIND_TCB_REGS + REG_SET_CASID) +#if (CPU == PPC85XX) +#define WIND_TCB_SPEFSCR (WIND_TCB_REGS + REG_SET_SPEFSCR) +#endif /* CPU == PPC85XX */ +#endif /* _WRS_MMU_CLASS_* */ + +#define WIND_TCB_SP WIND_TCB_R1 +#define WIND_TCB_P0 WIND_TCB_R3 +#define WIND_TCB_P1 WIND_TCB_R4 +#define WIND_TCB_P2 WIND_TCB_R5 +#define WIND_TCB_P3 WIND_TCB_R6 +#define WIND_TCB_P4 WIND_TCB_R7 +#define WIND_TCB_P5 WIND_TCB_R8 +#define WIND_TCB_P6 WIND_TCB_R9 +#define WIND_TCB_P7 WIND_TCB_R10 + +#define WIND_TCB_T0 WIND_TCB_R14 +#define WIND_TCB_T1 WIND_TCB_R15 +#define WIND_TCB_T2 WIND_TCB_R16 +#define WIND_TCB_T3 WIND_TCB_R17 +#define WIND_TCB_T4 WIND_TCB_R18 +#define WIND_TCB_T5 WIND_TCB_R19 +#define WIND_TCB_T6 WIND_TCB_R20 +#define WIND_TCB_T7 WIND_TCB_R21 +#define WIND_TCB_T8 WIND_TCB_R22 +#define WIND_TCB_T9 WIND_TCB_R23 +#define WIND_TCB_T10 WIND_TCB_R24 +#define WIND_TCB_T11 WIND_TCB_R25 +#define WIND_TCB_T12 WIND_TCB_R26 +#define WIND_TCB_T13 WIND_TCB_R27 +#define WIND_TCB_T14 WIND_TCB_R28 +#define WIND_TCB_T15 WIND_TCB_R29 +#define WIND_TCB_T16 WIND_TCB_R30 +#define WIND_TCB_T17 WIND_TCB_R31 + +#ifdef _AIX_TOOL +#define WIND_TCB_RTOC WIND_TCB_R2 +#endif /* _AIX_TOOL */ + +/* size of the full REG_SET structure, including spare bytes */ + +#define _PPC_REG_SET_SIZE (_PPC_REG_SIZE * (GREG_NUM + 9)) + +#if (CPU == PPC860) + +/* Last valid number for the ASID register on the 8xx family */ + +#define LAST_ASID 15 + +#elif ((CPU == PPC405) || (CPU == PPC440) || (CPU == PPC85XX)) +#define LAST_ASID 255 +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCregsPpch */ diff --git a/h/arch/ppc/sigPpcCodes.h b/h/arch/ppc/sigPpcCodes.h new file mode 100644 index 0000000..889f480 --- /dev/null +++ b/h/arch/ppc/sigPpcCodes.h @@ -0,0 +1,23 @@ +/* sigPpcCodes.h - PowerPC codes sent to signal handlers */ + +/* Copyright 1984-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +*/ + +#ifndef __INCsigPpcCodesh +#define __INCsigPpcCodesh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "iv.h" + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsigPpcCodesh */ diff --git a/h/arch/ppc/spePpcLib.h b/h/arch/ppc/spePpcLib.h new file mode 100644 index 0000000..1a9c14e --- /dev/null +++ b/h/arch/ppc/spePpcLib.h @@ -0,0 +1,78 @@ +/* spePpcLib.h - PowerPC E500 sipgnal processing engine support library + * header + */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01b,03oct02,dtr Removing _PPC_MSR_SPE from here adding to ppc85xx.h. +01a,02sep02,dtr Created. +*/ + +#ifndef __INCspePpcLibh +#define __INCspePpcLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +#define SPE_OFFSET(x) (4*x) +#define ACC_SIZE 2 /* UINT32 */ +#define SPE_NUM_REGS 32 + +#ifndef _ASMLANGUAGE + +/* This structure should be aligned to the size of a cache block */ +typedef struct /* SPE_REG_SET */ + { + UINT32 gpr[SPE_NUM_REGS]; /* general pourpose registers */ + UINT32 acc[ACC_SIZE]; + } SPE_CONTEXT; + +#define SPEREG_SET SPE_CONTEXT + +extern void speSave (SPE_CONTEXT *spePtr); +extern void speRestore (SPE_CONTEXT *spePtr); + + +#define SPE_CONTEXT_GET(pTcb) (SPE_CONTEXT *)(pTcb->pCoprocCtx) +#define SPE_CONTEXT_SET(pTcb,X) (pTcb->pCoprocCtx=(int)(X)) + +/* variable declarations */ +#if 0 +extern REG_INDEX speRegName[]; /* spe data register table */ +extern REG_INDEX speCtlRegName[]; /* spe control register table */ +#endif + +extern WIND_TCB *pSpeTaskIdPrevious; /* task id for deferred exceptions */ +extern FUNCPTR speCreateHookRtn; /* arch dependent create hook routine */ +extern FUNCPTR speDisplayHookRtn; /* arch dependent display routine */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT void speArchInit (void); +IMPORT void speArchTaskCreateInit (SPE_CONTEXT *pFpContext); + +#else /* __STDC__ */ + +IMPORT void speArchInit (); +IMPORT void speArchTaskCreateInit (); + +#endif /* __STDC__ */ + + +#endif /* _ASMLANGUAGE */ + +/* define offsets in SPE_CONTEXT structure */ + + + +#ifdef __cplusplus +} +#endif + +#endif /* INCspePpcLibh */ diff --git a/h/arch/ppc/syscallArgsppc.h b/h/arch/ppc/syscallArgsppc.h new file mode 100644 index 0000000..7c13196 --- /dev/null +++ b/h/arch/ppc/syscallArgsppc.h @@ -0,0 +1,757 @@ +/* Aligned for ppc - align 64-bit elements */ + + +/* THIS FILE IS AUTO_GENERATED. PLEASE DO NOT EDIT. */ + +#ifndef _ASMLANGUAGE + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct _exitScArgs + { + int status; + }; + +struct creatScArgs + { + const char * name; + mode_t flag; + }; + +struct _openScArgs + { + const char * name; + int flags; + int mode; + }; + +struct closeScArgs + { + int fd; + }; + +struct readScArgs + { + int fd; + void * buffer; + size_t maxbytes; + }; + +struct writeScArgs + { + int fd; + const void * buffer; + size_t nbytes; + }; + +struct _ioctlScArgs + { + int fd; + int function; + int arg; + }; + +struct dupScArgs + { + int fd; + }; + +struct dup2ScArgs + { + int fd; + int fd2; + }; + +struct pipeScArgs + { + int filedes[2]; + }; + +struct removeScArgs + { + const char * name; + }; + +struct selectScArgs + { + int width; + fd_set * readFds; + fd_set * writeFds; + fd_set * excFds; + struct timeval * timeout; + }; + +struct socketScArgs + { + int domain; + int type; + int protocol; + }; + +struct bindScArgs + { + int s; + struct sockaddr * name; + int namelen; + }; + +struct listenScArgs + { + int s; + int backlog; + }; + +struct acceptScArgs + { + int s; + struct sockaddr * addr; + int *addrlen; + }; + +struct connectScArgs + { + int s; + struct sockaddr * name; + int namelen; + }; + +struct sendtoScArgs + { + int s; + caddr_t buf; + int bufLen; + int flags; + struct sockaddr * to; + int tolen; + }; + +struct sendScArgs + { + int s; + const char * buf; + int bufLen; + int flags; + }; + +struct sendmsgScArgs + { + int s; + struct msghdr * mp; + int flags; + }; + +struct recvfromScArgs + { + int s; + char * buf; + int bufLen; + int flags; + struct sockaddr *from; + int * pFromLen; + }; + +struct recvScArgs + { + int s; + char * buf; + int bufLen; + int flags; + }; + +struct recvmsgScArgs + { + int s; + struct msghdr * mp; + int flags; + }; + +struct setsockoptScArgs + { + int s; + int level; + int optname; + char * optval; + int optlen; + }; + +struct getsockoptScArgs + { + int s; + int level; + int optname; + char * optval; + int * optlen; + }; + +struct getsocknameScArgs + { + int s; + struct sockaddr *name; + int * namelen; + }; + +struct getpeernameScArgs + { + int s; + struct sockaddr *name; + int *namelen; + }; + +struct shutdownScArgs + { + int s; + int how; + }; + +struct mmapScArgs + { + void * addr; + size_t len; + int prot; + int flags; + int fildes; + int offPad; + off_t64 off; + }; + +struct munmapScArgs + { + void * addr; + size_t len; + }; + +struct mprotectScArgs + { + void * addr; + size_t len; + int prot; + }; + +struct killScArgs + { + OBJ_HANDLE rtpId; + int signo; + }; + +struct sigpendingScArgs + { + sigset_t * pSet; + }; + +struct sigprocmaskScArgs + { + int how; + const sigset_t * pSet; + sigset_t * pOset; + }; + +struct _sigqueueScArgs + { + OBJ_HANDLE rtpId; + int signo; + const union sigval * pValue; + int sigCode; + }; + +struct sigsuspendScArgs + { + const sigset_t * pSet; + }; + +struct sigtimedwaitScArgs + { + const sigset_t * pSet; + struct siginfo * pInfo; + const struct timespec * pTime; + }; + +struct _sigactionScArgs + { + int signo; + const struct sigaction * pAct; + struct sigaction * pOact; + void * retAddr; + }; + +struct chdirScArgs + { + const char * name; + }; + +struct _getcwdScArgs + { + char * buffer; + int length; + }; + +struct waitpidScArgs + { + OBJ_HANDLE childRtpId; + int * pStatus; + int options; + }; + +struct sysctlScArgs + { + int *pName; + u_int nameLen; + void * pOld; + size_t * pOldLen; + void * pNew; + size_t newLen; + }; + +struct _schedPxInfoGetScArgs + { + BOOL * pTimeSlicingOn; + ULONG * pTimeSlicePeriod; + }; + +struct sigaltstackScArgs + { + stack_t * ss; + stack_t * oss; + }; + +struct unlinkScArgs + { + const char * name; + }; + +struct linkScArgs + { + const char * name; + const char * newname; + }; + +struct fsyncScArgs + { + int fd; + }; + +struct fdatasyncScArgs + { + int fd; + }; + +struct renameScArgs + { + const char * oldname; + const char * newname; + }; + +struct fpathconfScArgs + { + int fd; + int name; + }; + +struct pathconfScArgs + { + const char * path; + int name; + }; + +struct accessScArgs + { + const char * path; + int amode; + }; + +struct chmodScArgs + { + const char * path; + mode_t mode; + }; + +struct eventReceiveScArgs + { + UINT32 events; + UINT32 options; + int timeout; + UINT32 * pEvtsReceived; + }; + +struct eventSendScArgs + { + int taskId; + UINT32 events; + }; + +struct eventCtlScArgs + { + OBJ_HANDLE handle; + VX_EVT_CTL_CMD command; + void * pArg; + UINT * pArgSize; + }; + +struct msgQSendScArgs + { + OBJ_HANDLE handle; + char * buffer; + UINT nBytes; + int timeout; + int priority; + }; + +struct msgQReceiveScArgs + { + OBJ_HANDLE handle; + char * buffer; + UINT maxNBytes; + int timeout; + }; + +struct _msgQOpenScArgs + { + const char * name; + UINT maxMsgs; + UINT maxMsgLength; + int options; + int mode; + void * context; + }; + +struct objDeleteScArgs + { + OBJ_HANDLE handle; + int options; + }; + +struct objInfoGetScArgs + { + OBJ_HANDLE handle; + void * pInfo; + UINT * pInfoSize; + int level; + }; + +struct _semTakeScArgs + { + OBJ_HANDLE handle; + int timeout; + }; + +struct _semGiveScArgs + { + OBJ_HANDLE handle; + }; + +struct _semOpenScArgs + { + const char * name; + SEM_TYPE type; + int initState; + int options; + int mode; + void * context; + }; + +struct semCtlScArgs + { + OBJ_HANDLE handle; + VX_SEM_CTL_CMD command; + void * pArg; + UINT * pArgSize; + }; + +struct _taskOpenScArgs + { + struct vx_task_open_sc_args * pArgs; + }; + +struct taskCtlScArgs + { + int tid; + VX_TASK_CTL_CMD command; + void * pArg; + UINT * pArgSize; + }; + +struct taskDelayScArgs + { + int ticks; + }; + +struct rtpSpawnScArgs + { + const char * rtpFileName; + const char ** argv; + const char ** envp; + int priority; + int uStackSize; + int options; + int taskOptions; + }; + +struct rtpInfoGetScArgs + { + OBJ_HANDLE rtpId; + RTP_DESC * rtpStruct; + }; + +struct taskKillScArgs + { + OBJ_HANDLE taskHandle; + int signo; + }; + +struct _taskSigqueueScArgs + { + OBJ_HANDLE taskHandle; + int signo; + const union sigval * pValue; + int sigCode; + }; + +struct _timer_openScArgs + { + const char * name; + int mode; + clockid_t clockId; + struct sigevent * evp; + void * context; + }; + +struct timerCtlScArgs + { + TIMER_CTL_CMD cmdCode; + int handle; + void * pArgs; + UINT * pArgSize; + }; + +struct pxOpenScArgs + { + PX_OBJ_TYPE type; + const char * name; + int objOpenMode; + void * attr; + }; + +struct pxCloseScArgs + { + OBJ_HANDLE handle; + }; + +struct pxUnlinkScArgs + { + PX_OBJ_TYPE type; + const char * name; + }; + +struct pxCtlScArgs + { + OBJ_HANDLE handle; + PX_CTL_CMD_CODE cmdCode; + void * pArgs; + UINT * pArgSize; + }; + +struct pxMqReceiveScArgs + { + OBJ_HANDLE handle; + char * pMsg; + size_t msgLen; + unsigned int * pMsgPrio; + PX_WAIT_OPTION waitOption; + struct timespec * time_out; + }; + +struct pxMqSendScArgs + { + OBJ_HANDLE handle; + const char * pMsg; + size_t msgLen; + unsigned int msgPrio; + PX_WAIT_OPTION waitOption; + struct timespec * time_out; + }; + +struct pxSemWaitScArgs + { + OBJ_HANDLE handle; + PX_WAIT_OPTION waitOption; + struct timespec * time_out; + }; + +struct pxSemPostScArgs + { + OBJ_HANDLE handle; + }; + +struct pipeDevCreateScArgs + { + const char * name; + int nMessages; + int nBytes; + }; + +struct pipeDevDeleteScArgs + { + const char * name; + BOOL force; + }; + +struct _sdCreateScArgs + { + char * name; + int options; + UINT32 size; + int physAddressPad; + off_t64 physAddress; + MMU_ATTR attr; + void ** pVirtAddress; + }; + +struct _sdOpenScArgs + { + char * name; + int options; + int mode; + UINT32 size; + off_t64 physAddress; + MMU_ATTR attr; + void ** pVirtAddress; + }; + +struct sdDeleteScArgs + { + OBJ_HANDLE handle; + int options; + }; + +struct sdMapScArgs + { + OBJ_HANDLE handle; + MMU_ATTR attr; + int options; + }; + +struct sdUnmapScArgs + { + OBJ_HANDLE handle; + int options; + }; + +struct sdProtectScArgs + { + OBJ_HANDLE handle; + MMU_ATTR attr; + }; + +struct _edrErrorInjectScArgs + { + int kind; + const char *fileName; + int lineNumber; + REG_SET *regset; + void *addr; + const char *msg; + }; + +struct resSearchNScArgs + { + const char * name; + struct res_target * target; + }; + +struct wvEventScArgs + { + int eventId; + const char * pData; + unsigned int dataSize; + }; + +struct rtpVarAddScArgs + { + void ** pVar; + void * value; + }; + +struct sdInfoGetScArgs + { + OBJ_HANDLE handle; + SD_DESC * pSdStruct; + }; + +struct _shlOpenScArgs + { + const char * name; + int options; + }; + +struct _shlUnlockScArgs + { + SHL_ID shlId; + }; + +struct _shlCloseScArgs + { + SHL_ID shlId; + }; + +struct _shlGetScArgs + { + SHL_ID shlId; + SHLINFO *pInfo; + }; + +struct _shlPutScArgs + { + SHL_ID shlId; + const SHLINFO *pInfo; + }; + +struct objUnlinkScArgs + { + const char * name; + enum windObjClassType classType; + }; + +struct getprlimitScArgs + { + int idtype; + OBJ_HANDLE handle; + int resource; + struct rlimit *rlp; + }; + +struct setprlimitScArgs + { + int idtype; + OBJ_HANDLE handle; + int resource; + struct rlimit *rlp; + }; + +struct _mctlScArgs + { + void * addr; + size_t len; + int function; + int arg; + }; + +#endif /* _ASMLANGUAGE */ diff --git a/h/arch/ppc/syscallPpc.h b/h/arch/ppc/syscallPpc.h new file mode 100644 index 0000000..5f36ef7 --- /dev/null +++ b/h/arch/ppc/syscallPpc.h @@ -0,0 +1,75 @@ +/* syscallPpc.h - PowerPC specific System Call Infrastructure header */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,04may04,yvp Renamed spare1 to srTable. +01b,06apr04,yvp SPR 95407: SYSCALL_ENTRY_FRAME_SIZE now made a multiple + of _STACK_ALIGN_SIZE. +01a,15sep03,yvp written. +*/ + +/* +DESCRIPTION +This header contains PowerPC-specific definitions and constants used by +the System Call Infrastructure library. + +*/ + +#ifndef __INCsyscallPpch +#define __INCsyscallPpch + +#ifdef __cplusplus +extern "C" { +#endif + +#define syscallDispatch_PORTABLE /* Use the portable dispatcher */ + + /* defines */ + +#define SYSCALL_ENTRY_FRAME_SIZE 96 + + /* PPC doesnt need a user-SP check since all params are in registers. */ + +#define _SYSCALL_USER_SP_CHECK(sp) + + /* typedefs */ + +#ifndef _ASMLANGUAGE + /* + * The SYSCALL_ENTRY_STATE structure defines the saved machine state + * when the system call trap is taken. This information is architecture + * specific, and is used by the system call dispatcher to restart system + * calls that have been interrupted by the occurance of signals. + * System call restart is achieved by restoring the saved state at the + * time of the system call trap, and re-issuing the system call. + * Arguments to the system call are saved on the kernel stack, and + * the address of that array is passed as an argument to the dispatcher. + * The layout of this structure must exactly match the ordering of members + * of the system call entry frame in src/arch/ppc/syscallALib.s. + */ + +typedef struct syscall_entry_state + { + int args[8]; /* argument list (r3-r10) */ + int scn; /* System Call Number (SCN) in r0 */ + void * pSdata; /* small data pointer (r13) */ + void * pSdata2; /* small data pointer 2 (r2) */ + void * pLR; /* saved link register value */ + int * pUStack; /* user-mode stack pointer */ + int statusReg; /* saved Machine Status Register (SRR1) */ + void * pc; /* Trap return address (SRR0) */ + int nonVolatileRegs[4]; /* saved non-volatile registers (r28-r31) */ + int pSrTable; /* Ptr to Segment Reg. Table (PPC60X only) */ + int spare1; + int spare2; + } SYSCALL_ENTRY_STATE; +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsyscallPpch */ diff --git a/h/arch/ppc/taskPpcLib.h b/h/arch/ppc/taskPpcLib.h new file mode 100644 index 0000000..b54de3f --- /dev/null +++ b/h/arch/ppc/taskPpcLib.h @@ -0,0 +1,20 @@ +/* taskPpcLib.h - generic kernel interface header */ + +/* +modification history +-------------------- +01a,02jun94,yao written. +*/ + +#ifndef __INCtaskPpcLibh +#define __INCtaskPpcLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtaskPpcLibh */ diff --git a/h/arch/ppc/toolPpc.h b/h/arch/ppc/toolPpc.h new file mode 100644 index 0000000..bd69463 --- /dev/null +++ b/h/arch/ppc/toolPpc.h @@ -0,0 +1,525 @@ +/* toolPpc.h - tool dependent headers */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +/* +modification history +-------------------- +02c,17aug05,pch Add _CPU_STACK_ALIGN_SHIFT +02b,18mar04,rec merge PPC970 T2 changes +02a,04oct04,mdo Documentation fixes for apigen +01z,08jul04,yvp Added _WRS_ARCH_USER_STACK_FRAME_EXTENSION. +01y,09jun04,pch add support for PPC440 with hard FP +01x,25feb04,pch PPC32 vn 2: All PPC now using 16-byte stack alignment +01w,08oct03,pch SPR 83570: Remove references to unsupported toolchain +01v,12dec02,pch Add generic PPC32 support +01u,08nov02,mil Added 16-byte stack alignment for PPC85XX. +01t,12nov01,yvp Reverted to 8-byte alignment for non-PPC604 processors. +01s,30oct01,sn removed Diab varargs +01r,25sep01,yvp define _WRS_TEXT_SEG_ALIGN macro. +01q,08may01,pch Add assembler abstractions (FUNC_EXPORT, FUNC_BEGIN, etc.) +01p,06apr01,max To make all memory allocations 16-byte aligned +01o,30mar01,pcs ADDED Altivec Register file set. +01n,22feb00,jgn add GTEXT & GDATA macros +01m,05may99,jgn make FRAMEBASESZ available for C code too +01l,22apr98,tam SPR 20438, removed #if TRUE,FALSE usage +01k,23dec97,dat SPR 20104, fixed LOADPTR, LOADVAR macros +01j,21may96,tpr added underscore in front of GNU_TOOL. +01i,22apr96,ms made GNU_TOOL the default +01h,29feb96,tpr removed #define _SDA2_BASE_ _SDA_BASE_ +01g,22jun95,caf updated Diab Data support. +01f,21jun95,caf updated Green Hills support. +01e,20apr95,yao defined _ALLOC_ALIGN_SIZE. +01d,21mar95,caf defined _STACK_ALIGN_SIZE. +01c,03feb95,caf cleanup. +01b,15nov94,caf changed name of file to toolPpc.h, added Green Hills support. +01a,25oct94,yao written. +*/ + +#ifndef __INCtoolPpch +#define __INCtoolPpch + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_DIAB_TOOL) && !defined(_GNU_TOOL) +#define _GNU_TOOL +#endif + +/* macros for stack frame */ + +/* +SVR4 Stack space allocation: + + Before Dynamic stack allocation + + +----------------------------------+ + | Back Chain | + |----------------------------------| + | Register save areas | + |----------------------------------| + | local,non-static variables | + |----------------------------------| + | parameter lists for callees | (overloaded parameters with #) + |----------------------------------| + | LR save word | + |----------------------------------| +SP=>| Back chain | + +----------------------------------+ + + After Dynamic stack allocation + + +----------------------------------+ + | Back Chain | + |----------------------------------| + | Register save areas | + |----------------------------------| + | local,non-static variables | + |----------------------------------| + | Dynamic Allocation Area | 16 byte stack alignment + |----------------------------------| + | parameter lists for callees | + |----------------------------------| + | LR save word | + |----------------------------------| +SP=>| Back chain | + +----------------------------------+ 16 bytes stack alignment +*/ + + /* Stack and Allocation alignment */ + +/* + * While it is possible to use different stack alignments for different + * PPC processors, current compilers use 16-byte alignment for all. + */ + +#define _CPU_STACK_ALIGN_SIZE 16 /* stack alignment (for all PPC) */ +#define _CPU_STACK_ALIGN_SHIFT 4 + +#if ((CPU == PPC604) || (CPU == PPC85XX) || (CPU == PPC970)) /* Altivec, E500 EABI */ +# define _CPU_ALLOC_ALIGN_SIZE 16 /* allocation alignment */ +#elif (CPU != PPC32) /* for others, !defined for generic */ +# define _CPU_ALLOC_ALIGN_SIZE 8 /* allocation alignment */ +#endif /* PPC604|PPC85XX|PPC970 : !PPC32 */ + +#define FRAMEBASESZ 16 /* minimum stack frame size */ + +/* +* +* _WRS_ARCH_USER_STACK_FRAME_EXTENSION - creating words on the stack for the +* back chain word and the LR register. +* +* This macro is used in creating the initial stack frame for an RTP's initial +* task. It performs the extra steps of creating words on the stack for the +* back chain word and the LR register. Both these locations are set to 0 to +* prevent stack traces and debuggers from looking ahead. +* +* NOMANUAL +*/ + +#define _WRS_ARCH_USER_STACK_FRAME_EXTENSION(sp) \ + do \ + { \ + (sp) -= 2*sizeof(int *); \ + *((int *)(sp)) = (int)0; \ + *((int *)((sp)+4)) = (int)0; \ + } while ((0)) + + +#ifdef _ASMLANGUAGE + +/* register definition */ + +/* volatile registers that are not saved across subroutine calls */ + +#define p0 r3 /* argument register, volatile */ +#define p1 r4 /* argument register, volatile */ +#define p2 r5 /* argument register, volatile */ +#define p3 r6 /* argument register, volatile */ +#define p4 r7 /* argument register, volatile */ +#define p5 r8 /* argument register, volatile */ +#define p6 r9 /* argument register, volatile */ +#define p7 r10 /* argument register, volatile */ +#define glr0 r0 /* prologs(PO,EABI), epilogs, glink routines(EABI) / + * language specific purpose(SVR4), volatile */ +#define glr1 r11 /* prologs, epilogs, as Pascal environment pointer(EABI) + * language specific purpose (SVR4) + * calls by pointer, as Pascal environment(PO), + * volatile */ +#define glr2 r12 /* prologs, epilogs, glink routines, calls by + * pointer(EABI), language specific purpose (SVR4), + * glue code, exception handling (PO), volatile */ +#define retval0 r3 /* return register 0, volatile */ +#define retval1 r4 /* return register 1, volatile */ + + +/* non-volatile and dedicated registers saved across subroutine calls */ + +#define sp r1 /* stack pointer, dedicated */ + +#define t0 r14 /* temporary registers, non-volatile */ +#define t1 r15 /* temporary registers, non-volatile */ +#define t2 r16 /* temporary registers, non-volatile */ +#define t3 r17 /* temporary registers, non-volatile */ +#define t4 r18 /* temporary registers, non-volatile */ +#define t5 r19 /* temporary registers, non-volatile */ +#define t6 r20 /* temporary registers, non-volatile */ +#define t7 r21 /* temporary registers, non-volatile */ +#define t8 r22 /* temporary registers, non-volatile */ +#define t9 r23 /* temporary registers, non-volatile */ +#define t10 r24 /* temporary registers, non-volatile */ +#define t11 r25 /* temporary registers, non-volatile */ +#define t12 r26 /* temporary registers, non-volatile */ +#define t13 r27 /* temporary registers, non-volatile */ +#define t14 r28 /* temporary registers, non-volatile */ +#define t15 r29 /* temporary registers, non-volatile */ +#define t16 r30 /* temporary registers, non-volatile */ +#define t17 r31 /* temporary registers, non-volatile */ + +#ifdef _GNU_TOOL + +/* GP register names */ + +#define r0 0 +#define r1 1 +#define r2 2 +#define r3 3 +#define r4 4 +#define r5 5 +#define r6 6 +#define r7 7 +#define r8 8 +#define r9 9 +#define r10 10 +#define r11 11 +#define r12 12 +#define r13 13 +#define r14 14 +#define r15 15 +#define r16 16 +#define r17 17 +#define r18 18 +#define r19 19 +#define r20 20 +#define r21 21 +#define r22 22 +#define r23 23 +#define r24 24 +#define r25 25 +#define r26 26 +#define r27 27 +#define r28 28 +#define r29 29 +#define r30 30 +#define r31 31 + +#ifdef _PPC_MSR_FP +/* FP register names */ + +#define fp0 0 +#define fr0 0 +#define f0 0 +#define fp1 1 +#define fr1 1 +#define f1 1 +#define fp2 2 +#define fr2 2 +#define f2 2 +#define fp3 3 +#define fr3 3 +#define f3 3 +#define fp4 4 +#define fr4 4 +#define f4 4 +#define fp5 5 +#define fr5 5 +#define f5 5 +#define fp6 6 +#define fr6 6 +#define f6 6 +#define fp7 7 +#define fr7 7 +#define f7 7 +#define fp8 8 +#define fr8 8 +#define f8 8 +#define fp9 9 +#define fr9 9 +#define f9 9 +#define fp10 10 +#define fr10 10 +#define f10 10 +#define fp11 11 +#define fr11 11 +#define f11 11 +#define fp12 12 +#define fr12 12 +#define f12 12 +#define fp13 13 +#define fr13 13 +#define f13 13 +#define fp14 14 +#define fr14 14 +#define f14 14 +#define fp15 15 +#define fr15 15 +#define f15 15 +#define fp16 16 +#define fr16 16 +#define f16 16 +#define fp17 17 +#define fr17 17 +#define f17 17 +#define fp18 18 +#define fr18 18 +#define f18 18 +#define fp19 19 +#define fr19 19 +#define f19 19 +#define fp20 20 +#define fr20 20 +#define f20 20 +#define fp21 21 +#define fr21 21 +#define f21 21 +#define fp22 22 +#define fr22 22 +#define f22 22 +#define fp23 23 +#define fr23 23 +#define f23 23 +#define fp24 24 +#define fr24 24 +#define f24 24 +#define fp25 25 +#define fr25 25 +#define f25 25 +#define fp26 26 +#define fr26 26 +#define f26 26 +#define fp27 27 +#define fr27 27 +#define f27 27 +#define fp28 28 +#define fr28 28 +#define f28 28 +#define fp29 29 +#define fr29 29 +#define f29 29 +#define fp30 30 +#define fr30 30 +#define f30 30 +#define fp31 31 +#define fr31 31 +#define f31 31 +#endif /* _PPC_MSR_FP */ + +/* Condition register names */ + +#define cr0 0 +#define cr1 1 +#define cr2 2 +#define cr3 3 +#define cr4 4 +#define cr5 5 +#define cr6 6 +#define cr7 7 + +/* Macro for hiadjust and lo */ +#define HIADJ(arg) arg@ha +#define HI(arg) arg@h +#define LO(arg) arg@l + +#ifdef _PPC_MSR_VEC + +/* ALTIVEC Vector register names */ + +#define v0 0 +#define v1 1 +#define v2 2 +#define v3 3 +#define v4 4 +#define v5 5 +#define v6 6 +#define v7 7 +#define v8 8 +#define v9 9 +#define v10 10 +#define v11 11 +#define v12 12 +#define v13 13 +#define v14 14 +#define v15 15 +#define v16 16 +#define v17 17 +#define v18 18 +#define v19 19 +#define v20 20 +#define v21 21 +#define v22 22 +#define v23 23 +#define v24 24 +#define v25 25 +#define v26 26 +#define v27 27 +#define v28 28 +#define v29 29 +#define v30 30 +#define v31 31 + +#endif /* _PPC_MSR_VEC */ + +#endif /* _GNU_TOOL */ + +#ifdef _DIAB_TOOL + +#ifdef _PPC_MSR_FP +/* Diab Data FP register names */ + +#define fp0 f0 +#define fr0 f0 +#define fp1 f1 +#define fr1 f1 +#define fp2 f2 +#define fr2 f2 +#define fp3 f3 +#define fr3 f3 +#define fp4 f4 +#define fr4 f4 +#define fp5 f5 +#define fr5 f5 +#define fp6 f6 +#define fr6 f6 +#define fp7 f7 +#define fr7 f7 +#define fp8 f8 +#define fr8 f8 +#define fp9 f9 +#define fr9 f9 +#define fp10 f10 +#define fr10 f10 +#define fp11 f11 +#define fr11 f11 +#define fp12 f12 +#define fr12 f12 +#define fp13 f13 +#define fr13 f13 +#define fp14 f14 +#define fr14 f14 +#define fp15 f15 +#define fr15 f15 +#define fp16 f16 +#define fr16 f16 +#define fp17 f17 +#define fr17 f17 +#define fp18 f18 +#define fr18 f18 +#define fp19 f19 +#define fr19 f19 +#define fp20 f20 +#define fr20 f20 +#define fp21 f21 +#define fr21 f21 +#define fp22 f22 +#define fr22 f22 +#define fp23 f23 +#define fr23 f23 +#define fp24 f24 +#define fr24 f24 +#define fp25 f25 +#define fr25 f25 +#define fp26 f26 +#define fr26 f26 +#define fp27 f27 +#define fr27 f27 +#define fp28 f28 +#define fr28 f28 +#define fp29 f29 +#define fr29 f29 +#define fp30 f30 +#define fr30 f30 +#define fp31 f31 +#define fr31 f31 +#endif /* _PPC_MSR_FP */ + +/* Macro for hiadjust and lo */ +#define HIADJ(arg) %hiadj(arg) +#define HI(arg) %hi(arg) +#define LO(arg) %lo(arg) + +#endif /* _DIAB_TOOL */ + +/* + * define r2 as VTOC/GOT(EABI), system use(SVR4)/TOC/GOT(PO),dedicated. + * define r13 as CTOC/GOT anchor pointer, dedicated (EABI), non-volatile + * register (SVR4, PO) + */ + +#define FUNC(func) func +#define FUNC_LABEL(func) func: + +#define FUNC_DECL(range, func) +#define VAR_DECL(var) var +#define VAR(var) var(r0) + +/* + * These macros are used to declare assembly language symbols that need + * to be typed properly(func or data) to be visible to the OMF tool. + * So that the build tool could mark them as an entry point to be linked + * by another PD. + */ + +#define GTEXT(sym) FUNC(sym) ; .type FUNC(sym),@function +#define GDATA(sym) VAR_DECL(sym) ; .type VAR_DECL(sym),@object + +/* Introduced to abstract assembler idiosyncrasies */ +#define FUNC_EXPORT(func) .globl GTEXT(func) +#define DATA_EXPORT(var) .globl GDATA(var) +#define FUNC_IMPORT(func) .extern FUNC(func) +#define DATA_IMPORT(var) .extern VAR_DECL(var) +#define FUNC_BEGIN(func) FUNC_LABEL(func) +#define FUNC_END(func) .size FUNC(func), . - FUNC(func) + + /* Macro for beginning a text segment */ +#define _WRS_TEXT_SEG_START \ + .text ; .balign _PPC_TEXT_SEG_ALIGN + +#define FRAMESZ(nregs) \ + ROUND_UP((FRAMEBASESZ + nregs * _PPC_REG_SIZE), _STACK_ALIGN_SIZE) + +#define LOADPTR(reg,const32) \ + addis reg,r0,HIADJ(const32); addi reg,reg,LO(const32) + +#define LOADVAR(reg,const32) \ + addis reg,r0,HIADJ(const32); lwz reg,LO(const32)(reg) + +#else /* _ASMLANGUAGE */ + +/* + * Use constant sizes if known (when building for a specific CPU type) + * else fetch from a global variable (when building for generic PPC32) + */ + +#ifdef _CPU_STACK_ALIGN_SIZE +#define _STACK_ALIGN_SIZE _CPU_STACK_ALIGN_SIZE +#else /* _CPU_STACK_ALIGN_SIZE */ +#define _STACK_ALIGN_SIZE _ppcStackAlignSize +extern int _ppcStackAlignSize; +#endif /* _CPU_STACK_ALIGN_SIZE */ + +#ifdef _CPU_ALLOC_ALIGN_SIZE +#define _ALLOC_ALIGN_SIZE _CPU_ALLOC_ALIGN_SIZE +#else /* _CPU_ALLOC_ALIGN_SIZE */ +#define _ALLOC_ALIGN_SIZE _ppcAllocationQuantumSize +extern int _ppcAllocationQuantumSize; +#endif /* _CPU_ALLOC_ALIGN_SIZE */ + +#define FUNCREF(func) func + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtoolPpch */ diff --git a/h/arch/ppc/vxPpcLib.h b/h/arch/ppc/vxPpcLib.h new file mode 100644 index 0000000..5945449 --- /dev/null +++ b/h/arch/ppc/vxPpcLib.h @@ -0,0 +1,275 @@ +/* vxPpcLib.h - header for board dependent library routines for the PowerPC */ + +/* +modification history +-------------------- +01y,09jun04,rec add 32-bit access routines for PPC970 HID registers +01x,22apr04,to delete K&R prototypes. +01w,18mar04,rec PPC970 merges +01v,25mar04,dtr Add vxIvor1Set. +01u,31mar03,dtr Adding vxHid1Set function. +01t,12nov02,mil Updated support for PPC85XX. +01s,02aug02,pcs Add support for PPC85XX and make it the same as PPC603 for + the present. +01r,28jan02,rcs added vxImmrIsbGet() and vxImmrDevGet() +01q,24oct01,jtp Add support for 440 decrementer +01p,22oct01,dtr Inclusion of vxKeyedDecReload function for some 860 bsps. + SPR65678. +01o,08oct01,mil added comments to various prototypes (SPR 9221). +01n,15aug01,pch Add support for PPC_NO_REAL_MODE & PPC440 +01m,02may01,dat 65984, Portable C Code, added vxDecReload, vxHid1Get +01l,25oct00,s_m renamed PPC405 cpu types +01k,12jun00,alp Added PPC405 support +01j,22mar00,tam added missing prototypes for PPC860 +01i,14jul97,mas prototypes for accessing DAR, DSISR, SRR0, SRR1 (SPR 8918). +01h,31mar97,tam added prototypes for DMA register access routines. +01g,10feb97,tam added prototypes for vxFpscrGet/Set() +01f,29oct96,tam added prototypes for vxPowerDown() , vxPowerModeSet() and + vxPowerModeGet(); added power management mode macros. +01e,18jun96,tam added prototypes for PPC403 debug register access routines. +01d,17jun96,tpr added vxDerGet(), vxDerSet(), vxImmrGet() and + vxImmrSet() prototypes. +01c,29may96,tam added prototypes for vxTimeBaseSet/Get (spr #6604). +01b,28feb96,tam added some PPC403 declarations. +01a,23feb96,tpr written. +*/ + +#ifndef __INCvxPpcLibh +#define __INCvxPpcLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* power management mode definitions - used by vxPowerModeSet/Get */ + +#define VX_POWER_MODE_DISABLE 0x1 /* power mgt disable: MSR(POW) = 0 */ +#define VX_POWER_MODE_FULL 0x2 /* All CPU units are active */ +#define VX_POWER_MODE_DOZE 0x4 /* doze power management mode */ +#define VX_POWER_MODE_NAP 0x8 /* nap power management mode */ +#define VX_POWER_MODE_SLEEP 0x10 /* sleep power management mode */ +#define VX_POWER_MODE_DEEP_SLEEP 0x20 /* deep sleep power mgt mode */ +#define VX_POWER_MODE_DPM 0x40 /* dynamic power management mode */ +#define VX_POWER_MODE_DOWN 0x80 /* all units down */ + +/* DMA channel definition for the vxDmaXXGet/Set() routines */ + +#define DMA_CHANNEL_0 0 +#define DMA_CHANNEL_1 1 +#define DMA_CHANNEL_2 2 +#define DMA_CHANNEL_3 3 + +/* function declarations */ + +#ifndef _ASMLANGUAGE + +IMPORT void vxMsrSet (UINT32); /* machine status reg */ +IMPORT UINT32 vxMsrGet (void); + +#if (CPU == PPC85XX) +IMPORT UINT32 vxDearGet (void); /* data exc addr reg */ +IMPORT void vxDearSet (UINT32); +IMPORT UINT32 vxCsrr0Get (void); /* save/restore reg 0 */ +IMPORT void vxCsrr0Set (UINT32); +IMPORT UINT32 vxCsrr1Get (void); /* save/restore reg 1 */ +IMPORT void vxCsrr1Set (UINT32); +IMPORT UINT32 vxMcsrr0Get (void); /* save/restore reg 0 */ +IMPORT void vxMcsrr0Set (UINT32); +IMPORT UINT32 vxMcsrr1Get (void); /* save/restore reg 1 */ +IMPORT void vxMcsrr1Set (UINT32); +IMPORT UINT32 vxSpefscrGet (void); /* FP status control reg */ +IMPORT void vxSpefscrSet (UINT32); +IMPORT void vxDecarSet (UINT32); /* dec auto reload reg */ +IMPORT UINT32 vxL1CSR0Get (void); /* L1 control status reg 0 */ +IMPORT void vxL1CSR0Set (UINT32); +IMPORT UINT32 vxL1CSR1Get (void); /* L1 control status reg 1 */ +IMPORT void vxL1CSR1Set (UINT32); +IMPORT UINT32 vxL1CFG0Get (void); /* L1 config reg 0 */ +IMPORT UINT32 vxL1CFG1Get (void); /* L1 config reg 1 */ +IMPORT void vxIvor1Set (UINT32); /* Set Mchk exception offset */ +#else /* CPU == PPC85XX */ +IMPORT void vxDarSet (UINT32); /* data addr reg */ +IMPORT UINT32 vxDarGet (void); +IMPORT void vxDsisrSet (UINT32); /* DSI source reg */ +IMPORT UINT32 vxDsisrGet (void); +#endif /* CPU == PPC85XX */ + +IMPORT void vxSrr0Set (UINT32); /* save/restore reg 0 */ +IMPORT UINT32 vxSrr0Get (void); +IMPORT void vxSrr1Set (UINT32); /* save/restore reg 1 */ +IMPORT UINT32 vxSrr1Get (void); +IMPORT UINT32 vxFirstBit (UINT32); /* get 1st bit set using cntlzw */ +IMPORT UINT32 vxPvrGet (void); /* processor version reg */ +IMPORT void vxDecSet (UINT32); /* decrementer reg */ +IMPORT UINT32 vxDecGet (void); +IMPORT UINT32 vxDecReload (UINT32); /* reload with lantency skew adj */ + +# if (CPU == PPC970) +IMPORT void vxHid0Set (UINT64 *); /* hardware imp dependent reg 0 */ +IMPORT void vxHid1Set (UINT64 *); /* hardware imp dependent reg 1 */ +IMPORT void vxHid4Set (UINT64 *); /* hardware imp dependent reg 4 */ +IMPORT void vxHid5Set (UINT64 *); /* hardware imp dependent reg 5 */ + +IMPORT void vxHid0Get (UINT64 *); /* hardware imp dependent reg 0 */ +IMPORT void vxHid1Get (UINT64 *); /* hardware imp dependent reg 1 */ +IMPORT void vxHid4Get (UINT64 *); /* hardware imp dependent reg 4 */ +IMPORT void vxHid5Get (UINT64 *); /* hardware imp dependent reg 5 */ + +IMPORT UINT32 vxHid0LGet (void); /* hardware imp dependent reg 0 Low */ +IMPORT UINT32 vxHid1LGet (void); /* hardware imp dependent reg 1 Low */ +IMPORT UINT32 vxHid4LGet (void); /* hardware imp dependent reg 4 Low */ +IMPORT UINT32 vxHid5LGet (void); /* hardware imp dependent reg 5 Low */ +IMPORT UINT32 vxHid0HGet (void); /* hardware imp dependent reg 0 High */ +IMPORT UINT32 vxHid1HGet (void); /* hardware imp dependent reg 1 High */ +IMPORT UINT32 vxHid4HGet (void); /* hardware imp dependent reg 4 High */ +IMPORT UINT32 vxHid5HGet (void); /* hardware imp dependent reg 5 High */ +#else /* CPU == PPC970 */ +IMPORT void vxHid0Set (UINT32); /* hardware imp dependent reg 0 */ +IMPORT void vxHid1Set (UINT32); /* hardware imp dependent reg 1 */ +IMPORT UINT32 vxHid0Get (void); +IMPORT UINT32 vxHid1Get (void); /* hardware imp dependent reg 1 */ +#endif /* CPU == PPC970 */ + +IMPORT STATUS vxPowerDown (void); +IMPORT STATUS vxPowerModeSet (UINT32); +IMPORT UINT32 vxPowerModeGet (void); +IMPORT void vxTimeBaseSet (UINT32 tbu, UINT32 tbl); /* time base up/lower */ +IMPORT void vxTimeBaseGet (UINT32 * pTbu, UINT32 * pTbl); +IMPORT void vxFpscrSet (UINT32); /* FP status control reg */ +IMPORT UINT32 vxFpscrGet (void); + +#if ((CPU == PPC403) || (CPU == PPC405) || (CPU == PPC405F) || \ + (CPU == PPC440) || (CPU == PPC85XX)) + +# if ((CPU == PPC440) || (CPU == PPC85XX)) +IMPORT void vxDecIntEnable (void); +IMPORT void vxDecIntAck (void); +#else /* CPU == PPC440, PPC85XX */ +IMPORT UINT32 vxExierEnable (UINT32); /* ext interrupt enable reg */ +IMPORT UINT32 vxExierDisable (UINT32); +IMPORT void vxPitSet (UINT32); /* prog interval timer */ +IMPORT UINT32 vxPitGet (void); +IMPORT void vxPitIntEnable (void); /* timer ctrl reg set PIT int en */ +IMPORT void vxPitIntAck (void); /* clear TSR PIT pending bit */ +# endif /* CPU == PPC440, PPC85XX */ + +IMPORT void vxFitIntEnable (void); /* timer ctrl reg set FIT int en */ +IMPORT void vxFitIntDisable (void); +IMPORT void vxFitIntAck (void); /* clear TSR FIT pending bit */ + +# if !((CPU == PPC440) || (CPU == PPC85XX)) +IMPORT UINT32 vxExisrGet (void); /* ext interrupt status reg */ +IMPORT void vxExisrClear (UINT32); +IMPORT UINT32 vxExierGet (void); /* ext interrupt enable reg */ +IMPORT void vxExierSet (UINT32); +# endif /* CPU != PPC440, PPC85XX */ + +# ifndef PPC_NO_REAL_MODE +IMPORT UINT32 vxDccrGet (void); /* data cache ctrl reg */ +IMPORT void vxDccrSet (UINT32); +IMPORT UINT32 vxIccrGet (void); /* instr cache ctrl reg */ +IMPORT void vxIccrSet (UINT32); +# endif /* PPC_NO_REAL_MODE */ + +# if ((CPU == PPC440) || (CPU == PPC85XX)) +IMPORT UINT32 vxIvprGet (void); +IMPORT void vxIvprSet (UINT32); +# else /* CPU == PPC440, PPC85XX */ +IMPORT UINT32 vxEvprGet (void); /* exception prefix reg */ +IMPORT void vxEvprSet (UINT32); +IMPORT UINT32 vxIocrGet (void); /* input/ouput config reg */ +IMPORT void vxIocrSet (UINT32); +# endif /* CPU == PPC440, PPC85XX */ + +IMPORT UINT32 vxTcrGet (void); /* timer ctrl reg */ +IMPORT void vxTcrSet (UINT32); +IMPORT UINT32 vxTsrGet (void); /* timer status reg */ +IMPORT void vxTsrSet (UINT32); + +# if ((CPU == PPC440) || (CPU == PPC85XX)) +IMPORT UINT32 vxDbcr0Get (void); +IMPORT void vxDbcr0Set (UINT32); +IMPORT UINT32 vxDbcr1Get (void); +IMPORT void vxDbcr1Set (UINT32); +IMPORT UINT32 vxDbcr2Get (void); +IMPORT void vxDbcr2Set (UINT32); +# if (CPU == PPC440) +IMPORT UINT32 vxDbdrGet (void); +IMPORT void vxDbdrClear (UINT32); +# endif /* CPU == PPC440 */ +# else /* CPU == PPC440, PPC85XX */ +IMPORT void vxBesrSet (UINT32); /* bus error syndrome reg */ +IMPORT UINT32 vxDbcrGet (void); /* debug ctrl reg */ +IMPORT void vxDbcrSet (UINT32); +# endif /* CPU == PPC440, PPC85XX */ + +IMPORT UINT32 vxDbsrGet (void); /* debug status reg */ +IMPORT void vxDbsrClear (UINT32); +IMPORT UINT32 vxDac1Get (void); /* data addr cmp reg 1 */ +IMPORT void vxDac1Set (UINT32); +IMPORT UINT32 vxDac2Get (void); /* data addr cmp reg 2 */ +IMPORT void vxDac2Set (UINT32); +IMPORT UINT32 vxIac1Get (void); /* instr addr cmp reg 1 */ +IMPORT void vxIac1Set (UINT32); +IMPORT UINT32 vxIac2Get (void); /* instr addr cmp reg 2 */ +IMPORT void vxIac2Set (UINT32); + +# if (CPU == PPC403) +IMPORT void vxDmacrSet (UINT32 regVal, UINT32 dmaRegNo); +IMPORT UINT32 vxDmacrGet (UINT32 dmaRegNo); +IMPORT void vxDmasrSet (UINT32 regVal); +IMPORT UINT32 vxDmasrGet (void); +IMPORT void vxDmaccSet (UINT32 regVal, UINT32 dmaRegNo); +IMPORT UINT32 vxDmaccGet (UINT32 dmaRegNo); +IMPORT void vxDmactSet (UINT32 regVal, UINT32 dmaRegNo); +IMPORT UINT32 vxDmactGet (UINT32 dmaRegNo); +IMPORT void vxDmadaSet (UINT32 regVal, UINT32 dmaRegNo); +IMPORT UINT32 vxDmadaGet (UINT32 dmaRegNo); +IMPORT void vxDmasaSet (UINT32 regVal, UINT32 dmaRegNo); +IMPORT UINT32 vxDmasaGet (UINT32 dmaRegNo); +# elif (CPU != PPC85XX) /* i.e. non-403/non-85XX */ +IMPORT UINT32 vxIac3Get (void); +IMPORT void vxIac3Set (UINT32); +IMPORT UINT32 vxIac4Get (void); +IMPORT void vxIac4Set (UINT32); +# endif /* CPU == PPC403 : PPC85XX */ + +#endif /* CPU == PPC4xx, PPC85XX */ + +#if ((CPU == PPC603) || (CPU == PPC604)) +IMPORT UINT32 vxImmrDevGet (void); /* Get PART/MASK bits of IMMR */ +IMPORT UINT32 vxImmrIsbGet (void); /* Get ISB bits of IMMR */ +#endif /* (CPU == PPC603) || (CPU == PPC604) */ + +#if (CPU == PPC860) +IMPORT void vxImmrSet (UINT32); /* internal mem map reg */ +IMPORT UINT32 vxImmrGet (void); +IMPORT UINT32 vxImmrDevGet (void); /* Get PART/MASK bits of IMMR */ +IMPORT UINT32 vxImmrIsbGet (void); /* Get ISB bits of IMMR */ +IMPORT void vxDerSet (UINT32); /* debug enable reg */ +IMPORT UINT32 vxDerGet (void); +IMPORT UINT32 vxKeyedDecReload (UINT32); /* vxDecReload a locked DEC */ +IMPORT void vxMTwbSet (UINT32); /* MMU table walk base reg */ +IMPORT UINT32 vxMTwbGet (void); +IMPORT void vxMdCtrSet (UINT32); /* data MMU ctrl reg */ +IMPORT UINT32 vxMdCtrGet (void); +IMPORT void vxMiCtrSet (UINT32); /* instr MMU ctrl reg */ +IMPORT UINT32 vxMiCtrGet (void); +IMPORT void vxIcCstSet (UINT32); /* instr cache ctrl status reg */ +IMPORT UINT32 vxIcCstGet (void); +IMPORT void vxIcAdrSet (UINT32); /* instr cache addr reg */ +IMPORT UINT32 vxIcAdrGet (void); +IMPORT UINT32 vxIcDatGet (void); /* instr cache data port */ +IMPORT void vxDcCstSet (UINT32); /* data cache ctrl status reg */ +IMPORT UINT32 vxDcCstGet (void); +IMPORT void vxDcAdrSet (UINT32); /* data cache addr reg */ +IMPORT UINT32 vxDcAdrGet (void); +#endif /* (CPU == PPC860) */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvxPpcLibh */ diff --git a/h/arch/sh/archSh.h b/h/arch/sh/archSh.h new file mode 100644 index 0000000..c901456 --- /dev/null +++ b/h/arch/sh/archSh.h @@ -0,0 +1,243 @@ +/* archSh.h - Renesas SH specific header */ + +/* + * Copyright (c) 1994-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +02f,29apr05,h_k disabled _WRS_SCHEDLIB_OPTIMIZED and enabled + schedLib_PORTABLE. (SPR #107854, #108678). +02e,12apr05,kk remove _WRS_OBJLIB_SUPPORT_VERIFY_TRAP macro (SPR# 106486) +02d,02feb05,h_k enabled _ARCH_SUPPORTS_GCC. (SPR #106087) +02c,09sep04,h_k added _WRS_OBJLIB_SUPPORT_VERIFY_TRAP. (SPR #99844) +02b,12may04,h_k eliminated _WRS_TEXT_REGION, _WRS_MEM_BASE and + _WRS_ADJUST_TEXT_START macros. (SPR #97280) + deleted the obsolete SH7729 CPU type. +02a,29apr04,h_k added SH_WARM_OFFSET. +01z,27apr04,cjj Defined workQLib_PORTABLE +01y,22mar04,zl moved trcLib_PORTABLE and INSTR to archShCommon.h; + added _WRS_FRAMEP_FROM_JMP_BUF and _WRS_RET_PC_FROM_JMP_BUF. +01x,19feb04,h_k defined trcLib_PORTABLE. +01w,14nov03,job Moved some blib stuff to archShCommon.h + Added missing include of archShCommon.h +01v,13nov03,pes Add include of archShCommon.h +01u,14nov03,job Moved some blib stuff to archShCommon.h + Added missing include of archShCommon.h +01t,13nov03,pes Add include of archShCommon.h +01s,29oct03,sn gcc 3.3.2 does not currently support arm or sh +01r,28oct03,pcm set portable semaphores as default so as not to break the build +01q,10sep03,pcm enabled base6 scheduler +01p,27aug03,to added defines for semLib. +01o,07may03,pes PAL conditional compilation cleanups. Phase 2. +01n,24apr03,pes CPU conditional compilation cleanups. +01m,05dec02,hk moved _WRS_HW_FP_SUPPORT from fppShLib.h to archSh.h (SPR#83145) +01l,13mar01,sn SPR 73723 - define supported toolchains +01k,23aug00,hk change to use default _CACHE_ALIGN_SIZE for SH7040. +01j,04jun99,zl hitachi SH4 architecture port, provided by Highlander + Engineering. Added include of toolSh.h +01i,05mar99,hk merged CPU conditional for _CACHE_ALIGN_SIZE. +01h,14sep98,st added _CACHE_ALIGN_SIZE for SH7750. +01g,22apr97,hk changed 704X to 7040. +01f,21dec95,hk added _CACHE_ALIGN_SIZE for SH704X. +01e,16aug95,hk restored _ARCH_MULTIPLE_CACHELIB. +01d,05jul95,hk deleted _ARCH_MULTIPLE_CACHELIB. +01c,01jun95,hk added _ARCH_MULTIPLE_CACHELIB. copyright to '95. +01b,23aug94,sa added '#undef _DYNAMIC_BUS_SIZING'. +01a,15jun94,hk written. +*/ + +#ifndef __INCarchShh +#define __INCarchShh + +#ifdef __cplusplus +extern "C" { +#endif + +#define _ARCH_SUPPORTS_GCC +#define _ARCH_SUPPORTS_DCC + +#define _ARCH_MULTIPLE_CACHELIB TRUE /* multiple cache libraries */ + +#if (CPU==SH7750) +#define _CACHE_ALIGN_SIZE 32 /* change default in vxArch.h */ +#endif + +#ifdef _DYNAMIC_BUS_SIZING +#undef _DYNAMIC_BUS_SIZING +#endif +#define _DYNAMIC_BUS_SIZING FALSE /* require alignment for swap */ + +/* + * FPU support only for SH-4. SH-3 archives are built with no SH-3E support. + * For SH-3E some target/src/arch/sh/... files need to be rebuilt with + * _WRS_HW_FP_SUPPORT defined (e.g. fppALib.s, fppArchLib.c, excALib.s and + * excArchLib.c). + */ + +/* in fppShow.c, re-type _WRS_FLOAT_TYPE as 'float' */ +#define _WRS_FLOAT_TYPE float + +#if (CPU==SH7750) +#define _WRS_HW_FP_SUPPORT +#endif + +/* PAL Additions */ + +#if (CPU==SH7750 || CPU==SH7700) +#define SM_ANCHOR_OFFSET 0x1600 /* not used for SDRAM config. */ +#define BOOT_LINE_OFFSET 0x1700 +#define EXC_MSG_OFFSET 0x1800 + + +/* This macro is used in kernelLib.c. + * If mmu is enabled, emulated SH7700 interrupt stack needs to be relocated + * on a fixed physical address space (P1/P2). If mmu is disabled, it is + * also possible to put the interrupt stack on copy-back cache (P0/P3). + * Note that cache flush is necessary, since bfill() to load 0xee might be done + * on copy-back cache and we may use the area from its behind. + */ +#define _WRS_INT_STACK_ADJUST \ + { \ + CACHE_DRV_FLUSH (&cacheLib, vxIntStackEnd, (int) intStackSize);\ + vxIntStackBase = (char *)(((UINT32)vxIntStackBase & 0x1fffffff)\ + | ((UINT32)intVecBaseGet() & 0xe0000000));\ +\ + vxIntStackEnd = (char *)(((UINT32)vxIntStackEnd & 0x1fffffff)\ + | ((UINT32)intVecBaseGet() & 0xe0000000));\ + } + +/* warm start offset */ +#define SH_WARM_OFFSET 0x8 /* refered by arch.cdf */ +#else /* CPU==SH7600 */ +/* warm start offset */ +#define SH_WARM_OFFSET 0x18 /* refered by arch.cdf */ +#endif /* (CPU==SH7750 || CPU==SH7700) */ + +/* replace IF_DEQUEUEIF macro in if.h */ +#define IF_DEQUEUEIF(ifq, m, ifp) { \ + (m) = (ifq)->ifq_head; \ + if (m) { \ + if (((ifq)->ifq_head = (m)->m_act) == 0) \ + (ifq)->ifq_tail = 0; \ + (m)->m_act = 0; \ + (ifq)->ifq_len--; \ + (ifp) = (struct ifnet *)( \ + (*((u_short *)((int)(m)+(m)->m_off+0)) << 16) | \ + (*((u_short *)((int)(m)+(m)->m_off+2)) ) ); \ + IF_ADJ(m); \ + } \ +} + +#if (CPU==SH7700) +/* override the standard definition of the CACHE_TYPE enum to add + * support for WAY2 and WAY3 caches. + */ +#define _WRS_CACHE_TYPE + +#define _INSTRUCTION_CACHE 0 /* Instruction Cache(s) */ +#define _DATA_CACHE 1 /* Data Cache(s) */ + +#define _WAY2_CACHE 3 +#define _WAY3_CACHE 4 + +#ifndef _ASMLANGUAGE +typedef enum /* CACHE_TYPE */ + { + INSTRUCTION_CACHE = _INSTRUCTION_CACHE, + DATA_CACHE = _DATA_CACHE, + WAY2_CACHE = _WAY2_CACHE, /* currently used in SH7700 only */ + WAY3_CACHE = _WAY3_CACHE /* currently used in SH7700 only */ + } CACHE_TYPE; +#endif /* _ASMLANGUAGE */ +#endif /* CPU==SH7700 */ + + +/* moved here from ieeefp.h */ + +#ifdef __SH3E__ +#define _DOUBLE_IS_32BITS +#endif + +/* from ffsLib.c */ +#undef PORTABLE +#undef ffsLib_PORTABLE + +/* from memPartLib.c */ +#define _WRS_NEED_ALIGNED_HEADER + +/* from sigLib.c. Triggers inclusion of code which sends a SIGBUS signal if + * no entry is found in the signal table. + */ +#define _WRS_SIG_EXCBERRVECNUM + +/* from dspLib.c */ + +#define _WRS_EARLY_DSP_INIT + +/* in dbgLib.c */ + +#define _WRS_LABEL_STRING " %s:\n" + +/* from loadElfLib.c */ + +#define _WRS_USE_ELF_LOAD_FORMAT + +/* from xdr_float.c */ + +#define FLOAT_NORM + +/* from etherLib.c */ + +#define _WRS_COPY_ETHERHDR_BY_INTS + +/* from bLib.c */ + +#define _WRS_BLIB_OPTIMIZED + +/* from schedLib.c */ + +#undef _WRS_SCHEDLIB_OPTIMIZED +#define schedLib_PORTABLE + +#define _WRS_VXLIB_SUPPORT + +#define _WRS_BASE6_SCHEDULER +#define _WRS_ENABLE_IDLE_INTS \ + { \ + intLevelSet (0); \ + if (_func_vxIdleLoopHook != NULL) \ + (* _func_vxIdleLoopHook) (); \ + } + +/* from sem*Lib.c, semA*Lib.s */ + +#define _WRS_HAS_OPTIMIZED_SEM +#define _WRS_USE_OPTIMIZED_SEM +#undef _WRS_USE_OPTIMIZED_SEM /* Use portable semaphores for now */ + +/* from workQLib.c */ + +#define workQLib_PORTABLE + +/* macros for getting frame and return PC from a jmp_buf */ + +#define _WRS_FRAMEP_FROM_JMP_BUF(env) ((char *) (env)[0].reg.spReg) +#define _WRS_RET_PC_FROM_JMP_BUF(env) ((env)[0].reg.pc) + +/* end of PAL additions */ + +#include "toolSh.h" + +#include "arch/sh/archShCommon.h" + +#ifdef __cplusplus +} +#endif + +#endif /* __INCarchShh */ diff --git a/h/arch/sh/archShCommon.h b/h/arch/sh/archShCommon.h new file mode 100644 index 0000000..1ec1d85 --- /dev/null +++ b/h/arch/sh/archShCommon.h @@ -0,0 +1,46 @@ +/* archShCommon.h - common Sh architecture specific header */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,29apr04,h_k enabled coprocessor abstraction. +01c,22mar04,zl moved trcLib_PORTABLE and INSTR definitions here. +01b,12nov03,job Moved some blib stuff from archSh.h +01a,11nov03,pes written. +*/ + +#ifndef __INCarchShCommonh +#define __INCarchShCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +#define _WRS_PAL_COPROC_LIB /* enable coprocessor abstraction */ + +/* from bLib.c */ + +#define _WRS_BLIB_ALIGNMENT 3 /* quad byte alignment mask */ +#define swab_PORTABLE + +/* from trcLib.c */ + +#define trcLib_PORTABLE + +/* moved here from h/types/vxTypesOld.h */ + +#ifndef _ASMLANGUAGE +typedef unsigned short INSTR; /* word-aligned instructions */ +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCarchShCommonh */ + + + + diff --git a/h/arch/sh/asmSh.h b/h/arch/sh/asmSh.h new file mode 100644 index 0000000..b8a0d09 --- /dev/null +++ b/h/arch/sh/asmSh.h @@ -0,0 +1,33 @@ +/* asmSh.h - SH assembler definitions header file */ + +/* Copyright 1994-2004 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01e,08sep04,h_k added _SH7750 condition. +01d,23aug00,hk change to use default _ALIGN_TEXT for SH7040(merged to SH7600). +01c,19apr00,hk added alignment macro _ALIGN_COPY_TEXT for VBR-relative stubs. +01b,17mar00,zl added alignment macro _ALIGN_TEXT +01a,21sep94,sa derived from version 01i of mc68k/asmMc68k.h. +*/ + +#ifndef __INCasmShh +#define __INCasmShh + +#ifdef __cplusplus +extern "C" { +#endif + +#if (CPU==SH7750) || defined (_SH7750) +#define _ALIGN_TEXT 5 /* 32 byte aligned */ +#else /* CPU != SH7750 && !defined (_SH7750) */ +#define _ALIGN_TEXT 4 /* 16 byte alignment */ +#endif /* CPU==SH7750 || defined (_SH7750) */ + +#define _ALIGN_COPY_TEXT 2 /* for text to be copied */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCasmShh */ diff --git a/h/arch/sh/cacheShLib.h b/h/arch/sh/cacheShLib.h new file mode 100644 index 0000000..b5b9c47 --- /dev/null +++ b/h/arch/sh/cacheShLib.h @@ -0,0 +1,175 @@ +/* cacheShLib.h - SH cache library header file */ + +/* Copyright 1994-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02k,28aug04,h_k added SH_Px_BASE for AIM MMU Lib. +02j,02apr04,h_k added CACHE_SH4A_MODE. (SPR #96128) +02i,09feb04,h_k added SH_PC_INVAL_BASE. +02h,04nov03,h_k added SH_P4_BASE. +02g,26aug03,h_k added SH_PHYS_MASK. +02f,05aug03,h_k added cacheSh7710LibInit (). (SPR #90073) +02e,05jun01,frf added CACHE_2WAY_MODE for enhanced Sh7751R mode. +02d,01feb01,frf added definition for SH7726. +02c,06dec00,hk delete CCR-related and unused definitions for SH7750. +02c,06nov00,zl added cacheSh7622LibInit and SH7622_CACHE_THRU. +02b,27sep00,zl exclude function declarations for asm files. +02a,09sep00,hk merge SH7729 to SH7700. +01z,23aug00,hk merge SH7410 to SH7600. get together function prototypes. +01y,06aug00,hk merged SH7040 to SH7600. hide local definitions for SH7700. +01x,31may00,frf SH7751 for T2 +01w,05mar99,hk minor clean-up for CPU conditional and comment. +01v,20sep98,hk code review: moved-up SH7750 section. simplified caching modes. + changed CCR_[IO]C_FLUSH to CCR_[IO]C_INVALIDATE. + changed CCR_[IO]C_INDEX_MODE to CCR_[IO]C_INDEX_ENABLE. + disabled unused defs for SH7750 store queue control. +01u,16jul98,st added SH7750 support. +01v,24jun98,jmc added definition of SH7729 cache control register 2. +01u,08may98,jmc added support for SH-DSP and SH3-DSP. +01t,06feb98,jmc renamed macro CACHE_WRITEBACK_P1 to CACHE_COPYBACK_P1. +01s,30jan98,jmc added CACHE_WRITEBACK_P1 for write-back cache configuration of + P1 region and CCR bit CCR_WRITE_BACK_P1 for same, SH7709 only. +01r,19jun97,hk fixed SH7040_CAC_ADRS_ARRAY/SH7040_CAC_DATA_ARRAY addresses. +01q,22apr97,hk changed 704X to 7040. +01p,16feb97,hk added CACHE_1WAY_MODE and CCR_1WAY_MODE for SH7702. + changed CCR_RAM_MODE to CCR_2WAY_MODE for SH7708. +01o,18jan97,hk added CACHE_DMA_BYPASS_P[013]. made cacheArchXXX local for + SH7700. added cacheArchInvalidate(). +01n,30dec96,hk renamed SH7700_P* to SH7700_P?_BASE. +01m,05sep96,hk renamed SH7700_CACHE_THRU to SH7700_P2_CACHE_THRU. added more + macros for SH7700. +01l,23aug96,hk changed code layout. added CCR bit defs for SH7700. also added + CACHE_2WAY_MODE for SH7700/SH7600. +01k,21may96,hk added SH7700 def. +01j,18jan96,hk changed cacheSh704XLibInit() to cacheSh704xLibInit(). +01i,14jan96,hk added CCR_ENABLED for SH704X. deleted SH7000 stuff. + changed C_PURGE_ADRS to SH7604_CACHE_PURGE. +01h,19dec95,hk added support for SH704X. +01g,21nov95,hk changed SH to Sh. +01f,21nov95,hk renamed SH7000 to SH7032, SH7600 to SH7604. +01e,16aug95,hk added prototypes for cache{SH7000|SH7600}LibInit(). +01d,23may95,hk made SH7604_CACHE_CCR to volatile SH7604_CCR, copyright to '95. +01c,09noV94,sa added C_ENABLE, ... , C_PURGE, C_PURGE_ADRS. + added cacheArchDmaMalloc(), cacheArchDmaFree(); +01b,21sep94,sa added SH_CACHE_CCR. +01a,21sep94,sa drrived from version 02b of arch/mc68k/cacheMc68kLib.h. +*/ + +#ifndef __INCcacheShLibh +#define __INCcacheShLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + + +#if (CPU==SH7750) /*==========================================================*/ + +/* Additional caching mode */ +#define CACHE_RAM_MODE 0x00000100 /* use half of cache as RAM */ +#define CACHE_DMA_BYPASS_P0 0x00000200 /* allocate on P2, free to P0 */ +#define CACHE_DMA_BYPASS_P1 0x00000400 /* allocate on P2, free to P1 */ +#define CACHE_DMA_BYPASS_P3 0x00000800 /* allocate on P2, free to P3 */ +#define CACHE_A25_INDEX 0x00001000 /* use A25 as cache index MSB */ +#define CACHE_COPYBACK_P1 0x00002000 /* set P1 to copy-back */ +#define CACHE_2WAY_MODE 0x00004000 /* enhanced mode: 2way assoc. */ +#define CACHE_SH4A_MODE 0x00008000 /* SH4A cache support */ + +#define SH7750_PHYS_MASK 0x1fffffff +#define SH7750_P1_BASE 0x80000000 /* cacheable, bypass mmu */ +#define SH7750_P2_BASE 0xa0000000 /* non cacheable, bypass mmu */ +#define SH7750_P3_BASE 0xc0000000 /* cacheable */ +#define SH7750_P4_BASE 0xe0000000 /* non cacheable, bypass mmu */ +#define SH_PHYS_MASK SH7750_PHYS_MASK +#define SH_P1_BASE SH7750_P1_BASE +#define SH_P2_BASE SH7750_P2_BASE +#define SH_P3_BASE SH7750_P3_BASE +#define SH_P4_BASE SH7750_P4_BASE +#define SH_PC_INVAL_BASE SH_P4_BASE /* pc invalidate base address */ + +/* These are referenced by hmse7751.h */ + +#define SH7751_PHYS_MASK 0x1fffffff +#define SH7751_P1_BASE 0x80000000 /* cacheable, bypass mmu */ +#define SH7751_P2_BASE 0xa0000000 /* non cacheable, bypass mmu */ +#define SH7751_P3_BASE 0xc0000000 /* cacheable */ +#define SH7751_P4_BASE 0xe0000000 /* non cacheable, bypass mmu */ + + +#elif (CPU==SH7700) /*===========================================*/ + +/* Additional caching mode for SH7700 */ +#define CACHE_2WAY_MODE 0x00000100 /* use half of cache as RAM */ +#define CACHE_DMA_BYPASS_P0 0x00000200 /* allocate on P2, free to P0 */ +#define CACHE_DMA_BYPASS_P1 0x00000400 /* allocate on P2, free to P1 */ +#define CACHE_DMA_BYPASS_P3 0x00000800 /* allocate on P2, free to P3 */ +#define CACHE_1WAY_MODE 0x00001000 /* SH7702 only */ +#define CACHE_COPYBACK_P1 0x00002000 /* SH7729/SH7709 only */ + +#define SH7700_PHYS_MASK 0x1fffffff +#define SH7700_P1_BASE 0x80000000 /* cacheable (write thru) */ +#define SH7700_P2_BASE 0xa0000000 /* non cacheable */ +#define SH7700_P3_BASE 0xc0000000 /* cacheable */ +#define SH7700_P4_BASE 0xe0000000 /* non cacheable */ +#define SH_PHYS_MASK SH7700_PHYS_MASK +#define SH_P1_BASE SH7700_P1_BASE +#define SH_P2_BASE SH7700_P2_BASE +#define SH_P3_BASE SH7700_P3_BASE +#define SH_P4_BASE SH7700_P4_BASE +#define SH_PC_INVAL_BASE SH_P4_BASE /* pc invalidate base address */ + + +#elif (CPU==SH7600) /*=========================================*/ + +/* Additional caching mode for SH7604 */ +#define CACHE_2WAY_MODE 0x100 /* use half of cache as RAM */ +#define CACHE_COPYBACK_P1 0x00002000 /* set P1 to copy-back + only for SH7622 */ + +/* Address space definitions */ +#define SH7604_CACHE_THRU 0x20000000 +#define SH7622_CACHE_THRU 0xa0000000 +#define SH7622_PHYS_MASK 0x1fffffff +#define SH_PHYS_MASK SH7622_PHYS_MASK +#define SH_PC_INVAL_BASE 0xc0000000 /* pc invalidate base address */ + +/* Additional caching mode for SH7040 */ +#define CACHE_SH7040_DRAM 0x1000 +#define CACHE_SH7040_CS3 0x0800 +#define CACHE_SH7040_CS2 0x0400 +#define CACHE_SH7040_CS1 0x0200 +#define CACHE_SH7040_CS0 0x0100 + +#endif /* CPU==SH7600 =========================================*/ + +#ifndef _ASMLANGUAGE + +#if defined(__STDC__) || defined(__cplusplus) +extern STATUS cacheSh7750LibInit (CACHE_MODE instMode, CACHE_MODE dataMode); +extern STATUS cacheSh7729LibInit (CACHE_MODE instMode, CACHE_MODE dataMode); +extern STATUS cacheSh7710LibInit (CACHE_MODE instMode, CACHE_MODE dataMode); +extern STATUS cacheSh7700LibInit (CACHE_MODE instMode, CACHE_MODE dataMode); +extern STATUS cacheSh7622LibInit (CACHE_MODE instMode, CACHE_MODE dataMode); +extern STATUS cacheSh7604LibInit (CACHE_MODE instMode, CACHE_MODE dataMode); +extern STATUS cacheSh7040LibInit (CACHE_MODE instMode, CACHE_MODE dataMode); +#else +extern STATUS cacheSh7750LibInit (); +extern STATUS cacheSh7729LibInit (); +extern STATUS cacheSh7710LibInit (); +extern STATUS cacheSh7700LibInit (); +extern STATUS cacheSh7622LibInit (); +extern STATUS cacheSh7604LibInit (); +extern STATUS cacheSh7040LibInit (); +#endif + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcacheShLibh */ diff --git a/h/arch/sh/coprocSh.h b/h/arch/sh/coprocSh.h new file mode 100644 index 0000000..53b52ee --- /dev/null +++ b/h/arch/sh/coprocSh.h @@ -0,0 +1,33 @@ +/* coprocSh.h - coprocessor management library header */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,21apr04,h_k written. +*/ + +#ifndef __INCcoprocShh +#define __INCcoprocShh + +#ifdef __cplusplus +extern "C" { +#endif + +/* inlcudes */ + +#include "taskLib.h" + +/* defines */ + +#define VX_FP_TASK VX_COPROC1_TASK /* fpu coprocessor support */ +#define VX_DSP_TASK VX_COPROC2_TASK /* dsp coprocessor support */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcoprocMipsh */ diff --git a/h/arch/sh/dbgShLib.h b/h/arch/sh/dbgShLib.h new file mode 100644 index 0000000..c0985a3 --- /dev/null +++ b/h/arch/sh/dbgShLib.h @@ -0,0 +1,267 @@ +/* dbgShLib.h - header file for arch dependent portion of debugger */ + +/* Copyright 1994-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01o,19apr04,h_k added SH7770 support. (SPR #96445) +01n,26feb04,h_k corrected BRK_HARDMASK and moved HW breakpoint bit to lower 16 + bit. (SPR #94415) +01m,20feb04,h_k added DBG_SYSCALL_SIZE. +01l,27nov01,h_k defined DBG_INST_ALIGN 2 for SH architectures. +01k,16feb01,hk prefix underscore to UBC_xxx macro (in conflict with sh7XXX.h). +01j,06sep00,zl updated for new HW breakpoint support. +01i,17apr00,frf Removed defs of TSH_BH_CHAN_XX, HWINFO and BRK_HW_BP +01h,02mar00,frf Add SH4 support for T2 +01g,29jun99,zl included SH7750 in hardware breakpoint support +01f,11mar99,hk placed wdb defs on top, dbg defs at bottom, commons in between. +02e,09mar99,hk moved UBC register defs to each CPU specific header. +02d,09mar99,hk merged DSP defs, retrieved defs for target shell debugger. +01C,21oct98,kab added SH7410 hardware breakpoint support. +01B,11sep98,kab added hardware breakpoint support for SH-DSP. +01A,08may98,jmc added support for the SH-DSP and SH3-DSP CPU types. +02c,29sep98,hk code review: simplified CPU conditionals. +02b,24sep98,st moved-up SH7750 section. added BAMR_IGNORE_BAR_LOWER_16BITS, + BAMR_IGNORE_BAR_LOWER_20BITS, BBR_BREAK_AT_QUAD_ACCESS + and BRCR_USER_BREAK_DEBUG_ENABLE defs. +02a,16jul98,st added SH7750 support. +01z,22apr97,hk changed 704X to 7040. +01y,17feb97,hk unified BREAK_ESF to ESFSH. +01x,09feb97,hk added aa to BREAK_ESF for SH7700. changed s/w breakpoint for + SH7700 to use 'trapa #0'. +01w,19aug96,hk changed to use 'trapa #255' for SH7700 s/w break. +01v,09aug96,hk use 'trapa #1' for SH7700 s/w break. changed code layout. +01u,10may96,hk added support for SH7700. +01t,18dec95,hk added support for SH704X. +01s,25apr95,hk enabled DBG_TT. +01r,31mar95,hk comply with new IV_TRAP macro. +01q,28feb95,hk changed DBG_TRAP_NUM to DBG_TRAP_VEC, followed new IV_ def. +01p,22feb95,hk added SH7000 support. +01o,21feb95,hk deleted BH_INTERACTIVE. +01n,17feb95,hk simplified bh() access code. +01m,07feb95,hk copyright year 1995. modified HWINFO, deleted HWINFO2. +01l,11jan95,hk restored HW_REGS_NUM to 2. modified HWINFO structure. +01k,10jan95,hk changed HW_REGS_NUM to 1. +01j,25dec94,hk disabled cret. +01i,23dec94,hk changing macro names. +01h,22dec94,hk enabled cret. +01g,18dec94,hk added UBC defs. +01f,15dec94,hk deleted junks, set BRK_HW_BP as 0x80 (same to i960). +01e,07dec94,hk #if FALSE'd junk. +01d,06dec94,hk fixed DBG_BREAK_INST. adding misc defines. +01c,30nov94,hk added DBG_TRAP_NUM. hardcoded DBG_BREAK_INST as "trapa #63". +01b,09oct94,hk added BREAK_ESF, TRACE_ESF, DBG_BREAK_INST. +01a,14sep94,sa written based on mc68k/dbgMc68kLib.h 01e version. +*/ + +#ifndef __INCShdbgh +#define __INCShdbgh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "esf.h" +#include "reg.h" + +/* register name definitions migrated from h/wdb/wdbBpLib.h */ + +#define reg_pc pc +#define reg_sp spReg +#define reg_fp fpReg + +/* software breakpoint related defines */ + +#define BREAK_ESF ESFSH +#define TRACE_ESF BREAK_ESF + +#define DBG_INST_ALIGN 2 +#define DBG_NO_SINGLE_STEP 1 + +#if (CPU==SH7750 || CPU==SH7700) +# define DBG_TRAP_NUM 0x00 +#elif (CPU==SH7600 || CPU==SH7000) +# define DBG_TRAP_NUM 0x3f +#endif + +#define DBG_BREAK_INST (0xc300 + (DBG_TRAP_NUM & 0xff)) +#define DBG_TRAP_VEC IV_TRAP(DBG_TRAP_NUM) +#define DBG_SYSCALL_SIZE (sizeof (INSTR) / sizeof (INSTR)) + + +/* Hardware breakpoint related defines */ + +#define DBG_HARDWARE_BP 1 +#define DEFAULT_HW_BP 0 /* default hw. breakpoint */ +#define BRK_HARDWARE 0x00001000 /* hardware breakpoint bit */ +#define BRK_HARDMASK 0x000003ff /* hardware breakpoint mask */ +#define BRK_INST BH_BREAK_INSN +#define MAX_CHAN 4 /* 2 or 4 UBC channels */ + +/* Common HW BP UI macros; register bits are in .h */ + +#define BH_BREAK_MASK 0x00000003 /* Instr/Data select */ +# define BH_BREAK_ANY 0x00000000 +# define BH_BREAK_INSN 0x00000001 +# define BH_BREAK_DATA 0x00000002 + +#define BH_CYCLE_MASK 0x0000000C /* Access type select */ +# define BH_CYCLE_ANY 0x00000000 +# define BH_CYCLE_READ 0x00000004 +# define BH_CYCLE_WRITE 0x00000008 +# define BH_CYCLE_RW 0x0000000C + +#define BH_SIZE_MASK 0x00000030 /* Access size select */ +# define BH_ANY 0x00000000 +# define BH_8 0x00000010 +# define BH_16 0x00000020 +# define BH_32 0x00000030 + +#define BH_CPU_MASK 0x000000C0 /* Bus controller select */ +# define BH_CPU 0x00000000 +# define BH_DMAC 0x00000040 +# define BH_DMAC_CPU 0x00000080 + +#define BH_BUS_MASK 0x00000300 /* Internal bus selection */ +# define BH_IBUS 0x00000000 +# define BH_XBUS 0x00000100 +# define BH_YBUS 0x00000200 + +/* Debug register access macros */ + +#define _UBC_TYPE(i) (ubc.type[i]) +#define _UBC_BAR(i) ((volatile UINT32 *) ubc.base[i]) +#define _UBC_BBR(i) ((volatile UINT16 *) (ubc.base[i] + 8)) +#define _UBC_BAMR32(i) ((volatile UINT32 *) (ubc.base[i] + 4)) +#define _UBC_BAMR8(i) ((volatile UINT8 *) (ubc.base[i] + 4)) +#define _UBC_CBR(i) ((volatile UINT32 *) (ubc.base[i] - 8)) +#define _UBC_BRCR16 ((volatile UINT16 *) ubc.pBRCR) +#define _UBC_BRCR32 ((volatile UINT32 *) ubc.pBRCR) + +/* UBC identifiers */ + +#define BRCR_NONE 0 /* No UBC support */ +#define BRCR_0_1 1 /* UBC w/o BRCR */ +#define BRCR_16_1 2 /* 16 bit BRCR, 1 channel */ +#define BRCR_16_2 3 /* 16 bit BRCR, 2 channels */ +#define BRCR_32_2 4 /* 32 bit BRCR, 2 channels */ +#define BRCR_32_4 5 /* 32 bit BRCR, 4 channels */ +#define CCMFR_32_2 6 /* 32 bit CCMFR,2 channels */ + +/* Supported BRCR (Break control register) bits on various SuperH CPUs */ + +#define UBC_BRCR_CONDITION_MASK_16_2 0xc000 +#define UBC_BRCR_CMFA (1<<15) /* Ch A */ +#define UBC_BRCR_CMFB (1<<14) /* Ch B */ + +#define UBC_BRCR_CONDITION_MASK_32_2 0x0000f000 +#define UBC_BRCR_BASMA (1<<21) /* Disable ASID check A */ +#define UBC_BRCR_BASMB (1<<20) /* Disable ASID check B */ +#define UBC_BRCR_SCMFCA (1<<15) /* Ch A, CPU */ +#define UBC_BRCR_SCMFCB (1<<14) /* Ch B, CPU */ +#define UBC_BRCR_SCMFDA (1<<13) /* Ch A, DMAC */ +#define UBC_BRCR_SCMFDB (1<<12) /* Ch B, DMAC */ + +#define UBC_BRCR_CONDITION_MASK_32_4 0xc0c0c0c0 +#define UBC_BRCR_CMFCA (1<<31) /* Ch A, CPU */ +#define UBC_BRCR_CMFPA (1<<30) /* Ch A, DMAC */ +#define UBC_BRCR_CMFCB (1<<23) /* Ch B, CPU */ +#define UBC_BRCR_CMFPB (1<<22) /* Ch B, DMAC */ +#define UBC_BRCR_CMFCC (1<<15) /* Ch C, CPU */ +#define UBC_BRCR_CMFPC (1<<14) /* Ch C, DMAC */ +#define UBC_BRCR_CMFCD (1<<7) /* Ch D, CPU */ +#define UBC_BRCR_CMFPD (1<<6) /* Ch D, DMAC */ + +/* Supported BBR (Break bus cycle register) bits on various SuperH CPUs */ + +#define UBC_BBR_XYE (1<<9) /* Select X/Y bus */ +#define UBC_BBR_XYS (1<<8) /* Select Y Bus */ +#define UBC_BBR_CD1 (1<<7) /* DMAC bus master */ +#define UBC_BBR_CD0 (1<<6) /* CPU bus master */ +#define UBC_BBR_ID1 (1<<5) /* Data access cycle */ +#define UBC_BBR_ID0 (1<<4) /* Inst fetch cycle */ +#define UBC_BBR_RW1 (1<<3) /* Write cycle */ +#define UBC_BBR_RW0 (1<<2) /* Read cycle */ +#define UBC_BBR_SZ1 (1<<1) /* Word access */ +#define UBC_BBR_SZ0 (1<<0) /* Byte access */ + +/* BAMR (Break address mask register) bits on BRCR_16_2 type */ + +#define UBC_BAMR_BASM (1<<2) /* Disable ASID check */ + +/* CBR (Match condition setting register) bits on SH4A CPUs */ + +#define UBC_CBR_MFE (1<<31) /* Match flag enable */ +#define UBC_CBR_AIE (1<<30) /* ASID check enable */ +#define UBC_CBR_MFI0 (1<<24) /* Match flag specify */ +#define UBC_CBR_AIV0 (1<<16) /* ASID specify */ +#define UBC_CBR_DBE (1<<15) /* Data value enable */ +#define UBC_CBR_SZ2 (1<<14) /* Quadword access */ +#define UBC_CBR_SZ1 (1<<13) /* Word access */ +#define UBC_CBR_SZ0 (1<<12) /* byte access */ +#define UBC_CBR_ETBE (1<<11) /* Exc. count value enable */ +#define UBC_CBR_CD0 (1<<6) /* Bus select */ +#define UBC_CBR_ID1 (1<<5) /* Data access cycle */ +#define UBC_CBR_ID0 (1<<4) /* Inst fetch cycle */ +#define UBC_CBR_RW1 (1<<2) /* Write cycle */ +#define UBC_CBR_RW0 (1<<1) /* Read cycle */ +#define UBC_CBR_CE (1<<0) /* Channel enable */ + +/* CRR (Match operation setting register) bits on SH4A CPUs */ + +#define UBC_CRR_RESERVE_13 (1<<13) /* reserved bit. write value + * always should be 1. + */ +#define UBC_CRR_PCB (1<<1) /* PC break after inst exec */ +#define UBC_CRR_BIE (1<<0) /* break enable */ + +/* CCMFR (Chennel match flag register) bits on SH4A CPUs */ + +#define UBC_CCMFR_MF1 (1<<1) /* chan 1 cond. match flag */ +#define UBC_CCMFR_MF0 (1<<0) /* chan 0 cond. match flag */ + + +#ifndef _ASMLANGUAGE + +/* structure to manage hardware breakpoint registers */ + +typedef struct + { + UINT32 bar[MAX_CHAN]; /* break address register A */ + union { + UINT16 bbr[MAX_CHAN]; /* break bus cycle register A */ + UINT32 cbr[MAX_CHAN >> 1]; /* match condition setting register */ + } u_mcr; + UINT32 type[MAX_CHAN]; /* brkpt register type */ + UINT32 brcr; /* break control register */ + } DBG_REGS; + +typedef struct + { + UINT32 brcrSize; + UINT32 brcrInit; + UINT32 pBRCR; + UINT32 type[MAX_CHAN]; + UINT32 base[MAX_CHAN]; + } UBC; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void (* _func_wdbUbcInit)(UBC *); + +#else + +extern VOIDFUNCPTR _func_wdbUbcInit; + +#endif /* __STDC__ */ + +#endif /* ! _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCShdbgh */ diff --git a/h/arch/sh/dsmShLib.h b/h/arch/sh/dsmShLib.h new file mode 100644 index 0000000..e90dfb5 --- /dev/null +++ b/h/arch/sh/dsmShLib.h @@ -0,0 +1,250 @@ +/* dsmLib.h - SH disassembler header */ + +/* Copyright 1994-2004 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01o,02dec04,h_k removed dsmInst() prototype. (SPR #104932) +01n,24feb04,h_k added INST_AND_REG_SP. +01m,11feb04,h_k added INST_MOV_IMM32 and INST_SC. +01l,06dec01,h_k added difinitions for INST_POP_REG, INST_ADD_IMM_R14 and + INST_ADD_REG_SP. +01k,14nov00,zl reverted previous change. +01j,14sep00,csi FP - DSP disassemble modification +01i,10may00,hk revised instruction macros to scan GCC 2.96 code. +01h,18apr00,rsh add macros to support dbgRetAdrsGet in dbgArchLib.c +01g,08jun99,zl added SH4 (SH7750) graphics support instructions +01f,08mar99,hk merged SH-DSP defs, shifted FPU instruction type values. +01e,08aug98,kab Fix for DSP movx insn. +01d,10jun98,knr Added support for SH-DSP. +01e,15jun98,hk tweaked FPU instruction types. +01d,21nov97,st added FPU instruction type. +01c,19jun96,hk changed itBraDispRn to itBraDispRm. +01b,25dec94,hk added delayed slot info. +01a,24nov94,hk written based on mc68k 01q. +*/ + +#ifndef __INCdsmShLibh +#define __INCdsmShLibh + + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "arch/sh/ivSh.h" + + +/* dsmLib status codes */ + +#define S_dsmLib_UNKNOWN_INSTRUCTION (M_dsmLib | 1) + + +/* instruction types */ + +#define itComplete 0x01 /* 0 format: "opcode" */ +#define itOneReg 0x02 /* n format: "opcode Rn" */ +#define itStoreCsr 0x03 /* n format: "opcode csr, Rn" */ +#define itAtOneReg 0x04 /* n format: "opcode @Rn" */ +#define itPushCsr 0x05 /* n format: "opcode csr,@-Rn" */ +#define itBraDispRm 0x06 /* m format: "opcode Rm" */ +#define itLoadCsr 0x07 /* m format: "opcode Rm,csr" */ +#define itPopCsr 0x08 /* m format: "opcode @Rm+,csr" */ +#define itTwoReg 0x09 /* nm format: "opcode Rm,Rn" */ +#define itPutRmAtRn 0x0a /* nm format: "opcode Rm,@Rn" */ +#define itGetRnAtRm 0x0b /* nm format: "opcode @Rm,Rn" */ +#define itMac 0x0c /* nm format: "opcode @Rm+,@Rn+" */ +#define itPopReg 0x0d /* nm format: "opcode @Rm+,Rn" */ +#define itPushReg 0x0e /* nm format: "opcode Rm,@-Rn" */ +#define itPutRmAtR0Rn 0x0f /* nm format: "opcode Rm,@(R0,Rn)" */ +#define itGetRnAtR0Rm 0x10 /* nm format: "opcode @(R0,Rm),Rn" */ +#define itGetR0AtDispRm 0x11 /* md format: "opcode @(disp,Rm),R0" */ +#define itPutR0AtDispRn 0x12 /* nd4 format: "opcode R0,@(disp,Rn)" */ +#define itPutRmAtDispRn 0x13 /* nmd format: "opcode Rm,@(disp,Rn)" */ +#define itGetRnAtDispRm 0x14 /* nmd format: "opcode @(disp,Rm),Rn" */ +#define itPutR0AtDispGbr 0x15 /* d format: "opcode R0,@(disp,GBR)" */ +#define itGetR0AtDispGbr 0x16 /* d format: "opcode @(disp,GBR),R0" */ +#define itMova 0x17 /* d format: "opcode @(disp,PC),R0" */ +#define itBraDisp8 0x18 /* d format: "opcode disp" */ +#define itBraDisp12 0x19 /* d12 format: "opcode disp" */ +#define itGetRnAtDispPc 0x1a /* nd8 format: "opcode @(disp,PC),Rn" */ +#define itImmAtR0Gbr 0x1b /* i format: "opcode #imm,@(R0,GBR)" */ +#define itImmToR0 0x1c /* i format: "opcode #imm,R0" */ +#define itImm 0x1d /* i format: "opcode #imm" */ +#define itImmToRn 0x1e /* ni format: "opcode #imm,Rn" */ +#define itGetDispPc 0x1f /* i format; "opcode @(disp,PC)" */ + +/* FPU Instruction types */ + +#define itOneFpReg 0x20 /* fn format: "opcode FRn" */ +#define itTwoFpReg 0x21 /* fnfm format: "opcode FRm,FRn" */ +#define itFloadFpul 0x22 /* fm format: "opcode FRm,FPUL" */ +#define itFstoreFpul 0x23 /* fn format: "opcode FPUL,FRn" */ +#define itThreeFpReg 0x24 /* fnfm format: "opcode FR0,FRm,FRn" */ +#define itGetFRnAtR0Rm 0x25 /* fnm format: "opcode @(R0,Rm),FRn" */ +#define itPopFRn 0x26 /* fnm format: "opcode @Rm+,FRn" */ +#define itGetFRnAtRm 0x27 /* fnm format: "opcode @Rm,FRn" */ +#define itPutFRmAtR0Rn 0x28 /* nfm format: "opcode FRm,@(R0,Rn)" */ +#define itPushFRm 0x29 /* nfm format: "opcode FRm,@-Rn" */ +#define itPutFRmAtRn 0x2a /* nfm format: "opcode FRm,@Rn" */ +#define itLoadFpscr 0x2b /* m format: "opcode Rm,FPSCR" */ +#define itLoadFpul 0x2c /* m format: "opcode Rm,FPUL" */ +#define itPopFpscr 0x2d /* m format: "opcode @Rm+,FPSCR" */ +#define itPopFpul 0x2e /* m format: "opcode @Rm+,FPUL" */ +#define itStoreFpscr 0x2f /* n format: "opcode FPSCR,Rn" */ +#define itStoreFpul 0x30 /* n format: "opcode FPUL,Rn" */ +#define itPushFpscr 0x31 /* n format: "opcode FPSCR,@-Rn" */ +#define itPushFpul 0x32 /* n format: "opcode FPUL,@-Rn" */ +#define itFipr 0x33 /* VnVm format: "opcode FVm, FVn" */ +#define itFtrv 0x34 /* Vn format: "opcode XMTRX, FVn" */ +#define itConvToDp 0x35 /* Dn format: "opcode FPUL, DRn" */ +#define itConvToSp 0x36 /* Dm format: "opcode DRm, FPUL" */ + +#define itDelay 0x8000 /* indicates that next inst is in delay slot */ +#define itTypeMask 0x00ff /* mask for regular instruction types */ + +typedef struct + { + char *name; + int type; + unsigned short op; + unsigned short mask; + } INST; + + +/* SH DSP instructions */ +/* dsp insn flags */ +#define SH_PMULS 0x00000001 /* padd/pmuls or psub/pmuls */ +#define SH_DCT 0x00000002 /* dct prefix */ +#define SH_DCF 0x00000004 /* dcf prefix */ +#define SH_MOVS 0x00000008 /* movs.[wl] insn */ +#define SH_MOVX 0x00000010 /* movx.w insn */ +#define SH_MOVY 0x00000020 /* movy.w insn */ + +typedef enum { + D_END=0, + D_AS, + D_AX, + D_AY, + D_DAX, + D_DAY, + D_DG, + D_DS, + D_DU, + D_DX, + D_DY, + D_DZ, + D_SE, + D_SF, + D_SX, + D_SY, + D_MACH, + D_MACL, + D_IMM +} SH_DSP_ARG_TYPE; + +/* + * First 16 bits are always like: + * 111110********** + * Second 16 bits are like: + * ????eeffxxyygguu + * ????eeffxxyyzzzz + * 00001iiiiiiizzzz + * where it's possible to have constants in any of + * ee, ff, xx, yy, gg, uu, zzzz + */ +#define EE_SHIFT 10 +#define FF_SHIFT 8 +#define GG_SHIFT 2 +#define UU_SHIFT 0 +#define XX_SHIFT 6 +#define YY_SHIFT 4 +#define ZZ_SHIFT 0 +#define EE_3 (0x3 << EE_SHIFT) +#define FF_3 (0x3 << FF_SHIFT) +#define GG_3 (0x3 << GG_SHIFT) +#define UU_3 (0x3 << UU_SHIFT) +#define XX_3 (0x3 << XX_SHIFT) +#define YY_3 (0x3 << YY_SHIFT) +#define ZZ_F (0xF << ZZ_SHIFT) + + +#define MOVX_MASK (0x02ac) +#define MOVY_MASK (0x0153) + + +typedef struct { + char *name; + SH_DSP_ARG_TYPE arg[8]; + ULONG insn; + ULONG mask; + ULONG flags; +} SH_DSP_OPCODE_INFO; + + +/* key instructions for code scanning, shared by trcLib and dbgArchLib */ + +#define INST_POP_REG (0x60f6) /* mov.l @r15+,rm */ +#define MASK_POP_REG (0xf0ff) /* */ + +#define INST_PUSH_REG (0x2f06) /* mov.l rm,@-r15 */ +#define MASK_PUSH_REG (0xff0f) /* */ + +#define INST_ADD_IMM_SP (0x7f00) /* add #imm,r15 */ +#define MASK_ADD_IMM_SP (0xff00) /* */ + +#define INST_ADD_IMM_R14 (0x7e00) /* add #imm,r14 */ +#define MASK_ADD_IMM_R14 (0xff00) /* */ + +#define INST_MOV_IMM32 (0xd000) /* mov.l @(disp,PC),rn */ +#define MASK_MOV_IMM32 (0xf000) /* */ + +#define INST_MOV_IMM16 (0x9000) /* mov.w @(disp,PC),rn */ +#define MASK_MOV_IMM16 (0xf000) /* */ + +#define INST_ADD_REG_SP (0x3f0c) /* add rm,r15 */ +#define MASK_ADD_REG_SP (0xff0f) /* */ + +#define INST_SUB_REG_SP (0x3f08) /* sub rm,r15 */ +#define MASK_SUB_REG_SP (0xff0f) /* */ + +#define INST_AND_REG_SP (0x2f09) /* and rm,r15 */ +#define MASK_AND_REG_SP (0xff0f) /* */ + +#define INST_PUSH_FP (0x2fe6) /* mov.l r14,@-r15 */ +#define INST_SET_FP (0x6ef3) /* mov r15,r14 */ +#define INST_RESTORE_SP (0x6fe3) /* mov r14,r15 */ +#define INST_POP_FP (0x6ef6) /* mov.l @r15+,r14 */ + +#define INST_PUSH_PR (0x4f22) /* sts.l pr,@-r15 */ +#define INST_POP_PR (0x4f26) /* lds.l @r15+,pr */ +#define INST_RTS (0x000b) /* rts */ + +/* for system call code check, shared by trcLib and wdbDbgArchLib */ + +#define INST_SC (0xc300 + (INUM_TRAP_SC & 0xff)) + /* system call: trapa #2 instr on SH3 & SH4 */ + /* trapa #61 instr on SH2 */ +#define INST_SC_MASK (0xffff) + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT int dsmData (USHORT *binInst, int address); +IMPORT int dsmNbytes (USHORT *binInst); + +#else + +IMPORT int dsmData (); +IMPORT int dsmNbytes (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdsmShLibh */ diff --git a/h/arch/sh/dspShLib.h b/h/arch/sh/dspShLib.h new file mode 100644 index 0000000..5b015dd --- /dev/null +++ b/h/arch/sh/dspShLib.h @@ -0,0 +1,111 @@ +/* dspShLib.h - SH Version of DSP Include File */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,15oct04,h_k added externs for PAL coprocessor abstraction. +01c,31aug98,kab added MOD reg. +01b,08aug98,kab filled in dspContext struct. +01a,22jul98,mem written. +*/ + +#ifndef __INCdspShLibh +#define __INCdspShLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "reg.h" +#include "vxWorks.h" + +/* DSP_CONTEXT structure offsets */ +#define DSPREG_SET_RS 0x00 +#define DSPREG_SET_RE 0x04 +#define DSPREG_SET_DSR 0x08 +#define DSPREG_SET_A0 0x0c +#define DSPREG_SET_A1 0x10 +#define DSPREG_SET_A0G 0x14 +#define DSPREG_SET_A1G 0x18 +#define DSPREG_SET_M0 0x1c +#define DSPREG_SET_M1 0x20 +#define DSPREG_SET_X0 0x24 +#define DSPREG_SET_X1 0x28 +#define DSPREG_SET_Y0 0x2c +#define DSPREG_SET_Y1 0x30 +#define DSPREG_SET_MOD 0x34 + +/* DSP DSR configurations */ +#define DSR_CS_OFFSET 1 +#define DSR_CARRY_MODE (0x0 << DSR_CS_OFFSET) +#define DSR_NEGATIVE_MODE (0x1 << DSR_CS_OFFSET) +#define DSR_ZERO_MODE (0x2 << DSR_CS_OFFSET) +#define DSR_OVERFLOW_MODE (0x3 << DSR_CS_OFFSET) +#define DSR_SIGNED_GT_MODE (0x4 << DSR_CS_OFFSET) +#define DSR_SIGNED_GE_MODE (0x5 << DSR_CS_OFFSET) + +#ifndef _ASMLANGUAGE + +typedef struct dspContext /* Dsp Context */ + { + ULONG rs; /* repeat start reg */ + ULONG re; /* repeat end reg */ + ULONG dsr; /* DSP status reg */ + ULONG a0; /* A0 data register */ + ULONG a1; /* A1 data register */ + ULONG a0g; /* A0 Guard register */ + ULONG a1g; /* A1 Guard register */ + ULONG m0; /* M0 data register */ + ULONG m1; /* M1 data register */ + ULONG x0; /* X0 data register */ + ULONG x1; /* X1 data register */ + ULONG y0; /* Y0 data register */ + ULONG y1; /* Y1 data register */ + ULONG mod; /* MODulo register */ + } DSP_CONTEXT; + +#define DSPREG_SET DSP_CONTEXT + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT void dspArchInit (void); +IMPORT void dspArchTaskCreateInit (DSP_CONTEXT *pDspContext); +IMPORT void dspFlushInit (void); +IMPORT UINT dspQueueInit (void); +IMPORT STATUS dspProbeSup (void); +IMPORT void dspSave (DSP_CONTEXT *); +IMPORT void dspRestore (DSP_CONTEXT *); +IMPORT STATUS dspEnable (void); +IMPORT STATUS dspDisable (void); +IMPORT void dspCtxShow (DSP_CONTEXT *); +IMPORT STATUS dspCtxDelete (DSP_CONTEXT *); +IMPORT DSP_CONTEXT * dspCtxCreate (int); + +#else + +IMPORT void dspArchInit (); +IMPORT void dspArchTaskCreateInit (); +IMPORT void dspFlushInit (); +IMPORT UINT dspQueueInit (); +IMPORT STATUS dspProbeSup (); +IMPORT void dspSave (); +IMPORT void dspRestore (); +IMPORT STATUS dspEnable (); +IMPORT STATUS dspDisable (); +IMPORT void dspCtxShow (); +IMPORT STATUS dspCtxDelete (); +IMPORT DSP_CONTEXT * dspCtxCreate (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdspShLibh */ diff --git a/h/arch/sh/elfSh.h b/h/arch/sh/elfSh.h new file mode 100644 index 0000000..9b2be1d --- /dev/null +++ b/h/arch/sh/elfSh.h @@ -0,0 +1,116 @@ +/* elfsh.h - Hitachi SH especific elf loader header */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software may be + * licensed only pursuant to the terms of an applicable Wind River license + * agreement. + */ + +/* +modification history +-------------------- +01e,25jul05,v_r Updated copyright. +01d,06jun05,mcm Adding relocations required for SH shared library support. +01c,04jun99,zl hitachi SH4 architecture port, provided by Highlander + Engineering +01b,21apr99,nd Added support for SH7750 +01a,26aug98,cs initial try at SH elf based on elfPpc.h, v01c +*/ + +#ifndef __INCelfShLibh +#define __INCelfShLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#define EM_ARCH_MACHINE EM_SH + +/* relocation type definition */ +#define R_SH_NONE 0 /* No relocation. */ +#define R_SH_DIR32 1 /* 32 bit absolute relocation */ +#define R_SH_REL32 2 /* 32 bit PC relative relocation. */ +#define R_SH_DIR8WPN 3 /* 8 bit PC relative branch divided by 2. */ +#define R_SH_IND12W 4 /* 12 bit PC relative branch divided by 2. */ +#define R_SH_DIR8WPL 5 /* 8 bit unsigned PC relative divided by 4. */ +#define R_SH_DIR8WPZ 6 /* 8 bit unsigned PC relative divided by 2. */ + + /* 8 bit GBR relative. XXX: This only makes sense if we have some + special symbol for the GBR relative area, and that is not + implemented. */ +#define R_SH_DIR8BP 7 + + /* 8 bit GBR relative divided by 2. XXX: This only makes sense if + we have some special symbol for the GBR relative area, and that + is not implemented. */ +#define R_SH_DIR8W 8 + + /* 8 bit GBR relative divided by 4. XXX: This only makes sense if + we have some special symbol for the GBR relative area, and that + is not implemented. */ +#define R_SH_DIR8L 9 + +#define FIRST_INVALID_RELOC 10 +#define LAST_INVALID_RELOC 24 + + /* The remaining relocs are a GNU extension used for relaxing. The + final pass of the linker never needs to do anything with any of + these relocs. Any required operations are handled by the + relaxation code. We use the same constants as COFF uses, not that + it really matters. */ + + /* A 16 bit switch table entry. This is generated for an expression + such as ``.word L1 - L2''. The offset holds the difference + between the reloc address and L2. */ +#define R_SH_SWITCH16 25 + + /* A 32 bit switch table entry. This is generated for an expression + such as ``.long L1 - L2''. The offset holds the difference + between the reloc address and L2. */ +#define R_SH_SWITCH32 26 + + /* Indicates a .uses pseudo-op. The compiler will generate .uses + pseudo-ops when it finds a function call which can be relaxed. + The offset field holds the PC relative offset to the instruction + which loads the register used in the function call. */ +#define R_SH_USES 27 + + /* The assembler will generate this reloc for addresses referred to + by the register loads associated with USES relocs. The offset + field holds the number of times the address is referenced in the + object file. */ +#define R_SH_COUNT 28 + + /* Indicates an alignment statement. The offset field is the power + of 2 to which subsequent portions of the object file must be + aligned. */ +#define R_SH_ALIGN 29 + + /* The assembler will generate this reloc before a block of + instructions. A section should be processed as assumining it + contains data, unless this reloc is seen. */ +#define R_SH_CODE 30 + + /* The assembler will generate this reloc after a block of + instructions when it sees data that is not instructions. */ +#define R_SH_DATA 31 + + /* The assembler generates this reloc for each label within a block + of instructions. This permits the linker to avoid swapping + instructions which are the targets of branches. */ +#define R_SH_LABEL 32 + +#define R_SH_GOT32 160 +#define R_SH_COPY 162 +#define R_SH_GLOB_DAT 163 +#define R_SH_JMP_SLOT 164 +#define R_SH_RELATIVE 165 + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCelfShLibh */ diff --git a/h/arch/sh/esfSh.h b/h/arch/sh/esfSh.h new file mode 100644 index 0000000..dd5f5a7 --- /dev/null +++ b/h/arch/sh/esfSh.h @@ -0,0 +1,49 @@ +/* esf.h - SH exception stack frames */ + +/* Copyright 1994-2004 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01i,06may04,h_k added pteh in ESFSH. +01h,22oct02,hk updated comment on ESFSH structure. +01g,31aug01,hk put PTEH.ASID in upper half of event field in ESFSH. +01f,21aug00,hk merge SH7729 to SH7700. +01e,16jul98,st added SH7750 support. +01d,06may98,jmc added support for SH-DSP and SH3-DSP CPU types. +01c,17feb97,hk added event to ESFSH for SH7700, renamed aa to info. +01b,09feb97,hk added aa to ESFSH for SH7700. +01a,30oct94,hk taken from 68k 01h. +*/ + +#ifndef __INCesfShh +#define __INCesfShh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* Exception stack frames. Most of these can happen only for one + CPU or another, but they are all defined for all CPU's */ + +/* ESFSH: just one stack frame defined for SH architecture. */ + +typedef struct + { + INSTR *pc; /* program counter */ + ULONG sr; /* status register */ +#if (CPU==SH7750 || CPU==SH7700) + ULONG pteh; /* page table entry high */ + UINT32 event; /* (MMUCR.AT << 31) | (PTEH.ASID << 16) | (EXPEVT) */ + UINT32 info; /* TRA/TEA/FPSCR register */ +#endif + } ESFSH; + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCesfShh */ diff --git a/h/arch/sh/excShLib.h b/h/arch/sh/excShLib.h new file mode 100644 index 0000000..7244f6e --- /dev/null +++ b/h/arch/sh/excShLib.h @@ -0,0 +1,130 @@ +/* excShLib.h - exception library header */ + +/* Copyright 1994-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02b,02dec04,h_k removed excFormatDbl and excFormatFlt prototype. (SPR #104932) +02a,26nov03,pes Correct _WRS_IS_SUPV_EXC macro. +01z,18nov03,pes Add _WRS_IS_SUPV_EXC macro. +01y,22oct01,hk added excPciMapInit() prototype for SH7751 virtual PCI support. +01x,27sep01,hk inserted asid to EXC_INFO, changed vecNum field to UINT8. +01w,21aug00,hk merge SH7729 to SH7700. merge SH7410 and SH7040 to SH7600. +01v,12jul00,hk added excFormatFlt()/excFormatDbl() function prototypes. +01u,20apr00,hk declared excBErrVecInit() and _func_excBErrIntAck. +01t,16jul98,st added SH7750 support. +01s,06may98,jmc added support for the SH-DSP and SH3-DSP CPU types. +01r,12may98,hk added EXC_FPSCR def. +01q,25nov97,hk changed comment for vecNum in EXC_INFO. +01p,22apr97,hk changed 704X to 7040. +01o,17feb97,hk changed accessAddr to info in EXC_INFO. added EXC_TRAP def. +01n,04jan97,hk added accessAddr and pad to EXC_INFO. def'd EXC_ACCESS_ADDR. +01m,15nov96,wt added declarations for mmuStub[] and mmuStubSize. +01l,09aug96,hk moved HIGH_VEC, LOW_VEC, TRAP_32_VEC, USER_VEC_START to ivSh.h. +01k,08aug96,hk localized TRAP_32_VEC/USER_VEC_START to non-SH3 cpus. changed + HIGH_VEC for SH7700. deleted SH7700_TRA, SH7700_EXPEVT, and + SH7700_INTEVT. also localized excBsrTblBErr/excBsrTbl to non- + SH3 cpus. +01j,29jul96,hk deleted declarations of intStub/intStubSize. +01i,11jul96,ja added SH7700_OFF_EXP SH7700_OFF_TLB SH7700_OFF_INT for SH7700. +01h,13jun96,hk added LOW_VEC and HIGH_VEC for SH7700. +01g,21may96,hk deleted HIGH_VEC for SH7700. +01f,13may96,hk added support for SH7700. +01e,18dec95,hk added support for SH704X. +01d,03jul95,hk fixed HIGH_VEC to 127 from 255. +01c,27mar95,hk added bus error support. copyright 1995. +01b,30oct94,hk EXC_INFO has been truncated to 12 bytes in alpha stage. + renamed excType to vecNum, EXC_TYPE to EXC_VEC_NUM. + added LOW_VEC, TRAP_32_VEC, USER_VEC_START, HIGH_VEC. + added excBsrTbl[] declaration. +01a,29jun94,hk written (EXC_INFO is temporalily adjusted to 20 bytes.) +*/ + +#ifndef __INCexcShLibh +#define __INCexcShLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* generic exception information - + * kept in the tcb of tasks that have caused exceptions + */ +typedef struct + { + UINT16 valid; /* indicators that following fields are valid */ + UINT8 vecNum; /* Vector Number (0 - 255) */ + UINT8 asid; /* Address Space ID (0 - 255) */ + INSTR *pc; /* Program Counter */ + UINT32 sr; /* Status Register */ + UINT32 info; /* TRA/TEA/FPSCR Register */ + UINT32 pad; /* (reserved for future use) */ + } EXC_INFO; + +/* exception info valid bits */ + +#define EXC_VEC_NUM 0x01 /* vector number valid */ +#define EXC_PC 0x02 /* pc valid */ +#define EXC_STATUS_REG 0x04 /* status register valid */ +#define EXC_ACCESS_ADDR 0x08 /* info: access address valid */ +#define EXC_TRAP 0x10 /* info: TRA register valid */ +#define EXC_FPSCR 0x20 /* info: fpscr valid */ +#define EXC_ASID 0x40 /* asid valid */ + +#define _WRS_IS_SUPV_EXC() (((excInfo.sr & SR_BIT_MD) == SR_BIT_MD) ? TRUE : FALSE) + +/* variable declarations */ + +extern FUNCPTR excExcepHook; /* add'l rtn to call when exceptions occur */ + +#if (CPU==SH7600 || CPU==SH7000) +extern int excBsrTblBErr []; /* bus error entry in excALib.s */ +extern int excBsrTbl []; /* table of BSRs in excALib.s */ +#elif (CPU==SH7750 || CPU==SH7700) +extern int excStub []; /* Exception handler (excALib) */ +extern int excStubSize; +extern int mmuStub []; /* TLB mishit handler (excALib) */ +extern int mmuStubSize; +#endif /* CPU==SH7750 || CPU==SH7700 */ +#if (CPU==SH7750) +extern int mmuPciStub []; /* TLB mishit handler for SH7751 (excALib) */ +extern int mmuPciStubSize; +extern int mmuPciStubParams; +extern int mmuPciIoStub[]; +extern int mmuPciIoStubSize; +extern int mmuPciIoStubParams; +extern int mmuStubProper[]; +extern int mmuStubProperSize; +#endif /* CPU==SH7750 */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS excBErrVecInit (int inum); +extern void (* _func_excBErrIntAck)(void); +#if (CPU==SH7750) +extern STATUS excPciMapInit (void *virtAddr, void *physAddr, UINT len, + void *virtIoAddr, void *physIoAddr, UINT lenIo); +#endif /* CPU==SH7750 */ + +#else + +extern STATUS excBErrVecInit (); +extern VOIDFUNCPTR _func_excBErrIntAck; +#if (CPU==SH7750) +extern STATUS excPciMapInit (); +#endif /* CPU==SH7750 */ + +#endif /* __STDC__ */ + +#endif /* ! _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCexcShLibh */ diff --git a/h/arch/sh/fppShLib.h b/h/arch/sh/fppShLib.h new file mode 100644 index 0000000..33c2116 --- /dev/null +++ b/h/arch/sh/fppShLib.h @@ -0,0 +1,159 @@ +/* fppShLib.h - SH Version of Floating-Point Include File */ + +/* Copyright (c) 1994-2005 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01n,09mar05,asa added typedef UNIOND64 and moved constants HREG and LREG + from fppArchShow for use in fppArchShow and fppArchMRegs + moved extern function definitions to usrCoprocSh.c + updated copyright to 2005 + removed if def(__STDC__) || def(__cplusplus) false branch +01m,02dec04,h_k changed fpx size to int. (SPR #104932) +01l,14oct04,h_k align 64 bit for FP_CONTEXT. (SPR #102473) + removed SH7718(SH3e) support and CPU type conditions. + added externs for PAL coprocessor abstraction. +01k,05dec02,hk moved _WRS_HW_FP_SUPPORT from fppShLib.h to archSh.h(SPR#83145) +01j,12sep01,zl added definition of _WRS_HW_FP_SUPPORT. +01i,02oct00,zl moved FPSCR_INIT out of _ASMLANGUAGE conditional. +01h,13jul00,hk made fppRegGet/fppRegSet func prototypes for SH7750 only. +01g,29jun00,hk added FPSCR bit definition. changed FPSCR_INIT for SH7700. + updated function declarations. +01f,28jun00,zl addded FPSCR default value. +01e,20mar00,zl added extended floating point registers to the FP context +01d,20may98,hk added fppProbeSup() and fppProbeTrap() prototypes. +01c,26nov97,hms delete definition of fppProbeSup(). +01b,25nov97,st added FPU registers. +01a,09oct94,hk written - derived from sparc 02j. +*/ + +#ifndef __INCfppShLibh +#define __INCfppShLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "reg.h" +#include "esf.h" + + +/* FP_CONTEXT structure offsets */ + +#define FPUL 0x00 /* OFFSET(FP_CONTEXT, fpul) */ +#define FPSCR 0x04 /* OFFSET(FP_CONTEXT, fpscr) */ +#define FPX 0x08 /* OFFSET(FP_CONTEXT, fpr[0]) */ +#define FPX_OFFSET(n) (FPX + (n)*4) /* OFFSET(FP_CONTEXT, fpr[n]) */ + + +/* FPSCR (Floating Point Status/Control Register) bit definition */ + +#define FPSCR_BANK1_SELECT 0x00200000 +#define FPSCR_FMOV_32BIT_PAIR 0x00100000 +#define FPSCR_DOUBLE_PRECISION 0x00080000 +#define FPSCR_DENORM_TRUNCATE 0x00040000 + +#define FPSCR_CAUSE_FPU_ERROR 0x00020000 +#define FPSCR_CAUSE_INVALID_OP 0x00010000 +#define FPSCR_CAUSE_ZERO_DIVIDE 0x00008000 +#define FPSCR_CAUSE_OVERFLOW 0x00004000 +#define FPSCR_CAUSE_UNDERFLOW 0x00002000 +#define FPSCR_CAUSE_INEXACT 0x00001000 + +#define FPSCR_ENABLE_INVALID_OP 0x00000800 +#define FPSCR_ENABLE_ZERO_DIVIDE 0x00000400 +#define FPSCR_ENABLE_OVERFLOW 0x00000200 +#define FPSCR_ENABLE_UNDERFLOW 0x00000100 +#define FPSCR_ENABLE_INEXACT 0x00000080 + +#define FPSCR_FLAG_INVALID_OP 0x00000040 +#define FPSCR_FLAG_ZERO_DIVIDE 0x00000020 +#define FPSCR_FLAG_OVERFLOW 0x00000010 +#define FPSCR_FLAG_UNDERFLOW 0x00000008 +#define FPSCR_FLAG_INEXACT 0x00000004 + +#define FPSCR_ROUND_MODE_MASK 0x00000003 +#define FPSCR_ROUND_TO_ZERO 0x00000001 +#define FPSCR_ROUND_TO_NEAREST 0x00000000 + +#define FP_NUM_DREGS 32 +#define FPSCR_INIT FPSCR_DOUBLE_PRECISION /* FPSCR_PR */ +#define FPSCR_SZ_PR (FPSCR_INIT | FPSCR_FMOV_32BIT_PAIR) /* FPSCR_SZ_PR*/ +#define _FP_ALIGN_SIZE 8 /* 64 bit */ + +#ifndef _ASMLANGUAGE + +typedef struct fpContext /* Floating-Point Context */ + { + int fpul; /* FPU communication reg. : 4 */ + int fpscr; /* FPU status/control reg.: 4 */ + int fpx[FP_NUM_DREGS]; /* FPU registers : 128 */ + /* TOTAL : 136 */ + } WRS_PACK_ALIGN(_FP_ALIGN_SIZE) FP_CONTEXT; + +#define FPREG_SET FP_CONTEXT + +/* defines */ + +#if (_BYTE_ORDER == _LITTLE_ENDIAN) +# define HREG 1 +# define LREG 0 +#else /* _BYTE_ORDER != _LITTLE_ENDIAN */ +# define HREG 0 +# define LREG 1 +#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ + +/* typedefs */ + +typedef union + { + double d64; + UINT32 u32[2]; + } FPP_UNION64D; + + +/* possible FPU error instructions */ + +#define FPE_MASK_2REG 0xf00f +#define FPE_INSN_FADD 0xf000 /* fadd */ +#define FPE_INSN_FSUB 0xf001 /* fsub */ +#define FPE_INSN_FMUL 0xf002 /* fmul */ +#define FPE_INSN_FDIV 0xf003 /* fdiv */ +#define FPE_INSN_FMAC 0xf00e /* fmac - multiply and accumulate */ + +#define FPE_MASK_1REG 0xf0ff +#define FPE_INSN_FSQRT 0xf06d /* fsqrt */ +#define FPE_INSN_FCNVSD 0xf0ad /* fcnvsd - convert single to double */ +#define FPE_INSN_FCNVDS 0xf0bd /* fcnvds - convert double to single */ + +/* variable declarations */ + +extern REG_INDEX fpRegName[]; /* f-point data register table */ +extern REG_INDEX fpCtlRegName[]; /* f-point control register table */ +extern WIND_TCB *pFppTaskIdPrevious; /* task id for deferred exceptions */ +extern FUNCPTR fppCreateHookRtn; /* arch dependent create hook routine */ +extern FUNCPTR fppDisplayHookRtn; /* arch dependent display routine */ + + +/* function declarations */ + +extern void fppArchInit (void); +extern void fppArchTaskCreateInit (FP_CONTEXT *pFpContext); +extern int fppFpulGet (void); +extern void fppFpulSet (int value); +extern int fppFpscrGet (void); +extern void fppFpscrSet (int value); +extern STATUS fppProbeSup (void); +extern void fppProbeTrap (void); +extern STATUS fppExcHandle (ESFSH *pEsf, REG_SET *pRegs); +extern STATUS fppRegGet (int regnum, UINT32 *p, int sz); +extern STATUS fppRegSet (int regnum, UINT32 *p, int sz); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfppShLibh */ diff --git a/h/arch/sh/in_cksum.h b/h/arch/sh/in_cksum.h new file mode 100644 index 0000000..76cb052 --- /dev/null +++ b/h/arch/sh/in_cksum.h @@ -0,0 +1,177 @@ +/* in_cksum.h - x86 version in_cksum header file */ + +/* Copyright 2001-2002 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from tahoe: in_cksum.c 1.2 86/01/05 + * from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91 + * from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp + * $FreeBSD: src/sys/i386/include/in_cksum.h,v 1.7.2.1 2000/05/05 13:37:00 jlemon Exp $ + */ + +/* +modification history +-------------------- +01f,25aug05,dlk Add section tags. +01e,24mar04,m_h Move to arch/sh +01d,20nov03,niq Remove copyright_wrs.h file inclusion +01c,06nov03,rlm Ran batch header update for header re-org. +01b,25jul02,rvr removed DCC specific code +01a,13sep01,hsh Created from BSD 4.3 +*/ + + +#ifndef _MACHINE_IN_CKSUM_H_ +#define _MACHINE_IN_CKSUM_H_ 1 + +#include + +/* + * in_cksum_hdr - checksum on header only + * + * It is useful to have an Internet checksum routine which is inlineable + * and optimized specifically for the task of computing IP header checksums + * in the normal case (where there are no options and the header length is + * therefore always exactly five 32-bit words. + */ + +static __inline +u_int in_cksum_hdr + ( + const struct ip *ip + ) + { + register u_int sum = 0; + int hlen = sizeof (struct ip); + register u_short *w = (u_short *) ip; + u_short remaining = 0; + + while (hlen > 1) + { + sum += *w++; + hlen -= 2; + } + + if (hlen == 1) + { + *(u_char *) (&remaining) = *(u_char *) w; + sum += remaining; + } + + sum = (sum & 0xffff) + (sum >> 16); + if (sum > 0xffff) + sum -= 0xffff; + + return ~sum & 0xffff; + } + +/* + * in_cksum_update + */ + +static __inline +void in_cksum_update + ( + struct ip *ip + ) + { + int __tmpsum; + __tmpsum = (int)ntohs(ip->ip_sum) + 256; + ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); + } + +/* + * in_pseudo - pre-checksum parts of pseudo-header + * + * Compute significant parts of the IPv4 checksum pseudo-header * for use in a + * delayed TCP/UDP checksum calculation. + * + * Args: + * + * src Source IP address + * dst Destination IP address + * lenproto htons(proto-hdr-len + proto-number) + */ + +static __inline +u_int16_t in_pseudo + ( + u_int32_t src, + u_int32_t dst, + u_int32_t lenproto + ) + { + u_int32_t sum; + + sum = lenproto + + (u_int16_t)(src >> 16) + + (u_int16_t)(src /*& 0xffff*/) + + (u_int16_t)(dst >> 16) + + (u_int16_t)(dst /*& 0xffff*/); + + sum = (u_int16_t)(sum >> 16) + (u_int16_t)(sum /*& 0xffff*/); + + if (sum > 0xffff) + sum -= 0xffff; + + return (sum); + } + +/* + * in_addword - Add two 16-bit workd + * + * Add the two 16-bit network-order values, carry, and return. + */ + +static __inline +u_int16_t in_addword + ( + u_int16_t a, + u_int16_t b + ) + { + u_int32_t sum = a + b; + + if (sum > 0xffff) + sum -= 0xffff; + + return (sum); + } + +_WRS_FASTTEXT +u_short in_cksum_skip(struct mbuf *m, int len, int skip); + +#endif /* _MACHINE_IN_CKSUM_H_ */ + + diff --git a/h/arch/sh/intShLib.h b/h/arch/sh/intShLib.h new file mode 100644 index 0000000..ac1bc43 --- /dev/null +++ b/h/arch/sh/intShLib.h @@ -0,0 +1,46 @@ +/* intShLib.h - SH interrupt library header */ + +/* Copyright 2000-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,11sep00,hk created. +*/ + +#ifndef __INCintShLibh +#define __INCintShLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + +#if defined(__STDC__) || defined(__cplusplus) + +extern void intVBRSet (FUNCPTR *baseAddr); +extern int intSRGet (void); +extern void intSRSet (int value); +extern STATUS (* _func_intConnectHook) (VOIDFUNCPTR *, VOIDFUNCPTR, int); +#if (CPU==SH7750 || CPU==SH7700) +extern STATUS intGlobalSRSet (UINT32 bits, UINT32 mask, int maxTasks); +#endif /* (CPU==SH7750 || CPU==SH7700) */ + +#else + +extern void intVBRSet (); +extern int intSRGet (); +extern void intSRSet (); +extern STATUS (* _func_intConnectHook) (); +#if (CPU==SH7750 || CPU==SH7700) +extern STATUS intGlobalSRSet (); +#endif /* (CPU==SH7750 || CPU==SH7700) */ + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCintShLibh */ diff --git a/h/arch/sh/ivSh.h b/h/arch/sh/ivSh.h new file mode 100644 index 0000000..86c7f5f --- /dev/null +++ b/h/arch/sh/ivSh.h @@ -0,0 +1,411 @@ +/* ivSh.h - interrupt vectors for Renesas SH CPUs */ + +/* Copyright 1994-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02x,27aug04,h_k added IP_MMU_VA_SHIFT and IP_MMU_VA_MASK for AIM MMU. +02w,11may04,h_k changed sys call trap number to 32 to share the number with + SH2. +02v,12feb04,h_k added INUM_TRAP_SC. +02u,04nov03,h_k added TRAP_SC. +02t,12sep03,h_k added system call trap and IP_TMP_FRAME definitions. +02s,20mar02,zl add reserved trap number for RTI tools; correct TMU4 comments. +02r,27sep01,hk added temporary storage for PTEH, PTEL, and MMUCR. +02q,11sep01,hk renamed WRS private VBR offset macros to IP_XXX. shifted stub + offsets to make room for temporal register storage. +02p,11sep01,h_k added USB Host Controller support for SH7727 (SPR #69831). +02o,21aug00,hk merge SH7729 to SH7700. merge SH7410 to SH7600. + move chip specific definitions to sh7xxx.h. +02n,06aug00,hk moved SH7040 specific definitions to sh7040.h. +02m,01jun00,frf SH7751 intevt: PCI, MPX, timer 3 and 4. +02l,18apr00,hk rearranged vbr relative offset macros for SH4/SH3. +02k,10apr00,hk added vbr relative offsets for text and data in P1/P2. +02j,05mar99,hk sorted out CPU conditionals. +02i,29dec98,hk merged for SH7750,SH7729,SH7700,SH7600,SH7410,SH7040,SH7000. +02h,07oct98,jmb clean up SH7410. +02g,04jun98,jmc added support for SH-DSP and SH3-DSP CPU types. +02f,25may98,jmb Deleted unnecessary ifdef. +02e,25may98,jmb Correct name of transmit-end interrupt for SCI. +02d,23may98,jmb Added macros for serial FIFO interrupts for SH7700. +02e,16sep98,hk merged SH7750/SH7700 defs. +02d,16jul98,st added SH7750 support. +02b,26nov97,hms added fpp support definition. +02c,25nov97,hk changed interrupt vector number definition for SH7700. +02b,21nov97,hk fixed IVEC_TO_INUM macro. +02a,22apr97,hk changed 704X to 7040. +01z,16feb97,hk deleted unused INUMs. changed INUM_EXC_LOW to 0x000, INUM_EXC + _HIGH to 0x1e0. added INUMs for SH7707. added INUM_TRAP_128. +01y,09feb97,hk added INUM_TRAP_1 for SH7700 zero div, deleted INUM_TRAP_254. +01x,19aug96,hk added INUM_TRAP_254 for SH7700 zero divide signal. +01w,19aug96,hk added INUM_SPURIOUS_INTERRUPT for SH7700. +01v,09aug96,hk moved in HIGH_VEC, LOW_VEC, TRAP_32_VEC, USER_VEC_START from + excShLib.h. created INUM_EXC_LOW, INUM_EXC_HIGH, INUM_INTR_LOW, + INUM_INTR_HIGH for SH7700. +01u,09aug96,hk put CPU macro check code on top. added INUM_TRAP_0/INUM_TRAP_ + 255 for SH7700. changed IV_TRAP() macro for SH7700. changed + code layout. +01t,08aug96,hk changed SH7700_VEC_OFFSET to SH7700_VEC_TABLE_OFFSET. added + SH7700_EXC_STUB_OFFSET, SH7700_TLB_STUB_OFFSET, SH7700_INT_ + STUB_OFFSET. +01s,06aug96,hk changed SH7700_VEC_OFFSET to 0x800 from 0x700. +01r,04aug96,hk changed ENUM_xxx to INUM_xxx. +01q,26jun96,ja added IV_USER_BREAK & IV_TRAP for SH7700. +01p,12jun96,hk added SH7700_VEC_OFFSET & _ASMLANGUAGE control. +01o,07jun96,hk changed IVEC_TO_INUM & INUM_TO_IVEC defs for SH7700. +01n,24may96,ja added macro IVEC_TO_INUM & INUM_TO_IVEC for SH7700. +01m,19may96,hk changed ICODE_IRLx defs. +01l,12may96,hk added ECODE/ICODE for SH7700. +01k,18jan96,hk added comments. +01j,19dec95,hk added support for SH704X. +01i,15nov95,hk added comment for INUM_TRAP_62 (zero divide trap). +01h,15aug95,hk deleted INUM_VIRT_BASE, made this configurable in BSP. +01g,19jun95,hk added INUM_VIRT_BASE. +01f,31mar95,hk added interrupt number definition. +01e,28feb95,hk changed all IV_ defs from vector number to vector itself. +01d,08feb95,sa deleted DGA-001 vectors (IV_DIVU ... IV_SW_IRQ7). +01c,05oct94,sa added DGA-001 vectors ( must move to h/drv/vme/dga001.h ) +01b,21jun94,sa added '#if (CPU==SH7600) #else (CPU==SH7000)'. +01a,15jun94,hk written. +*/ + +#ifndef __INCivShh +#define __INCivShh + +#ifdef __cplusplus +extern "C" { +#endif + +#if (CPU!=SH7750 && CPU!=SH7700 && CPU!=SH7600 && CPU!=SH7000) +#error The CPU macro is not defined correctly +#endif + + +#if (CPU==SH7750 || CPU==SH7700) + +/* interrupt vector numbers */ + +/*---------------------------------------------------------------------------*/ +/* exception/interrupt name (code >> 5) No. vector entry point */ +/*---------------------------------------------------------------------------*/ +#define INUM_EXC_LOW (0x000 >> 5) /* -exception lower limit- */ +/* INUM_RESET_PWRON (0x000 >> 5) 0 0x000 (0xa0000000) */ +/* INUM_RESET_MANUAL (0x020 >> 5) 1 0x004 (0xa0000000) */ +#define INUM_TLB_READ_MISS (0x040 >> 5) /* 2 0x008 (vbr + 0x400) */ +#define INUM_TLB_WRITE_MISS (0x060 >> 5) /* 3 0x00c (vbr + 0x400) */ +#define INUM_TLB_WRITE_INITIAL_PAGE (0x080 >> 5) /* 4 0x010 (vbr + 0x100) */ +#define INUM_TLB_READ_PROTECTED (0x0a0 >> 5) /* 5 0x014 (vbr + 0x100) */ +#define INUM_TLB_WRITE_PROTECTED (0x0c0 >> 5) /* 6 0x018 (vbr + 0x100) */ +#define INUM_READ_ADDRESS_ERROR (0x0e0 >> 5) /* 7 0x01c (vbr + 0x100) */ +#define INUM_WRITE_ADDRESS_ERROR (0x100 >> 5) /* 8 0x020 (vbr + 0x100) */ +#define INUM_FPU_EXCEPTION (0x120 >> 5) /* 9 0x024 (vbr + 0x100) */ +#define INUM_TLB_MULTIPLE_HIT (0x140 >> 5) /* 10 0x028 (0xa0000000) */ +#define INUM_TRAPA_INSTRUCTION (0x160 >> 5) /* 11 0x02c (vbr + 0x100) */ +#define INUM_ILLEGAL_INST_GENERAL (0x180 >> 5) /* 12 0x030 (vbr + 0x100) */ +#define INUM_ILLEGAL_INST_SLOT (0x1a0 >> 5) /* 13 0x034 (vbr + 0x100) */ +#define INUM_NMI (0x1c0 >> 5) /* 14 0x038 (vbr + 0x600) */ +#define INUM_USER_BREAK_TRAP (0x1e0 >> 5) /* 15 0x03c (vbr + 0x100) */ +#define INUM_EXC_HIGH (0x1e0 >> 5) /* -exception upper limit- */ +#define INUM_INTR_LOW (0x200 >> 5) /* -interrupt lower limit- */ +#define INUM_IRL15 (0x200 >> 5) /* 16 0x040 (vbr + 0x600) */ +#define INUM_IRL14 (0x220 >> 5) /* 17 0x044 (vbr + 0x600) */ +#define INUM_IRL13 (0x240 >> 5) /* 18 0x048 (vbr + 0x600) */ +#define INUM_IRL12 (0x260 >> 5) /* 19 0x04c (vbr + 0x600) */ +#define INUM_IRL11 (0x280 >> 5) /* 20 0x050 (vbr + 0x600) */ +#define INUM_IRL10 (0x2a0 >> 5) /* 21 0x054 (vbr + 0x600) */ +#define INUM_IRL9 (0x2c0 >> 5) /* 22 0x058 (vbr + 0x600) */ +#define INUM_IRL8 (0x2e0 >> 5) /* 23 0x05c (vbr + 0x600) */ +#define INUM_IRL7 (0x300 >> 5) /* 24 0x060 (vbr + 0x600) */ +#define INUM_IRL6 (0x320 >> 5) /* 25 0x064 (vbr + 0x600) */ +#define INUM_IRL5 (0x340 >> 5) /* 26 0x068 (vbr + 0x600) */ +#define INUM_IRL4 (0x360 >> 5) /* 27 0x06c (vbr + 0x600) */ +#define INUM_IRL3 (0x380 >> 5) /* 28 0x070 (vbr + 0x600) */ +#define INUM_IRL2 (0x3a0 >> 5) /* 29 0x074 (vbr + 0x600) */ +#define INUM_IRL1 (0x3c0 >> 5) /* 30 0x078 (vbr + 0x600) */ +/* (0x3e0 >> 5) 31 0x07c - reserved - */ +#define INUM_TMU0_UNDERFLOW (0x400 >> 5) /* 32 0x080 (vbr + 0x600) */ +#define INUM_TMU1_UNDERFLOW (0x420 >> 5) /* 33 0x084 (vbr + 0x600) */ +#define INUM_TMU2_UNDERFLOW (0x440 >> 5) /* 34 0x088 (vbr + 0x600) */ +#define INUM_TMU2_INPUT_CAPTURE (0x460 >> 5) /* 35 0x08c (vbr + 0x600) */ +#define INUM_RTC_ALARM (0x480 >> 5) /* 36 0x090 (vbr + 0x600) */ +#define INUM_RTC_PERIODIC (0x4a0 >> 5) /* 37 0x094 (vbr + 0x600) */ +#define INUM_RTC_CARRY (0x4c0 >> 5) /* 38 0x098 (vbr + 0x600) */ +#define INUM_SCI_RX_ERROR (0x4e0 >> 5) /* 39 0x09c (vbr + 0x600) */ +#define INUM_SCI_RX (0x500 >> 5) /* 40 0x0a0 (vbr + 0x600) */ +#define INUM_SCI_TX (0x520 >> 5) /* 41 0x0a4 (vbr + 0x600) */ +#define INUM_SCI_TX_END (0x540 >> 5) /* 42 0x0a8 (vbr + 0x600) */ +#define INUM_WDT_INTERVAL_TIMER (0x560 >> 5) /* 43 0x0ac (vbr + 0x600) */ +#define INUM_BSC_REFRESH_CMI (0x580 >> 5) /* 44 0x0b0 (vbr + 0x600) */ +#define INUM_BSC_REFRESH_OVF (0x5a0 >> 5) /* 45 0x0b4 (vbr + 0x600) */ +/* (0x5c0 >> 5) 46 0x0b8 (vbr + 0x600) */ +/* (0x5e0 >> 5) 47 0x0bc (vbr + 0x600) */ +#endif /* CPU==SH7750 || CPU==SH7700 */ + +#if (CPU==SH7750) +#define INUM_JTAG (0x600 >> 5) /* 48 0x0c0 */ +#define INUM_GPIO (0x620 >> 5) /* 49 0x0c4 (vbr + 0x600) */ +#define INUM_DMAC_DMTE0 (0x640 >> 5) /* 50 0x0c8 (vbr + 0x600) */ +#define INUM_DMAC_DMTE1 (0x660 >> 5) /* 51 0x0cc (vbr + 0x600) */ +#define INUM_DMAC_DMTE2 (0x680 >> 5) /* 52 0x0d0 (vbr + 0x600) */ +#define INUM_DMAC_DMTE3 (0x6a0 >> 5) /* 53 0x0d4 (vbr + 0x600) */ +#define INUM_DMAC_DMTER (0x6c0 >> 5) /* 54 0x0d8 (vbr + 0x600) */ +/* (0x6e0 >> 5) 55 0x0dc (vbr + 0x600) */ +#define INUM_SCIF2_ERROR (0x700 >> 5) /* 56 0x0e0 (vbr + 0x600) */ +#define INUM_SCIF2_RX (0x720 >> 5) /* 57 0x0e4 (vbr + 0x600) */ +#define INUM_SCIF2_BREAK (0x740 >> 5) /* 58 0x0e8 (vbr + 0x600) */ +#define INUM_SCIF2_TX (0x760 >> 5) /* 59 0x0ec (vbr + 0x600) */ +#define INUM_SH_BUS (0x780 >> 5) /* 60 0x0f0 (vbr + 0x600) */ +/* (0x7a0 >> 5) 61 0x0f4 (vbr + 0x600) */ +/* (0x7c0 >> 5) 62 0x0f8 (vbr + 0x600) */ +/* (0x7e0 >> 5) 63 0x0fc (vbr + 0x600) */ +#define INUM_FPU_DISABLE (0x800 >> 5) /* 64 0x100 (vbr + 0x600) */ +#define INUM_SLOT_FPU_DISABLE (0x820 >> 5) /* 65 0x104 (vbr + 0x600) */ +/* (0x840 >> 5) - 66 0x108 to (0xbe0 >> 5) - 79 0x13c (vbr + 0x600) */ +#define INUM_PCI_SERR (0xa00 >> 5) /* 80 0x140 (vbr + 0x600) */ +#define INUM_PCI_DMA3 (0xa20 >> 5) /* 81 0x144 (vbr + 0x600) */ +#define INUM_PCI_DMA2 (0xa40 >> 5) /* 82 0x148 (vbr + 0x600) */ +#define INUM_PCI_DMA1 (0xa60 >> 5) /* 83 0x14c (vbr + 0x600) */ +#define INUM_PCI_DMA0 (0xa80 >> 5) /* 84 0x150 (vbr + 0x600) */ +#define INUM_PCI_PWONREQ (0xaa0 >> 5) /* 85 0x154 (vbr + 0x600) */ +#define INUM_PCI_PWDWREQ (0xac0 >> 5) /* 85 0x158 (vbr + 0x600) */ +#define INUM_PCI_ERR (0xae0 >> 5) /* 87 0x15c (vbr + 0x600) */ +#define INUM_TMU3_UNDERFLOW (0xb00 >> 5) /* 88 0x160 (vbr + 0x600) */ +/* (0xb20 >> 5) 89 0x164 (vbr + 0x600) */ +/* (0xb40 >> 5) 90 0x168 (vbr + 0x600) */ +/* (0xb60 >> 5) 91 0x16c (vbr + 0x600) */ +#define INUM_TMU4_UNDERFLOW (0xb80 >> 5) /* 92 0x170 (vbr + 0x600) */ + +#endif /* CPU==SH7750 */ + +#if (CPU==SH7700) +#define INUM_IRQ0 (0x600 >> 5) /* 48 0x0c0 (vbr + 0x600) */ +#define INUM_IRQ1 (0x620 >> 5) /* 49 0x0c4 (vbr + 0x600) */ +#define INUM_IRQ2 (0x640 >> 5) /* 50 0x0c8 (vbr + 0x600) */ +#define INUM_IRQ3 (0x660 >> 5) /* 51 0x0cc (vbr + 0x600) */ +#define INUM_IRQ4 (0x680 >> 5) /* 52 0x0d0 (vbr + 0x600) */ +#define INUM_IRQ5 (0x6a0 >> 5) /* 53 0x0d4 (vbr + 0x600) */ +/* (0x6c0 >> 5) 54 0x0d8 (vbr + 0x600) */ +/* (0x6e0 >> 5) 55 0x0dc (vbr + 0x600) */ +#define INUM_PINT0_TO_PINT7 (0x700 >> 5) /* 56 0x0e0 (vbr + 0x600) */ +#define INUM_PINT8_TO_PINT15 (0x720 >> 5) /* 57 0x0e4 (vbr + 0x600) */ +/* (0x740 >> 5) 58 0x0e8 (vbr + 0x600) */ +/* (0x760 >> 5) 59 0x0ec (vbr + 0x600) */ +/* (0x780 >> 5) 60 0x0f0 (vbr + 0x600) */ +/* (0x7a0 >> 5) 61 0x0f4 (vbr + 0x600) */ +/* (0x7c0 >> 5) 62 0x0f8 (vbr + 0x600) */ +/* (0x7e0 >> 5) 63 0x0fc (vbr + 0x600) */ +#define INUM_DMAC0 (0x800 >> 5) /* 64 0x100 (vbr + 0x600) */ +#define INUM_DMAC1 (0x820 >> 5) /* 65 0x104 (vbr + 0x600) */ +#define INUM_DMAC2 (0x840 >> 5) /* 66 0x108 (vbr + 0x600) */ +#define INUM_DMAC3 (0x860 >> 5) /* 67 0x10c (vbr + 0x600) */ +#define INUM_SCIF1_ERROR (0x880 >> 5) /* 68 0x110 (vbr + 0x600) */ +#define INUM_SCIF1_RX (0x8a0 >> 5) /* 69 0x114 (vbr + 0x600) */ +#define INUM_SCIF1_BREAK (0x8c0 >> 5) /* 70 0x118 (vbr + 0x600) */ +#define INUM_SCIF1_TX (0x8e0 >> 5) /* 71 0x11c (vbr + 0x600) */ +#define INUM_SCIF2_ERROR (0x900 >> 5) /* 72 0x120 (vbr + 0x600) */ +#define INUM_SCIF2_RX (0x920 >> 5) /* 73 0x124 (vbr + 0x600) */ +#define INUM_SCIF2_BREAK (0x940 >> 5) /* 74 0x128 (vbr + 0x600) */ +#define INUM_SCIF2_TX (0x960 >> 5) /* 75 0x12c (vbr + 0x600) */ +#define INUM_AD (0x980 >> 5) /* 76 0x130 (vbr + 0x600) */ +#define INUM_LCD (0x9a0 >> 5) /* 77 0x134 (vbr + 0x600) */ +#define INUM_PC_CARD0 (0x9c0 >> 5) /* 78 0x138 (vbr + 0x600) */ +#define INUM_PC_CARD1 (0x9e0 >> 5) /* 79 0x13c (vbr + 0x600) */ +#define INUM_USB_H (0xa00 >> 5) /* 80 0x140 (vbr + 0x600) */ +#define INUM_USB_F0 (0xa20 >> 5) /* 81 0x142 (vbr + 0x600) */ +#define INUM_USB_F1 (0xa40 >> 5) /* 82 0x144 (vbr + 0x600) */ +#endif /* CPU==SH7700 */ + +#if (CPU==SH7750 || CPU==SH7700) +#define INUM_INTR_HIGH (0xfe0 >> 5) /*127 0x1fc -upper limit- */ +#define INUM_TRAP_0 0 /* 0 0x000 -lower limit- */ +#define INUM_TRAP_1 1 /* 1 0x004 (zero divide) */ +#define INUM_TRAP_32 32 /* 32 0x080 (system call) */ +#define INUM_TRAP_SC INUM_TRAP_32 +#define INUM_TRAP_128 128 /*128 0x200 (=0xfe0+0x20) */ +#define INUM_TRAP_255 255 /*255 0x3fc -upper limit- */ + +#define TRAP_SC (INUM_TRAP_SC << 2) /* 0x80 (system call trap number)<<2 */ + +/*--------------------------------------------------------------------------*/ + +/* VBR-relative offsets (WRS private). These definitions are shared by: + * excALib, excArchLib, intArchLib, sigCtxALib, vxALib, windALib + */ + +#define SH7700_NULL_EVT_CNT_OFFSET 0x000 /* spurious interrupt counter */ +#define SH7700_INT_EVT_ADRS_OFFSET 0x004 /* INTEVT register address */ +#define SH7700_ARE_WE_NESTED_OFFSET 0x008 /* areWeNested */ +#define SH7700_INT_STACK_BASE_OFFSET 0x00c /* intStackBase */ +#define SH7700_MMU_VA_SHIFT_OFFSET 0x01c /* mmuVaddrShift */ +#define SH7700_MMU_VA_MASK_OFFSET 0x01e /* mmuVaddrMask */ +#define SH7700_DISPATCH_STUB_OFFSET 0x040 /* _dispatchStub: */ +#define SH7700_INT_EXIT_STUB_OFFSET 0x080 /* _intExitStub: */ +#define SH7700_EXC_BERR_STUB_OFFSET 0x0b0 /* _excBErrStub: */ +#define SH7700_MEMPROBE_INT_STUB_OFFSET 0x0e0 /* _vxMemProbeIntStub: */ +#define SH7700_EXC_STUB_OFFSET 0x100 /* EXception Vector offset */ +#define SH7700_TLB_STUB_OFFSET 0x400 /* TLB miss Vector offset */ +#define SH7700_INT_STUB_OFFSET 0x600 /* INTerrupt Vector offset */ +#define SH7700_VEC_TABLE_OFFSET 0x800 /* virtual vector table */ +#define SH7700_INT_PRIO_TABLE_OFFSET 0xc00 /* interrupt priority table */ + +#define IP_NULL_EVT_CNT SH7700_NULL_EVT_CNT_OFFSET +#define IP_INT_EVT_ADRS SH7700_INT_EVT_ADRS_OFFSET +#define IP_ARE_WE_NESTED SH7700_ARE_WE_NESTED_OFFSET +#define IP_INT_STACK_BASE SH7700_ARE_WE_NESTED_OFFSET +#define IP_MMU_VA_SHIFT SH7700_MMU_VA_SHIFT_OFFSET +#define IP_MMU_VA_MASK SH7700_MMU_VA_MASK_OFFSET +#define IP_DISPATCH_STUB SH7700_DISPATCH_STUB_OFFSET +#define IP_INT_EXIT_STUB SH7700_INT_EXIT_STUB_OFFSET +#define IP_EXC_BERR_STUB SH7700_EXC_BERR_STUB_OFFSET +#define IP_MEMPROBE_INT_STUB SH7700_MEMPROBE_INT_STUB_OFFSET + +#define IP_TMP_MMUCR 0x020 +#define IP_TMP_PTEL 0x024 +#define IP_TMP_PTEH 0x028 +#define IP_TMP_SP 0x02c + +#define IP_TMP_R3 0x030 +#define IP_TMP_R2 0x034 +#define IP_TMP_R1 0x038 +#define IP_TMP_R0 0x03c /* vbr + 60 */ +#define IP_TMP_FRAME IP_TMP_R0 + 4 + +#ifndef _ASMLANGUAGE + +/* macros to convert interrupt vectors <-> interrupt numbers */ + +#define IVEC_TO_INUM(intVec) \ + ((int) ((UINT32)intVec - SH7700_VEC_TABLE_OFFSET) >> 2) +#define INUM_TO_IVEC(intNum) \ + ((VOIDFUNCPTR *) (((intNum) << 2) + SH7700_VEC_TABLE_OFFSET)) +#define INUM_TO_IEVT(intNum) \ + ((int) ((intNum) << 5)) +#define IEVT_TO_INUM(intEvt) \ + ((int) ((intEvt) >> 5)) + +/* virtual interrupt vectors defined for SH7750/SH7700 */ + +#define IV_SCI_ERI INUM_TO_IVEC (INUM_SCI_RX_ERROR) +#define IV_SCI_RXI INUM_TO_IVEC (INUM_SCI_RX) +#define IV_SCI_TXI INUM_TO_IVEC (INUM_SCI_TX) +#define IV_SCI_TEI INUM_TO_IVEC (INUM_SCI_TX_END) + +#define IV_SCIF_ERI INUM_TO_IVEC (INUM_SCIF2_ERROR) +#define IV_SCIF_RXI INUM_TO_IVEC (INUM_SCIF2_RX) +#define IV_SCIF_TXI INUM_TO_IVEC (INUM_SCIF2_TX) +#define IV_SCIF_BRK INUM_TO_IVEC (INUM_SCIF2_BREAK) + +#define IV_SH_BUS_0 INUM_TO_IVEC (INUM_IRL11) +#define IV_SH_BUS_1 INUM_TO_IVEC (INUM_IRL10) +#define IV_PCIINTA INUM_TO_IVEC (INUM_IRL15) +#define IV_PCIINTB INUM_TO_IVEC (INUM_IRL14) +#define IV_PCIINTC INUM_TO_IVEC (INUM_IRL13) +#define IV_PCIINTD INUM_TO_IVEC (INUM_IRL12) + +#define IV_USER_BREAK INUM_TO_IVEC (INUM_USER_BREAK_TRAP) +#define IV_TRAP(trapNum) \ + ((VOIDFUNCPTR *) (((trapNum) << 2) + SH7700_VEC_TABLE_OFFSET)) + +#define IV_TRAP_RTI IV_TRAP(251) /* reserve 255-252 */ + +#endif /* _ASMLANGUAGE */ + +#endif /* CPU==SH7750 || CPU==SH7700 */ + + +#if (CPU==SH7600 || CPU==SH7000) + +/* vector numbers of specific exceptions */ + +#define LOW_VEC 4 /* lowest vector initialized */ +#define TRAP_32_VEC 32 /* start of user trap vectors */ +#define USER_VEC_START 64 /* start of user interrupt vectors */ +#if (CPU==SH7000) +#define HIGH_VEC 127 /* highest vector initialized */ +#else +#define HIGH_VEC 255 +#endif + +/* macros to convert interrupt vectors <-> interrupt numbers */ + +#define IVEC_TO_INUM(intVec) ((int) (intVec) >> 2) +#define INUM_TO_IVEC(intNum) ((VOIDFUNCPTR *) ((intNum) << 2)) + +/* interrupt vector numbers */ + +#define INUM_RESET_PWRON_PC 0 /* Power-on reset PC */ +#define INUM_RESET_PWRON_SP 1 /* Power-on reset SP */ +#define INUM_RESET_MANUAL_PC 2 /* Manual reset PC */ +#define INUM_RESET_MANUAL_SP 3 /* Manual reset SP */ +#define INUM_ILLEGAL_INST_GENERAL 4 /* General illegal instruction */ +#define INUM_RESERVED_5 5 /* (Reserved) */ +#define INUM_ILLEGAL_INST_SLOT 6 /* Illegal slot instruction */ +#define INUM_RESERVED_7 7 /* (Reserved) */ +#define INUM_RESERVED_8 8 /* (Reserved) */ +#define INUM_BUS_ERROR_CPU 9 /* CPU bus error */ +#define INUM_BUS_ERROR_DMA 10 /* DMA bus error */ +#define INUM_NMI 11 /* Non-maskable interrupt */ +#define INUM_USER_BREAK 12 /* User break interrupt */ +/* 13-31 (Reserved) */ + /* Trap instruction (user vectors) */ +#define INUM_TRAP_32 32 /* used for system call */ +#define INUM_TRAP_SC INUM_TRAP_32 +#define INUM_TRAP_33 33 +#define INUM_TRAP_34 34 +#define INUM_TRAP_35 35 +#define INUM_TRAP_36 36 +#define INUM_TRAP_37 37 +#define INUM_TRAP_38 38 +#define INUM_TRAP_39 39 +#define INUM_TRAP_40 40 +#define INUM_TRAP_41 41 +#define INUM_TRAP_42 42 +#define INUM_TRAP_43 43 +#define INUM_TRAP_44 44 +#define INUM_TRAP_45 45 +#define INUM_TRAP_46 46 +#define INUM_TRAP_47 47 +#define INUM_TRAP_48 48 +#define INUM_TRAP_49 49 +#define INUM_TRAP_50 50 +#define INUM_TRAP_51 51 +#define INUM_TRAP_52 52 +#define INUM_TRAP_53 53 +#define INUM_TRAP_54 54 +#define INUM_TRAP_55 65 +#define INUM_TRAP_56 56 +#define INUM_TRAP_57 57 +#define INUM_TRAP_58 58 +#define INUM_TRAP_59 59 /* reserved for RTI tools */ +#define INUM_TRAP_60 60 /* reserved */ +#define INUM_TRAP_61 61 /* reserved */ +#define INUM_TRAP_62 62 /* used for zero divide trap */ +#define INUM_TRAP_63 63 /* used by dbgShLib.h */ + +/* interrupt vector definitions */ + +#define IV_RESET_PWRON_PC INUM_TO_IVEC (INUM_RESET_PWRON_PC) +#define IV_RESET_PWRON_SP INUM_TO_IVEC (INUM_RESET_PWRON_SP) +#define IV_RESET_MANUAL_PC INUM_TO_IVEC (INUM_RESET_MANUAL_PC) +#define IV_RESET_MANUAL_SP INUM_TO_IVEC (INUM_RESET_MANUAL_SP) +#define IV_ILLEGAL_INST_GENERAL INUM_TO_IVEC (INUM_ILLEGAL_INST_GENERAL) +#define IV_RESERVED_5 INUM_TO_IVEC (INUM_RESERVED_5) +#define IV_ILLEGAL_INST_SLOT INUM_TO_IVEC (INUM_ILLEGAL_INST_SLOT) +#define IV_RESERVED_7 INUM_TO_IVEC (INUM_RESERVED_7) +#define IV_RESERVED_8 INUM_TO_IVEC (INUM_RESERVED_8) +#define IV_BUS_ERROR_CPU INUM_TO_IVEC (INUM_BUS_ERROR_CPU) +#define IV_BUS_ERROR_DMA INUM_TO_IVEC (INUM_BUS_ERROR_DMA) +#define IV_NMI INUM_TO_IVEC (INUM_NMI) +#define IV_USER_BREAK INUM_TO_IVEC (INUM_USER_BREAK) +#define IV_TRAP(trapNum) INUM_TO_IVEC (trapNum) + +#define IV_TRAP_RTI IV_TRAP(INUM_TRAP_59) + +#endif /* CPU==SH7600 || CPU==SH7000 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCivShh */ diff --git a/h/arch/sh/mmuShLib.h b/h/arch/sh/mmuShLib.h new file mode 100644 index 0000000..810f67b --- /dev/null +++ b/h/arch/sh/mmuShLib.h @@ -0,0 +1,326 @@ +/* mmuShLib.h - mmuLib header for SH77xx */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01n,02mar05,h_k added macros and changed PTE structure for PTEA support. (SPR + #106555) +01m,29oct04,h_k added lock API. (SPR #102634) +01l,27aug04,h_k updated for AIM MMU based on mmuMipsLib.h. +01k,04dec03,h_k enabled MMU_GLOBAL_CONTEXT definition for SH7700. +01j,05sep03,h_k merged mmuShLib.h from AE. +01i,03aug00,hk merged mmuSh7750Lib.h. disabled unused MMUCR_REG definition. +01h,18apr00,zl updated for little endian support +01g,30sep98,hk restored MMUCR_REG by hms, deleted union. +01f,29sep98,hk deleted MMU_STATE_CACHEABLE_WRITETHROUGH. changed MMU_STATE_ + MASK_CACHEABLE for SH7750 to 0x9. defaulted MMU_STATE_CACHEABLE + for SH7750 to MMU_STATE_CACHEABLE_COPYBACK. +01e,22sep98,hms changed MMU_STATE_MASK_WT, MMU_STATE_WT_ON to + MMU_STATE_MASK_WRITETHROUGH, + MMU_MMU_STATE_CACHEABLE_WRITETHROUGH. + deleted MMU_STATE_WT_OFF. +01d,17sep98,hk merged mmuSh7750Lib.h by hms. added comments. +01c,28dec96,hk code review. +01b,25dec96,hk disabled MMUCR_REG def. changed indent. +01a,15nov96,wt written based on mmu30Lib.h-01d. +*/ + +#ifndef __INCmmuShLibh +#define __INCmmuShLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE +#include "aimMmuLib.h" +#endif + +/* Defines */ + +#define MMU_SH_LOCK_API /* Enable Lock APIs */ + +/* default RTP base address */ + +#define MMU_SH_RTP_BASE_ADRS 0x40000000 /* within U0 region and above + * 29 bit address space. + */ + +/* TLB definitions */ + +#define MMU_SH_TLB_ENTRY_NB 64 /* 64 entries */ +#define MMU_SH_UNLOCK_TLB_ENTRY(x) (MMU_SH_TLB_ENTRY_NB - x) +#define MMU_SH_TLB_ENTIRE -1 /* invalidate entire TLB */ + +/* MMU register definitions */ + +#define MMU_PTEH ((volatile UINT32 *)0xff000000) /* PTEH address */ +#define MMU_MMUCR ((volatile UINT32 *)0xff000010) /* MMUCR address */ + +/* MMUCR (memory management unit controler) register bit definitions */ + +#define MMU_MMUCR_URX_MASK (MMU_SH_TLB_ENTRY_NB - 1) +#define MMU_MMUCR_URB_SHIFT 18 /* urb start bit */ +#define MMU_MMUCR_URC_SHIFT 10 /* urc start bit */ +#define MMU_MMUCR_URB_MASK (MMU_MMUCR_URX_MASK << MMU_MMUCR_URB_SHIFT) +#define MMU_MMUCR_URC_MASK (MMU_MMUCR_URX_MASK << MMU_MMUCR_URC_SHIFT) + +/* Page table sizes */ + +#define MMU_REGION_TBL_SIZE 1024 /* number of region table entries */ + +/* PTE definitions */ + +#define MMU_PTE_SIZE_SHIFT 3 /* log2 (sizeof (PTE)) */ + +/*------ Protection, Caching, Mask Tables -------------------------*/ + +#define PTEL_VALID 0x00000100 +#define PTEL_VALID_NOT 0x00000000 +#define PTEL_INVALID 0xFFFFFEFF +#define PTEL_PROTECT_ALL_WRITABLE 0x00000060 +#define PTEL_PROTECT_ALL_READONLY 0x00000040 +#define PTEL_PROTECT_SUP_WRITABLE 0x00000020 +#define PTEL_PROTECT_SUP_READONLY 0x00000000 +#define PTEL_CACHEABLE_WRITETHRU 0x00000009 +#define PTEL_CACHEABLE_COPYBACK 0x00000008 +#define PTEL_CACHEABLE 0x00000008 +#define PTEL_CACHEABLE_NOT 0x00000000 + +#define PTEL_MASK_VALID 0x00000100 +#define PTEL_MASK_PROTECT 0x00000060 +#define PTEL_MASK_CACHE 0x00000009 /* C | WT bits */ +#define PTEL_MASK_CACHEABLE PTEL_CACHEABLE + +#define PTEL_MASK_PPN 0x1FFFFC00 + +/* These bits are reserved on PTEL and internally used for storing PTEA bits */ + +#define PTEL_PTEA_VALID 0x00000200 /* internally used */ +#define PTEL_PTEA_MASK 0xe0000200 /* internally used */ +#define PTEL_PTEA_SA_MASK 0xe0000000 /* internally used */ +#define PTEL_PTEA_TC_MASK 0x00000200 /* internally used */ + +/* PTEA assistant MASK Tables */ + +#define PTEA_MASK 0x0000000f /* TC | SA */ +#define PTEA_TC_MASK 0x00000008 /* PTEA.TC */ +#define PTEA_SA_MASK 0x00000007 /* PTEA.SA[2:0] */ + +#define PTEA_STATE_SHIFT 12 /* least bit of + * MMU_ATTR_SPL_MASK + */ +#define PTEA_STATE_MASK (PTEA_MASK << PTEA_STATE_SHIFT) + /* (TC | SA) << 12 */ + +#define PTEA_TC_TRANS_SHIFT 6 +#define PTEA_SA_TRANS_SHIFT 29 + +/* Context table information */ + +#define MMU_GLOBAL_CONTEXT 0 +#define MMU_MIN_CONTEXT 0 +#define MMU_MAX_CONTEXT 255 + +/* Page size support information */ + +#define MMU_PAGE_SIZES_ALLOWED (MMU_PAGE_MASK_1K | MMU_PAGE_MASK_4K | \ + MMU_PAGE_MASK_64K | MMU_PAGE_MASK_1M) + +/* SH Hardware TLB definitions */ + +#define TLB_1K_PAGE_SIZE 0x00000400 +#define TLB_4K_PAGE_SIZE 0x00001000 +#define TLB_64K_PAGE_SIZE 0x00010000 +#define TLB_1M_PAGE_SIZE 0x00100000 + +#define TLB_1K_PAGE_SIZE_MASK 0x00000000 +#define TLB_4K_PAGE_SIZE_MASK 0x00000C00 +#define TLB_64K_PAGE_SIZE_MASK 0x0000FC00 +#define TLB_1M_PAGE_SIZE_MASK 0x000FFC00 + +/* SH TLB definitions + * must not exceed 0x7fff. (See mmuStub() and cacheSh7750ILineInvalOp().) + */ + +#define TLB_1K_VADDR_MASK (0x0FFF << MMU_PTE_SIZE_SHIFT) +#define TLB_4K_VADDR_MASK (0x03FF << MMU_PTE_SIZE_SHIFT) +#define TLB_64K_VADDR_MASK (0x003F << MMU_PTE_SIZE_SHIFT) +#define TLB_1M_VADDR_MASK (0x0003 << MMU_PTE_SIZE_SHIFT) + +/* Vertual address shift definitions + * must be negative value. (See mmuStub() and cacheSh7750ILineInvalOp().) + */ + +#define TLB_1K_VADDR_SHIFT (MMU_PTE_SIZE_SHIFT - 10) +#define TLB_4K_VADDR_SHIFT (MMU_PTE_SIZE_SHIFT - 12) +#define TLB_64K_VADDR_SHIFT (MMU_PTE_SIZE_SHIFT - 16) +#define TLB_1M_VADDR_SHIFT (MMU_PTE_SIZE_SHIFT - 20) + +/* Page Table Size defines + * These define the page table size for each of the page sizes. + * Use the smallest page size supported + */ + +#define TLB_1M_TABLE_SIZE 4 +#define TLB_64K_TABLE_SIZE (16 * TLB_1M_TABLE_SIZE) +#define TLB_4K_TABLE_SIZE (16 * TLB_64K_TABLE_SIZE) +#define TLB_1K_TABLE_SIZE (4 * TLB_4K_TABLE_SIZE) + +/* State Defines */ + +#define MMU_SH_BASE_STATE (1 << MMU_SH_DIRTY_START) + +/* PTEL Defines */ + +#define MMU_SH_STATE_VALID PTEL_VALID /* V flag set */ +#define MMU_SH_STATE_VALID_NOT PTEL_VALID_NOT /* V flag not set */ +#define MMU_SH_STATE_WRITABLE PTEL_PROTECT_SUP_WRITABLE +#define MMU_SH_STATE_WRITABLE_NOT PTEL_PROTECT_SUP_READONLY +#define MMU_SH_STATE_INVALID_STATE PTEL_INVALID /* Invalid State */ +#define MMU_SH_GLOBAL 0x00000002 /* SH flag set */ +#define MMU_SH_UNCACHED PTEL_CACHEABLE_NOT +#define MMU_SH_CACHED PTEL_CACHEABLE + +/* SZ filed */ +#define MMU_SH_SZ_1K_PAGE 0x00000000 /* 1K page size */ +#define MMU_SH_SZ_4K_PAGE 0x00000010 /* 4K page size */ +#define MMU_SH_SZ_64K_PAGE 0x00000080 /* 64K page size */ +#define MMU_SH_SZ_1M_PAGE 0x00000090 /* 1M page size */ + +#define MMU_SH_GLOBAL_START 1 /* Start point of global bit */ +#define MMU_SH_DIRTY_START 2 /* Start point of dirty bit */ +#define MMU_SH_CACHE_START 3 /* Start point of cache field*/ +#define MMU_SH_VALID_START 8 /* Start point of valid bit */ + +/* Masks */ + +#define MMU_SH_STATE_MASK_VALID PTEL_MASK_VALID +#define MMU_SH_STATE_MASK_WRITABLE PTEL_PROTECT_SUP_WRITABLE +#define MMU_SH_STATE_MASK_PROTECTION PTEL_PROTECT_ALL_WRITABLE +#define MMU_SH_STATE_MASK_CACHEABLE PTEL_MASK_CACHEABLE +#define MMU_SH_STATE_MASK_CACHE PTEL_MASK_CACHE +#define MMU_SH_STATE_MASK (MMU_SH_STATE_MASK_VALID | \ + MMU_SH_STATE_MASK_PROTECTION | \ + MMU_SH_STATE_MASK_CACHE) +#define MMU_SH_MASK_GLOBAL MMU_SH_GLOBAL +#define MMU_SH_SZ_MASK 0x00000090 + +#define MMU_SH_VPN_MASK 0xfffffc00 +#define MMU_SH_PPN_MASK PTEL_MASK_PPN +#define MMU_SH_ASID_MASK 0x000000FF + +/* + * Table Entry Definitions + * These are definitions for the indexes for the cache, protection + * and mask tables defined for every device-dependent library + */ + +/* Cache Table Indexes */ + +#define MMU_INVALID 0 +#define MMU_CACHEOFF 1 +#define MMU_CPYBACK 2 +#define MMU_WRTHRU 3 +#define MMU_COHRNT 4 + +#ifndef _ASMLANGUAGE + +#define MMU_BYTES_PER_ENTRY sizeof (PTE) /* size of PTE structure */ + +/* Define the Page-Table Entry (PTE) Structure */ + +typedef struct + { +#if (_BYTE_ORDER == _BIG_ENDIAN) + UINT32 locked:1; + UINT32 reserved2:2; + UINT32 pageSize:21; + UINT32 reserved1:4; /* keep the bits always 0 (see mmuShALib.s) */ + UINT32 assist:4; /* LSB */ +#else /* _BYTE_ORDER == _LITTLE_ENDIAN */ + UINT32 assist:4; /* LSB */ + UINT32 reserved1:4; /* keep the bits always 0 (see mmuShALib.s) */ + UINT32 pageSize:21; + UINT32 reserved2:2; + UINT32 locked:1; +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + } PTE_ASSIST; + +typedef struct + { + UINT32 entry; + union + { + PTE_ASSIST fields; + UINT32 bits; + } ea; /* entry assistant */ + } PTE; + +/* Define the TLB Structure. */ + +typedef struct + { + UINT32 utlbAddr; /* UTLB address array */ + UINT32 utlbData1; /* UTLB data array 1 */ + } SH_TLB_ENTRY; + +/* TLB Setup structure + * + * This structure holds the information needed by the TLB Miss Handler + * to setup the TLB entry. + */ + +typedef struct + { + UINT32 pageSize; + UINT32 tableSize; + UINT16 vAddrShift; + UINT16 vAddrMask; + } SH_TLB_SETUP_STRUCT; + +/* + * This is the structure used to configure the mmu library + * for the varying SH architectures. + */ + +typedef struct mmuShConfigStruct + { + UINT32 kMemBase; /* Kernel Memory Base */ + +#ifdef MMU_SH_LOCK_API + UINT lockedTlbCnt; + UINT pciLockedTlbCnt; +#endif /* MMU_SH_LOCK_API */ + + /* Pointers to subroutines for SH device-specific needs */ + + VOIDFUNCPTR CrSet; + VOIDFUNCPTR On; + VOIDFUNCPTR TlbClr; + VOIDFUNCPTR ATTRSet; + VOIDFUNCPTR CTXSet; /* Set Context */ + VOIDFUNCPTR TTBSet; + VOIDFUNCPTR Dump; + +#ifdef MMU_SH_LOCK_API + VOIDFUNCPTR Move; + VOIDFUNCPTR TlbSet; +#endif /* MMU_SH_LOCK_API */ + } MMU_SH_CONFIG; + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmmuShLibh */ diff --git a/h/arch/sh/regsSh.h b/h/arch/sh/regsSh.h new file mode 100644 index 0000000..cfbbc39 --- /dev/null +++ b/h/arch/sh/regsSh.h @@ -0,0 +1,208 @@ +/* regsSh.h - Renesas SH registers */ + +/* + * Copyright (c) 1994-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +02a,01mar05,h_k added _SH_PTEA_SUPPORT definition. (SPR #106555) +01z,19oct04,h_k added SR_BIT_RB and SR_BIT_BL definitions. +01y,18nov03,h_k added pteh to REG_SET. +01x,30oct03,h_k added _SH_REG_SET_SIZE. +01w,11sep03,h_k added SR_BIT_MD. +01v,26aug03,h_k add P4_REG_BASE and register offsets for assembly code. +01u,21aug00,hk add SH7729/SH7410 SR info. +01t,29sep98,hk code review: minor supplement for SR diagram. +01s,24sep98,hms modified comment for definition of bits in the SH7750 SR. +01r,17feb97,hk deleted unnecessary bank register defs in #if 0 clause. +01q,04jan97,hk deleted register set offset comments. +01p,19aug96,hk deleted bank registers from SH7700' REG_SET. +01o,24jul96,wt added fpReg definition for wdbBpLib.h. +01n,13jun96,hk added bareg[8] to REG_SET for SH7700. +01m,12may96,hk added sr def for SH7700. +01l,15dec94,hk adding sr bit definition. +01k,05dec94,hk swapped sr and pc in REG_SET. +01j,02dec94,hk refined WIND_TCB_XXX defines. +01i,01dec94,hk added spReg comment. +01h,14oct94,hk added spReg definition for taskShow.c. +01g,09oct94,hk moved dummy FP_CONTEXT, FPREG_SET to fppShLib.h (alpha-0). +01f,09oct94,hk added FP_CONTEXT. +01e,09oct94,hk added PC_OFFSET, FPREG_SET. +01d,07oct94,hk split volatile/non-volatile regs, inserted mach/macl. +01c,27sep94,hk swapped pr and mac[2] in REG_SET. +01b,26sep94,hk swapped sr and pc in REG_SET. +01a,15jun94,hk derived from 01h of MIPS. +*/ + +#ifndef __INCregsShh +#define __INCregsShh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +typedef struct /* SH Register Set */ + { + ULONG vbr; /* vector base register */ + ULONG gbr; /* global base register */ + INSTR *pr; /* procedure register (for subroutine rtn) */ + ULONG voreg[8]; /* volatile registers (r0 - r7) */ + ULONG mac [2]; /* multiply and accumulate registers */ + ULONG nvreg[8]; /* non-volatile registers (r8 - r15) */ + INSTR *pc; /* program counter */ + ULONG sr; /* status register */ +#if (CPU==SH7750 || CPU==SH7700) + ULONG pteh; /* page table entry high */ +#endif /* (CPU==SH7750 || CPU==SH7700) */ + } REG_SET; + +#define fpReg nvreg[6] /* needed by wdbBpLib.h */ +#define spReg nvreg[7] /* needed by taskShow.c, dbgArchLib.c */ + +#else /* _ASMLANGUAGE */ + +/* On-chip register base address and offsets for assembly code */ + +#if (CPU==SH7750) +#define P4_REG_BASE 0xff000000 +#define TRA 0x20 /* 0xff000020: TRApa exception register */ +#define EXPEVT 0x24 /* 0xff000024: Exception Event */ +#define PTEH 0x00 /* 0xff000000: Page Table Entry High */ +#define PTEL 0x04 /* 0xff000004: Page Table Entry Low */ +#define TTB 0x08 /* 0xff000008: Translation Table Base */ +#define TEA 0x0c /* 0xff00000c: TLB Exception Address */ +#define MMUCR 0x10 /* 0xff000010: MMU Control Register */ +#define CCR 0x1c /* 0xff00001c: Cache Control Register */ +#define PTEA 0x34 /* 0xff000034: Page Table Entry Assistant */ +#define _SH_PTEA_SUPPORT /* enable PTEA register support */ +#elif (CPU==SH7700) +#define TRA 0xd0 /* 0xffffffd0: TRApa exception register */ +#define EXPEVT 0xd4 /* 0xffffffd4: EXception EVenT register */ +#define TEA 0xfc /* 0xfffffffc: TLB Exception Address */ + +#define P4_REG_BASE 0xffffffe0 +#define MMUCR 0x00 /* 0xffffffe0: MMU Control Register */ +#define PTEH 0x10 /* 0xfffffff0: Page Table Entry High */ +#define PTEL 0x14 /* 0xfffffff4: Page Table Entry Low */ +#define TTB 0x18 /* 0xfffffff8: Translation Table Base */ +/*#define CCR 0x0c /@ 0xffffffec: Cache Control Register */ +#endif /*CPU==SH7700*/ + +#endif /* _ASMLANGUAGE */ + +#define REG_SET_VBR 0x00 +#define REG_SET_GBR 0x04 +#define REG_SET_PR 0x08 +#define REG_SET_R0 0x0c +#define REG_SET_R1 0x10 +#define REG_SET_R2 0x14 +#define REG_SET_R3 0x18 +#define REG_SET_R4 0x1c +#define REG_SET_R5 0x20 +#define REG_SET_R6 0x24 +#define REG_SET_R7 0x28 +#define REG_SET_MACH 0x2c +#define REG_SET_MACL 0x30 +#define REG_SET_R8 0x34 +#define REG_SET_R9 0x38 +#define REG_SET_R10 0x3c +#define REG_SET_R11 0x40 +#define REG_SET_R12 0x44 +#define REG_SET_R13 0x48 +#define REG_SET_R14 0x4c +#define REG_SET_R15 0x50 +#define REG_SET_PC 0x54 +#define REG_SET_SR 0x58 +#if (CPU==SH7750 || CPU==SH7700) +#define REG_SET_PTEH 0x5c + +#define _SH_REG_SET_SIZE (REG_SET_PTEH + 4) /* for _sigCtxSave */ +#else +#define _SH_REG_SET_SIZE (REG_SET_SR + 4) /* for _sigCtxSave */ +#endif /* (CPU==SH7750 || CPU==SH7700) */ + +#define PC_OFFSET REG_SET_PC /* referenced by pc() in usrLib */ + +/* + * Definition of bits in the SH7750 Status Register (SR) + * + * +--+--+--+--+-----+--+------------+---+---+---+---+---+---+---+---+---+---+ + * |- |MD|RB|BL| - |FD| -------- | M | Q | Interrupt Mask| - | - | S | T | + * +--+--+--+--+-----+--+------------+---+---+---+---+---+---+---+---+---+---+ + * 31 30 29 28 15 9 8 7 6 5 4 3 2 1 0 + * + * Definition of bits in the SH7729 Status Register (SR) + * + * +--+--+--+--+-----+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ + * |- |MD|RB|BL| RC | - |DSP|DMY|DMX| M | Q | Interrupt Mask|RF1|RF0| S | T | + * +--+--+--+--+-----+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ + * 31 30 29 28 27-16 12 11 10 9 8 7 6 5 4 3 2 1 0 + * + * Definition of bits in the SH7700 Status Register (SR) + * + * +--+--+--+--+---------------------+---+---+---+---+---+---+---+---+---+---+ + * |- |MD|RB|BL| ----------------- | M | Q | Interrupt Mask| - | - | S | T | + * +--+--+--+--+---------------------+---+---+---+---+---+---+---+---+---+---+ + * 31 30 29 28 9 8 7 6 5 4 3 2 1 0 + * + * Definition of bits in the SH7410 Status Register (SR) + * + * +-----------+-----+-------+---+---+---+---+---+---+---+---+---+---+---+---+ + * | --------- | RC | ----- |DMY|DMX| M | Q | Interrupt Mask|RF1|RF0| S | T | + * +-----------+-----+-------+---+---+---+---+---+---+---+---+---+---+---+---+ + * 31 28 27-16 11 10 9 8 7 6 5 4 3 2 1 0 + * + * Definition of bits in the SH7600/SH7040/SH7000 Status Register (SR) + * + * +---------------------------------+---+---+---+---+---+---+---+---+---+---+ + * | ----------------------------- | M | Q | Interrupt Mask| - | - | S | T | + * +---------------------------------+---+---+---+---+---+---+---+---+---+---+ + * 31 9 8 7 6 5 4 3 2 1 0 + */ +#define SR_BIT_T 0x00000001 /* ref: dbgArchLib.c */ +#define SR_BIT_MD 0x40000000 /* ref: taskArchLib.c and + * rtpSigArchLib.c + */ +#define SR_BIT_RB 0x20000000 /* ref: rtpSigArchLib.c */ +#define SR_BIT_BL 0x10000000 /* ref: rtpSigArchLib.c */ + +/* TCB Register Set (WIND_TCB_REGS is defined in h/private/taskLibP.h) */ + +#define WIND_TCB_VBR (WIND_TCB_REGS + REG_SET_VBR) +#define WIND_TCB_GBR (WIND_TCB_REGS + REG_SET_GBR) +#define WIND_TCB_PR (WIND_TCB_REGS + REG_SET_PR) +#define WIND_TCB_R0 (WIND_TCB_REGS + REG_SET_R0) +#define WIND_TCB_R1 (WIND_TCB_REGS + REG_SET_R1) +#define WIND_TCB_R2 (WIND_TCB_REGS + REG_SET_R2) +#define WIND_TCB_R3 (WIND_TCB_REGS + REG_SET_R3) +#define WIND_TCB_R4 (WIND_TCB_REGS + REG_SET_R4) +#define WIND_TCB_R5 (WIND_TCB_REGS + REG_SET_R5) +#define WIND_TCB_R6 (WIND_TCB_REGS + REG_SET_R6) +#define WIND_TCB_R7 (WIND_TCB_REGS + REG_SET_R7) +#define WIND_TCB_MACH (WIND_TCB_REGS + REG_SET_MACH) +#define WIND_TCB_MACL (WIND_TCB_REGS + REG_SET_MACL) +#define WIND_TCB_R8 (WIND_TCB_REGS + REG_SET_R8) +#define WIND_TCB_R9 (WIND_TCB_REGS + REG_SET_R9) +#define WIND_TCB_R10 (WIND_TCB_REGS + REG_SET_R10) +#define WIND_TCB_R11 (WIND_TCB_REGS + REG_SET_R11) +#define WIND_TCB_R12 (WIND_TCB_REGS + REG_SET_R12) +#define WIND_TCB_R13 (WIND_TCB_REGS + REG_SET_R13) +#define WIND_TCB_R14 (WIND_TCB_REGS + REG_SET_R14) +#define WIND_TCB_R15 (WIND_TCB_REGS + REG_SET_R15) +#define WIND_TCB_PC (WIND_TCB_REGS + REG_SET_PC) +#define WIND_TCB_SR (WIND_TCB_REGS + REG_SET_SR) +#define WIND_TCB_PTEH (WIND_TCB_REGS + REG_SET_PTEH) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCregsShh */ diff --git a/h/arch/sh/sh7750.h b/h/arch/sh/sh7750.h new file mode 100644 index 0000000..7ede023 --- /dev/null +++ b/h/arch/sh/sh7750.h @@ -0,0 +1,295 @@ +/* sh7750.h - SH7750 header */ + +/* Copyright 1998-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01k,11jun02,zl fixed BSC definitions. +01j,07dec01,zl added BSC register definitions. +01i,10sep01,h_k added power control support (SPR #69838). +01h,16feb01,hk delete UBC register field defs (use defs in dbgShLib.h). +01g,15dec00,frf corrected Timer Control Register bit definitions. +01f,21nov00,zl renamed TMU registers. +01e,26jul99,zl added UBC register field definitions +01d,10mar99,hk moved in UBC register address defs from dbgShLib.h. +01c,26nov98,hk changed SCIF register prefix. added SCIF_SFDR2, SCIF_SSR2 defs. +01b,22sep98,hms changed expression of "SCI1, SCI2" to "SCI, SCIF". +01a,02jul98,st written based on sh7700.h 01h. +*/ + +/* +DESCRIPTION +This file contains I/O addresses and related constants for the SH7750 chip. +*/ + +#ifndef __INCsh7750h +#define __INCsh7750h + +#ifdef __cplusplus +extern "C" { +#endif + + +/* INTC (INTerrupt Controller) register addresses */ + +#define INTC_ICR ((volatile UINT16 *)0xffd00000) /* control register */ +#define INTC_IPRA ((volatile UINT16 *)0xffd00004) /* priority setup A */ +#define INTC_IPRB ((volatile UINT16 *)0xffd00008) /* priority setup B */ +#define INTC_IPRC ((volatile UINT16 *)0xffd0000c) /* priority setup C */ + +/* INTC ICR (Interrupt Control Register) bit definitions */ + +#define ICR_NMI_STATUS ((UINT16)0x8000) /* NMI input level status */ +#define ICR_NMI_BLOCK_MODE ((UINT16)0x0200) /* NMI block mode */ +#define ICR_NMI_LEAD_EDGE ((UINT16)0x0100) /* detect on leading edge */ +#define ICR_NMI_TRAIL_EDGE ((UINT16)0x0000) /* detect on trailing edge */ +#define ICR_NMI_IRL_PIN_MODE ((UINT16)0x0080) /* IRL pin mode */ + +/* FRQCR (FReQuency Control Register) */ + +#define FRQCR ((volatile UINT16 *)0xffc00000) + +/* FRQCR (FReQuency Control Register) bit definitions */ + +#define FRQCR_DEFAULT ((UINT16)0x0812) /* for 120MHz */ +#define FRQCR_CKOEN ((UINT16)0x0800) +#define FRQCR_PLL1EN ((UINT16)0x0400) +#define FRQCR_PLL2EN ((UINT16)0x0200) +#define FRQCR_IFC_BY_8 ((UINT16)0x0140) +#define FRQCR_IFC_BY_6 ((UINT16)0x0100) +#define FRQCR_IFC_BY_4 ((UINT16)0x00c0) +#define FRQCR_IFC_BY_3 ((UINT16)0x0080) +#define FRQCR_IFC_BY_2 ((UINT16)0x0040) +#define FRQCR_IFC_BY_1 ((UINT16)0x0000) +#define FRQCR_BFC_BY_8 ((UINT16)0x0028) +#define FRQCR_BFC_BY_6 ((UINT16)0x0020) +#define FRQCR_BFC_BY_4 ((UINT16)0x0018) +#define FRQCR_BFC_BY_3 ((UINT16)0x0010) +#define FRQCR_BFC_BY_2 ((UINT16)0x0008) +#define FRQCR_BFC_BY_1 ((UINT16)0x0000) +#define FRQCR_PFC_BY_8 ((UINT16)0x0004) +#define FRQCR_PFC_BY_6 ((UINT16)0x0003) +#define FRQCR_PFC_BY_4 ((UINT16)0x0002) +#define FRQCR_PFC_BY_3 ((UINT16)0x0001) +#define FRQCR_PFC_BY_2 ((UINT16)0x0000) + + +/* STBCR (Stanby Control Register) */ + +#define STBCR ((volatile UINT8 *)0xffc00004) +#define STBCR2 ((volatile UINT8 *)0xffc00010) + + +/* WDT (WatchDog Timer) register addresses */ + +#define WDT_WTCNT_WR ((volatile UINT16 *)0xffc00008) +#define WDT_WTCNT_RD ((volatile UINT8 *)0xffc00008) +#define WDT_WTCSR_WR ((volatile UINT16 *)0xffc0000c) +#define WDT_WTCSR_RD ((volatile UINT8 *)0xffc0000c) + +/* WDT WTCNT (Watchdog Timer CouNT) register bit definitions */ + +#define WTCNT_PASSWD 0x5a00 /* WTCNT write password */ + +/* WDT WTCSR (Watchdog Timer Control/Status Register) bit definitions */ + +#define WTCSR_PASSWD 0xa500 /* WTCSR write password */ + +#define WTCSR_TIMER_DISABLE 0x00 /* stop count */ +#if 0 /* definition not used */ +#define WTCSR_TIMER_ENABLE 0x80 /* start count */ +#define WTCSR_WATCHDOG_MODE 0x40 /* operate as watchdog timer */ +#define WTCSR_RSTS_MANUAL 0x20 /* select manual-reset watchdog */ +#define WTCSR_WOVF_STATUS 0x10 /* overflow status in watchdog mode */ +#define WTCSR_IOVF_STATUS 0x08 /* overflow status in interval mode */ +#define WTCSR_PCLK_BY4096 0x07 /* count-up by P-clock/4096 */ +#define WTCSR_PCLK_BY1024 0x06 /* count-up by P-clock/1024 */ +#define WTCSR_PCLK_BY256 0x05 /* count-up by P-clock/256 */ +#define WTCSR_PCLK_BY64 0x04 /* count-up by P-clock/64 */ +#define WTCSR_PCLK_BY32 0x03 /* count-up by P-clock/32 */ +#define WTCSR_PCLK_BY16 0x02 /* count-up by P-clock/16 */ +#define WTCSR_PCLK_BY4 0x01 /* count-up by P-clock/4 */ +#define WTCSR_PCLK_BY1 0x00 /* count-up by P-clock/1 */ +#endif /* definition not used */ + + +/* TMU (32bit x 3ch TiMer Unit) register addresses */ + +#define TMU_TOCR ((volatile UINT8 *)0xffd80000) +#define TMU_TSTR ((volatile UINT8 *)0xffd80004) +#define TMU_TCOR0 ((volatile UINT32 *)0xffd80008) +#define TMU_TCNT0 ((volatile UINT32 *)0xffd8000c) +#define TMU_TCR0 ((volatile UINT16 *)0xffd80010) +#define TMU_TCOR1 ((volatile UINT32 *)0xffd80014) +#define TMU_TCNT1 ((volatile UINT32 *)0xffd80018) +#define TMU_TCR1 ((volatile UINT16 *)0xffd8001c) +#define TMU_TCOR2 ((volatile UINT32 *)0xffd80020) +#define TMU_TCNT2 ((volatile UINT32 *)0xffd80024) +#define TMU_TCR2 ((volatile UINT16 *)0xffd80028) +#define TMU_TCPR2 ((volatile UINT32 *)0xffd8002c) + +/* TMU_TOCR_TCLK_CNTL (Timer Output Control Register) bit definitions */ +#define TOCR_DEFAULT ((UINT8)0x00) +#define TOCR_TCOE ((UINT8)0x01) /* RTC output */ +#define TOCR_TCLK_IN TOCR_DEFAULT +#define TOCR_TCLK_OUT TOCR_TCOE + +/* TMU_TSTR_START_CNTL (Timer STart Register) bit definitions */ +#define TSTR_STOP_ALL ((UINT8)0x00) /* stop counter 0/1/2 */ +#define TSTR_STR2 ((UINT8)0x04) /* start counter 2 */ +#define TSTR_STR1 ((UINT8)0x02) /* start counter 1 */ +#define TSTR_STR0 ((UINT8)0x01) /* start counter 0 */ + +/* TMU_TCR_CNTL (Timer Control Register) bit definitions */ +#define TCR_DEFAULT ((UINT16)0x0000) +#define TCR_ICPF ((UINT16)0x0200) /* input-capture status (ch.2 only) */ +#define TCR_UNF ((UINT16)0x0100) /* underflow status */ +#define TCR_ICPE1 ((UINT16)0x0080) /* enable input-capture (ch.2 only) */ +#define TCR_ICPE0 ((UINT16)0x0040) /* enable input-capture interrupt */ +#define TCR_UNIE ((UINT16)0x0020) /* enable underflow interrupt */ +#define TCR_CKEG_LEAD ((UINT16)0x0000) /* count on leading edge */ +#define TCR_CKEG_TRAIL ((UINT16)0x0008) /* count on trailing edge */ +#define TCR_CKEG_BOTH ((UINT16)0x0010) /* use both edge (up & down) */ +#define TCR_TPSC_P4 ((UINT16)0x0000) /* count by P/4 */ +#define TCR_TPSC_P16 ((UINT16)0x0001) /* count by P/16 */ +#define TCR_TPSC_P64 ((UINT16)0x0002) /* count by P/64 */ +#define TCR_TPSC_P256 ((UINT16)0x0003) /* count by P/256 */ +#define TCR_TPSC_P1024 ((UINT16)0x0004) /* count by P/1024 */ +#define TCR_TPSC_RTCCLK ((UINT16)0x0006) /* count by RTCCLK */ +#define TCR_TPSC_TCLK ((UINT16)0x0007) /* count by TCLK */ + +/* For backward compatibility */ +#define TMU_TOCR_TCLK_CNTL TMU_TOCR +#define TMU_TSTR_START_CNTL TMU_TSTR +#define TMU_TCOR_CONST_0 TMU_TCOR0 +#define TMU_TCNT_COUNT_0 TMU_TCNT0 +#define TMU_TCR_CNTL_0 TMU_TCR0 +#define TMU_TCOR_CONST_1 TMU_TCOR1 +#define TMU_TCNT_COUNT_1 TMU_TCNT1 +#define TMU_TCR_CNTL_1 TMU_TCR1 +#define TMU_TCOR_CONST_2 TMU_TCOR2 +#define TMU_TCNT_COUNT_2 TMU_TCNT2 +#define TMU_TCR_CNTL_2 TMU_TCR2 +#define TMU_TCPR2_CAPTURE TMU_TCPR2 +#define TSTR_START_2 TSTR_STR2 +#define TSTR_START_1 TSTR_STR1 +#define TSTR_START_0 TSTR_STR0 +#define TCR_CNTL_DEFAULT TCR_DEFAULT + + +/* UBC (User Break Controller) register addresses */ + +#define UBC_BARA ((volatile UINT32 *)0xff200000) /* Break Address Register A */ +#define UBC_BAMRA ((volatile UINT8 *)0xff200004) /* Break Address Mask Register A (8) */ +#define UBC_BBRA ((volatile UINT16 *)0xff200008) /* Break Buscycle Register A (16) */ +#define UBC_BASRA ((volatile UINT8 *)0xff000014) /* Break ASid Register A (8) */ +#define UBC_BARB ((volatile UINT32 *)0xff20000c) /* Break Address Register B */ +#define UBC_BAMRB ((volatile UINT8 *)0xff200010) /* Break Address Mask Register B (8) */ +#define UBC_BBRB ((volatile UINT16 *)0xff200014) /* Break Buscycle Register B (16) */ +#define UBC_BASRB ((volatile UINT8 *)0xff000018) /* Break ASid Register B (8) */ +#define UBC_BDRB ((volatile UINT32 *)0xff200018) /* Break Data Register B */ +#define UBC_BDMRB ((volatile UINT32 *)0xff20001c) /* Break Data Mask Register B */ +#define UBC_BRCR ((volatile UINT16 *)0xff200020) /* BReak Control Register (16) */ + + +/* RTC (Real Time Clock) register addresses */ + +#if 0 /* definition not used */ +#define RTC_COUNT_64HZ ((volatile UINT8 *)0xffc80000) /* R64CNT */ +#define RTC_COUNT_SEC ((volatile UINT8 *)0xffc80004) /* RSECCNT */ +#define RTC_COUNT_MIN ((volatile UINT8 *)0xffc80008) /* RMINCNT */ +#define RTC_COUNT_HOUR ((volatile UINT8 *)0xffc8000c) /* RHRCNT */ +#define RTC_COUNT_DAY_OF_WEEK ((volatile UINT8 *)0xffc80010) /* RWKCNT */ +#define RTC_COUNT_DAY ((volatile UINT8 *)0xffc80014) /* RDAYCNT */ +#define RTC_COUNT_MONTH ((volatile UINT8 *)0xffc80018) /* RMONCNT */ +#define RTC_COUNT_YEAR ((volatile UINT16 *)0xffc8001c) /* RYRCNT */ +#endif /* definition not used */ +#define RTC_ALARM_SEC ((volatile UINT8 *)0xffc80020) /* RSECAR */ +#define RTC_ALARM_MIN ((volatile UINT8 *)0xffc80024) /* RMINAR */ +#define RTC_ALARM_HOUR ((volatile UINT8 *)0xffc80028) /* RHRAR */ +#define RTC_ALARM_DAY_OF_WEEK ((volatile UINT8 *)0xffc8002c) /* RWKAR */ +#define RTC_ALARM_DAY ((volatile UINT8 *)0xffc80030) /* RDAYAR */ +#define RTC_ALARM_MONTH ((volatile UINT8 *)0xffc80034) /* RMONAR */ +#define RTC_CONTROL_1 ((volatile UINT8 *)0xffc80038) /* RCR1 */ +#define RTC_CONTROL_2 ((volatile UINT8 *)0xffc8003c) /* RCR2 */ + + +/* SCI (Serial Communication Interface) register addresses */ + +#define SCI_SMR1 ((volatile UINT8 *)0xffe00000) /* serial mode */ +#define SCI_BRR1 ((volatile UINT8 *)0xffe00004) /* bit rate */ +#define SCI_SCR1 ((volatile UINT8 *)0xffe00008) /* serial control */ +#define SCI_TDR1 ((volatile UINT8 *)0xffe0000c) /* transmit data */ +#define SCI_SSR1 ((volatile UINT8 *)0xffe00010) /* serial status */ +#define SCI_RDR1 ((volatile UINT8 *)0xffe00014) /* receive data */ +#define SCI_SCMR ((volatile UINT8 *)0xffe00018) /* smart card mode */ + +/* SCIF (Serial Communication Interface with FIFO) register addresses */ + +#define SCIF_SMR2 ((volatile UINT16 *)0xffe80000) /* serial mode */ +#define SCIF_BRR2 ((volatile UINT8 *)0xffe80004) /* bit rate */ +#define SCIF_SCR2 ((volatile UINT16 *)0xffe80008) /* serial control */ +#define SCIF_FTDR2 ((volatile UINT8 *)0xffe8000c) /* transmit FIFO data */ +#define SCIF_SFDR2 SCIF_FTDR2 +#define SCIF_FSR2 ((volatile UINT16 *)0xffe80010) /* serial status */ +#define SCIF_SSR2 SCIF_FSR2 +#define SCIF_FRDR2 ((volatile UINT8 *)0xffe80014) /* receive FIFO data */ +#define SCIF_FCR2 ((volatile UINT16 *)0xffe80018) /* FIFO control */ +#define SCIF_FDR2 ((volatile UINT16 *)0xffe8001c) /* FIFO data count */ +#define SCIF_SPTR2 ((volatile UINT16 *)0xffe80020) /* serial port reg */ +#define SCIF_LSR2 ((volatile UINT16 *)0xffe80024) /* line status */ + + +/* IOP (I/O Port) register addresses */ + +#define IOP_PCTR ((volatile UINT32 *)0xff80002c) /* I/O port control */ +#define IOP_PDTR ((volatile UINT16 *)0xff800030) /* I/O port data */ +#define IOP_SCSPTR1 ((volatile UINT8 *)0xffe0001c) /* serial port1 I/O */ +#define IOP_SCSPTR2 ((volatile UINT16 *)0xffe80020) /* serial port2 I/O */ + +/* Bus State Controller (BSC) register definitions */ + +#define BSC_BCR1 ((volatile UINT32 *)0xff800000) /* Bus control reg. 1 */ +#define BSC_BCR2 ((volatile UINT16 *)0xff800004) /* Bus control reg. 2 */ +#define BSC_WCR1 ((volatile UINT32 *)0xff800008) /* Wait state ctrl. 1 */ +#define BSC_WCR2 ((volatile UINT32 *)0xff80000c) /* Wait state ctrl. 2 */ +#define BSC_WCR3 ((volatile UINT32 *)0xff800010) /* Wait state ctrl. 3 */ +#define BSC_MCR ((volatile UINT32 *)0xff800014) /* Memory ctrl. reg. */ +#define BSC_PCR ((volatile UINT16 *)0xff800018) /* PCMCIA ctrl. reg. */ +#define BSC_RTCSR ((volatile UINT16 *)0xff80001c) /* Refresh ctrl./stat.*/ +#define BSC_RTCNT ((volatile UINT16 *)0xff800020) /* Refresh timer count*/ +#define BSC_RTCOR ((volatile UINT16 *)0xff800024) /* Refresh time const */ +#define BSC_RFCR ((volatile UINT16 *)0xff800028) /* Refresh count reg. */ + + +/* function declarations */ + +#ifndef _ASMLANGUAGE +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT STATUS sysIntDisable (int intLevel); +IMPORT STATUS sysIntEnable (int intLevel); +IMPORT int sysBusIntAck (int intLevel); +IMPORT STATUS sysBusIntGen (int level, int vector); +IMPORT STATUS sysMailboxEnable (char *mailboxAdrs); +IMPORT STATUS sysMailboxConnect (FUNCPTR routine, int arg); + +#else /* __STDC__ */ + +IMPORT STATUS sysIntDisable (); +IMPORT STATUS sysIntEnable (); +IMPORT int sysBusIntAck (); +IMPORT STATUS sysBusIntGen (); +IMPORT STATUS sysMailboxEnable (); +IMPORT STATUS sysMailboxConnect (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsh7750h */ diff --git a/h/arch/sh/sh7751.h b/h/arch/sh/sh7751.h new file mode 100644 index 0000000..618615c --- /dev/null +++ b/h/arch/sh/sh7751.h @@ -0,0 +1,185 @@ +/* sh7751.h - SH7751 header */ + +/* Copyright 1984-1998 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,11jun01,h_k added for PCI definition. +01c,09mar01,frf corrected PCI register definition. +01b,20feb01,hk added closing brace for __cplusplus. +01a,10jul00,frf Added declaration of new Regs +01a,05apr00,dgy created. +*/ + +/* +DESCRIPTION +This file contains I/O addresses and related constants for the SH7751 chip. +It will be used as an additional file to the sh7750.h and may redefine +elements already created therein. +*/ + +#ifndef __INCsh7751h +#define __INCsh7751h + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Interrupt Controller Regfisters */ + +#define INT_PRI_00 ((volatile UINT32 *)0xfe080000) /* Interrupt Priority level setting register 00 */ +#define INT_REQ_00 ((volatile UINT32 *)0xfe080020) /* Interrupt Factor register 00 */ +#define INT_MSK_00 ((volatile UINT32 *)0xfe080040) /* Interrupt Mask register 00 */ +#define INT_MSKCLR_00 ((volatile UINT32 *)0xfe080060) /* Interrupt Mask Clear register 00 */ + +/* FRQCR2 (FReQuency Control Register 2) */ + +#define FRQCR2 ((volatile UINT16 *)0xffc00014) + + +/* TMU register addresses */ + +/* The 7750 is a 32 bit x 3ch Timer Unit, the 7751 uses the same */ +/* definitions for the first 3 timers, but then has 2 additional */ +/* available that have the following new register definitions. */ + +#define TMU_TIMESTAMP_0 0 /* Timer 2 */ +#define TMU_TIMESTAMP_1 1 /* Timer 3 */ +#define TMU_TIMESTAMP_2 2 /* Timer 4 */ + +#define TMU_TSTR2_START_CNTL ((volatile UINT8 *)0xfe100004) + +#define TMU_TCOR_CONST_3 ((volatile UINT32 *)0xfe100008) +#define TMU_TCNT_COUNT_3 ((volatile UINT32 *)0xfe10000c) +#define TMU_TCR_CNTL_3 ((volatile UINT16 *)0xfe100010) + +#define TMU_TCOR_CONST_4 ((volatile UINT32 *)0xfe100014) +#define TMU_TCNT_COUNT_4 ((volatile UINT32 *)0xfe100018) +#define TMU_TCR_CNTL_4 ((volatile UINT16 *)0xfe10001c) + +/* TMU_TSTR2_START_CNTL (Timer STart Register2) bit definitions */ + +#define TSTR2_STOP_ALL ((UINT8)0x00) /* stop counter 3/4 */ +#define TSTR2_START_3 ((UINT8)0x01) /* start counter 0 */ +#define TSTR2_START_4 ((UINT8)0x02) /* start counter 1 */ + +#define SH7751_NO_TIMERS 3 + + +/* Specific PCI Control Registers */ + +#define PCIC_PCI_CONFIG_BASE 0xfe200000 /* configuration register 0 */ +#define PCIC_CONFIG_0 (volatile UINT32 *)(PCIC_PCI_CONFIG_BASE+0x00) /* PCI config reg 0 */ +#define PCIC_CONFIG_1 (volatile UINT32 *)(PCIC_PCI_CONFIG_BASE+0x04) /* PCI config reg 1 */ +#define PCIC_CONFIG_2 (volatile UINT32 *)(PCIC_PCI_CONFIG_BASE+0x08) /* PCI config reg 2 */ +#define PCIC_CONFIG_3 (volatile UINT32 *)(PCIC_PCI_CONFIG_BASE+0x0C) /* PCI config reg 3 */ +#define PCIC_CONFIG_4 (volatile UINT32 *)(PCIC_PCI_CONFIG_BASE+0x10) /* PCI config reg 4 */ +#define PCIC_CONFIG_5 (volatile UINT32 *)(PCIC_PCI_CONFIG_BASE+0x14) /* PCI config reg 5 */ +#define PCIC_CONFIG_6 (volatile UINT32 *)(PCIC_PCI_CONFIG_BASE+0x18) /* PCI config reg 6 */ +#define PCIC_CONFIG_7 (volatile UINT32 *)(PCIC_PCI_CONFIG_BASE+0x1C) /* PCI config reg 7 */ +#define PCIC_CONFIG_8 (volatile UINT32 *)(PCIC_PCI_CONFIG_BASE+0x20) /* PCI config reg 8 */ +#define PCIC_CONFIG_9 (volatile UINT32 *)(PCIC_PCI_CONFIG_BASE+0x24) /* PCI config reg 9 */ +#define PCIC_CONFIG_10 (volatile UINT32 *)(PCIC_PCI_CONFIG_BASE+0x28) /* PCI config reg 10*/ +#define PCIC_CONFIG_11 (volatile UINT32 *)(PCIC_PCI_CONFIG_BASE+0x2C) /* PCI config reg 11*/ +#define PCIC_CONFIG_12 (volatile UINT32 *)(PCIC_PCI_CONFIG_BASE+0x30) /* PCI config reg 12*/ +#define PCIC_CONFIG_13 (volatile UINT32 *)(PCIC_PCI_CONFIG_BASE+0x34) /* PCI config reg 13*/ +#define PCIC_CONFIG_14 (volatile UINT32 *)(PCIC_PCI_CONFIG_BASE+0x38) /* PCI config reg 14*/ +#define PCIC_CONFIG_15 (volatile UINT32 *)(PCIC_PCI_CONFIG_BASE+0x3C) /* PCI config reg 15*/ +#define PCIC_CONFIG_16 (volatile UINT32 *)(PCIC_PCI_CONFIG_BASE+0x40) /* PCI config reg 16*/ +#define PCIC_CONFIG_17 (volatile UINT32 *)(PCIC_PCI_CONFIG_BASE+0x44) /* PCI config reg 17*/ + +#define PCICR ((volatile UINT32 *)0xfe200100) /* PCI Control Register */ +/* Bit field Mask */ +#define PCICR_CFINIT 0x0001 /*set to initialise pcic*/ +#define PCICR_INTA 0x0004 /* Software control of INTA */ +#define PCICR_SERR 0x0008 /* Software control of SERR */ +#define PCICR_BMABT 0x0040 /*controls arbitration mode of bus master*/ +#define PCICR_BYTESWAP 0x0100 /*data byte endian swap little/big*/ +#define PCICR_KEY 0xa5000000 /* Key to enable reg. write */ + +#define PCILSR0 ((volatile UINT32 *)0xfe200104) /* Local space register 0 for PCI */ +#define PCILSR1 ((volatile UINT32 *)0xfe200108) /* Local space register 1 for PCI */ +#define PCILAR0 ((volatile UINT32 *)0xfe20010C) /* Local address register 0 for PCI */ +#define PCILAR1 ((volatile UINT32 *)0xfe200110) /* Local address register 1 for PCI */ +#define PCIINT ((volatile UINT32 *)0xfe200114) /* PCI interrupt register */ +#define PCIINTM ((volatile UINT32 *)0xfe200118) /* PCI interrupt mask register */ +#define PCIALR ((volatile UINT32 *)0xfe20011C) /* Error Address data register for PCI */ +#define PCICLR ((volatile UINT32 *)0xfe200120) /* Error Command data register for PCI */ +/* Reserved Register 0xfe200124 */ +/* Reserved Register 0xfe200128 */ +/* Reserved Register 0xfe20012C */ +#define PCIAINT ((volatile UINT32 *)0xfe200130) /* PCI arbiter interrupt register */ +#define PCIAINTM ((volatile UINT32 *)0xfe200134) /* PCI arbiter interrupt mask register */ +#define PCIBMLR ((volatile UINT32 *)0xfe200138) /* Error Bus Master data Register */ +/* Reserved Register 0xfe20013C */ + +/************** DMA SECTICTION ********************************/ + +#define PCIDMABT ((volatile UINT32 *)0xfe200140) /* DMA Transfet arbitration register for PCI */ +/************** DMA CHANNEL 0 *******************************/ + +#define PCIDPA0 ((volatile UINT32 *)0xfe200180) /* DMA transfer PCI address register 1 for PCI */ +#define PCIDLA0 ((volatile UINT32 *)0xfe200184) /* DMA transfer local bus starting address register 0 for PCI */ +#define PCIDTC0 ((volatile UINT32 *)0xfe200188) /* DMA transfer count register 0 for PCI */ +#define PCIDCR0 ((volatile UINT32 *)0xfe20018C) /* DMA Control Register 0 for PCI */ +/************** DMA CHANNEL 1 *******************************/ + +#define PCIDPA1 ((volatile UINT32 *)0xfe200190) /* DMA transfer PCI address register 1 for PCI */ +#define PCIDLA1 ((volatile UINT32 *)0xfe200194) /* DMA transfer local bus starting address register 1 for PCI */ +#define PCIDTC1 ((volatile UINT32 *)0xfe200198) /* DMA transfer count register 1 for PCI */ +#define PCIDCR1 ((volatile UINT32 *)0xfe20019C) /* DMA Control Register 1 for PCI */ +/************** DMA CHANNEL 2 *******************************/ + +#define PCIDPA2 ((volatile UINT32 *)0xfe2001A0) /* DMA transfer PCI address register 2 for PCI */ +#define PCIDLA2 ((volatile UINT32 *)0xfe2001A4) /* DMA transfer local bus starting address register 2 for PCI */ +#define PCIDTC2 ((volatile UINT32 *)0xfe2001A8) /* DMA transfer count register 2 for PCI */ +#define PCIDCR2 ((volatile UINT32 *)0xfe2001AC) /* DMA Control Register 2 for PCI */ +/************** DMA CHANNEL 3 *******************************/ + +#define PCIDPA3 ((volatile UINT32 *)0xfe2001B0) /* DMA transfer PCI address register 3 for PCI */ +#define PCIDLA3 ((volatile UINT32 *)0xfe2001B4) /* DMA transfer local bus starting address register 3 for PCI */ +#define PCIDTC3 ((volatile UINT32 *)0xfe2001B8) /* DMA transfer count register 3 for PCI */ +#define PCIDCR3 ((volatile UINT32 *)0xfe2001BC) /* DMA Control Register 3 for PCI */ +/************** END DMA SECTION ******************************/ + +#define PCIPAR ((volatile UINT32 *)0xfe2001C0) /* PIO Address register */ +#define PCIMBR ((volatile UINT32 *)0xfe2001C4) /* Memory space base register */ +#define PCIIOBR ((volatile UINT32 *)0xfe2001C8) /* IO space base register */ +#define PCIPINT ((volatile UINT32 *)0xfe2001CC) /* PCI power managment interrupt register */ +#define PCIPINTM ((volatile UINT32 *)0xfe2001D0) /* PCI power managment interrupt mask register */ +#define PCICLKR ((volatile UINT32 *)0xfe2001D4) /* PCI Clock control register */ +#define PCIBCR1 ((volatile UINT32 *)0xfe2001E0) /* PCI bus control registrer 1 */ +#define PCIBCR2 ((volatile UINT32 *)0xfe2001E4) /* PCI bus control registrer 2 */ +#define PCIWCR1 ((volatile UINT32 *)0xfe2001E8) /* PCI wait control register 1 */ +#define PCIWCR2 ((volatile UINT32 *)0xfe2001EC) /* PCI wait control register 2 */ +#define PCIWCR3 ((volatile UINT32 *)0xfe2001F0) /* PCI wait control register 3 */ +#define PCIMCR ((volatile UINT32 *)0xfe2001F4) /* PCIC discrete memory control register */ +#define PCIPCTR ((volatile UINT32 *)0xfe200200) /* Port Control Register */ +#define PCIPDTR ((volatile UINT32 *)0xfe200204) /* Port Data Register */ +#define PCIPDR ((volatile UINT32 *)0xfe200220) /* PIO data register */ +#define PCIIO 0xfe240000 /* PCI IO space base address,accesable 8, \ + 16,32 according to PCI I/O space (256KB) */ + + +/* function declarations */ + +#ifndef _ASMLANGUAGE +#if defined(__STDC__) || defined(__cplusplus) + +#else /* __STDC__ */ + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsh7751h */ + + + + diff --git a/h/arch/sh/sh7760.h b/h/arch/sh/sh7760.h new file mode 100644 index 0000000..e87ecc4 --- /dev/null +++ b/h/arch/sh/sh7760.h @@ -0,0 +1,381 @@ +/* sh7760.h - SH7760 header */ + +/* Copyright 2002-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,11apr03,??? Merge GPIO and DMA register definitions. +01b,05mar03,rgp added CAN device and clocking register defs +01a,17oct02,h_k written. +*/ + +/* +DESCRIPTION +This file contains I/O addresses and related constants for the SH7760 chip. +*/ + +#ifndef __INCsh7760h +#define __INCsh7760h + +#ifdef __cplusplus +extern "C" { +#endif + + +/* INTC (INTerrupt Controller) register addresses */ + +#define INTC_IPRD ((volatile UINT16 *)0xffd00010) /* priority setup D */ +#define INT_PRI_00 ((volatile UINT32 *)0xfe080000) /* priority setup 00 */ +#define INT_PRI_04 ((volatile UINT32 *)0xfe080004) /* priority setup 04 */ +#define INT_PRI_08 ((volatile UINT32 *)0xfe080008) /* priority setup 08 */ +#define INT_PRI_0C ((volatile UINT32 *)0xfe08000c) /* priority setup 0C */ +#define INT_REQ_00 ((volatile UINT32 *)0xfe080020) /* int source 00 */ +#define INT_REQ_04 ((volatile UINT32 *)0xfe080024) /* int source 04 */ +#define INT_MSK_00 ((volatile UINT32 *)0xfe080040) /* int mask 00 */ +#define INT_MSK_04 ((volatile UINT32 *)0xfe080044) /* int mask 04 */ +#define INT_MSKCLR_00 ((volatile UINT32 *)0xfe080060) /* int mask clear 00 */ +#define INT_MSKCLR_04 ((volatile UINT32 *)0xfe080064) /* int mask clear 04 */ + +/* INTC INTREQ00, INTMSK00 and INTMSKCLR00 bit definitions */ + +#define INT00_IRQ4 ((UINT32)0x80000000) +#define INT00_IRQ5 ((UINT32)0x40000000) +#define INT00_IRQ6 ((UINT32)0x20000000) +#define INT00_IRQ7 ((UINT32)0x10000000) +#define INT00_IRQ (INT00_IRQ4 | INT00_IRQ5 | INT00_IRQ6 | INT00_IRQ7) +#define INT00_HCANI0 ((UINT32)0x02000000) +#define INT00_HCANI1 ((UINT32)0x01000000) +#define INT00_HCAN2 (INT00_HCANI0 | INT00_HCANI1) +#define INT00_SSII0 ((UINT32)0x00800000) +#define INT00_SSII1 ((UINT32)0x00400000) +#define INT00_SSI (INT00_SSII0 | INT00_SSII1) +#define INT00_AC97I0 ((UINT32)0x00200000) +#define INT00_AC97I1 ((UINT32)0x00100000) +#define INT00_AC97 (INT00_AC97I0 | INT00_AC97I1) +#define INT00_IICI0 ((UINT32)0x00080000) +#define INT00_IICI1 ((UINT32)0x00040000) +#define INT00_IIC (INT00_IICI0 | INT00_IICI1) +#define INT00_USB ((UINT32)0x00020000) +#define INT00_LCDC ((UINT32)0x00010000) +#define INT00_DMABRGI0 ((UINT32)0x00004000) +#define INT00_DMABRGI1 ((UINT32)0x00002000) +#define INT00_DMABRGI2 ((UINT32)0x00001000) +#define INT00_DMABRG (INT00_DMABRGI0 | INT00_DMABRGI1 | INT00_DMABRGI2) +#define INT00_ERI0 ((UINT32)0x00000800) +#define INT00_RXI0 ((UINT32)0x00000400) +#define INT00_BRI0 ((UINT32)0x00000200) +#define INT00_TXI0 ((UINT32)0x00000100) +#define INT00_SCIF0 (INT00_ERI0 | INT00_RXI0 | INT00_BRI0 | INT00_TXI0) +#define INT00_ERI1 ((UINT32)0x00000080) +#define INT00_RXI1 ((UINT32)0x00000040) +#define INT00_BRI1 ((UINT32)0x00000020) +#define INT00_TXI1 ((UINT32)0x00000010) +#define INT00_SCIF1 (INT00_ERI1 | INT00_RXI1 | INT00_BRI1 | INT00_TXI1) +#define INT00_ERI2 ((UINT32)0x00000008) +#define INT00_RXI2 ((UINT32)0x00000004) +#define INT00_BRI2 ((UINT32)0x00000002) +#define INT00_TXI2 ((UINT32)0x00000001) +#define INT00_SCIF2 (INT00_ERI2 | INT00_RXI2 | INT00_BRI2 | INT00_TXI2) +#define INT00_ALL (INT00_IRQ | INT00_HCAN2 | INT00_SSI | INT00_AC97 | \ + INT00_IIC | INT00_USB | INT00_LCDC | INT00_DMABRG | \ + INT00_SCIF0 | INT00_SCIF1 | INT00_SCIF2) + +/* INTC INTREQ04, INTMSK04 and INTMSKCLR04 bit definitions */ +#define INT04_SIM_ERI ((UINT32)0x00800000) +#define INT04_SIM_RXI ((UINT32)0x00400000) +#define INT04_SIM_TXI ((UINT32)0x00200000) +#define INT04_SIM_TEI ((UINT32)0x00100000) +#define INT04_SIM (INT04_SIM_ERI | INT04_SIM_RXI | INT04_SIM_TXI | \ + INT04_SIM_TEI) +#define INT04_SPI ((UINT32)0x00080000) +#define INT04_MMCI0 ((UINT32)0x00040000) +#define INT04_MMCI1 ((UINT32)0x00020000) +#define INT04_MMCI2 ((UINT32)0x00010000) +#define INT04_MMCI3 ((UINT32)0x00008000) +#define INT04_MMCIF (INT04_MMCI0 | INT04_MMCI1 | INT04_MMCI2 | INT04_MMCI3) +#define INT04_MFI ((UINT32)0x00000040) +#define INT04_FLSTE ((UINT32)0x00000020) +#define INT04_FLTEND ((UINT32)0x00000010) +#define INT04_FLTRQ0 ((UINT32)0x00000008) +#define INT04_FLTRQ1 ((UINT32)0x00000004) +#define INT04_FLCTL (INT04_FLSTE | INT04_FLTEND | INT04_FLTRQ0 | \ + INT04_FLTRQ1) +#define INT04_ADC ((UINT32)0x00000002) +#define INT04_CMT ((UINT32)0x00000001) +#define INT04_ALL (INT04_SIM | INT04_SPI | INT04_MMCIF | INT04_MFI | \ + INT04_FLCTL | INT04_ADC | INT04_CMT) + + +/* SCIF (Serial Communication Interface with FIFO) register addresses */ + +#define SCIF0_SMR ((volatile UINT16 *)0xfe600000) /* serial mode */ +#define SCIF0_BRR ((volatile UINT8 *)0xfe600004) /* bit rate */ +#define SCIF0_SCR ((volatile UINT16 *)0xfe600008) /* serial control */ +#define SCIF0_FTDR ((volatile UINT8 *)0xfe60000c) /* transmit FIFO data */ +#define SCIF0_FSR ((volatile UINT16 *)0xfe600010) /* serial status */ +#define SCIF0_FRDR ((volatile UINT8 *)0xfe600014) /* receive FIFO data */ +#define SCIF0_FCR ((volatile UINT16 *)0xfe600018) /* FIFO control */ +#define SCIF0_TFDR ((volatile UINT16 *)0xfe60001c) /* tra FIFO data count*/ +#define SCIF0_RFDR ((volatile UINT16 *)0xfe600020) /* rec FIFO data count*/ +#define SCIF0_SPTR ((volatile UINT16 *)0xfe600024) /* serial port reg */ +#define SCIF0_LSR ((volatile UINT16 *)0xfe600028) /* line status */ +#define SCIF0_RER ((volatile UINT16 *)0xfe60002c) /* serial error reg */ + +#define SCIF1_SMR ((volatile UINT16 *)0xfe610000) /* serial mode */ +#define SCIF1_BRR ((volatile UINT8 *)0xfe610004) /* bit rate */ +#define SCIF1_SCR ((volatile UINT16 *)0xfe610008) /* serial control */ +#define SCIF1_FTDR ((volatile UINT8 *)0xfe61000c) /* transmit FIFO data */ +#define SCIF1_FSR ((volatile UINT16 *)0xfe610010) /* serial status */ +#define SCIF1_FRDR ((volatile UINT8 *)0xfe610014) /* receive FIFO data */ +#define SCIF1_FCR ((volatile UINT16 *)0xfe610018) /* FIFO control */ +#define SCIF1_TFDR ((volatile UINT16 *)0xfe61001c) /* tra FIFO data count*/ +#define SCIF1_RFDR ((volatile UINT16 *)0xfe610020) /* rec FIFO data count*/ +#define SCIF1_SPTR ((volatile UINT16 *)0xfe610024) /* serial port reg */ +#define SCIF1_LSR ((volatile UINT16 *)0xfe610028) /* line status */ +#define SCIF1_RER ((volatile UINT16 *)0xfe61002c) /* serial error reg */ + +#define SCIF2_SMR ((volatile UINT16 *)0xfe620000) /* serial mode */ +#define SCIF2_BRR ((volatile UINT8 *)0xfe620004) /* bit rate */ +#define SCIF2_SCR ((volatile UINT16 *)0xfe620008) /* serial control */ +#define SCIF2_FTDR ((volatile UINT8 *)0xfe62000c) /* transmit FIFO data */ +#define SCIF2_FSR ((volatile UINT16 *)0xfe620010) /* serial status */ +#define SCIF2_FRDR ((volatile UINT8 *)0xfe620014) /* receive FIFO data */ +#define SCIF2_FCR ((volatile UINT16 *)0xfe620018) /* FIFO control */ +#define SCIF2_TFDR ((volatile UINT16 *)0xfe62001c) /* tra FIFO data count*/ +#define SCIF2_RFDR ((volatile UINT16 *)0xfe620020) /* rec FIFO data count*/ +#define SCIF2_SPTR ((volatile UINT16 *)0xfe620024) /* serial port reg */ +#define SCIF2_LSR ((volatile UINT16 *)0xfe620028) /* line status */ +#define SCIF2_RER ((volatile UINT16 *)0xfe62002c) /* serial error reg */ + + + +/* HCAN2 controlers base addresses and register offsets (incomplete) */ + +#define HCAN0_MCR ((volatile UINT16 *)0xfe380000) /* module control */ +#define HCAN0_GSR ((volatile UINT16 *)0xfe380002) /* general status */ +#define HCAN0_BCR1 ((volatile UINT16 *)0xfe380004) /* bit timing config l*/ +#define HCAN0_BCR0 ((volatile UINT16 *)0xfe380006) /* bit timing config 0*/ +#define HCAN0_IRR ((volatile UINT16 *)0xfe380008) /* interrupt */ +#define HCAN0_IMR ((volatile UINT16 *)0xfe38000a) /* interrupt mask */ +#define HCAN0_TECREC ((volatile UINT16 *)0xfe38000c) /* tx error/rx error */ +#define HCAN0_TXPR1 ((volatile UINT16 *)0xfe380020) /* tx pending reg 1 */ +#define HCAN0_TXPR0 ((volatile UINT16 *)0xfe380022) /* tx pending reg 0 */ +#define HCAN0_TXCR1 ((volatile UINT16 *)0xfe380028) /* tx cancel reg 1 */ +#define HCAN0_TXCR0 ((volatile UINT16 *)0xfe38002a) /* tx cancel reg 0 */ +#define HCAN0_TXACK1 ((volatile UINT16 *)0xfe380030) /* tx ack reg 1 */ +#define HCAN0_TXACK0 ((volatile UINT16 *)0xfe380032) /* tx ack reg 0 */ +#define HCAN0_ABACK1 ((volatile UINT16 *)0xfe380038) /* abort ack reg 1 */ +#define HCAN0_ABACK0 ((volatile UINT16 *)0xfe38003a) /* abort ack reg 0 */ +#define HCAN0_RXPR1 ((volatile UINT16 *)0xfe380040) /* rx pending reg 1 */ +#define HCAN0_RXPR0 ((volatile UINT16 *)0xfe380042) /* rx pending reg 0 */ +#define HCAN0_RFPR1 ((volatile UINT16 *)0xfe380048) /* rem. pending reg 1 */ +#define HCAN0_RFPR0 ((volatile UINT16 *)0xfe38004a) /* rem. pending reg 0 */ +#define HCAN0_MBIMR1 ((volatile UINT16 *)0xfe380050) /* mb intr. mask reg 1*/ +#define HCAN0_MBIMR0 ((volatile UINT16 *)0xfe380052) /* mb intr. mask reg 0*/ +#define HCAN0_UMSR1 ((volatile UINT16 *)0xfe380058) /* unread status reg 1*/ +#define HCAN0_UMSR0 ((volatile UINT16 *)0xfe38005a) /* unread status reg 0*/ +#define HCAN0_TCNTR ((volatile UINT16 *)0xfe380080) /* timer counter */ +#define HCAN0_TCR ((volatile UINT16 *)0xfe380082) /* timer control */ +#define HCAN0_TSR ((volatile UINT16 *)0xfe380084) /* timer prescalar */ +#define HCAN0_TDCR ((volatile UINT16 *)0xfe380086) /* timer drift */ +#define HCAN0_LOSR ((volatile UINT16 *)0xfe380088) /* local offset */ +#define HCAN0_MBRx_ADDRESS(mbrn) \ + ((volatile UINT16 *)((char*)(0xfe380000) + \ + (0x100+(mbrn*32)))) + +#define HCAN1_MCR ((volatile UINT16 *)0xfe390000) /* module control */ +#define HCAN1_GSR ((volatile UINT16 *)0xfe390002) /* general status */ +#define HCAN1_BCR1 ((volatile UINT16 *)0xfe390004) /* bit timing config l*/ +#define HCAN1_BCR0 ((volatile UINT16 *)0xfe390006) /* bit timing config 0*/ +#define HCAN1_IRR ((volatile UINT16 *)0xfe390008) /* interrupt */ +#define HCAN1_IMR ((volatile UINT16 *)0xfe39000a) /* interrupt mask */ +#define HCAN1_TECREC ((volatile UINT16 *)0xfe39000c) /* tx error/rx error */ +#define HCAN1_TXPR1 ((volatile UINT16 *)0xfe390020) /* tx pending reg 1 */ +#define HCAN1_TXPR0 ((volatile UINT16 *)0xfe390022) /* tx pending reg 0 */ +#define HCAN1_TXCR1 ((volatile UINT16 *)0xfe390028) /* tx cancel reg 1 */ +#define HCAN1_TXCR0 ((volatile UINT16 *)0xfe39002a) /* tx cancel reg 0 */ +#define HCAN1_TXACK1 ((volatile UINT16 *)0xfe390030) /* tx ack reg 1 */ +#define HCAN1_TXACK0 ((volatile UINT16 *)0xfe390032) /* tx ack reg 0 */ +#define HCAN1_ABACK1 ((volatile UINT16 *)0xfe390038) /* abort ack reg 1 */ +#define HCAN1_ABACK0 ((volatile UINT16 *)0xfe39003a) /* abort ack reg 0 */ +#define HCAN1_RXPR1 ((volatile UINT16 *)0xfe390040) /* rx pending reg 1 */ +#define HCAN1_RXPR0 ((volatile UINT16 *)0xfe390042) /* rx pending reg 0 */ +#define HCAN1_RFPR1 ((volatile UINT16 *)0xfe390048) /* rem. pending reg 1 */ +#define HCAN1_RFPR0 ((volatile UINT16 *)0xfe39004a) /* rem. pending reg 0 */ +#define HCAN1_MBIMR1 ((volatile UINT16 *)0xfe390050) /* mb intr. mask reg 1*/ +#define HCAN1_MBIMR0 ((volatile UINT16 *)0xfe390052) /* mb intr. mask reg 0*/ +#define HCAN1_UMSR1 ((volatile UINT16 *)0xfe390058) /* unread status reg 1*/ +#define HCAN1_UMSR0 ((volatile UINT16 *)0xfe39005a) /* unread status reg 0*/ +#define HCAN1_TCNTR ((volatile UINT16 *)0xfe390080) /* timer counter */ +#define HCAN1_TCR ((volatile UINT16 *)0xfe390082) /* timer control */ +#define HCAN1_TSR ((volatile UINT16 *)0xfe390084) /* timer prescalar */ +#define HCAN1_TDCR ((volatile UINT16 *)0xfe390086) /* timer drift */ +#define HCAN1_LOSR ((volatile UINT16 *)0xfe390088) /* local offset */ +#define HCAN1_MBRx_ADDRESS(mbrn) \ + ((volatile UINT16 *)((char*)(0xfe390000) + \ + (0x100+(mbrn*32)))) + + +/* Clock Pulse Generator (CPG) module */ + +#define CPG_FRQCR ((volatile UINT16 *)0xffc00000) /* freq control reg */ +#define CPG_STBCR ((volatile UINT8 *)0xffc00004) /* standby control */ +#define CPG_WTCNT ((volatile UINT16 *)0xffc00008) /* watchdog counter */ +#define CPG_WTCSR ((volatile UINT16 *)0xffc0000c) /* watchdog control */ +#define CPG_STBCR2 ((volatile UINT8 *)0xffc00010) /* standby control 2 */ +#define CPG_CLKSTP00 ((volatile UINT32 *)0xfe0a0000) /* clock stop */ +#define CPG_CLKSTPCLR00 ((volatile UINT32 *)0xfe0a0010) /* clock stop clear */ +#define CPG_DCKDR ((volatile UINT32 *)0xfe0a0020) /* clk division reg */ +#define CPG_MCKCR ((volatile UINT32 *)0xfe0a0024) /* module clk control*/ + +/* --------------------------------------------------------------------------*/ +/* CLKSTP module assignments bit module */ +/* --------------------------------------------------------------------------*/ +#define CLKSTP_INTC ((UINT32)0x00000001) /* 0 INTC */ +#define CLKSTP_UNDEF0 ((UINT32)0x0000001e) /* 1-4 unused */ +#define CLKSTP_FCLK ((UINT32)0x00000020) /* 5 FCLK (FLCTL) */ +#define CLKSTP_UNDEF1 ((UINT32)0x000000c0) /* 6-7 unused */ +#define CLKSTP_DMAC ((UINT32)0x00000100) /* 8 DMAC */ +#define CLKSTP_MMCIF ((UINT32)0x00000200) /* 9 MMCIF */ +#define CLKSTP_GPIO ((UINT32)0x00000400) /* 10 GPIO */ +#define CLKSTP_DMABRG ((UINT32)0x00000800) /* 11 DMABRG */ +#define CLKSTP_HCAN0 ((UINT32)0x00001000) /* 12 HCAN 0 */ +#define CLKSTP_HCAN1 ((UINT32)0x00002000) /* 13 HCAN 1 */ +#define CLKSTP_ADC ((UINT32)0x00004000) /* 14 ADC */ +#define CLKSTP_AC97_0 ((UINT32)0x00008000) /* 15 AC97 0 */ +#define CLKSTP_AC97_1 ((UINT32)0x00010000) /* 16 AC97 1 */ +#define CLKSTP_CMT ((UINT32)0x00020000) /* 17 CMT */ +#define CLKSTP_FLCTL ((UINT32)0x00040000) /* 18 FLCTL */ +#define CLKSTP_USB ((UINT32)0x00080000) /* 19 USB */ +#define CLKSTP_LCDC ((UINT32)0x00100000) /* 20 LCDC */ +#define CLKSTP_UNDEF2 ((UINT32)0x00200000) /* 21 unused */ +#define CLKSTP_SPI ((UINT32)0x00400000) /* 22 SPI */ +#define CLKSTP_MFI ((UINT32)0x00800000) /* 23 MFI */ +#define CLKSTP_SIM ((UINT32)0x01000000) /* 24 SIM */ +#define CLKSTP_IIC0 ((UINT32)0x02000000) /* 25 IIC 0 */ +#define CLKSTP_IIC1 ((UINT32)0x04000000) /* 26 IIC 1 */ +#define CLKSTP_SCIF0 ((UINT32)0x08000000) /* 27 SCIF 0 */ +#define CLKSTP_SCIF1 ((UINT32)0x10000000) /* 28 SCIF 1 */ +#define CLKSTP_SCIF2 ((UINT32)0x20000000) /* 29 SCIF 2 */ +#define CLKSTP_SSI0 ((UINT32)0x40000000) /* 30 SSI 0 */ +#define CLKSTP_SSI1 ((UINT32)0x80000000) /* 31 SSI 1 */ + +/* GPIO Registers*/ +#define GPIO_PCCR ((volatile UINT16 *)0xfe400008) /* port C ctrl register */ +#define GPIO_PDCR ((volatile UINT16 *)0xfe40000C) /* port D ctrl register */ +#define GPIO_PECR ((volatile UINT16 *)0xfe400010) /* port E ctrl register */ +/* Peripheral Module Select Register*/ +#define PFC_IPSELR ((volatile UINT16 *)0xfe400034) +/* The registers related to the DMA controller*/ +#define DMA_DMAOR ((volatile UINT32 *)0xFFA00040) +#define DMA_DMATCR1 ((volatile UINT32 *)0xFFA00018) +#define DMA_CHCR1 ((volatile UINT32 *)0xFFA0001C) +#define DMA_DMAOR ((volatile UINT32 *)0xFFA00040) +#define DMA_DMARCR ((volatile UINT32 *)0xFE090008) /*Bridge Enable*/ +#define DMA_DMARSRA ((volatile UINT32 *)0xFE090000) +#define DMA_DMABRGCR ((volatile UINT32 *)0xFE3C0000) + + +/* interrupt vector numbers */ + +/*---------------------------------------------------------------------------*/ +/* exception/interrupt name (code >> 5) No. vector entry point */ +/*---------------------------------------------------------------------------*/ +#define INUM_DMAC_DMTE4 (0x780 >> 5) /* 60 0x0f0 (vbr + 0x600) */ +#define INUM_DMAC_DMTE5 (0x7a0 >> 5) /* 61 0x0f4 (vbr + 0x600) */ +#define INUM_DMAC_DMTE6 (0x7c0 >> 5) /* 62 0x0f8 (vbr + 0x600) */ +#define INUM_DMAC_DMTE7 (0x7e0 >> 5) /* 63 0x0fc (vbr + 0x600) */ +#define INUM_IRQ4 (0x800 >> 5) /* 64 0x100 (vbr + 0x600) */ +#define INUM_IRQ5 (0x820 >> 5) /* 65 0x104 (vbr + 0x600) */ +#define INUM_IRQ6 (0x840 >> 5) /* 66 0x108 (vbr + 0x600) */ +#define INUM_IRQ7 (0x860 >> 5) /* 67 0x10c (vbr + 0x600) */ +#define INUM_SCIF0_ERI (0x880 >> 5) /* 68 0x110 (vbr + 0x600) */ +#define INUM_SCIF0_RXI (0x8a0 >> 5) /* 69 0x114 (vbr + 0x600) */ +#define INUM_SCIF0_BRI (0x8c0 >> 5) /* 70 0x118 (vbr + 0x600) */ +#define INUM_SCIF0_TXI (0x8e0 >> 5) /* 71 0x11c (vbr + 0x600) */ +#define INUM_SHCAN2_CANI0 (0x900 >> 5) /* 72 0x120 (vbr + 0x600) */ +#define INUM_SHCAN2_CANI1 (0x920 >> 5) /* 73 0x124 (vbr + 0x600) */ +#define INUM_SSI_SSI0 (0x940 >> 5) /* 74 0x128 (vbr + 0x600) */ +#define INUM_SSI_SSI1 (0x960 >> 5) /* 75 0x12c (vbr + 0x600) */ +#define INUM_AC97_AC97I0 (0x980 >> 5) /* 76 0x130 (vbr + 0x600) */ +#define INUM_AC97_AC97I1 (0x9a0 >> 5) /* 77 0x134 (vbr + 0x600) */ +#define INUM_IIC_IICI0 (0x9c0 >> 5) /* 78 0x138 (vbr + 0x600) */ +#define INUM_IIC_IICI1 (0x9e0 >> 5) /* 79 0x13c (vbr + 0x600) */ +#define INUM_USB_USBI (0xa00 >> 5) /* 80 0x140 (vbr + 0x600) */ +#define INUM_LCDC_VINT (0xa20 >> 5) /* 81 0x144 (vbr + 0x600) */ +/* (0xa40 >> 5) 82 0x148 (vbr + 0x600) */ +/* (0xa60 >> 5) 83 0x14c (vbr + 0x600) */ +#define INUM_DMABRG_DMABRGI0 (0xa80 >> 5) /* 84 0x150 (vbr + 0x600) */ +#define INUM_DMABRG_DMABRGI1 (0xaa0 >> 5) /* 85 0x154 (vbr + 0x600) */ +#define INUM_DMABRG_DMABRGI2 (0xac0 >> 5) /* 86 0x158 (vbr + 0x600) */ +/* (0xae0 >> 5) 87 0x15c (vbr + 0x600) */ +#define INUM_SCIF1_ERI (0xb00 >> 5) /* 88 0x160 (vbr + 0x600) */ +#define INUM_SCIF1_RXI (0xb20 >> 5) /* 89 0x164 (vbr + 0x600) */ +#define INUM_SCIF1_BRI (0xb40 >> 5) /* 90 0x168 (vbr + 0x600) */ +#define INUM_SCIF1_TXI (0xb60 >> 5) /* 91 0x16c (vbr + 0x600) */ +#define INUM_SCIF2_ERI (0xb80 >> 5) /* 92 0x170 (vbr + 0x600) */ +#define INUM_SCIF2_RXI (0xba0 >> 5) /* 93 0x174 (vbr + 0x600) */ +#define INUM_SCIF2_BRI (0xbc0 >> 5) /* 94 0x178 (vbr + 0x600) */ +#define INUM_SCIF2_TXI (0xbe0 >> 5) /* 95 0x17c (vbr + 0x600) */ +#define INUM_SIM_ERI (0xc00 >> 5) /* 96 0x180 (vbr + 0x600) */ +#define INUM_SIM_RXI (0xc20 >> 5) /* 97 0x184 (vbr + 0x600) */ +#define INUM_SIM_TXI (0xc40 >> 5) /* 98 0x188 (vbr + 0x600) */ +#define INUM_SIM_TEI (0xc60 >> 5) /* 99 0x18c (vbr + 0x600) */ +#define INUM_SPI_SPII (0xc80 >> 5) /* 100 0x190 (vbr + 0x600) */ +/* (0xca0 >> 5) 101 0x194 (vbr + 0x600) */ +/* (0xcc0 >> 5) 102 0x198 (vbr + 0x600) */ +/* (0xce0 >> 5) 103 0x19c (vbr + 0x600) */ +#define INUM_MMCIF_MMCI0 (0xd00 >> 5) /* 104 0x1a0 (vbr + 0x600) */ +#define INUM_MMCIF_MMCI1 (0xd20 >> 5) /* 105 0x1a4 (vbr + 0x600) */ +#define INUM_MMCIF_MMCI2 (0xd40 >> 5) /* 106 0x1a8 (vbr + 0x600) */ +#define INUM_MMCIF_MMCI3 (0xd60 >> 5) /* 107 0x1ac (vbr + 0x600) */ +/* (0xd80 >> 5) 108 0x1b0 (vbr + 0x600) */ +/* (0xda0 >> 5) 109 0x1b4 (vbr + 0x600) */ +/* (0xdc0 >> 5) 110 0x1b8 (vbr + 0x600) */ +/* (0xde0 >> 5) 111 0x1bc (vbr + 0x600) */ +/* (0xe00 >> 5) 112 0x1c0 (vbr + 0x600) */ +/* (0xe20 >> 5) 113 0x1c4 (vbr + 0x600) */ +/* (0xe40 >> 5) 114 0x1c8 (vbr + 0x600) */ +/* (0xe60 >> 5) 115 0x1cc (vbr + 0x600) */ +#define INUM_MFI_MFII (0xe80 >> 5) /* 116 0x1d0 (vbr + 0x600) */ +/* (0xea0 >> 5) 117 0x1d4 (vbr + 0x600) */ +/* (0xec0 >> 5) 118 0x1d8 (vbr + 0x600) */ +/* (0xee0 >> 5) 119 0x1dc (vbr + 0x600) */ +#define INUM_FLCTL_FLSTE (0xf00 >> 5) /* 120 0x1e0 (vbr + 0x600) */ +#define INUM_FLCTL_FLTEND (0xf20 >> 5) /* 121 0x1e4 (vbr + 0x600) */ +#define INUM_FLCTL_FLTRQ0 (0xf40 >> 5) /* 122 0x1e8 (vbr + 0x600) */ +#define INUM_FLCTL_FLTRQ1 (0xf60 >> 5) /* 123 0x1ec (vbr + 0x600) */ +#define INUM_ADC_ADI (0xf80 >> 5) /* 124 0x1f0 (vbr + 0x600) */ +#define INUM_CMT_CMTI (0xfa0 >> 5) /* 125 0x1f4 (vbr + 0x600) */ + + +/* virtual interrupt vectors defined */ + +#define IV_IRQ0 INUM_TO_IVEC (INUM_IRL15) +#define IV_IRQ1 INUM_TO_IVEC (INUM_IRL14) +#define IV_IRQ2 INUM_TO_IVEC (INUM_IRL13) +#define IV_IRQ3 INUM_TO_IVEC (INUM_IRL12) +#define IV_IRQ4 INUM_TO_IVEC (INUM_IRL11) +#define IV_IRQ5 INUM_TO_IVEC (INUM_IRL10) +#define IV_IRQ6 INUM_TO_IVEC (INUM_IRL9) +#define IV_IRQ7 INUM_TO_IVEC (INUM_IRL8) +#define IV_IRQ8 INUM_TO_IVEC (INUM_IRL7) +#define IV_IRQ9 INUM_TO_IVEC (INUM_IRL6) +#define IV_IRQ10 INUM_TO_IVEC (INUM_IRL5) +#define IV_IRQ11 INUM_TO_IVEC (INUM_IRL4) +#define IV_IRQ12 INUM_TO_IVEC (INUM_IRL3) +#define IV_IRQ13 INUM_TO_IVEC (INUM_IRL2) +#define IV_IRQ14 INUM_TO_IVEC (INUM_IRL1) + +#define IV_SCIF1_ERI INUM_TO_IVEC (INUM_SCIF1_ERI) +#define IV_SCIF1_RXI INUM_TO_IVEC (INUM_SCIF1_RXI) +#define IV_SCIF1_BRI INUM_TO_IVEC (INUM_SCIF1_BRI) +#define IV_SCIF1_TXI INUM_TO_IVEC (INUM_SCIF1_TXI) + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsh7760h */ diff --git a/h/arch/sh/sh7770.h b/h/arch/sh/sh7770.h new file mode 100644 index 0000000..49ee87f --- /dev/null +++ b/h/arch/sh/sh7770.h @@ -0,0 +1,352 @@ +/* sh7770.h - SH7770 header */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +03b,24sep04,h_k added RTC_CLKSEL and GPIO register definitions. +02b,16apr04,h_k added UBC register addresses. (SPR #96445) + added INTC registers definitions. +01a,08apr04,h_k written. +*/ + +/* +DESCRIPTION +This file contains I/O addresses and related constants for the SH7770 chip. +*/ + +#ifndef __INCsh7770h +#define __INCsh7770h + +#ifdef __cplusplus +extern "C" { +#endif + + +/* INTC (INTerrupt Controller) register addresses */ + +#define INTC_ICR0 ((volatile UINT32 *)0xffd00000) /* control register 0 */ +#define INTC_ICR1 ((volatile UINT32 *)0xffd0001c) /* control register 1 */ +#define INTC_PRI ((volatile UINT32 *)0xffd00010) /* priority setup */ +#define INTC_REQ ((volatile UINT32 *)0xffd00024) /* int request */ +#define INTC_MSK0 ((volatile UINT32 *)0xffd00044) /* int mask 0 */ +#define INTC_MSK1 ((volatile UINT32 *)0xffd00048) /* int mask 1 */ +#define INTC_MSKCLR0 ((volatile UINT32 *)0xffd00064) /* int mask clear 0 */ +#define INTC_MSKCLR1 ((volatile UINT32 *)0xffd00068) /* int mask clear 1 */ +#define INTC_NMIFCR ((volatile UINT32 *)0xffd000c0) /* NMI flag control */ +#define INTC_USERIMASK ((volatile UINT32 *)0xff950000) /* user int mask */ + +/* ICR0 (INTerrupt Controller Register 0) definitions */ + +#define INTC_ICR0_NMIL (UINT32)0x80000000 +#define INTC_ICR0_MAI (UINT32)0x40000000 +#define INTC_ICR0_NMIB (UINT32)0x02000000 +#define INTC_ICR0_NMIE (UINT32)0x01000000 +#define INTC_ICR0_IRLM0 (UINT32)0x00800000 +#define INTC_ICR0_IRLM1 (UINT32)0x00400000 + +/* ICR1 (INTerrupt Controller Register 1) definitions */ + +#define INTC_ICR1_FAL_EDGE 0 +#define INTC_ICR1_RIS_EDGE 1 +#define INTC_ICR1_LOW_LVL 2 +#define INTC_ICR1_HIGH_LVL 3 + +#define INTC_ICR1_IRQ0_SHIFT 30 +#define INTC_ICR1_IRQ1_SHIFT 28 +#define INTC_ICR1_IRQ2_SHIFT 26 +#define INTC_ICR1_IRQ3_SHIFT 24 +#define INTC_ICR1_IRQ4_SHIFT 22 +#define INTC_ICR1_IRQ5_SHIFT 20 + +/* INTREQ (INTerrupt Request Register) definitions */ + +#define INTC_REQ_IR0 (UINT32)0x80000000 +#define INTC_REQ_IR1 (UINT32)0x40000000 +#define INTC_REQ_IR2 (UINT32)0x20000000 +#define INTC_REQ_IR3 (UINT32)0x10000000 +#define INTC_REQ_IR4 (UINT32)0x08000000 +#define INTC_REQ_IR5 (UINT32)0x04000000 + +/* INTMSK and INTMSKCLR Regisrters definitions */ + +#define INTC_MSK0_00 (UINT32)0x80000000 +#define INTC_MSK0_01 (UINT32)0x40000000 +#define INTC_MSK0_02 (UINT32)0x20000000 +#define INTC_MSK0_03 (UINT32)0x10000000 +#define INTC_MSK0_04 (UINT32)0x08000000 +#define INTC_MSK0_05 (UINT32)0x04000000 +#define INTC_MSK0_ALL (UINT32)0xfc000000 + +#define INTC_MSK1_10 (UINT32)0x80000000 +#define INTC_MSK1_ALL (UINT32)0x80000000 + +/* NMIFCR (NMI Fragment Controll Register) definitions */ + +#define INTC_NMIFCR_NMIL (UINT32)0x80000000 + +/* USERIMASK (User Mode Interrupt Mask Register) definitions */ + +#define INTC_USERIMASK_WKEY (UINT32)0xa5000000 +#define INTC_USERIMASK_SHIFT 4 + +/* INTC2 (INTerrupt Controller 2) register addresses */ + +#define INTC2_PRI0 ((volatile UINT32 *)0xffe00000) /* priority 0 setup */ +#define INTC2_PRI1 ((volatile UINT32 *)0xffe00004) /* priority 1 setup */ +#define INTC2_PRI2 ((volatile UINT32 *)0xffe00008) /* priority 2 setup */ +#define INTC2_PRI3 ((volatile UINT32 *)0xffe0000c) /* priority 3 setup */ +#define INTC2_PRI4 ((volatile UINT32 *)0xffe00010) /* priority 4 setup */ +#define INTC2_PRI5 ((volatile UINT32 *)0xffe00014) /* priority 5 setup */ +#define INTC2_PRI6 ((volatile UINT32 *)0xffe00018) /* priority 6 setup */ +#define INTC2_PRI7 ((volatile UINT32 *)0xffe0001c) /* priority 7 setup */ +#define INTC2_PRI8 ((volatile UINT32 *)0xffe00020) /* priority 8 setup */ +#define INTC2_PRI9 ((volatile UINT32 *)0xffe00024) /* priority 9 setup */ +#define INTC2_PRI10 ((volatile UINT32 *)0xffe00028) /* priority 10 setup */ +#define INTC2_PRI11 ((volatile UINT32 *)0xffe0002c) /* priority 11 setup */ +#define INTC2_PRI12 ((volatile UINT32 *)0xffe00030) /* priority 12 setup */ +#define INTC2_PRI13 ((volatile UINT32 *)0xfffe0034) /* priority 13 setup */ + +#define INTC2_A0 ((volatile UINT32 *)0xffe00038) /* int request */ +#define INTC2_A1 ((volatile UINT32 *)0xffe0003c) /* int request */ +#define INTC2_MSKRG ((volatile UINT32 *)0xffe00040) /* int mask */ +#define INTC2_MSKCR ((volatile UINT32 *)0xffe00044) /* int mask clear */ + +#define INTC2_B0 ((volatile UINT32 *)0xffe00048) /* int request modul */ +#define INTC2_B1 ((volatile UINT32 *)0xffe0004c) /* int request modul */ +#define INTC2_B2 ((volatile UINT32 *)0xffe00050) /* int request modul */ +#define INTC2_B3 ((volatile UINT32 *)0xffe00054) /* int request modul */ +#define INTC2_B4 ((volatile UINT32 *)0xffe00058) /* int request modul */ +#define INTC2_B5 ((volatile UINT32 *)0xffe0005c) /* int request modul */ +#define INTC2_B6 ((volatile UINT32 *)0xffe00060) /* int request modul */ +#define INTC2_B7 ((volatile UINT32 *)0xffe00064) /* int request modul */ +#define INTC2_B8 ((volatile UINT32 *)0xffe00068) /* int request modul */ +#define INTC2_B9 ((volatile UINT32 *)0xffe0006c) /* int request modul */ + +/* UBC (User Break Controller) register addresses */ + +#define UBC_CBR0 ((volatile UINT32 *)0xff200000) /* match cond. set 0 */ +#define UBC_CRR0 ((volatile UINT32 *)0xff200004) /* match oper. set 0 */ +#define UBC_CAR0 ((volatile UINT32 *)0xff200008) /* match addr. set 0 */ +#define UBC_CAMR0 ((volatile UINT32 *)0xff20000c) /* match addr. mask 0 */ +#define UBC_CBR1 ((volatile UINT32 *)0xff200020) /* match cond. set 1 */ +#define UBC_CRR1 ((volatile UINT32 *)0xff200024) /* match oper. set 1 */ +#define UBC_CAR1 ((volatile UINT32 *)0xff200028) /* match addr. set 1 */ +#define UBC_CAMR1 ((volatile UINT32 *)0xff20002c) /* match addr. mask 1 */ +#define UBC_CDR1 ((volatile UINT32 *)0xff200030) /* match data set 1 */ +#define UBC_CDMR1 ((volatile UINT32 *)0xff200034) /* match data mask 1 */ +#define UBC_CETR1 ((volatile UINT32 *)0xff200038) /* exe. cnt. enable 1 */ +#define UBC_CCMFR ((volatile UINT32 *)0xff200600) /* channel match flag */ +#define UBC_CBCR ((volatile UINT32 *)0xff200620) /* break control */ + +/* SCIF (Serial Communication Interface with FIFO) register addresses */ + +#define SCIF0_SMR ((volatile UINT16 *)0xff923000) /* serial mode */ +#define SCIF0_BRR ((volatile UINT8 *)0xff923004) /* bit rate */ +#define SCIF0_SCR ((volatile UINT16 *)0xff923008) /* serial control */ +#define SCIF0_FTDR ((volatile UINT8 *)0xff92300c) /* transmit FIFO data */ +#define SCIF0_FSR ((volatile UINT16 *)0xff923010) /* serial status */ +#define SCIF0_FRDR ((volatile UINT8 *)0xff923014) /* receive FIFO data */ +#define SCIF0_FCR ((volatile UINT16 *)0xff923018) /* FIFO control */ +#define SCIF0_RFDR ((volatile UINT16 *)0xff92301c) /* rec FIFO data count*/ +#define SCIF0_SPTR ((volatile UINT16 *)0xff923020) /* serial port reg */ +#define SCIF0_LSR ((volatile UINT16 *)0xff923024) /* line status */ + +#define SCIF1_SMR ((volatile UINT16 *)0xff924000) /* serial mode */ +#define SCIF1_BRR ((volatile UINT8 *)0xff924004) /* bit rate */ +#define SCIF1_SCR ((volatile UINT16 *)0xff924008) /* serial control */ +#define SCIF1_FTDR ((volatile UINT8 *)0xff92400c) /* transmit FIFO data */ +#define SCIF1_FSR ((volatile UINT16 *)0xff924010) /* serial status */ +#define SCIF1_FRDR ((volatile UINT8 *)0xff924014) /* receive FIFO data */ +#define SCIF1_FCR ((volatile UINT16 *)0xff924018) /* FIFO control */ +#define SCIF1_RFDR ((volatile UINT16 *)0xff92401c) /* rec FIFO data count*/ +#define SCIF1_SPTR ((volatile UINT16 *)0xff924020) /* serial port reg */ +#define SCIF1_LSR ((volatile UINT16 *)0xff924024) /* line status */ + +#define SCIF2_SMR ((volatile UINT16 *)0xff925000) /* serial mode */ +#define SCIF2_BRR ((volatile UINT8 *)0xff925004) /* bit rate */ +#define SCIF2_SCR ((volatile UINT16 *)0xff925008) /* serial control */ +#define SCIF2_FTDR ((volatile UINT8 *)0xff92500c) /* transmit FIFO data */ +#define SCIF2_FSR ((volatile UINT16 *)0xff925010) /* serial status */ +#define SCIF2_FRDR ((volatile UINT8 *)0xff925014) /* receive FIFO data */ +#define SCIF2_FCR ((volatile UINT16 *)0xff925018) /* FIFO control */ +#define SCIF2_RFDR ((volatile UINT16 *)0xff92501c) /* rec FIFO data count*/ +#define SCIF2_SPTR ((volatile UINT16 *)0xff925020) /* serial port reg */ +#define SCIF2_LSR ((volatile UINT16 *)0xff925024) /* line status */ + +/* RTC (Real Time Clock) register addresses */ + +#define RTC_CLKSEL ((volatile UINT16 *)0xffc80040) /* clock select reg */ + +/* GPIO (General Purpose IO) register base addresses */ + +#define GPIO0_IOINTSEL ((volatile UINT32 *)0xff93e000) /* IO interrupt select*/ +#define GPIO0_INOUTSEL ((volatile UINT32 *)0xff93e004) /* IO select reg */ +#define GPIO0_OUTDT ((volatile UINT32 *)0xff93e008) /* output data reg */ +#define GPIO0_INDT ((volatile UINT32 *)0xff93e00c) /* input data reg */ +#define GPIO0_INTDT ((volatile UINT32 *)0xff93e010) /* interrupt data reg */ +#define GPIO0_INTCLR ((volatile UINT32 *)0xff93e014) /* interrupt clear */ +#define GPIO0_INTMSK ((volatile UINT32 *)0xff93e018) /* interrupt mask */ +#define GPIO0_MSKCLR ((volatile UINT32 *)0xff93e01c) /* interr. mask clear */ +#define GPIO0_POSNEG ((volatile UINT32 *)0xff93e020) /* +/- logic set reg */ +#define GPIO0_EDGLEVEL ((volatile UINT32 *)0xff93e024) /* edge level set reg */ +#define GPIO0_FILONOFF ((volatile UINT32 *)0xff93e028) /* chattering on/off */ + +#define GPIO1_IOINTSEL ((volatile UINT32 *)0xff93f000) /* IO interrupt select*/ +#define GPIO1_INOUTSEL ((volatile UINT32 *)0xff93f004) /* IO select reg */ +#define GPIO1_OUTDT ((volatile UINT32 *)0xff93f008) /* output data reg */ +#define GPIO1_INDT ((volatile UINT32 *)0xff93f00c) /* input data reg */ +#define GPIO1_INTDT ((volatile UINT32 *)0xff93f010) /* interrupt data reg */ +#define GPIO1_INTCLR ((volatile UINT32 *)0xff93f014) /* interrupt clear */ +#define GPIO1_INTMSK ((volatile UINT32 *)0xff93f018) /* interrupt mask */ +#define GPIO1_MSKCLR ((volatile UINT32 *)0xff93f01c) /* interr. mask clear */ +#define GPIO1_POSNEG ((volatile UINT32 *)0xff93f020) /* +/- logic set reg */ +#define GPIO1_EDGLEVEL ((volatile UINT32 *)0xff93f024) /* edge level set reg */ +#define GPIO1_FILONOFF ((volatile UINT32 *)0xff93f028) /* chattering on/off */ + +#define GPIO2_IOINTSEL ((volatile UINT32 *)0xff940000) /* IO interrupt select*/ +#define GPIO2_INOUTSEL ((volatile UINT32 *)0xff940004) /* IO select reg */ +#define GPIO2_OUTDT ((volatile UINT32 *)0xff940008) /* output data reg */ +#define GPIO2_INDT ((volatile UINT32 *)0xff94000c) /* input data reg */ +#define GPIO2_INTDT ((volatile UINT32 *)0xff940010) /* interrupt data reg */ +#define GPIO2_INTCLR ((volatile UINT32 *)0xff940014) /* interrupt clear */ +#define GPIO2_INTMSK ((volatile UINT32 *)0xff940018) /* interrupt mask */ +#define GPIO2_MSKCLR ((volatile UINT32 *)0xff94001c) /* interr. mask clear */ +#define GPIO2_POSNEG ((volatile UINT32 *)0xff940020) /* +/- logic set reg */ +#define GPIO2_EDGLEVEL ((volatile UINT32 *)0xff940024) /* edge level set reg */ +#define GPIO2_FILONOFF ((volatile UINT32 *)0xff940028) /* chattering on/off */ + +#define GPIO3_IOINTSEL ((volatile UINT32 *)0xff941000) /* IO interrupt select*/ +#define GPIO3_INOUTSEL ((volatile UINT32 *)0xff941004) /* IO select reg */ +#define GPIO3_OUTDT ((volatile UINT32 *)0xff941008) /* output data reg */ +#define GPIO3_INDT ((volatile UINT32 *)0xff94100c) /* input data reg */ +#define GPIO3_INTDT ((volatile UINT32 *)0xff941010) /* interrupt data reg */ +#define GPIO3_INTCLR ((volatile UINT32 *)0xff941014) /* interrupt clear */ +#define GPIO3_INTMSK ((volatile UINT32 *)0xff941018) /* interrupt mask */ +#define GPIO3_MSKCLR ((volatile UINT32 *)0xff94101c) /* interr. mask clear */ +#define GPIO3_POSNEG ((volatile UINT32 *)0xff941020) /* +/- logic set reg */ +#define GPIO3_EDGLEVEL ((volatile UINT32 *)0xff941024) /* edge level set reg */ +#define GPIO3_FILONOFF ((volatile UINT32 *)0xff941028) /* chattering on/off */ + +/* interrupt vector numbers */ + +/*---------------------------------------------------------------------------*/ +/* exception/interrupt name (code >> 5) No. vector entry point */ +/*---------------------------------------------------------------------------*/ +#undef INUM_GPIO /* undefine INUM_GPIO defined in sh7750.h */ +#define INUM_GPIO (0x3e0 >> 5) /* 31 0x07c (vbr + 0x600) */ +#define INUM_TMU0_CH0_UNDERFLOW (0x400 >> 5) /* 32 0x080 (vbr + 0x600) */ +#define INUM_TMU0_CH1_UNDERFLOW (0x420 >> 5) /* 33 0x084 (vbr + 0x600) */ +#define INUM_TMU0_CH2_UNDERFLOW (0x440 >> 5) /* 34 0x088 (vbr + 0x600) */ +#define INUM_TMU0_CH2_INPUT_CAPTURE (0x460 >> 5) /* 35 0x08c (vbr + 0x600) */ +#define INUM_TMU1_CH0_UNDERFLOW (0x480 >> 5) /* 36 0x090 (vbr + 0x600) */ +#define INUM_TMU1_CH1_UNDERFLOW (0x4a0 >> 5) /* 37 0x094 (vbr + 0x600) */ +#define INUM_TMU1_CH2_UNDERFLOW (0x4c0 >> 5) /* 38 0x098 (vbr + 0x600) */ +#define INUM_TMU1_CH2_INPUT_CAPTURE (0x4e0 >> 5) /* 39 0x09c (vbr + 0x600) */ +#define INUM_TMU2_CH0_UNDERFLOW (0x500 >> 5) /* 40 0x0a0 (vbr + 0x600) */ +#define INUM_TMU2_CH1_UNDERFLOW (0x520 >> 5) /* 41 0x0a4 (vbr + 0x600) */ +#define INUM_TMU2_CH2_UNDERFLOW (0x540 >> 5) /* 42 0x0a8 (vbr + 0x600) */ +/* (0x560 >> 5) 43 0x0ac - reserved - */ +#define INUM_HAC (0x580 >> 5) /* 44 0x0b0 (vbr + 0x600) */ +/* (0x5a0 >> 5) 45 0x0b4 - reserved - */ +#define INUM_EXTERNAL (0x5c0 >> 5) /* 46 0x0b8 (vbr + 0x600) */ +#define INUM_SPDIF (0x5e0 >> 5) /* 47 0x0bc (vbr + 0x600) */ +/* INUM_JTAG (0x600 >> 5) /@ 48 0x0c0 */ +#define INUM_I2C (0x620 >> 5) /* 49 0x0c4 (vbr + 0x600) */ +/* INUM_DMAC_DMTE0 (0x640 >> 5) /@ 50 0x0c8 (vbr + 0x600) */ +/* INUM_DMAC_DMTE1 (0x660 >> 5) /@ 51 0x0cc (vbr + 0x600) */ +/* INUM_DMAC_DMTE2 (0x680 >> 5) /@ 52 0x0d0 (vbr + 0x600) */ +#define INUM_I2S0 (0x6a0 >> 5) /* 53 0x0d4 (vbr + 0x600) */ +#define INUM_I2S1 (0x6c0 >> 5) /* 54 0x0d8 (vbr + 0x600) */ +#define INUM_I2S2 (0x6e0 >> 5) /* 55 0x0dc (vbr + 0x600) */ +#define INUM_I2S3 (0x700 >> 5) /* 56 0x0c0 (vbr + 0x600) */ +#define INUM_SRC_RX_FULL (0x720 >> 5) /* 57 0x0e4 (vbr + 0x600) */ +#define INUM_SRC_TX_EMPTY (0x740 >> 5) /* 58 0x0e8 (vbr + 0x600) */ +#define INUM_SRC_SPDIF (0x760 >> 5) /* 59 0x0ec (vbr + 0x600) */ +#define INUM_DU (0x780 >> 5) /* 60 0x0f0 (vbr + 0x600) */ +#define INUM_VIDEO_IN (0x7a0 >> 5) /* 61 0x0f4 (vbr + 0x600) */ +#define INUM_REMOCON (0x7c0 >> 5) /* 62 0x0f8 (vbr + 0x600) */ +#define INUM_YUV (0x7e0 >> 5) /* 63 0x0fc (vbr + 0x600) */ +/* INUM_FPU_DISABLE (0x800 >> 5) /@ 64 0x100 (vbr + 0x600) */ +/* INUM_SLOT_FPU_DISABLE (0x820 >> 5) /@ 65 0x104 (vbr + 0x600) */ +#define INUM_USB_H (0x840 >> 5) /* 66 0x108 (vbr + 0x600) */ +#define INUM_ATAPI (0x860 >> 5) /* 67 0x10c (vbr + 0x600) */ +#define INUM_CAN (0x880 >> 5) /* 68 0x110 (vbr + 0x600) */ +#define INUM_GPS (0x8a0 >> 5) /* 69 0x114 (vbr + 0x600) */ +#define INUM_2D (0x8c0 >> 5) /* 70 0x118 (vbr + 0x600) */ +/* (0x8e0 >> 5) 71 0x11c - reserved - */ +#define INUM_3D_MBX (0x900 >> 5) /* 72 0x120 (vbr + 0x600) */ +#define INUM_3D_DMAC (0x920 >> 5) /* 73 0x124 (vbr + 0x600) */ +#define INUM_EX_BUS_ATA (0x940 >> 5) /* 74 0x128 (vbr + 0x600) */ +#define INUM_SPI0 (0x960 >> 5) /* 75 0x12c (vbr + 0x600) */ +#define INUM_SPI1 (0x980 >> 5) /* 76 0x130 (vbr + 0x600) */ +#define INUM_SCIF0 (0x9a0 >> 5) /* 77 0x134 (vbr + 0x600) */ +#define INUM_SCIF1 (0x9c0 >> 5) /* 78 0x138 (vbr + 0x600) */ +#define INUM_SCIF2 (0x9e0 >> 5) /* 79 0x13c (vbr + 0x600) */ +#define INUM_SCIF3 (0xa00 >> 5) /* 80 0x140 (vbr + 0x600) */ +#define INUM_SCIF4 (0xa20 >> 5) /* 81 0x144 (vbr + 0x600) */ +#define INUM_SCIF5 (0xa40 >> 5) /* 82 0x148 (vbr + 0x600) */ +#define INUM_SCIF6 (0xa60 >> 5) /* 83 0x14c (vbr + 0x600) */ +#define INUM_SCIF7 (0xa80 >> 5) /* 84 0x150 (vbr + 0x600) */ +#define INUM_SCIF8 (0xaa0 >> 5) /* 85 0x154 (vbr + 0x600) */ +#define INUM_SCIF9 (0xac0 >> 5) /* 86 0x158 (vbr + 0x600) */ +/* (0xae0 >> 5) 87 0x15c (vbr + 0x600) */ +/* (0xb00 >> 5) 88 0x160 (vbr + 0x600) */ +#define INUM_ADC (0xb20 >> 5) /* 89 0x164 (vbr + 0x600) */ +/* (0xb40 >> 5) 90 0x168 (vbr + 0x600) */ +/* (0xb60 >> 5) 91 0x16c (vbr + 0x600) */ +/* (0xb80 >> 5) 92 0x170 (vbr + 0x600) */ +#define INUM_BUSB_DMAC00 (0xba0 >> 5) /* 93 0x174 (vbr + 0x600) */ +#define INUM_BUSB_DMAC01 (0xbc0 >> 5) /* 94 0x178 (vbr + 0x600) */ +#define INUM_BUSB_DMAC02 (0xbe0 >> 5) /* 95 0x17c (vbr + 0x600) */ +#define INUM_BUSB_DMAC03 (0xc00 >> 5) /* 96 0x180 (vbr + 0x600) */ +#define INUM_BUSB_DMAC04 (0xc20 >> 5) /* 97 0x184 (vbr + 0x600) */ +#define INUM_BUSB_DMAC05 (0xc40 >> 5) /* 98 0x188 (vbr + 0x600) */ +#define INUM_BUSB_DMAC06 (0xc60 >> 5) /* 99 0x18c (vbr + 0x600) */ +#define INUM_BUSB_DMAC07 (0xc80 >> 5) /* 100 0x190 (vbr + 0x600) */ +#define INUM_BUSB_DMAC08 (0xca0 >> 5) /* 101 0x194 (vbr + 0x600) */ +#define INUM_BUSB_DMAC09 (0xcc0 >> 5) /* 102 0x198 (vbr + 0x600) */ +#define INUM_BUSB_DMAC10 (0xce0 >> 5) /* 103 0x19c (vbr + 0x600) */ +#define INUM_BUSB_DMAC11 (0xd00 >> 5) /* 104 0x1a0 (vbr + 0x600) */ +#define INUM_BUSB_DMAC12 (0xd20 >> 5) /* 105 0x1a4 (vbr + 0x600) */ +#define INUM_BUSB_DMAC13 (0xd40 >> 5) /* 106 0x1a8 (vbr + 0x600) */ +#define INUM_BUSB_DMAC14 (0xd60 >> 5) /* 107 0x1ac (vbr + 0x600) */ +#define INUM_BUSB_DMAC15 (0xd80 >> 5) /* 108 0x1b0 (vbr + 0x600) */ +#define INUM_BUSB_DMAC16 (0xda0 >> 5) /* 109 0x1b4 (vbr + 0x600) */ +#define INUM_BUSB_DMAC17 (0xdc0 >> 5) /* 110 0x1b8 (vbr + 0x600) */ +#define INUM_BUSB_DMAC18 (0xde0 >> 5) /* 111 0x1bc (vbr + 0x600) */ +#define INUM_BUSB_DMAC19 (0xe00 >> 5) /* 112 0x1c0 (vbr + 0x600) */ +#define INUM_BUSB_DMAC20 (0xe20 >> 5) /* 113 0x1c4 (vbr + 0x600) */ +#define INUM_BUSB_DMAC21 (0xe40 >> 5) /* 114 0x1c8 (vbr + 0x600) */ +#define INUM_BUSB_DMAC22 (0xe60 >> 5) /* 115 0x1cc (vbr + 0x600) */ +#define INUM_BUSB_DMAC23 (0xe80 >> 5) /* 116 0x1d0 (vbr + 0x600) */ +#define INUM_BUSB_DMAC24 (0xea0 >> 5) /* 117 0x1d4 (vbr + 0x600) */ +#define INUM_BUSB_DMAC25 (0xee0 >> 5) /* 118 0x1d8 (vbr + 0x600) */ +#define INUM_BUSB_DMAC26 (0xec0 >> 5) /* 119 0x1dc (vbr + 0x600) */ +#define INUM_BUSB_DMAC27 (0xf00 >> 5) /* 120 0x1e0 (vbr + 0x600) */ +#define INUM_BUSB_DMAC28 (0xf20 >> 5) /* 121 0x1e4 (vbr + 0x600) */ +#define INUM_BUSB_DMAC29 (0xf40 >> 5) /* 122 0x1e8 (vbr + 0x600) */ +#define INUM_BUSB_DMAC30 (0xf60 >> 5) /* 123 0x1ec (vbr + 0x600) */ +#define INUM_BUSB_DMAC31 (0xf80 >> 5) /* 124 0x1f0 (vbr + 0x600) */ + + +/* virtual interrupt vectors defined */ + +#define IV_IRQ0 INUM_TO_IVEC (INUM_IRL13) +#define IV_IRQ1 INUM_TO_IVEC (INUM_IRL11) +#define IV_IRQ2 INUM_TO_IVEC (INUM_IRL9) +#define IV_IRQ3 INUM_TO_IVEC (INUM_IRL7) +#define IV_IRQ4 INUM_TO_IVEC (INUM_IRL5) +#define IV_IRQ5 INUM_TO_IVEC (INUM_IRL3) + +#define IV_SCIF0 INUM_TO_IVEC (INUM_SCIF0) +#define IV_SCIF1 INUM_TO_IVEC (INUM_SCIF1) +#define IV_SCIF2 INUM_TO_IVEC (INUM_SCIF2) + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsh7770h */ diff --git a/h/arch/sh/sigShCodes.h b/h/arch/sh/sigShCodes.h new file mode 100644 index 0000000..e8bf6b3 --- /dev/null +++ b/h/arch/sh/sigShCodes.h @@ -0,0 +1,57 @@ +/* sigShCodes.h - SH codes sent to signal handlers */ + +/* Copyright 1995-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01l,21aug00,hk merge SH7729 to SH7700. merge SH7410 and SH7040 to SH7600. +01k,10feb99,hk clean-up SH7750 support. +01j,16jul98,st added SH7750 support. +01j,06may98,jmc added support for SH-DSP and SH3-DSP CPU types. +01j,26nov97,hms added fpp support definition. +01i,22apr97,hk changed 704X to 7040. +01h,09feb97,hk changed FPE_INTDIV_TRAP for SH7700 to INUM_TRAP_1. +01g,19aug96,hk changed FPE_INTDIV_TRAP for SH7700. +01f,09aug96,hk added FPE_INTDIV_TRAP for SH7700. +01e,05aug96,hk added TLB_xxx, BUS_xxx for SH7700, changed ILL_xxx names. +01d,04aug96,hk enabled ILL_xxx for SH7700. +01c,15nov95,hk reincarnated with five signal codes. +01b,01apr95,hk disabled this file. +01a,31mar95,hk written based on Mc68k-01b +*/ + +#ifndef __INCsigShCodesh +#define __INCsigShCodesh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "iv.h" + +#if (CPU==SH7750 || CPU==SH7700) +#define TLB_LOAD_MISS INUM_TLB_READ_MISS +#define TLB_STORE_MISS INUM_TLB_WRITE_MISS +#define TLB_INITITIAL_PAGE_WRITE INUM_TLB_WRITE_INITIAL_PAGE +#define TLB_LOAD_PROTEC_VIOLATION INUM_TLB_READ_PROTECTED +#define TLB_STORE_PROTEC_VIOLATION INUM_TLB_WRITE_PROTECTED +#define BUS_LOAD_ADDRESS_ERROR INUM_READ_ADDRESS_ERROR +#define BUS_STORE_ADDRESS_ERROR INUM_WRITE_ADDRESS_ERROR +#define FPU_EXCEPTION INUM_FPU_EXCEPTION +#define ILLEGAL_INSTR_GENERAL INUM_ILLEGAL_INST_GENERAL +#define ILLEGAL_SLOT_INSTR INUM_ILLEGAL_INST_SLOT +#define FPE_INTDIV_TRAP INUM_TRAP_1 +#elif (CPU==SH7600 || CPU==SH7000) +#define ILL_ILLINSTR_GENERAL INUM_ILLEGAL_INST_GENERAL +#define ILL_ILLINSTR_SLOT INUM_ILLEGAL_INST_SLOT +#define BUS_ADDERR_CPU INUM_BUS_ERROR_CPU +#define BUS_ADDERR_DMA INUM_BUS_ERROR_DMA +#define FPE_INTDIV_TRAP INUM_TRAP_62 +#endif /* CPU==SH7600 || CPU==SH7000 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsigShCodesh */ diff --git a/h/arch/sh/syscallArgssh4.h b/h/arch/sh/syscallArgssh4.h new file mode 100644 index 0000000..38e8035 --- /dev/null +++ b/h/arch/sh/syscallArgssh4.h @@ -0,0 +1,755 @@ +/* Aligned for sh4 - align to SH4 conventions */ + + +/* THIS FILE IS AUTO_GENERATED. PLEASE DO NOT EDIT. */ + +#ifndef _ASMLANGUAGE + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct _exitScArgs + { + int status; + }; + +struct creatScArgs + { + const char * name; + mode_t flag; + }; + +struct _openScArgs + { + const char * name; + int flags; + int mode; + }; + +struct closeScArgs + { + int fd; + }; + +struct readScArgs + { + int fd; + void * buffer; + size_t maxbytes; + }; + +struct writeScArgs + { + int fd; + const void * buffer; + size_t nbytes; + }; + +struct _ioctlScArgs + { + int fd; + int function; + int arg; + }; + +struct dupScArgs + { + int fd; + }; + +struct dup2ScArgs + { + int fd; + int fd2; + }; + +struct pipeScArgs + { + int filedes[2]; + }; + +struct removeScArgs + { + const char * name; + }; + +struct selectScArgs + { + int width; + fd_set * readFds; + fd_set * writeFds; + fd_set * excFds; + struct timeval * timeout; + }; + +struct socketScArgs + { + int domain; + int type; + int protocol; + }; + +struct bindScArgs + { + int s; + struct sockaddr * name; + int namelen; + }; + +struct listenScArgs + { + int s; + int backlog; + }; + +struct acceptScArgs + { + int s; + struct sockaddr * addr; + int *addrlen; + }; + +struct connectScArgs + { + int s; + struct sockaddr * name; + int namelen; + }; + +struct sendtoScArgs + { + int s; + caddr_t buf; + int bufLen; + int flags; + struct sockaddr * to; + int tolen; + }; + +struct sendScArgs + { + int s; + const char * buf; + int bufLen; + int flags; + }; + +struct sendmsgScArgs + { + int s; + struct msghdr * mp; + int flags; + }; + +struct recvfromScArgs + { + int s; + char * buf; + int bufLen; + int flags; + struct sockaddr *from; + int * pFromLen; + }; + +struct recvScArgs + { + int s; + char * buf; + int bufLen; + int flags; + }; + +struct recvmsgScArgs + { + int s; + struct msghdr * mp; + int flags; + }; + +struct setsockoptScArgs + { + int s; + int level; + int optname; + char * optval; + int optlen; + }; + +struct getsockoptScArgs + { + int s; + int level; + int optname; + char * optval; + int * optlen; + }; + +struct getsocknameScArgs + { + int s; + struct sockaddr *name; + int * namelen; + }; + +struct getpeernameScArgs + { + int s; + struct sockaddr *name; + int *namelen; + }; + +struct shutdownScArgs + { + int s; + int how; + }; + +struct mmapScArgs + { + void * addr; + size_t len; + int prot; + int flags; + int fildes; + off_t64 off; + }; + +struct munmapScArgs + { + void * addr; + size_t len; + }; + +struct mprotectScArgs + { + void * addr; + size_t len; + int prot; + }; + +struct killScArgs + { + OBJ_HANDLE rtpId; + int signo; + }; + +struct sigpendingScArgs + { + sigset_t * pSet; + }; + +struct sigprocmaskScArgs + { + int how; + const sigset_t * pSet; + sigset_t * pOset; + }; + +struct _sigqueueScArgs + { + OBJ_HANDLE rtpId; + int signo; + const union sigval * pValue; + int sigCode; + }; + +struct sigsuspendScArgs + { + const sigset_t * pSet; + }; + +struct sigtimedwaitScArgs + { + const sigset_t * pSet; + struct siginfo * pInfo; + const struct timespec * pTime; + }; + +struct _sigactionScArgs + { + int signo; + const struct sigaction * pAct; + struct sigaction * pOact; + void * retAddr; + }; + +struct chdirScArgs + { + const char * name; + }; + +struct _getcwdScArgs + { + char * buffer; + int length; + }; + +struct waitpidScArgs + { + OBJ_HANDLE childRtpId; + int * pStatus; + int options; + }; + +struct sysctlScArgs + { + int *pName; + u_int nameLen; + void * pOld; + size_t * pOldLen; + void * pNew; + size_t newLen; + }; + +struct _schedPxInfoGetScArgs + { + BOOL * pTimeSlicingOn; + ULONG * pTimeSlicePeriod; + }; + +struct sigaltstackScArgs + { + stack_t * ss; + stack_t * oss; + }; + +struct unlinkScArgs + { + const char * name; + }; + +struct linkScArgs + { + const char * name; + const char * newname; + }; + +struct fsyncScArgs + { + int fd; + }; + +struct fdatasyncScArgs + { + int fd; + }; + +struct renameScArgs + { + const char * oldname; + const char * newname; + }; + +struct fpathconfScArgs + { + int fd; + int name; + }; + +struct pathconfScArgs + { + const char * path; + int name; + }; + +struct accessScArgs + { + const char * path; + int amode; + }; + +struct chmodScArgs + { + const char * path; + mode_t mode; + }; + +struct eventReceiveScArgs + { + UINT32 events; + UINT32 options; + int timeout; + UINT32 * pEvtsReceived; + }; + +struct eventSendScArgs + { + int taskId; + UINT32 events; + }; + +struct eventCtlScArgs + { + OBJ_HANDLE handle; + VX_EVT_CTL_CMD command; + void * pArg; + UINT * pArgSize; + }; + +struct msgQSendScArgs + { + OBJ_HANDLE handle; + char * buffer; + UINT nBytes; + int timeout; + int priority; + }; + +struct msgQReceiveScArgs + { + OBJ_HANDLE handle; + char * buffer; + UINT maxNBytes; + int timeout; + }; + +struct _msgQOpenScArgs + { + const char * name; + UINT maxMsgs; + UINT maxMsgLength; + int options; + int mode; + void * context; + }; + +struct objDeleteScArgs + { + OBJ_HANDLE handle; + int options; + }; + +struct objInfoGetScArgs + { + OBJ_HANDLE handle; + void * pInfo; + UINT * pInfoSize; + int level; + }; + +struct _semTakeScArgs + { + OBJ_HANDLE handle; + int timeout; + }; + +struct _semGiveScArgs + { + OBJ_HANDLE handle; + }; + +struct _semOpenScArgs + { + const char * name; + SEM_TYPE type; + int initState; + int options; + int mode; + void * context; + }; + +struct semCtlScArgs + { + OBJ_HANDLE handle; + VX_SEM_CTL_CMD command; + void * pArg; + UINT * pArgSize; + }; + +struct _taskOpenScArgs + { + struct vx_task_open_sc_args * pArgs; + }; + +struct taskCtlScArgs + { + int tid; + VX_TASK_CTL_CMD command; + void * pArg; + UINT * pArgSize; + }; + +struct taskDelayScArgs + { + int ticks; + }; + +struct rtpSpawnScArgs + { + const char * rtpFileName; + const char ** argv; + const char ** envp; + int priority; + int uStackSize; + int options; + int taskOptions; + }; + +struct rtpInfoGetScArgs + { + OBJ_HANDLE rtpId; + RTP_DESC * rtpStruct; + }; + +struct taskKillScArgs + { + OBJ_HANDLE taskHandle; + int signo; + }; + +struct _taskSigqueueScArgs + { + OBJ_HANDLE taskHandle; + int signo; + const union sigval * pValue; + int sigCode; + }; + +struct _timer_openScArgs + { + const char * name; + int mode; + clockid_t clockId; + struct sigevent * evp; + void * context; + }; + +struct timerCtlScArgs + { + TIMER_CTL_CMD cmdCode; + int handle; + void * pArgs; + UINT * pArgSize; + }; + +struct pxOpenScArgs + { + PX_OBJ_TYPE type; + const char * name; + int objOpenMode; + void * attr; + }; + +struct pxCloseScArgs + { + OBJ_HANDLE handle; + }; + +struct pxUnlinkScArgs + { + PX_OBJ_TYPE type; + const char * name; + }; + +struct pxCtlScArgs + { + OBJ_HANDLE handle; + PX_CTL_CMD_CODE cmdCode; + void * pArgs; + UINT * pArgSize; + }; + +struct pxMqReceiveScArgs + { + OBJ_HANDLE handle; + char * pMsg; + size_t msgLen; + unsigned int * pMsgPrio; + PX_WAIT_OPTION waitOption; + struct timespec * time_out; + }; + +struct pxMqSendScArgs + { + OBJ_HANDLE handle; + const char * pMsg; + size_t msgLen; + unsigned int msgPrio; + PX_WAIT_OPTION waitOption; + struct timespec * time_out; + }; + +struct pxSemWaitScArgs + { + OBJ_HANDLE handle; + PX_WAIT_OPTION waitOption; + struct timespec * time_out; + }; + +struct pxSemPostScArgs + { + OBJ_HANDLE handle; + }; + +struct pipeDevCreateScArgs + { + const char * name; + int nMessages; + int nBytes; + }; + +struct pipeDevDeleteScArgs + { + const char * name; + BOOL force; + }; + +struct _sdCreateScArgs + { + char * name; + int options; + UINT32 size; + MMU_ATTR attr; + off_t64 physAddress; + void ** pVirtAddress; + }; + +struct _sdOpenScArgs + { + char * name; + int options; + int mode; + UINT32 size; + off_t64 physAddress; + MMU_ATTR attr; + void ** pVirtAddress; + }; + +struct sdDeleteScArgs + { + OBJ_HANDLE handle; + int options; + }; + +struct sdMapScArgs + { + OBJ_HANDLE handle; + MMU_ATTR attr; + int options; + }; + +struct sdUnmapScArgs + { + OBJ_HANDLE handle; + int options; + }; + +struct sdProtectScArgs + { + OBJ_HANDLE handle; + MMU_ATTR attr; + }; + +struct _edrErrorInjectScArgs + { + int kind; + const char *fileName; + int lineNumber; + REG_SET *regset; + void *addr; + const char *msg; + }; + +struct resSearchNScArgs + { + const char * name; + struct res_target * target; + }; + +struct wvEventScArgs + { + int eventId; + const char * pData; + unsigned int dataSize; + }; + +struct rtpVarAddScArgs + { + void ** pVar; + void * value; + }; + +struct sdInfoGetScArgs + { + OBJ_HANDLE handle; + SD_DESC * pSdStruct; + }; + +struct _shlOpenScArgs + { + const char * name; + int options; + }; + +struct _shlUnlockScArgs + { + SHL_ID shlId; + }; + +struct _shlCloseScArgs + { + SHL_ID shlId; + }; + +struct _shlGetScArgs + { + SHL_ID shlId; + SHLINFO *pInfo; + }; + +struct _shlPutScArgs + { + SHL_ID shlId; + const SHLINFO *pInfo; + }; + +struct objUnlinkScArgs + { + const char * name; + enum windObjClassType classType; + }; + +struct getprlimitScArgs + { + int idtype; + OBJ_HANDLE handle; + int resource; + struct rlimit *rlp; + }; + +struct setprlimitScArgs + { + int idtype; + OBJ_HANDLE handle; + int resource; + struct rlimit *rlp; + }; + +struct _mctlScArgs + { + void * addr; + size_t len; + int function; + int arg; + }; + +#endif /* _ASMLANGUAGE */ diff --git a/h/arch/sh/syscallSh.h b/h/arch/sh/syscallSh.h new file mode 100644 index 0000000..f01921a --- /dev/null +++ b/h/arch/sh/syscallSh.h @@ -0,0 +1,73 @@ +/* syscallSh.h - SH specific System Call Infrastructure header */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,30aug04,h_k added user stack align validation. +01a,18sep03,h_k written. +*/ + +/* +DESCRIPTION +This header contains SH-specific definitions and constants used by +the System Call Infrastructure library. + +*/ + +#ifndef __INCsyscallShh +#define __INCsyscallShh + +#ifdef __cplusplus +extern "C" { +#endif + +#define syscallDispatch_PORTABLE /* Use the portable dispatcher */ + + /* defines */ + +#define SYSCALL_ENTRY_FRAME_SIZE 56 + +#define _SYSCALL_USER_SP_CHECK(sp) \ + { \ + if ((UINT32)(sp) & (_STACK_ALIGN_SIZE - 1)) \ + { \ + errnoSet (S_syscallLib_INVALID_USER_SP); \ + return (ERROR); \ + } \ + } + + /* typedefs */ + +#ifndef _ASMLANGUAGE + /* + * The SYSCALL_ENTRY_STATE structure defines the saved machine state + * when the system call trap is taken. This information is architecture + * specific, and is used by the system call dispatcher to restart system + * calls that have been interrupted by the occurance of signals. + * System call restart is achieved by restoring the saved state at the + * time of the system call trap, and re-issuing the system call. + * Arguments to the system call are saved on the kernel stack, and + * the address of that array is passed as an argument to the dispatcher. + * The layout of this structure must exactly match the ordering of members + * of the system call entry frame in src/arch/sh/syscallALib.s. + */ + +typedef struct syscall_entry_state + { + int args[8]; /* argument list (r4-r7 and sp[0]-sp[3]) */ + int scn; /* System Call Number (SCN) in r3 */ + int statusReg; /* saved Status Register (ssr) */ + void * pc; /* Trap return address (ssp) */ + void * pPR; /* saved return register value */ + int * pUStack; /* user-mode stack pointer */ + int spare1; /* reserved */ + } SYSCALL_ENTRY_STATE; +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsyscallShh */ diff --git a/h/arch/sh/toolSh.h b/h/arch/sh/toolSh.h new file mode 100644 index 0000000..ee5a6b4 --- /dev/null +++ b/h/arch/sh/toolSh.h @@ -0,0 +1,71 @@ +/* toolSh.h - tool dependent header */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01j,08sep04,h_k swapped _FUNCTION and FUNCTION. +01i,02sep04,h_k added LEADING_UNDERSCORE macro and set TRUE. +01h,30nov01,zl removed unnecessary and non-working TOOL_FAMILY conditional. +01g,31oct01,zl added Diab support, removed NULL redefinition. +01f,23may00,zl force definition of _GNU_TOOL. +01e,29apr00,zl added NULL definition. +01d,29apr00,zl added _BYTE_ORDER definition back. +01c,21apr00,max removed vararg, using toolchain includes. +01b,20sep99,zl define _BYTE_ORDER for little endian. +01a,04jun99,zl written based on va-sh.h from the GNU distribution +*/ + +#ifndef __INCtoolShh +#define __INCtoolShh + +/* Both GNU and Diab preprocessor define __LITTLE_ENDIAN__ */ + +#undef _BYTE_ORDER +#ifdef __LITTLE_ENDIAN__ +#define _BYTE_ORDER _LITTLE_ENDIAN +#else +#define _BYTE_ORDER _BIG_ENDIAN +#endif + +/* + * The LEADING_UNDERSCORE macro should be defined to TRUE for toolchains + * that prefix a leading underscore character, i.e. "_", to symbols in B6 + * for backword compatible with T2. + */ + +#define LEADING_UNDERSCORE TRUE + +#if (LEADING_UNDERSCORE == TRUE) +#define _FUNCTION(func) _##func +#define _FUNC_LABEL(func) _##func##: +#define _VAR(var) _##var +#define _VAR_LABEL(var) _##var##: +#else /* LEADING_UNDERSCORE == FALSE */ +#define _FUNCTION(func) func +#define _FUNC_LABEL(func) func##: +#define _VAR(var) var +#define _VAR_LABEL(var) var##: +#endif /* LEADING_UNDERSCORE == TRUE */ + +/* + * This extra macro forces an extra level of indirection without which + * the preprocessor does not fully expand _FUNCTION. + */ + +#define FUNCTION(func) _FUNCTION(func) +#define FUNC_LABEL(func) _FUNCTION(func): +#define VAR(var) _VAR(var) +#define VAR_LABEL(var) _VAR(var): + +/* + * These macros are used to declare assembly language symbols that need + * to be typed properly(func or data) to be visible to the OMF tool. + * So that the build tool could mark them as an entry point to be linked + * by another PD. + */ + +#define GTEXT(sym) FUNCTION(sym) ; .type FUNCTION(sym),@function +#define GDATA(sym) VAR(sym) ; .type VAR(sym),@object + +#endif /* __INCtoolShh */ diff --git a/h/arch/sh/vxShLib.h b/h/arch/sh/vxShLib.h new file mode 100644 index 0000000..04fabf3 --- /dev/null +++ b/h/arch/sh/vxShLib.h @@ -0,0 +1,72 @@ +/* vxShLib.h - header for miscellaneous Hitachi-SH support routines */ + +/* Copyright 2000-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,02nov01,zl changed VXPOWERMODEREGS to use pointers. +01b,07sep01,h_k added power control support (SPR #69838). +01a,20apr00,hk created to export vxMemProbeSup() and vxMemProbeTrap() to BSP. +*/ + +#ifndef __INCvxShLibh +#define __INCvxShLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* power management mode definitions - used by vxPowerModeSet/Get */ + +#define VX_POWER_MODE_DISABLE 0x0 /* power mgt disable */ +#define VX_POWER_MODE_SLEEP 0x1 /* sleep power management mode */ +#define VX_POWER_MODE_DEEP_SLEEP 0x2 /* deep sleep power mgt mode */ +#define VX_POWER_MODE_USER 0xff /* user specific mode */ +#define VX_POWER_MODE_MASK 0xff /* mask for the mode */ + +/* power management registers definitions */ + +#define STBCR2_DSLP 0x80 /* deep sleep for SH7750 only */ + +#ifndef _ASMLANGUAGE + +/* structure to manage power mode registers */ + +typedef struct + { + volatile UINT8 * pSTBCR1; + volatile UINT8 * pSTBCR2; + volatile UINT8 * pSTBCR3; + } VXPOWERMODEREGS; + +extern VXPOWERMODEREGS vxPowerModeRegs; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT STATUS vxMemProbeSup (int length, char * src, char * dest); +IMPORT void vxMemProbeTrap (void); +IMPORT STATUS vxPowerDown (void); +IMPORT STATUS vxPowerModeSet (UINT32); +IMPORT UINT32 vxPowerModeGet (void); +IMPORT STATUS (* _func_vxIdleLoopHook) (void); + +#else /* __STDC__ */ + +IMPORT STATUS vxMemProbeSup (); +IMPORT void vxMemProbeTrap (); +IMPORT STATUS vxPowerDown (); +IMPORT STATUS vxPowerModeSet (); +IMPORT UINT32 vxPowerModeGet (); +IMPORT FUNCPTR _func_vxIdleLoopHook; + +#endif /* __STDC__ */ +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvxShLibh */ diff --git a/h/arch/simhppa/archSimhppa.h b/h/arch/simhppa/archSimhppa.h new file mode 100644 index 0000000..98f834a --- /dev/null +++ b/h/arch/simhppa/archSimhppa.h @@ -0,0 +1,93 @@ +/* archSimhppa.h - simhppa specific header */ + +/* Copyright 1993 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01d,29jul98,ms added WV_INSTRUMENTATION +01c,20nov95,mem added decl of _ARCH_va_list for c++, fixes for gcc. +01b,20jul94,ms added _ARCH_INT_MIN, changed _ARCH_MULTIPLE_CACHELIB. +01a,11aug93,gae from rrr. +*/ + +#ifndef __INCarchSimhppah +#define __INCarchSimhppah + +#ifdef __cplusplus +extern "C" { +#endif + +#define WV_INSTRUMENTATION +#define _STACK_DIR _STACK_GROWS_UP + + +#define _ALLOC_ALIGN_SIZE 8 /* 8-byte alignment */ +#define _STACK_ALIGN_SIZE 8 /* 8-byte alignment */ + +#define _ARCH_MULTIPLE_CACHELIB FALSE /* multiple cache libraries */ + +#define _DYNAMIC_BUS_SIZING FALSE /* no dynamic bus sizing */ + +#define _ARCH_INT_MIN (-2147483647 - 1) + +/* defines for stdarg.h */ +/* Amount of space required in an argument list for an arg of type TYPE. + TYPE may alternatively be an expression whose type is used. */ + +#ifndef _ARCH_va_list +#define _ARCH_va_list typedef double *va_list +#endif /* _ARCH_va_list */ + +#define __WORD_MASK 0xFFFFFFFC +#define __DW_MASK 0xFFFFFFF8 + +/* Args > 8 bytes are passed by reference. Args > 4 and <= 8 are + * right-justified in 8 bytes. Args <= 4 are right-justified in + * 4 bytes. + */ +/* + * __list is the word-aligned address of the previous argument. + */ +/* If sizeof __mode > 8, address of arg is at __list - 4. We need to do + * two indirections: 1 to fetch the address, and 1 to fetch the value. + * If sizeof __mode <= 8, the word-aligned address of arg is + * __list - sizeof __mode, masked to requred alignment (4 or 8 byte). + * The real address is the word-aligned address + extra byte offset. + */ + +#ifdef __GNUC__ +#define __gnuc_va_start(AP) \ + ((AP) = (va_list)__builtin_saveregs()) +#define _ARCH_va_start(__list,__parmN) \ + (__builtin_next_arg (__parmN), __gnuc_va_start (__list)) +#else /* not __GNUC__ */ +#ifdef __cplusplus +_ARCH_va_list; +extern "C" { + void __builtin_va_start(va_list, ...); +} +#define _ARCH_va_start(__list,__parmN) \ + (__list=0,__builtin_va_start(__list,&__parmN)) +#else /* not __cplusplus */ +#define _ARCH_va_start(__list,__parmN) \ + __builtin_va_start (__list, &__parmN) +#endif /* __cplusplus */ +#endif /* __GNUC__ */ + +#define _ARCH_va_arg(__list,__mode) \ + (sizeof(__mode) > 8 ? \ + ((__list = (va_list) ((char *)__list - sizeof (int))), \ + (*((__mode *) (*((int *) (__list)))))) : \ + ((__list = \ + (va_list) ((long)((char *)__list - sizeof (__mode)) \ + & (sizeof(__mode) > 4 ? __DW_MASK : __WORD_MASK))), \ + (*((__mode *) ((char *)__list + \ + ((8 - sizeof(__mode)) % 4)))))) + +#define _ARCH_va_end(__list) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCarchSimhppah */ diff --git a/h/arch/simhppa/asmSimhppa.h b/h/arch/simhppa/asmSimhppa.h new file mode 100644 index 0000000..1f7c2d4 --- /dev/null +++ b/h/arch/simhppa/asmSimhppa.h @@ -0,0 +1,35 @@ +/* asmSimhppa.h - simhppa assembler definitions header */ + +/* Copyright 1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,01jan96,kab added _ASMLANGUAGE check +01a,11jul93,gae written. +*/ + +#ifndef __INCasmSimhppah +#define __INCasmSimhppah + +#ifndef _ASMLANGUAGE + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _ASMLANGUAGE */ + +#endif /* __INCasmSimhppah */ + + + + + + + + diff --git a/h/arch/simhppa/dbgSimhppaLib.h b/h/arch/simhppa/dbgSimhppaLib.h new file mode 100644 index 0000000..b7be4db --- /dev/null +++ b/h/arch/simhppa/dbgSimhppaLib.h @@ -0,0 +1,35 @@ +/* dbgSimhppaLib.h - simhppa debugger header */ + +/* Copyright 1993-1994 Wind River Systems, Inc. */ + +/* +modification history +------------------- +01d,16mar98,dbt modified for new breakpoint scheme. +01c,20jul94,ms allowed stack trace and cret. +01b,25jan94,gae made BREAK_ESF same as EXC_INFO. +01a,11aug93,gae from rrr. +*/ + +#ifndef __INCdbgSimhppaLibh +#define __INCdbgSimhppaLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "excLib.h" + +#define BREAK_ESF EXC_INFO +#define TRACE_ESF BREAK_ESF /* in case needed */ + +/*#define DBG_TRAP_NUM 5 */ + +#define DBG_BREAK_INST 0x0 +#define DBG_NO_SINGLE_STEP 1 /* no trace support */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdbgSimhppaLibh */ diff --git a/h/arch/simhppa/dsmSimhppaLib.h b/h/arch/simhppa/dsmSimhppaLib.h new file mode 100644 index 0000000..e4fffb3 --- /dev/null +++ b/h/arch/simhppa/dsmSimhppaLib.h @@ -0,0 +1,192 @@ +/* dshppa.h - simhppa disassembler library header */ + +/* Copyright 1984-1993 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01a,05jan96,kab changed INSN_TAB and deleted DSM_TAB +*/ + +#ifndef __dsmhppah +#define __dsmhppah + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef PARISC_HPUX9 +#include "wtxtclp.h" +#else +#include "vwModNum.h" + +/* XXX p_m should find a better error code here */ + +#define S_dsmLib_UNKNOWN_INSTRUCTION (0x20000 | 1) + +#endif /*PARISC_HPUX9*/ + +/* macros for bit mask and shift for operation field */ + +/* ?!?BUG -- len is never used, presumably it's a width?!? */ +#define BIT_MASK(p,len) ((1<<(32-(p)))-1) +#define BIT_SHIFT(p,len) (32 -(p) - (len)) + +#define IMM5_MASK 0x0000001f +#define IMM5_13_MASK BIT_MASK(5, 13) +#define BIT27_5_MASK BIT_MASK(27, 5) +#define BIT19_8_MASK BIT_MASK(19, 8) +#define BIT_M_N_MASK 0x00000020 +#define BIT6_5_MASK BIT_MASK(6, 5) +#define BIT11_5_MASK BIT_MASK(11, 5) +#define BIT12_1_MASK BIT_MASK(12, 1) +#define BIT13_3_MASK BIT_MASK(13, 3) +#define BIT16_2_MASK BIT_MASK(16, 2) +#define BIT16_3_MASK BIT_MASK(16, 3) +#define BIT16_5_MASK BIT_MASK(16, 5) +#define BIT21_2_MASK BIT_MASK(21, 2) +#define BIT23_3_MASK BIT_MASK(23, 3) + +/* operation code extention definitions */ + +/* load indexed instructions */ + +#define EXT_LDWX_CODE 0x02 +#define EXT_LDHX_CODE 0x01 +#define EXT_LDBX_CODE 0x00 +#define EXT_LDWAX_CODE 0x06 +#define EXT_LDWAS_CODE 0x06 +#define EXT_LDCWX_CODE 0x07 +#define EXT_STWS_CODE 0x0a +#define EXT_STHS_CODE 0x09 +#define EXT_STBS_CODE 0x08 +#define EXT_STWAS_CODE 0x0e +#define EXT_STBYS_CODE 0x0c + +/* system control instructions */ + +#define EXT_SYSCTL_MASK 0x00001fe0 +#define EXT_BREAK_CODE 0 +#define EXT_RFI_CODE 0x60 +#define EXT_RFIR_CODE 0x65 +#define EXT_SSM_CODE 0x6b +#define EXT_RSM_CODE 0x73 +#define EXT_MTSM_CODE 0xc3 +#define EXT_LDSID_CODE 0x85 +#define EXT_MTSP_CODE 0xc1 +#define EXT_MTCTL_CODE 0xc2 +#define EXT_MFSP_CODE 0x25 +#define EXT_MFCTL_CODE 0x45 +#define EXT_SYNC_CODE 0x20 +#define EXT_PROBER_CODE 0x46 +#define EXT_PROBERI_CODE 0xc6 +#define EXT_PROBEW_CODE 0x47 +#define EXT_PROBEWI_CODE 0xc7 +#define EXT_LPA_CODE 0x4d + +/* memory managemnet instructions */ + +#define EXT_PDTLB_CODE 0x48 +#define EXT_PDTLBE_CODE 0x49 +#define EXT_PDC_CODE 0x4e +#define EXT_FDC_CODE 0x4a +#define EXT_FDCE_CODE 0x4b +#define EXT_PITLB_CODE 0x08 +#define EXT_PITLBE_CODE 0x09 +#define EXT_FIC_CODE 0x0a +#define EXT_FICE_CODE 0x0b +#define EXT_IDTLBA_CODE 0x41 +#define EXT_IDTLBP_CODE 0x40 +#define EXT_IITLBA_CODE 0x01 +#define EXT_IITLBP_CODE 0x00 + +/* memory managemnet instructions */ + +#define EXT_PDTLB_CODE 0x48 +#define EXT_PDTLBE_CODE 0x49 +#define EXT_PDC_CODE 0x4e +#define EXT_FDC_CODE 0x4a +#define EXT_FDCE_CODE 0x4b +#define EXT_PITLB_CODE 0x08 +#define EXT_PITLBE_CODE 0x09 +#define EXT_FIC_CODE 0x0a +#define EXT_FICE_CODE 0x0b +#define EXT_IDTLBA_CODE 0x41 +#define EXT_IDTLBP_CODE 0x40 +#define EXT_IITLBA_CODE 0x01 +#define EXT_IITLBP_CODE 0x00 + +/* deposit instructions */ + +#define EXT_VDEP_CODE 1 +#define EXT_ZVDEP_CODE 0 +#define EXT_DEP_CODE 3 +#define EXT_ZDEP_CODE 2 +#define EXT_VDEPI_CODE 5 +#define EXT_ZVDEPI_CODE 4 +#define EXT_DEPI_CODE 7 +#define EXT_ZDEPI_CODE 6 + +/* floating point load/store indexed instructions */ + +#define EXT_FLDWX_CODE 0x00 +#define EXT_FLDDX_CODE 0x00 +#define EXT_FLDWS_CODE 0x08 +#define EXT_FLDDS_CODE 0x08 +#define EXT_FSTWX_CODE 0x01 +#define EXT_FSTDX_CODE 0x01 +#define EXT_FSTWS_CODE 0x09 +#define EXT_FSTDS_CODE 0x09 + +/* load and store coprocessor instructions */ + +#define EXT_CLDX_CODE 0 +#define EXT_CSTX_CODE 1 +#define EXT_CLDS_CODE 8 +#define EXT_CSTS_CODE 9 + +/* extract and deposit instructions */ + +#define EXT_VSHD_CODE 0 +#define EXT_SHD_CODE 2 +#define EXT_VEXTRU_CODE 4 +#define EXT_VEXTRS_CODE 5 +#define EXT_EXTRU_CODE 6 +#define EXT_EXTRS_CODE 7 + +typedef struct + { + UINT32 mask; /* bit mask for operation code */ + UINT32 opCode; /* operation code */ + char *name; /* instruction name */ + int flags; /* nullification? check cond flag? */ + VOIDFUNCPTR pFunc; /* disassembler function */ + } INST_TAB; + +#if defined(__STDC__) || defined(__cplusplus) + +#ifdef PARISC_HPUX9 +IMPORT int dsmHppaInst (UINT32 *binInst, int address, + void (*prtAddress)(), Tcl_DString *pDString); +IMPORT int dsmHppaNbytes (UINT32 *binInst); +#else +IMPORT int dsmInst (UINT32 *binInst, int address, + void (*prtAddress)()); +IMPORT int dsmNbytes (UINT32 *binInst); +#endif /*PARISC_HPUX9 */ +#else + +#ifdef PARISC_HPUX9 +IMPORT int dsmHppaInst (); +IMPORT int dsmHppaNbytes (); +#else +IMPORT int dsmHppaInst (); +IMPORT int dsmHppaNbytes (); +#endif /*PARISC_HPUX9*/ + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdsmhppah */ diff --git a/h/arch/simhppa/esfSimhppa.h b/h/arch/simhppa/esfSimhppa.h new file mode 100644 index 0000000..e85d3cb --- /dev/null +++ b/h/arch/simhppa/esfSimhppa.h @@ -0,0 +1,28 @@ +/* esfSimhppa.h - simhppa exception stack frame */ + +/* Copyright 1993-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,25jan94,gae defined ESF. +01a,11aug93,gae from rrr. +*/ + +#ifndef __INCesfSimhppah +#define __INCesfSimhppah + +#ifdef __cplusplus +extern "C" { +#endif + +#include "regs.h" +#include "excLib.h" + +#define ESF EXC_INFO + +#ifdef __cplusplus +} +#endif + +#endif /* __INCesfSimhppah */ diff --git a/h/arch/simhppa/excSimhppaLib.h b/h/arch/simhppa/excSimhppaLib.h new file mode 100644 index 0000000..94daef6 --- /dev/null +++ b/h/arch/simhppa/excSimhppaLib.h @@ -0,0 +1,57 @@ +/* excSimhppaLib.h - simhppa exception library header */ + +/* Copyright 1993-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,08jun94,ms saved more state during exception/breakpoint +01c,10jan94,gae added external declaration for excExcepHook +01b,26jan94,gae rearranged EXC_INFO -- same as "simsparc". +01a,11aug93,gae from rrr. +*/ + +#ifndef __INCexcSimhppaLibh +#define __INCexcSimhppaLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + + +/* variable declarations */ + +extern FUNCPTR excExcepHook; /* add'l rtn to call when exceptions occur */ + + +#define ESF EXC_INFO + +typedef struct + { + int valid; + int pc; + int npc; + int ps; + int sig; + int code; + int addr; + int ptcb; + int gr[32]; + int fr[32]; + int sr[8]; + int cr11; + int state; + int addr1; + int addr2; + int pad[4]; + } EXC_INFO; + +#ifdef __cplusplus +} +#endif + +#endif /* _ASMLANGUAGE */ + +#endif /* __INCexcSimhppaLibh */ diff --git a/h/arch/simhppa/fppSimhppaLib.h b/h/arch/simhppa/fppSimhppaLib.h new file mode 100644 index 0000000..1d6ea4a --- /dev/null +++ b/h/arch/simhppa/fppSimhppaLib.h @@ -0,0 +1,91 @@ +/* fppSimhppaLib.h - simhppa floating-point header */ + +/* Copyright 1996 Wind River Systems, Inc. */ +/* +modification history +-------------------- +02b,25oct96,mem fixed FP_DATA definition. +02a,14jan96,kab created from fppSimsparcLib.h w/ hp mods. +01c,22sep95,ms added dummyQueuePtr field to FP_CONTEXT (SPR #4796). +01b,30jul93,gae fixed fpContext to have double regs. +01a,05jun93,rrr derived. +*/ + +#ifndef __INCfppSimhppaLibh +#define __INCfppSimhppaLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + +#define FP_NUM_DREGS 28 /* Floating-Point Data Registers */ + +/* equates for fppState, fpstate */ + +#define UNKNOWN 0x00 /* default */ +#define FPU_TESTED 0x01 /* set by fppProbe */ +#define FPU_TESTED_TRUE 0x02 /* set by fppProbe */ +#define FPU_TESTED_FALSE 0x00 /* set by fppProbe */ +#define FPU_AVAILABLE (FPU_TESTED + FPU_TESTED_TRUE) +#define NO_FPU_AVAILABLE (FPU_TESTED + FPU_TESTED_FALSE) + +#ifndef _ASMLANGUAGE + +typedef struct fpContext /* Floating-Point Context */ + { + union + { + unsigned int fps[8]; /* status reg; exception regs; + undefined if read/written as ints */ + double fpd[4]; /* ditto; */ + } fpe; + double fr[FP_NUM_DREGS]; /* Data Registers */ + } FP_CONTEXT; + +#define FPREG_SET FP_CONTEXT + +/* variable declarations */ + +extern REG_INDEX fpRegName[]; /* f-point data register table */ +extern REG_INDEX fpCtlRegName[]; /* f-point control register table */ +extern WIND_TCB *pFppTaskIdPrevious; /* task id for deferred exceptions */ +extern FUNCPTR fppCreateHookRtn; /* arch dependent create hook routine */ +extern FUNCPTR fppDisplayHookRtn; /* arch dependent display routine */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void fppArchInit (void); +extern void fppArchTaskCreateInit (FP_CONTEXT *pFpContext); + +#else + +extern void fppArchInit (); +extern void fppArchTaskCreateInit (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#define FSR_OFFSET(n) (4*(n)) /* status & exception regs */ +#define FP_DATA FSR_OFFSET(8) /* Data Registers */ +#define FPD_OFFSET(n) (FP_DATA + (8 * (n))) +#define FPREG_SET_SIZE (32*8) /* used in fppALib.s */ + +#define fpsr fpe.fps[0] /* status reg */ +#define fpe0 fpe.fps[1] /* exception reg */ +#define fpe1 fpe.fps[2] /* exception reg */ +#define fpe2 fpe.fps[3] /* exception reg */ +#define fpe3 fpe.fps[4] /* exception reg */ +#define fpe4 fpe.fps[5] /* exception reg */ +#define fpe5 fpe.fps[6] /* exception reg */ +#define fpe6 fpe.fps[7] /* exception reg */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfppSimsparcLibh */ diff --git a/h/arch/simhppa/ivSimhppa.h b/h/arch/simhppa/ivSimhppa.h new file mode 100644 index 0000000..a142b9c --- /dev/null +++ b/h/arch/simhppa/ivSimhppa.h @@ -0,0 +1,51 @@ +/* ivSimhppa.h - simhppa interrupt vectors */ + +/* Copyright 1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,01jan96,kab added _ASMLANGUAGE +01a,11aug93,gae from rrr. +*/ + +#ifndef __INCivSimhppa +#define __INCivSimhppa + +#ifndef _ASMLANGUAGE + +#ifdef __cplusplus +extern "C" { +#endif + +/* macros to convert interrupt vectors <-> interrupt numbers */ + +#define IVEC_TO_INUM(intVec) ((int) (intVec)) +#define INUM_TO_IVEC(intNum) ((VOIDFUNCPTR *) (intNum)) + +#define IVEC_TO_FD(intVec) ((intVec) - 32) +#define FD_TO_IVEC(fd) ((fd) + 32) + +/* interrupt vector definitions */ + +#define IV_HUP INUM_TO_IVEC (1) +#define IV_INT INUM_TO_IVEC (2) +#define IV_ILL INUM_TO_IVEC (4) +#define IV_TRAP INUM_TO_IVEC (5) +#define IV_FPE INUM_TO_IVEC (8) +#define IV_BUS INUM_TO_IVEC (10) +#define IV_SEGV INUM_TO_IVEC (11) +#define IV_CLOCK1 INUM_TO_IVEC (14) +#define IV_USR1 INUM_TO_IVEC (16) +#define IV_USR2 INUM_TO_IVEC (17) +#define IV_CLOCK2 INUM_TO_IVEC (20) +#define IV_CLOCK3 INUM_TO_IVEC (21) +#define IV_IO INUM_TO_IVEC (22) + +#ifdef __cplusplus +} +#endif + +#endif /* _ASMLANGUAGE */ + +#endif /* __INCivSimhppa */ diff --git a/h/arch/simhppa/regsSimhppa.h b/h/arch/simhppa/regsSimhppa.h new file mode 100644 index 0000000..223e3d2 --- /dev/null +++ b/h/arch/simhppa/regsSimhppa.h @@ -0,0 +1,131 @@ +/* regsSimhppa.h - simhppa registers header */ + +/* Copyright 1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,02dec96,mem Added array to hold os-specific async process state. +01d,05nov96,mem removed retVal field. +01c,28oct96,mem changed __ctxRestore prototype, changed extern to IMPORT. + removed sig_regs field. +01b,20nov95,mem expanded to use the full HP-PA register set. +01a,11aug93,gae from rrr. +*/ + +#ifndef __INCregsSimhppah +#define __INCregsSimhppah + +#ifndef _ASMLANGUAGE + +#ifdef __cplusplus +extern "C" { +#endif + +/* some common names for registers */ +#define reg_fp gr[3] +#define reg_pc pc +#define reg_npc npc +#define reg_psw psw +#define reg_arg0 gr[26] +#define reg_dp gr[27] +#define reg_ret0 gr[28] +#define spReg gr[30] +#define reg_sp spReg + +typedef struct rset /* simhppa Register Set. */ + { + /* fields which are not strictly registers */ + int flags; /* OS flags */ + int reg_mask; /* signal mask for the task. */ + + /* HP-PA registers */ + int pc; /* (pcoqh) pc */ + int npc; /* (pcoqt) next pc */ + int pcsqh; /* */ + int pcsqt; /* */ + int gr[32]; /* general regs */ + int sr[8]; /* space regs */ + int sar; /* shift amount register (cr11) */ + int eiem; /* */ + int iir; /* */ + int isr; /* */ + int ior; /* */ + int psw; /* processor status word. */ + int _goto; /* */ + int ccr; /* control register ccr */ + int cr0; /* control register #0 */ + int cr8; /* control register #8 */ + int cr9; /* control register #9 */ + int cr12; /* control register #12 */ + int cr13; /* control register #13 */ + int cr24; /* control register #24 */ + int cr25; /* control register #25 */ + int cr26; /* control register #26 */ + int mpsfu_high; /* */ + int mpsfu_low; /* */ + int mpsfu_ovflo; /* */ + int async; /* TRUE if saved state is async */ + int os_state[350]; /* os-specific async state */ + } REG_SET; + +#define PC_OFFSET OFFSET(REG_SET,reg_pc) + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT int sr3RegGet (void); +IMPORT int dpRegGet (void); +IMPORT int spRegGet (void); +IMPORT int vxLDC (void *address); +IMPORT int __ctxSave (REG_SET *pRegs); +IMPORT int __ctxWindSave (REG_SET *pRegs, int reschedule); +IMPORT void __ctxRestore (REG_SET *pRegs); + +#else + +IMPORT int sr3RegGet (); +IMPORT int dpRegGet (); +IMPORT int spRegGet (); +IMPORT int vxLDC (); +IMPORT int __ctxSave (); +IMPORT int __ctxWindSave (); +IMPORT void __ctxRestore (); + +#endif /* defined(__STDC__) || defined(__cplusplus) */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ASMLANGUAGE */ + +#define REG_SET_FLAGS 0x0000 +#define REG_SET_MASK 0x0004 +#define REG_SET_PC 0x0008 +#define REG_SET_NPC 0x000c +#define REG_SET_PCSQH 0x0010 +#define REG_SET_PCSQT 0x0014 +#define REG_SET_GR0 0x0018 +#define REG_SET_SR0 0x0098 +#define REG_SET_SAR 0x00b8 +#define REG_SET_EIEM 0x00bc +#define REG_SET_IIR 0x00c0 +#define REG_SET_ISR 0x00c4 +#define REG_SET_IOR 0x00c8 +#define REG_SET_PSW 0x00cc +#define REG_SET_GOTO 0x00d0 +#define REG_SET_CCR 0x00d4 +#define REG_SET_CR0 0x00d8 +#define REG_SET_CR8 0x00dc +#define REG_SET_CR9 0x00e0 +#define REG_SET_CR12 0x00e4 +#define REG_SET_CR13 0x00e8 +#define REG_SET_CR24 0x00ec +#define REG_SET_CR25 0x00f0 +#define REG_SET_CR26 0x00f4 +#define REG_SET_MPSFU_HIGH 0x00f8 +#define REG_SET_MPSFU_LOW 0x00fc +#define REG_SET_MPSFU_OVFLO 0x0100 +#define REG_SET_ASYNC 0x0104 + +#endif /* __INCregsSimhppah */ diff --git a/h/arch/simlinux/archSimlinux.h b/h/arch/simlinux/archSimlinux.h new file mode 100644 index 0000000..c558911 --- /dev/null +++ b/h/arch/simlinux/archSimlinux.h @@ -0,0 +1,119 @@ +/* archSimnt.h - i86 VxSim specific header */ + +/* + * Copyright 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +01x,12apr05,kk removed _WRS_OBJLIB_SUPPORT_VERIFY_TRAP macro (SPR# 106486) +01w,31mar05,elp added _ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK macro +01v,27aug04,dbt Added _WRS_OBJLIB_SUPPORT_VERIFY_TRAP. +01u,18may04,tam removed _WRS_KERNEL_TEXT_START_ADRS definition +01t,18may04,jmp fixed _WRS_FRAMEP_FROM_JMP_BUF macro. +01s,15may04,zl fixed _WRS_FRAMEP_FROM_JMP_BUF() +01r,14may04,jmp removed obsolete stuff. +01q,23mar04,jmp added support for portable trcLib. + added macros for getting frame and return PC from a jmp_buf. +01p,09feb04,aeg moved _WRS_PAL_COPROC_LIB to archSimntCommon.h +01o,04dec03,dbt Added support for DIAB compiler. +01n,02dec03,dbt Updated power management support. +01m,25nov03,pes Move definition of _BYTE_ORDER to archCommon.h. +01l,14nov03,job Moved blib stuff to archSimntCommon.h +01k,13nov03,pes Add include of common header +01j,23sep03,dbt Use new B6 scheduler. +01i,18aug03,dbt Added PAL support for VxSim. +01h,22jul03,kam removed define of WV_INSTRUMENTATION +01g,28may03,jmp removed X86_EXT structure. +01f,22apr03,dbt Added _WRS_ARCH_IS_SIMULATOR definition. +01e,27mar03,jmp added X86_EXT. no longer include ntcontext.h +01d,13mar01,sn SPR 73723 - define supported toolchains +01c,21sep01,jmp only include ntcontext.h if _ASMLANGUAGE not defined + (SPR# 34669). +01b,29jul98,ms added WV_INSTRUMENTATION +01a,03sep97,cym written +*/ + +#ifndef __INCarchSimnth +#define __INCarchSimnth + +#ifdef __cplusplus +extern "C" { +#endif + +/* Begin PAL */ + +#define _ALLOC_ALIGN_SIZE 8 /* 8-byte alignment */ +#define _STACK_ALIGN_SIZE 8 /* 8-byte alignment */ + +#define _DYNAMIC_BUS_SIZING FALSE /* no dynamic bus sizing */ + +#define _WRS_ARCH_IS_SIMULATOR /* This is a simulator */ + +#define _ARCH_SUPPORTS_GCC /* GCC compiler is supported on this arch. */ +#define _ARCH_SUPPORTS_DCC /* DCC compiler is supported on this arch. */ + +#if CPU!=SIMNT +/* Used in usrDepend.c and usrKernelStack.c */ + +#define _ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK +#endif + +/* moved here from h/private/javaLibP.h */ + +#define JAVA_C_SYM_PREFIX "" + +#ifndef _ASMLANGUAGE +/* macros for getting frame and return PC from a jmp_buf */ + +#define _WRS_FRAMEP_FROM_JMP_BUF(env) ((char *) (env)[0].reg.reg_fp) +#define _WRS_RET_PC_FROM_JMP_BUF(env) ((INSTR *) (env)[0].reg.reg_pc) +#endif /* _ASMLANGUAGE */ + +/* from loadElfLib.c */ + +#define _WRS_USE_ELF_LOAD_FORMAT + +/* from xdr_float.c */ + +#define FLOAT_NORM + +/* from qPriBMapLib.c */ + +#define qPriBMapLib_PORTABLE + +/* from ffsLib.c */ + +#define ffsLib_PORTABLE + +/* from schedLib.c */ + +#define _WRS_VXLIB_SUPPORT + +#define _WRS_BASE6_SCHEDULER +#define _WRS_ENABLE_IDLE_INTS + +/* from spyLib.c */ + +#define _WRS_SPY_TASK_SIZE 10000 + +/* End PAL */ + +#if (CPU==SIMLINUX) +#include "arch/simlinux/archSimlinuxCommon.h" +#elif (CPU==SIMNT) +#include "arch/simnt/archSimntCommon.h" +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCarchSimnth */ diff --git a/h/arch/simlinux/archSimlinuxCommon.h b/h/arch/simlinux/archSimlinuxCommon.h new file mode 100644 index 0000000..1d004a5 --- /dev/null +++ b/h/arch/simlinux/archSimlinuxCommon.h @@ -0,0 +1,68 @@ +/* archSimpentiumCommon.h - common PENTIUM VxSim architecture specific header */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,13may04,zl enabled user-mode trcLib +01g,22apr04,jmp added support for portable trcLib. +01f,23mar04,dbt Updated comments. +01e,09feb04,aeg added _WRS_PAL_COPROC_LIB +01d,25nov03,pes Move definition of _BYTE_ORDER to archCommon.h. +01c,17nov03,jmp added SYSCALL_TRAP_HANDLE_INIT. +01b,12nov03,job Moved some blib stuff from archSimnt.h +01a,11nov03,pes written. +*/ + +#ifndef __INCarchSimpentiumCommonh +#define __INCarchSimpentiumCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +/* from bLib.c */ + +#undef _WRS_BLIB_OPTIMIZED +#undef _WRS_SWAB_OPTIMIZED +#define swab_PORTABLE +#define _WRS_BLIB_ALIGNMENT 3 /* quad byte alignment mask */ + +/* + * SYSCALL_TRAP_HANDLE_INIT - system call trap magic number + * + * On VxSim, the system call infrastucture is based on a mechanism to directly + * call kernel services from RTP via the syscallTrapHandle() routine. + * Since the RTP does not have access to syscallTrapHandle() routine, each RTP + * contains a function pointer _func_syscallTrapHandle which is initialized to + * an invalid address: SYSCALL_TRAP_HANDLE_INIT. On the first system call + * performed by the RTP, an exception will be generated, the exception + * handling will invoke syscallTrapHandlerInit() if installed, and + * syscallTrapHandlerInit() will fix _func_syscallTrapHandle to point to + * syscallTrapHandle(). + */ + +#define SYSCALL_TRAP_HANDLE_INIT 0x1234 + +#define _BYTE_ORDER _LITTLE_ENDIAN + +/* Enable Coprocessor Abstraction */ + +#define _WRS_PAL_COPROC_LIB + +/* Enable Portable trcLib */ + +#define trcLib_PORTABLE +#define _WRS_TRC_ARGS_COUNT 5 /* number of arguments to print in */ + /* stack trace */ + +#ifndef _ASMLANGUAGE +typedef unsigned char INSTR; /* char instructions */ +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCarchSimpentiumCommonh */ diff --git a/h/arch/simlinux/asmSimlinux.h b/h/arch/simlinux/asmSimlinux.h new file mode 100644 index 0000000..a3be0ee --- /dev/null +++ b/h/arch/simlinux/asmSimlinux.h @@ -0,0 +1,120 @@ +/* asmI86.h - i80x86 assembler definitions header file */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,04may04,dbt Added ARG8-12 and SP_ARG8-12. +01g,17nov03,jb Adding additional ARG defines +01f,01nov01,hdn added ARG8 and SP_ARG8 +01e,01oct01,pad Turn off the underscore prepending to assembly routines. +01d,14aug01,hdn imported FUNC/FUNC_LABEL GTEXT/GDATA macros from T31 ver 01i +01c,28aug98,hdn added INT_CONNECT_CODE29 for intEnt(). +01b,07jun93,hdn added support for c++ +01a,28feb92,hdn written based on TRON, 68k version. +*/ + +#ifndef __INCasmI86h +#define __INCasmI86h + +/************************************************************/ + +/* + * The following definitions are used for symbol name compatibility. + * + * When #if 1, sources are assembled assuming the compiler + * you are using does not generate global symbols prefixed by "_". + * (e.g. elf/dwarf) + * + * When #if 0, sources are assembled assuming the compiler + * you are using generates global symbols prefixed by "_". + * (e.g. coff/stabs) + */ + +#if TRUE +#define FUNC(sym) sym +#define FUNC_LABEL(sym) sym: +#else +#define FUNC(sym) _##sym +#define FUNC_LABEL(sym) _##sym: +#endif + +#define VAR(sym) FUNC(sym) + +/* + * These macros are used to declare assembly language symbols that need + * to be typed properly(func or data) to be visible to the OMF tool. + * So that the build tool could mark them as an entry point to be linked + * by another PD. This is an elfism. Use #if 0 for a.out. + */ + +#if FALSE +#define GTEXT(sym) FUNC(sym) ; .type FUNC(sym),@function +#define GDATA(sym) FUNC(sym) ; .type FUNC(sym),@object +#else +#define GTEXT(sym) FUNC(sym) +#define GDATA(sym) FUNC(sym) +#endif + +/************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/* fp offsets to arguments */ + +#define ARG1 8 +#define ARG1W 10 +#define ARG2 12 +#define ARG2W 14 +#define ARG3 16 +#define ARG3W 18 +#define ARG4 20 +#define ARG5 24 +#define ARG6 28 +#define ARG7 32 +#define ARG8 36 +#define ARG9 40 +#define ARG10 44 +#define ARG11 48 +#define ARG12 52 + +#define DARG1 8 /* double arguments */ +#define DARG1L 12 +#define DARG2 16 +#define DARG2L 20 +#define DARG3 24 +#define DARG3L 28 +#define DARG4 32 +#define DARG4L 36 + +/* sp offsets to arguments */ + +#define SP_ARG0 0 +#define SP_ARG1 4 +#define SP_ARG1W 6 +#define SP_ARG2 8 +#define SP_ARG2W 10 +#define SP_ARG3 12 +#define SP_ARG3W 14 +#define SP_ARG4 16 +#define SP_ARG5 20 +#define SP_ARG6 24 +#define SP_ARG7 28 +#define SP_ARG8 32 +#define SP_ARG9 36 +#define SP_ARG10 40 +#define SP_ARG11 44 +#define SP_ARG12 48 + +/* offset to the IRQ number in the intConnectCode[] */ + +#define INT_CONNECT_CODE29 24 /* from the return address of intEnt() */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCasmI86h */ diff --git a/h/arch/simlinux/coprocSimlinux.h b/h/arch/simlinux/coprocSimlinux.h new file mode 100644 index 0000000..f67cce7 --- /dev/null +++ b/h/arch/simlinux/coprocSimlinux.h @@ -0,0 +1,32 @@ +/* coprocSimsolaris.h - coprocessor management library header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,19aug04,dbt Written +*/ + +#ifndef __INCcoprocSimsolarish +#define __INCcoprocSimsolarish + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "taskLib.h" + +/* defines */ + +#define VX_FP_TASK VX_COPROC1_TASK + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcoprocSimsolarish */ diff --git a/h/arch/simlinux/dbgSimlinuxLib.h b/h/arch/simlinux/dbgSimlinuxLib.h new file mode 100644 index 0000000..eb307d2 --- /dev/null +++ b/h/arch/simlinux/dbgSimlinuxLib.h @@ -0,0 +1,94 @@ +/* dbgSimntLib.h - header file for arch dependent portion of debugger */ + +/* Copyright 1998-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,18may04,jmp fixed instrI86.h reference. +01d,07apr04,jmp adapted to share trcArchLib between VxSim/i86 and i86 arches. +01c,11feb04,elg Add syscall instruction size macro. +01b,09feb04,jeg added DSM() macro definition +01a,29apr98,cym written based on x86 version. +*/ + +#ifndef __INCdbgSimntLibh +#define __INCdbgSimntLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#if (CPU==SIMNT) +#include "arch/simnt/instrI86.h" +#elif (CPU==SIMLINUX) +#include "arch/simlinux/instrI86.h" +#endif + +/* defines */ + +#define BRK_INST 0x1000 /* instruction hardware breakpoint */ +#define BRK_DATAW1 0x1400 /* data write 1 byte breakpoint */ +#define BRK_DATAW2 0x1500 /* data write 2 byte breakpoint */ +#define BRK_DATAW4 0x1700 /* data write 4 byte breakpoint */ +#define BRK_DATARW1 0x1c00 /* data read-write 1 byte breakpoint */ +#define BRK_DATARW2 0x1d00 /* data read-write 2 byte breakpoint */ +#define BRK_DATARW4 0x1f00 /* data read-write 4 byte breakpoint */ + +#define BRK_HARDWARE 0x1000 /* hardware breakpoint bit */ +#define BRK_HARDMASK 0x1f00 /* hardware breakpoint mask */ + +#define TRACE_FLAG (0x0100) /* TF in EFLAGS */ +#define INT_FLAG (0x0200) /* IF in EFLAGS */ + +#define DBG_INST_ALIGN (1) + +#ifndef _ASMLANGUAGE + +#define BREAK_INST 0xcc /* int 3 */ +#define DBG_BREAK_INST 0xcc /* int 3 */ +#define DBG_SYSCALL_SIZE 2 +#define BREAK_ESF EXC_INFO +#define TRACE_ESF EXC_INFO + +/* offsets to register fields in type REG_SET */ + +#define EDI (0) +#define ESI (1) +#define EBP (2) +#define ESP (3) +#define EBX (4) +#define EDX (5) +#define ECX (6) +#define EAX (7) +#define EFLAGS (8) + +#define _WRS_TRC_ARGS_COUNT 5 /* number of arguments to print in */ + /* stack trace */ + +/* macros */ + +#define DSM(addr,inst,mask) ((*(addr) & (mask)) == (inst)) + +/* hardware breakpoint registers */ + +typedef struct /* DBG_REGS */ + { + unsigned int db0; /* debug register 0 */ + unsigned int db1; /* debug register 1 */ + unsigned int db2; /* debug register 2 */ + unsigned int db3; /* debug register 3 */ + unsigned int db6; /* debug register 6 */ + unsigned int db7; /* debug register 7 */ + + } DBG_REGS; + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* INCdbgSimntLibh */ diff --git a/h/arch/simlinux/dsmSimlinuxLib.h b/h/arch/simlinux/dsmSimlinuxLib.h new file mode 100644 index 0000000..350d4de --- /dev/null +++ b/h/arch/simlinux/dsmSimlinuxLib.h @@ -0,0 +1,647 @@ +/* dsmI86Lib.h - i80x86 disassembler header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01k,16mar04,md Add output functions to dmsData() and dsmInst() +01j,01mar03,pai Made the FORMAT_X & FORMAT_Y opcode data pointers point to + constant data. Updated Copyright. +01i,16sep02,pai Updated support for SSE2 & Pentium 4 instructions. +01h,30aug01,hdn added SIMD, sysenter/exit support. +01g,06may98,fle added P5 and P6 instructions and facilities +01f,14nov94,hdn changed D->DISR, W->WFUL, S->SEXT, P->POP, A->AX, I->IMM. + +kdl minor cleanup. +01e,29may94,hdn removed I80486 conditional. +01d,31aug93,hdn changed a type of pD, from char to UCHAR. + changed a type of 1st parameter, from char to UCHAR. +01c,07jun93,hdn added support for c++ +01b,26mar93,hdn added new instructions for 486. +01a,23jun92,hdn written. +*/ + +#ifndef __INCdsmI86Libh +#define __INCdsmI86Libh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include "vwModNum.h" + + +/* dsmLib status codes */ + +#define S_dsmLib_UNKNOWN_INSTRUCTION (M_dsmLib | 1) + + +#define DSM_BUFSIZE16 (16) +#define DSM_BUFSIZE32 (32) + +typedef struct /* INST */ + { + const char * pOpc; /* Instruction Name */ + int type; /* instruction type */ + int flag; /* instruction flag */ + int flag2; /* instruction flag2 */ + UCHAR op0; /* opcode 0 */ + UCHAR op1; /* opcode 1 */ + UCHAR op2; /* opcode 2 */ + UCHAR op3; /* opcode 3 */ + UCHAR mask0; /* mask 0 */ + UCHAR mask1; /* mask 1 */ + UCHAR mask2; /* mask 2 */ + UCHAR mask3; /* mask 3 */ + + } INST; + +typedef struct /* FORMAT_X */ + { + const INST * pI; /* pointer to an INST descriptor */ + const char * pD; /* opcode data pointer */ + const char * pOpc; /* instruction name pointer */ + char obuf [DSM_BUFSIZE16]; /* instruction name buffer */ + char a32; /* address size 0,1 */ + char d32; /* data size 0,1 */ + char lenO; /* opcode length 1,2 */ + char lenD; /* displacement length 0,1,2,4 */ + char lenI; /* immediate length 0,1,2,4 */ + char modrm; /* MODRM 0,1 */ + char sib; /* SIB 0,1 */ + char w; /* W 0,1 */ + char d; /* D 0,1 */ + char s; /* S 0,1 */ + char reg; /* register 3 bits, 8 bits */ + char mod; /* value of MODRM byte bits 6,7 */ + char rm; /* value of MODRM byte bits 0,1,2 */ + char ss; + char index; + char base; + char mf; + char st; + char fd; + + } FORMAT_X; + +typedef struct /* FORMAT_Y */ + { + const char * pD; /* opcode data pointer */ + const char * pOpc; /* instruction name pointer */ + char * pOpr0; /* output string 0 */ + char * pOpr1; /* output string 1 */ + char * pOpr2; /* output string 2 */ + int len; /* instruction length */ + int addr; /* address operand */ + char obuf [DSM_BUFSIZE16]; /* opcode buffer */ + char rbuf [DSM_BUFSIZE16]; /* register buffer */ + char mbuf [DSM_BUFSIZE32]; /* memory buffer */ + char temp [DSM_BUFSIZE32]; /* temporary buffer */ + char ibuf [DSM_BUFSIZE16]; /* immediate buffer */ + char dbuf [DSM_BUFSIZE16]; /* displacement buffer */ + + } FORMAT_Y; + +/* bit definitions of flag */ + +/* jhw: MSB of flag byte is not included in switch statement used + * to format the output. + */ + +/* MODRM must be defined if REG, MMXREG, XMMREG are defined */ + +#define SF (0x10000000) +#define OP1 (0x20000000) +#define OP2 (0x40000000) +#define OP3 (0x80000000) +#define WFUL (0x01000000) /* operand size bit */ +#define SEXT (0x02000000) /* sign extend flag */ +#define DISR (0x04000000) /* data direction info encoded in opcode */ +#define TTT (0x08000000) /* hack to look for rotate instructions */ + +#define TTTN (0x00100000) /* opcode least significant byte + * bits 0-4 = condition test field */ +#define MF (0x00200000) /* opcode bits 1-2 are = register size info */ +#define POP (0x00400000) /* cat a "P" to end of instruction name */ + +#define IMM (0x00000001) +#define I8 (0x00000002) /* imm8 byte exists */ +#define DIS (0x00000004) /* displacement info */ +#define D8 (0x00000008) /* displacement info */ +#define D16 (0x00000010) /* displacement info */ +#define AX (0x00000020) /* store into AX register */ +#define CL (0x00000040) /* cat "CL" to end of operands */ +#define REG (0x00000080) /* modrm bits 3-5 = register specifier */ +#define SREG2 (0x00000100) /* modrm bits 3-4 = 2 bit segment register */ +#define SREG3 (0x00000200) /* modrm bits 3-5 = 3 bit segment register */ +#define MODRM (0x00000400) /* modrm byte exists */ +#define EEE (0x00000800) /* modrm bits 3-5 = control/debug register */ +#define REGRM (0x00001000) /* modrm bits 0-2 = register specifier */ +#define PORT (0x00002000) /* use a port as an operand */ +#define OFFSEL (0x00004000) /* jump or call offset */ +#define D16L8 (0x00008000) /* displacement info */ +#define FD (0x00010000) /* stack element is destination */ +#define ST (0x00020000) /* stack element is operand */ +#define MMXRM (0x00040000) /* modrm bits 0-2 = MMX register */ +#define MMXREG (0x00080000) /* modrm bits 3-5 = MMX register */ +#define GG (0x00800000) /* least sign opcode byte + * bits 0-1 = MMX granularity */ + +/* bit definitions of flag2 */ + +#define XMMRM (0x00000001) /* modrm bits 0-2 = XMM register */ +#define XMMREG (0x00000002) /* modrm bits 3-5 = XMM register */ + +#define ESC (0xd8) /* for co-processor instructions */ + +/* instruction types */ + +#define itAaa 1 +#define itAad 2 +#define itAam 3 +#define itAas 4 +#define itAddItoA 5 +#define itAddItoRM 6 +#define itAddRMtoRM 7 +#define itAndItoA 8 +#define itAndItoRM 9 +#define itAndRMtoRM 10 +#define itArpl 11 +#define itAsize 12 +#define itBound 13 +#define itBsf 14 +#define itBsr 15 +#define itBtI 16 +#define itBtR 17 +#define itBtcI 18 +#define itBtcR 19 +#define itBtrI 20 +#define itBtrR 21 +#define itBtsI 22 +#define itBtsR 23 +#define itCall 24 +#define itCallRM 25 +#define itCallSeg 26 +#define itCallSegRM 27 +#define itCbw 28 +#define itCjmp 29 +#define itClc 30 +#define itCld 31 +#define itCli 32 +#define itClts 33 +#define itCmc 34 +#define itCmpIwiA 35 +#define itCmpIwiRM 36 +#define itCmpRMwiRM 37 +#define itCmps 38 +#define itCs 39 +#define itCset 40 +#define itCwd 41 +#define itDaa 42 +#define itDas 43 +#define itDecR 44 +#define itDecRM 45 +#define itDiv 46 +#define itDs 47 +#define itEnter 48 +#define itEs 49 +#define itFs 50 +#define itGs 51 +#define itHlt 52 +#define itIdiv 53 +#define itImulAwiRM 54 +#define itImulRMwiI 55 +#define itImulRwiRM 56 +#define itInF 57 +#define itInV 58 +#define itIncR 59 +#define itIncRM 60 +#define itIns 61 +#define itInt 62 +#define itInt3 63 +#define itInto 64 +#define itIret 65 +#define itJcxz 66 +#define itJmpD 67 +#define itJmpRM 68 +#define itJmpS 69 +#define itJmpSeg 70 +#define itJmpSegRM 71 +#define itLahf 72 +#define itLar 73 +#define itLds 74 +#define itLea 75 +#define itLeave 76 +#define itLes 77 +#define itLfs 78 +#define itLgdt 79 +#define itLgs 80 +#define itLidt 81 +#define itLldt 82 +#define itLmsw 83 +#define itLock 84 +#define itLods 85 +#define itLoop 86 +#define itLoopnz 87 +#define itLoopz 88 +#define itLsl 89 +#define itLss 90 +#define itLtr 91 +#define itMovAMtoMA 92 +#define itMovC 93 +#define itMovD 94 +#define itMovItoR 95 +#define itMovItoRM 96 +#define itMovRMtoMR 97 +#define itMovRMtoS 98 +#define itMovRtoRM 99 +#define itMovStoRM 100 +#define itMovT 101 +#define itMovs 102 +#define itMovsx 103 +#define itMovzx 104 +#define itMulAwiRM 105 +#define itNeg 106 +#define itNop 107 +#define itNot 108 +#define itOrItoA 109 + +#define itOrItoRM 111 + +#define itOrRMtoRM 113 + +#define itOsize 115 +#define itOutF 116 +#define itOutV 117 +#define itOuts 118 +#define itPopR 119 +#define itPopRM 120 +#define itPopS 121 +#define itPopa 122 +#define itPopf 123 +#define itPushI 124 +#define itPushR 125 +#define itPushRM 126 +#define itPushS 127 +#define itPusha 128 +#define itPushf 129 +#define itRNcmps 130 +#define itRNscas 131 +#define itRcmps 132 +#define itRet 133 +#define itRetI 134 +#define itRetSeg 135 +#define itRetSegI 136 +#define itRins 137 +#define itRlods 138 +#define itRmovs 139 +#define itRolRMby1 140 +#define itRolRMbyCL 141 +#define itRolRMbyI 142 +#define itRouts 143 +#define itRscas 144 +#define itRstos 145 +#define itSahf 146 +#define itSbbIfrA 147 +#define itSbbIfrRM 148 +#define itSbbRMfrRM 149 +#define itScas 150 +#define itSgdt 151 +#define itShldRMbyCL 152 +#define itShldRMbyI 153 +#define itShrdRMbyCL 154 +#define itShrdRMbyI 155 +#define itSmsw 156 +#define itSs 157 +#define itStc 158 +#define itStd 159 +#define itSti 160 +#define itStos 161 +#define itStr 162 + +#define itSubIfrA 164 +#define itSubIfrRM 165 +#define itSubRMfrRM 166 +#define itTestIanA 167 +#define itTestIanRM 168 +#define itTestRManR 169 +#define itWait 170 +#define itXchgA 171 +#define itXchgRM 172 +#define itXlat 173 + +/* instructions for 387 */ + +#define itF2xm1 174 +#define itFabs 175 +#define itFaddIRM 176 +#define itFaddST 177 +#define itFchs 178 +#define itFclex 179 +#define itFcomIRM 180 +#define itFcomST 181 +#define itFcompIRM 182 +#define itFcompST 183 +#define itFcompp 184 +#define itFcos 185 +#define itFdecstp 186 +#define itFdivIRM 187 +#define itFdivST 188 +#define itFfree 189 +#define itFincstp 190 +#define itFinit 191 +#define itFld1 192 +#define itFldBCDM 193 +#define itFldERM 194 +#define itFldIRM 195 +#define itFldL2E 196 +#define itFldL2T 197 +#define itFldLG2 198 +#define itFldLIM 199 +#define itFldLN2 200 +#define itFldPI 201 +#define itFldST 202 +#define itFldZ 203 +#define itFldcw 204 +#define itFldenv 205 +#define itFmulIRM 206 +#define itFmulST 207 +#define itFnop 208 +#define itFpatan 209 +#define itFprem 210 +#define itFprem1 211 +#define itFptan 212 +#define itFrndint 213 +#define itFrstor 214 +#define itFsave 215 +#define itFscale 216 +#define itFsin 217 +#define itFsincos 218 +#define itFsqrt 219 +#define itFstIRM 220 +#define itFstST 221 +#define itFstcw 222 +#define itFstenv 223 +#define itFstpBCDM 224 +#define itFstpERM 225 +#define itFstpIRM 226 +#define itFstpLIM 227 +#define itFstpST 228 +#define itFstsw 229 +#define itFstswA 230 +#define itFsubIRM 231 +#define itFsubST 232 +#define itFtst 233 +#define itFucom 234 +#define itFucomp 235 +#define itFucompp 236 +#define itFxam 237 +#define itFxch 238 +#define itFxtract 239 +#define itFyl2x 240 +#define itFyl2xp1 241 +#define itFcmovb 242 +#define itFcmove 243 +#define itFcmovbe 244 +#define itFcmovu 245 +#define itFcmovnb 246 +#define itFcmovne 247 +#define itFcmovnbe 248 +#define itFcmovnu 249 +#define itFcomi 250 + + +/* addendum */ + +#define itSidt 300 +#define itSldt 301 +#define itVerr 302 +#define itVerw 303 +#define itXorItoRM 304 +#define itAdcItoRM 305 +#define itXorItoA 306 +#define itAdcItoA 307 +#define itXorRMtoRM 308 +#define itAdcRMtoRM 309 +#define itRep 310 +#define itRepNe 311 + +/* 80486 instructions */ + +#define itBswap 400 +#define itCmpxchg 401 +#define itXadd 402 +#define itInvd 403 +#define itWbinvd 404 +#define itInvlpg 405 + +/* P5 instructions */ + +#define itCmpxchg8b 500 +#define itCpuid 501 +#define itRdtsc 502 +#define itRdmsr 503 +#define itWrmsr 504 +#define itRsm 505 + +/* P6 instructions */ + +#define itCmovcc 600 +#define itRdpmc 601 +#define itUd2 602 +#define itSysenter 603 +#define itSysexit 604 + +/* MMX/SSE2 instructions */ + +#define itEmms 700 +#define itMovd 701 +#define itMovq 702 +#define itPackssdw 703 +#define itPacksswb 704 +#define itPackuswb 705 +#define itPadd 706 +#define itPadds 707 +#define itPaddus 708 +#define itPand 709 +#define itPandn 710 +#define itPcmpeq 711 +#define itPcmpgt 712 +#define itPmadd 713 +#define itPmulh 714 +#define itPmull 715 +#define itPor 716 +#define itPsll 717 +#define itPsra 718 +#define itPsrl 719 +#define itPsub 720 +#define itPsubs 721 +#define itPsubus 722 +#define itPunpckh 723 +#define itPunpckl 724 +#define itPxor 725 + +/* SSE/SSE2 instructions */ + +#define itAddpd 800 +#define itAddps 801 +#define itAddsd 802 +#define itAddss 803 +#define itAndnpd 804 +#define itAndnps 805 +#define itAndpd 806 +#define itAndps 807 + +#define itCmppd 821 +#define itCmpps 822 +#define itCmpsd 823 +#define itCmpss 824 + +#define itComiss 827 +#define itCvtdq2pd 828 +#define itCvtdq2ps 829 +#define itCvtpd2dq 830 +#define itCvtpd2ps 831 +#define itCvtpi2pd 832 +#define itCvtpi2ps 833 +#define itCvtps2dq 834 +#define itCvtps2pd 835 +#define itCvtps2pi 836 +#define itCvtsd2si 837 +#define itCvtsd2ss 838 +#define itCvtsi2sd 839 +#define itCvtsi2ss 840 +#define itCvtss2sd 841 +#define itCvtss2si 842 +#define itCvttpd2dq 843 +#define itCvttpd2pi 844 +#define itCvttps2dq 845 +#define itCvttps2pi 846 +#define itCvttsd2si 847 +#define itCvttss2si 848 +#define itDivpd 849 +#define itDivps 850 +#define itDivsd 851 +#define itDivss 852 +#define itFxrstor 853 +#define itFxsave 854 +#define itLdmxcsr 855 +#define itMaskmovdqu 856 +#define itMaskmovq 857 +#define itMaxpd 858 +#define itMaxps 859 +#define itMaxsd 860 +#define itMaxss 861 +#define itMinpd 862 +#define itMinps 863 +#define itMinsd 864 +#define itMinss 865 +#define itMovapd 866 +#define itMovaps 867 +#define itMovdq2q 868 +#define itMovdqa 869 +#define itMovdqu 870 +#define itMovhlps 871 +#define itMovhpd 872 +#define itMovhps 873 +#define itMovlhps 874 +#define itMovlpd 875 +#define itMovlps 876 +#define itMovmskpd 877 +#define itMovmskps 878 +#define itMovntdq 879 +#define itMovntpd 880 +#define itMovntps 881 +#define itMovntq 882 +#define itMovq2dq 883 +#define itMovsd 884 +#define itMovss 885 +#define itMovupd 886 +#define itMovups 887 +#define itMulpd 888 +#define itMulps 889 +#define itMulsd 890 +#define itMulss 891 +#define itOrpd 892 +#define itOrps 893 +#define itPavgb 894 +#define itPavgw 895 +#define itPextrw 896 +#define itPinsrw 897 +#define itPmaxsw 898 +#define itPmaxub 899 +#define itPminsw 900 +#define itPminub 901 +#define itPmovmskb 902 +#define itPmulhuw 903 +#define itPmuludq 904 +#define itPrefetchnta 905 +#define itPrefetcht0 906 +#define itPrefetcht1 907 +#define itPrefetcht2 908 +#define itPsadbw 909 +#define itPshufd 910 +#define itPshufhw 911 +#define itPshuflw 912 +#define itPshufw 913 +#define itPslldq 914 +#define itPsrldq 915 +#define itPunpckhqdq 916 +#define itPunpcklqdq 917 +#define itRcpps 918 +#define itRcpss 919 +#define itRsqrtps 920 +#define itRsqrtss 921 +#define itSfence 922 +#define itShufps 923 +#define itSqrtpd 924 +#define itSqrtps 925 +#define itSqrtsd 926 +#define itSqrtss 927 +#define itStmxcsr 928 +#define itSubpd 929 +#define itSubps 930 +#define itSubsd 931 +#define itSubss 932 +#define itUcomisd 933 +#define itUcomiss 934 +#define itUnpckhpd 935 +#define itUnpckhps 936 +#define itUnpcklpd 937 +#define itUnpcklps 938 +#define itXorpd 939 +#define itXorps 940 + +/* Pentium 4 instructions */ + +#define itClflush 1000 +#define itLfence 1001 +#define itMfence 1002 +#define itMovnti 1003 +#define itPause 1004 + + +/* function declarations */ + +#if defined (__STDC__) || defined (__cplusplus) + +IMPORT int dsmData (UCHAR *, int, FUNCPTR, int); +IMPORT int dsmInst (UCHAR *, int, VOIDFUNCPTR, FUNCPTR, int); +IMPORT int dsmNbytes (UCHAR *); + +#else + +IMPORT int dsmData (); +IMPORT int dsmInst (); +IMPORT int dsmNbytes (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdsmI86Libh */ diff --git a/h/arch/simlinux/elfI86.h b/h/arch/simlinux/elfI86.h new file mode 100644 index 0000000..d839657 --- /dev/null +++ b/h/arch/simlinux/elfI86.h @@ -0,0 +1,65 @@ +/* elfI86.h - i86-specific ELF loader header */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software may be + * licensed only pursuant to the terms of an applicable Wind River license + * agreement. + */ + +/* +modification history +-------------------- +01c,25jul05,v_r Updated copyright. +01b,27feb04,pad Renamed relocation type R_386_JUMP_SLOT as R_386_JMP_SLOT as + per ABI. +01a,12sep01,pad Backported from TAE 3.1 to T2.2 with necessary adaptations + (base version: elfI86.h@@/main/tor3_x/1). +*/ + +#ifndef __INCelfI86h +#define __INCelfI86h + +#ifdef __cplusplus +extern "C" { +#endif + +#define EM_ARCH_MACHINE EM_386 +#define EM_ARCH_MACH_ALT EM_486 /* not used */ + +/* + * Relocation Type Definitions + * The only ones that appear in vxWorks archives are "1" and "2" + */ + +#define R_386_NONE 0 /* No reloc */ +#define R_386_32 1 /* Direct 32 bit */ +#define R_386_PC32 2 /* PC relative 32 bit */ +#define R_386_GOT32 3 /* 32 bit GOT entry */ +#define R_386_PLT32 4 /* 32 bit PLT address */ +#define R_386_COPY 5 /* Copy symbol at runtime */ +#define R_386_GLOB_DAT 6 /* Create GOT entry */ +#define R_386_JMP_SLOT 7 /* Create PLT entry */ +#define R_386_RELATIVE 8 /* Adjust by program base */ +#define R_386_GOTOFF 9 /* 32 bit offset to GOT */ +#define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */ + +/* These 16-bit and 8-bit relocs should never show up */ + +#define R_386_16 20 +#define R_386_PC16 21 +#define R_386_8 22 +#define R_386_PC8 23 +#define R_386_max 24 + +/* These are GNU extensions to enable C++ vtable garbage collection. */ + +#define R_386_GNU_VTINHERIT 250 +#define R_386_GNU_VTENTRY 251 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCelfI86h */ diff --git a/h/arch/simlinux/esfSimlinux.h b/h/arch/simlinux/esfSimlinux.h new file mode 100644 index 0000000..ce0e641 --- /dev/null +++ b/h/arch/simlinux/esfSimlinux.h @@ -0,0 +1,39 @@ +/* esfSimsparc.h - vxSim for Windows exception stack frame */ + +/* Copyright 1993-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,29apr98,cym derived from simsolaris +*/ + +#ifndef __INCesfSimnth +#define __INCesfSimnth + +#ifdef __cplusplus +extern "C" { +#endif + +#include "regs.h" +#include "excLib.h" + +#define ESF EXC_INFO + +/* Overflow/Underflow Stack Frame */ + +#define STACK_FRAME 0x00 /* Stack Frame */ +#define SF_LOCALS (STACK_FRAME + 0x00) /* Local Registers */ +#define SF_INS (STACK_FRAME + 0x20) /* In Registers */ +#define SF_SPARE (STACK_FRAME + 0x5C) /* Spare Slot */ +#define STACK_FRAME_SIZE 0x60 + + +#define INIT_STACK_FRAME STACK_ROUND_UP ((((MAX_TASK_ARGS - 6) \ + * sizeof (int)) + (STACK_FRAME_SIZE - 4))) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCesfSimnth */ diff --git a/h/arch/simlinux/excSimlinuxLib.h b/h/arch/simlinux/excSimlinuxLib.h new file mode 100644 index 0000000..4c6606e --- /dev/null +++ b/h/arch/simlinux/excSimlinuxLib.h @@ -0,0 +1,51 @@ +/* excSimlinuxLib.h - simlinux exception library header */ + +/* Copyright 1993-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,10mar04,dbt Fixed _WRS_IS_SUP_EXC() macro. +01d,09feb04,jmp added _WRS_IS_SUPV_EXC() macro. +01c,21oct03,jmp renamed some fields of EXC_INFO to share code with + simsolaris. +01b,17apr03,dbt Adapted for VxWorks 5.x +01a,05sep00,hbh derived from simsolaris + +jmp +*/ + +#ifndef __INCexcSimlinuxLibh +#define __INCexcSimlinuxLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* defines */ + +#define _WRS_IS_SUPV_EXC() VXSIM_SUP_MODE_GET(pRegs->reg_status) + +/* variable declarations */ + +extern FUNCPTR excExcepHook; /* add'l rtn to call when exceptions occur */ + +/* typedefs */ + +typedef struct + { + UINT32 valid; /* indicators that following fields are valid */ + UINT32 sig; /* signal number */ + UINT32 code; /* Signal code */ + UINT32 addr; /* Memory location which caused fault */ + UCHAR * pc; /* program counter */ + } EXC_INFO; + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCexcSimlinuxLibh */ diff --git a/h/arch/simlinux/fppSimlinuxLib.h b/h/arch/simlinux/fppSimlinuxLib.h new file mode 100644 index 0000000..e2a1e96 --- /dev/null +++ b/h/arch/simlinux/fppSimlinuxLib.h @@ -0,0 +1,117 @@ +/* fppLib.h - floating-point coprocessor support library header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,19aug03,dbt Added PAL support. +01d,17jun03,jmp code cleanup. +01c,27mar03,jmp rewrote from i86. +01b,03may02,jmp added fppDtoDx() & fppDxtoD(). +01a,29apr98,cym derived from i86 +*/ + +#ifndef __INCfppSimntLibh +#define __INCfppSimntLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* number of fp registers on coprocessor */ + +#define FP_NUM_REGS 8 /* number of FP registers */ + +/* FPREG_SET structure offsets */ + +#define FPREG_FPCR 0x00 /* offset to FPCR in FPREG_SET */ +#define FPREG_FPSR 0x04 /* offset to FPSR in FPREG_SET */ +#define FPREG_FPTAG 0x08 /* offset to FPTAG in FPREG_SET */ +#define FPREG_IP 0x0c /* offset to IP in FPREG_SET */ +#define FPREG_CS 0x10 /* offset to CS in FPREG_SET */ +#define FPREG_OP 0x12 /* offset to OP in FPREG_SET */ +#define FPREG_DP 0x14 /* offset to DP in FPREG_SET */ +#define FPREG_DS 0x18 /* offset to DS in FPREG_SET */ +#define FPREG_FPX(n) (0x1c + (n)*sizeof(DOUBLEX)) + +/* FPU Control Word register */ + +#define FPCR_PC_MASK 0xfffffcff /* Precision Control Field mask */ +#define FPCR_PC_DOUBLE 0x0200 /* Double precision */ + +#ifndef _ASMLANGUAGE + +/* DOUBLEX - double extended precision */ + +typedef struct + { + unsigned char f[10]; + } DOUBLEX; + +/* FP_CONTEXT - FP context used by fsave/frstor instruction */ + +typedef struct fpContext /* FP_CONTEXT */ + { + int fpcr; /* 4 control word (16 low bits) */ + int fpsr; /* 4 status word (16 low bits) */ + int fptag; /* 4 tag word (16 low bits) */ + int ip; /* 4 instruction pointer offset */ + short cs; /* 2 instruction pointer selector */ + short op; /* 2 last FP instruction op code */ + int dp; /* 4 operand pointer offset */ + int ds; /* 4 operand pointer selector */ + DOUBLEX fpx[FP_NUM_REGS]; /* 8*10 FR[0-7] non-TOS rel. order */ + } FP_CONTEXT; /* 108 bytes total */ + +#define FPREG_SET FP_CONTEXT + +/* variable declarations */ + +extern REG_INDEX fpRegName[]; /* f-point data register table */ +extern REG_INDEX fpCtlRegName[]; /* f-point control register table */ +extern FUNCPTR fppCreateHookRtn; /* arch dependent create hook routine */ +extern FUNCPTR fppDisplayHookRtn; /* arch dependent display routine */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void fppArchInit (void); +extern STATUS fppProbe (void); +extern void fppDtoDx (DOUBLEX * pDx, double * pDouble); +extern void fppDxtoD (double * pDouble, DOUBLEX * pDx); +extern void fppRegsToCtx (FPREG_SET * pFpRegSet, + FP_CONTEXT * pFpContext); +extern void fppCtxToRegs (FP_CONTEXT * pFpContext, + FPREG_SET * pFpRegSet); +extern FP_CONTEXT * fppCtxCreate (int tid); +extern STATUS fppCtxDelete (FP_CONTEXT * pCtx); +extern void fppCtxShow (FP_CONTEXT * pFpContext); +extern STATUS fppEnable (void); +extern STATUS fppDisable (void); + +#else + +extern void fppArchInit (); +extern void fppArchTaskCreateInit (); +extern STATUS fppProbe (); +extern void fppDtoDx (); +extern void fppDxtoD (); +extern void fppRegsToCtx (); +extern void fppCtxToRegs (); +extern FP_CONTEXT * fppCtxCreate (); +extern STATUS fppCtxDelete (); +extern void fppCtxShow (); +extern STATUS fppEnable (); +extern STATUS fppDisable (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfppSimntLibh */ diff --git a/h/arch/simlinux/in_cksum.h b/h/arch/simlinux/in_cksum.h new file mode 100644 index 0000000..25291a9 --- /dev/null +++ b/h/arch/simlinux/in_cksum.h @@ -0,0 +1,176 @@ +/* in_cksum.h - x86 version in_cksum header file */ + +/* Copyright 2001-2002 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from tahoe: in_cksum.c 1.2 86/01/05 + * from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91 + * from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp + * $FreeBSD: src/sys/i386/include/in_cksum.h,v 1.7.2.1 2000/05/05 13:37:00 jlemon Exp $ + */ + +/* +modification history +-------------------- +01f,25aug05,dlk Add section tags. +01e,24mar04,m_h INternet Checksum +01d,20nov03,niq Remove copyright_wrs.h file inclusion +01c,15nov03,rp updating header file path +01b,25jul02,rvr removed DCC specific code +01a,13sep01,hsh Created from BSD 4.3 +*/ + + +#ifndef _MACHINE_IN_CKSUM_H_ +#define _MACHINE_IN_CKSUM_H_ 1 + +#include + +/* + * in_cksum_hdr - checksum on header only + * + * It is useful to have an Internet checksum routine which is inlineable + * and optimized specifically for the task of computing IP header checksums + * in the normal case (where there are no options and the header length is + * therefore always exactly five 32-bit words. + */ + +static __inline +u_int in_cksum_hdr + ( + const struct ip *ip + ) + { + register u_int sum = 0; + int hlen = sizeof (struct ip); + register u_short *w = (u_short *) ip; + u_short remaining = 0; + + while (hlen > 1) + { + sum += *w++; + hlen -= 2; + } + + if (hlen == 1) + { + *(u_char *) (&remaining) = *(u_char *) w; + sum += remaining; + } + + sum = (sum & 0xffff) + (sum >> 16); + if (sum > 0xffff) + sum -= 0xffff; + + return ~sum & 0xffff; + } + +/* + * in_cksum_update + */ + +static __inline +void in_cksum_update + ( + struct ip *ip + ) + { + int __tmpsum; + __tmpsum = (int)ntohs(ip->ip_sum) + 256; + ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); + } + +/* + * in_pseudo - pre-checksum parts of pseudo-header + * + * Compute significant parts of the IPv4 checksum pseudo-header * for use in a + * delayed TCP/UDP checksum calculation. + * + * Args: + * + * src Source IP address + * dst Destination IP address + * lenproto htons(proto-hdr-len + proto-number) + */ + +static __inline +u_int16_t in_pseudo + ( + u_int32_t src, + u_int32_t dst, + u_int32_t lenproto + ) + { + u_int32_t sum; + + sum = lenproto + + (u_int16_t)(src >> 16) + + (u_int16_t)(src /*& 0xffff*/) + + (u_int16_t)(dst >> 16) + + (u_int16_t)(dst /*& 0xffff*/); + + sum = (u_int16_t)(sum >> 16) + (u_int16_t)(sum /*& 0xffff*/); + + if (sum > 0xffff) + sum -= 0xffff; + + return (sum); + } + +/* + * in_addword - Add two 16-bit workd + * + * Add the two 16-bit network-order values, carry, and return. + */ + +static __inline +u_int16_t in_addword + ( + u_int16_t a, + u_int16_t b + ) + { + u_int32_t sum = a + b; + + if (sum > 0xffff) + sum -= 0xffff; + + return (sum); + } + +_WRS_FASTTEXT +u_short in_cksum_skip(struct mbuf *m, int len, int skip); + +#endif /* _MACHINE_IN_CKSUM_H_ */ + diff --git a/h/arch/simlinux/instrI86.h b/h/arch/simlinux/instrI86.h new file mode 100644 index 0000000..8a264af --- /dev/null +++ b/h/arch/simlinux/instrI86.h @@ -0,0 +1,86 @@ +/* instrI86.h - header for I86 instruction fields */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,26apr04,jmp created from target/h/dbgI86Lib.h +*/ + +/* + * WARNING: This file is shared between i86 and VxSim/i86 arches, + * and between Kernel and User sides. + * Please make sure that any modifications to this file + * does not break other arches. + */ + +#ifndef __INCinstrI86h +#define __INCinstrI86h + +/* defines */ + +#define ADDI08_0 (0x83) +#define ADDI08_1 (0xc4) +#define ADDI32_0 (0x81) +#define ADDI32_1 (0xc4) +#define LEAD08_0 (0x8d) +#define LEAD08_1 (0x64) +#define LEAD08_2 (0x24) +#define LEAD32_0 (0x8d) +#define LEAD32_1 (0xa4) +#define LEAD32_2 (0x24) +#define JMPD08 (0xeb) +#define JMPD32 (0xe9) +#define ENTER (0xc8) +#define PUSH_EBX (0x53) +#define PUSH_EBP (0x55) +#define PUSH_ESI (0x56) +#define MOV_ESP0 (0x89) +#define MOV_ESP1 (0xe5) +#define MOV_ESP_ESI (0xe689) +#define LEAVE (0xc9) +#define RET (0xc3) +#define RETADD (0xc2) +#define CALL_DIR (0xe8) +#define CALL_INDIR0 (0xff) +#define CALL_INDIR1 (0x10) +#define CALL_INDIR_REG_EAX (0xd0) +#define CALL_INDIR_REG_ECX (0xd1) +#define CALL_INDIR_REG_EDX (0xd2) +#define CALL_INDIR_REG_EBX (0xd3) +#define MOV_ECX (0x0d8b) +#define MOV_EDX (0x158b) +#define MOV_EBP_ESP (0xe589) + +#define ADDI08_0_MASK (0xff) +#define ADDI08_1_MASK (0xff) +#define ADDI32_0_MASK (0xff) +#define ADDI32_1_MASK (0xff) +#define LEAD08_0_MASK (0xff) +#define LEAD08_1_MASK (0xff) +#define LEAD08_2_MASK (0xff) +#define LEAD32_0_MASK (0xff) +#define LEAD32_1_MASK (0xff) +#define LEAD32_2_MASK (0xff) +#define JMPD08_MASK (0xff) +#define JMPD32_MASK (0xff) +#define ENTER_MASK (0xff) +#define PUSH_EBX_MASK (0xff) +#define PUSH_EBP_MASK (0xff) +#define PUSH_ESI_MASK (0xff) +#define MOV_ESP0_MASK (0xff) +#define MOV_ESP1_MASK (0xff) +#define MOV_ESP_ESI_MASK (0xffff) +#define LEAVE_MASK (0xff) +#define RET_MASK (0xff) +#define RETADD_MASK (0xff) +#define CALL_DIR_MASK (0xff) +#define CALL_INDIR0_MASK (0xff) +#define CALL_INDIR1_MASK (0x38) +#define CALL_INDIR_REG_MASK (0xdf) +#define MOV_ECX_MASK (0xffff) +#define MOV_EDX_MASK (0xffff) +#define MOV_EBP_ESP_MASK (0xffff) + +#endif /* __INCinstrI86h */ diff --git a/h/arch/simlinux/ivSimlinux.h b/h/arch/simlinux/ivSimlinux.h new file mode 100644 index 0000000..9a9be87 --- /dev/null +++ b/h/arch/simlinux/ivSimlinux.h @@ -0,0 +1,53 @@ +/* ivSimlinux.h - simlinux interrupt vectors */ + +/* Copyright 1993-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,16sep03,jmp cleanup interrupt vector definitions. +01b,21may03,jmp moved IV_MAX from intArchLib.c. +01a,05sep00,hbh derived from simsolaris +*/ + +#ifndef __INCivSimlinuxh +#define __INCivSimlinuxh + +#ifdef __cplusplus +extern "C" { +#endif + +/* maximun number of interrupt vectors */ + +#define IV_MAX (256 + 32) /* 256 correspond to MAX_FD defined on host */ + /* side, see vxsimLib.h */ + +/* macros to convert interrupt vectors <-> interrupt numbers */ + +#define IVEC_TO_INUM(intVec) ((int) (intVec)) +#define INUM_TO_IVEC(intNum) ((VOIDFUNCPTR *) (intNum)) + +#define IVEC_TO_FD(intVec) (IVEC_TO_INUM(intVec) - 32) +#define FD_TO_IVEC(fd) (INUM_TO_IVEC((fd) + 32)) + +/* interrupt vector definitions */ + +#define IV_HUP 1 +#define IV_INT 2 +#define IV_ILL 4 +#define IV_TRAP 5 +#define IV_BUS 7 +#define IV_FPE 8 +#define IV_SEGV 11 +#define IV_CLOCK1 14 +#define IV_USR1 10 +#define IV_USR2 12 +#define IV_IO 29 +#define IV_CLOCK2 26 +#define IV_CLOCK3 27 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCivSimlinux */ diff --git a/h/arch/simlinux/mmuArchLib.h b/h/arch/simlinux/mmuArchLib.h new file mode 100644 index 0000000..669d635 --- /dev/null +++ b/h/arch/simlinux/mmuArchLib.h @@ -0,0 +1,289 @@ +/* mmuArchLib.h - mmu library header for VxSim */ + +/* Copyright 1999-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,19aug04,dbt Removed obsolote mmuArchCurrentSet() prototype. +01d,03dec03,jmp added mmuArchLibInit(). +01c,26nov03,jmp added mmuArchCurrentSet(). +01c,30dec03,kab Update for VIRT_ADDR type +01b,07oct03,jmp added MMU_STATE_VALID_NOT. + added MMU cache simulation. +01a,17jul03,jmp imported from VxWorksAE. +*/ + +#ifndef __INCmmuArchLibh +#define __INCmmuArchLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HOST +#include "host.h" +#else /* HOST */ +#include "vxWorks.h" +#endif /* HOST */ + +/* MMU Page Size */ + +#ifdef HOST +#ifndef WIN32 +#define MMU_PAGE_SIZE 0x2000 /* pages are 8 kbytes */ +#else /* !WIN32 */ +#define MMU_PAGE_SIZE 0x10000 /* pages are 64 kbytes */ +#endif /* WIN32 */ + +/* + * VxSim host code does not have access to VIRT_ADDR & PHYS_ADDR, so + * it is necessary to define them here. + */ + +#define VIRT_ADDR UINT32 +#define PHYS_ADDR UINT32 + +#else /* HOST */ +#if CPU != SIMNT +#define MMU_PAGE_SIZE 0x2000 /* pages are 8 kbytes */ +#else /* CPU != SIMNT */ +#define MMU_PAGE_SIZE 0x10000 /* pages are 64 kbytes */ +#endif /* CPU != SIMNT */ +#endif /* HOST */ + +/* + * Page Table Entry (PTE) description: + * + * ______Real Page Number (rpn)_______ ______Page State_______ + * / \ / \ + * _______________________________________________________________ + * | | | | | | | | | | | | | | | | | | | |U|S|R|W|X| | | | | | |C|V| + * --------------------------------------------------------------- + * | | | | | | | | | | | | | + * | | | | | | | | | | | | | + * 13 User ______/ | | | | | | | | | | | | + * 12 Supervisor __/ | | | | | | | | | | | + * 11 Read __________/ | | | | | | | | | | + * 10 Write ___________/ | | | | | | | | | + * 9 Execute ___________/ | | | | | | | | + * 8 Reserved ____________/ | | | | | | | + * 7 Reserved ______________/ | | | | | | + * 6 Reserved ________________/ | | | | | + * 5 Reserved __________________/ | | | | + * 4 Reserved ____________________/ | | | + * 3 Reserved ______________________/ | | + * 2 Cache __________________________/ | + * 1 Valid _____________________________/ + * + * NOTE: On SIMNT, only 16 bits of the rpn bitfield (19 bits) are used. + * This is due to the SIMNT MMU page size. + */ + +/* Bit patterns for various MMU states */ + +#define MMU_STATE_SHIFT 8 + +#define MMU_STATE_VALID 0x00000001 +#define MMU_STATE_VALID_NOT 0x00000000 +#define MMU_STATE_CACHEABLE 0x00000002 +#define MMU_STATE_CACHEABLE_NOT 0x00000000 +#define MMU_STATE_INVALID_STATE 0xffffffff +#define MMU_STATE_NO_ACCESS 0x00000000 + +#define MMU_STATE_SUP_RX (0x0d << MMU_STATE_SHIFT) +#define MMU_STATE_SUP_RWX (0x0f << MMU_STATE_SHIFT) +#define MMU_STATE_USR_SUP_RX (0x1d << MMU_STATE_SHIFT) +#define MMU_STATE_USR_RX_SUP_RWX (0x15 << MMU_STATE_SHIFT) +#define MMU_STATE_USR_SUP_RWX (0x1f << MMU_STATE_SHIFT) + + +/* Masks associated with the above bit patterns */ + +#define MMU_STATE_MASK_VALID 0x00000001 +#define MMU_STATE_MASK_CACHEABLE 0x00000002 +#define MMU_STATE_MASK_PROTECTION (0x1f << MMU_STATE_SHIFT) + +/* Number of L1 and L2 descriptors available in tables */ + +#if MMU_PAGE_SIZE == 0x10000 +#define MMU_NUM_L1_DESC 2048 +#define MMU_NUM_L2_DESC 32 +#else /* MMU_PAGE_SIZE == 0x10000 */ +#define MMU_NUM_L1_DESC 4096 +#define MMU_NUM_L2_DESC 128 +#endif /* MMU_PAGE_SIZE == 0x10000 */ + +/* + * Alignment to use to allocate L2 structure. This is necessary to know how + * much bits are necessary to get the base address of a L2 structure + * (l2ba field in MMU_LEVEL_2_DESC and MMU_LEVEL_1_DESC structures. + */ + +#define MMU_L2_ALLOC_ALIGNMENT 0x1000 + +/* Memory size described by a L1 descriptor */ + +#define MMU_L1_SIZE (MMU_NUM_L1_DESC * MMU_PAGE_SIZE) + +/* Define _BYTE_ORDER macro for host side */ + +#ifdef HOST +#if HOST_BYTE_ORDER == BIG_ENDIAN +#undef _BIG_ENDIAN +#define _BIG_ENDIAN BIG_ENDIAN +#undef _BYTE_ORDER +#define _BYTE_ORDER _BIG_ENDIAN +#else /* HOST_BYTE_ORDER == BIG_ENDIAN */ +#undef _BIG_ENDIAN +#define _LITTLE_ENDIAN LITTLE_ENDIAN +#undef _BYTE_ORDER +#define _BYTE_ORDER _LITTLE_ENDIAN +#endif /* HOST_BYTE_ORDER == BIG_ENDIAN */ +#endif /* HOST */ + +/* PTE structure */ + +typedef union /* PTE structure */ + { + struct /* bit field desciption */ + { +#if _BYTE_ORDER == _BIG_ENDIAN + UINT32 rpn :19; /* real page number */ + UINT32 access :5; /* Access attributes: USR, SUP, RWX */ + UINT32 reserved :6; /* Reserved for later use */ + UINT32 cache :1; /* Cache attribute */ + UINT32 v :1; /* page valid bit */ +#else /* _BYTE_ORDER == _BIG_ENDIAN */ + UINT32 v :1; /* page valid bit */ + UINT32 cache :1; /* Cache attribute */ + UINT32 reserved :6; /* Reserved for later use */ + UINT32 access :5; /* Access attributes: USR, SUP, RWX */ + UINT32 rpn :19; /* real page number */ +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + } field; + UINT32 bits; + } PTE; + +/* Effective (Virtual) address structure */ + +typedef union /* effective address structure */ + { + struct /* Bit field description */ + { +#if _BYTE_ORDER == _BIG_ENDIAN +#if MMU_PAGE_SIZE == 0x10000 + UINT32 l1index :11; /* Level 1 Index */ + UINT32 l2index :5; /* Level 2 Index */ + UINT32 po :16; /* Page Offset */ +#else /* MMU_PAGE_SIZE == 0x10000 */ + UINT32 l1index :12; /* Level 1 Index */ + UINT32 l2index :7; /* Level 2 Index */ + UINT32 po :13; /* Page Offset */ +#endif /* MMU_PAGE_SIZE == 0x10000 */ +#else /* _BYTE_ORDER == _BIG_ENDIAN */ +#if MMU_PAGE_SIZE == 0x10000 + UINT32 po :16; /* Page Offset */ + UINT32 l2index :5; /* Level 2 Index */ + UINT32 l1index :11; /* Level 1 Index */ +#else /* MMU_PAGE_SIZE == 0x10000 */ + UINT32 po :13; /* Page Offset */ + UINT32 l2index :7; /* Level 2 Index */ + UINT32 l1index :12; /* Level 1 Index */ +#endif /* MMU_PAGE_SIZE == 0x10000 */ +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + } field; + VIRT_ADDR effAddr; /* Note: Requires VIRT_ADDR == UINT32 */ + } EFFECTIVE_ADDR; + +/* Real (Physical) address structure */ + +typedef union /* real address structure */ + { + struct /* Bit field description */ + { +#if _BYTE_ORDER == _BIG_ENDIAN +#if MMU_PAGE_SIZE == 0x10000 + UINT32 rpn :16; /* Real Page Number */ + UINT32 po :16; /* Page Offset */ +#else /* MMU_PAGE_SIZE == 0x10000 */ + UINT32 rpn :19; /* Real Page Number */ + UINT32 po :13; /* Page Offset */ +#endif /* MMU_PAGE_SIZE == 0x10000 */ +#else /* _BYTE_ORDER == _BIG_ENDIAN */ +#if MMU_PAGE_SIZE == 0x10000 + UINT32 po :16; /* Page Offset */ + UINT32 rpn :16; /* Real Page Number */ +#else /* MMU_PAGE_SIZE == 0x10000 */ + UINT32 po :13; /* Page Offset */ + UINT32 rpn :19; /* Real Page Number */ +#endif /* MMU_PAGE_SIZE == 0x10000 */ +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + } field; + PHYS_ADDR realAddr; /* Note: Requires PHYS_ADDR == UINT32 */ + } REAL_ADDR; + +/* Level 2 Descriptor Table structure */ + +typedef union /* Level 2 descriptor table structure */ + { + struct /* Bit field description */ + { +#if _BYTE_ORDER == _BIG_ENDIAN + UINT32 l2ba :20; /* Level 2 table base address */ + UINT32 l2index :10; /* Level 2 table Index, note that this */ + /* value does not depend on the number */ + /* of L2 descriptors. The constraint is */ + /* that l2ba + l2index is 20 and l2ba */ + /* is dependent on the allocation */ + /* aligment of L2 desc table */ + UINT32 reserved :2; /* Reserved (must always be zero) */ +#else /* _BYTE_ORDER == _BIG_ENDIAN */ + UINT32 reserved :2; /* Reserved (must always be zero) */ + UINT32 l2index :10; /* Level 2 table Index */ + UINT32 l2ba :20; /* Level 2 table base address */ +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + } field; + PTE * pPte; + } MMU_LEVEL_2_DESC; + +/* Level 1 Descriptor Table structure */ + +typedef struct + { + UINT32 l2ba :20; /* Level 2 table Base Address */ + UINT32 v :1; /* segment valid bit */ + UINT32 pad :11; /* padding */ + } MMU_LEVEL_1_DESC; + +/* MMU translation table structure */ + +#define MMU_L1_MASK_SIZE 32 + +#if MMU_L1_MASK_SIZE == 8 +#define MMU_L1_MASK_TYPE UINT8 +#elif MMU_L1_MASK_SIZE == 16 +#define MMU_L1_MASK_TYPE UINT16 +#elif MMU_L1_MASK_SIZE == 32 +#define MMU_L1_MASK_TYPE UINT32 +#else +#error "Unsupported MMU_L1_MASK_SIZE value." +#endif + +typedef struct mmuTransTblStruct + { + MMU_LEVEL_1_DESC * pLvl1Tbl; /* Level1 descriptor table */ + UINT32 firstL1Ix; /* First L1 index used */ + UINT32 lastL1Ix; /* Last L1 index used */ + MMU_L1_MASK_TYPE l1Mask[MMU_NUM_L1_DESC/MMU_L1_MASK_SIZE]; + } MMU_TRANS_TBL; + +#ifndef HOST +extern STATUS mmuArchLibInit (UINT pageSize); +#endif /* HOST */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmmuArchLibh */ diff --git a/h/arch/simlinux/regsSimlinux.h b/h/arch/simlinux/regsSimlinux.h new file mode 100644 index 0000000..9610873 --- /dev/null +++ b/h/arch/simlinux/regsSimlinux.h @@ -0,0 +1,112 @@ +/* regsSimnt.h - simnt registers header */ + +/* Copyright 1995-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01l,31aug04,jmp made SIMLINUX REG_SET indentical to SIMNT. +01k,01dec03,jmp added mmuTransTbl (current MMU translation table) to REG_SET. +01j,24nov03,jeg added macros to manage supervisor bit +01i,14nov03,jmp added SIM_STATUS_USR. +01h,18sep03,jeg removed SIM_STATUS_INIT macro. +01g,12sep03,jeg updated REG_SET structure to split intLockKey by a status bit + field. Removed the WIND_TCB_* macros. +01f,27may03,jmp added Register offsets in TCB. +01e,26mar03,jmp replaced INSTR by UCHAR to use this file from host side. +01d,17mar03,jmp renamed macros REG_* in REG_SET_*. +01c,16jan03,elp added REGS defines (SPR #84278). +01b,29apr98,cym added intLockKey +01a,27aug97,cym written +*/ + +#ifndef __INCregsSimnth +#define __INCregsSimnth + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#define GREG_NUM 8 + +typedef struct /* REG_SET - simnt register set (based on x86) */ + { + ULONG edi; /* general register */ + ULONG esi; /* general register */ + ULONG ebp; /* general register */ + ULONG esp; /* general register */ + ULONG ebx; /* general register */ + ULONG edx; /* general register */ + ULONG ecx; /* frame pointer register */ + ULONG eax; /* stack pointer register */ + ULONG eflags; /* status register */ + UCHAR * pc; /* program counter */ + ULONG reg_status; /* status bit field */ + UINT32 mmuTransTbl; /* current MMU translation table */ + char unused[0xc8]; /* unused - keep for SIMNT backward */ + /* compatibility with T2.x releases */ + } REG_SET; + +#undef pc +#undef spReg +#define spReg esp +#define fpReg ebp +#define reg_pc pc +#define reg_sp spReg +#define reg_fp fpReg + +#define G_REG_BASE 0x00 +#define G_REG_OFFSET(n) (G_REG_BASE + (n) * sizeof(ULONG)) +#define SR_OFFSET G_REG_OFFSET(GREG_NUM) +#define PC_OFFSET (SR_OFFSET + sizeof(ULONG)) +#endif /* _ASMLANGUAGE */ + +/* Register offsets */ + +#define REG_SET_EDI 0x00 +#define REG_SET_ESI 0x04 +#define REG_SET_EBP 0x08 +#define REG_SET_ESP 0x0c +#define REG_SET_EBX 0x10 +#define REG_SET_EDX 0x14 +#define REG_SET_ECX 0x18 +#define REG_SET_EAX 0x1c +#define REG_SET_EFLAGS 0x20 +#define REG_SET_PC 0x24 +#define REG_SET_SIMSTATUS 0x28 +#define REG_SET_MMU_TRANS_TBL 0x2c + +/* status bit fields */ + +#define SIM_STATUS_INTLOCK 0x0001 /* interrupt locked */ +#define SIM_STATUS_INTUNLOCK 0x0000 /* interrupt unlocked */ +#define SIM_STATUS_SUP 0x0002 /* supervisor mode */ +#define SIM_STATUS_USR 0x0000 /* user mode */ + +/* macros to access interrupt status field */ + +#define VXSIM_INT_MASK_SET(vxsimStatus) \ + (vxsimStatus |= SIM_STATUS_INTLOCK) + +#define VXSIM_INT_MASK_CLEAR(vxsimStatus) \ + (vxsimStatus &= ~(SIM_STATUS_INTLOCK)) + +#define VXSIM_INT_MASK_GET(vxsimStatus) \ + (((vxsimStatus & SIM_STATUS_INTLOCK) == 0) ? FALSE : TRUE) + +#define VXSIM_SUP_MODE_SET(vxsimStatus) \ + (vxsimStatus |= SIM_STATUS_SUP) + +#define VXSIM_USR_MODE_SET(vxsimStatus) \ + (vxsimStatus &= ~(SIM_STATUS_SUP)) + +#define VXSIM_SUP_MODE_GET(vxsimStatus) \ + (((vxsimStatus & SIM_STATUS_SUP) == 0) ? FALSE : TRUE) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCregsSimnth */ diff --git a/h/arch/simlinux/syscallArgsx86.h b/h/arch/simlinux/syscallArgsx86.h new file mode 100644 index 0000000..ebbdcf9 --- /dev/null +++ b/h/arch/simlinux/syscallArgsx86.h @@ -0,0 +1,755 @@ +/* Aligned for x86 - no alignment needed */ + + +/* THIS FILE IS AUTO_GENERATED. PLEASE DO NOT EDIT. */ + +#ifndef _ASMLANGUAGE + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct _exitScArgs + { + int status; + }; + +struct creatScArgs + { + const char * name; + mode_t flag; + }; + +struct _openScArgs + { + const char * name; + int flags; + int mode; + }; + +struct closeScArgs + { + int fd; + }; + +struct readScArgs + { + int fd; + void * buffer; + size_t maxbytes; + }; + +struct writeScArgs + { + int fd; + const void * buffer; + size_t nbytes; + }; + +struct _ioctlScArgs + { + int fd; + int function; + int arg; + }; + +struct dupScArgs + { + int fd; + }; + +struct dup2ScArgs + { + int fd; + int fd2; + }; + +struct pipeScArgs + { + int filedes[2]; + }; + +struct removeScArgs + { + const char * name; + }; + +struct selectScArgs + { + int width; + fd_set * readFds; + fd_set * writeFds; + fd_set * excFds; + struct timeval * timeout; + }; + +struct socketScArgs + { + int domain; + int type; + int protocol; + }; + +struct bindScArgs + { + int s; + struct sockaddr * name; + int namelen; + }; + +struct listenScArgs + { + int s; + int backlog; + }; + +struct acceptScArgs + { + int s; + struct sockaddr * addr; + int *addrlen; + }; + +struct connectScArgs + { + int s; + struct sockaddr * name; + int namelen; + }; + +struct sendtoScArgs + { + int s; + caddr_t buf; + int bufLen; + int flags; + struct sockaddr * to; + int tolen; + }; + +struct sendScArgs + { + int s; + const char * buf; + int bufLen; + int flags; + }; + +struct sendmsgScArgs + { + int s; + struct msghdr * mp; + int flags; + }; + +struct recvfromScArgs + { + int s; + char * buf; + int bufLen; + int flags; + struct sockaddr *from; + int * pFromLen; + }; + +struct recvScArgs + { + int s; + char * buf; + int bufLen; + int flags; + }; + +struct recvmsgScArgs + { + int s; + struct msghdr * mp; + int flags; + }; + +struct setsockoptScArgs + { + int s; + int level; + int optname; + char * optval; + int optlen; + }; + +struct getsockoptScArgs + { + int s; + int level; + int optname; + char * optval; + int * optlen; + }; + +struct getsocknameScArgs + { + int s; + struct sockaddr *name; + int * namelen; + }; + +struct getpeernameScArgs + { + int s; + struct sockaddr *name; + int *namelen; + }; + +struct shutdownScArgs + { + int s; + int how; + }; + +struct mmapScArgs + { + void * addr; + size_t len; + int prot; + int flags; + int fildes; + off_t64 off; + }; + +struct munmapScArgs + { + void * addr; + size_t len; + }; + +struct mprotectScArgs + { + void * addr; + size_t len; + int prot; + }; + +struct killScArgs + { + OBJ_HANDLE rtpId; + int signo; + }; + +struct sigpendingScArgs + { + sigset_t * pSet; + }; + +struct sigprocmaskScArgs + { + int how; + const sigset_t * pSet; + sigset_t * pOset; + }; + +struct _sigqueueScArgs + { + OBJ_HANDLE rtpId; + int signo; + const union sigval * pValue; + int sigCode; + }; + +struct sigsuspendScArgs + { + const sigset_t * pSet; + }; + +struct sigtimedwaitScArgs + { + const sigset_t * pSet; + struct siginfo * pInfo; + const struct timespec * pTime; + }; + +struct _sigactionScArgs + { + int signo; + const struct sigaction * pAct; + struct sigaction * pOact; + void * retAddr; + }; + +struct chdirScArgs + { + const char * name; + }; + +struct _getcwdScArgs + { + char * buffer; + int length; + }; + +struct waitpidScArgs + { + OBJ_HANDLE childRtpId; + int * pStatus; + int options; + }; + +struct sysctlScArgs + { + int *pName; + u_int nameLen; + void * pOld; + size_t * pOldLen; + void * pNew; + size_t newLen; + }; + +struct _schedPxInfoGetScArgs + { + BOOL * pTimeSlicingOn; + ULONG * pTimeSlicePeriod; + }; + +struct sigaltstackScArgs + { + stack_t * ss; + stack_t * oss; + }; + +struct unlinkScArgs + { + const char * name; + }; + +struct linkScArgs + { + const char * name; + const char * newname; + }; + +struct fsyncScArgs + { + int fd; + }; + +struct fdatasyncScArgs + { + int fd; + }; + +struct renameScArgs + { + const char * oldname; + const char * newname; + }; + +struct fpathconfScArgs + { + int fd; + int name; + }; + +struct pathconfScArgs + { + const char * path; + int name; + }; + +struct accessScArgs + { + const char * path; + int amode; + }; + +struct chmodScArgs + { + const char * path; + mode_t mode; + }; + +struct eventReceiveScArgs + { + UINT32 events; + UINT32 options; + int timeout; + UINT32 * pEvtsReceived; + }; + +struct eventSendScArgs + { + int taskId; + UINT32 events; + }; + +struct eventCtlScArgs + { + OBJ_HANDLE handle; + VX_EVT_CTL_CMD command; + void * pArg; + UINT * pArgSize; + }; + +struct msgQSendScArgs + { + OBJ_HANDLE handle; + char * buffer; + UINT nBytes; + int timeout; + int priority; + }; + +struct msgQReceiveScArgs + { + OBJ_HANDLE handle; + char * buffer; + UINT maxNBytes; + int timeout; + }; + +struct _msgQOpenScArgs + { + const char * name; + UINT maxMsgs; + UINT maxMsgLength; + int options; + int mode; + void * context; + }; + +struct objDeleteScArgs + { + OBJ_HANDLE handle; + int options; + }; + +struct objInfoGetScArgs + { + OBJ_HANDLE handle; + void * pInfo; + UINT * pInfoSize; + int level; + }; + +struct _semTakeScArgs + { + OBJ_HANDLE handle; + int timeout; + }; + +struct _semGiveScArgs + { + OBJ_HANDLE handle; + }; + +struct _semOpenScArgs + { + const char * name; + SEM_TYPE type; + int initState; + int options; + int mode; + void * context; + }; + +struct semCtlScArgs + { + OBJ_HANDLE handle; + VX_SEM_CTL_CMD command; + void * pArg; + UINT * pArgSize; + }; + +struct _taskOpenScArgs + { + struct vx_task_open_sc_args * pArgs; + }; + +struct taskCtlScArgs + { + int tid; + VX_TASK_CTL_CMD command; + void * pArg; + UINT * pArgSize; + }; + +struct taskDelayScArgs + { + int ticks; + }; + +struct rtpSpawnScArgs + { + const char * rtpFileName; + const char ** argv; + const char ** envp; + int priority; + int uStackSize; + int options; + int taskOptions; + }; + +struct rtpInfoGetScArgs + { + OBJ_HANDLE rtpId; + RTP_DESC * rtpStruct; + }; + +struct taskKillScArgs + { + OBJ_HANDLE taskHandle; + int signo; + }; + +struct _taskSigqueueScArgs + { + OBJ_HANDLE taskHandle; + int signo; + const union sigval * pValue; + int sigCode; + }; + +struct _timer_openScArgs + { + const char * name; + int mode; + clockid_t clockId; + struct sigevent * evp; + void * context; + }; + +struct timerCtlScArgs + { + TIMER_CTL_CMD cmdCode; + int handle; + void * pArgs; + UINT * pArgSize; + }; + +struct pxOpenScArgs + { + PX_OBJ_TYPE type; + const char * name; + int objOpenMode; + void * attr; + }; + +struct pxCloseScArgs + { + OBJ_HANDLE handle; + }; + +struct pxUnlinkScArgs + { + PX_OBJ_TYPE type; + const char * name; + }; + +struct pxCtlScArgs + { + OBJ_HANDLE handle; + PX_CTL_CMD_CODE cmdCode; + void * pArgs; + UINT * pArgSize; + }; + +struct pxMqReceiveScArgs + { + OBJ_HANDLE handle; + char * pMsg; + size_t msgLen; + unsigned int * pMsgPrio; + PX_WAIT_OPTION waitOption; + struct timespec * time_out; + }; + +struct pxMqSendScArgs + { + OBJ_HANDLE handle; + const char * pMsg; + size_t msgLen; + unsigned int msgPrio; + PX_WAIT_OPTION waitOption; + struct timespec * time_out; + }; + +struct pxSemWaitScArgs + { + OBJ_HANDLE handle; + PX_WAIT_OPTION waitOption; + struct timespec * time_out; + }; + +struct pxSemPostScArgs + { + OBJ_HANDLE handle; + }; + +struct pipeDevCreateScArgs + { + const char * name; + int nMessages; + int nBytes; + }; + +struct pipeDevDeleteScArgs + { + const char * name; + BOOL force; + }; + +struct _sdCreateScArgs + { + char * name; + int options; + UINT32 size; + off_t64 physAddress; + MMU_ATTR attr; + void ** pVirtAddress; + }; + +struct _sdOpenScArgs + { + char * name; + int options; + int mode; + UINT32 size; + off_t64 physAddress; + MMU_ATTR attr; + void ** pVirtAddress; + }; + +struct sdDeleteScArgs + { + OBJ_HANDLE handle; + int options; + }; + +struct sdMapScArgs + { + OBJ_HANDLE handle; + MMU_ATTR attr; + int options; + }; + +struct sdUnmapScArgs + { + OBJ_HANDLE handle; + int options; + }; + +struct sdProtectScArgs + { + OBJ_HANDLE handle; + MMU_ATTR attr; + }; + +struct _edrErrorInjectScArgs + { + int kind; + const char *fileName; + int lineNumber; + REG_SET *regset; + void *addr; + const char *msg; + }; + +struct resSearchNScArgs + { + const char * name; + struct res_target * target; + }; + +struct wvEventScArgs + { + int eventId; + const char * pData; + unsigned int dataSize; + }; + +struct rtpVarAddScArgs + { + void ** pVar; + void * value; + }; + +struct sdInfoGetScArgs + { + OBJ_HANDLE handle; + SD_DESC * pSdStruct; + }; + +struct _shlOpenScArgs + { + const char * name; + int options; + }; + +struct _shlUnlockScArgs + { + SHL_ID shlId; + }; + +struct _shlCloseScArgs + { + SHL_ID shlId; + }; + +struct _shlGetScArgs + { + SHL_ID shlId; + SHLINFO *pInfo; + }; + +struct _shlPutScArgs + { + SHL_ID shlId; + const SHLINFO *pInfo; + }; + +struct objUnlinkScArgs + { + const char * name; + enum windObjClassType classType; + }; + +struct getprlimitScArgs + { + int idtype; + OBJ_HANDLE handle; + int resource; + struct rlimit *rlp; + }; + +struct setprlimitScArgs + { + int idtype; + OBJ_HANDLE handle; + int resource; + struct rlimit *rlp; + }; + +struct _mctlScArgs + { + void * addr; + size_t len; + int function; + int arg; + }; + +#endif /* _ASMLANGUAGE */ diff --git a/h/arch/simlinux/syscallSimlinux.h b/h/arch/simlinux/syscallSimlinux.h new file mode 100644 index 0000000..d004043 --- /dev/null +++ b/h/arch/simlinux/syscallSimlinux.h @@ -0,0 +1,71 @@ +/* syscallVxSim.h - VxSim specific System Call Infrastructure header */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,10feb04,jeg added _func_syscallTrapHandle to fixe dependency issue + introduced into wdbDbgSysCallCheck() API. +01c,09feb04,jeg added syscallTrapHandle () prototype. +01b,12dec03,jeg added frame pointer and program counter in + SYSCALL_ENTRY_STATE structure +01a,05nov03,jmp written. +*/ + +/* +DESCRIPTION +This header contains VxSim-specific definitions and constants used by +the System Call Infrastructure library. + +*/ + +#ifndef __INCsyscallVxSimh +#define __INCsyscallVxSimh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define syscallDispatch_PORTABLE /* Use the portable dispatcher */ + +#define SYSCALL_ENTRY_FRAME_SIZE 52 +#define _SYSCALL_USER_SP_CHECK(sp) /* XXX To implement */ + +/* typedefs */ + +#ifndef _ASMLANGUAGE + /* + * The SYSCALL_ENTRY_STATE structure defines the saved machine state + * when the system call trap is taken. This information is architecture + * specific, and is used by the system call dispatcher to restart system + * calls that have been interrupted by the occurance of signals. + * System call restart is achieved by restoring the saved state at the + * time of the system call trap, and re-issuing the system call. + * Arguments to the system call are saved on the kernel stack, and + * the address of that array is passed as an argument to the dispatcher. + * The layout of this structure must exactly match the ordering of members + * of the system call entry frame in src/arch/sim/syscallALib.s. + */ + +typedef struct syscall_entry_state + { + int args[8]; /* argument list (user stack) */ + int scn; /* System Call Number (SCN) in eax */ + int * pUStack; /* user-mode stack pointer */ + int statusReg; /* saved Status Register */ + int * efp; /* saved frame Register */ + void * pc; /* Trap return address */ + } SYSCALL_ENTRY_STATE; + +extern FUNCPTR _func_syscallTrapHandle; + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsyscallVxSimh */ diff --git a/h/arch/simlinux/vxSimlinuxLib.h b/h/arch/simlinux/vxSimlinuxLib.h new file mode 100644 index 0000000..f3dc51a --- /dev/null +++ b/h/arch/simlinux/vxSimlinuxLib.h @@ -0,0 +1,29 @@ +/* vxSimntLib.h - header for board dependent routines for Windows VxSim */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,01dec03,dbt Fixed vxPowerDown prototype. +01a,01apr03,jmp written. +*/ + +#ifndef __INCvxSimntLibh +#define __INCvxSimntLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +IMPORT void vxPowerDown (void); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvxSimntLibh */ diff --git a/h/arch/simlinux/vxsimHostArchLib.h b/h/arch/simlinux/vxsimHostArchLib.h new file mode 100644 index 0000000..f3fcc64 --- /dev/null +++ b/h/arch/simlinux/vxsimHostArchLib.h @@ -0,0 +1,63 @@ +/* vxsimHostArchLib.h - simulator UNIX/VxSim public interface header */ + +/* Copyright 2003-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01n,11jan05,jmp moved vxsimHostWdbPipeInit() to common vxsimHostLib.h. +01m,09mar04,jmp renamed vxsimHostFdInit() to vxsimHostTtyInit(). +01l,13oct03,jeg moved vxsimHostOpendir () prototype to vxsimHostLib.h. +01k,25aug03,jeg added vxsimHostGetgid () prototype +01j,05aug03,jeg moved vxsimHostShMemInit () prototype to vxsimHostLib.h. +01i,16jun03,dbt Removed vxsimHostStat() & vxsimHostFstatSize(). +01h,20may03,jmp moved vxsimHostModel() to vxsimHostLib.h. +01g,04apr03,dbt Added vxsimHostContextLoad() prototype. + Removed vxsimHostMakecontext() prototype. +01f,03apr03,jeg moved common routine definitions to target/h/vxsimHostLib.h +01e,01apr03,jeg Updated routines declaration +01d,20mar03,jeg added vxsimHostPrintf and vxsimHostProcAddrGet prototype. +01c,19mar03,dbt Removed some useless routines. + Modified vxsimHostIntLock()/vxsimHostIntUnlock() interfaces +01b,05mar03,jeg cleanup code. Removed unused routine declarations and Unix + type definitions. +01a,27jan03,jeg written, based on u_Lib.h +*/ + +/* +This header contains the prototype declarations for all UNIX and host routines +call made by VxSim. +*/ + +#ifndef __INCvxsimHostArchLibh +#define __INCvxsimHostArchLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types/vxCpu.h" /* Must come before regs.h */ +#include "passFsLib.h" /* Must come before regs.h */ +#include "regs.h" /* for REG_SET */ +#include "stat.h" /* for stat and statfs */ + +/* host side defined routines */ + +extern void vxsimHostTtyInit (int fd, int raw); +extern STATUS vxsimHostKill (int pid, int sig); +extern void vxsimHostContextLoad (REG_SET * pRegSet); +extern void * vxsimHostMalloc (int size); +extern STATUS vxsimHostSigdelset (int *set, int signo); +extern void * vxsimHostSignal (int signo, void * sigwhat); +extern STATUS vxsimHostSigprocmask (int how, int *set, int *oldset); +extern void vxsimHostTimerEnable (int clk, int ticksPerSecond); +extern void vxsimHostUserGet (char * hostname, char * hostip, + char * username, char * cwd); +extern void vxsimHostWdbDbgArchInit (void); +extern int vxsimHostGetgid (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvxsimHostArchLibh */ diff --git a/h/arch/simnt/archSimnt.h b/h/arch/simnt/archSimnt.h new file mode 100644 index 0000000..c558911 --- /dev/null +++ b/h/arch/simnt/archSimnt.h @@ -0,0 +1,119 @@ +/* archSimnt.h - i86 VxSim specific header */ + +/* + * Copyright 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +01x,12apr05,kk removed _WRS_OBJLIB_SUPPORT_VERIFY_TRAP macro (SPR# 106486) +01w,31mar05,elp added _ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK macro +01v,27aug04,dbt Added _WRS_OBJLIB_SUPPORT_VERIFY_TRAP. +01u,18may04,tam removed _WRS_KERNEL_TEXT_START_ADRS definition +01t,18may04,jmp fixed _WRS_FRAMEP_FROM_JMP_BUF macro. +01s,15may04,zl fixed _WRS_FRAMEP_FROM_JMP_BUF() +01r,14may04,jmp removed obsolete stuff. +01q,23mar04,jmp added support for portable trcLib. + added macros for getting frame and return PC from a jmp_buf. +01p,09feb04,aeg moved _WRS_PAL_COPROC_LIB to archSimntCommon.h +01o,04dec03,dbt Added support for DIAB compiler. +01n,02dec03,dbt Updated power management support. +01m,25nov03,pes Move definition of _BYTE_ORDER to archCommon.h. +01l,14nov03,job Moved blib stuff to archSimntCommon.h +01k,13nov03,pes Add include of common header +01j,23sep03,dbt Use new B6 scheduler. +01i,18aug03,dbt Added PAL support for VxSim. +01h,22jul03,kam removed define of WV_INSTRUMENTATION +01g,28may03,jmp removed X86_EXT structure. +01f,22apr03,dbt Added _WRS_ARCH_IS_SIMULATOR definition. +01e,27mar03,jmp added X86_EXT. no longer include ntcontext.h +01d,13mar01,sn SPR 73723 - define supported toolchains +01c,21sep01,jmp only include ntcontext.h if _ASMLANGUAGE not defined + (SPR# 34669). +01b,29jul98,ms added WV_INSTRUMENTATION +01a,03sep97,cym written +*/ + +#ifndef __INCarchSimnth +#define __INCarchSimnth + +#ifdef __cplusplus +extern "C" { +#endif + +/* Begin PAL */ + +#define _ALLOC_ALIGN_SIZE 8 /* 8-byte alignment */ +#define _STACK_ALIGN_SIZE 8 /* 8-byte alignment */ + +#define _DYNAMIC_BUS_SIZING FALSE /* no dynamic bus sizing */ + +#define _WRS_ARCH_IS_SIMULATOR /* This is a simulator */ + +#define _ARCH_SUPPORTS_GCC /* GCC compiler is supported on this arch. */ +#define _ARCH_SUPPORTS_DCC /* DCC compiler is supported on this arch. */ + +#if CPU!=SIMNT +/* Used in usrDepend.c and usrKernelStack.c */ + +#define _ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK +#endif + +/* moved here from h/private/javaLibP.h */ + +#define JAVA_C_SYM_PREFIX "" + +#ifndef _ASMLANGUAGE +/* macros for getting frame and return PC from a jmp_buf */ + +#define _WRS_FRAMEP_FROM_JMP_BUF(env) ((char *) (env)[0].reg.reg_fp) +#define _WRS_RET_PC_FROM_JMP_BUF(env) ((INSTR *) (env)[0].reg.reg_pc) +#endif /* _ASMLANGUAGE */ + +/* from loadElfLib.c */ + +#define _WRS_USE_ELF_LOAD_FORMAT + +/* from xdr_float.c */ + +#define FLOAT_NORM + +/* from qPriBMapLib.c */ + +#define qPriBMapLib_PORTABLE + +/* from ffsLib.c */ + +#define ffsLib_PORTABLE + +/* from schedLib.c */ + +#define _WRS_VXLIB_SUPPORT + +#define _WRS_BASE6_SCHEDULER +#define _WRS_ENABLE_IDLE_INTS + +/* from spyLib.c */ + +#define _WRS_SPY_TASK_SIZE 10000 + +/* End PAL */ + +#if (CPU==SIMLINUX) +#include "arch/simlinux/archSimlinuxCommon.h" +#elif (CPU==SIMNT) +#include "arch/simnt/archSimntCommon.h" +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCarchSimnth */ diff --git a/h/arch/simnt/archSimntCommon.h b/h/arch/simnt/archSimntCommon.h new file mode 100644 index 0000000..1d004a5 --- /dev/null +++ b/h/arch/simnt/archSimntCommon.h @@ -0,0 +1,68 @@ +/* archSimpentiumCommon.h - common PENTIUM VxSim architecture specific header */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,13may04,zl enabled user-mode trcLib +01g,22apr04,jmp added support for portable trcLib. +01f,23mar04,dbt Updated comments. +01e,09feb04,aeg added _WRS_PAL_COPROC_LIB +01d,25nov03,pes Move definition of _BYTE_ORDER to archCommon.h. +01c,17nov03,jmp added SYSCALL_TRAP_HANDLE_INIT. +01b,12nov03,job Moved some blib stuff from archSimnt.h +01a,11nov03,pes written. +*/ + +#ifndef __INCarchSimpentiumCommonh +#define __INCarchSimpentiumCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +/* from bLib.c */ + +#undef _WRS_BLIB_OPTIMIZED +#undef _WRS_SWAB_OPTIMIZED +#define swab_PORTABLE +#define _WRS_BLIB_ALIGNMENT 3 /* quad byte alignment mask */ + +/* + * SYSCALL_TRAP_HANDLE_INIT - system call trap magic number + * + * On VxSim, the system call infrastucture is based on a mechanism to directly + * call kernel services from RTP via the syscallTrapHandle() routine. + * Since the RTP does not have access to syscallTrapHandle() routine, each RTP + * contains a function pointer _func_syscallTrapHandle which is initialized to + * an invalid address: SYSCALL_TRAP_HANDLE_INIT. On the first system call + * performed by the RTP, an exception will be generated, the exception + * handling will invoke syscallTrapHandlerInit() if installed, and + * syscallTrapHandlerInit() will fix _func_syscallTrapHandle to point to + * syscallTrapHandle(). + */ + +#define SYSCALL_TRAP_HANDLE_INIT 0x1234 + +#define _BYTE_ORDER _LITTLE_ENDIAN + +/* Enable Coprocessor Abstraction */ + +#define _WRS_PAL_COPROC_LIB + +/* Enable Portable trcLib */ + +#define trcLib_PORTABLE +#define _WRS_TRC_ARGS_COUNT 5 /* number of arguments to print in */ + /* stack trace */ + +#ifndef _ASMLANGUAGE +typedef unsigned char INSTR; /* char instructions */ +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCarchSimpentiumCommonh */ diff --git a/h/arch/simnt/asmSimnt.h b/h/arch/simnt/asmSimnt.h new file mode 100644 index 0000000..a3be0ee --- /dev/null +++ b/h/arch/simnt/asmSimnt.h @@ -0,0 +1,120 @@ +/* asmI86.h - i80x86 assembler definitions header file */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,04may04,dbt Added ARG8-12 and SP_ARG8-12. +01g,17nov03,jb Adding additional ARG defines +01f,01nov01,hdn added ARG8 and SP_ARG8 +01e,01oct01,pad Turn off the underscore prepending to assembly routines. +01d,14aug01,hdn imported FUNC/FUNC_LABEL GTEXT/GDATA macros from T31 ver 01i +01c,28aug98,hdn added INT_CONNECT_CODE29 for intEnt(). +01b,07jun93,hdn added support for c++ +01a,28feb92,hdn written based on TRON, 68k version. +*/ + +#ifndef __INCasmI86h +#define __INCasmI86h + +/************************************************************/ + +/* + * The following definitions are used for symbol name compatibility. + * + * When #if 1, sources are assembled assuming the compiler + * you are using does not generate global symbols prefixed by "_". + * (e.g. elf/dwarf) + * + * When #if 0, sources are assembled assuming the compiler + * you are using generates global symbols prefixed by "_". + * (e.g. coff/stabs) + */ + +#if TRUE +#define FUNC(sym) sym +#define FUNC_LABEL(sym) sym: +#else +#define FUNC(sym) _##sym +#define FUNC_LABEL(sym) _##sym: +#endif + +#define VAR(sym) FUNC(sym) + +/* + * These macros are used to declare assembly language symbols that need + * to be typed properly(func or data) to be visible to the OMF tool. + * So that the build tool could mark them as an entry point to be linked + * by another PD. This is an elfism. Use #if 0 for a.out. + */ + +#if FALSE +#define GTEXT(sym) FUNC(sym) ; .type FUNC(sym),@function +#define GDATA(sym) FUNC(sym) ; .type FUNC(sym),@object +#else +#define GTEXT(sym) FUNC(sym) +#define GDATA(sym) FUNC(sym) +#endif + +/************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/* fp offsets to arguments */ + +#define ARG1 8 +#define ARG1W 10 +#define ARG2 12 +#define ARG2W 14 +#define ARG3 16 +#define ARG3W 18 +#define ARG4 20 +#define ARG5 24 +#define ARG6 28 +#define ARG7 32 +#define ARG8 36 +#define ARG9 40 +#define ARG10 44 +#define ARG11 48 +#define ARG12 52 + +#define DARG1 8 /* double arguments */ +#define DARG1L 12 +#define DARG2 16 +#define DARG2L 20 +#define DARG3 24 +#define DARG3L 28 +#define DARG4 32 +#define DARG4L 36 + +/* sp offsets to arguments */ + +#define SP_ARG0 0 +#define SP_ARG1 4 +#define SP_ARG1W 6 +#define SP_ARG2 8 +#define SP_ARG2W 10 +#define SP_ARG3 12 +#define SP_ARG3W 14 +#define SP_ARG4 16 +#define SP_ARG5 20 +#define SP_ARG6 24 +#define SP_ARG7 28 +#define SP_ARG8 32 +#define SP_ARG9 36 +#define SP_ARG10 40 +#define SP_ARG11 44 +#define SP_ARG12 48 + +/* offset to the IRQ number in the intConnectCode[] */ + +#define INT_CONNECT_CODE29 24 /* from the return address of intEnt() */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCasmI86h */ diff --git a/h/arch/simnt/coprocSimnt.h b/h/arch/simnt/coprocSimnt.h new file mode 100644 index 0000000..f67cce7 --- /dev/null +++ b/h/arch/simnt/coprocSimnt.h @@ -0,0 +1,32 @@ +/* coprocSimsolaris.h - coprocessor management library header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,19aug04,dbt Written +*/ + +#ifndef __INCcoprocSimsolarish +#define __INCcoprocSimsolarish + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "taskLib.h" + +/* defines */ + +#define VX_FP_TASK VX_COPROC1_TASK + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcoprocSimsolarish */ diff --git a/h/arch/simnt/dbgSimntLib.h b/h/arch/simnt/dbgSimntLib.h new file mode 100644 index 0000000..eb307d2 --- /dev/null +++ b/h/arch/simnt/dbgSimntLib.h @@ -0,0 +1,94 @@ +/* dbgSimntLib.h - header file for arch dependent portion of debugger */ + +/* Copyright 1998-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,18may04,jmp fixed instrI86.h reference. +01d,07apr04,jmp adapted to share trcArchLib between VxSim/i86 and i86 arches. +01c,11feb04,elg Add syscall instruction size macro. +01b,09feb04,jeg added DSM() macro definition +01a,29apr98,cym written based on x86 version. +*/ + +#ifndef __INCdbgSimntLibh +#define __INCdbgSimntLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#if (CPU==SIMNT) +#include "arch/simnt/instrI86.h" +#elif (CPU==SIMLINUX) +#include "arch/simlinux/instrI86.h" +#endif + +/* defines */ + +#define BRK_INST 0x1000 /* instruction hardware breakpoint */ +#define BRK_DATAW1 0x1400 /* data write 1 byte breakpoint */ +#define BRK_DATAW2 0x1500 /* data write 2 byte breakpoint */ +#define BRK_DATAW4 0x1700 /* data write 4 byte breakpoint */ +#define BRK_DATARW1 0x1c00 /* data read-write 1 byte breakpoint */ +#define BRK_DATARW2 0x1d00 /* data read-write 2 byte breakpoint */ +#define BRK_DATARW4 0x1f00 /* data read-write 4 byte breakpoint */ + +#define BRK_HARDWARE 0x1000 /* hardware breakpoint bit */ +#define BRK_HARDMASK 0x1f00 /* hardware breakpoint mask */ + +#define TRACE_FLAG (0x0100) /* TF in EFLAGS */ +#define INT_FLAG (0x0200) /* IF in EFLAGS */ + +#define DBG_INST_ALIGN (1) + +#ifndef _ASMLANGUAGE + +#define BREAK_INST 0xcc /* int 3 */ +#define DBG_BREAK_INST 0xcc /* int 3 */ +#define DBG_SYSCALL_SIZE 2 +#define BREAK_ESF EXC_INFO +#define TRACE_ESF EXC_INFO + +/* offsets to register fields in type REG_SET */ + +#define EDI (0) +#define ESI (1) +#define EBP (2) +#define ESP (3) +#define EBX (4) +#define EDX (5) +#define ECX (6) +#define EAX (7) +#define EFLAGS (8) + +#define _WRS_TRC_ARGS_COUNT 5 /* number of arguments to print in */ + /* stack trace */ + +/* macros */ + +#define DSM(addr,inst,mask) ((*(addr) & (mask)) == (inst)) + +/* hardware breakpoint registers */ + +typedef struct /* DBG_REGS */ + { + unsigned int db0; /* debug register 0 */ + unsigned int db1; /* debug register 1 */ + unsigned int db2; /* debug register 2 */ + unsigned int db3; /* debug register 3 */ + unsigned int db6; /* debug register 6 */ + unsigned int db7; /* debug register 7 */ + + } DBG_REGS; + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* INCdbgSimntLibh */ diff --git a/h/arch/simnt/dsmSimntLib.h b/h/arch/simnt/dsmSimntLib.h new file mode 100644 index 0000000..350d4de --- /dev/null +++ b/h/arch/simnt/dsmSimntLib.h @@ -0,0 +1,647 @@ +/* dsmI86Lib.h - i80x86 disassembler header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01k,16mar04,md Add output functions to dmsData() and dsmInst() +01j,01mar03,pai Made the FORMAT_X & FORMAT_Y opcode data pointers point to + constant data. Updated Copyright. +01i,16sep02,pai Updated support for SSE2 & Pentium 4 instructions. +01h,30aug01,hdn added SIMD, sysenter/exit support. +01g,06may98,fle added P5 and P6 instructions and facilities +01f,14nov94,hdn changed D->DISR, W->WFUL, S->SEXT, P->POP, A->AX, I->IMM. + +kdl minor cleanup. +01e,29may94,hdn removed I80486 conditional. +01d,31aug93,hdn changed a type of pD, from char to UCHAR. + changed a type of 1st parameter, from char to UCHAR. +01c,07jun93,hdn added support for c++ +01b,26mar93,hdn added new instructions for 486. +01a,23jun92,hdn written. +*/ + +#ifndef __INCdsmI86Libh +#define __INCdsmI86Libh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include "vwModNum.h" + + +/* dsmLib status codes */ + +#define S_dsmLib_UNKNOWN_INSTRUCTION (M_dsmLib | 1) + + +#define DSM_BUFSIZE16 (16) +#define DSM_BUFSIZE32 (32) + +typedef struct /* INST */ + { + const char * pOpc; /* Instruction Name */ + int type; /* instruction type */ + int flag; /* instruction flag */ + int flag2; /* instruction flag2 */ + UCHAR op0; /* opcode 0 */ + UCHAR op1; /* opcode 1 */ + UCHAR op2; /* opcode 2 */ + UCHAR op3; /* opcode 3 */ + UCHAR mask0; /* mask 0 */ + UCHAR mask1; /* mask 1 */ + UCHAR mask2; /* mask 2 */ + UCHAR mask3; /* mask 3 */ + + } INST; + +typedef struct /* FORMAT_X */ + { + const INST * pI; /* pointer to an INST descriptor */ + const char * pD; /* opcode data pointer */ + const char * pOpc; /* instruction name pointer */ + char obuf [DSM_BUFSIZE16]; /* instruction name buffer */ + char a32; /* address size 0,1 */ + char d32; /* data size 0,1 */ + char lenO; /* opcode length 1,2 */ + char lenD; /* displacement length 0,1,2,4 */ + char lenI; /* immediate length 0,1,2,4 */ + char modrm; /* MODRM 0,1 */ + char sib; /* SIB 0,1 */ + char w; /* W 0,1 */ + char d; /* D 0,1 */ + char s; /* S 0,1 */ + char reg; /* register 3 bits, 8 bits */ + char mod; /* value of MODRM byte bits 6,7 */ + char rm; /* value of MODRM byte bits 0,1,2 */ + char ss; + char index; + char base; + char mf; + char st; + char fd; + + } FORMAT_X; + +typedef struct /* FORMAT_Y */ + { + const char * pD; /* opcode data pointer */ + const char * pOpc; /* instruction name pointer */ + char * pOpr0; /* output string 0 */ + char * pOpr1; /* output string 1 */ + char * pOpr2; /* output string 2 */ + int len; /* instruction length */ + int addr; /* address operand */ + char obuf [DSM_BUFSIZE16]; /* opcode buffer */ + char rbuf [DSM_BUFSIZE16]; /* register buffer */ + char mbuf [DSM_BUFSIZE32]; /* memory buffer */ + char temp [DSM_BUFSIZE32]; /* temporary buffer */ + char ibuf [DSM_BUFSIZE16]; /* immediate buffer */ + char dbuf [DSM_BUFSIZE16]; /* displacement buffer */ + + } FORMAT_Y; + +/* bit definitions of flag */ + +/* jhw: MSB of flag byte is not included in switch statement used + * to format the output. + */ + +/* MODRM must be defined if REG, MMXREG, XMMREG are defined */ + +#define SF (0x10000000) +#define OP1 (0x20000000) +#define OP2 (0x40000000) +#define OP3 (0x80000000) +#define WFUL (0x01000000) /* operand size bit */ +#define SEXT (0x02000000) /* sign extend flag */ +#define DISR (0x04000000) /* data direction info encoded in opcode */ +#define TTT (0x08000000) /* hack to look for rotate instructions */ + +#define TTTN (0x00100000) /* opcode least significant byte + * bits 0-4 = condition test field */ +#define MF (0x00200000) /* opcode bits 1-2 are = register size info */ +#define POP (0x00400000) /* cat a "P" to end of instruction name */ + +#define IMM (0x00000001) +#define I8 (0x00000002) /* imm8 byte exists */ +#define DIS (0x00000004) /* displacement info */ +#define D8 (0x00000008) /* displacement info */ +#define D16 (0x00000010) /* displacement info */ +#define AX (0x00000020) /* store into AX register */ +#define CL (0x00000040) /* cat "CL" to end of operands */ +#define REG (0x00000080) /* modrm bits 3-5 = register specifier */ +#define SREG2 (0x00000100) /* modrm bits 3-4 = 2 bit segment register */ +#define SREG3 (0x00000200) /* modrm bits 3-5 = 3 bit segment register */ +#define MODRM (0x00000400) /* modrm byte exists */ +#define EEE (0x00000800) /* modrm bits 3-5 = control/debug register */ +#define REGRM (0x00001000) /* modrm bits 0-2 = register specifier */ +#define PORT (0x00002000) /* use a port as an operand */ +#define OFFSEL (0x00004000) /* jump or call offset */ +#define D16L8 (0x00008000) /* displacement info */ +#define FD (0x00010000) /* stack element is destination */ +#define ST (0x00020000) /* stack element is operand */ +#define MMXRM (0x00040000) /* modrm bits 0-2 = MMX register */ +#define MMXREG (0x00080000) /* modrm bits 3-5 = MMX register */ +#define GG (0x00800000) /* least sign opcode byte + * bits 0-1 = MMX granularity */ + +/* bit definitions of flag2 */ + +#define XMMRM (0x00000001) /* modrm bits 0-2 = XMM register */ +#define XMMREG (0x00000002) /* modrm bits 3-5 = XMM register */ + +#define ESC (0xd8) /* for co-processor instructions */ + +/* instruction types */ + +#define itAaa 1 +#define itAad 2 +#define itAam 3 +#define itAas 4 +#define itAddItoA 5 +#define itAddItoRM 6 +#define itAddRMtoRM 7 +#define itAndItoA 8 +#define itAndItoRM 9 +#define itAndRMtoRM 10 +#define itArpl 11 +#define itAsize 12 +#define itBound 13 +#define itBsf 14 +#define itBsr 15 +#define itBtI 16 +#define itBtR 17 +#define itBtcI 18 +#define itBtcR 19 +#define itBtrI 20 +#define itBtrR 21 +#define itBtsI 22 +#define itBtsR 23 +#define itCall 24 +#define itCallRM 25 +#define itCallSeg 26 +#define itCallSegRM 27 +#define itCbw 28 +#define itCjmp 29 +#define itClc 30 +#define itCld 31 +#define itCli 32 +#define itClts 33 +#define itCmc 34 +#define itCmpIwiA 35 +#define itCmpIwiRM 36 +#define itCmpRMwiRM 37 +#define itCmps 38 +#define itCs 39 +#define itCset 40 +#define itCwd 41 +#define itDaa 42 +#define itDas 43 +#define itDecR 44 +#define itDecRM 45 +#define itDiv 46 +#define itDs 47 +#define itEnter 48 +#define itEs 49 +#define itFs 50 +#define itGs 51 +#define itHlt 52 +#define itIdiv 53 +#define itImulAwiRM 54 +#define itImulRMwiI 55 +#define itImulRwiRM 56 +#define itInF 57 +#define itInV 58 +#define itIncR 59 +#define itIncRM 60 +#define itIns 61 +#define itInt 62 +#define itInt3 63 +#define itInto 64 +#define itIret 65 +#define itJcxz 66 +#define itJmpD 67 +#define itJmpRM 68 +#define itJmpS 69 +#define itJmpSeg 70 +#define itJmpSegRM 71 +#define itLahf 72 +#define itLar 73 +#define itLds 74 +#define itLea 75 +#define itLeave 76 +#define itLes 77 +#define itLfs 78 +#define itLgdt 79 +#define itLgs 80 +#define itLidt 81 +#define itLldt 82 +#define itLmsw 83 +#define itLock 84 +#define itLods 85 +#define itLoop 86 +#define itLoopnz 87 +#define itLoopz 88 +#define itLsl 89 +#define itLss 90 +#define itLtr 91 +#define itMovAMtoMA 92 +#define itMovC 93 +#define itMovD 94 +#define itMovItoR 95 +#define itMovItoRM 96 +#define itMovRMtoMR 97 +#define itMovRMtoS 98 +#define itMovRtoRM 99 +#define itMovStoRM 100 +#define itMovT 101 +#define itMovs 102 +#define itMovsx 103 +#define itMovzx 104 +#define itMulAwiRM 105 +#define itNeg 106 +#define itNop 107 +#define itNot 108 +#define itOrItoA 109 + +#define itOrItoRM 111 + +#define itOrRMtoRM 113 + +#define itOsize 115 +#define itOutF 116 +#define itOutV 117 +#define itOuts 118 +#define itPopR 119 +#define itPopRM 120 +#define itPopS 121 +#define itPopa 122 +#define itPopf 123 +#define itPushI 124 +#define itPushR 125 +#define itPushRM 126 +#define itPushS 127 +#define itPusha 128 +#define itPushf 129 +#define itRNcmps 130 +#define itRNscas 131 +#define itRcmps 132 +#define itRet 133 +#define itRetI 134 +#define itRetSeg 135 +#define itRetSegI 136 +#define itRins 137 +#define itRlods 138 +#define itRmovs 139 +#define itRolRMby1 140 +#define itRolRMbyCL 141 +#define itRolRMbyI 142 +#define itRouts 143 +#define itRscas 144 +#define itRstos 145 +#define itSahf 146 +#define itSbbIfrA 147 +#define itSbbIfrRM 148 +#define itSbbRMfrRM 149 +#define itScas 150 +#define itSgdt 151 +#define itShldRMbyCL 152 +#define itShldRMbyI 153 +#define itShrdRMbyCL 154 +#define itShrdRMbyI 155 +#define itSmsw 156 +#define itSs 157 +#define itStc 158 +#define itStd 159 +#define itSti 160 +#define itStos 161 +#define itStr 162 + +#define itSubIfrA 164 +#define itSubIfrRM 165 +#define itSubRMfrRM 166 +#define itTestIanA 167 +#define itTestIanRM 168 +#define itTestRManR 169 +#define itWait 170 +#define itXchgA 171 +#define itXchgRM 172 +#define itXlat 173 + +/* instructions for 387 */ + +#define itF2xm1 174 +#define itFabs 175 +#define itFaddIRM 176 +#define itFaddST 177 +#define itFchs 178 +#define itFclex 179 +#define itFcomIRM 180 +#define itFcomST 181 +#define itFcompIRM 182 +#define itFcompST 183 +#define itFcompp 184 +#define itFcos 185 +#define itFdecstp 186 +#define itFdivIRM 187 +#define itFdivST 188 +#define itFfree 189 +#define itFincstp 190 +#define itFinit 191 +#define itFld1 192 +#define itFldBCDM 193 +#define itFldERM 194 +#define itFldIRM 195 +#define itFldL2E 196 +#define itFldL2T 197 +#define itFldLG2 198 +#define itFldLIM 199 +#define itFldLN2 200 +#define itFldPI 201 +#define itFldST 202 +#define itFldZ 203 +#define itFldcw 204 +#define itFldenv 205 +#define itFmulIRM 206 +#define itFmulST 207 +#define itFnop 208 +#define itFpatan 209 +#define itFprem 210 +#define itFprem1 211 +#define itFptan 212 +#define itFrndint 213 +#define itFrstor 214 +#define itFsave 215 +#define itFscale 216 +#define itFsin 217 +#define itFsincos 218 +#define itFsqrt 219 +#define itFstIRM 220 +#define itFstST 221 +#define itFstcw 222 +#define itFstenv 223 +#define itFstpBCDM 224 +#define itFstpERM 225 +#define itFstpIRM 226 +#define itFstpLIM 227 +#define itFstpST 228 +#define itFstsw 229 +#define itFstswA 230 +#define itFsubIRM 231 +#define itFsubST 232 +#define itFtst 233 +#define itFucom 234 +#define itFucomp 235 +#define itFucompp 236 +#define itFxam 237 +#define itFxch 238 +#define itFxtract 239 +#define itFyl2x 240 +#define itFyl2xp1 241 +#define itFcmovb 242 +#define itFcmove 243 +#define itFcmovbe 244 +#define itFcmovu 245 +#define itFcmovnb 246 +#define itFcmovne 247 +#define itFcmovnbe 248 +#define itFcmovnu 249 +#define itFcomi 250 + + +/* addendum */ + +#define itSidt 300 +#define itSldt 301 +#define itVerr 302 +#define itVerw 303 +#define itXorItoRM 304 +#define itAdcItoRM 305 +#define itXorItoA 306 +#define itAdcItoA 307 +#define itXorRMtoRM 308 +#define itAdcRMtoRM 309 +#define itRep 310 +#define itRepNe 311 + +/* 80486 instructions */ + +#define itBswap 400 +#define itCmpxchg 401 +#define itXadd 402 +#define itInvd 403 +#define itWbinvd 404 +#define itInvlpg 405 + +/* P5 instructions */ + +#define itCmpxchg8b 500 +#define itCpuid 501 +#define itRdtsc 502 +#define itRdmsr 503 +#define itWrmsr 504 +#define itRsm 505 + +/* P6 instructions */ + +#define itCmovcc 600 +#define itRdpmc 601 +#define itUd2 602 +#define itSysenter 603 +#define itSysexit 604 + +/* MMX/SSE2 instructions */ + +#define itEmms 700 +#define itMovd 701 +#define itMovq 702 +#define itPackssdw 703 +#define itPacksswb 704 +#define itPackuswb 705 +#define itPadd 706 +#define itPadds 707 +#define itPaddus 708 +#define itPand 709 +#define itPandn 710 +#define itPcmpeq 711 +#define itPcmpgt 712 +#define itPmadd 713 +#define itPmulh 714 +#define itPmull 715 +#define itPor 716 +#define itPsll 717 +#define itPsra 718 +#define itPsrl 719 +#define itPsub 720 +#define itPsubs 721 +#define itPsubus 722 +#define itPunpckh 723 +#define itPunpckl 724 +#define itPxor 725 + +/* SSE/SSE2 instructions */ + +#define itAddpd 800 +#define itAddps 801 +#define itAddsd 802 +#define itAddss 803 +#define itAndnpd 804 +#define itAndnps 805 +#define itAndpd 806 +#define itAndps 807 + +#define itCmppd 821 +#define itCmpps 822 +#define itCmpsd 823 +#define itCmpss 824 + +#define itComiss 827 +#define itCvtdq2pd 828 +#define itCvtdq2ps 829 +#define itCvtpd2dq 830 +#define itCvtpd2ps 831 +#define itCvtpi2pd 832 +#define itCvtpi2ps 833 +#define itCvtps2dq 834 +#define itCvtps2pd 835 +#define itCvtps2pi 836 +#define itCvtsd2si 837 +#define itCvtsd2ss 838 +#define itCvtsi2sd 839 +#define itCvtsi2ss 840 +#define itCvtss2sd 841 +#define itCvtss2si 842 +#define itCvttpd2dq 843 +#define itCvttpd2pi 844 +#define itCvttps2dq 845 +#define itCvttps2pi 846 +#define itCvttsd2si 847 +#define itCvttss2si 848 +#define itDivpd 849 +#define itDivps 850 +#define itDivsd 851 +#define itDivss 852 +#define itFxrstor 853 +#define itFxsave 854 +#define itLdmxcsr 855 +#define itMaskmovdqu 856 +#define itMaskmovq 857 +#define itMaxpd 858 +#define itMaxps 859 +#define itMaxsd 860 +#define itMaxss 861 +#define itMinpd 862 +#define itMinps 863 +#define itMinsd 864 +#define itMinss 865 +#define itMovapd 866 +#define itMovaps 867 +#define itMovdq2q 868 +#define itMovdqa 869 +#define itMovdqu 870 +#define itMovhlps 871 +#define itMovhpd 872 +#define itMovhps 873 +#define itMovlhps 874 +#define itMovlpd 875 +#define itMovlps 876 +#define itMovmskpd 877 +#define itMovmskps 878 +#define itMovntdq 879 +#define itMovntpd 880 +#define itMovntps 881 +#define itMovntq 882 +#define itMovq2dq 883 +#define itMovsd 884 +#define itMovss 885 +#define itMovupd 886 +#define itMovups 887 +#define itMulpd 888 +#define itMulps 889 +#define itMulsd 890 +#define itMulss 891 +#define itOrpd 892 +#define itOrps 893 +#define itPavgb 894 +#define itPavgw 895 +#define itPextrw 896 +#define itPinsrw 897 +#define itPmaxsw 898 +#define itPmaxub 899 +#define itPminsw 900 +#define itPminub 901 +#define itPmovmskb 902 +#define itPmulhuw 903 +#define itPmuludq 904 +#define itPrefetchnta 905 +#define itPrefetcht0 906 +#define itPrefetcht1 907 +#define itPrefetcht2 908 +#define itPsadbw 909 +#define itPshufd 910 +#define itPshufhw 911 +#define itPshuflw 912 +#define itPshufw 913 +#define itPslldq 914 +#define itPsrldq 915 +#define itPunpckhqdq 916 +#define itPunpcklqdq 917 +#define itRcpps 918 +#define itRcpss 919 +#define itRsqrtps 920 +#define itRsqrtss 921 +#define itSfence 922 +#define itShufps 923 +#define itSqrtpd 924 +#define itSqrtps 925 +#define itSqrtsd 926 +#define itSqrtss 927 +#define itStmxcsr 928 +#define itSubpd 929 +#define itSubps 930 +#define itSubsd 931 +#define itSubss 932 +#define itUcomisd 933 +#define itUcomiss 934 +#define itUnpckhpd 935 +#define itUnpckhps 936 +#define itUnpcklpd 937 +#define itUnpcklps 938 +#define itXorpd 939 +#define itXorps 940 + +/* Pentium 4 instructions */ + +#define itClflush 1000 +#define itLfence 1001 +#define itMfence 1002 +#define itMovnti 1003 +#define itPause 1004 + + +/* function declarations */ + +#if defined (__STDC__) || defined (__cplusplus) + +IMPORT int dsmData (UCHAR *, int, FUNCPTR, int); +IMPORT int dsmInst (UCHAR *, int, VOIDFUNCPTR, FUNCPTR, int); +IMPORT int dsmNbytes (UCHAR *); + +#else + +IMPORT int dsmData (); +IMPORT int dsmInst (); +IMPORT int dsmNbytes (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdsmI86Libh */ diff --git a/h/arch/simnt/elfI86.h b/h/arch/simnt/elfI86.h new file mode 100644 index 0000000..d839657 --- /dev/null +++ b/h/arch/simnt/elfI86.h @@ -0,0 +1,65 @@ +/* elfI86.h - i86-specific ELF loader header */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software may be + * licensed only pursuant to the terms of an applicable Wind River license + * agreement. + */ + +/* +modification history +-------------------- +01c,25jul05,v_r Updated copyright. +01b,27feb04,pad Renamed relocation type R_386_JUMP_SLOT as R_386_JMP_SLOT as + per ABI. +01a,12sep01,pad Backported from TAE 3.1 to T2.2 with necessary adaptations + (base version: elfI86.h@@/main/tor3_x/1). +*/ + +#ifndef __INCelfI86h +#define __INCelfI86h + +#ifdef __cplusplus +extern "C" { +#endif + +#define EM_ARCH_MACHINE EM_386 +#define EM_ARCH_MACH_ALT EM_486 /* not used */ + +/* + * Relocation Type Definitions + * The only ones that appear in vxWorks archives are "1" and "2" + */ + +#define R_386_NONE 0 /* No reloc */ +#define R_386_32 1 /* Direct 32 bit */ +#define R_386_PC32 2 /* PC relative 32 bit */ +#define R_386_GOT32 3 /* 32 bit GOT entry */ +#define R_386_PLT32 4 /* 32 bit PLT address */ +#define R_386_COPY 5 /* Copy symbol at runtime */ +#define R_386_GLOB_DAT 6 /* Create GOT entry */ +#define R_386_JMP_SLOT 7 /* Create PLT entry */ +#define R_386_RELATIVE 8 /* Adjust by program base */ +#define R_386_GOTOFF 9 /* 32 bit offset to GOT */ +#define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */ + +/* These 16-bit and 8-bit relocs should never show up */ + +#define R_386_16 20 +#define R_386_PC16 21 +#define R_386_8 22 +#define R_386_PC8 23 +#define R_386_max 24 + +/* These are GNU extensions to enable C++ vtable garbage collection. */ + +#define R_386_GNU_VTINHERIT 250 +#define R_386_GNU_VTENTRY 251 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCelfI86h */ diff --git a/h/arch/simnt/esfSimnt.h b/h/arch/simnt/esfSimnt.h new file mode 100644 index 0000000..ce0e641 --- /dev/null +++ b/h/arch/simnt/esfSimnt.h @@ -0,0 +1,39 @@ +/* esfSimsparc.h - vxSim for Windows exception stack frame */ + +/* Copyright 1993-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,29apr98,cym derived from simsolaris +*/ + +#ifndef __INCesfSimnth +#define __INCesfSimnth + +#ifdef __cplusplus +extern "C" { +#endif + +#include "regs.h" +#include "excLib.h" + +#define ESF EXC_INFO + +/* Overflow/Underflow Stack Frame */ + +#define STACK_FRAME 0x00 /* Stack Frame */ +#define SF_LOCALS (STACK_FRAME + 0x00) /* Local Registers */ +#define SF_INS (STACK_FRAME + 0x20) /* In Registers */ +#define SF_SPARE (STACK_FRAME + 0x5C) /* Spare Slot */ +#define STACK_FRAME_SIZE 0x60 + + +#define INIT_STACK_FRAME STACK_ROUND_UP ((((MAX_TASK_ARGS - 6) \ + * sizeof (int)) + (STACK_FRAME_SIZE - 4))) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCesfSimnth */ diff --git a/h/arch/simnt/excSimntLib.h b/h/arch/simnt/excSimntLib.h new file mode 100644 index 0000000..cfa4407 --- /dev/null +++ b/h/arch/simnt/excSimntLib.h @@ -0,0 +1,100 @@ +/* excSimntLib.h - exception library header */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,10mar04,dbt Fixed _WRS_IS_SUP_EXC() macro. +01e,09feb04,jmp added _WRS_IS_SUPV_EXC() macro. +01d,21oct03,jmp replaced padding field of EXC_INFO by access type. +01c,28mar03,jmp added exception numbers. + replaced INSTR by UCHAR to use this file from host side. +01b,30may00,elp renamed errCode in accessAddr. +01a,29apr98,cym written based x86 version. +*/ + +#ifndef __INCexcSimntLibh +#define __INCexcSimntLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* typedefs */ + +typedef struct + { + UINT16 valid; /* indicators that following fields are valid */ + UINT16 vecNum; /* vector number */ + ULONG accessAddr; /* access address */ + UCHAR * pc; /* program counter */ + ULONG statusReg; /* status register */ + UINT16 csReg; /* code segment register */ + UINT16 accessType; /* type of access (read or write) */ + } EXC_INFO; + +/* defines */ + +#define _WRS_IS_SUPV_EXC() VXSIM_SUP_MODE_GET(pRegs->reg_status) + +#define LOW_VEC 0 /* lowest initialized vector */ +#define HIGH_VEC 0xff /* highest initialized vector */ + +/* exception info valid bits */ + +#define EXC_VEC_NUM 0x01 /* vector number valid */ +#define EXC_ACCESS_READ 0x02 /* accessAddr is valid (READ access) */ +#define EXC_ACCESS_WRITE 0x04 /* accessAddr is valid (WRITE access) */ +#define EXC_PC 0x08 /* pc valid */ +#define EXC_STATUS_REG 0x10 /* status register valid */ +#define EXC_CS_REG 0x20 /* code segment register valid */ +#define EXC_INVALID_TYPE 0x80 /* special indicator: ESF type was bad; + * type is in funcCode field */ + +/* exception numbers */ + +#define EXC_INT_DIVIDE_BY_ZERO 0 +#define EXC_SINGLE_STEP 1 +#define EXC_DATATYPE_MISALIGNMENT 2 +#define EXC_BREAKPOINT 3 +#define EXC_IN_PAGE_ERROR 4 +#define EXC_ILLEGAL_INSTRUCTION 5 +#define EXC_INVALID_DISPOSITION 6 +#define EXC_ARRAY_BOUNDS_EXCEEDED 7 +#define EXC_FLT_DENORMAL_OPERAND 8 +#define EXC_FLT_DIVIDE_BY_ZERO 9 +#define EXC_FLT_INEXACT_RESULT 10 +#define EXC_FLT_INVALID_OPERATION 11 +#define EXC_FLT_OVERFLOW 12 +#define EXC_ACCESS_VIOLATION 13 +#define EXC_FLT_STACK_CHECK 14 +#define EXC_FLT_UNDERFLOW 15 +#define EXC_INT_OVERFLOW 16 +#define EXC_PRIV_INSTRUCTION 17 +#define EXC_STACK_OVERFLOW 18 +#define EXC_UNKNOWN 19 + +/* variable declarations */ + +extern FUNCPTR excExcepHook; /* add'l rtn to call when exceptions occur */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void excStub (void); +extern void excIntStub (void); + +#else /* __STDC__ */ + +extern void excStub (); +extern void excIntStub (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCexcSimntLibh */ diff --git a/h/arch/simnt/fppSimntLib.h b/h/arch/simnt/fppSimntLib.h new file mode 100644 index 0000000..e2a1e96 --- /dev/null +++ b/h/arch/simnt/fppSimntLib.h @@ -0,0 +1,117 @@ +/* fppLib.h - floating-point coprocessor support library header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,19aug03,dbt Added PAL support. +01d,17jun03,jmp code cleanup. +01c,27mar03,jmp rewrote from i86. +01b,03may02,jmp added fppDtoDx() & fppDxtoD(). +01a,29apr98,cym derived from i86 +*/ + +#ifndef __INCfppSimntLibh +#define __INCfppSimntLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* number of fp registers on coprocessor */ + +#define FP_NUM_REGS 8 /* number of FP registers */ + +/* FPREG_SET structure offsets */ + +#define FPREG_FPCR 0x00 /* offset to FPCR in FPREG_SET */ +#define FPREG_FPSR 0x04 /* offset to FPSR in FPREG_SET */ +#define FPREG_FPTAG 0x08 /* offset to FPTAG in FPREG_SET */ +#define FPREG_IP 0x0c /* offset to IP in FPREG_SET */ +#define FPREG_CS 0x10 /* offset to CS in FPREG_SET */ +#define FPREG_OP 0x12 /* offset to OP in FPREG_SET */ +#define FPREG_DP 0x14 /* offset to DP in FPREG_SET */ +#define FPREG_DS 0x18 /* offset to DS in FPREG_SET */ +#define FPREG_FPX(n) (0x1c + (n)*sizeof(DOUBLEX)) + +/* FPU Control Word register */ + +#define FPCR_PC_MASK 0xfffffcff /* Precision Control Field mask */ +#define FPCR_PC_DOUBLE 0x0200 /* Double precision */ + +#ifndef _ASMLANGUAGE + +/* DOUBLEX - double extended precision */ + +typedef struct + { + unsigned char f[10]; + } DOUBLEX; + +/* FP_CONTEXT - FP context used by fsave/frstor instruction */ + +typedef struct fpContext /* FP_CONTEXT */ + { + int fpcr; /* 4 control word (16 low bits) */ + int fpsr; /* 4 status word (16 low bits) */ + int fptag; /* 4 tag word (16 low bits) */ + int ip; /* 4 instruction pointer offset */ + short cs; /* 2 instruction pointer selector */ + short op; /* 2 last FP instruction op code */ + int dp; /* 4 operand pointer offset */ + int ds; /* 4 operand pointer selector */ + DOUBLEX fpx[FP_NUM_REGS]; /* 8*10 FR[0-7] non-TOS rel. order */ + } FP_CONTEXT; /* 108 bytes total */ + +#define FPREG_SET FP_CONTEXT + +/* variable declarations */ + +extern REG_INDEX fpRegName[]; /* f-point data register table */ +extern REG_INDEX fpCtlRegName[]; /* f-point control register table */ +extern FUNCPTR fppCreateHookRtn; /* arch dependent create hook routine */ +extern FUNCPTR fppDisplayHookRtn; /* arch dependent display routine */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void fppArchInit (void); +extern STATUS fppProbe (void); +extern void fppDtoDx (DOUBLEX * pDx, double * pDouble); +extern void fppDxtoD (double * pDouble, DOUBLEX * pDx); +extern void fppRegsToCtx (FPREG_SET * pFpRegSet, + FP_CONTEXT * pFpContext); +extern void fppCtxToRegs (FP_CONTEXT * pFpContext, + FPREG_SET * pFpRegSet); +extern FP_CONTEXT * fppCtxCreate (int tid); +extern STATUS fppCtxDelete (FP_CONTEXT * pCtx); +extern void fppCtxShow (FP_CONTEXT * pFpContext); +extern STATUS fppEnable (void); +extern STATUS fppDisable (void); + +#else + +extern void fppArchInit (); +extern void fppArchTaskCreateInit (); +extern STATUS fppProbe (); +extern void fppDtoDx (); +extern void fppDxtoD (); +extern void fppRegsToCtx (); +extern void fppCtxToRegs (); +extern FP_CONTEXT * fppCtxCreate (); +extern STATUS fppCtxDelete (); +extern void fppCtxShow (); +extern STATUS fppEnable (); +extern STATUS fppDisable (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfppSimntLibh */ diff --git a/h/arch/simnt/in_cksum.h b/h/arch/simnt/in_cksum.h new file mode 100644 index 0000000..25291a9 --- /dev/null +++ b/h/arch/simnt/in_cksum.h @@ -0,0 +1,176 @@ +/* in_cksum.h - x86 version in_cksum header file */ + +/* Copyright 2001-2002 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from tahoe: in_cksum.c 1.2 86/01/05 + * from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91 + * from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp + * $FreeBSD: src/sys/i386/include/in_cksum.h,v 1.7.2.1 2000/05/05 13:37:00 jlemon Exp $ + */ + +/* +modification history +-------------------- +01f,25aug05,dlk Add section tags. +01e,24mar04,m_h INternet Checksum +01d,20nov03,niq Remove copyright_wrs.h file inclusion +01c,15nov03,rp updating header file path +01b,25jul02,rvr removed DCC specific code +01a,13sep01,hsh Created from BSD 4.3 +*/ + + +#ifndef _MACHINE_IN_CKSUM_H_ +#define _MACHINE_IN_CKSUM_H_ 1 + +#include + +/* + * in_cksum_hdr - checksum on header only + * + * It is useful to have an Internet checksum routine which is inlineable + * and optimized specifically for the task of computing IP header checksums + * in the normal case (where there are no options and the header length is + * therefore always exactly five 32-bit words. + */ + +static __inline +u_int in_cksum_hdr + ( + const struct ip *ip + ) + { + register u_int sum = 0; + int hlen = sizeof (struct ip); + register u_short *w = (u_short *) ip; + u_short remaining = 0; + + while (hlen > 1) + { + sum += *w++; + hlen -= 2; + } + + if (hlen == 1) + { + *(u_char *) (&remaining) = *(u_char *) w; + sum += remaining; + } + + sum = (sum & 0xffff) + (sum >> 16); + if (sum > 0xffff) + sum -= 0xffff; + + return ~sum & 0xffff; + } + +/* + * in_cksum_update + */ + +static __inline +void in_cksum_update + ( + struct ip *ip + ) + { + int __tmpsum; + __tmpsum = (int)ntohs(ip->ip_sum) + 256; + ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); + } + +/* + * in_pseudo - pre-checksum parts of pseudo-header + * + * Compute significant parts of the IPv4 checksum pseudo-header * for use in a + * delayed TCP/UDP checksum calculation. + * + * Args: + * + * src Source IP address + * dst Destination IP address + * lenproto htons(proto-hdr-len + proto-number) + */ + +static __inline +u_int16_t in_pseudo + ( + u_int32_t src, + u_int32_t dst, + u_int32_t lenproto + ) + { + u_int32_t sum; + + sum = lenproto + + (u_int16_t)(src >> 16) + + (u_int16_t)(src /*& 0xffff*/) + + (u_int16_t)(dst >> 16) + + (u_int16_t)(dst /*& 0xffff*/); + + sum = (u_int16_t)(sum >> 16) + (u_int16_t)(sum /*& 0xffff*/); + + if (sum > 0xffff) + sum -= 0xffff; + + return (sum); + } + +/* + * in_addword - Add two 16-bit workd + * + * Add the two 16-bit network-order values, carry, and return. + */ + +static __inline +u_int16_t in_addword + ( + u_int16_t a, + u_int16_t b + ) + { + u_int32_t sum = a + b; + + if (sum > 0xffff) + sum -= 0xffff; + + return (sum); + } + +_WRS_FASTTEXT +u_short in_cksum_skip(struct mbuf *m, int len, int skip); + +#endif /* _MACHINE_IN_CKSUM_H_ */ + diff --git a/h/arch/simnt/instrI86.h b/h/arch/simnt/instrI86.h new file mode 100644 index 0000000..8a264af --- /dev/null +++ b/h/arch/simnt/instrI86.h @@ -0,0 +1,86 @@ +/* instrI86.h - header for I86 instruction fields */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,26apr04,jmp created from target/h/dbgI86Lib.h +*/ + +/* + * WARNING: This file is shared between i86 and VxSim/i86 arches, + * and between Kernel and User sides. + * Please make sure that any modifications to this file + * does not break other arches. + */ + +#ifndef __INCinstrI86h +#define __INCinstrI86h + +/* defines */ + +#define ADDI08_0 (0x83) +#define ADDI08_1 (0xc4) +#define ADDI32_0 (0x81) +#define ADDI32_1 (0xc4) +#define LEAD08_0 (0x8d) +#define LEAD08_1 (0x64) +#define LEAD08_2 (0x24) +#define LEAD32_0 (0x8d) +#define LEAD32_1 (0xa4) +#define LEAD32_2 (0x24) +#define JMPD08 (0xeb) +#define JMPD32 (0xe9) +#define ENTER (0xc8) +#define PUSH_EBX (0x53) +#define PUSH_EBP (0x55) +#define PUSH_ESI (0x56) +#define MOV_ESP0 (0x89) +#define MOV_ESP1 (0xe5) +#define MOV_ESP_ESI (0xe689) +#define LEAVE (0xc9) +#define RET (0xc3) +#define RETADD (0xc2) +#define CALL_DIR (0xe8) +#define CALL_INDIR0 (0xff) +#define CALL_INDIR1 (0x10) +#define CALL_INDIR_REG_EAX (0xd0) +#define CALL_INDIR_REG_ECX (0xd1) +#define CALL_INDIR_REG_EDX (0xd2) +#define CALL_INDIR_REG_EBX (0xd3) +#define MOV_ECX (0x0d8b) +#define MOV_EDX (0x158b) +#define MOV_EBP_ESP (0xe589) + +#define ADDI08_0_MASK (0xff) +#define ADDI08_1_MASK (0xff) +#define ADDI32_0_MASK (0xff) +#define ADDI32_1_MASK (0xff) +#define LEAD08_0_MASK (0xff) +#define LEAD08_1_MASK (0xff) +#define LEAD08_2_MASK (0xff) +#define LEAD32_0_MASK (0xff) +#define LEAD32_1_MASK (0xff) +#define LEAD32_2_MASK (0xff) +#define JMPD08_MASK (0xff) +#define JMPD32_MASK (0xff) +#define ENTER_MASK (0xff) +#define PUSH_EBX_MASK (0xff) +#define PUSH_EBP_MASK (0xff) +#define PUSH_ESI_MASK (0xff) +#define MOV_ESP0_MASK (0xff) +#define MOV_ESP1_MASK (0xff) +#define MOV_ESP_ESI_MASK (0xffff) +#define LEAVE_MASK (0xff) +#define RET_MASK (0xff) +#define RETADD_MASK (0xff) +#define CALL_DIR_MASK (0xff) +#define CALL_INDIR0_MASK (0xff) +#define CALL_INDIR1_MASK (0x38) +#define CALL_INDIR_REG_MASK (0xdf) +#define MOV_ECX_MASK (0xffff) +#define MOV_EDX_MASK (0xffff) +#define MOV_EBP_ESP_MASK (0xffff) + +#endif /* __INCinstrI86h */ diff --git a/h/arch/simnt/ivSimnt.h b/h/arch/simnt/ivSimnt.h new file mode 100644 index 0000000..a9384bc --- /dev/null +++ b/h/arch/simnt/ivSimnt.h @@ -0,0 +1,40 @@ +/* ivSimnt.h - simnt interrupt vectors */ + +/* Copyright 1993-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,09feb04,dat Diab lint fix, chg INUM_TO_IVEC +01b,21may03,jmp moved IV_MAX from intArchLib.c. +01a,06oct97,cym written +*/ + +#ifndef __INCivSimnth +#define __INCivSimnth + +#ifdef __cplusplus +extern "C" { +#endif + +/* maximun number of interrupt vectors */ + +#define IV_MAX 0x0300 /* This value must be coherent with */ + /* VXSIM_MAX_INTS defined on host side. */ + /* See vxsimwin32.h . */ + +/* macros to convert interrupt vectors <-> interrupt numbers */ + +#define IVEC_TO_INUM(intVec) (intVec) +#define INUM_TO_IVEC(intNum) ((VOIDFUNCPTR *)intNum) + +#define IVEC_TO_MESSAGE(intVec) (intVec) +#define MESSAGE_TO_IVEC(message) (message) + +/* interrupt vector definitions */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCivSimnth */ diff --git a/h/arch/simnt/mmuArchLib.h b/h/arch/simnt/mmuArchLib.h new file mode 100644 index 0000000..669d635 --- /dev/null +++ b/h/arch/simnt/mmuArchLib.h @@ -0,0 +1,289 @@ +/* mmuArchLib.h - mmu library header for VxSim */ + +/* Copyright 1999-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,19aug04,dbt Removed obsolote mmuArchCurrentSet() prototype. +01d,03dec03,jmp added mmuArchLibInit(). +01c,26nov03,jmp added mmuArchCurrentSet(). +01c,30dec03,kab Update for VIRT_ADDR type +01b,07oct03,jmp added MMU_STATE_VALID_NOT. + added MMU cache simulation. +01a,17jul03,jmp imported from VxWorksAE. +*/ + +#ifndef __INCmmuArchLibh +#define __INCmmuArchLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HOST +#include "host.h" +#else /* HOST */ +#include "vxWorks.h" +#endif /* HOST */ + +/* MMU Page Size */ + +#ifdef HOST +#ifndef WIN32 +#define MMU_PAGE_SIZE 0x2000 /* pages are 8 kbytes */ +#else /* !WIN32 */ +#define MMU_PAGE_SIZE 0x10000 /* pages are 64 kbytes */ +#endif /* WIN32 */ + +/* + * VxSim host code does not have access to VIRT_ADDR & PHYS_ADDR, so + * it is necessary to define them here. + */ + +#define VIRT_ADDR UINT32 +#define PHYS_ADDR UINT32 + +#else /* HOST */ +#if CPU != SIMNT +#define MMU_PAGE_SIZE 0x2000 /* pages are 8 kbytes */ +#else /* CPU != SIMNT */ +#define MMU_PAGE_SIZE 0x10000 /* pages are 64 kbytes */ +#endif /* CPU != SIMNT */ +#endif /* HOST */ + +/* + * Page Table Entry (PTE) description: + * + * ______Real Page Number (rpn)_______ ______Page State_______ + * / \ / \ + * _______________________________________________________________ + * | | | | | | | | | | | | | | | | | | | |U|S|R|W|X| | | | | | |C|V| + * --------------------------------------------------------------- + * | | | | | | | | | | | | | + * | | | | | | | | | | | | | + * 13 User ______/ | | | | | | | | | | | | + * 12 Supervisor __/ | | | | | | | | | | | + * 11 Read __________/ | | | | | | | | | | + * 10 Write ___________/ | | | | | | | | | + * 9 Execute ___________/ | | | | | | | | + * 8 Reserved ____________/ | | | | | | | + * 7 Reserved ______________/ | | | | | | + * 6 Reserved ________________/ | | | | | + * 5 Reserved __________________/ | | | | + * 4 Reserved ____________________/ | | | + * 3 Reserved ______________________/ | | + * 2 Cache __________________________/ | + * 1 Valid _____________________________/ + * + * NOTE: On SIMNT, only 16 bits of the rpn bitfield (19 bits) are used. + * This is due to the SIMNT MMU page size. + */ + +/* Bit patterns for various MMU states */ + +#define MMU_STATE_SHIFT 8 + +#define MMU_STATE_VALID 0x00000001 +#define MMU_STATE_VALID_NOT 0x00000000 +#define MMU_STATE_CACHEABLE 0x00000002 +#define MMU_STATE_CACHEABLE_NOT 0x00000000 +#define MMU_STATE_INVALID_STATE 0xffffffff +#define MMU_STATE_NO_ACCESS 0x00000000 + +#define MMU_STATE_SUP_RX (0x0d << MMU_STATE_SHIFT) +#define MMU_STATE_SUP_RWX (0x0f << MMU_STATE_SHIFT) +#define MMU_STATE_USR_SUP_RX (0x1d << MMU_STATE_SHIFT) +#define MMU_STATE_USR_RX_SUP_RWX (0x15 << MMU_STATE_SHIFT) +#define MMU_STATE_USR_SUP_RWX (0x1f << MMU_STATE_SHIFT) + + +/* Masks associated with the above bit patterns */ + +#define MMU_STATE_MASK_VALID 0x00000001 +#define MMU_STATE_MASK_CACHEABLE 0x00000002 +#define MMU_STATE_MASK_PROTECTION (0x1f << MMU_STATE_SHIFT) + +/* Number of L1 and L2 descriptors available in tables */ + +#if MMU_PAGE_SIZE == 0x10000 +#define MMU_NUM_L1_DESC 2048 +#define MMU_NUM_L2_DESC 32 +#else /* MMU_PAGE_SIZE == 0x10000 */ +#define MMU_NUM_L1_DESC 4096 +#define MMU_NUM_L2_DESC 128 +#endif /* MMU_PAGE_SIZE == 0x10000 */ + +/* + * Alignment to use to allocate L2 structure. This is necessary to know how + * much bits are necessary to get the base address of a L2 structure + * (l2ba field in MMU_LEVEL_2_DESC and MMU_LEVEL_1_DESC structures. + */ + +#define MMU_L2_ALLOC_ALIGNMENT 0x1000 + +/* Memory size described by a L1 descriptor */ + +#define MMU_L1_SIZE (MMU_NUM_L1_DESC * MMU_PAGE_SIZE) + +/* Define _BYTE_ORDER macro for host side */ + +#ifdef HOST +#if HOST_BYTE_ORDER == BIG_ENDIAN +#undef _BIG_ENDIAN +#define _BIG_ENDIAN BIG_ENDIAN +#undef _BYTE_ORDER +#define _BYTE_ORDER _BIG_ENDIAN +#else /* HOST_BYTE_ORDER == BIG_ENDIAN */ +#undef _BIG_ENDIAN +#define _LITTLE_ENDIAN LITTLE_ENDIAN +#undef _BYTE_ORDER +#define _BYTE_ORDER _LITTLE_ENDIAN +#endif /* HOST_BYTE_ORDER == BIG_ENDIAN */ +#endif /* HOST */ + +/* PTE structure */ + +typedef union /* PTE structure */ + { + struct /* bit field desciption */ + { +#if _BYTE_ORDER == _BIG_ENDIAN + UINT32 rpn :19; /* real page number */ + UINT32 access :5; /* Access attributes: USR, SUP, RWX */ + UINT32 reserved :6; /* Reserved for later use */ + UINT32 cache :1; /* Cache attribute */ + UINT32 v :1; /* page valid bit */ +#else /* _BYTE_ORDER == _BIG_ENDIAN */ + UINT32 v :1; /* page valid bit */ + UINT32 cache :1; /* Cache attribute */ + UINT32 reserved :6; /* Reserved for later use */ + UINT32 access :5; /* Access attributes: USR, SUP, RWX */ + UINT32 rpn :19; /* real page number */ +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + } field; + UINT32 bits; + } PTE; + +/* Effective (Virtual) address structure */ + +typedef union /* effective address structure */ + { + struct /* Bit field description */ + { +#if _BYTE_ORDER == _BIG_ENDIAN +#if MMU_PAGE_SIZE == 0x10000 + UINT32 l1index :11; /* Level 1 Index */ + UINT32 l2index :5; /* Level 2 Index */ + UINT32 po :16; /* Page Offset */ +#else /* MMU_PAGE_SIZE == 0x10000 */ + UINT32 l1index :12; /* Level 1 Index */ + UINT32 l2index :7; /* Level 2 Index */ + UINT32 po :13; /* Page Offset */ +#endif /* MMU_PAGE_SIZE == 0x10000 */ +#else /* _BYTE_ORDER == _BIG_ENDIAN */ +#if MMU_PAGE_SIZE == 0x10000 + UINT32 po :16; /* Page Offset */ + UINT32 l2index :5; /* Level 2 Index */ + UINT32 l1index :11; /* Level 1 Index */ +#else /* MMU_PAGE_SIZE == 0x10000 */ + UINT32 po :13; /* Page Offset */ + UINT32 l2index :7; /* Level 2 Index */ + UINT32 l1index :12; /* Level 1 Index */ +#endif /* MMU_PAGE_SIZE == 0x10000 */ +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + } field; + VIRT_ADDR effAddr; /* Note: Requires VIRT_ADDR == UINT32 */ + } EFFECTIVE_ADDR; + +/* Real (Physical) address structure */ + +typedef union /* real address structure */ + { + struct /* Bit field description */ + { +#if _BYTE_ORDER == _BIG_ENDIAN +#if MMU_PAGE_SIZE == 0x10000 + UINT32 rpn :16; /* Real Page Number */ + UINT32 po :16; /* Page Offset */ +#else /* MMU_PAGE_SIZE == 0x10000 */ + UINT32 rpn :19; /* Real Page Number */ + UINT32 po :13; /* Page Offset */ +#endif /* MMU_PAGE_SIZE == 0x10000 */ +#else /* _BYTE_ORDER == _BIG_ENDIAN */ +#if MMU_PAGE_SIZE == 0x10000 + UINT32 po :16; /* Page Offset */ + UINT32 rpn :16; /* Real Page Number */ +#else /* MMU_PAGE_SIZE == 0x10000 */ + UINT32 po :13; /* Page Offset */ + UINT32 rpn :19; /* Real Page Number */ +#endif /* MMU_PAGE_SIZE == 0x10000 */ +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + } field; + PHYS_ADDR realAddr; /* Note: Requires PHYS_ADDR == UINT32 */ + } REAL_ADDR; + +/* Level 2 Descriptor Table structure */ + +typedef union /* Level 2 descriptor table structure */ + { + struct /* Bit field description */ + { +#if _BYTE_ORDER == _BIG_ENDIAN + UINT32 l2ba :20; /* Level 2 table base address */ + UINT32 l2index :10; /* Level 2 table Index, note that this */ + /* value does not depend on the number */ + /* of L2 descriptors. The constraint is */ + /* that l2ba + l2index is 20 and l2ba */ + /* is dependent on the allocation */ + /* aligment of L2 desc table */ + UINT32 reserved :2; /* Reserved (must always be zero) */ +#else /* _BYTE_ORDER == _BIG_ENDIAN */ + UINT32 reserved :2; /* Reserved (must always be zero) */ + UINT32 l2index :10; /* Level 2 table Index */ + UINT32 l2ba :20; /* Level 2 table base address */ +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + } field; + PTE * pPte; + } MMU_LEVEL_2_DESC; + +/* Level 1 Descriptor Table structure */ + +typedef struct + { + UINT32 l2ba :20; /* Level 2 table Base Address */ + UINT32 v :1; /* segment valid bit */ + UINT32 pad :11; /* padding */ + } MMU_LEVEL_1_DESC; + +/* MMU translation table structure */ + +#define MMU_L1_MASK_SIZE 32 + +#if MMU_L1_MASK_SIZE == 8 +#define MMU_L1_MASK_TYPE UINT8 +#elif MMU_L1_MASK_SIZE == 16 +#define MMU_L1_MASK_TYPE UINT16 +#elif MMU_L1_MASK_SIZE == 32 +#define MMU_L1_MASK_TYPE UINT32 +#else +#error "Unsupported MMU_L1_MASK_SIZE value." +#endif + +typedef struct mmuTransTblStruct + { + MMU_LEVEL_1_DESC * pLvl1Tbl; /* Level1 descriptor table */ + UINT32 firstL1Ix; /* First L1 index used */ + UINT32 lastL1Ix; /* Last L1 index used */ + MMU_L1_MASK_TYPE l1Mask[MMU_NUM_L1_DESC/MMU_L1_MASK_SIZE]; + } MMU_TRANS_TBL; + +#ifndef HOST +extern STATUS mmuArchLibInit (UINT pageSize); +#endif /* HOST */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmmuArchLibh */ diff --git a/h/arch/simnt/ntcontext.h b/h/arch/simnt/ntcontext.h new file mode 100644 index 0000000..2436f7d --- /dev/null +++ b/h/arch/simnt/ntcontext.h @@ -0,0 +1,166 @@ +/* ntcontext.h - NT context record header */ + +/* Copyright 1998-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,13sep01,hbh Removed BYTE type (SPR 32165) +01b,21jan98,jmb Added modhist, converted comments to C style. +01a,12jun98,cym created. +*/ + +#ifndef __INCntcontexth +#define __INCntcontexth + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void * HANDLE; +typedef unsigned short int WORD; +typedef unsigned long DWORD; + + + +#define CREATE_SUSPENDED 0x4L + +/* + * Define the size of the 80387 save area, which is in the context frame. + */ + +#define SIZE_OF_80387_REGISTERS 80 + +/* + * The following flags control the contents of the CONTEXT structure. + */ + +#if !defined(RC_INVOKED) + +#define CONTEXT_i386 0x00010000 /* this assumes that i386 and */ +#define CONTEXT_i486 0x00010000 /* i486 have identical context records */ + +/* end_wx86 */ + +#define CONTEXT_CONTROL (CONTEXT_i386 | 0x00000001L) /* SS:SP, CS:IP, FLAGS, BP */ +#define CONTEXT_INTEGER (CONTEXT_i386 | 0x00000002L) /* AX, BX, CX, DX, SI, DI */ +#define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x00000004L) /* DS, ES, FS, GS */ +#define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x00000008L) /* 387 state */ +#define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x00000010L) /* DB 0-3,6,7 */ + +#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER |\ + CONTEXT_SEGMENTS) + +/* begin_wx86 */ + +#endif + +typedef struct _FLOATING_SAVE_AREA { + DWORD ControlWord; + DWORD StatusWord; + DWORD TagWord; + DWORD ErrorOffset; + DWORD ErrorSelector; + DWORD DataOffset; + DWORD DataSelector; + char RegisterArea[SIZE_OF_80387_REGISTERS]; + DWORD Cr0NpxState; +} FLOATING_SAVE_AREA; + +typedef FLOATING_SAVE_AREA *PFLOATING_SAVE_AREA; + +/* + * Context Frame + * + * This frame has a several purposes: 1) it is used as an argument to + * NtContinue, 2) is is used to constuct a call frame for APC delivery, + * and 3) it is used in the user level thread creation routines. + * + * The layout of the record conforms to a standard call frame. + */ + +typedef struct _CONTEXT { + + /* + * The flags values within this flag control the contents of + * a CONTEXT record. + * + * If the context record is used as an input parameter, then + * for each portion of the context record controlled by a flag + * whose value is set, it is assumed that that portion of the + * context record contains valid context. If the context record + * is being used to modify a threads context, then only that + * portion of the threads context will be modified. + * + * If the context record is used as an IN OUT parameter to capture + * the context of a thread, then only those portions of the thread's + * context corresponding to set flags will be returned. + * + * The context record is never used as an OUT only parameter. + */ + + DWORD ContextFlags; + + /* + * This section is specified/returned if CONTEXT_DEBUG_REGISTERS is + * set in ContextFlags. Note that CONTEXT_DEBUG_REGISTERS is NOT + * included in CONTEXT_FULL. + */ + + DWORD Dr0; + DWORD Dr1; + DWORD Dr2; + DWORD Dr3; + DWORD Dr6; + DWORD Dr7; + + /* + * This section is specified/returned if the + * ContextFlags word contians the flag CONTEXT_FLOATING_POINT. + */ + + FLOATING_SAVE_AREA FloatSave; + + /* + * This section is specified/returned if the + * ContextFlags word contians the flag CONTEXT_SEGMENTS. + */ + + DWORD SegGs; + DWORD SegFs; + DWORD SegEs; + DWORD SegDs; + + /* + * This section is specified/returned if the + * ContextFlags word contians the flag CONTEXT_INTEGER. + */ + + DWORD Edi; + DWORD Esi; + DWORD Ebx; + DWORD Edx; + DWORD Ecx; + DWORD Eax; + + /* + * This section is specified/returned if the + * ContextFlags word contians the flag CONTEXT_CONTROL. + */ + + DWORD Ebp; + DWORD Eip; + DWORD SegCs; /* MUST BE SANITIZED */ + DWORD EFlags; /* MUST BE SANITIZED */ + DWORD Esp; + DWORD SegSs; + +} CONTEXT; + +typedef CONTEXT *PCONTEXT; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCntcontexth */ diff --git a/h/arch/simnt/regsSimnt.h b/h/arch/simnt/regsSimnt.h new file mode 100644 index 0000000..9610873 --- /dev/null +++ b/h/arch/simnt/regsSimnt.h @@ -0,0 +1,112 @@ +/* regsSimnt.h - simnt registers header */ + +/* Copyright 1995-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01l,31aug04,jmp made SIMLINUX REG_SET indentical to SIMNT. +01k,01dec03,jmp added mmuTransTbl (current MMU translation table) to REG_SET. +01j,24nov03,jeg added macros to manage supervisor bit +01i,14nov03,jmp added SIM_STATUS_USR. +01h,18sep03,jeg removed SIM_STATUS_INIT macro. +01g,12sep03,jeg updated REG_SET structure to split intLockKey by a status bit + field. Removed the WIND_TCB_* macros. +01f,27may03,jmp added Register offsets in TCB. +01e,26mar03,jmp replaced INSTR by UCHAR to use this file from host side. +01d,17mar03,jmp renamed macros REG_* in REG_SET_*. +01c,16jan03,elp added REGS defines (SPR #84278). +01b,29apr98,cym added intLockKey +01a,27aug97,cym written +*/ + +#ifndef __INCregsSimnth +#define __INCregsSimnth + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#define GREG_NUM 8 + +typedef struct /* REG_SET - simnt register set (based on x86) */ + { + ULONG edi; /* general register */ + ULONG esi; /* general register */ + ULONG ebp; /* general register */ + ULONG esp; /* general register */ + ULONG ebx; /* general register */ + ULONG edx; /* general register */ + ULONG ecx; /* frame pointer register */ + ULONG eax; /* stack pointer register */ + ULONG eflags; /* status register */ + UCHAR * pc; /* program counter */ + ULONG reg_status; /* status bit field */ + UINT32 mmuTransTbl; /* current MMU translation table */ + char unused[0xc8]; /* unused - keep for SIMNT backward */ + /* compatibility with T2.x releases */ + } REG_SET; + +#undef pc +#undef spReg +#define spReg esp +#define fpReg ebp +#define reg_pc pc +#define reg_sp spReg +#define reg_fp fpReg + +#define G_REG_BASE 0x00 +#define G_REG_OFFSET(n) (G_REG_BASE + (n) * sizeof(ULONG)) +#define SR_OFFSET G_REG_OFFSET(GREG_NUM) +#define PC_OFFSET (SR_OFFSET + sizeof(ULONG)) +#endif /* _ASMLANGUAGE */ + +/* Register offsets */ + +#define REG_SET_EDI 0x00 +#define REG_SET_ESI 0x04 +#define REG_SET_EBP 0x08 +#define REG_SET_ESP 0x0c +#define REG_SET_EBX 0x10 +#define REG_SET_EDX 0x14 +#define REG_SET_ECX 0x18 +#define REG_SET_EAX 0x1c +#define REG_SET_EFLAGS 0x20 +#define REG_SET_PC 0x24 +#define REG_SET_SIMSTATUS 0x28 +#define REG_SET_MMU_TRANS_TBL 0x2c + +/* status bit fields */ + +#define SIM_STATUS_INTLOCK 0x0001 /* interrupt locked */ +#define SIM_STATUS_INTUNLOCK 0x0000 /* interrupt unlocked */ +#define SIM_STATUS_SUP 0x0002 /* supervisor mode */ +#define SIM_STATUS_USR 0x0000 /* user mode */ + +/* macros to access interrupt status field */ + +#define VXSIM_INT_MASK_SET(vxsimStatus) \ + (vxsimStatus |= SIM_STATUS_INTLOCK) + +#define VXSIM_INT_MASK_CLEAR(vxsimStatus) \ + (vxsimStatus &= ~(SIM_STATUS_INTLOCK)) + +#define VXSIM_INT_MASK_GET(vxsimStatus) \ + (((vxsimStatus & SIM_STATUS_INTLOCK) == 0) ? FALSE : TRUE) + +#define VXSIM_SUP_MODE_SET(vxsimStatus) \ + (vxsimStatus |= SIM_STATUS_SUP) + +#define VXSIM_USR_MODE_SET(vxsimStatus) \ + (vxsimStatus &= ~(SIM_STATUS_SUP)) + +#define VXSIM_SUP_MODE_GET(vxsimStatus) \ + (((vxsimStatus & SIM_STATUS_SUP) == 0) ? FALSE : TRUE) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCregsSimnth */ diff --git a/h/arch/simnt/stdargGnu.h b/h/arch/simnt/stdargGnu.h new file mode 100644 index 0000000..8eab107 --- /dev/null +++ b/h/arch/simnt/stdargGnu.h @@ -0,0 +1,140 @@ +/* stdargGnu.h - Ansi C standard arguments header file */ + +/* +modification history +-------------------- +01b,03mar98,jmb clean-up +01a,27feb98,jmb A simplified version of stdarg.h from Cygwin32, Beta 18. +*/ + +/* +DESCRIPTION +This file contains macros and typedefs for varargs. +Note: This file should not be included directly! The correct file +to include is . + +This file was derived from the cygwin32-b18 version of gcc/ginclude/stdarg.h. +*/ + +#ifndef __INCstdargh +Bug!! Please use #include +#endif + + +#ifndef __INCstdargGnuh +#define __INCstdargGnuh + +#ifdef __cplusplus +extern "C" { +#endif + +/* stdarg.h for GNU. + Note that the type used in va_arg is supposed to match the + actual type **after default promotions**. + Thus, va_arg (..., short) is not valid. */ + +#ifndef _STDARG_H +#ifndef _ANSI_STDARG_H_ +#ifndef __need___va_list +#define _STDARG_H +#define _ANSI_STDARG_H_ +#endif /* not __need___va_list */ +#undef __need___va_list + + +/* Define __gnuc_va_list. */ + +#ifndef __GNUC_VA_LIST +#define __GNUC_VA_LIST +typedef void *__gnuc_va_list; +#endif + +/* Define the standard macros for the user, + if this invocation was from the user program. */ +#ifdef _STDARG_H + +/* Amount of space required in an argument list for an arg of type TYPE. + TYPE may alternatively be an expression whose type is used. */ + +#define __va_rounded_size(TYPE) \ + (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) + +#define va_start(AP, LASTARG) \ + (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG))) + +#undef va_end +void va_end (__gnuc_va_list); /* Defined in libgcc.a */ +#define va_end(AP) ((void)0) + +/* We cast to void * and then to TYPE * because this avoids + a warning about increasing the alignment requirement. */ +/* CYGNUS LOCAL mn10200/law */ +/* END CYGNUS LOCAL */ +/* This is for little-endian machines; small args are padded upward. */ +#define va_arg(AP, TYPE) \ + (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ + *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE)))) + +/* Copy __gnuc_va_list into another variable of this type. */ +#define __va_copy(dest, src) (dest) = (src) + +#endif /* _STDARG_H */ + +#ifdef _STDARG_H +/* Define va_list, if desired, from __gnuc_va_list. */ +/* We deliberately do not define va_list when called from + stdio.h, because ANSI C says that stdio.h is not supposed to define + va_list. stdio.h needs to have access to that data type, + but must not use that name. It should use the name __gnuc_va_list, + which is safe because it is reserved for the implementation. */ + +#ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */ +#undef _VA_LIST +#endif + +#ifdef _BSD_VA_LIST +#undef _BSD_VA_LIST +#endif + + +/* The macro _VA_LIST_ is the same thing used by this file in Ultrix. + But on BSD NET2 we must not test or define or undef it. + (Note that the comments in NET 2's ansi.h + are incorrect for _VA_LIST_--see stdio.h!) */ +#if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT) +/* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */ +#ifndef _VA_LIST_DEFINED +/* The macro _VA_LIST is used in SCO Unix 3.2. */ +#ifndef _VA_LIST +/* The macro _VA_LIST_T_H is used in the Bull dpx2 */ +#ifndef _VA_LIST_T_H +typedef __gnuc_va_list va_list; +#endif /* not _VA_LIST_T_H */ +#endif /* not _VA_LIST */ +#endif /* not _VA_LIST_DEFINED */ +#if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__)) +#define _VA_LIST_ +#endif +#ifndef _VA_LIST +#define _VA_LIST +#endif +#ifndef _VA_LIST_DEFINED +#define _VA_LIST_DEFINED +#endif +#ifndef _VA_LIST_T_H +#define _VA_LIST_T_H +#endif + +#endif /* not _VA_LIST_, except on certain systems */ + + +#endif /* _STDARG_H */ + +#endif /* not _ANSI_STDARG_H_ */ +#endif /* not _STDARG_H */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCstdargGnuh */ diff --git a/h/arch/simnt/syscallArgsx86.h b/h/arch/simnt/syscallArgsx86.h new file mode 100644 index 0000000..ebbdcf9 --- /dev/null +++ b/h/arch/simnt/syscallArgsx86.h @@ -0,0 +1,755 @@ +/* Aligned for x86 - no alignment needed */ + + +/* THIS FILE IS AUTO_GENERATED. PLEASE DO NOT EDIT. */ + +#ifndef _ASMLANGUAGE + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct _exitScArgs + { + int status; + }; + +struct creatScArgs + { + const char * name; + mode_t flag; + }; + +struct _openScArgs + { + const char * name; + int flags; + int mode; + }; + +struct closeScArgs + { + int fd; + }; + +struct readScArgs + { + int fd; + void * buffer; + size_t maxbytes; + }; + +struct writeScArgs + { + int fd; + const void * buffer; + size_t nbytes; + }; + +struct _ioctlScArgs + { + int fd; + int function; + int arg; + }; + +struct dupScArgs + { + int fd; + }; + +struct dup2ScArgs + { + int fd; + int fd2; + }; + +struct pipeScArgs + { + int filedes[2]; + }; + +struct removeScArgs + { + const char * name; + }; + +struct selectScArgs + { + int width; + fd_set * readFds; + fd_set * writeFds; + fd_set * excFds; + struct timeval * timeout; + }; + +struct socketScArgs + { + int domain; + int type; + int protocol; + }; + +struct bindScArgs + { + int s; + struct sockaddr * name; + int namelen; + }; + +struct listenScArgs + { + int s; + int backlog; + }; + +struct acceptScArgs + { + int s; + struct sockaddr * addr; + int *addrlen; + }; + +struct connectScArgs + { + int s; + struct sockaddr * name; + int namelen; + }; + +struct sendtoScArgs + { + int s; + caddr_t buf; + int bufLen; + int flags; + struct sockaddr * to; + int tolen; + }; + +struct sendScArgs + { + int s; + const char * buf; + int bufLen; + int flags; + }; + +struct sendmsgScArgs + { + int s; + struct msghdr * mp; + int flags; + }; + +struct recvfromScArgs + { + int s; + char * buf; + int bufLen; + int flags; + struct sockaddr *from; + int * pFromLen; + }; + +struct recvScArgs + { + int s; + char * buf; + int bufLen; + int flags; + }; + +struct recvmsgScArgs + { + int s; + struct msghdr * mp; + int flags; + }; + +struct setsockoptScArgs + { + int s; + int level; + int optname; + char * optval; + int optlen; + }; + +struct getsockoptScArgs + { + int s; + int level; + int optname; + char * optval; + int * optlen; + }; + +struct getsocknameScArgs + { + int s; + struct sockaddr *name; + int * namelen; + }; + +struct getpeernameScArgs + { + int s; + struct sockaddr *name; + int *namelen; + }; + +struct shutdownScArgs + { + int s; + int how; + }; + +struct mmapScArgs + { + void * addr; + size_t len; + int prot; + int flags; + int fildes; + off_t64 off; + }; + +struct munmapScArgs + { + void * addr; + size_t len; + }; + +struct mprotectScArgs + { + void * addr; + size_t len; + int prot; + }; + +struct killScArgs + { + OBJ_HANDLE rtpId; + int signo; + }; + +struct sigpendingScArgs + { + sigset_t * pSet; + }; + +struct sigprocmaskScArgs + { + int how; + const sigset_t * pSet; + sigset_t * pOset; + }; + +struct _sigqueueScArgs + { + OBJ_HANDLE rtpId; + int signo; + const union sigval * pValue; + int sigCode; + }; + +struct sigsuspendScArgs + { + const sigset_t * pSet; + }; + +struct sigtimedwaitScArgs + { + const sigset_t * pSet; + struct siginfo * pInfo; + const struct timespec * pTime; + }; + +struct _sigactionScArgs + { + int signo; + const struct sigaction * pAct; + struct sigaction * pOact; + void * retAddr; + }; + +struct chdirScArgs + { + const char * name; + }; + +struct _getcwdScArgs + { + char * buffer; + int length; + }; + +struct waitpidScArgs + { + OBJ_HANDLE childRtpId; + int * pStatus; + int options; + }; + +struct sysctlScArgs + { + int *pName; + u_int nameLen; + void * pOld; + size_t * pOldLen; + void * pNew; + size_t newLen; + }; + +struct _schedPxInfoGetScArgs + { + BOOL * pTimeSlicingOn; + ULONG * pTimeSlicePeriod; + }; + +struct sigaltstackScArgs + { + stack_t * ss; + stack_t * oss; + }; + +struct unlinkScArgs + { + const char * name; + }; + +struct linkScArgs + { + const char * name; + const char * newname; + }; + +struct fsyncScArgs + { + int fd; + }; + +struct fdatasyncScArgs + { + int fd; + }; + +struct renameScArgs + { + const char * oldname; + const char * newname; + }; + +struct fpathconfScArgs + { + int fd; + int name; + }; + +struct pathconfScArgs + { + const char * path; + int name; + }; + +struct accessScArgs + { + const char * path; + int amode; + }; + +struct chmodScArgs + { + const char * path; + mode_t mode; + }; + +struct eventReceiveScArgs + { + UINT32 events; + UINT32 options; + int timeout; + UINT32 * pEvtsReceived; + }; + +struct eventSendScArgs + { + int taskId; + UINT32 events; + }; + +struct eventCtlScArgs + { + OBJ_HANDLE handle; + VX_EVT_CTL_CMD command; + void * pArg; + UINT * pArgSize; + }; + +struct msgQSendScArgs + { + OBJ_HANDLE handle; + char * buffer; + UINT nBytes; + int timeout; + int priority; + }; + +struct msgQReceiveScArgs + { + OBJ_HANDLE handle; + char * buffer; + UINT maxNBytes; + int timeout; + }; + +struct _msgQOpenScArgs + { + const char * name; + UINT maxMsgs; + UINT maxMsgLength; + int options; + int mode; + void * context; + }; + +struct objDeleteScArgs + { + OBJ_HANDLE handle; + int options; + }; + +struct objInfoGetScArgs + { + OBJ_HANDLE handle; + void * pInfo; + UINT * pInfoSize; + int level; + }; + +struct _semTakeScArgs + { + OBJ_HANDLE handle; + int timeout; + }; + +struct _semGiveScArgs + { + OBJ_HANDLE handle; + }; + +struct _semOpenScArgs + { + const char * name; + SEM_TYPE type; + int initState; + int options; + int mode; + void * context; + }; + +struct semCtlScArgs + { + OBJ_HANDLE handle; + VX_SEM_CTL_CMD command; + void * pArg; + UINT * pArgSize; + }; + +struct _taskOpenScArgs + { + struct vx_task_open_sc_args * pArgs; + }; + +struct taskCtlScArgs + { + int tid; + VX_TASK_CTL_CMD command; + void * pArg; + UINT * pArgSize; + }; + +struct taskDelayScArgs + { + int ticks; + }; + +struct rtpSpawnScArgs + { + const char * rtpFileName; + const char ** argv; + const char ** envp; + int priority; + int uStackSize; + int options; + int taskOptions; + }; + +struct rtpInfoGetScArgs + { + OBJ_HANDLE rtpId; + RTP_DESC * rtpStruct; + }; + +struct taskKillScArgs + { + OBJ_HANDLE taskHandle; + int signo; + }; + +struct _taskSigqueueScArgs + { + OBJ_HANDLE taskHandle; + int signo; + const union sigval * pValue; + int sigCode; + }; + +struct _timer_openScArgs + { + const char * name; + int mode; + clockid_t clockId; + struct sigevent * evp; + void * context; + }; + +struct timerCtlScArgs + { + TIMER_CTL_CMD cmdCode; + int handle; + void * pArgs; + UINT * pArgSize; + }; + +struct pxOpenScArgs + { + PX_OBJ_TYPE type; + const char * name; + int objOpenMode; + void * attr; + }; + +struct pxCloseScArgs + { + OBJ_HANDLE handle; + }; + +struct pxUnlinkScArgs + { + PX_OBJ_TYPE type; + const char * name; + }; + +struct pxCtlScArgs + { + OBJ_HANDLE handle; + PX_CTL_CMD_CODE cmdCode; + void * pArgs; + UINT * pArgSize; + }; + +struct pxMqReceiveScArgs + { + OBJ_HANDLE handle; + char * pMsg; + size_t msgLen; + unsigned int * pMsgPrio; + PX_WAIT_OPTION waitOption; + struct timespec * time_out; + }; + +struct pxMqSendScArgs + { + OBJ_HANDLE handle; + const char * pMsg; + size_t msgLen; + unsigned int msgPrio; + PX_WAIT_OPTION waitOption; + struct timespec * time_out; + }; + +struct pxSemWaitScArgs + { + OBJ_HANDLE handle; + PX_WAIT_OPTION waitOption; + struct timespec * time_out; + }; + +struct pxSemPostScArgs + { + OBJ_HANDLE handle; + }; + +struct pipeDevCreateScArgs + { + const char * name; + int nMessages; + int nBytes; + }; + +struct pipeDevDeleteScArgs + { + const char * name; + BOOL force; + }; + +struct _sdCreateScArgs + { + char * name; + int options; + UINT32 size; + off_t64 physAddress; + MMU_ATTR attr; + void ** pVirtAddress; + }; + +struct _sdOpenScArgs + { + char * name; + int options; + int mode; + UINT32 size; + off_t64 physAddress; + MMU_ATTR attr; + void ** pVirtAddress; + }; + +struct sdDeleteScArgs + { + OBJ_HANDLE handle; + int options; + }; + +struct sdMapScArgs + { + OBJ_HANDLE handle; + MMU_ATTR attr; + int options; + }; + +struct sdUnmapScArgs + { + OBJ_HANDLE handle; + int options; + }; + +struct sdProtectScArgs + { + OBJ_HANDLE handle; + MMU_ATTR attr; + }; + +struct _edrErrorInjectScArgs + { + int kind; + const char *fileName; + int lineNumber; + REG_SET *regset; + void *addr; + const char *msg; + }; + +struct resSearchNScArgs + { + const char * name; + struct res_target * target; + }; + +struct wvEventScArgs + { + int eventId; + const char * pData; + unsigned int dataSize; + }; + +struct rtpVarAddScArgs + { + void ** pVar; + void * value; + }; + +struct sdInfoGetScArgs + { + OBJ_HANDLE handle; + SD_DESC * pSdStruct; + }; + +struct _shlOpenScArgs + { + const char * name; + int options; + }; + +struct _shlUnlockScArgs + { + SHL_ID shlId; + }; + +struct _shlCloseScArgs + { + SHL_ID shlId; + }; + +struct _shlGetScArgs + { + SHL_ID shlId; + SHLINFO *pInfo; + }; + +struct _shlPutScArgs + { + SHL_ID shlId; + const SHLINFO *pInfo; + }; + +struct objUnlinkScArgs + { + const char * name; + enum windObjClassType classType; + }; + +struct getprlimitScArgs + { + int idtype; + OBJ_HANDLE handle; + int resource; + struct rlimit *rlp; + }; + +struct setprlimitScArgs + { + int idtype; + OBJ_HANDLE handle; + int resource; + struct rlimit *rlp; + }; + +struct _mctlScArgs + { + void * addr; + size_t len; + int function; + int arg; + }; + +#endif /* _ASMLANGUAGE */ diff --git a/h/arch/simnt/syscallSimnt.h b/h/arch/simnt/syscallSimnt.h new file mode 100644 index 0000000..d004043 --- /dev/null +++ b/h/arch/simnt/syscallSimnt.h @@ -0,0 +1,71 @@ +/* syscallVxSim.h - VxSim specific System Call Infrastructure header */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,10feb04,jeg added _func_syscallTrapHandle to fixe dependency issue + introduced into wdbDbgSysCallCheck() API. +01c,09feb04,jeg added syscallTrapHandle () prototype. +01b,12dec03,jeg added frame pointer and program counter in + SYSCALL_ENTRY_STATE structure +01a,05nov03,jmp written. +*/ + +/* +DESCRIPTION +This header contains VxSim-specific definitions and constants used by +the System Call Infrastructure library. + +*/ + +#ifndef __INCsyscallVxSimh +#define __INCsyscallVxSimh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define syscallDispatch_PORTABLE /* Use the portable dispatcher */ + +#define SYSCALL_ENTRY_FRAME_SIZE 52 +#define _SYSCALL_USER_SP_CHECK(sp) /* XXX To implement */ + +/* typedefs */ + +#ifndef _ASMLANGUAGE + /* + * The SYSCALL_ENTRY_STATE structure defines the saved machine state + * when the system call trap is taken. This information is architecture + * specific, and is used by the system call dispatcher to restart system + * calls that have been interrupted by the occurance of signals. + * System call restart is achieved by restoring the saved state at the + * time of the system call trap, and re-issuing the system call. + * Arguments to the system call are saved on the kernel stack, and + * the address of that array is passed as an argument to the dispatcher. + * The layout of this structure must exactly match the ordering of members + * of the system call entry frame in src/arch/sim/syscallALib.s. + */ + +typedef struct syscall_entry_state + { + int args[8]; /* argument list (user stack) */ + int scn; /* System Call Number (SCN) in eax */ + int * pUStack; /* user-mode stack pointer */ + int statusReg; /* saved Status Register */ + int * efp; /* saved frame Register */ + void * pc; /* Trap return address */ + } SYSCALL_ENTRY_STATE; + +extern FUNCPTR _func_syscallTrapHandle; + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsyscallVxSimh */ diff --git a/h/arch/simnt/va_simnt.h b/h/arch/simnt/va_simnt.h new file mode 100644 index 0000000..6ac66e4 --- /dev/null +++ b/h/arch/simnt/va_simnt.h @@ -0,0 +1,163 @@ +/*** +*stdarg.h - defines ANSI-style macros for variable argument functions +* +* Copyright (c) 1985-1995, Microsoft Corporation. All rights reserved. +* +*Purpose: +* This file defines ANSI-style macros for accessing arguments +* of functions which take a variable number of arguments. +* [ANSI] +* +* [Public] +* +****/ + +#if _MSC_VER > 1000 +#pragma once +#endif + +#ifndef _INC_STDARG +#define _INC_STDARG + +#if !defined(_WIN32) && !defined(_MAC) +#error ERROR: Only Mac or Win32 targets supported! +#endif + + +#ifdef _MSC_VER +/* + * Currently, all MS C compilers for Win32 platforms default to 8 byte + * alignment. + */ +#pragma pack(push,8) +#endif /* _MSC_VER */ + +#ifdef __cplusplus +extern "C" { +#endif + + + +#ifndef _VA_LIST_DEFINED +#ifdef _M_ALPHA +typedef struct { + char *a0; /* pointer to first homed integer argument */ + int offset; /* byte offset of next parameter */ +} va_list; +#else +typedef char * va_list; +#endif +#define _VA_LIST_DEFINED +#endif + +#ifdef _M_IX86 + + +#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) ) + +#define va_start(ap,v) ( ap = (va_list)&v + _INTSIZEOF(v) ) +#define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) ) +#define va_end(ap) ( ap = (va_list)0 ) + +#elif defined(_M_MRX000) + + +/* Use these types and definitions if generating code for MIPS */ + +#define va_start(ap,v) ap = (va_list)&v + sizeof(v) +#define va_end(list) +#define va_arg(list, mode) ((mode *)(list =\ + (char *) ((((int)list + (__builtin_alignof(mode)<=4?3:7)) &\ + (__builtin_alignof(mode)<=4?-4:-8))+sizeof(mode))))[-1] + +/* +++++++++++++++++++++++++++++++++++++++++++ + Because of parameter passing conventions in C: + use mode=int for char, and short types + use mode=double for float types + use a pointer for array types + +++++++++++++++++++++++++++++++++++++++++++ */ + + +#elif defined(_M_ALPHA) + + +/* Use these types and definitions if generating code for ALPHA */ + +/* + * The Alpha compiler supports two builtin functions that are used to + * implement stdarg/varargs. The __builtin_va_start function is used + * by va_start to initialize the data structure that locates the next + * argument. The __builtin_isfloat function is used by va_arg to pick + * which part of the home area a given register argument is stored in. + * The home area is where up to six integer and/or six floating point + * register arguments are stored down (so they can also be referenced + * by a pointer like any arguments passed on the stack). + */ + +extern void * __builtin_va_start(va_list, ...); + +#ifdef _CFRONT +#define __builtin_isfloat(a) __builtin_alignof(a) +#endif + +#define va_start(list, v) __builtin_va_start(list, v, 1) +#define va_end(list) +#define va_arg(list, mode) \ + ( *( ((list).offset += ((int)sizeof(mode) + 7) & -8) , \ + (mode *)((list).a0 + (list).offset - \ + ((__builtin_isfloat(mode) && (list).offset <= (6 * 8)) ? \ + (6 * 8) + 8 : ((int)sizeof(mode) + 7) & -8) \ + ) \ + ) \ + ) + +#elif defined(_M_PPC) + +/* Microsoft C8 front end (used in Motorola Merged compiler) */ +/* bytes that a type occupies in the argument list */ +#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) ) +/* return 'ap' adjusted for type 't' in arglist */ +#define _ALIGNIT(ap,t) \ + ((((int)(ap))+(sizeof(t)<8?3:7)) & (sizeof(t)<8?~3:~7)) + +#define va_start(ap,v) ( ap = (va_list)&v + _INTSIZEOF(v) ) +#define va_arg(ap,t) ( *(t *)((ap = (char *) (_ALIGNIT(ap, t) + _INTSIZEOF(t))) - _INTSIZEOF(t)) ) +#define va_end(ap) ( ap = (va_list)0 ) + +#elif defined(_M_M68K) +#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) ) + +#define va_start(ap,v) ( ap = (va_list)&v + (sizeof(v) < sizeof(int) ? sizeof(v) : _INTSIZEOF(v)) ) +#define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) ) +#define va_end(ap) ( ap = (va_list)0 ) + +#elif defined(_M_MPPC) +#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) ) + +#define va_start(ap,v) ( ap = (va_list)&v + _INTSIZEOF(v) ) +#define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) ) +#define va_end(ap) ( ap = (va_list)0 ) + +#else + +/* A guess at the proper definitions for other platforms */ + +#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) ) + +#define va_start(ap,v) ( ap = (va_list)&v + _INTSIZEOF(v) ) +#define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) ) +#define va_end(ap) ( ap = (va_list)0 ) + + +#endif + + +#ifdef __cplusplus +} +#endif + +#ifdef _MSC_VER +#pragma pack(pop) +#endif /* _MSC_VER */ + +#endif /* _INC_STDARG */ diff --git a/h/arch/simnt/vxSimntLib.h b/h/arch/simnt/vxSimntLib.h new file mode 100644 index 0000000..f3dc51a --- /dev/null +++ b/h/arch/simnt/vxSimntLib.h @@ -0,0 +1,29 @@ +/* vxSimntLib.h - header for board dependent routines for Windows VxSim */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,01dec03,dbt Fixed vxPowerDown prototype. +01a,01apr03,jmp written. +*/ + +#ifndef __INCvxSimntLibh +#define __INCvxSimntLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +IMPORT void vxPowerDown (void); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvxSimntLibh */ diff --git a/h/arch/simnt/vxsimArchLib.h b/h/arch/simnt/vxsimArchLib.h new file mode 100644 index 0000000..be5288d --- /dev/null +++ b/h/arch/simnt/vxsimArchLib.h @@ -0,0 +1,18 @@ +/* vxsimArchLib.h - header for VxSim architecture library */ + +/* Copyright 2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,28mar03,jmp added vxsimExceptionDispatch. +01a,30jan03,jmp written. +*/ + +#ifndef __INCvxsimArchLibh +#define __INCvxsimArchLibh + +extern void vxsimExceptionDispatch (EXC_INFO * pExcInfo, REG_SET * pRegs); + +#endif /* __INCvxsimArchLibh */ diff --git a/h/arch/simnt/vxsimHostArchLib.h b/h/arch/simnt/vxsimHostArchLib.h new file mode 100644 index 0000000..473772a --- /dev/null +++ b/h/arch/simnt/vxsimHostArchLib.h @@ -0,0 +1,57 @@ +/* vxsimHostArchLib.h - Windows/VxSim interface header */ + +/* Copyright 2003-2005 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01h,19jan05,jmp removed vxsimHostMailslot* +01g,13oct03,jeg removed vxsimHostFileNReadGet () prototype. +01f,30jul03,jmp remove buffer managements routine specific to Ulip. +01e,30apr03,dbt Moved timestamp code to vxsimHostLib.h. +01d,04apr03,jmp reworked vxsimHostMailslotInit() to fix system mode. +01c,04apr03,jeg moved common routine definitions to target/h/vxsimHostLib.h +01b,25mar03,jeg Adapted to common Unix/Windws passFs +01b,25mar03,jmp added vxsimHostConsoleSioIntInit. +01a,30jan03,jmp written. +*/ + +#ifndef __INCvxsimHostArchLibh +#define __INCvxsimHostArchLibh + +/* includes */ + +#include "passFsLib.h" +#include "stat.h" + +/* defines */ + +/* externals */ + +/* function declarations */ + +extern STATUS vxsimHostVxWorksInstrCacheFlush (void * address, UINT32 size); +extern void vxsimHostConsoleFlush (void); +extern void vxsimHostConsoleSioIntInit (int intVecNum); +extern void vxsimHostPuts (char * string); +extern void vxsimHostPutc (char character); +extern void vxsimHostIntHandlingModeSet (BOOL mode); +extern STATUS vxsimHostUlipInit (int ulipIfNum, + int ulipDeviceNum, + int ulipIntVec, + int ** ppSimUlipRcvCount, + int ** ppSimUlipReadCount); +extern int vxsimHostUlipWrite (int ulipIfNum, char * pBuf, + int length); +extern void vxsimHostUlipStop (int ulipIfNum); +extern int vxsimHostUlipIpAddrGet (char * ulipIpAddr); +extern int vxsimHostTimerRateGet (int clk); +extern void vxsimHostTimerEnable (int clk); +extern STATUS vxsimHostTimerRateSet (int clk, int ticksPerSecond); +extern char * vxsimHostBootFileNameGet (void); +extern void vxsimHostDbg (char * format, ...); +extern void vxsimHostDebugBreak (void); +extern void vxsimHostCriticalSectionEnter (UINT32 * pCriticalSection); +extern void vxsimHostCriticalSectionLeave (UINT32 * pCriticalSection); +#endif /* __INCvxsimHostArchLibh */ diff --git a/h/arch/simsolaris/archSimsolaris.h b/h/arch/simsolaris/archSimsolaris.h new file mode 100644 index 0000000..cdf49cb --- /dev/null +++ b/h/arch/simsolaris/archSimsolaris.h @@ -0,0 +1,114 @@ +/* archSimsolaris.h - simsparc specific header */ + +/* + * Copyright 1993-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +01y,12apr05,kk remove _WRS_OBJLIB_SUPPORT_VERIFY_TRAP macro (SPR# 106486) +01x,31mar05,elp added _ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK macro +01w,27aug04,dbt Added _WRS_OBJLIB_SUPPORT_VERIFY_TRAP. +01v,17may04,tam removed _WRS_KERNEL_TEXT_START_ADRS definition +01u,14may04,jmp removed upsolete stuff. +01t,22apr04,jmp added macros for getting frame and return PC from a jmp_buf. +01s,25feb04,aeg moved _WRS_PAL_COPROC_LIB to archSimsolarisCommon.h +01r,22jan04,dbt Added support for GNU compiler. +01q,02dec03,dbt Updated power management support. +01p,14nov03,job Moved blib stuff to archSimsolarisCommon.h +01o,13nov03,pes Add include of common header file. +01n,23sep03,dbt Use new B6 scheduler. +01m,18aug03,dbt Added PAL spuport for VxSim. +01l,22jul03,kam removed define of WV_INSTRUMENTATION +01k,19jun03,dbt Added support for DCC. +01j,31may01,jmp removed _WRS_NO_EXC_STACK_USED definition. + Added _WRS_ARCH_IS_SIMULATOR. + Added define for PAL-ified cache library. +01i,12feb01,hbh Removed _WRS_NO_OVERLAPPING_MODEL and NO_SL_DATA_SUPPORT + flags definition (SPR 64073) +01h,26may00,rlp added _WRS_NO_EXC_STACK_USED macro. +01g,19apr00,hbh Added _WRS_NO_OVERLAPPING_MODEL macro. +01f,17apr00,cjj defined NO_SL_DATA_SUPPORT +01e,13apr00,hbh added WV_INSTRUMENTATION +01d,23dec99,cjj removed WV_INSTRUMENTATION for T3 development. +01c,29jul98,ms added WV_INSTRUMENTATION +01b,16dec96,yp va_start now passes LASTARG to builtin_next_arg +01a,07jun95,ism derived from simsparc +*/ + +#ifndef __INCarchSimsolarish +#define __INCarchSimsolarish + +#ifdef __cplusplus +extern "C" { +#endif + +#define _ALLOC_ALIGN_SIZE 8 /* 8-byte alignment */ +#define _STACK_ALIGN_SIZE 8 /* 8-byte alignment */ + +#define _DYNAMIC_BUS_SIZING FALSE /* no dynamic bus sizing */ + +#define _WRS_ARCH_IS_SIMULATOR /* This is a simulator */ + +#define _ARCH_SUPPORTS_DCC /* DCC compiler is supported on this arch. */ +#define _ARCH_SUPPORTS_GCC /* GCC compiler is supported on this arch. */ + +/* Used in usrDepend.c and usrKernelStack.c */ + +#define _ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK + +/* moved here from h/private/javaLibP.h */ + +#define JAVA_C_SYM_PREFIX "" + +#ifndef _ASMLANGUAGE +/* macros for getting frame and return PC from a jmp_buf */ + +#define _WRS_FRAMEP_FROM_JMP_BUF(env) ((char *) (env)[0].reg.reg_sp) +#define _WRS_RET_PC_FROM_JMP_BUF(env) ((INSTR *) (env)[0].reg.reg_pc) + +#endif /* _ASMLANGUAGE */ + +/* from loadElfLib.c */ + +#define _WRS_USE_ELF_LOAD_FORMAT + +/* from xdr_float.c */ + +#define FLOAT_NORM + +/* from qPriBMapLib.c */ + +#define qPriBMapLib_PORTABLE + +/* from ffsLib.c */ + +#define ffsLib_PORTABLE + +/* from schedLib.c */ + +#define _WRS_VXLIB_SUPPORT + +#define _WRS_BASE6_SCHEDULER +#define _WRS_ENABLE_IDLE_INTS + +/* from spyLib.c */ + +#define _WRS_SPY_TASK_SIZE 10000 + +/* End PAL */ + +#include "arch/simsolaris/archSimsolarisCommon.h" + +#ifdef __cplusplus +} +#endif + +#endif /* __INCarchSimsolarish */ diff --git a/h/arch/simsolaris/archSimsolarisCommon.h b/h/arch/simsolaris/archSimsolarisCommon.h new file mode 100644 index 0000000..d115669 --- /dev/null +++ b/h/arch/simsolaris/archSimsolarisCommon.h @@ -0,0 +1,83 @@ +/* archSimsolarisCommon.h - common Simsolaris architecture specific header */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,13may04,zl enabled user-side trace. +01e,22apr04,jmp added support for portable trcLib. + Moved INSTR definitions from archSimsolaris.h. +01d,25feb04,aeg added _WRS_PAL_COPROC_LIB +01c,24dec03,jeg added SYSCALL_TRAP_HANDLE_INIT and SYSCALL_SF macros. +01b,12nov03,job Moved blib stuff from archSimsolaris.h +01a,11nov03,pes written. +*/ + +#ifndef __INCarchSimsolarisCommonh +#define __INCarchSimsolarisCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +/* from bLib.c */ + +#undef _WRS_BLIB_OPTIMIZED +#undef _WRS_SWAB_OPTIMIZED +#define swab_PORTABLE +#define _WRS_BLIB_ALIGNMENT 3 /* quad byte alignment mask */ + +/* + * SYSCALL_TRAP_HANDLE_INIT - system call trap magic number + * + * On VxSim, the system call infrastucture is based on a mechanism to directly + * call kernel services from RTP via the syscallTrapHandle() routine. + * Since the RTP does not have access to syscallTrapHandle() routine, each RTP + * contains a function pointer _func_syscallTrapHandle which is initialized to + * an invalid address: SYSCALL_TRAP_HANDLE_INIT. On the first system call + * performed by the RTP, an exception will be generated, the exception + * handling will invoke syscallTrapHandlerInit() if installed, and + * syscallTrapHandlerInit() will fix _func_syscallTrapHandle to point to + * syscallTrapHandle(). + */ + +#define SYSCALL_TRAP_HANDLE_INIT 0x1234 + +/* + * stack frame size used for syscall routines. The size is bigger than the + * STACK_FRAME_SIZE usually used since we have 8 parameters to manage. So it + * requires additional space into stack frame to store parameters 7 and 8. + */ + +#define SYSCALL_SF 0x80 + +/* + * Parameters 1 to 6 are located into %i0 to %i5 registers, the + * others are located into stack. Define offset of paameters 7 + * 8 into the stack. + */ + +#define PARAM7 0x5c +#define PARAM8 0x60 +#define PARAM9 0x64 + +/* Enable Coprocessor Abstraction */ + +#define _WRS_PAL_COPROC_LIB + +/* Enable portable trcLib */ + +#define trcLib_PORTABLE +#define _WRS_TRC_ARGS_COUNT 6 /* number of arguments to print in */ + +#ifndef _ASMLANGUAGE +typedef unsigned long INSTR; /* 32 bit word-aligned instructions */ +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCarchSimsolarisCommonh */ + diff --git a/h/arch/simsolaris/asmSimsolaris.h b/h/arch/simsolaris/asmSimsolaris.h new file mode 100644 index 0000000..09ac40d --- /dev/null +++ b/h/arch/simsolaris/asmSimsolaris.h @@ -0,0 +1,58 @@ +/* asmSimsolaris.h - VxSim/Solaris assembler definitions header */ + +/* Copyright 1993-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,05mar03,jeg Updated __INC macro +01d,23feb00,bwa put back TRUE and FALSE. for them to be initialized, + _ASMLANGUAGE has to be defined in the file were this file + is included +01c,01feb00,bwa replaced TRUE and FALSE by 1 and 0 since they are not defined + here +01b,01dec99,aeg added FUNC, FUNC_LABEL, GTEXT, and GDATA macros. +01a,07jun95,ism derived from simsparc +*/ + +#ifndef __INCasmSimsolaris +#define __INCasmSimsolaris + + +/* + * The LEADING_UNDERSCORE macro should be defined to TRUE for toolchains + * that do NOT prefix a leading underscore character, i.e. "_", to + * symbols. Define the macro to FALSE when using a toolchain that + * does add a leading underscore character to symbols. + */ + +#define LEADING_UNDERSCORE FALSE + +#if (LEADING_UNDERSCORE == TRUE) +#define FUNC(func) _##func +#define FUNC_LABEL(func) _##func: +#else +#define FUNC(func) func +#define FUNC_LABEL(func) func: +#endif + + +/* + * The GTEXT and GDATA macros should be used to ensure the proper + * symbol type is associated with a function or data label. This + * is an ELFism. + */ + +#define GTEXT(sym) FUNC(sym) ; .type FUNC(sym),@function +#define GDATA(sym) FUNC(sym) ; .type FUNC(sym),@object + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCasmSimsolaris*/ diff --git a/h/arch/simsolaris/compilerError13053 b/h/arch/simsolaris/compilerError13053 new file mode 100644 index 0000000..e69de29 diff --git a/h/arch/simsolaris/compilerError23367 b/h/arch/simsolaris/compilerError23367 new file mode 100644 index 0000000..e69de29 diff --git a/h/arch/simsolaris/coprocSimsolaris.h b/h/arch/simsolaris/coprocSimsolaris.h new file mode 100644 index 0000000..f67cce7 --- /dev/null +++ b/h/arch/simsolaris/coprocSimsolaris.h @@ -0,0 +1,32 @@ +/* coprocSimsolaris.h - coprocessor management library header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,19aug04,dbt Written +*/ + +#ifndef __INCcoprocSimsolarish +#define __INCcoprocSimsolarish + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "taskLib.h" + +/* defines */ + +#define VX_FP_TASK VX_COPROC1_TASK + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcoprocSimsolarish */ diff --git a/h/arch/simsolaris/dbgSimsolarisLib.h b/h/arch/simsolaris/dbgSimsolarisLib.h new file mode 100644 index 0000000..c82c902 --- /dev/null +++ b/h/arch/simsolaris/dbgSimsolarisLib.h @@ -0,0 +1,52 @@ +/* dbgSimsolarisLib.h - simsolaris debugger header */ + +/* Copyright 1993-2004 Wind River Systems, Inc. */ + +/* +modification history +------------------- +01h,11feb04,elg Add syscall instruction size macro. +01g,24jun03,jmp code cleanup. +01f,24jan03,jeg add Destination Register definition +01e,20jan03,jeg Merged T22-CP1 : INST_SAV and INST_SAV_MASK Macros value + updated +01d,13sep00,mlg added INST_SAV +01c,03mar00,elg Add _wdbDbgCtxSetup() to support system mode. +01b,29dec97,dbt modified for new breakpoint scheme +01a,07jun95,ism derived from simsparc +*/ + +#ifndef __INCdbgSimsolarisLibh +#define __INCdbgSimsolarisLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "excLib.h" +#include "arch/simsolaris/dsmSimsolarisLib.h" + +/* defines */ + +#define DBG_NO_SINGLE_STEP 1 +#define DBG_BREAK_INST 0x91d02001 + +#define DBG_SYSCALL_SIZE ((2 * sizeof (INSTR)) / sizeof (INSTR)) + +#define INST_SAV 0x9de3b000 +#define INST_SAV_MASK 0xfffff000 + +#define INST_CALL OP_1 +#define INST_CALL_MASK OP +#define JMPL_o7 (OP_2 + RD_o7 + OP3_38) +#define JMPL_o7_MASK (OP + DR + OP3) + +#define I7_OFFSET 0x0f /* offset from base of stack, in ints */ +#define I7_CONTENTS(sp) ((INSTR *)*(sp + I7_OFFSET)) +#ifdef __cplusplus +} +#endif + +#endif /* __INCdbgSimsolarisLibh */ diff --git a/h/arch/simsolaris/dsmSimsolarisLib.h b/h/arch/simsolaris/dsmSimsolarisLib.h new file mode 100644 index 0000000..b613e69 --- /dev/null +++ b/h/arch/simsolaris/dsmSimsolarisLib.h @@ -0,0 +1,64 @@ +/* dsmSparcLib.h - header for Sparc disassembler library */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01m,10may04,dbt updated prototypes for dsmData() and dsmInst() +01l,22apr04,jmp move instruction fields to instrSparc.h. +01k,15mar96,dat changed RD to DR, name conflict with streams pkg +01j,22sep92,rrr added support for c++ +01i,26may92,jwt upgraded to SPARC Version 8. +01h,26may92,rrr the tree shuffle +01g,09jan92,jwt added ANSI function prototypes. +01f,19dec91,jwt passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01e,27apr89,mcl changed to dsmSparcLib.h; changes trap mask. +01d,07apr89,mcl adds more SHIFT_CT fields; changes OPC to OPFC; bug in RS1_i4. +01c,06apr89,mcl adds f[x] fields. +01b,05apr89,mcl adds itClr and itClrAsi. +01a,05aug88,mcl written by adapting version 01j of 26oct87 of dsmLib.h. +*/ + +#ifndef __INCdsmSparcLibh +#define __INCdsmSparcLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "arch/simsolaris/instrSparc.h" + + +/* dsmLib status codes */ + +#define S_dsmLib_UNKNOWN_INSTRUCTION (M_dsmLib | 1) + +/* + * The following structure is not size compatible with the + * one for the Motorola 68k family due to changed word size. + */ + +typedef struct + { + char * name; + unsigned long op; + unsigned long mask; + int type; + } INST; + +/* function declarations */ + +IMPORT int dsmData (INSTR * binInst, unsigned int address, + FUNCPTR oFn, int oArg); +IMPORT int dsmInst (FAST INSTR * binInst, unsigned int address, + VOIDFUNCPTR prtAddress, FUNCPTR oFn, int oArg); +IMPORT int dsmNbytes (FAST INSTR *binInst); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdsmSparcLibh */ diff --git a/h/arch/simsolaris/elfSparc.h b/h/arch/simsolaris/elfSparc.h new file mode 100644 index 0000000..8ea149e --- /dev/null +++ b/h/arch/simsolaris/elfSparc.h @@ -0,0 +1,112 @@ +/* elfSparc.h - SPARC ABI header file used by ld, ar, as & loaders */ + +/* + * Copyright (c) 2004 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software may be + * licensed only pursuant to the terms of an applicable Wind River license + * agreement. + */ + +/* +modification history +-------------------- +01e,25jul05,v_r Updated copyright. +01d,18sep04,jn Move towards shared code for host and target loaders +01c,20jun03,nwd Deliver of Tornado 2.2 Cumulative Patch 1 +01a,30apr03,jn Derived from Diab version of elf_sparc.h. + /vobs/rome_diab_lib/dlib/include/include.unx/ + elf_sparc.h@@/main/1 + and /.wind_vxw_h/river/target/h/vxWorks.h@@/main/tor2/1 + (for elements of Wind River coding standards). + Moved definitions of N_* macros here. +*/ + +#ifndef __INCelfSparch +#define __INCelfSparch + +#ifdef __cplusplus +extern "C" { +#endif + +#define EM_ARCH_MACHINE EM_SPARC + +#ifndef EM_ARCH_MACH_ALT /* defaults to EM_ARCH_MACHINE */ +#define EM_ARCH_MACH_ALT EM_ARCH_MACHINE +#endif + + +/* + * Note entry header + */ + +typedef struct + { + Elf32_Word n_namesz; /* length of note's name */ + Elf32_Word n_descsz; /* length of note's "desc" */ + Elf32_Word n_type; /* type of note */ + } Elf32_Nhdr; + +/* + * Known values for note entry types (e_type == ET_CORE) + */ + +#define NT_PRSTATUS 1 +#define NT_PRFPREG 2 +#define NT_PRPSINFO 3 + +/************** Exported data, types and macros *****************/ + +/* + * Relocation types + */ + +#define R_SPARC_FIRST 0 + +#define R_SPARC_NONE 0 /* relocation type */ +#define R_SPARC_8 1 +#define R_SPARC_16 2 +#define R_SPARC_32 3 +#define R_SPARC_DISP8 4 +#define R_SPARC_DISP16 5 +#define R_SPARC_DISP32 6 +#define R_SPARC_WDISP30 7 +#define R_SPARC_WDISP22 8 +#define R_SPARC_HI22 9 +#define R_SPARC_22 10 +#define R_SPARC_13 11 +#define R_SPARC_LO10 12 +#define R_SPARC_GOT10 13 +#define R_SPARC_GOT13 14 +#define R_SPARC_GOT22 15 +#define R_SPARC_PC10 16 +#define R_SPARC_PC22 17 +#define R_SPARC_WPLT30 18 +#define R_SPARC_COPY 19 +#define R_SPARC_GLOB_DAT 20 +#define R_SPARC_JMP_SLOT 21 +#define R_SPARC_RELATIVE 22 +#define R_SPARC_UA32 23 +#define R_SPARC_NUM 24 /* must be >last */ + +typedef enum /* RTYPE_SPARC - sparc relocation types */ + { + RELOC_8, RELOC_16, RELOC_32, /* simplest relocs */ + RELOC_DISP8, RELOC_DISP16, RELOC_DISP32, /* Disp's (pc-rel) */ + RELOC_WDISP30, RELOC_WDISP22, /* SR word disp's */ + RELOC_HI22, RELOC_22, /* SR 22-bit relocs */ + RELOC_13, RELOC_LO10, /* SR 13&10-bit relocs*/ + RELOC_SFA_BASE, RELOC_SFA_OFF13, /* SR S.F.A. relocs */ + RELOC_BASE10, RELOC_BASE13, RELOC_BASE22, /* base_relative pic */ + RELOC_PC10, RELOC_PC22, /* special pc-rel pic */ + RELOC_JMP_TBL, /* jmp_tbl_rel in pic */ + RELOC_SEGOFF16, /* ShLib offset-in-seg*/ + RELOC_GLOB_DAT, RELOC_JMP_SLOT, RELOC_RELATIVE /* rtld relocs */ + } RTYPE_SPARC; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCelfSparch */ + diff --git a/h/arch/simsolaris/esfSimsolaris.h b/h/arch/simsolaris/esfSimsolaris.h new file mode 100644 index 0000000..99629a2 --- /dev/null +++ b/h/arch/simsolaris/esfSimsolaris.h @@ -0,0 +1,39 @@ +/* esfSimsparc.h - simsparc exception stack frame */ + +/* Copyright 1993-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,07jun95,ism derived from simsparc +*/ + +#ifndef __INCesfSimsparch +#define __INCesfSimsparch + +#ifdef __cplusplus +extern "C" { +#endif + +#include "regs.h" +#include "excLib.h" + +#define ESF EXC_INFO + +/* Overflow/Underflow Stack Frame */ + +#define STACK_FRAME 0x00 /* Stack Frame */ +#define SF_LOCALS (STACK_FRAME + 0x00) /* Local Registers */ +#define SF_INS (STACK_FRAME + 0x20) /* In Registers */ +#define SF_SPARE (STACK_FRAME + 0x5C) /* Spare Slot */ +#define STACK_FRAME_SIZE 0x60 + + +#define INIT_STACK_FRAME STACK_ROUND_UP ((((MAX_TASK_ARGS - 6) \ + * sizeof (int)) + (STACK_FRAME_SIZE - 4))) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCesfSimsparch */ diff --git a/h/arch/simsolaris/excSimsolarisLib.h b/h/arch/simsolaris/excSimsolarisLib.h new file mode 100644 index 0000000..47b1415 --- /dev/null +++ b/h/arch/simsolaris/excSimsolarisLib.h @@ -0,0 +1,51 @@ +/* excSimsolaris.h - simsolaris exception library header */ + +/* Copyright 1993-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,10mar04,dbt Fixed _WRS_IS_SUP_EXC() macro. +01c,09feb04,jmp added _WRS_IS_SUPV_EXC() macro. +01b,21oct03,jmp file cleanup. +01a,07jun95,ism derived from simsparc +*/ + +#ifndef __INCexcSimsolarisLibh +#define __INCexcSimsolarisLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* defines */ + +#define _WRS_IS_SUPV_EXC() VXSIM_SUP_MODE_GET(pRegs->reg_status) + +/* variable declarations */ + +extern FUNCPTR excExcepHook; /* add'l rtn to call when exceptions occur */ + +/* typedefs */ + +typedef struct + { + UINT32 valid; /* Indicators that following fields are valid */ + UINT32 pc; /* Program counter */ + UINT32 npc; /* Next program counter */ + UINT32 ps; /* Processor status */ + UINT32 sig; /* signal number */ + UINT32 code; /* Signal code */ + UINT32 addr; /* Memory location which caused fault */ + UINT32 ptcb; + } EXC_INFO; + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCexcSimsolarisLibh */ diff --git a/h/arch/simsolaris/fppSimsolarisLib.h b/h/arch/simsolaris/fppSimsolarisLib.h new file mode 100644 index 0000000..361a7ba --- /dev/null +++ b/h/arch/simsolaris/fppSimsolarisLib.h @@ -0,0 +1,189 @@ +/* fppSimSolarisLib.h - Solaris VxSim floating-point header */ + +/* Copyright (c) 1985 by Sun Microsystems, Inc. */ + +/* Copyright 1993-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,21aug03,dbt Added FPSR macros. +01c,19aug03,dbt Added PAL support. +01b,19mar03,dbt Fixed fp status register offset. +01a,07jun95,ism derived from simsparc +*/ + +#ifndef __INCfppSimsolarisLibh +#define __INCfppSimsolarisLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + +/* + * Definition of bits in the Sun-4 FSR (Floating-point Status Register) + * _____________________________________________________________ + * | RD | RP | TEM | res | FTT | QNE | PR | FCC | AEXC | CEXC | + * |-----|---- |-----|------|-----|-----|----|-----|------|------| + * 31 30 29 28 27 23 22 17 16 14 13 12 11 10 9 5 4 0 + */ + +#define FSR_CEXC 0x0000001f /* Current Exception */ +#define FSR_AEXC 0x000003e0 /* ieee accrued exceptions */ +#define FSR_FCC 0x00000c00 /* Floating-point Condition Codes */ +#define FSR_PR 0x00001000 /* Partial Remainder */ +#define FSR_QNE 0x00002000 /* Queue not empty */ +#define FSR_FTT 0x0001c000 /* Floating-point Trap Type */ +#define FSR_VER 0x000E0000 /* Version */ +#define FSR_RESV 0x007e0000 /* reserved */ +#define FSR_TEM 0x0f100000 /* ieee Trap Enable Mask */ +#define FSR_RP 0x30000000 /* Rounding Precision */ +#define FSR_RD 0xc0000000 /* Rounding Direction */ + +#define FSR_AEXC_SHIFT 5 /* shift needed for ieee accrued exceptions */ +#define FSR_FCC_SHIFT 10 /* shift needed for Floating-point Condition Codes */ +#define FSR_FTT_SHIFT 14 /* shift needed for trap type */ +#define FSR_TEM_SHIFT 23 /* shift needed for ieee Trap Enable Mask */ +#define FSR_RP_SHIFT 28 /* shift needed for Rounding Precision */ +#define FSR_RD_SHIFT 30 /* shift needed for Rounding Direction */ + +/* + * Definition of CEXC (Current EXCeption) bit field of fsr + */ +#define FSR_CEXC_NX 0x00000001 /* inexact */ +#define FSR_CEXC_DZ 0x00000002 /* divide-by-zero */ +#define FSR_CEXC_UF 0x00000004 /* underflow */ +#define FSR_CEXC_OF 0x00000008 /* overflow */ +#define FSR_CEXC_NV 0x00000010 /* invalid */ + +/* + * Definition of AEXC (Accrued EXCeption) bit field of fsr + */ +#define FSR_AEXC_NX (0x1 << 5) /* inexact */ +#define FSR_AEXC_DZ (0x2 << 5) /* divide-by-zero */ +#define FSR_AEXC_UF (0x4 << 5) /* underflow */ +#define FSR_AEXC_OF (0x8 << 5) /* overflow */ +#define FSR_AEXC_NV (0x10 << 5) /* invalid */ + +/* + * Definition of FCC (Floating-point Condition Code) field within the FSR + */ +#define FCC_EQUAL 0 /* equal */ +#define FCC_LT 1 /* less than */ +#define FCC_GT 2 /* greater than */ +#define FCC_UNORD 3 /* unordered */ +#define FSR_FCC_EQUAL (FCC_EQUAL << FSR_FCC_SHIFT) +#define FSR_FCC_LT (FCC_LT << FSR_FCC_SHIFT) +#define FSR_FCC_GT (FCC_GT << FSR_FCC_SHIFT) +#define FSR_FCC_UNORD (FCC_UNORD << FSR_FCC_SHIFT) + +/* + * Definition of FTT (Floating-point Trap Type) field within the FSR + */ +#define FTT_NONE 0 /* no exceptions */ +#define FTT_IEEE 1 /* IEEE exception */ +#define FTT_UNFIN 2 /* unfinished fpop */ +#define FTT_UNIMP 3 /* unimplemented fpop */ +#define FTT_SEQ 4 /* sequence error */ +#define FTT_ALIGN 5 /* alignment, by software convention */ +#define FTT_DFAULT 6 /* data fault, by software convention */ +#define FSR_FTT_IEEE (FTT_IEEE << FSR_FTT_SHIFT) +#define FSR_FTT_UNFIN (FTT_UNFIN << FSR_FTT_SHIFT) +#define FSR_FTT_UNIMP (FTT_UNIMP << FSR_FTT_SHIFT) +#define FSR_FTT_SEQ (FTT_SEQ << FSR_FTT_SHIFT) +#define FSR_FTT_ALIGN (FTT_ALIGN << FSR_FTT_SHIFT) +#define FSR_FTT_DFAULT (FTT_DFAULT << FSR_FTT_SHIFT) + +/* + * Definition of TEM (Trap Enable Mask) bit field of fsr + */ +#define FSR_TEM_NX (0x1 << 23) /* inexact */ +#define FSR_TEM_DZ (0x2 << 23) /* divide-by-zero */ +#define FSR_TEM_UF (0x4 << 23) /* underflow */ +#define FSR_TEM_OF (0x8 << 23) /* overflow */ +#define FSR_TEM_NV (0x10 << 23) /* invalid */ + +/* + * Definition of RP (Rounding Precision) field of fsr + */ +#define RP_DBLEXT 0 /* double-extended */ +#define RP_SINGLE 1 /* single */ +#define RP_DOUBLE 2 /* double */ +#define RP_RESERVED 3 /* unused and reserved */ + +/* + * Definition of RD (Rounding Direction) field of fsr + */ +#define RD_NEAR 0 /* nearest or even if tie */ +#define RD_ZER0 1 /* to zero */ +#define RD_POSINF 2 /* positive infinity */ +#define RD_NEGINF 3 /* negative infinity */ + +/* Number of floating point data registers */ + +#define FP_NUM_DREGS 16 /* Floating-Point Data Registers */ + +/* equates for fppState, fpstate */ + +#define UNKNOWN 0x00 /* default */ +#define FPU_TESTED 0x01 /* set by fppProbe */ +#define FPU_TESTED_TRUE 0x02 /* set by fppProbe */ +#define FPU_TESTED_FALSE 0x00 /* set by fppProbe */ +#define FPU_AVAILABLE (FPU_TESTED + FPU_TESTED_TRUE) +#define NO_FPU_AVAILABLE (FPU_TESTED + FPU_TESTED_FALSE) + +#ifndef _ASMLANGUAGE + +typedef struct fpContext /* Floating-Point Context */ + { + double fpd[FP_NUM_DREGS]; /* Data Registers */ + unsigned int fsr; /* Status Register */ + } FP_CONTEXT; + +#define FPREG_SET FP_CONTEXT + +/* variable declarations */ + +extern REG_INDEX fpRegName[]; /* f-point data register table */ +extern REG_INDEX fpCtlRegName[]; /* f-point control register table */ +extern WIND_TCB *pFppTaskIdPrevious; /* task id for deferred exceptions */ +extern FUNCPTR fppCreateHookRtn; /* arch dependent create hook routine */ +extern FUNCPTR fppDisplayHookRtn; /* arch dependent display routine */ + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void fppNan (FP_CONTEXT *pFpContext, ULONG fppFsr); +extern FP_CONTEXT * fppCtxCreate (int tid); +extern STATUS fppCtxDelete (FP_CONTEXT * pCtx); +extern void fppCtxShow (FP_CONTEXT * pFpContext); +extern STATUS fppEnable (void); +extern STATUS fppDisable (void); + +#else + +extern void fppNan (); +extern FP_CONTEXT * fppCtxCreate (); +extern STATUS fppCtxDelete (); +extern void fppCtxShow (); +extern STATUS fppEnable (); +extern STATUS fppDisable (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#define FP_DATA 0x0 /* Data Registers */ +#define FPD(n) (FP_DATA + (4 * (n))) +#define FP_QUEUE (FPD(FP_NUM_DREGS*2)) /* Q Registers (dword aligned)*/ +#define FSR (FP_QUEUE) /* Status Register */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfppSimsolarisLibh */ diff --git a/h/arch/simsolaris/in_cksum.h b/h/arch/simsolaris/in_cksum.h new file mode 100644 index 0000000..25291a9 --- /dev/null +++ b/h/arch/simsolaris/in_cksum.h @@ -0,0 +1,176 @@ +/* in_cksum.h - x86 version in_cksum header file */ + +/* Copyright 2001-2002 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from tahoe: in_cksum.c 1.2 86/01/05 + * from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91 + * from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp + * $FreeBSD: src/sys/i386/include/in_cksum.h,v 1.7.2.1 2000/05/05 13:37:00 jlemon Exp $ + */ + +/* +modification history +-------------------- +01f,25aug05,dlk Add section tags. +01e,24mar04,m_h INternet Checksum +01d,20nov03,niq Remove copyright_wrs.h file inclusion +01c,15nov03,rp updating header file path +01b,25jul02,rvr removed DCC specific code +01a,13sep01,hsh Created from BSD 4.3 +*/ + + +#ifndef _MACHINE_IN_CKSUM_H_ +#define _MACHINE_IN_CKSUM_H_ 1 + +#include + +/* + * in_cksum_hdr - checksum on header only + * + * It is useful to have an Internet checksum routine which is inlineable + * and optimized specifically for the task of computing IP header checksums + * in the normal case (where there are no options and the header length is + * therefore always exactly five 32-bit words. + */ + +static __inline +u_int in_cksum_hdr + ( + const struct ip *ip + ) + { + register u_int sum = 0; + int hlen = sizeof (struct ip); + register u_short *w = (u_short *) ip; + u_short remaining = 0; + + while (hlen > 1) + { + sum += *w++; + hlen -= 2; + } + + if (hlen == 1) + { + *(u_char *) (&remaining) = *(u_char *) w; + sum += remaining; + } + + sum = (sum & 0xffff) + (sum >> 16); + if (sum > 0xffff) + sum -= 0xffff; + + return ~sum & 0xffff; + } + +/* + * in_cksum_update + */ + +static __inline +void in_cksum_update + ( + struct ip *ip + ) + { + int __tmpsum; + __tmpsum = (int)ntohs(ip->ip_sum) + 256; + ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); + } + +/* + * in_pseudo - pre-checksum parts of pseudo-header + * + * Compute significant parts of the IPv4 checksum pseudo-header * for use in a + * delayed TCP/UDP checksum calculation. + * + * Args: + * + * src Source IP address + * dst Destination IP address + * lenproto htons(proto-hdr-len + proto-number) + */ + +static __inline +u_int16_t in_pseudo + ( + u_int32_t src, + u_int32_t dst, + u_int32_t lenproto + ) + { + u_int32_t sum; + + sum = lenproto + + (u_int16_t)(src >> 16) + + (u_int16_t)(src /*& 0xffff*/) + + (u_int16_t)(dst >> 16) + + (u_int16_t)(dst /*& 0xffff*/); + + sum = (u_int16_t)(sum >> 16) + (u_int16_t)(sum /*& 0xffff*/); + + if (sum > 0xffff) + sum -= 0xffff; + + return (sum); + } + +/* + * in_addword - Add two 16-bit workd + * + * Add the two 16-bit network-order values, carry, and return. + */ + +static __inline +u_int16_t in_addword + ( + u_int16_t a, + u_int16_t b + ) + { + u_int32_t sum = a + b; + + if (sum > 0xffff) + sum -= 0xffff; + + return (sum); + } + +_WRS_FASTTEXT +u_short in_cksum_skip(struct mbuf *m, int len, int skip); + +#endif /* _MACHINE_IN_CKSUM_H_ */ + diff --git a/h/arch/simsolaris/instrSparc.h b/h/arch/simsolaris/instrSparc.h new file mode 100644 index 0000000..d068c73 --- /dev/null +++ b/h/arch/simsolaris/instrSparc.h @@ -0,0 +1,1006 @@ +/* instrSparc.h - header for Sparc instruction fields */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01a,22apr04,jmp moved Sparc instruction fields form dsmSparc.h. +*/ + +#ifndef __INCinstrSparch +#define __INCinstrSparch + +/* instruction fields */ + +/* instruction fields: opcode masks */ + +#define OP 0xC0000000 /* general opcode */ +#define OP2 0x01C00000 /* op2 opcode */ +#define OP3 0x01F80000 /* op3 opcode */ +#define OPFC 0x00003FE0 /* floating point or other */ + /* coprocessor opcode */ + +/* instruction fields: register masks */ + +#define DR 0x3E000000 /* destination register */ +#define RS1 0x0007C000 /* source register 1 */ +#define RS2 0x0000001F /* source register 2 */ + +/* instruction fields: constant masks */ + +#define DISP30 0x3FFFFFFF /* 30-bit sign-extended word */ + /* displacement */ +#define DISP22 0x003FFFFF /* 22-bit sign-extended word */ + /* displacement */ +#define DISP22_SIGN 0x00200000 /* 22-bit sign */ +#define CONST22 0x003FFFFF /* 22-bit constant value */ + /* (structure size) */ +#define IMM22 0x003FFFFF /* 22-bit immediate value */ + /* (result of %hi) */ +#define SIMM13 0x00001FFF /* 13-bit sign-extended immediate */ + /* value */ +#define SIMM13_SIGN 0x00001000 /* 13-bit sign */ +#define LOBITS 0x000003FF /* 10-bit immediate value */ + /* (result of %lo) */ +#define TRAP_NUMBER 0x0000007F /* trap number */ + +/* instruction fields: miscellaneous masks */ + +#define A 0x20000000 /* annul bit */ +#define COND 0x1E000000 /* test condition */ +#define I 0x00002000 /* selects type of second ALU operand */ +#define ASI 0x00001FE0 /* alternate address space indicator */ +#define SHCNT 0x0000001F /* shift count */ + +/* + * instruction fields: opcode, register, constant, and miscellaneous + * shift counts + */ + +#define DISP30_SHIFT_CT 2 /* 30-bit sign-extended word displacement */ +#define DISP22_SHIFT_CT 2 /* 22-bit sign-extended word displacement */ +#define IMM22_SHIFT_CT 10 /* 22-bit immediate value */ + +#define OP_SHIFT_CT 30 /* general opcode */ +#define A_SHIFT_CT 29 /* annul bit */ +#define RD_SHIFT_CT 25 /* destination register */ +#define COND_SHIFT_CT 25 /* test condition */ +#define OP2_SHIFT_CT 22 /* op2 opcode */ +#define OP3_SHIFT_CT 19 /* op3 opcode */ +#define RS1_SHIFT_CT 14 /* source register 1 */ +#define I_SHIFT_CT 13 /* I field */ +#define OPFC_SHIFT_CT 5 /* coprocessor opcode */ +#define ASI_SHIFT_CT 5 /* alternate address space indicator */ + +/* instruction fields: things that don't fit under other categories */ + +#define DISP22_SIGN_EXTEND 0xFFC00000 /* 22-bit sign-extended */ + /* word displacement */ +#define SIMM13_SIGN_EXTEND 0xFFFFE000 /* 13-bit sign-extended */ + /* immediate value */ + +/* instruction fields: opcode equates */ + +#define OP_3 0xC0000000 /* general opcode: load/store */ +#define OP_2 0x80000000 /* general opcode: arithmetic */ +#define OP_1 0x40000000 /* general opcode: Call */ +#define OP_0 0x00000000 /* general opcode: Bicc, FBfcc, */ + /* CBccc, SETHI */ +#define OP2_7 0x01C00000 /* op2 opcode: CBccc */ +#define OP2_6 0x01800000 /* op2 opcode: FBfcc */ +#define OP2_5 0x01400000 /* op2 opcode: (n/i) */ +#define OP2_4 0x01000000 /* op2 opcode: SETHI */ +#define OP2_3 0x00C00000 /* op2 opcode: (n/i) */ +#define OP2_2 0x00800000 /* op2 opcode: Bicc */ +#define OP2_1 0x00400000 /* op2 opcode: (n/i) */ +#define OP2_0 0x00000000 /* op2 opcode: UNIMPlemented */ +#define OP3_3F 0x01F80000 /* op3 opcode */ +#define OP3_3E 0x01F00000 /* op3 opcode */ +#define OP3_3D 0x01E80000 /* op3 opcode */ +#define OP3_3C 0x01E00000 /* op3 opcode */ +#define OP3_3B 0x01D80000 /* op3 opcode */ +#define OP3_3A 0x01D00000 /* op3 opcode */ +#define OP3_39 0x01C80000 /* op3 opcode */ +#define OP3_38 0x01C00000 /* op3 opcode */ +#define OP3_37 0x01B80000 /* op3 opcode */ +#define OP3_36 0x01B00000 /* op3 opcode */ +#define OP3_35 0x01A80000 /* op3 opcode */ +#define OP3_34 0x01A00000 /* op3 opcode */ +#define OP3_33 0x01980000 /* op3 opcode */ +#define OP3_32 0x01900000 /* op3 opcode */ +#define OP3_31 0x01880000 /* op3 opcode */ +#define OP3_30 0x01800000 /* op3 opcode */ +#define OP3_2F 0x01780000 /* op3 opcode */ +#define OP3_2E 0x01700000 /* op3 opcode */ +#define OP3_2D 0x01680000 /* op3 opcode */ +#define OP3_2C 0x01600000 /* op3 opcode */ +#define OP3_2B 0x01580000 /* op3 opcode */ +#define OP3_2A 0x01500000 /* op3 opcode */ +#define OP3_29 0x01480000 /* op3 opcode */ +#define OP3_28 0x01400000 /* op3 opcode */ +#define OP3_27 0x01380000 /* op3 opcode */ +#define OP3_26 0x01300000 /* op3 opcode */ +#define OP3_25 0x01280000 /* op3 opcode */ +#define OP3_24 0x01200000 /* op3 opcode */ +#define OP3_23 0x01180000 /* op3 opcode */ +#define OP3_22 0x01100000 /* op3 opcode */ +#define OP3_21 0x01080000 /* op3 opcode */ +#define OP3_20 0x01000000 /* op3 opcode */ +#define OP3_1F 0x00F80000 /* op3 opcode */ +#define OP3_1E 0x00F00000 /* op3 opcode */ +#define OP3_1D 0x00E80000 /* op3 opcode */ +#define OP3_1C 0x00E00000 /* op3 opcode */ +#define OP3_1B 0x00D80000 /* op3 opcode */ +#define OP3_1A 0x00D00000 /* op3 opcode */ +#define OP3_19 0x00C80000 /* op3 opcode */ +#define OP3_18 0x00C00000 /* op3 opcode */ +#define OP3_17 0x00B80000 /* op3 opcode */ +#define OP3_16 0x00B00000 /* op3 opcode */ +#define OP3_15 0x00A80000 /* op3 opcode */ +#define OP3_14 0x00A00000 /* op3 opcode */ +#define OP3_13 0x00980000 /* op3 opcode */ +#define OP3_12 0x00900000 /* op3 opcode */ +#define OP3_11 0x00880000 /* op3 opcode */ +#define OP3_10 0x00800000 /* op3 opcode */ +#define OP3_0F 0x00780000 /* op3 opcode */ +#define OP3_0E 0x00700000 /* op3 opcode */ +#define OP3_0D 0x00680000 /* op3 opcode */ +#define OP3_0C 0x00600000 /* op3 opcode */ +#define OP3_0B 0x00580000 /* op3 opcode */ +#define OP3_0A 0x00500000 /* op3 opcode */ +#define OP3_09 0x00480000 /* op3 opcode */ +#define OP3_08 0x00400000 /* op3 opcode */ +#define OP3_07 0x00380000 /* op3 opcode */ +#define OP3_06 0x00300000 /* op3 opcode */ +#define OP3_05 0x00280000 /* op3 opcode */ +#define OP3_04 0x00200000 /* op3 opcode */ +#define OP3_03 0x00180000 /* op3 opcode */ +#define OP3_02 0x00100000 /* op3 opcode */ +#define OP3_01 0x00080000 /* op3 opcode */ +#define OP3_00 0x00000000 /* op3 opcode */ +#define OPFC_1FF 0x00003FE0 /* floating point or coproc opcode */ +#define OPFC_1FE 0x00003FC0 /* floating point or coproc opcode */ +#define OPFC_1FD 0x00003FA0 /* floating point or coproc opcode */ +#define OPFC_1FC 0x00003F80 /* floating point or coproc opcode */ +#define OPFC_1FB 0x00003F60 /* floating point or coproc opcode */ +#define OPFC_1FA 0x00003F40 /* floating point or coproc opcode */ +#define OPFC_1F9 0x00003F20 /* floating point or coproc opcode */ +#define OPFC_1F8 0x00003F00 /* floating point or coproc opcode */ +#define OPFC_1F7 0x00003EE0 /* floating point or coproc opcode */ +#define OPFC_1F6 0x00003EC0 /* floating point or coproc opcode */ +#define OPFC_1F5 0x00003EA0 /* floating point or coproc opcode */ +#define OPFC_1F4 0x00003E80 /* floating point or coproc opcode */ +#define OPFC_1F3 0x00003E60 /* floating point or coproc opcode */ +#define OPFC_1F2 0x00003E40 /* floating point or coproc opcode */ +#define OPFC_1F1 0x00003E20 /* floating point or coproc opcode */ +#define OPFC_1F0 0x00003E00 /* floating point or coproc opcode */ +#define OPFC_1EF 0x00003DE0 /* floating point or coproc opcode */ +#define OPFC_1EE 0x00003DC0 /* floating point or coproc opcode */ +#define OPFC_1ED 0x00003DA0 /* floating point or coproc opcode */ +#define OPFC_1EC 0x00003D80 /* floating point or coproc opcode */ +#define OPFC_1EB 0x00003D60 /* floating point or coproc opcode */ +#define OPFC_1EA 0x00003D40 /* floating point or coproc opcode */ +#define OPFC_1E9 0x00003D20 /* floating point or coproc opcode */ +#define OPFC_1E8 0x00003D00 /* floating point or coproc opcode */ +#define OPFC_1E7 0x00003CE0 /* floating point or coproc opcode */ +#define OPFC_1E6 0x00003CC0 /* floating point or coproc opcode */ +#define OPFC_1E5 0x00003CA0 /* floating point or coproc opcode */ +#define OPFC_1E4 0x00003C80 /* floating point or coproc opcode */ +#define OPFC_1E3 0x00003C60 /* floating point or coproc opcode */ +#define OPFC_1E2 0x00003C40 /* floating point or coproc opcode */ +#define OPFC_1E1 0x00003C20 /* floating point or coproc opcode */ +#define OPFC_1E0 0x00003C00 /* floating point or coproc opcode */ +#define OPFC_1DF 0x00003BE0 /* floating point or coproc opcode */ +#define OPFC_1DE 0x00003BC0 /* floating point or coproc opcode */ +#define OPFC_1DD 0x00003BA0 /* floating point or coproc opcode */ +#define OPFC_1DC 0x00003B80 /* floating point or coproc opcode */ +#define OPFC_1DB 0x00003B60 /* floating point or coproc opcode */ +#define OPFC_1DA 0x00003B40 /* floating point or coproc opcode */ +#define OPFC_1D9 0x00003B20 /* floating point or coproc opcode */ +#define OPFC_1D8 0x00003B00 /* floating point or coproc opcode */ +#define OPFC_1D7 0x00003AE0 /* floating point or coproc opcode */ +#define OPFC_1D6 0x00003AC0 /* floating point or coproc opcode */ +#define OPFC_1D5 0x00003AA0 /* floating point or coproc opcode */ +#define OPFC_1D4 0x00003A80 /* floating point or coproc opcode */ +#define OPFC_1D3 0x00003A60 /* floating point or coproc opcode */ +#define OPFC_1D2 0x00003A40 /* floating point or coproc opcode */ +#define OPFC_1D1 0x00003A20 /* floating point or coproc opcode */ +#define OPFC_1D0 0x00003A00 /* floating point or coproc opcode */ +#define OPFC_1CF 0x000039E0 /* floating point or coproc opcode */ +#define OPFC_1CE 0x000039C0 /* floating point or coproc opcode */ +#define OPFC_1CD 0x000039A0 /* floating point or coproc opcode */ +#define OPFC_1CC 0x00003980 /* floating point or coproc opcode */ +#define OPFC_1CB 0x00003960 /* floating point or coproc opcode */ +#define OPFC_1CA 0x00003940 /* floating point or coproc opcode */ +#define OPFC_1C9 0x00003920 /* floating point or coproc opcode */ +#define OPFC_1C8 0x00003900 /* floating point or coproc opcode */ +#define OPFC_1C7 0x000038E0 /* floating point or coproc opcode */ +#define OPFC_1C6 0x000038C0 /* floating point or coproc opcode */ +#define OPFC_1C5 0x000038A0 /* floating point or coproc opcode */ +#define OPFC_1C4 0x00003880 /* floating point or coproc opcode */ +#define OPFC_1C3 0x00003860 /* floating point or coproc opcode */ +#define OPFC_1C2 0x00003840 /* floating point or coproc opcode */ +#define OPFC_1C1 0x00003820 /* floating point or coproc opcode */ +#define OPFC_1C0 0x00003800 /* floating point or coproc opcode */ +#define OPFC_1BF 0x000037E0 /* floating point or coproc opcode */ +#define OPFC_1BE 0x000037C0 /* floating point or coproc opcode */ +#define OPFC_1BD 0x000037A0 /* floating point or coproc opcode */ +#define OPFC_1BC 0x00003780 /* floating point or coproc opcode */ +#define OPFC_1BB 0x00003760 /* floating point or coproc opcode */ +#define OPFC_1BA 0x00003740 /* floating point or coproc opcode */ +#define OPFC_1B9 0x00003720 /* floating point or coproc opcode */ +#define OPFC_1B8 0x00003700 /* floating point or coproc opcode */ +#define OPFC_1B7 0x000036E0 /* floating point or coproc opcode */ +#define OPFC_1B6 0x000036C0 /* floating point or coproc opcode */ +#define OPFC_1B5 0x000036A0 /* floating point or coproc opcode */ +#define OPFC_1B4 0x00003680 /* floating point or coproc opcode */ +#define OPFC_1B3 0x00003660 /* floating point or coproc opcode */ +#define OPFC_1B2 0x00003640 /* floating point or coproc opcode */ +#define OPFC_1B1 0x00003620 /* floating point or coproc opcode */ +#define OPFC_1B0 0x00003600 /* floating point or coproc opcode */ +#define OPFC_1AF 0x000035E0 /* floating point or coproc opcode */ +#define OPFC_1AE 0x000035C0 /* floating point or coproc opcode */ +#define OPFC_1AD 0x000035A0 /* floating point or coproc opcode */ +#define OPFC_1AC 0x00003580 /* floating point or coproc opcode */ +#define OPFC_1AB 0x00003560 /* floating point or coproc opcode */ +#define OPFC_1AA 0x00003540 /* floating point or coproc opcode */ +#define OPFC_1A9 0x00003520 /* floating point or coproc opcode */ +#define OPFC_1A8 0x00003500 /* floating point or coproc opcode */ +#define OPFC_1A7 0x000034E0 /* floating point or coproc opcode */ +#define OPFC_1A6 0x000034C0 /* floating point or coproc opcode */ +#define OPFC_1A5 0x000034A0 /* floating point or coproc opcode */ +#define OPFC_1A4 0x00003480 /* floating point or coproc opcode */ +#define OPFC_1A3 0x00003460 /* floating point or coproc opcode */ +#define OPFC_1A2 0x00003440 /* floating point or coproc opcode */ +#define OPFC_1A1 0x00003420 /* floating point or coproc opcode */ +#define OPFC_1A0 0x00003400 /* floating point or coproc opcode */ +#define OPFC_19F 0x000033E0 /* floating point or coproc opcode */ +#define OPFC_19E 0x000033C0 /* floating point or coproc opcode */ +#define OPFC_19D 0x000033A0 /* floating point or coproc opcode */ +#define OPFC_19C 0x00003380 /* floating point or coproc opcode */ +#define OPFC_19B 0x00003360 /* floating point or coproc opcode */ +#define OPFC_19A 0x00003340 /* floating point or coproc opcode */ +#define OPFC_199 0x00003320 /* floating point or coproc opcode */ +#define OPFC_198 0x00003300 /* floating point or coproc opcode */ +#define OPFC_197 0x000032E0 /* floating point or coproc opcode */ +#define OPFC_196 0x000032C0 /* floating point or coproc opcode */ +#define OPFC_195 0x000032A0 /* floating point or coproc opcode */ +#define OPFC_194 0x00003280 /* floating point or coproc opcode */ +#define OPFC_193 0x00003260 /* floating point or coproc opcode */ +#define OPFC_192 0x00003240 /* floating point or coproc opcode */ +#define OPFC_191 0x00003220 /* floating point or coproc opcode */ +#define OPFC_190 0x00003200 /* floating point or coproc opcode */ +#define OPFC_18F 0x000031E0 /* floating point or coproc opcode */ +#define OPFC_18E 0x000031C0 /* floating point or coproc opcode */ +#define OPFC_18D 0x000031A0 /* floating point or coproc opcode */ +#define OPFC_18C 0x00003180 /* floating point or coproc opcode */ +#define OPFC_18B 0x00003160 /* floating point or coproc opcode */ +#define OPFC_18A 0x00003140 /* floating point or coproc opcode */ +#define OPFC_189 0x00003120 /* floating point or coproc opcode */ +#define OPFC_188 0x00003100 /* floating point or coproc opcode */ +#define OPFC_187 0x000030E0 /* floating point or coproc opcode */ +#define OPFC_186 0x000030C0 /* floating point or coproc opcode */ +#define OPFC_185 0x000030A0 /* floating point or coproc opcode */ +#define OPFC_184 0x00003080 /* floating point or coproc opcode */ +#define OPFC_183 0x00003060 /* floating point or coproc opcode */ +#define OPFC_182 0x00003040 /* floating point or coproc opcode */ +#define OPFC_181 0x00003020 /* floating point or coproc opcode */ +#define OPFC_180 0x00003000 /* floating point or coproc opcode */ +#define OPFC_17F 0x00002FE0 /* floating point or coproc opcode */ +#define OPFC_17E 0x00002FC0 /* floating point or coproc opcode */ +#define OPFC_17D 0x00002FA0 /* floating point or coproc opcode */ +#define OPFC_17C 0x00002F80 /* floating point or coproc opcode */ +#define OPFC_17B 0x00002F60 /* floating point or coproc opcode */ +#define OPFC_17A 0x00002F40 /* floating point or coproc opcode */ +#define OPFC_179 0x00002F20 /* floating point or coproc opcode */ +#define OPFC_178 0x00002F00 /* floating point or coproc opcode */ +#define OPFC_177 0x00002EE0 /* floating point or coproc opcode */ +#define OPFC_176 0x00002EC0 /* floating point or coproc opcode */ +#define OPFC_175 0x00002EA0 /* floating point or coproc opcode */ +#define OPFC_174 0x00002E80 /* floating point or coproc opcode */ +#define OPFC_173 0x00002E60 /* floating point or coproc opcode */ +#define OPFC_172 0x00002E40 /* floating point or coproc opcode */ +#define OPFC_171 0x00002E20 /* floating point or coproc opcode */ +#define OPFC_170 0x00002E00 /* floating point or coproc opcode */ +#define OPFC_16F 0x00002DE0 /* floating point or coproc opcode */ +#define OPFC_16E 0x00002DC0 /* floating point or coproc opcode */ +#define OPFC_16D 0x00002DA0 /* floating point or coproc opcode */ +#define OPFC_16C 0x00002D80 /* floating point or coproc opcode */ +#define OPFC_16B 0x00002D60 /* floating point or coproc opcode */ +#define OPFC_16A 0x00002D40 /* floating point or coproc opcode */ +#define OPFC_169 0x00002D20 /* floating point or coproc opcode */ +#define OPFC_168 0x00002D00 /* floating point or coproc opcode */ +#define OPFC_167 0x00002CE0 /* floating point or coproc opcode */ +#define OPFC_166 0x00002CC0 /* floating point or coproc opcode */ +#define OPFC_165 0x00002CA0 /* floating point or coproc opcode */ +#define OPFC_164 0x00002C80 /* floating point or coproc opcode */ +#define OPFC_163 0x00002C60 /* floating point or coproc opcode */ +#define OPFC_162 0x00002C40 /* floating point or coproc opcode */ +#define OPFC_161 0x00002C20 /* floating point or coproc opcode */ +#define OPFC_160 0x00002C00 /* floating point or coproc opcode */ +#define OPFC_15F 0x00002BE0 /* floating point or coproc opcode */ +#define OPFC_15E 0x00002BC0 /* floating point or coproc opcode */ +#define OPFC_15D 0x00002BA0 /* floating point or coproc opcode */ +#define OPFC_15C 0x00002B80 /* floating point or coproc opcode */ +#define OPFC_15B 0x00002B60 /* floating point or coproc opcode */ +#define OPFC_15A 0x00002B40 /* floating point or coproc opcode */ +#define OPFC_159 0x00002B20 /* floating point or coproc opcode */ +#define OPFC_158 0x00002B00 /* floating point or coproc opcode */ +#define OPFC_157 0x00002AE0 /* floating point or coproc opcode */ +#define OPFC_156 0x00002AC0 /* floating point or coproc opcode */ +#define OPFC_155 0x00002AA0 /* floating point or coproc opcode */ +#define OPFC_154 0x00002A80 /* floating point or coproc opcode */ +#define OPFC_153 0x00002A60 /* floating point or coproc opcode */ +#define OPFC_152 0x00002A40 /* floating point or coproc opcode */ +#define OPFC_151 0x00002A20 /* floating point or coproc opcode */ +#define OPFC_150 0x00002A00 /* floating point or coproc opcode */ +#define OPFC_14F 0x000029E0 /* floating point or coproc opcode */ +#define OPFC_14E 0x000029C0 /* floating point or coproc opcode */ +#define OPFC_14D 0x000029A0 /* floating point or coproc opcode */ +#define OPFC_14C 0x00002980 /* floating point or coproc opcode */ +#define OPFC_14B 0x00002960 /* floating point or coproc opcode */ +#define OPFC_14A 0x00002940 /* floating point or coproc opcode */ +#define OPFC_149 0x00002920 /* floating point or coproc opcode */ +#define OPFC_148 0x00002900 /* floating point or coproc opcode */ +#define OPFC_147 0x000028E0 /* floating point or coproc opcode */ +#define OPFC_146 0x000028C0 /* floating point or coproc opcode */ +#define OPFC_145 0x000028A0 /* floating point or coproc opcode */ +#define OPFC_144 0x00002880 /* floating point or coproc opcode */ +#define OPFC_143 0x00002860 /* floating point or coproc opcode */ +#define OPFC_142 0x00002840 /* floating point or coproc opcode */ +#define OPFC_141 0x00002820 /* floating point or coproc opcode */ +#define OPFC_140 0x00002800 /* floating point or coproc opcode */ +#define OPFC_13F 0x000027E0 /* floating point or coproc opcode */ +#define OPFC_13E 0x000027C0 /* floating point or coproc opcode */ +#define OPFC_13D 0x000027A0 /* floating point or coproc opcode */ +#define OPFC_13C 0x00002780 /* floating point or coproc opcode */ +#define OPFC_13B 0x00002760 /* floating point or coproc opcode */ +#define OPFC_13A 0x00002740 /* floating point or coproc opcode */ +#define OPFC_139 0x00002720 /* floating point or coproc opcode */ +#define OPFC_138 0x00002700 /* floating point or coproc opcode */ +#define OPFC_137 0x000026E0 /* floating point or coproc opcode */ +#define OPFC_136 0x000026C0 /* floating point or coproc opcode */ +#define OPFC_135 0x000026A0 /* floating point or coproc opcode */ +#define OPFC_134 0x00002680 /* floating point or coproc opcode */ +#define OPFC_133 0x00002660 /* floating point or coproc opcode */ +#define OPFC_132 0x00002640 /* floating point or coproc opcode */ +#define OPFC_131 0x00002620 /* floating point or coproc opcode */ +#define OPFC_130 0x00002600 /* floating point or coproc opcode */ +#define OPFC_12F 0x000025E0 /* floating point or coproc opcode */ +#define OPFC_12E 0x000025C0 /* floating point or coproc opcode */ +#define OPFC_12D 0x000025A0 /* floating point or coproc opcode */ +#define OPFC_12C 0x00002580 /* floating point or coproc opcode */ +#define OPFC_12B 0x00002560 /* floating point or coproc opcode */ +#define OPFC_12A 0x00002540 /* floating point or coproc opcode */ +#define OPFC_129 0x00002520 /* floating point or coproc opcode */ +#define OPFC_128 0x00002500 /* floating point or coproc opcode */ +#define OPFC_127 0x000024E0 /* floating point or coproc opcode */ +#define OPFC_126 0x000024C0 /* floating point or coproc opcode */ +#define OPFC_125 0x000024A0 /* floating point or coproc opcode */ +#define OPFC_124 0x00002480 /* floating point or coproc opcode */ +#define OPFC_123 0x00002460 /* floating point or coproc opcode */ +#define OPFC_122 0x00002440 /* floating point or coproc opcode */ +#define OPFC_121 0x00002420 /* floating point or coproc opcode */ +#define OPFC_120 0x00002400 /* floating point or coproc opcode */ +#define OPFC_11F 0x000023E0 /* floating point or coproc opcode */ +#define OPFC_11E 0x000023C0 /* floating point or coproc opcode */ +#define OPFC_11D 0x000023A0 /* floating point or coproc opcode */ +#define OPFC_11C 0x00002380 /* floating point or coproc opcode */ +#define OPFC_11B 0x00002360 /* floating point or coproc opcode */ +#define OPFC_11A 0x00002340 /* floating point or coproc opcode */ +#define OPFC_119 0x00002320 /* floating point or coproc opcode */ +#define OPFC_118 0x00002300 /* floating point or coproc opcode */ +#define OPFC_117 0x000022E0 /* floating point or coproc opcode */ +#define OPFC_116 0x000022C0 /* floating point or coproc opcode */ +#define OPFC_115 0x000022A0 /* floating point or coproc opcode */ +#define OPFC_114 0x00002280 /* floating point or coproc opcode */ +#define OPFC_113 0x00002260 /* floating point or coproc opcode */ +#define OPFC_112 0x00002240 /* floating point or coproc opcode */ +#define OPFC_111 0x00002220 /* floating point or coproc opcode */ +#define OPFC_110 0x00002200 /* floating point or coproc opcode */ +#define OPFC_10F 0x000021E0 /* floating point or coproc opcode */ +#define OPFC_10E 0x000021C0 /* floating point or coproc opcode */ +#define OPFC_10D 0x000021A0 /* floating point or coproc opcode */ +#define OPFC_10C 0x00002180 /* floating point or coproc opcode */ +#define OPFC_10B 0x00002160 /* floating point or coproc opcode */ +#define OPFC_10A 0x00002140 /* floating point or coproc opcode */ +#define OPFC_109 0x00002120 /* floating point or coproc opcode */ +#define OPFC_108 0x00002100 /* floating point or coproc opcode */ +#define OPFC_107 0x000020E0 /* floating point or coproc opcode */ +#define OPFC_106 0x000020C0 /* floating point or coproc opcode */ +#define OPFC_105 0x000020A0 /* floating point or coproc opcode */ +#define OPFC_104 0x00002080 /* floating point or coproc opcode */ +#define OPFC_103 0x00002060 /* floating point or coproc opcode */ +#define OPFC_102 0x00002040 /* floating point or coproc opcode */ +#define OPFC_101 0x00002020 /* floating point or coproc opcode */ +#define OPFC_100 0x00002000 /* floating point or coproc opcode */ +#define OPFC_0FF 0x00001FE0 /* floating point or coproc opcode */ +#define OPFC_0FE 0x00001FC0 /* floating point or coproc opcode */ +#define OPFC_0FD 0x00001FA0 /* floating point or coproc opcode */ +#define OPFC_0FC 0x00001F80 /* floating point or coproc opcode */ +#define OPFC_0FB 0x00001F60 /* floating point or coproc opcode */ +#define OPFC_0FA 0x00001F40 /* floating point or coproc opcode */ +#define OPFC_0F9 0x00001F20 /* floating point or coproc opcode */ +#define OPFC_0F8 0x00001F00 /* floating point or coproc opcode */ +#define OPFC_0F7 0x00001EE0 /* floating point or coproc opcode */ +#define OPFC_0F6 0x00001EC0 /* floating point or coproc opcode */ +#define OPFC_0F5 0x00001EA0 /* floating point or coproc opcode */ +#define OPFC_0F4 0x00001E80 /* floating point or coproc opcode */ +#define OPFC_0F3 0x00001E60 /* floating point or coproc opcode */ +#define OPFC_0F2 0x00001E40 /* floating point or coproc opcode */ +#define OPFC_0F1 0x00001E20 /* floating point or coproc opcode */ +#define OPFC_0F0 0x00001E00 /* floating point or coproc opcode */ +#define OPFC_0EF 0x00001DE0 /* floating point or coproc opcode */ +#define OPFC_0EE 0x00001DC0 /* floating point or coproc opcode */ +#define OPFC_0ED 0x00001DA0 /* floating point or coproc opcode */ +#define OPFC_0EC 0x00001D80 /* floating point or coproc opcode */ +#define OPFC_0EB 0x00001D60 /* floating point or coproc opcode */ +#define OPFC_0EA 0x00001D40 /* floating point or coproc opcode */ +#define OPFC_0E9 0x00001D20 /* floating point or coproc opcode */ +#define OPFC_0E8 0x00001D00 /* floating point or coproc opcode */ +#define OPFC_0E7 0x00001CE0 /* floating point or coproc opcode */ +#define OPFC_0E6 0x00001CC0 /* floating point or coproc opcode */ +#define OPFC_0E5 0x00001CA0 /* floating point or coproc opcode */ +#define OPFC_0E4 0x00001C80 /* floating point or coproc opcode */ +#define OPFC_0E3 0x00001C60 /* floating point or coproc opcode */ +#define OPFC_0E2 0x00001C40 /* floating point or coproc opcode */ +#define OPFC_0E1 0x00001C20 /* floating point or coproc opcode */ +#define OPFC_0E0 0x00001C00 /* floating point or coproc opcode */ +#define OPFC_0DF 0x00001BE0 /* floating point or coproc opcode */ +#define OPFC_0DE 0x00001BC0 /* floating point or coproc opcode */ +#define OPFC_0DD 0x00001BA0 /* floating point or coproc opcode */ +#define OPFC_0DC 0x00001B80 /* floating point or coproc opcode */ +#define OPFC_0DB 0x00001B60 /* floating point or coproc opcode */ +#define OPFC_0DA 0x00001B40 /* floating point or coproc opcode */ +#define OPFC_0D9 0x00001B20 /* floating point or coproc opcode */ +#define OPFC_0D8 0x00001B00 /* floating point or coproc opcode */ +#define OPFC_0D7 0x00001AE0 /* floating point or coproc opcode */ +#define OPFC_0D6 0x00001AC0 /* floating point or coproc opcode */ +#define OPFC_0D5 0x00001AA0 /* floating point or coproc opcode */ +#define OPFC_0D4 0x00001A80 /* floating point or coproc opcode */ +#define OPFC_0D3 0x00001A60 /* floating point or coproc opcode */ +#define OPFC_0D2 0x00001A40 /* floating point or coproc opcode */ +#define OPFC_0D1 0x00001A20 /* floating point or coproc opcode */ +#define OPFC_0D0 0x00001A00 /* floating point or coproc opcode */ +#define OPFC_0CF 0x000019E0 /* floating point or coproc opcode */ +#define OPFC_0CE 0x000019C0 /* floating point or coproc opcode */ +#define OPFC_0CD 0x000019A0 /* floating point or coproc opcode */ +#define OPFC_0CC 0x00001980 /* floating point or coproc opcode */ +#define OPFC_0CB 0x00001960 /* floating point or coproc opcode */ +#define OPFC_0CA 0x00001940 /* floating point or coproc opcode */ +#define OPFC_0C9 0x00001920 /* floating point or coproc opcode */ +#define OPFC_0C8 0x00001900 /* floating point or coproc opcode */ +#define OPFC_0C7 0x000018E0 /* floating point or coproc opcode */ +#define OPFC_0C6 0x000018C0 /* floating point or coproc opcode */ +#define OPFC_0C5 0x000018A0 /* floating point or coproc opcode */ +#define OPFC_0C4 0x00001880 /* floating point or coproc opcode */ +#define OPFC_0C3 0x00001860 /* floating point or coproc opcode */ +#define OPFC_0C2 0x00001840 /* floating point or coproc opcode */ +#define OPFC_0C1 0x00001820 /* floating point or coproc opcode */ +#define OPFC_0C0 0x00001800 /* floating point or coproc opcode */ +#define OPFC_0BF 0x000017E0 /* floating point or coproc opcode */ +#define OPFC_0BE 0x000017C0 /* floating point or coproc opcode */ +#define OPFC_0BD 0x000017A0 /* floating point or coproc opcode */ +#define OPFC_0BC 0x00001780 /* floating point or coproc opcode */ +#define OPFC_0BB 0x00001760 /* floating point or coproc opcode */ +#define OPFC_0BA 0x00001740 /* floating point or coproc opcode */ +#define OPFC_0B9 0x00001720 /* floating point or coproc opcode */ +#define OPFC_0B8 0x00001700 /* floating point or coproc opcode */ +#define OPFC_0B7 0x000016E0 /* floating point or coproc opcode */ +#define OPFC_0B6 0x000016C0 /* floating point or coproc opcode */ +#define OPFC_0B5 0x000016A0 /* floating point or coproc opcode */ +#define OPFC_0B4 0x00001680 /* floating point or coproc opcode */ +#define OPFC_0B3 0x00001660 /* floating point or coproc opcode */ +#define OPFC_0B2 0x00001640 /* floating point or coproc opcode */ +#define OPFC_0B1 0x00001620 /* floating point or coproc opcode */ +#define OPFC_0B0 0x00001600 /* floating point or coproc opcode */ +#define OPFC_0AF 0x000015E0 /* floating point or coproc opcode */ +#define OPFC_0AE 0x000015C0 /* floating point or coproc opcode */ +#define OPFC_0AD 0x000015A0 /* floating point or coproc opcode */ +#define OPFC_0AC 0x00001580 /* floating point or coproc opcode */ +#define OPFC_0AB 0x00001560 /* floating point or coproc opcode */ +#define OPFC_0AA 0x00001540 /* floating point or coproc opcode */ +#define OPFC_0A9 0x00001520 /* floating point or coproc opcode */ +#define OPFC_0A8 0x00001500 /* floating point or coproc opcode */ +#define OPFC_0A7 0x000014E0 /* floating point or coproc opcode */ +#define OPFC_0A6 0x000014C0 /* floating point or coproc opcode */ +#define OPFC_0A5 0x000014A0 /* floating point or coproc opcode */ +#define OPFC_0A4 0x00001480 /* floating point or coproc opcode */ +#define OPFC_0A3 0x00001460 /* floating point or coproc opcode */ +#define OPFC_0A2 0x00001440 /* floating point or coproc opcode */ +#define OPFC_0A1 0x00001420 /* floating point or coproc opcode */ +#define OPFC_0A0 0x00001400 /* floating point or coproc opcode */ +#define OPFC_09F 0x000013E0 /* floating point or coproc opcode */ +#define OPFC_09E 0x000013C0 /* floating point or coproc opcode */ +#define OPFC_09D 0x000013A0 /* floating point or coproc opcode */ +#define OPFC_09C 0x00001380 /* floating point or coproc opcode */ +#define OPFC_09B 0x00001360 /* floating point or coproc opcode */ +#define OPFC_09A 0x00001340 /* floating point or coproc opcode */ +#define OPFC_099 0x00001320 /* floating point or coproc opcode */ +#define OPFC_098 0x00001300 /* floating point or coproc opcode */ +#define OPFC_097 0x000012E0 /* floating point or coproc opcode */ +#define OPFC_096 0x000012C0 /* floating point or coproc opcode */ +#define OPFC_095 0x000012A0 /* floating point or coproc opcode */ +#define OPFC_094 0x00001280 /* floating point or coproc opcode */ +#define OPFC_093 0x00001260 /* floating point or coproc opcode */ +#define OPFC_092 0x00001240 /* floating point or coproc opcode */ +#define OPFC_091 0x00001220 /* floating point or coproc opcode */ +#define OPFC_090 0x00001200 /* floating point or coproc opcode */ +#define OPFC_08F 0x000011E0 /* floating point or coproc opcode */ +#define OPFC_08E 0x000011C0 /* floating point or coproc opcode */ +#define OPFC_08D 0x000011A0 /* floating point or coproc opcode */ +#define OPFC_08C 0x00001180 /* floating point or coproc opcode */ +#define OPFC_08B 0x00001160 /* floating point or coproc opcode */ +#define OPFC_08A 0x00001140 /* floating point or coproc opcode */ +#define OPFC_089 0x00001120 /* floating point or coproc opcode */ +#define OPFC_088 0x00001100 /* floating point or coproc opcode */ +#define OPFC_087 0x000010E0 /* floating point or coproc opcode */ +#define OPFC_086 0x000010C0 /* floating point or coproc opcode */ +#define OPFC_085 0x000010A0 /* floating point or coproc opcode */ +#define OPFC_084 0x00001080 /* floating point or coproc opcode */ +#define OPFC_083 0x00001060 /* floating point or coproc opcode */ +#define OPFC_082 0x00001040 /* floating point or coproc opcode */ +#define OPFC_081 0x00001020 /* floating point or coproc opcode */ +#define OPFC_080 0x00001000 /* floating point or coproc opcode */ +#define OPFC_07F 0x00000FE0 /* floating point or coproc opcode */ +#define OPFC_07E 0x00000FC0 /* floating point or coproc opcode */ +#define OPFC_07D 0x00000FA0 /* floating point or coproc opcode */ +#define OPFC_07C 0x00000F80 /* floating point or coproc opcode */ +#define OPFC_07B 0x00000F60 /* floating point or coproc opcode */ +#define OPFC_07A 0x00000F40 /* floating point or coproc opcode */ +#define OPFC_079 0x00000F20 /* floating point or coproc opcode */ +#define OPFC_078 0x00000F00 /* floating point or coproc opcode */ +#define OPFC_077 0x00000EE0 /* floating point or coproc opcode */ +#define OPFC_076 0x00000EC0 /* floating point or coproc opcode */ +#define OPFC_075 0x00000EA0 /* floating point or coproc opcode */ +#define OPFC_074 0x00000E80 /* floating point or coproc opcode */ +#define OPFC_073 0x00000E60 /* floating point or coproc opcode */ +#define OPFC_072 0x00000E40 /* floating point or coproc opcode */ +#define OPFC_071 0x00000E20 /* floating point or coproc opcode */ +#define OPFC_070 0x00000E00 /* floating point or coproc opcode */ +#define OPFC_06F 0x00000DE0 /* floating point or coproc opcode */ +#define OPFC_06E 0x00000DC0 /* floating point or coproc opcode */ +#define OPFC_06D 0x00000DA0 /* floating point or coproc opcode */ +#define OPFC_06C 0x00000D80 /* floating point or coproc opcode */ +#define OPFC_06B 0x00000D60 /* floating point or coproc opcode */ +#define OPFC_06A 0x00000D40 /* floating point or coproc opcode */ +#define OPFC_069 0x00000D20 /* floating point or coproc opcode */ +#define OPFC_068 0x00000D00 /* floating point or coproc opcode */ +#define OPFC_067 0x00000CE0 /* floating point or coproc opcode */ +#define OPFC_066 0x00000CC0 /* floating point or coproc opcode */ +#define OPFC_065 0x00000CA0 /* floating point or coproc opcode */ +#define OPFC_064 0x00000C80 /* floating point or coproc opcode */ +#define OPFC_063 0x00000C60 /* floating point or coproc opcode */ +#define OPFC_062 0x00000C40 /* floating point or coproc opcode */ +#define OPFC_061 0x00000C20 /* floating point or coproc opcode */ +#define OPFC_060 0x00000C00 /* floating point or coproc opcode */ +#define OPFC_05F 0x00000BE0 /* floating point or coproc opcode */ +#define OPFC_05E 0x00000BC0 /* floating point or coproc opcode */ +#define OPFC_05D 0x00000BA0 /* floating point or coproc opcode */ +#define OPFC_05C 0x00000B80 /* floating point or coproc opcode */ +#define OPFC_05B 0x00000B60 /* floating point or coproc opcode */ +#define OPFC_05A 0x00000B40 /* floating point or coproc opcode */ +#define OPFC_059 0x00000B20 /* floating point or coproc opcode */ +#define OPFC_058 0x00000B00 /* floating point or coproc opcode */ +#define OPFC_057 0x00000AE0 /* floating point or coproc opcode */ +#define OPFC_056 0x00000AC0 /* floating point or coproc opcode */ +#define OPFC_055 0x00000AA0 /* floating point or coproc opcode */ +#define OPFC_054 0x00000A80 /* floating point or coproc opcode */ +#define OPFC_053 0x00000A60 /* floating point or coproc opcode */ +#define OPFC_052 0x00000A40 /* floating point or coproc opcode */ +#define OPFC_051 0x00000A20 /* floating point or coproc opcode */ +#define OPFC_050 0x00000A00 /* floating point or coproc opcode */ +#define OPFC_04F 0x000009E0 /* floating point or coproc opcode */ +#define OPFC_04E 0x000009C0 /* floating point or coproc opcode */ +#define OPFC_04D 0x000009A0 /* floating point or coproc opcode */ +#define OPFC_04C 0x00000980 /* floating point or coproc opcode */ +#define OPFC_04B 0x00000960 /* floating point or coproc opcode */ +#define OPFC_04A 0x00000940 /* floating point or coproc opcode */ +#define OPFC_049 0x00000920 /* floating point or coproc opcode */ +#define OPFC_048 0x00000900 /* floating point or coproc opcode */ +#define OPFC_047 0x000008E0 /* floating point or coproc opcode */ +#define OPFC_046 0x000008C0 /* floating point or coproc opcode */ +#define OPFC_045 0x000008A0 /* floating point or coproc opcode */ +#define OPFC_044 0x00000880 /* floating point or coproc opcode */ +#define OPFC_043 0x00000860 /* floating point or coproc opcode */ +#define OPFC_042 0x00000840 /* floating point or coproc opcode */ +#define OPFC_041 0x00000820 /* floating point or coproc opcode */ +#define OPFC_040 0x00000800 /* floating point or coproc opcode */ +#define OPFC_03F 0x000007E0 /* floating point or coproc opcode */ +#define OPFC_03E 0x000007C0 /* floating point or coproc opcode */ +#define OPFC_03D 0x000007A0 /* floating point or coproc opcode */ +#define OPFC_03C 0x00000780 /* floating point or coproc opcode */ +#define OPFC_03B 0x00000760 /* floating point or coproc opcode */ +#define OPFC_03A 0x00000740 /* floating point or coproc opcode */ +#define OPFC_039 0x00000720 /* floating point or coproc opcode */ +#define OPFC_038 0x00000700 /* floating point or coproc opcode */ +#define OPFC_037 0x000006E0 /* floating point or coproc opcode */ +#define OPFC_036 0x000006C0 /* floating point or coproc opcode */ +#define OPFC_035 0x000006A0 /* floating point or coproc opcode */ +#define OPFC_034 0x00000680 /* floating point or coproc opcode */ +#define OPFC_033 0x00000660 /* floating point or coproc opcode */ +#define OPFC_032 0x00000640 /* floating point or coproc opcode */ +#define OPFC_031 0x00000620 /* floating point or coproc opcode */ +#define OPFC_030 0x00000600 /* floating point or coproc opcode */ +#define OPFC_02F 0x000005E0 /* floating point or coproc opcode */ +#define OPFC_02E 0x000005C0 /* floating point or coproc opcode */ +#define OPFC_02D 0x000005A0 /* floating point or coproc opcode */ +#define OPFC_02C 0x00000580 /* floating point or coproc opcode */ +#define OPFC_02B 0x00000560 /* floating point or coproc opcode */ +#define OPFC_02A 0x00000540 /* floating point or coproc opcode */ +#define OPFC_029 0x00000520 /* floating point or coproc opcode */ +#define OPFC_028 0x00000500 /* floating point or coproc opcode */ +#define OPFC_027 0x000004E0 /* floating point or coproc opcode */ +#define OPFC_026 0x000004C0 /* floating point or coproc opcode */ +#define OPFC_025 0x000004A0 /* floating point or coproc opcode */ +#define OPFC_024 0x00000480 /* floating point or coproc opcode */ +#define OPFC_023 0x00000460 /* floating point or coproc opcode */ +#define OPFC_022 0x00000440 /* floating point or coproc opcode */ +#define OPFC_021 0x00000420 /* floating point or coproc opcode */ +#define OPFC_020 0x00000400 /* floating point or coproc opcode */ +#define OPFC_01F 0x000003E0 /* floating point or coproc opcode */ +#define OPFC_01E 0x000003C0 /* floating point or coproc opcode */ +#define OPFC_01D 0x000003A0 /* floating point or coproc opcode */ +#define OPFC_01C 0x00000380 /* floating point or coproc opcode */ +#define OPFC_01B 0x00000360 /* floating point or coproc opcode */ +#define OPFC_01A 0x00000340 /* floating point or coproc opcode */ +#define OPFC_019 0x00000320 /* floating point or coproc opcode */ +#define OPFC_018 0x00000300 /* floating point or coproc opcode */ +#define OPFC_017 0x000002E0 /* floating point or coproc opcode */ +#define OPFC_016 0x000002C0 /* floating point or coproc opcode */ +#define OPFC_015 0x000002A0 /* floating point or coproc opcode */ +#define OPFC_014 0x00000280 /* floating point or coproc opcode */ +#define OPFC_013 0x00000260 /* floating point or coproc opcode */ +#define OPFC_012 0x00000240 /* floating point or coproc opcode */ +#define OPFC_011 0x00000220 /* floating point or coproc opcode */ +#define OPFC_010 0x00000200 /* floating point or coproc opcode */ +#define OPFC_00F 0x000001E0 /* floating point or coproc opcode */ +#define OPFC_00E 0x000001C0 /* floating point or coproc opcode */ +#define OPFC_00D 0x000001A0 /* floating point or coproc opcode */ +#define OPFC_00C 0x00000180 /* floating point or coproc opcode */ +#define OPFC_00B 0x00000160 /* floating point or coproc opcode */ +#define OPFC_00A 0x00000140 /* floating point or coproc opcode */ +#define OPFC_009 0x00000120 /* floating point or coproc opcode */ +#define OPFC_008 0x00000100 /* floating point or coproc opcode */ +#define OPFC_007 0x000000E0 /* floating point or coproc opcode */ +#define OPFC_006 0x000000C0 /* floating point or coproc opcode */ +#define OPFC_005 0x000000A0 /* floating point or coproc opcode */ +#define OPFC_004 0x00000080 /* floating point or coproc opcode */ +#define OPFC_003 0x00000060 /* floating point or coproc opcode */ +#define OPFC_002 0x00000040 /* floating point or coproc opcode */ +#define OPFC_001 0x00000020 /* floating point or coproc opcode */ +#define OPFC_000 0x00000000 /* floating point or coproc opcode */ + +/* instruction fields: integer unit register equates */ + +#define RD_i7 0x3E000000 /* destination register: %i7 */ +#define RD_i6 0x3C000000 /* destination register: %i6 */ +#define RD_i5 0x3A000000 /* destination register: %i5 */ +#define RD_i4 0x38000000 /* destination register: %i4 */ +#define RD_i3 0x36000000 /* destination register: %i3 */ +#define RD_i2 0x34000000 /* destination register: %i2 */ +#define RD_i1 0x32000000 /* destination register: %i1 */ +#define RD_i0 0x30000000 /* destination register: %i0 */ +#define RD_l7 0x2E000000 /* destination register: %l7 */ +#define RD_l6 0x2C000000 /* destination register: %l6 */ +#define RD_l5 0x2A000000 /* destination register: %l5 */ +#define RD_l4 0x28000000 /* destination register: %l4 */ +#define RD_l3 0x26000000 /* destination register: %l3 */ +#define RD_l2 0x24000000 /* destination register: %l2 */ +#define RD_l1 0x22000000 /* destination register: %l1 */ +#define RD_l0 0x20000000 /* destination register: %l0 */ +#define RD_o7 0x1E000000 /* destination register: %o7 */ +#define RD_o6 0x1C000000 /* destination register: %o6 */ +#define RD_o5 0x1A000000 /* destination register: %o5 */ +#define RD_o4 0x18000000 /* destination register: %o4 */ +#define RD_o3 0x16000000 /* destination register: %o3 */ +#define RD_o2 0x14000000 /* destination register: %o2 */ +#define RD_o1 0x12000000 /* destination register: %o1 */ +#define RD_o0 0x10000000 /* destination register: %o0 */ +#define RD_g7 0x0E000000 /* destination register: %g7 */ +#define RD_g6 0x0C000000 /* destination register: %g6 */ +#define RD_g5 0x0A000000 /* destination register: %g5 */ +#define RD_g4 0x08000000 /* destination register: %g4 */ +#define RD_g3 0x06000000 /* destination register: %g3 */ +#define RD_g2 0x04000000 /* destination register: %g2 */ +#define RD_g1 0x02000000 /* destination register: %g1 */ +#define RD_g0 0x00000000 /* destination register: %g0 */ +#define RS1_i7 0x0007C000 /* source register 1: %i7 */ +#define RS1_i6 0x00078000 /* source register 1: %i6 */ +#define RS1_i5 0x00074000 /* source register 1: %i5 */ +#define RS1_i4 0x00070000 /* source register 1: %i4 */ +#define RS1_i3 0x0006C000 /* source register 1: %i3 */ +#define RS1_i2 0x00068000 /* source register 1: %i2 */ +#define RS1_i1 0x00064000 /* source register 1: %i1 */ +#define RS1_i0 0x00060000 /* source register 1: %i0 */ +#define RS1_l7 0x0005C000 /* source register 1: %l7 */ +#define RS1_l6 0x00058000 /* source register 1: %l6 */ +#define RS1_l5 0x00054000 /* source register 1: %l5 */ +#define RS1_l4 0x00050000 /* source register 1: %l4 */ +#define RS1_l3 0x0004C000 /* source register 1: %l3 */ +#define RS1_l2 0x00048000 /* source register 1: %l2 */ +#define RS1_l1 0x00044000 /* source register 1: %l1 */ +#define RS1_l0 0x00040000 /* source register 1: %l0 */ +#define RS1_o7 0x0003C000 /* source register 1: %o7 */ +#define RS1_o6 0x00038000 /* source register 1: %o6 */ +#define RS1_o5 0x00034000 /* source register 1: %o5 */ +#define RS1_o4 0x00030000 /* source register 1: %o4 */ +#define RS1_o3 0x0002C000 /* source register 1: %o3 */ +#define RS1_o2 0x00028000 /* source register 1: %o2 */ +#define RS1_o1 0x00024000 /* source register 1: %o1 */ +#define RS1_o0 0x00020000 /* source register 1: %o0 */ +#define RS1_g7 0x0001C000 /* source register 1: %g7 */ +#define RS1_g6 0x00018000 /* source register 1: %g6 */ +#define RS1_g5 0x00014000 /* source register 1: %g5 */ +#define RS1_g4 0x00010000 /* source register 1: %g4 */ +#define RS1_g3 0x0000C000 /* source register 1: %g3 */ +#define RS1_g2 0x00008000 /* source register 1: %g2 */ +#define RS1_g1 0x00004000 /* source register 1: %g1 */ +#define RS1_g0 0x00000000 /* source register 1: %g0 */ +#define RS2_i7 0x0000001F /* source register 2: %i7 */ +#define RS2_i6 0x0000001E /* source register 2: %i6 */ +#define RS2_i5 0x0000001D /* source register 2: %i5 */ +#define RS2_i4 0x0000001C /* source register 2: %i4 */ +#define RS2_i3 0x0000001B /* source register 2: %i3 */ +#define RS2_i2 0x0000001A /* source register 2: %i2 */ +#define RS2_i1 0x00000019 /* source register 2: %i1 */ +#define RS2_i0 0x00000018 /* source register 2: %i0 */ +#define RS2_l7 0x00000017 /* source register 2: %l7 */ +#define RS2_l6 0x00000016 /* source register 2: %l6 */ +#define RS2_l5 0x00000015 /* source register 2: %l5 */ +#define RS2_l4 0x00000014 /* source register 2: %l4 */ +#define RS2_l3 0x00000013 /* source register 2: %l3 */ +#define RS2_l2 0x00000012 /* source register 2: %l2 */ +#define RS2_l1 0x00000011 /* source register 2: %l1 */ +#define RS2_l0 0x00000010 /* source register 2: %l0 */ +#define RS2_o7 0x0000000F /* source register 2: %o7 */ +#define RS2_o6 0x0000000E /* source register 2: %o6 */ +#define RS2_o5 0x0000000D /* source register 2: %o5 */ +#define RS2_o4 0x0000000C /* source register 2: %o4 */ +#define RS2_o3 0x0000000B /* source register 2: %o3 */ +#define RS2_o2 0x0000000A /* source register 2: %o2 */ +#define RS2_o1 0x00000009 /* source register 2: %o1 */ +#define RS2_o0 0x00000008 /* source register 2: %o0 */ +#define RS2_g7 0x00000007 /* source register 2: %g7 */ +#define RS2_g6 0x00000006 /* source register 2: %g6 */ +#define RS2_g5 0x00000005 /* source register 2: %g5 */ +#define RS2_g4 0x00000004 /* source register 2: %g4 */ +#define RS2_g3 0x00000003 /* source register 2: %g3 */ +#define RS2_g2 0x00000002 /* source register 2: %g2 */ +#define RS2_g1 0x00000001 /* source register 2: %g1 */ +#define RS2_g0 0x00000000 /* source register 2: %g0 */ + +/* instruction fields: floating point unit register equates */ + +#define RD_f31 0x3E000000 /* destination register: %f31 */ +#define RD_f30 0x3C000000 /* destination register: %f30 */ +#define RD_f29 0x3A000000 /* destination register: %f29 */ +#define RD_f28 0x38000000 /* destination register: %f28 */ +#define RD_f27 0x36000000 /* destination register: %f27 */ +#define RD_f26 0x34000000 /* destination register: %f26 */ +#define RD_f25 0x32000000 /* destination register: %f25 */ +#define RD_f24 0x30000000 /* destination register: %f24 */ +#define RD_f23 0x2E000000 /* destination register: %f23 */ +#define RD_f22 0x2C000000 /* destination register: %f22 */ +#define RD_f21 0x2A000000 /* destination register: %f21 */ +#define RD_f20 0x28000000 /* destination register: %f20 */ +#define RD_f19 0x26000000 /* destination register: %f19 */ +#define RD_f18 0x24000000 /* destination register: %f18 */ +#define RD_f17 0x22000000 /* destination register: %f17 */ +#define RD_f16 0x20000000 /* destination register: %f16 */ +#define RD_f15 0x1E000000 /* destination register: %f15 */ +#define RD_f14 0x1C000000 /* destination register: %f14 */ +#define RD_f13 0x1A000000 /* destination register: %f13 */ +#define RD_f12 0x18000000 /* destination register: %f12 */ +#define RD_f11 0x16000000 /* destination register: %f11 */ +#define RD_f10 0x14000000 /* destination register: %f10 */ +#define RD_f09 0x12000000 /* destination register: %f09 */ +#define RD_f08 0x10000000 /* destination register: %f08 */ +#define RD_f07 0x0E000000 /* destination register: %f07 */ +#define RD_f06 0x0C000000 /* destination register: %f06 */ +#define RD_f05 0x0A000000 /* destination register: %f05 */ +#define RD_f04 0x08000000 /* destination register: %f04 */ +#define RD_f03 0x06000000 /* destination register: %f03 */ +#define RD_f02 0x04000000 /* destination register: %f02 */ +#define RD_f01 0x02000000 /* destination register: %f01 */ +#define RD_f00 0x00000000 /* destination register: %f00 */ +#define RS1_f31 0x0007C000 /* source register 1: %f31 */ +#define RS1_f30 0x00078000 /* source register 1: %f30 */ +#define RS1_f29 0x00074000 /* source register 1: %f29 */ +#define RS1_f28 0x00060000 /* source register 1: %f28 */ +#define RS1_f27 0x0006C000 /* source register 1: %f27 */ +#define RS1_f26 0x00068000 /* source register 1: %f26 */ +#define RS1_f25 0x00064000 /* source register 1: %f25 */ +#define RS1_f24 0x00060000 /* source register 1: %f24 */ +#define RS1_f23 0x0005C000 /* source register 1: %f23 */ +#define RS1_f22 0x00058000 /* source register 1: %f22 */ +#define RS1_f21 0x00054000 /* source register 1: %f21 */ +#define RS1_f20 0x00050000 /* source register 1: %f20 */ +#define RS1_f19 0x0004C000 /* source register 1: %f19 */ +#define RS1_f18 0x00048000 /* source register 1: %f18 */ +#define RS1_f17 0x00044000 /* source register 1: %f17 */ +#define RS1_f16 0x00040000 /* source register 1: %f16 */ +#define RS1_f15 0x0003C000 /* source register 1: %f15 */ +#define RS1_f14 0x00038000 /* source register 1: %f14 */ +#define RS1_f13 0x00034000 /* source register 1: %f13 */ +#define RS1_f12 0x00030000 /* source register 1: %f12 */ +#define RS1_f11 0x0002C000 /* source register 1: %f11 */ +#define RS1_f10 0x00028000 /* source register 1: %f10 */ +#define RS1_f09 0x00024000 /* source register 1: %f09 */ +#define RS1_f08 0x00020000 /* source register 1: %f08 */ +#define RS1_f07 0x0001C000 /* source register 1: %f07 */ +#define RS1_f06 0x00018000 /* source register 1: %f06 */ +#define RS1_f05 0x00014000 /* source register 1: %f05 */ +#define RS1_f04 0x00010000 /* source register 1: %f04 */ +#define RS1_f03 0x0000C000 /* source register 1: %f03 */ +#define RS1_f02 0x00008000 /* source register 1: %f02 */ +#define RS1_f01 0x00004000 /* source register 1: %f01 */ +#define RS1_f00 0x00000000 /* source register 1: %f00 */ +#define RS2_f31 0x0000001F /* source register 2: %f31 */ +#define RS2_f30 0x0000001E /* source register 2: %f30 */ +#define RS2_f29 0x0000001D /* source register 2: %f29 */ +#define RS2_f28 0x0000001C /* source register 2: %f28 */ +#define RS2_f27 0x0000001B /* source register 2: %f27 */ +#define RS2_f26 0x0000001A /* source register 2: %f26 */ +#define RS2_f25 0x00000019 /* source register 2: %f25 */ +#define RS2_f24 0x00000018 /* source register 2: %f24 */ +#define RS2_f23 0x00000017 /* source register 2: %f23 */ +#define RS2_f22 0x00000016 /* source register 2: %f22 */ +#define RS2_f21 0x00000015 /* source register 2: %f21 */ +#define RS2_f20 0x00000014 /* source register 2: %f20 */ +#define RS2_f19 0x00000013 /* source register 2: %f19 */ +#define RS2_f18 0x00000012 /* source register 2: %f18 */ +#define RS2_f17 0x00000011 /* source register 2: %f17 */ +#define RS2_f16 0x00000010 /* source register 2: %f16 */ +#define RS2_f15 0x0000000F /* source register 2: %f15 */ +#define RS2_f14 0x0000000E /* source register 2: %f14 */ +#define RS2_f13 0x0000000D /* source register 2: %f13 */ +#define RS2_f12 0x0000000C /* source register 2: %f12 */ +#define RS2_f11 0x0000000B /* source register 2: %f11 */ +#define RS2_f10 0x0000000A /* source register 2: %f10 */ +#define RS2_f09 0x00000009 /* source register 2: %f09 */ +#define RS2_f08 0x00000008 /* source register 2: %f08 */ +#define RS2_f07 0x00000007 /* source register 2: %f07 */ +#define RS2_f06 0x00000006 /* source register 2: %f06 */ +#define RS2_f05 0x00000005 /* source register 2: %f05 */ +#define RS2_f04 0x00000004 /* source register 2: %f04 */ +#define RS2_f03 0x00000003 /* source register 2: %f03 */ +#define RS2_f02 0x00000002 /* source register 2: %f02 */ +#define RS2_f01 0x00000001 /* source register 2: %f01 */ +#define RS2_f00 0x00000000 /* source register 2: %f00 */ + +/* instruction fields: miscellaneous equates */ + +#define A_1 0x20000000 /* annul bit on */ +#define A_0 0x00000000 /* annul bit off */ +#define COND_F 0x1E000000 /* test condition F */ +#define COND_E 0x1C000000 /* test condition E */ +#define COND_D 0x1A000000 /* test condition D */ +#define COND_C 0x18000000 /* test condition C */ +#define COND_B 0x16000000 /* test condition B */ +#define COND_A 0x14000000 /* test condition A */ +#define COND_9 0x12000000 /* test condition 9 */ +#define COND_8 0x10000000 /* test condition 8 */ +#define COND_7 0x0E000000 /* test condition 7 */ +#define COND_6 0x0C000000 /* test condition 6 */ +#define COND_5 0x0A000000 /* test condition 5 */ +#define COND_4 0x08000000 /* test condition 4 */ +#define COND_3 0x06000000 /* test condition 3 */ +#define COND_2 0x04000000 /* test condition 2 */ +#define COND_1 0x02000000 /* test condition 1 */ +#define COND_0 0x00000000 /* test condition 0 */ +#define I_1 0x00002000 /* second ALU operand is simm13 */ +#define I_0 0x00000000 /* second ALU operand is rs2 and */ + /* possibly ASI */ +#define ASI_SUPER_D 0x00000160 /* alternate address space: */ + /* supervisor data */ +#define ASI_USER_D 0x00000140 /* alternate address space: user data */ +#define ASI_SUPER_I 0x00000120 /* alternate address space: */ + /* supervisor instruction */ +#define ASI_USER_I 0x00000100 /* alternate address space: user */ + /* instruction */ + + +/* + * instruction types + * + * Listed in order of first occurrence in dsmLib_sparc.c. + * Note the reversal of where you would think formats 1 & 2 should be. + */ + +/* instruction types: instruction format 2 (OP_0: Bicc, FBfcc, CBccc, SETHI) */ + +#define itUnimp 0x00 /* unimplemented instruction */ +#define itBranch 0x01 /* branch instructions */ +#define itNop 0x02 /* no operation */ +#define itSethi 0x03 /* SETHI instruction */ + +/* instruction types: instruction format 1 (OP_1: Call) */ + +#define itCall 0x10 /* CALL disp30 */ + +/* instruction types: instruction format 3 (OP_2: arithmetic, etc.) */ + +#define itArith 0x20 /* arithmetic ops: general */ + /* case */ +#define itArithRs1SpoofMov 0x21 /* arithmetic ops: special */ + /* rs1 values */ +#define itArithOrSet 0x22 /* arithmetic ops: special */ + /* 'or' case */ +#define itArithRs1Spoof 0x23 /* arithmetic ops: special */ + /* rs1 values */ +#define itArithRs1Rs2Spoof 0x24 /* arithmetic ops: special */ + /* rs1 and rs2 values */ +#define itArithRs2Spoof 0x25 /* arithmetic ops: special */ + /* rs2 values */ +#define itArithRdSpoof 0x26 /* arithmetic ops: special */ + /* rd values */ +#define itArithRs1RdSpoof 0x27 /* arithmetic ops: special */ + /* rs1 and rd values */ +#define itArithRs2RdSpoof 0x28 /* arithmetic ops: special */ + /* rs2 and rd values */ +#define itArithRdSpoofCmp 0x29 /* arithmetic ops: special */ + /* rd values */ +#define itShift 0x30 /* general case shift ops */ +#define itRdY 0x40 /* read from %y */ +#define itRdPsr 0x41 /* read from %psr */ +#define itRdWim 0x42 /* read from %wim */ +#define itRdTbr 0x43 /* read from %tbr */ +#define itWrY 0x44 /* write to %y */ +#define itWrPsr 0x45 /* write to %psr */ +#define itWrWim 0x46 /* write to %wim */ +#define itWrTbr 0x47 /* write to %tbr */ +#define itRdAsr 0x48 /* RDASR */ +#define itWrAsr 0x49 /* WRASR */ +#define itFloat2op 0x50 /* floating point, 2-operand */ + /* ops */ +#define itFloat3op 0x51 /* floating point, 3-operand */ + /* ops */ +#define itFloatCompare 0x52 /* floating point, compare */ + /* ops */ +#define itCpop1 0x60 /* coproc operations, class 1 */ +#define itCpop2 0x61 /* coproc operations, class 2 */ +#define itRet 0x80 /* return (simple case) */ +#define itJmp 0x81 /* jump */ +#define itJmpl 0x82 /* jump and link */ +#define itRett 0x83 /* return from trap */ +#define itTrap 0x90 /* trap instructions */ +#define itFlush 0xA0 /* flush cache */ +#define itSaveTrivial 0xA1 /* save window */ +#define itSave 0xA2 /* save window */ +#define itRestoreTrivial 0xA3 /* restore window */ +#define itRestore 0xA4 /* restore window */ + +/* instruction types: instruction format 3 (OP_3: load/store) */ + +#define itLd 0xB0 /* general load */ +#define itSt 0xB1 /* general store */ +#define itClr 0xB2 /* store from %g0 */ +#define itSwap 0xB3 /* general swap */ +#define itLdAsi 0xB4 /* load from alternate */ + /* address space */ +#define itStAsi 0xB5 /* store to alternate */ + /* address space */ +#define itClrAsi 0xB6 /* store %g0 to alternate */ + /* address space */ +#define itSwapAsi 0xB7 /* swap with alternate */ + /* address space */ +#define itLdFreg 0xC0 /* load from floating point */ + /* register */ +#define itLdFsr 0xC1 /* load from floating point */ + /* status register */ +#define itStFreg 0xC2 /* store to floating point */ + /* register */ +#define itStFsr 0xC3 /* store to floating point */ + /* status register */ +#define itStFq 0xC4 /* store to floating point */ + /* queue */ +#define itLdCreg 0xC5 /* load from coproc register */ +#define itLdCsr 0xC6 /* load from coproc status */ + /* register */ +#define itStCreg 0xC7 /* store to coproc register */ +#define itStCsr 0xC8 /* store to coproc status */ + /* register */ +#define itStCq 0xC9 /* store to coproc queue */ + +#endif /* __INCinstrSparch */ diff --git a/h/arch/simsolaris/ivSimsolaris.h b/h/arch/simsolaris/ivSimsolaris.h new file mode 100644 index 0000000..d75a452 --- /dev/null +++ b/h/arch/simsolaris/ivSimsolaris.h @@ -0,0 +1,59 @@ +/* ivSimsolaris.h - Solaris VxSim interrupt vectors */ + +/* Copyright 1993-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,16sep03,jmp cleanup interrupt vector definitions. +01f,21may03,jmp moved IV_MAX from intArchLib.c. +01e,18mar03,dbt Added missing interrupt vectors. +01d,05mar03,jeg cleanup code . +01c,21feb03,jeg added test to avoid multiple definitions of FD_TO_IVEC. +01b,13feb97,pr changed the iv number which were different from the sparc. +01a,07jun95,ism derived from simsparc +*/ + +#ifndef __INCivSimsolarisLibh +#define __INCivSimsolarisLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* maximun number of interrupt vectors */ + +#define IV_MAX (256 + 32) /* 256 correspond to MAX_FD defined on host */ + /* side, see vxsimLib.h */ + +/* macros to convert interrupt vectors <-> interrupt numbers */ + +#define IVEC_TO_INUM(intVec) ((int) (intVec)) +#define INUM_TO_IVEC(intNum) ((VOIDFUNCPTR *) (intNum)) + +#define IVEC_TO_FD(intVec) (IVEC_TO_INUM(intVec) - 32) +#ifndef FD_TO_IVEC +#define FD_TO_IVEC(fd) (INUM_TO_IVEC((fd) + 32)) +#endif + +/* interrupt vector definitions */ + +#define IV_HUP 1 +#define IV_INT 2 +#define IV_ILL 4 +#define IV_TRAP 5 +#define IV_FPE 8 +#define IV_BUS 10 +#define IV_SEGV 11 +#define IV_CLOCK1 14 +#define IV_USR1 16 +#define IV_USR2 17 +#define IV_IO 22 +#define IV_CLOCK2 28 +#define IV_CLOCK3 29 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCivSimsolarisLibh */ diff --git a/h/arch/simsolaris/mmuArchLib.h b/h/arch/simsolaris/mmuArchLib.h new file mode 100644 index 0000000..669d635 --- /dev/null +++ b/h/arch/simsolaris/mmuArchLib.h @@ -0,0 +1,289 @@ +/* mmuArchLib.h - mmu library header for VxSim */ + +/* Copyright 1999-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,19aug04,dbt Removed obsolote mmuArchCurrentSet() prototype. +01d,03dec03,jmp added mmuArchLibInit(). +01c,26nov03,jmp added mmuArchCurrentSet(). +01c,30dec03,kab Update for VIRT_ADDR type +01b,07oct03,jmp added MMU_STATE_VALID_NOT. + added MMU cache simulation. +01a,17jul03,jmp imported from VxWorksAE. +*/ + +#ifndef __INCmmuArchLibh +#define __INCmmuArchLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HOST +#include "host.h" +#else /* HOST */ +#include "vxWorks.h" +#endif /* HOST */ + +/* MMU Page Size */ + +#ifdef HOST +#ifndef WIN32 +#define MMU_PAGE_SIZE 0x2000 /* pages are 8 kbytes */ +#else /* !WIN32 */ +#define MMU_PAGE_SIZE 0x10000 /* pages are 64 kbytes */ +#endif /* WIN32 */ + +/* + * VxSim host code does not have access to VIRT_ADDR & PHYS_ADDR, so + * it is necessary to define them here. + */ + +#define VIRT_ADDR UINT32 +#define PHYS_ADDR UINT32 + +#else /* HOST */ +#if CPU != SIMNT +#define MMU_PAGE_SIZE 0x2000 /* pages are 8 kbytes */ +#else /* CPU != SIMNT */ +#define MMU_PAGE_SIZE 0x10000 /* pages are 64 kbytes */ +#endif /* CPU != SIMNT */ +#endif /* HOST */ + +/* + * Page Table Entry (PTE) description: + * + * ______Real Page Number (rpn)_______ ______Page State_______ + * / \ / \ + * _______________________________________________________________ + * | | | | | | | | | | | | | | | | | | | |U|S|R|W|X| | | | | | |C|V| + * --------------------------------------------------------------- + * | | | | | | | | | | | | | + * | | | | | | | | | | | | | + * 13 User ______/ | | | | | | | | | | | | + * 12 Supervisor __/ | | | | | | | | | | | + * 11 Read __________/ | | | | | | | | | | + * 10 Write ___________/ | | | | | | | | | + * 9 Execute ___________/ | | | | | | | | + * 8 Reserved ____________/ | | | | | | | + * 7 Reserved ______________/ | | | | | | + * 6 Reserved ________________/ | | | | | + * 5 Reserved __________________/ | | | | + * 4 Reserved ____________________/ | | | + * 3 Reserved ______________________/ | | + * 2 Cache __________________________/ | + * 1 Valid _____________________________/ + * + * NOTE: On SIMNT, only 16 bits of the rpn bitfield (19 bits) are used. + * This is due to the SIMNT MMU page size. + */ + +/* Bit patterns for various MMU states */ + +#define MMU_STATE_SHIFT 8 + +#define MMU_STATE_VALID 0x00000001 +#define MMU_STATE_VALID_NOT 0x00000000 +#define MMU_STATE_CACHEABLE 0x00000002 +#define MMU_STATE_CACHEABLE_NOT 0x00000000 +#define MMU_STATE_INVALID_STATE 0xffffffff +#define MMU_STATE_NO_ACCESS 0x00000000 + +#define MMU_STATE_SUP_RX (0x0d << MMU_STATE_SHIFT) +#define MMU_STATE_SUP_RWX (0x0f << MMU_STATE_SHIFT) +#define MMU_STATE_USR_SUP_RX (0x1d << MMU_STATE_SHIFT) +#define MMU_STATE_USR_RX_SUP_RWX (0x15 << MMU_STATE_SHIFT) +#define MMU_STATE_USR_SUP_RWX (0x1f << MMU_STATE_SHIFT) + + +/* Masks associated with the above bit patterns */ + +#define MMU_STATE_MASK_VALID 0x00000001 +#define MMU_STATE_MASK_CACHEABLE 0x00000002 +#define MMU_STATE_MASK_PROTECTION (0x1f << MMU_STATE_SHIFT) + +/* Number of L1 and L2 descriptors available in tables */ + +#if MMU_PAGE_SIZE == 0x10000 +#define MMU_NUM_L1_DESC 2048 +#define MMU_NUM_L2_DESC 32 +#else /* MMU_PAGE_SIZE == 0x10000 */ +#define MMU_NUM_L1_DESC 4096 +#define MMU_NUM_L2_DESC 128 +#endif /* MMU_PAGE_SIZE == 0x10000 */ + +/* + * Alignment to use to allocate L2 structure. This is necessary to know how + * much bits are necessary to get the base address of a L2 structure + * (l2ba field in MMU_LEVEL_2_DESC and MMU_LEVEL_1_DESC structures. + */ + +#define MMU_L2_ALLOC_ALIGNMENT 0x1000 + +/* Memory size described by a L1 descriptor */ + +#define MMU_L1_SIZE (MMU_NUM_L1_DESC * MMU_PAGE_SIZE) + +/* Define _BYTE_ORDER macro for host side */ + +#ifdef HOST +#if HOST_BYTE_ORDER == BIG_ENDIAN +#undef _BIG_ENDIAN +#define _BIG_ENDIAN BIG_ENDIAN +#undef _BYTE_ORDER +#define _BYTE_ORDER _BIG_ENDIAN +#else /* HOST_BYTE_ORDER == BIG_ENDIAN */ +#undef _BIG_ENDIAN +#define _LITTLE_ENDIAN LITTLE_ENDIAN +#undef _BYTE_ORDER +#define _BYTE_ORDER _LITTLE_ENDIAN +#endif /* HOST_BYTE_ORDER == BIG_ENDIAN */ +#endif /* HOST */ + +/* PTE structure */ + +typedef union /* PTE structure */ + { + struct /* bit field desciption */ + { +#if _BYTE_ORDER == _BIG_ENDIAN + UINT32 rpn :19; /* real page number */ + UINT32 access :5; /* Access attributes: USR, SUP, RWX */ + UINT32 reserved :6; /* Reserved for later use */ + UINT32 cache :1; /* Cache attribute */ + UINT32 v :1; /* page valid bit */ +#else /* _BYTE_ORDER == _BIG_ENDIAN */ + UINT32 v :1; /* page valid bit */ + UINT32 cache :1; /* Cache attribute */ + UINT32 reserved :6; /* Reserved for later use */ + UINT32 access :5; /* Access attributes: USR, SUP, RWX */ + UINT32 rpn :19; /* real page number */ +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + } field; + UINT32 bits; + } PTE; + +/* Effective (Virtual) address structure */ + +typedef union /* effective address structure */ + { + struct /* Bit field description */ + { +#if _BYTE_ORDER == _BIG_ENDIAN +#if MMU_PAGE_SIZE == 0x10000 + UINT32 l1index :11; /* Level 1 Index */ + UINT32 l2index :5; /* Level 2 Index */ + UINT32 po :16; /* Page Offset */ +#else /* MMU_PAGE_SIZE == 0x10000 */ + UINT32 l1index :12; /* Level 1 Index */ + UINT32 l2index :7; /* Level 2 Index */ + UINT32 po :13; /* Page Offset */ +#endif /* MMU_PAGE_SIZE == 0x10000 */ +#else /* _BYTE_ORDER == _BIG_ENDIAN */ +#if MMU_PAGE_SIZE == 0x10000 + UINT32 po :16; /* Page Offset */ + UINT32 l2index :5; /* Level 2 Index */ + UINT32 l1index :11; /* Level 1 Index */ +#else /* MMU_PAGE_SIZE == 0x10000 */ + UINT32 po :13; /* Page Offset */ + UINT32 l2index :7; /* Level 2 Index */ + UINT32 l1index :12; /* Level 1 Index */ +#endif /* MMU_PAGE_SIZE == 0x10000 */ +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + } field; + VIRT_ADDR effAddr; /* Note: Requires VIRT_ADDR == UINT32 */ + } EFFECTIVE_ADDR; + +/* Real (Physical) address structure */ + +typedef union /* real address structure */ + { + struct /* Bit field description */ + { +#if _BYTE_ORDER == _BIG_ENDIAN +#if MMU_PAGE_SIZE == 0x10000 + UINT32 rpn :16; /* Real Page Number */ + UINT32 po :16; /* Page Offset */ +#else /* MMU_PAGE_SIZE == 0x10000 */ + UINT32 rpn :19; /* Real Page Number */ + UINT32 po :13; /* Page Offset */ +#endif /* MMU_PAGE_SIZE == 0x10000 */ +#else /* _BYTE_ORDER == _BIG_ENDIAN */ +#if MMU_PAGE_SIZE == 0x10000 + UINT32 po :16; /* Page Offset */ + UINT32 rpn :16; /* Real Page Number */ +#else /* MMU_PAGE_SIZE == 0x10000 */ + UINT32 po :13; /* Page Offset */ + UINT32 rpn :19; /* Real Page Number */ +#endif /* MMU_PAGE_SIZE == 0x10000 */ +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + } field; + PHYS_ADDR realAddr; /* Note: Requires PHYS_ADDR == UINT32 */ + } REAL_ADDR; + +/* Level 2 Descriptor Table structure */ + +typedef union /* Level 2 descriptor table structure */ + { + struct /* Bit field description */ + { +#if _BYTE_ORDER == _BIG_ENDIAN + UINT32 l2ba :20; /* Level 2 table base address */ + UINT32 l2index :10; /* Level 2 table Index, note that this */ + /* value does not depend on the number */ + /* of L2 descriptors. The constraint is */ + /* that l2ba + l2index is 20 and l2ba */ + /* is dependent on the allocation */ + /* aligment of L2 desc table */ + UINT32 reserved :2; /* Reserved (must always be zero) */ +#else /* _BYTE_ORDER == _BIG_ENDIAN */ + UINT32 reserved :2; /* Reserved (must always be zero) */ + UINT32 l2index :10; /* Level 2 table Index */ + UINT32 l2ba :20; /* Level 2 table base address */ +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + } field; + PTE * pPte; + } MMU_LEVEL_2_DESC; + +/* Level 1 Descriptor Table structure */ + +typedef struct + { + UINT32 l2ba :20; /* Level 2 table Base Address */ + UINT32 v :1; /* segment valid bit */ + UINT32 pad :11; /* padding */ + } MMU_LEVEL_1_DESC; + +/* MMU translation table structure */ + +#define MMU_L1_MASK_SIZE 32 + +#if MMU_L1_MASK_SIZE == 8 +#define MMU_L1_MASK_TYPE UINT8 +#elif MMU_L1_MASK_SIZE == 16 +#define MMU_L1_MASK_TYPE UINT16 +#elif MMU_L1_MASK_SIZE == 32 +#define MMU_L1_MASK_TYPE UINT32 +#else +#error "Unsupported MMU_L1_MASK_SIZE value." +#endif + +typedef struct mmuTransTblStruct + { + MMU_LEVEL_1_DESC * pLvl1Tbl; /* Level1 descriptor table */ + UINT32 firstL1Ix; /* First L1 index used */ + UINT32 lastL1Ix; /* Last L1 index used */ + MMU_L1_MASK_TYPE l1Mask[MMU_NUM_L1_DESC/MMU_L1_MASK_SIZE]; + } MMU_TRANS_TBL; + +#ifndef HOST +extern STATUS mmuArchLibInit (UINT pageSize); +#endif /* HOST */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmmuArchLibh */ diff --git a/h/arch/simsolaris/regsSimsolaris.h b/h/arch/simsolaris/regsSimsolaris.h new file mode 100644 index 0000000..8a5c7f5 --- /dev/null +++ b/h/arch/simsolaris/regsSimsolaris.h @@ -0,0 +1,128 @@ +/* regsSimsolaris.h - simsolaris registers header */ + +/* Copyright 1995-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01n,26jul05,jmp added fpReg as defined on other architectures. +01m,29dec03,jeg added REG_SET_MMU_TRANS_TBL macro. Added additional macros + required for RTP support. +01l,01dec03,jmp added mmuTransTbl (current MMU translation table) to REG_SET. +01k,24nov03,jeg added macros to manage supervisor bit +01j,18sep03,jeg removed SIM_STATUS_INIT macro. +01i,09sep03,jeg updated REG_SET structure to split intLockKey by a status + bit field. +01h,03apr03,dbt Removed references to ucontext. +01g,25mar03,dbt Replaced reg_onstack field in TDB with intLockKey. + Removed no longer used signal mask from REG_SET. + Enabled use of macro in assembly code. +01f,20mar03,jeg removed REG_XX definitions +01e,18mar03,dbt Added interrupt level in REG_SET. +01d,19jun01,jmp used host NGREG if defined. +01c,30dec97,dbt added common names for registers +01b,27oct95,ism cleanup +01a,12jun95,ism written +*/ + +#ifndef __INCregsSimsolarish +#define __INCregsSimsolarish + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +typedef struct /* Solaris VxSim Register Set */ + { + void * reg_pc; /* pc to retore */ + void * reg_npc; /* next pc to restore */ + int reg_psr; /* psr to restore */ + int reg_wbcnt; /* number of outstanding windows (always 0!) */ + int reg_tbr; /* not used for sim */ + int reg_y; /* y register to restore */ + int reg_status; /* status bit field */ + int unused[4]; /* unused (kept for backward compatibility) */ + int reg_global[8]; /* global registers */ + int reg_out[8]; /* out registers */ + int reg_local[8]; /* local registers */ + int reg_in[8]; /* in registers */ + int mmuTransTbl; /* current MMU translation table */ + int reserved[111]; /* unused (kept for backward compatibility) */ + } REG_SET; + +/* some common names for registers */ + +#undef pc +#define pc reg_pc /* program counter */ +#define reg_sp reg_out[6] /* stack pointer */ +#define reg_fp reg_in[6] /* frame pointer */ +#undef spReg +#define spReg reg_out[6] +#undef fpReg +#define fpReg reg_in[6] +#endif /* _ASMLANGUAGE */ + +#define REG_SET_PC 0x00 /* Program Counter */ +#define REG_SET_NPC 0x04 /* Next Program Counter */ +#define REG_SET_PSR 0x08 /* Processor Status Register */ +#define REG_SET_WIM 0x0C /* Window Invalid Mask */ +#define REG_SET_TBR 0x10 /* Trap Base Register */ +#define REG_SET_Y 0x14 /* Y Register */ +#define REG_SET_SIMSTATUS 0x18 /* Status Register */ +#define REG_SET_GLOBALS 0x2C /* Global Registers (%R0 - %R7) */ +#define REG_SET_OUTS 0x4C /* Out Registers (%R8 - %R15) */ +#define REG_SET_LOCALS 0x6C /* Local Registers (%R16 - %R23) */ +#define REG_SET_INS 0x8C /* In Registers (%R24 - %R31) */ +#define REG_SET_MMU_TRANS_TBL 0xAC + +#define REG_SET_GLOBAL(n) (REG_SET_GLOBALS + (4 * (n))) +#define REG_SET_OUT(n) (REG_SET_OUTS + (4 * (n))) +#define REG_SET_LOCAL(n) (REG_SET_LOCALS + (4 * (n))) +#define REG_SET_IN(n) (REG_SET_INS + (4 * (n))) + +#define PC_OFFSET REG_SET_PC /* referenced by pc() in usrLib */ + +#define REG_SET_SIZE 620 /* size of REG_SET struct */ + +/* registers offset into stack frame */ + +#define SF_REG_LOCALS 0 +#define SF_REG_INS 0x20 + +#define SF_REG_LOCAL(n) (SF_REG_LOCALS + (4 * (n))) +#define SF_REG_IN(n) (SF_REG_INS + (4 * (n))) + +/* status bit fields */ + +#define SIM_STATUS_INTLOCK 0x0001 /* interrupt locked */ +#define SIM_STATUS_INTUNLOCK 0x0000 /* interrupt unlocked */ +#define SIM_STATUS_SUP 0x0002 /* supervisor mode */ +#define SIM_STATUS_USR 0x0000 /* user mode */ + +/* macros to access interrupt status field */ + +#define VXSIM_INT_MASK_SET(vxsimStatus) \ + (vxsimStatus |= SIM_STATUS_INTLOCK) + +#define VXSIM_INT_MASK_CLEAR(vxsimStatus) \ + (vxsimStatus &= ~(SIM_STATUS_INTLOCK)) + +#define VXSIM_INT_MASK_GET(vxsimStatus) \ + (((vxsimStatus & SIM_STATUS_INTLOCK) == 0) ? FALSE : TRUE) + +#define VXSIM_SUP_MODE_SET(vxsimStatus) \ + (vxsimStatus |= SIM_STATUS_SUP) + +#define VXSIM_USR_MODE_SET(vxsimStatus) \ + (vxsimStatus &= ~(SIM_STATUS_SUP)) + +#define VXSIM_SUP_MODE_GET(vxsimStatus) \ + (((vxsimStatus & SIM_STATUS_SUP) == 0) ? FALSE : TRUE) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCregsSimsolarish */ diff --git a/h/arch/simsolaris/syscallArgsPaddingsparc.h b/h/arch/simsolaris/syscallArgsPaddingsparc.h new file mode 100644 index 0000000..a948097 --- /dev/null +++ b/h/arch/simsolaris/syscallArgsPaddingsparc.h @@ -0,0 +1,20 @@ +/* System call padding for sparc - align 64-bit elements */ + + +/* THIS FILE IS AUTO_GENERATED. PLEASE DO NOT EDIT. */ + +#ifndef _ASMLANGUAGE + +#include + +typedef struct syscall_args_padding_tbl { + int scNum; + int paddingEnum; +} SYSCALL_ARGS_PADDING_TBL; + +SYSCALL_ARGS_PADDING_TBL syscallArgsPaddingTbl[] = { + { SYSCALL_NUMBER (SCG_STANDARD, 28), 0x20 }, + { SYSCALL_NUMBER (SCG_VXWORKS, 31), 0x8 }, +}; + +#endif /* _ASMLANGUAGE */ diff --git a/h/arch/simsolaris/syscallArgssparc.h b/h/arch/simsolaris/syscallArgssparc.h new file mode 100644 index 0000000..07eaa12 --- /dev/null +++ b/h/arch/simsolaris/syscallArgssparc.h @@ -0,0 +1,757 @@ +/* Aligned for sparc - align 64-bit elements */ + + +/* THIS FILE IS AUTO_GENERATED. PLEASE DO NOT EDIT. */ + +#ifndef _ASMLANGUAGE + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct _exitScArgs + { + int status; + }; + +struct creatScArgs + { + const char * name; + mode_t flag; + }; + +struct _openScArgs + { + const char * name; + int flags; + int mode; + }; + +struct closeScArgs + { + int fd; + }; + +struct readScArgs + { + int fd; + void * buffer; + size_t maxbytes; + }; + +struct writeScArgs + { + int fd; + const void * buffer; + size_t nbytes; + }; + +struct _ioctlScArgs + { + int fd; + int function; + int arg; + }; + +struct dupScArgs + { + int fd; + }; + +struct dup2ScArgs + { + int fd; + int fd2; + }; + +struct pipeScArgs + { + int filedes[2]; + }; + +struct removeScArgs + { + const char * name; + }; + +struct selectScArgs + { + int width; + fd_set * readFds; + fd_set * writeFds; + fd_set * excFds; + struct timeval * timeout; + }; + +struct socketScArgs + { + int domain; + int type; + int protocol; + }; + +struct bindScArgs + { + int s; + struct sockaddr * name; + int namelen; + }; + +struct listenScArgs + { + int s; + int backlog; + }; + +struct acceptScArgs + { + int s; + struct sockaddr * addr; + int *addrlen; + }; + +struct connectScArgs + { + int s; + struct sockaddr * name; + int namelen; + }; + +struct sendtoScArgs + { + int s; + caddr_t buf; + int bufLen; + int flags; + struct sockaddr * to; + int tolen; + }; + +struct sendScArgs + { + int s; + const char * buf; + int bufLen; + int flags; + }; + +struct sendmsgScArgs + { + int s; + struct msghdr * mp; + int flags; + }; + +struct recvfromScArgs + { + int s; + char * buf; + int bufLen; + int flags; + struct sockaddr *from; + int * pFromLen; + }; + +struct recvScArgs + { + int s; + char * buf; + int bufLen; + int flags; + }; + +struct recvmsgScArgs + { + int s; + struct msghdr * mp; + int flags; + }; + +struct setsockoptScArgs + { + int s; + int level; + int optname; + char * optval; + int optlen; + }; + +struct getsockoptScArgs + { + int s; + int level; + int optname; + char * optval; + int * optlen; + }; + +struct getsocknameScArgs + { + int s; + struct sockaddr *name; + int * namelen; + }; + +struct getpeernameScArgs + { + int s; + struct sockaddr *name; + int *namelen; + }; + +struct shutdownScArgs + { + int s; + int how; + }; + +struct mmapScArgs + { + void * addr; + size_t len; + int prot; + int flags; + int fildes; + int offPad; + off_t64 off; + }; + +struct munmapScArgs + { + void * addr; + size_t len; + }; + +struct mprotectScArgs + { + void * addr; + size_t len; + int prot; + }; + +struct killScArgs + { + OBJ_HANDLE rtpId; + int signo; + }; + +struct sigpendingScArgs + { + sigset_t * pSet; + }; + +struct sigprocmaskScArgs + { + int how; + const sigset_t * pSet; + sigset_t * pOset; + }; + +struct _sigqueueScArgs + { + OBJ_HANDLE rtpId; + int signo; + const union sigval * pValue; + int sigCode; + }; + +struct sigsuspendScArgs + { + const sigset_t * pSet; + }; + +struct sigtimedwaitScArgs + { + const sigset_t * pSet; + struct siginfo * pInfo; + const struct timespec * pTime; + }; + +struct _sigactionScArgs + { + int signo; + const struct sigaction * pAct; + struct sigaction * pOact; + void * retAddr; + }; + +struct chdirScArgs + { + const char * name; + }; + +struct _getcwdScArgs + { + char * buffer; + int length; + }; + +struct waitpidScArgs + { + OBJ_HANDLE childRtpId; + int * pStatus; + int options; + }; + +struct sysctlScArgs + { + int *pName; + u_int nameLen; + void * pOld; + size_t * pOldLen; + void * pNew; + size_t newLen; + }; + +struct _schedPxInfoGetScArgs + { + BOOL * pTimeSlicingOn; + ULONG * pTimeSlicePeriod; + }; + +struct sigaltstackScArgs + { + stack_t * ss; + stack_t * oss; + }; + +struct unlinkScArgs + { + const char * name; + }; + +struct linkScArgs + { + const char * name; + const char * newname; + }; + +struct fsyncScArgs + { + int fd; + }; + +struct fdatasyncScArgs + { + int fd; + }; + +struct renameScArgs + { + const char * oldname; + const char * newname; + }; + +struct fpathconfScArgs + { + int fd; + int name; + }; + +struct pathconfScArgs + { + const char * path; + int name; + }; + +struct accessScArgs + { + const char * path; + int amode; + }; + +struct chmodScArgs + { + const char * path; + mode_t mode; + }; + +struct eventReceiveScArgs + { + UINT32 events; + UINT32 options; + int timeout; + UINT32 * pEvtsReceived; + }; + +struct eventSendScArgs + { + int taskId; + UINT32 events; + }; + +struct eventCtlScArgs + { + OBJ_HANDLE handle; + VX_EVT_CTL_CMD command; + void * pArg; + UINT * pArgSize; + }; + +struct msgQSendScArgs + { + OBJ_HANDLE handle; + char * buffer; + UINT nBytes; + int timeout; + int priority; + }; + +struct msgQReceiveScArgs + { + OBJ_HANDLE handle; + char * buffer; + UINT maxNBytes; + int timeout; + }; + +struct _msgQOpenScArgs + { + const char * name; + UINT maxMsgs; + UINT maxMsgLength; + int options; + int mode; + void * context; + }; + +struct objDeleteScArgs + { + OBJ_HANDLE handle; + int options; + }; + +struct objInfoGetScArgs + { + OBJ_HANDLE handle; + void * pInfo; + UINT * pInfoSize; + int level; + }; + +struct _semTakeScArgs + { + OBJ_HANDLE handle; + int timeout; + }; + +struct _semGiveScArgs + { + OBJ_HANDLE handle; + }; + +struct _semOpenScArgs + { + const char * name; + SEM_TYPE type; + int initState; + int options; + int mode; + void * context; + }; + +struct semCtlScArgs + { + OBJ_HANDLE handle; + VX_SEM_CTL_CMD command; + void * pArg; + UINT * pArgSize; + }; + +struct _taskOpenScArgs + { + struct vx_task_open_sc_args * pArgs; + }; + +struct taskCtlScArgs + { + int tid; + VX_TASK_CTL_CMD command; + void * pArg; + UINT * pArgSize; + }; + +struct taskDelayScArgs + { + int ticks; + }; + +struct rtpSpawnScArgs + { + const char * rtpFileName; + const char ** argv; + const char ** envp; + int priority; + int uStackSize; + int options; + int taskOptions; + }; + +struct rtpInfoGetScArgs + { + OBJ_HANDLE rtpId; + RTP_DESC * rtpStruct; + }; + +struct taskKillScArgs + { + OBJ_HANDLE taskHandle; + int signo; + }; + +struct _taskSigqueueScArgs + { + OBJ_HANDLE taskHandle; + int signo; + const union sigval * pValue; + int sigCode; + }; + +struct _timer_openScArgs + { + const char * name; + int mode; + clockid_t clockId; + struct sigevent * evp; + void * context; + }; + +struct timerCtlScArgs + { + TIMER_CTL_CMD cmdCode; + int handle; + void * pArgs; + UINT * pArgSize; + }; + +struct pxOpenScArgs + { + PX_OBJ_TYPE type; + const char * name; + int objOpenMode; + void * attr; + }; + +struct pxCloseScArgs + { + OBJ_HANDLE handle; + }; + +struct pxUnlinkScArgs + { + PX_OBJ_TYPE type; + const char * name; + }; + +struct pxCtlScArgs + { + OBJ_HANDLE handle; + PX_CTL_CMD_CODE cmdCode; + void * pArgs; + UINT * pArgSize; + }; + +struct pxMqReceiveScArgs + { + OBJ_HANDLE handle; + char * pMsg; + size_t msgLen; + unsigned int * pMsgPrio; + PX_WAIT_OPTION waitOption; + struct timespec * time_out; + }; + +struct pxMqSendScArgs + { + OBJ_HANDLE handle; + const char * pMsg; + size_t msgLen; + unsigned int msgPrio; + PX_WAIT_OPTION waitOption; + struct timespec * time_out; + }; + +struct pxSemWaitScArgs + { + OBJ_HANDLE handle; + PX_WAIT_OPTION waitOption; + struct timespec * time_out; + }; + +struct pxSemPostScArgs + { + OBJ_HANDLE handle; + }; + +struct pipeDevCreateScArgs + { + const char * name; + int nMessages; + int nBytes; + }; + +struct pipeDevDeleteScArgs + { + const char * name; + BOOL force; + }; + +struct _sdCreateScArgs + { + char * name; + int options; + UINT32 size; + int physAddressPad; + off_t64 physAddress; + MMU_ATTR attr; + void ** pVirtAddress; + }; + +struct _sdOpenScArgs + { + char * name; + int options; + int mode; + UINT32 size; + off_t64 physAddress; + MMU_ATTR attr; + void ** pVirtAddress; + }; + +struct sdDeleteScArgs + { + OBJ_HANDLE handle; + int options; + }; + +struct sdMapScArgs + { + OBJ_HANDLE handle; + MMU_ATTR attr; + int options; + }; + +struct sdUnmapScArgs + { + OBJ_HANDLE handle; + int options; + }; + +struct sdProtectScArgs + { + OBJ_HANDLE handle; + MMU_ATTR attr; + }; + +struct _edrErrorInjectScArgs + { + int kind; + const char *fileName; + int lineNumber; + REG_SET *regset; + void *addr; + const char *msg; + }; + +struct resSearchNScArgs + { + const char * name; + struct res_target * target; + }; + +struct wvEventScArgs + { + int eventId; + const char * pData; + unsigned int dataSize; + }; + +struct rtpVarAddScArgs + { + void ** pVar; + void * value; + }; + +struct sdInfoGetScArgs + { + OBJ_HANDLE handle; + SD_DESC * pSdStruct; + }; + +struct _shlOpenScArgs + { + const char * name; + int options; + }; + +struct _shlUnlockScArgs + { + SHL_ID shlId; + }; + +struct _shlCloseScArgs + { + SHL_ID shlId; + }; + +struct _shlGetScArgs + { + SHL_ID shlId; + SHLINFO *pInfo; + }; + +struct _shlPutScArgs + { + SHL_ID shlId; + const SHLINFO *pInfo; + }; + +struct objUnlinkScArgs + { + const char * name; + enum windObjClassType classType; + }; + +struct getprlimitScArgs + { + int idtype; + OBJ_HANDLE handle; + int resource; + struct rlimit *rlp; + }; + +struct setprlimitScArgs + { + int idtype; + OBJ_HANDLE handle; + int resource; + struct rlimit *rlp; + }; + +struct _mctlScArgs + { + void * addr; + size_t len; + int function; + int arg; + }; + +#endif /* _ASMLANGUAGE */ diff --git a/h/arch/simsolaris/syscallSimsolaris.h b/h/arch/simsolaris/syscallSimsolaris.h new file mode 100644 index 0000000..ec1f3cc --- /dev/null +++ b/h/arch/simsolaris/syscallSimsolaris.h @@ -0,0 +1,67 @@ +/* syscallSimsolaris.h - VxSim specific System Call Infrastructure header */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,10feb04,jeg added _func_syscallTrapHandle to fixe dependency issue + introduced into wdbDbgSysCallCheck() API. +01b,09feb04,jeg added syscallTrapHandle () prototype. +01a,26dec03,jeg written. +*/ + +/* +DESCRIPTION +This header contains VxSim-specific definitions and constants used by +the System Call Infrastructure library. + +*/ + +#ifndef __INCsyscallVxSimh +#define __INCsyscallVxSimh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define syscallDispatch_PORTABLE /* Use the portable dispatcher */ +#define SYSCALL_ENTRY_FRAME_SIZE 48 +#define _SYSCALL_USER_SP_CHECK(sp) /* XXX To implement */ + +/* typedefs */ + +#ifndef _ASMLANGUAGE + /* + * The SYSCALL_ENTRY_STATE structure defines the saved machine state + * when the system call trap is taken. This information is architecture + * specific, and is used by the system call dispatcher to restart system + * calls that have been interrupted by the occurance of signals. + * System call restart is achieved by restoring the saved state at the + * time of the system call trap, and re-issuing the system call. + * Arguments to the system call are saved on the kernel stack, and + * the address of that array is passed as an argument to the dispatcher. + * The layout of this structure must exactly match the ordering of members + * of the system call entry frame in src/arch/sim/syscallALib.s. + */ + +typedef struct syscall_entry_state + { + int args[8]; /* argument list (user stack) */ + int scn; /* System Call Number (SCN) in eax */ + int * pUStack; /* user-mode stack pointer */ + int statusReg; /* saved Status Register */ + void * pc; /* Trap return address */ + } SYSCALL_ENTRY_STATE; + +extern FUNCPTR _func_syscallTrapHandle; + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsyscallVxSimh */ diff --git a/h/arch/simsolaris/ulipSimsolaris.h b/h/arch/simsolaris/ulipSimsolaris.h new file mode 100644 index 0000000..70c0378 --- /dev/null +++ b/h/arch/simsolaris/ulipSimsolaris.h @@ -0,0 +1,23 @@ +#ifndef _ulip_io_h +#define _ulip_io_h + +/* Copyright 1993-96 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01a,07jun95,ism Imported. +*/ + +/* Description: Interface for direct access to ulip + * device driver. The ulip driver is + * a DLPI device simliar to Ethernet's + * le0. To talk directly to the + * device we need to wrap messages + * in DLPI protocol. + */ + +#define MAX_BUF_LEN 1500 +int ReadUlip (int fd, char * buf, int len); +int WriteUlip (int fd, char * buf, int len); + +#endif diff --git a/h/arch/simsolaris/vxSimsolarisLib.h b/h/arch/simsolaris/vxSimsolarisLib.h new file mode 100644 index 0000000..4f875c1 --- /dev/null +++ b/h/arch/simsolaris/vxSimsolarisLib.h @@ -0,0 +1,30 @@ +/* vxSimsolarisLib.h - header for board dependent routines for Solaris VxSim */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,01dec03,dbt Fixed vxPowerDown prototype. +01a,25mar03,dbt written. +*/ + +#ifndef __INCvxSimsolarisLibh +#define __INCvxSimsolarisLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +IMPORT void vxPowerDown (void); +IMPORT STATUS vxWindowsFlush (void); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvxSimsolarisLibh */ diff --git a/h/arch/simsolaris/vxsimHostArchLib.h b/h/arch/simsolaris/vxsimHostArchLib.h new file mode 100644 index 0000000..f3fcc64 --- /dev/null +++ b/h/arch/simsolaris/vxsimHostArchLib.h @@ -0,0 +1,63 @@ +/* vxsimHostArchLib.h - simulator UNIX/VxSim public interface header */ + +/* Copyright 2003-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01n,11jan05,jmp moved vxsimHostWdbPipeInit() to common vxsimHostLib.h. +01m,09mar04,jmp renamed vxsimHostFdInit() to vxsimHostTtyInit(). +01l,13oct03,jeg moved vxsimHostOpendir () prototype to vxsimHostLib.h. +01k,25aug03,jeg added vxsimHostGetgid () prototype +01j,05aug03,jeg moved vxsimHostShMemInit () prototype to vxsimHostLib.h. +01i,16jun03,dbt Removed vxsimHostStat() & vxsimHostFstatSize(). +01h,20may03,jmp moved vxsimHostModel() to vxsimHostLib.h. +01g,04apr03,dbt Added vxsimHostContextLoad() prototype. + Removed vxsimHostMakecontext() prototype. +01f,03apr03,jeg moved common routine definitions to target/h/vxsimHostLib.h +01e,01apr03,jeg Updated routines declaration +01d,20mar03,jeg added vxsimHostPrintf and vxsimHostProcAddrGet prototype. +01c,19mar03,dbt Removed some useless routines. + Modified vxsimHostIntLock()/vxsimHostIntUnlock() interfaces +01b,05mar03,jeg cleanup code. Removed unused routine declarations and Unix + type definitions. +01a,27jan03,jeg written, based on u_Lib.h +*/ + +/* +This header contains the prototype declarations for all UNIX and host routines +call made by VxSim. +*/ + +#ifndef __INCvxsimHostArchLibh +#define __INCvxsimHostArchLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types/vxCpu.h" /* Must come before regs.h */ +#include "passFsLib.h" /* Must come before regs.h */ +#include "regs.h" /* for REG_SET */ +#include "stat.h" /* for stat and statfs */ + +/* host side defined routines */ + +extern void vxsimHostTtyInit (int fd, int raw); +extern STATUS vxsimHostKill (int pid, int sig); +extern void vxsimHostContextLoad (REG_SET * pRegSet); +extern void * vxsimHostMalloc (int size); +extern STATUS vxsimHostSigdelset (int *set, int signo); +extern void * vxsimHostSignal (int signo, void * sigwhat); +extern STATUS vxsimHostSigprocmask (int how, int *set, int *oldset); +extern void vxsimHostTimerEnable (int clk, int ticksPerSecond); +extern void vxsimHostUserGet (char * hostname, char * hostip, + char * username, char * cwd); +extern void vxsimHostWdbDbgArchInit (void); +extern int vxsimHostGetgid (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvxsimHostArchLibh */ diff --git a/h/arpLib.h b/h/arpLib.h new file mode 100644 index 0000000..d775f35 --- /dev/null +++ b/h/arpLib.h @@ -0,0 +1,65 @@ +/* arpLib.h - VxWorks ARP table manipulation header file */ + +/* Copyright 1990 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02k,09oct01,rae merge from truestack +02j,07feb01,spm added merge record for 30jan01 update from version 02i of + tor2_0_x branch (base version 02h) and fixed modification + history; replaced printed error message with errno value +02i,30jan01,ijm merged ARP automatic linking fix (SPR #7576) +02h,22sep92,rrr added support for c++ +02g,07sep92,smb added include netinet/in.h to remove ANSI warnings +02f,04jul92,jcf cleaned up. +02e,11jun92,elh changed parameter to arpCmd. +02d,26may92,rrr the tree shuffle +02c,04apr92,elh added arpFlush. +02b,06jan92,elh passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +02a,18nov91,elh written. +*/ + +#ifndef __INCarpLibh +#define __INCarpLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "netinet/in.h" + +#if defined(__STDC__) || defined(__cplusplus) + +extern void arpLibInit (void); +extern STATUS arpAdd (char *host, char *eaddr, int flags); +extern STATUS arpDelete (char *host); +extern STATUS arpCmd (int cmd, struct in_addr * pIpAddr, u_char *pHwAddr, + int *pFlags); +extern void arpFlush (void); + +#else /* __STDC__ */ + +extern void arpLibInit (); +extern STATUS arpAdd (); +extern STATUS arpDelete (); +extern STATUS arpCmd (); +extern void arpFlush (); + +#endif /* __STDC__ */ + +/* error values */ + +#define S_arpLib_INVALID_ARGUMENT (M_arpLib | 1) +#define S_arpLib_INVALID_HOST (M_arpLib | 2) +#define S_arpLib_INVALID_ENET_ADDRESS (M_arpLib | 3) +#define S_arpLib_INVALID_FLAG (M_arpLib | 4) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCarpLibh */ diff --git a/h/arpa/inet.h b/h/arpa/inet.h new file mode 100644 index 0000000..656ae81 --- /dev/null +++ b/h/arpa/inet.h @@ -0,0 +1,71 @@ +/* inet.h - Internet header */ + +/* Copyright 1984 - 1999 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1983 Regents of the University of California. + + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * @(#)inet.h 5.2 (Berkeley) 6/27/88 + */ + +/* +modification history +-------------------- +01g,26jul99,spm added ansi/c++ prototypes for routines (SPR #5307) +01f,22sep92,rrr added support for c++ +01e,26may92,rrr the tree shuffle +01d,04oct91,rrr passed through the ansification filter + -changed copyright notice +01c,05oct90,shl added copyright notice. + added title. +01b,16apr89,gae updated to new 4.3BSD. +01a,22dec86,rdc created. +*/ + +#ifndef __INCineth +#define __INCineth + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * External definitions for + * functions in inet(3N) + */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern unsigned long inet_addr (char *); +extern char * inet_ntoa (struct in_addr); +extern struct in_addr inet_makeaddr (int, int); +extern unsigned long inet_network (char *); + +#else + +unsigned long inet_addr(); +char *inet_ntoa(); +struct in_addr inet_makeaddr(); +unsigned long inet_network(); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCafh */ diff --git a/h/asm.h b/h/asm.h new file mode 100644 index 0000000..4c05c79 --- /dev/null +++ b/h/asm.h @@ -0,0 +1,102 @@ +/* asm.h - assembler definitions header file */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02e,17apr03,dbt Added SIMLINUX support. +02d,22oct01,dee Merge from T2.1.0 ColdFire +02c,01mar00,frf Add SH4 support for T2 +02p,23apr97,hk added support for SH. +02b,15aug97,cym added support for SIMNT +02b,28nov96,cdp added ARM support. +021,29jun95,ism added support for SIMSPARCSOLARIS +01n,19mar95,dvs removed #ifdef TRON - tron no longer supported. +01m,18jun93,hdn added support for I80X86 +01l,02dec93,pme added Am29K support +01k,11aug93,gae vxsim hppa. +01j,20jun93,gae vxsim. +01i,22sep92,rrr added support for c++ +01h,04jul92,jcf cleaned up. +01g,26may92,rrr the tree shuffle + -changed includes to have absolute path from h/ +01f,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01e,02aug91,ajm added MIPS support +01d,19jul91,gae renamed architecture specific include file to be xx.h. +01c,29apr91,hdn added defines and macros for TRON architecture. +01b,05oct90,shl added copyright notice. + made #endif ANSI style. +01a,07may90,gae written. +*/ + +#ifndef __INCasmh +#define __INCasmh + +#ifdef __cplusplus +extern "C" { +#endif + +#if CPU_FAMILY==MC680X0 +#include "arch/mc68k/asmMc68k.h" +#endif /* MC680X0 */ + +#if CPU_FAMILY==COLDFIRE +#include "arch/coldfire/asmColdfire.h" +#endif /* COLDFIRE */ + +#if CPU_FAMILY==SPARC +#include "arch/sparc/asmSparc.h" +#endif /* SPARC */ + +#if CPU_FAMILY==SIMSPARCSUNOS +#include "arch/simsparc/asmSimsparc.h" +#endif /* SIMSPARCSUNOS */ + +#if CPU_FAMILY==SIMSPARCSOLARIS +#include "arch/simsolaris/asmSimsolaris.h" +#endif /* SIMSPARCSUNOS */ + +#if CPU_FAMILY==SIMHPPA +#include "arch/simhppa/asmSimhppa.h" +#endif /* SIMHPPA */ + +#if CPU_FAMILY==SIMLINUX +#include "arch/simlinux/asmSimlinux.h" +#endif /* SIMLINUX */ + +#if CPU_FAMILY==SIMNT +#include "arch/simnt/asmSimnt.h" +#endif /* SIMNT */ + +#if CPU_FAMILY==MIPS +#include "arch/mips/asmMips.h" +#endif /* MIPS */ + +#if CPU_FAMILY==PPC +#include "arch/ppc/asmPpc.h" +#endif /* PPC */ + +#if CPU_FAMILY==I80X86 +#include "arch/i86/asmI86.h" +#endif /* MIPS */ + +#if CPU_FAMILY==AM29XXX +#include "arch/am29k/asmAm29k.h" +#endif /* AM29XXX */ + +#if CPU_FAMILY==SH +#include "arch/sh/asmSh.h" +#endif /* SH */ + +#if CPU_FAMILY==ARM +#include "arch/arm/asmArm.h" +#endif /* ARM */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCasmh */ diff --git a/h/assert.h b/h/assert.h new file mode 100644 index 0000000..37f2373 --- /dev/null +++ b/h/assert.h @@ -0,0 +1,43 @@ +/* assert.h - ANSI standard assert functions header */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,13nov92,smb fixed assert macro to not generate warnings +01d,22sep92,rrr added support for c++ +01c,20jul92,smb added __assert extern. +01b,04jul92,jcf cleaned up. +01a,03jul92,smb written. +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types/vxANSI.h" + +#undef assert +#ifdef NDEBUG +#define assert(ignore) ((void) 0) +#else /* turn debugging on */ + +#define _ASSERT_STR(z) _ASSERT_TMP(z) +#define _ASSERT_TMP(z) #z + +#if defined(__STDC__) || defined(__cplusplus) +extern void __assert (const char *msg); +#else +extern void __assert (); +#endif + +#define assert(test) ((void) \ + ((test) ? ((void) 0) : \ + __assert("Assertion failed: "#test", file " \ + __FILE__ ", line "_ASSERT_STR(__LINE__)"\n"))) +#endif /* NDEBUG */ + +#ifdef __cplusplus +} +#endif diff --git a/h/auxv.h b/h/auxv.h new file mode 100644 index 0000000..7dc8c07 --- /dev/null +++ b/h/auxv.h @@ -0,0 +1,69 @@ +/* auxv.h - auxiliary vector header */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,03dec03,zl added AT_WINDSTKALN, AT_WINDCACHEALN +01a,03sep03,nrj written. +*/ + +#ifndef __INCauxvh +#define __INCauxvh + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifndef _ASMLANGUAGE + +typedef struct auxiliaryVector + { + int a_type; + union + { + long a_val; + void *a_ptr; + void (*a_fcn)(); + } a_un; + } auxv_t; + +#endif /* _ASMLANGUAGE */ + +#define AT_NULL 0 +#define AT_IGNORE 1 /* No meaning of entry */ +#define AT_EXECFD 2 /* a_val is fd for lib loader */ +#define AT_PHDR 3 /* runtime memory ptr for phdr */ +#define AT_PHENT 4 /* sizeof(phdr[0]) */ +#define AT_PHNUM 5 /* no. of phdr entries */ +#define AT_PAGESZ 6 /* a_val is page size */ +#define AT_BASE 7 /* a_ptr is loader base addr */ +#define AT_FLAGS 8 /* flags */ +#define AT_ENTRY 9 /* entry point */ +#define AT_DCACHEBSIZE 10 /* data cache block size */ +#define AT_ICACHEBSIZE 11 /* instruction cache block size */ +#define AT_UCACHEBSIZE 12 /* unified cache block size */ + +/* Specific to Wind River OS implementation */ + +#define AT_WINDVERSION 3000 /* VxWorks version */ + +#define AT_WINDHEAPSZ 3001 /* initial heap size for process */ +#define AT_WINDMEMALN 3002 /* memory alignment in bytes */ +#define AT_WINDCACHEALN 3003 /* cache alignment in bytes */ +#define AT_WINDSTKALN 3004 /* stack alignment in bytes */ +#define AT_WINDMMUSTAT 3005 /* state of MMU - enabled or not */ +#define AT_WINDLIBMMU 3006 /* mmu info for shared lib */ +#define AT_WINDLIBLD 3007 /* shared lib loader specific */ +#define AT_WINDLIBFD 3008 /* shared lib file desc */ +#define AT_WINDDBG 3009 /* Debugger info */ + +#define AT_WINDVXSIM 3010 /* reserved for VXSIM */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCauxvh */ diff --git a/h/avlLib.h b/h/avlLib.h new file mode 100644 index 0000000..bffba06 --- /dev/null +++ b/h/avlLib.h @@ -0,0 +1,71 @@ +/* avltLib.h - header file for AVL tree */ + +/* Copyright 1999-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,03may04,rp removed avlTreeErase +01b,06apr04,rp added avlInsertInform, avlRemoveInsert and avlTreeErase +01a,08feb03,zl moved out uint key version to avlUintLib, replaced + GENERIC_ARGUMENT with void *. +01g,08aug03,zl resolved avlLib aliasing problem. +01f,24jan01,sn end file with newline(!) to avoid cpp errors +01e,10feb00,abd added avlMinimumGet and avlMaximumGet +01d,10feb00,abd added avlTreeWalk, avlTreePrint, avlTreeErase, avlTreePrintErase +01c,03feb00,abd added avlInsertInform, avlRemoveInsert +01b,24jan00,abd added avlSuccessorGet and avlPredecessorGet +01a,08feb99,wkn created. +*/ + +#ifndef __INCavlLibh +#define __INCavlLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* typedefs */ + +typedef struct avl_node + { + struct avl_node * left; /* pointer to the left subtree */ + struct avl_node * right; /* pointer to the right subtree */ + int height; /* height of the subtree rooted at this node */ + } AVL_NODE; + +typedef AVL_NODE * AVL_TREE; /* points to the root node of the tree */ + +typedef STATUS (*AVL_COMPARE)(AVL_NODE *pNode, void * pKey); + +/* callback routines for avlUintTreeWalk */ + +typedef STATUS (*AVL_CALLBACK)(AVL_NODE *pNode, void * pArg); + +/* function declarations */ + +STATUS avlInsert (AVL_TREE * pRoot, AVL_NODE * pNode, void * pKey, + AVL_COMPARE cmpRtn); +AVL_NODE * avlDelete (AVL_TREE * pRoot, void * pKey, AVL_COMPARE cmpRtn); +AVL_NODE * avlSearch (AVL_TREE root, void * pKey, AVL_COMPARE cmpRtn); +AVL_NODE * avlSuccessorGet (AVL_TREE root, void * pKey, AVL_COMPARE cmpRtn); +AVL_NODE * avlPredecessorGet (AVL_TREE root, void * pKey, AVL_COMPARE cmpRtn); +AVL_NODE * avlMinimumGet (AVL_TREE root); +AVL_NODE * avlMaximumGet (AVL_TREE root); +STATUS avlTreeWalk (AVL_TREE pRoot, AVL_CALLBACK preRtn, void * preArg, + AVL_CALLBACK inRtn, void * inArg, + AVL_CALLBACK postRtn, void * postArg); +STATUS avlInsertInform (AVL_TREE * pRoot, void * pNewNode, void * key, + void ** ppKeyHolder, AVL_COMPARE cmpRtn); +void * avlRemoveInsert (AVL_TREE * pRoot, void * pNewNode, void * key, + AVL_COMPARE cmpRtn); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCavlLibh */ diff --git a/h/avlUintLib.h b/h/avlUintLib.h new file mode 100644 index 0000000..1e88aaf --- /dev/null +++ b/h/avlUintLib.h @@ -0,0 +1,60 @@ +/* avlUintLib.h - header file for AVL tree with unsigned integer sorting key */ + +/* Copyright 1999-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,02dec03,zl created based on avlLib.h. +*/ + +#ifndef __INCavlUintLibh +#define __INCavlUintLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* typedefs */ + +/* + * Binary tree node definition that uses an unsigned integer as the sorting + * key. + */ + +typedef struct avlu_node + { + struct avlu_node * left; /* pointer to the left subtree */ + struct avlu_node * right; /* pointer to the right subtree */ + int height; /* height of the subtree rooted at this node */ + UINT key; /* sorting key */ + } AVLU_NODE; + +typedef AVLU_NODE * AVLU_TREE; /* points to the root node of the tree */ + +/* callback routines for avlUintTreeWalk */ + +typedef STATUS (*AVLU_CALLBACK)(AVLU_NODE *pNode, void * pArg); + +/* function declarations */ + +STATUS avlUintInsert (AVLU_TREE * pRoot, AVLU_NODE * pNode); +AVLU_NODE * avlUintDelete (AVLU_TREE * pRoot, UINT key); +AVLU_NODE * avlUintSearch (AVLU_TREE root, UINT key); +AVLU_NODE * avlUintSuccessorGet (AVLU_TREE root, UINT key); +AVLU_NODE * avlUintPredecessorGet (AVLU_TREE root, UINT key); +AVLU_NODE * avlUintMinimumGet (AVLU_TREE root); +AVLU_NODE * avlUintMaximumGet (AVLU_TREE root); +STATUS avlUintTreeWalk (AVLU_TREE pRoot, AVLU_CALLBACK preRtn, + void * preArg, AVLU_CALLBACK inRtn, void * inArg, + AVLU_CALLBACK postRtn, void * postArg); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCavlUintLibh */ diff --git a/h/b_out.h b/h/b_out.h new file mode 100644 index 0000000..d930bad --- /dev/null +++ b/h/b_out.h @@ -0,0 +1,195 @@ +/* b_out.h - b.out object module header */ + +/* +modification history +-------------------- +01f,22sep92,rrr added support for c++ +01e,04jul92,jcf cleaned up. +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01b,09jun91,del added pragma for building w/o -mic-compat flag w/ gcc960. +01a,31mar91,del installed from gnu960. +*/ + +#ifndef __INCb_outh +#define __INCb_outh + +#ifdef __cplusplus +extern "C" { +#endif + + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* This file is a modified version of 'a.out.h'. It is to be used in all + * all GNU tools modified to support the i80960 (or tools that operate on + * object files created by such tools). + * + * All i80960 development is done in a CROSS-DEVELOPMENT environment. I.e., + * object code is generated on, and executed under the direction of a symbolic + * debugger running on, a host system. We do not want to be subject to the + * vagaries of which host it is or whether it supports COFF or a.out format, + * or anything else. We DO want to: + * + * o always generate the same format object files, regardless of host. + * + * o have an 'a.out' header that we can modify for our own purposes + * (the 80960 is typically an embedded processor and may require + * enhanced linker support that the normal a.out.h header can't + * accommodate). + * + * As for byte-ordering, the following rules apply: + * + * o Text and data that is actually downloaded to the target is always + * in i80960 (little-endian) order. + * + * o All other numbers (in the header, symbols, relocation directives) + * are in host byte-order: object files CANNOT be lifted from a + * little-end host and used on a big-endian (or vice versa) without + * modification. + * + * o The downloader ('comm960') takes care to generate a pseudo-header + * with correct (i80960) byte-ordering before shipping text and data + * off to the NINDY monitor in the target systems. Symbols and + * relocation info are never sent to the target. + */ + + +#define BMAGIC 0415 +/* We don't accept the following (see N_BADMAG macro). + * They're just here so GNU code will compile. + */ +#define OMAGIC 0407 /* old impure format */ +#define NMAGIC 0410 /* read-only text */ +#define ZMAGIC 0413 /* demand load format */ + +/* FILE HEADER + * All 'lengths' are given as a number of bytes. + * All 'alignments' are for relinkable files only; an alignment of + * 'n' indicates the corresponding segment must begin at an + * address that is a multiple of (2**n). + */ +struct exec { + /* Standard stuff */ + unsigned long a_magic; /* Identifies this as a b.out file */ + unsigned long a_text; /* Length of text */ + unsigned long a_data; /* Length of data */ + unsigned long a_bss; /* Length of runtime uninitialized data area */ + unsigned long a_syms; /* Length of symbol table */ + unsigned long a_entry; /* Runtime start address */ + unsigned long a_trsize; /* Length of text relocation info */ + unsigned long a_drsize; /* Length of data relocation info */ + + /* Added for i960 */ + unsigned long a_tload; /* Text runtime load address */ + unsigned long a_dload; /* Data runtime load address */ + unsigned char a_talign; /* Alignment of text segment */ + unsigned char a_dalign; /* Alignment of data segment */ + unsigned char a_balign; /* Alignment of bss segment */ + unsigned char unused; /* (Just to make struct size a multiple of 4) */ +}; + +#define N_BADMAG(x) (((x).a_magic)!=BMAGIC) +#define N_TXTOFF(x) ( sizeof(struct exec) ) +#define N_DATOFF(x) ( N_TXTOFF(x) + (x).a_text ) +#define N_TROFF(x) ( N_DATOFF(x) + (x).a_data ) +#define N_DROFF(x) ( N_TROFF(x) + (x).a_trsize ) +#define N_SYMOFF(x) ( N_DROFF(x) + (x).a_drsize ) +#define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms ) + +/* A single entry in the symbol table + */ +struct nlist { + union { + char *n_name; + struct nlist *n_next; + long n_strx; /* Index into string table */ + } n_un; + char n_type; /* See below */ + char n_other; /* Used in i80960 support -- see below */ + short n_desc; + unsigned n_value; +}; + + +/* Legal values of n_type + */ +#define N_UNDF 0 /* Undefined symbol */ +#define N_ABS 2 /* Absolute symbol */ +#define N_TEXT 4 /* Text symbol */ +#define N_DATA 6 /* Data symbol */ +#define N_BSS 8 /* BSS symbol */ +#define N_FN 31 /* Filename symbol */ +#define N_BAL 0x10 /* I80960 BAL entry point to function */ + +#define N_EXT 1 /* External symbol (OR'd in with one of above) */ +#define N_TYPE 036 /* Mask for all the type bits */ +#define N_STAB 0340 /* Mask for all bits used for SDB entries */ + +/* MEANING OF 'n_other' + * + * If non-zero, the 'n_other' fields indicates either a leaf procedure or + * a system procedure, as follows: + * + * 1 <= n_other <= 32 : + * The symbol is the entry point to a system procedure. + * 'n_value' is the address of the entry, as for any other + * procedure. The system procedure number (which can be used in + * a 'calls' instruction) is (n_other-1). These entries come from + * '.sysproc' directives. + * + * n_other == N_CALLNAME + * the symbol is the 'call' entry point to a leaf procedure. + * The *next* symbol in the symbol table must be the corresponding + * 'bal' entry point to the procedure (see following). These + * entries come from '.leafproc' directives in which two different + * symbols are specified (the first one is represented here). + * + * + * n_other == N_BALNAME + * the symbol is the 'bal' entry point to a leaf procedure. + * These entries result from '.leafproc' directives in which only + * one symbol is specified, or in which the same symbol is + * specified twice. + * + * Note that an N_CALLNAME entry *must* have a corresponding N_BALNAME entry, + * but not every N_BALNAME entry must have an N_CALLNAME entry. + */ +#define N_CALLNAME -1 +#define N_BALNAME -2 + + +struct relocation_info { + int r_address; /* File address of item to be relocated */ + unsigned + r_symbolnum:24,/* Index of symbol on which relocation is based*/ + r_pcrel:1, /* 1 => relocate PC-relative; else absolute + * On i960, pc-relative implies 24-bit + * address, absolute implies 32-bit. + */ + r_length:2, /* Number of bytes to relocate: + * 0 => 1 byte + * 1 => 2 bytes + * 2 => 4 bytes -- only value used for i960 + */ + r_extern:1, + r_bsr:1, /* Something for the GNU NS32K assembler */ + r_disp:1, /* Something for the GNU NS32K assembler */ + r_callj:1, /* 1 if relocation target is an i960 'callj' */ + nuthin:1; /* Unused */ +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCb_outh */ diff --git a/h/blkIo.h b/h/blkIo.h new file mode 100644 index 0000000..bc00b12 --- /dev/null +++ b/h/blkIo.h @@ -0,0 +1,52 @@ +/* blkIo.h - block I/O header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,22sep92,rrr added support for c++ +01h,04jul92,jcf cleaned up. +01g,26may92,rrr the tree shuffle +01f,04oct91,rrr passed through the ansification filter + -changed READ, WRITE and UPDATE to O_RDONLY O_WRONLY O_RDWR + -changed copyright notice +01e,05oct90,shl added copyright notice. + made #endif ANSI style. +01d,12jul90,kdl added bd_statusChk routine field in BLK_DEV. +01c,04may90,kdl added bd_mode and bd_readyChanged in BLK_DEV. +01b,23mar90,kdl changed types for lint, changed BLK_DEV field names. +01a,15mar90,kdl written +*/ + +#ifndef __INCblkIoh +#define __INCblkIoh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + +typedef struct /* BLK_DEV */ + { + FUNCPTR bd_blkRd; /* function to read blocks */ + FUNCPTR bd_blkWrt; /* function to write blocks */ + FUNCPTR bd_ioctl; /* function to ioctl device */ + FUNCPTR bd_reset; /* function to reset device */ + FUNCPTR bd_statusChk; /* function to check status */ + BOOL bd_removable; /* removable medium flag */ + ULONG bd_nBlocks; /* number of blocks on device */ + ULONG bd_bytesPerBlk; /* number of bytes per block */ + ULONG bd_blksPerTrack; /* number of blocks per track */ + ULONG bd_nHeads; /* number of heads */ + int bd_retry; /* retry count for I/O errors */ + int bd_mode; /* O_RDONLY |O_WRONLY| O_RDWR */ + BOOL bd_readyChanged; /* dev ready status changed */ + } BLK_DEV; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCblkIoh */ diff --git a/h/bmpLib.h b/h/bmpLib.h new file mode 100644 index 0000000..d5b8d72 --- /dev/null +++ b/h/bmpLib.h @@ -0,0 +1,107 @@ +/* bmpLib.h - bitmap library header file */ + +/* Copyright 1998-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,04aug00,pfl cleaned up, added comment. +01b,19nov98,tam added bitGet(). +01a,15sep98,tam written. +*/ + +#ifndef __INCbmpLibh +#define __INCbmpLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* bitmap macros */ + +#define BMP_WORD_BIT_SIZE 32 + +extern UINT bitFirstGet (UINT32 * , UINT , UINT); + +/******************************************************************************* +* +* bitGet - get the value of a bit +* +* DESCRIPTION +* This macro returns the value of a bit in a bitmap. is the +* bit position between 0 and (bitmap size - 1). is the start +* address of the bitmap. +* +* RETURNS +* Value of a specific bit. +* +* NOMANUAL +*/ + +#define bitGet(bitNo,addr) \ + ((*(UINT32 *)(((UINT32 *)(addr)) + ((bitNo) >> 5))) & \ + (0x80000000 >> ((bitNo) & (BMP_WORD_BIT_SIZE-1)))) + +/******************************************************************************* +* +* bitSet - set a bit +* +* DESCRIPTION +* This macro sets the value (1) of a bit in a bitmap. is the +* bit position between 0 and (bitmap size - 1). is the start +* address of the bitmap. +* +* RETURNS +* N/A +* +* NOMANUAL +*/ + +#define bitSet(bitNo,addr) \ + (*(UINT32 *)(((UINT32 *)(addr)) + ((bitNo) >> 5))) |= \ + (0x80000000 >> ((bitNo) & (BMP_WORD_BIT_SIZE-1))) + +/******************************************************************************* +* +* bitClear - clear a bit +* +* DESCRIPTION +* This macro clears the value (0) of a bit in a bitmap. is the +* bit position between 0 and (bitmap size - 1). is the start +* address of the bitmap. +* +* RETURNS +* N/A +* +* NOMANUAL +*/ + +#define bitClear(bitNo,addr) \ + (*(UINT32 *)(((UINT32 *)(addr)) + ((bitNo) >> 5))) &= \ + ~(0x80000000 >> ((bitNo) & (BMP_WORD_BIT_SIZE-1))) + +/******************************************************************************* +* +* bitChange - change a bit +* +* DESCRIPTION +* This macro toggles the value of a bit in a bitmap. is the +* bit position between 0 and (bitmap size - 1). is the start +* address of the bitmap. +* +* RETURNS +* N/A +* +* NOMANUAL +*/ + +#define bitChange(bitNo,addr) \ + (*(UINT32 *)(((UINT32 *)(addr)) + ((bitNo) >> 5))) ^= \ + (0x80000000 >> ((bitNo) & (BMP_WORD_BIT_SIZE-1))) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCbmpLibh */ diff --git a/h/bootEcoffLib.h b/h/bootEcoffLib.h new file mode 100644 index 0000000..623d615 --- /dev/null +++ b/h/bootEcoffLib.h @@ -0,0 +1,35 @@ +/* bootEcoffLib.h - extended COFF object module boot loader library header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,22sep92,rrr added support for c++ +01a,23jul92,ajm written +*/ + +#ifndef __INCbootEcoffLibh +#define __INCbootEcoffLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS bootEcoffInit (); + +#else /* __STDC__ */ + +extern STATUS bootEcoffInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCbootEcoffLibh */ diff --git a/h/bootElfLib.h b/h/bootElfLib.h new file mode 100644 index 0000000..2d65287 --- /dev/null +++ b/h/bootElfLib.h @@ -0,0 +1,34 @@ +/* bootElfLib.h - ELF object module boot loader library header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,25oct93,cd created from bootEcoffLib.h v01b +*/ + +#ifndef __INCbootElfLibh +#define __INCbootElfLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS bootElfInit (); + +#else /* __STDC__ */ + +extern STATUS bootElfInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCbootElfLibh */ diff --git a/h/bootLib.h b/h/bootLib.h new file mode 100644 index 0000000..67e53a7 --- /dev/null +++ b/h/bootLib.h @@ -0,0 +1,93 @@ +/* bootLib.h - boot support subroutine library */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01n,21oct03,bpn Added bootStringToStructAdd() prototype. +01m,13mar02,jkf Fixed SPR#74251, increased BOOT_DEV_LEN, BOOT_FILE_LEN, + and BOOT_FIELD_LEN, changed copyright date to 2002. +01l,15may97,spm fixed SPR 8533: increased BOOT_PARAMS field sizes to prevent + overflow with DHCP client leases +01k,30apr97,spm moved unit number field to end of BOOT_PARAMS structure +01j,16dec96,spm removed conditional include from DHCP client code +01i,03dec96,spm added conditional include to DHCP client code +01h,27nov96,spm added support for DHCP client and network device unit numbers +01g,22sep92,rrr added support for c++ +01f,04jul92,jcf cleaned up. +01e,26may92,rrr the tree shuffle +01d,04oct91,rrr passed through the ansification filter + -changed VOID to void + -changed copyright notice +01c,05oct90,shl added ANSI function prototypes. + added copyright notice. +01b,10aug90,dnw added declaration of bootParamsErrorPrint(). +01a,18jul90,dnw written +*/ + +#ifndef __INCbootLibh +#define __INCbootLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* BOOT_PARAMS is a structure containing all the fields of the VxWorks + * boot line. The routines in bootLib convert this structure to and + * from the boot line ascii string. + */ + +#define BOOT_DEV_LEN 40 /* max chars in device name */ +#define BOOT_HOST_LEN 20 /* max chars in host name */ +#define BOOT_ADDR_LEN 30 /* max chars in net addr */ +#define BOOT_TARGET_ADDR_LEN 50 /* IP address + mask + lease times */ +#define BOOT_ADDR_LEN 30 /* max chars in net addr */ +#define BOOT_FILE_LEN 160 /* max chars in file name */ +#define BOOT_USR_LEN 20 /* max chars in user name */ +#define BOOT_PASSWORD_LEN 20 /* max chars in password */ +#define BOOT_OTHER_LEN 80 /* max chars in "other" field */ + +#define BOOT_FIELD_LEN 160 /* max chars in any boot field */ + +typedef struct /* BOOT_PARAMS */ + { + char bootDev [BOOT_DEV_LEN]; /* boot device code */ + char hostName [BOOT_HOST_LEN]; /* name of host */ + char targetName [BOOT_HOST_LEN]; /* name of target */ + char ead [BOOT_TARGET_ADDR_LEN]; /* ethernet internet addr */ + char bad [BOOT_TARGET_ADDR_LEN]; /* backplane internet addr */ + char had [BOOT_ADDR_LEN]; /* host internet addr */ + char gad [BOOT_ADDR_LEN]; /* gateway internet addr */ + char bootFile [BOOT_FILE_LEN]; /* name of boot file */ + char startupScript [BOOT_FILE_LEN]; /* name of startup script file */ + char usr [BOOT_USR_LEN]; /* user name */ + char passwd [BOOT_PASSWORD_LEN]; /* password */ + char other [BOOT_OTHER_LEN]; /* available for applications */ + int procNum; /* processor number */ + int flags; /* configuration flags */ + int unitNum; /* network device unit number */ + } BOOT_PARAMS; + +/* function declarations */ + +IMPORT STATUS bootBpAnchorExtract (char * string, char ** pAnchorAdrs); +IMPORT STATUS bootLeaseExtract (char * string, u_long * pLeaseLen, + u_long * pLeaseStart); +IMPORT STATUS bootNetmaskExtract (char * string, int * pNetmask); +IMPORT STATUS bootScanNum (char ** ppString, int * pValue, BOOL hex); +IMPORT STATUS bootStructToString (char * paramString, + BOOT_PARAMS * pBootParams); +IMPORT char * bootStringToStruct (char * bootString, + BOOT_PARAMS * pBootParams); +IMPORT char * bootStringToStructAdd (char * bootString, + BOOT_PARAMS * pBootParams); +IMPORT void bootParamsErrorPrint (char * bootString, char * pError); +IMPORT void bootParamsPrompt (char * string); +IMPORT void bootParamsShow (char * paramString); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCbootLibh */ diff --git a/h/bootLoadLib.h b/h/bootLoadLib.h new file mode 100644 index 0000000..a1e5ce6 --- /dev/null +++ b/h/bootLoadLib.h @@ -0,0 +1,48 @@ +/* bootLoadLib.h - object module boot loader library header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,22sep92,rrr added support for c++ +01c,04jul92,jcf cleaned up. +01b,23jun92,ajm fixed function prototype for bootLoadModule +01a,01jun92,ajm written +*/ + +#ifndef __INCbootLoadLibh +#define __INCbootLoadLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "symLib.h" + +/* status codes */ + +#define S_bootLoadLib_ROUTINE_NOT_INSTALLED (M_bootLoadLib | 1) + +/* data structures */ + +extern FUNCPTR bootLoadRoutine; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS bootLoadModule (int fd, FUNCPTR *pEntry); + +#else /* __STDC__ */ + +extern STATUS bootLoadModule (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCbootLoadLibh */ diff --git a/h/bootpLib.h b/h/bootpLib.h new file mode 100644 index 0000000..a713431 --- /dev/null +++ b/h/bootpLib.h @@ -0,0 +1,283 @@ +/* bootpLib.h - BOOTP client include file */ + +/* Copyright 1990 - 2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01n,14jun00,spm upgraded to RFC 1542 and removed direct link-level access; + changed interface to isolate message body values from options +01m,07apr97,spm changed BOOTP interface to DHCP style: all options supported +01l,26sep96,spm fixed SPR 7120: added parameter for gateway to bootpParamsGet +01k,22sep92,rrr added support for c++ +01j,04jul92,jcf cleaned up. +01i,11jun92,elh modified parameters to bootpParamsGet. +01h,26may92,rrr the tree shuffle + -changed includes to have absolute path from h/ +01g,17apr92,elh moved prototypes icmpLib. +01f,28feb92,elh ansified. +01e,27aug91,elh added RFC 1048 stuff, and added errors. +01d,12aug90,dnw changed retransmission delay parameters +01c,12aug90,hjb major revision +01b,19apr90,hjb added VX_LOG_FILE definition +01a,11mar90,hjb written +*/ + +#ifndef __INCbootpLibh +#define __INCbootpLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vwModNum.h" +#include "netinet/in.h" + +/* defines */ + /* BOOTP reserved ports */ +#define _BOOTP_SPORT 67 +#define _BOOTP_CPORT 68 + +#define BOOTREQUEST 1 /* BOOTP operations */ +#define BOOTREPLY 2 + +#define SIZE_HLEN 16 +#define SIZE_SNAME 64 +#define SIZE_VEND 64 +#define SIZE_FILE 128 + +#define UDPHL sizeof (struct udphdr) /* UDP header length */ +#define IPHL sizeof (struct ip) /* IP header length */ + +/* retransmission delay parameters */ + +#define INIT_BOOTP_DELAY 4 /* initial retransmit delay (secs) */ +#define MAX_BOOTP_DELAY 64 /* maximum retransmit delay (secs) */ + +/* Hardware type values from the arp section of the assigned numbers RFC. */ + +#define ETHER 1 /* Ethernet (10Mb) */ +#define EXPETHER 2 /* Experimental Ethernet (3Mb) */ +#define AX25 3 /* Amateur Radio AX.25 */ +#define PRONET 4 /* Proteon ProNET Token Ring */ +#define CHAOS 5 /* Chaos */ +#define IEEE802 6 /* IEEE 802 Networks */ +#define ARCNET 7 /* ARCNET */ +#define HYPERCH 8 /* Hyperchannel */ +#define LANSTAR 9 /* Lanstar */ +#define AUTONET 10 /* Autonet Short Address */ +#define LOCALTALK 11 /* LocalTalk */ +#define LOCALNET 12 /* LocalNet */ +#define ULTRALINK 13 /* Ultra link */ +#define FRAMERELAY 15 /* Frame Relay */ +#define SERIAL 20 /* Serial Line */ +#define DNS_NAME 128 /* DNS name */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* dont optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + + /* BOOTP message structure */ +typedef struct bootp_msg + { + unsigned char bp_op; /* packet opcode type */ + unsigned char bp_htype; /* hardware addr type */ + unsigned char bp_hlen; /* hardware addr length */ + unsigned char bp_hops; /* gateway hops */ + unsigned long bp_xid; /* transaction ID */ + unsigned short bp_secs; /* seconds since boot */ + unsigned short bp_unused; + struct in_addr bp_ciaddr; /* client IP address */ + struct in_addr bp_yiaddr; /* 'your' IP address */ + struct in_addr bp_siaddr; /* server IP address */ + struct in_addr bp_giaddr; /* gateway IP address */ + unsigned char bp_chaddr [SIZE_HLEN]; /* client hardware addr */ + unsigned char bp_sname [SIZE_SNAME]; /* server host name */ + unsigned char bp_file [SIZE_FILE]; /* boot file name */ + unsigned char bp_vend [SIZE_VEND]; /* vendor-specific area */ + } BOOTP_MSG; + +#define BOOTPLEN sizeof (struct bootp_msg) + +struct in_addr_list + { + unsigned char num; + struct in_addr * addrlist; + }; + +struct ushort_list + { + unsigned char num; + unsigned short * shortlist; + }; + +struct bootpParams /* BOOTP options/vendor extensions from RFC 1533 */ + { + struct in_addr * netmask; + unsigned short * timeOffset; + struct in_addr_list * routers; + struct in_addr_list * timeServers; + struct in_addr_list * nameServers; + struct in_addr_list * dnsServers; + struct in_addr_list * logServers; + struct in_addr_list * cookieServers; + struct in_addr_list * lprServers; + struct in_addr_list * impressServers; + struct in_addr_list * rlpServers; + char * clientName; + unsigned short * filesize; + char * dumpfile; + char * domainName; + struct in_addr * swapServer; + char * rootPath; + char * extoptPath; + unsigned char * ipForward; + unsigned char * nonlocalSourceRoute; + struct in_addr_list * policyFilter; + unsigned short * maxDgramSize; + unsigned char * ipTTL; + unsigned long * mtuTimeout; + struct ushort_list * mtuTable; + unsigned short * intfaceMTU; + unsigned char * allSubnetsLocal; + struct in_addr * broadcastAddr; + unsigned char * maskDiscover; + unsigned char * maskSupplier; + unsigned char * routerDiscover; + struct in_addr * routerDiscAddr; + struct in_addr_list * staticRoutes; + unsigned char * arpTrailers; + unsigned long * arpTimeout; + unsigned char * etherPacketType; + unsigned char * tcpTTL; + unsigned long * tcpInterval; + unsigned char * tcpGarbage; + char * nisDomain; + struct in_addr_list * nisServers; + struct in_addr_list * ntpServers; + char * vendString; + struct in_addr_list * nbnServers; + struct in_addr_list * nbddServers; + unsigned char * nbNodeType; + char * nbScope; + struct in_addr_list * xFontServers; + struct in_addr_list * xDisplayManagers; + char * nispDomain; + struct in_addr_list * nispServers; + struct in_addr_list * ipAgents; + struct in_addr_list * smtpServers; + struct in_addr_list * pop3Servers; + struct in_addr_list * nntpServers; + struct in_addr_list * wwwServers; + struct in_addr_list * fingerServers; + struct in_addr_list * ircServers; + struct in_addr_list * stServers; + struct in_addr_list * stdaServers; + }; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off */ +#endif /* CPU_FAMILY==I960 */ + +#define VM_RFC1048 { 99, 130, 83, 99 } + + +#define TAG_PAD 0 /* RFC 1048 vendor tags */ +#define TAG_SUBNET_MASK 1 +#define TAG_TIME_OFFSET 2 +#define TAG_GATEWAY 3 +#define TAG_TIME_SERVER 4 +#define TAG_NAME_SERVER 5 +#define TAG_DNS_SERVER 6 +#define TAG_LOG_SERVER 7 +#define TAG_COOKIE_SERVER 8 +#define TAG_LPR_SERVER 9 +#define TAG_IMPRESS_SERVER 10 +#define TAG_RLP_SERVER 11 +#define TAG_HOSTNAME 12 +#define TAG_END 255 +#define TAG_BOOTSIZE 13 /* RFC 1084 vendor tags */ +#define TAG_MERIT_DUMP 14 /* RFC 1395 vendor tags */ +#define TAG_DNS_DOMAIN 15 +#define TAG_SWAP_SERVER 16 +#define TAG_ROOT_PATH 17 +#define TAG_EXTENSIONS_PATH 18 /* RFC 1497 vendor tags */ +#define TAG_IP_FORWARD 19 /* RFC 1533 vendor tags */ +#define TAG_NONLOCAL_SRCROUTE 20 +#define TAG_POLICY_FILTER 21 +#define TAG_MAX_DGRAM_SIZE 22 +#define TAG_DEFAULT_IP_TTL 23 +#define TAG_MTU_AGING_TIMEOUT 24 +#define TAG_MTU_PLATEAU_TABLE 25 +#define TAG_IF_MTU 26 +#define TAG_ALL_SUBNET_LOCAL 27 +#define TAG_BRDCAST_ADDR 28 +#define TAG_MASK_DISCOVER 29 +#define TAG_MASK_SUPPLIER 30 +#define TAG_ROUTER_DISCOVER 31 +#define TAG_ROUTER_SOLICIT 32 +#define TAG_STATIC_ROUTE 33 +#define TAG_TRAILER 34 +#define TAG_ARP_CACHE_TIMEOUT 35 +#define TAG_ETHER_ENCAP 36 +#define TAG_DEFAULT_TCP_TTL 37 +#define TAG_KEEPALIVE_INTER 38 +#define TAG_KEEPALIVE_GARBA 39 +#define TAG_NIS_DOMAIN 40 +#define TAG_NIS_SERVER 41 +#define TAG_NTP_SERVER 42 +#define TAG_VENDOR_SPEC 43 +#define TAG_NBN_SERVER 44 +#define TAG_NBDD_SERVER 45 +#define TAG_NB_NODETYPE 46 +#define TAG_NB_SCOPE 47 +#define TAG_XFONT_SERVER 48 +#define TAG_XDISPLAY_MANAGER 49 +#define TAG_NISP_DOMAIN 64 +#define TAG_NISP_SERVER 65 +#define TAG_MOBILEIP_HA 68 +#define TAG_SMTP_SERVER 69 +#define TAG_POP3_SERVER 70 +#define TAG_NNTP_SERVER 71 +#define TAG_WWW_SERVER 72 +#define TAG_FINGER_SERVER 73 +#define TAG_IRC_SERVER 74 +#define TAG_ST_SERVER 75 +#define TAG_STDA_SERVER 76 + +/* error values */ + +#define S_bootpLib_INVALID_ARGUMENT (M_bootpLib | 1) +#define S_bootpLib_INVALID_COOKIE (M_bootpLib | 2) +#define S_bootpLib_NO_BROADCASTS (M_bootpLib | 3) +#define S_bootpLib_PARSE_ERROR (M_bootpLib | 4) +#define S_bootpLib_INVALID_TAG (M_bootpLib | 5) +#define S_bootpLib_TIME_OUT (M_bootpLib | 6) +#define S_bootpLib_MEM_ERROR (M_bootpLib | 7) +#define S_bootpLib_NOT_INITIALIZED (M_bootpLib | 8) +#define S_bootpLib_BAD_DEVICE (M_bootpLib | 9) + +/* function prototypes */ + +#if defined(__STDC__) || defined(__cplusplus) +STATUS bootpLibInit (int); +STATUS bootpParamsGet (struct ifnet *, u_int, struct in_addr *, + struct in_addr *, char *, char *, + struct bootpParams *); +STATUS bootpMsgGet (struct ifnet *, struct in_addr *, USHORT, USHORT, + BOOTP_MSG *, u_int); +#else /* __STDC__ */ + +STATUS bootpLibInit (); +STATUS bootpParamsGet (); +STATUS bootpMsgGet (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCbootpLibh */ diff --git a/h/bpfDrv.h b/h/bpfDrv.h new file mode 100644 index 0000000..85553a2 --- /dev/null +++ b/h/bpfDrv.h @@ -0,0 +1,42 @@ +/* bpfDrv.h - include file for Berkeley Packet Filter (BPF) I/O interface */ + +/* Copyright 1999 - 2000 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,05apr00,spm added interface to remove I/O device +01a,24nov99,spm written +*/ + +#ifndef __INCbpfDrvh +#define __INCbpfDrvh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "net/bpf.h" + +/* function declarations */ + +#if defined (__STDC__) || defined(__cplusplus) + +extern STATUS bpfDrv (void); +extern STATUS bpfDevCreate (char *pDevName, int numUnits, int bufSize); +extern STATUS bpfDevDelete (char *pDevName); +extern STATUS bpfDrvRemove (void); +#else /* __STDC__ */ + +extern STATUS bpfDrv (); +extern STATUS bpfDevCreate (); +extern STATUS bpfDevDelete (); +extern STATUS bpfDrvRemove (); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCbpfDrvh */ diff --git a/h/bsdSockLib.h b/h/bsdSockLib.h new file mode 100644 index 0000000..1ed99d5 --- /dev/null +++ b/h/bsdSockLib.h @@ -0,0 +1,89 @@ +/* bsdSockLib.h - UNIX BSD 4.4 compatible socket library header */ + +/* Copyright 1984 - 1997 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,29apr99,pul Upgraded NPT phase3 code to tor2.0.0 +01d,02feb99,sgv added definition of bsdZbufSockRtn. +01c,06oct97,spm added optional binary compatibility for BSD 4.3 applications +01b,07aug95,dzb moved sys/socket.h inclusion to sockFunc.h. +01a,21jul95,dzb created from sockLib.h, ver 02d. +*/ + +#ifndef __INCbsdSockLibh +#define __INCbsdSockLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "sockFunc.h" + +/* externals */ + +#ifdef BSD43_COMPATIBLE +IMPORT BOOL bsdSock43ApiFlag; +#endif + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern SOCK_FUNC *bsdSockLibInit (void); +extern STATUS bsdBind (int s, struct sockaddr *name, int namelen); +extern STATUS bsdConnect (int s, struct sockaddr *name, int namelen); +extern STATUS bsdConnectWithTimeout (int sock, struct sockaddr *adrs, + int adrsLen, struct timeval *timeVal); +extern STATUS bsdGetpeername (int s, struct sockaddr *name, int *namelen); +extern STATUS bsdGetsockname (int s, struct sockaddr *name, int *namelen); +extern STATUS bsdGetsockopt (int s, int level, int optname, char *optval, + int *optlen); +extern STATUS bsdListen (int s, int backlog); +extern STATUS bsdSetsockopt (int s, int level, int optname, char *optval, + int optlen); +extern STATUS bsdShutdown (int s, int how); +extern int bsdAccept (int s, struct sockaddr *addr, int *addrlen); +extern int bsdRecv (int s, char *buf, int bufLen, int flags); +extern int bsdRecvfrom (int s, char *buf, int bufLen, int flags, + struct sockaddr *from, int *pFromLen); +extern int bsdRecvmsg (int sd, struct msghdr *mp, int flags); +extern int bsdSend (int s, char *buf, int bufLen, int flags); +extern int bsdSendmsg (int sd, struct msghdr *mp, int flags); +extern int bsdSendto (int s, caddr_t buf, int bufLen, int flags, + struct sockaddr *to, int tolen); +extern int bsdSocket (int domain, int type, int protocol); +extern STATUS bsdZbufSockRtn ( void ); + +#else /* __STDC__ */ + +extern SOCK_FUNC *bsdSockLibInit (); +extern STATUS bsdBind (); +extern STATUS bsdConnect (); +extern STATUS bsdConnectWithTimeout (); +extern STATUS bsdGetpeername (); +extern STATUS bsdGetsockname (); +extern STATUS bsdGetsockopt (); +extern STATUS bsdListen (); +extern STATUS bsdSetsockopt (); +extern STATUS bsdShutdown (); +extern int bsdAccept (); +extern int bsdRecv (); +extern int bsdRecvfrom (); +extern int bsdRecvmsg (); +extern int bsdSend (); +extern int bsdSendmsg (); +extern int bsdSendto (); +extern int bsdSocket (); +extern STATUS bsdZbufSockRtn (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCbsdSockLibh */ diff --git a/h/bsdSockMap.h b/h/bsdSockMap.h new file mode 100644 index 0000000..8b2d9d1 --- /dev/null +++ b/h/bsdSockMap.h @@ -0,0 +1,46 @@ +/* bsdSockMap.h - BSD socket name mapping */ + +/* Copyright 1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,29apr99,pul Upgraded NPT phase3 code to tor2.0.0 +01b,02feb99,sgv added mapping for zbufsockrtn +01a,21jul95,dzb written. +*/ + +#ifndef __INCbsdSockMaph +#define __INCbsdSockMaph + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define sockLibInit bsdSockLibInit +#define accept bsdAccept +#define bind bsdBind +#define connect bsdConnect +#define connectWithTimeout bsdConnectWithTimeout +#define getpeername bsdGetpeername +#define getsockname bsdGetsockname +#define listen bsdListen +#define recv bsdRecv +#define recvfrom bsdRecvfrom +#define recvmsg bsdRecvmsg +#define send bsdSend +#define sendto bsdSendto +#define sendmsg bsdSendmsg +#define shutdown bsdShutdown +#define socket bsdSocket +#define getsockopt bsdGetsockopt +#define setsockopt bsdSetsockopt +#define zbufsockrtn bsdZbufSockRtn + +#ifdef __cplusplus +} +#endif + +#endif /* __INCbsdSockMaph */ diff --git a/h/bspVersion.h b/h/bspVersion.h new file mode 100644 index 0000000..c78ef44 --- /dev/null +++ b/h/bspVersion.h @@ -0,0 +1,65 @@ +/* bspVersion.h - VxWorks board support package version information */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* +This header file is now historical. New 1.1 BSPs do not refer to this +file, only older 1.0 BSPs. This file is carried forward only to maintain +backward compatibility for old 1.0 BSPs. + +MAKE NO FURTHER EDITS TO THIS FILE. 23sep96,dat. +*/ + +/* +modification history +-------------------- +01i,23sep96,dat changed default BSP version back to 1.0. (1.1 BSPs don't + use this header file). +01h,26sep95,dat added decl of sysBspRev +01g,21jun95,ms changed to version "1.1" +01f,12apr94,caf changed to version "1.0". +01e,20nov93,caf changed to version "1.0-beta". +01e,02dec93,pme pushed to Beta for Am29K. +01d,21jan93,caf changed to version "1.0". +01c,16oct92,caf changed from alpha to beta. +01b,22sep92,rrr added support for c++ +01a,08sep92,caf created. +*/ + +#ifndef __INCbspVersionh +#define __INCbspVersionh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#ifndef BSP_VERSION +# define BSP_VERSION "1.0" /* for printing */ +# define BSP_VER_1_0 1 /* for #if or #ifdef testing */ +#endif /*BSP_VERSION*/ + +/* function declarations */ + +#ifndef _ASMLANGUAGE + +#if defined(__STDC__) || defined(__cplusplus) + +extern char * bspVersion (void); /* old 1.0 usage */ +extern char * sysBspRev (void); /* new 1.1 usage */ + +#else /* __STDC__ */ + +extern char * bspVersion (); +extern char * sysBspRev (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCbspVersionh */ diff --git a/h/buf.h b/h/buf.h new file mode 100644 index 0000000..e86155d --- /dev/null +++ b/h/buf.h @@ -0,0 +1,201 @@ +/* buf.h - file system buffer cache interface */ + +/* Copyright 2005 Wind River Systems, Inc */ + +/* +modification history +-------------------- +01d,21jul05,jlk added BUF_USED_ONCE priority macro +01c,12apr05,act add a field to hold errors; change buf_done to take a buf and + an error +01b,17mar05,act export buf_done() function +01a,16mar05,act add buf_initmountpoint prototype + */ + +#ifndef __INCbufh +#define __INCbufh + +#include "sys/queue.h" +#include "semLib.h" +#include "drv/xbd/bio.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Type-name for "logical block number". Buffers are named by + * pairs, so that a file system that + * wants to get "block 3" of a file (vnode), you just get . + * (The block size is up to the user of the buffer code.) + */ +typedef unsigned long long lblkno_t; /* ??? signed? */ + +struct ucred; +struct mount; + +LIST_HEAD(bhashhdr, buf); +TAILQ_HEAD(bfreehdr, buf); + +/* + * Note that a buffer can be both free and on a vnode. This occurs when + * the buffer is cacheing valid data. + * + * Buffers are taken off their free list while "owned", but are always + * on a hash chain (kept in the mount point) based on their buffer hash + * value. + * + * Each buffer also has an I/O semaphore that is taken when I/O is + * started, and given only when the I/O is finished. Thus, if you + * can get the I/O semaphore, I/O is done (or was never started). + * The code to start the I/O should always be able to get the semaphore + * without waiting (otherwise it is a repeated start w/o first finishing). + * + * The B_BUSY bit is really the same information as in b_mutex: if the + * buffer is owned, it is busy; if not, it is not-busy. Only the block + * getting and releasing functions should manipulate this flag. B_BUSY + * is documented as "I/O in progress", but this is a white lie, it just + * means a task has the buffer locked. + */ +struct buf { + SEM_ID b_mutex; /* mutex to lock buffer while owned */ + SEM_ID b_iosem; /* I/O semaphore (binary sem) */ + int b_flags; /* see below */ + + /* don't need b_size yet - HRFS buffers are all one size per mount */ + int b_bsize; /* size of data */ + void *b_data; /* this buffer's data (shared w/bio) */ + struct bio *b_bio; /* ### need more, eventually? */ + int b_error; /* error for buf_wait */ + +#ifdef notyet + void (*b_done)(struct buf *); /* for B_CALL */ +#endif + + struct vnode *b_vp; /* this buffer's vnode */ + lblkno_t b_lblkno; /* and its logical block number */ + + int b_priority; /* cache priority */ + LIST_ENTRY(buf) b_hash; /* hash chain */ + LIST_ENTRY(buf) b_vnbufs; /* chain of buffers on this vnode */ + TAILQ_ENTRY(buf) b_freelist; /* chain if free */ +}; + +/* + * Flags for b_flags. + * + * The names are from NetBSD; the bit-value numbers do not match though. + */ +/* B_AGE -- move to age queue when I/O done */ +#define B_ASYNC 0x00000001 /* Start I/O, do not wait */ +/* B_BAD -- bad block revectoring in progress */ +#define B_BUSY 0x00000002 /* I/O in progress */ +/* B_SCANNED -- already pushed during sync */ +/* B_CALL 0x00000004 -- call b_iodone from buf_done */ +#define B_DELWRI 0x00000008 /* buffer has delayed-write data */ +/* B_DIRTY -- dirty page (VM system info, n/a) */ +#define B_DONE 0x00000010 /* I/O completed */ +#define B_EINTR 0x00000020 /* I/O was interrupted (for NFS) */ +#define B_ERROR 0x00000040 /* I/O error occurred */ +/* B_GATHERED 0x00000080 -- LFS: already in a segment */ +#define B_INVAL 0x00000100 /* does not contain valid info */ +/* B_LOCKED -- locked in core (not reusable) */ +/* B_NOCACHE -- do not cache block after use */ +/* B_CACHE -- bread() found us in the cache */ +/* B_PHYS -- I/O to user space */ +/* B_RAW -- set by physio() for raw transfers */ +#define B_READ 0x00000200 /* read buffer */ +/* B_TAPE -- magnetic tape I/O */ +/* B_WANTED -- process wants this buffer */ +#define B_WRITE 0x00000400 /* write buffer */ +/* B_XXX -- debugging flag */ +/* B_VFLUSH -- buffer is being synced */ + +/* + * Buffer caching "levels" (priorities). A buffer that contains some + * valid data goes on one of the "higher-level" queues, in LRU fashion, + * by putting released buffers at the end of the queue and taking + * buffers off the front of the queue. + * + * The ones in the "trash" queue by definition have no valid data + * (the code itself does not really need this distinction at the + * moment, but it seems reasonable to keep it). + */ +#define BUF_TRASH 0 /* "trash" queue: no valid data */ +#define BUF_USED_ONCE 1 /* blocks that are used just once */ +#define BUF_ORDINARY 2 /* ordinary data/transactions */ +#define BUF_META_LOW 3 /* low priority metadata */ +#define BUF_META_HIGH 4 /* high priority metadata */ +#define BUF_NQUEUES 5 /* number of free-list queues */ + +#define buf_setpriority(bp, pri) ((bp)->b_priority = (pri)) + +/* + * Buffer hashing, per mount-point. This hash function probably needs + * tuning. Note that the current BUFHASH definition depends on BHSIZE + * being a power of two. + */ +#define BUF_BHSIZE 32 +#define BUFHASH(vp, lbn) \ + (((((long)(vp) >> 8) + (int)(lbn))) & (BUF_BHSIZE - 1)) + +void buf_initmountpoint(struct mount *); +int buf_makebuffers(struct mount *, int, int, struct bio *); +void buf_deletebuffers(struct mount *); + +/* + * getblk() is BSD-compatible, except that we ignore the two "unused"s + * (so they had better always be 0! in BSD they control sleep() behavior). + * + * bread() does a getblk() and then reads the underlying data if the + * block was not already in cache. bwrite() writes the data, and there + * are several variations on the theme. In general, once you getblk() + * or bread(), you own that pair until you brelse() or + * bwrite() it to give it back. + * + * For file systems that move underlying data, we provide buf_moveblk(), + * to move a buffer (which you must own) from one pair to + * another. The new vnode may be the same as the old one. It is OK to + * move the lbn to a cached LBN (this just invalidates the old cached + * copy) -- it has to be, since the caller can't tell which LBNs are + * cached -- but it is an error to move it to a pair that is + * currently both cached and owned. (This means you have a bug in your + * file system, since you think you are working with that pair + * on behalf of this task or some other task.) In this case you will + * get EBUSY as a return value. (??? maybe we should just panic?) + * + * Both vnodes must be on the same mount point (if not, you get an + * error, again). + * + * We also provide buf_swapdata, which simply swaps the underlying + * data of two buffers (you must own both) without even looking at + * anything else. + */ +struct buf *buf_getblk(struct vnode *, lblkno_t, int); +int buf_moveblk(struct buf *, struct vnode *, lblkno_t); +void buf_swapdata(struct buf *, struct buf *); + +#define getblk(vp, lbn, size, unused1, unused2) buf_getblk(vp, lbn, size) + +int bread(struct vnode *, lblkno_t, int, struct ucred *, struct buf **); +#ifdef notyet +int breada(struct vnode *, lblkno_t, int, lblkno_t, int, + struct ucred *, struct buf **); +int breadn(struct vnode *, lblkno_t, int, lblkno_t *, int *, int, + struct ucred *, struct buf **); +#endif +int bwrite(struct buf *); /* write block, wait for result */ +void buf_startwrite(struct buf *); /* begin write; caller still owns buf */ +#ifdef notyet +void bdwrite(struct buf *); /* delayed write: write after timeout */ +#endif +void bawrite(struct buf *); /* async write: start write but don't wait */ +void brelse(struct buf *); /* release buffer to free list, no I/O */ +int buf_wait(struct buf *); /* wait for I/O, and return errno (0=OK) */ +void buf_done(struct buf *, int); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCbufh */ diff --git a/h/bufLib.h b/h/bufLib.h new file mode 100644 index 0000000..b66c592 --- /dev/null +++ b/h/bufLib.h @@ -0,0 +1,53 @@ +/* bufLib.h - header file for remote debug server */ + +/* Copyright 1984-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,05apr95,ms new data types. +01a,20sep94,ms written. +*/ + +#ifndef __INCbufLibh +#define __INCbufLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* data types */ + +typedef struct + { + void * pClass; /* class pointer */ + char * pBufs; /* array of buffers */ + int numBufs; /* number of buffers in the array */ + int bufSize; /* size of each buffer */ + char * pFreeBufs; /* free list */ + } BUF_POOL; + +/* function prototypes */ + + +#if defined(__STDC__) || defined(__cplusplus) + +void bufPoolInit (BUF_POOL *pBufPool, char *pBufs, int numBufs, + int bufSize); +char * bufAlloc (BUF_POOL *pBufPool); +void bufFree (BUF_POOL *pBufPool, char *pBuf); + +#else /* defined(__STDC__) || defined(__cplusplus) */ + +void bufPoolInit (); +char * bufAlloc (); +void bufFree (); + +#endif /* defined(__STDC__) || defined(__cplusplus) */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCbufLibh */ + diff --git a/h/cacheLib.h b/h/cacheLib.h new file mode 100644 index 0000000..66d399d --- /dev/null +++ b/h/cacheLib.h @@ -0,0 +1,303 @@ +/* cacheLib.h - cache library header file */ + +/* Copyright 1984-1998 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +03h,05may04,sru add cacheForeign* API; remove non-ANSI prototypes. +03g,09may03,pes Move definition of numeric values for cache types out of + #ifndef _ASMLANGUAGE. +03f,29apr03,pes PAL conditional compilation cleanup. +03e,22oct01,dee merge from T2.1.0 coldfire release +03d,10sep00,hk extended CACHE_TYPE for SH7729. +03c,01mar00,frf Add SH4 support for T2 +03b,23apr97,hk added SH support. +03c,05nov98.jpd removed cacheArchLibInit definition for ARM. +03b,28nov96,cdp added ARM support. +03a,26may94,yao added PPC support. +02p,19mar95,dvs removed #ifdef TRON - tron no longer supported. +02o,08jun94,tpr added branch cache used by MC68060 cpu. +02n,02dec93,pme Added Am29K family support. +02m,09jun93,hdn added support for I80X86 +02l,19oct92,jcf reordered xxLibInit params. made CACHE_TYPE v5.0 compatible. +02k,29sep92,jwt merged cacheLibInit(), cacheReset(), and cacheModeSet(). +02j,22sep92,rrr added support for c++ +02i,20aug92,wmd added #include for i960. +02h,13aug92,rdc removed instances of cacheLib functions and CACHE_FUNCS + structures and conditional compilation of corresponding + IMPORTS. +02g,30jul92,dnw added cacheLib functions and CACHE_FUNCS structures. +02f,15jul92,jwt added more CACHE_MODEs. +02e,09jul92,jwt added virtual-to-physical and physical-to-virtual stuff. +02d,07jul92,ajm added support for mips +02c,06jul92,jwt cleaned up cacheDrvXxx() macros by stressing pointers. +02b,04jul92,jcf cleaned up. +02a,03jul92,jwt cache library header for 5.1; moved '040 stuff to arch/mc68k. +01k,16jun92,jwt made safe for assembly language files. +01j,26may92,rrr the tree shuffle + -changed includes to have absolute path from h/ +01i,20jan92,shl added cache68kLib.h. +01h,09jan92,jwt created cacheSPARCLib.h; + cleaned up ANSI compiler warning messages. +01g,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01f,27aug91,shl added scope type for MC68040 caches. +01e,19jul91,gae renamed architecture specific include file to be xx.h. +01d,23jan91,jwt added SPARC cache commands. +01c,01mar91,hdn added TRON related stuff. +01b,05oct90,shl added copyright notice; made #endif ANSI style. +01a,15jul90,jcf written. +*/ + +#ifndef __INCcacheLibh +#define __INCcacheLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "vwModNum.h" +#include "limits.h" + +/* Cache mode soft bit masks */ + +#define CACHE_DISABLED 0x00 /* No cache or disabled */ + +#define CACHE_WRITETHROUGH 0x01 /* Write-through Mode */ +#define CACHE_COPYBACK 0x02 /* Copyback Mode */ +#define CACHE_WRITEALLOCATE 0x04 /* Write Allocate Mode */ +#define CACHE_NO_WRITEALLOCATE 0x08 +#define CACHE_SNOOP_ENABLE 0x10 /* Bus Snooping */ +#define CACHE_SNOOP_DISABLE 0x20 +#define CACHE_BURST_ENABLE 0x40 /* Cache Burst Cycles */ +#define CACHE_BURST_DISABLE 0x80 + +/* Errno values */ + +#define S_cacheLib_INVALID_CACHE (M_cacheLib | 1) + +/* Value for "entire cache" in length arguments */ + +#define ENTIRE_CACHE ULONG_MAX + +/* explicit names of the cache types */ + +#define _INSTRUCTION_CACHE 0 /* Instruction Cache(s) */ +#define _DATA_CACHE 1 /* Data Cache(s) */ +#define _BRANCH_CACHE 2 /* Branch Cache(s) */ + +#ifndef _ASMLANGUAGE + +#if !defined (_WRS_CACHE_TYPE) +typedef enum /* CACHE_TYPE */ + { + INSTRUCTION_CACHE = _INSTRUCTION_CACHE, + DATA_CACHE = _DATA_CACHE + } CACHE_TYPE; +#endif /* _WRS_CACHE_TYPE */ + +typedef UINT CACHE_MODE; /* CACHE_MODE */ +typedef STATUS (*CACHEFOREIGNFUNC)(CACHE_TYPE, VIRT_ADDR, + PHYS_ADDR, size_t); + +typedef struct /* Cache Routine Pointers */ + { + FUNCPTR enableRtn; /* cacheEnable() */ + FUNCPTR disableRtn; /* cacheDisable() */ + FUNCPTR lockRtn; /* cacheLock() */ + FUNCPTR unlockRtn; /* cacheUnlock() */ + FUNCPTR flushRtn; /* cacheFlush() */ + FUNCPTR invalidateRtn; /* cacheInvalidate() */ + FUNCPTR clearRtn; /* cacheClear() */ + + FUNCPTR textUpdateRtn; /* cacheTextUpdate() */ + FUNCPTR pipeFlushRtn; /* cachePipeFlush() */ + FUNCPTR dmaMallocRtn; /* cacheDmaMalloc() */ + FUNCPTR dmaFreeRtn; /* cacheDmaFree() */ + FUNCPTR dmaVirtToPhysRtn; /* virtual-to-Physical Translation */ + FUNCPTR dmaPhysToVirtRtn; /* physical-to-Virtual Translation */ + + /* explicit prototypes required due to PHYS_ADDR datatype */ + + CACHEFOREIGNFUNC foreignFlushRtn; /* cacheForeignFlush() */ + CACHEFOREIGNFUNC foreignInvalidateRtn; /* cacheForeignInvalidate() */ + CACHEFOREIGNFUNC foreignClearRtn; /* cacheForeignClear() */ + } CACHE_LIB; + +/* Cache flush and invalidate support for general use and drivers */ + +typedef struct /* Driver Cache Routine Pointers */ + { + FUNCPTR flushRtn; /* cacheFlush() */ + FUNCPTR invalidateRtn; /* cacheInvalidate() */ + FUNCPTR virtToPhysRtn; /* Virtual-to-Physical Translation */ + FUNCPTR physToVirtRtn; /* Physical-to-Virtual Translation */ + } CACHE_FUNCS; + + +/* Cache macros */ + +#define CACHE_TEXT_UPDATE(adrs, bytes) \ + ((cacheLib.textUpdateRtn == NULL) ? OK : \ + (cacheLib.textUpdateRtn) ((adrs), (bytes))) + +#define CACHE_PIPE_FLUSH() \ + ((cacheLib.pipeFlushRtn == NULL) ? OK : \ + (cacheLib.pipeFlushRtn) ()) + + +#define CACHE_DRV_FLUSH(pFuncs, adrs, bytes) \ + (((pFuncs)->flushRtn == NULL) ? OK : \ + ((pFuncs)->flushRtn) (DATA_CACHE, (adrs), (bytes))) + +#define CACHE_DRV_INVALIDATE(pFuncs, adrs, bytes) \ + (((pFuncs)->invalidateRtn == NULL) ? OK : \ + ((pFuncs)->invalidateRtn) (DATA_CACHE, (adrs), (bytes))) + +#define CACHE_DRV_VIRT_TO_PHYS(pFuncs, adrs) \ + (((pFuncs)->virtToPhysRtn == NULL) ? (void *) (adrs) : \ + (void *) (((pFuncs)->virtToPhysRtn) (adrs))) + +#define CACHE_DRV_PHYS_TO_VIRT(pFuncs, adrs) \ + (((pFuncs)->physToVirtRtn == NULL) ? (void *) (adrs) : \ + ((void *) ((pFuncs)->physToVirtRtn) (adrs))) + +#define CACHE_DRV_IS_WRITE_COHERENT(pFuncs) \ + ((pFuncs)->flushRtn == NULL) + +#define CACHE_DRV_IS_READ_COHERENT(pFuncs) \ + ((pFuncs)->invalidateRtn == NULL) + + +#define CACHE_DMA_FLUSH(adrs, bytes) \ + CACHE_DRV_FLUSH (&cacheDmaFuncs, (adrs), (bytes)) + +#define CACHE_DMA_INVALIDATE(adrs, bytes) \ + CACHE_DRV_INVALIDATE (&cacheDmaFuncs, (adrs), (bytes)) + +#define CACHE_DMA_VIRT_TO_PHYS(adrs) \ + CACHE_DRV_VIRT_TO_PHYS (&cacheDmaFuncs, (adrs)) + +#define CACHE_DMA_PHYS_TO_VIRT(adrs) \ + CACHE_DRV_PHYS_TO_VIRT (&cacheDmaFuncs, (adrs)) + +#define CACHE_DMA_IS_WRITE_COHERENT() \ + CACHE_DRV_IS_WRITE_COHERENT (&cacheDmaFuncs) + +#define CACHE_DMA_IS_READ_COHERENT() \ + CACHE_DRV_IS_READ_COHERENT (&cacheDmaFuncs) + + +#define CACHE_USER_FLUSH(adrs, bytes) \ + CACHE_DRV_FLUSH (&cacheUserFuncs, (adrs), (bytes)) + +#define CACHE_USER_INVALIDATE(adrs, bytes) \ + CACHE_DRV_INVALIDATE (&cacheUserFuncs, (adrs), (bytes)) + +#define CACHE_USER_IS_WRITE_COHERENT() \ + CACHE_DRV_IS_WRITE_COHERENT (&cacheUserFuncs) + +#define CACHE_USER_IS_READ_COHERENT() \ + CACHE_DRV_IS_READ_COHERENT (&cacheUserFuncs) + + + +/* variable declarations */ + +IMPORT CACHE_LIB cacheLib; +IMPORT CACHE_FUNCS cacheNullFuncs; /* functions for non-cached memory */ +IMPORT CACHE_FUNCS cacheDmaFuncs; /* functions for dma memory */ +IMPORT CACHE_FUNCS cacheUserFuncs; /* functions for user memory */ + +IMPORT FUNCPTR cacheDmaMallocRtn; +IMPORT FUNCPTR cacheDmaFreeRtn; +IMPORT CACHE_MODE cacheDataMode; /* data cache modes for funcptrs */ +IMPORT BOOL cacheDataEnabled; +IMPORT BOOL cacheMmuAvailable; + +/* function declarations */ + +extern STATUS cacheLibInit (CACHE_MODE inst, CACHE_MODE data); +#if (CPU_FAMILY != ARM) +extern STATUS cacheArchLibInit (CACHE_MODE inst, CACHE_MODE data); +#endif +extern STATUS cacheEnable (CACHE_TYPE cache); +extern STATUS cacheDisable (CACHE_TYPE cache); +extern STATUS cacheLock (CACHE_TYPE cache, void * adrs, size_t bytes); +extern STATUS cacheUnlock (CACHE_TYPE cache, void * adrs, size_t bytes); +extern STATUS cacheFlush (CACHE_TYPE cache, void * adrs, size_t bytes); +extern STATUS cacheInvalidate (CACHE_TYPE cache, void *adrs, size_t bytes); +extern STATUS cacheClear (CACHE_TYPE cache, void * adrs, size_t bytes); +extern STATUS cacheTextUpdate (void * adrs, size_t bytes); +extern STATUS cachePipeFlush (void); + +extern void * cacheDmaMalloc (size_t bytes); +extern STATUS cacheDmaFree (void * pBuf); + +extern STATUS cacheDrvFlush (CACHE_FUNCS * pFuncs, void * adrs, size_t bytes); +extern STATUS cacheDrvInvalidate (CACHE_FUNCS * pFuncs, void * adrs, + size_t bytes); +extern void * cacheDrvVirtToPhys (CACHE_FUNCS * pFuncs, void * adrs); +extern void * cacheDrvPhysToVirt (CACHE_FUNCS * pFuncs, void * adrs); + +extern STATUS cacheForeignFlush (CACHE_TYPE cache, VIRT_ADDR virtAdrs, + PHYS_ADDR physAdrs, size_t bytes); +extern STATUS cacheForeignInvalidate (CACHE_TYPE cache, VIRT_ADDR virtAdrs, + PHYS_ADDR physAdrs, size_t bytes); +extern STATUS cacheForeignClear (CACHE_TYPE cache, VIRT_ADDR virtAdrs, + PHYS_ADDR physAdrs , size_t bytes); + +extern void cacheFuncsSet (void); + +#endif /* _ASMLANGUAGE */ + +/* Architecture-specific cache headers */ + +#if (CPU_FAMILY == MC680X0) +#include "arch/mc68k/cacheMc68kLib.h" +#endif /* (CPU_FAMILY == MC680X0) */ + +#if (CPU_FAMILY == COLDFIRE) +#include "arch/coldfire/cacheColdfireLib.h" +#endif /* (CPU_FAMILY == COLDFIRE) */ + +#if (CPU_FAMILY == SPARC) +#include "arch/sparc/cacheSparcLib.h" +#endif + +#if (CPU_FAMILY == MIPS) +#include "arch/mips/cacheMipsLib.h" +#endif /* (CPU_FAMILY == MIPS) */ + +#if (CPU_FAMILY == PPC) +#include "arch/ppc/cachePpcLib.h" +#endif /* CPU_FAMILY == PPC */ + +#if (CPU_FAMILY == I960) +#include "arch/i960/vxI960Lib.h" +#endif /* CPU_FAMILY == I960 */ + +#if (CPU_FAMILY == I80X86) +#include "arch/i86/cacheI86Lib.h" +#endif /* CPU_FAMILY == I80X86 */ + +#if (CPU_FAMILY == AM29XXX) +#include "arch/am29k/cacheAm29kLib.h" +#endif /* CPU_FAMILY == AM29XXX */ + +#if (CPU_FAMILY == SH) +#include "arch/sh/cacheShLib.h" +#endif /* CPU_FAMILY == SH */ + +#if (CPU_FAMILY == ARM) +#include "arch/arm/cacheArmLib.h" +#endif /* CPU_FAMILY == ARM */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcacheLibh */ diff --git a/h/cbioLib.h b/h/cbioLib.h new file mode 100644 index 0000000..d0a4a80 --- /dev/null +++ b/h/cbioLib.h @@ -0,0 +1,220 @@ +/* cbioLib.h - cached block I/O device (CBIO) header file */ + +/* Copyright 1999-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01o,24sep04,act back out changes for SPR#90008 +01n,23sep04,jlk added CBIO_TRANS_ROLLBACK ioctl command +01m,31aug04,alr added transaction support for transCbio +01l,02may04,jkf SPR#90008, adding cbioDevDelete() +01k,02sep03,jkf add write through cache option to CBIO_RW, CBIO_WRITE_THROUGH +01j,21aug01,jkf SPR#69031, common code for both AE & 5.x. +01i,14apr00,jkf fixed S_cbioLib_INVALID_CBIO_DEV_ID definition +01h,29feb00,jkf T3 changes +01g,31aug99,jkf overhaul for new CBIO API. +01f,31jul99,jkf T2 merge, tidiness & spelling. +01e,14oct98,lrn added includes for required types +01d,07sep98,lrn added prototype for cbioDevVerify +01c,02jul98,lrn ready for prerelease +01b,27apr98,lrn added implementation dependent structure pointer, stats +01a,15jan98,lrn written +*/ + +#ifndef __INCcbioLibh +#define __INCcbioLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include "blkIo.h" /* for BLK_DEV type */ + +/* + * typedef's and enums + */ + +typedef unsigned long block_t ; /* block number */ +typedef unsigned long cookie_t ; /* opaque cookie */ +typedef struct cbioDev * CBIO_DEV_ID ; /* CBIO device handle */ + +typedef enum /* CBIO_RW direction enum */ + { + CBIO_READ = 0, /* read */ + CBIO_WRITE = 1, /* copy back write */ + CBIO_WRITE_THROUGH = 2 /* write through write */ + } CBIO_RW; + + +typedef struct cbioParams /* CBIO Device parameters */ + { + BOOL cbioRemovable; /* removable medium flag */ + block_t nBlocks; /* number of blocks on device */ + size_t bytesPerBlk; /* number of bytes per block */ + size_t blockOffset; /* number of blocks from physical 0 */ + short blocksPerTrack; /* number of blocks per track */ + short nHeads; /* number of heads */ + short retryCnt; /* retry count for I/O errors -XXX */ + block_t lastErrBlk; /* block # where last error occurred */ + int lastErrno; /* error code of last error */ + } CBIO_PARAMS; + + +/* + * Cached Block I/O (CBIO) API functions + */ + +/* Library init routine */ +IMPORT STATUS cbioLibInit + ( + void + ); + +/* transfer n blocks from/to memory */ +IMPORT STATUS cbioBlkRW + ( + CBIO_DEV_ID dev, + block_t startBlock, + block_t numBlocks, + addr_t buffer, + CBIO_RW rw, + cookie_t * pCookie + ); + + +/* transfer n bytes from/to memory */ +IMPORT STATUS cbioBytesRW + ( + CBIO_DEV_ID dev, + block_t startBlock, + off_t offset, + addr_t buffer, + size_t nBytes, + CBIO_RW rw, + cookie_t * pCookie + ); + + +/* Copy from block to block */ +IMPORT STATUS cbioBlkCopy + ( + CBIO_DEV_ID dev, + block_t srcBlock, + block_t dstBlock, + block_t numBlocks + ); + + +/* I/O control operations */ +IMPORT STATUS cbioIoctl + ( + CBIO_DEV_ID dev, + int command, + addr_t arg + ); + + +/* get mode - O_RDONLY, O_WRONLY, O_RDWR */ +IMPORT int cbioModeGet + ( + CBIO_DEV_ID dev + ); + + +/* set mode - O_RDONLY, O_WRONLY, or O_RDWR */ +IMPORT STATUS cbioModeSet + ( + CBIO_DEV_ID dev, + int mode + ); + + +/* determine device ready status */ +IMPORT int cbioRdyChgdGet + ( + CBIO_DEV_ID dev + ); + + +/* Force a change in ready status state */ +IMPORT STATUS cbioRdyChgdSet + ( + CBIO_DEV_ID dev, + BOOL status + ); + + +/* Obtain exclusive ownership of device */ +IMPORT STATUS cbioLock + ( + CBIO_DEV_ID dev, + int timeout /* max time to pend (semTake) */ + ); + + +/* Release exclusive ownership of device */ +IMPORT STATUS cbioUnlock + ( + CBIO_DEV_ID dev + ); + + +/* fill CBIO_PARAMS structure */ +IMPORT STATUS cbioParamsGet + ( + CBIO_DEV_ID dev, + CBIO_PARAMS * pCbioParams + ); + + +/* display cbio information */ +IMPORT STATUS cbioShow + ( + CBIO_DEV_ID dev + ); + +/* Verify a CBIO device is valid */ +IMPORT STATUS cbioDevVerify + ( + CBIO_DEV_ID device + ); + +/* create a CBIO wapper atop a BLK_DEV */ +IMPORT CBIO_DEV_ID cbioWrapBlkDev + ( + BLK_DEV * pDevice + ); + +/* + * CBIO I/O control codes for cbioIoctl() + */ + +#define CBIO_RESET 0xcb100000 /* Reset device */ +#define CBIO_STATUS_CHK 0xcb100001 /* check device status */ +#define CBIO_DEVICE_LOCK 0xcb100002 /* Prevent disk removal */ +#define CBIO_DEVICE_UNLOCK 0xcb100003 /* Allow disk removal */ +#define CBIO_DEVICE_EJECT 0xcb100004 /* Dismount device */ +#define CBIO_CACHE_FLUSH 0xcb100010 /* Flush dirty caches */ +#define CBIO_CACHE_INVAL 0xcb100030 /* Flush & Invalidate all */ +#define CBIO_CACHE_NEWBLK 0xcb100050 /* Allocate scratch block */ + +#define CBIO_DELETE 0xcb100060 /* Delete a Block from underlying layers */ + +#define CBIO_TRANS_COMMIT 0xcb100070 /* Commit a transaction */ +#define CBIO_TRANS_FORMAT 0xcb100071 /* Format a transaction device */ +#define CBIO_TRANS_DEFRAG 0xcb100072 /* defrag a transaction device for use as DOS FAT */ +#define CBIO_TRANS_ROLLBACK 0xcb100073 /* rollback to last transaction point */ + +/* + * cbioLib errno's + */ + +#define S_cbioLib_INVALID_CBIO_DEV_ID (M_cbioLib | 1) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcbioLibh */ diff --git a/h/cdromFsLib.h b/h/cdromFsLib.h new file mode 100644 index 0000000..b054f24 --- /dev/null +++ b/h/cdromFsLib.h @@ -0,0 +1,286 @@ +/* cdromFsLib.h - ISO 9660 File System definitions */ + +/* + * Copyright (c) 1997-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +02l,11aug05,aeg moved cdromFsDevDelete() prototype from cdromFsLibP.h +02k,30apr05,aeg deprecated cdromFsVersionNumGet() and cdromFsVersionDisplay(); + removed inclusion of private/cdromFsLibP.h; + changed cdromFsDevCreate() to accept device_t not BLK_DEV *; + removed prototype for non-existent function cdromFsDevReset(). +02j,08apr05,jge increased CDROM_MAX_FILE_NAME_LEN after seeing CDs that + break the Joliet 128-byte filename limit. +02i,05dec02,tkj cdromFs joliet code review changes. +02h,22oct02,tkj Change ioctl() codes to standard values. +02g,10oct02,tkj Code cleanup: Split into cdromFsLib.h and cdromFsLibP.h. +02f,01oct02,tkj Fix SPR#78416 Handles .. wrong. Accepts path xx/../yy even + if xx does not exist. +02e,16sep02,tkj Fix compiler errors/warnings. +02d,20aug02,tkj More work on SPR#78208 - Productice Joliet extensions; + Changes from Europe. +02c,27jun02,tkj More work on SPR#78208 - Productice Joliet extensions. +02b,26jun02,tkj Enchancememts: SPR#78208 - Productice Joliet extensions. + Bug fixes: SPR#32715/SPR#34826, SPR#78415, SPR#78452, + SPR#78454, SPR#78455, SPR#78456, SPR#79162. + Bugs not fixed yet: SPR#34659, SPR#75766, SPR#78416, + SPR#79162. +02a,26jun02,tkj Checkin cdromFsLib Joliet extensions as received from Wind + River Services in the Netherlands. It needs work to be + productized. +01b,07dec98,lrn add C++ support (SPR#23776) +01a,10apr97,dds SPR#7538: add CDROM file system support to vxWorks. +*/ + +/* + * currently only ISO 9660 is supported. All data dependent on this + * standard has prefix "ISO", or "iso" or "Iso" + */ + +#ifndef cdromFsLib_h +#define cdromFsLib_h + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include +#include + +/* defines */ + +/* Sizes */ + +#define KB *1024 + +#define CDROM_STD_LS_SIZE (2 KB) /* standard cdrom logical sector size */ + +#define CDROM_MAX_PATH_LEN 1024 +#define CDROM_MAX_FILE_NAME_LEN 256 + +/* + * ioctl() function codes + */ + +#define CDROMFS_IOCTL(X) ((M_cdromFsLib >> 8) | (X)) + +/* Joliet support */ + +#define CDROMFS_DIR_MODE_SET CDROMFS_IOCTL(0) +#define CDROMFS_DIR_MODE_GET CDROMFS_IOCTL(1) + +/* Miscellaneous */ + +#define CDROMFS_STRIP_SEMICOLON CDROMFS_IOCTL(2) +#define CDROMFS_GET_VOL_DESC CDROMFS_IOCTL(3) + +/* Multi-session support */ + +#define CDROMFS_SESSION_NUMBER_SET CDROMFS_IOCTL(4) +#define CDROMFS_SESSION_NUMBER_GET CDROMFS_IOCTL(5) +#define CDROMFS_MAX_SESSION_NUMBER_GET CDROMFS_IOCTL(6) + +#define DEFAULT_SESSION 100 + +/* Obsolete - For backwards compatibility only */ + +#define IOCTL_DIR_MODE_SET CDROMFS_DIR_MODE_SET +#define IOCTL_DIR_MODE_GET CDROMFS_DIR_MODE_GET +#define IOCTL_STRIP_SEMICOLON CDROMFS_STRIP_SEMICOLON +#define IOCTL_GET_VOL_DESC CDROMFS_GET_VOL_DESC +#define IOCTL_SESSION_NUMBER_SET CDROMFS_SESSION_NUMBER_SET +#define IOCTL_SESSION_NUMBER_GET CDROMFS_SESSION_NUMBER_GET +#define IOCTL_MAX_SESSION_NUMBER_GET CDROMFS_MAX_SESSION_NUMBER_GET + +/* Mode values for IOCT_DIR_MODE_SET/GET */ + +#define MODE_ISO9660 0 +#define MODE_JOLIET 1 +#define MODE_AUTO 2 +#define MODE_MAX MODE_AUTO +#define MODE_DEFAULT MODE_ISO9660 + +/* + * ISO Volume Descriptors + */ + +/* constants */ + +#define ISO_PVD_BASE_LS 16 +#define ISO_STD_ID "CD001" /* must be in each VD */ +#define ISO_STD_ID_SIZE 5 /* must be in each VD */ +#define ISO_VD_SIZE 2048 + +#define ISO_VD_VERSION ((u_char)1) + +/* Volume descriptor (VD) types: */ + +#define ISO_VD_BOOT ((u_char)0) +#define ISO_VD_PRIMARY ((u_char)1) +#define ISO_VD_SUPPLEM ((u_char)2) +#define ISO_VD_PARTN ((u_char)3) +#define ISO_VD_SETTERM ((u_char)255) + +/* typedefs */ + +/* + * Primary/Secondary volume descriptor returned by ioctl(IOCTL_GET_VOL_DESC) + */ + +/* Volume descriptor date/time field */ + +#define ISO_V_DATE_TIME_YEAR_SIZE 4 +#define ISO_V_DATE_TIME_FIELD_STD_SIZE 2 +#define ISO_V_DATE_TIME_FROM_GREENW_NIMUTE 15 + +typedef struct isoVDDateTime + { + u_char year[ ISO_V_DATE_TIME_YEAR_SIZE ]; /* 1-9999 */ + u_char month[ ISO_V_DATE_TIME_FIELD_STD_SIZE ]; /* 1-12 */ + u_char day[ ISO_V_DATE_TIME_FIELD_STD_SIZE ]; /* 1-31 */ + u_char hour[ ISO_V_DATE_TIME_FIELD_STD_SIZE ]; /* 0-23 */ + u_char minute[ ISO_V_DATE_TIME_FIELD_STD_SIZE ]; /* 0-59 */ + u_char sec[ ISO_V_DATE_TIME_FIELD_STD_SIZE ]; /* 0-59 */ + u_char sec100[ ISO_V_DATE_TIME_FIELD_STD_SIZE ]; /* 0-99 */ + signed char greenwOffBy15Minute; + } T_ISO_VD_DATE_TIME; + +typedef T_ISO_VD_DATE_TIME * T_ISO_VD_DATE_TIME_ID; + +/* Primary/Secondary Volume Descriptor fields sizes */ + +#define ISO_VD_ID_STD_SIZE 128 +#define ISO_VD_F_ID_STD_SIZE 37 +#define ISO_VD_SYSTEM_ID_SIZE (40-8) +#define ISO_VD_VOLUME_ID_SIZE (72-40) +#define ISO_VD_VOL_SPACE_SIZE (80+ENDIAN_OFF_LONG) +#define ISO_VD_ESCAPE_SEC_SIZE (120-88) + +#define CDROM_MAX_DIR_LEV 120 /* max dir nesting level */ +#define CDROM_MAX_DIR_SIZE 128 /* max directory/file Byte sice */ + /* For backwards compatibility */ + +#define CDROM_MAX_DIR_SICE CDROM_MAX_DIR_SIZE + +/* Primary/Supplementary Volume Descriptor */ + +typedef struct isoPrimarySuplementaryVolDescriptor + { + u_long volSize; /* logical sector per volume */ + u_long PTSize; /* bytes per Path Table */ + u_long PTSizeOnCD; /* bytes per Path Table on physical CD*/ + u_long PTOccur; /* Path table occurence */ + u_long PTOptOccur; /* optional occurence */ + u_long rootDirSize; /* bytes per Root Directory */ + u_long rootDirStartLB; /* where root dir starts */ + + u_long volDescSector; /* Sector containing the volume descriptor */ + u_long volDescOffInSect; /* Volume descriptor offset in sector */ + u_short volDescNum; /* Volume descriptor number in session */ + + u_short volSetSize; /* number of disks in set */ + u_short volSeqNum; /* disk number in set */ + u_short SesiOnCd; /* number of all sessions on device */ + u_short ReadSession; /* Seesion that contains the volume descriptor */ + u_short LBSize; /* bytes per Logical Block */ + + u_char type; /* volume descriptor type, have to be one */ + /* of ISO_VD_PRIMARY or ISO_VD_SUPPLEM */ + u_char uniCodeLev; /* Unicode level */ + /* 0=ISO9660 */ + /* 1=UC-level1 2=UC-level2 3=UC-level3 */ + + u_char fileStructVersion; /* currently 1 only (ISO) */ + u_char stdID[ ISO_STD_ID_SIZE + 1 ]; /* currently have to be */ + /* ISO_STD_ID */ + u_char systemId[ ISO_VD_SYSTEM_ID_SIZE +1 ]; /* a-u_chars */ + u_char volumeId[ ISO_VD_VOLUME_ID_SIZE +1 ]; /* d-u_chars */ + u_char volSetId[ ISO_VD_ID_STD_SIZE +1 ]; /* d-u_chars */ + u_char publisherId[ ISO_VD_ID_STD_SIZE +1 ]; /* a-u_chars */ + u_char preparerId[ ISO_VD_ID_STD_SIZE +1 ]; /* a-u_chars */ + u_char applicatId[ ISO_VD_ID_STD_SIZE +1 ]; /* a-u_chars */ + u_char cprightFId[ ISO_VD_F_ID_STD_SIZE +1 ]; /* file ID */ + u_char abstractFId[ ISO_VD_F_ID_STD_SIZE +1 ]; /* file ID */ + u_char bibliogrFId[ ISO_VD_F_ID_STD_SIZE +1 ]; /* file ID */ + T_ISO_VD_DATE_TIME creationDate; + T_ISO_VD_DATE_TIME modificationDate; + T_ISO_VD_DATE_TIME expirationDate; + T_ISO_VD_DATE_TIME effectiveDate; + } T_ISO_PVD_SVD; + +typedef T_ISO_PVD_SVD * T_ISO_PVD_SVD_ID; + +/* + * CD-ROM volume descriptor (internal) + * + * This is here only for the function declarations. + */ + +typedef struct cdromVolDescr * CDROM_VOL_DESC_ID; + +/* ========= errno codes =========== */ + +#define S_cdromFsLib_ALREADY_INIT (M_cdromFsLib | 1) +#define S_cdromFsLib_DEVICE_REMOVED (M_cdromFsLib | 3) +#define S_cdromFsLib_SUCH_PATH_TABLE_SIZE_NOT_SUPPORTED (M_cdromFsLib | 4) +#define S_cdromFsLib_ONE_OF_VALUES_NOT_POWER_OF_2 (M_cdromFsLib | 5) +#define S_cdromFsLib_UNKNOWN_FILE_SYSTEM (M_cdromFsLib | 6) + + /* For backwards compatibility */ + +#define S_cdromFsLib_UNNOWN_FILE_SYSTEM S_cdromFsLib_UNKNOWN_FILE_SYSTEM + +#define S_cdromFsLib_INVAL_VOL_DESCR (M_cdromFsLib | 7) +#define S_cdromFsLib_INVALID_PATH_STRING (M_cdromFsLib | 8) +#define S_cdromFsLib_MAX_DIR_HIERARCHY_LEVEL_OVERFLOW (M_cdromFsLib | 9) +#define S_cdromFsLib_NO_SUCH_FILE_OR_DIRECTORY (M_cdromFsLib | 10) +#define S_cdromFsLib_INVALID_DIRECTORY_STRUCTURE (M_cdromFsLib | 11) +#define S_cdromFsLib_INVALID_FILE_DESCRIPTOR (M_cdromFsLib | 12) +#define S_cdromFsLib_READ_ONLY_DEVICE (M_cdromFsLib | 13) +#define S_cdromFsLib_END_OF_FILE (M_cdromFsLib | 14) +#define S_cdromFsLib_INV_ARG_VALUE (M_cdromFsLib | 15) +#define S_cdromFsLib_SEMTAKE_ERROR (M_cdromFsLib | 16) +#define S_cdromFsLib_SEMGIVE_ERROR (M_cdromFsLib | 17) +#define S_cdromFsLib_VOL_UNMOUNTED (M_cdromFsLib | 18) +#define S_cdromFsLib_INVAL_DIR_OPER (M_cdromFsLib | 19) +#define S_cdromFsLib_READING_FAILURE (M_cdromFsLib | 20) +#define S_cdromFsLib_INVALID_DIR_REC_STRUCT (M_cdromFsLib | 21) +#define S_cdromFsLib_SESSION_NR_NOT_SUPPORTED (M_cdromFsLib | 23) + + +/* globals */ + +#ifndef _ASMLANGUAGE + +/* function declarations */ + +/* interface functions */ + +extern STATUS cdromFsInit (void); + +/* user-callable functions prototypes */ + +extern CDROM_VOL_DESC_ID cdromFsDevCreate (char * devName, device_t device); +extern STATUS cdromFsDevDelete (CDROM_VOL_DESC_ID volDescId); + +extern void cdromFsVolConfigShow (void * arg); + +extern uint32_t cdromFsVersionNumGet (void) _WRS_DEPRECATED (""); +extern void cdromFsVersionDisplay (int level) _WRS_DEPRECATED (""); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* cdromFsLib_h */ diff --git a/h/classLib.h b/h/classLib.h new file mode 100644 index 0000000..0d2ad91 --- /dev/null +++ b/h/classLib.h @@ -0,0 +1,59 @@ +/* classLib.h - object class management library header file */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01k,23apr04,dcc removed inclusion of objLib.h and memLib.h +01j,25jun03,dcc removed non-ANSI prototypes. +01i,14mar03,dcc moved CLASS_ID definition to types/vxWind.h +01h,15oct93,cd added #ifndef _ASMLANGUAGE. +01g,22sep92,rrr added support for c++ +01f,04jul92,jcf cleaned up. +01e,26may92,rrr the tree shuffle +01d,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01c,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01b,26jun90,jcf added object allocation/termination/etc. count +01a,10dec89,jcf written. +*/ + +#ifndef __INCclassLibh +#define __INCclassLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "vwModNum.h" + +/* status codes */ + +#define S_classLib_CLASS_ID_ERROR (M_classLib | 1) +#define S_classLib_NO_CLASS_DESTROY (M_classLib | 2) + +#ifndef _ASMLANGUAGE + +/* Note that CLASS_ID is declared in types/vxWind.h */ + +extern CLASS_ID classClassId; /* class object class id */ + +/* function declarations */ + +extern STATUS classLibInit (void); +extern STATUS classMemPartIdSet (CLASS_ID classId, PART_ID memPartId); +extern void classShowInit (void); +extern STATUS classShow (CLASS_ID classId, int level); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCclassLibh */ diff --git a/h/coff-i386.h b/h/coff-i386.h new file mode 100644 index 0000000..92282fe --- /dev/null +++ b/h/coff-i386.h @@ -0,0 +1,253 @@ +/* coff-i386.h - Cygwin32 description of PE COFF objects */ + +/* +modification history +-------------------- +01a,03mar98,jmb written. +*/ + +/* + * This file from cygwin32-b18, include/coff/i386.h + * Please update if tools are upgraded to a later version of cygwin32. + */ + +#ifndef __INCcoffi386h +#define __INCcoffi386h + +#ifdef __cplusplus +extern "C" { +#endif + +/*** coff information for Intel 386/486. */ + + +/********************** FILE HEADER **********************/ + +struct external_filehdr { + char f_magic[2]; /* magic number */ + char f_nscns[2]; /* number of sections */ + char f_timdat[4]; /* time & date stamp */ + char f_symptr[4]; /* file pointer to symtab */ + char f_nsyms[4]; /* number of symtab entries */ + char f_opthdr[2]; /* sizeof(optional hdr) */ + char f_flags[2]; /* flags */ +}; + +/* Bits for f_flags: + * F_RELFLG relocation info stripped from file + * F_EXEC file is executable (no unresolved external references) + * F_LNNO line numbers stripped from file + * F_LSYMS local symbols stripped from file + * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax) + */ + +#define F_RELFLG (0x0001) +#define F_EXEC (0x0002) +#define F_LNNO (0x0004) +#define F_LSYMS (0x0008) + + + +#define I386MAGIC 0x14c +#define I386PTXMAGIC 0x154 +#define I386AIXMAGIC 0x175 + +/* This is Lynx's all-platform magic number for executables. */ + +#define LYNXCOFFMAGIC 0415 + +#define I386BADMAG(x) (((x).f_magic != I386MAGIC) \ + && (x).f_magic != I386AIXMAGIC \ + && (x).f_magic != I386PTXMAGIC \ + && (x).f_magic != LYNXCOFFMAGIC) + +#define FILHDR struct external_filehdr +#define FILHSZ 20 + + +/********************** AOUT "OPTIONAL HEADER" **********************/ + + +typedef struct +{ + char magic[2]; /* type of file */ + char vstamp[2]; /* version stamp */ + char tsize[4]; /* text size in bytes, padded to FW bdry*/ + char dsize[4]; /* initialized data " " */ + char bsize[4]; /* uninitialized data " " */ + char entry[4]; /* entry pt. */ + char text_start[4]; /* base of text used for this file */ + char data_start[4]; /* base of data used for this file */ + + +} +AOUTHDR; + + +#define AOUTSZ 28 +#define AOUTHDRSZ 28 + +#define OMAGIC 0404 /* object files, eg as output */ +#define ZMAGIC 0413 /* demand load format, eg normal ld output */ +#define STMAGIC 0401 /* target shlib */ +#define SHMAGIC 0443 /* host shlib */ + + +/* define some NT default values */ +/* #define NT_IMAGE_BASE 0x400000 moved to internal.h */ +#define NT_SECTION_ALIGNMENT 0x1000 +#define NT_FILE_ALIGNMENT 0x200 +#define NT_DEF_RESERVE 0x100000 +#define NT_DEF_COMMIT 0x1000 + +/********************** SECTION HEADER **********************/ + + +struct external_scnhdr { + char s_name[8]; /* section name */ + char s_paddr[4]; /* physical address, aliased s_nlib */ + char s_vaddr[4]; /* virtual address */ + char s_size[4]; /* section size */ + char s_scnptr[4]; /* file ptr to raw data for section */ + char s_relptr[4]; /* file ptr to relocation */ + char s_lnnoptr[4]; /* file ptr to line numbers */ + char s_nreloc[2]; /* number of relocation entries */ + char s_nlnno[2]; /* number of line number entries*/ + char s_flags[4]; /* flags */ +}; + +#define SCNHDR struct external_scnhdr +#define SCNHSZ 40 + +/* + * names of "special" sections + */ +#define _TEXT ".text" +#define _DATA ".data" +#define _BSS ".bss" +#define _COMMENT ".comment" +#define _LIB ".lib" + +/********************** LINE NUMBERS **********************/ + +/* 1 line number entry for every "breakpointable" source line in a section. + * Line numbers are grouped on a per function basis; first entry in a function + * grouping will have l_lnno = 0 and in place of physical address will be the + * symbol table index of the function name. + */ +struct external_lineno { + union { + char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ + char l_paddr[4]; /* (physical) address of line number */ + } l_addr; + char l_lnno[2]; /* line number */ +}; + + +#define LINENO struct external_lineno +#define LINESZ 6 + + +/********************** SYMBOLS **********************/ + +#define E_SYMNMLEN 8 /* # characters in a symbol name */ +#define E_FILNMLEN 14 /* # characters in a file name */ +#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ + +struct external_syment +{ + union { + char e_name[E_SYMNMLEN]; + struct { + char e_zeroes[4]; + char e_offset[4]; + } e; + } e; + char e_value[4]; + char e_scnum[2]; + char e_type[2]; + char e_sclass[1]; + char e_numaux[1]; +}; + +#define N_BTMASK (0xf) +#define N_TMASK (0x30) +#define N_BTSHFT (4) +#define N_TSHIFT (2) + +union external_auxent { + struct { + char x_tagndx[4]; /* str, un, or enum tag indx */ + union { + struct { + char x_lnno[2]; /* declaration line number */ + char x_size[2]; /* str/union/array size */ + } x_lnsz; + char x_fsize[4]; /* size of function */ + } x_misc; + union { + struct { /* if ISFCN, tag, or .bb */ + char x_lnnoptr[4]; /* ptr to fcn line # */ + char x_endndx[4]; /* entry ndx past block end */ + } x_fcn; + struct { /* if ISARY, up to 4 dimen. */ + char x_dimen[E_DIMNUM][2]; + } x_ary; + } x_fcnary; + char x_tvndx[2]; /* tv index */ + } x_sym; + + union { + char x_fname[E_FILNMLEN]; + struct { + char x_zeroes[4]; + char x_offset[4]; + } x_n; + } x_file; + + struct { + char x_scnlen[4]; /* section length */ + char x_nreloc[2]; /* # relocation entries */ + char x_nlinno[2]; /* # line numbers */ + char x_checksum[4]; /* section COMDAT checksum */ + char x_associated[2]; /* COMDAT associated section index */ + char x_comdat[1]; /* COMDAT selection number */ + } x_scn; + + struct { + char x_tvfill[4]; /* tv fill value */ + char x_tvlen[2]; /* length of .tv */ + char x_tvran[2][2]; /* tv range */ + } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ + + +}; + +#define SYMENT struct external_syment +#define SYMESZ 18 +#define AUXENT union external_auxent +#define AUXESZ 18 + + +# define _ETEXT "etext" + + +/********************** RELOCATION DIRECTIVES **********************/ + + + +struct external_reloc { + char r_vaddr[4]; + char r_symndx[4]; + char r_type[2]; +}; + + +#define RELOC struct external_reloc +#define RELSZ 10 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcoffi386h */ diff --git a/h/coff-pe.h b/h/coff-pe.h new file mode 100644 index 0000000..83e02cf --- /dev/null +++ b/h/coff-pe.h @@ -0,0 +1,192 @@ +/* coff-pe.h - Cygwin32 description of the PEI header and AOUT header in PE COFF */ + +/* +modification history +-------------------- +01a,03mar98,jmb written. +*/ + +/* + * This file from cygwin32-b18, include/coff/pe.h + * Please update if tools are upgraded to a later version of cygwin32. + */ + +#ifndef __INCcoffpeh +#define __INCcoffpeh + +#ifdef __cplusplus +extern "C" { +#endif + +/* PE COFF header information */ + +#ifndef _PE_H +#define _PE_H + +/* NT specific file attributes */ +#define IMAGE_FILE_RELOCS_STRIPPED 0x0001 +#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 +#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 +#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 +#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 +#define IMAGE_FILE_32BIT_MACHINE 0x0100 +#define IMAGE_FILE_DEBUG_STRIPPED 0x0200 +#define IMAGE_FILE_SYSTEM 0x1000 +#define IMAGE_FILE_DLL 0x2000 +#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 + +/* additional flags to be set for section headers to allow the NT loader to + read and write to the section data (to replace the addresses of data in + dlls for one thing); also to execute the section in .text's case */ +#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 +#define IMAGE_SCN_MEM_EXECUTE 0x20000000 +#define IMAGE_SCN_MEM_READ 0x40000000 +#define IMAGE_SCN_MEM_WRITE 0x80000000 + +/* + * Section characteristics added for ppc-nt + */ + +#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved. */ + +#define IMAGE_SCN_CNT_CODE 0x00000020 /* Section contains code. */ +#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 /* Section contains initialized data. */ +#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 /* Section contains uninitialized data. */ + +#define IMAGE_SCN_LNK_OTHER 0x00000100 /* Reserved. */ +#define IMAGE_SCN_LNK_INFO 0x00000200 /* Section contains comments or some other type of information. */ +#define IMAGE_SCN_LNK_REMOVE 0x00000800 /* Section contents will not become part of image. */ +#define IMAGE_SCN_LNK_COMDAT 0x00001000 /* Section contents comdat. */ + +#define IMAGE_SCN_MEM_FARDATA 0x00008000 + +#define IMAGE_SCN_MEM_PURGEABLE 0x00020000 +#define IMAGE_SCN_MEM_16BIT 0x00020000 +#define IMAGE_SCN_MEM_LOCKED 0x00040000 +#define IMAGE_SCN_MEM_PRELOAD 0x00080000 + +#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 +#define IMAGE_SCN_ALIGN_2BYTES 0x00200000 +#define IMAGE_SCN_ALIGN_4BYTES 0x00300000 +#define IMAGE_SCN_ALIGN_8BYTES 0x00400000 +#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default alignment if no others are specified. */ +#define IMAGE_SCN_ALIGN_32BYTES 0x00600000 +#define IMAGE_SCN_ALIGN_64BYTES 0x00700000 + + +#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 /* Section contains extended relocations. */ +#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 /* Section is not cachable. */ +#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 /* Section is not pageable. */ +#define IMAGE_SCN_MEM_SHARED 0x10000000 /* Section is shareable. */ + +/* COMDAT selection codes. */ + +#define IMAGE_COMDAT_SELECT_NODUPLICATES (1) /* Warn if duplicates. */ +#define IMAGE_COMDAT_SELECT_ANY (2) /* No warning. */ +#define IMAGE_COMDAT_SELECT_SAME_SIZE (3) /* Warn if different size. */ +#define IMAGE_COMDAT_SELECT_EXACT_MATCH (4) /* Warn if different. */ +#define IMAGE_COMDAT_SELECT_ASSOCIATIVE (5) /* Base on other section. */ + +/* Magic values that are true for all dos/nt implementations */ +#define DOSMAGIC 0x5a4d +#define NT_SIGNATURE 0x00004550 + + /* NT allows long filenames, we want to accommodate this. This may break + some of the bfd functions */ +#undef FILNMLEN +#define FILNMLEN 18 /* # characters in a file name */ + + +#ifdef COFF_IMAGE_WITH_PE +/* The filehdr is only weired in images */ + +#undef FILHDR +struct external_PE_filehdr +{ + /* DOS header fields */ + char e_magic[2]; /* Magic number, 0x5a4d */ + char e_cblp[2]; /* Bytes on last page of file, 0x90 */ + char e_cp[2]; /* Pages in file, 0x3 */ + char e_crlc[2]; /* Relocations, 0x0 */ + char e_cparhdr[2]; /* Size of header in paragraphs, 0x4 */ + char e_minalloc[2]; /* Minimum extra paragraphs needed, 0x0 */ + char e_maxalloc[2]; /* Maximum extra paragraphs needed, 0xFFFF */ + char e_ss[2]; /* Initial (relative) SS value, 0x0 */ + char e_sp[2]; /* Initial SP value, 0xb8 */ + char e_csum[2]; /* Checksum, 0x0 */ + char e_ip[2]; /* Initial IP value, 0x0 */ + char e_cs[2]; /* Initial (relative) CS value, 0x0 */ + char e_lfarlc[2]; /* File address of relocation table, 0x40 */ + char e_ovno[2]; /* Overlay number, 0x0 */ + char e_res[4][2]; /* Reserved words, all 0x0 */ + char e_oemid[2]; /* OEM identifier (for e_oeminfo), 0x0 */ + char e_oeminfo[2]; /* OEM information; e_oemid specific, 0x0 */ + char e_res2[10][2]; /* Reserved words, all 0x0 */ + char e_lfanew[4]; /* File address of new exe header, 0x80 */ + char dos_message[16][4]; /* other stuff, always follow DOS header */ + char nt_signature[4]; /* required NT signature, 0x4550 */ + + /* From standard header */ + + + char f_magic[2]; /* magic number */ + char f_nscns[2]; /* number of sections */ + char f_timdat[4]; /* time & date stamp */ + char f_symptr[4]; /* file pointer to symtab */ + char f_nsyms[4]; /* number of symtab entries */ + char f_opthdr[2]; /* sizeof(optional hdr) */ + char f_flags[2]; /* flags */ + +}; + + +#define FILHDR struct external_PE_filehdr +#undef FILHSZ +#define FILHSZ 152 + +#endif + +typedef struct +{ + AOUTHDR standard; + + /* NT extra fields; see internal.h for descriptions */ + char ImageBase[4]; + char SectionAlignment[4]; + char FileAlignment[4]; + char MajorOperatingSystemVersion[2]; + char MinorOperatingSystemVersion[2]; + char MajorImageVersion[2]; + char MinorImageVersion[2]; + char MajorSubsystemVersion[2]; + char MinorSubsystemVersion[2]; + char Reserved1[4]; + char SizeOfImage[4]; + char SizeOfHeaders[4]; + char CheckSum[4]; + char Subsystem[2]; + char DllCharacteristics[2]; + char SizeOfStackReserve[4]; + char SizeOfStackCommit[4]; + char SizeOfHeapReserve[4]; + char SizeOfHeapCommit[4]; + char LoaderFlags[4]; + char NumberOfRvaAndSizes[4]; + /* IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; */ + char DataDirectory[16][2][4]; /* 16 entries, 2 elements/entry, 4 chars */ + +} PEAOUTHDR; + + +#undef AOUTSZ +#define AOUTSZ (AOUTHDRSZ + 196) + +#undef E_FILNMLEN +#define E_FILNMLEN 18 /* # characters in a file name */ +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcoffpeh */ diff --git a/h/comAutomation.h b/h/comAutomation.h new file mode 100644 index 0000000..0de38b3 --- /dev/null +++ b/h/comAutomation.h @@ -0,0 +1,203 @@ +/* comAutomation.h generated by WIDL Version 2.2.1 on 06-Dec-01 at 11:42:36 AM */ + +#include "comBase.h" + +#ifndef __INCcomAutomation_h +#define __INCcomAutomation_h + + +#include "comCoreTypes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int include_comAutomation (void); + +/* + * VARENUM usage key, + * + * * [V] - may appear in a VARIANT + * * [S] - may appear in a Safe Array + * + * VT_EMPTY [V] nothing + * VT_NULL [V] SQL style Null + * VT_I2 [V][S] 2 byte signed int + * VT_I4 [V][S] 4 byte signed int + * VT_R4 [V][S] 4 byte real + * VT_R8 [V][S] 8 byte real + * VT_CY [V][S] currency + * VT_DATE [V][S] date + * VT_BSTR [V][S] OLE Automation string + * VT_ERROR [V][S] SCODE + * VT_BOOL [V][S] True=-1, False=0 + * VT_VARIANT [S] VARIANT * + * VT_UNKNOWN [V][S] IUnknown * + * VT_UI1 [V][S] unsigned char + * VT_ARRAY [V][S] SAFEARRAY* + */ +enum tagVARENUM +{ +VT_EMPTY = 0, +VT_NULL = 1, +VT_I2 = 2, +VT_I4 = 3, +VT_R4 = 4, +VT_R8 = 5, +VT_CY = 6, +VT_DATE = 7, +VT_BSTR = 8, +VT_DISPATCH = 9, +VT_ERROR = 10, +VT_BOOL = 11, +VT_VARIANT = 12, +VT_UNKNOWN = 13, +VT_DECIMAL = 14, +VT_I1 = 16, +VT_UI1 = 17, +VT_UI2 = 18, +VT_UI4 = 19, +VT_I8 = 20, +VT_UI8 = 21, +VT_INT = 22, +VT_UINT = 23, +VT_VOID = 24, +VT_HRESULT = 25, +VT_PTR = 26, +VT_SAFEARRAY = 27, +VT_CARRAY = 28, +VT_USERDEFINED = 29, +VT_LPSTR = 30, +VT_LPWSTR = 31, +VT_FILETIME = 64, +VT_BLOB = 65, +VT_STREAM = 66, +VT_STORAGE = 67, +VT_STREAMED_OBJECT = 68, +VT_STORED_OBJECT = 69, +VT_BLOB_OBJECT = 70, +VT_CF = 71, +VT_CLSID = 72, +VT_VECTOR = 4096, +VT_ARRAY = 8192, +VT_BYREF = 16384, +VT_RESERVED = 32768, +VT_ILLEGAL = 65535, +VT_ILLEGALMASKED = 4095, +VT_TYPEMASK = 4095, +}; + +typedef enum tagVARENUM VARENUM; + +typedef unsigned short VARTYPE; + +struct tagVARIANT +{ +VARTYPE vt; +WORD wReserved1; +WORD wReserved2; +WORD wReserved3; +union +{ +LONG lVal; +BYTE bVal; +SHORT iVal; +FLOAT fltVal; +DOUBLE dblVal; +VARIANT_BOOL boolVal; +SCODE scode; +CY cyVal; +DATE date; +BSTR bstrVal; +IUnknown* punkVal; +struct tagSAFEARRAY* parray; +BYTE* pbVal; +SHORT* piVal; +LONG* plVal; +FLOAT* pfltVal; +DOUBLE* pdblVal; +VARIANT_BOOL* pboolVal; +SCODE* pscode; +CY* pcyVal; +DATE* pdate; +BSTR* pbstrVal; +IUnknown** ppunkVal; +struct tagVARIANT* pvarVal; +void* byref; +char cVal; +USHORT uiVal; +ULONG ulVal; +INT intVal; +UINT uintVal; +char* pcVal; +USHORT* puiVal; +ULONG* pulVal; +INT* pintVal; +UINT* puintVal; +} ; +}; + +typedef struct tagVARIANT VARIANT; + +typedef VARIANT* LPVARIANT; + +typedef VARIANT VARIANTARG; + +typedef VARIANT* LPVARIANTARG; + +#define SF_ERROR VT_ERROR +#define SF_I1 VT_I1 +#define SF_I2 VT_I2 +#define SF_I4 VT_I4 +#define SF_BSTR VT_BSTR +#define SF_UNKNOWN VT_UNKNOWN +#define SF_VARIANT VT_VARIANT +enum tagFADF_TYPE +{ +FADF_AUTO = 1, +FADF_STATIC = 2, +FADF_EMBEDDED = 4, +FADF_FIXEDSIZE = 16, +FADF_RECORD = 32, +FADF_HAVEIID = 64, +FADF_HAVEVARTYPE = 128, +FADF_BSTR = 256, +FADF_UNKNOWN = 512, +FADF_DISPATCH = 1024, +FADF_VARIANT = 2048, +FADF_RESERVED = 61448, +}; + +typedef enum tagFADF_TYPE FADF_TYPE; + +struct tagSAFEARRAYBOUND +{ +ULONG cElements; +LONG lLbound; +}; + +typedef struct tagSAFEARRAYBOUND SAFEARRAYBOUND; + +typedef SAFEARRAYBOUND* LPSAFEARRAYBOUND; + +struct tagSAFEARRAY +{ +USHORT cDims; +USHORT fFeatures; +ULONG cbElements; +ULONG cLocks; +PVOID pvData; +SAFEARRAYBOUND rgsabound[1]; +}; + +typedef struct tagSAFEARRAY SAFEARRAY; + +#ifdef __cplusplus +} +#endif + + + +#endif /* __INCcomAutomation_h */ + + diff --git a/h/comBase.h b/h/comBase.h new file mode 100644 index 0000000..feed89c --- /dev/null +++ b/h/comBase.h @@ -0,0 +1,243 @@ +/* comBase.h - VxDCOM Base Definitions */ + +/* Copyright (c) 1999 Wind River Systems, Inc. */ + +/* + +modification history +-------------------- +01l,21dec01,nel Use offset for DCC instead of adjustment in COM_ADJUST_THIS. +01k,10dec01,dbs diab build +01j,13jul01,dbs allow multiple vtables to be defined in same file +01i,02jul01,dbs fix typo in vtbl formats +01h,29jun01,dbs fix vtbl format for T3 compilers +01g,27jun01,dbs fix warnings from COM_VTABLE macro +01f,25jun01,dbs rename vtbl macros to COM_VTBL_XXX +01e,22jun01,dbs add WIDL_ADJUST_THIS macro +01d,20jun01,dbs fix C build +01c,15jun01,dbs fix vtbl layouts for known compilers +01b,19jul00,dbs add basic C support +01a,21sep99,dbs created from comLib.h +*/ + +#ifndef __INCcomBase_h +#define __INCcomBase_h + +/* + * Always include vxWorks.h for basic types - IDL will need to define + * those Win32-like types that aren't present in vxWorks.h but the + * base OS definitions should always be present. + */ + +#include + +/* Some common macros... */ + +#define __RPC_FAR +#define __RPC_USER +#define __RPC_STUB + +#ifndef interface +#define interface struct +#endif + +#ifndef STDCALL +#define STDCALL +#endif + +#ifdef __cplusplus +#define EXTERN_C extern "C" +#define STDMETHOD(method) virtual HRESULT STDMETHODCALLTYPE method +#define STDMETHOD_(type,method) virtual type STDMETHODCALLTYPE method +#else +#define EXTERN_C extern +#define STDMETHOD(method) HRESULT STDMETHODCALLTYPE (*method) +#define STDMETHOD_(type,method) type STDMETHODCALLTYPE (*method) +#endif + +#define DECLSPEC_UUID(x) +#define STDMETHODCALLTYPE STDCALL +#define STDMETHODIMP HRESULT STDMETHODCALLTYPE +#define STDMETHODIMP_(type) type STDMETHODCALLTYPE + +#define __RPC_FAR +#define __RPC_USER +#define __RPC_STUB + +#define PRPC_MESSAGE void* + +/* + * WIDL_CPP_REF is defined as a true C++ reference when compiling for + * C++, and as a pointer when compiling for plain C. This is used by + * WIDL when emitting typedefs, etc, generated from IDL. + */ + +#ifdef __cplusplus +#define WIDL_CPP_REF & +#else +#define WIDL_CPP_REF * +#endif + +/************************************************************************** +* +* -- VTable Layout -- +* +* Whether we're using C++ or plain C, we must generate a vtbl that is +* compatible with the C++ compiler for this architecture. Currently we +* know about the two different versions of 'gcc' where pre-egcs +* versions (as shipped with Tornado 2.0) use the old-style entries +* with this-offsets held in the table itself, but later versions +* (egcs/gcc2.95 and beyond) can use one DWORD per entry, and the +* compiler supplies an inline 'thunk' code-fragment to adjust the +* this-ptr. However, for VxWorks AE 1.x (T3.x) compilers, this feature +* is not enabled, so the vtbl format is gcc2-offsets (i.e. the old +* style). +* +* To define a vtable structure, the usage is:- +* +* typedef struct +* { +* COM_VTBL_BEGIN +* COM_VTBL_ENTRY (HRESULT, Method1, (int x)); +* COM_VTBL_ENTRY (HRESULT, Method2, (long x)); +* COM_VTBL_END +* } IFooVtbl; +* +* To build a const vtable the usage is:- +* +* COM_VTABLE(IFoo) IFoo_proxy_vtbl = { +* COM_VTBL_HEADER +* COM_VTBL_METHOD (&IFoo_Method1_proxy), +* COM_VTBL_METHOD (&IFoo_Method2_proxy) +* }; +* +* Note carefully the use of commas and semicolons at the end of +* the lines. +* +*************************************************************************** +* +* Firstly, enumerate what the possible vtable formats are. +* +**************************************************************************/ + +#define COM_VTBL_FORMAT_GCC2_OFFSET 1 +#define COM_VTBL_FORMAT_GCC2_THUNKS 2 +#define COM_VTBL_FORMAT_GCC3 3 + +/************************************************************************** +* +* Now, we figure out which version of GCC and which platform its +* running on, and then select the appropriate COM_VTBL_FORMAT_XXX +* macro to enforce one (and *only* one) of the vtable formats, for +* VxWorks (AE) targets. Host-builds (Linux, Solaris) must define the +* macro in their repsective makefiles. +* +***************************************************************************/ + +#if !defined(unix) +#ifdef __GNUC__ +# if (__GNUC__ == 2) +# define COM_VTBL_FORMAT COM_VTBL_FORMAT_GCC2_OFFSET +# elif (__GNUC__ == 3) +# define COM_VTBL_FORMAT COM_VTBL_FORMAT_GCC3 +# endif +#elif defined (__DCC__) +# define COM_VTBL_FORMAT COM_VTBL_FORMAT_GCC2_OFFSET +#endif +#endif + +/************************************************************************** +* +* Now we take the decision we have just made, and generate the +* correct vtable layout, calling-macros, etc. +* +***************************************************************************/ + +#if (COM_VTBL_FORMAT == COM_VTBL_FORMAT_GCC2_OFFSET) + +/************************************************************************** +* +* This is the vtable format for gcc WITHOUT THUNKS. This format has an +* adjustment to the 'this' pointer stored at each call-site (vtable +* entry) and the caller has to adjust 'this' before dispatching the +* call. +* +***************************************************************************/ + +#define COM_VTBL_BEGIN short __adj; short __pad; void* pRTTI; + +#define COM_VTBL_ENTRY(rt, fn, args) \ + short __adj##fn; short __pad##fn; rt (*fn) args + +#define COM_VTBL_END + +#define COM_VTBL_HEADER 0,0,0, +#define COM_VTBL_METHOD(fn) 0,0,fn + +#define COM_ADJUST_THIS(pThis) (void*)(((char*)pThis)+pThis->lpVtbl->__adjQueryInterface) + +#define COM_VTBL_SYMBOL com_vtbl_format_gcc2_offset + +#elif (COM_VTBL_FORMAT == COM_VTBL_FORMAT_GCC2_THUNKS) + +/************************************************************************** +* +* This is the vtable format for gcc2.x WITH THUNKS. This format simply +* stores the pointer at each call-site and the compiler supplies +* inline fragments of code to adjust the 'this' pointer (these are the +* thunks) so each vtable entry is simply a function pointer. +* +***************************************************************************/ + +#define COM_VTBL_BEGIN short __adj; short __pad; void* pRTTI; + +#define COM_VTBL_ENTRY(rt, fn, args) rt (*fn) args + +#define COM_VTBL_END + +#define COM_VTBL_HEADER 0,0,0, +#define COM_VTBL_METHOD(fn) fn + +#define COM_ADJUST_THIS(pThis) pThis + +#define COM_VTBL_SYMBOL com_vtbl_format_gcc2_thunks + +#elif (COM_VTBL_FORMAT == COM_VTBL_FORMAT_GCC3) + +/************************************************************************** +* +* This is the vtable format for gcc3. This format is the same as the +* 'with thunks' format, but there is no 'header' i.e. the 'this' +* pointer offset is not stored in the vtable at all. +* +***************************************************************************/ + +#define COM_VTBL_BEGIN + +#define COM_VTBL_ENTRY(rt, fn, args) rt (*fn) args + +#define COM_VTBL_END + +#define COM_VTBL_HEADER +#define COM_VTBL_METHOD(fn) fn + +#define COM_ADJUST_THIS(pThis) pThis + +#define COM_VTBL_SYMBOL com_vtbl_format_gcc3 + +#else +#error Unknown GCC vtable format - unable to determine host/compiler. +#endif + +#define DECLARE_COM_VTBL_SYMBOL_HERE int COM_VTBL_SYMBOL = 0; + +#define COM_VTABLE(itf) \ + extern int COM_VTBL_SYMBOL; \ + static void widlref_##itf(int x) \ + { widlref_##itf (x+COM_VTBL_SYMBOL); } \ + const itf##Vtbl + +#endif /* __INCcomBase_h */ + + + diff --git a/h/comCoreLib.h b/h/comCoreLib.h new file mode 100644 index 0000000..7214f79 --- /dev/null +++ b/h/comCoreLib.h @@ -0,0 +1,132 @@ +/* comCoreLib.h - core COM definitions */ + +/* Copyright (c) 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,07aug01,dbs return multiple interfaces during creation +01e,06aug01,dbs add registry-show capability +01d,28jun01,dbs add interlocked inc/dec funcs +01c,27jun01,dbs add GUID string len definition +01b,22jun01,dbs add const to args for comGuidCmp +01a,20jun01,dbs created +*/ + +#ifndef __INCcomCoreLib_h +#define __INCcomCoreLib_h + +/* includes */ + +#include "comCoreTypes.h" /* IDL-derived types */ +#include "comErr.h" /* error codes & macros */ + +#ifdef __cplusplus + +#include + +inline bool operator < (const GUID& a, const GUID& b) + { + return (memcmp (&a, &b, sizeof (GUID)) < 0); + } + +inline bool operator == (const GUID& a, const GUID& b) + { + return (memcmp (&a, &b, sizeof (GUID)) == 0); + } + +inline bool operator != (const GUID& a, const GUID& b) + { + return ! (a == b); + } + +extern "C" +{ +#endif + +/* defines */ + +#define GUID_STRING_LEN 64 + + +/* types */ + +typedef HRESULT (*PFN_GETCLASSOBJECT) (REFCLSID, REFIID, void**); + +typedef enum + { + PS_DEFAULT=0, /* use system default priority */ + PS_SVR_ASSIGNED, /* use priority in reg. info */ + PS_CLNT_PROPAGATED /* use priority from client */ + } VXDCOMPRIORITYSCHEME; + +/* prototypes */ + +STATUS comCoreLibInit (void); + +STATUS comCoreRegShow (void); + +HRESULT comCoreGUID2String + ( + const GUID * pGuid, /* GUID to print */ + char * buf /* GUID_STRING_LEN */ + ); + +HRESULT comInstanceCreate + ( + REFCLSID clsid, /* class ID */ + IUnknown * pUnkOuter, /* aggregating interface */ + DWORD dwClsCtx, /* class context */ + const char * hint, /* service hint */ + ULONG cMQIs, /* number of MQIs */ + MULTI_QI * pMQIs /* MQI array */ + ); + +HRESULT comClassObjectGet + ( + REFCLSID clsid, /* class ID */ + DWORD dwClsCtx, /* class context */ + const char * hint, /* service hint */ + REFIID iid, /* class-obj IID */ + void ** ppvClsObj /* resulting interface ptr */ + ); + +HRESULT comRegistryAdd + ( + const char * regName, /* registry name */ + DWORD dwClsCtx, /* class context */ + IRegistry* pReg /* registry to add */ + ); + +HRESULT comClassRegister + ( + REFCLSID clsid, /* class ID */ + DWORD dwClsCtx, /* class context */ + PFN_GETCLASSOBJECT pfnGCO, /* GetClassObject() func */ + VXDCOMPRIORITYSCHEME priScheme, /* priority scheme */ + int priority /* priority assoc. with scheme */ + ); + +BOOL comGuidCmp + ( + const GUID * a, /* one GUID */ + const GUID * b /* another GUID */ + ); + +long comSafeInc + ( + long * pVar /* variable to increment */ + ); + +long comSafeDec + ( + long * pVar /* variable to decrement */ + ); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcomCoreLib_h */ + + diff --git a/h/comCoreTypes.h b/h/comCoreTypes.h new file mode 100644 index 0000000..b5b372b --- /dev/null +++ b/h/comCoreTypes.h @@ -0,0 +1,972 @@ +/* comCoreTypes.h generated by WIDL Version 2.2.1 on 10-Dec-01 at 11:59:07 AM */ + +#include "comBase.h" + +#ifndef __INCcomCoreTypes_h +#define __INCcomCoreTypes_h + + +#ifdef __cplusplus +extern "C" { +#endif + +int include_comCoreTypes (void); + +#ifndef __IWindTypes_FWD_DEFINED__ +#define __IWindTypes_FWD_DEFINED__ +typedef interface IWindTypes IWindTypes; +#endif /* __IWindTypes_FWD_DEFINED__ */ + +#ifndef __IUnknown_FWD_DEFINED__ +#define __IUnknown_FWD_DEFINED__ +typedef interface IUnknown IUnknown; +#endif /* __IUnknown_FWD_DEFINED__ */ + +#ifndef __IClassFactory_FWD_DEFINED__ +#define __IClassFactory_FWD_DEFINED__ +typedef interface IClassFactory IClassFactory; +#endif /* __IClassFactory_FWD_DEFINED__ */ + +#ifndef __IMultiQI_FWD_DEFINED__ +#define __IMultiQI_FWD_DEFINED__ +typedef interface IMultiQI IMultiQI; +#endif /* __IMultiQI_FWD_DEFINED__ */ + +#ifndef __IRegistry_FWD_DEFINED__ +#define __IRegistry_FWD_DEFINED__ +typedef interface IRegistry IRegistry; +#endif /* __IRegistry_FWD_DEFINED__ */ + +#ifndef __IEnumGUID_FWD_DEFINED__ +#define __IEnumGUID_FWD_DEFINED__ +typedef interface IEnumGUID IEnumGUID; +#endif /* __IEnumGUID_FWD_DEFINED__ */ + +#ifndef __IEnumString_FWD_DEFINED__ +#define __IEnumString_FWD_DEFINED__ +typedef interface IEnumString IEnumString; +#endif /* __IEnumString_FWD_DEFINED__ */ + +#ifndef __IEnumUnknown_FWD_DEFINED__ +#define __IEnumUnknown_FWD_DEFINED__ +typedef interface IEnumUnknown IEnumUnknown; +#endif /* __IEnumUnknown_FWD_DEFINED__ */ + +#ifndef __IMalloc_FWD_DEFINED__ +#define __IMalloc_FWD_DEFINED__ +typedef interface IMalloc IMalloc; +#endif /* __IMalloc_FWD_DEFINED__ */ + +#if 0 +/* These types are defined by the OS (vxWorks.h) */ +typedef unsigned char UCHAR; + +typedef unsigned short USHORT; + +typedef unsigned long ULONG; + +typedef int BOOL; + +typedef unsigned int UINT; + +#endif +#if !(defined (CPU) && defined (SIMNT) && (CPU == SIMNT)) +/* These are defined by the SIMNT BSP */ +typedef short WORD; + +typedef unsigned long DWORD; + +#endif +typedef unsigned char BYTE; + +typedef char CHAR; + +typedef short SHORT; + +typedef long LONG; + +typedef float FLOAT; + +typedef double DOUBLE; + +typedef long SCODE; + +typedef long HRESULT; + +typedef int INT; + +typedef unsigned short WCHAR; + +typedef unsigned short OLECHAR; + +typedef void* PVOID; + +typedef void* LPVOID; + +typedef OLECHAR* LPOLESTR; + +typedef WCHAR* LPWSTR; + +typedef const OLECHAR* LPCOLESTR; + +typedef const WCHAR* LPCWSTR; + +typedef long long LONGLONG; +typedef long unsigned long ULONGLONG; +#if 0 +typedef hyper LONGLONG; + +typedef unsigned hyper ULONGLONG; + +#else +typedef LONGLONG hyper; +typedef ULONGLONG uhyper; +#endif +typedef LONGLONG LARGE_INTEGER; + +typedef ULONGLONG ULARGE_INTEGER; + +struct _tagCY +{ +LONGLONG int64; +}; + +typedef struct _tagCY CY; + +typedef LONGLONG OID; + +typedef LONGLONG OXID; + +typedef unsigned short PROTSEQ; + +/* Basic IDL types */ +typedef unsigned char byte; +typedef unsigned char uchar; +typedef unsigned long ulong; +struct _FILETIME +{ +DWORD dwLowDateTime; +DWORD dwHighDateTime; +}; + +typedef struct _FILETIME FILETIME; + +typedef struct _FILETIME* PFILETIME; + +typedef struct _FILETIME* LPFILETIME; + +struct _SYSTEMTIME +{ +WORD wYear; +WORD wMonth; +WORD wDayOfWeek; +WORD wDay; +WORD wHour; +WORD wMinute; +WORD wSecond; +WORD wMilliseconds; +}; + +typedef struct _SYSTEMTIME SYSTEMTIME; + +typedef struct _SYSTEMTIME* PSYSTEMTIME; + +typedef struct _SYSTEMTIME* LPSYSTEMTIME; + +struct _SECURITY_ATTRIBUTES +{ +DWORD nLength; +LPVOID lpSecurityDescriptor; +BOOL bInheritHandle; +}; + +typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES; + +typedef struct _SECURITY_ATTRIBUTES* PSECURITY_ATTRIBUTES; + +typedef struct _SECURITY_ATTRIBUTES* LPSECURITY_ATTRIBUTES; + +typedef USHORT SECURITY_DESCRIPTOR_CONTROL; + +typedef USHORT* PSECURITY_DESCRIPTOR_CONTROL; + +typedef PVOID PSID; + +struct _ACL +{ +UCHAR AclRevision; +UCHAR Sbz1; +USHORT AclSize; +USHORT AceCount; +USHORT Sbz2; +}; + +typedef struct _ACL ACL; + +typedef ACL* PACL; + +struct _SECURITY_DESCRIPTOR +{ +UCHAR Revision; +UCHAR Sbz1; +SECURITY_DESCRIPTOR_CONTROL Control; +PSID Owner; +PSID Group; +PACL Sacl; +PACL Dacl; +}; + +typedef struct _SECURITY_DESCRIPTOR SECURITY_DESCRIPTOR; + +typedef struct _SECURITY_DESCRIPTOR* PISECURITY_DESCRIPTOR; + +struct _COAUTHIDENTITY +{ +LPWSTR User; +ULONG UserLength; +LPWSTR Domain; +ULONG DomainLength; +LPWSTR Password; +ULONG PasswordLength; +ULONG Flags; +}; + +typedef struct _COAUTHIDENTITY COAUTHIDENTITY; + +struct _COAUTHINFO +{ +DWORD dwAuthnSvc; +DWORD dwAuthzSvc; +LPWSTR pwszServerPrincName; +DWORD dwAuthnLevel; +DWORD dwImpersonationLevel; +COAUTHIDENTITY* pAuthIdentityData; +DWORD dwCapabilities; +}; + +typedef struct _COAUTHINFO COAUTHINFO; + +struct _COSERVERINFO +{ +DWORD dwReserved1; +LPWSTR pwszName; +COAUTHINFO* pAuthInfo; +DWORD dwReserved2; +}; + +typedef struct _COSERVERINFO COSERVERINFO; + +#ifndef GUID_DEFINED +#define GUID_DEFINED +struct _GUID +{ +DWORD Data1; +WORD Data2; +WORD Data3; +BYTE Data4[8]; +}; + +typedef struct _GUID GUID; + +typedef struct _GUID* LPGUID; + +#endif /* !GUID_DEFINED */ +extern const GUID GUID_NULL; +#define IID_NULL GUID_NULL +typedef GUID IID; + +typedef IID* LPIID; + +#define __IID_DEFINED__ +typedef GUID CLSID; + +typedef CLSID* LPCLSID; + +#define CLSID_NULL GUID_NULL +typedef GUID IPID; + +typedef IPID* LPIPID; + +typedef GUID CATID; + +typedef CATID* LPCATID; + +#define CATID_NULL GUID_NULL +typedef const GUID WIDL_CPP_REF REFGUID; + +typedef const IID WIDL_CPP_REF REFIID; + +typedef const CLSID WIDL_CPP_REF REFCLSID; + +typedef const IPID WIDL_CPP_REF REFIPID; + +enum tagCLSCTX +{ +CLSCTX_INPROC_SERVER = 1, +CLSCTX_INPROC_HANDLER = 2, +CLSCTX_LOCAL_SERVER = 4, +CLSCTX_INPROC_SERVER16 = 8, +CLSCTX_REMOTE_SERVER = 16, +CLSCTX_INPROC_HANDLER16 = 32, +CLSCTX_INPROC_SERVERX86 = 64, +CLSCTX_INPROC_HANDLERX86 = 128, +}; + +typedef enum tagCLSCTX CLSCTX; + +enum tagMSHLFLAGS +{ +MSHLFLAGS_NORMAL = 0, +MSHLFLAGS_TABLESTRONG = 1, +MSHLFLAGS_TABLEWEAK = 2, +MSHLFLAGS_NOPING = 4, +}; + +typedef enum tagMSHLFLAGS MSHLFLAGS; + +enum tagMSHCTX +{ +MSHCTX_LOCAL = 0, +MSHCTX_NOSHAREDMEM = 1, +MSHCTX_DIFFERENTMACHINE = 2, +MSHCTX_INPROC = 3, +}; + +typedef enum tagMSHCTX MSHCTX; + +typedef DWORD LCID; + +struct _BYTE_BLOB +{ +unsigned long clSize; +byte abData[1]; +}; + +typedef struct _BYTE_BLOB BYTE_BLOB; + +typedef BYTE_BLOB* UP_BYTE_BLOB; + +struct _WORD_BLOB +{ +unsigned long clSize; +unsigned short asData[1]; +}; + +typedef struct _WORD_BLOB WORD_BLOB; + +typedef WORD_BLOB* UP_WORD_BLOB; + +struct _DWORD_BLOB +{ +unsigned long clSize; +unsigned long alData[1]; +}; + +typedef struct _DWORD_BLOB DWORD_BLOB; + +typedef DWORD_BLOB* UP_DWORD_BLOB; + +struct _FLAGGED_BYTE_BLOB +{ +unsigned long fFlags; +unsigned long clSize; +byte abData[1]; +}; + +typedef struct _FLAGGED_BYTE_BLOB FLAGGED_BYTE_BLOB; + +typedef FLAGGED_BYTE_BLOB* UP_FLAGGED_BYTE_BLOB; + +struct _FLAGGED_WORD_BLOB +{ +unsigned long fFlags; +unsigned long clSize; +unsigned short asData[1]; +}; + +typedef struct _FLAGGED_WORD_BLOB FLAGGED_WORD_BLOB; + +typedef FLAGGED_WORD_BLOB* UP_FLAGGED_WORD_BLOB; + +struct _BYTE_SIZEDARR +{ +unsigned long clSize; +byte* pData; +}; + +typedef struct _BYTE_SIZEDARR BYTE_SIZEDARR; + +struct _SHORT_SIZEDARR +{ +unsigned long clSize; +unsigned short* pData; +}; + +typedef struct _SHORT_SIZEDARR WORD_SIZEDARR; + +struct _LONG_SIZEDARR +{ +unsigned long clSize; +unsigned long* pData; +}; + +typedef struct _LONG_SIZEDARR DWORD_SIZEDARR; + +struct _HYPER_SIZEDARR +{ +unsigned long clSize; +hyper* pData; +}; + +typedef struct _HYPER_SIZEDARR HYPER_SIZEDARR; + +typedef double DATE; + +struct tagDEC +{ +USHORT wReserved; +BYTE scale; +BYTE sign; +ULONG Hi32; +ULONGLONG Lo64; +}; + +typedef struct tagDEC DECIMAL; + +typedef OLECHAR* BSTR; + +typedef BSTR* LPBSTR; + +/* 0 == FALSE, -1 == TRUE */ +typedef short VARIANT_BOOL; + +typedef BYTE boolean; +#if 0 +typedef boolean BOOLEAN; + +#endif +#define VARIANT_TRUE ((VARIANT_BOOL)0xffff) +#define VARIANT_FALSE ((VARIANT_BOOL)0) +struct tagBLOB +{ +ULONG cbSize; +BYTE* pBlobData; +}; + +typedef struct tagBLOB BLOB; + +typedef struct tagBLOB* LPBLOB; + +typedef ULONG PROPID; + +typedef IUnknown* LPUNKNOWN; + +typedef IClassFactory* LPCLASSFACTORY; + +typedef IMultiQI* LPMULTIQI; + +struct tagMULTI_QI +{ +const IID* pIID; +IUnknown* pItf; +HRESULT hr; +}; + +typedef struct tagMULTI_QI MULTI_QI; + +typedef IEnumGUID* LPENUMGUID; + +typedef IEnumString* LPENUMSTRING; + +typedef IEnumUnknown* LPENUMUNKNOWN; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_END + } IWindTypesVtbl; + +#ifdef __cplusplus + +interface IWindTypes {}; + +#else + +/* C interface definition for IWindTypes */ + +interface IWindTypes + { + const IWindTypesVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IWindTypes; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_END + } IUnknownVtbl; + +#ifdef __cplusplus + +interface IUnknown +{ +virtual HRESULT QueryInterface (REFIID riid, void** ppvObject) =0; + +virtual ULONG AddRef () =0; + +virtual ULONG Release () =0; + +}; + +#else + +/* C interface definition for IUnknown */ + +interface IUnknown + { + const IUnknownVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IUnknown; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, CreateInstance, (IClassFactory* pThis, IUnknown* pUnkOuter, REFIID riid, void** ppvObject)); + +#define IClassFactory_CreateInstance(pThis, pUnkOuter, riid, ppvObject) pThis->lpVtbl->CreateInstance(COM_ADJUST_THIS(pThis), pUnkOuter, riid, ppvObject) + + COM_VTBL_ENTRY (HRESULT, LockServer, (IClassFactory* pThis, BOOL fLock)); + +#define IClassFactory_LockServer(pThis, fLock) pThis->lpVtbl->LockServer(COM_ADJUST_THIS(pThis), fLock) + + COM_VTBL_END + } IClassFactoryVtbl; + +#ifdef __cplusplus + +interface IClassFactory : public IUnknown +{ +virtual HRESULT CreateInstance (IUnknown* pUnkOuter, REFIID riid, void** ppvObject) =0; + +virtual HRESULT LockServer (BOOL fLock) =0; + +}; + +#else + +/* C interface definition for IClassFactory */ + +interface IClassFactory + { + const IClassFactoryVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IClassFactory; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, QueryMultipleInterfaces, (IMultiQI* pThis, ULONG cMQIs, MULTI_QI* pMQIs)); + +#define IMultiQI_QueryMultipleInterfaces(pThis, cMQIs, pMQIs) pThis->lpVtbl->QueryMultipleInterfaces(COM_ADJUST_THIS(pThis), cMQIs, pMQIs) + + COM_VTBL_END + } IMultiQIVtbl; + +#ifdef __cplusplus + +interface IMultiQI : public IUnknown +{ +virtual HRESULT QueryMultipleInterfaces (ULONG cMQIs, MULTI_QI* pMQIs) =0; + +}; + +#else + +/* C interface definition for IMultiQI */ + +interface IMultiQI + { + const IMultiQIVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IMultiQI; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, RegisterClass, (IRegistry* pThis, REFCLSID clsid, void* pfnGetClassObject)); + +#define IRegistry_RegisterClass(pThis, clsid, pfnGetClassObject) pThis->lpVtbl->RegisterClass(COM_ADJUST_THIS(pThis), clsid, pfnGetClassObject) + + COM_VTBL_ENTRY (HRESULT, IsClassRegistered, (IRegistry* pThis, REFCLSID clsid)); + +#define IRegistry_IsClassRegistered(pThis, clsid) pThis->lpVtbl->IsClassRegistered(COM_ADJUST_THIS(pThis), clsid) + + COM_VTBL_ENTRY (HRESULT, CreateInstance, (IRegistry* pThis, REFCLSID clsid, IUnknown* pUnkOuter, DWORD dwClsContext, const char* hint, ULONG cMQIs, MULTI_QI* pMQIs)); + +#define IRegistry_CreateInstance(pThis, clsid, pUnkOuter, dwClsContext, hint, cMQIs, pMQIs) pThis->lpVtbl->CreateInstance(COM_ADJUST_THIS(pThis), clsid, pUnkOuter, dwClsContext, hint, cMQIs, pMQIs) + + COM_VTBL_ENTRY (HRESULT, GetClassObject, (IRegistry* pThis, REFCLSID clsid, REFIID iid, DWORD dwClsContext, const char* hint, IUnknown** ppClsObj)); + +#define IRegistry_GetClassObject(pThis, clsid, iid, dwClsContext, hint, ppClsObj) pThis->lpVtbl->GetClassObject(COM_ADJUST_THIS(pThis), clsid, iid, dwClsContext, hint, ppClsObj) + + COM_VTBL_ENTRY (HRESULT, GetClassID, (IRegistry* pThis, DWORD dwIndex, LPCLSID pclsid)); + +#define IRegistry_GetClassID(pThis, dwIndex, pclsid) pThis->lpVtbl->GetClassID(COM_ADJUST_THIS(pThis), dwIndex, pclsid) + + COM_VTBL_END + } IRegistryVtbl; + +#ifdef __cplusplus + +interface IRegistry : public IUnknown +{ +virtual HRESULT RegisterClass (REFCLSID clsid, void* pfnGetClassObject) =0; + +virtual HRESULT IsClassRegistered (REFCLSID clsid) =0; + +virtual HRESULT CreateInstance (REFCLSID clsid, IUnknown* pUnkOuter, DWORD dwClsContext, const char* hint, ULONG cMQIs, MULTI_QI* pMQIs) =0; + +virtual HRESULT GetClassObject (REFCLSID clsid, REFIID iid, DWORD dwClsContext, const char* hint, IUnknown** ppClsObj) =0; + +virtual HRESULT GetClassID (DWORD dwIndex, LPCLSID pclsid) =0; + +}; + +#else + +/* C interface definition for IRegistry */ + +interface IRegistry + { + const IRegistryVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IRegistry; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, Next, (IEnumGUID* pThis, ULONG celt, GUID* rgelt, ULONG* pceltFetched)); + +#define IEnumGUID_Next(pThis, celt, rgelt, pceltFetched) pThis->lpVtbl->Next(COM_ADJUST_THIS(pThis), celt, rgelt, pceltFetched) + + COM_VTBL_ENTRY (HRESULT, Skip, (IEnumGUID* pThis, ULONG celt)); + +#define IEnumGUID_Skip(pThis, celt) pThis->lpVtbl->Skip(COM_ADJUST_THIS(pThis), celt) + + COM_VTBL_ENTRY (HRESULT, Reset, (IEnumGUID* pThis)); + +#define IEnumGUID_Reset(pThis) pThis->lpVtbl->Reset(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, Clone, (IEnumGUID* pThis, IEnumGUID** ppenum)); + +#define IEnumGUID_Clone(pThis, ppenum) pThis->lpVtbl->Clone(COM_ADJUST_THIS(pThis), ppenum) + + COM_VTBL_END + } IEnumGUIDVtbl; + +#ifdef __cplusplus + +interface IEnumGUID : public IUnknown +{ +virtual HRESULT Next (ULONG celt, GUID* rgelt, ULONG* pceltFetched) =0; + +virtual HRESULT Skip (ULONG celt) =0; + +virtual HRESULT Reset () =0; + +virtual HRESULT Clone (IEnumGUID** ppenum) =0; + +}; + +#else + +/* C interface definition for IEnumGUID */ + +interface IEnumGUID + { + const IEnumGUIDVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IEnumGUID; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, Next, (IEnumString* pThis, ULONG celt, LPOLESTR* rgelt, ULONG* pceltFetched)); + +#define IEnumString_Next(pThis, celt, rgelt, pceltFetched) pThis->lpVtbl->Next(COM_ADJUST_THIS(pThis), celt, rgelt, pceltFetched) + + COM_VTBL_ENTRY (HRESULT, Skip, (IEnumString* pThis, ULONG celt)); + +#define IEnumString_Skip(pThis, celt) pThis->lpVtbl->Skip(COM_ADJUST_THIS(pThis), celt) + + COM_VTBL_ENTRY (HRESULT, Reset, (IEnumString* pThis)); + +#define IEnumString_Reset(pThis) pThis->lpVtbl->Reset(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, Clone, (IEnumString* pThis, IEnumString** ppenum)); + +#define IEnumString_Clone(pThis, ppenum) pThis->lpVtbl->Clone(COM_ADJUST_THIS(pThis), ppenum) + + COM_VTBL_END + } IEnumStringVtbl; + +#ifdef __cplusplus + +interface IEnumString : public IUnknown +{ +virtual HRESULT Next (ULONG celt, LPOLESTR* rgelt, ULONG* pceltFetched) =0; + +virtual HRESULT Skip (ULONG celt) =0; + +virtual HRESULT Reset () =0; + +virtual HRESULT Clone (IEnumString** ppenum) =0; + +}; + +#else + +/* C interface definition for IEnumString */ + +interface IEnumString + { + const IEnumStringVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IEnumString; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, Next, (IEnumUnknown* pThis, ULONG celt, IUnknown** rgelt, ULONG* pceltFetched)); + +#define IEnumUnknown_Next(pThis, celt, rgelt, pceltFetched) pThis->lpVtbl->Next(COM_ADJUST_THIS(pThis), celt, rgelt, pceltFetched) + + COM_VTBL_ENTRY (HRESULT, Skip, (IEnumUnknown* pThis, ULONG celt)); + +#define IEnumUnknown_Skip(pThis, celt) pThis->lpVtbl->Skip(COM_ADJUST_THIS(pThis), celt) + + COM_VTBL_ENTRY (HRESULT, Reset, (IEnumUnknown* pThis)); + +#define IEnumUnknown_Reset(pThis) pThis->lpVtbl->Reset(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, Clone, (IEnumUnknown* pThis, IEnumUnknown** ppenum)); + +#define IEnumUnknown_Clone(pThis, ppenum) pThis->lpVtbl->Clone(COM_ADJUST_THIS(pThis), ppenum) + + COM_VTBL_END + } IEnumUnknownVtbl; + +#ifdef __cplusplus + +interface IEnumUnknown : public IUnknown +{ +virtual HRESULT Next (ULONG celt, IUnknown** rgelt, ULONG* pceltFetched) =0; + +virtual HRESULT Skip (ULONG celt) =0; + +virtual HRESULT Reset () =0; + +virtual HRESULT Clone (IEnumUnknown** ppenum) =0; + +}; + +#else + +/* C interface definition for IEnumUnknown */ + +interface IEnumUnknown + { + const IEnumUnknownVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IEnumUnknown; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (void*, Alloc, (IMalloc* pThis, ULONG cb)); + +#define IMalloc_Alloc(pThis, cb) pThis->lpVtbl->Alloc(COM_ADJUST_THIS(pThis), cb) + + COM_VTBL_ENTRY (void*, Realloc, (IMalloc* pThis, void* pv, ULONG cb)); + +#define IMalloc_Realloc(pThis, pv, cb) pThis->lpVtbl->Realloc(COM_ADJUST_THIS(pThis), pv, cb) + + COM_VTBL_ENTRY (void, Free, (IMalloc* pThis, void* pv)); + +#define IMalloc_Free(pThis, pv) pThis->lpVtbl->Free(COM_ADJUST_THIS(pThis), pv) + + COM_VTBL_ENTRY (ULONG, GetSize, (IMalloc* pThis, void* pv)); + +#define IMalloc_GetSize(pThis, pv) pThis->lpVtbl->GetSize(COM_ADJUST_THIS(pThis), pv) + + COM_VTBL_ENTRY (int, DidAlloc, (IMalloc* pThis, void* pv)); + +#define IMalloc_DidAlloc(pThis, pv) pThis->lpVtbl->DidAlloc(COM_ADJUST_THIS(pThis), pv) + + COM_VTBL_ENTRY (void, HeapMinimize, (IMalloc* pThis)); + +#define IMalloc_HeapMinimize(pThis) pThis->lpVtbl->HeapMinimize(COM_ADJUST_THIS(pThis)) + + COM_VTBL_END + } IMallocVtbl; + +#ifdef __cplusplus + +interface IMalloc : public IUnknown +{ +virtual void* Alloc (ULONG cb) =0; + +virtual void* Realloc (void* pv, ULONG cb) =0; + +virtual void Free (void* pv) =0; + +virtual ULONG GetSize (void* pv) =0; + +virtual int DidAlloc (void* pv) =0; + +virtual void HeapMinimize () =0; + +}; + +#else + +/* C interface definition for IMalloc */ + +interface IMalloc + { + const IMallocVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IMalloc; + +#ifdef __cplusplus +} +#endif + + + +#endif /* __INCcomCoreTypes_h */ + + diff --git a/h/comErr.h b/h/comErr.h new file mode 100644 index 0000000..cc42754 --- /dev/null +++ b/h/comErr.h @@ -0,0 +1,367 @@ +/* dcomErr.h -- DCOM API error codes (subset of win32 error codes) */ + +/* Copyright (c) 1998 Wind River Systems, Inc. */ + +#ifndef __INC_dcomErr_h +#define __INC_dcomErr_h + +/* facility codes */ + +#define FACILITY_WINDOWS 8 +#define FACILITY_STORAGE 3 +#define FACILITY_RPC 1 +#define FACILITY_SSPI 9 +#define FACILITY_WIN32 7 +#define FACILITY_CONTROL 10 +#define FACILITY_NULL 0 +#define FACILITY_INTERNET 12 +#define FACILITY_ITF 4 +#define FACILITY_DISPATCH 2 +#define FACILITY_CERT 11 + + +#define NO_ERROR 0L + +/* DCOM / RPC error codes */ + +#define RPC_S_INVALID_STRING_BINDING 1700L +#define RPC_S_WRONG_KIND_OF_BINDING 1701L +#define RPC_S_INVALID_BINDING 1702L +#define RPC_S_PROTSEQ_NOT_SUPPORTED 1703L +#define RPC_S_INVALID_RPC_PROTSEQ 1704L +#define RPC_S_INVALID_STRING_UUID 1705L +#define RPC_S_INVALID_ENDPOINT_FORMAT 1706L +#define RPC_S_INVALID_NET_ADDR 1707L +#define RPC_S_NO_ENDPOINT_FOUND 1708L +#define RPC_S_INVALID_TIMEOUT 1709L +#define RPC_S_OBJECT_NOT_FOUND 1710L +#define RPC_S_ALREADY_REGISTERED 1711L +#define RPC_S_TYPE_ALREADY_REGISTERED 1712L +#define RPC_S_ALREADY_LISTENING 1713L +#define RPC_S_NO_PROTSEQS_REGISTERED 1714L +#define RPC_S_NOT_LISTENING 1715L +#define RPC_S_UNKNOWN_MGR_TYPE 1716L +#define RPC_S_UNKNOWN_IF 1717L +#define RPC_S_NO_BINDINGS 1718L +#define RPC_S_NO_PROTSEQS 1719L +#define RPC_S_CANT_CREATE_ENDPOINT 1720L +#define RPC_S_OUT_OF_RESOURCES 1721L +#define RPC_S_SERVER_UNAVAILABLE 1722L +#define RPC_S_SERVER_TOO_BUSY 1723L +#define RPC_S_INVALID_NETWORK_OPTIONS 1724L +#define RPC_S_NO_CALL_ACTIVE 1725L +#define RPC_S_CALL_FAILED 1726L +#define RPC_S_CALL_FAILED_DNE 1727L +#define RPC_S_PROTOCOL_ERROR 1728L +#define RPC_S_UNSUPPORTED_TRANS_SYN 1730L +#define RPC_S_UNSUPPORTED_TYPE 1732L +#define RPC_S_INVALID_TAG 1733L +#define RPC_S_INVALID_BOUND 1734L +#define RPC_S_NO_ENTRY_NAME 1735L +#define RPC_S_INVALID_NAME_SYNTAX 1736L +#define RPC_S_UNSUPPORTED_NAME_SYNTAX 1737L +#define RPC_S_UUID_NO_ADDRESS 1739L +#define RPC_S_DUPLICATE_ENDPOINT 1740L +#define RPC_S_UNKNOWN_AUTHN_TYPE 1741L +#define RPC_S_MAX_CALLS_TOO_SMALL 1742L +#define RPC_S_STRING_TOO_LONG 1743L +#define RPC_S_PROTSEQ_NOT_FOUND 1744L +#define RPC_S_PROCNUM_OUT_OF_RANGE 1745L +#define RPC_S_BINDING_HAS_NO_AUTH 1746L +#define RPC_S_UNKNOWN_AUTHN_SERVICE 1747L +#define RPC_S_UNKNOWN_AUTHN_LEVEL 1748L +#define RPC_S_INVALID_AUTH_IDENTITY 1749L +#define RPC_S_UNKNOWN_AUTHZ_SERVICE 1750L +#define EPT_S_INVALID_ENTRY 1751L +#define EPT_S_CANT_PERFORM_OP 1752L +#define EPT_S_NOT_REGISTERED 1753L +#define RPC_S_NOTHING_TO_EXPORT 1754L +#define RPC_S_INCOMPLETE_NAME 1755L +#define RPC_S_INVALID_VERS_OPTION 1756L +#define RPC_S_NO_MORE_MEMBERS 1757L +#define RPC_S_NOT_ALL_OBJS_UNEXPORTED 1758L +#define RPC_S_INTERFACE_NOT_FOUND 1759L +#define RPC_S_ENTRY_ALREADY_EXISTS 1760L +#define RPC_S_ENTRY_NOT_FOUND 1761L +#define RPC_S_NAME_SERVICE_UNAVAILABLE 1762L +#define RPC_S_INVALID_NAF_ID 1763L +#define RPC_S_CANNOT_SUPPORT 1764L +#define RPC_S_NO_CONTEXT_AVAILABLE 1765L +#define RPC_S_INTERNAL_ERROR 1766L +#define RPC_S_ZERO_DIVIDE 1767L +#define RPC_S_ADDRESS_ERROR 1768L +#define RPC_S_FP_DIV_ZERO 1769L +#define RPC_S_FP_UNDERFLOW 1770L +#define RPC_S_FP_OVERFLOW 1771L +#define RPC_X_NO_MORE_ENTRIES 1772L +#define RPC_X_SS_CHAR_TRANS_OPEN_FAIL 1773L +#define RPC_X_SS_CHAR_TRANS_SHORT_FILE 1774L +#define RPC_X_SS_IN_NULL_CONTEXT 1775L +#define RPC_X_SS_CONTEXT_DAMAGED 1777L +#define RPC_X_SS_HANDLES_MISMATCH 1778L +#define RPC_X_SS_CANNOT_GET_CALL_HANDLE 1779L +#define RPC_X_NULL_REF_POINTER 1780L +#define RPC_X_ENUM_VALUE_OUT_OF_RANGE 1781L +#define RPC_X_BYTE_COUNT_TOO_SMALL 1782L +#define RPC_X_BAD_STUB_DATA 1783L +#define ERROR_INVALID_USER_BUFFER 1784L +#define ERROR_UNRECOGNIZED_MEDIA 1785L +#define ERROR_NO_TRUST_LSA_SECRET 1786L +#define ERROR_NO_TRUST_SAM_ACCOUNT 1787L +#define ERROR_TRUSTED_DOMAIN_FAILURE 1788L +#define ERROR_TRUSTED_RELATIONSHIP_FAILURE 1789L +#define ERROR_TRUST_FAILURE 1790L +#define RPC_S_CALL_IN_PROGRESS 1791L +#define ERROR_NETLOGON_NOT_STARTED 1792L +#define ERROR_ACCOUNT_EXPIRED 1793L +#define ERROR_REDIRECTOR_HAS_OPEN_HANDLES 1794L +#define ERROR_PRINTER_DRIVER_ALREADY_INSTALLED 1795L +#define ERROR_UNKNOWN_PORT 1796L +#define ERROR_UNKNOWN_PRINTER_DRIVER 1797L +#define ERROR_UNKNOWN_PRINTPROCESSOR 1798L +#define ERROR_INVALID_SEPARATOR_FILE 1799L +#define ERROR_INVALID_PRIORITY 1800L +#define ERROR_INVALID_PRINTER_NAME 1801L +#define ERROR_PRINTER_ALREADY_EXISTS 1802L +#define ERROR_INVALID_PRINTER_COMMAND 1803L +#define ERROR_INVALID_DATATYPE 1804L +#define ERROR_INVALID_ENVIRONMENT 1805L +#define RPC_S_NO_MORE_BINDINGS 1806L +#define ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT 1807L +#define ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT 1808L +#define ERROR_NOLOGON_SERVER_TRUST_ACCOUNT 1809L +#define ERROR_DOMAIN_TRUST_INCONSISTENT 1810L +#define ERROR_SERVER_HAS_OPEN_HANDLES 1811L +#define ERROR_RESOURCE_DATA_NOT_FOUND 1812L +#define ERROR_RESOURCE_TYPE_NOT_FOUND 1813L +#define ERROR_RESOURCE_NAME_NOT_FOUND 1814L +#define ERROR_RESOURCE_LANG_NOT_FOUND 1815L +#define ERROR_NOT_ENOUGH_QUOTA 1816L +#define RPC_S_NO_INTERFACES 1817L +#define RPC_S_CALL_CANCELLED 1818L +#define RPC_S_BINDING_INCOMPLETE 1819L +#define RPC_S_COMM_FAILURE 1820L +#define RPC_S_UNSUPPORTED_AUTHN_LEVEL 1821L +#define RPC_S_NO_PRINC_NAME 1822L +#define RPC_S_NOT_RPC_ERROR 1823L +#define RPC_S_UUID_LOCAL_ONLY 1824L +#define RPC_S_SEC_PKG_ERROR 1825L +#define RPC_S_NOT_CANCELLED 1826L +#define RPC_X_INVALID_ES_ACTION 1827L +#define RPC_X_WRONG_ES_VERSION 1828L +#define RPC_X_WRONG_STUB_VERSION 1829L +#define RPC_X_INVALID_PIPE_OBJECT 1830L +#define RPC_X_INVALID_PIPE_OPERATION 1831L +#define RPC_X_WRONG_PIPE_VERSION 1832L +#define RPC_S_GROUP_MEMBER_NOT_FOUND 1898L +#define EPT_S_CANT_CREATE 1899L +#define RPC_S_INVALID_OBJECT 1900L + +/* DCOM object exporter error codes */ + +#define OR_INVALID_OXID 1910L +#define OR_INVALID_OID 1911L +#define OR_INVALID_SET 1912L + +/* HRESULT SEVERITY values required for DCOM */ + +#define SEVERITY_SUCCESS 0 +#define SEVERITY_ERROR 1 + + +/* SUCCEEDED / FAILED macros for testing returned HRESULTs */ +#define SUCCEEDED(hr) ((HRESULT) (hr) >= 0) +#define FAILED(hr) ((HRESULT) (hr) < 0) +#define HRESULT_CODE(hr) ((hr) & 0xFFFF) +#define HRESULT_FACILITY(hr) (((hr) >> 16) & 0x1FFF) +#define HRESULT_SEVERITY(hr) (((hr) >> 31) & 0x01) + +/* How to make your own HRESULT */ +#define MAKE_HRESULT(sev,fac,code) \ + ((HRESULT) (((unsigned long)(sev)<<31) | \ + ((unsigned long)(fac)<<16) | \ + ((unsigned long)(code))) ) + +#define DEFINE_HRESULT(_sc) ((HRESULT)_sc) + +/* Standard COM/DCOM HRESULT values */ + + +#define NOERROR 0 +#define S_OK ((HRESULT)0x00000000L) +#define S_FALSE ((HRESULT)0x00000001L) + +#define E_UNEXPECTED DEFINE_HRESULT(0x8000FFFFL) +#define E_NOTIMPL DEFINE_HRESULT(0x80004001L) +#define E_OUTOFMEMORY DEFINE_HRESULT(0x8007000EL) +#define E_INVALIDARG DEFINE_HRESULT(0x80070057L) +#define E_NOINTERFACE DEFINE_HRESULT(0x80004002L) +#define E_POINTER DEFINE_HRESULT(0x80004003L) +#define E_HANDLE DEFINE_HRESULT(0x80070006L) +#define E_ABORT DEFINE_HRESULT(0x80004004L) +#define E_FAIL DEFINE_HRESULT(0x80004005L) +#define E_ACCESSDENIED DEFINE_HRESULT(0x80070005L) +#define E_PENDING DEFINE_HRESULT(0x8000000AL) +#define CO_E_INIT_TLS DEFINE_HRESULT(0x80004006L) +#define CO_E_INIT_SHARED_ALLOCATOR DEFINE_HRESULT(0x80004007L) +#define CO_E_INIT_MEMORY_ALLOCATOR DEFINE_HRESULT(0x80004008L) +#define CO_E_INIT_CLASS_CACHE DEFINE_HRESULT(0x80004009L) +#define CO_E_INIT_RPC_CHANNEL DEFINE_HRESULT(0x8000400AL) +#define CO_E_INIT_TLS_SET_CHANNEL_CONTROL DEFINE_HRESULT(0x8000400BL) +#define CO_E_INIT_TLS_CHANNEL_CONTROL DEFINE_HRESULT(0x8000400CL) +#define CO_E_INIT_UNACCEPTED_USER_ALLOCATOR DEFINE_HRESULT(0x8000400DL) +#define CO_E_INIT_SCM_MUTEX_EXISTS DEFINE_HRESULT(0x8000400EL) +#define CO_E_INIT_SCM_FILE_MAPPING_EXISTS DEFINE_HRESULT(0x8000400FL) +#define CO_E_INIT_SCM_MAP_VIEW_OF_FILE DEFINE_HRESULT(0x80004010L) +#define CO_E_INIT_SCM_EXEC_FAILURE DEFINE_HRESULT(0x80004011L) +#define CO_E_INIT_ONLY_SINGLE_THREADED DEFINE_HRESULT(0x80004012L) +#define CO_E_CANT_REMOTE DEFINE_HRESULT(0x80004013L) +#define CO_E_BAD_SERVER_NAME DEFINE_HRESULT(0x80004014L) +#define CO_E_WRONG_SERVER_IDENTITY DEFINE_HRESULT(0x80004015L) +#define CO_E_OLE1DDE_DISABLED DEFINE_HRESULT(0x80004016L) +#define CO_E_RUNAS_SYNTAX DEFINE_HRESULT(0x80004017L) +#define CO_E_CREATEPROCESS_FAILURE DEFINE_HRESULT(0x80004018L) +#define CO_E_RUNAS_CREATEPROCESS_FAILURE DEFINE_HRESULT(0x80004019L) +#define CO_E_RUNAS_LOGON_FAILURE DEFINE_HRESULT(0x8000401AL) +#define CO_E_LAUNCH_PERMSSION_DENIED DEFINE_HRESULT(0x8000401BL) +#define CO_E_START_SERVICE_FAILURE DEFINE_HRESULT(0x8000401CL) +#define CO_E_REMOTE_COMMUNICATION_FAILURE DEFINE_HRESULT(0x8000401DL) +#define CO_E_SERVER_START_TIMEOUT DEFINE_HRESULT(0x8000401EL) +#define CO_E_CLSREG_INCONSISTENT DEFINE_HRESULT(0x8000401FL) +#define CO_E_IIDREG_INCONSISTENT DEFINE_HRESULT(0x80004020L) +#define CO_E_NOT_SUPPORTED DEFINE_HRESULT(0x80004021L) + +#define CLASS_E_NOAGGREGATION DEFINE_HRESULT(0x80040110L) +#define CLASS_E_CLASSNOTAVAILABLE DEFINE_HRESULT(0x80040111L) + +#define REGDB_E_READREGDB DEFINE_HRESULT(0x80040150L) +#define REGDB_E_WRITEREGDB DEFINE_HRESULT(0x80040151L) +#define REGDB_E_KEYMISSING DEFINE_HRESULT(0x80040152L) +#define REGDB_E_INVALIDVALUE DEFINE_HRESULT(0x80040153L) +#define REGDB_E_CLASSNOTREG DEFINE_HRESULT(0x80040154L) +#define REGDB_E_IIDNOTREG DEFINE_HRESULT(0x80040155L) + +#define CO_E_NOTINITIALIZED DEFINE_HRESULT(0x800401F0L) +#define CO_E_ALREADYINITIALIZED DEFINE_HRESULT(0x800401F1L) +#define CO_E_CANTDETERMINECLASS DEFINE_HRESULT(0x800401F2L) +#define CO_E_CLASSSTRING DEFINE_HRESULT(0x800401F3L) +#define CO_E_IIDSTRING DEFINE_HRESULT(0x800401F4L) +#define CO_E_APPNOTFOUND DEFINE_HRESULT(0x800401F5L) +#define CO_E_APPSINGLEUSE DEFINE_HRESULT(0x800401F6L) +#define CO_E_ERRORINAPP DEFINE_HRESULT(0x800401F7L) +#define CO_E_DLLNOTFOUND DEFINE_HRESULT(0x800401F8L) +#define CO_E_ERRORINDLL DEFINE_HRESULT(0x800401F9L) +#define CO_E_WRONGOSFORAPP DEFINE_HRESULT(0x800401FAL) +#define CO_E_OBJNOTREG DEFINE_HRESULT(0x800401FBL) +#define CO_E_OBJISREG DEFINE_HRESULT(0x800401FCL) +#define CO_E_OBJNOTCONNECTED DEFINE_HRESULT(0x800401FDL) +#define CO_E_APPDIDNTREG DEFINE_HRESULT(0x800401FEL) +#define CO_E_RELEASED DEFINE_HRESULT(0x800401FFL) + +#define CO_E_CLASS_CREATE_FAILED DEFINE_HRESULT(0x80080001L) +#define CO_E_SCM_ERROR DEFINE_HRESULT(0x80080002L) +#define CO_E_SCM_RPC_FAILURE DEFINE_HRESULT(0x80080003L) +#define CO_E_BAD_PATH DEFINE_HRESULT(0x80080004L) +#define CO_E_SERVER_EXEC_FAILURE DEFINE_HRESULT(0x80080005L) +#define CO_E_OBJSRV_RPC_FAILURE DEFINE_HRESULT(0x80080006L) + +#define CO_E_SERVER_STOPPING DEFINE_HRESULT(0x80080008L) +#define CO_S_NOTALLINTERFACES DEFINE_HRESULT(0x00080012L) + +#define DISP_E_UNKNOWNINTERFACE DEFINE_HRESULT(0x80020001L) +#define DISP_E_MEMBERNOTFOUND DEFINE_HRESULT(0x80020003L) +#define DISP_E_PARAMNOTFOUND DEFINE_HRESULT(0x80020004L) +#define DISP_E_TYPEMISMATCH DEFINE_HRESULT(0x80020005L) +#define DISP_E_UNKNOWNNAME DEFINE_HRESULT(0x80020006L) +#define DISP_E_NONAMEDARGS DEFINE_HRESULT(0x80020007L) +#define DISP_E_BADVARTYPE DEFINE_HRESULT(0x80020008L) +#define DISP_E_EXCEPTION DEFINE_HRESULT(0x80020009L) +#define DISP_E_OVERFLOW DEFINE_HRESULT(0x8002000AL) +#define DISP_E_BADINDEX DEFINE_HRESULT(0x8002000BL) +#define DISP_E_UNKNOWNLCID DEFINE_HRESULT(0x8002000CL) +#define DISP_E_ARRAYISLOCKED DEFINE_HRESULT(0x8002000DL) +#define DISP_E_BADPARAMCOUNT DEFINE_HRESULT(0x8002000EL) +#define DISP_E_PARAMNOTOPTIONAL DEFINE_HRESULT(0x8002000FL) +#define DISP_E_BADCALLEE DEFINE_HRESULT(0x80020010L) +#define DISP_E_NOTACOLLECTION DEFINE_HRESULT(0x80020011L) +#define TYPE_E_BUFFERTOOSMALL DEFINE_HRESULT(0x80028016L) +#define TYPE_E_INVDATAREAD DEFINE_HRESULT(0x80028018L) +#define TYPE_E_UNSUPFORMAT DEFINE_HRESULT(0x80028019L) +#define TYPE_E_REGISTRYACCESS DEFINE_HRESULT(0x8002801CL) +#define TYPE_E_LIBNOTREGISTERED DEFINE_HRESULT(0x8002801DL) +#define TYPE_E_UNDEFINEDTYPE DEFINE_HRESULT(0x80028027L) +#define TYPE_E_QUALIFIEDNAMEDISALLOWED DEFINE_HRESULT(0x80028028L) +#define TYPE_E_INVALIDSTATE DEFINE_HRESULT(0x80028029L) +#define TYPE_E_WRONGTYPEKIND DEFINE_HRESULT(0x8002802AL) +#define TYPE_E_ELEMENTNOTFOUND DEFINE_HRESULT(0x8002802BL) +#define TYPE_E_AMBIGUOUSNAME DEFINE_HRESULT(0x8002802CL) +#define TYPE_E_NAMECONFLICT DEFINE_HRESULT(0x8002802DL) +#define TYPE_E_UNKNOWNLCID DEFINE_HRESULT(0x8002802EL) +#define TYPE_E_DLLFUNCTIONNOTFOUND DEFINE_HRESULT(0x8002802FL) +#define TYPE_E_BADMODULEKIND DEFINE_HRESULT(0x800288BDL) +#define TYPE_E_SIZETOOBIG DEFINE_HRESULT(0x800288C5L) +#define TYPE_E_DUPLICATEID DEFINE_HRESULT(0x800288C6L) +#define TYPE_E_INVALIDID DEFINE_HRESULT(0x800288CFL) +#define TYPE_E_TYPEMISMATCH DEFINE_HRESULT(0x80028CA0L) +#define TYPE_E_OUTOFBOUNDS DEFINE_HRESULT(0x80028CA1L) +#define TYPE_E_IOERROR DEFINE_HRESULT(0x80028CA2L) +#define TYPE_E_CANTCREATETMPFILE DEFINE_HRESULT(0x80028CA3L) +#define TYPE_E_CANTLOADLIBRARY DEFINE_HRESULT(0x80029C4AL) +#define TYPE_E_INCONSISTENTPROPFUNCS DEFINE_HRESULT(0x80029C83L) +#define TYPE_E_CIRCULARTYPE DEFINE_HRESULT(0x80029C84L) + +#define RPC_E_CALL_REJECTED DEFINE_HRESULT(0x80010001L) +#define RPC_E_CALL_CANCELED DEFINE_HRESULT(0x80010002L) +#define RPC_E_CANTPOST_INSENDCALL DEFINE_HRESULT(0x80010003L) +#define RPC_E_CANTCALLOUT_INASYNCCALL DEFINE_HRESULT(0x80010004L) +#define RPC_E_CANTCALLOUT_INEXTERNALCALL DEFINE_HRESULT(0x80010005L) +#define RPC_E_CONNECTION_TERMINATED DEFINE_HRESULT(0x80010006L) +#define RPC_E_SERVER_DIED DEFINE_HRESULT(0x80010007L) +#define RPC_E_CLIENT_DIED DEFINE_HRESULT(0x80010008L) +#define RPC_E_INVALID_DATAPACKET DEFINE_HRESULT(0x80010009L) +#define RPC_E_CANTTRANSMIT_CALL DEFINE_HRESULT(0x8001000AL) +#define RPC_E_CLIENT_CANTMARSHAL_DATA DEFINE_HRESULT(0x8001000BL) +#define RPC_E_CLIENT_CANTUNMARSHAL_DATA DEFINE_HRESULT(0x8001000CL) +#define RPC_E_SERVER_CANTMARSHAL_DATA DEFINE_HRESULT(0x8001000DL) +#define RPC_E_SERVER_CANTUNMARSHAL_DATA DEFINE_HRESULT(0x8001000EL) +#define RPC_E_INVALID_DATA DEFINE_HRESULT(0x8001000FL) +#define RPC_E_INVALID_PARAMETER DEFINE_HRESULT(0x80010010L) +#define RPC_E_CANTCALLOUT_AGAIN DEFINE_HRESULT(0x80010011L) +#define RPC_E_SERVER_DIED_DNE DEFINE_HRESULT(0x80010012L) +#define RPC_E_SYS_CALL_FAILED DEFINE_HRESULT(0x80010100L) +#define RPC_E_OUT_OF_RESOURCES DEFINE_HRESULT(0x80010101L) +#define RPC_E_ATTEMPTED_MULTITHREAD DEFINE_HRESULT(0x80010102L) +#define RPC_E_NOT_REGISTERED DEFINE_HRESULT(0x80010103L) +#define RPC_E_FAULT DEFINE_HRESULT(0x80010104L) +#define RPC_E_SERVERFAULT DEFINE_HRESULT(0x80010105L) +#define RPC_E_CHANGED_MODE DEFINE_HRESULT(0x80010106L) +#define RPC_E_INVALIDMETHOD DEFINE_HRESULT(0x80010107L) +#define RPC_E_DISCONNECTED DEFINE_HRESULT(0x80010108L) +#define RPC_E_RETRY DEFINE_HRESULT(0x80010109L) +#define RPC_E_SERVERCALL_RETRYLATER DEFINE_HRESULT(0x8001010AL) +#define RPC_E_SERVERCALL_REJECTED DEFINE_HRESULT(0x8001010BL) +#define RPC_E_INVALID_CALLDATA DEFINE_HRESULT(0x8001010CL) +#define RPC_E_CANTCALLOUT_ININPUTSYNCCALL DEFINE_HRESULT(0x8001010DL) +#define RPC_E_WRONG_THREAD DEFINE_HRESULT(0x8001010EL) +#define RPC_E_THREAD_NOT_INIT DEFINE_HRESULT(0x8001010FL) +#define RPC_E_VERSION_MISMATCH DEFINE_HRESULT(0x80010110L) +#define RPC_E_INVALID_HEADER DEFINE_HRESULT(0x80010111L) +#define RPC_E_INVALID_EXTENSION DEFINE_HRESULT(0x80010112L) +#define RPC_E_INVALID_IPID DEFINE_HRESULT(0x80010113L) +#define RPC_E_INVALID_OBJECT DEFINE_HRESULT(0x80010114L) +#define RPC_S_CALLPENDING DEFINE_HRESULT(0x80010115L) +#define RPC_S_WAITONTIMER DEFINE_HRESULT(0x80010116L) +#define RPC_E_CALL_COMPLETE DEFINE_HRESULT(0x80010117L) +#define RPC_E_UNSECURE_CALL DEFINE_HRESULT(0x80010118L) +#define RPC_E_TOO_LATE DEFINE_HRESULT(0x80010119L) +#define RPC_E_NO_GOOD_SECURITY_PACKAGES DEFINE_HRESULT(0x8001011AL) +#define RPC_E_ACCESS_DENIED DEFINE_HRESULT(0x8001011BL) +#define RPC_E_REMOTE_DISABLED DEFINE_HRESULT(0x8001011CL) +#define RPC_E_INVALID_OBJREF DEFINE_HRESULT(0x8001011DL) +#define RPC_E_UNEXPECTED DEFINE_HRESULT(0x8001FFFFL) + + +#endif + + + diff --git a/h/comLib.h b/h/comLib.h new file mode 100644 index 0000000..f811a0d --- /dev/null +++ b/h/comLib.h @@ -0,0 +1,412 @@ +/* comLib.h - VxWorks COM public API */ + +/* Copyright (c) 1998 Wind River Systems, Inc. */ + +/* + +modification history +-------------------- +02u,02jan02,nel Fix alloca for diab build. +02t,10dec01,dbs diab build +02s,08aug01,nel Removed V_DECIMAL macros, not supported. +02r,16jul01,dbs correct definition of comLibInit func +02q,13jul01,dbs change vxcom back to vxidl +02p,28jun01,dbs move VxMutex to private header +02o,27jun01,nel Add extra SafeArray API. +02n,21jun01,dbs move some definitions to comCoreLib +02m,20jun01,nel Remove WindTypes and replace with vxcom.h. +02l,08feb01,nel SPR#63885. SAFEARRAYs added. +02k,30may00,nel Add more variant support +02j,02feb00,dbs add some Variant-related APIs +02i,22sep99,dbs fix VARIANT type (moved to vxidl.idl) +02h,20sep99,dbs move main typedefs into vxidl.idl/.h +02g,16sep99,dbs add uchar typedef +02f,01sep99,dbs add more IDL types +02e,18aug99,aim fix GUID structure for SIMNT +02d,05aug99,dbs add byte typedef +02c,30jul99,aim changed mutex types to void* +02b,30jul99,dbs fix build issues on SIMNT +02a,29jul99,dbs add SIMNT support +01z,28jul99,drm Changing g_defaultServerPriority to g_defaultServerPriority. +01y,27jul99,drm Removing PS_CLNT_ASSIGNED enum entry. +01x,16jul99,dbs reverse T2OLE expression, remove need for USES_CONVERSION +01w,10jun99,dbs move vxdcom-private funcs out of here +01v,04jun99,dbs remove public registry APIs +01u,03jun99,dbs make mutex lock return void +01t,03jun99,dbs fix long long type for W32 +01s,02jun99,aim #undef Free if it's defined +01r,02jun99,dbs use new OS-specific macros +01q,20may99,dbs add SysAllocStringByteLen() API +01p,07may99,dbs add PROTSEQ typedef +01o,03may99,drm adding priority scheme support +01n,28apr99,dbs remove COM_NO_WINDOWS_H +01m,20apr99,dbs add TLS defs for Win32, remove CoSetMalloc() API +01l,14apr99,dbs fix alloca() definition for Win32 +01k,14apr99,dbs add definition for alloca() in gcc +01j,31mar99,dbs added SysAllocStringLen API +01i,19mar99,drm added CoCreateGuid() declaration +01h,01mar99,dbs add GUID_NULL definition +01g,19feb99,dbs add more wide-char support +01f,11feb99,dbs add CoSetMalloc API +01e,04feb99,dbs fix wide-char type for portability +01d,03feb99,dbs use STDMETHOD macros +01c,20jan99,dbs fix file names - vxcom becomes com +01b,08jan99,dbs add TLS functions +01a,18dec98,dbs created (from dcomLib.h) + +*/ + +/* + + DESCRIPTION: + + This file defines a working subset of the COM API (as defined by + Microsoft) for support of plain COM in VxWorks. + + A slight difference from the MS implementation is that + CoCreateInstance() only works for CLSCTX_INPROC servers, and + CoCreateInstanceEx() must be used for CLSCTX_REMOTE servers. + + Also, CoGetClassObject() is only available when DCOM is included, and + not under plain VXCOM. + + */ + +#ifndef __INCcomLib_h +#define __INCcomLib_h + +#include +#include "vxidl.h" +#include "comCoreLib.h" +#include "semLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern int g_defaultServerPriority; + +/* + * The COM initialization type -- only COINIT_MULTITHREADED is + * accepted by VxCOM / VxDCOM, the others are provided for Win32 + * compatibility. +*/ +typedef enum + { + COINIT_APARTMENTTHREADED = 0x2, // apartment model - not supported + COINIT_MULTITHREADED = 0x0, // call objects on any thread. + COINIT_DISABLE_OLE1DDE = 0x4, // [don't use DDE for Ole1 support] + COINIT_SPEED_OVER_MEMORY = 0x8, // [trade memory for speed?] + } COINIT; + + +////////////////////////////////////////////////////////////////////////// +// +// Public API Functions - these mimic the Win32 CoXxxx API calls. +// +////////////////////////////////////////////////////////////////////////// + +STATUS comLibInit (void); + +HRESULT CoCreateInstance + ( + REFCLSID rclsid, // CLSID of the object + IUnknown* pUnkOuter, // pointer to aggregating object + DWORD dwClsContext, // one of CLSCTX values + REFIID riid, // IID of desired interface + void** ppv // output interface ptr + ); + +HRESULT CoInitialize (void*); + +HRESULT CoInitializeEx (void*, DWORD); + +void CoUninitialize (void); + +DWORD CoGetCurrentProcess (void); + +void* CoTaskMemAlloc (ULONG cb); + +void* CoTaskMemRealloc (LPVOID pv, ULONG cb); + +void CoTaskMemFree (LPVOID pv); + +HRESULT CoGetMalloc + ( + DWORD dwMemContext, // private or shared + IMalloc** ppMalloc // output ptr + ); + +HRESULT CoCreateGuid (GUID *pguid); + +BSTR SysAllocString (const OLECHAR*); + +BSTR SysAllocStringLen (const OLECHAR*, unsigned long); + +BSTR SysAllocStringByteLen (const char*, unsigned long); + +HRESULT SysFreeString (BSTR); + +DWORD SysStringLen (BSTR); + +DWORD SysStringByteLen (BSTR); + +int StringFromGUID2 + ( + REFGUID rguid, // IID to be converted + LPOLESTR lpsz, // resulting string + int cbMax // max size of returned string + ); + +HRESULT StringFromCLSID + ( + REFCLSID rclsid, // CLSID to be converted + LPOLESTR* ppsz // output var to receive string + ); + +HRESULT StringFromIID + ( + REFIID riid, // IID to be converted + LPOLESTR* ppsz // output var to receive string + ); + +HRESULT CLSIDFromString + ( + LPCOLESTR lpsz, // string representation of CLSID + LPCLSID pclsid // pointer to CLSID + ); + +HRESULT IIDFromString + ( + LPCOLESTR lpsz, // string representation of IID + LPIID piid // pointer to IID + ); + +BOOL IsEqualGUID + ( + REFGUID guid1, + REFGUID guid2 + ); + +BOOL IsEqualCLSID + ( + REFCLSID clsid1, + REFCLSID clsid2 + ); + +BOOL IsEqualIID + ( + REFIID iid1, + REFIID iid2 + ); + +HRESULT WriteClassStm + ( + IStream * pStm, // IStream to store in + REFCLSID rclsid // CLSID to be stored in stream + ); + +HRESULT ReadClassStm + ( + IStream * pStm, // stream holding the CLSID + CLSID * pclsid // output CLSID + ); + +#ifndef V_VT + +/* Variant access macros */ + +#define V_VT(X) ((X)->vt) +#define V_ISARRAY(X) (V_VT(X)&VT_ARRAY) + +#define V_UI1(X) ((X)->bVal) +#define V_I2(X) ((X)->iVal) +#define V_I4(X) ((X)->lVal) +#define V_R4(X) ((X)->fltVal) +#define V_R8(X) ((X)->dblVal) +#define V_CY(X) ((X)->cyVal) +#define V_DATE(X) ((X)->date) +#define V_BSTR(X) ((X)->bstrVal) +#define V_ERROR(X) ((X)->scode) +#define V_BOOL(X) ((X)->boolVal) +#define V_UNKNOWN(X) ((X)->punkVal) +#define V_ARRAY(X) ((X)->parray) +#define V_VARIANT(X) ((X)->pvarVal) + +#endif /* V_VT */ + +void VariantInit (VARIANT* v); + +HRESULT VariantClear (VARIANT* v); + +HRESULT VariantCopy (VARIANT* d, VARIANT* s); + +HRESULT VariantChangeType (VARIANT * d, + VARIANT * s, + USHORT wFlags, + VARTYPE vt); + +SAFEARRAY * SafeArrayCreate + ( + VARTYPE vt, + UINT cDims, + SAFEARRAYBOUND * rgsabound + ); + +HRESULT SafeArrayDestroy + ( + SAFEARRAY * psa + ); + + +HRESULT SafeArrayLock (SAFEARRAY * psa); +HRESULT SafeArrayUnlock (SAFEARRAY * psa); + + +HRESULT SafeArrayPutElement + ( + SAFEARRAY * psa, + long * rgIndicies, + void * pv + ); + +HRESULT SafeArrayGetElement + ( + SAFEARRAY * psa, + long * rgIndicies, + void * pv + ); + +HRESULT SafeArrayAccessData + ( + SAFEARRAY * psa, + void ** ppvData + ); + +HRESULT SafeArrayUnaccessData + ( + SAFEARRAY * psa + ); + +HRESULT SafeArrayCopy + ( + SAFEARRAY * psa, + SAFEARRAY ** ppsaOut + ); + +HRESULT SafeArrayGetLBound + ( + SAFEARRAY * psa, + unsigned int nDim, + long * plLbound + ); + +HRESULT SafeArrayGetUBound + ( + SAFEARRAY * psa, + unsigned int nDim, + long * plUbound + ); + +UINT SafeArrayGetDim + ( + SAFEARRAY * psa + ); + +UINT SafeArrayGetElemsize + ( + SAFEARRAY * psa + ); + +HRESULT SafeArrayGetVartype + ( + SAFEARRAY * psa, + VARTYPE * pvt + ); + +const char* vxcomGUID2String (REFGUID guid); + +HRESULT comStreamCreate + ( + const void* pMem, // raw memory block + unsigned long len, // length + IStream** ppStream // output stream-ptr + ); + +int comWideToAscii + ( + char* result, // resulting ascii string + const OLECHAR* wstr, // input wide-string + int maxLen // max length to convert + ); + + +int comAsciiToWide + ( + OLECHAR* result, // resulting wide string + const char* str, // input string + int maxLen // max length to convert + ); + +size_t comWideStrLen + ( + const OLECHAR* wsz // wide string + ); + +OLECHAR* comWideStrCopy + ( + OLECHAR* wszDst, // destination + const OLECHAR* wszSrc // source + ); + +HRESULT vxdcomClassRegister + ( + REFCLSID clsid, // key + PFN_GETCLASSOBJECT pFnGCO, // ptr to GetClassObject() fn + VXDCOMPRIORITYSCHEME priorityScheme, // priority scheme + int priority // priority assoc. with scheme + ); + +////////////////////////////////////////////////////////////////////////// +// +// Inline ASCII/WIDE conversion macros a la ATL. Unlike ATL, a +// function need not declare USES_CONVERSION at the top, but can +// freely use the macros to do inline conversion of wide-to-ascii +// (e.g. OLE2T(pwszSomeWideString)) or ascii-to-wide (e.g. T2OLE("some +// ASCII text")) on any architecture. Currently, OLECHAR != wchar_t on +// all VxWorks architectures, so use of Wide Literal Strings +// (e.g. L"some wide text") is not recommended. +// + +#ifdef __GNUC__ +# ifndef alloca +# define alloca __builtin_alloca +# endif +#elif defined(__DCC__) +/* its a builtin for DCC */ +#else +#include +#endif + +#ifndef USES_CONVERSION +#define USES_CONVERSION +#endif + +OLECHAR* comT2OLEHelper (void*,const char*); +char* comOLE2THelper (void*,const OLECHAR*); + +#define T2OLE(psz) \ + ((psz) ? (comT2OLEHelper (alloca (sizeof (OLECHAR) * (strlen (psz) + 1)), \ + psz)) : 0) + +#define OLE2T(pwsz) \ + ((pwsz) ? (comOLE2THelper(alloca (comWideStrLen (pwsz) + 1), pwsz)) : 0) + +#ifdef __cplusplus +} +#endif + +#endif + + + diff --git a/h/comObjLib.h b/h/comObjLib.h new file mode 100644 index 0000000..37ebaa7 --- /dev/null +++ b/h/comObjLib.h @@ -0,0 +1,953 @@ +/* comObjLib.h - template-based COM-object construction library (VxCOM) */ + +/* Copyright (c) 1999 Wind River Systems, Inc. */ + +/* + +modification history +-------------------- +02n,04oct01,dbs add macros to export coclasses in shlibs +02m,24sep01,nel SPR#70528. Fix memory leak in CComBSTR. +02l,31jul01,dbs allow override of InternalAddRef/Release methods +02k,28jun01,dbs use safe inc/dec funcs, remove VxMutex dependency +02j,21jun01,dbs make use of VxMutex class +02i,09apr01,nel SPR#65606. Correct minor formating errors. +02h,28feb01,nel SPR#35792. Add more ATL defs to bring into line with T2. +02g,16aug00,nel Add CComBSTR(char *) to CComStr to make MathDemo example work + under vxworks. +02f,30may00,nel Add more variant support +02e,28feb00,nel Remove VxComTrack dependency on hard coded idl stuff +02d,01feb00,nel Added VxComTrack code and Fix for singleton operation +02c,15oct99,dbs fix comments to refer to proper classnames +02b,18aug99,dbs remove extraneous ptr-conversion operator in CComPtr +02a,13aug99,drm Bux fix. +01z,13aug99,dbs fix copy-ctor in CComPtr +01y,29jul99,aim changed mutex types to void* +01x,28jul99,drm Changing g_defaultServerPriority to g_defaultServerPriority. +01w,28jul99,dbs remove PS_CLNT_ASSIGNED enum value +01v,26jul99,dbs fix typo in COM_INTERFACE_ENTRY macros +01u,30jun99,dbs add const operator-> to CComPtr +01t,28jun99,dbs remove obsolete ptrAssign function +01s,04jun99,dbs fix registry calls +01r,03jun99,dbs remove comSyncLib and VxMutex class +01q,26may99,dbs add further ATL compatibility +01p,20may99,dbs move class-object functionality into CComCoClass + class so explicit template instantiation works +01o,04may99,dbs check return value of alloc in CreateInstance +01n,03may99,drm adding priority scheme support +01m,27apr99,dbs add alloc helper funcs +01l,23apr99,dbs make mutex publically available thru CComObject methods +01k,23apr99,dbs improve QI implementation, remove virtualness, + enforce locking in CComObject class +01j,22apr99,dbs remove potential leaks, remove extraneous debugging + code (will be replaced with official DEBUG-lib in + future), simplify locking strategy (we don't need to + provide a VxNoLock class at all). +01i,14apr99,dbs put incr and decr methods into VxMutex class +01h,31mar99,dbs add CComPtr and CComBSTR classes +01g,03feb99,dbs use STDMETHOD macros +01f,20jan99,dbs fix file names - vxcom becomes com +01e,11jan99,dbs change classnames to be ATL compatible +01d,21dec98,dbs changes for VXCOM +01c,15dec98,dbs add singleton support +01b,11dec98,dbs simplify registry +01a,17nov98,dbs created + +*/ + +/* + + DESCRIPTION: + + This file contains template classes for creating COM objects using + multiple inheritance to implement multiple interfaces. Classes + created with these templates feature class-factories, thread-safe + reference counting, etc... + + They are source-level compatible with ATL, and use the same + COM_MAP() style of interface mapping, although the implementation is + somewhat different. + */ + + +#ifndef __INCcomObjLib_h__ +#define __INCcomObjLib_h__ + +#include "comCoreLib.h" +#include "comLib.h" +#include + +#define DECLARE_CLASSFACTORY_SINGLETON() enum {singleton=1}; + +#define DECLARE_REGISTRY_RESOURCE(x) +#define DECLARE_REGISTRY(class, pid, vpid, nid, flags) + +#ifndef VXDCOM_COMTRACK_LEVEL +#define VXDCOM_COMTRACK_LEVEL 0 +#endif + +#if (VXDCOM_COMTRACK_LEVEL == 0) +#define COMTRACK_ADD_CLS(c) +#define COMTRACK_ADD_IID(c) +#define COMTRACK_UPDATE() +#else +#include "comShow.h" +#define COMTRACK_ADD_CLS(c) if (VxComTrack::theInstance()->addClassInstance ((void *)this, (char *)vxcomGUID2String (GetObjectCLSID ()), #c, m_dwRefCount, GetObjectCLSID ()) != NULL) _qi_impl (IID_IUnknown, NULL) +#define COMTRACK_ADD_IID(c) VxComTrack::theInstance()->addInterface ((void *)this, (char *)vxcomGUID2String (IID_##c), "IID_"#c, IID_##c) +#define COMTRACK_UPDATE() VxComTrack::theInstance()->updateClassInstance (this, m_dwRefCount) +#endif + +////////////////////////////////////////////////////////////////////////// +// +// CComObjectRoot - the base class of all the VxDCOM classes. It +// provides basic IUnknown support, plus support for COM aggregation +// and reference-counting... +// + +class CComObjectRoot + { + + public: + enum { singleton=0 }; + + CComObjectRoot (IUnknown *punk=0) + : m_dwRefCount (0), + m_pUnkOuter (punk) + { + } + + virtual ~CComObjectRoot () + { + } + + // IUnknown implementation support - these methods provide the + // basis upon which the IUnknown methods are built... + + ULONG InternalAddRef () + { + ULONG n = comSafeInc (&m_dwRefCount); + return n; + } + + ULONG InternalRelease () + { + ULONG n = comSafeDec (&m_dwRefCount); + + COMTRACK_UPDATE (); + + if (n) + return n; + + // Must delete this object, so we temporarily set its + // ref-count to 1 so we don't get circular destruction + // chains... + m_dwRefCount = 1; + + delete this; + return 0; + } + + protected: + long m_dwRefCount; // reference-count + IUnknown* m_pUnkOuter; // aggregating outer + + }; + +////////////////////////////////////////////////////////////////////////// +// +// CComClassFactory - implements IClassFactory to allow objects to +// be created at runtime... +// + +template class CComClassFactory + : public CComObjectRoot, + public IClassFactory + + { + + enum { singleton_factory=T::singleton }; + + public: + + CComClassFactory () {} + + // IUnknown implementation for class-factory + + ULONG STDMETHODCALLTYPE AddRef () + { return InternalAddRef (); } + + ULONG STDMETHODCALLTYPE Release () + { + ULONG result = InternalRelease (); + return result; + } + + HRESULT STDMETHODCALLTYPE QueryInterface (REFIID riid, void ** ppv) + { + if (! ppv) + return E_POINTER; + + if ((riid == IID_IClassFactory) || (riid == IID_IUnknown)) + { + *ppv = static_cast (this); + InternalAddRef (); + return S_OK; + } + + *ppv = 0; + return E_NOINTERFACE; + } + + + // IClassFactory implementation + HRESULT STDMETHODCALLTYPE CreateInstance + ( + IUnknown* pUnkOuter, + REFIID riid, + void** ppv + ); + + HRESULT STDMETHODCALLTYPE LockServer (BOOL bLock) + { return S_OK; } + + }; + +////////////////////////////////////////////////////////////////////////// +// +// CComCoClass - represents the 'coclass' or component-object +// itself. The 'coclass' represents the whole object, not any +// particular one of its exposed interfaces, and is only required when +// an object/class must be 'externally' createable via +// CoCreateinstance(). Hence, the functions required by +// CComClassFactory and the registration mechanism are wrapped in this +// template-class. It should be mixed in with the user's class when +// this functionality is required. +// + +template class CComCoClass + { + typedef CComClassFactory ClassFactory_t; + + public: + + static const CLSID& GetObjectCLSID () { return *pclsid; } + + // classObjectGet - gets the class' class-object (factory)... + static HRESULT classObjectGet + ( + REFCLSID clsid, + REFIID iid, + void** ppv + ) + + { + + // Validate CLSID + if (*pclsid != clsid) + return CLASS_E_CLASSNOTAVAILABLE; + + // Create new factory... + ClassFactory_t* pCF = new ClassFactory_t; + + // Bump up CF ref count to 1 + pCF->AddRef (); + + // QI for requested interface - if successful it will leave + // ref-count at 2, if not, then it will be 1 still... + HRESULT hr = pCF->QueryInterface (iid, ppv); + + // release one reference - if QI failed this will destroy the + // factory, but if successful will leave it around... + pCF->Release (); + + return hr; + } + + // classRegister - this function is used by the auto-registration + // macro AUTOREGISTER_COCLASS to add the CLSID to the Registry + static HRESULT classRegister + ( + VXDCOMPRIORITYSCHEME scheme, // priority scheme to use + int priority // priority - not used by all schemes + ) + { + int priorityToRegister; // prio to register is determined by sheme + + switch (scheme) + { + case PS_DEFAULT: + // Set priority to system default; ignore priority argument + priorityToRegister = g_defaultServerPriority; + break; + + case PS_SVR_ASSIGNED: + // Set priority to given priority + priorityToRegister = priority; + break; + + case PS_CLNT_PROPAGATED: + // Set priority to given priority for cases where the priority + // is not provided by the client (as in Win32). If the + // provided priority is < 0, then use the default system + // priority. + if (priority < 0) + priorityToRegister = g_defaultServerPriority; + else + { + if ((priority >=0) && (priority <=255)) + priorityToRegister = priority; + else + priorityToRegister = g_defaultServerPriority; + } + break; + + default: + // Unknown or unsupported priority scheme. Return an error. + return E_UNEXPECTED; + break; + } + + // Register the structure against the CLSID + return comClassRegister (*pclsid, + CLSCTX_INPROC_SERVER, + &classObjectGet, + scheme, + priorityToRegister); + } + + }; + + +////////////////////////////////////////////////////////////////////////// +// +// wotlQIHelper -- templated on the same implementation class as +// CComObject, this function provides a type-safe way of invoking +// the class' _qi_impl() method. +// + +template +HRESULT wotlQIHelper (T* pThis, REFIID riid, void** ppv) + { + return pThis->_qi_impl (riid, ppv); + } + +////////////////////////////////////////////////////////////////////////// +// +// CComObject - the main class for creating objects. The class 'T' +// must derive from CComObjectRoot (in order to gain an IUnknown +// implementation and other support functionality). +// + +template class CComObject : public T + { + public: + + // CreateInstance() creates a single instance, no aggregation, no + // specific COM interface... + static HRESULT CreateInstance (CComObject** pp); + + // CreateInstance - does the business of creating an instance of + // the class, and finding the requested interface on it... + static HRESULT CreateInstance + ( + IUnknown* punkOuter, + REFIID riid, + void** ppv + ) + { + // Validate args + if (!ppv) + return E_POINTER; + + // Create an instance (refcount will be zero) + CComObject* pObj = new CComObject; + if (! pObj) + return E_OUTOFMEMORY; + + // preset return value in case we fail to QI + *ppv = 0; + + // save aggregate IUnknown ptr + pObj->m_pUnkOuter = punkOuter; + + // QI for desired interface - if it fails, we must get rid of + // the recently-allocated instance before returning. If it + // succeeds, returned interface-ptr will have one ref... + HRESULT hr = pObj->_qi_impl (riid, ppv); + if (FAILED (hr)) + delete pObj; + + return hr; + } + + // over-ride the base-class 'internal_qi' method so we can + // implement QI via the COM_MAP macros... + HRESULT internal_qi (REFIID riid, void** ppv) + { + return _qi_impl (riid, ppv); + } + + // IUnknown implementation - these methods are used by each of the + // multiply-inherited base interfaces as their own IUnknown + // methods. + + ULONG STDMETHODCALLTYPE AddRef () + { + if (m_pUnkOuter) + return m_pUnkOuter->AddRef (); + return InternalAddRef (); + } + + ULONG STDMETHODCALLTYPE Release () + { + if (m_pUnkOuter) + return m_pUnkOuter->Release (); + return InternalRelease (); + } + + HRESULT STDMETHODCALLTYPE QueryInterface (REFIID riid, void ** ppv) + { + if (m_pUnkOuter) + return m_pUnkOuter->QueryInterface (riid, ppv); + return wotlQIHelper (this, riid, ppv); + } + + private: + static DWORD m_dwRegToken; + + }; + +template +HRESULT CComObject::CreateInstance (CComObject** pp) + { + if (0 != pp) + { + *pp = new CComObject (); + if (0 != *pp) + return S_OK; + + return E_OUTOFMEMORY; + } + + return E_POINTER; + } + +template DWORD CComObject::m_dwRegToken; + +template +HRESULT CComClassFactory::CreateInstance + ( + IUnknown* pUnkOuter, + REFIID riid, + void** ppv + ) + { + HRESULT hr; + static IUnknown* m_punkTheInstance = 0; + + if (singleton_factory) + { + if (pUnkOuter) + return CLASS_E_NOAGGREGATION; + + if (! m_punkTheInstance) + { + hr = CComObject::CreateInstance + (0, IID_IUnknown, (void**) &m_punkTheInstance); + if (FAILED (hr)) + return hr; + // This is a singleton so we will never want to delete it, + // therefore we increment the ref count. + AddRef (); + } + + return m_punkTheInstance->QueryInterface (riid, ppv); + } + + return CComObject::CreateInstance (pUnkOuter, riid, ppv); + } + + +////////////////////////////////////////////////////////////////////////// +// +// CComPtr -- a smart-ptr class (like that of ATL) for holding COM +// interface pointers, and performing automatic ref-counting. We don't +// provide the CComQIPtr class. +// + +template class CComPtr + { + Itf* m_ptr; + + public: + + CComPtr () : m_ptr (0) {} + + CComPtr (Itf* p) : m_ptr (p) + { + if (m_ptr) + m_ptr->AddRef (); + } + + CComPtr (const CComPtr& sp) : m_ptr (sp.m_ptr) + { + if (m_ptr) + m_ptr->AddRef (); + } + + ~CComPtr () + { + if (m_ptr) + m_ptr->Release (); + m_ptr = 0; + } + + void Release () + { + if (m_ptr) + m_ptr->Release (); + m_ptr = 0; + } + + operator Itf* () const + { + return m_ptr; + } + + Itf** operator& () + { + return &m_ptr; + } + + Itf* operator-> () + { + return m_ptr; + } + + const Itf* operator-> () const + { + return m_ptr; + } + + Itf* operator= (Itf* p) + { + if (p) + p->AddRef (); + if (m_ptr) + m_ptr->Release (); + m_ptr = p; + return m_ptr; + } + + Itf* operator= (const CComPtr& sp) + { + if (sp.m_ptr) + sp.m_ptr->AddRef (); + if (m_ptr) + m_ptr->Release (); + m_ptr = sp.m_ptr; + return m_ptr; + } + + bool operator! () const + { + return (m_ptr == 0); + } + + void Attach (Itf *p2) + { + if (0 != m_ptr) + { + m_ptr->Release (); + } + m_ptr = p2; + } + + Itf *Detach() + { + Itf *pt = m_ptr; + m_ptr = 0; + return pt; + } + + HRESULT CopyTo (Itf **ppT) + { + if (0 == ppT) + { + return E_POINTER; + } + *ppT = m_ptr; + if (0 != p) + { + p->AddRef (); + } + return S_OK; + } + }; + +/////////////////////////////////////////////////////////////////////// +// +// CComBSTR -- a class that wraps up the BSTR data type... +// + +class CComBSTR + { + BSTR m_str; + + public: + CComBSTR () : m_str (0) {} + + explicit CComBSTR (int nSize, LPCOLESTR sz = 0) + { + m_str = ::SysAllocStringLen (sz, nSize); + } + + CComBSTR (const char * pstr) + { + OLECHAR * wsz = new OLECHAR [(strlen (pstr) + 1) * 2]; + + comAsciiToWide (wsz, pstr, strlen (pstr) + 1); + + m_str = ::SysAllocString (wsz); + delete [] wsz; + } + + explicit CComBSTR (LPCOLESTR psz) + { + m_str = ::SysAllocString (psz); + } + + explicit CComBSTR (const CComBSTR& src) + { + m_str = src.Copy (); + } + + CComBSTR& operator= (const CComBSTR& cbs); + + CComBSTR& operator= (LPCOLESTR pSrc); + + ~CComBSTR() + { + Empty (); + } + + unsigned int Length () const + { + return ::SysStringLen (m_str); + } + + operator BSTR () const + { + return m_str; + } + + BSTR* operator& () + { + return &m_str; + } + + BSTR Copy() const + { + return ::SysAllocStringLen (m_str, ::SysStringLen (m_str)); + } + + void Attach (BSTR src) + { + m_str = src; + } + + BSTR Detach () + { + BSTR s = m_str; + m_str = 0; + return s; + } + + void Empty () + { + if (m_str) + ::SysFreeString (m_str); + m_str = 0; + } + + bool operator! () const + { + return (m_str == NULL); + } + + void Append (const CComBSTR& cbs) + { + Append (cbs.m_str, ::SysStringLen (cbs.m_str)); + } + + void Append (LPCOLESTR lpsz) + { + Append (lpsz, ::comWideStrLen (lpsz)); + } + + void AppendBSTR (BSTR bs) + { + Append (bs, ::SysStringLen (bs)); + } + + void Append (LPCOLESTR lpsz, int nLen); + + CComBSTR& operator+= (const CComBSTR& cbs) + { + AppendBSTR (cbs.m_str); + return *this; + } + }; + +////////////////////////////////////////////////////////////////////////// +// +// CComVariant support +// + + +class CComVariant : public tagVARIANT +{ +// Constructors +public: + CComVariant() + { + ::VariantInit(this); + } + ~CComVariant() + { + Clear(); + } + + CComVariant(const VARIANT& varSrc) + { + ::VariantInit(this); + InternalCopy(&varSrc); + } + + CComVariant(const CComVariant& varSrc) + { + ::VariantInit(this); + InternalCopy(&varSrc); + } + + CComVariant(BSTR bstrSrc) + { + ::VariantInit(this); + *this = bstrSrc; + } + + CComVariant(LPCOLESTR lpszSrc) + { + ::VariantInit(this); + *this = lpszSrc; + } + + CComVariant(bool bSrc) + { + ::VariantInit(this); + vt = VT_BOOL; + boolVal = bSrc ? VARIANT_TRUE : VARIANT_FALSE; + } + + CComVariant(int nSrc) + { + ::VariantInit(this); + vt = VT_I4; + lVal = nSrc; + } + + CComVariant(BYTE nSrc) + { + ::VariantInit(this); + vt = VT_UI1; + bVal = nSrc; + } + + CComVariant(short nSrc) + { + ::VariantInit(this); + vt = VT_I2; + iVal = nSrc; + } + + CComVariant(long nSrc, VARTYPE vtSrc = VT_I4) + { + ::VariantInit(this); + vt = vtSrc; + lVal = nSrc; + } + + CComVariant(float fltSrc) + { + ::VariantInit(this); + vt = VT_R4; + fltVal = fltSrc; + } + + CComVariant(double dblSrc) + { + ::VariantInit(this); + vt = VT_R8; + dblVal = dblSrc; + } + + CComVariant(CY cySrc) + { + ::VariantInit(this); + vt = VT_CY; + cyVal = cySrc; + } + + CComVariant(IUnknown* pSrc) + { + ::VariantInit(this); + vt = VT_UNKNOWN; + punkVal = pSrc; + if (punkVal != NULL) + { + punkVal->AddRef(); + } + } + + CComVariant& operator=(const CComVariant& varSrc) + { + InternalCopy(&varSrc); + return *this; + } + + CComVariant& operator=(const VARIANT& varSrc) + { + InternalCopy(&varSrc); + return *this; + } + + CComVariant& operator=(BSTR bstrSrc); + CComVariant& operator=(LPCOLESTR lpszSrc); + + CComVariant& operator=(bool bSrc); + CComVariant& operator=(int nSrc); + CComVariant& operator=(BYTE nSrc); + CComVariant& operator=(short nSrc); + CComVariant& operator=(long nSrc); + CComVariant& operator=(float fltSrc); + CComVariant& operator=(double dblSrc); + CComVariant& operator=(CY cySrc); + + CComVariant& operator=(IUnknown* pSrc); + + bool operator==(const VARIANT& varSrc); + bool operator!=(const VARIANT& varSrc) {return !operator==(varSrc);} + + HRESULT Clear() + { + return ::VariantClear(this); + } + + HRESULT Copy(const VARIANT* pSrc) + { + return ::VariantCopy(this, const_cast(pSrc)); + } + + HRESULT Attach(VARIANT* pSrc); + HRESULT Detach(VARIANT* pDest); + HRESULT ChangeType(VARTYPE vtNew, const VARIANT* pSrc = NULL); + + HRESULT InternalClear(); + void InternalCopy(const VARIANT* pSrc); +}; + + +////////////////////////////////////////////////////////////////////////// +// +// Macros for making QueryInterface work. +// +// The COM_MAP macros define a function called _qi_impl() which does +// runtime casts to obtain the requested interface pointer. +// +// Other than that, the layout of the COM_MAP in the user's class is +// identical to an ATL map, but only allows for COM_INTERFACE_ENTRY +// and COM_INTERFACE_ENTRY_IID entries, not any of the other more +// fanciful types. +// +// The default IUnknown is always the first COM_INTERFACE_ENTRY in the +// table, so (by definition) this must be derived from IUnknown or the +// static_cast() will fail... +// + +#define BEGIN_COM_MAP(cls) HRESULT _qi_impl (REFIID riid, void** ppv) { \ + COMTRACK_ADD_CLS(cls); + +#define COM_INTERFACE_ENTRY(itf) \ + if (ppv == NULL) \ + {COMTRACK_ADD_IID (itf);} else { \ + if ((IID_##itf == riid) || (IID_IUnknown == riid)) { \ + *ppv = static_cast (this); \ + InternalAddRef (); \ + COMTRACK_UPDATE (); \ + return S_OK; } } + +#define COM_INTERFACE_ENTRY_IID(iid,itf) \ + if (ppv == NULL) \ + {COMTRACK_ADD_IID (itf);} else { \ + if (riid == iid) { \ + *ppv = static_cast (this); \ + InternalAddRef (); \ + COMTRACK_UPDATE (); \ + return S_OK; }} + +#define END_COM_MAP() \ + if (ppv != 0) *ppv = 0; \ + return E_NOINTERFACE; } + +////////////////////////////////////////////////////////////////////////// +// +// AUTOREGISTER_COCLASS(cls,name) +// +// This macro must be included in the object-implementation C++ source +// file after the object's class definition. It associates the C++ +// class 'cls' with the CLSID and registers the module +// name in the VxRegistry, against the object's CLSID. +// +////////////////////////////////////////////////////////////////////////// + +#define AUTOREGISTER_COCLASS(cls,priorityScheme, priority) \ + struct cls ## _autoreg { \ + cls ## _autoreg () { \ + CComObject::classRegister (priorityScheme, \ + priority); } }; \ + static cls ## _autoreg __autoreg_ ## cls; + + +////////////////////////////////////////////////////////////////////////// +// +// BEGIN_COCLASS_TABLE, EXPORT_COCLASS, END_COCLASS_TABLE +// +// Macros for exporting coclasses from shared-libraries. They should +// be used like so:- +// +// BEGIN_COCLASS_TABLE +// EXPORT_COCLASS(CoMyClass) +// END_COCLASS_TABLE +// +// where CoMyClass is a coclass (i.e. inherits CComCoClass) and thus +// has a static method 'classObjectGet' conforming to the typedef +// PFN_GETCLASSOBJECT as defined in comCoreLib.h +// +////////////////////////////////////////////////////////////////////////// + +#define BEGIN_COCLASS_TABLE \ +extern "C" HRESULT DllGetClassObject \ + (REFCLSID clsid, REFIID iid, void** ppv) { + +#define EXPORT_COCLASS(coclass) \ + if (clsid == coclass::GetObjectCLSID ()) \ + { return coclass::classObjectGet (clsid, iid, ppv); } + +#define END_COCLASS_TABLE \ + return CLASS_E_CLASSNOTAVAILABLE; } + +#endif /* __INCcomObjLib_h__ */ + + + + diff --git a/h/comObjLibExt.h b/h/comObjLibExt.h new file mode 100644 index 0000000..a4e5c00 --- /dev/null +++ b/h/comObjLibExt.h @@ -0,0 +1,206 @@ +/* comObjLibExt.h - VxCOM Embeded Extensions to comObjLib.h */ + +/* Copyright (c) 2001 Wind River Systems, Inc. */ + +/* + +modification history +-------------------- +01d,03jan02,nel Remove references to T2OLE and OLE2T. +01c,09aug01,nel Add wide string conversion. +01b,07aug01,nel Add extra methods to VxComBSTR to allow creation from numeric + values. +01a,23jul01,nel created + +*/ + +/* + + DESCRIPTION: + + This file provides VxWorks specific extensions to the existing ATL like + classes defined in comObjLib.h + +*/ + + +#ifndef __INCcomObjLibExt_h__ +#define __INCcomObjLibExt_h__ + +#include +#include + +class VxComBSTR : public CComBSTR + { + public: + + VxComBSTR () : CComBSTR () + { + m_text = NULL; + } + + explicit VxComBSTR (int nSize, LPCOLESTR sz = 0) : CComBSTR (nSize, sz) + { + m_text = NULL; + } + + explicit VxComBSTR (const char * pstr) : CComBSTR (pstr) + { + m_text = NULL; + } + + explicit VxComBSTR (LPCOLESTR psz) : CComBSTR (psz) + { + m_text = NULL; + } + + explicit VxComBSTR (const CComBSTR& src) : CComBSTR (src) + { + m_text = NULL; + } + + explicit VxComBSTR (DWORD src) : CComBSTR () + { + m_text = NULL; + *this = src; + } + + explicit VxComBSTR (DOUBLE src) : CComBSTR () + { + m_text = NULL; + *this = src; + } + + ~VxComBSTR () + { + if (m_text != NULL) + { + delete []m_text; + m_text = NULL; + } + } + + operator char * () + { + char * ptr; + + if (m_text != NULL) + { + delete []m_text; + m_text = NULL; + } + + if ((BSTR)(*this) == NULL) + { + return NULL; + } + +#ifdef _WIN32 + m_text = new char [wcslen ((BSTR)(*this)) + 1]; +#else + m_text = new char [comWideStrLen ((BSTR)(*this)) + 1]; +#endif + if (m_text == NULL) return NULL; +#ifdef _WIN32 + wcstombs (m_text, (BSTR)(*this), wcslen ((BSTR)(*this)) + 1); +#else + comWideToAscii (m_text, (BSTR)(*this), comWideStrLen ((BSTR)(*this)) + 1); +#endif + return m_text; + } + + operator DWORD () + { + return (DWORD)atol (*this); + } + + VxComBSTR& operator = (const DWORD& src) + { + if (m_text) + { + delete []m_text; + m_text = NULL; + } + char buffer [32]; + sprintf (buffer, "%ld", src); + *this = buffer; + return *this; + } + + void SetHex (const DWORD src) + { + if (m_text) + { + delete []m_text; + m_text = NULL; + } + char buffer [32]; + sprintf (buffer, "%lX", src); + *this = buffer; + } + + VxComBSTR& operator = (const DOUBLE& src) + { + if (m_text) + { + delete []m_text; + m_text = NULL; + } + char buffer [32]; + sprintf (buffer, "%f", src); + *this = buffer; + return *this; + } + + VxComBSTR& operator = (const char * src) + { + if (m_text) + { + delete []m_text; + m_text = NULL; + } + OLECHAR * wStr = new OLECHAR [(strlen (src) + 1)]; +#ifdef _WIN32 + mbstowcs (wStr, src, strlen (src) + 1); +#else + comAsciiToWide (wStr, src, strlen (src) + 1); +#endif + *((CComBSTR *)this) = wStr; + delete []wStr; + return *this; + } + + bool const operator == (const VxComBSTR& src) + { + long int i; + + if (Length () != src.Length ()) + { + return false; + } + + for (i = 0; i < (long int)Length (); i++) + { + if (((BSTR)(*this)) [i] != ((BSTR)src)[i]) + { + return false; + } + } + return true; + } + + bool const operator != (const VxComBSTR& src) + { + return !(*this == src); + } + + private: + + char * m_text; + }; + +#endif + + + + diff --git a/h/comShow.h b/h/comShow.h new file mode 100644 index 0000000..ee948ba --- /dev/null +++ b/h/comShow.h @@ -0,0 +1,120 @@ +/* comShow.h - VxWorks COM show routines public API */ + +/* Copyright (c) 1999 Wind River Systems, Inc. */ + +/* + +modification history +-------------------- +01d,04oct01,nel Correct comTrackShow def with and extern "C". +01c,25sep01,nel Add method to translate a guid to a string. +01b,06mar00,nel Added VxComTrack class +01a,24mar99,drm created + +*/ + +/* + + DESCRIPTION: + + */ + +#ifndef __INCcomShow_h +#define __INCcomShow_h + +#include "vxidl.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int vxcomRegShow(); +int comTrackShow (); + +#ifdef __cplusplus + } +#endif + +class VxComTrack + { + public: + VxComTrack (); + + ~VxComTrack (); + + void * addClassInstance + ( + void * thisPtr, + char * guid, + char * name, + unsigned long refCount, + REFCLSID iid + ); + + void updateClassInstance + ( + void * thisPtr, + unsigned long refCount + ); + + void addInterface + ( + void * thisPtr, + char * guid, + char * name, + REFIID cls + ); + + int print (); + + const char * findGUID (REFGUID guid); + + static VxComTrack * theInstance (); + + class INTERFACE + { + public: + INTERFACE * next; + INTERFACE * listNext; + INTERFACE * listPrev; + char * guid; + char * name; + unsigned long owner; + unsigned long magic1; + void * thisPtr; + IID iid; /* added here to not break T3 inspector */ + }; + + class CLASS + { + public: + CLASS * next; + CLASS * prev; + void * thisPtr; + char * guid; + char * name; + unsigned long refCount; + unsigned long owner; + INTERFACE * interfaces; + unsigned long magic1; + CLSID cls; /* added here to not break T3 inspector */ + }; + + private: + enum { MAGIC1 = 0x5aa5aa55 }; + + static VxComTrack * s_pTheList; + + CLASS * findClass (void * thisPtr); + + INTERFACE * findInterface + ( + CLASS * classPtr, + char * guid + ); + + }; + +#endif + + diff --git a/h/common.h b/h/common.h new file mode 100644 index 0000000..07248aa --- /dev/null +++ b/h/common.h @@ -0,0 +1,109 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/vxworks/common.h,v 1.3 2003/01/15 14:00:28 josh Exp $ */ + + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + +/* + * + * Copyright 1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + * + */ + +/* + * $Log: common.h,v $ + * Revision 1.3 2003/01/15 14:00:28 josh + * directory structure shifting + * + * Revision 1.2 2001/11/07 14:26:53 tneale + * Added wm to include path + * + * Revision 1.1.1.1 2001/11/05 17:47:17 tneale + * Tornado shuffle + * + * Revision 1.3 2000/02/04 21:49:29 josh + * modified header files for clean builds of vxWorks demo + * + * Revision 1.2 2000/01/28 23:09:25 josh + * make sure we're really using memcmp() when we intend to + * + * Revision 1.1 2000/01/27 18:25:29 josh + * initial checkin of porting files for vxWorks + * + * + */ + +/* +modification history +------------------- +01b,19apr05,job update copyright notices +01a,06oct04,job draw processor alignment from vxWorks header files +*/ + +#include + +#include + +#ifdef INSTALL_ON_BIG_ENDIAN +#undef INSTALL_ON_BIG_ENDIAN +#endif + +#ifdef INSTALL_ON_LITTLE_ENDIAN +#undef INSTALL_ON_LITTLE_ENDIAN +#endif + +#if (_BYTE_ORDER == _BIG_ENDIAN) +#define INSTALL_ON_BIG_ENDIAN 1 +#define INSTALL_ON_LITTLE_ENDIAN 0 +#elif (_BYTE_ORDER == _LITTLE_ENDIAN) +#define INSTALL_ON_LITTLE_ENDIAN 1 +#define INSTALL_ON_BIT_ENDIAN 0 +#endif + +#ifdef CONFIG_PREAMBLE + +/* This is a sample of how one might use the BUG() macros for simple + * debugging. You can almost certainly do better than this, see the + * comments in common/h/bug.h for details. This definition suffices + * for simple (and very verbose) debugging. + */ + +#if 0 && defined(INSTALL_BUG) && INSTALL_BUG + +#define BUG_OUT stdout + +#define BUG(w,x,y,z) \ + do {\ + fprintf z;\ + fprintf (BUG_OUT, "\n");\ + if ((x) == BUG_FATAL)\ + t_suspend(0L);\ + } while (0) + +#include + +#endif /* defined(INSTALL_BUG) && INSTALL_BUG */ + +/* + * Fun with our new run-time debugging facility. + * This is still experimental, and defaults to uninstalled. + */ +#if defined(INSTALL_SNARK_BUG_CONF) && INSTALL_SNARK_BUG_CONF +#include +#endif + +#else /* CONFIG_PREAMBLE */ + +#define GLUE_ALLOC(x) ((void *) malloc(x)) +#define GLUE_FREE(x) free((char *) (x)) +#define GLUE_NOW() glue_now() + +#endif /* CONFIG_PREAMBLE */ diff --git a/h/connLib.h b/h/connLib.h new file mode 100644 index 0000000..77b27de --- /dev/null +++ b/h/connLib.h @@ -0,0 +1,34 @@ +/* connLib.h - target buffer connection library header */ + +/* Copyright 1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,10dec93,smb written. +*/ + +#ifndef __INCconnLibh +#define __INCconnLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) || defined(__cplusplus) + +extern void connRtnSet (FUNCPTR initRtn, VOIDFUNCPTR closeRtn, + VOIDFUNCPTR errorRtn, VOIDFUNCPTR dataTransferRtn); + +#else /* __STDC__ */ + +extern void connRtnSet (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCconnLibh */ + diff --git a/h/coprocLib.h b/h/coprocLib.h new file mode 100644 index 0000000..9ac0a03 --- /dev/null +++ b/h/coprocLib.h @@ -0,0 +1,78 @@ +/* coprocLib.h - coprocessor management library header */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01e,02oct04,yvp Added prototypes for coprocCtxReplicate and coprocMRegs. +01d,16feb04,yvp Prototype change for coprocTaskRegsShow(). +01c,26nov03,yvp Added coprocCtxStorageSizeGet() + cleanup. +01b,02may03,pes Add prototype for coprocShowInit(). +01a,21mar03,yvp written. +*/ + +#ifndef __INCcoprocLibh +#define __INCcoprocLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "taskLib.h" + +/* defines */ + +#define COPROCS_MAX 8 /* Max. number of coprocessors per task */ + +/* Coprocessor option bits occupy the upper 8 bits of the task option word */ + +#define COPROC_FIELD_MASK \ + (VX_COPROC1_TASK | VX_COPROC2_TASK | VX_COPROC3_TASK | VX_COPROC4_TASK | \ + VX_COPROC5_TASK | VX_COPROC6_TASK | VX_COPROC7_TASK | VX_COPROC8_TASK ) + +#define COPROCS_ALL COPROC_FIELD_MASK + +/* generic status codes */ + +#define S_coprocLib_ALLOC_FAILED (M_coprocLib | 1) +#define S_coprocLib_COPROC_ENABLE_FAILED (M_coprocLib | 2) +#define S_coprocLib_COPROC_DISABLE_FAILED (M_coprocLib | 3) +#define S_coprocLib_EXCHANDLER_REGISTER_FAILED (M_coprocLib | 4) +#define S_coprocLib_HOOK_ATTACH_FAILED (M_coprocLib | 5) +#define S_coprocLib_INVALID_ARGUMENT (M_coprocLib | 6) +#define S_coprocLib_INVALID_OPERATION (M_coprocLib | 7) +#define S_coprocLib_NO_COPROC_SUPPORT (M_coprocLib | 8) + +#ifndef _ASMLANGUAGE + +/* function declarations */ + +STATUS coprocLibInit (void); +void coprocShowInit (void); +STATUS coprocEnable (int); +STATUS coprocDisable (int); +void coprocTaskCreateHook (WIND_TCB *); +void coprocTaskDeleteHook (WIND_TCB *); +void coprocTaskSwapHook (WIND_TCB *, WIND_TCB *); +STATUS coprocTaskRegsGet (int, int, void *); +STATUS coprocTaskRegsSet (int, int, void *); +int coprocCtxStorageSizeGet (int); +int coprocShowOnDebug (BOOL, int); +void coprocSave (int); +void coprocShow (void); +void coprocTaskRegsShow (int, int); +void * coprocCtxReplicate (int, int); +STATUS coprocMRegs (int, char *, BOOL *); +void coprocRegListShow (void); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcoprocLibh */ diff --git a/h/copyright_wrs.h b/h/copyright_wrs.h new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/h/copyright_wrs.h @@ -0,0 +1 @@ + diff --git a/h/coreDumpLib.h b/h/coreDumpLib.h new file mode 100644 index 0000000..636ab87 --- /dev/null +++ b/h/coreDumpLib.h @@ -0,0 +1,162 @@ +/* coreDumpLib.h - core dump interface header */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01k,09sep05,jmp updated core dump types. +01j,02sep05,jmp renamed coreDumpFormat() into coreDumpDevFormat(). + added S_coreDumpLib_CORE_DUMP_FILTER_NOT_FOUND. +01i,22aug05,dbt Added coreDumpOpen() & coreDumpClose() prototypes. Updated + coreDumpRead() prototype. +01h,11aug05,dbt Added valid & errnoVal fields in CORE_DUMP_INFO structure. + Added device size in CORE_DUMP_RAW_DEV_DESC structure. + Added coreDumpDevShow() prototype. +01g,11aug05,dbt Added coreDumpUsrGenerate() & coreDumpMemDump() prototypes; + removed coreDumpGenerate(). +01f,05aug05,jmp added CORE_DUMP_RAW_DEV, moved some definitions to + private/coreDumpLibP.h. +01e,04aug05,jmp added more errnos. +01d,03aug05,dbt Added errnos & additional APIs. +01c,29jul05,jmp added core dump memory filtering. +01b,18jul05,jmp updated CORE_DUMP_INFO structure. +01a,29jun05,jmp splited & cleanup. +01a,22mar05,jmp written. +*/ + +#ifndef __INCcoreDumpLibh +#define __INCcoreDumpLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include +#ifndef HOST +#include +#include +#include +#include +#include +#endif /* !HOST */ + +/* defines */ + +/* generic status codes */ + +#ifndef HOST +#define S_coreDumpLib_CORE_DUMP_HOOK_TABLE_FULL (M_coreDumpLib | 1) +#define S_coreDumpLib_CORE_DUMP_HOOK_NOT_FOUND (M_coreDumpLib | 2) +#define S_coreDumpLib_CORE_DUMP_INVALID_DEVICE (M_coreDumpLib | 3) +#define S_coreDumpLib_CORE_DUMP_DEVICE_READ_ERROR (M_coreDumpLib | 4) +#define S_coreDumpLib_CORE_DUMP_DEVICE_WRITE_ERROR (M_coreDumpLib | 5) +#define S_coreDumpLib_CORE_DUMP_DEVICE_ERASE_ERROR (M_coreDumpLib | 6) +#define S_coreDumpLib_CORE_DUMP_DEVICE_OPEN_ERROR (M_coreDumpLib | 7) +#define S_coreDumpLib_CORE_DUMP_DEVICE_CLOSE_ERROR (M_coreDumpLib | 8) +#define S_coreDumpLib_CORE_DUMP_INVALID_ARGS (M_coreDumpLib | 9) +#define S_coreDumpLib_CORE_DUMP_INVALID_CORE_DUMP (M_coreDumpLib | 10) +#define S_coreDumpLib_CORE_DUMP_STORAGE_NOT_FORMATED (M_coreDumpLib | 11) +#define S_coreDumpLib_CORE_DUMP_DEVICE_NOT_INITIALIZED (M_coreDumpLib | 12) +#define S_coreDumpLib_CORE_DUMP_TOO_MANY_CORE_DUMP (M_coreDumpLib | 13) +#define S_coreDumpLib_CORE_DUMP_COMPRESSION_ERROR (M_coreDumpLib | 14) +#define S_coreDumpLib_CORE_DUMP_FILTER_TABLE_FULL (M_coreDumpLib | 15) +#define S_coreDumpLib_CORE_DUMP_GENERATE_ALREADY_RUNNING (M_coreDumpLib | 16) +#define S_coreDumpLib_CORE_DUMP_PATH_TOO_LONG (M_coreDumpLib | 17) +#define S_coreDumpLib_CORE_DUMP_GENERATE_NOT_RUNNING (M_coreDumpLib | 18) +#define S_coreDumpLib_CORE_DUMP_DEVICE_TOO_SMALL (M_coreDumpLib | 19) +#define S_coreDumpLib_CORE_DUMP_FILTER_NOT_FOUND (M_coreDumpLib | 20) +#endif /* !HOST */ + +/* core dump info macros */ + +#define MAX_CORE_DUMP_LEN 20 /* max len for core dump name */ +#define MAX_NAME_LENGTH 256 /* max length for RTP or task */ + +/* typedefs */ + +/* core dump types */ + +typedef enum /* CORE_DUMP_TYPE */ + { + CORE_DUMP_USER, /* 0: user coredump (on-demand) */ + CORE_DUMP_KERNEL_INIT, /* 1: fatal error during kernel intialization */ + CORE_DUMP_INTERRUPT, /* 2: error in a VxWorks interrupt handler */ + CORE_DUMP_KERNEL_PANIC, /* 3: kernel panic */ + CORE_DUMP_KERNEL_TASK, /* 4: kernel task error */ + CORE_DUMP_RTP, /* 5: process coredump */ + CORE_DUMP_KERNEL /* 6: VxWorks kernel error */ + } CORE_DUMP_TYPE; + +typedef struct core_dump_desc * CORE_DUMP_ID; /* core dump descriptor */ + +typedef struct core_dump_info /* core dump information */ + { + UINT32 coreDumpIndex; /* core dump index */ + BOOL valid; /* core dump is valid? */ + UINT32 errnoVal; /* core dump errno */ + char name[MAX_CORE_DUMP_LEN];/* name of the core dump */ + size_t size; /* size of the core dump */ + CORE_DUMP_TYPE type; /* origin of the core dump */ + int taskId; /* task Id (for kernel core dump) */ + char taskName [MAX_NAME_LENGTH]; /* name of task */ + UINT32 rtpId; /* process Id (for process core dump) */ + char rtpName [MAX_NAME_LENGTH]; /* path to RTP */ + int excNum; /* exception number (Not valid for */ + /* on-demand & workQPanic) */ + UINT32 pc; /* program counter */ + UINT32 sp; /* stack pointer */ + UINT32 fp; /* frame pointer */ + time_t time; /* core dump generation calendar time */ + UINT32 ticks; /* VxWorks time stamp */ + } CORE_DUMP_INFO; + +typedef struct core_dump_raw_dev_desc /* coredump raw device descriptor */ + { + UINT32 devWrtBlkSize; /* device write block size */ + void * deviceId; /* device ID used for various rtns */ + size_t size; /* device size */ + char * pDevWrtBlkCache; /* device write cache buffer */ + FUNCPTR pDevEraseRtn; /* device erase() routine */ + FUNCPTR pDevWriteRtn; /* device write() routine */ + FUNCPTR pDevReadRtn; /* device read() routine */ + FUNCPTR pDevFlushRtn; /* device flush() routine */ + } CORE_DUMP_RAW_DEV_DESC; + +/* externals */ + +#ifndef HOST +extern STATUS coreDumpDevFormat (UINT32 coreDumpMax); +extern BOOL coreDumpIsAvailable (void); +extern STATUS coreDumpNextGet (UINT32 currentIx, + UINT32 * pNextIx); +extern CORE_DUMP_INFO * coreDumpInfoGet (UINT32 coreDumpIndex); +extern CORE_DUMP_ID coreDumpOpen (UINT32 coreDumpIx); +extern STATUS coreDumpClose (CORE_DUMP_ID coreDumpId); +extern int coreDumpRead (CORE_DUMP_ID coreDumpId, + void * buffer, size_t size); +extern STATUS coreDumpShowInit (void); +extern STATUS coreDumpShow (UINT32 coreDumpIndex, UINT32 level); +extern STATUS coreDumpDevShow (void); +extern STATUS coreDumpMemFilterAdd (void * addr, size_t size); +extern STATUS coreDumpMemFilterDelete (void * addr, size_t size); +extern STATUS coreDumpCreateHookAdd (FUNCPTR createHook); +extern STATUS coreDumpCreateHookDelete(FUNCPTR createHook); +extern STATUS coreDumpUsrGenerate (void); +extern STATUS coreDumpMemDump (void * addr, size_t size, + void * destAddr); +#endif /* !HOST */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcoreDumpLibh */ diff --git a/h/cplusLib.h b/h/cplusLib.h new file mode 100644 index 0000000..661a14f --- /dev/null +++ b/h/cplusLib.h @@ -0,0 +1,54 @@ +/* cplusLib.h - VxWorks C++ support */ + +/* Copyright 1992,1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,11oct04,jn Add cplusXtorGet routine +01d,14apr03,sn include demanglerTypes.h rather than duplicating definitions +01c,07dec01,sn added demangler declarations +01b,26apr93,srh added cplus?torsLink declarations. +01a,01jan93,srh written. +*/ + +#ifndef __INCcplusLibh +#define __INCcplusLibh + +#include "private/cplusLibP.h" +#include "demanglerTypes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +void cplusCtors (const char * moduleName); +void cplusDtors (const char * moduleName); +void cplusCtorsLink (); +void cplusDtorsLink (); +void cplusDemanglerSet (int mode); +void cplusDemanglerStyleSet (DEMANGLER_STYLE style); +void cplusXtorSet (int strategy); +int cplusXtorGet (); + +#else /* __STDC__ */ + +void cplusCtors (); +void cplusDtors (); +void cplusCtorsLink (); +void cplusDtorsLink (); +void cplusDemanglerSet (); +void cplusXtorSet (); +int cplusXtorGet (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcplusLibh */ diff --git a/h/cpuPwrLib.h b/h/cpuPwrLib.h new file mode 100644 index 0000000..4810267 --- /dev/null +++ b/h/cpuPwrLib.h @@ -0,0 +1,136 @@ +/* cpuPwrLib.h - CPU Power Management framework header file */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01c,08sep05,mmi added light power manager and set/get status API's +01b,27aug05,mmi mods for not breaking other IA32 +01a,05Aug05,mmi created +*/ + +/* +* DESCRIPTION +* This header contains the datatype and prototype declarations for cpu +* power framework management +*/ + +#ifndef __INCcpuPwrLibh +#define __INCcpuPwrLibh + + +#ifdef __cplusplus +extern "C" { +#endif + +#undef DEBUG_CPU_PWR_MGMT /* define this to turn on debugging */ + +/* Defines for CPU power framework events */ + +#define CPU_PWR_EVENT_INT_ENTER (0x00000001) +#define CPU_PWR_EVENT_INT_EXIT (0x00000002) +#define CPU_PWR_EVENT_IDLE_ENTER (0x00000004) +#define CPU_PWR_EVENT_IDLE_EXIT (0x00000008) +#define CPU_PWR_EVENT_TASK_SWITCH (0x00000010) +#define CPU_PWR_EVENT_CPU_UTIL (0x00000020) +#define CPU_PWR_EVENT_THRES_CROSS (0x00000040) +#define CPU_PWR_EVENT_PRIO_CHANGE (0x00000080) + + +/* +* CPU power C-states in the power management framework. Its defined as follows +*/ + +typedef enum cpuPwrCState + { + cpuPwrC0State = 0, + cpuPwrC1State = 1, + cpuPwrC2State = 2, + cpuPwrC3State = 3, + cpuPwrC4State = 4, + cpuPwrC5State = 5, + cpuPwrCStateError = 6 +} CPU_PWR_C_STATE; + +/* + * CPU power P-states in the power management framework. Its defined as follows + */ + +typedef enum cpuPwrPState + { + cpuPwrCurrentTaskPState = 0, + cpuPwrP0State = 1, + cpuPwrP1State = 2, + cpuPwrP2State = 3, + cpuPwrP3State = 4, + cpuPwrP4State = 5, + cpuPwrP5State = 6, + cpuPwrP6State = 7, + cpuPwrPStateError = 8 +} CPU_PWR_P_STATE; + +/* + * Thermal interrupt defines + */ + +typedef enum cpuPwrThermIntType + { + cpuPwrThermIntHot = 0, + cpuPwrThermIntCold = 1 + } CPU_PWR_THERM_INT_TYPE; + +/* + * Type of Period that may expire the CPU utilization power manager + */ + +typedef enum cpuPwrUtilPeriod + { + cpuPwrPeriod1 = 0, + cpuPwrPeriod2 = 1 + } CPU_PWR_UTIL_PERIOD; + +typedef struct cpuPwrEventHandlers + { + FUNCPTR intEnterRtn; /* CPU_PWR_EVENT_INT_ENTER */ + UINT intEnterRtnArg; /* Arg passed to intEnterRtn */ + FUNCPTR intExitRtn; /* CPU_PWR_EVENT_INT_EXIT */ + UINT intExitRtnArg; /* Arg passed to intExitRtn */ + FUNCPTR idleEnterRtn; /* CPU_PWR_EVENT_IDLE_ENTER */ + UINT idleEnterRtnArg; /* Arg passed to idleEnterRtn */ + FUNCPTR idleExitRtn; /* CPU_PWR_EVENT_IDLE_EXIT */ + UINT idleExitRtnArg; /* Arg passed to idleExitRtn */ + FUNCPTR taskSwitchRtn; /* CPU_PWR_EVENT_TASK_SWITCH */ + FUNCPTR cpuUtilRtn; /* CPU_PWR_EVENT_CPU_UTIL */ + /* event handler */ + FUNCPTR threshCrossRtn; /* CPU_PWR_EVENT_THRESH_CROSS */ + /* event handler */ + FUNCPTR priChangeRtn; /* CPU_PWR_EVENT_PRIORITY_CHANGE */ + } CPU_PWR_EVENT_HANDLERS, * CPU_PWR_EVENT_HANDLERS_PTR ; + +/* Function prototypes */ + +extern STATUS cpuPwrEventHandlersSet (CPU_PWR_EVENT_HANDLERS_PTR); +extern STATUS cpuPwrCStateSet (CPU_PWR_C_STATE); +extern STATUS cpuPwrPStateSet (CPU_PWR_P_STATE); +extern CPU_PWR_P_STATE cpuPwrPStateGet (void ); +extern STATUS cpuPwrTaskPStateSet (int, CPU_PWR_P_STATE); +extern CPU_PWR_P_STATE cpuPwrTaskPStateGet (int ); +extern STATUS cpuPwrTempThreshSet (int, int); +extern STATUS cpuPwrTempThreshGet (int *, int * ); +extern STATUS cpuPwrUtilPeriodSet (UINT, UINT ); +extern BOOL cpuPwrSrcCheck (void); +extern BOOL cpuPwrCheckHotRtn (void); +extern void cpuPwrThermIntConnect (VOIDFUNCPTR *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcpuPwrLibh */ diff --git a/h/cpuPwrMgr.h b/h/cpuPwrMgr.h new file mode 100644 index 0000000..d62dd9e --- /dev/null +++ b/h/cpuPwrMgr.h @@ -0,0 +1,47 @@ +/* cpuPwrMgr.h - CPU power Manager library header file */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- + +01a,04sep05,mmi created +*/ + +#ifndef __INCcpuPwrMrgh +#define __INCcpuPwrMgrh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* typedef's */ + +/* function prototypes */ + +/* Routines to Enable/Disable CPU power Manager */ + +extern BOOL cpuPwrMgrIsEnabled (void); +extern STATUS cpuPwrMgrEnable (BOOL enable); + +/* Initialization routines */ + +extern STATUS cpuPwrLightMgrInit (void); +extern STATUS cpuPwrUtilMgrInit (UINT8, UINT8); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcpuPwrMgr */ + + diff --git a/h/ctype.h b/h/ctype.h new file mode 100644 index 0000000..ea80f2c --- /dev/null +++ b/h/ctype.h @@ -0,0 +1,122 @@ +/* ctype.h - ANSI standard ctype functions header */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,18mar04,mcm Fix for SPR 95066 - moving isascii/toascii from vxWorks.h +01i,24mar04,sn fixed __toupper and __tolower to only evaluate arg once +01h,30nov01,f_b Remove is*() macros when compiling in C++ mode +01g,19aug93,dvs added outside parens for __toupper & __tolower (SPR #2340) +01f,25jan93,smb added __STDC__ wrapper for __ctype table, SPR 1924. +01e,22sep92,rrr added support for c++ +01d,19aug92,smb fixed SPR #1471, toupper & tolower checks for valid argument. +01d,11jul92,smb reversed order of function decl. and defines. +01c,11jul92,smb added __STDC__. +01b,04jul92,jcf cleaned up. +01a,03jul92,smb written +*/ + +#ifndef __INCctypeh +#define __INCctypeh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types/vxANSI.h" + +#if defined(__STDC__) || defined(__cplusplus) + +extern int isalnum(int __c); +extern int isalpha(int __c); +extern int iscntrl(int __c); +extern int isdigit(int __c); +extern int isgraph(int __c); +extern int islower(int __c); +extern int isprint(int __c); +extern int ispunct(int __c); +extern int isspace(int __c); +extern int isupper(int __c); +extern int isxdigit(int __c); +extern int tolower(int __c); +extern int toupper(int __c); + +#else /* __STDC__ */ + +extern int isalnum(); +extern int isalpha(); +extern int iscntrl(); +extern int isdigit(); +extern int isgraph(); +extern int islower(); +extern int isprint(); +extern int ispunct(); +extern int isspace(); +extern int isupper(); +extern int isxdigit(); +extern int tolower(); +extern int toupper(); + +#endif /* __STDC__ */ + +#define _C_UPPER 0x1 +#define _C_LOWER 0x2 +#define _C_NUMBER 0x4 +#define _C_WHITE_SPACE 0x8 +#define _C_PUNCT 0x10 +#define _C_CONTROL 0x20 +#define _C_HEX_NUMBER 0x40 +#define _C_B 0x80 + +#if defined(__STDC__) || defined(__cplusplus) +extern const unsigned char *__ctype; +extern const unsigned char *__ctype_tolower; +extern const unsigned char *__ctype_toupper; +#else /* __STDC__ */ +extern unsigned char *__ctype; +extern unsigned char *__ctype_tolower; +extern unsigned char *__ctype_toupper; +#endif /* __STDC__ */ + +#define __isalpha(c) (__ctype[c] & (_C_UPPER | _C_LOWER)) +#define __isupper(c) (__ctype[c] & (_C_UPPER)) +#define __islower(c) (__ctype[c] & (_C_LOWER)) +#define __isdigit(c) (__ctype[c] & (_C_NUMBER)) +#define __isxdigit(c) (__ctype[c] & (_C_HEX_NUMBER)) +#define __isspace(c) (__ctype[c] & (_C_WHITE_SPACE | _C_CONTROL)) +#define __ispunct(c) (__ctype[c] & (_C_PUNCT)) +#define __isalnum(c) (__ctype[c] & (_C_UPPER | _C_LOWER | _C_NUMBER)) +#define __isprint(c) (__ctype[c] & (_C_PUNCT | _C_UPPER | _C_LOWER | \ + _C_WHITE_SPACE | _C_NUMBER)) +#define __isgraph(c) (__ctype[c] & (_C_PUNCT | _C_UPPER | _C_LOWER | \ + _C_NUMBER)) +#define __iscntrl(c) (__ctype[c] & (_C_CONTROL | _C_B)) +#define __toupper(c) (__ctype_toupper[c]) +#define __tolower(c) (__ctype_tolower[c]) + +#ifndef __cplusplus +#define isalpha(c) __isalpha(c) +#define isupper(c) __isupper(c) +#define islower(c) __islower(c) +#define isdigit(c) __isdigit(c) +#define isxdigit(c) __isxdigit(c) +#define isspace(c) __isspace(c) +#define ispunct(c) __ispunct(c) +#define isalnum(c) __isalnum(c) +#define isprint(c) __isprint(c) +#define isgraph(c) __isgraph(c) +#define iscntrl(c) __iscntrl(c) +#define toupper(c) __toupper(c) +#define tolower(c) __tolower(c) +#endif + +#define isascii(c) ((unsigned) (c) <= 0177) +#define toascii(c) ((c) & 0177) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCctypeh */ diff --git a/h/dbgLib.h b/h/dbgLib.h new file mode 100644 index 0000000..ae9ff1e --- /dev/null +++ b/h/dbgLib.h @@ -0,0 +1,107 @@ +/* dbgLib.h - header file for dbgLib.c */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02h,08jul03,bpn Moved ALL definition to dbgTaskLibP.h +02g,01jul03,jmp removed SIMNT specific code. +02f,28feb03,bpn Clean-up. +02e,30apr98,dbt removed unused DBG_TT. +02d,12jan98,dbt modified for new debugger scheme. +02c,15aug97,cym added SIMNT support. +02b,28nov96,cdp added ARM support. +02a,26may94,yao added PPC support. +01t,19mar95,dvs removed #ifdef TRON - tron no longer supported. +01s,15dec93,hdn added support for I80X86. +01r,02dec93,pad Added Am29k family support. +01q,11aug93,gae vxsim hppa. +01p,20jun93,gae vxsim. +01r,22feb94,smb changed typedef EVENT_TYPE to event_t (SPR #3064) +01q,14jan94,c_s changed protoype of e (). +01p,10dec93,smb added instrumentation for eventpoints +01o,13nov92,dnw removed DBG_INFO typedef to taskLib.h (SPR #1768) +01n,22sep92,rrr added support for c++ +01m,25aug92,yao added function prototypes for dbgBreakNotifyInstall(), + dbgStepQuiet(), bdTask(). +01l,29jul92,wmd place #pragma aligns around DBG_INFO for the i960. +01k,10jul92,yao renamed DBG_STATE to DBG_INFO. removed dbgMode, pDbgSave, + BOOLS resumeTask, sstepTask, sstepQuite, pInterruptBreak. + added dbgState to DBG_INFO. added DBG_TASK_RESUME, + DBG_TASK_S_STEP, DBG_TASK_QUIET. added dbgBrkExists (). + added BRK_SINGLE_STEP. renamed BRK_SO to BRK_STEP_OVER. +01j,06jul92,yao removed dbgLockCnt in DBG_STATE. +01i,04jul92,jcf cleaned up. +01h,12mar92,yao moved TRON related stuff to dbgTRONLib.h. added macros + LST_FIRST, LST_NEXT, INST_CMP. added data structure HWBP, + BRKENTRY, DBG_STATE. added ANSI prototype for architecture + interface routines. +01j,26may92,rrr the tree shuffle +01i,23apr92,wmd moved include of dbg960Lib.h after defines of structures. +01g,09jan92,jwt converted CPU==SPARC to CPU_FAMILY==SPARC. +01f,16dec91,hdn changed a type of bp->code, from INSTR to int, for G100. +01e,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01d,11sep91,hdn added things for redesigned dbgLib.c for TRON. +01c,10jun91,del added pragma for gnu960 alignment. +01b,24mar91,del added things for redesigned dbgLib.c only available on + i960ca. +01a,05oct90,shl created. +*/ + +#ifndef __INCdbgLibh +#define __INCdbgLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#ifndef _ASMLANGUAGE +/* + * XXX bpn - used by trcLib.c that needs dbgLib.h to be included. + * This should be put in each trcLib.c + */ +#include + +/* Defines */ + +#undef INST_CMP +#define INST_CMP(addr,inst,mask) ((*(addr) & (mask)) == (inst)) /* XXX bpn - should be in dbgArchLibP.h */ + +/* function declarations */ + +/* + * For compatibility purpose with vxWorks 5.5, the definition of the + * shell debug functions are written in this file. + */ + +IMPORT STATUS dbgInit (void); + +IMPORT void dbgHelp (void); +IMPORT STATUS c (int taskNameOrId, INSTR * addr, INSTR * addr1); +IMPORT STATUS s (int taskNameOrId, INSTR * addr, INSTR * addr1); +IMPORT STATUS b (INSTR * addr, int taskNameOrId, int count, BOOL quiet); +IMPORT STATUS e (INSTR * addr, event_t eventId, int taskNameOrId, + FUNCPTR evtRtn, int arg); +#if DBG_HARDWARE_BP +IMPORT STATUS bh (INSTR * addr, int access, int taskNameOrId, int count, + BOOL quiet); +#endif /* DBG_HARDWARE_BP */ +IMPORT STATUS bd (INSTR * addr, int taskNameOrId); +IMPORT STATUS bdall (int taskNameOrId); +IMPORT STATUS cret (int taskNameOrId); +IMPORT STATUS so (int taskNameOrId); +IMPORT void l (INSTR * addr, int count); +IMPORT STATUS tt (int taskNameOrId); + +#endif /* _ASMLANGUAGE */ +#ifdef __cplusplus +} +#endif + +#endif /* __INCdbgLibh */ diff --git a/h/dbgRpcLib.h b/h/dbgRpcLib.h new file mode 100644 index 0000000..f01056d --- /dev/null +++ b/h/dbgRpcLib.h @@ -0,0 +1,42 @@ +/* dbgRpcLib.h - header file for remote debugging via rpc */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,22sep92,rrr added support for c++ +01e,04jul92,jcf cleaned up. +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -changed copyright notice +01b,05oct90,shl added copyright notice. + made #endif ANSI style. +01a,05jun90,llk extracted from xdr_dbx.h. +*/ + +#ifndef __INCdbgRpcLibh +#define __INCdbgRpcLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#define PROCESS_START 50 +#define PROCESS_WAIT 51 +#define VX_STATE_INQ 60 +#define VX_LOAD 61 +#define VX_SYMBOL_INQ 62 +#define VX_BREAK_ADD 63 +#define VX_BREAK_DELETE 64 +#define VX_FP_INQUIRE 65 +#define VX_TASK_SUSPEND 66 +#define VX_CALL_FUNC 67 +#define VX_CONV_FROM_68881 68 +#define VX_CONV_TO_68881 69 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdbgRpcLibh */ diff --git a/h/dcacheCbio.h b/h/dcacheCbio.h new file mode 100644 index 0000000..8ec5aee --- /dev/null +++ b/h/dcacheCbio.h @@ -0,0 +1,80 @@ +/* dcacheCbio.h - disk cache manager header file */ + +/* Copyright 1999-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,22mar05,dcc added inclusion of cbioLib.h +01i,23sep04,act back out changes for SPR#90008 +01h,03may04,jkf SPR#90008, adding device deletion routine +01g,04mar02,jkf SPR#32277, adding dcacheDevEnable and Disable +01f,21sep01,jkf SPR#69031, common code for both AE & 5.x. +01e,29feb00,jkf T3 changes +01d,31jul99,jkf T2 merge, tidiness & spelling. +01c,09sep98,lrn added dcacheDevMemResize() prototype +01b,06sep98,lrn changed dcacheDevCreate() prototype for CBIO subordinate +01a,15jun98,lrn written. +*/ + +#ifndef __INCdcacheCbioh +#define __INCdcacheCbioh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include "cbioLib.h" + +/* defines */ +#define DCACHE_MAX_DEVS 16 /* max # of cached devices */ + +/* globals */ +IMPORT int dcacheUpdTaskId ; /* updater task id, one per system */ +IMPORT int dcacheUpdTaskPriority ; /* updater task priority - tunable */ +IMPORT int dcacheUpdTaskStack ; /* updater task stack size - tunable */ + +/* prototypes */ + +IMPORT CBIO_DEV_ID dcacheDevCreate ( + CBIO_DEV_ID subDev, /* lower level device handle */ + char * pRamAddr, /* where it is in memory (NULL = malloc) */ + int memSize, /* amount of memory to use */ + char * pDesc /* device pDesc string */ + ) ; + +IMPORT STATUS dcacheDevTune ( + CBIO_DEV_ID dev, /* device handle */ + int dirtyMax, /* max # of dirty cache blocks allowed */ + int bypassCount, /* request size for bypassing cache */ + int readAhead, /* how many blocks to read ahead */ + int syncInterval /* how many seconds between disk updates */ + ) ; + +IMPORT void dcacheShow ( + CBIO_DEV_ID dev, /* device handle */ + int verbose /* 1: display state of each cache block */ + ) ; + +IMPORT STATUS dcacheDevMemResize + ( + CBIO_DEV_ID dev, /* device handle */ + size_t newSize /* new cache size in bytes */ + ) ; + +IMPORT STATUS dcacheDevEnable + ( + CBIO_DEV_ID dev /* CBIO device handle */ + ); + +IMPORT STATUS dcacheDevDisable + ( + CBIO_DEV_ID dev /* CBIO device handle */ + ); + +#ifdef __cplusplus +} +#endif + +#endif /*__INCdcacheCbioh*/ diff --git a/h/dcomExtent.h b/h/dcomExtent.h new file mode 100644 index 0000000..c6376c5 --- /dev/null +++ b/h/dcomExtent.h @@ -0,0 +1,47 @@ +/* dcomExtent.h - header for VxDCOM ORPC_EXTENT*/ + +/* Copyright (c) 1999 Wind River Systems, Inc. */ + +/* + +modification history +-------------------- +01c,28feb00,dbs fix extent size +01b,15feb00,dbs add all extent-related defs +01a,13aug99,drm created + +*/ + +#ifndef __INCdcomExtent_h +#define __INCdcomExtent_h + + +#ifdef _WIN32 +#include +#else +#include "comLib.h" +#endif + + +// defines + +#define VXDCOM_MAX_EXTENT_DATA sizeof(VXDCOMEXTENT) +#define VXDCOM_MAX_EXTENT_ARRAY 8 + + +////////////////////////////////////////////////////////////////////////// +// +// GUID and structure for VxDCOM extenstions +// + +const GUID GUID_VXDCOM_EXTENT = + {0x5c460fb8,0x8b2,0x11d3,{0x83,0x45,0x0,0x60,0x8,0x1e,0x90,0x8}}; + +typedef struct + { + long priority; // client propagated priority + long dummy; // force size up to 8 + } VXDCOMEXTENT; + + +#endif diff --git a/h/dcomLib.h b/h/dcomLib.h new file mode 100644 index 0000000..bdf14e2 --- /dev/null +++ b/h/dcomLib.h @@ -0,0 +1,252 @@ +/* dcomLib.h - VxWorks DCOM public API */ + +/* Copyright (c) 1998 Wind River Systems, Inc. */ + +/* + +modification history +-------------------- +01r,11oct01,nel Add SCM Stack Size param to dcomLibInit. +01q,16jul01,dbs fix up for plain C compilation, add definition of dcomLibInit +01p,12mar01,nel SPR#62130. Add CoDisconectObject API def. +01o,20sep99,dbs use vxidl.idl types +01n,09sep99,drm Removing GUID_VXDCOM_EXTENT and VXDCOMEXTENT definitions from + here as they've been moved to the new file dcomExtent.h +01m,21jul99,drm Adding GUID and structure for the VxDCOM extent. +01l,24jun99,dbs add authn APIs +01k,21apr99,dbs add fwd decls of RPC interfaces +01j,21apr99,dbs move IRpcChannelBuffer into its own privte header +01i,29jan99,dbs simplify proxy/stub code +01h,20jan99,dbs fix file names - vxcom becomes com +01g,22dec98,dbs tidy up ORPC interface +01f,18dec98,dbs move some stuff to vxcomLib.h +01e,14dec98,dbs enhance RPCOLEMESSAGE struct, speed up GUID ops +01d,11dec98,dbs remove need for COM_NO_WINDOWS_H flag +01c,11dec98,dbs simplify registry +01b,26nov98,dbs add IRemUnknown functionality +01a,17nov98,dbs created + +*/ + +/* + +DESCRIPTION: + +This file defines a working subset of the COM API (as defined by +Microsoft) for support of DCOM in VxWorks. + +*/ + +#ifndef __INCdcomLib_h +#define __INCdcomLib_h + +#include "comLib.h" + +EXTERN_C const CLSID CLSID_StdMarshal; + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * DCOM library initialisation/termination functions. + */ + +STATUS dcomLibInit + ( + int, /* BSTR policy */ + int, /* DCOM Authentication level */ + unsigned int, /* thread priority */ + unsigned int, /* Static threads */ + unsigned int, /* Dynamic threads */ + unsigned int, /* Stack Size of server thread */ + unsigned int, /* Stack Size of SCM thread */ + int, /* Client Priority propogation */ + int /* Object Exporter Port Number */ + ); + +void dcomLibTerm (void); + +/* + * Public API Functions - these mimic the Win32 CoXxxx API calls, + * specifically those related to marshaling and interface remoting. + */ + +HRESULT CoGetClassObject + ( + REFCLSID rclsid, /* CLSID of class object */ + DWORD dwClsContext, /* one of CLSCTX values */ + COSERVERINFO* pServerInfo, /* must be NULL */ + REFIID riid, /* IID of desired interface */ + void** ppv /* output interface pointer */ + ); + +HRESULT CoCreateInstanceEx + ( + REFCLSID rclsid, /* CLSID of the object */ + IUnknown* punkOuter, /* ptr to aggregating object */ + DWORD dwClsCtx, /* one of CLSCTX values */ + COSERVERINFO* pServerInfo, /* machine to create object on */ + ULONG cmq, /* number of MULTI_QI structures */ + MULTI_QI* pResults /* array of MULTI_QI structures */ + ); + +HRESULT CoRegisterClassObject + ( + REFCLSID rclsid, /* CLSID to be registered */ + IUnknown* pUnk, /* pointer to the class object */ + DWORD dwClsContext, /* context from CLSCTX_XXX enum */ + DWORD flags, /* how to connect to the class object */ + DWORD* lpdwRegister /* returned token */ + ); + +HRESULT CoRevokeClassObject + ( + DWORD dwRegister /* token for class object */ + ); + +HRESULT CoGetStandardMarshal + ( + REFIID riid, /* interface IID */ + IUnknown* pUnk, /* interface-ptr to be marshaled */ + DWORD dwDestContext, /* destination context */ + void* pvDestContext, /* reserved for future use */ + DWORD mshlflags, /* reason for marshaling */ + IMarshal** ppMshl /* output ptr */ + ); + +HRESULT CoMarshalInterface + ( + IStream* pStm, /* stream to marshal into */ + REFIID riid, /* interface IID */ + IUnknown* pUnk, /* interface-ptr to be marshaled */ + DWORD dwDestContext, /* destination context */ + void* pvDestContext, /* reserved for future use */ + DWORD mshlflags /* reason for marshaling */ + ); + +HRESULT CoUnmarshalInterface + ( + IStream* pStm, /* stream containing interface */ + REFIID riid, /* IID of the interface */ + void** ppv /* output variable to receive ptr */ + ); + +HRESULT CoGetMarshalSizeMax + ( + ULONG* pulSize, /* ptr to the upper-bound value */ + REFIID riid, /* IID of interface */ + IUnknown* pUnk, /* interface-ptr to be marshaled */ + DWORD dwDestContext, /* destination process */ + LPVOID pvDestContext, /* reserved for future use */ + DWORD mshlflags /* reason for marshaling */ + ); + +HRESULT CoReleaseMarshalData + ( + IStream* pStrm /* stream to release */ + ); + +HRESULT CoDisconnectObject + ( + IUnknown* pUnk, /* object to be disconnected */ + DWORD dwReserved /* reserved for future use - MBZ */ + ); + +HRESULT CoGetPSClsid + ( + REFIID riid, /* IID to use */ + LPCLSID pClsid /* resulting P/S CLSID */ + ); + +#define RPC_C_AUTHN_LEVEL_DEFAULT 0 +#define RPC_C_AUTHN_LEVEL_NONE 1 +#define RPC_C_AUTHN_LEVEL_CONNECT 2 +#define RPC_C_AUTHN_LEVEL_CALL 3 +#define RPC_C_AUTHN_LEVEL_PKT 4 +#define RPC_C_AUTHN_LEVEL_PKT_INTEGRITY 5 +#define RPC_C_AUTHN_LEVEL_PKT_PRIVACY 6 + +#define RPC_C_AUTHN_NONE 0 +#define RPC_C_AUTHN_DCE_PRIVATE 1 +#define RPC_C_AUTHN_DCE_PUBLIC 2 +#define RPC_C_AUTHN_DEC_PUBLIC 4 +#define RPC_C_AUTHN_WINNT 10 +#define RPC_C_AUTHN_DEFAULT 0xFFFFFFFF + +#define RPC_C_IMP_LEVEL_DEFAULT 0 +#define RPC_C_IMP_LEVEL_ANONYMOUS 1 +#define RPC_C_IMP_LEVEL_IDENTIFY 2 +#define RPC_C_IMP_LEVEL_IMPERSONATE 3 +#define RPC_C_IMP_LEVEL_DELEGATE 4 + +#define RPC_C_AUTHZ_NONE 0 +#define RPC_C_AUTHZ_NAME 1 +#define RPC_C_AUTHZ_DCE 2 + +#define EOAC_NONE (0) + +/************************************************************************** +* +* vxdcomUserAdd -- add a user+password to VxDCOM +* +* This function adds a username, plus their password, to the VxDCOM +* security service. This is used when an authentication level other +* than the default is required, the only valid level being +* RPC_C_AUTHN_LEVEL_CONNECT. +* +* RETURNS: n/a +*/ + +void vxdcomUserAdd + ( + const char* userName, + const char* userPassword + ); + +/************************************************************************** +* +* CoInitializeSecurity -- initialize the security service +* +* This function initializes the VxDCOM security service (only +* NTLMSSP is supported by VxDCOM). The parameter 'dwAuthnLevel' sets +* both the default incoming authentication level and the default +* outgoing authentication level, and must be one of the +* RPC_C_AUTHN_LEVEL_xxx constants. Incoming calls with less than this +* level will be failed, outgoing calls will be made (by default) with +* this level. The parameter 'dwImpLevel' sets the default +* impersonation level for outgoing calls, and must be one of the +* RPC_C_IMP_LEVEL_xxx constants. +* +* Calling CoCreateInstanceEx() with a non-NULL 'pServerInfo' parameter +* will utilise the fields in the COSERVERINFO structure to determine +* where the server is to be created. If the structure has a non-NULL +* 'pAuthInfo' member, then the security settings in that structure +* will override the default settings for the duration of that +* activation request, and will be applied to the created proxy (if the +* activation is successful). Valid settings for the COAUTHINFO +* structure are described in its definition earlier in this file. +* +* RETURNS: an HRESULT value +*/ + +HRESULT CoInitializeSecurity + ( + void* psd, /* security descriptor - MBZ */ + long cAuths, /* must be -1 */ + void* asAuths, /* array of services - MBZ */ + void* pReserved1, /* reserved - MBZ */ + DWORD dwAuthnLevel, /* default authentication level */ + DWORD dwImpLevel, /* default impersonation level */ + void* pAuthList, /* per-service info - MBZ */ + DWORD dwcapabilities, /* capabilities - must be EOAC_NONE */ + void* pReserved3 /* reserved - MBZ */ + ); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdcomLib_h */ + + diff --git a/h/dcomProxy.h b/h/dcomProxy.h new file mode 100644 index 0000000..a1411b2 --- /dev/null +++ b/h/dcomProxy.h @@ -0,0 +1,406 @@ +/* dcomProxy.h - VxWorks DCOM runtime marshaling support */ + +/* Copyright (c) 1998 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02i,02aug01,dbs add [v1_enum] support +02h,31jul01,dbs remove obsolete InterfaceProxy class, add p/s registration + macro +02g,28feb01,nel SPR#35698. Add boolean type. +02f,19sep00,nel Change constness of widlMarshal to match T3. +02e,24aug00,dbs fix many OPC-related SPRs +02d,18jul00,dbs add CV array type and enum type +02c,02mar00,dbs add revised VTBL macros +02b,11feb00,dbs add void_t() to allow void-pointers in marshaling +02a,07feb00,dbs simplify NdrType classes, enhance marshaling of arrays to + support all kinds +01z,02feb00,dbs change proxy vtbl to be template-based +01y,14oct99,dbs make double an explicit typedesc +01x,22sep99,dbs add uhyper type +01w,16sep99,dbs marshaling enhancements, part 2 +01v,14sep99,dbs change REFIIDs to const IID& for WIDL compatibility, add + VARIANT, pointer and string types +01u,12aug99,dbs improve NDR structure support +01t,05aug99,dbs remove byte typedef +01s,30jul99,dbs tighten up type-safety of NDR types +01r,25jun99,dbs add channel-ID to stub-msg +01q,03jun99,aim removed BYTE_ORDER and LITTLE_ENDIAN defs +01p,02jun99,dbs remove OS-specific macros +01o,28may99,dbs make stub disp-tbl a struct +01n,27may99,dbs remove DCE-specific stub-function type +01m,25may99,dbs remove NDRTYPES::alloc/free methods +01l,20may99,dbs move NDR phase into streams +01k,18may99,dbs add proxy/stub marshaling phase to NDR-streams +01j,14may99,dbs add alignment requirement to NdrType +01i,14may99,dbs remove obsolete PFNSTUB type +01h,14may99,dbs add new NDR support +01g,11may99,dbs simplify proxy remoting architecture +01f,11may99,dbs add fwd-decl of IRpcStubBuffer etc, rename symbols + like VXCOM_* to VXDCOM_* +01e,04may99,dbs remove cplusplus check +01d,30apr99,dbs fix up bracketing in vtbl macros +01c,29apr99,dbs fix -Wall warnings +01b,22apr99,dbs add HRESULT member to RPCOLEMESSAGE +01a,20apr99,dbs added mod-hist +*/ + +/* This header is to be included in generated proxy/stub code. */ + +#ifndef __INCdcomProxy_h +#define __INCdcomProxy_h + +#include "dcomLib.h" +#include "comObjLib.h" + +////////////////////////////////////////////////////////////////////////// +// +// DATA REPRESENTATION -- we use the NDR format, which is actually +// defined as a vector of 4 bytes, the first of which contains the +// integer ordering field. However, its difficult in C to pass this +// around, so we use an unsigned-long representation instead. +// + +#if (_BYTE_ORDER == _LITTLE_ENDIAN) +#define VXDCOM_NDR_CHAR_REP 0x00 +#define VXDCOM_NDR_INT_REP 0x01 +#define VXDCOM_NDR_FLOAT_REP 0x00 +#define VXDCOM_DREP_LITTLE_ENDIAN 0x00000010 +#define VXDCOM_DREP_BIG_ENDIAN 0x00000000 +#define VXDCOM_DREP_MASK 0x000000FF +#define VXDCOM_DREP_LOCAL VXDCOM_DREP_LITTLE_ENDIAN +#else /* big endian */ +#define VXDCOM_NDR_CHAR_REP 0x00 +#define VXDCOM_NDR_INT_REP 0x00 +#define VXDCOM_NDR_FLOAT_REP 0x00 +#define VXDCOM_DREP_LITTLE_ENDIAN 0x10000000 +#define VXDCOM_DREP_BIG_ENDIAN 0x00000000 +#define VXDCOM_DREP_MASK 0xFF000000 +#define VXDCOM_DREP_LOCAL VXDCOM_DREP_BIG_ENDIAN +#endif + +#define VXDCOM_NDR_DATAREP0 ((VXDCOM_NDR_INT_REP << 4) | VXDCOM_NDR_CHAR_REP) +#define VXDCOM_NDR_DATAREP1 (VXDCOM_NDR_FLOAT_REP) +#define VXDCOM_NDR_DATAREP2 (0) +#define VXDCOM_NDR_DATAREP3 (0) + +typedef unsigned long RPCOLEDATAREP; + +////////////////////////////////////////////////////////////////////////// +// +// Forward type declarations... +// + +class NdrTypeFactory; +class NdrMarshalStream; +class NdrUnmarshalStream; + +class RpcProxyMsg; + +class NDRTYPES; + +/////////////////////////////////////////////////////////////////////////// +// +// IUnknown proxy functions +// + +extern HRESULT IUnknown_QueryInterface_vxproxy (IUnknown*, REFIID, void**); +extern ULONG IUnknown_AddRef_vxproxy (IUnknown*); +extern ULONG IUnknown_Release_vxproxy (IUnknown*); + +/////////////////////////////////////////////////////////////////////////// +// +// ndr_make_right - re-formats a 2-byte, 4-byte or 8-byte number +// into the format indicated by the dataRep field... +// + +template +inline void ndr_make_right (T& t, ULONG drepOther) + { + if (VXDCOM_DREP_LOCAL == drepOther) + return; + + char *a = (char*) &t; + char *b = ((char*) &t) + sizeof (T) - 1; + char tmp; + + for (size_t n=0; n < (sizeof (T) / 2); ++n) + { + tmp = *a; + *a = *b; + *b = tmp; + ++a; + --b; + } + } + + +////////////////////////////////////////////////////////////////////////// +// +// NDR Utility macros... +// + +#define NDR_SIZEOF(type) ((size_t) ((char*)(((type*)0) + 1))) + +#define NDR_OFFSETOF(type,member) ((size_t) &((type*) 0)->member) + +////////////////////////////////////////////////////////////////////////// +// +// Define NDR/IDL types that aren't part of C/C++ +// + +typedef unsigned long DREP; + +////////////////////////////////////////////////////////////////////////// +// + +class NdrType + { + + public: + + enum TypeKind + { + TK_SIMPLE=0, + TK_STRUCT, + TK_ARRAY, + TK_CSTRUCT, + TK_CARRAY, + TK_VARRAY, + TK_CVARRAY, + TK_UNION, + TK_NE_UNION, + TK_PTR, + TK_BSTR, + TK_INTERFACE + }; + + void* operator new (size_t, NdrTypeFactory*); + void operator delete (void*); + + NdrType (NDRTYPES& n) : m_dwRefCount (0), m_ndrtypes (n) {} + + virtual ~NdrType () {} + + virtual TypeKind kind () const =0; + virtual size_t size (NdrUnmarshalStream*) =0; + virtual size_t alignment () const =0; + virtual void resize (size_t) =0; + virtual long value () const =0; + virtual void bind (void*) =0; + + virtual HRESULT marshal1 (NdrMarshalStream*) =0; + virtual HRESULT marshal2 (NdrMarshalStream*); + + virtual HRESULT unmarshal1 (NdrUnmarshalStream*) =0; + virtual HRESULT unmarshal2 (NdrUnmarshalStream*); + + virtual HRESULT marshal (NdrMarshalStream*); + virtual HRESULT unmarshal (NdrUnmarshalStream*); + + ULONG AddRef () { return ++m_dwRefCount; } + ULONG Release () + { + ULONG n = --m_dwRefCount; + if (n == 0) + delete this; + return n; + } + + void arraySizeSet (int n); + int arraySizeGet (); + + private: + DWORD m_dwRefCount; + NDRTYPES& m_ndrtypes; + }; + +////////////////////////////////////////////////////////////////////////// +// +// Define the generic 'type descriptor' as ref-counting pointer to an +// NdrType (subclass) instance. +// + +typedef CComPtr NdrTypeDesc; + +////////////////////////////////////////////////////////////////////////// +// +// NDR Structure support -- the nSizeIs member indicates the +// associated structure member which provides the dynamic sizing +// information for a particular data member. For fixed-size structure +// elements, this value will be -1 (i.e. there is no sizing info) and +// for those with a size_is attribute the field will hold the index +// (in the range 0..N-1 where N is the number of struct members) of +// the data member that is nominated in the size_is field. +// +// For conformant structures, i.e. those whose last element is a +// conformant-array, they may use the cstruct_t type descriptor, and +// then won't require the last member to have nSizeIs set. +// + +struct NdrMemberInfo + { + NdrTypeDesc pType; + size_t nOffset; + int nSizeIs; + + NdrMemberInfo (const NdrTypeDesc& pt, size_t offset, int nsize = -1) + : pType (pt), nOffset (offset), nSizeIs (nsize) + {} + + NdrMemberInfo () : pType (0), nOffset (0), nSizeIs (-1) + {} + }; + +#define NDR_MEMBER(sname,mem,typ) NdrMemberInfo(typ,NDR_OFFSETOF(sname,mem)) +#define NDR_MEMBERX(sname,mem,typ,sz) NdrMemberInfo(typ,NDR_OFFSETOF(sname,mem),sz) + +////////////////////////////////////////////////////////////////////////// +// + +struct RpcMode + { + enum Mode_t { OBJECT=0, DCE=1 }; + }; + +////////////////////////////////////////////////////////////////////////// +// +// RPC proxy message +// + +class RPC_PROXY_MSG + { + public: + RPC_PROXY_MSG (const IID& riid, RpcMode::Mode_t mode, ULONG opnum, void*); + ~RPC_PROXY_MSG (); + + NdrMarshalStream* marshalStreamGet (); + HRESULT SendReceive (); + NdrUnmarshalStream* unmarshalStreamGet (); + + RpcProxyMsg* m_pImpl; + }; + +////////////////////////////////////////////////////////////////////////// +// +// RPC stub message +// + +class RPC_STUB_MSG + { + public: + RPC_STUB_MSG (NdrUnmarshalStream*, NdrMarshalStream*, int =0); + ~RPC_STUB_MSG () {} + + NdrUnmarshalStream* unmarshalStreamGet (); + NdrMarshalStream* marshalStreamGet (); + int channelIdGet (); + + private: + + NdrUnmarshalStream* m_pUnmshlStrm; + NdrMarshalStream* m_pMshlStrm; + int m_channelId; + }; + +////////////////////////////////////////////////////////////////////////// +// +// Stub dispatch function type... +// + +typedef HRESULT (STDMETHODCALLTYPE * PFN_ORPC_STUB) (IUnknown*, RPC_STUB_MSG&); + + +/////////////////////////////////////////////////////////////////////////// +// +// Stub dispatch-table type... +// + +struct VXDCOM_STUB_DISPTBL + { + unsigned int nFuncs; + const PFN_ORPC_STUB* funcs; + }; + + +////////////////////////////////////////////////////////////////////////// +// +// autoregistration helper class for proxy/stubs +// + +class vxdcom_ps_autoreg + { + public: + vxdcom_ps_autoreg + ( + const IID& iid, + const void* pv, + const VXDCOM_STUB_DISPTBL* ps + ); + }; + +#define VXDCOM_PS_AUTOREGISTER(itf) \ + static vxdcom_ps_autoreg \ + _the_##itf##_ps_autoreg (IID_##itf, \ + &itf##_vxproxy_vtbl, \ + &itf##_vxstub_disptbl) + +////////////////////////////////////////////////////////////////////////// +// +// NDR Types +// + +class NDRTYPES + { + public: + int arraySize; + + public: + NDRTYPES (int hint=256); + ~NDRTYPES (); + + NdrTypeDesc byte_t (); + NdrTypeDesc short_t (); + NdrTypeDesc long_t (); + NdrTypeDesc enum_t (); + NdrTypeDesc v1enum_t (); + NdrTypeDesc hyper_t (); + NdrTypeDesc float_t (); + NdrTypeDesc double_t (); + NdrTypeDesc bstr_t (); + NdrTypeDesc struct_t (int nelems, const NdrMemberInfo m[], int nSizeIs = -1); + NdrTypeDesc cstruct_t (int nelems, const NdrMemberInfo m[], int nSizeIs); + NdrTypeDesc array_t (const NdrTypeDesc& eltype, size_t elsz, size_t nelems=0); + NdrTypeDesc carray_t (const NdrTypeDesc& eltype, size_t elsz, size_t nelems=0); + NdrTypeDesc cvarray_t (const NdrTypeDesc& eltype, size_t elsz, size_t nelems=0, size_t nmax=0); + NdrTypeDesc interfaceptr_t (const IID&); + NdrTypeDesc variant_t (); + NdrTypeDesc cstring_t (); + NdrTypeDesc wstring_t (); + NdrTypeDesc pointer_t (const NdrTypeDesc& pointeeType); + NdrTypeDesc refptr_t (const NdrTypeDesc& pointeeType); + + // map C types to IDL types + NdrTypeDesc void_t () { return byte_t (); } + NdrTypeDesc boolean_t () { return byte_t (); } + NdrTypeDesc char_t () { return byte_t (); } + NdrTypeDesc uchar_t () { return byte_t (); } + NdrTypeDesc ushort_t () { return short_t (); } + NdrTypeDesc ulong_t () { return long_t (); } + NdrTypeDesc uhyper_t () { return hyper_t (); } + NdrTypeDesc int_t () { return long_t (); } + NdrTypeDesc uint_t () { return long_t (); } + NdrTypeDesc hresult_t () { return long_t (); } + NdrTypeDesc longlong_t () { return hyper_t (); } + + private: + NdrTypeFactory* m_pFactory; + }; + +HRESULT widlMarshal (void const*, NdrMarshalStream*, const NdrTypeDesc&); +HRESULT widlUnmarshal (void*, NdrUnmarshalStream*, const NdrTypeDesc&); + +#endif + + diff --git a/h/demangler.h b/h/demangler.h new file mode 100644 index 0000000..207ba13 --- /dev/null +++ b/h/demangler.h @@ -0,0 +1,71 @@ +/* demangler.h - WR wrapper around GNU libiberty C++ demangler */ + +/* Copyright 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02d,02aug04,sn added demangleToBuffer entry point +02c,16dec03,sn DEBUG_DEMANGLER really no longer on by default! +02b,05may03,sn DEBUG_DEMANGLER no longer on by default +02a,15apr03,sn moved to share/src/demangler +01b,10dec01,sn move enum defs to demanglerTypes.h +01a,28nov01,sn wrote +*/ + +#ifndef __INCdemanglerh +#define __INCdemanglerh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +/* defines */ + +/* typedefs */ + +#include "demanglerTypes.h" + +char * demangle + ( + const char * mangledSymbol, + DEMANGLER_STYLE style, /* the scheme used to mangle symbols */ + DEMANGLER_MODE mode /* how hard to work */ + ); + +DEMANGLER_RESULT demangleToBuffer + ( + char * mangledSymbol, + char * buffer, /* output buffer for demangled name */ + size_t * pBufferSize, /* in: actual buffer size / out: required buffer size */ + DEMANGLER_MODE mode, + char ** pResult /* out: result string */ + ); + +DEMANGLER_STYLE demanglerStyleFromName + ( + const char * styleName, + DEMANGLER_STYLE defaultStyle + ); + +const char * demanglerNameFromStyle + ( + DEMANGLER_STYLE style + ); + +/* Add #define DEBUG_DEMANGLER here to turn on debugging */ + +#ifdef DEBUG_DEMANGLER +#define debug_dmgl(fmt, x) (printf("debug_dmgl: "), printf((fmt), (x))) +#else +#define debug_dmgl(fmt, x) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdemanglerh */ + diff --git a/h/demanglerTypes.h b/h/demanglerTypes.h new file mode 100644 index 0000000..3e9af1f --- /dev/null +++ b/h/demanglerTypes.h @@ -0,0 +1,55 @@ +/* demanglerTypes.h - enums needed for WR demangler functions (can safely be included by GDB) */ + +/* Copyright 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,03aug04,sn added DEMANGLER_RESULT +01b,15apr03,sn moved to share/src/demangler +01a,10dec01,sn wrote +*/ + +#ifndef __INCdemanglerTypesh +#define __INCdemanglerTypesh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +/* defines */ + +/* typedefs */ + +typedef enum demangler_style + { + DMGL_STYLE_GNU, + DMGL_STYLE_DIAB, + DMGL_STYLE_IA64_ABI, + DMGL_STYLE_AUTO, + DMGL_STYLE_ARM, + DMGL_STYLE_INVALID + } DEMANGLER_STYLE; + +typedef enum demangler_mode + { + DMGL_MODE_OFF = 0, /* function name is not demangled */ + DMGL_MODE_TERSE = 1, /* just function name, no type information */ + DMGL_MODE_COMPLETE = 2 /* full demangling */ + } DEMANGLER_MODE; + +typedef enum demangle_result + { + DMGL_OK, + DMGL_ERR_BUFFER_OVERFLOW, + DMGL_ERR_BAD_INPUT + } DEMANGLER_RESULT; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdemanglerTypesh */ + diff --git a/h/dhcp/common.h b/h/dhcp/common.h new file mode 100644 index 0000000..4bab729 --- /dev/null +++ b/h/dhcp/common.h @@ -0,0 +1,375 @@ +/* common.h - DHCP server include file for shared data structures */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,12dec01,wap Interface name field of if_info structure is too small for + some interface names (SPR #29087) +01a,09oct01,rae merge from truestack ver 01h, base 01e, minor fixes + +01e,14jul00,spm upgraded to RFC 2131 and removed direct link-level access +01d,06oct97,spm added support for dynamic driver type detection +01c,06aug97,spm added definitions for C++ compilation +01b,06may97,spm changed memory access to align IP header on four byte boundary +01a,07apr97,spm created by modifying WIDE project DHCP implementation +*/ + +/* + * WIDE Project DHCP Implementation + * Copyright (c) 1995 Akihiro Tominaga + * Copyright (c) 1995 WIDE Project + * All rights reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided only with the following + * conditions are satisfied: + * + * 1. Both the copyright notice and this permission notice appear in + * all copies of the software, derivative works or modified versions, + * and any portions thereof, and that both notices appear in + * supporting documentation. + * 2. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by WIDE Project and + * its contributors. + * 3. Neither the name of WIDE Project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND WIDE + * PROJECT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES + * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ALSO, THERE + * IS NO WARRANTY IMPLIED OR OTHERWISE, NOR IS SUPPORT PROVIDED. + * + * Feedback of the results generated from any improvements or + * extensions made to this software would be much appreciated. + * Any such feedback should be sent to: + * + * Akihiro Tominaga + * WIDE Project + * Keio University, Endo 5322, Kanagawa, Japan + * (E-mail: dhcp-dist@wide.ad.jp) + * + * WIDE project has the rights to redistribute these changes. + */ + +#ifndef __INCcommonh +#define __INCcommonh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Resources sent to client outside of options field, if at all. */ + +#define S_TABLE_CONT 0 +#define S_SNAME 1 +#define S_FILE 2 +#define S_SIADDR 3 +#define S_ALLOW_BOOTP 4 +#define S_IP_ADDR 5 +#define S_MAX_LEASE 6 +#define S_DEFAULT_LEASE 7 +#define S_CLIENT_ID 8 +#define S_PARAM_ID 9 +#define S_CLASS_ID 10 + +/* Resources sent to client as RFC 1533 options. */ + +#define S_SUBNET_MASK 11 +#define S_TIME_OFFSET 12 +#define S_ROUTER 13 +#define S_TIME_SERVER 14 +#define S_NAME_SERVER 15 +#define S_DNS_SERVER 16 +#define S_LOG_SERVER 17 +#define S_COOKIE_SERVER 18 +#define S_LPR_SERVER 19 +#define S_IMPRESS_SERVER 20 +#define S_RLS_SERVER 21 +#define S_HOSTNAME 22 +#define S_BOOTSIZE 23 +#define S_MERIT_DUMP 24 +#define S_DNS_DOMAIN 25 +#define S_SWAP_SERVER 26 +#define S_ROOT_PATH 27 +#define S_EXTENSIONS_PATH 28 +#define S_IP_FORWARD 29 +#define S_NONLOCAL_SRCROUTE 30 +#define S_POLICY_FILTER 31 +#define S_MAX_DGRAM_SIZE 32 +#define S_DEFAULT_IP_TTL 33 +#define S_MTU_AGING_TIMEOUT 34 +#define S_MTU_PLATEAU_TABLE 35 +#define S_IF_MTU 36 +#define S_ALL_SUBNET_LOCAL 37 +#define S_BRDCAST_ADDR 38 +#define S_MASK_DISCOVER 39 +#define S_MASK_SUPPLIER 40 +#define S_ROUTER_DISCOVER 41 +#define S_ROUTER_SOLICIT 42 +#define S_STATIC_ROUTE 43 +#define S_TRAILER 44 +#define S_ARP_CACHE_TIMEOUT 45 +#define S_ETHER_ENCAP 46 +#define S_DEFAULT_TCP_TTL 47 +#define S_KEEPALIVE_INTER 48 +#define S_KEEPALIVE_GARBA 49 +#define S_NIS_DOMAIN 50 +#define S_NIS_SERVER 51 +#define S_NTP_SERVER 52 +#define S_NBN_SERVER 53 +#define S_NBDD_SERVER 54 +#define S_NB_NODETYPE 55 +#define S_NB_SCOPE 56 +#define S_XFONT_SERVER 57 +#define S_XDISPLAY_MANAGER 58 +#define S_DHCP_T1 59 +#define S_DHCP_T2 60 +#define S_NISP_DOMAIN 61 +#define S_NISP_SERVER 62 +#define S_MOBILEIP_HA 63 +#define S_SMTP_SERVER 64 +#define S_POP3_SERVER 65 +#define S_NNTP_SERVER 66 +#define S_DFLT_WWW_SERVER 67 +#define S_DFLT_FINGER_SERVER 68 +#define S_DFLT_IRC_SERVER 69 +#define S_STREETTALK_SERVER 70 +#define S_STDA_SERVER 71 + +#define S_LAST_OPTION S_STDA_SERVER +#define VALIDSIZE ((S_LAST_OPTION / 8) + 1) + +/* Set length for entry names. Leave space to append unique value. */ + +#define BASE_NAME 8 /* length for user-provided name, excluding '\0' */ +#define MAX_NAME BASE_NAME + 2 * sizeof (u_long) + +#include +#include +#include + +#define DHCPS_OFF 2 /* 4-byte alignment offset needed by Sun BSP's */ +#define ETHERHL sizeof(struct ether_header) /* ethernet header length */ +#define IPHL sizeof(struct ip) /* IP header length */ +#define UDPHL sizeof(struct udphdr) /* UDP header length */ +#define WORD 4 /* word alignment in bits */ + +#if CPU_FAMILY==I960 +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +struct msg +{ + struct ether_header *ether; + struct ip *ip; + struct udphdr *udp; + struct dhcp *dhcp; +}; + +struct if_info { + int fd; + char name[IFNAMSIZ]; + short unit; + int bpfDev; /* File descriptor for Berkeley Packet Filter */ + int mtuSize; + unsigned int htype; + unsigned char hlen; + char haddr[6]; + struct in_addr ipaddr; + struct in_addr subnetmask; + int buf_size; + char *buf; + struct if_info *next; /* Next entry in null terminated list. */ +}; + +struct relay_acl { + struct in_addr relay, + subnet_mask; +}; + +struct client_id { + unsigned char idtype, + idlen; + char id [MAXOPT]; + struct in_addr subnet; +}; + +struct u_shorts { + int num; + unsigned short *shorts; +}; + +struct in_addrs { + int num; + struct in_addr *addr; +}; + +struct ip_pairs { + int num; + struct in_addr *addr1, + *addr2; +}; + +struct chaddr { + unsigned char htype, + hlen; + char haddr [MAX_HLEN]; +}; + +struct dhcp_binding { + + /* external info */ + struct client_id cid; /* hashing key. client identifier */ + struct chaddr haddr; + time_t expire_epoch; /* lease expiration epoch */ + char res_name [MAX_NAME + 1]; /* name of resource */ + + /* internal info */ + char flag; +#define COMPLETE_ENTRY 0x1 /* complete entry */ +#define STATIC_ENTRY 0x2 /* static entry */ +#define BOOTP_ENTRY 0x4 /* bootp entry */ + time_t temp_epoch; /* memo expiration epoch */ + struct dhcp_resource *res; /* pointer to resource */ +}; + +struct dhcp_resource { + + /* external info */ + char allow_bootp, /* boolean */ + ip_forward, /* boolean */ + nonlocal_srcroute, /* boolean */ + all_subnet_local, /* boolean */ + mask_discover, /* boolean */ + mask_supplier, /* boolean */ + router_discover, /* boolean */ + trailer, /* boolean */ + ether_encap, /* boolean */ + keepalive_garba, /* boolean */ + entryname [MAX_NAME + 1], /* tag name of entry */ + sname [MAX_SNAME + 1], /* server host name */ + file [MAX_FILE + 1], /* boot file name */ + hostname [MAXOPT + 1], + merit_dump [MAXOPT + 1], + dns_domain [MAXOPT + 1], + root_path [MAXOPT + 1], + extensions_path [MAXOPT + 1], + nis_domain [MAXOPT + 1], + nb_scope [MAXOPT + 1], /* NetBIOS scope */ + nisp_domain [MAXOPT + 1]; /* NIS+ domain name */ + unsigned char default_ip_ttl, /* time to live (1 - 255) */ + default_tcp_ttl, + nb_nodetype; /* NetBIOS node type */ +#define BNODE 0x1 +#define PNODE 0x2 +#define MNODE 0x4 +#define HNODE 0x8 + unsigned short bootsize, /* bootfile size in 16 bits */ + max_dgram_size, /* max dgram reassembly */ + intf_mtu, /* interface mtu */ + dhcp_t1, /* host byte order */ + dhcp_t2; /* host byte order */ + long time_offset; /* offset from UTC */ + unsigned long max_lease, /* maximum lease duration + (host byte order) */ + default_lease, /* default lease duration + (host byte order) */ + mtu_aging_timeout, /* unsigned 32 bits integer */ + arp_cache_timeout, + keepalive_inter; + struct u_shorts mtu_plateau_table; /* array of 16 bit ints */ + struct in_addr siaddr, /* (tftp) server */ + ip_addr, /* IP address */ + subnet_mask, + swap_server, + brdcast_addr, + router_solicit; + struct in_addrs router, + time_server, + name_server, + dns_server, /* DNS server */ + log_server, + cookie_server, + lpr_server, + impress_server, + rls_server, /* Resource Location Server */ + nis_server, + ntp_server, + nbn_server, /* NetBIOS name server */ + nbdd_server, /* NetBIOS dgram distrib server */ + xfont_server, /* X font erver */ + xdisplay_manager, /* X display manager */ + nisp_server, /* NIS+ server */ + mobileip_ha, /* Mobile IP Home Agent */ + smtp_server, /* SMTP server */ + pop3_server, /* POP3 server */ + nntp_server, /* NNTP server */ + dflt_www_server, /* Default WWW server */ + dflt_finger_server, /* Default Finger server */ + dflt_irc_server, /* Default IRC server */ + streettalk_server, /* StreetTalk server */ + stda_server; /* STDA server */ + struct ip_pairs policy_filter, + static_route; + + /* internal info */ + char valid[VALIDSIZE], /* indicate which are available */ + active[VALIDSIZE]; /* indicate which differ from + Host Requirements RFC */ + struct dhcp_binding *binding; /* pointer to identifier + * associated with resource. + */ +}; + +#if CPU_FAMILY==I960 +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif +#ifndef GOOD +#define GOOD 1 +#endif +#ifndef BAD +#define BAD 0 +#endif +#ifndef ADDRPOOL_DUMP +#define ADDRPOOL_DUMP "/tmp/addrpool_dump" +#endif +#define MAX_NBIND 500 /* maximum number of dhcp_binding + ( this is used in garbage_collect(); ) */ + +#define MAXPATHLEN 64 /* Maximum length of database names. */ + +#ifndef VIRTUAL_STACK +extern int nbind; +#endif /* VIRTUAL_STACK */ + +#ifndef sun +extern struct bpf_hdr *rbpf; /* pointer to bpf header */ +#endif +/* extern struct msg rcv; */ + +int add_bind(); +STATUS read_bind_db (void); +STATUS read_addrpool_db (int); +void read_relay_db (int); +void dump_bind_db(); +void finish(); +char *haddrtos(); +char *cidtos(); +char *_ctime(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/dhcp/common_subr.h b/h/dhcp/common_subr.h new file mode 100644 index 0000000..c68b251 --- /dev/null +++ b/h/dhcp/common_subr.h @@ -0,0 +1,97 @@ +/* common_subr.h - DHCP server include file for function prototypes */ + +/* Copyright 1984 - 2000 Wind River Systems, Inc. */ + +/* +modification history +____________________ +01c,14jul00,spm added support for non-Ethernet devices +01b,06aug97,spm added alignment pragma and definitions for C++ compilation +01a,07apr97,spm created by modifying WIDE project DHCP implementation +*/ + +/* + * WIDE Project DHCP Implementation + * Copyright (c) 1995 Akihiro Tominaga + * Copyright (c) 1995 WIDE Project + * All rights reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided only with the following + * conditions are satisfied: + * + * 1. Both the copyright notice and this permission notice appear in + * all copies of the software, derivative works or modified versions, + * and any portions thereof, and that both notices appear in + * supporting documentation. + * 2. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by WIDE Project and + * its contributors. + * 3. Neither the name of WIDE Project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND WIDE + * PROJECT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES + * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ALSO, THERE + * IS NO WARRANTY IMPLIED OR OTHERWISE, NOR IS SUPPORT PROVIDED. + * + * Feedback of the results generated from any improvements or + * extensions made to this software would be much appreciated. + * Any such feedback should be sent to: + * + * Akihiro Tominaga + * WIDE Project + * Keio University, Endo 5322, Kanagawa, Japan + * (E-mail: dhcp-dist@wide.ad.jp) + * + * WIDE project has the rights to redistribute these changes. + */ + +#ifndef __INCcommon_subrh +#define __INCcommon_subrh + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct dhcpEvent /* External event descriptor. */ + { + unsigned char source; /* Offset of receiving interface in list. */ + int length; /* Length of incoming message. */ + } +EVENT_DATA; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#define EVENT_RING_SIZE (10 * sizeof (EVENT_DATA)) + +/* Tests for flags field of DHCP messages. */ + +#define ISBRDCST(X) ((X & htons(0x8000)) != 0) +#define SETBRDCST(X) ((X) |= htons(0x8000)) + +#ifndef sun +void align_msg(); +#endif +void set_srvport(); +int check_ipsum(); +int check_udpsum(); +u_short udp_cksum(); +u_short get_ipsum(); +u_short get_udpsum(); +u_short cksum(); +struct if_info *read_interfaces (struct if_info *, int *, int); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcommon_subrh */ diff --git a/h/dhcp/copyright_dhcp.h b/h/dhcp/copyright_dhcp.h new file mode 100644 index 0000000..f9d1604 --- /dev/null +++ b/h/dhcp/copyright_dhcp.h @@ -0,0 +1,48 @@ +/* copyright_dhcp.h - WIDE project copyright for DHCP implementation */ + +/* Copyright 1984 - 1996 Wind River Systems, Inc. */ + +/* +modification history +____________________ +01a,03oct96,spm created. +*/ + +/* + * WIDE Project DHCP Implementation + * Copyright (c) 1995 Akihiro Tominaga + * Copyright (c) 1995 WIDE Project + * All rights reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided only with the following + * conditions are satisfied: + * + * 1. Both the copyright notice and this permission notice appear in + * all copies of the software, derivative works or modified versions, + * and any portions thereof, and that both notices appear in + * supporting documentation. + * 2. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by WIDE Project and + * its contributors. + * 3. Neither the name of WIDE Project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND WIDE + * PROJECT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES + * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ALSO, THERE + * IS NO WARRANTY IMPLIED OR OTHERWISE, NOR IS SUPPORT PROVIDED. + * + * Feedback of the results generated from any improvements or + * extensions made to this software would be much appreciated. + * Any such feedback should be sent to: + * + * Akihiro Tominaga + * WIDE Project + * Keio University, Endo 5322, Kanagawa, Japan + * (E-mail: dhcp-dist@wide.ad.jp) + * + * WIDE project has the rights to redistribute these changes. + */ diff --git a/h/dhcp/database.h b/h/dhcp/database.h new file mode 100644 index 0000000..a3b4d0d --- /dev/null +++ b/h/dhcp/database.h @@ -0,0 +1,209 @@ +/* database.h - DHCP server include file for database functions */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,09oct01,rae merge from truestack (remove some variables) +01c,06aug97,spm added definitions for C++ compilation +01b,09may97,spm corrected declarations of hooks for storage routines +01a,07apr97,spm created by modifying WIDE project DHCP implementation +*/ + +/* + * WIDE Project DHCP Implementation + * Copyright (c) 1995 Akihiro Tominaga + * Copyright (c) 1995 WIDE Project + * All rights reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided only with the following + * conditions are satisfied: + * + * 1. Both the copyright notice and this permission notice appear in + * all copies of the software, derivative works or modified versions, + * and any portions thereof, and that both notices appear in + * supporting documentation. + * 2. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by WIDE Project and + * its contributors. + * 3. Neither the name of WIDE Project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND WIDE + * PROJECT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES + * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ALSO, THERE + * IS NO WARRANTY IMPLIED OR OTHERWISE, NOR IS SUPPORT PROVIDED. + * + * Feedback of the results generated from any improvements or + * extensions made to this software would be much appreciated. + * Any such feedback should be sent to: + * + * Akihiro Tominaga + * WIDE Project + * Keio University, Endo 5322, Kanagawa, Japan + * (E-mail: dhcp-dist@wide.ad.jp) + * + * WIDE project has the rights to redistribute these changes. + */ + +#ifndef __INCdatabaseh +#define __INCdatabaseh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * functions prototype definition + */ +void dump_bind_entry(); +static time_t strtotime(); +int bindcidcmp(); +int paramcidcmp(); +int resipcmp(); +int relayipcmp(); +time_t _mktime(); + +static void read_entry(); +int process_entry(); +void set_default(struct dhcp_resource *); +static void adjust(); +static void get_string(); +int eval_symbol(); +static void eat_whitespace(); +static long get_integer(); +static int prs_inaddr(); +static STATUS get_ip(); +static void default_netmask(); +int resnmcmp(); +static int read_idtype(); +static int read_cid(); +static int read_haddr(); +static int read_subnet(); + +int proc_sname(); +int proc_file(); +int proc_tblc(); +int proc_mtpt(); +int proc_clid(); +int proc_class(); +int proc_ip(); +int proc_ips(); +int proc_ippairs(); +int proc_hl(); +int proc_hs(); +int proc_nl(); +int proc_ns(); +int proc_octet(); +int proc_str(); +int proc_bool(); + +#define SUCCESS 0 +#define E_END_OF_ENTRY 1 + +#define MAXENTRYLEN 4096 +#define MAXSTRINGLEN 260 +#define MAX_MTUPLTSZ 127 +#define MAX_IPS 63 +#define MAX_IPPAIR 31 + +#define OP_ADDITION 1 /* Operations on tags */ +#define OP_DELETION 2 + +#ifndef BUFSIZ +#define BUFSIZ 1024 +#endif + +IMPORT FUNCPTR dhcpsLeaseHookRtn; +IMPORT FUNCPTR dhcpsAddressHookRtn; + +struct symbolmap { + char *symbol; + int code; + int (*func)(); +}; + +static struct symbolmap symbol_list[] = { + { "tblc", S_TABLE_CONT, proc_tblc }, + { "snam", S_SNAME, proc_sname }, + { "file", S_FILE, proc_file }, + { "siad", S_SIADDR, proc_ip }, + { "albp", S_ALLOW_BOOTP, proc_bool }, + { "ipad", S_IP_ADDR, proc_ip }, + { "maxl", S_MAX_LEASE, proc_hl }, + { "dfll", S_DEFAULT_LEASE, proc_hl }, + { "clid", S_CLIENT_ID, proc_clid }, + { "pmid", S_PARAM_ID, proc_clid}, + { "clas", S_CLASS_ID, proc_class}, + { "snmk", S_SUBNET_MASK, proc_ip }, + { "tmof", S_TIME_OFFSET, proc_nl }, + { "rout", S_ROUTER, proc_ips }, + { "tmsv", S_TIME_SERVER, proc_ips }, + { "nmsv", S_NAME_SERVER, proc_ips }, + { "dnsv", S_DNS_SERVER, proc_ips }, + { "lgsv", S_LOG_SERVER, proc_ips }, + { "cksv", S_COOKIE_SERVER, proc_ips }, + { "lpsv", S_LPR_SERVER, proc_ips }, + { "imsv", S_IMPRESS_SERVER, proc_ips }, + { "rlsv", S_RLS_SERVER, proc_ips }, + { "hstn", S_HOSTNAME, proc_str }, + { "btsz", S_BOOTSIZE, proc_ns }, + { "mdmp", S_MERIT_DUMP, proc_str }, + { "dnsd", S_DNS_DOMAIN, proc_str }, + { "swsv", S_SWAP_SERVER, proc_ip }, + { "rpth", S_ROOT_PATH, proc_str }, + { "epth", S_EXTENSIONS_PATH, proc_str }, + { "ipfd", S_IP_FORWARD, proc_bool }, + { "nlsr", S_NONLOCAL_SRCROUTE, proc_bool }, + { "plcy", S_POLICY_FILTER, proc_ippairs }, + { "mdgs", S_MAX_DGRAM_SIZE, proc_ns }, + { "ditl", S_DEFAULT_IP_TTL, proc_octet }, + { "mtat", S_MTU_AGING_TIMEOUT, proc_nl }, + { "mtpt", S_MTU_PLATEAU_TABLE, proc_mtpt }, + { "ifmt", S_IF_MTU, proc_ns }, + { "asnl", S_ALL_SUBNET_LOCAL, proc_bool }, + { "brda", S_BRDCAST_ADDR, proc_ip }, + { "mskd", S_MASK_DISCOVER, proc_bool }, + { "msks", S_MASK_SUPPLIER, proc_bool }, + { "rtrd", S_ROUTER_DISCOVER, proc_bool }, + { "rtsl", S_ROUTER_SOLICIT, proc_ip }, + { "strt", S_STATIC_ROUTE, proc_ippairs }, + { "trlr", S_TRAILER, proc_bool }, + { "arpt", S_ARP_CACHE_TIMEOUT, proc_nl }, + { "encp", S_ETHER_ENCAP, proc_bool }, + { "dttl", S_DEFAULT_TCP_TTL, proc_octet }, + { "kain", S_KEEPALIVE_INTER, proc_nl }, + { "kagb", S_KEEPALIVE_GARBA, proc_bool }, + { "nisd", S_NIS_DOMAIN, proc_str }, + { "nisv", S_NIS_SERVER, proc_ips }, + { "ntsv", S_NTP_SERVER, proc_ips }, + { "nnsv", S_NBN_SERVER, proc_ips }, + { "ndsv", S_NBDD_SERVER, proc_ips }, + { "nbnt", S_NB_NODETYPE, proc_octet }, + { "nbsc", S_NB_SCOPE, proc_str }, + { "xfsv", S_XFONT_SERVER, proc_ips }, + { "xdmn", S_XDISPLAY_MANAGER, proc_ips }, + { "dht1", S_DHCP_T1, proc_hs }, + { "dht2", S_DHCP_T2, proc_hs }, + { "nspd", S_NISP_DOMAIN, proc_str }, + { "nsps", S_NISP_SERVER, proc_ips }, + { "miph", S_MOBILEIP_HA, proc_ips }, + { "smtp", S_SMTP_SERVER, proc_ips }, + { "pops", S_POP3_SERVER, proc_ips }, + { "nntp", S_NNTP_SERVER, proc_ips }, + { "wwws", S_DFLT_WWW_SERVER, proc_ips }, + { "fngs", S_DFLT_FINGER_SERVER, proc_ips }, + { "ircs", S_DFLT_IRC_SERVER, proc_ips }, + { "stsv", S_STREETTALK_SERVER, proc_ips }, + { "stda", S_STDA_SERVER, proc_ips } +}; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/dhcp/dhcp.h b/h/dhcp/dhcp.h new file mode 100644 index 0000000..44f0f08 --- /dev/null +++ b/h/dhcp/dhcp.h @@ -0,0 +1,289 @@ +/* dhcp.h - Common DHCP include file for server, relay agent, and client */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* +modification history +--------------------- +01j,23apr02,wap Add prototype for dhcpTime() (SPR #68900) +01i,27jun01,ppp removed MIN LEASE since it is not supported any more (SPR + #34799) +01h,07sep00,spm moved client-specific transmit routine to private module +01g,05apr00,spm added entries for boot-time client shared code +01f,24nov99,spm upgraded to RFC 2131 and removed direct link-level access +01e,04dec97,spm added code review modifications +01d,06aug97,spm added definitions for C++ compilation +01c,02jun97,spm changed DHCP option tags to prevent name conflicts (SPR #8667) +01b,29jan97,spm added little-endian support and additional DHCP defines. +01a,03oct96,spm created by modifying WIDE project DHCP Implementation. +*/ + +#ifndef __INCdhcph +#define __INCdhcph + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * WIDE Project DHCP Implementation + * Copyright (c) 1995 Akihiro Tominaga + * Copyright (c) 1995 WIDE Project + * All rights reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided only with the following + * conditions are satisfied: + * + * 1. Both the copyright notice and this permission notice appear in + * all copies of the software, derivative works or modified versions, + * and any portions thereof, and that both notices appear in + * supporting documentation. + * 2. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by WIDE Project and + * its contributors. + * 3. Neither the name of WIDE Project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND WIDE + * PROJECT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES + * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ALSO, THERE + * IS NO WARRANTY IMPLIED OR OTHERWISE, NOR IS SUPPORT PROVIDED. + * + * Feedback of the results generated from any improvements or + * extensions made to this software would be much appreciated. + * Any such feedback should be sent to: + * + * Akihiro Tominaga + * WIDE Project + * Keio University, Endo 5322, Kanagawa, Japan + * (E-mail: dhcp-dist@wide.ad.jp) + * + * WIDE project has the rights to redistribute these changes. + */ + +#include "netinet/in.h" + +/* Tag values for DHCP options. */ + +#define _DHCP_PAD_TAG ((char) 0) +#define _DHCP_SUBNET_MASK_TAG ((char) 1) +#define _DHCP_TIME_OFFSET_TAG ((char) 2) +#define _DHCP_ROUTER_TAG ((char) 3) +#define _DHCP_TIME_SERVER_TAG ((char) 4) +#define _DHCP_NAME_SERVER_TAG ((char) 5) +#define _DHCP_DNS_SERVER_TAG ((char) 6) +#define _DHCP_LOG_SERVER_TAG ((char) 7) +#define _DHCP_COOKIE_SERVER_TAG ((char) 8) +#define _DHCP_LPR_SERVER_TAG ((char) 9) +#define _DHCP_IMPRESS_SERVER_TAG ((char) 10) +#define _DHCP_RLS_SERVER_TAG ((char) 11) +#define _DHCP_HOSTNAME_TAG ((char) 12) +#define _DHCP_BOOTSIZE_TAG ((char) 13) +#define _DHCP_MERIT_DUMP_TAG ((char) 14) +#define _DHCP_DNS_DOMAIN_TAG ((char) 15) +#define _DHCP_SWAP_SERVER_TAG ((char) 16) +#define _DHCP_ROOT_PATH_TAG ((char) 17) +#define _DHCP_EXTENSIONS_PATH_TAG ((char) 18) +#define _DHCP_IP_FORWARD_TAG ((char) 19) +#define _DHCP_NONLOCAL_SRCROUTE_TAG ((char) 20) +#define _DHCP_POLICY_FILTER_TAG ((char) 21) +#define _DHCP_MAX_DGRAM_SIZE_TAG ((char) 22) +#define _DHCP_DEFAULT_IP_TTL_TAG ((char) 23) +#define _DHCP_MTU_AGING_TIMEOUT_TAG ((char) 24) +#define _DHCP_MTU_PLATEAU_TABLE_TAG ((char) 25) +#define _DHCP_IF_MTU_TAG ((char) 26) +#define _DHCP_ALL_SUBNET_LOCAL_TAG ((char) 27) +#define _DHCP_BRDCAST_ADDR_TAG ((char) 28) +#define _DHCP_MASK_DISCOVER_TAG ((char) 29) +#define _DHCP_MASK_SUPPLIER_TAG ((char) 30) +#define _DHCP_ROUTER_DISCOVER_TAG ((char) 31) +#define _DHCP_ROUTER_SOLICIT_TAG ((char) 32) +#define _DHCP_STATIC_ROUTE_TAG ((char) 33) +#define _DHCP_TRAILER_TAG ((char) 34) +#define _DHCP_ARP_CACHE_TIMEOUT_TAG ((char) 35) +#define _DHCP_ETHER_ENCAP_TAG ((char) 36) +#define _DHCP_DEFAULT_TCP_TTL_TAG ((char) 37) +#define _DHCP_KEEPALIVE_INTERVAL_TAG ((char) 38) +#define _DHCP_KEEPALIVE_GARBAGE_TAG ((char) 39) +#define _DHCP_NIS_DOMAIN_TAG ((char) 40) +#define _DHCP_NIS_SERVER_TAG ((char) 41) +#define _DHCP_NTP_SERVER_TAG ((char) 42) +#define _DHCP_VENDOR_SPEC_TAG ((char) 43) +#define _DHCP_NBN_SERVER_TAG ((char) 44) +#define _DHCP_NBDD_SERVER_TAG ((char) 45) +#define _DHCP_NB_NODETYPE_TAG ((char) 46) +#define _DHCP_NB_SCOPE_TAG ((char) 47) +#define _DHCP_XFONT_SERVER_TAG ((char) 48) +#define _DHCP_XDISPLAY_MANAGER_TAG ((char) 49) +#define _DHCP_REQUEST_IPADDR_TAG ((char) 50) +#define _DHCP_LEASE_TIME_TAG ((char) 51) +#define _DHCP_OPT_OVERLOAD_TAG ((char) 52) +#define _DHCP_MSGTYPE_TAG ((char) 53) +#define _DHCP_SERVER_ID_TAG ((char) 54) +#define _DHCP_REQ_LIST_TAG ((char) 55) +#define _DHCP_ERRMSG_TAG ((char) 56) +#define _DHCP_MAXMSGSIZE_TAG ((char) 57) +#define _DHCP_T1_TAG ((char) 58) +#define _DHCP_T2_TAG ((char) 59) +#define _DHCP_CLASS_ID_TAG ((char) 60) +#define _DHCP_CLIENT_ID_TAG ((char) 61) +#define _DHCP_NISP_DOMAIN_TAG ((char) 64) +#define _DHCP_NISP_SERVER_TAG ((char) 65) +#define _DHCP_TFTP_SERVERNAME_TAG ((char) 66) +#define _DHCP_BOOTFILE_TAG ((char) 67) +#define _DHCP_MOBILEIP_HA_TAG ((char) 68) +#define _DHCP_SMTP_SERVER_TAG ((char) 69) +#define _DHCP_POP3_SERVER_TAG ((char) 70) +#define _DHCP_NNTP_SERVER_TAG ((char) 71) +#define _DHCP_DFLT_WWW_SERVER_TAG ((char) 72) +#define _DHCP_DFLT_FINGER_SERVER_TAG ((char) 73) +#define _DHCP_DFLT_IRC_SERVER_TAG ((char) 74) +#define _DHCP_STREETTALK_SERVER_TAG ((char) 75) +#define _DHCP_STDA_SERVER_TAG ((char) 76) +#define _DHCP_END_TAG ((char) 255) + +#define _DHCP_LAST_OPTION _DHCP_STDA_SERVER_TAG +#define _DHCP_MAX_OPTLEN 255 + +/* + * Hardware type values from the arp section of the assigned numbers RFC. + * (Frequently used as client identifier types). + */ + +#define ETHER 1 /* Ethernet (10Mb) */ +#define EXPETHER 2 /* Experimental Ethernet (3Mb) */ +#define AX25 3 /* Amateur Radio AX.25 */ +#define PRONET 4 /* Proteon ProNET Token Ring */ +#define CHAOS 5 /* Chaos */ +#define IEEE802 6 /* IEEE 802 Networks */ +#define ARCNET 7 /* ARCNET */ +#define HYPERCH 8 /* Hyperchannel */ +#define LANSTAR 9 /* Lanstar */ +#define AUTONET 10 /* Autonet Short Address */ +#define LOCALTALK 11 /* LocalTalk */ +#define LOCALNET 12 /* LocalNet */ +#define ULTRALINK 13 /* Ultra link */ +#define FRAMERELAY 15 /* Frame Relay */ +#define SERIAL 20 /* Serial Line */ +#define DNS_NAME 128 /* DNS name */ + +/* Definitions for DHCP message format. */ + +#define MAX_HLEN 16 /* maximum length of haddr field */ +#define MAX_SNAME 64 +#define MAX_FILE 128 +#define DFLTOPTLEN 312 +#define BOOTPOPTLEN 64 +#define MAXOPT 0xff +#define INFINITY 0xffffffff + +/* Definitions for ARP messages. */ + +#define MAX_ARPLEN (sizeof (struct arphdr) + 2 * (MAX_HLEN + 4)) +#define ARPHL (sizeof (struct arphdr)) + +#if CPU_FAMILY==I960 +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* DHCP message format */ + +struct dhcp + { + unsigned char op; /* packet type */ + unsigned char htype; /* Link-level interface address type */ + unsigned char hlen; /* Link-level interface address length */ + unsigned char hops; /* Hops through DHCP relay agents */ + unsigned long xid; /* transaction ID */ + unsigned short secs; /* seconds since lease negotiation started */ + unsigned short flags; + struct in_addr ciaddr; /* Client's current IP address */ + struct in_addr yiaddr; /* Client's assigned IP address */ + struct in_addr siaddr; /* Address of (tftp) server */ + struct in_addr giaddr; /* Address of relay agent */ + char chaddr [MAX_HLEN]; /* Client's hardware address */ + char sname [MAX_SNAME]; /* Host name of DHCP server */ + char file [MAX_FILE]; /* File name of boot image */ + char options [DFLTOPTLEN]; /* DHCP message options */ + }; + +struct ps_udph /* pseudo udp header for checksum */ + { + struct in_addr srcip; + struct in_addr dstip; + char zero; + char prto; + short ulen; + }; + +#if CPU_FAMILY==I960 +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* Definitions for processing incoming DHCP messages */ + +#define DHCP_MSG_SIZE (DFLTDHCPLEN + UDPHL + IPHL) +#define MESSAGE_RING_SIZE (10 * DHCP_MSG_SIZE) +#define DFLTDHCPLEN sizeof (struct dhcp) /* default DHCP message size */ +#define DFLTBOOTPLEN (DFLTDHCPLEN - DFLTOPTLEN + BOOTPOPTLEN) +#define DHCPLEN(UDP) (ntohs(UDP->uh_ulen) - UDPHL) /* get DHCP msg size */ + /* from UDP header */ +#define OPTBODY(TAGP) ( ( (char *)TAGP) + 2) /* get DHCP option contents */ +#define DHCPOPTLEN(TAGP) ((UINT8) * ( ((char *)TAGP) + 1)) /* option length */ + +/* handle the word alignment */ +#define GETHS(PTR) (*((u_char *)PTR)*256 + *(((u_char *)PTR)+1)) +#define GETHL(PTR) (*((u_char *)PTR)*256*256*256 + *(((u_char *)PTR)+1)*256*256 +\ + *(((u_char *)PTR)+2)*256 + *(((u_char *)PTR)+3)) + +/* Bit operators for options flags. */ + +#define SETBIT(a,i) ((a)[(i) / 8] |= (1 << (7 - (i) % 8))) +#define CLRBIT(a,i) ((a)[(i) / 8] &= ~(1 << (7 - (i) % 8))) +#define ISSET(a,i) ((a)[(i) / 8] & (1 << (7 - (i) % 8))) +#define ISCLR(a,i) (((a)[(i) / 8] & (1 << (7 - (i) % 8))) == 0) + +#define BOOTREQUEST 1 +#define BOOTREPLY 2 + + +/* + * DHCP/BOOTP magic cookie defined in RFC 1048 + */ + +#define RFC1048_MAGIC { 99, 130, 83, 99 } +#define MAGIC_LEN 4 + +/* DHCP message types */ + +#define DHCPDISCOVER 1 +#define DHCPOFFER 2 +#define DHCPREQUEST 3 +#define DHCPDECLINE 4 +#define DHCPACK 5 +#define DHCPNAK 6 +#define DHCPRELEASE 7 +#define DHCPINFORM 8 +#define BOOTP 0 + +/* Classification of DHCP message fields */ + +#define FILE_ISOPT 1 +#define SNAME_ISOPT 2 +#define BOTH_AREOPT FILE_ISOPT + SNAME_ISOPT + +/* Common routines for all DHCP components */ + +IMPORT int dhcpConvert (int); +IMPORT char * pickup_opt (struct dhcp *, int, char); +IMPORT u_short udp_cksum (struct ps_udph *, char *, int); +IMPORT time_t dhcpTime (time_t *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/dhcp/dhcpc.h b/h/dhcp/dhcpc.h new file mode 100644 index 0000000..dcd84e7 --- /dev/null +++ b/h/dhcp/dhcpc.h @@ -0,0 +1,350 @@ +/* dhcpc.h - DHCP runtime client include file for shared definitions */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* +modification history +--------------------- +01k,12dec01,wap Interface name field of if_info structure is too small for + some interface names (SPR #29087) +01j,31oct01,vvv fixed warnings when BOOTP and DHCP are included in image +01i,09oct01,rae merge from truestack ver 01b/2 base 01h (SPRs 69850, 68014) +01h,05apr00,spm removed unused offset (BPF provides required alignment) +01g,24nov99,spm upgraded to RFC 2131 and removed direct link-level access +01f,06oct97,spm split interface name into device name and unit number +01e,06aug97,spm removed parameters linked list to reduce memory required; + added definitions for C++ compilation; renamed class field + of dhcp_reqspec structure to prevent C++ errors (SPR #9079) +01d,02jun97,spm changed DHCP option tags to prevent name conflicts (SPR #8667) +01c,07apr97,spm removed #define's now in configAll.h, changed router_solicit + field in parameter descriptor from pointer to structure +01b,03jan97,spm added little-endian support and moved macros to dhcp.h +01a,03oct96,spm created by modifying WIDE project DHCP implementation +*/ + +#ifndef __INCdhcpch +#define __INCdhcpch + +#ifdef __cplusplus +extern "C" { +#endif + +#include "wdLib.h" + +#include "netinet/in.h" +#include "netinet/if_ether.h" + +#include "dhcp/dhcp.h" +#include "dhcp/copyright_dhcp.h" + +#define ETHERHL sizeof(struct ether_header) + +#ifndef IPHL +#define IPHL sizeof(struct ip) +#endif + +#ifndef UDPHL +#define UDPHL sizeof(struct udphdr) +#endif + +#define WORD 4 /* Multiplier for IP header length field */ + +/* Notification routine event types. */ + +#define DHCPC_LEASE_NEW 0 +#define DHCPC_LEASE_INVALID 1 + +/* DHCP client operations to access permanent storage. */ + +#define DHCP_CACHE_READ 0 +#define DHCP_CACHE_WRITE 1 +#define DHCP_CACHE_ERASE 2 + +#if CPU_FAMILY==I960 +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +struct client_id + { + /* + * The DHCP client identifer consists of a string of characters. + * Typically, the client identifier contains a type value (from the + * hardware type values in the ARP section of the assigned numbers + * RFC) followed by the hardware address from the data link layer. + */ + + unsigned char len; + char * id; + }; + +struct request_list + { + /* + * This structure defines the contents of the option request list, which + * consists of a sequence of DHCP option tags of the indicated length. + * A DHCP server may provide any, all, or none of the specified options + * to the requesting client. + */ + + u_char len; /* Length of request list. */ + char list [0xff]; /* Storage for option tags. */ + }; + +struct vendor_list + { + /* + * This structure defines the components of vendor-specific information + * which may be returned by a DHCP server. The contents of that option + * are not defined by the DHCP specification. + */ + + u_char len; /* Amount of vendor-specific data. */ + char list [255]; /* Contents of vendor-specific data. */ + }; + +/* + * Request specification for DHCP lease - partially filled by + * dhcpcOptionSet() and/or dhcpcOptionAdd() routines. + */ + +struct dhcp_reqspec + { + u_short maxlen; /* Maximum supported DHCP message */ + u_short optlen; /* Length of message's option field. */ + int waitsecs; /* Duration for collecting additional lease offers. */ + struct in_addr ipaddr; /* Requested IP address */ + struct in_addr srvaddr; /* IP address of DHCP server */ + struct request_list reqlist; /* List of requested options */ + struct client_id * clid; /* Client identifier */ + char * dhcp_errmsg; + struct dhcpcOpts * pOptList; /* Suggested values for options */ + char * pOptions; /* Derived options field contents */ + }; + +struct in_addrs + { + /* + * This structure defines the components of a list of IP addresses. + * Some of the options provided by the DHCP server use this format. + */ + + unsigned char num; /* Number of IP addresses returned. */ + struct in_addr * addr; /* IP address values. */ + }; + +struct u_shorts + { + /* + * This structure defines a list of 16-bit numbers used for some of + * the DHCP options. + */ + + unsigned char num; /* Number of 16-bit values returned. */ + unsigned short * shortnum; /* List of values returned. */ + }; + +#define MAXTAGNUM (_DHCP_LAST_OPTION + 1) +#define OPTMASKSIZE (MAXTAGNUM / 8 + 1 ) + +/* Options storage structure - used by the dhcpcOptionAdd () routine. */ + +struct dhcpcOpts + { + int optlen; /* Current total size of option data */ + char optmask [OPTMASKSIZE]; /* indicates available entries */ + ULONG tag1; /* subnet mask value */ + long tag2; /* time offset value */ + UCHAR * pTag3; /* router address values */ + UCHAR * pTag4; /* time server address values */ + UCHAR * pTag5; /* name server address values */ + UCHAR * pTag6; /* domain name server address values */ + UCHAR * pTag7; /* log server address values */ + UCHAR * pTag8; /* cookie server address values */ + UCHAR * pTag9; /* LPR server address values */ + UCHAR * pTag10; /* Impress server address values */ + UCHAR * pTag11; /* Resource location server address values */ + char * pTag12; /* Host name value */ + USHORT tag13; /* Boot file size value */ + char * pTag14; /* Merit dump file value */ + char * pTag15; /* Domain name value */ + ULONG tag16; /* Swap server value */ + char * pTag17; /* Root path value */ + char * pTag18; /* Extensions path value */ + UCHAR tag19; /* IP Forwarding flag value */ + UCHAR tag20; /* Non-local source routing flag value */ + UCHAR * pTag21; /* Policy filter address/mask values */ + USHORT tag22; /* Maximum datagram size value */ + UCHAR tag23; /* Default IP TTL value */ + ULONG tag24; /* Path MTU aging timeout value */ + UCHAR * pTag25; /* Path MTU plateau table values */ + USHORT tag26; /* MTU size value */ + UCHAR tag27; /* All subnets local flag value */ + ULONG tag28; /* Broadcast address value */ + UCHAR tag29; /* Mask discovery flag value */ + UCHAR tag30; /* Mask supplier flag value */ + UCHAR tag31; /* Router discovery flag value */ + ULONG tag32; /* Router soliciation address value */ + UCHAR * pTag33; /* Static route address/mask values */ + UCHAR tag34; /* Trailer encapsulation flag value */ + ULONG tag35; /* ARP cache timeout value */ + UCHAR tag36; /* Ethernet encapsulation flag value */ + UCHAR tag37; /* Default TCP TTL value */ + ULONG tag38; /* TCP keepalive interval value */ + UCHAR tag39; /* TCP keepalive garbage octet flag value */ + char * pTag40; /* NIS domain value */ + UCHAR * pTag41; /* NIS server address values */ + UCHAR * pTag42; /* NTP server address values */ + UCHAR * pTag43; /* Vendor specific information value */ + UCHAR * pTag44; /* NetBIOS name server address values */ + UCHAR * pTag45; /* NBDD server address values */ + UCHAR tag46; /* NetBIOS node type value */ + char * pTag47; /* NetBIOS scope value */ + UCHAR * pTag48; /* X Windows font server address values */ + UCHAR * pTag49; /* X Windows display manager address values */ + /* Tag 50 may not be set manually. */ + ULONG tag51; /* Lease time value */ + /* Tags 52, 53, 54 and 57 may not be set manually. */ + UCHAR * pTag55; /* Parameter request list value */ + char * pTag56; /* Error message value */ + ULONG tag58; /* Renewal time value */ + ULONG tag59; /* Rebinding time value */ + UCHAR * pTag60; /* Class identifier value */ + UCHAR * pTag61; /* Client identifier value */ + /* Tags 62 and 63 are currently undefined. */ + char * pTag64; /* NIS+ domain value */ + UCHAR * pTag65; /* NIS+ server address values */ + char * pTag66; /* TFTP server name value */ + char * pTag67; /* Boot file name value */ + UCHAR * pTag68; /* Mobile IP home agent address values */ + UCHAR * pTag69; /* SMTP server address values */ + UCHAR * pTag70; /* POP server address values */ + UCHAR * pTag71; /* NNTP server address values */ + UCHAR * pTag72; /* WWW server address values */ + UCHAR * pTag73; /* Finger server address values */ + UCHAR * pTag74; /* IRC server address values */ + UCHAR * pTag75; /* StreetTalk server address values */ + UCHAR * pTag76; /* STDA server address values */ + }; + +/* Parameter retrieval structure - used by the dhcpcParamsGet () routine. */ + +struct dhcp_param + { + char got_option [OPTMASKSIZE]; + char msgtype; /* DHCP reply or BOOTP reply? */ + char * sname; /* Host name of DHCP server */ + char * temp_sname; /* Server host name if 'sname' holds options. */ + char * file; /* Boot file name */ + char * temp_file; /* File name if 'file' holds options. */ + char * hostname; /* Host name of bootstrap server */ + char * merit_dump; + char * dns_domain; + char * root_path; + char * extensions_path; + char * nis_domain; + char * nb_scope; /* NetBIOS scope */ + char * errmsg; + char * nisp_domain; /* NIS+ domain name */ + unsigned char ip_forward; /* Boolean flag */ + unsigned char nonlocal_srcroute; /* Boolean flag */ + unsigned char all_subnet_local; /* Boolean flag */ + unsigned char mask_discover; /* Boolean flag */ + unsigned char mask_supplier; /* Boolean flag */ + unsigned char router_discover; /* Boolean flag */ + unsigned char trailer; /* Boolean flag */ + unsigned char ether_encap; /* Boolean flag */ + unsigned char keepalive_garba; /* Boolean flag */ + unsigned char nb_nodetype; /* NetBIOS node type */ + +#define BNODE 0x1 +#define PNODE 0x2 +#define MNODE 0x4 +#define HNODE 0x8 + unsigned char default_ip_ttl; /* time to live (1 - 255) */ + unsigned char default_tcp_ttl; + unsigned short bootsize; /* bootfile size in 16 bits */ + unsigned short max_dgram_size; /* max dgram reassembly */ + unsigned short intf_mtu; /* interface mtu */ + long time_offset; /* 32 bits integer (network byte order) + offset from UTC */ + unsigned long lease_origin; /* DHCP lease start time */ + unsigned long lease_duration; /* DHCP lease duration */ + unsigned long dhcp_t1; + unsigned long dhcp_t2; + unsigned long mtu_aging_timeout; /* 32 bit unsigned integer */ + unsigned long arp_cache_timeout; + unsigned long keepalive_inter; + struct u_shorts * mtu_plateau_table; /* array of 16 bit integers */ + struct in_addr server_id; /* DHCP server's IP address */ + struct in_addr ciaddr; /* Client's current address */ + struct in_addr yiaddr; /* Client's assigned address */ + struct in_addr siaddr; /* Address of (tftp) server */ + struct in_addr giaddr; /* Address of relay agent */ + struct in_addr * subnet_mask; + struct in_addr * swap_server; + struct in_addr * brdcast_addr; + struct in_addr router_solicit; + struct in_addrs * router; + struct in_addrs * time_server; + struct in_addrs * name_server; + struct in_addrs * dns_server; /* DNS server */ + struct in_addrs * log_server; + struct in_addrs * cookie_server; + struct in_addrs * lpr_server; + struct in_addrs * impress_server; + struct in_addrs * rls_server; /* Resource Location Server */ + struct in_addrs * policy_filter; + struct in_addrs * static_route; + struct in_addrs * nis_server; + struct in_addrs * ntp_server; + struct in_addrs * nbn_server; /* NetBIOS name server */ + struct in_addrs * nbdd_server; /* NetBIOS dgram distrib server */ + struct in_addrs * xfont_server; /* X font erver */ + struct in_addrs * xdisplay_manager; /* X display manager */ + struct in_addrs * nisp_server; /* NIS+ server */ + struct in_addrs * mobileip_ha; /* Mobile IP Home Agent */ + struct in_addrs * smtp_server; + struct in_addrs * pop3_server; + struct in_addrs * nntp_server; + struct in_addrs * dflt_www_server; + struct in_addrs * dflt_finger_server; + struct in_addrs * dflt_irc_server; + struct in_addrs * streettalk_server; + struct in_addrs * stda_server; /* StreetTalk Directory Assistance */ + struct vendor_list * vendlist; /* Vendor-specific information */ + }; + +struct chaddr + { + unsigned char htype; + unsigned char hlen; + char haddr[MAX_HLEN]; + }; + +struct if_info + { + char name [IFNAMSIZ]; + short unit; + int bpfDev; /* BPF file descriptor */ + int bufSize; /* Size of BPF data buffer */ + struct chaddr haddr; + struct ifnet * iface; + }; + + +struct msg + { + struct ip *ip; + struct udphdr *udp; + struct dhcp *dhcp; + }; + +#if CPU_FAMILY==I960 +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/dhcp/dhcpcBoot.h b/h/dhcp/dhcpcBoot.h new file mode 100644 index 0000000..e3cbdfb --- /dev/null +++ b/h/dhcp/dhcpcBoot.h @@ -0,0 +1,88 @@ +/* dhcpcBoot.h - DHCP client include file for boot-time internal usage */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,05nov01,vvv fixed compilation warning +01f,09oct01,rae merge from truestack +01e,05apr00,spm upgraded to RFC 2131 and removed direct link-level access; + removed entries shared with run-time client +01d,04dec97,spm added code review modifications +01c,06oct97,spm added support for dynamic driver type detection +01b,02sep97,spm removed name conflicts with runtime DHCP client (SPR #9241) +01a,26aug97,spm created to preserve single-lease interface at boot time + from existing include files - 01f of dhcpClientCommon.h, + 01d of dhcp.h, 01c of dhcpCommonSubr.h, and 01e of dhcpc.h +*/ + +#ifndef __INCdhcpcBooth +#define __INCdhcpcBooth + +#ifdef __cplusplus +extern "C" { +#endif + +#include "net/if.h" +#include "netinet/in.h" +#include "netinet/if_ether.h" + +#include "dhcp/dhcpc.h" + +/* Define sources for events. */ + +#define DHCP_AUTO_EVENT 0 + +/* Define types of events. */ + +#define DHCP_MSG_ARRIVED 0 +#define DHCP_TIMEOUT 1 + +/* Status of DHCP client. */ + +#define DHCP_MANUAL 0 /* IP address assigned manually. */ +#define DHCP_BOOTP 1 /* Lease established using BOOTP reply. */ +#define DHCP_NATIVE 2 /* Lease established using DHCP reply. */ + +/* DHCP boot-time client state definitions */ + +#define INIT 0 +#define WAIT_OFFER 1 +#define SELECTING 2 +#define REQUESTING 3 +#define BOUND 4 +#define INFORMING 5 + +/* DHCP client message processing definitions */ + +#define CHKOFF(LEN) (offopt + 2 + (LEN) < DFLTOPTLEN) /* check option offset */ + +#define WORD 4 + +#define EVENT_RING_SIZE (10 * sizeof (EVENT_DATA)) + +IMPORT int dhcpcBindType; /* Type of DHCP lease, if any. */ + +IMPORT struct dhcp_param * dhcpcBootParam; /* Configuration parameters */ + +/* Mirror variables for values assigned externally when building image. */ + +IMPORT int dhcpcMinLease; /* Minimum lease length accepted. */ +IMPORT int _dhcpcReadTaskPriority; /* Priority level of data retriever */ +IMPORT int _dhcpcReadTaskOptions; /* Option settings of data retriever */ +IMPORT int _dhcpcReadTaskStackSize; /* Stack size of data retriever */ +IMPORT int dhcpcReadTaskId; /* Identifier for data retrieval task */ + +/* + * Access point to start message exchanges for lease negotation, or for + * additional configuration parameters if an address is already known. + */ + +IMPORT int dhcp_boot_client (struct if_info *, int, int, BOOL); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/dhcp/dhcpcCommonLib.h b/h/dhcp/dhcpcCommonLib.h new file mode 100644 index 0000000..585b94c --- /dev/null +++ b/h/dhcp/dhcpcCommonLib.h @@ -0,0 +1,177 @@ +/* dhcpcCommonLib.h - common include file for run-time and boot-time client */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01m,08jan02,wap fix duplicate error codes (SPR #72103) +01l,09oct01,rae merge from truestack (SPR 69850) +01k,07sep00,spm moved client-specific transmit routine from shared module +01j,05apr00,spm added entries for boot-time client shared code +01i,24nov99,spm upgraded to RFC 2131 and removed direct link-level access +01h,17mar99,spm enabled dhcpcRelease() routine (SPR #25482) +01g,06oct97,spm added relative paths to #include statements; removed warnings +01f,06aug97,spm removed parameters linked list to reduce memory required; + added definitions for C++ compilation +01e,10jun97,spm isolated incoming messages in state machine from input hooks +01d,06may97,spm added DHCPC_OFF to align IP header on four byte boundary +01c,07apr97,spm added shutdown return code +01b,29jan97,spm added little-endian support and modified for coding standards +01a,03oct96,spm created by modifying WIDE project DHCP implementation +*/ + +#ifndef __INCdhcpClientCommonh +#define __INCdhcpClientCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "dhcp/dhcpc.h" +#include "rngLib.h" + +#define S_dhcpcLib_NOT_INITIALIZED (M_dhcpcLib | 1) +#define S_dhcpcLib_BAD_DEVICE (M_dhcpcLib | 2) +#define S_dhcpcLib_MAX_LEASES_REACHED (M_dhcpcLib | 3) +#define S_dhcpcLib_MEM_ERROR (M_dhcpcLib | 4) +#define S_dhcpcLib_BAD_COOKIE (M_dhcpcLib | 5) +#define S_dhcpcLib_NOT_BOUND (M_dhcpcLib | 6) +#define S_dhcpcLib_BAD_OPTION (M_dhcpcLib | 7) +#define S_dhcpcLib_OPTION_NOT_PRESENT (M_dhcpcLib | 8) +#define S_dhcpcLib_TIMER_ERROR (M_dhcpcLib | 9) +#define S_dhcpcLib_OPTION_NOT_STORED (M_dhcpcLib | 10) + +/* Define sources for events. */ + +#define DHCP_AUTO_EVENT 0 +#define DHCP_USER_EVENT 1 + +/* Define types of events. */ + +#define DHCP_MSG_ARRIVED 0 +#define DHCP_TIMEOUT 1 +#define DHCP_USER_BIND 2 +#define DHCP_USER_VERIFY 3 +#define DHCP_USER_RELEASE 4 +#define DHCP_USER_SHUTDOWN 5 +#define DHCP_USER_INFORM 6 + +/* State transition definitions (besides OK or ERROR). */ + +#define DHCPC_DONE 2 /* Lease relinquished or expired - exit. */ +#define DHCPC_MORE 3 /* Call a second routine when processing. */ +#define DHCPC_STATE_BEGIN 6 /* Initial processing after DHCPC_MORE. */ + +/* Return codes indicate special situations related to state machine. */ + +#define DHCPC_SHUTDOWN 11 +#define DHCPC_ERROR 12 + +/* Classification of DHCP client leases. */ + +#define DHCP_MANUAL 0 /* Lease established after system boot. */ +#define DHCP_BOOTP 1 /* Lease established using BOOTP reply. */ +#define DHCP_NATIVE 2 /* Lease established using DHCP reply. */ +#define DHCP_AUTOMATIC 3 /* Bound at boot time - lease still valid. */ + +/* Internal settings for state machine */ + +#define FIRSTTIMER 4 +#define MAXTIMER 64 +#define INIT_WAITING 10 +#define DISCOVER_RETRANS 4 + +#if CPU_FAMILY==I960 +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct leaseData /* Lease-specific variables. */ + { + BOOL initFlag; /* Lease initialized? */ + BOOL waitFlag; /* Synchronous or asynchronous bind attempt? */ + BOOL autoConfig; /* Apply parameters to network interface? */ + BOOL oldFlag; /* Use old (padded) DHCP message formats? */ + SEM_ID leaseSem; /* Blocking semaphore for synchronous bind. */ + BOOL leaseGood; /* Bind attempt successful? */ + char * msgBuffer; + int leaseType; /* Static or dynamic parameters, or BOOTP. */ + int prevState; /* Preceding state in state machine. */ + int currState; /* Current/next state in state machine. */ + WDOG_ID timer; /* Timeout interval for DHCP events */ + time_t initEpoch; /* Timestamp of last request. */ + int timeout; /* Current timeout interval. */ + int numRetry; /* Number of retransmission timeouts. */ + FUNCPTR eventHookRtn; /* Event notification hook */ + FUNCPTR cacheHookRtn; /* Data storage hook */ + struct dhcp_reqspec leaseReqSpec; /* Options request list */ + struct if_info ifData; /* Transmit/receive interface */ + unsigned long xid; /* Current transaction ID. */ + struct dhcp_param *dhcpcParam; /* Current configuration parameters */ + } +LEASE_DATA; + +typedef struct messageData /* Storage for incoming DHCP messages */ + { + BOOL writeFlag; /* Buffer available? */ + char *msgBuffer; /* Data buffer contents (copied from BPF) */ + } +MESSAGE_DATA; + +typedef struct dhcpcEvent /* External event descriptor. */ + { + unsigned char source; /* Automatic event or manual event? */ + unsigned char type; /* Manual event - defines user request. + * Automatic - message arrival or timeout. + */ + void * leaseId; /* Cookie assigned by dhcpcInit (). */ + int slot; /* Offset of message buffer in list. */ + char * pMsg; /* Start of DHCP message */ + BOOL lastFlag; /* Release buffer when finished processing? */ + } +EVENT_DATA; + +/* Values for lease established during system boot. */ + +typedef struct dhcpLeaseData + { + struct in_addr yiaddr; /* assigned IP address */ + unsigned long lease_origin; /* start time of lease */ + unsigned long lease_duration; /* length of lease */ + } +DHCP_LEASE_DATA; + +struct buffer /* transmission buffer for DHCP messages */ + { + char * buf; + int size; + }; + +#if CPU_FAMILY==I960 +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#define EVENT_RING_SIZE (10 * sizeof (EVENT_DATA)) + +IMPORT RING_ID dhcpcEventRing; /* Ring buffer of DHCP events */ +IMPORT SEM_ID dhcpcEventSem; /* DHCP event notification */ + +IMPORT BOOL dhcpcInitialized; +IMPORT DHCP_LEASE_DATA dhcpcBootLease; /* Settings from boot-time lease. */ +IMPORT LEASE_DATA ** dhcpcLeaseList; /* List of available cookies. */ +IMPORT MESSAGE_DATA * dhcpcMessageList; /* Incoming DHCP messages. */ +IMPORT int dhcpcMaxLeases; /* Max. number of simultaneous leases. */ +IMPORT void dhcpcOptFieldCreate (struct dhcpcOpts *, UCHAR *); +IMPORT void dhcpcDefaultsSet (struct dhcp_param *); +IMPORT void dhcpcParamsCopy (LEASE_DATA *, struct dhcp_param *); +IMPORT STATUS dhcpcArpSend (struct ifnet *, char *, int); +IMPORT STATUS dhcpSend (struct ifnet *, struct sockaddr_in *, + char *, int, BOOL); +IMPORT STATUS dhcpcEventAdd (int, int, void *, BOOL); +IMPORT void dhcpcLeaseCleanup (LEASE_DATA *); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/dhcp/dhcpcInit.h b/h/dhcp/dhcpcInit.h new file mode 100644 index 0000000..9053214 --- /dev/null +++ b/h/dhcp/dhcpcInit.h @@ -0,0 +1,42 @@ +/* dhcpcInit.h - DHCP runtime client include file for system startup */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* +modification history + +--------------------- +01g,09oct01,rae merge from truestack: update dhcpcConfigSet call +01f,24nov99,spm upgraded to RFC 2131 and removed direct link-level access +01e,06aug97,spm removed parameters linked list to reduce memory required; + added definitions for C++ compilation; renamed class field + of dhcp_reqspec structure to prevent C++ errors (SPR #9079) +01d,02jun97,spm changed DHCP option tags to prevent name conflicts (SPR #8667) +01c,07apr97,spm removed #define's now in configAll.h, changed router_solicit + field in parameter descriptor from pointer to structure +01b,03jan97,spm added little-endian support and moved macros to dhcp.h +01a,03oct96,spm created by modifying WIDE project DHCP implementation +*/ + +#ifndef __INCdhcpcInith +#define __INCdhcpcInith + +#ifdef __cplusplus +extern "C" { +#endif + +#include "bootLib.h" + +/* Functions called at system startup. */ + +IMPORT STATUS dhcpcShowInit (void); +IMPORT STATUS dhcpcLibInit (int, int, int, int, int, int, int); +IMPORT STATUS dhcpcLeaseGet (char *, BOOL *); +IMPORT STATUS dhcpcConfigSet (BOOT_PARAMS *, char *, int *, BOOL * pDhcpStatus, + BOOL configFlag); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/dhcp/dhcpcInternal.h b/h/dhcp/dhcpcInternal.h new file mode 100644 index 0000000..b48b60c --- /dev/null +++ b/h/dhcp/dhcpcInternal.h @@ -0,0 +1,95 @@ +/* dhcpcInternal.h - DHCP runtime client include file for internal usage */ + +/* Copyright 1984 - 2000 Wind River Systems, Inc. */ + +/* +modification history +____________________ +01g,05apr00,spm removed entries shared with boot-time client +01f,24nov99,spm upgraded to RFC 2131 and removed direct link-level access +01e,04dec97,spm added code review modifications +01d,06oct97,spm added relative paths to #include statements +01c,06aug97,spm added definitions for C++ compilation +01b,27jan97,spm added support for little-endian architectures +01a,03oct96,spm created by modifying WIDE project DHCP Implementation +*/ + +#ifndef __INCdhcpcInternalh +#define __INCdhcpcInternalh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "netinet/in.h" + +#include "dhcp/copyright_dhcp.h" +#include "dhcp/dhcp.h" +#include "dhcp/dhcpc.h" +#include "dhcp/dhcpcCommonLib.h" + +IMPORT struct buffer sbuf; +IMPORT struct ps_udph spudph; +IMPORT struct msg dhcpcMsgIn; +IMPORT struct msg dhcpcMsgOut; +IMPORT unsigned char dhcpCookie [MAGIC_LEN]; + +IMPORT int initialize (int, int, int); +IMPORT int init (EVENT_DATA *); +IMPORT int wait_offer (EVENT_DATA *); +IMPORT int selecting (EVENT_DATA *); +IMPORT int requesting (EVENT_DATA *); +IMPORT int bound (EVENT_DATA *); +IMPORT int renewing (EVENT_DATA *); +IMPORT int rebinding (EVENT_DATA *); +IMPORT int init_reboot (EVENT_DATA *); +IMPORT int verify (EVENT_DATA *); +IMPORT int reboot_verify (EVENT_DATA *); +IMPORT int inform (EVENT_DATA *); + +IMPORT void dhcpcPrivateCleanup (void); + +IMPORT int config_if (struct if_info *, struct in_addr *, + struct in_addr *, struct in_addr *); +IMPORT void set_route (struct dhcp_param *); +IMPORT void down_if (struct if_info *); +IMPORT void reset_if (struct if_info *); + +IMPORT void align_msg (struct msg *, char *); +IMPORT char * pickup_opt (struct dhcp *, int, char); +IMPORT int dhcp_msgtoparam (struct dhcp *, int, struct dhcp_param *); +IMPORT int arp_check (struct in_addr *, struct if_info *); +IMPORT int arp_reply (struct in_addr *, struct if_info *); +IMPORT int merge_param (struct dhcp_param *, struct dhcp_param *); +IMPORT int clean_param (struct dhcp_param *); + +IMPORT int make_discover (LEASE_DATA *, BOOL); +IMPORT int make_request (LEASE_DATA *, int, BOOL); +IMPORT long generate_xid (struct if_info *); +IMPORT int send_unicast (struct in_addr *, struct dhcp *, int); +IMPORT int gen_retransmit (LEASE_DATA *, int); + +IMPORT void set_declinfo (struct dhcp_reqspec *, LEASE_DATA *, char *, int); +IMPORT int dhcp_decline (struct dhcp_reqspec *, struct if_info *); +IMPORT void set_relinfo (struct dhcp_reqspec *, LEASE_DATA *, char *); +IMPORT int dhcp_release (struct dhcp_reqspec *, struct if_info *, BOOL); + +IMPORT int use_parameter (struct dhcp_param *, LEASE_DATA *); +IMPORT void release (LEASE_DATA *, BOOL); + +IMPORT int handle_ip (char *, struct dhcp_param *); +IMPORT int handle_num (char *, struct dhcp_param *); +IMPORT int handle_ips (char *, struct dhcp_param *); +IMPORT int handle_str (char *, struct dhcp_param *); +IMPORT int handle_bool (char *, struct dhcp_param *); +IMPORT int handle_ippairs (char *, struct dhcp_param *); +IMPORT int handle_nums (char *, struct dhcp_param *); +IMPORT int handle_list (char *, struct dhcp_param *); + +IMPORT int (*handle_param[MAXTAGNUM])(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/dhcp/dhcpcShow.h b/h/dhcp/dhcpcShow.h new file mode 100644 index 0000000..8e21a66 --- /dev/null +++ b/h/dhcp/dhcpcShow.h @@ -0,0 +1,27 @@ +/* dhcpcShow.h - DHCP runtime client include file for show routines */ + +/* Copyright 1984 - 1997 Wind River Systems, Inc. */ + +/* +modification history +____________________ +01a,26oct97,spm written. +*/ + +#ifndef __INCdhcpcShowh +#define __INCdhcpcShowh + +#ifdef __cplusplus +extern "C" { +#endif + +IMPORT void dhcpcShowInit (void); +IMPORT STATUS dhcpcServerShow (void *); +IMPORT STATUS dhcpcTimersShow (void *); +IMPORT STATUS dhcpcParamsShow (void *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/dhcp/dhcpcStateLib.h b/h/dhcp/dhcpcStateLib.h new file mode 100644 index 0000000..b894643 --- /dev/null +++ b/h/dhcp/dhcpcStateLib.h @@ -0,0 +1,50 @@ +/* dhcpcStateLib.h - DHCP runtime client interface to state machine */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* +modification history +____________________ +01f,10oct01,rae merge from truestack +01e,13jun00,spm increased size of function pointer array for new state +01d,24nov99,spm upgraded to RFC 2131 and removed direct link-level access +01c,06oct97,spm added relative paths to #include statements +01b,06aug97,spm added definitions for C++ compilation +01a,03oct96,spm created by modifying WIDE project DHCP implementation +*/ + +#ifndef __INCdhcpcStateLibh +#define __INCdhcpcStateLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "dhcp/copyright_dhcp.h" + +/* DHCP client states */ + +#define INIT 0 +#define WAIT_OFFER 1 +#define SELECTING 2 +#define REQUESTING 3 +#define BOUND 4 +#define RENEWING 5 +#define REBINDING 6 +#define INIT_REBOOT 7 +#define VERIFY 8 +#define REBOOTING 9 +#define VERIFYING 10 +#define INFORMING 11 +#define MAX_STATES INFORMING + 1 + +IMPORT int (*fsm[MAX_STATES])(); + +IMPORT STATUS dhcp_client_setup (int, int, int); +IMPORT int dhcp_client (void *, BOOL); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/dhcp/dhcps.h b/h/dhcp/dhcps.h new file mode 100644 index 0000000..b4ef9bd --- /dev/null +++ b/h/dhcp/dhcps.h @@ -0,0 +1,229 @@ +/* dhcps.h - DHCP server primary include file */ + +/* Copyright 1984 - 1997 Wind River Systems, Inc. */ + +/* +modification history +____________________ +01b,06aug97,spm added definitions for C++ compilation +01a,07apr97,spm created by modifying WIDE project DHCP implementation +*/ + +/* + * WIDE Project DHCP Implementation + * Copyright (c) 1995 Akihiro Tominaga + * Copyright (c) 1995 WIDE Project + * All rights reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided only with the following + * conditions are satisfied: + * + * 1. Both the copyright notice and this permission notice appear in + * all copies of the software, derivative works or modified versions, + * and any portions thereof, and that both notices appear in + * supporting documentation. + * 2. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by WIDE Project and + * its contributors. + * 3. Neither the name of WIDE Project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND WIDE + * PROJECT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES + * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ALSO, THERE + * IS NO WARRANTY IMPLIED OR OTHERWISE, NOR IS SUPPORT PROVIDED. + * + * Feedback of the results generated from any improvements or + * extensions made to this software would be much appreciated. + * Any such feedback should be sent to: + * + * Akihiro Tominaga + * WIDE Project + * Keio University, Endo 5322, Kanagawa, Japan + * (E-mail: dhcp-dist@wide.ad.jp) + * + * WIDE project has the rights to redistribute these changes. + */ + +#ifndef __INCdhcpsh +#define __INCdhcpsh + +#ifdef __cplusplus +extern "C" { +#endif + +#define GC_INTERVAL 600 /* interval between garbage collections */ + +/* + * function prototype definition + */ +static void garbage_collect (void); +static void get_cid (struct dhcp *, int, struct client_id *); +static void clean_sbuf (void); +static void construct_msg (u_char, struct dhcp_resource *, + u_long, struct if_info *); +static void turnoff_bind (struct dhcp_binding *); +static int nvttostr (char *, char *, int); +static int get_maxoptlen (struct dhcp *, int); +static int get_subnet (struct dhcp *, int, struct in_addr *, struct if_info *); +static int available_res (struct dhcp_resource *, struct client_id *, time_t); +static int choose_lease (int, time_t, struct dhcp_resource *); +static int update_db (int, struct client_id *, struct dhcp_resource *, + u_long, time_t); +static int cidcmp (struct client_id *, struct client_id *); +static int icmp_check (int, struct in_addr *); +static int insert_it (char *); +static int free_bind (struct hash_member *); +static int free_fake (struct hash_member *); +static int send_dhcp (struct if_info *, int); +static int insert_opt (struct dhcp_resource *, u_long, int, char *, char); +#define PASSIVE 0 +#define ACTIVE 1 +static u_long get_reqlease (struct dhcp *, int); +static struct dhcp_resource *select_wciaddr (struct client_id *, time_t, int *); +static struct dhcp_resource *select_wcid (int, struct client_id *, time_t); +static struct dhcp_resource *select_wreqip (int, struct client_id *, time_t); +static struct dhcp_resource *select_newone (int, struct client_id *, time_t, + u_long); +static struct dhcp_resource *choose_res (struct client_id *, time_t, u_long); + +extern struct hash_member *reslist; +extern struct hash_member *bindlist; +extern struct hash_tbl cidhashtable; +extern struct hash_tbl iphashtable; +extern struct hash_tbl relayhashtable; +extern struct hash_tbl paramhashtable; + +extern int bindcidcmp(); +extern int paramcidcmp(); +extern int resipcmp(); +extern int relayipcmp(); +extern int open_if(); + +static int discover(); +static int request(); +static int decline(); +static int release(); + +#ifndef NOBOOTP +static void construct_bootp(); +static int available_forbootp(); +static int send_bootp(); +static struct dhcp_resource *choose_forbootp(); +static int bootp(); +#endif /* NOBOOTP */ + +static int (*process_msg[])() = { +#ifdef NOBOOTP + NULL, +#else + bootp, +#endif + discover, + NULL, + request, + decline, + NULL, + NULL, + release +}; + +static int ins_ip (struct dhcp_resource *, u_long, int, char *, char); +static int ins_ips (struct dhcp_resource *, u_long, int, char *, char); +static int ins_ippairs (struct dhcp_resource *, u_long, int, char *, char); +static int ins_long (struct dhcp_resource *, u_long, int, char *, char); +static int ins_short (struct dhcp_resource *, u_long, int, char *, char); +static int ins_octet (struct dhcp_resource *, u_long, int, char *, char); +static int ins_str (struct dhcp_resource *, u_long, int, char *, char); +static int ins_mtpt (struct dhcp_resource *, u_long, int, char *, char); +static int ins_dht (struct dhcp_resource *, u_long, int, char *, char); + +static int (*ins_opt []) (struct dhcp_resource *, u_long, int, char *, char) = + { + NULL, /* PAD == 0 */ + ins_ip, /* SUBNET_MASK */ + ins_long, /* TIME_OFFSET */ + ins_ips, /* ROUTER */ + ins_ips, /* TIME_SERVER */ + ins_ips, /* NAME_SERVER */ + ins_ips, /* DNS_SERVER */ + ins_ips, /* LOG_SERVER */ + ins_ips, /* COOKIE_SERVER */ + ins_ips, /* LPR_SERVER */ + ins_ips, /* IMPRESS_SERVER */ + ins_ips, /* RLS_SERVER */ + ins_str, /* HOSTNAME */ + ins_short, /* BOOTSIZE */ + ins_str, /* MERIT_DUMP */ + ins_str, /* DNS_DOMAIN */ + ins_ip, /* SWAP_SERVER */ + ins_str, /* ROOT_PATH */ + ins_str, /* EXTENSIONS_PATH */ + ins_octet, /* IP_FORWARD */ + ins_octet, /* NONLOCAL_SRCROUTE */ + ins_ippairs, /* POLICY_FILTER */ + ins_short, /* MAX_DGRAM_SIZE */ + ins_octet, /* DEFAULT_IP_TTL */ + ins_long, /* MTU_AGING_TIMEOUT */ + ins_mtpt, /* MTU_PLATEAU_TABLE */ + ins_short, /* IF_MTU */ + ins_octet, /* ALL_SUBNET_LOCAL */ + ins_ip, /* BRDCAST_ADDR */ + ins_octet, /* MASK_DISCOVER */ + ins_octet, /* MASK_SUPPLIER */ + ins_octet, /* ROUTER_DISCOVER */ + ins_ip, /* ROUTER_SOLICIT */ + ins_ippairs, /* STATIC_ROUTE */ + ins_octet, /* TRAILER */ + ins_long, /* ARP_CACHE_TIMEOUT */ + ins_octet, /* ETHER_ENCAP */ + ins_octet, /* DEFAULT_TCP_TTL */ + ins_long, /* KEEPALIVE_INTER */ + ins_octet, /* KEEPALIVE_GARBA */ + ins_str, /* NIS_DOMAIN */ + ins_ips, /* NIS_SERVER */ + ins_ips, /* NTP_SERVER */ + NULL, /* VENDOR_SPEC */ + ins_ips, /* NBN_SERVER */ + ins_ips, /* NBDD_SERVER */ + ins_octet, /* NB_NODETYPE */ + ins_str, /* NB_SCOPE */ + ins_ips, /* XFONT_SERVER */ + ins_ips, /* XDISPLAY_MANAGER */ + NULL, /* REQUEST_IPADDR */ + NULL, /* LEASE_TIME */ + NULL, /* OPT_OVERLOAD */ + NULL, /* DHCP_MSGTYPE */ + NULL, /* SERVER_ID */ + NULL, /* REQ_LIST */ + NULL, /* DHCP_ERRMSG */ + NULL, /* DHCP_MAXMSGSIZE */ + ins_dht, /* DHCP_T1 */ + ins_dht, /* DHCP_T2 */ + NULL, /* CLASS_ID */ + NULL, /* CLIENT_ID */ + NULL, + NULL, + ins_str, /* NISP_DOMAIN */ + ins_ips, /* NISP_SERVER */ + NULL, /* TFTP_SERVERNAME */ + NULL, /* BOOTFILE */ + ins_ips, /* MOBILEIP_HA */ + ins_ips, /* SMTP_SERVER */ + ins_ips, /* POP3_SERVER */ + ins_ips, /* NNTP_SERVER */ + ins_ips, /* DFLT_WWW_SERVER */ + ins_ips, /* DFLT_FINGER_SERVER */ + ins_ips, /* DFLT_IRC_SERVER */ + ins_ips, /* STREETTALK_SERVER */ + ins_ips /* STDA_SERVER */ +}; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/dhcp/hash.h b/h/dhcp/hash.h new file mode 100644 index 0000000..88ecff2 --- /dev/null +++ b/h/dhcp/hash.h @@ -0,0 +1,86 @@ +/* hash.h - DHCP server include file for hash table functions */ + +/* Copyright 1984 - 1997 Wind River Systems, Inc. */ + +/* +modification history +____________________ +01b,06aug97,spm added definitions for C++ compilation +01a,07apr97,spm created by modifying WIDE project DHCP implementation +*/ + +/* + * Modified by Akihiro Tominaga. (tomy@sfc.wide.ad.jp) + */ +/* + * Generalized hash table ADT + * + * Provides multiple, dynamically-allocated, variable-sized hash tables on + * various data and keys. + * + * This package attempts to follow some of the coding conventions suggested + * by Bob Sidebotham and the AFS Clean Code Committee. + * + * + * + * Copyright 1988 by Carnegie Mellon. + * + * Permission to use, copy, modify, and distribute this program for any + * purpose and without fee is hereby granted, provided that this copyright + * and permission notice appear on all copies and supporting documentation, + * the name of Carnegie Mellon not be used in advertising or publicity + * pertaining to distribution of the program without specific prior + * permission, and notice be given in supporting documentation that copying + * and distribution is by permission of Carnegie Mellon and Stanford + * University. Carnegie Mellon makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ +#ifndef __INChashh +#define __INChashh + +#ifdef __cplusplus +extern "C" { +#endif + +#define HASHTBL_SIZE 127 /* this is a prime number */ + +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif +#ifndef NULL +#define NULL 0 +#endif + +/* + * Define "hash_datum" as a universal data type + */ +#ifdef __STDC__ +typedef void hash_datum; +#else +typedef char hash_datum; +#endif + +struct hash_member { + struct hash_member *next; + hash_datum *data; +}; + +struct hash_tbl { + struct hash_member *head[HASHTBL_SIZE]; +}; + +extern int hash_exst(); +extern int hash_ins(); +extern int hash_del(); +extern hash_datum *hash_pickup(); +extern hash_datum *hash_find(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/dhcpcBootLib.h b/h/dhcpcBootLib.h new file mode 100644 index 0000000..dc2521d --- /dev/null +++ b/h/dhcpcBootLib.h @@ -0,0 +1,41 @@ +/* dhcpcBootLib.h - DHCP client include file for boot-time interface */ + +/* Copyright 1984 - 2000 Wind River Systems, Inc. */ + +/* +modification history +____________________ +01f,13jun00,spm changed interface to support adding options to messages; + added prototype to prevent compiler warnings +01e,05apr00,spm upgraded to RFC 2131 and combined with run-time client +01d,04dec97,spm added code review modifications +01c,19aug97,spm major overhaul: preserved single-lease interface by + merging include files - 01f of dhcpClientCommon.h, + 01d of dhcp.h, 01c of dhcpCommonSubr.h, 01e of dhcpc.h +01b,06aug97,spm added conditional include and definitions for C++ compilation +01a,07apr97,spm created. +*/ + +#ifndef __INCdhcpcBootLibh +#define __INCdhcpcBootLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "netinet/in.h" + +#include "dhcp/dhcpcBoot.h" + +/* DHCP boot-time high-level interface functions */ + +IMPORT void * dhcpcBootInit (struct ifnet *, int, int, int, int, int, int); +IMPORT STATUS dhcpcBootBind (void); +IMPORT STATUS dhcpcBootInformGet (char *); +IMPORT STATUS dhcpcBootParamsGet (struct dhcp_param *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/dhcpcLib.h b/h/dhcpcLib.h new file mode 100644 index 0000000..8b4068a --- /dev/null +++ b/h/dhcpcLib.h @@ -0,0 +1,54 @@ +/* dhcpcLib.h - DHCP include file for user interface of runtime client */ + +/* Copyright 1984 - 2000 Wind River Systems, Inc. */ + +/* +modification history +____________________ +01h,05apr00,spm removed entries shared with boot-time client +01g,24nov99,spm upgraded to RFC 2131 and removed direct link-level access +01f,06oct97,spm added prototypes for user-callable routines +01e,06aug97,spm added definitions for C++ compilation +01d,30apr97,spm changed dhcpcOptionGet() prototype to return length +01c,07apr97,spm added prototypes for new functions +01b,29jan97,spm added support for little-endian architectures +01a,03oct96,spm created. +*/ + +#ifndef __INCdhcpcLibh +#define __INCdhcpcLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "dhcp/dhcpc.h" /* DHCP client data structures */ + +IMPORT void * pDhcpcBootCookie; /* User access to boot-time lease. */ + +/* DHCP data structures for option requests and retrieval. */ + +/* DHCP (runtime) client user interface routines */ + +IMPORT STATUS dhcpcLibInit (int, int, int, int, int, int, int); +IMPORT void * dhcpcInit (struct ifnet *, BOOL); +IMPORT STATUS dhcpcEventHookAdd (void *, FUNCPTR); +IMPORT STATUS dhcpcEventHookDelete (void *); +IMPORT STATUS dhcpcCacheHookAdd (FUNCPTR); +IMPORT STATUS dhcpcCacheHookDelete (void); +IMPORT STATUS dhcpcOptionSet (void *, int); +IMPORT STATUS dhcpcOptionAdd (void *, UCHAR, int, UCHAR *); +IMPORT STATUS dhcpcBind (void *, BOOL); +IMPORT STATUS dhcpcVerify (void *); +IMPORT STATUS dhcpcOptionGet (void *, int, int *, char *); +IMPORT STATUS dhcpcServerGet (void *, struct in_addr *); +IMPORT STATUS dhcpcTimerGet (void *, int *, int *); +IMPORT STATUS dhcpcParamsGet (void *, struct dhcp_param *); +IMPORT STATUS dhcpcRelease (void *); +IMPORT STATUS dhcpcShutdown (void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/dhcprLib.h b/h/dhcprLib.h new file mode 100644 index 0000000..c1fb41b --- /dev/null +++ b/h/dhcprLib.h @@ -0,0 +1,52 @@ +/* dhcprLib.h - DHCP relay agent include file for user interface */ + +/* Copyright 1984 - 1997 Wind River Systems, Inc. */ + +/* +modification history +____________________ +01d,04dec97,spm added code review modifications +01c,06aug97,spm added definitions for C++ compilation +01b,28apr97,spm moved DHCP_MAX_HOPS to configAll.h +01a,07apr97,spm created. +*/ + +#ifndef __INCdhcprLibh +#define __INCdhcprLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#if CPU_FAMILY==I960 +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct serverDesc + { + char *pAddress; /* IP address of DHCP server target */ + } DHCP_TARGET_DESC; + +typedef struct server + { + struct in_addr ip; + struct server *next; + } DHCP_SERVER_DESC; + +IMPORT DHCP_TARGET_DESC * pDhcpRelayTargetTbl; +IMPORT int dhcpNumTargets; +IMPORT DHCP_SERVER_DESC * pDhcpTargetList; +IMPORT struct msg dhcpMsgIn; + +#if CPU_FAMILY==I960 +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +IMPORT int open_if(); +IMPORT void read_server_db (int); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/dhcpsLib.h b/h/dhcpsLib.h new file mode 100644 index 0000000..74217cc --- /dev/null +++ b/h/dhcpsLib.h @@ -0,0 +1,173 @@ +/* dhcpsLib.h - DHCP server include file for user interface */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,10oct01,rae merge from truestack (virtual stack support) +01a,25jun01,ppp fixed the problem involving the dhcp server and client to be + built together (SPR #64194) +01f,14jul00,spm upgraded to RFC 2131 and removed direct link-level access +01e,04dec97,spm added code review modifications +01d,06oct97,spm moved default parameters from usrNetwork.c; added prototypes + for user-callable routines +01c,06aug97,spm added definitions for C++ compilation +01b,18apr97,spm added dhcpsInit() prototype to eliminate compiler warnings +01a,07apr97,spm created. +*/ + +#ifndef __INCdhcpsLibh +#define __INCdhcpsLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#define S_dhcpsLib_NOT_INITIALIZED (M_dhcpsLib | 1) + +#include "ioLib.h" + +#define PROTO_ICMP 1 /* Normally found in /etc/protocols */ + +#if CPU_FAMILY==I960 +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct leaseDesc + { + /* + * This structure defines the components of an address pool entry. + * The DHCP server issues leases for individual IP addresses from + * the address pool. + */ + + char *pName; /* base name of pool entry */ + char *pStartIp; /* first IP address in range */ + char *pEndIp; /* last IP address in range */ + char *pParams; /* other lease parameters */ + } DHCPS_LEASE_DESC; + +typedef struct entryDesc + { + /* + * This structure defines the components of a single lease entry + * from the address pool which will be offered to DHCP clients. + */ + + char *pName; /* unique name of lease entry */ + char *pAddress; /* single IP address within range */ + char *pParams; /* associated lease parameters */ + } DHCPS_ENTRY_DESC; + +#include "ioLib.h" + +typedef struct ifDesc + { + char ifName[MAX_FILENAME_LENGTH]; /* name of interface to use */ + } DHCPS_IF_DESC; + +typedef struct relayDesc + { + /* + * This structure contains information for a relay agent used to + * communicate with DHCP clients or servers on other networks. + */ + + char *pAddress; /* IP address of relay agent */ + char *pMask; /* Subnet mask of supported network */ + } DHCPS_RELAY_DESC; + +#include "dhcprLib.h" /* Relay agent capability. */ + +#if CPU_FAMILY==I960 +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +IMPORT DHCPS_LEASE_DESC * pDhcpsLeasePool; +IMPORT DHCPS_RELAY_DESC * pDhcpsRelaySourceTbl; + +typedef struct dhpcsConfigDesc + { + int dhcpMaxHops; /* max hops */ + int dhcpSPort; /* server port */ + int dhcpCPort; /* client port */ + int dhcpMaxMsgSize; /* max msg size */ + long dhcpsDfltLease; /* Default for default lease length */ + long dhcpsMaxLease; /* Default maximum lease length */ + FUNCPTR pDhcpsLeaseFunc; /* ptr to lease function */ + FUNCPTR pDhcpsAddrFunc; /* ptr to address function */ + DHCPS_IF_DESC *pDhcpsIfTbl; /* ptr to device table */ + int numDev; /* # of devices in table */ + DHCPS_LEASE_DESC *pDhcpsLeaseTbl; /* lease tbl */ + int dhcpsLeaseTblSize; /* size of lease table */ + DHCP_TARGET_DESC *pDhcpsTargetTbl; /* target table */ + int dhcpTargetTblSize; /* size of target table */ + DHCPS_RELAY_DESC *pDhcpsRelayTbl; /* relay table */ + int dhcpsRelayTblSize; /* size of relay table */ + } DHCPS_CFG_PARAMS; + +/* User-callable routines */ + +IMPORT STATUS dhcpsInit (DHCPS_CFG_PARAMS *); +IMPORT STATUS dhcpsLeaseEntryAdd (char *, char *, char *, char *); +IMPORT STATUS dhcpsLeaseHookAdd (FUNCPTR); +IMPORT STATUS dhcpsAddressHookAdd (FUNCPTR); +IMPORT STATUS dhcpsVsInit (); +/* Critical section semaphore. */ + +IMPORT SEM_ID dhcpsMutexSem; + +/* Operations on database cache. */ + +#define DHCPS_STORAGE_START 0 +#define DHCPS_STORAGE_STOP 1 +#define DHCPS_STORAGE_WRITE 2 +#define DHCPS_STORAGE_READ 3 +#define DHCPS_STORAGE_CLEAR 4 + +/* + * The following string contains host requirements defaults needed for + * RFC compliance - DO NOT REMOVE OR MODIFY!! + */ + +#define DHCPS_DEFAULT_ENTRY "ipfd=false:nlsr=false:mdgs=576:ditl=64:ifmt=576:asnl=false:brda=255.255.255.255:mskd=false:msks=false:rtrd=true:rtsl=255.255.255.255:trlr=false:arpt=60:encp=false:dttl=64:kain=7200:kagb=false" + +#define MAX_DHCPFILTERS 23 /* Number of filters as defined below */ + +#define DHCPS_FILTER_DEFINE { \ +BPF_STMT(BPF_LD+BPF_TYPE,0), /* Save lltype in accumulator */ \ +BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, ETHERTYPE_IP, 0, 20), /* IP packet? */ \ +/* \ + * The remaining statements use the (new) BPF_HLEN alias to avoid any \ + * link-layer dependencies. The expected length values are assigned to the \ + * correct values during startup. The expected destination port is also \ + * altered to match the actual value chosen. \ + */ \ +BPF_STMT(BPF_LD+BPF_H+BPF_ABS+BPF_HLEN, 6), /* A <- IP FRAGMENT field */ \ +BPF_JUMP(BPF_JMP+BPF_JSET+BPF_K, 0x1fff, 18, 0), /* OFFSET == 0 ? */ \ +BPF_STMT(BPF_LDX+BPF_HLEN, 0), /* X <- frame data offset */ \ +BPF_STMT(BPF_LD+BPF_H+BPF_IND, 2), /* A <- IP_LEN field */ \ +BPF_JUMP(BPF_JMP+BPF_JGE+BPF_K, 0, 0, 15), /* IP/UDP headers + DHCP? */ \ +BPF_STMT(BPF_LD+BPF_B+BPF_IND, 9), /* A <- IP_PROTO field */ \ +BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, IPPROTO_UDP, 0, 13), /* UDP ? */ \ +BPF_STMT(BPF_LD+BPF_HLEN, 0), /* A <- frame data offset */ \ +BPF_STMT(BPF_LDX+BPF_B+BPF_MSH+BPF_HLEN, 0), /* X <- IPHDR LEN field */ \ +BPF_STMT(BPF_ALU+BPF_ADD+BPF_X, 0), /* A <- start of UDP datagram */ \ +BPF_STMT(BPF_MISC+BPF_TAX, 0), /* X <- start of UDP datagram */ \ +BPF_STMT(BPF_LD+BPF_H+BPF_IND, 2), /* A <- UDP DSTPORT */ \ +BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 67, 0, 7), /* check DSTPORT */ \ +BPF_STMT(BPF_LD+BPF_H+BPF_IND, 4), /* A <- UDP LENGTH */ \ +BPF_JUMP(BPF_JMP+BPF_JGE+BPF_K, 0, 0, 5), /* UDP header + DHCP? */ \ +BPF_STMT(BPF_LD+BPF_B+BPF_IND, 11), /* A <- DHCP hops field */ \ +BPF_JUMP(BPF_JMP+BPF_JGT+BPF_K, -1, 3, 0), /* -1 replaced with max hops */ \ +BPF_STMT(BPF_LD+BPF_W+BPF_IND, 244), /* A <- DHCP options */ \ +BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 0x63825363, 0, 1), \ +BPF_STMT(BPF_RET+BPF_K+BPF_HLEN, DFLTDHCPLEN + UDPHL + IPHL), \ +BPF_STMT(BPF_RET+BPF_K, 0) /* unrecognized message: ignore frame */ } + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/dirent.h b/h/dirent.h new file mode 100644 index 0000000..3033455 --- /dev/null +++ b/h/dirent.h @@ -0,0 +1,79 @@ +/* dirent.h - POSIX directory handling definitions */ + +/* + * Copyright 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01m,28jul05,act add an "end of dir" flag to a DIR for FIOREADDIR ops +01l,20jlk05,jlk added d_ino field to dirent struct for POSIX. +01k,09apr04,dat adding const to char ptrs +01j,22sep92,rrr added support for c++ +01i,04jul92,jcf cleaned up. +01h,26may92,rrr the tree shuffle +01g,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01f,10jun91.del added pragma for gnu960 alignment. +01e,05oct90,dnw added rewinddir() and closedir(). +01d,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01c,07aug90,shl added IMPORT type to function declarations. +01b,25may90,dnw moved NAME_MAX to limits.h + added copyright +01a,17apr90,kdl written. +*/ + + +#ifndef __INCdirenth +#define __INCdirenth + +#ifdef __cplusplus +extern "C" { +#endif + +#include "limits.h" + + +/* Directory entry */ + +struct dirent /* dirent */ + { + ino_t d_ino; /* file serial number */ + char d_name [NAME_MAX + 1]; /* file name, null-terminated */ + }; + + +/* HIDDEN - not for end-customer use */ +/* Directory descriptor */ + +typedef struct /* DIR */ + { + int dd_fd; /* file descriptor for open directory */ + int dd_cookie; /* filesys-specific marker within dir */ + BOOL dd_eof; /* readdir EOF flag */ + struct dirent dd_dirent; /* obtained directory entry */ + } DIR; + +/* END_HIDDEN */ + +/* function declarations */ + +extern DIR * opendir (const char *dirName); +extern STATUS closedir (DIR *pDir); +extern struct dirent * readdir (DIR *pDir); +extern void rewinddir (DIR *pDir); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdirenth */ diff --git a/h/dllLib.h b/h/dllLib.h new file mode 100644 index 0000000..0372871 --- /dev/null +++ b/h/dllLib.h @@ -0,0 +1,270 @@ +/* dllLib.h - doubly linked list library header */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01k,03jun05,yvp Added #ifndef _ASMLANGUAGE. + Updated copyright. #include now with angle-brackets. +01j,19jan05,vvv moved some macros here from osdep.h +01i,05may04,cjj removed non-standard prototypes. +01h,22sep92,rrr added support for c++ +01g,04jul92,jcf cleaned up. +01f,26may92,rrr the tree shuffle +01e,04oct91,rrr passed through the ansification filter + -changed VOID to void + -changed copyright notice +01d,08apr91,jdi added NOMANUAL to prevent mangen. +01c,20dec90,gae fixed declaration of dllRemove. +01b,05oct90,shl added ANSI function prototypes. + added copyright notice. +01a,07aug89,jcf written. +*/ + +#ifndef __INCdllLibh +#define __INCdllLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifndef _ASMLANGUAGE + +/* type definitions */ + +typedef struct dlnode /* Node of a linked list. */ + { + struct dlnode *next; /* Points at the next node in the list */ + struct dlnode *previous; /* Points at the previous node in the list */ + } DL_NODE; + + +/* HIDDEN */ + +typedef struct /* Header for a linked list. */ + { + DL_NODE *head; /* header of list */ + DL_NODE *tail; /* tail of list */ + } DL_LIST; + +/* END_HIDDEN */ + +/****************************************************************************** +* +* DLL_INIT - initialize doubly linked list descriptor +* +* Initialize the specified list to an empty list. +* +* NOMANUAL +*/ + +#define DLL_INIT(list) \ + { \ + ((DL_LIST *)(list))->head = NULL; \ + ((DL_LIST *)(list))->tail = NULL; \ + } + +/******************************************************************************* +* +* dllFirst - find first node in list +* +* DESCRIPTION +* Finds the first node in a doubly linked list. +* +* RETURNS +* Pointer to the first node in a list, or +* NULL if the list is empty. +* +* NOMANUAL +*/ + +#define DLL_FIRST(pList) \ + ( \ + (((DL_LIST *)(pList))->head) \ + ) + +/******************************************************************************* +* +* dllLast - find last node in list +* +* Finds the last node in a doubly linked list. +* +* RETURNS +* pointer to the last node in list, or +* NULL if the list is empty. +* +* NOMANUAL +*/ + +#define DLL_LAST(pList) \ + ( \ + (((DL_LIST *)(pList))->tail) \ + ) + +/******************************************************************************* +* +* dllNext - find next node in list +* +* Locates the node immediately after the node pointed to by the pNode. +* +* RETURNS: +* Pointer to the next node in the list, or +* NULL if there is no next node. +* +* NOMANUAL +*/ + +#define DLL_NEXT(pNode) \ + ( \ + (((DL_NODE *)(pNode))->next) \ + ) + +/******************************************************************************* +* +* dllPrevious - find preceding node in list +* +* Locates the node immediately before the node pointed to by the pNode. +* +* RETURNS: +* Pointer to the preceding node in the list, or +* NULL if there is no next node. +* +* NOMANUAL +*/ + +#define DLL_PREVIOUS(pNode) \ + ( \ + (((DL_NODE *)(pNode))->previous) \ + ) + +/******************************************************************************* +* +* dllEmpty - boolean function to check for empty list +* +* RETURNS: +* TRUE if list is empty +* FALSE otherwise +* +* NOMANUAL +*/ + +#define DLL_EMPTY(pList) \ + ( \ + (((DL_LIST *)pList)->head == NULL) \ + ) + +/****************************************************************************** +* +* DLL_INSERT - insert node in list after specified node +* +* This macro inserts the specified node in the specified list. +* The new node is placed following the specified 'previous' node in the list. +* If the specified previous node is NULL, the node is inserted at the head +* of the list. +* +* NOMANUAL +*/ + +#define DLL_INSERT(list, previousNode, node) \ + { \ + DL_NODE *temp; \ + if ((previousNode) == NULL) \ + { \ + temp = ((DL_LIST *)(list))->head; \ + ((DL_LIST *)(list))->head = (DL_NODE *)(node); \ + } \ + else \ + { \ + temp = ((DL_NODE *)(previousNode))->next; \ + ((DL_NODE *)(previousNode))->next = (DL_NODE *)(node); \ + } \ + if (temp == NULL) \ + ((DL_LIST *)(list))->tail = (DL_NODE *)(node); \ + else \ + temp->previous = (DL_NODE *)(node); \ + ((DL_NODE *)(node))->next = temp; \ + ((DL_NODE *)(node))->previous = (DL_NODE *)(previousNode); \ + } + +/****************************************************************************** +* +* DLL_ADD - add node to end of list +* +* This macro adds the specified node to the end of the specified list. +* +* NOMANUAL +*/ + +#define DLL_ADD(list, node) \ + { \ + DL_NODE *listTail = (list)->tail; \ + DLL_INSERT ((list), listTail, (node)); \ + } + +/****************************************************************************** +* +* DLL_REMOVE - remove specified node in list +* +* Remove the specified node in the doubly linked list. +* +* NOMANUAL +*/ + +#define DLL_REMOVE(list, node) \ + { \ + if (((DL_NODE *)(node))->previous == NULL) \ + ((DL_LIST *)(list))->head = ((DL_NODE *)(node))->next; \ + else \ + ((DL_NODE *)(node))->previous->next = ((DL_NODE *)(node))->next; \ + if (((DL_NODE *)(node))->next == NULL) \ + ((DL_LIST *)(list))->tail = ((DL_NODE *)(node))->previous; \ + else \ + ((DL_NODE *)(node))->next->previous = ((DL_NODE *)(node))->previous; \ + } + +/****************************************************************************** +* +* DLL_GET - get (delete and return) first node from list +* +* This macro gets the first node from the specified list, deletes the node +* from the list, and returns a pointer to the node gotten. +* +* NOMANUAL +*/ + +#define DLL_GET(list, node) \ + { \ + (node) = (void *)((DL_LIST *)(list))->head; \ + if ((node) != NULL) \ + { \ + ((DL_LIST *)(list))->head = ((DL_NODE *)(node))->next; \ + if (((DL_NODE *)(node))->next == NULL) \ + ((DL_LIST *)(list))->tail = NULL; \ + else \ + ((DL_NODE *)(node))->next->previous = NULL; \ + } \ + } + + +/* function declarations */ + +extern DL_LIST *dllCreate (void); +extern DL_NODE *dllEach (DL_LIST *pList, FUNCPTR routine, int routineArg); +extern DL_NODE *dllGet (DL_LIST *pList); +extern STATUS dllDelete (DL_LIST *pList); +extern STATUS dllInit (DL_LIST *pList); +extern STATUS dllTerminate (DL_LIST *pList); +extern int dllCount (DL_LIST *pList); +extern void dllAdd (DL_LIST *pList, DL_NODE *pNode); +extern void dllInsert (DL_LIST *pList, DL_NODE *pPrev, DL_NODE *pNode); +extern void dllRemove (DL_LIST *pList, DL_NODE *pNode); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdllLibh */ diff --git a/h/dma.h b/h/dma.h new file mode 100644 index 0000000..49625f9 --- /dev/null +++ b/h/dma.h @@ -0,0 +1,57 @@ +/* dma.h - DMA (direct memory access) header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,22sep92,rrr added support for c++ +01d,04jul92,jcf cleaned up. +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01a,20dec90,jcc written. +*/ + +#ifndef __INCdmah +#define __INCdmah + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "private/semLibP.h" + +typedef struct dmaCtrl /* DMA_CTRL - generic DMA controller info */ + { + SEMAPHORE ctrlMutexSem; /* semaphore for exclusive access */ + SEMAPHORE ctrlSyncSem; /* semaphore for waiting on I/O interrupt */ + BOOL intOnCompletion; /* whether ctrl can interrupt when done */ + VOIDFUNCPTR dmaReset; /* function for resetting the DMA bus */ + FUNCPTR dmaTransact; /* function for managing a DMA transaction */ + FUNCPTR dmaBytesIn; /* function for DMA input */ + FUNCPTR dmaBytesOut; /* function for DMA output */ + FUNCPTR dmaBusPhaseGet; /* function returning the current bus phase */ + UINT maxBytesPerXfer; /* upper bound of ctrl. tansfer counter */ + UINT clkPeriod; /* period of the controller clock (nsec) */ + int dmaPriority; /* priority of task when doing DMA I/O */ + int dmaBusPhase; /* current phase of DMA */ + } DMA_CTRL; + +/* structure to pass to ioctl call to execute a DMA command */ + +typedef struct /* DMA_TRANSACTION - information about a DMA transaction */ + { + UINT8 *srcAddress; /* address of source data buffer */ + UINT8 *destAddress; /* address of destination data buffer */ + int dataLength; /* length of data buffer in bytes (0=no data) */ + UINT8 statusByte; /* status byte returned from target */ + } DMA_TRANSACTION; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdmah */ diff --git a/h/dosFsCommon.h b/h/dosFsCommon.h new file mode 100644 index 0000000..eb0ee0b --- /dev/null +++ b/h/dosFsCommon.h @@ -0,0 +1,111 @@ +/* dosFsCommon.h - DOS file system header file (common elements) */ + +/* Copyright 1999-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,02may04,jkf fixed SPR#83487, DOS_MAX_DIR_LEVELS to 124 +01a,09apr04,dat written (from dosFsLib.h ver 01q) +*/ + +/* +These are the common DOS file system macros needed for both +kernel and RTP space. (This file is referenced as usrFsLib.h from +RTP space). +*/ + +#ifndef __INCdosFsCommonh +#define __INCdosFsCommonh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* defines */ +#define DOS_FS_COMPAT /* enable definition for backwards compatibility */ + +/* dosDevCreateOptions - check disk levels */ + +#define DOS_CHK_FLAGS_MASK 0x000000ff /* all "control" flags in here */ +#define DOS_CHK_ONLY 0x00000001 +#define DOS_CHK_REPAIR 0x00000002 +#define DOS_CHK_NONE 0x00000004 +#define DOS_CHK_FORCE 0x00000008 /* force chkdsk even if clean */ +#define DOS_CHK_VERB_0 0x0000ff00 /* verbosity level/flags */ +#define DOS_CHK_VERB_SILENT DOS_CHK_VERB_0 +#define DOS_CHK_VERB_1 0x00000100 +#define DOS_CHK_VERB_2 0x00000200 + +/* misc max definitions */ +#define DOS_MAX_DIR_LEVELS 124 /* max expected directory levels */ +#define DOS_VOL_LABEL_LEN 11 /* length of volume label */ + +/* ioctl FIOCHKDSK - check disk levels */ + +#define CHK_ONLY 1 +#define CHK_REPAIR 2 + +/* additional open() flags */ + +#define DOS_O_CONTIG_CHK 0x10000 /* check file for contiguity */ +#define DOS_O_CASENS 0x20000 /* case-sensitive file lookup */ + +/* File attribute byte values */ + +#define DOS_ATTR_RDONLY 0x01 /* read-only file */ +#define DOS_ATTR_HIDDEN 0x02 /* hidden file */ +#define DOS_ATTR_SYSTEM 0x04 /* system file */ +#define DOS_ATTR_VOL_LABEL 0x08 /* volume label (not a file) */ +#define DOS_ATTR_DIRECTORY 0x10 /* entry is a sub-directory */ +#define DOS_ATTR_ARCHIVE 0x20 /* file subject to archiving */ + +/* error codes */ +/* + * The codes which are defined with ERRNO_PX_FLAG can be mapped + * to POSIX error codes: + * if (errno & ERRNO_PX_FLAG) errno &= 0x7fff ; + */ + +#define S_dosFsLib_32BIT_OVERFLOW (M_dosFsLib | 1) +#define S_dosFsLib_DISK_FULL (M_dosFsLib | 2) +#define S_dosFsLib_FILE_NOT_FOUND (M_dosFsLib | 3) +#define S_dosFsLib_NO_FREE_FILE_DESCRIPTORS (M_dosFsLib | 4) +#define S_dosFsLib_NOT_FILE (M_dosFsLib | 5) +#define S_dosFsLib_NOT_SAME_VOLUME (M_dosFsLib | 6) +#define S_dosFsLib_NOT_DIRECTORY (M_dosFsLib | 7) +#define S_dosFsLib_DIR_NOT_EMPTY (M_dosFsLib | 8) +#define S_dosFsLib_FILE_EXISTS (M_dosFsLib | 9) +#define S_dosFsLib_INVALID_PARAMETER (M_dosFsLib | 10) +#define S_dosFsLib_NAME_TOO_LONG (M_dosFsLib | 11) +#define S_dosFsLib_UNSUPPORTED (M_dosFsLib | 12) +#define S_dosFsLib_VOLUME_NOT_AVAILABLE (M_dosFsLib | 13) +#define S_dosFsLib_INVALID_NUMBER_OF_BYTES (M_dosFsLib | 14) +#define S_dosFsLib_ILLEGAL_NAME (M_dosFsLib | 15) +#define S_dosFsLib_CANT_DEL_ROOT (M_dosFsLib | 16) +#define S_dosFsLib_READ_ONLY (M_dosFsLib | 17) +#define S_dosFsLib_ROOT_DIR_FULL (M_dosFsLib | 18) +#define S_dosFsLib_NO_LABEL (M_dosFsLib | 19) +#define S_dosFsLib_NO_CONTIG_SPACE (M_dosFsLib | 20) +#define S_dosFsLib_FD_OBSOLETE (M_dosFsLib | 21) +#define S_dosFsLib_DELETED (M_dosFsLib | 22) +#define S_dosFsLib_INTERNAL_ERROR (M_dosFsLib | 23) +#define S_dosFsLib_WRITE_ONLY (M_dosFsLib | 24) +#define S_dosFsLib_ILLEGAL_PATH (M_dosFsLib | 25) +#define S_dosFsLib_ACCESS_BEYOND_EOF (M_dosFsLib | 26) +#define S_dosFsLib_DIR_READ_ONLY (M_dosFsLib | 27) +#define S_dosFsLib_UNKNOWN_VOLUME_FORMAT (M_dosFsLib | 28) +#define S_dosFsLib_ILLEGAL_CLUSTER_NUMBER (M_dosFsLib | 29) + +/* macros */ + +/* typedefs */ + +/* interface functions prototypes */ + +#ifdef __cplusplus + } +#endif + +#endif /* __INCdosFsCommonh */ diff --git a/h/dosFsLib.h b/h/dosFsLib.h new file mode 100644 index 0000000..45c3861 --- /dev/null +++ b/h/dosFsLib.h @@ -0,0 +1,261 @@ +/* dosFsLib.h - DOS file system header file */ + +/* Copyright 1999-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02e,04oct05,dcc added miselaneous cache routines. +02d,05aug05,dcc added dosFsCacheLibInit() declaration. +02c,04aug05,jlk moved formatter function pointer, dosFsFmtRtn, from dosFsLibP.h +02b,03aug05,pcm changed parameters to dosFsLibInit() +02a,20jun05,dcc updated formatter API. +01z,25may05,dcc added cache support. +01y,18may05,dcc added API to plug into the removability framework. +01x,18apr05,dcc updated dosFs formatter to work over rawFs. +01w,31jan05,dcc updated dosFs to use XBD interface. +01v,23sep04,act back out changes for SPR#90008 +01u,03may04,jkf SPR#90008, adding device deletion routine +01t,27apr04,act add DOS_FILENAMES_UNICODE option +01s,09apr04,dat creating dosFsCommon.h +01r,21mar04,act add DOS_CHK_FORCE and DOS_CHK_FLAGS_MASK for clean bit +01q,02sep03,jkf rename autoChkLevel to dosDevCreateOptions, more generic. + added DOS_WRITE_THROUGH_[USR,ALL,FAT,DIR] options. +01p,04mar02,jkf Adding dosSetVolCaseSens(),SPR#29751, orig by chn. +01o,30nov01,jkf SPR#68203, adding dosFsLastAccessDateEnable(). +01n,14nov01,jkf SPR#71720, avoiding unaligned pointer accesses. + added leading underscore to _WRS_PACK_ALIGN ifndef +01m,11nov01,jkf added WRS_PACK_ALIGN ifndef for AE 1.1 support, this + allows same dosFs2 files to build in AE 1.1 environment. +01l,10nov01,jkf SPR#32178, made dosFsVolDescGet public + Added WRS_PACK_ALIGN (2) to legacy struct for MIPS. +01k,21sep01,jkf SPR#69031, common code for both AE & 5.x. +01j,21sep01,jkf changed error codes to WRS standard. +01i,29feb00,jkf T3 changes +01h,31aug99,jkf changes for new CBIO API. +01g,31jul99,jkf T2 merge, tidiness & spelling. +01f,15oct98,lrn moved 64-bit extended ioctl codes to ioLib.h +01e,11sep98,vld prototype of dosFsDevCreate() to accept arbitrary + block device ptr. +01d,09jul98,lrn added more defines for back compatibility +01c,30jun98,lrn moved ERRNO_PX_FLAG to errno.h, renamed dosFsInit to + dosFsLibInit, added b.c., cosmetics +01b,28jun98,vld tested and checked in +01a,22jan98,vld written, +*/ + +#ifndef __INCdoFsLib +#define __INCdoFsLib + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include "drv/manager/device.h" + +/* dosDevCreateOptions - data and meta data handling options */ + +/* dosDevCreateOptions - coupled, write through metadata operations */ + +#define DOS_WRITE_THROUGH_DIR 0x00010000 /* write through dirents */ +#define DOS_WRITE_THROUGH_FAT 0x00020000 /* write through FAT ops */ +#define DOS_WRITE_THROUGH_USR 0x00040000 /* write through user data */ +/* dosDevCreateOptions - coupled, immediate write through of all IO */ +#define DOS_WRITE_THROUGH_ALL 0x00080000 + +/* dosDevCreateOptions - file name format (VxWorks 5.5 style vs UTF16) */ + +#define DOS_FILENAMES_UNICODE 0x00100000 /* use Unicode filenames */ + +/* volume format definitions */ + +/* data types */ +/* Volume configuration data */ + +typedef struct /* DOS_VOL_CONFIG */ + { /* Legend: M- modifiable, C- Calculated */ + enum + { _AUTO=0, _FAT12=12, _FAT16=16, _FAT32=32 } + fatType; /* M- Fat format Type */ + const char * sysId ; /* M- sys ID string */ + int secPerClust; /* M- sectors per cluster (minimum 1) */ + short nResrvd; /* M- number of reserved sectors (min 1) */ + short maxRootEnts; /* M- max number of entries in root dir */ + char nFats; /* M- number of FAT copies (minimum 1) */ + ULONG secPerFat; /* C- number of sectors per FAT copy */ + ULONG nClust; /* C- # of clusters on disk */ + ULONG nHidden; /* C- number of hidden sectors */ + ULONG volSerial ; /* M- disk serial number */ + int secPerTrack; /* M- sectors per track */ + char nHeads; /* M- number of heads */ + char mediaByte; /* M- media descriptor byte */ + char volLabel[ 11 ]; /* X- disk volume label */ + } DOS_VOL_CONFIG; + +/* + * A DOS_VOLUME_DESC_ID is pointer to DOS_VOLUME_DESC. For details + * see h/private/dosFsLibP.h. Note: That is a WRS private header file. + */ + +typedef struct DOS_VOLUME_DESC * DOS_VOLUME_DESC_ID; + +/* dosFsVolFormat() options: */ +#define DOS_OPT_DEFAULT 0x0000 /* format with default options */ +#define DOS_OPT_PRESERVE 0x0001 /* preserve boot block if possible */ +#define DOS_OPT_BLANK 0x0002 /* create a clean boot block */ +#define DOS_OPT_QUIET 0x0004 /* dont produce any output */ +#define DOS_OPT_FAT16 0x0010 /* format with FAT16 file system */ +#define DOS_OPT_FAT32 0x0020 /* format with FAT32 file system */ +#define DOS_OPT_VXLONGNAMES 0x0100 /* format with VxLong file names */ + +#define DOS_CACHE_VOL_NO_DMA 0x01 + +/* macros */ + +/* typedefs */ + +/* interface functions prototypes */ + +IMPORT STATUS dosFsLibInit (int maxFiles, int options); +IMPORT STATUS dosFsDevCreate ( char * pDevName, device_t device, + u_int maxFiles, u_int dosDevCreateOptions ); +IMPORT STATUS dosFsVolUnmount ( void * pDev ); +IMPORT STATUS dosFsShow( void * dev, u_int level ); +IMPORT STATUS dosFsVolFormat( char * path, int opt, FUNCPTR pPromptFunc ); +IMPORT STATUS dosFsVolFormatFd ( int fd, int opt, FUNCPTR pPromptFunc ); +IMPORT void dosFsFmtLibInit( void ); +IMPORT void dosChkLibInit( void ); +IMPORT STATUS dosDirOldLibInit( void ); +IMPORT STATUS dosVDirLibInit ( void ); +IMPORT STATUS dosFsFatInit ( void ); +IMPORT DOS_VOLUME_DESC_ID dosFsVolDescGet (void * pDevNameOrPVolDesc, + u_char ** ppTail); +IMPORT STATUS dosFsLastAccessDateEnable (DOS_VOLUME_DESC_ID dosVolDescId, + BOOL enable); +IMPORT STATUS dosFsDiskProbe (device_t xbdDevice); +IMPORT STATUS dosFsMonitorDevCreate (device_t xbdId, char * pDevName); +IMPORT STATUS dosFsDevDelete (DOS_VOLUME_DESC_ID pVolDesc); +IMPORT STATUS dosFsCacheCreate (char * volName, char * cacheAddr, + u_int cacheSize); +IMPORT STATUS dosFsCacheDelete (const char * volName); +IMPORT UINT dosFsDefaultCacheSizeGet (void); +IMPORT UINT dosFsDefaultCacheSizeSet (UINT newDefaultSize); +IMPORT UINT dosFsCacheOptionsSet (char * volName, UINT options); +IMPORT UINT dosFsCacheOptionsGet (char * volName); +IMPORT void dosFsCacheLibInit (u_int defaultCacheSize); +IMPORT void dosFsCacheShow (const char * volName, u_int level); + +IMPORT STATUS dosSetVolCaseSens /* set rename case sens */ + ( + DOS_VOLUME_DESC_ID pVolDesc, + BOOL sensitivity /* TRUE == case sens */ + ); + +/* OS Macro's */ + +#ifndef _WRS_PACK_ALIGN +# define _WRS_PACK_ALIGN(x) __attribute__((packed, aligned(x))) +#endif /* _WRS_PACK_ALIGN */ + + +#if TRUE /* SPR#71720, avoiding unaligned pointer accesses. */ + +/* GNU versions of new OS macros */ + +#ifndef _WRS_ALIGNOF +/* + * _WRS_ALIGNOF - return the alignment of an item, in bytes + * + * Returns the byte alignment for an item. The returned value + * is the alignment in units of bytes. + */ + +# define _WRS_ALIGNOF(x) \ + __alignof__(x) + +#endif /* ifndef _WRS_ALIGNOF */ + +#ifndef _WRS_ALIGN_CHECK +/* + * _WRS_ALIGN_CHECK - test a pointer for a particular alignment + * + * Returns TRUE if the pointer is aligned sufficiently to be a + * pointer to a specified data type. Returns FALSE if the pointer + * value is not aligned to be a valid pointer to the data type. + */ + +# define _WRS_ALIGN_CHECK(ptr, type) \ + (((int)(ptr) & ( _WRS_ALIGNOF(type) - 1)) == 0 ? TRUE : FALSE) + +#endif /* ifndef _WRS_ALIGN_CHECK */ + +#endif /* TRUE/FALSE - SPR#71720, avoiding unaligned pointer accesses. */ + + + +#ifdef DOS_FS_COMPAT +/* types for backwards compatibility, should be discontinued */ +#include "blkIo.h" + +typedef void * DOS_VOL_DESC ; + +/* DOS_PART_TBL is obsolete: use dpartCbio/usrFdiskPartLib instead */ + +typedef struct /* DOS_PART_TBL */ + { + UINT8 dospt_status; /* partition status */ + UINT8 dospt_startHead; /* starting head */ + short dospt_startSec; /* starting sector/cylinder */ + UINT8 dospt_type; /* partition type */ + UINT8 dospt_endHead; /* ending head */ + short dospt_endSec; /* ending sector/cylinder */ + ULONG dospt_absSec; /* starting absolute sector */ + ULONG dospt_nSectors; /* number of sectors in part */ + } _WRS_PACK_ALIGN (2) DOS_PART_TBL; + + +/* dosFs Date and Time Structure - should be replaced with ANSI time */ + +typedef struct /* DOS_DATE_TIME */ + { + int dosdt_year; /* current year */ + int dosdt_month; /* current month */ + int dosdt_day; /* current day */ + int dosdt_hour; /* current hour */ + int dosdt_minute; /* current minute */ + int dosdt_second; /* current second */ + } DOS_DATE_TIME; + +/* old defines */ +#define DOS_BOOT_SYS_ID 0x03 /* system ID string (8 bytes)*/ +#define DOS_SYS_ID_LEN 8 /* length of system ID string */ +#define DOS_BOOT_PART_TBL 0x1be /* first disk partition tbl (16 bytes)*/ + +/* old proprietary long file names, now renamed VXLONGNAMES */ +#define DOS_OPT_LONGNAMES 0x4 + +/* All other old options are non applicable anymore, defined for compiles */ +#define DOS_OPT_CHANGENOWARN 0x1 /* disk may be changed w/out warning */ +#define DOS_OPT_AUTOSYNC 0x2 /* autoSync mode enabled */ +#define DOS_OPT_EXPORT 0x8 /* file system export enabled */ +#define DOS_OPT_LOWERCASE 0x40 /* filenames use lower-case chars */ + +/* old prototypes */ +extern DOS_VOL_DESC * dosFsDevInit (char *pDevName, BLK_DEV *pBlkDev, + DOS_VOL_CONFIG *pConfig); +extern DOS_VOL_DESC * dosFsMkfs (char *pVolName, BLK_DEV *pBlkDev); + +/* function pointers to fmt handler */ +/* format routine */ +IMPORT STATUS (*dosFsFmtRtn)( char *path, int opt, FUNCPTR pPromptFunc ); + + +/* end of backward compatibility types */ +#endif /* DOS_FS_COMPAT */ + +#ifdef __cplusplus + } +#endif + +#endif /* __INCdoFsLib */ diff --git a/h/dpartCbio.h b/h/dpartCbio.h new file mode 100644 index 0000000..4ed2923 --- /dev/null +++ b/h/dpartCbio.h @@ -0,0 +1,46 @@ +/* dpartCbio.h - disk partition manager header file */ + +/* Copyright 1999-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,23sep04,act back out changes for SPR#90008 +01f,03may04,jkf SPR#90008, adding device deletion routine +01e,21sep01,jkf SPR#69031, common code for both AE & 5.x. +01d,31jul99,jkf changed maximum partitions to 24, SPR#28277 +01c,31jul99,jkf T2 merge, tidiness & spelling. +01b,14oct98,lrn T2.0 integration +01a,15jun98,lrn written. +*/ + +#ifndef __INCdpartCbioh +#define __INCdpartCbioh + +#ifdef __cplusplus +extern "C" { +#endif + +/* typedefs */ +typedef struct + { + u_long offset ; /* abs. # of first block in partition */ + u_long nBlocks ; /* total # of blocks in partition */ + int flags ; /* misc. flags */ + int spare ; /* padding, must be zero */ + } PART_TABLE_ENTRY ; + +/* defines */ +#define PART_MAX_ENTRIES 24 /* Max # of partitions */ + +/* prototypes */ +IMPORT CBIO_DEV_ID dpartDevCreate(CBIO_DEV_ID subDev, + int nPart, FUNCPTR pPartDecodeFunc); +IMPORT CBIO_DEV_ID dpartPartGet (CBIO_DEV_ID masterHandle, int partNum); + +#ifdef __cplusplus +} +#endif + +#endif /*__INCdpartCbioh*/ + diff --git a/h/drv/dma/i8237Dma.h b/h/drv/dma/i8237Dma.h new file mode 100644 index 0000000..b08fabf --- /dev/null +++ b/h/drv/dma/i8237Dma.h @@ -0,0 +1,85 @@ +/* i8237Dma.h - Intel 8237 DMA controller header */ + +/* Copyright 1984-1993 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01a,30sep93,hdn written. +*/ + +#ifndef __INCi8237Dmah +#define __INCi8237Dmah + +#ifdef __cplusplus +extern "C" { +#endif + + +/* DMA chip-1 IO address */ + +#define DMA1_BASE 0x00 + +#define DMA1_ADDR(chan) (DMA1_BASE + (chan << 1)) +#define DMA1_COUNT(chan) (DMA1_BASE + (chan << 1) + 1) +#define DMA1_STATUS 0x08 +#define DMA1_CMD 0x08 +#define DMA1_MASK_SINGLE 0x0a +#define DMA1_MODE 0x0b +#define DMA1_CLEAR_FF 0x0c +#define DMA1_CLEAR_ALL 0x0d +#define DMA1_CLEAR_MASK 0x0e +#define DMA1_MASK_ALL 0x0f + +/* DMA chip-2 IO address */ + +#define DMA2_BASE 0xc0 + +#define DMA2_ADDR(chan) (DMA2_BASE + ((chan - 4) << 2)) +#define DMA2_COUNT(chan) (DMA2_BASE + ((chan - 4) << 2) + 2) +#define DMA2_STATUS 0xd0 +#define DMA2_CMD 0xd0 +#define DMA2_MASK_SINGLE 0xd4 +#define DMA2_MODE 0xd6 +#define DMA2_CLEAR_FF 0xd8 +#define DMA2_CLEAR_ALL 0xda +#define DMA2_CLEAR_MASK 0xdc +#define DMA2_MASK_ALL 0xde + +/* mode register bit */ + +#define DMA_MODE_DEMAND 0x00 +#define DMA_MODE_SINGLE 0x40 +#define DMA_MODE_BLOCK 0x80 +#define DMA_MODE_CASCADE 0xc0 +#define DMA_MODE_DECREMENT 0x20 +#define DMA_MODE_INCREMENT 0x00 +#define DMA_MODE_AUTO_ENABLE 0x10 +#define DMA_MODE_AUTO_DISABLE 0x00 +#define DMA_MODE_WRITE 0x08 +#define DMA_MODE_READ 0x04 + +/* mask register bit */ + +#define DMA_MASK_SET 0x04 +#define DMA_MASK_RESET 0x00 + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +STATUS dmaSetup (int direction, void *pBuf, UINT nBytes, UINT chan); + +#else + +STATUS dmaSetup (); + +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCi8237Dmah */ + diff --git a/h/drv/dma/i960Dma.h b/h/drv/dma/i960Dma.h new file mode 100644 index 0000000..20fa07a --- /dev/null +++ b/h/drv/dma/i960Dma.h @@ -0,0 +1,116 @@ +/* i960Dma.h - Intel i960 DMA definitions */ + +/* Copyright 1984-1993 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01b,12feb93,ccc added cplusplus and ASMLANUGAGE. +01a,22jan93,ccc created for TP960V SCSI support +*/ + +/* +This file contains definitions associated with the i960's on-board DMA +controller, and the data structures used by the DMA interface routines +in "sysALib.s". See Intel's "I960CA User's Manual", Chapter 13 - but beware, +there seem to be many typos. + +These definitions (and the routines in "sysALib.s") are hardware-independent +and should really be in architecture-wide places rather than the BSP. +*/ + +#ifndef INCi960Dmah +#define INCi960Dmah + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "vxWorks.h" + +/* + * Bit positions and masks in DMA Command Register (DMAC) + * + * Note: 'chan' must be in range 0 to 3 + */ + +#define DMAC_CHAN_ENABLE_BIT(chan) ((chan) + 0) +#define DMAC_CHAN_TERM_BIT(chan) ((chan) + 4) +#define DMAC_CHAN_ACTIVE_BIT(chan) ((chan) + 8) +#define DMAC_CHAN_DONE_BIT(chan) ((chan) + 12) +#define DMAC_CHAN_WAIT_BIT(chan) ((chan) + 16) + +#define DMAC_CHAN_ENABLE(chan) (1 << DMAC_CHAN_ENABLE_BIT (chan)) +#define DMAC_CHAN_TERM(chan) (1 << DMAC_CHAN_TERM_BIT (chan)) +#define DMAC_CHAN_ACTIVE(chan) (1 << DMAC_CHAN_ACTIVE_BIT (chan)) +#define DMAC_CHAN_DONE(chan) (1 << DMAC_CHAN_DONE_BIT (chan)) +#define DMAC_CHAN_WAIT(chan) (1 << DMAC_CHAN_WAIT_BIT (chan)) + +#define DMAC_PRIORITY 0x00100000 +#define DMAC_THROTTLE 0x00200000 + + +/* Bit masks in DMA Control Word */ + +#define DMACW_XFER_8_TO_8 0 /* transfer mode specs */ +#define DMACW_XFER_8_TO_16 1 +#define DMACW_XFER_RESERVED_1 2 +#define DMACW_XFER_8_TO_32 3 + +#define DMACW_XFER_16_TO_8 4 +#define DMACW_XFER_16_TO_16 5 +#define DMACW_XFER_RESERVED_2 6 +#define DMACW_XFER_16_TO_32 7 + +#define DMACW_XFER_8_FLYBY 8 +#define DMACW_XFER_16_FLYBY 9 +#define DMACW_XFER_128_FLYBY_QUAD 10 +#define DMACW_XFER_32_FLYBY 11 + +#define DMACW_XFER_32_TO_8 12 /* Intel says 32 to 16 ?? */ +#define DMACW_XFER_32_TO_16 13 +#define DMACW_XFER_128_TO_128_QUAD 14 +#define DMACW_XFER_32_TO_32 15 + +#define DMACW_XFER_MASK 0x0000000F /* select one of the above */ + +#define DMACW_DST_HOLD 0x00000010 /* hold / increment dst addr */ +#define DMACW_DST_INCR 0x00000000 + +#define DMACW_SRC_HOLD 0x00000020 /* hold / increment src addr */ +#define DMACW_SRC_INCR 0x00000000 + +#define DMACW_SYNC_DST 0x000000C0 /* sync w. dst / src / none */ +#define DMACW_SYNC_SRC 0x00000080 /* (NB - Intel docs reverse */ +#define DMACW_SYNC_NONE 0x00000000 /* src/dst and sync/none.) */ + +#define DMACW_TERM_COUNT 0x00000100 /* end on count / EOP input */ +#define DMACW_TERM_EOP 0x00000000 + +#define DMACW_DST_CHAIN 0x00000200 /* dst chaining when set */ + +#define DMACW_SRC_CHAIN 0x00000400 /* src chaining when set */ + +#define DMACW_CHAIN_INT 0x00000800 /* intr on chain when set */ + +#define DMACW_CHAIN_WAIT 0x00001000 /* wait on chain when set */ + + +/* Parameters for "sysDmaChanSetup()" */ + +typedef struct dmaParams + { + UINT32 count; /* byte count to be transferred */ + volatile UINT8 * srcAddr; /* initial source address */ + volatile UINT8 * dstAddr; /* initial destination address */ + struct dmaParams * next; /* link to next transfer in chain */ + } DMA_PARAMS; + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* INCi960Dmah */ diff --git a/h/drv/dma/iPIIX4Dma.h b/h/drv/dma/iPIIX4Dma.h new file mode 100644 index 0000000..7dc3bd0 --- /dev/null +++ b/h/drv/dma/iPIIX4Dma.h @@ -0,0 +1,184 @@ +/* iPIIX4Dma.h - Intel 82371ab PCI-TO-ISA/IDEXCELERATOR(PIIX4) Driver Header file */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify, or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01d,23sep05,dee SPR#112529, define additional dma controller pci types +01c,02aug05,dee dma support for PIIX4 ATA controller +01b,20dec01,bsp function declaration changed. +01a,21Nov01,bsp written. +*/ + +/* + * Please refer to Intel Document Order Number: 290562-001 + * 82371AB PCI-TO-ISA / IDE XCELERATOR (PIIX4) + */ + +#ifndef __INCiPIIX4Dmah +#define __INCiPIIX4Dmah + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + + + /* includes */ + +#include +#include +#include +#include + + +/* defines */ + +#undef IDEDMA_DEBUG /* define to display debug messages */ +#undef PRINT_PRD_TABLE /* define to print the PRD table */ + +#define I82371AB_VENDOR_ID 0x8086 /* Intel Corp. */ +#define I82371AB_DEVICE_ID 0x7111 /* i82371AB PIIX4 */ +#define I82801AA_DEVICE_ID 0x2411 /* i82801AA ICH */ +#define I82801AB_DEVICE_ID 0x2421 /* i82801AB ICH0 */ +#define I82372FB_DEVICE_ID 0x7601 /* i82372FB */ + +#define I82371AB_MAC_64_K 0x10000 /* pow(2,16) */ +#define I82371AB_MAC_4_K 0x01000 /* pow(2,12) */ +#define I82371AB_MAC_512 0x00200 /* pow(2,9) */ + + + /* max number of controllers */ +#define I82371AB_MAX_CTRLS 0x2 /* 0 and 1 only */ + + + /* Offset in the PCI configuaration space */ + +#define PCI_CFG_BMIBA PCI_CFG_BASE_ADDRESS_4 + + /* 0x20-0x23 default = 0x0000 R/W */ +#define PCI_CFG_IDETIM(ctrl) (0x40 + ctrl * 2) +#define PCI_CFG_IDETIM_PRI 0x40 /* 0x40-0x41 default = 0x0000 R/W */ +#define PCI_CFG_IDETIM_SEC 0x42 /* 0x42-0x43 default = 0x0000 R/W */ +#define PCI_CFG_SIDETIME 0x44 /* 0x44 default = 0x00 R/W */ +#define PCI_CFG_UDMACTL 0x48 /* 0x48 default = 0x00 R/W */ +#define PCI_CFG_UDMATIM 0x4A /* 0x4A-0x4B default = 0x0000 R/W */ + + + /* Page-78, 2.7, Ref-1 */ + +#define I82371AB_BMICOMadd(ctrl) (ideController.ioBaseAddress + 0x0 + ctrl * 8) +#define I82371AB_BMISTAadd(ctrl) (ideController.ioBaseAddress + 0x2 + ctrl * 8) +#define I82371AB_BMIDTPadd(ctrl) (ideController.ioBaseAddress + 0x4 + ctrl * 8) +#define I82371AB_BMI_ALL 0xff +#define I82371AB_BMICOM 0x00 +#define I82371AB_BMISTA 0x01 +#define I82371AB_BMIDTP 0x02 + + + /* BMICOM */ + +#define I82371AB_RWCON 0x08 +#define I82371AB_SSBM 0x01 + + + /* BMISTA */ + +#define I82371AB_DMA1CAP 0x40 +#define I82371AB_DMA0CAP 0x20 +#define I82371AB_INT_STATUS 0x04 +#define I82371AB_IDEDMA_ERROR 0x02 +#define I82371AB_BMIDE_ACTIVE 0x01 + + + /* bit masks */ + +#define I82371AB_BMBIA_ADD_MASK 0xfff0 /* valid bits 15 to 4 */ + + /* PCI status */ +#define I82371AB_PCISTS_BME 0x0004 /* bus master enable bit*/ +#define I82371AB_PCISTS_IOSE 0x0001 /* I/O space enable bit */ + + /* IDE Timing Register */ +#define I82371AB_IDETIM_ENE 0x8000 /* IDE enable */ +#define I82371AB_IDETIM_PPE0 0x0004 /* PPC0 enable */ +#define I82371AB_IDETIM_IE0 0x0002 /* IORDY Sample Point + Enable Drive 0 */ + +/* A small delay for register hardware settling time*/ + +#define I82371AB_DELAY(ctrl) sysInByte(I82371AB_BMISTAadd(ctrl)); \ + sysInByte(I82371AB_BMISTAadd(ctrl)); \ + sysInByte(I82371AB_BMISTAadd(ctrl)); \ + sysInByte(I82371AB_BMISTAadd(ctrl)) + +/* typedefs */ + +typedef struct pci_ide_controller + { + int pciBusNo; + int pciDeviceNo; + int pciFuncNo; + + /* PCI configuaration Registers */ + + PCI_HEADER_DEVICE pciHeader; + UINT16 ideTim[2]; /* Primary channel - 40,41 */ + /* Secondary channel - 42,43 */ + UINT8 slaveIdeTim; /* 44 */ + UINT8 uDmaCtl; /* 48 */ + UINT16 uDmaTime; /* 4A-4B */ + + /* IO Space Registers */ + + UINT32 ioBaseAddress; + UINT8 bmiCom[2]; /* 0x00 */ + UINT8 bmiSta[2]; /* 0x02 */ + UINT32 bmiDtp[2]; /* 0x04 */ + + WDOG_ID bmiWdogId[2]; + BOOL bmiWdogOkay[2]; + UINT32 * pPRDTable[I82371AB_MAX_CTRLS]; + }PCI_IDE_CONTROLLER; + +typedef struct i82371DescTable + { + void * buffer; + UINT16 count; + UINT16 eot; +#define END_OF_TABLE 0x8000; /* end of table bit indication */ + } i82371_DESC_TBL; + + +/* function declarations */ + +extern STATUS iPIIX4PciIdeCtrlInit (int ctrl); +extern STATUS iPIIX4InitAtaDmaEngine (int ctrl, int drive, char * pBuf, + UINT32 bufLength, int direction); +extern STATUS iPIIX4StartAtaDmaEngine (int ctrl); +extern STATUS iPIIX4StopAtaDmaEngine (int ctrl); +extern STATUS iPIIX4AtaDmaTrnsfrWait (int ctrl, int time); +extern short iPIIX4AtaDmaModeNegotiate (short rwmode); +extern void iPIIX4IdeCtrlReset (void); +extern STATUS iPIIX4AtaDmaModeSet (int ctrl,int drive,short rwmode); + +#ifdef IDEDMA_DEBUG +extern void iPIIX4IdeDebugVerbosityLevelSet (int level); +extern int iPIIX4IdeDebugVerbosityLevelGet (void); +#endif /* IDEDMA_DEBUG */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCiPIIX4Dmah */ diff --git a/h/drv/dma/ibmMalDma.h b/h/drv/dma/ibmMalDma.h new file mode 100644 index 0000000..fac9c34 --- /dev/null +++ b/h/drv/dma/ibmMalDma.h @@ -0,0 +1,236 @@ +/* ibmMalDma.h - IBM Memory Access Layer (MAL) library header */ + +/* +******************************************************************************* + This source and object code has been made available to you by IBM on an + AS-IS basis. + + IT IS PROVIDED WITHOUT WARRANTY OF ANY KIND, INCLUDING THE WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE OR OF NONINFRINGEMENT + OF THIRD PARTY RIGHTS. IN NO EVENT SHALL IBM OR ITS LICENSORS BE LIABLE + FOR INCIDENTAL, CONSEQUENTIAL OR PUNITIVE DAMAGES. IBM'S OR ITS LICENSOR'S + DAMAGES FOR ANY CAUSE OF ACTION, WHETHER IN CONTRACT OR IN TORT, AT LAW OR + AT EQUITY, SHALL BE LIMITED TO A MAXIMUM OF $1,000 PER LICENSE. No license + under IBM patents or patent applications is to be implied by the copyright + license. + + Any user of this software should understand that neither IBM nor its + licensors will be responsible for any consequences resulting from the use + of this software. + + Any person who transfers this source code or any derivative work must + include the IBM copyright notice, this paragraph, and the preceding two + paragraphs in the transferred software. + + Any person who transfers this object code or any derivative work must + include the IBM copyright notice in the transferred software. + + COPYRIGHT I B M CORPORATION 2000 + LICENSED MATERIAL - PROGRAM PROPERTY OF I B M + +******************************************************************************** +\NOMANUAL +*/ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,03sep04,mdo Documentation fixes for apigen +01g,28may04,jln add MAL_RX_GROUP_HANDLER_RUNING +01f,26aug03,jln change malLib.c to ibmMalDma.h; + change ibmMalRxGroupHandlerEnable() API +01e,07jul03,jln rename EMAC_RXCHAN_GROUP to MAL_RXCHAN_GROUP +01d,11jun03,jln modified MAL_DATA structure, more comments. +01c,16may01,mcg common driver for walnut (405GP), cedar (NPe405x) +01b,15jan00,mcg added alignment requirement for buffer descriptor rings +01a,18oct99,mcg created +*/ + +/* +This file contains constants for the IBM Memory Access Layer core. +The emacEnd driver is tightly coupling with this header file, if any change +in the MAL data structure and APIs, the emacEnd.c should be recompiled. +*/ + +#ifndef INCibmMalDmah +#define INCibmMalDmah + +#ifdef __cplusplus +extern "C" { +#endif + +#define MAL_NUM_TYPES 2 +#define MAL_TX_TYPE 0 +#define MAL_RX_TYPE 1 +#define MAL_MAX_CHANNELS 32 /* 32 for receive, 32 for transmit */ + +/* + * Reduced configurations of MAL are used for chips with fewer communication + * cores inside. + */ + +#define MAL_NO_INTS 0x00000000 +#define MAL_EOB_INT_EN 0x00000001 +#define MAL_DE_INT_EN 0x00000002 +#define MAL_SERR_INT_EN 0x00000004 + +#define MAL_MAX_DESC 256 /* max descriptors per channel */ +#define MAL_MAX_DESC_TBL_SIZE (MAL_MAX_DESC * sizeof(MAL_BD)) +#define MAL_DESC_REQ_ALIGN (512*1024) /* 512KB */ + +/* MAX RX channels in a board */ + +#ifndef MAX_MAL_RX_CHANS +#define MAX_MAL_RX_CHANS 4 +#endif + +/* MAL flags */ + +#define MAL_RX_GROUP_ENABLE 0x0001 +#define MAL_RX_GROUP_POLL_ENABLE 0x0002 +#define MAL_RX_GROUP_HANDLER_RUNING 0x0004 + +/* MAL Channel structure */ + +typedef struct + { + UINT channelType; /* TX_TYPE or RX_TYPE */ + UINT channelNum; /* channel number (0 through 31) */ + UINT bufferSizeRX; /* receive buffer size if an RX channel */ + UINT channelIntMask; /* interrupt mask for this channel */ + VOIDFUNCPTR functionEOB; /* function for EOB int on this channel */ + UINT parmEOB; /* parameter for the above function */ + VOIDFUNCPTR functionDescErr; /* function for DE int on this channel */ + UINT parmDescErr; /* parameter for the above function */ + VOIDFUNCPTR functionSERR; /* function for MAL SERR int for this chn */ + UINT parmSERR; /* parameter for the above function */ + } MAL_CHANNEL; + +/* + * MAL initialization structure. This information is passed to the MAL driver + * in malInit(). + */ + +typedef struct + { + UINT dcrBaseReg; + UINT validChannels[MAL_NUM_TYPES]; + UINT intLvlTxeob; + UINT intVecTxeob; + UINT intLvlRxeob; + UINT intVecRxeob; + UINT intLvlTxde; + UINT intVecTxde; + UINT intLvlRxde; + UINT intVecRxde; + UINT intLvlSerr; + UINT intVecSerr; + } MAL_INIT; + +/* Structure to group all EMAC_RX channels */ + +typedef struct + { + int rotateIndex [MAX_MAL_RX_CHANS]; /* channel order to search */ + UINT rotateRx [MAX_MAL_RX_CHANS]; /* RX channels index in order */ + UINT chanNum; /* number of RX channels in group */ + UINT maxRxPktsPerInterrupt; /* Max RX packets in a interrupt */ + } MAL_RXCHAN_GROUP; + +/* + * MAL driver control structure. + */ + +typedef struct + { + MAL_INIT malInit; + char *descTablesAlloc; + char *descTables; + UINT reserved1; + MAL_CHANNEL malChannelArray[MAL_NUM_TYPES][MAL_MAX_CHANNELS]; + UINT malInitializedChannels[MAL_NUM_TYPES]; + UINT malFlags; + UINT reserved2; + MAL_RXCHAN_GROUP malRxChanGrp; + UINT reserved3; + UINT reserved4; + } MAL_DATA; + +/* + * MAL Buffer Descriptor Structure. The same structure is used for both + * Transmit and Receive channels. + */ +typedef struct + { + USHORT statusControl; /* Shared between MAL and comm core */ + USHORT dataLen; /* Buffer byte count */ + char * bufferAdrs; /* Buffer address */ + } MAL_BD; + + +/* + * The status/control bits in the MAL buffer descriptor structure have different + * meaning if the descriptor is used by a TX channel versus an RX channel. + * Bits 0:5 are used to convey MAL control/status. Bits 6:15 are + * used to convey the communication core's (EMAC for example) control/status. + */ + +/* MAL TX Descriptor Control/Status bits */ +#define MAL_TX_CTRL_READY 0x8000 /* Packet ready to transmit */ +#define MAL_TX_CTRL_WRAP 0x4000 /* Last descriptor in the ring */ +#define MAL_TX_CTRL_CM 0x2000 +#define MAL_TX_CTRL_LAST 0x1000 /* Last buffer for this packet */ +#define MAL_TX_CTRL_INTR 0x0400 /* Intr when packet TX complete*/ + +/* MAL RX Descriptor Control/Status bits */ +#define MAL_RX_CTRL_EMPTY 0x8000 /* Buffer empty, ready to RX */ +#define MAL_RX_CTRL_WRAP 0x4000 /* Last descriptor in the ring */ +#define MAL_RX_CTRL_CM 0x2000 +#define MAL_RX_CTRL_LAST 0x1000 /* Last buffer for this packet */ +#define MAL_RX_CTRL_FIRST 0x0800 /* 1st buffer for this packet */ +#define MAL_RX_CTRL_INTR 0x0400 /* Intr when packet RX complete*/ + +/* Masks */ +#define MAL_MAL_CTRL_BITS 0xFC00 /* All descriptor bits for MAL */ +#define MAL_COMMAC_CTRL_BITS 0x03FF /* All descriptor bits for the */ + /* communications core */ + +#define MAL_RX_ONE_BUFFER (MAL_RX_CTRL_FIRST | MAL_RX_CTRL_LAST) + + +/* External functions */ +#if defined(__STDC__) || defined(__cplusplus) + +void ibmMalReset (UINT dcrBaseReg); +MAL_DATA * ibmMalInit (MAL_INIT *pMalInit); +STATUS ibmMalChannelInit (MAL_DATA *pMalData, MAL_CHANNEL *pChannel); +STATUS ibmMalChannelDelete (MAL_DATA *pMalData, UINT channelType, UINT channelNum); +STATUS ibmMalChannelActivate (MAL_DATA *pMalData, UINT channelType, UINT channelNum); +STATUS ibmMalChannelStop (MAL_DATA *pMalData, UINT channelType, UINT channelNum); +STATUS ibmMalChannelIntMaskGet (MAL_DATA *pMalData, UINT channelType, UINT channelNum, UINT * intMask); +STATUS ibmMalChannelIntMaskSet (MAL_DATA *pMalData, UINT channelType, UINT channelNum, UINT intMask); +STATUS ibmMalChannelDescTblPtrGet (MAL_DATA *pMalData, UINT channelType, UINT channelNum, + MAL_BD ** descTblAdrs); +STATUS ibmMalShutDown (MAL_DATA * pMalData); +void ibmMalRxGroupHandlerEnable (MAL_DATA *, BOOL, BOOL); +#else +void ibmMalReset (); +MAL_DATA * ibmMalInit (); +STATUS ibmMalChannelInit (); +STATUS ibmMalChannelDelete (); +STATUS ibmMalChannelActivate (); +STATUS ibmMalChannelStop (); +STATUS ibmMalChannelIntMaskGet (); +STATUS ibmMalChannelIntMaskSet (); +STATUS ibmMalChannelDescTblPtrGet (); +STATUS ibmMalShutDown (); +void ibmMalRxGroupHandlerEnable (); +#endif /* defined(__STDC__) || defined(__cplusplus) */ + +#ifdef __cplusplus +} +#endif + +#endif /* INCibmMalDmah */ diff --git a/h/drv/dma/l64853.h b/h/drv/dma/l64853.h new file mode 100644 index 0000000..02ee1c3 --- /dev/null +++ b/h/drv/dma/l64853.h @@ -0,0 +1,109 @@ +/* l64853.h - L64853 SBus DMA Controller header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01g,22sep92,rrr added support for c++ +01f,06aug92,ccc added function prototypes. +01e,26may92,rrr the tree shuffle +01d,26may92,ajm got rid of HOST_DEC def's (new compiler) + updated copyright +01c,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01b,28sep91,ajm ifdef'd HOST_DEC for compiler problem +01a,27jun91,jcc written. +*/ + +#ifndef __INCl64853h +#define __INCl64853h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "vxWorks.h" +#include "dma.h" + +typedef struct l64853dmaCtrl /* L64853_DMA_CTRL - L64853 DMA ctrl info */ + { + DMA_CTRL dmaCtrl; /* generic DMA ctrl struct */ + volatile UINT32 * pCsrReg; /* ptr to Control / Status register */ + volatile UINT32 * pAdrsReg; /* ptr to Address Counter register */ + volatile UINT32 * pBcntReg; /* ptr to Byte Counter register */ + volatile UINT32 * pIdReg; /* ptr to ID register */ + } L64853_DMA_CTRL; + +typedef L64853_DMA_CTRL L64853; + +/* Control/Status Register Bit Fields */ + +#define L64853_CSR_INT_PEND 0x00000001 /* interrupt pending bit */ +#define L64853_CSR_ERR_PEND 0x00000002 /* error pending bit */ +#define L64853_CSR_PACK_CNT 0x0000000c /* pack count bits */ +#define L64853_CSR_INT_EN 0x00000010 /* interrupt enable bit */ +#define L64853_CSR_FLUSH 0x00000020 /* flush buffer bit */ +#define L64853_CSR_DRAIN 0x00000040 /* drain buffer bit */ +#define L64853_CSR_RESET 0x00000080 /* reset DMA bit */ +#define L64853_CSR_WRITE 0x00000100 /* read/write bit */ +#define L64853_CSR_EN_DMA 0x00000200 /* enable DMA bit */ +#define L64853_CSR_REQ_PEND 0x00000400 /* request pending bit */ +#define L64853_CSR_BYTE_ADDR 0x00001800 /* byte address bits */ +#define L64853_CSR_EN_CNT 0x00002000 /* enable counter bit */ +#define L64853_CSR_TC 0x00004000 /* terminal count bit */ +#define L64853_CSR_ILACC 0x00008000 /* ILACC 79C900 bit */ +#define L64853_CSR_DEV_ID 0xf0000000 /* device ID bits */ + +#endif /* _ASMLANGUAGE */ + +#ifndef _ASMLANGUAGE +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT void l64853AdrsCountSet (L64853 *pL64853, char *pAdrsCount); +IMPORT void l64853ByteCountSet (L64853 *pL64853, int byteCount); +IMPORT void l64853Write (L64853 *pL64853); +IMPORT void l64853CountEnable (L64853 *pL64853); +IMPORT void l64853DmaEnable (L64853 *pL64853); +IMPORT void l64853CountDisable (L64853 *pL64853); +IMPORT void l64853DmaDisable (L64853 *pL64853); +IMPORT void l64853Read (L64853 *pL64853); +IMPORT void l64853IntEnable (L64853 *pL64853); +IMPORT STATUS l64853Show (DMA_CTRL *pDmaCtrl); +IMPORT BOOL l64853ErrPendTest (L64853 *pL64853); +IMPORT void l64853Flush (L64853 *pL64853); +IMPORT BOOL l64853TermCountTest (L64853 *pL64853); +IMPORT void l64853Drain (L64853 *pL64853); +IMPORT DMA_CTRL *l64853CtrlCreate (UINT32 *baseAdrs, int regOffset, + UINT32 *pIdReg); + +#else /* __STDC__ */ + +IMPORT void l64853AdrsCountSet (); +IMPORT void l64853ByteCountSet (); +IMPORT void l64853Write (); +IMPORT void l64853CountEnable (); +IMPORT void l64853DmaEnable (); +IMPORT void l64853CountDisable (); +IMPORT void l64853DmaDisable (); +IMPORT void l64853Read (); +IMPORT void l64853IntEnable (); +IMPORT STATUS l64853Show (); +IMPORT BOOL l64853ErrPendTest (); +IMPORT void l64853Flush (); +IMPORT BOOL l64853TermCountTest (); +IMPORT void l64853Drain (); +IMPORT DMA_CTRL *l64853CtrlCreate (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCl64853h */ diff --git a/h/drv/dma/m5200Sdma.h b/h/drv/dma/m5200Sdma.h new file mode 100644 index 0000000..3519c53 --- /dev/null +++ b/h/drv/dma/m5200Sdma.h @@ -0,0 +1,110 @@ +/* sysM5200Sdma.h - Motorola MPC5200 Smartcomm DMA controller interface header */ + +/* Copyright 1990-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,27dec04,k_p cleanups +01a,17Jul03,pkr written +*/ + +#ifndef __INCm5200Sdmah +#define __INCm5200Sdmah + +/* includes */ + +#ifdef __cplusplus +extern "C" { +#endif + + typedef struct sdma_register_set + { + volatile UINT32 taskBar; /* MBAR_SDMA + 0x00 sdTpb */ + volatile UINT32 currentPointer; /* MBAR_SDMA + 0x04 sdMdeComplex */ + volatile UINT32 endPointer; /* MBAR_SDMA + 0x08 sdMdeComplex */ + volatile UINT32 variablePointer; /* MBAR_SDMA + 0x0c sdMdeComplex */ + + /* The following are Priority Task Decoder (ptd) UINTs in + * sdma/rtl_v/sdPtd.v. + * + * The ptd UINTister map below is from the smartcomm spec, table 3-2, + * page 3-54. + * + * The spec shows the ptd map as 20 words, but sdPtd.v has only + * implemented 19 + * + * The word commented out below is the one which is not implemented. + */ + + volatile UINT8 IntVect1; /* MBAR_SDMA + 0x10 sdPtd */ + volatile UINT8 IntVect2; /* MBAR_SDMA + 0x11 sdPtd */ + volatile UINT16 PtdCntrl; /* MBAR_SDMA + 0x12 sdPtd */ + + volatile UINT32 IntPend; /* MBAR_SDMA + 0x14 sdPtd */ + volatile UINT32 IntMask; /* MBAR_SDMA + 0x18 sdPtd */ + + volatile UINT32 TCR01; /* MBAR_SDMA + 0x1c sdPtd */ + volatile UINT32 TCR23; /* MBAR_SDMA + 0x20 sdPtd */ + volatile UINT32 TCR45; /* MBAR_SDMA + 0x24 sdPtd */ + volatile UINT32 TCR67; /* MBAR_SDMA + 0x28 sdPtd */ + volatile UINT32 TCR89; /* MBAR_SDMA + 0x2c sdPtd */ + volatile UINT32 TCRAB; /* MBAR_SDMA + 0x30 sdPtd */ + volatile UINT32 TCRCD; /* MBAR_SDMA + 0x34 sdPtd */ + volatile UINT32 TCREF; /* MBAR_SDMA + 0x38 sdPtd */ + volatile UINT8 IPR[32]; /*MBAR_SDMA + 0x3c .. + * MBAR_SDMA + 0x5b sdPtd + */ + volatile UINT32 res1; /* reserved */ + volatile UINT32 res2; /* reserved */ + volatile UINT32 res3; /* reserved */ + volatile UINT32 MDEDebug; /* MBAR_SDMA + 0x68 sdMdeComplex */ + volatile UINT32 ADSDebug; /* MBAR_SDMA + 0x6c sdAdsTop */ + volatile UINT32 Value1; /* MBAR_SDMA + 0x70 sdDbg */ + volatile UINT32 Value2; /* MBAR_SDMA + 0x74 sdDbg */ + volatile UINT32 Control; /* MBAR_SDMA + 0x78 sdDbg */ + volatile UINT32 Status; /* MBAR_SDMA + 0x7c sdDbg */ + volatile UINT32 EU00; /* MBAR_SDMA + 0x80 sdMac macer UINT */ + volatile UINT32 EU01; /* MBAR_SDMA + 0x84 sdMac macemr UINT */ + volatile UINT32 EU02; /* MBAR_SDMA + 0x88 unused */ + volatile UINT32 EU03; /* MBAR_SDMA + 0x8c unused */ + volatile UINT32 EU04; /* MBAR_SDMA + 0x90 unused */ + volatile UINT32 EU05; /* MBAR_SDMA + 0x94 unused */ + volatile UINT32 EU06; /* MBAR_SDMA + 0x98 unused */ + volatile UINT32 EU07; /* MBAR_SDMA + 0x9c unused */ + volatile UINT32 EU10; /* MBAR_SDMA + 0xa0 unused */ + volatile UINT32 EU11; /* MBAR_SDMA + 0xa4 unused */ + volatile UINT32 EU12; /* MBAR_SDMA + 0xa8 unused */ + volatile UINT32 EU13; /* MBAR_SDMA + 0xac unused */ + volatile UINT32 EU14; /* MBAR_SDMA + 0xb0 unused */ + volatile UINT32 EU15; /* MBAR_SDMA + 0xb4 unused */ + volatile UINT32 EU16; /* MBAR_SDMA + 0xb8 unused */ + volatile UINT32 EU17; /* MBAR_SDMA + 0xbc unused */ + volatile UINT32 EU20; /* MBAR_SDMA + 0xc0 unused */ + volatile UINT32 EU21; /* MBAR_SDMA + 0xc4 unused */ + volatile UINT32 EU22; /* MBAR_SDMA + 0xc8 unused */ + volatile UINT32 EU23; /* MBAR_SDMA + 0xcc unused */ + volatile UINT32 EU24; /* MBAR_SDMA + 0xd0 unused */ + volatile UINT32 EU25; /* MBAR_SDMA + 0xd4 unused */ + volatile UINT32 EU26; /* MBAR_SDMA + 0xd8 unused */ + volatile UINT32 EU27; /* MBAR_SDMA + 0xdc unused */ + volatile UINT32 EU30; /* MBAR_SDMA + 0xe0 unused */ + volatile UINT32 EU31; /* MBAR_SDMA + 0xe4 unused */ + volatile UINT32 EU32; /* MBAR_SDMA + 0xe8 unused */ + volatile UINT32 EU33; /* MBAR_SDMA + 0xec unused */ + volatile UINT32 EU34; /* MBAR_SDMA + 0xf0 unused */ + volatile UINT32 EU35; /* MBAR_SDMA + 0xf4 unused */ + volatile UINT32 EU36; /* MBAR_SDMA + 0xf8 unused */ + volatile UINT32 EU37; /* MBAR_SDMA + 0xfc unused */ + } sdma_regs; + +extern sdma_regs *sysSDMA; + +#define SDMA_PTDCNTRL_PE 1 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm5200Sdmah */ + diff --git a/h/drv/dma/m68450.h b/h/drv/dma/m68450.h new file mode 100644 index 0000000..295998c --- /dev/null +++ b/h/drv/dma/m68450.h @@ -0,0 +1,225 @@ +/* m68450.h - Tadpole TP32V system dependent library */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,26apr02,dat Adding cplusplus protection, SPR 75017 +01d,14mar95,vin included in the h/drv/dma directory. included copyright. +01c,07sep93,vin added dma channel macros and definitions made more generic; + changed the name of the file from scsiDma.h to m68450.h +01b,22jan91,tad rewritten to conform to Wind River coding standards. +01a,01oct87,tad written. +*/ + +/* +DESCRIPTION +This module contains definitions needed when using the 68450 DMA controller +on the Tadpole TP32V. The following macros need to be defined in target.h. +DMAC_ADRS,DMAC_CHANNEL_0_OFFSET,DMAC_CHANNEL_1_OFFSET,DMAC_CHANNEL_2_OFFSET +DMAC_CHANNEL_3_OFFSET,DMA_GCR + +*/ + +#ifndef __INCm68450h +#define __INCm68450h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* This structure defines the register layout of the device in memory */ +struct dmaRegisters + { + UINT8 csr; /* Channel status register */ + UINT8 cer; /* Channel error register */ + UINT8 pad1[2]; + UINT8 dcr; /* Device control register */ + UINT8 ocr; /* Operation control register */ + UINT8 scr; /* Sequence control register */ + UINT8 ccr; /* Channel control register */ + UINT8 pad2[2]; + UINT16 mtcr; /* Memory transfer count register */ + UINT32 mar; /* Memory address register */ + UINT8 pad3[4]; + UINT32 dar; /* Device address register */ + UINT8 pad4[2]; + UINT16 btcr; /* Base transfer count register */ + UINT32 bar; /* Base address register */ + UINT8 pad5[5]; + UINT8 nivr; /* Normal interrupt vector reg */ + UINT8 pad6[1]; + UINT8 eivr; /* Error interrupt vector reg */ + UINT8 pad7[1]; + UINT8 mfcr; /* Memory function code register */ + UINT8 pad8[3]; + UINT8 cpr; /* Channel priority register */ + UINT8 pad9[3]; + UINT8 dfcr; /* Device function code register */ + UINT8 pad10[7]; + UINT8 bfcr; /* Base function code register */ + }; + +/* Bitfield masks for registers in the dmaRegisters structure */ + +/* DCR */ + +#define DMA_XRM 0xC0 /* External request mode */ +#define DMA_DTYP 0x30 /* Device type */ +#define DMA_DPS 0x08 /* Device port size */ +#define DMA_PCL 0x07 /* Peripheral control line function */ + +/* OCR */ + +#define DMA_DIR 0x80 /* Transfer direction */ +#define DMA_SIZE 0x30 /* Operand size */ +#define DMA_CHAIN 0x0C /* Chain operation */ +#define DMA_REQG 0x03 /* Request generation */ + +/* SCR */ + +#define DMA_MAC 0x0C /* Memory address count */ +#define DMA_DAC 0x03 /* Device address count */ + +/* CCR */ + +#define DMA_STR 0x80 /* Start operation */ +#define DMA_CNT 0x40 /* Continue operation */ +#define DMA_HLT 0x20 /* Halt operation */ +#define DMA_SAB 0x10 /* Software abort */ +#define DMA_INT 0x08 /* Interrupt enable */ + +/* CSR */ + +#define DMA_COC 0x80 /* Channel operation complete */ +#define DMA_BTC 0x40 /* Block transfer complete */ +#define DMA_NDT 0x20 /* Normal device termination */ +#define DMA_ERR 0x10 /* Error */ +#define DMA_ACT 0x08 /* Channel active */ +#define DMA_PCT 0x02 /* PCL transition */ +#define DMA_PCS 0x01 /* PCL state */ + +/* GCR */ + +#define DMA_BT 0x0C /* Burst transfer time */ +#define DMA_BR 0x03 /* Bandwidth available to DMAC */ + +/* Bitfield definitions for DCR */ + +/* XRM */ + +#define DMA_BURST 0x00 /* Burst transfer mode */ +#define DMA_CYCNH 0x80 /* Cycle steal without hold */ +#define DMA_CYCWH 0xC0 /* Cycle stel with hold */ + +/* DTYP */ + +#define DMA_THOU 0x00 /* 68000 compatible, explicitly addressed */ +#define DMA_HUN 0x10 /* 6800 compatible, explicitly addressed */ +#define DMA_ACK 0x20 /* Device with ACK */ +#define DMA_ACKRDY 0x30 /* Device with ACK & RDY */ + +/* DPS */ + +#define DMA_PORT8 0x00 /* 8-bit port */ +#define DMA_PORT16 0x08 /* 16-bit port */ + +/* PCL */ + +#define DMA_STATUSINP 0x00 /* Status input (level read in CSR) */ +#define DMA_STATINPINT 0x01 /* Status input with interrupt */ +#define DMA_SPULSE 0x02 /* Start pulse output */ +#define DMA_ABINP 0x03 /* Abort input */ + +/* Bitfield definitions for OCR */ + +/* DIR */ + +#define DMA_MEMDEV 0x00 /* Memory to device */ +#define DMA_DEVMEM 0x80 /* Device to memory */ + +/* SIZE */ + +#define DMA_SZBYTE 0x00 /* Byte */ +#define DMA_SZWORD 0x10 /* Word */ +#define DMA_SZLWORD 0x20 /* Long word */ +#define DMA_SZBYTENP 0x30 /* Byte, no packing */ + +/* CHAIN */ + +#define DMA_CHAINDIS 0x00 /* Chaining disabled */ +#define DMA_CHAINARR 0x08 /* Array chaining enabled */ +#define DMA_CHAINARL 0x0C /* Linked array chaining enabled */ + +/* REQG */ + +#define DMA_INTLIM 0x00 /* Internal request at limited rate */ +#define DMA_INTMAX 0x01 /* Internal request at maximum rate */ +#define DMA_EXTERN 0x02 /* External request */ +#define DMA_EXTAUTO 0x03 /* External request, auto-start */ + +/* Bitfield definitions for SCR */ +/* MAC */ + +#define DMA_MNOCNT 0x00 /* MAR does not count */ +#define DMA_MUPCNT 0x04 /* MAR counts up */ +#define DMA_MDNCNT 0x80 /* MAR counts down */ + +/* DAC */ + +#define DMA_DNOCNT 0x00 /* DAR does not count */ +#define DMA_DUPCNT 0x01 /* DAR counts up */ +#define DMA_DDNCNT 0x20 /* DAR counts down */ + +/* Bitfield definitions for CER */ +/* ERROR CODE */ + +#define DMA_NOERR 0x00 /* No error */ +#define DMA_CONFIGERR 0x01 /* Configuration error */ +#define DMA_TIMEERR 0x02 /* Operation timing error */ +#define DMA_AMERR 0x05 /* Address error, MAR or MTCR */ +#define DMA_ADERR 0x06 /* Address error, DAR */ +#define DMA_ABERR 0x07 /* Address error, BAR or BTCR */ +#define DMA_BMERR 0x09 /* Bus error, MAR or MTCR */ +#define DMA_BDERR 0x0A /* Bus error, DAR */ +#define DMA_BBERR 0x0B /* Bus error, BAR or BTCR */ +#define DMA_CMERR 0x0D /* Count error, MAR or MTCR */ +#define DMA_CDERR 0x0E /* Count error, DAR */ +#define DMA_CBERR 0x0F /* Count error, BAR or BTCR */ +#define DMA_EXTAB 0x10 /* External abort */ +#define DMA_SFTAB 0x11 /* Software abort */ + +/* Bitfield definitions for GCR */ +/* BT */ + +#define DMA_BT16 0x00 /* 16 clocks */ +#define DMA_BT32 0x04 /* 32 clocks */ +#define DMA_BT64 0x08 /* 64 clocks */ +#define DMA_BT128 0x0C /* 128 clocks */ + +/* BR */ + +#define DMA_BW50 0x00 /* 50.00% bandwidth */ +#define DMA_BW25 0x01 /* 25.00% bandwidth */ +#define DMA_BW12 0x02 /* 12.50% bandwidth */ +#define DMA_BW6 0x03 /* 6.25% bandwidth */ + +#define DMA_0 ((struct dmaRegisters *) DMAC_ADRS + \ + DMAC_CHANNEL_0_OFFSET) +#define DMA_1 ((struct dmaRegisters *) DMAC_ADRS + \ + DMAC_CHANNEL_1_OFFSET) +#define DMA_2 ((struct dmaRegisters *) DMAC_ADRS + \ + DMAC_CHANNEL_2_OFFSET) +#define DMA_3 ((struct dmaRegisters *) DMAC_ADRS + \ + DMAC_CHANNEL_3_OFFSET) + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm68450h */ diff --git a/h/drv/dma/mpc107Dma.h b/h/drv/dma/mpc107Dma.h new file mode 100644 index 0000000..319a3ee --- /dev/null +++ b/h/drv/dma/mpc107Dma.h @@ -0,0 +1,182 @@ +/* mpc107Dma.h - MPC107 DMA registers definitions */ + +/* Copyright 1984-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,11sep00,rcs fix include path for mpc107.h +01a,06jun00,bri written +*/ + +#ifndef __INCmpc107Dmah +#define __INCmpc107Dmah + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "drv/multi/mpc107.h" + +/* defines */ + +/* MPC107 configuration registers for DMA interface */ + +#define MPC107_DMA_EUMBBAR 0x1000 /* Offset of DMA registers */ + /* in EUMBBAR Space */ + +/* DMA Channel Zero Register Definitions */ + +#define MPC107_DMA_DMR0 (MPC107_DMA_EUMBBAR + 0x100)/* Mode Register */ +#define MPC107_DMA_DSR0 (MPC107_DMA_EUMBBAR + 0x104)/* Status Register */ +#define MPC107_DMA_CDAR0 (MPC107_DMA_EUMBBAR + 0x108)/* Current Descriptor */ +#define MPC107_DMA_SAR0 (MPC107_DMA_EUMBBAR + 0x110)/* Source Address */ +#define MPC107_DMA_DAR0 (MPC107_DMA_EUMBBAR + 0x118)/* Destination Address */ +#define MPC107_DMA_BCR0 (MPC107_DMA_EUMBBAR + 0x120)/* Byte Count */ +#define MPC107_DMA_NDAR0 (MPC107_DMA_EUMBBAR + 0x124)/* Next Descriptor */ + +/* DMA Channel One Register Definitions */ + +#define MPC107_DMA_DMR1 (MPC107_DMA_EUMBBAR + 0x200) /* Mode Register */ +#define MPC107_DMA_DSR1 (MPC107_DMA_EUMBBAR + 0x204) /* Status Register */ +#define MPC107_DMA_CDAR1 (MPC107_DMA_EUMBBAR + 0x208) /* Current Descriptor */ +#define MPC107_DMA_SAR1 (MPC107_DMA_EUMBBAR + 0x210) /* Source Address */ +#define MPC107_DMA_DAR1 (MPC107_DMA_EUMBBAR + 0x218) /* Destination Address */ +#define MPC107_DMA_BCR1 (MPC107_DMA_EUMBBAR + 0x220) /* Byte Count */ +#define MPC107_DMA_NDAR1 (MPC107_DMA_EUMBBAR + 0x224) /* Next Descriptor */ + +/* Bit Definitions */ + +/* Mode Register Bit Definitons */ + +#define MPC107_DMA_DMR_CS 0x00000001 /* Channel Start */ +#define MPC107_DMA_DMR_CC 0x00000002 /* Channel Continue */ +#define MPC107_DMA_DMR_CTM 0x00000004 /* Direct DMA mode */ + /* Channel Transfer */ +#define MPC107_DMA_DMR_DL 0x00000008 /* Descriptor Location */ +#define MPC107_DMA_DMR_EOTIE 0x00000080 /* End of Transfer */ + /* Interrupt Enable */ +#define MPC107_DMA_DMR_EIE 0x00000100 /* Error Interrupt Enable */ +#define MPC107_DMA_DMR_PDE 0x00040000 /* Periodic DMA Enable */ + +/* Status Register Bit Definitions */ + +#define MPC107_DMA_DSR_EOCAI 0x00000001 /* End of chain or */ + /* direct Interrupt */ +#define MPC107_DMA_DSR_EOSI 0x00000002 /* End of Segment Interrupt */ +#define MPC107_DMA_DSR_CB 0x00000004 /* Channel Busy */ +#define MPC107_DMA_DSR_PE 0x00000010 /* PCI Error */ +#define MPC107_DMA_DSR_LME 0x00000080 /* Local Memory Error */ + +/* Current Descriptor Address Register Bit definitions */ + +#define MPC107_DMA_CDAR_CTT_SHIFT 0x2 /* Transfer Type Shift */ +#define MPC107_DMA_CDAR_ADDR_MASK 0xffffffc0 /* Address Mask */ +#define MPC107_DMA_CDAR_EOSIE 0x00000008 /* End of Segment Interrupt */ +#define MPC107_DMA_CDAR_SNEN 0x00000010 /* Snoop Enable */ + +/* Next Descriptor Address Register Bit definitions */ + +#define MPC107_DMA_NDAR_EOTD 0x00000001 /* End of transfer descriptor */ +#define MPC107_DMA_NDAR_NDEOSIE 0x00000008 /* Next descriptor */ + /* end-of-segment interrupt */ + /* enable */ +#define MPC107_DMA_NDAR_NDSNEN 0x00000010 /* Snoop Enable */ +#define MPC107_DMA_NDAR_ADDR_MASK 0xffffffc0 /* Address Mask */ + +/* + * DMA 0 Mode register default value + * Error Interrupt Disabled ,End of Transfer + * Interrupt Disabled and Direct Mode DMA transfer + */ + +#define MPC107_DMA_DMR0_DEFAULT 0x04 + +/* + * DMA 1 Mode register default value + * Error Interrupt Disabled ,End of Transfer + * Interrupt Disabled and Direct Mode DMA transfer + */ + +#define MPC107_DMA_DMR1_DEFAULT 0x04 + + +/* General Definitions */ + +#define MPC107_DMA_CHANNEL0 0x0 /* Channel Zero */ +#define MPC107_DMA_CHANNEL1 0x1 /* Channel One */ +#define MPC107_DMA_MEM_ALIGN 0x3 /* For aligining to 8 words */ + /* 2exp3 = 8 */ + +#define MPC107_DMA_CH_BUSY_MASK 0x00000001 /* Channel busy mask */ + +#define MPC107_DMA_TIMEOUT_BUSY 0x10000 + +/* Error Numbers and Return Values */ + +#define MPC107_DMA_PERIODIC_CH 0x01 /* Channel configured for */ + /* Periodic DMA */ +#define MPC107_DMA_CHAIN_CH 0x02 /* Channel configured for */ + /* Chained DMA */ +#define MPC107_DMA_DIRECT_CH 0x03 /* Channel configured for */ + /* Direct DMA */ +#define MPC107_DMA_PERIODIC_CH_FREE 0x04 /* periodic DMA is configured */ + /* and channel is free */ +#define MPC107_DMA_PERIODIC_CH_BUSY 0x05 /* "periodic" DMA is configured */ + /* and channel is Busy */ +#define MPC107_DMA_CHAIN_CH_FREE 0x06 /* chained DMA is configured */ + /* and channel is free */ +#define MPC107_DMA_CHAIN_CH_BUSY 0x07 /* chained DMA is configured */ + /* and channel is busy */ +#define MPC107_DMA_DIRECT_CH_FREE 0x08 /* direct DMA is configured */ + /* and channel is free */ +#define MPC107_DMA_DIRECT_CH_BUSY 0x09 /* direct DMA is configured */ + /* and channel is busy */ +#define MPC107_DMA_NUM_BYTES 0x0a /* Number of bytes is zero */ +#define MPC107_DMA_UNDEF_CH 0x0b /* Undefined Channel Number */ + + +/* typedefs */ + +/* + * Descriptors for Chained /Periodic DMA transfers . + * Descriptors should be alligned on a 8 word byte boundary + */ + +typedef struct mpc107DmaDescriptors + { + UCHAR *pSourceAddress; /* Pointer to Source address */ + ULONG reserved1; /* Reserved 1 */ + UCHAR *pDestinationAddress; /* Pointer to Destination address */ + ULONG reserved2; /* Reserved 2 */ + struct mpc107DmaDescriptors *pNextDescriptorAddress; /* Pointer to next */ + /* descriptor */ + ULONG reserved3; /* Reserved 3 */ + ULONG numberOfBytes; /* Number of bytes */ + ULONG reserved4; /* Reserved 4 */ + } MPC107_DMA_DESCRIPTOR; + +/* function declrations */ + +IMPORT void mpc107DmaInit (void); +IMPORT STATUS mpc107DmaStartDirect (UINT32 channelNumber, UINT32 transferType, + UINT32 sourceAddress , + UINT32 destinationAddress, + UINT32 numberOfBytes); +IMPORT STATUS mpc107DmaChainedStart (UINT32 channelNumber,UINT32 timePeriod); +IMPORT STATUS mpc107DmaPeriodicStop (UINT32 channelNumber ); +IMPORT STATUS mpc107DmaBuildDecsriptor (UINT32 channelNumber, + UCHAR *pSourceAddress, + UCHAR *pDestinationAddress, + UINT32 transferType, + UINT32 numberOfBytes); +IMPORT INT32 mpc107DmaStatus (ULONG channel); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmpc107Dmah */ + diff --git a/h/drv/dma/we32104.h b/h/drv/dma/we32104.h new file mode 100644 index 0000000..28e3395 --- /dev/null +++ b/h/drv/dma/we32104.h @@ -0,0 +1,143 @@ +/* we32104.h - Western Electric 32104 DMA controller header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01f,22sep92,rrr added support for c++ +01e,26may92,rrr the tree shuffle +01d,26may92,ajm got rid of HOST_DEC def's (new compiler) + updated copyright +01c,04oct91,rrr passed through the ansification filter + -changed copyright notice +01b,28sep91,ajm ifdef'd HOST_DEC for compiler problem +01e,02Aug91,rfs created +*/ + +#ifndef __INCwe32104h +#define __INCwe32104h + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef struct we32104_chan + { + volatile u_int SourceAdd; + volatile u_int DestAdd; + u_int Dummy1; + volatile u_int BaseAdd; + volatile u_int TranCount; + u_int Dummy2; + volatile u_int IntVect; + u_int Dummy3; + volatile u_int StatCont; + u_int Mode; + u_int DevControl; + u_int Fill [21]; + } WE32104_CHAN; + +typedef struct we32104 + { + WE32104_CHAN Ch0; + WE32104_CHAN Ch1; + WE32104_CHAN Ch2; + WE32104_CHAN Ch3; + u_int Dummy1 [4]; + u_int Mask; + u_int Dummy5 [123]; + volatile u_int DataBuf0 [8]; + u_int Dummy6 [24]; + volatile u_int DataBuf1 [8]; + u_int Dummy7 [24]; + volatile u_int DataBuf2 [8]; + u_int Dummy8 [24]; + volatile u_int DataBuf3 [8]; + } WE32104; + + +/***** mode register bit defs *****/ + +#define MODE_IE 0x0004 /* interrupt enable */ + +#define MODE_DS_MASK 0x00e0 /* system buss data size bits */ +#define MODE_DS_CHAR 0x00e0 /* size is 8 bits */ +#define MODE_DS_SHORT 0x00c0 /* size is 16 bits */ +#define MODE_DS_LONG 0x0080 /* size is 32 bits */ +#define MODE_DS_DOUBLE 0x00a0 /* size is 64 bits */ +#define MODE_DS_QUAD 0x0000 /* size is 128 bits */ + +#define MODE_DAC 0x0200 /* dest addr constant */ +#define MODE_SAC 0x0800 /* src addr constant */ + +#define MODE_TT_MASK 0x6000 /* transfer type bits */ +#define MODE_TT_MM 0x0000 /* memory to memory */ +#define MODE_TT_PM 0x2000 /* peripheral to memory */ +#define MODE_TT_MP 0x4000 /* memory to peripheral */ +#define MODE_TT_MF 0x6000 /* memory fill */ + +#define MODE_BR 0x8000 /* burst mode */ + + +/***** device control register bit defs *****/ + +#define DCR_PA_MASK 0x007c /* peripheral buss address bits. + * there are 32 possible addresses, + * too many to give indidual defs. + */ + +#define DCR_SF_MASK 0x0380 /* stretch field bits, in sync mode */ +#define DCR_SF_0 0x0000 /* insert 0 wait state */ +#define DCR_SF_1 0x0010 /* insert 1 wait state, etc. */ +#define DCR_SF_2 0x0100 +#define DCR_SF_4 0x0180 +#define DCR_SF_8 0x0200 +#define DCR_SF_16 0x0280 +#define DCR_SF_32 0x0300 +#define DCR_SF_64 0x0380 + +#define DCR_SA_MASK 0x0400 /* sync/async bit mask */ +#define DCR_SYNC 0x0400 /* sync mode, use SF field */ +#define DCR_ASYNC 0x0000 /* async mode */ + +#define DCR_BL 0x2000 /* burst length */ + +#define DCR_CS_MASK 0xc000 /* peripheral buss chip select bits */ +#define DCR_CS_0 0x0000 /* chip select 0 */ +#define DCR_CS_1 0x4000 /* chip select 1 */ +#define DCR_CS_2 0x8000 /* chip select 2 */ +#define DCR_CS_3 0xc000 /* chip select 3 */ + + +/***** status and control register bit defs *****/ + +#define SCR_NT 0x0001 /* normal transfer complete */ + +#define SCR_ERR_MASK 0x0037 /* error bits mask */ +#define SCR_ERR_NONE 0x0000 +#define SCR_ERR_BERR 0x0002 /* buss error */ +#define SCR_ERR_CS 0x0004 /* CS pin active when master */ +#define SCR_ERR_SA 0x0008 /* software abort issued */ +#define SCR_ERR_TIME 0x0020 /* peripheral buss time out */ + +#define SCR_ACT 0x0100 /* channel is active status */ +#define SCR_SA 0x0200 /* software abort cmd */ +#define SCR_HB 0x0400 /* channel halt cmd */ +#define SCR_STR 0x0800 /* channel start cmd */ +#define SCR_CH 0x1000 /* use chaining cmd */ + + +/***** mask register bit defs *****/ + +#define MASK_CH0 0x1 +#define MASK_CH1 0x2 +#define MASK_CH2 0x4 +#define MASK_CH3 0x8 + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwe32104h */ diff --git a/h/drv/end/amd8111LanEnd.h b/h/drv/end/amd8111LanEnd.h new file mode 100644 index 0000000..70daeb5 --- /dev/null +++ b/h/drv/end/amd8111LanEnd.h @@ -0,0 +1,685 @@ +/* amd8111LanEnd.h - END style AMD 8111 LAN PCI Ethernet driver header */ + +/* + * Copyright (c) 1998-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01b,01sep05,gtf modified for AMD8111 LAN END driver. +01a,07dec98,snk added support 7997x[012] across architectures. + written from 01b of lnPciEnd.h +*/ + +#ifndef __INCamd8111LanEndh +#define __INCamd8111LanEndh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include +#include +#include + + +/* board level/bus specific and architecture specific macros */ + +#if (CPU_FAMILY == PPC) + +#ifndef AMD_LONG_WR +#define AMD_LONG_WR(addr, value) (sysOutLong ((ULONG) addr, (ULONG) value)) +#endif + +#ifndef AMD_WORD_WR +#define AMD_WORD_WR(addr, value) (sysOutWord ((ULONG) addr, (USHORT) value)) +#endif + +#ifndef AMD_BYTE_WR +#define AMD_BYTE_WR(addr, value) (sysOutByte ((ULONG) addr, (UCHAR) value)) +#endif + +#ifndef AMD_LONG_RD +#define AMD_LONG_RD(addr, value) (value = sysInLong ((ULONG) addr)) +#endif + +#ifndef AMD_WORD_RD +#define AMD_WORD_RD(addr, value) (value = sysInWord ((ULONG) addr)) +#endif + +#ifndef AMD_BYTE_RD +#define AMD_BYTE_RD(addr, value) (value = sysInByte ((ULONG) addr)) +#endif + +#endif /* CPU_FAMILY == PPC */ + +#ifndef AMD_LONG_WR +#define AMD_LONG_WR(addr, value) \ + (* (volatile UINT32 *) (addr) = ((UINT32) AMD_SWAP_LONG (value) )) +#endif /* FEI_LONG_WR */ + +#ifndef AMD_WORD_WR +#define AMD_WORD_WR(addr, value) \ + (* (volatile UINT16 *) (addr) = ((UINT16) AMD_SWAP_WORD (value) )) +#endif /* FEI_WORD_WR */ + +#ifndef AMD_BYTE_WR +#define AMD_BYTE_WR(addr, value) \ + (* (volatile UINT8 *) (addr) = (UINT8) (value) ) +#endif /* FEI_BYTE_WR */ + +#ifndef AMD_LONG_RD +#define AMD_LONG_RD(addr, value) \ + do { \ + UINT32 _temp_ = *(volatile UINT32 *)(addr); \ + (value) = (UINT32) AMD_SWAP_LONG (_temp_); \ + } while (0) +#endif /* FEI_LONG_RD */ + +#ifndef AMD_WORD_RD +#define AMD_WORD_RD(addr, value) \ + do { \ + UINT16 _temp_ = *(volatile UINT16 *)(addr); \ + (value) = (UINT16) AMD_SWAP_WORD (_temp_); \ + } while (0) +#endif /* FEI_WORD_RD */ + +#ifndef AMD_BYTE_RD +#define AMD_BYTE_RD(addr, value) \ + do { \ + (value) = (UINT8) (*(volatile UINT8 *)(addr)); \ + } while (0) +#endif /* FEI_BYTE_RD */ + + +#if _BYTE_ORDER==_BIG_ENDIAN +# define PCI_SWAP(x) ((amd8111LanBusEndianess) ? (int)(x) : LONGSWAP((int)(x))) +#else +# define PCI_SWAP(x) (x) +#endif + + +/* 32-bits */ + +#define CHIPID (0x004) +#define AUTO_POLL_VAL (0x098) + +/* 16-bites */ + +#define AP0 (0x088) + +#define AP0_PHY0_ADDR_MASK 0x001f + +#define AP1 (0x08a) + +#define AP1_REG1_EN 0x8000 +#define AP1_REG1_ADDR_MASK 0x1f00 +#define AP1_PRE_SUP1 0x0040 +#define AP1_PHY1_DFLT 0x0020 +#define AP1_PHY1_ADDR_MASK 0x001f + +#define AP2 (0x08c) +#define AP3 (0x08e) +#define AP4 (0x090) +#define AP5 (0x092) + +/* 32-bits */ + +#define BADR (0x120) +#define BADX0 (0x100) +#define BADX1 (0x108) +#define BADX2 (0x110) +#define BADX3 (0x118) + +#define CMD0 (0x048) + +#define CMD0_RDMD0 0x00010000 +#define CMD0_TDMD3 0x00000800 +#define CMD0_TDMD2 0x00000400 +#define CMD0_TDMD1 0x00000200 +#define CMD0_TDMD0 0x00000100 +#define CMD0_UINTCMD 0x00000040 +#define CMD0_RX_FAST_SPND 0x00000020 +#define CMD0_TX_FAST_SPND 0x00000010 +#define CMD0_RX_SPND 0x00000008 +#define CMD0_TX_SPND 0x00000004 +#define CMD0_INTREN 0x00000002 +#define CMD0_RUN 0x00000001 + +#define CMD2 (0x050) + +#define CMD2_CONDUIT_MODE 0x20000000 +#define CMD2_RPA 0x00100000 +#define CMD2_DRCVPA 0x00080000 +#define CMD2_DRCVBC 0x00040000 +#define CMD2_PROM 0x00020000 +#define CMD2_ASTRIP_RCV 0x00002000 +#define CMD2_RCV_DROP0 0x00001000 +#define CMD2_EMBA 0x00000800 +#define CMD2_DXMT2PD 0x00000400 +#define CMD2_LTINTEN 0x00000200 +#define CMD2_DXMTFCS 0x00000100 +#define CMD2_APAD_XMT 0x00000040 +#define CMD2_DRTY 0x00000020 +#define CMD2_INLOOP 0x00000010 +#define CMD2_EXLOOP 0x00000008 +#define CMD2_REXUFLO 0x00000002 + +#define CMD3 (0x054) + +#define CMD3_JUMBO 0x00400000 +#define CMD3_VSIZE 0x00200000 +#define CMD3_VLONLY 0x00100000 +#define CMD3_VL_TAG_DEL 0x00080000 +#define CMD3_EN_PMGR 0x00004000 +#define CMD3_FORCE_FULL_DUPLEX 0x00001000 +#define CMD3_FORCE_LINK_STATUS 0x00000800 +#define CMD3_APEP 0x00000400 +#define CMD3_MPPLBA 0x00000200 +#define CMD3_BKPRS_EN 0x00000100 +#define CMD3_RESET_PHY_PULSE 0x00000004 +#define CMD3_RESET_PHY 0x00000002 +#define CMD3_PHY_RST_POL 0x00000001 + +#define CMD7 (0x064) + +#define CMD7_PMAT_SAVE_MATCH 0x00000010 +#define CMD7_PMAT_MODE 0x00000008 +#define CMD7_MPEN_SW 0x00000002 +#define CMD7_LCMODE_SW 0x00000001 + + +#define CTRL1 (0x06c) + +#define CTRL1_RESET_PHY_WIDTH_MASK 0x001f0000 +#define CTRL1_XMTSP_MASK 0x00000300 +#define CTRL1_CACHE_ALIGN 0x00000010 +#define CTRL1_BURST_LIMIT_MASK 0x0000000f + + +#define CTRL2 (0x070) + +#define CTRL2_FMDC_MASK 0x00000300 +#define CTRL2_XPHYRST 0x00000080 +#define CTRL2_XPHYANE 0x00000040 +#define CTRL2_XPHYFD 0x00000020 +#define CTRL2_XPHYSP_MASK 0x00000018 +#define CTRL2_APDW_MASK 0x00000007 + + +#define DLY_INT_A (0x0a8) +#define DLY_INT_B (0x0ac) + +#define FLOW (0x0c8) + +/* 8-bits */ +#define IPG (0x18d) +#define IFS1 (0x18c) + + +/* 32-bits */ + +#define INT0 (0x038) + +#define INT0_INTR 0x80000000 +#define INT0_INTPN 0x40000000 +#define INT0_LCINT 0x08000000 +#define INT0_APINT5 0x04000000 +#define INT0_APINT4 0x02000000 +#define INT0_APINT3 0x01000000 +#define INT0_APINT2 0x00800000 +#define INT0_APINT1 0x00400000 +#define INT0_APINT0 0x00200000 +#define INT0_MIIPDINT 0x00100000 +#define INT0_MCCINT 0x00020000 +#define INT0_MREINT 0x00010000 +#define INT0_SPNDINT 0x00004000 +#define INT0_MPINT 0x00002000 +#define INT0_TINT3 0x00000800 +#define INT0_TINT2 0x00000400 +#define INT0_TINT1 0x00000200 +#define INT0_TINT0 0x00000100 +#define INT0_UINT 0x00000080 +#define INT0_STINT 0x00000010 +#define INT0_RINT0 0x00000001 + + +#define INTEN0 (0x040) + +#define INTEN0_LCINTEN 0x08000000 +#define INTEN0_APINT5EN 0x04000000 +#define INTEN0_APINT4EN 0x02000000 +#define INTEN0_APINT3EN 0x01000000 +#define INTEN0_APINT2EN 0x00400000 +#define INTEN0_APINT1EN 0x00200000 +#define INTEN0_APINT0EN 0x00100000 +#define INTEN0_MIIPDINTEN 0x00080000 +#define INTEN0_MCCINTEN 0x00020000 +#define INTEN0_MREINTEN 0x00010000 +#define INTEN0_SPNDINTEN 0x00004000 +#define INTEN0_MPNINTEN 0x00002000 +#define INTEN0_TINTEN3 0x00000800 +#define INTEN0_TINTEN2 0x00000400 +#define INTEN0_TINTEN1 0x00000200 +#define INTEN0_TINTEN0 0x00000100 +#define INTEN0_STINTEN 0x00000010 +#define INTEN0_RINTEN0 0x00000001 + +/* 64-bits */ + +#define LADRF_L (0x168) +#define LADRF_H (0x16c) + +/* 16-bits */ + +#define MIB_ADRS (0x014) + +#define MIB_CMD_ACTIVE 0x8000 +#define MIB_RD_CMD 0x2000 +#define MIB_CLEAR 0x1000 +#define MIB_ADDRESS_MASK 0x001f + + +/* 32-bits */ + +#define MIB_DATA (0x010) + + +/* 48-bits */ + +#define MAC_ADRS (0x160) + +/* 32-bits */ + +#define PHY_ACCESS (0x0d0) + + +/* 32-bits */ + +#define ON_NOW_PTRN0 (0x190) +#define ON_NOW_PTRN1 (0x194) + + +/* 16-bits */ + +#define RCV_RING_LEN (0x150) + + +/* 16-bits */ + +#define SRAM_BND (0x17a) +#define SRAM_BND_DEFAULT 0x08 +#define SRAM_SIZE (0x178) +#define SRAM_SIZE_DEFAULT 0x10 + + +/* 32-bits */ + +#define STAT0 (0x030) + +#define STAT0_PMAT_DET 0x00010000 +#define STAT0_MP_DET 0x00008000 +#define STAT0_LC_DET 0x00004000 +#define STAT0_SPEED_MASK 0x00000380 +#define STAT0_FULL_DUPLEX 0x00000040 +#define STAT0_LINK_STATUS 0x00000020 +#define STAT0_AUTONEG_COMPLETE 0x00000010 +#define STAT0_MIIPD 0x00000008 +#define STAT0_RX_SUSPENDED 0x00000004 +#define STAT0_TX_SUSPENDED 0x00000002 +#define STAT0_RUNNING 0x00000001 + + +/* 16-bits */ + +#define STVAL (0x0d8) + + +/* 16-bits */ + +#define XMT_RING0_LEN (0x140) +#define XMT_RING1_LEN (0x144) +#define XMT_RING2_LEN (0x148) +#define XMT_RING3_LEN (0x14c) + +/* 32-bits */ + +#define XMT_RING_LIMIT (0x07c) + + +/* Bit Fields */ + + +typedef struct rxDesc + { + UINT32 RD[4] ; + } AMD_RD ; + + +typedef struct txDesc + { + UINT32 TD[4] ; + } AMD_TD ; + + +#define RD_USER_SPACE 0 +#define RD_WORD1 1 +#define RD_MCNT 1 +#define RD_WORD2 2 +#define RD_BCNT 2 +#define RD_FLAGS 2 +#define RD_RBADR 3 + + +/* Word 0x8 */ + +#define RD_OWN 0x80000000 +#define RD_ERR 0x40000000 +#define RD_FRAM 0x20000000 +#define RD_OFLO 0x10000000 +#define RD_CRC 0x08000000 +#define RD_BUFF 0x04000000 +#define RD_STP 0x02000000 +#define RD_ENP 0x01000000 +#define RD_PAM 0x00400000 +#define RD_LAFM 0x00200000 +#define RD_BAM 0x00100000 +#define RD_TT_MASK 0x000c0000 +#define RD_BCNT_MASK 0x0000ffff + + +#define TD_WORD0 0 +#define TD_BCNT 0 +#define TD_FLAGS 0 +#define TD_WORD1 1 +#define TD_TCC 1 +#define TD_TCI 1 +#define TD_TBADR 2 +#define TD_USER_SPACE 3 + + +/* Word 0x0 */ + +#define TD_OWN 0x80000000 +#define TD_ADD_FCS 0x20000000 +#define TD_LTINT 0x10000000 +#define TD_PRI_LOCK 0x04000000 +#define TD_STP 0x02000000 +#define TD_ENP 0x01000000 +#define TD_KILL 0x00400000 +#define TD_BCNT_MASK 0x0000ffff + +/* Word 0x4 */ + +#define TD_TCC_MASK 0x00030000 +#define TD_TCI_MASK 0x0000ffff + + +/* Control block definitions for AMD PCnet (Ethernet) chip. */ + +typedef union addrFilter /* logical address filter layout */ + { + UINT8 lafBytes [8]; /* (8) bytes */ + UINT16 lafWords [4]; /* (4) 16-bit words */ + UINT32 lafDwords [2]; /* (2) 32-bit dwords */ + } ADDR_FILTER; + +typedef enum filterModCmd /* addrFilterMod() commands */ + { + AMD_LADRF_ADD, /* add a logical address */ + AMD_LADRF_DEL, /* delete a logical address */ + AMD_LADRF_ADD_ALL, /* add all logical addresses */ + AMD_LADRF_DEL_ALL /* delete all logical addresses */ + } FILTER_MOD_CMD; + + +/* CRC for logical address filter */ + +#define AMD_CRC_POLYNOMIAL (0xedb88320) /* Ethernet CRC polynomial */ +#define AMD_CRC_TO_LAF_IX(crc) ((crc) >> 26) /* get 6 MSBits */ +#define AMD_LAF_LEN (8) /* logical addr filter length */ +#define AMD_LA_LEN (6) /* logical address length */ +#define BITS_PER_LA (8 * AMD_LA_LEN) /* logical addr length bits */ + + + +/* Definitions for the drvCtrl specific flags field */ + +#define LS_PROMISCUOUS_FLAG 0x1 /* set the promiscuous mode */ +#define LS_MEM_ALLOC_FLAG 0x2 /* allocating memory flag */ +#define LS_PAD_USED_FLAG 0x4 /* padding used flag */ +#define LS_RCV_HANDLING_FLAG 0x8 /* handling recv packet */ +#define LS_START_OUTPUT_FLAG 0x10 /* trigger output flag */ +#define LS_POLLING 0x20 /* polling flag */ +#define LS_MODE_MEM_IO_MAP 0x100 /* device registers memory mapped */ +#define LS_MODE_DWIO 0x200 /* device in 32 bit mode */ +#define LS_MODE_NOSWAP_MASTER 0x400 /* don't swap PCI master I/O ops */ + +/* descriptor size */ + +#define RD_SIZ sizeof(AMD_RD) +#define TD_SIZ sizeof(AMD_TD) + + +/* How much work we're allowed to do in the RX handler (# of pkts processed) */ + +#define AMD_RX_LIMIT 32 + +/* How many descriptors we want to use up in a single gather-write transmit */ + +#define AMD_MAX_FRAGS 32 + + + +/* */ + +typedef struct amd8111LanBoardInfoType +{ + UINT32 vector; /* interrupt vector number */ + UINT32 baseAddr; /* memory base address for CSR */ + UINT32 pciMemAddr ; /* PCI memory base address from CPU */ + UCHAR enetAddr[6]; /* ethernet address */ + int (*intEnable)(int unit); /* board specific interrupt enable routine */ + int (*intDisable)(int unit); /* board specific interrupt disable routine */ + int (*intAck) (int unit); /* interrupt ack */ + STATUS (*intConnect) (VOIDFUNCPTR * vector, VOIDFUNCPTR routine, int parameter); + STATUS (*intDisconnect) (VOIDFUNCPTR * vector, VOIDFUNCPTR routine, int parameter); + UINT32 (*sysLocalToBus)(int unit,UINT32 localAdr); + UINT32 (*sysBusToLocal)(int unit,UINT32 sysAdr); + + /* configuration parameters, user can override in the BSP */ + UINT8 phyAddr; /* PHY device address, valid addresses: 0-32 */ + UINT8 phySpeed; + UINT8 phyDpx; + UINT8 fill0; +} AMD8111_LAN_BOARD_INFO ; + + +/* The definition of the driver control structure */ + +typedef struct amd8111LanDevice + { + END_OBJ endObj; /* The class we inherit from */ + + int unit; /* unit number of the device */ + + int rdNum ; /* total number of RDs */ + int rdIndex; /* current RD send index */ + int rringSize; /* RD ring size */ + int rringLen; /* RD ring length (bytes) */ + volatile AMD_RD * pRring; /* RD ring start */ + + int tdNum ; /* total number of TDs */ + int tdIndex; /* current TD transmit index */ + int tdIndexC; /* current TD cleaning index */ + int tringSize; /* TD ring size */ + int tringLen; /* TD ring length (bytes) */ + volatile AMD_TD * pTring; /* TD ring start */ + + int inum; /* interrupt number */ + int ilevel; /* interrupt level */ + + volatile char * pShMem; /* real ptr to shared memory */ + volatile char * pShMemEnd; /* real ptr to shared memory end */ + volatile char * memBase; /* PCnet memory pool base */ + volatile char * memAdrs; /* PCnet memory pool base */ + + UINT32 shMemPtoVOffset; /* bias to convert pShMem P->V */ + + UINT32 devAdrs; /* device structure address */ + + UINT32 chipId; /* (csr88|csr89) chip ID value */ + int memSize; /* PCnet memory pool size */ + int memWidth; /* width of data port */ + int offset; /* offset of data in the buffer */ + volatile UINT32 flags; /* Our local flags */ + UINT32 pciMemBase; /* memory base as seen from PCI*/ + UINT8 enetAddr[6]; /* ethernet address */ + CACHE_FUNCS cacheFuncs; /* cache function pointers */ + + volatile BOOL txBlocked; /* transmit flow control */ + volatile BOOL txCleaning; /* transmit descriptor cleaning */ + + CL_POOL_ID pClPoolId; /* cluster pool Id */ + M_CL_CONFIG mClCfg; /* mBlk & cluster config structure */ + CL_DESC clDesc; /* cluster descriptor table */ + + END_ERR lastError; /* Last error passed to muxError */ + volatile BOOL errorHandling; /* task level error handling */ + + M_BLK_ID * mBlks; /* saved mBlk pointers */ + + AMD8111_LAN_BOARD_INFO board ; + + /* Hold current values of these registers */ + + UINT32 cmd0 ; + UINT32 cmd2 ; + UINT32 cmd3 ; + UINT32 cmd7 ; + UINT32 inten0 ; + + } AMD8111_LAN_DRV_CTRL; + + +/* + * MIB statistics. The variable positions correspond the the index position + * required to access the given value. For example, rxvMissPkts is index 0, + * rcvOctets is index 1 and so on. + */ + +typedef struct amd8111LanStatCounterType { + UINT32 rcvMissPkts ; /* 0x0 */ + UINT32 rcvOctets ; + UINT32 rcvBroadCastPkts ; + UINT32 rcvMultiCastPkts ; + UINT32 rcvUndersizePkts ; + UINT32 rcvOversizePkts ; + UINT32 rcvFragments ; + UINT32 rcvJabbers ; + UINT32 rcvUnicastPkts ; + UINT32 rcvAlignmentErrors ; + UINT32 rcvFCSErrors ; + UINT32 rcvGoodOctets ; + UINT32 rcvMACCtrl ; + UINT32 rcvFlowCtrl ; + UINT32 rcvPkts64Octets ; + UINT32 rcvPkts65to127Octets ; + UINT32 rcvPkts128to255ctets ; /* 0x10 */ + UINT32 rcvPkts256to511ctets ; + UINT32 rcvPkts512to1023ctets ; + UINT32 rcvPkts1024to1518ctets ; + UINT32 rcvUnsupportedOpcode ; + UINT32 rcvSymbolErrors ; + UINT32 rcvDropPktsRing0 ; + UINT32 reserved0[3] ; + UINT32 rcvJumboPkts ; + UINT32 reserved1[5] ; + UINT32 xmtUnderrunPkts ; /* 0x20 */ + UINT32 xmtOctets ; + UINT32 xmtPackets ; + UINT32 xmtBroadCastPkts ; + UINT32 xmtMultiCastPkts ; + UINT32 xmtCollisions ; + UINT32 xmtUnicastPkts ; + UINT32 xmtOneCollision ; + UINT32 xmtMultipleCollision ; + UINT32 xmtDeferredTransmit ; + UINT32 xmtLateCollision ; + UINT32 xmtExcessiveDefer ; + UINT32 xmtLossCarrier ; + UINT32 xmtExcessiveCollision ; + UINT32 xmtBackPressure ; + UINT32 xmtFlowCtrl ; + UINT32 xmtPkts64Octets ; /* 0x30 */ + UINT32 xmtPkts65to127Octets ; + UINT32 xmtPkts128to255Octets ; + UINT32 xmtPkts256to511Octets ; + UINT32 xmtPkts512to1023Octets ; + UINT32 xmtPkts1024to1518Octets ; + UINT32 xmtOversizePkts ; + UINT32 xmtJumboPkts ; /* 0x37 */ + +} AMD8111_LAN_STAT_COUNTER ; + + +/* Configuration items */ + +#define AMD_MIN_FBUF (100) /* Min sizeof first buffer in chain */ + +#define AMD_BUFSIZ (ETHERMTU + SIZEOF_ETHERHEADER + 6) + +#define AMD_SPEED (10000000) + +#define AMD_RD_RLEN (7) /* ring size as a ^ 2 => 128 RD's */ +#define AMD_TD_TLEN (7) /* ring size as a ^ 2 => 128 TD's */ + +#define AMD_RD_MIN (2) /* min descriptors 4 */ +#define AMD_TD_MIN (2) /* min descriptors 4 */ + +#define AMD_RD_MAX (9) /* max descriptors 512 */ +#define AMD_TD_MAX (9) /* max descriptors 512 */ + +#define AMD8111_LAN_DEV_NAME "amdPci" /* name of the device */ +#define AMD8111_LAN_DEV_NAME_LEN (7) /* length of the name string */ +#define AMD8111_LAN_APROM_SIZE (32) /* hardware Address PROM size bytes */ + +#define AMD_LITTLE_ENDIAN (0) /* little endian PCI bus */ +#define AMD_BIG_ENDIAN (1) /* big endian PCI bus */ +#define AMD_ACTIVE_LOW (0) /* active-low interrupt line */ +#define AMD_ACTIVE_HI (1) /* active-high interrupt line */ + + +#define AMD_RD_OWNED(rd) ( PCI_SWAP ((rd)->RD [RD_FLAGS]) & RD_OWN ) +#define AMD_TD_OWNED(td) ( PCI_SWAP ((td)->TD [TD_FLAGS]) & TD_OWN ) + + +#define AMD_PKT_LEN_GET(rd) ( PCI_SWAP ((rd)->RD [RD_MCNT]) & RD_BCNT_MASK ) + + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT STATUS amd8111LanInitParse (AMD8111_LAN_DRV_CTRL * pDrvCtrl, char * initString); +IMPORT END_OBJ * amd8111LanEndLoad (char * initString); + +#else + +IMPORT STATUS amd8111LanInitParse (); +IMPORT END_OBJ * amd8111LanEndLoad (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCamd8111LanEndh */ diff --git a/h/drv/end/auEnd.h b/h/drv/end/auEnd.h new file mode 100644 index 0000000..9b4a6ea --- /dev/null +++ b/h/drv/end/auEnd.h @@ -0,0 +1,312 @@ +/* auEnd.h - END based MAC Ethernet header */ + +/* Copyright 1998-2001 Wind River Systems, Inc. */ + +/* + * This file has been developed or significantly modified by the + * MIPS Center of Excellence Dedicated Engineering Staff. + * This notice is as per the MIPS Center of Excellence Master Partner + * Agreement, do not remove this notice without checking first with + * WR/Platforms MIPS Center of Excellence engineering management. + */ + +/* +modification history +-------------------- +01h,03jun02,zmm Fix AU_DEV_NAME_LEN, SPR 78215. +01g,14may02,zmm Global au1000 name changes. SPR 77333. +01f,06may02,zmm Fix SPR 76824. +01e,15nov01,zmm Supported auto-negotiation and cache coherent mode. + Add base addresses of the Ethernet registers. SPR 71884. +01d,11oct01,tlc Change register names according to new revision of Au1000 + Databook. General cleanup. +01c,21sep01,agf add ring size warning; + change MAC_ENABLE to use enableAdrs field +01b,19jun01,zmm Put volatile in the MAC macros. +01a,17may01,mem written. +*/ + +#ifndef __INCauEndh +#define __INCauEndh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "end.h" +#include "cacheLib.h" +#include "netinet/if_ether.h" +#include "miiLib.h" + +/* board level/bus specific and architecture specific macros */ + +#if _BYTE_ORDER==_BIG_ENDIAN +# define PCI_SWAP(x) LONGSWAP((int)(x)) +#else +# define PCI_SWAP(x) (x) +#endif + +/* + * WARNING -- + * logic in the source code depends on the following being a power of 2 + */ +#define AU_N_TX_BUF 4 /* # of transmit buffers */ +#define AU_N_RX_BUF 4 /* # of receive buffers */ + +/* Device IO or memory mapped access and data registers */ + +#define AU_MAC_REG(reg) \ + (*(volatile UINT32 *)((UINT32)(pDrvCtrl->devAdrs)+(reg))) + +#define AU_DMA_REG(reg) \ + (*(volatile UINT32 *)((UINT32)(pDrvCtrl->dmaAdrs)+(reg))) + +#define AU_MAC_ENABLE \ + (*(volatile UINT32 *)((UINT32)(pDrvCtrl->enableAdrs))) + +#define AU_MAC_CONTROL AU_MAC_REG(0x00) +#define AU_MAC_ADDRESS_HIGH AU_MAC_REG(0x04) +#define AU_MAC_ADDRESS_LOW AU_MAC_REG(0x08) +#define AU_MULTICAST_HASH_ADDRESS_HIGH AU_MAC_REG(0x0c) +#define AU_MULTICAST_HASH_ADDRESS_LOW AU_MAC_REG(0x10) +#define AU_MII_CONTROL AU_MAC_REG(0x14) +#define AU_MII_DATA AU_MAC_REG(0x18) +#define AU_FLOW_CONTROL AU_MAC_REG(0x1c) +#define AU_VLAN1_TAG AU_MAC_REG(0x20) +#define AU_VLAN2_TAG AU_MAC_REG(0x24) + +/* AU Dedicated MAC DMA registers */ + +#define AU_TX_STATUS(idx) AU_DMA_REG(0x00 + 0x10*(idx)) +#define AU_TX_ADDRESS(idx) AU_DMA_REG(0x04 + 0x10*(idx)) +#define AU_TX_LENGTH(idx) AU_DMA_REG(0x08 + 0x10*(idx)) + +#define AU_RX_STATUS(idx) AU_DMA_REG(0x0100 + 0x10*(idx)) +#define AU_RX_ADDRESS(idx) AU_DMA_REG(0x0104 + 0x10*(idx)) + +/* MAC Control bits */ + +#define AU_MAC_CONTROL_RA (1 << 31) /* receive all */ +#define AU_MAC_CONTROL_EM_BIG (1 << 30) /* big endian */ +#define AU_MAC_CONTROL_DO (1 << 23) /* disable receive own */ +#define AU_MAC_CONTROL_F (1 << 20) /* full duplex */ +#define AU_MAC_CONTROL_PM (1 << 19) /* pass multicast */ +#define AU_MAC_CONTROL_PR (1 << 18) /* promiscuous mode */ +#define AU_MAC_CONTROL_IF (1 << 17) /* inverse filtering */ +#define AU_MAC_CONTROL_PB (1 << 16) /* pass bad frames */ +#define AU_MAC_CONTROL_HO (1 << 15) /* hash-only filter */ +#define AU_MAC_CONTROL_HP (1 << 13) /* hash/perfect */ +#define AU_MAC_CONTROL_LC (1 << 12) /* late collision */ +#define AU_MAC_CONTROL_DB (1 << 11) /* disable broadcast */ +#define AU_MAC_CONTROL_DR (1 << 10) /* disable retry */ +#define AU_MAC_CONTROL_AP (1 << 8) /* auto pad strip */ +#define AU_MAC_CONTROL_BL(n) (((n)&3) << 6) /* backoff limit */ +#define AU_MAC_CONTROL_DC (1 << 5) /* deferral clock */ +#define AU_MAC_CONTROL_TE (1 << 3) /* Tx enable */ +#define AU_MAC_CONTROL_RE (1 << 2) /* Rx enable */ +#define AU_MAC_CONTROL_LB_NORMAL (0) /* normal mode */ + +/* MAC Enable bits */ + +#define AU_MAC_ENABLE_JP (1 << 6) /* Jumbo Packet Enable */ +#define AU_MAC_ENABLE_E2 (1 << 5) /* Enable 2 */ +#define AU_MAC_ENABLE_E1 (1 << 4) /* Enable 1 */ +#define AU_MAC_ENABLE_C (1 << 3) /* Non-Cacheable */ +#define AU_MAC_ENABLE_TS (1 << 2) /* Toss */ +#define AU_MAC_ENABLE_E0 (1 << 1) /* Enable 0 */ +#define AU_MAC_ENABLE_CE (1 << 0) /* Clocks Enable */ + +#define AU_MAC_ENABLE_RESET_ALL 0x00 /* Reset all */ +#define AU_MAC_ENABLE_CLOCKS_ONLY 0x41 /* only clocks */ +#define AU_MAC_ENABLE_NORMAL 0x37 /* Normal operation */ + + +/* CRC for logical address filter */ + +#define AU_CRC_POLYNOMIAL 0xedb88320 /* CRC polynomial */ +#define AU_CRC_TO_LAF_IX(crc) ((crc) >> 26) /* get 6 MSBits */ +#define AU_LAF_LEN 8 /* logical addr filter legth */ +#define AU_LA_LEN 6 /* logical address length */ +#define MAC_ADDRS_SIZE 6 + +/* MII Defines */ + +#define AU_MAX_PHY 1 + +/* MII Control bits */ + +#define AU_MII_CONTROL_READ 0 /* Read */ +#define AU_MII_CONTROL_WRITE (1 << 1) /* Write */ +#define AU_MII_CONTROL_BUSY (1 << 0) /* Busy */ + +#define MII_MGMT_WR_OFF 17 +#ifndef MII_WRITE +# define MII_WRITE ((ULONG) 0x00002000) +#endif +#ifndef MII_READ +# define MII_READ ((ULONG) 0x00044000) +#endif + +#define MII_MGMT_WR ((ULONG) 0x00020000) +#define MII_MGMT_CLOCK ((ULONG) 0x00010000) +#define MII_READ_FRM ((ULONG) 0x60000000) +#define MII_WRITE_FRM ((ULONG) 0x50020000) +#define MII_PHY_CTRL_RES ((USHORT) 0x007F) +#define MII_PHY_STAT_RES ((USHORT) 0x07C0) +#define MII_PHY_NWAY_RES ((USHORT) 0x1C00) +#define MII_PHY_NWAY_EXP_RES ((USHORT) 0xFFE0) +#define MII_MGMT_DATA_IN ((ULONG) 0x00080000) +#define MII_READ_DATA_MSK MII_MGMT_DATA_IN + +#define DEC_MAX_PHY 32 /* max number of PHY devices */ +#define DEC_MAX_LINK_TOUT 6 /* max link timeout (in secs) */ + +#define MII_PREAMBLE ((ULONG) 0xFFFFFFFF) +#define MII_LINK_STATUS 0x4 + +/* MII frame header format */ + +#define MII_SOF 0x4 /* start of frame */ +#define MII_RD 0x2 /* op-code: Read */ +#define MII_WR 0x1 /* op-code: Write */ + +/* MII PHY registers */ + +#define MII_PHY_CR 0x00 /* Control Register */ +#define MII_PHY_SR 0x01 /* Status Register */ +#define MII_PHY_ID0 0x02 /* Identifier Register 0 */ +#define MII_PHY_ID1 0x03 /* Identifier Register 1 */ +#define MII_PHY_ANA 0x04 /* Auto Negot'n Advertisement */ +#define MII_PHY_ANLPA 0x05 /* Auto Negot'n Link Partner Ability */ +#define MII_PHY_ANE 0x06 /* Auto Negot'n Expansion */ + +/* MII PHY Auto Negotiation Advertisement Register */ + +#define MII_PHY_ANA_TAF 0x03e0 /* Technology Ability Field */ +#define MII_PHY_ANA_T4AM 0x0200 /* T4 Technology Ability Mask */ +#define MII_PHY_ANA_TXAM 0x0180 /* TX Technology Ability Mask */ +#define MII_PHY_ANA_FDAM 0x0140 /* Full Duplex Technology Ability Mask */ +#define MII_PHY_ANA_HDAM 0x02a0 /* Half Duplex Technology Ability Mask */ +#define MII_PHY_ANA_100M 0x0380 /* 100Mb Technology Ability Mask */ +#define MII_PHY_ANA_10M 0x0060 /* 10Mb Technology Ability Mask */ +#define MII_PHY_ANA_CSMA 0x0001 /* CSMA-CD Capable */ + +/* MII PHY Auto Negotiation Remote End Register */ + +#define MII_PHY_ANLPA_NP 0x8000 /* Next Page (Enable) */ +#define MII_PHY_ANLPA_ACK 0x4000 /* Remote Acknowledge */ +#define MII_PHY_ANLPA_RF 0x2000 /* Remote Fault */ +#define MII_PHY_ANLPA_TAF 0x03e0 /* Technology Ability Field */ +#define MII_PHY_ANLPA_T4AM 0x0200 /* T4 Technology Ability Mask */ +#define MII_PHY_ANLPA_TXAM 0x0180 /* TX Technology Ability Mask */ +#define MII_PHY_ANLPA_FDAM 0x0140 /* Full Duplex Technology Ability Mask */ +#define MII_PHY_ANLPA_HDAM 0x02a0 /* Half Duplex Technology Ability Mask */ +#define MII_PHY_ANLPA_100M 0x0380 /* 100Mb Technology Ability Mask */ +#define MII_PHY_ANLPA_10M 0x0060 /* 10Mb Technology Ability Mask */ +#define MII_PHY_ANLPA_CSMA 0x0001 /* CSMA-CD Capable */ + +/* Special MII flag bit definitions, not the user flag bits */ + +#define AU_USR_MII_BUS_MON 0x01000000 /* monitor the MII bus */ +#define AU_USR_MII_AN_TBL 0x04000000 /* use auto-negotiation table */ +#define AU_USR_MII_NO_AN 0x08000000 /* do not auto-negotiate */ +#define AU_USR_MII_FD 0x10000000 /* allow full duplex */ +#define AU_USR_MII_100MB 0x20000000 /* allow 100 MB */ +#define AU_USR_MII_HD 0x40000000 /* allow half duplex */ +#define AU_USR_MII_10MB 0x80000000 /* allow 10 MB */ + + +/* Definitions for the drvCtrl specific flags field */ + +#define AU_PROMISCUOUS_FLAG 0x1 /* set the promiscuous mode */ +#define AU_MEM_ALLOC_FLAG 0x2 /* allocating memory flag */ +#define AU_PAD_USED_FLAG 0x4 /* padding used flag */ +#define AU_RCV_HANDLING_FLAG 0x8 /* handling recv packet */ +#define AU_START_OUTPUT_FLAG 0x10 /* trigger output flag */ +#define AU_POLLING 0x20 /* polling flag */ +#define AU_MODE_MEM_IO_MAP 0x100 /* device registers memory mapped */ +#define AU_MODE_DWIO 0x200 /* device in 32 bit mode */ + +/* The definition of the driver control structure */ + +typedef struct auDevice + { + END_OBJ endObj; /* The class we inherit from */ + int unit; /* unit number of the device */ + UINT32 flags; /* Our local flags */ + UINT8 enetAddr[6]; /* ethernet address */ + + int ivec; /* interrupt vector */ + int ilevel; /* interrupt level */ + UINT32 devAdrs; /* device structure address */ + UINT32 dmaAdrs; /* DMA device address */ + UINT32 enableAdrs; /* MAC enable register address */ + + char * pRxMem[AU_N_RX_BUF]; /* Base of receive buffers */ + char * pTxMem[AU_N_TX_BUF]; /* Base of transmit buffers */ + + char * pRxMemBase; /* Base address of receive buffers */ + char * pTxMemBase; /* Base address of transmit buffers */ + + int offset; /* offset of data in the buffer */ + + int rmdIndex; /* current RMD index */ + int rringSize; /* RMD ring size */ + + int tmdIndex; /* current TMD index */ + int tmdLastIndex; /* last TMD index */ + int tringSize; /* TMD ring size */ + + PHY_INFO *pPhyInfo; /* info on a MII-compliant PHY */ + UINT32 miiPhyFlags; /* MII-compliant PHY flags */ + UINT8 phyAddr; /* MII-compliant PHY address */ + MII_AN_ORDER_TBL * pMiiPhyTbl; /* MII-compliant PHY's table */ + + CACHE_FUNCS cacheFuncs; /* cache function pointers */ + BOOL txBlocked; /* transmit flow control */ + BOOL txCleaning; /* transmit descriptor cleaning */ + CL_POOL_ID pClPoolId; /* cluster pool Id */ + M_CL_CONFIG mClCfg; /* mBlk & cluster config structure */ + CL_DESC clDesc; /* cluster descriptor table */ + END_ERR lastError; /* Last error passed to muxError */ + BOOL errorHandling; /* task level error handling */ + u_short errorStat; /* error status */ + } AU_DRV_CTRL; + +/* Configuration items */ + +#define BUS_LATENCY_COUNT 0x1000 /* Max BUS timeo len in 0.1 uSeconds */ +#define AU_MIN_FBUF 100 /* Minsize of first buffer in chain */ +#define AU_BUFSIZ (ETHERMTU + SIZEOF_ETHERHEADER + 6) +#define AU_DMA_BUFSIZ 2048 /* Req'd by Au1000 DMA engine */ +#define AU_SPEED 10000000 +#define AU_RMD_RLEN 5 /* ring size as a ^ 2 -- 32 RMD's */ +#define AU_TMD_TLEN 5 /* ring size as a ^ 2 -- 32 TMD's */ +#define AU_RMD_MIN 2 /* min descriptors 4 */ +#define AU_TMD_MIN 2 /* min descriptors 4 */ +#define AU_RMD_MAX 9 /* max descriptors 512 */ +#define AU_TMD_MAX 9 /* max descriptors 512 */ +#define AU_DEV_NAME "au" /* name of the device */ +#define AU_DEV_NAME_LEN 3 /* length of the name string */ +#define AU_APROM_SIZE 32 /* hardware address prom size */ + +#define AU_PKT_LEN_GET(rmd) PCI_SWAP (rmd->rBufMskCnt) - 4; + +#if defined(__STDC__) || defined(__cplusplus) +IMPORT END_OBJ * auEndLoad (char * initString); +IMPORT STATUS auInitParse (AU_DRV_CTRL * pDrvCtrl, + char * initString); +#else +IMPORT END_OBJ * auEndLoad (); +IMPORT STATUS auInitParse (); +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCauEndh */ diff --git a/h/drv/end/bcm1250MacEnd.h b/h/drv/end/bcm1250MacEnd.h new file mode 100644 index 0000000..a53c2ff --- /dev/null +++ b/h/drv/end/bcm1250MacEnd.h @@ -0,0 +1,169 @@ +/* bcm1250MacEnd.h - END style BCM1250 MAC Ethernet driver definitions */ + +/* Copyright 2002 Wind River Systems, Inc. */ + +/********************************************************************* +* +* Copyright 2000,2001 +* Broadcom Corporation. All rights reserved. +* +* This software is furnished under license to Wind River Systems, Inc. +* and may be used only in accordance with the terms and conditions of +* this license. No title or ownership is transferred hereby. +**********************************************************************/ + +/* + * This file has been developed or significantly modified by the + * MIPS Center of Excellence Dedicated Engineering Staff. + * This notice is as per the MIPS Center of Excellence Master Partner + * Agreement, do not remove this notice without checking first with + * WR/Platforms MIPS Center of Excellence engineering management. + */ + +/* +modification history +-------------------- +01d,20mar02,pgh Apply code review fixes. +01c,14mar02,pgh Made the code compliant with the coding standard. + Eliminated unused variables. + Added some new variables. +01b,07dec01,agf apply coding standard fix-ups +01a,15nov01,agf written. +*/ + +#ifndef __INCbcm1250MacEndh +#define __INCbcm1250MacEndh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#define SB_DEV_NAME "sbe" +#define SB_DEV_NAME_LEN 4 + +#define VXW_RCV_BUF_OFFSET 2 +#define ETH_CRC_LEN 4 /* ethernet CRC length */ +#define ETH_ADDR_LEN 6 /* ethernet address length */ +#define NUM_RDS_DEF 32 /* default number of RX dscrs */ +#define NUM_TDS_DEF 32 /* default number of TX dscrs */ + +#define RXDSCR_LOAN_NUM 32 /* Number of descriptors available to loan */ +#define CACHELINESIZE 32 +#define MAX_FRAME_SIZE (ETHERMTU + ENET_HDR_REAL_SIZ + 4 + 2) +#define NUMCACHEBLKS(x) (((x) + (CACHELINESIZE - 1)) / CACHELINESIZE) +#define MAX_FRAME_CACHE_BLKS (NUMCACHEBLKS (MAX_FRAME_SIZE)) + +#define BCM1250_MAC_DUAL_CHAN 0x0001 /* Use two RX/TX channels */ +#define BCM1250_MAC_POLLING 0x0002 /* Poll mode, io mode */ +#define BCM1250_MAC_PROMISC 0x0004 /* Promiscuous, rx mode */ +#define BCM1250_MAC_MCAST 0x0008 /* Multicast, rx mode */ + +#define BCM1250_MAC_SPEED_10 10000000 /* 10 Mbps */ +#define BCM1250_MAC_SPEED_100 100000000 /* 100 Mbps */ +#define BCM1250_MAC_SPEED_1000 1000000000 /* 1000 Mbps - 1Gbps */ +#define BCM1250_MAC_SPEED_DEF BCM1250_MAC_SPEED_10 + +typedef unsigned long MAC_REG; + +typedef enum + { + BUF_TYPE_NONE, + BUF_TYPE_CL, + BUF_TYPE_MBLK + } BUF_TYPE; + +typedef enum + { + MAC_SPEED_10, + MAC_SPEED_100, + MAC_SPEED_1000 + } MAC_SPEED; + +typedef enum + { + MAC_DUPLEX_HALF, + MAC_DUPLEX_FULL + } MAC_DUPLEX; + +typedef enum + { + MAC_FC_DISABLED, + MAC_FC_FRAME, + MAC_FC_COLLISION, + MAC_FC_CARRIER + } MAC_FC; + +typedef struct ethDmaDscr + { + UINT64 dscr_a; /* DMA descriptor first doubleword */ + UINT64 dscr_b; /* DMA descriptor second doubleword */ + } ETH_DMA_DSCR; + +typedef struct txBufTable + { + char * pBuf; /* buffer pointer */ + BUF_TYPE type; /* buffer type */ + } TX_BUF_TABLE; + +typedef struct ethMacDma + { + MAC_REG regConfig0; /* DMA config register 0 */ + MAC_REG regConfig1; /* DMA config register 1 */ + MAC_REG regDscrBase; /* Descriptor base address */ + MAC_REG regDscrCnt; /* Descriptor count register */ + MAC_REG regCurDscr; /* current descriptor address */ + + ETH_DMA_DSCR * pDscrTable; /* base of descriptor table */ + TX_BUF_TABLE * bufTable; /* buffer table, one per descr */ + int maxDescr; /* total # of descriptors in ring */ + int tailIndex; /* tail index to DMA buffer descr ring */ + int headIndex; /* head index to DMA buffer descr ring */ + int ringCount; /* count of DMA buffer descr in ring */ + + BOOL hndlAct; /* handle routine is active */ + BOOL txBlocked; /* doesn't have resources to transmit */ + } ETH_MAC_DMA; + +typedef struct drvCtrl + { + END_OBJ endObj; /* The class we inherit from. */ + END_ERR lastError; /* Last error passed to muxError */ + int unit; /* ethernet interface unit number */ + int iVecNum; /* interrupt vector number */ + int intSource; /* interrupt source */ + int flags; /* Our local flags. */ + + MAC_REG regMacBase; + MAC_REG regDmaBase; + MAC_REG regMacEnable; /* MAC Enable Register */ + MAC_REG regMacCfg; /* MAC Configuration Register */ + MAC_REG regFifoCfg; /* FIFO configuration register */ + MAC_REG regFrameCfg; /* Frame configuration register */ + MAC_REG regRxFilter; /* receive filter register */ + MAC_REG regIsr; /* Interrupt status register */ + MAC_REG regImr; /* Interrupt mask register */ + MAC_REG regMdio; /* mii regster */ + + MAC_SPEED macSpeed; + MAC_DUPLEX macDuplex; + MAC_FC macFc; + + int phyAddr; /* phy address */ + char * mClBlkBase; /* Net Pool ClBlk, MBlk addr */ + char * bufBase; /* Net Pool cluster buffer addr */ + + CL_POOL_ID clPoolId; /* cluster pool */ + + ETH_MAC_DMA txDma; + ETH_MAC_DMA rxDma; + } DRV_CTRL; + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCbcm1250MacEndh */ diff --git a/h/drv/end/dec21x40End.h b/h/drv/end/dec21x40End.h new file mode 100644 index 0000000..d84f816 --- /dev/null +++ b/h/drv/end/dec21x40End.h @@ -0,0 +1,1074 @@ +/* dec21x40End.h - DEC Ethernet LAN Controller 21x40 interface header */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +03k,04dec02,m_h muxError in rx (83536) +03j,04sep02,m_h better nS delay functionality (SPR 75515) +03i,03sep02,m_h conflicting CSR macro (71320) +03h,30may02,sru Added REGSWAP and DEC_DRV_NOSWAP_MASTER definitions +03g,13may02,rcs added loanBufs field to DEC21X40_DRV_CTRL SPR# 75455 +03f,22apr02,rcs added txPollSendTd and txPollSendBuf fields to + DEC21X40_DRV_CTRL SPR# 76102 +03e,20jul01,rcs added LE_BYTE_SWAP to byte swap only little endian (SPR# 69093) +03c,17jul00,ar standardised +03c,17apr00,an Added DEC_USR_HPNA_FORCE_FAST and SLOW flags. Add + DEC_USR_HPNA_FORCE_LOW_PWR and HI_PWR flags. Removed + unused DEC_USR_FORCE, DEC_USR_100MB, DEC_USR_FD, and + DEC_USR_PHY_CHK flags. +03b,13apr00,an Added DEC_USR_HPNA_PREFER_10BT flag to support special + dec21145 media change technique. +03a,18feb00,an Added support for 21145. Added missing 21040,21140 and + 21143 defines. +01w,11jun00,ham removed reference to etherLib. +01v,08may00,jgn SPR 31198, Added more SROM macros +01u,23mar00,dmw Added Serial ROM EXT2 Info Block, valid media types +01t,24feb00,stv made a selective merge to add alignment fix. +01s,06dic99,cn re-introduced definitions of MII_READ and MII_WRITE for + backward compatibility (SPR #29542). +01r,08nov99,cn Added MII-related definitions. +01q,19aug99,dmw Added mask to IBLK_EXT_SIZE to look at only the size (0x7F). +01p,17aug99,dmw Added defines for ANA and ANLPA registers. +01p,07apr99,dra Added offset field for alignment fix. +01o,30mar99,dat Fixed SROM_VERSION, SPR 26201 +01n,11mar99,tm Added CSR9/MII/21143 defines, DEC_USR_PHY_CHK flag (SPR 22196) +01m,02mar99,tm Added intr mask to drvCtrl struct for multipass ISR (SPR 23950) +01l,18jan99,scb Added support for END driver on dec21143. +01k,31jul98,cn Added macro DEC_USR_FD [SPR# 21683] and field intrConnect + in pDrvCtrl [SPR#21557]. +01j,20apr98,map fixed endian-safe SROM_SHORT macro [SPR# 21013] +01i,24sep97,vin changed MBLK_CONFIG to M_CL_CONFIG +01h,31aug97,vin added a txBlocked variable to the drvCtrl structure. +01g,22aug97,gnn changes due to new buffering scheme. +01f,21aug97,vin modified free_buf type def added map's fixes +01e,10jun97,map renamed funcDec21x40MediaSelect to _func_dec21x40MediaSelect. +01d,02jun97,map added DEC Serial ROM support, and driver control definitions. +01c,24apr97,map added PCISWAP_SHORT +01b,18apr97,map added support for dec 21140 +01a,10jan97,map written from ../netif/if_dc.h +*/ + +#ifndef __INCdec21x40Endh +#define __INCdec21x40Endh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "end.h" +#include "netBufLib.h" +#include "miiLib.h" +#include "netinet/if_ether.h" + +#define DECPCI_REG_OFFSET 0x08 /* quad word aligned */ + +/* Endian safe macros - PCISWAP, PCISWAP_SHORT, SROM_SHORT */ + +#if (_BYTE_ORDER == _BIG_ENDIAN) +# define PCISWAP(x) LONGSWAP(x) +# define PCISWAP_SHORT(x) (MSB(x) | LSB(x) << 8) +# define LE_BYTE_SWAP(x) (x) +#else +# define PCISWAP(x) (x) +# define PCISWAP_SHORT(x) (x) +# define LE_BYTE_SWAP(x) (MSB(x) | LSB(x) << 8) /* little endian byte SWAP */ +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + +/* REGSWAP - Run-time controllable PCISWAP, for use with chip registers */ + +#if (_BYTE_ORDER == _BIG_ENDIAN) +# define REGSWAP(x) (DRV_FLAGS_ISSET(DEC_NOSWAP_MASTER) ? \ + (int)(x) : LONGSWAP((int)(x))) +#else +# define REGSWAP(x) (x) +#endif + + + +#define SROM_SHORT(pX) (*(UINT8*)(pX) | *((UINT8*)(pX)+1) << 8) + +/* + * Receive Message Descriptor Entry. + * Four words per entry. Number of entries must be a power of two. + */ + +typedef struct rDesc + { + ULONG rDesc0; /* status and ownership */ + ULONG rDesc1; /* control & buffer count */ + ULONG rDesc2; /* buffer address 1 */ + ULONG rDesc3; /* buffer address 2 */ + } DEC_RD; + +/* + * Transmit Message Descriptor Entry. + * Four words per entry. Number of entries must be a power of two. + */ + +typedef struct tDesc + { + ULONG tDesc0; /* status and ownership */ + ULONG tDesc1; /* control & buffer count */ + ULONG tDesc2; /* buffer address 1 */ + ULONG tDesc3; /* buffer address 2 */ + } DEC_TD; + +#define MIN_RDS 5 /* 5 buffers reasonable minimum */ +#define MIN_TDS 5 /* 5 buffers reasonable minimum */ +#define NUM_RDS_DEF 32 /* default number of Recv descriptors */ +#define NUM_TDS_DEF 64 /* default number of Xmit descriptors */ +#define NUM_LOAN 16 /* number of loaner buffers */ + +/* HomePNA PHY reg */ +/* maximum number of PHA PHY registers */ + +#define MAX_PNA_PHY_REGISTERS 0x20 + +/* define names to registers */ + +#define PNA_PHY_CTRL_LOW 0x0 +#define PNA_PHY_CTRL_HI 0x1 +#define PNA_PHY_STAT_LOW 0x2 +#define PNA_PHY_STAT_HI 0x3 +#define PNA_PHY_IMASK_LOW 0x4 +#define PNA_PHY_IMASK_HI 0x5 +#define PNA_PHY_ISTAT_LOW 0x6 +#define PNA_PHY_ISTAT_HI 0x7 +#define PNA_PHY_TX_PCOM_1 0x8 +#define PNA_PHY_TX_PCOM_2 0x9 +#define PNA_PHY_TX_PCOM_3 0xa +#define PNA_PHY_TX_PCOM_4 0xb +#define PNA_PHY_RX_PCOM_1 0xc +#define PNA_PHY_RX_PCOM_2 0xd +#define PNA_PHY_RX_PCOM_3 0xe +#define PNA_PHY_RX_PCOM_4 0xf +#define PNA_PHY_NOISE 0x10 +#define PNA_PHY_PEAK 0x11 +#define PNA_PHY_NSE_FLOOR 0x12 +#define PNA_PHY_NSE_CEILING 0x13 +#define PNA_PHY_NSE_ATTACK 0x14 +#define PNA_PHY_NSE_EVENTS 0x15 +#define PNA_PHY_AID_ADDR 0x19 +#define PNA_PHY_AID_INTERVAL 0x1a +#define PNA_PHY_AID_ISBI 0x1b +#define PNA_PHY_ISBI_SLOW 0x1c +#define PNA_PHY_ISBI_FAST 0x1d +#define PNA_PHY_TX_PULSE_WIDTH 0x1e +#define PNA_PHY_TX_PULSE_CYCLES 0x1f + +/* PNA PHY register bit values */ + +#define PHA_PHY_CTRL_LOW_PDN 0x08 /* PHY power down mode */ +#define PHA_PHY_CTRL_LOW_HS 0x04 /* PHY high speed mode */ +#define PHA_PHY_CTRL_LOW_HP 0x02 /* PHY high power mode */ + +/* HomePNA SPI opcodes */ + +#define PNA_SPI_OPCODE_SET_WE 0x06 +#define PNA_SPI_OPCODE_CLEAR_WE 0x04 +#define PNA_SPI_OPCODE_READ 0x03 +#define PNA_SPI_OPCODE_WRITE 0x02 + +/* HOMEPNA_PHY_REGS defines */ + +#define PNA_PHY_REG_VALUE 0x0 +#define PNA_PHY_REG_UPDATED 0x1 +typedef struct homePNAPhyInfo + { + USHORT sp_csr13; /* SP field for CSR13 */ + + /* PHA phy register values */ + + UCHAR pna_phy_regs[MAX_PNA_PHY_REGISTERS][2]; + } HOMEPNA_PHY_INFO; + +/* define CSRs and descriptors */ + +#define CSR0 0 /* csr 0 */ +#define CSR1 1 /* csr 1 */ +#define CSR2 2 /* csr 2 */ +#define CSR3 3 /* csr 3 */ +#define CSR4 4 /* csr 4 */ +#define CSR5 5 /* csr 5 */ +#define CSR6 6 /* csr 6 */ +#define CSR7 7 /* csr 7 */ +#define CSR8 8 /* csr 8 */ +#define CSR9 9 /* csr 9 */ +#define CSR10 10 /* csr 10 */ +#define CSR11 11 /* csr 11 */ +#define CSR12 12 /* csr 12 */ +#define CSR13 13 /* csr 13 */ +#define CSR14 14 /* csr 14 */ +#define CSR15 15 /* csr 15 */ + +#define RDESC0 0 /* recv desc 0 */ +#define RDESC1 1 /* recv desc 1 */ +#define RDESC2 2 /* recv desc 2 */ +#define RDESC3 3 /* recv desc 3 */ + +#define TDESC0 0 /* xmit desc 0 */ +#define TDESC1 1 /* xmit desc 1 */ +#define TDESC2 2 /* xmit desc 2 */ +#define TDESC3 3 /* xmit desc 3 */ + +/* command status register read write */ + +#define DEC21X40_CSR(base,x) ((ULONG)(base) + ((DECPCI_REG_OFFSET) * (x))) +#define DEC21X40_READ_CSR(base,x) (PCISWAP(*((ULONG *)DEC21X40_CSR((base),(x))))) +#define DEC21X40_WRITE_CSR(base,x,val) (*((ULONG *)DEC21X40_CSR((base),(x))) = \ + PCISWAP((val))) + +/* CSR, READ_CSR, WRITE_CSR are defined for backward compatibility but these + * may conflict with other drivers (SPR 71320) + */ + +#ifndef CSR +#define CSR DEC21X40_CSR +#endif + +#ifndef READ_CSR +#define READ_CSR DEC21X40_READ_CSR +#endif /*READ_CSR*/ + +#ifndef WRITE_CSR +#define WRITE_CSR DEC21X40_WRITE_CSR +#endif /*WRITE_CSR*/ + + +/* recv xmit descriptor read write */ + +#define DESC(base,x) ((ULONG)(base) + (4 * (x))) + +#define READ_DESC(base,x) (PCISWAP(*((ULONG *)(DESC((base),(x)))))) + +#define WRITE_DESC(base,x,val) (*((ULONG *)(DESC((base),(x)))) = PCISWAP((val))) + + +/* Definitions for fields and bits in the DEC_DEVICE */ + +/* CSR0 Bus Mode Register */ + +#define CSR0_21143_EONR 0x04000000 /* enable OnNow registers */ +#define CSR0_21140_WIE 0x01000000 /* pci write and invalidate */ +#define CSR0_21140_RLE 0x00800000 /* pci read line enable */ +#define CSR0_21140_RML 0x00200000 /* pci read multiple - 21140 */ +#define CSR0_21140_DBO 0x00100000 /* descriptor byte ordering - 21140 */ +#define CSR0_TAP_NO 0x00000000 /* no xmit auto polling */ +#define CSR0_TAP_200 0x00020000 /* xmit poll every 200 usecs */ +#define CSR0_TAP_800 0x00040000 /* xmit poll every 800 usecs */ +#define CSR0_TAP_1600 0x00060000 /* xmit poll every 1.6 millsecs */ +#define CSR0_TAP_12 0x00080000 /* xmit poll every 12.8 usecs - 21140 */ +#define CSR0_TAP_25 0x000A0000 /* xmit poll every 25.6 usecs - 21140 */ +#define CSR0_TAP_51 0x000C0000 /* xmit poll every 51.2 usecs - 21140 */ +#define CSR0_TAP_102 0x000E0000 /* xmit poll every 102.4 usecs- 21140 */ +#define CSR0_DAS 0x00010000 /* Diagnostic Address Space */ +#define CSR0_CAL_NO 0x00000000 /* cache address alignment not used */ +#define CSR0_CAL_08 0x00004000 /* 08 longword boundary aligned */ +#define CSR0_CAL_16 0x00008000 /* 16 longword boundary aligned */ +#define CSR0_CAL_32 0x0000c000 /* 32 longword boundary aligned */ +#define CSR0_PBL_UL 0x00000000 /* dma burst len - unlimited */ +#define CSR0_PBL_01 0x00000100 /* dma burst len - 1 lword */ +#define CSR0_PBL_02 0x00000200 /* dma burst len - 2 lwords */ +#define CSR0_PBL_04 0x00000400 /* dma burst len - 4 lwords */ +#define CSR0_PBL_08 0x00000800 /* dma burst len - 8 lwords */ +#define CSR0_PBL_16 0x00001000 /* dma burst len - 16 lwords */ +#define CSR0_PBL_32 0x00002000 /* dma burst len - 32 lwords */ +#define CSR0_BLE 0x00000080 /* Big/little endian */ +#define CSR0_BAR 0x00000002 /* Bus arbitration */ +#define CSR0_SWR 0x00000001 /* software reset */ + +#define CSR0_PBL_MSK 0x00003F00 /* Dma burst length mask */ +#define CSR0_PBL_VAL(x) (((x) << 8) & CSR0_PBL_MSK) + +#define CSR0_DSL_MSK 0x0000007C /* Descriptor skip length */ +#define CSR0_DSL_VAL(x) (((x) << 2) & CSR0_DSL_MSK) + +#define CSR0_TAP_MSK 0x00060000 +#define CSR0_BLE_MSK 0x00000080 +#define CSR0_CAL_MSK 0x0000c000 + + +/* CSR1 Transmit Poll Demand Register */ + +#define CSR1_TPD 0x00000001 /* Transmit poll demand */ + +/* CSR2 Recieve Poll Demand Register */ + +#define CSR2_RPD 0x00000001 /* Transmit poll demand */ + +/* CSR3 Receive List Base address Register */ + +#define CSR3_RDBA_MSK 0xFFFFFFFC /* long word aligned */ +#define CSR3_RDBA_VAL(x) ((x) & CSR3_RDBA_MSK) + +/* CSR4 Transmit List Base address Register */ + +#define CSR4_TDBA_MSK 0xFFFFFFFC /* long word aligned */ +#define CSR4_TDBA_VAL(x) ((x) & CSR4_TDBA_MSK) + +/* CSR5 Status register */ + +#define CSR5_21145_HRI 0x10000000 /* HomePNA PHY interrupt */ +#define CSR5_21143_LC 0x08000000 /* link changed */ +#define CSR5_21143_GPI 0x04000000 /* general purpose port intterupt */ + +#define CSR5_ERR_PE 0x00000000 /* parity error */ +#define CSR5_ERR_MA 0x00800000 /* Master abort */ +#define CSR5_ERR_TA 0x01000000 /* target abort */ + +#define CSR5_TPS_ST 0x00000000 /* Stopped */ +#define CSR5_TPS_RFTD 0x00100000 /* Running Fetch xmit descriptor */ +#define CSR5_TPS_RWET 0x00200000 /* Running Wait for end of Xmission */ +#define CSR5_TPS_RRBM 0x00300000 /* Running Read buff from memory */ +#define CSR5_TPS_RSP 0x00500000 /* Running Set up packet */ +#define CSR5_TPS_STFU 0x00600000 /* Suspended xmit FIFO underflow */ +#define CSR5_TPS_RCTD 0x00700000 /* Running Close xmit descriptor */ + +#define CSR5_RPS_ST 0x00000000 /* stopped reset or stop rcv command */ +#define CSR5_RPS_RFRD 0x00020000 /* Running Fetch rcv descriptor */ +#define CSR5_RPS_RCEP 0x00040000 /* Running Check end of rcv packet */ +#define CSR5_RPS_RWRP 0x00060000 /* Running Wait for rcv packet */ +#define CSR5_RPS_SURB 0x00080000 /* Suspended - unavailable rcv buff */ +#define CSR5_RPS_RCRD 0x000A0000 /* Running close rcv descriptor */ +#define CSR5_RPS_RFFF 0x000C0000 /* flush frame from rcv FIFO */ +#define CSR5_RPS_RQRF 0x000E0000 /* queue the rcv frame into rcv buff */ + +#define CSR5_NIS 0x00010000 /* normal interrupt summary */ +#define CSR5_AIS 0x00008000 /* abnormal interrupt summary */ +#define CSR5_SE 0x00002000 /* system error */ +#define CSR5_21040_LNF 0x00001000 /* link fail - 21040 */ +#define CSR5_21040_FD 0x00000800 /* Full duplex short frm rxd - 21040 */ +#define CSR5_21140_TMR 0x00000800 /* GP timer expired - 21140 */ +#define CSR5_21040_AT 0x00000400 /* AUI / 10BaseT Pin - 21040 */ +#define CSR5_21140_ETI 0x00000400 /* Early Tx intrrupt - 21140 */ +#define CSR5_RWT 0x00000200 /* rcv watchdog time-out */ +#define CSR5_RPS 0x00000100 /* rcv process stopped */ +#define CSR5_RU 0x00000080 /* rcv buffer unavailable */ +#define CSR5_RI 0x00000040 /* rcv interrupt */ +#define CSR5_UNF 0x00000020 /* xmit underflow */ +#define CSR5_ANC 0x00000010 /* auto-negotiate complete */ +#define CSR5_TJT 0x00000008 /* xmit jabber time-out */ +#define CSR5_TU 0x00000004 /* xmit buffer unavailable */ +#define CSR5_TPS 0x00000002 /* Xmit Process stopped */ +#define CSR5_TI 0x00000001 /* xmit interrupt */ + +#define CSR5_RPS_MSK 0x000E0000 /* Rcv process state mask */ +#define CSR5_TPS_MSK 0x00700000 /* Xmit process state mask */ +#define CSR5_ERR_MSK 0x03800000 /* error mask */ + +/* CSR6 Operation Mode Register */ + +#define CSR6_21140_SC 0x80000000 /* special capture effect enable */ +#define CSR6_21140_RA 0x40000000 /* receive all */ +#define CSR6_21145_IGDL 0x04000000 /* ignore dest addr LSB */ +#define CSR6_21143_IGDM 0x04000000 /* ignore dest addr MSB */ +#define CSR6_21140_MB1 0x02000000 /* must be 1 */ +#define CSR6_21140_SCR 0x01000000 /* scrambler mode */ +#define CSR6_21140_PCS 0x00800000 /* PCS function */ +#define CSR6_21140_TTM 0x00400000 /* tx threshold mode */ +#define CSR6_21140_SF 0x00200000 /* store and forward */ +#define CSR6_21140_HBD 0x00080000 /* heartbeat disable */ +#define CSR6_21140_PS 0x00040000 /* port select */ +#define CSR6_CAE 0x00020000 /* capture effect enable */ +#define CSR6_21040_BP 0x00010000 /* back pressure */ +#define CSR6_THR_072 0x00000000 /* threshold bytes 72 */ +#define CSR6_THR_096 0x00004000 /* threshold bytes 96 */ +#define CSR6_THR_128 0x00008000 /* threshold bytes 128 */ +#define CSR6_THR_160 0x0000C000 /* threshold bytes 160 */ +#define CSR6_ST 0x00002000 /* start/stop Xmit command */ +#define CSR6_FC 0x00001000 /* Force collision mode */ +#define CSR6_OM_EL 0x00000800 /* External loopback mode */ +#define CSR6_OM_IL 0x00000400 /* Internal loopback mode */ +#define CSR6_OM_NOR 0x00000000 /* normal mode */ +#define CSR6_FD 0x00000200 /* Full Duplex mode */ +#define CSR6_21040_FKD 0x00000100 /* Flaky oscillator disable */ +#define CSR6_PM 0x00000080 /* Pass all multicast */ +#define CSR6_PR 0x00000040 /* promiscuous mode */ +#define CSR6_SB 0x00000020 /* Start/Stop Back off counter */ +#define CSR6_IF 0x00000010 /* inverse filtering [RO] */ +#define CSR6_PB 0x00000008 /* pass bad frames */ +#define CSR6_HO 0x00000004 /* hash only filter mode [RO] */ +#define CSR6_SR 0x00000002 /* start/stop receive command */ +#define CSR6_HP 0x00000001 /* hash/perfect filter mode [RO] */ + +/* CSR7 Interrupt Mask register */ + +#define CSR7_21145_HRIM 0x10000000 /* HomePNA PHY interrupt mask */ +#define CSR7_21143_LCM 0x08000000 /* link changed mask */ +#define CSR7_21143_GPM 0x04000000 /* general purpose port mask */ +#define CSR7_NIM 0x00010000 /* normal interrupt mask */ +#define CSR7_AIM 0x00008000 /* abnormal interrupt mask */ +#define CSR7_21040_ERM 0x00004000 /* early receive interrupt mask */ +#define CSR7_SEM 0x00002000 /* system error mask */ +#define CSR7_21040_LFM 0x00001000 /* link fail mask */ +#define CSR7_21040_FDM 0x00000800 /* full duplex mask */ +#define CSR7_21140_TMR 0x00000800 /* gp timer mask */ +#define CSR7_21040_ATM 0x00000400 /* aui/tp switch mask */ +#define CSR7_21140_ETM 0x00000400 /* early trasmit mask */ +#define CSR7_RWM 0x00000200 /* rcv watchdog time-out mask */ +#define CSR7_RSM 0x00000100 /* rcv stopped mask */ +#define CSR7_RUM 0x00000080 /* rcv buff unavailable mask */ +#define CSR7_RIM 0x00000040 /* rcv interrupt mask */ +#define CSR7_UNM 0x00000020 /* underflow interrupt mask */ +#define CSR7_ANC 0x00000010 /* auto-negotiation complete */ +#define CSR7_TJM 0x00000008 /* xmit jabber timer out mask */ +#define CSR7_TUM 0x00000004 /* xmit buff unavailable mask */ +#define CSR7_TSM 0x00000002 /* xmission stopped mask */ +#define CSR7_TIM 0x00000001 /* xmit interrupt mask */ + + +/* CSR8 Missing Frame Counter */ + +#define CSR8_21140_OFO 0x10000000 /* overflow counter overflow */ +#define CSR8_21140_OFC_MSK 0x0FFE0000 /* overflow counter */ +#define CSR8_MFO 0x00010000 /* missed frame overflow */ +#define CSR8_MFC_MSK 0x0000FFFF /* Missed frame counter mask */ + +/* CSR9 Ethernet Address ROM Register */ + +#define CSR9_21145_SPI_DO 0x00800000 /* SPI serial data out */ +#define CSR9_21145_SPI_DI 0x00400000 /* SPI serial data in */ +#define CSR9_21145_SPI_CLK 0x00200000 /* SPI serial clock */ +#define CSR9_21145_SPI_CS 0x00100000 /* SPI chip select */ +#define CSR9_21145_SPI_MSK 0x00f00000 /* SPI bit mask */ +#define CSR9_21140_MDI 0x00080000 /* MII mgmt data in */ +#define CSR9_21140_MII 0x00040000 /* MII mgmt op mode */ +#define CSR9_21140_MDO 0x00020000 /* MII mgmt write data */ +#define CSR9_21140_MDC 0x00010000 /* MII mgmt clock */ +#define CSR9_21140_RD 0x00004000 /* Serial ROM Read */ +#define CSR9_21140_WR 0x00002000 /* Serial ROM Write */ +#define CSR9_21140_BR 0x00001000 /* boot rom select */ +#define CSR9_21140_SR 0x00000800 /* serial rom select */ +#define CSR9_21140_REG 0x00000400 /* external register select */ + +#define CSR9_21040_DNV 0x80000000 /* Data not valid */ +#define CSR9_DAT_MSK 0x000000FF /* data mask */ + +#define ENET_ROM_SIZE 8 /* ethernet rom register size */ + +#define CSR9_MDO_SHF 17 +#define CSR9_MDI_SHF 19 +#define CSR9_MII_DBIT_RD(X) (((X) & CSR9_21140_MDI) >> CSR9_MDI_SHF) +#define CSR9_MII_DBIT_WR(X) (((X) & 0x1) << CSR9_MDO_SHF) + +/* CSR10 Reserved */ + + +/* CSR11 Full Duplex Register */ + +#define CSR11_FDACV_MSK 0x0000FFFF /* full duplex auto config mask */ + + +/* CSR12 SIA status Register - 21040 */ + +#define CSR12_21040_DA0 0x00000080 /* Diagnostic bit all One */ +#define CSR12_21040_DAZ 0x00000040 /* Diagnostic bit all zero */ +#define CSR12_21040_DSP 0x00000020 /* Diagnostic BIST status indicator */ +#define CSR12_21040_DSD 0x00000010 /* Diagnostic Self test done */ +#define CSR12_21040_APS 0x00000008 /* Auto polarity state */ +#define CSR12_21040_LKF 0x00000004 /* link fail status */ +#define CSR12_21040_NCR 0x00000002 /* network connection error */ +#define CSR12_21040_PAUI 0x00000001 /* pin AUI_TP indication */ + +/* CSR12 General Purpose Register - 21140 */ + +#define CSR12_21140_GPC 0x00000100 /* General purpose control */ +#define CSR12_21140_MD 0x000000ff /* General purpose mode/data */ + + +/* CSR12 Auto-negotiation state values - 21143 */ + +#define CSR12_21143_LPC_MSK 0xffff0000 /* link partner code bitmask */ +#define CSR12_21143_LPN 0x00008000 /* line partner negtiable */ + +#define CSR12_AN_MASK 0x00007000 +#define CSR12_AN_DISABLED 0x00000000 +#define CSR12_AN_TX_DISABLED 0x00001000 +#define CSR12_AN_START 0x00001000 +#define CSR12_AN_ABILITY_DETECT 0x00002000 +#define CSR12_AN_ACK_DETECT 0x00003000 +#define CSR12_AN_COMPLETE_ACK 0x00004000 +#define CSR12_AN_COMPLETE 0x00005000 +#define CSR12_AN_LINK_CHECK 0x00006000 + +/* CSR12 values for 21143 */ + +#define CSR12_21143_TRF 0x00000800 /* transmit remote fault */ +#define CSR12_21143_NSN 0x00000400 /* non-stable NLPs detected */ +#define CSR12_21143_TRA 0x00000200 /* 10BASE-T receive port activity */ +#define CSR12_21145_HRA 0x00000100 /* HomePNA receive port activity */ +#define CSR12_21143_ARA 0x00000100 /* AUI receive port activity */ +#define CSR12_21143_APS 0x00000008 /* Auto polarity state */ +#define CSR12_21143_LS10 0x00000004 +#define CSR12_21143_LS100 0x00000002 +#define CSR12_21143_MII 0x00000001 + +/* CSR13 SIA connectivity Register */ + +#define CSR13_21145_SP_MSK 0xffff0000 /* special field for HomePNA use */ +#define CSR13_OE57 0x00008000 /* Output enable 5 6 7 */ +#define CSR13_OE24 0x00004000 /* output enable 2 4 */ +#define CSR13_OE13 0x00002000 /* output enable 1 3 */ +#define CSR13_IE 0x00001000 /* input enable */ +#define CSR13_SEL_LED 0x00000f00 /* select LED and external driver */ +#define CSR13_ASE_APLL 0x00000080 /* ase apll start enable */ +#define CSR13_SIM 0x00000040 /* serial iface input multiplexer */ +#define CSR13_ENI 0x00000020 /* encoder Input multiplexer */ +#define CSR13_EDP_SIA 0x00000010 /* pll external input enable */ +#define CSR13_AUI_TP 0x00000008 /* AUI or 10BASE-T or AUI */ +#define CSR13_CAC_CSR 0x00000004 /* auto config register */ +#define CSR13_PS 0x00000002 /* pin AUI_TP select */ +#define CSR13_SRL_SIA 0x00000001 /* srl sia Reset */ + +/* CSR14 SIA xmit rcv Register */ + +#define CSR14_21143_T4 0x00040000 /* 1000Base-T4 -21143 */ +#define CSR14_21143_TXF 0x00020000 /* 100Base-TX full duplex -21143 */ +#define CSR14_21143_TXH 0x00010000 /* 100Base-TX half duplex -21143 */ +#define CSR14_21143_TAS 0x00008000 /* 10Base-T/AUI autosensing -21143 */ +#define CSR14_SPP 0x00004000 /* set polarity plus */ +#define CSR14_APE 0x00002000 /* auto polarity enable */ +#define CSR14_LTE 0x00001000 /* link test enable */ +#define CSR14_SQE 0x00000800 /* signal quality generate enable */ +#define CSR14_CLD 0x00000400 /* collision detect enable */ +#define CSR14_CSQ 0x00000200 /* collision squelch enable */ +#define CSR14_RSQ 0x00000100 /* receive squelch enable */ +#define CSR14_21143_ANE 0x00000080 /* autonegotiation enable */ +#define CSR14_21143_TH 0x00000040 /* 10Base-T half duplex enable */ +#define CSR14_CPEN_NC 0x00000030 /* no compensation */ +#define CSR14_CPEN_HP 0x00000020 /* high power mode */ +#define CSR14_CPEN_DM 0x00000010 /* disable mode */ +#define CSR14_LSE 0x00000008 /* link pulse send enable */ +#define CSR14_DREN 0x00000004 /* driver enable */ +#define CSR14_LBK 0x00000002 /* loopback enable */ +#define CSR14_ECEN 0x00000001 /* encoder enable */ + +/* CSR15 SIA general register */ + +#define CSR15_21143_RMI 0x40000000 /* receive match interrupt */ +#define CSR15_21143_GI1 0x20000000 /* general port interrupt 1 */ +#define CSR15_21143_GI0 0x10000000 /* general port interrupt 0 */ +#define CSR15_21143_CWE 0x08000000 /* control write enable */ +#define CSR15_21143_RME 0x04000000 /* receive match enable */ +#define CSR15_21143_GE1 0x02000000 /* GEP interrupt enable on port 1 */ +#define CSR15_21143_GE0 0x01000000 /* GEP interrupt enable on port 0 */ +#define CSR15_21143_LG3 0x00800000 /* LED/GEP3 select */ +#define CSR15_21143_LG2 0x00400000 /* LED/GEP2 select */ +#define CSR15_21143_LG1 0x00200000 /* LED/GEP1 select */ +#define CSR15_21143_LG0 0x00100000 /* LED/GEP0 select */ +#define CSR15_21143_LEE 0x00000800 /* link extend enable */ +#define CSR15_21143_RWR 0x00000020 /* receive watchdog release */ +#define CSR15_21143_RWD 0x00000010 /* receive watchdog disable */ +#define CSR15_21143_ABM 0x00000008 /* AUI/BNC mode */ +#define CSR15_JCK 0x00000004 /* jabber clock */ +#define CSR15_HUJ 0x00000002 /* host unjab */ +#define CSR15_JBD 0x00000001 /* jabber disable */ + +#define CSR15_MD_MSK 0x000F0000 /* general purpose mode mask */ +#define CSR15_MODE_10 0x00050000 + +#define CSR15_MD_VAL(x) (((x) << 16) & CSR15_MD_MSK) + +/* receive descriptor */ + +/* receive descriptor 0 */ + +#define RDESC0_OWN 0x80000000 /* Own */ +#define RDESC0_ES 0x00008000 /* Error summary */ +#define RDESC0_LE 0x00004000 +#define RDESC0_DT_SRF 0x00000000 /* serial rcvd frame */ +#define RDESC0_DT_ILF 0x00001000 /* internal loop back frame */ +#define RDESC0_DT_ELF 0x00002000 /* external loop back frame */ +#define RDESC0_RF 0x00000800 /* runt frame */ +#define RDESC0_MF 0x00000400 /* multicast frame */ +#define RDESC0_FD 0x00000200 /* first descriptor */ +#define RDESC0_LS 0x00000100 /* last descriptor */ +#define RDESC0_TL 0x00000080 /* frame too long */ +#define RDESC0_CS 0x00000040 /* collision seen */ +#define RDESC0_FT 0x00000020 /* frame type */ +#define RDESC0_RJ 0x00000010 /* receive watch dog */ +#define RDESC0_DB 0x00000004 /* dribbling bit */ +#define RDESC0_CE 0x00000002 /* crc error */ +#define RDESC0_OF 0x00000001 /* Over flow */ + +#define DEC_FRAME_LEN_MSK 0x3FFF0000 /* Frame length mask */ + +#define DEC_FRAME_LEN_GET(x) (((x) & DEC_FRAME_LEN_MSK) >> 16) +#define DEC_FRAME_LEN_SET(x) (((x) << 16) & DEC_FRAME_LEN_MSK) + +/* receive descriptor 1 */ + +#define RDESC1_RER 0x02000000 /* recv end of ring */ +#define RDESC1_RCH 0x01000000 /* second address chained */ + +#define RDESC1_RBS2_MSK 0x003FF800 /* RBS2 buffer 2 size */ +#define RDESC1_RBS1_MSK 0x000007FF /* RBS1 buffer 1 size */ + +#define RDESC1_RBS1_VAL(x) ((x) & RDESC1_RBS1_MSK) /* multiple of 4 */ +#define RDESC1_RBS2_VAL(x) (((x) << 11) & RDESC1_RBS2_MSK) + +/* transmit descriptor */ + +/* xmit descriptor 0 */ + +#define TDESC0_OWN 0x80000000 /* own */ +#define TDESC0_ES 0x00008000 /* error summary */ +#define TDESC0_TO 0x00004000 /* xmit jabber time out */ +#define TDESC0_LO 0x00000800 /* loss of carrier */ +#define TDESC0_NC 0x00000400 /* NC No carrier */ +#define TDESC0_LC 0x00000200 /* late collision */ +#define TDESC0_EC 0x00000100 /* excessive collision */ +#define TDESC0_HF 0x00000080 /* heart beat fail */ +#define TDESC0_LF 0x00000004 /* link fail */ +#define TDESC0_UF 0x00000002 /* underflow error */ +#define TDESC0_DE 0x00000001 /* deffered */ + +#define TDESC0_CC_MSK 0x00000078 +#define TDESC0_CC_VAL(X) (((X) & TDESC0_CC_MSK) >> 3) + +/* xmit descriptor 1 */ + +#define TDESC1_IC 0x80000000 /* interrupt on completion */ +#define TDESC1_LS 0x40000000 /* last segment */ +#define TDESC1_FS 0x20000000 /* first segment */ +#define TDESC1_FT1 0x10000000 /* filtering type */ +#define TDESC1_SET 0x08000000 /* setup packet */ +#define TDESC1_AC 0x04000000 /* add crc disable */ +#define TDESC1_TER 0x02000000 /* xmit end of ring */ +#define TDESC1_TCH 0x01000000 /* second address chained */ +#define TDESC1_DPD 0x00800000 /* disabled padding */ +#define TDESC1_FT0 0x00400000 /* filtering type */ + +#define TDESC1_TBS2_MSK 0x003FF800 /* TBS2 buffer 2 size */ +#define TDESC1_TBS1_MSK 0x000007FF /* TBS2 buffer 1 size */ + +#define TDESC1_TBS1_PUT(x) ((x) & TDESC1_TBS1_MSK) /* multiple of 4 */ +#define TDESC1_TBS2_PUT(x) (((x) << 11) & TDESC1_TBS2_MSK) + +#define FLTR_FRM_SIZE 0xC0 /* filter frm size 192 bytes */ +#define FLTR_FRM_SIZE_ULONGS (FLTR_FRM_SIZE / sizeof (ULONG)) +#define FLTR_FRM_ADRS_NUM 0x10 /* filter frm holds 16 addrs */ +#define FLTR_FRM_ADRS_SIZE 0x06 /* size of each phys addrs */ +#define FLTR_FRM_DEF_ADRS 0xFFFFFFFF /* enet broad cast address */ +#define FLTR_FRM_PHY_ADRS_OFF 156 /* word - 39 */ + +#define DEC_CRC_POLY 0x04c11db6 /* for CRC computation */ +#define DEC_FLT_INDEX(I) ((((I) & ~0x1) * 2) + ((I) & 0x1)) + +/* MII Defines */ + +#define MII_MGMT_WR_OFF 17 +#ifndef MII_WRITE +# define MII_WRITE ((ULONG) 0x00002000) +#endif +#ifndef MII_READ +# define MII_READ ((ULONG) 0x00044000) +#endif + +#define MII_MGMT_WR ((ULONG) 0x00020000) +#define MII_MGMT_CLOCK ((ULONG) 0x00010000) +#define MII_READ_FRM ((ULONG) 0x60000000) +#define MII_WRITE_FRM ((ULONG) 0x50020000) +#define MII_PHY_CTRL_RES ((USHORT) 0x007F) +#define MII_PHY_STAT_RES ((USHORT) 0x07C0) +#define MII_PHY_NWAY_RES ((USHORT) 0x1C00) +#define MII_PHY_NWAY_EXP_RES ((USHORT) 0xFFE0) +#define MII_MGMT_DATA_IN ((ULONG) 0x00080000) +#define MII_READ_DATA_MSK MII_MGMT_DATA_IN + +#define DEC_MAX_PHY 32 /* max number of PHY devices */ +#define DEC_MAX_LINK_TOUT 6 /* max link timeout (in secs) */ + +#define MII_PREAMBLE ((ULONG) 0xFFFFFFFF) +#define MII_LINK_STATUS 0x4 + +/* MII frame header format */ + +#define MII_SOF 0x4 /* start of frame */ +#define MII_RD 0x2 /* op-code: Read */ +#define MII_WR 0x1 /* op-code: Write */ + +/* MII PHY registers */ + +#define MII_PHY_CR 0x00 /* Control Register */ +#define MII_PHY_SR 0x01 /* Status Register */ +#define MII_PHY_ID0 0x02 /* Identifier Register 0 */ +#define MII_PHY_ID1 0x03 /* Identifier Register 1 */ +#define MII_PHY_ANA 0x04 /* Auto Negot'n Advertisement */ +#define MII_PHY_ANLPA 0x05 /* Auto Negot'n Link Partner Ability */ +#define MII_PHY_ANE 0x06 /* Auto Negot'n Expansion */ + +/* MII PHY Auto Negotiation Advertisement Register */ + +#define MII_PHY_ANA_TAF 0x03e0 /* Technology Ability Field */ +#define MII_PHY_ANA_T4AM 0x0200 /* T4 Technology Ability Mask */ +#define MII_PHY_ANA_TXAM 0x0180 /* TX Technology Ability Mask */ +#define MII_PHY_ANA_FDAM 0x0140 /* Full Duplex Technology Ability Mask */ +#define MII_PHY_ANA_HDAM 0x02a0 /* Half Duplex Technology Ability Mask */ +#define MII_PHY_ANA_100M 0x0380 /* 100Mb Technology Ability Mask */ +#define MII_PHY_ANA_10M 0x0060 /* 10Mb Technology Ability Mask */ +#define MII_PHY_ANA_CSMA 0x0001 /* CSMA-CD Capable */ + +/* MII PHY Auto Negotiation Remote End Register */ + +#define MII_PHY_ANLPA_NP 0x8000 /* Next Page (Enable) */ +#define MII_PHY_ANLPA_ACK 0x4000 /* Remote Acknowledge */ +#define MII_PHY_ANLPA_RF 0x2000 /* Remote Fault */ +#define MII_PHY_ANLPA_TAF 0x03e0 /* Technology Ability Field */ +#define MII_PHY_ANLPA_T4AM 0x0200 /* T4 Technology Ability Mask */ +#define MII_PHY_ANLPA_TXAM 0x0180 /* TX Technology Ability Mask */ +#define MII_PHY_ANLPA_FDAM 0x0140 /* Full Duplex Technology Ability Mask */ +#define MII_PHY_ANLPA_HDAM 0x02a0 /* Half Duplex Technology Ability Mask */ +#define MII_PHY_ANLPA_100M 0x0380 /* 100Mb Technology Ability Mask */ +#define MII_PHY_ANLPA_10M 0x0060 /* 10Mb Technology Ability Mask */ +#define MII_PHY_ANLPA_CSMA 0x0001 /* CSMA-CD Capable */ + +#define MII_PHY_SR_ + +/* DEC Serial ROM */ + +#define DEC21140_SROM_SIZE 128 +#define DEC21140_SROM_WORDS 64 +#define DEC21140_SROM_VERSION_3 0x3 +#define DEC21140_SROM_VERSION_4 0x4 + +/* Serial ROM access macros */ + +#define SROM_VERSION(pSrom) (UCHAR) *(pSrom + 0x12) +#define SROM_ILEAF0_OFFSET(pSrom) SROM_SHORT (pSrom + 0x1b) + +/* Serial ROM Info Leaf */ + +#define ILEAF_GPR_MODE(pILeaf) (UCHAR) *(pILeaf + 2) +#define ILEAF_MEDIA_COUNT(pILeaf) (UCHAR) *(pILeaf + 3) +#define ILEAF_INFO_BLK0(pILeaf) (UCHAR *) (pILeaf + 4) + +/* Serial ROM Info Leaf - 21143 */ + +#define ILEAF_21143_MEDIA_COUNT(pILeaf) (UCHAR) *(pILeaf + 2) +#define ILEAF_21143_INFO_BLK0(pILeaf) (UCHAR *) (pILeaf + 3) + +/* Serial ROM Info Leaf - 21145 */ + +#define ILEAF_21145_MEDIA_COUNT(pILeaf) (UCHAR) *(pILeaf + 2) +#define ILEAF_21145_INFO_BLK0(pILeaf) (UCHAR *) (pILeaf + 3) + +/* Serial ROM Info Block */ + +#define IBLK_COMPACT_SIZE 4 +#define IBLK_IS_COMPACT(pIBlk) ((*(pIBlk) & 0x80) == 0x00) +#define IBLK_IS_EXT(pIBlk) ((*(pIBlk) & 0x80) == 0x80) +#define IBLK_IS_EXT0(pIBlk) \ + (IBLK_IS_EXT(pIBlk) && (IBLK_EXT_TYPE(pIBlk) == 0x00)) + +#define IBLK_IS_EXT1(pIBlk) \ + (IBLK_IS_EXT(pIBlk) && (IBLK_EXT_TYPE(pIBlk) == 0x01)) + + +#define IBLK_COMPACT_MCODE(pIBlk) (UCHAR) (*pIBlk & 0x7F) +#define IBLK_COMPACT_GPDATA(pIBlk) (UCHAR) *(pIBlk+1) +#define IBLK_COMPACT_CMD(pIBlk) SROM_SHORT(pIBlk+2) + +#define IBLK_EXT_SIZE(pIBlk) (UCHAR) (*(pIBlk+0) & 0x7F) +#define IBLK_EXT_TYPE(pIBlk) (UCHAR) *(pIBlk+1) + +#define IBLK_IS_EXT2 0x02 /* Block type 2 */ +#define IBLK_IS_EXT3 0x03 /* Block type 3 */ +#define IBLK_IS_EXT4 0x04 /* Block type 4 */ +#define IBLK_IS_EXT5 0x05 /* Block type 5 */ +#define IBLK_IS_EXT7 0x07 /* Block type 7 */ + + +#define IBLK_EXT0_TO_COMPACT(pIBlk) (UCHAR *)(pIBlk+2) +#define IBLK_EXT1_PHY(pIBlk) (UCHAR) *(pIBlk+2) +#define IBLK_EXT1_INIT_LEN(pIBlk) (UCHAR) *(pIBlk+3) +#define IBLK_EXT1_INIT_STR(pIBlk) (UCHAR *)(pIBlk+4) +#define IBLK_EXT1_RESET_LEN(pIBlk) \ + (UCHAR) *(IBLK_EXT1_INIT_STR(pIBlk) + IBLK_EXT1_INIT_LEN(pIBlk)) +#define IBLK_EXT1_RESET_STR(pIBlk) \ + (UCHAR *) (IBLK_EXT1_INIT_STR(pIBlk) + IBLK_EXT1_INIT_LEN(pIBlk) + 1) +#define IBLK_EXT1_MEDIA_CAP(pIBlk) \ + SROM_SHORT( IBLK_EXT1_RESET_STR(pIBlk) + IBLK_EXT1_RESET_LEN(pIBlk)) +#define IBLK_EXT1_AUTO_AD(pIBlk) \ + SROM_SHORT( IBLK_EXT1_RESET_STR(pIBlk) + IBLK_EXT1_RESET_LEN(pIBlk) + 2) +#define IBLK_EXT1_FD_MAP(pIBlk) \ + SROM_SHORT( IBLK_EXT1_RESET_STR(pIBlk) + IBLK_EXT1_RESET_LEN(pIBlk) + 4) +#define IBLK_EXT1_TTM_MAP(pIBlk) \ + SROM_SHORT( IBLK_EXT1_RESET_STR(pIBlk) + IBLK_EXT1_RESET_LEN(pIBlk) + 6) + +/* Extended format - Block type 2, 3, 4 & 5 - 21143 */ + +#define IBLK_EXT2_MCODE(pIBlk) (UCHAR) (*(pIBlk + 2) & 0x3F) +#define IBLK_EXT2_EXT(pIBlk) (UCHAR) ((*(pIBlk + 2) & 0x40) >> 6) +#define IBLK_EXT2_MSD_CSR13(pIBlk) SROM_SHORT(pIBlk + 3) +#define IBLK_EXT2_MSD_CSR14(pIBlk) SROM_SHORT(pIBlk + 5) +#define IBLK_EXT2_MSD_CSR15(pIBlk) SROM_SHORT(pIBlk + 7) +#define IBLK_EXT2_GPC(pIBlk) \ + SROM_SHORT( pIBlk + 3 + ((((UCHAR) *pIBlk) & 0x7F) - 0x6)) +#define IBLK_EXT2_GPD(pIBlk) \ + SROM_SHORT( pIBlk + 5 + ((((UCHAR) *pIBlk) & 0x7F) - 0x6)) + +#define IBLK_EXT3_PHY(pIBlk) (UCHAR) *(pIBlk+2) +#define IBLK_EXT3_INIT_LEN(pIBlk) (UCHAR) *(pIBlk+3) +#define IBLK_EXT3_INIT_STR(pIBlk) (UCHAR *)(pIBlk+4) +#define IBLK_EXT3_RESET_LEN(pIBlk) \ + (UCHAR) *(IBLK_EXT3_INIT_STR(pIBlk) + IBLK_EXT3_INIT_LEN(pIBlk)) +#define IBLK_EXT3_RESET_STR(pIBlk) \ + (UCHAR *) (IBLK_EXT3_INIT_STR(pIBlk) + IBLK_EXT3_INIT_LEN(pIBlk) + 1) +#define IBLK_EXT3_MEDIA_CAP(pIBlk) \ + SROM_SHORT( IBLK_EXT3_RESET_STR(pIBlk) + IBLK_EXT3_RESET_LEN(pIBlk)) +#define IBLK_EXT3_AUTO_AD(pIBlk) \ + SROM_SHORT( IBLK_EXT3_RESET_STR(pIBlk) + IBLK_EXT3_RESET_LEN(pIBlk) + 2) +#define IBLK_EXT3_FD_MAP(pIBlk) \ + SROM_SHORT( IBLK_EXT3_RESET_STR(pIBlk) + IBLK_EXT3_RESET_LEN(pIBlk) + 4) +#define IBLK_EXT3_TTM_MAP(pIBlk) \ + SROM_SHORT( IBLK_EXT3_RESET_STR(pIBlk) + IBLK_EXT3_RESET_LEN(pIBlk) + 6) +#define IBLK_EXT3_MII_CI(pIBlk) \ + SROM_SHORT( IBLK_EXT3_RESET_STR(pIBlk) + IBLK_EXT3_RESET_LEN(pIBlk) + 8) + +#define IBLK_EXT4_MCODE(pIBlk) (UCHAR) (*(pIBlk + 2) & 0x3F) +#define IBLK_EXT4_GPC(pIBlk) SROM_SHORT(pIBlk + 3 ) +#define IBLK_EXT4_GPD(pIBlk) SROM_SHORT(pIBlk + 5 ) +#define IBLK_EXT4_CMD(pIBlk) SROM_SHORT(pIBlk + 7 ) +#define IBLK_EXT4_CMD_PS 0x0001 +#define IBLK_EXT4_CMD_TTM 0x0010 +#define IBLK_EXT4_CMD_PCS 0x0020 +#define IBLK_EXT4_CMD_SCR 0x0040 + +#define IBLK_EXT5_RESET_LEN(pIBlk) (UCHAR) *(pIBlk+2) + +#define IBLK_EXT7_ANALOG_CTRL(pIBlk) SROM_SHORT(pIBlk + 2 ) +#define IBLK_EXT7_CTRL_LOW(pIBlk) (UCHAR) *(pIBlk + 4 ) +#define IBLK_EXT7_CTRL_HI(pIBlk) (UCHAR) *(pIBlk + 5 ) +#define IBLK_EXT7_NOISE(pIBlk) (UCHAR) *(pIBlk + 6 ) +#define IBLK_EXT7_NSE_FLOOR(pIBlk) (UCHAR) *(pIBlk + 7 ) +#define IBLK_EXT7_NSE_CEILING(pIBlk) (UCHAR) *(pIBlk + 8 ) +#define IBLK_EXT7_NSE_ATTACK(pIBlk) (UCHAR) *(pIBlk + 9 ) +#define IBLK_EXT7_EXTRA_INDEX(pIBlk) (UCHAR) (0x1f & *(pIBlk)) +#define IBLK_EXT7_EXTRA_DATA(pIBlk) (UCHAR) *(pIBlk +1 ) + +/* Serial ROM Compact Info Block, command field */ + +#define COMPACT_CMD_ACT_INV 0x8000 /* Active Invalid */ +#define COMPACT_CMD_MED_DEF 0x4000 /* Default Media */ +#define COMPACT_CMD_POLARITY 0x0080 /* Media bit polarity */ +#define COMPACT_CMD_SCR 0x0040 /* Scrambler mode */ +#define COMPACT_CMD_PCS 0x0030 /* PCS Function */ +#define COMPACT_CMD_MED_SENSE 0x000E /* Media Sense */ +#define COMPACT_CMD_PS 0x0001 /* Port Select */ + +/* Serial ROM EXT1 Info Block, valid media types */ + +#define EXT1_MEDIA_100BT4 0x0200 +#define EXT1_MEDIA_100BTX_FD 0x0100 +#define EXT1_MEDIA_100BTX 0x0080 +#define EXT1_MEDIA_10BT_FD 0x0040 +#define EXT1_MEDIA_10BT 0x0020 +#define EXT1_MEDIA_CAP_MSK 0x03E0 + +/* Serial ROM EXT2 Info Block, valid media types */ + +#define EXT2_MEDIA_10TP 0x0000 /* 10baseT (Twisted Pair) */ +#define EXT2_MEDIA_BNC 0x0001 /* 10base2 (BNC) */ +#define EXT2_MEDIA_AUI 0x0002 /* 10base5 (AUI) */ +#define EXT2_MEDIA_10FD 0x0004 /* 10baseT Full Duplex */ +#define EXT2_MEDIA_HOMEPNA 0x0012 /* Home PNA */ + +typedef struct free_buf + { + void * pClBuf; /* pointer cluster buffer */ + } FREE_BUF; + +/* The dec21x40End driver control structure */ + +typedef struct dec21x40DrvCtrl + { + END_OBJ endObj; /* base class */ + int flags; /* driver flags */ + + int unit; /* unit number */ + ULONG devAdrs; /* IO base address */ + int ivec; /* interrupt vector */ + int ilevel; /* interrupt level */ + UINT32 intrMask; /* interrupt mask */ + char * memBase; /* descriptor mempool base addr */ + ULONG memSize; /* descriptor mempool size */ + ULONG pciMemBase; /* memory base on PCI adr space */ + ULONG usrFlags; + ULONG drvFlags; + int offset; /* offset to fix alignment */ + + int numRds; /* RD ring size */ + int rxIndex; /* index into RD ring */ + DEC_RD * rxRing; /* RD ring */ + + int numTds; /* TD ring size */ + int txIndex; /* index into TD ring */ + int txDiIndex; /* disposal index into TD ring */ + DEC_TD * txRing; /* TD ring */ + + UINT8 mediaCount; /* Number of PHY devices [RW] */ + UINT8 mediaDefault; /* Default PHY device [RW] */ + UINT8 mediaCurrent; /* Current PHY device [RW] */ + UINT8 gprModeVal; /* Mode bits for GP register [RW]*/ + + BOOL rxHandling; + BOOL txCleaning; + BOOL intrConnect; /* intr routine connected */ + + CACHE_FUNCS cacheFuncs; /* cache function pointers */ + BOOL txBlocked; /* variable for blocking */ + FREE_BUF freeBuf[128]; + CL_POOL_ID clPoolId; + + int rxLen; /* current receive bytes */ + int rxMaxLen; /* receive managment limit */ + + PHY_INFO *pPhyInfo; /* info on a MII-compliant PHY */ + UINT32 miiPhyFlags; /* MII-compliant PHY flags */ + UINT8 phyAddr; /* MII-compliant PHY address */ + MII_AN_ORDER_TBL * pMiiPhyTbl; /* MII-compliant PHY's table */ + HOMEPNA_PHY_INFO *pHomePNAPhyInfo; /* info on a HomePNA PHY */ + BOOL homePNAPhyValuesFound; /* existance of defaults */ + char *txPollSendBuf; /* buffer for poll mode send */ + int loanBufs; /* number of loaner clusters */ + END_ERR lastError; /* Last error passed to muxError */ + } DEC21X40_DRV_CTRL; + +IMPORT FUNCPTR _func_dec21x40MediaSelect; +IMPORT VOIDFUNCPTR _func_dec21x40NanoDelay; + +#define DRV_NAME "dc" +#define DRV_NAME_LEN 3 +#define EADDR_LEN 6 +#define ETH_CRC_LEN 4 +#define DEC_BUFSIZ (ETHERMTU + SIZEOF_ETHERHEADER + EADDR_LEN) + +/* DRV_CTRL flags */ +#define DEC_MEMOWN 0x0001 /* TDs and RDs allocated by driver */ +#define DEC_TX_KICKSTART 0x0002 /* No transmit poll */ +#define DEC_POLLING 0x0004 /* Poll mode, io mode */ +#define DEC_PROMISC 0x0008 /* Promiscuous, rx mode */ +#define DEC_MCAST 0x0010 /* Multicast, rx mode */ +#define DEC_BSP_EADRS 0x0020 /* Use BSP routine to get ether addr */ +#define DEC_NOSWAP_MASTER 0x0040 /* Don't swap PCI bus master I/O */ +#define DEC_21140 0x4000 /* DEC21140 device type */ +#define DEC_21040 0x8000 /* DEC21040 device type */ +#define DEC_21143 0x2000 /* DEC21143 device type */ +#define DEC_21145 0x1000 /* DEC21145 device type */ + +/* + * User options + * + * These options may be set in the userFlags field of the dec21x40End driver + * load string. The driver, at initialization, will set up apt registers to + * reflect the selected options. + */ + +#define DEC_USR_BE 0x00000001 /* CSR0: Big Endian */ + +#define DEC_USR_TAP_02 0x00000002 /* CSR0: Tx poll every 200 usec */ +#define DEC_USR_TAP_08 0x00000004 /* CSR0: Tx poll every 800 usec */ +#define DEC_USR_TAP_16 0x00000006 /* CSR0: Tx poll every 1.6 msec */ +#define DEC_USR_TAP_012 0x00000008 /* CSR0: Tx poll every 12.8 usec */ +#define DEC_USR_TAP_025 0x0000000A /* CSR0: Tx poll every 25.6 usec */ +#define DEC_USR_TAP_051 0x0000000C /* CSR0: Tx poll every 51.2 usec */ +#define DEC_USR_TAP_102 0x0000000E /* CSR0: Tx poll every 102.4 usec */ +#define DEC_USR_TAP_MSK 0x0000000E +#define DEC_USR_TAP_SHF 16 + +#define DEC_USR_CAL_08 0x00000010 /* CSR0: Cache adrs aligned 8 lwords */ +#define DEC_USR_CAL_16 0x00000020 /* CSR0: Cache adrs aligned 16 lwords */ +#define DEC_USR_CAL_32 0x00000030 /* CSR0: Cache adrs aligned 32 lwords */ +#define DEC_USR_CAL_MSK 0x00000030 +#define DEC_USR_CAL_SHF 10 + +#define DEC_USR_PBL_01 0x00000040 /* CSR0: DMA burst len 1 lword */ +#define DEC_USR_PBL_02 0x00000080 /* CSR0: DMA burst len 2 lwords */ +#define DEC_USR_PBL_04 0x00000100 /* CSR0: DMA burst len 4 lwords */ +#define DEC_USR_PBL_08 0x00000200 /* CSR0: DMA burst len 8 lwords */ +#define DEC_USR_PBL_16 0x00000400 /* CSR0: DMA burst len 16 lwords */ +#define DEC_USR_PBL_32 0x00000800 /* CSR0: DMA burst len 32 lwords */ +#define DEC_USR_PBL_MSK 0x00000FC0 +#define DEC_USR_PBL_SHF 2 + +#define DEC_USR_BAR_RX 0x00001000 /* CSR0: Rx has priority over Tx */ +#define DEC_USR_RML 0x00002000 /* CSR0: PCI memory-read-multiple */ +#define DEC_USR_XEA 0x00004000 /* Use sysDec21x40EnetAddrGet() */ +#define DEC_USR_SF 0x00008000 /* Enable store&forward CSR6:21 */ + +#define DEC_USR_THR_072 0x00000000 /* Use TxTheshold 72/128 bytes */ +#define DEC_USR_THR_096 0x00010000 /* Use TxTheshold 96/256 bytes */ +#define DEC_USR_THR_128 0x00020000 /* Use TxTheshold 128/512 bytes */ +#define DEC_USR_THR_160 0x00030000 /* Use TxTheshold 160/1024 bytes */ +#define DEC_USR_THR_MSK 0x00030000 +#define DEC_USR_THR_SHF 2 + +#define DEC_USR_SB 0x00040000 /* Enable backoff counter CSR6:5 */ +#define DEC_USR_PB 0x00080000 /* Enable pass bad frame CSR6:3 */ +#define DEC_USR_SC 0x00100000 /* Enable spl capture effect CSR6:31 */ +#define DEC_USR_CA 0x00200000 /* Enable capture effect CSR6:17 */ + +/* + * since USR_FORCE_MODE, USR_100MB, USR_FD, USR_PHY_CHK dont seem to be + * used anymore by the current drirver, we take over their bits for HomePNA + */ + +/* FORCE HomePNA to desired modes */ + +#define DEC_USR_HPNA_FORCE_LOW_PWR 0x00400000 /* low power HomePNA */ +#define DEC_USR_HPNA_FORCE_HI_PWR 0x00800000 /* high power HomePNA */ +#define DEC_USR_HPNA_FORCE_SLOW 0x01000000 /* low speed HomePNA 0.7 MB/s */ +#define DEC_USR_HPNA_FORCE_FAST 0x02000000 /* hi speed HomePNA 1 MB/s */ + +#define DEC_USR_MII 0x04000000 /* use additional pars for MII PHY */ + +#define DEC_USR_HPNA_PREFER_10BT 0x08000000 /* continually autonegotiate */ + /* 10BT link and select if avaliable */ +#define DEC_USR_21145 0x20000000 /* Intel/DEC 21145 part */ +#define DEC_USR_21143 0x40000000 /* DEC 21143 part */ +#define DEC_USR_21140 0x80000000 /* DEC 21140 part */ +#define DEC_USR_VER_MSK 0xE0000000 /* DEC version mask */ + + + +#define DEC_USR_CSR6_MSK (CSR6_21140_PS | CSR6_21140_PCS | CSR6_21140_SCR | \ + CSR6_21140_TTM | CSR6_FD | CSR6_21140_HBD) + +/* Special MII flag bit definitions, not the user flag bits */ + +#define DEC_USR_MII_BUS_MON 0x01000000 /* monitor the MII bus */ +#define DEC_USR_MII_AN_TBL 0x04000000 /* use auto-negotiation table */ +#define DEC_USR_MII_NO_AN 0x08000000 /* do not auto-negotiate */ +#define DEC_USR_MII_FD 0x10000000 /* allow full duplex */ +#define DEC_USR_MII_100MB 0x20000000 /* allow 100 MB */ +#define DEC_USR_MII_HD 0x40000000 /* allow half duplex */ +#define DEC_USR_MII_10MB 0x80000000 /* allow 10 MB */ + + +/* + * Driver options + * + * These options may be set in the drvFlags field of the dec21x40End driver + * load string. The driver's run time behavior can be controlled by these + * flags. + */ + +#define DEC_DRV_NOSWAP_MASTER 0x00000001 /* don't swap PCI master I/O */ + + +/* + * Device specific network configuration defined in configNet.h + */ + +IMPORT M_CL_CONFIG dec21x40MBlkConfig; /* mblk config description */ +IMPORT CL_DESC dec21x40ClDescTbl[]; /* cluster pool config table */ +IMPORT int dec21x40ClDescTblEnt; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdec21x40Endh */ diff --git a/h/drv/end/dec21x4xEnd.h b/h/drv/end/dec21x4xEnd.h new file mode 100644 index 0000000..d663eae --- /dev/null +++ b/h/drv/end/dec21x4xEnd.h @@ -0,0 +1,794 @@ +/* dec21x4xEnd.h - DEC Ethernet LAN Controller 21x4x interface header */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01q,28oct01,dat Adding warnings about obsolete drivers +01p,01feb99,dat (from kla) added decl for dec21x4xLoad. SPR 24794 +01o,13oct98,cn Added macro DEC_USR_FD [SPR# 21683]. +01n,24sep98,dat SPR 20942, DEC_FRAME_LEN_MSK was incorrect. +01m,13mar98,jgn add extra CSR6 register values (SPR #20166) +01l,29jan98,rlp renamed macro names containing lower case characters. +01k,08dec97,tam added _func_dec2114xIntAck +01j,27sep97,rlp added support for dec21143 +01i,24sep97,vin changed MBLK_CONFIG to M_CL_CONFIG +01h,31aug97,vin added a txBlocked variable to the drvCtrl structure. +01g,22aug97,gnn changes due to new buffering scheme. +01f,21aug97,vin modified free_buf type def added map's fixes +01e,10jun97,map renamed funcDec21x40MediaSelect to _func_dec21x40MediaSelect. +01d,02jun97,map added DEC Serial ROM support, and driver control definitions. +01c,24apr97,map added PCISWAP_SHORT +01b,18apr97,map added support for dec 21140 +01a,10jan97,map written from ../netif/if_dc.h +*/ + +#ifndef __INCif_dec21x4xEndh +#define __INCif_dec21x4xEndh + +#ifdef __cplusplus +extern "C" { +#endif + +/* dec21x4xEnd is being obsoleted, use dec21x40End instead */ + +#warning "dec21x4xEnd is being obsoleted, please use dec21x40End instead" + + +#include "end.h" +#include "netBufLib.h" + +#define DECPCI_REG_OFFSET 0x08 /* quad word aligned */ + +#if (_BYTE_ORDER == _BIG_ENDIAN) + +#define PCISWAP(x) LONGSWAP(x) +#define PCISWAP_SHORT(x) (MSB(x) | LSB(x) << 8) +#define SROM_SHORT(pX) (*(UINT8*)(pX) << 8 | *((UINT8*)(pX)+1)) + +#else + +#define PCISWAP(x) (x) +#define PCISWAP_SHORT(x) (x) +#define SROM_SHORT(pX) (*(UINT8*)(pX) | *((UINT8*)(pX)+1) << 8) + +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + +/* + * Receive Message Descriptor Entry. + * Four words per entry. Number of entries must be a power of two. + */ + +typedef struct rDesc + { + ULONG rDesc0; /* status and ownership */ + ULONG rDesc1; /* control & buffer count */ + ULONG rDesc2; /* buffer address 1 */ + ULONG rDesc3; /* buffer address 2 */ + } DEC_RD; + +/* + * Transmit Message Descriptor Entry. + * Four words per entry. Number of entries must be a power of two. + */ + +typedef struct tDesc + { + ULONG tDesc0; /* status and ownership */ + ULONG tDesc1; /* control & buffer count */ + ULONG tDesc2; /* buffer address 1 */ + ULONG tDesc3; /* buffer address 2 */ + } DEC_TD; + +#define DEC_MAX_UNITS 4 /* max number of dec units */ +#define MIN_RDS 5 /* 5 buffers reasonable minimum */ +#define MIN_TDS 5 /* 5 buffers reasonable minimum */ +#define NUM_RDS_DEF 32 /* default number of Recv descriptors */ +#define NUM_TDS_DEF 64 /* default number of Xmit descriptors */ +#define NUM_LOAN 16 /* number of loaner buffers */ + +/* define CSRs and descriptors */ + +#define CSR0 0 /* csr 0 */ +#define CSR1 1 /* csr 1 */ +#define CSR2 2 /* csr 2 */ +#define CSR3 3 /* csr 3 */ +#define CSR4 4 /* csr 4 */ +#define CSR5 5 /* csr 5 */ +#define CSR6 6 /* csr 6 */ +#define CSR7 7 /* csr 7 */ +#define CSR8 8 /* csr 8 */ +#define CSR9 9 /* csr 9 */ +#define CSR10 10 /* csr 10 */ +#define CSR11 11 /* csr 11 */ +#define CSR12 12 /* csr 12 */ +#define CSR13 13 /* csr 13 */ +#define CSR14 14 /* csr 14 */ +#define CSR15 15 /* csr 15 */ + +#define RDESC0 0 /* recv desc 0 */ +#define RDESC1 1 /* recv desc 1 */ +#define RDESC2 2 /* recv desc 2 */ +#define RDESC3 3 /* recv desc 3 */ + +#define TDESC0 0 /* xmit desc 0 */ +#define TDESC1 1 /* xmit desc 1 */ +#define TDESC2 2 /* xmit desc 2 */ +#define TDESC3 3 /* xmit desc 3 */ + +/* command status register read write */ + +#define CSR(base,x) ((ULONG)(base) + ((DECPCI_REG_OFFSET) * (x))) + +#define READ_CSR(base,x) (PCISWAP(*((ULONG *)CSR((base),(x))))) + +#define WRITE_CSR(base,x,val) (*((ULONG *)CSR((base),(x))) = PCISWAP((val))) + + +/* recv xmit descriptor read write */ + +#define DESC(base,x) ((ULONG)(base) + (4 * (x))) + +#define READ_DESC(base,x) (PCISWAP(*((ULONG *)(DESC((base),(x)))))) + +#define WRITE_DESC(base,x,val) (*((ULONG *)(DESC((base),(x)))) = PCISWAP((val))) + + +/* Definitions for fields and bits in the DEC_DEVICE */ + +/* CSR0 Bus Mode Register */ + +#define CSR0_21143_WIE 0x01000000 /* write & invalidate enable 21143 */ +#define CSR0_21143_RLE 0x00800000 /* read line enable 21143 */ +#define CSR0_2114X_RML 0x00200000 /* pci read multiple - 2114X */ +#define CSR0_2114X_DBO 0x00100000 /* descriptor byte ordering - 2114X */ +#define CSR0_TAP_NO 0x00000000 /* no xmit auto polling */ +#define CSR0_TAP_200 0x00020000 /* xmit poll every 200 usecs */ +#define CSR0_TAP_800 0x00040000 /* xmit poll every 800 usecs */ +#define CSR0_TAP_1600 0x00060000 /* xmit poll every 1.6 millsecs */ +#define CSR0_TAP_12 0x00080000 /* xmit poll every 12.8 usecs - 2114X */ +#define CSR0_TAP_25 0x000A0000 /* xmit poll every 25.6 usecs - 2114X */ +#define CSR0_TAP_51 0x000C0000 /* xmit poll every 51.2 usecs - 2114X */ +#define CSR0_TAP_102 0x000E0000 /* xmit poll every 102.4 usecs- 2114X */ +#define CSR0_DAS 0x00010000 /* Diagnostic Address Space */ +#define CSR0_CAL_NO 0x00000000 /* cache address alignment not used */ +#define CSR0_CAL_08 0x00004000 /* 08 longword boundary aligned */ +#define CSR0_CAL_16 0x00008000 /* 16 longword boundary aligned */ +#define CSR0_CAL_32 0x0000c000 /* 32 longword boundary aligned */ +#define CSR0_PBL_UL 0x00000000 /* dma burst len - unlimited */ +#define CSR0_PBL_01 0x00000100 /* dma burst len - 1 lword */ +#define CSR0_PBL_02 0x00000200 /* dma burst len - 2 lwords */ +#define CSR0_PBL_04 0x00000400 /* dma burst len - 4 lwords */ +#define CSR0_PBL_08 0x00000800 /* dma burst len - 8 lwords */ +#define CSR0_PBL_16 0x00001000 /* dma burst len - 16 lwords */ +#define CSR0_PBL_32 0x00002000 /* dma burst len - 32 lwords */ +#define CSR0_BLE 0x00000080 /* Big/little endian */ +#define CSR0_BAR 0x00000002 /* Bus arbitration */ +#define CSR0_SWR 0x00000001 /* software reset */ + +#define CSR0_PBL_MSK 0x00003F00 /* Dma burst length mask */ +#define CSR0_PBL_VAL(x) (((x) << 8) & CSR0_PBL_MSK) + +#define CSR0_DSL_MSK 0x0000007C /* Descriptor skip length */ +#define CSR0_DSL_VAL(x) (((x) << 2) & CSR0_DSL_MSK) + +#define CSR0_TAP_MSK 0x00060000 +#define CSR0_BLE_MSK 0x00000080 +#define CSR0_CAL_MSK 0x0000c000 + +/* CSR1 Transmit Poll Demand Register */ + +#define CSR1_TPD 0x00000001 /* Transmit poll demand */ + +/* CSR2 Recieve Poll Demand Register */ + +#define CSR2_RPD 0x00000001 /* Transmit poll demand */ + +/* CSR3 Receive List Base address Register */ + +#define CSR3_RDBA_MSK 0xFFFFFFFC /* long word aligned */ +#define CSR3_RDBA_VAL(x) ((x) & CSR3_RDBA_MSK) + +/* CSR4 Transmit List Base address Register */ + +#define CSR4_TDBA_MSK 0xFFFFFFFC /* long word aligned */ +#define CSR4_TDBA_VAL(x) ((x) & CSR4_TDBA_MSK) + +/* CSR5 Status register */ + +#define CSR5_21143_LC 0x08000000 /* link changed - 21143 */ +#define CSR5_21143_GPI 0x04000000 /* GP port interrupt -21143 */ +#define CSR5_ERR_PE 0x00000000 /* parity error */ +#define CSR5_ERR_MA 0x00800000 /* Master abort */ +#define CSR5_ERR_TA 0x01000000 /* target abort */ +#define CSR5_TPS_ST 0x00000000 /* Stopped */ +#define CSR5_TPS_RFTD 0x00100000 /* Running Fetch xmit descriptor */ +#define CSR5_TPS_RWET 0x00200000 /* Running Wait for end of Xmission */ +#define CSR5_TPS_RRBM 0x00300000 /* Running Read buff from memory */ +#define CSR5_TPS_RSP 0x00500000 /* Running Set up packet */ +#define CSR5_TPS_STFU 0x00600000 /* Suspended xmit FIFO underflow */ +#define CSR5_TPS_RCTD 0x00700000 /* Running Close xmit descriptor */ +#define CSR5_RPS_ST 0x00000000 /* stopped reset or stop rcv command */ +#define CSR5_RPS_RFRD 0x00020000 /* Running Fetch rcv descriptor */ +#define CSR5_RPS_RCEP 0x00040000 /* Running Check end of rcv packet */ +#define CSR5_RPS_RWRP 0x00060000 /* Running Wait for rcv packet */ +#define CSR5_RPS_SURB 0x00080000 /* Suspended - unavailable rcv buff */ +#define CSR5_RPS_RCRD 0x000A0000 /* Running close rcv descriptor */ +#define CSR5_RPS_RFFF 0x000C0000 /* flush frame from rcv FIFO */ +#define CSR5_RPS_RQRF 0x000E0000 /* queue the rcv frame into rcv buff */ +#define CSR5_NIS 0x00010000 /* normal interrupt summary */ +#define CSR5_AIS 0x00008000 /* abnormal interrupt summary */ +#define CSR5_21143_ERI 0x00004000 /* early receive interrupt - 21143 */ +#define CSR5_SE 0x00002000 /* system error */ +#define CSR5_21X4X_LNF 0x00001000 /* link fail - 21X4X */ +#define CSR5_21040_FD 0x00000800 /* Full duplex short frm rxd - 21040 */ +#define CSR5_2114X_TMR 0x00000800 /* GP timer expired - 2114X */ +#define CSR5_21040_AT 0x00000400 /* AUI / 10BaseT Pin - 21040 */ +#define CSR5_2114X_ETI 0x00000400 /* Early Tx intrrupt - 2114X */ +#define CSR5_RWT 0x00000200 /* rcv watchdog time-out */ +#define CSR5_RPS 0x00000100 /* rcv process stopped */ +#define CSR5_RU 0x00000080 /* rcv buffer unavailable */ +#define CSR5_RI 0x00000040 /* rcv interrupt */ +#define CSR5_UNF 0x00000020 /* xmit underflow */ +#define CSR5_21143_LNP 0x00000010 /* link pass - 21143 */ +#define CSR5_TJT 0x00000008 /* xmit jabber time-out */ +#define CSR5_TU 0x00000004 /* xmit buffer unavailable */ +#define CSR5_TPS 0x00000002 /* Xmit Process stopped */ +#define CSR5_TI 0x00000001 /* xmit interrupt */ + +#define CSR5_RPS_MSK 0x000E0000 /* Rcv process state mask */ +#define CSR5_TPS_MSK 0x00700000 /* Xmit process state mask */ +#define CSR5_ERR_MSK 0x03800000 /* error mask */ + +/* CSR6 Operation Mode Register */ + +#define CSR6_2114X_SC 0x80000000 /* special capture effect enable */ +#define CSR6_2114X_RA 0x40000000 /* receive all */ +#define CSR6_2114X_MB1 0x02000000 /* must be 1 */ +#define CSR6_2114X_SCR 0x01000000 /* scrambler mode */ +#define CSR6_2114X_PCS 0x00800000 /* PCS function */ +#define CSR6_2114X_TTM 0x00400000 /* tx threshold mode */ +#define CSR6_2114X_SF 0x00200000 /* store and forward */ +#define CSR6_2114X_HBD 0x00080000 /* heartbeat disable */ +#define CSR6_2114X_PS 0x00040000 /* port select */ +#define CSR6_CAE 0x00020000 /* capture effect enable */ +#define CSR6_21040_BP 0x00010000 /* back pressure - 21040 */ +#define CSR6_THR_072 0x00000000 /* threshold bytes 72 */ +#define CSR6_THR_096 0x00004000 /* threshold bytes 96 */ +#define CSR6_THR_128 0x00008000 /* threshold bytes 128 */ +#define CSR6_THR_160 0x0000C000 /* threshold bytes 160 */ +#define CSR6_ST 0x00002000 /* start/stop Xmit command */ +#define CSR6_FC 0x00001000 /* Force collision mode */ +#define CSR6_OM_EXT 0x00000800 /* external loopback mode */ +#define CSR6_OM_INT 0x00000400 /* internal loopback mode */ +#define CSR6_OM_NOR 0x00000000 /* normal mode */ +#define CSR6_FD 0x00000200 /* Full Duplex mode */ +#define CSR6_21040_FKD 0x00000100 /* Flaky oscillator disable - 21040 */ +#define CSR6_PM 0x00000080 /* Pass all multicast */ +#define CSR6_PR 0x00000040 /* promiscuous mode */ +#define CSR6_SB 0x00000020 /* Start/Stop Back off counter */ +#define CSR6_IF 0x00000010 /* inverse filtering [RO] */ +#define CSR6_PB 0x00000008 /* pass bad frames */ +#define CSR6_HO 0x00000004 /* hash only filter mode [RO] */ +#define CSR6_SR 0x00000002 /* start/stop receive command */ +#define CSR6_HP 0x00000001 /* hash/perfect filter mode [RO] */ + +/* CSR7 Interrupt Mask register */ + +#define CSR7_21143_LCM 0x08000000 /* link changed mask - 21143 */ +#define CSR7_21143_GPM 0x04000000 /* general purpose port mask - 21143 */ +#define CSR7_NIM 0x00010000 /* normal interrupt mask */ +#define CSR7_AIM 0x00008000 /* abnormal interrupt mask */ +#define CSR7_21143_ERM 0x00004000 /* early receive mask - 21143 */ +#define CSR7_SEM 0x00002000 /* system error mask */ +#define CSR7_21X4X_LFM 0x00001000 /* link fail mask */ +#define CSR7_21040_FDM 0x00000800 /* full duplex mask - 21040 */ +#define CSR7_2114X_TMR 0x00000800 /* gp timer mask */ +#define CSR7_21040_ATM 0x00000400 /* aui/tp switch mask - 21040 */ +#define CSR7_2114X_ETM 0x00000400 /* early trasmit mask */ +#define CSR7_RWM 0x00000200 /* rcv watchdog time-out mask */ +#define CSR7_RSM 0x00000100 /* rcv stopped mask */ +#define CSR7_RUM 0x00000080 /* rcv buff unavailable mask */ +#define CSR7_RIM 0x00000040 /* rcv interrupt mask */ +#define CSR7_UNM 0x00000020 /* underflow interrupt mask */ +#define CSR7_21143_LPE 0x00000010 /* link pass - 21143 */ +#define CSR7_TJM 0x00000008 /* xmit jabber timer out mask */ +#define CSR7_TUM 0x00000004 /* xmit buff unavailable mask */ +#define CSR7_TSM 0x00000002 /* xmission stopped mask */ +#define CSR7_TIM 0x00000001 /* xmit interrupt mask */ + +/* CSR8 Missing Frame Counter */ + +#define CSR8_2114X_OFO 0x10000000 /* overflow counter overflow */ +#define CSR8_2114X_OFC_MSK 0x0FFE0000 /* overflow counter */ +#define CSR8_MFO 0x00010000 /* missed frame overflow */ +#define CSR8_MFC_MSK 0x0000FFFF /* Missed frame counter mask */ + +/* CSR9 Ethernet Address ROM Register */ + +#define CSR9_2114X_MDI 0x00080000 /* MII mgmt data in */ +#define CSR9_2114X_MII 0x00040000 /* MII mgmt op mode */ +#define CSR9_2114X_MDO 0x00020000 /* MII mgmt write data */ +#define CSR9_2114X_MDC 0x00010000 /* MII mgmt clock */ +#define CSR9_2114X_RD 0x00004000 /* Serial ROM Read */ +#define CSR9_2114X_WR 0x00002000 /* Serial ROM Write */ +#define CSR9_2114X_BR 0x00001000 /* boot rom select */ +#define CSR9_2114X_SR 0x00000800 /* serial rom select */ +#define CSR9_2114X_REG 0x00000400 /* external register select */ + +#define CSR9_21040_DNV 0x80000000 /* Data not valid */ +#define CSR9_DAT_MSK 0x000000FF /* data mask */ + +#define ENET_ROM_SIZE 8 /* ethernet rom register size */ + +/* CSR10 Reserved */ + +/* CSR11 Full Duplex Register */ + +#define CSR11_FDACV_MSK 0x0000FFFF /* full duplex auto config mask */ + +/* CSR12 SIA status Register - 21040 */ + +#define CSR12_21040_DA0 0x00000080 /* Diagnostic bit all One */ +#define CSR12_21040_DAZ 0x00000040 /* Diagnostic bit all zero */ +#define CSR12_21040_DSP 0x00000020 /* Diagnostic BIST status indicator */ +#define CSR12_21040_DSD 0x00000010 /* Diagnostic Self test done */ +#define CSR12_21040_APS 0x00000008 /* Auto polarity state */ +#define CSR12_21040_LKF 0x00000004 /* link fail status */ +#define CSR12_21040_NCR 0x00000002 /* network connection error */ +#define CSR12_21040_PAUI 0x00000001 /* pin AUI_TP indication */ + +/* CSR12 General Purpose Register - 21140 */ + +#define CSR12_21140_GPC 0x00000100 /* General purpose control */ +#define CSR12_21140_MD 0x000000ff /* General purpose mode/data */ + +/* CSR12 SIA status Register */ + +#define CSR12_21143_LPN 0x00008000 /* link partern negotiable */ +#define CSR12_21143_LCK 0x00006000 /* link check */ +#define CSR12_21143_FLP 0x00005000 /* FLP link good */ +#define CSR12_21143_CAK 0x00004000 /* complete acknowledge */ +#define CSR12_21143_AKD 0x00003000 /* acknowledge detect */ +#define CSR12_21143_ADT 0x00002000 /* ability detect */ +#define CSR12_21143_TRD 0x00001000 /* Transmit disable */ +#define CSR12_21143_DIS 0x00000000 /* autonegotiation disable */ +#define CSR12_21143_TRF 0x00000800 /* transmit remote fault */ +#define CSR12_21143_NSN 0x00000400 /* non stable NLPs detected */ +#define CSR12_21143_TRA 0x00000200 /* 10Base-T receive port activity */ +#define CSR12_21143_ARA 0x00000100 /* AUI receive port activity */ +#define CSR12_21143_APS 0x00000008 /* Auto polarity state */ +#define CSR12_21143_10 0x00000004 /* 10 Mb/s link status */ +#define CSR12_21143_100 0x00000002 /* 100 Mb/s link status */ +#define CSR12_21143_MRA 0x00000001 /* MII receive port activity */ + +/* CSR13 SIA connectivity Register */ + +#define CSR13_OE57 0x00008000 /* Output enable 5 6 7 */ +#define CSR13_OE24 0x00004000 /* output enable 2 4 */ +#define CSR13_OE13 0x00002000 /* output enable 1 3 */ +#define CSR13_IE 0x00001000 /* input enable */ +#define CSR13_SEL_LED 0x00000f00 /* select LED and external driver */ +#define CSR13_ASE_APLL 0x00000080 /* ase apll start enable */ +#define CSR13_SIM 0x00000040 /* serial iface input multiplexer */ +#define CSR13_ENI 0x00000020 /* encoder Input multiplexer */ +#define CSR13_EDP_SIA 0x00000010 /* pll external input enable */ +#define CSR13_AUI_TP 0x00000008 /* AUI - 10BASE-T or AUI */ +#define CSR13_CAC_CSR 0x00000004 /* auto config register */ +#define CSR13_PS 0x00000002 /* pin AUI_TP select */ +#define CSR13_SRL_SIA 0x00000001 /* srl sia Reset */ + +/* CSR14 SIA xmit rcv Register */ + +#define CSR14_21143_T4 0x00040000 /* 1000Base-T4 -21143 */ +#define CSR14_21143_TXF 0x00020000 /* 100Base-TX full duplex -21143 */ +#define CSR14_21143_TXH 0x00010000 /* 100Base-TX half duplex -21143 */ +#define CSR14_21143_TAS 0x00008000 /* 10Base-T/AUI autosensing -21143 */ +#define CSR14_SPP 0x00004000 /* set polarity plus */ +#define CSR14_APE 0x00002000 /* auto polarity enable */ +#define CSR14_LTE 0x00001000 /* link test enable */ +#define CSR14_SQE 0x00000800 /* signal quality generate enable */ +#define CSR14_CLD 0x00000400 /* collision detect enable */ +#define CSR14_CSQ 0x00000200 /* collision squelch enable */ +#define CSR14_RSQ 0x00000100 /* receive squelch enable */ +#define CSR14_21143_ANE 0x00000080 /* autonegotiation enable */ +#define CSR14_21143_TH 0x00000040 /* 10Base-T half duplex enable */ +#define CSR14_CPEN_NC 0x00000030 /* no compensation */ +#define CSR14_CPEN_HP 0x00000020 /* high power mode */ +#define CSR14_CPEN_DM 0x00000010 /* disable mode */ +#define CSR14_LSE 0x00000008 /* link pulse send enable */ +#define CSR14_DREN 0x00000004 /* driver enable */ +#define CSR14_LBK 0x00000002 /* loopback enable */ +#define CSR14_ECEN 0x00000001 /* encoder enable */ + +/* CSR15 SIA general register */ + +#define CSR15_21143_RMI 0x40000000 /* receive match interrupt */ +#define CSR15_21143_GI1 0x20000000 /* general port interrupt 1 */ +#define CSR15_21143_GI0 0x10000000 /* general port interrupt 0 */ +#define CSR15_21143_CWE 0x08000000 /* control write enable */ +#define CSR15_21143_RME 0x04000000 /* receive match enable */ +#define CSR15_21143_GE1 0x02000000 /* GEP interrupt enable on port 1 */ +#define CSR15_21143_GE0 0x01000000 /* GEP interrupt enable on port 0 */ +#define CSR15_21143_LG3 0x00800000 /* LED/GEP3 select */ +#define CSR15_21143_LG2 0x00400000 /* LED/GEP2 select */ +#define CSR15_21143_LG1 0x00200000 /* LED/GEP1 select */ +#define CSR15_21143_LG0 0x00100000 /* LED/GEP0 select */ +#define CSR15_21143_RWR 0x00000020 /* receive watchdog release */ +#define CSR15_21143_RWD 0x00000010 /* receive watchdog disable */ +#define CSR15_21143_ABM 0x00000008 /* AUI/BNC mode */ +#define CSR15_JCK 0x00000004 /* jabber clock */ +#define CSR15_HUJ 0x00000002 /* host unjab */ +#define CSR15_JBD 0x00000001 /* jabber disable */ + +#define CSR15_MD_MSK 0x000F0000 /* general purpose mode mask */ +#define CSR15_MODE_10 0x00050000 + +#define CSR15_MD_VAL(x) (((x) << 16) & CSR15_MD_MSK) + +/* receive descriptor */ + +/* receive descriptor 0 */ + +#define RDESC0_OWN 0x80000000 /* Own */ +#define RDESC0_FF 0x40000000 /* filtering fail */ +#define RDESC0_ES 0x00008000 /* Error summary */ +#define RDESC0_LE 0x00004000 +#define RDESC0_DT_SRF 0x00000000 /* serial rcvd frame */ +#define RDESC0_DT_ILF 0x00001000 /* internal loop back frame */ +#define RDESC0_DT_ELF 0x00002000 /* external loop back frame */ +#define RDESC0_RF 0x00000800 /* runt frame */ +#define RDESC0_MF 0x00000400 /* multicast frame */ +#define RDESC0_FD 0x00000200 /* first descriptor */ +#define RDESC0_LS 0x00000100 /* last descriptor */ +#define RDESC0_TL 0x00000080 /* frame too long */ +#define RDESC0_CS 0x00000040 /* collision seen */ +#define RDESC0_FT 0x00000020 /* frame type */ +#define RDESC0_RJ 0x00000010 /* receive watch dog */ +#define RDESC0_RE 0x00000008 /* report on MII error */ +#define RDESC0_DB 0x00000004 /* dribbling bit */ +#define RDESC0_CE 0x00000002 /* crc error */ +#define RDESC0_OF 0x00000001 /* Over flow */ + +#define DEC_FRAME_LEN_MSK 0x3FFF0000 /* Frame length mask */ +#define DEC_FRAME_LEN_GET(x) (((x) & DEC_FRAME_LEN_MSK) >> 16) +#define DEC_FRAME_LEN_SET(x) (((x) << 16) & DEC_FRAME_LEN_MSK) + +/* receive descriptor 1 */ + +#define RDESC1_RER 0x02000000 /* recv end of ring */ +#define RDESC1_RCH 0x01000000 /* second address chained */ + +#define RDESC1_RBS2_MSK 0x003FF800 /* RBS2 buffer 2 size */ +#define RDESC1_RBS1_MSK 0x000007FF /* RBS1 buffer 1 size */ + +#define RDESC1_RBS1_VAL(x) ((x) & RDESC1_RBS1_MSK) /* multiple of 4 */ +#define RDESC1_RBS2_VAL(x) (((x) << 11) & RDESC1_RBS2_MSK) + +/* transmit descriptor */ + +/* xmit descriptor 0 */ + +#define TDESC0_OWN 0x80000000 /* own */ +#define TDESC0_ES 0x00008000 /* error summary */ +#define TDESC0_TO 0x00004000 /* xmit jabber time out */ +#define TDESC0_LO 0x00000800 /* loss of carrier */ +#define TDESC0_NC 0x00000400 /* NC No carrier */ +#define TDESC0_LC 0x00000200 /* late collision */ +#define TDESC0_EC 0x00000100 /* excessive collision */ +#define TDESC0_HF 0x00000080 /* heart beat fail */ +#define TDESC0_LF 0x00000004 /* link fail */ +#define TDESC0_UF 0x00000002 /* underflow error */ +#define TDESC0_DE 0x00000001 /* deffered */ + +#define TDESC0_CC_MSK 0x00000078 +#define TDESC0_CC_VAL(X) (((X) & TDESC0_CC_MSK) >> 3) + +/* xmit descriptor 1 */ + +#define TDESC1_IC 0x80000000 /* interrupt on completion */ +#define TDESC1_LS 0x40000000 /* last segment */ +#define TDESC1_FS 0x20000000 /* first segment */ +#define TDESC1_FT1 0x10000000 /* filtering type */ +#define TDESC1_SET 0x08000000 /* setup packet */ +#define TDESC1_AC 0x04000000 /* add crc disable */ +#define TDESC1_TER 0x02000000 /* xmit end of ring */ +#define TDESC1_TCH 0x01000000 /* second address chained */ +#define TDESC1_DPD 0x00800000 /* disabled padding */ +#define TDESC1_FT0 0x00400000 /* filtering type */ + +#define TDESC1_TBS2_MSK 0x003FF800 /* TBS2 buffer 2 size */ +#define TDESC1_TBS1_MSK 0x000007FF /* TBS2 buffer 1 size */ + +#define TDESC1_TBS1_PUT(x) ((x) & TDESC1_TBS1_MSK) /* multiple of 4 */ +#define TDESC1_TBS2_PUT(x) (((x) << 11) & TDESC1_TBS2_MSK) + +#define FLTR_FRM_SIZE 0xC0 /* filter frm size 192 bytes */ +#define FLTR_FRM_SIZE_ULONGS (FLTR_FRM_SIZE / sizeof (ULONG)) +#define FLTR_FRM_ADRS_NUM 0x10 /* filter frm holds 16 addrs */ +#define FLTR_FRM_ADRS_SIZE 0x06 /* size of each phys addrs */ +#define FLTR_FRM_DEF_ADRS 0xFFFFFFFF /* enet broad cast address */ +#define FLTR_FRM_PHY_ADRS_OFF 156 /* word - 39 */ + +#define DEC_CRC_POLY 0x04c11db6 /* for CRC computation */ +#define DEC_FLT_INDEX(I) ((((I) & ~0x1) * 2) + ((I) & 0x1)) + +/* MII Defines */ + +#define MII_MGMT_WR_OFF 17 +#define MII_MGMT_WR ((ULONG) 0x00020000) +#define MII_WRITE ((ULONG) 0x00002000) +#define MII_READ ((ULONG) 0x00044000) +#define MII_MGMT_CLOCK ((ULONG) 0x00010000) +#define MII_READ_FRM ((ULONG) 0x60000000) +#define MII_PHY_CTRL_RES ((USHORT) 0x007F) +#define MII_PHY_STAT_RES ((USHORT) 0x07C0) +#define MII_PHY_NWAY_RES ((USHORT) 0x1C00) +#define MII_PHY_NWAY_EXP_RES ((USHORT) 0xFFE0) +#define MII_MGMT_DATA_IN ((ULONG) 0x00080000) +#define MII_READ_DATA_MSK MII_MGMT_DATA_IN + +/* DEC Serial ROM */ + +#define DEC2114X_SROM_SIZE 128 +#define DEC2114X_SROM_WORDS 64 +#define DEC2114X_SROM_VERSION_3 0x3 + +/* Serial ROM access macros */ + +#define SROM_VERSION(pSrom) (UCHAR) *(pSrom+0x12) +#define SROM_ILEAF0_OFFSET(pSrom) SROM_SHORT (pSrom+0x1b) + +/* Serial ROM Info Leaf - 21140 */ + +#define ILEAF_21140_GPR_MODE(pILeaf) (UCHAR) *(pILeaf+2) +#define ILEAF_21140_MEDIA_COUNT(pILeaf) (UCHAR) *(pILeaf+3) +#define ILEAF_21140_INFO_BLK0(pILeaf) (UCHAR *) (pILeaf+4) + +/* Serial ROM Info Leaf - 21143 */ + +#define ILEAF_21143_MEDIA_COUNT(pILeaf) (UCHAR) *(pILeaf+2) +#define ILEAF_21143_INFO_BLK0(pILeaf) (UCHAR *) (pILeaf+3) + +/* Serial ROM Info Block */ + +#define IBLK_COMPACT_SIZE 4 +#define IBLK_IS_COMPACT(pIBlk) ((*(pIBlk) & 0x80) == 0x00) +#define IBLK_IS_EXT(pIBlk) ((*(pIBlk) & 0x80) == 0x80) +#define IBLK_IS_EXT0(pIBlk) \ + (IBLK_IS_EXT(pIBlk) && (IBLK_EXT_TYPE(pIBlk) == 0x00)) + +#define IBLK_IS_EXT1(pIBlk) \ + (IBLK_IS_EXT(pIBlk) && (IBLK_EXT_TYPE(pIBlk) == 0x01)) + +#define IBLK_EXT_SIZE(pIBlk) (UCHAR) (*(pIBlk+0) & 0x7F) +#define IBLK_EXT_TYPE(pIBlk) (UCHAR) *(pIBlk+1) + +#define IBLK_IS_EXT2 0x02 /* Block type 2 */ +#define IBLK_IS_EXT3 0x03 /* Block type 3 */ +#define IBLK_IS_EXT4 0x04 /* Block type 4 */ +#define IBLK_IS_EXT5 0x05 /* Block type 5 */ + +/* Extended format - Block type 0 & 1 - 21140 */ + +#define IBLK_COMPACT_MCODE(pIBlk) (UCHAR) (*pIBlk & 0x7F) +#define IBLK_COMPACT_GPDATA(pIBlk) (UCHAR) *(pIBlk+1) +#define IBLK_COMPACT_CMD(pIBlk) SROM_SHORT(pIBlk+2) + +#define IBLK_EXT0_TO_COMPACT(pIBlk) (UCHAR *)(pIBlk+2) +#define IBLK_EXT1_PHY(pIBlk) (UCHAR) *(pIBlk+2) +#define IBLK_EXT1_INIT_LEN(pIBlk) (UCHAR) *(pIBlk+3) +#define IBLK_EXT1_INIT_STR(pIBlk) (UCHAR *)(pIBlk+4) +#define IBLK_EXT1_RESET_LEN(pIBlk) \ + (UCHAR) *(IBLK_EXT1_INIT_STR(pIBlk) + IBLK_EXT1_INIT_LEN(pIBlk)) +#define IBLK_EXT1_RESET_STR(pIBlk) \ + (UCHAR *) (IBLK_EXT1_INIT_STR(pIBlk) + IBLK_EXT1_INIT_LEN(pIBlk) + 1) +#define IBLK_EXT1_MEDIA_CAP(pIBlk) \ + SROM_SHORT( IBLK_EXT1_RESET_STR(pIBlk) + IBLK_EXT1_RESET_LEN(pIBlk)) +#define IBLK_EXT1_AUTO_AD(pIBlk) \ + SROM_SHORT( IBLK_EXT1_RESET_STR(pIBlk) + IBLK_EXT1_RESET_LEN(pIBlk) + 2) +#define IBLK_EXT1_FD_MAP(pIBlk) \ + SROM_SHORT( IBLK_EXT1_RESET_STR(pIBlk) + IBLK_EXT1_RESET_LEN(pIBlk) + 4) +#define IBLK_EXT1_TTM_MAP(pIBlk) \ + SROM_SHORT( IBLK_EXT1_RESET_STR(pIBlk) + IBLK_EXT1_RESET_LEN(pIBlk) + 6) + +/* Extended format - Block type 2, 3, 4 & 5 - 21143 */ + +#define IBLK_EXT2_MCODE(pIBlk) (UCHAR) (*(pIBlk + 2) & 0x3F) +#define IBLK_EXT2_EXT(pIBlk) (UCHAR) ((*(pIBlk + 2) & 0x40) >> 6) +#define IBLK_EXT2_MSD_CSR13(pIBlk) SROM_SHORT(pIBlk + 3) +#define IBLK_EXT2_MSD_CSR14(pIBlk) SROM_SHORT(pIBlk + 5) +#define IBLK_EXT2_MSD_CSR15(pIBlk) SROM_SHORT(pIBlk + 7) +#define IBLK_EXT2_GPC(pIBlk) \ + SROM_SHORT( pIBlk + 3 + ((((UCHAR) *pIBlk) & 0x7F) - 0x6)) +#define IBLK_EXT2_GPD(pIBlk) \ + SROM_SHORT( pIBlk + 5 + ((((UCHAR) *pIBlk) & 0x7F) - 0x6)) + +#define IBLK_EXT3_PHY(pIBlk) (UCHAR) *(pIBlk+2) +#define IBLK_EXT3_INIT_LEN(pIBlk) (UCHAR) *(pIBlk+3) +#define IBLK_EXT3_INIT_STR(pIBlk) (UCHAR *)(pIBlk+4) +#define IBLK_EXT3_RESET_LEN(pIBlk) \ + (UCHAR) *(IBLK_EXT3_INIT_STR(pIBlk) + IBLK_EXT3_INIT_LEN(pIBlk)) +#define IBLK_EXT3_RESET_STR(pIBlk) \ + (UCHAR *) (IBLK_EXT3_INIT_STR(pIBlk) + IBLK_EXT3_INIT_LEN(pIBlk) + 1) +#define IBLK_EXT3_MEDIA_CAP(pIBlk) \ + SROM_SHORT( IBLK_EXT3_RESET_STR(pIBlk) + IBLK_EXT3_RESET_LEN(pIBlk)) +#define IBLK_EXT3_AUTO_AD(pIBlk) \ + SROM_SHORT( IBLK_EXT3_RESET_STR(pIBlk) + IBLK_EXT3_RESET_LEN(pIBlk) + 2) +#define IBLK_EXT3_FD_MAP(pIBlk) \ + SROM_SHORT( IBLK_EXT3_RESET_STR(pIBlk) + IBLK_EXT3_RESET_LEN(pIBlk) + 4) +#define IBLK_EXT3_TTM_MAP(pIBlk) \ + SROM_SHORT( IBLK_EXT3_RESET_STR(pIBlk) + IBLK_EXT3_RESET_LEN(pIBlk) + 6) +#define IBLK_EXT3_MII_CI(pIBlk) \ + SROM_SHORT( IBLK_EXT3_RESET_STR(pIBlk) + IBLK_EXT3_RESET_LEN(pIBlk) + 8) + +#define IBLK_EXT4_MCODE(pIBlk) (UCHAR) (*(pIBlk + 2) & 0x3F) +#define IBLK_EXT4_GPC(pIBlk) SROM_SHORT(pIBlk + 3 ) +#define IBLK_EXT4_GPD(pIBlk) SROM_SHORT(pIBlk + 5 ) +#define IBLK_EXT4_CMD(pIBlk) SROM_SHORT(pIBlk + 7 ) +#define IBLK_EXT4_CMD_PS 0x0001 +#define IBLK_EXT4_CMD_TTM 0x0010 +#define IBLK_EXT4_CMD_PCS 0x0020 +#define IBLK_EXT4_CMD_SCR 0x0040 + +#define IBLK_EXT5_RESET_LEN(pIBlk) (UCHAR) *(pIBlk+2) + +/* Serial ROM Compact Info Block, command field */ +#define COMPACT_CMD_ACT_INV 0x8000 /* Active Invalid */ +#define COMPACT_CMD_MED_DEF 0x4000 /* Default Media */ +#define COMPACT_CMD_POLARITY 0x0080 /* Media bit polarity */ +#define COMPACT_CMD_SCR 0x0040 /* Scrambler mode */ +#define COMPACT_CMD_PCS 0x0030 /* PCS Function */ +#define COMPACT_CMD_MED_SENSE 0x000E /* Media Sense */ +#define COMPACT_CMD_PS 0x0001 /* Port Select */ + +/* Serial ROM EXT1 Info Block, valid media types */ + +#define EXT1_MEDIA_100BT4 0x0200 +#define EXT1_MEDIA_100BTX_FD 0x0100 +#define EXT1_MEDIA_100BTX 0x0080 +#define EXT1_MEDIA_10BT_FD 0x0040 +#define EXT1_MEDIA_10BT 0x0020 +#define EXT1_MEDIA_CAP_MSK 0x03E0 + +typedef struct free_buf + { + void * pClBuf; /* pointer cluster buffer */ + } FREE_BUF; + +/* The dec21x4xEnd driver control structure */ + +typedef struct dec21x4x_drv_ctrl + { + END_OBJ endObj; /* base class */ + int flags; /* driver flags */ + + int unit; /* unit number */ + ULONG devAdrs; /* IO base address */ + int ivec; /* interrupt vector */ + int ilevel; /* interrupt level */ + char * memBase; /* descriptor mempool base addr */ + ULONG memSize; /* descriptor mempool size */ + ULONG pciMemBase; /* memory base on PCI adr space */ + ULONG usrFlags; /* user configuration flags */ + int offset; /* offset for unalignment pb */ + + int numRds; /* RD ring size */ + int rxIndex; /* index into RD ring */ + DEC_RD * rxRing; /* RD ring */ + + int numTds; /* TD ring size */ + int txIndex; /* index into TD ring */ + int txDiIndex; /* disposal index into TD ring */ + DEC_TD * txRing; /* TD ring */ + + UINT8 mediaCount; /* Number of PHY devices [RW] */ + UINT8 mediaDefault; /* Default PHY device [RW] */ + UINT8 mediaCurrent; /* Current PHY device [RW] */ + UINT8 gprModeVal; /* Mode bits for GP register [RW]*/ + + BOOL rxHandling; /* handling received packets */ + BOOL txCleaning; /* cleaning transmit queue */ + + CACHE_FUNCS cacheFuncs; /* cache function pointers */ + BOOL txBlocked; /* variable for blocking */ + FREE_BUF freeBuf[128]; /* Array of free arguments */ + CL_POOL_ID clPoolId; /* cluster pool pointer */ + } DEC21X4X_DRV_CTRL; + +IMPORT FUNCPTR _func_dec21x4xMediaSelect; + +#define DRV_NAME "dc" +#define DRV_NAME_LEN 3 +#define EADDR_LEN 6 +#define ETH_CRC_LEN 4 +#define DEC_BUFSIZ (ETHERMTU + ENET_HDR_REAL_SIZ + EADDR_LEN) + +/* DRV_CTRL flags */ + +#define DEC_MEMOWN 0x0001 /* TDs and RDs allocated by driver */ +#define DEC_TX_KICKSTART 0x0002 /* No transmit poll */ +#define DEC_POLLING 0x0004 /* Poll mode, io mode */ +#define DEC_PROMISC 0x0008 /* Promiscuous, rx mode */ +#define DEC_MCAST 0x0010 /* Multicast, rx mode */ +#define DEC_BSP_EADRS 0x0020 /* Use BSP routine to get ether addr */ +#define DEC_21143 0x2000 /* DEC21143 device type */ +#define DEC_21140 0x4000 /* DEC21140 device type */ +#define DEC_21040 0x8000 /* DEC21040 device type */ + +/* + * User options + * + * These options may be set in the userFlags field of the dec21x4xEnd driver + * load string. The driver, at initialization, will set up apt registers to + * reflect the selected options. + */ + +#define DEC_USR_BAR_RX 0x00001000 /* CSR0: Rx has priority over Tx */ +#define DEC_USR_BE 0x00000001 /* CSR0: Big Endian */ + +#define DEC_USR_TAP_02 0x00000002 /* CSR0: Tx poll every 200 usec */ +#define DEC_USR_TAP_08 0x00000004 /* CSR0: Tx poll every 800 usec */ +#define DEC_USR_TAP_16 0x00000006 /* CSR0: Tx poll every 1.6 msec */ +#define DEC_USR_TAP_012 0x00000008 /* CSR0: Tx poll every 12.8 usec */ +#define DEC_USR_TAP_025 0x0000000A /* CSR0: Tx poll every 25.6 usec */ +#define DEC_USR_TAP_051 0x0000000C /* CSR0: Tx poll every 51.2 usec */ +#define DEC_USR_TAP_102 0x0000000E /* CSR0: Tx poll every 102.4 usec */ + +#define DEC_USR_TAP_MSK 0x0000000E +#define DEC_USR_TAP_SHF 16 + +#define DEC_USR_CAL_08 0x00000010 /* CSR0: Cache adrs aligned 8 lwords */ +#define DEC_USR_CAL_16 0x00000020 /* CSR0: Cache adrs aligned 16 lwords */ +#define DEC_USR_CAL_32 0x00000030 /* CSR0: Cache adrs aligned 32 lwords */ +#define DEC_USR_CAL_MSK 0x00000030 +#define DEC_USR_CAL_SHF 10 + +#define DEC_USR_PBL_01 0x00000040 /* CSR0: DMA burst len 1 lword */ +#define DEC_USR_PBL_02 0x00000080 /* CSR0: DMA burst len 2 lwords */ +#define DEC_USR_PBL_04 0x00000100 /* CSR0: DMA burst len 4 lwords */ +#define DEC_USR_PBL_08 0x00000200 /* CSR0: DMA burst len 8 lwords */ +#define DEC_USR_PBL_16 0x00000400 /* CSR0: DMA burst len 16 lwords */ +#define DEC_USR_PBL_32 0x00000800 /* CSR0: DMA burst len 32 lwords */ +#define DEC_USR_PBL_MSK 0x00000FC0 +#define DEC_USR_PBL_SHF 2 + +#define DEC_USR_RML 0x00002000 /* CSR0: PCI memory-read-multiple */ +#define DEC_USR_XEA 0x00004000 /* Use sysDec21x4xEnetAddrGet() */ +#define DEC_USR_SF 0x00008000 /* Enable store&forward CSR6:21 */ + +#define DEC_USR_THR_072 0x00000000 /* Use TxTheshold 72/128 bytes */ +#define DEC_USR_THR_096 0x00010000 /* Use TxTheshold 96/256 bytes */ +#define DEC_USR_THR_128 0x00020000 /* Use TxTheshold 128/512 bytes */ +#define DEC_USR_THR_160 0x00030000 /* Use TxTheshold 160/1024 bytes */ +#define DEC_USR_THR_MSK 0x00030000 +#define DEC_USR_THR_SHF 2 + +#define DEC_USR_SB 0x00040000 /* Enable backoff counter CSR6:5 */ +#define DEC_USR_PB 0x00080000 /* Enable pass bad frame CSR6:3 */ +#define DEC_USR_SC 0x00100000 /* Enable spl capture effect CSR6:31 */ +#define DEC_USR_CA 0x00200000 /* Enable capture effect CSR6:17 */ +#define DEC_USR_21143 0x40000000 /* DEC 21143 part */ +#define DEC_USR_21140 0x80000000 /* DEC 21140 part */ +#define DEC_USR_VER_MSK 0xC0000000 /* DEC version mask */ +#define DEC_USR_FD 0x00400000 /* enable Full Duplex mode CSR6:9 */ + +#define DEC_USR_CSR6_MSK \ + (CSR6_2114X_PS | CSR6_2114X_PCS | CSR6_2114X_SCR | CSR6_2114X_TTM | CSR6_FD) + +/* Device specific network configuration defined in configNet.h */ + +IMPORT M_CL_CONFIG dec21x4xMBlkConfig; /* mblk config description */ +IMPORT CL_DESC dec21x4xClDescTbl[]; /* cluster pool config table */ +IMPORT int dec21x4xClDescTblEnt; + +IMPORT FUNCPTR _func_dec2114xMediaSelect; /* specfic media routine */ +IMPORT VOIDFUNCPTR _func_dec2114xIntAck; /* specfic int. ack. routine */ +IMPORT END_OBJ * dec214x4DrvLoad (char * initStr); /* create device */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_dec21x4xEndh */ diff --git a/h/drv/end/ei82596End.h b/h/drv/end/ei82596End.h new file mode 100644 index 0000000..3ad6cc5 --- /dev/null +++ b/h/drv/end/ei82596End.h @@ -0,0 +1,325 @@ +/* ei82596End.h - Intel 82596 network interface header */ + +/* Copyright 1990-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01c,13jan99,mem changed pNext pointers to type EI_LINK. (SPR 24440) +01b,07apr97,map removed refCnt; renamed actualCnt to count in RFD struct. +01a,15sep96,map created from ../netif/if_ei.h +*/ + +#ifndef __INCei82596Endh +#define __INCei82596Endh + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* constants needed within this file */ + +#define EH_SIZE 14 /* avoid structure padding issues */ +#define N_MCAST 12 + + +/* Intel 82596 endian safe link macros and structure definitions */ + +#define LINK_WR(pLink,value) \ + (((pLink)->lsw = (UINT16)((UINT32)(value) & 0x0000ffff)), \ + ((pLink)->msw = (UINT16)(((UINT32)(value) >> 16) & 0x0000ffff))) + +#define LINK_RD(pLink) ((pLink)->lsw | ((pLink)->msw << 16)) + +#define STAT_RD LINK_RD /* statistic read is a link read */ +#define STAT_WR LINK_WR /* statistic write is a link write */ + +typedef struct ei_link /* EI_LINK - endian resolvable link */ + { + UINT16 lsw; /* least significant word */ + UINT16 msw; /* most significant word */ + } EI_LINK; + +typedef struct ei_node /* EI_NODE - common linked list object */ + { + UINT16 field1; + UINT16 field2; + EI_LINK lNext; /* link to next node */ + EI_LINK field4; + UINT16 field5; + UINT16 field6; + UINT8 field7 [EH_SIZE]; + char field8 [ETHERMTU]; + EI_LINK pNext; /* ptr to next node */ + } EI_NODE; + +typedef EI_LINK EI_STAT; /* EI_STAT - 82596 error statistic */ + + +/* Intel 82596 structure and bit mask definitions */ + +/* PORT commands */ + +#define PORT_RESET 0x0 +#define PORT_SELFTEST 0x1 +#define PORT_NEWSCP 0x2 +#define PORT_DUMP 0x3 + + +/* System Configuration Pointer and bit field defines */ + +typedef struct scp /* SCP - System Configuration Pointer */ + { + UINT16 scpRsv1; /* reserved */ + UINT16 scpSysbus; /* SYSBUS */ + UINT16 scpRsv2; /* reserved */ + UINT16 scpRsv3; /* reserved */ + EI_LINK pIscp; /* ISCP address */ + } SCP; + +#define SCP_MODE_82586 0x0000 /* operate in i82586 mode */ +#define SCP_MODE_SEGMENTED 0x0002 /* operate in i82596 segmented mode */ +#define SCP_MODE_LINEAR 0x0004 /* operate in i82596 linear mode */ +#define SCP_EXT_TRIGGER 0x0008 /* ext. trig. of Bus Throttle timers */ +#define SCP_LOCK_DISABLE 0x0010 /* lock function disabled */ +#define SCP_INT_LOW 0x0020 /* interrupt pin is active low */ +#define SCP_SYSBUS_BIT6 0x0040 /* reserved - bit 6 - *MUST BE ONE* */ +#define SCP_SYSBUS_BIT7 0x0080 /* reserved - bit 7 - *MUST BE ZERO* */ + + +/* Intermediate System Configuration Pointer */ + +typedef struct iscp /* ISCP - Intermediate System Config. Ptr. */ + { + volatile UINT16 iscpBusy; /* i82596 is being initialized */ + UINT16 iscpRsv1; /* reserved */ + EI_LINK pScb; /* SCB address */ + } ISCP; + + +/* System Control Block and bit field defines */ + +typedef struct scb /* SCB - System Control Block */ + { + volatile UINT16 scbStatus; /* Status Word */ + volatile UINT16 scbCommand; /* Command Word */ + EI_LINK pCB; /* command block address */ + EI_LINK pRF; /* receive frame area address */ + EI_STAT crcErr; /* CRC error count */ + EI_STAT allignErr; /* frames misaligned and CRC err cnt */ + EI_STAT noResErr; /* no resources error count */ + EI_STAT ovErr; /* overrun error count */ + EI_STAT cdErr; /* collision detected error count */ + EI_STAT frameErr; /* short frame error count */ + UINT16 tOff; /* T-off timer */ + UINT16 tOn; /* T-on timer */ + } SCB; + +#define SCB_S_RUIDLE 0x0000 /* RU is idle */ +#define SCB_S_BTTL 0x0008 /* Bus Throttle timers loaded */ +#define SCB_S_RUMASK 0x00f0 /* state mask */ +#define SCB_S_RUSUSP 0x0010 /* RU is suspended */ +#define SCB_S_RUNORSRC 0x0020 /* RU has no resources */ +#define SCB_S_RURSV1 0x0030 /* reserved */ +#define SCB_S_RUREADY 0x0040 /* RU is ready */ +#define SCB_S_RUNRBD 0x0080 /* RU has no more RBD's */ +#define SCB_S_RUNORSRCR 0x00a0 /* RU no more resources/no more RBD's */ +#define SCB_S_CUMASK 0x0f00 /* state mask */ +#define SCB_S_CUSUSP 0x0100 /* CU is suspended */ +#define SCB_S_CUACTIVE 0x0200 /* CU is active */ +#define SCB_S_CURSV1 0x0300 /* reserved */ +#define SCB_S_CURSV2 0x0400 /* reserved */ +#define SCB_S_CURSV3 0x0500 /* reserved */ +#define SCB_S_CURSV4 0x0600 /* reserved */ +#define SCB_S_CURSV5 0x0700 /* reserved */ +#define SCB_S_XMASK 0xf000 /* state mask */ +#define SCB_S_CUIDLE 0x0000 /* CU is idle */ +#define SCB_S_RNR 0x1000 /* RU left the ready state */ +#define SCB_S_CNA 0x2000 /* CU left the active state */ +#define SCB_S_FR 0x4000 /* RU finished receiveing a frame */ +#define SCB_S_CX 0x8000 /* CU finished a cmd with I bit set */ + +#define SCB_C_RUNOP 0x0000 /* NOP */ +#define SCB_C_RUSTART 0x0010 /* start reception of frames */ +#define SCB_C_RURESUME 0x0020 /* resume reception of frames */ +#define SCB_C_RUSUSPEND 0x0030 /* suspend reception of frames */ +#define SCB_C_RUABORT 0x0040 /* abort receiver immediately */ +#define SCB_C_RURSV1 0x0050 /* reserved */ +#define SCB_C_RURSV2 0x0060 /* reserved */ +#define SCB_C_RURSV3 0x0070 /* reserved */ +#define SCB_C_RESET 0x0080 /* reset chip */ +#define SCB_C_CUNOP 0x0000 /* NOP */ +#define SCB_C_CUSTART 0x0100 /* start execution */ +#define SCB_C_CURESUME 0x0200 /* resume execution */ +#define SCB_C_CUSUSPEND 0x0300 /* suspend execution after cur. cmd */ +#define SCB_C_CUABORT 0x0400 /* abort current cmd immediately */ +#define SCB_C_CULOADBT 0x0500 /* load bus throttle timers after cnt */ +#define SCB_C_CULDBTIMM 0x0600 /* load bus throttle timers now */ +#define SCB_C_CURSV1 0x0700 /* reserved */ +#define SCB_C_ACK_RNR 0x1000 /* ACK that RU became not ready */ +#define SCB_C_ACK_CNA 0x2000 /* ACK that CU bacame not active */ +#define SCB_C_ACK_FR 0x4000 /* ACK that RU received a frame */ +#define SCB_C_ACK_CX 0x8000 /* ACK that CU completed an action */ + + +/* Action Command Descriptions */ + +typedef struct ac_iasetup /* AC_IASETUP - Individual Address Setup */ + { + UINT8 ciAddress[6]; /* local ethernet address */ + UINT16 ciFill; + } AC_IASETUP; + +typedef struct ac_config /* AC_CONFIG - i82596 Configure */ + { + UINT8 ccByte8; /* byte count, prefetched bit*/ + UINT8 ccByte9; /* FIFO limit, monitor bits */ + UINT8 ccByte10; /* save bad frames */ + UINT8 ccByte11; /* address length, loopback */ + UINT8 ccByte12; /* backoff method */ + UINT8 ccByte13; /* interframe spacing */ + UINT8 ccByte14; /* slot time -low byte */ + UINT8 ccByte15; /* slot time -upper 3 bits, max retry */ + UINT8 ccByte16; /* promiscuious mode, CRC, padding */ + UINT8 ccByte17; /* carrier sense, collision detect */ + UINT8 ccByte18; /* minimum frame length */ + UINT8 ccByte19; /* auto retransmit, multicast,... */ + UINT8 ccByte20; /* DCR slot num, full duplex */ + UINT8 ccByte21; /* disable backoff, ... */ + UINT16 ccFill; + } AC_CONFIG; + +typedef struct ac_mcast /* AC_MCAST - Mulitcast Setup */ + { + UINT16 cmMcCount; /* the number of bytes in MC list */ + UINT8 cmAddrList[6 * N_MCAST]; /* mulitcast address list */ + } AC_MCAST; + +typedef struct ac_tdr /* AC_TDR - Time Domain Reflectometry */ + { + UINT16 ctInfo; /* time, link OK, tx err, line err */ + UINT16 ctReserve1; /* reserved */ + } AC_TDR; + +typedef struct ac_dump /* AC_DUMP - Dump */ + { + EI_LINK bufAddr; /* address of dump buffer */ + } AC_DUMP; + + +/* Command Frame Description and defines */ + +typedef struct cfd /* CFD - Command Frame Descriptor */ + { + volatile UINT16 cfdStatus; /* command status */ + UINT16 cfdCommand; /* command */ + EI_LINK link; /* address of next CB */ + union /* command dependent section */ + { + struct ac_iasetup cfd_iasetup; /* IA setup */ + struct ac_config cfd_config; /* config */ + struct ac_mcast cfd_mcast; /* multicast setup */ + struct ac_tdr cfd_tdr; /* TDR */ + struct ac_dump cfd_dump; /* dump */ + } cfd_cmd; + } CFD; + +#define cfdIASetup cfd_cmd.cfd_iasetup +#define cfdConfig cfd_cmd.cfd_config +#define cfdMcast cfd_cmd.cfd_mcast +#define cfdTDR cfd_cmd.cfd_tdr +#define cfdDump cfd_cmd.cfd_dump + +#define CFD_C_NOP 0x0000 /* No Operation */ +#define CFD_C_IASETUP 0x0001 /* Individual Address Setup */ +#define CFD_C_CONFIG 0x0002 /* Configure Chip */ +#define CFD_C_MASETUP 0x0003 /* Multicast Setup */ +#define CFD_C_XMIT 0x0004 /* Transmit (see below too ...) */ +#define CFD_C_TDR 0x0005 /* Time Domain Reflectometry */ +#define CFD_C_DUMP 0x0006 /* Dump Registers */ +#define CFD_C_DIAG 0x0007 /* Diagnose */ +#define CFD_C_INT 0x2000 /* 596 interrupts CPU after execution */ +#define CFD_C_SE 0x4000 /* CU should suspend after execution */ +#define CFD_C_EL 0x8000 /* End of command list */ + +#define CFD_S_ABORTED 0x1000 /* Command was aborted via CU Abort */ +#define CFD_S_OK 0x2000 /* Command completed successfully */ +#define CFD_S_BUSY 0x4000 /* CU is executing this command */ +#define CFD_S_COMPLETE 0x8000 /* Command complete */ + + +/* 82596 Transmit/Receive Frames */ + +typedef struct tfd /* TFD - Transmit Frame Descriptor */ + { + volatile UINT16 status; /* status field */ + UINT16 command; /* command field */ + EI_LINK lNext; /* link to next desc. */ + EI_LINK lBufDesc; /* link to buf desc. */ + UINT16 count; /* length of data */ + UINT16 reserved; /* not used */ + UINT8 enetHdr [EH_SIZE]; /* ethernet header */ + char enetData [ETHERMTU]; /* transmit data */ + EI_LINK pNext; /* ptr to next desc. */ + } TFD; + +/* special TFD specific command block bit masks */ + +#define CFD_C_TX_FLEX 0x0008 /* Use Flexible Mode */ +#define CFD_C_TX_NOCRC 0x0010 /* Do not insert CRC */ + +#define CFD_S_COLL_MASK 0x000f /* to access number of collisions */ +#define CFD_S_RETRY 0x0020 /* reached the max number of retries */ +#define CFD_S_HBEAT 0x0040 /* Heartbeat Indicator */ +#define CFD_S_TRDEF 0x0080 /* Transmission Deferred */ +#define CFD_S_DMA_UNDR 0x0100 /* DMA Underrun (no data) */ +#define CFD_S_NO_CTS 0x0200 /* Lost Clear To Send signal */ +#define CFD_S_NO_CRS 0x0400 /* No Carrier Sense */ +#define CFD_S_LATE_COLL 0x0800 /* Late collision is detected */ + +#define TFD_CNT_EOF 0x8000 /* all data kept in TFD */ + + +typedef struct rfd /* RFD - Receive Frame Descriptor */ + { + volatile UINT16 status; /* status field */ + UINT16 command; /* command field */ + EI_LINK lNext; /* link to next desc. */ + EI_LINK lBufDesc; /* link to buf desc. */ + volatile UINT16 count; /* actual byte count */ + UINT16 bufSize; /* buffer size */ + UINT8 enetHdr [EH_SIZE]; /* the ethernet header */ + char enetData [ETHERMTU]; /* received data */ + EI_LINK pNext; /* ptr to next desc. */ + } RFD; + +/* RFD bit masks */ + +#define RFD_S_COLL 0x0001 /* collision during reception */ +#define RFD_S_EOP 0x0040 /* no EOP flag */ +#define RFD_S_MATCH 0x0080 /* dest Addr matched the IA address */ +#define RFD_S_DMA 0x0100 /* DMA Overrun failure to get bus */ +#define RFD_S_RSRC 0x0200 /* received, but ran out of buffers */ +#define RFD_S_ALGN 0x0400 /* received misaligned with CRC error */ +#define RFD_S_CRC 0x0800 /* received with CRC error */ +#define RFD_S_LEN 0x1000 /* received with length error */ +#define RFD_S_OK 0x2000 /* frame received successfully */ +#define RFD_S_BUSY 0x4000 /* frame reception ready/in progress */ +#define RFD_S_COMPLETE 0x8000 /* frame reception complete */ + +#define RFD_M_FLEXMODE 0x0008 /* flexible mode */ +#define RFD_M_SUSPEND 0x4000 /* suspend RU after receiving frame */ +#define RFD_M_EL 0x8000 /* end of RFD list */ + +#if CPU_FAMILY==I960 +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCei82596Endh */ diff --git a/h/drv/end/el3c90xEnd.h b/h/drv/end/el3c90xEnd.h new file mode 100644 index 0000000..665b861 --- /dev/null +++ b/h/drv/end/el3c90xEnd.h @@ -0,0 +1,1021 @@ +/* el3c90xEnd.h - 3Com EtherLink PCI XL END network interface header*/ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,11oct01,bur Added more 3Com chip device ids. +01a,11jan99,mtl written by teamF1 Inc. +*/ + +#ifndef __INCel3c90xEndh +#define __INCel3c90xEndh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#if FALSE +#define DRV_DEBUG /* temporary should be taken out */ +#endif + +#ifdef DRV_DEBUG +#include "logLib.h" +#define DRV_DEBUG_OFF 0x0000 +#define DRV_DEBUG_RX 0x0001 +#define DRV_DEBUG_TX 0x0002 +#define DRV_DEBUG_INT 0x0004 +#define DRV_DEBUG_POLL (DRV_DEBUG_POLL_RX | DRV_DEBUG_POLL_TX) +#define DRV_DEBUG_POLL_RX 0x0008 +#define DRV_DEBUG_POLL_TX 0x0010 +#define DRV_DEBUG_LOAD 0x0020 +#define DRV_DEBUG_LOAD2 0x0040 +#define DRV_DEBUG_IOCTL 0x0080 +#define DRV_DEBUG_RESET 0x0100 +#define DRV_DEBUG_MCAST 0x0200 +#define DRV_DEBUG_CSR 0x0400 +#define DRV_DEBUG_RX_PKT 0x0800 +#define DRV_DEBUG_POLL_REDIR 0x10000 +#define DRV_DEBUG_LOG_NVRAM 0x20000 +#define DRV_DEBUG_ALL 0xfffff +#endif /* DRV_DEBUG */ + + +/* configuration items */ + +#define EL3C90X_DEV_NAME "elPci" /* device name */ +#define EL3C90X_DEV_NAME_LEN 6 +#define EA_SIZE 6 /* one Ethernet address */ +#define EH_SIZE 14 /* ethernet header size */ +#define EL3C90X_BUFSIZ 1536 /* aligned packet size */ +#define EL_MIN_FBUF 4 /* Minsize of first buffer in chain */ +#define EL_UPD_CNT 16 /* number of upload descriptors */ +#define EL_DND_CNT 16 /* number of download descriptors */ + +/* Definitions for the drvCtrl specific flags field */ + +#define EL_MEM_ALLOC_FLAG 0x01 /* allocating memory flag */ +#define EL_POLLING 0x02 /* polling flag */ +#define EL_MODE_MEM_IO_MAP 0x04 /* dev registers mem mapped */ +#define EL_PROMISCUOUS_FLAG 0x08 /* set the promiscuous mode */ + + +/* eeprom defines */ + +#define EL_EE_WAIT 162 /* 162 usec */ +#define EL_EE_RETRY_CNT 100 /* retry count */ +#define EL_EE_READ 0x0080 /* read, 5 bit address */ +#define EL_EE_WRITE 0x0040 /* write, 5 bit address */ +#define EL_EE_ERASE 0x00c0 /* erase, 5 bit address */ +#define EL_EE_EWEN 0x0030 /* erase, no data needed */ +#define EL_EE_BUSY 0x8000 + +/* eeprom contents */ + +#define EL_EE_EADDR0 0x00 /* station address, first word */ +#define EL_EE_EADDR1 0x01 /* station address, next word, */ +#define EL_EE_EADDR2 0x02 /* station address, last word */ +#define EL_EE_PRODID 0x03 /* product ID code */ +#define EL_EE_MDATA_DATE 0x04 /* manufacturing data, date */ +#define EL_EE_MDATA_DIV 0x05 /* manufacturing data, division */ +#define EL_EE_MDATA_PCODE 0x06 /* manufacturing data, product code */ +#define EL_EE_MFG_ID 0x07 +#define EL_EE_PCI_PARM 0x08 +#define EL_EE_ROM_ONFO 0x09 +#define EL_EE_OEM_ADR0 0x0A +#define EL_EE_OEM_ADR1 0x0B +#define EL_EE_OEM_ADR2 0x0C +#define EL_EE_SOFTINFO1 0x0D +#define EL_EE_COMPAT 0x0E +#define EL_EE_SOFTINFO2 0x0F +#define EL_EE_CAPS 0x10 /* capabilities word */ +#define EL_EE_RSVD0 0x11 +#define EL_EE_ICFG_0 0x12 +#define EL_EE_ICFG_1 0x13 +#define EL_EE_RSVD1 0x14 +#define EL_EE_SOFTINFO3 0x15 +#define EL_EE_RSVD_2 0x16 + + +/* Bits in the capabilities word */ + +#define EL_CAPS_PNP 0x0001 +#define EL_CAPS_FULL_DUPLEX 0x0002 +#define EL_CAPS_LARGE_PKTS 0x0004 +#define EL_CAPS_SLAVE_DMA 0x0008 +#define EL_CAPS_SECOND_DMA 0x0010 +#define EL_CAPS_FULL_BM 0x0020 +#define EL_CAPS_FRAG_BM 0x0040 +#define EL_CAPS_CRC_PASSTHRU 0x0080 +#define EL_CAPS_TXDONE 0x0100 +#define EL_CAPS_NO_TXLENGTH 0x0200 +#define EL_CAPS_RX_REPEAT 0x0400 +#define EL_CAPS_SNOOPING 0x0800 +#define EL_CAPS_100MBPS 0x1000 +#define EL_CAPS_PWRMGMT 0x2000 + + +/* Register layouts. */ + +#define EL_COMMAND 0x0E +#define EL_STATUS 0x0E + +#define EL_TX_STATUS 0x1B +#define EL_TX_FREE 0x1C +#define EL_DMACTL 0x20 +#define EL_DOWNLIST_PTR 0x24 +#define EL_TX_FREETHRESH 0x2F +#define EL_UPLIST_PTR 0x38 +#define EL_UPLIST_STATUS 0x30 + +#define EL_PKTSTAT_UP_STALLED 0x00002000 +#define EL_PKTSTAT_UP_ERROR 0x00004000 +#define EL_PKTSTAT_UP_CMPLT 0x00008000 + +#define EL_DMACTL_DN_CMPLT_REQ 0x00000002 +#define EL_DMACTL_DOWN_STALLED 0x00000004 +#define EL_DMACTL_UP_CMPLT 0x00000008 +#define EL_DMACTL_DOWN_CMPLT 0x00000010 +#define EL_DMACTL_UP_RX_EARLY 0x00000020 +#define EL_DMACTL_ARM_COUNTDOWN 0x00000040 +#define EL_DMACTL_DOWN_INPROG 0x00000080 +#define EL_DMACTL_COUNTER_SPEED 0x00000100 +#define EL_DMACTL_DOWNDOWN_MODE 0x00000200 +#define EL_DMACTL_TARGET_ABORT 0x40000000 +#define EL_DMACTL_MASTER_ABORT 0x80000000 + +/* + * Command codes. Some command codes require that we wait for + * the CMD_BUSY flag to clear. Those codes are marked as 'mustwait.' + */ + +#define EL_CMD_RESET 0x0000 /* mustwait */ +#define EL_CMD_WINSEL 0x0800 +#define EL_CMD_COAX_START 0x1000 +#define EL_CMD_RX_DISABLE 0x1800 +#define EL_CMD_RX_ENABLE 0x2000 +#define EL_CMD_RX_RESET 0x2800 /* mustwait */ +#define EL_CMD_UP_STALL 0x3000 /* mustwait */ +#define EL_CMD_UP_UNSTALL 0x3001 +#define EL_CMD_DOWN_STALL 0x3002 /* mustwait */ +#define EL_CMD_DOWN_UNSTALL 0x3003 +#define EL_CMD_RX_DISCARD 0x4000 +#define EL_CMD_TX_ENABLE 0x4800 +#define EL_CMD_TX_DISABLE 0x5000 +#define EL_CMD_TX_RESET 0x5800 /* mustwait */ +#define EL_CMD_INTR_FAKE 0x6000 +#define EL_CMD_INTR_ACK 0x6800 +#define EL_CMD_INTR_ENB 0x7000 +#define EL_CMD_STAT_ENB 0x7800 +#define EL_CMD_RX_SET_FILT 0x8000 +#define EL_CMD_RX_SET_THRESH 0x8800 +#define EL_CMD_TX_SET_THRESH 0x9000 +#define EL_CMD_TX_SET_START 0x9800 +#define EL_CMD_DMA_UP 0xA000 +#define EL_CMD_DMA_STOP 0xA001 +#define EL_CMD_STATS_ENABLE 0xA800 +#define EL_CMD_STATS_DISABLE 0xB000 +#define EL_CMD_COAX_STOP 0xB800 + +#define EL_CMD_SET_TX_RECLAIM 0xC000 /* 3c905B only */ +#define EL_CMD_RX_SET_HASH 0xC800 /* 3c905B only */ + +#define EL_HASH_SET 0x0400 +#define EL_HASHFILT_SIZE 256 + +/* + * status codes + * Note that bits 15 to 13 indicate the currently visible register window + * which may be anything from 0 to 7. + */ + +#define EL_STAT_INTLATCH 0x0001 /* 0 */ +#define EL_STAT_ADFAIL 0x0002 /* 1 */ +#define EL_STAT_TX_COMPLETE 0x0004 /* 2 */ +#define EL_STAT_TX_AVAIL 0x0008 /* 3 first generation */ +#define EL_STAT_RX_COMPLETE 0x0010 /* 4 */ +#define EL_STAT_RX_EARLY 0x0020 /* 5 */ +#define EL_STAT_INTREQ 0x0040 /* 6 */ +#define EL_STAT_STATSOFLOW 0x0080 /* 7 */ +#define EL_STAT_DMADONE 0x0100 /* 8 first generation */ +#define EL_STAT_LINKSTAT 0x0100 /* 8 3c509B */ +#define EL_STAT_DOWN_COMPLETE 0x0200 /* 9 */ +#define EL_STAT_UP_COMPLETE 0x0400 /* 10 */ +#define EL_STAT_DMABUSY 0x0800 /* 11 first generation */ +#define EL_STAT_CMDBUSY 0x1000 /* 12 */ + +/* interrupts we normally want enabled. */ + +#define EL_INTRS \ + (EL_STAT_UP_COMPLETE|EL_STAT_STATSOFLOW|EL_STAT_ADFAIL| \ + EL_STAT_DOWN_COMPLETE|EL_STAT_TX_COMPLETE|EL_STAT_INTLATCH) + +#define EL_WIN_0 0 +#define EL_WIN_1 1 +#define EL_WIN_2 2 +#define EL_WIN_3 3 +#define EL_WIN_4 4 +#define EL_WIN_5 5 +#define EL_WIN_6 6 +#define EL_WIN_7 7 + +/* window 0 registers */ + +#define EL_W0_EE_DATA 0x0C +#define EL_W0_EE_CMD 0x0A +#define EL_W0_RSRC_CFG 0x08 +#define EL_W0_ADDR_CFG 0x06 +#define EL_W0_CFG_CTRL 0x04 +#define EL_W0_PROD_ID 0x02 +#define EL_W0_MFG_ID 0x00 + +/* window 1 */ + +#define EL_W1_TX_FIFO 0x10 +#define EL_W1_FREE_TX 0x0C +#define EL_W1_TX_STATUS 0x0B +#define EL_W1_TX_TIMER 0x0A +#define EL_W1_RX_STATUS 0x08 +#define EL_W1_RX_FIFO 0x00 + +/* RX status codes */ + +#define EL_RXSTATUS_OVERRUN 0x01 +#define EL_RXSTATUS_RUNT 0x02 +#define EL_RXSTATUS_ALIGN 0x04 +#define EL_RXSTATUS_CRC 0x08 +#define EL_RXSTATUS_OVERSIZE 0x10 +#define EL_RXSTATUS_DRIBBLE 0x20 + +/* TX status codes */ + +#define EL_TXSTATUS_RECLAIM 0x02 /* 3c905B only */ +#define EL_TXSTATUS_OVERFLOW 0x04 +#define EL_TXSTATUS_MAXCOLS 0x08 +#define EL_TXSTATUS_UNDERRUN 0x10 +#define EL_TXSTATUS_JABBER 0x20 +#define EL_TXSTATUS_INTREQ 0x40 +#define EL_TXSTATUS_COMPLETE 0x80 + +/* window 2 */ + +#define EL_W2_RESET_OPTIONS 0x0C /* 3c905B only */ +#define EL_W2_STATION_MASK_HI 0x0A +#define EL_W2_STATION_MASK_MID 0x08 +#define EL_W2_STATION_MASK_LO 0x06 +#define EL_W2_STATION_ADDR_HI 0x04 +#define EL_W2_STATION_ADDR_MID 0x02 +#define EL_W2_STATION_ADDR_LO 0x00 + +#define EL_RESETOPT_FEATUREMASK (0x0001 | 0x0002 | 0x004) +#define EL_RESETOPT_D3RESETDIS 0x0008 +#define EL_RESETOPT_DISADVFD 0x0010 +#define EL_RESETOPT_DISADV100 0x0020 +#define EL_RESETOPT_DISAUTONEG 0x0040 +#define EL_RESETOPT_DEBUGMODE 0x0080 +#define EL_RESETOPT_FASTAUTO 0x0100 +#define EL_RESETOPT_FASTEE 0x0200 +#define EL_RESETOPT_FORCEDCONF 0x0400 +#define EL_RESETOPT_TESTPDTPDR 0x0800 +#define EL_RESETOPT_TEST100TX 0x1000 +#define EL_RESETOPT_TEST100RX 0x2000 + +/* window 3 (fifo management) */ + +#define EL_W3_INTERNAL_CFG 0x00 +#define EL_W3_RESET_OPT 0x08 +#define EL_W3_FREE_TX 0x0C +#define EL_W3_FREE_RX 0x0A +#define EL_W3_MAC_CTRL 0x06 + +#define EL_ICFG_CONNECTOR_MASK 0x00F00000 +#define EL_ICFG_CONNECTOR_BITS 20 + +#define EL_ICFG_RAMSIZE_MASK 0x00000007 +#define EL_ICFG_RAMWIDTH 0x00000008 +#define EL_ICFG_ROMSIZE_MASK (0x00000040 | 0x00000080) +#define EL_ICFG_DISABLE_BASSD 0x00000100 +#define EL_ICFG_RAMLOC 0x00000200 +#define EL_ICFG_RAMPART (0x00010000 | 0x00020000) +#define EL_ICFG_XCVRSEL (0x00100000 | 0x00200000 | 0x00400000) +#define EL_ICFG_AUTOSEL 0x01000000 + +#define EL_XCVR_10BT 0x00 +#define EL_XCVR_AUI 0x01 +#define EL_XCVR_RSVD_0 0x02 +#define EL_XCVR_COAX 0x03 +#define EL_XCVR_100BTX 0x04 +#define EL_XCVR_100BFX 0x05 +#define EL_XCVR_MII 0x06 +#define EL_XCVR_RSVD_1 0x07 +#define EL_XCVR_AUTO 0x08 /* 3c905B only */ + +#define EL_MACCTRL_DEFER_EXT_END 0x0001 +#define EL_MACCTRL_DEFER_0 0x0002 +#define EL_MACCTRL_DEFER_1 0x0004 +#define EL_MACCTRL_DEFER_2 0x0008 +#define EL_MACCTRL_DEFER_3 0x0010 +#define EL_MACCTRL_DUPLEX 0x0020 +#define EL_MACCTRL_ALLOW_LARGE_PACK 0x0040 +#define EL_MACCTRL_EXTEND_AFTER_COL 0x0080 (3c905B only) +#define EL_MACCTRL_FLOW_CONTROL_ENB 0x0100 (3c905B only) +#define EL_MACCTRL_VLT_END 0x0200 (3c905B only) + +/* + * The 'reset options' register contains power-on reset values + * loaded from the EEPROM. This includes the supported media + * types on the card. It is also known as the media options register. + */ +#define EL_W3_MEDIA_OPT 0x08 + +#define EL_MEDIAOPT_BT4 0x0001 /* MII */ +#define EL_MEDIAOPT_BTX 0x0002 /* on-chip */ +#define EL_MEDIAOPT_BFX 0x0004 /* on-chip */ +#define EL_MEDIAOPT_BT 0x0008 /* on-chip */ +#define EL_MEDIAOPT_BNC 0x0010 /* on-chip */ +#define EL_MEDIAOPT_AUI 0x0020 /* on-chip */ +#define EL_MEDIAOPT_MII 0x0040 /* MII */ +#define EL_MEDIAOPT_VCO 0x0100 /* 1st gen chip only */ + +#define EL_MEDIAOPT_10FL 0x0100 /* 3x905B only, on-chip */ +#define EL_MEDIAOPT_MASK 0x01FF + +/* window 4 (diagnostics) */ + +#define EL_W4_UPPERBYTESOK 0x0D +#define EL_W4_BADSSD 0x0C +#define EL_W4_MEDIA_STATUS 0x0A +#define EL_W4_PHY_MGMT 0x08 +#define EL_W4_NET_DIAG 0x06 +#define EL_W4_FIFO_DIAG 0x04 +#define EL_W4_VCO_DIAG 0x02 + +#define EL_W4_CTRLR_STAT 0x08 +#define EL_W4_TX_DIAG 0x00 + +#define EL_MII_CLK 0x01 +#define EL_MII_DATA 0x02 +#define EL_MII_DIR 0x04 + +#define EL_MEDIA_SQE 0x0008 +#define EL_MEDIA_10TP 0x00C0 +#define EL_MEDIA_LNK 0x0080 +#define EL_MEDIA_LNKBEAT 0x0800 + +#define EL_MEDIASTAT_CRCSTRIP 0x0004 +#define EL_MEDIASTAT_SQEENB 0x0008 +#define EL_MEDIASTAT_COLDET 0x0010 +#define EL_MEDIASTAT_CARRIER 0x0020 +#define EL_MEDIASTAT_JABGUARD 0x0040 +#define EL_MEDIASTAT_LINKBEAT 0x0080 +#define EL_MEDIASTAT_JABDETECT 0x0200 +#define EL_MEDIASTAT_POLREVERS 0x0400 +#define EL_MEDIASTAT_LINKDETECT 0x0800 +#define EL_MEDIASTAT_TXINPROG 0x1000 +#define EL_MEDIASTAT_DCENB 0x4000 +#define EL_MEDIASTAT_AUIDIS 0x8000 + +#define EL_NETDIAG_TEST_LOWVOLT 0x0001 +#define EL_NETDIAG_ASIC_REVMASK (0x0002|0x0004|0x0008|0x0010|0x0020) +#define EL_NETDIAG_UPPER_BYTES_ENABLE 0x0040 +#define EL_NETDIAG_STATS_ENABLED 0x0080 +#define EL_NETDIAG_TX_FATALERR 0x0100 +#define EL_NETDIAG_TRANSMITTING 0x0200 +#define EL_NETDIAG_RX_ENABLED 0x0400 +#define EL_NETDIAG_TX_ENABLED 0x0800 +#define EL_NETDIAG_FIFO_LOOPBACK 0x1000 +#define EL_NETDIAG_MAC_LOOPBACK 0x2000 +#define EL_NETDIAG_ENDEC_LOOPBACK 0x4000 +#define EL_NETDIAG_EXTERNAL_LOOP 0x8000 + +/* window 5 */ + +#define EL_W5_STAT_ENB 0x0C +#define EL_W5_INTR_ENB 0x0A +#define EL_W5_RECLAIM_THRESH 0x09 /* 3c905B only */ +#define EL_W5_RX_FILTER 0x08 +#define EL_W5_RX_EARLYTHRESH 0x06 +#define EL_W5_TX_AVAILTHRESH 0x02 +#define EL_W5_TX_STARTTHRESH 0x00 + +/* RX filter bits */ +#define EL_RXFILTER_INDIVIDUAL 0x01 +#define EL_RXFILTER_ALLMULTI 0x02 +#define EL_RXFILTER_BROADCAST 0x04 +#define EL_RXFILTER_ALLFRAMES 0x08 +#define EL_RXFILTER_MULTIHASH 0x10 /* 3c905B only */ + +/* window 6 (stats) */ +#define EL_W6_TX_BYTES_OK 0x0C +#define EL_W6_RX_BYTES_OK 0x0A +#define EL_W6_UPPER_FRAMES_OK 0x09 +#define EL_W6_DEFERRED 0x08 +#define EL_W6_RX_OK 0x07 +#define EL_W6_TX_OK 0x06 +#define EL_W6_RX_OVERRUN 0x05 +#define EL_W6_COL_LATE 0x04 +#define EL_W6_COL_SINGLE 0x03 +#define EL_W6_COL_MULTIPLE 0x02 +#define EL_W6_SQE_ERRORS 0x01 +#define EL_W6_CARRIER_LOST 0x00 + +/* window 7 (bus master control) */ +#define EL_W7_BM_ADDR 0x00 +#define EL_W7_BM_LEN 0x06 +#define EL_W7_BM_STATUS 0x0B +#define EL_W7_BM_TIMEr 0x0A + +/* bus master control registers */ + +#define EL_BM_PKTSTAT 0x20 +#define EL_BM_DOWNLISTPTR 0x24 +#define EL_BM_FRAGADDR 0x28 +#define EL_BM_FRAGLEN 0x2C +#define EL_BM_TXFREETHRESH 0x2F +#define EL_BM_UPPKTSTAT 0x30 +#define EL_BM_UPLISTPTR 0x38 + +#define EL_LAST_FRAG 0x80000000 + +/* descriptor registers and defines */ + +#define EL_MAXFRAGS 63 +#define EL_MIN_FRAMELEN 60 + +#define EL_RXSTAT_LENMASK 0x00001FFF /* bits 0 to 12 length mask */ +#define EL_RXSTAT_UP_ERROR 0x00004000 +#define EL_RXSTAT_UP_CMPLT 0x00008000 +#define EL_RXSTAT_UP_OVERRUN 0x00010000 +#define EL_RXSTAT_RUNT 0x00020000 +#define EL_RXSTAT_ALIGN 0x00040000 +#define EL_RXSTAT_CRC 0x00080000 +#define EL_RXSTAT_OVERSIZE 0x00100000 +#define EL_RXSTAT_DRIBBLE 0x00800000 +#define EL_RXSTAT_UP_OFLOW 0x01000000 +#define EL_RXSTAT_IPCKERR 0x02000000 /* 3c905B only */ +#define EL_RXSTAT_TCPCKERR 0x04000000 /* 3c905B only */ +#define EL_RXSTAT_UDPCKERR 0x08000000 /* 3c905B only */ +#define EL_RXSTAT_BUFEN 0x10000000 /* 3c905B only */ +#define EL_RXSTAT_IPCKOK 0x20000000 /* 3c905B only */ +#define EL_RXSTAT_TCPCOK 0x40000000 /* 3c905B only */ +#define EL_RXSTAT_UDPCKOK 0x80000000 /* 3c905B only */ + +#define EL_TXSTAT_LENMASK 0x00001FFF /* bits 0 to 12 length mask */ +#define EL_TXSTAT_CRCDIS 0x00002000 +#define EL_TXSTAT_TX_INTR 0x00008000 +#define EL_TXSTAT_DL_COMPLETE 0x00010000 +#define EL_TXSTAT_IPCKSUM 0x02000000 /* 3c905B only */ +#define EL_TXSTAT_TCPCKSUM 0x04000000 /* 3c905B only */ +#define EL_TXSTAT_UDPCKSUM 0x08000000 /* 3c905B only */ +#define EL_TXSTAT_DL_INTR 0x80000000 + +#define EL_CAPABILITY_BM 0x20 + +/* MII constants */ + +#define EL_MII_STARTDELIM 0x01 +#define EL_MII_READOP 0x02 +#define EL_MII_WRITEOP 0x01 +#define EL_MII_TURNAROUND 0x02 + +/* + * The 3C905B adapters implement a few features that we want to + * take advantage of, namely the multicast hash filter. With older + * chips, you only have the option of turning on reception of all + * multicast frames. + */ + +#define EL_TYPE_905B 1 +#define EL_TYPE_90X 2 +#define EL_TIMEOUT 1000 + +/* General constants . 3Com PCI vendor ID */ + +#define TC_VENDORID 0x10B7 + +/* 3Com chip device IDs.*/ + +#define TC_DEVICEID_BOOMERANG_10BT 0x9000 +#define TC_DEVICEID_BOOMERANG_10BT_COMBO 0x9001 +#define TC_DEVICEID_BOOMERANG_10_100BT 0x9050 +#define TC_DEVICEID_BOOMERANG_100BT4 0x9051 +#define TC_DEVICEID_CYCLONE_10BT 0x9004 +#define TC_DEVICEID_CYCLONE_10BT_COMBO 0x9005 +#define TC_DEVICEID_CYCLONE_10_100BT 0x9055 +#define TC_DEVICEID_CYCLONE_10_100BT4 0x9056 +#define TC_DEVICEID_CYCLONE_10_100FX 0x905A +#define TC_DEVICEID_CYCLONE_10_100BT_SERV 0x9800 +#define TC_DEVICEID_CYCLONE_10FL 0x900A +#define TC_DEVICEID_CYCLONE_10_100_COMBO 0x9058 +#define TC_DEVICEID_KRAKATOA_10BT_TPC 0x9006 +#define TC_DEVICEID_TORNADO_10_100BT 0x9200 +#define TC_DEVICEID_TORNADO_10_100BT_SERV 0x9805 +#define TC_DEVICEID_TORNADO_HOMECONNECT 0x4500 +#define TC_DEVICEID_HURRICANE_SOHO100TX 0x7646 + +/* + * Texas Instruments PHY identifiers + * + * The ThunderLAN manual has a curious and confusing error in it. + * In chapter 7, which describes PHYs, it says that TI PHYs have + * the following ID codes, where xx denotes a revision: + * + * 0x4000501xx internal 10baseT PHY + * 0x4000502xx TNETE211 100VG-AnyLan PMI + * + * The problem here is that these are not valid 32-bit hex numbers: + * there's one digit too many. My guess is that they mean the internal + * 10baseT PHY is 0x4000501x and the TNETE211 is 0x4000502x since these + * are the only numbers that make sense. + */ +#define TI_PHY_VENDORID 0x4000 +#define TI_PHY_10BT 0x501F +#define TI_PHY_100VGPMI 0x502F + +/* + * These ID values are for the NS DP83840A 10/100 PHY + */ +#define NS_PHY_VENDORID 0x2000 +#define NS_PHY_83840A 0x5C0F + +/* + * Level 1 10/100 PHY + */ +#define LEVEL1_PHY_VENDORID 0x7810 +#define LEVEL1_PHY_LXT970 0x000F + +/* + * Intel 82555 10/100 PHY + */ +#define INTEL_PHY_VENDORID 0x0A28 +#define INTEL_PHY_82555 0x015F + +/* + * SEEQ 80220 10/100 PHY + */ +#define SEEQ_PHY_VENDORID 0x0016 +#define SEEQ_PHY_80220 0xF83F + + +/* + * PCI low memory base and low I/O base register, and + * other PCI registers. Note: some are only available on + * the 3c905B, in particular those that related to power management. + */ + +#define EL_PCI_VENDOR_ID 0x00 +#define EL_PCI_DEVICE_ID 0x02 +#define EL_PCI_COMMAND 0x04 +#define EL_PCI_STATUS 0x06 +#define EL_PCI_CLASSCODE 0x09 +#define EL_PCI_LATENCY_TIMER 0x0D +#define EL_PCI_HEADER_TYPE 0x0E +#define EL_PCI_LOIO 0x10 +#define EL_PCI_LOMEM 0x14 +#define EL_PCI_BIOSROM 0x30 +#define EL_PCI_INTLINE 0x3C +#define EL_PCI_INTPIN 0x3D +#define EL_PCI_MINGNT 0x3E +#define EL_PCI_MINLAT 0x0F +#define EL_PCI_RESETOPT 0x48 +#define EL_PCI_EEPROM_DATA 0x4C + +/* 3c905B-only registers */ +#define EL_PCI_CAPID 0xDC /* 8 bits */ +#define EL_PCI_NEXTPTR 0xDD /* 8 bits */ +#define EL_PCI_PWRMGMTCAP 0xDE /* 16 bits */ +#define EL_PCI_PWRMGMTCTRL 0xE0 /* 16 bits */ + +#define EL_PSTATE_MASK 0x0003 +#define EL_PSTATE_D0 0x0000 +#define EL_PSTATE_D1 0x0002 +#define EL_PSTATE_D2 0x0002 +#define EL_PSTATE_D3 0x0003 +#define EL_PME_EN 0x0010 +#define EL_PME_STATUS 0x8000 + +#define PHY_UNKNOWN 6 + +#define EL_PHYADDR_MIN 0x00 +#define EL_PHYADDR_MAX 0x1F + +#define EL_PHY_GENCTL 0x00 +#define EL_PHY_GENSTS 0x01 +#define EL_PHY_VENID 0x02 +#define EL_PHY_DEVID 0x03 +#define EL_PHY_ANAR 0x04 +#define EL_PHY_LPAR 0x05 +#define EL_PHY_ANEXP 0x06 + +#define PHY_ANAR_NEXTPAGE 0x8000 +#define PHY_ANAR_RSVD0 0x4000 +#define PHY_ANAR_TLRFLT 0x2000 +#define PHY_ANAR_RSVD1 0x1000 +#define PHY_ANAR_RSVD2 0x0800 +#define PHY_ANAR_RSVD3 0x0400 +#define PHY_ANAR_100BT4 0x0200 +#define PHY_ANAR_100BTXFULL 0x0100 +#define PHY_ANAR_100BTXHALF 0x0080 +#define PHY_ANAR_10BTFULL 0x0040 +#define PHY_ANAR_10BTHALF 0x0020 +#define PHY_ANAR_PROTO4 0x0010 +#define PHY_ANAR_PROTO3 0x0008 +#define PHY_ANAR_PROTO2 0x0004 +#define PHY_ANAR_PROTO1 0x0002 +#define PHY_ANAR_PROTO0 0x0001 + +/* + * These are the register definitions for the PHY (physical layer + * interface chip). + */ + +/* + * PHY BMCR Basic Mode Control Register + */ + +#define PHY_BMCR 0x00 +#define PHY_BMCR_RESET 0x8000 +#define PHY_BMCR_LOOPBK 0x4000 +#define PHY_BMCR_SPEEDSEL 0x2000 +#define PHY_BMCR_AUTONEGENBL 0x1000 +#define PHY_BMCR_RSVD0 0x0800 /* write as zero */ +#define PHY_BMCR_ISOLATE 0x0400 +#define PHY_BMCR_AUTONEGRSTR 0x0200 +#define PHY_BMCR_DUPLEX 0x0100 +#define PHY_BMCR_COLLTEST 0x0080 +#define PHY_BMCR_RSVD1 0x0040 /* write as zero, don't care */ +#define PHY_BMCR_RSVD2 0x0020 /* write as zero, don't care */ +#define PHY_BMCR_RSVD3 0x0010 /* write as zero, don't care */ +#define PHY_BMCR_RSVD4 0x0008 /* write as zero, don't care */ +#define PHY_BMCR_RSVD5 0x0004 /* write as zero, don't care */ +#define PHY_BMCR_RSVD6 0x0002 /* write as zero, don't care */ +#define PHY_BMCR_RSVD7 0x0001 /* write as zero, don't care */ + +/* + * RESET: 1 == software reset, 0 == normal operation + * Resets status and control registers to default values. + * Relatches all hardware config values. + * + * LOOPBK: 1 == loopback operation enabled, 0 == normal operation + * + * SPEEDSEL: 1 == 100Mb/s, 0 == 10Mb/s + * Link speed is selected byt his bit or if auto-negotiation if bit + * 12 (AUTONEGENBL) is set (in which case the value of this register + * is ignored). + * + * AUTONEGENBL: 1 == Autonegotiation enabled, 0 == Autonegotiation disabled + * Bits 8 and 13 are ignored when autoneg is set, otherwise bits 8 and 13 + * determine speed and mode. Should be cleared and then set if PHY configured + * for no autoneg on startup. + * + * ISOLATE: 1 == isolate PHY from MII, 0 == normal operation + * + * AUTONEGRSTR: 1 == restart autonegotiation, 0 = normal operation + * + * DUPLEX: 1 == full duplex mode, 0 == half duplex mode + * + * COLLTEST: 1 == collision test enabled, 0 == normal operation + */ + +/* + * PHY, BMSR Basic Mode Status Register + */ +#define PHY_BMSR 0x01 +#define PHY_BMSR_100BT4 0x8000 +#define PHY_BMSR_100BTXFULL 0x4000 +#define PHY_BMSR_100BTXHALF 0x2000 +#define PHY_BMSR_10BTFULL 0x1000 +#define PHY_BMSR_10BTHALF 0x0800 +#define PHY_BMSR_RSVD1 0x0400 /* write as zero, don't care */ +#define PHY_BMSR_RSVD2 0x0200 /* write as zero, don't care */ +#define PHY_BMSR_RSVD3 0x0100 /* write as zero, don't care */ +#define PHY_BMSR_RSVD4 0x0080 /* write as zero, don't care */ +#define PHY_BMSR_MFPRESUP 0x0040 +#define PHY_BMSR_AUTONEGCOMP 0x0020 +#define PHY_BMSR_REMFAULT 0x0010 +#define PHY_BMSR_CANAUTONEG 0x0008 +#define PHY_BMSR_LINKSTAT 0x0004 +#define PHY_BMSR_JABBER 0x0002 +#define PHY_BMSR_EXTENDED 0x0001 + +/* ethernet media */ + +#define IFM_ETHER 0x00000020 +#define IFM_10_T 3 /* 10BaseT - RJ45 */ +#define IFM_10_2 4 /* 10Base2 - Thinnet */ +#define IFM_10_5 5 /* 10Base5 - AUI */ +#define IFM_100_TX 6 /* 100BaseTX - RJ45 */ +#define IFM_100_FX 7 /* 100BaseFX - Fiber */ +#define IFM_100_T4 8 /* 100BaseT4 - 4 pair cat 3 */ +#define IFM_100_VG 9 /* 100VG-AnyLAN */ +#define IFM_100_T2 10 /* 100BaseT2 */ + +/* Shared media sub-types */ + +#define IFM_AUTO 0 /* Autoselect best media */ +#define IFM_MANUAL 1 /* Jumper/dipswitch selects media */ +#define IFM_NONE 2 /* Deselect all media */ + +/* Shared options */ + +#define IFM_FDX 0x00100000 /* Force full duplex */ +#define IFM_HDX 0x00200000 /* Force half duplex */ +#define IFM_FLAG0 0x01000000 /* Driver defined flag */ +#define IFM_FLAG1 0x02000000 /* Driver defined flag */ +#define IFM_FLAG2 0x04000000 /* Driver defined flag */ +#define IFM_LOOP 0x08000000 /* Put hardware in loopback */ + +/* Masks */ + +#define IFM_NMASK 0x000000e0 /* Network type */ +#define IFM_TMASK 0x0000000f /* Media sub-type */ +#define IFM_IMASK 0xf0000000 /* Instance */ +#define IFM_ISHIFT 28 /* Instance shift */ +#define IFM_OMASK 0x0000ff00 /* Type specific options */ +#define IFM_GMASK 0x0ff00000 /* Global options */ + +/* Status bits */ + +#define IFM_AVALID 0x00000001 /* Active bit valid */ +#define IFM_ACTIVE 0x00000002 /* Iface bound to working net */ + + +/* + * fragment structure in a descriptor each descriptor can have upto + * 63 fragments + */ + +typedef struct elFrag + { + UINT32 fragAddr; /* fragment address */ + UINT32 fragLen; /* fragment length */ + } EL_FRAG; + +/* structure of a descriptor with multiple fragments */ + +typedef struct elDesc + { + UINT32 nextDesc; /* final entry has 0 nextptr */ + UINT32 status; /* status of the descriptor */ + EL_FRAG descFrag [EL_MAXFRAGS]; /* fragments */ + } EL_DESC; + +/* structure of a descriptor with one fragment */ + +typedef struct elDescOnefrag + { + UINT32 nextDesc; /* final entry has 0 nextptr */ + UINT32 status; /* status of the descriptor */ + EL_FRAG descFrag; /* one fragment only */ + } EL_SIMPLE_DESC; + +/* structure of the recv and transmit descriptors laid out in memory */ + +typedef struct elDescBlk + { + EL_SIMPLE_DESC rxDescs [EL_UPD_CNT]; + EL_DESC txDescs [EL_DND_CNT]; + unsigned char descPad [EL_MIN_FRAMELEN]; + } EL_DESC_BLK; + +/* structure of a linked list holding ptrs to descriptors */ + +typedef struct elChain + { + EL_DESC * pDesc; + M_BLK * pMblk; + struct elChain * pNextChain; + } EL_DESC_CHAIN; + +/* structure of a linked list holding ptrs to simple descriptors */ + +typedef struct elChainOnefrag + { + EL_SIMPLE_DESC * pDesc; + M_BLK * pMblk; + struct elChainOnefrag * pNextChain; + } EL_SIMPLE_DESC_CHAIN; + +/* structure of recv and transmit chains */ + +typedef struct elRxTxChain + { + EL_SIMPLE_DESC_CHAIN rxChain [EL_UPD_CNT]; + EL_DESC_CHAIN txChain [EL_DND_CNT]; + EL_SIMPLE_DESC_CHAIN * pRxHead; + EL_DESC_CHAIN * pTxHead; + EL_DESC_CHAIN * pTxTail; + EL_DESC_CHAIN * pTxFree; + } EL_RX_TX_CHAIN; + +/* structure of the device type */ + +typedef struct elType + { + UINT16 vendorId; + UINT16 deviceId; + char * devName; + } EL_DEV_TYPE; + +/* structure of the media independant interface frame */ + +typedef struct elMiiFrame + { + UINT8 stDelim; + UINT8 opCode; + UINT8 phyAddr; + UINT8 regAddr; + UINT8 turnAround; + UINT16 data; + } EL_MII_FRAME; + +/* statistics structure */ + +typedef struct elStats + { + UINT8 carrierLost; + UINT8 sqeErrs; + UINT8 txMultiCollision; + UINT8 txSingleCollision; + UINT8 txLateCollision; + UINT8 rxOverrun; + UINT8 txFramesOk; + UINT8 rxFramesOk; + UINT8 txDeferred; + UINT8 upperFramesOk; + UINT16 rxBytesOk; + UINT16 txBytesOk; + UINT16 status; + } EL_STATS; + +/* 3com 3c90x device control structure */ + +typedef struct el3c90xDevice + { + END_OBJ endObj; /* The class we inherit from */ + int unit; /* unit number of the device */ + UINT32 flags; /* Our local flags */ + EL_DEV_TYPE * pPhyDevType; /* phy info */ + UINT8 devType; /* 3c90x or 3c905B */ + UINT8 devPhyAddr; /* PHY address */ + UINT32 xCvr; /* transciever */ + UINT16 devMedia; /* media */ + UINT16 devCaps; /* capabilities */ + char * pDescMem; /* descriptor memory pointer */ + EL_DESC_BLK * pDescBlk; /* pointer to descriptor blk */ + EL_RX_TX_CHAIN rxTxChain; /* recv Transmit chains */ + UINT32 devAdrs; /* device structure address */ + int ivec; /* interrupt vector */ + int intLevel; /* interrupt level */ + char * memAdrs; /* 3COM memory pool base */ + int memSize; /* 3COM memory pool size */ + int memWidth; /* width of data port */ + int offset; /* offset of data in the buffer */ + int bufMtplr; /* buffer multiplier */ + UINT32 pciMemBase; /* memory base as seen from PCI*/ + UINT8 enetAddr[6]; /* ethernet address */ + CACHE_FUNCS cacheFuncs; /* cache function pointers */ + BOOL txBlocked; /* transmit flow control */ + CL_POOL_ID pClPoolId; /* cluster pool Id */ + M_CL_CONFIG mClCfg; /* mBlk & cluster cfg structure */ + CL_DESC clDesc; /* cluster descriptor table */ + } EL3C90X_DEVICE; + +#define EL_RX_GOODFRAMES(x) \ + ((x.upperFramesOk & 0x03) << 8) | x.rxFramesOk + +#define EL_TX_GOODFRAMES(x) \ + ((x.upperFramesOk & 0x30) << 4) | x.txFramesOk + +/* + * Macros to extract various bits of information from the media word. + */ +#define IFM_TYPE(x) ((x) & IFM_NMASK) +#define IFM_SUBTYPE(x) ((x) & IFM_TMASK) +#define IFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT) + +/* macro to select a window */ + +#define EL_SEL_WIN(x) \ + SYS_OUT_SHORT (pDrvCtrl, (pDrvCtrl->devAdrs + (UINT32)EL_COMMAND, \ + EL_CMD_WINSEL | (x))) + +/* + * MII access routines are provided for adapters with external + * PHYs (3c905-TX, 3c905-T4, 3c905B-T4) and those with built-in + * autoneg logic that's faked up to look like a PHY (3c905B-TX). + * Note: if you don't perform the MDIO operations just right, + * it's possible to end up with code that works correctly with + * some chips/CPUs/processor speeds/bus speeds/etc but not + * with others. + */ +#define EL_MII_SET(x) \ + el3c90xCsrWriteWord (pDrvCtrl, EL_W4_PHY_MGMT, \ + (el3c90xCsrReadWord(pDrvCtrl, \ + EL_W4_PHY_MGMT, \ + EL_WIN_4) | (x)), EL_WIN_4) + +#define EL_MII_CLR(x) \ + el3c90xCsrWriteWord (pDrvCtrl, EL_W4_PHY_MGMT, \ + (el3c90xCsrReadWord(pDrvCtrl, \ + EL_W4_PHY_MGMT, \ + EL_WIN_4) & ~(x)), EL_WIN_4) + + +/* board level/bus specific and architecture specific macros */ + +#if _BYTE_ORDER==_BIG_ENDIAN +#define PCI_SWAP(x) LONGSWAP((int)(x)) +#define PCI_WORD_SWAP(x) ((LSB((USHORT)(x)) << 8) | MSB((USHORT)(x))) +#else +#define PCI_SWAP(x) (x) +#define PCI_WORD_SWAP(x) (x) +#endif + +#if (CPU_FAMILY==I80X86) + +#ifndef EL3C90X_CACHE_VIRT_TO_PHYS +#define EL3C90X_CACHE_VIRT_TO_PHYS(address) \ + CACHE_DRV_VIRT_TO_PHYS (&pDrvCtrl->cacheFuncs, (address)) +#endif /* EL3C90X_CACHE_VIRT_TO_PHYS */ + +#ifndef SYS_OUT_LONG +#define SYS_OUT_LONG(pDrvCtrl,addr,value) \ + { \ + if (pDrvCtrl->flags & EL_MODE_MEM_IO_MAP) \ + *((ULONG *)(addr)) = (value); \ + else \ + sysOutLong((int)(addr), (value)); \ + } +#endif /* SYS_OUT_LONG */ + +#ifndef SYS_IN_LONG +#define SYS_IN_LONG(pDrvCtrl, addr, data) \ + { \ + if (pDrvCtrl->flags & EL_MODE_MEM_IO_MAP) \ + ((data) = *((ULONG *)(addr))); \ + else \ + ((data) = sysInLong((int) (addr))); \ + } +#endif /* SYS_IN_LONG */ + +#ifndef SYS_OUT_SHORT +#define SYS_OUT_SHORT(pDrvCtrl,addr,value) \ + { \ + if (pDrvCtrl->flags & EL_MODE_MEM_IO_MAP) \ + *((USHORT *)(addr)) = (value); \ + else \ + sysOutWord((int)(addr), (value)); \ + } +#endif /* SYS_OUT_SHORT */ + +#ifndef SYS_IN_SHORT +#define SYS_IN_SHORT(pDrvCtrl, addr, data) \ + { \ + if (pDrvCtrl->flags & EL_MODE_MEM_IO_MAP) \ + ((data) = *((USHORT *)(addr))); \ + else \ + ((data) = sysInWord((int) (addr))); \ + } +#endif /* SYS_IN_SHORT */ + +#ifndef SYS_OUT_BYTE +#define SYS_OUT_BYTE(pDrvCtrl,addr,value) \ + { \ + if (pDrvCtrl->flags & EL_MODE_MEM_IO_MAP) \ + *((UCHAR *)(addr)) = (value); \ + else \ + sysOutByte((int)(addr), (value)); \ + } +#endif /* SYS_OUT_BYTE */ + +#ifndef SYS_IN_BYTE +#define SYS_IN_BYTE(pDrvCtrl, addr, data) \ + { \ + if (pDrvCtrl->flags & EL_MODE_MEM_IO_MAP) \ + ((data) = *((UCHAR *)(addr))); \ + else \ + ((data) = sysInByte((int) (addr))); \ + } +#endif /* SYS_IN_BYTE */ +#endif /* CPU_FAMILY == I80x86 */ + +#if defined(__STDC__) || defined(__cplusplus) +IMPORT END_OBJ * el3c90xEndLoad (char * initString); +IMPORT STATUS el3c90xInitParse (EL3C90X_DEVICE * pDrvCtrl, + char * initString); +#else +IMPORT END_OBJ * el3c90xEndLoad (); +IMPORT STATUS el3c90xInitParse (); +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCel3c90xEndh */ diff --git a/h/drv/end/elt3c509End.h b/h/drv/end/elt3c509End.h new file mode 100644 index 0000000..049935e --- /dev/null +++ b/h/drv/end/elt3c509End.h @@ -0,0 +1,384 @@ +/* elt3c509End.h - 3Com EtherLink III END network interface header*/ + +/* Copyright 1998-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,02aug00,jkf moved statistic definitions to the driver, SPR#26952 +01c,11jun00,ham removed reference to etherLib. +01b,10mar99,sbs added DEF_NUM_RX_FRAMES. +01a,28sep98,snk written by mBedded Innovations Inc. +*/ + + +#ifndef __INCelt3c509Endh +#define __INCelt3c509Endh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "netinet/if_ether.h" + +#ifndef _ASMLANGUAGE + + +/* debug defines */ + +#undef DRV_DEBUG + +#ifdef DRV_DEBUG +#define ELT_TIMING +#endif /* DRV_DEBUG */ + +/* defines */ + +#define EA_SIZE 6 /* one Ethernet address */ +#define EH_SIZE 14 /* ethernet header size */ +#define MAX_FRAME_SIZE (EH_SIZE + ETHERMTU) /* capacity of buffer */ + +#define DEF_NUM_RX_FRAMES 64 /* default number of receive frames */ + +#define ATTACHMENT_DEFAULT 0 /* use card as configured */ +#define ATTACHMENT_AUI 1 /* AUI (thick, DIX, DB-15) */ +#define ATTACHMENT_BNC 2 /* BNC (thin, 10BASE-2) */ +#define ATTACHMENT_RJ45 3 /* RJ-45 (twisted pair, TPE,10BASE-T)*/ + +/* Configuration items */ + +#define ELT3C509_BUFSIZ (ETHERMTU + SIZEOF_ETHERHEADER + 6) +#define ELT3C509_SPEED 10000000 +#define ELT_PRODUCTID_3C589 0x9058 /* product ID for PCMCIA 3C589 */ + +/* naming items */ + +#define ELT3C509_DEV_NAME "elt" +#define ELT3C509_DEV_NAME_LEN 4 + +/* flags */ + +#define ELT3C_PROMISCUOUS_FLAG 0x1 +#define ELT3C_RCV_HANDLING_FLAG 0x2 +#define ELT3C_POLLING 0x4 + + +/* statistic block, see also driver source code */ +typedef struct + { +#ifdef ELT_TIMING + UINT elt3c509Stats[40]; +#else + UINT elt3c509Stats[30]; +#endif + } ELT3C509_STAT; + + /* ELT driver data structures */ + +typedef struct elt3c509_device + { + END_OBJ endObj; /* The class we inherit from. */ + int unit; /* unit number */ + char * pTxCluster; /* pointer to transmit cluster */ + int nRxFrames; /* number of recv frames */ + int rxFilter; /* current recv address filter bits */ + int port; /* base I/O port of this board */ + int ivec; /* interrupt vector */ + int intLevel; /* interrupt level */ + int attachment; /* connector to use (AUI,BNC,TPE) */ + int intMask; /* current board interrupt mask */ + ELT3C509_STAT elt3c509Stat; /* statistics */ + long flags; /* Our local flags. */ + UCHAR enetAddr [6]; /* ethernet address */ + CACHE_FUNCS cacheFuncs; /* cache function pointers */ + BOOL txBlocked; /* indicates netTask active/queued */ + CL_POOL_ID pClPoolId; /* cluster pool id */ + M_CL_CONFIG endClConfig; /* cluster config structure */ + CL_DESC endClDesc; /* cluster descriptor table */ +#ifdef ELT_TIMING + int interruptTime; /* timer value at ISR, -1 if invalid */ + int maxRxLatency; /* max time to service receive buffer */ +#endif /* ELT_TIMING */ + } ELT3C509_DEVICE; + + +/* ELT register offsets, grouped by window number */ + +/* all windows */ + +#define ELT3C509_COMMAND 0x0e /* command register */ +#define ELT3C509_STATUS 0x0e /* status register */ + +/* window number symbols for selection command */ + +#define WIN_CONFIG 0x0000 +#define WIN_OPERATING 0x0001 +#define WIN_ADDRESS 0x0002 +#define WIN_FIFO 0x0003 +#define WIN_DIAGNOSTIC 0x0004 +#define WIN_RESULTS 0x0005 +#define WIN_STATISTICS 0x0006 + +/* window 0, configuration and EEPROM */ + +#define MANUF_ID 0x00 /* manufacturer ID */ +#define PRODUCT_ID 0x02 /* product ID/MCA adapter ID */ +#define CONFIG_CONTROL 0x04 /* configuration control */ +#define ADDRESS_CONFIG 0x06 /* address configuration */ +#define RESOURCE_CONFIG 0x08 /* resource configuration */ +#define EEPROM_CONTROL 0x0a /* EEPROM control */ +#define EEPROM_DATA 0x0c /* EEPROM data in/out */ + +/* window 1, operating set */ + +#define DATA_REGISTER 0x00 /* data (low word) in/out */ +#define DATA_HIGH 0x02 /* data (high word) in/out */ +#define RX_STATUS 0x08 /* received packet status */ +#define TIMER 0x0a /* (byte) interrupt latency timer */ +#define TX_STATUS 0x0b /* (byte) transmit status */ +#define TX_FREE_BYTES 0x0c /* free bytes available in tx FIFO */ + /* also appears in window 3 */ + +/* window 2, station address setup/read */ + +#define ADDRESS_0 0x00 /* (byte) station address 0 */ +#define ADDRESS_1 0x01 /* (byte) station address 1 */ +#define ADDRESS_2 0x02 /* (byte) station address 2 */ +#define ADDRESS_3 0x03 /* (byte) station address 3 */ +#define ADDRESS_4 0x04 /* (byte) station address 4 */ +#define ADDRESS_5 0x05 /* (byte) station address 5 */ + +/* window 3, FIFO management */ + +#define TX_RECLAIM 0x08 /* MCA tx reclaim threshold */ +#define RX_FREE_BYTES 0x0a /* free bytes available in rx FIFO */ +#define TX_FREE_BYTES_3 0x0c /* free bytes available in tx FIFO */ + /* also appears in window 1 */ + /* same offset so can use same macro */ + +/* window 4, diagnostics */ + +#define TX_DIAGNOSTIC 0x00 /* tx diagnostic */ +#define HOST_DIAGNOSTIC 0x02 /* host diagnostic */ +#define FIFO_DIAGNOSTIC 0x04 /* FIFO diagnostic */ +#define NET_DIAGNOSTIC 0x06 /* net diagnostic */ +#define ETHERNET_STATUS 0x08 /* ethernet controller status */ +#define MEDIA_STATUS 0x0a /* media type and status */ + +/* window 5, command results and internal state (read only) */ + +#define TX_START_THRESH 0x00 /* tx start threshold + 4 */ +#define TX_AVAIL_THRESH 0x02 /* tx available threshold */ +#define RX_EARLY_THRESH 0x06 /* rx early threshold */ +#define RX_FILTER 0x08 /* rx filter lower 4 bits */ +#define INTERRUPT_MASK 0x0a /* interrupt mask */ +#define READ_ZERO_MASK 0x0c /* read zero mask */ + +/* window 6, statistics registers (byte regs. MUST be read/written as bytes) */ + +#define CARRIER_LOSTS 0x00 /* (byte) carrier loss during tx */ +#define SQE_FAILURES 0x01 /* (byte) heartbeat loss during tx */ +#define MULT_COLLISIONS 0x02 /* (byte) tx with multiple collis. */ +#define ONE_COLLISIONS 0x03 /* (byte) tx with one collision */ +#define LATE_COLLISIONS 0x04 /* (byte) tx with late collision */ +#define RECV_OVERRUNS 0x05 /* (byte) receive overruns */ +#define GOOD_TRANSMITS 0x06 /* (byte) frames transmitted OK */ +#define GOOD_RECEIVES 0x07 /* (byte) frames received OK */ +#define TX_DEFERRALS 0x08 /* (byte) transmit deferrals */ +#define BYTES_RECEIVED 0x0a /* total bytes received OK */ +#define BYTES_TRANSMITTED 0x0c /* total bytes transmitted OK */ + +/* ISA ID sequence state machine commands */ + +#define ID_PORT 0x0100 /* I/O port to access ID sequence */ + /* could be 0x110..0x1f0 but this */ + /* is a highly unlikely address to */ + /* be used by anything else */ +#define ID_RESET 0x00 /* reset ID state machine */ +#define ID_EEPROM_READ 0x80 /* read EEPROM register addressed by */ + /* last 6 bits of this command */ +#define ID_EEPROM_MASK 0x3f /* these bits here */ +#define ID_SET_TAG 0xd0 /* set tag register to last 3 bits */ +#define ID_TAG_MASK 0x07 /* values 1..7 take tagged adapter */ + /* out of the contention process */ +#define ID_ACTIVATE 0xff /* activate adapter as pre-configured */ + +#define ID_SEQUENCE_INITIAL 0xff /* initial value in ID sequence */ +#define ID_SEQUENCE_LENGTH 255 /* iteration count */ +#define ID_CARRY_BIT 0x100 /* carry out of 8-bit ID value shift */ +#define ID_POLYNOMIAL 0xcf /* XOR this with ID value */ +#define ID_REGISTER_SIZE 16 /* bits in an EEPROM register */ + +/* important EEPROM addresses */ + +#define EE_A_PRODUCT_ID 0x03 /* 3C5xx product id */ +#define EE_A_MANUFACTURER 0x07 /* 3Com mfg. id == 0x6d50 */ +#define EE_A_ADDRESS 0x08 /* address configuration */ +#define EE_A_RESOURCE 0x09 /* resource configuration */ +#define EE_A_OEM_NODE_0 0x0a /* word 0 of OEM Ethernet address */ +#define EE_A_OEM_NODE_1 0x0b /* word 1 of OEM Ethernet address */ +#define EE_A_OEM_NODE_2 0x0c /* word 2 of OEM Ethernet address */ + +#define MANUFACTURER_ID 0x6d50 /* 3Com id code in EEPROM */ + +/* address configuration register fields and values */ + +#define AC_IO_BASE_MASK 0x001f /* I/O base address encoding */ + /* 0-30 select n * 0x10 + 0x200 */ +#define AC_IO_BASE_ZERO 0x0200 /* first encoded address */ +#define AC_IO_BASE_FACTOR 0x10 /* convert code to address range */ +#define AC_IO_BASE_EISA 0x001f /* EISA addressing indicator */ +#define AC_XCVR_MASK 0xc000 /* transciever selection field */ +#define AC_XCVR_TPE 0x0000 /* select twisted-pair (10BASE-T) */ +#define AC_XCVR_AUI 0x4000 /* select AUI (external transceiver) */ +#define AC_XCVR_BNC 0xc000 /* select BNC (10BASE-2); must also */ + /* activate with START_COAX command */ + +/* configuration control register bits */ + +#define CC_ENABLE 0x0001 /* set to enable IRQ driver */ +#define CC_RESET 0x0004 /* reset adapter to POR state */ +#define CC_POR_INTERNAL_ENDEC 0x0100 /* use internal encoder/decoder */ +#define CC_POR_10BASETAVAIL 0x0200 + /* on-board TPE transceiver available */ +#define CC_POR_TEST_MASK 0x0c00 /* test mode bits */ +#define CC_POR_TEST_RECEIVE 0x0400 /* receive test mode */ +#define CC_POR_TEST_TRANSMIT 0x0800 /* transmit test mode */ +#define CC_POR_TEST_NORMAL 0x0c00 /* normal operation mode */ +#define CC_POR_10BASE2_AVAIL 0x1000 + /* on-board coax transceiver available*/ +#define CC_POR_AUI_AVAIL 0x2000 /* on-board AUI connector evailable */ + +/* FIFO diagnostic register bits */ + +#define FD_TX_BC 0x0001 /* TX BIST is complete */ +#define FD_TX_BF 0x0002 /* TX BIST has failed */ +#define FD_TX_BFC 0x0004 /* sets TX BF to test for stuck-at */ +#define FD_TX_BIST 0x0008 /* enable BIST in TX FIFO RAM */ +#define FD_RX_BC 0x0010 /* TRX BIST is complete */ +#define FD_RX_BF 0x0020 /* RX BIST has failed */ +#define FD_RX_BFC 0x0040 /* sets RX BF to test for stuck-at */ +#define FD_RX_BIST 0x0080 /* enable BIST in RX FIFO RAM */ +#define FD_TX_OVERRUN 0x0400 /* host wrote too much data */ +#define FD_RX_OVERRUN 0x0800 /* RX overrun (not necessarily */ + /* packet overrun yet) */ +#define FD_RX_STATUS_OVERRUN 0x1000 /* already 8 packets in RX FIFO */ +#define FD_RX_UNDERRUN 0x2000 /* host read past end of packet */ +#define FD_RX_RECEIVING 0x8000 /* packet being received now */ + +/* media type and status bits */ + +#define MT_S_SQE_ENABLE 0x0008 /* enable SQE error detection */ +#define MT_S_COLLISION 0x0010 /* (?) collision in progress */ +#define MT_S_CARRIER 0x0020 /* (?) carrier sensed currently */ +#define MT_S_JABBER_ENABLE 0x0040 /* enable jabber and polarity detect */ +#define MT_S_LINK_BEAT_ENABLE 0x0080 /* enable TPE link beat */ +#define MT_S_UNSQUELCH 0x0100 /* unsquelch status */ +#define MT_S_JABBER 0x0200 /* jabber status */ +#define MT_S_POLARITY 0x0400 /* polarity swap status */ +#define MT_S_LINK_BEAT 0x0800 /* link beat correct status */ +#define MT_S_SQE 0x1000 /* SQE present status */ +#define MT_S_INTERNAL_ENDEC 0x2000 /* internal encoder/decoder in use */ +#define MT_S_BNC 0x4000 /* BNC transceiver in use */ +#define MT_S_AUI_DISABLE 0x8000 /* AUI interface disabled */ + +/* command opcodes (uppper 5 bits of command register) */ + +#define GLOBAL_RESET 0x0000 /* global reset (powerup equiv.) */ +#define SELECT_WINDOW 0x0800 /* select register window */ +#define START_COAX 0x1000 /* start coaxial transciever */ +#define RX_DISABLE 0x1800 /* disable ethernet receiver */ +#define RX_ENABLE 0x2000 /* enable ethernet receiver */ +#define RX_RESET 0x2800 /* reset ethernet receiver */ +#define RX_DISCARD 0x4000 /* discard remainder of top FIFO pkt */ +#define TX_ENABLE 0x4800 /* enable ethernet transmitter */ +#define TX_DISABLE 0x5000 /* disable ethernet transmitter */ +#define TX_RESET 0x5800 /* reset ethernet transmitter */ +#define REQ_INTERRUPT 0x6000 /* set interrupt requested bit */ +#define ACK_INTERRUPT 0x6800 /* acknowledge interrupt conditions */ +#define MASK_INTERRUPT 0x7000 /* set interrupt mask bits */ +#define MASK_STATUS 0x7800 /* set status mask bits */ + /* the "read zero mask" */ +#define SET_RX_FILTER 0x8000 /* set receive filter bits */ +#define SET_RX_THRESH 0x8800 /* set receive early threshold */ +#define SET_TX_AVAIL 0x9000 /* set transmit available threshold */ +#define SET_TX_START 0x9800 /* set transmit start threshold */ +#define STATS_ENABLE 0xa800 /* enable statistics collection */ +#define STATS_DISABLE 0xb000 /* disable statistics collection */ +#define STOP_COAX 0xb800 /* stop coaxial transciever */ +#define SET_TX_RECLAIM 0xc000 /* (MCA) set tx reclaim threshold */ + +/* receive filter command argument bits */ + +#define RX_F_STATION_IA 0x01 /* accept individual address */ +#define RX_F_MULTICAST 0x02 /* accept multicast (group) addresses */ +#define RX_F_BROADCAST 0x04 /* accept broadcast address */ +#define RX_F_PROMISCUOUS 0x08 /* accept all addresses */ +#define RX_F_NORMAL (RX_F_STATION_IA | RX_F_BROADCAST) + +/* board status bits (also acknowledge and mask bits) */ + +#define INTERRUPT_LATCH 0x0001 /* raise interrupt to host */ +#define ADAPTER_FAILURE 0x0002 /* error unrecoverable by adapter */ + /* tx overrun, rx underrun, or */ + /* hypothetical hardware errors */ +#define TX_COMPLETE 0x0004 /* tx finished with error or */ + /* packet interrupt bit was set */ +#define TX_AVAILABLE 0x0008 /* tx available threshold exceeded */ +#define RX_COMPLETE 0x0010 /* a complete packet is available */ +#define RX_EARLY 0x0020 /* rx early threshold exceeded */ +#define INTERRUPT_REQ 0x0040 /* set by request interrupt command */ +#define UPDATE_STATS 0x0080 /* one or more statistics counters */ + /* needs to be flushed */ +#define STATUS_MASK 0x00ff /* pick status bits out of register */ +#define COMMAND_IN_PROGRESS 0x1000 /* last command still being processed */ +#define WINDOW_MASK 0xe000 /* current register window selection */ + +/* transmit status register bits */ + +#define TX_S_RECLAIM 0x02 /* tx reclaim (MCA only) */ +#define TX_S_OVERFLOW 0x04 /* tx status overflow (lost info) */ +#define TX_S_MAX_COLL 0x08 /* maximum collisions reached */ +#define TX_S_UNDERRUN 0x10 /* underrun, tx reset required */ +#define TX_S_JABBER 0x20 /* jabber error, tx reset required */ +#define TX_S_INTERRUPT 0x40 /* interrupt on successful xmit */ +#define TX_S_COMPLETE 0x80 /* transmission complete */ + /* This bit denotes a valid status */ + /* when set; valid status is popped */ + /* off the stack by a write cycle to */ + /* the transmit status register */ + +/* transmit free bytes constants */ + +#define TX_IDLE_COUNT 0x7f8 /* 2,040; supposed to be 2,044 */ + /* use a >= test to see if tx idle */ + +/* receive status register bits */ + +#define RX_S_CNT_MASK 0x07ff /* received byte count field */ +#define RX_S_CODE_MASK 0x3800 /* error code field */ +#define RX_S_OVERRUN 0x0000 /* overrun error */ +#define RX_S_RUNT 0x1800 /* runt packet error */ +#define RX_S_ALIGN 0x2000 /* alignment (framing) error */ +#define RX_S_CRC 0x2800 /* CRC error */ +#define RX_S_OVERSIZE 0x0800 /* oversize packet error (>1514) */ +#define RX_S_DRIBBLE 0x1000 /* dribble bit(s); this code is */ + /* valid when error bit is not set */ +#define RX_S_ERROR 0x4000 /* error in rx packet, code above */ +#define RX_S_INCOMPLETE 0x8000 /* packet is incomplete or FIFO empty */ + /* opposite of transmit status! */ + +/* transmit packet preamble bits and fields */ + +#define TX_F_LEN_MASK 0x07ff /* length field */ +#define TX_F_INTERRUPT 0x8000 /* interrupt on transmit complete */ +#define TX_F_DWORD_MASK 0xfffc /* mask to round lengths to dword */ +#define TX_F_PREAMBLE_SIZE 4 /* size of packet length "preamble" */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCelt3c509Endh */ diff --git a/h/drv/end/emacEnd.h b/h/drv/end/emacEnd.h new file mode 100644 index 0000000..cda2fda --- /dev/null +++ b/h/drv/end/emacEnd.h @@ -0,0 +1,752 @@ +/* emacEnd.h - END based IBM EMAC Ethernet header */ + +/* +******************************************************************************* + This source and object code has been made available to you by IBM on an + AS-IS basis. + + IT IS PROVIDED WITHOUT WARRANTY OF ANY KIND, INCLUDING THE WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE OR OF NONINFRINGEMENT + OF THIRD PARTY RIGHTS. IN NO EVENT SHALL IBM OR ITS LICENSORS BE LIABLE + FOR INCIDENTAL, CONSEQUENTIAL OR PUNITIVE DAMAGES. IBMS OR ITS LICENSORS + DAMAGES FOR ANY CAUSE OF ACTION, WHETHER IN CONTRACT OR IN TORT, AT LAW OR + AT EQUITY, SHALL BE LIMITED TO A MAXIMUM OF $1,000 PER LICENSE. No license + under IBM patents or patent applications is to be implied by the copyright + license. + + Any user of this software should understand that neither IBM nor its + licensors will be responsible for any consequences resulting from the use + of this software. + + Any person who transfers this source code or any derivative work must + include the IBM copyright notice, this paragraph, and the preceding two + paragraphs in the transferred software. + + Any person who transfers this object code or any derivative work must + include the IBM copyright notice in the transferred software. + + COPYRIGHT I B M CORPORATION 2000 + LICENSED MATERIAL - PROGRAM PROPERTY OF I B M" + +******************************************************************************** +\NOMANUAL +*/ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01z,16jul04,jln add TAH definition; add tahBase for TAH; 2 Byte offset +01y,03sep04,mdo Documentation fixes for apigen +01x,30jun04,jln add pRxMblkArray member; 10 byte offset +01w,28may04,jln add EMAC_GIGABIT_CAPABLE_INTERFACE +01v,19may04,jb3 change local flags for SPR 95025 +01u,26aug03,jln change malLib.h to ibmMalDma.h; + define EMAC_RX_GROUP_POLL_ENABLE +01t,18aug03,jln add emacBspInfo structure; add burstLength +01s,24jul03,jln add pTxPollBufAdr member +01r,16jul03,jln rename ibmEmacEnd.h to emacEnd.h; add PHY definition +01q,24jun03,jln remove restart timer from EMAC_DRV_CTRL +01p,13jun03,jln modified EMAC_DRV_CTRL structure +01o,29may03,jln merge ibm440gx change for gigabit support; modify DRV_CTRL +01n,28may03,jtp Merge IBM changes; add CICADA PHY errata processing to ignore + Loss of Carrier Sense. +01m,06nov01,alr fix (SPR 71487) ibmEmacEnd: driver may instruct MUX to block + (EMAC_TX_BLOCKED/END_ERR_BLOCK) but never call muxTxRestart +01l,18oct01,mcg Polled mode fixes, added OPB speed variables to main struct. +01k,20aug01,kab Change ibmEmac to emac - max 4 letter boot dev in DHCP, other +01j,25jul01,pmr added macro to control memory allocation for loaning buffers +01i,10may01,mcg extensive changes to driver to remove data cache coherency + code, add support for both TX channels, add full-duplex flow + control support. 405 kernel must be used. +01h,09may01,pmr changed ENET_HDR_REAL_SIZ to SIZEOF_ETHERHEADER. +01g,29nov00,s_m changes from ibm +01f,02nov00,mcg added semMutexRX to device structure +01e,05jul00,mcg added phyAnlpr to device structure +01d,15may00,mcg register name updates to match 405GP User Manual +01c,03mar00 mcg Added bit fields. TX and RX descriptor queues to 64 entries +01b,07dec99 mcg Increased default TX and RX descriptor queues to 128 entries +01a,11oct99,mcg created. +*/ + +#ifndef __INCibmEmacEndh +#define __INCibmEmacEndh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "end.h" +#include "cacheLib.h" +#include "drv/dma/ibmMalDma.h" +#include "wdLib.h" + +/* + * Defines for inputFlags in the ibmEmacEnd load string. If none of the flags + * below are set in the input string, the driver will use one transmit + * channel, will use cached buffer/clusters (and manage the data cache + * coherency), and will do transmits without copying (zero copy). The flags + * below can be used change the default behavior. + */ + +#define EMAC_INPUT_TX_COPY 0x01 /* Do transmits with copy */ +#define EMAC_INPUT_UNCACHED_BUF 0x02 /* Use uncached buffers */ +#define EMAC_INPUT_TX_2_CHANNEL 0x04 /* Use both TX channels */ + +#define EMAC_RXCHAN_GROUP_ENABLE 0x1000 /* group all RX channels */ +#define EMAC_RXCHAN_GROUP_POLL_ENABLE 0x2000 /* polling in grouping mode */ + +#define EMAC_GIGABIT_CAPABLE_INTERFACE 0x4000 /* flag for 440GX Gigabit port */ +#define EMAC_XSUM_OFFLOAD_SUPPORT 0x8000 /* flag for 440GX XSUM support */ + +/* + * A common buffer descriptor structure is used for transmit and receive + * operations. Only the status/control bits have different meaning for TX + * and RX. Bits 0:5 are used to control the RX and TX behavior of MAL on a + * per-packet basis. See malLib.h for the MAL buffer descriptor structure, + * and the definitions of bits 0:5. + * + * Bits 6:15 are used to control the EMAC TX behavior, and to get status + * about the TX and RX behavior of the EMAC on a per packet basis. + */ + +/* EMAC Transmit Control */ +#define EMAC_TX_CTRL_GFCS 0x0200 /* Generate FCS */ +#define EMAC_TX_CTRL_GP 0x0100 /* Generate padding */ +#define EMAC_TX_CTRL_ISA 0x0080 /* Insert source address */ +#define EMAC_TX_CTRL_RSA 0x0040 /* Replace source address */ +#define EMAC_TX_CTRL_IVT 0x0020 /* Insert VLAN tag */ +#define EMAC_TX_CTRL_RVT 0x0010 /* Replace VLAN tag */ + +#define EMAC_TX_CTRL_XM_SSR0 0x0002 /* TCP xsum and seg on SSR0 */ +#define EMAC_TX_CTRL_XM_SSR1 0x0004 /* TCP xsum and seg on SSR1 */ +#define EMAC_TX_CTRL_XM_SSR2 0x0006 /* TCP xsum and seg on SSR2 */ +#define EMAC_TX_CTRL_XM_SSR3 0x0008 /* TCP xsum and seg on SSR3 */ +#define EMAC_TX_CTRL_XM_SSR4 0x000a /* TCP xsum and seg on SSR4 */ +#define EMAC_TX_CTRL_XM_SSR5 0x000c /* TCP xsum and seg on SSR5 */ +#define EMAC_TX_CTRL_XM_ONLY 0x000e /* tcp xsum only */ + +/* EMAC Transmit Status */ +#define EMAC_TX_STAT_BFCS 0x0200 /* Bad FCS in packet */ +#define EMAC_TX_STAT_BPP 0x0100 /* Bad previous packet */ +#define EMAC_TX_STAT_LCS 0x0080 /* Loss of carrier sense */ +#define EMAC_TX_STAT_ED 0x0040 /* Excessive deferral */ +#define EMAC_TX_STAT_EC 0x0020 /* Excessive collisions */ +#define EMAC_TX_STAT_LC 0x0010 /* Late collision */ +#define EMAC_TX_STAT_MC 0x0008 /* Multiple collision */ +#define EMAC_TX_STAT_SC 0x0004 /* Single collision */ +#define EMAC_TX_STAT_UR 0x0002 /* Underrun */ +#define EMAC_TX_STAT_SQE 0x0001 /* Signal quality error (SQE) */ +#define EMAC_TX_STAT 0x03FF /* All TX STAT bits above */ + +/* All the TX status bits that are considered errors */ +#ifdef CICADA_PHY_RGMII_10MPS_12DUPLEX_ERRATA +/* Ignore Loss of Carrier Sense Errors for Cicada PHY errata */ +#define EMAC_TX_ERRORS ( EMAC_TX_STAT_EC | \ + EMAC_TX_STAT_LC | EMAC_TX_STAT_UR | \ + EMAC_TX_STAT_SQE) +#else +#define EMAC_TX_ERRORS (EMAC_TX_STAT_LCS | EMAC_TX_STAT_EC | \ + EMAC_TX_STAT_LC | EMAC_TX_STAT_UR | \ + EMAC_TX_STAT_SQE) +#endif + +/* EMAC Receive Status */ +#define EMAC_RX_STAT_OE 0x0200 /* Overrun error */ +#define EMAC_RX_STAT_PP 0x0100 /* Pause packet received */ +#define EMAC_RX_STAT_BP 0x0080 /* Bad packet */ +#define EMAC_RX_STAT_RP 0x0040 /* Runt packet */ +#define EMAC_RX_STAT_SE 0x0020 /* Short event */ +#define EMAC_RX_STAT_AE 0x0010 /* Alignment error */ +#define EMAC_RX_STAT_BFCS 0x0008 /* Bad FCS */ +#define EMAC_RX_STAT_PTL 0x0004 /* Packet too long */ +#define EMAC_RX_STAT_ORE 0x0002 /* Out of range error */ +#define EMAC_RX_STAT_IRE 0x0001 /* In range error */ +#define EMAC_RX_STAT 0x03FF /* All RX STAT bits above */ + +/* Range error */ + +#define EMAC_RX_STAT_RE (EMAC_RX_STAT_IRE | EMAC_RX_STAT_ORE) + +/* RX XSUM error */ + +#define EMAC_RX_STAT_RX_XSUM EMAC_RX_STAT_RE + +/* All the RX status bits that are considered errors */ +#define EMAC_RX_ERRORS (EMAC_RX_STAT_OE | EMAC_RX_STAT_BP | \ + EMAC_RX_STAT_RP | EMAC_RX_STAT_SE | \ + EMAC_RX_STAT_AE | EMAC_RX_STAT_BFCS | \ + EMAC_RX_STAT_PTL | EMAC_RX_STAT_RE ) + +/* + * Default descriptor initialization values. + */ + +#define EMAC_TX_DESC_INIT (EMAC_TX_CTRL_GFCS | EMAC_TX_CTRL_GP) + +#define EMAC_RX_DESC_INIT (MAL_RX_CTRL_EMPTY | MAL_RX_CTRL_INTR) + + +/* Definitions for localFlags bits in the EMAC_DRV_CTRL structure */ + +#define EMAC_HANDLE_RX_RUNNING 0x01 /* HandleRcvInt job running */ +#define EMAC_POLLING_MODE 0x02 /* Currently in polling mode */ +#define EMAC_TX_CLEAN_RUNNING 0x04 /* TX clean in progress */ +#define EMAC_TX_BLOCKED 0x08 /* Ran out of TX descriptors */ +#define EMAC_TX_NOT_RESTARTED 0x10 /* netJob emacTxRestart running */ + +/* + * EMAC_BUF_SIZE is 1500 + 14 + 18 = 1532 which is 4 less than an even number + * of 32 byte cache lines. Add sizeof(long) cluster overhead and it is 1536. + * The 18 bytes is padding. + */ + +#define EMAC_BUF_SIZE (ETHERMTU + SIZEOF_ETHERHEADER + 18) +#define EMAC_MIN_FBUF 100 /* Minsize of first buffer in chain */ +#define EMAC_SPEED 10000000 /* 10Mbps */ +#define EMAC_RXD_MIN 8 /* minimum # of RX descriptors/MAL chn */ +#define EMAC_TXD_MIN 8 /* minimum # of TX descriptors/MAL chn */ +#define EMAC_RXD_DFT 64 /* default # of RX descriptors/MAL chn */ +#define EMAC_TXD_DFT 256 /* default # of TX descriptors/MAL chn */ +#define EMAC_RXD_MAX MAL_MAX_DESC /* max # of RX descriptors/MAL chn */ +#define EMAC_TXD_MAX MAL_MAX_DESC /* max # of TX descriptors/MAL chn */ + +#define EMAC_RXD_LOAN_X 4 /* multiply no. of RX desc. to allow */ + /* for buffer loaning */ +#define EMAC_RXBUF_OFFSET 0x2 /* force 2 byte offset */ + +#define EMAC_DEV_NAME "emac" /* Name of this device - max 4 char */ +#define EMAC_DEV_DESC "IBM EMAC End Driver" /* Description */ + +/* + * Basic unit, maximum, minimum, and default memory sizes. + * The sizeof(long) in EMAC_BSC_MEM_SIZE is for cluster overhead. + */ +#define EMAC_BSC_MEM_SIZE (EMAC_BUF_SIZE + sizeof(long)) + +#define EMAC_MAX_MEM_SIZE ((EMAC_RXD_MAX * EMAC_RXD_LOAN_X) * EMAC_BSC_MEM_SIZE) +#define EMAC_MIN_MEM_SIZE ((EMAC_RXD_MIN * EMAC_RXD_LOAN_X) * EMAC_BSC_MEM_SIZE) +#define EMAC_DFT_MEM_SIZE ((EMAC_RXD_DFT * EMAC_RXD_LOAN_X) * EMAC_BSC_MEM_SIZE) + +/* Multiple Individual and Group Address Filter definitions */ + +#define EMAC_FILTER_CRC_POLY 0x04C11DB6 +#define EMAC_ADDR_BYTES 6 +#define EMAC_ADDR_BITS 8 + +/* EMAC type */ + +#define EMAC_IBM_405GP 2 +#define EMAC_IBM_440GP 3 +#define EMAC_IBM_440GX 4 + +/* EMAC speed */ + +#define EMAC_SPEED_10Mbps 10 +#define EMAC_SPEED_100Mbps 100 +#define EMAC_SPEED_1000Mbps 1000 + +/* mode supported in EMAC */ + +#define PHY_MODE_DISABLED 0x00 +#define PHY_MODE_MII 0x01 +#define PHY_MODE_SMII 0x02 +#define PHY_MODE_RMII 0x03 +#define PHY_MODE_GMII 0x04 +#define PHY_MODE_RGMII 0x05 +#define PHY_MODE_TBI 0x06 +#define PHY_MODE_RTBI 0x07 + +#define PHY_TYPE_UNKNOWN 0xff + +#define PHY_HALF_DUPLEX 22 +#define PHY_FULL_DUPLEX 44 + +/* PHY register offsets */ + +#define PHY_BMCR 0x00 /* Basic Mode Control Reg */ +#define PHY_BMSR 0x01 /* Basic Mode Status Reg */ +#define PHY_PHYIDR1 0x02 /* PHY identifier Reg 1 */ +#define PHY_PHYIDR2 0x03 /* PHY identifier Reg 2 */ +#define PHY_ANAR 0x04 /* Auto-neg Advertisement Reg */ +#define PHY_ANLPAR 0x05 /* Auto-neg Link Partner Ability Reg */ +#define PHY_ANER 0x06 /* Auto-neg Expansion Reg */ +#define PHY_ANNPTR 0x07 /* Auto-neg Next Page TX */ +#define PHY_PHYSTS 0x10 /* PHY Status Reg */ +#define PHY_MIPSCR 0x11 +#define PHY_MIPGSR 0x12 +#define PHY_DCR 0x13 +#define PHY_FCSCR 0x14 +#define PHY_RECR 0x15 +#define PHY_PCSR 0x16 +#define PHY_LBR 0x17 +#define PHY_10BTSCR 0x18 +#define PHY_PHYCTRL 0x19 + +/* PHY BMCR */ + +#define PHY_BMCR_RESET 0x8000 +#define PHY_BMCR_LOOP 0x4000 +#define PHY_BMCR_100MB 0x2000 +#define PHY_BMCR_AUTON 0x1000 +#define PHY_BMCR_POWD 0x0800 +#define PHY_BMCR_ISO 0x0400 +#define PHY_BMCR_RST_NEG 0x0200 +#define PHY_BMCR_DPLX 0x0100 +#define PHY_BMCR_COL_TST 0x0080 + +/* PHY BMSR */ + +#define PHY_BMSR_100T4 0x8000 +#define PHY_BMSR_100TXF 0x4000 +#define PHY_BMSR_100TXH 0x2000 +#define PHY_BMSR_10TF 0x1000 +#define PHY_BMSR_10TH 0x0800 +#define PHY_BMSR_PRE_SUP 0x0040 +#define PHY_BMSR_AUTN_COMP 0x0020 +#define PHY_BMSR_RF 0x0010 +#define PHY_BMSR_AUTN_ABLE 0x0008 +#define PHY_BMSR_LS 0x0004 +#define PHY_BMSR_JD 0x0002 +#define PHY_BMSR_EXT 0x0001 + +/*PHY ANLPAR */ + +#define PHY_ANLPAR_NP 0x8000 +#define PHY_ANLPAR_ACK 0x4000 +#define PHY_ANLPAR_RF 0x2000 +#define PHY_ANLPAR_T4 0x0200 +#define PHY_ANLPAR_TXFD 0x0100 +#define PHY_ANLPAR_TX 0x0080 +#define PHY_ANLPAR_10FD 0x0040 +#define PHY_ANLPAR_10 0x0020 +#define PHY_ANLPAR_100 0x0380 + +/* PHY 10BTSCR */ + +#define PHY_10BTSCR_HBDS 0x0080 + +/* Structure to keep track of resources to be freed by ibmEmacSendCleanup */ + +typedef struct + { + UCHAR * pFree; /* Cluster address, Mblk, etc. */ + int descNum; /* desc num used for this packet */ + int lastIndex; /* last index for this packet */ + int typeFree; /* padding */ + } EMAC_FREE; + + +/* Structure to keep track of TX descriptor queue information */ + +typedef struct + { + volatile MAL_BD * pTxDesc; /* First descriptor in the TX ring */ + volatile int indexTxD; /* Current TX descriptor index */ + volatile int indexTxDClean; /* Current TX cleanup descriptor index*/ + int txFreeDesc; /* free descriptor in this channel */ + int numTxD; /* Number of TX descriptors */ + int freeMblkNum; /* Number of Mblk needed to be free */ + UINT getNewPacketTX; /* Write to EMAC_TMR0 to kick off TX */ + UINT fifoAeTX; /* Tx Fifo Almost Empty value */ + EMAC_FREE txFree[EMAC_TXD_MAX]; /* array of info for TX free cleanup */ + } TX_INFO; + +/* Flags used by the txFree arrays */ + +#define EMAC_TX_FREE_NONE 0 +#define EMAC_TX_FREE_CLUSTER 1 +#define EMAC_TX_FREE_MBLK 2 +#define EMAC_TX_FREE_MBLK_LAST 3 + +typedef struct emac_phy_info EMAC_PHY_INFO; + +typedef struct emacBspInfo + { + UINT emacBaseAdr; /* EMAC base address */ + int malTxChn0; /* TX channel 0 No. */ + int malTxChn1; /* TX channel 1 No. */ + int malRxChn0; /* RX channel 0 No. */ + + int intVec; /* Interrupt vector */ + int intLvl; /* Interrupt Level */ + int cacheLineSz; /* Cache line size */ + + int emacType; /* type of EMAC (405/440GP/440GX) */ + int burstLength; /* burst length */ + int phyAdrs; /* PHY address */ + int opbSpeedMhz; /* OPB bus speed in MHz */ + MAL_DATA * pMalData; /* pointer to MAL struct*/ + EMAC_PHY_INFO * pEmacPhyInfo; /* pointer to PHY_INFO struct */ + + UINT extFlag1; /* reserved flag 1 */ + UINT extFlag2; /* reserved flag 2 */ + UINT tahBase; /* TAH base address for EMAC2/3 */ + int tahIntLvl; /* TAH interrupt level */ + UINT reserved3; /* reserved 3 */ + UINT reserved4; /* reserved 4 */ + + void * pExtBspInfo; /* reserved forward compatibility */ + } EMAC_BSP_INFO; + +/* + * The definition of the overall driver control structure. Each instance of + * the driver creates its own copy of this structure. + */ + +typedef struct ibmEmacDevice + { + END_OBJ end; /* END_OBJ for this device */ + int unit; /* Unit number of this EMAC device */ + UINT baseAdrs; /* Base address of EMAC registers */ + UINT tahBase; /* Base address for TAH */ + UINT8 enetAddr[6]; /* Ethernet MAC address */ + int txChn0MalChannel; /* MAL channel # for EMAC TX channel 0*/ + int txChn1MalChannel; /* MAL channel # for EMAC TX channel 1*/ + int rxChn0MalChannel; /* MAL channel # for EMAC RX channel 0*/ + MAL_DATA * pMalData; /* ptr to MAL data for this EMAC */ + int numTxChannels; /* using 1 or 2 TX Channels */ + int txChannel; /* TX channel next for next transmit */ + TX_INFO txInfo[2]; /* Tx desc info */ + M_BLK_ID * pRxMblkArray; /* pointer to Mblk Array */ + volatile MAL_BD * pRxDesc; /* First descriptor in the RX ring */ + volatile int indexRxD; /* Current RX descriptor index */ + int maxRxCountPerInt; /* max Rx packets per ISR */ + int numRxD; /* Number of RX descriptors */ + int totalTxD; /* Number of TX descriptors */ + int ivec; /* Ethernet Interrupt vector */ + int ilevel; /* Ethernet Interrupt level */ + int phyAdrs; /* Address of PHY to be used */ + USHORT phyAnlpar; /* Results of auto-negotiation */ + char * memInputAdrs; /* Memory address from input string */ + char * memAdrsMalloc; /* Memory that was malloced */ + int memSizeMalloc; /* Size of memory that was malloced */ + char * memAdrs; /* Actual address to be used */ + int memInputSize; /* Memory size from input string */ + int memSize; /* Actual memory size to be used */ + UINT inputFlags; /* Flags passed in load string */ + volatile UINT localFlags; /* Local status flags */ + CACHE_FUNCS * pCacheFuncs; /* pointer to Cache function */ + CL_POOL_ID pClPoolId; /* Cluster pool Id */ + M_CL_CONFIG mClCfg; /* mBlk & cluster config structure */ + CL_DESC clDesc; /* Cluster descriptor table */ + END_ERR lastError; /* Last error sent to muxError */ + UINT errorEmac; /* saves last EMAC error */ + int intErrorTX; /* number of TX error interrupts */ + int intErrorRX; /* number of RX error interrupts */ + int cacheLineSize; /* size of the processor cache line */ + int opbSpeedMhz; /* OPB bus speed in MHz */ + UINT stacrOpbSpeed; /* used in STACR reg OPB speed field */ + volatile int txFreeDesc; /* number of free TX descriptor */ + int txIntDescCount; /* TX packets since last TX INT set */ + int wMarkLow; /* low water mark to set TX INT */ + int wMarkHigh; /* high water mark to cleanup TX desc */ + BOOL recount; /* flag to set TX interrupt */ + int lastIntPktCount; /* packet count since last TX INT set */ + UCHAR intNumTbl[64]; /* TX INT setup table */ + int txError; /* TX error counter */ + int txMacRestart; /* TX MAC restart counter */ + int txStallCount; /* TX stall counter */ + int txStallDescNum; /* required TX desc num to unblock */ + UINT32 txEoBIntCount; /* count of TX EOF interrrupt */ + int rxEoBIntCount; /* RX EOB interrupt count */ + int rxDescError; /* RX descriptor count */ + WDOG_ID monitorTimer; /* WD to monitor device */ + int monitorInterval; /* time to fire monitor timer in sec */ + int txPacketCount; /* statistic for TX packets */ + int rxPacketCount; /* statistic for RX packets */ + BOOL startFlag; /* device start flag */ + EMAC_PHY_INFO * phyInfo; /* PHY info structure */ + int emacType; /* EMAC type */ + int burstLength; /* burst length */ + EMAC_BSP_INFO *pEmacBspInfo; /* pointer to EMAC_BSP_INFO */ + STATUS linkStatus; /* link status */ + UINT phySpeed; /* PHY speed */ + UINT phyDuplex; /* PHY Duplex */ + UINT phyType; /* PHY type */ + char * pTxPollBufAdr; /* cache-safe buffer for TX polling */ + int initType; /* buffer initialization typr */ + int tahIntLvl; /* TAH interrupt */ + BOOL xsumUsrflag; /* IP/TCP/UDP XSUM flag */ + BOOL tahEnableFlag; /* TAH enabled in BSP */ + END_CAPABILITIES hwCaps; /* interface capability structure */ + } EMAC_DRV_CTRL; + +/* Struct for PHY information */ + +struct emac_phy_info + { + STATUS (* phyPreInit)(EMAC_DRV_CTRL *); /* PHY/MAC interface setup func */ + void (* phyPreConfig)(EMAC_DRV_CTRL *); /* Pre autoNegotiation func */ + STATUS (* phyConfigStart)(EMAC_DRV_CTRL *, UINT); /* start auto negotiation func */ + void (* phyPostConfig)(EMAC_DRV_CTRL *); /* Post autoNegotiation func */ + UINT (* phySpeedGet)(EMAC_DRV_CTRL *); /* phySpeedGet func pointer */ + UINT (* phyDuplexGet)(EMAC_DRV_CTRL *); /* phyDuplexGet func pointer */ + UINT (* phyTypeGet)(EMAC_DRV_CTRL *); /* phyTypeGet func pointer */ + UINT reserved1; /* reserved 1 */ + UINT reserved2; /* reserved 2 */ + UINT reserved3; /* reserved 3 */ + UINT reserved4; /* reserved 4 */ + }; + +/* + * TAH register and BIT definitions + * The base address of TAH0/TAH1 is passed by loadstring + */ + +#define TAH_REVID 0x50 /* Revision ID */ +#define TAH_MR 0x60 /* Mode */ +#define TAH_SSR0 0x64 /* Segment size 0 */ +#define TAH_SSR1 0x68 /* Segment size 1 */ +#define TAH_SSR2 0x6c /* Segment size 2 */ +#define TAH_SSR3 0x70 /* Segment size 3 */ +#define TAH_SSR4 0x74 /* Segment size 4 */ +#define TAH_SSR5 0x78 /* Segment size 5 */ +#define TAH_TSR 0x7c /* Transmit status (RO) */ + +/* TAH REVID register bits */ + +#define TAH_REVID_RN 0x000fff00 /* REVID_RN */ +#define TAH_REVID_BRN 0x000000FF /* REVID_BRN */ + +/* TAH Mode register bits */ + +#define TAH_MR_CVR 0x80000000 /* XSUM verify on RX */ +#define TAH_MR_SR 0x40000000 /* reset */ +#define TAH_MR_ST 0x3f000000 /* send threshod */ +#define TAH_MR_TFS 0x00e00000 /* TX FIFO size */ +#define TAH_MR_DTFP 0x00100000 /* parity protection */ +#define TAH_MR_DIG 0x00010000 /* TAH interrupt */ + +#define TAH_MR_ST_256 0x01000000 /* 256B Send Threshold */ +#define TAH_MR_ST_512 0x02000000 /* 512B Send Threshold */ +#define TAH_MR_ST_1024 0x04000000 /* 1024B Send Threshold */ +#define TAH_MR_ST_1536 0x06000000 /* 1536B Send Threshold */ + +#define TAH_MR_TFS_2K 0x00200000 /* 2K for TFS */ +#define TAH_MR_TFS_4K 0x00400000 /* 4K for TFS */ +#define TAH_MR_TFS_6K 0x00600000 /* 6K for TFS */ +#define TAH_MR_TFS_8K 0x00800000 /* 8K for TFS */ +#define TAH_MR_TFS_10K 0x00A00000 /* 10K for TFS */ +#define TAH_MR_TFS_16K 0x00000000 /* 16K for TFS */ + +/* TAH Segment Size Registers(0 - 5) bits */ + +#define TAH_SSR_SS 0x3ffe0000 /* Segment Size */ + +/* TAH transmit status register bits */ + +#define TAH_TSR_TFTS 0x80000000 /* TX FIFO too small */ +#define TAH_TSR_UH 0x40000000 /* Unrecognized header */ +#define TAH_TSR_NIPF 0x20000000 /* Not IP V4 */ +#define TAH_TSR_IPOP 0x10000000 /* IP Option present */ +#define TAH_TSR_NISF 0x08000000 /* No IEEE SNAP Format */ +#define TAH_TSR_ILTS 0x04000000 /* ip length too short */ +#define TAH_TSR_IPFP 0x02000000 /* ip fragment present */ +#define TAH_TSR_UP 0x01000000 /* Upsupported Protocal */ +#define TAH_TSR_TFP 0x00800000 /* some TCP flag present */ +#define TAH_TSR_SUDP 0x00400000 /* Segmentation for UDP */ +#define TAH_TSR_DLM 0x00200000 /* Data length mismatch */ +#define TAH_TSR_SIEEE 0x00100000 /* segmentation for IEEE */ +#define TAH_TSR_TFPE 0x00080000 /* TX Fifo parity error */ +#define TAH_TSR_SSTS 0x00040000 /* Segment size too small */ + +/* + * Ethernet Register and Register Bit Definitions + * The base address of the EMAC is one of the load string parameters. + */ + +#define EMAC_MR0 0x00 /* Mode Reg 0 */ +#define EMAC_MR1 0x04 /* Mode Reg 1 */ +#define EMAC_TMR0 0x08 /* Transmit Mode 0 */ +#define EMAC_TMR1 0x0C /* Transmit Mode 1 */ +#define EMAC_RMR 0x10 /* Receive Mode */ +#define EMAC_ISR 0x14 /* Interrupt Status */ +#define EMAC_ISER 0x18 /* Interrupt Status Enable */ +#define EMAC_IAHR 0x1C /* Individual Adrs High */ +#define EMAC_IALR 0x20 /* Individual Adrs Low */ +#define EMAC_VTPID 0x24 /* VLAN TPID Reg */ +#define EMAC_VTCI 0x28 /* VLAN TCI Reg */ +#define EMAC_PTR 0x2C /* Pause Timer */ +#define EMAC_IAHT1 0x30 /* Ind Adrs Hash Table 1 */ +#define EMAC_IAHT2 0x34 /* Ind Adrs Hash Table 2 */ +#define EMAC_IAHT3 0x38 /* Ind Adrs Hash Table 3 */ +#define EMAC_IAHT4 0x3C /* Ind Adrs Hash Table 4 */ +#define EMAC_GAHT1 0x40 /* Group Adrs Hash Table 1 */ +#define EMAC_GAHT2 0x44 /* Group Adrs Hash Table 2 */ +#define EMAC_GAHT3 0x48 /* Group Adrs Hash Table 3 */ +#define EMAC_GAHT4 0x4C /* Group Adrs Hash Table 4 */ +#define EMAC_LSAH 0x50 /* Last Source Adrs High */ +#define EMAC_LSAL 0x54 /* Last Source Adrs Low */ +#define EMAC_IPGVR 0x58 /* Inter-Frame Gap Value */ +#define EMAC_STACR 0x5C /* STA Control */ +#define EMAC_TRTR 0x60 /* TX Request Threshold */ +#define EMAC_RWMR 0x64 /* RX High/Low Water Mark */ +#define EMAC_OCTX 0x68 /* MIB Octets transmitted */ +#define EMAC_OCRX 0x6C /* MIB Octets received */ + + +/* + * EMAC Mode Reg 0 bit definitions + */ +#define EMAC_MR0_RXI 0x80000000 /* RX MAC idle */ +#define EMAC_MR0_TXI 0x40000000 /* TX MAC idle */ +#define EMAC_MR0_SRST 0x20000000 /* Soft reset */ +#define EMAC_MR0_TXE 0x10000000 /* TX MAC enable */ +#define EMAC_MR0_RXE 0x08000000 /* RX MAC enable */ +#define EMAC_MR0_WKE 0x04000000 /* Wake up enable */ + +#define EMAC_MR0_BOTH_IDLE (EMAC_MR0_RXI | EMAC_MR0_TXI) + +/* + * EMAC Mode Reg 1 bit definitions + */ +#define EMAC_MR1_FDE 0x80000000 /* Full Duplex enable */ +#define EMAC_MR1_ILE 0x40000000 /* Internal loopback */ +#define EMAC_MR1_VLE 0x20000000 /* VLAN enable */ +#define EMAC_MR1_EIFC 0x10000000 /* Enable Int. Flow Control */ +#define EMAC_MR1_APP 0x08000000 /* Allow pause packet */ +#define EMAC_MR1_IST 0x01000000 /* Ignore SQE test */ + +#define EMAC_MR1_MF_10MBPS 0x00000000 /* Medium frequency = 10Mbps */ +#define EMAC_MR1_MF_100MBPS 0x00400000 /* Medium frequency = 100Mbps */ +#define EMAC_MR1_MF_1GBPS 0x00800000 /* Medium frequency = 1000Mbps*/ +#define EMAC_MR1_MF_1GBPS_GPCS 0x00C00000 /* 1000Mbps using GPCS */ +#define EMAC_MR1_RFS_512 0x00000000 /* Receive FIF0 = 512B */ +#define EMAC_MR1_RFS_1K 0x00080000 /* Receive FIF0 = 1KB */ +#define EMAC_MR1_RFS_2K 0x00100000 /* Receive FIF0 = 2KB */ +#define EMAC_MR1_RFS_4K 0x00180000 /* Receive FIF0 = 4KB */ +#define EMAC_MR1_RFS_8K 0x00200000 /* Receive FIF0 = 8KB */ +#define EMAC_MR1_RFS_16K 0x00280000 /* Receive FIF0 = 16KB */ +#define EMAC_MR1_TFS_512 0x00000000 /* Transmit FIFO = 512B */ +#define EMAC_MR1_TFS_1K 0x00010000 /* Transmit FIFO = 1KB */ +#define EMAC_MR1_TFS_2K 0x00020000 /* Transmit FIFO = 2KB */ +#define EMAC_MR1_TFS_4K 0x00030000 /* Transmit FIFO = 4KB */ +#define EMAC_MR1_TFS_8K 0x00040000 /* Transmit FIFO = 8KB */ +#define EMAC_MR1_TFS_16K 0x00050000 /* Transmit FIFO = 16KB */ + +/* walnut/ebony only */ +#define EMAC_MR1_TR0_SINGLE 0x00000000 /* TX 0 single packet mode */ +#define EMAC_MR1_TR0_DEPEND 0x00010000 /* TX 0 multi packet mode */ +#define EMAC_MR1_TR0_MULTI 0x00008000 /* TX 0 dependent mode */ +#define EMAC_MR1_TR1_SINGLE 0x00000000 /* TX 1 single packet mode */ +#define EMAC_MR1_TR1_DEPEND 0x00004000 /* TX 1 multi packet mode */ +#define EMAC_MR1_TR1_MULTI 0x00002000 /* TX 1 dependent mode */ + +#define EMAC_MR1_TR 0x00008000 /* Transmit request */ +#define EMAC_MR1_MWSW 0x00007000 /* Max wait status words */ +#define EMAC_MR1_MWSW_VAL 0x00001000 /* Max wait status words val */ +#define EMAC_MR1_JPSM 0x00000800 /* Jumbo packet support mode */ +#define EMAC_MR1_IPPA 0x000007C0 /* Internal PCS PHY address */ +#define EMAC_MR1_IPPA_ENCODE(n) ((((unsigned long)(n))&0x1F)<<6) +#define EMAC_MR1_OBCI 0x00000038 /* OPB bus clock indication */ +#define EMAC_MR1_OBCI_50MHZ 0x00000000 /* OPB bus clock freq 50MHz */ +#define EMAC_MR1_OBCI_66MHZ 0x00000008 /* OPB bus clock freq 66MHz */ +#define EMAC_MR1_OBCI_83MHZ 0x00000010 /* OPB bus clock freq 83MHz */ +#define EMAC_MR1_OBCI_100MHZ 0x00000018 /* OPB bus clock freq 100MHz */ +#define EMAC_MR1_OBCI_G100MHZ 0x00000020 /* OPB bus clock freq 100MHz */ + +/* + * EMAC Transmit Mode Register 0 bit definitions + */ +#define EMAC_TMR0_GNP0 0x80000000 /* TX 0 get new packet */ +#define EMAC_TMR0_GNP1 0x40000000 /* TX 1 get new packet */ + +/* walnut / ebony only */ +#define EMAC_TMR0_GNPD 0x20000000 /* TX dependent get new packet */ +#define EMAC_TMR0_FC 0x10000000 /* First channel */ + +#define EMAC_TMR0_TFAE 0x00000007 /* TX fifo almost empty */ +#define EMAC_TMR0_TFAE_DIS 0x00000007 /* '111'b disables */ + +/* + * EMAC Receive Mode Register bit definitions + */ +#define EMAC_RMR_SP 0x80000000 /* Strip padding */ +#define EMAC_RMR_SFCS 0x40000000 /* Strip FCS */ +#define EMAC_RMR_RRP 0x20000000 /* RX runt packets */ +#define EMAC_RMR_RFP 0x10000000 /* RX packets with FCS error */ +#define EMAC_RMR_ROP 0x08000000 /* RX oversize packets */ +#define EMAC_RMR_RPIR 0x04000000 /* RX packets w/ inrange error */ +#define EMAC_RMR_PPP 0x02000000 /* Propagate pause packets */ +#define EMAC_RMR_PME 0x01000000 /* Promiscuous mode enable */ +#define EMAC_RMR_PMME 0x00800000 /* Promiscuous multicast mode */ +#define EMAC_RMR_IAE 0x00400000 /* Individual address enable */ +#define EMAC_RMR_MIAE 0x00200000 /* Multiple individual address */ +#define EMAC_RMR_BAE 0x00100000 /* Broadcast address enable */ +#define EMAC_RMR_MAE 0x00080000 /* Multicast address enable */ +#define EMAC_RMR_RFAF 0x00000007 /* Rx Fifo Almost Full */ +#define EMAC_RMR_RFAF_DIS 0x00000007 /* '111'b disables */ + +/* + * EMAC Interrupt Status & Enable registers bit definitions + */ +/* RX bits */ +#define EMAC_ISR_OVR 0x02000000 /* Overrun error */ +#define EMAC_ISR_PP 0x01000000 /* Pause packet received */ +#define EMAC_ISR_BP 0x00800000 /* Bad packet */ +#define EMAC_ISR_RP 0x00400000 /* Runt packet */ +#define EMAC_ISR_SE 0x00200000 /* Short event */ +#define EMAC_ISR_SYE 0x00100000 /* Symbol error */ +#define EMAC_ISR_BFCS 0x00080000 /* Bad FCS */ +#define EMAC_ISR_PTLE 0x00040000 /* Packet too long */ +#define EMAC_ISR_ORE 0x00020000 /* Out of range error */ +#define EMAC_ISR_IRE 0x00010000 /* In range error */ +/* TX bits */ +#define EMAC_ISR_DBDM 0x00000200 /* Dead bit TX dependent mode */ +#define EMAC_ISR_DB0 0x00000100 /* Dead bit TX channel 0 */ +#define EMAC_ISR_SE0 0x00000080 /* SQE error TX channel 0 */ +#define EMAC_ISR_TE0 0x00000040 /* TX error channel 0 */ +#define EMAC_ISR_DB1 0x00000020 /* Dead bit TX channel 1 */ +#define EMAC_ISR_SE1 0x00000010 /* SQE error TX channel 1 */ +#define EMAC_ISR_TE1 0x00000008 /* TX error channel 1 */ +#define EMAC_ISR_MOS 0x00000002 /* MMA operation succeeded */ +#define EMAC_ISR_MOF 0x00000001 /* MMA operation failed */ +#define EMAC_ISR_NO_INTS 0x00000000 /* No interrupts */ + +/* The set of bits above we want to cause an Ethernet interrupt for RX error */ + +#define EMAC_ISR_RX_INTS 0 + +/* The set of bits above we want to cause an Ethernet interrupt for TX error */ + +#define EMAC_ISR_TX_INTS 0 + +/* + * EMAC MII station management unit (STA Control) register bit definitions + */ +#define EMAC_STACR_OC 0x00008000 /* Operation complete */ +#define EMAC_STACR_PHYE 0x00004000 /* PHY error */ +#define EMAC_STACR_WRITE 0x00002000 /* STA command WRITE */ +#define EMAC_STACR_READ 0x00001000 /* STA command READ */ + +/* Walnut / Ebony only */ +#define EMAC_STACR_CLK_50MHZ 0x00000000 /* OPB bus clock freq 50MHz */ +#define EMAC_STACR_CLK_83MHZ 0x00000800 /* OPB bus clock freq 83MHz */ +#define EMAC_STACR_CLK_66MHZ 0x00000400 /* OPB bus clock freq 66MHz */ +#define EMAC_STACR_CLK_100MHZ 0x00000C00 /* OPB bus clock freq 100MHz */ + +/* + * EMAC Transmit Request Threshold Register bit definitions + */ +#define EMAC_TRTR_64 0x00000000 +#define EMAC_TRTR_128 0x01000000 +#define EMAC_TRTR_192 0x02000000 +#define EMAC_TRTR_256 0x03000000 +#define EMAC_TRTR_1024 0x0F000000 +#define EMAC_TRTR_1536 0x17000000 + +#if defined(__STDC__) || defined(__cplusplus) +#else +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCibmEmacEndh */ diff --git a/h/drv/end/fei82557End.h b/h/drv/end/fei82557End.h new file mode 100644 index 0000000..6859324 --- /dev/null +++ b/h/drv/end/fei82557End.h @@ -0,0 +1,738 @@ +/* fei82557End.h - Intel 82557 network interface header */ + +/* Copyright 1990-2005 Wind River Systems, Inc. */ +/* + +modification history +-------------------- +01r,16feb05,pmr macrotized the 32-byte alignment used by device. +01q,26jan05,pmr SPR 102537: make CFD_SIZE a multiple of cache line size. +01p,17may04,mdo Add include file to fix compilation error when included in + the wrSbc405gp BSP +01o,26mar04,dlk Fix incorrect usage of 'volatile' keyword. +01n,28jan04,wap Add checksum offload support +01m,24feb03,rcs added added definition of RFD_DESC_SIZE SPR#86352 +01l,23jan03,rcs Added RBD_TAG struct +01k,20sep01,dat Removing ANSI errors for diab compiler +01j,28sep00,jgn remove physical to virtual translations (SPR 34891) +01i,13sep00,jkf T3 SPR#33822 (aka T2 SPR's 33792, 33795, and 33796) +01i,11jun00,ham removed reference to etherLib. +01h,06nov99,dat Merge from tor3_x.bsp_drv_facility branch +01g,12nov99,mas added typecasting to non-PPC FEI_XXXX_RD macros (SPR 24474) +01f,21mar99,jkf Added PPC access routines needed for Yellowknife. +01e,21jul98,cn Moved here some redefineable macros +01d,01apr98,cn added vendor and device id definitions +01c,11mar98,cn checked-in +01b,05mar98,cn code clean-up after code review +01a,07nov97,cn created from ../netif/if_fei.h, version 01c +*/ + +#ifndef __INCfei82557Endh +#define __INCfei82557Endh + +/* includes */ +#include "netBufLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* defines */ + +/* + * redefine the macro below in the bsp if you need to access the device + * registers/descriptors in a more suitable way. + */ + + +#if (CPU_FAMILY == PPC) + +#ifndef FEI_LONG_WR +#define FEI_LONG_WR(addr, value) (sysOutLong ((ULONG) addr, (ULONG) value)) +#endif + +#ifndef FEI_WORD_WR +#define FEI_WORD_WR(addr, value) (sysOutWord ((ULONG) addr, (USHORT) value)) +#endif + +#ifndef FEI_BYTE_WR +#define FEI_BYTE_WR(addr, value) (sysOutByte ((ULONG) addr, (UCHAR) value)) +#endif + +#ifndef FEI_LONG_RD +#define FEI_LONG_RD(addr, value) (value = sysInLong ((ULONG) addr)) +#endif + +#ifndef FEI_WORD_RD +#define FEI_WORD_RD(addr, value) (value = sysInWord ((ULONG) addr)) +#endif + +#ifndef FEI_BYTE_RD +#define FEI_BYTE_RD(addr, value) (value = sysInByte ((ULONG) addr)) +#endif + +#endif /* CPU_FAMILY == PPC */ + +#ifndef FEI_LONG_WR +#define FEI_LONG_WR(addr, value) \ + (* (volatile UINT32 *) (addr) = ((UINT32) FEI_SWAP_LONG (value) )) +#endif /* FEI_LONG_WR */ + +#ifndef FEI_WORD_WR +#define FEI_WORD_WR(addr, value) \ + (* (volatile UINT16 *) (addr) = ((UINT16) FEI_SWAP_WORD (value) )) +#endif /* FEI_WORD_WR */ + +#ifndef FEI_BYTE_WR +#define FEI_BYTE_WR(addr, value) \ + (* (volatile UINT8 *) (addr) = (UINT8) (value) ) +#endif /* FEI_BYTE_WR */ + +#ifndef FEI_LONG_RD +#define FEI_LONG_RD(addr, value) \ + do { \ + UINT32 _temp_ = *(volatile UINT32 *)(addr); \ + (value) = (UINT32) FEI_SWAP_LONG (_temp_); \ + } while (0) +#endif /* FEI_LONG_RD */ + +#ifndef FEI_WORD_RD +#define FEI_WORD_RD(addr, value) \ + do { \ + UINT16 _temp_ = *(volatile UINT16 *)(addr); \ + (value) = (UINT16) FEI_SWAP_WORD (_temp_); \ + } while (0) +#endif /* FEI_WORD_RD */ + +#ifndef FEI_BYTE_RD +#define FEI_BYTE_RD(addr, value) \ + do { \ + (value) = (UINT8) (*(volatile UINT8 *)(addr)); \ + } while (0) +#endif /* FEI_BYTE_RD */ + +/* + * Default macro definitions for BSP interface. + * These macros can be redefined in a wrapper file, to generate + * a new module with an optimized interface. + */ + +#ifndef SYS_INT_CONNECT +#define SYS_INT_CONNECT(pDrvCtrl, pFunc, arg, pRet) \ + { \ + /* SPR 33796/33822 - init SYS_INT_CONNECT's return value" to ERROR */ \ + *pRet = ERROR; \ + \ + /* SPR 33792 - remove FEI_VECTOR checking from SYS_INT_CONNECT */ \ + /* SPR 33795 - add feiEndIntConnect NULL checking in SYS_INT_CONNECT */ \ + if (feiEndIntConnect != NULL) \ + { \ + *pRet = (feiEndIntConnect) ((VOIDFUNCPTR*) \ + INUM_TO_IVEC (FEI_VECTOR (pDrvCtrl)), \ + (pFunc), (int) (arg)); \ + } \ + } +#endif /* SYS_INT_CONNECT */ + +#ifndef SYS_INT_DISCONNECT +#define SYS_INT_DISCONNECT(pDrvCtrl, pFunc, arg, pRet) \ + { \ + /* SPR 33796 - initialize SYS_INT_DISCONNECT's return value to ERROR */ \ + *pRet = ERROR; \ + \ + /* SPR 33792 - remove FEI_VECTOR checking from SYS_INT_DISCONNECT */ \ + if (feiEndIntDisconnect != NULL) \ + { \ + *pRet = feiEndIntDisconnect ((VOIDFUNCPTR*) \ + INUM_TO_IVEC (FEI_VECTOR (pDrvCtrl)), \ + (pFunc)); \ + } \ + } +#endif /* SYS_INT_DISCONNECT */ + +#ifndef SYS_INT_ENABLE +#define SYS_INT_ENABLE(pDrvCtrl) \ +if (FEI_INT_ENABLE (pDrvCtrl)) \ + ((*(FUNCPTR) (FEI_INT_ENABLE (pDrvCtrl))) (pDrvCtrl->unit)) +#endif /*SYS_INT_ENABLE*/ + +#ifndef SYS_INT_DISABLE +#define SYS_INT_DISABLE(pDrvCtrl) \ +if (FEI_INT_DISABLE (pDrvCtrl)) \ + ((*(FUNCPTR) (FEI_INT_DISABLE (pDrvCtrl))) (pDrvCtrl->unit)) +#endif /*SYS_INT_DISABLE*/ + +#ifndef SYS_INT_ACK +#define SYS_INT_ACK(pDrvCtrl) \ +if (FEI_INT_ACK (pDrvCtrl)) \ + ((*(FUNCPTR) (FEI_INT_ACK (pDrvCtrl))) (pDrvCtrl->unit)) +#endif /*SYS_INT_ACK*/ + +#ifndef LOCAL_TO_SYS_ADDR +#define LOCAL_TO_SYS_ADDR(unit,localAddr) \ + ((int) pDrvCtrl->board.sysLocalToBus ? \ + (*pDrvCtrl->board.sysLocalToBus) (unit, localAddr) : localAddr) +#endif /* LOCAL_TO_SYS_ADDR */ + +#ifndef SYS_TO_LOCAL_ADDR +#define SYS_TO_LOCAL_ADDR(unit,sysAddr) \ + ((int) pDrvCtrl->board.sysBusToLocal ? \ + (*pDrvCtrl->board.sysBusToLocal)(unit, sysAddr) : sysAddr) +#endif /* SYS_TO_LOCAL_ADDR */ + +/* Intel PRO-100B PCI specific definitions */ + +#define PRO100B_PCI_VENDOR_ID 0x8086 /* PCI vendor ID */ +#define PRO100B_PCI_DEVICE_ID 0x1229 /* PCI device ID */ + +#define FEI82557_DEVICE_ID 0x1229 /* 82557 device ID */ +#define FEI82550_DEVICE_ID 0x9999 /* 82550 pseudo device ID */ + +#define MC_FEI MC_EI /* temp */ + +#define DEV_NAME "fei" +#define DEV_NAME_LEN 4 +#define DEF_NUM_CFDS 64 /* default number of CFDs */ +#define DEF_NUM_RFDS 128 /* default number of RFDs */ +#define FEI_100MBS 100000000 /* bits per sec */ +#define FEI_10MBS 10000000 /* bits per sec */ +#define EADDR_LEN 6 /* ethernet address length */ +#define FEI_ADDR_LEN EADDR_LEN /* ethernet address length */ + +#define FEI_ACTION_TMO 0x01 /* action command timeout in seconds */ +#define FEI_SCB_TMO 0x01 /* SCB command timeout in seconds */ +#define FEI_INIT_TMO 0x01 /* 557 init timeout in seconds */ +#define FEI_TX_RESTART_TMO 0x01 /* tx restart watchdog timeout */ +#define FEI_TCB_TX_THRESH 0x10 /* Tx threshold value */ + +/* Cluster Size */ +#define CLUSTER_SIZE 1536 + +/* RFD and CFD size */ +#define DESC_ALIGN 32 +#define RFD_SIZE_HDR 16 + + /* The RFD wants to be 32 byte aligned so is rounded up to 32 */ +#define RFD_SIZE_HDR 16 +#define RFD_SIZE_EXTHDR 16 +#define RFD_SIZE_PKT (EH_SIZE + ETHERMTU + 2) +#define RFD_SIZE_TRAIL RFD_SIZE_PREV + RFD_SIZE_SW_NEXT +#define RFD_SIZE_PREV 4 +#define RFD_SIZE_SW_NEXT 4 + +#define RFD_SIZE ROUND_UP ((RFD_SIZE_HDR + \ + RFD_SIZE_EXTHDR + \ + RFD_SIZE_PKT + \ + RFD_SIZE_TRAIL), 4) + +#define RFD_DESC_SIZE DESC_ALIGN + +#define RFD_STATUS_NONE 0x00 +#define RFD_STATUS_START 0x01 +#define RFD_STATUS_EL 0x02 + +#define FIRST_RFD 0x00 +#define LAST_RFD 0xff +#define MID_RFD 0x12 + + + /* The actual RBD size is 16 bytes but wants to be 32 byte aligned */ + +#define RBD_SIZE DESC_ALIGN + +#define RBD_STATUS_FREE 0x00 +#define RBD_STATUS_DMA 0x01 +#define RBD_STATUS_MISSED 0x03 +#define RBD_STATUS_EL_SEEN 0x55 +#define RBD_STATUS_BAD 0xff +#define RBD_FORCE_REQUEUE 0xff + +#define RBD_TAG_FREE 0x00 +#define RBD_TAG_DMA 0x01 +#define RBD_TAG_RING 0x02 +#define RBD_TAG_BAD 0xff + +#define CFD_SIZE_HDR 8 +#define CFD_SIZE_DUMP 4 +#define CFD_SIZE_MULTIC (2 + (6 * N_MCAST)) +#define CFD_SIZE_IA 8 +#define CFD_SIZE_NOP 0 +#define CFD_SIZE_PKT (EH_SIZE + ETHERMTU + 2) +#define CFD_SIZE_TCB (8 + CFD_SIZE_PKT) +#define CFD_SIZE_PREV 4 +#define CFD_SIZE_SW_NEXT 4 +#define CFD_SIZE_ACTION 1 +#define CFD_SIZE_TRAIL (CFD_SIZE_PREV + \ + CFD_SIZE_SW_NEXT + \ + CFD_SIZE_ACTION) +#define CFD_SIZE_CORE CFD_SIZE_TCB + + /* The CFD wants to be 32 byte aligned so is rounded up to 32 */ + +#define CFD_SIZE ROUND_UP ((CFD_SIZE_HDR + \ + CFD_SIZE_CORE + \ + CFD_SIZE_TRAIL), DESC_ALIGN) + +/* frame descriptors definitions */ + +#define CFD_STAT_OFFSET 0x00 /* status word */ +#define CFD_COMM_OFFSET 0x02 /* command word */ +#define CFD_NEXT_OFFSET 0x04 /* next frame */ +#define CFD_PREV_OFFSET (CFD_SIZE - 4) /* previous frame */ +#define CFD_TBD_ADDR_OFFSET 0x08 /* buffer descriptor*/ +#define CFD_COUNT_OFFSET 0x0c /* count field */ +#define CFD_NUM_OFFSET 0x0f /* buffer num field */ +#define CFD_THRESH_OFFSET 0x0e /* threshold field */ + +/* + * Extended CFD offsets (present in 82550 and 82551 only). These + * are used when we issue an IPCB transmit command, which gives us + * extra fields that allow the use of TX checksum offload. + */ +#define CFD_SCHEDLO_OFFSET 0x10 /* 16 bits */ +#define CFD_IPSCHED_OFFSET 0x12 /* 8 bits */ +#define CFD_IPACTIVATEHI_OFFSET 0x13 /* 8 bits */ +#define CFD_VLAN_OFFSET 0x14 /* 16 bits */ +#define CFD_IPHDROFF_OFFSET 0x16 /* 8 bits */ +#define CFD_TCPUDPHDROFF_OFFSET 0x17 /* 8 bits */ +#define CFD_TBDZEROPTR_OFFSET 0x18 /* 32 bits */ +#define CFD_TBDZEROSIZE_OFFSET 0x1C /* 16 bits */ +#define CFD_TOTALTCPLEN_OFFSET 0x1E /* 16 bits */ + +#define CFD_ACTION_OFFSET (CFD_SIZE - 9) /* action/transmit */ +#define CFD_SW_NEXT_OFFSET (CFD_SIZE - 8) /* s/w next link */ +#define CFD_PKT_OFFSET (CFD_SIZE_HDR + 8) /* packet data */ +#define CFD_IA_OFFSET CFD_SIZE_HDR /* individual address */ +#define CFD_MCOUNT_OFFSET CFD_SIZE_HDR /* mcount field */ +#define CFD_MC_OFFSET (CFD_SIZE_HDR + 2) /* mcast list */ + +#define RFD_STAT_OFFSET 0x00 /* status word */ +#define RFD_COMM_OFFSET 0x02 /* command word */ +#define RFD_NEXT_OFFSET 0x04 /* next frame field */ +#define RFD_PREV_OFFSET (RFD_SIZE - 4) /* previous frame */ +#define RFD_SW_NEXT_OFFSET (RFD_SIZE - 8) /* s/w next frame */ +#define RFD_RBD_OFFSET 0x08 /* buffer descriptor */ +#define RFD_COUNT_OFFSET 0x0c /* count field */ +#define RFD_SIZE_OFFSET 0x0e /* data size */ + +/* Extended RFD offsets (present in 82550 and 82551 only) */ +#define RFD_VLANID_OFFSET 0x10 /* VLAN ID (16 bits) */ +#define RFD_RXPARSESTS_OFFSET 0x12 /* 8 bits */ +#define RFD_RSVD0_OFFSET 0x13 /* 8 bits */ +#define RFD_SECURITYSTS_OFFSET 0x14 /* 16 bits */ +#define RFD_CSUMSTS_OFFSET 0x16 /* 8 bits */ +#define RFD_ZEROCOPYSTS_OFFSET 0x17 /* 8 bits */ +#define RFD_PAD_OFFSET 0x18 /* 64 bits */ + +#define RFD_PKT_OFFSET (RFD_SIZE_HDR) /* packet data*/ + +#define RBD_STAT_OFFSET 0x00 /* Count & F flag */ +#define RBD_EOF_OFFSET 0x02 /* End of Frame */ +#define RBD_NEXT_OFFSET 0x04 /* Next RBD in list */ +#define RBD_BUFFER_OFFSET 0x08 /* cluster pointer */ +#define RBD_CFG_OFFSET 0x0c /* EL & size fields */ + +#define RBD_C_EL 0x8000 + +#define RBD_EL_MASK 0x8000 +#define RBD_SIZE_MASK 0x7fff +#define RBD_COUNT_MASK 0x3fff + +#define TBD_NOT_USED 0xffffffff /* use semplified mode */ +#define RBD_NULL_ADDR 0xffffffff /* use flexible mode */ + +/* TX-specific constants */ + +/* Number of TX frags allowed per transmission. */ +#define TBD_MAX_FRAGS 32 + +/* + * We place the transmit buffer array immediately after + * the CFD structure, when doing scatter/gather TX DMA. + */ +#define CFD_TBD_OFFSET 0x10 +#define CFD_TBD_OFFSET_TxCB 0x20 +#define CFD_TBD_OFFSET_IPCB 0x20 +#define CFD_FRAG1_OFFSET CFD_TBD_OFFSET +#define CFD_FRAG1_OFFSET_TxCB CFD_TBD_OFFSET +#define CFD_FRAG1_OFFSET_IPCB 0x18 + +/* A fragment address/length pair is 8 bytes long (two 32-bit words). */ +#define TBD_SIZE 8 + +/* + * A fragment addrees/length pair contains a 32-bit physical address + * pointer, followed by a 32-bit length field. + */ +#define TBD_ADDR_OFFSET 0x00 +#define TBD_LEN_OFFSET 0x04 + +/* IPCB flags */ + +#define IPCB_IP_CHECKSUM_ENABLE 0x10 +#define IPCB_TCPUDP_CHECKSUM_ENABLE 0x20 +#define IPCB_TCP_PACKET 0x40 +#define IPCB_LARGESEND_ENABLE 0x80 +#define IPCB_HARDWAREPARSING_ENABLE 0x01 +#define IPCB_INSERTVLAN_ENABLE 0x02 +#define IPCB_IP_ACTIVATION_DEFAULT IPCB_HARDWAREPARSING_ENABLE + +#define IPCB_DEFAULT (/*IPCB_TCPUDP_CHECKSUM_ENABLE*/0 | \ + IPCB_IP_CHECKSUM_ENABLE | \ + (IPCB_HARDWAREPARSING_ENABLE << 8)) + +/* + * We also need to save a pointer to the mBlk so we + * can reap it later. We can place it after the TFD array. + */ +#define CFD_MBLK_OFFSET CFD_TBD_OFFSET + (TBD_SIZE * (TBD_MAX_FRAGS + 2)) + + +/* + * This bit, if set in the FragLen field, indicates that this + * is the last fragment that needs to be processed in this TBD. + */ +#define TBD_LASTFRAG 0x00008000 + +/* TX-specific bits in the status/command fields */ + +#define TBD_CTL_SF 0x0008 /* simple/flex mode */ +#define TBD_CTL_NO_CRC 0x0010 /* no TX CRC */ + +#define TBD_STS_DMA_COMPLETE 0x8000 /* TX DMA done for this txcb */ +#define TBD_STS_TX_OK 0x2000 /* TX done with no error */ +#define TBD_STS_URUN 0x1000 /* TX underrun */ + +/* board specific infomation */ + +typedef struct + { + UINT32 vector; /* interrupt vector number */ + UINT32 baseAddr; /* memory base address for CSR */ + UCHAR enetAddr[6]; /* ethernet address */ + int (*intEnable)(int unit); /* board specific interrupt enable routine */ + int (*intDisable)(int unit); /* board specific interrupt disable routine */ + int (*intAck) (int unit); /* interrupt ack */ + UINT32 (*sysLocalToBus)(int unit,UINT32 localAdr); + UINT32 (*sysBusToLocal)(int unit,UINT32 sysAdr); + + /* configuration parameters, user can override in the BSP */ + UINT8 phyAddr; /* PHY device address, valid addresses: 0-32 */ + UINT8 phySpeed; + UINT8 phyDpx; + UINT8 fill0; + + UINT16 tcbTxThresh; + + UINT16 others; /* allow you write all bits to Mode Control Register in the + PHY device, don't touch it unless you know what you're doing. */ + + UINT32 spare1; + UINT32 spare2; + UINT32 spare3; + UINT32 spare4; + } FEI_BOARD_INFO; + +typedef UINT32 * RFD_ID; +typedef UINT32 * RBD_ID; +typedef UINT32 * RBD_TAG_ID; + + /* + * The read discriptor structure is a place holdes for the actual RFD + * used by the device. The driver does not actuall access this area + * the structure but uses the macros and offsets provided. + */ +typedef struct read_disc + { + UINT32 long1; + UINT32 long2; + UINT32 long3; + UINT32 long4; + } RD_DESC; + + /* + * The RFD_TAG makes use of the additional 16 bytes of space allocated + * for each RFD beyond the 16 bytes used by the device. This space is used + * to store information not provided by the device but useful for managing + * the flexible mode configuration. + */ + +typedef struct rfd_tag + { + RD_DESC rfd; /* DON'T ACCESS this field */ + UINT16 index; + UINT16 nextIndex; + UINT16 spareWord; + UINT16 status; + RBD_ID pRFD; /* pointer to own pRFD */ + UINT32 spareLong; + } RFD_TAG; + + /* + * The RBD_TAG makes use of the additional 16 bytes of space allocated + * for each RBD beyond the 16 bytes used by the device. This space is used + * to store information not provided by the device but useful for managing + * the flexible mode configuration. + */ +typedef struct rbd_tag + { + RD_DESC rbd; /* DON'T ACCESS this field */ + UINT16 index; + UINT16 next; + M_BLK_ID pMblk; + RFD_ID pRFD; /* pointer to self */ + RBD_ID pRBD; /* pointer to own RBD */ + } RBD_TAG; + +/* constants needed within this file */ + +#define FEI_MAX_UNITS 4 /* max units supported */ +#define FEI_CFD_DEF 32 /* default number of CFDs */ +#define FEI_RFD_DEF 32 /* default number of RFDs */ +#define FEI_RFD_LOAN 8 /* number RFDs that can be loaned */ +#define EH_SIZE 14 /* avoid structure padding issues */ +#define N_MCAST 12 + +/* SCB registers offset definitions @@@ */ +#define SCB_STATUS 0x00 /* SCB status byte */ +#define SCB_CMD 0x02 /* SCB command byte */ +#define SCB_POINTER 0x04 /* SCB pointer */ +#define SCB_PORT 0x08 /* SCB port register */ +#define SCB_FLASH 0x0c /* SCB flash control register */ +#define SCB_EEPROM 0x0e /* SCB eeprom control register */ +#define SCB_MDI 0x10 /* SCB mdi control register */ +#define SCB_EARLYRX 0x14 /* SCB early receive */ + +/* SCB Status Word byte mask definitions */ + +#define SCB_S_RUMASK 0x3c /* RU status mask */ +#define SCB_S_RUIDLE 0x00 /* RU is idle */ +#define SCB_S_RUSUSP 0x04 /* RU is suspended */ +#define SCB_S_RUNORSR 0x08 /* RU no more resources */ +#define SCB_S_RURDY 0x10 /* RU is ready */ +#define SCB_S_RUSUSPNR 0x24 /* RU is suspended/no more resources */ +#define SCB_S_RUNORSRBD 0x28 /* RU no more resources/no more RBD's */ +#define SCB_S_RURDYBD 0x30 /* RU is ready/no more RBD's */ +#define SCB_S_CUMASK 0xc0 /* CU status mask */ +#define SCB_S_CUIDLE 0x00 /* CU is idle */ +#define SCB_S_CUSUSP 0x40 /* CU is suspended */ +#define SCB_S_CUACTIVE 0x80 /* CU is active */ +#define SCB_S_MASK 0xff + +/* SCB STAT/ACK byte bit mask definitions */ + +#define SCB_S_STATMASK 0xfc00 /* stat mask */ +#define SCB_S_SWI 0x0400 /* software generated interrupt */ +#define SCB_S_MDI 0x0800 /* An MDI read or write cycle is done */ +#define SCB_S_RNR 0x1000 /* RU left the ready state */ +#define SCB_S_CNA 0x2000 /* CU left the active state */ +#define SCB_S_CI 0x2000 /* CU entered the idle state */ +#define SCB_S_FR 0x4000 /* RU finished receiveing a frame */ +#define SCB_S_CX 0x8000 /* CU finished a cmd with I bit set */ +#define SCB_S_TNO 0x8000 /* Tx command ended with not OK */ + +/* SCB Command byte bit mask definitions */ + +#define SCB_C_RUMASK 0x07 /* RU Command mask */ +#define SCB_C_RUNOP 0x00 /* NOP */ +#define SCB_C_RUSTART 0x01 /* RU start reception of frames */ +#define SCB_C_RURESUME 0x02 /* RU resume reception of frames */ +#define SCB_C_RUABORT 0x04 /* RU abort receiver immediately */ +#define SCB_C_RULDHDS 0x05 /* RU load header data size */ +#define SCB_C_RULDBASE 0x06 /* load RU base address */ +#define SCB_C_RURBDRSM 0x07 /* RBD resume */ +#define SCB_C_CUMASK 0x70 /* CU Command mask */ +#define SCB_C_CUNOP 0x00 /* NOP */ +#define SCB_C_CUSTART 0x10 /* CU start execution */ +#define SCB_C_CURESUME 0x20 /* CU resume execution */ +#define SCB_C_CULDDUMP 0x40 /* load dump counters address */ +#define SCB_C_CUDUMP 0x50 /* dump stat counters */ +#define SCB_C_CULDBASE 0x60 /* load CU base address */ +#define SCB_C_CUDUMPRST 0x70 /* dump and reset stat counters */ +#define SCB_CR_MASK 0xff + +/* SCB Interrupt Control byte bit mask definitions */ + +#define SCB_C_M 0x01 /* interrupt mask */ +#define SCB_C_SI 0x02 /* software generated interrupt */ +#define SCB_C_RNR 0x10 /* RU ran out of resources */ +#define SCB_C_CNA 0x20 /* CU left active state (transmit) */ +#define SCB_C_FR 0x40 /* frame receive */ + +/* PORT commands */ + +#define FEI_PORT_RESET 0x0 /* PORT reset command */ +#define FEI_PORT_SELFTEST 0x1 /* PORT selftest command */ +#define FEI_PORT_SELRESET 0x2 /* PORT selective reset command */ +#define FEI_PORT_DUMP 0x3 /* PORT dump command */ + +/* Action Command Descriptions */ + +/* special TCB-specific command block bit mask definitions */ + +#define CFD_S_TX_DMA_U 0x1000 /* DMA underrun */ +#define TCB_CNT_EOF 0x8000 /* all data kept in TFD */ +#define CFD_C_TX_FLEX 0x0008 /* use flexible mode */ + + +/* special Diag-specific command block bit mask definitions */ + +#define CFD_S_DIAG_F 0x0800 /* diag failed */ + +/* Command Frame Description and defines */ + +/* Action Status Word bit mask definitions */ + +#define CFD_S_OK 0x2000 /* Command completed successfully */ +#define CFD_S_B 0x4000 /* CU starts access this CFD */ +#define CFD_S_COMPLETE 0x8000 /* Command complete */ + +/* Action Command Word bit mask definitions */ + +#define CFD_C_NOP 0x0000 /* No Operation */ +#define CFD_C_IASETUP 0x0001 /* Individual Address Setup */ +#define CFD_C_CONFIG 0x0002 /* Configure Chip */ +#define CFD_C_MASETUP 0x0003 /* Multicast Setup */ +#define CFD_C_XMIT 0x0004 /* Transmit (see below too ...) */ +#define CFD_C_DUMP 0x0006 /* Dump Registers */ +#define CFD_C_DIAG 0x0007 /* Diagnose */ +#define CFD_C_LOADFILT 0x0008 +#define CFD_C_IPCBXMIT 0x0009 /* hardware offload transmit */ +#define CFD_C_CID 0x1F00 /* Delay CNA interrupt */ +#define CFD_C_INT 0x2000 /* 557 interrupts CPU after execution */ +#define CFD_C_SUSP 0x4000 /* CU should suspend after execution */ +#define CFD_C_EL 0x8000 /* End of command list */ + +/* 82557 Receive Frame Descriptors */ + +/* RFD bit mask definitions */ + +#define RFD_S_COLL 0x0001 /* collision during reception */ +#define RFD_S_IA 0x0002 /* individual address match */ +#define RFD_S_NOAMATCH 0x0004 /* doesn't match anything */ +#define RFD_S_HWPARSE 0x0008 /* hardware parsed frame */ +#define RFD_S_RXER 0x0010 /* receive error */ +#define RFD_S_LEN 0x0020 /* type/len field designator */ +#define RFD_S_SHORT 0x0080 /* frame too short */ +#define RFD_S_DMA 0x0100 /* DMA Overrun failure to get bus */ +#define RFD_S_RSRC 0x0200 /* received, but ran out of buffers */ +#define RFD_S_ALGN 0x0400 /* received misaligned with CRC error */ +#define RFD_S_CRC 0x0800 /* received with CRC error */ +#define RFD_S_OK 0x2000 /* frame received successfully */ +#define RFD_S_B 0x4000 /* RU begins accessing this RFD */ +#define RFD_S_COMPLETE 0x8000 /* frame reception complete */ + +#define RFD_C_FLEX 0x0008 /* flexible mode */ +#define RFD_C_HEADER 0x10 /* frame is a header */ +#define RFD_C_SUSP 0x4000 /* suspend RU after receiving frame */ +#define RFD_C_EL 0x8000 /* end of RFD list */ + +#define RFD_CNT_F 0x4000 /* actual count updated */ +#define RFD_CNT_EOF 0x80 /* end of frame */ + +/* + * Extended RFD definitions relating to TCP/IP checksum offload + * (82550/82551 only) + */ + +/* Bits in the 'csum' byte */ +#define RFD_CS_TCPUDP_CHECKSUM_BIT_VALID 0x10 +#define RFD_CS_TCPUDP_CHECKSUM_VALID 0x20 +#define RFD_CS_IP_CHECKSUM_BIT_VALID 0x01 +#define RFD_CS_IP_CHECKSUM_VALID 0x02 + +/* Bits in the 'packet parser' byte */ +#define RFD_P_PARSE_BIT 0x08 +#define RFD_P_CHECKSUM_PROTOCOL_MASK 0x03 +#define RFD_P_TCP_PACKET 0x00 +#define RFD_P_UDP_PACKET 0x01 +#define RFD_P_IP_PACKET 0x03 + +typedef volatile UINT32 * FD_ID; +typedef volatile UINT32 * CSR_ID; +typedef FD_ID CFD_ID; + +/* Configuration definitions */ + +#define FEI_BYTE_COUNT 0x16 /* the number of Command Block bytes */ +#define FEI_RX_FIFO 0x08 /* Receive FIFO limit */ +#define FEI_TX_FIFO 0x00 /* Transmit FIFO limit */ +#define FEI_ADAPT_IFS 0x00 /* Adaptive IFS */ +#define FEI_MWI_ENABLE 0x01 /* Enable MWI */ +#define FEI_RD_ALIGN 0x02 /* Read alignment Enabled */ +#define FEI_RX_MAX_DMA 0x00 /* RX DMA Max Byte Count(not enabled) */ +#define FEI_TX_MAX_DMA 0x00 /* TX DMA Max Byte Count(not enabled) */ +#define FEI_MAX_DMA_EN 0x00 /* Enable DMA Max Byte Counts */ + + + + +/* EEPROM bit definitions */ + +#define FEI_EESK 0x01 /* EEPROM shift clock */ +#define FEI_EECS 0x02 /* EEPROM chip select */ +#define FEI_EEDI 0x04 /* EEPROM data in */ +#define FEI_EEDO 0x08 /* EEPROM data out */ + + +/* Following defines should be in another header file */ + +/* MDI definitions */ + +#define MDI_READ 0x2 +#define MDI_WRITE 0x1 +#define MDI_CTRL_REG 0x0 +#define MDI_STATUS_REG 0x1 + +/* MDI control register bit */ +#define MDI_CR_COLL_TEST 0x80 +#define MDI_CR_FDX 0x100 /* FDX =1, half duplex =0 */ +#define MDI_CR_RESTART 0x200 /* restart auto negotiation */ +#define MDI_CR_ISOLATE 0x400 /* isolate PHY from MII */ +#define MDI_CR_POWER_DOWN 0x800 /* power down */ +#define MDI_CR_SELECT 0x1000 /* auto speed select */ +#define MDI_CR_100 0x2000 /* 0 = 10mb, 1 = 100mb */ +#define MDI_CR_LOOPBACK 0x4000 /* 0 = normal, 1 = loopback */ +#define MDI_CR_RESET 0x8000 /* 0 = normal, 1 = PHY reset */ + +/* MDI Status register bit definitions */ +#define MDI_SR_LINK_STATUS 0x4 /* link Status -- 1 = link */ +#define MDI_SR_AUTO_SELECT 0x8 /* auto speed select capable */ +#define MDI_SR_REMOTE_FAULT 0x10 /* Remote fault detect */ +#define MDI_SR_AUTO_NEG 0x20 /* auto negotiation complete */ +#define MDI_SR_10T_HALF_DPX 0x800 /* 10BaseT half duplex capable */ +#define MDI_SR_10T_FULL_DPX 0x1000 /* 10BaseT full duplex capable */ +#define MDI_SR_TX_HALF_DPX 0x2000 /* TX half duplex capable */ +#define MDI_SR_TX_FULL_DPX 0x4000 /* TX full duplex capable */ +#define MDI_SR_T4 0x8000 /* T4 capable */ + +#define PHY_100MBS 1 +#define PHY_10MBS 0 +#define PHY_AUTO_SPEED 2 + +#define PHY_FULL_DPX 1 +#define PHY_HALF_DPX 0 +#define PHY_AUTO_DPX 2 + +#define PHY_LINK_ERROR 0x10 +#define PHY_AUTO_FAIL 0x20 + +/* PRO/100B definitions */ + +#define EP100B_PCI_VENDOR_ID 0x8086 /* Intel vendor ID */ +#define EP100B_PCI_DEVICE_ID 0x1229 /* PRO/100B device ID */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfei82557Endh */ + diff --git a/h/drv/end/gei82543End.h b/h/drv/end/gei82543End.h new file mode 100644 index 0000000..ec8858a --- /dev/null +++ b/h/drv/end/gei82543End.h @@ -0,0 +1,871 @@ +/* gei82543End.h - Intel 8254x network interface header */ + +/* Copyright 1990-2002 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01l,11aug05,dlk Add support for IPv6 checksum offload. +01k,04jun04,jln add new flags: GEI_END_FORCE_FLUSH_CACHE and + GEI_END_FORCE_INVALIDATE_CACHE +01j,08may04,dlk Remove txType field from TX_DESCTL. + Remove DEFAULT_MBLK_NUM_FACTOR, must be same as + DEFAULT_LOAN_RXBUF_FACTOR for linkBuf/netTupleGet use. +01i,02feb04,wap Add checksum offload support +01h,19dec02,jln add PHY BSP call hook for 82543-copper (SPR 84779) +01g,28may02,jln add TX_RESTART_TRUE and TX_RESTART_NONE +01f,20apr02,jln support 82540/5/6 spr # 76739 +01e,31jan02,jln change len of device name (spr#73010) +01d,05dec01,jln add definitions for TBI compatibility workaround +01c,01oct01,jln move device ID definition to sysGei82543End.c +01b,01apr01,jln clean up after code review (partial spr#65326) +01a,08Jan01,jln written +*/ + +#ifndef __INCGEI82543Endh +#define __INCGEI82543Endh + +/* includes */ + +#include "etherLib.h" +#include "miiLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* define */ + +#define UNKNOWN -1 + +#ifndef PHYS_TO_BUS_ADDR +#define PHYS_TO_BUS_ADDR(unit,physAddr) \ + ((int) pDrvCtrl->adaptor.sysLocalToBus ? \ + (*pDrvCtrl->adaptor.sysLocalToBus) (unit, physAddr) : physAddr) +#endif /* PHYS_TO_BUS_ADDR */ + +#ifndef BUS_TO_PHYS_ADDR +#define BUS_TO_PHYS_ADDR(unit,busAddr) \ + ((int) pDrvCtrl->adaptor.sysBusToLocal ? \ + (*pDrvCtrl->adaptor.sysBusToLocal)(unit, busAddr) : busAddr) +#endif /* BUS_TO_PHYS_ADDR */ + +#define TX_DESC_TYPE_CLEAN 0 /* TX descriptor type */ +#define TX_DESC_TYPE_COPY 1 /* -- copy/chain/EOP */ +#define TX_DESC_TYPE_CHAIN 2 +#define TX_DESC_TYPE_EOP 3 + +/* TX descriptors structure */ + +#define TXDESC_BUFADRLOW_OFFSET 0 /* buf mem low offset */ +#define TXDESC_BUFADRHIGH_OFFSET 4 /* buf mem high offset */ +#define TXDESC_LENGTH_OFFSET 8 /* buf length offset */ +#define TXDESC_CSO_OFFSET 10 /* checksum offset */ +#define TXDESC_CMD_OFFSET 11 /* command offset */ +#define TXDESC_STATUS_OFFSET 12 /* status offset */ +#define TXDESC_CSS_OFFSET 13 /* cksum start */ +#define TXDESC_SPECIAL_OFFSET 14 /* special field */ +#define TXDESC_SIZE 16 /* descriptor size */ + +#ifdef notdef +#define TXDESC_CTX_IPCSS_OFFSET 0 /* CXT descriptor IPCSS */ +#define TXDESC_CTX_TUCSS_OFFSET 4 /* CXT descriptor TUCSS */ +#endif +/* + * Extended TCP/IP Context TX descriptor structure. + * Identified by DEXT bit = 1 in TUCMD field, and DTYP = 0000b + */ + +#define TXDESC_CTX_IPCSS_OFFSET 0 /* IP checksum start offset */ +#define TXDESC_CTX_IPCSO_OFFSET 1 /* IP checksum offset offset */ +#define TXDESC_CTX_IPCSE_OFFSET 2 /* IP checksum end offset */ +#define TXDESC_CTX_TUCSS_OFFSET 4 /* TCP/UDP checksum start offset */ +#define TXDESC_CTX_TUCSO_OFFSET 5 /* TCP/UDP cksum. offset offset */ +#define TXDESC_CTX_TUCSE_OFFSET 6 /* TCP/UDP checksum end offset */ +/* + * The PKTLEN field is 20 bits, and DTYP is 4 bits. DTYP appears in the + * High-order 4 bits of the byte at offset 10. + */ +#define TXDESC_CTX_PKTLEN_OFFSET 8 /* Packet len for segmentation */ +#define TXDESC_CTX_DTYP_OFFSET 10 /* Descriptor type == 0000b */ +#define TXDESC_CTX_TUCMD_OFFSET 11 /* context command byte offset */ +#define TXDESC_CTX_STATUS_OFFSET 12 /* Status nybble byte offset */ +#define TXDESC_CTX_HDRLEN_OFFSET 13 /* Header length offset (seg) */ +#define TXDESC_CTX_MSS_OFFSET 14 /* MSS offset (segmentation) */ + +/* RX descriptor structure */ + +#define RXDESC_BUFADRLOW_OFFSET 0 /* buf mem low offset */ +#define RXDESC_BUFADRHIGH_OFFSET 4 /* buf mem high offset */ +#define RXDESC_LENGTH_OFFSET 8 /* length offset */ +#define RXDESC_CHKSUM_OFFSET 10 /* cksum offset */ +#define RXDESC_STATUS_OFFSET 12 /* status offset */ +#define RXDESC_ERROR_OFFSET 13 /* error offset */ +#define RXDESC_SPECIAL_OFFSET 14 /* special offset */ +#define RXDESC_SIZE 16 /* descriptor size */ + +#define TX_ETHER_PHY_SIZE (EH_SIZE + ETHERMTU + 2) + +#define PRO1000_PCI_VENDOR_ID 0x8086 /* Intel vendor ID */ +#define PRO1000_PCI_DEVICE_ID 0x1001 /* device ID */ +#define PRO1000F_PCI_SUBSYSTEM_ID 0x1003 /* device subsystem ID */ +#define PRO1000T_PCI_SUBSYSTEM_ID 0x1004 +#define PRO1000T_PCI_DEVICE_ID 0x1004 /* bizard case */ +#define PRO1000F_BOARD 0x1003 /* backward compatible */ +#define PRO1000T_BOARD 0x1003 /* backward compatible */ +#define INTEL_PCI_VENDOR_ID 0x8086 + +#define PRO1000_546_BOARD 0x100e /* 82540/82545/82546 MAC */ +#define PRO1000_544_BOARD 0x1008 /* 82544 MAC */ +#define PRO1000_543_BOARD 0x1003 /* 82543 MAC */ + +#define GEI_COPPER_MEDIA 1 +#define GEI_FIBER_MEDIA 2 + +#define GEI_PHY_GMII_TYPE 1 + +#define DEFAULT_RXRES_PROCESS_FACTOR 2 +#define DEFAULT_TIMER_INTERVAL 2 /* 2 seconds */ +#define DEFAULT_DRV_FLAGS 0 +#define DEFAULT_LOAN_RXBUF_FACTOR 4 +#define DEFAULT_MBUF_COPY_SIZE 256 +#define DEFAULT_NUM_TXDES 24 +#define DEFAULT_NUM_RXDES 24 +#define DEFAULT_RXINT_DELAY 0 +#define DEFAULT_MULTI_FILTER_TYPE MULTI_FILTER_TYPE_47_36 +#define DEFAULT_FLOW_CONTRL FLOW_CONTRL_HW +#define DEFAULT_TX_REPORT TX_REPORT_RS +#define DEFAULT_TIPG_IPGT_F 6 +#define DEFAULT_TIPG_IPGT_T 8 +#define DEFAULT_TIPG_IPGR1 8 +#define DEFAULT_TIPG_IPGR2 6 + +#define GEI543_MAX_DEV_UNIT 4 + +/* flags available to config system */ + +#define GEI_END_SET_TIMER 0x0001 /* use a watchdog timer */ +#define GEI_END_SET_RX_PRIORITY 0x0002 /* RX has higher priority (543 only) */ +#define GEI_END_FREE_RESOURCE_DELAY 0x0004 /* allow delay to free loaned TX cluster */ +#define GEI_END_JUMBO_FRAME_SUPPORT 0x0008 /* Jumbo Frame allowed */ +#define GEI_END_RX_IP_XSUM 0x0010 /* RX IP XSUM allowed, not supported */ +#define GEI_END_RX_TCPUDP_XSUM 0x0020 /* RX TCP XSUM allowed, not supported */ +#define GEI_END_TX_IP_XSUM 0x0040 /* TX IP XSUM allowed, not supported */ +#define GEI_END_TX_TCPUDP_XSUM 0x0080 /* TX TCP XSUM allowed, not supported */ +#define GEI_END_TX_TCP_SEGMENTATION 0x0100 /* TX TCP segmentation, not supported */ +#define GEI_END_TBI_COMPATIBILITY 0x0200 /* TBI compatibility workaround (543 only) */ +#define GEI_END_USER_MEM_FOR_DESC_ONLY 0x0400 /* cacheable user mem for RX descriptors only */ +#define GEI_END_FORCE_FLUSH_CACHE 0x1000 /* force flush data cache */ +#define GEI_END_FORCE_INVALIDATE_CACHE 0x2000 /* force flush data cache */ + +#define GEI_END_CSUM (GEI_END_RX_IP_XSUM | GEI_END_TX_IP_XSUM |\ + GEI_END_RX_TCPUDP_XSUM | GEI_END_TX_TCPUDP_XSUM) + + +#define GEI_DEFAULT_RXDES_NUM 0x40 +#define GEI_DEFAULT_TXDES_NUM 0x80 +#define GEI_DEFAULT_USR_FLAG (GEI_END_SET_TIMER | \ + GEI_END_SET_RX_PRIORITY | \ + GEI_END_FREE_RESOURCE_DELAY) + +#define GEI_DEFAULT_ETHERHEADER (SIZEOF_ETHERHEADER) +#define GEI_MAX_FRAME_SIZE 16288 /* based on default RX/TX + buffer configuration */ + +#define GEI_MAX_JUMBO_MTU_SIZE (GEI_MAX_FRAME_SIZE - \ + GEI_DEFAULT_ETHERHEADER - \ + ETHER_CRC_LENGTH) + +#define GEI_DEFAULT_JUMBO_MTU_SIZE 9000 /* 9000 bytes */ + +#define AVAIL_TX_INT (INT_TXDW_BIT) +#define AVAIL_RX_INT (INT_RXO_BIT | INT_RXTO_BIT) +#define AVAIL_RX_TX_INT (AVAIL_TX_INT | AVAIL_RX_INT) +#define AVAIL_LINK_INT (INT_LSC_BIT) +#define INT_LINK_CHECK (AVAIL_LINK_INT | INT_RXCFG_BIT) +#define INTEL_82543GC_VALID_INT (AVAIL_RX_TX_INT | INT_LINK_CHECK | INT_TXDLOW_BIT) + +#define MAX_TXINT_DELAY 65536 +#define MAX_RXINT_DELAY 65536 +#define MIN_TXINT_DELAY 1 +#define TXINT_DELAY_LESS 5 +#define TXINT_DELAY_MORE 512 + +#define ETHER_CRC_LENGTH 4 +#define RX_CRC_LEN ETHER_CRC_LENGTH +#define MAX_ETHER_PACKET_SIZE 1514 +#define MIN_ETHER_PACKET_SIZE 60 +#define ETHER_ADDRESS_SIZE 6 + +#define CARRIER_EXTENSION_BYTE 0x0f + +#define INTEL_82543GC_MTA_NUM 128 + +#define INTEL_82543GC_MULTIPLE_DES 8 + +#define TX_COLLISION_THRESHOLD 16 +#define FDX_COLLISION_DISTANCE 64 +#define HDX_COLLISION_DISTANCE 64 +#define BIG_HDX_COLLISION_DISTANCE 512 + +#define NUM_RAR 16 +#define NUM_MTA 128 +#define NUM_VLAN 128 +#define MAX_NUM_MULTI (NUM_RAR + NUM_MTA - 1) + +#define MULTI_FILTER_TYPE_47_36 0 +#define MULTI_FILTER_TYPE_46_35 1 +#define MULTI_FILTER_TYPE_45_34 2 +#define MULTI_FILTER_TYPE_43_32 3 + +#define FLOW_CONTRL_NONE 0 +#define FLOW_CONTRL_TRANSMIT 1 +#define FLOW_CONTRL_RECEIVE 2 +#define FLOW_CONTRL_ALL 3 +#define FLOW_CONTRL_HW 0xf + +#define TX_REPORT_RS 1 +#define TX_REPORT_RPS 2 + +#define DMA_RX_PRIORITY 1 +#define DMA_FAIR_RX_TX 2 + +#define FULL_DUPLEX_MODE 1 +#define HALF_DUPLEX_MODE 2 +#define DUPLEX_HW 3 +#define DEFAULT_DUPLEX_MODE FULL_DUPLEX_MODE + +#define END_SPEED_10M 10000000 /* 10Mbs */ +#define END_SPEED_100M 100000000 /* 100Mbs */ +#define END_SPEED_1000M 1000000000 /* 1000Mbs */ +#define END_SPEED END_SPEED_1000M + +#define DEVICE_NAME "gei" +#define DEVICE_NAME_LENGTH 4 + +#define TYPE_PRO1000F_PCI 1 +#define TYPE_PRO1000T_PCI 2 +#define GEI82543_HW_AUTO 0x1 +#define GEI82543_FORCE_LINK 0x2 + +/* general flags */ + +#define FLAG_POLLING_MODE 0x0001 +#define FLAG_PROMISC_MODE 0x0002 +#define FLAG_ALLMULTI_MODE 0x0004 +#define FLAG_MULTICAST_MODE 0x0008 +#define FLAG_BROADCAST_MODE 0x0010 + +/* misc */ + +#define TX_RESTART_NONE 0x4000 /* muxTxRestart not scheduled */ +#define TX_RESTART_TRUE 0x8000 /* muxTxRestart is scheduled */ +#define LINK_STATUS_OK 0 +#define LINK_STATUS_ERROR 1 +#define LINK_STATUS_UNKNOWN 2 +#define FREE_ALL_AUTO 1 +#define FREE_ALL_FORCE 2 +#define TX_LOAN_TRANSMIT 1 +#define TX_COPY_TRANSMIT 2 +#define LINK_TIMEOUT_IN_QUAR_SEC 12 /* 3s */ + +#define GEI_MII_PHY_CAP_FLAGS (MII_PHY_10 | MII_PHY_100 | \ + MII_PHY_FD | MII_PHY_HD | \ + MII_PHY_1000T_FD) + +/* Offsets of checksum fields within protocol headers */ + +#define IP_HDR_CKSUM_OFFSET 10 /* Offset within IP header */ +#define TCP_HDR_CKSUM_OFFSET 16 /* Offset within TCP header */ +#define UDP_HDR_CKSUM_OFFSET 6 /* Offset within UDP header */ + +/* register area */ + +/* TX registers */ + +#define INTEL_82543GC_TDBAL 0x3800 /* Tx Descriptor Base Low */ +#define INTEL_82543GC_TDBAH 0x3804 /* Tx Descriptor Base High */ +#define INTEL_82543GC_TDLEN 0x3808 /* Tx Descriptor Length */ +#define INTEL_82543GC_TDH 0x3810 /* Tx Descriptor Head */ +#define INTEL_82543GC_TDT 0x3818 /* Tx Descriptor Tail */ + +/* RX registers */ + +#define INTEL_82543GC_RDBAL 0x2800 /* Rx Descriptor Base Low */ +#define INTEL_82543GC_RDBAH 0x2804 /* Rx Descriptor Base High */ +#define INTEL_82543GC_RDLEN 0x2808 /* Rx Descriptor Length */ +#define INTEL_82543GC_RDH 0x2810 /* Rx Descriptor Head */ +#define INTEL_82543GC_RDT 0x2818 /* Rx Descriptor Tail */ + +/* Interrupt registers */ + +#define INTEL_82543GC_ICR 0xc0 /* Interrupt Cause Read */ +#define INTEL_82543GC_ICS 0xc8 /* Interrupt Cause Set */ +#define INTEL_82543GC_IMS 0xd0 /* Interrupt Mask Set/Read */ +#define INTEL_82543GC_IMC 0xD8 /* Interrupt Mask Clear */ + +#define INTEL_82543GC_CTRL 0x0 /* Device Control */ +#define INTEL_82543GC_STATUS 0x8 /* Device Status */ +#define INTEL_82543GC_EECD 0x10 /* EEPROM/Flash Data */ +#define INTEL_82543GC_CTRL_EXT 0x18 /* Extended Device Control */ +#define INTEL_82543GC_MDI 0x20 /* MDI Control */ +#define INTEL_82543GC_FCAL 0x28 /* Flow Control Adr Low */ +#define INTEL_82543GC_FCAH 0x2c /* Flow Control Adr High */ +#define INTEL_82543GC_FCT 0x30 /* Flow Control Type */ +#define INTEL_82543GC_VET 0x38 /* VLAN EtherType */ +#define INTEL_82546EB_ITR 0xc4 /* register for 82540/5/6 MAC only, + interrupt throttle register */ +#define INTEL_82543GC_RCTL 0x100 /* Receive Control */ +#define INTEL_82543GC_FCTTV 0x170 /* Flow Ctrl TX Timer Value */ +#define INTEL_82543GC_TXCW 0x178 /* TX Configuration Word */ +#define INTEL_82543GC_RXCW 0x180 /* RX Configuration Word */ +#define INTEL_82543GC_TCTL 0x400 /* TX control */ +#define INTEL_82543GC_TIPG 0x410 /* Transmit IPG */ +#define INTEL_82543GC_PBA 0x1000 /* Packet Buffer Allocation */ +#define INTEL_82543GC_FCRTL 0x2160 /* Flow ctrl RX Threshold Lo*/ +#define INTEL_82543GC_FCRTH 0x2168 /* Flow ctrl RX Threshold hi*/ +#define INTEL_82543GC_RDTR 0x2820 /* Rx Delay Timer Ring */ +#define INTEL_82546EB_RADV 0x282C /* register for 82540/5/6 MAC only, + absolute Rx Delay Timer register */ +#define INTEL_82543GC_TIDV 0x3820 /* Tx Interrupt Delay Value */ +#define INTEL_82543GC_TXDCTL 0x3828 /* Transmit descriptor control */ +#define INTEL_82546EB_TADV 0x382C /* register for 82540/5/6 MAC only, + absolute Tx Interrupt Delay register */ +#define INTEL_82543GC_RXCSUM 0x5000 /* Receive Checksum control */ +#define INTEL_82543GC_MTA 0x5200 /* Multicast Table Array */ +#define INTEL_82543GC_RAL 0x5400 /* Rx Adr Low */ +#define INTEL_82543GC_RAH 0x5404 /* Rx Adr High */ +#define INTEL_82543GC_VLAN 0x5600 /* VLAN Filter Table Array */ + +/* Statistic Registers */ + +#define INTEL_82543GC_CRCERRS 0x4000 +#define INTEL_82543GC_ALGNERRC 0x4004 +#define INTEL_82543GC_SYMERRS 0x4008 +#define INTEL_82543GC_RXERRC 0x400c +#define INTEL_82543GC_MPC 0x4010 +#define INTEL_82543GC_SCC 0x4014 +#define INTEL_82543GC_ECOL 0x4018 +#define INTEL_82543GC_MCC 0x401c +#define INTEL_82543GC_LATECOL 0x4020 +#define INTEL_82543GC_COLC 0x4028 +#define INTEL_82543GC_TUC 0x402c +#define INTEL_82543GC_DC 0x4030 +#define INTEL_82543GC_TNCRS 0x4034 +#define INTEL_82543GC_SEC 0x4038 +#define INTEL_82543GC_CEXTEER 0x403c +#define INTEL_82543GC_RLEC 0x4040 +#define INTEL_82543GC_XONRXC 0x4048 +#define INTEL_82543GC_XONTXC 0x404c +#define INTEL_82543GC_XOFFRXC 0x4050 +#define INTEL_82543GC_XOFFTXC 0x4054 +#define INTEL_82543GC_FCRUC 0x4058 +#define INTEL_82543GC_PRC64 0x405c +#define INTEL_82543GC_PRC127 0x4060 +#define INTEL_82543GC_PRC255 0x4064 +#define INTEL_82543GC_PRC511 0x4068 +#define INTEL_82543GC_PRC1023 0x406c +#define INTEL_82543GC_PRC1522 0x4070 +#define INTEL_82543GC_GPRC 0x4074 +#define INTEL_82543GC_BPRC 0x4078 +#define INTEL_82543GC_MPRC 0x407c +#define INTEL_82543GC_GPTC 0x4080 +#define INTEL_82543GC_GORL 0x4088 +#define INTEL_82543GC_GORH 0x408c +#define INTEL_82543GC_GOTL 0x4090 +#define INTEL_82543GC_GOTH 0x4094 +#define INTEL_82543GC_RNBC 0x40a0 +#define INTEL_82543GC_RUC 0x40a4 +#define INTEL_82543GC_RFC 0x40a8 +#define INTEL_82543GC_ROC 0x40ac +#define INTEL_82543GC_RJC 0x40b0 +#define INTEL_82543GC_TORL 0x40c0 +#define INTEL_82543GC_TORH 0x40c4 +#define INTEL_82543GC_TOTL 0x40c8 +#define INTEL_82543GC_TOTH 0x40cc +#define INTEL_82543GC_TPR 0x40d0 +#define INTEL_82543GC_TPT 0x40d4 +#define INTEL_82543GC_PTC64 0x40d8 +#define INTEL_82543GC_PTC127 0x40dc +#define INTEL_82543GC_PTC255 0x40e0 +#define INTEL_82543GC_PTC511 0x40e4 +#define INTEL_82543GC_PTC1023 0x40e8 +#define INTEL_82543GC_PTC1522 0x40ec +#define INTEL_82543GC_MPTC 0x40f0 +#define INTEL_82543GC_BPTC 0x40f4 +#define INTEL_82543GC_TSCTC 0x40f8 +#define INTEL_82543GC_TSCTFC 0x40fc +#define INTEL_82543GC_RDFH 0x2410 +#define INTEL_82543GC_RDFT 0x2418 +#define INTEL_82543GC_RDFHS 0x2420 +#define INTEL_82543GC_RDFTS 0x2428 +#define INTEL_82543GC_RDFPC 0x2430 +#define INTEL_82543GC_TDFH 0x3410 +#define INTEL_82543GC_TDFT 0x3418 +#define INTEL_82543GC_TDFHS 0x3420 +#define INTEL_82543GC_TDFTS 0x3428 +#define INTEL_82543GC_TDFPC 0x3430 + +/* Rx Configuration Word Field */ + +#define RXCW_C_BIT 0x20000000 + +/* EEPROM Structure */ + +#define EEPROM_WORD_SIZE 0x40 /* 0-0x3f */ +#define EEPROM_SUM 0xBABA +#define EEPROM_INDEX_SIZE 0x40 +#define EEPROM_INDEX_BITS 6 +#define EEPROM_CMD_BITS 3 +#define EEPROM_DATA_BITS 16 +#define EEPROM_READ_OPCODE 0x6 +#define EEPROM_WRITE_OPCODE 0x5 +#define EEPROM_ERASE_OPCODE 0x7 + +#define EEPROM_IA_ADDRESS 0x0 +#define EEPROM_ICW1 0xa +#define EEPROM_ICW1_SWDPIO_BITS 0x1e0 +#define EEPROM_ICW1_SWDPIO_SHIFT 5 +#define EEPROM_ICW1_ILOS_BIT 0x10 +#define EEPROM_ICW1_FRCSPD_BIT 0x800 +#define EEPROM_ICW1_ILOS_SHIFT 4 + +#define EEPROM_ICW2 0xf +#define EEPROM_ICW2_PAUSE_BITS 0x3000 +#define EEPROM_ICW2_ASM_DIR 0x2000 +#define EEPROM_ICW2_SWDPIO_EXE_BITS 0xf0 +#define EEPROM_ICW2_SWDPIO_EXE_SHIFT 4 + +#define BAR0_64_BIT 0x04 + +/* TX Descriptor Command Fields */ + +#define TXD_CMD_EOP 0x01 +#define TXD_CMD_IFCS 0x02 +#define TXD_CMD_IC 0x04 +#define TXD_CMD_RS 0x08 +#define TXD_CMD_RPS 0x10 +#define TXD_CMD_DEXT 0x20 +#define TXD_CMD_VLE 0x40 +#define TXD_CMD_IDE 0x80 + +/* for TX context descriptor only */ + +#define TXD_CMD_CTX_TCP 0x01 /* 1 == TCP, 0 == UDP */ +#define TXD_CMD_CTX_IP 0x02 +#define TXD_CMD_CTX_TSE 0x04 +#define TXD_CMD_CTX_RS 0x08 +#define TXD_CMD_CTX_DEXT 0x20 +#define TXD_CMD_CTX_IDE 0x80 + +/* TX Descriptor Status Fields */ + +#define TXD_STAT_DD 0x01 +#define TXD_STAT_EC 0x02 +#define TXD_STAT_LC 0x04 +#define TXD_STAT_TU 0x08 + +/* TX Data Descriptor POPTS fields */ + +#define TXD_DATA_POPTS_IXSM_BIT 0x01 +#define TXD_DATA_POPTS_TXSM_BIT 0x02 + +/* TX Data Descriptor DTYP Fileld */ +#define TXD_DTYP_BIT 0x01 + +/* RX Descriptor Status Field */ + +#define RXD_STAT_DD 0x01 +#define RXD_STAT_EOP 0x02 +#define RXD_STAT_IXSM 0x04 +#define RXD_STAT_VP 0x08 +#define RXD_STAT_RSV 0x10 +#define RXD_STAT_TCPCS 0x20 +#define RXD_STAT_IPCS 0x40 +#define RXD_STAT_PIF 0x80 + +/* RX Descriptor Error Field */ + +#define RXD_ERROR_CE 0x01 /* CRC or Align error */ +#define RXD_ERROR_SE 0x02 /* Symbol error */ +#define RXD_ERROR_SEQ 0x04 /* Sequence error */ +#define RXD_ERROR_RSV 0x08 /* reserved */ +#define RXD_ERROR_CXE 0x10 /* Carrier ext error */ +#define RXD_ERROR_TCPE 0x20 /* TCP/UDP CKSUM error */ +#define RXD_ERROR_IPE 0x40 /* IP CKSUM error */ +#define RXD_ERROR_RXE 0x80 /* RX data error */ + +/* Interrupt Register Fields */ + +#define INT_TXDW_BIT 0x01 /* TX descriptor write-back */ +#define INT_TXQE_BIT 0x02 /* TX ring empty */ +#define INT_LSC_BIT 0x04 /* link change interrupt */ +#define INT_RXSEQ_BIT 0x08 /* RX sequence error */ +#define INT_RXDMT0_BIT 0x10 /* RX descriptor Mini Threshold */ +#define INT_RXO_BIT 0x40 /* RX FIFO overrun */ +#define INT_RXTO_BIT 0x80 /* RX timer interrupt */ +#define INT_MDAC_BIT 0x200 /* MDIO complete interrupt */ +#define INT_RXCFG_BIT 0x400 /* Receiving /C/ ordered set */ +#define INT_GPI0_BIT 0x800 /* GPIO 0 interrupt (543 MAC) */ +#define INT_GPI1_BIT 0x1000 /* PHY (544 MAC) or GPIO1 (543) interrupt */ +#define INT_GPI2_BIT 0x2000 /* GPIO2 interrupt */ +#define INT_GPI3_BIT 0x4000 /* GPIO3 interrupt */ +#define INT_TXDLOW_BIT 0x8000 /* TX descriptor low threshold hit */ + +/* IMS register */ + +#define IMS_TXDW_BIT 0x01 +#define IMS_TXQE_BIT 0x02 +#define IMS_LSC_BIT 0x04 +#define IMS_RXSEQ_BIT 0x08 +#define IMS_RXDMT0_BIT 0x10 +#define IMS_RXO_BIT 0x40 +#define IMS_RXTO_BIT 0x80 +#define IMS_MDAC_BIT 0x200 +#define IMS_RXCFG_BIT 0x400 +#define IMS_TXDLOW_BIT 0x8000 + +/* IMC register */ + +#define IMC_ALL_BITS 0xffffffff +#define IMC_TXDW_BIT 0x01 +#define IMC_TXQE_BIT 0x02 +#define IMC_LSC_BIT 0x04 +#define IMC_RXSEQ_BIT 0x08 +#define IMC_RXDMT0_BIT 0x10 +#define IMC_RXO_BIT 0x40 +#define IMC_RXTO_BIT 0x80 +#define IMC_MDAC_BIT 0x200 +#define IMC_RXCFG_BIT 0x400 +#define IMC_TXDLOW_BIT 0x8000 + +/* ICR register */ + +#define ICR_TXDW_BIT 0x01 +#define ICR_TXQE_BIT 0x02 +#define ICR_LSC_BIT 0x04 +#define ICR_RXSEQ_BIT 0x08 +#define ICR_RXDMT0_BIT 0x10 +#define ICR_RXO_BIT 0x40 +#define ICR_RXTO_BIT 0x80 +#define ICR_MDAC_BIT 0x200 +#define ICR_RXCFG_BIT 0x400 +#define ICR_TXDLOW_BIT 0x8000 + +/* EEPROM Register Fields */ + +#define EECD_SK_BIT 0x1 +#define EECD_CS_BIT 0x2 +#define EECD_DI_BIT 0x4 +#define EECD_DO_BIT 0x8 +#define EECD_REQ_BIT 0x40 +#define EECD_GNT_BIT 0x80 +#define EECD_PRES_BIT 0x100 +#define EECD_SIZE_BIT 0x200 + +/* RAT field */ + +#define RAH_AV_BIT 0x80000000 + +/* Control Register Field */ + +#define CTRL_FD_BIT 0x1 +#define CTRL_PRIOR_BIT 0x4 +#define CTRL_ASDE_BIT 0x20 +#define CTRL_SLU_BIT 0x40 +#define CTRL_ILOS_BIT 0x80 +#define CTRL_SPD_100_BIT 0x100 +#define CTRL_SPD_1000_BIT 0x200 +#define CTRL_FRCSPD_BIT 0x800 +#define CTRL_FRCDPX_BIT 0x1000 +#define CTRL_SWDPIN0_BIT 0x40000 +#define CTRL_SWDPIN1_BIT 0x80000 +#define CTRL_SWDPIN2_BIT 0x100000 +#define CTRL_SWDPIN3_BIT 0x200000 +#define CTRL_SWDPIO0_BIT 0x400000 +#define CTRL_SWDPIO1_BIT 0x800000 +#define CTRL_SWDPIO2_BIT 0x1000000 +#define CTRL_SWDPIO3_BIT 0x2000000 +#define CTRL_RST_BIT 0x4000000 +#define CTRL_RFCE_BIT 0x8000000 +#define CTRL_TFCE_BIT 0x10000000 +#define CTRL_PHY_RST_BIT 0x80000000 +#define CTRL_MDC_BIT CTRL_SWDPIN3_BIT +#define CTRL_MDIO_BIT CTRL_SWDPIN2_BIT +#define CTRL_MDC_DIR_BIT CTRL_SWDPIO3_BIT +#define CTRL_MDIO_DIR_BIT CTRL_SWDPIO2_BIT +#define CTRL_SPEED_MASK 0x300 +#define CTRL_SWDPIOLO_SHIFT 22 +#define CTRL_ILOS_SHIFT 7 + +/* Receive Control Register Fields */ + +#define RCTL_MO_SHIFT 12 +#define RCTL_BSIZE_2048 0 +#define RCTL_BSIZE_4096 0x00030000 +#define RCTL_BSIZE_8192 0x00020000 +#define RCTL_BSIZE_16384 0x00010000 +#define RCTL_EN_BIT 0x00000002 +#define RCTL_SBP_BIT 0x00000004 +#define RCTL_UPE_BIT 0x00000008 +#define RCTL_MPE_BIT 0x00000010 +#define RCTL_LPE_BIT 0x00000020 +#define RCTL_BAM_BIT 0x00008000 +#define RCTL_BSEX_BIT 0x02000000 +#define RCTL_SECRC_BIT 0x04000000 + +/* MDI register fields */ + +#define MDI_WRITE_BIT 0x4000000 +#define MDI_READ_BIT 0x8000000 +#define MDI_READY_BIT 0x10000000 +#define MDI_ERR_BIT 0x40000000 +#define MDI_REG_SHIFT 16 +#define MDI_PHY_SHIFT 21 + +/* Flow Control Field and Initial value */ + +#define FCRTL_XONE_BIT 0x80000000 +#define FLOW_CONTROL_LOW_ADR 0x00c28001 +#define FLOW_CONTROL_HIGH_ADR 0x00000100 +#define FLOW_CONTROL_TYPE 0x8808 +#define FLOW_CONTROL_TIMER_VALUE 0x100 +#define FLOW_CONTROL_LOW_THRESH 0x4000 +#define FLOW_CONTROL_HIGH_THRESH 0x8000 + +/* Extended Control Register Fields */ + +#define CTRL_EXT_SWDPIN4_BIT 0x10 +#define CTRL_EXT_SWDPIN5_BIT 0x20 +#define CTRL_EXT_SWDPIN6_BIT 0x40 +#define CTRL_EXT_SWDPIN7_BIT 0x80 +#define CTRL_EXT_SWDPIO4_BIT 0x100 +#define CTRL_EXT_SWDPIO5_BIT 0x200 +#define CTRL_EXT_SWDPIO6_BIT 0x400 +#define CTRL_EXT_SWDPIO7_BIT 0x800 +#define CTRL_EXT_SWDPIOHI_SHIFT 8 + +#define CTRL_PHY_RESET_DIR4_BIT CTRL_EXT_SWDPIO4_BIT +#define CTRL_PHY_RESET4_BIT CTRL_EXT_SWDPIN4_BIT + +/* Status Register Fields */ + +#define STATUS_FD_BIT 0x1 +#define STATUS_LU_BIT 0x2 +#define STATUS_TBIMODE_BIT 0x20 +#define STATUS_SPEED_100_BIT 0x40 +#define STATUS_SPEED_1000_BIT 0x80 + +/* TX control Regsiter Fields */ + +#define TCTL_EN_BIT 0x2 +#define TCTL_PSP_BIT 0x8 +#define TCTL_PBE_BIT 0x800000 +#define TCTL_COLD_BIT 0x3ff000 +#define TCTL_COLD_SHIFT 12 +#define TCLT_CT_SHIFT 4 + +/* TIPG Register Fields */ + +#define TIPG_IPGR1_SHIFT 10 +#define TIPG_IPGR2_SHIFT 20 + +/* RDTR Register Field */ + +#define RDTR_FPD_BIT 0x80000000 + +/* TX Configuration Word fields */ + +#define TXCW_ANE_BIT 0x80000000 +#define TXCW_FD_BIT 0x20 +#define TXCW_ASM_DIR 0x100 +#define TXCW_PAUSE_BITS 0x180 + +/* RXCSUM register field */ + +#define RXCSUM_IPOFL_BIT 0x0100 +#define RXCSUM_TUOFL_BIT 0x0200 +#define RXCSUM_IPV6OFL_BIT 0x0400 + +/* PHY's Registers And Initial Value*/ + +#define PHY_PREAMBLE 0xFFFFFFFF +#define PHY_PREAMBLE_SIZE 32 +#define PHY_WR_OP 0x01 +#define PHY_RD_OP 0x02 +#define PHY_TURNAR 0x02 +#define PHY_MARK 0x01 + +#define CL_OVERHEAD 4 + +/* Type define */ + +typedef struct txDescManager TX_DESCTL; + +typedef TX_DESCTL * P_TX_DESCTL; + +struct txDescManager + { + M_BLK_ID mBlk; /* location for mBlk */ + }; + +typedef struct devDrv_stat + { + UINT32 rxtxHandlerNum; /* num of rxtx handle routine was called per sec */ + UINT32 rxIntCount; /* num of rx interrupt per sec */ + UINT32 txIntCount; /* num of tx interrupt per sec */ + UINT32 rxORunIntCount; /* num of rx overrun interrupt per sec */ + UINT32 rxPacketNum; /* num of rx packet per sec */ + UINT32 txPacketNum; /* num of tx packet per sec */ + UINT32 rxPacketDrvErr; /* num of pkt rx error on driver per sec */ + } DEVDRV_STAT; + +typedef struct dev_Timer + { + UINT32 rdtrVal; /* RDTR, unit of 1.024ns */ + UINT32 radvVal; /* RADV, unit of 1.024us */ + UINT32 itrVal; /* ITR, unit of 256 ns */ + UINT32 tidvVal; /* TIDV, unit of 1.024us */ + UINT32 tadvVal; /* TADV, unit of 1.024us */ + UINT32 watchDogIntVal; /* interval of watchdog, unit of second */ + } DEV_TIMER; + +struct adapter_info + { + int vector; /* interrupt vector */ + UINT32 regBaseLow; /* register PCI base address - low */ + UINT32 regBaseHigh; /* register PCI base address - high */ + UINT32 flashBase; /* flash PCI base address */ + + BOOL adr64; /* indictor of 64 bit address */ + UINT32 boardType; /* board type */ + UINT32 phyType; /* PHY type (MII/GMII) */ + + UINT32 delayUnit; /* delay unit(in ns) for the delay function */ + FUNCPTR delayFunc; /* BSP specified delay function */ + + STATUS (*intEnable)(int); /* board specific interrupt enable routine */ + STATUS (*intDisable)(int); /* board specific interrupt disable routine */ + STATUS (*intAck) (int); /* interrupt ack */ + + void (*phySpecInit)(PHY_INFO *, UINT8); /* vendor specified PHY's init */ + UINT32 (*sysLocalToBus)(int,UINT32); + UINT32 (*sysBusToLocal)(int,UINT32); + + FUNCPTR intConnect; /* interrupt connect function */ + FUNCPTR intDisConnect; /* interrupt disconnect function */ + + UINT16 eeprom_icw1; /* ICW1 in EEPROM */ + UINT16 eeprom_icw2; /* ICW2 in EEPROM */ + + UCHAR enetAddr[6]; /* Ether address for this adaptor */ + UCHAR reserved1[2]; /* reserved */ + + FUNCPTR phyDelayRtn; /* phy delay function */ + UINT32 phyMaxDelay; /* max phy detection retry */ + UINT32 phyDelayParm; /* delay parameter for phy delay function */ + UINT32 phyAddr; /* phy Addr */ + + BOOL (*sysGeiDynaTimerSetup)(struct adapter_info *); /* adjust device's timer dynamically */ + BOOL (*sysGeiInitTimerSetup)(struct adapter_info *); /* set the device's timer initially */ + + DEVDRV_STAT devDrvStat; /* statistic data for devices */ + DEV_TIMER devTimerUpdate; /* timer register value for update */ + + void (*phyBspPreInit)(PHY_INFO *, UINT8); /* BSP specific PHY init for 82543-copper */ + }; + +typedef struct adapter_info ADAPTOR_INFO; + +/* structure for Statistic registers */ + +typedef struct sta_reg + { + UINT32 crcerrs; /* CRC error count */ + UINT32 algnerrc; /* alignment err count */ + UINT32 symerrs; /* symbol err count */ + UINT32 rxerrc; /* rx err count */ + UINT32 mpc; /* missed packet count */ + UINT32 scc; /* single collision count */ + UINT32 ecol; /* excessive collision count */ + UINT32 mcc; /* multi collision count */ + UINT32 latecol; /* later collision count */ + UINT32 colc; /* collision count */ + UINT32 tuc; /* tx underun count */ + UINT32 dc; /* defer count */ + UINT32 tncrs; /* tx - no crs count */ + UINT32 sec; /* sequence err count */ + UINT32 cexteer; /* carrier extension count */ + UINT32 rlec; /* rx length error count */ + UINT32 xonrxc; /* XON receive count */ + UINT32 xontxc; /* XON transmit count */ + UINT32 xoffrxc; /* XOFF receive count */ + UINT32 xofftxc; /* XFF transmit count */ + UINT32 fcruc; /* FC received unsupported count */ + UINT32 prc64; /* packet rx (64 byte) count */ + UINT32 prc127; /* packet rx (65 - 127 byte) count */ + UINT32 prc255; /* packet rx (128 - 255 byte) count */ + UINT32 prc511; /* packet rx (256 - 511 byte) count */ + UINT32 prc1023; /* packet rx (512 - 1023 byte) count */ + UINT32 prc1522; /* packet rx (1024 - 1522 byte) count */ + UINT32 gprc; /* good packet received count */ + UINT32 bprc; /* broadcast packet received count */ + UINT32 mprc; /* Multicast packet received count */ + UINT32 gptc; /* good packet transmit count */ + UINT32 gorl; /* good octets receive count (low) */ + UINT32 gorh; /* good octets received count (high) */ + UINT32 gotl; /* good octets transmit count (lo) */ + UINT32 goth; /* good octets transmit count (hi) */ + UINT32 rnbc; /* receive no buffer count */ + UINT32 ruc; /* receive undersize count */ + UINT32 rfc; /* receive fragment count */ + UINT32 roc; /* receive oversize count */ + UINT32 rjc; /* receive Jabber count */ + UINT32 torl; /* total octets received (lo) */ + UINT32 torh; /* total octets received (hi) */ + UINT32 totl; /* total octets transmit (lo) */ + UINT32 toth; /* total octets transmit (hi) */ + UINT32 tpr; /* total packet received */ + UINT32 tpt; /* total packet transmit */ + UINT32 ptc64; /* packet transmit (64 byte) count */ + UINT32 ptc127; /* packet transmit (65-127 byte) count */ + UINT32 ptc255; /* packet transmit (128-255 byte) count */ + UINT32 ptc511; /* packet transmit (256-511 byte) count */ + UINT32 ptc1023; /* packet transmit (512-1023 byte) count */ + UINT32 ptc1522; /* packet transmit (1024-1522 byte) count */ + UINT32 mptc; /* Multicast packet transmit count */ + UINT32 bptc; /* Broadcast packet transmit count */ + UINT32 tsctc; /* TCP segmentation context tx count */ + UINT32 tsctfc; /* TCP segmentation context tx fail count */ + UINT32 rdfh; /* rx data FIFO head */ + UINT32 rdft; /* rx data FIFO tail */ + UINT32 rdfhs; /* rx data FIFO head saved register */ + UINT32 rdfts; /* rx data FIFO tail saved register */ + UINT32 rdfpc; /* rx data FIFO packet count */ + UINT32 tdfh; /* tx data FIFO head */ + UINT32 tdft; /* tx data FIFO tail */ + UINT32 tdfhs; /* tx data FIFO head saved register */ + UINT32 tdfts; /* tx data FIFO tail saved register */ + UINT32 tdfpc; /* tx data FIFO packet count */ + } STA_REG; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#if defined(__STDC__) || defined(__cplusplus) +IMPORT END_OBJ * gei82543EndLoad (char * initString); +#else +IMPORT END_OBJ * gei82543EndLoad (); +#endif /* defined(__STDC__) || defined(__cplusplus) */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCGEI82543Endh */ + + diff --git a/h/drv/end/iOlicomEnd.h b/h/drv/end/iOlicomEnd.h new file mode 100644 index 0000000..b4f5db9 --- /dev/null +++ b/h/drv/end/iOlicomEnd.h @@ -0,0 +1,620 @@ +/* iOlicomEnd.h - END-style Intel Olicom PCMCIA Ethernet interface header */ + +/* Copyright 1997-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,20sep01,dat Removing ANSI errors for diab compiler +01f,03aug00,jpd corrected length of drive name string (SPR #32276). +01e,11jun00,ham removed reference to etherLib. +01d,02sep98,jpd renamed struct type name to prevent conflict. Improved + data copying macros efficiency. Add big-endian support. +01c,02apr98,jpd made conditionally-compilable version for Brutus and PID. +01b,16feb98.jpd modified to work on Brutus, but not yet on both Brutus and PID. +01a,16dec97,rlp copied from if_oli.h +*/ + +#ifndef __INCiOlicomEndh +#define __INCiOlicomEndh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "end.h" +#include "netBufLib.h" +#include "netinet/if_ether.h" + +/* Define Constants */ + +#define PC_SOCKET_A 0x00 +#define PC_SOCKET_B 0x40 + +#define ATTRIBUTE_MEMORY_SLOT 0x01000 + + +#ifndef TARGET_HAS_NO_VADEM +#define PC_INDEX ((volatile char *)(ctrlBase + 0x00)) +#define PC_DATA_READ ((volatile int *) (ctrlBase + 0x01)) +#define PC_DATA_WRITE ((volatile char *)(ctrlBase + 0x01)) + +#define MAPPED_MEMORY_BASE 0x10000 /* 64K */ + +#define ATTRIB_MEMORY_A MAPPED_MEMORY_BASE +#define ATTRIB_MEMORY_B ATTRIB_MEMORY_A + ATTRIBUTE_MEMORY_SLOT +#endif /* TARGET_HAS_NO_VADEM */ + +/* + * Define to have complete control over the PCMCIA system. + * These definitions are Access macro, I/O Registers, Control Registers, + * PCMCIA Structures and Constants. + */ + +/* Macro definition for PCMCIA Access */ + +#ifndef I82595_REGS_CONTIGUOUS +#define PCMCIA_CALC_ADDR(x) (((((UINT)(x)) & ~0x01) << 1) | \ + (((UINT)(x)) & 0x01)) + +#define PCMCIA_READ_RAW(x, y) (*(volatile UINT *) (PCMCIA_CALC_ADDR(x) | (y))) + +#define PCMCIA_WRITE_RAW(x, y, z) (*(volatile UINT8 *) \ + (PCMCIA_CALC_ADDR(x) | (y)) = (z)) + +#define PCMCIA_IO_WRITE(x, y) ((*(volatile UINT8 *)(x)) = (y)) + +#define PCMCIA_IO_READ(x) (((((UINT)(x)) & 0x01) == 0) ? \ + (*(volatile UINT *)(x)) & OCT_MSK: \ + (*(volatile UINT *)(x)) >> 24) + +#define PCMCIA_ATTR_READ(x) (((((UINT)(x)) & ODD_MSK) == 0) ? \ + PCMCIA_READ_RAW(x, (int)pDrvCtrl->pcmcia.memBaseA) & OCT_MSK :\ + PCMCIA_READ_RAW(x, (int)pDrvCtrl->pcmcia.memBaseA) >> 24) + +#define PCMCIA_ATTR_WRITE(x, y) PCMCIA_WRITE_RAW((x), (int) \ + pDrvCtrl->pcmcia.memBaseA, (y)) +/* On PID, two apparently consecutive registers cannot be read at once */ + +#define READ_R14_R15(val) \ + { \ + val = PCMCIA_IO_READ (pDrvCtrl->pcmcia.oliAddr + I595_R14); \ + val |= (PCMCIA_IO_READ (pDrvCtrl->pcmcia.oliAddr + I595_R15) << 8); \ + } +#if (_BYTE_ORDER == _BIG_ENDIAN) +#define READ_PTR_R14_R15(ptr, pR14) \ + { \ + *(ptr)++ = (0xFF & *((volatile UINT32 *)(pR14))); \ + *(ptr)++ = (*((UINT32 *)((pR14) + 1)) >> 24); \ + } +#else /* (_BYTE_ORDER == _BIG_ENDIAN) */ +#define READ_PTR_R14_R15(ptr, pR14) \ + { \ + *(ptr)++ = *((volatile UINT8 *)(pR14)); \ + *(ptr)++ = (*((UINT32 *)((pR14) + 1)) >> 24); \ + } +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ +#define WRITE_R14_R15(val) \ + { \ + PCMCIA_IO_WRITE (pDrvCtrl->pcmcia.oliAddr + I595_R14, (val)); \ + PCMCIA_IO_WRITE (pDrvCtrl->pcmcia.oliAddr + I595_R15, ((val) >> 8)); \ + } +#define WRITE_PTR_R14_R15(ptr, pR14) \ + { \ + *(pR14) = *(ptr)++; \ + *((pR14) + 1) = *(ptr)++; \ + } +#else /* I82595_REGS_CONTIGUOUS */ +#define PCMCIA_CALC_ADDR(x) (x) +#define PCMCIA_IO_WRITE(x, y) ((*(volatile UINT8 *) (x)) = (y)) +#define PCMCIA_IO_WRITE16(x, y) ((*(volatile UINT16 *)(x)) = (y)) +#define PCMCIA_IO_READ(x) (* (volatile UINT8 *) (x)) +#define PCMCIA_IO_READ16(x) (* (volatile UINT16 *)(x)) +#define PCMCIA_ATTR_READ(x) (* (volatile UINT8 *) (x)) +#define PCMCIA_ATTR_WRITE(x, y) ((*(volatile UINT8 *) (x)) = (y)) + +/* On Brutus, R14 and R15 can be read with one 16 bit operation */ + +#define READ_R14_R15(val) \ + { \ + val = (PCMCIA_IO_READ16 (pDrvCtrl->pcmcia.oliAddr + I595_R14)); \ + } +#define READ_PTR_R14_R15(ptr, pR14) \ + { \ + *((UINT16 *)(ptr))++ = *((volatile UINT16 *)(pR14));\ + } +#define WRITE_R14_R15(val) \ + PCMCIA_IO_WRITE16 (pDrvCtrl->pcmcia.oliAddr + I595_R14, (val)); + +#define WRITE_PTR_R14_R15(ptr, pr14) \ + *(volatile UINT16 *)(pR14) = *((UINT16 *)(ptr))++; +#endif /* !I82595_REGS_CONTIGUOUS */ + +/* General Setup Registers */ + +#define PCIDREV 0x00 /* Identification & Revision */ +#define PCIFSTATUS 0x01 /* Interface Status */ +#define PCPWRRSTCTL 0x02 /* Power and RESETDRV Control */ +#define PCCSTATCHNG 0x04 /* Card Status Change */ +#define PCADDWINEN 0x06 /* Address Window Enable */ +#define PCCDGCR 0x16 /* Card Detect and General Control Register */ +#define PCGLBCTL 0x1E /* Global Control Register */ + +#define PCINTGCTL 0x03 /* Interrupt & General Control */ +#define PCSTATCHNGINT 0x05 /* Card Status Change Interrupt Configuration */ + +/* Definitions for fields in general setup registers */ + +/* Interface Status Register */ + +#define GSR_CD 0x0C /* Card detect - Complement of CD[2:1] pins */ +#define GSR_RDY 0x20 /* Card is ready */ + +/* Power and RESETDRV control register */ + +#define GSR_CPE 0x10 /* PC card power enable */ +#define GSR_PSE 0x20 /* Auto power switch enable */ +#define GSR_OE 0x80 /* Output enable */ + +/* Interrupt & general control register */ + +#define GSR_DRT 0x40 /* Deactivates reset signal to the PC card */ + +/* Card Status Change Register */ + +#define GSR_CDC 0x08 /* Card detect change */ + +/* Card status change interrupt configuration register */ + +#define GSR_IRQ4 0x40 /* IRQ4 enable */ +#define GSR_IRQ3 0x30 /* IRQ3 enable */ +#define GSR_CDE 0x08 /* Card detect enable */ + +/* Address window enable register */ + +#define GSR_WD0 0x01 /* Enable window 0 */ + +/* I/O Registers */ + +#define PCIOCTL 0x7 /* I/O Control */ +#define PCIOA0STARTL 0x08 /* I/O Addr 0 Start Low */ +#define PCIOA0STARTH 0x09 /* I/O Addr 0 Start High */ +#define PCIOA0STOPL 0x0A /* I/O Addr 0 Stop Low */ +#define PCIOA0STOPH 0x0B /* I/O Addr 0 Stop High */ +#define PCIOA1STARTL 0x0C /* I/O Addr 1 Start Low */ +#define PCIOA1STARTH 0x0D /* I/O Addr 1 Start High */ +#define PCIOA1STOPL 0x0E /* I/O Addr 1 Stop Low */ +#define PCIOA1STOPH 0x0F /* I/O Addr 1 Stop High */ + +#define PCSYSA0MSTARTL 0x10 /* System Memory Addr 0 Mapping Start Low */ +#define PCSYSA0MSTARTH 0x11 /* System Memory Addr 0 Mapping Start High */ +#define PCSYSA0MSTOPL 0x12 /* System Memory Addr 0 Mapping Stop Low */ +#define PCSYSA0MSTOPH 0x13 /* System Memory Addr 0 Mapping Stop High */ +#define PCCMEMA0OFFL 0x14 /* Card Memory Offset Addr 0 Low */ +#define PCCMEMA0OFFH 0x15 /* Card Memory Offset Addr 0 High */ + +#define PCSYSA1MSTARTL 0x18 /* System Memory Addr 1 Mapping Start Low */ +#define PCSYSA1MSTARTH 0x19 /* System Memory Addr 1 Mapping Start High */ +#define PCSYSA1MSTOPL 0x1A /* System Memory Addr 1 Mapping Stop Low */ +#define PCSYSA1MSTOPH 0x1B /* System Memory Addr 1 Mapping Stop High */ +#define PCCMEMA1OFFL 0x1C /* Card Memory Offset Addr 1 Low */ +#define PCCMEMA1OFFH 0x1D /* Card Memory Offset Addr 1 High */ + +#define PCSYSA2MSTARTL 0x20 /* System Memory Addr 2 Mapping Start Low */ +#define PCSYSA2MSTARTH 0x21 /* System Memory Addr 2 Mapping Start High */ +#define PCSYSA2MSTOPL 0x22 /* System Memory Addr 2 Mapping Stop Low */ +#define PCSYSA2MSTOPH 0x23 /* System Memory Addr 2 Mapping Stop High */ +#define PCCMEMA2OFFL 0x24 /* Card Memory Offset Addr 2 Low */ +#define PCCMEMA2OFFH 0x25 /* Card Memory Offset Addr 2 High */ + +#define PCSYSA3MSTARTL 0x28 /* System Memory Addr 3 Mapping Start Low */ +#define PCSYSA3MSTARTH 0x29 /* System Memory Addr 3 Mapping Start High */ +#define PCSYSA3MSTOPL 0x2A /* System Memory Addr 3 Mapping Stop Low */ +#define PCSYSA3MSTOPH 0x2B /* System Memory Addr 3 Mapping Stop High */ +#define PCCMEMA3OFFL 0x2C /* Card Memory Offset Addr 3 Low */ +#define PCCMEMA3OFFH 0x2D /* Card Memory Offset Addr 3 High */ + +#define PCSYSA4MSTARTL 0x30 /* System Memory Addr 4 Mapping Start Low */ +#define PCSYSA4MSTARTH 0x31 /* System Memory Addr 4 Mapping Start High */ +#define PCSYSA4MSTOPL 0x32 /* System Memory Addr 4 Mapping Stop Low */ +#define PCSYSA4MSTOPH 0x33 /* System Memory Addr 4 Mapping Stop High */ +#define PCCMEMA4OFFL 0x34 /* Card Memory Offset Addr 4 Low */ +#define PCCMEMA4OFFH 0x35 /* Card Memory Offset Addr 4 High */ + +/* Unique Registers */ + +#define PCCONTROL 0x38 /* Control */ +#define PCACTTIM 0x39 /* Activity Timer */ +#define PCMISC 0x3A /* Miscellaneous */ +#define PCGPIOCON 0x3B /* GPIO Configuration */ +#define PCPROGCS 0x3D /* Programmable Chip Select */ +#define PCPROGCSCON 0x3E /* Programmable Chip Select + * Configuration Register */ +#define PCATA 0x3F /* ATA */ + +/* Define PCMCIA structures */ + +typedef enum + { + COMMON, /* Common memory */ + ATTRIBUTE /* Attribute memory */ + } + MEMTYPE; + +typedef struct PCMCIASocket +{ + UINT pcs_attrbase; + UINT pcs_attrrange; + UINT pcs_iobase; + UINT pcs_iorange; +} PCMCIASOCKET; + +/* PCMCIA Control Structure */ + +typedef struct pcmcia_ctrl + { + char * ioBaseA; /* I/O space base address for Card A */ + char * attrBaseA; /* Attribute space base address Card A*/ + char * memBaseA; /* Memory space base address Card A */ + char * ioBaseB; /* I/O space base address for Card B */ + char * attrBaseB; /* Attribute space base address Card B*/ + char * memBaseB; /* Memory space base address Card B */ + char * ctrlBase; /* Base of Vadem PCMCIA controller */ + char * oliAddr; /* address of board */ + char * oliAttribMem; /* Address of attribute memory */ + int intLevelA; /* Interrupt level for Card A */ + int intVectA; /* Interrupt vector for Card A */ + int intLevelB; /* Interrupt level for Card B */ + int intVectB; /* Interrupt vector for Card B */ + BOOL cardPresent; /* TRUE if a card is in the slot */ + UINT socket; /* Socket holding card, A or B */ + PCMCIASOCKET theSocket; /* PCMCIA Socket descriptor */ + } OLI_PCMCIA_CTRL; + +/* Trasmit Buffer Descriptor */ + +typedef struct tx_bd + { + UINT16 statusMode; /* status and control */ + UINT16 dataLength; /* length of data buffer in bytes */ + char * dataPointer; /* points to memory data buffer */ + } TX_BD; + +/* Receive Buffer Descriptor */ + +typedef struct rx_bd + { + UINT16 statusMode; /* status and control */ + UINT16 dataLength; /* length of data buffer in bytes */ + char * dataPointer; /* points to memory data buffer */ + } RX_BD; + +/* Olicom Card Configuration registers */ + +#define CARDCONFREG0 0x3F8 +#define CARDCONFREG1 0x3FA + +/* Definitions for fields in Olicom card configuration registers */ + +/* Register 1 */ + +#define CREG1_INT_IO 0x02 /* I/O Interrupt */ + +/* There are four tuples that we need to read from the card */ + +#define CARD_FUNCID 0x21 /* Should identify the card as + an Network Adaptor */ +#define CARD_FUNCE 0x22 /* Function extension tuple detailing + the Ethernet hardware address */ +#define CARD_CONFIG 0x1A /* Describes card configuration registers */ +#define CARD_CFT_ENTRY 0x1B /* There are several different copies of + this one tuple, which describe the + different I/O addresses accepted by the + Intel 82595 Controller */ + +/* + * Register layout of the Intel 82595TX chip + * + * Those ever imaginative people at Intel have no other + * names for the registers on their chip than r1, r2 + * etc.. + * + */ + +#ifndef I82595_REGS_CONTIGUOUS +/* + * To try and optimise I/O to the chip, this structure represents + * the *real* appearance of the chip in the PID7T NISA I/O space; + * the weird wiring arrangement described in pid.h means that, + * although the chip has a sequential collection of registers, they + * appear to be grouped as two-register pairs, aligned on a word + * boundary + */ +#define I595_R0 0x00 +#define I595_R1 0x01 +#define I595_R2 0x04 +#define I595_R3 0x05 +#define I595_R4 0x08 +#define I595_R5 0x09 +#define I595_R6 0x0C +#define I595_R7 0x0D +#define I595_R8 0x10 +#define I595_R9 0x11 +#define I595_R10 0x14 +#define I595_R11 0x15 +#define I595_R12 0x18 +#define I595_R13 0x19 +#define I595_R14 0x1C +#define I595_R15 0x1D +#else +/* Normal layout */ +#define I595_R0 0x00 +#define I595_R1 0x01 +#define I595_R2 0x02 +#define I595_R3 0x03 +#define I595_R4 0x04 +#define I595_R5 0x05 +#define I595_R6 0x06 +#define I595_R7 0x07 +#define I595_R8 0x08 +#define I595_R9 0x09 +#define I595_R10 0x0A +#define I595_R11 0x0B +#define I595_R12 0x0C +#define I595_R13 0x0D +#define I595_R14 0x0E +#define I595_R15 0x0F +#endif /* !I82595_REGS_CONTIGUOUS */ + +/* + * Register 0 is special, as it's the same in all banks + * Access Macro to Register 0. + */ + +#define SELECTBANK(c, b)(PCMCIA_IO_WRITE((c) + I595_R0, (b) << 6)) +#define RUNCMD(c, o) (PCMCIA_IO_WRITE((c) + I595_R0, \ + ((o) & OPCODE_MASK))) +#define ABORTCMD(c) (PCMCIA_IO_WRITE((c) + I595_R0, (1 << 5))) + +/* 82595TX Command Set for register 0 */ + +#define CMD_MC_SETUP 0x03 +#define CMD_TRANSMIT 0x04 +#define CMD_TDR 0x05 +#define CMD_DUMP 0x06 +#define CMD_DIAGNOSE 0x07 +#define CMD_RCV_ENABLE 0x08 +#define CMD_RCV_DISABLE 0x0A +#define CMD_RCV_STOP 0x0B +#define CMD_ABORT 0x0D +#define CMD_RESET 0x0E +#define CMD_XMIT_RAW 0x14 +#define CMD_CONT_XMIT_LIST 0x15 +#define CMD_SET_TRISTATE 0x16 +#define CMD_RESET_TRISTATE 0x17 +#define CMD_POWER_DOWN 0x18 +#define CMD_RESUME_XMIT_LIST 0x1C +#define CMD_SEL_RESET 0x1E + +#define OPCODE_MASK 0x1F + +/* 82595TX result codes for register 0 */ + +#define RESULT_INIT_DONE 0x0E + +/* Definitions for fields and bits in the OLI_DEVICE */ + +/* I/O Bank 0 */ + +/* Reg 1 Interrupt/Status Register */ + +#define BNK0_RX_SIT 0x01 /* RX stop interrupt */ +#define BNK0_RX_IT 0x02 /* RX interrupt */ +#define BNK0_TX_IT 0x04 /* TX interrupt */ +#define BNK0_EXE_IT 0x08 /* Execution interrupt */ +#define BNK0_EXE_IDL 0x00 /* Execution state idle */ +#define BNK0_EXE_BSY 0x20 /* Execution state busy */ +#define BNK0_EXE_ART 0x30 /* Execution state aborting */ +#define BNK0_RCV_DIS 0x00 /* Receive state disable */ +#define BNK0_RCV_RDY 0x40 /* Receive state ready */ +#define BNK0_RCV_ACT 0x80 /* Receive state active */ +#define BNK0_RCV_STP 0xC0 /* Receive state stopping */ + +#define BNK0_ITS_MSK 0x0F /* All interrupts mask */ +#define BNK0_EXE_MSK 0x30 /* Execution state mask */ +#define BNK0_RCV_MSK 0xC0 /* Receive state mask */ + +#define BNK0_EXE_STE(r) ((r) & BNK0_EXE_MSK) +#define BNK0_RCV_STE(r) ((r) & BNK0_RCV_MSK) + +/* Reg 3 Interrupt Mask Register */ + +#define BNK0_RX_SMK 0x01 /* RX stop interrupt mask */ +#define BNK0_RX_MK 0x02 /* RX interrupt mask */ +#define BNK0_TX_MK 0x04 /* TX interrupt mask */ +#define BNK0_EXE_MK 0x08 /* Execution interrupt mask */ +#define BNK0_HAR_SLT 0x10 /* 32Bit IO port/host address select */ +#define BNK0_CBR_SLT 0x20 /* Current/Base register select */ + +/* I/O Bank 1 */ + +/* Reg 1 Config ISA Register/Tri-state irq lines */ + +#define BNK1_ISA_HBW 0x02 /* Host bus width (ISA only) */ +#define BNK1_ISA_ART 0x40 /* Alternate ready timing (ISA only) */ +#define BNK1_TST_EN 0x80 /* Tri-state interrupt lines */ + +/* I/O Bank 2 */ + +/* Reg 1 Control the program features of the 82595TX */ + +#define BNK2_TCP_DIS 0x01 /* Transmit concurrent processing disable */ +#define BNK2_PCM_ISA 0x10 /* PCMCIA/ISA Select */ +#define BNK2_TCH_END 0x20 /* Transmit chaining int mode */ +#define BNK2_TCH_ERR 0x40 /* Transmit chaining error stop */ +#define BNK2_BAD_DSC 0x80 /* Discard bad frames */ + +/* Reg 2 Control the program features of the 82595TX */ + +#define BNK2_PCS_EN 0x01 /* Promiscous mode enable */ +#define BNK2_BRO_DIS 0x02 /* Disable broadcast */ +#define BNK2_RX_CRC 0x04 /* RX CRC in memory */ +#define BNK2_LEN_DIS 0x08 /* Length disable */ +#define BNK2_SAI_EN 0x10 /* enable source address insertion */ +#define BNK2_MIA_EN 0x20 /* Multi individual address enable */ +#define BNK2_LP_DIS 0x00 /* Loopback disable */ +#define BNK2_LP_INT 0x40 /* Internal loopback */ +#define BNK2_LP_EXT 0x80 /* External loopback */ + +/* Reg 3 Control the program features of the 82595TX */ + +#define BNK2_LI_DIS 0x01 /* Link integrity disable */ +#define BNK2_PC_DIS 0x02 /* disable polarity correction */ +#define BNK2_TPE_AUI 0x04 /* TPE/AUI */ +#define BNK2_JB_DIS 0x08 /* Jabber disable */ +#define BNK2_AP_EN 0x10 /* APORT */ +#define BNK2_BNC_TPE 0x20 /* BNC/TPE */ +#define BNK2_TST_EN 0xC0 /* Production testing mode */ + + +/* RCV status field*/ + +#define RCV_EOF 0x08 /* Reception of frame completed */ +#define RCV_BOF 0x10 /* Begining of frame bit */ +#define RCV_RXCPY 0x20 /* RCV copy threshold */ +#define RCV_RECLM 0x40 /* RCV-DMA reclaimes location */ +#define RCV_UNDRN 0x80 /* RCV data underrun */ + +#define RCV_COL_DCT 0x0001 /* Collision detected */ +#define RCV_IA_MCH 0x0002 /* Individual address match */ +#define RCV_SRT_FRM 0x0080 /* Received frame shorter than 64Bytes */ +#define RCV_OVR_RUN 0x0100 /* OVERRUN */ +#define RCV_ALG_ERR 0x0400 /* Alignment error */ +#define RCV_CRC_ERR 0x0800 /* CRC error */ +#define RCV_LEN_ERR 0x1000 /* Length error */ +#define RCV_OK 0x2000 /* Frame received OK */ +#define RCV_TYP_LEN 0x8000 /* Type field */ + +/* XMT status field*/ + +#define XMT_COL_MAX 0x0020 /* Failed due to max collisions */ +#define XMT_HRT_BET 0x0040 /* Collision detect test passed after prev Tx */ +#define XMT_LN_DEF 0x0080 /* Tx deferred due to link activity */ +#define XMT_UND_RUN 0x0100 /* Underrun */ +#define XMT_LST_CRS 0x0400 /* Carrier sense lost */ +#define XMT_LT_COL 0x0800 /* Later collision */ +#define XMT_OK 0x2000 /* Transmit OK */ +#define XMT_COLL 0x8000 /* Collision on the last transmit */ + +#define XMT_COL_MSK 0x000F /* number collisions mask */ +#define XMT_CHAIN 0x8000 /* Flag indicates a XMT chaining (16Bit) */ +#define XMT_CHAIN_OCT 0x80 /* Flag indicates a XMT chaining (8Bit) */ + +#define TOTAL_RAM_SIZE (64 * 1024) +#define RAM_TX_BASE (0) +#define RAM_TX_SIZE (32 * 1024) +#define RAM_TX_LIMIT (RAM_TX_BASE + (RAM_TX_SIZE - 1)) + +#define RAM_RX_SIZE (TOTAL_RAM_SIZE - RAM_TX_SIZE) +#define RAM_RX_BASE (RAM_TX_SIZE) +#define RAM_RX_LIMIT (RAM_RX_BASE + (RAM_RX_SIZE - 1)) + + +/* + * Macro for converting from packet byte count to length in Tx ring + * buffer which needs to include 8 bytes of header and half-word + * alignment + */ + +#define COUNT_TO_LEN(x) ((x) + ((((x) & 0x01) == 0) ? 8 : 9)) + +/* Define Ethernet Network Driver parameters */ + +#define MAX_UNITS 1 /* max Olicom units */ +#define DRV_NAME "oli" +#define DRV_NAME_LEN 4 /* including null terminator */ +#define EADDR_LEN 6 +#define OLI_BUFSIZ (ETHERMTU + SIZEOF_ETHERHEADER + EADDR_LEN) +#define OLI_SPEED 10000000 + +#define TX_BD_MIN 2 /* minimum number of Tx buffer descriptors */ +#define TX_BD_MAX 0x14 /* maximum number of Tx buffer descriptors */ +#define RX_BD_MIN 2 /* minimum number of Rx buffer descriptors */ +#define TX_BD_DEFAULT 0x10 /* default number of Tx buffer descriptors */ +#define RX_BD_DEFAULT 0x10 /* default number of Rx buffer descriptors */ +#define OLI_MIN_FBUF 9 /* min. size of the first buffer in a frame */ +#define OLI_MAX_XMT 0x600 /* max. size of the XMT block mem. structure */ +#define NUM_LOAN 0x10 /* number of Rx loaner buffers in pool */ + +/* Define control structures */ + +/* typedefs */ + +typedef struct free_buf + { + void * pClBuf; /* pointer cluster buffer */ + } FREE_BUF; + +/* The definition of the driver control structure */ + +typedef struct end_device + { + END_OBJ endObj; /* The class we inherit from. */ + int unit; /* unit number */ + long flags; /* Our local flags. */ + + OLI_PCMCIA_CTRL pcmcia; /* PCMCIA control structure */ + int ivec; /* interrupt vector */ + int ilevel; /* interrupt level */ + + int txBdNum; /* number of transmit BD */ + TX_BD * txBdBase; /* transmit BD base address */ + int txBdNext; /* next transmit BD to fill */ + int txBdIndexC; /* current transmit BD index */ + + int rxBdNum; /* number of receive BD */ + RX_BD * rxBdBase; /* receive BD base address */ + int rxBdNext; /* next receive BD to read */ + + char * pShMem; /* real ptr to shared memory */ + ULONG shMemSize; /* shared memory size */ + + UINT8 enetAddr[EADDR_LEN]; /* ethernet address */ + int offset; + + CACHE_FUNCS cacheFuncs; /* cache function pointers */ + FREE_BUF freeBuf[128]; /* Array of free routines. */ + CL_POOL_ID clPoolId; + } END_DEVICE; + +#define FLTR_FRM_SIZE 0x180 /* filter frm size 64 Multicast address */ + +/* Definitions for the flags field */ + +#define OLI_RCV_HANDLING 0x0001 +#define OLI_POLLING 0x0002 /* Poll mode */ +#define OLI_TX_CLEANING 0x0004 +#define OLI_TX_STOP 0x0008 + +#define OLI_MEMOWN 0x8000 /* memory allocated by driver */ + +/* state of transmit BD */ + +#define TX_BD_READY 0x80 + +/* state of receive BD */ + +#define RX_BD_EMPTY 0x01 + +/* definitions of several mask */ + +#define OCT_MSK 0xFF /* 8-bit mask */ +#define ODD_MSK 0x01 /* Odd mask */ + + +#ifdef __cplusplus +} +#endif + + +#endif /* __INCiOlicomEndh */ diff --git a/h/drv/end/ln7990End.h b/h/drv/end/ln7990End.h new file mode 100644 index 0000000..a19efdd --- /dev/null +++ b/h/drv/end/ln7990End.h @@ -0,0 +1,225 @@ +/* ln7990End.h - END based AMD LANCE Ethernet header */ + +/* Copyright 1984-1998 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01f,22sep98,dat Fixed lint warnings in LN_RMD_TO_ADDR by adding parens +01e,02jun97,gnn Changed LN_TMD_TO_ADDR to take into account Force 30 issue. +01d,21jan97,gnn Added LN_TMD_TO_ADDR to map a address from a TMD. +01c,13nov96,dat Removed LN_REGS. +01b,22oct96,gnn moved some stuff to ln7990EndCommon.h + added macros for accesses to registers + cleaned up some structs and unions. +01a,15aug96,gnn copied from if_ln.h. +*/ + +#ifndef __INCln7990Endh +#define __INCln7990Endh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Control block definitions for AMD LANCE (Ethernet) chip. + * This has some of the same (mis)features as the Intel 82586 with + * regards to byte ordering. It assumes that a memory address specifies + * the location of the least significant byte of a multi-byte value. This + * is correct for most Intel & DEC processors, but is wrong for 680x0s. + * As a result, all addresses specified to the chip must have their + * words swapped. At least it has a control bit to automatically swap + * bytes during data transfer dma. (The 82586 is much worse.) + */ + +/* + * Initialization Block. + * Specifies addresses of receive and transmit descriptor rings. + */ +typedef struct lnIB + { + u_short lnIBMode; /* mode register */ + char lnIBPadr [6]; /* PADR: byte swapped ethernet physical address */ + /* LADRF: logical address filter */ + u_short lnIBLadrfLow; /* least significant word */ + u_short lnIBLadrfMidLow; /* low middle word */ + u_short lnIBLadrfMidHigh; /* high middle word */ + u_short lnIBLadrfHigh; /* most significant word */ + /* RDRA: read ring address */ + u_short lnIBRdraLow; /* low word */ + u_short lnIBRdraHigh; /* high word */ + /* TDRA: transmit ring address */ + u_short lnIBTdraLow; /* low word */ + u_short lnIBTdraHigh; /* high word */ + } ln_ib; + +/* + * Receive Message Descriptor Entry. + * Four words per entry. Number of entries must be a power of two. + */ +typedef struct lnRMD + { + u_short lnRMD0; /* bits 15:00 of receive buffer address */ + u_short lnRMD1; /* bits 23:16 of receive buffer address */ + u_short lnRMD2; /* buffer byte count (negative) */ + u_short lnRMD3; /* message byte count */ + } ln_rmd; + + +#define rbuf_ladr lnRMD0 +#define rbuf_hadr lnRMD1 +#define rbuf_bcnt lnRMD2 +#define rbuf_mcnt lnRMD3 + +/* + * Transmit Message Descriptor Entry. + * Four words per entry. Number of entries must be a power of two. + */ +typedef struct lnTMD + { + u_short lnTMD0; /* bits 15:00 of transmit buffer address */ + + union + { + u_short lnTMD1; /* bits 23:16 of transmit buffer address */ + u_short ln_tmd1b; + } ln_tmd1; + + u_short lnTMD2; /* message byte count */ + + union + { + u_short lnTMD3; /* errors */ + u_short lntmd3b; + } ln_tmd3; + } ln_tmd; + +#define tbuf_ladr lnTMD0 +#define tbuf_hadr ln_tmd1.lnTMD1 +#define tbuf_stat ln_tmd1.lnTMD1 +#define tbuf_bcnt lnTMD2 +#define tbuf_err ln_tmd3.lnTMD3 + +/* Definitions for fields and bits in the LN_REGS */ + +#define lnrmd1_OWN 0x8000 /* Own */ +#define lnrmd1_ERR 0x4000 /* Error */ +#define lnrmd1_FRAM 0x2000 /* Framming Error */ +#define lnrmd1_OFLO 0x1000 /* Overflow */ +#define lnrmd1_CRC 0x0800 /* CRC */ +#define lnrmd1_BUFF 0x0400 /* Buffer Error */ +#define lnrmd1_STP 0x0200 /* Start of Packet */ +#define lnrmd1_ENP 0x0100 /* End of Packet */ +#define lnrmd1_HADR 0x00FF /* High Address */ + +#define lntmd1_OWN 0x8000 /* Own */ +#define lntmd1_ERR 0x4000 /* Error */ +#define lntmd1_MORE 0x1000 /* More than One Retry */ +#define lntmd1_ONE 0x0800 /* One Retry */ +#define lntmd1_DEF 0x0400 /* Deferred */ +#define lntmd1_STP 0x0200 /* Start of Packet */ +#define lntmd1_ENP 0x0100 /* End of Packet */ +#define lntmd1_HADR 0x00FF /* High Address */ + +#define lntmd3_BUFF 0x8000 /* Buffer Error */ +#define lntmd3_UFLO 0x4000 /* Underflow Error */ + +#define lntmd3_LCOL 0x1000 /* Late Collision */ +#define lntmd3_LCAR 0x0800 /* Lost Carrier */ +#define lntmd3_RTRY 0x0400 /* Retry Error */ +#define lntmd3_TDR 0x03FF /* Time Domain Reflectometry */ + +/* + * Generic shared memory read and write macros. + */ + +#ifndef SHMEM_RD +# define SHMEM_RD(x) *(x) +#endif + +#ifndef SHMEM_WR +# define SHMEM_WR(x,y) (*(x) = y) +#endif + +/* + * Macros for read and write descriptors. + * + */ +#define LN_RMD_BUF_TO_ADDR(rmd, tmp, buf) \ + tmp = LN_CACHE_VIRT_TO_PHYS (buf); \ + rmd->rbuf_ladr = (u_long) tmp;\ + rmd->rbuf_hadr = (((u_long) tmp >> 16) & lnrmd1_HADR) | lnrmd1_OWN; + +#define LN_TMD_BUF_TO_ADDR(tmd, tmp, buf) \ + tmp = LN_CACHE_VIRT_TO_PHYS (buf); \ + tmd->tbuf_ladr = (u_long) tmp;\ + tmd->tbuf_hadr = (u_long) tmp >> 16; + +#define LN_TMD_TO_ADDR(tmd, addr) \ + addr = (tmd->tbuf_ladr | (tmd->tbuf_hadr << 16)) & 0x00ffffff; + +#define LN_RMD_TO_ADDR(pool, rmd, addr) \ + addr = (((ULONG)pool & 0xff000000) | \ + ((rmd->rbuf_ladr | (rmd->rbuf_hadr << 16)) & 0x00ffffff)); + +#define LN_ADDR_TO_RMD(addr, rmd) \ + rmd->rbuf_ladr = addr; \ + rmd->rbuf_hadr = (addr >> 16) & lnrmd1_HADR; + +#define LN_CLEAN_RXD(rmd) \ + pRmd->rbuf_hadr &= 0xff;\ + pRmd->rbuf_mcnt = 0; \ + pRmd->lnRMD1 |= lnrmd1_OWN; + +#define LN_ADDR_TO_IB_RMD(addr, ib, rsize) \ + ib->lnIBRdraLow = (u_long) addr; \ + ib->lnIBRdraHigh = (((u_long) addr >> 16) & 0xff) | (rsize << 13); + +#define LN_ADDR_TO_IB_TMD(addr, ib, tsize) \ + ib->lnIBTdraLow = (u_long) addr; \ + ib->lnIBTdraHigh = (((u_long) addr >> 16) & 0xff) | (tsize << 13); + +#define LN_RMD_OWNED(rmd) \ + (rmd->lnRMD1 & lnrmd1_OWN) + +#define LN_ADDRF_CLEAR(ib) \ + ib->lnIBLadrfLow = 0; \ + ib->lnIBLadrfMidLow = 0; \ + ib->lnIBLadrfMidHigh = 0; \ + ib->lnIBLadrfHigh = 0; + +#define LN_ADDRF_SET(ib, crc) \ + switch (crc >> 4)\ + {\ + case 0:\ + pIb->lnIBLadrfLow |= 1 << (crc & 0xf);\ + break;\ + case 1: \ + pIb->lnIBLadrfMidLow |= 1 << (crc & 0xf);\ + break;\ + case 2:\ + pIb->lnIBLadrfMidHigh |= 1 << (crc & 0xf);\ + break;\ + case 3:\ + pIb->lnIBLadrfHigh |= 1 << (crc & 0xf);\ + break;\ + default:\ + break;\ + } + +#define LN_PKT_LEN_GET(rmd) \ + pRmd->rbuf_mcnt - 4; + +#define LN_RMD_ERR(rmd) \ + (rmd->lnRMD1 & lnrmd1_ERR) || \ + ( \ + (rmd->lnRMD1 & (lnrmd1_STP | lnrmd1_ENP)) != \ + (lnrmd1_STP | lnrmd1_ENP)) + +#define LN_TMD_CLR_ERR(tmd) \ + tmd->tbuf_stat &= lnrmd1_HADR +#ifdef __cplusplus +} +#endif + +#endif /* __INCln7990Endh */ diff --git a/h/drv/end/ln7990EndCommon.h b/h/drv/end/ln7990EndCommon.h new file mode 100644 index 0000000..5271c70 --- /dev/null +++ b/h/drv/end/ln7990EndCommon.h @@ -0,0 +1,81 @@ +/* ln7990EndCommon.h - defines common across all versions of the driver. */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,26apr02,dat Adding cplusplus protection, SPR 75017 +01b,21jan97,gnn Added LN_MIN_FBUF for the minimum size of the first TMD buf + in a buffer chain. +01a,01oct96,gnn written. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: +*/ + +#ifndef __INCln7990EndCommonh +#define __INCln7990EndCommonh + +/* includes */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* defints */ +#define TMD_OWN 0x8000 +#define TMD_ERR 0x6000 + +#define TMD_BUFF 0x8000 +#define TMD_UFLO 0x4000 +#define TMD_LCAR 0x0800 + +#define LN_MIN_FBUF 100 /* Minimum size of the first buffer in a */ + /* chain. */ + +/* Configuration items */ + +#define RMD_SIZ sizeof(ln_rmd) +#define TMD_SIZ sizeof(ln_tmd) +#define IB_SIZ sizeof(ln_ib) + +#define lncsr_ERR 0x8000 /* (RO) error flag (BABL|CERR|MISS|MERR) */ +#define lncsr_BABL 0x4000 /* (RC) babble transmitter timeout */ +#define lncsr_CERR 0x2000 /* (RC) collision error */ +#define lncsr_MISS 0x1000 /* (RC) missed packet */ +#define lncsr_MERR 0x0800 /* (RC) memory error */ +#define lncsr_RINT 0x0400 /* (RC) receiver interrupt */ +#define lncsr_TINT 0x0200 /* (RC) transmitter interrupt */ +#define lncsr_IDON 0x0100 /* (RC) initialization done */ +#define lncsr_INTR 0x0080 /* (RO) interrupt flag */ +#define lncsr_INEA 0x0040 /* (RW) interrupt enable */ +#define lncsr_RXON 0x0020 /* (RO) receiver on */ +#define lncsr_TXON 0x0010 /* (RO) transmitter on */ +#define lncsr_TDMD 0x0008 /* (WOO)transmit demand */ +#define lncsr_STOP 0x0004 /* (WOO)stop (& reset) chip */ +#define lncsr_STRT 0x0002 /* (RW) start chip */ +#define lncsr_INIT 0x0001 /* (RW) initialize (acces init block) */ + +#define lncsr3_BSWP 0x0004 /* Byte Swap */ +#define lncsr3_ACON 0x0002 /* ALE Control */ +#define lncsr3_BCON 0x0001 /* Byte Control */ + + +/* typedefs */ + +/* globals */ + +/* locals */ + +/* forward declarations */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCln7990EndCommonh */ diff --git a/h/drv/end/ln97xEnd.h b/h/drv/end/ln97xEnd.h new file mode 100644 index 0000000..9a47785 --- /dev/null +++ b/h/drv/end/ln97xEnd.h @@ -0,0 +1,485 @@ +/* ln97xEnd.h - END style AMD Am79C97X PCnet-PCI Ethernet driver header */ + +/* Copyright 1998-2004 Wind River Systems, Inc. */ +/* Copyright 1998 CETIA Inc. */ + +/* +modification history +-------------------- +01i,26sep05,wap Add TX underflow error indication flag (SPR #111881) +01h,02nov04,wap Fixed SPR# 102962 and SPR# 103409 +01g,08aug04,sru Added fields to support fast phys-to-virt translation. +01f,30may02,sru Added REG_SWAP and LS_MODE_NOSWAP_MASTER definitions. +01e,12nov01,pai Added definitions for CSR5 and CSR8-CSR11 fields. Setup + PCI_SWAP definition in one place. Doubled the number of + receive and transmit descriptors the device will use. + Removed obsolete member from DRV_CTRL. + Removed superfluous "arch-specific" (CPU_FAMILY==I80X86) + macros. +01d,27mar01,tlc Add definitions for interrupt level and PCI bus endianess. + Revised how PCI_SWAP is defined. It is now conditionally + defined based on the ln97xEndianess parameter set in + ln97xParamInit(). +01c,11jun00,ham removed reference to etherLib. +01b,19may00,pai Implemented accumulated driver bug fixes (SPR #31349). +01a,07dec98,snk added support 7997x[012] across architectures. + written from 01b of lnPciEnd.h +*/ + +#ifndef __INCln97xEndh +#define __INCln97xEndh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "end.h" +#include "cacheLib.h" +#include "netinet/if_ether.h" + + +/* define the various levels of debugging if the DRV_DEBUG is defined */ + +#ifdef DRV_DEBUG +# include "logLib.h" +# define DRV_DEBUG_OFF 0x0000 +# define DRV_DEBUG_RX 0x0001 +# define DRV_DEBUG_TX 0x0002 +# define DRV_DEBUG_INT 0x0004 +# define DRV_DEBUG_POLL (DRV_DEBUG_POLL_RX | DRV_DEBUG_POLL_TX) +# define DRV_DEBUG_POLL_RX 0x0008 +# define DRV_DEBUG_POLL_TX 0x0010 +# define DRV_DEBUG_LOAD 0x0020 +# define DRV_DEBUG_LOAD2 0x0040 +# define DRV_DEBUG_IOCTL 0x0080 +# define DRV_DEBUG_RESET 0x0100 +# define DRV_DEBUG_MCAST 0x0200 +# define DRV_DEBUG_CSR 0x0400 +# define DRV_DEBUG_RX_PKT 0x0800 +# define DRV_DEBUG_POLL_REDIR 0x10000 +# define DRV_DEBUG_LOG_NVRAM 0x20000 +# define DRV_DEBUG_ALL 0xfffff +#endif /* DRV_DEBUG */ + +/* board level/bus specific and architecture specific macros */ + +#if _BYTE_ORDER==_BIG_ENDIAN +# define PCI_SWAP(x) ((ln97xBusEndianess) ? (int)(x) : LONGSWAP((int)(x))) +#else +# define PCI_SWAP(x) (x) +#endif + +#if _BYTE_ORDER==_BIG_ENDIAN +# define REG_SWAP(d,x) (((d)->flags & LS_MODE_NOSWAP_MASTER) ? \ + (int)(x) : LONGSWAP((int)(x))) +#else +# define REG_SWAP(d,x) (x) +#endif + +/* device IO or memory mapped access and data registers */ + +#define LN_97X_RDP ((UINT32 *)((UINT32)(pDrvCtrl->devAdrs) + 0x10)) +#define LN_97X_RAP ((UINT32 *)((UINT32)(pDrvCtrl->devAdrs) + 0x14)) +#define LN_97X_RST ((UINT32 *)((UINT32)(pDrvCtrl->devAdrs) + 0x18)) +#define LN_97X_BDP ((UINT32 *)((UINT32)(pDrvCtrl->devAdrs) + 0x1C)) + +/* csr and bcr addresses */ + +#define CSR(x) (x) +#define BCR(x) (x) + +/* Definitions for fields and bits in the device */ + +#define CSR0_RESRVD 0xffff0000 /* resvd: written 0, read undefined */ +#define CSR0_ERR 0x8000 /* (RO) err flg (BABL|CERR|MISS|MERR) */ +#define CSR0_BABL 0x4000 /* (RC) babble transmitter timeout */ +#define CSR0_CERR 0x2000 /* (RC) collision error */ +#define CSR0_MISS 0x1000 /* (RC) missed packet */ +#define CSR0_MERR 0x0800 /* (RC) memory error */ +#define CSR0_RINT 0x0400 /* (RC) receiver interrupt */ +#define CSR0_TINT 0x0200 /* (RC) transmitter interrupt */ +#define CSR0_IDON 0x0100 /* (RC) initialization done */ +#define CSR0_INTR 0x0080 /* (RO) interrupt flag */ +#define CSR0_INEA 0x0040 /* (RW) interrupt enable */ +#define CSR0_RXON 0x0020 /* (RO) receiver on */ +#define CSR0_TXON 0x0010 /* (RO) transmitter on */ +#define CSR0_TDMD 0x0008 /* (WOO)transmit demand */ +#define CSR0_STOP 0x0004 /* (WOO)stop (& reset) chip */ +#define CSR0_STRT 0x0002 /* (RW) start chip */ +#define CSR0_INIT 0x0001 /* (RW) initialize (acces init block) */ + +#define CSR0_INTMASK (CSR0_BABL | CSR0_CERR | CSR0_MISS | \ + CSR0_MERR | CSR0_RINT | CSR0_TINT | \ + CSR0_IDON | CSR0_INEA) + +#define CSR3_DXSUFLO 0x0040 /* disable transmit stop on UFLO */ +#define CSR3_BSWP 0x0004 /* Byte Swap */ + +/* CSR 4 test and features control */ + +#define CSR4_EN124 0x8000 /* enable CSR124 access */ +#define CSR4_DMAPLUS 0x4000 /* disable DMA burst xfer counter */ +#define CSR4_TIMER 0x2000 /* enable bus activity timer */ +#define CSR4_DPOLL 0x1000 /* disable transmit polling */ +#define CSR4_APAD_XMIT 0x0800 /* enable auto pad transmit */ +#define CSR4_ASTRP_RCV 0x0400 /* enable auto pad stripping */ +#define CSR4_MFCO 0x0200 /* missed frame counter overflow */ +#define CSR4_MFCOM 0x0100 /* missed frame counter mask */ +#define CSR4_UINTCMD 0x0080 /* user interrupt command */ +#define CSR4_UINT 0x0040 /* user interrupt issued */ +#define CSR4_RCVCC0 0x0020 /* receive collision cntr overflow */ +#define CSR4_RCVCCOM 0x0010 /* receive collision cntr mask */ +#define CSR4_TXSTRT 0x0008 /* transmit start status */ +#define CSR4_TXSTRTM 0x0004 /* transmit start mask */ +#define CSR4_JAB 0x0002 /* jabber error indicated */ +#define CSR4_JABM 0x0001 /* jabber error mask */ + +#define CSR4_TFC_MASK (CSR4_MFCOM | CSR4_RCVCCOM | \ + CSR4_TXSTRTM | CSR4_JABM) + +/* CSR 5 extended control and interrupt */ + +#define CSR5_RESRVD_B 0xffff0000 /* resvd: written 0, read undefined */ +#define CSR5_TOKINTD 0x00008000 /* transmit OK interrupt disable */ +#define CSR5_LTINTEN 0x00004000 /* last transmit interrupt enable */ +#define CSR5_RESRVD_A 0x00003000 /* resvd: written 0, read undefined */ +#define CSR5_SINT 0x00000800 /* system interrupt asserted */ +#define CSR5_SINTE 0x00000400 /* system interrupt enable */ +#define CSR5_SLPINT 0x00000200 /* sleep interrupt asserted */ +#define CSR5_SLPINTE 0x00000100 /* sleep interrupt enable */ +#define CSR5_EXDINT 0x00000080 /* excessive deferral asserted */ +#define CSR5_EXDINTE 0x00000040 /* excessive deferral int. enable */ +#define CSR5_MPPLBA 0x00000020 /* magic packet broadcast accept */ +#define CSR5_MPINT 0x00000010 /* magic packet int. asserted */ +#define CSR5_MPINTE 0x00000008 /* magic packet int. enable */ +#define CSR5_MPEN 0x00000004 /* magic packet mode enable */ +#define CSR5_MPMODE 0x00000002 /* set magic packet mode */ +#define CSR5_SPND 0x00000001 /* set suspend mode */ + +#define CSR5_RESRVD_MASK (~(CSR5_RESRVD_B | CSR5_RESRVD_A)) + +/* CSR 8 logical address filter 0 */ + +#define CSR8_RESRVD 0xffff0000 /* reserved locations, write as 0 */ +#define CSR8_LADRF0 0x0000ffff /* logical address filter [15:0] */ + +/* CSR 9 logical address filter 1 */ + +#define CSR9_RESRVD 0xffff0000 /* reserved locations, write as 0 */ +#define CSR9_LADRF1 0x0000ffff /* logical address filter [31:16] */ + +/* CSR 10 logical address filter 2 */ + +#define CSR10_RESRVD 0xffff0000 /* reserved locations, write as 0 */ +#define CSR10_LADRF2 0x0000ffff /* logical address filter [47:32] */ + +/* CSR 11 logical address filter 3 */ + +#define CSR11_RESRVD 0xffff0000 /* reserved locations, write as 0 */ +#define CSR11_LADRF3 0x0000ffff /* logical address filter [63:48] */ + +/* CSR 15 mode register - loaded from initialization block */ + +#define CSR15_PROM 0x00008000 /* set promiscuous mode */ +#define CSR15_DTX 0x00000002 /* disable transmitter section */ +#define CSR15_DRX 0x00000001 /* disable receiver section */ + +/* CSR 80 RX and TX FIFO threshold register */ + +#define CSR80_TXTHR0 0x0400 /* TX threshold low bit */ +#define CSR80_TXTHR1 0x0800 /* TX threshold hi bit */ +#define CSR80_DEFAULT 0x1410 /* chip default value */ + +/* CSR 88 and CSR 89 chip ID registers */ + +#define CSR88_LN970_PARTID 0x00001003 /* Am79c970 part ID lower value */ +#define CSR88_LN971_PARTID 0x00003003 /* Am79c971 part ID lower value */ +#define CSR88_LN972_PARTID 0x00004003 /* Am79c972 part ID lower value */ +#define CSR88_LN973_PARTID 0x00005003 /* Am79c973 part ID lower value */ +#define CSR88_LN975_PARTID 0x00007003 /* Am79c975 part ID lower value */ + +#define CSR89_LN97X_PARTID 0x00000262 /* Am79c97x part ID upper value */ + +/* chip ID values are formed as follows: + * + * chipId = (CSR(88) | (CSR(89) << 16)) + * chipId = (chipId >> 12) & 0xffff + */ + +#define CHIP_ID_AM79C970A (0x2621) /* PCnet-PCI II Am79C970A */ +#define CHIP_ID_AM79C971 (0x2623) /* PCnet-FAST Am79C971 */ +#define CHIP_ID_AM79C972 (0x2624) /* PCnet-FAST + Am79C972 */ +#define CHIP_ID_AM79C973 (0x2625) /* PCnet-FAST III Am79C973 */ +#define CHIP_ID_AM79C975 (0x2627) /* PCnet Fast III Am79C975 */ + +/* BCR 2 */ + +#define BCR2_LEDPE 0x1000 /* LED program enable */ +#define BCR2_AUTO_SELECT 0x0002 /* auto select port type 10BT/AUI */ +#define BCR2_ACTIVE_HIGH 0x80 /* select active high interrupt pin */ +#define BCR2_ACTIVE_LOW 0x00 /* select active low interrupt pin */ + +/* BCR 18 burst size and bus control register */ + +#define BCR18_ROMTMG 0x9000 /* expansion ROM timing (default) */ +#define BCR18_NOUFLO 0x0800 /* TX store and forward mode */ +#define BCR18_MEMCMD 0x0200 /* enable PCI memory read multiple */ +#define BCR18_BREADE 0x0040 /* burst read enable (SWSTYLE=3) */ +#define BCR18_BWRITE 0x0020 /* burst write enable (SWSTYLE=3) */ +#define BCR18_RESRVD 0x0001 /* reserved location (default) */ + +#define BCR18_BSBC_MASK (BCR18_ROMTMG | BCR18_RESRVD | \ + BCR18_BREADE | BCR18_BWRITE) + +/* BCR 20 software style register */ + +#define BCR20_SSIZE32 0x0100 +#define BCR20_SWSTYLE_LANCE 0x0000 +#define BCR20_SWSTYLE_ILACC 0x0001 +#define BCR20_SWSTYLE_PCNET 0x0002 +#define BCR20_SWSTYLE_PCNET_II 0x0003 + +/* Control block definitions for AMD PCnet (Ethernet) chip. */ + +typedef struct + { + ULONG rdp; /* register data Port */ + ULONG rap; /* Register Address Port */ + ULONG rst; /* Reset Register */ + ULONG bdp; /* Bus Configuration Register Data Port */ + } LN_DEVICE; + +/* Initialization Block */ + +typedef struct lnIB + { + ULONG lnIBMode; /* mode register */ + UCHAR lnIBPadr [8]; /* PADR: bswapd ethnt phys address */ + UCHAR lnIBLadrf [8]; /* logical address filter */ + ULONG lnIBRdra; /* RDRA: read ring address, long word */ + ULONG lnIBTdra; /* TDRA: transmit ring address long word */ + } LN_IB; + +/* Receive Message Descriptor Entry.*/ + +typedef struct lnRMD + { + /* element order changed to accomodate burst mode operation */ + ULONG lnRMD2; /* message byte count */ + ULONG lnRMD1; /* status & buffer byte count (negative) */ + ULONG lnRMD0; /* bits 31:00 of receive buffer address */ + ULONG lnRMD3; /* reserved */ + } LN_RMD; + +/* Transmit Message Descriptor Entry. */ + +typedef struct lnTMD + { + /* element order changed to accomodate burst mode operation */ + ULONG lnTMD2; /* errors */ + ULONG lnTMD1; /* message byte count */ + ULONG lnTMD0; /* bits 31:00 of transmit buffer address */ + ULONG lnTMD3; /* reserved */ + } LN_TMD; + +typedef union addrFilter /* logical address filter layout */ + { + UINT8 lafBytes [8]; /* (8) bytes */ + UINT16 lafWords [4]; /* (4) 16-bit words */ + UINT32 lafDwords [2]; /* (2) 32-bit dwords */ + } ADDR_FILTER; + +typedef enum filterModCmd /* addrFilterMod() commands */ + { + LN_LADRF_ADD, /* add a logical address */ + LN_LADRF_DEL, /* delete a logical address */ + LN_LADRF_ADD_ALL, /* add all logical addresses */ + LN_LADRF_DEL_ALL /* delete all logical addresses */ + } FILTER_MOD_CMD; + + +/* initialization block */ + +#define IB_MODE_TLEN_MSK 0xf0000000 +#define IB_MODE_RLEN_MSK 0x00f00000 + +/* receive descriptor */ + +#define RMD1_OWN 0x80000000 /* Own */ +#define RMD1_ERR 0x40000000 /* Error */ +#define RMD1_FRAM 0x20000000 /* Framming Error */ +#define RMD1_OFLO 0x10000000 /* Overflow */ +#define RMD1_CRC 0x08000000 /* CRC */ +#define RMD1_BUFF 0x04000000 /* Buffer Error */ +#define RMD1_STP 0x02000000 /* Start of Packet */ +#define RMD1_ENP 0x01000000 /* End of Packet */ +#define RMD1_RES 0x00ff0000 /* reserved */ +#define RMD1_CNST 0x0000f000 /* rmd1 constant value */ + +#define RMD1_BCNT_MSK 0x00000fff /* buffer cnt mask */ +#define RMD2_MCNT_MSK 0x00000fff /* message buffer cnt mask */ + +/* transmit descriptor */ + +#define TMD1_OWN 0x80000000 /* Own */ +#define TMD1_ERR 0x40000000 /* Error */ +#define TMD1_MORE 0x10000000 /* More than One Retry */ +#define TMD1_ONE 0x08000000 /* One Retry */ +#define TMD1_DEF 0x04000000 /* Deferred */ +#define TMD1_STP 0x02000000 /* Start of Packet */ +#define TMD1_ENP 0x01000000 /* End of Packet */ +#define TMD1_BPE 0x00800000 /* Bus Parity Error */ +#define TMD1_RES 0x007F0000 /* Reserved locations */ +#define TMD1_CNST 0x0000f000 /* tmd1 constant value */ + +#define TMD2_BUFF 0x80000000 /* Buffer Error */ +#define TMD2_UFLO 0x40000000 /* Underflow Error */ +#define TMD2_LCOL 0x10000000 /* Late Collision */ +#define TMD2_LCAR 0x08000000 /* Lost Carrier */ +#define TMD2_RTRY 0x04000000 /* Retry Error */ +#define TMD2_TDR 0x03FF0000 /* Time Domain Reflectometry */ + +#define TMD1_BCNT_MSK 0x00000fff /* buffer cnt mask */ + +/* CRC for logical address filter */ + +#define LN_CRC_POLYNOMIAL (0xedb88320) /* Ethernet CRC polynomial */ +#define LN_CRC_TO_LAF_IX(crc) ((crc) >> 26) /* get 6 MSBits */ +#define LN_LAF_LEN (8) /* logical addr filter length */ +#define LN_LA_LEN (6) /* logical address length */ +#define BITS_PER_LA (8 * LN_LA_LEN) /* logical addr length bits */ + +/* Definitions for the drvCtrl specific flags field */ + +#define LS_PROMISCUOUS_FLAG 0x1 /* set the promiscuous mode */ +#define LS_MEM_ALLOC_FLAG 0x2 /* allocating memory flag */ +#define LS_PAD_USED_FLAG 0x4 /* padding used flag */ +#define LS_RCV_HANDLING_FLAG 0x8 /* handling recv packet */ +#define LS_START_OUTPUT_FLAG 0x10 /* trigger output flag */ +#define LS_POLLING 0x20 /* polling flag */ +#define LS_MODE_MEM_IO_MAP 0x100 /* device registers memory mapped */ +#define LS_MODE_DWIO 0x200 /* device in 32 bit mode */ +#define LS_MODE_NOSWAP_MASTER 0x400 /* don't swap PCI master I/O ops */ +#define LS_TX_UFLO 0x800 /* TX underflow occured */ + +/* descriptor size */ + +#define RMD_SIZ sizeof(LN_RMD) +#define TMD_SIZ sizeof(LN_TMD) +#define IB_SIZ sizeof(LN_IB) + +/* How much work we're allowed to do in the RX handler (# of pkts processed) */ + +#define LN_RX_LIMIT 16 + +/* How many descriptors we want to use up in a single gather-write transmit */ + +#define LN_MAX_FRAGS 16 + +/* The definition of the driver control structure */ + +typedef struct ln97xDevice + { + END_OBJ endObj; /* The class we inherit from */ + + int unit; /* unit number of the device */ + volatile LN_IB * ib; /* ptr to Initialization Block */ + + int rmdIndex; /* current RMD send index */ + int rringSize; /* RMD ring size */ + int rringLen; /* RMD ring length (bytes) */ + volatile LN_RMD * pRring; /* RMD ring start */ + + int tmdIndex; /* current TMD transmit index */ + int tmdIndexC; /* current TMD cleaning index */ + int tringSize; /* TMD ring size */ + int tringLen; /* TMD ring length (bytes) */ + volatile LN_TMD * pTring; /* TMD ring start */ + + int inum; /* interrupt number */ + int ilevel; /* interrupt level */ + + volatile UINT32 * pRdp; /* device register CSR */ + volatile UINT32 * pRap; /* device register RAP */ + volatile UINT32 * pReset; /* device register Reset */ + volatile UINT32 * pBdp; /* device register BCR */ + + volatile char * pShMem; /* real ptr to shared memory */ + volatile char * pShMemEnd; /* real ptr to shared memory end */ + volatile char * memBase; /* PCnet memory pool base */ + volatile char * memAdrs; /* PCnet memory pool base */ + + UINT32 shMemPtoVOffset; /* bias to convert pShMem P->V */ + + UINT32 devAdrs; /* device structure address */ + UINT16 csr3B; /* csr3 value board specific */ + UINT32 chipId; /* (csr88|csr89) chip ID value */ + int memSize; /* PCnet memory pool size */ + int memWidth; /* width of data port */ + int offset; /* offset of data in the buffer */ + volatile UINT32 flags; /* Our local flags */ + UINT32 pciMemBase; /* memory base as seen from PCI*/ + UINT8 enetAddr[6]; /* ethernet address */ + CACHE_FUNCS cacheFuncs; /* cache function pointers */ + + volatile BOOL txBlocked; /* transmit flow control */ + volatile BOOL txCleaning; /* transmit descriptor cleaning */ + + CL_POOL_ID pClPoolId; /* cluster pool Id */ + M_CL_CONFIG mClCfg; /* mBlk & cluster config structure */ + CL_DESC clDesc; /* cluster descriptor table */ + + END_ERR lastError; /* Last error passed to muxError */ + volatile BOOL errorHandling; /* task level error handling */ + + M_BLK_ID * mBlks; /* saved mBlk pointers */ + + } LN_97X_DRV_CTRL; + +/* Configuration items */ + +#define LN_MIN_FBUF (100) /* Min sizeof first buffer in chain */ +#define LN_BUFSIZ (ETHERMTU + SIZEOF_ETHERHEADER + 6) +#define LN_SPEED (10000000) +#define LN_RMD_RLEN (7) /* ring size as a ^ 2 => 128 RMD's */ +#define LN_TMD_TLEN (7) /* ring size as a ^ 2 => 128 TMD's */ +#define LN_RMD_MIN (2) /* min descriptors 4 */ +#define LN_TMD_MIN (2) /* min descriptors 4 */ +#define LN_RMD_MAX (9) /* max descriptors 512 */ +#define LN_TMD_MAX (9) /* max descriptors 512 */ +#define LN_97X_DEV_NAME "lnPci" /* name of the device */ +#define LN_97X_DEV_NAME_LEN (6) /* length of the name string */ +#define LN_97X_APROM_SIZE (32) /* hardware Address PROM size bytes */ +#define LN_LITTLE_ENDIAN (0) /* little endian PCI bus */ +#define LN_BIG_ENDIAN (1) /* big endian PCI bus */ +#define LN_ACTIVE_LOW (0) /* active-low interrupt line */ +#define LN_ACTIVE_HI (1) /* active-high interrupt line */ + +#define LN_RMD_OWNED(rmd) (PCI_SWAP ((rmd)->lnRMD1) & RMD1_OWN) +#define LN_TMD_OWNED(tmd) (PCI_SWAP ((tmd)->lnTMD1) & TMD1_OWN) + +#define LN_PKT_LEN_GET(rmd) (PCI_SWAP ((rmd)->lnRMD2) - 4) + + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT STATUS ln97xInitParse (LN_97X_DRV_CTRL * pDrvCtrl, char * initString); +IMPORT END_OBJ * ln97xEndLoad (char * initString); + +#else + +IMPORT STATUS ln97xInitParse (); +IMPORT END_OBJ * ln97xEndLoad (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCln97xEndh */ + diff --git a/h/drv/end/m5200FecEnd.h b/h/drv/end/m5200FecEnd.h new file mode 100644 index 0000000..7497586 --- /dev/null +++ b/h/drv/end/m5200FecEnd.h @@ -0,0 +1,771 @@ +/* m5200FecEnd.h - Motorola MPC5200 Ethernet network interface header */ + +/* Copyright 1990-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,17feb05,j_b add undocumented XFIFO Control Register bit to set with Rev.B +01f,10jan05,k_p replaced sysEnetAddrGet() with sysFecEnetAddrGet() as a part + of 'M' command modification and cleanups. +01e,17jun04,bjn RFIFO_ERROR - changes to fecStop/fecStart. +01d,25may04,bjn resolve various issues, see change log details (SPR97198) +01c,15mar04,bjn Support for Bestcomm 2.0 +01b,18Jul03,pkr adopted from motFecEnd +01a,09nov98,cn written. +*/ + +/* +change log details +------------------ +01e * Added stoppingTx for handling of RFIFO_ERROR/XFIFO_ERROR +01d * Increase FEC_END_BD_LOAN_NUM from 32 to 64. This creates more + network cluster buffers for the system to use and is necessary + to allow ping buffer sizes of 65500 bytes to be returned. + This results in m5200FecInitMem() allocating much more memory, + so this parameter is best trimmed to suit the application. + * Added BUF_TYPE_LOCAL, txBuffAvailable and pTxBuffLocal, requied + to ensure that TX packets get sent to the wire when NET_BUF_ALLOC() + returns NULL. +*/ + +#ifndef __INCm5200FecEndh +#define __INCm5200FecEndh + +/* includes */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +/* revision D.3 and greater processors require special FEC initialization */ + +#define REV_D_4 0x0502 +#define REV_D_3 0x0501 + +/* + * redefine the macro below in the bsp if you need to access the device + * registers/descriptors in a more suitable way. + */ + +#ifndef FEC_END_LONG_WR +#define FEC_END_LONG_WR(addr, value) \ + (* (addr) = ((UINT32) (value))) +#endif /* FEC_END_LONG_WR */ + +#ifndef FEC_END_WORD_WR +#define FEC_END_WORD_WR(addr, value) \ + (* (addr) = ((UINT16) (value))) +#endif /* FEC_END_WORD_WR */ + +#ifndef FEC_END_BYTE_WR +#define FEC_END_BYTE_WR(addr, value) \ + (* (addr) = ((UINT8) (value))) +#endif /* FEC_END_BYTE_WR */ + +#ifndef FEC_END_LONG_RD +#define FEC_END_LONG_RD(addr, value) \ + ((value) = (* (UINT32 *) (addr))) +#endif /* FEC_END_LONG_RD */ + +#ifndef FEC_END_WORD_RD +#define FEC_END_WORD_RD(addr, value) \ + ((value) = (* (UINT16 *) (addr))) +#endif /* FEC_END_WORD_RD */ + +#ifndef FEC_END_BYTE_RD +#define FEC_END_BYTE_RD(addr, value) \ + ((value) = (* (UINT8 *) (addr))) +#endif /* FEC_END_BYTE_RD */ + +/* + * Default macro definitions for BSP interface. + * These macros can be redefined in a wrapper file, to generate + * a new module with an optimized interface. + */ + +#ifndef SYS_FEC_INT_CONNECT +#define SYS_FEC_INT_CONNECT(pDrvCtrl, pFuncFEC, pFuncRDMA, pFuncWDMA, arg, ret) \ + { \ + IMPORT STATUS intConnect (VOIDFUNCPTR *, VOIDFUNCPTR, int); \ + ret = OK; \ + if (!pDrvCtrl->intrConnect) \ + { \ + if (FEC_END_FEC_VECTOR (pDrvCtrl)) \ + { \ + ret = (intConnect) ((VOIDFUNCPTR*) \ + INUM_TO_IVEC (FEC_END_FEC_VECTOR (pDrvCtrl)), \ + (pFuncFEC), (int) (arg)); \ + } \ + \ + if (FEC_END_RDMA_VECTOR (pDrvCtrl)) \ + { \ + ret = (intConnect) ((VOIDFUNCPTR*) \ + INUM_TO_IVEC (FEC_END_RDMA_VECTOR (pDrvCtrl)),\ + (pFuncRDMA), (int) (arg)); \ + } \ + \ + if (FEC_END_WDMA_VECTOR (pDrvCtrl)) \ + { \ + ret = (intConnect) ((VOIDFUNCPTR*) \ + INUM_TO_IVEC (FEC_END_WDMA_VECTOR (pDrvCtrl)), \ + (pFuncWDMA), (int) (arg)); \ + } \ + pDrvCtrl->intrConnect = TRUE; \ + } \ + } +#endif /* SYS_FEC_INT_CONNECT */ + + + +#ifndef SYS_FEC_INT_DISCONNECT + +#define SYS_FEC_INT_DISCONNECT(pDrvCtrl, pFuncFEC, pFuncRDMA, pFuncWDMA, arg, ret) \ + { \ + ret = OK; \ + if ( m5200FecIntDisc != NULL) \ + { \ + if (FEC_END_FEC_VECTOR (pDrvCtrl)) \ + { \ + ret = (*m5200FecIntDisc) ((VOIDFUNCPTR*) \ + INUM_TO_IVEC (FEC_END_FEC_VECTOR (pDrvCtrl)), \ + (pFuncFEC)); \ + } \ + \ + if (FEC_END_RDMA_VECTOR (pDrvCtrl)) \ + { \ + ret = (*m5200FecIntDisc) ((VOIDFUNCPTR*) \ + INUM_TO_IVEC (FEC_END_RDMA_VECTOR (pDrvCtrl)), \ + (pFuncRDMA)); \ + } \ + \ + if (FEC_END_WDMA_VECTOR (pDrvCtrl)) \ + { \ + ret = (*m5200FecIntDisc) ((VOIDFUNCPTR*) \ + INUM_TO_IVEC (FEC_END_WDMA_VECTOR (pDrvCtrl)), \ + (pFuncWDMA)); \ + } \ + pDrvCtrl->intrConnect = FALSE; \ + } \ + } +#endif /* SYS_FEC_INT_DISCONNECT */ + + +#ifndef SYS_FEC_INT_ENABLE +#define SYS_FEC_INT_ENABLE(pDrvCtrl, ret) \ + { \ + IMPORT int intEnable (int); \ + ret = OK; \ + if (FEC_END_FEC_VECTOR (pDrvCtrl)) \ + ret = intEnable ((int) (FEC_END_FEC_VECTOR (pDrvCtrl))); \ + if (FEC_END_RDMA_VECTOR (pDrvCtrl)) \ + ret = intEnable ((int) (FEC_END_RDMA_VECTOR (pDrvCtrl))); \ + if (FEC_END_WDMA_VECTOR (pDrvCtrl)) \ + ret = intEnable ((int) (FEC_END_WDMA_VECTOR (pDrvCtrl))); \ + } +#endif /* SYS_FEC_INT_ENABLE */ + + +#ifndef SYS_FEC_INT_DISABLE + +#define SYS_FEC_INT_DISABLE(pDrvCtrl, ret) \ + { \ + IMPORT int intDisable (int); \ + ret = OK; \ + if (FEC_END_FEC_VECTOR (pDrvCtrl)) \ + ret = intDisable ((int) (FEC_END_FEC_VECTOR (pDrvCtrl))); \ + if (FEC_END_RDMA_VECTOR (pDrvCtrl)) \ + ret = intDisable ((int) (FEC_END_RDMA_VECTOR (pDrvCtrl))); \ + if (FEC_END_WDMA_VECTOR (pDrvCtrl)) \ + ret = intDisable ((int) (FEC_END_WDMA_VECTOR (pDrvCtrl))); \ + } + +#endif /* SYS_FEC_INT_DISABLE */ + +#define SYS_FEC_ENET_ADDR_GET(address) \ +if (sysFecEnetAddrGet != NULL) \ + if (sysFecEnetAddrGet (pDrvCtrl->unit, (address)) == ERROR) \ + { \ + errnoSet (S_iosLib_INVALID_ETHERNET_ADDRESS); \ + return (NULL); \ + } + +#define SYS_FEC_ENET_ENABLE \ +if (sysFecEnetEnable != NULL) \ + if (sysFecEnetEnable (pDrvCtrl->fecBaseAddr) == ERROR) \ + return (ERROR); + +#define SYS_FEC_ENET_DISABLE \ +if (sysFecEnetDisable != NULL) \ + if (sysFecEnetDisable (pDrvCtrl->fecBaseAddr) == ERROR) \ + return (ERROR); + +#define FEC_END_DEV_NAME "fec" +#define FEC_END_DEV_NAME_LEN 4 +#define FEC_END_TBD_DEF_NUM 64 /* default number of TBDs */ +#define FEC_END_RBD_DEF_NUM 48 /* default number of RBDs */ +#define FEC_END_TX_CL_NUM 6 /* number of tx clusters */ +#define FEC_END_BD_LOAN_NUM 64 /* loaned BDs */ +#define FEC_END_TBD_MAX 128 /* max number of TBDs */ +#define FEC_END_RBD_MAX 128 /* max number of TBDs */ +#define FEC_END_WAIT_MAX 0xf0000000 /* max delay after sending */ + +#define FEC_END_ADDR_LEN 6 /* ethernet address length */ + +/* Control/Status Registers (CSR) definitions */ + +#define FEC_END_EVENT_OFF 0x0004 /* interrupt event register */ +#define FEC_END_MASK_OFF 0x0008 /* interrupt mask register */ +#define FEC_END_iaddr1_OFF 0x018 +#define FEC_END_iaddr2_OFF 0x01C +#define FEC_END_CTRL_OFF 0x0024 /* FEC control register */ +#define FEC_END_MII_DATA_OFF 0x0040 /* MII data register */ +#define FEC_END_MII_SPEED_OFF 0x0044 /* MII speed register */ +#define FEC_END_RX_CTRL_OFF 0x0084 /* rx control register */ +#define FEC_END_TX_CTRL_OFF 0x00c4 /* tx control register */ +#define FEC_END_ADDR_L_OFF 0x00e4 /* lower 32-bits of MAC address */ +#define FEC_END_ADDR_H_OFF 0x00e8 /* upper 16-bits of MAC address */ +#define FEC_END_OP_PAUSE_OFF 0x00EC +#define FEC_END_HASH_H_OFF 0x0118 /* upper 32-bits of hash table */ +#define FEC_END_HASH_L_OFF 0x011c /* lower 32-bits of hash table */ + +#define FEC_END_fifo_id_OFF 0x140 +#define FEC_END_x_wmrk_OFF 0x144 +#define FEC_END_fcntrl_OFF 0x148 +#define FEC_END_r_bound_OFF 0x14C +#define FEC_END_r_fstart_OFF 0x150 +#define FEC_END_r_count_OFF 0x154 +#define FEC_END_r_lag_OFF 0x158 +#define FEC_END_r_read_OFF 0x15C +#define FEC_END_r_write_OFF 0x160 +#define FEC_END_x_count_OFF 0x164 +#define FEC_END_x_lag_OFF 0x168 +#define FEC_END_x_retry_OFF 0x16C +#define FEC_END_x_write_OFF 0x170 +#define FEC_END_x_read_OFF 0x174 +#define FEC_END_fm_cntrl_OFF 0x180 +#define FEC_END_rfifo_data_OFF 0x184 +#define FEC_END_rfifo_status_OFF 0x188 +#define FEC_END_rfifo_cntrl_OFF 0x18C +#define FEC_END_rfifo_lrf_ptr_OFF 0x190 +#define FEC_END_rfifo_lwf_ptr_OFF 0x194 +#define FEC_END_rfifo_alarm_OFF 0x198 +#define FEC_END_rfifo_rdptr_OFF 0x19C +#define FEC_END_rfifo_wrptr_OFF 0x1A0 +#define FEC_END_tfifo_data_OFF 0x1A4 +#define FEC_END_tfifo_status_OFF 0x1A8 +#define FEC_END_tfifo_cntrl_OFF 0x1AC +#define FEC_END_tfifo_lrf_ptr_OFF 0x1B0 +#define FEC_END_tfifo_lwf_ptr_OFF 0x1B4 +#define FEC_END_tfifo_alarm_OFF 0x1B8 +#define FEC_END_tfifo_rdptr_OFF 0x1BC +#define FEC_END_tfifo_wrptr_OFF 0x1C0 +#define FEC_END_reset_cntrl_OFF 0x1C4 +#define FEC_END_xmit_fsm_OFF 0x1C8 + +#define FEC_FIFO_STAT_ERROR 0x400000 +#define FEC_FIFO_STAT_UF 0x200000 +#define FEC_FIFO_STAT_OF 0x100000 +#define FEC_FIFO_STAT_ALARM 0x020000 + +/* Control/Status Registers (CSR) bit definitions */ + +#define FEC_END_RX_START_MSK 0xfffffffc /* quad-word alignment */ + /* required for rx BDs */ + +#define FEC_END_TX_START_MSK 0xfffffffc /* quad-word alignment */ + /* required for tx BDs */ +/* Ethernet CSR bit definitions */ + +#define FEC_END_ETH_EN 0x00000002 /* enable Ethernet operation */ +#define FEC_END_ETH_DIS 0x00000000 /* disable Ethernet operation*/ +#define FEC_END_ETH_RES 0x00000001 /* reset the FEC */ +#define FEC_END_CTRL_MASK 0x00000003 /* FEC control register mask */ + +/* + * interrupt bits definitions: these are common to both the + * mask and the event register. + */ + +#define FEC_END_EVENT_HB 0x80000000 /* heartbeat error */ +#define FEC_END_EVENT_BABR 0x40000000 /* babbling rx error */ +#define FEC_END_EVENT_BABT 0x20000000 /* babbling tx error */ +#define FEC_END_EVENT_GRA 0x10000000 /* graceful stop complete */ +#define FEC_END_EVENT_TXF 0x08000000 /* tx frame */ +#define FEC_END_EVENT_MII 0x00800000 /* MII transfer */ +#define FEC_END_EVENT_BERR 0x00400000 /* U-bus access error */ +#define FEC_END_EVENT_LCOL 0x00200000 /* Late collision */ +#define FEC_END_EVENT_COL_RL 0x00100000 /* Collision retry limit */ +#define FEC_END_EVENT_XFIFO_UN 0x00080000 /* Transmit fifo underrun */ +#define FEC_END_EVENT_FIFO_ERR 0x00040000 /* Transmit fifo error */ +#define FEC_END_EVENT_RFIFO_ERR 0x00020000 /* Receive fifo error */ +#define FEC_END_EVENT_MSK 0xfffe0000 /* clear all interrupts */ +#define FEC_END_MASK_ALL FEC_END_EVENT_MSK /* mask all interrupts */ + + +/* bit masks for the interrupt level/vector CSR */ + +#define FEC_END_LVL_MSK 0xe0000000 /* intr level */ +#define FEC_END_TYPE_MSK 0x0000000c /* highest pending intr */ +#define FEC_END_VEC_MSK 0xe000000c /* this register mask */ +#define FEC_END_RES_MSK 0x1ffffff3 /* reserved bits */ +#define FEC_END_LVL_SHIFT 0x1d /* intr level bits location */ + +/* transmit and receive active registers definitions */ + +#define FEC_END_TX_ACT 0x01000000 /* tx active bit */ +#define FEC_END_RX_ACT 0x01000000 /* rx active bit */ + +/* MII management frame CSRs */ + +#define FEC_END_MII_ST 0x40000000 /* start of frame delimiter */ +#define FEC_END_MII_OP_RD 0x20000000 /* perform a read operation */ +#define FEC_END_MII_OP_WR 0x10000000 /* perform a write operation */ +#define FEC_END_MII_ADDR_MSK 0x0f800000 /* PHY address field mask */ +#define FEC_END_MII_REG_MSK 0x007c0000 /* PHY register field mask */ +#define FEC_END_MII_TA 0x00020000 /* turnaround */ +#define FEC_END_MII_DATA_MSK 0x0000ffff /* PHY data field */ +#define FEC_END_MII_RA_SHIFT 0x12 /* mii reg address bits */ +#define FEC_END_MII_PA_SHIFT 0x17 /* mii PHY address bits */ + +#define FEC_END_MII_PRE_DIS 0x00000080 /* desable preamble */ +#define FEC_END_MII_SPEED_25 0x00000005 /* recommended for 25Mhz CPU */ +#define FEC_END_MII_SPEED_33 0x00000007 /* recommended for 33Mhz CPU */ +#define FEC_END_MII_SPEED_40 0x00000008 /* recommended for 40Mhz CPU */ +#define FEC_END_MII_SPEED_50 0x0000000a /* recommended for 50Mhz CPU */ +#define FEC_END_MII_SPEED_SHIFT 1 /* MII_SPEED bits location */ +#define FEC_END_MII_CLOCK_MAX 2500000 /* max freq of MII clock (Hz)*/ +#define FEC_END_MII_MAN_DIS 0x00000000 /* disable the MII management*/ + /* interface */ +#define FEC_END_MII_SPEED_MSK 0xffffff81 /* speed field mask */ + +/* FIFO transmit and receive CSRs definitions */ + +#define FEC_END_FIFO_MSK 0x000003ff /* FIFO rx/tx/bound mask */ + +/* SDMA function code CSR */ + +#define FEC_END_SDMA_DATA_BE 0x60000000 /* big-endian byte-ordering */ + /* for SDMA data transfer */ + +#define FEC_END_SDMA_DATA_PPC 0x20000000 /* PPC byte-ordering */ + /* for SDMA data transfer */ + +#define FEC_END_SDMA_DATA_RES 0x00000000 /* reserved value */ + +#define FEC_END_SDMA_BD_BE 0x18000000 /* big-endian byte-ordering */ + /* for SDMA BDs transfer */ + +#define FEC_END_SDMA_BD_PPC 0x08000000 /* PPC byte-ordering */ + /* for SDMA BDs transfer */ + + +#define FEC_END_SDMA_BD_RES 0x00000000 /* reserved value */ +#define FEC_END_SDMA_FUNC_0 0x00000000 /* no function code */ + +/* receive control/hash registers bit definitions */ + +#define FEC_END_RX_CTRL_PROM 0x00000008 /* promiscous mode */ +#define FEC_END_RX_CTRL_MII 0x00000004 /* select MII interface */ +#define FEC_END_RX_CTRL_DRT 0x00000002 /* disable rx on transmit */ +#define FEC_END_RX_CTRL_LOOP 0x00000001 /* loopback mode */ +#define FEC_END_RX_FR_MSK 0x000007ff /* rx frame length mask */ + + +/* transmit control register bit definitions */ + +#define FEC_END_TX_CTRL_FD 0x00000004 /* enable full duplex mode */ +#define FEC_END_TX_CTRL_HBC 0x00000002 /* HB check is performed */ +#define FEC_END_TX_CTRL_GRA 0x00000001 /* issue a graceful tx stop */ + +/* rx/tx buffer descriptors definitions */ + +#define FEC_END_RBD_SZ 8 /* RBD size in byte */ +#define FEC_END_TBD_SZ 8 /* TBD size in byte */ +#define FEC_END_TBD_MIN 6 /* min number of TBDs */ +#define FEC_END_RBD_MIN 4 /* min number of RBDs */ +#define FEC_END_TBD_POLL_NUM 1 /* one TBD for poll operation */ +#define CL_OVERHEAD 4 /* prepended cluster overhead */ +#define CL_ALIGNMENT 4 /* cluster required alignment */ +#define MBLK_ALIGNMENT 4 /* mBlks required alignment */ +#define FEC_END_BD_ALIGN 0x20 /* required alignment for RBDs */ +#define FEC_END_MAX_PCK_SZ (ETHERMTU + SIZEOF_ETHERHEADER \ + + ETHER_CRC_LEN) + +#define FEC_END_BD_STAT_OFF 0 /* offset of the status word */ +#define FEC_END_BD_LEN_OFF 2 /* offset of the data length word */ +#define FEC_END_BD_ADDR_OFF 4 /* offset of the data pointer word */ + +#define BESTCOMM_API 11 + +#ifndef BESTCOMM_API +/* TBD bits definitions */ + +#define FEC_END_TBD_RDY 0x8000 /* ready for transmission */ +#define FEC_END_TBD_WRAP 0x2000 /* look at CSR5 for next bd */ +#define FEC_END_TBD_INT 0x1000 /* Interrupt */ +#define FEC_END_TBD_LAST 0x0800 /* last bd in this frame */ +#define FEC_END_TBD_CRC 0x0400 /* transmit the CRC sequence */ +#define FEC_END_TBD_DEF 0x0200 /* Append bad CRC */ +#define FEC_END_TBD_HB 0x0100 /* heartbeat error */ +#define FEC_END_TBD_LC 0x0080 /* late collision */ +#define FEC_END_TBD_RL 0x0040 /* retransmission limit */ +#define FEC_END_TBD_UN 0x0002 /* underrun error */ +#define FEC_END_TBD_CSL 0x0001 /* carrier sense lost */ +#define FEC_END_TBD_RC_MASK 0x003c /* retransmission count mask */ + +/* RBD bits definitions */ + +#define FEC_END_RBD_EMPTY 0x8000 /* ready for reception */ +#define FEC_END_RBD_WRAP 0x2000 /* look at CSR4 for next bd */ +#define FEC_END_RBD_INT 0x1000 /* BD int bit in status */ +#define FEC_END_RBD_LAST 0x0800 /* last bd in this frame */ +#define FEC_END_RBD_MISS 0x0100 /* address recognition miss */ +#define FEC_END_RBD_BC 0x0080 /* broadcast frame */ +#define FEC_END_RBD_MC 0x0040 /* multicast frame */ +#define FEC_END_RBD_LG 0x0020 /* frame length violation */ +#define FEC_END_RBD_NO 0x0010 /* nonoctet aligned frame */ +#define FEC_END_RBD_SH 0x0008 /* short frame error */ + /* not supported by the 860T */ +#define FEC_END_RBD_CRC 0x0004 /* CRC error */ +#define FEC_END_RBD_OV 0x0002 /* overrun error */ +#define FEC_END_RBD_TR 0x0001 /* truncated frame (>2KB) */ + +#define FEC_END_RBD_ERR (FEC_END_RBD_LG | \ + FEC_END_RBD_NO | \ + FEC_END_RBD_CRC | \ + FEC_END_RBD_OV | \ + FEC_END_RBD_TR) +#else +#define FEC_END_RBD_EMPTY (SDMA_BD_MASK_READY>>16) /* ready for RX */ +#define FEC_END_TBD_RDY (SDMA_BD_MASK_READY>>16) /* ready for TX */ +#define FEC_END_TBD_LAST (TASK_BD_TFD>>16) /* ready for TX */ +#define FEC_END_TBD_INT (TASK_BD_INT>>16) /* BD int bit in status */ +#define FEC_END_TBD_CRC 0 + +/* if RBD contains RxFIO Status at the end */ +#define FEC_END_RBD_FEMPTY 0x0001 /* FIFO run empty */ +#define FEC_END_RBD_ALARM 0x0002 /* FIFO alarm */ +#define FEC_END_RBD_FULL 0x0004 /* FIFO is full */ +#define FEC_END_RBD_FR 0x0008 /* frame data ready */ +#define FEC_END_RBD_OV 0x0010 /* FIFO overflow */ +#define FEC_END_RBD_UF 0x0020 /* FIFO underflow */ + +#define FEC_END_RBD_ERR (FEC_END_RBD_FEMPTY | \ + FEC_END_RBD_ALARM | \ + FEC_END_RBD_FULL | \ + FEC_END_RBD_OV | \ + FEC_END_RBD_UF) +#endif + +#define FEC_END_CRC_POLY 0x04c11db7 /* CRC polynomium: */ + /* x^32 + x^26 + x^23 + */ + /* x^22 + x^16 + x^12 + */ + /* x^11 + x^10 + x^8 + */ + /* x^7 + x^5 + x^4 + */ + /* x^2 + x^1 + x^0 + */ + +#define FEC_END_HASH_MASK 0x7c000000 /* bits 27-31 */ +#define FEC_END_HASH_SHIFT 0x1a /* to get the index */ + +/* defines related to the PHY device */ + +#define FEC_END_PHY_PRE_INIT 0x0001 /* PHY info initialized */ +#define FEC_END_PHY_AUTO 0x0010 /* enable auto-negotiation */ +#define FEC_END_PHY_TBL 0x0020 /* use negotiation table */ +#define FEC_END_PHY_100 0x0040 /* PHY may use 100Mbit speed */ +#define FEC_END_PHY_10 0x0080 /* PHY may use 10Mbit speed */ +#define FEC_END_PHY_FD 0x0100 /* PHY may use full duplex */ +#define FEC_END_PHY_HD 0x0200 /* PHY may use half duplex */ +#define FEC_END_PHY_MAX_WAIT 0x100 /* max delay before */ +#define FEC_END_PHY_NULL 0xff /* PHY is not present */ +#define FEC_END_PHY_DEF 0x0 /* PHY's logical address */ + +/* allowed PHY's speeds */ + +#define FEC_END_100MBS 100000000 /* bits per sec */ +#define FEC_END_10MBS 10000000 /* bits per sec */ + +/* + * user flags: full duplex mode, loopback mode, serial interface etc. + * the user may configure some of this options according to his needs + * by setting the related bits in the field of the load string. + */ + +#define FEC_END_USR_PHY_NO_AN 0x00000001 /* do not auto-negotiate */ +#define FEC_END_USR_PHY_TBL 0x00000002 /* use negotiation table */ +#define FEC_END_USR_PHY_NO_FD 0x00000004 /* do not use full duplex */ +#define FEC_END_USR_PHY_NO_100 0x00000008 /* do not use 100Mbit speed */ +#define FEC_END_USR_PHY_NO_HD 0x00000010 /* do not use half duplex */ +#define FEC_END_USR_PHY_NO_10 0x00000020 /* do not use 10Mbit speed */ +#define FEC_END_USR_PHY_ISO 0x00000100 /* isolate a PHY */ +#define FEC_END_USR_SER 0x00000200 /* 7-wire serial interface */ +#define FEC_END_USR_LOOP 0x00000400 /* loopback mode */ + /* only use it for testing */ +#define FEC_END_USR_HBC 0x00000080 /* perform heartbeat control */ + +#define FEC_END_TBD_OK 0x1 /* the TBD is a good one */ +#define FEC_END_TBD_BUSY 0x2 /* the TBD has not been used */ +#define FEC_END_TBD_ERROR 0x4 /* the TBD is errored */ + +#define PKT_TYPE_MULTI 0x1 /* packet with a multicast address */ +#define PKT_TYPE_UNI 0x2 /* packet with a unicast address */ +#define PKT_TYPE_NONE 0x4 /* address type is not meaningful */ + +#define BUF_TYPE_CL 0x1 /* this's a cluster pointer */ +#define BUF_TYPE_MBLK 0x2 /* this's a mblk pointer */ +#define BUF_TYPE_LOCAL 0x4 /* local TX buffer (not from + netBufLib) */ + +/* frame descriptors definitions */ + +typedef char * FEC_END_BD_ID; +typedef FEC_END_BD_ID FEC_END_TBD_ID; +typedef FEC_END_BD_ID FEC_END_RBD_ID; + +/* MII definitions */ + +#define MII_MAX_PHY_NUM 0x20 /* max number of attached PHYs */ + +#define MII_CTRL_REG 0x0 /* Control Register */ +#define MII_STAT_REG 0x1 /* Status Register */ +#define MII_PHY_ID1_REG 0x2 /* PHY identifier 1 Register */ +#define MII_PHY_ID2_REG 0x3 /* PHY identifier 2 Register */ +#define MII_AN_ADS_REG 0x4 /* Auto-Negotiation */ + /* Advertisement Register */ +#define MII_AN_PRTN_REG 0x5 /* Auto-Negotiation */ + /* partner ability Register */ +#define MII_AN_EXP_REG 0x6 /* Auto-Negotiation */ + /* Expansion Register */ +#define MII_AN_NEXT_REG 0x7 /* Auto-Negotiation */ + /* next-page transmit Register */ + +/* MII control register bit */ + +#define MII_CR_COLL_TEST 0x0080 /* collision test */ +#define MII_CR_FDX 0x0100 /* FDX =1, half duplex =0 */ +#define MII_CR_RESTART 0x0200 /* restart auto negotiation */ +#define MII_CR_ISOLATE 0x0400 /* isolate PHY from MII */ +#define MII_CR_POWER_DOWN 0x0800 /* power down */ +#define MII_CR_AUTO_EN 0x1000 /* auto-negotiation enable */ +#define MII_CR_100 0x2000 /* 0 = 10mb, 1 = 100mb */ +#define MII_CR_LOOPBACK 0x4000 /* 0 = normal, 1 = loopback */ +#define MII_CR_RESET 0x8000 /* 0 = normal, 1 = PHY reset */ +#define MII_CR_NORM_EN 0x0000 /* just enable the PHY */ + +/* MII Status register bit definitions */ + +#define MII_SR_LINK_STATUS 0x0004 /* link Status -- 1 = link */ +#define MII_SR_AUTO_SEL 0x0008 /* auto speed select capable */ +#define MII_SR_REMOTE_FAULT 0x0010 /* Remote fault detect */ +#define MII_SR_AUTO_NEG 0x0020 /* auto negotiation complete */ +#define MII_SR_10T_HALF_DPX 0x0800 /* 10BaseT HD capable */ +#define MII_SR_10T_FULL_DPX 0x1000 /* 10BaseT FD capable */ +#define MII_SR_TX_HALF_DPX 0x2000 /* TX HD capable */ +#define MII_SR_TX_FULL_DPX 0x4000 /* TX FD capable */ +#define MII_SR_T4 0x8000 /* T4 capable */ + +/* MII Link Code word bit definitions */ + +#define MII_BP_FAULT 0x2000 /* remote fault */ +#define MII_BP_ACK 0x4000 /* acknowledge */ +#define MII_BP_NP 0x8000 /* nexp page is supported */ + +/* MII Next Page bit definitions */ + +#define MII_NP_TOGGLE 0x0800 /* toggle bit */ +#define MII_NP_ACK2 0x1000 /* acknowledge two */ +#define MII_NP_MSG 0x2000 /* message page */ +#define MII_NP_ACK1 0x4000 /* acknowledge one */ +#define MII_NP_NP 0x8000 /* nexp page will follow */ + +/* MII Expansion Register bit definitions */ + +#define MII_EXP_FAULT 0x0010 /* parallel detection fault */ +#define MII_EXP_PRTN_NP 0x0008 /* link partner next-page able */ +#define MII_EXP_LOC_NP 0x0004 /* local PHY next-page able */ +#define MII_EXP_PR 0x0002 /* full page received */ +#define MII_EXP_PRT_AN 0x0001 /* link partner auto negotiation able*/ + +/* technology ability field bit definitions */ + +#define MII_TECH_10BASE_T 0x0020 /* 10Base-T */ +#define MII_TECH_10BASE_FD 0x0040 /* 10Base-T Full Duplex */ +#define MII_TECH_100BASE_TX 0x0080 /* 100Base-TX */ +#define MII_TECH_100BASE_TX_FD 0x0100 /* 100Base-TX Full Duplex */ +#define MII_TECH_100BASE_T4 0x0200 /* 100Base-T4 */ +#define MII_TECH_MASK 0x1fe0 /* technology abilities mask */ + +#define MII_AN_FAIL 0x10 /* auto-negotiation fail */ +#define MII_STAT_FAIL 0x20 /* errors in the status register */ +#define FEC_END_PHY_NO_ABLE 0x40 /* the PHY lacks some abilities */ + +/* FEC_Lite FIFO Transmit Watermark Register(X_WMRK) definitions */ + +#define FEC_XFIFO_WMRK_64 0x00000000 /* TX FIFO watermark(64 bytes) */ +#define FEC_XFIFO_WMRK_128 0x00000001 /* TX FIFO watermark(128 bytes) */ +#define FEC_XFIFO_WMRK_192 0x00000002 /* TX FIFO watermark(192 bytes) */ +#define FEC_XFIFO_WMRK_256 0x00000003 /* TX FIFO watermark(256 bytes) */ + +/* FEC_Lite Opcode/Pause Duration Register(OP_PAUSE) definitions */ + +#define FEC_OP_PAUSE_OPCODE 0x00010000 /* Opcode field used in PAUSE + frames */ + +/* settings */ + +/* FEC-Lite RFIFO Control Register (RFIFO_CNTRL) definitions */ + +#define FEC_RFIFO_CNTRL_FRAME 0x08000000 /* Frame mode enable */ + +#ifdef BESTCOMM_API +#define FEC_RFIFO_CNTRL_GR 0x07000000 /* Default Granularity value = 7*/ +#else +#define FEC_RFIFO_CNTRL_GR 0x04000000 /* Default Granularity value = 4*/ +#endif + +/* FEC-Lite RFIFO Alarm Register (RFIFO_ALARM) definitions */ +#define FEC_RFIFO_ALARM 0x0000030C /* Default value is 520 bytes */ + +/* FEC-Lite XFIFO Control Register(XFIFO_CNTRL) definitions */ + +#define FEC_XFIFO_CNTRL_FRAME 0x08000000 /* Frame mode enable */ + +#ifdef BESTCOMM_API +#define FEC_XFIFO_CNTRL_GR 0x07000000 /* Default Granularity value = 7*/ +#else +#define FEC_XFIFO_CNTRL_GR 0x04000000 /* Default Granularity value = 4*/ +#endif + +#define FEC_XFIFO_CNTRL_TXW_MASK 0x00040000 /* Undocumented bit to set w/Rev.B */ + +#define FEC_PAUSE_DURATION 0x0020 /* Pause transmission for the + duration */ + +/* + * this table may be customized by the user in configNet.h + */ + +IMPORT INT16 m5200FecPhyAnOrderTbl []; + + +typedef struct mii_regs + { + UINT16 phyStatus; /* PHY's status register */ + UINT16 phyCtrl; /* PHY's control register */ + UINT16 phyId1; /* PHY's identifier field 1 */ + UINT16 phyId2; /* PHY's identifier field 2 */ + UINT16 phyAds; /* PHY's advertisement register */ + UINT16 phyPrtn; /* PHY's partner register */ + UINT16 phyExp; /* PHY's expansion register */ + UINT16 phyNext; /* PHY's next paget transmit register */ + } MII_REGS; + +typedef struct phy_info + { + MII_REGS miiRegs; /* PHY registers */ + UINT8 phyAddr; /* address of the PHY to be used */ + UINT8 isoPhyAddr; /* address of a PHY to isolate */ + UINT32 phyFlags; /* some flags */ + UINT32 phySpeed; /* 10/100 Mbit/sec */ + UINT32 phyMode; /* half/full duplex mode */ + UINT32 phyDefMode; /* default operating mode */ + } PHY_INFO; + +typedef struct mot_fec_tbd_list + { + UINT16 fragNum; + UINT16 pktType; + UCHAR * pBuf; + UINT16 bufType; + struct mot_fec_tbd_list * pNext; + FEC_END_TBD_ID pTbd; + } FEC_END_TBD_LIST; + +typedef FEC_END_TBD_LIST * FEC_END_TBD_LIST_ID; + +/* The definition of the driver control structure */ + +typedef struct drv_ctrl + { + END_OBJ endObj; /* base class */ + int unit; /* unit number */ + UINT32 fecBaseAddr; /* internal RAM base address */ + VOIDFUNCPTR * ivecFEC; /* interrupt vector number FEC */ + VOIDFUNCPTR * ivecRDMA; /* interrupt vector number RDMA */ + VOIDFUNCPTR * ivecWDMA; /* interrupt vector number WDMA */ + UINT32 fifoTxBase; /* address of Tx FIFO in internal RAM*/ + UINT32 fifoRxBase; /* address of Rx FIFO in internal RAM*/ + char * pBufBase; /* FEC memory pool base */ + ULONG bufSize; /* FEC memory pool size */ + UINT16 rbdNum; /* number of RBDs */ +#ifndef BESTCOMM_API + FEC_END_RBD_ID rbdBase; /* RBD ring */ +#else + int recvTaskNo; /* Bestcomm Task for Receive */ + int rxPollTID; + #endif + UINT16 rbdIndex; /* RBD index */ + UINT16 tbdNum; /* number of TBDs */ + FEC_END_TBD_ID tbdBase; /* TBD ring */ + #ifdef BESTCOMM_API + int xmitTaskNo; /* Bestcomm Task for Transmit */ + #endif + UINT16 tbdIndex; /* TBD index */ + UINT16 usedTbdIndex; /* used TBD index */ + volatile UINT16 cleanTbdNum; /* number of clean TBDs */ + BOOL txStall; /* tx handler stalled - no Tbd */ + FEC_END_TBD_LIST * pTbdList [FEC_END_TBD_MAX]; + /* list of TBDs */ + ULONG userFlags; /* some user flags */ + INT8 flags; /* driver state */ + BOOL loaded; /* interface has been loaded */ + BOOL intrConnect; /* interrupt has been connected */ + UINT32 intMask; /* interrupt mask register */ + UCHAR * pTxPollBuf; /* cluster pointer for poll mode */ + UCHAR * rxBuf[FEC_END_RBD_MAX]; + /* array of pointers to clusters */ + SEM_ID miiSem; /* synch semaphore for mii frames */ + SEM_ID graSem; /* synch semaphore for graceful */ + /* transmit command */ + char * pClBlkArea; /* cluster block pointer */ + UINT32 clBlkSize; /* clusters block memory size */ + char * pMBlkArea; /* mBlock area pointer */ + UINT32 mBlkSize; /* mBlocks area memory size */ + CACHE_FUNCS bdCacheFuncs; /* cache descriptor */ + CACHE_FUNCS bufCacheFuncs; /* cache descriptor */ + CL_POOL_ID pClPoolId; /* cluster pool identifier */ + PHY_INFO *phyInfo; /* info on a MII-compliant PHY */ + UINT32 clockSpeed; /* clock speed (Hz) for MII_SPEED */ + UINT8 txBuffAvailable; /* Flag for use with pTxBuffLocal */ + char * pTxBuffLocal; /* Local buffer for sending data */ + UINT32 stoppingTx; /* Flag to stop sending frames after */ + /* fecStop has been scheduled */ + } DRV_CTRL; + +/* + * this cache functions descriptors is used to flush/invalidate + * the FEC's data buffers. They are set to the system's cache + * flush and invalidate routine. This will allow proper operation + * of the driver if data cache are turned on. + */ + +IMPORT STATUS cacheArchInvalidate (CACHE_TYPE, void *, size_t); + +IMPORT STATUS cacheArchFlush (CACHE_TYPE, void *, size_t); + +IMPORT STATUS sysFecEnetAddrGet (UINT32 motCmpAddr, UCHAR * address); +IMPORT STATUS sysEnetAddrSet (UINT32 motCmpAddr, UCHAR * address); +IMPORT STATUS sysFecEnetEnable (UINT32 motCmpAddr); +IMPORT STATUS sysFecEnetDisable (UINT32 motCmpAddr); +IMPORT FUNCPTR _func_m5200FecPhyInit; +IMPORT FUNCPTR _func_m5200FecHbFail; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm5200FecEndh */ + diff --git a/h/drv/end/m8260Fcc.h b/h/drv/end/m8260Fcc.h new file mode 100644 index 0000000..36fc2a1 --- /dev/null +++ b/h/drv/end/m8260Fcc.h @@ -0,0 +1,310 @@ +/* m8260Fcc.h - Motorola MPC8260 Fast Communications Controller header file */ + +/* Copyright 1984-1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,12sep99,ms_ created from m8260Cpm.h, 01d. +*/ + +/* + * This file contains constants for the Fast Communications Controllers + * (fCCs) in the Motorola MPC8260 PowerQUICC II integrated Communications + * Processor + */ + +#ifndef __INCm8260Fcch +#define __INCm8260Fcch + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef M8260ABBREVIATIONS +#define M8260ABBREVIATIONS + +#ifdef _ASMLANGUAGE +#define CAST(x) +#else /* _ASMLANGUAGE */ +typedef volatile UCHAR VCHAR; /* shorthand for volatile UCHAR */ +typedef volatile INT32 VINT32; /* volatile unsigned word */ +typedef volatile INT16 VINT16; /* volatile unsigned halfword */ +typedef volatile INT8 VINT8; /* volatile unsigned byte */ +typedef volatile UINT32 VUINT32; /* volatile unsigned word */ +typedef volatile UINT16 VUINT16; /* volatile unsigned halfword */ +typedef volatile UINT8 VUINT8; /* volatile unsigned byte */ +#define CAST(x) (x) +#endif /* _ASMLANGUAGE */ + +#endif /* M8260ABBREVIATIONS */ + +/* + * MPC8260 internal register/memory map (section 17 of prelim. spec) + * note that these are offsets from the value stored in the IMMR + * register. Also note that in the MPC8260, the IMMR is not a special + * purpose register, but it is memory mapped. + */ + +/* CPM mux FCC clock route register */ + +#define M8260_CMXFCR(base) (CAST(VUINT32 *)((base) + 0x11B04)) + +/* FCC 1 register set */ + +#define M8260_FGMR1(base) (CAST(VUINT32 *)((base) + 0x11300)) /* Gen Mode */ +#define M8260_FPSMR1(base) (CAST(VUINT32 *)((base) + 0x11304)) /* Prot Spec */ +#define M8260_FTODR1(base) (CAST(VUINT32 *)((base) + 0x11308)) /* transmit */ + /* on demand */ +#define M8260_FDSR1(base) (CAST(VUINT32 *)((base) + 0x1130C)) /* data sync */ +#define M8260_FCCER1(base) (CAST(VUINT32 *)((base) + 0x11310)) /* event */ +#define M8260_FCCMR1(base) (CAST(VUINT32 *)((base) + 0x11304)) /* mask */ +#define M8260_FCCSR1(base) (CAST(VUINT32 *)((base) + 0x11308)) /* status */ + +/* FCC1 transmit internal rate registers for PHY 0-3 */ + +#define M8260_FTIRR1_PHY0(base) (CAST(VUINT32 *)((base) + 0x1131C)) +#define M8260_FTIRR1_PHY1(base) (CAST(VUINT32 *)((base) + 0x1131D)) +#define M8260_FTIRR1_PHY2(base) (CAST(VUINT32 *)((base) + 0x1131E)) +#define M8260_FTIRR1_PHY3(base) (CAST(VUINT32 *)((base) + 0x1131F)) + +/* offsets in internal RAM of FCC registers */ + +#define M8260_FCC_IRAM_GAP 0x20 /* gap between FCCs */ + /* in Internal RAM */ +#define M8260_FCC_GFMR_OFF 0x0 /* GFMR offset */ +#define M8260_FCC_FPSMR_OFF 0x4 /* FPSMR offset */ +#define M8260_FCC_FTODR_OFF 0x8 /* FTODR offset */ +#define M8260_FCC_FDSR_OFF 0xC /* FDSR offset */ +#define M8260_FCC_FCCER_OFF 0x10 /* FCCER offset */ +#define M8260_FCC_FCCMR_OFF 0x14 /* FCCMR offset */ +#define M8260_FCC_FCCSR_OFF 0x18 /* FCCSR offset */ + +/* FCC Dual-Ported RAM definitions */ + +#define M8260_FCC1_BASE(base) (CAST(VUINT32 *)((base) + 0x8400)) /* FCC1 */ +#define M8260_FCC2_BASE(base) (CAST(VUINT32 *)((base) + 0x8500)) /* FCC2 */ +#define M8260_FCC3_BASE(base) (CAST(VUINT32 *)((base) + 0x8600)) /* FCC3 */ +#define M8260_FCC_DPRAM_GAP 0x100 /* gap between FCCs */ + /* parameter RAM in DPRAM */ +#define M8260_FCC_RIPTR_OFF 0x0 /* rx FIFO pointer offset */ +#define M8260_FCC_TIPTR_OFF 0x2 /* tx FIFO pointer offset */ +#define M8260_FCC_RES1_OFF 0x4 /* reserved */ +#define M8260_FCC_MRBLR_OFF 0x6 /* max rx buffer length */ +#define M8260_FCC_RSTATE_OFF 0x8 /* rx internal state */ +#define M8260_FCC_RBASE_OFF 0xC /* RBD base address */ +#define M8260_FCC_RBDSTAT_OFF 0x10 /* RBD status/control */ +#define M8260_FCC_RBDLEN_OFF 0x12 /* RBD data length */ +#define M8260_FCC_RDPTR_OFF 0x14 /* RBD data pointer */ +#define M8260_FCC_TSTATE_OFF 0x18 /* tx internal state */ +#define M8260_FCC_TBASE_OFF 0x1C /* TBD base address */ +#define M8260_FCC_TBDSTAT_OFF 0x20 /* TBD status/control */ +#define M8260_FCC_TBDLEN_OFF 0x22 /* TBD data length */ +#define M8260_FCC_TDPTR_OFF 0x24 /* TBD data pointer */ +#define M8260_FCC_RBPTR_OFF 0x28 /* RBD pointer */ +#define M8260_FCC_TBPTR_OFF 0x2C /* TBD pointer */ +#define M8260_FCC_RCRC_OFF 0x30 /* temp rx CRC */ +#define M8260_FCC_TCRC_OFF 0x34 /* temp tx CRC */ + +#define M8260_FCC_STATBUF_OFF 0x3C /* internal buffer */ +#define M8260_FCC_CAM_PTR_OFF 0x40 /* CAM address */ +#define M8260_FCC_C_MASK_OFF 0x44 /* MASK for CRC */ +#define M8260_FCC_C_PRES_OFF 0x48 /* preset CRC */ +#define M8260_FCC_CRCEC_OFF 0x4C /* CRC error counter */ +#define M8260_FCC_ALEC_OFF 0x50 /* alignment error counter */ +#define M8260_FCC_DISFC_OFF 0x54 /* discard frame counter */ +#define M8260_FCC_RET_LIM_OFF 0x58 /* retry limit */ +#define M8260_FCC_RET_CNT_OFF 0x5A /* retry limit counter */ +#define M8260_FCC_P_PER_OFF 0x5C /* persistence */ +#define M8260_FCC_BOFF_CNT_OFF 0x5E /* backoff counter */ +#define M8260_FCC_GADDR_H_OFF 0x60 /* group address filter high */ +#define M8260_FCC_GADDR_L_OFF 0x64 /* group address filter low */ +#define M8260_FCC_TFCSTAT_OFF 0x68 /* out-of-sequence TBD stat */ +#define M8260_FCC_TFCLEN_OFF 0x6A /* out-of-sequence TBD length */ +#define M8260_FCC_TFCPTR_OFF 0x6C /* out-of-sequence TBD pointer*/ +#define M8260_FCC_MFLR_OFF 0x70 /* max receive frame length */ +#define M8260_FCC_PADDR_H_OFF 0x72 /* individual address high */ +#define M8260_FCC_PADDR_M_OFF 0x74 /* individual address medium */ +#define M8260_FCC_PADDR_L_OFF 0x76 /* individual address low */ +#define M8260_FCC_IBD_CNT_OFF 0x78 /* internal BD counter */ +#define M8260_FCC_IBD_START_OFF 0x7A /* internal BD start pointer */ +#define M8260_FCC_IBD_END_OFF 0x7C /* internal BD end pointer */ +#define M8260_FCC_TX_LEN_OFF 0x7E /* tx frame length counter */ +#define M8260_FCC_IBD_BASE_OFF 0x80 /* internal BD base */ +#define M8260_FCC_IADDR_H_OFF 0xA0 /* individual addr filter high*/ +#define M8260_FCC_IADDR_L_OFF 0xA4 /* individual addr filter low */ +#define M8260_FCC_MINFLR_OFF 0xA8 /* min frame lenght */ +#define M8260_FCC_TADDR_H_OFF 0xAA /* set hash table addr high */ +#define M8260_FCC_TADDR_M_OFF 0xAC /* set hash table addr medium */ +#define M8260_FCC_TADDR_L_OFF 0xAE /* set hash table addr low */ +#define M8260_FCC_PAD_PTR_OFF 0xB0 /* internal PAD pointer */ +#define M8260_FCC_RES2_OFF 0xB2 /* reserved */ +#define M8260_FCC_CF_RANGE_OFF 0xB4 /* control frame range */ +#define M8260_FCC_MAX_B_OFF 0xB6 /* max BD byte counter */ +#define M8260_FCC_MAXD1_OFF 0xB8 /* max DMA1 lenght */ +#define M8260_FCC_MAXD2_OFF 0xBA /* max DMA2 lenght */ +#define M8260_FCC_MAXD_OFF 0xBC /* rx max DMA lenght */ +#define M8260_FCC_DMA_CNT_OFF 0xBE /* rx DMA counter */ +#define M8260_FCC_OCTC_OFF 0xC0 /* data octets number */ +#define M8260_FCC_COLC_OFF 0xC4 /* collision estimate */ +#define M8260_FCC_BROC_OFF 0xC8 /* received broadast packets */ +#define M8260_FCC_MULC_OFF 0xCC /* received multicast packets */ +#define M8260_FCC_USPC_OFF 0xD0 /* good packets shorter than */ + /* 64 bytes */ +#define M8260_FCC_FRGC_OFF 0xD4 /* bad packets shorter than */ + /* 64 bytes */ +#define M8260_FCC_OSPC_OFF 0xD8 /* good packets longer than */ + /* 1518 bytes */ +#define M8260_FCC_JBRC_OFF 0xDC /* bad packets longer than */ + /* 1518 bytes */ +#define M8260_FCC_P64C_OFF 0xE0 /* packets 64-byte long */ +#define M8260_FCC_P65C_OFF 0xE4 /* packets < 128 bytes and */ + /* > 64 bytes */ +#define M8260_FCC_P128C_OFF 0xE8 /* packets < 256 bytes and */ + /* > 127 bytes */ +#define M8260_FCC_P256C_OFF 0xEC /* packets < 512 bytes and */ + /* > 255 bytes */ +#define M8260_FCC_P512C_OFF 0xF0 /* packets < 1024 bytes and */ + /* > 511 bytes */ +#define M8260_FCC_P1024C_OFF 0xF4 /* packets < 1519 bytes and */ + /* > 1023 bytes */ +#define M8260_FCC_CAM_BUF_OFF 0xF8 /* internal buffer */ +#define M8260_FCC_RES3_OFF 0xFC /* reserved */ + +/* General FCC Mode Register definitions */ + +#define M8260_GFMR_HDLC 0x00000000 /* HDLC mode */ +#define M8260_GFMR_RES1 0x00000001 /* reserved mode */ +#define M8260_GFMR_RES2 0x00000002 /* reserved mode */ +#define M8260_GFMR_RES3 0x00000003 /* reserved mode */ +#define M8260_GFMR_RES4 0x00000004 /* reserved mode */ +#define M8260_GFMR_RES5 0x00000005 /* reserved mode */ +#define M8260_GFMR_RES6 0x00000006 /* reserved mode */ +#define M8260_GFMR_RES7 0x00000007 /* reserved mode */ +#define M8260_GFMR_RES8 0x00000008 /* reserved mode */ +#define M8260_GFMR_RES9 0x00000009 /* reserved mode */ +#define M8260_GFMR_ATM 0x0000000a /* ATM mode */ +#define M8260_GFMR_RES10 0x0000000b /* reserved mode */ +#define M8260_GFMR_ETHERNET 0x0000000c /* ethernet mode */ +#define M8260_GFMR_RES11 0x0000000d /* reserved mode */ +#define M8260_GFMR_RES12 0x0000000e /* reserved mode */ +#define M8260_GFMR_RES13 0x0000000f /* reserved mode */ +#define M8260_GFMR_NORM 0x00000000 /* normal mode */ +#define M8260_GFMR_LOOP 0x40000000 /* local loopback */ +#define M8260_GFMR_ECHO 0x80000000 /* automatic echo */ +#define M8260_GFMR_LOOP_ECHO 0xc0000000 /* loop & echo */ +#define M8260_GFMR_TCI 0x20000000 /* tx clock invert */ +#define M8260_GFMR_TRX 0x10000000 /* transparent receiver */ +#define M8260_GFMR_TTX 0x08000000 /* transparent transmitter */ +#define M8260_GFMR_CDP 0x04000000 /* CD* pulse */ +#define M8260_GFMR_CTSP 0x02000000 /* CTS* pulse */ +#define M8260_GFMR_CDS 0x01000000 /* CD* sampling */ +#define M8260_GFMR_CTSS 0x00800000 /* CTS* sampling */ +#define M8260_GFMR_SYN_EXT 0x00000000 /* external sync */ +#define M8260_GFMR_SYN_AUTO 0x00004000 /* automatic sync */ +#define M8260_GFMR_SYN_8 0x00008000 /* 8-bit sync pattern */ +#define M8260_GFMR_SYN_16 0x0000c000 /* 16-bit sync pattern */ +#define M8260_GFMR_RTSM 0x00002000 /* RTS* mode */ +#define M8260_GFMR_RENC_RES 0x00001000 /* receiver encoding reserved */ +#define M8260_GFMR_RENC_NRZI 0x00000800 /* receiver encoding NRZI */ +#define M8260_GFMR_RENC_NRZ 0x00000000 /* receiver encoding NRZ */ +#define M8260_GFMR_REVD 0x00000400 /* reverse data */ +#define M8260_GFMR_TENC_RES 0x00000200 /* transmitter encoding res */ +#define M8260_GFMR_TENC_NRZI 0x00000100 /* transmitter encoding NRZI */ +#define M8260_GFMR_TENC_NRZ 0x00000000 /* transmitter encoding NRZ */ +#define M8260_GFMR_TCRC_RES 0x00000040 /* transparent CRC reserved */ +#define M8260_GFMR_TCRC_16 0x00000000 /* 16-bit transparent CRC */ +#define M8260_GFMR_TCRC_32 0x00000080 /* 32-bit transparent CRC */ +#define M8260_GFMR_ENT 0x00000010 /* enable transmitter */ +#define M8260_GFMR_ENR 0x00000020 /* enable receiver */ + +/* FCC Data Synchronization Register definitions */ + +#define M8260_FDSR_SYN1_MASK 0x00ff /* sync pattern mask 1 */ +#define M8260_FDSR_SYN2_MASK 0xff00 /* sync pattern mask 2 */ +#define M8260_FDSR_ETH_SYN1 0x55 /* Ethernet sync pattern 1 */ +#define M8260_FDSR_ETH_SYN2 0xd5 /* Ethernet sync pattern 2 */ + +/* FCC Transmit on Demand Register definitions */ + +#define M8260_FTODR_TOD 0x8000 /* transmit on demand */ + +/* FCC Function Code Register definitions */ + +#define M8260_FCR_GBL 0x20 /* global mem operation */ + /* enable snooping */ +#define M8260_FCR_BO_BE 0x10 /* big-endian ordering */ +#define M8260_FCR_BO_LE 0x08 /* little-endian ordering */ +#define M8260_FCR_TC2 0x04 /* transfer code for TC[2] */ +#define M8260_FCR_DTB 0x02 /* data is in the local bus */ +#define M8260_FCR_BDB 0x01 /* BDs are in the local bus */ +#define M8260_FCR_SHIFT 24 /* get to fcr bits in xstate */ + +/* FCC Ethernet Protocol Specific Mode Register definitions */ + +#define M8260_FPSMR_ETH_HBC 0x80000000 /* heartbeat checking */ +#define M8260_FPSMR_ETH_FC 0x40000000 /* force collision */ +#define M8260_FPSMR_ETH_SBT 0x20000000 /* stop backoff timer */ +#define M8260_FPSMR_ETH_LPB 0x10000000 /* loopback operation */ +#define M8260_FPSMR_ETH_LCW 0x08000000 /* late collision window */ +#define M8260_FPSMR_ETH_FDE 0x04000000 /* full duplex enable */ +#define M8260_FPSMR_ETH_MON 0x02000000 /* enable RMON mode */ +#define M8260_FPSMR_ETH_PRO 0x00400000 /* enable promiscous mode */ +#define M8260_FPSMR_ETH_FCE 0x00200000 /* flow control enable */ +#define M8260_FPSMR_ETH_RSH 0x00100000 /* receive short frame */ +#define M8260_FPSMR_ETH_CAM 0x00000400 /* CAM address matching */ +#define M8260_FPSMR_ETH_BRO 0x00000200 /* broadcast enable */ +#define M8260_FPSMR_ETH_CRC_32 0x00000080 /* use 32-bit CCITT CRC */ +#define M8260_FPSMR_ETH_CRC_MASK 0x000000c0 /* CRC mask field */ + +/* FCC Ethernet Event and Mask Register definitions */ + +#define M8260_FEM_ETH_RES 0xff00 /* reserved mask */ +#define M8260_FEM_ETH_EVENT 0x00ff /* event mask */ +#define M8260_FEM_ETH_GRA 0x0080 /* graceful stop event */ +#define M8260_FEM_ETH_RXC 0x0040 /* rx control frame event */ +#define M8260_FEM_ETH_TXC 0x0020 /* tx control frame event */ +#define M8260_FEM_ETH_TXE 0x0010 /* transmission error event */ +#define M8260_FEM_ETH_RXF 0x0008 /* frame received event */ +#define M8260_FEM_ETH_BSY 0x0004 /* busy condition */ +#define M8260_FEM_ETH_TXB 0x0002 /* buffer transmitted event */ +#define M8260_FEM_ETH_RXB 0x0001 /* buffer received event */ + +/* FCC Ethernet Receive Buffer Descriptor definitions */ + +#define M8260_FETH_RBD_E 0x8000 /* buffer is empty */ +#define M8260_FETH_RBD_W 0x2000 /* last BD in ring */ +#define M8260_FETH_RBD_I 0x1000 /* interrupt on receive */ +#define M8260_FETH_RBD_L 0x0800 /* buffer is last in frame */ +#define M8260_FETH_RBD_F 0x0400 /* buffer is first in frame */ +#define M8260_FETH_RBD_M 0x0100 /* miss bit for prom mode */ +#define M8260_FETH_RBD_BC 0x0080 /* broadcast address frame */ +#define M8260_FETH_RBD_MC 0x0040 /* multicast address frame */ +#define M8260_FETH_RBD_LG 0x0020 /* frame length violation */ +#define M8260_FETH_RBD_NO 0x0010 /* nonoctet aligned frame */ +#define M8260_FETH_RBD_SH 0x0008 /* short frame received */ +#define M8260_FETH_RBD_CR 0x0004 /* Rx CRC error */ +#define M8260_FETH_RBD_OV 0x0002 /* overrun condition */ +#define M8260_FETH_RBD_CL 0x0001 /* collision condition */ + +/* FCC Ethernet Transmit Buffer Descriptor definitions */ + +#define M8260_FETH_TBD_R 0x8000 /* buffer is ready */ +#define M8260_FETH_TBD_PAD 0x4000 /* auto pad short frames */ +#define M8260_FETH_TBD_W 0x2000 /* last BD in ring */ +#define M8260_FETH_TBD_I 0x1000 /* interrupt on transmit */ +#define M8260_FETH_TBD_L 0x0800 /* buffer is last in frame */ +#define M8260_FETH_TBD_TC 0x0400 /* auto transmit CRC */ +#define M8260_FETH_TBD_DEF 0x0200 /* defer indication */ +#define M8260_FETH_TBD_HB 0x0100 /* heartbeat */ +#define M8260_FETH_TBD_LC 0x0080 /* late collision */ +#define M8260_FETH_TBD_RL 0x0040 /* retransmission limit */ +#define M8260_FETH_TBD_RC 0x003c /* retry count */ +#define M8260_FETH_TBD_UN 0x0002 /* underrun */ +#define M8260_FETH_TBD_CSL 0x0001 /* carrier sense lost */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm8260Fcch */ diff --git a/h/drv/end/m8260SccEnd.h b/h/drv/end/m8260SccEnd.h new file mode 100644 index 0000000..943bbd2 --- /dev/null +++ b/h/drv/end/m8260SccEnd.h @@ -0,0 +1,400 @@ +/* m8260SccEnd.h - Motorola MPC8260 Serial Communication Controllers (SCC) Ethernet interface header */ + +/* Copyright 1996-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,16jan03,gjc SPR#85071 and SPR#85093 :Added define to support DUPLEX. +01c,17may02,gjc #SPR 75922, undef SCC_BUF if prev defined. +01b,09may02,gjc Fixing SPR #75046 by setting SCC to Full Duplex Mode. +01a,10may01,g_h adapted from sbcM8260CpmEnd.h (ver. 01b). +*/ + +/* +This file contains definitions to support the end-style Network Driver +for the Motorola CPM core Ethernet controller used in the M68EN360 and +PPC800-series communications controllers. These definitions are compiler +dependant, meaning that their values are based on the particular cpu +being used. +*/ + +#ifndef __INCm8260SccEndh +#define __INCm8260SccEndh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "drv/sio/m8260Cp.h" +#include "drv/sio/m8260CpmMux.h" +#include "drv/mem/m8260Siu.h" + +/* defines */ + +/* + * the following may be redefined in the bsp to account for the actual + * number of SCC devices in the system. + */ + +#ifndef MAX_SCC_CHANNELS +#define MAX_SCC_CHANNELS 4 /* max SCC number for Ethernet channels */ +#endif /* MAX_SCC_CHANNELS */ + +/* MPC8260 Dual Ported Ram addresses */ + +#define PPC8260_DPR_SCC1(dprbase) ((VINT32 *) (dprbase + 0x8000)) +#define PPC8260_DPR_SCC2(dprbase) ((VINT32 *) (dprbase + 0x8100)) +#define PPC8260_DPR_SCC3(dprbase) ((VINT32 *) (dprbase + 0x8200)) +#define PPC8260_DPR_SCC4(dprbase) ((VINT32 *) (dprbase + 0x8300)) + + /* SCC 1 register set */ + +#define GSMR_L1(base) (CAST(VUINT32 *)(base + 0x11A00)) /* SCC1 General Mode*/ +#define GSMR_H1(base) (CAST(VUINT32 *)(base + 0x11A04)) /* SCC1 General Mode*/ +#define PSMR1(base) (CAST(VUINT16 *)(base + 0x11A08)) /* SCC1 Proto. Spec */ +/* 11A0A RESERVED */ +#define TODR1(base) (CAST(VUINT16 *)(base + 0x11A0C)) /* SCC1 Tx On Demand*/ +#define DSR1(base) (CAST(VUINT16 *)(base + 0x11A0E)) /* SCC1 Data Sync */ +#define SCCE1(base) (CAST(VUINT16 *)(base + 0x11A10)) /* SCC1 Event Reg */ +#define SCCM1(base) (CAST(VUINT16 *)(base + 0x11A14)) /* SCC1 Mask Reg */ +#define SCCS1(base) (CAST(VUINT8 *)(base + 0x11A17)) /* SCC1 Status Reg */ +/* 11A18-11A1F RESERVED */ + +/* SCC 2 register set */ + +#define GSMR_L2(base) (CAST(VUINT32 *)(base + 0x11A20)) /* SCC2 General Mode*/ +#define GSMR_H2(base) (CAST(VUINT32 *)(base + 0x11A24)) /* SCC2 General Mode*/ +#define PSMR2(base) (CAST(VUINT16 *)(base + 0x11A28)) /* SCC2 Proto. Spec */ +/* 11A2A RESERVED */ +#define TODR2(base) (CAST(VUINT16 *)(base + 0x11A2C)) /* SCC2 Tx On Demand*/ +#define DSR2(base) (CAST(VUINT16 *)(base + 0x11A2E)) /* SCC2 Data Sync */ +#define SCCE2(base) (CAST(VUINT16 *)(base + 0x11A30)) /* SCC2 Event Reg */ +#define SCCM2(base) (CAST(VUINT16 *)(base + 0x11A34)) /* SCC2 Mask Reg */ +#define SCCS2(base) (CAST(VUINT8 *)(base + 0x11A37)) /* SCC2 Status Reg */ +/* 11A38-11A3F RESERVED */ + +/* SCC 3 register set */ + +#define GSMR_L3(base) (CAST(VUINT32 *)(base + 0x11A40)) /* SCC3 General Mode*/ +#define GSMR_H3(base) (CAST(VUINT32 *)(base + 0x11A44)) /* SCC3 General Mode*/ +#define PSMR3(base) (CAST(VUINT16 *)(base + 0x11A48)) /* SCC3 Proto. Spec */ +/* 11A4A RESERVED */ +#define TODR3(base) (CAST(VUINT16 *)(base + 0x11A4C)) /* SCC3 Tx On Demand*/ +#define DSR3(base) (CAST(VUINT16 *)(base + 0x11A4E)) /* SCC3 Data Sync */ +#define SCCE3(base) (CAST(VUINT16 *)(base + 0x11A50)) /* SCC3 Event Reg */ +#define SCCM3(base) (CAST(VUINT16 *)(base + 0x11A54)) /* SCC3 Mask Reg */ +#define SCCS3(base) (CAST(VUINT8 *)(base + 0x11A57)) /* SCC3 Status Reg */ +/* 11A58-11A5F RESERVED */ + +/* SCC 4 register set */ + +#define GSMR_L4(base) (CAST(VUINT32 *)(base + 0x11A60)) /* SCC4 General Mode*/ +#define GSMR_H4(base) (CAST(VUINT32 *)(base + 0x11A64)) /* SCC4 General Mode*/ +#define PSMR4(base) (CAST(VUINT16 *)(base + 0x11A68)) /* SCC4 Proto. Spec */ +/* 11A6A RESERVED */ +#define TODR4(base) (CAST(VUINT16 *)(base + 0x11A6C)) /* SCC4 Tx On Demand*/ +#define DSR4(base) (CAST(VUINT16 *)(base + 0x11A6E)) /* SCC4 Data Sync */ +#define SCCE4(base) (CAST(VUINT16 *)(base + 0x11A70)) /* SCC4 Event Reg */ +#define SCCM4(base) (CAST(VUINT16 *)(base + 0x11A74)) /* SCC2 Mask Reg */ +#define SCCS4(base) (CAST(VUINT8 *)(base + 0x11A77)) /* SCC4 Status Reg */ +/* 11A78-11A7F RESERVED */ + + +#define SCC_USR_RUNNING_FROM_ROM 0x00000001 /* inhibit zcopy mode */ +#define SCC_USR_DUPLEX_HALF 0x00000000 /* Half duplex */ +#define SCC_USR_DUPLEX_FULL 0x00000002 /* Full duplex */ + +#define CPM_DPR_SCC1(baseAddr) PPC8260_DPR_SCC1 (baseAddr) +#define CPM_GSMR_L1(baseAddr) GSMR_L1 (baseAddr) +#define END_OBJ_STRING "MPC8260 PowerQUICC II Enhanced Network Driver" +#define MOT_DEV_NAME "motscc" +#define MOT_DEV_NAME_LEN 7 + + +/* bsp-specific routine to include */ + +#define SYS_ENET_ADDR_GET(address) \ +if (sysSccEnetAddrGet != NULL) \ + if (sysSccEnetAddrGet (pDrvCtrl->unit, (address)) == ERROR) \ + { \ + errnoSet (S_iosLib_INVALID_ETHERNET_ADDRESS); \ + return (NULL); \ + } + +#define SYS_ENET_ENABLE \ +if (sysSccEnetEnable != NULL) \ + if (sysSccEnetEnable (pDrvCtrl->unit) == ERROR) \ + return (ERROR); + +#define SYS_ENET_DISABLE \ +if (sysSccEnetDisable != NULL) \ + sysSccEnetDisable (pDrvCtrl->unit); + +/* General SCC Mode Register definitions */ + +#define SCC_GSMRL_HDLC 0x00000000 /* HDLC mode */ +#define SCC_GSMRL_APPLETALK 0x00000002 /* AppleTalk mode (LocalTalk) */ +#define SCC_GSMRL_SS7 0x00000003 /* SS7 mode (microcode) */ +#define SCC_GSMRL_UART 0x00000004 /* UART mode */ +#define SCC_GSMRL_PROFI_BUS 0x00000005 /* Profi-Bus mode (microcode) */ +#define SCC_GSMRL_ASYNC_HDLC 0x00000006 /* async HDLC mode (microcode)*/ +#define SCC_GSMRL_V14 0x00000007 /* V.14 mode */ +#define SCC_GSMRL_BISYNC 0x00000008 /* BISYNC mode */ +#define SCC_GSMRL_DDCMP 0x00000009 /* DDCMP mode (microcode) */ +#define SCC_GSMRL_ETHERNET 0x0000000c /* ethernet mode (SCC1 only) */ +#define SCC_GSMRL_ENT 0x00000010 /* enable transmitter */ +#define SCC_GSMRL_ENR 0x00000020 /* enable receiver */ +#define SCC_GSMRL_LOOPBACK 0x00000040 /* local loopback mode */ +#define SCC_GSMRL_ECHO 0x00000080 /* automatic echo mode */ +#define SCC_GSMRL_TENC 0x00000700 /* transmitter encoding method*/ +#define SCC_GSMRL_RENC 0x00003800 /* receiver encoding method */ +#define SCC_GSMRL_RDCR_X8 0x00004000 /* receive DPLL clock x8 */ +#define SCC_GSMRL_RDCR_X16 0x00008000 /* receive DPLL clock x16 */ +#define SCC_GSMRL_RDCR_X32 0x0000c000 /* receive DPLL clock x32 */ +#define SCC_GSMRL_TDCR_X8 0x00010000 /* transmit DPLL clock x8 */ +#define SCC_GSMRL_TDCR_X16 0x00020000 /* transmit DPLL clock x16 */ +#define SCC_GSMRL_TDCR_X32 0x00030000 /* transmit DPLL clock x32 */ +#define SCC_GSMRL_TEND 0x00040000 /* transmitter frame ending */ +#define SCC_GSMRL_TPP_00 0x00180000 /* Tx preamble pattern = 00 */ +#define SCC_GSMRL_TPP_10 0x00080000 /* Tx preamble pattern = 10 */ +#define SCC_GSMRL_TPP_01 0x00100000 /* Tx preamble pattern = 01 */ +#define SCC_GSMRL_TPP_11 0x00180000 /* Tx preamble pattern = 11 */ +#define SCC_GSMRL_TPL_NONE 0x00000000 /* no Tx preamble (default) */ +#define SCC_GSMRL_TPL_8 0x00200000 /* Tx preamble = 1 byte */ +#define SCC_GSMRL_TPL_16 0x00400000 /* Tx preamble = 2 bytes */ +#define SCC_GSMRL_TPL_32 0x00600000 /* Tx preamble = 4 bytes */ +#define SCC_GSMRL_TPL_48 0x00800000 /* Tx preamble = 6 bytes */ +#define SCC_GSMRL_TPL_64 0x00a00000 /* Tx preamble = 8 bytes */ +#define SCC_GSMRL_TPL_128 0x00c00000 /* Tx preamble = 16 bytes */ +#define SCC_GSMRL_TINV 0x01000000 /* DPLL transmit input invert */ +#define SCC_GSMRL_RINV 0x02000000 /* DPLL receive input invert */ +#define SCC_GSMRL_TSNC 0x0c000000 /* transmit sense */ +#define SCC_GSMRL_TCI 0x10000000 /* transmit clock invert */ +#define SCC_GSMRL_EDGE 0x60000000 /* adjustment edge +/- */ + +#define SCC_GSMRH_RSYN 0x00000001 /* receive sync timing*/ +#define SCC_GSMRH_RTSM 0x00000002 /* RTS* mode */ +#define SCC_GSMRH_SYNL 0x0000000c /* sync length */ +#define SCC_GSMRH_TXSY 0x00000010 /* transmitter/receiver sync */ +#define SCC_GSMRH_RFW 0x00000020 /* Rx FIFO width */ +#define SCC_GSMRH_TFL 0x00000040 /* transmit FIFO length */ +#define SCC_GSMRH_CTSS 0x00000080 /* CTS* sampling */ +#define SCC_GSMRH_CDS 0x00000100 /* CD* sampling */ +#define SCC_GSMRH_CTSP 0x00000200 /* CTS* pulse */ +#define SCC_GSMRH_CDP 0x00000400 /* CD* pulse */ +#define SCC_GSMRH_TTX 0x00000800 /* transparent transmitter */ +#define SCC_GSMRH_TRX 0x00001000 /* transparent receiver */ +#define SCC_GSMRH_REVD 0x00002000 /* reverse data */ +#define SCC_GSMRH_TCRC 0x0000c000 /* transparent CRC */ +#define SCC_GSMRH_GDE 0x00010000 /* glitch detect enable */ + +/* CPM - Communication Processor Module */ + +/* SCC Ethernet Protocol Specific Mode Register definitions */ + +#define SCC_ETHER_PSMR_FDE 0x0001 +#define SCC_ETHER_PSMR_NIB_13 0x0000 /* SFD 13 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_14 0x0002 /* SFD 14 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_15 0x0004 /* SFD 15 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_16 0x0006 /* SFD 16 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_21 0x0008 /* SFD 21 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_22 0x000a /* SFD 22 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_23 0x000c /* SFD 23 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_24 0x000e /* SFD 24 bits after TENA */ +#define SCC_ETHER_PSMR_LCW 0x0010 /* late collision window */ +#define SCC_ETHER_PSMR_SIP 0x0200 /* sample input pins */ +#define SCC_ETHER_PSMR_LPB 0x0040 /* loopback operation */ +#define SCC_ETHER_PSMR_SBT 0x0080 /* stop backoff timer */ +#define SCC_ETHER_PSMR_BRO 0x0100 /* broadcast address */ +#define SCC_ETHER_PSMR_PRO 0x0200 /* promiscuous mode */ +#define SCC_ETHER_PSMR_CRC 0x0800 /* CRC selection */ +#define SCC_ETHER_PSMR_IAM 0x1000 /* individual address mode */ +#define SCC_ETHER_PSMR_RSH 0x2000 /* receive short frame */ +#define SCC_ETHER_PSMR_FC 0x4000 /* force collision */ +#define SCC_ETHER_PSMR_HBC 0x8000 /* heartbeat checking*/ + +/* SCC Ethernet Event and Mask Register definitions */ + +#define SCC_ETHER_SCCX_RXB 0x0001 /* buffer received event */ +#define SCC_ETHER_SCCX_TXB 0x0002 /* buffer transmitted event */ +#define SCC_ETHER_SCCX_BSY 0x0004 /* busy condition */ +#define SCC_ETHER_SCCX_RXF 0x0008 /* frame received event */ +#define SCC_ETHER_SCCX_TXE 0x0010 /* transmission error event */ +#define SCC_ETHER_SCCX_GRA 0x0080 /* graceful stop event */ + +/* SCC Ethernet Receive Buffer Descriptor definitions */ + +#define SCC_ETHER_RX_BD_CL 0x0001 /* collision condition */ +#define SCC_ETHER_RX_BD_OV 0x0002 /* overrun condition */ +#define SCC_ETHER_RX_BD_CR 0x0004 /* Rx CRC error */ +#define SCC_ETHER_RX_BD_SH 0x0008 /* short frame received */ +#define SCC_ETHER_RX_BD_NO 0x0010 /* Rx nonoctet aligned frame */ +#define SCC_ETHER_RX_BD_LG 0x0020 /* Rx frame length violation */ +#define SCC_ETHER_RX_BD_M 0x0100 /* miss bit for prom mode */ +#define SCC_ETHER_RX_BD_F 0x0400 /* buffer is first in frame */ +#define SCC_ETHER_RX_BD_L 0x0800 /* buffer is last in frame */ +#define SCC_ETHER_RX_BD_I 0x1000 /* interrupt on receive */ +#define SCC_ETHER_RX_BD_W 0x2000 /* last BD in ring */ +#define SCC_ETHER_RX_BD_E 0x8000 /* buffer is empty */ + +/* SCC Ethernet Transmit Buffer Descriptor definitions */ + +#define SCC_ETHER_TX_BD_CSL 0x0001 /* carrier sense lost */ +#define SCC_ETHER_TX_BD_UN 0x0002 /* underrun */ +#define SCC_ETHER_TX_BD_RC 0x003c /* retry count */ +#define SCC_ETHER_TX_BD_RL 0x0040 /* retransmission limit */ +#define SCC_ETHER_TX_BD_LC 0x0080 /* late collision */ +#define SCC_ETHER_TX_BD_HB 0x0100 /* heartbeat */ +#define SCC_ETHER_TX_BD_DEF 0x0200 /* defer indication */ +#define SCC_ETHER_TX_BD_TC 0x0400 /* auto transmit CRC */ +#define SCC_ETHER_TX_BD_L 0x0800 /* buffer is last in frame */ +#define SCC_ETHER_TX_BD_I 0x1000 /* interrupt on transmit */ +#define SCC_ETHER_TX_BD_W 0x2000 /* last BD in ring */ +#define SCC_ETHER_TX_BD_PAD 0x4000 /* auto pad short frames */ +#define SCC_ETHER_TX_BD_R 0x8000 /* buffer is ready */ + +/* typedefs */ + +/* SCC - Serial Comunications Controller */ + +typedef struct /* SCC_ETHER_PROTO */ + { + UINT32 c_pres; /* preset CRC */ + UINT32 c_mask; /* constant mask for CRC */ + UINT32 crcec; /* CRC error counter */ + UINT32 alec; /* alignment error counter */ + UINT32 disfc; /* discard frame counter */ + UINT16 pads; /* short frame pad value */ + UINT16 ret_lim; /* retry limit threshold */ + UINT16 ret_cnt; /* retry limit counter */ + UINT16 mflr; /* maximum frame length register */ + UINT16 minflr; /* minimum frame length register */ + UINT16 maxd1; /* max DMA1 length register */ + UINT16 maxd2; /* max DMA2 length register */ + UINT16 maxd; /* Rx max DMA */ + UINT16 dma_cnt; /* Rx DMA counter */ + UINT16 max_b; /* max BD byte count */ + UINT16 gaddr1; /* group address filter 1 */ + UINT16 gaddr2; /* group address filter 2 */ + UINT16 gaddr3; /* group address filter 3 */ + UINT16 gaddr4; /* group address filter 4 */ + UINT32 tbuf0_data0; /* save area 0 - current frame */ + UINT32 tbuf0_data1; /* save area 1 - current frame */ + UINT32 tbuf0_rba0; /* ? */ + UINT32 tbuf0_crc; /* ? */ + UINT16 tbuf0_bcnt; /* ? */ + UINT16 paddr1_h; /* physical address 1 (MSB) */ + UINT16 paddr1_m; /* physical address 1 */ + UINT16 paddr1_l; /* physical address 1 (LSB) */ + UINT16 p_per; /* persistence */ + UINT16 rfbd_ptr; /* Rx first BD pointer */ + UINT16 tfbd_ptr; /* Tx first BD pointer */ + UINT16 tlbd_ptr; /* Tx last BD pointer */ + UINT32 tbuf1_data0; /* save area 0 - next frame */ + UINT32 tbuf1_data1; /* ? */ + UINT32 tbuf1_rba0; /* ? */ + UINT32 tbuf1_crc; /* ? */ + UINT16 tbuf1_bcnt; /* ? */ + UINT16 tx_len; /* Tx frame length counter */ + UINT16 iaddr1; /* individual address filter 1 */ + UINT16 iaddr2; /* individual address filter 2 */ + UINT16 iaddr3; /* individual address filter 3 */ + UINT16 iaddr4; /* individual address filter 4 */ + UINT16 boff_cnt; /* backoff counter */ + UINT16 taddr_h; /* temp address (MSB) */ + UINT16 taddr_m; /* temp address */ + UINT16 taddr_l; /* temp address (LSB) */ + } SCC_ETHER_PROTO; + +/* SCC Parameters */ + + typedef struct /* SCC_PARAM */ + { /* offset description*/ + volatile INT16 rbase; /* 00 Rx buffer descriptor base address */ + volatile INT16 tbase; /* 02 Tx buffer descriptor base address */ + volatile INT8 rfcr; /* 04 Rx function code */ + volatile INT8 tfcr; /* 05 Tx function code */ + volatile INT16 mrblr; /* 06 maximum receive buffer length */ + volatile INT32 rstate; /* 08 Rx internal state */ + volatile INT32 res1; /* 0C Rx internal data pointer */ + volatile INT16 rbptr; /* 10 Rx buffer descriptor pointer */ + volatile INT16 res2; /* 12 reserved/internal */ + volatile INT32 res3; /* 14 reserved/internal */ + volatile INT32 tstate; /* 18 Tx internal state */ + volatile INT32 res4; /* 1C reserved/internal */ + volatile INT16 tbptr; /* 20 Tx buffer descriptor pointer */ + volatile INT16 res5; /* 22 reserved/internal */ + volatile INT32 res6; /* 24 reserved/internal */ + volatile INT32 rcrc; /* 28 temp receive CRC */ + volatile INT32 tcrc; /* 2C temp transmit CRC */ + } SCC_PARAM; + +typedef struct /* SCC */ + { + SCC_PARAM param; /* SCC parameters */ + char prot[64]; /* protocol specific area */ + } SCC; + +typedef struct /* SCC_REG */ + { + UINT32 gsmrl; /* SCC general mode register - low */ + UINT32 gsmrh; /* SCC eneral mode register - high */ + UINT16 psmr; /* SCC protocol mode register */ + UINT16 res1; /* reserved */ + UINT16 todr; /* SCC transmit on demand */ + UINT16 dsr; /* SCC data sync. register */ + UINT16 scce; /* SCC event register */ + UINT16 res2; /* reserved */ + UINT16 sccm; /* SCC mask register */ + UINT8 res3; /* reserved */ + UINT8 sccs; /* SCC status register */ + } SCC_REG; + +/* SCC Buffer */ + +#ifdef SCC_BUF +#undef SCC_BUF +#endif + +typedef struct /* SCC_BUF */ + { + UINT16 statusMode; /* status and control */ + UINT16 dataLength; /* length of data buffer in bytes */ + u_char * dataPointer; /* points to data buffer */ + } SCC_BUF; + +/* SCC device descriptor */ + +typedef struct /* SCC_ETHER_DEV */ + { + int sccNum; /* number of SCC device */ + int txBdNum; /* number of transmit buf descriptors */ + int rxBdNum; /* number of receive buf descriptors */ + SCC_BUF * txBdBase; /* transmit BD base address */ + SCC_BUF * rxBdBase; /* receive BD base address */ + u_char * txBufBase; /* transmit buffer base address */ + u_char * rxBufBase; /* receive buffer base address */ + UINT32 txBufSize; /* transmit buffer size */ + UINT32 rxBufSize; /* receive buffer size */ + int txBdNext; /* next transmit BD to fill */ + int rxBdNext; /* next receive BD to read */ + volatile SCC * pScc; /* SCC parameter RAM */ + volatile SCC_REG * pSccReg; /* SCC registers */ + UINT32 intMask; /* interrupt acknowledge mask */ + } SCC_ETHER_DEV; + + +/* globals */ + +IMPORT STATUS sysSccEnetEnable (int unit); /* enable ctrl */ +IMPORT void sysSccEnetDisable (int unit); /* disable ctrl */ +IMPORT STATUS sysSccEnetAddrGet (int unit, u_char * addr); /* get enet addr */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm8260SccEndh */ + diff --git a/h/drv/end/mb86960End.h b/h/drv/end/mb86960End.h new file mode 100644 index 0000000..8bf8274 --- /dev/null +++ b/h/drv/end/mb86960End.h @@ -0,0 +1,312 @@ +/* mb86960End.h - Fujitsu MB86960 Ethernet Controller interface header */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,20sep01,dat Removing ANSI errors for diab compiler +01a,27feb99,db created from target/h/drv/netif/if_fn.h +*/ + +#ifndef __INCmb86960h +#define __INCmb86960h + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "end.h" +#include "netinet/if_ether.h" + +/* defines */ + +#define FN_DEV_NAME "fn" +#define FN_DEV_NAME_LEN 3 +#define ENET_ADDR_LEN 6 + +/* Pre-defined interrupt masks */ + +#define NORM_INTRMASK (DLCR3_RX_PKT | DLCR3_OVR_FLO) +#define NO_RX_INTRMASK (DLCR3_OVR_FLO) + +#define MB86960_CRC_POLY 0xedb88320 + +/* Start transmission */ + +#define KICK_TRANSMIT (BMR10_TMST | BMR11_MASK16 | BMR11_RST_TX16 \ + | BMR11_OPT_16_COLL | 0x0100) + +/* Configuration items */ + +#define MB86960_SPEED 10000000 /* 10BASE-T speed in bits/sec */ + +/* SECTION: Data Structures */ + +typedef struct rx_hdr /* received packet header */ + { + unsigned short status; /* only upper byte used */ + unsigned short len; /* pkt length in little endian order */ + } MB86960_RX_HDR; + +#define MB86960_RX_HDR_SIZ sizeof(MB86960_RX_HDR) + +#define MB86960_DATA_OFFSET (sizeof(u_short) + MB86960_RX_HDR_SIZ) + +typedef struct rx_frame + { + u_short pad1; + MB86960_RX_HDR rxHdr; /* header provided by chip */ + struct ether_header enetHdr; /* the Ethernet header */ + char data [ETHERMTU]; /* the data field */ + } MB86960_RX_FRAME; + +#define MB86960_BUFSIZ (sizeof(struct rx_frame)) + +#define MB86960_FRAME_DATA_ADDR_GET(pFrame) \ + (pFrame = ((char *)(pFrame) + sizeof(UINT16) \ + + sizeof(MB86960_RX_HDR))) + +/* The definition of the driver control structure */ + +typedef struct mb86960_end_ctrl + { + END_OBJ end; /* The class we inherit from. */ + int unit; /* unit number */ + int vector; /* interrupt vector */ + long flags; /* Our local flags. */ + char * devBaseAddr; /* Base address of the device register set */ + SEM_ID txSem; /* transmitter semaphore */ + UCHAR enetAddr[6]; /* ethernet address */ + CL_POOL_ID pClPoolId; /* Cluster Pool Id */ + } MB86960_END_CTRL; + +#define MB86960_END_CTRL_SIZE sizeof(MB86960_END_CTRL) + + +/* SECTION: Register Addresses */ + +/* NICE registers, defined as offsets from base addr */ + + /* The statically mapped registers. This group of registers is + * always available to the CPU. + * This first group are the data link control registers 0-7. + */ + +#define NICE_STATUS 0x02 /* DLC0,1: Tx and Rx status */ +#define NICE_INTRMASK 0x06 /* DLC2,3: Tx and Rx intr masks */ +#define NICE_MODE 0x0a /* DLC4,5: Tx and Rx modes */ +#define NICE_CONFIG 0x0e /* DLC6,7: configuration bits */ + + + /* The selectable mapped registers. These groups can be mapped in + * or out of the overall register set. The selection of which group + * is currently mapped in is done via control register 2 (DLCR7) in + * the statically mapped register group above. + */ + + + /* the secondary data link control regs */ + +#define NICE_ADDR1 0x12 /* DLC8,9: node addr high word */ +#define NICE_ADDR2 0x16 /* DLC10,11: node addr mid word */ +#define NICE_ADDR3 0x1a /* DLC12,13: node addr low word */ +#define NICE_TDR 0x1e /* DLC14,15: time domain counter */ + + /* the hash table registers */ + +#define NICE_HASH1 0x12 +#define NICE_HASH2 0x16 +#define NICE_HASH3 0x1a +#define NICE_HASH4 0x1e + + /* the buffer memory registers */ + +#define NICE_PORT 0x12 /* BMR8: access port to buffer */ +#define NICE_TRANSMIT 0x16 /* BMR10,11: Tx cmd & coll ctrl */ +#define NICE_DMA 0x1a /* BMR12,13: DMA control */ +#define NICE_STUFF 0x1e + + + +/* SECTION: bit defines for the device registers and receive header status */ + +/* The status field of the receive header (RX_HDR above) */ + +#define RX_HDR_STAT_BIT_7 0x8000 /* unused; should read as 0 */ +#define RX_HDR_STAT_BIT_6 0x4000 /* unused; should read as 0 */ +#define RX_HDR_STAT_GOOD 0x2000 /* packet is good */ +#define RX_HDR_STAT_RMT_RST 0x1000 /* packet type = 0x0900 */ +#define RX_HDR_STAT_SHRT_ERR 0x0800 /* short packet error */ +#define RX_HDR_STAT_ALGN_ERR 0x0400 /* alignment error */ +#define RX_HDR_STAT_CRC_ERR 0x0200 /* CRC error */ +#define RX_HDR_STAT_OVR_FLO 0x0100 /* overflow error */ + + /* Note that the short error bit has been observed to be set sporadically + * and is therefore not usable. The overflow bit should never be set, + * since the receiver should not be giving us incomplete packets! The + * lower byte of the status field is currently unused, but has been seen + * to have various bits set. It is probably wise to simply mask this + * byte off to avoid any confusion. + */ + + +/* DLCR0,1 -- the receive and transmit status register */ + +#define DLCR0_TX_DONE 0x8000 /* transmit OK */ +#define DLCR0_NET_BSY 0x4000 /* network is busy, carrier present */ +#define DLCR0_TX_RX 0x2000 /* transmit received good */ +#define DLCR0_CR_LOST 0x1000 /* short packet */ +#define DLCR0_BIT_3 0x0800 /* unused bit; write 0 */ +#define DLCR0_COL 0x0400 /* a collision occurred */ +#define DLCR0_16_COL 0x0200 /* 16 collisions occurred */ +#define DLCR0_BUS_WR_ERR 0x0100 /* buss write error */ + +#define DLCR1_RX_PKT 0x0080 /* received packet ready */ +#define DLCR1_BUS_RD_ERR 0x0040 /* buss read error */ +#define DLCR1_DMA_EOP 0x0020 /* DMA end operation interrupt status */ +#define DLCR1_RMT_RST 0x0010 /* received a remote reset packet */ +#define DLCR1_SHRT_ERR 0x0008 /* short packet error */ +#define DLCR1_ALGN_ERR 0x0004 /* alignment error */ +#define DLCR1_CRC_ERR 0x0002 /* CRC error, CRC does not match FCS */ +#define DLCR1_OVR_FLO 0x0001 /* overflow, no space available */ + + +/* DLCR2,3 -- interrupt masks for receive and transmit status register */ + +#define DLCR2_TX_DONE 0x8000 /* transmit OK intr mask */ +#define DLCR2_BIT_6 0x4000 /* unused; write 0 */ +#define DLCR2_TX_RX 0x2000 /* transmission received good mask */ +#define DLCR2_BIT_4 0x1000 /* unused; write 0 */ +#define DLCR2_BIT_3 0x0800 /* unused; write 0 */ +#define DLCR2_COL 0x0400 /* collision intr mask */ +#define DLCR2_16_COL 0x0200 /* 16 collisions intr mask */ +#define DLCR2_BUS_WR_ERR 0x0100 /* buss write error intr mask */ + +#define DLCR3_RX_PKT 0x0080 /* received packet ready intr mask */ +#define DLCR3_BUS_RD_ERR 0x0040 /* buss read error intr mask */ +#define DLCR3_DMA_EOP 0x0020 /* DMA end operation intr mask */ +#define DLCR3_RMT_RST 0x0010 /* remote reset intr mask */ +#define DLCR3_SHRT_ERR 0x0008 /* short packet error intr mask */ +#define DLCR3_ALGN_ERR 0x0004 /* alignment error intr mask */ +#define DLCR3_CRC_ERR 0x0002 /* CRC error intr mask */ +#define DLCR3_OVR_FLO 0x0001 /* overflow error intr mask */ + + +/* DLCR4,5 -- receiver and transmitter modes register */ + +#define DLCR4_COL_CTR 0xf000 /* collision counter, 4 bits */ +#define DLCR4_BIT_3 0x0800 /* unused; write 0 */ +#define DLCR4_CNTRL 0x0400 /* drives the CNTRL pin; pin 95 */ +#define DLCR4_LBC 0x0200 /* endec loopback; 0 selects */ +#define DLCR4_TX_NO_DEFER 0x0100 /* disable carrier detect on Tx */ + +#define DLCR5_BIT_7 0x0080 /* unused; write 0 */ +#define DLCR5_BUF_EMPTY 0x0040 /* buffer empty */ +#define DLCR5_ACPT_BAD 0x0020 /* accept bad packets */ +#define DLCR5_SHRT_ADD 0x0010 /* use short address, 5 bytes */ +#define DLCR5_ENA_SHRT_PKT 0x0008 /* enable receipt of short packets */ +#define DLCR5_BIT_2 0x0004 /* unused; write 1 */ +#define DLCR5_AF1 0x0002 /* addr filter mode, bit 1 */ +#define DLCR5_AF0 0x0001 /* addr filter mode, bit 0 */ + + +/* DLCR6,7 -- configuration register */ + +#define DLCR6_DISABLE_DLC 0x8000 /* disable data link controller */ +#define DLCR6_BIT_6 0x4000 /* unused; write 1 */ +#define DLCR6_SYS_BUS 0x2000 /* selects width of system bus */ +#define DLCR6_SYS_BUS_8 0x2000 /* system bus is 8 bit */ +#define DLCR6_SYS_BUS_16 0x0000 /* system bus is 16 bit */ +#define DLCR6_BUF_BUS 0x1000 /* selects width of buffer bus */ +#define DLCR6_BUF_BUS_8 0x1000 /* buffer bus is 8 bits */ +#define DLCR6_BUF_BUS_16 0x0000 /* buffer bus is 16 bits */ +#define DLCR6_TBS 0x0c00 /* selects Tx buffer size, 2 bits */ +#define DLCR6_TBS_2KB 0x0000 /* Tx buffer size is 2 KB */ +#define DLCR6_TBS_4KB 0x0400 /* Tx buffer size is 4 KB */ +#define DLCR6_TBS_8KB 0x0800 /* Tx buffer size is 8 KB */ +#define DLCR6_TBS_16KB 0x0c00 /* Tx buffer size is 16 KB */ +#define DLCR6_BS 0x0300 /* selects SRAM buffer size, 2 bits */ +#define DLCR6_BS_8KB 0x0000 /* SRAM buffer size is 8 KB */ +#define DLCR6_BS_16KB 0x0100 /* SRAM buffer size is 16 KB */ +#define DLCR6_BS_32KB 0x0200 /* SRAM buffer size is 32 KB */ +#define DLCR6_BS_64KB 0x0300 /* SRAM buffer size is 64 KB */ + +#define DLCR7_CNF 0x00c0 /* selects chip config, 2 bits */ +#define DLCR7_CNF_NICE 0x0000 /* normal NICE mode */ +#define DLCR7_CNF_MONITOR 0x0040 /* add monitor function */ +#define DLCR7_CNF_BYPASS 0x0080 /* bypass ENDEC */ +#define DLCR7_CNF_TEST 0x00c0 /* test ENDEC */ +#define DLCR7_PWRDN 0x0020 /* selects standby power mode */ +#define DLCR7_PWRDN_ON 0x0000 /* standby mode on */ +#define DLCR7_PWRDN_OFF 0x0020 /* standby mode off */ +#define DLCR7_BIT_4 0x0010 /* unused; write 1 */ +#define DLCR7_REG_BNK 0x000c /* selects register bank, 2 bits */ +#define DLCR7_REG_BNK_DLC 0x0000 /* DLC group 00 is mapped in */ +#define DLCR7_REG_BNK_HASH 0x0004 /* HASH group 01 is mapped in */ +#define DLCR7_REG_BNK_BMR 0x000c /* BMR group 10 is mapped in */ +#define DLCR7_EOP_POL 0x0002 /* selects polarity of EOP pin */ +#define DLCR7_ENDIAN 0x0001 /* selects endian mode of system bus */ +#define DLCR7_ENDIAN_LITTLE 0x0000 /* endian mode is little */ +#define DLCR7_ENDIAN_BIG 0x0001 /* endian mode is big */ + + +/* + * DLCR8-DLCR13 are the node ID registers when register group 00 is mapped in. + * There are no bit defines for these registers. Given an Ethernet address + * of 11:22:33:44:55:66, the following shows the relationship to these + * registers. + * dlcr8 = 0x11; + * dlcr9 = 0x22; + * ..... + * dlcr13 = 0x66; + */ + + +/* + * DLCR14,DLCR15 are the time domain reflectometer registers when register + * group 00 is mapped in. There are no bit defines for these registers. + * R14 holds the LSB, R15 the MSB, both are read only. + */ + + +/* BMR8 -- buffer memory port. There are no bit defines for this register. */ + +/* BMR10,11 -- transmit collision control and start command register */ + +#define BMR10_TMST 0x8000 /* transmit start command */ +#define BMR10_PKTS 0x7f00 /* number of packets to transmit */ + +#define BMR11_BIT7 0x0080 /* unused, write with 0 */ +#define BMR11_BIT6 0x0040 /* unused, write with 0 */ +#define BMR11_BIT5 0x0020 /* unused, write with 0 */ +#define BMR11_BIT4 0x0010 /* unused, write with 0 */ +#define BMR11_BIT3 0x0008 /* unused, write with 0 */ +#define BMR11_MASK16 0x0004 /* something to do with 16 colls */ +#define BMR11_RST_TX16 0x0002 /* " */ +#define BMR11_OPT_16_COLL 0x0001 /* " */ + + +/* BMR12,13 -- DMA control register */ + +#define BMR12_BIT7 0x8000 /* unused, write with 0 */ +#define BMR12_BIT6 0x4000 /* unused, write with 0 */ +#define BMR12_BIT5 0x2000 /* unused, write with 0 */ +#define BMR12_BIT4 0x1000 /* unused, write with 0 */ +#define BMR12_BIT3 0x0800 /* unused, write with 0 */ +#define BMR12_BIT2 0x0400 /* unused, write with 0 */ +#define BMR12_DMA_RENA 0x0200 /* DMA read enable */ +#define BMR12_DMA_TENA 0x0100 /* DMA write enable */ + + +/* BMR14 -- to be done */ + +/* BMR15 -- currently no function */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmb86960h */ diff --git a/h/drv/end/mbcEnd.h b/h/drv/end/mbcEnd.h new file mode 100644 index 0000000..870e3c4 --- /dev/null +++ b/h/drv/end/mbcEnd.h @@ -0,0 +1,191 @@ +/* mbcEnd.h - Motorola 68302fads End network interface header */ + +/* Copyright 1996-1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,19feb99,dra written. +*/ + +/* +This file contains I/O addresses and related constants for the Motorola +Module Bus Ethernet controller used in the M68EN360 communications +controller. +*/ + +#ifndef __INCmbcEndh +#define __INCmbcEndh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +/* MBC - Module Bus Ethernet controller */ + +#define DEV_NAME "mbc" /* device interface name */ +#define DEV_NAME_LEN 4 /* device name length */ + +/* Module Bus Ethernet Controller registers */ + +#define MBC_ECNTL 0x000 /* ethernet control register */ +#define MBC_EDMA 0x002 /* DMA configuration register */ +#define MBC_EMRBLR 0x004 /* max receive buffer length */ +#define MBC_IVEC 0x006 /* interrupt vector register */ +#define MBC_IEVNT 0x008 /* interrupt event */ +#define MBC_IMASK 0x00a /* interrupt mask register */ +#define MBC_ECFG 0x00c /* configurartion register */ +#define MBC_TEST 0x00e /* test register */ +#define MBC_AR 0x010 /* address recognition control */ +#define MBC_ARTAB 0x200 /* address recognition table */ +#define MBC_EBD 0x400 /* buffer descriptors table */ + +/* Ethernet Control register definitions */ + +#define MBC_ECNTL_RES 0x0000 /* ethernet reset */ +#define MBC_ECNTL_RES_OFF 0x0001 /* ethernet reset off */ +#define MBC_ECNTL_ENBL 0x0002 /* ethernet enable */ +#define MBC_ECNTL_GTS 0x0004 /* graceful tx stop */ + +/* Ethernet DMA config/status register definitions */ + +#define MBC_EDMA_BLIM_MSK 0x0007 /* burst limit mask */ +#define MBC_EDMA_BLIM_1 0x0000 /* burst limit, 1 */ +#define MBC_EDMA_BLIM_2 0x0001 /* burst limit, 2 */ +#define MBC_EDMA_BLIM_4 0x0002 /* burst limit, 4 */ +#define MBC_EDMA_BLIM_8 0x0003 /* burst limit, 8 */ +#define MBC_EDMA_BLIM_16 0x0004 /* burst limit, 16 */ +#define MBC_EDMA_BLIM_32 0x0005 /* burst limit, 32 */ +#define MBC_EDMA_BLIM_64 0x0006 /* burst limit, 64 */ +#define MBC_EDMA_BLIM_UNL 0x0007 /* burst limit, unlimited */ +#define MBC_EDMA_WMRK_MSK 0x0018 /* fifo watermark mask */ +#define MBC_EDMA_WMRK_8 0x0000 /* fifo watermark 8 bytes */ +#define MBC_EDMA_WMRK_16 0x0008 /* fifo watermark 16 bytes */ +#define MBC_EDMA_WMRK_24 0x0010 /* fifo watermark 24 bytes */ +#define MBC_EDMA_WMRK_32 0x0018 /* fifo watermark 32 bytes */ +#define MBC_EDMA_TSRLY 0x0020 /* transmit start early */ +#define MBC_EDMA_BDS_MSK 0x00c0 /* bdsize mask */ +#define MBC_EDMA_BDS_SHFT 0x0006 /* shift cnt for bd size */ +#define MBC_EDMA_BDS_8 0x0000 /* bdsize 8tx/120rx */ +#define MBC_EDMA_BDS_16 0x0001 /* bdsize 16tx/112rx */ +#define MBC_EDMA_BDS_32 0x0002 /* bdsize 32tx/96rx */ +#define MBC_EDMA_BDS_64 0x0003 /* bdsize 64tx/64rx */ +#define MBC_EDMA_BDE_MSK 0xfe00 /* bd error # */ +#define MBC_EDMA_BDE_SHFT 0x0009 /* shift cnt for bd error # */ +#define MBC_BD_MAX 128 /* total number of buffer descriptors */ + +/* Interrupt Vector register definitions */ + +#define MBC_IVEC_MSK 0x00ff /* interrupt vector mask */ +#define MBC_IVEC_RX 0x0000 /* receive interrupt */ +#define MBC_IVEC_TX 0x0001 /* transmit interrupt */ +#define MBC_IVEC_NTC 0x0002 /* non time critical interrupt */ +#define MBC_IVEC_TC 0x0003 /* time critical interrupt */ +#define MBC_IVEC_VG 0x0100 /* vector granularity */ + +/* Interrupt Event register definitions */ + +#define MBC_IEVNT_RXB 0x0001 /* receive buffer interrupt */ +#define MBC_IEVNT_TXB 0x0002 /* transmit buffer interrupt */ +#define MBC_IEVNT_BSY 0x0004 /* busy interrupt */ +#define MBC_IEVNT_RXF 0x0008 /* receive frame interrupt */ +#define MBC_IEVNT_TXF 0x0010 /* transmit frame interrupt */ +#define MBC_IEVNT_EBE 0x0020 /* ethernet bus error */ +#define MBC_IEVNT_BOD 0x0040 /* backoff done */ +#define MBC_IEVNT_GRA 0x0080 /* graceful stop complete */ +#define MBC_IEVNT_BTE 0x0100 /* babbling transmitter error */ +#define MBC_IEVNT_BRE 0x0200 /* babbling receiver error */ +#define MBC_IEVNT_HBE 0x0400 /* heartbeat error */ + +/* Interrupt Mask register */ + +#define MBC_IMASK_RXB 0x0001 /* receive buffer interrupt */ +#define MBC_IMASK_TXB 0x0002 /* transmit buffer interrupt */ +#define MBC_IMASK_BSY 0x0004 /* busy interrupt */ +#define MBC_IMASK_RXF 0x0008 /* receive frame interrupt */ +#define MBC_IMASK_TXF 0x0010 /* transmit frame interrupt */ +#define MBC_IMASK_EBE 0x0020 /* ethernet bus error */ +#define MBC_IMASK_BOD 0x0040 /* backoff done */ +#define MBC_IMASK_GRA 0x0080 /* graceful stop complete */ +#define MBC_IMASK_BTE 0x0100 /* babbling transmitter error */ +#define MBC_IMASK_BRE 0x0200 /* babbling receiver error */ +#define MBC_IMASK_HBE 0x0400 /* heartbeat error */ + +/* Ethernet Configuration register definitions */ + +#define MBC_ECFG_LOOP 0x0001 /* internal loopback */ +#define MBC_ECFG_FDEN 0x0002 /* full duplex enable */ +#define MBC_ECFG_HBC 0x0004 /* heartbeat control */ + +/* Address Recognition register definitions */ +/* written only when ethernet controller is disabled */ + +#define MBC_AR_PROM 0x0400 /* promiscuous */ +#define MBC_AR_PAREJ 0x0800 /* phys address reject */ +#define MBC_AR_INDEX 0x4000 /* index enable */ +#define MBC_AR_MULTI_00 0x0000 /* multicast and broadcast */ +#define MBC_AR_MULTI_01 0x1000 /* multicast, but no broadcast */ +#define MBC_AR_MULTI_10 0x2000 /* all multicast and broadcast */ +#define MBC_AR_MULTI_11 0x3000 /* no multicast or broadcast */ +#define MBC_AR_HASH 0x8000 /* hash mode enable */ + +#define MBC_ARTAB_SIZE 64 /* number of entries in the AR table */ + + +/* SCC Ethernet Protocol Specific Mode Register definitions */ + +/* Receive/Transmit Buffer Descriptor */ +#ifndef _ASMLANGUAGE + +typedef struct /* MBC_BD */ + { + UINT16 statusMode; /* status and control */ + UINT16 dataLength; /* length of data buffer in bytes */ + UCHAR * dataPointer; /* points to data buffer */ + } MBC_BD; + +#endif /* _ASMLANGUAGE */ + + +/* Receive Buffer Descriptor statusMode field definitions */ + +#define MBC_RXBD_CL 0x0001 /* collision condition */ +#define MBC_RXBD_OV 0x0002 /* overrun condition */ +#define MBC_RXBD_CR 0x0004 /* Rx CRC error */ +#define MBC_RXBD_SH 0x0008 /* short frame received */ +#define MBC_RXBD_NO 0x0010 /* Rx nonoctet aligned frame */ +#define MBC_RXBD_LG 0x0020 /* Rx frame length violation */ +#define MBC_RXBD_M 0x0100 /* miss bit for prom mode */ +#define MBC_RXBD_F 0x0400 /* buffer is first in frame */ +#define MBC_RXBD_L 0x0800 /* buffer is last in frame */ +#define MBC_RXBD_I 0x1000 /* interrupt on receive */ +#define MBC_RXBD_W 0x2000 /* last BD in ring */ +#define MBC_RXBD_E 0x8000 /* buffer is empty */ + +/* Transmit Buffer Descriptor statusMode field definitions */ + +#define MBC_TXBD_CSL 0x0001 /* carrier sense lost */ +#define MBC_TXBD_UN 0x0002 /* underrun */ +#define MBC_TXBD_RC 0x003c /* retry count */ +#define MBC_TXBD_RC_SHFT 0x0002 /* shift cnt for RC */ +#define MBC_TXBD_RL 0x0040 /* retransmission limit */ +#define MBC_TXBD_LC 0x0080 /* late collision */ +#define MBC_TXBD_HB 0x0100 /* heartbeat */ +#define MBC_TXBD_DEF 0x0200 /* defer indication */ +#define MBC_TXBD_TC 0x0400 /* auto transmit CRC */ +#define MBC_TXBD_L 0x0800 /* buffer is last in frame */ +#define MBC_TXBD_I 0x1000 /* interrupt on transmit */ +#define MBC_TXBD_W 0x2000 /* last BD in ring */ +#define MBC_TXBD_PAD 0x4000 /* auto pad short frames */ +#define MBC_TXBD_R 0x8000 /* buffer is ready */ +#define MBC_TXBD_ERRS (MBC_TXBD_DEF | MBC_TXBD_HB | \ + MBC_TXBD_LC | MBC_TXBD_RL | \ + MBC_TXBD_UN | MBC_TXBD_CSL) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmbcEndh */ diff --git a/h/drv/end/motCpmEnd.h b/h/drv/end/motCpmEnd.h new file mode 100644 index 0000000..7d5683c --- /dev/null +++ b/h/drv/end/motCpmEnd.h @@ -0,0 +1,342 @@ +/* motCpmEnd.h - Motorola CPM core Ethernet interface header */ + +/* Copyright 1996 - 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,12nov04,dtr Use PPC32 and CPU32 types instead of PPC860. +01g,24jan02,rcs removed #include "drv/netif/if_cpm.h" +01f,24jan02,rcs moved General SCC Mode Register definitions, + SCC Ethernet Protocol Specific Mode Register definitions, + SCC Ethernet Event and Mask Register definitions, + SCC Ethernet Receive Buffer Descriptor definitions, + SCC Ethernet Transmit Buffer Descriptor definitions, + SCC Serial Comunications Controller, + SCC device descriptor, and + #include "drv/multi/ppc860Cpm.h" from h/drv/netif/if_cpm.h +01e,08jan02,mil Backed out last update "Remove compilation warning". +01d,22dec01,g_h Remove compilation warning +01c,28aug98,dat changed all motCmp names to motCpm. +01b,29jun98,cn fixed compiler errors for CPUs other than CPU32 or PPC860. +01a,22jun98,cn created. +*/ + +/* +This file contains definitions to support the end-style Network Driver +for the Motorola CPM core Ethernet controller used in the M68EN360 and +PPC800-series communications controllers. These definitions are compiler +dependant, meaning that their values are based on the particular cpu +being used. +*/ + +#ifndef __INCmotCpmEndh +#define __INCmotCpmEndh + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((CPU == PPC32) || (CPU == PPC860)) +#include "drv/multi/ppc860Cpm.h" +#include "drv/multi/ppc860Siu.h" +#else +#include "drv/multi/m68360.h" /* default: use CPU32 include file */ +#endif /* CPU == PPC32 */ + +/* defines */ + +/* + * the following may be redefined in the bsp to account for the actual + * number of SCC devices in the system. + */ + +#ifndef MAX_SCC_CHANNELS +#define MAX_SCC_CHANNELS 4 /* max SCC number for Ethernet channels */ +#endif /* MAX_SCC_CHANNELS */ + +#if ((CPU == PPC32) || (CPU == PPC860)) + +#define CPM_DPR_SCC1(baseAddr) MPC860_DPR_SCC1 (baseAddr) +#define CPM_GSMR_L1(baseAddr) GSMR_L1 (baseAddr) +#define CPM_CIMR_SCC4 CIMR_SCC4 +#define CPM_CIMR(baseAddr) CIMR (baseAddr) +#define CPM_CISR(baseAddr) CISR (baseAddr) +#define CPM_CPCR(baseAddr) CPCR (baseAddr) +#define END_OBJ_STRING "MPC860 Power-QUICC Enhanced Network Driver" +#define MOT_DEV_NAME "cpm" +#define MOT_DEV_NAME_LEN 4 + +/* General SCC Mode Register definitions */ + +#define SCC_GSMRL_HDLC 0x00000000 /* HDLC mode */ +#define SCC_GSMRL_APPLETALK 0x00000002 /* AppleTalk mode (LocalTalk) */ +#define SCC_GSMRL_SS7 0x00000003 /* SS7 mode (microcode) */ +#define SCC_GSMRL_UART 0x00000004 /* UART mode */ +#define SCC_GSMRL_PROFI_BUS 0x00000005 /* Profi-Bus mode (microcode) */ +#define SCC_GSMRL_ASYNC_HDLC 0x00000006 /* async HDLC mode (microcode)*/ +#define SCC_GSMRL_V14 0x00000007 /* V.14 mode */ +#define SCC_GSMRL_BISYNC 0x00000008 /* BISYNC mode */ +#define SCC_GSMRL_DDCMP 0x00000009 /* DDCMP mode (microcode) */ +#define SCC_GSMRL_ETHERNET 0x0000000c /* ethernet mode (SCC1 only) */ +#define SCC_GSMRL_ENT 0x00000010 /* enable transmitter */ +#define SCC_GSMRL_ENR 0x00000020 /* enable receiver */ +#define SCC_GSMRL_LOOPBACK 0x00000040 /* local loopback mode */ +#define SCC_GSMRL_ECHO 0x00000080 /* automatic echo mode */ +#define SCC_GSMRL_TENC 0x00000700 /* transmitter encoding method*/ +#define SCC_GSMRL_RENC 0x00003800 /* receiver encoding method */ +#define SCC_GSMRL_RDCR_X8 0x00004000 /* receive DPLL clock x8 */ +#define SCC_GSMRL_RDCR_X16 0x00008000 /* receive DPLL clock x16 */ +#define SCC_GSMRL_RDCR_X32 0x0000c000 /* receive DPLL clock x32 */ +#define SCC_GSMRL_TDCR_X8 0x00010000 /* transmit DPLL clock x8 */ +#define SCC_GSMRL_TDCR_X16 0x00020000 /* transmit DPLL clock x16 */ +#define SCC_GSMRL_TDCR_X32 0x00030000 /* transmit DPLL clock x32 */ +#define SCC_GSMRL_TEND 0x00040000 /* transmitter frame ending */ +#define SCC_GSMRL_TPP_00 0x00180000 /* Tx preamble pattern = 00 */ +#define SCC_GSMRL_TPP_10 0x00080000 /* Tx preamble pattern = 10 */ +#define SCC_GSMRL_TPP_01 0x00100000 /* Tx preamble pattern = 01 */ +#define SCC_GSMRL_TPP_11 0x00180000 /* Tx preamble pattern = 11 */ +#define SCC_GSMRL_TPL_NONE 0x00000000 /* no Tx preamble (default) */ +#define SCC_GSMRL_TPL_8 0x00200000 /* Tx preamble = 1 byte */ +#define SCC_GSMRL_TPL_16 0x00400000 /* Tx preamble = 2 bytes */ +#define SCC_GSMRL_TPL_32 0x00600000 /* Tx preamble = 4 bytes */ +#define SCC_GSMRL_TPL_48 0x00800000 /* Tx preamble = 6 bytes */ +#define SCC_GSMRL_TPL_64 0x00a00000 /* Tx preamble = 8 bytes */ +#define SCC_GSMRL_TPL_128 0x00c00000 /* Tx preamble = 16 bytes */ +#define SCC_GSMRL_TINV 0x01000000 /* DPLL transmit input invert */ +#define SCC_GSMRL_RINV 0x02000000 /* DPLL receive input invert */ +#define SCC_GSMRL_TSNC 0x0c000000 /* transmit sense */ +#define SCC_GSMRL_TCI 0x10000000 /* transmit clock invert */ +#define SCC_GSMRL_EDGE 0x60000000 /* adjustment edge +/- */ + +#define SCC_GSMRH_RSYN 0x00000001 /* receive sync timing*/ +#define SCC_GSMRH_RTSM 0x00000002 /* RTS* mode */ +#define SCC_GSMRH_SYNL 0x0000000c /* sync length */ +#define SCC_GSMRH_TXSY 0x00000010 /* transmitter/receiver sync */ +#define SCC_GSMRH_RFW 0x00000020 /* Rx FIFO width */ +#define SCC_GSMRH_TFL 0x00000040 /* transmit FIFO length */ +#define SCC_GSMRH_CTSS 0x00000080 /* CTS* sampling */ +#define SCC_GSMRH_CDS 0x00000100 /* CD* sampling */ +#define SCC_GSMRH_CTSP 0x00000200 /* CTS* pulse */ +#define SCC_GSMRH_CDP 0x00000400 /* CD* pulse */ +#define SCC_GSMRH_TTX 0x00000800 /* transparent transmitter */ +#define SCC_GSMRH_TRX 0x00001000 /* transparent receiver */ +#define SCC_GSMRH_REVD 0x00002000 /* reverse data */ +#define SCC_GSMRH_TCRC 0x0000c000 /* transparent CRC */ +#define SCC_GSMRH_GDE 0x00010000 /* glitch detect enable */ + +/* CPM - Communication Processor Module */ + +/* SCC Ethernet Protocol Specific Mode Register definitions */ + +#define SCC_ETHER_PSMR_NIB_13 0x0000 /* SFD 13 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_14 0x0002 /* SFD 14 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_15 0x0004 /* SFD 15 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_16 0x0006 /* SFD 16 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_21 0x0008 /* SFD 21 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_22 0x000a /* SFD 22 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_23 0x000c /* SFD 23 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_24 0x000e /* SFD 24 bits after TENA */ +#define SCC_ETHER_PSMR_LCW 0x0100 /* late collision window */ +#define SCC_ETHER_PSMR_SIP 0x0200 /* sample input pins */ +#define SCC_ETHER_PSMR_LPB 0x0400 /* loopback operation */ +#define SCC_ETHER_PSMR_SBT 0x0800 /* stop backoff timer */ +#define SCC_ETHER_PSMR_BRO 0x0100 /* broadcast address */ +#define SCC_ETHER_PSMR_PRO 0x0200 /* promiscuous mode */ +#define SCC_ETHER_PSMR_CRC 0x0800 /* CRC selection */ +#define SCC_ETHER_PSMR_IAM 0x1000 /* individual address mode */ +#define SCC_ETHER_PSMR_RSH 0x2000 /* receive short frame */ +#define SCC_ETHER_PSMR_FC 0x4000 /* force collision */ +#define SCC_ETHER_PSMR_HBC 0x8000 /* heartbeat checking*/ + +/* SCC Ethernet Event and Mask Register definitions */ + +#define SCC_ETHER_SCCX_RXB 0x0001 /* buffer received event */ +#define SCC_ETHER_SCCX_TXB 0x0002 /* buffer transmitted event */ +#define SCC_ETHER_SCCX_BSY 0x0004 /* busy condition */ +#define SCC_ETHER_SCCX_RXF 0x0008 /* frame received event */ +#define SCC_ETHER_SCCX_TXE 0x0010 /* transmission error event */ +#define SCC_ETHER_SCCX_GRA 0x0080 /* graceful stop event */ + +/* SCC Ethernet Receive Buffer Descriptor definitions */ + +#define SCC_ETHER_RX_BD_CL 0x0001 /* collision condition */ +#define SCC_ETHER_RX_BD_OV 0x0002 /* overrun condition */ +#define SCC_ETHER_RX_BD_CR 0x0004 /* Rx CRC error */ +#define SCC_ETHER_RX_BD_SH 0x0008 /* short frame received */ +#define SCC_ETHER_RX_BD_NO 0x0010 /* Rx nonoctet aligned frame */ +#define SCC_ETHER_RX_BD_LG 0x0020 /* Rx frame length violation */ +#define SCC_ETHER_RX_BD_M 0x0100 /* miss bit for prom mode */ +#define SCC_ETHER_RX_BD_F 0x0400 /* buffer is first in frame */ +#define SCC_ETHER_RX_BD_L 0x0800 /* buffer is last in frame */ +#define SCC_ETHER_RX_BD_I 0x1000 /* interrupt on receive */ +#define SCC_ETHER_RX_BD_W 0x2000 /* last BD in ring */ +#define SCC_ETHER_RX_BD_E 0x8000 /* buffer is empty */ + +/* SCC Ethernet Transmit Buffer Descriptor definitions */ + +#define SCC_ETHER_TX_BD_CSL 0x0001 /* carrier sense lost */ +#define SCC_ETHER_TX_BD_UN 0x0002 /* underrun */ +#define SCC_ETHER_TX_BD_RC 0x003c /* retry count */ +#define SCC_ETHER_TX_BD_RL 0x0040 /* retransmission limit */ +#define SCC_ETHER_TX_BD_LC 0x0080 /* late collision */ +#define SCC_ETHER_TX_BD_HB 0x0100 /* heartbeat */ +#define SCC_ETHER_TX_BD_DEF 0x0200 /* defer indication */ +#define SCC_ETHER_TX_BD_TC 0x0400 /* auto transmit CRC */ +#define SCC_ETHER_TX_BD_L 0x0800 /* buffer is last in frame */ +#define SCC_ETHER_TX_BD_I 0x1000 /* interrupt on transmit */ +#define SCC_ETHER_TX_BD_W 0x2000 /* last BD in ring */ +#define SCC_ETHER_TX_BD_PAD 0x4000 /* auto pad short frames */ +#define SCC_ETHER_TX_BD_R 0x8000 /* buffer is ready */ + +/* typedefs */ + +/* SCC - Serial Comunications Controller */ + +typedef struct /* SCC_ETHER_PROTO */ + { + UINT32 c_pres; /* preset CRC */ + UINT32 c_mask; /* constant mask for CRC */ + volatile UINT32 crcec; /* CRC error counter */ + volatile UINT32 alec; /* alignment error counter */ + volatile UINT32 disfc; /* discard frame counter */ + UINT16 pads; /* short frame pad value */ + UINT16 ret_lim; /* retry limit threshold */ + volatile UINT16 ret_cnt; /* retry limit counter */ + UINT16 mflr; /* maximum frame length register */ + UINT16 minflr; /* minimum frame length register */ + UINT16 maxd1; /* max DMA1 length register */ + UINT16 maxd2; /* max DMA2 length register */ + volatile UINT16 maxd; /* Rx max DMA */ + volatile UINT16 dma_cnt; /* Rx DMA counter */ + volatile UINT16 max_b; /* max BD byte count */ + UINT16 gaddr1; /* group address filter 1 */ + UINT16 gaddr2; /* group address filter 2 */ + UINT16 gaddr3; /* group address filter 3 */ + UINT16 gaddr4; /* group address filter 4 */ + volatile UINT32 tbuf0_data0; /* save area 0 - current frame */ + volatile UINT32 tbuf0_data1; /* save area 1 - current frame */ + volatile UINT32 tbuf0_rba0; /* ? */ + volatile UINT32 tbuf0_crc; /* ? */ + volatile UINT16 tbuf0_bcnt; /* ? */ + UINT16 paddr1_h; /* physical address 1 (MSB) */ + UINT16 paddr1_m; /* physical address 1 */ + UINT16 paddr1_l; /* physical address 1 (LSB) */ + UINT16 p_per; /* persistence */ + volatile UINT16 rfbd_ptr; /* Rx first BD pointer */ + volatile UINT16 tfbd_ptr; /* Tx first BD pointer */ + volatile UINT16 tlbd_ptr; /* Tx last BD pointer */ + volatile UINT32 tbuf1_data0; /* save area 0 - next frame */ + volatile UINT32 tbuf1_data1; /* ? */ + volatile UINT32 tbuf1_rba0; /* ? */ + volatile UINT32 tbuf1_crc; /* ? */ + volatile UINT16 tbuf1_bcnt; /* ? */ + volatile UINT16 tx_len; /* Tx frame length counter */ + UINT16 iaddr1; /* individual address filter 1 */ + UINT16 iaddr2; /* individual address filter 2 */ + UINT16 iaddr3; /* individual address filter 3 */ + UINT16 iaddr4; /* individual address filter 4 */ + volatile UINT16 boff_cnt; /* backoff counter */ + UINT16 taddr_h; /* temp address (MSB) */ + UINT16 taddr_m; /* temp address */ + UINT16 taddr_l; /* temp address (LSB) */ + } SCC_ETHER_PROTO; + +/* SCC device descriptor */ + +typedef struct /* SCC_ETHER_DEV */ + { + int sccNum; /* number of SCC device */ + int txBdNum; /* number of transmit buf descriptors */ + int rxBdNum; /* number of receive buf descriptors */ + SCC_BUF * txBdBase; /* transmit BD base address */ + SCC_BUF * rxBdBase; /* receive BD base address */ + u_char * txBufBase; /* transmit buffer base address */ + u_char * rxBufBase; /* receive buffer base address */ + UINT32 txBufSize; /* transmit buffer size */ + UINT32 rxBufSize; /* receive buffer size */ + int txBdNext; /* next transmit BD to fill */ + int rxBdNext; /* next receive BD to read */ + volatile SCC * pScc; /* SCC parameter RAM */ + volatile SCC_REG * pSccReg; /* SCC registers */ + UINT32 intMask; /* interrupt acknowledge mask */ + } SCC_ETHER_DEV; + +#else /* default: use CPU32 definitions */ + +#define SCC_ETHER_DEV SCC_DEV +#define CPM_DPR_SCC1(baseAddr) M360_DPR_SCC1 (baseAddr) +#define CPM_GSMR_L1(baseAddr) M360_CPM_GSMR_L1 (baseAddr) +#define CPM_CIMR_SCC4 CPIC_CIXR_SCC4 +#define CPM_CIMR(baseAddr) M360_CPM_CIMR (baseAddr) +#define CPM_CISR(baseAddr) M360_CPM_CISR (baseAddr) +#define CPM_CPCR(baseAddr) M360_CPM_CR (baseAddr) +#define END_OBJ_STRING "MC68EN360 QUICC Enhanced Network Driver" +#define MOT_DEV_NAME "qu" +#define MOT_DEV_NAME_LEN 3 + +#endif /* CPU == PPC32 || PPC860 */ + +/* bsp-specific routine to include */ + +#if ((CPU == PPC32)|| (CPU == PPC860)) + +#define SYS_ENET_ADDR_GET(address) \ +if (sysCpmEnetAddrGet != NULL) \ + if (sysCpmEnetAddrGet (pDrvCtrl->unit, (address)) == ERROR) \ + { \ + errnoSet (S_iosLib_INVALID_ETHERNET_ADDRESS); \ + return (NULL); \ + } + +#define SYS_ENET_ENABLE \ +if (sysCpmEnetEnable != NULL) \ + if (sysCpmEnetEnable (pDrvCtrl->unit) == ERROR) \ + return (ERROR); + +#define SYS_ENET_DISABLE \ +if (sysCpmEnetDisable != NULL) \ + sysCpmEnetDisable (pDrvCtrl->unit); + +#else /* default: use CPU32 definitions */ + +#define SYS_ENET_ADDR_GET(address) \ +if (sys360EnetAddrGet != NULL) \ + if (sys360EnetAddrGet (pDrvCtrl->unit, (address)) == ERROR) \ + { \ + errnoSet (S_iosLib_INVALID_ETHERNET_ADDRESS); \ + return (NULL); \ + } + +#define SYS_ENET_ENABLE \ +if (sys360EnetEnable != NULL) \ + if (sys360EnetEnable (pDrvCtrl->unit, pDrvCtrl->regBase) == ERROR) \ + return (ERROR); + +#define SYS_ENET_DISABLE \ +if (sys360EnetDisable != NULL) \ + sys360EnetDisable (pDrvCtrl->unit, pDrvCtrl->regBase); + +#endif /* CPU == PPC32 | PPC860*/ + +/* globals */ + +#if ((CPU == PPC32) || (CPU == PPC860)) + +IMPORT STATUS sysCpmEnetEnable (int unit); /* enable ctrl */ +IMPORT void sysCpmEnetDisable (int unit); /* disable ctrl */ +IMPORT STATUS sysCpmEnetAddrGet (int unit, u_char * addr); /* get enet addr */ + +#else /* default: use CPU32 prototypes */ + +IMPORT STATUS sys360EnetEnable (int unit, UINT32 regBase); /* enable ctrl */ +IMPORT void sys360EnetDisable (int unit, UINT32 regBase); /* disable ctrl */ +IMPORT STATUS sys360EnetAddrGet (int unit, u_char * addr); /* get enet addr */ + +#endif /* CPU == PPC32 || PPC860 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmotCpmEndh */ diff --git a/h/drv/end/motFcc2End.h b/h/drv/end/motFcc2End.h new file mode 100644 index 0000000..a38282b --- /dev/null +++ b/h/drv/end/motFcc2End.h @@ -0,0 +1,645 @@ +/* MotFcc2End.h - Second Generation Motorola FCC Ethernet network interface.*/ + +/* + * Copyright (c) 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01j,19mar05,dlk Enhancements. Combine buffer descriptor status and length + fields. +01j,19aug04,mdo Clean up unused variables. +01h,23jul04,mdo Base 6 Enhancements +01g,15jun04,mdo Fix compiler warning with gnu compiler. +01f,04jun04,mil Changed cacheArchXXX funcs to cacheXXX funcs. +01e,30mar04,mdo SPR's 81336, 93209, 94561, 94562 and general cleanup. +01d,12jan04,dat lint removal +01c,05dec03,rcs fixed warnings for base6 +01b,13aug03,gjc Fixed SPRs #89689,#89649,#87812,#87749,90135,#86434 +01a,16jan03,gjc SPR#85164 :Second Generation Motorola FCC END header. +*/ + +#ifndef __INCmotFcc2Endh +#define __INCmotFcc2Endh + +/* includes */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "etherLib.h" +#include "miiLib.h" + +/* defines */ +/* + * redefine the macro below in the bsp if you need to access the device + * registers/descriptors in a more suitable way. + */ +#ifndef MOT_FCC_LONG_WR +#define MOT_FCC_LONG_WR(addr, value) \ + (* ((UINT32 *) addr) = ((UINT32) (value))) +#endif /* MOT_FCC_LONG_WR */ + +#ifndef MOT_FCC_WORD_WR +#define MOT_FCC_WORD_WR(addr, value) \ + (* (addr) = ((UINT16) (value))) +#endif /* MOT_FCC_WORD_WR */ + +#ifndef MOT_FCC_BYTE_WR +#define MOT_FCC_BYTE_WR(addr, value) \ + (* (addr) = ((UINT8) (value))) +#endif /* MOT_FCC_BYTE_WR */ + +#ifndef MOT_FCC_LONG_RD +#define MOT_FCC_LONG_RD(addr, value) \ + ((value) = (* (UINT32 *) (addr))) +#endif /* MOT_FCC_LONG_RD */ + +#ifndef MOT_FCC_WORD_RD +#define MOT_FCC_WORD_RD(addr, value) \ + ((value) = (* (UINT16 *) (addr))) +#endif /* MOT_FCC_WORD_RD */ + +#ifndef MOT_FCC_BYTE_RD +#define MOT_FCC_BYTE_RD(addr, value) \ + ((value) = (* (UINT8 *) (addr))) +#endif /* MOT_FCC_BYTE_RD */ + +/* + * Default macro definitions for BSP interface. + * These macros can be redefined in a wrapper file, to generate + * a new module with an optimized interface. + */ + +#define MOT_FCC_INUM(pDrvCtrl) \ + ((int) INUM_FCC1 + ((pDrvCtrl)->fccNum - 1)) + +#define MOT_FCC_IVEC(pDrvCtrl) \ + INUM_TO_IVEC (MOT_FCC_INUM (pDrvCtrl)) + +#ifndef SYS_FCC_INT_CONNECT +#define SYS_FCC_INT_CONNECT(pDrvCtrl, pFunc, arg, ret) \ + do { \ + IMPORT STATUS intConnect (VOIDFUNCPTR *, VOIDFUNCPTR, int); \ + pDrvCtrl->intrConnect = TRUE; \ + ret = (intConnect) ((VOIDFUNCPTR*) MOT_FCC_IVEC (pDrvCtrl), \ + (pFunc), (int) (arg)); \ + } while (FALSE) +#endif /* SYS_FCC_INT_CONNECT */ + +#ifndef SYS_FCC_INT_DISCONNECT +#define SYS_FCC_INT_DISCONNECT(pDrvCtrl, pFunc, arg, ret) \ + do { \ + ret = OK; \ + if (MOT_FCC_IVEC (pDrvCtrl) && (pDrvCtrl->intDiscFunc != NULL)) \ + { \ + pDrvCtrl->intrConnect = FALSE; \ + ret = (*pDrvCtrl->intDiscFunc) \ + ((VOIDFUNCPTR*) MOT_FCC_IVEC (pDrvCtrl), \ + (pFunc)); \ + } \ + } while (FALSE) +#endif /* SYS_FCC_INT_DISCONNECT */ + +#ifndef SYS_FCC_INT_ENABLE +#define SYS_FCC_INT_ENABLE(pDrvCtrl, ret) \ +{ \ +IMPORT int intEnable (int); \ +ret = OK; \ + \ +if (MOT_FCC_INUM (pDrvCtrl)) \ + ret = intEnable ((int) (MOT_FCC_INUM (pDrvCtrl))); \ +} +#endif /* SYS_FCC_INT_ENABLE */ + +#ifndef SYS_FCC_INT_DISABLE +#define SYS_FCC_INT_DISABLE(pDrvCtrl, ret) \ +{ \ +IMPORT int intDisable (int); \ +ret = OK; \ + \ +if (MOT_FCC_INUM (pDrvCtrl)) \ + ret = intDisable ((int) (MOT_FCC_INUM (pDrvCtrl))); \ +} +#endif /* SYS_FCC_INT_DISABLE */ + +#ifndef SYS_FCC_INT_ACK +#define SYS_FCC_INT_ACK(pDrvCtrl, ret) \ +{ \ +ret = OK; \ +} +#endif /* SYS_FCC_INT_ACK */ + +#define SYS_FCC_ENET_ADDR_GET(address) \ +if (sysFccEnetAddrGet != NULL) \ + if (sysFccEnetAddrGet (pDrvCtrl->unit, (address)) == ERROR) \ + { \ + errnoSet (S_iosLib_INVALID_ETHERNET_ADDRESS); \ + return (NULL); \ + } + +#define SYS_FCC_ENET_ENABLE \ +if (sysFccEnetEnable != NULL) \ + if (sysFccEnetEnable (pDrvCtrl->immrVal, pDrvCtrl->fccNum) \ + == ERROR) \ + return (ERROR); + +#define SYS_FCC_ENET_DISABLE \ +if (sysFccEnetDisable != NULL) \ + if (sysFccEnetDisable (pDrvCtrl->immrVal, pDrvCtrl->fccNum) \ + == ERROR) \ + return (ERROR); + +#define SYS_FCC_MII_BIT_RD(bit) \ +if (sysFccMiiBitRd != NULL) \ + if (sysFccMiiBitRd (pDrvCtrl->immrVal, pDrvCtrl->fccNum, (bit)) \ + == ERROR) \ + return (ERROR); + +#define SYS_FCC_MII_BIT_WR(bit) \ +if (sysFccMiiBitWr != NULL) \ + if (sysFccMiiBitWr (pDrvCtrl->immrVal, pDrvCtrl->fccNum, (bit)) \ + == ERROR) \ + return (ERROR); + +#define MOT_FCC_MII_WR(data, len) \ + { \ + UINT8 i = len; \ + \ + while (i--) \ + SYS_FCC_MII_BIT_WR (((data) >> i) & 0x1); \ + } + +#define MOT_FCC_MII_RD(data, len) \ + { \ + UINT8 i = len; \ + INT8 bitVal = 0; \ + \ + while (i--) \ + { \ + (data) <<= 1; \ + SYS_FCC_MII_BIT_RD (&bitVal); \ + (data) |= bitVal & 0x1; \ + } \ + } + + +/* driver flags */ + +#define MOT_FCC_OWN_BUF_MEM 0x01 /* internally provided memory for data*/ +#define MOT_FCC_INV_TBD_NUM 0x02 /* invalid tbdNum provided */ +#define MOT_FCC_INV_RBD_NUM 0x04 /* invalid rbdNum provided */ +#define MOT_FCC_POLLING 0x08 /* polling mode */ +#define MOT_FCC_PROM 0x20 /* promiscuous mode */ +#define MOT_FCC_MCAST 0x40 /* multicast addressing mode */ +#define MOT_FCC_FD 0x80 /* full duplex mode */ +#define MOT_FCC_OWN_BD_MEM 0x10 /* internally provided memory for BDs */ + +#define MOT_FCC_LOOP_NS 10 + +#define MOT_FCC_DEV_NAME "motfcc" +#define MOT_FCC_DEV_NAME_LEN 7 +#define MOT_FCC_MAX_DEVS 2 +#define MOT_FCC_TBD_DEF_NUM 64 /* default number of TBDs */ +#define MOT_FCC_RBD_DEF_NUM 32 /* default number of RBDs */ +#define MOT_FCC_TX_CL_NUM 128 /* number of tx clusters */ +#define MOT_FCC_TX_POLL_NUM 1 /* one TBD for poll operation */ +#define MOT_FCC_TBD_MAX 128 /* max number of TBDs */ +#define MOT_FCC_RBD_MAX 128 /* max number of RBDs */ +#define MOT_FCC_WAIT_MAX 0xf0000000 /* max delay after sending */ +#define MOT_FCC_MIN_TX_PKT_SZ 100 /* the smallest packet we send */ + +#define MOT_FCC_ADDR_LEN 6 /* ethernet address length */ +#define MOT_FCC_FCR_DEF_VAL M8260_FCR_BO_BE /* def value for the FCR */ +#define MOT_FCC_C_MASK_VAL 0xdebb20e3 /* recommended value */ +#define MOT_FCC_C_PRES_VAL 0xffffffff /* recommended value */ +#define MOT_FCC_CLEAR_VAL 0x00000000 /* clear this field */ +#define MOT_FCC_RET_LIM_VAL 0xf /* recommended value */ +#define MOT_FCC_MINFLR_VAL 0x40 /* recommended value */ +#define MOT_FCC_PAD_VAL MOT_FCC_TIPTR_VAL /* padding value */ +#define MOT_FCC_MAXD_VAL 1524 /* recommended value used to be 1520*/ +#define MOT_FCC_DSR_VAL 0xD555 /* recommended value */ +#define MOT_FCC_FCCE_VAL 0xffff /* clear all events */ + +/* rx/tx buffer descriptors definitions */ + +#define MOT_FCC_RBD_SZ 8 /* RBD size in byte */ +#define MOT_FCC_TBD_SZ 8 /* TBD size in byte */ +#define MOT_FCC_TBD_MIN 16 /* min number of TBDs */ +#define MOT_FCC_RBD_MIN 16 /* min number of RBDs */ +#define CL_OVERHEAD 4 /* prepended cluster overhead */ +#define CL_ALIGNMENT 0x20 /* cluster required alignment */ +#define MBLK_ALIGNMENT 4 /* mBlks required alignment */ +#define MOT_FCC_BD_ALIGN 0x8 /* required alignment for BDs */ +#define MOT_FCC_BUF_ALIGN 0x20 /* required alignment for data buffer */ +#define MOT_FCC_BD_STAT_OFF 0 /* offset of the status word */ +#define MOT_FCC_BD_LEN_OFF 2 /* offset of the data length=word */ +#define MOT_FCC_BD_ADDR_OFF 4 /* offset of the data pointer=word */ + +#define MOT_FCC_RBD_ERR (M8260_FETH_RBD_LG | \ + M8260_FETH_RBD_NO | \ + M8260_FETH_RBD_SH | \ + M8260_FETH_RBD_CR | \ + M8260_FETH_RBD_CL | \ + M8260_FETH_RBD_OV) + +/* allowed PHY's speeds */ + +#define MOT_FCC_100MBS 100000000 /* bits per sec */ +#define MOT_FCC_10MBS 10000000 /* bits per sec */ + +/* + * user flags: full duplex mode, loopback mode, serial interface etc. + * the user may configure some of this options according to his needs + * by setting the related bits in the field of the load string. + */ + +#define MOT_FCC_USR_PHY_NO_AN 0x00000001 /* do not auto-negotiate */ +#define MOT_FCC_USR_PHY_TBL 0x00000002 /* use negotiation table */ +#define MOT_FCC_USR_PHY_NO_FD 0x00000004 /* do not use full duplex */ +#define MOT_FCC_USR_PHY_NO_100 0x00000008 /* do not use 100Mbit speed */ +#define MOT_FCC_USR_PHY_NO_HD 0x00000010 /* do not use half duplex */ +#define MOT_FCC_USR_PHY_NO_10 0x00000020 /* do not use 10Mbit speed */ +#define MOT_FCC_USR_PHY_MON 0x00000040 /* use PHY Monitor */ +#define MOT_FCC_USR_PHY_ISO 0x00000100 /* isolate a PHY */ +#define MOT_FCC_USR_RMON 0x00000200 /* enable RMON support */ +#define MOT_FCC_USR_LOOP 0x00000400 /* external loopback mode */ + /* only use it for testing */ +#define MOT_FCC_USR_HBC 0x00000800 /* perform heartbeat control */ +#define MOT_FCC_USR_BUF_LBUS 0x00001000 /* buffers are on the local bus */ +#define MOT_FCC_USR_BD_LBUS 0x00002000 /* BDs are on the local bus */ +#define MOT_FCC_USR_NO_ZCOPY 0x00004000 /* inhibit zcopy mode */ + +/* required if bufs are on local bus, optional otherwise */ +#define MOT_FCC_USR_DPRAM_ALOC 0x00008000 /* Using DPRAM auto allocation */ +/* allow snooping of memory operations */ +#define MOT_FCC_USR_SNOOP_ENABLE 0x00010000 /* Enable snooping from FCC */ + +#define MOT_FCC_TBD_OK 0x1 /* the TBD is a good one */ +#define MOT_FCC_TBD_BUSY 0x2 /* the TBD has not been used */ +#define MOT_FCC_TBD_ERROR 0x4 /* the TBD has errors */ + +/* Driver State Variable */ +#define MOT_FCC_STATE_INIT 0x00 +#define MOT_FCC_STATE_NOT_LOADED 0x00 +#define MOT_FCC_STATE_LOADED 0x01 +#define MOT_FCC_STATE_NOT_RUNNING 0x00 +#define MOT_FCC_STATE_RUNNING 0x02 + +/* frame descriptors definitions (DEPRECATED) */ + +typedef char * MOT_FCC_BD_ID; +typedef MOT_FCC_BD_ID MOT_FCC_TBD_ID; +typedef MOT_FCC_BD_ID MOT_FCC_RBD_ID; + +/* + * this table may be customized by the user in configNet.h + */ + +IMPORT INT16 motFccPhyAnOrderTbl []; + +typedef struct { + UINT32 numInts; + UINT32 numZcopySends; + UINT32 numNonZcopySends; + UINT32 numTXBInts; + UINT32 numBSYInts; + UINT32 numRXFInts; + UINT32 numRXBInts; + UINT32 numRXCInts; + UINT32 numTXCInts; + UINT32 numTXEInts; + UINT32 numOTHERInts; + + UINT32 numRXFHandlerEntries; + UINT32 numRXFHandlerErrQuits; + UINT32 numRXFHandlerFramesProcessed; + UINT32 numRXFHandlerFramesRejected; + UINT32 numRXFHandlerNetBufAllocErrors; + UINT32 numRXFHandlerNetCblkAllocErrors; + UINT32 numRXFHandlerNetMblkAllocErrors; + UINT32 numRXFHandlerFramesCollisions; + UINT32 numRXFHandlerFramesCrcErrors; + UINT32 numRXFHandlerFramesLong; + UINT32 numRXFExceedBurstLimit; + + UINT32 numNetJobAddErrors; + + UINT32 numRxStallsEntered; + UINT32 numRxStallsCleared; + + UINT32 numTxStallsCleared; + UINT32 numTxStallErrors; + + UINT32 numLSCHandlerEntries; + UINT32 numLSCHandlerExits; + + UINT32 motFccTxErr; + UINT32 motFccHbFailErr; + UINT32 motFccTxLcErr; + UINT32 motFccTxUrErr; + UINT32 motFccTxCslErr; + UINT32 motFccTxRlErr; + UINT32 motFccTxDefErr; + + UINT32 motFccRxLgErr; + UINT32 motFccRxNoErr; + UINT32 motFccRxCrcErr; + UINT32 motFccRxOvErr; + UINT32 motFccRxShErr; + UINT32 motFccRxLcErr; + UINT32 motFccRxMemErr; +}FCC_DRIVER_STATS; + + +/*---------------------------------------------------------------------*/ +/* F C C E T H E R N E T P A R A M E T E R S */ +/*---------------------------------------------------------------------*/ +typedef volatile unsigned long VULONG; +typedef volatile unsigned short VUSHORT; +typedef volatile unsigned char VUCHAR; + + +typedef struct { + VULONG stat_bus; /* Internal use buffer. */ + VULONG cam_ptr; /* CAM address. */ + VULONG c_mask; /* CRC constant mask*/ + VULONG c_pres; /* CRC preset */ + VULONG crcec; /* CRC error counter */ + VULONG alec; /* alignment error counter */ + VULONG disfc; /* discarded frame counter */ + VUSHORT ret_lim; /* Retry limit threshold. */ + VUSHORT ret_cnt; /* Retry limit counter. */ + VUSHORT p_per; /* persistence */ + VUSHORT boff_cnt; /* back-off counter */ + VULONG gaddr_h; /* group address filter, high */ + VULONG gaddr_l; /* group address filter, low */ + VUSHORT tfcstat; /* out of sequence Tx BD status. */ + VUSHORT tfclen; /* out of sequence Tx BD length. */ + VULONG tfcptr; /* out of sequence Tx BD data pointer. */ + VUSHORT maxflr; /* maximum frame length reg */ + VUSHORT paddr_h; /* physical address (MSB) */ + VUSHORT paddr_m; /* physical address */ + VUSHORT paddr_l; /* physical address (LSB) */ + VUSHORT ibd_cnt; /* internal BD counter. */ + VUSHORT ibd_start; /* internal BD start pointer. */ + VUSHORT ibd_end; /* internal BD end pointer. */ + VUSHORT tx_len; /* tx frame length counter */ + VUCHAR ibd_base[0x20]; /* internal micro code usage. */ + VULONG iaddr_h; /* individual address filter, high */ + VULONG iaddr_l; /* individual address filter, low */ + VUSHORT minflr; /* minimum frame length reg */ + VUSHORT taddr_h; /* temp address (MSB) */ + VUSHORT taddr_m; /* temp address */ + VUSHORT taddr_l; /* temp address (LSB) */ + VUSHORT pad_ptr; /* pad_ptr. */ + VUSHORT cf_type; /* flow control frame type coding. */ + VUSHORT cf_range; /* flow control frame range. */ + VUSHORT max_b; /* max buffer descriptor byte count. */ + VUSHORT maxd1; /* max DMA1 length register. */ + VUSHORT maxd2; /* max DMA2 length register. */ + VUSHORT maxd; /* Rx max DMA. */ + VUSHORT dma_cnt; /* Rx DMA counter. */ + + + /* counter: */ + VULONG octc; /* received octets counter. */ + VULONG colc; /* estimated number of collisions */ + VULONG broc; /* received good packets of broadcast address */ + VULONG mulc; /* received good packets of multicast address */ + VULONG uspc; /* received packets shorter then 64 octets. */ + VULONG frgc; /* as uspc + bad packets */ + VULONG ospc; /* received packets longer then 1518 =octets. */ + VULONG jbrc; /* as ospc + bad packets */ + VULONG p64c; /* received packets of 64 octets.. */ + VULONG p65c; /* received packets of 65-128 octets.. */ + VULONG p128c; /* received packets of 128-255 octets.. */ + VULONG p256c; /* received packets of 256-511 octets.. */ + VULONG p512c; /* received packets of 512-1023 octets.. */ + VULONG p1024c; /* received packets of 1024-1518 octets.. */ + VULONG cam_buf; /* cam respond internal buffer. */ + VUSHORT rfthr; /* received frames threshold */ + VUSHORT rfcnt; /* received frames count */ +} _WRS_PACK_ALIGN(4) FCC_ETH_PARAM_T; + + +/*---------------------------------------------------------------------*/ +/* F C C P A R A M E T E R S */ +/*---------------------------------------------------------------------*/ + + +typedef struct { + VUSHORT riptr; /* Rx internal temporary data pointer. */ + VUSHORT tiptr; /* Tx internal temporary data pointer. */ + VUSHORT RESERVED0; /* Reserved */ + VUSHORT mrblr; /* Rx buffer length */ + VULONG rstate; /* Rx internal state */ + VULONG rbase; /* RX BD base address */ + VUSHORT rbdstat; /* Rx BD status and control */ + VUSHORT rbdlen; /* Rx BD data length */ + VULONG rdptr; /* rx BD data pointer */ + VULONG tstate; /* Tx internal state */ + VULONG tbase; /* TX BD base address */ + VUSHORT tbdstat; /* Tx BD status and control */ + VUSHORT tbdlen; /* Tx BD data length */ + VULONG tdptr; /* Tx data pointer */ + VULONG rbptr; /* rx BD pointer */ + VULONG tbptr; /* Tx BD pointer */ + VULONG rcrc; /* Temp receive CRC */ + VULONG tcrc; /* Temp transmit CRC */ + VULONG foo; + +/*-----------------------------------------------------------------*/ +/* Protocol Specific Parameters */ +/*-----------------------------------------------------------------*/ + union { + + /* Force this union to be 256 bytes - 0x34 bytes big. + * The 0x34 is the size of the protocol independent part + * of the structure. + */ + UCHAR pads[0xc4]; + FCC_ETH_PARAM_T e; + + } prot; + +} _WRS_PACK_ALIGN(4) FCC_PARAM_T; + + +/*-----------------------------------------------------------------*/ +/* FCC registers */ +/*-----------------------------------------------------------------*/ +typedef struct { + VULONG fcc_gfmr; /* General Mode Register */ + VULONG fcc_psmr; /* Protocol Specific Mode Reg */ + VUSHORT fcc_todr; /* Transmit On Demand Reg */ + VUCHAR reserved22[0x2]; + VUSHORT fcc_dsr; /* Data Sync Register */ + VUCHAR reserved23[0x2]; + VUSHORT fcc_fcce; /* Event Register */ + VUSHORT unused1; + VUSHORT fcc_fccm; /* Mask Register */ + VUSHORT unused2; + VUCHAR fcc_fccs; /* Status Register */ + VUCHAR reserved24[0x3]; + VULONG fcc_tirr; /* Transmit Partial Rate Reg */ +} _WRS_PACK_ALIGN(4) FCC_REG_T; + +/* + * Combine the status and length fields into a single field to + * discourage multiple accesses to the uncached buffer descriptors. + */ +typedef struct _FCC_BD + { + volatile UINT32 bdStatLen; /* Status in upper 16 bits; length in lower */ + volatile UINT32 bdAddr; + } FCC_BD; + +/* + * This is the bsp boot information structure for the Mii/Phy, Dpram + * and misc functions. It contains bsp specific call backs for the driver. + * A pointer to the structure is passed in the load string. + */ + +typedef struct + { + FUNCPTR miiPhyInit; /* bsp MiiPhy init function */ + FUNCPTR miiPhyInt; /* Driver function for BSP to call */ + FUNCPTR miiPhyBitRead; /* Bit Read function */ + FUNCPTR miiPhyBitWrite; /* Bit Write function */ + FUNCPTR miiPhyDuplex; /* duplex status call back */ + FUNCPTR miiPhySpeed; /* speed status call back */ + FUNCPTR hbFail; /* heart beat fail */ + FUNCPTR intDisc; /* disconnect Function */ + FUNCPTR dpramFree; + FUNCPTR dpramFccMalloc; + FUNCPTR dpramFccFree; + FUNCPTR reserved[4]; /* future use */ + } FCC_END_FUNCS; + + +/* The definition of the driver control structure */ + +typedef struct drv_ctrl + { + END_OBJ endObj; /* base class */ +#if defined(MOT_FCC_DBG) || defined (MOT_FCC_STAT_MONITOR) + FCC_DRIVER_STATS * Stats; +#endif + int unit; /* unit number */ + FCC_REG_T * fccReg; + FCC_ETH_PARAM_T * fccEthPar; + FCC_PARAM_T * fccPar; + + UINT8 fccNum; /* FCC being used */ + UINT32 immrVal; /* internal RAM base address */ + UINT32 fifoTxBase; /* address of Tx FIFO in internal RAM */ + UINT32 fifoRxBase; /* address of Rx FIFO in internal RAM */ + char * pBufBase; /* FCC memory pool base */ + UINT32 bufSize; /* FCC memory pool size */ + char * pRawBdBase; /* FCC BDs base */ + char * pBdBase; /* FCC BDs base */ + UINT32 bdSize; /* FCC BDs size */ + void * riPtr; /* save for free in unload */ + void * tiPtr; /* save for free in unload */ + void * padPtr; /* save for free in unload */ +/* receive buffer descriptor management */ + + UINT16 rbdNum; /* number of TX bd's */ + UINT16 rbdCnt; /* number of rbds full */ + FCC_BD * pRbdNext; /* RBD next to rx */ + FCC_BD * pRbdBase; /* RBD ring */ + M_BLK_ID * pMblkList; /* allocated clusters */ + + volatile BOOL rxTxHandling; /* true when motFccHandler() net job posted */ + + UINT maxRxFrames; /* max frames to Receive in one job */ + +/* transmit buffer descriptor management */ + + UINT16 tbdNum; /* total number of TX BDs */ + UINT16 tbdFree; /* number of free TX BDs */ + FCC_BD * pTbdNext; /* TBD index */ + FCC_BD * pTbdLast; /* TBD index */ + FCC_BD * pTbdBase; /* TBD ring base */ + M_BLK ** tBufList; /* allocated clusters */ + UINT16 txUnStallThresh; /* tx reclaim threshold */ + UINT32 txStallCount; /* count of transmit stalls */ + volatile BOOL txStall; /* tx handler stalled - no Tbd */ + volatile BOOL sysSuspended; /* system was suspended */ + volatile BOOL pollReceived; /* pollReceive executed */ + volatile UINT32 lastPollIndex; /* last index read in polling mode */ + UINT32 mblkMult; + UINT32 clMult; + + ULONG userFlags; /* some user flags */ + INT8 flags; /* driver state */ + UINT32 state; /* driver state including load flag */ + BOOL intrConnect; /* interrupt has been connected */ + UINT32 intMask; /* interrupt mask register */ + UINT32 fccIramAddr; /* base addr of this fcc */ + UINT32 fccPramAddr; /* parameter RAM addr of this fcc */ + UCHAR * pTxPollBuf; /* cluster pointer for poll mode */ + M_BLK_ID pTxPollMblk; + UINT32 clBlkSize; /* clusters block memory size */ + char * pMBlkArea; /* mBlock area pointer */ + UINT32 mBlkSize; /* mBlocks area memory size */ + int initType; /* netPoolInit() or netPoolCreate() */ + CACHE_FUNCS bufCacheFuncs; /* cache descriptor */ + PHY_INFO *phyInfo; /* info on a MII-compliant PHY */ + + BOOL lscHandling; + + /* function pointers to support debugging */ + FUNCPTR netJobAdd; + FUNCPTR muxTxRestart; + FUNCPTR muxError; + + /* Bsp specific functions and call backs passed in the load string */ + FCC_END_FUNCS * motFccFuncs; + + FUNCPTR hbFailFunc; + FUNCPTR intDiscFunc; /* assign a proper disc routine */ + FUNCPTR phyInitFunc; /* BSP Phy Init */ + FUNCPTR phyDuplexFunc; /* duplex function */ + FUNCPTR phySpeedFunc; /* speed function */ + + FUNCPTR dpramFreeFunc; + FUNCPTR dpramFccMallocFunc; + FUNCPTR dpramFccFreeFunc; + END_ERR lastError; /* Last error passed to muxError */ + } DRV_CTRL; + + +/* + * this cache functions descriptors is used to flush/invalidate + * the FCC's data buffers. They are set to the system's cache + * flush and invalidate routine. This will allow proper operation + * of the driver if data cache are turned on. + */ + +IMPORT STATUS cacheInvalidate (CACHE_TYPE, void *, size_t); +IMPORT STATUS cacheFlush (CACHE_TYPE, void *, size_t); + +IMPORT STATUS sysFccEnetAddrGet (int unit,UCHAR *address); +IMPORT STATUS sysFccEnetEnable (UINT32 immrVal, UINT8 fccNum); +IMPORT STATUS sysFccEnetDisable (UINT32 immrVal, UINT8 fccNum); +IMPORT STATUS sysFccMiiBitWr (UINT32 immrVal, UINT8 fccNum, + INT32 bit); +IMPORT STATUS sysFccMiiBitRd (UINT32 immrVal, UINT8 fccNum, + INT8 * bit); +IMPORT STATUS miiPhyInit (PHY_INFO * phyInfo); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmotFcc2Endh */ + diff --git a/h/drv/end/motFccEnd.h b/h/drv/end/motFccEnd.h new file mode 100644 index 0000000..4c02a6b --- /dev/null +++ b/h/drv/end/motFccEnd.h @@ -0,0 +1,631 @@ +/* motFccEnd.h - Motorola FCC Ethernet network interface header */ + +/* Copyright 1990-2002 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01f,14dec01,rcs extended DRV_CTRL and added TODO_NODE and TX_JOB_NODE + for motFccJobQueue() support. +01e,26nov01,rcs converted to motFccEnd.h +01d,17sep01,g_h fix SPR 70254 +01c,15jul99,ms_ make compliant with our coding standards +01b,17apr99,ms_ get m8260Cpm.h locally +01a,09apr99,cn written from motFecEnd.h, 01c. +*/ + +#ifndef __INCsbcMotFccEndh +#define __INCsbcMotFccEndh + +/* includes */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "etherLib.h" +#include "miiLib.h" +#include "m8260Fcc.h" +#include "lstLib.h" +#include "msgQLib.h" + +/* defines */ + +#ifndef M8260ABBREVIATIONS +#define M8260ABBREVIATIONS + +#ifdef _ASMLANGUAGE +#define CAST(x) +#else /* _ASMLANGUAGE */ +typedef volatile UCHAR VCHAR; /* shorthand for volatile UCHAR */ +typedef volatile INT32 VINT32; /* volatile unsigned word */ +typedef volatile INT16 VINT16; /* volatile unsigned halfword */ +typedef volatile INT8 VINT8; /* volatile unsigned byte */ +typedef volatile UINT32 VUINT32; /* volatile unsigned word */ +typedef volatile UINT16 VUINT16; /* volatile unsigned halfword */ +typedef volatile UINT8 VUINT8; /* volatile unsigned byte */ +#define CAST(x) (x) +#endif /* _ASMLANGUAGE */ + +#endif /* M8260ABBREVIATIONS */ + +/* + * redefine the macro below in the bsp if you need to access the device + * registers/descriptors in a more suitable way. + */ + +#ifndef MOT_FCC_LONG_WR +#define MOT_FCC_LONG_WR(addr, value) \ + (* (addr) = ((UINT32) (value))) +#endif /* MOT_FCC_LONG_WR */ + +#ifndef MOT_FCC_WORD_WR +#define MOT_FCC_WORD_WR(addr, value) \ + (* (addr) = ((UINT16) (value))) +#endif /* MOT_FCC_WORD_WR */ + +#ifndef MOT_FCC_BYTE_WR +#define MOT_FCC_BYTE_WR(addr, value) \ + (* (addr) = ((UINT8) (value))) +#endif /* MOT_FCC_BYTE_WR */ + +#ifndef MOT_FCC_LONG_RD +#define MOT_FCC_LONG_RD(addr, value) \ + ((value) = (* (UINT32 *) (addr))) +#endif /* MOT_FCC_LONG_RD */ + +#ifndef MOT_FCC_WORD_RD +#define MOT_FCC_WORD_RD(addr, value) \ + ((value) = (* (UINT16 *) (addr))) +#endif /* MOT_FCC_WORD_RD */ + +#ifndef MOT_FCC_BYTE_RD +#define MOT_FCC_BYTE_RD(addr, value) \ + ((value) = (* (UINT8 *) (addr))) +#endif /* MOT_FCC_BYTE_RD */ + +/* + * Default macro definitions for BSP interface. + * These macros can be redefined in a wrapper file, to generate + * a new module with an optimized interface. + */ + +#define MOT_FCC_INUM(pDrvCtrl) \ + ((int) INUM_FCC1 + ((pDrvCtrl)->fccNum - 1)) + +#define MOT_FCC_IVEC(pDrvCtrl) \ + INUM_TO_IVEC (MOT_FCC_INUM (pDrvCtrl)) + +#ifndef SYS_FCC_INT_CONNECT +#define SYS_FCC_INT_CONNECT(pDrvCtrl, pFunc, arg, ret) \ +{ \ +IMPORT STATUS intConnect (VOIDFUNCPTR *, VOIDFUNCPTR, int); \ +ret = OK; \ + \ + pDrvCtrl->intrConnect = TRUE; \ + ret = (intConnect) ((VOIDFUNCPTR*) MOT_FCC_IVEC (pDrvCtrl), \ + (pFunc), (int) (arg)); \ +} +#endif /* SYS_FCC_INT_CONNECT */ + +#ifndef SYS_FCC_INT_DISCONNECT +#define SYS_FCC_INT_DISCONNECT(pDrvCtrl, pFunc, arg, ret) \ +{ \ +ret = OK; \ + \ +if (MOT_FCC_IVEC (pDrvCtrl) && (_func_motFccIntDisc != NULL)) \ + { \ + pDrvCtrl->intrConnect = FALSE; \ + ret = (*_func_motFccIntDisc) ((VOIDFUNCPTR*) MOT_FCC_IVEC (pDrvCtrl), \ + (pFunc)); \ + } \ +} +#endif /* SYS_FCC_INT_DISCONNECT */ + +#ifndef SYS_FCC_INT_ENABLE +#define SYS_FCC_INT_ENABLE(pDrvCtrl, ret) \ +{ \ +IMPORT int intEnable (int); \ +ret = OK; \ + \ +if (MOT_FCC_INUM (pDrvCtrl)) \ + ret = intEnable ((int) (MOT_FCC_INUM (pDrvCtrl))); \ +} +#endif /* SYS_FCC_INT_ENABLE */ + +#ifndef SYS_FCC_INT_DISABLE +#define SYS_FCC_INT_DISABLE(pDrvCtrl, ret) \ +{ \ +IMPORT int intDisable (int); \ +ret = OK; \ + \ +if (MOT_FCC_INUM (pDrvCtrl)) \ + ret = intDisable ((int) (MOT_FCC_INUM (pDrvCtrl))); \ +} +#endif /* SYS_FCC_INT_DISABLE */ + +#ifndef SYS_FCC_INT_ACK +#define SYS_FCC_INT_ACK(pDrvCtrl, ret) \ +{ \ +ret = OK; \ +} +#endif /* SYS_FCC_INT_ACK */ + +#define SYS_FCC_ENET_ADDR_GET(address) \ +if (sysFccEnetAddrGet != NULL) \ + if (sysFccEnetAddrGet (pDrvCtrl->unit, (address)) == ERROR) \ + { \ + errnoSet (S_iosLib_INVALID_ETHERNET_ADDRESS); \ + return (NULL); \ + } + +#define SYS_FCC_ENET_ENABLE \ +if (sysFccEnetEnable != NULL) \ + if (sysFccEnetEnable (pDrvCtrl->immrVal, pDrvCtrl->fccNum) \ + == ERROR) \ + return (ERROR); + +#define SYS_FCC_ENET_DISABLE \ +if (sysFccEnetDisable != NULL) \ + if (sysFccEnetDisable (pDrvCtrl->immrVal, pDrvCtrl->fccNum) \ + == ERROR) \ + return (ERROR); + +#define SYS_FCC_MII_BIT_RD(bit) \ +if (sysFccMiiBitRd != NULL) \ + if (sysFccMiiBitRd (pDrvCtrl->immrVal, pDrvCtrl->fccNum, (bit)) \ + == ERROR) \ + return (ERROR); + +#define SYS_FCC_MII_BIT_WR(bit) \ +if (sysFccMiiBitWr != NULL) \ + if (sysFccMiiBitWr (pDrvCtrl->immrVal, pDrvCtrl->fccNum, (bit)) \ + == ERROR) \ + return (ERROR); + +#define MOT_FCC_MII_WR(data, len) \ + { \ + UINT8 i = len; \ + \ + while (i--) \ + SYS_FCC_MII_BIT_WR (((data) >> i) & 0x1); \ + } + +#define MOT_FCC_MII_RD(data, len) \ + { \ + UINT8 i = len; \ + UINT8 bitVal = 0; \ + \ + while (i--) \ + { \ + (data) <<= 1; \ + SYS_FCC_MII_BIT_RD (&bitVal); \ + (data) |= bitVal & 0x1; \ + } \ + } + +#define MOT_FCC_LOOP_NS 10 + +#define MOT_FCC_DEV_NAME "motfcc" +#define MOT_FCC_DEV_NAME_LEN 7 +#define MOT_FCC_TBD_DEF_NUM 32 /* default number of TBDs */ +#define MOT_FCC_RBD_DEF_NUM 32 /* default number of RBDs */ +#define MOT_FCC_TX_CL_NUM 64 /* number of tx clusters */ +#define MOT_FCC_BD_LOAN_NUM 32 /* loaned BDs */ +#define MOT_FCC_TX_POLL_NUM 1 /* one TBD for poll operation */ +#define MOT_FCC_TBD_MAX 128 /* max number of TBDs */ +#define MOT_FCC_RBD_MAX 128 /* max number of TBDs */ +#define MOT_FCC_WAIT_MAX 0xf0000000 /* max delay after sending */ +#define MOT_FCC_MIN_TX_PKT_SZ 100 /* the smallest packet we send */ + +#define MOT_FCC_ADDR_LEN 6 /* ethernet address length */ +#define MOT_FCC_RIPTR_VAL 0xb800 /* rx FIFO pointer value */ +#define MOT_FCC_TIPTR_VAL 0xba00 /* tx FIFO pointer value */ +#define MOT_FCC_RES_VAL 0x0000 /* reserved field value */ +#define MOT_FCC_FCR_DEF_VAL M8260_FCR_BO_BE /* def value for the FCR */ +#define MOT_FCC_C_MASK_VAL 0xdebb20e3 /* recommended value */ +#define MOT_FCC_C_PRES_VAL 0xffffffff /* recommended value */ +#define MOT_FCC_CLEAR_VAL 0x00000000 /* clear this field */ +#define MOT_FCC_RET_LIM_VAL 0xf /* recommended value */ +#define MOT_FCC_MINFLR_VAL 0x40 /* recommended value */ +#define MOT_FCC_PAD_VAL MOT_FCC_TIPTR_VAL /* padding value */ +#define MOT_FCC_MAXD_VAL 1520 /* recommended value */ +#define MOT_FCC_DSR_VAL 0xD555 /* recommended value */ +#define MOT_FCC_FCCE_VAL 0xffff /* clear all events */ + +/* rx/tx buffer descriptors definitions */ + +#define MOT_FCC_RBD_SZ 8 /* RBD size in byte */ +#define MOT_FCC_TBD_SZ 8 /* TBD size in byte */ +#define MOT_FCC_TBD_MIN 16 /* min number of TBDs */ +#define MOT_FCC_RBD_MIN 16 /* min number of RBDs */ +#define CL_OVERHEAD 4 /* prepended cluster overhead */ +#define CL_ALIGNMENT 4 /* cluster required alignment */ +#define MBLK_ALIGNMENT 4 /* mBlks required alignment */ +#define MOT_FCC_BD_ALIGN 0x8 /* required alignment for BDs */ +#define MOT_FCC_BUF_ALIGN 0x20 /* required alignment for data buffer */ + +#define MOT_FCC_RBD_ERR (M8260_FETH_RBD_LG | \ + M8260_FETH_RBD_NO | \ + M8260_FETH_RBD_SH | \ + M8260_FETH_RBD_CR | \ + M8260_FETH_RBD_CL | \ + M8260_FETH_RBD_OV) + +/* allowed PHY's speeds */ + +#define MOT_FCC_100MBS 100000000 /* bits per sec */ +#define MOT_FCC_10MBS 10000000 /* bits per sec */ + +/* + * user flags: full duplex mode, loopback mode, serial interface etc. + * the user may configure some of this options according to his needs + * by setting the related bits in the field of the load string. + */ + +#define MOT_FCC_USR_PHY_NO_AN 0x00000001 /* do not auto-negotiate */ +#define MOT_FCC_USR_PHY_TBL 0x00000002 /* use negotiation table */ +#define MOT_FCC_USR_PHY_NO_FD 0x00000004 /* do not use full duplex */ +#define MOT_FCC_USR_PHY_NO_100 0x00000008 /* do not use 100Mbit speed */ +#define MOT_FCC_USR_PHY_NO_HD 0x00000010 /* do not use half duplex */ +#define MOT_FCC_USR_PHY_NO_10 0x00000020 /* do not use 10Mbit speed */ +#define MOT_FCC_USR_PHY_ISO 0x00000100 /* isolate a PHY */ +#define MOT_FCC_USR_RMON 0x00000200 /* enable RMON support */ + +#define MOT_FCC_USR_LOOP 0x00000400 /* external loopback mode */ + /* only use it for testing */ + +#define MOT_FCC_USR_HBC 0x00000800 /* perform heartbeat control */ +#define MOT_FCC_USR_BUF_LBUS 0x00001000 /* buffers are on local bus */ +#define MOT_FCC_USR_BD_LBUS 0x00002000 /* BDs are on local bus */ + +#define MOT_FCC_USR_NO_ZCOPY 0x00004000 /* inhibit zcopy mode */ + /* required if bufs are on */ + /* local bus, optional */ + /* otherwise */ + +#define MOT_FCC_USR_DPRAM_ALOC 0x00008000 /* Using DPAM auto allocation */ +#define MOT_FCC_TBD_OK 0x1 /* the TBD is a good one */ +#define MOT_FCC_TBD_BUSY 0x2 /* the TBD has not been used */ +#define MOT_FCC_TBD_ERROR 0x4 /* the TBD is errored */ + +/* frame descriptors definitions */ + +typedef char * MOT_FCC_BD_ID; +typedef MOT_FCC_BD_ID MOT_FCC_TBD_ID; +typedef MOT_FCC_BD_ID MOT_FCC_RBD_ID; + +/* + * this table may be customized by the user in configNet.h + */ + +IMPORT INT16 motFccPhyAnOrderTbl []; + +typedef struct { + UINT32 numIsrEntries; + UINT32 numIsrExits; + + UINT32 numZcopySends; + UINT32 numNonZcopySends; + + UINT32 numTXBInts; + + UINT32 numrecoveryeasy; + + UINT32 numRXFInts; + UINT32 numRXFHandlerEntries; + UINT32 numRXFHandlerExits; + UINT32 numRXFHandlerErrQuits; + UINT32 numRXFHandlerEmptyLoopBreaks; + UINT32 numRXFHandlerFramesProcessed; + UINT32 numRXFHandlerFramesRejected; + UINT32 numRXFramesLostToBufferReuse; + + UINT32 numLSCHandlerEntries; + UINT32 numLSCHandlerExits; + + UINT32 numStallsEntered; + UINT32 numStallsCleared; + + UINT32 motFccTxErr; + UINT32 motFccHbFailErr; + UINT32 motFccTxLcErr; + UINT32 motFccTxUrErr; + UINT32 motFccTxCslErr; + UINT32 motFccTxRlErr; + + UINT32 motFccRxBsyErr; + UINT32 motFccRxLgErr; + UINT32 motFccRxNoErr; + UINT32 motFccRxCrcErr; + UINT32 motFccRxOvErr; + UINT32 motFccRxShErr; + UINT32 motFccRxLcErr; + UINT32 motFccRxMemErr; +}FCC_DRIVER_STATS; + + +/*---------------------------------------------------------------------*/ +/* F C C E T H E R N E T P A R A M E T E R S */ +/*---------------------------------------------------------------------*/ +typedef volatile unsigned long VULONG; +typedef volatile unsigned short VUSHORT; +typedef volatile unsigned char VUCHAR; + +#pragma pack(1) + +typedef struct { + VULONG stat_bus; /* Internal use buffer. */ + VULONG cam_ptr; /* CAM address. */ + VULONG c_mask; /* CRC constant mask*/ + VULONG c_pres; /* CRC preset */ + VULONG crcec; /* CRC error counter */ + VULONG alec; /* alignment error counter */ + VULONG disfc; /* discarded frame counter */ + VUSHORT ret_lim; /* Retry limit threshold. */ + VUSHORT ret_cnt; /* Retry limit counter. */ + VUSHORT p_per; /* persistence */ + VUSHORT boff_cnt; /* back-off counter */ + VULONG gaddr_h; /* group address filter, high */ + VULONG gaddr_l; /* group address filter, low */ + VUSHORT tfcstat; /* out of sequece Tx BD staus. */ + VUSHORT tfclen; /* out of sequece Tx BD length. */ + VULONG tfcptr; /* out of sequece Tx BD data pointer. */ + VUSHORT maxflr; /* maximum frame length reg */ + VUSHORT paddr_h; /* physical address (MSB) */ + VUSHORT paddr_m; /* physical address */ + VUSHORT paddr_l; /* physical address (LSB) */ + VUSHORT ibd_cnt; /* internal BD counter. */ + VUSHORT ibd_start; /* internal BD start pointer. */ + VUSHORT ibd_end; /* internal BD end pointer. */ + VUSHORT tx_len; /* tx frame length counter */ + VUCHAR ibd_base[0x20]; /* internal micro code usage. */ + VULONG iaddr_h; /* individual address filter, high */ + VULONG iaddr_l; /* individual address filter, low */ + VUSHORT minflr; /* minimum frame length reg */ + VUSHORT taddr_h; /* temp address (MSB) */ + VUSHORT taddr_m; /* temp address */ + VUSHORT taddr_l; /* temp address (LSB) */ + VUSHORT pad_ptr; /* pad_ptr. */ + VUSHORT cf_type; /* flow control frame type coding. */ + VUSHORT cf_range; /* flow control frame range. */ + VUSHORT max_b; /* max buffer descriptor byte count. */ + VUSHORT maxd1; /* max DMA1 length register. */ + VUSHORT maxd2; /* max DMA2 length register. */ + VUSHORT maxd; /* Rx max DMA. */ + VUSHORT dma_cnt; /* Rx DMA counter. */ + + /* counter: */ + VULONG octc; /* received octets counter. */ + VULONG colc; /* estimated number of collisions */ + VULONG broc; /* received good packets of broadcast address */ + VULONG mulc; /* received good packets of multicast address */ + VULONG uspc; /* received packets shorter then 64 octets. */ + VULONG frgc; /* as uspc + bad packets */ + VULONG ospc; /* received packets longer then 1518 octets. */ + VULONG jbrc; /* as ospc + bad packets */ + VULONG p64c; /* received packets of 64 octets.. */ + VULONG p65c; /* received packets of 65-128 octets.. */ + VULONG p128c; /* received packets of 128-255 octets.. */ + VULONG p256c; /* received packets of 256-511 octets.. */ + VULONG p512c; /* received packets of 512-1023 octets.. */ + VULONG p1024c; /* received packets of 1024-1518 octets.. */ + VULONG cam_buf; /* cam respond internal buffer. */ + VUSHORT rfthr; /* received frames threshold */ + VUSHORT rfcnt; /* received frames count */ +} FCC_ETH_PARAM_T; +#pragma pack() + +/*---------------------------------------------------------------------*/ +/* F C C P A R A M E T E R S */ +/*---------------------------------------------------------------------*/ +#pragma pack(1) +typedef struct { + + VUSHORT riptr; /* Rx internal temporary data pointer. */ + VUSHORT tiptr; /* Tx internal temporary data pointer. */ + VUSHORT RESERVED0; /* Reserved */ + VUSHORT mrblr; /* Rx buffer length */ + VULONG rstate; /* Rx internal state */ + VULONG rbase; /* RX BD base address */ + VUSHORT rbdstat; /* Rx BD status and control */ + VUSHORT rbdlen; /* Rx BD data length */ + VULONG rdptr; /* rx BD data pointer */ + VULONG tstate; /* Tx internal state */ + VULONG tbase; /* TX BD base address */ + VUSHORT tbdstat; /* Tx BD status and control */ + VUSHORT tbdlen; /* Tx BD data length */ + VULONG tdptr; /* Tx data pointer */ + VULONG rbptr; /* rx BD pointer */ + VULONG tbptr; /* Tx BD pointer */ + VULONG rcrc; /* Temp receive CRC */ + VULONG tcrc; /* Temp transmit CRC */ + VULONG foo; + + /*-----------------------------------------------------------------*/ + /* Protocol Specific Parameters */ + /*-----------------------------------------------------------------*/ + union { + + /* Force this union to be 256 bytes - 0x34 bytes big. + The 0x34 is the size of the protocol independent part + of the structure. + */ + UCHAR pads[0xc4]; + FCC_ETH_PARAM_T e; + + } prot; + +} FCC_PARAM_T; +#pragma pack() + + +/*-----------------------------------------------------------------*/ +/* FCC registers */ +/*-----------------------------------------------------------------*/ +#pragma pack(1) +typedef struct { + VULONG fcc_gmr; /* General Mode Register */ + VULONG fcc_psmr; /* Protocol Specific Mode Reg */ + VUSHORT fcc_todr; /* Transmit On Demand Reg */ + VUCHAR reserved22[0x2]; + VUSHORT fcc_dsr; /* Data Sync Register */ + VUCHAR reserved23[0x2]; + VUSHORT fcc_fcce; /* Event Register */ + VUSHORT unused1; + VUSHORT fcc_fccm; /* Mask Register */ + VUSHORT unused2; + VUCHAR fcc_fccs; /* Status Register */ + VUCHAR reserved24[0x3]; + VULONG fcc_tirr; /* Transmit Partial Rate Reg */ +} FCC_REG_T; + +#pragma pack() + +typedef struct { + VUSHORT word1; + VUSHORT bdLen; + VULONG bdAddr; +}FCC_BD; + +typedef struct _pool { + FCC_BD desc; + void *pBuf; + struct _pool *next; +}BPOOL; + +typedef struct fcc_tbd_list { + void *pBuf; + VULONG info; + +#define PKT_TYPE_MULTI 0x10 /* packet with a multicast address */ +#define PKT_TYPE_UNI 0x20 /* packet with a unicast address */ +#define PKT_TYPE_NONE 0x40 /* address type is not meaningful */ +#define BUF_TYPE_CL 0x01 /* this's a cluster pointer */ +#define BUF_TYPE_MBLK 0x02 /* this's a mblk pointer */ +} FCC_TBD_LIST; + +typedef struct + { + FUNCPTR routine; /* routine to be called */ + int param1; /* arg to routine */ + int param2; + int param3; + int param4; + int param5; + } TODO_NODE; + +typedef struct tx_job_node + { + NODE node; /* linked list node */ + TODO_NODE todo; /* to do node */ + } TX_JOB_NODE; + +/* The definition of the driver control structure */ + +typedef struct drv_ctrl { + END_OBJ endObj; /* base class */ + int unit; /* unit number */ + + FCC_DRIVER_STATS *Stats; + + FCC_REG_T *fccReg; + FCC_ETH_PARAM_T *fccEthPar; + FCC_PARAM_T *fccPar; + + BPOOL *RxContainers, *RxEmpty, *RxFree, *RxHead, *RxTail; + volatile int RxBufCount; + volatile int rxHandling; + volatile int lscHandling; + + UINT8 fccNum; /* FCC being used */ + UINT32 immrVal; /* internal RAM base address */ + UINT32 fifoTxBase; /* address of Tx FIFO in internal RAM */ + UINT32 fifoRxBase; /* address of Rx FIFO in internal RAM */ + char * pBufBase; /* FCC memory pool base */ + ULONG bufSize; /* FCC memory pool size */ + char * pBdBase; /* FCC BDs base */ + ULONG bdSize; /* FCC BDs size */ + + UINT16 rbdNum; /* number of RBDs */ + FCC_BD *rbdBase; /* RBD ring */ + volatile UINT16 rbdIndex; /* RBD index */ + void *rBufList[MOT_FCC_RBD_MAX]; + + UINT32 mblkMult; + UINT32 clMult; + + UINT16 tbdNum; /* number of TBDs */ + FCC_BD *tbdBase; /* TBD ring */ + volatile UINT16 tbdIndex; /* TBD index */ + volatile UINT16 usedTbdIndex; /* used TBD index */ + volatile UINT16 cleanTbdNum; /* number of clean TBDs */ + volatile BOOL txStall; /* tx handler stalled - no Tbd */ + UINT16 unStallThresh; /* a threshold */ + + FCC_TBD_LIST pTbdList[MOT_FCC_TBD_MAX]; /* list of TBDs */ + + ULONG userFlags; /* some user flags */ + BOOL zeroBufFlag; + INT8 flags; /* driver state */ + BOOL loaded; /* interface has been loaded */ + BOOL intrConnect; /* interrupt has been connected */ + UINT32 intMask; /* interrupt mask register */ + UINT32 fccIramAddr; /* base addr of this fcc */ + UINT32 fccPramAddr; /* parameter RAM addr of this fcc */ + UCHAR * pTxPollBuf; /* cluster pointer for poll mode */ + + SEM_ID graSem; /* synch semaphore for graceful */ + /* transmit command */ + char * pClBlkArea; /* cluster block pointer */ + UINT32 clBlkSize; /* clusters block memory size */ + char * pMBlkArea; /* mBlock area pointer */ + UINT32 mBlkSize; /* mBlocks area memory size */ + CACHE_FUNCS bdCacheFuncs; /* cache descriptor */ + CACHE_FUNCS bufCacheFuncs; /* cache descriptor */ + CL_POOL_ID pClPoolId; /* cluster pool identifier */ + PHY_INFO *phyInfo; /* info on a MII-compliant PHY */ + int offset; /* Alignment offset */ + UINT deviceId; /* PCI device ID */ + END_ERR lastError; /* Last error passed to muxError */ + UINT errorNoBufs; /* cluster exhaustion */ + MSG_Q_ID txJobMsgQId; /* message queue for defering tx jobs */ + int txJobMsgQLen; /* tx message queue length */ + BOOL txJobQState; /* handshake for tx message queue */ +} DRV_CTRL; + +/* + * this cache functions descriptors is used to flush/invalidate + * the FCC's data buffers. They are set to the system's cache + * flush and invalidate routine. This will allow proper operation + * of the driver if data cache are turned on. + */ + +IMPORT STATUS cacheArchInvalidate (CACHE_TYPE, void *, size_t); + +IMPORT STATUS cacheArchFlush (CACHE_TYPE, void *, size_t); + +LOCAL CACHE_FUNCS motFccBufCacheFuncs; +#if FALSE +LOCAL FUNCPTR motFccBufInvRtn = cacheArchInvalidate; +LOCAL FUNCPTR motFccBufFlushRtn = cacheArchFlush; +#endif /* FALSE */ + +FUNCPTR _func_motFccIntDisc = NULL; /* assign a proper disc routine */ + +IMPORT STATUS sysFccEnetAddrGet (int unit,UCHAR *address); +IMPORT STATUS sysFccEnetEnable (UINT32 immrVal, UINT8 fccNum); +IMPORT STATUS sysFccEnetDisable (UINT32 immrVal, UINT8 fccNum); +IMPORT STATUS sysFccMiiBitWr (UINT32 immrVal, UINT8 fccNum, + INT32 bit); +IMPORT STATUS sysFccMiiBitRd (UINT32 immrVal, UINT8 fccNum, + INT8 * bit); +IMPORT STATUS miiPhyInit (PHY_INFO * phyInfo); +IMPORT FUNCPTR _func_motFccPhyInit; +IMPORT FUNCPTR _func_motFccHbFail; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsbcMotFccEndh */ + diff --git a/h/drv/end/motFecEnd.h b/h/drv/end/motFecEnd.h new file mode 100644 index 0000000..4324b5f --- /dev/null +++ b/h/drv/end/motFecEnd.h @@ -0,0 +1,639 @@ +/* motFecEnd.h - Motorola FEC Ethernet network interface header */ + +/* + * Copyright (c) 1990-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* Copyright 1999-2000 Motorola, Inc., All Rights Reserved */ + +/* +modification history +-------------------- +01i,13oct05,mmi update cache routine references +01h,05dec03,rcs fixed warnings for base6 +01g,01apr02,pmr SPR 72070: passing unit number to sysFecEnetAddrGet. +01f,07dec01,rcs added define REV_D_3 SPR# 71420 +01e,26oct01,crg added support for proper setting of MII management interface + speed (SPR 33812) +01d,21nov00,rhk added define for revision D4 processor and for pin mux bit. +01c,11jun00,ham removed reference to etherLib. +01b,09feb99,cn changes required by performance improvement (SPR# 24883). +01a,09nov98,cn written. +*/ + +#ifndef __INCmotFecEndh +#define __INCmotFecEndh + +/* includes */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +/* revision D.3 and greater processors require special FEC initialization */ + +#define REV_D_4 0x0502 +#define REV_D_3 0x0501 + +/* + * redefine the macro below in the bsp if you need to access the device + * registers/descriptors in a more suitable way. + */ + +#ifndef MOT_FEC_LONG_WR +#define MOT_FEC_LONG_WR(addr, value) \ + (* (addr) = ((UINT32) (value))) +#endif /* MOT_FEC_LONG_WR */ + +#ifndef MOT_FEC_WORD_WR +#define MOT_FEC_WORD_WR(addr, value) \ + (* (addr) = ((UINT16) (value))) +#endif /* MOT_FEC_WORD_WR */ + +#ifndef MOT_FEC_BYTE_WR +#define MOT_FEC_BYTE_WR(addr, value) \ + (* (addr) = ((UINT8) (value))) +#endif /* MOT_FEC_BYTE_WR */ + +#ifndef MOT_FEC_LONG_RD +#define MOT_FEC_LONG_RD(addr, value) \ + ((value) = (* (UINT32 *) (addr))) +#endif /* MOT_FEC_LONG_RD */ + +#ifndef MOT_FEC_WORD_RD +#define MOT_FEC_WORD_RD(addr, value) \ + ((value) = (* (UINT16 *) (addr))) +#endif /* MOT_FEC_WORD_RD */ + +#ifndef MOT_FEC_BYTE_RD +#define MOT_FEC_BYTE_RD(addr, value) \ + ((value) = (* (UINT8 *) (addr))) +#endif /* MOT_FEC_BYTE_RD */ + +/* + * Default macro definitions for BSP interface. + * These macros can be redefined in a wrapper file, to generate + * a new module with an optimized interface. + */ + +#ifndef SYS_FEC_INT_CONNECT +#define SYS_FEC_INT_CONNECT(pDrvCtrl, pFunc, arg, ret) \ +{ \ +IMPORT STATUS intConnect (VOIDFUNCPTR *, VOIDFUNCPTR, int); \ +ret = OK; \ + \ +if (MOT_FEC_VECTOR (pDrvCtrl) && (!(pDrvCtrl->intrConnect))) \ + { \ + pDrvCtrl->intrConnect = TRUE; \ + ret = (intConnect) ((VOIDFUNCPTR*) \ + INUM_TO_IVEC (MOT_FEC_VECTOR (pDrvCtrl)), \ + (pFunc), (int) (arg)); \ + } \ +} +#endif /* SYS_FEC_INT_CONNECT */ + +#ifndef SYS_FEC_INT_DISCONNECT +#define SYS_FEC_INT_DISCONNECT(pDrvCtrl, pFunc, arg, ret) \ +{ \ +ret = OK; \ + \ +if (MOT_FEC_VECTOR (pDrvCtrl) && (motFecIntDisc != NULL)) \ + { \ + pDrvCtrl->intrConnect = FALSE; \ + ret = (*motFecIntDisc) ((VOIDFUNCPTR*) \ + INUM_TO_IVEC (MOT_FEC_VECTOR (pDrvCtrl)), \ + (pFunc)); \ + } \ +} +#endif /* SYS_FEC_INT_DISCONNECT */ + +#ifndef SYS_FEC_INT_ENABLE +#define SYS_FEC_INT_ENABLE(pDrvCtrl, ret) \ +{ \ +IMPORT int intEnable (int); \ +ret = OK; \ + \ +if (MOT_FEC_VECTOR (pDrvCtrl)) \ + ret = intEnable ((int) (MOT_FEC_VECTOR (pDrvCtrl))); \ +} +#endif /* SYS_FEC_INT_ENABLE */ + +#ifndef SYS_FEC_INT_DISABLE +#define SYS_FEC_INT_DISABLE(pDrvCtrl, ret) \ +{ \ +IMPORT int intDisable (int); \ +ret = OK; \ + \ +if (MOT_FEC_VECTOR (pDrvCtrl)) \ + ret = intDisable ((int) (MOT_FEC_VECTOR (pDrvCtrl))); \ +} +#endif /* SYS_FEC_INT_DISABLE */ + +#define SYS_FEC_ENET_ADDR_GET(address) \ +if (sysFecEnetAddrGet != NULL) \ + if (sysFecEnetAddrGet (pDrvCtrl->unit, (address)) == ERROR) \ + { \ + errnoSet (S_iosLib_INVALID_ETHERNET_ADDRESS); \ + return (NULL); \ + } + +#define SYS_FEC_ENET_ENABLE \ +if (sysFecEnetEnable != NULL) \ + if (sysFecEnetEnable (pDrvCtrl->motCpmAddr) == ERROR) \ + return (ERROR); + +#define SYS_FEC_ENET_DISABLE \ +if (sysFecEnetDisable != NULL) \ + if (sysFecEnetDisable (pDrvCtrl->motCpmAddr) == ERROR) \ + return (ERROR); + +#define MOT_FEC_DEV_NAME "motfec" +#define MOT_FEC_DEV_NAME_LEN 7 +#define MOT_FEC_TBD_DEF_NUM 64 /* default number of TBDs */ +#define MOT_FEC_RBD_DEF_NUM 48 /* default number of RBDs */ +#define MOT_FEC_TX_CL_NUM 6 /* number of tx clusters */ +#define MOT_FEC_BD_LOAN_NUM 32 /* loaned BDs */ +#define MOT_FEC_TBD_MAX 128 /* max number of TBDs */ +#define MOT_FEC_RBD_MAX 128 /* max number of TBDs */ +#define MOT_FEC_WAIT_MAX 0xf0000000 /* max delay after sending */ + +#define MOT_FEC_ADDR_LEN 6 /* ethernet address length */ + +/* Control/Status Registers (CSR) definitions */ + +#define MOT_FEC_CSR_OFF 0x0e00 /* CSRs offset in the 860T RAM */ +#define MOT_FEC_ADDR_L_OFF 0x0e00 /* lower 32-bits of MAC address */ +#define MOT_FEC_ADDR_H_OFF 0x0e04 /* upper 16-bits of MAC address */ +#define MOT_FEC_HASH_H_OFF 0x0e08 /* upper 32-bits of hash table */ +#define MOT_FEC_HASH_L_OFF 0x0e0c /* lower 32-bits of hash table */ +#define MOT_FEC_RX_START_OFF 0x0e10 /* rx ring start address */ +#define MOT_FEC_TX_START_OFF 0x0e14 /* tx ring start address */ +#define MOT_FEC_RX_BUF_OFF 0x0e18 /* max rx buf length */ +#define MOT_FEC_CTRL_OFF 0x0e40 /* FEC control register */ +#define MOT_FEC_EVENT_OFF 0x0e44 /* interrupt event register */ +#define MOT_FEC_MASK_OFF 0x0e48 /* interrupt mask register */ +#define MOT_FEC_VEC_OFF 0x0e4c /* interrupt level/vector register */ +#define MOT_FEC_RX_ACT_OFF 0x0e50 /* rx ring has been updated */ +#define MOT_FEC_TX_ACT_OFF 0x0e54 /* tx ring has been updated */ +#define MOT_FEC_MII_DATA_OFF 0x0e80 /* MII data register */ +#define MOT_FEC_MII_SPEED_OFF 0x0e84 /* MII speed register */ +#define MOT_FEC_RX_BOUND_OFF 0x0ecc /* rx fifo limit in the 860T ram */ +#define MOT_FEC_RX_FIFO_OFF 0x0ed0 /* rx fifo base in the 860T ram */ +#define MOT_FEC_TX_FIFO_OFF 0x0eec /* tx fifo base in the 860T ram */ +#define MOT_FEC_SDMA_OFF 0x0f34 /* function code to SDMA */ +#define MOT_FEC_RX_CTRL_OFF 0x0f44 /* rx control register */ +#define MOT_FEC_RX_FR_OFF 0x0f48 /* max rx frame length */ +#define MOT_FEC_TX_CTRL_OFF 0x0f84 /* tx control register */ + +/* Control/Status Registers (CSR) bit definitions */ + +#define MOT_FEC_RX_START_MSK 0xfffffffc /* quad-word alignment */ + /* required for rx BDs */ + +#define MOT_FEC_TX_START_MSK 0xfffffffc /* quad-word alignment */ + /* required for tx BDs */ +/* Ethernet CSR bit definitions */ + +#define MOT_FEC_ETH_PINMUX 0x00000004 /* select FEC for port D pins */ +#define MOT_FEC_ETH_EN 0x00000002 /* enable Ethernet operation */ +#define MOT_FEC_ETH_DIS 0x00000000 /* disable Ethernet operation */ +#define MOT_FEC_ETH_RES 0x00000001 /* reset the FEC */ +#define MOT_FEC_CTRL_MASK 0x00000007 /* FEC control register mask */ + +/* + * interrupt bits definitions: these are common to both the + * mask and the event register. + */ + +#define MOT_FEC_EVENT_HB 0x80000000 /* heartbeat error */ +#define MOT_FEC_EVENT_BABR 0x40000000 /* babbling rx error */ +#define MOT_FEC_EVENT_BABT 0x20000000 /* babbling tx error */ +#define MOT_FEC_EVENT_GRA 0x10000000 /* graceful stop complete */ +#define MOT_FEC_EVENT_TXF 0x08000000 /* tx frame */ +#define MOT_FEC_EVENT_TXB 0x04000000 /* tx buffer */ +#define MOT_FEC_EVENT_RXF 0x02000000 /* rx frame */ +#define MOT_FEC_EVENT_RXB 0x01000000 /* rx buffer */ +#define MOT_FEC_EVENT_MII 0x00800000 /* MII transfer */ +#define MOT_FEC_EVENT_BERR 0x00400000 /* U-bus access error */ +#define MOT_FEC_EVENT_MSK 0xffc00000 /* clear all interrupts */ +#define MOT_FEC_MASK_ALL MOT_FEC_EVENT_MSK /* mask all interrupts */ + +/* bit masks for the interrupt level/vector CSR */ + +#define MOT_FEC_LVL_MSK 0xe0000000 /* intr level */ +#define MOT_FEC_TYPE_MSK 0x0000000c /* highest pending intr */ +#define MOT_FEC_VEC_MSK 0xe000000c /* this register mask */ +#define MOT_FEC_RES_MSK 0x1ffffff3 /* reserved bits */ +#define MOT_FEC_LVL_SHIFT 0x1d /* intr level bits location */ + +/* transmit and receive active registers definitions */ + +#define MOT_FEC_TX_ACT 0x01000000 /* tx active bit */ +#define MOT_FEC_RX_ACT 0x01000000 /* rx active bit */ + +/* MII management frame CSRs */ + +#define MOT_FEC_MII_ST 0x40000000 /* start of frame delimiter */ +#define MOT_FEC_MII_OP_RD 0x20000000 /* perform a read operation */ +#define MOT_FEC_MII_OP_WR 0x10000000 /* perform a write operation */ +#define MOT_FEC_MII_ADDR_MSK 0x0f800000 /* PHY address field mask */ +#define MOT_FEC_MII_REG_MSK 0x007c0000 /* PHY register field mask */ +#define MOT_FEC_MII_TA 0x00020000 /* turnaround */ +#define MOT_FEC_MII_DATA_MSK 0x0000ffff /* PHY data field */ +#define MOT_FEC_MII_RA_SHIFT 0x12 /* mii reg address bits */ +#define MOT_FEC_MII_PA_SHIFT 0x17 /* mii PHY address bits */ + +#define MOT_FEC_MII_PRE_DIS 0x00000080 /* desable preamble */ +#define MOT_FEC_MII_SPEED_25 0x00000005 /* recommended for 25Mhz CPU */ +#define MOT_FEC_MII_SPEED_33 0x00000007 /* recommended for 33Mhz CPU */ +#define MOT_FEC_MII_SPEED_40 0x00000008 /* recommended for 40Mhz CPU */ +#define MOT_FEC_MII_SPEED_50 0x0000000a /* recommended for 50Mhz CPU */ +#define MOT_FEC_MII_SPEED_SHIFT 1 /* MII_SPEED bits location */ +#define MOT_FEC_MII_CLOCK_MAX 2500000 /* max freq of MII clock (Hz) */ +#define MOT_FEC_MII_MAN_DIS 0x00000000 /* disable the MII management */ + /* interface */ +#define MOT_FEC_MII_SPEED_MSK 0xffffff81 /* speed field mask */ + +/* FIFO transmit and receive CSRs definitions */ + +#define MOT_FEC_FIFO_MSK 0x000003ff /* FIFO rx/tx/bound mask */ + +/* SDMA function code CSR */ + +#define MOT_FEC_SDMA_DATA_BE 0x60000000 /* big-endian byte-ordering */ + /* for SDMA data transfer */ + +#define MOT_FEC_SDMA_DATA_PPC 0x20000000 /* PPC byte-ordering */ + /* for SDMA data transfer */ + +#define MOT_FEC_SDMA_DATA_RES 0x00000000 /* reserved value */ + +#define MOT_FEC_SDMA_BD_BE 0x18000000 /* big-endian byte-ordering */ + /* for SDMA BDs transfer */ + +#define MOT_FEC_SDMA_BD_PPC 0x08000000 /* PPC byte-ordering */ + /* for SDMA BDs transfer */ + + +#define MOT_FEC_SDMA_BD_RES 0x00000000 /* reserved value */ +#define MOT_FEC_SDMA_FUNC_0 0x00000000 /* no function code */ + +/* receive control/hash registers bit definitions */ + +#define MOT_FEC_RX_CTRL_PROM 0x00000008 /* promiscous mode */ +#define MOT_FEC_RX_CTRL_MII 0x00000004 /* select MII interface */ +#define MOT_FEC_RX_CTRL_DRT 0x00000002 /* disable rx on transmit */ +#define MOT_FEC_RX_CTRL_LOOP 0x00000001 /* loopback mode */ +#define MOT_FEC_RX_FR_MSK 0x000007ff /* rx frame length mask */ + + +/* transmit control register bit definitions */ + +#define MOT_FEC_TX_CTRL_FD 0x00000004 /* enable full duplex mode */ +#define MOT_FEC_TX_CTRL_HBC 0x00000002 /* HB check is performed */ +#define MOT_FEC_TX_CTRL_GRA 0x00000001 /* issue a graceful tx stop */ + +/* rx/tx buffer descriptors definitions */ + +#define MOT_FEC_RBD_SZ 8 /* RBD size in byte */ +#define MOT_FEC_TBD_SZ 8 /* TBD size in byte */ +#define MOT_FEC_TBD_MIN 6 /* min number of TBDs */ +#define MOT_FEC_RBD_MIN 4 /* min number of RBDs */ +#define MOT_FEC_TBD_POLL_NUM 1 /* one TBD for poll operation */ +#define CL_OVERHEAD 4 /* prepended cluster overhead */ +#define CL_ALIGNMENT 4 /* cluster required alignment */ +#define MBLK_ALIGNMENT 4 /* mBlks required alignment */ +#define MOT_FEC_BD_ALIGN 0x10 /* required alignment for RBDs */ +#define MOT_FEC_MAX_PCK_SZ (ETHERMTU + SIZEOF_ETHERHEADER \ + + ETHER_CRC_LEN) + +#define MOT_FEC_BD_STAT_OFF 0 /* offset of the status word */ +#define MOT_FEC_BD_LEN_OFF 2 /* offset of the data length word */ +#define MOT_FEC_BD_ADDR_OFF 4 /* offset of the data pointer word */ + +/* TBD bits definitions */ + +#define MOT_FEC_TBD_RDY 0x8000 /* ready for transmission */ +#define MOT_FEC_TBD_TO1 0x4000 /* transmit ownership bit 1 */ +#define MOT_FEC_TBD_WRAP 0x2000 /* look at CSR5 for next bd */ +#define MOT_FEC_TBD_TO2 0x1000 /* transmit ownership bit 2 */ +#define MOT_FEC_TBD_LAST 0x0800 /* last bd in this frame */ +#define MOT_FEC_TBD_CRC 0x0400 /* transmit the CRC sequence */ +#define MOT_FEC_TBD_DEF 0x0200 /* deferred transmission */ +#define MOT_FEC_TBD_HB 0x0100 /* heartbeat error */ +#define MOT_FEC_TBD_LC 0x0080 /* late collision */ +#define MOT_FEC_TBD_RL 0x0040 /* retransmission limit */ +#define MOT_FEC_TBD_UN 0x0002 /* underrun error */ +#define MOT_FEC_TBD_CSL 0x0001 /* carrier sense lost */ +#define MOT_FEC_TBD_RC_MASK 0x003c /* retransmission count mask */ + +/* RBD bits definitions */ + +#define MOT_FEC_RBD_EMPTY 0x8000 /* ready for reception */ +#define MOT_FEC_RBD_RO1 0x4000 /* receive ownership bit 1 */ +#define MOT_FEC_RBD_WRAP 0x2000 /* look at CSR4 for next bd */ +#define MOT_FEC_RBD_RO2 0x1000 /* receive ownership bit 2 */ +#define MOT_FEC_RBD_LAST 0x0800 /* last bd in this frame */ +#define MOT_FEC_RBD_RES1 0x0400 /* reserved bit 1 */ +#define MOT_FEC_RBD_RES2 0x0200 /* reserved bit 2 */ +#define MOT_FEC_RBD_MISS 0x0100 /* address recognition miss */ +#define MOT_FEC_RBD_BC 0x0080 /* broadcast frame */ +#define MOT_FEC_RBD_MC 0x0040 /* multicast frame */ +#define MOT_FEC_RBD_LG 0x0020 /* frame length violation */ +#define MOT_FEC_RBD_NO 0x0010 /* nonoctet aligned frame */ +#define MOT_FEC_RBD_SH 0x0008 /* short frame error */ + /* not supported by the 860T */ +#define MOT_FEC_RBD_CRC 0x0004 /* CRC error */ +#define MOT_FEC_RBD_OV 0x0002 /* overrun error */ +#define MOT_FEC_RBD_TR 0x0001 /* truncated frame (>2KB) */ +#define MOT_FEC_RBD_ERR (MOT_FEC_RBD_LG | \ + MOT_FEC_RBD_NO | \ + MOT_FEC_RBD_CRC | \ + MOT_FEC_RBD_OV | \ + MOT_FEC_RBD_TR) + +#define MOT_FEC_CRC_POLY 0x04c11db7 /* CRC polynomium: */ + /* x^32 + x^26 + x^23 + */ + /* x^22 + x^16 + x^12 + */ + /* x^11 + x^10 + x^8 + */ + /* x^7 + x^5 + x^4 + */ + /* x^2 + x^1 + x^0 + */ + +#define MOT_FEC_HASH_MASK 0x7c000000 /* bits 27-31 */ +#define MOT_FEC_HASH_SHIFT 0x1a /* to get the index */ + +/* defines related to the PHY device */ + +#define MOT_FEC_PHY_PRE_INIT 0x0001 /* PHY info initialized */ +#define MOT_FEC_PHY_AUTO 0x0010 /* enable auto-negotiation */ +#define MOT_FEC_PHY_TBL 0x0020 /* use negotiation table */ +#define MOT_FEC_PHY_100 0x0040 /* PHY may use 100Mbit speed */ +#define MOT_FEC_PHY_10 0x0080 /* PHY may use 10Mbit speed */ +#define MOT_FEC_PHY_FD 0x0100 /* PHY may use full duplex */ +#define MOT_FEC_PHY_HD 0x0200 /* PHY may use half duplex */ +#define MOT_FEC_PHY_MAX_WAIT 0x100 /* max delay before */ +#define MOT_FEC_PHY_NULL 0xff /* PHY is not present */ +#define MOT_FEC_PHY_DEF 0x0 /* PHY's logical address */ + +/* allowed PHY's speeds */ + +#define MOT_FEC_100MBS 100000000 /* bits per sec */ +#define MOT_FEC_10MBS 10000000 /* bits per sec */ + +/* + * user flags: full duplex mode, loopback mode, serial interface etc. + * the user may configure some of this options according to his needs + * by setting the related bits in the field of the load string. + */ + +#define MOT_FEC_USR_PHY_NO_AN 0x00000001 /* do not auto-negotiate */ +#define MOT_FEC_USR_PHY_TBL 0x00000002 /* use negotiation table */ +#define MOT_FEC_USR_PHY_NO_FD 0x00000004 /* do not use full duplex */ +#define MOT_FEC_USR_PHY_NO_100 0x00000008 /* do not use 100Mbit speed */ +#define MOT_FEC_USR_PHY_NO_HD 0x00000010 /* do not use half duplex */ +#define MOT_FEC_USR_PHY_NO_10 0x00000020 /* do not use 10Mbit speed */ +#define MOT_FEC_USR_PHY_ISO 0x00000100 /* isolate a PHY */ +#define MOT_FEC_USR_SER 0x00000200 /* 7-wire serial interface */ +#define MOT_FEC_USR_LOOP 0x00000400 /* loopback mode */ + /* only use it for testing */ +#define MOT_FEC_USR_HBC 0x00000080 /* perform heartbeat control */ + +#define MOT_FEC_TBD_OK 0x1 /* the TBD is a good one */ +#define MOT_FEC_TBD_BUSY 0x2 /* the TBD has not been used */ +#define MOT_FEC_TBD_ERROR 0x4 /* the TBD is errored */ + +#define PKT_TYPE_MULTI 0x1 /* packet with a multicast address */ +#define PKT_TYPE_UNI 0x2 /* packet with a unicast address */ +#define PKT_TYPE_NONE 0x4 /* address type is not meaningful */ + +#define BUF_TYPE_CL 0x1 /* this's a cluster pointer */ +#define BUF_TYPE_MBLK 0x2 /* this's a mblk pointer */ + +/* frame descriptors definitions */ + +typedef char * MOT_FEC_BD_ID; +typedef MOT_FEC_BD_ID MOT_FEC_TBD_ID; +typedef MOT_FEC_BD_ID MOT_FEC_RBD_ID; + +/* MII definitions */ + +#ifndef ETHER_CRC_LEN + #define ETHER_CRC_LEN 0x4 /* CRC length in bytes */ +#endif +#define MII_MAX_PHY_NUM 0x20 /* max number of attached PHYs */ + +#define MII_CTRL_REG 0x0 /* Control Register */ +#define MII_STAT_REG 0x1 /* Status Register */ +#define MII_PHY_ID1_REG 0x2 /* PHY identifier 1 Register */ +#define MII_PHY_ID2_REG 0x3 /* PHY identifier 2 Register */ +#define MII_AN_ADS_REG 0x4 /* Auto-Negotiation */ + /* Advertisement Register */ +#define MII_AN_PRTN_REG 0x5 /* Auto-Negotiation */ + /* partner ability Register */ +#define MII_AN_EXP_REG 0x6 /* Auto-Negotiation */ + /* Expansion Register */ +#define MII_AN_NEXT_REG 0x7 /* Auto-Negotiation */ + /* next-page transmit Register */ + +/* MII control register bit */ + +#define MII_CR_COLL_TEST 0x0080 /* collision test */ +#define MII_CR_FDX 0x0100 /* FDX =1, half duplex =0 */ +#define MII_CR_RESTART 0x0200 /* restart auto negotiation */ +#define MII_CR_ISOLATE 0x0400 /* isolate PHY from MII */ +#define MII_CR_POWER_DOWN 0x0800 /* power down */ +#define MII_CR_AUTO_EN 0x1000 /* auto-negotiation enable */ +#define MII_CR_100 0x2000 /* 0 = 10mb, 1 = 100mb */ +#define MII_CR_LOOPBACK 0x4000 /* 0 = normal, 1 = loopback */ +#define MII_CR_RESET 0x8000 /* 0 = normal, 1 = PHY reset */ +#define MII_CR_NORM_EN 0x0000 /* just enable the PHY */ + +/* MII Status register bit definitions */ + +#define MII_SR_LINK_STATUS 0x0004 /* link Status -- 1 = link */ +#define MII_SR_AUTO_SEL 0x0008 /* auto speed select capable */ +#define MII_SR_REMOTE_FAULT 0x0010 /* Remote fault detect */ +#define MII_SR_AUTO_NEG 0x0020 /* auto negotiation complete */ +#define MII_SR_10T_HALF_DPX 0x0800 /* 10BaseT HD capable */ +#define MII_SR_10T_FULL_DPX 0x1000 /* 10BaseT FD capable */ +#define MII_SR_TX_HALF_DPX 0x2000 /* TX HD capable */ +#define MII_SR_TX_FULL_DPX 0x4000 /* TX FD capable */ +#define MII_SR_T4 0x8000 /* T4 capable */ + +/* MII Link Code word bit definitions */ + +#define MII_BP_FAULT 0x2000 /* remote fault */ +#define MII_BP_ACK 0x4000 /* acknowledge */ +#define MII_BP_NP 0x8000 /* nexp page is supported */ + +/* MII Next Page bit definitions */ + +#define MII_NP_TOGGLE 0x0800 /* toggle bit */ +#define MII_NP_ACK2 0x1000 /* acknowledge two */ +#define MII_NP_MSG 0x2000 /* message page */ +#define MII_NP_ACK1 0x4000 /* acknowledge one */ +#define MII_NP_NP 0x8000 /* nexp page will follow */ + +/* MII Expansion Register bit definitions */ + +#define MII_EXP_FAULT 0x0010 /* parallel detection fault */ +#define MII_EXP_PRTN_NP 0x0008 /* link partner next-page able */ +#define MII_EXP_LOC_NP 0x0004 /* local PHY next-page able */ +#define MII_EXP_PR 0x0002 /* full page received */ +#define MII_EXP_PRT_AN 0x0001 /* link partner auto negotiation able */ + +/* technology ability field bit definitions */ + +#define MII_TECH_10BASE_T 0x0020 /* 10Base-T */ +#define MII_TECH_10BASE_FD 0x0040 /* 10Base-T Full Duplex */ +#define MII_TECH_100BASE_TX 0x0080 /* 100Base-TX */ +#define MII_TECH_100BASE_TX_FD 0x0100 /* 100Base-TX Full Duplex */ +#define MII_TECH_100BASE_T4 0x0200 /* 100Base-T4 */ +#define MII_TECH_MASK 0x1fe0 /* technology abilities mask */ + +#define MII_AN_FAIL 0x10 /* auto-negotiation fail */ +#define MII_STAT_FAIL 0x20 /* errors in the status register */ +#define MOT_FEC_PHY_NO_ABLE 0x40 /* the PHY lacks some abilities */ + +/* + * this table may be customized by the user in configNet.h + */ + +IMPORT INT16 motFecPhyAnOrderTbl []; + +/* + * the table below is used to translate user settings + * into MII-standard values for technology abilities. + */ + +LOCAL UINT16 miiAnLookupTbl [] = { + MII_TECH_10BASE_T, + MII_TECH_10BASE_FD, + MII_TECH_100BASE_TX, + MII_TECH_100BASE_TX_FD, + MII_TECH_100BASE_T4 + }; + +LOCAL UINT16 miiCrLookupTbl [] = { + MII_CR_NORM_EN, + MII_CR_FDX, + MII_CR_100, + (MII_CR_100 | MII_CR_FDX), + (MII_CR_100 | MII_CR_FDX) + }; + +typedef struct mii_regs + { + UINT16 phyStatus; /* PHY's status register */ + UINT16 phyCtrl; /* PHY's control register */ + UINT16 phyId1; /* PHY's identifier field 1 */ + UINT16 phyId2; /* PHY's identifier field 2 */ + UINT16 phyAds; /* PHY's advertisement register */ + UINT16 phyPrtn; /* PHY's partner register */ + UINT16 phyExp; /* PHY's expansion register */ + UINT16 phyNext; /* PHY's next paget transmit register */ + } MII_REGS; + +typedef struct phy_info + { + MII_REGS miiRegs; /* PHY registers */ + UINT8 phyAddr; /* address of the PHY to be used */ + UINT8 isoPhyAddr; /* address of a PHY to isolate */ + UINT32 phyFlags; /* some flags */ + UINT32 phySpeed; /* 10/100 Mbit/sec */ + UINT32 phyMode; /* half/full duplex mode */ + UINT32 phyDefMode; /* default operating mode */ + } PHY_INFO; + +typedef struct mot_fec_tbd_list + { + UINT16 fragNum; + UINT16 pktType; + UCHAR * pBuf; + UINT16 bufType; + struct mot_fec_tbd_list * pNext; + MOT_FEC_TBD_ID pTbd; + } MOT_FEC_TBD_LIST; + +typedef MOT_FEC_TBD_LIST * MOT_FEC_TBD_LIST_ID; + +/* The definition of the driver control structure */ + +typedef struct drv_ctrl + { + END_OBJ endObj; /* base class */ + int unit; /* unit number */ + UINT32 motCpmAddr; /* internal RAM base address */ + int ivec; /* interrupt vector number */ + int ilevel; /* interrupt level */ + UINT32 fifoTxBase; /* address of Tx FIFO in internal RAM */ + UINT32 fifoRxBase; /* address of Rx FIFO in internal RAM */ + char * pBufBase; /* FEC memory pool base */ + ULONG bufSize; /* FEC memory pool size */ + UINT16 rbdNum; /* number of RBDs */ + MOT_FEC_RBD_ID rbdBase; /* RBD ring */ + UINT16 rbdIndex; /* RBD index */ + UINT16 tbdNum; /* number of TBDs */ + MOT_FEC_TBD_ID tbdBase; /* TBD ring */ + UINT16 tbdIndex; /* TBD index */ + UINT16 usedTbdIndex; /* used TBD index */ + UINT16 cleanTbdNum; /* number of clean TBDs */ + BOOL txStall; /* tx handler stalled - no Tbd */ + MOT_FEC_TBD_LIST * pTbdList [MOT_FEC_TBD_MAX]; + /* list of TBDs */ + ULONG userFlags; /* some user flags */ + INT8 flags; /* driver state */ + BOOL loaded; /* interface has been loaded */ + BOOL intrConnect; /* interrupt has been connected */ + UINT32 intMask; /* interrupt mask register */ + UCHAR * pTxPollBuf; /* cluster pointer for poll mode */ + UCHAR * rxBuf[MOT_FEC_RBD_MAX]; + /* array of pointers to clusters */ + SEM_ID miiSem; /* synch semaphore for mii frames */ + SEM_ID graSem; /* synch semaphore for graceful */ + /* transmit command */ + char * pClBlkArea; /* cluster block pointer */ + UINT32 clBlkSize; /* clusters block memory size */ + char * pMBlkArea; /* mBlock area pointer */ + UINT32 mBlkSize; /* mBlocks area memory size */ + CACHE_FUNCS bdCacheFuncs; /* cache descriptor */ + CACHE_FUNCS bufCacheFuncs; /* cache descriptor */ + CL_POOL_ID pClPoolId; /* cluster pool identifier */ + PHY_INFO *phyInfo; /* info on a MII-compliant PHY */ + UINT32 clockSpeed; /* clock speed (Hz) for MII_SPEED */ + } DRV_CTRL; + +/* + * this cache functions descriptors is used to flush/invalidate + * the FEC's data buffers. They are set to the system's cache + * flush and invalidate routine. This will allow proper operation + * of the driver if data cache are turned on. + */ + +IMPORT STATUS cacheInvalidate (CACHE_TYPE, void *, size_t); + +IMPORT STATUS cacheFlush (CACHE_TYPE, void *, size_t); + +LOCAL CACHE_FUNCS motFecBufCacheFuncs; +LOCAL FUNCPTR motFecBufInvRtn = cacheInvalidate; +LOCAL FUNCPTR motFecBufFlushRtn = cacheFlush; + +FUNCPTR motFecIntDisc = NULL; /* assign a proper disc routine */ +IMPORT STATUS sysFecEnetAddrGet (UINT32 motCmpAddr, UCHAR * address); +IMPORT STATUS sysFecEnetEnable (UINT32 motCmpAddr); +IMPORT STATUS sysFecEnetDisable (UINT32 motCmpAddr); +IMPORT FUNCPTR _func_motFecPhyInit; +IMPORT FUNCPTR _func_motFecHbFail; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmotFecEndh */ + diff --git a/h/drv/end/motTsecEnd.h b/h/drv/end/motTsecEnd.h new file mode 100644 index 0000000..c919302 --- /dev/null +++ b/h/drv/end/motTsecEnd.h @@ -0,0 +1,1180 @@ +/* MotTsecEnd.h - Motorola TSEC Ethernet network interface.*/ + +/* Copyright 2003-2005 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01o,26jun05,dlk Replace netJobAdd() with jobQueuePost(). +01j,24mar05,dtr Changes from code review. +01i,31jan05,dtr Decouple from interrupt controller. +01h,23nov04,rcs Fixed SPR 104568 - fails large pings when attached to a + gigabit switch +01g,22oct04,dtr Added Interrupt coalescing defines. Changed some defaults + for increased performance.SPR 102536 +01f,22jul04,rcs Added PHY Access definitions +01e,21jun04,mil Changed cacheArchXXX funcs to cacheXXX funcs. +01d,27apr04,mdo Latest updates for B6 build +01c,13apr04,mil Fixed location of header file. +01c,26mar04,rcs Fixed SPR 95432 +01b,12feb04,rcs Adjusted default settings +01b,04feb04,mil Fixed problem if compiled with GNU. +01a,10mar03,gjc Motorola TSEC Ethernet. +*/ + + +#ifndef __INCmotTsecEndh +#define __INCmotTsecEndh + +/* includes */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "net/ethernet.h" +#include "etherLib.h" +#include "miiLib.h" + +#define _WRS_VXWORKS_VNUM \ + ((_WRS_VXWORKS_MAJOR << 16)|(_WRS_VXWORKS_MINOR << 8)|(_WRS_VXWORKS_MAINT)) + +#if _WRS_VXWORKS_VNUM >= 0x060100 + +#undef USE_NET_JOB_ADD + +#ifdef USE_NET_JOB_ADD +#undef netJobAdd /* for the cases when we store it in a pointer */ +#endif + +#define NET_JOB_ADD(f, a1, a2, a3, a4, a5) \ + (jobQueueStdPost (&netJobInfo, NET_TASK_QJOB_PRI, \ + (VOIDFUNCPTR)(f), (void *)(a1), (void *)(a2), \ + (void *)(a3), (void *)(a4), (void *)(a5))) +#else +#define USE_NET_JOB_ADD +#define NET_JOB_ADD(f, a1, a2, a3, a4, a5) \ + (netJobAdd ((f), (a1), (a2), (a3), (a4), (a5))) +#endif + + +#ifndef M8260ABBREVIATIONS +#define M8260ABBREVIATIONS + +#ifdef _ASMLANGUAGE +#define CAST(x) +#else /* _ASMLANGUAGE */ +typedef volatile UCHAR VCHAR; /* shorthand for volatile UCHAR */ +typedef volatile INT32 VINT32; /* volatile unsigned word */ +typedef volatile INT16 VINT16; /* volatile unsigned halfword */ +typedef volatile INT8 VINT8; /* volatile unsigned byte */ +typedef volatile UINT32 VUINT32; /* volatile unsigned word */ +typedef volatile UINT16 VUINT16; /* volatile unsigned halfword */ +typedef volatile UINT8 VUINT8; /* volatile unsigned byte */ +#define CAST(x) (x) +#endif /* _ASMLANGUAGE */ + +#endif /* M8260ABBREVIATIONS */ + +typedef struct ether_addr ENET_ADDR; + +#define MOT_TSEC_DEV_NAME "mottsec" +#define MOT_TSEC_DEV_NAME_LEN 8 +#define MOT_TSEC_MAX_DEVS 2 +#define MOT_TSEC_DEV_1 0 +#define MOT_TSEC_DEV_2 1 +#define MOT_TSEC_ADRS_OFFSET_1 0x00024000 +#define MOT_TSEC_ADRS_OFFSET_2 0x00025000 + +/* IEVENT and IMASK Register definitions */ +#define MOT_TSEC_IEVENT_BABR 0x80000000 +#define MOT_TSEC_IEVENT_RXC 0x40000000 +#define MOT_TSEC_IEVENT_BSY 0x20000000 +#define MOT_TSEC_IEVENT_EBERR 0x10000000 +#define MOT_TSEC_IEVENT_MSRO 0x04000000 +#define MOT_TSEC_IEVENT_GTSC 0x02000000 +#define MOT_TSEC_IEVENT_BABT 0x01000000 +#define MOT_TSEC_IEVENT_TXC 0x00800000 +#define MOT_TSEC_IEVENT_TXE 0x00400000 +#define MOT_TSEC_IEVENT_TXB 0x00200000 +#define MOT_TSEC_IEVENT_TXF 0x00100000 +#define MOT_TSEC_IEVENT_LC 0x00040000 +#define MOT_TSEC_IEVENT_CRL 0x00020000 +#define MOT_TSEC_IEVENT_XFUN 0x00010000 +#define MOT_TSEC_IEVENT_RXB0 0x00008000 +#define MOT_TSEC_IEVENT_GRSC 0x00000100 +#define MOT_TSEC_IEVENT_RXF0 0x00000080 + +/* Error Disable Registers */ +#define MOT_TSEC_EDIS_BSYDIS 0x20000000 +#define MOT_TSEC_EDIS_EBERRDIS 0x10000000 +#define MOT_TSEC_EDIS_TXEDIS 0x00400000 +#define MOT_TSEC_EDIS_LCDIS 0x00040000 +#define MOT_TSEC_EDIS_CRLDIS 0x00020000 +#define MOT_TSEC_EDIS_XFUNDIS 0x00010000 + +/* Ethernet Control Register */ +#define MOT_TSEC_ECNTRL_CLRCNT 0x00004000 +#define MOT_TSEC_ECNTRL_AUTOZ 0x00002000 +#define MOT_TSEC_ECNTRL_STEN 0x00001000 +#define MOT_TSEC_ECNTRL_TBIM 0x00000020 +#define MOT_TSEC_ECNTRL_RPM 0x00000010 +#define MOT_TSEC_ECNTRL_R100M 0x00000008 + +/* Minimum Frame Register Length */ +#define MOT_TSEC_MINFLR(l) (l&0x0000007f) + +/* PTV Register Definition */ +#define MOT_TSEC_PTV_PTE(t) (t<<16) +#define MOT_TSEC_PTV_PT(t) (t) + +/* DMA Control Register */ +#define MOT_TSEC_DMACTRL_TDSEN 0x00000080 +#define MOT_TSEC_DMACTRL_TBDSEN 0x00000040 +#define MOT_TSEC_DMACTRL_GRS 0x00000010 +#define MOT_TSEC_DMACTRL_GTS 0x00000008 +#define MOT_TSEC_DMACTRL_TOD 0x00000004 +#define MOT_TSEC_DMACTRL_WWR 0x00000002 +#define MOT_TSEC_DMACTRL_WOP 0x00000001 + +/* TBI Physical Address Registers */ +#define MOT_TSEC_TBIPA(a) (a&0x0000001f) + +/* FIFO Transmit Threshold Registers */ +#define MOT_TSEC_FIFO_TX_THR(a) (a&0x000001ff) + +/* FIFO Transmit Starve Registers */ +#define MOT_TSEC_FIFO_TX_STARVE(a) (a&0x000001ff) + +/* FIFO Transmit Starve Shutoff Registers */ +#define MOT_TSEC_FIFO_TX_STARVE_SHUTOFF(a) (a&0x000001ff) + +/* Transmit Control Register */ +#define MOT_TSEC_TCTRL_THDF 0x00000800 +#define MOT_TSEC_TCTRL_RFC_PAUSE 0x00000010 +#define MOT_TSEC_TCTRL_TFC_PAUSE 0x00000008 + +#define MOT_TSEC_TSTAT_THLT 0x80000000 + +/* Transmit Interrupt Coalescing */ +#define MOT_TSEC_TXIC_ICEN 0x80000000 +#define MOT_TSEC_TXIC_ICFCT(a) ((a&0x000000ff)<<21) +#define MOT_TSEC_TXIC_ICTT(a) (a&0x0000ffff) + +#define MOT_TSEC_OSTBD_R 0x80000000 +#define MOT_TSEC_OSTBD_PAD 0x40000000 +#define MOT_TSEC_OSTBD_W 0x20000000 +#define MOT_TSEC_OSTBD_I 0x10000000 +#define MOT_TSEC_OSTBD_L 0x08000000 +#define MOT_TSEC_OSTBD_TC 0x04000000 +#define MOT_TSEC_OSTBD_DEF 0x02000000 +#define MOT_TSEC_OSTBD_LC 0x00800000 +#define MOT_TSEC_OSTBD_RL 0x00400000 +#define MOT_TSEC_OSTBD_RC(r) ((r&0x0000003c)>>18) +#define MOT_TSEC_OSTBD_UN 0x00020000 +#define MOT_TSEC_OSTBD_LEN(l) (l&0x0000ffff) + +#define MOT_TSEC_RCTRL_BC_REJ 0x00000010 +#define MOT_TSEC_RCTRL_PROM 0x00000008 +#define MOT_TSEC_RCTRL_RSF 0x00000004 + +#define MOT_TSEC_RSTAT_QHLT 0x00800000 +#define MOT_TSEC_TDLEN(l) (l&0x0000ffff) +#define MOT_TSEC_RBDLEN(l) (l&0x0000ffff) +#define MOT_TSEC_CRBPTR(p) (p&0xfffffff8) +#define MOT_TSEC_MRBLR(l) (l&0x0000ffc0) +#define MOT_TSEC_RBASE(p) (p&0xfffffff8) + +#define MOT_TSEC_MACCFG1_SOFT_RESET 0x80000000 +#define MOT_TSEC_MACCFG1_RESET_RX_MC 0x00080000 +#define MOT_TSEC_MACCFG1_RESET_TX_MC 0x00040000 +#define MOT_TSEC_MACCFG1_RESET_RX_FUN 0x00020000 +#define MOT_TSEC_MACCFG1_RESET_TX_FUN 0x00010000 +#define MOT_TSEC_MACCFG1_LOOPBACK 0x00000100 +#define MOT_TSEC_MACCFG1_RX_FLOW 0x00000020 +#define MOT_TSEC_MACCFG1_TX_FLOW 0x00000010 +#define MOT_TSEC_MACCFG1_SYNCD_RX_EN 0x00000008 +#define MOT_TSEC_MACCFG1_RX_EN 0x00000004 +#define MOT_TSEC_MACCFG1_SYNCD_TX_EN 0x00000002 +#define MOT_TSEC_MACCFG1_TX_EN 0x00000001 + +#define MOT_TSEC_MACCFG2_PRE_LEN(l) ((l<<12) & 0xf000) +#define MOT_TSEC_MACCFG2_PRE_LEN_GET(r) ((r&0xf000)>>12) +#define MOT_TSEC_MACCFG2_IF_MODE(m) ((m<<8) & 0x0300) +#define MOT_TSEC_MACCFG2_IF_MODE_GET(r) ((r&0x0300)>>8) + +#define MOT_TSEC_MACCFG2_IF_MODE_MASK 0x00000003 +#define MOT_TSEC_MACCFG2_IF_MODE_MII 0x00000001 +#define MOT_TSEC_MACCFG2_IF_MODE_GMII_TBI 0x00000002 +#define MOT_TSEC_MACCFG2_HUGE_FRAME 0x00000020 +#define MOT_TSEC_MACCFG2_LENGTH_CHECK 0x00000010 +#define MOT_TSEC_MACCFG2_PADCRC 0x00000004 +#define MOT_TSEC_MACCFG2_CRC_EN 0x00000002 +#define MOT_TSEC_MACCFG2_FULL_DUPLEX 0x00000001 + +#define MOT_TSEC_IPGIFG_NBBIPG1(l) ((l&0x0000007f)<<24) +#define MOT_TSEC_IPGIFG_NBBIPG2(l) ( (l&0x0000007f)<<16) +#define MOT_TSEC_IPGIFG_MIFGE(l) ((l&0x000000ff)<<8) +#define MOT_TSEC_IPGIFG_BBIPG(l) (l&0x0000007f) + +#define MOT_TSEC_HALDUP_ALTBEB_TRUNC(l) ((l&0x0000000f)<<20) +#define MOT_TSEC_HALFDUP_BEB 0x00080000 +#define MOT_TSEC_HALFDUP_BPNBO 0x00040000 +#define MOT_TSEC_HALFDUP_NBO 0x00020000 +#define MOT_TSEC_HALFDUP_EXCESS_DEF 0x00010000 +#define MOT_TSEC_HALDUP_RETRY(v) ((v&0x0000000F)<<12) +#define MOT_TSEC_HALDUP_COL_WINDOW(w) (w&0x003f) + +#define MOT_TSEC_MAXFRM(l) (l&0x0000ffff) +#define MOT_TSEC_MIIMCFG_RESET 0x80000000 +#define MOT_TSEC_MIIMCFG_NO_PRE 0x00000010 +#define MOT_TSEC_MIIMCFG_MCS(l) (l&0x00000007) +#define MOT_TSEC_MIIMCFG_MCS_2 0x00000000 +#define MOT_TSEC_MIIMCFG_MCS_4 0x00000001 +#define MOT_TSEC_MIIMCFG_MCS_6 0x00000002 +#define MOT_TSEC_MIIMCFG_MCS_8 0x00000003 +#define MOT_TSEC_MIIMCFG_MCS_10 0x00000004 +#define MOT_TSEC_MIIMCFG_MCS_14 0x00000005 +#define MOT_TSEC_MIIMCFG_MCS_20 0x00000006 +#define MOT_TSEC_MIIMCFG_MCS_28 0x00000007 + +#define MOT_TSEC_MIIMCOM_SCAN_CYCLE 0x00000002 +#define MOT_TSEC_MIIMCOM_READ_CYCLE 0x00000001 + +#define MOT_TSEC_MIIMADD_PHYADRS(a) ((a&0x0000001f)<<8) +#define MOT_TSEC_MIIMADD_REGADRS(a) (a&0x0000001f) + +#define MOT_TSEC_MIIMCON_PHY_CTRL(a) (a&0x0000ffff) + +#define MOT_TSEC_MIIMSTAT_PHY(a) (a&0x0000ffff) + +#define MOT_TSEC_MIIMIND_NOT_VALID 0x00000004 +#define MOT_TSEC_MIIMIND_SCAN 0x00000002 +#define MOT_TSEC_MIIMIND_BUSY 0x00000001 + +#define MOT_TSEC_IFSTAT_EXCESS_DEF 0x00000200 + +#define MOT_TSEC_MACSTNADDR1_SA_1 0xff000000 +#define MOT_TSEC_MACSTNADDR1_SA_2 0x00ff0000 +#define MOT_TSEC_MACSTNADDR1_SA_3 0x0000ff00 +#define MOT_TSEC_MACSTNADDR1_SA_4 0x000000ff +#define MOT_TSEC_MACSTNADDR2_SA_5 0xff000000 +#define MOT_TSEC_MACSTNADDR2_SA_6 0x00ff0000 + +/* Transmit Buffer Descriptor bit definitions */ +#define MOT_TSEC_TBD_R 0x8000 +#define MOT_TSEC_TBD_PADCRC 0x4000 +#define MOT_TSEC_TBD_W 0x2000 +#define MOT_TSEC_TBD_I 0x1000 +#define MOT_TSEC_TBD_L 0x0800 +#define MOT_TSEC_TBD_TC 0x0400 +#define MOT_TSEC_TBD_DEF 0x0200 +#define MOT_TSEC_TBD_HFE_LC 0x0080 +#define MOT_TSEC_TBD_HFE_RL 0x0040 +#define MOT_TSEC_TBD_HFE_RC 0x003c +#define MOT_TSEC_TBD_HFE_UN 0x0002 + +/* Receive Buffer Descriptors bit definitions */ +#define MOT_TSEC_RBD_E 0x8000 +#define MOT_TSEC_RBD_RO1 0x4000 +#define MOT_TSEC_RBD_W 0x2000 +#define MOT_TSEC_RBD_I 0x1000 +#define MOT_TSEC_RBD_L 0x0800 +#define MOT_TSEC_RBD_F 0x0400 +#define MOT_TSEC_RBD_M 0x0200 +#define MOT_TSEC_RBD_BC 0x0080 +#define MOT_TSEC_RBD_MC 0x0040 +#define MOT_TSEC_RBD_LG 0x0020 +#define MOT_TSEC_RBD_NO 0x0010 +#define MOT_TSEC_RBD_SH 0x0008 +#define MOT_TSEC_RBD_CR 0x0004 +#define MOT_TSEC_RBD_OV 0x0002 +#define MOT_TSEC_RBD_TR 0x0001 + +#define MOT_TSEC_RBD_ERR (MOT_TSEC_RBD_TR | MOT_TSEC_RBD_OV | \ + MOT_TSEC_RBD_CR | MOT_TSEC_RBD_SH | \ + MOT_TSEC_RBD_NO | MOT_TSEC_RBD_LG) + + +#define MOT_TSEC_ATTR_ELCWT_NA 0x0 +#define MOT_TSEC_ATTR_ELCWT_L2 0x4 +#define MOT_TSEC_ATTR_ELCWT_L2_LOCK 0x6 +#define MOT_TSEC_ATTR_ELCWT(v) ((v&0x00000003)<<13) + +#define MOT_TSEC_ATTR_BDLWT_NA 0x0 +#define MOT_TSEC_ATTR_BDLWT_L2 0x2 +#define MOT_TSEC_ATTR_BDLWT_L2_LOCK 0x3 +#define MOT_TSEC_ATTR_BDLWT(v) ((v&0x00000003)<<10) + +#define MOT_TSEC_ATTR_RDSEN 0x00000080 +#define MOT_TSEC_ATTR_RBDSEN 0x00000040 + +#define MOT_TSEC_ATTRELI_EL(v) ((v&0x00003fff)<<16) +#define MOT_TSEC_ATTRELI_EI(v) (v&0x00003fff) + +/* TSEC init string parameters */ +/* "MMBASE:TSEC_PORT:MAC_ADRS:PHY_DEF_MODES:USER_FLAGS:FUNC_TABLE:EXT_PARMS" */ +/* MMBASE - 85xx local base address. Used as base for driver memory space. + * MAC_ADRS - Mac address in 12 digit format eg. 00-A0-1E-11-22-33 + * PHY_DEF_MODE - Default Attributes passed to the MII driver. + * USER_DEF_MODE - Mandatory initialization user parameters. + * FUNC_TABLE - Table of BSP and Driver callbacks + * PARMS - Address of a structure that contains required initialization + * parameters and driver specific tuning parameters. + * EXT_PARMS - Address of a structure that contains optional initialization + * parameters and driver specific tuning parameters. + */ + +/* MII/PHY PHY_DEF_MODE flags to init the phy driver */ +#define MOT_TSEC_USR_MODE_DEFAULT 0 +#define MOT_TSEC_USR_PHY_NO_AN 0x00000001 /* do not auto-negotiate */ +#define MOT_TSEC_USR_PHY_TBL 0x00000002 /* use negotiation table */ +#define MOT_TSEC_USR_PHY_NO_FD 0x00000004 /* do not use full duplex */ +#define MOT_TSEC_USR_PHY_NO_100 0x00000008 /* do not use 100Mbit speed */ +#define MOT_TSEC_USR_PHY_NO_HD 0x00000010 /* do not use half duplex */ +#define MOT_TSEC_USR_PHY_NO_10 0x00000020 /* do not use 10Mbit speed */ +#define MOT_TSEC_USR_PHY_MON 0x00000040 /* use PHY Monitor */ +#define MOT_TSEC_USR_PHY_ISO 0x00000080 /* isolate a PHY */ + + +/* ECNTRL Ethernet Control */ +#define MOT_TSEC_USR_STAT_CLEAR 0x00000100 /* init + runtime clear mstats*/ +#define MOT_TSEC_USR_STAT_AUTOZ 0x00000200 /* init */ +#define MOT_TSEC_USR_STAT_ENABLE 0x00000400 /* init */ + +/* PHY bus configuration selections */ +#define MOT_TSEC_USR_MODE_MASK 0x0003f800 +#define MOT_TSEC_USR_MODE_TBI 0x00000800 +#define MOT_TSEC_USR_MODE_RTBI 0x00001000 +#define MOT_TSEC_USR_MODE_MII 0x00002000 +#define MOT_TSEC_USR_MODE_GMII 0x00004000 +#define MOT_TSEC_USR_MODE_RGMII 0x00008000 +#define MOT_TSEC_USR_MODE_RGMII_10 0x00010000 +#define MOT_TSEC_USR_MODE_RGMII_100 0x00020000 + +/* TSEC extended initialization parameters */ + +/* Bit flags */ +/* DMACTRL - Configure the DMA block */ +#define MOT_TSEC_TX_SNOOP_EN 0x00000001 /* snoop Tx Clusters */ +#define MOT_TSEC_TX_BD_SNOOP_EN 0x00000002 /* snoop txbds */ +#define MOT_TSEC_TX_WWR 0x00000004 /* init */ +#define MOT_TSEC_TXBD_WOP 0x00000008 /* init */ + +/* RCTRL - Receive Control flags */ +#define MOT_TSEC_BROADCAST_REJECT 0x00000010 /* Broadcast Reject */ +#define MOT_TSEC_PROMISCUOUS_MODE 0x00000008 /* Promiscuous Mode*/ +#define MOT_TSEC_RX_SHORT_FRAME 0x00000004 /* Rx Shorter Frames */ + /* if (frametsecRegsPtr; +#define MOT_TSEC_MII_FRAME_SET(p) TSEC_REG_T * tsecMiiReg = (p)->tsecMiiPtr; +#define MOT_TSEC_IEVENT_REG tsecReg->ievent +#define MOT_TSEC_IMASK_REG tsecReg->imask +#define MOT_TSEC_EDIS_REG tsecReg->edis +#define MOT_TSEC_ECNTRL_REG tsecReg->ecntrl +#define MOT_TSEC_MINFLR_REG tsecReg->minflr +#define MOT_TSEC_PTV_REG tsecReg->ptv +#define MOT_TSEC_DMACTRL_REG tsecReg->dmactrl +#define MOT_TSEC_TBIPA_REG tsecReg->tbipa +#define MOT_TSEC_FIFO_TX_THR_REG tsecReg->fifoTxTheshold +#define MOT_TSEC_FIFO_TX_STARVE_REG tsecReg->fifoTxStarve +#define MOT_TSEC_FIFO_TX_STARVE_SHUTOFF_REG tsecReg->fifoTxStarveShutoff +#define MOT_TSEC_TCTRL_REG tsecReg->tctrl +#define MOT_TSEC_TSTAT_REG tsecReg->tstat +#define MOT_TSEC_TBDLEN_REG tsecReg->tbdlen +#define MOT_TSEC_TXIC_REG tsecReg->txic +#define MOT_TSEC_CTBPTR_REG tsecReg->ctbptr +#define MOT_TSEC_TBPTR_REG tsecReg->tbptr +#define MOT_TSEC_TBASE_REG tsecReg->tbase +#define MOT_TSEC_OSTBD_REG tsecReg->ostbd +#define MOT_TSEC_OSTBDP_REG tsecReg->ostbdp +#define MOT_TSEC_RCTRL_REG tsecReg->rctrl +#define MOT_TSEC_RSTAT_REG tsecReg->rstat +#define MOT_TSEC_RBDLEN_REG tsecReg->rbdlen +#define MOT_TSEC_CRBPTR_REG tsecReg->crbptr +#define MOT_TSEC_MRBLR_REG tsecReg->mrblr +#define MOT_TSEC_RBPTR_REG tsecReg->rbptr +#define MOT_TSEC_RBASE_REG tsecReg->rbase +#define MOT_TSEC_MACCFG1_REG tsecReg->maccfg1 +#define MOT_TSEC_MACCFG2_REG tsecReg->maccfg2 +#define MOT_TSEC_IPGIFG_REG tsecReg->ipgifgi +#define MOT_TSEC_HAFDUP_REG tsecReg->hafdup +#define MOT_TSEC_MAXFRM_REG tsecReg->maxfrm +#define MOT_TSEC_MIIMCFG_REG tsecMiiReg->miicfg +#define MOT_TSEC_MIIMCOM_REG tsecMiiReg->miicom +#define MOT_TSEC_MIIMADD_REG tsecMiiReg->miimadd +#define MOT_TSEC_MIIMCON_REG tsecMiiReg->miimcon +#define MOT_TSEC_MIIMSTAT_REG tsecMiiReg->miimstat +#define MOT_TSEC_MIIMIND_REG tsecMiiReg->miimind +#define MOT_TSEC_IFSTAT_REG tsecReg->ifstat +#define MOT_TSEC_MACSTNADDR1_REG tsecReg->macstnaddr1 +#define MOT_TSEC_MACSTNADDR2_REG tsecReg->macstnaddr2 +#define MOT_TSEC_TR64_REG tsecReg->tr64 +#define MOT_TSEC_TR127_REG tsecReg->tr127 +#define MOT_TSEC_TR255_REG tsecReg->tr255 +#define MOT_TSEC_TR511_REG tsecReg->tr511 +#define MOT_TSEC_TR1K_REG tsecReg->tr1k +#define MOT_TSEC_TRMAX_REG tsecReg->trmax +#define MOT_TSEC_TRMGV_REG tsecReg->trmgv +#define MOT_TSEC_RBYT_REG tsecReg->rbyt +#define MOT_TSEC_RPKT_REG tsecReg->rpkt +#define MOT_TSEC_RFCS_REG tsecReg->rfcs +#define MOT_TSEC_RMCA_REG tsecReg->rmca +#define MOT_TSEC_RBCA_REG tsecReg->rbca +#define MOT_TSEC_RXCF_REG tsecReg->rxcf +#define MOT_TSEC_RXPF_REG tsecReg->rxpf +#define MOT_TSEC_RXUO_REG tsecReg->rxuo +#define MOT_TSEC_RALN_REG tsecReg->raln +#define MOT_TSEC_RFLR_REG tsecReg->rflr +#define MOT_TSEC_RCDE_REG tsecReg->rcde +#define MOT_TSEC_RCSE_REG tsecReg->rcse +#define MOT_TSEC_RUND_REG tsecReg->rund +#define MOT_TSEC_ROVR_REG tsecReg->rovr +#define MOT_TSEC_RFGR_REG tsecReg->rfgr +#define MOT_TSEC_RJBR_REG tsecReg->rjbr +#define MOT_TSEC_RDRP_REG tsecReg->rdrp + +#define MOT_TSEC_TBYT_REG tsecReg->tbyt +#define MOT_TSEC_TPKT_REG tsecReg->tpkt +#define MOT_TSEC_TMCA_REG tsecReg->tmca +#define MOT_TSEC_TBCA_REG tsecReg->tbca +#define MOT_TSEC_TXPF_REG tsecReg->txpf +#define MOT_TSEC_TDFR_REG tsecReg->tdfr +#define MOT_TSEC_TEDF_REG tsecReg->tedf +#define MOT_TSEC_TSCL_REG tsecReg->tscl +#define MOT_TSEC_TMCL_REG tsecReg->tmcl +#define MOT_TSEC_TLCL_REG tsecReg->tlcl +#define MOT_TSEC_TXCL_REG tsecReg->txcl +#define MOT_TSEC_TNCL_REG tsecReg->tncl + +#define MOT_TSEC_TDRP_REG tsecReg->tdrp +#define MOT_TSEC_TJBR_REG tsecReg->tjbr +#define MOT_TSEC_TFCS_REG tsecReg->tfcs +#define MOT_TSEC_TFCF_REG tsecReg->tfcf +#define MOT_TSEC_TOVR_REG tsecReg->tovr +#define MOT_TSEC_TUND_REG tsecReg->tund +#define MOT_TSEC_TFGR_REG tsecReg->tfrg + +#define MOT_TSEC_CAR1_REG tsecReg->car1 +#define MOT_TSEC_CAR2_REG tsecReg->car2 +#define MOT_TSEC_CAM1_REG tsecReg->cam1 +#define MOT_TSEC_CAM2_REG tsecReg->cam2 + +#define MOT_TSEC_IADDR_REG tsecReg->iaddr +#define MOT_TSEC_IADDR0_REG tsecReg->iaddr[0] +#define MOT_TSEC_IADDR1_REG tsecReg->iaddr[1] +#define MOT_TSEC_IADDR2_REG tsecReg->iaddr[2] +#define MOT_TSEC_IADDR3_REG tsecReg->iaddr[3] +#define MOT_TSEC_IADDR4_REG tsecReg->iaddr[4] +#define MOT_TSEC_IADDR5_REG tsecReg->iaddr[5] +#define MOT_TSEC_IADDR6_REG tsecReg->iaddr[6] +#define MOT_TSEC_IADDR7_REG tsecReg->iaddr[7] + +#define MOT_TSEC_GADDR_REG tsecReg->gaddr +#define MOT_TSEC_GADDR0_REG tsecReg->gaddr[0] +#define MOT_TSEC_GADDR1_REG tsecReg->gaddr[1] +#define MOT_TSEC_GADDR2_REG tsecReg->gaddr[2] +#define MOT_TSEC_GADDR3_REG tsecReg->gaddr[3] +#define MOT_TSEC_GADDR4_REG tsecReg->gaddr[4] +#define MOT_TSEC_GADDR5_REG tsecReg->gaddr[5] +#define MOT_TSEC_GADDR6_REG tsecReg->gaddr[6] +#define MOT_TSEC_GADDR7_REG tsecReg->gaddr[7] + +#define MOT_TSEC_ATTR_REG tsecReg->attr +#define MOT_TSEC_ATTRELI_REG tsecReg->attreli + +/* TBI registers */ +#define MOT_TSEC_TBI_SR_REG MOT_TSEC_TBIPA_REG + 1 + + +/* Driver State Variables */ + +#define MOT_TSEC_STATE_INIT 0x00 +#define MOT_TSEC_STATE_NOT_LOADED 0x00 +#define MOT_TSEC_STATE_LOADED 0x01 +#define MOT_TSEC_STATE_NOT_RUNNING 0x00 +#define MOT_TSEC_STATE_RUNNING 0x02 + +/* Internal driver flags */ + +#define MOT_TSEC_OWN_BUF_MEM 0x01 /* internally provided memory for data*/ +#define MOT_TSEC_INV_TBD_NUM 0x02 /* invalid tbdNum provided */ +#define MOT_TSEC_INV_RBD_NUM 0x04 /* invalid rbdNum provided */ +#define MOT_TSEC_POLLING 0x08 /* polling mode */ +#define MOT_TSEC_PROM 0x20 /* promiscuous mode */ +#define MOT_TSEC_MCAST 0x40 /* multicast addressing mode */ +#define MOT_TSEC_FD 0x80 /* full duplex mode */ +#define MOT_TSEC_OWN_BD_MEM 0x10 /* internally provided memory for BDs */ +#define MOT_TSEC_MIN_TX_PKT_SZ 100 /* the smallest packet we send */ + +#define MOT_TSEC_CL_NUM_DEFAULT 128 /* number of tx clusters */ +#define MOT_TSEC_CL_MULTIPLE 11 /* ratio of clusters to RBDs */ +#define MOT_TSEC_TBD_NUM_DEFAULT 32 /* default number of TBDs */ +#define MOT_TSEC_RBD_NUM_DEFAULT 32 /* default number of RBDs */ +#define MOT_TSEC_TX_POLL_NUM 1 /* one TBD for poll operation */ + +#define MOT_TSEC_CL_OVERHEAD 4 /* prepended cluster overhead */ +#define MOT_TSEC_CL_ALIGNMENT 64 /* cluster required alignment */ +#define MOT_TSEC_CL_SIZE 1536 /* cluster size */ +#define MOT_TSEC_MBLK_ALIGNMENT 64 /* mBlks required alignment */ +#define MOT_TSEC_BD_SIZE 0x8 /* size of TSEC BD */ +#define MOT_TSEC_BD_ALIGN 64 /* required alignment for BDs */ +#define MOT_TSEC_BUF_ALIGN 64 /* required alignment for data buffer */ +/* + * the total is 0x630 and it accounts for the required alignment + * of receive data buffers, and the cluster overhead. + */ +#define XXX_TSEC_MAX_CL_LEN ((MII_ETH_MAX_PCK_SZ \ + + (MOT_TSEC_BUF_ALIGN - 1) \ + + MOT_TSEC_BUF_ALIGN \ + + (MOT_TSEC_CL_OVERHEAD - 1)) \ + & (~ (MOT_TSEC_CL_OVERHEAD - 1))) + +#define MOT_TSEC_MAX_CL_LEN ROUND_UP(XXX_TSEC_MAX_CL_LEN,MOT_TSEC_BUF_ALIGN) + +#define MOT_TSEC_RX_CL_SZ (MOT_TSEC_MAX_CL_LEN) +#define MOT_TSEC_TX_CL_SZ (MOT_TSEC_MAX_CL_LEN) + +/* BIT mask defines for hardware specific PHY events. */ +#define MOT_TSEC_PHY_EVENT_AUTONEG_ERROR 0x0001 +#define MOT_TSEC_PHY_EVENT_SPEED 0x0002 +#define MOT_TSEC_PHY_EVENT_DUPLEX 0x0004 +#define MOT_TSEC_PHY_EVENT_AUTONEG_COMPLETE 0x0008 +#define MOT_TSEC_PHY_EVENT_LINK 0x0010 +#define MOT_TSEC_PHY_EVENT_SYMBOL_ERROR 0x0020 +#define MOT_TSEC_PHY_EVENT_FALSE_CARRIER 0x0040 +#define MOT_TSEC_PHY_EVENT_FIFO_ERROR 0x0080 +#define MOT_TSEC_PHY_EVENT_XOVER 0x0100 +#define MOT_TSEC_PHY_EVENT_DOWNSHIFT 0x0200 +#define MOT_TSEC_PHY_EVENT_POLARITY 0x0400 +#define MOT_TSEC_PHY_EVENT_JABBER 0x0800 + +/* PHY Access definitions */ +#define MOT_TSEC_PHY_GIG_STATUS_REG 0xa +#define MOT_TSEC_PHY_1000_M_LINK_FD 0x0800 +#define MOT_TSEC_PHY_1000_M_LINK_OK 0x1000 + +#define MOT_TSEC_PHY_LINK_STATUS 0x5 +#define MOT_TSEC_PHY_10_M_LINK_FD 0x0040 +#define MOT_TSEC_PHY_100_M_LINK_FD 0x0100 + +typedef struct + { + UINT8 autonegError; /* 0-N/A, 0 - none, 1- error */ + UINT8 duplex; /* 1 - half, 2- full */ +#define MOT_TSEC_PHY_DUPLEX_HALF (1) +#define MOT_TSEC_PHY_DUPLEX_FULL (2) + UINT8 speed; /* 0-N/A, 1 - 10, 2- 100, 3 -1G */ +#define MOT_TSEC_PHY_SPEED_10 (1) +#define MOT_TSEC_PHY_SPEED_100 (2) +#define MOT_TSEC_PHY_SPEED_1000 (3) + UINT8 link; /* 0-N/A, 1 - down, 2- up */ + UINT8 symbolError; /* 0-N/A, 1 - none, 2- error */ + UINT8 autoNegComplete; /* 0-N/A, 1 - no, 2- completed */ + UINT8 energyDetect; /* 0-N/A, 1 - no, 2- detected */ + UINT8 falseCarrier; /* 0-N/A, 1 - no, 2- detected */ + UINT8 downShift; /* 0-N/A, 1 - no, 2- detected */ + UINT8 fifoError; /* 0-N/A, 1 - none, 2- error */ + UINT8 xover; /* 0-N/A, 1 - MDI, 2- MDIX */ + UINT8 polarity; /* 0-N/A, 1 - normal, 2- reversed */ + UINT8 jabber; /* 0-N/A, 1 - no, 2- detected */ + UINT8 pageReceived; /* 0-N/A, 1 - no, 2- detected */ + UINT8 cableLength; /* 0-N/A */ + UINT8 txPause; /* 0-N/A, 1 - no, 2- detected */ + UINT8 rxPause; /* 0-N/A, 1 - no, 2- detected */ + UINT8 farEndFault; /* 0-N/A, 1 - no, 2- detected */ + UINT32 rxErrorCntr; /* 0-N/A, number of rx errors */ + UINT32 reserved[4]; /* future use */ + } MOT_TSEC_PHY_STATUS; + +/* The definition of the driver control structure */ + +typedef struct tsec_drv_ctrl + { + END_OBJ endObj; /* base class */ + TSEC_REG_T * tsecRegsPtr; /* pointer to TSEC registers */ + UINT32 unit; /* unit number 0 or 1*/ + ENET_ADDR enetAddr; /* current Ethernet Address */ + UINT32 inum_tsecTx; /* TSEC Tx interrupt num */ + UINT32 inum_tsecRx; /* TSEC Rx interrupt num */ + UINT32 inum_tsecErr; /*TSEC Err interrupt num */ + FUNCPTR inumToIvec; /* Conversion utility */ + FUNCPTR ivecToInum; /* Conversion utility */ + UINT32 initFlags; /* user init flags */ + UINT32 userFlags; + UINT32 pollCnt; /* polling counter */ + UINT32 pollLoops; /* polling limit */ + UINT maxRxFrames; /* max frames to Receive in one job */ + int initType; /* netPoolInit() or netPoolCreate() */ + NETBUF_CFG * pNetBufCfg; +#ifdef USE_NET_JOB_ADD + volatile BOOL rxJobQued; + volatile UINT32 txHandlerQued; +#endif + UINT32 retries; + UINT32 maxRetries; + + /* phy init parameter table */ + MOT_TSEC_PHY_PARAMS * phyInit; + + /* Bsp specific functions and call backs */ + MOT_TSEC_FUNC_TABLE * initFuncs; + + /* Driver specific init parameters */ + MOT_TSEC_PARAMS * initParms; + + /* TSEC hardware specific init parameters */ + MOT_TSEC_EXT_PARAMS * initParmsExt; + + /* Interrupt Controller Specific info */ + MOT_TSEC_INT_CTRL *intCtrl; + + TSEC_REG_T * tsecMiiPtr; /* pointer to TSEC Mii registers */ + + UINT32 tsecNum; /* physical TSEC 0 or 1 */ + + UINT32 fifoTxBase; /* address of Tx FIFO in internal RAM */ + UINT32 fifoRxBase; /* address of Rx FIFO in internal RAM */ + + char * pBufAlloc; /* Allocated TSEC memory pool base */ + char * pBufBase; /* Rounded TSEC memory pool base */ + UINT32 bufSize; /* TSEC memory pool size */ + + TSEC_BD * pBdAlloc; /* TSEC BDs Alloc pointer */ + TSEC_BD * pBdBase; /* TSEC BDs base */ + UINT32 bdSize; /* TSEC BDs size */ + + /* receive buffer descriptor management */ + + UINT32 rbdNum; /* number of RX bd's */ + + JOB_QUEUE_ID jobQueueId; /* Job queue to post to */ +#ifndef USE_NET_JOB_ADD + QJOB rxJob; +#endif + TSEC_BD * pRbdBase; /* RBD ring */ + UINT32 rbdIndex; + UINT32 rbdMask; + M_BLK_ID * pMblkList; /* allocated clusters */ + + /* transmit buffer descriptor management */ + +#ifndef USE_NET_JOB_ADD + QJOB txJob; +#endif + UINT16 tbdNum; /* number of TX bd's */ + UINT16 tbdFree; + TSEC_BD * pTbdBase; /* TBD ring base */ + M_BLK ** tBufList; /* allocated clusters */ + UINT32 tbdMask; + UINT32 tbdIndex; + UINT32 tbdCleanIndex; + UINT16 txUnStallThresh; /* tx reclaim threshold */ + UINT16 txStallThresh; /* tx low water threshold */ + + UINT16 tbiAdr; /* tbi interface address */ + UINT32 phyFlags; /* Phy flags */ + UINT32 flags; /* driver flags */ + UINT32 state; /* driver state including load flag */ + UINT32 intMask; /* interrupt mask register */ + UINT32 intErrorMask; /* interrupt error mask register */ + UCHAR * pTxPollBuf; /* cluster pointer for poll mode */ + M_BLK_ID pTxPollMblk; + /* transmit command */ + char * pClBlkArea; /* cluster block pointer */ + UINT32 clBlkSize; /* clusters block memory size */ + char * pMBlkArea; /* mBlock area pointer */ + UINT32 mBlkSize; /* mBlocks area memory size */ + CACHE_FUNCS bufCacheFuncs; /* cache descriptor */ + CL_POOL_ID pClPoolId; /* cluster pool identifier */ + PHY_INFO * phyInfo; /* info on a MII-compliant PHY */ + + BOOL lscHandling; + BOOL txStall; /* tx handler stalled - no Tbd */ + + /* function pointers to support unit testing */ + +#ifdef USE_NET_JOB_ADD + FUNCPTR netJobAdd; +#endif + FUNCPTR muxTxRestart; + FUNCPTR muxError; + + /* Bsp specific functions and call backs */ + + FUNCPTR phyInitFunc; /* BSP Phy Init */ + FUNCPTR phyStatusFunc; /* Status Get function */ + FUNCPTR miiPhyRead; /* mii Read */ + FUNCPTR miiPhyWrite; /* mii Write */ + FUNCPTR enetEnable; /* enable ethernet */ + FUNCPTR enetDisable; /* disable ethernet */ + FUNCPTR enetAddrGet; /* get ethernet address */ + FUNCPTR enetAddrSet; /* set ethernet Address */ + FUNCPTR extWriteL2AllocFunc; /* Use ext write alloc L2 for Tx BD */ +#ifdef MOT_TSEC_DBG + TSEC_DRIVER_STATS *stats; +#endif + UINT32 missedCnt; + UINT32 passCnt; + UINT32 packetCnt; + UINT32 starveCnt; + UINT32 busyMissed; + BOOL busyState; + END_IFDRVCONF endStatsConf; + END_IFCOUNTERS endStatsCounters; + } TSEC_DRV_CTRL; + + +IMPORT STATUS cacheInvalidate (CACHE_TYPE, void *, size_t); +IMPORT STATUS cacheFlush (CACHE_TYPE, void *, size_t); +IMPORT int intEnable (int); +IMPORT int intDisable (int); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmotTsecEndh */ + diff --git a/h/drv/end/ne2000End.h b/h/drv/end/ne2000End.h new file mode 100644 index 0000000..f9f6dcd --- /dev/null +++ b/h/drv/end/ne2000End.h @@ -0,0 +1,201 @@ +/* ne2000End.h - Novell/Eagle 2000 network interface header */ + +/* Copyright 1984-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,02dec02,m_h PSTOP is not 0x80 on 8 bit devices (80785) +01c,11jun00,ham removed reference to etherLib. +01b,28may00,dat added more macros, gen clean up +01a,16mar98,mem written, based on drv/netif/if_ene.h +*/ + + +#ifndef __INCne2000Endh +#define __INCne2000Endh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "netinet/if_ether.h" + +#define EADDR_LEN 6 +#define NE2000_BUFSIZ (ETHERMTU + SIZEOF_ETHERHEADER + EADDR_LEN) + +/* NE 2000 on-board memory page addresses */ + +#define NE2000_CONFIG_PAGE 0x00 /* where the Ethernet address is */ +#define NE2000_EADDR_LOC 0x00 /* location within config. page */ +#define NE2000_TSTART 0x40 +#define NE2000_PSTART 0x46 +#define NE2000_PSTOP16 0x80 +#define NE2000_PSTOP8 0x60 +#define NE2000_PSTOP NE2000_PSTOP16 + +#define ENE_PAGESIZE 256 + +typedef struct + { + UCHAR rstat; + UCHAR next; + UCHAR lowByteCnt; + UCHAR uppByteCnt; + } NE2000_HEADER; + +/* NS 8390 (Ethernet LAN Controller) */ + +/* page-0, read */ + +#define ENE_CMD 0x00 /* command */ +#define ENE_TRINCRL 0x01 /* TRDMA incrementer */ +#define ENE_TRINCRH 0x02 /* TRDMA incrementer */ +#define ENE_BOUND 0x03 /* boundary page */ +#define ENE_TSTAT 0x04 /* transmit status */ +#define ENE_COLCNT 0x05 /* collision error */ +#define ENE_INTSTAT 0x07 /* interrupt status */ +#define ENE_RSTAT 0x0c /* receive status */ +#define ENE_ALICNT 0x0d /* alignment error */ +#define ENE_CRCCNT 0x0e /* crc error */ +#define ENE_MPCNT 0x0f /* missed packet */ + +/* page-0, write */ + +#define ENE_RSTART 0x01 /* receive start */ +#define ENE_RSTOP 0x02 /* receive stop */ +#define ENE_TSTART 0x04 /* transmit start */ +#define ENE_TCNTL 0x05 /* transmit counter */ +#define ENE_TCNTH 0x06 /* transmit counter */ +#define ENE_RSAR0 0x08 /* remote address */ +#define ENE_RSAR1 0x09 /* remote address */ +#define ENE_RBCR0 0x0a /* remote byte count */ +#define ENE_RBCR1 0x0b /* remote byte count */ +#define ENE_RCON 0x0c /* receive config */ +#define ENE_TCON 0x0d /* transmit config */ +#define ENE_DCON 0x0e /* data config */ +#define ENE_INTMASK 0x0f /* interrupt mask */ + +/* page-1, read and write */ + +#define ENE_STA0 0x01 /* station address */ +#define ENE_STA1 0x02 /* station address */ +#define ENE_STA2 0x03 /* station address */ +#define ENE_STA3 0x04 /* station address */ +#define ENE_STA4 0x05 /* station address */ +#define ENE_STA5 0x06 /* station address */ +#define ENE_CURR 0x07 /* current page */ +#define ENE_MAR0 0x08 /* multicast address */ +#define ENE_MAR1 0x09 /* multicast address */ +#define ENE_MAR2 0x0a /* multicast address */ +#define ENE_MAR3 0x0b /* multicast address */ +#define ENE_MAR4 0x0c /* multicast address */ +#define ENE_MAR5 0x0d /* multicast address */ +#define ENE_MAR6 0x0e /* multicast address */ +#define ENE_MAR7 0x0f /* multicast address */ + +/* page-2, read and write */ + +#define ENE_NEXT 0x05 /* next page */ +#define ENE_BLOCK 0x06 /* block address */ +#define ENE_ENH 0x07 /* enable features */ + +/* NE2000 board registers */ + +#define ENE_DATA 0x10 /* data window */ +#define ENE_RESET 0x1f /* read here to reset */ + + +/* COMMAND: Command Register */ +#define CMD_PAGE2 0x80 +#define CMD_PAGE1 0x40 +#define CMD_PAGE0 0x00 +#define CMD_NODMA 0x20 +#define CMD_RWRITE 0x10 +#define CMD_RREAD 0x08 +#define CMD_TXP 0x04 +#define CMD_START 0x02 +#define CMD_STOP 0x01 + +/* RCON: Receive Configuration Register */ +#define RCON_MON 0x20 +#define RCON_PROM 0x10 +#define RCON_GROUP 0x08 +#define RCON_BROAD 0x04 +#define RCON_RUNTS 0x02 +#define RCON_SEP 0x01 + +/* TCON: Transmit Configuration Register */ +#define TCON_LB1 0x04 +#define TCON_LB0 0x02 +#define TCON_CRCN 0x01 +#define TCON_NORMAL 0x00 /* normal operation mode */ + +/* DCON: Data Configuration Register */ +#define DCON_BSIZE1 0x40 +#define DCON_BSIZE0 0x20 +#define DCON_AUTO_INIT 0x10 +#define DCON_LOOPBK_OFF 0x08 +#define DCON_LOOPBK_ON 0x00 +#define DCON_DMA_32 0x04 +#define DCON_DMA_16 0x00 +#define DCON_BIG_ENDIAN 0x02 +#define DCON_LITTLE_ENDIAN 0x00 +#define DCON_BUS16 0x01 +#define DCON_BUS_8 0x00 + +/* INTMASK: Interrupt Mask Register */ +#define IM_XDCE 0x40 +#define IM_CNTE 0x20 +#define IM_OVWE 0x10 +#define IM_TXEE 0x08 +#define IM_RXEE 0x04 +#define IM_PTXE 0x02 +#define IM_PRXE 0x01 + +/* INTSTAT: Interrupt Status Register */ +#define ISTAT_RST 0x80 +#define ISTAT_RDC 0x40 /* remote DMA complete */ +#define ISTAT_CNT 0x20 +#define ISTAT_OVW 0x10 +#define ISTAT_TXE 0x08 +#define ISTAT_RXE 0x04 +#define ISTAT_PTX 0x02 +#define ISTAT_PRX 0x01 + +/* TSTAT: Transmit Status Register */ +#define TSTAT_OWC 0x80 +#define TSTAT_CDH 0x40 +#define TSTAT_UNDER 0x20 +#define TSTAT_CRL 0x10 +#define TSTAT_ABORT 0x08 +#define TSTAT_TWC 0x04 +#define TSTAT_NDT 0x02 +#define TSTAT_PTX 0x01 + +/* RSTAT: Receive Status Register */ +#define RSTAT_DFR 0x80 +#define RSTAT_DIS 0x40 +#define RSTAT_GROUP 0x20 +#define RSTAT_MPA 0x10 +#define RSTAT_OVER 0x08 +#define RSTAT_FAE 0x04 +#define RSTAT_CRC 0x02 +#define RSTAT_PRX 0x01 + +/* ENH: Enable Features */ +#define ENH_WAIT1 0x80 +#define ENH_WAIT0 0x40 +#define ENH_SLOT1 0x10 +#define ENH_SLOT0 0x08 + +/* flags - software synchronize bit definitions */ +#define TXING 0x01 +#define RXING 0x02 +#define TXREQ 0x04 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCne2000Endh */ diff --git a/h/drv/end/nicEvbEnd.h b/h/drv/end/nicEvbEnd.h new file mode 100644 index 0000000..81271d0 --- /dev/null +++ b/h/drv/end/nicEvbEnd.h @@ -0,0 +1,242 @@ +/* nicEvbEnd.h - NIC driver header (for EVB403) */ + +/* Copyright 1984-1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,20jan99,sut from netif/if_nicEvb.h +*/ + +#ifndef __INCnicEvbEndh +#define __INCnicEvbEndh + +#ifdef __cplusplus +extern "C" { +#endif + +/* driver flags */ +typedef UINT8 NIC_DRV_FLAG; + +#define NIC_FLAG_POLL 0x01 + +typedef union nic_regs +{ + u_char reg [16]; + struct + { + volatile u_char cr; + volatile u_char pstart; + volatile u_char pstop; + volatile u_char bnry; + volatile u_char tpsr; + volatile u_char tbcr0; + volatile u_char tbcr1; + volatile u_char isr; + volatile u_char rsar0; + volatile u_char rsar1; + volatile u_char rbcr0; + volatile u_char rbcr1; + volatile u_char rcr; + volatile u_char tcr; + volatile u_char dcr; + volatile u_char imr; + } nic_pg0; + struct + { + volatile u_char cr; + volatile u_char par0; + volatile u_char par1; + volatile u_char par2; + volatile u_char par3; + volatile u_char par4; + volatile u_char par5; + volatile u_char curr; + volatile u_char mar0; + volatile u_char mar1; + volatile u_char mar2; + volatile u_char mar3; + volatile u_char mar4; + volatile u_char mar5; + volatile u_char mar6; + volatile u_char mar7; + } nic_pg1; +} NIC_DEVICE; + +/* Page 1 offsets IR - Internal Register */ +#define NIC_IR_CR 0x00 /* Command register */ +#define NIC_IR_PAR0 0x01 /* Phsical Address Register 0 */ +#define NIC_IR_PAR1 0x02 /* Phsical Address Register 1 */ +#define NIC_IR_PAR2 0x03 /* Phsical Address Register 2 */ +#define NIC_IR_PAR3 0x04 /* Phsical Address Register 3 */ +#define NIC_IR_PAR4 0x05 /* Phsical Address Register 4 */ +#define NIC_IR_PAR5 0x06 /* Phsical Address Register 5 */ +#define NIC_IR_CURR 0x07 /* Current Page Register */ +#define NIC_IR_MAR0 0x08 /* Multicast Address Register 0 */ +#define NIC_IR_MAR1 0x09 /* Multicast Address Register 1 */ +#define NIC_IR_MAR2 0x0a /* Multicast Address Register 2 */ +#define NIC_IR_MAR3 0x0b /* Multicast Address Register 3 */ +#define NIC_IR_MAR4 0x0c /* Multicast Address Register 4 */ +#define NIC_IR_MAR5 0x0d /* Multicast Address Register 5 */ +#define NIC_IR_MAR6 0x0e /* Multicast Address Register 6 */ +#define NIC_IR_MAR7 0x0f /* Multicast Address Register 7 */ + +#define Cr nic_pg0.cr +#define Pstart nic_pg0.pstart +#define Pstop nic_pg0.pstop +#define Bnry nic_pg0.bnry +#define Tpsr nic_pg0.tpsr +#define Tsr nic_pg0.tpsr +#define Tbcr0 nic_pg0.tbcr0 +#define Tbcr1 nic_pg0.tbcr1 +#define Isr nic_pg0.isr +#define Rsar0 nic_pg0.rsar0 +#define Rsar1 nic_pg0.rsar1 +#define Rbcr0 nic_pg0.rbcr0 +#define Rbcr1 nic_pg0.rbcr1 +#define Rcr nic_pg0.rcr +#define Rsr nic_pg0.rcr +#define Tcr nic_pg0.tcr +#define Dcr nic_pg0.dcr +#define Imr nic_pg0.imr + +#define Par0 nic_pg1.par0 +#define Par1 nic_pg1.par1 +#define Par2 nic_pg1.par2 +#define Par3 nic_pg1.par3 +#define Par4 nic_pg1.par4 +#define Par5 nic_pg1.par5 +#define Curr nic_pg1.curr + +#define NIC_BASE 0xf4000000 +#define NIC_PORT 0xf4000010 +#define NIC_ACC 0xf4000030 +#define NIC_DMA 0xf4000020 + +#define NICRAM_BOT 0x8000 +#define NICRAM_TOP 0xFFFF +#define NICROM_BOT 0x0000 +#define NICROM_TOP 0x001F +#define NICROMSIZ (NICROM_TOP - NICROM_BOT) +#define NICRAMSIZ (NICRAM_TOP - NICRAM_BOT) + +#define PBMASK 0xc0 /* XXX */ +#define ACC_MASK 0x01 /* XXX */ +#define PACKET_SIZE 256 + + +#define PSTART 8 +#define PSTOP 32 +#define MAXXMT 10 +#define BNRY PSTART +#define CURR PSTART+1 +#define XMTBUF 0xe100 + +/* + * CR Register bits (SAME) + */ + +#define STP 0x1 +#define STA 0x2 +#define TXP 0x4 +#define RREAD 0x8 +#define RWRITE 0x10 +#define SPKT 0x18 +#define ABORT 0x20 +#define RPAGE0 0x00 +#define RPAGE1 0x40 +#define RPAGE2 0x80 + +/* + * ISR Register (SAME) + */ + +#define PRX 0x1 +#define PTX 0x2 +#define RXE 0x4 +#define TXE 0x8 +#define OVW 0x10 +#define CNT 0x20 +#define RDC 0x40 +#define RST 0x80 + +/* + * IMR(SAme) + */ + +#define PRXE 0x1 +#define PTXE 0x2 +#define RXEE 0x4 +#define TXEE 0x8 +#define OVWE 0x10 +#define CNTE 0x20 +#define RDCE 0x40 + +/* + * DCR + */ + +#define WTS 0x1 +#define BOS 0x2 +#define LAS 0x4 +#define NOTLS 0x8 +#define DCR_ARM 0x10 +#define FIFO2 0x00 +#define FIFO4 0x20 +#define FIFO8 0x40 +#define FIFO12 0x60 + +/* + * TCR + */ + +#define CRC 0x1 +#define MODE0 0x0 +#define MODE1 0x2 +#define MODE2 0x4 +#define MODE3 0x6 +#define ATD 0x8 +#define OFST 0x10 + +/* + * TSR + */ + +#define TPTX 0x1 +#define COL 0x4 +#define ABT 0x8 +#define CRS 0x10 +#define FU 0x20 +#define CDH 0x40 +#define OWC 0x80 + +/* + * RCR + */ + +#define SEP 0x1 +#define AR 0x2 +#define AB 0x4 +#define AM 0x8 +#define PRO 0x10 +#define MON 0x20 + +/* + * RSR + */ + +#define CRCR 0x2 +#define FAE 0x4 +#define FO 0x8 +#define MPA 0x10 +#define PHY 0x20 +#define DIS 0x40 +#define DFR 0x80 + +#define MINPKTSIZE 64 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnicEvbEndh */ diff --git a/h/drv/end/ns83902End.h b/h/drv/end/ns83902End.h new file mode 100644 index 0000000..13ab9aa --- /dev/null +++ b/h/drv/end/ns83902End.h @@ -0,0 +1,189 @@ +/* ns83902End.h - NIC driver header */ + +/* Copyright 1984-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,11apr00,zl added more register definitions +01b,10apr00,zl renamed file to ns83902End.h, cleaned up +01a,20jan99,zl written based on nicEvbEnd.h +*/ + +#ifndef __INCns83902Endh +#define __INCns83902Endh + +#ifdef __cplusplus +extern "C" { +#endif + +/* driver flags */ + +typedef UINT8 NS83902_DRV_FLAG; + +#define NS83902_FLAG_POLL 0x01 /* for poll mode */ + +#define NS83902_WIDE_MASK 0x01 /* option bit 0 (LSB) */ +#define NS83902_INTERVAL_MASK 0x02 /* option bit 1 */ +#define MINPKTSIZE 64 /* Minimum packet size */ +#define NS83902_PAGE_SIZE 256 /* Page size in buffer memory */ +#define NS83902_TX_POOL_SIZE 1514 /* TX pool size */ + +/* Page 0 Internal register offsets */ + +#define NS83902_CR 0x00 /* R/W: Command Register R/W */ +#define NS83902_PSTART 0x01 /* W: Page Start Register */ +#define NS83902_CLDA0 0x01 /* R: Current Local DMA Address0 */ +#define NS83902_PSTOP 0x02 /* W: Page Stop Register */ +#define NS83902_CLDA1 0x02 /* R: Current Local DMA Address1 */ +#define NS83902_BNRY 0x03 /* R/W: Boundary Pointer Register */ +#define NS83902_TPSR 0x04 /* W: Transmit Page Start Register */ +#define NS83902_TSR 0x04 /* R: Transmit Status Register */ +#define NS83902_TBCR0 0x05 /* W: Transmit Byte Count0 Register */ +#define NS83902_NCR 0x05 /* R: Number of Collisions */ +#define NS83902_TBCR1 0x06 /* W: Transmit Byte Count1 Register */ +#define NS83902_FIFO 0x06 /* R: FIFO Register */ +#define NS83902_ISR 0x07 /* R/W: Interrup Status Register */ +#define NS83902_RSAR0 0x08 /* W: Remote Start Address0 Register */ +#define NS83902_CRDA0 0x08 /* R: Current Remote DMA Address0 Reg.*/ +#define NS83902_RSAR1 0x09 /* W: Remote Start Address1 Register */ +#define NS83902_CRDA1 0x09 /* R: Current Remote DMA Address1 Reg.*/ +#define NS83902_RBCR0 0x0A /* W: Remote Byte Count0 Register */ +#define NS83902_RBCR1 0x0B /* W: Remote Byte Count1 Register */ +#define NS83902_RCR 0x0C /* W: Receive Configuration Register */ +#define NS83902_RSR 0x0C /* R: Receive Status Register */ +#define NS83902_TCR 0x0D /* W: Transmit Configuration Register */ +#define NS83902_CNTR0 0x0D /* R: Tally Counter 0 (Frm. Alignment.*/ +#define NS83902_DCR 0x0E /* W: Data Configuration Register */ +#define NS83902_CNTR1 0x0E /* R: Tally Counter 1 (CRC) */ +#define NS83902_IMR 0x0F /* W: Interrupt Mask Register */ +#define NS83902_CNTR2 0x0F /* R: Tally Counter 1 (Missed Pkt.)*/ + +/* Page 1 Internal Register Offsets */ + +#define NS83902_CR 0x00 /* Command register */ +#define NS83902_PAR0 0x01 /* Phsical Address Register 0 */ +#define NS83902_PAR1 0x02 /* Phsical Address Register 1 */ +#define NS83902_PAR2 0x03 /* Phsical Address Register 2 */ +#define NS83902_PAR3 0x04 /* Phsical Address Register 3 */ +#define NS83902_PAR4 0x05 /* Phsical Address Register 4 */ +#define NS83902_PAR5 0x06 /* Phsical Address Register 5 */ +#define NS83902_CURR 0x07 /* Current Page Register */ +#define NS83902_MAR0 0x08 /* Multicast Address Register 0 */ +#define NS83902_MAR1 0x09 /* Multicast Address Register 1 */ +#define NS83902_MAR2 0x0a /* Multicast Address Register 2 */ +#define NS83902_MAR3 0x0b /* Multicast Address Register 3 */ +#define NS83902_MAR4 0x0c /* Multicast Address Register 4 */ +#define NS83902_MAR5 0x0d /* Multicast Address Register 5 */ +#define NS83902_MAR6 0x0e /* Multicast Address Register 6 */ +#define NS83902_MAR7 0x0f /* Multicast Address Register 7 */ + + +/* + * Configuration Register bits + */ + +#define CR_STP 0x1 /* Stop */ +#define CR_STA 0x2 /* Start */ +#define CR_TXP 0x4 /* Transmit Packet command */ +#define CR_RREAD 0x8 /* Remote DMA Read command */ +#define CR_RWRITE 0x10 /* Remote DMA Write command */ +#define CR_SPKT 0x18 /* Send Packet command */ +#define CR_ABORT 0x20 /* Abort command */ +#define CR_RPAGE0 0x00 /* Register Page 0 */ +#define CR_RPAGE1 0x40 /* Register Page 1 */ +#define CR_RPAGE2 0x80 /* Register Page 2 */ +#define CR_PAGE_MASK 0xc0 /* Register Page mask */ + +/* + * Interrupt Status Register + */ + +#define ISR_PRX 0x1 /* Packet Received */ +#define ISR_PTX 0x2 /* Packet Transmitted */ +#define ISR_RXE 0x4 /* Receive Error */ +#define ISR_TXE 0x8 /* Transmit Error */ +#define ISR_OVW 0x10 /* Overwrite Warning */ +#define ISR_CNT 0x20 /* Counter Overflow */ +#define ISR_RDC 0x40 /* Remote DMA complete */ +#define ISR_RST 0x80 /* Reset Status */ + +/* + * Interrupt Mode Register + */ + +#define IMR_PRXE 0x1 /* Packet Received Intr. Enable */ +#define IMR_PTXE 0x2 /* Packet Transmitted Intr. Enable */ +#define IMR_RXEE 0x4 /* Receive Error Intr. Enable */ +#define IMR_TXEE 0x8 /* Transmit Error Intr. Enable */ +#define IMR_OVWE 0x10 /* Overwrite Warning Intr. Enable */ +#define IMR_CNTE 0x20 /* Counter Overflow Intr. Enable */ +#define IMR_RDCE 0x40 /* Remote DMA complete Intr. Enable */ + +/* + * Data Configuration Register + */ + +#define DCR_WTS 0x1 /* Word Transfer Select */ +#define DCR_BOS 0x2 /* Byte Order Select */ +#define DCR_LAS 0x4 /* Long Address Select */ +#define DCR_NOTLS 0x8 /* Loopback Select */ +#define DCR_ARM 0x10 /* Auto-Initialize Select */ +#define DCR_FIFO2 0x00 /* Fifo Threshold 1 word /2 bytes */ +#define DCR_FIFO4 0x20 /* Fifo Threshold 2 words / 4 bytes */ +#define DCR_FIFO8 0x40 /* Fifo Threshold 4 words / 8 bytes */ +#define DCR_FIFO12 0x60 /* Fifo Threshold 6 words / 12 bytes */ + +/* + * Transmit Configuration Register + */ + +#define TCR_CRC 0x1 /* Inhibit CRC */ +#define TCR_MODE0 0x0 /* Norman operation */ +#define TCR_MODE1 0x2 /* Internal NIC Module Loopback */ +#define TCR_MODE2 0x4 /* Internal ENDEC Module Loopback */ +#define TCR_MODE3 0x6 /* External Loopback */ +#define TCR_ATD 0x8 /* Auto Transmit Disable */ +#define TCR_OFST 0x10 /* Collision Offset Enable */ + +/* + * Transmit Status Register + */ + +#define TSR_PTX 0x1 /* Packet transmitted */ +#define TSR_COL 0x4 /* Transmit Collided */ +#define TSR_ABT 0x8 /* Transmit Aborted */ +#define TSR_CRS 0x10 /* Carrier Sense Lost */ +#define TSR_FU 0x20 /* FIFO underrun */ +#define TSR_CDH 0x40 /* CD Heartbeat */ +#define TSR_OWC 0x80 /* Out of Window Collision */ + +/* + * Receive Configuration Register + */ + +#define RCR_SEP 0x1 /* Save Errored Packets */ +#define RCR_AR 0x2 /* Accept Runt Packets */ +#define RCR_AB 0x4 /* Acept Broadcast */ +#define RCR_AM 0x8 /* Accept Multicast */ +#define RCR_PRO 0x10 /* Promiscuous Physical */ +#define RCR_MON 0x20 /* Monitor Mode */ + +/* + * Receive Status Register + */ + +#define RSR_PRX 0x1 /* Packet Received Intact */ +#define RSR_CRC 0x2 /* CRC Error */ +#define RSR_FAE 0x4 /* Frame Alignment Error */ +#define RSR_FO 0x8 /* FIFO Overrun */ +#define RSR_MPA 0x10 /* Missed Packet */ +#define RSR_PHY 0x20 /* Physical/Multicast Address */ +#define RSR_DIS 0x40 /* Receiver Disabled */ +#define RSR_DFR 0x80 /* Deferring */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCns83902Endh */ diff --git a/h/drv/end/sh7615End.h b/h/drv/end/sh7615End.h new file mode 100644 index 0000000..84e20f6 --- /dev/null +++ b/h/drv/end/sh7615End.h @@ -0,0 +1,440 @@ +/* sh7615End.h - Ethernet driver header */ + +/* Copyright 1984-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,28mar02,h_k added lastError in SH7615END_DRV_CTRL (SPR #74021). +01i,02nov00,frf changed macros definitions for PHY registers. +01h,26sep00,rsh remove some macros related to allowing bsp to provide shared + memory +01g,25sep00,rsh add macro defs for reading and writing registers a'la + motFecEnd +01f,25sep00,rsh add some additional macros that make code more readable +01e,22sep00,rsh continue development +01d,14sep00,rsh continue development +01c,18aug00,rsh continue developement +01b,16aug00,rsh continue development +01a,14aug00,rsh written +*/ + +#ifndef __INCsh7615Endh +#define __INCsh7615Endh + +#ifdef __cplusplus +extern "C" { +#endif + +/* driver flags */ + + +/* Ethernet Controller register offsets */ + +#define ETHERC_ECMR 0xFFFFFD60 /* R/W: EtherC mode register */ +#define ETHERC_ECSR 0xFFFFFD64 /* R/W: EtherC status register */ +#define ETHERC_ECSIPR 0xFFFFFD68 /* R/W: EtherC status int permission */ +#define ETHERC_PIR 0xFFFFFD6C /* R/W: PHY Interface register */ +#define ETHERC_MAHR 0xFFFFFD70 /* R/W: MAC Address High register */ +#define ETHERC_MALR 0xFFFFFD74 /* R/W: MAC Address Low register */ +#define ETHERC_RFLR 0xFFFFFD78 /* R/W: Receive frame length register */ +#define ETHERC_PSR 0xFFFFFD7C /* R: PHY status register */ +#define ETHERC_TROCR 0xFFFFFD80 /* R/W: Tx retry over counter register */ +#define ETHERC_CDCR 0xFFFFFD84 /* R/W: Collision detect counter register */ +#define ETHERC_LCCR 0xFFFFFD88 /* R/W: Lost Carrier counter register */ +#define ETHERC_CNDCR 0xFFFFFD8C /* R/W: Carrier not detect counter */ +#define ETHERC_IFLCR 0xFFFFFD90 /* R/W: Illegal frame length counter */ +#define ETHERC_CEFCR 0xFFFFFD94 /* R/W: CRC error frame recv counter */ +#define ETHERC_FRECR 0xFFFFFD98 /* R/W: Frame receive error counter */ +#define ETHERC_TSFRCR 0xFFFFFD9C /* R/W: Too-short Frame recv counter */ +#define ETHERC_TLFRCR 0xFFFFFDA0 /* R/W: Too-long Frame recv counter */ +#define ETHERC_RFCR 0xFFFFFDA4 /* R/W: Residual bit frame counter */ +#define ETHERC_MAFCR 0xFFFFFDA8 /* R/W: Multicast addr frame counter */ + +/* E-DMAC registers */ + +#define E_DMAC_EDMR 0xFFFFFD00 /* R/W: E-DMAC mode register */ +#define E_DMAC_EDTRR 0xFFFFFD04 /* R/W: E-DMAC tran request register */ +#define E_DMAC_EDRRR 0xFFFFFD08 /* R/W: E-DMAC recv request register */ +#define E_DMAC_TDLAR 0xFFFFFD0C /* R/W: Tx desc list addr register */ +#define E_DMAC_RDLAR 0xFFFFFD10 /* R/W: Rx desc list addr register */ +#define E_DMAC_EESR 0xFFFFFD14 /* R/W: EtherC/E-DMAC status register */ +#define E_DMAC_EESIPR 0xFFFFFD18 /* R/W: EtherC/E-DMAC status interrupt + permission register */ +#define E_DMAC_TRSCER 0xFFFFFD1C /* R/W: Tx/Rx status copy enable */ +#define E_DMAC_RMFCR 0xFFFFFD20 /* R/W: Recevied missed-frame counter */ +#define E_DMAC_TFTR 0xFFFFFD24 /* R/W: Tx FIFO threshold register */ +#define E_DMAC_FDR 0xFFFFFD28 /* R/W: FIFO depth register */ +#define E_DMAC_RCR 0xFFFFFD2C /* R/W: Receiver control register */ +#define E_DMAC_EDOCR 0xFFFFFD30 /* R/W: E-DMAC operation control */ + +/* Ethernet Controller register bit definitions */ + +/* + * EtherC mode Register bits + */ + +#define ECMR_PRCEF 0x00001000 /* Permit Receive CRC Error Frame */ +#define ECMR_MPDE 0x00000200 /* Magic Packet Detection enable */ +#define ECMR_RE 0x00000040 /* Receiver Enable */ +#define ECMR_TE 0x00000020 /* Transmitter Enable */ +#define ECMR_ILB 0x00000008 /* Internal loop back mode */ +#define ECMR_ELB 0x00000004 /* External loop back mode */ +#define ECMR_DM 0x00000002 /* Duplex Mode */ +#define ECMR_PRM 0x00000001 /* Promiscuous Mode */ + +/* + * EtherC Status Register + */ + +#define ECSR_LCHNG 0x00000004 /* LINK signal changed */ +#define ECSR_MPR 0x00000002 /* Magic Packet received */ +#define ECSR_ICD 0x00000001 /* Illegal Carrier detection */ +#define ECSR_CLEAR 0x00000007 /* clear all sources */ + +/* + * EtherC Status Interrupt Permission Register + */ + +#define ECSIPR_LCHNGIP 0x00000004 /* LINK signal change int enable */ +#define ECSIPR_MPRIP 0x00000002 /* Magic Packet received int enable */ +#define ECSIPR_ICDIP 0x00000001 /* Illegal Carrier detection int enalbe */ +#define ECSIPR_CLEAR 0x00000000 /* Disable all sources */ + +/* + * PHY Interface Register + */ + +#define PIR_MDI 0x00000008 /* MII Management Data-In */ +#define PIR_MDO 0x00000004 /* MII Management Data-Out */ +#define PIR_MMD 0x00000002 /* MII Management Data Mode */ +#define PIR_MDC 0x00000001 /* MII Management Data Clock */ + +/* + * Receive Frame Length Register + */ + +#define RFLR_1518 0x000005ee /* 1518 bytes */ +#define RFLR_1519 0x000005ef /* 1519 bytes */ +#define RFLR_1520 0x000005f0 /* 1520 bytes */ +#define RFLR_2047 0x000007ff /* 2047 bytes */ +#define RFLR_2048 0x00000800 /* 2048 bytes */ + +/* + * PHY Interface Status Register + */ + +#define PSR_LMON 0x00000001 /* Link Monitor */ + +/* + * counter register clear macros + */ + +#define TXROC_CLEAR 0x0000FFFF /* clear counter */ +#define CDCR_CLEAR 0x0000FFFF /* clear counter */ +#define LCCR_CLEAR 0x0000FFFF /* clear counter */ +#define CNDCR_CLEAR 0x0000FFFF /* clear counter */ +#define IFLCR_CLEAR 0x0000FFFF /* clear counter */ +#define CEFCR_CLEAR 0x0000FFFF /* clear counter */ +#define FRECR_CLEAR 0x0000FFFF /* clear counter */ +#define TSFRCR_CLEAR 0x0000FFFF /* clear counter */ +#define TLFRCR_CLEAR 0x0000FFFF /* clear counter */ +#define RFCR_CLEAR 0x0000FFFF /* clear counter */ +#define MAFCR_CLEAR 0x0000FFFF /* clear counter */ + +/* E-DMAC register bit definitions */ + +/* + * E-DMAC Mode Register + */ + +#define EDMR_DL1 0x00000020 /* Descriptor length */ +#define EDMR_DL0 0x00000010 /* Descriptor length */ +#define EDMR_SWR 0x00000001 /* Software reset */ + +/* + * E-DMAC Transmit request register + */ + +#define EDTRR_TR 0x00000001 /* Transmit request */ + +/* + * E-DMAC Receive request register + */ + +#define EDRRR_RR 0x00000001 /* Receive request */ + +/* + * EtherC/E-DMAC status register + */ + +#define EESR_RFCOF 0x01000000 /* Receive frame counter overflow */ +#define EESR_ECI 0x00400000 /* EtherC status regsiter interrupt */ +#define EESR_TC 0x00200000 /* Tx Complete */ +#define EESR_TDE 0x00100000 /* Tx Descriptor Exhausted */ +#define EESR_TFUF 0x00080000 /* Tx FIFO Underflow */ +#define EESR_FR 0x00040000 /* Frame Received */ +#define EESR_RDE 0x00020000 /* Rx Descriptor Exhausted */ +#define EESR_RFOF 0x00010000 /* Rx FIFO Overflow */ +#define EESR_ITF 0x00001000 /* Illegal Tx Frame */ +#define EESR_CND 0x00000800 /* Carrier not detected */ +#define EESR_DLC 0x00000400 /* Detect loss of carrier */ +#define EESR_CD 0x00000200 /* Collision Detect */ +#define EESR_TRO 0x00000100 /* Tx Retry Over */ +#define EESR_RMAF 0x00000080 /* Receive Multicast Address frame */ +#define EESR_RRF 0x00000010 /* Receive residual-bit frame */ +#define EESR_RTLF 0x00000008 /* Receive Too-long frame */ +#define EESR_RTSF 0x00000004 /* Receive Too-short frame */ +#define EESR_PRE 0x00000002 /* PHY-LSI Receive Error */ +#define EESR_CERF 0x00000001 /* CRC Error on Received frame */ + +#define EESR_VALID_INT_MSK 0x017f1f9f /* all possible interrupt sources */ +#define EESR_CLEAR 0x017f1f9f /* all possible interrupt sources */ + +/* + * EtherC/E-DMAC status Interrupt Permission register + */ + +#define EESIPR_RFCOFIP 0x01000000 /* Receive frame counter overflow */ +#define EESIPR_ECIIP 0x00400000 /* EtherC status regsiter interrupt */ +#define EESIPR_TCIP 0x00200000 /* Tx Complete */ +#define EESIPR_TDEIP 0x00100000 /* Tx Descriptor Exhausted */ +#define EESIPR_TFUFIP 0x00080000 /* Tx FIFO Underflow */ +#define EESIPR_FRIP 0x00040000 /* Frame Received */ +#define EESIPR_RDEIP 0x00020000 /* Rx Descriptor Exhausted */ +#define EESIPR_RFOFIP 0x00010000 /* Rx FIFO Overflow */ +#define EESIPR_ITFIP 0x00001000 /* Illegal Tx Frame */ +#define EESIPR_CNDIP 0x00000800 /* Carrier not detected */ +#define EESIPR_DLCIP 0x00000400 /* Detect loss of carrier */ +#define EESIPR_CDIP 0x00000200 /* Collision Detect */ +#define EESIPR_TROIP 0x00000100 /* Tx Retry Over */ +#define EESIPR_RMAFIP 0x00000080 /* Receive Multicast Address frame */ +#define EESIPR_RRFIP 0x00000010 /* Receive residual-bit frame */ +#define EESIPR_RTLFIP 0x00000008 /* Receive Too-long frame */ +#define EESIPR_RTSFIP 0x00000004 /* Receive Too-short frame */ +#define EESIPR_PREIP 0x00000002 /* PHY-LSI Receive Error */ +#define EESIPR_CERFIP 0x00000001 /* CRC Error on Received frame */ + +/* + * Tx/Rx status copy enable register + */ + +#define TRSCER_ITFCE 0x00001000 /* Illegal Tx Frame */ +#define TRSCER_CNDCE 0x00000800 /* Carrier not detected */ +#define TRSCER_DLCCE 0x00000400 /* Detect loss of carrier */ +#define TRSCER_CDCE 0x00000200 /* Collision Detect */ +#define TRSCER_TROCE 0x00000100 /* Tx Retry Over */ +#define TRSCER_RMAFCE 0x00000080 /* Receive Multicast Address frame */ +#define TRSCER_RRFCE 0x00000010 /* Receive residual-bit frame */ +#define TRSCER_RTLFCE 0x00000008 /* Receive Too-long frame */ +#define TRSCER_RTSFCE 0x00000004 /* Receive Too-short frame */ +#define TRSCER_PRECE 0x00000002 /* PHY-LSI Receive Error */ +#define TRSCER_CERFCE 0x00000001 /* CRC Error on Received frame */ + +/* + * FIFO Depth Register + */ + +/* */ + +/* + * Receiver Control Register + */ + +#define RCR_RNC 0x00000001 /* Receive Enable Control */ + +/* + * E-DMAC Operation Control Register + */ + +#define EDOCR_FEC 0x00000004 /* FIFO Error control */ +#define EDOCR_AEC 0x00000002 /* Address Error Control*/ +#define EDOCR_EDH 0x00000001 /* E-DMAC Halted */ + +/* Transmit descriptor bit definitions */ + +#define TD0_TACT 0x80000000 /* Tx Descriptor Active */ +#define TD0_OWN TD0_TACT /* the chip owns the descriptor */ +#define TD0_TDL 0x40000000 /* Tx Descriptor Last */ +#define TD0_TFP1 0x20000000 /* Tx Frame Position */ +#define TD0_TFP0 0x10000000 /* Tx FRame Position */ +#define TD0_TFP 0x30000000 /* buffer contains entire frame */ +#define TD0_TFE 0x08000000 /* Tx Frame Error */ +#define TD0_TFS4 0x00000010 /* Tx Illegal Frame */ +#define TD0_IF TD0_TFS4 +#define TD0_TFS3 0x00000008 /* Tx Carrier Not Detect */ +#define TD0_CND TD0_TFS3 +#define TD0_TFS2 0x00000004 /* Tx Detect Loss Carrier */ +#define TD0_DLC TD0_TFS2 +#define TD0_TFS1 0x00000002 /* Tx Collision Detect */ +#define TD0_CD TD0_TFS1 +#define TD0_TFS0 0x00000001 /* Tx Retry Over */ +#define TD0_TRO TD0_TFS0 +#define TD0_CLEAR_ERRORS_N_STATS 0xf0000000 + +#define SH7615END_TBS_PUT(x) ((x) << 16) + +/* Receive descriptor bit definitions */ + +#define RD0_RACT 0x80000000 /* Rx Descriptor Active */ +#define RD0_OWN RD0_RACT /* the chip owns the descriptor */ +#define RD0_RDL 0x40000000 /* Rx Descriptor Last */ +#define RD0_RFP1 0x20000000 /* Rx Frame Position */ +#define RD0_RFP0 0x10000000 /* Rx FRame Position */ +#define RD0_RFE 0x08000000 /* Rx Frame Error */ +#define RD0_RFS9 0x00000200 /* Rx FIFO Overflow */ +#define RD0_RFS7 0x00000080 /* Rx Multicast Addr Frame */ +#define RD0_RFS4 0x00000010 /* Rx Residual-Bit FRame */ +#define RD0_RFS3 0x00000008 /* Rx Too-Long Frame */ +#define RD0_RFS2 0x00000004 /* Rx Too-Short Frame */ +#define RD0_RFS1 0x00000002 /* Rx PHY-LSI Recv Error */ +#define RD0_RFS0 0x00000001 /* Rx CRC Error on Received */ + +#define SH7615END_FRAME_LEN_MSK 0x0000FFFF /* Frame length mask */ +#define SH7615END_FRAME_LEN_GET(x) ((x) & SH7615END_FRAME_LEN_MSK) + +/* DP83843BVJE PHY Chip */ +#define PHY_ADDR 0x01 + +/* DP83843BVJE Phyter MII offset registers */ + +#define BMCR 0x00 /* Basic Mode Control Register */ +#define BMSR 0x01 /* Basic Mode status Register */ +#define PHYIDR1 0x02 /* PHY Identifier register #1 */ +#define PHYIDR2 0x03 /* PHY Identifier register #2 */ +#define ANAR 0x04 /* Auto-Negotiation Advertisement + Register */ +#define ANLPAR 0x05 /* Auto-Negotiation Link Partner + Ability Register */ +#define ANER 0x06 /* Auto-Negotiation Expansion + Register */ +#define ANNPTR 0x07 /* Auto-Negotiation Next Page TX */ +/* 0x08-0x0f Reserved */ +#define PHYSTS 0x10 /* PHY Status Register */ +#define MIPSCR 0x11 /* MII Interrupt PHY Specific Control + Register */ +#define MIPGSR 0x12 /* MII Interrupt PHY Generic Status + Register */ +#define DCR 0x13 /* Disconnect Count Register */ +#define FCSCR 0x14 /* False Carrier Sense Counter + Register */ +#define RECR 0x15 /* Receive Error Counter Register */ +#define PCSR 0x16 /* PCS Sub-Layer Configuration and + Status Register */ +#define LBR 0x17 /* Loopback and Bypass Register */ +#define BTSCR 0x18 /* 10Base-T Status & Control Register */ +#define PHYCTRL 0x19 /* PHY Control Register */ +/* 0x1A-0x1F Reserved */ + +/* DP83843BVJE Phyter MII register data */ + +#define D_RESET 0x8000 +#define D_BMCR 0x0000 +#define D_ANAR 0x01e1 +#define D_ANLPAR 0x0021 +#define D_ANER 0x0004 +#define D_ANNPTR 0x2001 +#define D_MIPSCR 0x0000 +#define D_DCR 0x0000 +#define D_FCSCR 0x0000 +#define D_RECR 0x0000 +#define D_PCSR 0x0000 +#define D_LBR 0x0000 +#define D_10BTSCR 0x0000 + +#define D_PHYCTRL 0x0801 + +/* + * Receive Message Descriptor Entry. + * Four words per entry. Number of entries must be a power of two. + */ +typedef struct rDesc + { + UINT32 rDesc0; /* status */ + UINT32 rDesc1; /* buffer & data count */ + UINT32 rDesc2; /* buffer address 1 */ + UINT32 rDesc3; /* Pad */ + } SH7615_RD; + +/* + * Transmit Message Descriptor Entry. + * Four words per entry. Number of entries must be a power of two. + */ +typedef struct tDesc + { + UINT32 tDesc0; /* status */ + UINT32 tDesc1; /* data count */ + UINT32 tDesc2; /* buffer address 1 */ + UINT32 tDesc3; /* Pad */ + } SH7615_TD; + +typedef struct free_buf + { + void * pClBuf; /* pointer cluster buffer */ + } FREE_BUF; + +/* typedefs */ + +typedef struct sh7615EndDrvCtrl + { + END_OBJ end; /* The class we inherit from. */ + END_ERR lastError; /* Last error passed to muxError */ + long flags; /* Our local flags. */ + ULONG userFlags; /* some user flags */ + int unit; /* unit number */ + + int numRds; /* RD ring size */ + int rxIndex; /* current RMD index */ + SH7615_RD* rxRing; /* RMD ring start */ + + int numTds; /* TD ring size */ + int txIndex; /* current TMD index */ + int txDiIndex; /* current TMD index */ + SH7615_TD* txRing; /* TMD ring start */ + + int ivec; /* interrupt vector */ + int ilevel; /* interrupt level */ + UINT32 intrMask; /* interrupt mask */ + char* pShMem; /* real ptr to shared memory */ + char* memBase; /* LANCE memory pool base */ + int memSize; /* LANCE memory pool size */ + + BOOL loaded; /* interface has been loaded */ + char * pClBlkArea; /* cluster block pointer */ + UINT32 clBlkSize; /* clusters block memory size */ + char * pMBlkArea; /* mBlock area pointer */ + UINT32 mBlkSize; /* mBlocks area memory size */ + UCHAR enetAddr[6]; /* ethernet address */ + CL_POOL_ID pClPoolId; /* cluster pool */ + BOOL rxHandling; /* rcv task is scheduled */ + BOOL txCleaning; + BOOL txBlocked; /* variable for blocking */ +/* REVISIT - shouldn't this be the same array size as number of possible buffers? */ + FREE_BUF freeBuf[128]; +/* PHY_INFO *phyInfo; */ /* info on a MII-compliant PHY */ + } SH7615END_DRV_CTRL; + +/* rx/tx buffer descriptors definitions */ + +#define SH7615END_RBD_SZ 16 /* RBD size in byte */ +#define SH7615END_TBD_SZ 16 /* TBD size in byte */ +#define SH7615END_TBD_MIN 6 /* min number of TBDs */ +#define SH7615END_RBD_MIN 4 /* min number of RBDs */ +#define SH7615END_TBD_POLL_NUM 1 /* one TBD for poll operation */ +#define CL_OVERHEAD 4 /* prepended cluster overhead */ +#define CL_ALIGNMENT 4 /* cluster required alignment */ +#define MBLK_ALIGNMENT 4 /* mBlks required alignment */ +#define SH7615END_BD_ALIGN 0x10 /* required alignment for RBDs */ +#define SH7615END_MAX_PCK_SZ (ETHERMTU + SIZEOF_ETHERHEADER \ + + ETHER_CRC_LEN) + +#define SH7615END_RBD_DEF_NUM 48 /* default number of Recv descriptors */ +#define SH7615END_TBD_DEF_NUM 64 /* default number of Xmit descriptors */ +#define NUM_LOAN 16 /* number of loaner buffers */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsh7615Endh */ + diff --git a/h/drv/end/simnetEnd.h b/h/drv/end/simnetEnd.h new file mode 100644 index 0000000..38a177e --- /dev/null +++ b/h/drv/end/simnetEnd.h @@ -0,0 +1,56 @@ +/* simNetEndDrv.h - END style Simulator Ethernet driver header */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,15apr04,elp added defines to get/set parameters. +01a30jul03,elp written. +*/ + +#ifndef __INCsimEndh +#define __INCsimEndh + +#ifdef __cplusplus +extern "C" { +#endif + +/* SIMNET defines */ + +/* macros to get SUBNET information from vxsimnetd */ +#define SIMNET_SUBNET_MTU 1 /* get subnet mtu */ +#define SIMNET_SUBNET_PHYS_ADDRLEN 2 /* get MAC address length */ +#define SIMNET_SUBNET_BROAD_ADDRESS 3 /* get subnet bcast address */ +#define SIMNET_SUBNET_ADDRESS 4 /* get subnet address */ +#define SIMNET_SUBNET_MASK 5 /* get subnet mask */ +#define SIMNET_SUBNET_ADDRESSV6 6 /* get subnet IPv6 prefix */ +#define SIMNET_SUBNET_ADDRESSV6_LEN 7 /* get subnet IPv6 prefix len */ +#define SIMNET_SUBNET_BROADCAST 8 /* broadcast support ? */ +#define SIMNET_SUBNET_MULTICAST 9 /* multicast support ? */ + +/* macro to get/set NODE information */ +#define SIMNET_NODE_PHYS_ADDRESS 10 /* node MAC address */ +#define SIMNET_NODE_INTERRUPT 11 /* node interrupt enabled */ +#define SIMNET_NODE_PROMISCUOUS 12 /* node promiscuous */ +#define SIMNET_NODE_MULTICAST 13 /* node multicasting */ +#define SIMNET_NODE_ADDRESS 14 /* node address */ +#define SIMNET_NODE_ADDRESSV6 15 /* IPv6 node address */ + +/* typedefs */ + +typedef struct simnet_pkt + { + void * ldp_handle; /* Reserved for internal use */ + int ldp_maxsize; /* Maximum size of the packet */ + int ldp_size; /* size of the packet */ + int ldp_offset; /* data offset from the packet ptr. */ + UINT8 ldp_buf[1]; /* 1 or more bytes for data */ + } SIMNET_PKT; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsimNetEndDrvh */ + diff --git a/h/drv/end/smEnd.h b/h/drv/end/smEnd.h new file mode 100644 index 0000000..1eb39ff --- /dev/null +++ b/h/drv/end/smEnd.h @@ -0,0 +1,255 @@ +/* smEnd.h - WRS shared memory driver header file */ + +/* Copyright 1984 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01m,05oct04,jln changed EADDR_LEN to SM_EADDR_LEN (spr#102310) +01l,06feb04,jln ported to T221 and Base6; + add new configuration flags. +01k,20sep01,mas added lastError to SM_END_DEV (SPR 70181) +01j,15jun01,mas removed SM_END_CLST_SIZ, fixed SM_PACKET_ROUNDUP, added + SM_MTU (SPR 68195) +01i,30mar01,mas added netmask storage to SM_END_DEV struct and pre-AE + compatibility flag (SPR 64957) +01h,15mar01,mas added ethernet address support per IEEE-802.3 (SPR 34766) +01g,17jun00,mas added pRxPktCnt and rxInts to SM device control structure +01f,11jun00,ham removed reference to etherLib. +01e,07apr00,mas moved SM common parameters to smLib.h +01d,11feb00,mas added media support for T3 +01c,08oct99,mas smEnd componentized. +01b,16sep99,mas removed unused macros; added IOCTL codes for callout hook + routines smEndCopyRtn() and smEndMblkCopyRtn(); released + (SPR 25573). +01a,28jan99,mas written based on if_sm.h rev 01f,22sep92. +*/ + +#ifndef __INCsmEndh +#define __INCsmEndh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "end.h" +#include "m2Lib.h" +#include "netinet/if_ether.h" +#include "ioctl.h" +#include "bootLib.h" +#include "smLib.h" +#include "smPktLib.h" + + +/* defines */ + +/* + * Definitions for the shared memory END State flags field + * + * Flag Use + * --------------- ------------------------------------------------------ + * S_LOADED smEnd successfully loaded + * S_CPU_ATTACHED local CPU is attached to shared memory + * S_ARP_PUB ethernet H/W address is published to ARP table + * S_RUNNING local CPU active in shared memory + * S_POLLED_SM shared memory interface is operating in polled mode + * S_POLLED_END MUX interface is operating in polled mode + * S_RCV_TASK_ACTIVE interrupt driven receive task is active + * S_MSTR_PRE_AE_COMPAT pre-AE master node, don't wait for address publishing + */ + +#define S_LOADED 0x0001 +#define S_CPU_ATTACHED 0x0002 +#define S_RUNNING 0x0004 +#define S_ARP_PUB 0x0008 +#define S_POLLED_SM 0x0010 +#define S_POLLED_END 0x0020 +#define S_RCV_TASK_ACTIVE 0x0040 +#define S_MSTR_PRE_AE_COMPAT 0x8000 + +#define SM_PARAMS_MAX 256 + +#define SM_NAME_MAX 15 + +#define SM_END_COOKIE 0xfab0fad0 + +#define SM_MIN_MBLK_NUM 0x10 +#define SM_DFLT_MBLK_NUM 0x30 + +#define SM_MIN_CLBLK_NUM 0x10 +#define SM_DFLT_CLBLK_NUM 0x20 + +#define SM_END_MIN_FBUF (1536) /* min first buffer size */ + +#define SM_PACKET_ROUNDUP(siz) \ + ( \ + ((((siz) + sizeof(SM_PKT_HDR)) % 16) == 0) ? 0 : \ + (16 - (((siz) + sizeof(SM_PKT_HDR)) % 16)) \ + ) + +#define SM_END_MIB2_SPEED -1 + +/* IP address length */ + +#define IPADDR_LEN 4 + +/* ethernet address length and positions */ + +#define SM_EADDR_LEN (sizeof(struct ether_addr)) + +/* maximum smEnd payload (maximum tranfer unit) */ + +#define SM_MTU(pDev) \ + ((UINT)pDev->maxPktBytes - (SIZEOF_ETHERHEADER + SM_EADDR_LEN)) + +/* smEnd ethernet MAC address octet positions */ + +#define SM_ETHER_ID_FIRST (0) +#define SM_ETHER_ID_SECOND (1) +#define SM_ETHER_ID_THIRD (2) +#define SM_ETHER_EUI64_FOURTH (3) +#define SM_ETHER_EUI64_FIFTH (4) +#define SM_ETHER_USER_OPT (SM_EADDR_LEN-3) +#define SM_ETHER_UNIT (SM_EADDR_LEN-2) +#define SM_ETHER_CPU (SM_EADDR_LEN-1) + +/* configuration flag for SM end */ + +#define SMEND_SM_SEQ_ADDR 0x0001 +#define SMEND_PROXY_SERVER_FLAG 0x0002 +#define SMEND_PROXY_CLIENT_FLAG 0x0004 +#define SMEND_PROXY_DEFAULT_ADDR_FLAG 0x0008 + +/* + * Maximum delay for initial access to sm from slave processor in ticks. + * At 100 ticks per second, this is about 30 seconds. + */ + +#define SM_MAX_WAIT 3000 + +#define M_BLK_OVERHEAD 4 +#define CL_BLK_OVERHEAD 4 +#define CL_OVERHEAD 4 + +#define PKT_TYPE_MULTI 0x1 /* packet with a multicast address */ +#define PKT_TYPE_UNI 0x2 /* packet with a unicast address */ +#define PKT_TYPE_NONE 0x4 /* address type is not meaningful */ + +#define SMEND_DEV_NAME "sm" + +#ifndef _ASMLANGUAGE + +/* Macros */ + +#define etherAdrsPtr(eaddr) (u_char *)(eaddr) + +#define smEndInputCount(pSmEndDev, cpu) \ + (pSmEndDev)->smPktDesc.cpuLocalAdrs [(cpu)].inputList.count + +#define SM_END_ETHER_ADDR_GET(pEnd) \ + ((pEnd)->mib2Tbl.ifPhysAddress.phyAddress) + +#define SM_END_ETHER_ADDR_LEN_GET(pEnd) \ + ((pEnd)->mib2Tbl.ifPhysAddress.addrLength) + +/* IOCTL codes */ + +/* get mblk copy routine pointer */ + +#define SMIOCGMCPYRTN _IOR('s', 1, FUNCPTR) + +/* set mblk copy routine pointer */ + +#define SMIOCSMCPYRTN _IOW('s', 2, FUNCPTR) + +/* get chained mblk copy routine pointer */ + +#define SMIOCGCCPYRTN _IOR('s', 3, FUNCPTR) + +/* set chained mblk copy routine pointer */ + +#define SMIOCSCCPYRTN _IOW('s', 4, FUNCPTR) + + +/* typedefs */ + +/* The definition of the shared memory device control structure */ + +typedef struct sm_end_device /* SM_END_DEV */ + { + END_OBJ end; /* The class we inherit from. */ + UINT cookie; /* sm device validation cookie */ + int unit; /* unit number */ + char devName[SM_NAME_MAX+1]; /* device name */ + SM_ANCHOR * pAnchor; /* SM anchor local address */ + char * pMem; /* SM local base address */ + char * pMemAlloc; /* memory allocated by smEnd */ + ULONG memSize; /* total shared memory size in bytes */ + unsigned tasType; /* test-and-set type (HARD/SOFT) */ + unsigned maxCpus; /* max #CPUs supported in 'sm' */ + unsigned masterCpu; /* master CPU number */ + unsigned localCpu; /* local cpu number */ + ULONG maxPktBytes; /* max size of shared memory packet */ + ULONG startAddr; /* start of seq addrs (0 = not seq) */ + ULONG ipAddr; /* network address of node */ + int maxPackets; /* max #packets CPU can receive */ + int intType; /* interrupt method */ + int intArg1; /* 1st interrupt argument */ + int intArg2; /* 2nd interrupt argument */ + int intArg3; /* 3rd interrupt argument */ + int ticksPerBeat; /* #CPU ticks per heartbeat */ + ULONG mbNum; /* number of mBlks to allocate */ + ULONG cbNum; /* number of clBlks to allocate */ + void (* pSmFree) (void *); /* routine to free memory*/ + BOOL smAlloc; /* sm allocated? */ + BOOL isMaster; /* we are master CPU? */ + BOOL isBoot; /* we are boot device? */ + ULONG flags; /* Our local flags. */ + SM_PKT_MEM_HDR * pSmPktHdr; /* sm packet header */ + int * pRxPktCnt; /* SM pkt CPU input pkt count */ + UINT rxInts; /* interrupt counter for rec'vd pkts */ + CL_POOL_ID clPoolId; /* cluster pool ID */ + M_BLK_ID tupleId; /* receive-ready tuple (mBlk) ID */ + M_BLK_ID pollQ; /* polled tuple queue */ + M_BLK_ID pollQLast; /* polled tuple queue last entry */ + void * pMclBlkCfg; /* mBlk/clBlk config memory */ + void * pClustMem; /* cluster pool memory */ + u_char enPhyAddr[MAXIFPHYADDR]; /* ethernet physical address*/ + SM_PKT_DESC smPktDesc; /* shared mem packet desc */ + u_long masterAddr; /* master's IP address */ + unsigned netmask; /* network address mask */ + END_ERR lastError; /* last Mux error recorded */ + BOOT_PARAMS * pBootParams; /* pointer to the boot parameter structure */ + ULONG configFlag; /* configuration flag passed by user */ + } SM_END_DEV; + + +/* externals */ + +extern SM_END_DEV ** unitTbl; + +/* function prototypes */ + +#if defined(__STDC__) || defined(__cplusplus) +extern STATUS smEndDevInit (SM_END_DEV * pSmEndDev); +extern void smEndShowInit (void); +extern STATUS smNetShow (char * ifName, BOOL zero); +extern END_OBJ * smEndLoad (char * initString); +extern STATUS smEndInetAddrGet (char *, int, int, char *); +#else +extern STATUS smEndDevInit (); +extern void smEndShowInit (); +extern STATUS smNetShow (); +extern END_OBJ * smEndLoad (); +extern STATUS smEndInetAddrGet (); +#endif /* defined(__STDC__) || defined(__cplusplus) */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsmEndh */ diff --git a/h/drv/end/sn83932End.h b/h/drv/end/sn83932End.h new file mode 100644 index 0000000..7b1bcc9 --- /dev/null +++ b/h/drv/end/sn83932End.h @@ -0,0 +1,395 @@ +/* if_sn.h - structures and defines for the DP83932B SONIC device */ + +/* Copyright 1991-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01k,20sep97,pul added # defines for new MBLK buffering scheme +01j,15Apr97,sal Addop for End Driver +01h,18oct93,cd added extra field to TX_DESC to hold associated mbuf, + defined EXBUS, added timer support. +01g,22sep92,rrr added support for c++ +01f,04jun92,ajm defined appropriate regs volatile +01e,26may92,rrr the tree shuffle +01d,03feb92,rfs minor changes to TX_DESC, moved tunables out to driver +01c,08nov91,rfs adapted from Ironics stuff +01b,29jul91,kjl cleanup in preparation for release +01a,25mar91,kjl adapted from if_ln.h 01j,05oct90,shl +*/ + +#ifndef __INCif_snh +#define __INCif_snh + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* Total number of cluster pools */ +#define NUM_CLUSTER_POOLS 2 + +/* Configurable number of clusters of each type */ +#define NUM_OPTIMAL_CLUSTER 32 +#define NUM_MTU_CLUSTER 16 + +/* Configurable number of cluster blks and mblks */ +#define NUM_CL_BLK 32 +#define NUM_MBLK 32 + +/* Tunable Parameters */ +#define NUM_RRA_DESC (4) /* number of RRA descriptors */ +#define NUM_RX_DESC (512) /* number of Rx descriptors */ +#define NUM_TX_DESC (64) /* num of Tx desc, must be power of 2 */ +#define MAX_TX_FRAGS (32) /* max transmit frags to support */ + +/* The following values denote the maximum # of RX/TX events to process + * in one pass (ie. Process up to x received packets before processing up + * to y transmitted packets. + */ +#define RX_PROCESS_FLOW 16 +#define TX_PROCESS_FLOW 8 + +/* DATA STRUCTURES */ + +typedef struct rra_desc /* Receive Resource Descriptor */ + { + unsigned long buff_ptr0; /* these two point to the starting location */ + unsigned long buff_ptr1; /* of the receive buffer arear (RBA) */ + + unsigned long buff_wc0; /* these two define the number of 16 bit */ + unsigned long buff_wc1; /* words that the RBA occupies */ + } RRA_DESC; +#define RRA_DESC_SIZ sizeof(RRA_DESC) + +#define RRA_SIZE (NUM_RRA_DESC * RRA_DESC_SIZ) /* size of area */ + +typedef struct Rx_desc /* Receive Descriptor */ + { + unsigned long status; /* indicates the status of the received packet */ + unsigned long byte_count;/* length of the complete packet */ + unsigned long pkt_ptr0; /* these two pointers locate the */ + unsigned long pkt_ptr1; /* packet in the RBA */ + unsigned long seq_no; /* displays the sequence the RBAs used and the */ + /* packets buffered */ + struct Rx_desc *link; /* location of the next receive descriptor */ + unsigned long in_use; /* ownership of the descriptor */ + /* zero value: driver (system) is the owner */ + /* non -zero value: SONIC (device) is the owner */ + } RX_DESC; + +#define RX_DESC_SIZ sizeof(RX_DESC) + +#define RDA_SIZE (NUM_RX_DESC * RX_DESC_SIZ) /* Total Bytes */ + +/* values for in_use field */ +#define IN_USE (1) /*SL* In use by the device */ +#define NOT_IN_USE (0) /*SL* Free to manipulate */ + +/* end-of-list marker for link field */ +#define RX_EOL (RX_DESC *)(1) + +#define CAM_COUNT (16) + +typedef struct Cam_desc + { + unsigned long cep; + unsigned long cap0; + unsigned long cap1; + unsigned long cap2; + } CAM_DESC; + +#define CAM_DESC_SIZE sizeof (CAM_DESC) + +/* Define size of CAM descriptor area plus a word for the CAM enable */ +#define CAM_SIZE (CAM_COUNT * CAM_DESC_SIZE) + 4 + +typedef struct frag_desc + { + unsigned long frag_ptr0; /* 0,1 pointer to the fragment in */ + unsigned long frag_ptr1; /* the transmit buffer area */ + unsigned long frag_size; /* byte count of the fragment */ + } FRAG_DESC; /* Fragment descriptors */ + + + +typedef struct Tx_desc /* Transmit Descriptor */ + { + unsigned long status; /* status of the transmission */ + /* written into transmit control */ + /* register (TCR) */ + unsigned long config; /* programming SONIC to various */ + /* transmiting modes */ + unsigned long pkt_size; /* byte count of the packet */ + unsigned long frag_count; /* number of fragments of the packet */ + FRAG_DESC frag[MAX_TX_FRAGS]; /* max Fragment descriptors */ + struct Tx_desc *pLink; /* OUR real link ptr */ + unsigned long flag; /* IN USE flag */ + unsigned long number; /* Descriptor number */ + } TX_DESC; + + +#define TX_DESC_SIZ sizeof(TX_DESC) + +#define TDA_SIZE (NUM_TX_DESC * TX_DESC_SIZ) + +/* end-of-list marker for link field */ +#define TX_EOL (1) + +/* State Definitions */ +#define SN_POLLING 0x01 /* Poll Mode */ +#define SN_PROMISC 0x02 /* Promicuous Mode */ +#define SN_ALLMULTI 0x04 /* Allow all multicasts */ +#define SN_RECLAIMING 0x80 /* Performing a Reclaim of TXDs */ + + +/* SONIC registers, defined as data structure */ + +typedef struct sonic + { + volatile unsigned long cr; + volatile unsigned long dcr; + volatile unsigned long rcr; + volatile unsigned long tcr; + volatile unsigned long imr; + volatile unsigned long isr; + volatile unsigned long utda; + volatile unsigned long ctda; + volatile unsigned long fill_20; + volatile unsigned long fill_24; + volatile unsigned long fill_28; + volatile unsigned long fill_2c; + volatile unsigned long fill_30; + volatile unsigned long urda; + volatile unsigned long crda; + volatile unsigned long fill_3c; + volatile unsigned long fill_40; + volatile unsigned long fill_44; + volatile unsigned long fill_48; + volatile unsigned long eobc; + volatile unsigned long urra; + volatile unsigned long rsa; + volatile unsigned long rea; + volatile unsigned long rrp; + volatile unsigned long rwp; + volatile unsigned long fill_64; + volatile unsigned long fill_68; + volatile unsigned long fill_6c; + volatile unsigned long fill_70; + volatile unsigned long fill_74; + volatile unsigned long fill_78; + volatile unsigned long fill_7c; + volatile unsigned long fill_80; + volatile unsigned long cep; + volatile unsigned long cap2; + volatile unsigned long cap1; + volatile unsigned long cap0; + volatile unsigned long ce; + volatile unsigned long cdp; + volatile unsigned long cdc; + volatile unsigned long sr; + volatile unsigned long wt0; + volatile unsigned long wt1; + volatile unsigned long rsc; + volatile unsigned long fill_b0; + volatile unsigned long fill_b4; + volatile unsigned long fill_b8; + volatile unsigned long fill_bc; + volatile unsigned long fill_c0; + volatile unsigned long fill_c4; + volatile unsigned long fill_c8; + volatile unsigned long fill_cc; + volatile unsigned long fill_d0; + volatile unsigned long fill_d4; + volatile unsigned long fill_d8; + volatile unsigned long fill_dc; + volatile unsigned long fill_e0; + volatile unsigned long fill_e4; + volatile unsigned long fill_e8; + volatile unsigned long fill_ec; + volatile unsigned long fill_f0; + volatile unsigned long fill_f4; + volatile unsigned long fill_f8; + volatile unsigned long dcr2; + } SONIC; +#define SONIC_SIZ sizeof(SONIC) + + +/* SONIC registers, defined as direct ptrs. The constant SONIC_BASE_ADDR + * should be defined elsewhere; in board specific header file. + * These defines are NOT used in the VxWorks SONIC driver, but are left + * here for reference. + */ + +#if 0 +#define SONIC_CR (volatile unsigned long *) (SONIC_BASE_ADDR + 0x00) +#define SONIC_DCR (volatile unsigned long *) (SONIC_BASE_ADDR + 0x04) +#define SONIC_RCR (volatile unsigned long *) (SONIC_BASE_ADDR + 0x08) +#define SONIC_TCR (volatile unsigned long *) (SONIC_BASE_ADDR + 0x0c) +#define SONIC_IMR (volatile unsigned long *) (SONIC_BASE_ADDR + 0x10) +#define SONIC_ISR (volatile unsigned long *) (SONIC_BASE_ADDR + 0x14) +#define SONIC_UTDA (volatile unsigned long *) (SONIC_BASE_ADDR + 0x18) +#define SONIC_CTDA (volatile unsigned long *) (SONIC_BASE_ADDR + 0x1c) + +#define SONIC_URDA (volatile unsigned long *) (SONIC_BASE_ADDR + 0x34) +#define SONIC_CRDA (volatile unsigned long *) (SONIC_BASE_ADDR + 0x38) +#define SONIC_EOBC (volatile unsigned long *) (SONIC_BASE_ADDR + 0x4c) +#define SONIC_URRA (volatile unsigned long *) (SONIC_BASE_ADDR + 0x50) +#define SONIC_RSA (volatile unsigned long *) (SONIC_BASE_ADDR + 0x54) +#define SONIC_REA (volatile unsigned long *) (SONIC_BASE_ADDR + 0x58) +#define SONIC_RRP (volatile unsigned long *) (SONIC_BASE_ADDR + 0x5c) +#define SONIC_RWP (volatile unsigned long *) (SONIC_BASE_ADDR + 0x60) +#define SONIC_CEP (volatile unsigned long *) (SONIC_BASE_ADDR + 0x84) +#define SONIC_CAP2 (volatile unsigned long *) (SONIC_BASE_ADDR + 0x88) +#define SONIC_CAP1 (volatile unsigned long *) (SONIC_BASE_ADDR + 0x8c) +#define SONIC_CAP0 (volatile unsigned long *) (SONIC_BASE_ADDR + 0x90) +#define SONIC_CE (volatile unsigned long *) (SONIC_BASE_ADDR + 0x94) +#define SONIC_CDP (volatile unsigned long *) (SONIC_BASE_ADDR + 0x98) +#define SONIC_CDC (volatile unsigned long *) (SONIC_BASE_ADDR + 0x9c) +#define SONIC_SR (volatile unsigned long *) (SONIC_BASE_ADDR + 0xa0) +#define SONIC_WT0 (volatile unsigned long *) (SONIC_BASE_ADDR + 0xa4) +#define SONIC_WT1 (volatile unsigned long *) (SONIC_BASE_ADDR + 0xa8) +#define SONIC_RSC (volatile unsigned long *) (SONIC_BASE_ADDR + 0xac) +#define SONIC_CRCT (volatile unsigned long *) (SONIC_BASE_ADDR + 0xb0) +#define SONIC_FAET (volatile unsigned long *) (SONIC_BASE_ADDR + 0xb4) +#define SONIC_MPT (volatile unsigned long *) (SONIC_BASE_ADDR + 0xb8) + +#define SONIC_CRBA0 (volatile unsigned long *) (SONIC_BASE_ADDR + 0x3c) +#define SONIC_CRBA1 (volatile unsigned long *) (SONIC_BASE_ADDR + 0x40) +#define SONIC_RBWC0 (volatile unsigned long *) (SONIC_BASE_ADDR + 0x44) +#define SONIC_RBWC1 (volatile unsigned long *) (SONIC_BASE_ADDR + 0x48) + +#define SONIC_TPS (volatile unsigned long *) (SONIC_BASE_ADDR + 0x20) +#define SONIC_TFC (volatile unsigned long *) (SONIC_BASE_ADDR + 0x24) +#define SONIC_TSA0 (volatile unsigned long *) (SONIC_BASE_ADDR + 0x28) +#define SONIC_TSA1 (volatile unsigned long *) (SONIC_BASE_ADDR + 0x2c) +#define SONIC_TFS (volatile unsigned long *) (SONIC_BASE_ADDR + 0x30) +#define SONIC_TTDA (volatile unsigned long *) (SONIC_BASE_ADDR + 0x80) +#endif + +/* miscellaneous stuff */ +#define LMASK (0xffff0000) +#define UMASK (0x0000ffff) + +/* Command Register Commands */ +#define LCAM (0x0200) /* Load CAM */ +#define RRRA (0x0100) /* Read RRA */ +#define RST (0x0080) /* Software Reset */ +#define RST_OFF (0x0000) /* Software Reset Off */ +#define ST (0x0020) /* Start Timer */ +#define STP (0x0010) /* Stop Timer */ +#define RXEN (0x0008) /* Receiver Enable */ +#define RXDIS (0x0004) /* Receiver Disable */ +#define TXP (0x0002) /* Transmit Packet */ +#define HTX (0x0001) /* Halt Transmission */ + +/* Data Configuration Register */ +#define EXBUS (0x8000) /* Extended Bus Mode (BVF) */ +#define LBR (0x2000) /* Latched Mode */ +#define PO1 (0x1000) /* Programmable Output 1 */ +#define PO0 (0x0800) /* Programmable Output 0 */ +#define STERM (0x0400) /* Synchronous Transmission */ +#define USR1 (0x0200) /* User Definable Pin 1 */ +#define USR0 (0x0100) /* User Definable Pin 0 */ +#define WC1 (0x0080) /* Wait State Control 1 */ +#define WC0 (0x0040) /* Wait State Control 0 */ +#define WAIT0 (0) /* 0 Wait state */ +#define WAIT1 (WC0) /* 1 Wait state */ +#define WAIT2 (WC1) /* 2 Wait state */ +#define WAIT3 (WC1 | WC0) /* 3 Wait state */ +#define DW (0x0020) /* Data Width Control */ +#define DW_32 (0x0020) /* Data Width 32 bits */ +#define DW_16 (0x0000) /* Data Width 16 bits */ +#define BMS (0x0010) /* Block Mode Select for DMA */ +#define RFT1 (0x0008) /* Receive FIFO threshold 1 */ +#define RFT0 (0x0004) /* Receive FIFO threshold 0 */ +#define TFT1 (0x0002) /* Transmit FIFO Threshold 1 */ +#define TFT0 (0x0001) /* Transmit FIFO Threshold 0 */ + +/* Receive Control Register */ +#define ERR (0x8000) /* Accept packets with errors */ +#define RNT (0x4000) /* Accept Runt packets */ +#define BRD (0x2000) /* Accept broadcast packets */ +#define PRO (0x1000) /* Physical Promiscuous packets */ +#define AMC (0x0800) /* Accept all multicast packets */ +#define LB1 (0x0400) /* Loopback bit 1 */ +#define LB0 (0x0200) /* Loopback bit 0 */ +#define NO_LB (0x0000) /* No Loopback */ +#define MAC_LB (0x0200) /* MAC loopback */ +#define ENDEC_LB (0x0400) /* ENDEC loopback */ +#define XCVR_LB (0x0600) /* Transceiver loopback */ +#define MC (0x0100) /* Multicast packet received */ +#define BC (0x0080) /* Broadcast packet received */ +#define LPKT (0x0040) /* Last packet in RBA */ +#define CRS (0x0020) /* Carrier Sense Activity */ +#define COL (0x0010) /* Collision activity */ +#define CRCR (0x0008) /* CRC Error */ +#define FAER (0x0004) /* Frame alignment error */ +#define LBK (0x0002) /* Loopback packet received */ +#define PRX (0x0001) /* Packet received OK */ + +/* Transmit Control Register */ +#define PINT (0x8000) /* Programmable Interrupt */ +#define POWC (0x4000) /* Programmed out of window collision timer */ +#define CRCI (0x2000) /* CRC Inhibit */ +#define EXDIS (0x1000) /* Disable Excessive Deferral Timer */ +#define EXD (0x0400) /* Excessive Deferral */ +#define DEF (0x0200) /* Deferred transmission */ +#define NCRS (0x0100) /* No CRS */ +#define CRSL (0x0080) /* CRS Lost */ +#define EXC (0x0040) /* Excessive Collisions */ +#define OWC (0x0020) /* Out of window collision */ +#define PMB (0x0008) /* Packet monitored bad */ +#define FU (0x0004) /* FIFO underrun */ +#define BCM (0x0002) /* Byte count mismatch */ +#define PTX (0x0001) /* Packet transmitted OK */ + +/* Interrupt Mask Register */ +#define BREN (0x4000) /* Bus Retry Occured Enable */ +#define HBLEN (0x2000) /* Heartbeat lost Enable */ +#define LCDEN (0x1000) /* Load Cam Done Interrupt Enable */ +#define PINTEN (0x0800) /* Programmable Interrupt Enable */ +#define PRXEN (0x0400) /* Packet Received Enable */ +#define PTXEN (0x0200) /* Packet Transmitted OK Enable */ +#define TXEREN (0x0100) /* Transmit Error Enable */ +#define TCEN (0x0080) /* Timer Complete Enable */ +#define RDEEN (0x0040) /* Receive Descriptors Enable */ +#define RBEEN (0x0020) /* Receive Buffers Exhausted Enable */ +#define RBAEEN (0x0010) /* Receive Buffer Area Exceeded Enable */ +#define CRCEN (0x0008) /* CRC Tally counter warning Enable */ +#define FAEEN (0x0004) /* FAE Tally counter warning Enable */ +#define MPEN (0x0002) /* MP Tally counter warning Enable */ +#define RFOEN (0x0001) /* Receive FIFO Overrun Enable */ + +/* Interrupt Status Register */ +#define CLEAR_ISR (0xffff) /* Clear all status */ +#define BR (0x4000) /* Bus Retry Occured */ +#define HBL (0x2000) /* Heartbeat lost */ +#define LCD (0x1000) /* Load Cam Done Interrupt */ +#define PINTS (0x0800) /* Programmable Interrupt Status */ +#define PKTRX (0x0400) /* Packet Received */ +#define TXDN (0x0200) /* Transmission Done */ +#define TXER (0x0100) /* Transmit Error */ +#define TC (0x0080) /* Timer Complete */ +#define RDE (0x0040) /* Receive Descriptors */ +#define RBE (0x0020) /* Receive Buffers Exhausted */ +#define RBAE (0x0010) /* Receive Buffer Area Exceeded */ +#define CRC (0x0008) /* CRC Tally counter warning */ +#define FAE (0x0004) /* FAE Tally counter warning */ +#define MP (0x0002) /* MP Tally counter warning */ +#define RFO (0x0001) /* Receive FIFO Overrun */ + +/* End of Buffer Count Register */ +#define MAX_PACKET_SIZE (0x02f8) /* 760 words */ + +#if CPU_FAMILY==I960 +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_snh */ diff --git a/h/drv/end/ultraEnd.h b/h/drv/end/ultraEnd.h new file mode 100644 index 0000000..fc06802 --- /dev/null +++ b/h/drv/end/ultraEnd.h @@ -0,0 +1,220 @@ +/* ultraEnd.h - SMC Elite Ultra END network interface header */ + +/* Copyright 1984-1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,11jan99,dra written. +*/ + +#ifndef __INCultraEndh +#define __INCultraEndh + +#ifdef __cplusplus +extern "C" { +#endif + +#define DEV_NAME "ultra" +#define DEV_NAME_LEN 6 + +#define ULTRA_RAMSIZE 0x4000 /* 16 Kbytes */ +#define ULTRA_TSTART0 0x00 +#define ULTRA_TSTART1 0x08 +#define ULTRA_PSTART 0x10 +#define ULTRA_PSTOP 0x40 +#define ULTRA_MIN_SIZE ETHERSMALL +#define ULTRA_MAX_SIZE (SIZEOF_ETHERHEADER+ETHERMTU) + +#define ULTRA_BUFSIZ (ULTRA_MAX_SIZE + 6) +#define ULTRA_MIN_FBUF (ULTRA_BUFSIZ) + +typedef struct + { + UCHAR rstat; + UCHAR next; + UCHAR lowByteCnt; + UCHAR uppByteCnt; + } ULTRA_HEADER; + +typedef struct + { + char irq; + char reg; + } IRQ_TABLE; + +/* SMC Elite Ultra */ + +#define CTRL_CON 0x00 /* Control */ +#define CTRL_EEROM 0x01 /* EEROM */ +#define CTRL_HARD 0x04 /* Hardware */ +#define CTRL_BIOS 0x05 /* BIOS page */ +#define CTRL_INT 0x06 /* Interrupt control */ +#define CTRL_REV 0x07 /* Revision */ +#define CTRL_LAN0 0x08 /* SWH=0 LAN address */ +#define CTRL_LAN1 0x09 /* SWH=0 LAN address */ +#define CTRL_LAN2 0x0a /* SWH=0 LAN address */ +#define CTRL_LAN3 0x0b /* SWH=0 LAN address */ +#define CTRL_LAN4 0x0c /* SWH=0 LAN address */ +#define CTRL_LAN5 0x0d /* SWH=0 LAN address */ +#define CTRL_BDID 0x0e /* SWH=0 Board ID */ +#define CTRL_CKSM 0x0f /* SWH=0 Checksum */ + +#define CTRL_PIDL 0x08 /* SWH=1 POS ID */ +#define CTRL_PIDH 0x09 /* SWH=1 POS ID */ +#define CTRL_IOADDR 0x0a /* SWH=1 IO address */ +#define CTRL_MEMADDR 0x0b /* SWH=1 MEM address */ +#define CTRL_BIO 0x0c /* SWH=1 BIOS base */ +#define CTRL_GCON 0x0d /* SWH=1 Gen control */ + +/* page-0, read */ + +#define LAN_PAGESIZE 0x20 /* page size */ +#define LAN_CMD 0x10 /* command */ +#define LAN_BOUND 0x13 /* boundary page */ +#define LAN_TSTAT 0x14 /* transmit status */ +#define LAN_COLCNT 0x15 /* collision error */ +#define LAN_INTSTAT 0x17 /* interrupt status */ +#define LAN_RSTAT 0x1c /* receive status */ +#define LAN_ALICNT 0x1d /* alignment error */ +#define LAN_CRCCNT 0x1e /* crc error */ +#define LAN_MPCNT 0x1f /* missed packet */ + +/* page-0, write */ + +#define LAN_RSTART 0x11 /* receive start */ +#define LAN_RSTOP 0x12 /* receive stop */ +#define LAN_TSTART 0x14 /* transmit start */ +#define LAN_TCNTL 0x15 /* transmit counter */ +#define LAN_TCNTH 0x16 /* transmit counter */ +#define LAN_RCON 0x1c /* receive config */ +#define LAN_TCON 0x1d /* transmit config */ +#define LAN_DCON 0x1e /* data config */ +#define LAN_INTMASK 0x1f /* interrupt mask */ + +/* page-1, read and write */ + +#define LAN_STA0 0x11 /* station address */ +#define LAN_STA1 0x12 /* station address */ +#define LAN_STA2 0x13 /* station address */ +#define LAN_STA3 0x14 /* station address */ +#define LAN_STA4 0x15 /* station address */ +#define LAN_STA5 0x16 /* station address */ +#define LAN_CURR 0x17 /* current page */ +#define LAN_MAR0 0x18 /* multicast address */ +#define LAN_MAR1 0x19 /* multicast address */ +#define LAN_MAR2 0x1a /* multicast address */ +#define LAN_MAR3 0x1b /* multicast address */ +#define LAN_MAR4 0x1c /* multicast address */ +#define LAN_MAR5 0x1d /* multicast address */ +#define LAN_MAR6 0x1e /* multicast address */ +#define LAN_MAR7 0x1f /* multicast address */ + +/* page-2, read and write */ + +#define LAN_NEXT 0x15 /* next page */ +#define LAN_ENH 0x17 /* enable features */ + +/* Control Register */ + +#define CON_RESET 0x80 +#define CON_MENABLE 0x40 + +/* Hardware Support Register */ + +#define HARD_SWH 0x80 + +/* BIOS Page Register */ + +#define BIOS_M16EN 0x80 + +/* Interrupt Control Register */ + +#define INT_ENABLE 0x01 + +/* Command Register */ + +#define CMD_PS1 0x80 +#define CMD_PS0 0x40 +#define CMD_TXP 0x04 +#define CMD_STA 0x02 +#define CMD_STP 0x01 + +/* Receive Configuration Register */ + +#define RCON_MON 0x20 +#define RCON_PROM 0x10 +#define RCON_GROUP 0x08 +#define RCON_BROAD 0x04 +#define RCON_RUNTS 0x02 +#define RCON_SEP 0x01 + +/* Transmit Configuration Register */ + +#define TCON_LB1 0x04 +#define TCON_LB0 0x02 +#define TCON_CRCN 0x01 + +/* Data Configuration Register */ + +#define DCON_BSIZE1 0x40 +#define DCON_BSIZE0 0x20 +#define DCON_BUS16 0x01 + +/* Interrupt Mask Register */ + +#define IM_CNTE 0x20 +#define IM_OVWE 0x10 +#define IM_TXEE 0x08 +#define IM_RXEE 0x04 +#define IM_PTXE 0x02 +#define IM_PRXE 0x01 + +/* Interrupt Status Register */ + +#define ISTAT_RST 0x80 +#define ISTAT_CNT 0x20 +#define ISTAT_OVW 0x10 +#define ISTAT_TXE 0x08 +#define ISTAT_RXE 0x04 +#define ISTAT_PTX 0x02 +#define ISTAT_PRX 0x01 + +/* Transmit Status Register */ + +#define TSTAT_OWC 0x80 +#define TSTAT_CDH 0x40 +#define TSTAT_UNDER 0x20 +#define TSTAT_CRL 0x10 +#define TSTAT_ABORT 0x08 +#define TSTAT_TWC 0x04 +#define TSTAT_NDT 0x02 +#define TSTAT_PTX 0x01 + +/* Receive Status Register */ + +#define RSTAT_DFR 0x80 +#define RSTAT_DIS 0x40 +#define RSTAT_GROUP 0x20 +#define RSTAT_MPA 0x10 +#define RSTAT_OVER 0x08 +#define RSTAT_FAE 0x04 +#define RSTAT_CRC 0x02 +#define RSTAT_PRX 0x01 + +/* Enable Features */ + +#define ENH_WAIT1 0x80 +#define ENH_WAIT0 0x40 +#define ENH_SLOT1 0x10 +#define ENH_SLOT0 0x08 + +/* BIO Base Register */ + +#define BIO_FINE16 0x80 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCultraEndh */ diff --git a/h/drv/end/wancomEnd.h b/h/drv/end/wancomEnd.h new file mode 100644 index 0000000..67c37b6 --- /dev/null +++ b/h/drv/end/wancomEnd.h @@ -0,0 +1,441 @@ +/* wancomEnd.h - Marvel/Galileo GT642xx network interface header */ + +/* Copyright 1990-2004 Wind River Systems, Inc. */ +/* Copyright 2002 Motorola, Inc. All Rights Reserved */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01e,09feb05,mdo Documentation fixes for apigen +01d,28jun04,h_k added pNetBufCfg and initType, deleted memBaseState and + hashState in WANCOM_DRV_CTRL and pMblk in RX_DESC. +01c,11jun04,h_k changed comment for baseAddr. merged wancomDefs.h. +01b,26mar04,h_k merged from cp7000g BSP. +01a,28oct02,scb Copied from hxeb100 base version 01a. +*/ + +/* +******************************************************************************** +* (c), Copyright 2001, Marvell International Ltd. * +* THIS CODE CONTAINS CONFIDENTIAL INFORMATION OF MARVELL SEMICONDUCTOR, INC. * +* NO RIGHTS ARE GRANTED HEREIN UNDER ANY PATENT, MASK WORK RIGHT OR COPYRIGHT * +* OF MARVELL OR ANY THIRD PARTY. MARVELL RESERVES THE RIGHT AT ITS SOLE * +* DISCRETION TO REQUEST THAT THIS CODE BE IMMEDIATELY RETURNED TO MARVELL. * +* THIS CODE IS PROVIDED "AS IS". MARVELL MAKES NO WARRANTIES, EXPRESS, IMPLIED * +* OR OTHERWISE, REGARDING ITS ACCURACY, COMPLETENESS OR PERFORMANCE. * +******************************************************************************** +* wancomEnd.h - Header File for : GT-642xx network interface header +* +* DESCRIPTION: +* This file defines the network devices that can be attached to the MUX. +* +* DEPENDENCIES: +* WRS endLib library. +* +******************************************************************************** +*/ + +#ifndef __INCwancomEndh +#define __INCwancomEndh + +/* includes */ + +#include "etherLib.h" +#include "miiLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define DRV_NAME "wancom" + +/* descriptor defines */ + +#define SHADOW_OWNER_BY_GT 1 +#define SHADOW_OWNER_BY_CPU 0 +#define OWNER_BY_GT (1<<31) +#define FIRST (1<<17) +#define LAST (1<<16) +#define ENABLE_INTERRUPT (1<<23) +#define PADDING (1<<18) +#define GENERATE_CRC (1<<22) +#define ERROR_SUMMARY (1<<15) + +/* this macros are used to enable access to MPSC_SDCMR */ + +#define ENABLE_RX_DMA (1<<7) +#define ABORT_RECEIVE (1<<15) +#define STOP_TRANSMIT (1<<16) +#define PORT_SDMA_STOP_TX_LOW (1<<17) +#define TX_DEMAND (1<<23) +#define PORT_SDMA_START_TX_LOW (1<<24) +#define ABORT_TRANSMIT (1<<31) + +/* Serial second layer cause registers bits definition */ +/* Ethernet mask bits */ + +#define RX_BUFFER_RETURN 0x1 +#define TX_BUFFER_HIGH_PRIO 0x4 +#define TX_BUFFER_LOW_PRIO 0x8 +#define TX_END_HIGH_PRIO 0x40 +#define TX_END_LOW_PRIO 0x80 +#define RX_RESOURCE_ERR 0x100 +#define TX_RESOURCE_ERR_HIGH_PRIO 0x400 +#define TX_RESOURCE_ERR_LOW_PRIO 0x800 +#define RX_OVERRUN 0x1000 +#define TX_UNDERRUN 0x2000 +#define RX_BUFFER_QUEUE_0 (1<<16) +#define RX_BUFFER_QUEUE_1 (1<<17) +#define RX_BUFFER_QUEUE_2 (1<<18) +#define RX_BUFFER_QUEUE_3 (1<<19) +#define RX_ERROR_QUEUE_0 (1<<20) +#define RX_ERROR_QUEUE_1 (1<<21) +#define RX_ERROR_QUEUE_2 (1<<22) +#define RX_ERROR_QUEUE_3 (1<<23) +#define MII_PHYS_STATUS_CHANGE 0x10000000 +#define SMI_COMMAND_DONE 0x20000000 +#define ETHER_INT_SUM 0x80000000 + +/* Serial Port Multiplex register (connect to MII control) */ + +#define SERIAL_PORT_MULTIPLEX 0xf010 + +#define ETHERNET_PORTS_DIFFERENCE_OFFSETS 0x400 + +#define NIBBLE_SWAPPING_16_BIT(X) (((X&0xf)<<4) | ((X&0xf0)>>4) | \ + ((X&0xf00)<<4) | ((X&0xf000)>>4)) + +#define NIBBLE_SWAPPING_32_BIT(X) (((X&0xf)<<4) | ((X&0xf0)>>4) | \ + ((X&0xf00)<<4) | ((X&0xf000)>>4) | ((X&0xf0000)<<4) | \ + ((X&0xf00000)>>4) | ((X&0xf000000)<<4) | ((X&0xf0000000)>>4)) + +#define GT_NIBBLE(X) ((X&0x1)<<3)+((X&0x2)<<1)+((X&0x4)>>1)+((X&0x8)>>3) + +#define FLIP_6_BITS(X) (((X&0x1)<<5)+((X&0x2)<<3)+((X&0x4)<<1)+ \ + ((X&0x8)>>1)+((X&0x10)>>3)+((X&0x20)>>5)) + +#define FLIP_9_BITS(X) (((X&0x1)<<8)+((X&0x2)<<6)+((X&0x4)<<4)+ \ + ((X&0x8)<<2)+((X&0x10)<<0)+((X&0x20)>>2)+((X&0x40)>>4)+ \ + ((X&0x80)>>6)+((X&0x100)>>8)) + +#define _8K_TABLE 0 +/* size of hash entry for an address */ + +#define MAC_ENTRY_SIZE 8 +/* hash table entry fields */ + +#define VALID_BIT 0 +#define VALID 1 +#define NOT_VALID 0 +#define SKIP_BIT 1 +#define SKIP (1<<1) +#define DONT_SKIP 0 +#define RD_BIT 2 +#define RCV_PKT 1 +#define DROP_RCV_PKT 0 + +#define HOP_NUMBER 12 + +#define EIGHT_K 0x8000 +#define HALF_K 0x8000/16 + +#define HASH_DEFUALT_MODE 14 +#define HASH_MODE 13 +#define HASH_SIZE 12 +#define PROMISCUOUS_MODE 0 + +#define WANCOM_BUF_DEF_SIZE (SIZEOF_ETHERHEADER + ETHERMTU + 4) + +/* For buffers less than 8 bytes */ + +#define TX_BUF_OFFSET_IN_DESC 0x18 +/* ethernet configuration value */ + +#define PORT_CONFIG_VALUE 0x00000081 + +/* Ethernet config ext. value */ + +#define PORT_CONFIG_EXTEND_VALUE 0x00010800 + +/* SDMA configure value */ + +#if (_BYTE_ORDER == _BIG_ENDIAN) +/* big endian DMA transfer mode */ + +#define PORT_SDMA_CONFIG_VALUE 0x00002000 + +#else +/* little endian DMA transfer mode */ + +#define PORT_SDMA_CONFIG_VALUE 0x000020c0 + +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + +/* serial ports multiple x reg (RMII and mpsc's connected) */ + +#define GT_SERIAL_PORT_MUX 0x00000001 + +#ifndef WANCOM_SYS_INT_CONNECT +#define WANCOM_SYS_INT_CONNECT(pDrvCtrl, pFunc, arg, pRet) \ + { \ + *pRet = ERROR ; \ + if(wancomEndIntConnect != NULL) \ + { \ + *pRet = (wancomEndIntConnect) ( \ + INUM_TO_IVEC (pDrvCtrl->port.vector), \ + (VOIDFUNCPTR*)(pFunc), (int) (arg)); \ + } \ + } +#endif /* WANCOM_SYS_INT_CONNECT */ + +#ifndef WANCOM_SYS_INT_DISCONNECT +#define WANCOM_SYS_INT_DISCONNECT(pDrvCtrl, pFunc, arg, pRet) \ + { \ + *pRet = ERROR ; \ + if(wancomEndIntDisconnect != NULL) \ + { \ + *pRet = (wancomEndIntDisconnect) ((VOIDFUNCPTR*) \ + INUM_TO_IVEC (pDrvCtrl->port.level), \ + (pFunc), (int) (arg)); \ + } \ + } +#endif /* WANCOM_SYS_INT_DISCONNECT */ + +#ifndef WANCOM_SYS_INT_ENABLE +#define WANCOM_SYS_INT_ENABLE(pDrvCtrl) \ +if (WANCOM_INT_ENABLE (pDrvCtrl)) \ + ((*(FUNCPTR) (WANCOM_INT_ENABLE (pDrvCtrl))) (pDrvCtrl->unit)) +#endif /* WANCOM_SYS_INT_ENABLE */ + +#ifndef WANCOM_SYS_INT_DISABLE +#define WANCOM_SYS_INT_DISABLE(pDrvCtrl) \ +if (WANCOM_INT_DISABLE (pDrvCtrl)) \ + ((*(FUNCPTR) (WANCOM_INT_DISABLE (pDrvCtrl))) (pDrvCtrl->unit)) +#endif /* WANCOM_SYS_INT_DISABLE */ + +#ifndef WANCOM_SYS_INT_ACK +#define WANCOM_SYS_INT_ACK(pDrvCtrl) \ +if (WANCOM_INT_ACK (pDrvCtrl)) \ + ((*(FUNCPTR) (WANCOM_INT_ACK (pDrvCtrl))) (pDrvCtrl->unit)) +#endif /* WANCOM_SYS_INT_ACK */ + +#ifndef LOCAL_TO_SYS_ADDR +#define LOCAL_TO_SYS_ADDR(unit,localAddr) \ + ((int) pDrvCtrl->port.sysLocalToBus ? \ + (*pDrvCtrl->port.sysLocalToBus) (unit, localAddr) : localAddr) +#endif /* LOCAL_TO_SYS_ADDR */ + +#ifndef SYS_TO_LOCAL_ADDR +#define SYS_TO_LOCAL_ADDR(unit,sysAddr) \ + ((int) pDrvCtrl->port.sysBusToLocal ? \ + (*pDrvCtrl->port.sysBusToLocal)(unit, sysAddr) : sysAddr) +#endif /* SYS_TO_LOCAL_ADDR */ + + +/* CPU interface registers */ + +#define WANCOM_DEV_NAME "wancom" +#define WANCOM_DEV_NAME_LEN 7 +#define DEF_NUM_CFDS 32 /* default number of CFDs (Hex) */ +#define DEF_NUM_RFDS 32 /* default number of RFDs (Hex) */ +#define WANCOM_100MBS 100000000 /* bits per sec */ +#define WANCOM_10MBS 10000000 /* bits per sec */ +#define WANCOM_ADDR_LEN 6 /* ethernet address length */ + +/* constants needed within this file */ + +#define EH_SIZE 14 /* avoid structure padding issues */ +#define N_MCAST 12 + +/* offsets from 642xx register base address */ + +#define PORT0_BASE_OFFSET 0x2400 /* ethernet 0 base addr */ +#define ETH_SMIR_BASE_OFFSET 0x2010 /* SMIR register */ +#define ETH_PHY_BASE_OFFSET 0x2000 /* Phy register */ + +/* Ethernet port register offsets from port base address */ + +#define PORT_CONFIG_REG 0x000 +#define PORT_CONFIG_EXTEND_REG 0x008 +#define PORT_COMMAND_REG 0x010 +#define PORT_STATUS_REG 0x018 +#define SERIAL_PARAMETERS_REG 0x020 +#define HASH_TABLE_POINTER_REG 0x028 +#define FLOW_CONTROL_SOURCE_ADDRESS_LOW 0x030 +#define FLOW_CONTROL_SOURCE_ADDRESS_HIGH 0x038 +#define SDMA_CONFIGURATION_REG 0x040 +#define SDMA_COMMAND_REG 0x048 +#define INTERRUPT_CAUSE_REG 0x050 +#define INTERRUPT_MASK_REG 0x058 +#define FIRST_RX_DESC_PTR0_OFFSET 0x080 +#define FIRST_RX_DESC_PTR1_OFFSET 0x084 +#define FIRST_RX_DESC_PTR2_OFFSET 0x088 +#define FIRST_RX_DESC_PTR3_OFFSET 0x08c +#define CURRENT_RX_DESC_PTR0_OFFSET 0x0a0 +#define CURRENT_RX_DESC_PTR1_OFFSET 0x0a4 +#define CURRENT_RX_DESC_PTR2_OFFSET 0x0a8 +#define CURRENT_RX_DESC_PTR3_OFFSET 0x0ac +#define CURRENT_TX_DESC_PTR0_OFFSET 0x0e0 +#define CURRENT_TX_DESC_PTR1_OFFSET 0x0e4 +#define MIB_COUNTER_BASE 0x100 +#define MIB_COUNTER_END 0x200 + +/* Port status register bits offset in register */ + +#define SPEED_100MBS (1<<0) +#define LINK_UP_BIT (1<<3) +#define TX_LOW_RUNNING (1<<5) +#define TX_HIGH_RUNNING (1<<6) +#define TX_IN_PROGRESS (1<<7) + +/* Port Config register bits offset in register */ + +#define PROMISCUOUS_MODE_BIT (1<<0) + + +/* typedefs */ +/* board specific information */ + +typedef struct + { + UINT32 vector; /* interrupt vector */ + UINT32 level; /* interrupt level */ + UINT32 baseAddr; /* Port registers base address */ + UCHAR enetAddr[8]; /* eth address with 2 byte pad */ + int (*intEnable)(int unit); /* port interrupt enable routine */ + int (*intDisable)(int unit); /* port interrupt disable routine */ + int (*intAck) (int unit); /* interrupt ack */ + UINT32 portConfig; + UINT32 portConfigExtend; + UINT32 portCommand; + UINT32 portSdmaConfig; + int offset; + } WANCOM_PORT_INFO; + +typedef unsigned int RX_COMMAND; + +typedef struct SdmaRxDesc + { +#if (_BYTE_ORDER == _BIG_ENDIAN) + unsigned int bufsize :16; + volatile unsigned int bytecnt :16; + volatile RX_COMMAND cmd_sts; + unsigned int next_desc_ptr; + volatile unsigned int buf_ptr; +#else /* _BYTE_ORDER == _BIG_ENDIAN */ + volatile RX_COMMAND cmd_sts; + volatile unsigned int bytecnt :16; + unsigned int bufsize :16; + unsigned int buf_ptr; + unsigned int next_desc_ptr; +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + M_BLK_ID pMblk; + /* to be safe, align the structure size multiple of 32 bytes */ + unsigned int reserved [3]; + } RX_DESC; + +typedef unsigned int TX_COMMAND; + +/* tx descriptor definition. buf is used for sending small buffers + * less than 8 bytes in size. buf is placed so it is on a boundary + * that is divisible by 8 (required for buffers <= 8 bytes) and + * sized so the descriptor is divisible evenly by 16 + */ + +typedef struct SdmaTxDesc + { +#if (_BYTE_ORDER == _BIG_ENDIAN) + unsigned int bytecnt :16; + unsigned int shadowOwner :16; + volatile TX_COMMAND cmd_sts; + unsigned int next_desc_ptr; + unsigned int buf_ptr; +#else /* _BYTE_ORDER == _BIG_ENDIAN */ + volatile TX_COMMAND cmd_sts; + unsigned int shadowOwner :16; + unsigned int bytecnt :16; + unsigned int buf_ptr; + unsigned int next_desc_ptr; +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + UINT8 buf [8]; + M_BLK * pointerToRxQueue; + char * txBuffPtr; + } TX_DESC; + +/* The definition of the driver control structure */ + +typedef struct wancom_drv_ctrl + { + END_OBJ endObj; /* base class */ + int unit; /* unit number */ + char * pMemBase; /* memory pool base */ + ULONG memSize; /* memory pool size */ + char * pClsBase; /* cluster pool base */ + char * pMemArea; /* Mblk Clblk pool pointer */ + char * pTxBuffBase; /* tx buffer base address */ + int nCFDs; /* how many CFDs to create */ + volatile int nFreeCFDs; /* how many CFDs freed */ + int nRFDs; /* how many RFDs to create */ + UINT32 pCSR; /* pointer to CSR base */ + + RX_DESC* headRxDescPtr; /* Pointer to head Rx desc queue */ + RX_DESC* rxDescMem; /* Pointer to start of Rx desc memory */ + TX_DESC* usedTxDescPtr; /* Pointer to head Tx desc queue */ + TX_DESC* currTxDescPtr; /* Pointer to next available Tx desc */ + TX_DESC* txDescMem; /* Pointer to start of Tx desc memory */ + + UINT16 flags; /* driver state */ + BOOL attached; /* interface has been attached */ + BOOL rxHandle; /* rx handler scheduled */ + BOOL txHandle; /* tx handler scheduled */ + BOOL txStall; /* tx handler stalled - no CFDs */ + END_ERR lastError; /* Last error passed to muxError */ + WANCOM_PORT_INFO port; /* port specific info */ + CL_POOL_ID pClPoolId; /* cluster pool identifier */ + int addressTableHashMode ; + int addressTableHashSize ; + UINT32 addressTableBase ; + char * addressTableMalloc ; + int initType; /* memory pool initialization type */ + NETBUF_CFG * pNetBufCfg; + } WANCOM_DRV_CTRL; + +#if (_BYTE_ORDER == _BIG_ENDIAN) +#define PSWAP(x) LONGSWAP(x) +#else /* _BYTE_ORDER == _LITTLE_ENDIAN */ +#define PSWAP(x) (x) +#endif + +#ifndef EIEIO +#define EIEIO +#endif + +#define WANCOM_REG_RD(x,val) \ + { \ + UINT32 tmp ; \ + tmp = *((volatile UINT32*)(x)); \ + EIEIO ; \ + (*val) = PSWAP(tmp); \ + EIEIO ; \ + } + +#define WANCOM_REG_WR(x,val) \ + { \ + UINT32 tmp ; \ + tmp = PSWAP(val); \ + EIEIO ; \ + *((volatile UINT32*)(x)) = tmp ; \ + EIEIO ; \ + tmp = *((volatile UINT32*)(x)); \ + } + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwancomEndh */ + diff --git a/h/drv/erf/erfLib.h b/h/drv/erf/erfLib.h new file mode 100644 index 0000000..5feb477 --- /dev/null +++ b/h/drv/erf/erfLib.h @@ -0,0 +1,100 @@ +/* erfLib.c - Event Reporting Framework Library */ + +/* +* Copyright (c) 2005 Wind River Systems, Inc. +* +* The right to copy, distribute, modify or otherwise make use +* of this software may be licensed only pursuant to the terms +* of an applicable Wind River license agreement. +*/ + +/* +modification history +-------------------- +01e,24jun05,jmt Allow multiple tasks and auto unregistration +01d,01sep05,mil Fixed build warning on useless keyword/empty declaration. +01c,17may05,jmt Update after Design review +01b,23mar05,jmt Continue implementation after initial review +01a,16mar05,jmt written +*/ + +/* +DESCRIPTION +This module provides an Event Reporting Framework for use by other +libraries. + +INCLUDE FILES: vwModNum.h +*/ + +#ifndef INCerfLibh +#define INCerfLibh + +#include + +/* defines */ + +/* erfHandlerRaise "procType" defines */ +#define ERF_ASYNC_PROC 0 /* Asynchronous (delayed) proc */ +#define ERF_SYNC_PROC 1 /* Synchronous (immediate) proc */ +#define ERF_PROC_TYPE_MAX ERF_SYNC_PROC /* for range checking */ + +/* erfHandlerRegister Event Processing flags Defines */ +#define ERF_FLAG_NONE 0 /* No options needed */ +#define ERF_FLAG_AUTO_UNREG 1 /* Auto Unregister after event */ +#define ERF_FLAG_MAX ERF_FLAG_AUTO_UNREG /* for range checking */ + +/* Event Category and Type Defines */ +#define ERF_NUM_SYSTEM_CATEGORIES 1 +#define ERF_MAX_NUM_SYSTEM_TYPES 3 /* must include T_erfLib_ALL_TYPES */ + +/* Globally defined Types */ +#define T_erfLib_ALL_TYPES 0 + +/* Test Event Category and related types */ +#define C_erfLib_TEST_CATEGORY 0 +#define T_erfLib_TEST_0_TYPE 1 +#define T_erfLib_TEST_1_TYPE 2 + +/* errno defines */ +#define S_erfLib_INVALID_PARAMETER (M_erfLib | 0x0001) +#define S_erfLib_MEMORY_ERROR (M_erfLib | 0x0002) +#define S_erfLib_INIT_ERROR (M_erfLib | 0x0003) +#define S_erfLib_TOO_MANY_USER_CATS (M_erfLib | 0x0004) +#define S_erfLib_TOO_MANY_USER_TYPES (M_erfLib | 0x0005) +#define S_erfLib_HANDLER_NOT_FOUND (M_erfLib | 0x0006) +#define S_erfLib_QUEUE_EMPTY (M_erfLib | 0x0007) +#define S_erfLib_QUEUE_FULL (M_erfLib | 0x0008) +#define S_erfLib_QUEUE_ALREADY_CREATED (M_erfLib | 0x0009) +#define S_erfLib_AUTO_UNREG_ERROR (M_erfLib | 0x000A) + + +/* typedefs */ + +typedef void erfHandlerPrototype (UINT16 maxUserCat, UINT16 maxUserType, + void * pEventData, void * pUserData); + +typedef void erfFreePrototype (void * __ptr); + +/* forward declarations */ + +STATUS erfLibInit (UINT16 maxUserCat, UINT16 maxUserType); +UINT16 erfMaxCategoriesGet(); +UINT16 erfMaxTypesGet(); +UINT16 erfQueueSizeGet(); +STATUS erfHandlerRegister(UINT16 eventCat, UINT16 eventType, + erfHandlerPrototype * pEventHandler, + void * pUserData, UINT16 flags); +STATUS erfHandlerUnregister(UINT16 eventCat, UINT16 eventType, + erfHandlerPrototype * pEventHandler, + void * pUserData); + +STATUS erfCategoryAllocate(UINT16 * pEventCat); +STATUS erfCategoryQueueCreate(UINT16 pEventCat, int queueSize, int priority); +STATUS erfTypeAllocate(UINT16 eventCat, UINT16 * pEventType); +UINT16 erfCategoriesAvailable(); +UINT16 erfTypesAvailable(UINT16 eventCat); + +STATUS erfEventRaise(UINT16 eventCat, UINT16 eventType, int procType, + void * pEventData, erfFreePrototype * pFreeFunc); + +#endif /* INCerfLibh */ diff --git a/h/drv/erf/erfLibP.h b/h/drv/erf/erfLibP.h new file mode 100644 index 0000000..e8150c1 --- /dev/null +++ b/h/drv/erf/erfLibP.h @@ -0,0 +1,66 @@ +/* erfLibP.c - Event Reporting Framework Library Private header*/ + +/* +* Copyright (c) 2005 Wind River Systems, Inc. +* +* The right to copy, distribute, modify or otherwise make use +* of this software may be licensed only pursuant to the terms +* of an applicable Wind River license agreement. +*/ + +/* +modification history +-------------------- +01a,27jun05,jmt written +*/ + +/* +DESCRIPTION +This file provides the private definitions for the Event Reporting Framework. + +INCLUDE FILES: erfLib.h +*/ + +#ifndef INCerfLibPh +#define INCerfLibPh + +#include "erfLib.h" + +/* defines */ + +/* typedefs */ + +struct eventHandlerStruct /* Event Handler Info */ + { + UINT16 flags; /* processing flags */ + erfHandlerPrototype * pHandler; /* handler function */ + void * pUserData; /* User Data Pointer */ + struct eventHandlerStruct * next; /* next in list */ + }; + +struct erfQueueElementStruct + { + UINT16 eventCat; /* Event Category */ + UINT16 eventType; /* Event Type */ + void * pEventData; /* Pointer to Event Data */ + erfFreePrototype * pFreeFunc; /* Func to free Event Data when done */ + }; + +struct erfQueueStruct + { + UINT16 queueSize; /* number of elements */ + UINT16 firstElement; /* index number of first element */ + UINT16 firstFreeElement; /* index number of last element */ + SEM_ID queueCount; /* Counting semaphore for handling elements */ + int eventTaskId; /* Event Task ID */ + struct erfQueueElementStruct data[1]; /* List of Event Records */ + }; + + +/* forward declarations */ + +UINT16 erfMaxCategoriesGet(); +UINT16 erfMaxTypesGet(); +UINT16 erfQueueSizeGet(); + +#endif /* INCerfLibPh */ diff --git a/h/drv/erf/erfShow.h b/h/drv/erf/erfShow.h new file mode 100644 index 0000000..04c0e1a --- /dev/null +++ b/h/drv/erf/erfShow.h @@ -0,0 +1,39 @@ +/* erfLib.c - Event Reporting Framework Library */ + +/* +* Copyright (c) 2005 Wind River Systems, Inc. +* +* The right to copy, distribute, modify or otherwise make use +* of this software may be licensed only pursuant to the terms +* of an applicable Wind River license agreement. +*/ + +/* +modification history +-------------------- +01b,22jul05,jmt Allow multiple tasks and auto unregistration +01a,30mar05,jmt written +*/ + +/* +DESCRIPTION +This module provides an Event Reporting Framework Show and debug routines. + +INCLUDE FILES: +*/ + +#ifndef INCerfShowh +#define INCerfShowh + +/* defines */ + +/* typedefs */ + +/* forward declarations */ + +void erfShow(); +UINT16 erfMaxCategoriesGet(); +UINT16 erfMaxTypesGet(); +UINT16 erfDefaultQueueSizeGet(); + +#endif /* INCerfShowh */ diff --git a/h/drv/fdisk/nec765Fd.h b/h/drv/fdisk/nec765Fd.h new file mode 100644 index 0000000..058c6b8 --- /dev/null +++ b/h/drv/fdisk/nec765Fd.h @@ -0,0 +1,158 @@ +/* nec765Fd.h - NEC 765 floppy disk controller header */ + +/* Copyright 1984-1993 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01f,10dec97,ms added prototype for usrFdConfig +01e,31aug95,hdn added error code, + FD_UNFORMATED FD_WRITE_PROTECTED FD_DISK_NOT_PRESENT +01d,25oct94,hdn added FD_RAW structure for fdRawio(). + added fdRawio() function declarations. +01c,22apr94,hdn moved FD_DMA_BUF, FD_DMA_BUF_SIZE to config.h. +01b,06apr94,hdn changed the DMA address from 0x1000 to 0x2000. +01a,30sep93,hdn written. +*/ + +#ifndef __INCnec765Fdh +#define __INCnec765Fdh + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifndef _ASMLANGUAGE + +#include "blkIo.h" + +typedef struct fdDev + { + BLK_DEV blkDev; + int fdType; /* floppy disk type */ + int drive; /* drive no. 0 - 3 */ + int blkOffset; /* sector offset */ + } FD_DEV; + +typedef struct fdType + { + int sectors; /* no of sectors */ + int sectorsTrack; /* sectors per track */ + int heads; /* no of heads */ + int cylinders; /* no of cylinders */ + int secSize; /* bytes per sector, 128 << secSize */ + char gap1; /* gap1 size for read, write */ + char gap2; /* gap2 size for format */ + char dataRate; /* data transfer rate */ + char stepRate; /* stepping rate */ + char headUnload; /* head unload time */ + char headLoad; /* head load time */ + char mfm; /* MFM bit for read, write, format */ + char sk; /* SK bit for read */ + char *name; /* name */ + } FD_TYPE; + +typedef struct fdRaw + { /* this is for IDERAWACCESS ioctl */ + UINT cylinder; /* cylinder (0 -> (cylindres-1)) */ + UINT head; /* head (0 -> (heads-1)) */ + UINT sector; /* sector (1 -> sectorsTrack) */ + char *pBuf; /* pointer to buffer (bytesSector * nSecs) */ + UINT nSecs; /* number of sectors (1 -> sectorsTrack) */ + UINT direction; /* read=0, write=1 */ + } FD_RAW; + + +/* max number of FD drives */ + +#define FD_MAX_DRIVES 4 + +/* error code */ + +#define FD_UNFORMATED -2 /* unformated diskette */ +#define FD_WRITE_PROTECTED -3 /* write protected diskette */ +#define FD_DISK_NOT_PRESENT -4 /* no diskette */ + + +/* FDC IO address */ + +#define FD_REG_OUTPUT 0x3f2 +#define FD_REG_STATUS 0x3f4 +#define FD_REG_COMMAND 0x3f4 +#define FD_REG_DATA 0x3f5 +#define FD_REG_INPUT 0x3f7 +#define FD_REG_CONFIG 0x3f7 + +/* FDC Digital Output Register */ + +#define FD_DOR_DRIVE0_SEL 0x00 +#define FD_DOR_DRIVE1_SEL 0x01 +#define FD_DOR_DRIVE2_SEL 0x02 +#define FD_DOR_DRIVE3_SEL 0x03 +#define FD_DOR_RESET 0x00 +#define FD_DOR_CLEAR_RESET 0x04 +#define FD_DOR_DMA_DISABLE 0x00 +#define FD_DOR_DMA_ENABLE 0x08 +#define FD_DOR_DRIVE_ON 0x10 + +/* FDC Main Status Register */ + +#define FD_MSR_DRIVE0_SEEK 0x01 +#define FD_MSR_DRIVE1_SEEK 0x02 +#define FD_MSR_DRIVE2_SEEK 0x04 +#define FD_MSR_DRIVE3_SEEK 0x08 +#define FD_MSR_FD_BUSY 0x10 +#define FD_MSR_EXEC_MODE 0x20 +#define FD_MSR_DIRECTION 0x40 +#define FD_MSR_RQM 0x80 + +/* FDC Commands */ + +#define FD_CMD_SPECIFY 0x03 +#define FD_CMD_SENSEDRIVE 0x04 +#define FD_CMD_RECALIBRATE 0x07 +#define FD_CMD_SENSEINT 0x08 +#define FD_CMD_SEEK 0x0f +#define FD_CMD_READ 0x06 +#define FD_CMD_WRITE 0x05 +#define FD_CMD_FORMAT 0x0d + +#define FD_CMD_LEN_SPECIFY 3 +#define FD_CMD_LEN_SENSEDRIVE 2 +#define FD_CMD_LEN_RECALIBRATE 2 +#define FD_CMD_LEN_SENSEINT 1 +#define FD_CMD_LEN_SEEK 3 +#define FD_CMD_LEN_RW 9 +#define FD_CMD_LEN_FORMAT 6 + +/* FDC's DMA channel */ + +#define FD_DMA_CHAN 2 + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +STATUS fdDrv (int vector, int level); +BLK_DEV *fdDevCreate (int fdType, int drive, int nBlks, int offset); +STATUS fdRawio (int drive, int fdType, FD_RAW *pFdRaw); +STATUS usrFdConfig (int type, int drive, char *fileName); + +#else + +STATUS fdDrv (); +BLK_DEV *fdDevCreate (); +STATUS fdRawio (); +STATUS usrFdConfig (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnec765Fdh */ + diff --git a/h/drv/hdisk/ataDrv.h b/h/drv/hdisk/ataDrv.h new file mode 100644 index 0000000..a4d79b7 --- /dev/null +++ b/h/drv/hdisk/ataDrv.h @@ -0,0 +1,1614 @@ +/* ataDrv.h - ATA/ATAPI library header file */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify, or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01f,25sep05,dee remove ATA_DEBUG, use ADDED_CFLAGS -DATA_DEBUG +01e,15sep05,dee SPR#111796 +01d,06sep05,dee change name from sysInWordStringReverse to sysInWordStringRev + to match bsp function naming +01c,29aug05,dee use only one bio queue per controller +01b,12aug05,dee changes for XBD conversion +01a,14dec??,bri created + +*/ + +#ifndef __INCataDrvh +#define __INCataDrvh + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifndef _ASMLANGUAGE + +/* includes */ + +#include +#include +#include +#include +#include +#include +#include + +extern VOIDFUNCPTR _func_sysAtaInit; +extern void sysInWordStringRev (ULONG ioAddr, UINT16 *bufPtr, int nWords); + +/* defines */ + +/* Special BSP INIT After ATA Reset */ + +#ifndef SYS_ATA_INIT_RTN + #define SYS_ATA_INIT_RTN(pCtrl) if (_func_sysAtaInit != NULL) \ + { \ + ((*_func_sysAtaInit)(pCtrl)); \ + } +#endif + +#if !defined(ATA_ZERO) +# define ATA_ZERO (0) +#endif + +#ifdef ATA_DEBUG + + #define ATA_LOCAL + + /* debug verbosity level. Highest is 20. + * + * Error Messages 2 + * Drive params 9 + * function entry with params 12 + * notify that an action is started 13 + * control flow like function entry and exit 14 + * Intermediate state 15 + * Interrupt messages 19 + */ + + #define ATA_DEBUG_MSG(lvl, fmt, a1, a2, a3, a4, a5, a6) \ + if ((lvl) <= ataDebugLevel) \ + { \ + logMsg (fmt, (int)(a1), (int)(a2), (int)(a3), (int)(a4), \ + (int)(a5), (int)(a6)); \ + taskDelay(15); \ + } + + #define ATA_INTR_MSG(fmt, a1, a2, a3, a4, a5, a6) \ + if (ataIntrDebug) \ + logMsg (fmt, (int)(a1), (int)(a2), (int)(a3), (int)(a4), \ + (int)(a5), (int)(a6)); +#else + #define ATA_DEBUG_MSG(lvl, fmt, a1, a2, a3, a4, a5, a6) + #define ATA_INTR_MSG(fmt, a1, a2, a3, a4, a5, a6) + #define ATA_LOCAL LOCAL +#endif + + +/* + * make it compatible for little/big endian machines. + * i.e. swap for Big Endian machines + */ + +#if _BYTE_ORDER == _BIG_ENDIAN + #define ATA_SWAP(x) LONGSWAP(x) +#else + #define ATA_SWAP(x) (x) +#endif + + + +/* defines */ + +/* user can modify the following section + * modification will affect the driver footprint code and data sections + */ + +/* + * Power Management feature set - + * SMART feature set - Must not be enabled for devices implementing + * packet command feature set + */ +#undef ATA_SMART_FEATURE /* Enable/Disable Smart feature set */ +#undef ATA_CFA_FEATURE /* Enable/Disable CFA feature set */ + +/* QUEUEING IS NOT SUPPORT - DO NOT DEFINE */ +#undef ATAPI_QUEUED_FEATURE /* Enable/Disable Queued feature set */ + +/* OVERLAP IS NOT YET SUPPORTED - DO NOT DEFINE */ +#undef ATAPI_OVERLAPPED_FEATURE /* Overlapped feature set */ + +#undef ATAPI_PWR_MNGMT /* enable/disable Pwr Manag. feature */ +#undef ATAPI_ADV_PWR_MNGMT /* enable/disable Pwr Manag. feature */ +#undef ATAPI_SECURITY_FEATURE /* enable/disable security feature */ +#undef ATAPI_PWRUP_IN_STDBY /* enable/disable Pwr-up in standby */ +/* + * Removable Media feature set - Not implementing Packet Command feature set. + * - Media status notification disabled. + * - ATA_CMD_MEDIA_LOCK, + * ATA_CMD_MEDIA_UNLOCK, + * ATA_CMD_MEDIA_EJECT commands will not work if + * this feature is disabled. + */ +#undef REMOV_MEDIA_FEATURE /* enable/disable Remov. media feature */ +#undef REMOV_MEDIA_NOTIFY /* enable/disable Remov. status Notif. */ + +/* Host protected area feature set + * - Use prohibited if Removable media feature set + * - More than one Nonvolatile setmax address + * is prohibited. + */ +#undef HOST_PROT_AREA_FEATURE /* Host protected area feature set */ +/* end of user configurable */ + +/* IoCtl definitions */ + +/* security feature */ + +#define IOCTL_DIS_MASTER_PWD 0x00 +#define IOCTL_DIS_USER_PWD 0x01 +#define IOCTL_ERASE_PREPARE 0x02 +#define IOCTL_NORMAL_ERASE_UNIT_USR 0x03 +#define IOCTL_NORMAL_ERASE_UNIT_MSTR 0x04 +#define IOCTL_ENH_ERASE_UNIT_USR 0x05 +#define IOCTL_ENH_ERASE_UNIT_MSTR 0x06 +#define IOCTL_FREEZE_LOCK 0x07 +#define IOCTL_SET_PASS_MSTR 0x08 +#define IOCTL_SET_PASS_USR_HIGH 0x09 +#define IOCTL_SET_PASS_USR_MAX 0x0A +#define IOCTL_UNLOCK_USR 0x0B +#define IOCTL_UNLOCK_MSTR 0x0C +/* removable media feauture */ +#define IOCTL_EJECT_DISK 0X0F +#define IOCTL_LOAD_DISK 0X10 +#define IOCTL_GET_MEDIA_STATUS 0x11 +#define IOCTL_MEDIA_LOCK 0X12 +#define IOCTL_MEDIA_UNLOCK 0X13 + +/* removable media notification feature */ + +#define IOCTL_ENA_REMOVE_NOTIFY 0x14 +#define IOCTL_DISABLE_REMOVE_NOTIFY 0x15 + +/* Advanced Power Management feature */ + +#define IOCTL_ENB_SET_ADV_POW_MNGMNT 0X20 +#define IOCTL_DISABLE_ADV_POW_MNGMNT 0X21 + +/* Power-up in standby feature */ + +#define IOCTL_ENB_POW_UP_STDBY 0X30 + +/* Host protected area feature */ + +#define IOCTL_READ_NATIVE_MAX_ADDRESS 0XC0 +#define IOCTL_SET_MAX_ADDRESS 0XC1 +#define IOCTL_SET_MAX_SET_PASS 0XC2 +#define IOCTL_SET_MAX_LOCK 0XC3 +#define IOCTL_SET_MAX_UNLOCK 0XC4 +#define IOCTL_SET_MAX_FREEZE_LOCK 0XC5 + +/* SMART feature */ + +#define IOCTL_SMART_READ_DATA 0XD0 +#define IOCTL_SMART_ENABLE_ATTRIB_AUTO 0XD1 +#define IOCTL_SMART_DISABLE_ATTRIB_AUTO 0XD2 +#define IOCTL_SMART_SAVE_ATTRIB 0XD3 +#define IOCTL_SMART_OFFLINE_IMMED 0XD4 +#define EXEC_OFF_IMMED_OFF_MODE 0 +#define EXEC_SHORT_SELF_IMMED_OFF_MODE 1 +#define EXEC_EXT_SELF_IMMED_OFF_MODE 2 +#define ABORT_OFF_MODE_SELF_IMMED 127 +#define EXEC_SHORT_SELF_IMMED_CAP_MODE 129 +#define EXEC_EXT_SELF_IMMED_CAP_MODE 130 +#define IOCTL_SMART_READ_LOG_SECTOR 0XD5 +#define IOCTL_SMART_WRITE_LOG_SECTOR 0XD6 +#define LOG_DIR 0 +#define ERROR_LOG 1 +#define SELFTEST_LOG 6 +#define IOCTL_SMART_ENABLE_OPER 0XD8 +#define IOCTL_SMART_DISABLE_OPER 0XD9 +#define IOCTL_SMART_RETURN_STATUS 0XDA + +/* Power management feature */ + +#define IOCTL_CHECK_POWER_MODE 0XE5 /* ATA_CMD_CHECK_POWER_MODE */ +#define IOCTL_IDLE_IMMEDIATE 0XE1 /* ATA_CMD_IDLE_IMMEDIATE */ +#define IOCTL_SLEEP 0XE6 /* ATA_CMD_SLEEP */ +#define IOCTL_STANDBY_IMMEDIATE 0XE0 /* ATA_CMD_STANDBY_IMMEDIATE*/ + +/* CFA feature */ + +#define IOCTL_CFA_ERASE_SECTORS 0XF0 +#define IOCTL_CFA_WRITE_MULTIPLE_WITHOUT_ERASE 0XFD +#define IOCTL_CFA_WRITE_SECTORS_WITHOUT_ERASE 0XF8 +#define IOCTL_CFA_TRANSLATE_SECTOR 0XF7 +#define IOCTL_CFA_REQUEST_EXTENDED_ERROR_CODE 0XF3 +#define IOCTL_ATAPI_READ_TOC_PMA_ATIP 0XF8 + +/* IoCtl definitions END*/ + +#define IDE_LOCAL 0 /* ctrl type: LOCAL(IDE) */ +#define ATA_PCMCIA 1 /* ctrl type: PCMCIA */ +#define PARIDE 2 /* ctrl type: Paralle Port */ +#define USB 3 /* media : USB */ + +#define ATA_MAX_DRIVES 2 /* Always 2 drives per controller */ + +#define ATA_MAX_CTRLS 2 + +#define ATA_LIKE_WAIT_FOREVER (sysClkRateGet() * 5) /* 1 minute */ + +/* config */ + +/* Page 63, 7.1.7.1, Ref-2 */ + +#define CONFIG_PROT_TYPE 0xc000 /* Protocol Type */ +#define CONFIG_PROT_TYPE_ATAPI 0x8000 /* ATAPI */ + +#define CONFIG_REMOVABLE 0x0080 /* Removable */ + +#define CONFIG_PKT_TYPE 0x0060 /* CMD DRQ Type */ +#define CONFIG_PKT_TYPE_MICRO 0x0000 /* Microprocessor DRQ */ +#define CONFIG_PKT_TYPE_INTER 0x0020 /* Interrupt DRQ */ +#define CONFIG_PKT_TYPE_ACCEL 0x0040 /* Accelerated DRQ */ + +#define CONFIG_PKT_SIZE 0x0003 /* Command Packet Size */ +#define CONFIG_PKT_SIZE_12 0x0000 /* 12 bytes */ + +/* config END*/ + + +/* word 2 of device parametes specific configuration values */ + +#define ATA_SPEC_CONFIG_VALUE_0 0x37c8 /* SET FEATURE subcomm req */ + /* IDENTIFY DEVICE resp incomplete*/ +#define ATA_SPEC_CONFIG_VALUE_1 0x738c /* SET FEATURE subcomm req */ + /* IDENTIFY DEVICE resp complete*/ +#define ATA_SPEC_CONFIG_VALUE_2 0x8c73 /* SET FEATURE subcomm NOT req */ + /* IDENTIFY DEVICE resp incomplete*/ +#define ATA_SPEC_CONFIG_VALUE_3 0xc837 /* SET FEATURE subcomm NOT req */ + /* IDENTIFY DEVICE resp complete*/ + +/* + * Drive Types. + * This is 12 to 8 bits of 1st word of "ATAPI Identify device" command + * Table , Page 113, Ref-1. + */ + +#define CONFIG_DEV_TYPE_MASK 0x1f00 +#define CONFIG_DEV_TYPE_DIRECT 0x00 +#define CONFIG_DEV_TYPE_SEQUENTIAL 0x01 +#define CONFIG_DEV_TYPE_PRINTER 0x02 +#define CONFIG_DEV_TYPE_PROCESSOR 0x03 +#define CONFIG_DEV_TYPE_WRITE_ONCE 0x04 +#define CONFIG_DEV_TYPE_CD_ROM 0x05 +#define CONFIG_DEV_TYPE_SCANNER 0x06 +#define CONFIG_DEV_TYPE_OPTICAL 0x07 +#define CONFIG_DEV_TYPE_MEDIUM_CHANGER 0x08 +#define CONFIG_DEV_TYPE_COMMUNICATION 0x09 +#define CONFIG_DEV_TYPE_ARRAY_CONTROLLER 0x0C +#define CONFIG_DEV_TYPE_ENCLOSER_SERVICE 0x0D +#define CONFIG_DEV_TYPE_RED_BLK_CMD_DEV 0x0E +#define CONFIG_DEV_TYPE_OPT_CARD_RW 0x00 +#define CONFIG_DEV_TYPE_UNKNOWN 0x1F + +/* Host controller functions macro's */ + + +/* Read a BYTE from IO port, `ioAdrs' */ + +#ifndef ATA_IO_BYTE_READ + #define ATA_IO_BYTE_READ(ioAdrs) sysInByte (ioAdrs) +#endif /* ATA_IO_BYTE_READ */ + + +/* Write a BYTE `byte' to IO port, `ioAdrs' */ + +#ifndef ATA_IO_BYTE_WRITE + #define ATA_IO_BYTE_WRITE(ioAdrs, byte) sysOutByte (ioAdrs, byte) +#endif /* ATA_IO_BYTE_WRITE */ + +/* Read 16-bit little-endian `nWords' into `pData' from IO port, `ioAdrs' */ + +#ifndef ATA_IO_NWORD_READ + #define ATA_IO_NWORD_READ(ioAdrs, pData, nWords) \ + sysInWordString (ioAdrs, pData, nWords) +#endif /* ATA_IO_NWORD_READ */ + + +/* Write 16-bit little-endian `nWords' from `pData' into IO port, `ioAdrs' */ + +#ifndef ATA_IO_NWORD_WRITE + #define ATA_IO_NWORD_WRITE(ioAdrs, pData, nWords) \ + sysOutWordString (ioAdrs, pData, nWords) +#endif /* ATA_IO_NWORD_WRITE */ + + + +/* Read 32-bit little-endian `nLongs' into `pData' from IO port, `ioAdrs' */ + +#ifndef ATA_IO_NLONG_READ + #define ATA_IO_NLONG_READ(ioAdrs, pData, nLongs) \ + sysInLongString (ioAdrs, pData, nLongs) +#endif /* ATA_IO_NLONG_READ */ + + +/* Write 32-bit little-endian `nLongs' from `pData' into IO port, `ioAdrs' */ + +#ifndef ATA_IO_NLONG_WRITE + #define ATA_IO_NLONG_WRITE(ioAdrs, pData, nLongs) \ + sysOutLongString (ioAdrs, pData, nLongs) +#endif /* ATA_IO_NLONG_WRITE */ + + +/* Read 32-bit CPU-endian `nWords' into `pData' from IO port, `ioAdrs' */ + +#ifndef ATA_IO_NWORD_READ_SWAP + #if (_BYTE_ORDER == _BIG_ENDIAN) + #define ATA_IO_NWORD_READ_SWAP(ioAdrs, pData, nWords) \ + sysInWordStringRev (ioAdrs, pData, nWords) + #else /* (_BYTE_ORDER == _BIG_ENDIAN) */ + #define ATA_IO_NWORD_READ_SWAP(ioAdrs, pData, nWords) \ + ATA_IO_NWORD_READ (ioAdrs, pData, nWords) + #endif /* (_BYTE_ORDER == _BIG_ENDIAN) */ +#endif /* ATA_IO_NLONG_READ_SWAP */ + +/* + * This macro provides a small delay, which is expected to be more than 400nSec + * that is used in several places in the ATA command protocols: + * 1) It is recommended that the host delay 400ns after + * writing the command register. + * 2) ATA-4 has added a new requirement that the host delay + * 400ns if the DEV bit in the Device/Head register is + * changed. This was not recommended or required in ATA-1, + * ATA-2 or ATA-3. + * 3) ATA-4 has added another new requirement that the host delay + * after the last word of a data transfer before checking the + * status register. This was not recommended or required in + * ATA-1, ATA-2 or ATA-3. + * + */ + +#define ATA_DELAY_400NSEC ATA_IO_BYTE_READ(ATAPI_ASTATUS); \ + ATA_IO_BYTE_READ(ATAPI_ASTATUS); \ + ATA_IO_BYTE_READ(ATAPI_ASTATUS); \ + ATA_IO_BYTE_READ(ATAPI_ASTATUS); \ + ATA_IO_BYTE_READ(ATAPI_ASTATUS) + +#define ATA_SIGNATURE 0x01010000 +#define ATAPI_SIGNATURE 0x010114EB + +#define ATAPI_MAX_CMD_LENGTH 12 /* maximum length in bytes of an ATAPI command */ + +#ifndef ATA_SEM_TIMEOUT_DEF + #define ATA_SEM_TIMEOUT_DEF 5 /* default timeout for ATA sync sem */ +#endif + +#ifndef ATA_WDG_TIMEOUT_DEF + #define ATA_WDG_TIMEOUT_DEF 5 /* default timeout for ATA watch dog */ +#endif /* These two are also defined in pc.h */ + +/* Device types */ + +#define ATA_TYPE_NONE 0x00 /* device is faulty or not present */ +#define ATA_TYPE_ATA 0x01 /* ATA device */ +#define ATA_TYPE_ATAPI 0x02 /* ATAPI device */ +#define ATA_TYPE_INIT 0xFF /* device must be identified */ + +/* Device states */ + +#define ATA_DEV_OK 0 /* device is OK */ +#define ATA_DEV_NONE 1 /* device absent or does not respond */ +#define ATA_DEV_DIAG_F 2 /* device diagnostic failed */ +#define ATA_DEV_PREAD_F 3 /* read device parameters failed */ +#define ATA_DEV_MED_CH 4 /* medium have been changed */ +#define ATA_DEV_INIT 255 /* uninitialized device */ + +/* Errors */ + +/* Register mode and other definitions */ + +/* size/drive/head register +6 : addressing mode CHS or LBA */ +/* These are only in ATA1, ATA2. not defined in ATAPI 5*/ + +#define ATA_SDH_IBM 0xa0 /* chs, 512 bytes sector, ecc */ +#define ATA_SDH_LBA 0xe0 /* lba, 512 bytes sector, ecc */ + +/** Register Bit Definitions **/ + +/* Device Control register +6 WR Control Block */ + +#define ATA_CTL_4BIT 0x8 /* use 4 head bits (wd1003) */ +#define ATA_CTL_SRST 0x4 /* reset controller */ +#define ATA_CTL_NIEN 0x2 /* disable interrupts */ + +/* Feature Register */ + +#define FEAT_OVERLAP 0x02 /* command may be overlapped */ +#define FEAT_DMA 0x01 /* data will be transferred via DMA */ + +/* Error register +1 RD */ + +#define ERR_ABRT 0x04 /* command aborted ATA_ERR_ABRT */ + +/* other bits of error register are command dependent */ + +/* Error Register */ + +#define ERR_SENSE_KEY 0xf0 /* Sense Key mask */ + +#define SENSE_NO_SENSE 0x00 /* no sense sense key */ +#define SENSE_RECOVERED_ERROR 0x10 /* recovered error sense key */ +#define SENSE_NOT_READY 0x20 /* not ready sense key */ +#define SENSE_MEDIUM_ERROR 0x30 /* medium error sense key */ +#define SENSE_HARDWARE_ERROR 0x40 /* hardware error sense key */ +#define SENSE_ILLEGAL_REQUEST 0x50 /* illegal request sense key */ +#define SENSE_UNIT_ATTENTION 0x60 /* unit attention sense key */ +#define SENSE_DATA_PROTECT 0x70 /* data protect sense key */ +#define SENSE_BLANK_CHECK 0x80 /* blank check */ +#define SENSE_VENDOR_SPECIFIC 0x90 /* vendor specific skey */ +#define SENSE_COPY_ABORTED 0xa0 /* copy aborted */ +#define SENSE_ABORTED_COMMAND 0xb0 /* aborted command sense key */ +#define SENSE_EQUAL 0xc0 /* equal */ +#define SENSE_VOLUME_OVERFLOW 0xd0 /* volume overflow */ +#define SENSE_MISCOMPARE 0xe0 /* miscompare sense key */ +#define SENSE_RESERVED 0xf0 + + +#define ERR_MCR 0x08 /* Media Change Requested */ +#define ERR_ABRT 0x04 /* Aborted command */ +#define ERR_EOM 0x02 /* End Of Media */ +#define ERR_ILI 0x01 /* Illegal Length Indication */ + +/* Interrupt Reason Register */ + +#define INTR_RELEASE 0x04 /*Bus released before command completion*/ +#define INTR_IO 0x02 /*1 - In to the Host; 0 - Out to device */ +#define INTR_COD 0x01 /* 1 - Command; 0 - user Data */ + +#define USE_LBA 0x40 /* used to 'OR' into Dev/Head register */ + +/* The drive number bit */ + +#define ATA_DRIVE_BIT 4 /* usage :- 1<ataReg.data /* (RW/RW)data reg. (16 bits) */ +#define ATAPI_ERROR (long)pCtrl->ataReg.error /* (R /R )error reg. */ +#define ATAPI_FEATURE (long)pCtrl->ataReg.feature /* (W /W )feature reg. */ +#define ATAPI_SECCNT_INTREASON (long)pCtrl->ataReg.seccnt /* (RW/R )seccount/intr reason */ +#define ATAPI_SECTOR (long)pCtrl->ataReg.sector /* (RW/ )Sector Number reg */ +#define ATAPI_CYLLOW_BCOUNT_LO (long)pCtrl->ataReg.cylLo /* (RW/RW)cylLow/byte count low */ +#define ATAPI_CYLHI_BCOUNT_HI (long)pCtrl->ataReg.cylHi /* (RW/RW)cylHi/byte count high */ +#define ATAPI_CYLLOW (long)pCtrl->ataReg.cylLo /* (RW/RW)cylLow/byte count low */ +#define ATAPI_CYLHI (long)pCtrl->ataReg.cylHi /* (RW/RW)cylHi/byte count high */ +#define ATAPI_SDH_D_SELECT (long)pCtrl->ataReg.sdh /* (RW/RW)sdh/drive select reg. */ +#define ATAPI_STATUS (long)pCtrl->ataReg.status /* (R /R )status reg. */ +#define ATAPI_COMMAND (long)pCtrl->ataReg.command /* (W /W )command reg. */ +#define ATAPI_D_CONTROL (long)pCtrl->ataReg.dControl/* (W /W )device control */ +#define ATAPI_ASTATUS (long)pCtrl->ataReg.aStatus /* (R /R )alternate status */ + +#define ATA_WORD54_58_VALID 0x01 +#define ATA_WORD64_70_VALID 0x02 +#define ATA_WORD88_VALID 0x04 + + /* Commands */ + +#define ATA_CMD_DIAGNOSE 0x90 /* execute controller diagnostic */ +#define ATAPI_CMD_SRST 0x08 /* Device reset, N-NONATAPI,M-ATAPI + ATA_CMD_DEVICE_RESET */ +#define ATA_CMD_RECALIB 0x10 + + /* Recalibrate obsolete */ + +#define ATA_CMD_FORMAT 0x50 + + /* Format track obsolete */ + +/* Commands mandatory for nonATAPI devices. */ /* 6.4.1, Page 21, Ref-1 */ + +#define ATA_CMD_EXECUTE_DEVICE_DIAGNOSTIC 0X90 + + /* Device diagnostic, Y */ + /* PIO data-in, Y ATA_CMD_IDENTIFY_DEVICE */ +#define ATA_CMD_IDENT_DEV 0xEC /* identify */ + +#define ATA_CMD_INITP 0X91 + + /* + * Non-data, M-(NONATAPI if CHS supported),?, + * N-ATAPI ATA_CMD_INITIALIZE_DEVICE_PARAMETERS + */ + +#define ATA_CMD_READ_DMA 0XC8 + + /* DMA, M-NONATAPI, N-ATAPI */ + +#define ATA_CMD_READ_MULTI 0XC4 + + /* PIO data-in, Y-NONATAPI, N-ATAPI ATA_CMD_READ_MULTIPLE */ + +#define ATA_CMD_READ_VERIFY_SECTOR_S 0X40 + + /* Non-data, 8.28,Page 149, Ref-1 */ + +#define ATA_CMD_READ 0X20 + + /* PIO data-in, Y ATA_CMD_READ_SECTORS */ + +#define ATA_CMD_SEEK 0X70 + + /* Non-data, Y-NONATAPI, N-ATAPI */ + +#define ATA_CMD_SET_FEATURE 0XEF + + /* Non-data, Y ATA_CMD_SET_FEATURES*/ + +#define ATA_CMD_SET_MULTI 0XC6 + + /* PIO data out, Y-NONATAPI, N-ATAPI ATA_CMD_SET_MULTIPLE_MODE */ + +#define ATA_CMD_WRITE_DMA 0XCA + + /* DMA, Y-NONATAPI, N-ATAPI */ + +#define ATA_CMD_WRITE_MULTI 0XC5 + + /* PIO data out, Y-NONATAPI, N-ATAPI ATA_CMD_WRITE_MULTIPLE*/ + +#define ATA_CMD_WRITE 0X30 + + /* PIO data out, Y-NONATAPI, N-ATAPI ATA_CMD_WRITE_SECTORS */ + +/* Commands for only ATA. but not for ATAPI */ + +#define ATA_CMD_DOWNLOAD_MICROCODE 0X92 + + /* PIO data-out, O-NONATAPI,N-ATAPI */ +/* ATA_CMD_INITP*/ + +#define ATA_CMD_READ_BUFFER 0XE4 + + /* PIO data-in, O-NONATAPI, N-ATAPI */ + +/*ATA_CMD_READ_DMA*/ + +/*ATA_CMD_READ_MULTIPLE*/ + +/*ATA_CMD_READ_VERIFY_SECTORS*/ + +/*ATA_CMD_SEEK*/ + +/*ATA_CMD_SET_MULTI*/ + +#define ATA_CMD_WRITE_BUFFER 0XE8 + + /* PIO data out, 0-NONATAPI,N-ATAPI */ + +/*ATA_CMD_WRITE_DMA*/ + +/*ATA_CMD_WRITE_MULTIPLE*/ + +/*ATA_CMD_WRITE_SECTORS*/ + +/* + * ATA commands mandatory for ATAPI (CD-ROM) device + * 7.0, Table 18, Page 59, Ref 2 + */ + +#define ATA_CMD_CHECK_POWER_MODE 0XE5 + /* Non-data, ? ?-(M-ATAPI Driver tells) */ + +#define ATA_CMD_IDLE_IMMEDIATE 0XE1 + /* Non-data, ? ?-(M-ATAPI Driver tells) */ + +#define ATA_CMD_SLEEP 0XE6 + /* Non-data, ? ?-(M-ATAPI Driver tells) */ + +#define ATA_CMD_STANDBY_IMMEDIATE 0XE0 + /* Non-data, Y-POWER_MANAGEMENT, + ?-(M-ATAPI Driver tells) */ + +#define ATA_CMD_READ_VERIFY_SECTORS 0X40 + /* Non-data,Y-NONATAPI, N-ATAPI */ + + +/* Packet Device commands */ + +#define ATA_PI_CMD_SRST 0X08 + /* Device reset, N-NONATAPI,M-ATAPI ATA_CMD_DEVICE_RESET */ + +#define ATA_PI_CMD_PKTCMD 0XA0 + /* Packet, N-NONATAPI, M-ATAPI ATA_CMD_PACKET */ + +#define ATA_PI_CMD_IDENTD 0XA1 + /* PIO data-in, N-NONATAPI,M-ATAPI + ATA_CMD_IDENTIFY_PACKET_DEVICE */ + +#define ATA_PI_CMD_SERVICE 0XA2 + /* PACKET or READ/WRITE DMA QUEUED, Y-(PACKET & OVERLAPPED) + ATA_CMD_SERVICE */ + +#define ATA_CMD_NOP 0X00 + /* Non-data, O-NONATAPI,M-ATAPI,M-OVERLAP */ + +/* CompactFlash Association CFA memory Commands */ + +#define ATA_CMD_CFA_ERASE_SECTORS 0XC0 + /* Non-data, Y-(if CFA) */ + +#define ATA_CMD_CFA_REQUEST_EXTENDED_ERROR_CODE 0X03 + /* Non-data, Y-(if CFA) */ + +#define ATA_CMD_CFA_TRANSLATE_SECTOR 0X87 + /* PIO data-in, Y-(if CFA) */ + +#define ATA_CMD_CFA_WRITE_MULTIPLE_WITHOUT_ERASE 0XCD + /* PIO data-out, Y-(if CFA) */ + +#define ATA_CMD_CFA_WRITE_SECTORS_WITHOUT_ERASE 0X38 + /* PIO data-out, Y-(if CFA) */ + +/* others */ + +#define ATA_CMD_FLUSH_CACHE 0XE7 /* Non-data, Y */ +#define ATA_CMD_GET_MEDIA_STATUS 0XDA /* Non-data, ? */ +#define ATA_CMD_IDLE 0XE3 /* Non-data, ? */ +#define ATA_CMD_MEDIA_EJECT 0XED /* Non-data, ? */ +#define ATA_CMD_MEDIA_LOCK 0XDE /* Non-data, ? */ +#define ATA_CMD_MEDIA_UNLOCK 0XDF /* Non-data, ? */ +#define ATA_CMD_READ_DMA_QUEUED 0XC7 /* DMA QUEUED, + M-(OVERLAP-Y & ATAPI-N), + N-ATAPI */ +#define ATA_CMD_READ_NATIVE_MAX_ADDRESS 0XF8 /* Non-data, + * M-HOST_PROTECTED_AREA, + * N-Removable feature */ +#define ATA_CMD_SECURITY_DISABLE_PASSWORD 0XF6 /* PIO data-out, M-SECURITY */ +#define ATA_CMD_SECURITY_ERASE_PREPARE 0XF3 /* Non-data, M-SECURITY */ +#define ATA_CMD_SECURITY_ERASE_UNIT 0XF4 /* PIO data-out, M-SECURITY */ +#define ATA_CMD_SECURITY_FREEZE_LOCK 0XF5 /* Non-data, M-SECURITY */ +#define ATA_CMD_SECURITY_SET_PASSWORD 0XF1 /* PIO data-out, M-SECURITY */ +#define ATA_CMD_SECURITY_UNLOCK 0XF2 /* PIO data-out, M-SECURITY */ + +#define ATA_CMD_SET_MAX 0XF9 /* Non-data, ? */ +#define ATA_CMD_SMART 0XB0 /* Non-data, Y-SMART,N-ATAPI */ +#define ATA_CMD_STANDBY 0XE2 /* Non-data, ? */ +#define ATA_CMD_WRITE_DMA_QUEUED 0XCC /* DMA QUEUED, + Y-(OVERLAP-Y & ATAPI-N) + N-ATAPI */ + +/* ATAPI MMC Commands */ +/* ANSI INCITS 360-2002 Annex I, page 397 */ + +#define ATAPI_CMD_INQUIRY 0X12 +#define ATAPI_CMD_LOAD_UNLOAD_MEDIUM 0XA6 +#define ATAPI_CMD_MECHANISM_STATUS 0XBD +#define ATAPI_CMD_MODE_SELECT 0X55 +#define ATAPI_CMD_MODE_SENSE 0X5A +#define ATAPI_CMD_PAUSE_RESUME 0X4B +#define ATAPI_CMD_PLAY_AUDIO10 0X45 +#define ATAPI_CMD_PLAY_AUDIO12 0XA5 +#define ATAPI_CMD_PLAY_AUDIO_MSF 0X47 +#define ATAPI_CMD_PLAY_CD_LBA 0XBC +#define ATAPI_CMD_PLAY_CD_MSF 0XB4 +#define ATAPI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0X1E +#define ATAPI_CMD_READ10 0X28 +#define ATAPI_CMD_READ12 0XA8 +#define ATAPI_CMD_READ_CD_CAPACITY 0X25 /* 0x23 */ +#define ATAPI_CMD_READ_CD 0XBE +#define ATAPI_CMD_READ_CD_MSF 0XB9 +#define ATAPI_CMD_READ_HEADER 0X44 +#define ATAPI_CMD_READ_SUB_CHANNEL 0X42 +#define ATAPI_CMD_READ_TOC_PMA_ATIP 0X43 /* PMA/ATIP are + from sff8090i */ +#define ATAPI_CMD_REQUEST_SENSE 0X03 +#define ATAPI_CMD_SCAN 0XBA +#define ATAPI_CMD_SEEK 0X2B +#define ATAPI_CMD_SET_CD_SPEED 0XBB +#define ATAPI_CMD_STOP_PLAY_SCAN 0X4E +#define ATAPI_CMD_START_STOP_UNIT 0X1B +#define ATAPI_CMD_TEST_UNIT_READY 0X00 + + +#define ATAPI_CMD_BLANK 0XA1 +#define ATAPI_CMD_CLOSE_TRACK_RZONE_SESSION_BORDER 0X5B +#define ATAPI_CMD_COMPARE 0X39 +#define ATAPI_CMD_ERASE_10 0X2C +#define ATAPI_CMD_FORMAT_UNIT 0X04 +#define ATAPI_CMD_GET_CONFIGURATION 0X46 +#define ATAPI_CMD_GET_EVENT_STATUS_NOTIFICATION 0X4A +#define ATAPI_CMD_GET_PERFORMANCE 0XAC +#define ATAPI_CMD_LOCK_UNLOCK_CACHE 0X36 +#define ATAPI_CMD_LOG_SELECT 0X4C +#define ATAPI_CMD_LOG_SENSE 0X4D +#define ATAPI_CMD_PRE_FETCH 0X34 +#define ATAPI_CMD_READ_BUFFER 0X3C +#define ATAPI_CMD_READ_BUFFER_CAPACITY 0X5C +#define ATAPI_CMD_READ_DISC_INFORMATION 0X51 +#define ATAPI_CMD_READ_DVD_STRUCTURE 0XAD +#define ATAPI_CMD_READ_FORMAT_CAPACITIES 0X23 +#define ATAPI_CMD_READ_TRACK_RZONE_INFORMATION 0X52 +#define ATAPI_CMD_RECEIVE_DIAGNOSTIC_RESULTS 0X1C +#define ATAPI_CMD_RELEASE_6 0X17 +#define ATAPI_CMD_RELEASE_10 0X57 +#define ATAPI_CMD_REPAIR_RZONE 0X58 +#define ATAPI_CMD_REPORT_KEY 0XA4 +#define ATAPI_CMD_RESERVE_6 0X16 +#define ATAPI_CMD_RESERVE_10 0X56 +#define ATAPI_CMD_RESERVE_TRACK_RZONE 0X53 +#define ATAPI_CMD_SEND_CUE_SHEET 0X5D +#define ATAPI_CMD_SEND_DIAGNOSTIC 0X1D +#define ATAPI_CMD_SEND_EVENT 0XA2 +#define ATAPI_CMD_SEND_KEY 0XA3 +#define ATAPI_CMD_SEND_OPC_INFORMATION 0X54 +#define ATAPI_CMD_SET_READ_AHEAD 0XA7 +#define ATAPI_CMD_SET_STREAMING 0XB6 +#define ATAPI_CMD_SYNCHRONIZE_CACHE 0X35 +#define ATAPI_CMD_VERIFY_10 0X2F +#define ATAPI_CMD_WRITE_10 0X2A +#define ATAPI_CMD_WRITE_12 0XAA +#define ATAPI_CMD_WRITE_VERIFY_10 0X2E +#define ATAPI_CMD_WRITE_BUFFER 0X3B + + +/* sub command of ATA_CMD_SET_MAX */ /* Table 30, 8.38, Ref-1 */ + +#define ATA_SUB_SET_MAX_ADDRESS 0x00 +#define ATA_SUB_SET_MAX_SET_PASS 0x01 +#define ATA_SUB_SET_MAX_LOCK 0x02 +#define ATA_SUB_SET_MAX_UNLOCK 0x03 +#define ATA_SUB_SET_MAX_FREEZE_LOCK 0x04 + +/* ATA_SUB_SET_MAX_ADDRESS sector count options */ + +#define SET_MAX_VOLATILE 0x00 +#define SET_MAX_NON_VOLATILE 0x01 + +/* sub command of ATA_CMD_SET_FEATURE */ /* Table 27, Page 167, Ref-1 */ + +/* #define ATA_SUB_ENABLE_8BIT 0x01 Retired. + enable 8bit data transfer */ +#define ATA_SUB_ENABLE_WCACHE 0x02 /* enable write cache */ +#define ATA_SUB_SET_RWMODE 0x03 /* set transfer mode */ +#define ATA_SUB_ENB_ADV_POW_MNGMNT 0x05 /* enable advanced power management*/ +#define ATA_SUB_ENB_POW_UP_STDBY 0x06 /* Enable Power-Up In Standby. */ +#define ATA_SUB_POW_UP_STDBY_SPIN 0x07 /* device spin-up.*/ +#define ATA_SUB_BOOTMETHOD 0x09 /* Reserved for Address offset + reserved area boot method + technical report */ +#define ATA_SUB_ENA_CFA_POW_MOD1 0x0A /* Enable CFA power mode 1 */ +#define ATA_SUB_DISABLE_NOTIFY 0x31 /*Disable Media Status Notification*/ + +/* #define ATA_SUB_DISABLE_RETRY 0x33 obsolete. disable retry */ +/* #define ATA_SUB_SET_LENGTH 0x44 obsolete. length of + vendor specific bytes */ +/* #define ATA_SUB_SET_CACHE 0x54 obsolete. set cache segments */ + +#define ATA_SUB_DISABLE_LOOK 0x55 /* disable read look-ahead feature */ +#define ATA_SUB_ENA_INTR_RELEASE 0x5D /* Enable release interrupt */ +#define ATA_SUB_ENA_SERV_INTR 0x5E /* Enable service interrupt */ +#define ATA_SUB_DISABLE_REVE 0x66 /*disable reverting to power on def*/ + +/* #define ATA_SUB_DISABLE_ECC 0x77 obsolete. disable ECC */ +/* #define ATA_SUB_DISABLE_8BIT 0x81 Retired. disable 8bit data transfer*/ + +#define ATA_SUB_DISABLE_WCACHE 0x82 /* disable write cache */ +#define ATA_SUB_DIS_ADV_POW_MNGMT 0x85 /* Disable advanced power mgmt */ +#define ATA_SUB_DISB_POW_UP_STDBY 0x86 /* Disable PowerUp In Stdby feature*/ + +/* #define ATA_SUB_ENABLE_ECC 0x88 obsolete. enable ECC */ + +#define ATA_SUB_BOOTMETHOD_REPORT 0x89 /* Reserved for Address offset + reserved area boot method + technical report */ +#define ATA_SUB_DIS_CFA_POW_MOD1 0x8A /* Enable CFA power mode 1 */ +#define ATA_SUB_ENABLE_NOTIFY 0x95 /* Enable Media Status Notification*/ + +/*#define ATA_SUB_ENABLE_RETRY 0x99 obsolete. enable retries */ + +#define ATA_SUB_ENABLE_LOOK 0xaa /* enable read look-ahead feature */ + +/*#define ATA_SUB_SET_PREFETCH 0xab obsolete. set maximum prefetch */ +/*#define ATA_SUB_SET_4BYTES 0xbb obsolete. 4 bytes of vendor + specific bytes */ +#define ATA_SUB_ENABLE_REVE 0xcc /* enable reverting to power on def*/ +#define ATA_SUB_DIS_INTR_RELEASE 0xDD /* Disable release interrupt */ +#define ATA_SUB_DIS_SERV_INTR 0xDE /* Disable service interrupt */ + +/* sub command of ATA_CMD_SMART */ /* Table 32, Page 184, Ref-1 */ + +#define ATA_SMART_READ_DATA 0XD0 +#define ATA_SMART_ATTRIB_AUTO 0XD2 +#define ATA_SMART_SAVE_ATTRIB 0XD3 +#define ATA_SMART_OFFLINE_IMMED 0XD4 +#define ATA_SMART_READ_LOG_SECTOR 0XD5 +#define ATA_SMART_WRITE_LOG_SECTOR 0XD6 +#define ATA_SMART_ENABLE_OPER 0XD8 +#define ATA_SMART_DISABLE_OPER 0XD9 +#define ATA_SMART_RETURN_STATUS 0XDA + +/* arg1 values of Sub command ATA_SMART_ATTRIB_AUTO */ + +#define ATA_SMART_SUB_ENABLE_ATTRIB_AUTO 0xf1 +#define ATA_SMART_SUB_DISABLE_ATTRIB_AUTO 0x00 + +/* arg1 values of Sub command ATA_SMART_OFFLINE_IMMED */ + +#define ATA_SMART_SUB_EXEC_OFF_IMMED_OFF_MODE 0 +#define ATA_SMART_SUB_EXEC_SHORT_SELF_IMMED_OFF_MODE 1 +#define ATA_SMART_SUB_EXEC_EXT_SELF_IMMED_OFF_MODE 2 +#define ATA_SMART_SUB_ABORT_OFF_MODE_SELF_IMMED 127 +#define ATA_SMART_SUB_EXEC_SHORT_SELF_IMMED_CAP_MODE 129 +#define ATA_SMART_SUB_EXEC_EXT_SELF_IMMED_CAP_MODE 130 + +/* + * arg1 values of Sub command ATA_SMART_READ_LOG_SECTOR / + * ATA_SMART_WRITE_LOG_SECTOR + */ +#define ATA_SMART_SUB_LOG_DIRECTORY 0x00 +#define ATA_SMART_SUB_ERROR_LOG 0x01 +#define ATA_SMART_SUB_SELF_TEST_LOG 0x06 + +/* transfer modes of ATA_SUB_SET_RWM ODE */ /* Table 28, Page 168, Ref-1 */ + +#define ATA_PIO_DEF_W 0x00 /* PIO default trans. mode */ +#define ATA_PIO_DEF_WO 0x01 /* PIO default trans. mode, no IORDY */ +#define ATA_PIO_W_0 0x08 /* PIO flow control trans. mode 0 */ +#define ATA_PIO_W_1 0x09 /* PIO flow control trans. mode 1 */ +#define ATA_PIO_W_2 0x0a /* PIO flow control trans. mode 2 */ +#define ATA_PIO_W_3 0x0b /* PIO flow control trans. mode 3 */ +#define ATA_PIO_W_4 0x0c /* PIO flow control trans. mode 4 */ + +#define ATA_DMA_SINGLE_0 0x10 /* singleword DMA mode 0 */ +#define ATA_DMA_SINGLE_1 0x11 /* singleword DMA mode 1 */ +#define ATA_DMA_SINGLE_2 0x12 /* singleword DMA mode 2 */ + +#define ATA_DMA_MULTI_0 0x20 /* multiword DMA mode 0 */ +#define ATA_DMA_MULTI_1 0x21 /* multiword DMA mode 1 */ +#define ATA_DMA_MULTI_2 0x22 /* multiword DMA mode 2 */ + +#define ATA_DMA_ULTRA_0 0x40 /* Ultra DMA mode 0 */ +#define ATA_DMA_ULTRA_1 0x41 /* Ultra DMA mode 1 */ +#define ATA_DMA_ULTRA_2 0x42 /* Ultra DMA mode 2 */ +#define ATA_DMA_ULTRA_3 0x43 /* Ultra DMA mode 3 */ +#define ATA_DMA_ULTRA_4 0x44 /* Ultra DMA mode 4 */ +#define ATA_DMA_ULTRA_5 0x45 /* Ultra DMA mode 5 */ +#define ATA_DMA_ULTRA_6 0x46 /* Ultra DMA mode 6 (not supported) */ + + +/* configuration flags: transfer mode, bits, unit, geometry + * + * 15 14 13 12 | 11 10 9 8 | 7 6 5 4 | 3 2 1 0 + * ------------------|-----------------|-----------------|---------------- + * 0 0 0 0 | 0 0 0 0 | 0 0 0 0 | 0 0 0 0 + * ---------|--------|--------|--------|----|---|--------|----|-----------| + * -BIT MASK|-PIOMASK|--------|GEO MASK|----|---|DMA MASK|PIO-|----Mode---| + * 32 16 P P U M S P + * I I L U I I + * B B O O T L N O + * I I R T G + * T T M S A I L F + * S S U I E L + * L N O + * T G D D D W + * I L M M M + * E A A A C + * O + * N + * T + * R + * O + * L + * + */ +#define ATA_MODE_MASK 0x00FF /* transfer mode mask */ +#define ATA_GEO_MASK 0x0300 /* geometry mask */ +#define ATA_PIO_MASK 0x3000 /* RW PIO mask */ +#define ATA_BITS_MASK 0xc000 /* RW bits size mask */ + +#define ATA_PIO_DEF_0 ATA_PIO_DEF_W /* PIO default mode */ +#define ATA_PIO_DEF_1 ATA_PIO_DEF_WO /* PIO default mode, no IORDY */ +#define ATA_PIO_0 ATA_PIO_W_0 /* PIO mode 0 */ +#define ATA_PIO_1 ATA_PIO_W_1 /* PIO mode 1 */ +#define ATA_PIO_2 ATA_PIO_W_2 /* PIO mode 2 */ +#define ATA_PIO_3 ATA_PIO_W_3 /* PIO mode 3 */ +#define ATA_PIO_4 ATA_PIO_W_4 /* PIO mode 4 */ +#define ATA_PIO_AUTO 0x000D /* PIO max supported mode */ + +#define ATA_DMA_AUTO 0x0046 /* DMA max supported mode */ + +#define ATA_GEO_FORCE 0x0100 /* set geometry in the table */ +#define ATA_GEO_PHYSICAL 0x0200 /* set physical geometry */ +#define ATA_GEO_CURRENT 0x0300 /* set current geometry */ + +#define ATA_PIO_SINGLE 0x1000 /* RW PIO single sector */ +#define ATA_PIO_MULTI 0x2000 /* RW PIO multi sector */ + +/* PIO Mode codes, these are also offset of set values */ + +#define ATA_SET_PIO_MODE_0 0x0 +#define ATA_SET_PIO_MODE_1 0x1 +#define ATA_SET_PIO_MODE_2 0x2 +#define ATA_SET_PIO_MODE_3 0x3 +#define ATA_SET_PIO_MODE_4 0x4 + +/* Single, multi and Udma codes, these are also offset of set values */ + +#define ATA_SET_SDMA_MODE_0 0x0 +#define ATA_SET_SDMA_MODE_1 0x1 +#define ATA_SET_SDMA_MODE_2 0x2 + +#define ATA_SET_MDMA_MODE_0 0x0 +#define ATA_SET_MDMA_MODE_1 0x1 +#define ATA_SET_MDMA_MODE_2 0x2 + +#define ATA_SET_UDMA_MODE_0 0x0 +#define ATA_SET_UDMA_MODE_1 0x1 +#define ATA_SET_UDMA_MODE_2 0x2 +#define ATA_SET_UDMA_MODE_3 0x3 +#define ATA_SET_UDMA_MODE_4 0x4 +#define ATA_SET_UDMA_MODE_5 0x5 + +/* Bit masks */ + +#define ATA_BIT_MASK0 0x0001 +#define ATA_BIT_MASK1 0x0002 +#define ATA_BIT_MASK2 0x0004 +#define ATA_BIT_MASK3 0x0008 +#define ATA_BIT_MASK4 0x0010 +#define ATA_BIT_MASK5 0x0020 +#define ATA_BIT_MASK6 0x0040 +#define ATA_BIT_MASK7 0x0080 +#define ATA_BIT_MASK8 0x0100 +#define ATA_BIT_MASK9 0x0200 +#define ATA_BIT_MASK10 0x0400 +#define ATA_BIT_MASK11 0x0800 +#define ATA_BIT_MASK12 0x1000 +#define ATA_BIT_MASK13 0x2000 +#define ATA_BIT_MASK14 0x4000 +#define ATA_BIT_MASK15 0x8000 + + +#define ATA_BITS_16 0x4000 /* RW bits size, 16 bits */ +#define ATA_BITS_32 0x8000 /* RW bits size, 32 bits */ + +#define ATA_BYTES_PER_BLOC 512 + +#define ATA_MAX_RW_SECTORS 0x100 /* max sectors per transfer */ +#define ATAPI_CDROM_BYTE_PER_BLK 2048 /* user data in CDROM Model */ +#define ATAPI_BLOCKS 100 /* number of blocks */ + +#define ATA_MULTISEC_MASK 0x00ff + +/* Capabilities fields and masks */ + +#define ATA_INTER_DMA_MASK 0x8000 +#define ATA_CMD_QUE_MASK 0x4000 +#define ATA_OVERLAP_MASK 0x2000 +#define ATA_IORDY_MASK 0x0800 +#define ATA_IOLBA_MASK 0x0200 +#define ATA_DMA_CAP_MASK 0x0100 + +/* hardware reset results - bit masks*/ +#define ATA_HWRR_CBLID 0x2000 + +/* PIO Mode bits and masks */ + +#define ATA_PIO_MASK_012 0x03 /* PIO Mode 0,1,2 */ +#define ATA_PIO_MASK_34 0x02 /* PIO Mode 3,4 */ + +/* LBA Mask and bits */ + +#define ATA_LBA_HEAD_MASK 0x0f000000 +#define ATA_LBA_CYL_MASK 0x00ffff00 +#define ATA_LBA_SECTOR_MASK 0x000000ff + +/* capabilities */ + +#define CAPABIL_DMA 0x0100 /* DMA Supported */ +#define CAPABIL_LBA 0x0200 /* LBA Supported */ +#define CAPABIL_IORDY_CTRL 0x0400 /* IORDY can be disabled */ +#define CAPABIL_IORDY 0x0800 /* IORDY Supported */ +#define CAPABIL_OVERLAP 0x2000 /* Overlap Operation Supported */ + +/* Command Related Definitions */ + +/* ATAPI_CMD_START_STOP_UNIT. Page-197,10.8.25,Ref-2 */ + +#define STOP_DISK 0X00 +#define START_DISK 0X01 +#define EJECT_DISK 0X02 +#define LOAD_DISK 0X03 + +/* ATAPI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL */ + +#define MEDIA_UNLOCK 0x00 +#define MEDIA_LOCK 0x01 + + /* Delay to ensure Status Register content is valid */ + +#define ATA_WAIT_STATUS sysDelay () /* >= 400 ns */ + + +/* enum */ + +typedef enum /* with respect to host/memory */ + { + IN_DATA = O_RDONLY, /* from drive to memory */ + OUT_DATA = O_WRONLY, /* to drive from memory */ + NON_DATA /* non data command */ + } ATA_DATA_DIR; + +/* type defs */ + +typedef ATA_RESOURCE ATAPI_RESOURCE; + +/* members of this structure shall be in this order only. */ + +typedef struct ataParams /* Table 21, Page 108, Ref-1 */ + { + short config; /* 0 General configuration - Bit significant */ + short cylinders; /* 1 number of Logical cylinders */ + short specConfig; /* 2 Specific Configuaraion ( removcyl ) */ + short heads; /* 3 number of Logical heads */ + short retired4; /* 4-5 Retired ( bytesTrack ) */ + short retired5; /* 4-5 Retired ( bytesSec ) */ + short sectors; /* 6 no. of (Logical sectors)/(logical track)*/ + short retired7; /* 7-9 Retired ( bytesGap ) */ + short retired8; /* 7-9 Retired ( bytesSync ) */ + short retired9; /* 7-9 Retired ( vendstat ) */ + char serial[20]; /* 10-19 Drive serial number */ + short retired20; /* 20-21 Retired ( type ) */ + short retired21; /* 20-21 Retired ( size ) */ + short obsolete22; /* 22 obsolete ( bytesEcc ) */ + char rev[8]; /* 23-26 firmware revision */ + char model[40]; /* 27-46 model number */ + short multiSecs; /* 47 RW multiple support. bits 15-8 = 80h. + bits 7-0 = 00h reserved, =01h to ffh + max no of secs to transfer /interrupt */ + short reserved48; /* 48 reserved */ + short capabilities; /* 49 capabilities - Bit significant */ + short capabilities2; /* 50 capabilities */ + short pioMode ; /* 51 Retired (X) ( new- retired51 ) */ + short dmaMode ; /* 52 Retired (R) ( new- retired52 ) */ + short valid; /* 53 field validity R-15-3 reserved; + F-2= word 88 validity; + F-1= word 64-70 validity; + V-0= word 54-58 validity */ + short currentCylinders; /* 54 number of current logical cylinders (V) */ + short currentHeads; /* 55 number of current logical heads (V) */ + short currentSectors; /* 56 no. of current logical sectors/track (V)*/ + short capacity0; /* 57 current capacity in sectors */ + short capacity1; /* 58 current capacity in sectors */ + short multiSet; /* 59 multiple sector setting */ + short lba_size_1; /* 60 total number of user addressable sectors*/ + short lba_size_2; /* 61 total number of user addressable sectors*/ + short singleDma; /* 62 Retired (R) ( New- retired62) */ + short multiDma; /* 63 multi word DMA transfer */ + short advancedPio; /* 64 flow control PIO modes supported */ + short cycleTimeDma; /* 65 minimum MDMA transfer cycle time/word */ + short cycleTimeMulti; /* 66 recommended multiword DMA cycle time */ + short cycleTimePioNoIordy; /* 67 min PIO transfer cycle time wo flow ctl */ + short cycleTimePioIordy; /* 68 min PIO transfer cycle time w IORDY */ + short reserved69; /* 69 reserved */ + short reserved70; /* 70 reserved */ + + /* ATAPI */ + + short pktCmdRelTime; /* [71] Typical Time for Release after Packet */ + short servCmdRelTime; /* [72] Typical Time for Release after SERVICE*/ + short majorRevNum; /* [73] Major Revision Number (0|FFFF if no) */ + short minorVersNum; /* [74] Minor Version Number (0|FFFF if no) */ + short queueDepth; /* 75 queuedepth bits15-5 reserved; + 4-0 (max queue depth-1) */ + short reserved76[4]; /* 76-79 reserved */ + short majorVer; /* 80 Major version Number */ + short minorVer; /* 81 Minor version Number */ + short suppCommand1; /* 82 Command set supported */ + short suppCommand2; /* 83 Command set supported */ + short suppCommandFeatureExt; /* 84 Command set/feature support extn */ + short enableCommandFeature1; /* 85 Command set/feature enabled */ + short enableCommandFeature2; /* 86 Command set/feature enabled */ + short defaultCommandFeature; /* 87 Default Command set/feature */ + short ultraDmaMode; /* 88 Ultra DMA mode. bits 15-13 reserved; + 12 UDMA mode4;11 UDMA mode3; + 10 UDMA mode2;9 UDMA mode1; + 8 UDMA mode0;7-5 reserved; + 4 upto UDMA4;3 upto UDMA3; + 2 upto UDMA2;1 upto UDMA1; + 0 upto UDMA0 */ + short securityEraseTime; /* 89 Time Required for security erase unit + completion (F) */ + short enSecurityEraseTime; /* 90 Time Required for enhansed security + erase completion (F) */ + short advPowerManVal; /* 91 Current adv. power mgmnt value (V) */ + short masterPassRev; /* 92 Master password Revision code (V) */ + short hardResetResult; /* 93 Hardware Reset result */ + short reserved94[33]; /* 94-126 reserved */ + short removeNotification; /* 127 Removable Media Status Notification + feature set supported */ + short securityStatus; /* 128 Security status */ + short vendorSpecific129[31]; /* 129-159 Vendor Specifc */ + short cfaPowerMode; /* 160 CFA power mode 1 */ + short reserved161[94]; /* 161-254 Reserved */ + short integrityWord; /* 255 Integrity word */ + + } ATA_PARAM; + +/* define ATA_XBD structure/typedef so the xbd functions can find the + * pointer to the device structure ataDev. This is a locally defined + * structure that is passed to the xbd routines. The first entity is + * XBD structure - and this must always be the first entity. Other external + * routines will modify this part. The rest of the structure can + * be ata driver specific. + */ +typedef struct ata_xbd + { + XBD xbd; /* must be first, add new items below here */ + SEMAPHORE xbdSemId; /* used for xbdBlkDevCreateSync() */ + devname_t name; /* name of device */ + device_t device; /* device number of this instance */ + UINT32 xbdInserted; /* device is inserted */ + BOOL xbdInstantiated; /* TRUE if stack init is complete */ + struct ataDev *ataDev; /* necessary to access the device structure */ + } ATA_XBD; + +typedef struct ataDev + { + BLK_DEV blkDev; /* must be here so ATA_DEV* == BLK_DEV* */ + ATA_XBD ataXbd; /* actual xbd for this device */ + int ctrl; /* ctrl no. 0 - 1 */ + int drive; /* drive no. 0 - 1 */ + UINT32 blkOffset; /* sector offset */ + UINT32 nBlocks; /* number of sectors */ + + char *pBuf; /* Current position in an user buffer */ + char *pBufEnd; /* End of user buffer */ + ATA_DATA_DIR direction; /* Transfer direction */ + int transCount; /* Number of transfer cycles */ + int errNum; /* Error description message number */ + + /* ATAPI Registers contents */ + + UINT8 intReason; /* Interrupt Reason Register */ + UINT8 status; /* Status Register */ + UINT16 transSize; /* Byte Count Register */ + + } ATA_DEV; + +typedef struct ataInfo + { + UINT32 cylinders; /* number of cylinders */ + UINT32 heads; /* number of heads */ + UINT32 sectors; /* number of sectors per track */ + UINT32 bytes; /* number of bytes per sector */ + UINT32 precomp; /* precompensation cylinder */ + } ATAPI_TYPE; + +typedef ATAPI_TYPE ATA_TYPE; + +typedef struct ataDrive + { + ATA_PARAM param; /* geometry parameter */ + ATAPI_TYPE *driveInfo; /* drive info */ + BOOL okMulti; /* MULTI: TRUE if supported */ + BOOL okIordy; /* IORDY: TRUE if supported */ + BOOL okDma; /* DMA: TRUE if supported */ + BOOL usingDma; /* drive configured for dma */ + BOOL okInterleavedDMA; /* Interleaved DMA operation */ + BOOL okCommandQue; /* Queue Command operation */ + BOOL okOverlap; /* OverLap operation */ + BOOL okRemovable; /* Removable Media: */ + BOOL supportSmart; /* Supports SMART feature set*/ + short multiSecs; /* supported max sectors RW */ + short pioMode; /* supported max PIO mode */ + short singleDmaMode; /* supported max + single word DMA mode. obs */ + short multiDmaMode; /* supported max + multi word DMA mode */ + short ultraDmaMode; /* supported max + Ultra DMA mode */ + short rwMode; /* RW mode: + PIO[0,1,2,3,4], + Single DMA[0,1,2], + Multi word DMA[0,1,2], + Ultra DMA[0,1,2,3,4,5] */ + short rwBits; /* RW bits: 16 or 32 */ + short rwPio; /* RW PIO unit: single or + multi sector */ + + UINT8 state; /* device state */ + UINT8 checkPower; /* status from ATA_CMD_CHECK_PWR, + what is power state */ + UINT8 diagCode; /* diagnostic code */ + UINT8 type; /* device type ATA/ATAPI/NONE*/ + UINT8 driveType; /* drive type HDD/CD-ROM/CD-R/ + CD-RW/DVD/TAPE/ZIP/ZAJ/ + LS-120/ etc. */ + UINT8 okLba; /* LBA: 0x40 if supported */ + UINT8 rsrv[2]; /* byte fill */ + + STATUS (*Reset)(int Ctrl,int dev); /* pointer to reset function */ + ATA_DEV *pAtaDev; /* pointer to ATA block device + structure */ + UINT8 cmdLength; /* 12 or 16 byte command */ + + /* setfeature : sub 0x95 */ + + BOOL okPEJ; /* Power Eject capable. */ + BOOL okLock; /* Supports Lock */ + short mediaStatusNotifyVer; /* status notify version */ + UINT16 nativeMaxAdd[4]; /* 3 = LBA 27:24 / Head + * 2 = LBA 23:16 / cylHi + * 1 = LBA 15:8 / cylLow + * 0 = LBA 7:0 / sector no + */ + short CFAerrorCode; /* result of "CFA request + * extended error code" cmd */ + UINT32 signature; +} ATA_DRIVE; + +typedef struct ataReg + { + UINT32 *data; /* (RW) data register (16 bits) */ + UINT32 *error; /* (R) error register */ + UINT32 *feature; /* (W) feature or write-precomp */ + UINT32 *seccnt; /* (RW) sector count */ + UINT32 *sector; /* (RW) first sector number */ + UINT32 *cylLo; /* (RW) cylinder low byte */ + UINT32 *cylHi; /* (RW) cylinder high byte */ + UINT32 *sdh; /* (RW) sector size/drive/head */ + UINT32 *command; /* (W) command register */ + UINT32 *status; /* (R) immediate status */ + UINT32 *aStatus; /* (R) alternate status */ + UINT32 *dControl; /* (W) disk controller control */ + } ATA_REG; + +typedef struct ataCtrl + { + ATA_DRIVE drive[ATA_MAX_DRIVES]; /* drives per controller */ + ATA_REG ataReg; /* Ata registers located in drives */ + SEMAPHORE ataBioReadySem; /* bio queue counting semaphore */ + SEMAPHORE syncSem; /* binary sem for syncronization */ + SEMAPHORE muteSem; /* mutex sem for mutual-exclusion */ + struct bio *bioQueueh; /* bio queue head for master device */ + struct bio *bioQueuet; /* bio queue tail for master device */ + int svcTaskId; /* id of service task for this ctrl */ + WDOG_ID wdgId; /* watch dog */ + int ctrl; /* controller number */ + int pwrdown; /* power down mode */ + int ctrlType; /* type of controller */ + int intVector; /* interrupt vector */ + int intLevel; /* interrupt level */ + int intCount; /* interrupt count */ + int intStatus; /* interrupt status */ + int configType; /* user recommended configuaration. + * This is the value passed to ataPiDrv + * during driver intialization. + */ + int semTimeout; /* timeout seconds for sync semaphore */ + int wdgTimeout; /* timeout seconds for watch dog */ + BOOL wdgOkay; /* watch dog status */ + BOOL installed; /* TRUE if a driver is installed */ + BOOL changed; /* TRUE if a card is installed */ + BOOL uDmaCableOkay; /* Set to 1 if the devices are connected + * to the controller with a 80 conductor + * cable using 40 pin connector + * (UDMA cable). + */ + /* The following function pointers and Boolean must be set by the + * bsp (sysAta.c) sysAtaInit() function + */ + FUNCPTR ataIntConnect; /* interrupt connect routine */ + FUNCPTR ataIntDisconnect; /* interrupt disconnect routine */ + FUNCPTR ataIntEnable; /* interrupt enable routine */ + FUNCPTR ataIntDisable; /* interrupt disable routine */ + FUNCPTR ataIntPreProcessing; /* this can be used for executing + * code in the beginning of the + * interrupt service routine */ + FUNCPTR ataIntPostProcessing; /* this can be used for executing + * code in the beginning of the + * interrupt service routine */ + FUNCPTR ataDmaInit; /* initialize the DMA hardware */ + FUNCPTR ataDmaSet; /* setup the DMA hardware for xfer */ + FUNCPTR ataDmaStart; /* start the DMA operation */ + FUNCPTR ataDmaStop; /* stop DMA functions */ + FUNCPTR ataDmaCheck; /* test status of DMA */ + FUNCPTR ataDmaModeSet; /* set mode of DMA operations */ + FUNCPTR ataDmaModeNegotiate; /* determine DMA xfer mode */ + FUNCPTR ataDmaReset; /* reset the DMA controller */ + BOOL ataHostDmaSupportOkay; /* DMA supported */ + } ATA_CTRL; + +typedef struct ataRaw + { + /* this is for ATA RAW ACCESS ioctl */ + UINT32 cylinder; /* cylinder (0 -> (cylindres-1)) */ + UINT32 head; /* head (0 -> (heads-1)) */ + UINT32 sector; /* sector (1 -> sectorsTrack) */ + char *pBuf; /* pointer to buffer (bytesSector * nSecs) */ + UINT32 nSecs; /* number of sectors (1 -> sectorsTrack) */ + int direction; /* read=0, write=1 */ + } ATA_RAW; + + +typedef struct atapi_cmd + { + UINT8 cmdPkt [ATAPI_MAX_CMD_LENGTH]; + char **ppBuf; + UINT32 bufLength; + ATA_DATA_DIR direction; + UINT32 desiredTransferSize; + BOOL dma; + BOOL overlap; + } ATAPI_CMD; + + +typedef struct smart_data /* Table 34, section 8.41.5.8, Ref-1 */ + { + short vendorSpecific0[362]; /* 0 - 361 */ + short offLineCollectionStatus; /* 362 + * Table 35, 8.41.5.8.1 Ref-1 + */ + short selfTestExecutionStatus; /* 363 + * Table 36, 8.41.5.8.2 Ref-1 + */ + short timeOffLine1; /* 364 in secs */ + short timeOffLine2; /* 365 in secs */ + short vendorSpecific366; /* 366 */ + short offlineCollectionCapability; /* 367 */ + short smartCapability1; /* 368 */ + short smartCapability2; /* 369 */ + short errorLogCapability; /* 370 + * bit-0: 1-supported + * 0-notsupported + */ + short vendorSpecific371; /* 371 */ + short shortSelfTestPollTime; /* 372 in mins */ + short extendedSelfTestPollTime; /* 373 in mins */ + short reserved374[12]; /* 374 - 385 */ + short vendorSpecific386[125]; /* 386-510 */ + short checksum; /* 511 */ + } SMART_DATA; + + +typedef struct smart_log_dir_entry + { + short noOfSectors; + short reserved; + } SMART_LOG_DIR_ENTRY; + + +typedef struct smart_log_directory /* Table 38, section 8.41.6.8.1, Ref-1 */ + { + short smartLogVersion1; /* 0 */ + short smartLogVersion2; /* 1 */ + SMART_LOG_DIR_ENTRY smartLogEntry[255]; /* 2 - 511 (255 * 2) */ + } SMART_LOG_DIRECTORY; + + +typedef struct readTocStruct + { + UINT32 transferLength; + UINT8 * pResultBuf; + } READ_TOC_STRUCT; + + +typedef struct command_data_struct /* Table 41 , 8.41.6.8.2.3.1, Ref-1 */ + { + short dControl; /* Device Control / Alternate status */ + short feature; /* Error / Feature */ + short seccnt; + short sector; + short cylLo; + short cylHi; + short sdh; + short command; + short timeStampLSB; + short timeStampNextLSB; + short timeStampNextMSB; + short timeStampMSB; + } COMMAND_DATA_STRUCT; + + +typedef struct error_data_struct /* Table 42 , 8.41.6.8.2.3.2, Ref-1 */ + { + short reserved0; + short error; /* Error / Feature */ + short seccnt; + short sector; + short cylLo; + short cylHi; + short sdh; + short status; /* Status / command */ + short extendedErrorInfo[19]; + short state; /* 27 */ + short LifeTimeStampLSB; /* 28 */ + short LifeTimeStampMSB; /* 29 */ + } ERROR_DATA_STRUCT; + + +typedef struct error_log_data_struct /* Table 40, 8.41.6.8.2.3, Ref-1 */ + { + COMMAND_DATA_STRUCT commandDataStruct[5]; /* fifth is where error reported*/ + ERROR_DATA_STRUCT errorDataStruct; + } ERROR_LOG_DATA_STRUCT; + + +typedef struct smart_error_log_sector /* Table 39, 8.41.6.8.2 , Ref-1 */ + { + short errorLogVersion; /* 0 */ + short errorLogIndex; /* 1 */ + ERROR_LOG_DATA_STRUCT ErrLogDataStruct[5]; /* 2 - 91 + * 92-181 + * 182-271 + * 272-361 + * 362-451 + */ + short DeviceErrCount1; /* 452 */ + short DeviceErrCount2; /* 453 */ + short reserved454[57]; /* 454-510 */ + short checksum; /* 511 */ + } SMART_ERROR_LOG_SECTOR; + + +typedef struct self_test_descriptor /* Table 45, 8.41.6.8.3.2, Ref-1 */ + { + short sector; /* 0 */ + short selfTestExecStatus; /* 1 */ + short lifeTimeStampLSB; /* 2 */ + short lifeTimeStampMSB; /* 3 */ + short failChechPoint; /* 4 */ + short failingLBALSB; /* 5 */ + short failingLBAnextLSB; /* 6 */ + short failingLBAnextMSB; /* 7 */ + short failingLBAMSB; /* 8 */ + short vendorSpecific[15]; /* 9 - 23 */ + } SELF_TEST_DESCRIPTOR; + + +typedef struct self_test_log /* Table 44, 8.41.6.8.3, Ref-1 */ + { + short revision; + SELF_TEST_DESCRIPTOR descriptorEntry[21]; /* 2 - 505 (24 * 21) */ + short vendorSpecific1; /* 506 */ + short vendorSpecific2; /* 507 */ + short selfTestIndex; /* 508 */ + short reserved509; /* 509 */ + short reserved510; /* 510 */ + short checksum; /* 511 */ + } SELF_TEST_LOG; + +typedef UINT8 CMD_PKT [ATAPI_MAX_CMD_LENGTH]; + +extern ATA_RESOURCE ataResources[]; + +/* function declarations */ + +extern STATUS ataDrv (int ctrl, int drives, int vector, int level, + BOOL configType, int semTimeout, int wdgTimeout); +extern BLK_DEV *ataDevCreate (int ctrl, int drive, UINT32 nBlks, UINT32 offset); +extern device_t ataXbdDevCreate (int ctrl, int drive, UINT32 nBlks, UINT32 offset, const char *); +extern UINT8 atapiPktCmdSend (ATA_DEV * pAtapiDev, ATAPI_CMD * pComPack); +extern UINT16 atapiGetCylinderCount (int ctrl, int drive); +extern UINT8 atapiGetHeadCount (int ctrl, int drive); +extern char * atapiGetDriveSerialNumber (int ctrl, int drive); +extern char * atapiGetFirmwareRevision (int ctrl, int drive); +extern char * atapiGetModelNumber (int ctrl, int drive); +extern UINT32 atapiGetFeatureSupported (int ctrl, int drive); +extern UINT32 atapiGetFeatureEnabled (int ctrl, int drive); +extern UINT8 atapiGetMaxDmaMode (int ctrl, int drive); +extern UINT8 atapiGetCurrentDmaMode (int ctrl, int drive); +extern UINT8 atapiGetMaxPioMode (int ctrl, int drive); +extern UINT8 atapiGetCurrentPioMode (int ctrl, int drive); +extern UINT8 atapiGetCurrenRwMode (int ctrl, int drive); +extern UINT8 atapiGetDriveType (int ctrl, int drive); +extern UINT32 atapiGetAtapiVersionNumber (int ctrl, int drive); +extern UINT16 atapiGetRemovMediaStatusNotifyVer (int ctrl, int drive); +extern UINT16 atapiGetCurrentCylinderCount (int ctrl, int drive); +extern UINT8 atapiGetCurrentHeadCount (int ctrl, int drive); +extern UINT16 atapiGetBytesPerTrack (int ctrl, int drive); +extern UINT16 atapiGetBytesPerSector (int ctrl, int drive); +extern STATUS atapiIoctl (int function, int ctrl, int drive, int password [16], + int arg0, UINT32 * arg1, UINT8 ** ppBuf); +extern STATUS atapiInit (int ctrl, int dev); +extern STATUS atapiTestUnitRdy (ATA_DEV *pAtapiDev); +extern STATUS atapiReadCapacity (ATA_DEV *pAtapiDev); +extern STATUS atapiCtrlMediumRemoval (ATA_DEV * pAtapiDev, int arg0); +extern STATUS atapiRequestSense (ATA_DEV * pAtapiDev,char * pBuf); +extern STATUS atapiReadTocPmaAtip (ATA_DEV * pAtapiDev, UINT32 transferLength, + char * resultBuf); +extern STATUS atapiRead10 (ATA_DEV * pAtapiDev,UINT32 startBlk, + UINT32 nBlks, UINT32 transferLength, char * pBuf); +extern UINT8 atapiGetMaxSDmaMode (int ctrl,int drive ); +extern UINT8 atapiGetCurrentSDmaMode (int ctrl,int drive ); +extern UINT8 atapiGetCurrentRwMode (int ctrl,int drive ); +extern STATUS atapiScan (ATA_DEV * pAtapiDev, UINT32 startAddressField, + int function); +extern STATUS atapiSeek (ATA_DEV * pAtapiDev, UINT32 addressLBA); +extern STATUS atapiSetCDSpeed (ATA_DEV * pAtapiDev, int readDriveSpeed, + int writeDriveSpeed); +extern STATUS atapiStopPlayScan (ATA_DEV * pAtapiDev); +extern STATUS atapiStartStopUnit (ATA_DEV * pAtapiDev,int arg0); +extern STATUS ataCtrlReset (int ctrl); +extern STATUS ataParamRead (int ctrl, int drive,void *buffer, int command); +extern STATUS ataPiInit (int ctrl, int drive ); +extern STATUS ataRW (int ctrl, int drive, UINT32 cylinder, UINT32 head, + UINT32 sector, void *p, UINT32 nSecs, int direction); +extern STATUS ataDmaRW (int ctrl, int drive, UINT32 cylinder, UINT32 head, + UINT32 sector, void *p, UINT32 nSecs, int direction); +extern STATUS ataWait (int ctrl, int request, BOOL reset); +extern STATUS ataStatusChk (ATA_CTRL * pCtrl, UINT8 mask, UINT8 status); +extern STATUS ataPRead (int ctrl, int drive, void *p); +extern STATUS ataInit (int ctrl, int drive); +extern STATUS ataCmd (int ctrl, int drive, int cmd, int arg0, int arg1, + int arg2, int arg3, int arg4, int arg5); +extern STATUS ataDevIdentify (int ctrl, int dev); +extern STATUS atapiInit (int ctrl, int dev); +extern STATUS atapiPRead (int ctrl, int drive, void * buffer); +extern UINT8 atapiPktCmd (ATA_DEV * pAtapiDev,ATAPI_CMD * pComPack); +extern STATUS atapiNonDataCmd (ATA_DEV * pAtapiDev, ATAPI_CMD * pComPack); +extern STATUS ataShowInit (void); +extern STATUS ataDrv (int ctrl, int drives, int vector, int level, + BOOL configType, int semTimeout, int wdgTimeout); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCataDrvh */ + diff --git a/h/drv/hdisk/ideDrv.h b/h/drv/hdisk/ideDrv.h new file mode 100644 index 0000000..214b7c2 --- /dev/null +++ b/h/drv/hdisk/ideDrv.h @@ -0,0 +1,158 @@ +/* ideDrv.h - IDE disk controller header */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01d,30oct01,dat Adding warning about driver being obsolete +01c,25oct94,hdn added ideRawio() function prototype. +01b,10oct94,hdn added IDE_RAW structure for ideRawio(). +01a,19oct93,hdn written. +*/ + +#ifndef __INCideDrvh +#define __INCideDrvh + +#ifdef __cplusplus +extern "C" { +#endif + +#warning "The ideDrv is replaced by ataDrv. Please use ataDrv instead" + + +#ifndef _ASMLANGUAGE + +#include "blkIo.h" + +typedef struct ideDev + { + BLK_DEV blkDev; + int drive; /* drive no. 0 - 1 */ + int blkOffset; /* sector offset */ + } IDE_DEV; + +typedef struct ideType + { + int cylinders; /* number of cylinders */ + int heads; /* number of heads */ + int sectorsTrack; /* number of sectors per track */ + int bytesSector; /* number of bytes per sector */ + int precomp; /* precompensation cylinder */ + } IDE_TYPE; + +typedef struct ideParams + { + short config; /* general configuration */ + short cylinders; /* number of cylinders */ + short removcyl; /* number of removable cylinders */ + short heads; /* number of heads */ + short bytesTrack; /* number of unformatted bytes/track */ + short bytesSec; /* number of unformatted bytes/sector */ + short sectorsTrack; /* number of sectors/track */ + short bytesGap; /* minimum bytes in intersector gap */ + short bytesSync; /* minimum bytes in sync field */ + short vendstat; /* number of words of vendor status */ + char serial[20]; /* controller serial number */ + short type; /* controller type */ + short size; /* sector buffer size, in sectors */ + short bytesEcc; /* ecc bytes appended */ + char rev[8]; /* firmware revision */ + char model[40]; /* model name */ + short nsecperint; /* sectors per interrupt */ + short usedmovsd; /* can use double word read/write? */ + short spare[207]; /* */ + } IDE_PARAM; + +typedef struct ideRaw + { /* this is for IDERAWACCESS ioctl */ + UINT cylinder; /* cylinder (0 -> (cylindres-1)) */ + UINT head; /* head (0 -> (heads-1)) */ + UINT sector; /* sector (1 -> sectorsTrack) */ + char *pBuf; /* pointer to buffer (bytesSector * nSecs) */ + UINT nSecs; /* number of sectors (1 -> sectorsTrack) */ + UINT direction; /* read=0, write=1 */ + } IDE_RAW; + + +/* max number of IDE drives */ + +#define IDE_MAX_DRIVES 2 + + +/* IDE registers */ + +#define IDE_DATA 0x1f0 /* (RW) data register (16 bits) */ +#define IDE_ERROR 0x1f1 /* (R) error register */ +#define IDE_PRECOMP 0x1f1 /* (W) write precompensation */ +#define IDE_SECCNT 0x1f2 /* (RW) sector count */ +#define IDE_SECTOR 0x1f3 /* (RW) first sector number */ +#define IDE_CYL_LO 0x1f4 /* (RW) cylinder low byte */ +#define IDE_CYL_HI 0x1f5 /* (RW) cylinder high byte */ +#define IDE_SDH 0x1f6 /* (RW) sector size/drive/head */ +#define IDE_COMMAND 0x1f7 /* (W) command register */ +#define IDE_STATUS 0x1f7 /* (R) immediate status */ +#define IDE_A_STATUS 0x3f6 /* (R) alternate status */ +#define IDE_D_CONTROL 0x3f6 /* (W) disk controller control */ +#define IDE_D_ADDRESS 0x3f7 /* (R) disk controller address */ + + +/* diagnostic code */ + +#define DIAG_OK 0x01 + +/* control register */ + +#define CTL_4BIT 0x8 /* use 4 head bits (wd1003) */ +#define CTL_RST 0x4 /* reset controller */ +#define CTL_IDS 0x2 /* disable interrupts */ + +/* status register */ + +#define STAT_BUSY 0x80 /* controller busy */ +#define STAT_READY 0x40 /* selected drive ready */ +#define STAT_WRTFLT 0x20 /* write fault */ +#define STAT_SEEKCMPLT 0x10 /* seek complete */ +#define STAT_DRQ 0x08 /* data request */ +#define STAT_ECCCOR 0x04 /* ECC correction made in data */ +#define STAT_INDEX 0x02 /* index pulse from selected drive */ +#define STAT_ERR 0x01 /* error detect */ + +/* size/drive/head register */ + +#define SDH_IBM 0xa0 /* 512 bytes sector, ecc */ + +/* commands */ + +#define CMD_RECALIB 0x10 /* recalibrate */ +#define CMD_SEEK 0x70 /* seek */ +#define CMD_READ 0x20 /* read sectors with retries */ +#define CMD_WRITE 0x30 /* write sectors with retries */ +#define CMD_FORMAT 0x50 /* format track */ +#define CMD_DIAGNOSE 0x90 /* execute controller diagnostic */ +#define CMD_INITP 0x91 /* initialize drive parameters */ +#define CMD_READP 0xEC /* identify */ + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +STATUS ideDrv (int vector, int level, BOOL manualConfig); +BLK_DEV *ideDevCreate (int drive, int nBlks, int offset); +STATUS ideRawio (int drive, IDE_RAW *pIdeRaw); + +#else + +STATUS ideDrv (); +BLK_DEV *ideDevCreate (); +STATUS ideRawio (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCideDrvh */ diff --git a/h/drv/hdisk/m5200AtaDrv.h b/h/drv/hdisk/m5200AtaDrv.h new file mode 100644 index 0000000..05e482b --- /dev/null +++ b/h/drv/hdisk/m5200AtaDrv.h @@ -0,0 +1,544 @@ +/* ataDrv.h - ATA/IDE (LOCAL and PCMCIA) disk controller header */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01i,10jan05,rfr Added ATA_CMD_WRITE_FLUSH +01h,29apr02,pmr SPR 76487: changed ataDrv() arg configType from BOOL to int. +01g,09nov01,jac SPR#67795, added definitions for ATAPI CDROM extensions. +01f,30oct97,db added macro ATA_SWAP for big endian targets. changed some + elements in ATA_CTRL from short to UINT32. +01e,10dec97,ms added usrAtaConfig prototype and ataResources import +01e,01nov96,hdn added support for PCMCIA +01d,25sep96,hdn added support for ATA-2 +01c,18mar96,hdn added ataShowInit(). +01b,01mar96,hdn cleaned up. +01a,02mar95,hdn written based on ideDrv.h. +*/ + +#ifndef __INCpcataDrvh +#define __INCpcataDrvh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + + +#include "dosFsLib.h" +#include "blkIo.h" +#include "wdLib.h" +#include "private/semLibP.h" +#include "drv/pcmcia/pccardLib.h" + +IMPORT ATA_RESOURCE ataResources[]; +/* define swap macro for little/big endian machines */ + +#if _BYTE_ORDER == _BIG_ENDIAN +# define ATA_SWAP(x) LONGSWAP(x) +#else +# define ATA_SWAP(x) (x) +#endif + +#define IDE_LOCAL 0 /* ctrl type: LOCAL(IDE) */ +#define ATA_PCMCIA 1 /* ctrl type: PCMCIA */ + +#define ATA_MAX_CTRLS 1 /* max number of ATA controller */ +#define ATA_MAX_DRIVES 2 /* max number of ATA drives */ + +typedef struct ataParams + { + short config; /* general configuration */ + short cylinders; /* number of cylinders */ + short removcyl; /* number of removable cylinders */ + short heads; /* number of heads */ + short bytesTrack; /* number of unformatted bytes/track */ + short bytesSec; /* number of unformatted bytes/sector */ + short sectors; /* number of sectors/track */ + short bytesGap; /* minimum bytes in intersector gap */ + short bytesSync; /* minimum bytes in sync field */ + short vendstat; /* number of words of vendor status */ + char serial[20]; /* controller serial number */ + short type; /* controller type */ + short size; /* sector buffer size, in sectors */ + short bytesEcc; /* ecc bytes appended */ + char rev[8]; /* firmware revision */ + char model[40]; /* model name */ + short multiSecs; /* RW multiple support. bits 7-0 ia max secs */ + short reserved48; /* reserved */ + short capabilities; /* capabilities */ + short reserved50; /* reserved */ + short pioMode; /* PIO data transfer cycle timing mode */ + short dmaMode; /* single word DMA data transfer cycle timing */ + short valid; /* field validity */ + short currentCylinders; /* number of current logical cylinders */ + short currentHeads; /* number of current logical heads */ + short currentSectors; /* number of current logical sectors / track */ + short capacity0; /* current capacity in sectors */ + short capacity1; /* current capacity in sectors */ + short multiSet; /* multiple sector setting */ + short sectors0; /* total number of user addressable sectors */ + short sectors1; /* total number of user addressable sectors */ + short singleDma; /* single word DMA transfer */ + short multiDma; /* multi word DMA transfer */ + short advancedPio; /* flow control PIO transfer modes supported */ + short cycletimeDma; /* minimum multiword DMA transfer cycle time */ + short cycletimeMulti; /* recommended multiword DMA cycle time */ + short cycletimePioNoIordy; /* min PIO transfer cycle time wo flow ctl */ + short cycletimePioIordy; /* min PIO transfer cycle time w IORDY */ + short reserved69; /* reserved */ + short reserved70; /* reserved */ + + /* ATAPI */ + + short pktCmdRelTime; /* [71]Typical Time for Release after Packet */ + short servCmdRelTime; /* [72]Typical Time for Release after SERVICE */ + short majorRevNum; /* [73] Major Revision Number (0|FFFF if no) */ + short minorVersNum; /* [74] Minor Version Number (0|FFFF if no) */ + short reserved75[53]; /* reserved */ + short vendor[32]; /* vendor specific */ + short reserved160[96]; /* reserved */ + } ATA_PARAM; + +typedef enum /* ATAPI */ + { + NON_DATA, /* non data command */ + OUT_DATA, + IN_DATA + } t_data_dir; + +/* Device types */ + +#define ATA_TYPE_NONE 0x00 /* device is faulty or not present */ + +#define ATA_TYPE_ATA 0x01 /* ATA device */ + +#define ATA_TYPE_ATAPI 0x02 /* ATAPI device */ + +#define ATA_TYPE_INIT 255 /* device must be identified */ + +/* Device states */ + +#define ATA_DEV_OK 0 /* device is OK */ + +#define ATA_DEV_NONE 1 /* device absent or does not respond */ + +#define ATA_DEV_DIAG_F 2 /* device diagnostic failed */ + +#define ATA_DEV_PREAD_F 3 /* read device parameters failed */ + +#define ATA_DEV_MED_CH 4 /* medium have been changed */ + +#define ATA_DEV_NO_BLKDEV 5 /* No block device available */ + +#define ATA_DEV_INIT 255 /* uninitialized device */ + +typedef struct ataDev + { + BLK_DEV blkDev; /* must be here */ + int ctrl; /* ctrl no. 0 - 1 */ + int drive; /* drive no. 0 - 1 */ + int blkOffset; /* sector offset */ + int nBlocks; /* number of sectors */ + + char * pBuf; /* Current position in an user buffer */ + char * pBufEnd; /* End of user buffer */ + t_data_dir direction; /* Transfer direction */ + int transCount; /* Number of transfer cycles */ + int errNum; /* Error description message number */ + + /* ATAPI Registers contents */ + + uint8_t intReason; /* Interrupt Reason Register */ + uint8_t status; /* Status Register */ + uint16_t transSize; /* Byte Count Register */ + } ATA_DEV; + +typedef struct ataDrive + { + ATA_PARAM param; /* geometry parameter */ + short okMulti; /* MULTI: TRUE if supported */ + short okIordy; /* IORDY: TRUE if supported */ + short okDma; /* DMA: TRUE if supported */ + short okLba; /* LBA: TRUE if supported */ + short multiSecs; /* supported max sectors for multiple RW */ + short pioMode; /* supported max PIO mode */ + short singleDmaMode; /* supported max single word DMA mode */ + short multiDmaMode; /* supported max multi word DMA mode */ + short rwMode; /* RW mode: PIO[0,1,2,3,4] or DMA[0,1,2] */ + short rwBits; /* RW bits: 16 or 32 */ + short rwPio; /* RW PIO unit: single or multi sector */ + short rwDma; /* RW DMA unit: single or multi word */ + + uint8_t state; /* device state */ + uint8_t diagCode; /* diagnostic code */ + uint8_t type; /* device type */ + STATUS (*Reset) /* pointer to reset function */ + ( + int ctrl, + int dev + ); + + ATA_DEV *pAtaDev; /* pointer to ATA block device structure */ + } ATA_DRIVE; + +typedef struct ataCtrl + { + ATA_DRIVE drive[ATA_MAX_DRIVES]; /* drives per controller */ + SEMAPHORE syncSem; /* binary sem for syncronization */ + SEMAPHORE muteSem; /* mutex sem for mutual-exclusion */ + WDOG_ID wdgId; /* watch dog */ + BOOL wdgOkay; /* watch dog status */ + int semTimeout; /* timeout seconds for sync semaphore */ + int wdgTimeout; /* timeout seconds for watch dog */ + int ctrlType; /* type of controller */ + BOOL installed; /* TRUE if a driver is installed */ + BOOL changed; /* TRUE if a card is installed */ + int intLevel; /* interrupt level */ + int intCount; /* interrupt count */ + int intStatus; /* interrupt status */ + int drives; /* number of drives in the controller */ + UINT32 data; /* (RW) data register (16 bits) */ + UINT32 error; /* (R) error register */ + UINT32 feature; /* (W) feature or write-precompensation */ + UINT32 seccnt; /* (RW) sector count */ + UINT32 sector; /* (RW) first sector number */ + UINT32 cylLo; /* (RW) cylinder low byte */ + UINT32 cylHi; /* (RW) cylinder high byte */ + UINT32 sdh; /* (RW) sector size/drive/head */ + UINT32 command; /* (W) command register */ + UINT32 status; /* (R) immediate status */ + UINT32 aStatus; /* (R) alternate status */ + UINT32 dControl; /* (W) disk controller control */ + UINT32 dAddress; /* (R) disk controller address */ + + int configType; /* or'd configuration flags */ + } ATA_CTRL; + +typedef struct ataType + { + int cylinders; /* number of cylinders */ + int heads; /* number of heads */ + int sectors; /* number of sectors per track */ + int bytes; /* number of bytes per sector */ + int precomp; /* precompensation cylinder */ + } ATA_TYPE; + +typedef struct ataRaw + { /* this is for ATARAWACCESS ioctl */ + UINT cylinder; /* cylinder (0 -> (cylindres-1)) */ + UINT head; /* head (0 -> (heads-1)) */ + UINT sector; /* sector (1 -> sectorsTrack) */ + char *pBuf; /* pointer to buffer (bytesSector * nSecs) */ + UINT nSecs; /* number of sectors (1 -> sectorsTrack) */ + UINT direction; /* read=0, write=1 */ + } ATA_RAW; + + +#define ATA_SEM_TIMEOUT_DEF 5 /* default timeout for ATA sync sem */ +#define ATA_WDG_TIMEOUT_DEF 5 /* default timeout for ATA watch dog */ + + +/* ATA registers */ + +#define ATA_DATA(base0) (base0 + 0x60) /* (RW) data register (16 bits) */ +#define ATA_ERROR(base0) (base0 + 0x64) /* (R) error register */ +#define ATA_FEATURE(base0) (base0 + 0x64) /* (W) feature/precompensation */ +#define ATA_SECCNT(base0) (base0 + 0x68) /* (RW) sector count */ +#define ATA_SECTOR(base0) (base0 + 0x6C) /* (RW) first sector number */ +#define ATA_CYL_LO(base0) (base0 + 0x70) /* (RW) cylinder low byte */ +#define ATA_CYL_HI(base0) (base0 + 0x74) /* (RW) cylinder high byte */ +#define ATA_SDH(base0) (base0 + 0x78) /* (RW) sector size/drive/head */ +#define ATA_COMMAND(base0) (base0 + 0x7C) /* (W) command register */ +#define ATA_STATUS(base0) (base0 + 0x7C) /* (R) immediate status */ +#define ATA_A_STATUS(base1) (base1 + 0x5C) /* (R) alternate status */ +#define ATA_D_CONTROL(base1) (base1 + 0x5C) /* (W) disk controller control */ +#define ATA_D_ADDRESS(base1) (base1 + 0) /* (R) disk controller address NOT USED*/ + + +/* diagnostic code */ + +#define ATA_DIAG_OK 0x01 + +/* control register */ + +#define ATA_CTL_4BIT 0x8 /* use 4 head bits (wd1003) */ +#define ATA_CTL_RST 0x4 /* reset controller */ +#define ATA_CTL_IDS 0x2 /* disable interrupts */ + +/* status register */ + +#define ATA_STAT_ACCESS (ATA_STAT_BUSY | ATA_STAT_DRQ) + /* device accessible */ + +#define ATA_STAT_BUSY 0x80 /* controller busy */ +#define ATA_STAT_READY 0x40 /* selected drive ready */ +#define ATA_STAT_WRTFLT 0x20 /* write fault */ +#define ATA_STAT_SEEKCMPLT 0x10 /* seek complete */ +#define ATA_STAT_DRQ 0x08 /* data request */ +#define ATA_STAT_ECCCOR 0x04 /* ECC correction made in data */ +#define ATA_STAT_INDEX 0x02 /* index pulse from selected drive */ +#define ATA_STAT_ERR 0x01 /* error detect */ + +/* size/drive/head register: addressing mode CHS or LBA */ + +#define ATA_SDH_IBM 0xa0 /* chs, 512 bytes sector, ecc */ +#define ATA_SDH_LBA 0xe0 /* lba, 512 bytes sector, ecc */ + +/* commands */ + +#define ATA_CMD_RECALIB 0x10 /* recalibrate */ +#define ATA_CMD_SEEK 0x70 /* seek */ +#define ATA_CMD_READ 0x20 /* read sectors with retries */ +#define ATA_CMD_WRITE 0x30 /* write sectors with retries */ +#define ATA_CMD_FORMAT 0x50 /* format track */ +#define ATA_CMD_DIAGNOSE 0x90 /* execute controller diagnostic */ +#define ATA_CMD_INITP 0x91 /* initialize drive parameters */ +#define ATA_CMD_READP 0xEC /* identify */ +#define ATA_CMD_SET_FEATURE 0xEF /* set features */ +#define ATA_CMD_SET_MULTI 0xC6 /* set multi */ +#define ATA_CMD_READ_MULTI 0xC4 /* read multi */ +#define ATA_CMD_WRITE_MULTI 0xC5 /* write multi */ +#define ATA_CMD_FLUSH_CACHE 0xE7 /* Flush write cache */ + +/* ATAPI commands */ + +#define ATA_PI_CMD_SRST 0x08 /* ATAPI Soft Reset */ +#define ATA_PI_CMD_PKTCMD 0xA0 /* ATAPI Pakcet Command */ +#define ATA_PI_CMD_IDENTD 0xA1 /* ATAPI Identify Device */ +#define ATA_PI_CMD_SERVICE 0xA2 /* Service */ + +/* CDROM commands */ + +#define CDROM_CMD_TEST_UNIT_READY 0x00 /* CDROM Test Unit Ready */ +#define CDROM_CMD_REQUEST_SENSE 0x03 /* CDROM Request Sense */ +#define CDROM_CMD_INQUIRY 0x12 /* CDROM Inquiry */ +#define CDROM_CMD_READ_CDROM_CAP 0x25 /* CDROM Read CD-ROM Capacity */ +#define CDROM_CMD_READ_12 0xA8 /* CDROM Read (12) */ + +/* sub command of ATA_CMD_SET_FEATURE */ + +#define ATA_SUB_ENABLE_8BIT 0x01 /* enable 8bit data transfer */ +#define ATA_SUB_ENABLE_WCACHE 0x02 /* enable write cache */ +#define ATA_SUB_SET_RWMODE 0x03 /* set transfer mode */ +#define ATA_SUB_DISABLE_RETRY 0x33 /* disable retry */ +#define ATA_SUB_SET_LENGTH 0x44 /* length of vendor specific bytes */ +#define ATA_SUB_SET_CACHE 0x54 /* set cache segments */ +#define ATA_SUB_DISABLE_LOOK 0x55 /* disable read look-ahead feature */ +#define ATA_SUB_DISABLE_REVE 0x66 /* disable reverting to power on def */ +#define ATA_SUB_DISABLE_ECC 0x77 /* disable ECC */ +#define ATA_SUB_DISABLE_8BIT 0x81 /* disable 8bit data transfer */ +#define ATA_SUB_DISABLE_WCACHE 0x82 /* disable write cache */ +#define ATA_SUB_ENABLE_ECC 0x88 /* enable ECC */ +#define ATA_SUB_ENABLE_RETRY 0x99 /* enable retries */ +#define ATA_SUB_ENABLE_LOOK 0xaa /* enable read look-ahead feature */ +#define ATA_SUB_SET_PREFETCH 0xab /* set maximum prefetch */ +#define ATA_SUB_SET_4BYTES 0xbb /* 4 bytes of vendor specific bytes */ +#define ATA_SUB_ENABLE_REVE 0xcc /* enable reverting to power on def */ + +/* transfer modes of ATA_SUB_SET_RWMODE */ + +#define ATA_PIO_DEF_W 0x00 /* PIO default trans. mode */ +#define ATA_PIO_DEF_WO 0x01 /* PIO default trans. mode, no IORDY */ +#define ATA_PIO_W_0 0x08 /* PIO flow control trans. mode 0 */ +#define ATA_PIO_W_1 0x09 /* PIO flow control trans. mode 1 */ +#define ATA_PIO_W_2 0x0a /* PIO flow control trans. mode 2 */ +#define ATA_PIO_W_3 0x0b /* PIO flow control trans. mode 3 */ +#define ATA_PIO_W_4 0x0c /* PIO flow control trans. mode 4 */ +#define ATA_DMA_SINGLE_0 0x10 /* singleword DMA mode 0 */ +#define ATA_DMA_SINGLE_1 0x11 /* singleword DMA mode 1 */ +#define ATA_DMA_SINGLE_2 0x12 /* singleword DMA mode 2 */ +#define ATA_DMA_MULTI_0 0x20 /* multiword DMA mode 0 */ +#define ATA_DMA_MULTI_1 0x21 /* multiword DMA mode 1 */ +#define ATA_DMA_MULTI_2 0x22 /* multiword DMA mode 2 */ +#define ATA_MAX_RW_SECTORS 0x100 /* max sectors per transfer */ + +/* configuration flags: transfer mode, bits, unit, geometry */ + +#define ATA_PIO_DEF_0 ATA_PIO_DEF_W /* PIO default mode */ +#define ATA_PIO_DEF_1 ATA_PIO_DEF_WO /* PIO default mode, no IORDY */ +#define ATA_PIO_0 ATA_PIO_W_0 /* PIO mode 0 */ +#define ATA_PIO_1 ATA_PIO_W_1 /* PIO mode 1 */ +#define ATA_PIO_2 ATA_PIO_W_2 /* PIO mode 2 */ +#define ATA_PIO_3 ATA_PIO_W_3 /* PIO mode 3 */ +#define ATA_PIO_4 ATA_PIO_W_4 /* PIO mode 4 */ +#define ATA_PIO_AUTO 0x000d /* PIO max supported mode */ +#define ATA_DMA_0 0x0002 /* DMA mode 0 */ +#define ATA_DMA_1 0x0003 /* DMA mode 1 */ +#define ATA_DMA_2 0x0004 /* DMA mode 2 */ +#define ATA_DMA_AUTO 0x0005 /* DMA max supported mode */ +#define ATA_MODE_MASK 0x000F /* transfer mode mask */ + +#define ATA_BITS_16 0x0040 /* RW bits size, 16 bits */ +#define ATA_BITS_32 0x0080 /* RW bits size, 32 bits */ +#define ATA_BITS_MASK 0x00c0 /* RW bits size mask */ + +#define ATA_PIO_SINGLE 0x0010 /* RW PIO single sector */ +#define ATA_PIO_MULTI 0x0020 /* RW PIO multi sector */ +#define ATA_PIO_MASK 0x0030 /* RW PIO mask */ + +#define ATA_DMA_SINGLE 0x0400 /* RW DMA single word */ +#define ATA_DMA_MULTI 0x0800 /* RW DMA multi word */ +#define ATA_DMA_MASK 0x0c00 /* RW DMA mask */ + +#define ATA_GEO_FORCE 0x0100 /* set geometry in the table */ +#define ATA_GEO_PHYSICAL 0x0200 /* set physical geometry */ +#define ATA_GEO_CURRENT 0x0300 /* set current geometry */ +#define ATA_GEO_MASK 0x0300 /* geometry mask */ + + +/****************************** ATAPI Devices ******************************/ + +/* config */ + +#define CONFIG_PROT_TYPE 0xc000 /* Protocol Type */ +#define CONFIG_PROT_TYPE_ATAPI 0x8000 /* ATAPI */ + +#define CONFIG_DEV_TYPE 0x1f00 /* Device Type */ +#define CONFIG_DEV_TYPE_CD_ROM 0x0500 + +#define CONFIG_REMOVABLE 0x0080 /* Removable */ + +#define CONFIG_PKT_TYPE 0x0060 /* CMD DRQ Type */ +#define CONFIG_PKT_TYPE_MICRO 0x0000 /* Microprocessor DRQ */ +#define CONFIG_PKT_TYPE_INTER 0x0020 /* Interrupt DRQ */ +#define CONFIG_PKT_TYPE_ACCEL 0x0040 /* Accelerated DRQ */ + +#define CONFIG_PKT_SIZE 0x0003 /* Command Packet Size */ +#define CONFIG_PKT_SIZE_12 0x0000 /* 12 bytes */ + +/* capabilities */ + +#define CAPABIL_DMA 0x0100 /* DMA Supported */ +#define CAPABIL_LBA 0x0200 /* LBA Supported */ +#define CAPABIL_IORDY_CTRL 0x0400 /* IORDY can be disabled */ +#define CAPABIL_IORDY 0x0800 /* IORDY Supported */ +#define CAPABIL_OVERLAP 0x2000 /* Overlap Operation Supported */ + +/* valid */ + +#define FIELDS_VALID 0x0002 + +/* singleDma */ + +#define SINGLEDMA_MODE 0xff00 /* 15-8: mode active */ +#define SINGLEDMA_SUPPORT 0x00ff /* 7-0: modes supported */ + +/* multiDma */ + +#define MULTIDMA_MODE 0xff00 /* 15-8: mode active */ +#define MULTIDMA_SUPPORT 0x00ff /* 7-0: modes supported */ + +/* advPio */ + +#define ADVPIO_MODE3 0x0001 /* The Device supports PIO Mode 3 */ + +/* ATAPI registers */ + +#define ATAPI_DATA pCtrl->data /* ATA_DATA (RW) data reg. (16 bits) */ +#define ATAPI_ERROR pCtrl->error /* ATA_ERROR (R) error reg. */ +#define ATAPI_FEATURE pCtrl->feature /* ATA_FEATURE (W) feature reg. */ +#define ATAPI_INTREASON pCtrl->seccnt /* ATA_SECCNT (R) interrupt reason */ +#define ATAPI_BCOUNT_LO pCtrl->cylLo /* ATA_CYL_LO (RW) byte count (low) */ +#define ATAPI_BCOUNT_HI pCtrl->cylHi /* ATA_CYL_HI (RW) byte count (high) */ +#define ATAPI_D_SELECT pCtrl->sdh /* ATA_SDH (RW) drive select reg. */ +#define ATAPI_STATUS pCtrl->status /* ATA_STATUS (R) status reg. */ +#define ATAPI_COMMAND pCtrl->command /* ATA_COMMAND (W) command reg. */ +#define ATAPI_D_CONTROL pCtrl->dControl /* ATA_D_CONTROL (W) device control */ + +/* Error Register */ + +#define ERR_SENSE_KEY 0xf0 /* Sense Key mask */ +#define SENSE_NO_SENSE 0x00 /* no sense sense key */ +#define SENSE_RECOVERED_ERROR 0x10 /* recovered error sense key */ +#define SENSE_NOT_READY 0x20 /* not ready sense key */ +#define SENSE_MEDIUM_ERROR 0x30 /* medium error sense key */ +#define SENSE_HARDWARE_ERROR 0x40 /* hardware error sense key */ +#define SENSE_ILLEGAL_REQUEST 0x50 /* illegal request sense key */ +#define SENSE_UNIT_ATTENTION 0x60 /* unit attention sense key */ +#define SENSE_DATA_PROTECT 0x70 /* data protect sense key */ +#define SENSE_ABBORTED_COMMAND 0xb0 /* aborted command sense key */ +#define SENSE_MISCOMPARE 0xe0 /* miscompare sense key */ +#define ERR_MCR 0x08 /* Media Change Requested */ +#define ERR_ABRT 0x04 /* Aborted command */ +#define ERR_EOM 0x02 /* End Of Media */ +#define ERR_ILI 0x01 /* Illegal Length Indication */ + +/* Feature Register */ + +#define FEAT_OVERLAP 0x02 /* command may be overlapped */ +#define FEAT_DMA 0x01 /* data will be transferred via DMA */ + +/* Interrupt Reason Register */ + +#define INTR_RELEASE 0x04 /* Bus released before completing the command */ +#define INTR_IO 0x02 /* 1 - In to the Host; 0 - Out to the device */ +#define INTR_COD 0x01 /* 1 - Command; 0 - user Data */ + +/* Drive Select Register */ + +#define DSEL_FILLER 0xa0 /* to fill static fields */ +#define DSEL_DRV 0x10 /* Device 0 (DRV=0) or 1 (DRV=1) */ + +/* Status Register */ + +#define STAT_BUSY 0x80 /* controller busy */ +#define STAT_READY 0x40 /* selected drive ready */ + +#define STAT_DMA_READY 0x20 /* ready to a DMA data transfer */ + +#define STAT_WRTFLT 0x20 /* write fault */ + +#define STAT_SERVICE 0x10 /* service or interrupt request */ + +#define STAT_SEEKCMPLT 0x10 /* seek complete */ +#define STAT_DRQ 0x08 /* data request */ +#define STAT_ECCCOR 0x04 /* ECC correction made in data */ +#define STAT_ERR 0x01 /* error detect */ + +/* Device Control Register */ + +#define CTL_FILLER 0x8 /* bit 3 must be always set */ +#define CTL_RST 0x4 /* reset controller */ +#define CTL_IDS 0x2 /* disable interrupts */ + +/**********************************************************************/ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS ataDrv (int ctrl, int drives, int vector, int level, + int configType, int semTimeout, + int wdgTimeout); +extern BLK_DEV *ataDevCreate (int ctrl, int drive, int nBlks, int offset); +extern STATUS ataRawio (int ctrl, int drive, ATA_RAW *pAtaRaw); +extern void ataShowInit (void); +extern STATUS ataShow (int ctrl, int drive); +extern int usrAtaPartition (int ctrl, int drive, DOS_PART_TBL *pPart); +extern STATUS usrAtaConfig (int ctrl, int drive, char *fileName); +extern void usrAtaInit (void); + +#else + +extern STATUS ataDrv (); +extern BLK_DEV *ataDevCreate (); +extern STATUS ataRawio (); +extern void ataShowInit (); +extern STATUS ataShow (); +extern int usrAtaPartition (); +extern STATUS usrAtaConfig (); +extern void usrAtaInit (); + +#endif /* __STDC__ */ + + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpcataDrvh */ diff --git a/h/drv/i2c/i2cLib.h b/h/drv/i2c/i2cLib.h new file mode 100644 index 0000000..788df57 --- /dev/null +++ b/h/drv/i2c/i2cLib.h @@ -0,0 +1,309 @@ +/* i2cLib.h - Structure for the i2cLib API*/ + +/* Copyright 1984 - 2002 Wind River Services. */ +/* Copyright 1984 - 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,18jul01,a_n written. + +*/ + +/* +DESCRIPTION + +This file defines all the structures uses by master and slave i2c device +drivers. +*/ + +#ifndef __INCi2cLibh +#define __INCi2cLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "semLib.h" +#include "lstLib.h" /* List library for linked structures. */ + + +#define I2C_INIT_STR_MAX 255 +#define I2C_NAME_MAX 20 /* The maximum length of a device name */ +#define I2C_DESC_MAX 80 /* The maximum length of device desription. */ +#define ENO_I2C_MASTER 0xFFFFA5A5 + +/* options passed to the master read/write routines */ +#define I2C_OPT_NO_STOP 0x00000001 + +/* flags */ +#define I2C_SLAVE_FLG_FAST_MODE 0x00000001 /* common 400kbs xfer rate */ +#define I2C_SLAVE_FLG_STANDARD_MODE_ONLY 0x00000002 /* old 100kbs xfer*/ +#define I2C_SLAVE_FLG_HS_MODE 0x00000004 /* 3.4 Mbs xfer */ +#define I2C_SLAVE_FLG_7_BIT_ADDR 0x80000000 /* normal 7 bit addressing */ +#define I2C_SLAVE_FLG_10_BIT_ADDR 0x40000000 /* normal 7 bit addressing */ + +#define I2C_MASTER_FLG_FAST_MODE 0x00000001 /* common 400kbs xfer rate */ +#define I2C_MASTER_FLG_STANDARD_MODE_ONLY 0x00000002 /* old 100kbs xfer*/ +#define I2C_MASTER_FLG_HS_MODE 0x00000004 /* 3.4 Mbs xfer */ + + +/* + * + * I2C_DEV_OBJ - device specific control object + * + * The I2C_DEV_OBJ structure is the glue linking generic + * master and slave I2C device structure (I2C_MASTER_OBJ & I2C_SLAVE_OBJ) + * with the device specific data object referenced by pDevice. + */ + +typedef struct i2c_dev_obj + { + char name[I2C_NAME_MAX]; + int unit; + char description[I2C_DESC_MAX]; + void* pDevice; /* Pointer back to the device data. */ + } I2C_DEV_OBJ; + + + +/* + * + * i2cMasterObject - the basic end object that i2c masters derives from + * + * This data structure defines a device independant amount of state + * that is maintained by all drivers/devices. + * Each specific i2c master interface device derives from this object + * first and then incorporates it's own data structures after it. + * + */ +typedef struct i2c_master_object + { + NODE node; + I2C_DEV_OBJ i2cDevObject; /* Root of the device heirarchy. */ + BOOL attached; /* Indicates unit is attached. */ + SEM_ID accessSem; /* write semaphore. */ + UINT32 flags; /* Various flags. */ + struct i2c_master_funcs *pFuncTable; /* Function table. */ + LIST attachedSlaves; /* slave i2c devices attached */ + } I2C_MASTER_OBJ; + + +/* + * + * i2cSlaveObject - the basic end object that i2c slaves derives from + * + * This data structure defines a device independant amount of state + * that is maintained by all drivers/devices. + * Each specific i2c slave device derives from this object + * first and then incorporates it's own data structures after it. + * + */ +typedef struct i2c_slave_object + { + NODE node; + I2C_DEV_OBJ i2cDevObject; /* Root of the device heirarchy. */ + UINT32 flags; /* Various flags. */ + UINT32 i2cAddr; /* I2C Slave address. */ + I2C_MASTER_OBJ * i2cMaster; + } I2C_SLAVE_OBJ; +/* + * + * I2C_MASTER_FUNCS - driver function table + * + * This is a table that is created, one per driver, to hold all the + * function pointers for that driver. In this way we can have only one + * instance to this structer, but one pointer per netDevice structure. + */ +#if 0 +typedef struct i2c_master_funcs + { + STATUS (*write) (I2C_MASTER_OBJ *, UINT8, UINT8*, UINT32, UINT32, int); /* Driver's write func. */ + STATUS (*read) (I2C_MASTER_OBJ *, UINT8, UINT8*, UINT32, UINT32, int); /* Driver's read func. */ + } I2C_MASTER_FUNCS; +#else +typedef struct i2c_master_funcs + { + FUNCPTR write; + FUNCPTR read; + } I2C_MASTER_FUNCS; +#endif + +/* This structure is a row in our run time i2c master table. + * Each row contains all the i2c master units started on a particular named device. + * I.e. all devices that are MPC8240 i2c masters will be in the list + * off of the row with the name "mpc8240_i2c". + */ + +typedef struct i2c_master_tbl_row + { + NODE node; /* Needed by our list processing library. */ + char name[I2C_NAME_MAX]; /* Name of the devices in row. (mpc8240_i2c, etc.) */ + LIST units; /* List of devices, i.e. 0, 1, etc.. */ + } I2C_MASTER_TBL_ROW; + +/* This is the structure that is used by the BSP to build up a table + * of I2C Master interface devices to be started at boot time. + */ +typedef struct i2c_master_tbl_entry + { + int unit; /* This device's unit # */ + I2C_MASTER_OBJ* (*i2cLoadFunc) (char*, void*); /* The Load function. */ + char* i2cLoadString; /* The load string. */ + BOOL processed; /* Has this been processed? */ + } I2C_MASTER_TBL_ENTRY; + +#define I2C_MASTER_TBL_END NULL + +/* This structure is a row in our run time i2c slave table. + * Each row contains all the i2c slave units started on a particular named device. + * I.e. all devices that are eeprom i2c masters will be in the list + * off of the row with the name "eeprom_i2c". + */ + +typedef struct i2c_slave_tbl_row + { + NODE node; /* Needed by our list processing library. */ + char name[I2C_NAME_MAX]; /* Name of the devices in row. (mpc8240_i2c, etc.) */ + LIST units; /* List of devices, i.e. 0, 1, etc.. */ + } I2C_SLAVE_TBL_ROW; + +/* This is the structure that is used by the BSP to build up a table + * of I2C Slave devices to be started at boot time. + */ +typedef struct i2c_slave_tbl_entry + { + int unit; /* This device's unit # */ + I2C_SLAVE_OBJ* (*i2cLoadFunc) (char*, void*); /* The Load function. */ + char* i2cLoadString; /* The load string. */ + BOOL processed; /* Has this been processed? */ + } I2C_SLAVE_TBL_ENTRY; + +#define I2C_SLAVE_TBL_END NULL + +void i2cAccessSemTake + ( + I2C_MASTER_OBJ* pI2CMaster, + int tmout + ); + +void i2cAccessSemGive + ( + I2C_MASTER_OBJ* pI2CMaster + ); + +void i2cMasterFlagsClr + ( + I2C_MASTER_OBJ* pI2CMaster, + UINT32 clrBits + ); + +void i2cMasterFlagsSet + ( + I2C_MASTER_OBJ* pI2CMaster, + UINT32 setBits + ); + +int i2cMasterFlagsGet + ( + I2C_MASTER_OBJ* pI2CMaster + ); + +char* i2cMasterDevName + ( + I2C_MASTER_OBJ* pI2CMaster + ); + +void i2cSlaveAddrSet + ( + I2C_SLAVE_OBJ* pI2CSlave, + UINT32 i2cAddr + ); + +UINT32 i2cSlaveAddrGet + ( + I2C_SLAVE_OBJ* pI2CSlave + ); + +I2C_MASTER_OBJ* i2cMasterFindByName + ( + char* pName, /* device name to search for */ + int unit + ); + +I2C_SLAVE_OBJ* i2cSlaveFindByName + ( + char* pName, /* device name to search for */ + int unit + ); + +STATUS i2cLibInit (void); + +I2C_MASTER_OBJ * i2cMasterDevLoad + ( + int unit, /* unit number of device */ + FUNCPTR i2cDrvLoad, /* load function of the driver */ + char* pInitString /* init string for this driver */ + ); + +I2C_SLAVE_OBJ * i2cSlaveDevLoad + ( + int unit, /* unit number of device */ + FUNCPTR i2cDrvLoad, /* load function of the driver */ + char* pInitString /* init string for this driver */ + ); + +STATUS i2cMasterObjInit + ( + I2C_MASTER_OBJ * pI2CMasterObj, /* object to be initialized */ + char * pMasterBaseName, /* device base name, for example, "mpc8240_i2c" */ + int masterUnitNo, /* unit number */ + I2C_MASTER_FUNCS * pMasterFuncTable, /* master device functions */ + char* pMasterDescription, + UINT32 masterFlags + ); + + +STATUS i2cSlaveObjInit + ( + I2C_SLAVE_OBJ * pI2CSlaveObj, /* object to be initialized */ + char * pSlaveBaseName, /* device base name, for example, "mpc8240_i2c" */ + int slaveUnitNo, /* unit number */ + char* pSlaveDescription, + UINT32 slaveFlags, + UINT32 slaveI2CAddr, + char * pMasterBaseName, /* device base name, for example, "mpc8240_i2c" */ + int masterUnitNo /* unit number */ + ); + +STATUS i2cMasterObjFlagSet + ( + I2C_MASTER_OBJ * pI2CMaster, + UINT32 flags + ); + + +STATUS i2cWrite + ( + I2C_SLAVE_OBJ * pI2CSlave, /* i2c slave device structure */ + UINT8 * pBuff, /* data to be written */ + UINT32 nBytes, /* number of bytes to write */ + UINT32 options, /* transaction options */ + int timeout /* timeout in ticks */ + ); + +STATUS i2cRead + ( + I2C_SLAVE_OBJ * pI2CSlave, /* i2c slave device structure */ + UINT8 * pBuff, /* data buffer to read into */ + UINT32 nBytes, /* number of bytes to read */ + UINT32 options, /* transaction options */ + int timeout /* timeout in ticks */ + ); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCi2cLibh */ diff --git a/h/drv/i2c/ixp400I2c.h b/h/drv/i2c/ixp400I2c.h new file mode 100644 index 0000000..2a57164 --- /dev/null +++ b/h/drv/i2c/ixp400I2c.h @@ -0,0 +1,49 @@ +/* ixp400I2c.h - Intel IXP400 I2c header file */ + +/* +Copyright (c) 2002, 2004-2005 Wind River Systems, Inc. All rights reserved. +Certain portions of these files may be copyright (c) 2002-2005 Intel +Corporation. +*/ + +/* +modification history +-------------------- +01c,28feb05,pai Picked up Intel mods to init functions. +01b,20dec04,pai Updated copyright notice. +01a,05jun02,jb initial version... +*/ + +#ifndef __INCixp400I2ch +#define __INCixp400I2ch + + +#ifdef __cplusplus +extern "C" { +#endif + +#define IXP400_I2C_READ_FLAG 0x1 /* Read from slave */ +#define IXP400_I2C_WRITE_MSK 0xFE /* Write to slave */ +#define IXP400_I2C_ACK_RTY 5 /* Acknowledge Receive retry count */ + + +/* Function Declarations */ + +STATUS ixp400I2CStart (); +void ixp400I2CStop (); +void ixp400I2CAckSend (); +STATUS ixp400I2CAckReceive (); +void ixp400I2CByteTransmit (unsigned char dataByte); +void ixp400I2CByteReceive (unsigned char *dataByte); +STATUS ixp400I2CWriteTransfer (UINT8 devAddr, UINT8 *buffer, UINT32 num, UINT8 offset); +STATUS ixp400I2CReadTransfer (UINT8 devAddr, UINT8 *buffer, UINT32 num, UINT8 offset); + +#ifdef INCLUDE_I2C_HW_CTRL +UINT32 ixp400I2CInit (void); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCixp400I2ch */ diff --git a/h/drv/i2c/m5200I2CMaster.h b/h/drv/i2c/m5200I2CMaster.h new file mode 100644 index 0000000..c9b4c8a --- /dev/null +++ b/h/drv/i2c/m5200I2CMaster.h @@ -0,0 +1,89 @@ +/* m5200I2CMaster.h - MPC5200 on chip I2C controller */ + +/* Copyright 2000-2002 Wind River Systems, Inc. */ +/* Copyright 2000-2002 Wind River Services */ + + +/* +modification history +-------------------- +01a,13oct03,e_c Written +*/ + + +#ifndef __INCm5200I2CMasterh +#define __INCm5200I2CMasterh +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define M5200I2C_DEV_NAME "m5200i2c" +#define M5200I2C_DEV_NAME_LEN 8 + + +/* register offsets from the base */ +#define M5200_I2C_ADR_REG_OFFSET 0x00 +#define M5200_I2C_FREQDIV_REG_OFFSET 0x04 +#define M5200_I2C_CTRL_REG_OFFSET 0x08 +#define M5200_I2C_STAT_REG_OFFSET 0x0c +#define M5200_I2C_DATA_REG_OFFSET 0x10 +#define M5200_I2C_INTCTL_OFFSET 0x20 + +/* register defines */ +/* adress register */ +#define M5200_I2C_ADR_REG_MASK 0xfe000000 + +/* frequency divider register */ +#define M5200_I2C_FREQDIV_REG_MASK 0x3f000000 + +/* I2C control register */ +#define M5200_I2C_CTL_REG_MASK 0xfc000000 +#define M5200_I2C_CTL_REG_EN 0x80000000 +#define M5200_I2C_CTL_REG_IEN 0x40000000 +#define M5200_I2C_CTL_REG_STA 0x20000000 +#define M5200_I2C_CTL_REG_TX 0x10000000 +#define M5200_I2C_CTL_REG_TXAK 0x08000000 +#define M5200_I2C_CTL_REG_RSTA 0x04000000 + +/* I2C status register */ +#define M5200_I2C_STAT_REG_MASK 0xf7000000 +#define M5200_I2C_STAT_REG_CF 0x80000000 +#define M5200_I2C_STAT_REG_AAS 0x40000000 +#define M5200_I2C_STAT_REG_BB 0x20000000 +#define M5200_I2C_STAT_REG_AL 0x10000000 +#define M5200_I2C_STAT_REG_SRW 0x04000000 +#define M5200_I2C_STAT_REG_IF 0x02000000 +#define M5200_I2C_STAT_REG_RXAK 0x01000000 + + +/* Data I/O register */ +#define M5200_I2C_DATA_REG_MASK 0xff000000 + +/* I2C interrupt control register */ +#define M5200_I2C_INTCTL_MASK 0xff000000 + + +#define M5200_TO_I2C_DATA(data) (((UINT32)data << 24) & 0xff000000) +#define I2C_TO_M5200_DATA(data) (UINT8)(data >> 24) + + + +typedef struct m5200I2CDrvCtrl +{ + I2C_MASTER_OBJ i2cMasterObj; + int unit; + UINT32 regBase; +} M5200_I2C_DRV_CTRL; + +#if defined(__STDC__) || defined(__cplusplus) + IMPORT void * m5200I2CDrvLoad (char * initString); +#else + IMPORT void * m5200I2CDrvLoad (); +#endif /* __STDC__ */ + + + +#ifdef __cpluscplus +} +#endif /* __cplusplus */ +#endif /* __INCm5200I2CMasterh */ diff --git a/h/drv/intrCtl/hd644232.h b/h/drv/intrCtl/hd644232.h new file mode 100644 index 0000000..572db73 --- /dev/null +++ b/h/drv/intrCtl/hd644232.h @@ -0,0 +1,80 @@ +/* hd644232.h - Hitachi 644232 IRC Interrupt Request Controller header */ + +/* Copyright 1991-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01e,22sep92,rrr added support for c++ +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01b,07jun91,hdn defined HD644232_REG_OFFSET. +01a,09feb91,hdn written. +*/ + +#ifndef __INChd644232h +#define __INChd644232h + +#ifdef __cplusplus +extern "C" { +#endif + +#define HD644232_REG_OFFSET 3 + +#ifndef _ASMLANGUAGE +typedef struct + { + UCHAR pad0[HD644232_REG_OFFSET]; + UCHAR lmr1; + UCHAR pad1[HD644232_REG_OFFSET]; + UCHAR lmr2; + UCHAR pad2[HD644232_REG_OFFSET]; + UCHAR lmr3; + UCHAR pad3[HD644232_REG_OFFSET]; + UCHAR lmr4; + UCHAR pad4[HD644232_REG_OFFSET]; + UCHAR lmr5; + UCHAR pad5[HD644232_REG_OFFSET]; + UCHAR lmr6; + UCHAR pad6[HD644232_REG_OFFSET]; + UCHAR vmr; + UCHAR pad7[HD644232_REG_OFFSET]; + UCHAR vsr; + UCHAR pad8[HD644232_REG_OFFSET]; + UCHAR vnr; + UCHAR pad9[HD644232_REG_OFFSET]; + UCHAR tmr; + UCHAR pad10[HD644232_REG_OFFSET]; + UCHAR imr; + UCHAR pad11[HD644232_REG_OFFSET]; + UCHAR irr; + UCHAR pad12[HD644232_REG_OFFSET]; + UCHAR bmr; + UCHAR pad13[HD644232_REG_OFFSET]; + UCHAR brr; + } IRC; +#endif /* _ASMLANGUAGE */ + +/* Local Interrupt Request */ +#define IRC_LIR0 0x01 +#define IRC_LIR1 0x02 +#define IRC_LIR2 0x04 +#define IRC_LIR3 0x08 +#define IRC_LIR4 0x10 +#define IRC_LIR5 0x20 +#define IRC_LIR6 0x40 + +/* default values */ +#define IRC_VMR_AUTOVEC 0xff +#define IRC_TMR_EDGE 0xff +#define IRC_IMR_DISABLE 0x7f +#define IRC_BMR_DISABLE 0xff +#define IRC_BMR_ENABLE 0x00 + +#ifdef __cplusplus +} +#endif + +#endif /* __INChd644232h */ diff --git a/h/drv/intrCtl/i82378Ibc.h b/h/drv/intrCtl/i82378Ibc.h new file mode 100644 index 0000000..9c910ee --- /dev/null +++ b/h/drv/intrCtl/i82378Ibc.h @@ -0,0 +1,105 @@ +/* i82378.h - i82378 IBC (ISA Bridge Controller) driver */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,30oct96,tam added IBC_READ_BYTE and IBC_WRITE_BYTE definitions (spr #7415). +01b,11oct96,tam added _ASMLANGUAGE conditional. +01a,29jan96,tam written. +*/ + +#ifndef __INCi82378Ibch +#define __INCi82378Ibch + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The macro IBC_BASE_ADRS, PIC_REG_ADDR_INTERVAL & PIT_REG_ADDR_INTERVAL + * must be defined when including this header. + */ + +/* default definitions */ + +#define CAST + +#define PIC_ADRS(base,reg) (CAST (base+(reg*PIC_REG_ADDR_INTERVAL))) + +/* register definitions */ + +#define PIC_port1(base) PIC_ADRS(base,0x00) /* port 1. */ +#define PIC_port2(base) PIC_ADRS(base,0x01) /* port 2. */ + +/* hardware register access macros */ + +#ifndef IBC_BYTE_READ /* reads IBC register */ +# define IBC_BYTE_READ(addr,pData) (*pData = *(UCHAR *)(addr)) +#endif + +#ifndef IBC_BYTE_WRITE /* write to IBC register */ +# define IBC_BYTE_WRITE(addr,data) *(UCHAR *)(addr) = (data); EIEIO +#endif + +/* alias */ + +#define PIC_IMASK(base) PIC_port2(base) /* Interrupt mask. */ +#define PIC_IACK(base) PIC_port1(base) /* Interrupt acknowledge. */ + +#define PIC_ISR_MASK(base) PIC_port1(base) /* in-service register mask */ +#define PIC_IRR_MASK(base) PIC_port1(base) /* interrupt request reg */ + +#define OCW3_DEF 0x08 /* 3rd default control word */ +#define OCW3_PCB 0x04 /* Polling Control Bit */ +#define OCW3_ISR 0x03 /* Read in-service reg */ +#define OCW3_IRR 0x02 /* Read inter request reg */ + + +#define ISA_INTR_ACK_REG (CPU_PCI_IACK_ADRS + 0x1ff0) + +#define i82378_INT1_CTRL (IBC_BASE_ADRS + 0x0020) /* pic1 82378 */ +#define i82378_INT1_MASK (IBC_BASE_ADRS + 0x0021) +#define i82378_INT1_ELC (IBC_BASE_ADRS + 0x04d0) +#define i82378_INT2_CTRL (IBC_BASE_ADRS + 0x00a0) /* pic2 82378 */ +#define i82378_INT2_MASK (IBC_BASE_ADRS + 0x00a1) +#define i82378_INT2_ELC (IBC_BASE_ADRS + 0x04d1) +#define i82378_TMR1_CNT0 (IBC_BASE_ADRS + 0x0040) /* timer */ +#define i82378_TMR1_CNT1 (IBC_BASE_ADRS + 0x0041) +#define i82378_TMR1_CNT2 (IBC_BASE_ADRS + 0x0042) +#define i82378_TMR1_CMOD (IBC_BASE_ADRS + 0x0043) +#define i82378_RST_IRQ12 (IBC_BASE_ADRS + 0x0060) +#define i82378_NMI_SCTRL (IBC_BASE_ADRS + 0x0061) +#define i82378_PCOP (IBC_BASE_ADRS + 0x0c04) +#define i82378_TMCP (IBC_BASE_ADRS + 0x0c01) + +/* programmable interrupt controller (PIC) */ + +#define PIC1_BASE_ADR i82378_INT1_CTRL +#define PIC2_BASE_ADR i82378_INT2_CTRL + +/* programmable interrupt timers */ + +#define PIT_BASE_ADR i82378_TMR1_CNT0 /* timeraddrs */ +#define PIT_CLOCK 1193180 + + +/* typedefs */ + +#ifndef _ASMLANGUAGE + +typedef struct intHandlerDesc /* interrupt handler desciption */ + { + VOIDFUNCPTR vec; /* interrupt vector */ + int arg; /* interrupt handler argument */ + struct intHandlerDesc * next; /* next interrupt handler & argument */ + } INT_HANDLER_DESC; + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCi82378Ibch */ diff --git a/h/drv/intrCtl/i8259.h b/h/drv/intrCtl/i8259.h new file mode 100644 index 0000000..7c77eff --- /dev/null +++ b/h/drv/intrCtl/i8259.h @@ -0,0 +1,96 @@ +/* i8259.h - Intel 8259a PIC (Programmable Interrupt Controller) */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,23apr02,hdn added prototypes for new BOI/EOI rtn (spr 76411) +01g,08mar02,hdn added prototype i8259Init() for HTT (spr 73738) +01f,28may97,hdn copied i8259a.h to i8259.h for APIC support. +01e,17mar97,hdn added function declarations. +01d,03jan95,vin added PIC_ISR_MASK, PIC_IRR_MASK, OCW3 +01c,16aug93,hdn deleted PIC_BASE_ADRS macros. +01b,16jun93,hdn updated to 5.1. +01a,15may92,hdn written. +*/ + +#ifndef __INCi8259h +#define __INCi8259h + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The macro PIC_REG_ADDR_INTERVAL must be defined + * when including this header. + */ + +/* default definitions */ + +#define CAST + +#define PIC_ADRS(base,reg) (CAST (base+(reg*PIC_REG_ADDR_INTERVAL))) + +/* register definitions */ + +#define PIC_port1(base) PIC_ADRS(base,0x00) /* port 1. */ +#define PIC_port2(base) PIC_ADRS(base,0x01) /* port 2. */ + +/* alias */ + +#define PIC_IMASK(base) PIC_port2(base) /* Interrupt mask. */ +#define PIC_IACK(base) PIC_port1(base) /* Interrupt acknowledge. */ + +#define PIC_ISR_MASK(base) PIC_port1(base) /* in-service register mask */ +#define PIC_IRR_MASK(base) PIC_port1(base) /* interrupt request reg */ + +#define OCW3_DEF 0x08 /* 3rd default control word */ +#define OCW3_PCB 0x04 /* Polling Control Bit */ +#define OCW3_ISR 0x03 /* Read in-service reg */ +#define OCW3_IRR 0x02 /* Read inter request reg */ + +#define I8259_EOI 0x20 /* EOI bit in OCW2 */ + +#ifndef _ASMLANGUAGE + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT VOID i8259Init (void); +IMPORT int sysIntLevel (int arg); +IMPORT VOID sysIntLock (void); +IMPORT VOID sysIntUnlock (void); +IMPORT VOID i8259IntBoi (int irqNo); +IMPORT VOID i8259IntBoiEem (int irqNo); +IMPORT VOID i8259IntBoiSmm (int irqNo); +IMPORT VOID i8259IntEoiSmm (int irqNo); +IMPORT VOID i8259IntEoiMaster (int irqNo); +IMPORT VOID i8259IntEoiSlave (int irqNo); +IMPORT VOID i8259IntEoiSlaveNfnm (int irqNo); +IMPORT VOID i8259IntEoiSlaveSfnm (int irqNo); + +#else + +IMPORT VOID i8259Init (); +IMPORT int sysIntLevel (); +IMPORT VOID sysIntLock (); +IMPORT VOID sysIntUnlock (); +IMPORT VOID i8259IntBoi (); +IMPORT VOID i8259IntBoiEem (); +IMPORT VOID i8259IntBoiSmm (); +IMPORT VOID i8259IntEoiSmm (); +IMPORT VOID i8259IntEoiMaster (); +IMPORT VOID i8259IntEoiSlave (); +IMPORT VOID i8259IntEoiSlaveNfnm (); +IMPORT VOID i8259IntEoiSlaveSfnm (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCi8259h */ diff --git a/h/drv/intrCtl/i8259a.h b/h/drv/intrCtl/i8259a.h new file mode 100644 index 0000000..7da3051 --- /dev/null +++ b/h/drv/intrCtl/i8259a.h @@ -0,0 +1,73 @@ +/* i8259a.h - Intel 8259a PIC (Programmable Interrupt Controller) */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,17mar97,hdn added function declarations. +01d,03jan95,vin added PIC_ISR_MASK, PIC_IRR_MASK, OCW3 +01c,16aug93,hdn deleted PIC_BASE_ADRS macros. +01b,16jun93,hdn updated to 5.1. +01a,15may92,hdn written. +*/ + +#ifndef __INCi8259ah +#define __INCi8259ah + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The macro PIC_REG_ADDR_INTERVAL must be defined + * when including this header. + */ + +/* default definitions */ + +#define CAST + +#define PIC_ADRS(base,reg) (CAST (base+(reg*PIC_REG_ADDR_INTERVAL))) + +/* register definitions */ + +#define PIC_port1(base) PIC_ADRS(base,0x00) /* port 1. */ +#define PIC_port2(base) PIC_ADRS(base,0x01) /* port 2. */ + +/* alias */ + +#define PIC_IMASK(base) PIC_port2(base) /* Interrupt mask. */ +#define PIC_IACK(base) PIC_port1(base) /* Interrupt acknowledge. */ + +#define PIC_ISR_MASK(base) PIC_port1(base) /* in-service register mask */ +#define PIC_IRR_MASK(base) PIC_port1(base) /* interrupt request reg */ + +#define OCW3_DEF 0x08 /* 3rd default control word */ +#define OCW3_PCB 0x04 /* Polling Control Bit */ +#define OCW3_ISR 0x03 /* Read in-service reg */ +#define OCW3_IRR 0x02 /* Read inter request reg */ + +#ifndef _ASMLANGUAGE + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT int sysIntLevel (void); +IMPORT VOID sysIntLock (void); +IMPORT VOID sysIntUnlock (void); + +#else + +IMPORT int sysIntLevel (); +IMPORT VOID sysIntLock (); +IMPORT VOID sysIntUnlock (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCi8259ah */ diff --git a/h/drv/intrCtl/ioApic.h b/h/drv/intrCtl/ioApic.h new file mode 100644 index 0000000..d35024a --- /dev/null +++ b/h/drv/intrCtl/ioApic.h @@ -0,0 +1,114 @@ +/* ioApic.h - Intel IO APIC/xAPIC (Advanced PIC) */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,15may02,hdn removed ifdef for IOAPIC_DATA +01d,08mar02,hdn added prototypes for HTT (spr 73738) +01c,26jun01,hdn added support for Pentium4 IO xAPIC +01b,25may98,hdn re-written +01a,30jun97,sub written +*/ + +#ifndef __INCioApich +#define __INCioApich + +#ifdef __cplusplus +extern "C" { +#endif + + +/* IO APIC direct register offset */ + +#define IOAPIC_DATA 0x10 /* IO window (data) - pc.h */ +#define IOAPIC_IRQPA 0x20 /* IRQ Pin Assertion Register */ +#define IOAPIC_EOI 0x40 /* EOI Register */ + +/* IO APIC indirect register offset */ + +#define IOAPIC_ID 0x00 /* IOAPIC ID */ +#define IOAPIC_VERS 0x01 /* IOAPIC Version */ +#define IOAPIC_ARB 0x02 /* IOAPIC Arbitration ID */ +#define IOAPIC_BOOT 0x03 /* IOAPIC Boot Configuration */ +#define IOAPIC_REDTBL 0x10 /* Redirection Table (24 * 64bit) */ + +/* Interrupt delivery type */ + +#define IOAPIC_DT_APIC 0x0 /* APIC serial bus */ +#define IOAPIC_DT_FS 0x1 /* Front side bus message*/ + +/* Version register bits */ + +#define IOAPIC_MRE_MASK 0x00ff0000 /* Max Red. entry mask */ +#define IOAPIC_PRQ 0x00008000 /* this has IRQ reg */ +#define IOAPIC_VERSION 0x000000ff /* version number */ + +/* Redirection table entry number */ + +#define MAX_REDTABLE_ENTRIES 32 + +/* Redirection table entry bits: upper 32 bit */ + +#define IOAPIC_DESTINATION 0xff000000 + +/* Redirection table entry bits: lower 32 bit */ + +#define IOAPIC_INT_MASK 0x00010000 +#define IOAPIC_LEVEL 0x00008000 +#define IOAPIC_EDGE 0x00000000 +#define IOAPIC_REMOTE 0x00004000 +#define IOAPIC_LOW 0x00002000 +#define IOAPIC_HIGH 0x00000000 +#define IOAPIC_LOGICAL 0x00000800 +#define IOAPIC_PHYSICAL 0x00000000 +#define IOAPIC_FIXED 0x00000000 +#define IOAPIC_LOWEST 0x00000100 +#define IOAPIC_SMI 0x00000200 +#define IOAPIC_NMI 0x00000400 +#define IOAPIC_INIT 0x00000500 +#define IOAPIC_EXTINT 0x00000700 +#define IOAPIC_VEC_MASK 0x000000ff + + +#ifndef _ASMLANGUAGE + + +/* variable declarations */ + +IMPORT UINT32 ioApicVersion; +IMPORT UINT32 ioApicRedEntries; + + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT STATUS ioApicInit (void); +IMPORT VOID ioApicEnable (BOOL enable); +IMPORT STATUS ioApicIrqSet (INT32 irq, INT32 apicId); +IMPORT STATUS ioApicRedGet (INT32 irq, INT32 * pUpper32, INT32 * pLower32); +IMPORT STATUS ioApicRedSet (INT32 irq, INT32 upper32, INT32 lower32); +IMPORT INT32 ioApicGet (UINT32 index, UINT32 data, INT32 offset); +IMPORT void ioApicSet (UINT32 index, UINT32 data, INT32 offset, INT32 value); + +#else + +IMPORT STATUS ioApicInit (); +IMPORT VOID ioApicEnable (); +IMPORT STATUS ioApicIrqSet (); +IMPORT STATUS ioApicRedGet (); +IMPORT STATUS ioApicRedSet (); +IMPORT INT32 ioApicGet (); +IMPORT void ioApicSet (); + +#endif /* __STDC__ */ + + +#endif /* _ASMLANGUAGE */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCioApich */ diff --git a/h/drv/intrCtl/ixp400IntrCtl.h b/h/drv/intrCtl/ixp400IntrCtl.h new file mode 100644 index 0000000..addf02a --- /dev/null +++ b/h/drv/intrCtl/ixp400IntrCtl.h @@ -0,0 +1,319 @@ +/* ixp400IntrCtl.h - interrupt controller driver Ixp400 */ + +/* +Copyright (c) 2002-2004 Wind River Systems, Inc. All rights reserved. +Certain portions of these files may be copyright (c) 2002-2004 Intel +Corporation. +*/ + +/* +modification history +-------------------- +01d,24aug05,m_h interrupt controller for ixdp465 and related XSCALE BSPs +01c,20dec04,pai Updated copyright notice. +01b,24jul03,m_h PSM now named NPE +01a,05jun02,jb initial version... +*/ + +#ifndef __INCixp400IntrCtlh +#define __INCixp400IntrCtlh + +#include "ixp400.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* typedefs */ + +#ifndef _ASMLANGUAGE +#endif /* _ASMLANGUAGE */ + + +/* macros to convert interrupt vectors <-> interrupt numbers */ + +#ifdef IVEC_TO_INUM +#undef IVEC_TO_INUM +#endif +#define IVEC_TO_INUM(intVec) ((int) (intVec)) + +#ifdef INUM_TO_IVEC +#undef INUM_TO_IVEC +#endif +#define INUM_TO_IVEC(intNum) ((VOIDFUNCPTR *) (intNum)) + +/* + * Define Ixp400 Interrupt registers + */ +/****************************************************************** + + Interrupt Controller Register Definitions. + +******************************************************************/ + +#define IXP400_ICPR ( IXP400_INTC_BASE + 0x0 ) /* Interrupt Status Reg. */ +#define IXP400_ICMR ( IXP400_INTC_BASE + 0x4 ) /* Interrupt Enable Reg. */ +#define IXP400_ICLR ( IXP400_INTC_BASE + 0x8 ) /* Interrupt Select Reg IRQ/FIQ */ +#define IXP400_ICIP ( IXP400_INTC_BASE + 0xC ) /* IRQ Status Reg. */ +#define IXP400_ICFP ( IXP400_INTC_BASE + 0x10 ) /* FIQ Status Reg. */ +#define IXP400_ICHR ( IXP400_INTC_BASE + 0x14 ) /* Interrupt Priority Reg. */ +#define IXP400_ICIH ( IXP400_INTC_BASE + 0x18 ) /* IRQ Highest Pri Int Reg. */ +#define IXP400_ICFH ( IXP400_INTC_BASE + 0x1C ) /* FIQ Highest Pri Int Reg. */ + + +/* the following register are for handling INTR 31-63 */ +#ifdef IX_DEVICE_IXP465 +#define IXP400_ICPR_UPPER ( IXP400_INTC_BASE + 0x20 ) /* Interrupt Status Reg. #2 */ +#define IXP400_ICMR_UPPER ( IXP400_INTC_BASE + 0x24 ) /* Interrupt Enable Reg. #2 */ +#define IXP400_ICLR_UPPER ( IXP400_INTC_BASE + 0x28 ) /* Interrupt Select Reg IRQ/FIQ #2 */ +#define IXP400_ICIP_UPPER ( IXP400_INTC_BASE + 0x2C ) /* IRQ Status Reg. #2 */ +#define IXP400_ICFP_UPPER ( IXP400_INTC_BASE + 0x30 ) /* FIQ Status Reg. #2 */ + +#define IXP400_ERROR_EN2 ( IXP400_INTC_BASE + 0x34 ) /* for interrupts 31-63, error priority enable */ + /* used to raise priority above all others */ +#endif + + + +#define IXP400_INT_LVL_NPEA (0) +#define IXP400_INT_LVL_NPEB (1) +#define IXP400_INT_LVL_NPEC (2) +#define IXP400_INT_LVL_QM1 (3) +#define IXP400_INT_LVL_QM2 (4) +#define IXP400_INT_LVL_TIMER1 (5) +#define IXP400_INT_LVL_GPIO0 (6) +#define IXP400_INT_LVL_GPIO1 (7) +#define IXP400_INT_LVL_PCI_INT (8) +#define IXP400_INT_LVL_PCI_DMA1 (9) +#define IXP400_INT_LVL_PCI_DMA2 (10) +#define IXP400_INT_LVL_TIMER2 (11) +#define IXP400_INT_LVL_USB (12) +#define IXP400_INT_LVL_UART2 (13) +#define IXP400_INT_LVL_TIMESTAMP (14) +#define IXP400_INT_LVL_UART1 (15) +#define IXP400_INT_LVL_WDOG (16) +#define IXP400_INT_LVL_AHB_PMU (17) +#define IXP400_INT_LVL_XSCALE_PMU (18) +#define IXP400_INT_LVL_GPIO2 (19) +#define IXP400_INT_LVL_GPIO3 (20) +#define IXP400_INT_LVL_GPIO4 (21) +#define IXP400_INT_LVL_GPIO5 (22) +#define IXP400_INT_LVL_GPIO6 (23) +#define IXP400_INT_LVL_GPIO7 (24) +#define IXP400_INT_LVL_GPIO8 (25) +#define IXP400_INT_LVL_GPIO9 (26) +#define IXP400_INT_LVL_GPIO10 (27) +#define IXP400_INT_LVL_GPIO11 (28) +#define IXP400_INT_LVL_GPIO12 (29) +#define IXP400_INT_LVL_INT1 (30) +#define IXP400_INT_LVL_INT2 (31) + + +#ifdef IX_DEVICE_IXP465 +#define IXP400_INT_LVL_USB_HOST (32) +#define IXP400_INT_LVL_I2C (33) +#define IXP400_INT_LVL_SSP (34) +#define IXP400_INT_LVL_TSYNC (35) +#define IXP400_INT_LVL_EAU_DONE (36) +#define IXP400_INT_LVL_SHA_HASHING_DONE (37) +#define IXP400_INT_LVL_RSVD_38 (38) +#define IXP400_INT_LVL_RSVD_39 (39) +#define IXP400_INT_LVL_RSVD_40 (40) +#define IXP400_INT_LVL_RSVD_41 (41) +#define IXP400_INT_LVL_RSVD_42 (42) +#define IXP400_INT_LVL_RSVD_43 (43) +#define IXP400_INT_LVL_RSVD_44 (44) +#define IXP400_INT_LVL_RSVD_45 (45) +#define IXP400_INT_LVL_RSVD_46 (46) +#define IXP400_INT_LVL_RSVD_47 (47) +#define IXP400_INT_LVL_RSVD_48 (48) +#define IXP400_INT_LVL_RSVD_49 (49) +#define IXP400_INT_LVL_RSVD_50 (50) +#define IXP400_INT_LVL_RSVD_51 (51) +#define IXP400_INT_LVL_RSVD_52 (52) +#define IXP400_INT_LVL_RSVD_53 (53) +#define IXP400_INT_LVL_RSVD_54 (54) +#define IXP400_INT_LVL_RSVD_55 (55) +#define IXP400_INT_LVL_RSVD_56 (56) +#define IXP400_INT_LVL_RSVD_57 (57) +#define IXP400_INT_LVL_SWCP (58) +#define IXP400_INT_LVL_RSVD_59 (59) +#define IXP400_INT_LVL_AQM (60) +#define IXP400_INT_LVL_MCU (61) +#define IXP400_INT_LVL_EBC (62) +#define IXP400_INT_LVL_RSVD_63 (63) +#endif + +/* Bit definitions for Interrupt Pending/Mask/Status registers */ + +#define IXP400_INTC_NPEA (1 << IXP400_INT_LVL_NPEA) +#define IXP400_INTC_NPEB (1 << IXP400_INT_LVL_NPEB) +#define IXP400_INTC_NPEC (1 << IXP400_INT_LVL_NPEC) +#define IXP400_INTC_QM1 (1 << IXP400_INT_LVL_QM1) +#define IXP400_INTC_QM2 (1 << IXP400_INT_LVL_QM2) +#define IXP400_INTC_TIMER1 (1 << IXP400_INT_LVL_TIMER1) +#define IXP400_INTC_GPIO0 (1 << IXP400_INT_LVL_GPIO0) +#define IXP400_INTC_GPIO1 (1 << IXP400_INT_LVL_GPIO1) +#define IXP400_INTC_PCI_INT (1 << IXP400_INT_LVL_PCI_INT) +#define IXP400_INTC_PCI_DMA1 (1 << IXP400_INT_LVL_PCI_DMA1) +#define IXP400_INTC_PCI_DMA2 (1 << IXP400_INT_LVL_PCI_DMA2) +#define IXP400_INTC_TIMER2 (1 << IXP400_INT_LVL_TIMER2) +#define IXP400_INTC_USB (1 << IXP400_INT_LVL_USB) +#define IXP400_INTC_UART2 (1 << IXP400_INT_LVL_UART2) +#define IXP400_INTC_TIMESTAMP (1 << IXP400_INT_LVL_TIMESTAMP) +#define IXP400_INTC_UART1 (1 << IXP400_INT_LVL_UART1) +#define IXP400_INTC_WDOG (1 << IXP400_INT_LVL_WDOG) +#define IXP400_INTC_AHB_PMU (1 << IXP400_INT_LVL_AHB_PMU) +#define IXP400_INTC_XSCALE_PMU (1 << IXP400_INT_LVL_XSCALE_PMU) +#define IXP400_INTC_GPIO2 (1 << IXP400_INT_LVL_GPIO2) +#define IXP400_INTC_GPIO3 (1 << IXP400_INT_LVL_GPIO3) +#define IXP400_INTC_GPIO4 (1 << IXP400_INT_LVL_GPIO4) +#define IXP400_INTC_GPIO5 (1 << IXP400_INT_LVL_GPIO5) +#define IXP400_INTC_GPIO6 (1 << IXP400_INT_LVL_GPIO6) +#define IXP400_INTC_GPIO7 (1 << IXP400_INT_LVL_GPIO7) +#define IXP400_INTC_GPIO8 (1 << IXP400_INT_LVL_GPIO8) +#define IXP400_INTC_GPIO9 (1 << IXP400_INT_LVL_GPIO9) +#define IXP400_INTC_GPIO10 (1 << IXP400_INT_LVL_GPIO10) +#define IXP400_INTC_GPIO11 (1 << IXP400_INT_LVL_GPIO11) +#define IXP400_INTC_GPIO12 (1 << IXP400_INT_LVL_GPIO12) +#define IXP400_INTC_SW_INT1 (1 << IXP400_INT_LVL_INT1) +#define IXP400_INTC_SW_INT2 (1 << IXP400_INT_LVL_INT2) + +#ifdef IX_DEVICE_IXP465 +#define IXP400_INTC_USB_HOST (1 << (IXP400_INT_LVL_USB_HOST - 32)) +#define IXP400_INTC_I2C (1 << (IXP400_INT_LVL_I2C - 32)) +#define IXP400_INTC_SSP (1 << (IXP400_INT_LVL_SSP - 32)) +#define IXP400_INTC_TSYNC (1 << (IXP400_INT_LVL_RSVD_TSYNC - 32)) +#define IXP400_INTC_EAU_DONE (1 << (IXP400_INT_LVL_RSVD_EAU_DONE - 32)) +#define IXP400_INTC_SHA_HASHING_DONE (1 << (IXP400_INT_LVL_RSVD_SHA_HASHING_DONE - 32)) +#define IXP400_INTC_RSVD_38 (1 << (IXP400_INT_LVL_RSVD_38 - 32)) +#define IXP400_INTC_RSVD_39 (1 << (IXP400_INT_LVL_RSVD_39 - 32)) +#define IXP400_INTC_RSVD_40 (1 << (IXP400_INT_LVL_RSVD_40 - 32)) +#define IXP400_INTC_RSVD_41 (1 << (IXP400_INT_LVL_RSVD_41 - 32)) +#define IXP400_INTC_RSVD_42 (1 << (IXP400_INT_LVL_RSVD_42 - 32)) +#define IXP400_INTC_RSVD_43 (1 << (IXP400_INT_LVL_RSVD_43 - 32)) +#define IXP400_INTC_RSVD_44 (1 << (IXP400_INT_LVL_RSVD_44 - 32)) +#define IXP400_INTC_RSVD_45 (1 << (IXP400_INT_LVL_RSVD_45 - 32)) +#define IXP400_INTC_RSVD_46 (1 << (IXP400_INT_LVL_RSVD_46 - 32)) +#define IXP400_INTC_RSVD_47 (1 << (IXP400_INT_LVL_RSVD_47 - 32)) +#define IXP400_INTC_RSVD_48 (1 << (IXP400_INT_LVL_RSVD_48 - 32)) +#define IXP400_INTC_RSVD_49 (1 << (IXP400_INT_LVL_RSVD_49 - 32)) +#define IXP400_INTC_RSVD_50 (1 << (IXP400_INT_LVL_RSVD_50 - 32)) +#define IXP400_INTC_RSVD_51 (1 << (IXP400_INT_LVL_RSVD_51 - 32)) +#define IXP400_INTC_RSVD_52 (1 << (IXP400_INT_LVL_RSVD_52 - 32)) +#define IXP400_INTC_RSVD_53 (1 << (IXP400_INT_LVL_RSVD_53 - 32)) +#define IXP400_INTC_RSVD_54 (1 << (IXP400_INT_LVL_RSVD_54 - 32)) +#define IXP400_INTC_RSVD_55 (1 << (IXP400_INT_LVL_RSVD_55 - 32)) +#define IXP400_INTC_RSVD_56 (1 << (IXP400_INT_LVL_RSVD_56 - 32)) +#define IXP400_INTC_RSVD_57 (1 << (IXP400_INT_LVL_RSVD_57 - 32)) +#define IXP400_INTC_SWCP (1 << (IXP400_INT_LVL_SWCP - 32)) +#define IXP400_INTC_RSVD_59 (1 << (IXP400_INT_LVL_RSVD_59 - 32)) +#define IXP400_INTC_AQM (1 << (IXP400_INT_LVL_AQM - 32)) +#define IXP400_INTC_MCU (1 << (IXP400_INT_LVL_MCU - 32)) +#define IXP400_INTC_EBC (1 << (IXP400_INT_LVL_EBC - 32)) +#define IXP400_INTC_RSVD_63 (1 << (IXP400_INT_LVL_RSVD_63 - 32)) +#endif + + + + +/* Vector definitions */ +#define IXP400_INT_NUM_LEVELS_LOWER (32) + +#if IX_DEVICE_IXP465 +#define IXP400_INT_NUM_LEVELS (64) +#else +#define IXP400_INT_NUM_LEVELS (IXP400_INT_NUM_LEVELS_LOWER) +#endif + + +#define IXP400_INT_MODE INT_NON_PREEMPT_MODEL + + +#define INT_VEC_NPEA IVEC_TO_INUM(IXP400_INT_LVL_NPEA) +#define INT_VEC_NPEB IVEC_TO_INUM(IXP400_INT_LVL_NPEB) +#define INT_VEC_NPEC IVEC_TO_INUM(IXP400_INT_LVL_NPEC) +#define INT_VEC_QM1 IVEC_TO_INUM(IXP400_INT_LVL_QM1 ) +#define INT_VEC_QM2 IVEC_TO_INUM(IXP400_INT_LVL_QM2 ) +#define INT_VEC_TIMER1 IVEC_TO_INUM(IXP400_INT_LVL_TIMER1) +#define INT_VEC_GPIO0 IVEC_TO_INUM(IXP400_INT_LVL_GPIO0) +#define INT_VEC_GPIO1 IVEC_TO_INUM(IXP400_INT_LVL_GPIO1) +#define INT_VEC_PCI IVEC_TO_INUM(IXP400_INT_LVL_PCI) +#define INT_VEC_PCI_DMA1 IVEC_TO_INUM(IXP400_INT_LVL_PCI_DMA1) +#define INT_VEC_PCI_DMA2 IVEC_TO_INUM(IXP400_INT_LVL_PCI_DMA2) +#define INT_VEC_TIMER2 IVEC_TO_INUM(IXP400_INT_LVL_TIMER2) +#define INT_VEC_APB_DMA IVEC_TO_INUM(IXP400_INT_LVL_APB_DMA) +#define INT_VEC_USB IVEC_TO_INUM(IXP400_INT_LVL_USB) +#define INT_VEC_UART1 IVEC_TO_INUM(IXP400_INT_LVL_UART1) +#define INT_VEC_TIMESTAMP IVEC_TO_INUM(IXP400_INT_LVL_TIMESTAMP) +#define INT_VEC_UART2 IVEC_TO_INUM(IXP400_INT_LVL_UART2) +#define INT_VEC_WDOG IVEC_TO_INUM(IXP400_INT_LVL_WDOG) +#define INT_VEC_AHB_PMU IVEC_TO_INUM(IXP400_INT_LVL_AHB_PMU) +#define INT_VEC_XSCALE_PMU IVEC_TO_INUM(IXP400_INT_LVL_XSCALE_PMU) +#define INT_VEC_GPIO2 IVEC_TO_INUM(IXP400_INT_LVL_GPIO2) +#define INT_VEC_GPIO3 IVEC_TO_INUM(IXP400_INT_LVL_GPIO3) +#define INT_VEC_GPIO4 IVEC_TO_INUM(IXP400_INT_LVL_GPIO4) +#define INT_VEC_GPIO5 IVEC_TO_INUM(IXP400_INT_LVL_GPIO5) +#define INT_VEC_GPIO6 IVEC_TO_INUM(IXP400_INT_LVL_GPIO6) +#define INT_VEC_GPIO7 IVEC_TO_INUM(IXP400_INT_LVL_GPIO7) +#define INT_VEC_GPIO8 IVEC_TO_INUM(IXP400_INT_LVL_GPIO8) +#define INT_VEC_GPIO9 IVEC_TO_INUM(IXP400_INT_LVL_GPIO9) +#define INT_VEC_GPIO10 IVEC_TO_INUM(IXP400_INT_LVL_GPIO10) +#define INT_VEC_GPIO11 IVEC_TO_INUM(IXP400_INT_LVL_GPIO11) +#define INT_VEC_GPIO12 IVEC_TO_INUM(IXP400_INT_LVL_GPIO12) +#define INT_VEC_INT1 IVEC_TO_INUM(IXP400_INT_LVL_INT1) +#define INT_VEC_INT2 IVEC_TO_INUM(IXP400_INT_LVL_INT2) + + +#if IX_DEVICE_IXP465 +#define INT_VEC_USB_HOST IVEC_TO_INUM(IXP400_INT_LVL_USB_HOST) +#define INT_VEC_I2C IVEC_TO_INUM(IXP400_INT_LVL_I2C) +#define INT_VEC_SSP IVEC_TO_INUM(IXP400_INT_LVL_SSP) +#define INT_VEC_TSYNC IVEC_TO_INUM(IXP400_INT_LVL_TSYNC) +#define INT_VEC_EAU_DONE IVEC_TO_INUM(IXP400_INT_LVL_EAU_DONE) +#define INT_VEC_SHA_HASHING_DONE IVEC_TO_INUM(IXP400_INT_LVL_SHA_HASHING_DONE) +#define INT_VEC_RSVD_38 IVEC_TO_INUM(IXP400_INT_LVL_RSVD_38) +#define INT_VEC_RSVD_39 IVEC_TO_INUM(IXP400_INT_LVL_RSVD_39) +#define INT_VEC_RSVD_40 IVEC_TO_INUM(IXP400_INT_LVL_RSVD_40) +#define INT_VEC_RSVD_41 IVEC_TO_INUM(IXP400_INT_LVL_RSVD_41) +#define INT_VEC_RSVD_42 IVEC_TO_INUM(IXP400_INT_LVL_RSVD_42) +#define INT_VEC_RSVD_43 IVEC_TO_INUM(IXP400_INT_LVL_RSVD_43) +#define INT_VEC_RSVD_44 IVEC_TO_INUM(IXP400_INT_LVL_RSVD_44) +#define INT_VEC_RSVD_45 IVEC_TO_INUM(IXP400_INT_LVL_RSVD_45) +#define INT_VEC_RSVD_46 IVEC_TO_INUM(IXP400_INT_LVL_RSVD_46) +#define INT_VEC_RSVD_47 IVEC_TO_INUM(IXP400_INT_LVL_RSVD_47) +#define INT_VEC_RSVD_48 IVEC_TO_INUM(IXP400_INT_LVL_RSVD_48) +#define INT_VEC_RSVD_49 IVEC_TO_INUM(IXP400_INT_LVL_RSVD_49) +#define INT_VEC_RSVD_50 IVEC_TO_INUM(IXP400_INT_LVL_RSVD_50) +#define INT_VEC_RSVD_51 IVEC_TO_INUM(IXP400_INT_LVL_RSVD_51) +#define INT_VEC_RSVD_52 IVEC_TO_INUM(IXP400_INT_LVL_RSVD_52) +#define INT_VEC_RSVD_53 IVEC_TO_INUM(IXP400_INT_LVL_RSVD_53) +#define INT_VEC_RSVD_54 IVEC_TO_INUM(IXP400_INT_LVL_RSVD_54) +#define INT_VEC_RSVD_55 IVEC_TO_INUM(IXP400_INT_LVL_RSVD_55) +#define INT_VEC_RSVD_56 IVEC_TO_INUM(IXP400_INT_LVL_RSVD_56) +#define INT_VEC_RSVD_57 IVEC_TO_INUM(IXP400_INT_LVL_RSVD_57) +#define INT_VEC_SWCP IVEC_TO_INUM(IXP400_INT_LVL_SWCP) +#define INT_VEC_RSVD_59 IVEC_TO_INUM(IXP400_INT_LVL_RSVD_59) +#define INT_VEC_AQM IVEC_TO_INUM(IXP400_INT_LVL_AQM) +#define INT_VEC_MCU IVEC_TO_INUM(IXP400_INT_LVL_MCU) +#define INT_VEC_EBC IVEC_TO_INUM(IXP400_INT_LVL_EBC) +#define INT_VEC_RSVD_63 IVEC_TO_INUM(IXP400_INT_LVL_RSVD_63) +#endif + + + + +/* + * Set the default value of ICHP - Interrupt highest priorty encoding register. + */ +#ifndef IXP400_ICHR_INIT_VALUE +#define IXP400_ICHR_INIT_VALUE (0x00fac688) +#endif + + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCIxp400IntrCtrl */ diff --git a/h/drv/intrCtl/loApic.h b/h/drv/intrCtl/loApic.h new file mode 100644 index 0000000..87bc712 --- /dev/null +++ b/h/drv/intrCtl/loApic.h @@ -0,0 +1,227 @@ +/* loApic.h - Intel Pentium[234] Local APIC/xAPIC (Advanced PIC) */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,08mar02,hdn added prototypes for HTT (spr 73738) +01c,21jun01,hdn added support for Pentium4 Local xAPIC +01b,25may98,hdn re-written +01a,26jun97,sub written +*/ + +#ifndef __INCloApich +#define __INCloApich + +#ifdef __cplusplus +extern "C" { +#endif + +/* Local APIC Register Offset */ + +#define LOAPIC_ID 0x020 /* Local APIC ID Reg */ +#define LOAPIC_VER 0x030 /* Local APIC Version Reg */ +#define LOAPIC_TPR 0x080 /* Task Priority Reg */ +#define LOAPIC_APR 0x090 /* Arbitration Priority Reg */ +#define LOAPIC_PPR 0x0a0 /* Processor Priority Reg */ +#define LOAPIC_EOI 0x0b0 /* EOI Reg */ +#define LOAPIC_LDR 0x0d0 /* Logical Destination Reg */ +#define LOAPIC_DFR 0x0e0 /* Destination Format Reg */ +#define LOAPIC_SVR 0x0f0 /* Spurious Interrupt Reg */ +#define LOAPIC_ISR 0x100 /* In-service Reg */ +#define LOAPIC_TMR 0x180 /* Trigger Mode Reg */ +#define LOAPIC_IRR 0x200 /* Interrupt Request Reg */ +#define LOAPIC_ESR 0x280 /* Error Status Reg */ +#define LOAPIC_ICRLO 0x300 /* Interrupt Command Reg */ +#define LOAPIC_ICRHI 0x310 /* Interrupt Command Reg */ +#define LOAPIC_TIMER 0x320 /* LVT (Timer) */ +#define LOAPIC_THERMAL 0x330 /* LVT (Thermal) */ +#define LOAPIC_PMC 0x340 /* LVT (PMC) */ +#define LOAPIC_LINT0 0x350 /* LVT (LINT0) */ +#define LOAPIC_LINT1 0x360 /* LVT (LINT1) */ +#define LOAPIC_ERROR 0x370 /* LVT (ERROR) */ +#define LOAPIC_TIMER_ICR 0x380 /* Timer Initial Count Reg */ +#define LOAPIC_TIMER_CCR 0x390 /* Timer Current Count Reg */ +#define LOAPIC_TIMER_CONFIG 0x3e0 /* Timer Divide Config Reg */ + +/* IA32_APIC_BASE MSR Bits */ + +#define LOAPIC_BASE_MASK 0xfffff000 /* LO APIC Base Addr mask */ +#define LOAPIC_GLOBAL_ENABLE 0x00000800 /* LO APIC Global Enable */ +#define LOAPIC_BSP 0x00000100 /* LO APIC BSP */ + +/* Local APIC ID Register Bits */ + +#define LOAPIC_ID_MASK 0x0f000000 /* LO APIC ID mask */ + +/* Local APIC Version Register Bits */ + +#define LOAPIC_VERSION_MASK 0x000000ff /* LO APIC Version mask */ +#define LOAPIC_MAXLVT_MASK 0x00ff0000 /* LO APIC Max LVT mask */ +#define LOAPIC_PENTIUM4 0x00000014 /* LO APIC in Pentium4 */ +#define LOAPIC_LVT_PENTIUM4 5 /* LO APIC LVT - Pentium4 */ +#define LOAPIC_LVT_P6 4 /* LO APIC LVT - P6 */ +#define LOAPIC_LVT_P5 3 /* LO APIC LVT - P5 */ + +/* Local APIC Vector Table Bits */ + +#define LOAPIC_VECTOR 0x000000ff /* vectorNo */ +#define LOAPIC_MODE 0x00000700 /* delivery mode */ +#define LOAPIC_FIXED 0x00000000 /* delivery mode: FIXED */ +#define LOAPIC_SMI 0x00000200 /* delivery mode: SMI */ +#define LOAPIC_NMI 0x00000400 /* delivery mode: NMI */ +#define LOAPIC_EXT 0x00000700 /* delivery mode: ExtINT */ +#define LOAPIC_IDLE 0x00000000 /* delivery status: Idle */ +#define LOAPIC_PEND 0x00001000 /* delivery status: Pend */ +#define LOAPIC_HIGH 0x00000000 /* polarity: High */ +#define LOAPIC_LOW 0x00002000 /* polarity: Low */ +#define LOAPIC_REMOTE 0x00004000 /* remote IRR */ +#define LOAPIC_EDGE 0x00000000 /* trigger mode: Edge */ +#define LOAPIC_LEVEL 0x00008000 /* trigger mode: Level */ +#define LOAPIC_MASK 0x00010000 /* mask */ + +/* Local APIC Spurious-Interrupt Register Bits */ + +#define LOAPIC_ENABLE 0x100 /* APIC Enabled */ +#define LOAPIC_FOCUS_DISABLE 0x200 /* Focus Processor Checking */ + +/* Local APIC Timer Bits */ + +#define LOAPIC_TIMER_DIVBY_2 0x0 /* Divide by 2 */ +#define LOAPIC_TIMER_DIVBY_4 0x1 /* Divide by 4 */ +#define LOAPIC_TIMER_DIVBY_8 0x2 /* Divide by 8 */ +#define LOAPIC_TIMER_DIVBY_16 0x3 /* Divide by 16 */ +#define LOAPIC_TIMER_DIVBY_32 0x8 /* Divide by 32 */ +#define LOAPIC_TIMER_DIVBY_64 0x9 /* Divide by 64 */ +#define LOAPIC_TIMER_DIVBY_128 0xa /* Divide by 128 */ +#define LOAPIC_TIMER_DIVBY_1 0xb /* Divide by 1 */ +#define LOAPIC_TIMER_DIVBY_MASK 0xf /* mask bits */ +#define LOAPIC_TIMER_PERIODIC 0x00020000 /* Timer Mode: Periodic */ + +/* Local Vector's lock-unlock macro used in loApicIntLock/Unlock */ + +#define LOCKED_TIMER 0x01 +#define LOCKED_PMC 0x02 +#define LOCKED_LINT0 0x04 +#define LOCKED_LINT1 0x08 +#define LOCKED_ERROR 0x10 +#define LOCKED_THERMAL 0x20 + +/* Interrupt Command Register: delivery mode and status */ + +#define MODE_FIXED 0x0 /* delivery mode: Fixed */ +#define MODE_LOWEST 0x1 /* delivery mode: Lowest */ +#define MODE_SMI 0x2 /* delivery mode: SMI */ +#define MODE_NMI 0x4 /* delivery mode: NMI */ +#define MODE_INIT 0x5 /* delivery mode: INIT */ +#define MODE_STARTUP 0x6 /* delivery mode: StartUp */ +#define STATUS_PEND 0x1000 /* delivery status: Pend */ + +/* MP Configuration Table Entries */ + +#define MP_ENTRY_CPU 0 /* Entry Type: CPU */ +#define MP_ENTRY_BUS 1 /* Entry Type: BUS */ +#define MP_ENTRY_IOAPIC 2 /* Entry Type: IO APIC */ +#define MP_ENTRY_IOINTERRUPT 3 /* Entry Type: IO INT */ +#define MP_ENTRY_LOINTERRUPT 4 /* Entry Type: LO INT */ + +/* MP Configuration Table CPU Flags */ + +#define MP_CPU_FLAGS_BP 0x02 + +/* IMCR related bits */ + +#define IMCR_ADRS 0x22 /* IMCR addr reg */ +#define IMCR_DATA 0x23 /* IMCR data reg */ +#define IMCR_REG_SEL 0x70 /* IMCR reg select */ +#define IMCR_IOAPIC_ON 0x01 /* IMCR IOAPIC route enable */ +#define IMCR_IOAPIC_OFF 0x00 /* IMCR IOAPIC route disable */ + + +#ifndef _ASMLANGUAGE + +/* MultiProcessor Specification version 1.4 */ + +typedef struct /* MP Floating Pointer Structure */ + { + char signature [4]; /* "_MP_" */ + UINT32 configTableAddr; /* address of the MP configuration table */ + UINT8 length; /* length of the floating pointer structure */ + UINT8 specRev; /* version number of the MP specification */ + UINT8 cksum; /* checksum of the pointer structure */ + UINT8 featureByte[5]; /* MP feature bytes 1 - 5 */ + } MP_FPS; + +typedef struct /* MP Configuration Table Header */ + { + char mpSignature[4]; /* "PCMP" */ + UINT16 tableLength; /* length of the base configuration table */ + UINT8 specRevision; /* version number of the MP specification */ + UINT8 cksum; /* checksum of the base configuration table */ + char oemId[8]; /* string that identifies the manufacturer */ + char prodId[12]; /* string that identifies the product */ + UINT32 oemTablePtr; /* address to an OEM configuration table */ + UINT16 oemTableSize; /* size of the OEM configuration table */ + UINT16 entryCount; /* number of entries in the variable table */ + UINT32 localApicBaseAddr; /* address of the Local APIC */ + UINT16 extendedTableLength; /* length of the extended entries */ + UINT8 extendedTableCksum; /* checksum of the extended table entries */ + UINT8 reserved; + } MP_HEADER; + +typedef struct /* MP Config Table Entry for CPU's */ + { + UINT8 entryType; /* 0 identifies a processor entry */ + UINT8 localApicId; /* Local APIC ID number */ + UINT8 localApicVersion; /* Local APIC's version number */ + UINT8 cpuFlags; /* EN: usable, BP: boot-processor */ + UINT32 cpuSig; /* stepping, model, family of the CPU */ + UINT32 featureFlags; /* feature definition flag */ + UINT32 reserved[2]; + } MP_CPU; + +typedef struct /* MP Config Table Entry for IO APIC's */ + { + UINT8 entryType; /* 2 identifies an IO APIC entry */ + UINT8 ioApicId; /* ID of this IO APIC */ + UINT8 ioApicVersion; /* version of this IO APIC */ + UINT8 ioApicFlags; /* usable or not */ + UINT32 ioApicBaseAddress; /* address of this IO APIC */ + } MP_IOAPIC; + +/* variable declarations */ + +IMPORT UINT32 loApicBase; /* default Local APIC addr */ +IMPORT UINT32 ioApicBase; /* default IO APIC index addr */ +IMPORT UINT32 ioApicData; /* default IO APIC data addr */ +IMPORT UINT32 loApicId; /* local APIC Id */ +IMPORT UINT32 loApicVersion; /* local APIC Version */ +IMPORT UINT32 loApicMaxLvt; /* local APIC Max LVT */ + + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT void loApicInit (void); +IMPORT void loApicEnable (BOOL enable); +IMPORT STATUS loApicIpi (INT32 apicId, INT32 shortHand, INT32 trigger, + INT32 level, INT32 destMode, INT32 deliMode, + INT32 vectorNo); + +#else + +IMPORT void loApicInit (); +IMPORT void loApicEnable (); +IMPORT STATUS loApicIpi (); + +#endif /* __STDC__ */ + + +#endif /* _ASMLANGUAGE */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCloApich */ diff --git a/h/drv/intrCtl/m33242j.h b/h/drv/intrCtl/m33242j.h new file mode 100644 index 0000000..79cef10 --- /dev/null +++ b/h/drv/intrCtl/m33242j.h @@ -0,0 +1,80 @@ +/* m33242j.h - Mitsubishi 33242j IRC Interrupt Request Controller header file */ + +/* Copyright 1991-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01d,22sep92,rrr added support for c++ +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01a,16may91,hdn written. +*/ + +#ifndef __INCm33242jh +#define __INCm33242jh + +#ifdef __cplusplus +extern "C" { +#endif + +#define M33242J_REG_OFFSET 3 + +#ifndef _ASMLANGUAGE +typedef struct + { + UCHAR pad0[M33242J_REG_OFFSET]; + UCHAR lmr1; + UCHAR pad1[M33242J_REG_OFFSET]; + UCHAR lmr2; + UCHAR pad2[M33242J_REG_OFFSET]; + UCHAR lmr3; + UCHAR pad3[M33242J_REG_OFFSET]; + UCHAR lmr4; + UCHAR pad4[M33242J_REG_OFFSET]; + UCHAR lmr5; + UCHAR pad5[M33242J_REG_OFFSET]; + UCHAR lmr6; + UCHAR pad6[M33242J_REG_OFFSET]; + UCHAR vmr; + UCHAR pad7[M33242J_REG_OFFSET]; + UCHAR vsr; + UCHAR pad8[M33242J_REG_OFFSET]; + UCHAR vnr; + UCHAR pad9[M33242J_REG_OFFSET]; + UCHAR tmr; + UCHAR pad10[M33242J_REG_OFFSET]; + UCHAR imr; + UCHAR pad11[M33242J_REG_OFFSET]; + UCHAR irr; + UCHAR pad12[M33242J_REG_OFFSET]; + UCHAR bmr; + UCHAR pad13[M33242J_REG_OFFSET]; + UCHAR brr; + } IRC; +#endif /* _ASMLANGUAGE */ + +/* Local Interrupt Request */ +#define IRC_LIR0 0x01 +#define IRC_LIR1 0x02 +#define IRC_LIR2 0x04 +#define IRC_LIR3 0x08 +#define IRC_LIR4 0x10 +#define IRC_LIR5 0x20 +#define IRC_LIR6 0x40 + +/* default values */ +#define IRC_IMR_DISABLE 0xff +#define IRC_BMR_DISABLE 0xff +#define IRC_VMR_AUTOVEC 0xff +#define IRC_TMR_EDGE 0xff +#define IRC_IRR_RESET 0xff +#define IRC_VNR_AUTOVEC 0xff + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm33242jh */ diff --git a/h/drv/intrCtl/m5200Intr.h b/h/drv/intrCtl/m5200Intr.h new file mode 100644 index 0000000..248d122 --- /dev/null +++ b/h/drv/intrCtl/m5200Intr.h @@ -0,0 +1,220 @@ +/* m5200Intr.h - Motorola MPC5200 interrupt header file */ + +/* Copyright 1991-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,15feb05,j_b INUM_PERIPHERAL_LAST corrected +01a,03jul03,pkr derived from ppc860Intr.h +*/ + +#ifndef __INCm5200Intrh +#define __INCm5200Intrh + +#ifdef __cplusplus +extern "C" { +#endif + +/* interrupt number definitions */ + +/* Peripheral Interrupts */ + +#define INUM_PERIPHERAL_FIRST 0 +#define INUM_BESTCOMM 0 +#define INUM_PSC1 1 +#define INUM_PSC2 2 +#define INUM_PSC3 3 +#define INUM_PSC6 4 +#define INUM_ETH 5 +#define INUM_USB 6 +#define INUM_ATA 7 +#define INUM_PCI_CTL 8 +#define INUM_PCI_RX 9 +#define INUM_PCI_TX 10 +#define INUM_PSC4 11 +#define INUM_PSC5 12 +#define INUM_SPI_MODF 13 +#define INUM_SPI_SPIF 14 +#define INUM_I2C1 15 +#define INUM_I2C2 16 +#define INUM_CAN1 17 +#define INUM_CAN2 18 +#define INUM_IR_RX 19 +#define INUM_IR_TX 20 +#define INUM_XLB 21 +#define INUM_BDLC 22 +#define INUM_BESTCOMM_LP 23 +#define INUM_PERIPHERAL_LAST INUM_BESTCOMM_LP + +/* External Interrupts to Main Controller */ +#define INUM_MAIN_FIRST 32 +#define INUM_SLT1 32 +#define INUM_IRQ1 33 +#define INUM_IRQ2 34 +#define INUM_IRQ3 35 +#define _INUM_LO 36 /* internal only */ +#define INUM_RTC_pint 37 +#define INUM_RTC_sint 38 +#define INUM_GPIO_std 39 +#define INUM_GPIO_wkup 40 +#define INUM_TMR0 41 +#define INUM_TMR1 42 +#define INUM_TMR2 43 +#define INUM_TMR3 44 +#define INUM_TMR4 45 +#define INUM_TMR5 46 +#define INUM_TMR6 47 +#define INUM_TMR7 48 +#define INUM_MAIN_LAST 48 + +/* Critical Interrupts to Main Controller */ +#define INUM_CRITICAL_FIRST 49 +#define INUM_IRQ0 49 +#define INUM_SLT0 50 +#define _INUM_HI 51 /* internal only */ +#define INUM_CCS 52 +#define INUM_CRITICAL_LAST 52 + +/* Bestcomm Interrupts (to share a common table */ + +#define INUM_SDMA_FIRST 53 +#define INUM_SDMA_TEA 53 +#define INUM_SDMA_TASK0 54 +#define INUM_SDMA_TASK1 55 +#define INUM_SDMA_TASK2 56 +#define INUM_SDMA_TASK3 57 +#define INUM_SDMA_TASK4 58 +#define INUM_SDMA_TASK5 59 +#define INUM_SDMA_TASK6 60 +#define INUM_SDMA_TASK7 61 +#define INUM_SDMA_TASK8 62 +#define INUM_SDMA_TASK9 63 +#define INUM_SDMA_TASK10 64 +#define INUM_SDMA_TASK11 65 +#define INUM_SDMA_TASK12 66 +#define INUM_SDMA_TASK13 67 +#define INUM_SDMA_TASK14 68 +#define INUM_SDMA_TASK15 69 +#define INUM_SDMA_LAST 69 + +#define SDMA_TASKNO_TO_INUM(TASKNO) (INUM_SDMA_TASK0+TASKNO) + +#define NUM_VEC_MAX 69 + +/* vectors */ + +#define IV_BESTCOMM INUM_TO_IVEC (INUM_BESTCOMM) +#define IV_PSC1 INUM_TO_IVEC (INUM_PSC1) +#define IV_PSC2 INUM_TO_IVEC (INUM_PSC2) +#define IV_PSC3 INUM_TO_IVEC (INUM_PSC3) +#define IV_PSC6 INUM_TO_IVEC (INUM_PSC6) +#define IV_ETH INUM_TO_IVEC (INUM_ETH) +#define IV_USB INUM_TO_IVEC (INUM_USB) +#define IV_ATA INUM_TO_IVEC (INUM_ATA) +#define IV_PCI_CTL INUM_TO_IVEC (INUM_PCI_CTL) +#define IV_PCI_RX INUM_TO_IVEC (INUM_PCI_RX) +#define IV_PCI_TX INUM_TO_IVEC (INUM_PCI_TX) +#define IV_PSC4 INUM_TO_IVEC (INUM_PSC4) +#define IV_PSC5 INUM_TO_IVEC (INUM_PSC5) +#define IV_SPI_MODF INUM_TO_IVEC (INUM_SPI_MODF) +#define IV_SPI_SPIF INUM_TO_IVEC (INUM_SPI_SPIF) +#define IV_I2C1 INUM_TO_IVEC (INUM_I2C1) +#define IV_I2C2 INUM_TO_IVEC (INUM_I2C2) +#define IV_CAN1 INUM_TO_IVEC (INUM_CAN1) +#define IV_CAN2 INUM_TO_IVEC (INUM_CAN2) +#define IV_IR_RX INUM_TO_IVEC (INUM_IR_RX) +#define IV_IR_TX INUM_TO_IVEC (INUM_IR_TX) +#define IV_XLB INUM_TO_IVEC (INUM_XLB) +#define IV_BDLC INUM_TO_IVEC (INUM_BDLC) +#define IV_BESTCOMM_LP INUM_TO_IVEC (INUM_BESTCOMM_LP) +#define IV_RESERVED24 INUM_TO_IVEC (INUM_RESERVED24) +#define IV_RESERVED25 INUM_TO_IVEC (INUM_RESERVED25) +#define IV_RESERVED26 INUM_TO_IVEC (INUM_RESERVED26) +#define IV_RESERVED27 INUM_TO_IVEC (INUM_RESERVED27) +#define IV_RESERVED28 INUM_TO_IVEC (INUM_RESERVED28) +#define IV_RESERVED29 INUM_TO_IVEC (INUM_RESERVED29) +#define IV_RESERVED30 INUM_TO_IVEC (INUM_RESERVED30) +#define IV_RESERVED31 INUM_TO_IVEC (INUM_RESERVED31) + +#define IV_SLT1 INUM_TO_IVEC (INUM_SLT1) +#define IV_IRQ1 INUM_TO_IVEC (INUM_IRQ1) +#define IV_IRQ2 INUM_TO_IVEC (INUM_IRQ2) +#define IV_IRQ3 INUM_TO_IVEC (INUM_IRQ3) +#define IV_RTC_pint INUM_TO_IVEC (INUM_RTC_pint) +#define IV_RTC_sint INUM_TO_IVEC (INUM_RTC_sint) +#define IV_GPIO_std INUM_TO_IVEC (INUM_GPIO_std) +#define IV_GPIO_wkup INUM_TO_IVEC (INUM_GPIO_wkup) +#define IV_TMR0 INUM_TO_IVEC (INUM_TMR0) +#define IV_TMR1 INUM_TO_IVEC (INUM_TMR1) +#define IV_TMR2 INUM_TO_IVEC (INUM_TMR2) +#define IV_TMR3 INUM_TO_IVEC (INUM_TMR3) +#define IV_TMR4 INUM_TO_IVEC (INUM_TMR4) +#define IV_TMR5 INUM_TO_IVEC (INUM_TMR5) +#define IV_TMR6 INUM_TO_IVEC (INUM_TMR6) +#define IV_TMR7 INUM_TO_IVEC (INUM_TMR7) + +#define IV_IRQ0 INUM_TO_IVEC (INUM_IRQ0) +#define IV_SLT0 INUM_TO_IVEC (INUM_SLT0) +#define IV_CCS INUM_TO_IVEC (INUM_CCS) + +#define IV_SDMA_TEA INUM_TO_IVEC (INUM_SDMA_TEA) +#define IV_SDMA_TASK0 INUM_TO_IVEC (INUM_SDMA_TASK0) +#define IV_SDMA_TASK1 INUM_TO_IVEC (INUM_SDMA_TASK1) +#define IV_SDMA_TASK2 INUM_TO_IVEC (INUM_SDMA_TASK2) +#define IV_SDMA_TASK3 INUM_TO_IVEC (INUM_SDMA_TASK3) +#define IV_SDMA_TASK4 INUM_TO_IVEC (INUM_SDMA_TASK4) +#define IV_SDMA_TASK5 INUM_TO_IVEC (INUM_SDMA_TASK5) +#define IV_SDMA_TASK6 INUM_TO_IVEC (INUM_SDMA_TASK6) +#define IV_SDMA_TASK7 INUM_TO_IVEC (INUM_SDMA_TASK7) +#define IV_SDMA_TASK8 INUM_TO_IVEC (INUM_SDMA_TASK8) +#define IV_SDMA_TASK9 INUM_TO_IVEC (INUM_SDMA_TASK9) +#define IV_SDMA_TASK10 INUM_TO_IVEC (INUM_SDMA_TASK10) +#define IV_SDMA_TASK11 INUM_TO_IVEC (INUM_SDMA_TASK11) +#define IV_SDMA_TASK12 INUM_TO_IVEC (INUM_SDMA_TASK12) +#define IV_SDMA_TASK13 INUM_TO_IVEC (INUM_SDMA_TASK13) +#define IV_SDMA_TASK14 INUM_TO_IVEC (INUM_SDMA_TASK14) + +#define SDMA_TASKNO_TO_IVEC(TASKNO) INUM_TO_IVEC(SDMA_TASKNO_TO_INUM(TASKNO)) + +/* other defines */ + +#define USE_CRITICAL_INTERRUPT 0 + +#define INTR_LEVEL_DEFAULT 3 + +/* typedefs */ + +/* interrupt handler */ + +#ifndef _ASMLANGUAGE +typedef struct intr_handler + { + VOIDFUNCPTR vec; /* interrupt vector */ + int arg; /* interrupt handler argument */ + } INTR_HANDLER; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT STATUS m5200IntrInit (void); +IMPORT int m5200IntrSetLevel(int, int); +IMPORT void m5200IntAck(int); + +#else + +IMPORT STATUS m5200IntrInit (); +IMPORT STATUS m5200IntrSetLevel(); +IMPORT void m5200IntAck(); + +#endif /* __STDC__ */ +#endif /* _ASMLANGUAGE */ + +#define _EXC_INFO_XLB 0x10000 /* mach check from XLB, info in DAR/DSISR */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm5200Intrh */ diff --git a/h/drv/intrCtl/m68153.h b/h/drv/intrCtl/m68153.h new file mode 100644 index 0000000..579d2ff --- /dev/null +++ b/h/drv/intrCtl/m68153.h @@ -0,0 +1,47 @@ +/* m68153.h - Motorola 68153 Bus Interruptor Module header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01e,22sep92,rrr added support for c++ +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -changed copyright notice +01b,05oct90,shl added copyright notice. + made #endif ANSI style. +01a,03jun88,tja extracted from frc21.h +*/ + +#ifndef __INCm68153h +#define __INCm68153h + +#ifdef __cplusplus +extern "C" { +#endif + + +/* BIM addresses */ + +#define BIM_CR1(base) ((char *) ((base) + 0x01)) /* control reg 1 */ +#define BIM_CR2(base) ((char *) ((base) + 0x03)) /* control reg 2 */ +#define BIM_CR3(base) ((char *) ((base) + 0x05)) /* control reg 3 */ +#define BIM_CR4(base) ((char *) ((base) + 0x07)) /* control reg 4 */ +#define BIM_VR1(base) ((char *) ((base) + 0x09)) /* vector reg 1 */ +#define BIM_VR2(base) ((char *) ((base) + 0x0b)) /* vector reg 2 */ +#define BIM_VR3(base) ((char *) ((base) + 0x0d)) /* vector reg 3 */ +#define BIM_VR4(base) ((char *) ((base) + 0x0f)) /* vector reg 4 */ + +/* BIM control reg bits */ + +#define BIM_IRE 0x10 /* interrupt enable */ +#define BIM_IRAC 0x08 /* interrupt auto-clear */ +#define BIM_XIN 0x20 /* don't supply vector */ +#define BIM_F 0x80 /* user defined flag */ +#define BIM_FAC 0x40 /* clear flag in interrupt */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm68153h */ diff --git a/h/drv/intrCtl/m8260IntrCtl.h b/h/drv/intrCtl/m8260IntrCtl.h new file mode 100644 index 0000000..6b8d6e2 --- /dev/null +++ b/h/drv/intrCtl/m8260IntrCtl.h @@ -0,0 +1,192 @@ +/* m8260IntrCtl.h - MPC 8260 interrupt controller header file */ + +/* Copyright 1991-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,16jan03,dtr Adding PCI interrupt for HIP4 part. +01g,17sep99,ms_ remove period in __INCm8260Intr +01f,17sep99,ms_ try removing config.h +01e,15jul99,ms_ make compliant with our coding standards +01d,17apr99,ms_ final EAR cleanup +01c,15apr99,ms_ add default interrupt priority ordering +01b,13apr99,ms_ redefine IVEC_TO_INUM and INUM_TO_IVEC to use the numbers as + shown in the +MPC8260 user's manaul +01a,21jan99,ms_ adapted from ppc860Intr.h +*/ + +#ifndef __INCm8260IntrCtlh +#define __INCm8260IntrCtlh + +#include "vxWorks.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _ASMLANGUAGE +#define CAST(x) +#else /* _ASMLANGUAGE */ +#define CAST(x) (x) +#endif /* _ASMLANGUAGE */ + +#ifdef IVEC_TO_INUM +# undef IVEC_TO_INUM +#endif /* IVEC_TO_INUM */ + +#ifdef INUM_TO_IVEC +# undef INUM_TO_IVEC +#endif /* INUM_TO_IVEC */ + +#define IVEC_TO_INUM(intVec) (m8260IvecToInum(intVec)) +#define INUM_TO_IVEC(intNum) (m8260InumToIvec(intNum)) + + +/* Interrupt Controller Registers */ + +#define M8260_SICR(base) ((VINT32 *) ((base) + 0x010C00)) +#define M8260_SIVEC(base) ((VINT32 *) ((base) + 0x010C04)) +#define M8260_SIPNR_H(base) ((VINT32 *) ((base) + 0x010C08)) +#define M8260_SIPNR_L(base) ((VINT32 *) ((base) + 0x010C0C)) +#define M8260_SIPRR(base) ((VINT32 *) ((base) + 0x010C10)) +#define M8260_SCPRR_H(base) ((VINT32 *) ((base) + 0x010C14)) +#define M8260_SCPRR_L(base) ((VINT32 *) ((base) + 0x010C18)) +#define M8260_SIMR_H(base) ((VINT32 *) ((base) + 0x010C1C)) +#define M8260_SIMR_L(base) ((VINT32 *) ((base) + 0x010C20)) +#define M8260_SIEXR(base) ((VINT32 *) ((base) + 0x010C24)) + + +/* interrupt numbers */ + +#define INUM_ERROR 0 /* Error */ +#define INUM_I2C 1 /* I2C */ +#define INUM_SPI 2 /* SPI */ +#define INUM_RISC_TIMER 3 /* Risc Timer Table */ +#define INUM_SMC1 4 /* SMC 1 */ +#define INUM_SMC2 5 /* SMC 2 */ +#define INUM_IDMA1 6 /* IDMA1 */ +#define INUM_IDMA2 7 /* IDMA2 */ +#define INUM_IDMA3 8 /* IDMA3 */ +#define INUM_IDMA4 9 /* IDMA4 */ +#define INUM_SDMA 10 /* SDMA */ +#define INUM_RESERVED11 11 /* reserved */ +#define INUM_TIMER1 12 /* Timer 1 */ +#define INUM_TIMER2 13 /* Timer 2 */ +#define INUM_TIMER3 14 /* Timer 3 */ +#define INUM_TIMER4 15 /* Timer 4 */ +#define INUM_TMCNT 16 /* TMCNT */ +#define INUM_PIT 17 /* PIT */ +#define INUM_PCI 18 /* PCI Error/DMA/Messages */ +#define INUM_IRQ1 19 /* IRQ 1 interrupt */ +#define INUM_IRQ2 20 /* IRQ 2 interrupt */ +#define INUM_IRQ3 21 /* IRQ 3 interrupt */ +#define INUM_IRQ4 22 /* IRQ 4 interrupt */ +#define INUM_IRQ5 23 /* IRQ 5 interrupt */ +#define INUM_IRQ6 24 /* IRQ 6 interrupt */ +#define INUM_IRQ7 25 /* IRQ 7 interrupt */ +#define INUM_RESERVED26 26 /* reserved */ +#define INUM_FCC1 27 /* FCC1 */ +#define INUM_FCC2 28 /* FCC2 */ +#define INUM_FCC3 29 /* FCC3 */ +#define INUM_RESERVED30 30 /* reserved */ +#define INUM_MCC1 31 /* MCC1 */ +#define INUM_MCC2 32 /* MCC2 */ +#define INUM_RESERVED33 33 /* reserved */ +#define INUM_RESERVED34 34 /* reserved */ +#define INUM_SCC1 35 /* SCC1 */ +#define INUM_SCC2 36 /* SCC2 */ +#define INUM_SCC3 37 /* SCC3 */ +#define INUM_SCC4 38 /* SCC4 */ +#define INUM_RESERVED39 39 /* reserved */ +#define INUM_PC15 40 /* Parallel I/O [15] */ +#define INUM_PC14 41 /* Parallel I/O [14] */ +#define INUM_PC13 42 /* Parallel I/O [13] */ +#define INUM_PC12 43 /* Parallel I/O [12] */ +#define INUM_PC11 44 /* Parallel I/O [11] */ +#define INUM_PC10 45 /* Parallel I/O [10] */ +#define INUM_PC9 46 /* Parallel I/O [9] */ +#define INUM_PC8 47 /* Parallel I/O [8] */ +#define INUM_PC7 48 /* Parallel I/O [7] */ +#define INUM_PC6 49 /* Parallel I/O [6] */ +#define INUM_PC5 50 /* Parallel I/O [5] */ +#define INUM_PC4 51 /* Parallel I/O [4] */ +#define INUM_PC3 52 /* Parallel I/O [3] */ +#define INUM_PC2 53 /* Parallel I/O [2] */ +#define INUM_PC1 54 /* Parallel I/O [1] */ +#define INUM_PC0 55 /* Parallel I/O [0] */ + +#define INUM_MAX INUM_PC0 +#define IVEC_MAX (INUM_PC0 + 8) + +/* SICR Masks*/ + +#define MPC8260_CICR_SCCDP_MSK 0xc00000 /* SCCd Priority Order Mask */ +#define MPC8260_CICR_SCCDP_SCC1 0x000000 /* SCC1 asserts the SCCd */ +#define MPC8260_CICR_SCCDP_SCC2 0x400000 /* SCC2 asserts the SCCd */ +#define MPC8260_CICR_SCCDP_SCC3 0x800000 /* SCC3 asserts the SCCd */ +#define MPC8260_CICR_SCCDP_SCC4 0xc00000 /* SCC4 asserts the SCCd */ +#define MPC8260_CICR_SCCCP_MSK 0x300000 /* SCCc Priority Order Mask */ +#define MPC8260_CICR_SCCCP_SCC1 0x000000 /* SCC1 asserts the SCCc */ +#define MPC8260_CICR_SCCCP_SCC2 0x100000 /* SCC2 asserts the SCCc */ +#define MPC8260_CICR_SCCCP_SCC3 0x200000 /* SCC3 asserts the SCCc */ +#define MPC8260_CICR_SCCCP_SCC4 0x300000 /* SCC4 asserts the SCCc */ +#define MPC8260_CICR_SCCBP_MSK 0x0c0000 /* SCCb Priority Order Mask */ +#define MPC8260_CICR_SCCBP_SCC1 0x000000 /* SCC1 asserts the SCCb */ +#define MPC8260_CICR_SCCBP_SCC2 0x040000 /* SCC2 asserts the SCCb */ +#define MPC8260_CICR_SCCBP_SCC3 0x080000 /* SCC3 asserts the SCCb */ +#define MPC8260_CICR_SCCBP_SCC4 0x0c0000 /* SCC4 asserts the SCCb */ +#define MPC8260_CICR_SCCAP_MSK 0x030000 /* SCCa Priority Order Mask */ +#define MPC8260_CICR_SCCAP_SCC1 0x000000 /* SCC1 asserts the SCCa */ +#define MPC8260_CICR_SCCAP_SCC2 0x010000 /* SCC2 asserts the SCCa */ +#define MPC8260_CICR_SCCAP_SCC3 0x020000 /* SCC3 asserts the SCCa */ +#define MPC8260_CICR_SCCAP_SCC4 0x030000 /* SCC4 asserts the SCCa */ +#define MPC8260_CICR_IRL_MSK 0x00e000 /* Interrupt Request Level */ +#define MPC8260_CICR_IRL_LVL0 0x000000 /* Interrupt Request Level 0 */ +#define MPC8260_CICR_IRL_LVL1 0x002000 /* Interrupt Request Level 1 */ +#define MPC8260_CICR_IRL_LVL2 0x004000 /* Interrupt Request Level 2 */ +#define MPC8260_CICR_IRL_LVL3 0x006000 /* Interrupt Request Level 3 */ +#define MPC8260_CICR_IRL_LVL4 0x008000 /* Interrupt Request Level 4 */ +#define MPC8260_CICR_IRL_LVL5 0x00a000 /* Interrupt Request Level 5 */ +#define MPC8260_CICR_IRL_LVL6 0x00c000 /* Interrupt Request Level 6 */ +#define MPC8260_CICR_IRL_LVL7 0x00e000 /* Interrupt Request Level 7 */ +#define MPC8260_CICR_HP_MSK 0x001f00 /* Highest Priority */ +#define MPC8260_CICR_IEN 0x000080 /* Interrupt Enable */ +#define MPC8260_CICR_SPS 0x000001 /* Spread Priority Scheme */ + +/* interrupt handler */ + +#ifndef _ASMLANGUAGE +typedef struct intr_handler + { + VOIDFUNCPTR vec; /* interrupt vector */ + int arg; /* interrupt handler argument */ + } INTR_HANDLER; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT STATUS m8260IntrInit (); +extern STATUS m8260IntDisable (int ); +IMPORT STATUS m8260IntEnable (int ); +extern int m8260IvecToInum(VOIDFUNCPTR *); +extern VOIDFUNCPTR * m8260InumToIvec(int); + +#else + +IMPORT STATUS m8260IntrInit (); +extern STATUS m8260IntDisable (); +IMPORT STATUS m8260IntEnable (); +extern int m8260IvecToInum(); +extern VOIDFUNCPTR * m8260InumToIvec(); + +#endif /* __STDC__ */ +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm8260IntrCtlh */ diff --git a/h/drv/intrCtl/mpc107Epic.h b/h/drv/intrCtl/mpc107Epic.h new file mode 100644 index 0000000..436b3d2 --- /dev/null +++ b/h/drv/intrCtl/mpc107Epic.h @@ -0,0 +1,294 @@ +/* mpc107Epic.h - MPC107 EPIC register definitions */ + +/* Copyright 1984-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,11sep00,rcs correct include path errors +01a,06jun00,bri written +*/ + +#ifndef __INCmpc107Epich +#define __INCmpc107Epich + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "drv/multi/mpc107.h" + +/* defines */ + +/* MPC107 configuration registers for EPIC && other definitions */ + +#define INTERRUPT_TABLESIZE 256 /* Interrupt Table Size */ + +#define EPIC_EUMBBAR 0x40000 /* EUMBBAR of EPIC */ +#define MPC107_EPIC_FEATURES_REG (EPIC_EUMBBAR + 0x01000)/* Feature report */ +#define MPC107_EPIC_GLOBAL_REG (EPIC_EUMBBAR + 0x01020)/* Global config. */ +#define MPC107_EPIC_INT_CONF_REG (EPIC_EUMBBAR + 0x01030)/* Interrupt config */ +#define MPC107_EPIC_VENDOR_ID_REG (EPIC_EUMBBAR + 0x01080)/* Vendor id */ +#define MPC107_EPIC_PROC_INIT_REG (EPIC_EUMBBAR + 0x01090)/* Processor init. */ +#define MPC107_EPIC_SPUR_VEC_REG (EPIC_EUMBBAR + 0x010e0)/* Spurious vector */ +#define MPC107_EPIC_TM_FREQ_REG (EPIC_EUMBBAR + 0x010f0)/* Timer Frequency */ + + +/* + * Definitions of Global Timer Registers : + * Global Timer Current Count Register (GTCCR) + * Global Timer Base Count Register (GTBCR) + * Global Timer Vector/Priority Register (GTVPR) + * Global Timer Destination Register (GTDR) + */ + +#define MPC107_EPIC_TM0_CUR_COUNT_REG (EPIC_EUMBBAR + 0x01100) /* GTCCR0 */ +#define MPC107_EPIC_TM0_BASE_COUNT_REG (EPIC_EUMBBAR + 0x01110) /* GTBCRO */ +#define MPC107_EPIC_TM0_VEC_REG (EPIC_EUMBBAR + 0x01120) /* GTVPR0 */ +#define MPC107_EPIC_TM0_DES_REG (EPIC_EUMBBAR + 0x01130) /* GTDR0 */ + +#define MPC107_EPIC_TM1_CUR_COUNT_REG (EPIC_EUMBBAR + 0x01140) /* GTCCR1 */ +#define MPC107_EPIC_TM1_BASE_COUNT_REG (EPIC_EUMBBAR + 0x01150) /* GTBCR1*/ +#define MPC107_EPIC_TM1_VEC_REG (EPIC_EUMBBAR + 0x01160) /* GTVPR1*/ +#define MPC107_EPIC_TM1_DES_REG (EPIC_EUMBBAR + 0x01170) /* GTDR1*/ + +#define MPC107_EPIC_TM2_CUR_COUNT_REG (EPIC_EUMBBAR + 0x01180) /* GTCCR2 */ +#define MPC107_EPIC_TM2_BASE_COUNT_REG (EPIC_EUMBBAR + 0x01190) /* GTBCR2 */ +#define MPC107_EPIC_TM2_VEC_REG (EPIC_EUMBBAR + 0x011a0) /* GTVPR2 */ +#define MPC107_EPIC_TM2_DES_REG (EPIC_EUMBBAR + 0x011b0) /* GTDR2 */ + +#define MPC107_EPIC_TM3_CUR_COUNT_REG (EPIC_EUMBBAR + 0x011c0) /* GTCCR3 */ +#define MPC107_EPIC_TM3_BASE_COUNT_REG (EPIC_EUMBBAR + 0x011d0) /* GTBCR3 */ +#define MPC107_EPIC_TM3_VEC_REG (EPIC_EUMBBAR + 0x011e0) /* GTVPR3 */ +#define MPC107_EPIC_TM3_DES_REG (EPIC_EUMBBAR + 0x011f0) /* GTDR3 */ + + +/* + * External Interrupts Vector /Priority Registers (IVPR) and + * Destination Registers (IDR) + */ + +#define MPC107_EPIC_EX_INT0_VEC_REG (EPIC_EUMBBAR + 0x10200) /* IVPR0 */ +#define MPC107_EPIC_EX_INT0_DES_REG (EPIC_EUMBBAR + 0x10210) /* IDR0 */ +#define MPC107_EPIC_EX_INT1_VEC_REG (EPIC_EUMBBAR + 0x10220) /* IVPR1 */ +#define MPC107_EPIC_EX_INT1_DES_REG (EPIC_EUMBBAR + 0x10230) /* IDR1 */ +#define MPC107_EPIC_EX_INT2_VEC_REG (EPIC_EUMBBAR + 0x10240) /* IVPR2 */ +#define MPC107_EPIC_EX_INT2_DES_REG (EPIC_EUMBBAR + 0x10250) /* IDR2 */ +#define MPC107_EPIC_EX_INT3_VEC_REG (EPIC_EUMBBAR + 0x10260) /* IVPR3 */ +#define MPC107_EPIC_EX_INT3_DES_REG (EPIC_EUMBBAR + 0x10270) /* IDR3 */ +#define MPC107_EPIC_EX_INT4_VEC_REG (EPIC_EUMBBAR + 0x10280) /* IVPR4 */ +#define MPC107_EPIC_EX_INT4_DES_REG (EPIC_EUMBBAR + 0x10290) /* IDR4 */ + +/* + * Serial Interrupts Vector /Priority Registers (SVPR) and + * Destination Registers (SDR) + */ + +#define MPC107_EPIC_SR_INT0_VEC_REG (EPIC_EUMBBAR + 0x10200) /* SVPR0 */ +#define MPC107_EPIC_SR_INT0_DES_REG (EPIC_EUMBBAR + 0x10210) /* SDR0 */ +#define MPC107_EPIC_SR_INT1_VEC_REG (EPIC_EUMBBAR + 0x10220) /* SVPR1 */ +#define MPC107_EPIC_SR_INT1_DES_REG (EPIC_EUMBBAR + 0x10230) /* SDR1 */ +#define MPC107_EPIC_SR_INT2_VEC_REG (EPIC_EUMBBAR + 0x10240) /* SVPR2 */ +#define MPC107_EPIC_SR_INT2_DES_REG (EPIC_EUMBBAR + 0x10250) /* SDR2 */ +#define MPC107_EPIC_SR_INT3_VEC_REG (EPIC_EUMBBAR + 0x10260) /* SVPR3 */ +#define MPC107_EPIC_SR_INT3_DES_REG (EPIC_EUMBBAR + 0x10270) /* SDR3 */ +#define MPC107_EPIC_SR_INT4_VEC_REG (EPIC_EUMBBAR + 0x10280) /* SVPR4 */ +#define MPC107_EPIC_SR_INT4_DES_REG (EPIC_EUMBBAR + 0x10290) /* SDR4 */ + +#define MPC107_EPIC_SR_INT5_VEC_REG (EPIC_EUMBBAR + 0x102a0) /* SVPR5 */ +#define MPC107_EPIC_SR_INT5_DES_REG (EPIC_EUMBBAR + 0x102b0) /* SDR5 */ +#define MPC107_EPIC_SR_INT6_VEC_REG (EPIC_EUMBBAR + 0x102c0) /* SVPR6 */ +#define MPC107_EPIC_SR_INT6_DES_REG (EPIC_EUMBBAR + 0x102d0) /* SDR6 */ +#define MPC107_EPIC_SR_INT7_VEC_REG (EPIC_EUMBBAR + 0x102e0) /* SVPR7 */ +#define MPC107_EPIC_SR_INT7_DES_REG (EPIC_EUMBBAR + 0x102f0) /* SDR7 */ +#define MPC107_EPIC_SR_INT8_VEC_REG (EPIC_EUMBBAR + 0x10300) /* SVPR8 */ +#define MPC107_EPIC_SR_INT8_DES_REG (EPIC_EUMBBAR + 0x10310) /* SDR8 */ +#define MPC107_EPIC_SR_INT9_VEC_REG (EPIC_EUMBBAR + 0x10320) /* SVPR9 */ +#define MPC107_EPIC_SR_INT9_DES_REG (EPIC_EUMBBAR + 0x10330) /* SDR9 */ + +#define MPC107_EPIC_SR_INT10_VEC_REG (EPIC_EUMBBAR + 0x10340) /* SVPR10 */ +#define MPC107_EPIC_SR_INT10_DES_REG (EPIC_EUMBBAR + 0x10350) /* SDR10 */ +#define MPC107_EPIC_SR_INT11_VEC_REG (EPIC_EUMBBAR + 0x10360) /* SVPR11 */ +#define MPC107_EPIC_SR_INT11_DES_REG (EPIC_EUMBBAR + 0x10370) /* SDR11 */ +#define MPC107_EPIC_SR_INT12_VEC_REG (EPIC_EUMBBAR + 0x10380) /* SVPR12 */ +#define MPC107_EPIC_SR_INT12_DES_REG (EPIC_EUMBBAR + 0x10390) /* SDR12 */ +#define MPC107_EPIC_SR_INT13_VEC_REG (EPIC_EUMBBAR + 0x103a0) /* SVPR13 */ +#define MPC107_EPIC_SR_INT13_DES_REG (EPIC_EUMBBAR + 0x103b0) /* SDR13 */ +#define MPC107_EPIC_SR_INT14_VEC_REG (EPIC_EUMBBAR + 0x103c0) /* SVPR14 */ +#define MPC107_EPIC_SR_INT14_DES_REG (EPIC_EUMBBAR + 0x103d0) /* SDR14 */ +#define MPC107_EPIC_SR_INT15_VEC_REG (EPIC_EUMBBAR + 0x103e0) /* SVPR15 */ +#define MPC107_EPIC_SR_INT15_DES_REG (EPIC_EUMBBAR + 0x103f0) /* SDR15 */ + +/* + * IIC Interrupts Vector /Priority Registers (IIVPR) and + * Destination Registers (IIDR) + */ + +#define MPC107_EPIC_I2C_INT_VEC_REG (EPIC_EUMBBAR + 0x11020)/* IIVPR0 */ +#define MPC107_EPIC_I2C_INT_DES_REG (EPIC_EUMBBAR + 0x11030)/* IIDR0 */ + +/* + * DMA Interrupts Vector /Priority Registers (IIVPR) and + * Destination Registers (IIDR) - Channel Zero + */ + +#define MPC107_EPIC_DMA0_INT_VEC_REG (EPIC_EUMBBAR + 0x11040) /* IIVPR1 */ +#define MPC107_EPIC_DMA0_INT_DES_REG (EPIC_EUMBBAR + 0x11050) /* IIDR1 */ + +/* + * DMA Interrupts Vector /Priority Registers (IIVPR) and + * Destination Registers (IIDR) - Channel One + */ + +#define MPC107_EPIC_DMA1_INT_VEC_REG (EPIC_EUMBBAR + 0x11060) /* IIVPR2 */ +#define MPC107_EPIC_DMA1_INT_DES_REG (EPIC_EUMBBAR + 0x11070) /* IIDR2 */ + + +/* + * Message Unit Interrupts Vector /Priority Registers (IIVPR) and + * Destination Registers (IIDR) + */ + +#define MPC107_EPIC_MSG_INT_VEC_REG (EPIC_EUMBBAR + 0x110c0)/* IIVPR3 */ +#define MPC107_EPIC_MSG_INT_DES_REG (EPIC_EUMBBAR + 0x110d0)/* IIDR3 */ + + +/* General Register Definitions */ + +#define MPC107_EPIC_PROC_CTASK_PRI_REG \ + (EPIC_EUMBBAR + 0x20080) /* Proccesor current task Register */ +#define MPC107_EPIC_PROC_INT_ACK_REG \ + (EPIC_EUMBBAR + 0x200a0) /* Interrupt acknowledge Register */ +#define MPC107_EPIC_PROC_EOI_REG \ + (EPIC_EUMBBAR + 0x200b0) /* End of interrupt Register */ + +/* General Definitions */ + +#define MPC107_EPIC_VEC_REG_INTERVAL 0x20 /* Distance between interrupt */ + /* vector registers */ + +#define MPC107_EPIC_VEC_REG(irq) (MPC107_EPIC_EX_INT0_VEC_REG + \ + (irq * MPC107_EPIC_VEC_REG_INTERVAL)) + + +#define MPC107_EPIC_DIRECT_IRQ 0 /* Direct IRQ */ +#define MPC107_INT_VEC_IRQ0 5 /* Maximum Ext Interrupts */ +#define MPC107_EPIC_INTER_IN_SERVICE 2 /* Interrupt in service */ +#define MPC107_EPIC_INTERNAL_INTERRUPT 20 /* Internal Interrupts */ +#define MPC107_EPIC_EXTERNAL_INTERRUPT 21 /* External Interrupts */ +#define MPC107_EPIC_INV_INTER_SOURCE 22 /* Invalid Interrupt Source */ +#define MPC107_EPIC_MAX_EXT_IRQS 5 /* Maximum No. of ext.Interrupts */ +#define MPC107_EPIC_PRIORITY_MIN 0 /* minimum level of priority */ +#define MPC107_EPIC_PRIORITY_MAX 15 /* maximum level of priority */ +#define MPC107_EPIC_PRIORITY_GENERAL 12 /* General priority */ +#define MPC107_EPIC_INV_PRIO_ERROR ((ULONG)(-1)) /* Invalid Priority */ + +#define MPC107_EPIC_IVPRO_INT_NUM 0 /* External Interrupt 0 */ +#define MPC107_EPIC_IVPR1_INT_NUM 1 /* External Interrupt 1 */ +#define MPC107_EPIC_IVPR2_INT_NUM 2 /* External Interrupt 2 */ +#define MPC107_EPIC_IVPR3_INT_NUM 3 /* External Interrupt 3 */ +#define MPC107_EPIC_IVPR4_INT_NUM 4 /* External Interrupt 4 */ + +#define MPC107_EPIC_SVPRO_INT_NUM 0 /* Serial Interrupt 0 */ +#define MPC107_EPIC_SVPR1_INT_NUM 1 /* Serial Interrupt 1 */ +#define MPC107_EPIC_SVPR2_INT_NUM 2 /* Serial Interrupt 2 */ +#define MPC107_EPIC_SVPR3_INT_NUM 3 /* Serial Interrupt 3 */ +#define MPC107_EPIC_SVPR4_INT_NUM 4 /* Serial Interrupt 4 */ +#define MPC107_EPIC_SVPR5_INT_NUM 5 /* Serial Interrupt 5 */ +#define MPC107_EPIC_SVPR6_INT_NUM 6 /* Serial Interrupt 6 */ +#define MPC107_EPIC_SVPR7_INT_NUM 7 /* Serial Interrupt 7 */ +#define MPC107_EPIC_SVPR8_INT_NUM 8 /* Serial Interrupt 8 */ +#define MPC107_EPIC_SVPR9_INT_NUM 9 /* Serial Interrupt 9 */ +#define MPC107_EPIC_SVPR1O_INT_NUM 10 /* Serial Interrupt 10 */ +#define MPC107_EPIC_SVPR11_INT_NUM 11 /* Serial Interrupt 11 */ +#define MPC107_EPIC_SVPR12_INT_NUM 12 /* Serial Interrupt 12 */ +#define MPC107_EPIC_SVPR13_INT_NUM 13 /* Serial Interrupt 13 */ +#define MPC107_EPIC_SVPR14_INT_NUM 14 /* Serial Interrupt 14 */ +#define MPC107_EPIC_SVPR15_INT_NUM 15 /* Serial Interrupt 15 */ + + +#define MPC107_EPIC_IIC_INT_VECT 0x71 /* IIC Interrupt */ +#define MPC107_EPIC_DMA0_INT_VECT 0x72 /* DMA Channel 0 Interrupt */ +#define MPC107_EPIC_DMA1_INT_VECT 0x73 /* DMA Channel 1 Interrupt */ +#define MPC107_EPIC_MU_INT_VECT 0x76 /* Message Unit Interrupt */ + +/* Bit definitions */ + +/* Global Configuration Register Bit Definitions */ + +#define MPC107_EPIC_GCR_RESET 0x80000000 /* EPIC reset bit */ +#define MPC107_EPIC_GCR_MODE_MIXED 0x20000000 /* EPIC Mixed Mode bit */ + +/* Interrupt Configuration Register Bit Definitions */ + +#define MPC107_EPIC_ICR_SEI 0x08000000 /* Serial Interrupt Enable */ +#define MPC107_EPIC_ICR_CLK_RATIO_MSK \ + (0x40000000 | 0x20000000 | 0x10000000) /* Clock Ratio Mask Bits */ +#define MPC107_EPIC_ICR_CLK_RATIO(val) \ + (((val) << 28) & MPC107_EPIC_ICR_CLK_RATIO_MSK) /* Clock Ratio Shift */ + + +/* Interrupt Vector/Priority Register Bit Definitions */ + +#define MPC107_EPIC_IVPR_INTR_MSK 0x80000000 /* Interrupt Mask bit */ +#define MPC107_EPIC_IVPR_INTR_ACTIVE 0x40000000 /* Interrupt Activity Bit */ +#define MPC107_EPIC_IVPR_INTR_POLARITY 0x00800000 /* Interrupt Polarity Bit */ +#define MPC107_EPIC_IVPR_INTR_SENSE 0x00400000 /* Interrupt Sense Bit */ +#define MPC107_EPIC_IVPR_POLARITY(p) ((p) << 23) /* Int Polarity Shift */ +#define MPC107_EPIC_IVPR_SENS(s) ((s) << 22) /* Int Sense Shift */ +#define MPC107_EPIC_IVPR_PRIORITY_MSK \ + (0x00080000 | 0x00040000 | 0x00020000 | 0x00010000) /* Priority Mask */ +#define MPC107_EPIC_IVPR_PRIORITY(p) \ + (((p) << 16) & MPC107_EPIC_IVPR_PRIORITY_MSK)/* Priority Shift */ +#define MPC107_EPIC_IVPR_VECTOR_MSK (0xff) /* Vector Mask */ +#define MPC107_EPIC_IVPR_VECTOR(vec) \ + ((vec) & MPC107_EPIC_IVPR_VECTOR_MSK) /* Vector Mask */ +#define MPC107_EPIC_INT_ACT_LOW 0 /* Active low Interrupt */ +#define MPC107_EPIC_INT_ACT_HIGH 1 /* Active high Interrupt */ +#define MPC107_EPIC_SENSE_LVL 1 /* Level Sensitive */ +#define MPC107_EPIC_SENSE_EDG 0 /* Edge Sensitive */ +#define MPC107_EPIC_INT_POLARITY 0x0 /* Interrupt polarity */ + +/* Global Timer Vector/Priority register Bit Definitions */ + +#define MPC107_EPIC_TM_VECREG_INTMASK 0x80000000 /* Interrupt Mask Bit */ + + +/* Global Timer Base Count Register Bit Definitions */ + +#define MPC107_EPIC_TM_BASE_COUNT_CI 0x80000000 /* Count Inhibit Bit */ + + +#define MPC107_EPIC_TM_CUR_COUNT_TB 0x80000000 /* toggle bit */ + +/* typedefs */ + +/* interrupt handler description */ + +typedef struct intHandlerDesc + { + VOIDFUNCPTR vec; /* interrupt vector */ + INT32 arg; /* interrupt handler argument */ + struct intHandlerDesc * next; /* pointer to the next handler */ + } INT_HANDLER_DESC; + + +/* function declarations */ + +IMPORT VOID mpc107EpicInit (ULONG IRQType, ULONG clkRatio); +IMPORT VOID mpc107EpicIntrInit (VOID); +IMPORT STATUS mpc107EpicIntConnect (VOIDFUNCPTR *vector, + VOIDFUNCPTR routine, + INT32 parameter ); +IMPORT STATUS mpc107EpicIntDisconnect (VOIDFUNCPTR * vector, + VOIDFUNCPTR routine); +IMPORT VOID mpc107EpicIntHandler (VOID); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmpc107Epich */ + diff --git a/h/drv/intrCtl/ppc555Intr.h b/h/drv/intrCtl/ppc555Intr.h new file mode 100644 index 0000000..c6a0288 --- /dev/null +++ b/h/drv/intrCtl/ppc555Intr.h @@ -0,0 +1,72 @@ +/* ppc509Intr.h - PowerPC 509 interrupt header file */ + +/* Copyright 1991-1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,16mar99,zl written. +*/ + +#ifndef __INCppc509Intrh +#define __INCppc509Intrh + +#ifdef __cplusplus +extern "C" { +#endif + +/* interrupt number definitions */ + +#define LEVELN_PRIORITY_LVL(n) (2*n + 1) +#define IRQN_PRIORITY_LVL(n) (2*n) + +#define INT_LEVEL0 0 /* level 0 interrupt */ +#define INT_LEVEL1 1 /* level 1 interrupt */ +#define INT_LEVEL2 2 /* level 2 interrupt */ +#define INT_LEVEL3 3 /* level 3 interrupt */ +#define INT_LEVEL4 4 /* level 4 interrupt */ +#define INT_LEVEL5 5 /* level 5 interrupt */ +#define INT_LEVEL6 6 /* level 6 interrupt */ +#define INT_LEVEL7 7 /* level 7 interrupt */ + +#define INT_IRQ0 0 /* IRQ 0 interrupt */ +#define INT_IRQ1 1 /* IRQ 1 interrupt */ +#define INT_IRQ2 2 /* IRQ 2 interrupt */ +#define INT_IRQ3 3 /* IRQ 3 interrupt */ +#define INT_IRQ4 4 /* IRQ 4 interrupt */ +#define INT_IRQ5 5 /* IRQ 5 interrupt */ +#define INT_IRQ6 6 /* IRQ 6 interrupt */ +#define INT_IRQ7 7 /* IRQ 7 interrupt */ + + +#define NUM_VEC_MAX 64 + +/* typedefs */ + +/* interrupt handler */ + +#ifndef _ASMLANGUAGE +typedef struct intr_handler + { + VOIDFUNCPTR vec; /* interrupt vector */ + int arg; /* interrupt handler argument */ + } INTR_HANDLER; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT STATUS ppc509IntrInit (void); + +#else + +IMPORT STATUS ppc509IntrInit (); + +#endif /* __STDC__ */ +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCppc509Intrh */ diff --git a/h/drv/intrCtl/ppc860Intr.h b/h/drv/intrCtl/ppc860Intr.h new file mode 100644 index 0000000..b00e55d --- /dev/null +++ b/h/drv/intrCtl/ppc860Intr.h @@ -0,0 +1,127 @@ +/* ppc860Intr.h - PowerPC 860 interrupt header file */ + +/* Copyright 1991-1998 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,09nov98,cn added IVEC_TO_IRQ, IVEC_TO_ILEVEL macros. +01c,09mar98,map added IV_RESERVED59, 60 for compatiblity [SPR# 20114] +01b,10jun97,map added IV_SCC[34] definitions [SPR# 8450] +01a,17apr96,tpr written. +*/ + +#ifndef __INCppc860Intrh +#define __INCppc860Intrh + +#ifdef __cplusplus +extern "C" { +#endif + +/* interrupt number definitions */ + +#define IV_IRQ0 INUM_TO_IVEC (0) /* IRQ 0 interrupt */ +#define IV_LEVEL0 INUM_TO_IVEC (1) /* level 0 interrupt */ +#define IV_IRQ1 INUM_TO_IVEC (2) /* IRQ 1 interrupt */ +#define IV_LEVEL1 INUM_TO_IVEC (3) /* level 1 interrupt */ +#define IV_IRQ2 INUM_TO_IVEC (4) /* IRQ 2 interrupt */ +#define IV_LEVEL2 INUM_TO_IVEC (5) /* level 2 interrupt */ +#define IV_IRQ3 INUM_TO_IVEC (6) /* IRQ 3 interrupt */ +#define IV_LEVEL3 INUM_TO_IVEC (7) /* level 3 interrupt */ +#define IV_IRQ4 INUM_TO_IVEC (8) /* IRQ 4 interrupt */ +#define IV_LEVEL4 INUM_TO_IVEC (9) /* level 4 interrupt */ +#define IV_IRQ5 INUM_TO_IVEC (10) /* IRQ 5 interrupt */ +#define IV_LEVEL5 INUM_TO_IVEC (11) /* level 5 interrupt */ +#define IV_IRQ6 INUM_TO_IVEC (12) /* IRQ 6 interrupt */ +#define IV_LEVEL6 INUM_TO_IVEC (13) /* level 6 interrupt */ +#define IV_IRQ7 INUM_TO_IVEC (14) /* IRQ 7 interrupt */ +#define IV_LEVEL7 INUM_TO_IVEC (15) /* level 7 interrupt */ + +#define IV_RESERVE0 INUM_TO_IVEC (16) /* reserved */ +#define IV_RESERVE1 INUM_TO_IVEC (17) /* reserved */ +#define IV_RESERVE2 INUM_TO_IVEC (18) /* reserved */ +#define IV_RESERVE3 INUM_TO_IVEC (19) /* reserved */ +#define IV_RESERVE4 INUM_TO_IVEC (20) /* reserved */ +#define IV_RESERVE5 INUM_TO_IVEC (21) /* reserved */ +#define IV_RESERVE6 INUM_TO_IVEC (22) /* reserved */ +#define IV_RESERVE7 INUM_TO_IVEC (23) /* reserved */ +#define IV_RESERVE8 INUM_TO_IVEC (24) /* reserved */ +#define IV_RESERVE9 INUM_TO_IVEC (25) /* reserved */ +#define IV_RESERVE10 INUM_TO_IVEC (26) /* reserved */ +#define IV_RESERVE11 INUM_TO_IVEC (27) /* reserved */ +#define IV_RESERVE12 INUM_TO_IVEC (28) /* reserved */ +#define IV_RESERVE13 INUM_TO_IVEC (29) /* reserved */ +#define IV_RESERVE14 INUM_TO_IVEC (30) /* reserved */ +#define IV_RESERVE15 INUM_TO_IVEC (31) /* reserved */ + +#define IV_ERROR INUM_TO_IVEC (32) /* Error */ +#define IV_PC4 INUM_TO_IVEC (33) /* Parallel I/O [4] */ +#define IV_PC5 INUM_TO_IVEC (34) /* Parallel I/O [5] */ +#define IV_SMC2_PIP INUM_TO_IVEC (35) /* SMC 2/PIP */ +#define IV_SMC1 INUM_TO_IVEC (36) /* SMC 1 */ +#define IV_SPI INUM_TO_IVEC (37) /* SPI */ +#define IV_PC6 INUM_TO_IVEC (38) /* Parallel I/O [6] */ +#define IV_TIMER4 INUM_TO_IVEC (39) /* Timer 4 */ +#define IV_RESERVED40 INUM_TO_IVEC (40) /* reserved */ +#define IV_PC7 INUM_TO_IVEC (41) /* Parallel I/O [7] */ +#define IV_PC8 INUM_TO_IVEC (42) /* Parallel I/O [8] */ +#define IV_PC9 INUM_TO_IVEC (43) /* Parallel I/O [9] */ +#define IV_TIMER3 INUM_TO_IVEC (44) /* Timer 3 */ +#define IV_RESERVED45 INUM_TO_IVEC (45) /* reserved */ +#define IV_PC10 INUM_TO_IVEC (46) /* Parallel I/O [10] */ +#define IV_PC11 INUM_TO_IVEC (47) /* Parallel I/O [11] */ +#define IV_I2C INUM_TO_IVEC (48) /* I2C */ +#define IV_RISC_TIMER_TABLE INUM_TO_IVEC (49) /* Risc Timer Table */ +#define IV_TIMER2 INUM_TO_IVEC (50) /* Timer 2 */ +#define IV_RESERVED51 INUM_TO_IVEC (51) /* reserved */ +#define IV_IDMA2 INUM_TO_IVEC (52) /* IDMA2 */ +#define IV_IDMA1 INUM_TO_IVEC (53) /* IDMA1 */ +#define IV_SDMA INUM_TO_IVEC (54) /* SDMA bus error */ +#define IV_PC12 INUM_TO_IVEC (55) /* Parallel I/O [12] */ +#define IV_PC13 INUM_TO_IVEC (56) /* Parallel I/O [13] */ +#define IV_TIMER1 INUM_TO_IVEC (57) /* Timer 1 */ +#define IV_PC14 INUM_TO_IVEC (58) /* Parallel I/O [14] */ +#define IV_SCC4 INUM_TO_IVEC (59) /* SCC4 */ +#define IV_RESERVED59 IV_SCC4 +#define IV_SCC3 INUM_TO_IVEC (60) /* SCC3 */ +#define IV_RESERVED60 IV_SCC3 +#define IV_SCC2 INUM_TO_IVEC (61) /* SCC2 */ +#define IV_SCC1 INUM_TO_IVEC (62) /* SCC1 */ +#define IV_PC15 INUM_TO_IVEC (63) /* Parallel I/O [15] */ + +#define NUM_VEC_MAX 64 + +/* macro to get to the IRQ/ILEVEL from the vector number */ + +#define IVEC_TO_IRQ(x) (int) (x >> 1) /* interrupt request*/ +#define IVEC_TO_ILEVEL(x) (int) (x >> 1) /* interrupt level */ + +/* typedefs */ + +/* interrupt handler */ + +#ifndef _ASMLANGUAGE +typedef struct intr_handler + { + VOIDFUNCPTR vec; /* interrupt vector */ + int arg; /* interrupt handler argument */ + } INTR_HANDLER; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT STATUS ppc860IntrInit (VOIDFUNCPTR *); + +#else + +IMPORT STATUS ppc860IntrInit (); + +#endif /* __STDC__ */ +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCppc860Intrh */ diff --git a/h/drv/intrCtl/quiccIntrCtl.h b/h/drv/intrCtl/quiccIntrCtl.h new file mode 100644 index 0000000..fd03069 --- /dev/null +++ b/h/drv/intrCtl/quiccIntrCtl.h @@ -0,0 +1,157 @@ +/* quiccIntrCtl.h - PowerQuicc interrupt controller header file */ + +/* Copyright 1991-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,10jan05,dtr adapted from m85xxIntrCtl. +*/ + +#ifndef __INCquiccIntrCtlh +#define __INCquiccIntrCtlh + +#include "vxWorks.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _ASMLANGUAGE +#define CAST(x) +#else /* _ASMLANGUAGE */ +#define CAST(x) (x) +#endif /* _ASMLANGUAGE */ + +#ifdef IVEC_TO_INUM +# undef IVEC_TO_INUM +#endif /* IVEC_TO_INUM */ + +#ifdef INUM_TO_IVEC +# undef INUM_TO_IVEC +#endif /* INUM_TO_IVEC */ + +#define IVEC_TO_INUM(intVec) (quiccIvecToInum(intVec)) +#define INUM_TO_IVEC(intNum) (quiccInumToIvec(intNum)) + +#ifdef PQ2PRO +#define INUM_UART1 9 +#define INUM_UART2 10 +#define INUM_SEC 11 +#define INUM_I2C1 14 +#define INUM_I2C2 15 +#define INUM_SPI 16 +#define INUM_IRQ1 17 +#define INUM_IRQ2 18 +#define INUM_IRQ3 19 +#define INUM_IRQ4 20 +#define INUM_IRQ5 21 +#define INUM_IRQ6 22 +#define INUM_IRQ7 23 +#define INUM_TSEC1_TX 32 +#define INUM_TSEC1_RX 33 +#define INUM_TSEC1_ERR 34 +#define INUM_TSEC2_TX 35 +#define INUM_TSEC2_RX 36 +#define INUM_TSEC2_ERR 37 +#define INUM_USB2_DR 38 +#define INUM_USB2_MPH 39 +#define INUM_IRQ0 48 +#define INUM_RTC_SEC 64 +#define INUM_PIT 65 +#define INUM_PCI1 66 +#define INUM_PCI2 67 +#define INUM_RTC_ALR 68 +#define INUM_MU 69 +#define INUM_SBA 70 +#define INUM_DMA 71 +#define INUM_GTM4 72 +#define INUM_GTM8 73 +#define INUM_CPIO1 74 +#define INUM_GPIO2 75 +#define INUM_DDR 76 +#define INUM_LBC 77 +#define INUM_GTM2 78 +#define INUM_GTM6 79 +#define INUM_PMC 80 +#define INUM_GTM3 84 +#define INUM_GTM7 85 +#define INUM_GTM1 90 +#define INUM_GTM5 91 + +#define INUM_MAX 128 +#define IVEC_MAX 128 + +#endif + +/* Interrupt Controller Registers */ + +#define QUICC_SICR(base) ((VINT32 *) ((base) + SIC_REG_BA + 0x000)) +#define QUICC_SIVEC(base) ((VINT32 *) ((base) + SIC_REG_BA + 0x004)) +#define QUICC_SIPNR_H(base) ((VINT32 *) ((base) + SIC_REG_BA + 0x008)) +#define QUICC_SIPNR_L(base) ((VINT32 *) ((base) + SIC_REG_BA + 0x00C)) + +#define QUICC_SIPRR_A(base) ((VINT32 *) ((base) + SIC_REG_BA + 0x010)) + +#define QUICC_SIPRR_D(base) ((VINT32 *) ((base) + SIC_REG_BA + 0x01C)) + +#define QUICC_SIMR_H(base) ((VINT32 *) ((base) + SIC_REG_BA + 0x020)) +#define QUICC_SIMR_L(base) ((VINT32 *) ((base) + SIC_REG_BA + 0x024)) + +#define QUICC_SICNR(base) ((VINT32 *) ((base) + SIC_REG_BA + 0x028)) +#define QUICC_SEPNR(base) ((VINT32 *) ((base) + SIC_REG_BA + 0x02C)) +#define QUICC_SMPRR_A(base) ((VINT32 *) ((base) + SIC_REG_BA + 0x030)) +#define QUICC_SMPRR_B(base) ((VINT32 *) ((base) + SIC_REG_BA + 0x034)) + +#define QUICC_SEMSR(base) ((VINT32 *) ((base) + SIC_REG_BA + 0x038)) +#define QUICC_SECNR(base) ((VINT32 *) ((base) + SIC_REG_BA + 0x03C)) + +#define QUICC_SERSR(base) ((VINT32 *) ((base) + SIC_REG_BA + 0x040)) +#define QUICC_SERMR(base) ((VINT32 *) ((base) + SIC_REG_BA + 0x044)) +#define QUICC_SERCR(base) ((VINT32 *) ((base) + SIC_REG_BA + 0x048)) + + +#define QUICC_SIFCR_H(base) ((VINT32 *) ((base) + SIC_REG_BA + 0x050)) +#define QUICC_SIFCR_L(base) ((VINT32 *) ((base) + SIC_REG_BA + 0x054)) +#define QUICC_SEFCR(base) ((VINT32 *) ((base) + SIC_REG_BA + 0x058)) +#define QUICC_SERFR(base) ((VINT32 *) ((base) + SIC_REG_BA + 0x05C)) +#define QUICC_SCVCR(base) ((VINT32 *) ((base) + SIC_REG_BA + 0x060)) +#define QUICC_SMVCR(base) ((VINT32 *) ((base) + SIC_REG_BA + 0x064)) + +/* interrupt handler */ + +#ifndef _ASMLANGUAGE +typedef struct intr_handler + { + VOIDFUNCPTR vec; /* interrupt vector */ + int arg; /* interrupt handler argument */ + void *pNext; + } INTR_HANDLER; + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT STATUS quiccIntrInit (); +extern STATUS quiccIntDisable (int ); +IMPORT STATUS quiccIntEnable (int ); +extern int quiccIvecToInum(VOIDFUNCPTR *); +extern VOIDFUNCPTR * quiccInumToIvec(int); + +#else + +IMPORT STATUS quiccIntrInit (); +extern STATUS quiccIntDisable (); +IMPORT STATUS quiccIntEnable (); +extern int quiccIvecToInum(); +extern VOIDFUNCPTR * quiccInumToIvec(); + +#endif /* __STDC__ */ +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCquiccIntrCtlh */ diff --git a/h/drv/intrCtl/s68154.h b/h/drv/intrCtl/s68154.h new file mode 100644 index 0000000..3e33cb9 --- /dev/null +++ b/h/drv/intrCtl/s68154.h @@ -0,0 +1,51 @@ +/* s68154.h - Signetics 68154 Interrupt Generator header file */ + +/* Copyright 1984-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,02mar93,eve upgraded for 5.1 +01a,19mar90,trl written +*/ + +#ifndef __INCs68154h +#define __INCs68154h + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* registers */ + +#define IGR_VEC_REG(base) ((char *) (base) + 0) /* vector r/w */ +#define IGR_REQ_REG(base) ((char *) (base) + 2) /* request r/w */ + + +/* interrupt vector register */ + +#define IGR_ENABLE_INT 0x02 +#define IGR_CLEAR_INT 0x04 +#define IGR_INT_MASK 0xf8 /* bits 3-7 of interrupt vector */ + + +/* interrupt request register */ + +#define IGR_IRQ1 0x02 +#define IGR_IRQ2 0x04 +#define IGR_IRQ3 0x08 +#define IGR_IRQ4 0x10 +#define IGR_IRQ5 0x20 +#define IGR_IRQ6 0x40 +#define IGR_IRQ7 0x80 + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCs68154h */ diff --git a/h/drv/intrCtl/s68155.h b/h/drv/intrCtl/s68155.h new file mode 100644 index 0000000..d50fc2d --- /dev/null +++ b/h/drv/intrCtl/s68155.h @@ -0,0 +1,116 @@ +/* s68155.h - Signetics 68155 Interrupt Handler header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01e,22sep92,rrr added support for c++ +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -changed copyright notice +01b,05oct90,shl added copyright notice. + made #endif ANSI style. +01a,05Dec88,jcf written. +*/ + +#ifndef __INCs68155h +#define __INCs68155h + +#ifdef __cplusplus +extern "C" { +#endif + + +/* IRHDL addresses */ + +#define IHDL_PTR(base) ((char *) ((base) + 0x01)) /* pointer -> CRn */ +#define IHDL_CR(base) ((char *) ((base) + 0x03)) /* control reg */ +#define IHDL_VEC(base) ((char *) ((base) + 0x05)) /* interrupt vec. */ +#define IHDL_LOCAL_MASK(base) ((char *) ((base) + 0x07)) /* local int. mask */ +#define IHDL_LOCAL_STATUS(base) ((char *) ((base) + 0x09)) /* local status */ +#define IHDL_BUS_MASK(base) ((char *) ((base) + 0x0b)) /* system bus mask */ +#define IHDL_BUS_STATUS(base) ((char *) ((base) + 0x0d)) /* system bus stat */ +#define IHDL_LAST_ACK(base) ((char *) ((base) + 0x0f)) /* last acknowledge*/ + +/* control registers */ + +#define IHDL_CR1 0x1 /* local interrupt level 1 */ +#define IHDL_CR2 0x2 /* local interrupt level 2 */ +#define IHDL_CR3 0x3 /* local interrupt level 3 */ +#define IHDL_CR4 0x4 /* local interrupt level 4 */ +#define IHDL_CR5 0x5 /* local interrupt level 5 */ +#define IHDL_CR6 0x6 /* local interrupt level 6 */ + +/* equates for control register */ + +#define IHDL_CR_HIGH 0x1 /* interrupt asserted high (unlikely) */ +#define IHDL_CR_EDGE 0x2 /* input is edge sensitive (likely) */ +#define IHDL_CR_VECTOR 0x4 /* IRHDL provides vector */ + +/* equates for vector register */ + +#define IHDL_VEC_MASK 0xf8 /* low three bits always read as zero */ + +/* equates for local mask */ + +#define IHDL_LOCAL_MASK_NMI_VEC 0x1 /* 1 = active high */ +#define IHDL_LOCAL_MASK_1 0x2 /* 1 = local interrupt 1 enabled */ +#define IHDL_LOCAL_MASK_2 0x4 /* 1 = local interrupt 2 enabled */ +#define IHDL_LOCAL_MASK_3 0x8 /* 1 = local interrupt 3 enabled */ +#define IHDL_LOCAL_MASK_4 0x10 /* 1 = local interrupt 4 enabled */ +#define IHDL_LOCAL_MASK_5 0x20 /* 1 = local interrupt 5 enabled */ +#define IHDL_LOCAL_MASK_6 0x40 /* 1 = local interrupt 6 enabled */ +#define IHDL_LOCAL_MASK_NMI 0x80 /* 1 = NMI enabled */ + +/* equates for local status */ + +#define IHDL_LOCAL_STATUS_1 0x2 /* 1 = local interrupt 1 */ +#define IHDL_LOCAL_STATUS_2 0x4 /* 1 = local interrupt 2 */ +#define IHDL_LOCAL_STATUS_3 0x8 /* 1 = local interrupt 3 */ +#define IHDL_LOCAL_STATUS_4 0x10 /* 1 = local interrupt 4 */ +#define IHDL_LOCAL_STATUS_5 0x20 /* 1 = local interrupt 5 */ +#define IHDL_LOCAL_STATUS_6 0x40 /* 1 = local interrupt 6 */ +#define IHDL_LOCAL_STATUS_NMI 0x80 /* 1 = NMI */ + +/* equates for bus mask */ + /* low bit always reads as zero */ +#define IHDL_BUS_MASK_1 0x2 /* 1 = bus interrupt 1 enabled */ +#define IHDL_BUS_MASK_2 0x4 /* 1 = bus interrupt 2 enabled */ +#define IHDL_BUS_MASK_3 0x8 /* 1 = bus interrupt 3 enabled */ +#define IHDL_BUS_MASK_4 0x10 /* 1 = bus interrupt 4 enabled */ +#define IHDL_BUS_MASK_5 0x20 /* 1 = bus interrupt 5 enabled */ +#define IHDL_BUS_MASK_6 0x40 /* 1 = bus interrupt 6 enabled */ +#define IHDL_BUS_MASK_7 0x80 /* 1 = bus interrupt 7 enabled */ + +/* equates for bus status */ + /* low bit always reads as zero */ +#define IHDL_BUS_STATUS_1 0x2 /* 1 = bus interrupt 1 */ +#define IHDL_BUS_STATUS_2 0x4 /* 1 = bus interrupt 2 */ +#define IHDL_BUS_STATUS_3 0x8 /* 1 = bus interrupt 3 */ +#define IHDL_BUS_STATUS_4 0x10 /* 1 = bus interrupt 4 */ +#define IHDL_BUS_STATUS_5 0x20 /* 1 = bus interrupt 5 */ +#define IHDL_BUS_STATUS_6 0x40 /* 1 = bus interrupt 6 */ +#define IHDL_BUS_STATUS_7 0x80 /* 1 = bus interrupt 7 */ + +/* equates for last acknowledge */ + +#define IHDL_LAST_ACK_BUS_1 0x1 +#define IHDL_LAST_ACK_BUS_2 0x2 +#define IHDL_LAST_ACK_BUS_3 0x3 +#define IHDL_LAST_ACK_BUS_4 0x4 +#define IHDL_LAST_ACK_BUS_5 0x5 +#define IHDL_LAST_ACK_BUS_6 0x6 +#define IHDL_LAST_ACK_BUS_7 0x7 +#define IHDL_LAST_ACK_LOCAL_1 0x9 +#define IHDL_LAST_ACK_LOCAL_2 0xa +#define IHDL_LAST_ACK_LOCAL_3 0xb +#define IHDL_LAST_ACK_LOCAL_4 0xc +#define IHDL_LAST_ACK_LOCAL_5 0xd +#define IHDL_LAST_ACK_LOCAL_6 0xe +#define IHDL_LAST_ACK_NMI 0xf + +#ifdef __cplusplus +} +#endif + +#endif /* __INCs68155h */ diff --git a/h/drv/intrCtl/sa150xIntrCtl.h b/h/drv/intrCtl/sa150xIntrCtl.h new file mode 100644 index 0000000..6f34b92 --- /dev/null +++ b/h/drv/intrCtl/sa150xIntrCtl.h @@ -0,0 +1,161 @@ +/* sa150xIntrCtl.h - ARM 1500/1501 interrupt controller */ + +/* Copyright 1998 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,23sep98,cdp written. +*/ + +#ifndef __INCsa150xIntrCtlh +#define __INCsa150xIntrCtlh + +#ifdef __cplusplus +extern "C" { +#endif + + +#define SA150X_INT_REG_ADDR_INTERVAL 16 +#ifdef _ASMLANGUAGE +#define SA150X_INT_ADRS(base,reg) ((base) + \ + (reg)*SA150X_INT_REG_ADDR_INTERVAL) +#else +#define SA150X_INT_ADRS(base,reg) ((UINT32)(base) + \ + (reg)*SA150X_INT_REG_ADDR_INTERVAL) +#endif + +/* interrupt controller registers */ + +#define SA150X_INT_DESTINATION(base) SA150X_INT_ADRS(base,0) +#define SA150X_INT_SPECIAL(base) SA150X_INT_ADRS(base,1) +#define SA150X_INT_ENABLE(base) SA150X_INT_ADRS(base,2) +#define SA150X_INT_POLARITY(base) SA150X_INT_ADRS(base,3) +#define SA150X_INT_IRQ_REQUEST(base) SA150X_INT_ADRS(base,4) +#define SA150X_INT_FIQ_REQUEST(base) SA150X_INT_ADRS(base,5) +#define SA150X_INT_STATUS(base) SA150X_INT_ADRS(base,6) +#define SA150X_INT_CLEAR(base) SA150X_INT_STATUS(base) +#define SA150X_INT_SOURCE(base) SA150X_INT_ADRS(base,7) +#define SA150X_INT_SET(base) SA150X_INT_SOURCE(base) + + +#ifndef _ASMLANGUAGE + +/* hardware access methods */ + +#ifndef SA150X_INT_REG_READ +#define SA150X_INT_REG_READ(a,val) ((val) = *(volatile UINT32 *)(a)) +#endif + +#ifndef SA150X_INT_REG_WRITE +#define SA150X_INT_REG_WRITE(a,val) (*(volatile UINT32 *)(a) = (val)) +#endif + +#if defined(SA150X_INT_RETRY_WRITES) && \ + !defined(SA150X_INT_REG_WRITE_RETRY) +#define SA150X_INT_REG_WRITE_RETRY(reg,val) \ + { \ + UINT32 _rVal, _wVal; \ + _wVal = (val); \ + do \ + { \ + SA150X_INT_REG_WRITE ((reg), _wVal); \ + SA150X_INT_REG_READ ((reg), _rVal); \ + } \ + while (_rVal != _wVal); \ + } +#endif + +#ifndef SA150X_INT_REQ_REG_READ +#ifdef SA150X_INT_RETRY_READS +#define SA150X_INT_REQ_REG_READ(reg,val,mask,tries,ok) \ + { \ + int _i; \ + for (_i = 0; _i < (tries); ++_i) \ + { \ + SA150X_INT_REG_READ ((reg), (val)); \ + if (((val) & (mask)) == 0) \ + break; \ + } \ + (ok) = _i < tries; \ + } +#else +#define SA150X_INT_REQ_REG_READ(reg,val,mask,tries,ok) \ + SA150X_INT_REG_READ ((reg), (val)); +#endif +#endif + + +/* structure describing an interrupt controller */ + +typedef struct + { + /* + * The following values should be initialised in the BSP before + * the interrupt driver is initialised. + */ + + volatile UINT32 * base; /* base of registers */ +#ifdef SA150X_INT_HANDLE_1501_DESTINATION + UINT32 destModifier; /* EOR with destination reg */ +#endif + + /* + * The following value should be initialised in the BSP to the FIQ + * bits enabled prior to the call to sa150xIntDevInit() (e.g. by + * sysInit) or 0 if no FIQ sources are enabled until after that + * call. Calls to sa150xIntFiqEnable/Disable will change bits in + * this word. It should not be changed by any other means. + */ + + UINT32 enabledFiqs; /* FIQs currently enabled */ + + /* + * The following values are reserved for internal use by the + * interrupt driver and should not be changed by anything else. + * They do not require initialisation by the BSP. + */ + + UINT32 enabledIrqs; /* IRQs enabled by intEnable */ +#ifdef SA150X_INT_CACHE_IRQ_REQUEST + UINT32 irqRequests; /* cached current requests */ + int requestsValid; /* is irqRequests valid */ +#endif + } sa150xIntrCtlDetails; + + +/* interrupt feature bits for configuration */ + +#define SA150X_INT_POLARITY_NEGATIVE (0 << 0) +#define SA150X_INT_POLARITY_POSITIVE (1 << 0) +#define SA150X_INT_TYPE_EDGE (0 << 1) +#define SA150X_INT_TYPE_LEVEL (1 << 1) +#define SA150X_INT_DESTINATION_IRQ (0 << 2) +#define SA150X_INT_DESTINATION_FIQ (1 << 2) + + +IMPORT STATUS sa150xIntLvlConfigure (int level, int features); + + +/* macro to convert level number to vector number */ + +#ifndef SA150X_INT_LVL_VEC_MAP +# define SA150X_INT_LVL_VEC_MAP(level, vector) \ + ((vector) = ((level) + SA150X_INT_VEC_BASE)) +#endif + + +#endif /* _ASMLANGUAGE */ + + +/* debug macro */ + +#ifndef SA150X_INT_DEBUG +#define SA150X_INT_DEBUG(a,b) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsa150xIntrCtlh */ diff --git a/h/drv/manager/device.h b/h/drv/manager/device.h new file mode 100644 index 0000000..5b00f4d --- /dev/null +++ b/h/drv/manager/device.h @@ -0,0 +1,63 @@ +/* device.h - Removable device header file */ + +/* Copyright 2004 Wind River Systems, Inc */ + +/* +modification history +-------------------- +01b,20apr05,rfr Added devName() function +01a,25mar05,rfr Removed prototype eventing system. +*/ + +#ifndef __INCdeviceh +#define __INCdeviceh + +#include + +#define MAX_DEVNAME 10 + +#define NULLDEV 0 + +#define DV_TYPE_NONE 0 +#define DV_TYPE_XBD 1 + + +struct device; + +typedef uint32_t device_t; +typedef char devname_t[MAX_DEVNAME]; + +struct device +{ + device_t dv_dev; /* This device's device_t */ + int dv_type; /* DV_TYPE_XBD, etc */ + devname_t dv_xname; /* The name of this device */ + int dv_error; /* insert/delete errors */ +}; + +/* +* These are functions to be called by device drivers that conform to this +* interface. +*/ + +int devAttach(struct device *dev, const char *name, int type, device_t *result); +STATUS devDetach(struct device *dev); + +/* +* This is the initialization function for the device infrastructure. It must be +* called before any other device infrastructure calls +*/ + +STATUS devInit(uint16_t ndevs); + +/* +* These functions manage the mapping between device_t and struct device *. +* Every call to devMap() should be paired with a call to devUnmap(). +*/ + +struct device *devMap(device_t dev); +int devUnmap(struct device *); + +STATUS devName(device_t dev, devname_t name); + +#endif diff --git a/h/drv/mem/amd29LV800TMem.h b/h/drv/mem/amd29LV800TMem.h new file mode 100644 index 0000000..55a5607 --- /dev/null +++ b/h/drv/mem/amd29LV800TMem.h @@ -0,0 +1,90 @@ +/* amd29LV800TMem.h - AMD 29LV800T FLASH memory header */ + +/* Copyright 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,22jun01,g_h remove sysNvRamGet() & sysNvRamSet() prototype +01a,22apr01,g_h created. +*/ + +/* +DESCRIPTION +This file contains header information for AMD 29LV800T FLASH memory routines. +*/ + +#ifndef __INCamd29LV800TMemh +#define __INCamd29LV800TMemh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ +#ifndef UINT64 +#define UINT64 unsigned long long +#endif + +#define BLOCKS (sizeof(blocks) / sizeof(tBLOCK)) + +#if __PACKUNALIGNED__ +typedef __packed__ struct tSOURCE +{ + UINT64 Integer; +} _PackedType tSOURCE; +#define readUnaligned(x) ((tSOURCE *)(x))->Integer +#else +#define readUnaligned(x) *(UINT64 *)(x) +#endif + +#ifdef __LITTLE_ENDIAN__ +#define MASKSHIFTOP1 << +#define MASKSHIFTOP2 >> +#else +#define MASKSHIFTOP1 >> +#define MASKSHIFTOP2 << +#endif + + +/* typedefs */ +typedef float FLOAT; +typedef double DOUBLE; + +typedef union tFLASH +{ + UINT32 Halves[2]; + UINT64 Integer; + DOUBLE Float; +} tFLASH; + +typedef struct tBLOCK +{ + UINT16 Number; + UINT16 Size; +} tBLOCK; + +/* function declarations */ + +#ifndef _ASMLANGUAGE +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT UINT32 amd29LV800TWrite(volatile UINT8 *pDest, UINT8 *pSource, UINT32 Length); +IMPORT UINT32 amd29LV800TEraseBlock(volatile UINT8 *pChip, volatile UINT8 *pSector); +IMPORT UINT32 amd29LV800TEraseSector(volatile UINT8 *pSector); + +#else /* __STDC__ */ + +IMPORT UINT32 amd29LV800TWrite(); +IMPORT UINT32 amd29LV800TEraseBlock(); +IMPORT UINT32 amd29LV800TEraseSector(); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCamd29LV800TMemh */ diff --git a/h/drv/mem/flash28.h b/h/drv/mem/flash28.h new file mode 100644 index 0000000..3f51f4f --- /dev/null +++ b/h/drv/mem/flash28.h @@ -0,0 +1,69 @@ +/* flash28.h - header for 28FXXX FLASH memory devices */ + +/* Copyright 1994-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,15feb01,frf added intel Flash 28F128J3A,28F320J3A,28F640J3A support. +01h,01feb00,jpd added defs for Intel 28F320, Sharp 28F160S3. SPR 31293 +01e,28aug98,jpd added 28F016 defs, including FLASH_WIDTH_SPECIAL_2 version. +01f,03aug99,dat merge from HIT group T2 branch +01e,04may99,cn added 28F016 definitions. +01d,04jul97,jpd added 28F008 definitions. +01c,26jan96,dzb added casts for CMD constants. +01b,24feb94,dzb added device codes for different flash devices. +01a,10feb94,dzb created. +*/ + +/* +DESCRIPTION +This file contains header information for 28F0X0 FLASH memory devices. +*/ + +#ifndef __INCflash28h +#define __INCflash28h + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define FLASH28_CMD_READ_MEM (FLASH_DEF) 0x00000000 +#define FLASH28_CMD_READ_ID (FLASH_DEF) 0x90909090 +#define FLASH28_CMD_ERASE_SETUP (FLASH_DEF) 0x20202020 +#define FLASH28_CMD_ERASE (FLASH_DEF) 0x20202020 +#define FLASH28_CMD_ERASE_VERIFY (FLASH_DEF) 0xa0a0a0a0 +#define FLASH28_CMD_PROG_SETUP (FLASH_DEF) 0x40404040 +#define FLASH28_CMD_PROG_VERIFY (FLASH_DEF) 0xc0c0c0c0 +#define FLASH28_CMD_RESET (FLASH_DEF) 0xffffffff +#define FLASH28F008_CMD_READ_STATUS (FLASH_DEF) 0x70707070 +#define FLASH28F008_CMD_CLEAR_STATUS (FLASH_DEF) 0x50505050 +#define FLASH28F008_CMD_ERASE (FLASH_DEF) 0xD0D0D0D0 + +#ifdef FLASH_WIDTH_SPECIAL_2 +#define FLASH28F008_STAT_WSMS (FLASH_DEF) 0x00800080 +#else +#define FLASH28F008_STAT_WSMS (FLASH_DEF) 0x80808080 +#endif /* FLASH_WIDTH_SPECIAL_2 */ +#define FLASH28F008_STAT_BWS (FLASH_DEF) 0x10101010 +#define FLASH28F008_STAT_EWS (FLASH_DEF) 0x20202020 + +#define FLASH_28F256 0xa1 /* device code 28F256 */ +#define FLASH_28F512 0x25 /* device code 28F512 */ +#define FLASH_28F128J3A 0x18 /* device code 28F128 */ +#define FLASH_28F640J3A 0x17 /* device code 28F640 */ +#define FLASH_28F320J3A 0x16 /* device code 28F320 */ +#define FLASH_28F010 0xa7 /* device code 28F010 */ +#define FLASH_28F020 0x2a /* device code 28F020 */ +#define FLASH_28F008 0xa2 /* device code 28F008 */ +#define FLASH_28F016 0xaa /* device code 28F016 */ +#define FLASH_28F160 0xd0 /* device code 28F160 */ +#define FLASH_28F320 0xd4 /* device code 28F320 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCflash28h */ diff --git a/h/drv/mem/flash29.h b/h/drv/mem/flash29.h new file mode 100644 index 0000000..7f58d3c --- /dev/null +++ b/h/drv/mem/flash29.h @@ -0,0 +1,69 @@ +/* flash29.h - header for 29F0X0 FLASH memory devices */ + +/* Copyright 1994-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,13feb01,frf added AM29LV040B definition. +01e,23mar00,zl added 29LV160T and 29LV160B definitions +01d,06mar98,jpd added 29LV1024 and 29C040A definitions. +01c,26jan96,dzb added casts for CMD constants. + +jpb changed CAST to CAST_CH. +01b,24feb94,dzb made device code 1 byte. +01a,10feb94,dzb created. +*/ + +/* +DESCRIPTION +This file contains header information for 29F0X0 FLASH memory devices. +*/ + +#ifndef __INCflash29h +#define __INCflash29h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _ASMLANGUAGE +#define CAST_CH +#else /* _ASMLANGUAGE */ +#define CAST_CH (char *) +#endif /* _ASMLANGUAGE */ + +#ifndef FLASH29_REG_ADRS +#define FLASH29_REG_ADRS(reg) (CAST_CH FLASH_ADRS + (reg * FLASH_WIDTH)) +#endif /* FLASH29_REG_ADRS */ + +/* FLASH29 command register addresses */ + +#define FLASH29_REG_FIRST_CYCLE FLASH29_REG_ADRS (0x5555) +#define FLASH29_REG_SECOND_CYCLE FLASH29_REG_ADRS (0x2aaa) + +/* FLASH29 command definitions */ + +#define FLASH29_CMD_FIRST (FLASH_DEF) 0xaaaaaaaa +#define FLASH29_CMD_SECOND (FLASH_DEF) 0x55555555 +#define FLASH29_CMD_FOURTH (FLASH_DEF) 0xaaaaaaaa +#define FLASH29_CMD_FIFTH (FLASH_DEF) 0x55555555 +#define FLASH29_CMD_SIXTH (FLASH_DEF) 0x10101010 +#define FLASH29_CMD_SECTOR (FLASH_DEF) 0x30303030 + +#define FLASH29_CMD_PROGRAM (FLASH_DEF) 0xa0a0a0a0 +#define FLASH29_CMD_CHIP_ERASE (FLASH_DEF) 0x80808080 +#define FLASH29_CMD_READ_RESET (FLASH_DEF) 0xf0f0f0f0 +#define FLASH29_CMD_AUTOSELECT (FLASH_DEF) 0x90909090 + +#define FLASH_29F010 0x20 /* device code 29F010 */ +#define FLASH_29C040A 0xA4 /* device code 29C040A */ +#define FLASH_29LV1024 0x26 /* device code 29LV1024 */ +#define FLASH_29LV160T 0xC4 /* device code 29LV160T */ +#define FLASH_29LV160B 0x49 /* device code 29LV160B */ +#define FLASH_29LV040B 0x4f /* device code 29LV040B */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCflash29h */ diff --git a/h/drv/mem/flashDev.h b/h/drv/mem/flashDev.h new file mode 100644 index 0000000..b36a52f --- /dev/null +++ b/h/drv/mem/flashDev.h @@ -0,0 +1,81 @@ +/* flashDev.h - generic FLASH memory header */ + +/* Copyright 1994-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,27mar00,zl added FLASH_CHIP_WIDTH and FLASH_POLL_DEF +01a,08jan94,dzb created. +*/ + +/* +DESCRIPTION +This file contains header information for generic FLASH memory routines. +*/ + +#ifndef __INCflashDevh +#define __INCflashDevh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#if (FLASH_WIDTH == 1) +#define FLASH_DEF UINT8 +#define FLASH_CAST (UINT8 *) +#endif /* FLASH_WIDTH */ + +#if (FLASH_WIDTH == 2) +#define FLASH_DEF UINT16 +#define FLASH_CAST (UINT16 *) +#endif /* FLASH_WIDTH */ + +#if (FLASH_WIDTH == 4) +#define FLASH_DEF UINT32 +#define FLASH_CAST (UINT32 *) +#endif /* FLASH_WIDTH */ + +/* Define the width of the chip itself */ + +#ifndef FLASH_CHIP_WIDTH +#define FLASH_CHIP_WIDTH 1 /* default to 1 byte */ +#endif /* FLASH_CHIP_WIDTH */ + +#if (FLASH_CHIP_WIDTH == 1) +#define FLASH_POLL_DEF UINT8 +#define FLASH_POLL_CAST (UINT8 *) +#elif (FLASH_CHIP_WIDTH == 2) +#define FLASH_POLL_DEF UINT16 +#define FLASH_POLL_CAST (UINT16 *) +#elif (FLASH_CHIP_WIDTH == 4) +#define FLASH_POLL_DEF UINT32 +#define FLASH_POLL_CAST (UINT32 *) +#endif /* FLASH_CHIP_WIDTH */ + +#define FLASH_UNKNOWN 0 + +/* function declarations */ + +#ifndef _ASMLANGUAGE +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT STATUS sysFlashGet (char *string, int strLen, int offset); +IMPORT STATUS sysFlashSet (char *string, int strLen, int offset); + +#else /* __STDC__ */ + +IMPORT STATUS sysFlashGet (); +IMPORT STATUS sysFlashSet (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCflashDevh */ diff --git a/h/drv/mem/i28f640j3mem.h b/h/drv/mem/i28f640j3mem.h new file mode 100644 index 0000000..be39de1 --- /dev/null +++ b/h/drv/mem/i28f640j3mem.h @@ -0,0 +1,68 @@ +/****************************************************************************** +* +* Module: flash.h +* +* Description: Flash Module Definitions +* +* Project: HSI VisionWare -- vWare +* +* Functions: +* +* Notes: +* +* History: See Visual SourceSafe History +* +* Disclaimer: Copyright 1999-2000 Wind River Systems, Inc. All Rights Reserved +* +*******************************************************************************/ +/* i28F640J3Mem.h - Intel 28F640J3 FLASH memory header */ + +/* Copyright 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,16apr01,gh created. +*/ + +/* +DESCRIPTION +This file contains header information for Intel 28F640J3 FLASH memory routines. +*/ + +#ifndef __INCi28F640J3Memh +#define __INCi28F640J3Memh + +#ifdef __cplusplus +extern "C" { +#endif + +/* typedefs */ +typedef union tFLASH +{ + UINT8 Integer; + UINT8 Float; +} tFLASH; + +/* function declarations */ + +#ifndef _ASMLANGUAGE +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT STATUS sysNvRamGet(char *string, int strLen, int offset); +IMPORT STATUS sysNvRamSet(char *string, int strLen, int offset); + +#else /* __STDC__ */ + +IMPORT STATUS sysNvRamGet(); +IMPORT STATUS sysNvRamSet(); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCi28F640J3Memh */ diff --git a/h/drv/mem/iFlash.h b/h/drv/mem/iFlash.h new file mode 100644 index 0000000..dcc666d --- /dev/null +++ b/h/drv/mem/iFlash.h @@ -0,0 +1,55 @@ +/* iFlash.h - Intel Flash Memory header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,30oct92,ccc created. +*/ + +/* +DESCRIPTION +This file contains header information for the Intel 256 Flash Memory device. +*/ + +#ifndef __INCiFlashh +#define __INCiFlashh + +#ifdef __cplusplus +extern "C" { +#endif + +/* device constants */ + +#define FLASH_CMD_READ_MEM 0x0000 +#define FLASH_CMD_READ_ID 0x9090 +#define FLASH_CMD_ERASE_SETUP 0x2020 +#define FLASH_CMD_ERASE 0x2020 +#define FLASH_CMD_ERASE_VERIFY 0xa0a0 +#define FLASH_CMD_PROG_SETUP 0x4040 +#define FLASH_CMD_PROG_VERIFY 0xc0c0 +#define FLASH_CMD_RESET 0xffff + +/* function declarations */ + +#ifndef _ASMLANGUAGE +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT STATUS sysNvRamGet (char *string, int strLen, int offset); +IMPORT STATUS sysNvRamSet (char *string, int strLen, int offset); + +#else /* __STDC__ */ + +IMPORT STATUS sysNvRamGet (); +IMPORT STATUS sysNvRamSet (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCiFlashh */ diff --git a/h/drv/mem/m8260Memc.h b/h/drv/mem/m8260Memc.h new file mode 100644 index 0000000..4fe652c --- /dev/null +++ b/h/drv/mem/m8260Memc.h @@ -0,0 +1,269 @@ +/* m8260Memc.h - Motorola MPC8260 Memory Controller header file */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,29may01,rcs removed nonexistant MCR, set MAR and MDR to correct offsets, + changed MSTAT to MCMR (SPR#63210) +01a,12sep99,ms_ created from m8260Cpm.h, 01d. +*/ + +/* + * This file contains constants for the Memory Controller in the + * Motorola MPC8260 PowerQUICC II integrated Communications Processor + */ + +#ifndef __INCm8260Memch +#define __INCm8260Memch + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef M8260ABBREVIATIONS +#define M8260ABBREVIATIONS + +#ifdef _ASMLANGUAGE +#define CAST(x) +#else /* _ASMLANGUAGE */ +typedef volatile UCHAR VCHAR; /* shorthand for volatile UCHAR */ +typedef volatile INT32 VINT32; /* volatile unsigned word */ +typedef volatile INT16 VINT16; /* volatile unsigned halfword */ +typedef volatile INT8 VINT8; /* volatile unsigned byte */ +typedef volatile UINT32 VUINT32; /* volatile unsigned word */ +typedef volatile UINT16 VUINT16; /* volatile unsigned halfword */ +typedef volatile UINT8 VUINT8; /* volatile unsigned byte */ +#define CAST(x) (x) +#endif /* _ASMLANGUAGE */ + +#endif /* M8260ABBREVIATIONS */ + +/* + * MPC8260 internal register/memory map (section 17 of prelim. spec) + * note that these are offsets from the value stored in the IMMR + * register. Also note that in the MPC8260, the IMMR is not a special + * purpose register, but it is memory mapped. + */ + +/* + * Memory Controller registers + */ + +/* Base Reg bank 0*/ + +#define M8260_BR0(base) (CAST(VUINT32 *)((base) + 0x10100)) + +/* Opt Reg bank 0*/ + +#define M8260_OR0(base) (CAST(VUINT32 *)((base) + 0x10104)) + +/* Base Reg bank 1*/ + +#define M8260_BR1(base) (CAST(VUINT32 *)((base) + 0x10108)) + +/* Opt Reg bank 1*/ + +#define M8260_OR1(base) (CAST(VUINT32 *)((base) + 0x1010c)) + +/* Base Reg bank 2*/ + +#define M8260_BR2(base) (CAST(VUINT32 *)((base) + 0x10110)) + +/* Opt Reg bank 2*/ + +#define M8260_OR2(base) (CAST(VUINT32 *)((base) + 0x10114)) + +/* Base Reg bank 3*/ + +#define M8260_BR3(base) (CAST(VUINT32 *)((base) + 0x10118)) + +/* Opt Reg bank 3*/ + +#define M8260_OR3(base) (CAST(VUINT32 *)((base) + 0x1011c)) + +/* Base Reg bank 4*/ + +#define M8260_BR4(base) (CAST(VUINT32 *)((base) + 0x10120)) + +/* Opt Reg bank 4*/ + +#define M8260_OR4(base) (CAST(VUINT32 *)((base) + 0x10124)) + +/* Base Reg bank 5*/ + +#define M8260_BR5(base) (CAST(VUINT32 *)((base) + 0x10128)) + +/* Opt Reg bank 5*/ + +#define M8260_OR5(base) (CAST(VUINT32 *)((base) + 0x1012c)) + +/* Base Reg bank 6*/ + +#define M8260_BR6(base) (CAST(VUINT32 *)((base) + 0x10130)) + +/* Opt Reg bank 6*/ + +#define M8260_OR6(base) (CAST(VUINT32 *)((base) + 0x10134)) + +/* Base Reg bank 7*/ + +#define M8260_BR7(base) (CAST(VUINT32 *)((base) + 0x10138)) + +/* Opt Reg bank 7*/ + +#define M8260_OR7(base) (CAST(VUINT32 *)((base) + 0x1013c)) + +/* Base Reg bank 8*/ + +#define M8260_BR8(base) (CAST(VUINT32 *)((base) + 0x10140)) + +/* Opt Reg bank 8*/ + +#define M8260_OR8(base) (CAST(VUINT32 *)((base) + 0x10144)) + +/* Base Reg bank 9*/ + +#define M8260_BR9(base) (CAST(VUINT32 *)((base) + 0x10148)) + +/* Opt Reg bank 9*/ + +#define M8260_OR9(base) (CAST(VUINT32 *)((base) + 0x1014c)) + +/* Base Reg bank 10*/ + +#define M8260_BR10(base) (CAST(VUINT32 *)((base) + 0x10150)) + +/* Opt Reg bank 10*/ + +#define M8260_OR10(base) (CAST(VUINT32 *)((base) + 0x10154)) + +/* Base Reg bank 11*/ + +#define M8260_BR11(base) (CAST(VUINT32 *)((base) + 0x10158)) + +/* Opt Reg bank 11*/ + +#define M8260_OR11(base) (CAST(VUINT32 *)((base) + 0x1015c)) + +#define MAR(base) (CAST(VUINT32 *)((base) + 0x0168)) /* Memory Address */ +#define MBMR(base) (CAST(VUINT32 *)((base) + 0x0174)) /* Machine B Mode */ +#define MCMR(base) (CAST(VUINT16 *)((base) + 0x0178)) /* Machine C Mode */ +#define MDR(base) (CAST(VUINT32 *)((base) + 0x0188)) /* Memory Data */ + +/* Mem Timer Presc*/ + +#define M8260_MPTPR(base) (CAST(VUINT16 *)((base) + 0x10184)) + +/* SDRAM refresh timer */ + +#define M8260_PSRT(base) (CAST(VUINT16 *)((base) + 0x1019c)) + +/* 60x bus SDRAM mode register */ + +#define M8260_PSDMR(base) (CAST(VUINT16 *)((base) + 0x10190)) + +/* Base Register bit definition */ + +#define M8260_BR_BA_MSK 0xffff8000 /* Base Address Mask */ +#define M8260_BR_RES_MSK 0x00006000 /* reserved field Mask */ +#define M8260_BR_PS_MSK 0x00001800 /* Port Size Mask */ +#define M8260_BR_PS_8 0x00000800 /* 8 bit port size */ +#define M8260_BR_PS_16 0x00001000 /* 16 bit port size */ +#define M8260_BR_PS_32 0x00001800 /* 32 bit port size */ +#define M8260_BR_PS_64 0x00000000 /* 64 bit port size */ +#define M8260_BR_DECC_MSK 0x00000600 /* data error checking */ +#define M8260_BR_DECC_DIS 0x00000000 /* error checking disabled */ +#define M8260_BR_DECC_NOR 0x00000200 /* normal parity checking */ +#define M8260_BR_DECC_RMW 0x00000400 /* RMW parity checking */ +#define M8260_BR_DECC_ECC 0x00000600 /* ECC checking */ +#define M8260_BR_WP 0x00000100 /* Write Protect */ +#define M8260_BR_MS_MSK 0x000000e0 /* Machine Select Mask */ +#define M8260_BR_MS_GPCM_60X 0x00000000 /* G.P.C.M. 60x Bus Machine */ +#define M8260_BR_MS_GPCM_LOC 0x00000020 /* G.P.C.M. Local Bus Machine */ +#define M8260_BR_MS_SDRAM_60X 0x00000040 /* SDRAM 60x Bus Machine */ +#define M8260_BR_MS_SDRAM_LOC 0x00000060 /* SDRAM Local Bus Machine */ +#define M8260_BR_MS_UPMA 0x00000080 /* U.P.M.A Machine */ +#define M8260_BR_MS_UPMB 0x000000a0 /* U.P.M.B Machine */ +#define M8260_BR_MS_UPMC 0x000000c0 /* U.P.M.C Machine */ +#define M8260_BR_EMEMC 0x00000010 /* External Memory Controller */ +#define M8260_BR_ATOM_MSK 0x0000000c /* Atomic Operation Mask */ +#define M8260_BR_ATOM_NOT 0x00000000 /* No Atomic Operation */ +#define M8260_BR_ATOM_RAWA 0x00000004 /* RAWA Atomic Operation */ +#define M8260_BR_ATOM_WARA 0x00000008 /* WARA Atomic Operation */ +#define M8260_BR_DR 0x00000002 /* Data Pipelining */ +#define M8260_BR_V 0x00000001 /* Bank Valid */ + +/* Option Register bit definition */ + +#define M8260_OR_AM_MSK 0xffff8000 /* Address Mask Mask */ +#define M8260_OR_BCTLD 0x00001000 /* Data Buffer Control Disable*/ +#define M8260_OR_CSNT_EARLY 0x00000800 /* Chip Select Negation Time */ +#define M8260_OR_ACS_MSK 0x00000600 /* Addr to Chip Select Setup */ +#define M8260_OR_ACS_DIV1 0x00000000 /* CS output at the same time */ +#define M8260_OR_ACS_DIV4 0x00000400 /* CS output 1/4 clock later */ +#define M8260_OR_ACS_DIV2 0x00000600 /* CS output 1/2 clock later */ +#define M8260_OR_RES 0x00000100 /* reserved */ +#define M8260_OR_SCY_MSK 0x000000f0 /* Cycle Lenght in Clocks */ +#define M8260_OR_SCY_0_CLK 0x00000000 /* 0 clk cycles wait states */ +#define M8260_OR_SCY_1_CLK 0x00000010 /* 1 clk cycles wait states */ +#define M8260_OR_SCY_2_CLK 0x00000020 /* 2 clk cycles wait states */ +#define M8260_OR_SCY_3_CLK 0x00000030 /* 3 clk cycles wait states */ +#define M8260_OR_SCY_4_CLK 0x00000040 /* 4 clk cycles wait states */ +#define M8260_OR_SCY_5_CLK 0x00000050 /* 5 clk cycles wait states */ +#define M8260_OR_SCY_6_CLK 0x00000060 /* 6 clk cycles wait states */ +#define M8260_OR_SCY_7_CLK 0x00000070 /* 7 clk cycles wait states */ +#define M8260_OR_SCY_8_CLK 0x00000080 /* 8 clk cycles wait states */ +#define M8260_OR_SCY_9_CLK 0x00000090 /* 9 clk cycles wait states */ +#define M8260_OR_SCY_10_CLK 0x000000a0 /* 10 clk cycles wait states */ +#define M8260_OR_SCY_11_CLK 0x000000b0 /* 11 clk cycles wait states */ +#define M8260_OR_SCY_12_CLK 0x000000c0 /* 12 clk cycles wait states */ +#define M8260_OR_SCY_13_CLK 0x000000d0 /* 13 clk cycles wait states */ +#define M8260_OR_SCY_14_CLK 0x000000e0 /* 14 clk cycles wait states */ +#define M8260_OR_SCY_15_CLK 0x000000f0 /* 15 clk cycles wait states */ +#define M8260_OR_SETA 0x00000008 /* External Transfer Ack */ +#define M8260_OR_TRLX 0x00000004 /* Timing Relaxed */ +#define M8260_OR_EHTR_MSK 0x00000006 /* extended hold timings */ +#define M8260_OR_EHTR_NORM 0x00000000 /* normal timing */ +#define M8260_OR_EHTR_1 0x00000002 /* one idle clock cycle */ +#define M8260_OR_EHTR_4 0x00000004 /* four idle clock cycles */ +#define M8260_OR_EHTR_8 0x00000006 /* eight idle clock cycles */ + +#define M8260_OR_SDRAM_BPD_2 0x00000000 /* 2 banks per device */ +#define M8260_OR_SDRAM_BPD_4 0x00002000 /* 4 banks per device */ +#define M8260_OR_SDRAM_BPD_8 0x00004000 /* 8 banks per device */ +#define M8260_OR_SDRAM_BPD_RES 0x00006000 /* reserved */ +#define M8260_OR_SDRAM_ROWST_7 0x00000400 /* row start address is A7 */ +#define M8260_OR_SDRAM_ROWST_8 0x00000800 /* row start address is A8 */ +#define M8260_OR_SDRAM_ROWST_9 0x00000c00 /* row start address is A9 */ +#define M8260_OR_SDRAM_ROWST_10 0x00001000 /* row start address is A10 */ +#define M8260_OR_SDRAM_ROWST_11 0x00001400 /* row start address is A11 */ +#define M8260_OR_SDRAM_ROWST_12 0x00001800 /* row start address is A12 */ +#define M8260_OR_SDRAM_ROWST_13 0x00001c00 /* row start address is A13 */ +#define M8260_OR_SDRAM_NUMR_9 0x00000000 /* 9 row address lines */ +#define M8260_OR_SDRAM_NUMR_10 0x00000040 /* 10 row address lines */ +#define M8260_OR_SDRAM_NUMR_11 0x00000080 /* 11 row address lines */ +#define M8260_OR_SDRAM_NUMR_12 0x000000c0 /* 12 row address lines */ +#define M8260_OR_SDRAM_NUMR_13 0x00000100 /* 13 row address lines */ +#define M8260_OR_SDRAM_NUMR_14 0x00000140 /* 14 row address lines */ +#define M8260_OR_SDRAM_NUMR_15 0x00000180 /* 15 row address lines */ +#define M8260_OR_SDRAM_PM_NORM 0x00000000 /* back-to-back page mode */ +#define M8260_OR_SDRAM_IBID 0x00000010 /* bank interleaving disable */ + +#define M8260_PSDMR_PBI 0x80000000 /* page-based interleaving */ +#define M8260_PSDMR_RFEN 0x40000000 /* page-based interleaving */ +#define M8260_PSDMR_OP_NORM 0x00000000 /* normal operation */ +#define M8260_PSDMR_OP_CBR 0x08000000 /* CBR refresh */ +#define M8260_PSDMR_OP_SELFR 0x10000000 /* self refresh */ +#define M8260_PSDMR_OP_MODE 0x18000000 /* mode register write */ +#define M8260_PSDMR_OP_PRE_BANK 0x20000000 /* precharge bank */ +#define M8260_PSDMR_OP_PRE_ALL 0x28000000 /* precharge all banks */ +#define M8260_PSDMR_OP_ACT 0x30000000 /* activate banks */ +#define M8260_PSDMR_OP_RW 0x38000000 /* read/write */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm8260Memch */ diff --git a/h/drv/mem/m8260Siu.h b/h/drv/mem/m8260Siu.h new file mode 100644 index 0000000..c867bf5 --- /dev/null +++ b/h/drv/mem/m8260Siu.h @@ -0,0 +1,98 @@ +/* m8260Siu.h - Motorola MPC8260 System Integration Unit header file */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,07jun02,dtr Changing size of PPC_ACR register. +01a,12sep99,ms_ created from m8260Cpm.h, 01d. +*/ + +/* + * This file contains constants for System Integration Unit (SIU) + * in the Motorola MPC8260 PowerQUICC II integrated Communications + * Processor + */ + +#ifndef __INCm8260Siuh +#define __INCm8260Siuh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef M8260ABBREVIATIONS +#define M8260ABBREVIATIONS + +#ifdef _ASMLANGUAGE +#define CAST(x) +#else /* _ASMLANGUAGE */ +typedef volatile UCHAR VCHAR; /* shorthand for volatile UCHAR */ +typedef volatile INT32 VINT32; /* volatile unsigned word */ +typedef volatile INT16 VINT16; /* volatile unsigned halfword */ +typedef volatile INT8 VINT8; /* volatile unsigned byte */ +typedef volatile UINT32 VUINT32; /* volatile unsigned word */ +typedef volatile UINT16 VUINT16; /* volatile unsigned halfword */ +typedef volatile UINT8 VUINT8; /* volatile unsigned byte */ +#define CAST(x) (x) +#endif /* _ASMLANGUAGE */ + +#endif /* M8260ABBREVIATIONS */ + +/* + * MPC8260 internal register/memory map (section 17 of prelim. spec) + * note that these are offsets from the value stored in the IMMR + * register. Also note that in the MPC8260, the IMMR is not a special + * purpose register, but it is memory mapped. + */ + +/* General SIU registers */ + +/* SIU Module Configuration Register */ + +#define M8260_SIUMCR(base) (CAST(VUINT32 *)((base) + 0x10000)) + +/* Protection Ctrl */ + +#define M8260_SYPCR(base) (CAST(VUINT32 *)((base) + 0x10004)) + +/* SW Service Reg */ + +#define M8260_SWSR(base) (CAST(VUINT16 *)((base) + 0x1000E)) + +/* Bus Configuration Register */ + +#define M8260_BCR(base) (CAST(VUINT32 *)((base) + 0x10024)) + +/* 60x Bus Arbiter Configuration Register */ + +#define M8260_PPC_ACR(base) (CAST(VUINT8 *)((base) + 0x10028)) + +/* 60x Bus Arbitration Level Register High */ + +#define M8260_PPC_ALRH(base) (CAST(VUINT32 *)((base) + 0x1002c)) + +/* 60x Bus Transfer Error Control Status */ + +#define M8260_TESCR1(base) (CAST(VUINT32 *)((base) + 0x10040)) + +/* Local Bus Transfer Error Control Status */ + +#define M8260_LTESCR1(base) (CAST(VUINT32 *)((base) + 0x10048)) + +/* System Protection Control register bit definition (SYPCR - 0x04) */ + +#define M8260_SYPCR_SWTC 0xffff0000 /* Software 'dog Timer Count */ +#define M8260_SYPCR_BMT 0x0000ff00 /* Bus Monitor Timing */ +#define M8260_SYPCR_PBME 0x00000080 /* 60x Bus Monitor Enable */ +#define M8260_SYPCR_LBME 0x00000040 /* local Bus Monitor Enable */ +#define M8260_SYPCR_SWE 0x00000004 /* Software Watchdog Enable */ +#define M8260_SYPCR_SWRI 0x00000002 /* Software Watchdog Reset/Int*/ +#define M8260_SYPCR_SWP 0x00000001 /* Software Watchdog Prescale */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm8260Siuh */ diff --git a/h/drv/mem/m82xxDpramLib.h b/h/drv/mem/m82xxDpramLib.h new file mode 100644 index 0000000..eec0c8a --- /dev/null +++ b/h/drv/mem/m82xxDpramLib.h @@ -0,0 +1,58 @@ +/* m82xxDpramLib.h - 82xx DPRAM memory allocation driver */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01c,26nov01,rcs renamed m82xxDpramLib.h and moved to target/h/drv/mem +01b,17jul01,g_h cleaning and renaming to sys82xxDpramLib.h +01a,16jul01,p_h created +*/ + +/* +DESCRIPTION +This module contains m82xx DPRAM memory allocation driver. +*/ + +#ifndef __INCm82xxDpramh +#define __INCm82xxDpramh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + +/* Define part */ +#define ALLOCTABLESIZE 64 + +typedef struct ADDR_RESOURCE + { + UINT32 start; + UINT32 size; + struct ADDR_RESOURCE * pNext; + } ADDR_RESOURCE; + +typedef struct + { + UINT32 start; + UINT32 limit; + ADDR_RESOURCE * pHead; + } POOL; + +/* Prototypes */ + +void m82xxDpramLibInit (void); +void* m82xxDpramMalloc (size_t Length); +void* m82xxDpramAlignedMalloc (size_t Length, size_t Alignment); +void m82xxDpramFree (void* Addr); +void* m82xxDpramFccMalloc (size_t Length, size_t Alignment); +void m82xxDpramFccFree (void* Addr); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm82xxDpramh */ diff --git a/h/drv/mem/mcecc.h b/h/drv/mem/mcecc.h new file mode 100644 index 0000000..6438af7 --- /dev/null +++ b/h/drv/mem/mcecc.h @@ -0,0 +1,178 @@ +/* mcecc.h - Memory Controller ASIC for ECC DRAM */ + +/* Copyright 1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,29sep98,fle doc : made it refgen parsable +01a,26oct93,dzb written based on version 01d of drv/multi/memc040.h. +*/ + +#ifdef DOC +#define INCmcecch +#endif /* DOC */ + +#ifndef __INCmcecch +#define __INCmcecch + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This file contains constants for Motorola's Memory Controller ASIC for + * ECC DRAM modules. The macro MCECC_BASE_ADRS must be defined when including + * this header. + */ + +#ifdef _ASMLANGUAGE +#define CAST +#else +#define CAST (char *) +#endif /* _ASMLANGUAGE */ + +/* on-board access, register definitions */ + +#define MCECC_REG_INTERVAL 1 + +#ifndef MCECC_ADRS /* to permit alternative board addressing */ +#define MCECC_ADRS(reg) (CAST (MCECC_BASE_ADRS + (reg * MCECC_REG_INTERVAL))) +#endif /* MCECC_ADRS */ + +#define MCECC_ID MCECC_ADRS(0x00) /* Chip ID */ +#define MCECC_REVISION MCECC_ADRS(0x04) /* Chip Revision Register */ +#define MCECC_MCR MCECC_ADRS(0x08) /* Memory Configuration Reg. */ +#define MCECC_BAR MCECC_ADRS(0x14) /* Base Address Register */ +#define MCECC_RCR MCECC_ADRS(0x18) /* RAM Control Register */ +#define MCECC_BCR MCECC_ADRS(0x1c) /* Bus Clock Frequency Reg. */ +#define MCECC_DCR MCECC_ADRS(0x20) /* Data Control Register */ +#define MCECC_SCR MCECC_ADRS(0x24) /* Scrub Control Register */ +#define MCECC_SPR_HI MCECC_ADRS(0x28) /* Scrub Period Reg (8-15) */ +#define MCECC_SPR_LO MCECC_ADRS(0x2c) /* Scrub Period Reg (7-0) */ +#define MCECC_CPC MCECC_ADRS(0x30) /* Chip Prescaler Counter */ +#define MCECC_STR MCECC_ADRS(0x34) /* Scrub Time Register */ +#define MCECC_SPC_HI MCECC_ADRS(0x38) /* Scrub Prescale Cnt (21-16) */ +#define MCECC_SPC_MID MCECC_ADRS(0x3c) /* Scrub Prescale Cnt (15-8) */ +#define MCECC_SPC_LO MCECC_ADRS(0x40) /* Scrub Prescale Cnt (7-0) */ +#define MCECC_STC_HI MCECC_ADRS(0x44) /* Scrub Timer Cnt (15-8) */ +#define MCECC_STC_LO MCECC_ADRS(0x48) /* Scrub Timer Cnt (7-0) */ +#define MCECC_SAC_HH MCECC_ADRS(0x4c) /* Scrub Address Cnt (26-24) */ +#define MCECC_SAC_H MCECC_ADRS(0x50) /* Scrub Address Cnt (23-16) */ +#define MCECC_SAC_L MCECC_ADRS(0x54) /* Scrub Address Cnt (15-8) */ +#define MCECC_SAC_LL MCECC_ADRS(0x58) /* Scrub Address Cnt (7-4) */ +#define MCECC_ELR MCECC_ADRS(0x5c) /* Error Logger Register */ +#define MCECC_EA_HH MCECC_ADRS(0x60) /* Error Address (31-24) */ +#define MCECC_EA_H MCECC_ADRS(0x64) /* Error Address (23-16) */ +#define MCECC_EA_L MCECC_ADRS(0x68) /* Error Address (15-8) */ +#define MCECC_EA_LL MCECC_ADRS(0x6c) /* Error Address (7-4) */ +#define MCECC_ESR MCECC_ADRS(0x70) /* Error Syndrome Register */ +#define MCECC_DR1 MCECC_ADRS(0x74) /* Defaults Register 1 */ +#define MCECC_DR2 MCECC_ADRS(0x78) /* Defaults Register 2 */ + +/* MCECC_ID 0x00 Chip ID */ + +#define MCECC_ID_RESET 0x0f /* software reset of MCECC chip */ + +/* MCECC_MCR 0x08 Memory Configuration Register */ + +#define MCECC_MCR_4MB 0x00 /* 4Mb of DRAM */ +#define MCECC_MCR_8MB 0x01 /* 8Mb of DRAM */ +#define MCECC_MCR_16MB 0x02 /* 16Mb of DRAM */ +#define MCECC_MCR_32MB 0x03 /* 32Mb of DRAM */ +#define MCECC_MCR_64MB 0x04 /* 64Mb of DRAM */ +#define MCECC_MCR_128MB 0x05 /* 128Mb of DRAM */ +#define MCECC_MCR_FSTRD 0x20 /* fast read */ + +/* MCECC_RCR 0x18 RAM Control Register */ + +#define MCECC_RCR_RAMEN 0x01 /* RAM enable */ +#define MCECC_RCR_NCEBEN 0x02 /* assert TEA* on noncorrectable err */ +#define MCECC_RCR_NCEIEN 0x04 /* interrupt on noncorrectable err */ +#define MCECC_RCR_RWB3 0x08 /* general purpose R/W bit */ +#define MCECC_RCR_SWAIT 0x10 /* snoop wait */ +#define MCECC_RCR_RWB5 0x20 /* general purpose R/W bit */ +#define MCECC_RCR_BAD 0xc0 /* base address bits 22 & 23 */ + +/* MCECC_BCR 0x1c Bus Clock Register */ + +#define MCECC_BCR_25MHZ 25 /* 25 MHz clock */ +#define MCECC_BCR_33MHZ 33 /* 33 MHz clock */ + +/* MCECC_DCR 0x20 Data Control Register */ + +#define MCECC_DCR_RWCKB 0x08 /* R/W checkbits */ +#define MCECC_DCR_ZFILL 0x10 /* zero fill */ +#define MCECC_DCR_DERC 0x20 /* disable error correction */ + +/* MCECC_SCR 0x24 Scrub Control Register */ + +#define MCECC_SCR_IDIS 0x01 /* image disable */ +#define MCECC_SCR_SBEIEN 0x02 /* interrupt on single bit error */ +#define MCECC_SCR_SCRBEN 0x08 /* enable scrubber */ +#define MCECC_SCR_SCRB 0x10 /* scrubber busy */ +#define MCECC_SCR_HITDIS 0x20 /* not implemented (Mot) */ +#define MCECC_SCR_RADATA 0x40 /* not implemented (Mot) */ +#define MCECC_SCR_RACODE 0x80 /* not implemented (Mot) */ +#define MCECC_SCRUB_DIS 0x00 /* disable scrubber */ + +/* MCECC_STR 0x34 Scrub Time On/Time Off Register */ + +#define MCECC_STR_OFF_IMMED 0x00 /* request DRAM immediately */ +#define MCECC_STR_OFF_16 0x01 /* request DRAM after 16 clocks */ +#define MCECC_STR_OFF_32 0x02 /* request DRAM after 32 clocks */ +#define MCECC_STR_OFF_64 0x03 /* request DRAM after 64 clocks */ +#define MCECC_STR_OFF_128 0x04 /* request DRAM after 128 clocks */ +#define MCECC_STR_OFF_256 0x05 /* request DRAM after 256 clocks */ +#define MCECC_STR_OFF_512 0x06 /* request DRAM after 512 clocks */ +#define MCECC_STR_OFF_NEVER 0x07 /* never request DRAM */ +#define MCECC_STR_ON_1 0x00 /* keep DRAM for 1 clock */ +#define MCECC_STR_ON_16 0x08 /* keep DRAM for 16 clocks */ +#define MCECC_STR_ON_32 0x10 /* keep DRAM for 32 clocks */ +#define MCECC_STR_ON_64 0x18 /* keep DRAM for 64 clocks */ +#define MCECC_STR_ON_128 0x20 /* keep DRAM for 128 clocks */ +#define MCECC_STR_ON_256 0x28 /* keep DRAM for 256 clocks */ +#define MCECC_STR_ON_512 0x30 /* keep DRAM for 512 clocks */ +#define MCECC_STR_ON_TOTAL 0x38 /* keep DRAM for total scrub time */ +#define MCECC_STR_SRDIS 0x80 /* scrubber read disable */ + +/* MCECC_ELR 0x5c Error Logger Register */ + +#define MCECC_ELR_SBE 0x01 /* single bit error */ +#define MCECC_ELR_MBE 0x02 /* multiple bit error */ +#define MCECC_ELR_EALT 0x08 /* error with alternate bus master */ +#define MCECC_ELR_ERA 0x10 /* not implemented (Mot) */ +#define MCECC_ELR_ESCRB 0x20 /* error with scrubber */ +#define MCECC_ELR_ERD 0x40 /* error occurred on a READ */ +#define MCECC_ELR_ERRLOG 0x80 /* error log is full */ + +/* MCECC_DR1 0x74 Default Register 1 */ + +#define MCECC_DR1_4M 0x00 /* 4Mb of DRAM */ +#define MCECC_DR1_8M 0x01 /* 8Mb of DRAM */ +#define MCECC_DR1_16M 0x02 /* 16Mb of DRAM */ +#define MCECC_DR1_32M 0x03 /* 32Mb of DRAM */ +#define MCECC_DR1_64M 0x04 /* 64Mb of DRAM */ +#define MCECC_DR1_128M 0x05 /* 128Mb of DRAM */ +#define MCECC_DR1_SELI0 0x80 /* register base address select 0 */ +#define MCECC_DR1_SELI1 0x10 /* register base address select 1 */ +#define MCECC_DR1_FSTRD 0x20 /* fast DRAM reads */ +#define MCECC_DR1_STATCOL 0x40 /* ? */ +#define MCECC_DR1_WRHDIS 0x80 /* not implemented (Mot) */ + +/* MCECC_DR2 0x78 Default Register 2 */ + +#define MCECC_DR2_RESST0 0x01 /* general purpose R/W bit */ +#define MCECC_DR2_RESST1 0x02 /* general purpose R/W bit */ +#define MCECC_DR2_RESST2 0x04 /* general purpose R/W bit */ +#define MCECC_DR2_NOCACHE 0x08 /* SCR can be cleared by software */ +#define MCECC_DR2_TVECT 0x10 /* test vendor vectors */ +#define MCECC_DR2_REFDIS 0x20 /* disable refreshing DRAM */ +#define MCECC_DR2_XY_FLIP 0x40 /* select opposite cache latches */ +#define MCECC_DR2_FRC_OPN 0x80 /* force DRAM read latches open */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmcecch */ diff --git a/h/drv/mem/memDev.h b/h/drv/mem/memDev.h new file mode 100644 index 0000000..1354bcc --- /dev/null +++ b/h/drv/mem/memDev.h @@ -0,0 +1,47 @@ +/* memDev.h - generic non-volatile RAM header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,22sep92,rrr added support for c++ +01c,07jul92,ccc change of name to memDev.h. +01b,29jun92,caf changed genericNvram.h to genericNvRam.h. +01a,26jun92,caf created. +*/ + +/* +DESCRIPTION +This file contains header information for generic non-volatile RAM routines. +*/ + +#ifndef __INCmemDevh +#define __INCmemDevh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +#ifndef _ASMLANGUAGE +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT STATUS sysNvRamGet (char *string, int strLen, int offset); +IMPORT STATUS sysNvRamSet (char *string, int strLen, int offset); + +#else /* __STDC__ */ + +IMPORT STATUS sysNvRamGet (); +IMPORT STATUS sysNvRamSet (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmemDevh */ diff --git a/h/drv/mem/mpc107MemInit.h b/h/drv/mem/mpc107MemInit.h new file mode 100644 index 0000000..191dc93 --- /dev/null +++ b/h/drv/mem/mpc107MemInit.h @@ -0,0 +1,453 @@ +/* mpc107MemInit.h - MPC107 Memory Controller register definitions */ + +/* Copyright 1984-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,06jun00,bri written +*/ + +#ifndef __INCmpc107MemInith +#define __INCmpc107MemInith + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "mpc107.h" + +/* defines */ + + +/* Memory control configuration Register #1 */ + +#define MPC107_MCC1_ROMNAL_MASK 0xf0000000 /* ROM nibble access time mask */ +#define MPC107_MCC1_ROMNAL_SHIFT 28 /* ROM nibble access time shft */ +#define MPC107_MCC1_ROMFAL_MASK 0x0f800000 /* ROM first access time mask */ +#define MPC107_MCC1_ROMFAL_SHIFT 23 /* ROM first access time shift */ +#define MPC107_MCC1_DBUS_SIZE_MASK 0x00600000 /* ROM/FLASH DBUS size mask */ +#define MPC107_MCC1_64N32 0x00400000 /* 64-bit external data path */ +#define MPC107_MCC1_8N64 0x00200000 /* 8-bit ROM/Flash */ +#define MPC107_MCC1_BURST_MASK 0x00100000 /* burst mode ROM Mask */ +#define MPC107_MCC1_BURST_SHIFT 20 /* burst mode SHIFT */ +#define MPC107_MCC1_MEMGO_MASK 0x00080000 /* enable RAM interface mask */ +#define MPC107_MCC1_MEMGO_SHIFT 19 /* enable RAM interface shift */ +#define MPC107_MCC1_SREN_MASK 0x00040000 /* enable self refresh mask */ +#define MPC107_MCC1_SREN_SHIFT 18 /* enable self refresh shift */ +#define MPC107_MCC1_RAM_TYPE_MASK 0x00020000 /* RAM type: 0=SDRAM,1=FPM/EDO */ +#define MPC107_MCC1_RAM_TYPE_SHIFT 17 /* RAM type: 0=SDRAM,1=FPM/EDO */ +#define MPC107_MCC1_PCKEN_MASK 0x00010000 /* enable parity checking mask */ +#define MPC107_MCC1_PCKEN_SHIFT 16 /* enable parity checking shif */ +#define MPC107_MCC1_ROW_ADRS_MASK 0x0000ffff /* row address mask */ + +#define MPC107_MCC1_ROMNAL_DATA 0xf /* ROM nibble access time */ +#define MPC107_MCC1_ROMFAL_DATA 0xf8 /* ROM first access time */ +#define MPC107_MCC1_BURST_DATA 0x0 /* burst mode type */ +#define MPC107_MCC1_MEMGO_DATA 0x0 /* enable RAM interface logic */ +#define MPC107_MCC1_SREN_DATA 0x0 /* enable self refresh */ +#define MPC107_MCC1_RAM_TYPE_DATA 0x0 /* RAM type: 0=SDRAM,1=FPM/EDO */ +#define MPC107_MCC1_PCKEN_DATA 0x0 /* enable parity checking */ +#define MPC107_MCC1_BANK0_ROWS 0x0 /* Number of rows for bank 0 */ +#define MPC107_MCC1_BANK1_ROWS 0x0 /* Number of rows for bank 1 */ +#define MPC107_MCC1_BANK2_ROWS 0x0 /* Number of rows for bank 2 */ +#define MPC107_MCC1_BANK3_ROWS 0x0 /* Number of rows for bank 3 */ +#define MPC107_MCC1_BANK4_ROWS 0x0 /* Number of rows for bank 4 */ +#define MPC107_MCC1_BANK5_ROWS 0x0 /* Number of rows for bank 5 */ +#define MPC107_MCC1_BANK6_ROWS 0x0 /* Number of rows for bank 6 */ +#define MPC107_MCC1_BANK7_ROWS 0x0 /* Number of rows for bank 7 */ + + +#define MPC107_MCC1_BANK7_ROWS_DATA (MPC107_MCC1_BANK7_ROWS << 14) +#define MPC107_MCC1_BANK6_ROWS_DATA (MPC107_MCC1_BANK6_ROWS << 12) +#define MPC107_MCC1_BANK5_ROWS_DATA (MPC107_MCC1_BANK5_ROWS << 10) +#define MPC107_MCC1_BANK4_ROWS_DATA (MPC107_MCC1_BANK4_ROWS << 8) +#define MPC107_MCC1_BANK3_ROWS_DATA (MPC107_MCC1_BANK3_ROWS << 6) +#define MPC107_MCC1_BANK2_ROWS_DATA (MPC107_MCC1_BANK2_ROWS << 4) +#define MPC107_MCC1_BANK1_ROWS_DATA (MPC107_MCC1_BANK1_ROWS << 2) +#define MPC107_MCC1_BANK0_ROWS_DATA (MPC107_MCC1_BANK0_ROWS << 0) + + + + +/* Memory control configuration Register #2*/ + +#define MPC107_MCC2_TS_WAIT_TIMER_M 0xe0000000 /* ROM out disable timing */ +#define MPC107_MCC2_TS_WAIT_TIMER_S 29 /* mask and shift */ +#define MPC107_MCC2_ASRISE_MASK 0x1e000000 /* AS_ falling edge timing */ +#define MPC107_MCC2_ASRISE_SHIFT 25 /* mask and shift */ +#define MPC107_MCC2_ASFALL_MASK 0x01e00000 /* AS_ rising edge timing */ +#define MPC107_MCC2_ASFALL_SHIFT 21 /* mask and shift */ +#define MPC107_MCC2_PAR_OR_ECC_M 0x00100000 /* ECC/parity mechanism mask */ +#define MPC107_MCC2_PAR_OR_ECC_S 20 /* ECC/parity mechanism shift */ +#define MPC107_MCC2_WR_PAR_CHK_EN 0x00080000 /* write parity check enable */ +#define MPC107_MCC2_WR_PAR_CHK_M 0x00080000 /* write parity check mask */ +#define MPC107_MCC2_WR_PAR_CHK_S 19 /* write parity check shift */ +#define MPC107_MCC2_RD_PARECC_EN 0x00040000 /* inline mem bus read parity */ +#define MPC107_MCC2_RD_PARECC_M 0x00040000 /* inline mem bus read mask */ +#define MPC107_MCC2_RD_PARECC_S 18 /* inline mem bus read shift */ +#define MPC107_MCC2_ECCEN_MASK 0x00020000 /* ECC enable */ +#define MPC107_MCC2_ECCEN_SHIFT 17 /* ECC enable shift */ +#define MPC107_MCC2_EDO 0x00010000 /* EDO DRAM */ +#define MPC107_MCC2_REFINT_MASK 0x0000fffc /* refresh interval mask */ +#define MPC107_MCC2_REFINT_SHIFT 2 /* refresh interval shift */ +#define MPC107_MCC2_RSV_PG_MASK 0x00000002 /* reserve 1 page mask */ +#define MPC107_MCC2_RSV_PG_SHIFT 1 /* reserve 1 page shift */ +#define MPC107_MCC2_RMW_PAR 0x00000001 /* parity gather/store */ + +#define MPC107_MCC2_REFINT_DATA 0x000006b8 /* refresh interval data */ +#define MPC107_MCC2_TS_WAIT_TIMER_DATA 0x0 /* ROM out disable timing */ +#define MPC107_MCC2_ASRISE_DATA 0x0 /* AS_ falling edge timing */ +#define MPC107_MCC2_ASFALL_DATA 0x0 /* AS_ rising edge timing */ +#define MPC107_MCC2_EDO_DATA 0x0 /* EDO DRAM */ +#define MPC107_MCC2_ECCEN_DATA 0x0 /* ECC enable */ +#define MPC107_MCC2_PAR_OR_ECC_D 0x0 /* ECC/parity mechanism data */ +#define MPC107_MCC2_WR_PAR_CHK_D 0x0 /* write parity check enable */ +#define MPC107_MCC2_RD_PARECC_D 0x0 /* inline mem bus read data */ +#define MPC107_MCC2_RSV_PG_DATA 0x0 /* reserve 1 page data */ +#define MPC107_MCC2_RMW_PAR_DATA 0x0 /* parity gather/store */ + + + +/* Memory control configuration Register #3 */ + +#define MPC107_MCC3_BSTOPRE_25_M 0xf0000000 /* burst to precharge timing */ +#define MPC107_MCC3_BSTOPRE_25_S 28 /* mask and shift */ +#define MPC107_MCC3_REFREC_MASK 0x0f000000 /* refresh to active interval */ +#define MPC107_MCC3_REFREC_SHIFT 24 /* timing mask and shift */ +#define MPC107_MCC3_RDLAT_MASK 0x00f00000 /* read data latency timing */ +#define MPC107_MCC3_RDLAT_SHIFT 20 /* mask and shift */ +#define MPC107_MCC3_CPX_MASK 0x00080000 /* CAS write timing */ +#define MPC107_MCC3_CPX_SHIFT 19 /* CAS write timing shift */ +#define MPC107_MCC3_CPX 0x00080000 /* CAS write timing */ +#define MPC107_MCC3_RAS6P_MASK 0x00078000 /* RAS low time for CBR */ +#define MPC107_MCC3_RAS6P_SHIFT 15 /* refresh shift and mask */ +#define MPC107_MCC3_CAS5_MASK 0x00007000 /* CAS low time for page mode */ +#define MPC107_MCC3_CAS5_SHIFT 12 /* access mask and shift */ +#define MPC107_MCC3_CP4_MASK 0x00000e00 /* CAS precharge mask */ +#define MPC107_MCC3_CP4_SHIFT 9 /* CAS precharge shift */ +#define MPC107_MCC3_CAS3_MASK 0x000001c0 /* CAS low time for first */ +#define MPC107_MCC3_CAS3_SHIFT 6 /* data access mask and shift */ +#define MPC107_MCC3_RCD2_MASK 0x00000038 /* RAS to CAS delay mask */ +#define MPC107_MCC3_RCD2_SHIFT 3 /* RAS to CAS delay shift */ +#define MPC107_MCC3_RP1_MASK 0x00000007 /* RAS precharge mask */ +#define MPC107_MCC3_RP1_SHIFT 2 /* RAS precharge shift */ + +#define MPC107_MCC3_REFREC_DATA 0x8 /* refresh to active interval */ +#define MPC107_MCC3_RDLAT_DATA 0x4 /* read data latency timing */ +#define MPC107_MCC3_CPX_DATA 0 /* CAS write timing */ +#define MPC107_MCC3_RAS6P_DATA 0x0 /* RAS low time for CBR */ +#define MPC107_MCC3_CAS5_DATA 0x0 /* CAS low time for page mode */ +#define MPC107_MCC3_CP4_DATA 0x2 /* CAS precharge data */ +#define MPC107_MCC3_CAS3_DATA 0x4 /* CAS low time for first */ +#define MPC107_MCC3_RCD2_DATA 0x0 /* RAS to CAS delay */ +#define MPC107_MCC3_RP1_DATA 0x2 /* RAS precharge data */ + +/* Burst to precharge for MCCR3 */ + +#define MPC107_MCC3_BSTOPRE_DATA ((MPC107_BSTOPRE_DATA & 0xf0) >> 4) + +/* Memory control configuration Register #4 */ + +#define MPC107_MCC4_PRETOACT_MASK 0xf0000000 /* precharge to active */ +#define MPC107_MCC4_PRETOACT_SHIFT 28 /* interval mask and shift */ +#define MPC107_MCC4_ACTOPRE_MASK 0x0f000000 /* active to precharge */ +#define MPC107_MCC4_ACTOPRE_SHIFT 24 /* interval mask and shift */ +#define MPC107_MCC4_WMODE_SHIFT 23 /* length of data */ +#define MPC107_MCC4_INLINE 0x00400000 /* inline ECC/parity chk enabl */ +#define MPC107_MCC4_REGISTERED 0x00100000 /* memory data interface */ +#define MPC107_MCC4_BSTOPRE_01_MASK 0x000c0000 /* burst to precharge timing */ +#define MPC107_MCC4_BSTOPRE_01_SHIFT 18 /* mask and shift */ +#define MPC107_MCC4_REGDIMM 0x00008000 /* config mem bus for DIMMs */ +#define MPC107_MCC4_SDMODE_CAS_SHF 12 /* CAS latency type shift */ +#define MPC107_MCC4_SDMODE_MASK 0x00007f00 /* SDRAM mode mask */ +#define MPC107_MCC4_SDMODE_SHIFT 8 /* SDRAM mode shift */ +#define MPC107_MCC4_ACTORW_MASK 0x000000f0 /* activate to read/write */ +#define MPC107_MCC4_ACTORW_SHIFT 4 /* interval mask and shift */ +#define MPC107_MCC4_BSTOPRE_69_MASK 0x0000000f /* burst to prechrg timing msk */ + +#define MPC107_MCC4_PRETOACT_DATA 0x03 /* precharge to active data */ +#define MPC107_MCC4_ACTOPRE_DATA 0x05 /* active to precharge data */ +#define MPC107_MCC4_WMODE_DATA 0x01 /* Length of burst for 32bit data */ +#define MPC107_MCC4_BUFTYPE_DATA MPC107_MCC4_INLINE /* buffer type */ +#define MPC107_BSTOPRE_DATA 0x07A /* burst to precharge timing */ +#define MPC107_MCC4_SDMODE_DATA 0x0 /* CAS latency type */ +#define MPC107_MCC4_ACTORW_DATA 0x3 /* activate to read/write */ + +/* Bitmasks to enable memory banks 0 - 7, used in config.h */ + +#define MPC107_BANK0_ENABLE 0x1 /* 1/0 Enable/Disable BANK 0 */ +#define MPC107_BANK1_ENABLE 0x0 /* 1/0 Enable/Disable BANK 1 */ +#define MPC107_BANK2_ENABLE 0x0 /* 1/0 Enable/Disable BANK 2 */ +#define MPC107_BANK3_ENABLE 0x0 /* 1/0 Enable/Disable BANK 3 */ +#define MPC107_BANK4_ENABLE 0x0 /* 1/0 Enable/Disable BANK 4 */ +#define MPC107_BANK5_ENABLE 0x0 /* 1/0 Enable/Disable BANK 5 */ +#define MPC107_BANK6_ENABLE 0x0 /* 1/0 Enable/Disable BANK 6 */ +#define MPC107_BANK7_ENABLE 0x0 /* 1/0 Enable/Disable BANK 7 */ + +#define MPC107_BANK0_ENABLE_DATA (MPC107_BANK0_ENABLE << 0x0 ) /* BANK 0 */ +#define MPC107_BANK1_ENABLE_DATA (MPC107_BANK1_ENABLE << 0x1 ) /* BANK 1 */ +#define MPC107_BANK2_ENABLE_DATA (MPC107_BANK2_ENABLE << 0x2 ) /* BANK 2 */ +#define MPC107_BANK3_ENABLE_DATA (MPC107_BANK3_ENABLE << 0x3 ) /* BANK 3 */ +#define MPC107_BANK4_ENABLE_DATA (MPC107_BANK4_ENABLE << 0x4 ) /* BANK 4 */ +#define MPC107_BANK5_ENABLE_DATA (MPC107_BANK5_ENABLE << 0x5 ) /* BANK 5 */ +#define MPC107_BANK6_ENABLE_DATA (MPC107_BANK6_ENABLE << 0x6 ) /* BANK 6 */ +#define MPC107_BANK7_ENABLE_DATA (MPC107_BANK7_ENABLE << 0x7 ) /* BANK 7 */ + + +/* memory bank sizes */ + +#define MPC107_BANK0_SIZE 0x01000000 /* 16MB - 1/2 32MB DIMM */ +#define MPC107_BANK1_SIZE 0x01000000 /* 16MB - 1/2 32MB DIMM */ +#define MPC107_BANK2_SIZE 0x01000000 /* 16MB - 1/2 32MB DIMM */ +#define MPC107_BANK3_SIZE 0x01000000 /* 16MB - 1/2 32MB DIMM */ +#define MPC107_BANK4_SIZE 0x01000000 /* 16MB - 1/2 32MB DIMM */ +#define MPC107_BANK5_SIZE 0x01000000 /* 16MB - 1/2 32MB DIMM */ +#define MPC107_BANK6_SIZE 0x01000000 /* 16MB - 1/2 32MB DIMM */ +#define MPC107_BANK7_SIZE 0x01000000 /* 16MB - 1/2 32MB DIMM */ + +/* + * The macros MPC107_BANK[x]_ADRS indicate the starting addresses of + * each memory bank. The default definitions provide for a contiguous + * and non-overlapping memory map for the eight banks regardless of the + * defined size of each bank. + * + * The only configurable options are the BANK enables and the BANK + * sizes which are fully configurable by the user. + */ + +/* carve up a valid mapping based on sizes */ + +#define MPC107_BANK0_ADRS 0x00000000 /* Mem starts at 0x0 */ +#define MPC107_BANK1_ADRS (MPC107_BANK0_ADRS + MPC107_BANK0_SIZE) +#define MPC107_BANK2_ADRS (MPC107_BANK1_ADRS + MPC107_BANK1_SIZE) +#define MPC107_BANK3_ADRS (MPC107_BANK2_ADRS + MPC107_BANK2_SIZE) +#define MPC107_BANK4_ADRS (MPC107_BANK3_ADRS + MPC107_BANK3_SIZE) +#define MPC107_BANK5_ADRS (MPC107_BANK4_ADRS + MPC107_BANK4_SIZE) +#define MPC107_BANK6_ADRS (MPC107_BANK5_ADRS + MPC107_BANK5_SIZE) +#define MPC107_BANK7_ADRS (MPC107_BANK6_ADRS + MPC107_BANK6_SIZE) +#define MPC107_BANK7_ADRS_END ((MPC107_BANK7_ADRS + MPC107_BANK7_SIZE) - 1) + +/* setup which memory banks to enable */ + +#define MPC107_MBER_DEFAULT MPC107_BANK0_ENABLE_DATA | \ + MPC107_BANK1_ENABLE_DATA | \ + MPC107_BANK2_ENABLE_DATA | \ + MPC107_BANK3_ENABLE_DATA | \ + MPC107_BANK4_ENABLE_DATA | \ + MPC107_BANK5_ENABLE_DATA | \ + MPC107_BANK6_ENABLE_DATA | \ + MPC107_BANK7_ENABLE_DATA + +/* break down the mapping addresses into MPC107 register settings */ + +#define MPC107_START_BANK0 (((MPC107_BANK0_ADRS) >> 20) & (0x3ff)) +#define MPC107_ENDOF_BANK0 (((MPC107_BANK1_ADRS - 1) >> 20) & (0x3ff)) +#define MPC107_START_BANK1 (((MPC107_BANK1_ADRS) >> 20) & (0x3ff)) +#define MPC107_ENDOF_BANK1 (((MPC107_BANK2_ADRS - 1) >> 20) & (0x3ff)) +#define MPC107_START_BANK2 (((MPC107_BANK2_ADRS) >> 20) & (0x3ff)) +#define MPC107_ENDOF_BANK2 (((MPC107_BANK3_ADRS - 1) >> 20) & (0x3ff)) +#define MPC107_START_BANK3 (((MPC107_BANK3_ADRS) >> 20) & (0x3ff)) +#define MPC107_ENDOF_BANK3 (((MPC107_BANK4_ADRS - 1) >> 20) & (0x3ff)) +#define MPC107_START_BANK4 (((MPC107_BANK4_ADRS) >> 20) & (0x3ff)) +#define MPC107_ENDOF_BANK4 (((MPC107_BANK5_ADRS - 1) >> 20) & (0x3ff)) +#define MPC107_START_BANK5 (((MPC107_BANK5_ADRS) >> 20) & (0x3ff)) +#define MPC107_ENDOF_BANK5 (((MPC107_BANK6_ADRS - 1) >> 20) & (0x3ff)) +#define MPC107_START_BANK6 (((MPC107_BANK6_ADRS) >> 20) & (0x3ff)) +#define MPC107_ENDOF_BANK6 (((MPC107_BANK7_ADRS - 1) >> 20) & (0x3ff)) +#define MPC107_START_BANK7 (((MPC107_BANK7_ADRS) >> 20) & (0x3ff)) +#define MPC107_ENDOF_BANK7 (((MPC107_BANK7_ADRS_END) >> 20) & (0x3ff)) + +#define STMEM_MASK (0x0ff) /* Start of Memory Mask */ +#define XTMEM_MASK (0x003) /* Extended Memory Mask */ + +/* Setup the actual MPC107 register values.*/ + +/* memory starting address register one */ + +#define MPC107_MSAR1_DEFAULT (((MPC107_START_BANK0 & STMEM_MASK) << 0) | \ + ((MPC107_START_BANK1 & STMEM_MASK) << 8) | \ + ((MPC107_START_BANK2 & STMEM_MASK) << 16) | \ + ((MPC107_START_BANK3 & STMEM_MASK) << 24)) + +/* memory starting extended address register one */ + +#define MPC107_XMSAR1_DEFAULT ((((MPC107_START_BANK0 >> 8) & XTMEM_MASK) << 0) \ + | (((MPC107_START_BANK1 >> 8) & XTMEM_MASK) << 8) \ + | (((MPC107_START_BANK2 >> 8) & XTMEM_MASK) << 16) \ + | (((MPC107_START_BANK3 >> 8) & XTMEM_MASK) << 24)) + +/* memory ending address register one */ + +#define MPC107_MEAR1_DEFAULT (((MPC107_ENDOF_BANK0 & STMEM_MASK) << 0) | \ + ((MPC107_ENDOF_BANK1 & STMEM_MASK) << 8) | \ + ((MPC107_ENDOF_BANK2 & STMEM_MASK) << 16) | \ + ((MPC107_ENDOF_BANK3 & STMEM_MASK) << 24)) + +/* memory ending extended address register one */ + +#define MPC107_XMEAR1_DEFAULT ((((MPC107_ENDOF_BANK0 >> 8) & XTMEM_MASK) << 0) \ + | (((MPC107_ENDOF_BANK1 >> 8) & XTMEM_MASK) << 8) \ + | (((MPC107_ENDOF_BANK2 >> 8) & XTMEM_MASK) << 16) \ + | (((MPC107_ENDOF_BANK3 >> 8) & XTMEM_MASK) << 24)) + +/* memory starting address register two */ + +#define MPC107_MSAR2_DEFAULT (((MPC107_START_BANK4 & STMEM_MASK) << 0) | \ + ((MPC107_START_BANK5 & STMEM_MASK) << 8) | \ + ((MPC107_START_BANK6 & STMEM_MASK) << 16) | \ + ((MPC107_START_BANK7 & STMEM_MASK) << 24)) + +/* memory starting extended address register two */ + +#define MPC107_XMSAR2_DEFAULT ((((MPC107_START_BANK4 >> 8) & XTMEM_MASK) << 0) \ + | (((MPC107_START_BANK5 >> 8) & XTMEM_MASK) << 8) \ + | (((MPC107_START_BANK6 >> 8) & XTMEM_MASK) << 16) \ + | (((MPC107_START_BANK7 >> 8) & XTMEM_MASK) << 24)) + +/* memory ending address register two */ + +#define MPC107_MEAR2_DEFAULT (((MPC107_ENDOF_BANK4 & STMEM_MASK) << 0) | \ + ((MPC107_ENDOF_BANK5 & STMEM_MASK) << 8) | \ + ((MPC107_ENDOF_BANK6 & STMEM_MASK) << 16) | \ + ((MPC107_ENDOF_BANK7 & STMEM_MASK) << 24)) + +/* memory ending extended address register two */ + +#define MPC107_XMEAR2_DEFAULT ((((MPC107_ENDOF_BANK4 >> 8) & XTMEM_MASK) << 0) \ + | (((MPC107_ENDOF_BANK5 >> 8) & XTMEM_MASK) << 8) \ + | (((MPC107_ENDOF_BANK6 >> 8) & XTMEM_MASK) << 16) \ + | (((MPC107_ENDOF_BANK7 >> 8) & XTMEM_MASK) << 24)) + +/* + * initial values for the MPC107 SDRAM memory control registers. + * Refer to MPC107 users manual and addendums for details on values. + * These defaults are to support SDRAM + */ + +/* The Memory control Configuration Register - 1 (MCCR1) */ + +#define MPC107_MCCR1_DEFAULT (MPC107_MCC1_ROMNAL_DATA << \ + MPC107_MCC1_ROMNAL_SHIFT) | \ + (MPC107_MCC1_ROMFAL_DATA << \ + MPC107_MCC1_ROMFAL_SHIFT) | \ + MPC107_MCC1_BANK7_ROWS_DATA | \ + MPC107_MCC1_BANK6_ROWS_DATA | \ + MPC107_MCC1_BANK5_ROWS_DATA | \ + MPC107_MCC1_BANK4_ROWS_DATA | \ + MPC107_MCC1_BANK3_ROWS_DATA | \ + MPC107_MCC1_BANK2_ROWS_DATA | \ + MPC107_MCC1_BANK1_ROWS_DATA | \ + MPC107_MCC1_BANK0_ROWS_DATA |\ + ((MPC107_MCC1_BURST_DATA << \ + MPC107_MCC1_BURST_SHIFT) & \ + MPC107_MCC1_BURST_MASK) + + + +/* The Memory control Configuration Register - 2 (MCCR2) */ + +#define MPC107_MCCR2_DEFAULT ((MPC107_MCC2_REFINT_DATA << \ + MPC107_MCC2_REFINT_SHIFT) & \ + MPC107_MCC2_REFINT_MASK) | \ + ((MPC107_MCC2_TS_WAIT_TIMER_DATA << \ + MPC107_MCC2_TS_WAIT_TIMER_S) & \ + MPC107_MCC2_TS_WAIT_TIMER_M) | \ + ((MPC107_MCC2_ASRISE_DATA << \ + MPC107_MCC2_ASRISE_SHIFT) &\ + MPC107_MCC2_ASRISE_MASK) | \ + ((MPC107_MCC2_ASFALL_DATA << \ + MPC107_MCC2_ASFALL_SHIFT) & \ + MPC107_MCC2_ASFALL_MASK) | \ + MPC107_MCC2_EDO_DATA | \ + ((MPC107_MCC2_ECCEN_DATA << \ + MPC107_MCC2_ECCEN_SHIFT) & \ + MPC107_MCC2_ECCEN_MASK) | \ + ((MPC107_MCC2_PAR_OR_ECC_D <<\ + MPC107_MCC2_PAR_OR_ECC_S) &\ + MPC107_MCC2_PAR_OR_ECC_M) | \ + ((MPC107_MCC2_WR_PAR_CHK_D << \ + MPC107_MCC2_WR_PAR_CHK_S) & \ + MPC107_MCC2_WR_PAR_CHK_M) |\ + ((MPC107_MCC2_RD_PARECC_D << \ + MPC107_MCC2_RD_PARECC_S) & \ + MPC107_MCC2_RD_PARECC_M) | \ + ((MPC107_MCC2_RSV_PG_DATA << \ + MPC107_MCC2_RSV_PG_SHIFT) & \ + MPC107_MCC2_RSV_PG_MASK)| \ + MPC107_MCC2_RMW_PAR_DATA + + +/* The Memory control Configuration Register - 3 (MCCR3) */ + +#define MPC107_MCCR3_DEFAULT ((MPC107_MCC3_BSTOPRE_DATA << \ + MPC107_MCC3_BSTOPRE_25_S ) & \ + MPC107_MCC3_BSTOPRE_25_M)| \ + ((MPC107_MCC3_REFREC_DATA << \ + MPC107_MCC3_REFREC_SHIFT) & \ + MPC107_MCC3_REFREC_MASK) | \ + ((MPC107_MCC3_CPX_DATA << \ + MPC107_MCC3_CPX_SHIFT) & \ + MPC107_MCC3_CPX_MASK ) | \ + ((MPC107_MCC3_RAS6P_DATA << \ + MPC107_MCC3_RAS6P_SHIFT) & \ + MPC107_MCC3_RAS6P_MASK ) | \ + ((MPC107_MCC3_CAS5_DATA << \ + MPC107_MCC3_CAS5_SHIFT ) & \ + MPC107_MCC3_CAS5_MASK) | \ + ((MPC107_MCC3_CP4_DATA << \ + MPC107_MCC3_CP4_SHIFT) & \ + MPC107_MCC3_CP4_MASK) | \ + ((MPC107_MCC3_CAS3_DATA << \ + MPC107_MCC3_CAS3_SHIFT) & \ + MPC107_MCC3_CAS3_MASK ) | \ + ((MPC107_MCC3_RCD2_DATA << \ + MPC107_MCC3_RCD2_SHIFT ) & \ + MPC107_MCC3_RCD2_MASK) | \ + ((MPC107_MCC3_RP1_DATA << \ + MPC107_MCC3_RP1_SHIFT) & \ + MPC107_MCC3_RP1_MASK) + + + + +/* Memory control Configuration Register -4 (MCCR4) */ + +#define MPC107_MCCR4_DEFAULT (MPC107_MCC4_PRETOACT_DATA << \ + MPC107_MCC4_PRETOACT_SHIFT) | \ + (MPC107_MCC4_ACTOPRE_DATA <<\ + MPC107_MCC4_ACTOPRE_SHIFT) | \ + (MPC107_MCC4_ACTOPRE_DATA << \ + MPC107_MCC4_ACTOPRE_SHIFT) | \ + (MPC107_MCC4_WMODE_DATA << \ + MPC107_MCC4_WMODE_SHIFT) | \ + (MPC107_MCC4_WMODE_DATA << \ + MPC107_MCC4_WMODE_SHIFT)| \ + (MPC107_MCC4_WMODE_DATA << \ + MPC107_MCC4_WMODE_SHIFT) | \ + MPC107_MCC4_BUFTYPE_DATA | \ + ((MPC107_BSTOPRE_DATA & \ + MPC107_MCC4_BSTOPRE_01_MASK) << \ + MPC107_MCC4_BSTOPRE_01_SHIFT) | \ + (MPC107_BSTOPRE_DATA & \ + MPC107_MCC4_BSTOPRE_69_MASK) | \ + ((MPC107_MCC4_SDMODE_DATA << \ + MPC107_MCC4_SDMODE_SHIFT) & \ + MPC107_MCC4_SDMODE_MASK) | \ + ((MPC107_MCC4_ACTORW_DATA << \ + MPC107_MCC4_ACTORW_MASK) & \ + MPC107_MCC4_ACTORW_MASK) + +/* SDRAM Page mode register initial value. */ + +#define MPC107_MPMR_DEFAULT 0x0032 /* SDRAM, 33Mhz w/ROMFAL =8 */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmpc107MemInith */ + diff --git a/h/drv/mem/quiccLbc.h b/h/drv/mem/quiccLbc.h new file mode 100644 index 0000000..daa546a --- /dev/null +++ b/h/drv/mem/quiccLbc.h @@ -0,0 +1,202 @@ +/* quiccLbc.h - Motorola PowerQuicc Local Bus controller header */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,10jan05,dtr adapted from ads85xx.h +*/ + +#ifndef INCquiccLbch +#define INCquiccLbch + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define QUICC_BR0(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x000)) +#define QUICC_OR0(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x004)) +#define QUICC_BR1(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x008)) +#define QUICC_OR1(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x00c)) +#define QUICC_BR2(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x010)) +#define QUICC_OR2(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x014)) +#define QUICC_BR3(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x018)) +#define QUICC_OR3(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x01c)) +#define QUICC_BR4(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x020)) +#define QUICC_OR4(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x024)) +#define QUICC_BR5(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x028)) +#define QUICC_OR5(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x02C)) +#define QUICC_BR6(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x030)) +#define QUICC_OR6(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x034)) +#define QUICC_BR7(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x038)) +#define QUICC_OR7(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x03C)) + +#define QUICC_MAR(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x068)) +#define QUICC_MAMR(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x070)) +#define QUICC_MBMR(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x074)) +#define QUICC_MCMR(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x078)) +#define QUICC_MRTPR(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x084)) +#define QUICC_MDR(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x088)) + +#define QUICC_LSDMR(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x094)) +#define QUICC_MDR(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x088)) + +#define QUICC_LSDMR(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x094)) + +#define QUICC_LURT(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x0A0)) +#define QUICC_LSRT(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x0A4)) +#define QUICC_LTESR(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x0B0)) +#define QUICC_LTEDR(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x0B4)) +#define QUICC_LTEIR(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x0B8)) +#define QUICC_LTEATR(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x0BC)) +#define QUICC_LTEAR(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x0C0)) + +/* LBC Clock Configuration */ +#define QUICC_LBCR(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x0D0)) +#define QUICC_LCRR(base) (CAST(VUINT32 *)((base) + LBC_REG_BA + 0x0D4)) + + +#ifdef PQ2PRO + +/* Local Bus Controller (LBC) Registers */ +/* BRx 0-16 Base Address + * 17-18 Extended Base Address + * 19-20 Port Size - 00 reserved + * - 01 8bit + * - 10 16bit + * - 11 32bit + * 21-22 Data Error Correction + * - 00 reserved + * - 01 Normal parity + * - 10 RMW parity generation (32-bit) + * - 11 reserved + * 23 Write Protect + * 24-26 Machine Select = 000 GPCM + * - 001->010 reserved + * - 011 SDRAM + * - 100->110 UPMA->UPMC + * - 111 reserved + * 28-29 Atomic Access - 00 No atomic access + * - 01 Read-after-write + * - 10 Write-after-read + * - 11 reserved + * 31 Valid + * + * ORx for SDRAM + * 0-16 Address mask + * 17-18 Extended address mask + * 19-21 Column address lines - 000->111 7->14 + * 23-25 Number of row address lines - 000->110 9->15 + * - 111 Reserved + * 26 Page mode select + * 31 External address latch delay + * + * ORx for GPCM Mode + * 0-16 Address mask + * 17-18 Extended address mask + * 19 Buffer Control Disable + * 20 Chip select negation + * 21-22 Addres to chip select setup + * 23 Extra Address to chip select setup + * 24-27 Cycle length in Bus clocks - 0000->1111 0->15 wait states + * 28 External address termination + * 29 Timing relaxed + * 30 Extended hold time for read access + * 31 External address latch delay + */ + +#define MRTPR_PTP_MASK 0xff000000 +#define MRTPR_PTP_WRITE(x) ( (x << 24) & MRTPR_PTP_MASK) +#define LSDMR_RFEN 0x40000000 /* Refresh Enable */ +/* LSDMR OP - 000 Normal operation + * - 001 Auto Refresh (Initialization) + * - 010 Self Refresh + * - 011 Mode Register Write (Initialization) + * - 100 Precharge Bank + * - 101 Precharge all banks (Initialization) + * - 110 Activate Bank + * - 111 Read/Write without valid transfer + */ +#define LSDMR_OP_MASK 0x38000000 +#define LSDMR_OP_SHIFT(x) ((x << 27) & LSDMR_OP_MASK) +/* Bank Select Multiplexed address line - 000 lines 12:13 + * - 001 13:14 + * - 010 14:15 + * - 011 15:16 + * - 100 16:17 + * - 101 17:18 + * - 110 18:19 + * - 111 19:20 + */ +#define LSDMR_BSMA_MASK 0x00E00000 +#define LSDMR_BSMA_SHIFT(x) ((x << 23) & LSDMR_BSMA_MASK) +/* RFCR Refresh recovery 000 - reserved + * 001->110 - 3->8 clocks + * 111 - 16 clocks + */ +#define LSDMR_RFCR_MASK 0x00038000 +#define LSDMR_RFCR_SHIFT(x) ((x << 15) & LSDMR_RFCR_MASK) +/* Incomplete LSDMR definitions */ +#endif /* PQ2PRO */ + +#ifndef _ASMLANGUAGE +/* Memory controller registers. +*/ +typedef struct mem_ctlr { + uint32_t memc_br0; + uint32_t memc_or0; + uint32_t memc_br1; + uint32_t memc_or1; + uint32_t memc_br2; + uint32_t memc_or2; + uint32_t memc_br3; + uint32_t memc_or3; + uint32_t memc_br4; + uint32_t memc_or4; + uint32_t memc_br5; + uint32_t memc_or5; + uint32_t memc_br6; + uint32_t memc_or6; + uint32_t memc_br7; + uint32_t memc_or7; + uint32_t memc_br8; + uint32_t memc_or8; + uint32_t memc_br9; + uint32_t memc_or9; + uint32_t memc_br10; + uint32_t memc_or10; + uint32_t memc_br11; + uint32_t memc_or11; + char res1[8]; + uint32_t memc_mar; + char res2[4]; + uint32_t memc_mamr; + uint32_t memc_mbmr; + uint32_t memc_mcmr; + char res3[8]; /* manual wrong, says 48 bits */ + uint16_t memc_mptpr; + char res4[2]; + uint32_t memc_mdr; + char res5[4]; + uint32_t memc_psdmr; + uint32_t memc_lsdmr; + uint8_t memc_purt; + char res6[3]; + uint8_t memc_psrt; + char res7[3]; + uint8_t memc_lurt; + char res8[3]; + uint8_t memc_lsrt; + char res9[3]; + uint32_t memc_immr; + char res10[84]; +} memctl834x_t; + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* INCquiccLbch */ diff --git a/h/drv/mem/unsupported/mcecc.h b/h/drv/mem/unsupported/mcecc.h new file mode 100644 index 0000000..6438af7 --- /dev/null +++ b/h/drv/mem/unsupported/mcecc.h @@ -0,0 +1,178 @@ +/* mcecc.h - Memory Controller ASIC for ECC DRAM */ + +/* Copyright 1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,29sep98,fle doc : made it refgen parsable +01a,26oct93,dzb written based on version 01d of drv/multi/memc040.h. +*/ + +#ifdef DOC +#define INCmcecch +#endif /* DOC */ + +#ifndef __INCmcecch +#define __INCmcecch + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This file contains constants for Motorola's Memory Controller ASIC for + * ECC DRAM modules. The macro MCECC_BASE_ADRS must be defined when including + * this header. + */ + +#ifdef _ASMLANGUAGE +#define CAST +#else +#define CAST (char *) +#endif /* _ASMLANGUAGE */ + +/* on-board access, register definitions */ + +#define MCECC_REG_INTERVAL 1 + +#ifndef MCECC_ADRS /* to permit alternative board addressing */ +#define MCECC_ADRS(reg) (CAST (MCECC_BASE_ADRS + (reg * MCECC_REG_INTERVAL))) +#endif /* MCECC_ADRS */ + +#define MCECC_ID MCECC_ADRS(0x00) /* Chip ID */ +#define MCECC_REVISION MCECC_ADRS(0x04) /* Chip Revision Register */ +#define MCECC_MCR MCECC_ADRS(0x08) /* Memory Configuration Reg. */ +#define MCECC_BAR MCECC_ADRS(0x14) /* Base Address Register */ +#define MCECC_RCR MCECC_ADRS(0x18) /* RAM Control Register */ +#define MCECC_BCR MCECC_ADRS(0x1c) /* Bus Clock Frequency Reg. */ +#define MCECC_DCR MCECC_ADRS(0x20) /* Data Control Register */ +#define MCECC_SCR MCECC_ADRS(0x24) /* Scrub Control Register */ +#define MCECC_SPR_HI MCECC_ADRS(0x28) /* Scrub Period Reg (8-15) */ +#define MCECC_SPR_LO MCECC_ADRS(0x2c) /* Scrub Period Reg (7-0) */ +#define MCECC_CPC MCECC_ADRS(0x30) /* Chip Prescaler Counter */ +#define MCECC_STR MCECC_ADRS(0x34) /* Scrub Time Register */ +#define MCECC_SPC_HI MCECC_ADRS(0x38) /* Scrub Prescale Cnt (21-16) */ +#define MCECC_SPC_MID MCECC_ADRS(0x3c) /* Scrub Prescale Cnt (15-8) */ +#define MCECC_SPC_LO MCECC_ADRS(0x40) /* Scrub Prescale Cnt (7-0) */ +#define MCECC_STC_HI MCECC_ADRS(0x44) /* Scrub Timer Cnt (15-8) */ +#define MCECC_STC_LO MCECC_ADRS(0x48) /* Scrub Timer Cnt (7-0) */ +#define MCECC_SAC_HH MCECC_ADRS(0x4c) /* Scrub Address Cnt (26-24) */ +#define MCECC_SAC_H MCECC_ADRS(0x50) /* Scrub Address Cnt (23-16) */ +#define MCECC_SAC_L MCECC_ADRS(0x54) /* Scrub Address Cnt (15-8) */ +#define MCECC_SAC_LL MCECC_ADRS(0x58) /* Scrub Address Cnt (7-4) */ +#define MCECC_ELR MCECC_ADRS(0x5c) /* Error Logger Register */ +#define MCECC_EA_HH MCECC_ADRS(0x60) /* Error Address (31-24) */ +#define MCECC_EA_H MCECC_ADRS(0x64) /* Error Address (23-16) */ +#define MCECC_EA_L MCECC_ADRS(0x68) /* Error Address (15-8) */ +#define MCECC_EA_LL MCECC_ADRS(0x6c) /* Error Address (7-4) */ +#define MCECC_ESR MCECC_ADRS(0x70) /* Error Syndrome Register */ +#define MCECC_DR1 MCECC_ADRS(0x74) /* Defaults Register 1 */ +#define MCECC_DR2 MCECC_ADRS(0x78) /* Defaults Register 2 */ + +/* MCECC_ID 0x00 Chip ID */ + +#define MCECC_ID_RESET 0x0f /* software reset of MCECC chip */ + +/* MCECC_MCR 0x08 Memory Configuration Register */ + +#define MCECC_MCR_4MB 0x00 /* 4Mb of DRAM */ +#define MCECC_MCR_8MB 0x01 /* 8Mb of DRAM */ +#define MCECC_MCR_16MB 0x02 /* 16Mb of DRAM */ +#define MCECC_MCR_32MB 0x03 /* 32Mb of DRAM */ +#define MCECC_MCR_64MB 0x04 /* 64Mb of DRAM */ +#define MCECC_MCR_128MB 0x05 /* 128Mb of DRAM */ +#define MCECC_MCR_FSTRD 0x20 /* fast read */ + +/* MCECC_RCR 0x18 RAM Control Register */ + +#define MCECC_RCR_RAMEN 0x01 /* RAM enable */ +#define MCECC_RCR_NCEBEN 0x02 /* assert TEA* on noncorrectable err */ +#define MCECC_RCR_NCEIEN 0x04 /* interrupt on noncorrectable err */ +#define MCECC_RCR_RWB3 0x08 /* general purpose R/W bit */ +#define MCECC_RCR_SWAIT 0x10 /* snoop wait */ +#define MCECC_RCR_RWB5 0x20 /* general purpose R/W bit */ +#define MCECC_RCR_BAD 0xc0 /* base address bits 22 & 23 */ + +/* MCECC_BCR 0x1c Bus Clock Register */ + +#define MCECC_BCR_25MHZ 25 /* 25 MHz clock */ +#define MCECC_BCR_33MHZ 33 /* 33 MHz clock */ + +/* MCECC_DCR 0x20 Data Control Register */ + +#define MCECC_DCR_RWCKB 0x08 /* R/W checkbits */ +#define MCECC_DCR_ZFILL 0x10 /* zero fill */ +#define MCECC_DCR_DERC 0x20 /* disable error correction */ + +/* MCECC_SCR 0x24 Scrub Control Register */ + +#define MCECC_SCR_IDIS 0x01 /* image disable */ +#define MCECC_SCR_SBEIEN 0x02 /* interrupt on single bit error */ +#define MCECC_SCR_SCRBEN 0x08 /* enable scrubber */ +#define MCECC_SCR_SCRB 0x10 /* scrubber busy */ +#define MCECC_SCR_HITDIS 0x20 /* not implemented (Mot) */ +#define MCECC_SCR_RADATA 0x40 /* not implemented (Mot) */ +#define MCECC_SCR_RACODE 0x80 /* not implemented (Mot) */ +#define MCECC_SCRUB_DIS 0x00 /* disable scrubber */ + +/* MCECC_STR 0x34 Scrub Time On/Time Off Register */ + +#define MCECC_STR_OFF_IMMED 0x00 /* request DRAM immediately */ +#define MCECC_STR_OFF_16 0x01 /* request DRAM after 16 clocks */ +#define MCECC_STR_OFF_32 0x02 /* request DRAM after 32 clocks */ +#define MCECC_STR_OFF_64 0x03 /* request DRAM after 64 clocks */ +#define MCECC_STR_OFF_128 0x04 /* request DRAM after 128 clocks */ +#define MCECC_STR_OFF_256 0x05 /* request DRAM after 256 clocks */ +#define MCECC_STR_OFF_512 0x06 /* request DRAM after 512 clocks */ +#define MCECC_STR_OFF_NEVER 0x07 /* never request DRAM */ +#define MCECC_STR_ON_1 0x00 /* keep DRAM for 1 clock */ +#define MCECC_STR_ON_16 0x08 /* keep DRAM for 16 clocks */ +#define MCECC_STR_ON_32 0x10 /* keep DRAM for 32 clocks */ +#define MCECC_STR_ON_64 0x18 /* keep DRAM for 64 clocks */ +#define MCECC_STR_ON_128 0x20 /* keep DRAM for 128 clocks */ +#define MCECC_STR_ON_256 0x28 /* keep DRAM for 256 clocks */ +#define MCECC_STR_ON_512 0x30 /* keep DRAM for 512 clocks */ +#define MCECC_STR_ON_TOTAL 0x38 /* keep DRAM for total scrub time */ +#define MCECC_STR_SRDIS 0x80 /* scrubber read disable */ + +/* MCECC_ELR 0x5c Error Logger Register */ + +#define MCECC_ELR_SBE 0x01 /* single bit error */ +#define MCECC_ELR_MBE 0x02 /* multiple bit error */ +#define MCECC_ELR_EALT 0x08 /* error with alternate bus master */ +#define MCECC_ELR_ERA 0x10 /* not implemented (Mot) */ +#define MCECC_ELR_ESCRB 0x20 /* error with scrubber */ +#define MCECC_ELR_ERD 0x40 /* error occurred on a READ */ +#define MCECC_ELR_ERRLOG 0x80 /* error log is full */ + +/* MCECC_DR1 0x74 Default Register 1 */ + +#define MCECC_DR1_4M 0x00 /* 4Mb of DRAM */ +#define MCECC_DR1_8M 0x01 /* 8Mb of DRAM */ +#define MCECC_DR1_16M 0x02 /* 16Mb of DRAM */ +#define MCECC_DR1_32M 0x03 /* 32Mb of DRAM */ +#define MCECC_DR1_64M 0x04 /* 64Mb of DRAM */ +#define MCECC_DR1_128M 0x05 /* 128Mb of DRAM */ +#define MCECC_DR1_SELI0 0x80 /* register base address select 0 */ +#define MCECC_DR1_SELI1 0x10 /* register base address select 1 */ +#define MCECC_DR1_FSTRD 0x20 /* fast DRAM reads */ +#define MCECC_DR1_STATCOL 0x40 /* ? */ +#define MCECC_DR1_WRHDIS 0x80 /* not implemented (Mot) */ + +/* MCECC_DR2 0x78 Default Register 2 */ + +#define MCECC_DR2_RESST0 0x01 /* general purpose R/W bit */ +#define MCECC_DR2_RESST1 0x02 /* general purpose R/W bit */ +#define MCECC_DR2_RESST2 0x04 /* general purpose R/W bit */ +#define MCECC_DR2_NOCACHE 0x08 /* SCR can be cleared by software */ +#define MCECC_DR2_TVECT 0x10 /* test vendor vectors */ +#define MCECC_DR2_REFDIS 0x20 /* disable refreshing DRAM */ +#define MCECC_DR2_XY_FLIP 0x40 /* select opposite cache latches */ +#define MCECC_DR2_FRC_OPN 0x80 /* force DRAM read latches open */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmcecch */ diff --git a/h/drv/multi/auLib.h b/h/drv/multi/auLib.h new file mode 100644 index 0000000..ac1a41c --- /dev/null +++ b/h/drv/multi/auLib.h @@ -0,0 +1,412 @@ +/* auLib.h - Au support header */ + +/* Copyright 2001 Wind River Systems, Inc. */ + +/* + * This file has been developed or significantly modified by the + * MIPS Center of Excellence Dedicated Engineering Staff. + * This notice is as per the MIPS Center of Excellence Master Partner + * Agreement, do not remove this notice without checking first with + * WR/Platforms MIPS Center of Excellence engineering management. + */ + +/* +modification history +-------------------- +01m,14may02,zmm Global au1000 name changes. SPR 77333. +01l,30apr02,zmm Add AU1000_GPIO_PINFUNC definition. +01k,03dec01,zmm Add CofE comment. +01j,27nov01,zmm Add bits of counter control register, fix __cpluscplus bug. +01i,18oct01,pes Merge changes +01h,03oct01,pes Remove references to PHYS_TO_K1 macro so that this file + becomes assembler safe. +01g,26sep01,tlc Correct AC'97 macros. +01f,22aug01,pes Add USB HOST register information +01e,13aug01,tlc Add AC'97 Controller Information. +01d,13aug01,pes Add defines needed to support PCI. Adjust addresses to make + their KSEG1 locations more obvious. +01c,23jul01,zmm Added Static Bus, SDRAM, UART, and clock Controllers. +01b,19jun01,zmm Fix AU1000_INTERRUPT_CONTROLLER1_BASE +01a,18may01,mem written. +*/ + +/* +This file contains I/O addresses and related constants for the +Alchemy Semiconductor Au1000. +*/ + +#ifndef __INCauh +#define __INCauh + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define MSK(n,m) (((1<<(n+1)) - 1) & ~((1<<(m)) - 1)) + +/* Interrupt controllers */ + +#define AU_INTERRUPT_CONTROLLER0_BASE (0xb0400000) +#define AU_INTERRUPT_CONTROLLER1_BASE (0xb1800000) + +#define AU_INT_CTRL_REG(ctrl, reg) \ + (*(volatile UINT32 *)(((ctrl) ? AU_INTERRUPT_CONTROLLER1_BASE \ + : AU_INTERRUPT_CONTROLLER0_BASE) + (reg))) + +#define AU_INTC_CONFIG0_READ(ctrl) AU_INT_CTRL_REG(ctrl, 0x40) +#define AU_INTC_CONFIG0_SET(ctrl) AU_INT_CTRL_REG(ctrl, 0x40) +#define AU_INTC_CONFIG0_CLEAR(ctrl) AU_INT_CTRL_REG(ctrl, 0x44) +#define AU_INTC_CONFIG1_READ(ctrl) AU_INT_CTRL_REG(ctrl, 0x48) +#define AU_INTC_CONFIG1_SET(ctrl) AU_INT_CTRL_REG(ctrl, 0x48) +#define AU_INTC_CONFIG1_CLEAR(ctrl) AU_INT_CTRL_REG(ctrl, 0x4c) +#define AU_INTC_CONFIG2_READ(ctrl) AU_INT_CTRL_REG(ctrl, 0x50) +#define AU_INTC_CONFIG2_SET(ctrl) AU_INT_CTRL_REG(ctrl, 0x50) +#define AU_INTC_CONFIG2_CLEAR(ctrl) AU_INT_CTRL_REG(ctrl, 0x54) +#define AU_INTC_REQUEST0_INT(ctrl) AU_INT_CTRL_REG(ctrl, 0x54) +#define AU_INTC_SOURCE_READ(ctrl) AU_INT_CTRL_REG(ctrl, 0x58) +#define AU_INTC_SOURCE_SET(ctrl) AU_INT_CTRL_REG(ctrl, 0x58) +#define AU_INTC_SOURCE_CLEAR(ctrl) AU_INT_CTRL_REG(ctrl, 0x5c) +#define AU_INTC_REQUEST1_INT(ctrl) AU_INT_CTRL_REG(ctrl, 0x5c) +#define AU_INTC_ASSIGN_REQUEST_READ(ctrl) AU_INT_CTRL_REG(ctrl, 0x60) +#define AU_INTC_ASSIGN_REQUEST_SET(ctrl) AU_INT_CTRL_REG(ctrl, 0x60) +#define AU_INTC_ASSIGN_REQUEST_CLEAR(ctrl) AU_INT_CTRL_REG(ctrl, 0x64) +#define AU_INTC_WAKEUP_READ(ctrl) AU_INT_CTRL_REG(ctrl, 0x68) +#define AU_INTC_WAKEUP_SET(ctrl) AU_INT_CTRL_REG(ctrl, 0x68) +#define AU_INTC_WAKEUP_CLEAR(ctrl) AU_INT_CTRL_REG(ctrl, 0x6c) +#define AU_INTC_MASK_READ(ctrl) AU_INT_CTRL_REG(ctrl, 0x70) +#define AU_INTC_MASK_SET(ctrl) AU_INT_CTRL_REG(ctrl, 0x70) +#define AU_INTC_MASK_CLEAR(ctrl) AU_INT_CTRL_REG(ctrl, 0x74) +#define AU_INTC_RISING_EDGE_DETECT(ctrl) AU_INT_CTRL_REG(ctrl, 0x78) +#define AU_INTC_RISING_EDGE_CLEAR(ctrl) AU_INT_CTRL_REG(ctrl, 0x78) +#define AU_INTC_FALLING_EDGE_DETECT(ctrl) AU_INT_CTRL_REG(ctrl, 0x7c) +#define AU_INTC_FALLING_EDGE_CLEAR(ctrl) AU_INT_CTRL_REG(ctrl, 0x7c) +#define AU_INTC_TEST_BIT(ctrl) AU_INT_CTRL_REG(ctrl, 0x80) + +/* SDRAM controller */ + +#define AU_SDRAM_CONTROLLER_BASE (0xb4000000) +#define AU_SDRAM_REG(reg) (AU_SDRAM_CONTROLLER_BASE + (reg)) + +#define AU_SDRAM_CS_MODE_0 AU_SDRAM_REG(0x00) +#define AU_SDRAM_CS_MODE_1 AU_SDRAM_REG(0x04) +#define AU_SDRAM_CS_MODE_2 AU_SDRAM_REG(0x08) +#define AU_SDRAM_CS_CONFIG_0 AU_SDRAM_REG(0x0c) +#define AU_SDRAM_CS_CONFIG_1 AU_SDRAM_REG(0x10) +#define AU_SDRAM_CS_CONFIG_2 AU_SDRAM_REG(0x14) +#define AU_SDRAM_REFRESH_CONFIG AU_SDRAM_REG(0x18) +#define AU_SDRAM_PRECHARGE_CMD AU_SDRAM_REG(0x1c) +#define AU_SDRAM_AUTO_REFRESH_CMD AU_SDRAM_REG(0x20) +#define AU_SDRAM_WRITE_EXTERN_0 AU_SDRAM_REG(0x24) +#define AU_SDRAM_WRITE_EXTERN_1 AU_SDRAM_REG(0x28) +#define AU_SDRAM_WRITE_EXTERN_2 AU_SDRAM_REG(0x2c) +#define AU_SDRAM_SLEEP AU_SDRAM_REG(0x30) +#define AU_SDRAM_TOGGLE_CKE AU_SDRAM_REG(0x34) + +#define AU_SDRAM_CS_MODE_F (1<<22) +#define AU_SDRAM_CS_MODE_SR (1<<21) +#define AU_SDRAM_CS_MODE_BS (1<<20) +#define AU_SDRAM_CS_MODE_RS MSK(19,18) +#define AU_SDRAM_CS_MODE_CS MSK(17,15) +#define AU_SDRAM_CS_MODE_TRAS MSK(14,11) +#define AU_SDRAM_CS_MODE_TMRD MSK(10,9) +#define AU_SDRAM_CS_MODE_TWR MSK(8,7) +#define AU_SDRAM_CS_MODE_TRP MSK(6,5) +#define AU_SDRAM_CS_MODE_TRCD MSK(4,3) +#define AU_SDRAM_CS_MODE_TCL MSK(2,0) +#define SET_SDRAM_CS_MODE_RS(x) ((x)<<18) +#define SET_SDRAM_CS_MODE_CS(x) ((x)<<15) +#define SET_SDRAM_CS_MODE_TRAS(x) ((x)<<11) +#define SET_SDRAM_CS_MODE_TMRD(x) ((x)<<9) +#define SET_SDRAM_CS_MODE_TWR(x) ((x)<<7) +#define SET_SDRAM_CS_MODE_TRP(x) ((x)<<5) +#define SET_SDRAM_CS_MODE_TRCD(x) ((x)<<3) +#define SET_SDRAM_CS_MODE_TCL(x) (x) + +#define AU_SDRAM_CS_CONFIG_E (1<<20) +#define AU_SDRAM_CS_CONFIG_CSBA MSK(19,10) +#define AU_SDRAM_CS_CONFIG_CSMASK MSK(9,0) +#define SET_SDRAM_CS_CONFIG_CSBA(x) ((x)<<10) +#define SET_SDRAM_CS_CONFIG_CSMASK(x) (x) + +#define AU_SDRAM_REFRESH_CONFIG_TRC MSK(31,28) +#define AU_SDRAM_REFRESH_CONFIG_TRPM MSK(27,26) +#define AU_SDRAM_REFRESH_CONFIG_E (1<<25) +#define AU_SDRAM_REFRESH_CONFIG_REF_INTER MSK(24,0) +#define SET_SDRAM_REFRESH_CONFIG_TRC(x) ((x)<<28) +#define SET_SDRAM_REFRESH_CONFIG_TRPR(x) ((x)<<26) +#define SET_SDRAM_REFRESH_CONFIG_REF_INTER(x) (x) + +/* Static BUS controllers */ + +#define AU_STATIC_CONTROLLER_BASE (0xb4001000) +#define AU_STATIC_REG(chipsel, reg) (AU_STATIC_CONTROLLER_BASE + 0x10*(chipsel) + reg) + +#define AU_STATIC_CONFIG(chipsel) AU_STATIC_REG(chipsel, 0x0) +#define AU_STATIC_TIMING(chipsel) AU_STATIC_REG(chipsel, 0x4) +#define AU_STATIC_ADDRESS(chipsel) AU_STATIC_REG(chipsel, 0x8) + +#define AU_STATIC_CONFIG_BV (1 << 12) +#define AU_STATIC_CONFIG_D5 (1 << 11) +#define AU_STATIC_CONFIG_AV (1 << 10) +#define AU_STATIC_CONFIG_LE (1 << 9) +#define AU_STATIC_CONFIG_TS (1 << 8) +#define AU_STATIC_CONFIG_EW (1 << 7) +#define AU_STATIC_CONFIG_H (1 << 6) +#define AU_STATIC_CONFIG_BS (1 << 5) +#define AU_STATIC_CONFIG_PM (1 << 4) +#define AU_STATIC_CONFIG_RO (1 << 3) +#define AU_STATIC_CONFIG_DTY MSK(2,0) + +#define AU_STATIC_TIMING_TWCS MSK(30,28) +#define AU_STATIC_TIMING_TCSH MSK(27,24) +#define AU_STATIC_TIMING_TWP MSK(19,14) +#define AU_STATIC_TIMING_TCSW MSK(13,10) +#define AU_STATIC_TIMING_TPM MSK(9,6) +#define AU_STATIC_TIMING_TA MSK(5,0) + +#define AU_STATIC_TIMING_TMST MSK(31,24) +#define AU_STATIC_TIMING_TMSU MSK(23,17) +#define AU_STATIC_TIMING_TMIH MSK(16,11) +#define AU_STATIC_TIMING_TIST MSK(10,5) +#define AU_STATIC_TIMING_TISU MSK(4,0) + +#define AU_STATIC_ADDRESS_E (1<<28) +#define AU_STATIC_ADDRESS_CSADDR MSK(27,14) +#define AU_STATIC_ADDRESS_AMASK MSK(13,0) +#define SET_STATIC_ADDRESS_CSADDR(x) ((x)<<14) +#define SET_STATIC_ADDRESS_AMASK(x) (x) + +/* Serial devices, UART 1 - UART 4 */ +#define UART0_BASE_ADR AU_UART_BASE +#define AU_UART_BASE (0xb1100000) +#define AU_UART_REG(uart, reg) (AU_UART_BASE + 0x100000*(uart) + (reg)) + +#define AU_UART_RXDATA(uart) AU_UART_REG(uart,0x000) +#define AU_UART_TXDATA(uart) AU_UART_REG(uart,0x004) +#define AU_UART_INTERRUPT_ENABLE(uart) AU_UART_REG(uart,0x008) +#define AU_UART_INTERRUPT_CAUSE(uart) AU_UART_REG(uart,0x00C) +#define AU_UART_FIFO_CONTROL(uart) AU_UART_REG(uart,0x010) +#define AU_UART_LINE_CONTROL(uart) AU_UART_REG(uart,0x014) +#define AU_UART_MODEM_CONTROL(uart) AU_UART_REG(uart,0x018) +#define AU_UART_LINE_STATUS(uart) AU_UART_REG(uart,0x01C) +#define AU_UART_MODEM_STATUS(uart) AU_UART_REG(uart,0x020) +#define AU_UART_CLOCK_DIVIDER(uart) AU_UART_REG(uart,0x028) +#define AU_UART_MODULE_CONTROL(uart) AU_UART_REG(uart,0x100) + +/* Clock controller */ + +#define AU_CLOCK_BASE (0xb1900000) +#define AU_CLOCK_REG(reg) (AU_CLOCK_BASE + (reg)) + +#define AU_CLOCK_FREQUENCY_CONTROL0 AU_CLOCK_REG(0x20) +#define AU_CLOCK_FREQUENCY_CONTROL1 AU_CLOCK_REG(0x24) +#define AU_CLOCK_CLOCK_SOURCE_CONTROL AU_CLOCK_REG(0x28) +#define AU_CLOCK_CPU_PLL_CONTROL AU_CLOCK_REG(0x60) +#define AU_CLOCK_AUX_PLL_CONTROL AU_CLOCK_REG(0x64) + +/* for use with AU_CLOCK_FREQUENCY_CONTROL0 register */ +#define AU_CLOCK_FREQUENCY_CONTROL_FS0 (1<<0) +#define AU_CLOCK_FREQUENCY_CONTROL_FE0 (1<<1) +#define AU_CLOCK_FREQUENCY_CONTROL_FRDIV0 MSK(9,2) + +#define AU_CLOCK_FREQUENCY_CONTROL_FS1 (1<<10) +#define AU_CLOCK_FREQUENCY_CONTROL_FE1 (1<<11) +#define AU_CLOCK_FREQUENCY_CONTROL_FRDIV1 MSK(19,12) + +#define AU_CLOCK_FREQUENCY_CONTROL_FS2 (1<<20) +#define AU_CLOCK_FREQUENCY_CONTROL_FE2 (1<<21) +#define AU_CLOCK_FREQUENCY_CONTROL_FRDIV2 MSK(29,22) + +#define AU_CLOCK_FREQUENCY_CONTROL_FRDIV0_SH 2 +#define AU_CLOCK_FREQUENCY_CONTROL_FRDIV1_SH 12 +#define AU_CLOCK_FREQUENCY_CONTROL_FRDIV2_SH 22 + +/* for use with AU_CLOCK_FREQUENCY_CONTROL1 register */ +#define AU_CLOCK_FREQUENCY_CONTROL_FS3 (1<<0) +#define AU_CLOCK_FREQUENCY_CONTROL_FE3 (1<<1) +#define AU_CLOCK_FREQUENCY_CONTROL_FRDIV3 MSK(9,2) + +#define AU_CLOCK_FREQUENCY_CONTROL_FS4 (1<<10) +#define AU_CLOCK_FREQUENCY_CONTROL_FE4 (1<<11) +#define AU_CLOCK_FREQUENCY_CONTROL_FRDIV4 MSK(19,12) + +#define AU_CLOCK_FREQUENCY_CONTROL_FS5 (1<<20) +#define AU_CLOCK_FREQUENCY_CONTROL_FE5 (1<<21) +#define AU_CLOCK_FREQUENCY_CONTROL_FRDIV5 MSK(29,22) + +#define AU_CLOCK_FREQUENCY_CONTROL_FRDIV3_SH 2 +#define AU_CLOCK_FREQUENCY_CONTROL_FRDIV4_SH 12 +#define AU_CLOCK_FREQUENCY_CONTROL_FRDIV5_SH 22 + +#define AU_CLOCK_SOURCE_CONTROL_CIR (1<<0) +#define AU_CLOCK_SOURCE_CONTROL_DIR (1<<1) +#define AU_CLOCK_SOURCE_CONTROL_MIR MSK(4,2) +#define AU_CLOCK_SOURCE_CONTROL_CUD (1<<5) +#define AU_CLOCK_SOURCE_CONTROL_DUD (1<<6) +#define AU_CLOCK_SOURCE_CONTROL_MUD MSK(9,7) +#define AU_CLOCK_SOURCE_CONTROL_CUH (1<<10) +#define AU_CLOCK_SOURCE_CONTROL_DUH (1<<11) +#define AU_CLOCK_SOURCE_CONTROL_MUH MSK(14,12) +#define AU_CLOCK_SOURCE_CONTROL_CI2 (1<<15) +#define AU_CLOCK_SOURCE_CONTROL_DI2 (1<<16) +#define AU_CLOCK_SOURCE_CONTROL_MI2 MSK(19,17) +#define AU_CLOCK_SOURCE_CONTROL_CE0 (1<<20) +#define AU_CLOCK_SOURCE_CONTROL_DE0 (1<<21) +#define AU_CLOCK_SOURCE_CONTROL_ME0 MSK(24,22) +#define AU_CLOCK_SOURCE_CONTROL_CE1 (1<<25) +#define AU_CLOCK_SOURCE_CONTROL_DE1 (1<<26) +#define AU_CLOCK_SOURCE_CONTROL_ME1 MSK(29,27) + +#define AU_CLOCK_SOURCE_CONTROL_IR_SH 2 +#define AU_CLOCK_SOURCE_CONTROL_UD_SH 7 +#define AU_CLOCK_SOURCE_CONTROL_UH_SH 12 +#define AU_CLOCK_SOURCE_CONTROL_I2_SH 17 +#define AU_CLOCK_SOURCE_CONTROL_E0_SH 22 +#define AU_CLOCK_SOURCE_CONTROL_E1_SH 27 + +#define AU_CLOCK_SOURCE_CONTROL_AUX 0x1 +#define AU_CLOCK_SOURCE_CONTROL_FREQ0 0x2 +#define AU_CLOCK_SOURCE_CONTROL_FREQ1 0x3 +#define AU_CLOCK_SOURCE_CONTROL_FREQ2 0x4 +#define AU_CLOCK_SOURCE_CONTROL_FREQ3 0x5 +#define AU_CLOCK_SOURCE_CONTROL_FREQ4 0x6 +#define AU_CLOCK_SOURCE_CONTROL_FREQ5 0x7 + +/* GPIO */ +#define AU_GPIO_BASE (0xb1900000) +#define AU_GPIO_REG(reg) (AU_GPIO_BASE + (reg)) + +#define AU_GPIO_PINFUNC AU_GPIO_REG(0x02c) +#define AU_GPIO_TRISTATE_STATE_READ AU_GPIO_REG(0x100) +#define AU_GPIO_TRISTATE_STATE_SET AU_GPIO_REG(0x100) +#define AU_GPIO_OUTPUT_STATE_READ AU_GPIO_REG(0x108) +#define AU_GPIO_OUTPUT_STATE_SET AU_GPIO_REG(0x108) +#define AU_GPIO_OUTPUT_STATE_CLEAR AU_GPIO_REG(0x10c) +#define AU_GPIO_PIN_STATE_READ AU_GPIO_REG(0x110) +#define AU_GPIO_PIN_INPUT_ENABLE AU_GPIO_REG(0x110) +#define AU_SYS_PIN_INPUT_EN AU_GPIO_REG(0x110) + +/* AC'97 Controller */ + +#define AU_AC97_BASE (0xb0000000) +#define AU_AC97_REG(reg) (AU_AC97_BASE + (reg)) + +#define AU_AC97_CONFIG AU_AC97_REG(0x00) +#define AU_AC97_STATUS AU_AC97_REG(0x04) +#define AU_AC97_DATA AU_AC97_REG(0x08) +#define AU_AC97_CMMD AU_AC97_REG(0x0C) +#define AU_AC97_CMMDRESP AU_AC97_REG(0x0C) +#define AU_AC97_ENABLE AU_AC97_REG(0x10) + +#define AU_AC97_CONFIG_RSLOTS MSK(22,13) +#define AU_AC97_CONFIG_RSLOT3 (1 << 13) +#define AU_AC97_CONFIG_RSLOT4 (1 << 14) +#define AU_AC97_CONFIG_RSLOT5 (1 << 15) +#define AU_AC97_CONFIG_RSLOT6 (1 << 16) +#define AU_AC97_CONFIG_RSLOT7 (1 << 17) +#define AU_AC97_CONFIG_RSLOT8 (1 << 18) +#define AU_AC97_CONFIG_RSLOT9 (1 << 19) +#define AU_AC97_CONFIG_RSLOT10 (1 << 20) +#define AU_AC97_CONFIG_RSLOT11 (1 << 21) +#define AU_AC97_CONFIG_RSLOT12 (1 << 22) + +#define AU_AC97_CONFIG_TSLOTS MSK(12,3) +#define AU_AC97_CONFIG_TSLOT3 (1 << 3) +#define AU_AC97_CONFIG_TSLOT4 (1 << 4) +#define AU_AC97_CONFIG_TSLOT5 (1 << 5) +#define AU_AC97_CONFIG_TSLOT6 (1 << 6) +#define AU_AC97_CONFIG_TSLOT7 (1 << 7) +#define AU_AC97_CONFIG_TSLOT8 (1 << 8) +#define AU_AC97_CONFIG_TSLOT9 (1 << 9) +#define AU_AC97_CONFIG_TSLOT10 (1 << 10) +#define AU_AC97_CONFIG_TSLOT11 (1 << 11) +#define AU_AC97_CONFIG_TSLOT12 (1 << 12) + +#define AU_AC97_CONFIG_ACLINK_RESET (1 << 0) + +#define AU_AC97_STATUS_READY (1 << 7) +#define AU_AC97_STATUS_CP (1 << 6) + +#define AU_AC97_CMMD_READ (1 << 7) +#define AU_AC97_CMMD_INDEX MSK(6,0) + +#define AU_AC97_ENABLE_CTRL (1 << 4) +#define AU_AC97_ENABLE_CLOCK (1 << 0) + +#define SET_AC97_COMMAND(reg, value) ((value) << 16 | reg ) +#define GET_AC97_COMMAND(reg) (reg >> 16) + +/* USB Controller */ +#define AU_USB_HOST_BASE (0xb0100000) +#define AU_USB_HOST_REG(reg) (AU_USB_HOST_BASE + (reg)) + +#define AU_USB_HOST_ENABLE AU_USB_HOST_REG(0x7fffc) +/* bits in host config register */ +#define AU_USB_HOST_ENABLE_RD (1 << 4) /* Reset Done */ +#define AU_USB_HOST_ENABLE_CE (1 << 3) /* Clock Enable */ +#define AU_USB_HOST_ENABLE_E (1 << 2) /* Enable */ +#define AU_USB_HOST_ENABLE_C (1 << 1) /* Cacheable */ +#define AU_USB_HOST_ENABLE_BE (1 << 0) /* Big Endian */ + + +#define AU_SYS_BASE (0xb1900000) +#define AU_SYS_REG(reg) (AU_SYS_BASE + (reg)) + +#define AU_SYS_TOY_TRIM AU_SYS_REG(0x00) +#define AU_SYS_TOY_WRITE AU_SYS_REG(0x04) +#define AU_SYS_TOY_MATCH_0 AU_SYS_REG(0x08) +#define AU_SYS_TOY_MATCH_1 AU_SYS_REG(0x0c) +#define AU_SYS_TOY_MATCH_2 AU_SYS_REG(0x10) +#define AU_SYS_COUNTER_CONTROL AU_SYS_REG(0x14) +#define AU_SYS_SCRATCH_0 AU_SYS_REG(0x18) +#define AU_SYS_SCRATCH_1 AU_SYS_REG(0x1c) +#define AU_SYS_FREQ_CONTROL_0 AU_SYS_REG(0x20) +#define AU_SYS_FREQ_CONTROL_1 AU_SYS_REG(0x24) +#define AU_SYS_CLOCK_SOURCE AU_SYS_REG(0x28) +#define AU_SYS_PIN_FUNCTION AU_SYS_REG(0x2c) + +#define AU_SYS_WAKE_MASK AU_SYS_REG(0x34) +#define AU_SYS_ENDIAN AU_SYS_REG(0x38) +#define AU_SYS_POWER_CONTROL AU_SYS_REG(0x3c) +#define AU_SYS_TOY_READ AU_SYS_REG(0x40) +#define AU_SYS_RTC_TRIM AU_SYS_REG(0x44) +#define AU_SYS_RTC_WRITE AU_SYS_REG(0x48) +#define AU_SYS_RTC_MATCH_0 AU_SYS_REG(0x4c) +#define AU_SYS_RTC_MATCH_1 AU_SYS_REG(0x50) +#define AU_SYS_RTC_MATCH_2 AU_SYS_REG(0x54) +#define AU_SYS_RTC_READ AU_SYS_REG(0x58) +#define AU_SYS_WAKE_SOURCE AU_SYS_REG(0x5c) +#define AU_SYS_CPU_PLL AU_SYS_REG(0x60) +#define AU_SYS_AUX_PLL AU_SYS_REG(0x64) + +#define AU_SYS_SLEEP_POWER AU_SYS_REG(0x78) +#define AU_SYS_SLEEP AU_SYS_REG(0x7c) + +/* bits in RTC and TOY control register */ +#define AU_SYS_COUNTER_CONTROL_ERS (1 << 23) +#define AU_SYS_COUNTER_CONTROL_RTS (1 << 20) +#define AU_SYS_COUNTER_CONTROL_RM2 (1 << 19) +#define AU_SYS_COUNTER_CONTROL_RM1 (1 << 18) +#define AU_SYS_COUNTER_CONTROL_RM0 (1 << 17) +#define AU_SYS_COUNTER_CONTROL_RS (1 << 16) +#define AU_SYS_COUNTER_CONTROL_BP (1 << 14) +#define AU_SYS_COUNTER_CONTROL_REN (1 << 13) +#define AU_SYS_COUNTER_CONTROL_BRT (1 << 12) +#define AU_SYS_COUNTER_CONTROL_TEN (1 << 11) +#define AU_SYS_COUNTER_CONTROL_BTT (1 << 10) +#define AU_SYS_COUNTER_CONTROL_EO (1 << 8) +#define AU_SYS_COUNTER_CONTROL_ETS (1 << 7) +#define AU_SYS_COUNTER_CONTROL_32S (1 << 5) +#define AU_SYS_COUNTER_CONTROL_TTS (1 << 4) +#define AU_SYS_COUNTER_CONTROL_TM2 (1 << 3) +#define AU_SYS_COUNTER_CONTROL_TM1 (1 << 2) +#define AU_SYS_COUNTER_CONTROL_TM0 (1 << 1) +#define AU_SYS_COUNTER_CONTROL_TS (1 << 0) + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* __INCauah */ + + + diff --git a/h/drv/multi/bcm1250Lib.h b/h/drv/multi/bcm1250Lib.h new file mode 100644 index 0000000..9249918 --- /dev/null +++ b/h/drv/multi/bcm1250Lib.h @@ -0,0 +1,3512 @@ +/* bcm1250Lib.h - BCM1250 systems-on-chip header file */ + +/* Copyright 2002 Wind River Systems, Inc. */ + +/********************************************************************* +* +* Copyright 2000,2001 +* Broadcom Corporation. All rights reserved. +* +* This software is furnished under license to Wind River Systems, Inc. +* and may be used only in accordance with the terms and conditions +* of this license. No title or ownership is transferred hereby. +********************************************************************* */ + +/* + * This file has been developed or significantly modified by the + * MIPS Center of Excellence Dedicated Engineering Staff. + * This notice is as per the MIPS Center of Excellence Master Partner + * Agreement, do not remove this notice without checking first with + * WR/Platforms MIPS Center of Excellence engineering management. + */ + +/* +modification history +-------------------- +01e,24apr03,pes PAL conditional compilation cleanup. +01d,31may02,pgh Fix the address definitions for R_MAC_CHLO0_BASE and + R_MAC_CHUP0_BASE. +01c,10may02,tlc Add C++ header protection. +01b,17dec01,agf Replace __ASSEMBLER__ with _ASMLANGUAGE +01a,05dec01,agf created +*/ + +/* +DESCRIPTION +This file contains constants for the BCM 1250. Register address +definitions for the various subsystems are provided, and most (but +not all) register field definitions are provided. + +Naming schemes for the BCM 1250 constants are: + + M_xxx MASK constant (identifies bits in a register). + For multi-bit fields, all bits in the field will + be set. + + K_xxx "Code" constant (value for data in a multi-bit + field). The value is right justified. + + V_xxx "Value" constant. This is the same as the + corresponding "K_xxx" constant, except it is + shifted to the correct position in the register. + + S_xxx SHIFT constant. This is the number of bits that + a field value (code) needs to be shifted + (towards the left) to put the value in the right + position for the register. + + A_xxx ADDRESS constant. This will be a physical + address. Use the PHYS_TO_K1 macro to generate + a K1SEG address. + + R_xxx RELATIVE offset constant. This is an offset from + an A_xxx constant (usually the first register in + a group). + + G_xxx(X) GET value. This macro obtains a multi-bit field + from a register, masks it, and shifts it to + the bottom of the register (retrieving a K_xxx + value, for example). + + V_xxx(X) VALUE. This macro computes the value of a + K_xxx constant shifted to the correct position + in the register. +*/ + +#ifndef __INCbcm1250Libh +#define __INCbcm1250Libh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + + /* macros */ + +/* + * Cast to 64-bit number. Presumably the syntax is different in + * assembly language. + * + */ + +#if !defined(_ASMLANGUAGE) +#define _SB_MAKE64(x) ((UINT64)(x)) +#define _SB_MAKE32(x) ((UINT32)(x)) +#else +#define _SB_MAKE64(x) (x) +#define _SB_MAKE32(x) (x) +#endif + + +/* + * Make a mask for 1 bit at position 'n' + */ + +#define _SB_MAKEMASK1(n) (_SB_MAKE64(1) << _SB_MAKE64(n)) +#define _SB_MAKEMASK1_32(n) (_SB_MAKE32(1) << _SB_MAKE32(n)) + +/* + * Make a mask for 'v' bits at position 'n' + */ + +#define _SB_MAKEMASK(v,n) (_SB_MAKE64((_SB_MAKE64(1)<<(v))-1) << _SB_MAKE64(n)) +#define _SB_MAKEMASK_32(v,n) (_SB_MAKE32((_SB_MAKE32(1)<<(v))-1) << _SB_MAKE32(n)) + +/* + * Make a value at 'v' at bit position 'n' + */ + +#define _SB_MAKEVALUE(v,n) (_SB_MAKE64(v) << _SB_MAKE64(n)) +#define _SB_MAKEVALUE_32(v,n) (_SB_MAKE32(v) << _SB_MAKE32(n)) + +#define _SB_GETVALUE(v,n,m) ((_SB_MAKE64(v) & _SB_MAKE64(m)) >> _SB_MAKE64(n)) +#define _SB_GETVALUE_32(v,n,m) ((_SB_MAKE32(v) & _SB_MAKE32(m)) >> _SB_MAKE32(n)) + +/* + * Macros to read/write on-chip registers + */ + +#if !defined(_ASMLANGUAGE) +#define SBWRITECSR(csr,val) *((volatile UINT64 *) PHYS_TO_K1(csr)) = (val) +#define SBREADCSR(csr) (*((volatile UINT64 *) PHYS_TO_K1(csr))) +#endif /* _ASMLANGUAGE*/ + + + /* defines */ + +/* ********************************************************************* + * Some general notes: + * + * For the most part, when there is more than one peripheral + * of the same type on the SOC, the constants below will be + * offsets from the base of each peripheral. For example, + * the MAC registers are described as offsets from the first + * MAC register, and there will be a MAC_REGISTER() macro + * to calculate the base address of a given MAC. + * + * The information in this file is based on the BCM1250 SOC + * manual version 0.2, July 2000. + ********************************************************************* */ + + +/* ********************************************************************* + * Memory Controller Registers + ********************************************************************* */ + +#define A_MC_BASE_0 0x0010051000 +#define A_MC_BASE_1 0x0010052000 +#define MC_REGISTER_SPACING 0x1000 + +#define A_MC_BASE(ctlid) ((ctlid)*MC_REGISTER_SPACING+A_MC_BASE_0) +#define A_MC_REGISTER(ctlid,reg) (A_MC_BASE(ctlid)+(reg)) + +#define R_MC_CONFIG 0x0000000100 +#define R_MC_DRAMCMD 0x0000000120 +#define R_MC_DRAMMODE 0x0000000140 +#define R_MC_TIMING1 0x0000000160 +#define R_MC_TIMING2 0x0000000180 +#define R_MC_CS_START 0x00000001A0 +#define R_MC_CS_END 0x00000001C0 +#define R_MC_CS_INTERLEAVE 0x00000001E0 +#define S_MC_CS_STARTEND 16 + +#define R_MC_CSX_BASE 0x0000000200 +#define R_MC_CSX_ROW 0x0000000000 /* relative to CSX_BASE, above */ +#define R_MC_CSX_COL 0x0000000020 /* relative to CSX_BASE, above */ +#define R_MC_CSX_BA 0x0000000040 /* relative to CSX_BASE, above */ +#define MC_CSX_SPACING 0x0000000060 /* relative to CSX_BASE, above */ + +#define R_MC_CS0_ROW 0x0000000200 +#define R_MC_CS0_COL 0x0000000220 +#define R_MC_CS0_BA 0x0000000240 +#define R_MC_CS1_ROW 0x0000000260 +#define R_MC_CS1_COL 0x0000000280 +#define R_MC_CS1_BA 0x00000002A0 +#define R_MC_CS2_ROW 0x00000002C0 +#define R_MC_CS2_COL 0x00000002E0 +#define R_MC_CS2_BA 0x0000000300 +#define R_MC_CS3_ROW 0x0000000320 +#define R_MC_CS3_COL 0x0000000340 +#define R_MC_CS3_BA 0x0000000360 +#define R_MC_CS_ATTR 0x0000000380 +#define R_MC_TEST_DATA 0x0000000400 +#define R_MC_TEST_ECC 0x0000000420 +#define R_MC_MCLK_CFG 0x0000000500 + +/* ********************************************************************* + * L2 Cache Control Registers + ********************************************************************* */ + +#define A_L2_READ_ADDRESS 0x0010040018 +#define A_L2_EEC_ADDRESS 0x0010040038 +#define A_L2_WAY_DISABLE 0x0010041000 +#define A_L2_MAKEDISABLE(x) (A_L2_WAY_DISABLE | (((~(x))&0x0F) << 8)) +#define A_L2_MGMT_TAG_BASE 0x00D0000000 + +/* ********************************************************************* + * PCI Interface Registers + ********************************************************************* */ + +#define A_PCI_TYPE00_HEADER 0x00DE000000 +#define A_PCI_TYPE01_HEADER 0x00DE000800 + + +/* ********************************************************************* + * Ethernet DMA and MACs + ********************************************************************* */ + +#define A_MAC_BASE_0 0x0010064000 +#define A_MAC_BASE_1 0x0010065000 +#define A_MAC_BASE_2 0x0010066000 + +#define MAC_SPACING 0x1000 +#define MAC_DMA_TXRX_SPACING 0x0400 +#define MAC_DMA_CHANNEL_SPACING 0x0100 +#define DMA_RX 0 +#define DMA_TX 1 +#define MAC_NUM_DMACHAN 2 /* channels per direction */ + +#define MAC_NUM_PORTS 3 + +#define A_MAC_CHANNEL_BASE(macnum) \ + (A_MAC_BASE_0 + \ + MAC_SPACING*(macnum)) + +#define A_MAC_REGISTER(macnum,reg) \ + (A_MAC_BASE_0 + \ + MAC_SPACING*(macnum) + (reg)) + + +#define R_MAC_DMA_CHANNELS 0x800 /* Relative to A_MAC_CHANNEL_BASE */ + +#define A_MAC_DMA_CHANNEL_BASE(macnum,txrx,chan) \ + ((A_MAC_CHANNEL_BASE(macnum)) + \ + R_MAC_DMA_CHANNELS + \ + (MAC_DMA_TXRX_SPACING*(txrx)) + \ + (MAC_DMA_CHANNEL_SPACING*(chan))) + +#define R_MAC_DMA_CHANNEL_BASE(txrx,chan) \ + (R_MAC_DMA_CHANNELS + \ + (MAC_DMA_TXRX_SPACING*(txrx)) + \ + (MAC_DMA_CHANNEL_SPACING*(chan))) + +#define A_MAC_DMA_REGISTER(macnum,txrx,chan,reg) \ + (A_MAC_DMA_CHANNEL_BASE(macnum,txrx,chan) + \ + (reg)) + +#define R_MAC_DMA_REGISTER(txrx,chan,reg) \ + (R_MAC_DMA_CHANNEL_BASE(txrx,chan) + \ + (reg)) + +/* + * DMA channel registers, relative to A_MAC_DMA_CHANNEL_BASE + */ + +#define R_MAC_DMA_CONFIG0 0x00000000 +#define R_MAC_DMA_CONFIG1 0x00000008 +#define R_MAC_DMA_DSCR_BASE 0x00000010 +#define R_MAC_DMA_DSCR_CNT 0x00000018 +#define R_MAC_DMA_CUR_DSCRA 0x00000020 +#define R_MAC_DMA_CUR_DSCRB 0x00000028 +#define R_MAC_DMA_CUR_DSCRADDR 0x00000030 + +/* + * RMON Counters + */ + +#define R_MAC_RMON_TX_BYTES 0x00000000 +#define R_MAC_RMON_COLLISIONS 0x00000008 +#define R_MAC_RMON_LATE_COL 0x00000010 +#define R_MAC_RMON_EX_COL 0x00000018 +#define R_MAC_RMON_FCS_ERROR 0x00000020 +#define R_MAC_RMON_TX_ABORT 0x00000028 +/* Counter #6 (0x30) now reserved */ +#define R_MAC_RMON_TX_BAD 0x00000038 +#define R_MAC_RMON_TX_GOOD 0x00000040 +#define R_MAC_RMON_TX_RUNT 0x00000048 +#define R_MAC_RMON_TX_OVERSIZE 0x00000050 +#define R_MAC_RMON_RX_BYTES 0x00000080 +#define R_MAC_RMON_RX_MCAST 0x00000088 +#define R_MAC_RMON_RX_BCAST 0x00000090 +#define R_MAC_RMON_RX_BAD 0x00000098 +#define R_MAC_RMON_RX_GOOD 0x000000A0 +#define R_MAC_RMON_RX_RUNT 0x000000A8 +#define R_MAC_RMON_RX_OVERSIZE 0x000000B0 +#define R_MAC_RMON_RX_FCS_ERROR 0x000000B8 +#define R_MAC_RMON_RX_LENGTH_ERROR 0x000000C0 +#define R_MAC_RMON_RX_CODE_ERROR 0x000000C8 +#define R_MAC_RMON_RX_ALIGN_ERROR 0x000000D0 + +/* Updated to spec 0.2 */ +#define R_MAC_CFG 0x00000100 +#define R_MAC_THRSH_CFG 0x00000108 +#define R_MAC_VLANTAG 0x00000110 +#define R_MAC_FRAMECFG 0x00000118 +#define R_MAC_EOPCNT 0x00000120 +#define R_MAC_FIFO_PTRS 0x00000130 +#define R_MAC_ADFILTER_CFG 0x00000200 +#define R_MAC_ETHERNET_ADDR 0x00000208 +#define R_MAC_PKT_TYPE 0x00000210 +#define R_MAC_HASH_BASE 0x00000240 +#define R_MAC_ADDR_BASE 0x00000280 +#define R_MAC_CHUP0_BASE 0x00000300 +#define R_MAC_CHLO0_BASE 0x00000320 +#define R_MAC_ENABLE 0x00000400 +#define R_MAC_STATUS 0x00000408 +#define R_MAC_INT_MASK 0x00000410 +#define R_MAC_TXD_CTL 0x00000420 +#define R_MAC_MDIO 0x00000428 +#define R_MAC_DEBUG_STATUS 0x00000448 + +#define MAC_HASH_COUNT 8 +#define MAC_ADDR_COUNT 8 +#define MAC_CHMAP_COUNT 4 + + +/* ********************************************************************* + * DUART Registers + ********************************************************************* */ + + +#define R_DUART_NUM_PORTS 2 + +#define A_DUART 0x0010060000 + +#define A_DUART_REG(r) + +#define DUART_CHANREG_SPACING 0x100 +#define A_DUART_CHANREG(chan,reg) (A_DUART + DUART_CHANREG_SPACING*(chan) + (reg)) +#define R_DUART_CHANREG(chan,reg) (DUART_CHANREG_SPACING*(chan) + (reg)) + +#define R_DUART_MODE_REG_1 0x100 +#define R_DUART_MODE_REG_2 0x110 +#define R_DUART_STATUS 0x120 +#define R_DUART_CLK_SEL 0x130 +#define R_DUART_CMD 0x150 +#define R_DUART_RX_HOLD 0x160 +#define R_DUART_TX_HOLD 0x170 + +/* + * The IMR and ISR can't be addressed with A_DUART_CHANREG, + * so use this macro instead. + */ + +#define R_DUART_AUX_CTRL 0x310 +#define R_DUART_ISR_A 0x320 +#define R_DUART_IMR_A 0x330 +#define R_DUART_ISR_B 0x340 +#define R_DUART_IMR_B 0x350 +#define R_DUART_OUT_PORT 0x360 +#define R_DUART_OPCR 0x370 + +#define R_DUART_SET_OPR 0x3B0 +#define R_DUART_CLEAR_OPR 0x3C0 + +#define DUART_IMRISR_SPACING 0x20 + +#define R_DUART_IMRREG(chan) (R_DUART_IMR_A + (chan)*DUART_IMRISR_SPACING) +#define R_DUART_ISRREG(chan) (R_DUART_ISR_A + (chan)*DUART_IMRISR_SPACING) + +#define A_DUART_IMRREG(chan) (A_DUART + R_DUART_IMRREG(chan)) +#define A_DUART_ISRREG(chan) (A_DUART + R_DUART_ISRREG(chan)) + +/* + * These constants are the absolute addresses. + */ + +#define A_DUART_MODE_REG_1_A 0x0010060100 +#define A_DUART_MODE_REG_2_A 0x0010060110 +#define A_DUART_STATUS_A 0x0010060120 +#define A_DUART_CLK_SEL_A 0x0010060130 +#define A_DUART_CMD_A 0x0010060150 +#define A_DUART_RX_HOLD_A 0x0010060160 +#define A_DUART_TX_HOLD_A 0x0010060170 + +#define A_DUART_MODE_REG_1_B 0x0010060200 +#define A_DUART_MODE_REG_2_B 0x0010060210 +#define A_DUART_STATUS_B 0x0010060220 +#define A_DUART_CLK_SEL_B 0x0010060230 +#define A_DUART_CMD_B 0x0010060250 +#define A_DUART_RX_HOLD_B 0x0010060260 +#define A_DUART_TX_HOLD_B 0x0010060270 + +#define A_DUART_INPORT_CHNG 0x0010060300 +#define A_DUART_AUX_CTRL 0x0010060310 +#define A_DUART_ISR_A 0x0010060320 +#define A_DUART_IMR_A 0x0010060330 +#define A_DUART_ISR_B 0x0010060340 +#define A_DUART_IMR_B 0x0010060350 +#define A_DUART_OUT_PORT 0x0010060360 +#define A_DUART_OPCR 0x0010060370 +#define A_DUART_IN_PORT 0x0010060380 +#define A_DUART_ISR 0x0010060390 +#define A_DUART_IMR 0x00100603A0 +#define A_DUART_SET_OPR 0x00100603B0 +#define A_DUART_CLEAR_OPR 0x00100603C0 +#define A_DUART_INPORT_CHNG_A 0x00100603D0 +#define A_DUART_INPORT_CHNG_B 0x00100603E0 + +/* ********************************************************************* + * Synchronous Serial Registers + ********************************************************************* */ + + +#define A_SER_BASE_0 0x0010060400 +#define A_SER_BASE_1 0x0010060800 +#define SER_SPACING 0x400 + +#define SER_DMA_TXRX_SPACING 0x80 + +#define SER_NUM_PORTS 2 + +#define A_SER_CHANNEL_BASE(sernum) \ + (A_SER_BASE_0 + \ + SER_SPACING*(sernum)) + +#define A_SER_REGISTER(sernum,reg) \ + (A_SER_BASE_0 + \ + SER_SPACING*(sernum) + (reg)) + + +#define R_SER_DMA_CHANNELS 0 /* Relative to A_SER_BASE_x */ + +#define A_SER_DMA_CHANNEL_BASE(sernum,txrx) \ + ((A_SER_CHANNEL_BASE(sernum)) + \ + R_SER_DMA_CHANNELS + \ + (SER_DMA_TXRX_SPACING*(txrx))) + +#define A_SER_DMA_REGISTER(sernum,txrx,reg) \ + (A_SER_DMA_CHANNEL_BASE(sernum,txrx) + \ + (reg)) + + +/* + * DMA channel registers, relative to A_SER_DMA_CHANNEL_BASE + */ + +#define R_SER_DMA_CONFIG0 0x00000000 +#define R_SER_DMA_CONFIG1 0x00000008 +#define R_SER_DMA_DSCR_BASE 0x00000010 +#define R_SER_DMA_DSCR_CNT 0x00000018 +#define R_SER_DMA_CUR_DSCRA 0x00000020 +#define R_SER_DMA_CUR_DSCRB 0x00000028 +#define R_SER_DMA_CUR_DSCRADDR 0x00000030 + +#define R_SER_DMA_CONFIG0_RX 0x00000000 +#define R_SER_DMA_CONFIG1_RX 0x00000008 +#define R_SER_DMA_DSCR_BASE_RX 0x00000010 +#define R_SER_DMA_DSCR_COUNT_RX 0x00000018 +#define R_SER_DMA_CUR_DSCR_A_RX 0x00000020 +#define R_SER_DMA_CUR_DSCR_B_RX 0x00000028 +#define R_SER_DMA_CUR_DSCR_ADDR_RX 0x00000030 + +#define R_SER_DMA_CONFIG0_TX 0x00000080 +#define R_SER_DMA_CONFIG1_TX 0x00000088 +#define R_SER_DMA_DSCR_BASE_TX 0x00000090 +#define R_SER_DMA_DSCR_COUNT_TX 0x00000098 +#define R_SER_DMA_CUR_DSCR_A_TX 0x000000A0 +#define R_SER_DMA_CUR_DSCR_B_TX 0x000000A8 +#define R_SER_DMA_CUR_DSCR_ADDR_TX 0x000000B0 + +#define R_SER_MODE 0x00000100 +#define R_SER_MINFRM_SZ 0x00000108 +#define R_SER_MAXFRM_SZ 0x00000110 +#define R_SER_ADDR 0x00000118 +#define R_SER_USR0_ADDR 0x00000120 +#define R_SER_USR1_ADDR 0x00000128 +#define R_SER_USR2_ADDR 0x00000130 +#define R_SER_USR3_ADDR 0x00000138 +#define R_SER_CMD 0x00000140 +#define R_SER_TX_RD_THRSH 0x00000160 +#define R_SER_TX_WR_THRSH 0x00000168 +#define R_SER_RX_RD_THRSH 0x00000170 +#define R_SER_LINE_MODE 0x00000178 +#define R_SER_DMA_ENABLE 0x00000180 +#define R_SER_INT_MASK 0x00000190 +#define R_SER_STATUS 0x00000188 +#define R_SER_STATUS_DEBUG 0x000001A8 +#define R_SER_RX_TABLE_BASE 0x00000200 +#define SER_RX_TABLE_COUNT 16 +#define R_SER_TX_TABLE_BASE 0x00000300 +#define SER_TX_TABLE_COUNT 16 + +/* RMON Counters */ +#define R_SER_RMON_TX_BYTE_LO 0x000001C0 +#define R_SER_RMON_TX_BYTE_HI 0x000001C8 +#define R_SER_RMON_RX_BYTE_LO 0x000001D0 +#define R_SER_RMON_RX_BYTE_HI 0x000001D8 +#define R_SER_RMON_TX_UNDERRUN 0x000001E0 +#define R_SER_RMON_RX_OVERFLOW 0x000001E8 +#define R_SER_RMON_RX_ERRORS 0x000001F0 +#define R_SER_RMON_RX_BADADDR 0x000001F8 + +/* ********************************************************************* + * Generic Bus Registers + ********************************************************************* */ + +#define IO_EXT_CFG_COUNT 8 + +#define A_IO_EXT_BASE 0x0010061000 +#define A_IO_EXT_REG(r) (A_IO_EXT_BASE + (r)) + +#define A_IO_EXT_CFG_BASE 0x0010061000 +#define A_IO_EXT_MULT_SIZE_BASE 0x0010061100 +#define A_IO_EXT_START_ADDR_BASE 0x0010061200 +#define A_IO_EXT_TIME_CFG0_BASE 0x0010061600 +#define A_IO_EXT_TIME_CFG1_BASE 0x0010061700 + +#define IO_EXT_REGISTER_SPACING 8 +#define A_IO_EXT_CS_BASE(cs) (A_IO_EXT_CFG_BASE+IO_EXT_REGISTER_SPACING*(cs)) +#define R_IO_EXT_REG(reg,cs) ((cs)*IO_EXT_REGISTER_SPACING + (reg)) + +#define R_IO_EXT_CFG 0x0000 +#define R_IO_EXT_MULT_SIZE 0x0100 +#define R_IO_EXT_START_ADDR 0x0200 +#define R_IO_EXT_TIME_CFG0 0x0600 +#define R_IO_EXT_TIME_CFG1 0x0700 + + +#define A_IO_INTERRUPT_STATUS 0x0010061A00 +#define A_IO_INTERRUPT_DATA0 0x0010061A10 +#define A_IO_INTERRUPT_DATA1 0x0010061A18 +#define A_IO_INTERRUPT_DATA2 0x0010061A20 +#define A_IO_INTERRUPT_DATA3 0x0010061A28 +#define A_IO_INTERRUPT_ADDR0 0x0010061A30 +#define A_IO_INTERRUPT_ADDR1 0x0010061A40 +#define A_IO_INTERRUPT_PARITY 0x0010061A50 +#define A_IO_PCMCIA_CFG 0x0010061A60 +#define A_IO_PCMCIA_STATUS 0x0010061A70 +#define A_IO_DRIVE_0 0x0010061300 +#define A_IO_DRIVE_1 0x0010061308 +#define A_IO_DRIVE_2 0x0010061310 +#define A_IO_DRIVE_3 0x0010061318 + +#define R_IO_INTERRUPT_STATUS 0x0A00 +#define R_IO_INTERRUPT_DATA0 0x0A10 +#define R_IO_INTERRUPT_DATA1 0x0A18 +#define R_IO_INTERRUPT_DATA2 0x0A20 +#define R_IO_INTERRUPT_DATA3 0x0A28 +#define R_IO_INTERRUPT_ADDR0 0x0A30 +#define R_IO_INTERRUPT_ADDR1 0x0A40 +#define R_IO_INTERRUPT_PARITY 0x0A50 +#define R_IO_PCMCIA_CFG 0x0A60 +#define R_IO_PCMCIA_STATUS 0x0A70 + +/* ********************************************************************* + * GPIO Registers + ********************************************************************* */ + +#define A_GPIO_CLR_EDGE 0x0010061A80 +#define A_GPIO_INT_TYPE 0x0010061A88 +#define A_GPIO_INPUT_INVERT 0x0010061A90 +#define A_GPIO_GLITCH 0x0010061A98 +#define A_GPIO_READ 0x0010061AA0 +#define A_GPIO_DIRECTION 0x0010061AA8 +#define A_GPIO_PIN_CLR 0x0010061AB0 +#define A_GPIO_PIN_SET 0x0010061AB8 + +#define A_GPIO_BASE 0x0010061A80 + +#define R_GPIO_CLR_EDGE 0x00 +#define R_GPIO_INT_TYPE 0x08 +#define R_GPIO_INPUT_INVERT 0x10 +#define R_GPIO_GLITCH 0x18 +#define R_GPIO_READ 0x20 +#define R_GPIO_DIRECTION 0x28 +#define R_GPIO_PIN_CLR 0x30 +#define R_GPIO_PIN_SET 0x38 + +/* ********************************************************************* + * SMBus Registers + ********************************************************************* */ + +#define A_SMB_XTRA_0 0x0010060000 +#define A_SMB_XTRA_1 0x0010060008 +#define A_SMB_FREQ_0 0x0010060010 +#define A_SMB_FREQ_1 0x0010060018 +#define A_SMB_STATUS_0 0x0010060020 +#define A_SMB_STATUS_1 0x0010060028 +#define A_SMB_CMD_0 0x0010060030 +#define A_SMB_CMD_1 0x0010060038 +#define A_SMB_START_0 0x0010060040 +#define A_SMB_START_1 0x0010060048 +#define A_SMB_DATA_0 0x0010060050 +#define A_SMB_DATA_1 0x0010060058 +#define A_SMB_CONTROL_0 0x0010060060 +#define A_SMB_CONTROL_1 0x0010060068 +#define A_SMB_PEC_0 0x0010060070 +#define A_SMB_PEC_1 0x0010060078 + +#define A_SMB_0 0x0010060000 +#define A_SMB_1 0x0010060008 +#define SMB_REGISTER_SPACING 0x8 +#define A_SMB_BASE(idx) (A_SMB_0+(idx)*SMB_REGISTER_SPACING) +#define A_SMB_REGISTER(idx,reg) (A_SMB_BASE(idx)+(reg)) + +#define R_SMB_XTRA 0x0000000000 +#define R_SMB_FREQ 0x0000000010 +#define R_SMB_STATUS 0x0000000020 +#define R_SMB_CMD 0x0000000030 +#define R_SMB_START 0x0000000040 +#define R_SMB_DATA 0x0000000050 +#define R_SMB_CONTROL 0x0000000060 +#define R_SMB_PEC 0x0000000070 + +/* ********************************************************************* + * Timer Registers + ********************************************************************* */ + +/* + * Watchdog timers + */ + +#define A_SCD_WDOG_0 0x0010020050 +#define A_SCD_WDOG_1 0x0010020150 +#define SCD_WDOG_SPACING 0x100 +#define SCD_NUM_WDOGS 2 +#define A_SCD_WDOG_BASE(w) (A_SCD_WDOG_0+SCD_WDOG_SPACING*(w)) +#define A_SCD_WDOG_REGISTER(w,r) (A_SCD_WDOG_BASE(w) + (r)) + +#define R_SCD_WDOG_INIT 0x0000000000 +#define R_SCD_WDOG_CNT 0x0000000008 +#define R_SCD_WDOG_CFG 0x0000000010 + +#define A_SCD_WDOG_INIT_0 0x0010020050 +#define A_SCD_WDOG_CNT_0 0x0010020058 +#define A_SCD_WDOG_CFG_0 0x0010020060 + +#define A_SCD_WDOG_INIT_1 0x0010020150 +#define A_SCD_WDOG_CNT_1 0x0010020158 +#define A_SCD_WDOG_CFG_1 0x0010020160 + +/* + * Generic timers + */ + +#define A_SCD_TIMER_0 0x0010020070 +#define A_SCD_TIMER_1 0x0010020078 +#define A_SCD_TIMER_2 0x0010020170 +#define A_SCD_TIMER_3 0x0010020178 +#define SCD_NUM_TIMERS 4 +#define A_SCD_TIMER_BASE(w) (A_SCD_TIMER_0+0x08*((w)&1)+0x100*(((w)&2)>>1)) +#define A_SCD_TIMER_REGISTER(w,r) (A_SCD_TIMER_BASE(w) + (r)) + +#define R_SCD_TIMER_INIT 0x0000000000 +#define R_SCD_TIMER_CNT 0x0000000010 +#define R_SCD_TIMER_CFG 0x0000000020 + +#define A_SCD_TIMER_INIT_0 0x0010020070 +#define A_SCD_TIMER_CNT_0 0x0010020080 +#define A_SCD_TIMER_CFG_0 0x0010020090 + +#define A_SCD_TIMER_INIT_1 0x0010020078 +#define A_SCD_TIMER_CNT_1 0x0010020088 +#define A_SCD_TIMER_CFG_1 0x0010020098 + +#define A_SCD_TIMER_INIT_2 0x0010020170 +#define A_SCD_TIMER_CNT_2 0x0010020180 +#define A_SCD_TIMER_CFG_2 0x0010020190 + +#define A_SCD_TIMER_INIT_3 0x0010020178 +#define A_SCD_TIMER_CNT_3 0x0010020188 +#define A_SCD_TIMER_CFG_3 0x0010020198 + +/* ********************************************************************* + * System Control Registers + ********************************************************************* */ + +#define A_SCD_SYSTEM_REVISION 0x0010020000 +#define A_SCD_SYSTEM_CFG 0x0010020008 + +#define A_SCD_SCRATCH 0x0010020C10 /* PASS2 */ + +/* ********************************************************************* + * System Address Trap Registers + ********************************************************************* */ + +#define A_ADDR_TRAP_INDEX 0x00100200B0 +#define A_ADDR_TRAP_REG 0x00100200B8 +#define A_ADDR_TRAP_UP_0 0x0010020400 +#define A_ADDR_TRAP_UP_1 0x0010020408 +#define A_ADDR_TRAP_UP_2 0x0010020410 +#define A_ADDR_TRAP_UP_3 0x0010020418 +#define A_ADDR_TRAP_DOWN_0 0x0010020420 +#define A_ADDR_TRAP_DOWN_1 0x0010020428 +#define A_ADDR_TRAP_DOWN_2 0x0010020430 +#define A_ADDR_TRAP_DOWN_3 0x0010020438 +#define A_ADDR_TRAP_CFG_0 0x0010020440 +#define A_ADDR_TRAP_CFG_1 0x0010020448 +#define A_ADDR_TRAP_CFG_2 0x0010020450 +#define A_ADDR_TRAP_CFG_3 0x0010020458 + + +/* ********************************************************************* + * System Interrupt Mapper Registers + ********************************************************************* */ + +#define A_IMR_CPU0_BASE 0x0010020000 +#define A_IMR_CPU1_BASE 0x0010022000 +#define IMR_REGISTER_SPACING 0x2000 + +#define A_IMR_MAPPER(cpu) (A_IMR_CPU0_BASE+(cpu)*IMR_REGISTER_SPACING) +#define A_IMR_REGISTER(cpu,reg) (A_IMR_MAPPER(cpu)+(reg)) + +#define R_IMR_INTERRUPT_DIAG 0x0010 +#define R_IMR_INTERRUPT_MASK 0x0028 +#define R_IMR_INTERRUPT_TRACE 0x0038 +#define R_IMR_INTERRUPT_SOURCE_STATUS 0x0040 +#define R_IMR_LDT_INTERRUPT_SET 0x0048 +#define R_IMR_LDT_INTERRUPT 0x0018 +#define R_IMR_LDT_INTERRUPT_CLR 0x0020 +#define R_IMR_MAILBOX_CPU 0x00c0 +#define R_IMR_ALIAS_MAILBOX_CPU 0x1000 +#define R_IMR_MAILBOX_SET_CPU 0x00C8 +#define R_IMR_ALIAS_MAILBOX_SET_CPU 0x1008 +#define R_IMR_MAILBOX_CLR_CPU 0x00D0 +#define R_IMR_INTERRUPT_STATUS_BASE 0x0100 +#define R_IMR_INTERRUPT_STATUS_COUNT 7 +#define R_IMR_INTERRUPT_MAP_BASE 0x0200 +#define R_IMR_INTERRUPT_MAP_COUNT 64 + +/* ********************************************************************* + * System Performance Counter Registers + ********************************************************************* */ + +#define A_SCD_PERF_CNT_CFG 0x00100204C0 +#define A_SCD_PERF_CNT_0 0x00100204D0 +#define A_SCD_PERF_CNT_1 0x00100204D8 +#define A_SCD_PERF_CNT_2 0x00100204E0 +#define A_SCD_PERF_CNT_3 0x00100204E8 + +/* ********************************************************************* + * System Bus Watcher Registers + ********************************************************************* */ + +#define A_SCD_BUS_ERR_STATUS 0x0010020880 +#define A_BUS_ERR_DATA_0 0x00100208A0 +#define A_BUS_ERR_DATA_1 0x00100208A8 +#define A_BUS_ERR_DATA_2 0x00100208B0 +#define A_BUS_ERR_DATA_3 0x00100208B8 +#define A_BUS_L2_ERRORS 0x00100208C0 +#define A_BUS_MEM_IO_ERRORS 0x00100208C8 + +/* ********************************************************************* + * System Debug Controller Registers + ********************************************************************* */ + +#define A_SCD_JTAG_BASE 0x0010000000 + +/* ********************************************************************* + * System Trace Buffer Registers + ********************************************************************* */ + +#define A_SCD_TRACE_CFG 0x0010020A00 +#define A_SCD_TRACE_READ 0x0010020A08 +#define A_SCD_TRACE_EVENT_0 0x0010020A20 +#define A_SCD_TRACE_EVENT_1 0x0010020A28 +#define A_SCD_TRACE_EVENT_2 0x0010020A30 +#define A_SCD_TRACE_EVENT_3 0x0010020A38 +#define A_SCD_TRACE_SEQUENCE_0 0x0010020A40 +#define A_SCD_TRACE_SEQUENCE_1 0x0010020A48 +#define A_SCD_TRACE_SEQUENCE_2 0x0010020A50 +#define A_SCD_TRACE_SEQUENCE_3 0x0010020A58 +#define A_SCD_TRACE_EVENT_4 0x0010020A60 +#define A_SCD_TRACE_EVENT_5 0x0010020A68 +#define A_SCD_TRACE_EVENT_6 0x0010020A70 +#define A_SCD_TRACE_EVENT_7 0x0010020A78 +#define A_SCD_TRACE_SEQUENCE_4 0x0010020A80 +#define A_SCD_TRACE_SEQUENCE_5 0x0010020A88 +#define A_SCD_TRACE_SEQUENCE_6 0x0010020A90 +#define A_SCD_TRACE_SEQUENCE_7 0x0010020A98 + +/* ********************************************************************* + * System Generic DMA Registers + ********************************************************************* */ + +#define A_DM_0 0x0010020B00 +#define A_DM_1 0x0010020B20 +#define A_DM_2 0x0010020B40 +#define A_DM_3 0x0010020B60 +#define DM_REGISTER_SPACING 0x20 +#define DM_NUM_CHANNELS 4 +#define A_DM_BASE(idx) (A_DM_0 + ((idx) * DM_REGISTER_SPACING)) +#define A_DM_REGISTER(idx,reg) (A_DM_BASE(idx) + (reg)) + +#define R_DM_DSCR_BASE 0x0000000000 +#define R_DM_DSCR_COUNT 0x0000000008 +#define R_DM_CUR_DSCR_ADDR 0x0000000010 +#define R_DM_DSCR_BASE_DEBUG 0x0000000018 + + +/* ********************************************************************* + * Physical Address Map + ********************************************************************* */ + +#define A_PHYS_MEMORY_0 _SB_MAKE64(0x0000000000) +#define A_PHYS_MEMORY_SIZE _SB_MAKE64((256*1024*1024)) +#define A_PHYS_SYSTEM_CTL _SB_MAKE64(0x0010000000) +#define A_PHYS_IO_SYSTEM _SB_MAKE64(0x0010060000) +#define A_PHYS_GENBUS _SB_MAKE64(0x0010090000) +#define A_PHYS_GENBUS_END _SB_MAKE64(0x0040000000) +#define A_PHYS_LDTPCI_IO_MATCH_BYTES_32 _SB_MAKE64(0x0040000000) +#define A_PHYS_LDTPCI_IO_MATCH_BITS_32 _SB_MAKE64(0x0060000000) +#define A_PHYS_MEMORY_1 _SB_MAKE64(0x0080000000) +#define A_PHYS_MEMORY_2 _SB_MAKE64(0x0090000000) +#define A_PHYS_MEMORY_3 _SB_MAKE64(0x00C0000000) +#define A_PHYS_L2_CACHE_TEST _SB_MAKE64(0x00D0000000) +#define A_PHYS_LDT_SPECIAL_MATCH_BYTES _SB_MAKE64(0x00D8000000) +#define A_PHYS_LDTPCI_IO_MATCH_BYTES _SB_MAKE64(0x00DC000000) +#define A_PHYS_LDTPCI_CFG_MATCH_BYTES _SB_MAKE64(0x00DE000000) +#define A_PHYS_LDT_SPECIAL_MATCH_BITS _SB_MAKE64(0x00F8000000) +#define A_PHYS_LDTPCI_IO_MATCH_BITS _SB_MAKE64(0x00FC000000) +#define A_PHYS_LDTPCI_CFG_MATCH_BITS _SB_MAKE64(0x00FE000000) +#define A_PHYS_MEMORY_EXP _SB_MAKE64(0x0100000000) +#define A_PHYS_MEMORY_EXP_SIZE _SB_MAKE64((508*1024*1024*1024)) +#define A_PHYS_LDT_EXP _SB_MAKE64(0x8000000000) +#define A_PHYS_PCI_FULLACCESS_BYTES _SB_MAKE64(0xF000000000) +#define A_PHYS_PCI_FULLACCESS_BITS _SB_MAKE64(0xF100000000) +#define A_PHYS_RESERVED _SB_MAKE64(0xF200000000) +#define A_PHYS_RESERVED_SPECIAL_LDT _SB_MAKE64(0xFD00000000) + +#define A_PHYS_L2CACHE_WAY_SIZE _SB_MAKE64(0x0000020000) +#define PHYS_L2CACHE_NUM_WAYS 4 +#define A_PHYS_L2CACHE_TOTAL_SIZE _SB_MAKE64(0x0000080000) +#define A_PHYS_L2CACHE_WAY0 _SB_MAKE64(0x00D0180000) +#define A_PHYS_L2CACHE_WAY1 _SB_MAKE64(0x00D01A0000) +#define A_PHYS_L2CACHE_WAY2 _SB_MAKE64(0x00D01C0000) +#define A_PHYS_L2CACHE_WAY3 _SB_MAKE64(0x00D01E0000) + + +/* ********************************************************************* + * + * The remainder are field definitions within the SOC registers + * + * The information in this file is based on the BCM1250 SOC + * manual version 0.2, July 2000. + ********************************************************************* */ + +/* ********************************************************************* + * System control/debug register constants + ********************************************************************* */ + +/* + * System Revision Register (Table 4-1) + */ + +#define M_SYS_RESERVED _SB_MAKEMASK(8,0) + +#define S_SYS_REVISION _SB_MAKE64(8) +#define M_SYS_REVISION _SB_MAKEMASK(8,S_SYS_REVISION) +#define V_SYS_REVISION(x) _SB_MAKEVALUE(x,S_SYS_REVISION) +#define G_SYS_REVISION(x) _SB_GETVALUE(x,S_SYS_REVISION,M_SYS_REVISION) + +#define K_SYS_REVISION_PASS1 1 +#define K_SYS_REVISION_PASS2 3 +#define K_SYS_REVISION_PASS3 4 /* XXX Unknown */ + +#define S_SYS_PART _SB_MAKE64(16) +#define M_SYS_PART _SB_MAKEMASK(16,S_SYS_PART) +#define V_SYS_PART(x) _SB_MAKEVALUE(x,S_SYS_PART) +#define G_SYS_PART(x) _SB_GETVALUE(x,S_SYS_PART,M_SYS_PART) + +#define K_SYS_PART_BCM1250 0x1250 +#define K_SYS_PART_SB1125 0x1125 + +#define S_SYS_WID _SB_MAKE64(32) +#define M_SYS_WID _SB_MAKEMASK(32,S_SYS_WID) +#define V_SYS_WID(x) _SB_MAKEVALUE(x,S_SYS_WID) +#define G_SYS_WID(x) _SB_GETVALUE(x,S_SYS_WID,M_SYS_WID) + +/* + * System Config Register (Table 4-2) + * Register: SCD_SYSTEM_CFG + */ + +#define M_SYS_LDT_PLL_BYP _SB_MAKEMASK1(3) +#define M_SYS_PCI_SYNC_TEST_MODE _SB_MAKEMASK1(4) +#define M_SYS_IOB0_DIV _SB_MAKEMASK1(5) +#define M_SYS_IOB1_DIV _SB_MAKEMASK1(6) + +#define S_SYS_PLL_DIV _SB_MAKE64(7) +#define M_SYS_PLL_DIV _SB_MAKEMASK(5,S_SYS_PLL_DIV) +#define V_SYS_PLL_DIV(x) _SB_MAKEVALUE(x,S_SYS_PLL_DIV) +#define G_SYS_PLL_DIV(x) _SB_GETVALUE(x,S_SYS_PLL_DIV,M_SYS_PLL_DIV) + +#define M_SYS_SER0_ENABLE _SB_MAKEMASK1(12) +#define M_SYS_SER0_RSTB_EN _SB_MAKEMASK1(13) +#define M_SYS_SER1_ENABLE _SB_MAKEMASK1(14) +#define M_SYS_SER1_RSTB_EN _SB_MAKEMASK1(15) +#define M_SYS_PCMCIA_ENABLE _SB_MAKEMASK1(16) + +#define S_SYS_BOOT_MODE _SB_MAKE64(17) +#define M_SYS_BOOT_MODE _SB_MAKEMASK(2,S_SYS_BOOT_MODE) +#define V_SYS_BOOT_MODE(x) _SB_MAKEVALUE(x,S_SYS_BOOT_MODE) +#define G_SYS_BOOT_MODE(x) _SB_GETVALUE(x,S_SYS_BOOT_MODE,M_SYS_BOOT_MODE) +#define K_SYS_BOOT_MODE_ROM32 0 +#define K_SYS_BOOT_MODE_ROM8 1 +#define K_SYS_BOOT_MODE_SMBUS_SMALL 2 +#define K_SYS_BOOT_MODE_SMBUS_BIG 3 + +#define M_SYS_PCI_HOST _SB_MAKEMASK1(19) +#define M_SYS_PCI_ARBITER _SB_MAKEMASK1(20) +#define M_SYS_SOUTH_ON_LDT _SB_MAKEMASK1(21) +#define M_SYS_BIG_ENDIAN _SB_MAKEMASK1(22) +#define M_SYS_GENCLK_EN _SB_MAKEMASK1(23) +#define M_SYS_LDT_TEST_EN _SB_MAKEMASK1(24) +#define M_SYS_GEN_PARITY_EN _SB_MAKEMASK1(25) + +#define S_SYS_CONFIG 26 +#define M_SYS_CONFIG _SB_MAKEMASK(6,S_SYS_CONFIG) +#define V_SYS_CONFIG(x) _SB_MAKEVALUE(x,S_SYS_CONFIG) +#define G_SYS_CONFIG(x) _SB_GETVALUE(x,S_SYS_CONFIG,M_SYS_CONFIG) + +/* The following bits are writeable by JTAG only. */ + +#define M_SYS_CLKSTOP _SB_MAKEMASK1(32) +#define M_SYS_CLKSTEP _SB_MAKEMASK1(33) + +#define S_SYS_CLKCOUNT 34 +#define M_SYS_CLKCOUNT _SB_MAKEMASK(8,S_SYS_CLKCOUNT) +#define V_SYS_CLKCOUNT(x) _SB_MAKEVALUE(x,S_SYS_CLKCOUNT) +#define G_SYS_CLKCOUNT(x) _SB_GETVALUE(x,S_SYS_CLKCOUNT,M_SYS_CLKCOUNT) + +#define M_SYS_PLL_BYPASS _SB_MAKEMASK1(42) + +#define S_SYS_PLL_IREF 43 +#define M_SYS_PLL_IREF _SB_MAKEMASK(2,S_SYS_PLL_IREF) + +#define S_SYS_PLL_VCO 45 +#define M_SYS_PLL_VCO _SB_MAKEMASK(2,S_SYS_PLL_VCO) + +#define S_SYS_PLL_VREG 47 +#define M_SYS_PLL_VREG _SB_MAKEMASK(2,S_SYS_PLL_VREG) + +#define M_SYS_MEM_RESET _SB_MAKEMASK1(49) +#define M_SYS_L2C_RESET _SB_MAKEMASK1(50) +#define M_SYS_IO_RESET_0 _SB_MAKEMASK1(51) +#define M_SYS_IO_RESET_1 _SB_MAKEMASK1(52) +#define M_SYS_SCD_RESET _SB_MAKEMASK1(53) + +/* End of bits writable by JTAG only. */ + +#define M_SYS_CPU_RESET_0 _SB_MAKEMASK1(54) +#define M_SYS_CPU_RESET_1 _SB_MAKEMASK1(55) + +#define M_SYS_UNICPU0 _SB_MAKEMASK1(56) +#define M_SYS_UNICPU1 _SB_MAKEMASK1(57) + +#define M_SYS_SB_SOFTRES _SB_MAKEMASK1(58) +#define M_SYS_EXT_RESET _SB_MAKEMASK1(59) +#define M_SYS_SYSTEM_RESET _SB_MAKEMASK1(60) + +#define M_SYS_MISR_MODE _SB_MAKEMASK1(61) +#define M_SYS_MISR_RESET _SB_MAKEMASK1(62) + +/* + * Mailbox Registers (Table 4-3) + * Registers: SCD_MBOX_CPU_x + */ + +#define S_MBOX_INT_3 0 +#define M_MBOX_INT_3 _SB_MAKEMASK(16,S_MBOX_INT_3) +#define S_MBOX_INT_2 16 +#define M_MBOX_INT_2 _SB_MAKEMASK(16,S_MBOX_INT_2) +#define S_MBOX_INT_1 32 +#define M_MBOX_INT_1 _SB_MAKEMASK(16,S_MBOX_INT_1) +#define S_MBOX_INT_0 48 +#define M_MBOX_INT_0 _SB_MAKEMASK(16,S_MBOX_INT_0) + +/* + * Watchdog Registers (Table 4-8) (Table 4-9) (Table 4-10) + * Registers: SCD_WDOG_INIT_CNT_x + */ + +#define V_SCD_WDOG_FREQ 1000000 + +#define S_SCD_WDOG_INIT 0 +#define M_SCD_WDOG_INIT _SB_MAKEMASK(13,S_SCD_WDOG_INIT) + +#define S_SCD_WDOG_CNT 0 +#define M_SCD_WDOG_CNT _SB_MAKEMASK(13,S_SCD_WDOG_CNT) + +#define M_SCD_WDOG_ENABLE _SB_MAKEMASK1(0) + +/* + * Timer Registers (Table 4-11) (Table 4-12) (Table 4-13) + */ + +#define V_SCD_TIMER_FREQ 1000000 + +#define S_SCD_TIMER_INIT 0 +#define M_SCD_TIMER_INIT _SB_MAKEMASK(20,S_SCD_TIMER_INIT) +#define V_SCD_TIMER_INIT(x) _SB_MAKEVALUE(x,S_SCD_TIMER_INIT) +#define G_SCD_TIMER_INIT(x) _SB_GETVALUE(x,S_SCD_TIMER_INIT,M_SCD_TIMER_INIT) + +#define S_SCD_TIMER_CNT 0 +#define M_SCD_TIMER_CNT _SB_MAKEMASK(20,S_SCD_TIMER_CNT) +#define V_SCD_TIMER_CNT(x) _SB_MAKEVALUE(x,S_SCD_TIMER_CNT) +#define G_SCD_TIMER_CNT(x) _SB_GETVALUE(x,S_SCD_TIMER_CNT,M_SCD_TIMER_CNT) + +#define M_SCD_TIMER_ENABLE _SB_MAKEMASK1(0) +#define M_SCD_TIMER_MODE _SB_MAKEMASK1(1) +#define M_SCD_TIMER_MODE_CONTINUOUS M_SCD_TIMER_MODE + +/* + * System Performance Counters + */ + +#define S_SPC_CFG_SRC0 0 +#define M_SPC_CFG_SRC0 _SB_MAKEMASK(8,S_SPC_CFG_SRC0) +#define V_SPC_CFG_SRC0(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC0) +#define G_SPC_CFG_SRC0(x) _SB_GETVALUE(x,S_SPC_CFG_SRC0,M_SPC_CFG_SRC0) + +#define S_SPC_CFG_SRC1 8 +#define M_SPC_CFG_SRC1 _SB_MAKEMASK(8,S_SPC_CFG_SRC1) +#define V_SPC_CFG_SRC1(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC1) +#define G_SPC_CFG_SRC1(x) _SB_GETVALUE(x,S_SPC_CFG_SRC1,M_SPC_CFG_SRC1) + +#define S_SPC_CFG_SRC2 16 +#define M_SPC_CFG_SRC2 _SB_MAKEMASK(8,S_SPC_CFG_SRC2) +#define V_SPC_CFG_SRC2(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC2) +#define G_SPC_CFG_SRC2(x) _SB_GETVALUE(x,S_SPC_CFG_SRC2,M_SPC_CFG_SRC2) + +#define S_SPC_CFG_SRC3 24 +#define M_SPC_CFG_SRC3 _SB_MAKEMASK(8,S_SPC_CFG_SRC3) +#define V_SPC_CFG_SRC3(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC3) +#define G_SPC_CFG_SRC3(x) _SB_GETVALUE(x,S_SPC_CFG_SRC3,M_SPC_CFG_SRC3) + +#define M_SPC_CFG_CLEAR _SB_MAKEMASK1(32) +#define M_SPC_CFG_ENABLE _SB_MAKEMASK1(33) + + +/* + * Bus Watcher + */ + +#define S_SCD_BERR_TID 8 +#define M_SCD_BERR_TID _SB_MAKEMASK(10,S_SCD_BERR_TID) +#define V_SCD_BERR_TID(x) _SB_MAKEVALUE(x,S_SCD_BERR_TID) +#define G_SCD_BERR_TID(x) _SB_GETVALUE(x,S_SCD_BERR_TID,M_SCD_BERR_TID) + +#define S_SCD_BERR_RID 18 +#define M_SCD_BERR_RID _SB_MAKEMASK(4,S_SCD_BERR_RID) +#define V_SCD_BERR_RID(x) _SB_MAKEVALUE(x,S_SCD_BERR_RID) +#define G_SCD_BERR_RID(x) _SB_GETVALUE(x,S_SCD_BERR_RID,M_SCD_BERR_RID) + +#define S_SCD_BERR_DCODE 22 +#define M_SCD_BERR_DCODE _SB_MAKEMASK(3,S_SCD_BERR_DCODE) +#define V_SCD_BERR_DCODE(x) _SB_MAKEVALUE(x,S_SCD_BERR_DCODE) +#define G_SCD_BERR_DCODE(x) _SB_GETVALUE(x,S_SCD_BERR_DCODE,M_SCD_BERR_DCODE) + +#define M_SCD_BERR_MULTERRS _SB_MAKEMASK1(30) + + +#define S_SCD_L2ECC_CORR_D 0 +#define M_SCD_L2ECC_CORR_D _SB_MAKEMASK(8,S_SCD_L2ECC_CORR_D) +#define V_SCD_L2ECC_CORR_D(x) _SB_MAKEVALUE(x,S_SCD_L2ECC_CORR_D) +#define G_SCD_L2ECC_CORR_D(x) _SB_GETVALUE(x,S_SCD_L2ECC_CORR_D,M_SCD_L2ECC_CORR_D) + +#define S_SCD_L2ECC_BAD_D 8 +#define M_SCD_L2ECC_BAD_D _SB_MAKEMASK(8,S_SCD_L2ECC_BAD_D) +#define V_SCD_L2ECC_BAD_D(x) _SB_MAKEVALUE(x,S_SCD_L2ECC_BAD_D) +#define G_SCD_L2ECC_BAD_D(x) _SB_GETVALUE(x,S_SCD_L2ECC_BAD_D,M_SCD_L2ECC_BAD_D) + +#define S_SCD_L2ECC_CORR_T 16 +#define M_SCD_L2ECC_CORR_T _SB_MAKEMASK(8,S_SCD_L2ECC_CORR_T) +#define V_SCD_L2ECC_CORR_T(x) _SB_MAKEVALUE(x,S_SCD_L2ECC_CORR_T) +#define G_SCD_L2ECC_CORR_T(x) _SB_GETVALUE(x,S_SCD_L2ECC_CORR_T,M_SCD_L2ECC_CORR_T) + +#define S_SCD_L2ECC_BAD_T 24 +#define M_SCD_L2ECC_BAD_T _SB_MAKEMASK(8,S_SCD_L2ECC_BAD_T) +#define V_SCD_L2ECC_BAD_T(x) _SB_MAKEVALUE(x,S_SCD_L2ECC_BAD_T) +#define G_SCD_L2ECC_BAD_T(x) _SB_GETVALUE(x,S_SCD_L2ECC_BAD_T,M_SCD_L2ECC_BAD_T) + +#define S_SCD_MEM_ECC_CORR 0 +#define M_SCD_MEM_ECC_CORR _SB_MAKEMASK(8,S_SCD_MEM_ECC_CORR) +#define V_SCD_MEM_ECC_CORR(x) _SB_MAKEVALUE(x,S_SCD_MEM_ECC_CORR) +#define G_SCD_MEM_ECC_CORR(x) _SB_GETVALUE(x,S_SCD_MEM_ECC_CORR,M_SCD_MEM_ECC_CORR) + +#define S_SCD_MEM_ECC_BAD 16 +#define M_SCD_MEM_ECC_BAD _SB_MAKEMASK(8,S_SCD_MEM_ECC_BAD) +#define V_SCD_MEM_ECC_BAD(x) _SB_MAKEVALUE(x,S_SCD_MEM_ECC_BAD) +#define G_SCD_MEM_ECC_BAD(x) _SB_GETVALUE(x,S_SCD_MEM_ECC_BAD,M_SCD_MEM_ECC_BAD) + +#define S_SCD_MEM_BUSERR 24 +#define M_SCD_MEM_BUSERR _SB_MAKEMASK(8,S_SCD_MEM_BUSERR) +#define V_SCD_MEM_BUSERR(x) _SB_MAKEVALUE(x,S_SCD_MEM_BUSERR) +#define G_SCD_MEM_BUSERR(x) _SB_GETVALUE(x,S_SCD_MEM_BUSERR,M_SCD_MEM_BUSERR) + + +/* + * Address Trap Registers + */ + +#define M_ATRAP_INDEX _SB_MAKEMASK(4,0) +#define M_ATRAP_ADDRESS _SB_MAKEMASK(40,0) + +#define S_ATRAP_CFG_CNT 0 +#define M_ATRAP_CFG_CNT _SB_MAKEMASK(3,S_ATRAP_CFG_CNT) +#define V_ATRAP_CFG_CNT(x) _SB_MAKEVALUE(x,S_ATRAP_CFG_CNT) +#define G_ATRAP_CFG_CNT(x) _SB_GETVALUE(x,S_ATRAP_CFG_CNT,M_ATRAP_CFG_CNT) + +#define M_ATRAP_CFG_WRITE _SB_MAKEMASK1(3) +#define M_ATRAP_CFG_ALL _SB_MAKEMASK1(4) +#define M_ATRAP_CFG_INV _SB_MAKEMASK1(5) +#define M_ATRAP_CFG_USESRC _SB_MAKEMASK1(6) +#define M_ATRAP_CFG_SRCINV _SB_MAKEMASK1(7) + +#define S_ATRAP_CFG_AGENTID 8 +#define M_ATRAP_CFG_AGENTID _SB_MAKEMASK(4,S_ATRAP_CFG_AGENTID) +#define V_ATRAP_CFG_AGENTID(x) _SB_MAKEVALUE(x,S_ATRAP_CFG_AGENTID) +#define G_ATRAP_CFG_AGENTID(x) _SB_GETVALUE(x,S_ATRAP_CFG_AGENTID,M_ATRAP_CFG_AGENTID) + +#define K_BUS_AGENT_CPU0 0 +#define K_BUS_AGENT_CPU1 1 +#define K_BUS_AGENT_IOB0 2 +#define K_BUS_AGENT_IOB1 3 +#define K_BUS_AGENT_SCD 4 +#define K_BUS_AGENT_RESERVED 5 +#define K_BUS_AGENT_L2C 6 +#define K_BUS_AGENT_MC 7 + +#define S_ATRAP_CFG_CATTR 12 +#define M_ATRAP_CFG_CATTR _SB_MAKEMASK(3,S_ATRAP_CFG_CATTR) +#define V_ATRAP_CFG_CATTR(x) _SB_MAKEVALUE(x,S_ATRAP_CFG_CATTR) +#define G_ATRAP_CFG_CATTR(x) _SB_GETVALUE(x,S_ATRAP_CFG_CATTR,M_ATRAP_CFG_CATTR) + +#define K_ATRAP_CFG_CATTR_IGNORE 0 +#define K_ATRAP_CFG_CATTR_UNC 1 +#define K_ATRAP_CFG_CATTR_CACHEABLE 2 +#define K_ATRAP_CFG_CATTR_NONCOH 3 +#define K_ATRAP_CFG_CATTR_COHERENT 4 +#define K_ATRAP_CFG_CATTR_NOTUNC 5 +#define K_ATRAP_CFG_CATTR_NOTNONCOH 6 +#define K_ATRAP_CFG_CATTR_NOTCOHERENT 7 + +/* + * Trace Buffer Config register + */ + +#define M_SCD_TRACE_CFG_RESET _SB_MAKEMASK1(0) +#define M_SCD_TRACE_CFG_START_READ _SB_MAKEMASK1(1) +#define M_SCD_TRACE_CFG_START _SB_MAKEMASK1(2) +#define M_SCD_TRACE_CFG_STOP _SB_MAKEMASK1(3) +#define M_SCD_TRACE_CFG_FREEZE _SB_MAKEMASK1(4) +#define M_SCD_TRACE_CFG_FREEZE_FULL _SB_MAKEMASK1(5) +#define M_SCD_TRACE_CFG_DEBUG_FULL _SB_MAKEMASK1(6) +#define M_SCD_TRACE_CFG_FULL _SB_MAKEMASK1(7) + +#define S_SCD_TRACE_CFG_CUR_ADDR 10 +#define M_SCD_TRACE_CFG_CUR_ADDR _SB_MAKEMASK(8,S_SCD_TRACE_CFG_CUR_ADDR) +#define V_SCD_TRACE_CFG_CUR_ADDR(x) _SB_MAKEVALUE(x,S_SCD_TRACE_CFG_CUR_ADDR) +#define G_SCD_TRACE_CFG_CUR_ADDR(x) _SB_GETVALUE(x,S_SCD_TRACE_CFG_CUR_ADDR,M_SCD_TRACE_CFG_CUR_ADDR) + +/* + * Trace Event registers + */ + +#define S_SCD_TREVT_ADDR_MATCH 0 +#define M_SCD_TREVT_ADDR_MATCH _SB_MAKEMASK(4,S_SCD_TREVT_ADDR_MATCH) +#define V_SCD_TREVT_ADDR_MATCH(x) _SB_MAKEVALUE(x,S_SCD_TREVT_ADDR_MATCH) +#define G_SCD_TREVT_ADDR_MATCH(x) _SB_GETVALUE(x,S_SCD_TREVT_ADDR_MATCH,M_SCD_TREVT_ADDR_MATCH) + +#define M_SCD_TREVT_REQID_MATCH _SB_MAKEMASK1(4) +#define M_SCD_TREVT_DATAID_MATCH _SB_MAKEMASK1(5) +#define M_SCD_TREVT_RESPID_MATCH _SB_MAKEMASK1(6) +#define M_SCD_TREVT_INTERRUPT _SB_MAKEMASK1(7) +#define M_SCD_TREVT_DEBUG_PIN _SB_MAKEMASK1(9) +#define M_SCD_TREVT_WRITE _SB_MAKEMASK1(10) +#define M_SCD_TREVT_READ _SB_MAKEMASK1(11) + +#define S_SCD_TREVT_REQID 12 +#define M_SCD_TREVT_REQID _SB_MAKEMASK(4,S_SCD_TREVT_REQID) +#define V_SCD_TREVT_REQID(x) _SB_MAKEVALUE(x,S_SCD_TREVT_REQID) +#define G_SCD_TREVT_REQID(x) _SB_GETVALUE(x,S_SCD_TREVT_REQID,M_SCD_TREVT_REQID) + +#define S_SCD_TREVT_RESPID 16 +#define M_SCD_TREVT_RESPID _SB_MAKEMASK(4,S_SCD_TREVT_RESPID) +#define V_SCD_TREVT_RESPID(x) _SB_MAKEVALUE(x,S_SCD_TREVT_RESPID) +#define G_SCD_TREVT_RESPID(x) _SB_GETVALUE(x,S_SCD_TREVT_RESPID,M_SCD_TREVT_RESPID) + +#define S_SCD_TREVT_DATAID 20 +#define M_SCD_TREVT_DATAID _SB_MAKEMASK(4,S_SCD_TREVT_DATAID) +#define V_SCD_TREVT_DATAID(x) _SB_MAKEVALUE(x,S_SCD_TREVT_DATAID) +#define G_SCD_TREVT_DATAID(x) _SB_GETVALUE(x,S_SCD_TREVT_DATAID,M_SCD_TREVT_DATID) + +#define S_SCD_TREVT_COUNT 24 +#define M_SCD_TREVT_COUNT _SB_MAKEMASK(8,S_SCD_TREVT_COUNT) +#define V_SCD_TREVT_COUNT(x) _SB_MAKEVALUE(x,S_SCD_TREVT_COUNT) +#define G_SCD_TREVT_COUNT(x) _SB_GETVALUE(x,S_SCD_TREVT_COUNT,M_SCD_TREVT_COUNT) + +/* + * Trace Sequence registers + */ + +#define S_SCD_TRSEQ_EVENT4 0 +#define M_SCD_TRSEQ_EVENT4 _SB_MAKEMASK(4,S_SCD_TRSEQ_EVENT4) +#define V_SCD_TRSEQ_EVENT4(x) _SB_MAKEVALUE(x,S_SCD_TRSEQ_EVENT4) +#define G_SCD_TRSEQ_EVENT4(x) _SB_GETVALUE(x,S_SCD_TRSEQ_EVENT4,M_SCD_TRSEQ_EVENT4) + +#define S_SCD_TRSEQ_EVENT3 4 +#define M_SCD_TRSEQ_EVENT3 _SB_MAKEMASK(4,S_SCD_TRSEQ_EVENT3) +#define V_SCD_TRSEQ_EVENT3(x) _SB_MAKEVALUE(x,S_SCD_TRSEQ_EVENT3) +#define G_SCD_TRSEQ_EVENT3(x) _SB_GETVALUE(x,S_SCD_TRSEQ_EVENT3,M_SCD_TRSEQ_EVENT3) + +#define S_SCD_TRSEQ_EVENT2 8 +#define M_SCD_TRSEQ_EVENT2 _SB_MAKEMASK(4,S_SCD_TRSEQ_EVENT2) +#define V_SCD_TRSEQ_EVENT2(x) _SB_MAKEVALUE(x,S_SCD_TRSEQ_EVENT2) +#define G_SCD_TRSEQ_EVENT2(x) _SB_GETVALUE(x,S_SCD_TRSEQ_EVENT2,M_SCD_TRSEQ_EVENT2) + +#define S_SCD_TRSEQ_EVENT1 12 +#define M_SCD_TRSEQ_EVENT1 _SB_MAKEMASK(4,S_SCD_TRSEQ_EVENT1) +#define V_SCD_TRSEQ_EVENT1(x) _SB_MAKEVALUE(x,S_SCD_TRSEQ_EVENT1) +#define G_SCD_TRSEQ_EVENT1(x) _SB_GETVALUE(x,S_SCD_TRSEQ_EVENT1,M_SCD_TRSEQ_EVENT1) + +#define K_SCD_TRSEQ_E0 0 +#define K_SCD_TRSEQ_E1 1 +#define K_SCD_TRSEQ_E2 2 +#define K_SCD_TRSEQ_E3 3 +#define K_SCD_TRSEQ_E0_E1 4 +#define K_SCD_TRSEQ_E1_E2 5 +#define K_SCD_TRSEQ_E2_E3 6 +#define K_SCD_TRSEQ_E0_E1_E2 7 +#define K_SCD_TRSEQ_E0_E1_E2_E3 8 +#define K_SCD_TRSEQ_E0E1 9 +#define K_SCD_TRSEQ_E0E1E2 10 +#define K_SCD_TRSEQ_E0E1E2E3 11 +#define K_SCD_TRSEQ_E0E1_E2 12 +#define K_SCD_TRSEQ_E0E1_E2E3 13 +#define K_SCD_TRSEQ_E0E1_E2_E3 14 +#define K_SCD_TRSEQ_IGNORED 15 + +#define K_SCD_TRSEQ_TRIGGER_ALL (V_SCD_TRSEQ_EVENT1(K_SCD_TRSEQ_IGNORED) | \ + V_SCD_TRSEQ_EVENT2(K_SCD_TRSEQ_IGNORED) | \ + V_SCD_TRSEQ_EVENT3(K_SCD_TRSEQ_IGNORED) | \ + V_SCD_TRSEQ_EVENT4(K_SCD_TRSEQ_IGNORED)) + +#define S_SCD_TRSEQ_FUNCTION 16 +#define M_SCD_TRSEQ_FUNCTION _SB_MAKEMASK(4,S_SCD_TRSEQ_FUNCTION) +#define V_SCD_TRSEQ_FUNCTION(x) _SB_MAKEVALUE(x,S_SCD_TRSEQ_FUNCTION) +#define G_SCD_TRSEQ_FUNCTION(x) _SB_GETVALUE(x,S_SCD_TRSEQ_FUNCTION,M_SCD_TRSEQ_FUNCTION) + +#define K_SCD_TRSEQ_FUNC_NOP 0 +#define K_SCD_TRSEQ_FUNC_START 1 +#define K_SCD_TRSEQ_FUNC_STOP 2 +#define K_SCD_TRSEQ_FUNC_FREEZE 3 + +#define V_SCD_TRSEQ_FUNC_NOP V_SCD_TRSEQ_FUNCTION(K_SCD_TRSEQ_FUNC_NOP) +#define V_SCD_TRSEQ_FUNC_START V_SCD_TRSEQ_FUNCTION(K_SCD_TRSEQ_FUNC_START) +#define V_SCD_TRSEQ_FUNC_STOP V_SCD_TRSEQ_FUNCTION(K_SCD_TRSEQ_FUNC_STOP) +#define V_SCD_TRSEQ_FUNC_FREEZE V_SCD_TRSEQ_FUNCTION(K_SCD_TRSEQ_FUNC_FREEZE) + +#define M_SCD_TRSEQ_ASAMPLE _SB_MAKEMASK1(18) +#define M_SCD_TRSEQ_DSAMPLE _SB_MAKEMASK1(19) +#define M_SCD_TRSEQ_DEBUGPIN _SB_MAKEMASK1(20) +#define M_SCD_TRSEQ_DEBUGCPU _SB_MAKEMASK1(21) +#define M_SCD_TRSEQ_CLEARUSE _SB_MAKEMASK1(22) + + +/* ********************************************************************* + * Interrupt Mapper Constants + ********************************************************************* */ + +/* + * Interrupt sources (Table 4-8, UM 0.2) + * + * First, the interrupt numbers. + */ + +#define K_INT_WATCHDOG_TIMER_0 0 +#define K_INT_WATCHDOG_TIMER_1 1 +#define K_INT_TIMER_0 2 +#define K_INT_TIMER_1 3 +#define K_INT_TIMER_2 4 +#define K_INT_TIMER_3 5 +#define K_INT_SMB_0 6 +#define K_INT_SMB_1 7 +#define K_INT_UART_0 8 +#define K_INT_UART_1 9 +#define K_INT_SER_0 10 +#define K_INT_SER_1 11 +#define K_INT_PCMCIA 12 +#define K_INT_ADDR_TRAP 13 +#define K_INT_PERF_CNT 14 +#define K_INT_TRACE_FREEZE 15 +#define K_INT_BAD_ECC 16 +#define K_INT_COR_ECC 17 +#define K_INT_IO_BUS 18 +#define K_INT_MAC_0 19 +#define K_INT_MAC_1 20 +#define K_INT_MAC_2 21 +#define K_INT_DM_CH_0 22 +#define K_INT_DM_CH_1 23 +#define K_INT_DM_CH_2 24 +#define K_INT_DM_CH_3 25 +#define K_INT_MBOX_0 26 +#define K_INT_MBOX_1 27 +#define K_INT_MBOX_2 28 +#define K_INT_MBOX_3 29 +#define K_INT_SPARE_0 30 +#define K_INT_SPARE_1 31 +#define K_INT_GPIO_0 32 +#define K_INT_GPIO_1 33 +#define K_INT_GPIO_2 34 +#define K_INT_GPIO_3 35 +#define K_INT_GPIO_4 36 +#define K_INT_GPIO_5 37 +#define K_INT_GPIO_6 38 +#define K_INT_GPIO_7 39 +#define K_INT_GPIO_8 40 +#define K_INT_GPIO_9 41 +#define K_INT_GPIO_10 42 +#define K_INT_GPIO_11 43 +#define K_INT_GPIO_12 44 +#define K_INT_GPIO_13 45 +#define K_INT_GPIO_14 46 +#define K_INT_GPIO_15 47 +#define K_INT_LDT_FATAL 48 +#define K_INT_LDT_NONFATAL 49 +#define K_INT_LDT_SMI 50 +#define K_INT_LDT_NMI 51 +#define K_INT_LDT_INIT 52 +#define K_INT_LDT_STARTUP 53 +#define K_INT_LDT_EXT 54 +#define K_INT_PCI_ERROR 55 +#define K_INT_PCI_INTA 56 +#define K_INT_PCI_INTB 57 +#define K_INT_PCI_INTC 58 +#define K_INT_PCI_INTD 59 +#define K_INT_SPARE_2 60 +#define K_INT_SPARE_3 61 +#define K_INT_SPARE_4 62 +#define K_INT_SPARE_5 63 + +/* + * Mask values for each interrupt + */ + +#define M_INT_WATCHDOG_TIMER_0 _SB_MAKEMASK1(K_INT_WATCHDOG_TIMER_0) +#define M_INT_WATCHDOG_TIMER_1 _SB_MAKEMASK1(K_INT_WATCHDOG_TIMER_1) +#define M_INT_TIMER_0 _SB_MAKEMASK1(K_INT_TIMER_0) +#define M_INT_TIMER_1 _SB_MAKEMASK1(K_INT_TIMER_1) +#define M_INT_TIMER_2 _SB_MAKEMASK1(K_INT_TIMER_2) +#define M_INT_TIMER_3 _SB_MAKEMASK1(K_INT_TIMER_3) +#define M_INT_SMB_0 _SB_MAKEMASK1(K_INT_SMB_0) +#define M_INT_SMB_1 _SB_MAKEMASK1(K_INT_SMB_1) +#define M_INT_UART_0 _SB_MAKEMASK1(K_INT_UART_0) +#define M_INT_UART_1 _SB_MAKEMASK1(K_INT_UART_1) +#define M_INT_SER_0 _SB_MAKEMASK1(K_INT_SER_0) +#define M_INT_SER_1 _SB_MAKEMASK1(K_INT_SER_1) +#define M_INT_PCMCIA _SB_MAKEMASK1(K_INT_PCMCIA) +#define M_INT_ADDR_TRAP _SB_MAKEMASK1(K_INT_ADDR_TRAP) +#define M_INT_PERF_CNT _SB_MAKEMASK1(K_INT_PERF_CNT) +#define M_INT_TRACE_FREEZE _SB_MAKEMASK1(K_INT_TRACE_FREEZE) +#define M_INT_BAD_ECC _SB_MAKEMASK1(K_INT_BAD_ECC) +#define M_INT_COR_ECC _SB_MAKEMASK1(K_INT_COR_ECC) +#define M_INT_IO_BUS _SB_MAKEMASK1(K_INT_IO_BUS) +#define M_INT_MAC_0 _SB_MAKEMASK1(K_INT_MAC_0) +#define M_INT_MAC_1 _SB_MAKEMASK1(K_INT_MAC_1) +#define M_INT_MAC_2 _SB_MAKEMASK1(K_INT_MAC_2) +#define M_INT_DM_CH_0 _SB_MAKEMASK1(K_INT_DM_CH_0) +#define M_INT_DM_CH_1 _SB_MAKEMASK1(K_INT_DM_CH_1) +#define M_INT_DM_CH_2 _SB_MAKEMASK1(K_INT_DM_CH_2) +#define M_INT_DM_CH_3 _SB_MAKEMASK1(K_INT_DM_CH_3) +#define M_INT_MBOX_0 _SB_MAKEMASK1(K_INT_MBOX_0) +#define M_INT_MBOX_1 _SB_MAKEMASK1(K_INT_MBOX_1) +#define M_INT_MBOX_2 _SB_MAKEMASK1(K_INT_MBOX_2) +#define M_INT_MBOX_3 _SB_MAKEMASK1(K_INT_MBOX_3) +#define M_INT_SPARE_0 _SB_MAKEMASK1(K_INT_SPARE_0) +#define M_INT_SPARE_1 _SB_MAKEMASK1(K_INT_SPARE_1) +#define M_INT_GPIO_0 _SB_MAKEMASK1(K_INT_GPIO_0) +#define M_INT_GPIO_1 _SB_MAKEMASK1(K_INT_GPIO_1) +#define M_INT_GPIO_2 _SB_MAKEMASK1(K_INT_GPIO_2) +#define M_INT_GPIO_3 _SB_MAKEMASK1(K_INT_GPIO_3) +#define M_INT_GPIO_4 _SB_MAKEMASK1(K_INT_GPIO_4) +#define M_INT_GPIO_5 _SB_MAKEMASK1(K_INT_GPIO_5) +#define M_INT_GPIO_6 _SB_MAKEMASK1(K_INT_GPIO_6) +#define M_INT_GPIO_7 _SB_MAKEMASK1(K_INT_GPIO_7) +#define M_INT_GPIO_8 _SB_MAKEMASK1(K_INT_GPIO_8) +#define M_INT_GPIO_9 _SB_MAKEMASK1(K_INT_GPIO_9) +#define M_INT_GPIO_10 _SB_MAKEMASK1(K_INT_GPIO_10) +#define M_INT_GPIO_11 _SB_MAKEMASK1(K_INT_GPIO_11) +#define M_INT_GPIO_12 _SB_MAKEMASK1(K_INT_GPIO_12) +#define M_INT_GPIO_13 _SB_MAKEMASK1(K_INT_GPIO_13) +#define M_INT_GPIO_14 _SB_MAKEMASK1(K_INT_GPIO_14) +#define M_INT_GPIO_15 _SB_MAKEMASK1(K_INT_GPIO_15) +#define M_INT_LDT_FATAL _SB_MAKEMASK1(K_INT_LDT_FATAL) +#define M_INT_LDT_NONFATAL _SB_MAKEMASK1(K_INT_LDT_NONFATAL) +#define M_INT_LDT_SMI _SB_MAKEMASK1(K_INT_LDT_SMI) +#define M_INT_LDT_NMI _SB_MAKEMASK1(K_INT_LDT_NMI) +#define M_INT_LDT_INIT _SB_MAKEMASK1(K_INT_LDT_INIT) +#define M_INT_LDT_STARTUP _SB_MAKEMASK1(K_INT_LDT_STARTUP) +#define M_INT_LDT_EXT _SB_MAKEMASK1(K_INT_LDT_EXT) +#define M_INT_PCI_ERROR _SB_MAKEMASK1(K_INT_PCI_ERROR) +#define M_INT_PCI_INTA _SB_MAKEMASK1(K_INT_PCI_INTA) +#define M_INT_PCI_INTB _SB_MAKEMASK1(K_INT_PCI_INTB) +#define M_INT_PCI_INTC _SB_MAKEMASK1(K_INT_PCI_INTC) +#define M_INT_PCI_INTD _SB_MAKEMASK1(K_INT_PCI_INTD) +#define M_INT_SPARE_2 _SB_MAKEMASK1(K_INT_SPARE_2) +#define M_INT_SPARE_3 _SB_MAKEMASK1(K_INT_SPARE_3) +#define M_INT_SPARE_4 _SB_MAKEMASK1(K_INT_SPARE_4) +#define M_INT_SPARE_5 _SB_MAKEMASK1(K_INT_SPARE_5) + +/* + * Interrupt mappings + */ + +#define K_INT_MAP_I0 0 /* interrupt pins on processor */ +#define K_INT_MAP_I1 1 +#define K_INT_MAP_I2 2 +#define K_INT_MAP_I3 3 +#define K_INT_MAP_I4 4 +#define K_INT_MAP_I5 5 +#define K_INT_MAP_NMI 6 /* nonmaskable */ +#define K_INT_MAP_DINT 7 /* debug interrupt */ + +/* + * LDT Interrupt Set Register (table 4-5) + */ + +#define S_INT_LDT_INTMSG 0 +#define M_INT_LDT_INTMSG _SB_MAKEMASK(3,S_INT_LDT_INTMSG) +#define V_INT_LDT_INTMSG(x) _SB_MAKEVALUE(x,S_INT_LDT_INTMSG) +#define G_INT_LDT_INTMSG(x) _SB_GETVALUE(x,S_INT_LDT_INTMSG,M_INT_LDT_INTMSG) + +#define K_INT_LDT_INTMSG_FIXED 0 +#define K_INT_LDT_INTMSG_ARBITRATED 1 +#define K_INT_LDT_INTMSG_SMI 2 +#define K_INT_LDT_INTMSG_NMI 3 +#define K_INT_LDT_INTMSG_INIT 4 +#define K_INT_LDT_INTMSG_STARTUP 5 +#define K_INT_LDT_INTMSG_EXTINT 6 +#define K_INT_LDT_INTMSG_RESERVED 7 + +#define M_INT_LDT_EDGETRIGGER 0 +#define M_INT_LDT_LEVELTRIGGER _SB_MAKEMASK1(3) + +#define M_INT_LDT_PHYSICALDEST 0 +#define M_INT_LDT_LOGICALDEST _SB_MAKEMASK1(4) + +#define S_INT_LDT_INTDEST 5 +#define M_INT_LDT_INTDEST _SB_MAKEMASK(10,S_INT_LDT_INTDEST) +#define V_INT_LDT_INTDEST(x) _SB_MAKEVALUE(x,S_INT_LDT_INTDEST) +#define G_INT_LDT_INTDEST(x) _SB_GETVALUE(x,S_INT_LDT_INTDEST,M_INT_LDT_INTDEST) + +#define S_INT_LDT_VECTOR 13 +#define M_INT_LDT_VECTOR _SB_MAKEMASK(8,S_INT_LDT_VECTOR) +#define V_INT_LDT_VECTOR(x) _SB_MAKEVALUE(x,S_INT_LDT_VECTOR) +#define G_INT_LDT_VECTOR(x) _SB_GETVALUE(x,S_INT_LDT_VECTOR,M_INT_LDT_VECTOR) + +/* + * Vector format (Table 4-6) + */ + +#define M_LDTVECT_RAISEINT 0x00 +#define M_LDTVECT_RAISEMBOX 0x40 + + +/* ********************************************************************* + * Level 2 Cache constants + ********************************************************************* */ + +/* + * Level 2 Cache Tag register (Table 5-3) + */ + +#define S_L2C_TAG_MBZ 0 +#define M_L2C_TAG_MBZ _SB_MAKEMASK(5,S_L2C_TAG_MBZ) + +#define S_L2C_TAG_INDEX 5 +#define M_L2C_TAG_INDEX _SB_MAKEMASK(12,S_L2C_TAG_INDEX) +#define V_L2C_TAG_INDEX(x) _SB_MAKEVALUE(x,S_L2C_TAG_INDEX) +#define G_L2C_TAG_INDEX(x) _SB_GETVALUE(x,S_L2C_TAG_INDEX,M_L2C_TAG_INDEX) + +#define S_L2C_TAG_TAG 17 +#define M_L2C_TAG_TAG _SB_MAKEMASK(23,S_L2C_TAG_TAG) +#define V_L2C_TAG_TAG(x) _SB_MAKEVALUE(x,S_L2C_TAG_TAG) +#define G_L2C_TAG_TAG(x) _SB_GETVALUE(x,S_L2C_TAG_TAG,M_L2C_TAG_TAG) + +#define S_L2C_TAG_ECC 40 +#define M_L2C_TAG_ECC _SB_MAKEMASK(6,S_L2C_TAG_ECC) +#define V_L2C_TAG_ECC(x) _SB_MAKEVALUE(x,S_L2C_TAG_ECC) +#define G_L2C_TAG_ECC(x) _SB_GETVALUE(x,S_L2C_TAG_ECC,M_L2C_TAG_ECC) + +#define S_L2C_TAG_WAY 46 +#define M_L2C_TAG_WAY _SB_MAKEMASK(2,S_L2C_TAG_WAY) +#define V_L2C_TAG_WAY(x) _SB_MAKEVALUE(x,S_L2C_TAG_WAY) +#define G_L2C_TAG_WAY(x) _SB_GETVALUE(x,S_L2C_TAG_WAY,M_L2C_TAG_WAY) + +#define M_L2C_TAG_DIRTY _SB_MAKEMASK1(48) +#define M_L2C_TAG_VALID _SB_MAKEMASK1(49) + +/* + * Format of level 2 cache management address (table 5-2) + */ + +#define S_L2C_MGMT_INDEX 5 +#define M_L2C_MGMT_INDEX _SB_MAKEMASK(12,S_L2C_MGMT_INDEX) +#define V_L2C_MGMT_INDEX(x) _SB_MAKEVALUE(x,S_L2C_MGMT_INDEX) +#define G_L2C_MGMT_INDEX(x) _SB_GETVALUE(x,S_L2C_MGMT_INDEX,M_L2C_MGMT_INDEX) + +#define S_L2C_MGMT_WAY 17 +#define M_L2C_MGMT_WAY _SB_MAKEMASK(2,S_L2C_MGMT_WAY) +#define V_L2C_MGMT_WAY(x) _SB_MAKEVALUE(x,S_L2C_MGMT_WAY) +#define G_L2C_MGMT_WAY(x) _SB_GETVALUE(x,S_L2C_MGMT_WAY,M_L2C_MGMT_WAY) + +#define S_L2C_MGMT_TAG 21 +#define M_L2C_MGMT_TAG _SB_MAKEMASK(6,S_L2C_MGMT_TAG) +#define V_L2C_MGMT_TAG(x) _SB_MAKEVALUE(x,S_L2C_MGMT_TAG) +#define G_L2C_MGMT_TAG(x) _SB_GETVALUE(x,S_L2C_MGMT_TAG,M_L2C_MGMT_TAG) + +#define M_L2C_MGMT_DIRTY _SB_MAKEMASK1(19) +#define M_L2C_MGMT_VALID _SB_MAKEMASK1(20) + +#define A_L2C_MGMT_TAG_BASE 0x00D0000000 + + +/* ********************************************************************* + * Memory Channel constants + ********************************************************************* */ + +/* + * Memory Channel Config Register (table 6-14) + */ + +#define S_MC_RESERVED0 0 +#define M_MC_RESERVED0 _SB_MAKEMASK(8,S_MC_RESERVED0) + +#define S_MC_CHANNEL_SEL 8 +#define M_MC_CHANNEL_SEL _SB_MAKEMASK(8,S_MC_CHANNEL_SEL) +#define V_MC_CHANNEL_SEL(x) _SB_MAKEVALUE(x,S_MC_CHANNEL_SEL) +#define G_MC_CHANNEL_SEL(x) _SB_GETVALUE(x,S_MC_CHANNEL_SEL,M_MC_CHANNEL_SEL) + +#define S_MC_BANK0_MAP 16 +#define M_MC_BANK0_MAP _SB_MAKEMASK(4,S_MC_BANK0_MAP) +#define V_MC_BANK0_MAP(x) _SB_MAKEVALUE(x,S_MC_BANK0_MAP) +#define G_MC_BANK0_MAP(x) _SB_GETVALUE(x,S_MC_BANK0_MAP,M_MC_BANK0_MAP) + +#define K_MC_BANK0_MAP_DEFAULT 0x00 +#define V_MC_BANK0_MAP_DEFAULT V_MC_BANK0_MAP(K_MC_BANK0_MAP_DEFAULT) + +#define S_MC_BANK1_MAP 20 +#define M_MC_BANK1_MAP _SB_MAKEMASK(4,S_MC_BANK1_MAP) +#define V_MC_BANK1_MAP(x) _SB_MAKEVALUE(x,S_MC_BANK1_MAP) +#define G_MC_BANK1_MAP(x) _SB_GETVALUE(x,S_MC_BANK1_MAP,M_MC_BANK1_MAP) + +#define K_MC_BANK1_MAP_DEFAULT 0x08 +#define V_MC_BANK1_MAP_DEFAULT V_MC_BANK1_MAP(K_MC_BANK1_MAP_DEFAULT) + +#define S_MC_BANK2_MAP 24 +#define M_MC_BANK2_MAP _SB_MAKEMASK(4,S_MC_BANK2_MAP) +#define V_MC_BANK2_MAP(x) _SB_MAKEVALUE(x,S_MC_BANK2_MAP) +#define G_MC_BANK2_MAP(x) _SB_GETVALUE(x,S_MC_BANK2_MAP,M_MC_BANK2_MAP) + +#define K_MC_BANK2_MAP_DEFAULT 0x09 +#define V_MC_BANK2_MAP_DEFAULT V_MC_BANK2_MAP(K_MC_BANK2_MAP_DEFAULT) + +#define S_MC_BANK3_MAP 28 +#define M_MC_BANK3_MAP _SB_MAKEMASK(4,S_MC_BANK3_MAP) +#define V_MC_BANK3_MAP(x) _SB_MAKEVALUE(x,S_MC_BANK3_MAP) +#define G_MC_BANK3_MAP(x) _SB_GETVALUE(x,S_MC_BANK3_MAP,M_MC_BANK3_MAP) + +#define K_MC_BANK3_MAP_DEFAULT 0x0C +#define V_MC_BANK3_MAP_DEFAULT V_MC_BANK3_MAP(K_MC_BANK3_MAP_DEFAULT) + +#define M_MC_RESERVED1 _SB_MAKEMASK(8,32) + +#define S_MC_QUEUE_SIZE 40 +#define M_MC_QUEUE_SIZE _SB_MAKEMASK(4,S_MC_QUEUE_SIZE) +#define V_MC_QUEUE_SIZE(x) _SB_MAKEVALUE(x,S_MC_QUEUE_SIZE) +#define G_MC_QUEUE_SIZE(x) _SB_GETVALUE(x,S_MC_QUEUE_SIZE,M_MC_QUEUE_SIZE) +#define V_MC_QUEUE_SIZE_DEFAULT V_MC_QUEUE_SIZE(0x0A) + +#define S_MC_AGE_LIMIT 44 +#define M_MC_AGE_LIMIT _SB_MAKEMASK(4,S_MC_AGE_LIMIT) +#define V_MC_AGE_LIMIT(x) _SB_MAKEVALUE(x,S_MC_AGE_LIMIT) +#define G_MC_AGE_LIMIT(x) _SB_GETVALUE(x,S_MC_AGE_LIMIT,M_MC_AGE_LIMIT) +#define V_MC_AGE_LIMIT_DEFAULT V_MC_AGE_LIMIT(8) + +#define S_MC_WR_LIMIT 48 +#define M_MC_WR_LIMIT _SB_MAKEMASK(4,S_MC_WR_LIMIT) +#define V_MC_WR_LIMIT(x) _SB_MAKEVALUE(x,S_MC_WR_LIMIT) +#define G_MC_WR_LIMIT(x) _SB_GETVALUE(x,S_MC_WR_LIMIT,M_MC_WR_LIMIT) +#define V_MC_WR_LIMIT_DEFAULT V_MC_WR_LIMIT(5) + +#define M_MC_IOB1HIGHPRIORITY _SB_MAKEMASK1(52) + +#define M_MC_RESERVED2 _SB_MAKEMASK(3,53) + +#define S_MC_CS_MODE 56 +#define M_MC_CS_MODE _SB_MAKEMASK(4,S_MC_CS_MODE) +#define V_MC_CS_MODE(x) _SB_MAKEVALUE(x,S_MC_CS_MODE) +#define G_MC_CS_MODE(x) _SB_GETVALUE(x,S_MC_CS_MODE,M_MC_CS_MODE) + +#define K_MC_CS_MODE_MSB_CS 0 +#define K_MC_CS_MODE_INTLV_CS 15 +#define K_MC_CS_MODE_MIXED_CS_10 12 +#define K_MC_CS_MODE_MIXED_CS_30 6 +#define K_MC_CS_MODE_MIXED_CS_32 3 + +#define V_MC_CS_MODE_MSB_CS V_MC_CS_MODE(K_MC_CS_MODE_MSB_CS) +#define V_MC_CS_MODE_INTLV_CS V_MC_CS_MODE(K_MC_CS_MODE_INTLV_CS) +#define V_MC_CS_MODE_MIXED_CS_10 V_MC_CS_MODE(K_MC_CS_MODE_MIXED_CS_10) +#define V_MC_CS_MODE_MIXED_CS_30 V_MC_CS_MODE(K_MC_CS_MODE_MIXED_CS_30) +#define V_MC_CS_MODE_MIXED_CS_32 V_MC_CS_MODE(K_MC_CS_MODE_MIXED_CS_32) + +#define M_MC_ECC_DISABLE _SB_MAKEMASK1(60) +#define M_MC_BERR_DISABLE _SB_MAKEMASK1(61) +#define M_MC_FORCE_SEQ _SB_MAKEMASK1(62) +#define M_MC_DEBUG _SB_MAKEMASK1(63) + +#define V_MC_CONFIG_DEFAULT V_MC_WR_LIMIT_DEFAULT | V_MC_AGE_LIMIT_DEFAULT | \ + V_MC_BANK0_MAP_DEFAULT | V_MC_BANK1_MAP_DEFAULT | \ + V_MC_BANK2_MAP_DEFAULT | V_MC_BANK3_MAP_DEFAULT | V_MC_CHANNEL_SEL(0) | \ + M_MC_IOB1HIGHPRIORITY | V_MC_QUEUE_SIZE_DEFAULT + + +/* + * Memory clock config register (Table 6-15) + * + * Note: this field has been updated to be consistent with the errata to 0.2 + */ + +#define S_MC_CLK_RATIO 0 +#define M_MC_CLK_RATIO _SB_MAKEMASK(4,S_MC_CLK_RATIO) +#define V_MC_CLK_RATIO(x) _SB_MAKEVALUE(x,S_MC_CLK_RATIO) +#define G_MC_CLK_RATIO(x) _SB_GETVALUE(x,S_MC_CLK_RATIO,M_MC_CLK_RATIO) + +#define K_MC_CLK_RATIO_2X 4 +#define K_MC_CLK_RATIO_25X 5 +#define K_MC_CLK_RATIO_3X 6 +#define K_MC_CLK_RATIO_35X 7 +#define K_MC_CLK_RATIO_4X 8 +#define K_MC_CLK_RATIO_45X 9 + +#define V_MC_CLK_RATIO_2X V_MC_CLK_RATIO(K_MC_CLK_RATIO_2X) +#define V_MC_CLK_RATIO_25X V_MC_CLK_RATIO(K_MC_CLK_RATIO_25X) +#define V_MC_CLK_RATIO_3X V_MC_CLK_RATIO(K_MC_CLK_RATIO_3X) +#define V_MC_CLK_RATIO_35X V_MC_CLK_RATIO(K_MC_CLK_RATIO_35X) +#define V_MC_CLK_RATIO_4X V_MC_CLK_RATIO(K_MC_CLK_RATIO_4X) +#define V_MC_CLK_RATIO_45X V_MC_CLK_RATIO(K_MC_CLK_RATIO_45X) +#define V_MC_CLK_RATIO_DEFAULT V_MC_CLK_RATIO_25X + +#define S_MC_REF_RATE 8 +#define M_MC_REF_RATE _SB_MAKEMASK(8,S_MC_REF_RATE) +#define V_MC_REF_RATE(x) _SB_MAKEVALUE(x,S_MC_REF_RATE) +#define G_MC_REF_RATE(x) _SB_GETVALUE(x,S_MC_REF_RATE,M_MC_REF_RATE) + +#define K_MC_REF_RATE_100MHz 0x62 +#define K_MC_REF_RATE_133MHz 0x81 +#define K_MC_REF_RATE_200MHz 0xC4 + +#define V_MC_REF_RATE_100MHz V_MC_REF_RATE(K_MC_REF_RATE_100MHz) +#define V_MC_REF_RATE_133MHz V_MC_REF_RATE(K_MC_REF_RATE_133MHz) +#define V_MC_REF_RATE_200MHz V_MC_REF_RATE(K_MC_REF_RATE_200MHz) +#define V_MC_REF_RATE_DEFAULT V_MC_REF_RATE_100MHz + +#define S_MC_CLOCK_DRIVE 16 +#define M_MC_CLOCK_DRIVE _SB_MAKEMASK(4,S_MC_CLOCK_DRIVE) +#define V_MC_CLOCK_DRIVE(x) _SB_MAKEVALUE(x,S_MC_CLOCK_DRIVE) +#define G_MC_CLOCK_DRIVE(x) _SB_GETVALUE(x,S_MC_CLOCK_DRIVE,M_MC_CLOCK_DRIVE) +#define V_MC_CLOCK_DRIVE_DEFAULT V_MC_CLOCK_DRIVE(0xF) + +#define S_MC_DATA_DRIVE 20 +#define M_MC_DATA_DRIVE _SB_MAKEMASK(4,S_MC_DATA_DRIVE) +#define V_MC_DATA_DRIVE(x) _SB_MAKEVALUE(x,S_MC_DATA_DRIVE) +#define G_MC_DATA_DRIVE(x) _SB_GETVALUE(x,S_MC_DATA_DRIVE,M_MC_DATA_DRIVE) +#define V_MC_DATA_DRIVE_DEFAULT V_MC_DATA_DRIVE(0x0) + +#define S_MC_ADDR_DRIVE 24 +#define M_MC_ADDR_DRIVE _SB_MAKEMASK(4,S_MC_ADDR_DRIVE) +#define V_MC_ADDR_DRIVE(x) _SB_MAKEVALUE(x,S_MC_ADDR_DRIVE) +#define G_MC_ADDR_DRIVE(x) _SB_GETVALUE(x,S_MC_ADDR_DRIVE,M_MC_ADDR_DRIVE) +#define V_MC_ADDR_DRIVE_DEFAULT V_MC_ADDR_DRIVE(0x0) + +#define M_MC_DLL_BYPASS _SB_MAKEMASK1(31) + +#define S_MC_DQI_SKEW 32 +#define M_MC_DQI_SKEW _SB_MAKEMASK(8,S_MC_DQI_SKEW) +#define V_MC_DQI_SKEW(x) _SB_MAKEVALUE(x,S_MC_DQI_SKEW) +#define G_MC_DQI_SKEW(x) _SB_GETVALUE(x,S_MC_DQI_SKEW,M_MC_DQI_SKEW) +#define V_MC_DQI_SKEW_DEFAULT V_MC_DQI_SKEW(0) + +#define S_MC_DQO_SKEW 40 +#define M_MC_DQO_SKEW _SB_MAKEMASK(8,S_MC_DQO_SKEW) +#define V_MC_DQO_SKEW(x) _SB_MAKEVALUE(x,S_MC_DQO_SKEW) +#define G_MC_DQO_SKEW(x) _SB_GETVALUE(x,S_MC_DQO_SKEW,M_MC_DQO_SKEW) +#define V_MC_DQO_SKEW_DEFAULT V_MC_DQO_SKEW(0) + +#define S_MC_ADDR_SKEW 48 +#define M_MC_ADDR_SKEW _SB_MAKEMASK(8,S_MC_ADDR_SKEW) +#define V_MC_ADDR_SKEW(x) _SB_MAKEVALUE(x,S_MC_ADDR_SKEW) +#define G_MC_ADDR_SKEW(x) _SB_GETVALUE(x,S_MC_ADDR_SKEW,M_MC_ADDR_SKEW) +#define V_MC_ADDR_SKEW_DEFAULT V_MC_ADDR_SKEW(0x0F) + +#define S_MC_DLL_DEFAULT 56 +#define M_MC_DLL_DEFAULT _SB_MAKEMASK(8,S_MC_DLL_DEFAULT) +#define V_MC_DLL_DEFAULT(x) _SB_MAKEVALUE(x,S_MC_DLL_DEFAULT) +#define G_MC_DLL_DEFAULT(x) _SB_GETVALUE(x,S_MC_DLL_DEFAULT,M_MC_DLL_DEFAULT) +#define V_MC_DLL_DEFAULT_DEFAULT V_MC_DLL_DEFAULT(0x10) + +#define V_MC_CLKCONFIG_DEFAULT V_MC_DLL_DEFAULT_DEFAULT | \ + V_MC_ADDR_SKEW_DEFAULT | \ + V_MC_DQO_SKEW_DEFAULT | \ + V_MC_DQI_SKEW_DEFAULT | \ + V_MC_ADDR_DRIVE_DEFAULT | \ + V_MC_DATA_DRIVE_DEFAULT | \ + V_MC_CLOCK_DRIVE_DEFAULT | \ + V_MC_REF_RATE_DEFAULT + + + +/* + * DRAM Command Register (Table 6-13) + */ + +#define S_MC_COMMAND 0 +#define M_MC_COMMAND _SB_MAKEMASK(4,S_MC_COMMAND) +#define V_MC_COMMAND(x) _SB_MAKEVALUE(x,S_MC_COMMAND) +#define G_MC_COMMAND(x) _SB_GETVALUE(x,S_MC_COMMAND,M_MC_COMMAND) + +#define K_MC_COMMAND_EMRS 0 +#define K_MC_COMMAND_MRS 1 +#define K_MC_COMMAND_PRE 2 +#define K_MC_COMMAND_AR 3 +#define K_MC_COMMAND_SETRFSH 4 +#define K_MC_COMMAND_CLRRFSH 5 +#define K_MC_COMMAND_SETPWRDN 6 +#define K_MC_COMMAND_CLRPWRDN 7 + +#define V_MC_COMMAND_EMRS V_MC_COMMAND(K_MC_COMMAND_EMRS) +#define V_MC_COMMAND_MRS V_MC_COMMAND(K_MC_COMMAND_MRS) +#define V_MC_COMMAND_PRE V_MC_COMMAND(K_MC_COMMAND_PRE) +#define V_MC_COMMAND_AR V_MC_COMMAND(K_MC_COMMAND_AR) +#define V_MC_COMMAND_SETRFSH V_MC_COMMAND(K_MC_COMMAND_SETRFSH) +#define V_MC_COMMAND_CLRRFSH V_MC_COMMAND(K_MC_COMMAND_CLRRFSH) +#define V_MC_COMMAND_SETPWRDN V_MC_COMMAND(K_MC_COMMAND_SETPWRDN) +#define V_MC_COMMAND_CLRPWRDN V_MC_COMMAND(K_MC_COMMAND_CLRPWRDN) + +#define M_MC_CS0 _SB_MAKEMASK1(4) +#define M_MC_CS1 _SB_MAKEMASK1(5) +#define M_MC_CS2 _SB_MAKEMASK1(6) +#define M_MC_CS3 _SB_MAKEMASK1(7) + +/* + * DRAM Mode Register (Table 6-14) + */ + +#define S_MC_EMODE 0 +#define M_MC_EMODE _SB_MAKEMASK(15,S_MC_EMODE) +#define V_MC_EMODE(x) _SB_MAKEVALUE(x,S_MC_EMODE) +#define G_MC_EMODE(x) _SB_GETVALUE(x,S_MC_EMODE,M_MC_EMODE) +#define V_MC_EMODE_DEFAULT V_MC_EMODE(0) + +#define S_MC_MODE 16 +#define M_MC_MODE _SB_MAKEMASK(15,S_MC_MODE) +#define V_MC_MODE(x) _SB_MAKEVALUE(x,S_MC_MODE) +#define G_MC_MODE(x) _SB_GETVALUE(x,S_MC_MODE,M_MC_MODE) +#define V_MC_MODE_DEFAULT V_MC_MODE(0x22) + +#define S_MC_DRAM_TYPE 32 +#define M_MC_DRAM_TYPE _SB_MAKEMASK(3,S_MC_DRAM_TYPE) +#define V_MC_DRAM_TYPE(x) _SB_MAKEVALUE(x,S_MC_DRAM_TYPE) +#define G_MC_DRAM_TYPE(x) _SB_GETVALUE(x,S_MC_DRAM_TYPE,M_MC_DRAM_TYPE) + +#define K_MC_DRAM_TYPE_JEDEC 0 +#define K_MC_DRAM_TYPE_FCRAM 1 +#define K_MC_DRAM_TYPE_SGRAM 2 + +#define V_MC_DRAM_TYPE_JEDEC V_MC_DRAM_TYPE(K_MC_DRAM_TYPE_JEDEC) +#define V_MC_DRAM_TYPE_FCRAM V_MC_DRAM_TYPE(K_MC_DRAM_TYPE_FCRAM) +#define V_MC_DRAM_TYPE_SGRAM V_MC_DRAM_TYPE(K_MC_DRAM_TYPE_SGRAM) + +#define M_MC_EXTERNALDECODE _SB_MAKEMASK1(35) + + + + +/* + * SDRAM Timing Register (Table 6-15) + */ + +#define M_MC_w2rIDLE_TWOCYCLES _SB_MAKEMASK1(62) +#define M_MC_r2wIDLE_TWOCYCLES _SB_MAKEMASK1(61) +#define M_MC_r2rIDLE_TWOCYCLES _SB_MAKEMASK1(60) + +#define S_MC_tFIFO 56 +#define M_MC_tFIFO _SB_MAKEMASK(4,S_MC_tFIFO) +#define V_MC_tFIFO(x) _SB_MAKEVALUE(x,S_MC_tFIFO) +#define K_MC_tFIFO_DEFAULT 1 +#define V_MC_tFIFO_DEFAULT V_MC_tFIFO(K_MC_tFIFO_DEFAULT) + +#define S_MC_tRFC 52 +#define M_MC_tRFC _SB_MAKEMASK(4,S_MC_tRFC) +#define V_MC_tRFC(x) _SB_MAKEVALUE(x,S_MC_tRFC) +#define K_MC_tRFC_DEFAULT 12 +#define V_MC_tRFC_DEFAULT V_MC_tRFC(K_MC_tRFC_DEFAULT) + +#define S_MC_tCwCr 40 +#define M_MC_tCwCr _SB_MAKEMASK(4,S_MC_tCwCr) +#define V_MC_tCwCr(x) _SB_MAKEVALUE(x,S_MC_tCwCr) +#define K_MC_tCwCr_DEFAULT 4 +#define V_MC_tCwCr_DEFAULT V_MC_tCwCr(K_MC_tCwCr_DEFAULT) + +#define S_MC_tRCr 28 +#define M_MC_tRCr _SB_MAKEMASK(4,S_MC_tRCr) +#define V_MC_tRCr(x) _SB_MAKEVALUE(x,S_MC_tRCr) +#define K_MC_tRCr_DEFAULT 9 +#define V_MC_tRCr_DEFAULT V_MC_tRCr(K_MC_tRCr_DEFAULT) + +#define S_MC_tRCw 24 +#define M_MC_tRCw _SB_MAKEMASK(4,S_MC_tRCw) +#define V_MC_tRCw(x) _SB_MAKEVALUE(x,S_MC_tRCw) +#define K_MC_tRCw_DEFAULT 10 +#define V_MC_tRCw_DEFAULT V_MC_tRCw(K_MC_tRCw_DEFAULT) + +#define S_MC_tRRD 20 +#define M_MC_tRRD _SB_MAKEMASK(4,S_MC_tRRD) +#define V_MC_tRRD(x) _SB_MAKEVALUE(x,S_MC_tRRD) +#define K_MC_tRRD_DEFAULT 2 +#define V_MC_tRRD_DEFAULT V_MC_tRRD(K_MC_tRRD_DEFAULT) + +#define S_MC_tRP 16 +#define M_MC_tRP _SB_MAKEMASK(4,S_MC_tRP) +#define V_MC_tRP(x) _SB_MAKEVALUE(x,S_MC_tRP) +#define K_MC_tRP_DEFAULT 4 +#define V_MC_tRP_DEFAULT V_MC_tRP(K_MC_tRP_DEFAULT) + +#define S_MC_tCwD 8 +#define M_MC_tCwD _SB_MAKEMASK(4,S_MC_tCwD) +#define V_MC_tCwD(x) _SB_MAKEVALUE(x,S_MC_tCwD) +#define K_MC_tCwD_DEFAULT 1 +#define V_MC_tCwD_DEFAULT V_MC_tCwD(K_MC_tCwD_DEFAULT) + +#define M_tCrDh _SB_MAKEMASK1(7) + +#define S_MC_tCrD 4 +#define M_MC_tCrD _SB_MAKEMASK(3,S_MC_tCrD) +#define V_MC_tCrD(x) _SB_MAKEVALUE(x,S_MC_tCrD) +#define K_MC_tCrD_DEFAULT 2 +#define V_MC_tCrD_DEFAULT V_MC_tCrD(K_MC_tCrD_DEFAULT) + +#define S_MC_tRCD 0 +#define M_MC_tRCD _SB_MAKEMASK(4,S_MC_tRCD) +#define V_MC_tRCD(x) _SB_MAKEVALUE(x,S_MC_tRCD) +#define K_MC_tRCD_DEFAULT 3 +#define V_MC_tRCD_DEFAULT V_MC_tRCD(K_MC_tRCD_DEFAULT) + +#define V_MC_TIMING_DEFAULT V_MC_tFIFO(K_MC_tFIFO_DEFAULT) | \ + V_MC_tRFC(K_MC_tRFC_DEFAULT) | \ + V_MC_tCwCr(K_MC_tCwCr_DEFAULT) | \ + V_MC_tRCr(K_MC_tRCr_DEFAULT) | \ + V_MC_tRCw(K_MC_tRCw_DEFAULT) | \ + V_MC_tRRD(K_MC_tRRD_DEFAULT) | \ + V_MC_tRP(K_MC_tRP_DEFAULT) | \ + V_MC_tCwD(K_MC_tCwD_DEFAULT) | \ + V_MC_tCrD(K_MC_tCrD_DEFAULT) | \ + V_MC_tRCD(K_MC_tRCD_DEFAULT) | \ + M_MC_r2rIDLE_TWOCYCLES + +/* + * Errata says these are not the default + * M_MC_w2rIDLE_TWOCYCLES | \ + * M_MC_r2wIDLE_TWOCYCLES | \ + */ + + +/* + * Chip Select Start Address Register (Table 6-17) + */ + +#define S_MC_CS0_START 0 +#define M_MC_CS0_START _SB_MAKEMASK(16,S_MC_CS0_START) +#define V_MC_CS0_START(x) _SB_MAKEVALUE(x,S_MC_CS0_START) +#define G_MC_CS0_START(x) _SB_GETVALUE(x,S_MC_CS0_START,M_MC_CS0_START) + +#define S_MC_CS1_START 16 +#define M_MC_CS1_START _SB_MAKEMASK(16,S_MC_CS1_START) +#define V_MC_CS1_START(x) _SB_MAKEVALUE(x,S_MC_CS1_START) +#define G_MC_CS1_START(x) _SB_GETVALUE(x,S_MC_CS1_START,M_MC_CS1_START) + +#define S_MC_CS2_START 32 +#define M_MC_CS2_START _SB_MAKEMASK(16,S_MC_CS2_START) +#define V_MC_CS2_START(x) _SB_MAKEVALUE(x,S_MC_CS2_START) +#define G_MC_CS2_START(x) _SB_GETVALUE(x,S_MC_CS2_START,M_MC_CS2_START) + +#define S_MC_CS3_START 48 +#define M_MC_CS3_START _SB_MAKEMASK(16,S_MC_CS3_START) +#define V_MC_CS3_START(x) _SB_MAKEVALUE(x,S_MC_CS3_START) +#define G_MC_CS3_START(x) _SB_GETVALUE(x,S_MC_CS3_START,M_MC_CS3_START) + +/* + * Chip Select End Address Register (Table 6-18) + */ + +#define S_MC_CS0_END 0 +#define M_MC_CS0_END _SB_MAKEMASK(16,S_MC_CS0_END) +#define V_MC_CS0_END(x) _SB_MAKEVALUE(x,S_MC_CS0_END) +#define G_MC_CS0_END(x) _SB_GETVALUE(x,S_MC_CS0_END,M_MC_CS0_END) + +#define S_MC_CS1_END 16 +#define M_MC_CS1_END _SB_MAKEMASK(16,S_MC_CS1_END) +#define V_MC_CS1_END(x) _SB_MAKEVALUE(x,S_MC_CS1_END) +#define G_MC_CS1_END(x) _SB_GETVALUE(x,S_MC_CS1_END,M_MC_CS1_END) + +#define S_MC_CS2_END 32 +#define M_MC_CS2_END _SB_MAKEMASK(16,S_MC_CS2_END) +#define V_MC_CS2_END(x) _SB_MAKEVALUE(x,S_MC_CS2_END) +#define G_MC_CS2_END(x) _SB_GETVALUE(x,S_MC_CS2_END,M_MC_CS2_END) + +#define S_MC_CS3_END 48 +#define M_MC_CS3_END _SB_MAKEMASK(16,S_MC_CS3_END) +#define V_MC_CS3_END(x) _SB_MAKEVALUE(x,S_MC_CS3_END) +#define G_MC_CS3_END(x) _SB_GETVALUE(x,S_MC_CS3_END,M_MC_CS3_END) + +/* + * Chip Select Interleave Register (Table 6-19) + */ + +#define S_MC_INTLV_RESERVED 0 +#define M_MC_INTLV_RESERVED _SB_MAKEMASK(5,S_MC_INTLV_RESERVED) + +#define S_MC_INTERLEAVE 7 +#define M_MC_INTERLEAVE _SB_MAKEMASK(18,S_MC_INTERLEAVE) +#define V_MC_INTERLEAVE(x) _SB_MAKEVALUE(x,S_MC_INTERLEAVE) + +#define S_MC_INTLV_MBZ 25 +#define M_MC_INTLV_MBZ _SB_MAKEMASK(39,S_MC_INTLV_MBZ) + +/* + * Row Address Bits Register (Table 6-20) + */ + +#define S_MC_RAS_RESERVED 0 +#define M_MC_RAS_RESERVED _SB_MAKEMASK(5,S_MC_RAS_RESERVED) + +#define S_MC_RAS_SELECT 12 +#define M_MC_RAS_SELECT _SB_MAKEMASK(25,S_MC_RAS_SELECT) +#define V_MC_RAS_SELECT(x) _SB_MAKEVALUE(x,S_MC_RAS_SELECT) + +#define S_MC_RAS_MBZ 37 +#define M_MC_RAS_MBZ _SB_MAKEMASK(27,S_MC_RAS_MBZ) + + +/* + * Column Address Bits Register (Table 6-21) + */ + +#define S_MC_CAS_RESERVED 0 +#define M_MC_CAS_RESERVED _SB_MAKEMASK(5,S_MC_CAS_RESERVED) + +#define S_MC_CAS_SELECT 5 +#define M_MC_CAS_SELECT _SB_MAKEMASK(18,S_MC_CAS_SELECT) +#define V_MC_CAS_SELECT(x) _SB_MAKEVALUE(x,S_MC_CAS_SELECT) + +#define S_MC_CAS_MBZ 23 +#define M_MC_CAS_MBZ _SB_MAKEMASK(41,S_MC_CAS_MBZ) + + +/* + * Bank Address Address Bits Register (Table 6-22) + */ + +#define S_MC_BA_RESERVED 0 +#define M_MC_BA_RESERVED _SB_MAKEMASK(5,S_MC_BA_RESERVED) + +#define S_MC_BA_SELECT 5 +#define M_MC_BA_SELECT _SB_MAKEMASK(20,S_MC_BA_SELECT) +#define V_MC_BA_SELECT(x) _SB_MAKEVALUE(x,S_MC_BA_SELECT) + +#define S_MC_BA_MBZ 25 +#define M_MC_BA_MBZ _SB_MAKEMASK(39,S_MC_BA_MBZ) + +/* + * Chip Select Attribute Register (Table 6-23) + */ + +#define K_MC_CS_ATTR_CLOSED 0 +#define K_MC_CS_ATTR_CASCHECK 1 +#define K_MC_CS_ATTR_HINT 2 +#define K_MC_CS_ATTR_OPEN 3 + +#define S_MC_CS0_PAGE 0 +#define M_MC_CS0_PAGE _SB_MAKEMASK(2,S_MC_CS0_PAGE) +#define V_MC_CS0_PAGE(x) _SB_MAKEVALUE(x,S_MC_CS0_PAGE) +#define G_MC_CS0_PAGE(x) _SB_GETVALUE(x,S_MC_CS0_PAGE,M_MC_CS0_PAGE) + +#define S_MC_CS1_PAGE 16 +#define M_MC_CS1_PAGE _SB_MAKEMASK(2,S_MC_CS1_PAGE) +#define V_MC_CS1_PAGE(x) _SB_MAKEVALUE(x,S_MC_CS1_PAGE) +#define G_MC_CS1_PAGE(x) _SB_GETVALUE(x,S_MC_CS1_PAGE,M_MC_CS1_PAGE) + +#define S_MC_CS2_PAGE 32 +#define M_MC_CS2_PAGE _SB_MAKEMASK(2,S_MC_CS2_PAGE) +#define V_MC_CS2_PAGE(x) _SB_MAKEVALUE(x,S_MC_CS2_PAGE) +#define G_MC_CS2_PAGE(x) _SB_GETVALUE(x,S_MC_CS2_PAGE,M_MC_CS2_PAGE) + +#define S_MC_CS3_PAGE 48 +#define M_MC_CS3_PAGE _SB_MAKEMASK(2,S_MC_CS3_PAGE) +#define V_MC_CS3_PAGE(x) _SB_MAKEVALUE(x,S_MC_CS3_PAGE) +#define G_MC_CS3_PAGE(x) _SB_GETVALUE(x,S_MC_CS3_PAGE,M_MC_CS3_PAGE) + +/* + * ECC Test ECC Register (Table 6-25) + */ + +#define S_MC_ECC_INVERT 0 +#define M_MC_ECC_INVERT _SB_MAKEMASK(8,S_MC_ECC_INVERT) + + +/* ********************************************************************* + * DMA constants + ********************************************************************* */ + +/* + * Ethernet and Serial DMA Configuration Register 0 (Table 7-4) + * Registers: DMA_CONFIG0_MAC_x_RX_CH_0 + * Registers: DMA_CONFIG0_MAC_x_TX_CH_0 + * Registers: DMA_CONFIG0_SER_x_RX + * Registers: DMA_CONFIG0_SER_x_TX + */ + + +#define M_DMA_DROP _SB_MAKEMASK1(0) +#define M_DMA_CHAIN_SEL _SB_MAKEMASK1(1) +#define M_DMA_RESERVED1 _SB_MAKEMASK1(2) +#define M_DMA_EOP_INT_EN _SB_MAKEMASK1(3) +#define M_DMA_HWM_INT_EN _SB_MAKEMASK1(4) +#define M_DMA_LWM_INT_EN _SB_MAKEMASK1(5) +#define M_DMA_TBX_EN _SB_MAKEMASK1(6) +#define M_DMA_TDX_EN _SB_MAKEMASK1(7) + +#define S_DMA_INT_PKTCNT _SB_MAKE64(8) +#define M_DMA_INT_PKTCNT _SB_MAKEMASK(8,S_DMA_INT_PKTCNT) +#define V_DMA_INT_PKTCNT(x) _SB_MAKEVALUE(x,S_DMA_INT_PKTCNT) +#define G_DMA_INT_PKTCNT(x) _SB_GETVALUE(x,S_DMA_INT_PKTCNT,M_DMA_INT_PKTCNT) + +#define S_DMA_RINGSZ _SB_MAKE64(16) +#define M_DMA_RINGSZ _SB_MAKEMASK(16,S_DMA_RINGSZ) +#define V_DMA_RINGSZ(x) _SB_MAKEVALUE(x,S_DMA_RINGSZ) +#define G_DMA_RINGSZ(x) _SB_GETVALUE(x,S_DMA_RINGSZ,M_DMA_RINGSZ) + +#define S_DMA_HIGH_WATERMARK _SB_MAKE64(32) +#define M_DMA_HIGH_WATERMARK _SB_MAKEMASK(16,S_DMA_HIGH_WATERMARK) +#define V_DMA_HIGH_WATERMARK(x) _SB_MAKEVALUE(x,S_DMA_HIGH_WATERMARK) +#define G_DMA_HIGH_WATERMARK(x) _SB_GETVALUE(x,S_DMA_HIGH_WATERMARK,M_DMA_HIGH_WATERMARK) + +#define S_DMA_LOW_WATERMARK _SB_MAKE64(48) +#define M_DMA_LOW_WATERMARK _SB_MAKEMASK(16,S_DMA_LOW_WATERMARK) +#define V_DMA_LOW_WATERMARK(x) _SB_MAKEVALUE(x,S_DMA_LOW_WATERMARK) +#define G_DMA_LOW_WATERMARK(x) _SB_GETVALUE(x,S_DMA_LOW_WATERMARK,M_DMA_LOW_WATERMARK) + +/* + * Ethernet and Serial DMA Configuration Register 2 (Table 7-5) + * Registers: DMA_CONFIG1_MAC_x_RX_CH_0 + * Registers: DMA_CONFIG1_DMA_x_TX_CH_0 + * Registers: DMA_CONFIG1_SER_x_RX + * Registers: DMA_CONFIG1_SER_x_TX + */ + +#define M_DMA_HDR_CF_EN _SB_MAKEMASK1(0) +#define M_DMA_ASIC_XFR_EN _SB_MAKEMASK1(1) +#define M_DMA_PRE_ADDR_EN _SB_MAKEMASK1(2) +#define M_DMA_FLOW_CTL_EN _SB_MAKEMASK1(3) +#define M_DMA_NO_DSCR_UPDT _SB_MAKEMASK1(4) +#define M_DMA_L2CA _SB_MAKEMASK1(5) + +#define M_DMA_MBZ1 _SB_MAKEMASK(6,15) + +#define S_DMA_HDR_SIZE _SB_MAKE64(21) +#define M_DMA_HDR_SIZE _SB_MAKEMASK(9,S_DMA_HDR_SIZE) +#define V_DMA_HDR_SIZE(x) _SB_MAKEVALUE(x,S_DMA_HDR_SIZE) +#define G_DMA_HDR_SIZE(x) _SB_GETVALUE(x,S_DMA_HDR_SIZE,M_DMA_HDR_SIZE) + +#define M_DMA_MBZ2 _SB_MAKEMASK(5,32) + +#define S_DMA_ASICXFR_SIZE _SB_MAKE64(37) +#define M_DMA_ASICXFR_SIZE _SB_MAKEMASK(9,S_DMA_ASICXFR_SIZE) +#define V_DMA_ASICXFR_SIZE(x) _SB_MAKEVALUE(x,S_DMA_ASICXFR_SIZE) +#define G_DMA_ASICXFR_SIZE(x) _SB_GETVALUE(x,S_DMA_ASICXFR_SIZE,M_DMA_ASICXFR_SIZE) + +#define S_DMA_INT_TIMEOUT _SB_MAKE64(48) +#define M_DMA_INT_TIMEOUT _SB_MAKEMASK(16,S_DMA_INT_TIMEOUT) +#define V_DMA_INT_TIMEOUT(x) _SB_MAKEVALUE(x,S_DMA_INT_TIMEOUT) +#define G_DMA_INT_TIMEOUT(x) _SB_GETVALUE(x,S_DMA_INT_TIMEOUT,M_DMA_INT_TIMEOUT) + +/* + * Ethernet and Serial DMA Descriptor base address (Table 7-6) + */ + +#define M_DMA_DSCRBASE_MBZ _SB_MAKEMASK(4,0) + + +/* + * ASIC Mode Base Address (Table 7-7) + */ + +#define M_DMA_ASIC_BASE_MBZ _SB_MAKEMASK(20,0) + +/* + * DMA Descriptor Count Registers (Table 7-8) + */ + +/* No bitfields */ + + +/* + * Current Descriptor Address Register (Table 7-11) + */ + +#define S_DMA_CURDSCR_ADDR _SB_MAKE64(0) +#define M_DMA_CURDSCR_ADDR _SB_MAKEMASK(40,S_DMA_CURDSCR_ADDR) +#define S_DMA_CURDSCR_COUNT _SB_MAKE64(48) +#define M_DMA_CURDSCR_COUNT _SB_MAKEMASK(16,S_DMA_CURDSCR_COUNT) + +/* ********************************************************************* + * DMA Descriptors + ********************************************************************* */ + +/* + * Descriptor doubleword "A" (Table 7-12) + */ + +#define S_DMA_DSCRA_OFFSET _SB_MAKE64(0) +#define M_DMA_DSCRA_OFFSET _SB_MAKEMASK(5,S_DMA_DSCRA_OFFSET) + +/* Note: Don't shift the address over, just mask it with the mask below */ +#define S_DMA_DSCRA_A_ADDR _SB_MAKE64(5) +#define M_DMA_DSCRA_A_ADDR _SB_MAKEMASK(35,S_DMA_DSCRA_A_ADDR) + +#define M_DMA_DSCRA_A_ADDR_OFFSET (M_DMA_DSCRA_OFFSET | M_DMA_DSCRA_A_ADDR) + +#define S_DMA_DSCRA_A_SIZE _SB_MAKE64(40) +#define M_DMA_DSCRA_A_SIZE _SB_MAKEMASK(9,S_DMA_DSCRA_A_SIZE) +#define V_DMA_DSCRA_A_SIZE(x) _SB_MAKEVALUE(x,S_DMA_DSCRA_A_SIZE) +#define G_DMA_DSCRA_A_SIZE(x) _SB_GETVALUE(x,S_DMA_DSCRA_A_SIZE,M_DMA_DSCRA_A_SIZE) + +#define M_DMA_DSCRA_INTERRUPT _SB_MAKEMASK1(49) +#define M_DMA_DSCRA_OFFSETB _SB_MAKEMASK1(50) + +#define S_DMA_DSCRA_STATUS _SB_MAKE64(51) +#define M_DMA_DSCRA_STATUS _SB_MAKEMASK(13,S_DMA_DSCRA_STATUS) +#define V_DMA_DSCRA_STATUS(x) _SB_MAKEVALUE(x,S_DMA_DSCRA_STATUS) +#define G_DMA_DSCRA_STATUS(x) _SB_GETVALUE(x,S_DMA_DSCRA_STATUS,M_DMA_DSCRA_STATUS) + +/* + * Descriptor doubleword "B" (Table 7-13) + */ + + +#define S_DMA_DSCRB_OPTIONS _SB_MAKE64(0) +#define M_DMA_DSCRB_OPTIONS _SB_MAKEMASK(4,S_DMA_DSCRB_OPTIONS) +#define V_DMA_DSCRB_OPTIONS(x) _SB_MAKEVALUE(x,S_DMA_DSCRB_OPTIONS) +#define G_DMA_DSCRB_OPTIONS(x) _SB_GETVALUE(x,S_DMA_DSCRB_OPTIONS,M_DMA_DSCRB_OPTIONS) + +#define R_DMA_DSCRB_ADDR _SB_MAKE64(0x10) + +/* Note: Don't shift the address over, just mask it with the mask below */ +#define S_DMA_DSCRB_B_ADDR _SB_MAKE64(5) +#define M_DMA_DSCRB_B_ADDR _SB_MAKEMASK(35,S_DMA_DSCRB_B_ADDR) + +#define S_DMA_DSCRB_B_SIZE _SB_MAKE64(40) +#define M_DMA_DSCRB_B_SIZE _SB_MAKEMASK(9,S_DMA_DSCRB_B_SIZE) +#define V_DMA_DSCRB_B_SIZE(x) _SB_MAKEVALUE(x,S_DMA_DSCRB_B_SIZE) +#define G_DMA_DSCRB_B_SIZE(x) _SB_GETVALUE(x,S_DMA_DSCRB_B_SIZE,M_DMA_DSCRB_B_SIZE) + +#define M_DMA_DSCRB_B_VALID _SB_MAKEMASK1(49) + +#define S_DMA_DSCRB_PKT_SIZE _SB_MAKE64(50) +#define M_DMA_DSCRB_PKT_SIZE _SB_MAKEMASK(14,S_DMA_DSCRB_PKT_SIZE) +#define V_DMA_DSCRB_PKT_SIZE(x) _SB_MAKEVALUE(x,S_DMA_DSCRB_PKT_SIZE) +#define G_DMA_DSCRB_PKT_SIZE(x) _SB_GETVALUE(x,S_DMA_DSCRB_PKT_SIZE,M_DMA_DSCRB_PKT_SIZE) + +/* + * Ethernet Descriptor Status Bits (Table 7-15) + */ + +#define M_DMA_ETHRX_BADIP4CS _SB_MAKEMASK1(51) +#define M_DMA_ETHRX_DSCRERR _SB_MAKEMASK1(52) + +#define S_DMA_ETHRX_RXCH 53 +#define M_DMA_ETHRX_RXCH _SB_MAKEMASK(2,S_DMA_ETHRX_RXCH) +#define V_DMA_ETHRX_RXCH(x) _SB_MAKEVALUE(x,S_DMA_ETHRX_RXCH) +#define G_DMA_ETHRX_RXCH(x) _SB_GETVALUE(x,S_DMA_ETHRX_RXCH,M_DMA_ETHRX_RXCH) + +#define S_DMA_ETHRX_PKTTYPE 55 +#define M_DMA_ETHRX_PKTTYPE _SB_MAKEMASK(3,S_DMA_ETHRX_PKTTYPE) +#define V_DMA_ETHRX_PKTTYPE(x) _SB_MAKEVALUE(x,S_DMA_ETHRX_PKTTYPE) +#define G_DMA_ETHRX_PKTTYPE(x) _SB_GETVALUE(x,S_DMA_ETHRX_PKTTYPE,M_DMA_ETHRX_PKTTYPE) + +#define K_DMA_ETHRX_PKTTYPE_IPV4 0 +#define K_DMA_ETHRX_PKTTYPE_ARPV4 1 +#define K_DMA_ETHRX_PKTTYPE_802 2 +#define K_DMA_ETHRX_PKTTYPE_OTHER 3 +#define K_DMA_ETHRX_PKTTYPE_USER0 4 +#define K_DMA_ETHRX_PKTTYPE_USER1 5 +#define K_DMA_ETHRX_PKTTYPE_USER2 6 +#define K_DMA_ETHRX_PKTTYPE_USER3 7 + +#define M_DMA_ETHRX_MATCH_EXACT _SB_MAKEMASK1(58) +#define M_DMA_ETHRX_MATCH_HASH _SB_MAKEMASK1(59) +#define M_DMA_ETHRX_BCAST _SB_MAKEMASK1(60) +#define M_DMA_ETHRX_MCAST _SB_MAKEMASK1(61) +#define M_DMA_ETHRX_BAD _SB_MAKEMASK1(62) +#define M_DMA_ETHRX_SOP _SB_MAKEMASK1(63) + +/* + * Ethernet Transmit Status Bits (Table 7-16) + */ + +#define M_DMA_ETHTX_SOP _SB_MAKEMASK1(63) + +/* + * Ethernet Transmit Options (Table 7-17) + */ + +#define K_DMA_ETHTX_NOTSOP _SB_MAKE64(0x00) +#define K_DMA_ETHTX_APPENDCRC _SB_MAKE64(0x01) +#define K_DMA_ETHTX_REPLACECRC _SB_MAKE64(0x02) +#define K_DMA_ETHTX_APPENDCRC_APPENDPAD _SB_MAKE64(0x03) +#define K_DMA_ETHTX_APPENDVLAN_REPLACECRC _SB_MAKE64(0x04) +#define K_DMA_ETHTX_REMOVEVLAN_REPLACECRC _SB_MAKE64(0x05) +#define K_DMA_ETHTX_REPLACEVLAN_REPLACECRC _SB_MAKE64(0x6) +#define K_DMA_ETHTX_NOMODS _SB_MAKE64(0x07) +#define K_DMA_ETHTX_RESERVED1 _SB_MAKE64(0x08) +#define K_DMA_ETHTX_REPLACESADDR_APPENDCRC _SB_MAKE64(0x09) +#define K_DMA_ETHTX_REPLACESADDR_REPLACECRC _SB_MAKE64(0x0A) +#define K_DMA_ETHTX_REPLACESADDR_APPENDCRC_APPENDPAD _SB_MAKE64(0x0B) +#define K_DMA_ETHTX_REPLACESADDR_APPENDVLAN_REPLACECRC _SB_MAKE64(0x0C) +#define K_DMA_ETHTX_REPLACESADDR_REMOVEVLAN_REPLACECRC _SB_MAKE64(0x0D) +#define K_DMA_ETHTX_REPLACESADDR_REPLACEVLAN_REPLACECRC _SB_MAKE64(0x0E) +#define K_DMA_ETHTX_RESERVED2 _SB_MAKE64(0x0F) + +/* + * Serial Receive Options (Table 7-18) + */ +#define M_DMA_SERRX_CRC_ERROR _SB_MAKEMASK1(56) +#define M_DMA_SERRX_ABORT _SB_MAKEMASK1(57) +#define M_DMA_SERRX_OCTET_ERROR _SB_MAKEMASK1(58) +#define M_DMA_SERRX_LONGFRAME_ERROR _SB_MAKEMASK1(59) +#define M_DMA_SERRX_SHORTFRAME_ERROR _SB_MAKEMASK1(60) +#define M_DMA_SERRX_OVERRUN_ERROR _SB_MAKEMASK1(61) +#define M_DMA_SERRX_GOOD _SB_MAKEMASK1(62) +#define M_DMA_SERRX_SOP _SB_MAKEMASK1(63) + +/* + * Serial Transmit Status Bits (Table 7-20) + */ + +#define M_DMA_SERTX_FLAG _SB_MAKEMASK1(63) + +/* + * Serial Transmit Options (Table 7-21) + */ + +#define K_DMA_SERTX_RESERVED _SB_MAKEMASK1(0) +#define K_DMA_SERTX_APPENDCRC _SB_MAKEMASK1(1) +#define K_DMA_SERTX_APPENDPAD _SB_MAKEMASK1(2) +#define K_DMA_SERTX_ABORT _SB_MAKEMASK1(3) + + +/* ********************************************************************* + * Data Mover Registers + ********************************************************************* */ + +/* + * Data Mover Descriptor Base Address Register (Table 7-22) + * Register: DM_DSCR_BASE_0 + * Register: DM_DSCR_BASE_1 + * Register: DM_DSCR_BASE_2 + * Register: DM_DSCR_BASE_3 + */ + +#define M_DM_DSCR_BASE_MBZ _SB_MAKEMASK(3,0) + +/* Note: Just mask the base address and then OR it in. */ +#define S_DM_DSCR_BASE_ADDR _SB_MAKE64(3) +#define M_DM_DSCR_BASE_ADDR _SB_MAKEMASK(36,S_DM_DSCR_BASE_ADDR) + +#define S_DM_DSCR_BASE_RINGSZ _SB_MAKE64(40) +#define M_DM_DSCR_BASE_RINGSZ _SB_MAKEMASK(16,S_DM_DSCR_BASE_RINGSZ) +#define V_DM_DSCR_BASE_RINGSZ(x) _SB_MAKEVALUE(x,S_DM_DSCR_BASE_RINGSZ) +#define G_DM_DSCR_BASE_RINGSZ(x) _SB_GETVALUE(x,S_DM_DSCR_BASE_RINGSZ,M_DM_DSCR_BASE_RINGSZ) + +#define S_DM_DSCR_BASE_PRIORITY _SB_MAKE64(56) +#define M_DM_DSCR_BASE_PRIORITY _SB_MAKEMASK(3,S_DM_DSCR_BASE_PRIORITY) +#define V_DM_DSCR_BASE_PRIORITY(x) _SB_MAKEVALUE(x,S_DM_DSCR_BASE_PRIORITY) +#define G_DM_DSCR_BASE_PRIORITY(x) _SB_GETVALUE(x,S_DM_DSCR_BASE_PRIORITY,M_DM_DSCR_BASE_PRIORITY) + +#define K_DM_DSCR_BASE_PRIORITY_1 0 +#define K_DM_DSCR_BASE_PRIORITY_2 1 +#define K_DM_DSCR_BASE_PRIORITY_4 2 +#define K_DM_DSCR_BASE_PRIORITY_8 3 +#define K_DM_DSCR_BASE_PRIORITY_16 4 + +#define M_DM_DSCR_BASE_ACTIVE _SB_MAKEMASK1(59) +#define M_DM_DSCR_BASE_INTERRUPT _SB_MAKEMASK1(60) +#define M_DM_DSCR_BASE_RESET _SB_MAKEMASK1(61) /* write register */ +#define M_DM_DSCR_BASE_ERROR _SB_MAKEMASK1(61) /* read register */ +#define M_DM_DSCR_BASE_ABORT _SB_MAKEMASK1(62) +#define M_DM_DSCR_BASE_ENABL _SB_MAKEMASK1(63) + +/* + * Data Mover Descriptor Count Register (Table 7-25) + */ + +/* no bitfields */ + +/* + * Data Mover Current Descriptor Address (Table 7-24) + * Register: DM_CUR_DSCR_ADDR_0 + * Register: DM_CUR_DSCR_ADDR_1 + * Register: DM_CUR_DSCR_ADDR_2 + * Register: DM_CUR_DSCR_ADDR_3 + */ + +#define S_DM_CUR_DSCR_DSCR_ADDR _SB_MAKE64(0) +#define M_DM_CUR_DSCR_DSCR_ADDR _SB_MAKEMASK(40,S_DM_CUR_DSCR_DSCR_ADDR) + +#define S_DM_CUR_DSCR_DSCR_COUNT _SB_MAKE64(48) +#define M_DM_CUR_DSCR_DSCR_COUNT _SB_MAKEMASK(16,S_DM_CUR_DSCR_DSCR_COUNT) +#define V_DM_CUR_DSCR_DSCR_COUNT(r) _SB_MAKEVALUE(r,S_DM_CUR_DSCR_DSCR_COUNT) +#define G_DM_CUR_DSCR_DSCR_COUNT(r) _SB_GETVALUE(r,S_DM_CUR_DSCR_DSCR_COUNT,\ + M_DM_CUR_DSCR_DSCR_COUNT) + +/* + * Data Mover Descriptor Doubleword "A" (Table 7-26) + */ + +#define S_DM_DSCRA_DST_ADDR _SB_MAKE64(0) +#define M_DM_DSCRA_DST_ADDR _SB_MAKEMASK(40,S_DM_DSCRA_DST_ADDR) + +#define M_DM_DSCRA_UN_DEST _SB_MAKEMASK1(40) +#define M_DM_DSCRA_UN_SRC _SB_MAKEMASK1(41) +#define M_DM_DSCRA_INTERRUPT _SB_MAKEMASK1(42) +#define M_DM_DSCRA_THROTTLE _SB_MAKEMASK1(43) + +#define S_DM_DSCRA_DIR_DEST _SB_MAKE64(44) +#define M_DM_DSCRA_DIR_DEST _SB_MAKEMASK(2,S_DM_DSCRA_DIR_DEST) +#define V_DM_DSCRA_DIR_DEST(x) _SB_MAKEVALUE(x,S_DM_DSCRA_DIR_DEST) +#define G_DM_DSCRA_DIR_DEST(x) _SB_GETVALUE(x,S_DM_DSCRA_DIR_DEST,M_DM_DSCRA_DIR_DEST) + +#define K_DM_DSCRA_DIR_DEST_INCR 0 +#define K_DM_DSCRA_DIR_DEST_DECR 1 +#define K_DM_DSCRA_DIR_DEST_CONST 2 + +#define V_DM_DSCRA_DIR_DEST_INCR _SB_MAKEVALUE(K_DM_DSCRA_DIR_DEST_INCR,S_DM_DSCRA_DIR_DEST) +#define V_DM_DSCRA_DIR_DEST_DECR _SB_MAKEVALUE(K_DM_DSCRA_DIR_DEST_DECR,S_DM_DSCRA_DIR_DEST) +#define V_DM_DSCRA_DIR_DEST_CONST _SB_MAKEVALUE(K_DM_DSCRA_DIR_DEST_CONST,S_DM_DSCRA_DIR_DEST) + +#define S_DM_DSCRA_DIR_SRC _SB_MAKE64(46) +#define M_DM_DSCRA_DIR_SRC _SB_MAKEMASK(2,S_DM_DSCRA_DIR_SRC) +#define V_DM_DSCRA_DIR_SRC(x) _SB_MAKEVALUE(x,S_DM_DSCRA_DIR_SRC) +#define G_DM_DSCRA_DIR_SRC(x) _SB_GETVALUE(x,S_DM_DSCRA_DIR_SRC,M_DM_DSCRA_DIR_SRC) + +#define K_DM_DSCRA_DIR_SRC_INCR 0 +#define K_DM_DSCRA_DIR_SRC_DECR 1 +#define K_DM_DSCRA_DIR_SRC_CONST 2 + +#define V_DM_DSCRA_DIR_SRC_INCR _SB_MAKEVALUE(K_DM_DSCRA_DIR_SRC_INCR,S_DM_DSCRA_DIR_SRC) +#define V_DM_DSCRA_DIR_SRC_DECR _SB_MAKEVALUE(K_DM_DSCRA_DIR_SRC_DECR,S_DM_DSCRA_DIR_SRC) +#define V_DM_DSCRA_DIR_SRC_CONST _SB_MAKEVALUE(K_DM_DSCRA_DIR_SRC_CONST,S_DM_DSCRA_DIR_SRC) + + +#define M_DM_DSCRA_ZERO_MEM _SB_MAKEMASK1(48) +#define M_DM_DSCRA_PREFETCH _SB_MAKEMASK1(49) +#define M_DM_DSCRA_L2C_DEST _SB_MAKEMASK1(50) +#define M_DM_DSCRA_L2C_SRC _SB_MAKEMASK1(51) + +#define M_DM_DSCRA_RESERVED2 _SB_MAKEMASK(12,52) + +/* + * Data Mover Descriptor Doubleword "B" (Table 7-25) + */ + +#define S_DM_DSCRB_SRC_ADDR _SB_MAKE64(0) +#define M_DM_DSCRB_SRC_ADDR _SB_MAKEMASK(40,S_DM_DSCRB_SRC_ADDR) + +#define S_DM_DSCRB_SRC_LENGTH _SB_MAKE64(40) +#define M_DM_DSCRB_SRC_LENGTH _SB_MAKEMASK(20,S_DM_DSCRB_SRC_LENGTH) +#define V_DM_DSCRB_SRC_LENGTH(x) _SB_MAKEVALUE(x,S_DM_DSCRB_SRC_LENGTH) +#define G_DM_DSCRB_SRC_LENGTH(x) _SB_GETVALUE(x,S_DM_DSCRB_SRC_LENGTH,M_DM_DSCRB_SRC_LENGTH) + + +/* ********************************************************************* + * Ethernet MAC Registers + ********************************************************************* */ + +/* + * MAC Configuration Register (Table 9-13) + * Register: MAC_CFG_0 + * Register: MAC_CFG_1 + * Register: MAC_CFG_2 + */ + + +/* Updated to spec 0.2 */ + +#define M_MAC_RESERVED0 _SB_MAKEMASK1(0) +#define M_MAC_TX_HOLD_SOP_EN _SB_MAKEMASK1(1) +#define M_MAC_RETRY_EN _SB_MAKEMASK1(2) +#define M_MAC_RET_DRPREQ_EN _SB_MAKEMASK1(3) +#define M_MAC_RET_UFL_EN _SB_MAKEMASK1(4) +#define M_MAC_BURST_EN _SB_MAKEMASK1(5) + +#define S_MAC_TX_PAUSE _SB_MAKE64(6) +#define M_MAC_TX_PAUSE_CNT _SB_MAKEMASK(3,S_MAC_TX_PAUSE) +#define V_MAC_TX_PAUSE_CNT(x) _SB_MAKEVALUE(x,S_MAC_TX_PAUSE) + +#define K_MAC_TX_PAUSE_CNT_512 0 +#define K_MAC_TX_PAUSE_CNT_1K 1 +#define K_MAC_TX_PAUSE_CNT_2K 2 +#define K_MAC_TX_PAUSE_CNT_4K 3 +#define K_MAC_TX_PAUSE_CNT_8K 4 +#define K_MAC_TX_PAUSE_CNT_16K 5 +#define K_MAC_TX_PAUSE_CNT_32K 6 +#define K_MAC_TX_PAUSE_CNT_64K 7 + +#define V_MAC_TX_PAUSE_CNT_512 V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_512) +#define V_MAC_TX_PAUSE_CNT_1K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_1K) +#define V_MAC_TX_PAUSE_CNT_2K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_2K) +#define V_MAC_TX_PAUSE_CNT_4K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_4K) +#define V_MAC_TX_PAUSE_CNT_8K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_8K) +#define V_MAC_TX_PAUSE_CNT_16K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_16K) +#define V_MAC_TX_PAUSE_CNT_32K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_32K) +#define V_MAC_TX_PAUSE_CNT_64K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_64K) + +#define M_MAC_RESERVED1 _SB_MAKEMASK(8,9) + +#define M_MAC_AP_STAT_EN _SB_MAKEMASK1(17) +#define M_MAC_RESERVED2 _SB_MAKEMASK1(18) +#define M_MAC_DRP_ERRPKT_EN _SB_MAKEMASK1(19) +#define M_MAC_DRP_FCSERRPKT_EN _SB_MAKEMASK1(20) +#define M_MAC_DRP_CODEERRPKT_EN _SB_MAKEMASK1(21) +#define M_MAC_DRP_DRBLERRPKT_EN _SB_MAKEMASK1(22) +#define M_MAC_DRP_RNTPKT_EN _SB_MAKEMASK1(23) +#define M_MAC_DRP_OSZPKT_EN _SB_MAKEMASK1(24) +#define M_MAC_DRP_LENERRPKT_EN _SB_MAKEMASK1(25) + +#define M_MAC_RESERVED3 _SB_MAKEMASK(6,26) + +#define M_MAC_BYPASS_SEL _SB_MAKEMASK1(32) +#define M_MAC_HDX_EN _SB_MAKEMASK1(33) + +#define S_MAC_SPEED_SEL _SB_MAKE64(34) +#define M_MAC_SPEED_SEL _SB_MAKEMASK(2,S_MAC_SPEED_SEL) +#define V_MAC_SPEED_SEL(x) _SB_MAKEVALUE(x,S_MAC_SPEED_SEL) +#define G_MAC_SPEED_SEL(x) _SB_GETVALUE(x,S_MAC_SPEED_SEL,M_MAC_SPEED_SEL) + +#define K_MAC_SPEED_SEL_10MBPS 0 +#define K_MAC_SPEED_SEL_100MBPS 1 +#define K_MAC_SPEED_SEL_1000MBPS 2 +#define K_MAC_SPEED_SEL_RESERVED 3 + +#define V_MAC_SPEED_SEL_10MBPS V_MAC_SPEED_SEL(K_MAC_SPEED_SEL_10MBPS) +#define V_MAC_SPEED_SEL_100MBPS V_MAC_SPEED_SEL(K_MAC_SPEED_SEL_100MBPS) +#define V_MAC_SPEED_SEL_1000MBPS V_MAC_SPEED_SEL(K_MAC_SPEED_SEL_1000MBPS) +#define V_MAC_SPEED_SEL_RESERVED V_MAC_SPEED_SEL(K_MAC_SPEED_SEL_RESERVED) + +#define M_MAC_TX_CLK_EDGE_SEL _SB_MAKEMASK1(36) +#define M_MAC_LOOPBACK_SEL _SB_MAKEMASK1(37) +#define M_MAC_FAST_SYNC _SB_MAKEMASK1(38) +#define M_MAC_SS_EN _SB_MAKEMASK1(39) + +#define S_MAC_BYPASS_CFG _SB_MAKE64(40) +#define M_MAC_BYPASS_CFG _SB_MAKEMASK(2,S_MAC_BYPASS_CFG) +#define V_MAC_BYPASS_CFG(x) _SB_MAKEVALUE(x,S_MAC_BYPASS_CFG) +#define G_MAC_BYPASS_CFG(x) _SB_GETVALUE(x,S_MAC_BYPASS_CFG,M_MAC_BYPASS_CFG) + +#define K_MAC_BYPASS_GMII 0 +#define K_MAC_BYPASS_ENCODED 1 +#define K_MAC_BYPASS_SOP 2 +#define K_MAC_BYPASS_EOP 3 + +#define M_MAC_BYPASS_16 _SB_MAKEMASK1(42) +#define M_MAC_BYPASS_FCS_CHK _SB_MAKEMASK1(43) + +#define M_MAC_RESERVED4 _SB_MAKEMASK(2,44) + +#define S_MAC_BYPASS_IFG _SB_MAKE64(46) +#define M_MAC_BYPASS_IFG _SB_MAKEMASK(8,S_MAC_BYPASS_IFG) +#define V_MAC_BYPASS_IFG(x) _SB_MAKEVALUE(x,S_MAC_BYPASS_IFG) +#define G_MAC_BYPASS_IFG(x) _SB_GETVALUE(x,S_MAC_BYPASS_IFG,M_MAC_BYPASS_IFG) + +#define K_MAC_FC_CMD_DISABLED 0 +#define K_MAC_FC_CMD_ENABLED 1 +#define K_MAC_FC_CMD_ENAB_FALSECARR 2 + +#define V_MAC_FC_CMD_DISABLED V_MAC_FC_CMD(K_MAC_FC_CMD_DISABLED) +#define V_MAC_FC_CMD_ENABLED V_MAC_FC_CMD(K_MAC_FC_CMD_ENABLED) +#define V_MAC_FC_CMD_ENAB_FALSECARR V_MAC_FC_CMD(K_MAC_FC_CMD_ENAB_FALSECARR) + +#define M_MAC_FC_SEL _SB_MAKEMASK1(54) + +#define S_MAC_FC_CMD _SB_MAKE64(55) +#define M_MAC_FC_CMD _SB_MAKEMASK(2,S_MAC_FC_CMD) +#define V_MAC_FC_CMD(x) _SB_MAKEVALUE(x,S_MAC_FC_CMD) +#define G_MAC_FC_CMD(x) _SB_GETVALUE(x,S_MAC_FC_CMD,M_MAC_FC_CMD) + +#define S_MAC_RX_CH_SEL _SB_MAKE64(57) +#define M_MAC_RX_CH_SEL _SB_MAKEMASK(7,S_MAC_RX_CH_SEL) +#define V_MAC_RX_CH_SEL(x) _SB_MAKEVALUE(x,S_MAC_RX_CH_SEL) +#define G_MAC_RX_CH_SEL(x) _SB_GETVALUE(x,S_MAC_RX_CH_SEL,M_MAC_RX_CH_SEL) + + +/* + * MAC Enable Registers + * Register: MAC_ENABLE_0 + * Register: MAC_ENABLE_1 + * Register: MAC_ENABLE_2 + */ + +#define M_MAC_RXDMA_EN0 _SB_MAKEMASK1(0) +#define M_MAC_RXDMA_EN1 _SB_MAKEMASK1(1) +#define M_MAC_TXDMA_EN0 _SB_MAKEMASK1(4) +#define M_MAC_TXDMA_EN1 _SB_MAKEMASK1(5) + +#define M_MAC_PORT_RESET _SB_MAKEMASK1(8) + +#define M_MAC_RX_ENABLE _SB_MAKEMASK1(10) +#define M_MAC_TX_ENABLE _SB_MAKEMASK1(11) +#define M_MAC_BYP_RX_ENABLE _SB_MAKEMASK1(12) +#define M_MAC_BYP_TX_ENABLE _SB_MAKEMASK1(13) + +/* + * MAC DMA Control Register + * Register: MAC_TXD_CTL_0 + * Register: MAC_TXD_CTL_1 + * Register: MAC_TXD_CTL_2 + */ + +#define S_MAC_TXD_WEIGHT0 _SB_MAKE64(0) +#define M_MAC_TXD_WEIGHT0 _SB_MAKEMASK(4,S_MAC_TXD_WEIGHT0) +#define V_MAC_TXD_WEIGHT0(x) _SB_MAKEVALUE(x,S_MAC_TXD_WEIGHT0) +#define G_MAC_TXD_WEIGHT0(x) _SB_GETVALUE(x,S_MAC_TXD_WEIGHT0,M_MAC_TXD_WEIGHT0) + +#define S_MAC_TXD_WEIGHT1 _SB_MAKE64(4) +#define M_MAC_TXD_WEIGHT1 _SB_MAKEMASK(4,S_MAC_TXD_WEIGHT1) +#define V_MAC_TXD_WEIGHT1(x) _SB_MAKEVALUE(x,S_MAC_TXD_WEIGHT1) +#define G_MAC_TXD_WEIGHT1(x) _SB_GETVALUE(x,S_MAC_TXD_WEIGHT1,M_MAC_TXD_WEIGHT1) + +/* + * MAC Fifo Threshhold registers (Table 9-14) + * Register: MAC_THRSH_CFG_0 + * Register: MAC_THRSH_CFG_1 + * Register: MAC_THRSH_CFG_2 + */ + +#define S_MAC_TX_WR_THRSH _SB_MAKE64(0) +#define M_MAC_TX_WR_THRSH _SB_MAKEMASK(6,S_MAC_TX_WR_THRSH) +#define V_MAC_TX_WR_THRSH(x) _SB_MAKEVALUE(x,S_MAC_TX_WR_THRSH) +#define G_MAC_TX_WR_THRSH(x) _SB_GETVALUE(x,S_MAC_TX_WR_THRSH,M_MAC_TX_WR_THRSH) + +#define S_MAC_TX_RD_THRSH _SB_MAKE64(8) +#define M_MAC_TX_RD_THRSH _SB_MAKEMASK(6,S_MAC_TX_RD_THRSH) +#define V_MAC_TX_RD_THRSH(x) _SB_MAKEVALUE(x,S_MAC_TX_RD_THRSH) +#define G_MAC_TX_RD_THRSH(x) _SB_GETVALUE(x,S_MAC_TX_RD_THRSH,M_MAC_TX_RD_THRSH) + +#define S_MAC_TX_RL_THRSH _SB_MAKE64(16) +#define M_MAC_TX_RL_THRSH _SB_MAKEMASK(4,S_MAC_TX_RL_THRSH) +#define V_MAC_TX_RL_THRSH(x) _SB_MAKEVALUE(x,S_MAC_TX_RL_THRSH) +#define G_MAC_TX_RL_THRSH(x) _SB_GETVALUE(x,S_MAC_TX_RL_THRSH,M_MAC_TX_RL_THRSH) + +#define S_MAC_RX_PL_THRSH _SB_MAKE64(24) +#define M_MAC_RX_PL_THRSH _SB_MAKEMASK(6,S_MAC_RX_WR_THRSH) +#define V_MAC_RX_PL_THRSH(x) _SB_MAKEVALUE(x,S_MAC_RX_PL_THRSH) +#define G_MAC_RX_PL_THRSH(x) _SB_GETVALUE(x,S_MAC_RX_PL_THRSH,M_MAC_RX_PL_THRSH) + +#define S_MAC_RX_RD_THRSH _SB_MAKE64(32) +#define M_MAC_RX_RD_THRSH _SB_MAKEMASK(6,S_MAC_RX_RD_THRSH) +#define V_MAC_RX_RD_THRSH(x) _SB_MAKEVALUE(x,S_MAC_RX_RD_THRSH) +#define G_MAC_RX_RD_THRSH(x) _SB_GETVALUE(x,S_MAC_RX_RD_THRSH,M_MAC_RX_RD_THRSH) + +#define S_MAC_RX_RL_THRSH _SB_MAKE64(40) +#define M_MAC_RX_RL_THRSH _SB_MAKEMASK(6,S_MAC_RX_RL_THRSH) +#define V_MAC_RX_RL_THRSH(x) _SB_MAKEVALUE(x,S_MAC_RX_RL_THRSH) +#define G_MAC_RX_RL_THRSH(x) _SB_GETVALUE(x,S_MAC_RX_RL_THRSH,M_MAC_RX_RL_THRSH) + +/* + * MAC Frame Configuration Registers (Table 9-15) + * Register: MAC_FRAME_CFG_0 + * Register: MAC_FRAME_CFG_1 + * Register: MAC_FRAME_CFG_2 + */ + +#define S_MAC_IFG_RX _SB_MAKE64(0) +#define M_MAC_IFG_RX _SB_MAKEMASK(6,S_MAC_IFG_RX) +#define V_MAC_IFG_RX(x) _SB_MAKEVALUE(x,S_MAC_IFG_RX) +#define G_MAC_IFG_RX(x) _SB_GETVALUE(x,S_MAC_IFG_RX,M_MAC_IFG_RX) + +#define S_MAC_IFG_TX _SB_MAKE64(6) +#define M_MAC_IFG_TX _SB_MAKEMASK(6,S_MAC_IFG_TX) +#define V_MAC_IFG_TX(x) _SB_MAKEVALUE(x,S_MAC_IFG_TX) +#define G_MAC_IFG_TX(x) _SB_GETVALUE(x,S_MAC_IFG_TX,M_MAC_IFG_TX) + +#define S_MAC_IFG_THRSH _SB_MAKE64(12) +#define M_MAC_IFG_THRSH _SB_MAKEMASK(6,S_MAC_IFG_THRSH) +#define V_MAC_IFG_THRSH(x) _SB_MAKEVALUE(x,S_MAC_IFG_THRSH) +#define G_MAC_IFG_THRSH(x) _SB_GETVALUE(x,S_MAC_IFG_THRSH,M_MAC_IFG_THRSH) + +#define S_MAC_BACKOFF_SEL _SB_MAKE64(18) +#define M_MAC_BACKOFF_SEL _SB_MAKEMASK(4,S_MAC_BACKOFF_SEL) +#define V_MAC_BACKOFF_SEL(x) _SB_MAKEVALUE(x,S_MAC_BACKOFF_SEL) +#define G_MAC_BACKOFF_SEL(x) _SB_GETVALUE(x,S_MAC_BACKOFF_SEL,M_MAC_BACKOFF_SEL) + +#define S_MAC_LFSR_SEED _SB_MAKE64(22) +#define M_MAC_LFSR_SEED _SB_MAKEMASK(8,S_MAC_LFSR_SEED) +#define V_MAC_LFSR_SEED(x) _SB_MAKEVALUE(x,S_MAC_LFSR_SEED) +#define G_MAC_LFSR_SEED(x) _SB_GETVALUE(x,S_MAC_LFSR_SEED,M_MAC_LFSR_SEED) + +#define S_MAC_SLOT_SIZE _SB_MAKE64(30) +#define M_MAC_SLOT_SIZE _SB_MAKEMASK(10,S_MAC_SLOT_SIZE) +#define V_MAC_SLOT_SIZE(x) _SB_MAKEVALUE(x,S_MAC_SLOT_SIZE) +#define G_MAC_SLOT_SIZE(x) _SB_GETVALUE(x,S_MAC_SLOT_SIZE,M_MAC_SLOT_SIZE) + +#define S_MAC_MIN_FRAMESZ _SB_MAKE64(40) +#define M_MAC_MIN_FRAMESZ _SB_MAKEMASK(8,S_MAC_MIN_FRAMESZ) +#define V_MAC_MIN_FRAMESZ(x) _SB_MAKEVALUE(x,S_MAC_MIN_FRAMESZ) +#define G_MAC_MIN_FRAMESZ(x) _SB_GETVALUE(x,S_MAC_MIN_FRAMESZ,M_MAC_MIN_FRAMESZ) + +#define S_MAC_MAX_FRAMESZ _SB_MAKE64(48) +#define M_MAC_MAX_FRAMESZ _SB_MAKEMASK(16,S_MAC_MAX_FRAMESZ) +#define V_MAC_MAX_FRAMESZ(x) _SB_MAKEVALUE(x,S_MAC_MAX_FRAMESZ) +#define G_MAC_MAX_FRAMESZ(x) _SB_GETVALUE(x,S_MAC_MAX_FRAMESZ,M_MAC_MAX_FRAMESZ) + +/* + * These constants are used to configure the fields within the Frame + * Configuration Register. + */ + +#define K_MAC_IFG_RX_10 _SB_MAKE64(18) +#define K_MAC_IFG_RX_100 _SB_MAKE64(18) +#define K_MAC_IFG_RX_1000 _SB_MAKE64(6) + +#define K_MAC_IFG_TX_10 _SB_MAKE64(20) +#define K_MAC_IFG_TX_100 _SB_MAKE64(20) +#define K_MAC_IFG_TX_1000 _SB_MAKE64(8) + +#define K_MAC_IFG_THRSH_10 _SB_MAKE64(12) +#define K_MAC_IFG_THRSH_100 _SB_MAKE64(12) +#define K_MAC_IFG_THRSH_1000 _SB_MAKE64(4) + +#define K_MAC_SLOT_SIZE_10 _SB_MAKE64(0) +#define K_MAC_SLOT_SIZE_100 _SB_MAKE64(0) +#define K_MAC_SLOT_SIZE_1000 _SB_MAKE64(0) + +#define V_MAC_IFG_RX_10 V_MAC_IFG_RX(K_MAC_IFG_RX_10) +#define V_MAC_IFG_RX_100 V_MAC_IFG_RX(K_MAC_IFG_RX_100) +#define V_MAC_IFG_RX_1000 V_MAC_IFG_RX(K_MAC_IFG_RX_1000) + +#define V_MAC_IFG_TX_10 V_MAC_IFG_TX(K_MAC_IFG_TX_10) +#define V_MAC_IFG_TX_100 V_MAC_IFG_TX(K_MAC_IFG_TX_100) +#define V_MAC_IFG_TX_1000 V_MAC_IFG_TX(K_MAC_IFG_TX_1000) + +#define V_MAC_IFG_THRSH_10 V_MAC_IFG_THRSH(K_MAC_IFG_THRSH_10) +#define V_MAC_IFG_THRSH_100 V_MAC_IFG_THRSH(K_MAC_IFG_THRSH_100) +#define V_MAC_IFG_THRSH_1000 V_MAC_IFG_THRSH(K_MAC_IFG_THRSH_1000) + +#define V_MAC_SLOT_SIZE_10 V_MAC_SLOT_SIZE(K_MAC_SLOT_SIZE_10) +#define V_MAC_SLOT_SIZE_100 V_MAC_SLOT_SIZE(K_MAC_SLOT_SIZE_100) +#define V_MAC_SLOT_SIZE_1000 V_MAC_SLOT_SIZE(K_MAC_SLOT_SIZE_1000) + +#define K_MAC_MIN_FRAMESZ_DEFAULT _SB_MAKE64(64) +#define K_MAC_MAX_FRAMESZ_DEFAULT _SB_MAKE64(1518) + +#define V_MAC_MIN_FRAMESZ_DEFAULT V_MAC_MIN_FRAMESZ(K_MAC_MIN_FRAMESZ_DEFAULT) +#define V_MAC_MAX_FRAMESZ_DEFAULT V_MAC_MAX_FRAMESZ(K_MAC_MAX_FRAMESZ_DEFAULT) + +/* + * MAC VLAN Tag Registers (Table 9-16) + * Register: MAC_VLANTAG_0 + * Register: MAC_VLANTAG_1 + * Register: MAC_VLANTAG_2 + */ + +/* No bit fields: lower 32 bits of register are the tags */ + +/* + * MAC Status Registers (Table 9-17) + * Also used for the MAC Interrupt Mask Register (Table 9-18) + * Register: MAC_STATUS_0 + * Register: MAC_STATUS_1 + * Register: MAC_STATUS_2 + * Register: MAC_INT_MASK_0 + * Register: MAC_INT_MASK_1 + * Register: MAC_INT_MASK_2 + */ + +/* + * Use these constants to shift the appropriate channel + * into the CH0 position so the same tests can be used + * on each channel. + */ + +#define S_MAC_RX_CH0 _SB_MAKE64(0) +#define S_MAC_RX_CH1 _SB_MAKE64(8) +#define S_MAC_TX_CH0 _SB_MAKE64(16) +#define S_MAC_TX_CH1 _SB_MAKE64(24) + +#define S_MAC_TXCHANNELS _SB_MAKE64(16) /* this is 1st TX chan */ +#define S_MAC_CHANWIDTH _SB_MAKE64(8) /* bits between channels */ + +/* + * These are the same as RX channel 0. The idea here + * is that you'll use one of the "S_" things above + * and pass just the six bits to a DMA-channel-specific ISR + */ +#define M_MAC_INT_CHANNEL _SB_MAKEMASK(8,0) +#define M_MAC_INT_EOP_COUNT _SB_MAKEMASK1(0) +#define M_MAC_INT_EOP_TIMER _SB_MAKEMASK1(1) +#define M_MAC_INT_EOP_SEEN _SB_MAKEMASK1(2) +#define M_MAC_INT_HWM _SB_MAKEMASK1(3) +#define M_MAC_INT_LWM _SB_MAKEMASK1(4) +#define M_MAC_INT_DSCR _SB_MAKEMASK1(5) +#define M_MAC_INT_ERR _SB_MAKEMASK1(6) +#define M_MAC_INT_DZERO _SB_MAKEMASK1(7) /* only for TX channels */ + + +#define M_MAC_RX_UNDRFL _SB_MAKEMASK1(40) +#define M_MAC_RX_OVRFL _SB_MAKEMASK1(41) +#define M_MAC_TX_UNDRFL _SB_MAKEMASK1(42) +#define M_MAC_TX_OVRFL _SB_MAKEMASK1(43) +#define M_MAC_LTCOL_ERR _SB_MAKEMASK1(44) +#define M_MAC_EXCOL_ERR _SB_MAKEMASK1(45) +#define M_MAC_CNTR_OVRFL_ERR _SB_MAKEMASK1(46) + +#define S_MAC_COUNTER_ADDR _SB_MAKE64(47) +#define M_MAC_COUNTER_ADDR _SB_MAKEMASK(5,S_MAC_COUNTER_ADDR) +#define V_MAC_COUNTER_ADDR(x) _SB_MAKEVALUE(x,S_MAC_COUNTER_ADDR) +#define G_MAC_COUNTER_ADDR(x) _SB_GETVALUE(x,S_MAC_COUNTER_ADDR,M_MAC_COUNTER_ADDR) + +/* + * MAC Fifo Pointer Registers (Table 9-19) [Debug register] + * Register: MAC_FIFO_PTRS_0 + * Register: MAC_FIFO_PTRS_1 + * Register: MAC_FIFO_PTRS_2 + */ + +#define S_MAC_TX_WRPTR _SB_MAKE64(0) +#define M_MAC_TX_WRPTR _SB_MAKEMASK(6,S_MAC_TX_WRPTR) +#define V_MAC_TX_WRPTR(x) _SB_MAKEVALUE(x,S_MAC_TX_WRPTR) +#define G_MAC_TX_WRPTR(x) _SB_GETVALUE(x,S_MAC_TX_WRPTR,M_MAC_TX_WRPTR) + +#define S_MAC_TX_RDPTR _SB_MAKE64(8) +#define M_MAC_TX_RDPTR _SB_MAKEMASK(6,S_MAC_TX_RDPTR) +#define V_MAC_TX_RDPTR(x) _SB_MAKEVALUE(x,S_MAC_TX_RDPTR) +#define G_MAC_TX_RDPTR(x) _SB_GETVALUE(x,S_MAC_TX_RDPTR,M_MAC_TX_RDPTR) + +#define S_MAC_RX_WRPTR _SB_MAKE64(16) +#define M_MAC_RX_WRPTR _SB_MAKEMASK(6,S_MAC_RX_WRPTR) +#define V_MAC_RX_WRPTR(x) _SB_MAKEVALUE(x,S_MAC_RX_WRPTR) +#define G_MAC_RX_WRPTR(x) _SB_GETVALUE(x,S_MAC_RX_WRPTR,M_MAC_TX_WRPTR) + +#define S_MAC_RX_RDPTR _SB_MAKE64(24) +#define M_MAC_RX_RDPTR _SB_MAKEMASK(6,S_MAC_RX_RDPTR) +#define V_MAC_RX_RDPTR(x) _SB_MAKEVALUE(x,S_MAC_RX_RDPTR) +#define G_MAC_RX_RDPTR(x) _SB_GETVALUE(x,S_MAC_RX_RDPTR,M_MAC_TX_RDPTR) + +/* + * MAC Fifo End Of Packet Count Registers (Table 9-20) [Debug register] + * Register: MAC_EOPCNT_0 + * Register: MAC_EOPCNT_1 + * Register: MAC_EOPCNT_2 + */ + +#define S_MAC_TX_EOP_COUNTER _SB_MAKE64(0) +#define M_MAC_TX_EOP_COUNTER _SB_MAKEMASK(6,S_MAC_TX_EOP_COUNTER) +#define V_MAC_TX_EOP_COUNTER(x) _SB_MAKEVALUE(x,S_MAC_TX_EOP_COUNTER) +#define G_MAC_TX_EOP_COUNTER(x) _SB_GETVALUE(x,S_MAC_TX_EOP_COUNTER,M_MAC_TX_EOP_COUNTER) + +#define S_MAC_RX_EOP_COUNTER _SB_MAKE64(8) +#define M_MAC_RX_EOP_COUNTER _SB_MAKEMASK(6,S_MAC_RX_EOP_COUNTER) +#define V_MAC_RX_EOP_COUNTER(x) _SB_MAKEVALUE(x,S_MAC_RX_EOP_COUNTER) +#define G_MAC_RX_EOP_COUNTER(x) _SB_GETVALUE(x,S_MAC_RX_EOP_COUNTER,M_MAC_RX_EOP_COUNTER) + +/* + * MAC Recieve Address Filter Exact Match Registers (Table 9-21) + * Registers: MAC_ADDR0_0 through MAC_ADDR7_0 + * Registers: MAC_ADDR0_1 through MAC_ADDR7_1 + * Registers: MAC_ADDR0_2 through MAC_ADDR7_2 + */ + +/* No bitfields */ + +/* + * MAC Recieve Address Filter Hash Match Registers (Table 9-22) + * Registers: MAC_HASH0_0 through MAC_HASH7_0 + * Registers: MAC_HASH0_1 through MAC_HASH7_1 + * Registers: MAC_HASH0_2 through MAC_HASH7_2 + */ + +/* No bitfields */ + +/* + * MAC Transmit Source Address Registers (Table 9-23) + * Register: MAC_ETHERNET_ADDR_0 + * Register: MAC_ETHERNET_ADDR_1 + * Register: MAC_ETHERNET_ADDR_2 + */ + +/* No bitfields */ + +/* + * MAC Packet Type Configuration Register + * Register: MAC_TYPE_CFG_0 + * Register: MAC_TYPE_CFG_1 + * Register: MAC_TYPE_CFG_2 + */ + +#define S_TYPECFG_TYPESIZE _SB_MAKE64(16) + +#define S_TYPECFG_TYPE0 _SB_MAKE64(0) +#define M_TYPECFG_TYPE0 _SB_MAKEMASK(16,S_TYPECFG_TYPE0) +#define V_TYPECFG_TYPE0(x) _SB_MAKEVALUE(x,S_TYPECFG_TYPE0) +#define G_TYPECFG_TYPE0(x) _SB_GETVALUE(x,S_TYPECFG_TYPE0,M_TYPECFG_TYPE0) + +#define S_TYPECFG_TYPE1 _SB_MAKE64(0) +#define M_TYPECFG_TYPE1 _SB_MAKEMASK(16,S_TYPECFG_TYPE1) +#define V_TYPECFG_TYPE1(x) _SB_MAKEVALUE(x,S_TYPECFG_TYPE1) +#define G_TYPECFG_TYPE1(x) _SB_GETVALUE(x,S_TYPECFG_TYPE1,M_TYPECFG_TYPE1) + +#define S_TYPECFG_TYPE2 _SB_MAKE64(0) +#define M_TYPECFG_TYPE2 _SB_MAKEMASK(16,S_TYPECFG_TYPE2) +#define V_TYPECFG_TYPE2(x) _SB_MAKEVALUE(x,S_TYPECFG_TYPE2) +#define G_TYPECFG_TYPE2(x) _SB_GETVALUE(x,S_TYPECFG_TYPE2,M_TYPECFG_TYPE2) + +#define S_TYPECFG_TYPE3 _SB_MAKE64(0) +#define M_TYPECFG_TYPE3 _SB_MAKEMASK(16,S_TYPECFG_TYPE3) +#define V_TYPECFG_TYPE3(x) _SB_MAKEVALUE(x,S_TYPECFG_TYPE3) +#define G_TYPECFG_TYPE3(x) _SB_GETVALUE(x,S_TYPECFG_TYPE3,M_TYPECFG_TYPE3) + +/* + * MAC Receive Address Filter Control Registers (Table 9-24) + * Register: MAC_ADFILTER_CFG_0 + * Register: MAC_ADFILTER_CFG_1 + * Register: MAC_ADFILTER_CFG_2 + */ + +#define M_MAC_ALLPKT_EN _SB_MAKEMASK1(0) +#define M_MAC_UCAST_EN _SB_MAKEMASK1(1) +#define M_MAC_UCAST_INV _SB_MAKEMASK1(2) +#define M_MAC_MCAST_EN _SB_MAKEMASK1(3) +#define M_MAC_MCAST_INV _SB_MAKEMASK1(4) +#define M_MAC_BCAST_EN _SB_MAKEMASK1(5) +#define M_MAC_DIRECT_INV _SB_MAKEMASK1(6) + +#define S_MAC_IPHDR_OFFSET _SB_MAKE64(8) +#define M_MAC_IPHDR_OFFSET _SB_MAKEMASK(8,S_MAC_IPHDR_OFFSET) +#define V_MAC_IPHDR_OFFSET(x) _SB_MAKEVALUE(x,S_MAC_IPHDR_OFFSET) +#define G_MAC_IPHDR_OFFSET(x) _SB_GETVALUE(x,S_MAC_IPHDR_OFFSET,M_MAC_IPHDR_OFFSET) + +/* + * MAC Receive Channel Select Registers (Table 9-25) + */ + +/* no bitfields */ + +/* + * MAC MII Management Interface Registers (Table 9-26) + * Register: MAC_MDIO_0 + * Register: MAC_MDIO_1 + * Register: MAC_MDIO_2 + */ + +#define S_MAC_MDC 0 +#define S_MAC_MDIO_DIR 1 +#define S_MAC_MDIO_OUT 2 +#define S_MAC_GENC 3 +#define S_MAC_MDIO_IN 4 + +#define M_MAC_MDC _SB_MAKEMASK1(S_MAC_MDC) +#define M_MAC_MDIO_DIR _SB_MAKEMASK1(S_MAC_MDIO_DIR) +#define M_MAC_MDIO_DIR_INPUT _SB_MAKEMASK1(S_MAC_MDIO_DIR) +#define M_MAC_MDIO_OUT _SB_MAKEMASK1(S_MAC_MDIO_OUT) +#define M_MAC_GENC _SB_MAKEMASK1(S_MAC_GENC) +#define M_MAC_MDIO_IN _SB_MAKEMASK1(S_MAC_MDIO_IN) + + +/* ********************************************************************** + * DUART Registers + ********************************************************************** */ + +/* + * DUART Mode Register #1 (Table 10-3) + * Register: DUART_MODE_REG_1_A + * Register: DUART_MODE_REG_1_B + */ + +#define S_DUART_BITS_PER_CHAR 0 +#define M_DUART_BITS_PER_CHAR _SB_MAKEMASK(2,S_DUART_BITS_PER_CHAR) +#define V_DUART_BITS_PER_CHAR(x) _SB_MAKEVALUE(x,S_DUART_BITS_PER_CHAR) + +#define K_DUART_BITS_PER_CHAR_RSV0 0 +#define K_DUART_BITS_PER_CHAR_RSV1 1 +#define K_DUART_BITS_PER_CHAR_7 2 +#define K_DUART_BITS_PER_CHAR_8 3 + +#define V_DUART_BITS_PER_CHAR_RSV0 V_DUART_BITS_PER_CHAR(K_DUART_BITS_PER_CHAR_RSV0) +#define V_DUART_BITS_PER_CHAR_RSV1 V_DUART_BITS_PER_CHAR(K_DUART_BITS_PER_CHAR_RSV1) +#define V_DUART_BITS_PER_CHAR_7 V_DUART_BITS_PER_CHAR(K_DUART_BITS_PER_CHAR_7) +#define V_DUART_BITS_PER_CHAR_8 V_DUART_BITS_PER_CHAR(K_DUART_BITS_PER_CHAR_8) + + +#define M_DUART_PARITY_TYPE_EVEN 0x00 +#define M_DUART_PARITY_TYPE_ODD _SB_MAKEMASK1(3) + +#define S_DUART_PARITY_MODE 3 +#define M_DUART_PARITY_MODE _SB_MAKEMASK(2,S_DUART_PARITY_MODE) +#define V_DUART_PARITY_MODE(x) _SB_MAKEVALUE(x,S_DUART_PARITY_MODE) + +#define K_DUART_PARITY_MODE_ADD 0 +#define K_DUART_PARITY_MODE_ADD_FIXED 1 +#define K_DUART_PARITY_MODE_NONE 2 + +#define V_DUART_PARITY_MODE_ADD V_DUART_PARITY_MODE(K_DUART_PARITY_MODE_ADD) +#define V_DUART_PARITY_MODE_ADD_FIXED V_DUART_PARITY_MODE(K_DUART_PARITY_MODE_ADD_FIXED) +#define V_DUART_PARITY_MODE_NONE V_DUART_PARITY_MODE(K_DUART_PARITY_MODE_NONE) + +#define M_DUART_ERR_MODE _SB_MAKEMASK1(5) /* must be zero */ + +#define M_DUART_RX_IRQ_SEL_RXRDY 0 +#define M_DUART_RX_IRQ_SEL_RXFULL _SB_MAKEMASK1(6) + +#define M_DUART_RX_RTS_ENA _SB_MAKEMASK1(7) + +/* + * DUART Mode Register #2 (Table 10-4) + * Register: DUART_MODE_REG_2_A + * Register: DUART_MODE_REG_2_B + */ + +#define M_DUART_MODE_RESERVED1 _SB_MAKEMASK(3,0) /* ignored */ + +#define M_DUART_STOP_BIT_LEN_2 _SB_MAKEMASK1(3) +#define M_DUART_STOP_BIT_LEN_1 0 + +#define M_DUART_TX_CTS_ENA _SB_MAKEMASK1(4) + +#define M_DUART_MODE_RESERVED2 _SB_MAKEMASK1(5) /* must be zero */ + +#define S_DUART_CHAN_MODE 6 +#define M_DUART_CHAN_MODE _SB_MAKEMASK(2,S_DUART_CHAN_MODE) +#define V_DUART_CHAN_MODE(x) _SB_MAKEVALUE(x,S_DUART_CHAN_MODE) + +#define K_DUART_CHAN_MODE_NORMAL 0 +#define K_DUART_CHAN_MODE_LCL_LOOP 2 +#define K_DUART_CHAN_MODE_REM_LOOP 3 + +#define V_DUART_CHAN_MODE_NORMAL V_DUART_CHAN_MODE(K_DUART_CHAN_MODE_NORMAL) +#define V_DUART_CHAN_MODE_LCL_LOOP V_DUART_CHAN_MODE(K_DUART_CHAN_MODE_LCL_LOOP) +#define V_DUART_CHAN_MODE_REM_LOOP V_DUART_CHAN_MODE(K_DUART_CHAN_MODE_REM_LOOP) + +/* + * DUART Command Register (Table 10-5) + * Register: DUART_CMD_A + * Register: DUART_CMD_B + */ + +#define M_DUART_RX_EN _SB_MAKEMASK1(0) +#define M_DUART_RX_DIS _SB_MAKEMASK1(1) +#define M_DUART_TX_EN _SB_MAKEMASK1(2) +#define M_DUART_TX_DIS _SB_MAKEMASK1(3) + +#define S_DUART_MISC_CMD 4 +#define M_DUART_MISC_CMD _SB_MAKEMASK(3,S_DUART_MISC_CMD) +#define V_DUART_MISC_CMD(x) _SB_MAKEVALUE(x,S_DUART_MISC_CMD) + +#define K_DUART_MISC_CMD_NOACTION0 0 +#define K_DUART_MISC_CMD_NOACTION1 1 +#define K_DUART_MISC_CMD_RESET_RX 2 +#define K_DUART_MISC_CMD_RESET_TX 3 +#define K_DUART_MISC_CMD_NOACTION4 4 +#define K_DUART_MISC_CMD_RESET_BREAK_INT 5 +#define K_DUART_MISC_CMD_START_BREAK 6 +#define K_DUART_MISC_CMD_STOP_BREAK 7 + +#define V_DUART_MISC_CMD_NOACTION0 V_DUART_MISC_CMD(K_DUART_MISC_CMD_NOACTION0) +#define V_DUART_MISC_CMD_NOACTION1 V_DUART_MISC_CMD(K_DUART_MISC_CMD_NOACTION1) +#define V_DUART_MISC_CMD_RESET_RX V_DUART_MISC_CMD(K_DUART_MISC_CMD_RESET_RX) +#define V_DUART_MISC_CMD_RESET_TX V_DUART_MISC_CMD(K_DUART_MISC_CMD_RESET_TX) +#define V_DUART_MISC_CMD_NOACTION4 V_DUART_MISC_CMD(K_DUART_MISC_CMD_NOACTION4) +#define V_DUART_MISC_CMD_RESET_BREAK_INT V_DUART_MISC_CMD(K_DUART_MISC_CMD_RESET_BREAK_INT) +#define V_DUART_MISC_CMD_START_BREAK V_DUART_MISC_CMD(K_DUART_MISC_CMD_START_BREAK) +#define V_DUART_MISC_CMD_STOP_BREAK V_DUART_MISC_CMD(K_DUART_MISC_CMD_STOP_BREAK) + +#define M_DUART_CMD_RESERVED _SB_MAKEMASK1(7) + +/* + * DUART Status Register (Table 10-6) + * Register: DUART_STATUS_A + * Register: DUART_STATUS_B + * READ-ONLY + */ + +#define M_DUART_RX_RDY _SB_MAKEMASK1(0) +#define M_DUART_RX_FFUL _SB_MAKEMASK1(1) +#define M_DUART_TX_RDY _SB_MAKEMASK1(2) +#define M_DUART_TX_EMT _SB_MAKEMASK1(3) +#define M_DUART_OVRUN_ERR _SB_MAKEMASK1(4) +#define M_DUART_PARITY_ERR _SB_MAKEMASK1(5) +#define M_DUART_FRM_ERR _SB_MAKEMASK1(6) +#define M_DUART_RCVD_BRK _SB_MAKEMASK1(7) + +/* + * DUART Baud Rate Register (Table 10-7) + * Register: DUART_CLK_SEL_A + * Register: DUART_CLK_SEL_B + */ + +#define M_DUART_CLK_COUNTER _SB_MAKEMASK(12,0) +#define V_DUART_BAUD_RATE(x) (100000000/((x)*20)-1) + +/* + * DUART Data Registers (Table 10-8 and 10-9) + * Register: DUART_RX_HOLD_A + * Register: DUART_RX_HOLD_B + * Register: DUART_TX_HOLD_A + * Register: DUART_TX_HOLD_B + */ + +#define M_DUART_RX_DATA _SB_MAKEMASK(8,0) +#define M_DUART_TX_DATA _SB_MAKEMASK(8,0) + +/* + * DUART Input Port Register (Table 10-10) + * Register: DUART_IN_PORT + */ + +#define M_DUART_IN_PIN0_VAL _SB_MAKEMASK1(0) +#define M_DUART_IN_PIN1_VAL _SB_MAKEMASK1(1) +#define M_DUART_IN_PIN2_VAL _SB_MAKEMASK1(2) +#define M_DUART_IN_PIN3_VAL _SB_MAKEMASK1(3) +#define M_DUART_IN_PIN4_VAL _SB_MAKEMASK1(4) +#define M_DUART_IN_PIN5_VAL _SB_MAKEMASK1(5) +#define M_DUART_RIN0_PIN _SB_MAKEMASK1(6) +#define M_DUART_RIN1_PIN _SB_MAKEMASK1(7) + +/* + * DUART Input Port Change Status Register (Tables 10-11, 10-12, and 10-13) + * Register: DUART_INPORT_CHNG + */ + +#define S_DUART_IN_PIN_VAL 0 +#define M_DUART_IN_PIN_VAL _SB_MAKEMASK(4,S_DUART_IN_PIN_VAL) + +#define S_DUART_IN_PIN_CHNG 4 +#define M_DUART_IN_PIN_CHNG _SB_MAKEMASK(4,S_DUART_IN_PIN_CHNG) + +/* + * DUART Output port control register (Table 10-14) + * Register: DUART_OPCR + */ + +#define M_DUART_OPCR_RESERVED0 _SB_MAKEMASK1(0) /* must be zero */ +#define M_DUART_OPC2_SEL _SB_MAKEMASK1(1) +#define M_DUART_OPCR_RESERVED1 _SB_MAKEMASK1(2) /* must be zero */ +#define M_DUART_OPC3_SEL _SB_MAKEMASK1(3) +#define M_DUART_OPCR_RESERVED2 _SB_MAKEMASK(4,4) /* must be zero */ + +/* + * DUART Aux Control Register (Table 10-15) + * Register: DUART_AUX_CTRL + */ + +#define M_DUART_IP0_CHNG_ENA _SB_MAKEMASK1(0) +#define M_DUART_IP1_CHNG_ENA _SB_MAKEMASK1(1) +#define M_DUART_IP2_CHNG_ENA _SB_MAKEMASK1(2) +#define M_DUART_IP3_CHNG_ENA _SB_MAKEMASK1(3) +#define M_DUART_ACR_RESERVED _SB_MAKEMASK(4,4) + +/* + * DUART Interrupt Status Register (Table 10-16) + * Register: DUART_ISR + */ + +#define M_DUART_ISR_TX_A _SB_MAKEMASK1(0) +#define M_DUART_ISR_RX_A _SB_MAKEMASK1(1) +#define M_DUART_ISR_BRK_A _SB_MAKEMASK1(2) +#define M_DUART_ISR_IN_A _SB_MAKEMASK1(3) +#define M_DUART_ISR_TX_B _SB_MAKEMASK1(4) +#define M_DUART_ISR_RX_B _SB_MAKEMASK1(5) +#define M_DUART_ISR_BRK_B _SB_MAKEMASK1(6) +#define M_DUART_ISR_IN_B _SB_MAKEMASK1(7) + +/* + * DUART Channel A Interrupt Status Register (Table 10-17) + * DUART Channel B Interrupt Status Register (Table 10-18) + * Register: DUART_ISR_A + * Register: DUART_ISR_B + */ + +#define M_DUART_ISR_TX _SB_MAKEMASK1(0) +#define M_DUART_ISR_RX _SB_MAKEMASK1(1) +#define M_DUART_ISR_BRK _SB_MAKEMASK1(2) +#define M_DUART_ISR_IN _SB_MAKEMASK1(3) +#define M_DUART_ISR_RESERVED _SB_MAKEMASK(4,4) + +/* + * DUART Interrupt Mask Register (Table 10-19) + * Register: DUART_IMR + */ + +#define M_DUART_IMR_TX_A _SB_MAKEMASK1(0) +#define M_DUART_IMR_RX_A _SB_MAKEMASK1(1) +#define M_DUART_IMR_BRK_A _SB_MAKEMASK1(2) +#define M_DUART_IMR_IN_A _SB_MAKEMASK1(3) +#define M_DUART_IMR_ALL_A _SB_MAKEMASK(4,4) + +#define M_DUART_IMR_TX_B _SB_MAKEMASK1(4) +#define M_DUART_IMR_RX_B _SB_MAKEMASK1(5) +#define M_DUART_IMR_BRK_B _SB_MAKEMASK1(5) +#define M_DUART_IMR_IN_B _SB_MAKEMASK1(7) +#define M_DUART_IMR_ALL_B _SB_MAKEMASK(4,4) + +/* + * DUART Channel A Interrupt Mask Register (Table 10-20) + * DUART Channel B Interrupt Mask Register (Table 10-21) + * Register: DUART_IMR_A + * Register: DUART_IMR_B + */ + +#define M_DUART_IMR_TX _SB_MAKEMASK1(0) +#define M_DUART_IMR_RX _SB_MAKEMASK1(1) +#define M_DUART_IMR_BRK _SB_MAKEMASK1(2) +#define M_DUART_IMR_IN _SB_MAKEMASK1(3) +#define M_DUART_IMR_ALL _SB_MAKEMASK(4,0) +#define M_DUART_IMR_RESERVED _SB_MAKEMASK(4,4) + + +/* + * DUART Output Port Set Register (Table 10-22) + * Register: DUART_SET_OPR + */ + +#define M_DUART_SET_OPR0 _SB_MAKEMASK1(0) +#define M_DUART_SET_OPR1 _SB_MAKEMASK1(1) +#define M_DUART_SET_OPR2 _SB_MAKEMASK1(2) +#define M_DUART_SET_OPR3 _SB_MAKEMASK1(3) +#define M_DUART_OPSR_RESERVED _SB_MAKEMASK(4,4) + +/* + * DUART Output Port Clear Register (Table 10-23) + * Register: DUART_CLEAR_OPR + */ + +#define M_DUART_CLR_OPR0 _SB_MAKEMASK1(0) +#define M_DUART_CLR_OPR1 _SB_MAKEMASK1(1) +#define M_DUART_CLR_OPR2 _SB_MAKEMASK1(2) +#define M_DUART_CLR_OPR3 _SB_MAKEMASK1(3) +#define M_DUART_OPCR_RESERVED _SB_MAKEMASK(4,4) + +/* + * DUART Output Port RTS Register (Table 10-24) + * Register: DUART_OUT_PORT + */ + +#define M_DUART_OUT_PIN_SET0 _SB_MAKEMASK1(0) +#define M_DUART_OUT_PIN_SET1 _SB_MAKEMASK1(1) +#define M_DUART_OUT_PIN_CLR0 _SB_MAKEMASK1(2) +#define M_DUART_OUT_PIN_CLR1 _SB_MAKEMASK1(3) +#define M_DUART_OPRR_RESERVED _SB_MAKEMASK(4,4) + +#define M_DUART_OUT_PIN_SET(chan) \ + (chan == 0 ? M_DUART_OUT_PIN_SET0 : M_DUART_OUT_PIN_SET1) +#define M_DUART_OUT_PIN_CLR(chan) \ + (chan == 0 ? M_DUART_OUT_PIN_CLR0 : M_DUART_OUT_PIN_CLR1) + +/* + * To be added: Synchronous Serial definitions + */ + + +/* ********************************************************************** + * Generic Bus constants + ********************************************************************** */ + +/* + * Generic Bus Region Configuration Registers (Table 11-4) + */ + +#define M_IO_RDY_ACTIVE _SB_MAKEMASK1(0) +#define M_IO_ENA_RDY _SB_MAKEMASK1(1) + +#define S_IO_WIDTH_SEL 2 +#define M_IO_WIDTH_SEL _SB_MAKEMASK(2,S_IO_WIDTH_SEL) +#define K_IO_WIDTH_SEL_1 0 +#define K_IO_WIDTH_SEL_2 1 +#define K_IO_WIDTH_SEL_4 3 +#define V_IO_WIDTH_SEL(x) _SB_MAKEVALUE(x,S_IO_WIDTH_SEL) +#define G_IO_WIDTH_SEL(x) _SB_GETVALUE(x,S_IO_WIDTH_SEL,M_IO_WIDTH_SEL) + +#define M_IO_PARITY_ENA _SB_MAKEMASK1(4) +#define M_IO_PARITY_ODD _SB_MAKEMASK1(6) +#define M_IO_NONMUX _SB_MAKEMASK1(7) + +#define S_IO_TIMEOUT 8 +#define M_IO_TIMEOUT _SB_MAKEMASK(8,S_IO_TIMEOUT) +#define V_IO_TIMEOUT(x) _SB_MAKEVALUE(x,S_IO_TIMEOUT) +#define G_IO_TIMEOUT(x) _SB_GETVALUE(x,S_IO_TIMEOUT,M_IO_TIMEOUT) + +/* + * Generic Bus Region Size register (Table 11-5) + */ + +#define S_IO_MULT_SIZE 0 +#define M_IO_MULT_SIZE _SB_MAKEMASK(12,S_IO_MULT_SIZE) +#define V_IO_MULT_SIZE(x) _SB_MAKEVALUE(x,S_IO_MULT_SIZE) +#define G_IO_MULT_SIZE(x) _SB_GETVALUE(x,S_IO_MULT_SIZE,M_IO_MULT_SIZE) + +#define S_IO_REGSIZE 16 /* # bits to shift size for this reg */ + +/* + * Generic Bus Region Address (Table 11-6) + */ + +#define S_IO_START_ADDR 0 +#define M_IO_START_ADDR _SB_MAKEMASK(14,S_IO_START_ADDR) +#define V_IO_START_ADDR(x) _SB_MAKEVALUE(x,S_IO_START_ADDR) +#define G_IO_START_ADDR(x) _SB_GETVALUE(x,S_IO_START_ADDR,M_IO_START_ADDR) + +#define S_IO_ADDRBASE 16 /* # bits to shift addr for this reg */ + +/* + * Generic Bus Region 0 Timing Registers (Table 11-7) + */ + +#define S_IO_ALE_WIDTH 0 +#define M_IO_ALE_WIDTH _SB_MAKEMASK(3,S_IO_ALE_WIDTH) +#define V_IO_ALE_WIDTH(x) _SB_MAKEVALUE(x,S_IO_ALE_WIDTH) +#define G_IO_ALE_WIDTH(x) _SB_GETVALUE(x,S_IO_ALE_WIDTH,M_IO_ALE_WIDTH) + +#define S_IO_ALE_TO_CS 4 +#define M_IO_ALE_TO_CS _SB_MAKEMASK(2,S_IO_ALE_TO_CS) +#define V_IO_ALE_TO_CS(x) _SB_MAKEVALUE(x,S_IO_ALE_TO_CS) +#define G_IO_ALE_TO_CS(x) _SB_GETVALUE(x,S_IO_ALE_TO_CS,M_IO_ALE_TO_CS) + +#define S_IO_CS_WIDTH 8 +#define M_IO_CS_WIDTH _SB_MAKEMASK(5,S_IO_CS_WIDTH) +#define V_IO_CS_WIDTH(x) _SB_MAKEVALUE(x,S_IO_CS_WIDTH) +#define G_IO_CS_WIDTH(x) _SB_GETVALUE(x,S_IO_CS_WIDTH,M_IO_CS_WIDTH) + +#define S_IO_RDY_SMPLE 13 +#define M_IO_RDY_SMPLE _SB_MAKEMASK(3,S_IO_RDY_SMPLE) +#define V_IO_RDY_SMPLE(x) _SB_MAKEVALUE(x,S_IO_RDY_SMPLE) +#define G_IO_RDY_SMPLE(x) _SB_GETVALUE(x,S_IO_RDY_SMPLE,M_IO_RDY_SMPLE) + + +/* + * Generic Bus Timing 1 Registers (Table 11-8) + */ + +#define S_IO_ALE_TO_WRITE 0 +#define M_IO_ALE_TO_WRITE _SB_MAKEMASK(3,S_IO_ALE_TO_WRITE) +#define V_IO_ALE_TO_WRITE(x) _SB_MAKEVALUE(x,S_IO_ALE_TO_WRITE) +#define G_IO_ALE_TO_WRITE(x) _SB_GETVALUE(x,S_IO_ALE_TO_WRITE,M_IO_ALE_TO_WRITE) + +#define S_IO_WRITE_WIDTH 4 +#define M_IO_WRITE_WIDTH _SB_MAKEMASK(4,S_IO_WRITE_WIDTH) +#define V_IO_WRITE_WIDTH(x) _SB_MAKEVALUE(x,S_IO_WRITE_WIDTH) +#define G_IO_WRITE_WIDTH(x) _SB_GETVALUE(x,S_IO_WRITE_WIDTH,M_IO_WRITE_WIDTH) + +#define S_IO_IDLE_CYCLE 8 +#define M_IO_IDLE_CYCLE _SB_MAKEMASK(4,S_IO_IDLE_CYCLE) +#define V_IO_IDLE_CYCLE(x) _SB_MAKEVALUE(x,S_IO_IDLE_CYCLE) +#define G_IO_IDLE_CYCLE(x) _SB_GETVALUE(x,S_IO_IDLE_CYCLE,M_IO_IDLE_CYCLE) + +#define S_IO_CS_TO_OE 12 +#define M_IO_CS_TO_OE _SB_MAKEMASK(2,S_IO_CS_TO_OE) +#define V_IO_CS_TO_OE(x) _SB_MAKEVALUE(x,S_IO_CS_TO_OE) +#define G_IO_CS_TO_OE(x) _SB_GETVALUE(x,S_IO_CS_TO_OE,M_IO_CS_TO_OE) + +#define S_IO_OE_TO_CS 14 +#define M_IO_OE_TO_CS _SB_MAKEMASK(2,S_IO_OE_TO_CS) +#define V_IO_OE_TO_CS(x) _SB_MAKEVALUE(x,S_IO_OE_TO_CS) +#define G_IO_OE_TO_CS(x) _SB_GETVALUE(x,S_IO_OE_TO_CS,M_IO_OE_TO_CS) + +/* + * Generic Bus Interrupt Status Register (Table 11-9) + */ + +#define M_IO_CS_ERR_INT _SB_MAKEMASK(0,8) +#define M_IO_CS0_ERR_INT _SB_MAKEMASK1(0) +#define M_IO_CS1_ERR_INT _SB_MAKEMASK1(1) +#define M_IO_CS2_ERR_INT _SB_MAKEMASK1(2) +#define M_IO_CS3_ERR_INT _SB_MAKEMASK1(3) +#define M_IO_CS4_ERR_INT _SB_MAKEMASK1(4) +#define M_IO_CS5_ERR_INT _SB_MAKEMASK1(5) +#define M_IO_CS6_ERR_INT _SB_MAKEMASK1(6) +#define M_IO_CS7_ERR_INT _SB_MAKEMASK1(7) + +#define M_IO_RD_PAR_INT _SB_MAKEMASK1(9) +#define M_IO_TIMEOUT_INT _SB_MAKEMASK1(10) +#define M_IO_ILL_ADDR_INT _SB_MAKEMASK1(11) +#define M_IO_MULT_CS_INT _SB_MAKEMASK1(12) + +/* + * PCMCIA configuration register (Table 12-6) + */ + +#define M_PCMCIA_CFG_ATTRMEM _SB_MAKEMASK1(0) +#define M_PCMCIA_CFG_3VEN _SB_MAKEMASK1(1) +#define M_PCMCIA_CFG_5VEN _SB_MAKEMASK1(2) +#define M_PCMCIA_CFG_VPPEN _SB_MAKEMASK1(3) +#define M_PCMCIA_CFG_RESET _SB_MAKEMASK1(4) +#define M_PCMCIA_CFG_APWRONEN _SB_MAKEMASK1(5) +#define M_PCMCIA_CFG_CDMASK _SB_MAKEMASK1(6) +#define M_PCMCIA_CFG_WPMASK _SB_MAKEMASK1(7) +#define M_PCMCIA_CFG_RDYMASK _SB_MAKEMASK1(8) +#define M_PCMCIA_CFG_PWRCTL _SB_MAKEMASK1(9) + +/* + * PCMCIA status register (Table 12-7) + */ + +#define M_PCMCIA_STATUS_CD1 _SB_MAKEMASK1(0) +#define M_PCMCIA_STATUS_CD2 _SB_MAKEMASK1(1) +#define M_PCMCIA_STATUS_VS1 _SB_MAKEMASK1(2) +#define M_PCMCIA_STATUS_VS2 _SB_MAKEMASK1(3) +#define M_PCMCIA_STATUS_WP _SB_MAKEMASK1(4) +#define M_PCMCIA_STATUS_RDY _SB_MAKEMASK1(5) +#define M_PCMCIA_STATUS_3VEN _SB_MAKEMASK1(6) +#define M_PCMCIA_STATUS_5VEN _SB_MAKEMASK1(7) +#define M_PCMCIA_STATUS_CDCHG _SB_MAKEMASK1(8) +#define M_PCMCIA_STATUS_WPCHG _SB_MAKEMASK1(9) +#define M_PCMCIA_STATUS_RDYCHG _SB_MAKEMASK1(10) + +/* + * GPIO Interrupt Type Register (table 13-3) + */ + +#define K_GPIO_INTR_DISABLE 0 +#define K_GPIO_INTR_EDGE 1 +#define K_GPIO_INTR_LEVEL 2 +#define K_GPIO_INTR_SPLIT 3 + +#define S_GPIO_INTR_TYPEX(n) (((n)/2)*2) +#define M_GPIO_INTR_TYPEX(n) _SB_MAKEMASK(2,S_GPIO_INTR_TYPEX(n)) +#define V_GPIO_INTR_TYPEX(n,x) _SB_MAKEVALUE(x,S_GPIO_INTR_TYPEX(n)) +#define G_GPIO_INTR_TYPEX(n,x) _SB_GETVALUE(x,S_GPIO_INTR_TYPEX(n),M_GPIO_INTR_TYPEX(n)) + +#define S_GPIO_INTR_TYPE0 0 +#define M_GPIO_INTR_TYPE0 _SB_MAKEMASK(2,S_GPIO_INTR_TYPE0) +#define V_GPIO_INTR_TYPE0(x) _SB_MAKEVALUE(x,S_GPIO_INTR_TYPE0) +#define G_GPIO_INTR_TYPE0(x) _SB_GETVALUE(x,S_GPIO_INTR_TYPE0,M_GPIO_INTR_TYPE0) + +#define S_GPIO_INTR_TYPE2 2 +#define M_GPIO_INTR_TYPE2 _SB_MAKEMASK(2,S_GPIO_INTR_TYPE2) +#define V_GPIO_INTR_TYPE2(x) _SB_MAKEVALUE(x,S_GPIO_INTR_TYPE2) +#define G_GPIO_INTR_TYPE2(x) _SB_GETVALUE(x,S_GPIO_INTR_TYPE2,M_GPIO_INTR_TYPE2) + +#define S_GPIO_INTR_TYPE4 4 +#define M_GPIO_INTR_TYPE4 _SB_MAKEMASK(2,S_GPIO_INTR_TYPE4) +#define V_GPIO_INTR_TYPE4(x) _SB_MAKEVALUE(x,S_GPIO_INTR_TYPE4) +#define G_GPIO_INTR_TYPE4(x) _SB_GETVALUE(x,S_GPIO_INTR_TYPE4,M_GPIO_INTR_TYPE4) + +#define S_GPIO_INTR_TYPE6 6 +#define M_GPIO_INTR_TYPE6 _SB_MAKEMASK(2,S_GPIO_INTR_TYPE6) +#define V_GPIO_INTR_TYPE6(x) _SB_MAKEVALUE(x,S_GPIO_INTR_TYPE6) +#define G_GPIO_INTR_TYPE6(x) _SB_GETVALUE(x,S_GPIO_INTR_TYPE6,M_GPIO_INTR_TYPE6) + +#define S_GPIO_INTR_TYPE8 8 +#define M_GPIO_INTR_TYPE8 _SB_MAKEMASK(2,S_GPIO_INTR_TYPE8) +#define V_GPIO_INTR_TYPE8(x) _SB_MAKEVALUE(x,S_GPIO_INTR_TYPE8) +#define G_GPIO_INTR_TYPE8(x) _SB_GETVALUE(x,S_GPIO_INTR_TYPE8,M_GPIO_INTR_TYPE8) + +#define S_GPIO_INTR_TYPE10 10 +#define M_GPIO_INTR_TYPE10 _SB_MAKEMASK(2,S_GPIO_INTR_TYPE10) +#define V_GPIO_INTR_TYPE10(x) _SB_MAKEVALUE(x,S_GPIO_INTR_TYPE10) +#define G_GPIO_INTR_TYPE10(x) _SB_GETVALUE(x,S_GPIO_INTR_TYPE10,M_GPIO_INTR_TYPE10) + +#define S_GPIO_INTR_TYPE12 12 +#define M_GPIO_INTR_TYPE12 _SB_MAKEMASK(2,S_GPIO_INTR_TYPE12) +#define V_GPIO_INTR_TYPE12(x) _SB_MAKEVALUE(x,S_GPIO_INTR_TYPE12) +#define G_GPIO_INTR_TYPE12(x) _SB_GETVALUE(x,S_GPIO_INTR_TYPE12,M_GPIO_INTR_TYPE12) + +#define S_GPIO_INTR_TYPE14 14 +#define M_GPIO_INTR_TYPE14 _SB_MAKEMASK(2,S_GPIO_INTR_TYPE14) +#define V_GPIO_INTR_TYPE14(x) _SB_MAKEVALUE(x,S_GPIO_INTR_TYPE14) +#define G_GPIO_INTR_TYPE14(x) _SB_GETVALUE(x,S_GPIO_INTR_TYPE14,M_GPIO_INTR_TYPE14) + + +/* ********************************************************************** + * System Management Bus constants + ********************************************************************** */ + +/* + * SMBus Clock Frequency Register (Table 14-2) + */ + +#define S_SMB_FREQ_DIV 0 +#define M_SMB_FREQ_DIV _SB_MAKEMASK(13,S_SMB_FREQ_DIV) +#define V_SMB_FREQ_DIV(x) _SB_MAKEVALUE(x,S_SMB_FREQ_DIV) + +#define K_SMB_FREQ_400KHZ 0x1F +#define K_SMB_FREQ_100KHZ 0x7D + +#define S_SMB_CMD 0 +#define M_SMB_CMD _SB_MAKEMASK(8,S_SMB_CMD) +#define V_SMB_CMD(x) _SB_MAKEVALUE(x,S_SMB_CMD) + +/* + * SMBus control register (Table 14-4) + */ + +#define M_SMB_ERR_INTR _SB_MAKEMASK1(0) +#define M_SMB_FINISH_INTR _SB_MAKEMASK1(1) +#define M_SMB_DATA_OUT _SB_MAKEMASK1(4) +#define M_SMB_DATA_DIR _SB_MAKEMASK1(5) +#define M_SMB_DATA_DIR_OUTPUT M_SMB_DATA_DIR +#define M_SMB_CLK_OUT _SB_MAKEMASK1(6) +#define M_SMB_DIRECT_ENABLE _SB_MAKEMASK1(7) + +/* + * SMBus status registers (Table 14-5) + */ + +#define M_SMB_BUSY _SB_MAKEMASK1(0) +#define M_SMB_ERROR _SB_MAKEMASK1(1) +#define M_SMB_ERROR_TYPE _SB_MAKEMASK1(2) +#define M_SMB_REF _SB_MAKEMASK1(6) +#define M_SMB_DATA_IN _SB_MAKEMASK1(7) + +/* + * SMBus Start/Command registers (Table 14-9) + */ + +#define S_SMB_ADDR 0 +#define M_SMB_ADDR _SB_MAKEMASK(7,S_SMB_ADDR) +#define V_SMB_ADDR(x) _SB_MAKEVALUE(x,S_SMB_ADDR) +#define G_SMB_ADDR(x) _SB_GETVALUE(x,S_SMB_ADDR,M_SMB_ADDR) + +#define M_SMB_QDATA _SB_MAKEMASK1(7) + +#define S_SMB_TT 8 +#define M_SMB_TT _SB_MAKEMASK(3,S_SMB_TT) +#define V_SMB_TT(x) _SB_MAKEVALUE(x,S_SMB_TT) +#define G_SMB_TT(x) _SB_GETVALUE(x,S_SMB_TT,M_SMB_TT) + +#define K_SMB_TT_WR1BYTE 0 +#define K_SMB_TT_WR2BYTE 1 +#define K_SMB_TT_WR3BYTE 2 +#define K_SMB_TT_CMD_RD1BYTE 3 +#define K_SMB_TT_CMD_RD2BYTE 4 +#define K_SMB_TT_RD1BYTE 5 +#define K_SMB_TT_QUICKCMD 6 +#define K_SMB_TT_EEPROMREAD 7 + +#define V_SMB_TT_WR1BYTE V_SMB_TT(K_SMB_TT_WR1BYTE) +#define V_SMB_TT_WR2BYTE V_SMB_TT(K_SMB_TT_WR2BYTE) +#define V_SMB_TT_WR3BYTE V_SMB_TT(K_SMB_TT_WR3BYTE) +#define V_SMB_TT_CMD_RD1BYTE V_SMB_TT(K_SMB_TT_CMD_RD1BYTE) +#define V_SMB_TT_CMD_RD2BYTE V_SMB_TT(K_SMB_TT_CMD_RD2BYTE) +#define V_SMB_TT_RD1BYTE V_SMB_TT(K_SMB_TT_RD1BYTE) +#define V_SMB_TT_QUICKCMD V_SMB_TT(K_SMB_TT_QUICKCMD) +#define V_SMB_TT_EEPROMREAD V_SMB_TT(K_SMB_TT_EEPROMREAD) + +#define M_SMB_PEC _SB_MAKEMASK1(15) + +/* + * SMBus Data Register (Table 14-6) and SMBus Extra Register (Table 14-7) + */ + +#define S_SMB_LB 0 +#define M_SMB_LB _SB_MAKEMASK(8,S_SMB_LB) +#define V_SMB_LB(x) _SB_MAKEVALUE(x,S_SMB_LB) + +#define S_SMB_MB 8 +#define M_SMB_MB _SB_MAKEMASK(8,S_SMB_MB) +#define V_SMB_MB(x) _SB_MAKEVALUE(x,S_SMB_MB) + + +/* + * SMBus Packet Error Check register (Table 14-8) + */ + +#define S_SPEC_PEC 0 +#define M_SPEC_PEC _SB_MAKEMASK(8,S_SPEC_PEC) +#define V_SPEC_MB(x) _SB_MAKEVALUE(x,S_SPEC_PEC) + +#ifndef _ASMLANGUAGE +#if (_WRS_INT_REGISTER_SIZE == 8) +#define MIPS3_SD(addr, value) \ + (* (volatile unsigned long long *) (addr) = (value)) +#define MIPS3_LD(addr) (*(volatile unsigned long long *) (addr)) + +#else /* _WRS_INT_REGISTER_SIZE == 8 */ + +void mips3_sd( volatile unsigned long long *, unsigned long long ); +unsigned long long mips3_ld( volatile unsigned long long * ); +#define MIPS3_SD(addr, value) \ + mips3_sd((volatile unsigned long long *) (addr), (value)) +#define MIPS3_LD(addr) mips3_ld((volatile unsigned long long *) (addr)) + +#endif /* _WRS_INT_REGISTER_SIZE == 8 */ + +#endif /* _ASMLANGUAGE */ + + +#ifdef __cplusplus +} +#endif +#endif /* __INCbcm1250Libh */ diff --git a/h/drv/multi/cvmeSqsys1.h b/h/drv/multi/cvmeSqsys1.h new file mode 100644 index 0000000..e0afa70 --- /dev/null +++ b/h/drv/multi/cvmeSqsys1.h @@ -0,0 +1,93 @@ +/* cvmeSqsys1.h - Cyclone Squall Sys-1 module header */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,26apr02,dat Adding cplusplus protection, SPR 75017 +01a,02mar93,ccc created. +*/ + +/* +This file contains the configuration parameters for the Cyclone Squall Sys-1 +module. +*/ + + +#ifndef __INCcvmeSqsys1h +#define __INCcvmeSqsys1h + +/* includes */ + +#include "drv/scsi/wd33c93.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define INCLUDE_EI /* include 82596 driver */ + +#undef IO_ADRS_EI +#define IO_ADRS_EI ((char *) 0x000fff00) /* 32A,32D i82596CA Ethernet */ +#undef INT_LVL_EI +#define INT_LVL_EI 0x0 +#undef INT_VEC_EI +#define INT_VEC_EI CVME960_VEC_XINT4 + +#define CVME960_EI_CA ((volatile UINT8 *) 0xc0000040) +#define CVME960_EI_PORT ((volatile UINT8 *) 0xc0000030) +#define CVME960_EI_UNUSED ((volatile UINT8 *) 0xc0000020) +#define EI_SYSBUS 0x6c +#define EI_POOL_ADRS NONE + +#undef DEFAULT_BOOT_LINE +#define DEFAULT_BOOT_LINE \ +"ei(0,0)host:/usr/vw/config/cvme960/vxWorks h=90.0.0.3 e=90.0.0.50 u=target" + +/* + * WD33C93 SCSI registers - start at 0xc0000000, 4 byte offsets. Chip + * is driven with a 16 MHz clock, giving a clock period of 62.5 nsec + */ + +#define CVME960_SBIC_BASE_ADRS ((unsigned char *) 0xc0000000) +#define CVME960_SBIC_REG_OFFSET 0x04 +#define CVME960_SBIC_CLK_PERIOD 62 /* nanosec */ +#define CVME960_SBIC_DEV_TYPE SBIC_WD33C93A + +#ifdef INCLUDE_SCSI_MODULE /* change FALSE to TRUE for SCSI interface */ +#define INCLUDE_SCSI /* include wd33c93 SCSI interface */ +#define INCLUDE_SCSI_BOOT /* include ability to boot from SCSI */ +#define INCLUDE_DOSFS /* file system to be used */ +#define INT_VEC_SCSI CVME960_VEC_XINT3 +#define INCLUDE_SCSI_DMA +#endif /* INCLUDE_SCSI_MODULE */ + +/* + * 0xc0000010 is the Squall module status register on a read, + * and the SCSI bus reset control register on a write. + */ + +#define SQ_STATUS_REG ((volatile unsigned char *) 0xc0000010) +#define SCSI_BUS_RESET_CTRL SQ_STATUS_REG + +/* bit definitions of status register (0xc0000010) - bits are active low */ +#define SCSI_BUS_RESET_BIT 2 +#define SCSI_IRQ_BIT 1 +#define SCC_IRQ_BIT 0 + +/* writes to SCSI_BUS_RESET_CTRL - assert/deassert RST* */ +#define ASSERT_SCSI_BUS_RESET 0x06 +#define DEASSERT_SCSI_BUS_RESET 0x02 +#define CLEAR_SCSI_RESET_IRQ 0x00 + +/* SCSI DMA channel */ +#define SCSI_DMA_CHANNEL 0 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcvmeSqsys1h */ diff --git a/h/drv/multi/cvmeSqsys3.h b/h/drv/multi/cvmeSqsys3.h new file mode 100644 index 0000000..5402237 --- /dev/null +++ b/h/drv/multi/cvmeSqsys3.h @@ -0,0 +1,89 @@ +/* cvmeSqsys3.h - Cyclone Squall Sys-3 module header */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,26apr02,dat Adding cplusplus protection, SPR 75017 +01a,02mar93,ccc created. +*/ + +/* +This file contains the configuration parameters for the Cyclone Squall Sys-3 +module. +*/ + + +#ifndef __INCcvmeSqsys3h +#define __INCcvmeSqsys3h + +/* includes */ + +#include "drv/scsi/ncr710.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define INCLUDE_EI /* include 82596 driver */ + +#undef IO_ADRS_EI +#define IO_ADRS_EI ((char *) 0x000fff00) /* 32A,32D i82596CA Ethernet */ +#undef INT_LVL_EI +#define INT_LVL_EI 0x0 +#undef INT_VEC_EI +#define INT_VEC_EI CVME960_VEC_XINT4 + +#define CVME960_EI_CA ((volatile UINT8 *) 0xc0000040) +#define CVME960_EI_PORT ((volatile UINT8 *) 0xc0000030) +#define CVME960_EI_UNUSED ((volatile UINT8 *) 0xc0000020) +#define EI_SYSBUS 0x6c +#define EI_POOL_ADRS NONE + +#undef DEFAULT_BOOT_LINE +#define DEFAULT_BOOT_LINE \ +"ei(0,0)host:/usr/vw/config/cvme960/vxWorks h=90.0.0.3 e=90.0.0.50 u=target" + +/* NCR53C710 definitions */ + +#define CVME960_SIOP_BASE_ADRS ((volatile UINT8 *) 0xc0000100) +#define CVME960_SIOP_FREQ NCR710_25MHZ /* 25-37.5 MHz chip */ +#define CVME960_SIOP_HW_REGS { 0,0,0,0,1,0,0,1,0,0,0,0,0,0,0} + +#ifdef INCLUDE_SCSI_MODULE /* change FALSE to TRUE for SCSI interface */ +#define INCLUDE_SCSI /* include wd33c93 SCSI interface */ +#define INCLUDE_SCSI_BOOT /* include ability to boot from SCSI */ +#define INCLUDE_DOSFS /* file system to be used */ +#define INT_VEC_SCSI CVME960_VEC_XINT3 +#define INCLUDE_SCSI_DMA +#endif /* INCLUDE_SCSI_MODULE */ + +/* + * 0xc0000010 is the Squall module status register on a read, + * and the SCSI bus reset control register on a write. + */ + +#define SQ_STATUS_REG ((volatile unsigned char *) 0xc0000010) +#define SCSI_BUS_RESET_CTRL SQ_STATUS_REG + +/* bit definitions of status register (0xc0000010) - bits are active low */ +#define SCSI_BUS_RESET_BIT 2 +#define SCSI_IRQ_BIT 1 +#define SCC_IRQ_BIT 0 + +/* writes to SCSI_BUS_RESET_CTRL - assert/deassert RST* */ +#define ASSERT_SCSI_BUS_RESET 0x06 +#define DEASSERT_SCSI_BUS_RESET 0x02 +#define CLEAR_SCSI_RESET_IRQ 0x00 + +/* SCSI DMA channel */ +#define SCSI_DMA_CHANNEL 0 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcvmeSqsys3h */ diff --git a/h/drv/multi/ds1244y.h b/h/drv/multi/ds1244y.h new file mode 100644 index 0000000..ed653f7 --- /dev/null +++ b/h/drv/multi/ds1244y.h @@ -0,0 +1,118 @@ +/* ds1244y.h - Dallas SRAM/Clock chip structures and addresses */ + +/* +modification history +-------------------- +01b,23jul93,caf added support for c++. +01a,07aug92,sas written. +*/ + +/* + * Structures for control of the Dallas Semiconductor DS1244Y Static-Ram-and- + * Real-Time-Clock chip. + * + */ + +#ifndef __INCds1244yh +#define __INCds1244yh + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define THEDAYS { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" } + +#define THEMONTHS \ + { "Jan", "Feb", "Mar", "Apr", "May", "Jun", \ + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" } + +/* + * Here is the magic key to access the clock (rather than the RAM) on the + * chip. These bits must be shifted into the clock until all 64 bits have + * been read in. This unlocks the clock for one additional 64-bit access, + * which may be a read or a write. + */ + +#define CLOCK_KEY \ + {0xc5, 0x3a, 0xa3, 0x5c, 0xc5, 0x3a, 0xa3, 0x5c} + +/* tm structure for dealing with time of day ala UNIX */ +/* all fields are in binary */ +typedef struct { + unsigned char tm_hsec; /* hundredths of seconds (0-99) */ + unsigned char tm_sec; /* seconds (0-59) */ + unsigned char tm_min; /* minutes (0-59) */ + unsigned char tm_hour; /* hours (0-23) */ + unsigned char tm_mday; /* day of month (1-31) */ + unsigned char tm_mon; /* month of year (0-11) */ + unsigned char tm_year; /* year - 1900 */ + unsigned char tm_wday; /* day of week (Sunday=0) */ + unsigned char tm_jmsb; /* MSB of julian date (100's day of year)*/ + unsigned char tm_jlsb; /* LSB of julian date */ +/* unsigned char tm_isdst; nonzero if Daylight Savings Time in effect */ +} TIME_DATA ; + +/* + * These defines are for various conversions to and from the binary + * structure above and the values that actually get loaded into the + * clock. + */ + +#define MIN_YEAR 1990 +#define MAX_YEAR 2089 +#define BIAS_YEAR -1990 + +#define MIN_MONTH 1 +#define MAX_MONTH 12 +#define BIAS_MONTH -1 + +#define MIN_DAY 1 +#define MAX_DAY 7 +#define BIAS_DAY -1 + +#define MIN_MDAY 1 +#define MAX_MDAY 31 +#define BIAS_MDAY 0 + +#define MIN_HOUR 0 +#define MAX_HOUR 23 +#define BIAS_HOUR 0 + +#define MIN_MINUTE 0 +#define MAX_MINUTE 59 +#define BIAS_MINUTE 0 + +#define MIN_SECOND 0 +#define MAX_SECOND 59 +#define BIAS_SECOND 0 + +#define MIN_HSEC 0 +#define MAX_HSEC 99 +#define BIAS_HSEC 0 + +typedef struct { + unsigned char data[8]; +} CLOCK_DATA; + +/* + * the following macros convert from BCD to binary and back. + * Be careful that the arguments are chars, and watch for overflows. + */ + +#define BCD_TO_BIN(bcd) ( ((((bcd)&0xf0)>>4)*10) + ((bcd)&0xf) ) +#define BIN_TO_BCD(bin) ( (((bin)/10)<<4) + ((bin)%10) ) + +#define FRAC_SECS 0 +#define SECS 1 +#define MINS 2 +#define HOURS 3 +#define DAYS 4 +#define DATE 5 +#define MONTH 6 +#define YEAR 7 + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCds1244yh */ diff --git a/h/drv/multi/fc68165.h b/h/drv/multi/fc68165.h new file mode 100644 index 0000000..6545a0a --- /dev/null +++ b/h/drv/multi/fc68165.h @@ -0,0 +1,312 @@ +/* fc68165.h - Force FC68165 (IOC) chip header file */ + +/* +modification history +-------------------- +01b,22sep92,rrr added support for c++ +01a,19jul92,caf initial WRS version. added check for _ASMLANGUAGE macro. + originally from Mike McCrary (Force). +*/ + +/* +This file contains the definitions for the IOC chip and IOC structure. +*/ + +#ifndef __INCfc68165h +#define __INCfc68165h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +typedef struct + { + unsigned long base_address; /* IOC_BASE */ + unsigned long general_control; /* IOC_GEN */ + unsigned long supplementary_control; /* IOC_SUPCTL */ + unsigned long timebase; /* IOC_TBASE */ + unsigned long timer [4]; /* IOC_TIMER */ + unsigned long spare1 [8]; /* IOC_SPARE1 */ + unsigned long cs_range [8]; /* IOC_CSRNG */ + unsigned long cs_config [8]; /* IOC_CSCFG */ + unsigned long int_intrq [8]; /* IOC_INTIRQ */ + unsigned long ext_intrq [8]; /* IOC_EXTIRQ */ + unsigned long dma_memory_address [4]; /* IOC_DMADDR */ + unsigned long dma_attribute [4]; /* IOC_DMATTR */ + unsigned long dma_control [4]; /* IOC_DMACTRL */ + unsigned long spare2 [4]; /* IOC_SPARE2 */ + unsigned char remnant [0x100]; + } FC68165; + +#endif /* _ASMLANGUAGE */ + +/* + * The following are the bit mask definitions, etc. + */ + +/* IOC_BASE */ + +#define IOC_BASE_PGM 0x00000001 + +/* IOC_GEN */ + +#define IOC_GEN_IACK74_MASK 0xf0000000 +#define IOC_GEN_IACK118_MASK 0x0f000000 +#define IOC_GEN_IACKCODE_MASK 0x00f00000 +#define IOC_GEN_BG 0x00080000 +#define IOC_GEN_FIACK 0x00040000 +#define IOC_GEN_EPARITY 0x00020000 +#define IOC_GEN_GBERR 0x00010000 +#define IOC_GEN_IACKBERR_MASK 0x0000C000 +#define IOC_GEN_IACKBERR_DISAB 0x00000000 +#define IOC_GEN_IACKBERR_3us 0x00004000 +#define IOC_GEN_IACKBERR_400ns 0x00008000 +#define IOC_GEN_IACKBERR_0 0x0000C000 +#define IOC_GEN_FLXWAIT_MASK 0x00003000 +#define IOC_GEN_FLXWAIT_0 0x00000000 +#define IOC_GEN_FLXWAIT_40ns 0x00001000 +#define IOC_GEN_FLXWAIT_70ns 0x00002000 +#define IOC_GEN_FLXWAIT_100ns 0x00003000 +#define IOC_GEN_FLXBERR_MASK 0x00000c00 +#define IOC_GEN_FLXBERR_750us 0x00000000 +#define IOC_GEN_FLXBERR_50us 0x00000400 +#define IOC_GEN_FLXBERR_3us 0x00000800 +#define IOC_GEN_FLXBERR_750ns 0x00000C00 +#define IOC_GEN_BERRLOC_MASK 0x00000300 +#define IOC_GEN_BERRLOC_750us 0x00000000 +#define IOC_GEN_BERRLOC_50us 0x00000100 +#define IOC_GEN_BERRLOC_6us 0x00000200 +#define IOC_GEN_BERRLOC_1_5us 0x00000300 +#define IOC_GEN_ENAIACK 0x00000080 +#define IOC_GEN_DEBOUNCEIRQ0 0x00000020 +#define IOC_GEN_TACH_START 0x00000010 +#define IOC_GEN_SUP_ONLY 0x00000008 +#define IOC_GEN_FAIR_ARB 0x00000004 +#define IOC_GEN_BOOT_DECODE 0x00000002 + +/* IOC_SUPCTL */ + +#define IOC_SUPCTL_BRIDGE_MASK 0xff000000 +#define IOC_SUPCTL_BRIDGE_NORMAL 0x00000000 +#define IOC_SUPCTL_WATCHDOG_ENABLE 0x00800000 /* 1 = enabled */ +#define IOC_SUPCTL_FC_MASK 0x007f0000 +#define IOC_SUPCTL_FC_6 0x00400000 +#define IOC_SUPCTL_FC_5 0x00200000 +#define IOC_SUPCTL_FC_4 0x00100000 +#define IOC_SUPCTL_FC_3 0x00080000 +#define IOC_SUPCTL_FC_2 0x00040000 +#define IOC_SUPCTL_FC_1 0x00020000 +#define IOC_SUPCTL_FC_0 0x00010000 +#define IOC_SUPCTL_GBERR_TRAP 0x00008000 /* 1 = error occurred */ +#define IOC_SUPCTL_WATCHDOG_TRAP 0x00004000 /* 1 = watchdog occurred */ +#define IOC_SUPCTL_POWERUP_MASK 0x00002000 /* 0 = powerup occurred */ +#define IOC_SUPCTL_tacho_mask 0x000000ff + +/* IOC_TBASE */ + +#define IOC_TBASE_MASK 0xffffffff /* 1 tic per us */ + +/* IOC_TIMER */ + +#define IOC_TIMER__MASK 0xffffffff + +/* IOC_CSRNG */ + +#define IOC_CSRNG_ADDR_MASK 0xffffffc0 +#define IOC_CSRNG_CMP 0x00000020 +#define IOC_CSRNG_FLXI 0x00000010 /* 0 = local */ +#define IOC_CSRNG_SELCODE_MASK 0x0000000c +#define IOC_CSRNG_SELCODE_DISABLED 0x00000000 +#define IOC_CSRNG_SELCODE_SUPRONLY 0x00000004 +#define IOC_CSRNG_SELCODE_SUPANDUSR 0x00000008 +#define IOC_CSRNG_SELCODE_COPROCESS 0x0000000C +#define IOC_CSRNG_READONLY 0x00000002 +#define IOC_CSRNG_CACHEINHIB 0x00000001 + +/* IOC_CSCFG */ + +#define IOC_CSCFG_LOCAL_CSDEV_MASK 0xc000 +#define IOC_CSCFG_LOCAL_CSDEV_4 0x0000 +#define IOC_CSCFG_LOCAL_CSDEV_3 0x4000 +#define IOC_CSCFG_LOCAL_CSDEV_2 0x8000 +#define IOC_CSCFG_LOCAL_CSDEV_1 0xC000 +#define IOC_CSCFG_LOCAL_RDWR_MASK 0x3000 +#define IOC_CSCFG_LOCAL_RDWR_4 0x0000 +#define IOC_CSCFG_LOCAL_RDWR_3 0x1000 +#define IOC_CSCFG_LOCAL_RDWR_2 0x2000 +#define IOC_CSCFG_LOCAL_RDWR_1 0x3000 +#define IOC_CSCFG_LOCAL_DTACK_MASK 0x0e00 +#define IOC_CSCFG_LOCAL_DTACK_12 0x0000 +#define IOC_CSCFG_LOCAL_DTACK_9 0x0200 +#define IOC_CSCFG_LOCAL_DTACK_6 0x0400 +#define IOC_CSCFG_LOCAL_DTACK_4 0x0600 +#define IOC_CSCFG_LOCAL_DTACK_3 0x0800 +#define IOC_CSCFG_LOCAL_DTACK_2 0x0a00 +#define IOC_CSCFG_LOCAL_DTACK_1 0x0c00 +#define IOC_CSCFG_LOCAL_DTACK_NEVER 0x0e00 +#define IOC_CSCFG_LOCAL_RDWRN_MASK 0x0180 +#define IOC_CSCFG_LOCAL_RDWRN_5 0x0000 +#define IOC_CSCFG_LOCAL_RDWRN_3 0x0080 +#define IOC_CSCFG_LOCAL_RDWRN_2 0x0100 +#define IOC_CSCFG_LOCAL_RDWRN_1 0x0180 +#define IOC_CSCFG_LOCAL_CSDEVN_MASK 0x0060 +#define IOC_CSCFG_LOCAL_CSDEVN_4 0x0000 +#define IOC_CSCFG_LOCAL_CSDEVN_2 0x0020 +#define IOC_CSCFG_LOCAL_CSDEVN_1 0x0040 +#define IOC_CSCFG_LOCAL_CSDEVN_0 0x0060 +#define IOC_CSCFG_LOCAL_CYLHOLD_MASK 0x0018 +#define IOC_CSCFG_LOCAL_CYLHOLD_3 0x0000 +#define IOC_CSCFG_LOCAL_CYLHOLD_2 0x0008 +#define IOC_CSCFG_LOCAL_CYLHOLD_1 0x0010 +#define IOC_CSCFG_LOCAL_CYLHOLD_0 0x0018 +#define IOC_CSCFG_LOCAL_DEVDESEL_MASK 0x0006 +#define IOC_CSCFG_LOCAL_DEVDESEL_12 0x0000 +#define IOC_CSCFG_LOCAL_DEVDESEL_5 0x0002 +#define IOC_CSCFG_LOCAL_DEVDESEL_3 0x0004 +#define IOC_CSCFG_LOCAL_DEVDESEL_1 0x0006 +#define IOC_CSCFG_LOCAL_FASTCONT 0x0001 +#define IOC_CSCFG_FLXI_ASYNCCSDEV 0x8000 +#define IOC_CSCFG_FLXI_ASYNCBYTE 0x4000 +#define IOC_CSCFG_FLXI_ENADSACK 0x2000 +#define IOC_CSCFG_FLXI_SCS 0x1000 +#define IOC_CSCFG_FLXI_SBS 0x0800 +#define IOC_CSCFG_FLXI_BRDA 0x0400 +#define IOC_CSCFG_FLXI_BRDE 0x0200 +#define IOC_CSCFG_FLXI_CSRD 0x0100 +#define IOC_CSCFG_FLXI_WAITS_MASK 0x00f0 +#define IOC_CSCFG_FLXI_WAITS_0 0x0000 /* 35 ns */ +#define IOC_CSCFG_FLXI_WAITS_1 0x0010 /* 70 ns */ +#define IOC_CSCFG_FLXI_WAITS_2 0x0020 /* 100 ns */ +#define IOC_CSCFG_FLXI_WAITS_3 0x0030 /* 135 ns */ +#define IOC_CSCFG_FLXI_WAITS_4 0x0040 /* 170 ns */ +#define IOC_CSCFG_FLXI_WAITS_5 0x0050 /* 200 ns */ +#define IOC_CSCFG_FLXI_WAITS_6 0x0060 /* 235 ns */ +#define IOC_CSCFG_FLXI_WAITS_7 0x0070 /* 270 ns */ +#define IOC_CSCFG_FLXI_WAITS_8 0x0080 /* 300 ns */ +#define IOC_CSCFG_FLXI_WAITS_9 0x0090 /* 335 ns */ +#define IOC_CSCFG_FLXI_WAITS_10 0x00a0 /* 370 ns */ +#define IOC_CSCFG_FLXI_WAITS_11 0x00b0 /* 400 ns */ +#define IOC_CSCFG_FLXI_WAITS_12 0x00c0 /* 435 ns */ +#define IOC_CSCFG_FLXI_WAITS_13 0x00d0 /* 470 ns */ +#define IOC_CSCFG_FLXI_WAITS_14 0x00e0 /* 500 ns */ +#define IOC_CSCFG_FLXI_WAITS_15 0x00f0 /* 535 ns */ +#define IOC_CSCFG_FLXI_STROBE_MASK 0x000c +#define IOC_CSCFG_FLXI_STROBE_NONE 0x0000 +#define IOC_CSCFG_FLXI_STROBE_BYTE 0x0004 +#define IOC_CSCFG_FLXI_STROBE_WORD 0x0008 +#define IOC_CSCFG_FLXI_STROBE_LONG 0x000c +#define IOC_CSCFG_FLXI_DSACK_MASK 0x0003 +#define IOC_CSCFG_FLXI_DSACK_LONG 0x0000 +#define IOC_CSCFG_FLXI_DSACK_WORD 0x0001 +#define IOC_CSCFG_FLXI_DSACK_BYTE 0x0002 +#define IOC_CSCFG_FLXI_DSACK_NONE 0x0003 + +/* IOC_INTIRQ */ + +#define IOC_INTIRQ_IRQENABLE 0x08000000 +#define IOC_INTIRQ_IRQLEVEL_MASK 0x07000000 +#define IOC_INTIRQ_IRQLEVEL_0 0x00000000 +#define IOC_INTIRQ_IRQLEVEL_1 0x01000000 +#define IOC_INTIRQ_IRQLEVEL_2 0x02000000 +#define IOC_INTIRQ_IRQLEVEL_3 0x03000000 +#define IOC_INTIRQ_IRQLEVEL_4 0x04000000 +#define IOC_INTIRQ_IRQLEVEL_5 0x05000000 +#define IOC_INTIRQ_IRQLEVEL_6 0x06000000 +#define IOC_INTIRQ_IRQLEVEL_7 0x07000000 +#define IOC_INTIRQ_IRQSTAT 0x00800000 +#define IOC_INTIRQ_IRQMAIL 0x00400000 +#define IOC_INTIRQ_TDENABLE 0x00000200 +#define IOC_INTIRQ_NOAUTOCLEAR 0x00000100 + +/* IOC_EXTIRQ */ + +#define IOC_EXTIRQ_IRQENABLE 0x08000000 +#define IOC_EXTIRQ_IRQLEVEL_MASK 0x07000000 +#define IOC_EXTIRQ_IRQLEVEL_0 0x00000000 +#define IOC_EXTIRQ_IRQLEVEL_1 0x01000000 +#define IOC_EXTIRQ_IRQLEVEL_2 0x02000000 +#define IOC_EXTIRQ_IRQLEVEL_3 0x03000000 +#define IOC_EXTIRQ_IRQLEVEL_4 0x04000000 +#define IOC_EXTIRQ_IRQLEVEL_5 0x05000000 +#define IOC_EXTIRQ_IRQLEVEL_6 0x06000000 +#define IOC_EXTIRQ_IRQLEVEL_7 0x07000000 +#define IOC_EXTIRQ_IRQSTAT 0x00800000 +#define IOC_EXTIRQ_EXTVECTOR 0x00000800 +#define IOC_EXTIRQ_EDGE 0x00000400 +#define IOC_EXTIRQ_ACTHIGH 0x00000200 +#define IOC_EXTIRQ_AUTOCLEAR 0x00000100 +#define IOC_EXTIRQ_DISABLEIACK 0x00000008 +#define IOC_EXTIRQ_CSTIMING_MASK 0x00000007 +#define IOC_EXTIRQ_CSTIMING_0 0x00000000 +#define IOC_EXTIRQ_CSTIMING_1 0x00000001 +#define IOC_EXTIRQ_CSTIMING_2 0x00000002 +#define IOC_EXTIRQ_CSTIMING_3 0x00000003 +#define IOC_EXTIRQ_CSTIMING_4 0x00000004 +#define IOC_EXTIRQ_CSTIMING_5 0x00000005 +#define IOC_EXTIRQ_CSTIMING_6 0x00000006 +#define IOC_EXTIRQ_CSTIMING_7 0x00000007 + +/* IOC_DMATTR */ + +#define IOC_DMATTR_LCLSIZE_MASK 0xc0000000 +#define IOC_DMATTR_LCLSIZE_LONG 0x00000000 +#define IOC_DMATTR_LCLSIZE_BYTE 0x40000000 +#define IOC_DMATTR_LCLSIZE_WORD 0x80000000 +#define IOC_DMATTR_LCLSIZE_BAD 0xc0000000 +#define IOC_DMATTR_LCLADDR_MASK 0x3f000000 +#define IOC_DMATTR_DSTFLXI 0x00800000 /* otherwise dst is local */ +#define IOC_DMATTR_FC_MASK 0x00700000 +#define IOC_DMATTR_FC_SUP_BT 0x00700000 +#define IOC_DMATTR_FC_SUP_PGM 0x00600000 +#define IOC_DMATTR_FC_SUP_DATA 0x00500000 +#define IOC_DMATTR_FC_USR_BT 0x00300000 +#define IOC_DMATTR_FC_USR_PGM 0x00200000 +#define IOC_DMATTR_FC_USR_DATA 0x00100000 +#define IOC_DMATTR_XFERCNT_MASK 0x000fffff /* 1 - 1 megabyte */ + +/* IOC_DMACTRL */ + +#define IOC_DMACTRL_NT 0x80000000 /* normal termination */ +#define IOC_DMACTRL_ET 0x40000000 /* error termination */ +#define IOC_DMACTRL_ENABLE 0x00010000 /* enables DMA controller */ +#define IOC_DMACTRL_RQ_MASK 0x00000e00 +#define IOC_DMACTRL_RQ_DISABLED 0x00000000 +#define IOC_DMACTRL_IFACTENABLED 0x00000800 /* if DMAREQ only */ +#define IOC_DMACTRL_AUTOENABLED 0x00000a00 /* DMAREQ always active */ +#define IOC_DMACTRL_1SHOTAUTOENABLED 0x00000c00 /* first AUTO, then IFACT */ +#define IOC_DMACTRL_EDGE 0x00000100 /* else LEVEL sensitive */ +#define IOC_DMACTRL_RQIGNORETIME_MASK 0x000000f0 +#define IOC_DMACTRL_RQIGNORETIME_465 0x00000000 /* 465 ns */ +#define IOC_DMACTRL_RQIGNORETIME_434 0x00000010 +#define IOC_DMACTRL_RQIGNORETIME_403 0x00000020 +#define IOC_DMACTRL_RQIGNORETIME_372 0x00000030 +#define IOC_DMACTRL_RQIGNORETIME_341 0x00000040 +#define IOC_DMACTRL_RQIGNORETIME_310 0x00000050 +#define IOC_DMACTRL_RQIGNORETIME_279 0x00000060 +#define IOC_DMACTRL_RQIGNORETIME_248 0x00000070 +#define IOC_DMACTRL_RQIGNORETIME_217 0x00000080 +#define IOC_DMACTRL_RQIGNORETIME_186 0x00000090 +#define IOC_DMACTRL_RQIGNORETIME_155 0x000000a0 +#define IOC_DMACTRL_RQIGNORETIME_124 0x000000b0 +#define IOC_DMACTRL_RQIGNORETIME_93 0x000000c0 +#define IOC_DMACTRL_RQIGNORETIME_62 0x000000d0 +#define IOC_DMACTRL_RQIGNORETIME_31 0x000000e0 +#define IOC_DMACTRL_RQIGNORETIME_0 0x000000f0 /* 0 ns */ +#define IOC_DMACTRL_HRQ 0x00000008 /* high active request */ +#define IOC_DMACTRL_LOCALPORT_MASK 0x00000007 /* CSDEV of DMA */ +#define IOC_DMACTRL_LOCALPROT_0 0x00000000 +#define IOC_DMACTRL_LOCALPROT_1 0x00000001 +#define IOC_DMACTRL_LOCALPROT_2 0x00000002 +#define IOC_DMACTRL_LOCALPROT_3 0x00000003 +#define IOC_DMACTRL_LOCALPROT_4 0x00000004 +#define IOC_DMACTRL_LOCALPROT_5 0x00000005 +#define IOC_DMACTRL_LOCALPROT_6 0x00000006 +#define IOC_DMACTRL_LOCALPROT_7 0x00000007 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfc68165h */ diff --git a/h/drv/multi/fga002.h b/h/drv/multi/fga002.h new file mode 100644 index 0000000..2f700a1 --- /dev/null +++ b/h/drv/multi/fga002.h @@ -0,0 +1,498 @@ +/* fga002.h - Force Computers FGA-002 gate array */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01i,22sep92,rrr added support for c++ +01h,06aug92,ccc added DMA definitions. +01g,13jul92,caf added function declarations. +01f,26may92,rrr the tree shuffle +01e,04oct91,rrr passed through the ansification filter + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01d,24oct90,yao added missing register definitions.allow for ASM & reg offset. +01c,05oct90,shl added copyright notice. + made #endif ANSI style. +01b,06sep89,jcf fixed CTRL15 definitions. +01a,14feb89,jcf written. +*/ + +#ifndef __INCfga002h +#define __INCfga002h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _ASMLANGUAGE +#define CAST +#define CAST_INT +#else +#define CAST (char *) +#define CAST_INT (int *) +#endif /* _ASMLANGUAGE */ + +#define FGA_ADRS(reg) (CAST (FGA_BASE_ADRS + (reg * FGA_REG_INTERVAL))) +#define FGA_ADRS_INT(reg) (CAST_INT (FGA_BASE_ADRS + (reg * FGA_REG_INTERVAL))) + +/* register definitions */ + + /* interrupt control registers */ +#define FGA_ICRMBOX0 FGA_ADRS(0x000) /* mailbox 0 */ +#define FGA_ICRMBOX1 FGA_ADRS(0x004) /* mailbox 1 */ +#define FGA_ICRMBOX2 FGA_ADRS(0x008) /* mailbox 2 */ +#define FGA_ICRMBOX3 FGA_ADRS(0x00C) /* mailbox 3 */ +#define FGA_ICRMBOX4 FGA_ADRS(0x010) /* mailbox 4 */ +#define FGA_ICRMBOX5 FGA_ADRS(0x014) /* mailbox 5 */ +#define FGA_ICRMBOX6 FGA_ADRS(0x018) /* mailbox 6 */ +#define FGA_ICRMBOX7 FGA_ADRS(0x01C) /* mailbox 7 */ + +#define FGA_ICRTIM0 FGA_ADRS(0x220) /* timer */ + +#define FGA_ICRFMB0REF FGA_ADRS(0x240) /* FMB0 refused */ +#define FGA_ICRFMB1REF FGA_ADRS(0x244) /* FMB1 refused */ +#define FGA_ICRFMB0MES FGA_ADRS(0x248) /* FMB0 message */ +#define FGA_ICRFMB1MES FGA_ADRS(0x24C) /* FMB1 message */ + +#define FGA_ICRDMANORM FGA_ADRS(0x230) /* DMA normal */ +#define FGA_ICRDMAERR FGA_ADRS(0x234) /* DMA error */ + +#define FGA_ICRPARITY FGA_ADRS(0x258) /* parity */ + +#define FGA_ICRVME1 FGA_ADRS(0x204) /* VMEIRQ 1 */ +#define FGA_ICRVME2 FGA_ADRS(0x208) /* VMEIRQ 2 */ +#define FGA_ICRVME3 FGA_ADRS(0x20C) /* VMEIRQ 3 */ +#define FGA_ICRVME4 FGA_ADRS(0x210) /* VMEIRQ 4 */ +#define FGA_ICRVME5 FGA_ADRS(0x214) /* VMEIRQ 5 */ +#define FGA_ICRVME6 FGA_ADRS(0x218) /* VMEIRQ 6 */ +#define FGA_ICRVME7 FGA_ADRS(0x21C) /* VMEIRQ 7 */ + + /* extended interrupt control registers */ +#define FGA_ICRABORT FGA_ADRS(0x280) /* abort */ +#define FGA_ICRACFAIL FGA_ADRS(0x284) /* acfail */ +#define FGA_ICRSYSFAIL FGA_ADRS(0x288) /* sysfail */ + +#define FGA_ICRLOCAL0 FGA_ADRS(0x28C) /* local 0 */ +#define FGA_ICRLOCAL1 FGA_ADRS(0x290) /* local 1 */ +#define FGA_ICRLOCAL2 FGA_ADRS(0x294) /* local 2 */ +#define FGA_ICRLOCAL3 FGA_ADRS(0x298) /* local 3 */ +#define FGA_ICRLOCAL4 FGA_ADRS(0x29C) /* local 4 */ +#define FGA_ICRLOCAL5 FGA_ADRS(0x2A0) /* local 5 */ +#define FGA_ICRLOCAL6 FGA_ADRS(0x2A4) /* local 6 */ +#define FGA_ICRLOCAL7 FGA_ADRS(0x2A8) /* local 7 */ + + + /* control registers */ +#define FGA_CTL1 FGA_ADRS(0x238) /* arbitration */ +#define FGA_CTL2 FGA_ADRS(0x23C) /* parity */ +#define FGA_CTL3 FGA_ADRS(0x250) /* bus width,vec */ +#define FGA_CTL4 FGA_ADRS(0x254) /* boot decode,ack */ +#define FGA_CTL5 FGA_ADRS(0x264) /* mbox VME acc */ +#define FGA_CTL6 FGA_ADRS(0x270) /* local DSACK */ +#define FGA_CTL7 FGA_ADRS(0x274) /* VME timeout */ +#define FGA_CTL8 FGA_ADRS(0x278) /* arb, acfail */ +#define FGA_CTL9 FGA_ADRS(0x27C) /* sysReset */ +#define FGA_CTL10 FGA_ADRS(0x2C0) /* memory size */ +#define FGA_CTL11 FGA_ADRS(0x2C4) /* memory decode */ +#define FGA_CTL12 FGA_ADRS(0x32C) /* VME release */ +#define FGA_CTL13 FGA_ADRS(0x350) /* TEST ONLY!!! */ +#define FGA_CTL14 FGA_ADRS(0x354) /* EPROM access */ +#define FGA_CTL15 FGA_ADRS(0x358) /* slave rmw */ +#define FGA_CTL16 FGA_ADRS(0x35C) /* bus unaligned rmw */ + /* timeout,parity */ + +#define FGA_LOCALIACK FGA_ADRS(0x334) /* IACK for L5-L8 */ + +#define FGA_ENAMCODE FGA_ADRS(0x2B4) /* dual port RAM */ + +#define FGA_MAINUM FGA_ADRS(0x2C8) /* A23-A16 LOCAL */ +#define FGA_MAINUU FGA_ADRS(0x2CC) /* A31-A24 LOCAL */ + +#define FGA_VMEPAGE FGA_ADRS(0x200) /* A31-A28 VME */ +#define FGA_BOTTOMPAGEU FGA_ADRS(0x2D0) /* A27-A20 VME */ +#define FGA_BOTTOMPAGEL FGA_ADRS(0x2D4) /* A19-A12 VME */ +#define FGA_TOPPAGEU FGA_ADRS(0x2D8) /* A27-A20 VME */ +#define FGA_TOPPAGEL FGA_ADRS(0x2DC) /* A19-A12 VME */ + +#define FGA_MYVMEPAGE FGA_ADRS(0x2FC) /* A15-A8 VME */ + +#define FGA_FMBCTL FGA_ADRS(0x338) /* FMB control */ +#define FGA_FMBAREA FGA_ADRS(0x33C) /* A31-A24 VME */ + +#define FGA_ISABORT FGA_ADRS(0x4C8) /* abort status */ +#define FGA_ISACFAIL FGA_ADRS(0x4CC) /* acfail status */ +#define FGA_ISSYSFAIL FGA_ADRS(0x4D0) /* sysfail status */ + +#define FGA_MBOX0 FGA_ADRS(0x80000) /* Mailbox 0 */ +#define FGA_MBOX1 FGA_ADRS(0x80004) /* Mailbox 1 */ +#define FGA_MBOX2 FGA_ADRS(0x80008) /* Mailbox 2 */ +#define FGA_MBOX3 FGA_ADRS(0x8000C) /* Mailbox 3 */ +#define FGA_MBOX4 FGA_ADRS(0x80010) /* Mailbox 4 */ +#define FGA_MBOX5 FGA_ADRS(0x80014) /* Mailbox 5 */ +#define FGA_MBOX6 FGA_ADRS(0x80018) /* Mailbox 6 */ +#define FGA_MBOX7 FGA_ADRS(0x8001C) /* Mailbox 7 */ + + /* auxiliary registers */ +#define FGA_AUXPINCTL FGA_ADRS(0x260) /* control */ +#define FGA_AUXFIFWEX FGA_ADRS(0x268) /* fifo write time */ +#define FGA_AUXFIFREX FGA_ADRS(0x26C) /* fifo read time */ + +#define FGA_AUXSRCSTART FGA_ADRS(0x340) /* src start */ +#define FGA_AUXDSTSTART FGA_ADRS(0x344) /* dst start */ +#define FGA_AUXSRCTERM FGA_ADRS(0x348) /* src termination */ +#define FGA_AUXDSTTERM FGA_ADRS(0x34C) /* dst termination */ + + /* timer register */ +#define FGA_TIM0PRELOAD FGA_ADRS(0x300) /* time preload */ +#define FGA_TIM0CTL FGA_ADRS(0x310) /* time control */ +#define FGA_TIM0COUNT FGA_ADRS(0xC00) /* timer0 counter */ + + /* DMA registers */ +#define FGA_DMASRCATT FGA_ADRS(0x320) /* DMA src attr */ +#define FGA_DMADSTATT FGA_ADRS(0x324) /* DMA dst attr */ +#define FGA_DMAGENERAL FGA_ADRS(0x328) /* DMA general */ +#define FGA_DMASRCDST FGA_ADRS(0x4EC) /* DMA mode */ +#define FGA_DMASRCADR FGA_ADRS_INT(0x500) /* DMA src addr */ +#define FGA_DMADSTADR FGA_ADRS_INT(0x504) /* DMA dst addr */ +#define FGA_DMATRFCNT FGA_ADRS_INT(0x508) /* DMA trans count */ + + /* interrupt status register */ +#define FGA_ISLOCAL0 FGA_ADRS(0x480) +#define FGA_ISLOCAL1 FGA_ADRS(0x484) +#define FGA_ISLOCAL2 FGA_ADRS(0x488) +#define FGA_ISLOCAL3 FGA_ADRS(0x48C) +#define FGA_ISLOCAL4 FGA_ADRS(0x490) +#define FGA_ISLOCAL5 FGA_ADRS(0x494) +#define FGA_ISLOCAL6 FGA_ADRS(0x498) +#define FGA_ISLOCAL7 FGA_ADRS(0x49C) + +#define FGA_ISTIM0 FGA_ADRS(0x4A0) /* timer0 */ +#define FGA_ISDMANORM FGA_ADRS(0x4B0) /* DMA termination */ +#define FGA_ISDMAERR FGA_ADRS(0x4B4) /* DMA error */ + +#define FGA_ISFB0REF FGA_ADRS(0x4B8) /* FMB0 refused */ +#define FGA_ISFB1REF FGA_ADRS(0x4BC) /* FMB1 refused */ +#define FGA_ISFB0MES FGA_ADRS(0x4E0) /* FMB0 message */ +#define FGA_ISFB1MES FGA_ADRS(0x4E4) /* FMB1 message */ + +#define FGA_ISPARITY FGA_ADRS(0x4C0) + +#define FGA_DMARUNCTL FGA_ADRS(0x4C4) +#define FGA_ABORTPIN FGA_ADRS(0x4D4) +#define FGA_ACFAILPIN FGA_ADRS(0x4D8) +#define FGA_SFAILPIN FGA_ADRS(0x4DC) + + /* reset status register */ +#define FGA_RSVMECALL FGA_ADRS(0x4F0) /* VME */ +#define FGA_RSKEYRES FGA_ADRS(0x4F4) /* KEY */ +#define FGA_RSCPUCALL FGA_ADRS(0x4F8) /* CPU */ +#define FGA_RSLOCSW FGA_ADRS(0x4FC) /* local switch */ +#define FGA_SOFTRESCALL FGA_ADRS(0xE00) /* software */ + + /* miscellanous registers */ +#define FGA_LIOTIMING FGA_ADRS(0x330) /* local IO timing */ + +#define FGA_PTYLL FGA_ADRS(0x400) /* PERR address */ +#define FGA_PTYLM FGA_ADRS(0x404) /* PERR address */ +#define FGA_PTYUM FGA_ADRS(0x408) /* PERR address */ +#define FGA_PTYUU FGA_ADRS(0x40C) /* PERR address */ +#define FGA_PTYATT FGA_ADRS(0x410) /* access status */ +#define FGA_IDENT FGA_ADRS(0x41C) /* rev/ident reg */ + +#define FGA_SPECIAL FGA_ADRS(0x420) /* SPECIAL reg */ +#define FGA_SPECIALENA FGA_ADRS(0x424) /* SPECIAL enable */ + +#define FGA_FMBCH0 FGA_ADRS(0xC0000) /* FMB0 channel */ +#define FGA_FMBCH1 FGA_ADRS(0xC0004) /* FMB1 channel*/ + +/* Interrupt Vector Offsets */ + +#define FGA_INT_MBOX0 0x00 +#define FGA_INT_MBOX1 0x01 +#define FGA_INT_MBOX2 0x02 +#define FGA_INT_MBOX3 0x03 +#define FGA_INT_MBOX4 0x04 +#define FGA_INT_MBOX5 0x05 +#define FGA_INT_MBOX6 0x06 +#define FGA_INT_MBOX7 0x07 +#define FGA_INT_TIMER 0x20 +#define FGA_INT_FMB1REF 0x24 +#define FGA_INT_FMB0REF 0x25 +#define FGA_INT_FMB1 0x26 +#define FGA_INT_FMB0 0x27 +#define FGA_INT_ABORT 0x28 +#define FGA_INT_ACFAIL 0x29 +#define FGA_INT_SYSFAIL 0x2a +#define FGA_INT_DMAERR 0x2b +#define FGA_INT_DMANORM 0x2c +#define FGA_INT_PARITY 0x2d +#define FGA_INT_LOCAL0 0x30 +#define FGA_INT_LOCAL1 0x31 +#define FGA_INT_LOCAL2 0x32 +#define FGA_INT_LOCAL3 0x33 +#define FGA_INT_LOCAL4 0x34 /* or external */ +#define FGA_INT_LOCAL5 0x35 /* or external */ +#define FGA_INT_LOCAL6 0x36 /* or external */ +#define FGA_INT_LOCAL7 0x37 /* or external */ + + +/* Register Masks */ + + /* ICR */ +#define FGA_ICR_ENABLE 0x8 /* enable interrupt */ +#define FGA_ICR_LEVEL_MASK 0x7 /* interrupt level mask */ + + /* following defines are only for extended interrupt control registers */ +#define FGA_ICR_AUTOCLEAR 0x10 /* autoclear interrupt */ +#define FGA_ICR_ACTIVITY 0x20 /* active high = 1 */ +#define FGA_ICR_EDGE 0x40 /* 1 = edge sensitive */ + + /* CTL1 */ +#define FGA_CTL1_COPROC_ASYNC 0x0 /* asynchronous */ +#define FGA_CTL1_COPROC_0WAIT 0x1 /* zero wait states */ +#define FGA_CTL1_COPROC_1WAIT 0x2 /* one wait states */ +#define FGA_CTL1_COPROC_2WAIT 0x3 /* two wait states */ +#define FGA_CTL1_SCON 0x4 /* internal arbiter select */ +#define FGA_CTL1_SUPERVISOR 0x8 /* supervisor access only */ + + /* CTL2 */ +#define FGA_CTL2_BYTESTROBE 0x1 /* all bytestrobe lines asserted on R */ +#define FGA_CTL2_CSDROPTION 0x2 /* CSDRP active in R/W cycles */ +#define FGA_CTL2_VMERESCALLENA 0x4 /* VME ResetCall enable */ +#define FGA_CTL2_PARITYOUTENA 0x8 /* parity enable */ + + /* CTL3 */ +#define FGA_CTL3_VMEBUS16 0x1 /* VME bus 16 bit wide */ +#define FGA_CTL3_VSBENA 0x2 /* VSB bus decoding enable */ +#define FGA_CTL3_VEC_MASK 0xc /* bit 7,6 of interrupt vec number */ + + /* CTL5 */ +#define FGA_CTL5_AUXOPTIONA 0x1 /* AUXOPTIONA enabled */ +#define FGA_CTL5_AUXOPTIONB 0x2 /* AUXOPTIONB enabled */ +#define FGA_CTL5_VME_A16_USER 0x4 /* VME access for mailbox int. */ +#define FGA_CTL5_VME_A16_SUP 0x8 /* VME access for mailbox int. */ +#define FGA_CTL5_VME_A16_BOTH 0xc /* VME access for mailbox int. */ + + /* CTL7 */ +#define FGA_CTL7_RAT_1US 0x1 /* VME release timeout */ +#define FGA_CTL7_RAT_2US 0x2 /* VME release timeout */ +#define FGA_CTL7_RAT_4US 0x3 /* VME release timeout */ +#define FGA_CTL7_RAT_8US 0x4 /* VME release timeout */ +#define FGA_CTL7_RAT_16US 0x5 /* VME release timeout */ +#define FGA_CTL7_RAT_32US 0x6 /* VME release timeout */ +#define FGA_CTL7_RAT_64US 0x7 /* VME release timeout */ +#define FGA_CTL7_NO_RELEASE_ON_BCLR 0x8 /* don't release bus on BCLR* */ + + /* CTL 8 */ +#define FGA_CTL8_ACFAIL 0x1 /* ACFAIL handler */ +#define FGA_CTL8_FAIR_ARB 0x2 /* VME bus fair arbitration */ +#define FGA_CTL8_SOFTSYSFAILINIT 0x4 /* Asserts SYSFLTOVME-pin to 0 */ +#define FGA_CTL8_BOOTSYSFAILINIT 0x8 /* INACTIVE */ + + /* CTL 9 */ +#define FGA_CTL9_0WAIT 0x1 /* EPROM wait states */ +#define FGA_CTL9_1WAIT 0x2 /* EPROM wait states */ +#define FGA_CTL9_2WAIT 0x3 /* EPROM wait states */ +#define FGA_CTL9_3WAIT 0x4 /* EPROM wait states */ +#define FGA_CTL9_4WAIT 0x5 /* EPROM wait states */ +#define FGA_CTL9_5WAIT 0x6 /* EPROM wait states */ +#define FGA_CTL9_6WAIT 0x7 /* EPROM wait states */ +#define FGA_CTL9_RESET_BUS 0x8 /* SYSRESET propagates to VMEBUS */ + + /* CTL 15 */ +#define FGA_CTL15_SHAREDRMW 0x1 /* slave RMW cycles are supported */ +#define FGA_CTL15_CINHLIO 0x2 /* do cache 0xff800000 - 0xfff00000 */ +#define FGA_CTL15_CINH16 0x4 /* do cache 0xfcxxxxxx, 0xfexxxxxx */ +#define FGA_CTL15_CINHOFFBOARD 0x8 /* do cache off board */ +#define FGA_CTL15_BURST_1WAIT 0x10 /* one waitstate burst cycles */ +#define FGA_CTL15_BURST_TWO 0x20 /* two transfers per burst */ +#define FGA_CTL15_VSB_TOUT_DIS 0x60 /* VSB bus error timeout disabled */ +#define FGA_CTL15_VSB_TOUT_16 0x80 /* VSB bus error timeout : 16 us */ +#define FGA_CTL15_VSB_TOUT_1000 0x40 /* VSB bus error timeout : 1000 us */ +#define FGA_CTL15_VSB_TOUT_64000 0x00 /* VSB bus error timeout : 64000 us */ + + /* LOCALIACK */ +#define FGA_LOCALIACK_INTERNAL 0x00 /* FGA responds with internal vector */ +#define FGA_LOCALIACK_NONE 0x01 /* FGA ignores interrupt */ +#define FGA_LOCALIACK_EXT_1US 0x02 /* FGA passes ext. vec., 1us response */ +#define FGA_LOCALIACK_EXT_500NS 0x03 /* FGA passes ext. vec.,.5us response */ +#define FGA_LOCALIACK_LOCAL5 0x03 /* LOCAL 5 MASK */ +#define FGA_LOCALIACK_LOCAL6 0x0c /* LOCAL 6 MASK */ +#define FGA_LOCALIACK_LOCAL7 0x30 /* LOCAL 7 MASK */ +#define FGA_LOCALIACK_LOCAL8 0xc0 /* LOCAL 8 MASK */ + + /* DMA Source/Destination Attribute Register */ +#define FGA_DMA_MAIN_MEMORY 0xc0 /* MAIN MEMORY 32 bit */ +#define FGA_DMA_SECOND_BUS_32 0xe0 /* Secondary Bus 32 bit */ +#define FGA_DMA_SECOND_BUS_16 0xe8 /* Secondary Bus 16 bit */ +#define FGA_DMA_SECOND_BUS_8 0xf0 /* Secondary Bus 8 bit */ +#define FGA_DMA_VMEBUS_32 0x00 /* VMEbus 32 bit */ +#define FGA_DMA_VMEBUS_16 0x80 /* VMEbus 16 bit */ +#define FGA_DMA_VMEBUS_8 0x40 /* VMEbus 8 bit */ +#define FGA_DMA_AUX_BUS 0xc8 /* AUX bus 8 bit */ + + /* DMA General Control Register */ +#define FGA_DMA_SRC_NO_COUNT 0x80 /* Source register does not count */ +#define FGA_DMA_SRC_COUNTS 0x00 /* Source register counts up */ +#define FGA_DMA_DST_NO_COUNT 0x40 /* Destination reg does not count */ +#define FGA_DMA_DST_COUNTS 0x00 /* Destination register counts up */ +#define FGA_DMA_ENABLE 0x01 /* enable DMA controller */ + + /* DMA Run Control Register */ +#define FGA_DMA_START 0x01 /* start the DMA operation */ +#define FGA_DMA_STOP 0x00 /* stop the DMA operation */ + + /* AUX Source/Destination Start Register */ +#define FGA_ASSACK_1CLK 0x00 /* AUXACK pin asserted... 1 clock */ +#define FGA_ASSACK_2CLK 0x10 /* 2 clockcycles */ +#define FGA_ASSACK_3CLK 0x20 /* 3 clockcycles */ +#define FGA_ASSACK_4CLK 0x30 /* 4 clockcycles */ +#define FGA_ASSACK_5CLK 0x40 /* 5 clockcycles */ +#define FGA_ASSACK_6CLK 0x50 /* 6 clockcycles */ +#define FGA_ASSACK_7CLK 0x60 /* 7 clockcycles */ +#define FGA_ASSACK_8CLK 0x70 /* 8 clockcycles */ +#define FGA_ASSACK_9CLK 0x80 /* 9 clockcycles */ +#define FGA_ASSACK_10CLK 0x90 /* 10 clockcycles */ +#define FGA_ASSACK_11CLK 0xa0 /* 11 clockcycles */ +#define FGA_ASSACK_12CLK 0xb0 /* 12 clockcycles */ +#define FGA_ASSACK_AUXREQ 0xc0 /* AUXREQ pin asserted */ +#define FGA_ASSACK_NORDY 0xd0 /* AUXREQ asserted, AUXRDY released */ +#define FGA_ASSACK_DATARD 0xe0 /* data read into FIFO */ +#define FGA_ASSACK_AUXRDY 0xf0 /* AUXRDY pin asserted */ + +#define FGA_RDY_1CLK 0x00 /* READY after... 1 clockcycle */ +#define FGA_RDY_2CLK 0x01 /* 2 clockcycles */ +#define FGA_RDY_3CLK 0x02 /* 3 clockcycles */ +#define FGA_RDY_4CLK 0x03 /* 4 clockcycles */ +#define FGA_RDY_5CLK 0x04 /* 5 clockcycles */ +#define FGA_RDY_6CLK 0x05 /* 6 clockcycles */ +#define FGA_RDY_7CLK 0x06 /* 7 clockcycles */ +#define FGA_RDY_8CLK 0x07 /* 8 clockcycles */ +#define FGA_RDY_9CLK 0x08 /* 9 clockcycles */ +#define FGA_RDY_10CLK 0x09 /* 10 clockcycles */ +#define FGA_RDY_11CLK 0x0a /* 11 clockcycles */ +#define FGA_RDY_12CLK 0x0b /* 12 clockcycles */ +#define FGA_RDY_AUXREQ 0x0c /* AUXREQ pin asserted */ +#define FGA_RDY_NORDY 0x0d /* AUXREQ asserted, AUXRDY released */ +#define FGA_RDY_DATARD 0x0e /* data read into FIFO */ +#define FGA_RDY_AUXRDY 0x0f /* AUXRDY pin asserted */ + + /* AUX Source/Destination Term Register */ +#define FGA_RELACK_1CLK 0x00 /* AUXACK pin released... 1 clock */ +#define FGA_RELACK_2CLK 0x10 /* (after READY) 2 clockcycles */ +#define FGA_RELACK_3CLK 0x20 /* 3 clockcycles */ +#define FGA_RELACK_4CLK 0x30 /* 4 clockcycles */ +#define FGA_RELACK_5CLK 0x40 /* 5 clockcycles */ +#define FGA_RELACK_6CLK 0x50 /* 6 clockcycles */ +#define FGA_RELACK_7CLK 0x60 /* 7 clockcycles */ +#define FGA_RELACK_8CLK 0x70 /* 8 clockcycles */ +#define FGA_RELACK_9CLK 0x80 /* 9 clockcycles */ +#define FGA_RELACK_10CLK 0x90 /* 10 clockcycles */ +#define FGA_RELACK_11CLK 0xa0 /* 11 clockcycles */ +#define FGA_RELACK_12CLK 0xb0 /* 12 clockcycles */ +#define FGA_RELACK_AUXRDY 0xc0 /* AUXRDY pin asserted */ +#define FGA_RELACK_NOTALLOWED 0xd0 /* DO NOT USE */ +#define FGA_RELACK_DATARD 0xe0 /* data read into FIFO */ +#define FGA_RELACK_VALIDRDY 0xf0 /* valid READY */ + +#define FGA_NEWCYC_1CLK 0x00 /* NEWCYCLE starts... 1 clockcycle */ +#define FGA_NEWCYC_2CLK 0x01 /* (after READY) 2 clockcycles */ +#define FGA_NEWCYC_3CLK 0x02 /* 3 clockcycles */ +#define FGA_NEWCYC_4CLK 0x03 /* 4 clockcycles */ +#define FGA_NEWCYC_5CLK 0x04 /* 5 clockcycles */ +#define FGA_NEWCYC_6CLK 0x05 /* 6 clockcycles */ +#define FGA_NEWCYC_7CLK 0x06 /* 7 clockcycles */ +#define FGA_NEWCYC_8CLK 0x07 /* 8 clockcycles */ +#define FGA_NEWCYC_9CLK 0x08 /* 9 clockcycles */ +#define FGA_NEWCYC_10CLK 0x09 /* 10 clockcycles */ +#define FGA_NEWCYC_11CLK 0x0a /* 11 clockcycles */ +#define FGA_NEWCYC_12CLK 0x0b /* 12 clockcycles */ +#define FGA_NEWCYC_AUXRDY 0x0c /* AUXRDY pin asserted */ +#define FGA_NEWCYC_AUXACK 0x0d /* AUXACK pin asserted */ +#define FGA_NEWCYC_DATARD 0x0e /* data read into FIFO */ +#define FGA_NEWCYC_VALIDRDY 0x0f /* valid READY */ + + /* AUX Pin Control */ +#define FGA_AUXPIN_AUTOREQ 0x08 /* autorequest enabled */ +#define FGA_AUXPIN_NOAUTOREQ 0x00 /* autorequest disabled */ +#define FGA_AUXPIN_RDY_HIGH 0x04 /* AUXRDY active high */ +#define FGA_AUXPIN_RDY_LOW 0x00 /* AUXRDY active low */ +#define FGA_AUXPIN_ACK_HIGH 0x02 /* AUXACK active high */ +#define FGA_AUXPIN_ACK_LOW 0x00 /* AUXACK active low */ +#define FGA_AUXPIN_REQ_HIGH 0x01 /* AUXREQ active high */ +#define FGA_AUXPIN_REQ_LOW 0x00 /* AUXREQ active low */ + + /* AUX FIFO Write/Read Timing Register */ +#define FGA_AUXFIFO_TIMING0 0x00 /* AUXFIFO Wr/Rd Timing 0 */ +#define FGA_AUXFIFO_TIMING1 0x01 /* AUXFIFO Wr/Rd Timing 1 */ +#define FGA_AUXFIFO_TIMING2 0x02 /* AUXFIFO Wr/Rd Timing 2 */ +#define FGA_AUXFIFO_TIMING3 0x03 /* AUXFIFO Wr/Rd Timing 3 */ +#define FGA_AUXFIFO_TIMING4 0x04 /* AUXFIFO Wr/Rd Timing 4 */ +#define FGA_AUXFIFO_TIMING5 0x05 /* AUXFIFO Wr/Rd Timing 5 */ +#define FGA_AUXFIFO_TIMING6 0x06 /* AUXFIFO Wr/Rd Timing 6 */ +#define FGA_AUXFIFO_TIMING7 0x07 /* AUXFIFO Wr/Rd Timing 7 */ +#define FGA_AUXFIFO_TIMING8 0x08 /* AUXFIFO Wr/Rd Timing 8 */ +#define FGA_AUXFIFO_TIMING9 0x09 /* AUXFIFO Wr/Rd Timing 9 */ +#define FGA_AUXFIFO_TIMING10 0x0a /* AUXFIFO Wr/Rd Timing 10 */ +#define FGA_AUXFIFO_TIMING11 0x0b /* AUXFIFO Wr/Rd Timing 11 */ +#define FGA_AUXFIFO_TIMING12 0x0c /* AUXFIFO Wr/Rd Timing 12 */ +#define FGA_AUXFIFO_TIMING13 0x0d /* AUXFIFO Wr/Rd Timing 13 */ +#define FGA_AUXFIFO_TIMING14 0x0e /* AUXFIFO Wr/Rd Timing 14 */ +#define FGA_AUXFIFO_TIMING15 0x0f /* AUXFIFO Wr/Rd Timing 15 */ + + /* ENAMCODE */ +#define FGA_ENAMCODE_EXTUSRDAT_R 0x2 /* DPR R access with AM 0x09 */ +#define FGA_ENAMCODE_EXTUSRDAT_RW 0x3 /* DPR RW access with AM 0x09 */ +#define FGA_ENAMCODE_EXTUSRPGM_R 0x8 /* DPR R access with AM 0x0a */ +#define FGA_ENAMCODE_EXTUSRPGM_RW 0xc /* DPR RW access with AM 0x0a */ +#define FGA_ENAMCODE_EXTSUPDAT_R 0x20 /* DPR R access with AM 0x0d */ +#define FGA_ENAMCODE_EXTSUPDAT_RW 0x30 /* DPR RW access with AM 0x0d */ +#define FGA_ENAMCODE_EXTSUPPGM_R 0x80 /* DPR R access with AM 0x0e */ +#define FGA_ENAMCODE_EXTSUPPGM_RW 0xc0 /* DPR RW access with AM 0x0e */ + + /* FMBCTL */ +#define FGA_FMBCTL_SLOT_MASK 0x1f /* slot # mask */ +#define FGA_FMBCTL_CHANNEL0 0x20 /* channel 0 enabled */ +#define FGA_FMBCTL_CHANNEL1 0x40 /* channel 1 enabled */ +#define FGA_FMBCTL_BOTH 0x80 /* FMB access w/ AM 0x0d/0x09 */ + +/* function declarations */ + +#ifndef _ASMLANGUAGE +#if defined(__STDC__) || defined(__cplusplus) + +#if CPU_FAMILY == I960 +IMPORT STATUS sysIntDisable (); +IMPORT STATUS sysIntEnable (); +IMPORT int sysBusIntAck (); +IMPORT STATUS sysBusIntGen (); +IMPORT STATUS sysMailboxEnable (); +#else /* CPU_FAMILY == I960 */ +IMPORT STATUS sysIntDisable (int intLevel); +IMPORT STATUS sysIntEnable (int intLevel); +IMPORT int sysBusIntAck (int intLevel); +IMPORT STATUS sysBusIntGen (int level, int vector); +IMPORT STATUS sysMailboxEnable (char *mailboxAdrs); +#endif /* CPU_FAMILY == I960 */ + +IMPORT STATUS sysMailboxConnect (FUNCPTR routine, int arg); + +#else /* __STDC__ */ + +IMPORT STATUS sysIntDisable (); +IMPORT STATUS sysIntEnable (); +IMPORT int sysBusIntAck (); +IMPORT STATUS sysBusIntGen (); +IMPORT STATUS sysMailboxEnable (); +IMPORT STATUS sysMailboxConnect (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfga002h */ diff --git a/h/drv/multi/frcEagle01.h b/h/drv/multi/frcEagle01.h new file mode 100644 index 0000000..fb254fb --- /dev/null +++ b/h/drv/multi/frcEagle01.h @@ -0,0 +1,92 @@ +/* frcEagle01.h - Force EAGLE-01C module header */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,26apr02,dat Adding cplusplus protection, SPR 75017 +01c,07jan93,ccc fixed comment about SCSI_DMA, now works. +01b,22oct92,ccc added definiton of INCLUDE_SCSI_BOOT, INCLUDE_DOSFS for SCSI. +01a,20oct92,caf created. +*/ + +/* +This file contains the configuration parameters for the Force EAGLE-01C module. +*/ + + +#ifndef __INCfrcEagle01h +#define __INCfrcEagle01h + +/* includes */ + +#include "drv/scsi/mb87030.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +/* interrupt vectors */ + +#define INT_VEC_FDC (INT_VEC_FGA + FGA_INT_LOCAL1) /* FDC */ +#define INT_VEC_LANCE (INT_VEC_FGA + FGA_INT_LOCAL6) /* LANCE ethernet */ +#define INT_VEC_SCSI (INT_VEC_FGA + FGA_INT_LOCAL7) /* SCSI */ +#define INT_VEC_SCSI_DMA (INT_VEC_FGA + FGA_INT_DMANORM) /* SCSI DMA */ + +/* interrupt levels */ + +#define INT_LVL_FDC 2 /* floppy disc controller */ +#define INT_LVL_LANCE 3 /* LANCE ethernet */ +#define INT_LVL_SCSI 2 /* SCSI */ + +#define FRC40_FDC_BASE_ADRS ((char *) 0xff803800) /* wd1772 disk ctlr */ + +/* LANCE Ethernet */ + +#define FRC40_LANCE_BASE_ADRS ((char *) 0xfef80000) /* Am7990 LANCE */ + +#define LN_POOL_ADRS 0xfef00000 /* dedicated memory pool */ +#define LN_POOL_SIZE 0x10000 /* size of ln memory pool */ +#define LN_DATA_WIDTH 2 /* word access only */ +#define LN_PADDING FALSE /* no padding for RAP */ +#define LN_RING_BUF_SIZE 0 /* use default size */ + +#undef DEFAULT_BOOT_LINE +#define DEFAULT_BOOT_LINE \ +"ln(0,0)host:/usr/vw/config/frc40/vxWorks h=90.0.0.3 e=90.0.0.50 u=target" + +#define INCLUDE_LN /* include LANCE Ethernet */ +#define IO_ADRS_LN FRC40_LANCE_BASE_ADRS /* LANCE I/O address */ +#define INT_VEC_LN INT_VEC_LANCE /* LANCE interrupt vector */ +#define INT_LVL_LN INT_LVL_LANCE /* LANCE interrupt level */ + +/* PIT */ + +#define FRC_PIT1_READ 0x40 /* 1=From SCSI, 0=To SCSI */ +#define FRC_PIT1_FLOPPY 0x80 /* 1=Floppy, 0=SCSI access */ + +/* SCSI */ + +#define FRC40_SCSI_DMA_CR ((char *) 0xff802c00) /* SCSI DMA control */ +#define FRC_SCSI_DMA_CR FRC40_SCSI_DMA_CR +#define FRC_SCSI_DMA_READ 0x01 +#define FRC40_SPC_BASE_ADRS ((UINT8 *) 0xff803400) /* base ads */ +#define FRC40_SPC_REG_OFFSET 1 /* reg offset */ +#define FRC40_SPC_CLK_PERIOD 125 /* clock (nsec) */ +#define FRC40_SPC_PARITY SPC_DATA_PARITY_HIGH /* input parity */ + +#if FALSE /* change FALSE to TRUE for SCSI interface */ +#define INCLUDE_SCSI /* include FRC-40 SCSI interface */ +#define INCLUDE_SCSI_BOOT /* include ability to boot from SCSI */ +#define INCLUDE_DOSFS /* file system to be used */ +#define INCLUDE_SCSI_DMA +#endif /* FALSE/TRUE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfrcEagle01h */ diff --git a/h/drv/multi/frcEagle02.h b/h/drv/multi/frcEagle02.h new file mode 100644 index 0000000..e39cb7b --- /dev/null +++ b/h/drv/multi/frcEagle02.h @@ -0,0 +1,90 @@ +/* frcEagle02.h - Force EAGLE-02 module header */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,26apr02,dat Adding cplusplus protection, SPR 75017 +01a,20oct92,caf created. +*/ + +/* +This file contains the configuration parameters for the Force EAGLE-02 module. +*/ + + +#ifndef __INCfrcEagle02h +#define __INCfrcEagle02h + +/* defines */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* interrupt vectors */ + +#define INT_VEC_VSB (INT_VEC_FGA + FGA_INT_LOCAL1) /* VSB */ +#define INT_VEC_LANCE (INT_VEC_FGA + FGA_INT_LOCAL7) /* LANCE Ethernet */ + +/* interrupt levels */ + +#define INT_LVL_LANCE 3 /* LANCE Ethernet */ +#define INT_LVL_VSB 6 /* VSB interrupts */ + +/* LANCE Ethernet */ + +#define FRC40_LANCE_BASE_ADRS ((char *) 0xfef80000) /* Am7990 LANCE */ + +#define LN_POOL_ADRS 0xfef00000 /* dedicated memory pool */ +#define LN_POOL_SIZE 0x10000 /* size of ln memory pool */ +#define LN_DATA_WIDTH 2 /* word access only */ +#define LN_PADDING FALSE /* no padding for RAP */ +#define LN_RING_BUF_SIZE 0 /* use default size */ + +#undef DEFAULT_BOOT_LINE +#define DEFAULT_BOOT_LINE \ +"ln(0,0)host:/usr/vw/config/frc40/vxWorks h=90.0.0.3 e=90.0.0.50 u=target" + +#define INCLUDE_LN /* include LANCE Ethernet */ +#define IO_ADRS_LN FRC40_LANCE_BASE_ADRS /* LANCE I/O address */ +#define INT_VEC_LN INT_VEC_LANCE /* LANCE interrupt vector */ +#define INT_LVL_LN INT_LVL_LANCE /* LANCE interrupt level */ + +/* EAGLE-02 defines */ + +/* what the base address should be set to (note: -1 will keep it useless) */ + +#define FRC40_E002_IOC_BASE_ADRS 0xfec00000 +#define FRC40_E002_FLASH_BASE_ADRS 0xfe800000 +#define FRC40_E002_VSB1_BASE_ADRS 0xfd000000 +#define FRC40_E002_CSR_BASE_ADRS 0xfec00200 +#define FRC40_E002_VSB2_BASE_ADRS 0xffffffff /* -1 */ +#define FRC40_E002_LANCE_BASE_ADRS 0xfef80000 +#define FRC40_E002_SRAM_BASE_ADRS LN_POOL_ADRS + +/* IOC chip selects */ + +#define FRC40_E002_IOCCS_FLASH 0 +#define FRC40_E002_IOCCS_VSB1 1 +#define FRC40_E002_IOCCS_CSR 2 +#define FRC40_E002_IOCCS_VSB2 3 +#define FRC40_E002_IOCCS_SRAM 4 +#define FRC40_E002_IOCCS_LANCE 5 +#define FRC40_E002_IOCCS_UNUSD1 6 +#define FRC40_E002_IOCCS_UNUSD2 7 + +/* definitions for device sizes as the IOC wants it */ + +#define FRC40_E002_VSB1_SIZE 0x00800000 /* 16 mb */ +#define FRC40_E002_CSR_SIZE 0x00000020 /* 64 bytes */ +#define FRC40_E002_VSB2_SIZE 0x00000000 /* 0 bytes */ +#define FRC40_E002_SRAM_SIZE 0x00008000 /* 64 kb */ +#define FRC40_E002_LANCE_SIZE 0x00000020 /* 64 bytes */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfrcEagle02h */ diff --git a/h/drv/multi/gt64120a.h b/h/drv/multi/gt64120a.h new file mode 100644 index 0000000..3628f5a --- /dev/null +++ b/h/drv/multi/gt64120a.h @@ -0,0 +1,1010 @@ +/* gt64120a.h - Galileo gt64120A bridge device header */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,07oct04,pes Apigen cleanup +01b,26apr02,dat Adding cplusplus protection, SPR 75017 +01a,15jun00,dra Written from earlier Galileo version of BSP. +*/ + +/* +* This file contains register offsets and programming values for the +* GT64120A bridge chip, which appears on the Galileo Technologies ev64120a +* evaluation board. +*/ + +/* Copyright (c) Galileo Technology Inc. All rights reserved. + * + * THIS SOFTWARE IS PROVIDED BY GALILEO TECHNOLOGY INC. ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL GALILEO TECHNOLOGY INC. BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * ANY REDISTRIBUTION OF THIS SOURCE CODE MUST RETAIN THE COPYRIGHT AND + * DECLARATION STATED ABOVE. + * + */ + +#ifndef __INCgt64120ah +#define __INCgt64120ah + +#ifdef __cplusplus +extern "C" { +#endif + +/* +********************************************************************* +* +* GT64120A Internal Register OFFSETS +* +********************************************************************* +*/ + +/* CPU Configuration */ +#define GT_CPU_INTF_CFG_OFS 0x000 +#define GT_MULTI_GT_REG_OFS 0x120 + +/* CPU Address Decode */ +#define GT_SCS10_L_DEC_ADRS_OFS 0x008 +#define GT_SCS10_H_DEC_ADRS_OFS 0x010 +#define GT_SCS32_L_DEC_ADRS_OFS 0x018 +#define GT_SCS32_H_DEC_ADRS_OFS 0x020 +#define GT_CS20_L_DEC_ADRS_OFS 0x028 +#define GT_CS20_H_DEC_ADRS_OFS 0x030 +#define GT_CS3_BOOTCS_L_DEC_ADRS_OFS 0x038 +#define GT_CS3_BOOTCS_H_DEC_ADRS_OFS 0x040 +#define GT_PCI0_IO_L_DEC_ADRS_OFS 0x048 +#define GT_PCI0_IO_H_DEC_ADRS_OFS 0x050 +#define GT_PCI0_MEM_0_L_DEC_ADRS_OFS 0x058 +#define GT_PCI0_MEM_0_H_DEC_ADRS_OFS 0x060 +#define GT_PCI0_MEM_1_L_DEC_ADRS_OFS 0x080 +#define GT_PCI0_MEM_1_H_DEC_ADRS_OFS 0x088 +#define GT_PCI1_IO_L_DEC_ADRS_OFS 0x090 +#define GT_PCI1_IO_H_DEC_ADRS_OFS 0x098 +#define GT_PCI1_MEM_0_L_DEC_ADRS_OFS 0x0a0 +#define GT_PCI1_MEM_0_H_DEC_ADRS_OFS 0x0a8 +#define GT_PCI1_MEM_1_L_DEC_ADRS_OFS 0x0b0 +#define GT_PCI1_MEM_1_H_DEC_ADRS_OFS 0x0b8 +#define GT_INTERNAL_SPACE_DEC_OFS 0x068 +#define GT_SCS10_ADRS_REMAP_OFS 0x0d0 +#define GT_SCS32_ADRS_REMAP_OFS 0x0d8 +#define GT_CS20_REMAP_OFS 0x0e0 +#define GT_CS3_BOOTCS_REMAP_OFS 0x0e8 +#define GT_PCI0_IO_REMAP_OFS 0x0f0 +#define GT_PCI0_MEM_0_REMAP_OFS 0x0f8 +#define GT_PCI0_MEM_1_REMAP_OFS 0x100 +#define GT_PCI1_IO_REMAP_OFS 0x108 +#define GT_PCI1_MEM_0_REMAP_OFS 0x110 +#define GT_PCI1_MEM_1_REMAP_OFS 0x118 + +/* CPU Errors Report */ +#define GT_CPU_ERROR_ADRS_L_OFS 0x070 +#define GT_CPU_ERROR_ADRS_H_OFS 0x078 +#define GT_CPU_ERROR_DATA_L_OFS 0x128 +#define GT_CPU_ERROR_DATA_H_OFS 0x130 +#define GT_CPU_ERROR_PARITY_OFS 0x138 + +/* CPU Sync Barrier */ +#define GT_PCI0_SYNC_BARRIER_VIRT_OFS 0x0c0 +#define GT_PCI1_SYNC_BARRIER_VIRT_OFS 0x0c8 + +/* SDRAM and Device Address Decode */ +#define GT_SCS0_L_DEC_ADRS_OFS 0x400 +#define GT_SCS0_H_DEC_ADRS_OFS 0x404 +#define GT_SCS1_L_DEC_ADRS_OFS 0x408 +#define GT_SCS1_H_DEC_ADRS_OFS 0x40c +#define GT_SCS2_L_DEC_ADRS_OFS 0x410 +#define GT_SCS2_H_DEC_ADRS_OFS 0x414 +#define GT_SCS3_L_DEC_ADRS_OFS 0x418 +#define GT_SCS3_H_DEC_ADRS_OFS 0x41c +#define GT_CS0_L_DEC_ADRS_OFS 0x420 +#define GT_CS0_H_DEC_ADRS_OFS 0x424 +#define GT_CS1_L_DEC_ADRS_OFS 0x428 +#define GT_CS1_H_DEC_ADRS_OFS 0x42c +#define GT_CS2_L_DEC_ADRS_OFS 0x430 +#define GT_CS2_H_DEC_ADRS_OFS 0x434 +#define GT_CS3_L_DEC_ADRS_OFS 0x438 +#define GT_CS3_H_DEC_ADRS_OFS 0x43c +#define GT_BOOTCS_L_DEC_ADRS_OFS 0x440 +#define GT_BOOTCS_H_DEC_ADRS_OFS 0x444 +#define GT_ADRS_DEC_ERROR_OFS 0x470 + +/* SDRAM Configuration */ +#define GT_SDRAM_CFG_OFS 0x448 +#define GT_SDRAM_OP_MODE_OFS 0x474 +#define GT_SDRAM_BURST_MODE_OFS 0x478 +#define GT_SDRAM_ADRS_DEC_OFS 0x47c + +/* SDRAM Parameters */ +#define GT_SDRAM_BANK0_PARAM_OFS 0x44c +#define GT_SDRAM_BANK1_PARAM_OFS 0x450 +#define GT_SDRAM_BANK2_PARAM_OFS 0x454 +#define GT_SDRAM_BANK3_PARAM_OFS 0x458 + +/* ECC */ +#define GT_ECC_ERROR_ADRS_OFS 0x490 +#define GT_ECC_ERROR_DATA_H_OFS 0x480 +#define GT_ECC_ERROR_DATA_L_OFS 0x484 +#define GT_ECC_FROM_MEM_OFS 0x488 +#define GT_ECC_CALCULATED_OFS 0x48c + +/* Device Parameters*/ +#define GT_DEV_BANK0_PARAM_OFS 0x45c +#define GT_DEV_BANK1_PARAM_OFS 0x460 +#define GT_DEV_BANK2_PARAM_OFS 0x464 +#define GT_DEV_BANK3_PARAM_OFS 0x468 +#define GT_DEV_BOOT_BANK_PARAM_OFS 0x46c + +/* DMA Record */ +#define GT_CHAN_0_DMA_BYTE_COUNT_OFS 0x800 +#define GT_CHAN_1_DMA_BYTE_COUNT_OFS 0x804 +#define GT_CHAN_2_DMA_BYTE_COUNT_OFS 0x808 +#define GT_CHAN_3_DMA_BYTE_COUNT_OFS 0x80c +#define GT_CHAN_0_DMA_SRC_ADRS_OFS 0x810 +#define GT_CHAN_1_DMA_SRC_ADRS_OFS 0x814 +#define GT_CHAN_2_DMA_SRC_ADRS_OFS 0x818 +#define GT_CHAN_3_DMA_SRC_ADRS_OFS 0x81c +#define GT_CHAN_0_DMA_DEST_ADRS_OFS 0x820 +#define GT_CHAN_1_DMA_DEST_ADRS_OFS 0x824 +#define GT_CHAN_2_DMA_DEST_ADRS_OFS 0x828 +#define GT_CHAN_3_DMA_DEST_ADRS_OFS 0x82c +#define GT_CHAN_0_NEXT_REC_PTR_OFS 0x830 +#define GT_CHAN_1_NEXT_REC_PTR_OFS 0x834 +#define GT_CHAN_2_NEXT_REC_PTR_OFS 0x838 +#define GT_CHAN_3_NEXT_REC_PTR_OFS 0x83c +#define GT_CHAN_0_CURRENT_DESCRIPTOR_PTR_OFS 0x870 +#define GT_CHAN_1_CURRENT_DESCRIPTOR_PTR_OFS 0x874 +#define GT_CHAN_2_CURRENT_DESCRIPTOR_PTR_OFS 0x878 +#define GT_CHAN_3_CURRENT_DESCRIPTOR_PTR_OFS 0x87c +#define GT_CHAN_0_CTL_OFS 0x840 +#define GT_CHAN_1_CTL_OFS 0x844 +#define GT_CHAN_2_CTL_OFS 0x848 +#define GT_CHAN_3_CTL_OFS 0x84c + +/* DMA Arbiter */ +#define GT_ARBITER_CTL_OFS 0x860 + +/* Timer/COUNTER */ +#define GT_TIMER_COUNTER_0_OFS 0x850 +#define GT_TIMER_COUNTER_1_OFS 0x854 +#define GT_TIMER_COUNTER_2_OFS 0x858 +#define GT_TIMER_COUNTER_3_OFS 0x85c +#define GT_TIMER_COUNTER_CTL_OFS 0x864 + +/* PCI Internal */ +#define GT_PCI0_COMMAND_OFS 0xc00 +#define GT_PCI1_COMMAND_OFS 0xc80 +#define GT_PCI0_TIMEOUT_RETRY_OFS 0xc04 +#define GT_PCI1_TIMEOUT_RETRY_OFS 0xc84 +#define GT_PCI0_SCS10_BANK_SZ_OFS 0xc08 +#define GT_PCI1_SCS10_BANK_SZ_OFS 0xc88 +#define GT_PCI0_SCS32_BANK_SZ_OFS 0xc0c +#define GT_PCI1_SCS32_BANK_SZ_OFS 0xc8c +#define GT_PCI0_CS20_BANK_SZ_OFS 0xc10 +#define GT_PCI1_CS20_BANK_SZ_OFS 0xc90 +#define GT_PCI0_CS3_BOOTCS_BANK_SZ_OFS 0xc14 +#define GT_PCI1_CS3_BOOTCS_BANK_SZ_OFS 0xc94 +#define GT_PCI0_BASE_ADRS_REGS_ENABLE_OFS 0xc3c +#define GT_PCI1_BASE_ADRS_REGS_ENABLE_OFS 0xcbc +#define GT_PCI0_PREFETCH_MAX_BURST_SZ_OFS 0xc40 +#define GT_PCI1_PREFETCH_MAX_BURST_SZ_OFS 0xcc0 +#define GT_PCI0_SCS10_BASE_ADRS_REMAP_OFS 0xc48 +#define GT_PCI1_SCS10_BASE_ADRS_REMAP_OFS 0xcc8 +#define GT_PCI0_SCS32_BASE_ADRS_REMAP_OFS 0xc4c +#define GT_PCI1_SCS32_BASE_ADRS_REMAP_OFS 0xccc +#define GT_PCI0_CS20_BASE_ADRS_REMAP_OFS 0xc50 +#define GT_PCI1_CS20_BASE_ADRS_REMAP_OFS 0xcd0 +#define GT_PCI0_CS3_BOOTCS_BASE_ADRS_REMAP_OFS 0xc54 +#define GT_PCI1_CS3_BOOTCS_BASE_ADRS_REMAP_OFS 0xcd4 +#define GT_PCI0_SWAPPED_SCS10_BASE_ADRS_REMAP_OFS 0xc58 +#define GT_PCI1_SWAPPED_SCS10_BASE_ADRS_REMAP_OFS 0xcd8 +#define GT_PCI0_SWAPPED_SCS32_BASE_ADRS_REMAP_OFS 0xc5c +#define GT_PCI1_SWAPPED_SCS32_BASE_ADRS_REMAP_OFS 0xcdc +#define GT_PCI0_SWAPPED_CS3_BOOTCS_BASE_ADRS_REMAP_OFS 0xc64 +#define GT_PCI1_SWAPPED_CS3_BOOTCS_BASE_ADRS_REMAP_OFS 0xce4 +#define GT_PCI0_CFG_ADRS_OFS 0xcf8 +#define GT_PCI1_CFG_ADRS_OFS 0xcf0 +#define GT_PCI0_CFG_DATA_VIRT_OFS 0xcfc +#define GT_PCI1_CFG_DATA_VIRT_OFS 0xcf4 +#define GT_PCI0_INTR_ACK_VIRT_OFS 0xc34 +#define GT_PCI1_INTR_ACK_VIRT_OFS 0xc30 + +/* Interrupts */ +#define GT_INTR_CAUSE_OFS 0xc18 +#define GT_H_INTR_CAUSE_OFS 0xc98 +#define GT_CPU_INTR_MASK_OFS 0xc1c +#define GT_CPU_H_INTR_MASK_OFS 0xc9c +#define GT_PCI0_INTR_CAUSE_MASK_OFS 0xc24 +#define GT_PCI0_H_INTR_CAUSE_MASK_OFS 0xca4 +#define GT_PCI0_SERR0_MASK_OFS 0xc28 +#define GT_PCI1_SERR1_MASK_OFS 0xca8 +#define GT_CPU_SELECT_CAUSE_OFS 0xc70 +#define GT_PCI0_INTR_SELECT_OFS 0xc74 + +/* + * PCI Configuration + * + * This is done by writing a register offset from pciConfigLib.h into + * GT_PCI0_CFG_ADRS, and then writing or reading the register value at + * GT_PCI0_CFG_DATA_VIRT. For register offsets, use definitions from + * pciConfigLib.h + * + * for PCI1, use GT_PCI1_CFG_{ADRS,DATA_VIRT}. Alternatively, add the + * constant offset GT_PCI1_CFG_OFS to the register offset, and use + * GT_PCI0_CFG_{ADRS,DATA_VIRT} + */ + +#define GT_PCI1_CFG_OFS 0x080 + +#define GT_PCI0_SCS10_BASE_ADRS_OFS PCI_CFG_BASE_ADDRESS_0 +#define GT_PCI0_SCS32_BASE_ADRS_OFS PCI_CFG_BASE_ADDRESS_1 +#define GT_PCI0_CS20_BASE_ADRS_OFS PCI_CFG_BASE_ADDRESS_2 +#define GT_PCI0_CS3_BOOTCS_BASE_ADRS_OFS PCI_CFG_BASE_ADDRESS_3 +#define GT_PCI0_INTERNAL_REGS_MEM_MAPPED_BASE_ADRS_OFS PCI_CFG_BASE_ADDRESS_4 +#define GT_PCI0_INTERNAL_REGS_IO_MAPPED_BASE_ADRS_OFS PCI_CFG_BASE_ADDRESS_5 +#define GT_EXPANSION_ROM_BASE_ADRS_OFS PCI_CFG_EXPANSION_ROM + +/* PCI Configuration, Function 1 */ +#define GT_PCI0_SWAPPED_SCS10_BASE_ADRS_OFS 0x110 +#define GT_PCI0_SWAPPED_SCS32_BASE_ADRS_OFS 0x114 +#define GT_PCI0_SWAPPED_CS3_BOOTCS_BASE_ADRS_OFS 0x11c + +/* I2O Support Registers */ +#define GT_INBOUND_MESSAGE_0_OFS 0x10 +#define GT_INBOUND_MESSAGE_1_OFS 0x14 +#define GT_OUTBOUND_MESSAGE_0_OFS 0x18 +#define GT_OUTBOUND_MESSAGE_1_OFS 0x1c +#define GT_INBOUND_DOORBELL_OFS 0x20 +#define GT_INBOUND_INTR_CAUSE_OFS 0x24 +#define GT_INBOUND_INTR_MASK_OFS 0x28 +#define GT_OUTBOUND_DOORBELL_OFS 0x2c +#define GT_OUTBOUND_INTR_CAUSE_OFS 0x30 +#define GT_OUTBOUND_INTR_MASK_OFS 0x34 +#define GT_INBOUND_QUEUE_PORT_VIRT_OFS 0x40 +#define GT_OUTBOUND_QUEUE_PORT_VIRT_OFS 0x44 +#define GT_QUEUE_CTL_OFS 0x50 +#define GT_QUEUE_BASE_ADRS_OFS 0x54 +#define GT_INBOUND_FREE_HEAD_PTR_OFS 0x60 +#define GT_INBOUND_FREE_TAIL_PTR_OFS 0x64 +#define GT_INBOUND_POST_HEAD_PTR_OFS 0x68 +#define GT_INBOUND_POST_TAIL_PTR_OFS 0x6c +#define GT_OUTBOUND_FREE_HEAD_PTR_OFS 0x70 +#define GT_OUTBOUND_FREE_TAIL_PTR_OFS 0x74 +#define GT_OUTBOUND_POST_HEAD_PTR_OFS 0x78 +#define GT_OUTBOUND_POST_TAIL_PTR_OFS 0x7c + + +/* +********************************************************************* +* +* GT64120A Internal Register ABSOLUTE ADDRESSES +* +* These require the includer of this header to define a GT_BASE macro. +* Here's an assembly-language example: +* +* #include +* +* #define K1BASE 0xa0000000 /@ MIPS base address for phys mem @/ +* #define GT_BASE (K1BASE | GT_INTERNAL_REGS_BASE_DEF) +* +* lw k0,GT_CPU_INTF_CFG /@ get CPU Interface Configuration @/ +* +********************************************************************* +*/ + +/* Default memory map */ + +#define GT_SCS0_BASE_DEF 0x00000000 +#define GT_SCS1_BASE_DEF 0x00800000 +#define GT_SCS2_BASE_DEF 0x01000000 +#define GT_SCS3_BASE_DEF 0x01800000 +#define GT_PCI0_IO_0_BASE_DEF 0x10000000 +#define GT_PCI0_MEM_0_BASE_DEF 0x12000000 +#define GT_INTERNAL_REGS_BASE_DEF 0x14000000 +#define GT_CS0_BASE_DEF 0x1c000000 +#define GT_CS1_BASE_DEF 0x1c800000 +#define GT_CS2_BASE_DEF 0x1d000000 +#define GT_CS3_BASE_DEF 0x1f000000 +#define GT_BOOTCS_BASE_DEF 0x1fc00000 +#define GT_PCI1_IO_BASE_DEF 0x20000000 +#define GT_PCI1_MEM_0_BASE_DEF 0x22000000 +#define GT_PCI1_MEM_1_BASE_DEF 0x24000000 +#define GT_PCI0_MEM_1_BASE_DEF 0xf2000000 + +/* CPU Configuration */ +#define GT_CPU_INTF_CFG (GT_BASE+GT_CPU_INTF_CFG_OFS) +#define GT_MULTI_GT_REG (GT_BASE+GT_MULTI_GT_REG_OFS) + +/* CPU Address Decode */ +#define GT_SCS10_L_DEC_ADRS (GT_BASE+GT_SCS10_L_DEC_ADRS_OFS) +#define GT_SCS10_H_DEC_ADRS (GT_BASE+GT_SCS10_H_DEC_ADRS_OFS) +#define GT_SCS32_L_DEC_ADRS (GT_BASE+GT_SCS32_L_DEC_ADRS_OFS) +#define GT_SCS32_H_DEC_ADRS (GT_BASE+GT_SCS32_H_DEC_ADRS_OFS) +#define GT_CS20_L_DEC_ADRS (GT_BASE+GT_CS20_L_DEC_ADRS_OFS) +#define GT_CS20_H_DEC_ADRS (GT_BASE+GT_CS20_H_DEC_ADRS_OFS) +#define GT_CS3_BOOTCS_L_DEC_ADRS (GT_BASE+GT_CS3_BOOTCS_L_DEC_ADRS_OFS) +#define GT_CS3_BOOTCS_H_DEC_ADRS (GT_BASE+GT_CS3_BOOTCS_H_DEC_ADRS_OFS) +#define GT_PCI0_IO_L_DEC_ADRS (GT_BASE+GT_PCI0_IO_L_DEC_ADRS_OFS) +#define GT_PCI0_IO_H_DEC_ADRS (GT_BASE+GT_PCI0_IO_H_DEC_ADRS_OFS) +#define GT_PCI0_MEM_0_L_DEC_ADRS (GT_BASE+GT_PCI0_MEM_0_L_DEC_ADRS_OFS) +#define GT_PCI0_MEM_0_H_DEC_ADRS (GT_BASE+GT_PCI0_MEM_0_H_DEC_ADRS_OFS) +#define GT_PCI0_MEM_1_L_DEC_ADRS (GT_BASE+GT_PCI0_MEM_1_L_DEC_ADRS_OFS) +#define GT_PCI0_MEM_1_H_DEC_ADRS (GT_BASE+GT_PCI0_MEM_1_H_DEC_ADRS_OFS) +#define GT_PCI1_IO_L_DEC_ADRS (GT_BASE+GT_PCI1_IO_L_DEC_ADRS_OFS) +#define GT_PCI1_IO_H_DEC_ADRS (GT_BASE+GT_PCI1_IO_H_DEC_ADRS_OFS) +#define GT_PCI1_MEM_0_L_DEC_ADRS (GT_BASE+GT_PCI1_MEM_0_L_DEC_ADRS_OFS) +#define GT_PCI1_MEM_0_H_DEC_ADRS (GT_BASE+GT_PCI1_MEM_0_H_DEC_ADRS_OFS) +#define GT_PCI1_MEM_1_L_DEC_ADRS (GT_BASE+GT_PCI1_MEM_1_L_DEC_ADRS_OFS) +#define GT_PCI1_MEM_1_H_DEC_ADRS (GT_BASE+GT_PCI1_MEM_1_H_DEC_ADRS_OFS) +#define GT_INTERNAL_SPACE_DEC (GT_BASE+GT_INTERNAL_SPACE_DEC_OFS) +#define GT_SCS10_ADRS_REMAP (GT_BASE+GT_SCS10_ADRS_REMAP_OFS) +#define GT_SCS32_ADRS_REMAP (GT_BASE+GT_SCS32_ADRS_REMAP_OFS) +#define GT_CS20_REMAP (GT_BASE+GT_CS20_REMAP_OFS) +#define GT_CS3_BOOTCS_REMAP (GT_BASE+GT_CS3_BOOTCS_REMAP_OFS) +#define GT_PCI0_IO_REMAP (GT_BASE+GT_PCI0_IO_REMAP_OFS) +#define GT_PCI0_MEM_0_REMAP (GT_BASE+GT_PCI0_MEM_0_REMAP_OFS) +#define GT_PCI0_MEM_1_REMAP (GT_BASE+GT_PCI0_MEM_1_REMAP_OFS) +#define GT_PCI1_IO_REMAP (GT_BASE+GT_PCI1_IO_REMAP_OFS) +#define GT_PCI1_MEM_0_REMAP (GT_BASE+GT_PCI1_MEM_0_REMAP_OFS) +#define GT_PCI1_MEM_1_REMAP (GT_BASE+GT_PCI1_MEM_1_REMAP_OFS) + +/* CPU Errors Report */ +#define GT_CPU_ERROR_ADRS_L (GT_BASE+GT_CPU_ERROR_ADRS_L_OFS) +#define GT_CPU_ERROR_ADRS_H (GT_BASE+GT_CPU_ERROR_ADRS_H_OFS) +#define GT_CPU_ERROR_DATA_L (GT_BASE+GT_CPU_ERROR_DATA_L_OFS) +#define GT_CPU_ERROR_DATA_H (GT_BASE+GT_CPU_ERROR_DATA_H_OFS) +#define GT_CPU_ERROR_PARITY (GT_BASE+GT_CPU_ERROR_PARITY_OFS) + +/* CPU Sync Barrier */ +#define GT_PCI0_SYNC_BARRIER_VIRT (GT_BASE+GT_PCI0_SYNC_BARRIER_VIRT_OFS) +#define GT_PCI1_SYNC_BARRIER_VIRT (GT_BASE+GT_PCI1_SYNC_BARRIER_VIRT_OFS) + +/* SDRAM and Device Address Decode */ +#define GT_SCS0_L_DEC_ADRS (GT_BASE+GT_SCS0_L_DEC_ADRS_OFS) +#define GT_SCS0_H_DEC_ADRS (GT_BASE+GT_SCS0_H_DEC_ADRS_OFS) +#define GT_SCS1_L_DEC_ADRS (GT_BASE+GT_SCS1_L_DEC_ADRS_OFS) +#define GT_SCS1_H_DEC_ADRS (GT_BASE+GT_SCS1_H_DEC_ADRS_OFS) +#define GT_SCS2_L_DEC_ADRS (GT_BASE+GT_SCS2_L_DEC_ADRS_OFS) +#define GT_SCS2_H_DEC_ADRS (GT_BASE+GT_SCS2_H_DEC_ADRS_OFS) +#define GT_SCS3_L_DEC_ADRS (GT_BASE+GT_SCS3_L_DEC_ADRS_OFS) +#define GT_SCS3_H_DEC_ADRS (GT_BASE+GT_SCS3_H_DEC_ADRS_OFS) +#define GT_CS0_L_DEC_ADRS (GT_BASE+GT_CS0_L_DEC_ADRS_OFS) +#define GT_CS0_H_DEC_ADRS (GT_BASE+GT_CS0_H_DEC_ADRS_OFS) +#define GT_CS1_L_DEC_ADRS (GT_BASE+GT_CS1_L_DEC_ADRS_OFS) +#define GT_CS1_H_DEC_ADRS (GT_BASE+GT_CS1_H_DEC_ADRS_OFS) +#define GT_CS2_L_DEC_ADRS (GT_BASE+GT_CS2_L_DEC_ADRS_OFS) +#define GT_CS2_H_DEC_ADRS (GT_BASE+GT_CS2_H_DEC_ADRS_OFS) +#define GT_CS3_L_DEC_ADRS (GT_BASE+GT_CS3_L_DEC_ADRS_OFS) +#define GT_CS3_H_DEC_ADRS (GT_BASE+GT_CS3_H_DEC_ADRS_OFS) +#define GT_BOOTCS_L_DEC_ADRS (GT_BASE+GT_BOOTCS_L_DEC_ADRS_OFS) +#define GT_BOOTCS_H_DEC_ADRS (GT_BASE+GT_BOOTCS_H_DEC_ADRS_OFS) +#define GT_ADRS_DEC_ERROR (GT_BASE+GT_ADRS_DEC_ERROR_OFS) + +/* SDRAM Configuration */ +#define GT_SDRAM_CFG (GT_BASE+GT_SDRAM_CFG_OFS) +#define GT_SDRAM_OP_MODE (GT_BASE+GT_SDRAM_OP_MODE_OFS) +#define GT_SDRAM_BURST_MODE (GT_BASE+GT_SDRAM_BURST_MODE_OFS) +#define GT_SDRAM_ADRS_DEC (GT_BASE+GT_SDRAM_ADRS_DEC_OFS) + +/* SDRAM Parameters */ +#define GT_SDRAM_BANK0_PARAM (GT_BASE+GT_SDRAM_BANK0_PARAM_OFS) +#define GT_SDRAM_BANK1_PARAM (GT_BASE+GT_SDRAM_BANK1_PARAM_OFS) +#define GT_SDRAM_BANK2_PARAM (GT_BASE+GT_SDRAM_BANK2_PARAM_OFS) +#define GT_SDRAM_BANK3_PARAM (GT_BASE+GT_SDRAM_BANK3_PARAM_OFS) + +/* ECC */ +#define GT_ECC_ERROR_ADRS (GT_BASE+GT_ECC_ERROR_ADRS_OFS) +#define GT_ECC_ERROR_DATA_H (GT_BASE+GT_ECC_ERROR_DATA_H_OFS) +#define GT_ECC_ERROR_DATA_L (GT_BASE+GT_ECC_ERROR_DATA_L_OFS) +#define GT_ECC_FROM_MEM (GT_BASE+GT_ECC_FROM_MEM_OFS) +#define GT_ECC_CALCULATED (GT_BASE+GT_ECC_CALCULATED_OFS) + +/* Device Parameters*/ +#define GT_DEV_BANK0_PARAM (GT_BASE+GT_DEV_BANK0_PARAM_OFS) +#define GT_DEV_BANK1_PARAM (GT_BASE+GT_DEV_BANK1_PARAM_OFS) +#define GT_DEV_BANK2_PARAM (GT_BASE+GT_DEV_BANK2_PARAM_OFS) +#define GT_DEV_BANK3_PARAM (GT_BASE+GT_DEV_BANK3_PARAM_OFS) +#define GT_DEV_BOOT_BANK_PARAM (GT_BASE+GT_DEV_BOOT_BANK_PARAM_OFS) + +/* DMA Record */ +#define GT_CHAN_0_DMA_BYTE_COUNT (GT_BASE+GT_CHAN_0_DMA_BYTE_COUNT_OFS) +#define GT_CHAN_1_DMA_BYTE_COUNT (GT_BASE+GT_CHAN_1_DMA_BYTE_COUNT_OFS) +#define GT_CHAN_2_DMA_BYTE_COUNT (GT_BASE+GT_CHAN_2_DMA_BYTE_COUNT_OFS) +#define GT_CHAN_3_DMA_BYTE_COUNT (GT_BASE+GT_CHAN_3_DMA_BYTE_COUNT_OFS) +#define GT_CHAN_0_DMA_SRC_ADRS (GT_BASE+GT_CHAN_0_DMA_SRC_ADRS_OFS) +#define GT_CHAN_1_DMA_SRC_ADRS (GT_BASE+GT_CHAN_1_DMA_SRC_ADRS_OFS) +#define GT_CHAN_2_DMA_SRC_ADRS (GT_BASE+GT_CHAN_2_DMA_SRC_ADRS_OFS) +#define GT_CHAN_3_DMA_SRC_ADRS (GT_BASE+GT_CHAN_3_DMA_SRC_ADRS_OFS) +#define GT_CHAN_0_DMA_DEST_ADRS (GT_BASE+GT_CHAN_0_DMA_DEST_ADRS_OFS) +#define GT_CHAN_1_DMA_DEST_ADRS (GT_BASE+GT_CHAN_1_DMA_DEST_ADRS_OFS) +#define GT_CHAN_2_DMA_DEST_ADRS (GT_BASE+GT_CHAN_2_DMA_DEST_ADRS_OFS) +#define GT_CHAN_3_DMA_DEST_ADRS (GT_BASE+GT_CHAN_3_DMA_DEST_ADRS_OFS) +#define GT_CHAN_0_NEXT_REC_PTR (GT_BASE+GT_CHAN_0_NEXT_REC_PTR_OFS) +#define GT_CHAN_1_NEXT_REC_PTR (GT_BASE+GT_CHAN_1_NEXT_REC_PTR_OFS) +#define GT_CHAN_2_NEXT_REC_PTR (GT_BASE+GT_CHAN_2_NEXT_REC_PTR_OFS) +#define GT_CHAN_3_NEXT_REC_PTR (GT_BASE+GT_CHAN_3_NEXT_REC_PTR_OFS) +#define GT_CHAN_0_CURRENT_DESCRIPTOR_PTR (GT_BASE+GT_CHAN_0_CURRENT_DESCRIPTOR_PTR_OFS) +#define GT_CHAN_1_CURRENT_DESCRIPTOR_PTR (GT_BASE+GT_CHAN_1_CURRENT_DESCRIPTOR_PTR_OFS) +#define GT_CHAN_2_CURRENT_DESCRIPTOR_PTR (GT_BASE+GT_CHAN_2_CURRENT_DESCRIPTOR_PTR_OFS) +#define GT_CHAN_3_CURRENT_DESCRIPTOR_PTR (GT_BASE+GT_CHAN_3_CURRENT_DESCRIPTOR_PTR_OFS) +#define GT_CHAN_0_CTL (GT_BASE+GT_CHAN_0_CTL_OFS) +#define GT_CHAN_1_CTL (GT_BASE+GT_CHAN_1_CTL_OFS) +#define GT_CHAN_2_CTL (GT_BASE+GT_CHAN_2_CTL_OFS) +#define GT_CHAN_3_CTL (GT_BASE+GT_CHAN_3_CTL_OFS) + +/* DMA Arbiter */ +#define GT_ARBITER_CTL (GT_BASE+GT_ARBITER_CTL_OFS) + +/* Timer/COUNTER */ +#define GT_TIMER_COUNTER_0 (GT_BASE+GT_TIMER_COUNTER_0_OFS) +#define GT_TIMER_COUNTER_1 (GT_BASE+GT_TIMER_COUNTER_1_OFS) +#define GT_TIMER_COUNTER_2 (GT_BASE+GT_TIMER_COUNTER_2_OFS) +#define GT_TIMER_COUNTER_3 (GT_BASE+GT_TIMER_COUNTER_3_OFS) +#define GT_TIMER_COUNTER_CTL (GT_BASE+GT_TIMER_COUNTER_CTL_OFS) + +/* PCI Internal */ +#define GT_PCI0_COMMAND (GT_BASE+GT_PCI0_COMMAND_OFS) +#define GT_PCI1_COMMAND (GT_BASE+GT_PCI1_COMMAND_OFS) +#define GT_PCI0_TIMEOUT_RETRY (GT_BASE+GT_PCI0_TIMEOUT_RETRY_OFS) +#define GT_PCI1_TIMEOUT_RETRY (GT_BASE+GT_PCI1_TIMEOUT_RETRY_OFS) +#define GT_PCI0_SCS10_BANK_SZ (GT_BASE+GT_PCI0_SCS10_BANK_SZ_OFS) +#define GT_PCI1_SCS10_BANK_SZ (GT_BASE+GT_PCI1_SCS10_BANK_SZ_OFS) +#define GT_PCI0_SCS32_BANK_SZ (GT_BASE+GT_PCI0_SCS32_BANK_SZ_OFS) +#define GT_PCI1_SCS32_BANK_SZ (GT_BASE+GT_PCI1_SCS32_BANK_SZ_OFS) +#define GT_PCI0_CS20_BANK_SZ (GT_BASE+GT_PCI0_CS20_BANK_SZ_OFS) +#define GT_PCI1_CS20_BANK_SZ (GT_BASE+GT_PCI1_CS20_BANK_SZ_OFS) +#define GT_PCI0_CS3_BOOTCS_BANK_SZ (GT_BASE+GT_PCI0_CS3_BOOTCS_BANK_SZ_OFS) +#define GT_PCI1_CS3_BOOTCS_BANK_SZ (GT_BASE+GT_PCI1_CS3_BOOTCS_BANK_SZ_OFS) +#define GT_PCI0_BASE_ADRS_REGS_ENABLE (GT_BASE+GT_PCI0_BASE_ADRS_REGS_ENABLE_OFS) +#define GT_PCI1_BASE_ADRS_REGS_ENABLE (GT_BASE+GT_PCI1_BASE_ADRS_REGS_ENABLE_OFS) +#define GT_PCI0_PREFETCH_MAX_BURST_SZ (GT_BASE+GT_PCI0_PREFETCH_MAX_BURST_SZ_OFS) +#define GT_PCI1_PREFETCH_MAX_BURST_SZ (GT_BASE+GT_PCI1_PREFETCH_MAX_BURST_SZ_OFS) +#define GT_PCI0_SCS10_BASE_ADRS_REMAP (GT_BASE+GT_PCI0_SCS10_BASE_ADRS_REMAP_OFS) +#define GT_PCI1_SCS10_BASE_ADRS_REMAP (GT_BASE+GT_PCI1_SCS10_BASE_ADRS_REMAP_OFS) +#define GT_PCI0_SCS32_BASE_ADRS_REMAP (GT_BASE+GT_PCI0_SCS32_BASE_ADRS_REMAP_OFS) +#define GT_PCI1_SCS32_BASE_ADRS_REMAP (GT_BASE+GT_PCI1_SCS32_BASE_ADRS_REMAP_OFS) +#define GT_PCI0_CS20_BASE_ADRS_REMAP (GT_BASE+GT_PCI0_CS20_BASE_ADRS_REMAP_OFS) +#define GT_PCI1_CS20_BASE_ADRS_REMAP (GT_BASE+GT_PCI1_CS20_BASE_ADRS_REMAP_OFS) +#define GT_PCI0_CS3_BOOTCS_BASE_ADRS_REMAP (GT_BASE+GT_PCI0_CS3_BOOTCS_BASE_ADRS_REMAP_OFS) +#define GT_PCI1_CS3_BOOTCS_BASE_ADRS_REMAP (GT_BASE+GT_PCI1_CS3_BOOTCS_BASE_ADRS_REMAP_OFS) +#define GT_PCI0_SWAPPED_SCS10_BASE_ADRS_REMAP (GT_BASE+GT_PCI0_SWAPPED_SCS10_BASE_ADRS_REMAP_OFS) +#define GT_PCI1_SWAPPED_SCS10_BASE_ADRS_REMAP (GT_BASE+GT_PCI1_SWAPPED_SCS10_BASE_ADRS_REMAP_OFS) +#define GT_PCI0_SWAPPED_SCS32_BASE_ADRS_REMAP (GT_BASE+GT_PCI0_SWAPPED_SCS32_BASE_ADRS_REMAP_OFS) +#define GT_PCI1_SWAPPED_SCS32_BASE_ADRS_REMAP (GT_BASE+GT_PCI1_SWAPPED_SCS32_BASE_ADRS_REMAP_OFS) +#define GT_PCI0_SWAPPED_CS3_BOOTCS_BASE_ADRS_REMAP (GT_BASE+GT_PCI0_SWAPPED_CS3_BOOTCS_BASE_ADRS_REMAP_OFS) +#define GT_PCI1_SWAPPED_CS3_BOOTCS_BASE_ADRS_REMAP (GT_BASE+GT_PCI1_SWAPPED_CS3_BOOTCS_BASE_ADRS_REMAP_OFS) +#define GT_PCI0_CFG_ADRS (GT_BASE+GT_PCI0_CFG_ADRS_OFS) +#define GT_PCI1_CFG_ADRS (GT_BASE+GT_PCI1_CFG_ADRS_OFS) +#define GT_PCI0_CFG_DATA_VIRT (GT_BASE+GT_PCI0_CFG_DATA_VIRT_OFS) +#define GT_PCI1_CFG_DATA_VIRT (GT_BASE+GT_PCI1_CFG_DATA_VIRT_OFS) +#define GT_PCI0_INTR_ACK_VIRT (GT_BASE+GT_PCI0_INTR_ACK_VIRT_OFS) +#define GT_PCI1_INTR_ACK_VIRT (GT_BASE+GT_PCI1_INTR_ACK_VIRT_OFS) + +/* Interrupts */ +#define GT_INTR_CAUSE (GT_BASE+GT_INTR_CAUSE_OFS) +#define GT_H_INTR_CAUSE (GT_BASE+GT_H_INTR_CAUSE_OFS) +#define GT_CPU_INTR_MASK (GT_BASE+GT_CPU_INTR_MASK_OFS) +#define GT_CPU_H_INTR_MASK (GT_BASE+GT_CPU_H_INTR_MASK_OFS) +#define GT_PCI0_INTR_CAUSE_MASK (GT_BASE+GT_PCI0_INTR_CAUSE_MASK_OFS) +#define GT_PCI0_H_INTR_CAUSE_MASK (GT_BASE+GT_PCI0_H_INTR_CAUSE_MASK_OFS) +#define GT_PCI0_SERR0_MASK (GT_BASE+GT_PCI0_SERR0_MASK_OFS) +#define GT_PCI1_SERR1_MASK (GT_BASE+GT_PCI1_SERR1_MASK_OFS) +#define GT_CPU_SELECT_CAUSE (GT_BASE+GT_CPU_SELECT_CAUSE_OFS) +#define GT_PCI0_INTR_SELECT (GT_BASE+GT_PCI0_INTR_SELECT_OFS) + +/* + * I2O Support Registers + * + * "I20 registers can be accessed from the CPU and PCI_0 sides (unless + * stated otherwise). If accessed from the PCI_0 side, address offset is + * with respect to the PCI_0 SCS[1:0]* Base Address Register contents. + * If accessed from the CPU side, the address offset is with respect to + * the CPU Internal Space Base Register + 0x1c00" + * -- GT64120A Data Sheet Revision 1.0 p. 171 + */ + +#define GT_I2O_CPU_BASE_OFS 0x1c00 + +#define GT_INBOUND_MESSAGE_0 (GT_BASE+GT_I2O_CPU_BASE_OFS+GT_INBOUND_MESSAGE_0_OFS) +#define GT_INBOUND_MESSAGE_1 (GT_BASE+GT_I2O_CPU_BASE_OFS+GT_INBOUND_MESSAGE_1_OFS) +#define GT_OUTBOUND_MESSAGE_0 (GT_BASE+GT_I2O_CPU_BASE_OFS+GT_OUTBOUND_MESSAGE_0_OFS) +#define GT_OUTBOUND_MESSAGE_1 (GT_BASE+GT_I2O_CPU_BASE_OFS+GT_OUTBOUND_MESSAGE_1_OFS) +#define GT_INBOUND_DOORBELL (GT_BASE+GT_I2O_CPU_BASE_OFS+GT_INBOUND_DOORBELL_OFS) +#define GT_INBOUND_INTR_CAUSE (GT_BASE+GT_I2O_CPU_BASE_OFS+GT_INBOUND_INTR_CAUSE_OFS) +#define GT_INBOUND_INTR_MASK (GT_BASE+GT_I2O_CPU_BASE_OFS+GT_INBOUND_INTR_MASK_OFS) +#define GT_OUTBOUND_DOORBELL (GT_BASE+GT_I2O_CPU_BASE_OFS+GT_OUTBOUND_DOORBELL_OFS) +#define GT_OUTBOUND_INTR_CAUSE (GT_BASE+GT_I2O_CPU_BASE_OFS+GT_OUTBOUND_INTR_CAUSE_OFS) +#define GT_OUTBOUND_INTR_MASK (GT_BASE+GT_I2O_CPU_BASE_OFS+GT_OUTBOUND_INTR_MASK_OFS) +#define GT_INBOUND_QUEUE_PORT_VIRT (GT_BASE+GT_I2O_CPU_BASE_OFS+GT_INBOUND_QUEUE_PORT_VIRT_OFS) +#define GT_OUTBOUND_QUEUE_PORT_VIRT (GT_BASE+GT_I2O_CPU_BASE_OFS+GT_OUTBOUND_QUEUE_PORT_VIRT_OFS) +#define GT_QUEUE_CTL (GT_BASE+GT_I2O_CPU_BASE_OFS+GT_QUEUE_CTL_OFS) +#define GT_QUEUE_BASE_ADRS (GT_BASE+GT_I2O_CPU_BASE_OFS+GT_QUEUE_BASE_ADRS_OFS) +#define GT_INBOUND_FREE_HEAD_PTR (GT_BASE+GT_I2O_CPU_BASE_OFS+GT_INBOUND_FREE_HEAD_PTR_OFS) +#define GT_INBOUND_FREE_TAIL_PTR (GT_BASE+GT_I2O_CPU_BASE_OFS+GT_INBOUND_FREE_TAIL_PTR_OFS) +#define GT_INBOUND_POST_HEAD_PTR (GT_BASE+GT_I2O_CPU_BASE_OFS+GT_INBOUND_POST_HEAD_PTR_OFS) +#define GT_INBOUND_POST_TAIL_PTR (GT_BASE+GT_I2O_CPU_BASE_OFS+GT_INBOUND_POST_TAIL_PTR_OFS) +#define GT_OUTBOUND_FREE_HEAD_PTR (GT_BASE+GT_I2O_CPU_BASE_OFS+GT_OUTBOUND_FREE_HEAD_PTR_OFS) +#define GT_OUTBOUND_FREE_TAIL_PTR (GT_BASE+GT_I2O_CPU_BASE_OFS+GT_OUTBOUND_FREE_TAIL_PTR_OFS) +#define GT_OUTBOUND_POST_HEAD_PTR (GT_BASE+GT_I2O_CPU_BASE_OFS+GT_OUTBOUND_POST_HEAD_PTR_OFS) +#define GT_OUTBOUND_POST_TAIL_PTR (GT_BASE+GT_I2O_CPU_BASE_OFS+GT_OUTBOUND_POST_TAIL_PTR_OFS) + +/* +********************************************************************** +* +* Register encodings +* +********************************************************************** +*/ + +/* create a mask of n ones */ + +#ifndef GT_MSK +#define GT_MSK(n) ((1 << (n)) - 1) +#endif + + +/* for CPU Interface Config: GT_CPU_INTF_CFG */ + +#define GT_CACHEOPMAP_SHF 0 +#define GT_CACHEOPMAP_MSK (GT_MSK(9) << GT_CACHEOPMAP_SHF) + +#define GT_CACHEPRES_SHF 9 +#define GT_CACHEPRES_MSK (GT_MSK(1) << GT_CACHEPRES_SHF) +#define GT_CACHEPRES_BIT GT_CACHEPRES_MSK +#define GT_CACHEPRES_GT64012_NOT_PRESENT 0 +#define GT_CACHEPRES_GT64012_PRESENT 1 + +#define GT_WRITEMODE_SHF 11 +#define GT_WRITEMODE_MSK (GT_MSK(1) << GT_WRITEMODE_SHF) +#define GT_WRITEMODE_BIT GT_WRITEMODE_MSK +#define GT_WRITEMODE_PIPELINED 0 +#define GT_WRITEMODE_R4000 1 + +#define GT_ENDIANESS_SHF 12 +#define GT_ENDIANESS_MSK (GT_MSK(1) << GT_ENDIANESS_SHF) +#define GT_ENDIANESS_BIT GT_ENDIANESS_MSK +#define GT_ENDIANESS_BIG 0 +#define GT_ENDIANESS_LITTLE 1 + +#define GT_R5KL2_PRESENT_SHF 14 +#define GT_R5KL2_PRESENT_MSK (GT_MSK(1) << GT_R5KL2_PRESENT_SHF) +#define GT_R5KL2_PRESENT_BIT GT_R5KL2_PRESENT_MSK +#define GT_R5KL2_PRESENT_NOT_PRESENT 0 +#define GT_R5KL2_PRESENT_PRESENT 1 + +#define GT_EXTERNAL_HIT_DELAY_SHF 15 +#define GT_EXTERNAL_HIT_DELAY_MSK (GT_MSK(1) << GT_EXTERNAL_HIT_DELAY_SHF) +#define GT_EXTERNAL_HIT_DELAY_BIT GT_EXTERNAL_HIT_DELAY_MSK +#define GT_EXTERNAL_HIT_DELAY_NON_REGISTERED 0 +#define GT_EXTERNAL_HIT_DELAY_REGISTERED 1 + +#define GT_CPU_WRITE_RATE_SHF 16 +#define GT_CPU_WRITE_RATE_MSK (GT_MSK(1) << GT_CPU_WRITE_RATE_SHF) +#define GT_CPU_WRITE_RATE_BIT GT_CPU_WRITE_RATE_MSK +#define GT_CPU_WRITE_RATE_DXDXDXDX 0 +#define GT_CPU_WRITE_RATE_DDDD 1 + +#define GT_STOP_RETRY_SHF 17 +#define GT_STOP_RETRY_MSK (GT_MSK(1) << GT_STOP_RETRY_SHF) +#define GT_STOP_RETRY_BIT GT_STOP_RETRY_MSK +#define GT_STOP_RETRY_CONTINUE 0 +#define GT_STOP_RETRY_STOP 1 + +#define GT_MULTIGT_SHF 18 +#define GT_MULTIGT_MSK (GT_MSK(1) << GT_MULTIGT_SHF) +#define GT_MULTIGT_BIT GT_MULTIGT_BIT +#define GT_MULTIGT_NOT_SUPPORTED 0 +#define GT_MULTIGT_SUPPORTED 1 + +#define GT_SYSADCVALID_SHF 19 +#define GT_SYSADCVALID_MSK (GT_MSK(1) << GT_SYSADCVALID_SHF) +#define GT_SYSADCVALID_BIT GT_SYSADCVALID_MSK +#define GT_SYSADCVALID_NOT_CONNECTED 0 +#define GT_SYSADCVALID_CONNECTED 1 + +#define GT_PCI0OVERRIDE_SHF 20 +#define GT_PCI0OVERRIDE_MSK (GT_MSK(2) << GT_PCI0OVERRIDE_SHF) +#define GT_PCI0OVERRIDE_NORMAL 0 /* normal address decoding */ +#define GT_PCI0OVERRIDE_1GBYTE 1 /* 1 GB PCI_0 Mem0 space */ +#define GT_PCI0OVERRIDE_2GBYTE 2 /* 2 GB PCI_0 Mem0 space */ + +#define GT_PCI1OVERRIDE_SHF 24 +#define GT_PCI1OVERRIDE_MSK (GT_MSK(2) << GT_PCI1OVERRIDE_SHF) +#define GT_PCI1OVERRIDE_NORMAL 0 /* normal address decoding */ +#define GT_PCI1OVERRIDE_1GBYTE 1 /* 1 GB PCI_1 Mem0 space */ +#define GT_PCI1OVERRIDE_2GBYTE 2 /* 2 GB PCI_1 Mem0 space */ + + +/* + * for Internal Space Decode: GT_INTERNAL_SPACE_DEC + */ + +#define GT_INTERNAL_SPACE_DEC_DEF 0x000000a0 + + +/* for SDRAM Configuration: GT_SDRAM_CFG */ + +#define GT_SDRAM_CFG_REFINTCNT_SHF 0 +#define GT_SDRAM_CFG_REFINTCNT_MSK (GT_MSK(14) << GT_SDRAM_CFG_REFINTCNT_SHF) + +#define GT_SDRAM_CFG_INTERLEAVE_SHF 14 +#define GT_SDRAM_CFG_INTERLEAVE_MSK (GT_MSK(1) << GT_SDRAM_CFG_INTERLEAVE_SHF) +#define GT_SDRAM_CFG_INTERLEAVE_BIT GT_SDRAM_CFG_INTERLEAVE_MSK +#define GT_SDRAM_CFG_INTERLEAVE_ENABLED 0 +#define GT_SDRAM_CFG_INTERLEAVE_DISABLED 1 + +#define GT_SDRAM_CFG_RMW_SHF 15 +#define GT_SDRAM_CFG_RMW_MSK (GT_MSK(1) << GT_SDRAM_CFG_RMW_SHF) +#define GT_SDRAM_CFG_RMW_BIT GT_SDRAM_CFG_RMW_MSK +#define GT_SDRAM_CFG_RMW_DISABLED 0 +#define GT_SDRAM_CFG_RMW_ENABLED 1 + +#define GT_SDRAM_CFG_STAGREF_SHF 16 +#define GT_SDRAM_CFG_STAGREF_MSK (GT_MSK(1) << GT_SDRAM_CFG_STAGREF_SHF) +#define GT_SDRAM_CFG_STAGREF_BIT GT_SDRAM_CFG_STAGREF_MSK +#define GT_SDRAM_CFG_STAGREF_STAGGERED 0 +#define GT_SDRAM_CFG_STAGREF_NON_STAGGERED 1 + +#define GT_SDRAM_CFG_CPUTODRAMERR_SHF 17 +#define GT_SDRAM_CFG_CPUTODRAMERR_MSK (GT_MSK(1) << GT_SDRAM_CFG_CPUTODRAMERR_SHF) +#define GT_SDRAM_CFG_CPUTODRAMERR_BIT GT_SDRAM_CFG_CPUTODRAMERR_MSK +#define GT_SDRAM_CFG_CPUTODRAMERR_GENERATE_ERR 0 +#define GT_SDRAM_CFG_CPUTODRAMERR_ALWAYS_GOOD 1 + +#define GT_SDRAM_CFG_ECCINT_SHF 18 +#define GT_SDRAM_CFG_ECCINT_MSK (GT_MSK(1) << GT_SDRAM_CFG_ECCINT_SHF) +#define GT_SDRAM_CFG_ECCINT_BIT GT_SDRAM_CFG_ECCINT_MSK +#define GT_SDRAM_CFG_ECCINT_2_ERRORS 0 +#define GT_SDRAM_CFG_ECCINT_1_ERROR 1 + +#define GT_SDRAM_CFG_DUPCNTL_SHF 19 +#define GT_SDRAM_CFG_DUPCNTL_MSK (GT_MSK(1) << GT_SDRAM_CFG_DUPCNTL_SHF) +#define GT_SDRAM_CFG_DUPCNTL_BIT GT_SDRAM_CFG_DUPCNTL_MSK + +#define GT_SDRAM_CFG_DUPBA_SHF 20 +#define GT_SDRAM_CFG_DUPBA_MSK (GT_MSK(1) << GT_SDRAM_CFG_DUPBA_SHF) +#define GT_SDRAM_CFG_DUPBA_BIT GT_SDRAM_CFG_DUPBA_MSK +#define GT_SDRAM_CFG_DUPBA_DO_NOT_DUP 0 +#define GT_SDRAM_CFG_DUPBA_DUPLICATE 1 + +#define GT_SDRAM_CFG_DUPEOT0_SHF 21 +#define GT_SDRAM_CFG_DUPEOT0_MSK (GT_MSK(1) << GT_SDRAM_CFG_DUPEOT0_SHF) +#define GT_SDRAM_CFG_DUPEOT0_BIT GT_SDRAM_CFG_DUPEOT0_MSK +#define GT_SDRAM_CFG_DUPEOT0_DO_NOT_DUP 0 +#define GT_SDRAM_CFG_DUPEOT0_DUPLICATE 1 + +#define GT_SDRAM_CFG_DUPEOT1_SHF 22 +#define GT_SDRAM_CFG_DUPEOT1_MSK (GT_MSK(1) << GT_SDRAM_CFG_DUPEOT1_SHF) +#define GT_SDRAM_CFG_DUPEOT1_BIT GT_SDRAM_CFG_DUPEOT1_MSK +#define GT_SDRAM_CFG_DUPEOT1_DO_NOT_DUP 0 +#define GT_SDRAM_CFG_DUPEOT1_DUPLICATE 1 + +#define GT_SDRAM_CFG_REGSDRAM_SHF 23 +#define GT_SDRAM_CFG_REGSDRAM_MSK (GT_MSK(1) << GT_SDRAM_CFG_REGSDRAM_SHF) +#define GT_SDRAM_CFG_REGSDRAM_BIT GT_SDRAM_CFG_REGSDRAM_MSK +#define GT_SDRAM_CFG_REGSDRAM_DISABLE 0 +#define GT_SDRAM_CFG_REGSDRAM_ENABLE 1 + +#define GT_SDRAM_CFG_DADR12_SHF 24 +#define GT_SDRAM_CFG_DADR12_MSK (GT_MSK(1) << GT_SDRAM_CFG_DADR12_SHF) +#define GT_SDRAM_CFG_DADR12_BIT GT_SDRAM_CFG_DADR12_MSK +#define GT_SDRAM_CFG_DADR12_ADP0 0 +#define GT_SDRAM_CFG_DADR12_DMAREQ3 0 + + +/* for SDRAM Operation Mode: GT_SDRAM_OP_MODE */ + +#define GT_SDRAM_OPMODE_OP_SHF 0 +#define GT_SDRAM_OPMODE_OP_MSK (GT_MSK(3) << GT_SDRAM_OPMODE_OP_SHF) +#define GT_SDRAM_OPMODE_OP_NORMAL 0 /* Normal SDRAM mode */ +#define GT_SDRAM_OPMODE_OP_NOP 1 /* NOP Command */ +#define GT_SDRAM_OPMODE_OP_ABPC 2 /* All banks precharge cmd */ +#define GT_SDRAM_OPMODE_OP_MRCE 3 /* Mode Register Cmd enable */ +#define GT_SDRAM_OPMODE_OP_CBRCE 4 /* CBR cycle enable */ + + +/* for SDRAM Burst Mode: GT_SDRAM_BURST_MODE */ + +#define GT_SDRAM_BURST_MODE_MBO 0xFFB /* reserved bits, must be 1 */ +#define GT_BURST_ORDER_SHF 2 +#define GT_BURST_ORDER_MSK (GT_MSK(1) << GT_BURST_ORDER_SHF) +#define GT_BURST_ORDER_BIT GT_BURST_ORDER_MSK +#define GT_BURST_ORDER_SUBBLOCK 1 +#define GT_BURST_ORDER_LINEAR 0 + + +/* for SDRAM Address Decode: GT_SDRAM_ADRS_DEC */ + +#define GT_ADDRDECODE_DEF 0x2 /* default value */ + + +/* for SDRAM Bank 0/1/2/3 Parameters: GT_SDRAM_BANK*_PARAM */ + +#define GT_SDRAM_B0_CASLAT_SHF 0 +#define GT_SDRAM_B0_CASLAT_MSK (GT_MSK(2) << GT_SDRAM_B0_CASLAT_SHF) +#define GT_SDRAM_B0_CASLAT_2 1 +#define GT_SDRAM_B0_CASLAT_3 2 + +#define GT_SDRAM_B0_FLOWTHROUGH_SHF 2 +#define GT_SDRAM_B0_FLOWTHROUGH_MSK (GT_MSK(1) << GT_SDRAM_B0_FLOWTHROUGH_SHF) +#define GT_SDRAM_B0_FLOWTHROUGH_BIT GT_SDRAM_B0_FLOWTHROUGH_MSK +#define GT_SDRAM_B0_FLOWTHROUGH_1_SAMPLE 0 +#define GT_SDRAM_B0_FLOWTHROUGH_NO_SAMPLE 1 + +#define GT_SDRAM_B0_SRASPRCHG_SHF 3 +#define GT_SDRAM_B0_SRASPRCHG_MSK (GT_MSK(1) << GT_SDRAM_B0_SRASPRCHG_SHF) +#define GT_SDRAM_B0_SRASPRCHG_2 0 +#define GT_SDRAM_B0_SRASPRCHG_3 1 + +#define GT_SDRAM_B0_COMPATIBLE_SHF 4 /* for GT64120A's predecessor */ +#define GT_SDRAM_B0_COMPATIBLE_MSK (GT_MSK(1) << GT_SDRAM_B0_COMPATIBLE_SHF) +#define GT_SDRAM_B0_COMPATIBLE_BIT GT_SDRAM_B0_COMPATIBLE_MSK +#define GT_SDRAM_B0_COMPATIBLE_B1 0 +#define GT_SDRAM_B0_COMPATIBLE_B0 1 + +#define GT_SDRAM_B0_64BITINT_SHF 5 +#define GT_SDRAM_B0_64BITINT_MSK (GT_MSK(1) << GT_SDRAM_B0_64BITINT_SHF) +#define GT_SDRAM_B0_64BITINT_BIT GT_SDRAM_B0_64BITINT_MSK +#define GT_SDRAM_B0_64BITINT_2 0 +#define GT_SDRAM_B0_64BITINT_4 1 + +#define GT_SDRAM_B0_BANKWIDTH_SHF 6 +#define GT_SDRAM_B0_BANKWIDTH_MSK (GT_MSK(1) << GT_SDRAM_B0_BANKWIDTH_SHF) +#define GT_SDRAM_B0_BANKWIDTH_BIT GT_SDRAM_B0_BANKWIDTH_MSK +#define GT_SDRAM_B0_BANKWIDTH_32 0 +#define GT_SDRAM_B0_BANKWIDTH_64 1 + +#define GT_SDRAM_B0_BANKLOC_SHF 7 +#define GT_SDRAM_B0_BANKLOC_MSK (GT_MSK(1) << GT_SDRAM_B0_BANKLOC_SHF) +#define GT_SDRAM_B0_BANKLOC_BIT GT_SDRAM_B0_BANKLOC_MSK +#define GT_SDRAM_B0_BANKLOC_EVEN 0 +#define GT_SDRAM_B0_BANKLOC_ODD 1 + +#define GT_SDRAM_B0_ECC_SHF 8 +#define GT_SDRAM_B0_ECC_MSK (GT_MSK(1) << GT_SDRAM_B0_ECC_SHF) +#define GT_SDRAM_B0_ECC_BIT GT_SDRAM_B0_ECC_MSK +#define GT_SDRAM_B0_ECC_NOT_SUPPORTED 0 +#define GT_SDRAM_B0_ECC_SUPPORTED 1 + +#define GT_SDRAM_B0_BYPASS_SHF 9 +#define GT_SDRAM_B0_BYPASS_MSK (GT_MSK(1) << GT_SDRAM_B0_BYPASS_SHF) +#define GT_SDRAM_B0_BYPASS_BIT GT_SDRAM_B0_BYPASS_MSK +#define GT_SDRAM_B0_BYPASS_NO_BYPASS 0 +#define GT_SDRAM_B0_BYPASS_BYPASS 1 + +#define GT_SDRAM_B0_SRASTOSCAS_SHF 10 +#define GT_SDRAM_B0_SRASTOSCAS_MSK (GT_MSK(1) << GT_SDRAM_B0_SRASTOSCAS_SHF) +#define GT_SDRAM_B0_SRASTOSCAS_BIT GT_SDRAM_B0_SRASTOSCAS_MSK +#define GT_SDRAM_B0_SRASTOSCAS_2 0 +#define GT_SDRAM_B0_SRASTOSCAS_3 1 + +#define GT_SDRAM_B0_SDRAMSIZE0_SHF 11 +#define GT_SDRAM_B0_SDRAMSIZE0_MSK (GT_MSK(1) << GT_SDRAM_B0_SDRAMSIZE0_SHF) +#define GT_SDRAM_B0_SDRAMSIZE0_BIT GT_SDRAM_B0_SDRAMSIZE0_MSK +#define GT_SDRAM_B0_SDRAMSIZE0_16M 0 +#define GT_SDRAM_B0_SDRAMSIZE0_64M 1 +#define GT_SDRAM_B0_SDRAMSIZE0_128M 1 +#define GT_SDRAM_B0_SDRAMSIZE0_256M 1 + +#define GT_SDRAM_B0_EXTPARITY_SHF 12 +#define GT_SDRAM_B0_EXTPARITY_MSK (GT_MSK(1) << GT_SDRAM_B0_EXTPARITY_SHF) +#define GT_SDRAM_B0_EXTPARITY_BIT GT_SDRAM_B0_EXTPARITY_MSK +#define GT_SDRAM_B0_EXTPARITY_NO_GEN 0 +#define GT_SDRAM_B0_EXTPARITY_GEN 1 + +#define GT_SDRAM_B0_BRSTLEN_SHF 13 +#define GT_SDRAM_B0_BRSTLEN_MSK (GT_MSK(1) << GT_SDRAM_B0_BRSTLEN_SHF) +#define GT_SDRAM_B0_BRSTLEN_BIT GT_SDRAM_B0_BRSTLEN_MSK +#define GT_SDRAM_B0_BRSTLEN_8 0 +#define GT_SDRAM_B0_BRSTLEN_4 1 + +#define GT_SDRAM_B0_SDRAMSIZE1_SHF 14 +#define GT_SDRAM_B0_SDRAMSIZE1_MSK (GT_MSK(1) << GT_SDRAM_B0_SDRAMSIZE1_SHF) +#define GT_SDRAM_B0_SDRAMSIZE1_BIT GT_SDRAM_B0_SDRAMSIZE1_MSK +#define GT_SDRAM_B0_SDRAMSIZE1_16M 0 +#define GT_SDRAM_B0_SDRAMSIZE1_64M 0 +#define GT_SDRAM_B0_SDRAMSIZE1_128M 0 +#define GT_SDRAM_B0_SDRAMSIZE1_256M 1 + + +/* for Device Bank 0/1/2/3 Parameters: GT_DEV_BANK*_PARAM_OFS */ + +#define GT_DEV_BANK_TURNOFF_SHF 0 +#define GT_DEV_BANK_TURNOFF_MSK (GT_MSK(3) << GT_DEV_BANK_TURNOFF_SHF) + +#define GT_DEV_BANK_ACCTOFIRST_SHF 3 +#define GT_DEV_BANK_ACCTOFIRST_MSK (GT_MSK(4) << GT_DEV_BANK_ACCTOFIRST_SHF) + +#define GT_DEV_BANK_ACCTONEXT_SHF 7 +#define GT_DEV_BANK_ACCTONEXT_MSK (GT_MSK(4) << GT_DEV_BANK_ACCTONEXT_SHF) + +#define GT_DEV_BANK_ALETOWR_SHF 11 +#define GT_DEV_BANK_ALETOWR_MSK (GT_MSK(3) << GT_DEV_BANK_ALETOWR_SHF) + +#define GT_DEV_BANK_WRACTIVE_SHF 14 +#define GT_DEV_BANK_WRACTIVE_MSK (GT_MSK(3) << GT_DEV_BANK_WRACTIVE_SHF) + +#define GT_DEV_BANK_WRHIGH_SHF 17 +#define GT_DEV_BANK_WRHIGH_MSK (GT_MSK(3) << GT_DEV_BANK_WRHIGH_SHF) + +#define GT_DEV_BANK_DEVWIDTH_SHF 20 +#define GT_DEV_BANK_DEVWIDTH_MSK (GT_MSK(2) << GT_DEV_BANK_DEVWIDTH_SHF) +#define GT_DEV_BANK_DEVWIDTH_8 0 +#define GT_DEV_BANK_DEVWIDTH_16 1 +#define GT_DEV_BANK_DEVWIDTH_32 2 +#define GT_DEV_BANK_DEVWIDTH_64 3 + +#define GT_DEV_BANK_DMAFLYBY0_SHF 22 +#define GT_DEV_BANK_DMAFLYBY0_MSK (GT_MSK(1) << GT_DEV_BANK_DMAFLYBY0_SHF) +#define GT_DEV_BANK_DMAFLYBY0_BIT GT_DEV_BANK_DMAFLYBY_MSK + +#define GT_DEV_BANK_DEVLOC_SHF 23 +#define GT_DEV_BANK_DEVLOC_MSK (GT_MSK(1) << GT_DEV_BANK_DEVLOC_SHF) +#define GT_DEV_BANK_DEVLOC_BIT GT_DEV_BANK_DEVLOC_MSK +#define GT_DEV_BANK_DEVLOC_EVEN 0 +#define GT_DEV_BANK_DEVLOC_ODD 1 + +#define GT_DEV_BANK_DMAFLYBY1_SHF 26 +#define GT_DEV_BANK_DMAFLYBY1_MSK (GT_MSK(4) << GT_DEV_BANK_DMAFLYBY1_SHF) + + +/* for PCI Command: PCI_0_COMMAND, PCI_1_COMMAND */ + +#define GT_MBYTESWAP_SHF 0 +#define GT_MBYTESWAP_MSK (GT_MSK(1) << GT_MBYTESWAP_SHF) +#define GT_MBYTESWAP_BIT GT_MBYTESWAP_MSK +#define GT_MBYTESWAP_SWAP 0 +#define GT_MBYTESWAP_DONT_SWAP 1 + +#define GT_SYNCMODE_SHF 1 +#define GT_SYNCMODE_MSK (GT_MSK(3) << GT_SYNCMODE_SHF) +#define GT_SYNCMODE_BIT GT_SYNCMODE_MSK +#define GT_SYNCMODE_DC_TO_66 0 +#define GT_SYNCMODE_P_GE_HALF_T 1 +#define GT_SYNCMODE_SYNC_P_GE_HALF_T 2 +#define GT_SYNCMODE_P_GE_THIRD_T 5 +#define GT_SYNCMODE_SYNC_P_GE_THIRD_T 6 + +#define GT_MWORDSWAP_SHF 10 +#define GT_MWORDSWAP_MSK (GT_MSK(1) << GT_MWORDSWAP_SHF) +#define GT_MWORDSWAP_BIT GT_MWORDSWAP_MSK +#define GT_MWORDSWAP_SWAP 1 +#define GT_MWORDSWAP_DONT_SWAP 0 + +#define GT_SWORDSWAP_SHF 11 +#define GT_SWORDSWAP_MSK (GT_MSK(1) << GT_SWORDSWAP_SHF) +#define GT_SWORDSWAP_BIT GT_SWORDSWAP_MSK +#define GT_SWORDSWAP_SWAP 1 +#define GT_SWORDSWAP_DONT_SWAP 0 + +#define GT_SSBWORDSWAP_SHF 12 +#define GT_SSBWORDSWAP_MSK (GT_MSK(1) << GT_SSBWORDSWAP_SHF) +#define GT_SSBWORDSWAP_BIT GT_SSBWORDSWAP_MSK +#define GT_SSBWORDSWAP_SWAP 1 +#define GT_SSBWORDSWAP_DONT_SWAP 0 + +#define GT_SBYTESWAP_SHF 16 +#define GT_SBYTESWAP_MSK (GT_MSK(1) << GT_SBYTESWAP_SHF) +#define GT_SBYTESWAP_BIT GT_SBYTESWAP_MSK +#define GT_SBYTESWAP_SWAP 0 +#define GT_SBYTESWAP_DONT_SWAP 1 + + +/* for PCI Timeout & Retry: GT_PCI0_TIMEOUT_RETRY, GT_PCI1_TIMEOUT_RETRY */ + +#define GT_TIMEOUT0_SHF 0 +#define GT_TIMEOUT0_MSK (GT_MSK(8) << GT_TIMEOUT0_SHF) +#define GT_TIMEOUT0_MAX GT_TIMEOUT0_MSK +#define GT_TIMEOUT0_DEF 0x0f + +#define GT_TIMEOUT1_SHF 8 +#define GT_TIMEOUT1_MSK (GT_MSK(8) << GT_TIMEOUT1_SHF) +#define GT_TIMEOUT1_MAX GT_TIMEOUT1_MSK +#define GT_TIMEOUT1_DEF 0x07 + +#define GT_RETRYCTR_SHF 16 +#define GT_RETRYCTR_MSK (GT_MSK(8) << GT_RETRYCTR_SHF) +#define GT_RETRYCTR_MAX GT_RETRYCTR_MSK +#define GT_RETRYCTR_RETRY_FOREVER 0 +#define GT_RETRYCTR_DEF GT_RETRYCTR_RETRY_FOREVER + +#define GT_TIMEOUT_MAX (GT_TIMEOUT0_MAX | GT_TIMEOUT1_MAX | GT_RETRYCTR_MAX) + + +/* for PCI configuration cycles: GT_PCI0_CFG_ADRS, GT_PCI1_CFG_ADRS */ + +#define GT_CONFIGEN_SHF 31 +#define GT_CONFIGEN_MSK (GT_MSK(1) << GT_CONFIGEN_SHF) +#define GT_CONFIGEN_BIT GT_CONFIGEN_MSK + +#define GT_BUSNUM_SHF 16 +#define GT_BUSNUM_MSK (GT_MSK(8) << GT_BUSNUM_SHF) + +#define GT_DEVNUM_SHF 11 +#define GT_DEVNUM_MSK (GT_MSK(5) << GT_DEVNUM_SHF) + +#define GT_FUNCNUM_SHF 8 +#define GT_FUNCNUM_MSK (GT_MSK(3) << GT_FUNCNUM_SHF) + +#define GT_REGNUM_SHF 2 +#define GT_REGNUM_MSK (GT_MSK(6) << GT_REGNUM_SHF) + + +/* + * for Interrupt Cause & Mask: GT_INTR_CAUSE, GT_CPU_INTR_MASK, + * GT_PCI0_INTR_CAUSE_MASK + * + * (1) can also be used for High Interrupt Cause & Mask: GT_H_INTR_CAUSE, + * GT_CPU_H_INTR_MASK, GT_PCI0_H_INTR_CAUSE_MASK + */ + +#define GT_INTR_INTSUM 0x00000001 +#define GT_INTR_MEMOUT 0x00000002 +#define GT_INTR_DMAOUT 0x00000004 +#define GT_INTR_CPUOUT 0x00000008 +#define GT_INTR_DMA0COMP 0x00000010 +#define GT_INTR_DMA1COMP 0x00000020 +#define GT_INTR_DMA2COMP 0x00000040 +#define GT_INTR_DMA3COMP 0x00000080 +#define GT_INTR_T0EXP 0x00000100 +#define GT_INTR_T1EXP 0x00000200 +#define GT_INTR_T2EXP 0x00000400 +#define GT_INTR_T3EXP 0x00000800 +#define GT_INTR_MASRDERR 0x00001000 /* (1) */ +#define GT_INTR_SLVWRERR 0x00002000 /* (1) */ +#define GT_INTR_MASWRERR 0x00004000 /* (1) */ +#define GT_INTR_SLVRDERR 0x00008000 /* (1) */ +#define GT_INTR_ADDRERR 0x00010000 /* (1) */ +#define GT_INTR_MEMERR 0x00020000 +#define GT_INTR_MASABORT 0x00040000 /* (1) */ +#define GT_INTR_TARABORT 0x00080000 /* (1) */ +#define GT_INTR_RETRYCTR 0x00100000 /* (1) */ +#define GT_INTR_PMCINT 0x00200000 /* (1) */ + +#define GT_INTR_CPUINT_SHF 22 +#define GT_INTR_CPUINT_MSK (GT_MSK(4) << GT_CPUINT_SHF) + +#define GT_INTR_PCIINT_SHF 26 +#define GT_INTR_PCIINT_MSK (GT_MSK(4) << GT_PCIINT_SHF) + +#define GT_INTR_CPUINTSUM 0x40000000 +#define GT_INTR_PCIINTSUM 0x80000000 + + +/* for SErr0/1* Mask, PCI_0/1 Events: GT_PCI0_SERR0_MASK, GT_PC1_SERR1_MASK */ + +#define GT_SERR_ADDRERR 0x00000001 +#define GT_SERR_MASWRERR 0x00000002 +#define GT_SERR_MASRDERR 0x00000004 +#define GT_SERR_MEMERR 0x00000008 +#define GT_SERR_MASABORT 0x00000010 +#define GT_SERR_TARABORT 0x00000020 + + +/* Miscellenous */ + +#define GT_BANKSIZE_MAX (256 * 1024 * 1024) /* Max 256MB bank */ + +/* GT Internal register data must be swapped when CPU is in big-endian mode */ + +#if (_BYTE_ORDER == _BIG_ENDIAN) +#define GT_SWAP(x) LONGSWAP(x) +#else /* _BYTE_ORDER == _LITTLE_ENDIAN */ +#define GT_SWAP(x) (x) +#endif /* _BYTE_ORDER */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCgt64120ah */ diff --git a/h/drv/multi/i534.h b/h/drv/multi/i534.h new file mode 100644 index 0000000..10b564c --- /dev/null +++ b/h/drv/multi/i534.h @@ -0,0 +1,160 @@ +/* i534.h - Header file for the intel 534 serial board. */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01j,22sep92,rrr added support for c++ +01i,26may92,rrr the tree shuffle +01h,04oct91,rrr passed through the ansification filter + -changed copyright notice +01g,05oct90,shl added copyright notice. +01f,08jan87,jlf added ifndef's to keep from being included twice. +01e,23jul84,ecs Brought definition of IO_534 back here from hwConfig.h. +01d,02aug83,dnw Removed I534_BASE, now IO_534 in ioLib.h. + Added PIC poll status definitions. +01c,16may83,jlf Put parens around address definitions. + Coerced I534_BASE to type (char *). +01b,29mar83,jlf Moved Buffer-size parameter to ty534Drv.c +01a,10mar83,jlf written +*/ + +#ifndef __INCi534h +#define __INCi534h + +#ifdef __cplusplus +extern "C" { +#endif + +/* Strapable parameters */ + +#define PIT_CLOCK_RATE 1228800 /* 1.2288 MHz into the PIT */ + +#define N_534_CHANNELS 4 /* Number of serial channels on bd */ + +/* The following addresses can only be accessed with the data block + selected */ + +#define IO_534 ((char *) 0xef0020) /* 0x10 bytes */ +#define I534_U0_D (IO_534) /* UART 0 data */ +#define I534_U0_S (IO_534 + 1) /* UART 0 status and command */ +#define I534_U1_D (IO_534 + 2) /* UART 1 data */ +#define I534_U1_S (IO_534 + 3) /* UART 1 status and command */ +#define I534_U2_D (IO_534 + 4) /* UART 2 data */ +#define I534_U2_S (IO_534 + 5) /* UART 2 status and command */ +#define I534_U3_D (IO_534 + 6) /* UART 3 data */ +#define I534_U3_S (IO_534 + 7) /* UART 3 status and command */ +#define I534_PIC0_B0 (IO_534 + 8) /* 8259, byte 0 - write ICW1, OCW2, */ + /* OCW3, read status */ +#define I534_PIC0_B1 (IO_534 + 9) /* 8259, byte 1 - write ICW2, OCW1, */ + /* read OCW1 */ +#define I534_PIC1_B0 (IO_534 + 0xa) /* Unused 8259, byte 0 */ +#define I534_PIC1_B1 (IO_534 + 0xb) /* Unused 8259, byte 1 */ + +/* The following can only be accessed with the control block selected */ + +#define I534_PIT0_0 (IO_534) /* 8253 PIT 0, counter 0 */ +#define I534_PIT0_1 (IO_534 + 1) /* 8253 PIT 0, counter 1 */ +#define I534_PIT0_2 (IO_534 + 2) /* 8253 PIT 0, counter 2 */ +#define I534_PIT0_C (IO_534 + 3) /* 8253 PIT 0, control */ +#define I534_PIT1_0 (IO_534 + 4) /* 8253 PIT 1, counter 0 */ +#define I534_PIT1_1 (IO_534 + 5) /* 8253 PIT 1, counter 1 */ +#define I534_PIT1_2 (IO_534 + 6) /* 8253 PIT 1, counter 2 */ +#define I534_PIT1_C (IO_534 + 7) /* 8253 PIT 1, control */ +#define I534_PPI_A (IO_534 + 8) /* 8255 PPI, Port A in */ +#define I534_PPI_B (IO_534 + 9) /* PPI, Port B in */ +#define I534_PPI_C (IO_534 + 0xa) /* PPI, Port C out and stat */ +#define I534_PPI_CTL (IO_534 + 0xb) /* PPI control */ + +/* The following can be accessed with either block selected */ + +#define I534_SEL_C (IO_534 + 0xc) /* Select Control Block */ +#define I534_SEL_D (IO_534 + 0xd) /* Select Data Block */ +#define I534_TEST (IO_534 + 0xe) /* Select test mode */ +#define I534_RESET (IO_534 + 0xf) /* Board Reset */ + +/* USART Mode Word bits */ + +#define U_1_STOP 0x40 +#define U_2_STOP 0xc0 +#define U_PARITY_EVEN 0x20 +#define U_PARITY_ENABLE 0x10 +#define U_7_DBITS 0x08 +#define U_8_DBITS 0x0c +#define U_X16 0x02 +#define U_X1 0x01 + +/* USART Command Word bits */ + +#define U_RESET 0x40 /* 1 returns 8251 to mode word */ +#define U_RTS 0x20 /* 1 forces RTS/ output to 0 */ +#define U_ERR_RESET 0x10 /* Reset all error flags */ +#define U_BREAK 0x08 /* 1 forces TxD low */ +#define U_RX_ENABLE 0x04 +#define U_DTR 0x02 /* 1 forces DTR/ output to 0 */ +#define U_TX_ENABLE 0x01 + +/* USART Status Word bits */ + +#define U_DSR 0x80 +#define U_FRAME_ERR 0x20 +#define U_OVE_ERR 0x10 +#define U_PARITY_ERR 0x08 +#define U_TX_EMPTY 0x04 +#define U_RX_READY 0x02 +#define U_TX_READY 0x01 + +/* PIT Mode Word bits */ + +#define PIT_SEL_C_0 0x00 +#define PIT_SEL_C_1 0x40 +#define PIT_SEL_C_2 0x80 +#define PIT_BOTH_BYTES 0x30 +#define PIT_MODE_3 0x06 + +/* PIC ICW1 */ + +#define PIC_ICW1_ID 0x10 /* Must be used to identify ICW1 */ +#define PIC_ADR_7_5 0xe0 /* Mask for bits 7-5 of lower */ + /* routine address */ +#define PIC_INTERVAL_4 0x04 +#define PIC_INTERVAL_8 0x00 +#define PIC_SINGLE 0x02 + +/* PIC OCW2 */ + +#define PIC_ROT_PRI 0x80 /* Rotate priority */ +#define PIC_SEOI 0x60 /* Specific end of interrupt */ +#define PIC_EOI 0x20 /* Non-specific End of int */ + +/* PIC OCW3 */ + +#define PIC_OCW3_ID 0x08 /* Must be set to identify OCW3 */ +#define PIC_SET_SMASK 0x60 /* Set special mask */ +#define PIC_RST_SMASK 0x40 /* Reset special mask */ +#define PIC_POLLING 0x04 +#define PIC_READ_IR 0x02 +#define PIC_READ_IS 0x03 + +/* PIC Poll status */ + +#define PIC_IL_REQUEST 0x80 /* interrupt requesting */ +#define PIC_IL_MASK 0x07 /* interrupt level mask */ +#define PIC_IL_CHAN0 0x00 /* channel 0 interrupt level */ +#define PIC_IL_CHAN1 0x02 /* channel 1 interrupt level */ +#define PIC_IL_CHAN2 0x04 /* channel 2 interrupt level */ +#define PIC_IL_CHAN3 0x06 /* channel 3 interrupt level */ +#define PIC_IL_TX 0x01 /* transmitter buffer empty interrupt */ + +/* Default baud rates for the 4 USARTs. */ + +#define BAUD_0 9600 +#define BAUD_1 9600 +#define BAUD_2 9600 +#define BAUD_3 9600 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCi534h */ diff --git a/h/drv/multi/i82510.h b/h/drv/multi/i82510.h new file mode 100644 index 0000000..c68140b --- /dev/null +++ b/h/drv/multi/i82510.h @@ -0,0 +1,239 @@ +/* i82510.h - Intel 82510 header file */ + +/* +modification history +-------------------- +01e,22sep92,rrr added support for c++ +01d,26may92,rrr the tree shuffle +01c,28oct91,wmd added Intel modifications. +01b,04oct91,rrr passed through the ansification filter + -changed copyright notice +01a,20aug91,del installed. +*/ + +#ifndef __INCi82510h +#define __INCi82510h + +#ifdef __cplusplus +extern "C" { +#endif + +/******************************************************************/ +/* Copyright (c) 1989, Intel Corporation + + Intel hereby grants you permission to copy, modify, and + distribute this software and its documentation. Intel grants + this permission provided that the above copyright notice appears + in all copies and that both the copyright notice and this + permission notice appear in supporting documentation. In + addition, Intel grants this permission provided that you + prominently mark as not part of the original any modifications + made to this software or documentation, and that the name of + Intel Corporation not be used in advertising or publicity + pertaining to distribution of the software or the documentation + without specific, written prior permission. + + Intel Corporation does not warrant, guarantee or make any + representations regarding the use of, or the results of the use + of, the software and documentation in terms of correctness, + accuracy, reliability, currentness, or otherwise; and you rely + on the software, documentation and results solely at your own + risk. */ +/******************************************************************/ + +/* #if 0 */ +typedef volatile struct + { + unsigned char data; /* TxD(write)/RxD(read) (BAL when LCR Bit 7 == 1) */ + unsigned char ger; /* General Enable Register (BAH when LCR Bit 7 == 1) */ + unsigned char gir; /* General Interrupt/Bank Register */ + unsigned char lcr; /* Line Configure Register */ + unsigned char mcr; /* Modem Control Register */ + unsigned char lsr; /* Line Status Register */ + unsigned char msr; /* Modem/I/O Pins Status Register */ + unsigned char acr0; /* Address/Control Character Register 0 */ + } I82510_REGS; /* 8250A Compatible Registers (NAS), BANK 0 */ + +typedef volatile struct + { + unsigned char data; /* TxD(write)/RxD(read) */ + unsigned char rxf; /* Received Char(read)/Transmit(write) Flags Register */ + unsigned char gir; /* General Interrupt/Bank Register */ + unsigned char tmst; /* Timer Status Register */ + unsigned char flr; /* Fifo Level Register */ + unsigned char rst; /* Receive Mach. Stat.(read)/Recieve Cmd(write) Reg */ + unsigned char tcm; /* Same as msr(read)/Transmit Command(write) Register */ + unsigned char gsr; /* General Status(read)/Internal Command(write) Reg */ + } I82510_WORK; /* General Work, Bank 1 */ + +typedef volatile struct + { + unsigned char dum; /* unused */ + unsigned char fmd; /* Fifo Mode Register */ + unsigned char gir; /* General Interrupt/Bank Register */ + unsigned char tmd; /* Transmit Machine Mode Register */ + unsigned char imd; /* Internal Mode Register */ + unsigned char acr1; /* Address/Control Character Register 1 */ + unsigned char rie; /* Receive Interrupt Enable Register */ + unsigned char rmd; /* Receive Machine Mode Register */ + } I82510_GENERAL; /* General Configuration, Bank 2 */ + +typedef volatile struct + { + unsigned char clcf; /* Clocks Configure Register (BBL when LCR bit 7 == 1)*/ + unsigned char bacf; /* Baud Rate Genrator A Configuration Register (BBH) */ + unsigned char gir; /* General Interrupt/Bank Register */ + unsigned char bbcf; /* Baud Rate Genrator B Configuration Register */ + unsigned char pmd; /* I/O Pin Mode Register */ + unsigned char mie; /* Modem Interrupt Enable Register */ + unsigned char tmie; /* Timers/Interrupt Enable Register */ + unsigned char dum; /* unused */ + } I82510_MODEM; /* Modem Configuration, Bank 3 */ +/*#endif*/ + +/* register offsets from base address of 82510 in memory */ + +#define TXD 0 +#define RXD 0 +#define BAL 0 +#define BAH 1 +#define GER 1 +#define GIR 2 +#define BANK 2 +#define LCR 3 +#define MCR 4 +#define LSR 5 +#define MSR 6 +#define ACR0 7 + +#define RXF 1 +#define TXF 1 +#define TMST 3 +#define TMCR 3 +#define FLR 4 +#define RST 5 +#define RCM 5 +#define TCM 6 +#define GSR 7 +#define ICM 7 + +#define FMD 1 +#define TMD 3 +#define IMD 4 +#define ACR1 5 +#define RIE 6 +#define RMD 7 + +#define CLCF 0 +#define BBL 0 +#define BACF 1 +#define BBH 1 +#define BBCF 3 +#define PMD 4 +#define MIE 5 +#define TMIE 6 + +/* bit definitions */ + +/* GER, general enable register */ +/* GSR, general status register, same bits as GER */ + +#define TIMER_BIT 0x20 +#define Tx_BIT 0x10 +#define MODEM_BIT 0x08 +#define Rx_BIT 0x04 +#define TxFIFO_BIT 0x02 +#define RxFIFO_BIT 0x01 + +/* GIR, general interrupt register/bank register + +/* bank select bits, R/W */ +#define NAS0 0 +#define WORK1 0x20 +#define GEN2 0x40 +#define MODM3 0x60 + +#define GIR_IP 0x01 /* interrupt pending bit, active low */ +#define GIR_IMASK 0x0e /* mask for interrupt vector */ +#define TIMER_INT 0x0A /* highest priority */ +#define Tx_INT 0x08 +#define Rx_INT 0x06 +#define RxFIFO_INT 0x04 +#define TxFIFO_INT 0x02 +#define MODEM_INT 0x00 /* lowest priority */ + +/* LSR, line status register, shares 5 lsb's with RST */ + +#define RxBREAK_DETECT 0x10 +#define RxFRAMING_ERR 0x08 +#define RxPARITY_ERR 0x04 +#define RxOVERRUN_ERR 0x02 +#define RxCHAR_AVAIL 0x01 +#define Rx_ERR_RESET (RxBREAK_DETECT|RxFRAMING_ERR|RxPARITY_ERR|RxOVERRUN_ERR) + +/* ICM, Internal Command Register */ + +#define SOFT_RESET 0x10 + +/* LCR, Line Configure Register */ + +#define DLAB 0x80 /* divisor latch bit */ +#define SET_BREAK 0x40 /* set break bit */ +#define PM2 0x20 /* parity mode bit 2 */ +#define PM1 0x10 /* parity mode bit 1 */ +#define PM0 0x08 /* parity mode bit 0 */ +#define STOP_BIT_LEN_0 0x04 /* stop bit lenght bit 0, with SBL1/2 in TMD */ +#define CL1 0x02 /* character lenght bit 1, with NBCL in TMD */ +#define CL0 0x01 /* character lenght bit 0, with NBCL in TMD */ + +#define PARITY_NONE 0 /* parity is for farmers */ +#define PARITY_ODD PM0 /* odd parity */ +#define PARITY_EVEN (PM0|PM1) /* even parity, SPF in TMD reg must be 0 */ +#define PARITY_HIGH (PM0|PM2) /* high parity, SPF in TMD reg must be 0 */ +#define PARITY_LOW (PM0|PM1|PM2)/* low parity, SPF in TMD reg must be 0 */ +#define PARITY_SOFT PM0 /* software parity, SPF in TMD reg must be 1 */ + +#define CHAR_LEN_5 0 /* 5 bit characters, NBCL in TMD must be 0 */ +#define CHAR_LEN_6 CL0 /* 6 bit characters, NBCL in TMD must be 0 */ +#define CHAR_LEN_7 CL1 /* 7 bit characters, NBCL in TMD must be 0 */ +#define CHAR_LEN_8 (CL0|CL1)/* 8 bit characters, NBCL in TMD must be 0 */ +#define CHAR_LEN_9 0 /* 9 bit characters, NBCL in TMD must be 1 */ + +/* MCR, Modem/I/O Pins Control Register */ + +#define DTR 0x01 + +/* MSR, Modem status register */ + +#define MSR_BITS 0x3 + +/* CLCF, Clock Configuration Register */ + +#define RxCLOCK_1X 0x80 /* 0 = 16X, 1 = 1X */ +#define RxCLK_SRC_BRGA 0x40 /* 0 = BRGB, 1 = BRGA */ +#define TxCLOCK_1X 0x20 /* 0 = 16X, 1 = 1X */ +#define TxCLK_SRC_BRGA 0x10 /* 0 = BRGB, 1 = BRGA */ + +/* BAL/BBL */ + +#define BAUD_LO(baud) ((XTAL/(32*baud)) & 0xff) + +/* BAH/BBH */ +#define BAUD_HI(baud) (((XTAL/(32*baud)) & 0xff00) >> 8) + +/* set baud rate for the 18.432 Mhz Clock */ + +#define BAUD_38400 16 /* XTAL/(32*BAUD) gives 15 (like manaul says) */ +#define BAUD_19200 32 /* 30 */ +#define BAUD_9600 64 /* 60 */ +#define BAUD_4800 128 /* 120 */ +#define BAUD_2400 256 /* 240 */ +#define BAUD_1200 512 /* 480, so don't use these... */ + +#define XTAL 18432000 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCi82510h */ diff --git a/h/drv/multi/ivic.h b/h/drv/multi/ivic.h new file mode 100644 index 0000000..bc14a2b --- /dev/null +++ b/h/drv/multi/ivic.h @@ -0,0 +1,423 @@ +/* ivic.h - Ironics/VTCs VME Interface Chip (VIC) constants */ + +/* +modification history +-------------------- +02d,22sep92,rrr added support for c++ +02c,26may92,rrr the tree shuffle +02b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +02a,31jan91,rjt initial release to windriver after many minor + fixes and alterations. +01a,25jul90,rjt writen by modifying IV-SPRC sparcmon versions. +*/ + +#ifndef __INCivich +#define __INCivich + +#ifdef __cplusplus +extern "C" { +#endif + +/*=========================================================================*/ +/* */ +/* NOTE: */ +/* assembly language files should turn off type declartions by not */ +/* including those portions of this include file, this is done by */ +/* placing a */ +/* */ +/* #define _ASMLANGUAGE */ +/* */ +/* statement before this file is included in any other files */ +/* */ +/* Also in order to incorparate stronger typing of all constants, and to */ +/* allow the same constants to be typed in C files,yet usable in */ +/* assembly files. An unorthadox method of TYPING is used by CONDITIONALLY */ +/* #define'ing the constant TYPES. If no _ASMLANGUAGE #define is present, */ +/* then the type is defined to a blank space, otherwise it is defined */ +/* to be a C type. This looks weird but works nicely. */ +/* */ +/*=========================================================================*/ + + +/*=========================================================================* + +Naming of register names and constants was done ( or was attempted ) so that +the front end of the names would indicate a related group while the tail +end of the names would further define the purpose of the name. Some groups +often contained sub-groups. Also some names don't follow this convention for +the sake of readability and other reasons. + + +An H_ prefix indicates that the constant is typed as a pointer to +unsigned short register. +An B_ prefix indicates that the constant is typed as a pointer to +unsigned char register. + +Because of unpredictability of structure sizing and placement for +different compilers, we use contants to access each register. + +Most constants are defined for consistancy in name AND intended usage. +BIT MANIPUATION is set up so that each bit field has 3 or more defines +associated with it. + +1. BIT VALUE MASK +2. ASSERTED VALUE(S) +3. DEASERTED VALUE + +where ASSERTED VALUE = 0 and dasserted value = 0xff for ACTIVE LOW SIGNALS + OR visa versa +where ASSERTED VALUE = 0xff and dasserted value = 0 for ACTIVE HIGH SIGNALS + +NOTE: The active high bits may also be something other than 0xff for + multi-bit fields. EG: for at 2 bit active high field there may be + 4 asserted values associated with it: 0x00 0x01 0x02 0x03. + + +the bit field should be altered as follows: + +new_reg_value = (old_reg_val & ~MASK) | (MASK & VALUE ) + + +REGISTER BIT STATUS for a bit field has 2 or more defines associated with it. + +1. BIT MASK +2. POSSIBLE BIT VALUE +3. . +4 . + +returned_bit_field_status = MASK & reg_value + +Most constants are declared immediatly after the register they are used in. +Some constants are shared between more than 1 register and are only defined +once after the first register. + + +Some of names used here indicatate the following: + +virqack - interrupt from the completion of vme irq acknowledge cycle +virq - interrupt from vme +virqreq - interrupt to vme +lirq - interrupt from the boards local stuff ie timers, sio etc. +misci - interrupt from error,dma or vmeack +erri - interrupt from error register +dmai - interrupt from dma register +icgsi - interrupt from icgs facilities +icmsi - interrupt from icms facilities + +======================================================================**/ + + +/* IMPORTANT NOTICE: NOT ALL CONSTANTS HAVE BEEN TESTED */ + +/* The following #defines allow or disallow C types */ +#ifndef _ASMLANGUAGE +/* C code type casting */ + +#ifndef P_VI_TYPE +#define P_VI_TYPE (unsigned char *) +#endif +#ifndef VI_TYPE +#define VI_TYPE (unsigned char) +#endif + +#else + +/* No type casting allowed in assembly */ +#define VI_TYPE +#define P_VI_TYPE +#endif /* _ASMLANGUAGE */ + + +#define VIC_ADR 0xfffc0000 + +#define VIC_TYPE unsigned char + +/* IMPORTANT */ +/* Some boards may require a special routine to access the vic registers. */ +/* ( ex: a board whose cache must be bypassed to ensure register integrity ) */ +/* If they do, there should be viXetReg() macros #define'd to call that */ +/* special routine. Otherwise the following viXetReg() macros will be used. */ +/* For portability reasons, it might be a good idea to only use viRegSet() */ +/* to alter any vic registers in C code. */ +/* */ +/* #undef the following macro to replace it if needed */ +#ifndef viRegSet +#define viRegSet(bReg,val) *(bReg) = (VIC_TYPE)(val) +#endif +#ifndef viRegGet +#define viRegGet(bReg) *(bReg) +#endif + + +/* BEGIN REGISTER CONSTANTS */ + +/* VME Intr IACK cntl */ +#define B_VIC_VIRQACK_CTL P_VI_TYPE (VIC_ADR + 0x03) +#define VIRQACK_MASK VI_TYPE 0x80 +#define VIRQACK_ENABLE VI_TYPE 0x0 +#define VIRQACK_DISABLE VI_TYPE 0x80 + +#define VIRQACK_IPL_MASK VI_TYPE 0x07 + +/* VME IRQ handler cntl lev 1-7 */ +#define B_VIC_VIRQ1_CTL P_VI_TYPE (VIC_ADR + 0x07) +#define B_VIC_VIRQ2_CTL P_VI_TYPE (VIC_ADR + 0x0b) +#define B_VIC_VIRQ3_CTL P_VI_TYPE (VIC_ADR + 0x0f) +#define B_VIC_VIRQ4_CTL P_VI_TYPE (VIC_ADR + 0x13) +#define B_VIC_VIRQ5_CTL P_VI_TYPE (VIC_ADR + 0x17) +#define B_VIC_VIRQ6_CTL P_VI_TYPE (VIC_ADR + 0x1b) +#define B_VIC_VIRQ7_CTL P_VI_TYPE (VIC_ADR + 0x1f) + +/* these are used a shift values to access the proper ctl reg */ +#define VIRQ1 VI_TYPE 0x01 +#define VIRQ2 VI_TYPE 0x02 +#define VIRQ3 VI_TYPE 0x03 +#define VIRQ4 VI_TYPE 0x04 +#define VIRQ5 VI_TYPE 0x05 +#define VIRQ6 VI_TYPE 0x06 +#define VIRQ7 VI_TYPE 0x07 + +#define VIRQ_CTL_IPL_MASK VI_TYPE 0x7 + +#define VIRQ_MASK VI_TYPE 0x80 +#define VIRQ_ENABLE VI_TYPE 0x0 +#define VIRQ_DISABLE VI_TYPE 0x80 + + + /* DMA Status Interrupt cntl */ +#define B_VIC_DMAI_CTL P_VI_TYPE (VIC_ADR + 0x23) + +#define DMAI_IPL_MASK 0x7 + +#define DMAI_MASK VI_TYPE 0x80 +#define DMAI_ENABLE VI_TYPE 0x0 +#define DMAI_DISABLE VI_TYPE 0x80 + +/* Local Interrupt cntl lev 1-7 */ +#define B_VIC_LIRQ1_CTL P_VI_TYPE (VIC_ADR + 0x27) +#define B_VIC_LIRQ2_CTL P_VI_TYPE (VIC_ADR + 0x2b) +#define B_VIC_LIRQ3_CTL P_VI_TYPE (VIC_ADR + 0x2f) +#define B_VIC_LIRQ4_CTL P_VI_TYPE (VIC_ADR + 0x33) +#define B_VIC_LIRQ5_CTL P_VI_TYPE (VIC_ADR + 0x37) +#define B_VIC_LIRQ6_CTL P_VI_TYPE (VIC_ADR + 0x3b) +#define B_VIC_LIRQ7_CTL P_VI_TYPE (VIC_ADR + 0x3f) + +/* these are used as shift values to access the proper ctl reg */ +/* these are also used for lirq status */ +#define LIRQ1 VI_TYPE 0x01 +#define LIRQ2 VI_TYPE 0x02 +#define LIRQ3 VI_TYPE 0x03 +#define LIRQ4 VI_TYPE 0x04 +#define LIRQ5 VI_TYPE 0x05 +#define LIRQ6 VI_TYPE 0x06 +#define LIRQ7 VI_TYPE 0x07 + +#define LIRQ_MASK VI_TYPE 0x80 +#define LIRQ_ENABLE VI_TYPE 0x0 +#define LIRQ_DISABLE VI_TYPE 0x80 + +#define SENCE_MASK VI_TYPE 0x70 +#define ACTIVE_MASK VI_TYPE 0x40 +#define LEVEL_MASK VI_TYPE 0x20 +#define VIC_VECTOR_MASK VI_TYPE 0x10 + +#define ACTIVE_HIGH VI_TYPE 0x40 +#define ACTIVE_LOW VI_TYPE 0x00 +#define EDGE_SENSITIVE VI_TYPE 0x20 +#define LEVEL_SENSITIVE VI_TYPE 0x00 +#define VIC_SUP_VECTOR VI_TYPE 0x10 +#define VIC_NO_SUP_VECTOR VI_TYPE 0x00 + +/* mask for state of LIRQ X VIC input signal */ +#define LIRQ_INPUT_SIGNAL_MASK VI_TYPE 0x08 + +#define LIRQ_CTL_IPL_MASK VI_TYPE 0x07 + +#define B_VIC_ICGSI_CTL P_VI_TYPE (VIC_ADR + 0x43) + +#define ICGSI_ENABLE VI_TYPE 0x00 +#define ICGSI_DISABLE VI_TYPE 0xf0 + +/* +These are actually masks which may be or'ed together. + +NOTE: +These are used for shift base values, to access the control +bit in the B_VIC_ICGSI_CTL reg do 0x1 << (ICGSx + 4) +these constants are used for other ICF functions. +*/ + +#define ICGS3 VI_TYPE 0x3 +#define ICGS2 VI_TYPE 0x2 +#define ICGS1 VI_TYPE 0x1 +#define ICGS0 VI_TYPE 0x0 + +#define ICGSI_IPL_MASK VI_TYPE 0x07 + +#define B_VIC_ICMSI_CTL P_VI_TYPE (VIC_ADR + 0x47) + +#define ICMSI_ENABLE VI_TYPE 0x00 +#define ICMSI_DISABLE VI_TYPE 0xf0 + +/* these are actually masks which may be or'ed together */ +#define ICMS3 VI_TYPE 0x3 +#define ICMS2 VI_TYPE 0x2 +#define ICMS1 VI_TYPE 0x1 +#define ICMS0 VI_TYPE 0x0 + +#define ICMSI_IPL_MASK VI_TYPE 0x07 + +#define B_VIC_ERRI_CTL P_VI_TYPE (VIC_ADR + 0x4b) + +#define ERRI_ENABLE VI_TYPE 0x00 +#define ERRI_DISABLE VI_TYPE 0xf0 + +/* these are actually masks which may be or'ed together */ +#define ERRI_SYSFAIL VI_TYPE 0x10 +#define ERRI_ARB_TIMEOUT VI_TYPE 0x20 +#define ERRI_WRITE_POST VI_TYPE 0x40 +#define ERRI_ACFAIL VI_TYPE 0x80 + +#define ERRI_IPL_MASK VI_TYPE 0x07 + +#define B_VIC_ICGSI_VBASE P_VI_TYPE (VIC_ADR + 0x4f) +#define B_VIC_ICGSI_STAT P_VI_TYPE (VIC_ADR + 0x4f) + +#define ICGSI_VBASE_MASK VI_TYPE 0xfc +#define ICGSI_STAT_MASK VI_TYPE 0x03 + +/* defined above but shown here + #define ICGS0 0 + #define ICGS1 1 + #define ICGS2 2 + #define ICGS3 3 +*/ + +#define B_VIC_ICMSI_VBASE P_VI_TYPE (VIC_ADR + 0x53) +#define B_VIC_ICMSI_STAT P_VI_TYPE (VIC_ADR + 0x53) +#define ICMSI_VBASE_MASK VI_TYPE 0xfc +#define ICMSI_STAT_MASK VI_TYPE 0x03 + +/* defined above but shown here + #define ICMS0 0 + #define ICMS1 1 + #define ICMS2 2 + #define ICMS3 3 +*/ + +#define B_VIC_LIRQ_VBASE P_VI_TYPE (VIC_ADR + 0x57) +#define B_VIC_LIRQ_STAT P_VI_TYPE (VIC_ADR + 0x57) + +#define LIRQ_VBASE_MASK VI_TYPE 0xf8 +#define LIRQ_STAT_MASK VI_TYPE 0x07 + + +/* this was B_VIC_ERRI_xxxx */ +#define B_VIC_MISCI_VBASE P_VI_TYPE (VIC_ADR + 0x5b) +#define B_VIC_MISCI_STAT P_VI_TYPE (VIC_ADR + 0x5b) + +#define MISCI_VBASE_MASK VI_TYPE 0xf8 +#define MISCI_STAT_MASK VI_TYPE 0x07 + +#define MISCI_DMA VI_TYPE 0x5 +#define MISCI_VME_IACK VI_TYPE 0x4 +#define MISCI_SYSFAIL VI_TYPE 0x3 +#define MISCI_ARB_TIMEOUT VI_TYPE 0x2 +#define MISCI_WRITE_POST VI_TYPE 0x1 +#define MISCI_ACFAIL VI_TYPE 0x0 + + +#define B_VIC_IPC_SWITCH P_VI_TYPE (VIC_ADR + 0x5f) +/* ICMSX and ICGSX contants above and shift accordingly */ + +#define B_VIC_IPC_REG0 P_VI_TYPE (VIC_ADR + 0x63) +#define B_VIC_IPC_REG1 P_VI_TYPE (VIC_ADR + 0x67) +#define B_VIC_IPC_REG2 P_VI_TYPE (VIC_ADR + 0x6b) +#define B_VIC_IPC_REG3 P_VI_TYPE (VIC_ADR + 0x6f) +#define B_VIC_IPC_REG4 P_VI_TYPE (VIC_ADR + 0x73) +#define B_VIC_IPC_REG5 P_VI_TYPE (VIC_ADR + 0x77) +#define B_VIC_IPC_REG6 P_VI_TYPE (VIC_ADR + 0x7b) +#define B_VIC_IPC_REG7 P_VI_TYPE (VIC_ADR + 0x7f) + +#define B_VIC_VIRQREQ_CTL P_VI_TYPE (VIC_ADR + 0x83) +#define B_VIC_VIRQREQ_STAT P_VI_TYPE (VIC_ADR + 0x83) + +#define VIRQREQ_MASK VI_TYPE 0x01 +#define VIRQREQ_ENABLE VI_TYPE 0x01 +#define VIRQREQ_DISABLE VI_TYPE 0x00 + +#define VIRQREQ_CTL_MASK VI_TYPE 0xfe +#define VIRQREQ_STAT VI_TYPE 0xfe + +#define VIRQ1REQ VI_TYPE 0x02 +#define VIRQ2REQ VI_TYPE 0x04 +#define VIRQ3REQ VI_TYPE 0x08 +#define VIRQ4REQ VI_TYPE 0x10 +#define VIRQ5REQ VI_TYPE 0x20 +#define VIRQ6REQ VI_TYPE 0x40 +#define VIRQ7REQ VI_TYPE 0x80 + + +#define B_VIC_VIRQ1REQ_VECTOR P_VI_TYPE (VIC_ADR + 0x87) +#define B_VIC_VIRQ2REQ_VECTOR P_VI_TYPE (VIC_ADR + 0x8b) +#define B_VIC_VIRQ3REQ_VECTOR P_VI_TYPE (VIC_ADR + 0x8f) +#define B_VIC_VIRQ4REQ_VECTOR P_VI_TYPE (VIC_ADR + 0x93) +#define B_VIC_VIRQ5REQ_VECTOR P_VI_TYPE (VIC_ADR + 0x97) +#define B_VIC_VIRQ6REQ_VECTOR P_VI_TYPE (VIC_ADR + 0x9b) +#define B_VIC_VIRQ7REQ_VECTOR P_VI_TYPE (VIC_ADR + 0x9f) + + +#define B_VIC_TIMEOUTS P_VI_TYPE (VIC_ADR + 0xa3) +#define B_VIC_LBUS_TIMING P_VI_TYPE (VIC_ADR + 0xa7) +#define B_VIC_BLK_XFER_DEF P_VI_TYPE (VIC_ADR + 0xab) +#define B_VIC_VME_CONFIG P_VI_TYPE (VIC_ADR + 0xaf) +#define B_VIC_ARB_REQ_CONFIG P_VI_TYPE (VIC_ADR + 0xb3) +#define B_VIC_AM_SRC P_VI_TYPE (VIC_ADR + 0xb7) + +/* bus error status reg */ +#define B_VIC_BERR_STAT P_VI_TYPE (VIC_ADR + 0xbb) +#define LBUS_VME_ACQ_TIME_OUT VI_TYPE 0x01 +#define SELF_SLAVE1_ACC VI_TYPE 0x02 +#define SELF_SLAVE0_ACC VI_TYPE 0x04 +#define LBUS_TIME_OUT VI_TYPE 0x08 +#define VME_TIMEOUT VI_TYPE 0x10 +#define VME_BUS_ERROR VI_TYPE 0x20 +#define LBUS_ERROR VI_TYPE 0x40 +#define IAM_SYSCON VI_TYPE 0x80 + + +#define B_VIC_DMA_STAT P_VI_TYPE (VIC_ADR + 0xbf) + +#define B_VIC_SLS0_CTL0 P_VI_TYPE (VIC_ADR + 0xc3) +#define TMR_MASK VI_TYPE 0xc0 +#define DISABLE_TMR VI_TYPE 0x0 +#define ENABLE_HZ50 VI_TYPE 0x40 +#define ENABLE_HZ1000 VI_TYPE 0x80 +#define ENABLE_HZ100 VI_TYPE 0xc0 + +#define ASIZE_MASK VI_TYPE 0x0c +#define ASIZE_32 VI_TYPE 0x00 +#define ASIZE_24 VI_TYPE 0x04 +#define ASIZE_16 VI_TYPE 0x08 + + +#define B_VIC_SLS0_CTL1 P_VI_TYPE (VIC_ADR + 0xc7) +#define B_VIC_SLS1_CTL0 P_VI_TYPE (VIC_ADR + 0xcb) +#define B_VIC_SLS1_CTL1 P_VI_TYPE (VIC_ADR + 0xcf) + +#define B_VIC_RLSE_CTL P_VI_TYPE (VIC_ADR + 0xd3) +#define B_VIC_BLK_XFER_CTL P_VI_TYPE (VIC_ADR + 0xd7) +#define B_VIC_BLK_XFER_LEN0 P_VI_TYPE (VIC_ADR + 0xdb) +#define B_VIC_BLK_XFER_LEN1 P_VI_TYPE (VIC_ADR + 0xdf) + +#define B_VIC_SYS_RESET P_VI_TYPE (VIC_ADR + 0xe3) +#define SYS_RESET_ENABLE VI_TYPE 0xf0 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCivich */ diff --git a/h/drv/multi/m5204.h b/h/drv/multi/m5204.h new file mode 100644 index 0000000..ce934ba --- /dev/null +++ b/h/drv/multi/m5204.h @@ -0,0 +1,190 @@ +/* m5204.h - Motorola MCF5204 CPU control registers */ + +/* Copyright 1994-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,15apr98,mem minor cleanups. +01a,09dec96,mem written. +*/ + +/* +This file contains I/O addresses and related constants for the MCF5204 +*/ + +#ifndef __INCm5204h +#define __INCm5204h + +#ifdef __cplusplus +extern "C" { +#endif + +/* +Need to use a distinct cast macro in order to not conflict with other +include files. +*/ + +#ifdef _ASMLANGUAGE +#define CAST_M5204(x) +#else /* _ASMLANGUAGE */ +#define CAST_M5204(x) (x) +#endif /* _ASMLANGUAGE */ + +/* Size of internal SRAM */ + +#define M5204_SRAM_SIZE 512 /* size of internal SRAM */ + +/* System Integration Module register addresses */ + +#define M5204_SIM_SIMR(base) (CAST_M5204(volatile UINT8 *)((base) + 0x003)) +#define M5204_SIM_ICR_E0(base) (CAST_M5204(volatile UINT8 *)((base) + 0x014)) +#define M5204_SIM_ICR_E1(base) (CAST_M5204(volatile UINT8 *)((base) + 0x015)) +#define M5204_SIM_ICR_E2(base) (CAST_M5204(volatile UINT8 *)((base) + 0x016)) +#define M5204_SIM_ICR_E3(base) (CAST_M5204(volatile UINT8 *)((base) + 0x017)) +#define M5204_SIM_ICR_SW(base) (CAST_M5204(volatile UINT8 *)((base) + 0x01b)) +#define M5204_SIM_ICR_T1(base) (CAST_M5204(volatile UINT8 *)((base) + 0x01c)) +#define M5204_SIM_ICR_T2(base) (CAST_M5204(volatile UINT8 *)((base) + 0x01d)) +#define M5204_SIM_ICR_U1(base) (CAST_M5204(volatile UINT8 *)((base) + 0x01f)) +#define M5204_SIM_IMR(base) (CAST_M5204(volatile UINT32 *)((base) + 0x034)) +#define M5204_SIM_IPR(base) (CAST_M5204(volatile UINT32 *)((base) + 0x038)) +#define M5204_SIM_RSR(base) (CAST_M5204(volatile UINT8 *)((base) + 0x040)) +#define M5204_SIM_SYPCR(base) (CAST_M5204(volatile UINT8 *)((base) + 0x041)) +#define M5204_SIM_SWIVR(base) (CAST_M5204(volatile UINT8 *)((base) + 0x042)) +#define M5204_SIM_SWSR(base) (CAST_M5204(volatile UINT8 *)((base) + 0x043)) + +/* chip select registers */ +#define M5204_SIM_CSAR0(base) (CAST_M5204(volatile UINT32 *)((base) + 0x064)) +#define M5204_SIM_CSMR0(base) (CAST_M5204(volatile UINT32 *)((base) + 0x068)) +#define M5204_SIM_CSCR0(base) (CAST_M5204(volatile UINT32 *)((base) + 0x06c)) +#define M5204_SIM_CSAR1(base) (CAST_M5204(volatile UINT32 *)((base) + 0x070)) +#define M5204_SIM_CSMR1(base) (CAST_M5204(volatile UINT32 *)((base) + 0x074)) +#define M5204_SIM_CSCR1(base) (CAST_M5204(volatile UINT32 *)((base) + 0x078)) +#define M5204_SIM_CSAR2(base) (CAST_M5204(volatile UINT32 *)((base) + 0x07c)) +#define M5204_SIM_CSMR2(base) (CAST_M5204(volatile UINT32 *)((base) + 0x080)) +#define M5204_SIM_CSCR2(base) (CAST_M5204(volatile UINT32 *)((base) + 0x084)) +#define M5204_SIM_CSAR3(base) (CAST_M5204(volatile UINT32 *)((base) + 0x088)) +#define M5204_SIM_CSMR3(base) (CAST_M5204(volatile UINT32 *)((base) + 0x08c)) +#define M5204_SIM_CSCR3(base) (CAST_M5204(volatile UINT32 *)((base) + 0x090)) +#define M5204_SIM_CSAR4(base) (CAST_M5204(volatile UINT32 *)((base) + 0x094)) +#define M5204_SIM_CSMR4(base) (CAST_M5204(volatile UINT32 *)((base) + 0x098)) +#define M5204_SIM_CSCR4(base) (CAST_M5204(volatile UINT32 *)((base) + 0x09c)) +#define M5204_SIM_CSAR5(base) (CAST_M5204(volatile UINT32 *)((base) + 0x0a0)) +#define M5204_SIM_CSMR5(base) (CAST_M5204(volatile UINT32 *)((base) + 0x0a4)) +#define M5204_SIM_CSCR5(base) (CAST_M5204(volatile UINT32 *)((base) + 0x0a8)) + +/* parallel port registers */ +#define M5204_SIM_PAR(base) (CAST_M5204(volatile UINT8 *)((base) + 0x0cb)) +#define M5204_SIM_PADDR(base) (CAST_M5204(volatile UINT8 *)((base) + 0x1c5)) +#define M5204_SIM_PADAT(base) (CAST_M5204(volatile UINT8 *)((base) + 0x1c9)) + +/* Timers 1 and 2. */ + +#define M5204_TIMER_REG(base, offset, timer) \ + ((base) + (((timer) - 1) * 0x20) + (offset)) + +#define M5204_TIMER_TMR(base, n) \ + (CAST_M5204(volatile UINT16 *) M5204_TIMER_REG(base, 0x100, n)) +#define M5204_TIMER_TRR(base, n) \ + (CAST_M5204(volatile UINT16 *) M5204_TIMER_REG(base, 0x104, n)) +#define M5204_TIMER_TCR(base, n) \ + (CAST_M5204(volatile UINT16 *) M5204_TIMER_REG(base, 0x108, n)) +#define M5204_TIMER_TCN(base, n) \ + (CAST_M5204(volatile UINT16 *) M5204_TIMER_REG(base, 0x10c, n)) +#define M5204_TIMER_TER(base, n) \ + (CAST_M5204(volatile UINT8 *) M5204_TIMER_REG(base, 0x111, n)) + +/* UART */ +#define M5204_UART_MR(base) (CAST_M5204(volatile UINT8 *)((base) + 0x140)) +#define M5204_UART_SR(base) (CAST_M5204(volatile UINT8 *)((base) + 0x144)) +#define M5204_UART_CSR(base) (CAST_M5204(volatile UINT8 *)((base) + 0x144)) +#define M5204_UART_CR(base) (CAST_M5204(volatile UINT8 *)((base) + 0x148)) +#define M5204_UART_RB(base) (CAST_M5204(volatile UINT8 *)((base) + 0x14c)) +#define M5204_UART_TB(base) (CAST_M5204(volatile UINT8 *)((base) + 0x14c)) +#define M5204_UART_IPCR(base) (CAST_M5204(volatile UINT8 *)((base) + 0x150)) +#define M5204_UART_ACR(base) (CAST_M5204(volatile UINT8 *)((base) + 0x150)) +#define M5204_UART_ISR(base) (CAST_M5204(volatile UINT8 *)((base) + 0x154)) +#define M5204_UART_IMR(base) (CAST_M5204(volatile UINT8 *)((base) + 0x154)) +#define M5204_UART_BG1(base) (CAST_M5204(volatile UINT8 *)((base) + 0x158)) +#define M5204_UART_BG2(base) (CAST_M5204(volatile UINT8 *)((base) + 0x15c)) +#define M5204_UART_IVR(base) (CAST_M5204(volatile UINT8 *)((base) + 0x170)) +#define M5204_UART_IP(base) (CAST_M5204(volatile UINT8 *)((base) + 0x174)) +#define M5204_UART_OP1(base) (CAST_M5204(volatile UINT8 *)((base) + 0x178)) +#define M5204_UART_OP2(base) (CAST_M5204(volatile UINT8 *)((base) + 0x17c)) + +/* SIM Module Configuration Register definitions */ + +/* SIM Configuration register (SIMR) */ +#define M5204_SIMR_FRZ0 (1 << 6) /* bus monitor runs */ +#define M5204_SIMR_FRZ1 (1 << 7) /* watchdog timer runs */ + +/* ICR - encode bits for ICR_xx registers */ +#define M5204_SIM_ICR_BITS(auto, level, priority) \ + ((((auto) & 0x01) << 7) \ + | (((level) & 0x07) << 2) \ + | ((priority) & 0x03)) + +/* IMR - Interrupt Mask Register bit definitions */ +#define M5204_IMR_IRQ0 (1 << 1) +#define M5204_IMR_IRQ1 (1 << 2) +#define M5204_IMR_IRQ2 (1 << 3) +#define M5204_IMR_IRQ3 (1 << 4) +#define M5204_IMR_SWT (1 << 8) +#define M5204_IMR_TIMER1 (1 << 9) +#define M5204_IMR_TIMER2 (1 << 10) +#define M5204_IMR_UART (1 << 12) + +/* chip select mask registers */ +#define M5204_CS_CSMR_MASK_512b 0x00000000 +#define M5204_CS_CSMR_MASK_1k 0x00000200 +#define M5204_CS_CSMR_MASK_2k 0x00000600 +#define M5204_CS_CSMR_MASK_4k 0x00000e00 +#define M5204_CS_CSMR_MASK_8k 0x00001e00 +#define M5204_CS_CSMR_MASK_16k 0x00003e00 +#define M5204_CS_CSMR_MASK_32k 0x00007e00 +#define M5204_CS_CSMR_MASK_64k 0x0000fe00 +#define M5204_CS_CSMR_MASK_128k 0x0001fe00 +#define M5204_CS_CSMR_MASK_256k 0x0003fe00 +#define M5204_CS_CSMR_MASK_512k 0x0007fe00 +#define M5204_CS_CSMR_MASK_1M 0x000ffe00 +#define M5204_CS_CSMR_MASK_2M 0x001ffe00 +#define M5204_CS_CSMR_MASK_4M 0x003ffe00 +#define M5204_CS_CSMR_MASK_8M 0x007ffe00 +#define M5204_CS_CSMR_MASK_16M 0x00fffe00 +#define M5204_CS_CSMR_MASK_32M 0x01fffe00 +#define M5204_CS_CSMR_MASK_64M 0x03fffe00 +#define M5204_CS_CSMR_MASK_128M 0x07fffe00 +#define M5204_CS_CSMR_MASK_256M 0x0ffffe00 +#define M5204_CS_CSMR_MASK_512M 0x1ffffe00 +#define M5204_CS_CSMR_MASK_1G 0x3ffffe00 +#define M5204_CS_CSMR_MASK_2G 0x7ffffe00 +#define M5204_CS_CSMR_MASK_4G 0xfffffe00 +#define M5204_CS_CSMR_WP (1 << 8) +#define M5204_CS_CSMR_CI (1 << 5) +#define M5204_CS_CSMR_SC (1 << 4) +#define M5204_CS_CSMR_SD (1 << 3) +#define M5204_CS_CSMR_UC (1 << 2) +#define M5204_CS_CSMR_UD (1 << 1) + +/* chip select control registers */ +#define M5204_CS_CSCR_WS(n) ((n) << 10) +#define M5204_CS_CSCR_WS_7 M5204_CS_CSCR_WS(7) +#define M5204_CS_CSCR_WS_6 M5204_CS_CSCR_WS(6) +#define M5204_CS_CSCR_WS_5 M5204_CS_CSCR_WS(5) +#define M5204_CS_CSCR_WS_4 M5204_CS_CSCR_WS(4) +#define M5204_CS_CSCR_WS_3 M5204_CS_CSCR_WS(3) +#define M5204_CS_CSCR_WS_2 M5204_CS_CSCR_WS(2) +#define M5204_CS_CSCR_WS_1 M5204_CS_CSCR_WS(1) +#define M5204_CS_CSCR_WS_0 M5204_CS_CSCR_WS(0) +#define M5204_CS_CSCR_BRST (1 << 9) +#define M5204_CS_CSCR_AA (1 << 8) +#define M5204_CS_CSCR_PS_16 (0 << 6) +#define M5204_CS_CSCR_PS_8 (1 << 6) +#define M5204_CS_CSCR_BEM (1 << 5) +#define M5204_CS_CSCR_V (1 << 0) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm5204h */ diff --git a/h/drv/multi/m5206.h b/h/drv/multi/m5206.h new file mode 100644 index 0000000..a9ba371 --- /dev/null +++ b/h/drv/multi/m5206.h @@ -0,0 +1,295 @@ +/* m5206.h - Motorola MCF5206 CPU control registers */ + +/* Copyright 1994-1997 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,21jan97,kab created from m5204.h +*/ + +/* +This file contains I/O addresses and related constants for the MCF5206 +*/ + +#ifndef __INCm5206h +#define __INCm5206h + +#ifdef __cplusplus +extern "C" { +#endif + +/* +Need to use a distinct cast macro in order to not conflict with other +include files. +*/ + +#ifdef _ASMLANGUAGE +#define CAST_M5206(x) +#else /* _ASMLANGUAGE */ +#define CAST_M5206(x) (x) +#endif /* _ASMLANGUAGE */ + +/* Size of internal SRAM */ + +#define M5206_SRAM_SIZE 512 /* size of internal SRAM */ + +/* System Integration Module register addresses */ + +#define M5206_SIM_SIMR(base) (CAST_M5206(volatile UINT8 *)((base) + 0x003)) +/* External IP1-7 */ +#define M5206_SIM_ICR1(base) (CAST_M5206(volatile UINT8 *)((base) + 0x014)) +#define M5206_SIM_ICR2(base) (CAST_M5206(volatile UINT8 *)((base) + 0x015)) +#define M5206_SIM_ICR3(base) (CAST_M5206(volatile UINT8 *)((base) + 0x016)) +#define M5206_SIM_ICR4(base) (CAST_M5206(volatile UINT8 *)((base) + 0x017)) +#define M5206_SIM_ICR5(base) (CAST_M5206(volatile UINT8 *)((base) + 0x018)) +#define M5206_SIM_ICR6(base) (CAST_M5206(volatile UINT8 *)((base) + 0x019)) +#define M5206_SIM_ICR7(base) (CAST_M5206(volatile UINT8 *)((base) + 0x01a)) +/* SWT */ +#define M5206_SIM_ICR8(base) (CAST_M5206(volatile UINT8 *)((base) + 0x01b)) +/* Timer 1 INT */ +#define M5206_SIM_ICR9(base) (CAST_M5206(volatile UINT8 *)((base) + 0x01c)) +/* Timer 2 INT */ +#define M5206_SIM_ICR10(base) (CAST_M5206(volatile UINT8 *)((base) + 0x01d)) +/* MBUS interrupt */ +#define M5206_SIM_ICR11(base) (CAST_M5206(volatile UINT8 *)((base) + 0x01e)) +/* UART 1 INT */ +#define M5206_SIM_ICR12(base) (CAST_M5206(volatile UINT8 *)((base) + 0x01f)) +/* UART 2 INT */ +#define M5206_SIM_ICR13(base) (CAST_M5206(volatile UINT8 *)((base) + 0x020)) +#define M5206_SIM_IMR(base) (CAST_M5206(volatile UINT16 *)((base) + 0x036)) +#define M5206_SIM_IPR(base) (CAST_M5206(volatile UINT16 *)((base) + 0x03a)) +#define M5206_SIM_RSR(base) (CAST_M5206(volatile UINT8 *)((base) + 0x040)) +#define M5206_SIM_SYPCR(base) (CAST_M5206(volatile UINT8 *)((base) + 0x041)) +#define M5206_SIM_SWIVR(base) (CAST_M5206(volatile UINT8 *)((base) + 0x042)) +#define M5206_SIM_SWSR(base) (CAST_M5206(volatile UINT8 *)((base) + 0x043)) + +/* DRAM */ +#define M5206_DCRR(base) (CAST_M5206(volatile UINT16 *)((base) + 0x046)) +#define M5206_DCTR(base) (CAST_M5206(volatile UINT16 *)((base) + 0x04a)) +#define M5206_DCAR0(base) (CAST_M5206(volatile UINT16 *)((base) + 0x04c)) +#define M5206_DCMR0(base) (CAST_M5206(volatile UINT32 *)((base) + 0x050)) +#define M5206_DCCR0(base) (CAST_M5206(volatile UINT8 *)((base) + 0x057)) +#define M5206_DCAR1(base) (CAST_M5206(volatile UINT16 *)((base) + 0x058)) +#define M5206_DCMR1(base) (CAST_M5206(volatile UINT32 *)((base) + 0x05c)) +#define M5206_DCCR1(base) (CAST_M5206(volatile UINT8 *)((base) + 0x063)) + +#define M5206_SIM_CSAR0(base) (CAST_M5206(volatile UINT16 *)((base) + 0x064)) +#define M5206_SIM_CSMR0(base) (CAST_M5206(volatile UINT32 *)((base) + 0x068)) +#define M5206_SIM_CSCR0(base) (CAST_M5206(volatile UINT16 *)((base) + 0x06e)) +#define M5206_SIM_CSAR1(base) (CAST_M5206(volatile UINT16 *)((base) + 0x070)) +#define M5206_SIM_CSMR1(base) (CAST_M5206(volatile UINT32 *)((base) + 0x074)) +#define M5206_SIM_CSCR1(base) (CAST_M5206(volatile UINT16 *)((base) + 0x07a)) +#define M5206_SIM_CSAR2(base) (CAST_M5206(volatile UINT16 *)((base) + 0x07c)) +#define M5206_SIM_CSMR2(base) (CAST_M5206(volatile UINT32 *)((base) + 0x080)) +#define M5206_SIM_CSCR2(base) (CAST_M5206(volatile UINT16 *)((base) + 0x086)) +#define M5206_SIM_CSAR3(base) (CAST_M5206(volatile UINT16 *)((base) + 0x088)) +#define M5206_SIM_CSMR3(base) (CAST_M5206(volatile UINT32 *)((base) + 0x08c)) +#define M5206_SIM_CSCR3(base) (CAST_M5206(volatile UINT16 *)((base) + 0x092)) +#define M5206_SIM_CSAR4(base) (CAST_M5206(volatile UINT16 *)((base) + 0x094)) +#define M5206_SIM_CSMR4(base) (CAST_M5206(volatile UINT32 *)((base) + 0x098)) +#define M5206_SIM_CSCR4(base) (CAST_M5206(volatile UINT16 *)((base) + 0x09e)) +#define M5206_SIM_CSAR5(base) (CAST_M5206(volatile UINT16 *)((base) + 0x0a0)) +#define M5206_SIM_CSMR5(base) (CAST_M5206(volatile UINT32 *)((base) + 0x0a4)) +#define M5206_SIM_CSCR5(base) (CAST_M5206(volatile UINT16 *)((base) + 0x0aa)) +#define M5206_SIM_CSAR6(base) (CAST_M5206(volatile UINT16 *)((base) + 0x0ac)) +#define M5206_SIM_CSMR6(base) (CAST_M5206(volatile UINT32 *)((base) + 0x0b0)) +#define M5206_SIM_CSCR6(base) (CAST_M5206(volatile UINT16 *)((base) + 0x0b6)) +#define M5206_SIM_CSAR7(base) (CAST_M5206(volatile UINT16 *)((base) + 0x0b8)) +#define M5206_SIM_CSMR7(base) (CAST_M5206(volatile UINT32 *)((base) + 0x0bc)) +#define M5206_SIM_CSCR7(base) (CAST_M5206(volatile UINT16 *)((base) + 0x0c2)) +#define M5206_SIM_DMCR(base) (CAST_M5206(volatile UINT16 *)((base) + 0x0c6)) +#define M5206_SIM_PAR(base) (CAST_M5206(volatile UINT8 *)((base) + 0x0cb)) +#define M5206_SIM_PADDR(base) (CAST_M5206(volatile UINT8 *)((base) + 0x1c5)) +#define M5206_SIM_PADAT(base) (CAST_M5206(volatile UINT8 *)((base) + 0x1c9)) + +/* Timers 1 and 2. */ + +#define M5206_TIMER_REG(base, offset, timer) \ + ((base) + (((timer) - 1) * 0x20) + (offset)) + +#define M5206_TIMER_TMR(base, n) \ + (CAST_M5206(volatile UINT16 *) M5206_TIMER_REG(base, 0x100, n)) +#define M5206_TIMER_TRR(base, n) \ + (CAST_M5206(volatile UINT16 *) M5206_TIMER_REG(base, 0x104, n)) +#define M5206_TIMER_TCR(base, n) \ + (CAST_M5206(volatile UINT16 *) M5206_TIMER_REG(base, 0x108, n)) +#define M5206_TIMER_TCN(base, n) \ + (CAST_M5206(volatile UINT16 *) M5206_TIMER_REG(base, 0x10c, n)) +#define M5206_TIMER_TER(base, n) \ + (CAST_M5206(volatile UINT8 *) M5206_TIMER_REG(base, 0x111, n)) + +/* UART 1 & 2 */ +#define M5206_UART_REG(base, offset, chan) \ + ((base) + (offset) + (((chan) - 1) * 0x40)) + +#define M5206_UART_MR(base, n) \ + (CAST_M5206(volatile UINT8 *) M5206_UART_REG((base), 0x140, n)) +#define M5206_UART_SR(base, n) \ + (CAST_M5206(volatile UINT8 *) M5206_UART_REG((base), 0x144, n)) +#define M5206_UART_CSR(base, n) \ + (CAST_M5206(volatile UINT8 *) M5206_UART_REG((base), 0x144, n)) +#define M5206_UART_CR(base, n) \ + (CAST_M5206(volatile UINT8 *) M5206_UART_REG((base), 0x148, n)) +#define M5206_UART_RB(base, n) \ + (CAST_M5206(volatile UINT8 *) M5206_UART_REG((base), 0x14c, n)) +#define M5206_UART_TB(base, n) \ + (CAST_M5206(volatile UINT8 *) M5206_UART_REG((base), 0x14c, n)) +#define M5206_UART_IPCR(base, n) \ + (CAST_M5206(volatile UINT8 *) M5206_UART_REG((base), 0x150, n)) +#define M5206_UART_ACR(base, n) \ + (CAST_M5206(volatile UINT8 *) M5206_UART_REG((base), 0x150, n)) +#define M5206_UART_ISR(base, n) \ + (CAST_M5206(volatile UINT8 *) M5206_UART_REG((base), 0x154, n)) +#define M5206_UART_IMR(base, n) \ + (CAST_M5206(volatile UINT8 *) M5206_UART_REG((base), 0x154, n)) +#define M5206_UART_BG1(base, n) \ + (CAST_M5206(volatile UINT8 *) M5206_UART_REG((base), 0x158, n)) +#define M5206_UART_BG2(base, n) \ + (CAST_M5206(volatile UINT8 *) M5206_UART_REG((base), 0x15c, n)) +#define M5206_UART_IVR(base, n) \ + (CAST_M5206(volatile UINT8 *) M5206_UART_REG((base), 0x170, n)) +#define M5206_UART_IP(base, n) \ + (CAST_M5206(volatile UINT8 *) M5206_UART_REG((base), 0x174, n)) +#define M5206_UART_OP1(base, n) \ + (CAST_M5206(volatile UINT8 *) M5206_UART_REG((base), 0x178, n)) +#define M5206_UART_OP2(base, n) \ + (CAST_M5206(volatile UINT8 *) M5206_UART_REG((base), 0x17c, n)) + +/* MBUS regs */ +#define M5206_MADR(base) (CAST_M5206(volatile UINT8 *)((base) + 0x1e0)) +#define M5206_MFDR(base) (CAST_M5206(volatile UINT8 *)((base) + 0x1e4)) +#define M5206_MBCR(base) (CAST_M5206(volatile UINT8 *)((base) + 0x1e8)) +#define M5206_MBSR(base) (CAST_M5206(volatile UINT8 *)((base) + 0x1ec)) +#define M5206_MBDR(base) (CAST_M5206(volatile UINT8 *)((base) + 0x1f0)) + + +/* SIM Module Configuration Register definitions */ + +/* ICR - encode bits for ICR_xx registers */ +#define M5206_SIM_ICR_BITS(auto, level, priority) \ + ((((auto) & 0x01) << 7) \ + | (((level) & 0x07) << 2) \ + | ((priority) & 0x03)) + +/* IMR - Interrupt Mask Register bit definitions */ +#define M5206_IMR_IRQ1 (1 << 1) +#define M5206_IMR_IRQ2 (1 << 2) +#define M5206_IMR_IRQ3 (1 << 3) +#define M5206_IMR_IRQ4 (1 << 4) +#define M5206_IMR_IRQ5 (1 << 5) +#define M5206_IMR_IRQ6 (1 << 6) +#define M5206_IMR_IRQ7 (1 << 7) +#define M5206_IMR_SWT (1 << 8) +#define M5206_IMR_TIMER1 (1 << 9) +#define M5206_IMR_TIMER2 (1 << 10) +#define M5206_IMR_MBUS (1 << 11) +#define M5206_IMR_UART1 (1 << 12) +#define M5206_IMR_UART2 (1 << 13) + +/* chip select mask registers */ +#define M5206_CS_CSMR_MASK_64k 0x00000000 +#define M5206_CS_CSMR_MASK_128k 0x00010000 +#define M5206_CS_CSMR_MASK_256k 0x00030000 +#define M5206_CS_CSMR_MASK_512k 0x00070000 +#define M5206_CS_CSMR_MASK_1M 0x000f0000 +#define M5206_CS_CSMR_MASK_2M 0x001f0000 +#define M5206_CS_CSMR_MASK_4M 0x003f0000 +#define M5206_CS_CSMR_MASK_8M 0x007f0000 +#define M5206_CS_CSMR_MASK_16M 0x00ff0000 +#define M5206_CS_CSMR_MASK_32M 0x01ff0000 +#define M5206_CS_CSMR_MASK_64M 0x03ff0000 +#define M5206_CS_CSMR_MASK_128M 0x07ff0000 +#define M5206_CS_CSMR_MASK_256M 0x0fff0000 +#define M5206_CS_CSMR_MASK_512M 0x1fff0000 +#define M5206_CS_CSMR_MASK_1G 0x3fff0000 +#define M5206_CS_CSMR_MASK_2G 0x7fff0000 +#define M5206_CS_CSMR_MASK_4G 0xffff0000 +#define M5206_CS_CSMR_CI (1 << 5) /* /CS1 only */ +#define M5206_CS_CSMR_SC (1 << 4) +#define M5206_CS_CSMR_SD (1 << 3) +#define M5206_CS_CSMR_UC (1 << 2) +#define M5206_CS_CSMR_UD (1 << 1) + +/* chip select control regs (CSCR) & default mem control reg (DMCR) */ +#define M5206_CS_CSCR_WS(n) ((n) << 10) /* wait-states */ +#define M5206_CS_CSCR_WS_15 M5206_CS_CSCR_WS(15) +#define M5206_CS_CSCR_WS_14 M5206_CS_CSCR_WS(14) +#define M5206_CS_CSCR_WS_13 M5206_CS_CSCR_WS(13) +#define M5206_CS_CSCR_WS_12 M5206_CS_CSCR_WS(12) +#define M5206_CS_CSCR_WS_11 M5206_CS_CSCR_WS(11) +#define M5206_CS_CSCR_WS_10 M5206_CS_CSCR_WS(10) +#define M5206_CS_CSCR_WS_9 M5206_CS_CSCR_WS(9) +#define M5206_CS_CSCR_WS_8 M5206_CS_CSCR_WS(8) +#define M5206_CS_CSCR_WS_7 M5206_CS_CSCR_WS(7) +#define M5206_CS_CSCR_WS_6 M5206_CS_CSCR_WS(6) +#define M5206_CS_CSCR_WS_5 M5206_CS_CSCR_WS(5) +#define M5206_CS_CSCR_WS_4 M5206_CS_CSCR_WS(4) +#define M5206_CS_CSCR_WS_3 M5206_CS_CSCR_WS(3) +#define M5206_CS_CSCR_WS_2 M5206_CS_CSCR_WS(2) +#define M5206_CS_CSCR_WS_1 M5206_CS_CSCR_WS(1) +#define M5206_CS_CSCR_WS_0 M5206_CS_CSCR_WS(0) +#define M5206_CS_CSCR_BRST (1 << 9) /* allow burst access */ +#define M5206_CS_CSCR_AA (1 << 8) /* auto-acknowledge */ +#define M5206_CS_CSCR_PS_32 (0 << 6) /* 32-bit port size */ +#define M5206_CS_CSCR_PS_8 (1 << 6) /* 8-bit port size */ +#define M5206_CS_CSCR_PS_16 (2 << 6) /* 16-bit port size */ +#define M5206_CS_CSCR_EMAA (1 << 5) /* alternate master auto-ack */ +#define M5206_CS_CSCR_ASET (1 << 4) /* address setup enable */ +#define M5206_CS_CSCR_WRAH (1 << 3) /* write address hold enable */ +#define M5206_CS_CSCR_RDAH (1 << 2) /* read address hold enable */ +#define M5206_CS_CSCR_WR (1 << 1) /* write enable */ +#define M5206_CS_CSCR_RD (1 << 0) /* read enable */ + +/* DRAM Controller Timing Register (DCTR) */ +#define M5206_DCTR_DAEM (1 << 15) /* drive multiplexed addr */ +#define M5206_DCTR_EDO (1 << 14) /* EDO enable */ +#define M5206_DCTR_RCD (1 << 12) /* RAS-to-CAS delay */ +#define M5206_DCTR_RSH1 (1 << 10) /* RAS hold time */ +#define M5206_DCTR_RSH0 (1 << 9) /* RAS hold time */ +#define M5206_DCTR_RP1 (1 << 6) /* RAS precharge time */ +#define M5206_DCTR_RP0 (1 << 5) /* RAS prechange time */ +#define M5206_DCTR_CAS (1 << 3) /* CAS time */ +#define M5206_DCTR_CP (1 << 1) /* CAS precharge time */ +#define M5206_DCTR_CSR (1 << 0) /* CAS setup time */ + +/* dram controller mask registers */ +#define M5206_DCMR_MASK_128k 0x00000000 +#define M5206_DCMR_MASK_256k 0x00020000 +#define M5206_DCMR_MASK_512k 0x00060000 +#define M5206_DCMR_MASK_1M 0x000e0000 +#define M5206_DCMR_MASK_2M 0x001e0000 +#define M5206_DCMR_MASK_4M 0x003e0000 +#define M5206_DCMR_MASK_8M 0x007e0000 +#define M5206_DCMR_MASK_16M 0x00fe0000 +#define M5206_DCMR_MASK_32M 0x01fe0000 +#define M5206_DCMR_MASK_64M 0x03fe0000 +#define M5206_DCMR_MASK_128M 0x07fe0000 +#define M5206_DCMR_MASK_256M 0x0ffe0000 +#define M5206_DCMR_MASK_512M 0x1ffe0000 +#define M5206_DCMR_MASK_1G 0x3ffe0000 +#define M5206_DCMR_MASK_2G 0x7ffe0000 +#define M5206_DCMR_MASK_4G 0xfffe0000 +#define M5206_DCMR_SC (1 << 4) +#define M5206_DCMR_SD (1 << 3) +#define M5206_DCMR_UC (1 << 2) +#define M5206_DCMR_UD (1 << 1) + +/* DRAM Controller Control Register */ +#define M5206_DCCR_PS_32 (0 << 6) /* 32-bit port size */ +#define M5206_DCCR_PS_8 (1 << 6) /* 8-bit port size */ +#define M5206_DCCR_PS_16 (3 << 6) /* 16-bit port size */ +#define M5206_DCCR_BPS_512B (0 << 4) /* 512byte bank page size */ +#define M5206_DCCR_BPS_1K (1 << 4) /* 1Kb bank page size */ +#define M5206_DCCR_BPS_2K (2 << 4) /* 2Kb bank page size */ +#define M5206_DCCR_MODE_NORMAL (0 << 2) /* normal page mode */ +#define M5206_DCCR_MODE_BURST (1 << 2) /* burst page mode */ +#define M5206_DCCR_MODE_FAST (3 << 2) /* fast page mode */ +#define M5206_DCCR_WR (1 << 1) /* Signal on write xfer */ +#define M5206_DCCR_RD (1 << 0) /* Signal on read xfer */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm5206h */ diff --git a/h/drv/multi/m5206e.h b/h/drv/multi/m5206e.h new file mode 100644 index 0000000..fcac047 --- /dev/null +++ b/h/drv/multi/m5206e.h @@ -0,0 +1,392 @@ +/* m5206e.h - Motorola MCF5206e CPU control registers */ + +/* Copyright 1994-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,05mar01,hjg Created from m5206.h +*/ + +/* +This file contains I/O addresses and related constants for the MCF5206e +*/ + +#ifndef __INCm5206eh +#define __INCm5206eh + +#ifdef __cplusplus +extern "C" { +#endif + +/* +Need to use a distinct cast macro in order to not conflict with other +include files. +*/ + +#ifdef _ASMLANGUAGE +#define CAST_M5206E(x) +#else /* _ASMLANGUAGE */ +#define CAST_M5206E(x) (x) +#endif /* _ASMLANGUAGE */ + +/* Size of internal SRAM */ + +#define M5206E_SRAM_SIZE 8192 /* size of internal SRAM */ + +/* System Integration Module register addresses */ + +#define M5206E_SIM_SIMR(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x003)) +/* External IP1-7 */ +#define M5206E_SIM_ICR1(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x014)) +#define M5206E_SIM_ICR2(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x015)) +#define M5206E_SIM_ICR3(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x016)) +#define M5206E_SIM_ICR4(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x017)) +#define M5206E_SIM_ICR5(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x018)) +#define M5206E_SIM_ICR6(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x019)) +#define M5206E_SIM_ICR7(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x01a)) +/* SWT */ +#define M5206E_SIM_ICR8(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x01b)) +/* Timer 1 INT */ +#define M5206E_SIM_ICR9(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x01c)) +/* Timer 2 INT */ +#define M5206E_SIM_ICR10(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x01d)) +/* MBUS interrupt */ +#define M5206E_SIM_ICR11(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x01e)) +/* UART 1 INT */ +#define M5206E_SIM_ICR12(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x01f)) +/* UART 2 INT */ +#define M5206E_SIM_ICR13(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x020)) +/* DMA Channel 0 Interrupt */ +#define M5206E_SIM_ICR14(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x021)) +/* DMA Channel 1 Interrupt */ +#define M5206E_SIM_ICR15(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x022)) +/* Interrupt Mask Register */ +#define M5206E_SIM_IMR(base) (CAST_M5206E(volatile UINT16 *)((base) + 0x036)) +/* Interrupt Pending Register */ +#define M5206E_SIM_IPR(base) (CAST_M5206E(volatile UINT16 *)((base) + 0x03a)) +/* Reset Status Register */ +#define M5206E_SIM_RSR(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x040)) +/* System Protection Control Register */ +#define M5206E_SIM_SYPCR(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x041)) +/* Software Watchdog Interrupt Vector Register */ +#define M5206E_SIM_SWIVR(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x042)) +/* Software Watchdog Service Register */ +#define M5206E_SIM_SWSR(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x043)) + +/* DRAM */ +/* DRAM Controller Refresh */ +#define M5206E_DCRR(base) (CAST_M5206E(volatile UINT16 *)((base) + 0x046)) +/* DRAM Controller Timing Register */ +#define M5206E_DCTR(base) (CAST_M5206E(volatile UINT16 *)((base) + 0x04a)) +/* DRAM Controller Address Register - Bank 0 */ +#define M5206E_DCAR0(base) (CAST_M5206E(volatile UINT16 *)((base) + 0x04c)) +/* DRAM Controller Mask Register - Bank 0 */ +#define M5206E_DCMR0(base) (CAST_M5206E(volatile UINT32 *)((base) + 0x050)) +/* DRAM Controller Control Register - Bank 0 */ +#define M5206E_DCCR0(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x057)) +/* DRAM Controller Address Register - Bank 1 */ +#define M5206E_DCAR1(base) (CAST_M5206E(volatile UINT16 *)((base) + 0x058)) +/* DRAM Controller Mask Register - Bank 1 */ +#define M5206E_DCMR1(base) (CAST_M5206E(volatile UINT32 *)((base) + 0x05c)) +/* DRAM Controller Control Register - Bank 1 */ +#define M5206E_DCCR1(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x063)) + +/* Chip-Select Address Register - Bank 0 */ +#define M5206E_SIM_CSAR0(base) (CAST_M5206E(volatile UINT16 *)((base) + 0x064)) +/* Chip-Select Mask Register - Bank 0 */ +#define M5206E_SIM_CSMR0(base) (CAST_M5206E(volatile UINT32 *)((base) + 0x068)) +/* Chip-Select Control Register - Bank 0 */ +#define M5206E_SIM_CSCR0(base) (CAST_M5206E(volatile UINT16 *)((base) + 0x06e)) +/* Chip-Select Address Register - Bank 1 */ +#define M5206E_SIM_CSAR1(base) (CAST_M5206E(volatile UINT16 *)((base) + 0x070)) +/* Chip-Select Mask Register - Bank 1 */ +#define M5206E_SIM_CSMR1(base) (CAST_M5206E(volatile UINT32 *)((base) + 0x074)) +/* Chip-Select Control Register - Bank 1 */ +#define M5206E_SIM_CSCR1(base) (CAST_M5206E(volatile UINT16 *)((base) + 0x07a)) +/* Chip-Select Address Register - Bank 2 */ +#define M5206E_SIM_CSAR2(base) (CAST_M5206E(volatile UINT16 *)((base) + 0x07c)) +/* Chip-Select Mask Register - Bank 2 */ +#define M5206E_SIM_CSMR2(base) (CAST_M5206E(volatile UINT32 *)((base) + 0x080)) +/* Chip-Select Control Register - Bank 2 */ +#define M5206E_SIM_CSCR2(base) (CAST_M5206E(volatile UINT16 *)((base) + 0x086)) +/* Chip-Select Address Register - Bank 3 */ +#define M5206E_SIM_CSAR3(base) (CAST_M5206E(volatile UINT16 *)((base) + 0x088)) +/* Chip-Select Mask Register - Bank 3 */ +#define M5206E_SIM_CSMR3(base) (CAST_M5206E(volatile UINT32 *)((base) + 0x08c)) +/* Chip-Select Control Register - Bank 3 */ +#define M5206E_SIM_CSCR3(base) (CAST_M5206E(volatile UINT16 *)((base) + 0x092)) +/* Chip-Select Address Register - Bank 4 */ +#define M5206E_SIM_CSAR4(base) (CAST_M5206E(volatile UINT16 *)((base) + 0x094)) +/* Chip-Select Mask Register - Bank 4 */ +#define M5206E_SIM_CSMR4(base) (CAST_M5206E(volatile UINT32 *)((base) + 0x098)) +/* Chip-Select Control Register - Bank 4 */ +#define M5206E_SIM_CSCR4(base) (CAST_M5206E(volatile UINT16 *)((base) + 0x09e)) +/* Chip-Select Address Register - Bank 5 */ +#define M5206E_SIM_CSAR5(base) (CAST_M5206E(volatile UINT16 *)((base) + 0x0a0)) +/* Chip-Select Mask Register - Bank 5 */ +#define M5206E_SIM_CSMR5(base) (CAST_M5206E(volatile UINT32 *)((base) + 0x0a4)) +/* Chip-Select Control Register - Bank 5 */ +#define M5206E_SIM_CSCR5(base) (CAST_M5206E(volatile UINT16 *)((base) + 0x0aa)) +/* Chip-Select Address Register - Bank 6 */ +#define M5206E_SIM_CSAR6(base) (CAST_M5206E(volatile UINT16 *)((base) + 0x0ac)) +/* Chip-Select Mask Register - Bank 6 */ +#define M5206E_SIM_CSMR6(base) (CAST_M5206E(volatile UINT32 *)((base) + 0x0b0)) +/* Chip-Select Control Register - Bank 6 */ +#define M5206E_SIM_CSCR6(base) (CAST_M5206E(volatile UINT16 *)((base) + 0x0b6)) +/* Chip-Select Address Register - Bank 7 */ +#define M5206E_SIM_CSAR7(base) (CAST_M5206E(volatile UINT16 *)((base) + 0x0b8)) +/* Chip-Select Mask Register - Bank 7 */ +#define M5206E_SIM_CSMR7(base) (CAST_M5206E(volatile UINT32 *)((base) + 0x0bc)) +/* Chip-Select Control Register - Bank 7 */ +#define M5206E_SIM_CSCR7(base) (CAST_M5206E(volatile UINT16 *)((base) + 0x0c2)) +/* Default Memory Control Register */ +#define M5206E_SIM_DMCR(base) (CAST_M5206E(volatile UINT16 *)((base) + 0x0c6)) +/* Pin Assignment Register */ +#define M5206E_SIM_PAR(base) (CAST_M5206E(volatile UINT16 *)((base) + 0x0ca)) +/* Port A Data Direction Register */ +#define M5206E_SIM_PADDR(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x1c5)) +/* Port A Data Register */ +#define M5206E_SIM_PADAT(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x1c9)) + +/* Timers 1 and 2. */ + +#define M5206E_TIMER_REG(base, offset, timer) \ + ((base) + ((timer) * 0x20) + (offset)) + +/* Timer 1/2 Mode Register */ +#define M5206E_TIMER_TMR(base, n) \ + (CAST_M5206E(volatile UINT16 *) M5206E_TIMER_REG(base, 0x100, n)) +/* Timer 1/2 Reference Register */ +#define M5206E_TIMER_TRR(base, n) \ + (CAST_M5206E(volatile UINT16 *) M5206E_TIMER_REG(base, 0x104, n)) +/* Timer 1/2 Capture Register */ +#define M5206E_TIMER_TCR(base, n) \ + (CAST_M5206E(volatile UINT16 *) M5206E_TIMER_REG(base, 0x108, n)) +/* Timer 1/2 Counter */ +#define M5206E_TIMER_TCN(base, n) \ + (CAST_M5206E(volatile UINT16 *) M5206E_TIMER_REG(base, 0x10c, n)) +/* Timer 1/2 Event Register */ +#define M5206E_TIMER_TER(base, n) \ + (CAST_M5206E(volatile UINT8 *) M5206E_TIMER_REG(base, 0x111, n)) + +/* UART 1 & 2 */ +#define M5206E_UART_REG(base, offset, chan) \ + ((base) + (offset) + ((chan) * 0x40)) + +/* UART 1/2 Mode Registers */ +#define M5206E_UART_MR(base, n) \ + (CAST_M5206E(volatile UINT8 *) M5206E_UART_REG((base), 0x140, n)) +/* UART 1/2 Status Register */ +#define M5206E_UART_SR(base, n) \ + (CAST_M5206E(volatile UINT8 *) M5206E_UART_REG((base), 0x144, n)) +/* UART 1/2 Clock-Select Register */ +#define M5206E_UART_CSR(base, n) \ + (CAST_M5206E(volatile UINT8 *) M5206E_UART_REG((base), 0x144, n)) +/* UART 1/2 Command Register */ +#define M5206E_UART_CR(base, n) \ + (CAST_M5206E(volatile UINT8 *) M5206E_UART_REG((base), 0x148, n)) +/* UART 1/2 Receive Buffer */ +#define M5206E_UART_RB(base, n) \ + (CAST_M5206E(volatile UINT8 *) M5206E_UART_REG((base), 0x14c, n)) +/* UART 1/2 Transmit Buffer */ +#define M5206E_UART_TB(base, n) \ + (CAST_M5206E(volatile UINT8 *) M5206E_UART_REG((base), 0x14c, n)) +/* UART 1/2 Input Port Change Register */ +#define M5206E_UART_IPCR(base, n) \ + (CAST_M5206E(volatile UINT8 *) M5206E_UART_REG((base), 0x150, n)) +/* UART 1/2 Input Auxilary Control Register */ +#define M5206E_UART_ACR(base, n) \ + (CAST_M5206E(volatile UINT8 *) M5206E_UART_REG((base), 0x150, n)) +/* UART 1/2 Interrupt Status Register */ +#define M5206E_UART_ISR(base, n) \ + (CAST_M5206E(volatile UINT8 *) M5206E_UART_REG((base), 0x154, n)) +/* UART 1/2 Interrupt Mask Register */ +#define M5206E_UART_IMR(base, n) \ + (CAST_M5206E(volatile UINT8 *) M5206E_UART_REG((base), 0x154, n)) +/* UART 1/2 Baud Rate Generator Prescale MSB */ +#define M5206E_UART_BG1(base, n) \ + (CAST_M5206E(volatile UINT8 *) M5206E_UART_REG((base), 0x158, n)) +/* UART 1/2 Baud Rate Generator Prescale LSB */ +#define M5206E_UART_BG2(base, n) \ + (CAST_M5206E(volatile UINT8 *) M5206E_UART_REG((base), 0x15c, n)) +/* UART 1/2 Interrupt Vector Register */ +#define M5206E_UART_IVR(base, n) \ + (CAST_M5206E(volatile UINT8 *) M5206E_UART_REG((base), 0x170, n)) +/* UART 1/2 Interrupt Port Register */ +#define M5206E_UART_IP(base, n) \ + (CAST_M5206E(volatile UINT8 *) M5206E_UART_REG((base), 0x174, n)) +/* UART 1/2 Output Port Bit Set CMD */ +#define M5206E_UART_OP1(base, n) \ + (CAST_M5206E(volatile UINT8 *) M5206E_UART_REG((base), 0x178, n)) +/* UART 1/2 Output Port Bit Reset CMD */ +#define M5206E_UART_OP2(base, n) \ + (CAST_M5206E(volatile UINT8 *) M5206E_UART_REG((base), 0x17c, n)) + +/* MBUS regs */ +/* M-Bus Address Register */ +#define M5206E_MADR(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x1e0)) +/* M-Bus Frequency Divider Register */ +#define M5206E_MFDR(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x1e4)) +/* M-Bus Control Register */ +#define M5206E_MBCR(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x1e8)) +/* M-Bus Control Register */ +#define M5206E_MBSR(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x1ec)) +/* M-Bus Data I/O Register */ +#define M5206E_MBDR(base) (CAST_M5206E(volatile UINT8 *)((base) + 0x1f0)) + +/* DMA 0 & 1 */ +#define M5206E_DMA_REG(base, offset, chan) \ + ((base) + (offset) + ((chan) * 0x40)) + +/* Source Address Registers */ +#define M5206E_DMA_DMASAR(base, n) \ + (CAST_M5206E(volatile UINT32 *) M5206E_DMA_REG((base), 0x200, n)) +/* Destination Address Registers */ +#define M5206E_DMA_DMADAR(base, n) \ + (CAST_M5206E(volatile UINT32 *) M5206E_DMA_REG((base), 0x204, n)) +/* DMA Control Registers */ +#define M5206E_DMA_DCR(base, n) \ + (CAST_M5206E(volatile UINT16 *) M5206E_DMA_REG((base), 0x208, n)) +/* Byte Count Registers */ +#define M5206E_DMA_BCR(base, n) \ + (CAST_M5206E(volatile UINT16 *) M5206E_DMA_REG((base), 0x20c, n)) +/* Status Registers */ +#define M5206E_DMA_DSR(base, n) \ + (CAST_M5206E(volatile UINT8 *) M5206E_DMA_REG((base), 0x210, n)) +/* Interrupt Vector Registers */ +#define M5206E_DMA_DIVR(base, n) \ + (CAST_M5206E(volatile UINT8 *) M5206E_DMA_REG((base), 0x214, n)) + + +/* SIM Module Configuration Register definitions */ + +/* ICR - encode bits for ICR_xx registers */ +#define M5206E_SIM_ICR_BITS(auto, level, priority) \ + ((((auto) & 0x01) << 7) \ + | (((level) & 0x07) << 2) \ + | ((priority) & 0x03)) + +/* IMR - Interrupt Mask Register bit definitions */ +#define M5206E_IMR_IRQ1 (1 << 1) +#define M5206E_IMR_IRQ2 (1 << 2) +#define M5206E_IMR_IRQ3 (1 << 3) +#define M5206E_IMR_IRQ4 (1 << 4) +#define M5206E_IMR_IRQ5 (1 << 5) +#define M5206E_IMR_IRQ6 (1 << 6) +#define M5206E_IMR_IRQ7 (1 << 7) +#define M5206E_IMR_SWT (1 << 8) +#define M5206E_IMR_TIMER1 (1 << 9) +#define M5206E_IMR_TIMER2 (1 << 10) +#define M5206E_IMR_MBUS (1 << 11) +#define M5206E_IMR_UART1 (1 << 12) +#define M5206E_IMR_UART2 (1 << 13) +#define M5206E_IMR_DMA0 (1 << 14) +#define M5206E_IMR_DMA1 (1 << 15) + +/* chip select mask registers */ +#define M5206E_CS_CSMR_MASK_64k 0x00000000 +#define M5206E_CS_CSMR_MASK_128k 0x00010000 +#define M5206E_CS_CSMR_MASK_256k 0x00030000 +#define M5206E_CS_CSMR_MASK_512k 0x00070000 +#define M5206E_CS_CSMR_MASK_1M 0x000f0000 +#define M5206E_CS_CSMR_MASK_2M 0x001f0000 +#define M5206E_CS_CSMR_MASK_4M 0x003f0000 +#define M5206E_CS_CSMR_MASK_8M 0x007f0000 +#define M5206E_CS_CSMR_MASK_16M 0x00ff0000 +#define M5206E_CS_CSMR_MASK_32M 0x01ff0000 +#define M5206E_CS_CSMR_MASK_64M 0x03ff0000 +#define M5206E_CS_CSMR_MASK_128M 0x07ff0000 +#define M5206E_CS_CSMR_MASK_256M 0x0fff0000 +#define M5206E_CS_CSMR_MASK_512M 0x1fff0000 +#define M5206E_CS_CSMR_MASK_1G 0x3fff0000 +#define M5206E_CS_CSMR_MASK_2G 0x7fff0000 +#define M5206E_CS_CSMR_MASK_4G 0xffff0000 +#define M5206E_CS_CSMR_CI (1 << 5) /* /CS1 only */ +#define M5206E_CS_CSMR_SC (1 << 4) +#define M5206E_CS_CSMR_SD (1 << 3) +#define M5206E_CS_CSMR_UC (1 << 2) +#define M5206E_CS_CSMR_UD (1 << 1) + +/* chip select control regs (CSCR) & default mem control reg (DMCR) */ +#define M5206E_CS_CSCR_WS(n) ((n) << 10) /* wait-states */ +#define M5206E_CS_CSCR_WS_15 M5206E_CS_CSCR_WS(15) +#define M5206E_CS_CSCR_WS_14 M5206E_CS_CSCR_WS(14) +#define M5206E_CS_CSCR_WS_13 M5206E_CS_CSCR_WS(13) +#define M5206E_CS_CSCR_WS_12 M5206E_CS_CSCR_WS(12) +#define M5206E_CS_CSCR_WS_11 M5206E_CS_CSCR_WS(11) +#define M5206E_CS_CSCR_WS_10 M5206E_CS_CSCR_WS(10) +#define M5206E_CS_CSCR_WS_9 M5206E_CS_CSCR_WS(9) +#define M5206E_CS_CSCR_WS_8 M5206E_CS_CSCR_WS(8) +#define M5206E_CS_CSCR_WS_7 M5206E_CS_CSCR_WS(7) +#define M5206E_CS_CSCR_WS_6 M5206E_CS_CSCR_WS(6) +#define M5206E_CS_CSCR_WS_5 M5206E_CS_CSCR_WS(5) +#define M5206E_CS_CSCR_WS_4 M5206E_CS_CSCR_WS(4) +#define M5206E_CS_CSCR_WS_3 M5206E_CS_CSCR_WS(3) +#define M5206E_CS_CSCR_WS_2 M5206E_CS_CSCR_WS(2) +#define M5206E_CS_CSCR_WS_1 M5206E_CS_CSCR_WS(1) +#define M5206E_CS_CSCR_WS_0 M5206E_CS_CSCR_WS(0) +#define M5206E_CS_CSCR_BRST (1 << 9) /* allow burst access */ +#define M5206E_CS_CSCR_AA (1 << 8) /* auto-acknowledge */ +#define M5206E_CS_CSCR_PS_32 (0 << 6) /* 32-bit port size */ +#define M5206E_CS_CSCR_PS_8 (1 << 6) /* 8-bit port size */ +#define M5206E_CS_CSCR_PS_16 (2 << 6) /* 16-bit port size */ +#define M5206E_CS_CSCR_EMAA (1 << 5) /* alternate master auto-ack */ +#define M5206E_CS_CSCR_ASET (1 << 4) /* address setup enable */ +#define M5206E_CS_CSCR_WRAH (1 << 3) /* write address hold enable */ +#define M5206E_CS_CSCR_RDAH (1 << 2) /* read address hold enable */ +#define M5206E_CS_CSCR_WR (1 << 1) /* write enable */ +#define M5206E_CS_CSCR_RD (1 << 0) /* read enable */ + +/* DRAM Controller Timing Register (DCTR) */ +#define M5206E_DCTR_DAEM (1 << 15) /* drive multiplexed addr */ +#define M5206E_DCTR_EDO (1 << 14) /* EDO enable */ +#define M5206E_DCTR_RCD (1 << 12) /* RAS-to-CAS delay */ +#define M5206E_DCTR_RSH1 (1 << 10) /* RAS hold time */ +#define M5206E_DCTR_RSH0 (1 << 9) /* RAS hold time */ +#define M5206E_DCTR_RP1 (1 << 6) /* RAS precharge time */ +#define M5206E_DCTR_RP0 (1 << 5) /* RAS prechange time */ +#define M5206E_DCTR_CAS (1 << 3) /* CAS time */ +#define M5206E_DCTR_CP (1 << 1) /* CAS precharge time */ +#define M5206E_DCTR_CSR (1 << 0) /* CAS setup time */ + +/* dram controller mask registers */ +#define M5206E_DCMR_MASK_128k 0x00000000 +#define M5206E_DCMR_MASK_256k 0x00020000 +#define M5206E_DCMR_MASK_512k 0x00060000 +#define M5206E_DCMR_MASK_1M 0x000e0000 +#define M5206E_DCMR_MASK_2M 0x001e0000 +#define M5206E_DCMR_MASK_4M 0x003e0000 +#define M5206E_DCMR_MASK_8M 0x007e0000 +#define M5206E_DCMR_MASK_16M 0x00fe0000 +#define M5206E_DCMR_MASK_32M 0x01fe0000 +#define M5206E_DCMR_MASK_64M 0x03fe0000 +#define M5206E_DCMR_MASK_128M 0x07fe0000 +#define M5206E_DCMR_MASK_256M 0x0ffe0000 +#define M5206E_DCMR_MASK_512M 0x1ffe0000 +#define M5206E_DCMR_MASK_1G 0x3ffe0000 +#define M5206E_DCMR_MASK_2G 0x7ffe0000 +#define M5206E_DCMR_MASK_4G 0xfffe0000 +#define M5206E_DCMR_SC (1 << 4) +#define M5206E_DCMR_SD (1 << 3) +#define M5206E_DCMR_UC (1 << 2) +#define M5206E_DCMR_UD (1 << 1) + +/* DRAM Controller Control Register */ +#define M5206E_DCCR_PS_32 (0 << 6) /* 32-bit port size */ +#define M5206E_DCCR_PS_8 (1 << 6) /* 8-bit port size */ +#define M5206E_DCCR_PS_16 (3 << 6) /* 16-bit port size */ +#define M5206E_DCCR_BPS_512B (0 << 4) /* 512byte bank page size */ +#define M5206E_DCCR_BPS_1K (1 << 4) /* 1Kb bank page size */ +#define M5206E_DCCR_BPS_2K (2 << 4) /* 2Kb bank page size */ +#define M5206E_DCCR_MODE_NORMAL (0 << 2) /* normal page mode */ +#define M5206E_DCCR_MODE_BURST (1 << 2) /* burst page mode */ +#define M5206E_DCCR_MODE_FAST (3 << 2) /* fast page mode */ +#define M5206E_DCCR_WR (1 << 1) /* Signal on write xfer */ +#define M5206E_DCCR_RD (1 << 0) /* Signal on read xfer */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm5206eh */ diff --git a/h/drv/multi/m5272.h b/h/drv/multi/m5272.h new file mode 100644 index 0000000..9ffa194 --- /dev/null +++ b/h/drv/multi/m5272.h @@ -0,0 +1,541 @@ +/* m5272.h - Motorola MCF5272 CPU control registers */ + +/* Copyright 1994-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,20mar01,hjg Created from m5206e.h +*/ + +/* +This file contains I/O addresses and related constants for the MCF5272 +*/ + +#ifndef __INCm5272h +#define __INCm5272h + +#ifdef __cplusplus +extern "C" { +#endif + +/* +Need to use a distinct cast macro in order to not conflict with other +include files. +*/ + +#ifdef _ASMLANGUAGE +#define CAST_M5272(x) +#else /* _ASMLANGUAGE */ +#define CAST_M5272(x) (x) +#endif /* _ASMLANGUAGE */ + +/* Size of internal SRAM */ + +#define M5272_SRAM_SIZE 4096 /* size of internal SRAM */ + +/* System Integration Module register addresses */ +#define M5272_SIM_MBAR(base) (CAST_M5272(volatile UINT32 *)((base) + 0x000)) +#define M5272_SIM_SCR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x004)) +#define M5272_SIM_SPR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x006)) +#define M5272_SIM_PMR(base) (CAST_M5272(volatile UINT32 *)((base) + 0x008)) +#define M5272_SIM_ALPR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x00e)) +#define M5272_SIM_DIR(base) (CAST_M5272(volatile UINT32 *)((base) + 0x010)) + +#define M5272_SIM_MBAR_BA (0xffff << 16) /* base address */ +#define M5272_SIM_MBAR_SC (1 << 4) /* set masks supervisor code */ +#define M5272_SIM_MBAR_SD (1 << 3) /* set masks supervisor data */ +#define M5272_SIM_MBAR_UC (1 << 2) /* set masks user code */ +#define M5272_SIM_MBAR_UD (1 << 1) /* set masks user data */ +#define M5272_SIM_MBAR_V (1 << 0) /* settings are valid */ + +#define M5272_SIM_SCR_RSTSRC (3 << 12) /* reset source */ +#define M5272_SIM_SCR_Priority (1 << 8) /* select bus priority scheme */ +#define M5272_SIM_SCR_AR (1 << 7) /* assume request */ +#define M5272_SIM_SCR_SoftRST (1 << 6) /* reset on-chip peripherals */ +#define M5272_SIM_SCR_BusLock (1 << 3) /* lock ownership of the bus */ +#define M5272_SIM_SCR_HWR_128 (0x0) /* hw watchdog 128 clocks */ +#define M5272_SIM_SCR_HWR_256 (0x1) /* hw watchdog 256 clocks */ +#define M5272_SIM_SCR_HWR_512 (0x2) /* hw watchdog 512 clocks */ +#define M5272_SIM_SCR_HWR_1024 (0x3) /* hw watchdog 1024 clocks */ +#define M5272_SIM_SCR_HWR_2048 (0x4) /* hw watchdog 2048 clocks */ +#define M5272_SIM_SCR_HWR_4096 (0x5) /* hw watchdog 4096 clocks */ +#define M5272_SIM_SCR_HWR_8192 (0x6) /* hw watchdog 8192 clocks */ +#define M5272_SIM_SCR_HWR_16384 (0x7) /* hw watchdog 16384 clocks */ + +#define M5272_SIM_SPR_ADC (1 << 15) /* addr decode conflict */ +#define M5272_SIM_SPR_WPV (1 << 14) /* wr protect violation */ +#define M5272_SIM_SPR_SMV (1 << 13) /* stopped module viol */ +#define M5272_SIM_SPR_PE (1 << 12) /* peripheral error */ +#define M5272_SIM_SPR_HWT (1 << 11) /* hw watchdog timer */ +#define M5272_SIM_SPR_RPV (1 << 10) /* read protect viol */ +#define M5272_SIM_SPR_EXT (1 << 9) /* extern. transf. err. */ +#define M5272_SIM_SPR_SUV (1 << 8) /* superv./user viol */ +#define M5272_SIM_SPR_ADCEN (1 << 7) /* addr decode conflict, excp */ +#define M5272_SIM_SPR_WPVEN (1 << 6) /* wr protect violation, excp */ +#define M5272_SIM_SPR_SMVEN (1 << 5) /* stopped module viol, excp */ +#define M5272_SIM_SPR_PEVEN (1 << 4) /* peripheral error, excp */ +#define M5272_SIM_SPR_HWTEN (1 << 3) /* hw watchdog timer, excp */ +#define M5272_SIM_SPR_RPVEN (1 << 2) /* read protect viol, excp */ +#define M5272_SIM_SPR_EXTEN (1 << 1) /* extern. transf. err., excp */ +#define M5272_SIM_SPR_SUVEN (1 << 0) /* superv./user viol, excp */ + +#define M5272_SIM_PMR_BDMPDN (1 << 31) /* debug power-down enable */ +#define M5272_SIM_PMR_ENETPDN (1 << 26) /* ethernet power-down enable */ +#define M5272_SIM_PMR_PLIPDN (1 << 25) /* PLIC power-down enable */ +#define M5272_SIM_PMR_DRAMPDN (1 << 24) /* DRAM contr. pwrdwn enable */ +#define M5272_SIM_PMR_DMAPDN (1 << 23) /* DMA contr. pwrdwn enable */ +#define M5272_SIM_PMR_PWMPDN (1 << 22) /* PWM power-down enable */ +#define M5272_SIM_PMR_QSPIPDN (1 << 21) /* QSPI power-down enable */ +#define M5272_SIM_PMR_TIMERPDN (1 << 20) /* timer power-down enable */ +#define M5272_SIM_PMR_GPIOPDN (1 << 19) /* Parallel port pwrdwn enable*/ +#define M5272_SIM_PMR_USBPDN (1 << 18) /* USB power-down enable */ +#define M5272_SIM_PMR_UART1PDN (1 << 17) /* UART1 power-down enable */ +#define M5272_SIM_PMR_UART0PDN (1 << 16) /* UART0 power-down enable */ +#define M5272_SIM_PMR_USBWK (1 << 10) /* USB wakeup enable */ +#define M5272_SIM_PMR_UART1WK (1 << 9) /* UART1 wakeup enable */ +#define M5272_SIM_PMR_UART0WK (1 << 8) /* UART0 wakeup enable */ +#define M5272_SIM_PMR_MOS (1 << 5) /* main oscillator stop */ +#define M5272_SIM_PMR_SLPEN (1 << 4) /* sleep enable */ + +#define M5272_SIM_DIR_VERSION (0xf << 28) /* version number */ +#define M5272_SIM_DIR_DSGNCNTR (0x3f << 22) /* design center */ +#define M5272_SIM_DIR_DEVNR (0x3ff << 12) /* device number */ +#define M5272_SIM_DIR_JEDEC (0xfff << 1) /* reduced Motorola-JEDEC-ID */ + +/* Interrupt Controller Registers */ +#define M5272_SIM_ICR1(base) (CAST_M5272(volatile UINT32 *)((base) + 0x020)) +#define M5272_SIM_ICR2(base) (CAST_M5272(volatile UINT32 *)((base) + 0x024)) +#define M5272_SIM_ICR3(base) (CAST_M5272(volatile UINT32 *)((base) + 0x028)) +#define M5272_SIM_ICR4(base) (CAST_M5272(volatile UINT32 *)((base) + 0x02c)) +#define M5272_SIM_ISR(base) (CAST_M5272(volatile UINT32 *)((base) + 0x030)) +#define M5272_SIM_PITR(base) (CAST_M5272(volatile UINT32 *)((base) + 0x034)) +#define M5272_SIM_PIWR(base) (CAST_M5272(volatile UINT32 *)((base) + 0x038)) +#define M5272_SIM_PIVR(base) (CAST_M5272(volatile UINT8 *)((base) + 0x03f)) + +#define M5272_SIM_PITR_POS_EDGE (0x00000000) /* positive edge triggered */ +#define M5272_SIM_PITR_NEG_EDGE (0xf0000060) /* negative edge triggered */ + +/* Chip Select Registers */ +#define M5272_CS_CSBR0(base) (CAST_M5272(volatile UINT32 *)((base) + 0x040)) +#define M5272_CS_CSOR0(base) (CAST_M5272(volatile UINT32 *)((base) + 0x044)) +#define M5272_CS_CSBR1(base) (CAST_M5272(volatile UINT32 *)((base) + 0x048)) +#define M5272_CS_CSOR1(base) (CAST_M5272(volatile UINT32 *)((base) + 0x04c)) +#define M5272_CS_CSBR2(base) (CAST_M5272(volatile UINT32 *)((base) + 0x050)) +#define M5272_CS_CSOR2(base) (CAST_M5272(volatile UINT32 *)((base) + 0x054)) +#define M5272_CS_CSBR3(base) (CAST_M5272(volatile UINT32 *)((base) + 0x058)) +#define M5272_CS_CSOR3(base) (CAST_M5272(volatile UINT32 *)((base) + 0x05c)) +#define M5272_CS_CSBR4(base) (CAST_M5272(volatile UINT32 *)((base) + 0x060)) +#define M5272_CS_CSOR4(base) (CAST_M5272(volatile UINT32 *)((base) + 0x064)) +#define M5272_CS_CSBR5(base) (CAST_M5272(volatile UINT32 *)((base) + 0x068)) +#define M5272_CS_CSOR5(base) (CAST_M5272(volatile UINT32 *)((base) + 0x06c)) +#define M5272_CS_CSBR6(base) (CAST_M5272(volatile UINT32 *)((base) + 0x070)) +#define M5272_CS_CSOR6(base) (CAST_M5272(volatile UINT32 *)((base) + 0x074)) +#define M5272_CS_CSBR7(base) (CAST_M5272(volatile UINT32 *)((base) + 0x078)) +#define M5272_CS_CSOR7(base) (CAST_M5272(volatile UINT32 *)((base) + 0x07c)) + +#define M5272_CS_CSBR_BA (0xfffff << 12) /* base address */ +#define M5272_CS_CSBR_EBI (3 << 10) /* ext. bus interface modes */ +#define M5272_CS_CSBR_BW (3 << 8) /* bus width */ +#define M5272_CS_CSBR_SUPER (1 << 7) /* supervisor mode */ +#define M5272_CS_CSBR_TT (3 << 5) /* transfer type */ +#define M5272_CS_CSBR_TM (7 << 2) /* transfer modifier */ +#define M5272_CS_CSBR_CTM (1 << 1) /* compare TM */ +#define M5272_CS_CSBR_ENABLE (1 << 0) /* enable/disable chip select */ + +#define M5272_CS_CSBR_BW_LONGW (0x0 << 8) /* bus width = 32 bit */ +#define M5272_CS_CSBR_BW_BYTE (0x1 << 8) /* bus width = 8 bit */ +#define M5272_CS_CSBR_BW_WORD (0x2 << 8) /* bus width = 16 bit */ +#define M5272_CS_CSBR_BW_LINE (0x3 << 8) /* bus width = cache line (32)*/ +#define M5272_CS_CSBR_EBI_1632 (0x0 << 10) /* 16/32 bit SRAM/ROM */ +#define M5272_CS_CSBR_EBI_SDRAM (0x1 << 10) /* SDRAM (CS7 only) */ +#define M5272_CS_CSBR_EBI_8 (0x3 << 10) /* 8 bit SRAM/ROM */ + +#define M5272_CS_CSOR_BAM (0xfffff << 12) /* address mask */ +#define M5272_CS_CSOR_ASET (1 << 11) /* address setup enable */ +#define M5272_CS_CSOR_WRAH (1 << 10) /* write address hold enable */ +#define M5272_CS_CSOR_RDAH (1 << 9) /* read address hold enable */ +#define M5272_CS_CSOR_EXTBURST (1 << 8) /* enable extended burst */ +#define M5272_CS_CSOR_WS(a) (((a)&0x1f)<<2) /* wait state generator */ +#define M5272_CS_CSOR_RW (1 << 1) /* RW and MRW determine if */ +#define M5272_CS_CSOR_MRW (1 << 0) /* read only or write only */ + +#define M5272_CS_CSOR_BAM_32M (0xfe000000) +#define M5272_CS_CSOR_BAM_16M (0xff000000) +#define M5272_CS_CSOR_BAM_8M (0xff800000) +#define M5272_CS_CSOR_BAM_4M (0xffc00000) +#define M5272_CS_CSOR_BAM_2M (0xffe00000) +#define M5272_CS_CSOR_BAM_1M (0xfff00000) +#define M5272_CS_CSOR_BAM_512K (0xfff80000) +#define M5272_CS_CSOR_BAM_256K (0xfffc0000) +#define M5272_CS_CSOR_BAM_128K (0xfffe0000) +#define M5272_CS_CSOR_BAM_64K (0xffff0000) +#define M5272_CS_CSOR_BAM_32K (0xffff8000) +#define M5272_CS_CSOR_BAM_16K (0xffffc000) +#define M5272_CS_CSOR_BAM_8K (0xffffe000) +#define M5272_CS_CSOR_BAM_4K (0xfffff000) + +/* Software Watchdog Registers */ +#define M5272_SIM_WRRR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x282)) +#define M5272_SIM_WIRR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x286)) +#define M5272_SIM_WCR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x28a)) +#define M5272_SIM_WER(base) (CAST_M5272(volatile UINT16 *)((base) + 0x28e)) + +#define M5272_SIM_WRRR_REF (0x7fff << 1) /* reference value */ +#define M5272_SIM_WRRR_EN (1 << 0) /* enable watchdog */ + +#define M5272_SIM_WIRR_REF (0x7fff << 1) /* reference value */ +#define M5272_SIM_WIRR_IEN (1 << 0) /* enable interrupt */ + +#define M5272_SIM_WCR_COUNT (0xffff << 0) /* counter value */ + +#define M5272_SIM_WER_WIE (1 << 0) /* watchdog interrupt event */ + +/* GPIO Port Register Memory Map */ +#define M5272_GPIO_PACNT(base) (CAST_M5272(volatile UINT32 *)((base) + 0x080)) +#define M5272_GPIO_PADDR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x084)) +#define M5272_GPIO_PADAT(base) (CAST_M5272(volatile UINT16 *)((base) + 0x086)) +#define M5272_GPIO_PBCNT(base) (CAST_M5272(volatile UINT32 *)((base) + 0x088)) +#define M5272_GPIO_PBDDR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x08c)) +#define M5272_GPIO_PBDAT(base) (CAST_M5272(volatile UINT16 *)((base) + 0x08e)) +#define M5272_GPIO_PCDDR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x094)) +#define M5272_GPIO_PCDAT(base) (CAST_M5272(volatile UINT16 *)((base) + 0x096)) +#define M5272_GPIO_PDCNT(base) (CAST_M5272(volatile UINT32 *)((base) + 0x098)) + +#define M5272_GPIO_PACNT_PACNT15 (3 << 30) /* configure pin M3 */ +#define M5272_GPIO_PACNT_PACNT14 (3 << 28) /* configure pin M2 */ +#define M5272_GPIO_PACNT_PACNT13 (3 << 26) /* configure pin L3 */ +#define M5272_GPIO_PACNT_PACNT12 (3 << 24) /* configure pin L2 */ +#define M5272_GPIO_PACNT_PACNT11 (3 << 22) /* configure pin L1 */ +#define M5272_GPIO_PACNT_PACNT10 (3 << 20) /* configure pin K5 */ +#define M5272_GPIO_PACNT_PACNT9 (3 << 18) /* configure pin J3 */ +#define M5272_GPIO_PACNT_PACNT8 (3 << 16) /* configure pin J2 */ +#define M5272_GPIO_PACNT_PACNT7 (3 << 14) /* configure pin P1 */ +#define M5272_GPIO_PACNT_PACNT6 (3 << 12) /* configure pin E1 */ +#define M5272_GPIO_PACNT_PACNT5 (3 << 10) /* configure pin E2 */ +#define M5272_GPIO_PACNT_PACNT4 (3 << 8) /* configure pin E3 */ +#define M5272_GPIO_PACNT_PACNT3 (3 << 6) /* configure pin E4 */ +#define M5272_GPIO_PACNT_PACNT2 (3 << 4) /* configure pin E5 */ +#define M5272_GPIO_PACNT_PACNT1 (3 << 2) /* configure pin D1 */ +#define M5272_GPIO_PACNT_PACNT0 (3 << 0) /* configure pin D2 */ + +#define M5272_GPIO_PBCNT_PBCNT15 (3 << 30) /* configure pin P10 */ +#define M5272_GPIO_PBCNT_PBCNT14 (3 << 28) /* configure pin L9 */ +#define M5272_GPIO_PBCNT_PBCNT13 (3 << 26) /* configure pin M9 */ +#define M5272_GPIO_PBCNT_PBCNT12 (3 << 24) /* configure pin N9 */ +#define M5272_GPIO_PBCNT_PBCNT11 (3 << 22) /* configure pin P9 */ +#define M5272_GPIO_PBCNT_PBCNT10 (3 << 20) /* configure pin L8 */ +#define M5272_GPIO_PBCNT_PBCNT9 (3 << 18) /* configure pin M8 */ +#define M5272_GPIO_PBCNT_PBCNT8 (3 << 16) /* configure pin N8 */ +#define M5272_GPIO_PBCNT_PBCNT7 (3 << 14) /* configure pin M6 */ +#define M5272_GPIO_PBCNT_PBCNT6 (3 << 12) /* configure pin G4 */ +#define M5272_GPIO_PBCNT_PBCNT5 (3 << 10) /* configure pin F3 */ +#define M5272_GPIO_PBCNT_PBCNT4 (3 << 8) /* configure pin G3 */ +#define M5272_GPIO_PBCNT_PBCNT3 (3 << 6) /* configure pin H3 */ +#define M5272_GPIO_PBCNT_PBCNT2 (3 << 4) /* configure pin H2 */ +#define M5272_GPIO_PBCNT_PBCNT1 (3 << 2) /* configure pin H1 */ +#define M5272_GPIO_PBCNT_PBCNT0 (3 << 0) /* configure pin H4 */ + +#define M5272_GPIO_PDCNT_PDCNT7 (3 << 14) /* configure pin K6 */ +#define M5272_GPIO_PDCNT_PDCNT6 (3 << 12) /* configure pin P5 */ +#define M5272_GPIO_PDCNT_PDCNT5 (3 << 10) /* configure pin P2 */ +#define M5272_GPIO_PDCNT_PDCNT4 (3 << 8) /* configure pin K1 */ +#define M5272_GPIO_PDCNT_PDCNT3 (3 << 6) /* configure pin K3 */ +#define M5272_GPIO_PDCNT_PDCNT2 (3 << 4) /* configure pin K2 */ +#define M5272_GPIO_PDCNT_PDCNT1 (3 << 2) /* configure pin K1 */ +#define M5272_GPIO_PDCNT_PDCNT0 (3 << 0) /* configure pin J4 */ + +/* QSPI Module Memory Map */ +#define M5272_QSPI_QMR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x0a0)) +#define M5272_QSPI_QDLYR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x0a4)) +#define M5272_QSPI_QWR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x0a8)) +#define M5272_QSPI_QIR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x0ac)) +#define M5272_QSPI_QAR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x0b0)) +#define M5272_QSPI_QDR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x0b4)) + +/* PWM Module Memory Map */ +#define M5272_PWM_PWCR1(base) (CAST_M5272(volatile UINT8 *)((base) + 0x0c0)) +#define M5272_PWM_PWCR2(base) (CAST_M5272(volatile UINT8 *)((base) + 0x0c4)) +#define M5272_PWM_PWCR3(base) (CAST_M5272(volatile UINT8 *)((base) + 0x0c8)) +#define M5272_PWM_PWWD1(base) (CAST_M5272(volatile UINT8 *)((base) + 0x0d0)) +#define M5272_PWM_PWWD2(base) (CAST_M5272(volatile UINT8 *)((base) + 0x0d4)) +#define M5272_PWM_PWWD3(base) (CAST_M5272(volatile UINT8 *)((base) + 0x0d8)) + +/* DMA Module Memory Map */ +#define M5272_DMA_DMR(base) (CAST_M5272(volatile UINT32 *)((base) + 0x0e0)) +#define M5272_DMA_DIR(base) (CAST_M5272(volatile UINT32 *)((base) + 0x0e6)) +#define M5272_DMA_DBCR(base) (CAST_M5272(volatile UINT32 *)((base) + 0x0e8)) +#define M5272_DMA_DSAR(base) (CAST_M5272(volatile UINT32 *)((base) + 0x0ec)) +#define M5272_DMA_DDAR(base) (CAST_M5272(volatile UINT32 *)((base) + 0x0f0)) + +#define M5272_DMA_DMR_RESET (1 << 31) /* reset */ +#define M5272_DMA_DMR_EN (1 << 30) /* enable */ +#define M5272_DMA_DMR_RQM (3 << 18) /* request mode */ +#define M5272_DMA_DMR_DSTM (3 << 13) /* dest. addressing mode */ +#define M5272_DMA_DMR_DSTT (7 << 10) /* dest. addressing type */ +#define M5272_DMA_DMR_DSTS (3 << 8) /* dest. data transfer type */ +#define M5272_DMA_DMR_SRCM (1 << 5) /* source addressing mode */ +#define M5272_DMA_DMR_SRCT (7 << 2) /* source addressing type */ +#define M5272_DMA_DMR_SRCS (3 << 0) /* source data transfer type */ + +#define M5272_DMA_DIR_INVEN (1 << 12) /* inval. combin. interrupt */ +#define M5272_DMA_DIR_ASCEN (1 << 11) /* addr. seq. compl. interr. */ +#define M5272_DMA_DIR_TEEN (1 << 9) /* Transfer error interrupt */ +#define M5272_DMA_DIR_TCEN (1 << 8) /* Transfer compl. interrupt */ +#define M5272_DMA_DIR_INV (1 << 4) /* invalid combination */ +#define M5272_DMA_DIR_ASC (1 << 3) /* addr. sequence complete */ +#define M5272_DMA_DIR_TE (1 << 1) /* transfer error */ +#define M5272_DMA_DIR_TC (1 << 0) /* transfer complete */ + +/* UART 0 & 1 */ +#define M5272_UART_REG(base, offset, chan) \ + ((base) + (offset) + ((chan) * 0x40)) +#define M5272_UART_UMR1(base, n) \ + (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x100, n)) +#define M5272_UART_UMR2(base, n) \ + (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x100, n)) +#define M5272_UART_USR(base, n) \ + (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x104, n)) +#define M5272_UART_UCSR(base, n) \ + (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x104, n)) +#define M5272_UART_UCR(base, n) \ + (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x108, n)) +#define M5272_UART_URB(base, n) \ + (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x10c, n)) +#define M5272_UART_UTB(base, n) \ + (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x10c, n)) +#define M5272_UART_UIPCR(base, n) \ + (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x110, n)) +#define M5272_UART_UACR(base, n) \ + (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x110, n)) +#define M5272_UART_UISR(base, n) \ + (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x114, n)) +#define M5272_UART_UIMR(base, n) \ + (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x114, n)) +#define M5272_UART_UDU(base, n) \ + (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x118, n)) +#define M5272_UART_UDL(base, n) \ + (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x11c, n)) +#define M5272_UART_UABU(base, n) \ + (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x120, n)) +#define M5272_UART_UABL(base, n) \ + (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x124, n)) +#define M5272_UART_UTF(base, n) \ + (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x128, n)) +#define M5272_UART_URF(base, n) \ + (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x12c, n)) +#define M5272_UART_UFPD(base, n) \ + (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x130, n)) +#define M5272_UART_UIP(base, n) \ + (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x134, n)) +#define M5272_UART_UOP1(base, n) \ + (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x138, n)) +#define M5272_UART_UOP0(base, n) \ + (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x13c, n)) + +#define M5272_UART_UMR1_RxRTS (1 << 7) /* receiver request-to-send */ +#define M5272_UART_UMR1_RxIRQ_FFULL (1 << 6) /* rec. interr. sel. */ +#define M5272_UART_UMR1_ERR (1 << 5) /* error mode-to-send */ +#define M5272_UART_UMR1_PM (3 << 3) /* parity mode */ +#define M5272_UART_UMR1_PT (1 << 2) /* parity type */ +#define M5272_UART_UMR1_B_C (3 << 0) /* bits per character */ + +#define M5272_UART_UMR2_CM (3 << 6) /* channel mode */ +#define M5272_UART_UMR2_TxRTS (1 << 5) /* transmitter ready-to-send */ +#define M5272_UART_UMR2_TxCTS (1 << 4) /* transmitter clear-to-send */ +#define M5272_UART_UMR2_SB (0xf << 0) /* stop-bit length control */ + +#define M5272_UART_USR_RB (1 << 7) /* received break */ +#define M5272_UART_USR_FE (1 << 6) /* framing error */ +#define M5272_UART_USR_PE (1 << 5) /* parity error */ +#define M5272_UART_USR_OE (1 << 4) /* overrun error */ +#define M5272_UART_USR_TxEMP (1 << 3) /* transmitter empty */ +#define M5272_UART_USR_TxRDY (1 << 2) /* transmitter ready */ +#define M5272_UART_USR_FFULL (1 << 1) /* FIFO full */ +#define M5272_UART_USR_RxRDY (1 << 0) /* receiver ready */ + +#define M5272_UART_UCSR_RCS (0xf << 4) /* receiver clock select */ +#define M5272_UART_UCSR_TCS (0xf << 0) /* transmitter clock select */ + +#define M5272_UART_UCR_ENAB (1 << 7) /* enable autobaud */ +#define M5272_UART_UCR_MISC (7 << 4) /* misc field */ +#define M5272_UART_UCR_TC (3 << 2) /* TC field */ +#define M5272_UART_UCR_RC (3 << 0) /* RC field */ + +#define M5272_UART_UIPCR_COS (1 << 4) /* change of state */ +#define M5272_UART_UIPCR_CTS (1 << 0) /* current state */ + +#define M5272_UART_UACR_RTSL (3 << 1) /* /RTS level */ +#define M5272_UART_UACR_IEC (1 << 0) /* input enable control */ + +#define M5272_UART_UISR_UIMR_COS (1 << 7) /* change of state */ +#define M5272_UART_UISR_UIMR_ABC (1 << 6) /* autobaud calc. */ +#define M5272_UART_UISR_UIMR_RxFIFO (1 << 5) /* rec. FIFO status */ +#define M5272_UART_UISR_UIMR_TxFIFO (1 << 4) /* trans. FIFO status */ +#define M5272_UART_UISR_UIMR_RxFTO (1 << 3) /* rec. FIFO timeout */ +#define M5272_UART_UISR_UIMR_DB (1 << 2) /* delta break */ +#define M5272_UART_UISR_UIMR_FFULL_RxRDY (1 << 1) /* FFULL/RxRDY*/ +#define M5272_UART_UISR_UIMR_TxRDY (1 << 0) /* transmitter ready */ + +#define M5272_UART_UTF_TXS (3 << 6) /* transmitter status */ +#define M5272_UART_UTF_FULL (1 << 5) /* transmitter FIFO full */ +#define M5272_UART_UTF_TXB (0x1f << 0) /* transmitter buf data level */ + +#define M5272_UART_URF_RXS (3 << 6) /* receiver status */ +#define M5272_UART_URF_FULL (1 << 5) /* receiver FIFO full */ +#define M5272_UART_URF_RXB (0x1f << 0) /* receiver buf data level */ + +/* SDRAM Controller Memory Map */ +#define M5272_SDRAM_SDCR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x180)) +#define M5272_SDRAM_SDTR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x184)) + +/* SDCR - SDRAM Configuration register */ +#define M5272_SDRAM_SDCR_MCAS (3 << 13) /* Maximum CAS address */ +#define M5272_SDRAM_SDCR_MCAS_A7 (0 << 13) +#define M5272_SDRAM_SDCR_MCAS_A8 (1 << 13) +#define M5272_SDRAM_SDCR_MCAS_A9 (2 << 13) +#define M5272_SDRAM_SDCR_MCAS_A10 (3 << 13) +#define M5272_SDRAM_SDCR_BALOC (7 << 8) /* Bank address location */ +#define M5272_SDRAM_SDCR_BALOC_A20 (1 << 8) /* SDBA0 = A20, SDBA1 = A21 */ +#define M5272_SDRAM_SDCR_BALOC_A21 (2 << 8) /* SDBA0 = A21, SDBA1 = A22 */ +#define M5272_SDRAM_SDCR_BALOC_A22 (3 << 8) /* SDBA0 = A22, SDBA1 = A23 */ +#define M5272_SDRAM_SDCR_BALOC_A23 (4 << 8) /* SDBA0 = A23, SDBA1 = A24 */ +#define M5272_SDRAM_SDCR_BALOC_A24 (5 << 8) /* SDBA0 = A24, SDBA1 = A25 */ +#define M5272_SDRAM_SDCR_GSL (1 << 7) /* Go to sleep */ +#define M5272_SDRAM_SDCR_REG (1 << 4) /* Register read data */ +#define M5272_SDRAM_SDCR_INV (1 << 3) /* Invert clock */ +#define M5272_SDRAM_SDCR_SLEEP (1 << 2) /* Sleep mode */ +#define M5272_SDRAM_SDCR_ACT (1 << 1) /* Active */ +#define M5272_SDRAM_SDCR_INIT (1 << 0) /* Initialisation enable */ + +/* SDTR - SDRAM Timing Register */ +#define M5272_SDRAM_SDTR_RTP 0xfc00 /* Refresh timing prescalar */ +#define M5272_SDRAM_SDTR_RTP_66 (61 << 10) /* 66MHz */ +#define M5272_SDRAM_SDTR_RTP_48 (43 << 10) /* 48MHz */ +#define M5272_SDRAM_SDTR_RTP_33 (29 << 10) /* 33MHz */ +#define M5272_SDRAM_SDTR_RTP_25 (22 << 10) /* 25MHz */ +#define M5272_SDRAM_SDTR_RTP_5 (4 << 10) /* 5MHz (emulator) */ +#define M5272_SDRAM_SDTR_RC (3 << 8) /* Refresh count */ +#define M5272_SDRAM_SDTR_RC_5 (0 << 8) /* 5 cycles */ +#define M5272_SDRAM_SDTR_RC_6 (1 << 8) /* 6 cycles */ +#define M5272_SDRAM_SDTR_RC_7 (2 << 8) /* 7 cycles */ +#define M5272_SDRAM_SDTR_RC_8 (3 << 8) /* 8 cycles */ +#define M5272_SDRAM_SDTR_RP (3 << 4) /* Precharge time */ +#define M5272_SDRAM_SDTR_RP_1 (0 << 4) /* 1 cycles */ +#define M5272_SDRAM_SDTR_RP_2 (1 << 4) /* 2 cycles */ +#define M5272_SDRAM_SDTR_RP_3 (2 << 4) /* 3 cycles */ +#define M5272_SDRAM_SDTR_RP_4 (3 << 4) /* 4 cycles */ +#define M5272_SDRAM_SDTR_RCD (3 << 2) /* RAS-CAS delay */ +#define M5272_SDRAM_SDTR_RCD_1 (0 << 2) /* 1 cycles */ +#define M5272_SDRAM_SDTR_RCD_2 (1 << 2) /* 2 cycles */ +#define M5272_SDRAM_SDTR_RCD_3 (2 << 2) /* 3 cycles */ +#define M5272_SDRAM_SDTR_RCD_4 (3 << 2) /* 4 cycles */ +#define M5272_SDRAM_SDTR_CLT (3 << 0) /* CAS latency */ +#define M5272_SDRAM_SDTR_CLT_2 (1 << 0) /* 2 cycles */ + +/* Timers 0 and 1 */ +#define M5272_TIMER_REG(base, offset, timer) \ + ((base) + ((timer) * 0x20) + (offset)) +#define M5272_TIMER_TMR(base, n) \ + (CAST_M5272(volatile UINT16 *) M5272_TIMER_REG(base, 0x200, n)) +#define M5272_TIMER_TRR(base, n) \ + (CAST_M5272(volatile UINT16 *) M5272_TIMER_REG(base, 0x204, n)) +#define M5272_TIMER_TCR(base, n) \ + (CAST_M5272(volatile UINT16 *) M5272_TIMER_REG(base, 0x208, n)) +#define M5272_TIMER_TCN(base, n) \ + (CAST_M5272(volatile UINT16 *) M5272_TIMER_REG(base, 0x20c, n)) +#define M5272_TIMER_TER(base, n) \ + (CAST_M5272(volatile UINT16 *) M5272_TIMER_REG(base, 0x210, n)) + +#define M5272_TIMER_TMR_PRESCALER (0xffff << 8) /* prescaler */ +#define M5272_TIMER_TMR_CE (3 << 6) /* capture edge */ +#define M5272_TIMER_TMR_OM (1 << 5) /* output mode */ +#define M5272_TIMER_TMR_ORI (1 << 4) /* output reference */ +#define M5272_TIMER_TMR_FRR (1 << 3) /* free run/restart */ +#define M5272_TIMER_TMR_CLK (3 << 1) /* input clock source */ +#define M5272_TIMER_TMR_RST (1 << 0) /* reset timer */ + +#define M5272_TIMER_TER_REF (1 << 1) /* output reference event */ +#define M5272_TIMER_TER_CAP (1 << 0) /* capture event */ + +/* PLIC Module Memory Map */ +#define M5272_PLIC_BASE(base) (CAST_M5272(volatile UINT32 *)((base) + 0x300)) + +/* Ethernet Module Memory Map */ +#define M5272_FEC_BASE(base) (CAST_M5272(volatile UINT32 *)((base) + 0x840)) + +/* USB Module Memory Map */ +#define M5272_USB_BASE(base) (CAST_M5272(volatile UINT32 *)((base) + 0x1000)) + +/* ISR - Interrupt Source Register bit definitions */ +#define M5272_ISR_INT1 (1 << 31) +#define M5272_ISR_INT2 (1 << 30) +#define M5272_ISR_INT3 (1 << 29) +#define M5272_ISR_INT4 (1 << 28) +#define M5272_ISR_TMR1 (1 << 27) +#define M5272_ISR_TMR2 (1 << 26) +#define M5272_ISR_TMR3 (1 << 25) +#define M5272_ISR_TMR4 (1 << 24) +#define M5272_ISR_UART1 (1 << 23) +#define M5272_ISR_UART2 (1 << 22) +#define M5272_ISR_PLI_P (1 << 21) +#define M5272_ISR_PLI_A (1 << 20) +#define M5272_ISR_USB0 (1 << 19) +#define M5272_ISR_USB1 (1 << 18) +#define M5272_ISR_USB2 (1 << 17) +#define M5272_ISR_USB3 (1 << 16) +#define M5272_ISR_USB4 (1 << 15) +#define M5272_ISR_USB5 (1 << 14) +#define M5272_ISR_USB6 (1 << 13) +#define M5272_ISR_USB7 (1 << 12) +#define M5272_ISR_DMA (1 << 11) +#define M5272_ISR_ERx (1 << 10) +#define M5272_ISR_ETx (1 << 9) +#define M5272_ISR_ENTC (1 << 8) +#define M5272_ISR_QSPI (1 << 7) +#define M5272_ISR_INT5 (1 << 6) +#define M5272_ISR_INT6 (1 << 5) +#define M5272_ISR_SWTO (1 << 4) + +/* Interrupt numbers on the 5272 are at fixed positions above + the base value (INT_NUM_BASE) defined in the BSP (config.h.) + INT_NUM_BASE must be a multiple of 32, and not less than 64. +*/ +#define INT_NUM_SPURIOUS (INT_NUM_BASE+0x00) /* reserved */ +#define INT_NUM_INT1 (INT_NUM_BASE+0x01) /* external int 1 */ +#define INT_NUM_INT2 (INT_NUM_BASE+0x02) /* external int 2 */ +#define INT_NUM_INT3 (INT_NUM_BASE+0x03) /* external int 3 */ +#define INT_NUM_INT4 (INT_NUM_BASE+0x04) /* external int 4 */ +#define INT_NUM_TMR1 (INT_NUM_BASE+0x05) /* timer 1 */ +#define INT_NUM_TMR2 (INT_NUM_BASE+0x06) /* timer 2 */ +#define INT_NUM_TMR3 (INT_NUM_BASE+0x07) /* timer 3 */ +#define INT_NUM_TMR4 (INT_NUM_BASE+0x08) /* timer 4 */ +#define INT_NUM_UART1 (INT_NUM_BASE+0x09) /* uart 1 */ +#define INT_NUM_UART2 (INT_NUM_BASE+0x0a) /* uart 2 */ +#define INT_NUM_PLIP (INT_NUM_BASE+0x0b) /* plic 2kHz periodic */ +#define INT_NUM_PLIA (INT_NUM_BASE+0x0c) /* plic async */ +#define INT_NUM_USB0 (INT_NUM_BASE+0x0d) /* usb endpoint 0 */ +#define INT_NUM_USB1 (INT_NUM_BASE+0x0e) /* usb endpoint 1 */ +#define INT_NUM_USB2 (INT_NUM_BASE+0x0f) /* usb endpoint 2 */ +#define INT_NUM_USB3 (INT_NUM_BASE+0x10) /* usb endpoint 3 */ +#define INT_NUM_USB4 (INT_NUM_BASE+0x11) /* usb endpoint 4 */ +#define INT_NUM_USB5 (INT_NUM_BASE+0x12) /* usb endpoint 5 */ +#define INT_NUM_USB6 (INT_NUM_BASE+0x13) /* usb endpoint 6 */ +#define INT_NUM_USB7 (INT_NUM_BASE+0x14) /* usb endpoint 7 */ +#define INT_NUM_DMA (INT_NUM_BASE+0x15) /* dma controller */ +#define INT_NUM_ERX (INT_NUM_BASE+0x16) /* ethernet receiver */ +#define INT_NUM_ETX (INT_NUM_BASE+0x17) /* ethernet transmitter */ +#define INT_NUM_ENTC (INT_NUM_BASE+0x18) /* ethernet module */ +#define INT_NUM_QSPI (INT_NUM_BASE+0x19) /* queued serial i'f */ +#define INT_NUM_INT5 (INT_NUM_BASE+0x1a) /* external int 5 */ +#define INT_NUM_INT6 (INT_NUM_BASE+0x1b) /* external int 6 */ +#define INT_NUM_SWTO (INT_NUM_BASE+0x1c) /* s/w watchdog */ +#define INT_NUM_RES1 (INT_NUM_BASE+0x1d) /* reserved */ +#define INT_NUM_RES2 (INT_NUM_BASE+0x1e) /* reserved */ +#define INT_NUM_RES3 (INT_NUM_BASE+0x1f) /* reserved */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm5272h */ diff --git a/h/drv/multi/m5307.h b/h/drv/multi/m5307.h new file mode 100644 index 0000000..f369bf1 --- /dev/null +++ b/h/drv/multi/m5307.h @@ -0,0 +1,411 @@ +/* m5307.h - Motorola MCF5307 CPU control registers */ + +/* Copyright 1994-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,19sep00,dh added new base address registers for CS2..7 for new 5307s +01a,31mar98,knr written. +*/ + +/* +This file contains I/O addresses and related constants for the MCF5307 +*/ + +#ifndef __INCm5307h +#define __INCm5307h + +#ifdef __cplusplus +extern "C" { +#endif + +/* +Need to use a distinct cast macro in order to not conflict with other +include files. +*/ + +#ifdef _ASMLANGUAGE +#define CAST_M5307(x) +#else /* _ASMLANGUAGE */ +#define CAST_M5307(x) (x) +#endif /* _ASMLANGUAGE */ + +/* Size of internal SRAM */ + +#define M5307_SRAM_SIZE 4096 /* size of SRAM */ +#define M5307_CACHE_SIZE 8192 /* size of cache */ + +/* ACRs (access control registers) */ + +#define M5307_ACR_ADDR_BASE(n) ((n) & 0xff000000) /* region base */ +#define M5307_ACR_ADDR_MASK(n) (((n)>>8) & 0x00ff0000) /* region mask */ +#define M5307_ACR_ENABLE (1 << 15) /* enable ACR */ +#define M5307_ACR_MODE_USER (0 << 13) /* match if user */ +#define M5307_ACR_MODE_SUPER (1 << 13) /* match if supervisor */ +#define M5307_ACR_MODE_ANY (2 << 13) /* match any */ +#define M5307_ACR_WRITETHROUGH (0 << 5) /* cacheable, writethrough */ +#define M5307_ACR_COPYBACK (1 << 5) /* cacheable, copyback */ +#define M5307_ACR_INH_PRECISE (2 << 5) /* cache-inhibited, precise */ +#define M5307_ACR_INH_IMPRECISE (3 << 5) /* cache-inhibited, imprecise*/ +#define M5307_ACR_WP (1 << 2) /* write-protect */ + +/* System Integration Module register addresses */ + +#define M5307_SIM_RSR(base) (CAST_M5307(volatile UINT8 *)((base) + 0x000)) +#define M5307_SIM_SYPCR(base) (CAST_M5307(volatile UINT8 *)((base) + 0x001)) +#define M5307_SIM_SWIVR(base) (CAST_M5307(volatile UINT8 *)((base) + 0x002)) +#define M5307_SIM_SWSR(base) (CAST_M5307(volatile UINT8 *)((base) + 0x003)) + +#define M5307_SIM_PAR(base) (CAST_M5307(volatile UINT16 *)((base) + 0x004)) +#define M5307_SIM_IRQPAR(base) (CAST_M5307(volatile UINT8 *)((base) + 0x006)) +#define M5307_SIM_PLLCR(base) (CAST_M5307(volatile UINT8 *)((base) + 0x008)) +#define M5307_SIM_MPARK(base) (CAST_M5307(volatile UINT8 *)((base) + 0x00c)) + +#define M5307_SIM_IPR(base) (CAST_M5307(volatile UINT32 *)((base) + 0x040)) +#define M5307_SIM_IMR(base) (CAST_M5307(volatile UINT32 *)((base) + 0x044)) + +/* Autovector control */ +#define MCF5307_SIM_AVCR_BLK (1 << 0) +#define MCF5307_SIM_AVCR_AVEC1 (1 << 1) +#define MCF5307_SIM_AVCR_AVEC2 (1 << 2) +#define MCF5307_SIM_AVCR_AVEC3 (1 << 3) +#define MCF5307_SIM_AVCR_AVEC4 (1 << 4) +#define MCF5307_SIM_AVCR_AVEC5 (1 << 5) +#define MCF5307_SIM_AVCR_AVEC6 (1 << 6) +#define MCF5307_SIM_AVCR_AVEC7 (1 << 7) + +#define M5307_SIM_AVCR(base) (CAST_M5307(volatile UINT8 *)((base) + 0x04b)) + +#define M5307_SIM_ICR_SWT(base) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x04c)) +#define M5307_SIM_ICR_TIMER1(base) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x04d)) +#define M5307_SIM_ICR_TIMER2(base) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x04e)) +#define M5307_SIM_ICR_MBUS(base) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x04f)) +#define M5307_SIM_ICR_UART1(base) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x050)) +#define M5307_SIM_ICR_UART2(base) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x051)) +#define M5307_SIM_ICR_DMA0(base) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x052)) +#define M5307_SIM_ICR_DMA1(base) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x053)) +#define M5307_SIM_ICR_DMA2(base) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x054)) +#define M5307_SIM_ICR_DMA3(base) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x055)) +#define M5307_SIM_ICR_ICR10(base) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x056)) +#define M5307_SIM_ICR_ICR11(base) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x057)) + +/* chip-select registers */ + +#define M5307_SIM_CSAR0(base) (CAST_M5307(volatile UINT16 *)((base) + 0x080)) +#define M5307_SIM_CSMR0(base) (CAST_M5307(volatile UINT32 *)((base) + 0x084)) +#define M5307_SIM_CSCR0(base) (CAST_M5307(volatile UINT16 *)((base) + 0x08a)) + +#define M5307_SIM_CSAR1(base) (CAST_M5307(volatile UINT16 *)((base) + 0x08c)) +#define M5307_SIM_CSMR1(base) (CAST_M5307(volatile UINT32 *)((base) + 0x090)) +#define M5307_SIM_CSCR1(base) (CAST_M5307(volatile UINT16 *)((base) + 0x096)) + +#if defined(M5307_MASK_H55J) + +/* Chip select unit on older H55J-mask chips used a single base address + register for CS2-CS7. Also the mask registers were 16-bit wide. +*/ +#define M5307_SIM_CSBAR(base) (CAST_M5307(volatile UINT8 *)((base) + 0x098)) +#define M5307_SIM_CSMR2(base) (CAST_M5307(volatile UINT16 *)((base) + 0x09c)) +#define M5307_SIM_CSCR2(base) (CAST_M5307(volatile UINT16 *)((base) + 0x0a2)) +#define M5307_SIM_CSMR3(base) (CAST_M5307(volatile UINT16 *)((base) + 0x0aa)) +#define M5307_SIM_CSCR3(base) (CAST_M5307(volatile UINT16 *)((base) + 0x0ae)) +#define M5307_SIM_CSMR4(base) (CAST_M5307(volatile UINT16 *)((base) + 0x0b6)) +#define M5307_SIM_CSCR4(base) (CAST_M5307(volatile UINT16 *)((base) + 0x0ba)) +#define M5307_SIM_CSMR5(base) (CAST_M5307(volatile UINT16 *)((base) + 0x0c2)) +#define M5307_SIM_CSCR5(base) (CAST_M5307(volatile UINT16 *)((base) + 0x0c6)) +#define M5307_SIM_CSMR6(base) (CAST_M5307(volatile UINT16 *)((base) + 0x0ce)) +#define M5307_SIM_CSCR6(base) (CAST_M5307(volatile UINT16 *)((base) + 0x0d2)) +#define M5307_SIM_CSMR7(base) (CAST_M5307(volatile UINT16 *)((base) + 0x0da)) +#define M5307_SIM_CSCR7(base) (CAST_M5307(volatile UINT16 *)((base) + 0x0de)) + +#endif + +#if defined(M5307_MASK_J20C) + +/* Chip select unit on newer J20C-mask chips has a base address register for + each chip select. The mask registers are now 32-bits. +*/ +#define M5307_SIM_CSAR2(base) (CAST_M5307(volatile UINT16 *)((base) + 0x098)) +#define M5307_SIM_CSMR2(base) (CAST_M5307(volatile UINT32 *)((base) + 0x09c)) +#define M5307_SIM_CSCR2(base) (CAST_M5307(volatile UINT16 *)((base) + 0x0a2)) + +#define M5307_SIM_CSAR3(base) (CAST_M5307(volatile UINT16 *)((base) + 0x0a4)) +#define M5307_SIM_CSMR3(base) (CAST_M5307(volatile UINT32 *)((base) + 0x0a8)) +#define M5307_SIM_CSCR3(base) (CAST_M5307(volatile UINT16 *)((base) + 0x0ae)) + +#define M5307_SIM_CSAR4(base) (CAST_M5307(volatile UINT16 *)((base) + 0x0b0)) +#define M5307_SIM_CSMR4(base) (CAST_M5307(volatile UINT32 *)((base) + 0x0b4)) +#define M5307_SIM_CSCR4(base) (CAST_M5307(volatile UINT16 *)((base) + 0x0ba)) + +#define M5307_SIM_CSAR5(base) (CAST_M5307(volatile UINT16 *)((base) + 0x0bc)) +#define M5307_SIM_CSMR5(base) (CAST_M5307(volatile UINT32 *)((base) + 0x0c0)) +#define M5307_SIM_CSCR5(base) (CAST_M5307(volatile UINT16 *)((base) + 0x0c6)) + +#define M5307_SIM_CSAR6(base) (CAST_M5307(volatile UINT16 *)((base) + 0x0c8)) +#define M5307_SIM_CSMR6(base) (CAST_M5307(volatile UINT32 *)((base) + 0x0cc)) +#define M5307_SIM_CSCR6(base) (CAST_M5307(volatile UINT16 *)((base) + 0x0d2)) + +#define M5307_SIM_CSAR7(base) (CAST_M5307(volatile UINT16 *)((base) + 0x0d4)) +#define M5307_SIM_CSMR7(base) (CAST_M5307(volatile UINT32 *)((base) + 0x0d8)) +#define M5307_SIM_CSCR7(base) (CAST_M5307(volatile UINT16 *)((base) + 0x0de)) + +#endif + +#define M5307_SIM_DCR(base) (CAST_M5307(volatile UINT16 *)((base) + 0x100)) +#define M5307_SIM_DACR0(base) (CAST_M5307(volatile UINT32 *)((base) + 0x108)) +#define M5307_SIM_DMR0(base) (CAST_M5307(volatile UINT32 *)((base) + 0x10c)) +#define M5307_SIM_DACR1(base) (CAST_M5307(volatile UINT32 *)((base) + 0x110)) +#define M5307_SIM_DMR1(base) (CAST_M5307(volatile UINT32 *)((base) + 0x114)) +#define M5307_SIM_TMR0(base) (CAST_M5307(volatile UINT16 *)((base) + 0x140)) +#define M5307_SIM_TRR0(base) (CAST_M5307(volatile UINT16 *)((base) + 0x144)) +#define M5307_SIM_TCR0(base) (CAST_M5307(volatile UINT16 *)((base) + 0x148)) +#define M5307_SIM_TCN0(base) (CAST_M5307(volatile UINT16 *)((base) + 0x14c)) +#define M5307_SIM_TER0(base) (CAST_M5307(volatile UINT8 *)((base) + 0x151)) +#define M5307_SIM_TMR1(base) (CAST_M5307(volatile UINT16 *)((base) + 0x180)) +#define M5307_SIM_TRR1(base) (CAST_M5307(volatile UINT16 *)((base) + 0x184)) +#define M5307_SIM_TCR1(base) (CAST_M5307(volatile UINT16 *)((base) + 0x188)) +#define M5307_SIM_TCN1(base) (CAST_M5307(volatile UINT16 *)((base) + 0x18c)) +#define M5307_SIM_TER1(base) (CAST_M5307(volatile UINT8 *)((base) + 0x191)) + +#define M5307_UART_MR(base, uart) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x1c0 + ((uart) ? 0x40 : 0x00))) +#define M5307_UART_SR(base, uart) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x1c4 + ((uart) ? 0x40 : 0x00))) +#define M5307_UART_CSR(base, uart) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x1c4 + ((uart) ? 0x40 : 0x00))) +#define M5307_UART_CR(base, uart) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x1c8 + ((uart) ? 0x40 : 0x00))) +#define M5307_UART_RB(base, uart) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x1cc + ((uart) ? 0x40 : 0x00))) +#define M5307_UART_TB(base, uart) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x1cc + ((uart) ? 0x40 : 0x00))) +#define M5307_UART_IPCR(base, uart) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x1d0 + ((uart) ? 0x40 : 0x00))) +#define M5307_UART_ACR(base, uart) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x1d0 + ((uart) ? 0x40 : 0x00))) +#define M5307_UART_ISR(base, uart) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x1d4 + ((uart) ? 0x40 : 0x00))) +#define M5307_UART_IMR(base, uart) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x1d4 + ((uart) ? 0x40 : 0x00))) +#define M5307_UART_BG1(base, uart) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x1d8 + ((uart) ? 0x40 : 0x00))) +#define M5307_UART_BG2(base, uart) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x1dc + ((uart) ? 0x40 : 0x00))) +#define M5307_UART_IVR(base, uart) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x1f0 + ((uart) ? 0x40 : 0x00))) +#define M5307_UART_IP(base, uart) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x1f4 + ((uart) ? 0x40 : 0x00))) +#define M5307_UART_OP2(base, uart) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x1f8 + ((uart) ? 0x40 : 0x00))) +#define M5307_UART_OP1(base, uart) \ + (CAST_M5307(volatile UINT8 *)((base) + 0x1fc + ((uart) ? 0x40 : 0x00))) + +#define M5307_SIM_PADDR(base) (CAST_M5307(volatile UINT16 *)((base) + 0x244)) +#define M5307_SIM_PADAT(base) (CAST_M5307(volatile UINT16 *)((base) + 0x248)) +#define M5307_SIM_MADR(base) (CAST_M5307(volatile UINT8 *)((base) + 0x280)) +#define M5307_SIM_MFDR(base) (CAST_M5307(volatile UINT8 *)((base) + 0x284)) +#define M5307_SIM_MBCR(base) (CAST_M5307(volatile UINT8 *)((base) + 0x288)) +#define M5307_SIM_MBSR(base) (CAST_M5307(volatile UINT8 *)((base) + 0x28c)) +#define M5307_SIM_MBDR(base) (CAST_M5307(volatile UINT8 *)((base) + 0x290)) +#define M5307_SIM_SAR0(base) (CAST_M5307(volatile UINT32 *)((base) + 0x300)) +#define M5307_SIM_DAR0(base) (CAST_M5307(volatile UINT32 *)((base) + 0x304)) +#define M5307_SIM_DCR0(base) (CAST_M5307(volatile UINT16 *)((base) + 0x308)) +#define M5307_SIM_BCR0(base) (CAST_M5307(volatile UINT16 *)((base) + 0x30c)) +#define M5307_SIM_DSR0(base) (CAST_M5307(volatile UINT8 *)((base) + 0x310)) +#define M5307_SIM_DIVR0(base) (CAST_M5307(volatile UINT8 *)((base) + 0x314)) +#define M5307_SIM_SAR1(base) (CAST_M5307(volatile UINT32 *)((base) + 0x340)) +#define M5307_SIM_DAR1(base) (CAST_M5307(volatile UINT32 *)((base) + 0x344)) +#define M5307_SIM_DCR1(base) (CAST_M5307(volatile UINT16 *)((base) + 0x348)) +#define M5307_SIM_BCR1(base) (CAST_M5307(volatile UINT16 *)((base) + 0x34c)) +#define M5307_SIM_DSR1(base) (CAST_M5307(volatile UINT8 *)((base) + 0x350)) +#define M5307_SIM_DIVR1(base) (CAST_M5307(volatile UINT8 *)((base) + 0x354)) +#define M5307_SIM_SAR2(base) (CAST_M5307(volatile UINT32 *)((base) + 0x380)) +#define M5307_SIM_DAR2(base) (CAST_M5307(volatile UINT32 *)((base) + 0x384)) +#define M5307_SIM_DCR2(base) (CAST_M5307(volatile UINT16 *)((base) + 0x388)) +#define M5307_SIM_BCR2(base) (CAST_M5307(volatile UINT16 *)((base) + 0x38c)) +#define M5307_SIM_DSR2(base) (CAST_M5307(volatile UINT8 *)((base) + 0x390)) +#define M5307_SIM_DIVR2(base) (CAST_M5307(volatile UINT8 *)((base) + 0x394)) +#define M5307_SIM_SAR3(base) (CAST_M5307(volatile UINT32 *)((base) + 0x3c0)) +#define M5307_SIM_DAR3(base) (CAST_M5307(volatile UINT32 *)((base) + 0x3c4)) +#define M5307_SIM_DCR3(base) (CAST_M5307(volatile UINT16 *)((base) + 0x3c8)) +#define M5307_SIM_BCR3(base) (CAST_M5307(volatile UINT16 *)((base) + 0x3cc)) +#define M5307_SIM_DSR3(base) (CAST_M5307(volatile UINT8 *)((base) + 0x3d0)) +#define M5307_SIM_DIVR3(base) (CAST_M5307(volatile UINT8 *)((base) + 0x3d4)) + +/* SIM Module Configuration Register definitions */ + +/* ICR - encode bits for ICR_xx registers */ +#define M5307_SIM_ICR_BITS(auto, level, priority) \ + ((((auto) & 0x01) << 7) \ + | (((level) & 0x07) << 2) \ + | ((priority) & 0x03)) + +/* IMR - Interrupt Mask Register bit definitions */ +#define M5307_IMR_EINT1 (1 << 1) +#define M5307_IMR_EINT2 (1 << 2) +#define M5307_IMR_EINT3 (1 << 3) +#define M5307_IMR_EINT4 (1 << 4) +#define M5307_IMR_EINT5 (1 << 5) +#define M5307_IMR_EINT6 (1 << 6) +#define M5307_IMR_EINT7 (1 << 7) +#define M5307_IMR_SWT (1 << 8) +#define M5307_IMR_TIMER1 (1 << 9) +#define M5307_IMR_TIMER2 (1 << 10) +#define M5307_IMR_MBUS (1 << 11) +#define M5307_IMR_UART1 (1 << 12) +#define M5307_IMR_UART2 (1 << 13) +#define M5307_IMR_DMA0 (1 << 14) +#define M5307_IMR_DMA1 (1 << 15) +#define M5307_IMR_DMA2 (1 << 16) +#define M5307_IMR_DMA3 (1 << 17) + +/* chip select mask registers */ +#define M5307_CS_CSMR_MASK_64k 0x00000000 +#define M5307_CS_CSMR_MASK_128k 0x00010000 +#define M5307_CS_CSMR_MASK_256k 0x00030000 +#define M5307_CS_CSMR_MASK_512k 0x00070000 +#define M5307_CS_CSMR_MASK_1M 0x000f0000 +#define M5307_CS_CSMR_MASK_2M 0x001f0000 +#define M5307_CS_CSMR_MASK_4M 0x003f0000 +#define M5307_CS_CSMR_MASK_8M 0x007f0000 +#define M5307_CS_CSMR_MASK_16M 0x00ff0000 +#define M5307_CS_CSMR_MASK_32M 0x01ff0000 +#define M5307_CS_CSMR_MASK_64M 0x03ff0000 +#define M5307_CS_CSMR_MASK_128M 0x07ff0000 +#define M5307_CS_CSMR_MASK_256M 0x0fff0000 +#define M5307_CS_CSMR_MASK_512M 0x1fff0000 +#define M5307_CS_CSMR_MASK_1G 0x3fff0000 +#define M5307_CS_CSMR_MASK_2G 0x7fff0000 +#define M5307_CS_CSMR_MASK_4G 0xffff0000 +#define M5307_CS_CSMR_WP (1 << 8) /* write protect */ +#define M5307_CS_CSMR_AM (1 << 6) /* alternate master */ +#define M5307_CS_CSMR_CI (1 << 5) /* mask CPU/IACK */ +#define M5307_CS_CSMR_SC (1 << 4) /* mask supervisor code */ +#define M5307_CS_CSMR_SD (1 << 3) /* mask supervisor data */ +#define M5307_CS_CSMR_UC (1 << 2) /* mask user code */ +#define M5307_CS_CSMR_UD (1 << 1) /* mask user data */ +#define M5307_CS_CSMR_V (1 << 0) /* valid */ + +/* chip select control regs (CSCR) & default mem control reg (DMCR) */ +#define M5307_CS_CSCR_WS(n) ((n) << 10) /* wait-states */ +#define M5307_CS_CSCR_WS_15 M5307_CS_CSCR_WS(15) +#define M5307_CS_CSCR_WS_14 M5307_CS_CSCR_WS(14) +#define M5307_CS_CSCR_WS_13 M5307_CS_CSCR_WS(13) +#define M5307_CS_CSCR_WS_12 M5307_CS_CSCR_WS(12) +#define M5307_CS_CSCR_WS_11 M5307_CS_CSCR_WS(11) +#define M5307_CS_CSCR_WS_10 M5307_CS_CSCR_WS(10) +#define M5307_CS_CSCR_WS_9 M5307_CS_CSCR_WS(9) +#define M5307_CS_CSCR_WS_8 M5307_CS_CSCR_WS(8) +#define M5307_CS_CSCR_WS_7 M5307_CS_CSCR_WS(7) +#define M5307_CS_CSCR_WS_6 M5307_CS_CSCR_WS(6) +#define M5307_CS_CSCR_WS_5 M5307_CS_CSCR_WS(5) +#define M5307_CS_CSCR_WS_4 M5307_CS_CSCR_WS(4) +#define M5307_CS_CSCR_WS_3 M5307_CS_CSCR_WS(3) +#define M5307_CS_CSCR_WS_2 M5307_CS_CSCR_WS(2) +#define M5307_CS_CSCR_WS_1 M5307_CS_CSCR_WS(1) +#define M5307_CS_CSCR_WS_0 M5307_CS_CSCR_WS(0) +#define M5307_CS_CSCR_AA (1 << 8) /* auto-acknowledge */ +#define M5307_CS_CSCR_PS_32 (0 << 6) /* 32-bit port size */ +#define M5307_CS_CSCR_PS_8 (1 << 6) /* 8-bit port size */ +#define M5307_CS_CSCR_PS_16 (2 << 6) /* 16-bit port size */ +#define M5307_CS_CSCR_BEM (1 << 5) /* byte enable module */ +#define M5307_CS_CSCR_BSTR (1 << 4) /* burst read enable */ +#define M5307_CS_CSCR_BSTW (1 << 3) /* burst write enable */ + +/* DRAM controller */ + +/* DRAM Control Register (DCR) */ +#define M5307_DCR_SO (1 << 15) /* synchronous operation */ +#define M5307_DCR_NAM (1 << 13) /* no address multiplexing */ +/* sync only bits */ +#define M5307_DCR_COC (1 << 12) /* command on clock enable */ +#define M5307_DCR_IS (1 << 11) /* initiate self-refresh */ +#define M5307_DCR_RTIM_3CLKS (0 << 9) /* 3 clks REFRESH to ACTV */ +#define M5307_DCR_RTIM_6CLKS (1 << 9) /* 6 clks REFRESH to ACTV */ +#define M5307_DCR_RTIM_9CLKS (2 << 9) /* 9 clks REFRESH to ACTV */ +/* async only bits */ +#define M5307_DCR_RRA_2CLKS (0 << 11) /* RAS asserted 2 clocks */ +#define M5307_DCR_RRA_3CLKS (1 << 11) /* RAS asserted 3 clocks */ +#define M5307_DCR_RRA_4CLKS (2 << 11) /* RAS asserted 4 clocks */ +#define M5307_DCR_RRA_5CLKS (3 << 11) /* RAS asserted 5 clocks */ +#define M5307_DCR_RRP_1CLKS (0 << 9) /* RAS precharged 1 clocks */ +#define M5307_DCR_RRP_2CLKS (1 << 9) /* RAS precharged 2 clocks */ +#define M5307_DCR_RRP_3CLKS (2 << 9) /* RAS precharged 3 clocks */ +#define M5307_DCR_RRP_4CLKS (3 << 9) /* RAS precharged 4 clocks */ +#define M5307_DCR_RC(n) ((n) & 0x01ff) /* refresh count */ + +/* DRAM controller address and control registers */ +#define M5307_DACR_RE (1 << 15) /* refresh enable */ +#define M5307_DACR_PS_32 (0 << 4) /* 32 bit port */ +#define M5307_DACR_PS_8 (1 << 4) /* 8 bit port */ +#define M5307_DACR_PS_16 (2 << 4) /* 16 bit port */ +/* sync */ +#define M5307_DACR_CASL_1 (0 << 12) /* CASL 1 (see manual) */ +#define M5307_DACR_CASL_2 (1 << 12) /* CASL 2 (see manual) */ +#define M5307_DACR_CASL_3 (2 << 12) /* CASL 3 (see manual) */ +#define M5307_DACR_CBM(n) ((n) << 8) /* command and bank mux */ +#define M5307_DACR_IMRS (1 << 6) /* init mode reg set cmd */ +#define M5307_DACR_IP (1 << 3) /* init precharge all cmd */ +#define M5307_DACR_PM (1 << 2) /* page mode */ +/* async */ +#define M5307_DACR_CAS_1CLKS (0 << 12) /* CAS asserted 1 clocks */ +#define M5307_DACR_CAS_2CLKS (1 << 12) /* CAS asserted 2 clocks */ +#define M5307_DACR_CAS_3CLKS (2 << 12) /* CAS asserted 3 clocks */ +#define M5307_DACR_CAS_4CLKS (3 << 12) /* CAS asserted 4 clocks */ +#define M5307_DACR_RAS_1CLKS (0 << 10) /* RAS asserted 1 clocks */ +#define M5307_DACR_RAS_2CLKS (1 << 10) /* RAS asserted 2 clocks */ +#define M5307_DACR_RAS_3CLKS (2 << 10) /* RAS asserted 3 clocks */ +#define M5307_DACR_RAS_4CLKS (3 << 10) /* RAS asserted 4 clocks */ +#define M5307_DACR_RNCN (1 << 9) /* RAS to CAS negate */ +#define M5307_DACR_RCD (1 << 8) /* RAS to CAS delay */ +#define M5307_DACR_EDO (1 << 6) /* extended data out */ +#define M5307_DACR_PM_NONE (0 << 2) /* no page mode */ +#define M5307_DACR_PM_BRST (1 << 2) /* page mode on burst only */ +#define M5307_DACR_PM_CONT (3 << 2) /* continuous page mode */ + +/* DRAM controller mask registers */ +#define M5307_DMR_MASK_256k 0x00000000 +#define M5307_DMR_MASK_512k 0x00040000 +#define M5307_DMR_MASK_1M 0x000c0000 +#define M5307_DMR_MASK_2M 0x001c0000 +#define M5307_DMR_MASK_4M 0x003c0000 +#define M5307_DMR_MASK_8M 0x007c0000 +#define M5307_DMR_MASK_16M 0x00fc0000 +#define M5307_DMR_MASK_32M 0x01fc0000 +#define M5307_DMR_MASK_64M 0x03fc0000 +#define M5307_DMR_MASK_128M 0x07fc0000 +#define M5307_DMR_MASK_256M 0x0ffc0000 +#define M5307_DMR_MASK_512M 0x1ffc0000 +#define M5307_DMR_MASK_1G 0x3ffc0000 +#define M5307_DMR_MASK_2G 0x7ffc0000 +#define M5307_DMR_MASK_4G 0xfffc0000 +#define M5307_DMR_WP (1 << 8) /* write protect */ +#define M5307_DMR_AM (1 << 6) /* alternate master */ +#define M5307_DMR_CI (1 << 5) /* mask CPU/IACK */ +#define M5307_DMR_SC (1 << 4) /* mask supervisor code */ +#define M5307_DMR_SD (1 << 3) /* mask supervisor data */ +#define M5307_DMR_UC (1 << 2) /* mask user code */ +#define M5307_DMR_UD (1 << 1) /* mask user data */ +#define M5307_DMR_V (1 << 0) /* valid */ + +/* DRAM controller (synchronous operation) */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm5307h */ + diff --git a/h/drv/multi/m5407.h b/h/drv/multi/m5407.h new file mode 100644 index 0000000..93d29e1 --- /dev/null +++ b/h/drv/multi/m5407.h @@ -0,0 +1,385 @@ +/* m5407.h - Motorola MCF5407 CPU control registers */ + +/* Copyright 1994-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,27sep00,dh written (based on m5307.h) +*/ + +/* +This file contains I/O addresses and related constants for the MCF5407 +*/ + +#ifndef __INCm5407h +#define __INCm5407h + +#ifdef __cplusplus +extern "C" { +#endif + +/* +Need to use a distinct cast macro in order to not conflict with other +include files. +*/ + +#ifdef _ASMLANGUAGE +#define CAST_M5407(x) +#else /* _ASMLANGUAGE */ +#define CAST_M5407(x) (x) +#endif /* _ASMLANGUAGE */ + +/* Size of internal SRAM */ + +#define M5407_SRAM_SIZE 4096 /* size of SRAM */ +#define M5407_SRAM_BANK_SIZE 2048 /* size of SRAM bank */ +#define M5407_DCACHE_SIZE 8192 /* size of data cache */ +#define M5407_ICACHE_SIZE 16384 /* size of instruction cache */ + +/* ACRs (access control registers) */ + +#define M5407_ACR_ADDR_BASE(n) ((n) & 0xff000000) /* region base */ +#define M5407_ACR_ADDR_MASK(n) (((n)>>8) & 0x00ff0000) /* region mask */ +#define M5407_ACR_ENABLE (1 << 15) /* enable ACR */ +#define M5407_ACR_MODE_USER (0 << 13) /* match if user */ +#define M5407_ACR_MODE_SUPER (1 << 13) /* match if supervisor */ +#define M5407_ACR_MODE_ANY (2 << 13) /* match any */ +#define M5407_ACR_WRITETHROUGH (0 << 5) /* cacheable, writethrough */ +#define M5407_ACR_COPYBACK (1 << 5) /* cacheable, copyback */ +#define M5407_ACR_INH_PRECISE (2 << 5) /* cache-inhibited, precise */ +#define M5407_ACR_INH_IMPRECISE (3 << 5) /* cache-inhibited, imprecise*/ +#define M5407_ACR_WP (1 << 2) /* write-protect */ + +/* System Integration Module register addresses */ + +#define M5407_SIM_RSR(base) (CAST_M5407(volatile UINT8 *)((base) + 0x000)) +#define M5407_SIM_SYPCR(base) (CAST_M5407(volatile UINT8 *)((base) + 0x001)) +#define M5407_SIM_SWIVR(base) (CAST_M5407(volatile UINT8 *)((base) + 0x002)) +#define M5407_SIM_SWSR(base) (CAST_M5407(volatile UINT8 *)((base) + 0x003)) + +#define M5407_SIM_PAR(base) (CAST_M5407(volatile UINT16 *)((base) + 0x004)) +#define M5407_SIM_IRQPAR(base) (CAST_M5407(volatile UINT8 *)((base) + 0x006)) +#define M5407_SIM_PLLCR(base) (CAST_M5407(volatile UINT8 *)((base) + 0x008)) +#define M5407_SIM_MPARK(base) (CAST_M5407(volatile UINT8 *)((base) + 0x00c)) + +#define M5407_SIM_IPR(base) (CAST_M5407(volatile UINT32 *)((base) + 0x040)) +#define M5407_SIM_IMR(base) (CAST_M5407(volatile UINT32 *)((base) + 0x044)) + +/* Autovector control */ +#define MCF5407_SIM_AVCR_BLK (1 << 0) +#define MCF5407_SIM_AVCR_AVEC1 (1 << 1) +#define MCF5407_SIM_AVCR_AVEC2 (1 << 2) +#define MCF5407_SIM_AVCR_AVEC3 (1 << 3) +#define MCF5407_SIM_AVCR_AVEC4 (1 << 4) +#define MCF5407_SIM_AVCR_AVEC5 (1 << 5) +#define MCF5407_SIM_AVCR_AVEC6 (1 << 6) +#define MCF5407_SIM_AVCR_AVEC7 (1 << 7) + +#define M5407_SIM_AVCR(base) (CAST_M5407(volatile UINT8 *)((base) + 0x04b)) + +#define M5407_SIM_ICR_SWT(base) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x04c)) +#define M5407_SIM_ICR_TIMER1(base) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x04d)) +#define M5407_SIM_ICR_TIMER2(base) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x04e)) +#define M5407_SIM_ICR_MBUS(base) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x04f)) +#define M5407_SIM_ICR_UART1(base) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x050)) +#define M5407_SIM_ICR_UART2(base) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x051)) +#define M5407_SIM_ICR_DMA0(base) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x052)) +#define M5407_SIM_ICR_DMA1(base) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x053)) +#define M5407_SIM_ICR_DMA2(base) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x054)) +#define M5407_SIM_ICR_DMA3(base) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x055)) +#define M5407_SIM_ICR_ICR10(base) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x056)) +#define M5407_SIM_ICR_ICR11(base) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x057)) + +/* Chip select registers */ + +#define M5407_SIM_CSAR0(base) (CAST_M5407(volatile UINT16 *)((base) + 0x080)) +#define M5407_SIM_CSMR0(base) (CAST_M5407(volatile UINT32 *)((base) + 0x084)) +#define M5407_SIM_CSCR0(base) (CAST_M5407(volatile UINT16 *)((base) + 0x08a)) + +#define M5407_SIM_CSAR1(base) (CAST_M5407(volatile UINT16 *)((base) + 0x08c)) +#define M5407_SIM_CSMR1(base) (CAST_M5407(volatile UINT32 *)((base) + 0x090)) +#define M5407_SIM_CSCR1(base) (CAST_M5407(volatile UINT16 *)((base) + 0x096)) + +#define M5407_SIM_CSAR2(base) (CAST_M5407(volatile UINT16 *)((base) + 0x098)) +#define M5407_SIM_CSMR2(base) (CAST_M5407(volatile UINT32 *)((base) + 0x09c)) +#define M5407_SIM_CSCR2(base) (CAST_M5407(volatile UINT16 *)((base) + 0x0a2)) + +#define M5407_SIM_CSAR3(base) (CAST_M5407(volatile UINT16 *)((base) + 0x0a4)) +#define M5407_SIM_CSMR3(base) (CAST_M5407(volatile UINT32 *)((base) + 0x0a8)) +#define M5407_SIM_CSCR3(base) (CAST_M5407(volatile UINT16 *)((base) + 0x0ae)) + +#define M5407_SIM_CSAR4(base) (CAST_M5407(volatile UINT16 *)((base) + 0x0b0)) +#define M5407_SIM_CSMR4(base) (CAST_M5407(volatile UINT32 *)((base) + 0x0b4)) +#define M5407_SIM_CSCR4(base) (CAST_M5407(volatile UINT16 *)((base) + 0x0ba)) + +#define M5407_SIM_CSAR5(base) (CAST_M5407(volatile UINT16 *)((base) + 0x0bc)) +#define M5407_SIM_CSMR5(base) (CAST_M5407(volatile UINT32 *)((base) + 0x0c0)) +#define M5407_SIM_CSCR5(base) (CAST_M5407(volatile UINT16 *)((base) + 0x0c6)) + +#define M5407_SIM_CSAR6(base) (CAST_M5407(volatile UINT16 *)((base) + 0x0c8)) +#define M5407_SIM_CSMR6(base) (CAST_M5407(volatile UINT32 *)((base) + 0x0cc)) +#define M5407_SIM_CSCR6(base) (CAST_M5407(volatile UINT16 *)((base) + 0x0d2)) + +#define M5407_SIM_CSAR7(base) (CAST_M5407(volatile UINT16 *)((base) + 0x0d4)) +#define M5407_SIM_CSMR7(base) (CAST_M5407(volatile UINT32 *)((base) + 0x0d8)) +#define M5407_SIM_CSCR7(base) (CAST_M5407(volatile UINT16 *)((base) + 0x0de)) + + +#define M5407_SIM_DCR(base) (CAST_M5407(volatile UINT16 *)((base) + 0x100)) +#define M5407_SIM_DACR0(base) (CAST_M5407(volatile UINT32 *)((base) + 0x108)) +#define M5407_SIM_DMR0(base) (CAST_M5407(volatile UINT32 *)((base) + 0x10c)) +#define M5407_SIM_DACR1(base) (CAST_M5407(volatile UINT32 *)((base) + 0x110)) +#define M5407_SIM_DMR1(base) (CAST_M5407(volatile UINT32 *)((base) + 0x114)) +#define M5407_SIM_TMR0(base) (CAST_M5407(volatile UINT16 *)((base) + 0x140)) +#define M5407_SIM_TRR0(base) (CAST_M5407(volatile UINT16 *)((base) + 0x144)) +#define M5407_SIM_TCR0(base) (CAST_M5407(volatile UINT16 *)((base) + 0x148)) +#define M5407_SIM_TCN0(base) (CAST_M5407(volatile UINT16 *)((base) + 0x14c)) +#define M5407_SIM_TER0(base) (CAST_M5407(volatile UINT8 *)((base) + 0x151)) +#define M5407_SIM_TMR1(base) (CAST_M5407(volatile UINT16 *)((base) + 0x180)) +#define M5407_SIM_TRR1(base) (CAST_M5407(volatile UINT16 *)((base) + 0x184)) +#define M5407_SIM_TCR1(base) (CAST_M5407(volatile UINT16 *)((base) + 0x188)) +#define M5407_SIM_TCN1(base) (CAST_M5407(volatile UINT16 *)((base) + 0x18c)) +#define M5407_SIM_TER1(base) (CAST_M5407(volatile UINT8 *)((base) + 0x191)) + +#define M5407_UART_MR(base, uart) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x1c0 + ((uart) ? 0x40 : 0x00))) +#define M5407_UART_SR(base, uart) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x1c4 + ((uart) ? 0x40 : 0x00))) +#define M5407_UART_CSR(base, uart) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x1c4 + ((uart) ? 0x40 : 0x00))) +#define M5407_UART_CR(base, uart) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x1c8 + ((uart) ? 0x40 : 0x00))) +#define M5407_UART_RB(base, uart) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x1cc + ((uart) ? 0x40 : 0x00))) +#define M5407_UART_TB(base, uart) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x1cc + ((uart) ? 0x40 : 0x00))) +#define M5407_UART_IPCR(base, uart) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x1d0 + ((uart) ? 0x40 : 0x00))) +#define M5407_UART_ACR(base, uart) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x1d0 + ((uart) ? 0x40 : 0x00))) +#define M5407_UART_ISR(base, uart) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x1d4 + ((uart) ? 0x40 : 0x00))) +#define M5407_UART_IMR(base, uart) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x1d4 + ((uart) ? 0x40 : 0x00))) +#define M5407_UART_BG1(base, uart) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x1d8 + ((uart) ? 0x40 : 0x00))) +#define M5407_UART_BG2(base, uart) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x1dc + ((uart) ? 0x40 : 0x00))) +#define M5407_UART_IVR(base, uart) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x1f0 + ((uart) ? 0x40 : 0x00))) +#define M5407_UART_IP(base, uart) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x1f4 + ((uart) ? 0x40 : 0x00))) +#define M5407_UART_OP2(base, uart) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x1f8 + ((uart) ? 0x40 : 0x00))) +#define M5407_UART_OP1(base, uart) \ + (CAST_M5407(volatile UINT8 *)((base) + 0x1fc + ((uart) ? 0x40 : 0x00))) + +#define M5407_SIM_PADDR(base) (CAST_M5407(volatile UINT16 *)((base) + 0x244)) +#define M5407_SIM_PADAT(base) (CAST_M5407(volatile UINT16 *)((base) + 0x248)) +#define M5407_SIM_MADR(base) (CAST_M5407(volatile UINT8 *)((base) + 0x280)) +#define M5407_SIM_MFDR(base) (CAST_M5407(volatile UINT8 *)((base) + 0x284)) +#define M5407_SIM_MBCR(base) (CAST_M5407(volatile UINT8 *)((base) + 0x288)) +#define M5407_SIM_MBSR(base) (CAST_M5407(volatile UINT8 *)((base) + 0x28c)) +#define M5407_SIM_MBDR(base) (CAST_M5407(volatile UINT8 *)((base) + 0x290)) +#define M5407_SIM_SAR0(base) (CAST_M5407(volatile UINT32 *)((base) + 0x300)) +#define M5407_SIM_DAR0(base) (CAST_M5407(volatile UINT32 *)((base) + 0x304)) +#define M5407_SIM_DCR0(base) (CAST_M5407(volatile UINT16 *)((base) + 0x308)) +#define M5407_SIM_BCR0(base) (CAST_M5407(volatile UINT16 *)((base) + 0x30c)) +#define M5407_SIM_DSR0(base) (CAST_M5407(volatile UINT8 *)((base) + 0x310)) +#define M5407_SIM_DIVR0(base) (CAST_M5407(volatile UINT8 *)((base) + 0x314)) +#define M5407_SIM_SAR1(base) (CAST_M5407(volatile UINT32 *)((base) + 0x340)) +#define M5407_SIM_DAR1(base) (CAST_M5407(volatile UINT32 *)((base) + 0x344)) +#define M5407_SIM_DCR1(base) (CAST_M5407(volatile UINT16 *)((base) + 0x348)) +#define M5407_SIM_BCR1(base) (CAST_M5407(volatile UINT16 *)((base) + 0x34c)) +#define M5407_SIM_DSR1(base) (CAST_M5407(volatile UINT8 *)((base) + 0x350)) +#define M5407_SIM_DIVR1(base) (CAST_M5407(volatile UINT8 *)((base) + 0x354)) +#define M5407_SIM_SAR2(base) (CAST_M5407(volatile UINT32 *)((base) + 0x380)) +#define M5407_SIM_DAR2(base) (CAST_M5407(volatile UINT32 *)((base) + 0x384)) +#define M5407_SIM_DCR2(base) (CAST_M5407(volatile UINT16 *)((base) + 0x388)) +#define M5407_SIM_BCR2(base) (CAST_M5407(volatile UINT16 *)((base) + 0x38c)) +#define M5407_SIM_DSR2(base) (CAST_M5407(volatile UINT8 *)((base) + 0x390)) +#define M5407_SIM_DIVR2(base) (CAST_M5407(volatile UINT8 *)((base) + 0x394)) +#define M5407_SIM_SAR3(base) (CAST_M5407(volatile UINT32 *)((base) + 0x3c0)) +#define M5407_SIM_DAR3(base) (CAST_M5407(volatile UINT32 *)((base) + 0x3c4)) +#define M5407_SIM_DCR3(base) (CAST_M5407(volatile UINT16 *)((base) + 0x3c8)) +#define M5407_SIM_BCR3(base) (CAST_M5407(volatile UINT16 *)((base) + 0x3cc)) +#define M5407_SIM_DSR3(base) (CAST_M5407(volatile UINT8 *)((base) + 0x3d0)) +#define M5407_SIM_DIVR3(base) (CAST_M5407(volatile UINT8 *)((base) + 0x3d4)) + +/* SIM Module Configuration Register definitions */ + +/* ICR - encode bits for ICR_xx registers */ +#define M5407_SIM_ICR_BITS(auto, level, priority) \ + ((((auto) & 0x01) << 7) \ + | (((level) & 0x07) << 2) \ + | ((priority) & 0x03)) + +/* IMR - Interrupt Mask Register bit definitions */ +#define M5407_IMR_EINT1 (1 << 1) +#define M5407_IMR_EINT2 (1 << 2) +#define M5407_IMR_EINT3 (1 << 3) +#define M5407_IMR_EINT4 (1 << 4) +#define M5407_IMR_EINT5 (1 << 5) +#define M5407_IMR_EINT6 (1 << 6) +#define M5407_IMR_EINT7 (1 << 7) +#define M5407_IMR_SWT (1 << 8) +#define M5407_IMR_TIMER1 (1 << 9) +#define M5407_IMR_TIMER2 (1 << 10) +#define M5407_IMR_MBUS (1 << 11) +#define M5407_IMR_UART1 (1 << 12) +#define M5407_IMR_UART2 (1 << 13) +#define M5407_IMR_DMA0 (1 << 14) +#define M5407_IMR_DMA1 (1 << 15) +#define M5407_IMR_DMA2 (1 << 16) +#define M5407_IMR_DMA3 (1 << 17) + +/* chip select mask registers */ +#define M5407_CS_CSMR_MASK_64k 0x00000000 +#define M5407_CS_CSMR_MASK_128k 0x00010000 +#define M5407_CS_CSMR_MASK_256k 0x00030000 +#define M5407_CS_CSMR_MASK_512k 0x00070000 +#define M5407_CS_CSMR_MASK_1M 0x000f0000 +#define M5407_CS_CSMR_MASK_2M 0x001f0000 +#define M5407_CS_CSMR_MASK_4M 0x003f0000 +#define M5407_CS_CSMR_MASK_8M 0x007f0000 +#define M5407_CS_CSMR_MASK_16M 0x00ff0000 +#define M5407_CS_CSMR_MASK_32M 0x01ff0000 +#define M5407_CS_CSMR_MASK_64M 0x03ff0000 +#define M5407_CS_CSMR_MASK_128M 0x07ff0000 +#define M5407_CS_CSMR_MASK_256M 0x0fff0000 +#define M5407_CS_CSMR_MASK_512M 0x1fff0000 +#define M5407_CS_CSMR_MASK_1G 0x3fff0000 +#define M5407_CS_CSMR_MASK_2G 0x7fff0000 +#define M5407_CS_CSMR_MASK_4G 0xffff0000 +#define M5407_CS_CSMR_WP (1 << 8) /* write protect */ +#define M5407_CS_CSMR_AM (1 << 6) /* alternate master */ +#define M5407_CS_CSMR_CI (1 << 5) /* mask CPU/IACK */ +#define M5407_CS_CSMR_SC (1 << 4) /* mask supervisor code */ +#define M5407_CS_CSMR_SD (1 << 3) /* mask supervisor data */ +#define M5407_CS_CSMR_UC (1 << 2) /* mask user code */ +#define M5407_CS_CSMR_UD (1 << 1) /* mask user data */ +#define M5407_CS_CSMR_V (1 << 0) /* valid */ + +/* chip select control regs (CSCR) & default mem control reg (DMCR) */ +#define M5407_CS_CSCR_WS(n) ((n) << 10) /* wait-states */ +#define M5407_CS_CSCR_WS_15 M5407_CS_CSCR_WS(15) +#define M5407_CS_CSCR_WS_14 M5407_CS_CSCR_WS(14) +#define M5407_CS_CSCR_WS_13 M5407_CS_CSCR_WS(13) +#define M5407_CS_CSCR_WS_12 M5407_CS_CSCR_WS(12) +#define M5407_CS_CSCR_WS_11 M5407_CS_CSCR_WS(11) +#define M5407_CS_CSCR_WS_10 M5407_CS_CSCR_WS(10) +#define M5407_CS_CSCR_WS_9 M5407_CS_CSCR_WS(9) +#define M5407_CS_CSCR_WS_8 M5407_CS_CSCR_WS(8) +#define M5407_CS_CSCR_WS_7 M5407_CS_CSCR_WS(7) +#define M5407_CS_CSCR_WS_6 M5407_CS_CSCR_WS(6) +#define M5407_CS_CSCR_WS_5 M5407_CS_CSCR_WS(5) +#define M5407_CS_CSCR_WS_4 M5407_CS_CSCR_WS(4) +#define M5407_CS_CSCR_WS_3 M5407_CS_CSCR_WS(3) +#define M5407_CS_CSCR_WS_2 M5407_CS_CSCR_WS(2) +#define M5407_CS_CSCR_WS_1 M5407_CS_CSCR_WS(1) +#define M5407_CS_CSCR_WS_0 M5407_CS_CSCR_WS(0) +#define M5407_CS_CSCR_AA (1 << 8) /* auto-acknowledge */ +#define M5407_CS_CSCR_PS_32 (0 << 6) /* 32-bit port size */ +#define M5407_CS_CSCR_PS_8 (1 << 6) /* 8-bit port size */ +#define M5407_CS_CSCR_PS_16 (2 << 6) /* 16-bit port size */ +#define M5407_CS_CSCR_BEM (1 << 5) /* byte enable module */ +#define M5407_CS_CSCR_BSTR (1 << 4) /* burst read enable */ +#define M5407_CS_CSCR_BSTW (1 << 3) /* burst write enable */ + +/* DRAM controller */ + +/* DRAM Control Register (DCR) */ +#define M5407_DCR_SO (1 << 15) /* synchronous operation */ +#define M5407_DCR_NAM (1 << 13) /* no address multiplexing */ +/* sync only bits */ +#define M5407_DCR_COC (1 << 12) /* command on clock enable */ +#define M5407_DCR_IS (1 << 11) /* initiate self-refresh */ +#define M5407_DCR_RTIM_3CLKS (0 << 9) /* 3 clks REFRESH to ACTV */ +#define M5407_DCR_RTIM_6CLKS (1 << 9) /* 6 clks REFRESH to ACTV */ +#define M5407_DCR_RTIM_9CLKS (2 << 9) /* 9 clks REFRESH to ACTV */ +/* async only bits */ +#define M5407_DCR_RRA_2CLKS (0 << 11) /* RAS asserted 2 clocks */ +#define M5407_DCR_RRA_3CLKS (1 << 11) /* RAS asserted 3 clocks */ +#define M5407_DCR_RRA_4CLKS (2 << 11) /* RAS asserted 4 clocks */ +#define M5407_DCR_RRA_5CLKS (3 << 11) /* RAS asserted 5 clocks */ +#define M5407_DCR_RRP_1CLKS (0 << 9) /* RAS precharged 1 clocks */ +#define M5407_DCR_RRP_2CLKS (1 << 9) /* RAS precharged 2 clocks */ +#define M5407_DCR_RRP_3CLKS (2 << 9) /* RAS precharged 3 clocks */ +#define M5407_DCR_RRP_4CLKS (3 << 9) /* RAS precharged 4 clocks */ +#define M5407_DCR_RC(n) ((n) & 0x01ff) /* refresh count */ + +/* DRAM controller address and control registers */ +#define M5407_DACR_RE (1 << 15) /* refresh enable */ +#define M5407_DACR_PS_32 (0 << 4) /* 32 bit port */ +#define M5407_DACR_PS_8 (1 << 4) /* 8 bit port */ +#define M5407_DACR_PS_16 (2 << 4) /* 16 bit port */ +/* sync */ +#define M5407_DACR_CASL_1 (0 << 12) /* CASL 1 (see manual) */ +#define M5407_DACR_CASL_2 (1 << 12) /* CASL 2 (see manual) */ +#define M5407_DACR_CASL_3 (2 << 12) /* CASL 3 (see manual) */ +#define M5407_DACR_CBM(n) ((n) << 8) /* command and bank mux */ +#define M5407_DACR_IMRS (1 << 6) /* init mode reg set cmd */ +#define M5407_DACR_IP (1 << 3) /* init precharge all cmd */ +#define M5407_DACR_PM (1 << 2) /* page mode */ +/* async */ +#define M5407_DACR_CAS_1CLKS (0 << 12) /* CAS asserted 1 clocks */ +#define M5407_DACR_CAS_2CLKS (1 << 12) /* CAS asserted 2 clocks */ +#define M5407_DACR_CAS_3CLKS (2 << 12) /* CAS asserted 3 clocks */ +#define M5407_DACR_CAS_4CLKS (3 << 12) /* CAS asserted 4 clocks */ +#define M5407_DACR_RAS_1CLKS (0 << 10) /* RAS asserted 1 clocks */ +#define M5407_DACR_RAS_2CLKS (1 << 10) /* RAS asserted 2 clocks */ +#define M5407_DACR_RAS_3CLKS (2 << 10) /* RAS asserted 3 clocks */ +#define M5407_DACR_RAS_4CLKS (3 << 10) /* RAS asserted 4 clocks */ +#define M5407_DACR_RNCN (1 << 9) /* RAS to CAS negate */ +#define M5407_DACR_RCD (1 << 8) /* RAS to CAS delay */ +#define M5407_DACR_EDO (1 << 6) /* extended data out */ +#define M5407_DACR_PM_NONE (0 << 2) /* no page mode */ +#define M5407_DACR_PM_BRST (1 << 2) /* page mode on burst only */ +#define M5407_DACR_PM_CONT (3 << 2) /* continuous page mode */ + +/* DRAM controller mask registers */ +#define M5407_DMR_MASK_256k 0x00000000 +#define M5407_DMR_MASK_512k 0x00040000 +#define M5407_DMR_MASK_1M 0x000c0000 +#define M5407_DMR_MASK_2M 0x001c0000 +#define M5407_DMR_MASK_4M 0x003c0000 +#define M5407_DMR_MASK_8M 0x007c0000 +#define M5407_DMR_MASK_16M 0x00fc0000 +#define M5407_DMR_MASK_32M 0x01fc0000 +#define M5407_DMR_MASK_64M 0x03fc0000 +#define M5407_DMR_MASK_128M 0x07fc0000 +#define M5407_DMR_MASK_256M 0x0ffc0000 +#define M5407_DMR_MASK_512M 0x1ffc0000 +#define M5407_DMR_MASK_1G 0x3ffc0000 +#define M5407_DMR_MASK_2G 0x7ffc0000 +#define M5407_DMR_MASK_4G 0xfffc0000 +#define M5407_DMR_WP (1 << 8) /* write protect */ +#define M5407_DMR_AM (1 << 6) /* alternate master */ +#define M5407_DMR_CI (1 << 5) /* mask CPU/IACK */ +#define M5407_DMR_SC (1 << 4) /* mask supervisor code */ +#define M5407_DMR_SD (1 << 3) /* mask supervisor data */ +#define M5407_DMR_UC (1 << 2) /* mask user code */ +#define M5407_DMR_UD (1 << 1) /* mask user data */ +#define M5407_DMR_V (1 << 0) /* valid */ + +/* DRAM controller (synchronous operation) */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm5407h */ + diff --git a/h/drv/multi/m68230.h b/h/drv/multi/m68230.h new file mode 100644 index 0000000..d7fad16 --- /dev/null +++ b/h/drv/multi/m68230.h @@ -0,0 +1,164 @@ +/* m68230.h - Motorola m68230 parallel/timer chip */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01k,10oct96,dat merge from windview102 +01j,06dec93,dzb added macros for 32 bit timer counter and preload regs. +01i,22sep92,rrr added support for c++ +01h,26may92,rrr the tree shuffle +01g,04oct91,rrr passed through the ansification filter + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01f,05oct90,shl added copyright notice. + made #endif ANSI style. +01e,20mar90,shl fixed ZERO_DET_CTL typo introduced in 01c. +01d,10oct89,rld Allow for ASM & register offset. +01c,27jul88,gae+mcl fixed ZERO_DET_CTL typo. +01b,25mar88,dnw added register definitions, cleaned up. +01a,08jan88,miz written. +*/ + +/* +This file contains constants for the Motorola m68230 parallel/timer chip. +*/ + +#ifndef __INCm68230h +#define __INCm68230h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _ASMLANGUAGE +#define CAST +#define CAST32 +#else +#define CAST (char *) +#define CAST32 (UINT32 *) +#endif /* _ASMLANGUAGE */ + +#define PIT_ADRS(base, reg) (CAST base + (reg * PIT_REG_ADDR_INTERVAL)) +#define PIT_A32(base, reg) (CAST32 PIT_ADRS (base, reg)) + +/* register definitions */ + +#define PIT_PGCR(base) PIT_ADRS (base, 0x00) /* port genl cntrl reg */ +#define PIT_PSRR(base) PIT_ADRS (base, 0x01) /* port service req reg */ +#define PIT_PADDR(base) PIT_ADRS (base, 0x02) /* port A data dir reg */ +#define PIT_PBDDR(base) PIT_ADRS (base, 0x03) /* port B data dir reg */ +#define PIT_PCDDR(base) PIT_ADRS (base, 0x04) /* port C data dir reg */ +#define PIT_PIVR(base) PIT_ADRS (base, 0x05) /* port int vector reg */ +#define PIT_PACR(base) PIT_ADRS (base, 0x06) /* port A control reg */ +#define PIT_PBCR(base) PIT_ADRS (base, 0x07) /* port B control reg */ +#define PIT_PADR(base) PIT_ADRS (base, 0x08) /* port A data reg */ +#define PIT_PBDR(base) PIT_ADRS (base, 0x09) /* port B data reg */ +#define PIT_PAAR(base) PIT_ADRS (base, 0x0a) /* port A alternate reg */ +#define PIT_PBAR(base) PIT_ADRS (base, 0x0b) /* port B alternate reg */ +#define PIT_PCDR(base) PIT_ADRS (base, 0x0c) /* port C data reg */ +#define PIT_PSR(base) PIT_ADRS (base, 0x0d) /* port status reg */ +#define PIT_TCR(base) PIT_ADRS (base, 0x10) /* timer control reg */ +#define PIT_TVIR(base) PIT_ADRS (base, 0x11) /* timer int vec reg */ +#define PIT_CPR(base) PIT_A32 (base, 0x12) /* ctr preload 32 bit */ +#define PIT_CPRH(base) PIT_ADRS (base, 0x13) /* ctr preload reg high */ +#define PIT_CPRM(base) PIT_ADRS (base, 0x14) /* ctr preload reg med */ +#define PIT_CPRL(base) PIT_ADRS (base, 0x15) /* ctr preload reg low */ +#define PIT_CNTR(base) PIT_A32 (base, 0x16) /* count reg 32 bit */ +#define PIT_CNTRH(base) PIT_ADRS (base, 0x17) /* count reg high */ +#define PIT_CNTRM(base) PIT_ADRS (base, 0x18) /* count reg medium */ +#define PIT_CNTRL(base) PIT_ADRS (base, 0x19) /* count reg low */ +#define PIT_TSR(base) PIT_ADRS (base, 0x1a) /* timer status reg */ + +/* port general control register */ + +#define PORT_MODE_3 0xc0 /* bidirectional 16-bit mode */ +#define PORT_MODE_2 0x80 /* bidirectional 8-bit mode */ +#define PORT_MODE_1 0x40 /* unidirectional 16-bit mode */ +#define PORT_MODE_0 0x00 /* unidirectional 8-bit mode */ +#define H34_ENABLE 0x20 /* 0 = diable, 1 = enable */ +#define H12_ENABLE 0x10 /* 0 = diable, 1 = enable */ +#define H4_SENSE 0x08 /* 0 = active low, 1 = active high */ +#define H3_SENSE 0x04 /* 0 = active low, 1 = active high */ +#define H2_SENSE 0x02 /* 0 = active low, 1 = active high */ +#define H1_SENSE 0x01 /* 0 = active low, 1 = active high */ + +/* port service request register */ + +#define DMA_REQ_1 0x60 /* dma request 1 */ +#define DMA_REQ_0 0x40 /* dma request 0 */ +#define DMA_NONE 0x20 /* no dma */ +#define PIACK 0x10 /* 0 = PC6, 1 = PIACK */ +#define PIRQ 0x08 /* 0 = PC5, 1 = PIRQ */ +#define PIPC_7 0x07 /* H4S > H3S > H2S > H1S */ +#define PIPC_6 0x06 /* H4S > H3S > H1S > H2S */ +#define PIPC_5 0x05 /* H3S > H4S > H2S > H1S */ +#define PIPC_4 0x04 /* H3S > H4S > H1S > H2S */ +#define PIPC_3 0x03 /* H2S > H1S > H4S > H3S */ +#define PIPC_2 0x02 /* H1S > H2S > H4S > H3S */ +#define PIPC_1 0x01 /* H2S > H1S > H3S > H4S */ +#define PIPC_0 0x00 /* H1S > H2S > H3S > H4S */ + +/* port interrupt vector register */ + +#define PORT_IVEC_MASK 0xfc /* port interrupt vector mask */ + +/* port A/B control register */ + +#define PORT_SUBMODE_3 0xc0 /* port submode 3 */ +#define PORT_SUBMODE_2 0x80 /* port submode 2 */ +#define PORT_SUBMODE_1 0x40 /* port submode 1 */ +#define PORT_SUBMODE_0 0x00 /* port submode 0 */ +#define H24_CONTROL_7 0x38 /* control field = 7 */ +#define H24_CONTROL_6 0x30 /* control field = 6 */ +#define H24_CONTROL_5 0x28 /* control field = 5 */ +#define H24_CONTROL_4 0x20 /* control field = 4 */ +#define H24_CONTROL_3 0x18 /* control field = 3 */ +#define H24_CONTROL_2 0x10 /* control field = 2 */ +#define H24_CONTROL_1 0x08 /* control field = 1 */ +#define H24_CONTROL_0 0x00 /* control field = 0 */ +#define H24_INT_ENABLE 0x04 /* 0 = disabled, 1 = enabled */ +#define H13_SVCRQ_ENABLE 0x02 /* 0 = disabled, 1 = enabled */ +#define H13_STATUS 0x01 /* status */ + +/* port status register */ + +#define H4_LEVEL 0x80 /* H4 level */ +#define H3_LEVEL 0x40 /* H3 level */ +#define H2_LEVEL 0x20 /* H2 level */ +#define H1_LEVEL 0x10 /* H1 level */ +#define H4S 0x08 /* H4 status */ +#define H3S 0x04 /* H3 status */ +#define H2S 0x02 /* H2 status */ +#define H1S 0x01 /* H1 status */ + +/* timer control register */ + +#define TIMER_CTL_7 0xe0 /* timer control 7 */ +#define TIMER_CTL_6 0xc0 /* timer control 6 */ +#define TIMER_CTL_5 0xa0 /* timer control 5 */ +#define TIMER_CTL_4 0x80 /* timer control 4 */ +#define TIMER_CTL_3 0x60 /* timer control 3 */ +#define TIMER_CTL_2 0x40 /* timer control 2 */ +#define TIMER_CTL_1 0x20 /* timer control 1 */ +#define TIMER_CTL_0 0x00 /* timer control 0 */ +#define ZERO_DET_CTL 0x10 /* zero detect control */ + /* 10 = rollover, 00 = use preload */ +#define CLOCK_CTL_3 0x06 /* clock control 3 */ +#define CLOCK_CTL_2 0x04 /* clock control 2 */ +#define CLOCK_CTL_1 0x02 /* clock control 1 */ +#define CLOCK_CTL_0 0x00 /* clock control 0 */ +#define TIMER_ENABLE 0x01 /* 0 = disabled, 1 = enabled */ + +/* timer status register */ + +#define ZERO_DET_STATUS 0x01 /* read: zero detect status bit */ +#define PIT_ACK_INTR 0x01 /* write: acknowledge interrupt */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm68230h */ diff --git a/h/drv/multi/m68302.h b/h/drv/multi/m68302.h new file mode 100644 index 0000000..615080e --- /dev/null +++ b/h/drv/multi/m68302.h @@ -0,0 +1,675 @@ +/* m68302.h - Motorola MC68302 CPU control registers */ + +/* Copyright 1984-1996, Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,16dec96,dat fixed some hdlc values, SPR 2260 +01h,31may96,dat correct use of volatile type for SCC_BUFF & SCC_REG +01g,10may96,dat added IMP_SCCX_PARAM and IMP_SCCX_PROT for m68302Sio. +01f,22sep92,rrr added support for c++ +01e,10aug92,caf added TY_CO_DEV and function declarations for 5.1 upgrade. + for 5.0.x compatibility, define INCLUDE_TY_CO_DRV_50 when + including this header. +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01b,30sep91,caf added _ASMLANGUAGE conditional. +01a,19sep91,jcf written. +*/ + +/* +This file contains I/O address and related constants for the MC68302. +*/ + +#ifndef __INCm68302h +#define __INCm68302h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#ifndef INCLUDE_TY_CO_DRV_50 +#include "tyLib.h" +#endif /* INCLUDE_TY_CO_DRV_50 */ + +/* System Configuration Registers */ + +#define IMP_BAR ((UINT16 *)0xf2) /* Base Address Register */ +#define IMP_SCR ((UINT32 *)0xf4) /* System Control Register */ + +/* MC68302 parameter register addresses */ + +#define IMP_SCC1 ((SCC *) (IMP_BASE_ADRS + 0x400)) +#define IMP_SCC1_PARAM ((SCC_PARAM *)(IMP_BASE_ADRS + 0x480)) +#define IMP_SCC1_PROT ((PROT_UART *) (IMP_BASE_ADRS + 0x49c)) +#define IMP_SCC2 ((SCC *) (IMP_BASE_ADRS + 0x500)) +#define IMP_SCC2_PARAM ((SCC_PARAM *)(IMP_BASE_ADRS + 0x580)) +#define IMP_SCC2_PROT ((PROT_UART *) (IMP_BASE_ADRS + 0x59c)) +#define IMP_SCC3 ((SCC3 *) (IMP_BASE_ADRS + 0x600)) +#define IMP_SCC3_PARAM ((SCC_PARAM *)(IMP_BASE_ADRS + 0x680)) +#define IMP_SCC3_PROT ((PROT_UART *) (IMP_BASE_ADRS + 0x69c)) +#define IMP_CMR ((UINT16 *) (IMP_BASE_ADRS + 0x802)) +#define IMP_SAPR ((UINT32 *) (IMP_BASE_ADRS + 0x804)) +#define IMP_DAPR ((UINT32 *) (IMP_BASE_ADRS + 0x808)) +#define IMP_BCR ((UINT16 *) (IMP_BASE_ADRS + 0x80c)) +#define IMP_CSR ((UINT8 *) (IMP_BASE_ADRS + 0x80e)) +#define IMP_FCR ((UINT8 *) (IMP_BASE_ADRS + 0x810)) +#define IMP_GIMR ((UINT16 *) (IMP_BASE_ADRS + 0x812)) +#define IMP_IPR ((UINT16 *) (IMP_BASE_ADRS + 0x814)) +#define IMP_IMR ((UINT16 *) (IMP_BASE_ADRS + 0x816)) +#define IMP_ISR ((UINT16 *) (IMP_BASE_ADRS + 0x818)) +#define IMP_PACNT ((UINT16 *) (IMP_BASE_ADRS + 0x81e)) +#define IMP_PADDR ((UINT16 *) (IMP_BASE_ADRS + 0x820)) +#define IMP_PADAT ((UINT16 *) (IMP_BASE_ADRS + 0x822)) +#define IMP_PBCNT ((UINT16 *) (IMP_BASE_ADRS + 0x824)) +#define IMP_PBDDR ((UINT16 *) (IMP_BASE_ADRS + 0x826)) +#define IMP_PBDAT ((UINT16 *) (IMP_BASE_ADRS + 0x828)) +#define IMP_BR0 ((UINT16 *) (IMP_BASE_ADRS + 0x830)) +#define IMP_OR0 ((UINT16 *) (IMP_BASE_ADRS + 0x832)) +#define IMP_BR1 ((UINT16 *) (IMP_BASE_ADRS + 0x834)) +#define IMP_OR1 ((UINT16 *) (IMP_BASE_ADRS + 0x836)) +#define IMP_BR2 ((UINT16 *) (IMP_BASE_ADRS + 0x838)) +#define IMP_OR2 ((UINT16 *) (IMP_BASE_ADRS + 0x83a)) +#define IMP_BR3 ((UINT16 *) (IMP_BASE_ADRS + 0x83c)) +#define IMP_OR3 ((UINT16 *) (IMP_BASE_ADRS + 0x83e)) +#define IMP_TMR1 ((UINT16 *) (IMP_BASE_ADRS + 0x840)) +#define IMP_TRR1 ((UINT16 *) (IMP_BASE_ADRS + 0x842)) +#define IMP_TCR1 ((UINT16 *) (IMP_BASE_ADRS + 0x844)) +#define IMP_TCN1 ((UINT16 *) (IMP_BASE_ADRS + 0x846)) +#define IMP_TER1 ((UINT8 *) (IMP_BASE_ADRS + 0x849)) +#define IMP_WRR ((UINT16 *) (IMP_BASE_ADRS + 0x84a)) +#define IMP_WCN ((UINT16 *) (IMP_BASE_ADRS + 0x84c)) +#define IMP_TMR2 ((UINT16 *) (IMP_BASE_ADRS + 0x850)) +#define IMP_TRR2 ((UINT16 *) (IMP_BASE_ADRS + 0x852)) +#define IMP_TCR2 ((UINT16 *) (IMP_BASE_ADRS + 0x854)) +#define IMP_TCN2 ((UINT16 *) (IMP_BASE_ADRS + 0x856)) +#define IMP_TER2 ((UINT8 *) (IMP_BASE_ADRS + 0x859)) +#define IMP_CR ((UINT8 *) (IMP_BASE_ADRS + 0x860)) +#define IMP_SCC1_REG ((SCC_REG *)(IMP_BASE_ADRS + 0x880)) +#define IMP_SCC2_REG ((SCC_REG *)(IMP_BASE_ADRS + 0x890)) +#define IMP_SCC3_REG ((SCC_REG *)(IMP_BASE_ADRS + 0x8a0)) +#define IMP_SPMODE ((UINT16 *) (IMP_BASE_ADRS + 0x8b0)) +#define IMP_SIMASK ((UINT16 *) (IMP_BASE_ADRS + 0x8b2)) +#define IMP_SIMODE ((UINT16 *) (IMP_BASE_ADRS + 0x8b4)) + + +/* Internal Register Defines */ + +/* CR - Command Registers */ + +#define CR_FLG 0x01 /* CP/IMP spinlock flag */ +#define CR_GCI 0x40 /* GCI command */ +#define CR_GCI_TAR 0x00 /* GCI - Transmit abort request */ +#define CR_GCI_TOUT 0x10 /* GCI - Timeout */ +#define CR_RST 0x80 /* software reset command */ + +/* GIMR - Global Interrupt Mode Registers */ + +#define GIMR_VEC_MASK 0x00e0 /* vector bits 7 - 5 */ +#define GIMR_EDGE1 0x0100 /* IRQ1 edge triggered (else level) */ +#define GIMR_EDGE6 0x0200 /* IRQ6 edge triggered (else level) */ +#define GIMR_EDGE7 0x0400 /* IRQ7 edge triggered (else level) */ +#define GIMR_EXT_VEC1 0x1000 /* level 1 vector external */ +#define GIMR_EXT_VEC6 0x2000 /* level 6 vector external */ +#define GIMR_EXT_VEC7 0x4000 /* level 7 vector external */ +#define GIMR_DISCRETE 0x8000 /* IPL0-IPL2 are IRQ1/IRQ6/IRQ7 */ + +/* IPR/IMR/ISR - Interrupt Pending/Mask/In-Service Registers */ + +#define INT_ERR 0x0001 /* response to ext. level 4 */ +#define INT_PB8 0x0002 /* parrallel port B (bit 8) */ +#define INT_SMC2 0x0004 /* serial management controller 2 */ +#define INT_SMC1 0x0008 /* serial management controller 1 */ +#define INT_TMR3 0x0010 /* timer 3 */ +#define INT_SCP 0x0020 /* serial comunication port */ +#define INT_TMR2 0x0040 /* timer 2 */ +#define INT_PB9 0x0080 /* parrallel port B (bit 9) */ +#define INT_SCC3 0x0100 /* serial comunication controller 3 */ +#define INT_TMR1 0x0200 /* timer 1 */ +#define INT_SCC2 0x0400 /* serial comunication controller 2 */ +#define INT_IDMA 0x0800 /* independent direct memory access */ +#define INT_SDMA 0x1000 /* serial direct memory access */ +#define INT_SCC1 0x2000 /* serial comunication controller 1 */ +#define INT_PB10 0x4000 /* parrallel port B (bit 10) */ +#define INT_PB11 0x8000 /* parrallel port B (bit 11) */ + +/* Interrupt Vectors */ + +#define INT_VEC_ERR (0x0 | (*IMP_GIMR & GIMR_VEC_MASK)) +#define INT_VEC_PB8 (0x1 | (*IMP_GIMR & GIMR_VEC_MASK)) +#define INT_VEC_SMC2 (0x2 | (*IMP_GIMR & GIMR_VEC_MASK)) +#define INT_VEC_SMC1 (0x3 | (*IMP_GIMR & GIMR_VEC_MASK)) +#define INT_VEC_TMR3 (0x4 | (*IMP_GIMR & GIMR_VEC_MASK)) +#define INT_VEC_SCP (0x5 | (*IMP_GIMR & GIMR_VEC_MASK)) +#define INT_VEC_TMR2 (0x6 | (*IMP_GIMR & GIMR_VEC_MASK)) +#define INT_VEC_PB9 (0x7 | (*IMP_GIMR & GIMR_VEC_MASK)) +#define INT_VEC_SCC3 (0x8 | (*IMP_GIMR & GIMR_VEC_MASK)) +#define INT_VEC_TMR1 (0x9 | (*IMP_GIMR & GIMR_VEC_MASK)) +#define INT_VEC_SCC2 (0xa | (*IMP_GIMR & GIMR_VEC_MASK)) +#define INT_VEC_IDMA (0xb | (*IMP_GIMR & GIMR_VEC_MASK)) +#define INT_VEC_SDMA (0xc | (*IMP_GIMR & GIMR_VEC_MASK)) +#define INT_VEC_SCC1 (0xd | (*IMP_GIMR & GIMR_VEC_MASK)) +#define INT_VEC_PB10 (0xe | (*IMP_GIMR & GIMR_VEC_MASK)) +#define INT_VEC_PB11 (0xf | (*IMP_GIMR & GIMR_VEC_MASK)) + +/* TMR1/TMR2 - Timer Mode Register */ + +#define TMR_ENABLE 0x0001 /* enable timer */ +#define TMR_STOP 0x0000 /* stop count */ +#define TMR_CLK 0x0002 /* count source is master clock */ +#define TMR_CLK16 0x0004 /* count source is master clock/16 */ +#define TMR_CLK_EXT 0x0006 /* count source is falling edge TIN */ +#define TMR_RESTART 0x0008 /* count is restarted upon ref cnt */ +#define TMR_INT 0x0010 /* enable interrupt upon ref cnt */ +#define TMR_TOGGLE 0x0020 /* toggle output */ +#define TMR_CAP_DIS 0x0000 /* disable interrupt on capture event */ +#define TMR_CAP_RISE 0x0040 /* enable int w/ capture rising edge */ +#define TMR_CAP_FALL 0x0080 /* enable int w/ capture falling edge */ +#define TMR_CAP_ANY 0x00c0 /* enable int w/ capture any edge */ + +/* TER1/TER2 - Timer Event Register */ + +#define TER_CAPTURE 0x01 /* counter value has been captured */ +#define TER_REF_CNT 0x02 /* counter value reached ref. cnt */ + +/* CS_BR - Chip Select Base Register */ + +#define CS_BR_ENABLE 0x0001 /* chip select pin is enabled */ +#define CS_BR_WRITE 0x0002 /* chip select pin write only */ + +/* CS_OR - Chip Select Options Register */ + +#define CS_OR_CFC 0x0001 /* function code of CS_BR compared */ +#define CS_OR_UNMASK_RW 0x0002 /* r/w bit of CS_BR is not masked */ + +/* SCR - System Control Register */ + +#define SCR_LPEN 0x00000020 /* low power mode enabled */ +#define SCR_LPP16 0x00000040 /* low power clock/16 prescale enable */ +#define SCR_LPREC 0x00000080 /* destructive low power recovery */ +#define SCR_HWDEN 0x00000800 /* hardware watchdog enable */ +#define SCR_SAM 0x00001000 /* synchronous access mode */ +#define SCR_FRZ1 0x00002000 /* freeze timer 1 */ +#define SCR_FRZ2 0x00004000 /* freeze timer 2 */ +#define SCR_FRZW 0x00008000 /* freeze watchdog timer */ +#define SCR_BCLM 0x00010000 /* BCLR derived from IPEND */ +#define SCR_ADCE 0x00020000 /* BERR on address decode conflict */ +#define SCR_EMWS 0x00040000 /* external master wait state */ +#define SCR_RMCST 0x00080000 /* RMC cycle special treatment */ +#define SCR_WPVE 0x00100000 /* BERR on write protect violation */ +#define SCR_VGE 0x00200000 /* vector generation enable (discpu) */ +#define SCR_ERRE 0x00400000 /* external RISC request enable */ +#define SCR_ADC 0x01000000 /* address decode conflict */ +#define SCR_WPV 0x02000000 /* write protect violation */ +#define SCR_HWT 0x04000000 /* hardware watchdog timeout */ +#define SCR_IPA 0x08000000 /* interrupt priority active */ + +/* SCC - Serial Comunications Controller */ + +typedef volatile struct /* SCC_BUF */ + { + UINT16 statusMode; /* status/mode protocal specific */ + UINT16 dataLength; /* length of buffer in bytes */ + char * dataPointer; /* points to data buffer */ + } SCC_BUF; + +typedef struct /* SCC_PARAM */ + { + UINT8 rfcr; /* receive function code */ + UINT8 tfcr; /* transmit function code */ + UINT16 mrblr; /* maximum receive buffer length */ + UINT16 res1; /* reserved/internal */ + UINT8 res2; /* reserved/internal */ + UINT8 rbd; /* receive internal buffer number */ + UINT16 res3[5]; /* reserved/internal */ + UINT8 res4; /* reserved/internal */ + UINT8 tbd; /* transmit internal buffer number */ + UINT16 res5[4]; /* reserved/internal */ + } SCC_PARAM; + +typedef struct /* SCC */ + { + SCC_BUF rxBd[8]; /* receive buffer descriptors */ + SCC_BUF txBd[8]; /* transmit buffer descriptors */ + SCC_PARAM param; /* SCC parameters */ + char prot[64]; /* protocol specific area */ + } SCC; + +typedef struct /* SCC3 */ + { + SCC_BUF rxBd[8]; /* receive buffer descriptors */ + SCC_BUF txBd[4]; /* transmit buffer descriptors */ + UINT16 res1[3]; /* reserved/internal */ + UINT16 smc1RxBd; /* SMC1 receive buffer descriptor */ + UINT16 smc1TxBd; /* SMC1 transmit buffer descriptor */ + UINT16 smc2RxBd; /* SMC2 receive buffer descriptor */ + UINT16 smc2TxBd; /* SMC2 transmit buffer descriptor */ + UINT16 res2[6]; /* reserved/internal */ + UINT16 scpBd; /* SCP buffer descriptor */ + UINT16 sccBerr; /* SCC channel bus error status */ + UINT16 rev; /* MC68302 revision number */ + SCC_PARAM param; /* SCC parameters */ + char prot[64]; /* protocol specific area */ + } SCC3; + +typedef volatile struct /* SCC_REG */ + { + UINT16 res1; /* reserved/internal */ + UINT16 scon; /* configuration register */ + UINT16 scm; /* mode register */ + UINT16 dsr; /* data sync. register */ + UINT8 scce; /* event register */ + UINT8 res2; /* reserved/internal */ + UINT8 sccm; /* mask register */ + UINT8 res3; /* reserved/internal */ + UINT8 sccs; /* status register */ + UINT8 res4; /* reserved/internal */ + UINT16 res5; /* reserved/internal */ + } SCC_REG; + +/* SCC Configuration Register */ + +#define SCON_DIV4 0x0001 /* SCC clock prescaler divide by 4 */ +#define SCON_EXT_RX_CLK 0x1000 /* RCLK pin is rx baud rate source */ +#define SCON_EXT_TX_CLK 0x2000 /* RCLK pin is tx baud rate source */ +#define SCON_EXT_BAUD 0x4000 /* TIN1 pin is baud rate clk source */ +#define SCON_WIRED_OR 0x8000 /* TXD pin is placed in open drain */ + +/* UART Protocol - SCC protocol specific parameters */ + +typedef volatile struct /* PROT_UART */ + { + UINT16 maxIdl; /* maximum idle characters */ + UINT16 idlc; /* temporary receive idle counter */ + UINT16 brkcr; /* break count register */ + UINT16 parec; /* receive parity error counter */ + UINT16 frmec; /* receive framing error counter */ + UINT16 nosec; /* receive noise counter */ + UINT16 brkec; /* receive break character counter */ + UINT16 uaddr1; /* uart address character 1 */ + UINT16 uaddr2; /* uart address character 2 */ + UINT16 rccr; /* receive control character register */ + UINT16 cntChar1; /* control character 1 */ + UINT16 cntChar2; /* control character 2 */ + UINT16 cntChar3; /* control character 3 */ + UINT16 cntChar4; /* control character 4 */ + UINT16 cntChar5; /* control character 5 */ + UINT16 cntChar6; /* control character 6 */ + UINT16 cntChar7; /* control character 7 */ + UINT16 cntChar8; /* control character 8 */ + } PROT_UART; + +/* UART Protocol - SCC Mode Register */ + +#define UART_SCM_HDLC 0x0000 /* hdlc mode */ +#define UART_SCM_ASYNC 0x0001 /* asynchronous mode (uart/ddcmp) */ +#define UART_SCM_SYNC 0x0002 /* synchronous mode (ddcmp/v.110) */ +#define UART_SCM_BISYNC 0x0003 /* bisync/promiscuous mode */ +#define UART_SCM_ENT 0x0004 /* enable transmitter */ +#define UART_SCM_ENR 0x0008 /* enable receiver */ +#define UART_SCM_LOOPBACK 0x0010 /* transmitter hooked to receiver */ +#define UART_SCM_ECHO 0x0020 /* transmitter echoes received chars */ +#define UART_SCM_MANUAL 0x0030 /* cts/cd under software control */ +#define UART_SCM_STOP_2 0x0040 /* two stop bits (one otherwise) */ +#define UART_SCM_RTSM 0x0080 /* 0:rts w/ tx char; 1:rts w/ tx enbl */ +#define UART_SCM_8BIT 0x0100 /* 8 bit char. length (7 otherwise) */ +#define UART_SCM_FRZ_TX 0x0200 /* freeze transmitter */ +#define UART_SCM_DROP1 0x0400 /* multidrop w/o adrs. recognition */ +#define UART_SCM_DDCMP 0x0800 /* ddcmp protocol selected */ +#define UART_SCM_DROP2 0x0c00 /* multidrop w adrs. recognition */ +#define UART_SCM_PARITY 0x1000 /* parity is enabled */ +#define UART_SCM_RX_EVEN 0x2000 /* rx even parity */ +#define UART_SCM_TX_ODD 0x0000 /* tx odd parity */ +#define UART_SCM_TX_SPACE 0x4000 /* tx space parity */ +#define UART_SCM_TX_EVEN 0x8000 /* tx even parity */ +#define UART_SCM_TX_MARK 0xc000 /* tx mark parity */ + +/* UART Protocol - SCC Event Register */ + +#define UART_SCCE_RX 0x01 /* buffer received */ +#define UART_SCCE_TX 0x02 /* buffer transmitted */ +#define UART_SCCE_BSY 0x04 /* character discarded, no buffers */ +#define UART_SCCE_CCR 0x08 /* control character received */ +#define UART_SCCE_BRK 0x10 /* break character received */ +#define UART_SCCE_IDL 0x20 /* idle sequence status changed */ +#define UART_SCCE_CD 0x40 /* carrier detect status changed */ +#define UART_SCCE_CTS 0x80 /* clear to send status changed */ + +/* UART Protocol - Receive Buffer Descriptor */ + +#define UART_RX_BD_CD 0x0001 /* carrier detect loss during rx */ +#define UART_RX_BD_OV 0x0002 /* receiver overrun */ +#define UART_RX_BD_PR 0x0008 /* parity error */ +#define UART_RX_BD_FR 0x0010 /* framing error */ +#define UART_RX_BD_BR 0x0020 /* break received */ +#define UART_RX_BD_ID 0x0100 /* buf closed on reception of IDLES */ +#define UART_RX_BD_UADDR1 0x0200 /* matched UADDR1 (UADDR2 otherwise) */ +#define UART_RX_BD_ADDR 0x0400 /* buffer contained address */ +#define UART_RX_BD_CNT 0x0800 /* control character in last byte */ +#define UART_RX_BD_INT 0x1000 /* interrupt will be generated */ +#define UART_RX_BD_WRAP 0x2000 /* wrap back to first BD */ +#define UART_RX_BD_EXT 0x4000 /* buffer in external memory */ +#define UART_RX_BD_EMPTY 0x8000 /* buffer is empty (available to CP) */ + +/* UART Protocol - Transmit Buffer Descriptor */ + +#define UART_TX_BD_CT 0x0001 /* cts was lost during tx */ +#define UART_TX_BD_PREAMBLE 0x0200 /* enable preamble */ +#define UART_TX_BD_ADDR 0x0400 /* buffer contained address char */ +#define UART_TX_BD_CTSR 0x0800 /* normal cts error reporting */ +#define UART_TX_BD_INT 0x1000 /* interrupt will be generated */ +#define UART_TX_BD_WRAP 0x2000 /* wrap back to first BD */ +#define UART_TX_BD_EXT 0x4000 /* buffer in external memory */ +#define UART_TX_BD_READY 0x8000 /* buffer is being sent (don't touch) */ + + +/* HDLC Protocol - SCC protocol specific parameters */ + +typedef struct /* PROT_HDLC */ + { + UINT16 rcrcLow; /* temporary receive crc low */ + UINT16 rcrcHigh; /* temporary receive crc high */ + UINT16 cMaskLow; /* constant (0xf0b8:16b; 0xdebb:32b) */ + UINT16 cMaskHigh; /* constant (0xf0b8:16b; 0x20e3:32b) */ + UINT16 tCrcLow; /* temporary transmit crc low */ + UINT16 tCrcHigh; /* temporary transmit crc high */ + UINT16 disfc; /* discard frame counter */ + UINT16 crcec; /* crc error counter */ + UINT16 abtsc; /* abort sequence counter */ + UINT16 nmarc; /* nonmatching adrs received counter */ + UINT16 retrc; /* frame retransmission counter */ + UINT16 mflr; /* max frame length register */ + UINT16 maxCnt; /* max length counter */ + UINT16 hmask; /* user-defined frame address mask */ + UINT16 haddr1; /* user-defined frame address */ + UINT16 haddr2; /* user-defined frame address */ + UINT16 haddr3; /* user-defined frame address */ + UINT16 haddr4; /* user-defined frame address */ + } PROT_HDLC; + +/* HDLC Protocol - SCC Mode Register */ + +#define HDLC_SCM_HDLC 0x0000 /* hdlc mode */ +#define HDLC_SCM_ASYNC 0x0001 /* asynchronous mode (uart/ddcmp) */ +#define HDLC_SCM_SYNC 0x0002 /* synchronous mode (ddcmp/v.110) */ +#define HDLC_SCM_BISYNC 0x0003 /* bisync/promiscuous mode */ +#define HDLC_SCM_ENT 0x0004 /* enable transmitter */ +#define HDLC_SCM_ENR 0x0008 /* enable receiver */ +#define HDLC_SCM_LOOPBACK 0x0010 /* transmitter hooked to receiver */ +#define HDLC_SCM_ECHO 0x0020 /* transmitter echoes received chars */ +#define HDLC_SCM_MANUAL 0x0030 /* cts/cd under software control */ +#define HDLC_SCM_NRZI 0x0040 /* nrzi tx encoding (nrz otherwise) */ +#define HDLC_SCM_FLG 0x0080 /* send flags between frames */ +#define HDLC_SCM_RTE 0x0100 /* retransmit enable */ +#define HDLC_SCM_FSE 0x0400 /* flag sharing enable */ +#define HDLC_SCM_C32 0x0800 /* 32 bit CCITT crc */ + +/* HDLC Protocol - SCC Event Register */ + +#define HDLC_SCCE_RXB 0x01 /* incomplete buffer received */ +#define HDLC_SCCE_TXB 0x02 /* buffer transmitted */ +#define HDLC_SCCE_BSY 0x04 /* frame discarded, no buffers */ +#define HDLC_SCCE_RXF 0x08 /* complete frame received */ +#define HDLC_SCCE_TXE 0x10 /* transmitter error */ +#define HDLC_SCCE_IDL 0x20 /* idle sequence status changed */ +#define HDLC_SCCE_CD 0x40 /* carrier detect status changed */ +#define HDLC_SCCE_CTS 0x80 /* clear to send status changed */ + +/* HDLC Protocol - Receive Buffer Descriptor */ + +#define HDLC_RX_BD_CD 0x0001 /* carrier detect loss during rx */ +#define HDLC_RX_BD_OV 0x0002 /* receiver overrun */ +#define HDLC_RX_BD_CRC 0x0004 /* crc error */ +#define HDLC_RX_BD_ABORT 0x0008 /* abort sequence */ +#define HDLC_RX_BD_NO 0x0010 /* non-octet frame received */ +#define HDLC_RX_BD_LG 0x0020 /* rx frame length violation */ +#define HDLC_RX_BD_FIRST 0x0400 /* buffer first in frame */ +#define HDLC_RX_BD_LAST 0x0800 /* buffer last in frame */ +#define HDLC_RX_BD_INT 0x1000 /* interrupt will be generated */ +#define HDLC_RX_BD_WRAP 0x2000 /* wrap back to first BD */ +#define HDLC_RX_BD_EXT 0x4000 /* buffer in external memory */ +#define HDLC_RX_BD_EMPTY 0x8000 /* buffer is empty (available to CP) */ + +/* HDLC Protocol - Transmit Buffer Descriptor */ + +#define HDLC_TX_BD_CT 0x0001 /* cts was lost during tx */ +#define HDLC_TX_BD_UN 0x0002 /* underrun during tx */ +#define HDLC_TX_BD_CRC 0x0400 /* transmit crc after last byte */ +#define HDLC_TX_BD_LAST 0x0800 /* last buffer in current frame */ +#define HDLC_TX_BD_INT 0x1000 /* interrupt will be generated */ +#define HDLC_TX_BD_WRAP 0x2000 /* wrap back to first BD */ +#define HDLC_TX_BD_EXT 0x4000 /* buffer in external memory */ +#define HDLC_TX_BD_READY 0x8000 /* buffer is being sent (don't touch) */ + + +/* BISYNC Protocol - SCC protocol specific parameters */ + +typedef struct /* PROT_BISYNC */ + { + UINT16 rcrc; /* temporary receive crc */ + UINT16 crcc; /* crc constant */ + UINT16 prcrc; /* preset receiver crc16/lrc */ + UINT16 tcrc; /* temporary transmit crc */ + UINT16 ptcrc; /* preset transmit crc16/lrc */ + UINT16 res1; /* reserved */ + UINT16 res2; /* reserved */ + UINT16 parec; /* receive parity error counter */ + UINT16 bsync; /* bisync sync character */ + UINT16 bdle; /* bisync dle character */ + UINT16 cntChar1; /* control character 1 */ + UINT16 cntChar2; /* control character 2 */ + UINT16 cntChar3; /* control character 3 */ + UINT16 cntChar4; /* control character 4 */ + UINT16 cntChar5; /* control character 5 */ + UINT16 cntChar6; /* control character 6 */ + UINT16 cntChar7; /* control character 7 */ + UINT16 cntChar8; /* control character 8 */ + } PROT_BISYNC; + +/* BISYNC Protocol - SCC Mode Register */ + +#define BISYNC_SCM_HDLC 0x0000 /* hdlc mode */ +#define BISYNC_SCM_ASYNC 0x0001 /* asynchronous mode (uart/ddcmp) */ +#define BISYNC_SCM_SYNC 0x0002 /* synchronous mode (ddcmp/v.110) */ +#define BISYNC_SCM_BISYNC 0x0003 /* bisync/promiscuous mode */ +#define BISYNC_SCM_ENT 0x0004 /* enable transmitter */ +#define BISYNC_SCM_ENR 0x0008 /* enable receiver */ +#define BISYNC_SCM_LOOPBACK 0x0010 /* transmitter hooked to receiver */ +#define BISYNC_SCM_ECHO 0x0020 /* transmitter echoes received chars */ +#define BISYNC_SCM_MANUAL 0x0030 /* cts/cd under software control */ +#define BISYNC_SCM_NRZI 0x0040 /* nrzi tx encoding (nrz otherwise) */ +#define BISYNC_SCM_SYNF 0x0080 /* send SYN1-SYN2 pairs between msgs */ +#define BISYNC_SCM_RBCS 0x0100 /* enable receive BCS */ +#define BISYNC_SCM_RTR 0x0200 /* enable receiver transparent mode */ +#define BISYNC_SCM_BCS 0x0800 /* CRC16 (LRC otherwise) */ +#define BISYNC_SCM_REVD 0x1000 /* reverse data (msb first) */ +#define BISYNC_SCM_NTSYN 0x2000 /* no transmit sync */ +#define BISYNC_SCM_EXSYN 0x4000 /* external sync mode */ +#define BISYNC_SCM_EVEN 0x8000 /* even parity */ + +/* BISYNC Protocol - SCC Event Register */ + +#define BISYNC_SCCE_RX 0x01 /* buffer received */ +#define BISYNC_SCCE_TX 0x02 /* buffer transmitted */ +#define BISYNC_SCCE_BSY 0x04 /* character discarded, no buffers */ +#define BISYNC_SCCE_RCH 0x08 /* character received, put in buffer */ +#define BISYNC_SCCE_TXE 0x10 /* transmitter error */ +#define BISYNC_SCCE_CD 0x40 /* carrier detect status changed */ +#define BISYNC_SCCE_CTS 0x80 /* clear to send status changed */ + +/* BISYNC Protocol - Receive Buffer Descriptor */ + +#define BISYNC_RX_BD_CD 0x0001 /* carrier detect loss during rx */ +#define BISYNC_RX_BD_OV 0x0002 /* receiver overrun */ +#define BISYNC_RX_BD_BCS_ERR 0x0004 /* bcs error */ +#define BISYNC_TX_BD_PARITY 0x0008 /* parity error */ +#define BISYNC_RX_BD_DLE 0x0010 /* DLE follow character error */ +#define BISYNC_RX_BD_BCS 0x0400 /* BCS received */ +#define BISYNC_RX_BD_CNT 0x0800 /* last byte is control character */ +#define BISYNC_RX_BD_INT 0x1000 /* interrupt will be generated */ +#define BISYNC_RX_BD_WRAP 0x2000 /* wrap back to first BD */ +#define BISYNC_RX_BD_EXT 0x4000 /* buffer in external memory */ +#define BISYNC_RX_BD_EMPTY 0x8000 /* buffer is empty (available to CP) */ + +/* BISYNC Protocol - Transmit Buffer Descriptor */ + +#define BISYNC_TX_BD_CT 0x0001 /* cts was lost during tx */ +#define BISYNC_TX_BD_UN 0x0002 /* underrun during tx */ +#define BISYNC_TX_BD_TR 0x0040 /* transparent mode */ +#define BISYNC_TX_BD_TX_DLE 0x0080 /* transmit DLE character */ +#define BISYNC_TX_BD_BR 0x0100 /* reset BCS accumulation */ +#define BISYNC_TX_BD_BCS 0x0200 /* include buffer in BCS accumulation */ +#define BISYNC_TX_BD_BCS_TX 0x0400 /* transmit BCS after last byte */ +#define BISYNC_TX_BD_LAST 0x0800 /* last buffer in current frame */ +#define BISYNC_TX_BD_INT 0x1000 /* interrupt will be generated */ +#define BISYNC_TX_BD_WRAP 0x2000 /* wrap back to first BD */ +#define BISYNC_TX_BD_EXT 0x4000 /* buffer in external memory */ +#define BISYNC_TX_BD_READY 0x8000 /* buffer is being sent (don't touch) */ + + +/* DDCMP Protocol - SCC protocol specific parameters */ + +typedef struct /* PROT_DDCMP */ + { + UINT16 rcrc; /* temporary receive crc */ + UINT16 crcc; /* crc constant */ + UINT16 pcrc; /* preset receiver crc16 */ + UINT16 tcrc; /* temporary transmit crc */ + UINT16 dsoh; /* ddcmp soh character */ + UINT16 denq; /* ddcmp enq character */ + UINT16 ddle; /* ddcmp dle character */ + UINT16 crc1ec; /* crc1 error counter */ + UINT16 crc2ec; /* crc2 error counter */ + UINT16 nmarc; /* nonmatching adrs received counter */ + UINT16 dismc; /* discard message counter */ + UINT16 rmlg; /* received message length */ + UINT16 rmlgCnt; /* received message length counter */ + UINT16 dmask; /* user-defined frame address mask */ + UINT16 daddr1; /* user-defined frame address */ + UINT16 daddr2; /* user-defined frame address */ + UINT16 daddr3; /* user-defined frame address */ + UINT16 daddr4; /* user-defined frame address */ + } PROT_DDCMP; + +/* DDCMP Protocol - SCC Mode Register */ + +#define DDCMP_SCM_HDLC 0x0000 /* hdlc mode */ +#define DDCMP_SCM_ASYNC 0x0001 /* asynchronous mode (uart/ddcmp) */ +#define DDCMP_SCM_SYNC 0x0002 /* synchronous mode (ddcmp/v.110) */ +#define DDCMP_SCM_BISYNC 0x0003 /* bisync/promiscuous mode */ +#define DDCMP_SCM_ENT 0x0004 /* enable transmitter */ +#define DDCMP_SCM_ENR 0x0008 /* enable receiver */ +#define DDCMP_SCM_LOOPBACK 0x0010 /* transmitter hooked to receiver */ +#define DDCMP_SCM_ECHO 0x0020 /* transmitter echoes received chars */ +#define DDCMP_SCM_MANUAL 0x0030 /* cts/cd under software control */ +#define DDCMP_SCM_NRZI 0x0040 /* nrzi tx encoding (nrz otherwise) */ +#define DDCMP_SCM_SYNF 0x0080 /* send SYN1-SYN2 pairs between msgs */ +#define DDCMP_SCM_V110 0x0400 /* V.110 protocol selected */ + +/* DDCMP Protocol - SCC Event Register */ + +#define DDCMP_SCCE_RBD 0x01 /* incomplete buffer received */ +#define DDCMP_SCCE_TX 0x02 /* buffer transmitted */ +#define DDCMP_SCCE_BSY 0x04 /* data byte discarded, no buffers */ +#define DDCMP_SCCE_RBK 0x08 /* complete block received */ +#define DDCMP_SCCE_TXE 0x10 /* transmitter error */ +#define DDCMP_SCCE_CD 0x40 /* carrier detect status changed */ +#define DDCMP_SCCE_CTS 0x80 /* clear to send status changed */ + +/* DDCMP Protocol - Receive Buffer Descriptor */ + +#define DDCMP_RX_BD_CD 0x0001 /* carrier detect loss during rx */ +#define DDCMP_RX_BD_OV 0x0002 /* receiver overrun */ +#define DDCMP_RX_BD_CRC_ERR 0x0004 /* crc error */ +#define DDCMP_TX_BD_PARITY 0x0008 /* parity error */ +#define DDCMP_RX_BD_FR 0x0010 /* framing error */ +#define DDCMP_RX_BD_CF 0x0020 /* crc follow error */ +#define DDCMP_RX_BD_DATA 0x0000 /* data message */ +#define DDCMP_RX_BD_CNT 0x0100 /* control message */ +#define DDCMP_RX_BD_MAINT 0x0200 /* maintenance message */ +#define DDCMP_RX_BD_HEADER 0x0400 /* buffer contains header */ +#define DDCMP_RX_BD_LAST 0x0800 /* last byte is control character */ +#define DDCMP_TX_BD_INT 0x1000 /* interrupt will be generated */ +#define DDCMP_RX_BD_WRAP 0x2000 /* wrap back to first BD */ +#define DDCMP_RX_BD_EXT 0x4000 /* buffer in external memory */ +#define DDCMP_RX_BD_EMPTY 0x8000 /* buffer is empty (available to CP) */ + +/* DDCMP Protocol - Transmit Buffer Descriptor */ + +#define DDCMP_TX_BD_CT 0x0001 /* cts was lost during tx */ +#define DDCMP_TX_BD_UN 0x0002 /* underrun during tx */ +#define DDCMP_TX_BD_OPTLAST 0x0200 /* optional last */ +#define DDCMP_TX_BD_TX_CRC 0x0400 /* transmit crc16 after last byte */ +#define DDCMP_TX_BD_LAST 0x0800 /* last buffer in current frame */ +#define DDCMP_TX_BD_INT 0x1000 /* interrupt will be generated */ +#define DDCMP_TX_BD_WRAP 0x2000 /* wrap back to first BD */ +#define DDCMP_TX_BD_EXT 0x4000 /* buffer in external memory */ +#define DDCMP_TX_BD_READY 0x8000 /* buffer is being sent (don't touch) */ + + +/* V.110 Protocol - SCC protocol specific parameters */ + +/* V.110 Protocol - SCC Event Register */ + +#define V110_SCCE_TX 0x02 /* buffer transmitted */ +#define V110_SCCE_BSY 0x04 /* data byte discarded, no buffers */ +#define V110_SCCE_RXF 0x08 /* complete frame received */ +#define V110_SCCE_TXE 0x10 /* transmitter error */ + +/* V110 Protocol - Receive Buffer Descriptor */ + +#define V110_RX_BD_OV 0x0002 /* receiver overrun */ +#define V110_RX_BD_SYNC_ERR 0x0008 /* synchronization error */ +#define V110_RX_BD_WRAP 0x2000 /* wrap back to first BD */ +#define V110_RX_BD_EXT 0x4000 /* buffer in external memory */ +#define V110_RX_BD_EMPTY 0x8000 /* buffer is empty (available to CP) */ + +/* V110 Protocol - Transmit Buffer Descriptor */ + +#define V110_TX_BD_UN 0x0002 /* underrun during tx */ +#define V110_TX_BD_TR 0x0040 /* transparent mode */ +#define V110_TX_BD_LAST 0x0800 /* last buffer in current frame */ +#define V110_TX_BD_INT 0x1000 /* interrupt will be generated */ +#define V110_TX_BD_WRAP 0x2000 /* wrap back to first BD */ +#define V110_TX_BD_EXT 0x4000 /* buffer in external memory */ +#define V110_TX_BD_READY 0x8000 /* buffer is being sent (don't touch) */ + +#ifndef INCLUDE_TY_CO_DRV_50 + +typedef struct /* TY_CO_DEV */ + { + TY_DEV tyDev; /* tyLib will handle this portion */ + BOOL created; /* true if this device has been created */ + char numChannels; /* number of channels to support */ + int clockRate; /* CPU clock frequency (Hz) */ + SCC * pScc; /* serial communication cntrlr */ + SCC_REG * pSccReg; /* serial communication cntrlr registers */ + int rxBdNext; /* next rcv buffer descriptor to fill */ + UINT16 intAck; /* interrupt acknowledge mask */ + } TY_CO_DEV; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT void tyCoInt (TY_CO_DEV * pDv); + +#else /* __STDC__ */ + +IMPORT void tyCoInt (); + +#endif /* __STDC__ */ +#endif /* INCLUDE_TY_CO_DRV_50 */ +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm68302h */ diff --git a/h/drv/multi/m68332.h b/h/drv/multi/m68332.h new file mode 100644 index 0000000..d10704e --- /dev/null +++ b/h/drv/multi/m68332.h @@ -0,0 +1,793 @@ +/* m68332.h - Motorola MC68332 CPU control registers */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01m,20dec96,dat fixed SPR 4225, M332_RAM_RAMBAR was incorrect +01l,24oct92,jcf fixed TPU defines. +01k,22sep92,rrr added support for c++ +01j,02jul92,caf added TY_CO_DEV and function declarations for 5.1 upgrade. + for 5.0.x compatibility, define INCLUDE_TY_CO_DRV_50 when + including this header. +01e,26may92,rrr the tree shuffle +01d,22jan92,caf fixed M332_QSM_CMD_BASE, QSM_QILR_SPI_MASK and SIM_CSOR_IPL. +01c,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01b,30sep91,caf added _ASMLANGUAGE conditional. +01a,13feb91,jcf based on Tektronix original. +*/ + +/* +This file contains I/O address and related constants for the MC68332. +*/ + +#ifndef __INCm68332h +#define __INCm68332h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "tyLib.h" + +#ifndef INCLUDE_TY_CO_DRV_50 + +typedef struct /* TY_CO_DEV */ + { + TY_DEV tyDev; + BOOL created; /* true if this device has been created */ + int baudFreq; /* system clock frequency */ + } TY_CO_DEV; + +#endif /* INCLUDE_TY_CO_DRV_50 */ + +/* MC68332 parameter register addresses */ + +#define M332_SIM_MCR ((UINT16 *) 0xfffa00) +#define M332_SIM_SIMTR ((UINT16 *) 0xfffa02) +#define M332_SIM_SYNCR ((UINT16 *) 0xfffa04) +#define M332_SIM_RSR ((UINT8 *) 0xfffa07) +#define M332_SIM_SIMTRE ((UINT16 *) 0xfffa08) +#define M332_SIM_PORTE ((UINT8 *) 0xfffa11) +#define M332_SIM_DDRE ((UINT8 *) 0xfffa15) +#define M332_SIM_PEPAR ((UINT8 *) 0xfffa17) +#define M332_SIM_PORTF ((UINT8 *) 0xfffa19) +#define M332_SIM_DDRF ((UINT8 *) 0xfffa1d) +#define M332_SIM_PFPAR ((UINT8 *) 0xfffa1f) +#define M332_SIM_SYPCR ((UINT8 *) 0xfffa21) +#define M332_SIM_PICR ((UINT16 *) 0xfffa22) +#define M332_SIM_PITR ((UINT16 *) 0xfffa24) +#define M332_SIM_SWSR ((UINT8 *) 0xfffa27) +#define M332_SIM_TSTMSRA ((UINT16 *) 0xfffa30) +#define M332_SIM_TSTMSRB ((UINT16 *) 0xfffa32) +#define M332_SIM_TSTSC ((UINT16 *) 0xfffa34) +#define M332_SIM_TSTRC ((UINT16 *) 0xfffa36) +#define M332_SIM_CREG ((UINT16 *) 0xfffa38) +#define M332_SIM_DREG ((UINT16 *) 0xfffa3a) +#define M332_SIM_PORTC ((UINT8 *) 0xfffa41) +#define M332_SIM_CSPAR0 ((UINT16 *) 0xfffa44) +#define M332_SIM_CSPAR1 ((UINT16 *) 0xfffa46) +#define M332_SIM_CSBOOT ((SIM_CS *) 0xfffa48) +#define M332_SIM_CS0 ((SIM_CS *) 0xfffa4c) +#define M332_SIM_CS1 ((SIM_CS *) 0xfffa50) +#define M332_SIM_CS2 ((SIM_CS *) 0xfffa54) +#define M332_SIM_CS3 ((SIM_CS *) 0xfffa58) +#define M332_SIM_CS4 ((SIM_CS *) 0xfffa5c) +#define M332_SIM_CS5 ((SIM_CS *) 0xfffa60) +#define M332_SIM_CS6 ((SIM_CS *) 0xfffa64) +#define M332_SIM_CS7 ((SIM_CS *) 0xfffa68) +#define M332_SIM_CS8 ((SIM_CS *) 0xfffa6c) +#define M332_SIM_CS9 ((SIM_CS *) 0xfffa70) +#define M332_SIM_CS10 ((SIM_CS *) 0xfffa74) +#define M332_RAM_RAMMCR ((UINT16 *) 0xfffb00) +#define M332_RAM_RAMTST ((UINT16 *) 0xfffb02) +#define M332_RAM_RAMBAR ((UINT16 *) 0xfffb04) +#define M332_QSM_QMCR ((UINT16 *) 0xfffc00) +#define M332_QSM_QTEST ((UINT16 *) 0xfffc02) +#define M332_QSM_QILR ((UINT8 *) 0xfffc04) +#define M332_QSM_QIVR ((UINT8 *) 0xfffc05) +#define M332_QSM_SCCR0 ((UINT16 *) 0xfffc08) +#define M332_QSM_SCCR1 ((UINT16 *) 0xfffc0a) +#define M332_QSM_SCSR ((UINT16 *) 0xfffc0c) +#define M332_QSM_SCDR ((UINT16 *) 0xfffc0e) +#define M332_QSM_QPDR ((UINT8 *) 0xfffc15) +#define M332_QSM_QPAR ((UINT8 *) 0xfffc16) +#define M332_QSM_QDDR ((UINT8 *) 0xfffc17) +#define M332_QSM_SPCR0 ((UINT16 *) 0xfffc18) +#define M332_QSM_SPCR1 ((UINT16 *) 0xfffc1a) +#define M332_QSM_SPCR2 ((UINT16 *) 0xfffc1c) +#define M332_QSM_SPCR3 ((UINT8 *) 0xfffc1e) +#define M332_QSM_SPSR ((UINT8 *) 0xfffc1f) +#define M332_QSM_RX_BASE ((UINT16 *) 0xfffd00) +#define M332_QSM_TX_BASE ((UINT16 *) 0xfffd20) +#define M332_QSM_CMD_BASE ((UINT8 *) 0xfffd40) +#define M332_TPU_TMCR ((UINT16 *) 0xfffe00) +#define M332_TPU_TTCR ((UINT16 *) 0xfffe02) +#define M332_TPU_DSCR ((UINT16 *) 0xfffe04) +#define M332_TPU_DSSR ((UINT16 *) 0xfffe06) +#define M332_TPU_TICR ((UINT16 *) 0xfffe08) +#define M332_TPU_CIER ((UINT16 *) 0xfffe0a) +#define M332_TPU_CFSR0 ((UINT16 *) 0xfffe0c) +#define M332_TPU_CFSR1 ((UINT16 *) 0xfffe0e) +#define M332_TPU_CFSR2 ((UINT16 *) 0xfffe10) +#define M332_TPU_CFSR3 ((UINT16 *) 0xfffe12) +#define M332_TPU_HSQR0 ((UINT16 *) 0xfffe14) +#define M332_TPU_HSQR1 ((UINT16 *) 0xfffe16) +#define M332_TPU_HSRR0 ((UINT16 *) 0xfffe18) +#define M332_TPU_HSRR1 ((UINT16 *) 0xfffe1a) +#define M332_TPU_CPR0 ((UINT16 *) 0xfffe1c) +#define M332_TPU_CPR1 ((UINT16 *) 0xfffe1e) +#define M332_TPU_CISR ((UINT16 *) 0xfffe20) +#define M332_TPU_CHN ((TPU_CHN *) 0xffff00) + + +/* SIM - Register definitions for the System Integration Module */ + +typedef struct /* SIM_CS */ + { + UINT16 csBar; /* chip select base address register */ + UINT16 csOr; /* chip select options register */ + } SIM_CS; + +/* SIM_MCR - Module Configuration Register (Write Once Only) */ + +#define SIM_MCR_MM 0x0040 /* module mapping */ +#define SIM_MCR_SUPV 0x0080 /* supervisor/unrestricted data space */ +#define SIM_MCR_X 0x0000 /* no show cycle, ext. arbitration */ +#define SIM_MCR_SH 0x0100 /* show cycle enabled, no ext. arb. */ +#define SIM_MCR_SH_X 0x0200 /* show cycle enabled, ext. arb. */ +#define SIM_MCR_SH_X_BG 0x0300 /* show cycle/ext arb; int halt w/ BG */ +#define SIM_MCR_SLVEN 0x0800 /* slave mode enable */ +#define SIM_MCR_FRZBM 0x2000 /* freeze bus monitor enable */ +#define SIM_MCR_FRZSW 0x4000 /* freeze software enable */ +#define SIM_MCR_EXOFF 0x8000 /* external clock off */ + +/* SIM_SIMTR - Module Test Register */ + +#define SIM_SIMTR_REV_MASK 0xfc00 /* revision number for this part */ + +/* SIM_SYNCR - Clock Synthesis Control Register */ + +#define SIM_SYNCR_STEXT 0x0001 /* stop mode external clock */ +#define SIM_SYNCR_STSIM 0x0002 /* stop mode system integration clock */ +#define SIM_SYNCR_RSTEN 0x0004 /* reset enable */ +#define SIM_SYNCR_SLOCK 0x0008 /* synthesizer lock */ +#define SIM_SYNCR_SLIMP 0x0010 /* limp mode */ +#define SIM_SYNCR_EDIV 0x0080 /* E clock divide rate */ +#define SIM_SYNCR_Y_MASK 0x3f00 /* Y - frequency control bits */ +#define SIM_SYNCR_X 0x4000 /* X - frequency control bit */ +#define SIM_SYNCR_W 0x8000 /* W - frequency control bit */ + +/* SIM_RSR - Reset Status Register */ + +#define SIM_RSR_TST 0x01 /* test submodule reset */ +#define SIM_RSR_SYS 0x02 /* system reset (CPU reset) */ +#define SIM_RSR_LOC 0x04 /* loss of clock reset */ +#define SIM_RSR_HLT 0x10 /* halt monitor reset */ +#define SIM_RSR_SW 0x20 /* software watchdog reset */ +#define SIM_RSR_POW 0x40 /* power up reset */ +#define SIM_RSR_EXT 0x80 /* external reset */ + +/* SIM_PEPAR - Port E Pin Assignment Register */ + +#define SIM_PEPAR_DSACK0 0x01 /* select bus control pin assignment */ +#define SIM_PEPAR_DSACK1 0x02 /* select bus control pin assignment */ +#define SIM_PEPAR_AVEC 0x04 /* select bus control pin assignment */ +#define SIM_PEPAR_RMC 0x08 /* select bus control pin assignment */ +#define SIM_PEPAR_DS 0x10 /* select bus control pin assignment */ +#define SIM_PEPAR_AS 0x20 /* select bus control pin assignment */ +#define SIM_PEPAR_SIZ0 0x40 /* select bus control pin assignment */ +#define SIM_PEPAR_SIZ1 0x80 /* select bus control pin assignment */ + +/* SIM_PFPAR - Port F Pin Assignment Register */ + +#define SIM_PFPAR_MODCK 0x01 /* select bus control pin assignment */ +#define SIM_PFPAR_IRQ1 0x02 /* select bus control pin assignment */ +#define SIM_PFPAR_IRQ2 0x04 /* select bus control pin assignment */ +#define SIM_PFPAR_IRQ3 0x08 /* select bus control pin assignment */ +#define SIM_PFPAR_IRQ4 0x10 /* select bus control pin assignment */ +#define SIM_PFPAR_IRQ5 0x20 /* select bus control pin assignment */ +#define SIM_PFPAR_IRQ6 0x40 /* select bus control pin assignment */ +#define SIM_PFPAR_IRQ7 0x80 /* select bus control pin assignment */ + +/* SIM_SYPCR - System Protection Control (Write Once Only) */ + +#define SIM_SYPCR_BMT_64 0x00 /* 64 clk cycle bus monitor timeout */ +#define SIM_SYPCR_BMT_32 0x01 /* 32 clk cycle bus monitor timeout */ +#define SIM_SYPCR_BMT_16 0x02 /* 16 clk cycle bus monitor timeout */ +#define SIM_SYPCR_BMT_8 0x03 /* 8 clk cycle bus monitor timeout */ +#define SIM_SYPCR_BME 0x04 /* bus monitor enable */ +#define SIM_SYPCR_HME 0x08 /* halt monitor enable */ +#define SIM_SYPCR_SWT_9 0x00 /* 2^9 extal cycle software timeout */ +#define SIM_SYPCR_SWT_11 0x10 /* 2^11 extal cycle software timeout */ +#define SIM_SYPCR_SWT_13 0x20 /* 2^13 extal cycle software timeout */ +#define SIM_SYPCR_SWT_15 0x30 /* 2^15 extal cycle software timeout */ +#define SIM_SYPCR_SWT_18 0x40 /* 2^18 extal cycle software timeout */ +#define SIM_SYPCR_SWT_20 0x50 /* 2^20 extal cycle software timeout */ +#define SIM_SYPCR_SWT_22 0x60 /* 2^22 extal cycle software timeout */ +#define SIM_SYPCR_SWT_24 0x70 /* 2^24 extal cycle software timeout */ +#define SIM_SYPCR_SWE 0x80 /* software watchdog enable */ + +/* SIM_PICR - Periodic Interrupt Control Register */ + +#define SIM_PICR_PIV_MASK 0x00ff /* periodic interrupt vector */ +#define SIM_PICR_PIRQL_MASK 0x0700 /* periodic interrupt request level */ + +/* SIM_PITR - Periodic Interrupt Timer */ + +#define SIM_PITR_PITR_MASK 0x00ff /* periodic interrupt timing register */ +#define SIM_PITR_PTP 0x0100 /* periodic timer prescale bit */ + +/* SIM_SWSR - Software Service Register */ + +#define SIM_SWSR_ACK1 0x55 /* software watchdog ack. part 1 */ +#define SIM_SWSR_ACK2 0xaa /* software watchdog ack. part 2 */ + +/* SIM_CSPAR0 - Chip Select Pin Assignement Register 0 */ + +#define SIM_CSPAR0_CSBOOT_DIS 0x0000 /* discrete output */ +#define SIM_CSPAR0_CSBOOT_DEF 0x0001 /* default pin function */ +#define SIM_CSPAR0_CSBOOT_8BIT 0x0002 /* chip select with 8 bit port */ +#define SIM_CSPAR0_CSBOOT_16BIT 0x0003 /* chip select with 16 bit port */ +#define SIM_CSPAR0_CS0_DIS 0x0000 /* discrete output */ +#define SIM_CSPAR0_CS0_BR 0x0004 /* default pin function */ +#define SIM_CSPAR0_CS0_8BIT 0x0008 /* chip select with 8 bit port */ +#define SIM_CSPAR0_CS0_16BIT 0x000c /* chip select with 16 bit port */ +#define SIM_CSPAR0_CS1_DIS 0x0000 /* discrete output */ +#define SIM_CSPAR0_CS1_BG 0x0010 /* default pin function */ +#define SIM_CSPAR0_CS1_8BIT 0x0020 /* chip select with 8 bit port */ +#define SIM_CSPAR0_CS1_16BIT 0x0030 /* chip select with 16 bit port */ +#define SIM_CSPAR0_CS2_DIS 0x0000 /* discrete output */ +#define SIM_CSPAR0_CS2_BGACK 0x0040 /* default pin function */ +#define SIM_CSPAR0_CS2_8BIT 0x0080 /* chip select with 8 bit port */ +#define SIM_CSPAR0_CS2_16BIT 0x00c0 /* chip select with 16 bit port */ +#define SIM_CSPAR0_CS3_DIS 0x0000 /* discrete output */ +#define SIM_CSPAR0_CS3_FC0 0x0100 /* default pin function */ +#define SIM_CSPAR0_CS3_8BIT 0x0200 /* chip select with 8 bit port */ +#define SIM_CSPAR0_CS3_16BIT 0x0300 /* chip select with 16 bit port */ +#define SIM_CSPAR0_CS4_DIS 0x0000 /* discrete output */ +#define SIM_CSPAR0_CS4_FC1 0x0400 /* default pin function */ +#define SIM_CSPAR0_CS4_8BIT 0x0800 /* chip select with 8 bit port */ +#define SIM_CSPAR0_CS4_16BIT 0x0c00 /* chip select with 16 bit port */ +#define SIM_CSPAR0_CS5_DIS 0x0000 /* discrete output */ +#define SIM_CSPAR0_CS5_FC2 0x1000 /* default pin function */ +#define SIM_CSPAR0_CS5_8BIT 0x2000 /* chip select with 8 bit port */ +#define SIM_CSPAR0_CS5_16BIT 0x3000 /* chip select with 16 bit port */ + +/* SIM_CSPAR1 - Chip Select Pin Assignement Register 1 */ + +#define SIM_CSPAR1_CS6_DIS 0x0000 /* discrete output */ +#define SIM_CSPAR1_CS6_A19 0x0001 /* default pin function */ +#define SIM_CSPAR1_CS6_8BIT 0x0002 /* chip select with 8 bit port */ +#define SIM_CSPAR1_CS6_16BIT 0x0003 /* chip select with 16 bit port */ +#define SIM_CSPAR1_CS7_DIS 0x0000 /* discrete output */ +#define SIM_CSPAR1_CS7_A20 0x0004 /* default pin function */ +#define SIM_CSPAR1_CS7_8BIT 0x0008 /* chip select with 8 bit port */ +#define SIM_CSPAR1_CS7_16BIT 0x000c /* chip select with 16 bit port */ +#define SIM_CSPAR1_CS8_DIS 0x0000 /* discrete output */ +#define SIM_CSPAR1_CS8_A21 0x0010 /* default pin function */ +#define SIM_CSPAR1_CS8_8BIT 0x0020 /* chip select with 8 bit port */ +#define SIM_CSPAR1_CS8_16BIT 0x0030 /* chip select with 16 bit port */ +#define SIM_CSPAR1_CS9_DIS 0x0000 /* discrete output */ +#define SIM_CSPAR1_CS9_A22 0x0040 /* default pin function */ +#define SIM_CSPAR1_CS9_8BIT 0x0080 /* chip select with 8 bit port */ +#define SIM_CSPAR1_CS9_16BIT 0x00c0 /* chip select with 16 bit port */ +#define SIM_CSPAR1_CS10_E_CLK 0x0000 /* E clock output */ +#define SIM_CSPAR1_CS10_A23 0x0100 /* default pin function */ +#define SIM_CSPAR1_CS10_8BIT 0x0200 /* chip select with 8 bit port */ +#define SIM_CSPAR1_CS10_16BIT 0x0300 /* chip select with 16 bit port */ + +/* SIM_CSBAR - Chip Select Base Address Register */ + +#define SIM_CSBAR_2K 0x0000 /* 2k block size */ +#define SIM_CSBAR_8K 0x0001 /* 8k block size */ +#define SIM_CSBAR_16K 0x0002 /* 16k block size */ +#define SIM_CSBAR_64K 0x0003 /* 64k block size */ +#define SIM_CSBAR_128K 0x0004 /* 128k block size */ +#define SIM_CSBAR_256K 0x0005 /* 256k block size */ +#define SIM_CSBAR_512K 0x0006 /* 512k block size */ +#define SIM_CSBAR_1024K 0x0007 /* 1024k block size */ + +/* SIM_CSOR - Chip Select Option Register */ + +#define SIM_CSOR_AVEC 0x0001 /* autovector */ +#define SIM_CSOR_IPL_ALL 0x0000 /* assert chip select for any level */ +#define SIM_CSOR_IPL_1 0x0002 /* assert chip select for level 1 */ +#define SIM_CSOR_IPL_2 0x0004 /* assert chip select for level 2 */ +#define SIM_CSOR_IPL_3 0x0006 /* assert chip select for level 3 */ +#define SIM_CSOR_IPL_4 0x0008 /* assert chip select for level 4 */ +#define SIM_CSOR_IPL_5 0x000a /* assert chip select for level 5 */ +#define SIM_CSOR_IPL_6 0x000c /* assert chip select for level 6 */ +#define SIM_CSOR_IPL_7 0x000e /* assert chip select for level 7 */ +#define SIM_CSOR_SP_CPU 0x0000 /* CPU space */ +#define SIM_CSOR_SP_USER 0x0010 /* user space */ +#define SIM_CSOR_SP_SUPV 0x0020 /* supervisor space */ +#define SIM_CSOR_SP_SU 0x0030 /* either supervisor or user space */ +#define SIM_CSOR_WAIT0 0x0000 /* dsack with 0 wait states */ +#define SIM_CSOR_WAIT1 0x0040 /* dsack with 1 wait states */ +#define SIM_CSOR_WAIT2 0x0080 /* dsack with 2 wait states */ +#define SIM_CSOR_WAIT3 0x00c0 /* dsack with 3 wait states */ +#define SIM_CSOR_WAIT4 0x0100 /* dsack with 4 wait states */ +#define SIM_CSOR_WAIT5 0x0140 /* dsack with 5 wait states */ +#define SIM_CSOR_WAIT6 0x0180 /* dsack with 6 wait states */ +#define SIM_CSOR_WAIT7 0x01c0 /* dsack with 7 wait states */ +#define SIM_CSOR_WAIT8 0x0200 /* dsack with 8 wait states */ +#define SIM_CSOR_WAIT9 0x0240 /* dsack with 9 wait states */ +#define SIM_CSOR_WAIT10 0x0280 /* dsack with 10 wait states */ +#define SIM_CSOR_WAIT11 0x02c0 /* dsack with 11 wait states */ +#define SIM_CSOR_WAIT12 0x0300 /* dsack with 12 wait states */ +#define SIM_CSOR_WAIT13 0x0340 /* dsack with 13 wait states */ +#define SIM_CSOR_WAIT_FAST 0x0380 /* fast termination */ +#define SIM_CSOR_WAIT_EXT 0x03c0 /* external dsack generation */ +#define SIM_CSOR_AS 0x0000 /* strobe with AS* */ +#define SIM_CSOR_DS 0x0400 /* strobe with DS* */ +#define SIM_CSOR_READ 0x0800 /* read only */ +#define SIM_CSOR_WRITE 0x1000 /* write only */ +#define SIM_CSOR_RW 0x1800 /* read/write */ +#define SIM_CSOR_BYTE_OFF 0x0000 /* off */ +#define SIM_CSOR_BYTE_LOWER 0x2000 /* lower byte access */ +#define SIM_CSOR_BYTE_UPPER 0x4000 /* upper byte access */ +#define SIM_CSOR_BYTE_BOTH 0x6000 /* either upper or lower access */ +#define SIM_CSOR_ASYNC 0x0000 /* asynchronous */ +#define SIM_CSOR_SYNC 0x8000 /* synchronous */ + + +/* RAM - Register definitions for the RAM Control Registers */ + +/* RAM_RAMMCR - RAM Module Configuration Register */ + +#define RAM_RAMMCR_SUPV 0x0100 /* supv. access to on chip RAM only */ +#define RAM_RAMMCR_STOP 0x8000 /* low power stop mode */ + +/* RAM_RAMTST - RAM Test Register */ + +#define RAM_RAMTST_RTBA 0x0100 /* RAMBAR may be written as desired */ + +/* RAM_RAMBAR - RAM Base Address Register */ + +#define RAM_RAMBAR_DISABLE 0x0001 /* RAM array is disabled */ +#define RAM_RAMBAR_ENABLE 0x0000 /* RAM array is enabled */ + + +/* QSM - Register definitions for the Queued Serial Module (QSM) */ + +/* QSM_MCR - Module Configuration Register */ + +#define QSM_MCR_SUPV 0x0080 /* supervisor/unrestricted access */ +#define QSM_MCR_FRZ0 0x2000 /* reserved */ +#define QSM_MCR_FRZ1 0x4000 /* halt QSM on transfer bndry */ +#define QSM_MCR_STOP 0x8000 /* stop enable */ + +/* QSM_QILR - QSM Interrupt Level Register */ + +#define QSM_QILR_SCI_MASK 0x07 /* SCI interrupt level (0 = disabled) */ +#define QSM_QILR_SPI_MASK 0x38 /* SCI interrupt level (0 = disabled) */ + +/* QSM_SCCR1 - Control Register 1 */ + +#define QSM_SCCR1_SBK 0x0001 /* send break */ +#define QSM_SCCR1_RWU 0x0002 /* receiver wakeup enable */ +#define QSM_SCCR1_RE 0x0004 /* receiver enable */ +#define QSM_SCCR1_TE 0x0008 /* transmitter enable */ +#define QSM_SCCR1_ILIE 0x0010 /* idle-line interrupt enable */ +#define QSM_SCCR1_RIE 0x0020 /* receiver interrupt enable */ +#define QSM_SCCR1_TCIE 0x0040 /* transmit complete interrupt enable */ +#define QSM_SCCR1_TIE 0x0080 /* transmit interrupt enable */ +#define QSM_SCCR1_WAKE 0x0100 /* wakeup by address mark */ +#define QSM_SCCR1_M 0x0200 /* mode select: 0= 8 data bits, 1 = 9 */ +#define QSM_SCCR1_PE 0x0400 /* parity enable */ +#define QSM_SCCR1_PT 0x0800 /* parity type: 1=Odd, 0=Even */ +#define QSM_SCCR1_ILT 0x1000 /* idle line detect type */ +#define QSM_SCCR1_WOMS 0x2000 /* wired or mode for SCI Pins */ +#define QSM_SCCR1_LOOPS 0x4000 /* test SCI operation */ + +/* QSM_SCSR - Status Register */ + +#define QSM_SCSR_PF 0x0001 /* parity error flag */ +#define QSM_SCSR_FE 0x0002 /* framing error flag */ +#define QSM_SCSR_NF 0x0004 /* noise error flag */ +#define QSM_SCSR_OR 0x0008 /* overrun error flag */ +#define QSM_SCSR_IDLE 0x0010 /* idle-line detected flag */ +#define QSM_SCSR_RAF 0x0020 /* receiver active flag */ +#define QSM_SCSR_RDRF 0x0040 /* receive data register full flag */ +#define QSM_SCSR_TC 0x0080 /* transmit complete */ +#define QSM_SCSR_TDRE 0x0100 /* transmit date register empty flag */ + +/* QSM_QPDR/QSM_QDDR - Port Data and Data Direction Register */ + +#define QSM_QPDR_MISO 0x01 /* MISO pin */ +#define QSM_QPDR_MOSI 0x02 /* MOSI pin */ +#define QSM_QPDR_SCK 0x04 /* SCK pin */ +#define QSM_QPDR_PCS0 0x08 /* PCS0 pin */ +#define QSM_QPDR_PCS1 0x10 /* PCS1 pin */ +#define QSM_QPDR_PCS2 0x20 /* PCS2 pin */ +#define QSM_QPDR_PCS3 0x40 /* PCS3 pin */ +#define QSM_QPDR_TXD 0x80 /* TXD pin */ + +/* QSM_QPAR - Pin Assignment Register */ + +#define QSM_QPAR_MISO 0x0001 /* MISO pin */ +#define QSM_QPAR_MOSI 0x0002 /* MOSI pin */ +#define QSM_QPAR_PCS0 0x0008 /* PCS0 pin */ +#define QSM_QPAR_PCS1 0x0010 /* PCS1 pin */ +#define QSM_QPAR_PCS2 0x0020 /* PCS2 pin */ +#define QSM_QPAR_PCS3 0x0040 /* PCS3 pin */ + +/* QSM_SPCR0 - Serial Peripheral Control Register 0 */ + +#define QSM_SPCR0_CPHA_CAP 0x0000 /* capture data on leading edge */ +#define QSM_SPCR0_CPHA_CHG 0x0100 /* change data on leading edge */ +#define QSM_SPCR0_CPOL_LOW 0x0000 /* clock polarity; SCK inactive low */ +#define QSM_SPCR0_CPOL_HIGH 0x0200 /* clock polarity; SCK inactive high */ +#define QSM_SPCR0_WOMQ 0x4000 /* wired or mode */ +#define QSM_SPCR0_MASTER 0x8000 /* device as QSM master */ +#define QSM_SPCR0_SLAVE 0x0000 /* device as QSM slave */ + +/* QSM_SPCR1 - Serial Peripheral Control Register 1 */ + +#define QSM_SPCR1_SPE 0x8000 /* QSPI is enabled */ + +/* QSM_SPCR2 - Serial Peripheral Control Register 2 */ + +#define QSM_SPCR2_WRTO 0x2000 /* wrap to NEWQP (0 otherwise) */ +#define QSM_SPCR2_WREN 0x4000 /* wrap enabled */ +#define QSM_SPCR2_SPIFIE 0x8000 /* finished interrupt enabled */ + +/* QSM_SPCR3 - Serial Peripheral Control Register 3 */ + +#define QSM_SPCR3_HALT 0x01 /* halt after current transfer */ +#define QSM_SPCR3_HMIE 0x02 /* HALTA or MODF interrupt enable */ +#define QSM_SPCR3_LOOPQ 0x04 /* loop back mode */ + +/* QSM_SPSR - Serial Peripheral Status Register */ + +#define QSM_SPSR_HALTA 0x20 /* QSPI halted */ +#define QSM_SPSR_MODF 0x40 /* mode fault (multiple masters) */ +#define QSM_SPSR_SPIF 0x80 /* QSPI executed last command */ + +/* QSM_SPCCB - Serial Peripheral Command Control Byte */ + +#define QSM_SPCCB_DSCK 0x10 /* SPCR1 contains PCS setup time */ +#define QSM_SPCCB_DT 0x20 /* SPCR1 contains inter-trans delay */ +#define QSM_SPCCB_BITSE 0x40 /* SPCR0 contains number of bits */ +#define QSM_SPCCB_CONT 0x80 /* continue to assert PCS after trans */ + + +/* TPU - Time Processing Unit */ + +/* Channel control options */ + +#define CHN_PSC_PAC 0x0000 /* force pin to PAC latches */ +#define CHN_PSC_HIGH 0x0001 /* force pin high */ +#define CHN_PSC_LOW 0x0002 /* force pin low */ +#define CHN_PSC_NC 0x0003 /* do not force any state */ +#define CHN_PAC_NCM 0x0000 /* no change on match */ +#define CHN_PAC_NO_DETECT 0x0000 /* do not detect transition */ +#define CHN_PAC_HIGH 0x0004 /* high on match */ +#define CHN_PAC_RISING 0x0004 /* detect rising edge */ +#define CHN_PAC_LOW 0x0008 /* low on match */ +#define CHN_PAC_FALLING 0x0008 /* detect falling edge */ +#define CHN_PAC_TOGGLE 0x000c /* toggle on match */ +#define CHN_PAC_EITHER 0x000c /* detect either edge transition */ +#define CHN_PAC_NC 0x0010 /* don not change PAC */ +#define CHN_TBS_INP_C1_M1 0x0000 /* input - capture TCR1, match TCR1 */ +#define CHN_TBS_INP_C1_M2 0x0020 /* input - capture TCR1, match TCR2 */ +#define CHN_TBS_INP_C2_M1 0x0040 /* input - capture TCR2, match TCR1 */ +#define CHN_TBS_INP_C2_M2 0x0060 /* input - capture TCR2, match TCR2 */ +#define CHN_TBS_OUT_C1_M1 0x0080 /* output - capture TCR1, match TCR1 */ +#define CHN_TBS_OUT_C1_M2 0x00a0 /* output - capture TCR1, match TCR2 */ +#define CHN_TBS_OUT_C2_M1 0x00c0 /* output - capture TCR2, match TCR1 */ +#define CHN_TBS_OUT_C2_M2 0x00e0 /* output - capture TCR2, match TCR2 */ +#define CHN_TBS_NC 0x0100 /* do not change TBS */ + +typedef struct /* TPU_DIO */ + { + UINT16 chnCont; + UINT16 pinLvl; + UINT16 matchRate; + } TPU_DIO; + +/* DIO_HSQR - Host Sequence Register */ + +#define DIO_HSQR_TRANS 0x0 /* record pin on transition */ +#define DIO_HSQR_MATCH 0x1 /* record pin at matchRate */ +#define DIO_HSQR_RECORD 0x2 /* record pin on HSRR = 0x3 */ + +/* DIO_HSRR - Host Service Register */ + +#define DIO_HSRR_NONE 0x0 /* none */ +#define DIO_HSRR_HIGH 0x1 /* force output high */ +#define DIO_HSRR_LOW 0x2 /* force output low */ +#define DIO_HSRR_INIT 0x3 /* initialization */ + +typedef struct /* TPU_ITC */ + { + UINT16 chnCont; + UINT16 linkBankAdrs; + UINT16 maxCount; + UINT16 transCount; + UINT16 finalTransTime; + UINT16 lastTransTime; + } TPU_ITC; + +/* ITC_HSQR - Host Sequence Register */ + +#define ITC_HSQR_SNGL 0x0 /* no link, single mode */ +#define ITC_HSQR_CONT 0x1 /* no link, continuous mode */ +#define ITC_HSQR_LINK_SNGL 0x2 /* link, single mode */ +#define ITC_HSQR_LINK_CONT 0x3 /* link, continuous mode */ + +/* ITC_HSRR - Host Service Register */ + +#define ITC_HSRR_NONE 0x0 /* none */ +#define ITC_HSRR_INIT 0x1 /* initialization */ + +typedef struct /* TPU_OC */ + { + UINT16 chnCont; + UINT16 offset; + UINT16 ratioRefAddr1; + UINT16 refAddr2Addr3; + UINT16 refTime; + UINT16 matchTime; + } TPU_OC; + +/* OC_HSQR - Host Sequence Register */ + +#define OC_HSQR_ALL 0x0 /* all pulse mode code executed */ +#define OC_HSQR_RESTRICT 0x2 /* pulse mode code 0xec,0xee executed */ + +/* OC_HSRR - Host Service Register */ + +#define OC_HSRR_NONE 0x0 /* none */ +#define OC_HSRR_HIPM 0x1 /* host initiated pulse mode */ +#define OC_HSRR_INIT 0x3 /* initialization */ + +typedef struct /* TPU_PWM */ + { + UINT16 chnCont; + UINT16 oldris; + UINT16 pwmhi; + UINT16 pwmper; + UINT16 pwmris; + } TPU_PWM; + +/* PWM_HSRR - Host Service Register */ + +#define PWM_HSRR_NONE 0x0 /* none */ +#define PWM_HSRR_UPDATE 0x1 /* immediate update request */ +#define PWM_HSRR_INIT 0x2 /* initialization */ + +typedef struct /* TPU_SPWM_M0 */ + { + UINT16 chnCont; + UINT16 nextRise; + UINT16 highTime; + UINT16 period; + UINT16 refAddr1; + UINT16 delay; + } TPU_SPWM_M0; + +typedef struct /* TPU_SPWM_M1 */ + { + UINT16 chnCont; + UINT16 nextRise; + UINT16 highTime; + UINT16 delay; + UINT16 refAddr1Addr2; + UINT16 refValue; + } TPU_SPWM_M1; + +typedef struct /* TPU_SPWM_M2 */ + { + UINT16 chnCont; + UINT16 nextRise; + UINT16 highTime; + UINT16 period; + UINT16 linkRefAddr1; + UINT16 delay; + } TPU_SPWM_M2; + +/* SPWM_HSQR - Host Sequence Register */ + +#define SPWM_HSQR_MODE0 0x0 /* mode 0 */ +#define SPWM_HSQR_MODE1 0x1 /* mode 1 */ +#define SPWM_HSQR_MODE2 0x2 /* mode 2 */ + +/* SPWM_HSRR - Host Service Register */ + +#define SPWM_HSRR_NONE 0x0 /* none */ +#define SPWM_HSRR_INIT 0x2 /* initialization */ +#define SPWM_HSRR_UPDATE 0x3 /* immediate update request */ + +typedef struct /* TPU_PMA */ + { + UINT16 chnCont; + UINT16 maxAddNumTeeth; + UINT16 addRollCnt; + UINT16 ratioTcrMax; + UINT16 periodHigh; + UINT16 periodLow; + } TPU_PMA; + +/* PMA_HSQR - Host Sequence Register */ + +#define PMA_HSQR_BANK 0x0 /* bank mode */ +#define PMA_HSQR_COUNT 0x1 /* count mode */ + +/* PMA_HSRR - Host Service Register */ + +#define PMA_HSRR_NONE 0x0 /* none */ +#define PMA_HSRR_INIT 0x1 /* initialization */ + +typedef struct /* TPU_PMM */ + { + UINT16 chnCont; + UINT16 maxMissNumTeeth; + UINT16 missRollCnt; + UINT16 ratioTcrMax; + UINT16 periodHigh; + UINT16 periodLow; + } TPU_PMM; + +/* PMM_HSQR - Host Sequence Register */ + +#define PMM_HSQR_BANK 0x2 /* bank mode */ +#define PMM_HSQR_COUNT 0x3 /* count mode */ + +/* PMM_HSRR - Host Service Register */ + +#define PMM_HSRR_NONE 0x0 /* none */ +#define PMM_HSRR_INIT 0x1 /* initialization */ + +typedef struct /* TPU_PSP */ + { + UINT16 chnCont; + UINT16 r2A2Tmp; + UINT16 angleTime; + UINT16 ratioTmp; + UINT16 ratioAngle1; + UINT16 ratioAngle2; + } TPU_PSP; + +/* PSP_HSQR - Host Sequence Register */ + +#define PSP_HSQR_ANGLE 0x0 /* angle-angle mode */ +#define PSP_HSQR_TIME 0x1 /* angle-time mode */ + +/* PSP_HSRR - Host Service Register */ + +#define PSP_HSRR_NONE 0x0 /* none */ +#define PSP_HSRR_UPDATE 0x1 /* immediate update request */ +#define PSP_HSRR_INIT 0x2 /* initialization */ +#define PSP_HSRR_FORCE 0x3 /* force mode */ + +typedef struct /* TPU_SM_PRI */ + { + UINT16 chnCont; + UINT16 pinCont; + UINT16 currentPos; + UINT16 desiredPos; + UINT16 modCntNextStep; + UINT16 stepCntLastChn; + } TPU_SM_PRI; + +typedef struct /* TPU_SM_SEC */ + { + UINT16 chnCont; + UINT16 pinCont; + UINT16 stepCntl0; + UINT16 stepCntl1; + } TPU_SM_SEC; + +/* SM_HSRR - Host Service Register */ + +#define SM_HSRR_NONE 0x0 /* none */ +#define SM_HSRR_INIT 0x2 /* initialization */ +#define SM_HSRR_STEP 0x3 /* step request */ + +typedef struct /* TPU_PPWA */ + { + UINT16 chnCont; + UINT16 maxPeriodCnt; + UINT16 lastAccum; + UINT16 accum; + UINT16 accumRatePpwaUb; + UINT16 ppwaLw; + } TPU_PPWA; + +/* PPWA_HSQR - Host Sequence Register */ + +#define PPWA_HSQR_ACC_24 0x0 /* accumulate 24 bit periods */ +#define PPWA_HSQR_ACC_16 0x1 /* accumulate 16 bit periods */ + +/* PPWA_HSRR - Host Service Register */ + +#define PPWA_HSRR_NONE 0x0 /* none */ +#define PPWA_HSRR_INIT 0x2 /* initialization */ + +typedef struct /* TPU_CHN */ + { + union + { + TPU_DIO dio; /* discrete input/output */ + TPU_ITC itc; /* input transition counter */ + TPU_OC oc; /* output compare */ + TPU_PWM pwm; /* pulse width modulation */ + TPU_SPWM_M0 spwmM0; /* synchronized pulse width modulation*/ + TPU_SPWM_M1 spwmM1; /* synchronized pulse width modulation*/ + TPU_SPWM_M2 spwmM2; /* synchronized pulse width modulation*/ + TPU_PMA pma; /* period measure w/additional trans */ + TPU_PMM pmm; /* period measure w/missing trans */ + TPU_PSP psp; /* position-sync. pulse generator */ + TPU_SM_PRI smPri; /* stepper motor primary channel */ + TPU_SM_SEC smSec; /* stepper motor secondary channel */ + TPU_PPWA ppwa; /* period/pulse width accumulator */ + UINT16 pad[8]; /* each channel has 8 parameters */ + } tf; + } TPU_CHN; + +/* TPU_TMCR - TPU Module Configuration Register */ + +#define TPU_TMCR_PSCK_32X 0x0000 /* clock/32 is TCR1 prescaler input */ +#define TPU_TMCR_PSCK_4X 0x0040 /* clock/4 is TCR1 prescaler input */ +#define TPU_TMCR_SUPV 0x0080 /* supervisor access only */ +#define TPU_TMCR_STF 0x0100 /* TPU is stopped */ +#define TPU_TMCR_T2CG 0x0200 /* TCR2 pin is gate of DIV8 clock */ +#define TPU_TMCR_EMU 0x0400 /* TPU and RAM in emulation mode */ +#define TPU_TMCR_TCR2_1X 0x0000 /* TCR2 divide by 1 prescaler */ +#define TPU_TMCR_TCR2_2X 0x0800 /* TCR2 divide by 2 prescaler */ +#define TPU_TMCR_TCR2_4X 0x1000 /* TCR2 divide by 4 prescaler */ +#define TPU_TMCR_TCR2_8X 0x1800 /* TCR2 divide by 8 prescaler */ +#define TPU_TMCR_TCR1_1X 0x0000 /* TCR1 divide by 1 prescaler */ +#define TPU_TMCR_TCR1_2X 0x2000 /* TCR1 divide by 2 prescaler */ +#define TPU_TMCR_TCR1_4X 0x4000 /* TCR1 divide by 4 prescaler */ +#define TPU_TMCR_TCR1_8X 0x6000 /* TCR1 divide by 8 prescaler */ +#define TPU_TMCR_STOP 0x8000 /* stop the clocks and microengine */ + +/* TPU_CFSR - Channel Function Select Register */ + +#define TPU_CFSR_DIO 0x8 /* discrete input/output */ +#define TPU_CFSR_ITC 0xa /* input transition counter */ +#define TPU_CFSR_OC 0xe /* output compare */ +#define TPU_CFSR_PWM 0x9 /* pulse width modulation */ +#define TPU_CFSR_SPWM 0x7 /* synchronized pulse width modulation*/ +#define TPU_CFSR_PMA 0xb /* period measure w/additional trans */ +#define TPU_CFSR_PMM 0xb /* period measure w/missing trans */ +#define TPU_CFSR_PSP 0xc /* position-sync. pulse generator */ +#define TPU_CFSR_SM 0xd /* stepper motor */ +#define TPU_CFSR_PPWA 0xf /* period/pulse width accumulator */ + +/* TPU_CPR - Channel Priority Register */ + +#define TPU_CPR_DISABLE 0x0 /* channel disabled */ +#define TPU_CPR_LOW 0x1 /* low priority */ +#define TPU_CPR_MEDIUM 0x2 /* medium priority */ +#define TPU_CPR_HIGH 0x3 /* high priority */ + +/* function declarations */ + +#ifndef INCLUDE_TY_CO_DRV_50 +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT void tyCoInt (void); + +#else /* __STDC__ */ + +IMPORT void tyCoInt (); + +#endif /* __STDC__ */ +#endif /* INCLUDE_TY_CO_DRV_50 */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm68332h */ diff --git a/h/drv/multi/m68340.h b/h/drv/multi/m68340.h new file mode 100644 index 0000000..8d19a4b --- /dev/null +++ b/h/drv/multi/m68340.h @@ -0,0 +1,525 @@ +/* m68340.h - Motorola MC68340 CPU control registers */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01e,22sep92,rrr added support for c++ +01d,06aug92,caf added TY_CO_DEV and function declarations for 5.1 upgrade. + for 5.0.x compatibility, define INCLUDE_TY_CO_DRV_50 when + including this header. +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01a,03sep91,jcf based on m68332.h. +*/ + +/* +This file contains I/O address and related constants for the MC68340. +*/ + +#ifndef __INCm68340h +#define __INCm68340h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE +#ifndef INCLUDE_TY_CO_DRV_50 + +#include "tyLib.h" + +typedef struct /* TY_CO_DEV */ + { + TY_DEV tyDev; + char numChannels; /* number of serial channel to support */ + BOOL created; /* true if this device has really been created */ + UINT8 *dr; /* data port */ + UINT8 *csr; /* clock select register */ + UINT8 *cr; /* control reg */ + UINT8 *isr; /* interrupt status/mask */ + UINT8 *acr; /* auxiliary control */ + UINT8 *mr1; /* mode 1 */ + UINT8 *mr2; /* mode 2 */ + UINT8 *sop; + UINT8 *ier; + UINT8 rem; /* bit for receive-enable mask */ + UINT8 tem; /* bit for transmit-enable mask */ + } TY_CO_DEV; + +#endif /* INCLUDE_TY_CO_DRV_50 */ +#endif /* _ASMLANGUAGE */ + +#define M340_ADRS(offset) ((int)M340_BASE_ADRS + offset) + +/* MC68340 parameter register addresses */ + +#define M340_SIM_MCR ((UINT16 *) M340_ADRS(0x000)) +#define M340_SIM_SYNCR ((UINT16 *) M340_ADRS(0x004)) +#define M340_SIM_AVR ((UINT8 *) M340_ADRS(0x006)) +#define M340_SIM_RSR ((UINT8 *) M340_ADRS(0x007)) +#define M340_SIM_PORTA ((UINT8 *) M340_ADRS(0x011)) +#define M340_SIM_DDRA ((UINT8 *) M340_ADRS(0x013)) +#define M340_SIM_PPARA1 ((UINT8 *) M340_ADRS(0x015)) +#define M340_SIM_PPARA2 ((UINT8 *) M340_ADRS(0x017)) +#define M340_SIM_PORTB ((UINT8 *) M340_ADRS(0x019)) +#define M340_SIM_DDRB ((UINT8 *) M340_ADRS(0x01d)) +#define M340_SIM_PPARB ((UINT8 *) M340_ADRS(0x01f)) +#define M340_SIM_SWIV ((UINT8 *) M340_ADRS(0x020)) +#define M340_SIM_SYPCR ((UINT8 *) M340_ADRS(0x021)) +#define M340_SIM_PICR ((UINT16 *) M340_ADRS(0x022)) +#define M340_SIM_PITR ((UINT16 *) M340_ADRS(0x024)) +#define M340_SIM_SWSR ((UINT8 *) M340_ADRS(0x027)) +#define M340_SIM_CSAM0 ((UINT32 *) M340_ADRS(0x040)) +#define M340_SIM_CSBAR0 ((UINT32 *) M340_ADRS(0x044)) +#define M340_SIM_CSAM1 ((UINT32 *) M340_ADRS(0x048)) +#define M340_SIM_CSBAR1 ((UINT32 *) M340_ADRS(0x04c)) +#define M340_SIM_CSAM2 ((UINT32 *) M340_ADRS(0x050)) +#define M340_SIM_CSBAR2 ((UINT32 *) M340_ADRS(0x054)) +#define M340_SIM_CSAM3 ((UINT32 *) M340_ADRS(0x058)) +#define M340_SIM_CSBAR3 ((UINT32 *) M340_ADRS(0x05c)) +#define M340_TMR1_MCR ((UINT16 *) M340_ADRS(0x600)) +#define M340_TMR1_IR ((UINT16 *) M340_ADRS(0x604)) +#define M340_TMR1_CR ((UINT16 *) M340_ADRS(0x606)) +#define M340_TMR1_SR ((UINT16 *) M340_ADRS(0x608)) +#define M340_TMR1_CNTR ((UINT16 *) M340_ADRS(0x60a)) +#define M340_TMR1_PREL1 ((UINT16 *) M340_ADRS(0x60c)) +#define M340_TMR1_PREL2 ((UINT16 *) M340_ADRS(0x60e)) +#define M340_TMR1_COM ((UINT16 *) M340_ADRS(0x610)) +#define M340_TMR2_MCR ((UINT16 *) M340_ADRS(0x640)) +#define M340_TMR2_IR ((UINT16 *) M340_ADRS(0x644)) +#define M340_TMR2_CR ((UINT16 *) M340_ADRS(0x646)) +#define M340_TMR2_SR ((UINT16 *) M340_ADRS(0x648)) +#define M340_TMR2_CNTR ((UINT16 *) M340_ADRS(0x64a)) +#define M340_TMR2_PREL1 ((UINT16 *) M340_ADRS(0x64c)) +#define M340_TMR2_PREL2 ((UINT16 *) M340_ADRS(0x64e)) +#define M340_TMR2_COM ((UINT16 *) M340_ADRS(0x650)) +#define M340_DUART_MCR_MSB ((UINT8 *) M340_ADRS(0x700)) +#define M340_DUART_MCR_LSB ((UINT8 *) M340_ADRS(0x701)) +#define M340_DUART_ILR ((UINT8 *) M340_ADRS(0x704)) +#define M340_DUART_IVR ((UINT8 *) M340_ADRS(0x705)) +#define M340_DUART_MR1A ((UINT8 *) M340_ADRS(0x710)) +#define M340_DUART_SRA ((UINT8 *) M340_ADRS(0x711)) +#define M340_DUART_CSRA ((UINT8 *) M340_ADRS(0x711)) +#define M340_DUART_CRA ((UINT8 *) M340_ADRS(0x712)) +#define M340_DUART_RBA ((UINT8 *) M340_ADRS(0x713)) +#define M340_DUART_TBA ((UINT8 *) M340_ADRS(0x713)) +#define M340_DUART_IPCR ((UINT8 *) M340_ADRS(0x714)) +#define M340_DUART_ACR ((UINT8 *) M340_ADRS(0x714)) +#define M340_DUART_ISR ((UINT8 *) M340_ADRS(0x715)) +#define M340_DUART_IER ((UINT8 *) M340_ADRS(0x715)) +#define M340_DUART_MR1B ((UINT8 *) M340_ADRS(0x718)) +#define M340_DUART_SRB ((UINT8 *) M340_ADRS(0x719)) +#define M340_DUART_CSRB ((UINT8 *) M340_ADRS(0x719)) +#define M340_DUART_CRB ((UINT8 *) M340_ADRS(0x71a)) +#define M340_DUART_RBB ((UINT8 *) M340_ADRS(0x71b)) +#define M340_DUART_TBB ((UINT8 *) M340_ADRS(0x71b)) +#define M340_DUART_IP ((UINT8 *) M340_ADRS(0x71d)) +#define M340_DUART_OPCR ((UINT8 *) M340_ADRS(0x71d)) +#define M340_DUART_SOP ((UINT8 *) M340_ADRS(0x71e)) +#define M340_DUART_ROP ((UINT8 *) M340_ADRS(0x71f)) +#define M340_DUART_MR2A ((UINT8 *) M340_ADRS(0x720)) +#define M340_DUART_MR2B ((UINT8 *) M340_ADRS(0x721)) +#define M340_DMA1_MCR ((UINT16 *) M340_ADRS(0x780)) +#define M340_DMA1_IR ((UINT16 *) M340_ADRS(0x784)) +#define M340_DMA1_CCR ((UINT16 *) M340_ADRS(0x788)) +#define M340_DMA1_CSR ((UINT8 *) M340_ADRS(0x78a)) +#define M340_DMA1_FCR ((UINT8 *) M340_ADRS(0x78b)) +#define M340_DMA1_SAR ((UINT32 *) M340_ADRS(0x78c)) +#define M340_DMA1_DAR ((UINT32 *) M340_ADRS(0x790)) +#define M340_DMA1_BTC ((UINT32 *) M340_ADRS(0x794)) +#define M340_DMA2_MCR ((UINT16 *) M340_ADRS(0x7a0)) +#define M340_DMA2_IR ((UINT16 *) M340_ADRS(0x7a4)) +#define M340_DMA2_CCR ((UINT16 *) M340_ADRS(0x7a8)) +#define M340_DMA2_CSR ((UINT8 *) M340_ADRS(0x7aa)) +#define M340_DMA2_FCR ((UINT8 *) M340_ADRS(0x7ab)) +#define M340_DMA2_SAR ((UINT32 *) M340_ADRS(0x7ac)) +#define M340_DMA2_DAR ((UINT32 *) M340_ADRS(0x7b0)) +#define M340_DMA2_BTC ((UINT32 *) M340_ADRS(0x7b4)) + + +/* SIM - Register definitions for the System Integration Module */ + +/* SIM_MCR - Module Configuration Register */ + +#define SIM_MCR_SUPV 0x0080 /* supervisor/unrestricted data space */ +#define SIM_MCR_X 0x0000 /* no show cycle, ext. arbitration */ +#define SIM_MCR_SH 0x0100 /* show cycle enabled, no ext. arb. */ +#define SIM_MCR_SH_X 0x0200 /* show cycle enabled, ext. arb. */ +#define SIM_MCR_SH_X_BG 0x0300 /* show cycle/ext arb; int halt w/ BG */ +#define SIM_MCR_FIRQ 0x1000 /* full interrupt request mode */ +#define SIM_MCR_FRZ0 0x2000 /* freeze periodic interrupt timer */ +#define SIM_MCR_FRZ1 0x4000 /* freeze software enable */ + +/* SIM_SYNCR - Clock Synthesis Control Register */ + +#define SIM_SYNCR_STEXT 0x0001 /* stop mode external clock */ +#define SIM_SYNCR_STSIM 0x0002 /* stop mode system integration clock */ +#define SIM_SYNCR_RSTEN 0x0004 /* reset enable */ +#define SIM_SYNCR_SLOCK 0x0008 /* synthesizer lock */ +#define SIM_SYNCR_SLIMP 0x0010 /* limp mode */ +#define SIM_SYNCR_Y_MASK 0x3f00 /* Y - frequency control bits */ +#define SIM_SYNCR_X 0x4000 /* X - frequency control bit */ +#define SIM_SYNCR_W 0x8000 /* W - frequency control bit */ + +/* SIM_AVR - Auto Vector Register */ + +#define SIM_AVR_LVL1 0x02 /* auto vector on IRQ1 */ +#define SIM_AVR_LVL2 0x04 /* auto vector on IRQ2 */ +#define SIM_AVR_LVL3 0x08 /* auto vector on IRQ3 */ +#define SIM_AVR_LVL4 0x10 /* auto vector on IRQ4 */ +#define SIM_AVR_LVL5 0x20 /* auto vector on IRQ5 */ +#define SIM_AVR_LVL6 0x40 /* auto vector on IRQ6 */ +#define SIM_AVR_LVL7 0x80 /* auto vector on IRQ7 */ + +/* SIM_RSR - Reset Status Register */ + +#define SIM_RSR_SYS 0x02 /* system reset (CPU reset) */ +#define SIM_RSR_LOC 0x04 /* loss of clock reset */ +#define SIM_RSR_HLT 0x10 /* halt monitor reset */ +#define SIM_RSR_SW 0x20 /* software watchdog reset */ +#define SIM_RSR_POW 0x40 /* power up reset */ +#define SIM_RSR_EXT 0x80 /* external reset */ + +/* M340_SIM_PPARA1 - Port A Pin Assignment Register 1 */ + +#define SIM_PPARA1_PRTA0 0x01 /* port function */ +#define SIM_PPARA1_PRTA1 0x02 /* port function */ +#define SIM_PPARA1_PRTA2 0x04 /* port function */ +#define SIM_PPARA1_PRTA3 0x08 /* port function */ +#define SIM_PPARA1_PRTA4 0x10 /* port function */ +#define SIM_PPARA1_PRTA5 0x20 /* port function */ +#define SIM_PPARA1_PRTA6 0x40 /* port function */ +#define SIM_PPARA1_PRTA7 0x80 /* port function */ + +/* M340_SIM_PPARA2 - Port A Pin Assignment Register 2 */ + +#define SIM_PPARA2_IACK1 0x02 /* iack function */ +#define SIM_PPARA2_IACK2 0x04 /* iack function */ +#define SIM_PPARA2_IACK3 0x08 /* iack function */ +#define SIM_PPARA2_IACK4 0x10 /* iack function */ +#define SIM_PPARA2_IACK5 0x20 /* iack function */ +#define SIM_PPARA2_IACK6 0x40 /* iack function */ +#define SIM_PPARA2_IACK7 0x80 /* iack function */ + +/* M340_SIM_PPARB - Port B Pin Assignment Register */ + +#define SIM_PPARB_MODCK 0x01 /* modck function */ +#define SIM_PPARB_IRQ1 0x02 /* irq function (SIM_MCR:FIRQ=1) */ +#define SIM_PPARB_IRQ2 0x04 /* irq function (SIM_MCR:FIRQ=1) */ +#define SIM_PPARB_IRQ3 0x08 /* irq function */ +#define SIM_PPARB_IRQ4 0x10 /* irq function (SIM_MCR:FIRQ=1) */ +#define SIM_PPARB_IRQ5 0x20 /* irq function */ +#define SIM_PPARB_IRQ6 0x40 /* irq function */ +#define SIM_PPARB_IRQ7 0x80 /* irq function */ + +/* SIM_SYPCR - System Protection Control (Write Once Only) */ + +#define SIM_SYPCR_BMT_64 0x00 /* 64 clk cycle bus monitor timeout */ +#define SIM_SYPCR_BMT_32 0x01 /* 32 clk cycle bus monitor timeout */ +#define SIM_SYPCR_BMT_16 0x02 /* 16 clk cycle bus monitor timeout */ +#define SIM_SYPCR_BMT_8 0x03 /* 8 clk cycle bus monitor timeout */ +#define SIM_SYPCR_BME 0x04 /* bus monitor enable */ +#define SIM_SYPCR_HME 0x08 /* halt monitor enable */ +#define SIM_SYPCR_SWT_9 0x00 /* 2^9 xtal cycles (SIM_PITR:SWP=0) */ +#define SIM_SYPCR_SWT_11 0x10 /* 2^11 xtal cycles (SIM_PITR:SWP=0) */ +#define SIM_SYPCR_SWT_13 0x20 /* 2^13 xtal cycles (SIM_PITR:SWP=0) */ +#define SIM_SYPCR_SWT_15 0x30 /* 2^15 xtal cycles (SIM_PITR:SWP=0) */ +#define SIM_SYPCR_SWT_18 0x00 /* 2^18 xtal cycles (SIM_PITR:SWP=1) */ +#define SIM_SYPCR_SWT_20 0x10 /* 2^20 xtal cycles (SIM_PITR:SWP=1) */ +#define SIM_SYPCR_SWT_22 0x20 /* 2^22 xtal cycles (SIM_PITR:SWP=1) */ +#define SIM_SYPCR_SWT_24 0x30 /* 2^24 xtal cycles (SIM_PITR:SWP=1) */ +#define SIM_SYPCR_SWRI 0x40 /* software watchdog resets CPU */ +#define SIM_SYPCR_SWE 0x80 /* software watchdog enable */ + +/* SIM_PICR - Periodic Interrupt Control Register */ + +#define SIM_PICR_PIV_MASK 0x00ff /* periodic interrupt vector */ +#define SIM_PICR_PIRQL_MASK 0x0700 /* periodic interrupt request level */ + +/* SIM_PITR - Periodic Interrupt Timer */ + +#define SIM_PITR_PITR_MASK 0x00ff /* periodic interrupt timing register */ +#define SIM_PITR_PTP 0x0100 /* periodic timer prescale bit */ +#define SIM_PITR_SWP 0x0200 /* software watchdog prescale bit */ + +/* SIM_SWSR - Software Service Register */ + +#define SIM_SWSR_ACK1 0x55 /* software watchdog ack. part 1 */ +#define SIM_SWSR_ACK2 0xaa /* software watchdog ack. part 2 */ + +/* SIM_CSAM - Chip Select Address Mask Register */ + +#define SIM_CSAM_WORD 0x00000001 /* 16b port dsack generation */ +#define SIM_CSAM_BYTE 0x00000002 /* 8b port dsack generation */ +#define SIM_CSAM_WAIT_EXT 0x00000003 /* external dsack generation */ +#define SIM_CSAM_WAIT0 0x00000000 /* dsack with 0 wait states */ +#define SIM_CSAM_WAIT1 0x00000004 /* dsack with 1 wait states */ +#define SIM_CSAM_WAIT2 0x00000008 /* dsack with 2 wait states */ +#define SIM_CSAM_WAIT3 0x0000000c /* dsack with 3 wait states */ +#define SIM_CSAM_FC_MASK 0x000000f0 /* function code to match */ +#define SIM_CSAM_ADRS_MASK 0xffffff00 /* address to match */ + +/* SIM_CSBAR - Chip Select Base Address Register */ + +#define SIM_CSBAR_VALID 0x00000001 /* register is valid */ +#define SIM_CSBAR_FTE 0x00000004 /* fast termination enabled */ +#define SIM_CSBAR_WP 0x00000008 /* write protect */ +#define SIM_CSBAR_FC 0x000000f0 /* function code to match */ +#define SIM_CSBAR_ADRS 0xffffff00 /* address to match */ + + +/* DUART - Register definitions for the DUART serial module */ + +/* M340_DUART_MCR - Module Configuration Register */ + +#define DUART_MCR_SUPV 0x0080 /* supervisor reg access only */ +#define DUART_MCR_ICCS 0x1000 /* SCLK is input capture clk */ +#define DUART_MCR_FREEZE 0x4000 /* execution freeze */ +#define DUART_MCR_STOP 0x8000 /* stops the serial clocks */ + +/* M340_DUART_MR1 - Mode Register 1 (a,b) */ + +#define DUART_MR1_5BITS 0x00 /* 5 bits */ +#define DUART_MR1_6BITS 0x01 /* 6 bits */ +#define DUART_MR1_7BITS 0x02 /* 7 bits */ +#define DUART_MR1_8BITS 0x03 /* 8 bits */ +#define DUART_MR1_PAR_EVEN 0x00 /* even parity */ +#define DUART_MR1_PAR_ODD 0x04 /* odd parity */ +#define DUART_MR1_PAR_SPACE 0x08 /* space parity */ +#define DUART_MR1_PAR_MARK 0x0c /* mark parity */ +#define DUART_MR1_PAR_NONE 0x10 /* no parity */ +#define DUART_MR1_MDROP_DATA 0x18 /* multi_drop data */ +#define DUART_MR1_MDROP_ADRS 0x1c /* multi_drop address */ +#define DUART_MR1_ERR 0x20 /* 0 = char, 1 = block */ +#define DUART_MR1_RX_FULL 0x40 /* 0 = RxRDY, 1 = FFULL */ +#define DUART_MR1_RX_RTS 0x80 /* 0 = no, 1 = yes */ + +/* M340_DUART_SR - Status Register (a,b) */ + +#define DUART_SR_RXRDY 0x01 /* 0 = no, 1 = yes */ +#define DUART_SR_FFULL 0x02 /* 0 = no, 1 = yes */ +#define DUART_SR_TXRDY 0x04 /* 0 = no, 1 = yes */ +#define DUART_SR_TXEMP 0x08 /* 0 = no, 1 = yes */ +#define DUART_SR_OVERRUN_ERR 0x10 /* 0 = no, 1 = yes */ +#define DUART_SR_PARITY_ERR 0x20 /* 0 = no, 1 = yes */ +#define DUART_SR_FRAMING_ERR 0x40 /* 0 = no, 1 = yes */ +#define DUART_SR_RXD_BREAK 0x80 /* 0 = no, 1 = yes */ + +/* M340_DUART_CSR - Clock Select Register (a,b) */ + +#define DUART_CSR_TX_CLK_75 0x00 /* 75 */ +#define DUART_CSR_TX_CLK_110 0x01 /* 110 */ +#define DUART_CSR_TX_CLK_134_5 0x02 /* 134.5 */ +#define DUART_CSR_TX_CLK_150 0x03 /* 150 */ +#define DUART_CSR_TX_CLK_300 0x04 /* 300 */ +#define DUART_CSR_TX_CLK_600 0x05 /* 600 */ +#define DUART_CSR_TX_CLK_1200 0x06 /* 1200 */ +#define DUART_CSR_TX_CLK_2000 0x07 /* 2000 */ +#define DUART_CSR_TX_CLK_2400 0x08 /* 2400 */ +#define DUART_CSR_TX_CLK_4800 0x09 /* 4800 */ +#define DUART_CSR_TX_CLK_1800 0x0a /* 1800 */ +#define DUART_CSR_TX_CLK_9600 0x0b /* 9600 */ +#define DUART_CSR_TX_CLK_19200 0x0c /* 19200 */ +#define DUART_CSR_TX_CLK_38400 0x0d /* 38400 */ +#define DUART_CSR_TX_CLK_SCLK16 0x0e /* SCLK/16 */ +#define DUART_CSR_TX_CLK_SCLK 0x0f /* SCLK */ +#define DUART_CSR_RX_CLK_75 0x00 /* 75 */ +#define DUART_CSR_RX_CLK_110 0x10 /* 110 */ +#define DUART_CSR_RX_CLK_134_5 0x20 /* 134.5 */ +#define DUART_CSR_RX_CLK_150 0x30 /* 150 */ +#define DUART_CSR_RX_CLK_300 0x40 /* 300 */ +#define DUART_CSR_RX_CLK_600 0x50 /* 600 */ +#define DUART_CSR_RX_CLK_1200 0x60 /* 1200 */ +#define DUART_CSR_RX_CLK_2000 0x70 /* 2000 */ +#define DUART_CSR_RX_CLK_2400 0x80 /* 2400 */ +#define DUART_CSR_RX_CLK_4800 0x90 /* 4800 */ +#define DUART_CSR_RX_CLK_1800 0xa0 /* 1800 */ +#define DUART_CSR_RX_CLK_9600 0xb0 /* 9600 */ +#define DUART_CSR_RX_CLK_19200 0xc0 /* 19200 */ +#define DUART_CSR_RX_CLK_38400 0xd0 /* 38400 */ +#define DUART_CSR_RX_CLK_SCLK16 0xe0 /* SCLK/16 */ +#define DUART_CSR_RX_CLK_SCLK 0xf0 /* SCLK */ + +/* M340_DUART_CR - Command Register (a,b) */ + +#define DUART_CR_RX_ENABLE 0x01 /* 0 = no, 1 = yes */ +#define DUART_CR_RX_DISABLE 0x02 /* 0 = no, 1 = yes */ +#define DUART_CR_TX_ENABLE 0x04 /* 0 = no, 1 = yes */ +#define DUART_CR_TX_DISABLE 0x08 /* 0 = no, 1 = yes */ +#define DUART_CR_RST_MR_PTR 0x10 /* reset mr pointer command */ +#define DUART_CR_RST_RX 0x20 /* reset receiver command */ +#define DUART_CR_RST_TX 0x30 /* reset transmitter command */ +#define DUART_CR_RST_ERR_STS 0x40 /* reset error status command */ +#define DUART_CR_RST_BRK_INT 0x50 /* reset break int. command */ +#define DUART_CR_STR_BREAK 0x60 /* start break command */ +#define DUART_CR_STP_BREAK 0x70 /* stop break command */ +#define DUART_CR_RTS_ON 0x80 /* assert rts */ +#define DUART_CR_RTS_OFF 0x90 /* deassert rts */ + +/* M340_DUART_IPCR - Input Port Change Register */ + +#define DUART_IPCR_CTSA 0x01 /* 0 = low, 1 = high */ +#define DUART_IPCR_CTSB 0x02 /* 0 = low, 1 = high */ +#define DUART_IPCR_COSA 0x10 /* 1 = look for cos */ +#define DUART_IPCR_COSB 0x20 /* 1 = look for cos */ + +/* M340_DUART_ACR - Auxiliary Control Register */ + +#define DUART_ACR_IECA 0x01 /* interrupt enable change a */ +#define DUART_ACR_IECB 0x02 /* interrupt enable change b */ +#define DUART_ACR_BRG 0x80 /* baudrate set select */ + +/* M340_DUART_ISR - Interrupt Status/Mask Register */ + +#define DUART_ISR_TX_RDY_A 0x01 /* 0 = no, 1 = yes */ +#define DUART_ISR_RX_RDY_A 0x02 /* 0 = no, 1 = yes */ +#define DUART_ISR_BREAK_A 0x04 /* 0 = no, 1 = yes */ +#define DUART_ISR_XTAL_UNSTABLE 0x08 /* 0 = no, 1 = yes */ +#define DUART_ISR_TX_RDY_B 0x10 /* 0 = no, 1 = yes */ +#define DUART_ISR_RX_RDY_B 0x20 /* 0 = no, 1 = yes */ +#define DUART_ISR_BREAK_B 0x40 /* 0 = no, 1 = yes */ +#define DUART_ISR_INPUT_DELTA 0x80 /* 0 = no, 1 = yes */ + +/* M340_DUART_IP - Input Port Register */ + +#define DUART_IP_CTSA 0x01 /* 0 = low, 1 = high */ +#define DUART_IP_CTSB 0x02 /* 0 = low, 1 = high */ + +/* M340_DUART_OPCR - Output Port Control Register */ + +#define DUART_OPCR_RTSA 0x00 /* 0 = OP[0], 1 = RTSA */ +#define DUART_OPCR_RTSB 0x01 /* 0 = OP[1], 1 = RTSB */ +#define DUART_OPCR_RXRDY 0x10 /* 0 = OP[4], 1 = RxRDYA */ +#define DUART_OPCR_TXRDY 0x40 /* 0 = OP[6], 1 = TxRDYA */ + +/* M340_DUART_MR2 - Mode Register 2 (a,b) */ + +#define DUART_MR2_STOP_BITS_1 0x07 /* 1 */ +#define DUART_MR2_STOP_BITS_2 0x0f /* 2 */ +#define DUART_MR2_CTS_ENABLE 0x10 /* 0 = no, 1 = yes */ +#define DUART_MR2_TX_RTS 0x20 /* 0 = no, 1 = yes */ +#define DUART_MR2_NORM 0x00 /* normal */ +#define DUART_MR2_ECHO 0x40 /* auto echo */ +#define DUART_MR2_LOOPBACK 0x80 /* local loop */ +#define DUART_MR2_R_LOOPBACK 0xc0 /* remote loop */ + + +/* TIMER - Register definitions for the general purpose timer module */ + +/* M340_TMR_MCR - Module Configuration Register */ + +#define TMR_MCR_SUPV 0x0080 /* supervisor reg access only */ +#define TMR_MCR_FREEZE 0x4000 /* execution freeze */ +#define TMR_MCR_STOP 0x8000 /* stops the serial clocks */ + +/* M340_TMR_CR - Control Register */ + +#define TMR_CR_TOGGLE 0x0001 /* tout toggles */ +#define TMR_CR_ZERO 0x0002 /* tout goes to zero */ +#define TMR_CR_ONE 0x0003 /* tout goes to one */ +#define TMR_CR_CAPTURE 0x0000 /* input/output capture mode */ +#define TMR_CR_SQUARE 0x0004 /* square wave generator */ +#define TMR_CR_V_SQUARE 0x0008 /* variable duty square wave */ +#define TMR_CR_V_SHOT 0x000c /* variable width single shot */ +#define TMR_CR_PWM 0x0010 /* pulse width measurement */ +#define TMR_CR_PM 0x0014 /* period measurement */ +#define TMR_CR_EVT 0x0018 /* event count */ +#define TMR_CR_BYPASS 0x001c /* bypass */ +#define TMR_CR_X2 0x0020 /* divide by 2 */ +#define TMR_CR_X4 0x0040 /* divide by 4 */ +#define TMR_CR_X8 0x0060 /* divide by 8 */ +#define TMR_CR_X16 0x0080 /* divide by 16 */ +#define TMR_CR_X32 0x00a0 /* divide by 32 */ +#define TMR_CR_X64 0x00c0 /* divide by 64 */ +#define TMR_CR_X128 0x00e0 /* divide by 128 */ +#define TMR_CR_X256 0x0000 /* divide by 256 */ +#define TMR_CR_CLK_TIN 0x0100 /* clock source is tin */ +#define TMR_CR_CPE 0x0200 /* clock prescaler enable */ +#define TMR_CR_PSE 0x0400 /* prescaler select enable */ +#define TMR_CR_TGE 0x0800 /* timer gate enable */ +#define TMR_CR_TC 0x1000 /* tc enabled */ +#define TMR_CR_TG 0x2000 /* tg enabled */ +#define TMR_CR_TO 0x4000 /* to enabled */ +#define TMR_CR_SWR 0x8000 /* software reset */ + +/* M340_TMR_SR - Status/Prescaler Register */ + +#define TMR_SR_COM 0x0100 /* counter value matches com */ +#define TMR_SR_OUT 0x0200 /* output level */ +#define TMR_SR_ON 0x0400 /* counter enabled */ +#define TMR_SR_TGL 0x0800 /* tgate level */ +#define TMR_SR_TC 0x1000 /* timer compare interrupt */ +#define TMR_SR_TG 0x2000 /* timer gate interrupt */ +#define TMR_SR_TO 0x4000 /* timeout interrupt */ +#define TMR_SR_INT 0x8000 /* interrupt request */ + + +/* DMA - Register definitions for the DMA module */ + +/* DMA_MCR - Module Configuration Register */ + +#define DMA_MCR_MAID_MASK 0x0070 /* master arbitration id */ +#define DMA_MCR_SUPV 0x0080 /* supervisor reg access only */ +#define DMA_MCR_ISM_MASK 0x0700 /* int service mask */ +#define DMA_MCR_SE 0x1000 /* single address enable */ +#define DMA_MCR_FREEZE 0x4000 /* execution freeze */ +#define DMA_MCR_STOP 0x8000 /* stops the serial clocks */ + +/* DMA_CCR - Channel Control Register */ + +#define DMA_CCR_START 0x0001 /* start dma transfer */ +#define DMA_CCR_SNGL 0x0002 /* single address transfer */ +#define DMA_CCR_BB25 0x0000 /* 25% bus utilization */ +#define DMA_CCR_BB50 0x0004 /* 50% bus utilization */ +#define DMA_CCR_BB75 0x0008 /* 75% bus utilization */ +#define DMA_CCR_BB100 0x000c /* 100% bus utilization */ +#define DMA_CCR_INT_REQ 0x0000 /* internal request */ +#define DMA_CCR_EXT_REQ 0x0020 /* external request */ +#define DMA_CCR_CYC_STEAL 0x0030 /* external cycle steal */ +#define DMA_CCR_DS_LONG 0x0000 /* long destination */ +#define DMA_CCR_DS_WORD 0x0040 /* word destination */ +#define DMA_CCR_DS_BYTE 0x0080 /* byte destination */ +#define DMA_CCR_SS_LONG 0x0000 /* long source */ +#define DMA_CCR_SS_WORD 0x0100 /* word source */ +#define DMA_CCR_SS_BYTE 0x0200 /* byte source */ +#define DMA_CCR_DAPI 0x0400 /* increment destination ptr */ +#define DMA_CCR_SAPI 0x0800 /* increment source ptr */ +#define DMA_CCR_READ 0x1000 /* direction in SAM */ +#define DMA_CCR_ECO 0x1000 /* external control option */ +#define DMA_CCR_INT_ERR 0x2000 /* error interrupt */ +#define DMA_CCR_INT 0x4000 /* normal interrupt */ +#define DMA_CCR_INT_BRK 0x8000 /* breakpoint interrupt */ + +/* DMA_CSR - Channel Status Register */ + +#define DMA_CSR_BRKP 0x04 /* breakpoint */ +#define DMA_CSR_CONF 0x08 /* configuration error */ +#define DMA_CSR_BED 0x10 /* destination bus error */ +#define DMA_CSR_BES 0x20 /* source bus error */ +#define DMA_CSR_DONE 0x40 /* dma done */ +#define DMA_CSR_IRQ 0x80 /* interrupt request */ + +/* function declarations */ + +#ifndef _ASMLANGUAGE +#ifndef INCLUDE_TY_CO_DRV_50 +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT void tyCoInt (void); + +#else /* __STDC__ */ + +IMPORT void tyCoInt (); + +#endif /* __STDC__ */ +#endif /* INCLUDE_TY_CO_DRV_50 */ +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm68340h */ diff --git a/h/drv/multi/m68360.h b/h/drv/multi/m68360.h new file mode 100644 index 0000000..b769ef6 --- /dev/null +++ b/h/drv/multi/m68360.h @@ -0,0 +1,1204 @@ +/* m68360.h - Motorola MC68360 CPU control registers */ + +/* Copyright 1994-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,05dec96,db fixed macro M360_DPR_TMR per SPR #7575. +01d,28may96,dat fixed SPR #5616, new macros for SMC in GCI mode +01c,24jan94,dzb fixed size of M360_CPM_GSMR_L3, M360_CPM_PSMR3, M360_CPM_PCINT. +01b,05oct93,dzb added ethernet macros. broke out CPM interrupt vectors. + added SCC_DEV abstraction. added CPM command macros. +01a,04aug93,dzb written. +*/ + +/* +This file contains I/O addresses and related constants for the MC68360. +*/ + +#ifndef __INCm68360h +#define __INCm68360h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#ifndef INCLUDE_TY_CO_DRV_50 +#include "tyLib.h" +#endif /* INCLUDE_TY_CO_DRV_50 */ + +/* MC68360 Module Base Address Register fixed locations */ + +#define M360_SIM_MBAR 0x0003ff00 /* master base address register */ +#define M360_SIM_MBAR_SLAVE 0x0003ff04 /* slave base address register */ +#define M360_SIM_MBARE 0x0003ff08 /* slave MBAR enable address */ + +/* MC68360 Dual Ported Ram addresses */ + +#define M360_DPR_SCC1(base) ((UINT32 *) (base + 0xc00)) +#define M360_DPR_MISC(base) ((UINT32 *) (base + 0xcb0)) +#define M360_DPR_SCC2(base) ((UINT32 *) (base + 0xd00)) +#define M360_DPR_TMR(base) ((UINT32 *) (base + 0xdb0)) +#define M360_DPR_SPI(base) ((UINT32 *) (base + 0xd80)) +#define M360_DPR_SCC3(base) ((UINT32 *) (base + 0xe00)) +#define M360_DPR_IDMA1(base) ((UINT32 *) (base + 0xe70)) +#define M360_DPR_SMC1(base) ((UINT32 *) (base + 0xe80)) +#define M360_DPR_SCC4(base) ((UINT32 *) (base + 0xf00)) +#define M360_DPR_IDMA2(base) ((UINT32 *) (base + 0xf70)) +#define M360_DPR_SMC2(base) ((UINT32 *) (base + 0xf80)) + +/* GCI MODE Buffer Descriptors */ + +#define M360_SMC1_M_RXBD(base) ((UINT16 *) (base + 0x0E80)) +#define M360_SMC1_M_TXBD(base) ((UINT16 *) (base + 0x0E82)) +#define M360_SMC1_CI_RXBD(base) ((UINT16 *) (base + 0x0E84)) +#define M360_SMC1_CI_TXBD(base) ((UINT16 *) (base + 0x0E86)) + +#define M360_SMC2_M_RXBD(base) ((UINT16 *) (base + 0x0F80)) +#define M360_SMC2_M_TXBD(base) ((UINT16 *) (base + 0x0F82)) +#define M360_SMC2_CI_RXBD(base) ((UINT16 *) (base + 0x0F84)) +#define M360_SMC2_CI_TXBD(base) ((UINT16 *) (base + 0x0F86)) + +/* MC68360 register addresses in parameter ram */ + +#define M360_REGB_OFFSET 0x1000 /* offset to internal registers */ + +/* System Integration Module register addresses */ + +#define M360_SIM_MCR(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x000)) +#define M360_SIM_AVR(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x008)) +#define M360_SIM_RSR(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x009)) +#define M360_SIM_CLKOCR(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x00c)) +#define M360_SIM_PLLCR(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x010)) +#define M360_SIM_CDVCR(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x014)) +#define M360_SIM_PEPAR(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x016)) +#define M360_SIM_SYPCR(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x022)) +#define M360_SIM_SWIV(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x023)) +#define M360_SIM_PICR(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x026)) +#define M360_SIM_PITR(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x02a)) +#define M360_SIM_SWSR(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x02f)) +#define M360_SIM_BKAR(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x030)) +#define M360_SIM_BKCR(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x034)) +#define M360_SIM_GMR(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x040)) +#define M360_SIM_MSTAT(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x044)) +#define M360_SIM_BR0(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x050)) +#define M360_SIM_OR0(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x054)) +#define M360_SIM_BR1(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x060)) +#define M360_SIM_OR1(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x064)) +#define M360_SIM_BR2(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x070)) +#define M360_SIM_OR2(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x074)) +#define M360_SIM_BR3(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x080)) +#define M360_SIM_OR3(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x084)) +#define M360_SIM_BR4(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x090)) +#define M360_SIM_OR4(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x094)) +#define M360_SIM_BR5(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x0a0)) +#define M360_SIM_OR5(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x0a4)) +#define M360_SIM_BR6(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x0b0)) +#define M360_SIM_OR6(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x0b4)) +#define M360_SIM_BR7(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x0c0)) +#define M360_SIM_OR7(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x0c4)) + +/* Communication Processor Module register addresses */ + +#define M360_CPM_ICCR(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x500)) +#define M360_CPM_CMR1(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x504)) +#define M360_CPM_SAPR1(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x508)) +#define M360_CPM_DAPR1(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x50c)) +#define M360_CPM_BCR1(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x510)) +#define M360_CPM_FCR1(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x514)) +#define M360_CPM_CMAR1(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x516)) +#define M360_CPM_CSR1(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x518)) +#define M360_CPM_SDSR(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x51c)) +#define M360_CPM_SDCR(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x51e)) +#define M360_CPM_SDAR(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x520)) +#define M360_CPM_CMR2(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x526)) +#define M360_CPM_SAPR2(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x528)) +#define M360_CPM_DAPR2(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x52c)) +#define M360_CPM_BCR2(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x530)) +#define M360_CPM_FCR2(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x534)) +#define M360_CPM_CMAR2(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x536)) +#define M360_CPM_CSR2(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x538)) +#define M360_CPM_CICR(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x540)) +#define M360_CPM_CIPR(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x544)) +#define M360_CPM_CIMR(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x548)) +#define M360_CPM_CISR(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x54c)) +#define M360_CPM_PADIR(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x550)) +#define M360_CPM_PAPAR(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x552)) +#define M360_CPM_PAODR(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x554)) +#define M360_CPM_PADAT(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x556)) +#define M360_CPM_PCDIR(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x560)) +#define M360_CPM_PCPAR(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x562)) +#define M360_CPM_PCSO(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x564)) +#define M360_CPM_PCDAT(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x566)) +#define M360_CPM_PCINT(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x568)) +#define M360_CPM_TGCR(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x580)) +#define M360_CPM_TMR1(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x590)) +#define M360_CPM_TMR2(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x592)) +#define M360_CPM_TRR1(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x594)) +#define M360_CPM_TRR2(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x596)) +#define M360_CPM_TCR1(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x598)) +#define M360_CPM_TCR2(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x59a)) +#define M360_CPM_TCN1(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x59c)) +#define M360_CPM_TCN2(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x59e)) +#define M360_CPM_TMR3(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x5a0)) +#define M360_CPM_TMR4(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x5a2)) +#define M360_CPM_TRR3(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x5a4)) +#define M360_CPM_TRR4(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x5a6)) +#define M360_CPM_TCR3(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x5a8)) +#define M360_CPM_TCR4(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x5aa)) +#define M360_CPM_TCN3(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x5ac)) +#define M360_CPM_TCN4(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x5ae)) +#define M360_CPM_TER1(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x5b0)) +#define M360_CPM_TER2(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x5b2)) +#define M360_CPM_TER3(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x5b4)) +#define M360_CPM_TER4(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x5b6)) +#define M360_CPM_CR(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x5c0)) +#define M360_CPM_RCCR(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x5c4)) +#define M360_CPM_RTER(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x5d6)) +#define M360_CPM_RTMR(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x5da)) +#define M360_CPM_BRGC1(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x5f0)) +#define M360_CPM_BRGC2(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x5f4)) +#define M360_CPM_BRGC3(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x5f8)) +#define M360_CPM_BRGC4(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x5fc)) +#define M360_CPM_GSMR_L1(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x600)) +#define M360_CPM_GSMR_H1(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x604)) +#define M360_CPM_PSMR1(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x608)) +#define M360_CPM_TODR1(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x60c)) +#define M360_CPM_DSR1(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x60e)) +#define M360_CPM_SCCE1(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x610)) +#define M360_CPM_SCCM1(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x614)) +#define M360_CPM_SCCS1(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x617)) +#define M360_CPM_GSMR_L2(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x620)) +#define M360_CPM_GSMR_H2(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x624)) +#define M360_CPM_PSMR2(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x628)) +#define M360_CPM_TODR2(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x62c)) +#define M360_CPM_DSR2(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x62e)) +#define M360_CPM_SCCE2(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x630)) +#define M360_CPM_SCCM2(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x634)) +#define M360_CPM_SCCS2(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x637)) +#define M360_CPM_GSMR_L3(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x640)) +#define M360_CPM_GSMR_H3(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x644)) +#define M360_CPM_PSMR3(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x648)) +#define M360_CPM_TODR3(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x64c)) +#define M360_CPM_DSR3(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x64e)) +#define M360_CPM_SCCE3(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x650)) +#define M360_CPM_SCCM3(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x654)) +#define M360_CPM_SCCS3(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x657)) +#define M360_CPM_GSMR_L4(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x660)) +#define M360_CPM_GSMR_H4(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x664)) +#define M360_CPM_PSMR4(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x668)) +#define M360_CPM_TODR4(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x66c)) +#define M360_CPM_DSR4(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x66e)) +#define M360_CPM_SCCE4(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x670)) +#define M360_CPM_SCCM4(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x674)) +#define M360_CPM_SCCS4(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x677)) +#define M360_CPM_SMCMR1(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x682)) +#define M360_CPM_SMCE1(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x686)) +#define M360_CPM_SMCM1(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x68a)) +#define M360_CPM_SMCMR2(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x692)) +#define M360_CPM_SMCE2(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x696)) +#define M360_CPM_SMCM2(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x69a)) +#define M360_CPM_SPMODE(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x6a0)) +#define M360_CPM_SPIE(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x6a6)) +#define M360_CPM_SPIM(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x6aa)) +#define M360_CPM_SPCOM(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x6ad)) +#define M360_CPM_PIPC(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x6b2)) +#define M360_CPM_PTPR(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x6b6)) +#define M360_CPM_PBDIR(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x6b8)) +#define M360_CPM_PBPAR(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x6bc)) +#define M360_CPM_PBODR(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x6c2)) +#define M360_CPM_PBDAT(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x6c4)) +#define M360_CPM_SIMODE(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x6e0)) +#define M360_CPM_SIGMR(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x6e4)) +#define M360_CPM_SISTR(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x6e6)) +#define M360_CPM_SICMR(base) ((UINT8 *) (base + M360_REGB_OFFSET + 0x6e7)) +#define M360_CPM_SICR(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x6ec)) +#define M360_CPM_SIRP(base) ((UINT32 *) (base + M360_REGB_OFFSET + 0x6f2)) +#define M360_CPM_SIRAM(base) ((UINT16 *) (base + M360_REGB_OFFSET + 0x700)) + +/* SMC GCI Monitor Channel Receive Buffer Descriptor */ + +#define SMC_GCI_MON_RXBD_E 0x8000 +#define SMC_GCI_MON_RXBD_L 0x4000 +#define SMC_GCI_MON_RXBD_ER 0x2000 +#define SMC_GCI_MON_RXBD_MS 0x1000 +#define SMC_GCI_MON_RXBD_AB 0x0200 +#define SMC_GCI_MON_RXBD_EB 0x0100 + +/* SMC GCI Monitor Channel Transmit Buffer Descriptor */ + +#define SMC_GCI_MON_TXBD_R 0x8000 +#define SMC_GCI_MON_TXBD_L 0x4000 +#define SMC_GCI_MON_TXBD_AR 0x2000 +#define SMC_GCI_MON_TXBD_MS 0x1000 +#define SMC_GCI_MON_TXBD_AB 0x0200 +#define SMC_GCI_MON_TXBD_EB 0x0100 + +/* SMC GCI C/I Channel Receive Buffer Descriptor */ + +#define SMC_GCI_CI_RXBD_E 0x8000 +#define SMC_GCI_CI_DATA_MASK 0x003F + +/* SMC GCI C/I Channel Transmit Buffer Descriptor */ + +#define SMC_GCI_CI_TXBD_R 0x8000 + +/* SMC GCI Event and Mask Register definitions */ + +#define SMC_GCI_SMCX_CTXB 0x08 +#define SMC_GCI_SMCX_CRXB 0x04 +#define SMC_GCI_SMCX_MTXB 0x02 +#define SMC_GCI_SMCX_MRXB 0x01 + +/* SMC MODE Register fields in GCI MODE */ + +#define SMC_SMCMR_CLEN_1 0x0000 +#define SMC_SMCMR_CLEN_2 0x0800 +#define SMC_SMCMR_CLEN_3 0x1000 +#define SMC_SMCMR_CLEN_4 0x1800 +#define SMC_SMCMR_CLEN_5 0x2000 +#define SMC_SMCMR_CLEN_6 0x2800 +#define SMC_SMCMR_CLEN_7 0x3000 +#define SMC_SMCMR_CLEN_8 0x3800 +#define SMC_SMCMR_CLEN_9 0x4000 +#define SMC_SMCMR_CLEN_10 0x4800 +#define SMC_SMCMR_CLEN_11 0x5000 +#define SMC_SMCMR_CLEN_12 0x5800 +#define SMC_SMCMR_CLEN_13 0x6000 +#define SMC_SMCMR_CLEN_14 0x6800 +#define SMC_SMCMR_CLEN_15 0x7000 +#define SMC_SMCMR_CLEN_16 0x7800 + +#define SMC_SMCMR_ME 0x0400 +#define SMC_SMCMR_MP 0x0200 +#define SMC_SMCMR_CN 0x0100 +#define SMC_SMCMR_CHAN1 0x0000 +#define SMC_SMCMR_CHAN2 0x0100 + +#define SMC_SMCMR_SM_GCI 0x0000 +#define SMC_SMCMR_SM_UART 0x0020 +#define SMC_SMCMR_SM_TRANSPARENT 0x0030 + +#define SMC_SMCMR_DM_NORMAL 0x0000 +#define SMC_SMCMR_DM_LCLOOP 0x0004 +#define SMC_SMCMR_DM_ECHO 0x0008 + +#define SMC_SMCMR_TEN 0x0002 +#define SMC_SMCMR_REN 0x0001 +#define SMC_SMCMR_CRX_ENABLE 0x0004 + + +/* SI GLOBAL MODE register */ + +#define SI_SIGMR_ENB 0x08 +#define SI_SIGMR_ENA 0x04 +#define SI_SIGMR_RDM_1CHN_64E 0x00 +#define SI_SIGMR_RDM_1CHN_32E 0x01 +#define SI_SIGMR_RDM_2CHN_32E 0x02 +#define SI_SIGMR_RDM_2CHN_16E 0x03 + +/* SIRAM fields */ + +#define SI_SWTR 0x4000 +#define SI_SSEL4 0x2000 +#define SI_SSEL3 0x1000 +#define SI_SSEL2 0x0800 +#define SI_SSEL1 0x0400 +#define SI_CSEL_NS1 0x0000 +#define SI_CSEL_SCC1 0x0040 +#define SI_CSEL_SCC2 0x0080 +#define SI_CSEL_SCC3 0x00C0 +#define SI_CSEL_SCC4 0x0100 +#define SI_CSEL_SMC1 0x0140 +#define SI_CSEL_SMC2 0x0180 +#define SI_CSEL_NS2 0x01C0 +#define SI_CNT_1 0x0000 +#define SI_CNT_2 0x0004 +#define SI_CNT_3 0x0008 +#define SI_CNT_4 0x000C +#define SI_CNT_5 0x0010 +#define SI_CNT_6 0x0014 +#define SI_CNT_7 0x0018 +#define SI_CNT_8 0x001C +#define SI_CNT_9 0x0020 +#define SI_CNT_10 0x0024 +#define SI_CNT_11 0x0028 +#define SI_CNT_12 0x002C +#define SI_CNT_13 0x0030 +#define SI_CNT_14 0x0034 +#define SI_CNT_15 0x0038 +#define SI_CNT_16 0x003C +#define SI_BYT 0x0002 +#define SI_LST 0x0001 + +/* SIM - System Integration Module */ + +/* SIM Module Configuration Register definitions */ + +#define SIM_MCR_IARB_OFF 0x00000000 /* interrupt arb = off */ +#define SIM_MCR_IARB_LO 0x00000001 /* interrupt arb = 0x1 */ +#define SIM_MCR_IARB_HI 0x0000000f /* interrupt arb = 0xf */ +#define SIM_MCR_BCLRISM 0x00000070 /* bus clear in arb ID */ +#define SIM_MCR_BCLRIID 0x00000070 /* bus clear int service mask */ +#define SIM_MCR_SUPV 0x00000080 /* supervisor/user data space */ +#define SIM_MCR_SHEN 0x00000300 /* show cycle enable */ +#define SIM_MCR_BCLROID 0x00001c00 /* bus clear out arb ID */ +#define SIM_MCR_FRZ0 0x00002000 /* freeze enable - bus mon */ +#define SIM_MCR_FRZ1 0x00004000 /* freeze enable - SWE & PIT */ +#define SIM_MCR_ASTM 0x00008000 /* arb synch timing mode */ +#define SIM_MCR_BSTM 0x00010000 /* bus synch timing mode */ +#define SIM_MCR_BR040ID 0xe0000000 /* bus request 68040 arb ID */ + +/* SIM Clock Out Control Register definitions */ + +#define SIM_CLKOCR_COM1_FULL 0x00 /* CLKO1 full strength output */ +#define SIM_CLKOCR_COM1_TWO 0x01 /* CLKO1 two thirds strength */ +#define SIM_CLKOCR_COM1_ONE 0x02 /* CLKO1 one third strength */ +#define SIM_CLKOCR_COM1_DIS 0x03 /* CLKO1 disabled */ +#define SIM_CLKOCR_COM2_FULL 0x00 /* CLKO2 full strength output */ +#define SIM_CLKOCR_COM2_TWO 0x04 /* CLKO2 two thirds strength */ +#define SIM_CLKOCR_COM2_ONE 0x08 /* CLKO2 one third strength */ +#define SIM_CLKOCR_COM2_DIS 0x0c /* CLKO2 disabled */ +#define SIM_CLKOCR_RSTEN 0x20 /* loss of lock causes reset */ +#define SIM_CLKOCR_CLKOWP 0x80 /* CLKOCR write protect */ + +/* SIM PLL Control Register definitions */ + +#define SIM_PLLCR_MF 0x0fff /* multiplication factor */ +#define SIM_PLLCR_STSIM 0x1000 /* stop mode - VCO drives SIM */ +#define SIM_PLLCR_PREEN 0x2000 /* prescaller enable */ +#define SIM_PLLCR_PLLWP 0x4000 /* PLLCR write protect */ +#define SIM_PLLCR_PLLEN 0x8000 /* PLL enable */ + +/* SIM Clock Divider Control Register defintions */ + +#define SIM_CDVCR_CSRC 0x0001 /* high/low freq system clk */ +#define SIM_CDVCR_DFNH_1 0x0000 /* divide high freq clk by 1 */ +#define SIM_CDVCR_DFNH_2 0x0002 /* divide high freq clk by 2 */ +#define SIM_CDVCR_DFNH_4 0x0004 /* divide high freq clk by 4 */ +#define SIM_CDVCR_DFNH_8 0x0006 /* divide high freq clk by 8 */ +#define SIM_CDVCR_DFNH_16 0x0008 /* divide high freq clk by 16 */ +#define SIM_CDVCR_DFNH_32 0x000a /* divide high freq clk by 32 */ +#define SIM_CDVCR_DFNH_64 0x000c /* divide high freq clk by 64 */ +#define SIM_CDVCR_DFNL_2 0x0000 /* divide low freq clk by 2 */ +#define SIM_CDVCR_DFNL_4 0x0010 /* divide low freq clk by 4 */ +#define SIM_CDVCR_DFNL_8 0x0020 /* divide low freq clk by 8 */ +#define SIM_CDVCR_DFNL_16 0x0030 /* divide low freq clk by 16 */ +#define SIM_CDVCR_DFNL_32 0x0040 /* divide low freq clk by 32 */ +#define SIM_CDVCR_DFNL_64 0x0050 /* divide low freq clk by 64 */ +#define SIM_CDVCR_DFNL_256 0x0070 /* divide low freq clk by 256 */ +#define SIM_CDVCR_RRQEN 0x0080 /* RISC idle -> high freq clk */ +#define SIM_CDVCR_INTEN 0x0700 /* interrupt -> high freq clk */ +#define SIM_CDVCR_DFTM_1 0x0000 /* divide BRGCLK by 1 - norm */ +#define SIM_CDVCR_DFTM_4 0x0800 /* divide BRGCLK by 4 */ +#define SIM_CDVCR_DFTM_16 0x1000 /* divide BRGCLK by 16 */ +#define SIM_CDVCR_DFTM_64 0x1800 /* divide BRGCLK by 64 */ +#define SIM_CDVCR_DFSY_1 0x0000 /* divide SyncClk by 1 - norm */ +#define SIM_CDVCR_DFSY_4 0x2000 /* divide SyncClk by 4 */ +#define SIM_CDVCR_DFSY_16 0x4000 /* divide SyncClk by 16 */ +#define SIM_CDVCR_DFSY_64 0x6000 /* divide SyncClk by 64 */ +#define SIM_CDVCR_CDVWP 0x8000 /* CDVCR write protect */ + +/* SIM Auto Vector Register definitions */ + +#define SIM_AVR_LVL1 0x02 /* auto vector on IRQ1 */ +#define SIM_AVR_LVL2 0x04 /* auto vector on IRQ2 */ +#define SIM_AVR_LVL3 0x08 /* auto vector on IRQ3 */ +#define SIM_AVR_LVL4 0x10 /* auto vector on IRQ4 */ +#define SIM_AVR_LVL5 0x20 /* auto vector on IRQ5 */ +#define SIM_AVR_LVL6 0x40 /* auto vector on IRQ6 */ +#define SIM_AVR_LVL7 0x80 /* auto vector on IRQ7 */ + +/* SIM Based Interrupt Autovector addresses */ + +#define INT_VEC_AV1 0x19 /* vector location of AV1 */ +#define INT_VEC_AV2 0x1a /* vector location of AV2 */ +#define INT_VEC_AV3 0x1b /* vector location of AV3 */ +#define INT_VEC_AV4 0x1c /* vector location of AV4 */ +#define INT_VEC_AV5 0x1d /* vector location of AV5 */ +#define INT_VEC_AV6 0x1e /* vector location of AV6 */ +#define INT_VEC_AV7 0x1f /* vector location of AV7 */ + +/* SIM Reset Status Register definitions */ + +#define SIM_RSR_SRSTP 0x01 /* soft reset pin */ +#define SIM_RSR_SRST 0x02 /* soft reset */ +#define SIM_RSR_LOC 0x04 /* loss of clock reset */ +#define SIM_RSR_DBF 0x10 /* double bus fault reset */ +#define SIM_RSR_SW 0x20 /* software watchdog reset */ +#define SIM_RSR_POW 0x40 /* power up reset */ +#define SIM_RSR_EXT 0x80 /* external reset */ + +/* SIM System Protection Control Register definitions (write once only) */ + +#define SIM_SYPCR_BMT_1024 0x00 /* 1024 clk monitor timeout */ +#define SIM_SYPCR_BMT_512 0x01 /* 512 clk monitor timeout */ +#define SIM_SYPCR_BMT_256 0x02 /* 256 clk monitor timeout */ +#define SIM_SYPCR_BMT_128 0x03 /* 128 clk monitor timeout */ +#define SIM_SYPCR_BME 0x04 /* bus monitor enable */ +#define SIM_SYPCR_DBFE 0x08 /* double bus fault enable */ +#define SIM_SYPCR_SWT_9 0x00 /* 2^9 clk cycles (SWP=0) */ +#define SIM_SYPCR_SWT_11 0x10 /* 2^11 clk cycles (SWP=0) */ +#define SIM_SYPCR_SWT_13 0x20 /* 2^13 clk cycles (SWP=0) */ +#define SIM_SYPCR_SWT_15 0x30 /* 2^15 clk cycles (SWP=0) */ +#define SIM_SYPCR_SWT_18 0x00 /* 2^18 clk cycles (SWP=1) */ +#define SIM_SYPCR_SWT_20 0x10 /* 2^20 clk cycles (SWP=1) */ +#define SIM_SYPCR_SWT_22 0x20 /* 2^22 clk cycles (SWP=1) */ +#define SIM_SYPCR_SWT_24 0x30 /* 2^24 clk cycles (SWP=1) */ +#define SIM_SYPCR_SWRI 0x40 /* soft watchdog resets CPU */ +#define SIM_SYPCR_SWE 0x80 /* soft watchdog enable */ + +/* SIM Periodic Interrupt Control Register definitions */ + +#define SIM_PICR_PIV 0x00ff /* PIT int vector */ +#define SIM_PICR_PIRQL 0x0700 /* PIT int request level */ + +/* SIM Periodic Interrupt Timer Register definitions */ + +#define SIM_PITR_PITR_CNT 0x00ff /* PIT counter register */ +#define SIM_PITR_PTP 0x0100 /* PIT prescale bit */ +#define SIM_PITR_SWP 0x0200 /* soft watchdog prescale bit */ + +/* SIM Software Watchdog Service Register definitions */ + +#define SIM_SWSR_ACK1 0x55 /* software watchdog ack. 1 */ +#define SIM_SWSR_ACK2 0xaa /* software watchdog ack. 2 */ + +/* EBI - External Bus Interface */ + +/* EBI Port E Pin Assignment Register definitions */ + +#define EBI_PEPAR_IACK5 0x0001 /* select IACK5* output func */ +#define EBI_PEPAR_IACK7 0x0002 /* select IACK7* output func */ +#define EBI_PEPAR_IACK1_2 0x0004 /* select IACK1,2 output func */ +#define EBI_PEPAR_IACK3_6 0x0010 /* select IACK3,6 output func */ +#define EBI_PEPAR_PWW 0x0020 /* PEPAR was written */ +#define EBI_PEPAR_AMUX 0x0040 /* select AMUX output func */ +#define EBI_PEPAR_WE 0x0080 /* select WE* output function */ +#define EBI_PEPAR_RAS1DD 0x0100 /* select RAS1DD* output func */ +#define EBI_PEPAR_CF1MODE 0x0600 /* CONFIG1/BCLRO*/RAS2DD* */ +#define EBI_PEPAR_SINTOUT 0x7000 /* slave interrupt out mode */ + +/* MEMC - Memory Controller */ + +/* MEMC Global Memory Register definitions */ + +#define MEMC_GMR_GMAX 0x00000020 /* global address mux enable */ +#define MEMC_GMR_DW40 0x00000040 /* delay write for 68EC040 */ +#define MEMC_GMR_DWQ 0x00000080 /* delay write for QUICC */ +#define MEMC_GMR_NCS 0x00000100 /* suppress CS/RAS on CPU sp. */ +#define MEMC_GMR_TSS40 0x00000200 /* TS* sample for 68EC040 */ +#define MEMC_GMR_PBEE 0x00000400 /* parity bus error enable */ +#define MEMC_GMR_OPAR 0x00000800 /* odd/even parity */ +#define MEMC_GMR_EMWS 0x00001000 /* external master wait state */ +#define MEMC_GMR_SYNC 0x00002000 /* synch external accesses */ +#define MEMC_GMR_WBTQ 0x00004000 /* wait between QUICC trans */ +#define MEMC_GMR_WBT40 0x00008000 /* wait between 68EC040 trans */ +#define MEMC_GMR_DPS_32 0x00000000 /* DRAM port size is 32 bits */ +#define MEMC_GMR_DPS_16 0x00010000 /* DRAM port size is 16 bits */ +#define MEMC_GMR_DPS_EX 0x00030000 /* external DSACK* support */ +#define MEMC_GMR_PGS_128K 0x00000000 /* page size is 128Kbytes */ +#define MEMC_GMR_PGS_256K 0x00040000 /* page size is 256Kbytes */ +#define MEMC_GMR_PGS_512K 0x00080000 /* page size is 512Kbytes */ +#define MEMC_GMR_PGS_1M 0x000c0000 /* page size is 1Mbytes */ +#define MEMC_GMR_PGS_2M 0x00100000 /* page size is 2Mbytes */ +#define MEMC_GMR_PGS_4M 0x00140000 /* page size is 4Mbytes */ +#define MEMC_GMR_PGS_8M 0x00180000 /* page size is 8Mbytes */ +#define MEMC_GMR_PGS_16M 0x001c0000 /* page size is 16Mbytes */ +#define MEMC_GMR_RCYC_4 0x00000000 /* refresh cycle 4 clocks */ +#define MEMC_GMR_RCYC_6 0x00200000 /* refresh cycle 6 clocks */ +#define MEMC_GMR_RCYC_7 0x00400000 /* refresh cycle 7 clocks */ +#define MEMC_GMR_RCYC_8 0x00600000 /* refresh cycle 8 clocks */ +#define MEMC_GMR_RFEN 0x00800000 /* refresh enable */ +#define MEMC_GMR_RCNT 0xff000000 /* refresh counter period */ + +/* MEMC Status Register definitions */ + +#define MEMC_MSTAT_PER1 0x0001 /* write protect err - bank 1 */ +#define MEMC_MSTAT_PER2 0x0002 /* write protect err - bank 2 */ +#define MEMC_MSTAT_PER3 0x0004 /* write protect err - bank 3 */ +#define MEMC_MSTAT_PER4 0x0008 /* write protect err - bank 4 */ +#define MEMC_MSTAT_PER5 0x0010 /* write protect err - bank 5 */ +#define MEMC_MSTAT_PER6 0x0020 /* write protect err - bank 6 */ +#define MEMC_MSTAT_PER7 0x0040 /* write protect err - bank 7 */ +#define MEMC_MSTAT_PER8 0x0080 /* write protect err - bank 8 */ +#define MEMC_MSTAT_WPER 0x0100 /* write protect error */ + +/* MEMC Base Register definitions */ + +#define MEMC_BR_V 0x00000001 /* DRAM/SRAM bank is valid */ +#define MEMC_BR_WP 0x00000002 /* write protect */ +#define MEMC_BR_PAREN 0x00000004 /* parity checking enable */ +#define MEMC_BR_CSNTQ 0x00000008 /* CS negate timing - QUICC */ +#define MEMC_BR_CSNT40 0x00000010 /* CS negate timing - 68EC040 */ +#define MEMC_BR_BACK40 0x00000020 /* burst acknowledge 68EC040 */ +#define MEMC_BR_TRLXQ 0x00000040 /* timing relax */ +#define MEMC_BR_FC 0x00000780 /* function code spec */ +#define MEMC_BR_BA 0xfffff800 /* base address spec */ + +/* MEMC Option Register definitions */ + +#define MEMC_OR_DSSEL 0x00000001 /* DRAM/SRAM select */ +#define MEMC_OR_SPS_32 0x00000000 /* SRAM port size is 32 bits */ +#define MEMC_OR_SPS_16 0x00000002 /* SRAM port size is 16 bits */ +#define MEMC_OR_SPS_8 0x00000004 /* SRAM port size is 8 bits */ +#define MEMC_OR_SPS_EX 0x00000006 /* external DSACK* support */ +#define MEMC_OR_PGME 0x00000008 /* page mode enable (DRAM) */ +#define MEMC_OR_BCYC_1 0x00000000 /* burst cycle 1 clock */ +#define MEMC_OR_BCYC_2 0x00000020 /* burst cycle 2 clock */ +#define MEMC_OR_BCYC_3 0x00000040 /* burst cycle 3 clock */ +#define MEMC_OR_BCYC_4 0x00000060 /* burst cycle 4 clock */ +#define MEMC_OR_FC 0x00000780 /* function code mask */ +#define MEMC_OR_AM 0x0ffff800 /* addresss mask */ +#define MEMC_OR_TCYC 0xf0000000 /* bus cycle length in clocks */ + +/*** CPM - register definitions for the Communication Processor Module ***/ + +/* CPM - Communication Processor Module */ + +/* CPM Configuration Register definitions */ + +#define CPM_CR_FLG 0x0001 /* flag - command executing */ +#define CPM_CR_CHANNEL_SCC1 0x0000 /* SCC1 channel */ +#define CPM_CR_CHANNEL_SCC2 0x0040 /* SCC2 channel */ +#define CPM_CR_CHANNEL_SPI 0x0050 /* SPI channel */ +#define CPM_CR_CHANNEL_RTMR 0x0050 /* RISC timer channel */ +#define CPM_CR_CHANNEL_SCC3 0x0080 /* SCC3 channel */ +#define CPM_CR_CHANNEL_SMC1 0x0090 /* SMC1 channel */ +#define CPM_CR_CHANNEL_IDMA1 0x0090 /* IDMA1 channel */ +#define CPM_CR_CHANNEL_SCC4 0x00c0 /* SCC4 channel */ +#define CPM_CR_CHANNEL_SMC2 0x00d0 /* SMC2 channel */ +#define CPM_CR_CHANNEL_IDMA2 0x00d0 /* IDMA2 channel */ +#define CPM_CR_OPCODE 0x0f00 /* command opcode */ + +#define CPM_CR_SCC_INIT_RT 0x0000 /* initialize SCC rx and tx*/ +#define CPM_CR_SCC_INIT_R 0x0100 /* initialize SCC rx only */ +#define CPM_CR_SCC_INIT_T 0x0200 /* initialize SCC tx only */ +#define CPM_CR_SCC_HUNT 0x0300 /* enter rx frame hunt mode */ +#define CPM_CR_SCC_STOP 0x0400 /* stop SCC tx */ +#define CPM_CR_SCC_GRSTOP 0x0500 /* gracefully stop SCC tx */ +#define CPM_CR_SCC_RESTART 0x0600 /* restart SCC tx */ +#define CPM_CR_SCC_CLOSE 0x0700 /* close SCC rx buffer */ +#define CPM_CR_SCC_SET_GROUP 0x0800 /* set SCC group address */ +#define CPM_CR_SCC_RESET_BCS 0x0a00 /* reset bisync seq calc */ + +#define CPM_CR_RST 0x8000 /* software reset command */ + +/* CPIC - CPM Interrupt Controller */ + +/* CPM Interrupt Configuration Register definitions */ + +#define CPIC_CICR_SPS 0x00000001 /* spread SCC priority scheme */ +#define CPIC_CICR_VBA 0x000000e0 /* vector base address */ +#define CPIC_CICR_HP 0x00001f00 /* highest priority source */ +#define CPIC_CICR_IRL 0x0000e000 /* interrupt request level */ +#define CPIC_CICR_SCaP_1 0x00000000 /* SCCa will be used by SCC1 */ +#define CPIC_CICR_SCaP_2 0x00010000 /* SCCa will be used by SCC2 */ +#define CPIC_CICR_SCaP_3 0x00020000 /* SCCa will be used by SCC3 */ +#define CPIC_CICR_SCaP_4 0x00030000 /* SCCa will be used by SCC4 */ +#define CPIC_CICR_SCbP_1 0x00000000 /* SCCb will be used by SCC1 */ +#define CPIC_CICR_SCbP_2 0x00040000 /* SCCb will be used by SCC2 */ +#define CPIC_CICR_SCbP_3 0x00080000 /* SCCb will be used by SCC3 */ +#define CPIC_CICR_SCbP_4 0x000c0000 /* SCCb will be used by SCC4 */ +#define CPIC_CICR_SCcP_1 0x00000000 /* SCCc will be used by SCC1 */ +#define CPIC_CICR_SCcP_2 0x00100000 /* SCCc will be used by SCC2 */ +#define CPIC_CICR_SCcP_3 0x00200000 /* SCCc will be used by SCC3 */ +#define CPIC_CICR_SCcP_4 0x00300000 /* SCCc will be used by SCC4 */ +#define CPIC_CICR_SCdP_1 0x00000000 /* SCCd will be used by SCC1 */ +#define CPIC_CICR_SCdP_2 0x00400000 /* SCCd will be used by SCC2 */ +#define CPIC_CICR_SCdP_3 0x00800000 /* SCCd will be used by SCC3 */ +#define CPIC_CICR_SCdP_4 0x00c00000 /* SCCd will be used by SCC4 */ + +/* CPM Interrupt Pending, Mask, and In-Serivice Register definitions */ + +#define CPIC_CIXR_PC11 0x00000002 /* PC11 interrupt source */ +#define CPIC_CIXR_PC10 0x00000004 /* PC10 interrupt source */ +#define CPIC_CIXR_SMC2 0x00000008 /* SMC2 interrupt source */ +#define CPIC_CIXR_SMC1 0x00000010 /* SMC1 interrupt source */ +#define CPIC_CIXR_SPI 0x00000020 /* SPI interrupt source */ +#define CPIC_CIXR_PC9 0x00000040 /* PC9 interrupt source */ +#define CPIC_CIXR_TMR4 0x00000080 /* TMR4 interrupt source */ +#define CPIC_CIXR_PC8 0x00000200 /* PC8 interrupt source */ +#define CPIC_CIXR_PC7 0x00000400 /* PC7 interrupt source */ +#define CPIC_CIXR_PC6 0x00000800 /* PC6 interrupt source */ +#define CPIC_CIXR_TMR3 0x00001000 /* TMR3 interrupt source */ +#define CPIC_CIXR_PC5 0x00004000 /* PC5 interrupt source */ +#define CPIC_CIXR_PC4 0x00008000 /* PC4 interrupt source */ +#define CPIC_CIXR_RTT 0x00020000 /* RTT interrupt source */ +#define CPIC_CIXR_TMR2 0x00040000 /* TMR2 interrupt source */ +#define CPIC_CIXR_IDMA2 0x00100000 /* IDMA2 interrupt source */ +#define CPIC_CIXR_IDMA1 0x00200000 /* IDMA1 interrupt source */ +#define CPIC_CIXR_SDMA 0x00400000 /* SDMA interrupt source */ +#define CPIC_CIXR_PC3 0x00800000 /* PC3 interrupt source */ +#define CPIC_CIXR_PC2 0x01000000 /* PC2 interrupt source */ +#define CPIC_CIXR_TMR1 0x02000000 /* TMR1 interrupt source */ +#define CPIC_CIXR_PC1 0x04000000 /* PC1 interrupt source */ +#define CPIC_CIXR_SCC4 0x08000000 /* SCC4 interrupt source */ +#define CPIC_CIXR_SCC3 0x10000000 /* SCC3 interrupt source */ +#define CPIC_CIXR_SCC2 0x20000000 /* SCC2 interrupt source */ +#define CPIC_CIXR_SCC1 0x40000000 /* SCC1 interrupt source */ +#define CPIC_CIXR_PC0 0x80000000 /* PC0 interrupt source */ + +/* CPM Based Interrupt Vectors offsets */ + +#define INT_OFF_ERR 0x0 +#define INT_OFF_PC11 0x1 +#define INT_OFF_PC10 0x2 +#define INT_OFF_SMC2 0x3 +#define INT_OFF_SMC1 0x4 +#define INT_OFF_SPI 0x5 +#define INT_OFF_PC9 0x6 +#define INT_OFF_TMR4 0x7 +#define INT_OFF_RES1 0x8 +#define INT_OFF_PC8 0x9 +#define INT_OFF_PC7 0xa +#define INT_OFF_PC6 0xb +#define INT_OFF_TMR3 0xc +#define INT_OFF_RES2 0xd +#define INT_OFF_PC5 0xe +#define INT_OFF_PC4 0xf +#define INT_OFF_RES3 0x10 +#define INT_OFF_RISC 0x11 +#define INT_OFF_TMR2 0x12 +#define INT_OFF_RES4 0x13 +#define INT_OFF_IDMA2 0x14 +#define INT_OFF_IDMA1 0x15 +#define INT_OFF_SDMA 0x16 +#define INT_OFF_PC3 0x17 +#define INT_OFF_PC2 0x18 +#define INT_OFF_TMR1 0x19 +#define INT_OFF_PC1 0x1a +#define INT_OFF_SCC4 0x1b +#define INT_OFF_SCC3 0x1c +#define INT_OFF_SCC2 0x1d +#define INT_OFF_SCC1 0x1e +#define INT_OFF_PC0 0x1f + +/* CPM Based Interrupt Vectors addresses */ + +#define INT_CPM_BASE(base) (*M360_CPM_CICR(base) & CPIC_CICR_VBA) + +#define INT_VEC_ERR(base) (INT_OFF_ERR | INT_CPM_BASE(base)) +#define INT_VEC_PC11(base) (INT_OFF_PC11 | INT_CPM_BASE(base)) +#define INT_VEC_PC10(base) (INT_OFF_PC10 | INT_CPM_BASE(base)) +#define INT_VEC_SMC2(base) (INT_OFF_SMC2 | INT_CPM_BASE(base)) +#define INT_VEC_SMC1(base) (INT_OFF_SMC1 | INT_CPM_BASE(base)) +#define INT_VEC_SPI(base) (INT_OFF_SPI | INT_CPM_BASE(base)) +#define INT_VEC_PC9(base) (INT_OFF_PC9 | INT_CPM_BASE(base)) +#define INT_VEC_TMR4(base) (INT_OFF_TMR4 | INT_CPM_BASE(base)) +#define INT_VEC_RES1(base) (INT_OFF_RES1 | INT_CPM_BASE(base)) +#define INT_VEC_PC8(base) (INT_OFF_PC8 | INT_CPM_BASE(base)) +#define INT_VEC_PC7(base) (INT_OFF_PC7 | INT_CPM_BASE(base)) +#define INT_VEC_PC6(base) (INT_OFF_PC6 | INT_CPM_BASE(base)) +#define INT_VEC_TMR3(base) (INT_OFF_TMR3 | INT_CPM_BASE(base)) +#define INT_VEC_RES2(base) (INT_OFF_RES2 | INT_CPM_BASE(base)) +#define INT_VEC_PC5(base) (INT_OFF_PC5 | INT_CPM_BASE(base)) +#define INT_VEC_PC4(base) (INT_OFF_PC4 | INT_CPM_BASE(base)) +#define INT_VEC_RES3(base) (INT_OFF_RES3 | INT_CPM_BASE(base)) +#define INT_VEC_RISC(base) (INT_OFF_RISC | INT_CPM_BASE(base)) +#define INT_VEC_TMR2(base) (INT_OFF_TMR2 | INT_CPM_BASE(base)) +#define INT_VEC_RES4(base) (INT_OFF_RES4 | INT_CPM_BASE(base)) +#define INT_VEC_IDMA2(base) (INT_OFF_IDMA2 | INT_CPM_BASE(base)) +#define INT_VEC_IDMA1(base) (INT_OFF_IDMA1 | INT_CPM_BASE(base)) +#define INT_VEC_SDMA(base) (INT_OFF_SDMA | INT_CPM_BASE(base)) +#define INT_VEC_PC3(base) (INT_OFF_PC3 | INT_CPM_BASE(base)) +#define INT_VEC_PC2(base) (INT_OFF_PC2 | INT_CPM_BASE(base)) +#define INT_VEC_TMR1(base) (INT_OFF_TMR1 | INT_CPM_BASE(base)) +#define INT_VEC_PC1(base) (INT_OFF_PC1 | INT_CPM_BASE(base)) +#define INT_VEC_SCC4(base) (INT_OFF_SCC4 | INT_CPM_BASE(base)) +#define INT_VEC_SCC3(base) (INT_OFF_SCC3 | INT_CPM_BASE(base)) +#define INT_VEC_SCC2(base) (INT_OFF_SCC2 | INT_CPM_BASE(base)) +#define INT_VEC_SCC1(base) (INT_OFF_SCC1 | INT_CPM_BASE(base)) +#define INT_VEC_PC0(base) (INT_OFF_PC0 | INT_CPM_BASE(base)) + +/* IDMA - Independent Direct Memory Access */ + +/* IDMA Configuration Register definitions */ + +#define IDMA_ICCR_IAID 0x0070 /* IDMA arbitration ID */ +#define IDMA_ICCR_ISM 0x0700 /* interrupt service mask */ +#define IDMA_ICCR_ARBP_1 0x0000 /* ch 1 priority over ch 2 */ +#define IDMA_ICCR_ARBP_2 0x1000 /* ch 2 priority over ch 1 */ +#define IDMA_ICCR_ARBP_ROT 0x2000 /* rotating priority of IDMAs */ +#define IDMA_ICCR_FRZ_DIS 0x0000 /* ignore the FREEZE signal */ +#define IDMA_ICCR_FRZ_EN 0x4000 /* freeze on FREEZE signal */ +#define IDMA_ICCR_STP 0x8000 /* stop sys clk to IDMA chnls */ + +/* SDMA - Serial Direct Memory Access */ + +/* SDMA Configuration Register definitions */ + +#define SDMA_SDCR_INTB 0x0001 /* breakpoint interrupt mask */ +#define SDMA_SDCR_INTE 0x0002 /* bus error interrupt mask */ +#define SDMA_SDCR_INTR 0x0004 /* reserved interrupt mask */ +#define SDMA_SDCR_SAID 0x0070 /* SDMA arbitration ID */ +#define SDMA_SDCR_SISM 0x0700 /* interrupt service mask */ +#define SDMA_SDCR_FRZ_DIS 0x0000 /* ignore the FREEZE signal */ +#define SDMA_SDCR_FRZ_EN 0x4000 /* freeze on FREEZE signal */ + +/* TMR - Timers */ + +/* TMR Global Configuration Register definitions */ + +#define TMR_TGCR_RST1 0x0001 /* reset/enable timer 1 */ +#define TMR_TGCR_STP1 0x0002 /* stop timer 1 */ +#define TMR_TGCR_FRZ1 0x0004 /* halt timer 1 on FREEZE */ +#define TMR_TGCR_GM1 0x0008 /* normal gate mode on TGATE1 */ +#define TMR_TGCR_RST2 0x0010 /* reset/enable timer 2 */ +#define TMR_TGCR_STP2 0x0020 /* stop timer 2 */ +#define TMR_TGCR_FRZ2 0x0040 /* halt timer 2 on FREEZE */ +#define TMR_TGCR_CAS2 0x0080 /* cascade timers 1 and 2 */ +#define TMR_TGCR_RST3 0x0100 /* reset/enable timer 3 */ +#define TMR_TGCR_STP3 0x0200 /* stop timer 3 */ +#define TMR_TGCR_FRZ3 0x0400 /* halt timer 3 on FREEZE */ +#define TMR_TGCR_GM2 0x0800 /* normal gate mode on TGATE2 */ +#define TMR_TGCR_RST4 0x1000 /* reset/enable timer 4 */ +#define TMR_TGCR_STP4 0x2000 /* stop timer 4 */ +#define TMR_TGCR_FRZ4 0x4000 /* halt timer 4 on FREEZE */ +#define TMR_TGCR_CAS4 0x8000 /* cascade timers 3 and 4 */ + +/* TMR Mode Register definitions */ + +#define TMR_TMR_GE 0x0001 /* enable TGATE signal */ +#define TMR_TMR_ICLK_CAS 0x0000 /* input is output of timer */ +#define TMR_TMR_ICLK_CLK 0x0002 /* input is general sys clock */ +#define TMR_TMR_ICLK_CLK16 0x0004 /* input is sys clock div 16 */ +#define TMR_TMR_ICLK_TIN 0x0006 /* input is TIN pin */ +#define TMR_TMR_FRR 0x0008 /* free run/restart timer */ +#define TMR_TMR_ORI 0x0010 /* output interrupt enable */ +#define TMR_TMR_OM 0x0020 /* output mode */ +#define TMR_TMR_CE 0x00c0 /* capture edge for TIN input */ +#define TMR_TMR_PS 0xff00 /* prescaler value */ + +/* TMR Event Register definitions */ + +#define TMR_TER_CAP 0x0001 /* capture event occurred */ +#define TMR_TER_REF 0x0002 /* reference event occurred */ + +/* SI - Serial Interface */ + +/* SI Mode Register definitions */ + +#define SI_SIMODE_TFSDa 0x00000003 /* transmit frame sync delay */ +#define SI_SIMODE_GMa 0x00000004 /* grant mode TDM a */ +#define SI_SIMODE_FEa 0x00000008 /* frame sync edge TDM a */ +#define SI_SIMODE_CEa 0x00000010 /* clock edge TDM a */ +#define SI_SIMODE_STZa 0x00000020 /* set L1TXDa to zero TDM a */ +#define SI_SIMODE_CRTa 0x00000040 /* common Rx/Tx pins TDM a */ +#define SI_SIMODE_DSCa 0x00000080 /* double speed clk TDM a */ +#define SI_SIMODE_RFSDa 0x00000300 /* receive frame sync delay */ +#define SI_SIMODE_SDMa 0x00000c00 /* SI diagnostic mode TDM a */ +#define SI_SIMODE_SMC1CS 0x00007000 /* SMC1 clk source (NMSI) */ +#define SI_SIMODE_SMC1 0x00008000 /* SMC1 connection (NMSI) */ +#define SI_SIMODE_TFSDb 0x00030000 /* transmit frame sync delay */ +#define SI_SIMODE_GMb 0x00040000 /* grant mode TDM b */ +#define SI_SIMODE_FEb 0x00080000 /* frame sync edge TDM b */ +#define SI_SIMODE_CEb 0x00100000 /* clock edge TDM b */ +#define SI_SIMODE_STZb 0x00200000 /* set L1TXDb to zero TDM b */ +#define SI_SIMODE_CRTb 0x00400000 /* common Rx/Tx pins TDM a */ +#define SI_SIMODE_DSCb 0x00800000 /* double speed clock TDM b */ +#define SI_SIMODE_RFSDb 0x03000000 /* receive frame sync delay */ +#define SI_SIMODE_SDMb 0x0c000000 /* SI diagnostic mode TDM b */ +#define SI_SIMODE_SMC2CS 0x70000000 /* SMC2 clk source (NMSI) */ +#define SI_SIMODE_SMC2 0x80000000 /* SMC2 connection (NMSI) */ + +/* SI Clock Route Register definitions */ + +#define SI_SICR_TCS 0x07 /* transmit clock source SCC */ +#define SI_SICR_RCS 0x38 /* receive clock source SCC */ +#define SI_SICR_SC 0x40 /* SCC connection (NMSI) */ +#define SI_SICR_GR 0x80 /* grant support by SCC */ + +/* BRG - Baud Rate Generator */ + +/* BRG Configuration Register definitions */ + +#define BRG_CR_DIV16 0x00001 /* BRG clock prescale div 16 */ +#define BRG_CR_CD 0x01ffe /* clock divider */ +#define BRG_CR_ATB 0x02000 /* autobaud support */ +#define BRG_CR_EXT_BRGCLK 0x00000 /* external clk source BRGCLK */ +#define BRG_CR_EXT_CLK2 0x04000 /* external clk source CLK2 */ +#define BRG_CR_EXT_CLK6 0x08000 /* external clk source CLK6 */ +#define BRG_CR_EN 0x10000 /* enable BRG count */ +#define BRG_CR_RST 0x20000 /* perform reset on BRG */ + +/* SCC - Serial Communication Controller */ + +/* General SCC Mode Register definitions */ + +#define SCC_GSMRL_HDLC 0x00000000 /* HDLC mode */ +#define SCC_GSMRL_APPLETALK 0x00000002 /* AppleTalk mode (LocalTalk) */ +#define SCC_GSMRL_SS7 0x00000003 /* SS7 mode (microcode) */ +#define SCC_GSMRL_UART 0x00000004 /* UART mode */ +#define SCC_GSMRL_PROFI_BUS 0x00000005 /* Profi-Bus mode (microcode) */ +#define SCC_GSMRL_ASYNC_HDLC 0x00000006 /* async HDLC mode (microcode)*/ +#define SCC_GSMRL_V14 0x00000007 /* V.14 mode */ +#define SCC_GSMRL_BISYNC 0x00000008 /* BISYNC mode */ +#define SCC_GSMRL_DDCMP 0x00000009 /* DDCMP mode (microcode) */ +#define SCC_GSMRL_ETHERNET 0x0000000c /* ethernet mode (SCC1 only) */ +#define SCC_GSMRL_ENT 0x00000010 /* enable transmitter */ +#define SCC_GSMRL_ENR 0x00000020 /* enable receiver */ +#define SCC_GSMRL_LOOPBACK 0x00000040 /* local loopback mode */ +#define SCC_GSMRL_ECHO 0x00000080 /* automatic echo mode */ +#define SCC_GSMRL_TENC 0x00000700 /* transmitter encoding method*/ +#define SCC_GSMRL_RENC 0x00003800 /* receiver encoding method */ +#define SCC_GSMRL_RDCR_X8 0x00004000 /* receive DPLL clock x8 */ +#define SCC_GSMRL_RDCR_X16 0x00008000 /* receive DPLL clock x16 */ +#define SCC_GSMRL_RDCR_X32 0x0000c000 /* receive DPLL clock x32 */ +#define SCC_GSMRL_TDCR_X8 0x00010000 /* transmit DPLL clock x8 */ +#define SCC_GSMRL_TDCR_X16 0x00020000 /* transmit DPLL clock x16 */ +#define SCC_GSMRL_TDCR_X32 0x00030000 /* transmit DPLL clock x32 */ +#define SCC_GSMRL_TEND 0x00040000 /* transmitter frame ending */ +#define SCC_GSMRL_TPP_00 0x00180000 /* Tx preamble pattern = 00 */ +#define SCC_GSMRL_TPP_10 0x00080000 /* Tx preamble pattern = 10 */ +#define SCC_GSMRL_TPP_01 0x00100000 /* Tx preamble pattern = 01 */ +#define SCC_GSMRL_TPP_11 0x00180000 /* Tx preamble pattern = 11 */ +#define SCC_GSMRL_TPL_NONE 0x00000000 /* no Tx preamble (default) */ +#define SCC_GSMRL_TPL_8 0x00200000 /* Tx preamble = 1 byte */ +#define SCC_GSMRL_TPL_16 0x00400000 /* Tx preamble = 2 bytes */ +#define SCC_GSMRL_TPL_32 0x00600000 /* Tx preamble = 4 bytes */ +#define SCC_GSMRL_TPL_48 0x00800000 /* Tx preamble = 6 bytes */ +#define SCC_GSMRL_TPL_64 0x00a00000 /* Tx preamble = 8 bytes */ +#define SCC_GSMRL_TPL_128 0x00c00000 /* Tx preamble = 16 bytes */ +#define SCC_GSMRL_TINV 0x01000000 /* DPLL transmit input invert */ +#define SCC_GSMRL_RINV 0x02000000 /* DPLL receive input invert */ +#define SCC_GSMRL_TSNC 0x0c000000 /* transmit sense */ +#define SCC_GSMRL_TCI 0x10000000 /* transmit clock invert */ +#define SCC_GSMRL_EDGE 0x60000000 /* adjustment edge +/- */ + +#define SCC_GSMRH_RSYN 0x00000001 /* receive sync timing*/ +#define SCC_GSMRH_RTSM 0x00000002 /* RTS* mode */ +#define SCC_GSMRH_SYNL 0x0000000c /* sync length */ +#define SCC_GSMRH_TXSY 0x00000010 /* transmitter/receiver sync */ +#define SCC_GSMRH_RFW 0x00000020 /* Rx FIFO width */ +#define SCC_GSMRH_TFL 0x00000040 /* transmit FIFO length */ +#define SCC_GSMRH_CTSS 0x00000080 /* CTS* sampling */ +#define SCC_GSMRH_CDS 0x00000100 /* CD* sampling */ +#define SCC_GSMRH_CTSP 0x00000200 /* CTS* pulse */ +#define SCC_GSMRH_CDP 0x00000400 /* CD* pulse */ +#define SCC_GSMRH_TTX 0x00000800 /* transparent transmitter */ +#define SCC_GSMRH_TRX 0x00001000 /* transparent receiver */ +#define SCC_GSMRH_REVD 0x00002000 /* reverse data */ +#define SCC_GSMRH_TCRC 0x0000c000 /* transparent CRC */ +#define SCC_GSMRH_GDE 0x00010000 /* glitch detect enable */ + +/* SCC UART protocol specific parameters */ + +typedef struct /* SCC_UART_PROTO */ + { + UINT32 res1; /* reserved */ + UINT32 res2; /* reserved */ + UINT16 maxIdl; /* maximum idle characters */ + UINT16 idlc; /* temporary idle counter */ + UINT16 brkcr; /* break count register (transmit) */ + UINT16 parec; /* receive parity error counter */ + UINT16 frmer; /* receive framing error counter */ + UINT16 nosec; /* receive noise counter */ + UINT16 brkec; /* receive break condition counter */ + UINT16 brkln; /* last received break length */ + UINT16 uaddr1; /* uart address character 1 */ + UINT16 uaddr2; /* uart address character 2 */ + UINT16 rtemp; /* temp storage */ + UINT16 toseq; /* transmit out-of-sequence character */ + UINT16 character1; /* control character 1 */ + UINT16 character2; /* control character 2 */ + UINT16 character3; /* control character 3 */ + UINT16 character4; /* control character 4 */ + UINT16 character5; /* control character 5 */ + UINT16 character6; /* control character 6 */ + UINT16 character7; /* control character 7 */ + UINT16 character8; /* control character 8 */ + UINT16 rccm; /* receive control character mask */ + UINT16 rccr; /* receive control character register */ + UINT16 rlbc; /* receive last break character */ + } SCC_UART_PROTO; + +/* SCC UART Protocol Specific Mode Register definitions */ + +#define SCC_UART_PSMR_TPM_ODD 0x0000 /* odd parity mode (Tx) */ +#define SCC_UART_PSMR_TPM_LOW 0x0001 /* low parity mode (Tx) */ +#define SCC_UART_PSMR_TPM_EVEN 0x0002 /* even parity mode (Tx) */ +#define SCC_UART_PSMR_TPM_HIGH 0x0003 /* high parity mode (Tx) */ +#define SCC_UART_PSMR_RPM_ODD 0x0000 /* odd parity mode (Rx) */ +#define SCC_UART_PSMR_RPM_LOW 0x0004 /* low parity mode (Rx) */ +#define SCC_UART_PSMR_RPM_EVEN 0x0008 /* even parity mode (Rx) */ +#define SCC_UART_PSMR_RPM_HIGH 0x000c /* high parity mode (Rx) */ +#define SCC_UART_PSMR_PEN 0x0010 /* parity enable */ +#define SCC_UART_PSMR_DRT 0x0040 /* disable Rx while Tx */ +#define SCC_UART_PSMR_SYN 0x0080 /* synchronous mode */ +#define SCC_UART_PSMR_RZS 0x0100 /* receive zero stop bits */ +#define SCC_UART_PSMR_FRZ 0x0200 /* freeze transmission */ +#define SCC_UART_PSMR_UM_NML 0x0000 /* noraml UART operation */ +#define SCC_UART_PSMR_UM_MULT_M 0x0400 /* multidrop non-auto mode */ +#define SCC_UART_PSMR_UM_MULT_A 0x0c00 /* multidrop automatic mode */ +#define SCC_UART_PSMR_CL_5BIT 0x0000 /* 5 bit character length */ +#define SCC_UART_PSMR_CL_6BIT 0x1000 /* 6 bit character length */ +#define SCC_UART_PSMR_CL_7BIT 0x2000 /* 7 bit character length */ +#define SCC_UART_PSMR_CL_8BIT 0x3000 /* 8 bit character length */ +#define SCC_UART_PSMR_SL 0x4000 /* 1 or 2 bit stop length */ +#define SCC_UART_PSMR_FLC 0x8000 /* flow control */ + +/* SCC UART Event and Mask Register definitions */ + +#define SCC_UART_SCCX_RX 0x0001 /* buffer received */ +#define SCC_UART_SCCX_TX 0x0002 /* buffer transmitted */ +#define SCC_UART_SCCX_BSY 0x0004 /* busy condition */ +#define SCC_UART_SCCX_CCR 0x0008 /* control character received */ +#define SCC_UART_SCCX_BRK_S 0x0020 /* break start */ +#define SCC_UART_SCCX_BRK_E 0x0040 /* break end */ +#define SCC_UART_SCCX_GRA 0x0080 /* graceful stop complete */ +#define SCC_UART_SCCX_IDL 0x0100 /* idle sequence stat changed */ +#define SCC_UART_SCCX_AB 0x0200 /* autobaud lock */ +#define SCC_UART_SCCX_GL_T 0x0800 /* glitch on Tx */ +#define SCC_UART_SCCX_GL_R 0x1000 /* glitch on Rx */ + +/* SCC UART Receive Buffer Descriptor definitions */ + +#define SCC_UART_RX_BD_CD 0x0001 /* carrier detect loss */ +#define SCC_UART_RX_BD_OV 0x0002 /* receiver overrun */ +#define SCC_UART_RX_BD_PR 0x0008 /* parity error */ +#define SCC_UART_RX_BD_FR 0x0010 /* framing error */ +#define SCC_UART_RX_BD_BR 0x0020 /* break received */ +#define SCC_UART_RX_BD_AM 0x0080 /* address match */ +#define SCC_UART_RX_BD_ID 0x0100 /* buf closed on IDLES */ +#define SCC_UART_RX_BD_CM 0x0200 /* continous mode */ +#define SCC_UART_RX_BD_ADDR 0x0400 /* buffer contains address */ +#define SCC_UART_RX_BD_CNT 0x0800 /* control character */ +#define SCC_UART_RX_BD_INT 0x1000 /* interrupt generated */ +#define SCC_UART_RX_BD_WRAP 0x2000 /* wrap back to first BD */ +#define SCC_UART_RX_BD_EMPTY 0x8000 /* buffer is empty */ + +/* SCC UART Transmit Buffer Descriptor definitions */ + +#define SCC_UART_TX_BD_CT 0x0001 /* cts was lost during tx */ +#define SCC_UART_TX_BD_NS 0x0080 /* no stop bit transmitted */ +#define SCC_UART_TX_BD_PREAMBLE 0x0100 /* enable preamble */ +#define SCC_UART_TX_BD_CM 0x0200 /* continous mode */ +#define SCC_UART_TX_BD_ADDR 0x0400 /* buffer contains address */ +#define SCC_UART_TX_BD_CTSR 0x0800 /* normal cts error reporting */ +#define SCC_UART_TX_BD_INT 0x1000 /* interrupt generated */ +#define SCC_UART_TX_BD_WRAP 0x2000 /* wrap back to first BD */ +#define SCC_UART_TX_BD_READY 0x8000 /* buffer is being sent */ + +/* SCC Ethernet protocol specific parameters */ + +typedef struct /* SCC_ETHER_PROTO */ + { + UINT32 c_pres; /* preset CRC */ + UINT32 c_mask; /* constant mask for CRC */ + UINT32 crcec; /* CRC error counter */ + UINT32 alec; /* alignment error counter */ + UINT32 disfc; /* discard frame counter */ + UINT16 pads; /* short frame pad value */ + UINT16 ret_lim; /* retry limit threshold */ + UINT16 ret_cnt; /* retry limit counter */ + UINT16 mflr; /* maximum frame length register */ + UINT16 minflr; /* minimum frame length register */ + UINT16 maxd1; /* max DMA1 length register */ + UINT16 maxd2; /* max DMA2 length register */ + UINT16 maxd; /* Rx max DMA */ + UINT16 dma_cnt; /* Rx DMA counter */ + UINT16 max_b; /* max BD byte count */ + UINT16 gaddr1; /* group address filter 1 */ + UINT16 gaddr2; /* group address filter 2 */ + UINT16 gaddr3; /* group address filter 3 */ + UINT16 gaddr4; /* group address filter 4 */ + UINT32 tbuf0_data0; /* save area 0 - current frame */ + UINT32 tbuf0_data1; /* save area 1 - current frame */ + UINT32 tbuf0_rba0; /* ? */ + UINT32 tbuf0_crc; /* ? */ + UINT16 tbuf0_bcnt; /* ? */ + UINT16 paddr1_h; /* physical address 1 (MSB) */ + UINT16 paddr1_m; /* physical address 1 */ + UINT16 paddr1_l; /* physical address 1 (LSB) */ + UINT16 p_per; /* persistence */ + UINT16 rfbd_ptr; /* Rx first BD pointer */ + UINT16 tfbd_ptr; /* Tx first BD pointer */ + UINT16 tlbd_ptr; /* Tx last BD pointer */ + UINT32 tbuf1_data0; /* save area 0 - next frame */ + UINT32 tbuf1_data1; /* ? */ + UINT32 tbuf1_rba0; /* ? */ + UINT32 tbuf1_crc; /* ? */ + UINT16 tbuf1_bcnt; /* ? */ + UINT16 tx_len; /* Tx frame length counter */ + UINT16 iaddr1; /* individual address filter 1 */ + UINT16 iaddr2; /* individual address filter 2 */ + UINT16 iaddr3; /* individual address filter 3 */ + UINT16 iaddr4; /* individual address filter 4 */ + UINT16 boff_cnt; /* backoff counter */ + UINT16 taddr_h; /* temp address (MSB) */ + UINT16 taddr_m; /* temp address */ + UINT16 taddr_l; /* temp address (LSB) */ + } SCC_ETHER_PROTO; + +/* SCC Ethernet Protocol Specific Mode Register definitions */ + +#define SCC_ETHER_PSMR_NIB_13 0x0000 /* SFD 13 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_14 0x0002 /* SFD 14 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_15 0x0004 /* SFD 15 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_16 0x0006 /* SFD 16 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_21 0x0008 /* SFD 21 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_22 0x000a /* SFD 22 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_23 0x000c /* SFD 23 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_24 0x000e /* SFD 24 bits after TENA */ +#define SCC_ETHER_PSMR_LCW 0x0100 /* late collision window */ +#define SCC_ETHER_PSMR_SIP 0x0200 /* sample input pins */ +#define SCC_ETHER_PSMR_LPB 0x0400 /* loopback operation */ +#define SCC_ETHER_PSMR_SBT 0x0800 /* stop backoff timer */ +#define SCC_ETHER_PSMR_BRO 0x0100 /* broadcast address */ +#define SCC_ETHER_PSMR_PRO 0x0200 /* promiscuous mode */ +#define SCC_ETHER_PSMR_CRC 0x0800 /* CRC selection */ +#define SCC_ETHER_PSMR_IAM 0x1000 /* individual address mode */ +#define SCC_ETHER_PSMR_RSH 0x2000 /* receive short frame */ +#define SCC_ETHER_PSMR_FC 0x4000 /* force collision */ +#define SCC_ETHER_PSMR_HBC 0x8000 /* heartbeat checking*/ + +/* SCC Ethernet Event and Mask Register definitions */ + +#define SCC_ETHER_SCCX_RXB 0x0001 /* buffer received event */ +#define SCC_ETHER_SCCX_TXB 0x0002 /* buffer transmitted event */ +#define SCC_ETHER_SCCX_BSY 0x0004 /* busy condition */ +#define SCC_ETHER_SCCX_RXF 0x0008 /* frame received event */ +#define SCC_ETHER_SCCX_TXE 0x0010 /* transmission error event */ +#define SCC_ETHER_SCCX_GRA 0x0080 /* graceful stop event */ + +/* SCC Ethernet Receive Buffer Descriptor definitions */ + +#define SCC_ETHER_RX_BD_CL 0x0001 /* collision condition */ +#define SCC_ETHER_RX_BD_OV 0x0002 /* overrun condition */ +#define SCC_ETHER_RX_BD_CR 0x0004 /* Rx CRC error */ +#define SCC_ETHER_RX_BD_SH 0x0008 /* short frame received */ +#define SCC_ETHER_RX_BD_NO 0x0010 /* Rx nonoctet aligned frame */ +#define SCC_ETHER_RX_BD_LG 0x0020 /* Rx frame length violation */ +#define SCC_ETHER_RX_BD_M 0x0100 /* miss bit for prom mode */ +#define SCC_ETHER_RX_BD_F 0x0400 /* buffer is first in frame */ +#define SCC_ETHER_RX_BD_L 0x0800 /* buffer is last in frame */ +#define SCC_ETHER_RX_BD_I 0x1000 /* interrupt on receive */ +#define SCC_ETHER_RX_BD_W 0x2000 /* last BD in ring */ +#define SCC_ETHER_RX_BD_E 0x8000 /* buffer is empty */ + +/* SCC Ethernet Transmit Buffer Descriptor definitions */ + +#define SCC_ETHER_TX_BD_CSL 0x0001 /* carrier sense lost */ +#define SCC_ETHER_TX_BD_UN 0x0002 /* underrun */ +#define SCC_ETHER_TX_BD_RC 0x003c /* retry count */ +#define SCC_ETHER_TX_BD_RL 0x0040 /* retransmission limit */ +#define SCC_ETHER_TX_BD_LC 0x0080 /* late collision */ +#define SCC_ETHER_TX_BD_HB 0x0100 /* heartbeat */ +#define SCC_ETHER_TX_BD_DEF 0x0200 /* defer indication */ +#define SCC_ETHER_TX_BD_TC 0x0400 /* auto transmit CRC */ +#define SCC_ETHER_TX_BD_L 0x0800 /* buffer is last in frame */ +#define SCC_ETHER_TX_BD_I 0x1000 /* interrupt on transmit */ +#define SCC_ETHER_TX_BD_W 0x2000 /* last BD in ring */ +#define SCC_ETHER_TX_BD_PAD 0x4000 /* auto pad short frames */ +#define SCC_ETHER_TX_BD_R 0x8000 /* buffer is ready */ + +/* SCC - Serial Comunications Controller */ + +typedef struct /* SCC_BUF */ + { + UINT16 statusMode; /* status and control */ + UINT16 dataLength; /* length of data buffer in bytes */ + u_char * dataPointer; /* points to data buffer */ + } SCC_BUF; + +typedef struct /* SCC_PARAM */ + { + UINT16 rbase; /* Rx buffer descriptor base address */ + UINT16 tbase; /* Tx buffer descriptor base address */ + UINT8 rfcr; /* Rx function code */ + UINT8 tfcr; /* Tx function code */ + UINT16 mrblr; /* maximum receive buffer length */ + UINT32 rstate; /* Rx internal state */ + UINT32 res1; /* reserved/internal */ + UINT16 rbptr; /* Rx buffer descriptor pointer */ + UINT16 res2; /* reserved/internal */ + UINT32 res3; /* reserved/internal */ + UINT32 tstate; /* Tx internal state */ + UINT32 res4; /* reserved/internal */ + UINT16 tbptr; /* Tx buffer descriptor pointer */ + UINT16 res5; /* reserved/internal */ + UINT32 res6; /* reserved/internal */ + UINT32 rcrc; /* temp receive CRC */ + UINT32 tcrc; /* temp transmit CRC */ + } SCC_PARAM; + +typedef struct /* SCC */ + { + SCC_PARAM param; /* SCC parameters */ + char prot[64]; /* protocol specific area */ + } SCC; + +typedef struct /* SCC_REG */ + { + UINT32 gsmrl; /* SCC general mode register - low */ + UINT32 gsmrh; /* SCC eneral mode register - high */ + UINT16 psmr; /* SCC protocol mode register */ + UINT16 res1; /* reserved */ + UINT16 todr; /* SCC transmit on demand */ + UINT16 dsr; /* SCC data sync. register */ + UINT16 scce; /* SCC event register */ + UINT16 res2; /* reserved */ + UINT16 sccm; /* SCC mask register */ + UINT8 res3; /* reserved */ + UINT8 sccs; /* SCC status register */ + } SCC_REG; + +/* SCC device descriptor */ + +typedef struct /* SCC_DEV */ + { + int sccNum; /* number of SCC device */ + int txBdNum; /* number of transmit buf descriptors */ + int rxBdNum; /* number of receive buf descriptors */ + SCC_BUF * txBdBase; /* transmit BD base address */ + SCC_BUF * rxBdBase; /* receive BD base address */ + u_char * txBufBase; /* transmit buffer base address */ + u_char * rxBufBase; /* receive buffer base address */ + UINT32 txBufSize; /* transmit buffer size */ + UINT32 rxBufSize; /* receive buffer size */ + int txBdNext; /* next transmit BD to fill */ + int rxBdNext; /* next receive BD to read */ + volatile SCC * pScc; /* SCC parameter RAM */ + volatile SCC_REG * pSccReg; /* SCC registers */ + UINT32 intMask; /* interrupt acknowledge mask */ + } SCC_DEV; + +#ifndef INCLUDE_TY_CO_DRV_50 + +/* UART SCC device descriptor */ + +typedef struct /* TY_CO_DEV */ + { + TY_DEV tyDev; /* tyLib will handle this portion */ + BOOL created; /* device has been created */ + char numChannels; /* number of channels to support */ + int clockRate; /* CPU clock frequency (Hz) */ + int bgrNum; /* number of BRG being used */ + UINT32 * pBaud; /* BRG registers */ + UINT32 regBase; /* register/DPR base address */ + SCC_DEV uart; /* UART SCC device */ + } TY_CO_DEV; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT void tyCoInt (TY_CO_DEV * pDv); + +#else /* __STDC__ */ + +IMPORT void tyCoInt (); + +#endif /* __STDC__ */ +#endif /* INCLUDE_TY_CO_DRV_50 */ +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm68360h */ diff --git a/h/drv/multi/m68562.h b/h/drv/multi/m68562.h new file mode 100644 index 0000000..c16d9a4 --- /dev/null +++ b/h/drv/multi/m68562.h @@ -0,0 +1,612 @@ +/* m68562.h - Motorola M68562 Serial I/O Chip header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01k,22sep92,rrr added support for c++ +01j,02jul92,caf added TY_CO_DEV and function declarations for 5.1 upgrade. + for 5.0.x compatibility, define INCLUDE_TY_CO_DRV_50 when + including this header. +01i,26may92,rrr the tree shuffle +01h,04oct91,rrr passed through the ansification filter + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01g,05oct90,shl added copyright notice. + made #endif ANSI style. +01f,11jun90,gae added _ASMLANGUAGE version. + simplified DUSCC macros, but kept 4.0.2 version temporarily. + fixed def'n of DUSCC_OMR_GPO1_1 to be O (oh) not 0 (zero). +01e,01mar89,jcc incorporated DUSCC_REG_ADDR_INTERVAL into definitions. +01d,28nov88,jcf change M562 to DUSCC because thats easier to remember. +01c,10aug88,gae got rid of ^L which are unloved by some assemblers. +01b,21jun88,mcl changed to be generic, not just mz7122; adds documentation. +01a,26jan88,sah written. +*/ + +#ifndef __INCm68562h +#define __INCm68562h + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The macro's DUSCC_BASE_ADRS and DUSCC_REG_INTERVAL must be defined + * when including this header. + * + * define INCLUDE_TY_CO_DRV_50 when using this header if you are using + * a VxWorks 5.0-style serial driver (tyCoDrv.c). + */ + +#ifdef _ASMLANGUAGE + +#define CAST + +#else /* _ASMLANGUAGE */ + +#define CAST (char *) + +#include "tyLib.h" + +#ifndef INCLUDE_TY_CO_DRV_50 + +typedef struct /* TY_CO_DEV */ + { + TY_DEV tyDev; + BOOL created; /* true if this device has been created */ + char numChannels; /* number of channels to support */ + volatile char * rx_data; /* receiver data port */ + volatile char * tx_data; /* transmitter data port */ + volatile char * ttr; /* transmitter timer register */ + volatile char * rtr; /* receiver timer register */ + volatile char * ier; /* interrupt enable register */ + volatile char * gsr; /* general status register */ + volatile char * rsr; /* receiver status register */ + volatile char * cmr1; + volatile char * cmr2; + volatile char * tpr; + volatile char * rpr; + volatile char * omr; + volatile char * ccr; + char rx_rdy; /* receiver ready bit */ + char tx_rdy; /* transmitter ready bit */ + } TY_CO_DEV; + +#endif /* INCLUDE_TY_CO_DRV_50 */ + +#endif /* _ASMLANGUAGE */ + +#define DUSCC_ADRS(reg) (CAST (DUSCC_BASE_ADRS+(reg*DUSCC_REG_INTERVAL))) + +/* port registers */ + +#define DUSCC_CMR1A DUSCC_ADRS(0x00) /* channel mode reg. 1 */ +#define DUSCC_CMR2A DUSCC_ADRS(0x01) /* channel mode reg. 2 */ +#define DUSCC_S1RA DUSCC_ADRS(0x02) /* secondary adrs reg1 */ +#define DUSCC_S2RA DUSCC_ADRS(0x03) /* secondary adrs reg2 */ +#define DUSCC_TPRA DUSCC_ADRS(0x04) /* tx parameter reg. */ +#define DUSCC_TTRA DUSCC_ADRS(0x05) /* tx timing reg. */ +#define DUSCC_RPRA DUSCC_ADRS(0x06) /* rx parameter reg. */ +#define DUSCC_RTRA DUSCC_ADRS(0x07) /* rx timing reg. */ +#define DUSCC_CTPRHA DUSCC_ADRS(0x08) /* counter preset high */ +#define DUSCC_CTPRLA DUSCC_ADRS(0x09) /* counter preset low */ +#define DUSCC_CTCRA DUSCC_ADRS(0x0a) /* counter control reg. */ +#define DUSCC_OMRA DUSCC_ADRS(0x0b) /* output/misc. reg. */ +#define DUSCC_CTHA DUSCC_ADRS(0x0c) /* counter/timer high */ +#define DUSCC_CTLA DUSCC_ADRS(0x0d) /* counter/timer low */ +#define DUSCC_PCRA DUSCC_ADRS(0x0e) /* pin configuration */ +#define DUSCC_CCRA DUSCC_ADRS(0x0f) /* channel command reg. */ +#define DUSCC_TXFIFOA DUSCC_ADRS(0x10) /* tx FIFO */ +#define DUSCC_RXFIFOA DUSCC_ADRS(0x14) /* rx FIFO */ +#define DUSCC_RSRA DUSCC_ADRS(0x18) /* rx status reg. */ +#define DUSCC_TRSRA DUSCC_ADRS(0x19) /* tx/rx status reg. */ +#define DUSCC_ICTSRA DUSCC_ADRS(0x1a) /* counter status reg. */ +#define DUSCC_GSR DUSCC_ADRS(0x1b) /* general status */ +#define DUSCC_IERA DUSCC_ADRS(0x1c) /* interrupt enable */ +#define DUSCC_IVR DUSCC_ADRS(0x1e) /* interrupt vector */ +#define DUSCC_ICR DUSCC_ADRS(0x1f) /* interrupt control */ +#define DUSCC_CMR1B DUSCC_ADRS(0x20) /* channel mode reg. 1 */ +#define DUSCC_CMR2B DUSCC_ADRS(0x21) /* channel mode reg. 2 */ +#define DUSCC_S1RB DUSCC_ADRS(0x22) /* secondary adrs reg 1 */ +#define DUSCC_S2RB DUSCC_ADRS(0x23) /* secondary adrs reg 2 */ +#define DUSCC_TPRB DUSCC_ADRS(0x24) /* tx parameter reg. */ +#define DUSCC_TTRB DUSCC_ADRS(0x25) /* tx timing reg. */ +#define DUSCC_RPRB DUSCC_ADRS(0x26) /* rx parameter reg. */ +#define DUSCC_RTRB DUSCC_ADRS(0x27) /* rx timing reg. */ +#define DUSCC_CTPRHB DUSCC_ADRS(0x28) /* counter preset high */ +#define DUSCC_CTPRLB DUSCC_ADRS(0x29) /* counter preset low */ +#define DUSCC_CTCRB DUSCC_ADRS(0x2a) /* counter control reg. */ +#define DUSCC_OMRB DUSCC_ADRS(0x2b) /* output/misc. reg. */ +#define DUSCC_CTHB DUSCC_ADRS(0x2c) /* counter/timer high */ +#define DUSCC_CTLB DUSCC_ADRS(0x2d) /* counter/timer low */ +#define DUSCC_PCRB DUSCC_ADRS(0x2e) /* pin configuration */ +#define DUSCC_CCRB DUSCC_ADRS(0x2f) /* channel command reg. */ +#define DUSCC_TXFIFOB DUSCC_ADRS(0x30) /* tx FIFO */ +#define DUSCC_RXFIFOB DUSCC_ADRS(0x34) /* rx FIFO */ +#define DUSCC_RSRB DUSCC_ADRS(0x38) /* rx status reg. */ +#define DUSCC_TRSRB DUSCC_ADRS(0x39) /* tx/rx status reg. */ +#define DUSCC_ICTSRB DUSCC_ADRS(0x3a) /* count/timer status */ +#define DUSCC_IERB DUSCC_ADRS(0x3c) /* interrupt enable */ +#define DUSCC_IVRM DUSCC_ADRS(0x3e) /* int. vec. modified */ + + +/* vector number offsets */ + +#define DUSCC_INT_A_RXRDY 0x00 /* RxRDY interrupt */ +#define DUSCC_INT_A_TXRDY 0x01 /* TxRDY interrupt */ +#define DUSCC_INT_A_RX_TX_ERROR 0x02 /* rx/tx error interrupt */ +#define DUSCC_INT_A_EXT 0x03 /* ext. & cnt/timer interrupt */ +#define DUSCC_INT_B_RXRDY 0x04 /* RxRDY interrupt */ +#define DUSCC_INT_B_TXRDY 0x05 /* TxRDY interrupt */ +#define DUSCC_INT_B_RX_TX_ERROR 0x06 /* rx/tx error interrupt */ +#define DUSCC_INT_B_EXT 0x07 /* ext. & cnt/timer interrupt */ + +#define N_CHANNELS 2 /* number of channels per chip */ + +/* channel mode register one (CMR1A, CMR1B) */ + +#define DUSCC_CMR1_BOP_PRIMARY 0x00 /* channel protocol mode */ +#define DUSCC_CMR1_BOP_SECONDARY 0x01 /* channel protocol mode */ +#define DUSCC_CMR1_BOP_LOOP 0x02 /* channel protocol mode */ +#define DUSCC_CMR1_BOP_LOOP_NO_ADR_CMP 0x03 /* channel protocol mode */ +#define DUSCC_CMR1_BOP_8BIT_ADRS 0x00 /* single octet address */ +#define DUSCC_CMR1_BOP_EXT_ADRS 0x08 /* extended address */ +#define DUSCC_CMR1_BOP_16BIT_ADRS 0x10 /* dual octet address */ +#define DUSCC_CMR1_BOP_16BIT_GRP_ADRS 0x18 /* dual octet adrs with group */ +#define DUSCC_CMR1_BOP_1_OCTET_CNT 0x00 /* 1 ctrl field follows adrs */ +#define DUSCC_CMR1_BOP_2_OCTET_CNT 0x20 /* 2 ctrl fields follow adrs */ + +#define DUSCC_CMR1_COP_DUAL_SYN 0x04 /* channel protocol mode */ +#define DUSCC_CMR1_COP_BISYNC 0x05 /* channel protocol mode */ +#define DUSCC_CMR1_COP_SINGLE_SYN 0x06 /* channel protocol mode */ +#define DUSCC_CMR1_COP_NO_PARITY 0x00 /* channel parity none */ +#define DUSCC_CMR1_COP_WITH_PARITY 0x10 /* channel parity odd/even */ +#define DUSCC_CMR1_COP_FORCE_PARITY 0x18 /* channel parity hi/lo */ +#define DUSCC_CMR1_COP_EVEN_PARITY 0x00 /* channel parity even */ +#define DUSCC_CMR1_COP_ODD_PARITY 0x20 /* channel parity odd */ +#define DUSCC_CMR1_COP_BISYNC_EBCDIC 0x00 /* comparisons in EBCDIC */ +#define DUSCC_CMR1_COP_BISYNC_ASCII 0x20 /* comparisons in ASCII */ + +#define DUSCC_CMR1_ASYNC 0x07 /* chnl protocol mode: async. */ + +#define DUSCC_CMR1_NRZ 0x00 /* non-return-to-zero */ +#define DUSCC_CMR1_NRZI 0x40 /* non-return-to-zero, inv */ +#define DUSCC_CMR1_FM0 0x80 /* bi-phase space */ +#define DUSCC_CMR1_FM1 0xc0 /* bi-phase mark */ + + +/* equates for channel mode register two (CMR2A, CMR2B) */ + +#define DUSCC_CMR2_FCS_SEL_NONE 0x00 /* frame check seq. select */ +#define DUSCC_CMR2_FCS_SEL_LRC_8_PRS0 0x02 /* frame check seq. select */ +#define DUSCC_CMR2_FCS_SEL_LRC_8_PRS1 0x03 /* frame check seq. select */ +#define DUSCC_CMR2_FCS_SEL_CRC_16_PRS0 0x04 /* frame check seq. select */ +#define DUSCC_CMR2_FCS_SEL_CRC_16_PRS1 0x05 /* frame check seq. select */ +#define DUSCC_CMR2_FCS_SEL_CRC_CC_PRS0 0x06 /* frame check seq. select */ +#define DUSCC_CMR2_FCS_SEL_CRC_CC_PRS1 0x07 /* frame check seq. select */ + +#define DUSCC_CMR2_DTI_HLFDUP_SADRDMA 0x00 /* data transfer interface */ +#define DUSCC_CMR2_DTI_HLFDUP_DADRDMA 0x08 /* data transfer interface */ +#define DUSCC_CMR2_DTI_FULDUP_SADRDMA 0x10 /* data transfer interface */ +#define DUSCC_CMR2_DTI_FULDUP_DADRDMA 0x18 /* data transfer interface */ +#define DUSCC_CMR2_DTI_WAIT_RX 0x20 /* data transfer interface */ +#define DUSCC_CMR2_DTI_WAIT_TX 0x28 /* data transfer interface */ +#define DUSCC_CMR2_DTI_WAIT_RX_TX 0x30 /* data transfer interface */ +#define DUSCC_CMR2_DTI_POLL_OR_INT 0x38 /* data transfer interface */ + +#define DUSCC_CMR2_CHN_CON_NORNAL 0x00 /* channel connection */ +#define DUSCC_CMR2_CHN_CON_AUTO_ECHO 0x40 /* channel connection */ +#define DUSCC_CMR2_CHN_CON_LOCAL_LOOP 0x80 /* channel connection */ + + +/* equates for transmit parameter register (TPRA, TPRB) */ + +#define DUSCC_TPR_5BITS 0x00 /* tx 5 bits per character */ +#define DUSCC_TPR_6BITS 0x01 /* tx 6 bits per character */ +#define DUSCC_TPR_7BITS 0x02 /* tx 7 bits per character */ +#define DUSCC_TPR_8BITS 0x03 /* tx 8 bits per character */ + +#define DUSCC_TPR_CTS_EN_TX_ENABLE 0x04 /* CTS_N affects tx */ + +#define DUSCC_TPR_TX_RTS_CONT_YES 0x08 /* RTS_N affected by tx */ + +#define DUSCC_TPR_ASYNC_9_16 0x00 /* async: 9/16 stop bits */ +#define DUSCC_TPR_ASYNC_10_16 0x10 /* async: 10/16 stop bits */ +#define DUSCC_TPR_ASYNC_11_16 0x20 /* async: 11/16 stop bits */ +#define DUSCC_TPR_ASYNC_12_16 0x30 /* async: 12/16 stop bits */ +#define DUSCC_TPR_ASYNC_13_16 0x40 /* async: 13/16 stop bits */ +#define DUSCC_TPR_ASYNC_14_16 0x50 /* async: 14/16 stop bits */ +#define DUSCC_TPR_ASYNC_15_16 0x60 /* async: 15/16 stop bits */ +#define DUSCC_TPR_ASYNC_1 0x70 /* async: 16/16 stop bits */ +#define DUSCC_TPR_ASYNC_1_9_16 0x80 /* async: 1 stop bit */ +#define DUSCC_TPR_ASYNC_1_10_16 0x90 /* async: 10/16 stop bits */ +#define DUSCC_TPR_ASYNC_1_11_16 0xa0 /* async: 11/16 stop bits */ +#define DUSCC_TPR_ASYNC_1_12_16 0xb0 /* async: 12/16 stop bits */ +#define DUSCC_TPR_ASYNC_1_13_16 0xc0 /* async: 13/16 stop bits */ +#define DUSCC_TPR_ASYNC_1_14_16 0xd0 /* async: 14/16 stop bits */ +#define DUSCC_TPR_ASYNC_1_15_16 0xe0 /* async: 15/16 stop bits */ +#define DUSCC_TPR_ASYNC_2 0xf0 /* async: 2 stop bits */ + +#define DUSCC_TPR_COP_TEOM_NO 0x00 /* no EOM on zero or done */ +#define DUSCC_TPR_COP_TEOM_YES 0x10 /* tx EOM on zero or done */ +#define DUSCC_TPR_COP_IDLE_MARK 0x00 /* idle in marking condition */ +#define DUSCC_TPR_COP_IDLE_SYN 0x20 /* idle sending SYNs */ +#define DUSCC_TPR_COP_UNDR_FCS 0x00 /* EOM termination */ +#define DUSCC_TPR_COP_UNDR_MARK 0x80 /* TxD in marking condition */ +#define DUSCC_TPR_COP_UNDR_SYN 0xc0 /* send SYNs */ + +#define DUSCC_TPR_BOP_TEOM_NO 0x00 /* no EOM on zero or done */ +#define DUSCC_TPR_BOP_TEOM_YES 0x10 /* tx EOM on zero or done */ +#define DUSCC_TPR_BOP_IDLE_MARK 0x00 /* idle in marking condition */ +#define DUSCC_TPR_BOP_IDLE_SYN 0x20 /* idle sending FLAGs */ +#define DUSCC_TPR_BOP_UNDR_FCS 0x00 /* EOM termination */ +#define DUSCC_TPR_BOP_UNDR_ABORT_MARK 0x80 /* TxD in marking condition */ +#define DUSCC_TPR_BOP_UNDR_ABORT_FLAG 0xc0 /* send ABORTs */ + + +/* equates for transmitter timing register (TTRA, TTRB) */ + +#define DUSCC_TTR_BAUD_50 0x00 /* transmit speed */ +#define DUSCC_TTR_BAUD_75 0x01 /* transmit speed */ +#define DUSCC_TTR_BAUD_110 0x02 /* transmit speed */ +#define DUSCC_TTR_BAUD_134_5 0x03 /* transmit speed */ +#define DUSCC_TTR_BAUD_150 0x04 /* transmit speed */ +#define DUSCC_TTR_BAUD_200 0x05 /* transmit speed */ +#define DUSCC_TTR_BAUD_300 0x06 /* transmit speed */ +#define DUSCC_TTR_BAUD_600 0x07 /* transmit speed */ +#define DUSCC_TTR_BAUD_1050 0x08 /* transmit speed */ +#define DUSCC_TTR_BAUD_1200 0x09 /* transmit speed */ +#define DUSCC_TTR_BAUD_2000 0x0a /* transmit speed */ +#define DUSCC_TTR_BAUD_2400 0x0b /* transmit speed */ +#define DUSCC_TTR_BAUD_4800 0x0c /* transmit speed */ +#define DUSCC_TTR_BAUD_9600 0x0d /* transmit speed */ +#define DUSCC_TTR_BAUD_19200 0x0e /* transmit speed */ +#define DUSCC_TTR_BAUD_38400 0x0f /* transmit speed */ + +#define DUSCC_TTR_CLK_1x_EXT 0x00 /* ext. clock, 1x baud rate */ +#define DUSCC_TTR_CLK_16x_EXT 0x10 /* ext. clock, 16x, async */ +#define DUSCC_TTR_CLK_DPLL 0x20 /* int., DPLL, half duplex */ +#define DUSCC_TTR_CLK_BRG 0x30 /* int., BRG, 32x, baud rate */ +#define DUSCC_TTR_CLK_2x_OTHER_CHAN 0x40 /* int., C/T, 2x baud rate */ +#define DUSCC_TTR_CLK_32x_OTHER_CHAN 0x50 /* int., C/T, 32x baud rate */ +#define DUSCC_TTR_CLK_2x_OWN_CHAN 0x60 /* int., C/T, 2x baud rate */ +#define DUSCC_TTR_CLK_32x_OWN_CHAN 0x70 /* int., C/T, 32x baud rate */ + +#define DUSCC_TTR_EXT_SOURCE_RTXC 0x00 /* ext. input from RTxC */ +#define DUSCC_TTR_EXT_SOURCE_TRXC 0x80 /* ext. input from TRxC */ + +/* equates for receiver parameter register (RPRA, RPRB) */ + +#define DUSCC_RPR_5BITS 0x00 /* rx 5 bits per character */ +#define DUSCC_RPR_6BITS 0x01 /* rx 6 bits per character */ +#define DUSCC_RPR_7BITS 0x02 /* rx 7 bits per character */ +#define DUSCC_RPR_8BITS 0x03 /* rx 8 bits per character */ + +#define DUSCC_RPR_DCD_EN_RX_DISABLE 0x00 /* not used to enable rx */ +#define DUSCC_RPR_DCD_EN_RX_ENABLE 0x04 /* used to enable receiver */ + +#define DUSCC_RPR_ASYNC_STRIP_PARITY_NO 0x00 /* do not strip RX parity */ +#define DUSCC_RPR_ASYNC_STRIP_PARITY_YES 0x08 /* strip RX parity */ +#define DUSCC_RPR_ASYNC_RX_RTS_CONT_NO 0x00 /* rx can't negate RTS_N */ +#define DUSCC_RPR_ASYNC_RX_RTS_CONT_YES 0x10 /* async: rx can negate RTS_N */ + +#define DUSCC_RPR_COP_STRIP_PARITY_NO 0x00 /* don't strip RX parity */ +#define DUSCC_RPR_COP_STRIP_PARITY_YES 0x08 /* strip RX parity */ +#define DUSCC_RPR_COP_EXT_SYNC_NO 0x00 /* external SYNC disable */ +#define DUSCC_RPR_COP_EXT_SYNC_YES 0x10 /* external SYNC enable */ +#define DUSCC_RPR_COP_AUTO_HUNT_NO 0x00 /* disable auto-hunt/PAD check*/ +#define DUSCC_RPR_COP_AUTO_HUNT_YES 0x20 /* enable auto-hunt/PAD check */ +#define DUSCC_RPR_COP_FCS_FIFO_NO 0x00 /* don't trans to RxFIFO */ +#define DUSCC_RPR_COP_FCS_FIFO_YES 0x40 /* trans. FCS to RxFIFO */ +#define DUSCC_RPR_COP_SYN_STRIP_LEADING 0x00 /* strip leading SYNs */ +#define DUSCC_RPR_COP_SYN_STRIP_ALL 0x80 /* strip all SYNs */ + +#define DUSCC_RPR_BOP_ALL_PARITY_ADR_NO 0x00 /* BOP: don't recognize all */ +#define DUSCC_RPR_BOP_ALL_PARITY_ADR_YES 0x08 /* BOP: recognize all parties */ +#define DUSCC_RPR_BOP_OVRUN_HUNT 0x00 /* BOP: hunt for FLAG on over */ +#define DUSCC_RPR_BOP_OVRUN_CONT 0x20 /* BOP: continue on overrun */ +#define DUSCC_RPR_BOP_FCS_FIFO_NO 0x00 /* BOP: don't trans. FCS */ +#define DUSCC_RPR_BOP_FCS_FIFO_YES 0x40 /* BOP: trans. FCS to RxFIFO */ + +/* equates for receiver timing register (RTRA, RTRB) */ + +#define DUSCC_RTR_BAUD_50 0x00 /* receiver speed */ +#define DUSCC_RTR_BAUD_75 0x01 /* receiver speed */ +#define DUSCC_RTR_BAUD_110 0x02 /* receiver speed */ +#define DUSCC_RTR_BAUD_134_5 0x03 /* receiver speed */ +#define DUSCC_RTR_BAUD_150 0x04 /* receiver speed */ +#define DUSCC_RTR_BAUD_200 0x05 /* receiver speed */ +#define DUSCC_RTR_BAUD_300 0x06 /* receiver speed */ +#define DUSCC_RTR_BAUD_600 0x07 /* receiver speed */ +#define DUSCC_RTR_BAUD_1050 0x08 /* receiver speed */ +#define DUSCC_RTR_BAUD_1200 0x09 /* receiver speed */ +#define DUSCC_RTR_BAUD_2000 0x0a /* receiver speed */ +#define DUSCC_RTR_BAUD_2400 0x0b /* receiver speed */ +#define DUSCC_RTR_BAUD_4800 0x0c /* receiver speed */ +#define DUSCC_RTR_BAUD_9600 0x0d /* receiver speed */ +#define DUSCC_RTR_BAUD_19200 0x0e /* receiver speed */ +#define DUSCC_RTR_BAUD_38400 0x0f /* receiver speed */ + +#define DUSCC_RTR_CLK_1x_EXT 0x00 /* ext. clock, 1x */ +#define DUSCC_RTR_CLK_16x_EXT 0x10 /* ext. clock, 16x, async */ +#define DUSCC_RTR_CLK_BRG 0x20 /* int. BRG clock, 32x, async */ +#define DUSCC_RTR_CLK_CT 0x30 /* int. C/T clock, 32x, async */ +#define DUSCC_RTR_CLK_DPLL_64x 0x40 /* int. clock, 64x */ +#define DUSCC_RTR_CK_DPLL_32x_EXT 0x50 /* ext. clock, 32x baud */ +#define DUSCC_RTR_CK_DPLL_32x_BRG 0x60 /* int. BRG clock, 32x baud */ +#define DUSCC_RTR_CK_DPLL_32x_CT 0x70 /* int. C/T clock, 32x baud */ + +#define DUSCC_RTR_EXT_SOURCE_RTXC 0x00 /* external input from RTxC */ +#define DUSCC_RTR_EXT_SOURCE_TRXC 0x80 /* external input from TRxC */ + +/* equates for counter/timer control register (CTCRA, CTCRB) */ + +#define DUSCC_CTCR_CLK_RTXC 0x00 /* clock source is RTxC pin */ +#define DUSCC_CTCR_CLK_TRXC 0x01 /* clock source is TRxC pin */ +#define DUSCC_CTCR_CLK_X1_CLK 0x02 /* clock source is clock/4 */ +#define DUSCC_CTCR_CLK_X1_CLK_RXD 0x03 /* clk is clk/4 gated by RxD */ +#define DUSCC_CTCR_CLK_RX_BRG 0x04 /* clock source is BRG */ +#define DUSCC_CTCR_CLK_TX_BRG 0x05 /* clock source is BRG */ +#define DUSCC_CTCR_CLK_RX_CHAR 0x06 /* clock source is rxload */ +#define DUSCC_CTCR_CLK_TX_CHAR 0x07 /* clock source is txload */ + +#define DUSCC_CTCR_PRESCALER_DIV_1 0x00 /* prescale by 1 */ +#define DUSCC_CTCR_PRESCALER_DIV_16 0x08 /* prescale by 16 */ +#define DUSCC_CTCR_PRESCALER_DIV_32 0x10 /* prescale by 32 */ +#define DUSCC_CTCR_PRESCALER_DIV_64 0x18 /* prescale by 64 */ + +#define DUSCC_CTCR_OUTPUT_CONT_SQUARE 0x00 /* count roll toggles output */ +#define DUSCC_CTCR_OUTPUT_CONT_PULSE 0x20 /* counter roll pulses output */ + +#define DUSCC_CTCR_ZERO_DET_CONT_PRESET 0x00 /* counter is preset to value */ +#define DUSCC_CTCR_ZERO_DET_CONT_CONT 0x40 /* counter is preset to -1 */ + +#define DUSCC_CTCR_ZERO_DET_INTR_DISABLE 0x00 /* disable zero detect int. */ +#define DUSCC_CTCR_ZERO_DET_INTR_ENABLE 0x80 /* enable zero detect int. */ + +/* equates for output and miscellaneous register (OMRA, OMRB) */ + +#define DUSCC_OMR_RTS_0 0x00 /* request-to-send lo */ +#define DUSCC_OMR_RTS_1 0x01 /* request-to-send hi */ + +#define DUSCC_OMR_GPO1_0 0x00 /* gen. purpose output 1 lo */ +#define DUSCC_OMR_GPO1_1 0x02 /* gen. purpose output 1 hi */ + +#define DUSCC_OMR_GPO2_0 0x00 /* gen. purpose output 2 lo */ +#define DUSCC_OMR_GPO2_1 0x04 /* gen. purpose output 2 hi */ + +#define DUSCC_OMR_RXRDY_FIFO_NOT_EMPTY 0x00 /* set TxRDY until FIFO empty */ +#define DUSCC_OMR_RXRDY_FIFO_FULL 0x08 /* set TxRDY if FIFO full */ + +#define DUSCC_OMR_TXRDY_FIFO_NOT_FULL 0x00 /* set TxRDY until FIFO full */ +#define DUSCC_OMR_TXRDY_FIFO_EMPTY 0x10 /* set TxRDY if FIFO empty */ + +#define DUSCC_OMR_TX_RES_CHAR_LENGTH_1 0x00 /* BOP: last char is 1 bits */ +#define DUSCC_OMR_TX_RES_CHAR_LENGTH_2 0x20 /* BOP: last char is 2 bits */ +#define DUSCC_OMR_TX_RES_CHAR_LENGTH_3 0x40 /* BOP: last char is 3 bits */ +#define DUSCC_OMR_TX_RES_CHAR_LENGTH_4 0x60 /* BOP: last char is 4 bits */ +#define DUSCC_OMR_TX_RES_CHAR_LENGTH_5 0x80 /* BOP: last char is 5 bits */ +#define DUSCC_OMR_TX_RES_CHAR_LENGTH_6 0xa0 /* BOP: last char is 6 bits */ +#define DUSCC_OMR_TX_RES_CHAR_LENGTH_7 0xc0 /* BOP: last char is 7 bits */ +#define DUSCC_OMR_TX_RES_CHAR_LENGTH_TPR 0xe0 /* BOP: last is TPR[1:0] bits */ + + +/* equates for pin configuration register (PCRA, PCRB) */ + +#define DUSCC_PCR_TRXC_INPUT 0x00 /* TRxC function: input */ +#define DUSCC_PCR_TRXC_XTAL_2 0x01 /* TRxC function: XTAL/2 */ +#define DUSCC_PCR_TRXC_DPLL 0x02 /* TRxC function: DPLL output */ +#define DUSCC_PCR_TRXC_CT 0x03 /* TRxC function: count/timer */ +#define DUSCC_PCR_TRXC_TXCLK_16x 0x04 /* TRxC function: TTRx16 */ +#define DUSCC_PCR_TRXC_RXCLK_16x 0x05 /* TRxC function: RTRx16 */ +#define DUSCC_PCR_TRXC_TXCLK_1x 0x06 /* TRxC function: TXC output */ +#define DUSCC_PCR_TRXC_RXCLK_1x 0x07 /* TRxC function: RXC output */ + +#define DUSCC_PCR_RTXC_INPUT 0x00 /* RTxC function: input */ +#define DUSCC_PCR_RTXC_CT 0x08 /* RTxC function: count/timer */ +#define DUSCC_PCR_RTXC_TXCLK_1x 0x10 /* RTxC function: TXC output */ +#define DUSCC_PCR_RTXC_RXCLK_1x 0x18 /* RTxC function: RXC output */ + +#define DUSCC_PCR_SYNOUT_RTS_SYNOUT 0x00 /* RTS is a SYNOUT */ +#define DUSCC_PCR_SYNOUT_RTS_RTS 0x20 /* RTS is an RTS */ + +#define DUSCC_PCR_GPO2_RTS_GPO2 0x00 /* GPO2 is a GPO2 */ +#define DUSCC_PCR_GPO2_RTS_RTS 0x40 /* GPO2 is an RTS */ + +#define DUSCC_PCR_X2_IDC_X2 0x00 /* X2 is crystal connection */ +#define DUSCC_PCR_X2_IDC_IDC 0x80 /* X2 is int. daisy chain */ + +/* equates for channel command register (CCRA, CCRB) commands */ + +#define DUSCC_CCR_TX_RESET_TX 0x00 /* reset transmitter */ +#define DUSCC_CCR_TX_RESET_TXCRC 0x01 /* reset transmit CRC */ +#define DUSCC_CCR_TX_ENABLE_TX 0x02 /* enable transmitter */ +#define DUSCC_CCR_TX_DISABLE_TX 0x03 /* disable transmitter */ +#define DUSCC_CCR_TX_TX_TSOM 0x04 /* transmit start of message */ +#define DUSCC_CCR_TX_TX_TSOMP 0x05 /* tx start of msg with pad */ +#define DUSCC_CCR_TX_TX_TEOM 0x06 /* transmit end-of-message */ +#define DUSCC_CCR_TX_TX_TABRK 0x07 /* transmit async break */ +#define DUSCC_CCR_TX_TX_TABORT 0x07 /* transmit BOP abort */ +#define DUSCC_CCR_TX_TX_DLE 0x08 /* transmit DLE */ +#define DUSCC_CCR_TX_ACT_ON_POLL 0x09 /* go active on poll */ +#define DUSCC_CCR_TX_RESET_ON_POLL 0x0a /* reset go active on poll */ +#define DUSCC_CCR_TX_GO_ON_LOOP 0x0b /* go on-loop */ +#define DUSCC_CCR_TX_GO_OFF_LOOP 0x0c /* go off-loop */ +#define DUSCC_CCR_TX_EXCLD_CRC 0x0d /* exclude from CRC */ + +#define DUSCC_CCR_RX_RESET_RX 0x40 /* reset receiver */ +#define DUSCC_CCR_RX_ENABLE_RX 0x42 /* enable receiver */ +#define DUSCC_CCR_RX_DISABLE_RX 0x43 /* disable receiver */ + +#define DUSCC_CCR_CT_START 0x80 /* start counter/timer */ +#define DUSCC_CCR_CT_STOP 0x81 /* stop counter/timer */ +#define DUSCC_CCR_CT_PRE_FFFF 0x82 /* preset counter/timer to -1 */ +#define DUSCC_CCR_CT_PRE_CTPRHL 0x83 /* counter/timer CTPRH/CTPRL */ + +#define DUSCC_CCR_DPLL_ENTR_SEARCH 0xc0 /* DPLL: enter search mode */ +#define DUSCC_CCR_DPLL_DISABLE_DPLL 0xc1 /* DPLL: disable */ +#define DUSCC_CCR_DPLL_SET_FM 0xc2 /* DPLL: set FM mode */ +#define DUSCC_CCR_DPLL_SET_NRZ1 0xc3 /* DPLL: set NRZI mode */ + +/* equates for receiver status register (RSRA, RSRB) */ + +#define DUSCC_RSR_ASYNC_PARITY_ERROR 0x01 /* parity error detected */ +#define DUSCC_RSR_ASYNC_FRAMING_ERR 0x02 /* framing error detected */ +#define DUSCC_RSR_ASYNC_BRK_STR_DET 0x04 /* break start detected */ +#define DUSCC_RSR_ASYNC_BRK_END_DET 0x08 /* break detected */ +#define DUSCC_RSR_ASYNC_OVERN_ERROR 0x20 /* overrun error */ +#define DUSCC_RSR_ASYNC_RTS_NEGATED 0x40 /* RTS negated when FIFO full */ +#define DUSCC_RSR_ASYNC_CHAR_COMP 0x80 /* character compared to S1R */ + +#define DUSCC_RSR_COP_PARITY_ERROR 0x01 /* parity error detected */ +#define DUSCC_RSR_COP_CRC_ERROR 0x02 /* CRC error detected */ +#define DUSCC_RSR_COP_SYN_DETET 0x04 /* SYN detected */ +#define DUSCC_RSR_COP_OVERN_ERROR 0x20 /* overrun error */ +#define DUSCC_RSR_COP_PAD_ERROR 0x40 /* PAD error detected */ +#define DUSCC_RSR_COP_EOM_DETET 0x80 /* end-of-message detected */ + +#define DUSCC_RSR_BOP_RCL_NOT_ZERO 0x01 /* non-zero character len. */ +#define DUSCC_RSR_BOP_FCS_ERROR 0x02 /* FCS error detected */ +#define DUSCC_RSR_BOP_FLAG_DETECT 0x04 /* FLAG sequence detected */ +#define DUSCC_RSR_BOP_IDLE_DETECT 0x08 /* idle sequence detected */ +#define DUSCC_RSR_BOP_SHORT_FRAM_DET 0x10 /* missing fields */ +#define DUSCC_RSR_BOP_OVERN_ERROR 0x20 /* overrun error */ +#define DUSCC_RSR_BOP_ABORT_DETECT 0x40 /* abort sequence detected */ +#define DUSCC_RSR_BOP_EOM_DETECT 0x80 /* end-of-message detected */ + +#define DUSCC_RSR_BOP_LOOP_RCL_NOT_ZERO 0x01 /* non-zero char len. */ +#define DUSCC_RSR_BOP_LOOP_FCS_ERROR 0x02 /* FCS error */ +#define DUSCC_RSR_BOP_LOOP_FLAG_DETECT 0x04 /* FLAG sequence */ +#define DUSCC_RSR_BOP_LOOP_TURN_DETECT 0x08 /* turnaround seq. */ +#define DUSCC_RSR_BOP_LOOP_SHORT_FRAM_DET 0x10 /* missing fields */ +#define DUSCC_RSR_BOP_LOOP_OVERN_ERROR 0x20 /* overrun error */ +#define DUSCC_RSR_BOP_LOOP_ABORT_DETECT 0x40 /* abort sequence */ +#define DUSCC_RSR_BOP_LOOP_EOM_DETECT 0x80 /* end-of-message */ + +/* equates for transmitter and receiver status register (TRSRA, TRSRB) */ + +#define DUSCC_TRSR_ASYNC_DPLL_ERROR 0x08 /* async: DPLL lost lock */ +#define DUSCC_TRSR_ASYNC_SND_BRK_ACK 0x10 /* async: transmitting break */ +#define DUSCC_TRSR_ASYNC_CTS_UNDERRUN 0x40 /* async: CTS underrun */ +#define DUSCC_TRSR_ASYNC_TX_EMPTY 0x80 /* async: transmit empty */ + +#define DUSCC_TRSR_COP_RX_XPRNT 0x01 /* COP: rx in transparent mode*/ +#define DUSCC_TRSR_COP_RX_HUNT 0x02 /* COP: rx hunting for SYN */ +#define DUSCC_TRSR_COP_DPLL_ERROR 0x08 /* COP: DPLL lost lock */ +#define DUSCC_TRSR_COP_SND_ACK 0x10 /* COP: xmit now sending ACK */ +#define DUSCC_TRSR_COP_FRAME_COMP 0x20 /* COP: end of message */ +#define DUSCC_TRSR_COP_CTS_UNDERRUN 0x40 /* COP: CTS underrun */ +#define DUSCC_TRSR_COP_TX_EMPTY 0x80 /* COP: transmit empty */ + +#define DUSCC_TRSR_BOP_RESDL_RX_0BIT 0x00 /* BOP: received residual len */ +#define DUSCC_TRSR_BOP_RESDL_RX_1BIT 0x01 /* BOP: received residual len */ +#define DUSCC_TRSR_BOP_RESDL_RX_2BIT 0x02 /* BOP: received residual len */ +#define DUSCC_TRSR_BOP_RESDL_RX_3BIT 0x03 /* BOP: received residual len */ +#define DUSCC_TRSR_BOP_RESDL_RX_4BIT 0x04 /* BOP: received residual len */ +#define DUSCC_TRSR_BOP_RESDL_RX_5BIT 0x05 /* BOP: received residual len */ +#define DUSCC_TRSR_BOP_RESDL_RX_6BIT 0x06 /* BOP: received residual len */ +#define DUSCC_TRSR_BOP_RESDL_RX_7BIT 0x07 /* BOP: received residual len */ + +#define DUSCC_TRSR_BOP_DPLL_ERROR 0x08 /* BOP: DPLL lost lock */ +#define DUSCC_TRSR_BOP_SND_ABRT_ACK 0x10 /* BOP: tx now sending ABORT */ +#define DUSCC_TRSR_BOP_FRAME_COMPLETE 0x20 /* BOP: end of msg */ +#define DUSCC_TRSR_BOP_CTS_UNDERRUN 0x40 /* BOP: CTS underrun */ +#define DUSCC_TRSR_BOP_TX_EMPTY 0x80 /* BOP: transmit empty */ + +#define DUSCC_TRSR_LOOP_LOOP_SND 0x40 /* LOOP: EOP sequence found */ + + +/* equates for input and counter/timer status register (ICTSRA, ICTSRB) */ + +#define DUSCC_ICTSR_GPI1 0x01 /* state of GPI1 pin */ +#define DUSCC_ICTSR_GPI2 0x02 /* state of GPI2 pin */ +#define DUSCC_ICTSR_CTSLC 0x04 /* state of CTLSC pin */ +#define DUSCC_ICTSR_DCD 0x08 /* state of DCD pin */ + +#define DUSCC_ICTSR_DELTA_CTSLC 0x10 /* CTS/LC changed */ +#define DUSCC_ICTSR_DELTA_DCD 0x20 /* DCD changed */ +#define DUSCC_ICTSR_CT_ZERO_COUNT 0x40 /* 1 = zero detected */ +#define DUSCC_ICTSR_CT_RUNNING 0x80 /* counter/timer is running */ + + +/* equates for general status register (GSR) */ + +#define DUSCC_GSR_A_RXRDY 0x01 /* received a character on A */ +#define DUSCC_GSR_A_TXRDY 0x02 /* ready to tx character on A */ +#define DUSCC_GSR_A_RXTX_STATUS 0x04 /* RSRA[7:0], TRSRA[7:3] */ +#define DUSCC_GSR_A_EXTERNAL_STATUS 0x08 /* refer to ICTSRA[6:4] */ +#define DUSCC_GSR_A_ALL 0x0f /* mask for above */ + +#define DUSCC_GSR_B_RXRDY 0x10 /* received a character on B */ +#define DUSCC_GSR_B_TXRDY 0x20 /* ready to tx character on B */ +#define DUSCC_GSR_B_RXTX_STATUS 0x40 /* RSRB[7:0], TRSRB[7:3] */ +#define DUSCC_GSR_B_EXTERNAL_STATUS 0x80 /* refer to ICTSRB[6:4] */ +#define DUSCC_GSR_B_ALL 0xf0 /* mask for above */ + +/* equates for interrupt enable register (IERA, IERB) */ + +#define DUSCC_IER_RSR_1_0 0x01 /* interrupt if RSR [0 or 1] */ +#define DUSCC_IER_RSR_3_2 0x02 /* interrupt if RSR [2 or 3] */ +#define DUSCC_IER_RSR_5_4 0x04 /* interrupt if RSR [4 or 5] */ +#define DUSCC_IER_RSR_7_6 0x08 /* interrupt if RSR [6 or 7] */ + +#define DUSCC_IER_RXRDY 0x10 /* interrupt if RxRDY */ +#define DUSCC_IER_TRSR 0x20 /* interrupt if TRSR bits 3-7 */ +#define DUSCC_IER_TXRDY 0x40 /* interrupt if TxRDY */ +#define DUSCC_IER_DCD_CTS 0x80 /* interrupt if DCD or CTS */ + + +/* equates for interrupt control register (ICR) */ + +#define DUSCC_ICR_CHAN_B_MAST_INT_EN 0x01 /* chnl B master int. enable */ +#define DUSCC_ICR_CHAN_A_MAST_INT_EN 0x02 /* chnl A master int. enable */ + +#define DUSCC_ICR_VECT_INCLDS_STATUS 0x04 /* 1 = use IVRM, 0 = use IVR */ + +#define DUSCC_ICR_BITS_MOD_2_0 0x00 /* modify vector bits 2:0 */ +#define DUSCC_ICR_BITS_MOD_4_2 0x08 /* modify vector bits 4:2 */ + +#define DUSCC_ICR_VECT_MODE_VECT 0x00 /* interrupts are vectored */ +#define DUSCC_ICR_VECT_MODE_NOT_VECT 0x30 /* interrupts non-vectored */ + +#define DUSCC_ICR_CHN_AB_INT_PRI_A 0x00 /* channel A highest priority */ +#define DUSCC_ICR_CHN_AB_INT_PRI_B 0x40 /* interleaved pri, A favored */ +#define DUSCC_ICR_CHN_AB_INT_PRI_INTL_A 0x80 /* channel B highest priority */ +#define DUSCC_ICR_CHN_AB_INT_PRI_INTL_B 0xc0 /* interleaved pri, B favored */ + + +/* equates for interrupt vector - as modified by IVRM */ + +#define DUSCC_IVRM_MASK 0x07 /* bits that can be modified */ +#define DUSCC_IVRM_MASK_CHANNEL 0x04 /* 1 = chnl B, 0 = chnl A */ +#define DUSCC_IVRM_RXRDY 0x00 /* RxRDY interrupt */ +#define DUSCC_IVRM_TXRDY 0x01 /* TxRDY interrupt */ +#define DUSCC_IVRM_RX_TX_EXCEPTION 0x02 /* rx/tx error interrupt */ +#define DUSCC_IVRM_EXTERN_OR_CT 0x03 /* ext. & cnt/timer interrupt */ + +/* function declarations */ + +#ifndef INCLUDE_TY_CO_DRV_50 +#ifndef _ASMLANGUAGE +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT void tyCoTxInt (FAST TY_CO_DEV * pTyCoDv); +IMPORT void tyCoRxInt (FAST TY_CO_DEV * pTyCoDv); +IMPORT void tyCoRxTxErrInt (FAST TY_CO_DEV * pTyCoDv); + +#else /* __STDC__ */ + +IMPORT void tyCoTxInt (); +IMPORT void tyCoRxInt (); +IMPORT void tyCoRxTxErrInt (); + +#endif /* __STDC__ */ +#endif /* _ASMLANGUAGE */ +#endif /* INCLUDE_TY_CO_DRV_50 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm68562h */ diff --git a/h/drv/multi/m68681.h b/h/drv/multi/m68681.h new file mode 100644 index 0000000..25eec19 --- /dev/null +++ b/h/drv/multi/m68681.h @@ -0,0 +1,254 @@ +/* m68681.h - Motorola M68681 serial chip header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01h,22sep92,rrr added support for c++ +01g,14aug92,caf added TY_CO_DEV and function declarations for 5.1 upgrade. + for 5.0.x compatibility, define INCLUDE_TY_CO_DRV_50 when + including this header. +01f,26may92,rrr the tree shuffle +01e,04oct91,rrr passed through the ansification filter + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01d,05oct90,shl added copyright notice. + made #endif ANSI style. +01c,10sep89,rld added DUART registers. +01b,30apr88,gae added definition INCm68681h. +01a,06jan88,miz written for Mizar Digital Systems. +*/ + +/* +This file contains constants for the Motorola M68681 serial chip. + +The constants DUART_REG_OFFSET and SIO must defined when +including this header file. +*/ + +#ifndef __INCm68681h +#define __INCm68681h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE +#ifndef INCLUDE_TY_CO_DRV_50 + +#include "tyLib.h" + +typedef struct /* TY_CO_DEV */ + { + TY_DEV tyDev; + BOOL created; /* true if this device has really been created */ + char numChannels; /* number of channels to support */ + char *dr; /* data port */ + char *csr; /* clock select register */ + char *cr; /* control register */ + char *sopbc; /* set ouput port bits register */ + char *isr; /* interrupt status register */ + char *mr; /* mode register */ + char *imr; /* interrupt mask register */ + char *ctlr; /* counter timer lower register */ + char *ctur; /* counter timer upper register */ + char *acr; /* auxiliary control register */ + char *ctron; /* counter on */ + char *ctroff; /* counter off */ + char *kimr; /* keep current interrupt mask register value */ + char rem; /* bit for receive-enable mask */ + char tem; /* bit for transmit-enable mask */ + VOIDFUNCPTR tickRtn; /* timer ISR (NULL if none) */ + } TY_CO_DEV; + +#endif /* INCLUDE_TY_CO_DRV_50 */ +#endif /* _ASMLANGUAGE */ + +#define N_CHANNELS 2 /* number of serial channels on chip */ + +#ifdef _ASMLANGUAGE +#define SIO_ADRS(reg) (SIO + (reg * DUART_REG_OFFSET)) +#else +#define SIO_ADRS(reg) ((char *) SIO + (reg * DUART_REG_OFFSET)) +#endif /* _ASMLANGUAGE */ + +/* SIO -- m68681 serial channel chip -- register definitions */ + +#define DUART_MRA SIO_ADRS(0x00) /* mode reg. A */ +#define DUART_CSRA SIO_ADRS(0x01) /* clock select reg. A */ +#define DUART_SRA DUART_CSRA /* status reg. A */ +#define DUART_CRA SIO_ADRS(0x02) /* command reg. A */ +#define DUART_THRA SIO_ADRS(0x03) /* transmit buffer A */ +#define DUART_RHRA DUART_THRA /* receive buffer A */ +#define DUART_ACR SIO_ADRS(0x04) /* auxiliary control reg. */ +#define DUART_IPCR DUART_ACR /* input port change reg. */ +#define DUART_IMR SIO_ADRS(0x05) /* int. mask reg. */ +#define DUART_ISR DUART_IMR /* int. status reg. */ +#define DUART_CTUR SIO_ADRS(0x06) /* counter timer upper reg. */ +#define DUART_CTLR SIO_ADRS(0x07) /* counter timer lower reg. */ +#define DUART_MRB SIO_ADRS(0x08) /* mode reg. B */ +#define DUART_CSRB SIO_ADRS(0x09) /* clock select reg. B */ +#define DUART_SRB DUART_CSRB /* status reg. B */ +#define DUART_CRB SIO_ADRS(0x0a) /* command reg. B */ +#define DUART_THRB SIO_ADRS(0x0b) /* transmit buffer B */ +#define DUART_RHRB DUART_THRB /* receive buffer B */ +#define DUART_IVR SIO_ADRS(0x0c) /* int. vector reg. */ +#define DUART_OPCR SIO_ADRS(0x0d) /* output port config. reg. */ +#define DUART_IP DUART_OPCR /* input port */ +#define DUART_SOPBC SIO_ADRS(0x0e) /* set output port bits */ +#define DUART_CTRON DUART_SOPBC /* counter on */ +#define DUART_ROPBC SIO_ADRS(0x0f) /* reset output port bits */ +#define DUART_CTROFF DUART_ROPBC /* counter off */ + +/* equates for mode reg. A or B, mode 1 */ +#define RX_RTS 0x80 /* 0 = no, 1 = yes */ +#define RX_INT 0x40 /* 0 = RxRDY, 1 = FFULL */ +#define ERR_MODE 0x20 /* 0 = char, 1 = block */ +#define PAR_MODE_MULTI 0x18 /* multi_drop mode */ +#define PAR_MODE_NO 0x10 /* no parity mode */ +#define PAR_MODE_FORCE 0x08 /* force parity mode */ +#define PAR_MODE_YES 0x00 /* parity mode */ +#define PARITY_TYPE 0x04 /* 0 = even, 1 = odd */ +#define BITS_CHAR_8 0x03 /* 8 bits */ +#define BITS_CHAR_7 0x02 /* 7 bits */ +#define BITS_CHAR_6 0x01 /* 6 bits */ +#define BITS_CHAR_5 0x00 /* 5 bits */ +/* equates for mode reg. A or B, mode 2 */ +#define CHAN_MODE_RL 0xc0 /* remote loop */ +#define CHAN_MODE_LL 0x80 /* local loop */ +#define CHAN_MODE_AECHO 0x40 /* auto echo */ +#define CHAN_MODE_NORM 0x00 /* normal */ +#define TX_RTS 0x20 /* 0 = no, 1 = yes */ +#define CTS_ENABLE 0x10 /* 0 = no, 1 = yes */ +#define STOP_BITS_2 0x0f /* 2 */ +#define STOP_BITS_1 0x07 /* 1 */ +/* equates for clock select reg. A or B */ +#define RX_CLK_SEL 0xf0 /* receiver clock select */ +#define RX_CLK_19200 0xc0 /* 19200 */ +#define RX_CLK_9600 0xb0 /* 9600 */ +#define RX_CLK_1800 0xa0 /* 1800 */ +#define RX_CLK_4800 0x90 /* 4800 */ +#define RX_CLK_2400 0x80 /* 2400 */ +#define RX_CLK_2000 0x70 /* 2000 */ +#define RX_CLK_1200 0x60 /* 1200 */ +#define RX_CLK_600 0x50 /* 600 */ +#define RX_CLK_300 0x40 /* 300 */ +#define RX_CLK_150 0x30 /* 150 */ +#define RX_CLK_134_5 0x20 /* 134.5 */ +#define RX_CLK_110 0x10 /* 110 */ +#define RX_CLK_75 0x00 /* 75 */ +#define TX_CLK_SEL 0x0f /* transmitter clock select */ +#define TX_CLK_19200 0x0c /* 19200 */ +#define TX_CLK_9600 0x0b /* 9600 */ +#define TX_CLK_1800 0x0a /* 1800 */ +#define TX_CLK_4800 0x09 /* 4800 */ +#define TX_CLK_2400 0x08 /* 2400 */ +#define TX_CLK_2000 0x07 /* 2000 */ +#define TX_CLK_1200 0x06 /* 1200 */ +#define TX_CLK_600 0x05 /* 600 */ +#define TX_CLK_300 0x04 /* 300 */ +#define TX_CLK_150 0x03 /* 150 */ +#define TX_CLK_134_5 0x02 /* 134.5 */ +#define TX_CLK_110 0x01 /* 110 */ +#define TX_CLK_75 0x00 /* 75 */ +/* equates for status reg. A or B */ +#define RXD_BREAK 0x80 /* 0 = no, 1 = yes */ +#define FRAMING_ERR 0x40 /* 0 = no, 1 = yes */ +#define PARITY_ERR 0x20 /* 0 = no, 1 = yes */ +#define OVERRUN_ERR 0x10 /* 0 = no, 1 = yes */ +#define TXENT 0x08 /* 0 = no, 1 = yes */ +#define TXRDY 0x04 /* 0 = no, 1 = yes */ +#define FFULL 0x02 /* 0 = no, 1 = yes */ +#define RXRDY 0x01 /* 0 = no, 1 = yes */ +/* equates for command reg. A or B */ +/* miscellaneous commands: 0x70 */ +#define STP_BREAK_CMD 0x70 /* stop break command */ +#define STR_BREAK_CMD 0x60 /* start break command */ +#define RST_BRK_INT_CMD 0x50 /* reset break int. command */ +#define RST_ERR_STS_CMD 0x40 /* reset error status command */ +#define RST_TX_CMD 0x30 /* reset transmitter command */ +#define RST_RX_CMD 0x20 /* reset receiver command */ +#define RST_MR_PTR_CMD 0x10 /* reset mr pointer command */ +#define NO_COMMAND 0x00 /* no command */ +#define TX_DISABLE 0x08 /* 0 = no, 1 = yes */ +#define TX_ENABLE 0x04 /* 0 = no, 1 = yes */ +#define RX_DISABLE 0x02 /* 0 = no, 1 = yes */ +#define RX_ENABLE 0x01 /* 0 = no, 1 = yes */ +/* equates for auxiliary control reg. (timer and counter clock selects) */ +#define BRG_SELECT 0x80 /* baud rate generator select */ + /* 0 = set 1; 1 = set 2 */ + /* NOTE above equates are set 2 ONLY */ +#define TMR_EXT_CLK_16 0x70 /* external clock divided by 16 */ +#define TMR_EXT_CLK 0x60 /* external clock */ +#define TMR_IP2_16 0x50 /* ip2 divided by 16 */ +#define TMR_IP2 0x40 /* ip2 */ +#define CTR_EXT_CLK_16 0x30 /* external clock divided by 16 */ +#define CTR_TXCB 0x20 /* channel B transmitter clock */ +#define CTR_TXCA 0x10 /* channel A transmitter clock */ +#define CTR_IP2 0x00 /* ip2 */ +#define DELTA_IP3_INT 0x08 /* delta ip3 int. */ +#define DELTA_IP2_INT 0x04 /* delta ip2 int. */ +#define DELTA_IP1_INT 0x02 /* delta ip1 int. */ +#define DELTA_IP0_INT 0x01 /* delta ip0 int. */ +/* equates for input port change reg. */ +#define DELTA_IP3 0x80 /* 0 = no, 1 = yes */ +#define DELTA_IP2 0x40 /* 0 = no, 1 = yes */ +#define DELTA_IP1 0x20 /* 0 = no, 1 = yes */ +#define DELTA_IP0 0x10 /* 0 = no, 1 = yes */ +#define IP3 0x08 /* 0 = low, 1 = high */ +#define IP2 0x04 /* 0 = low, 1 = high */ +#define IP1 0x02 /* 0 = low, 1 = high */ +#define IP0 0x01 /* 0 = low, 1 = high */ +/* equates for int. mask reg. */ +#define INPUT_DELTA_INT 0x80 /* 0 = off, 1 = on */ +#define BREAK_B_INT 0x40 /* 0 = off, 1 = on */ +#define RX_RDY_B_INT 0x20 /* 0 = off, 1 = on */ +#define TX_RDY_B_INT 0x10 /* 0 = off, 1 = on */ +#define CTR_RDY_INT 0x08 /* 0 = off, 1 = on */ +#define BREAK_A_INT 0x04 /* 0 = off, 1 = on */ +#define RX_RDY_A_INT 0x02 /* 0 = off, 1 = on */ +#define TX_RDY_A_INT 0x01 /* 0 = off, 1 = on */ +/* equates for int. status reg. */ +#define INPUT_DELTA 0x80 /* 0 = no, 1 = yes */ +#define BREAK_B 0x40 /* 0 = no, 1 = yes */ +#define RX_RDY_B 0x20 /* 0 = no, 1 = yes */ +#define TX_RDY_B 0x10 /* 0 = no, 1 = yes */ +#define CTR_RDY 0x08 /* 0 = no, 1 = yes */ +#define BREAK_A 0x04 /* 0 = no, 1 = yes */ +#define RX_RDY_A 0x02 /* 0 = no, 1 = yes */ +#define TX_RDY_A 0x01 /* 0 = no, 1 = yes */ +/* equates for output port config. reg. */ +#define OP7 0x80 /* 0 = OPCR[7], 1 = TxRDYB */ +#define OP6 0x40 /* 0 = OPCR[6], 1 = TxRDYA */ +#define OP5 0x20 /* 0 = OPCR[5], 1 = RxRDYB */ +#define OP4 0x10 /* 0 = OPCR[4], 1 = RxRDYA */ +#define RXCB_1X 0x0c /* RCXB_1X */ +#define TXCB_1X 0x08 /* TXCB_1X */ +#define C_T_OUTPUT 0x04 /* C_T_OUTPUT */ +#define OP3 0x00 /* 0 = OPCR[3] */ +#define RXCA_1X 0x03 /* RXCA_1X */ +#define TXCA_1X 0x02 /* TXCA_1X */ +#define TXCA_16X 0x01 /* TXCA_16X */ +#define OP2 0x00 /* 0 = OPCR[2] */ + +/* function declarations */ + +#ifndef INCLUDE_TY_CO_DRV_50 +#ifndef _ASMLANGUAGE +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT void tyCoInt (int arg); + +#else /* __STDC__ */ + +IMPORT void tyCoInt (); + +#endif /* __STDC__ */ +#endif /* _ASMLANGUAGE */ +#endif /* INCLUDE_TY_CO_DRV_50 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm68681h */ diff --git a/h/drv/multi/m68901.h b/h/drv/multi/m68901.h new file mode 100644 index 0000000..be00267 --- /dev/null +++ b/h/drv/multi/m68901.h @@ -0,0 +1,254 @@ +/* m68901.h - Motorola MC68901 MFP (Multi-Function Peripheral) */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01m,30jan93,dzb added sys and aux TIMER structures to TY_CO_DEV. + consolidated each timer's MFP_TCR macros into generic macros. + added MFP_TCR_{A,B,C,D}_MASK macros. added comments. +01l,04jan93,caf added timer driver support to TY_CO_DEV structure. + also added baudFreq, baudMin and baudMax to TY_CO_DEV. +01k,18dec92,caf added TY_CO_DEV and function declarations for 5.1 upgrade. + for 5.0.x compatibility, define INCLUDE_TY_CO_DRV_50 when + including this header. +01j,22sep92,rrr added support for c++ +01i,26may92,rrr the tree shuffle +01h,04oct91,rrr passed through the ansification filter + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01g,05oct90,shl added copyright notice. + made #endif ANSI style. +01f,28jul90,gae fixed typo in TADR definition introduced in 01e. +01e,13jul90,gae simplified MFP macros. +01d,15feb89,jcc incorporated MFP_REG_ADDR_INTERVAL into + register address definitions. +01c,16jan89,jcf added defines for rest of chip. +01b,04may88,gae fixed name on banner. +01a,30apr88,gae extracted from mv133.h. +*/ + +#ifndef __INCm68901h +#define __INCm68901h + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The macro MFP_REG_ADDR_INTERVAL must be defined + * when including this header. + */ + + +#ifdef _ASMLANGUAGE + +#define CAST + +#else /* _ASMLANGUAGE */ + +#define CAST (char *) + +#ifndef INCLUDE_TY_CO_DRV_50 + +#include "tyLib.h" + +typedef struct /* TIMER */ + { + char *cr; /* timer control register */ + char *dr; /* timer data register */ + char *ier; /* interrupt enable register */ + char *imr; /* interrupt mask register */ + int cMask; /* timer control register mask */ + int iMask; /* interrupt register mask */ + int prescale; /* clock timer resolution constant */ + } TIMER; + +typedef struct /* TY_CO_DEV */ + { + TY_DEV tyDev; + BOOL created; /* true if this device has really been created */ + uint32_t baudFreq; /* reference clock, in Hz */ + uint16_t baudMin; /* minimum baud rate */ + uint16_t baudMax; /* maximum baud rate */ + char *ucr; /* USART control register */ + char *rsr; /* receiver status register */ + char *tsr; /* transmit status register */ + char *udr; /* USART data register */ + char *imra; + char *imrb; + char *iera; + char *ierb; + char *baud1; /* baud rate 1 generator data register */ + char *baud2; /* baud rate 2 generator data register */ + TIMER sys; /* system clock timer */ + TIMER aux; /* auxilliary clock timer */ + } TY_CO_DEV; + +#endif /* INCLUDE_TY_CO_DRV_50 */ + +#endif /* _ASMLANGUAGE */ + +#define MFP_ADRS(base,reg) (CAST (base+(reg*MFP_REG_ADDR_INTERVAL))) + +/* register definitions */ + +#define MFP_GPIP(base) MFP_ADRS(base,0x00) /* Data I/O port */ +#define MFP_AER(base) MFP_ADRS(base,0x01) /* active edge register */ +#define MFP_DDR(base) MFP_ADRS(base,0x02) /* data direction reg. */ +#define MFP_IERA(base) MFP_ADRS(base,0x03) /* interrupt enable reg A */ +#define MFP_IERB(base) MFP_ADRS(base,0x04) /* interrupt enable reg B */ +#define MFP_IPRA(base) MFP_ADRS(base,0x05) /* int. pending reg A */ +#define MFP_IPRB(base) MFP_ADRS(base,0x06) /* int. pending reg B */ +#define MFP_ISRA(base) MFP_ADRS(base,0x07) /* int. in-service reg A */ +#define MFP_ISRB(base) MFP_ADRS(base,0x08) /* int. in-service reg B */ +#define MFP_IMRA(base) MFP_ADRS(base,0x09) /* interrupt mask reg A */ +#define MFP_IMRB(base) MFP_ADRS(base,0x0a) /* interrupt mask reg B */ +#define MFP_VR(base) MFP_ADRS(base,0x0b) /* vector reg */ +#define MFP_TACR(base) MFP_ADRS(base,0x0c) /* timer A control reg */ +#define MFP_TBCR(base) MFP_ADRS(base,0x0d) /* timer B control reg */ +#define MFP_TCDCR(base) MFP_ADRS(base,0x0e) /* timers C&D control reg */ +#define MFP_TADR(base) MFP_ADRS(base,0x0f) /* timer A data reg */ +#define MFP_TBDR(base) MFP_ADRS(base,0x10) /* timer B data reg */ +#define MFP_TCDR(base) MFP_ADRS(base,0x11) /* timer C data reg */ +#define MFP_TDDR(base) MFP_ADRS(base,0x12) /* timer D data reg */ +#define MFP_SCR(base) MFP_ADRS(base,0x13) /* sync char reg */ +#define MFP_UCR(base) MFP_ADRS(base,0x14) /* USART control reg */ +#define MFP_RSR(base) MFP_ADRS(base,0x15) /* receiver status reg */ +#define MFP_TSR(base) MFP_ADRS(base,0x16) /* transmitter status reg */ +#define MFP_UDR(base) MFP_ADRS(base,0x17) /* USART data reg */ + +/* vector number offsets */ + +#define MFP_INT_GP0 0x00 /* general purpose I0 */ +#define MFP_INT_GP1 0x01 /* general purpose I1 */ +#define MFP_INT_GP2 0x02 /* general purpose I2 */ +#define MFP_INT_GP3 0x03 /* general purpose I3 */ +#define MFP_INT_TIMER_D 0x04 /* timer D */ +#define MFP_INT_TIMER_C 0x05 /* timer C */ +#define MFP_INT_GP4 0x06 /* general purpose I4 */ +#define MFP_INT_GP5 0x07 /* general purpose I5 */ +#define MFP_INT_TIMER_B 0x08 /* timer B */ +#define MFP_INT_TX_ERR 0x09 /* transmit error */ +#define MFP_INT_TRANS 0x0a /* transmit buffer empty */ +#define MFP_INT_RX_ERR 0x0b /* receive error */ +#define MFP_INT_RECV 0x0c /* receive buffer full */ +#define MFP_INT_TIMER_A 0x0d /* timer A */ +#define MFP_INT_GP6 0x0e /* general purpose I6 */ +#define MFP_INT_GP7 0x0f /* general purpose I7 */ + +/* fields of vector register (VR) */ + +#define MFP_VR_SOFT 0x08 /* software acknowledge interrupts */ + +/* fields of interrupt enable A (IERA), interrupt pending A (IPRA), */ +/* interrupt in-service A (ISRA), interrupt mask A (IMRA) */ + +#define MFP_A_TIMER_B 0x01 /* timer B */ +#define MFP_A_TX_ERR 0x02 /* transmitter error */ +#define MFP_A_TX_EMPTY 0x04 /* transmitter buffer empty */ +#define MFP_A_RX_ERR 0x08 /* receiver error */ +#define MFP_A_RX_FULL 0x10 /* receiver buffer full */ +#define MFP_A_TIMER_A 0x20 /* timer A */ +#define MFP_A_GPIP6 0x40 /* general purpose i/o 6 */ +#define MFP_A_GPIP7 0x80 /* general purpose i/o 7 */ + +/* fields of interrupt enable B (IERB), interrupt pending B (IPRB), */ +/* interrupt in-service B (ISRB), interrupt mask B (IMRB) */ + +#define MFP_B_GPIP0 0x01 /* general purpose i/o 0 */ +#define MFP_B_GPIP1 0x02 /* general purpose i/o 1 */ +#define MFP_B_GPIP2 0x04 /* general purpose i/o 2 */ +#define MFP_B_GPIP3 0x08 /* general purpose i/o 3 */ +#define MFP_B_TIMER_D 0x10 /* timer D */ +#define MFP_B_TIMER_C 0x20 /* timer C */ +#define MFP_B_GPIP4 0x40 /* general purpose i/o 4 */ +#define MFP_B_GPIP5 0x80 /* general purpose i/o 5 */ + +/* fields of usart control register (UCR) */ + +#define MFP_UCR_16X 0x80 /* divide clock souce by 16 */ +#define MFP_UCR_8BIT 0x00 /* 8 bit word length */ +#define MFP_UCR_7BIT 0x20 /* 7 bit word length */ +#define MFP_UCR_6BIT 0x40 /* 6 bit word length */ +#define MFP_UCR_5BIT 0x60 /* 5 bit word length */ +#define MFP_UCR_SYNC 0x00 /* synchronous */ +#define MFP_UCR_1STOP 0x08 /* one stop bit */ +#define MFP_UCR_1_AND_HALF_STOP 0x10 /* one and a half stop bits */ +#define MFP_UCR_2STOP 0x18 /* two stop bits */ +#define MFP_UCR_NO_PARITY 0x00 /* disable parity */ +#define MFP_UCR_EVEN_PARITY 0x06 /* enable even parity */ +#define MFP_UCR_ODD_PARITY 0x04 /* enable odd parity */ + +/* fields of receiver status register (RSR) */ + +#define MFP_RSR_RX_ENABLE 0x01 /* enable receiver */ +#define MFP_RSR_SYNC_STRIP_ENABLE 0x02 /* strip sync characters */ +#define MFP_RSR_CHAR_IN_PROGRESS 0x04 /* receiving a character */ +#define MFP_RSR_BREAK_DETECT 0x08 /* break detect */ +#define MFP_RSR_FRAME_ERROR 0x10 /* framing error */ +#define MFP_RSR_PARITY_ERROR 0x20 /* parity error */ +#define MFP_RSR_OVERRUN_ERROR 0x40 /* overrun error */ +#define MFP_RSR_BUFFER_FULL 0x80 /* receive buffer full */ + +/* fields of transmitter status register (TSR) */ + +#define MFP_TSR_TX_ENABLE 0x01 /* enable receiver */ +#define MFP_TSR_HI_Z 0x00 /* hi - Z */ +#define MFP_TSR_LOW 0x02 /* LOW */ +#define MFP_TSR_HIGH 0x04 /* HIGH */ +#define MFP_TSR_LOOP 0x06 /* LOOP */ +#define MFP_TSR_BREAK 0x08 /* transmit break */ +#define MFP_TSR_EOT 0x10 /* end of transmission */ +#define MFP_TSR_AUTO_TURNAROUND 0x20 /* parity error */ +#define MFP_TSR_UNDERRUN_ERROR 0x40 /* overrun error */ +#define MFP_TSR_BUFFER_EMPTY 0x80 /* transmit buffer empty */ + +/* fields of timer control registers */ + +#define MFP_TCR_A_MASK 0xf /* timer A mask */ +#define MFP_TCR_B_MASK 0xf /* timer B mask */ +#define MFP_TCR_C_MASK 0x70 /* timer C mask */ +#define MFP_TCR_D_MASK 0x7 /* timer D mask */ +#define MFP_TCR_RESET 0x10 /* reset timer A&B */ +#define MFP_TCR_STOP 0x00 /* stop timer */ +#define MFP_TCR_DELAY_4 0x11 /* delay mode, divide by 4 prescale */ +#define MFP_TCR_DELAY_10 0x22 /* delay mode, divide by 10 prescale */ +#define MFP_TCR_DELAY_16 0x33 /* delay mode, divide by 16 prescale */ +#define MFP_TCR_DELAY_50 0x44 /* delay mode, divide by 50 prescale */ +#define MFP_TCR_DELAY_64 0x55 /* delay mode, divide by 64 prescale */ +#define MFP_TCR_DELAY_100 0x66 /* delay mode, divide by 100 prescale */ +#define MFP_TCR_DELAY_200 0x77 /* delay mode, divide by 200 prescale */ +#define MFP_TCR_EVENT 0x8 /* event count mode */ +#define MFP_TCR_PULSE_4 0x9 /* pulse mode, divide by 4 prescale */ +#define MFP_TCR_PULSE_10 0xa /* pulse mode, divide by 10 prescale */ +#define MFP_TCR_PULSE_16 0xb /* pulse mode, divide by 16 prescale */ +#define MFP_TCR_PULSE_50 0xc /* pulse mode, divide by 50 prescale */ +#define MFP_TCR_PULSE_64 0xd /* pulse mode, divide by 64 prescale */ +#define MFP_TCR_PULSE_100 0xe /* pulse mode, divide by 100 prescale */ +#define MFP_TCR_PULSE_200 0xf /* pulse mode, divide by 200 prescale */ + +/* function declarations */ + +#ifndef INCLUDE_TY_CO_DRV_50 +#ifndef _ASMLANGUAGE +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT void tyCoRxInt (void); +IMPORT void tyCoTxInt (void); + +#else /* __STDC__ */ + +IMPORT void tyCoRxInt (); +IMPORT void tyCoTxInt (); + +#endif /* __STDC__ */ +#endif /* _ASMLANGUAGE */ +#endif /* INCLUDE_TY_CO_DRV_50 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm68901h */ diff --git a/h/drv/multi/mcchip.h b/h/drv/multi/mcchip.h new file mode 100644 index 0000000..a0d50e6 --- /dev/null +++ b/h/drv/multi/mcchip.h @@ -0,0 +1,397 @@ +/* mcchip.h - Memory Controller ASIC (MCchip) */ + +/* Copyright 1984-1997 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01d,29sep98,fle doc : made it refgen parsable +01c,10feb97,dat added VERSION_REG_MC68060 +01b,30sep96,db fixed timeout constants(spr #7228) +01a,06jan93,ccc written. +*/ + +#ifdef DOC +#define INCmcchiph +#endif /* DOC */ + +#ifndef __INCmccchiph +#define __INCmccchiph + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This file contains constants for the Memory Controller ASIC (MCchip). + * The macro MCC_BASE_ADRS must be defined when including this header. + */ + +#ifdef _ASMLANGUAGE +#define CAST +#define CASTINT +#else +#define CAST (char *) +#define CASTINT (int *) +#endif /* _ASMLANGUAGE */ + +/* on-board access, register definitions */ + +#define MCC_REG_INTERVAL 1 + +#ifndef MCC_ADRS /* to permit alternative board addressing */ +#define MCC_ADRS(reg) (CAST (MCC_BASE_ADRS + (reg * MCC_REG_INTERVAL))) +#define MCC_ADRS_INT(reg) (CASTINT (MCC_BASE_ADRS + \ + (reg * MCC_REG_INTERVAL))) +#endif /* MCC_ADRS */ + +#define MCC_ID MCC_ADRS(0x00) /* Chip ID */ +#define MCC_REVISION MCC_ADRS(0x01) /* Chip Revision */ +#define MCC_GCR MCC_ADRS(0x02) /* General Control Register */ +#define MCC_VBR MCC_ADRS(0x03) /* Vector Base Register */ +#define MCC_TIMER1_CMP MCC_ADRS_INT(0x04) /* Tick Timer 1 Comp Reg */ +#define MCC_TIMER1_CMP_UU MCC_ADRS(0x04) /* Tick Timer 1 Comp Reg - UU */ +#define MCC_TIMER1_CMP_UL MCC_ADRS(0x05) /* - UL */ +#define MCC_TIMER1_CMP_LU MCC_ADRS(0x06) /* - LU */ +#define MCC_TIMER1_CMP_LL MCC_ADRS(0x07) /* - LL */ +#define MCC_TIMER1_CNT MCC_ADRS_INT(0x08) /* Tick Timer 1 Count Reg */ +#define MCC_TIMER1_CNT_UU MCC_ADRS(0x08) /* Tick Timer 1 Cnt Reg - UU */ +#define MCC_TIMER1_CNT_UL MCC_ADRS(0x09) /* - UL */ +#define MCC_TIMER1_CNT_LU MCC_ADRS(0x0a) /* - LU */ +#define MCC_TIMER1_CNT_LL MCC_ADRS(0x0b) /* - LL */ +#define MCC_TIMER2_CMP MCC_ADRS_INT(0x0c) /* Tick Timer 2 Comp Reg */ +#define MCC_TIMER2_CMP_UU MCC_ADRS(0x0c) /* Tick Timer 2 Comp Reg - UU */ +#define MCC_TIMER2_CMP_UL MCC_ADRS(0x0d) /* - UL */ +#define MCC_TIMER2_CMP_LU MCC_ADRS(0x0e) /* - LU */ +#define MCC_TIMER2_CMP_LL MCC_ADRS(0x0f) /* - LL */ +#define MCC_TIMER2_CNT MCC_ADRS_INT(0x10) /* Tick Timer 2 Count Reg */ +#define MCC_TIMER2_CNT_UU MCC_ADRS(0x10) /* Tick Timer 2 Cnt Reg - UU */ +#define MCC_TIMER2_CNT_UL MCC_ADRS(0x11) /* - UL */ +#define MCC_TIMER2_CNT_LU MCC_ADRS(0x12) /* - LU */ +#define MCC_TIMER2_CNT_LL MCC_ADRS(0x13) /* - LL */ +#define MCC_PRESCALE MCC_ADRS(0x14) /* Prescaler Count Register */ +#define MCC_PRESCALE_CLK_ADJ MCC_ADRS(0x15) /* Prescaler Clock Adjust */ +#define MCC_TIMER2_CR MCC_ADRS(0x16) /* Tick Timer 2 Ctrl Reg */ +#define MCC_TIMER1_CR MCC_ADRS(0x17) /* Tick Timer 1 Ctrl Reg */ +#define MCC_T4_IRQ_CR MCC_ADRS(0x18) /* Tick Timer 4 Inter CR */ +#define MCC_T3_IRQ_CR MCC_ADRS(0x19) /* Tick Timer 3 Inter CR */ +#define MCC_T2_IRQ_CR MCC_ADRS(0x1a) /* Tick Timer 2 Inter CR */ +#define MCC_T1_IRQ_CR MCC_ADRS(0x1b) /* Tick Timer 1 Inter CR */ +#define MCC_PARITY_ICR MCC_ADRS(0x1c) /* DRAM Parity Int Ctrl Reg */ +#define MCC_SCC_ICR MCC_ADRS(0x1d) /* SCC Inter Ctrl Reg */ +#define MCC_TIMER4_CR MCC_ADRS(0x1e) /* Tick Timer 4 Ctrl Reg */ +#define MCC_TIMER3_CR MCC_ADRS(0x1f) /* Tick Timer 3 Ctrl Reg */ +#define MCC_DRAM_BASE_AR_HIGH MCC_ADRS(0x20) /* DRAM Space Base Addr (hi) */ +#define MCC_DRAM_BASE_AR_LOW MCC_ADRS(0x21) /* DRAM Space Base Addr (low) */ +#define MCC_SRAM_BASE_AR_HIGH MCC_ADRS(0x22) /* SRAM Space Base Addr (hi) */ +#define MCC_SRAM_BASE_AR_LOW MCC_ADRS(0x23) /* SRAM Space Base Adrs (low) */ +#define MCC_DRAM_SPACE_SIZE MCC_ADRS(0x24) /* DRAM Space Size */ +#define MCC_DRAM_SRAM_OPTIONS MCC_ADRS(0x25) /* DRAM/SRAM Options */ +#define MCC_SRAM_SPACE_SIZE MCC_ADRS(0x26) /* SRAM Space Size */ +#define MCC_LANC_ERR_SR MCC_ADRS(0x28) /* LANC Error Status Register */ +#define MCC_LANC_IRQ_CR MCC_ADRS(0x2a) /* LANC Inter Ctrl Reg */ +#define MCC_LANC_BEICR MCC_ADRS(0x2b) /* LANC Bus Error Inter CR */ +#define MCC_SCSI_ERR_SR MCC_ADRS(0x2c) /* SCSI Error Status Register */ +#define MCC_GENERAL_INPUT MCC_ADRS(0x2d) /* General Purpose Input Reg */ +#define MCC_VERSION_REG MCC_ADRS(0x2e) /* Board Version */ +#define MCC_SCSI_IRQ_CR MCC_ADRS(0x2f) /* SCSI Inter Control Reg */ +#define MCC_TIMER3_CMP MCC_ADRS_INT(0x30) /* Tick Timer 3 Cmp Reg */ +#define MCC_TIMER3_CMP_UU MCC_ADRS(0x30) /* Tick Timer 3 Cmp Reg - UU */ +#define MCC_TIMER3_CMP_UL MCC_ADRS(0x31) /* - UL */ +#define MCC_TIMER3_CMP_LU MCC_ADRS(0x32) /* - LU */ +#define MCC_TIMER3_CMP_LL MCC_ADRS(0x33) /* - LL */ +#define MCC_TIMER3_CNT MCC_ADRS_INT(0x34) /* Tick Timer 3 Count Reg */ +#define MCC_TIMER3_CNT_UU MCC_ADRS(0x34) /* Tick Timer 3 Cnt Reg - UU */ +#define MCC_TIMER3_CNT_UL MCC_ADRS(0x35) /* - UL */ +#define MCC_TIMER3_CNT_LU MCC_ADRS(0x36) /* - LU */ +#define MCC_TIMER3_CNT_LL MCC_ADRS(0x37) /* - LL */ +#define MCC_TIMER4_CMP MCC_ADRS_INT(0x38) /* Tick Timer 4 Cmp Reg */ +#define MCC_TIMER4_CMP_UU MCC_ADRS(0x38) /* Tick Timer 4 Cmp Reg - UU */ +#define MCC_TIMER4_CMP_UL MCC_ADRS(0x39) /* - UL */ +#define MCC_TIMER4_CMP_LU MCC_ADRS(0x3a) /* - LU */ +#define MCC_TIMER4_CMP_LL MCC_ADRS(0x3b) /* - LL */ +#define MCC_TIMER4_CNT MCC_ADRS_INT(0x3c) /* Tick Timer 4 Count Reg */ +#define MCC_TIMER4_CNT_UU MCC_ADRS(0x3c) /* Tick Timer 4 Cnt Reg - UU */ +#define MCC_TIMER4_CNT_UL MCC_ADRS(0x3d) /* - UL */ +#define MCC_TIMER4_CNT_LU MCC_ADRS(0x3e) /* - LU */ +#define MCC_TIMER4_CNT_LL MCC_ADRS(0x3f) /* - LL */ +#define MCC_BUS_CLK_REG MCC_ADRS(0x40) /* Bus Clock Register */ +#define MCC_PROM_ACCESS_TIME MCC_ADRS(0x41) /* PROM access time register */ +#define MCC_FLASH_ACCESS_TIME MCC_ADRS(0x42) /* FLASH access time register */ +#define MCC_ABORT_ICR MCC_ADRS(0x43) /* ABORT switch int cont reg */ +#define MCC_RESET_CR MCC_ADRS(0x44) /* RESET switch control reg */ +#define MCC_WD_TIMER_CR MCC_ADRS(0x45) /* Watchdog timer control reg */ +#define MCC_WD_TIMEOUT_REG MCC_ADRS(0x46) /* Access and watchdog times */ +#define MCC_DRAM_CONTROL_REG MCC_ADRS(0x48) /* DRAM control register */ +#define MCC_MPU_STATUS_REG MCC_ADRS(0x4a) /* MPU status register */ +#define MCC_PRESCALE_COUNT MCC_ADRS_INT(0x4c) /* 32-bit prescale count */ + +/* GCR 0x02 General Control Register */ + +#define GCR_FAST_ON 0x01 /* Enable fast access for BBRAM 0 */ +#define GCR_FAST_OFF 0x00 /* Disable fast access for BBRAM 0 */ +#define GCR_MIEN_ON 0x02 /* Master Interrupt Enable 1 */ +#define GCR_MIEN_OFF 0x00 /* Master Interrupt Enable OFF 1 */ + +/* VBR 0x03 Vector Base Register */ + +#define MCC_INT_TT4 0x3 /* Tick Timer 4 IRQ */ +#define MCC_INT_TT3 0x4 /* Tick Timer 3 IRQ */ +#define MCC_INT_SCSI 0x5 /* SCSI IRQ */ +#define MCC_INT_LANC_ERR 0x6 /* LANC ERR */ +#define MCC_INT_LANC 0x7 /* LANC IRQ */ +#define MCC_INT_TT2 0x8 /* Tick Timer 2 IRQ */ +#define MCC_INT_TT1 0x9 /* Tick Timer 1 IRQ */ +#define MCC_INT_PARITY_ERROR 0xb /* Parity Error IRQ */ +#define MCC_INT_ABORT 0xe /* ABORT switch IRQ */ + +/* TIMER2_CR 0x16 Tick Timer 2 Control Register */ + +#define TIMER2_CR_CEN 0x01 /* Counter Enable 0 */ +#define TIMER2_CR_DIS 0x00 /* Counter Disable 0 */ +#define TIMER2_CR_COC 0x02 /* Clear On Compare 1 */ +#define TIMER2_CR_COVF 0x04 /* Clear Overflow Counter 2 */ + +/* TIMER1_CR 0x17 Tick Timer 1 Control Register */ + +#define TIMER1_CR_CEN 0x01 /* Counter Enable 0 */ +#define TIMER1_CR_DIS 0x00 /* Counter Disable 0 */ +#define TIMER1_CR_COC 0x02 /* Clear On Compare 1 */ +#define TIMER1_CR_COVF 0x04 /* Clear Overflow Counter 2 */ + +/* T4_IRQ_CR 0x18 Tick Timer 4 Interrupt Control Register */ + +#define T4_IRQ_CR_ICLR 0x08 /* Clear IRQ 3 */ +#define T4_IRQ_CR_IEN 0x10 /* Interrupt Enable 4 */ +#define T4_IRQ_CR_DIS 0x00 /* Interrupt Disable 4 */ +#define T4_IRQ_CR_INT 0x20 /* Interrupt Status 5 */ + +/* T3_IRQ_CR 0x19 Tick Timer 3 Interrupt Control Register */ + +#define T3_IRQ_CR_ICLR 0x08 /* Clear IRQ 3 */ +#define T3_IRQ_CR_IEN 0x10 /* Interrupt Enable 4 */ +#define T3_IRQ_CR_DIS 0x00 /* Interrupt Disable 4 */ +#define T3_IRQ_CR_INT 0x20 /* Interrupt Status 5 */ + +/* T2_IRQ_CR 0x1a Tick Timer 2 Interrupt Control Register */ + +#define T2_IRQ_CR_ICLR 0x08 /* Clear IRQ 3 */ +#define T2_IRQ_CR_IEN 0x10 /* Interrupt Enable 4 */ +#define T2_IRQ_CR_DIS 0x00 /* Interrupt Disable 4 */ +#define T2_IRQ_CR_INT 0x20 /* Interrupt Status 5 */ + +/* T1_IRQ_CR 0x1b Tick Timer 1 Interrupt Control Register */ + +#define T1_IRQ_CR_ICLR 0x08 /* Clear IRQ 3 */ +#define T1_IRQ_CR_IEN 0x10 /* Interrupt Enable 4 */ +#define T1_IRQ_CR_DIS 0x00 /* Interrupt Disable 4 */ +#define T1_IRQ_CR_INT 0x20 /* Interrupt Status 5 */ + +/* PARITY_ICR 0x1c DRAM Parity Error Interrupt Control Register */ + +#define PARITY_ICR_ICLR 0x08 /* Clear IRQ 3 */ +#define PARITY_ICR_IEN 0x10 /* Interrupt Enable 4 */ +#define PARITY_ICR_DIS 0x00 /* Interrupt Disable 4 */ +#define PARITY_ICR_INT 0x20 /* Interrupt Status 5 */ + +/* SCC_ICR 0x1d SCC Interrupt Control Register */ + +#define SCC_ICR_IEN 0x10 /* Interrupt Enable 4 */ +#define SCC_ICR_DIS 0x00 /* Interrupt Disable 4 */ +#define SCC_ICR_IRQ 0x20 /* An Interrupt has occured 5 */ + +/* TIMER4_CR 0x1e Tick Timer 4 Control Register */ + +#define TIMER4_CR_CEN 0x01 /* Counter Enable 0 */ +#define TIMER4_CR_DIS 0x00 /* Counter Disable 0 */ +#define TIMER4_CR_COC 0x02 /* Clear On Compare 1 */ +#define TIMER4_CR_COVF 0x04 /* Clear Overflow Counter 2 */ + +/* TIMER3_CR 0x1f Tick Timer 3 Control Register */ + +#define TIMER3_CR_CEN 0x01 /* Counter Enable 0 */ +#define TIMER3_CR_DIS 0x00 /* Counter Disable 0 */ +#define TIMER3_CR_COC 0x02 /* Clear On Compare 1 */ +#define TIMER3_CR_COVF 0x04 /* Clear Overflow Counter 2 */ + +/* DRAM_SPACE_SIZE 0x24 DRAM Space Size Register */ + +#define DRAM_SPACE_SIZE_1MB 0x00 /* 1 MB with 4 Mbit DRAMs 2-0 */ +#define DRAM_SPACE_SIZE_2MB 0x01 /* 2 MB with 4 Mbit DRAMs */ +#define DRAM_SPACE_SIZE_4MB4 0x03 /* 4 MB with 4 Mbit DRAMs interleave */ +#define DRAM_SPACE_SIZE_4MB16 0x04 /* 4 MB with 16 Mbit DRAMs */ +#define DRAM_SPACE_SIZE_8MB 0x05 /* 8 MB with 16 Mbit DRAMs */ +#define DRAM_SPACE_SIZE_NONE 0x06 /* DRAM mezzanine is not present */ +#define DRAM_SPACE_SIZE_16MB 0x07 /* 16 MB with 16 Mbit DRAMs int'leve */ + +/* DRAM_SRAM_OPTIONS 0x25 DRAM/SRAM Options Register */ + +#define DRAM_SRAM_OPTIONS_DMASK 0x07 /* Mask for DRAM bits 2-0 */ +#define DRAM_SRAM_OPTIONS_SMASK 0x18 /* Mask for SRAM bits 4-3 */ + +/* SRAM_SPACE_SIZE 0x26 SRAM Space Size Register */ + +#define SRAM_SPACE_512K 0x01 /* 512 KB */ +#define SRAM_SPACE_1MB 0x02 /* 1MB */ +#define SRAM_SPACE_2MB 0x03 /* 2MB */ +#define SRAM_SPACE_ENABLE 0x04 /* SRAM enable */ + +/* LANC_ERR_SR 0x28 LANC Error Status Register */ + +#define LANC_ERR_SR_SCLR 0x01 /* Clear Error Status Bits 0 */ +#define LANC_ERR_SR_LTO 0x02 /* Local Time out error 1 */ +#define LANC_ERR_SR_EXT 0x04 /* VMEbus error 2 */ +#define LANC_ERR_SR_PRTY 0x08 /* DRAM Parity Error 3 */ + +/* LANC_IRQ_CR 0x2a LANC Interrupt Control Register */ + +#define LANC_IRQ_CR_ICLR 0x08 /* Clear IRQ in edge mode 3 */ +#define LANC_IRQ_CR_IEN 0x10 /* Interrupt Enable 4 */ +#define LANC_IRQ_CR_DIS 0x00 /* Interrupt Disable 4 */ +#define LANC_IRQ_CR_INT 0x20 /* Interrupt Status 5 */ +#define LANC_IRQ_CR_EDGE 0x40 /* Edge sensitive IRQ 6 */ +#define LANC_IRQ_CR_LEVEL 0x00 /* Level sensitive IRQ 6 */ +#define LANC_IRQ_CR_HIGH_LOW 0x00 /* IRQ on RISING or HIGH 7 */ +#define LANC_IRQ_CR_LOW_HIGH 0x80 /* IRQ on FALLING or LOW 7 */ + +/* LANC_BEICR 0x2b LANC Bus Error Interrupt Control Register */ + +#define LANC_BEICR_ICLR 0x08 /* Clear IRQ 3 */ +#define LANC_BEICR_IEN 0x10 /* Interrupt Enable 4 */ +#define LANC_BEICR_DIS 0x00 /* Interrupt Disable 4 */ +#define LANC_BEICR_IRQ 0x20 /* Interrupt Status 5 */ +#define LANC_BEICR_NO_SNOOP 0x00 /* Inhibit Snoop 7-6 */ +#define LANC_BEICR_SINK_DATA 0x40 /* Sink Data 7-6 */ +#define LANC_BEICR_INVALIDATE 0x80 /* Invalidate Line 7-6 */ + +/* SCSI_ERR_SR 0x2c SCSI Error Status Register */ + +#define SCSI_ERR_SR_SCLR 0x01 /* Clear Error Status Bits 0 */ +#define SCSI_ERR_SR_LTO 0x02 /* Local Time out error 1 */ +#define SCSI_ERR_SR_EXT 0x04 /* VMEbus error 2 */ +#define SCSI_ERR_SR_PRTY 0x08 /* DRAM Parity Error 3 */ + +/* VERSION_REG 0x2e Version Register */ + +#define VERSION_REG_SPEED 0x01 /* 0=25MHz, 1=33MHz 0 */ +#define VERSION_REG_VMECHIP 0x02 /* 0=present, 1=not installed 1 */ +#define VERSION_REG_SCSI 0x04 /* 0=present, 1=not installed 2 */ +#define VERSION_REG_ETHERNET 0x08 /* 0=present, 1=not installed 3 */ +#define VERSION_REG_MC68040 0x10 /* 1=MC68040, 0=MC68LC040 4 */ +#define VERSION_REG_MC68060 0x10 /* 1=MC68060, 0=MC68LC060 4 */ +#define VERSION_REG_FLASH 0x20 /* address location 5 */ +#define VERSION_REG_IPIC2 0x40 /* 0=present, 1=not installed 6 */ +#define VERSION_REG_IPIC1 0x80 /* 0=present, 1=not installed 7 */ + +/* SCSI_IRQ_CR 0x2f SCSI Interrupt Control Register */ + +#define SCSI_IRQ_CR_IEN 0x10 /* Interrupt Enable 4 */ +#define SCSI_IRQ_CR_DIS 0x00 /* Interrupt Disable 4 */ +#define SCSI_IRQ_CR_IRQ 0x20 /* Interrupt Status 5 */ + +/* PROM_ACCESS_TIME 0x41 PROM Access Timer Control Register */ + +#define PROM_ACCESS_25M_60NS 0x00 /* 25 MHz - 60 ns */ +#define PROM_ACCESS_25M_100NS 0x01 /* - 100 ns */ +#define PROM_ACCESS_25M_140NS 0x02 /* - 140 ns */ +#define PROM_ACCESS_25M_180NS 0x03 /* - 180 ns */ +#define PROM_ACCESS_25M_220NS 0x04 /* - 220 ns */ +#define PROM_ACCESS_25M_260NS 0x05 /* - 260 ns */ +#define PROM_ACCESS_25M_300NS 0x06 /* - 300 ns */ +#define PROM_ACCESS_25M_340NS 0x07 /* - 340 ns */ + +#define PROM_ACCESS_33M_40NS 0x00 /* 33 MHz - 40 ns */ +#define PROM_ACCESS_33M_70NS 0x01 /* - 70 ns */ +#define PROM_ACCESS_33M_100NS 0x02 /* - 100 ns */ +#define PROM_ACCESS_33M_130NS 0x03 /* - 130 ns */ +#define PROM_ACCESS_33M_160NS 0x04 /* - 160 ns */ +#define PROM_ACCESS_33M_190NS 0x05 /* - 190 ns */ +#define PROM_ACCESS_33M_210NS 0x06 /* - 210 ns */ +#define PROM_ACCESS_33M_240NS 0x07 /* - 240 ns */ + +/* FLASH_ACCESS_TIME 0x42 PROM Access Timer Control Register */ + +#define FLASH_ACCESS_25M_60NS 0x00 /* 25 MHz - 60 ns */ +#define FLASH_ACCESS_25M_100NS 0x01 /* - 100 ns */ +#define FLASH_ACCESS_25M_140NS 0x02 /* - 140 ns */ +#define FLASH_ACCESS_25M_180NS 0x03 /* - 180 ns */ +#define FLASH_ACCESS_25M_220NS 0x04 /* - 220 ns */ +#define FLASH_ACCESS_25M_260NS 0x05 /* - 260 ns */ +#define FLASH_ACCESS_25M_300NS 0x06 /* - 300 ns */ +#define FLASH_ACCESS_25M_340NS 0x07 /* - 340 ns */ + +#define FLASH_ACCESS_33M_40NS 0x00 /* 33 MHz - 40 ns */ +#define FLASH_ACCESS_33M_70NS 0x01 /* - 70 ns */ +#define FLASH_ACCESS_33M_100NS 0x02 /* - 100 ns */ +#define FLASH_ACCESS_33M_130NS 0x03 /* - 130 ns */ +#define FLASH_ACCESS_33M_160NS 0x04 /* - 160 ns */ +#define FLASH_ACCESS_33M_190NS 0x05 /* - 190 ns */ +#define FLASH_ACCESS_33M_210NS 0x06 /* - 210 ns */ +#define FLASH_ACCESS_33M_240NS 0x07 /* - 240 ns */ + +/* ABORT_ICR 0x43 ABORT Switch Interrupt Control Register */ + +#define ABORT_ICR_ICLR 0x08 /* Clear IRQ 3 */ +#define ABORT_ICR_IEN 0x10 /* Interrupt Enable 4 */ +#define ABORT_ICR_DIS 0x00 /* Interrupt Disable 4 */ +#define ABORT_ICR_INT 0x20 /* Interrupt Status 5 */ + +/* RESET_CR 0x44 RESET Switch Control Register */ + +#define RESET_CR_BRFLI 0x10 /* Board Fail Status 4 */ +#define RESET_CR_PURS 0x08 /* Power-up Reset Status 3 */ +#define RESET_CR_CPURS 0x04 /* Clear Power-up Reset 2 */ +#define RESET_CR_BDFLO 0x02 /* Board Fail Assert 1 */ +#define RESET_CR_RSWE 0x01 /* RESET Switch Enable 0 */ + +/* WD_TIMER_CR 0x45 Watchdog Timer Control Register */ + +#define WD_TIMER_CR_WDCS 0x40 /* Clear Watchdog Timeout Status 6 */ +#define WD_TIMER_CR_WDCC 0x20 /* Clear Watchdog Counter 5 */ +#define WD_TIMER_CR_WDTO 0x10 /* Watchdog Timer Status Bit 4 */ +#define WD_TIMER_CR_WDBFE 0x08 /* Watchdog Timeout Asserts Fail 3 */ +#define WD_TIMER_CR_WDRSE 0x02 /* Watchdog Timeout Asserts LRESET 1 */ +#define WD_TIMER_CR_WDEN 0x01 /* Watchdog Timer Enable 0 */ +#define WD_TIMER_CR_DIS 0x00 /* Watchdog Timer Disable */ + +/* WD_TIMEOUT_REG 0x46 Access and Watchdog Time Base Select Reg */ + +#define WD_TIMEOUT_REG_WD_512US 0x00 /* Watchdog Timeout: 512us 3-0 */ +#define WD_TIMEOUT_REG_WD_1MS 0x01 /* 1ms */ +#define WD_TIMEOUT_REG_WD_2MS 0x02 /* 2ms */ +#define WD_TIMEOUT_REG_WD_4MS 0x03 /* 4ms */ +#define WD_TIMEOUT_REG_WD_8MS 0x04 /* 8ms */ +#define WD_TIMEOUT_REG_WD_16MS 0x05 /* 16ms */ +#define WD_TIMEOUT_REG_WD_32MS 0x06 /* 32ms */ +#define WD_TIMEOUT_REG_WD_64MS 0x07 /* 64ms */ +#define WD_TIMEOUT_REG_WD_128MS 0x08 /* 128ms */ +#define WD_TIMEOUT_REG_WD_256MS 0x09 /* 256ms */ +#define WD_TIMEOUT_REG_WD_512MS 0x0a /* 512ms */ +#define WD_TIMEOUT_REG_WD_1S 0x0b /* 1s */ +#define WD_TIMEOUT_REG_WD_4S 0x0c /* 4s */ +#define WD_TIMEOUT_REG_WD_16S 0x0d /* 16s */ +#define WD_TIMEOUT_REG_WD_32S 0x0e /* 32s */ +#define WD_TIMEOUT_REG_WD_64S 0x0f /* 64s */ + +#define WD_TIMEOUT_REG_LB_8US 0x00 /* Local Bus Timeout: 8us 5-4 */ +#define WD_TIMEOUT_REG_LB_64US 0x10 /* 64us */ +#define WD_TIMEOUT_REG_LB_256US 0x20 /* 256us */ +#define WD_TIMEOUT_REG_LB_NONE 0x30 /* none */ + +/* DRAM_CONTROL_REG 0x48 DRAM Control Register */ + +#define DRAM_CONTROL_REG_RAM_EN 0x01 /* DRAM Enable 0 */ +#define DRAM_CONTROL_REG_PAR_EN 0x02 /* DRAM Parity Check Enable 1 */ +#define DRAM_CONTROL_REG_PAR_IN 0x04 /* DRAM Parity Error -> IRQ 2 */ + +/* MPU_STATUS_REG 0x4a MPU Status Register */ + +#define MPU_STATUS_REG_MLTO 0x01 /* MPU received Local Bus Timeout 0 */ +#define MPU_STATUS_REG_MLPE 0x02 /* MPU received Parity Error 1 */ +#define MPU_STATUS_REG_MLBE 0x04 /* MPU received TEA 2 */ +#define MPU_STATUS_REG_MCLR 0x08 /* Clear MPU status bits 3 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmccchiph */ diff --git a/h/drv/multi/mcecc.h b/h/drv/multi/mcecc.h new file mode 100644 index 0000000..cda001c --- /dev/null +++ b/h/drv/multi/mcecc.h @@ -0,0 +1,168 @@ +/* mcecc.h - Memory Controller ASIC with Error Correction Code */ + +/* Copyright 1991-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,04jul94,tpr written. +*/ + +#ifdef DOC +#define INCmcecch +#endif /* DOC */ + +#ifndef __INCmcecch +#define __INCmcecch + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This file contains constants for Motorola's Memory Controller ASIC + * with ecc (error correction code). + * The macro MCECC_BASE_ADRS must be defined when including this header. + */ + +#ifdef _ASMLANGUAGE +#define CAST +#else +#define CAST (char *) +#endif /* _ASMLANGUAGE */ + +/* on-board access, register definitions */ + +#define MCECC_REG_INTERVAL 1 + +#ifndef MCECC_ADRS /* to permit alternative board addressing */ +#define MCECC_ADRS(reg) (CAST (MCECC_BASE_ADRS + (reg * MCECC_REG_INTERVAL))) +#endif /* MCECC_ADRS */ + +#define MCECC_ID MCECC_ADRS(0x00) /* Chip ID */ +#define MCECC_REVISION MCECC_ADRS(0x04) /* Chip Revision Register */ +#define MCECC_MCR MCECC_ADRS(0x08) /* Memory Configuration Reg */ +#define MCECC_DUMMY_0 MCECC_ADRS(0x0c) /* Alternate Status Register */ +#define MCECC_DUMMY_1 MCECC_ADRS(0x10) /* Alternate Control Register */ +#define MCECC_BAR MCECC_ADRS(0x14) /* Base Address Register */ +#define MCECC_RCR MCECC_ADRS(0x18) /* RAM Control Register */ +#define MCECC_BCR MCECC_ADRS(0x1c) /* Bus Clock Register */ +#define MCECC_DCR MCECC_ADRS(0x20) /* Data Control Register */ +#define MCECC_SCR MCECC_ADRS(0x24) /* Scrub Control Register */ +#define MCECC_SPR_0 MCECC_ADRS(0x28) /* Scrub Period Register 0 */ +#define MCECC_SPR_1 MCECC_ADRS(0x2c) /* Scrub Period Register 1 */ +#define MCECC_CPR MCECC_ADRS(0x30) /* Chip prescale Register */ +#define MCECC_STOOR MCECC_ADRS(0x34) /* Scrub Time On/Off Register */ +#define MCECC_SPSR_0 MCECC_ADRS(0x38) /* Scrub PreScale Register 0 */ +#define MCECC_SPSR_1 MCECC_ADRS(0x3c) /* Scrub PreScale Register 1 */ +#define MCECC_SPSR_2 MCECC_ADRS(0x40) /* Scrub PreScale Register 2 */ +#define MCECC_STR_0 MCECC_ADRS(0x44) /* Scrub Timer Register 0 */ +#define MCECC_STR_1 MCECC_ADRS(0x48) /* Scrub Timer Register 1 */ +#define MCECC_SACR_0 MCECC_ADRS(0x4c) /* Scrub Addr Cntr Register 0 */ +#define MCECC_SACR_1 MCECC_ADRS(0x50) /* Scrub Addr Cntr Register 1 */ +#define MCECC_SACR_2 MCECC_ADRS(0x54) /* Scrub Addr Cntr Register 2 */ +#define MCECC_SACR_3 MCECC_ADRS(0x58) /* Scrub Addr Cntr Register 3 */ +#define MCECC_ELR MCECC_ADRS(0x5c) /* Error Logger Register */ +#define MCECC_EAR_0 MCECC_ADRS(0x60) /* Error Addr Register 0 */ +#define MCECC_EAR_1 MCECC_ADRS(0x64) /* Error Addr Register 1 */ +#define MCECC_EAR_2 MCECC_ADRS(0x68) /* Error Addr Register 2 */ +#define MCECC_EAR_3 MCECC_ADRS(0x6c) /* Error Addr Register 3 */ +#define MCECC_ESR MCECC_ADRS(0x70) /* Error Syndrome Register */ +#define MCECC_DR_1 MCECC_ADRS(0x74) /* Default Register 1 */ +#define MCECC_DR_2 MCECC_ADRS(0x78) /* Default Register 2 */ + +/* MCECC_ID: 0x00 Chip ID */ + +#define MCECC_ID_RESET 0x0f /* software reset of chip */ + + +/* MCECC_MCR: 0x08 Memory Configuration Register */ + +#define MCECC_MCR_4MB 0x00 /* 4 Meg of Memory 2-0 */ +#define MCECC_MCR_8MB 0x01 /* 8 Meg of Memory 2-0 */ +#define MCECC_MCR_16MB 0x02 /* 16 Meg of Memory 2-0 */ +#define MCECC_MCR_32MB 0x03 /* 32 Meg of Memory 2-0 */ +#define MCECC_MCR_64MB 0x04 /* 64 Meg of Memory 2-0 */ +#define MCECC_MCR_128MB 0x05 /* 128 Meg of Memory 2-0 */ +#define MCECC_MCR_FSTRD 0x20 /* Fast Read 5 */ + + +/* MCECC_RCR: 0x18 RAM Control Register */ + +#define MCECC_RCR_RAMEN 0x01 /* RAM Enable 0 */ +#define MCECC_RCR_NCEBEN 0x02 /* Non correctable error Enable 1 */ +#define MCECC_RCR_NCEIEN 0x04 /* Non Correctable error Int Enable2 */ +#define MCECC_RCR_SWAIT 0x10 /* Snoop Wait 4 */ + +/* MCECC_BCR: 0x1c Bus Clock Register */ + +#define MCECC_BCR_16MHZ 16 /* 16 MHz clock */ +#define MCECC_BCR_20MHZ 20 /* 20 MHz clock */ +#define MCECC_BCR_25MHZ 25 /* 25 MHz clock */ +#define MCECC_BCR_33MHZ 33 /* 33 MHz clock */ +#define MCECC_BCR_50MHZ 50 /* 50 MHz clock */ +#define MCECC_BCR_60MHZ 60 /* 60 MHz clock */ + +/* MCECC_DCR: 0x20 Data Control Register */ + +#define MCECC_DCR_RWCKB 0x08 /* Read Write Check Bits 3 */ +#define MCECC_DCR_ZFILL 0x10 /* Zero fill 4 */ +#define MCECC_DCR_DERC 0x20 /* Disable Error Correction 5 */ + +/* MCECC_SCR: 0x24 Scrub Control Register */ + +#define MCECC_SCR_IDIS 0x01 /* Image Disable 0 */ +#define MCECC_SCR_SBEIEN 0x02 /* Single Bit Error Int Enable 1 */ +#define MCECC_SCR_SCRBEN 0x08 /* Scrubber Enable 3 */ +#define MCECC_SCR_SCRB 0x10 /* Scrubber state 4 */ + + +/* MCECC_STOOR: 0x34 Scrub Time On/Off Register */ + +#define MCECC_STOOR_STOFF_IMMED 0x00 /* Rqst DRAM immediatly */ +#define MCECC_STOOR_STOFF_16_BCLK 0x01 /* Rqst DRAM after 16 BCLK */ +#define MCECC_STOOR_STOFF_32_BCLK 0x02 /* Rqst DRAM after 32 BCLK */ +#define MCECC_STOOR_STOFF_64_BCLK 0x03 /* Rqst DRAM after 64 BCLK */ +#define MCECC_STOOR_STOFF_128_BCLK 0x04 /* Rqst DRAM after 128 BCLK */ +#define MCECC_STOOR_STOFF_256_BCLK 0x05 /* Rqst DRAM after 256 BCLK */ +#define MCECC_STOOR_STOFF_512_BCLK 0x06 /* Rqst DRAM after 512 BCLK */ +#define MCECC_STOOR_STOFF_NEVER 0x07 /* Rqst DRAM never */ +#define MCECC_STOOR_STON_1BLCK 0x00 /* Keep DRAM for 1 Mem cycle */ +#define MCECC_STOOR_STON_16_BCLK 0x08 /* Keep DRAM for 16 BCLK */ +#define MCECC_STOOR_STON_32_BCLK 0x10 /* Keep DRAM for 32 BCLK */ +#define MCECC_STOOR_STON_64_BCLK 0x18 /* Keep DRAM for 64 BCLK */ +#define MCECC_STOOR_STON_128_BCLK 0x20 /* Keep DRAM for 128 BCLK */ +#define MCECC_STOOR_STON_256_BCLK 0x28 /* Keep DRAM for 256 BCLK */ +#define MCECC_STOOR_STON_512_BCLK 0x30 /* Keep DRAM for 512 BCLK */ +#define MCECC_STOOR_STON_TOTAL 0x38 /* Keep DRAM for total srub */ +#define MCECC_STOOR_SRDIS 0x80 /* Scrubber Disable */ + +/* MCECC_ELR: 0x5c Error LOGGER Register */ + +#define MCECC_ELR_SBE 0x01 /* Single Bit Error */ +#define MCECC_ELR_MBE 0x02 /* Multiple Bit Error */ +#define MCECC_ELR_EALT 0x08 /* Error by an Alternate bus master */ +#define MCECC_ELR_ESCRB 0x20 /* Error from Scrubber */ +#define MCECC_ELR_ERD 0x40 /* READ signal pin state */ +#define MCECC_ELR_ERRLOG 0x80 /* single or double bit error logged */ + +/* MCECC_DR_1: 0x74 Default Register 1 */ + +#define MCECC_DR_1_RSIZ_4MB 0x00 /* 4 Mbytes of Dram */ +#define MCECC_DR_1_RSIZ_8MB 0x01 /* 8 Mbytes of Dram */ +#define MCECC_DR_1_RSIZ_16MB 0x02 /* 16 Mbytes of Dram */ +#define MCECC_DR_1_RSIZ_32MB 0x03 /* 32 Mbytes of Dram */ +#define MCECC_DR_1_RSIZ_64MB 0x04 /* 64 Mbytes of Dram */ +#define MCECC_DR_1_RSIZ_128MB 0x05 /* 128 Mbytes of Dram */ +#define MCECC_DR_1_SELI_000 0x00 /* Reg Base Address : 0xfff43000 */ +#define MCECC_DR_1_SELI_100 0x08 /* Reg Base Address : 0xfff43100 */ +#define MCECC_DR_1_SELI_200 0x10 /* Reg Base Address : 0xfff43200 */ +#define MCECC_DR_1_SELI_300 0x18 /* Reg Base Address : 0xfff43300 */ +#define MCECC_DR_1_FSTRD 0x20 /* Fast Read */ +#define MCECC_DR_1_STATCOL 0x40 /* RACODE and RADATA locked */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmcecch */ diff --git a/h/drv/multi/memc040.h b/h/drv/multi/memc040.h new file mode 100644 index 0000000..19279b5 --- /dev/null +++ b/h/drv/multi/memc040.h @@ -0,0 +1,113 @@ +/* memc040.h - Memory Controller ASIC for the MC68040-type bus */ + +/* Copyright 1991-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01e,29sep98,fle doc : made it refgen parsable +01d,22sep92,rrr added support for c++ +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01a,18jun91,ccc written. +*/ + +#ifdef DOC +#define INCmemc040h +#endif /* DOC */ + +#ifndef __INCmemc040h +#define __INCmemc040h + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This file contains constants for Motorola's Memory Controller ASIC. + * The macro MEMC_BASE_ADRS must be defined when including this header. + */ + +#ifdef _ASMLANGUAGE +#define CAST +#else +#define CAST (char *) +#endif /* _ASMLANGUAGE */ + +/* on-board access, register definitions */ + +#define MEMC_REG_INTERVAL 1 + +#ifndef MEMC_ADRS /* to permit alternative board addressing */ +#define MEMC_ADRS(reg) (CAST (MEMC_BASE_ADRS + (reg * MEMC_REG_INTERVAL))) +#endif /* MEMC_ADRS */ + +#define MEMC_ID MEMC_ADRS(0x00) /* Chip ID */ +#define MEMC_REVISION MEMC_ADRS(0x04) /* Chip Revision Register */ +#define MEMC_MCR MEMC_ADRS(0x08) /* Memory Configuration Register*/ +#define MEMC_ASR MEMC_ADRS(0x0c) /* Alternate Status Register */ +#define MEMC_ACR MEMC_ADRS(0x10) /* Alternate Control Register */ +#define MEMC_BAR MEMC_ADRS(0x14) /* Base Address Register */ +#define MEMC_RCR MEMC_ADRS(0x18) /* RAM Control Register */ +#define MEMC_BCR MEMC_ADRS(0x1c) /* Bus Clock Register */ + +/* MEMC_ID 0x00 Chip ID */ + +#define MEMC_ID_RESET 0x0f /* software reset of chip */ + +/* MEMC_REVISION 0x04 Chip Revision Register */ +/* NONE */ + +/* MEMC_MCR 0x08 Memory Configuration Register */ + +#define MEMC_MCR_4MB 0x00 /* 4 Meg of Memory 2-0 */ +#define MEMC_MCR_8MB 0x01 /* 8 Meg of Memory 2-0 */ +#define MEMC_MCR_16MB 0x02 /* 16 Meg of Memory 2-0 */ +#define MEMC_MCR_32MB 0x03 /* 32 Meg of Memory 2-0 */ +#define MEMC_MCR_64MB 0x04 /* 64 Meg of Memory 2-0 */ +#define MEMC_MCR_128MB 0x05 /* 128 Meg of Memory 2-0 */ +#define MEMC_MCR_WPB 0x08 /* Write-Per-Bit mode 3 */ +#define MEMC_MCR_EXTPEN 0x10 /* Enternal Parity Enable 4 */ +#define MEMC_MCR_FSTRD 0x20 /* Fast Read 5 */ + +/* MEMC_ASR 0x0c Alternate Status Register */ + +#define MEMC_ASR_APD 0xf0 /* State of the APD3-APD0 pins 7-4 */ +#define MEMC_ASR_BPD 0x0f /* State of the BPD3-BPD0 pins 3-0 */ + +/* MEMC_ACR 0x10 Alternate Control Register */ + +#define MEMC_ACR_DPD0 0x01 /* DPD0 output pin 0 */ +#define MEMC_ACR_DPD1 0x02 /* DPD1 output pin 1 */ +#define MEMC_ACR_DPD2 0x04 /* DPD2 output pin 2 */ +#define MEMC_ACR_DPD3 0x08 /* DPD3 output pin 3 */ +#define MEMC_ACR_CPD0 0x10 /* CPD0 output pin 4 */ +#define MEMC_ACR_CPD1 0x20 /* CPD1 output pin 5 */ +#define MEMC_ACR_CPD2 0x40 /* CPD2 output pin 6 */ +#define MEMC_ACR_CPD3 0x80 /* CPD3 output pin 7 */ + +/* MEMC_BAR 0x14 Base Address Register */ +/* NONE */ + +/* MEMC_RCR 0x18 RAM Control Register */ + +#define MEMC_RCR_RAMEN 0x01 /* RAM Enable 0 */ +#define MEMC_RCR_PAREN 0x02 /* Parity Enable 1 */ +#define MEMC_RCR_PARINT 0x04 /* Parity Interrupt Enable 2 */ +#define MEMC_RCR_WWP 0x08 /* Write Wrong Parity 3 */ +#define MEMC_RCR_SWAIT 0x10 /* Snoop Wait 4 */ +#define MEMC_RCR_DMCTL 0x20 /* Data Mux Control 5 */ + +/* MEMC_BCR 0x1c Bus Clock Register */ + +#define MEMC_BCR_16MHZ 16 /* 16 MHz clock */ +#define MEMC_BCR_25MHZ 25 /* 25 MHz clock */ +#define MEMC_BCR_33MHZ 33 /* 33 MHz clock */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmemc040h */ diff --git a/h/drv/multi/mpc107.h b/h/drv/multi/mpc107.h new file mode 100644 index 0000000..9a88bbd --- /dev/null +++ b/h/drv/multi/mpc107.h @@ -0,0 +1,356 @@ +/* mpc107.h - MPC107 General Configuration registers */ + +/* Copyright 1984-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,15sep01,dat Gnu-diab, use of WRS_ASM macro +01b,11sep00,rcs Add MCP107_DELTA macro +01a,23may00,bri written +*/ + +#ifndef __INCmpc107h +#define __INCmpc107h + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +/* MPC107 device and vendor ID's */ + +#define MPC107_VEN_ID 0x1057 /* Motorola Vendor ID */ +#define MPC107_DEV_ID 0x0003 /* MPC107 Device ID */ +#define MPC107_DEV_VEN_ID 0x00031057 /* (DevId << 16) + VenId */ + +/* MPC107 configuration adrs and data register for map A & B */ + +#define MPC107_CFG_ADDR_PREP 0x80000cf8 /* MPC107 cfg reg map A */ +#define MPC107_CFG_DATA_PREP 0x80000cfc /* MPC107 cfg data map A */ +#define MPC107_CFG_ADDR_CHRP 0xfec00000 /* MPC107 cfg reg map B */ +#define MPC107_CFG_DATA_CHRP 0xfee00000 /* MPC107 cfg data map B */ +#define MPC107_PICR1_MAPB 0x0 /* PICR1 bit 16 map B */ +#define MPC107_PICR1_MAPA 0x1 /* PICR1 bit 16 map A */ + +/* MPC107 indirect configuration registers */ + +#define MPC107_CFG_BASE 0x80000000 /* Base adrs of cfg regs */ +#define MPC107_CFG_BASE_16 0x8000 /* MPC107_CFG_BASE >> 16 */ +#define MPC107_PCICMD_ADRS (MPC107_CFG_BASE + 0x04) /* PCI Cmd reg */ +#define MPC107_PCISTAT_ADRS (MPC107_CFG_BASE + 0x06) /* PCI status reg */ +#define MPC107_PCIREVID_ADRS (MPC107_CFG_BASE + 0x08) /* PCI RevId reg */ +#define MPC107_PCISTDPROG_ADRS (MPC107_CFG_BASE + 0x09) /* PCI Standard */ + /* Program Interface */ +#define MPC107_PCISUBCLAS_ADRS (MPC107_CFG_BASE + 0x0a) /* PCI SubClass reg */ +#define MPC107_PCIBASECLAS_ADRS (MPC107_CFG_BASE + 0x0b) /* PCI BaseClas reg */ +#define MPC107_PCICACHLINE_ADRS (MPC107_CFG_BASE + 0x0c) /* PCI Cache Line */ + /* Size reg */ +#define MPC107_PCIHEADER_ADRS (MPC107_CFG_BASE + 0x0d) /* PCI Head Typ reg */ +#define MPC107_PCIBIST_ADRS (MPC107_CFG_BASE + 0x0e) /* PCI BIST reg */ +#define MPC107_LOCMEMBAR_ADRS (MPC107_CFG_BASE + 0x10) /* Local Memory Base */ + /* Address Register */ +#define MPC107_PCSRBAR_ADRS (MPC107_CFG_BASE + 0x14) /* Peripheral Cont */ + /* & Status Register */ + /* Base Address Reg */ +#define MPC107_PCIINTLINE_ADRS (MPC107_CFG_BASE + 0x3c) /* PCI Int Line reg */ +#define MPC107_PCIINTPIN_ADRS (MPC107_CFG_BASE + 0x3d) /* PCI Int Pin reg */ +#define MPC107_PCIMINGNT_ADRS (MPC107_CFG_BASE + 0x3e) /* PCI Min Gran reg */ +#define MPC107_PCIMAXLAT_ADRS (MPC107_CFG_BASE + 0x3f) /* PCI Max Lat reg */ +#define MPC107_PCIARBCONT_ADRS (MPC107_CFG_BASE + 0x46) /* PCI Arb Cont reg */ +#define MPC107_PMCR1_ADRS (MPC107_CFG_BASE + 0x70) /* Power Management */ + /* Config Reg-1 */ +#define MPC107_PMCR2_ADRS (MPC107_CFG_BASE + 0x72) /* Power Management */ + /* Config Reg-2 */ +#define MPC107_ODCR_ADRS (MPC107_CFG_BASE + 0x73) /* out driver reg */ +#define MPC107_CDCR_ADRS (MPC107_CFG_BASE + 0x74) /* Clk Driv Cnt reg */ +#define MPC107_MIOCR_ADRS (MPC107_CFG_BASE + 0x76) /* Misc i/o Cnt reg */ +#define MPC107_EUMBBAR_ADRS (MPC107_CFG_BASE + 0x78) /* Embedded Utilitie */ + /* Memory Block Base */ + /* address */ +#define MPC107_MSAR1_ADRS (MPC107_CFG_BASE + 0x80) /* MSAR1 */ +#define MPC107_XMSAR1_ADRS (MPC107_CFG_BASE + 0x88) /* XMSAR1 */ +#define MPC107_MEAR1_ADRS (MPC107_CFG_BASE + 0x90) /* MEAR1 */ +#define MPC107_XMEAR1_ADRS (MPC107_CFG_BASE + 0x98) /* XMEAR1 */ +#define MPC107_MSAR2_ADRS (MPC107_CFG_BASE + 0x84) /* MSAR2 */ +#define MPC107_XMSAR2_ADRS (MPC107_CFG_BASE + 0x8c) /* XMSAR2 */ +#define MPC107_MEAR2_ADRS (MPC107_CFG_BASE + 0x94) /* MEAR2 */ +#define MPC107_XMEAR2_ADRS (MPC107_CFG_BASE + 0x9c) /* XMEAR2 */ +#define MPC107_MBER_ADRS (MPC107_CFG_BASE + 0xa0) /* MBER */ +#define MPC107_MPMR_ADRS (MPC107_CFG_BASE + 0xa3) /* Page mode reg */ +#define MPC107_PICR1_ADRS (MPC107_CFG_BASE + 0xa8) /* PICR1 adrs */ +#define MPC107_PICR2_ADRS (MPC107_CFG_BASE + 0xac) /* PICR2 adrs */ + +/* MPC107 Diagnostic Registers */ + +#define MPC107_DIAGS_BASE (EUMB_BASE + 0x80000) +#define MCP107_MDP_ERR_INJ_MASK_DH 0xF_F000 /* Data High Err Inject Msk */ +#define MCP107_MDP_ERR_INJ_MASK_DL 0xF_F004 /* Data Low Err Inject Msk */ +#define MCP107_MDP_ERR_INJ_MASK_PAR 0xF_F008 /* Data Par Err Inject Msk */ +#define MCP107_MDP_ERR_CAP_MON_DH 0xF_F00c /* Data High Err Capture Mon */ +#define MCP107_MDP_ERR_CAP_MON_DL 0xF_F010 /* Data Low Err Capture Mon */ +#define MCP107_MDP_ERR_CAP_MON_PAR 0xF_F014 /* Data Par Err Capture Mon */ + + +#define MPC107_PICR1_ADRSMAP_MSK 0x00010000 /* Mask to determine address Map */ + /* PREP or CHRP */ +#define MPC107_ECCSBEC_ADRS (MPC107_CFG_BASE + 0xb8) /* ECC single Bit */ + /* error count Reg */ +#define MPC107_ECCSBETR_ADRS (MPC107_CFG_BASE + 0xb9) /* ECC single Bit */ + /* error trig Reg */ +#define MPC107_ERRENR1_ADRS (MPC107_CFG_BASE + 0xc0) /* Err Enable Reg-1 */ +#define MPC107_ERRDR1_ADRS (MPC107_CFG_BASE + 0xc1) /* Err Detect Reg-1 */ +#define MPC107_PBSES_ADRS (MPC107_CFG_BASE + 0xc3) /* Processor Err Bus */ +#define MPC107_ERRENR2_ADRS (MPC107_CFG_BASE + 0xc4) /* Err Enable reg-2 */ +#define MPC107_ERRDR2_ADRS (MPC107_CFG_BASE + 0xc5) /* Err Detect Reg-2 */ +#define MPC107_PCIBES_ADRS (MPC107_CFG_BASE + 0xc7) /* PCI Bus/Stat Err */ +#define MPC107_PPCIEAR_ADRS (MPC107_CFG_BASE + 0xc8) /* Processor/PCI Bus */ + /* Error address Reg */ +#define MPC107_ADMBO_ADRS (MPC107_CFG_BASE + 0xe0) /* Addr Map B Opt */ +#define MPC107_MCCR1_ADRS (MPC107_CFG_BASE + 0xf0) /* MCCR1 */ +#define MPC107_MCCR2_ADRS (MPC107_CFG_BASE + 0xf4) /* MCCR2 */ +#define MPC107_MCCR3_ADRS (MPC107_CFG_BASE + 0xf8) /* MCCR3 */ +#define MPC107_MCCR4_ADRS (MPC107_CFG_BASE + 0xfc) /* MCCR4 */ + + +/* MPC107 Latency Timer register */ + +#define MPC107_LAT_MAX_HOLD 0xf8 /* max PCI clocks for bus hold */ +#define MPC107_LAT_MIN_LAT 0x07 /* min latency timer value */ + +/* MPC107 - PCI arbiter control Register */ + +#define MPC107_PAC_IAE 0x00008000 /* internal arbiter enabled */ +#define MPC107_PAC_PARK_MASK 0x00006000 /* park mode control mask */ +#define MPC107_PAC_PARK_LAST 0x00000000 /* park mode cntrl, last device */ +#define MPC107_PAC_PARK_REQ0 0x00002000 /* park mode using REQ0/GNT0) */ +#define MPC107_PAC_PARK_MPC107 0x00004000 /* park mode control (MPC107) */ +#define MPC107_PAC_RPCC 0x00000400 /* retry PCI configuration cycle */ +#define MPC107_PAC_PPRI_LVL 0x00000080 /* MPC107 priority level: 1=high */ +#define MPC107_PAC_EDPL_MASK 0x0000000f /* ext dev priority lvl mask */ +#define MPC107_PAC_EDPL_REQ0 0x00000008 /* ext dev pty lvl REQ3/GNT3 */ +#define MPC107_PAC_EDPL_REQ1 0x00000004 /* ext dev pty lvl REQ2/GNT2 */ +#define MPC107_PAC_EDPL_REQ2 0x00000002 /* ext dev pty lvl REQ1/GNT1 */ +#define MPC107_PAC_EDPL_REQ3 0x00000001 /* ext dev pty lvl REQ0/GNT0 */ + +/* MPC107 - power management configuration #1 Register */ + +#define MPC107_PMC1_NO_NAP_MSG 0x00008000 /* no message before nap */ +#define MPC107_PMC1_NO_SLEEP_MSG 0x00004000 /* no message before sleep */ +#define MPC107_PMC1_LP_REF_EN 0x00001000 /* rfrsh enbl in low pwr mode */ +#define MPC107_PMC1_SUSP_QACK 0x00000400 /* QACK_ enable */ +#define MPC107_PMC1_PM 0x00000080 /* power mananagement enable */ +#define MPC107_PMC1_DOZE 0x00000020 /* doze mode */ +#define MPC107_PMC1_NAP 0x00000010 /* nap mode */ +#define MPC107_PMC1_SLEEP 0x00000008 /* sleep mode */ +#define MPC107_PMC1_CKO_MODE_MASK 0x00000006 /* clock output mode - mask */ +#define MPC107_PMC1_CKO_MODE_D 0x00000000 /* clk output mode - disable */ +#define MPC107_PMC1_CKO_MODE_S 0x00000002 /* clk out mode - system clk */ +#define MPC107_PMC1_CKO_MODE_1H 0x00000004 /* clk out mode - 1/2 PCI rate */ +#define MPC107_PMC1_CKO_MODE_P 0x00000006 /* clk out mode - PCI rate */ +#define MPC107_PMC1_CKO_SEL 0x00000001 /* clk out mode select */ + +/* MPC107 - power management configuration #2 Register */ + +#define MPC107_PMC2_DLL_EXTEND 0x00000080 /* extend DLL by a half clock */ +#define MPC107_PMC2_PCI_OHD_MASK 0x00000070 /* PCI out hold delay (mask) */ +#define MPC107_PMC2_PCI_OHD_SHIFT 4 /* PCI out hold delay (shift) */ +#define MPC107_PMC2_SLEEP 0x00000004 /* get PLL when exiting sleep */ +#define MPC107_PMC2_SUSPEND 0x00000002 /* get PLL when exiting suspend*/ +#define MPC107_PMC2_SHARED_MCP 0x00000001 /* disable MCP assertion */ + +/* MPC107 - output driver control Register */ + +#define MPC107_ODC_DRV_PCI 0x00000080 /* PCI drive: 0=hi, 1=med */ +#define MPC107_ODC_DRV_STD 0x00000040 /* STD drive: 0=hi, 1=med */ +#define MPC107_ODC_DRV_MEM_CTRL_MASK 0x00000030 /* mem ctrl drive: mask */ +#define MPC107_ODC_DRV_MEM_CTRL_40 0x00000000 /* mem ctrl drive: 40-ohms */ +#define MPC107_ODC_DRV_MEM_CTRL_20 0x00000010 /* mem ctrl drive: 20-ohms */ +#define MPC107_ODC_DRV_MEM_CTRL_13_3 0x00000020 /* mem ctrl drive: 13.3-ohms */ +#define MPC107_ODC_DRV_MEM_CTRL_8 0x00000030 /* mem ctrl drive: 8-ohms */ +#define MPC107_ODC_DRV_PCI_CLK_MASK 0x0000000c /* PCI clock drive: mask */ +#define MPC107_ODC_DRV_PCI_CLK_40 0x00000000 /* PCI clock drive: 40-ohms */ +#define MPC107_ODC_DRV_PCI_CLK_20 0x00000004 /* PCI clock drive: 20-ohms */ +#define MPC107_ODC_DRV_PCI_CLK_13_3 0x00000008 /* PCI clock drive: 13.3-ohms */ +#define MPC107_ODC_DRV_PCI_CLK_8 0x0000000c /* PCI clock drive: 8-ohms */ +#define MPC107_ODC_DRV_MEM_CLK_MASK 0x00000003 /* mem clock drive: mask */ +#define MPC107_ODC_DRV_MEM_CLK_40 0x00000000 /* mem clock drive: 40-ohms */ +#define MPC107_ODC_DRV_MEM_CLK_20 0x00000001 /* mem clock drive: 20-ohms */ +#define MPC107_ODC_DRV_MEM_CLK_13_3 0x00000002 /* mem clock drive: 13.3-ohms */ +#define MPC107_ODC_DRV_MEM_CLK_8 0x00000003 /* mem clock drive: 8-ohms */ + +/* MPC107 - clock driver control Register */ + +#define MPC107_CDC_PCI_CLK_0 0x00004000 /* PCI_CLK(0) disable */ +#define MPC107_CDC_PCI_CLK_1 0x00002000 /* PCI_CLK(1) disable */ +#define MPC107_CDC_PCI_CLK_2 0x00001000 /* PCI_CLK(2) disable */ +#define MPC107_CDC_PCI_CLK_3 0x00000800 /* PCI_CLK(3) disable */ +#define MPC107_CDC_PCI_CLK_4 0x00000400 /* PCI_CLK(4) disable */ +#define MPC107_CDC_SDRAM_CLK_0 0x00000040 /* SDRAM_CLK(0) disable */ +#define MPC107_CDC_SDRAM_CLK_1 0x00000020 /* SDRAM_CLK(1) disable */ +#define MPC107_CDC_SDRAM_CLK_2 0x00000010 /* SDRAM_CLK(2) disable */ +#define MPC107_CDC_SDRAM_CLK_3 0x00000008 /* SDRAM_CLK(3) disable */ + +/* MPC107 - processor interface configuration #1 Register */ + +#define MPC107_PIC1_CF_BREAD_WS_MASK 0x00c00000 /* wait states mask */ +#define MPC107_PIC1_CF_BREAD_WS_SHIFT 22 /* wait states shift */ +#define MPC107_PIC1_RCS0 0x00100000 /* ROM location */ +#define MPC107_PIC1_PROC_TYPE_MASK 0x00060000 /* processor type mask */ +#define MPC107_PIC1_PROC_TYPE_SHIFT 17 /* processor type shift */ +#define MPC107_PIC1_ADDRESS_MAP 0x00010000 /* address map */ +#define MPC107_PIC1_FLASH_WR_EN 0x00001000 /* FLASH write enable */ +#define MPC107_PIC1_MCP_EN 0x00000800 /* machine check enable */ +#define MPC107_PIC1_CF_DPARK 0x00000200 /* processor data bus park */ +#define MPC107_PIC1_STORE_GATHER 0x00000040 /* store gathering enable */ +#define MPC107_PIC1_ENDIAN_MODE 0x00000020 /* endian mode */ +#define MPC107_PIC1_CF_LOOP_SNOOP 0x00000010 /* PCI-to-mem snoop loop en */ +#define MPC107_PIC1_CF_APARK 0x00000008 /* processor addr bus park */ +#define MPC107_PIC1_SPECULATIVE 0x00000004 /* speculative PCI from */ + /* memory read enable */ + +/* MPC107 - processor interface configuration #2 Register */ + +#define MPC107_PIC2_NO_SER_ON_CFG 0x20000000 /* disable PCI serialization */ +#define MPC107_PIC2_NO_SNOOP_EN 0x08000000 /* disable PCI snoop */ +#define MPC107_PIC2_CF_FF0_LOCAL 0x04000000 /* ROM PCI address map */ +#define MPC107_PIC2_FLSH_WR_LCK_EN 0x02000000 /* disable FLASH writes */ +#define MPC107_PIC2_CF_SNOOP_WS_M 0x00c00000 /* snoop addr phase wait state*/ +#define MPC107_PIC2_CF_SNOOP_WS_S 18 /* snoop addr wait shift */ +#define MPC107_PIC2_CF_APHASE_WS_M 0x0000000c /* proc addr phase wait states*/ +#define MPC107_PIC2_CF_APHASE_WS_S 2 /* proc addr phase wait shift */ + +/* MPC107 - emulation support */ + +#define MPC107_ES_CPU_FD_ALIAS_EN 0x00000080 /* forward FDxxxxxx to PCI */ +#define MPC107_ES_PCI_FD_ALIAS_EN 0x00000040 /* forward FDxxxxxx to CPU */ +#define MPC107_ES_DLL_RESET 0x00000020 /* reset the DLL */ +#define MPC107_ES_PCI_COMPAT_HOLE 0x00000008 /* PCI compatibil hole enable */ +#define MPC107_ES_PROC_COMPAT_HOLE 0x00000004 /* proc compatibility hole en */ + +/* MPC107 - error enable #1 Register */ + +#define MPC107_EE1_PCI_TARG_ABORT 0x00000080 /* PCI target abort */ +#define MPC107_EE1_PCI_PERR_SLAVE 0x00000040 /* PCI slace PERR */ +#define MPC107_EE1_MEM_SELECT 0x00000020 /* memory select */ +#define MPC107_EE1_MEM_REFRESH 0x00000010 /* memory refresh overflow */ +#define MPC107_EE1_PCI_PERR_MSTR 0x00000008 /* PCI master PERR */ +#define MPC107_EE1_MEM_READ_PARITY 0x00000004 /* memory read parity */ +#define MPC107_EE1_PCI_MSTR_ABORT 0x00000002 /* PCI master abort */ +#define MPC107_EE1_LOCAL_BUS_ERROR 0x00000001 /* local bus error */ + +/* MPC107 - error detection #1 Register */ + +#define MPC107_ED1_SERR 0x00000080 /* SERR_ received */ +#define MPC107_ED1_PCI_PERR_SLAVE 0x00000040 /* PCI slace PERR */ +#define MPC107_ED1_MEM_SELECT 0x00000020 /* memory select */ +#define MPC107_ED1_MEM_REFRESH 0x00000010 /* memory refresh overflow */ +#define MPC107_ED1_CYCLE_SPACE 0x00000008 /* cycle type: 0=local, 1=PCI */ +#define MPC107_ED1_MEM_READ_PARITY 0x00000004 /* memory read parity */ +#define MPC107_ED1_ULBC_MASK 0x00000003 /* unsupported local bus */ + /* cycle mask */ +#define MPC107_ED1_ULBC_NO_ERROR 0x00000000 /* no error detected */ +#define MPC107_ED1_ULBC_UTA 0x00000001 /* unsupported transfer */ + /* attributes */ + +/* MPC107 - CPU Bus Error Status Register */ + +#define MPC107_CPU_BUS_ERR_TT_MASK 0x000000f8 +#define MPC107_CPU_BUS_ERR_TSIZ_MASK 0x00000007 + +/* MPC107 - error enable #2 */ + +#define MPC107_EE2_PCI_ADRS_PARITY 0x00000080 /* PCI address parity error */ +#define MPC107_EE2_ECC_MULTIBIT 0x00000008 /* ECC multi-bit error */ +#define MPC107_EE2_60X_MEM_WRITE_P 0x00000004 /* 60X mem write parity error */ +#define MPC107_EE2_FLASH_ROM_WRITE 0x00000001 /* Flash ROM write error */ + +/* MPC107 - error detection #2 Register */ + +#define MPC107_ED2_IEA 0x00000080 /* invalid error address */ +#define MPC107_ED2_ECC_MULTIBIT 0x00000008 /* ECC multi-bit error */ +#define MPC107_ED2_60X_MEM_WRITE_P 0x00000004 /* 60X mem write parity error */ +#define MPC107_ED2_FLASH_ROM_WRITE 0x00000001 /* Flash ROM write error */ + +/* MCP107 - PCI Bus Error Status Register */ + +#define MPC107_CPU_BUS_TARGET 0x00000010 /* 1=bus target,0=bus master */ +#define MPC107_CPU_BUS_ERR_C_BE_MASK 0x0000000f /* Bus Error Status mask */ + + +/* Address MAP B Options register */ + +#define MPC107_ADMBO_PROC_HOLE 0x00000004 /* Processor compatability hole */ +#define MPC107_ADMBO_PCI_HOLE 0x00000008 /* PCI compatabilty hole */ +#define MPC107_ADMBO_PCI_ALIAS 0x00000040 /* PCI alias */ +#define MPC107_ADMBO_CPU_ALIAS 0x00000080 /* CPU alias */ + +#define MPC107_ADMBO_DEFAULT 0x0 + + +/* Default Settings & values for MPC107 Registers */ + +#define MPC107_PCICMD_DEFAULT 0x00000006 /* PCI COMMAND Default value */ +#define MPC107_PICR1_DEFAULT 0xff041a18 /* PICR1 setting Flash */ + /* writing Enabled */ +#define MPC107_PICR2_DEFAULT 0x04040000 /* PICR2 setting with Write */ + /* Operations to Flash Enabled */ +#define MPC107_FLASH_WRITE_BIT (0x1 << 12) /* Flash Write Enable Bit */ + +/* PPC Decrementer - used as vxWorks system clock */ + +#define MPC107_DELTA(a,b) (abs((int)a - (int)b)) + +/* High and low words of bit-mask of read-only bits in PICR1 */ + +#define MPC107_PICR1_ROBITS_16 0x0011 /* Mask of Readonly bits */ +#define MPC107_PICR1_ROBITS_00 0x0000 /* Mask of Readonly bits */ +#define MPC107_EUMBBAR_VAL 0x80500000 /* Base address of EUMBBAR Reg */ + +#define MPC107_PCSRBAR_VAL 0x80500000 /* Base addr of PCRBARVAL Reg */ + +#define MPC107_ODCR_DATA 0xff /* default ODCR data */ + +#define MPC107_DEFAULT_BUS_CLOCK 33000000 /* 33 Mhz */ +#define MPC107_DEFAULT_TIMER_CLOCK 33000000/8 /* 33Mhz /8 */ + +#ifndef SYNC +# define SYNC WRS_ASM ("sync") +#endif /* SYNC */ + + +/* Swap of four bytes : ABCD becomes DCBA */ + +#define MPC107LONGSWAP(x) LONGSWAP(x) + +/* Swap of two bytes : AB becomes BA */ + +#define MPC107WORDSWAP(x) WORDSWAP(x) + +/* Macro to read Data from a register in EUMBBAR space */ + +#define MPC107EUMBBARREAD(regNum) MPC107LONGSWAP(*(ULONG *) \ + (MPC107_EUMBBAR_VAL + regNum)) + +/* Macro to write Data to a register in EUMBBAR space */ + +#define MPC107EUMBBARWRITE(regNum,regVal) \ + *(ULONG *)(MPC107_EUMBBAR_VAL + regNum) = MPC107LONGSWAP(regVal) + +/* Macro to read Data from a register in PCSRBAR space */ + +#define MPC107EUMBBARREAD(regNum) MPC107LONGSWAP(*(ULONG *) \ + (MPC107_EUMBBAR_VAL + regNum)) + +/* Macro to write Data to a register in PCSRBAR space */ + +#define MPC107PCSRBARWRITE(regNum,regVal) \ + *(ULONG *) (PCSRBAR_VAL + regNum) = MPC107LONGSWAP(regVal) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmpc107h */ + diff --git a/h/drv/multi/mpc107I2c.h b/h/drv/multi/mpc107I2c.h new file mode 100644 index 0000000..db6b1c8 --- /dev/null +++ b/h/drv/multi/mpc107I2c.h @@ -0,0 +1,150 @@ +/* mpc107I2c.h - MPC107 I2C registers definition's and values */ + +/* Copyright 1984-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,06jun00,bri written +*/ + +#ifndef __INCmpc107I2ch +#define __INCmpc107I2ch + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "mpc107.h" + +/* defines */ + +/* command identifiers for I2C */ + +#define MPC107_I2C_READOP 0 /* read operation */ +#define MPC107_I2C_WRITOP 1 /* write operation */ +#define MPC107_I2C_FRMTOP 2 /* format operation */ +#define MPC107_I2C_CHCKOP 3 /* check operation */ + + +/* MPC107 configuration registers for I2C interface */ + +#define MPC107_I2C_EUMBBAR 0x3000 + +#define MPC107_I2C_I2CADR (MPC107_I2C_EUMBBAR + 0x0) /* I2C address reg */ +#define MPC107_I2C_I2CFDR (MPC107_I2C_EUMBBAR + 0x4) /* I2C freq div reg */ +#define MPC107_I2C_I2CCR (MPC107_I2C_EUMBBAR + 0x8) /* I2C control reg */ +#define MPC107_I2C_I2CSR (MPC107_I2C_EUMBBAR + 0xc) /* I2C status reg */ +#define MPC107_I2C_I2CDR (MPC107_I2C_EUMBBAR + 0x10) /* I2C data reg */ + + +/* I2C Register masks */ + +#define MPC107_I2CADR_MASK 0x000000FE /* Address Mask */ +#define MPC107_I2CFDR_MASK 0x0000003F /* Freq Div Mask */ +#define MPC107_I2CCR_MASK 0x000000FC /* Control Reg Mask */ +#define MPC107_I2CSR_MASK 0x000000F7 /* Staus Reg Mask */ +#define MPC107_I2CDR_MASK 0x000000FF /* Data Reg Mask */ + + +/* MPC107 I2C Control register bit definitions */ + +#define MPC107_I2CCR_MEN 0x00000080 /* module enable */ +#define MPC107_I2CCR_MIEN 0x00000040 /* module interrupt enable */ +#define MPC107_I2CCR_MSTA 0x00000020 /* master/slave mode */ +#define MPC107_I2CCR_MTX 0x00000010 /* transmit/receiver mode */ +#define MPC107_I2CCR_TXAK 0x00000008 /* transfer ack enable */ +#define MPC107_I2CCR_RSTA 0x00000004 /* repeat start */ + + +/* MPC107 I2C Status register Bit values */ + +#define MPC107_I2CSR_MCF 0x00000080 /* data transferring */ +#define MPC107_I2CSR_MAAS 0x00000040 /* addressed as a slave */ +#define MPC107_I2CSR_MBB 0x00000020 /* bus busy */ +#define MPC107_I2CSR_MAL 0x00000010 /* arbitration lost */ +#define MPC107_I2CSR_SRW 0x00000004 /* slave read/write */ +#define MPC107_I2CSR_MIF 0x00000002 /* module interrupt */ +#define MPC107_I2CSR_RXAK 0x00000001 /* receive ack */ + + +/* Frequency Divider Register's definitions */ + +#define MPC107_DFFSR_DATA 0x10 /* Digital Filter Freq Sampling rate */ +#define MPC107_FDR_DATA 0x20 /* Frequency Divider Ratio */ + +/* Default value of Freq Divider Reg */ + +#define MPC107_I2CFDR_DEFAULT (MPC107_FDR_DATA) | (MPC107_DFFSR_DATA << 8) + + + +/* Address Data Register's definition */ + +#define MPC107_ADR_DATA 0x10 /* Slave Address */ +#define MPC107_I2CADR_DEFAULT (MPC107_ADR_DATA) /* Default */ + /* value of */ + /* Add Data Reg */ +#define MPC107_I2C_DEVICE_ADDR_MASK 0xf7 /* Device Address Mask */ + +#define MPC107_I2C_DEVICE_READ_ENABLE 0x1 /* Read enable */ + + +/* Control Register Definitions */ + +#define MPC107_I2CCR_DEFAULT MPC107_I2CCR_MSTA /* Default value of */ + /* Control Register */ + + +/* General definitions */ + +#define MPC107_I2C_WRITE 0x0 /* Write */ +#define MPC107_I2C_READ 0x1 /* Read */ +#define MPC107_I2C_READ_OR_WRITE 0x2 /* Read OR write */ +#define MPC107_I2C_READ_AND_WRITE 0x3 /* Read AND write */ +#define MPC107_I2C_READ_ANDOR_WRITE 0x4 /* Read AND OR write */ + + +/* error codes */ + +#define MPC107_I2C_ERR_CYCLE_START 1 /* start cycle */ +#define MPC107_I2C_ERR_CYCLE_STOP 2 /* stop cycle */ +#define MPC107_I2C_ERR_CYCLE_READ 3 /* read cycle */ +#define MPC107_I2C_ERR_CYCLE_WRITE 4 /* write cycle */ +#define MPC107_I2C_ERR_CYCLE_ACKIN 5 /* acknowledge in cycle */ +#define MPC107_I2C_ERR_CYCLE_ACKOUT 6 /* acknowledge out cycle */ +#define MPC107_I2C_ERR_KNOWN_STATE 7 /* known state */ +#define MPC107_I2C_ERR_CYCLE_TIMEOUT (1<<16) /* cycle timed out */ + + + +/* typedefs */ + +/* driver command packet */ + +typedef struct mpc107I2cCmdPckt + { + INT32 command; /* command identifier */ + INT32 status; /* status (error code) */ + UINT32 memoryAddress; /* memory address */ + UINT32 nBytes; /* number of bytes to transfer */ + }MPC107_I2C_CMD_PCKT; + + + +/* function declarations */ + +IMPORT VOID mpc107I2cInit (); +IMPORT INT32 mpc107i2cRead (UINT32 deviceAddress, UINT32 numBytes, + char *pBuf); +IMPORT INT32 mpc107i2cWrite (UINT32 deviceAddress, UINT32 numBytes, + char *pBuf); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmpc107I2ch */ + diff --git a/h/drv/multi/mpc107Msg.h b/h/drv/multi/mpc107Msg.h new file mode 100644 index 0000000..6254776 --- /dev/null +++ b/h/drv/multi/mpc107Msg.h @@ -0,0 +1,208 @@ +/* mpc107Msg.h - MPC107 Message Unit register numbers and values */ + +/* Copyright 1984-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,06jun00,bri written +*/ + +#ifndef __INCmpc107Msgh +#define __INCmpc107Msgh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "mpc107.h" + +/* defines */ + +/* MPC107 configuration registers for Message Unit */ + +#define MPC107_MSG_IMR0 0x50 /* Inbound message register 0 */ +#define MPC107_MSG_IMR1 0x54 /* Inbound message register 1 */ +#define MPC107_MSG_OMR0 0x58 /* Outbound message register 0 */ +#define MPC107_MSG_OMR1 0x5C /* Outbound message register 1 */ +#define MPC107_MSG_ODBR 0x60 /* Outbound doorbell register */ +#define MPC107_MSG_IDBR 0x68 /* Inbound doorbell register */ +#define MPC107_MSG_EDBMR 0x70 /* Extended doorbell mask register */ +#define MPC107_MSG_EDBSR 0x78 /* Extended doorbell status register */ +#define MPC107_MSG_EDBW1C 0x80 /* Extended doorbell write 1 clear register */ +#define MPC107_MSG_EDBW1S 0x88 /* Extended doorbell write 1 set register */ + +/* MPC107 Configuration registers for I2O */ + +#define MPC107_MSG_I2O_IMISR 0x100 /* Inbound message interrupt status reg */ +#define MPC107_MSG_I2O_IMIMR 0x104 /* Inbound message interrupt mask reg */ +#define MPC107_MSG_I2O_IFHPR 0x120 /* Inbound free_FIFO head pointer reg */ +#define MPC107_MSG_I2O_IFTPR 0x128 /* Inbound free_FIFO tail pointer reg */ +#define MPC107_MSG_I2O_IPHPR 0x130 /* Inbound post_FIFO head pointer reg */ +#define MPC107_MSG_I2O_IPTPR 0x138 /* Inbound post_FIFO tail pointer reg */ +#define MPC107_MSG_I2O_OFHPR 0x140 /* Outbound free_FIFO head pointer reg */ +#define MPC107_MSG_I2O_OFTPR 0x148 /* Outbound free_FIFO tail pointer reg */ +#define MPC107_MSG_I2O_OPHPR 0x150 /* Outbound post_FIFO head pointer reg */ +#define MPC107_MSG_I2O_OPTPR 0x158 /* Outbound post_FIFO tail pointer reg */ +#define MPC107_MSG_I2O_MUCR 0x164 /* Messaging unit control reg */ +#define MPC107_MSG_I2O_QBAR 0x170 /* Queue base address register */ + +#define MPC107_MSG_I2O_PCI_OMISR 0x30 /* Outbound message int status Reg */ +#define MPC107_MSG_I2O_PCI_OMIMR 0x34 /* Outbound message int mask Reg */ +#define MPC107_MSG_I2O_PCI_IFQPR 0x40 /* Inbound FIFO queue port reg */ +#define MPC107_MSG_I2O_PCI_OFQPR 0x44 /* Outbound FIFO queue port reg */ + + +/* Message Unit (I2O) Register Bit Definitions */ + +/* Outbound Message Interrupt Status Register */ + +#define MPC107_MSG_I2O_OPQI 0x00000020 /* Outbound Post Queue Interrupt */ +#define MPC107_MSG_I2O_ODI 0x00000008 /* Outbound Doorbell Interrupt */ +#define MPC107_MSG_I2O_OM1I 0x00000002 /* Outbound Message 1 Interrupt */ +#define MPC107_MSG_I2O_OM0I 0x00000001 /* Outbound Message 0 Interrupt */ + +/* Outbound Message Interrupt Mask Register */ + +#define MPC107_MSG_I2O_OPQIM 0x00000020 /* Out Post Queue Interrupt Mask */ +#define MPC107_MSG_I2O_ODIM 0x00000008 /* Out Doorbell Interrupt Mask */ +#define MPC107_MSG_I2O_OM1IM 0x00000002 /* Outbound Msg 1 Interrupt Mask */ +#define MPC107_MSG_I2O_OM0IM 0x00000001 /* Outbound Msg 0 Interrupt Mask */ + +/* Inbound Message Interrupt Status Register */ + +#define MPC107_MSG_I2O_OFOI 0x00000100 /* Outbound Free Overflow Int */ +#define MPC107_MSG_I2O_IPOI 0x00000080 /* Inbound Post Overflow Int */ +#define MPC107_MSG_I2O_IPQI 0x00000020 /* Inbound Post Queue Interrupt */ +#define MPC107_MSG_I2O_MCI 0x00000010 /* Machine Check Interrupt */ +#define MPC107_MSG_I2O_IDI 0x00000008 /* Inbound Doorbell Interrupt */ +#define MPC107_MSG_I2O_IM1I 0x00000002 /* Inbound Message 1 Interrupt */ +#define MPC107_MSG_I2O_IM0I 0x00000001 /* Inbound Message 0 Interrupt */ + +/* Inbound Message Interrupt Mask Register */ + +#define MPC107_MSG_I2O_OFOIM 0x00000100 /* Outbound Free Ovrflow Mask */ +#define MPC107_MSG_I2O_IPOIM 0x00000080 /* Inbound Post Overflow Mask */ +#define MPC107_MSG_I2O_IPQIM 0x00000020 /* Inbound Post Queue Mask */ +#define MPC107_MSG_I2O_MCIM 0x00000010 /* Machine Check Mask */ +#define MPC107_MSG_I2O_IDIM 0x00000008 /* Inbound Doorbell Mask */ +#define MPC107_MSG_I2O_IM1IM 0x00000002 /* Inbound Message 1 Mask */ +#define MPC107_MSG_I2O_IM0IM 0x00000001 /* Inbound Message 0 Mask */ + +/* Inbound FIFO Pointer Registers */ + +#define MPC107_MSG_I2O_IN_QBA 0xfff00000 /* Inbound Queue Base Addr */ +#define MPC107_MSG_I2O_IN_FIFOPTR 0x000ffffc /* In FIFO pointer offset */ + +/* Outbound FIFO Pointer Registers */ + +#define MPC107_MSG_I2O_OUT_QBA 0xfff00000 /* Outbound Queue Base Addr */ +#define MPC107_MSG_I2O_OUT_FIFOPTR 0x000ffffc /* Out FIFO pointer offset */ + + +/* I2O Messaging Unit Control Register */ + +#define MPC107_MSG_I2O_CQS 0x0000003e /* circular queue size mask */ +#define MPC107_MSG_I2O_CQS_16K 0x00000002 /* 4K entries, 16K bytes */ +#define MPC107_MSG_I2O_CQS_32K 0x00000004 /* 8K entries, 32K bytes */ +#define MPC107_MSG_I2O_CQS_64K 0x00000008 /* 16K entries, 64K bytes */ +#define MPC107_MSG_I2O_CQS_128K 0x00000010 /* 32K entries, 128K bytes */ +#define MPC107_MSG_I2O_CQS_256K 0x00000020 /* 64K entries, 256K bytes */ +#define MPC107_MSG_I2O_CQE 0x00000001 /* circular queue enable */ +#define MPC107_MSG_I2O_MUCR_DEFAULT MPC107_MSG_I2O_CQS_16K /* Default CQ Size */ +#define MPC107_MSG_I2O_CQS_ALIGN 20 /* 1 Mb Memory alignment */ + +#define MPC107_MSG_16KSIZE 0x1000 /* 4K Words */ +#define MPC107_MSG_I2O_CQS_16K_SIZE (MPC107_MSG_16KSIZE * 1) /* 4K Words */ +#define MPC107_MSG_I2O_CQS_32K_SIZE (MPC107_MSG_16KSIZE * 2) /* 8K Words */ +#define MPC107_MSG_I2O_CQS_64K_SIZE (MPC107_MSG_16KSIZE * 4) /* 16K Words */ +#define MPC107_MSG_I2O_CQS_128K_SIZE (MPC107_MSG_16KSIZE * 8) /* 32K Words */ +#define MPC107_MSG_I2O_CQS_256K_SIZE (MPC107_MSG_16KSIZE * 16)/* 64K Words */ + +#define MPC107_MSG_I2O_MFRAME_SIZE 0x20 /* Message Frame size 128 bytes */ + /* 32 words */ +#define MPC107_MSG_I2O_MUCR_QBAR_ALIGN 0x100000 /* 1 Mbytes */ + + +/* Inbound/Outbound Door Bell Register Definitions */ + +#define MPC107_MSG_IDBR_DATA_MASK 0xefffffff /* IDBR Data Mask */ +#define MPC107_MSG_IDBR_MC_SHIFT 31 /* IDBReg Machine Check Mask */ +#define MPC107_MSG_IDBR_MC_BIT 0x80000000 /* IDBR Machine Check Bit */ +#define MPC107_MSG_ODBR_DATA_MASK 0x1fffffff /* ODBR Data Mask */ + +/* Extended Doorbell register definitions */ + +#define MPC107_MSG_EDBMR_INTAIM_BIT 0x00000001 /* EDMBR INTA */ + /* Interrupt mask bit */ +#define MPC107_MSG_EDBMR_C0IM_BIT 0x00000008 /* EDMBR CPU */ + /* Interrupt mask bit */ +#define MPC107_MSG_EDBW1S_INTA_MSK 0xff000000 /* EDBW1S Reg INTA mask */ +#define MPC107_MSG_EDBW1S_INTA_SHIFT 24 /* EDBW1S Reg INTA shift */ +#define MPC107_MSG_EDBW1S_CP0_MSK 0x00ff0000 /* EDBW1S Reg CPU INT mask */ +#define MPC107_MSG_EDBW1S_CP0_SHIFT 16 /* EDBW1S Reg CPU INT shift */ + +/* I2O Queue Base Address Register */ + +#define MPC107_MSG_I2O_QBA 0xfff00000 /* queue base address bits */ + +/* General definitions */ + +#define MPC107_MSG_WRITE 0x0 /* Read */ +#define MPC107_MSG_READ 0x1 /* Write */ +#define MPC107_MSG_READ_OR_WRITE 0x2 /* Read OR Write */ +#define MPC107_MSG_READ_AND_WRITE 0x3 /* Read AND Write */ +#define MPC107_MSG_READ_ANDOR_WRITE 0x4 /* Read ANDOR Write */ +#define MPC107_MSG_INBOUND 0x01 /* In Bound */ +#define MPC107_MSG_OUTBOUND 0x02 /* Out Bound*/ + + +#define MPC107_MSG_GENERAL_LSB_MSK 0xff /* LSB Mask */ + +#define MPC107_MSG_INTAGEN 0x0 /* Generate INTA Interrupt */ +#define MPC107_MSG_CP0GEN 0x1 /* Generate CPU Interrupt */ + +#define MPC107_MSG_REGISTER0 0x0 /* Message Regiter 0 */ +#define MPC107_MSG_REGISTER1 0x1 /* Message Regiter 1 */ + +#define MPC107_MSG_I2O_NO_FREE_MFA 0xffffffff /* No MFA's are available */ +#define MPC107_MSG_I2O_FIFO_EMPTY 0xffffffff /* FIFO is empty */ + + +/* error Values */ + +#define MPC107_MSG_CHOUT_RANGE 0x10 /* Channel out of range */ +#define MPC107_MSG_REGOUT_RANGE 0x11 /* Register out of range */ +#define MPC107_MSG_UNDEF_REG 0x12 /* Undefined Register */ +#define MPC107_MSG_UNDEF_INT_TYPE 0x13 /* Undefined Interrupt type */ + +/* function declarations */ + +IMPORT void mpc107MsgMessageHostInit(void); +IMPORT void mpc107MsgMessagePeripheralInit(void); +IMPORT STATUS mpc107MsgExtDoorbellInit (UINT32 cpuIntA); +IMPORT STATUS mpc107MsgMessageWrite (UINT32 inOutBound, + UINT32 messageRegNum, + UINT32 message); +IMPORT STATUS mpc107MsgMessageRead (UINT32 inOutBound, UINT32 messageRegNum, + UINT32 *pMessageRead ); +IMPORT STATUS mpc107MsgDoorbellWrite (UINT32 inOutBound, UINT32 message, + UINT32 machineCheck); +IMPORT STATUS mpc107MsgDoorbellRead (UINT32 inOutBound, + UINT32 *pMsgDoorbellRead); +IMPORT STATUS mpc107MsgExtDoorbellSetWrite (UINT32 message, UINT32 cpuIntA); +IMPORT ULONG mpc107MsgExtDoorbellClrRead (void); +IMPORT STATUS mpc107MsgI2oInit (void); +IMPORT void mpc107MsgI2oInboundRead (void); +IMPORT STATUS mpc107MsgI2oInboundWrite (UINT32 *pBuf); +IMPORT void mpc107MsgI2oOutboundRead (void); +IMPORT void mpc107MsgI2oOutboundWrite (UINT32 *pBuf); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmpc107Msgh */ + diff --git a/h/drv/multi/msc01.h b/h/drv/multi/msc01.h new file mode 100644 index 0000000..2eeaf60 --- /dev/null +++ b/h/drv/multi/msc01.h @@ -0,0 +1,1577 @@ +/* msc01.h - MIPS System Controller bridge device header */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 2004 MIPS Technologies, Inc. All rights reserved. + * + * + * Unpublished rights (if any) reserved under the copyright laws of the + * United States of America and other countries. + * + * This code is proprietary to MIPS Technologies, Inc. ("MIPS + * Technologies"). Any copying, reproducing, modifying or use of this code + * (in whole or in part) that is not expressly permitted in writing by MIPS + * Technologies or an authorized third party is strictly prohibited. At a + * minimum, this code is protected under unfair competition and copyright + * laws. Violations thereof may result in criminal penalties and fines. + * + * MIPS Technologies reserves the right to change this code to improve + * function, design or otherwise. MIPS Technologies does not assume any + * liability arising out of the application or use of this code, or of any + * error or omission in such code. Any warranties, whether express, + * statutory, implied or otherwise, including but not limited to the implied + * warranties of merchantability or fitness for a particular purpose, are + * excluded. Except as expressly provided in any written license agreement + * from MIPS Technologies or an authorized third party, the furnishing of + * this code does not give recipient any license to any intellectual + * property rights, including any patent rights, that cover this code. + * + * This code shall not be exported, reexported, transferred, or released, + * directly or indirectly, in violation of the law of any country or + * international law, regulation, treaty, Executive Order, statute, + * amendments or supplements thereto. Should a conflict arise regarding the + * export, reexport, transfer, or release of this code, the laws of the + * United States of America shall be the governing law. + * + * This code constitutes one or more of the following: commercial computer + * software, commercial computer software documentation or other commercial + * items. If the user of this code, or any related documentation of any + * kind, including related technical data or manuals, is an agency, + * department, or other entity of the United States government + * ("Government"), the use, duplication, reproduction, release, + * modification, disclosure, or transfer of this code, or any related + * documentation of any kind, is restricted in accordance with Federal + * Acquisition Regulation 12.212 for civilian agencies and Defense Federal + * Acquisition Regulation Supplement 227.7202 for military agencies. The use + * of this code by the Government is further restricted in accordance with + * the terms of the license agreement(s) and/or applicable contract terms + * and conditions covering this code from MIPS Technologies or an authorized + * third party. + */ + +/* +modification history +-------------------- +01b,10mar05,kkz Removing double-slash comments, for Linux compiler +01c,10mar05,pes Removed C++-style comment lines +01b,04mar05,pes Apigen fixes. +01a,09feb05,pes Information compiled from multiple Yamon header files. +*/ + +/* + * this file contains register offsets and programming values for the + * MIPS Technologies SOC-it(tm) bridge chip (system controller). + */ + +#ifndef __INCmsc01h +#define __INCmsc01h + +#ifdef __cplusplus +extern "C" { +#endif + +/* System Controller ID in MSC01_SC_ID */ +#define MSC01_ID_SC_EC32 0x01 +#define MSC01_ID_SC_EC64 0x02 +#define MSC01_ID_SC_MGB 0x03 +#define MSC01_ID_SC_MGBIIA36D64C0IO 0x06 +#define MSC01_ID_SC_OCP 0x08 + +/* + **************************************************************************** + * Register offset addresses + *************************************************************************** + */ + +#define MSC01_SC_ID_OFS 0x0000 +#define MSC01_SC_SYSID_OFS 0x0008 +#define MSC01_SC_ERR_OFS 0x0108 +#define MSC01_SC_CFG_OFS 0x0110 +#define MSC01_BIU_IP1BAS1H_OFS 0x0200 +#define MSC01_BIU_IP1BAS1L_OFS 0x0208 +#define MSC01_BIU_IP1MSK1H_OFS 0x0210 +#define MSC01_BIU_IP1MSK1L_OFS 0x0218 +#define MSC01_BIU_IP1BAS2H_OFS 0x0240 +#define MSC01_BIU_IP1BAS2L_OFS 0x0248 +#define MSC01_BIU_IP1MSK2H_OFS 0x0250 +#define MSC01_BIU_IP1MSK2L_OFS 0x0258 +#define MSC01_BIU_IP2BAS1H_OFS 0x0280 +#define MSC01_BIU_IP2BAS1L_OFS 0x0288 +#define MSC01_BIU_IP2MSK1H_OFS 0x0290 +#define MSC01_BIU_IP2MSK1L_OFS 0x0298 +#define MSC01_BIU_IP2BAS2H_OFS 0x02c0 +#define MSC01_BIU_IP2BAS2L_OFS 0x02c8 +#define MSC01_BIU_IP2MSK2H_OFS 0x02d0 +#define MSC01_BIU_IP2MSK2L_OFS 0x02d8 +#define MSC01_BIU_IP3BAS1H_OFS 0x0300 +#define MSC01_BIU_IP3BAS1L_OFS 0x0308 +#define MSC01_BIU_IP3MSK1H_OFS 0x0310 +#define MSC01_BIU_IP3MSK1L_OFS 0x0318 +#define MSC01_BIU_IP3BAS2H_OFS 0x0340 +#define MSC01_BIU_IP3BAS2L_OFS 0x0348 +#define MSC01_BIU_IP3MSK2H_OFS 0x0350 +#define MSC01_BIU_IP3MSK2L_OFS 0x0358 +#define MSC01_BIU_MCBAS1H_OFS 0x0380 +#define MSC01_BIU_MCBAS1L_OFS 0x0388 +#define MSC01_BIU_MCMSK1H_OFS 0x0390 +#define MSC01_BIU_MCMSK1L_OFS 0x0398 +#define MSC01_BIU_MCBAS2H_OFS 0x03c0 +#define MSC01_BIU_MCBAS2L_OFS 0x03c8 +#define MSC01_BIU_MCMSK2H_OFS 0x03d0 +#define MSC01_BIU_MCMSK2L_OFS 0x03d8 +#define MSC01_BIU_RBBASH_OFS 0x07f0 +#define MSC01_BIU_RBBASL_OFS 0x07f8 +#define MSC01_BIU_IP1CTRL_OFS 0x0800 +#define MSC01_BIU_IP2CTRL_OFS 0x0808 +#define MSC01_BIU_IP3CTRL_OFS 0x0810 +#define MSC01_BIU_MCCTRL_OFS 0x0818 + +/* + **************************************************************************** + * Register encodings + *************************************************************************** + */ + +#define MSC01_SC_ID_ID_SHF 16 +#define MSC01_SC_ID_ID_MSK 0x00ff0000 +#define MSC01_SC_ID_MAR_SHF 8 +#define MSC01_SC_ID_MAR_MSK 0x0000ff00 +#define MSC01_SC_ID_MIR_SHF 0 +#define MSC01_SC_ID_MIR_MSK 0x000000ff + +#define MSC01_SC_SYSID_ID_SHF 0 +#define MSC01_SC_SYSID_ID_MSK 0xffffffff + +#define MSC01_SC_ERR_RSPERR_SHF 31 +#define MSC01_SC_ERR_RSPERR_MSK 0x80000000 +#define MSC01_SC_ERR_RSPERR_BIT 0x80000000 +#define MSC01_SC_ERR_RSPID_SHF 8 +#define MSC01_SC_ERR_RSPID_MSK 0x0000ff00 +#define MSC01_SC_ERR_RSPTYP_SHF 0 +#define MSC01_SC_ERR_RSPTYP_MSK 0x00000001 +#define MSC01_SC_ERR_RSPTYP_BIT 0x00000001 + +#define MSC01_SC_CFG_WC_SHF 16 +#define MSC01_SC_CFG_WC_MSK 0x00010000 +#define MSC01_SC_CFG_WC_BIT MSC01_SC_CFG_WC_MSK +#define MSC01_SC_CFG_EBIG_SHF 8 +#define MSC01_SC_CFG_EBIG_MSK 0x00000100 +#define MSC01_SC_CFG_EBIG_BIT MSC01_SC_CFG_EBIG_MSK +#define MSC01_SC_CFG_BSEL_SHF 0 +#define MSC01_SC_CFG_BSEL_MSK 0x00000003 + +#define MSC01_BIU_IP1BAS1H_BASH_SHF 0 +#define MSC01_BIU_IP1BAS1H_BASH_MSK 0x0000000f +#define MSC01_BIU_IP1BAS1L_BASL_SHF 22 +#define MSC01_BIU_IP1BAS1L_BASL_MSK 0xffc00000 +#define MSC01_BIU_IP1MSK1H_MSKH_SHF 0 +#define MSC01_BIU_IP1MSK1H_MSKH_MSK 0x0000000f +#define MSC01_BIU_IP1MSK1L_MSKL_SHF 22 +#define MSC01_BIU_IP1MSK1L_MSKL_MSK 0xffc00000 +#define MSC01_BIU_IP1BAS2H_BASH_SHF 0 +#define MSC01_BIU_IP1BAS2H_BASH_MSK 0x0000000f +#define MSC01_BIU_IP1BAS2L_BASL_SHF 22 +#define MSC01_BIU_IP1BAS2L_BASL_MSK 0xffc00000 +#define MSC01_BIU_IP1MSK2H_MSKH_SHF 0 +#define MSC01_BIU_IP1MSK2H_MSKH_MSK 0x0000000f +#define MSC01_BIU_IP1MSK2L_MSKL_SHF 22 +#define MSC01_BIU_IP1MSK2L_MSKL_MSK 0xffc00000 + +#define MSC01_BIU_IP2BAS1H_BASH_SHF 0 +#define MSC01_BIU_IP2BAS1H_BASH_MSK 0x0000000f +#define MSC01_BIU_IP2BAS1L_BASL_SHF 22 +#define MSC01_BIU_IP2BAS1L_BASL_MSK 0xffc00000 +#define MSC01_BIU_IP2MSK1H_MSKH_SHF 0 +#define MSC01_BIU_IP2MSK1H_MSKH_MSK 0x0000000f +#define MSC01_BIU_IP2MSK1L_MSKL_SHF 22 +#define MSC01_BIU_IP2MSK1L_MSKL_MSK 0xffc00000 +#define MSC01_BIU_IP2BAS2H_BASH_SHF 0 +#define MSC01_BIU_IP2BAS2H_BASH_MSK 0x0000000f +#define MSC01_BIU_IP2BAS2L_BASL_SHF 22 +#define MSC01_BIU_IP2BAS2L_BASL_MSK 0xffc00000 +#define MSC01_BIU_IP2MSK2H_MSKH_SHF 0 +#define MSC01_BIU_IP2MSK2H_MSKH_MSK 0x0000000f +#define MSC01_BIU_IP2MSK2L_MSKL_SHF 22 +#define MSC01_BIU_IP2MSK2L_MSKL_MSK 0xffc00000 + +#define MSC01_BIU_IP3BAS1H_BASH_SHF 0 +#define MSC01_BIU_IP3BAS1H_BASH_MSK 0x0000000f +#define MSC01_BIU_IP3BAS1L_BASL_SHF 22 +#define MSC01_BIU_IP3BAS1L_BASL_MSK 0xffc00000 +#define MSC01_BIU_IP3MSK1H_MSKH_SHF 0 +#define MSC01_BIU_IP3MSK1H_MSKH_MSK 0x0000000f +#define MSC01_BIU_IP3MSK1L_MSKL_SHF 22 +#define MSC01_BIU_IP3MSK1L_MSKL_MSK 0xffc00000 +#define MSC01_BIU_IP3BAS2H_BASH_SHF 0 +#define MSC01_BIU_IP3BAS2H_BASH_MSK 0x0000000f +#define MSC01_BIU_IP3BAS2L_BASL_SHF 22 +#define MSC01_BIU_IP3BAS2L_BASL_MSK 0xffc00000 +#define MSC01_BIU_IP3MSK2H_MSKH_SHF 0 +#define MSC01_BIU_IP3MSK2H_MSKH_MSK 0x0000000f +#define MSC01_BIU_IP3MSK2L_MSKL_SHF 22 +#define MSC01_BIU_IP3MSK2L_MSKL_MSK 0xffc00000 + +#define MSC01_BIU_MCBAS1H_BASH_SHF 0 +#define MSC01_BIU_MCBAS1H_BASH_MSK 0x0000000f +#define MSC01_BIU_MCBAS1L_BASL_SHF 22 +#define MSC01_BIU_MCBAS1L_BASL_MSK 0xffc00000 +#define MSC01_BIU_MCMSK1H_MSKH_SHF 0 +#define MSC01_BIU_MCMSK1H_MSKH_MSK 0x0000000f +#define MSC01_BIU_MCMSK1L_MSKL_SHF 22 +#define MSC01_BIU_MCMSK1L_MSKL_MSK 0xffc00000 +#define MSC01_BIU_MCBAS2H_BASH_SHF 0 +#define MSC01_BIU_MCBAS2H_BASH_MSK 0x0000000f +#define MSC01_BIU_MCBAS2L_BASL_SHF 22 +#define MSC01_BIU_MCBAS2L_BASL_MSK 0xffc00000 +#define MSC01_BIU_MCMSK2H_MSKH_SHF 0 +#define MSC01_BIU_MCMSK2H_MSKH_MSK 0x0000000f +#define MSC01_BIU_MCMSK2L_MSKL_SHF 22 +#define MSC01_BIU_MCMSK2L_MSKL_MSK 0xffc00000 + +#define MSC01_BIU_RBBAS_BASH_SHF 0 +#define MSC01_BIU_RBBAS_BASH_MSK 0x0000000f +#define MSC01_BIU_RBMSK_BASL_SHF 22 +#define MSC01_BIU_RBMSK_BASL_MSK 0xffc00000 + +#define MSC01_BIU_IP1CTRL_L_SHF 0 +#define MSC01_BIU_IP1CTRL_L_MSK 0x00000001 +#define MSC01_BIU_IP1CTRL_L_BIT MSC01_BIU_IP1CTRL_L_MSK + +#define MSC01_BIU_IP2CTRL_L_SHF 0 +#define MSC01_BIU_IP2CTRL_L_MSK 0x00000001 +#define MSC01_BIU_IP2CTRL_L_BIT MSC01_BIU_IP2CTRL_L_MSK + +#define MSC01_BIU_IP3CTRL_L_SHF 0 +#define MSC01_BIU_IP3CTRL_L_MSK 0x00000001 +#define MSC01_BIU_IP3CTRL_L_BIT MSC01_BIU_IP3CTRL_L_MSK + +#define MSC01_BIU_MCCTRL_L_SHF 0 +#define MSC01_BIU_MCCTRL_L_MSK 0x00000001 +#define MSC01_BIU_MCCTRL_L_BIT MSC01_BIU_MCCTRL_L_MSK + + +/* BIU + Registers absolute addresses: */ + +#define MSC01_SC_ID (MSC01_BIU_REG_BASE + MSC01_SC_ID_OFS) +#define MSC01_SC_ERR (MSC01_BIU_REG_BASE + MSC01_SC_ERR_OFS) +#define MSC01_SC_CFG (MSC01_BIU_REG_BASE + MSC01_SC_CFG_OFS) + +#define MSC01_BIU_IP1BAS1H (MSC01_BIU_REG_BASE + MSC01_BIU_IP1BAS1H_OFS) +#define MSC01_BIU_IP1BAS1L (MSC01_BIU_REG_BASE + MSC01_BIU_IP1BAS1L_OFS) +#define MSC01_BIU_IP1MSK1H (MSC01_BIU_REG_BASE + MSC01_BIU_IP1MSK1H_OFS) +#define MSC01_BIU_IP1MSK1L (MSC01_BIU_REG_BASE + MSC01_BIU_IP1MSK1L_OFS) +#define MSC01_BIU_IP1BAS2H (MSC01_BIU_REG_BASE + MSC01_BIU_IP1BAS2H_OFS) +#define MSC01_BIU_IP1BAS2L (MSC01_BIU_REG_BASE + MSC01_BIU_IP1BAS2L_OFS) +#define MSC01_BIU_IP1MSK2H (MSC01_BIU_REG_BASE + MSC01_BIU_IP1MSK2H_OFS) +#define MSC01_BIU_IP1MSK2L (MSC01_BIU_REG_BASE + MSC01_BIU_IP1MSK2L_OFS) +#define MSC01_BIU_IP2BAS1H (MSC01_BIU_REG_BASE + MSC01_BIU_IP2BAS1H_OFS) +#define MSC01_BIU_IP2BAS1L (MSC01_BIU_REG_BASE + MSC01_BIU_IP2BAS1L_OFS) +#define MSC01_BIU_IP2MSK1H (MSC01_BIU_REG_BASE + MSC01_BIU_IP2MSK1H_OFS) +#define MSC01_BIU_IP2MSK1L (MSC01_BIU_REG_BASE + MSC01_BIU_IP2MSK1L_OFS) +#define MSC01_BIU_IP2BAS2H (MSC01_BIU_REG_BASE + MSC01_BIU_IP2BAS2H_OFS) +#define MSC01_BIU_IP2BAS2L (MSC01_BIU_REG_BASE + MSC01_BIU_IP2BAS2L_OFS) +#define MSC01_BIU_IP2MSK2H (MSC01_BIU_REG_BASE + MSC01_BIU_IP2MSK2H_OFS) +#define MSC01_BIU_IP2MSK2L (MSC01_BIU_REG_BASE + MSC01_BIU_IP2MSK2L_OFS) +#define MSC01_BIU_IP3BAS1H (MSC01_BIU_REG_BASE + MSC01_BIU_IP3BAS1H_OFS) +#define MSC01_BIU_IP3BAS1L (MSC01_BIU_REG_BASE + MSC01_BIU_IP3BAS1L_OFS) +#define MSC01_BIU_IP3MSK1H (MSC01_BIU_REG_BASE + MSC01_BIU_IP3MSK1H_OFS) +#define MSC01_BIU_IP3MSK1L (MSC01_BIU_REG_BASE + MSC01_BIU_IP3MSK1L_OFS) +#define MSC01_BIU_IP3BAS2H (MSC01_BIU_REG_BASE + MSC01_BIU_IP3BAS2H_OFS) +#define MSC01_BIU_IP3BAS2L (MSC01_BIU_REG_BASE + MSC01_BIU_IP3BAS2L_OFS) +#define MSC01_BIU_IP3MSK2H (MSC01_BIU_REG_BASE + MSC01_BIU_IP3MSK2H_OFS) +#define MSC01_BIU_IP3MSK2L (MSC01_BIU_REG_BASE + MSC01_BIU_IP3MSK2L_OFS) +#define MSC01_BIU_MCBAS1H (MSC01_BIU_REG_BASE + MSC01_BIU_MCBAS1H_OFS) +#define MSC01_BIU_MCBAS1L (MSC01_BIU_REG_BASE + MSC01_BIU_MCBAS1L_OFS) +#define MSC01_BIU_MCMSK1H (MSC01_BIU_REG_BASE + MSC01_BIU_MCMSK1H_OFS) +#define MSC01_BIU_MCMSK1L (MSC01_BIU_REG_BASE + MSC01_BIU_MCMSK1L_OFS) +#define MSC01_BIU_MCBAS2H (MSC01_BIU_REG_BASE + MSC01_BIU_MCBAS2H_OFS) +#define MSC01_BIU_MCBAS2L (MSC01_BIU_REG_BASE + MSC01_BIU_MCBAS2L_OFS) +#define MSC01_BIU_MCMSK2H (MSC01_BIU_REG_BASE + MSC01_BIU_MCMSK2H_OFS) +#define MSC01_BIU_MCMSK2L (MSC01_BIU_REG_BASE + MSC01_BIU_MCMSK2L_OFS) +#define MSC01_BIU_RBBASH (MSC01_BIU_REG_BASE + MSC01_BIU_RBBASH_OFS) +#define MSC01_BIU_RBBASL (MSC01_BIU_REG_BASE + MSC01_BIU_RBBASL_OFS) +#define MSC01_BIU_IP1CTRL (MSC01_BIU_REG_BASE + MSC01_BIU_IP1CTRL_OFS) +#define MSC01_BIU_IP2CTRL (MSC01_BIU_REG_BASE + MSC01_BIU_IP2CTRL_OFS) +#define MSC01_BIU_IP3CTRL (MSC01_BIU_REG_BASE + MSC01_BIU_IP3CTRL_OFS) +#define MSC01_BIU_MCCTRL (MSC01_BIU_REG_BASE + MSC01_BIU_MCCTRL_OFS) + +/* + **************************************************************************** + * Register offset addresses + *************************************************************************** + */ + +#define MSC01_MC_CFGPB0_OFS 0x0110 /* SDRAM config, phbank0 (1) */ +#define MSC01_MC_CFGPB1_OFS 0x0118 /* SDRAM config, phbank1 (1) */ +#define MSC01_MC_CFGPB2_OFS 0x0120 /* SDRAM config, phbank2 (1) */ +#define MSC01_MC_CFGPB3_OFS 0x0128 /* SDRAM config, phbank3 (1) */ +#define MSC01_MC_LATENCY_OFS 0x0130 /* SDRAM latency params (1) */ +#define MSC01_MC_IOCTRL_OFS 0x0140 /* I/O region ctrl reg (1) */ +#define MSC01_MC_TIMPAR_OFS 0x0150 /* SDRAM command timing (2) */ +#define MSC01_MC_TREFRESH_OFS 0x0160 /* SDRAM refresh time (3) */ +#define MSC01_MC_INITCMD_OFS 0x0200 /* SDRAM init cmd reg (4) */ +#define MSC01_MC_CTRLENA_OFS 0x0300 /* Memory controller enabl */ +#define MSC01_MC_CMD_PD_OFS 0x0400 /* SDRAM power down ctrl */ +#define MSC01_MC_ARB_CFG_OFS 0x0600 /* 16 GP bits to arbiter */ +#define MSC01_MC_ARB_STAT_OFS 0x0608 /* arbitration unit status */ +#define MSC01_MC_HC_DDR_OFS 0x0710 /* DDR SDRAM type config (5) */ +#define MSC01_MC_HC_FMDW_OFS 0x0718 /* Full memory data width(5) */ +#define MSC01_MC_HC_PARITY_OFS 0x0720 /* Parity check enable (5) */ +#define MSC01_MC_HC_CLKRAT_OFS 0x0728 /* Clk ratio sysctl/SDRAM(5) */ +#define MSC01_MC_HC_RDDEL_OFS 0x0730 /* Read Data delay (5) */ +#define MSC01_MC_SPD_CFG_OFS 0x0800 /* Presence Detect Config */ +#define MSC01_MC_SPD_ADR_OFS 0x0808 /* Presence Detect Read Addr */ +#define MSC01_MC_SPD_DAT_OFS 0x0810 /* Presence Detect Read Data */ + +/* Note 1: must be set and frozen before initialization of SDRAM */ +/* Note 2: must be set and frozen before MC_CTRLENA is set */ +/* Note 3: must be set before MC_CTRLENA is set */ +/* Note 4: must NOT be accesses when MC_CTRLENA is set. */ +/* Note 5: Hidden Control, note 1 applies if used anyway. */ + +/* + **************************************************************************** + * Register encodings + *************************************************************************** + */ + +/* Row Width Fields of MC_CFGPX */ +#define MSC01_MC_CFGPBx_ROWW_SHF 4 +#define MSC01_MC_CFGPBx_ROWW_MSK 0x000000f0 +#define MSC01_MC_CFGPB0_ROWW_SHF MSC01_MC_CFGPBx_ROWW_SHF +#define MSC01_MC_CFGPB0_ROWW_MSK MSC01_MC_CFGPBx_ROWW_MSK +#define MSC01_MC_CFGPB1_ROWW_SHF MSC01_MC_CFGPBx_ROWW_SHF +#define MSC01_MC_CFGPB1_ROWW_MSK MSC01_MC_CFGPBx_ROWW_MSK +#define MSC01_MC_CFGPB2_ROWW_SHF MSC01_MC_CFGPBx_ROWW_SHF +#define MSC01_MC_CFGPB2_ROWW_MSK MSC01_MC_CFGPBx_ROWW_MSK +#define MSC01_MC_CFGPB3_ROWW_SHF MSC01_MC_CFGPBx_ROWW_SHF +#define MSC01_MC_CFGPB3_ROWW_MSK MSC01_MC_CFGPBx_ROWW_MSK + +/* Column Width Fields of MC_CFGPX */ +#define MSC01_MC_CFGPBx_COLW_SHF 0 +#define MSC01_MC_CFGPBx_COLW_MSK 0x0000000f +#define MSC01_MC_CFGPB0_COLW_SHF MSC01_MC_CFGPBx_COLW_SHF +#define MSC01_MC_CFGPB0_COLW_MSK MSC01_MC_CFGPBx_COLW_MSK +#define MSC01_MC_CFGPB1_COLW_SHF MSC01_MC_CFGPBx_COLW_SHF +#define MSC01_MC_CFGPB1_COLW_MSK MSC01_MC_CFGPBx_COLW_MSK +#define MSC01_MC_CFGPB2_COLW_SHF MSC01_MC_CFGPBx_COLW_SHF +#define MSC01_MC_CFGPB2_COLW_MSK MSC01_MC_CFGPBx_COLW_MSK +#define MSC01_MC_CFGPB3_COLW_SHF MSC01_MC_CFGPBx_COLW_SHF +#define MSC01_MC_CFGPB3_COLW_MSK MSC01_MC_CFGPBx_COLW_MSK + +/* Fields of MC_LATENCY */ +#define MSC01_MC_LATENCY_CSL_SHF 8 +#define MSC01_MC_LATENCY_CSL_MSK 0x00000f00 +#define MSC01_MC_LATENCY_WL_SHF 4 +#define MSC01_MC_LATENCY_WL_MSK 0x000000f0 +#define MSC01_MC_LATENCY_CL_SHF 0 +#define MSC01_MC_LATENCY_CL_MSK 0x0000000f + +/* Field of MC_IOCTRL */ +#define MSC01_MC_IOCTRL_IOGP_SHF 0 +#define MSC01_MC_IOCTRL_IOGP_MSK 0xffffffff + +/* Fields of MC_TIMPAR */ +#define MSC01_MC_TIMPAR_TMRAS_SHF 16 +#define MSC01_MC_TIMPAR_TMRAS_MIN 1 +#define MSC01_MC_TIMPAR_TMRAS_MAX 255 +#define MSC01_MC_TIMPAR_TMRAS_MSK 0x00ff0000 +#define MSC01_MC_TIMPAR_TRP_SHF 12 +#define MSC01_MC_TIMPAR_TRP_MIN 2 +#define MSC01_MC_TIMPAR_TRP_MAX 4 +#define MSC01_MC_TIMPAR_TRP_MSK 0x0000f000 +#define MSC01_MC_TIMPAR_TRAS_SHF 8 +#define MSC01_MC_TIMPAR_TRAS_MIN 2 +#define MSC01_MC_TIMPAR_TRAS_MAX 8 +#define MSC01_MC_TIMPAR_TRAS_MSK 0x00000f00 +#define MSC01_MC_TIMPAR_TRCD_SHF 4 +#define MSC01_MC_TIMPAR_TRCD_MIN 2 +#define MSC01_MC_TIMPAR_TRCD_MAX 3 +#define MSC01_MC_TIMPAR_TRCD_MSK 0x000000f0 +#define MSC01_MC_TIMPAR_TDPL_SHF 0 +#define MSC01_MC_TIMPAR_TDPL_MIN 1 +#define MSC01_MC_TIMPAR_TDPL_MAX 3 +#define MSC01_MC_TIMPAR_TDPL_MSK 0x0000000f + +/* Fields of MC_TREFRESH */ +#define MSC01_MC_TREFRESH_TREF_SHF 0 +#define MSC01_MC_TREFRESH_TREF_MSK 0x00001fff + +/* Fields of MC_INITCMD */ +#define MSC01_MC_INITCMD_WAIT_SHF 20 +#define MSC01_MC_INITCMD_WAIT_MSK 0x00f00000 +#define MSC01_MC_INITCMD_ICMD_SHF 16 +#define MSC01_MC_INITCMD_ICMD_MSK 0x00070000 +#define MSC01_MC_INITCMD_BA_SHF 12 +#define MSC01_MC_INITCMD_BA_MSK 0x00003000 +#define MSC01_MC_INITCMD_A_SHF 0 +#define MSC01_MC_INITCMD_A_MSK 0x00000fff +/* init command field-codes */ +#define MSC01_MC_INITCMD_ICMD_NOP 0x7 +#define MSC01_MC_INITCMD_ICMD_PALL 0x2 +#define MSC01_MC_INITCMD_ICMD_CBR 0x1 +#define MSC01_MC_INITCMD_ICMD_MRS 0x0 +#define MSC01_MC_INITCMD_BA_MRS 0x0 +#define MSC01_MC_INITCMD_BA_EMRS 0x1 +#define MSC01_MC_INITCMD_BA_PALL 0x0 +#define MSC01_MC_INITCMD_BA_CBR 0x0 +#define MSC01_MC_INITCMD_A_PALL 0x400 +#define MSC01_MC_INITCMD_A_CBR 0x0 + +/* Fields of MC_CTRLENA */ +#define MSC01_MC_CTRLENA_ENA_SHF 0 +#define MSC01_MC_CTRLENA_ENA_MSK 0x00000001 +#define MSC01_MC_CTRLENA_ENA_BIT MSC01_MC_CTRLENA_ENA_MSK + +/* Fields of MC_CMD_PD */ +#define MSC01_MC_CMD_PD_PWDS_SHF 1 +#define MSC01_MC_CMD_PD_PWDS_MSK 0x00000002 +#define MSC01_MC_CMD_PD_PWDS_BIT MSC01_MC_CMD_PD_PWDS_MSK +#define MSC01_MC_CMD_PD_PWD_SHF 0 +#define MSC01_MC_CMD_PD_PWD_MSK 0x00000001 +#define MSC01_MC_CMD_PD_PWD_BIT MSC01_MC_CMD_PD_PWD_MSK + +/* Fields of MC_ARB_CFG */ +#define MSC01_MC_ARB_CFG_ARB_CFG_SHF 0 +#define MSC01_MC_ARB_CFG_ARB_CFG_MSK 0x0000ffff + +/* Fields of MC_ARB_STAT */ +#define MSC01_MC_ARB_STAT_ARB_STAT_SHF 0 +#define MSC01_MC_ARB_STAT_ARB_STAT_MSK 0x0000ffff + +/* Hidden register MC_HC_DDR */ +#define MSC01_MC_HC_DDR_DDR_SHF 0 +#define MSC01_MC_HC_DDR_DDR_MSK 0x00000001 +#define MSC01_MC_HC_DDR_DDR_BIT MSC01_MC_HC_DDR_DDR_MSK + +/* Hidden register MC_HC_FMDW */ +#define MSC01_MC_HC_FMDW_FMDW_SHF 0 +#define MSC01_MC_HC_FMDW_FMDW_MSK 0x00000001 +#define MSC01_MC_HC_FMDW_FMDW_BIT MSC01_MC_HC_FMDW_FMDW_MSK + +/* Hidden register MC_HC_PARITY */ +#define MSC01_MC_HC_PARITY_PARITY_SHF 0 +#define MSC01_MC_HC_PARITY_PARITY_MSK 0x00000001 +#define MSC01_MC_HC_PARITY_PARITY_BIT MSC01_MC_HC_PARITY_PARITY_MSK + +/* Hidden register MC_HC_CLKRAT */ +#define MSC01_MC_HC_CLKRAT_CLKRAT_SHF 0 +#define MSC01_MC_HC_CLKRAT_CLKRAT_MSK 0x00000007 +#define MSC01_MC_HC_CLKRAT_CLKRAT_1_1 1 +#define MSC01_MC_HC_CLKRAT_CLKRAT_3_2 2 +#define MSC01_MC_HC_CLKRAT_CLKRAT_2_1 3 +#define MSC01_MC_HC_CLKRAT_CLKRAT_3_1 4 +#define MSC01_MC_HC_CLKRAT_CLKRAT_4_1 5 + +/* Hidden register MC_HC_RDDEL */ +#define MSC01_MC_HC_RDDEL_RDDEL_SHF 0 +#define MSC01_MC_HC_RDDEL_RDDEL_MSK 0x0000000f + +/* Fields of MC_SPD_CFG */ +#define MSC01_MC_SPD_CFG_CPDIV_SHF 0 +#define MSC01_MC_SPD_CFG_CPDIV_MSK 0x000001ff + +/* Fields of MC_SPD_ADR */ +#define MSC01_MC_SPD_ADR_DADR_SHF 8 +#define MSC01_MC_SPD_ADR_DADR_MSK 0x00000700 +#define MSC01_MC_SPD_ADR_BADR_SHF 0 +#define MSC01_MC_SPD_ADR_BADR_MSK 0x000000ff + +/* Fields of MC_SPD_DAT */ +#define MSC01_MC_SPD_DAT_RDERR_SHF 9 +#define MSC01_MC_SPD_DAT_RDERR_MSK 0x00000200 +#define MSC01_MC_SPD_DAT_RDERR_BIT MSC01_MC_SPD_DAT_RDERR_MSK +#define MSC01_MC_SPD_DAT_BUSY_SHF 8 +#define MSC01_MC_SPD_DAT_BUSY_MSK 0x00000100 +#define MSC01_MC_SPD_DAT_BUSY_BIT MSC01_MC_SPD_DAT_BUSY_MSK +#define MSC01_MC_SPD_DAT_RDATA_SHF 0 +#define MSC01_MC_SPD_DAT_RDATA_MSK 0x000000ff + + +/* + **************************************************************************** + * Registers absolute addresses + *************************************************************************** + */ + +#define MSC01_MC_CFGPB0 (MSC01_MC_REG_BASE + MSC01_MC_CFGPB0_OFS) +#define MSC01_MC_CFGPB1 (MSC01_MC_REG_BASE + MSC01_MC_CFGPB1_OFS) +#define MSC01_MC_CFGPB2 (MSC01_MC_REG_BASE + MSC01_MC_CFGPB2_OFS) +#define MSC01_MC_CFGPB3 (MSC01_MC_REG_BASE + MSC01_MC_CFGPB3_OFS) +#define MSC01_MC_LATENCY (MSC01_MC_REG_BASE + MSC01_MC_LATENCY_OFS) +#define MSC01_MC_IOCTRL (MSC01_MC_REG_BASE + MSC01_MC_IOCTRL_OFS) +#define MSC01_MC_TIMPAR (MSC01_MC_REG_BASE + MSC01_MC_TIMPAR_OFS) +#define MSC01_MC_TREFRESH (MSC01_MC_REG_BASE + MSC01_MC_TREFRESH_OFS) +#define MSC01_MC_INITCMD (MSC01_MC_REG_BASE + MSC01_MC_INITCMD_OFS) +#define MSC01_MC_CTRLENA (MSC01_MC_REG_BASE + MSC01_MC_CTRLENA_OFS) +#define MSC01_MC_CMD_PD (MSC01_MC_REG_BASE + MSC01_MC_CMD_PD_OFS) +#define MSC01_MC_ARB_CFG (MSC01_MC_REG_BASE + MSC01_MC_ARB_CFG_OFS) +#define MSC01_MC_ARB_STAT (MSC01_MC_REG_BASE + MSC01_MC_ARB_STAT_OFS) +#define MSC01_MC_HC_DDR (MSC01_MC_REG_BASE + MSC01_MC_HC_DDR_OFS) +#define MSC01_MC_HC_FMDW (MSC01_MC_REG_BASE + MSC01_MC_HC_FMDW_OFS) +#define MSC01_MC_HC_PARITY (MSC01_MC_REG_BASE + MSC01_MC_HC_PARITY_OFS) +#define MSC01_MC_HC_CLKRAT (MSC01_MC_REG_BASE + MSC01_MC_HC_CLKRAT_OFS) +#define MSC01_MC_HC_RDDEL (MSC01_MC_REG_BASE + MSC01_MC_HC_RDDEL_OFS) +#define MSC01_MC_SPD_CFG (MSC01_MC_REG_BASE + MSC01_MC_SPD_CFG_OFS) +#define MSC01_MC_SPD_ADR (MSC01_MC_REG_BASE + MSC01_MC_SPD_ADR_OFS) +#define MSC01_MC_SPD_DAT (MSC01_MC_REG_BASE + MSC01_MC_SPD_DAT_OFS) + +#ifndef KSEG1_BASE +# define KSEG0_BASE 0x80000000 /* unmapped, cachable */ +# define KSEG1_BASE 0xa0000000 /* unmapped, uncached */ +#endif + +/* + **************************************************************************** + * IPIF generic register space addresses, unmapped & uncached access via kseg1 + *************************************************************************** + */ + +#define MSC01_REGSPACE_MC 0 +#define MSC01_REGSPACE_IC 1 +#define MSC01_REGSPACE_BIU 2 +#define MSC01_REGSPACE_IP1 3 +#define MSC01_REGSPACE_IP2 4 +#define MSC01_REGSPACE_IP3 5 + +#define MSC01_REGADDR_RESET (KSEG1_BASE + 0x1f800000) /* power-up value */ +#define MSC01_REGADDR_SIZE 0x00040000 /* 256 KByte */ +#define MSC01_REGADDR(regspace) (MSC01_REGADDR_BASE \ + +(regspace)*MSC01_REGADDR_SIZE) + + + +/* + **************************************************************************** + * Default register base addresses (can be modified at run-time by software) + *************************************************************************** + */ + +#define MSC01_REGADDR_BASE (KSEG1_BASE + 0x1bc00000) /* programmed val */ + +#define MSC01_MC_REG_BASE MSC01_REGADDR(MSC01_REGSPACE_MC) +#define MSC01_IC_REG_BASE MSC01_REGADDR(MSC01_REGSPACE_IC) +#define MSC01_BIU_REG_BASE MSC01_REGADDR(MSC01_REGSPACE_BIU) +#define MSC01_SC_REG_BASE MSC01_REGADDR(MSC01_REGSPACE_BIU) +#define MSC01_IP1_REG_BASE MSC01_REGADDR(MSC01_REGSPACE_IP1) +#define MSC01_IP2_REG_BASE MSC01_REGADDR(MSC01_REGSPACE_IP2) +#define MSC01_IP3_REG_BASE MSC01_REGADDR(MSC01_REGSPACE_IP3) + + +/* + **************************************************************************** + * Power-up memory space (can be modified at run-time by software) + *************************************************************************** + */ + +#define MSC01_PHYSBASE_MC 0x00000000 +#define MSC01_PHYSBASE_IP1 0x10000000 +#define MSC01_PHYSBASE_IP2 0x14000000 +#define MSC01_PHYSBASE_IP3 0x18000000 + +#define MSC01_KSEG0BASE_MC (KSEG0_BASE + MSC01_PHYSBASE_MC) +#define MSC01_KSEG0BASE_IP1 (KSEG0_BASE + MSC01_PHYSBASE_IP1) +#define MSC01_KSEG0BASE_IP2 (KSEG0_BASE + MSC01_PHYSBASE_IP2) +#define MSC01_KSEG0BASE_IP3 (KSEG0_BASE + MSC01_PHYSBASE_IP3) + +/* PBC ID in MSC01_PBC_ID */ +#define MSC01_ID_PBC 0x80 + +/* + **************************************************************************** + * Register offset addresses and access types + *************************************************************************** + */ + +#define MSC01_PBC_ID_OFS 0x0000 +#define MSC01_PBC_CLKCFG_OFS 0x0100 +#define MSC01_PBC_CS0BASL_OFS 0x0200 +#define MSC01_PBC_CS1BASL_OFS 0x0210 +#define MSC01_PBC_CS2BASL_OFS 0x0220 +#define MSC01_PBC_CS3BASL_OFS 0x0230 +#define MSC01_PBC_CS0MSKL_OFS 0x0300 +#define MSC01_PBC_CS1MSKL_OFS 0x0310 +#define MSC01_PBC_CS2MSKL_OFS 0x0320 +#define MSC01_PBC_CS3MSKL_OFS 0x0330 +#define MSC01_PBC_CS0CFG_OFS 0x0400 +#define MSC01_PBC_CS1CFG_OFS 0x0410 +#define MSC01_PBC_CS2CFG_OFS 0x0420 +#define MSC01_PBC_CS3CFG_OFS 0x0430 +#define MSC01_PBC_CS0TIM_OFS 0x0500 +#define MSC01_PBC_CS1TIM_OFS 0x0510 +#define MSC01_PBC_CS2TIM_OFS 0x0520 +#define MSC01_PBC_CS3TIM_OFS 0x0530 +#define MSC01_PBC_CS0RW_OFS 0x0600 +#define MSC01_PBC_CS1RW_OFS 0x0610 +#define MSC01_PBC_CS2RW_OFS 0x0620 +#define MSC01_PBC_CS3RW_OFS 0x0630 + +/* + **************************************************************************** + * Register encodings + *************************************************************************** + */ + +#define MSC01_PBC_ID_ID_SHF 16 +#define MSC01_PBC_ID_ID_MSK 0x00ff0000 +#define MSC01_PBC_ID_MAR_SHF 8 +#define MSC01_PBC_ID_MAR_MSK 0x0000ff00 +#define MSC01_PBC_ID_MIR_SHF 0 +#define MSC01_PBC_ID_MIR_MSK 0x000000ff + +#define MSC01_PBC_CLKCFG_SHF 0 +#define MSC01_PBC_CLKCFG_MSK 0x0000001f + +#define MSC01_PBC_CSxBASL_BASL_SHF 22 +#define MSC01_PBC_CSxBASL_BASL_MSK 0x3fc00000 +#define MSC01_PBC_CS0BASL_BASL_SHF MSC01_PBC_CSxBASL_BASL_SHF +#define MSC01_PBC_CS0BASL_BASL_MSK MSC01_PBC_CSxBASL_BASL_MSK +#define MSC01_PBC_CS1BASL_BASL_SHF MSC01_PBC_CSxBASL_BASL_SHF +#define MSC01_PBC_CS1BASL_BASL_MSK MSC01_PBC_CSxBASL_BASL_MSK +#define MSC01_PBC_CS2BASL_BASL_SHF MSC01_PBC_CSxBASL_BASL_SHF +#define MSC01_PBC_CS2BASL_BASL_MSK MSC01_PBC_CSxBASL_BASL_MSK +#define MSC01_PBC_CS3BASL_BASL_SHF MSC01_PBC_CSxBASL_BASL_SHF +#define MSC01_PBC_CS3BASL_BASL_MSK MSC01_PBC_CSxBASL_BASL_MSK + +#define MSC01_PBC_CSxMSKL_MSKL_SHF 22 +#define MSC01_PBC_CSxMSKL_MSKL_MSK 0x0fc00000 +#define MSC01_PBC_CS0MSKL_MSKL_SHF MSC01_PBC_CSxMSKL_MSKL_SHF +#define MSC01_PBC_CS0MSKL_MSKL_MSK MSC01_PBC_CSxMSKL_MSKL_MSK +#define MSC01_PBC_CS1MSKL_MSKL_SHF MSC01_PBC_CSxMSKL_MSKL_SHF +#define MSC01_PBC_CS1MSKL_MSKL_MSK MSC01_PBC_CSxMSKL_MSKL_MSK +#define MSC01_PBC_CS2MSKL_MSKL_SHF MSC01_PBC_CSxMSKL_MSKL_SHF +#define MSC01_PBC_CS2MSKL_MSKL_MSK MSC01_PBC_CSxMSKL_MSKL_MSK +#define MSC01_PBC_CS3MSKL_MSKL_SHF MSC01_PBC_CSxMSKL_MSKL_SHF +#define MSC01_PBC_CS3MSKL_MSKL_MSK MSC01_PBC_CSxMSKL_MSKL_MSK + +#define MSC01_PBC_CSxCFG_ADM_SHF 20 +#define MSC01_PBC_CSxCFG_ADM_MSK 0x00100000 +#define MSC01_PBC_CSxCFG_ADM_BIT 0x00100000 +#define MSC01_PBC_CSxCFG_DTYP_SHF 16 +#define MSC01_PBC_CSxCFG_DTYP_MSK 0x00030000 +#define MSC01_PBC_CSxCFG_WSIDLE_SHF 8 +#define MSC01_PBC_CSxCFG_WSIDLE_MSK 0x00001f00 +#define MSC01_PBC_CSxCFG_WS_SHF 0 +#define MSC01_PBC_CSxCFG_WS_MSK 0x0000001f +#define MSC01_PBC_CS0CFG_ADM_SHF MSC01_PBC_CSxCFG_ADM_SHF +#define MSC01_PBC_CS0CFG_ADM_MSK MSC01_PBC_CSxCFG_ADM_MSK +#define MSC01_PBC_CS0CFG_ADM_BIT MSC01_PBC_CSxCFG_ADM_BIT +#define MSC01_PBC_CS0CFG_DTYP_SHF MSC01_PBC_CSxCFG_DTYP_SHF +#define MSC01_PBC_CS0CFG_DTYP_MSK MSC01_PBC_CSxCFG_DTYP_MSK +#define MSC01_PBC_CS0CFG_WSIDLE_SHF MSC01_PBC_CSxCFG_WSIDLE_SHF +#define MSC01_PBC_CS0CFG_WSIDLE_MSK MSC01_PBC_CSxCFG_WSIDLE_MSK +#define MSC01_PBC_CS0CFG_WS_SHF MSC01_PBC_CSxCFG_WS_SHF +#define MSC01_PBC_CS0CFG_WS_MSK MSC01_PBC_CSxCFG_WS_MSK +#define MSC01_PBC_CS1CFG_ADM_SHF MSC01_PBC_CSxCFG_ADM_SHF +#define MSC01_PBC_CS1CFG_ADM_MSK MSC01_PBC_CSxCFG_ADM_MSK +#define MSC01_PBC_CS1CFG_ADM_BIT MSC01_PBC_CSxCFG_ADM_BIT +#define MSC01_PBC_CS1CFG_DTYP_SHF MSC01_PBC_CSxCFG_DTYP_SHF +#define MSC01_PBC_CS1CFG_DTYP_MSK MSC01_PBC_CSxCFG_DTYP_MSK +#define MSC01_PBC_CS1CFG_WSIDLE_SHF MSC01_PBC_CSxCFG_WSIDLE_SHF +#define MSC01_PBC_CS1CFG_WSIDLE_MSK MSC01_PBC_CSxCFG_WSIDLE_MSK +#define MSC01_PBC_CS1CFG_WS_SHF MSC01_PBC_CSxCFG_WS_SHF +#define MSC01_PBC_CS1CFG_WS_MSK MSC01_PBC_CSxCFG_WS_MSK +#define MSC01_PBC_CS2CFG_ADM_SHF MSC01_PBC_CSxCFG_ADM_SHF +#define MSC01_PBC_CS2CFG_ADM_MSK MSC01_PBC_CSxCFG_ADM_MSK +#define MSC01_PBC_CS2CFG_ADM_BIT MSC01_PBC_CSxCFG_ADM_BIT +#define MSC01_PBC_CS2CFG_DTYP_SHF MSC01_PBC_CSxCFG_DTYP_SHF +#define MSC01_PBC_CS2CFG_DTYP_MSK MSC01_PBC_CSxCFG_DTYP_MSK +#define MSC01_PBC_CS2CFG_WSIDLE_SHF MSC01_PBC_CSxCFG_WSIDLE_SHF +#define MSC01_PBC_CS2CFG_WSIDLE_MSK MSC01_PBC_CSxCFG_WSIDLE_MSK +#define MSC01_PBC_CS2CFG_WS_SHF MSC01_PBC_CSxCFG_WS_SHF +#define MSC01_PBC_CS2CFG_WS_MSK MSC01_PBC_CSxCFG_WS_MSK +#define MSC01_PBC_CS3CFG_ADM_SHF MSC01_PBC_CSxCFG_ADM_SHF +#define MSC01_PBC_CS3CFG_ADM_MSK MSC01_PBC_CSxCFG_ADM_MSK +#define MSC01_PBC_CS3CFG_ADM_BIT MSC01_PBC_CSxCFG_ADM_BIT +#define MSC01_PBC_CS3CFG_DTYP_SHF MSC01_PBC_CSxCFG_DTYP_SHF +#define MSC01_PBC_CS3CFG_DTYP_MSK MSC01_PBC_CSxCFG_DTYP_MSK +#define MSC01_PBC_CS3CFG_WSIDLE_SHF MSC01_PBC_CSxCFG_WSIDLE_SHF +#define MSC01_PBC_CS3CFG_WSIDLE_MSK MSC01_PBC_CSxCFG_WSIDLE_MSK +#define MSC01_PBC_CS3CFG_WS_SHF MSC01_PBC_CSxCFG_WS_SHF +#define MSC01_PBC_CS3CFG_WS_MSK MSC01_PBC_CSxCFG_WS_MSK + +#define MSC01_PBC_CSxTIM_CDT_SHF 8 +#define MSC01_PBC_CSxTIM_CDT_MSK 0x00001f00 +#define MSC01_PBC_CSxTIM_CAT_SHF 0 +#define MSC01_PBC_CSxTIM_CAT_MSK 0x0000001f +#define MSC01_PBC_CS0TIM_CDT_SHF MSC01_PBC_CSxTIM_CDT_SHF +#define MSC01_PBC_CS0TIM_CDT_MSK MSC01_PBC_CSxTIM_CDT_MSK +#define MSC01_PBC_CS0TIM_CAT_SHF MSC01_PBC_CSxTIM_CAT_SHF +#define MSC01_PBC_CS0TIM_CAT_MSK MSC01_PBC_CSxTIM_CAT_MSK +#define MSC01_PBC_CS1TIM_CDT_SHF MSC01_PBC_CSxTIM_CDT_SHF +#define MSC01_PBC_CS1TIM_CDT_MSK MSC01_PBC_CSxTIM_CDT_MSK +#define MSC01_PBC_CS1TIM_CAT_SHF MSC01_PBC_CSxTIM_CAT_SHF +#define MSC01_PBC_CS1TIM_CAT_MSK MSC01_PBC_CSxTIM_CAT_MSK +#define MSC01_PBC_CS2TIM_CDT_SHF MSC01_PBC_CSxTIM_CDT_SHF +#define MSC01_PBC_CS2TIM_CDT_MSK MSC01_PBC_CSxTIM_CDT_MSK +#define MSC01_PBC_CS2TIM_CAT_SHF MSC01_PBC_CSxTIM_CAT_SHF +#define MSC01_PBC_CS2TIM_CAT_MSK MSC01_PBC_CSxTIM_CAT_MSK +#define MSC01_PBC_CS3TIM_CDT_SHF MSC01_PBC_CSxTIM_CDT_SHF +#define MSC01_PBC_CS3TIM_CDT_MSK MSC01_PBC_CSxTIM_CDT_MSK +#define MSC01_PBC_CS3TIM_CAT_SHF MSC01_PBC_CSxTIM_CAT_SHF +#define MSC01_PBC_CS3TIM_CAT_MSK MSC01_PBC_CSxTIM_CAT_MSK + +#define MSC01_PBC_CSxRW_RDT_SHF 24 +#define MSC01_PBC_CSxRW_RDT_MSK 0x1f000000 +#define MSC01_PBC_CSxRW_RAT_SHF 16 +#define MSC01_PBC_CSxRW_RAT_MSK 0x001f0000 +#define MSC01_PBC_CSxRW_WDT_SHF 8 +#define MSC01_PBC_CSxRW_WDT_MSK 0x00001f00 +#define MSC01_PBC_CSxRW_WAT_SHF 0 +#define MSC01_PBC_CSxRW_WAT_MSK 0x0000001f +#define MSC01_PBC_CS0RW_RDT_SHF MSC01_PBC_CSxRW_RDT_SHF +#define MSC01_PBC_CS0RW_RDT_MSK MSC01_PBC_CSxRW_RDT_MSK +#define MSC01_PBC_CS0RW_RAT_SHF MSC01_PBC_CSxRW_RAT_SHF +#define MSC01_PBC_CS0RW_RAT_MSK MSC01_PBC_CSxRW_RAT_MSK +#define MSC01_PBC_CS0RW_WDT_SHF MSC01_PBC_CSxRW_WDT_SHF +#define MSC01_PBC_CS0RW_WDT_MSK MSC01_PBC_CSxRW_WDT_MSK +#define MSC01_PBC_CS0RW_WAT_SHF MSC01_PBC_CSxRW_WAT_SHF +#define MSC01_PBC_CS0RW_WAT_MSK MSC01_PBC_CSxRW_WAT_MSK +#define MSC01_PBC_CS1RW_RDT_SHF MSC01_PBC_CSxRW_RDT_SHF +#define MSC01_PBC_CS1RW_RDT_MSK MSC01_PBC_CSxRW_RDT_MSK +#define MSC01_PBC_CS1RW_RAT_SHF MSC01_PBC_CSxRW_RAT_SHF +#define MSC01_PBC_CS1RW_RAT_MSK MSC01_PBC_CSxRW_RAT_MSK +#define MSC01_PBC_CS1RW_WDT_SHF MSC01_PBC_CSxRW_WDT_SHF +#define MSC01_PBC_CS1RW_WDT_MSK MSC01_PBC_CSxRW_WDT_MSK +#define MSC01_PBC_CS1RW_WAT_SHF MSC01_PBC_CSxRW_WAT_SHF +#define MSC01_PBC_CS1RW_WAT_MSK MSC01_PBC_CSxRW_WAT_MSK +#define MSC01_PBC_CS2RW_RDT_SHF MSC01_PBC_CSxRW_RDT_SHF +#define MSC01_PBC_CS2RW_RDT_MSK MSC01_PBC_CSxRW_RDT_MSK +#define MSC01_PBC_CS2RW_RAT_SHF MSC01_PBC_CSxRW_RAT_SHF +#define MSC01_PBC_CS2RW_RAT_MSK MSC01_PBC_CSxRW_RAT_MSK +#define MSC01_PBC_CS2RW_WDT_SHF MSC01_PBC_CSxRW_WDT_SHF +#define MSC01_PBC_CS2RW_WDT_MSK MSC01_PBC_CSxRW_WDT_MSK +#define MSC01_PBC_CS2RW_WAT_SHF MSC01_PBC_CSxRW_WAT_SHF +#define MSC01_PBC_CS2RW_WAT_MSK MSC01_PBC_CSxRW_WAT_MSK +#define MSC01_PBC_CS3RW_RDT_SHF MSC01_PBC_CSxRW_RDT_SHF +#define MSC01_PBC_CS3RW_RDT_MSK MSC01_PBC_CSxRW_RDT_MSK +#define MSC01_PBC_CS3RW_RAT_SHF MSC01_PBC_CSxRW_RAT_SHF +#define MSC01_PBC_CS3RW_RAT_MSK MSC01_PBC_CSxRW_RAT_MSK +#define MSC01_PBC_CS3RW_WDT_SHF MSC01_PBC_CSxRW_WDT_SHF +#define MSC01_PBC_CS3RW_WDT_MSK MSC01_PBC_CSxRW_WDT_MSK +#define MSC01_PBC_CS3RW_WAT_SHF MSC01_PBC_CSxRW_WAT_SHF +#define MSC01_PBC_CS3RW_WAT_MSK MSC01_PBC_CSxRW_WAT_MSK + +/* PERIPHERAL BUS CONTROLLER + Registers absolute addresses: + MSC01_PBC_REG_BASE is defined in */ + +#define MSC01_PBC_ID (MSC01_PBC_REG_BASE + MSC01_PBC_ID_OFS) +#define MSC01_PBC_CLKCFG (MSC01_PBC_REG_BASE + MSC01_PBC_CLKCFG_OFS) + +#define MSC01_PBC_CS0BASL (MSC01_PBC_REG_BASE + MSC01_PBC_CS0BASL_OFS) +#define MSC01_PBC_CS0MSKL (MSC01_PBC_REG_BASE + MSC01_PBC_CS0MSKL_OFS) +#define MSC01_PBC_CS1BASL (MSC01_PBC_REG_BASE + MSC01_PBC_CS1BASL_OFS) +#define MSC01_PBC_CS1MSKL (MSC01_PBC_REG_BASE + MSC01_PBC_CS1MSKL_OFS) +#define MSC01_PBC_CS2BASL (MSC01_PBC_REG_BASE + MSC01_PBC_CS2BASL_OFS) +#define MSC01_PBC_CS2MSKL (MSC01_PBC_REG_BASE + MSC01_PBC_CS2MSKL_OFS) +#define MSC01_PBC_CS3BASL (MSC01_PBC_REG_BASE + MSC01_PBC_CS3BASL_OFS) +#define MSC01_PBC_CS3MSKL (MSC01_PBC_REG_BASE + MSC01_PBC_CS3MSKL_OFS) + +#define MSC01_PBC_CS0CFG (MSC01_PBC_REG_BASE + MSC01_PBC_CS0CFG_OFS) +#define MSC01_PBC_CS0TIM (MSC01_PBC_REG_BASE + MSC01_PBC_CS0TIM_OFS) +#define MSC01_PBC_CS0RW (MSC01_PBC_REG_BASE + MSC01_PBC_CS0RW_OFS) +#define MSC01_PBC_CS1CFG (MSC01_PBC_REG_BASE + MSC01_PBC_CS1CFG_OFS) +#define MSC01_PBC_CS1TIM (MSC01_PBC_REG_BASE + MSC01_PBC_CS1TIM_OFS) +#define MSC01_PBC_CS1RW (MSC01_PBC_REG_BASE + MSC01_PBC_CS1RW_OFS) +#define MSC01_PBC_CS2CFG (MSC01_PBC_REG_BASE + MSC01_PBC_CS2CFG_OFS) +#define MSC01_PBC_CS2TIM (MSC01_PBC_REG_BASE + MSC01_PBC_CS2TIM_OFS) +#define MSC01_PBC_CS2RW (MSC01_PBC_REG_BASE + MSC01_PBC_CS2RW_OFS) +#define MSC01_PBC_CS3CFG (MSC01_PBC_REG_BASE + MSC01_PBC_CS3CFG_OFS) +#define MSC01_PBC_CS3TIM (MSC01_PBC_REG_BASE + MSC01_PBC_CS3TIM_OFS) +#define MSC01_PBC_CS3RW (MSC01_PBC_REG_BASE + MSC01_PBC_CS3RW_OFS) + +#define MSC01_PBC_CSxCFG_DTYP_8BIT 0 +#define MSC01_PBC_CSxCFG_DTYP_16BIT 1 +#define MSC01_PBC_CSxCFG_DTYP_32BIT 2 +#define MSC01_PBC_CS0CFG_DTYP_8BIT MSC01_PBC_CSxCFG_DTYP_8BIT +#define MSC01_PBC_CS0CFG_DTYP_16BIT MSC01_PBC_CSxCFG_DTYP_16BIT +#define MSC01_PBC_CS0CFG_DTYP_32BIT MSC01_PBC_CSxCFG_DTYP_32BIT +#define MSC01_PBC_CS1CFG_DTYP_8BIT MSC01_PBC_CSxCFG_DTYP_8BIT +#define MSC01_PBC_CS1CFG_DTYP_16BIT MSC01_PBC_CSxCFG_DTYP_16BIT +#define MSC01_PBC_CS1CFG_DTYP_32BIT MSC01_PBC_CSxCFG_DTYP_32BIT +#define MSC01_PBC_CS2CFG_DTYP_8BIT MSC01_PBC_CSxCFG_DTYP_8BIT +#define MSC01_PBC_CS2CFG_DTYP_16BIT MSC01_PBC_CSxCFG_DTYP_16BIT +#define MSC01_PBC_CS2CFG_DTYP_32BIT MSC01_PBC_CSxCFG_DTYP_32BIT +#define MSC01_PBC_CS3CFG_DTYP_8BIT MSC01_PBC_CSxCFG_DTYP_8BIT +#define MSC01_PBC_CS3CFG_DTYP_16BIT MSC01_PBC_CSxCFG_DTYP_16BIT +#define MSC01_PBC_CS3CFG_DTYP_32BIT MSC01_PBC_CSxCFG_DTYP_32BIT + + +/* + **************************************************************************** + * Register offset addresses + *************************************************************************** + */ + +/* PCI bridge ID in MSC01_PCI_ID */ +#define MSC01_ID_PCI 0x82 + +#define MSC01_PCI_ID_OFS 0x0000 +#define MSC01_PCI_SC2PMBASL_OFS 0x0208 +#define MSC01_PCI_SC2PMMSKL_OFS 0x0218 +#define MSC01_PCI_SC2PMMAPL_OFS 0x0228 +#define MSC01_PCI_SC2PIOBASL_OFS 0x0248 +#define MSC01_PCI_SC2PIOMSKL_OFS 0x0258 +#define MSC01_PCI_SC2PIOMAPL_OFS 0x0268 +#define MSC01_PCI_P2SCMSKL_OFS 0x0308 +#define MSC01_PCI_P2SCMAPL_OFS 0x0318 +#define MSC01_PCI_INTCFG_OFS 0x0600 +#define MSC01_PCI_INTSTAT_OFS 0x0608 +#define MSC01_PCI_CFGADDR_OFS 0x0610 +#define MSC01_PCI_CFGDATA_OFS 0x0618 +#define MSC01_PCI_IACK_OFS 0x0620 +#define MSC01_PCI_HEAD0_OFS 0x2000 /* DevID, VendorID */ +#define MSC01_PCI_HEAD1_OFS 0x2008 /* Status, Command */ +#define MSC01_PCI_HEAD2_OFS 0x2010 /* Class code, RevID */ +#define MSC01_PCI_HEAD3_OFS 0x2018 /* bist, header, latency */ +#define MSC01_PCI_HEAD4_OFS 0x2020 /* BAR 0 */ +#define MSC01_PCI_HEAD5_OFS 0x2028 /* BAR 1 */ +#define MSC01_PCI_HEAD6_OFS 0x2030 /* BAR 2 */ +#define MSC01_PCI_HEAD7_OFS 0x2038 /* BAR 3 */ +#define MSC01_PCI_HEAD8_OFS 0x2040 /* BAR 4 */ +#define MSC01_PCI_HEAD9_OFS 0x2048 /* BAR 5 */ +#define MSC01_PCI_HEAD10_OFS 0x2050 /* CardBus CIS Ptr */ +#define MSC01_PCI_HEAD11_OFS 0x2058 /* SubSystem ID, -VendorID */ +#define MSC01_PCI_HEAD12_OFS 0x2060 /* ROM BAR */ +#define MSC01_PCI_HEAD13_OFS 0x2068 /* Capabilities ptr */ +#define MSC01_PCI_HEAD14_OFS 0x2070 /* reserved */ +#define MSC01_PCI_HEAD15_OFS 0x2078 /* Maxl, ming, intpin, int */ +#define MSC01_PCI_BAR0_OFS 0x2220 +#define MSC01_PCI_CFG_OFS 0x2380 +#define MSC01_PCI_SWAP_OFS 0x2388 + + +/* + **************************************************************************** + * Register encodings + *************************************************************************** + */ + +#define MSC01_PCI_ID_ID_SHF 16 +#define MSC01_PCI_ID_ID_MSK 0x00ff0000 +#define MSC01_PCI_ID_MAR_SHF 8 +#define MSC01_PCI_ID_MAR_MSK 0x0000ff00 +#define MSC01_PCI_ID_MIR_SHF 0 +#define MSC01_PCI_ID_MIR_MSK 0x000000ff + +#define MSC01_PCI_SC2PMBASL_BAS_SHF 24 +#define MSC01_PCI_SC2PMBASL_BAS_MSK 0xff000000 + +#define MSC01_PCI_SC2PMMSKL_MSK_SHF 24 +#define MSC01_PCI_SC2PMMSKL_MSK_MSK 0xff000000 + +#define MSC01_PCI_SC2PMMAPL_MAP_SHF 24 +#define MSC01_PCI_SC2PMMAPL_MAP_MSK 0xff000000 + +#define MSC01_PCI_SC2PIOBASL_BAS_SHF 24 +#define MSC01_PCI_SC2PIOBASL_BAS_MSK 0xff000000 + +#define MSC01_PCI_SC2PIOMSKL_MSK_SHF 24 +#define MSC01_PCI_SC2PIOMSKL_MSK_MSK 0xff000000 + +#define MSC01_PCI_SC2PIOMAPL_MAP_SHF 24 +#define MSC01_PCI_SC2PIOMAPL_MAP_MSK 0xff000000 + +#define MSC01_PCI_P2SCMSKL_MSK_SHF 20 +#define MSC01_PCI_P2SCMSKL_MSK_MSK 0xfff00000 + +#define MSC01_PCI_P2SCMAPL_MAP_SHF 20 +#define MSC01_PCI_P2SCMAPL_MAP_MSK 0xfff00000 + +#define MSC01_PCI_INTCFG_RST_SHF 10 +#define MSC01_PCI_INTCFG_RST_MSK 0x00000400 +#define MSC01_PCI_INTCFG_RST_BIT 0x00000400 +#define MSC01_PCI_INTCFG_MWE_SHF 9 +#define MSC01_PCI_INTCFG_MWE_MSK 0x00000200 +#define MSC01_PCI_INTCFG_MWE_BIT 0x00000200 +#define MSC01_PCI_INTCFG_DTO_SHF 8 +#define MSC01_PCI_INTCFG_DTO_MSK 0x00000100 +#define MSC01_PCI_INTCFG_DTO_BIT 0x00000100 +#define MSC01_PCI_INTCFG_MA_SHF 7 +#define MSC01_PCI_INTCFG_MA_MSK 0x00000080 +#define MSC01_PCI_INTCFG_MA_BIT 0x00000080 +#define MSC01_PCI_INTCFG_TA_SHF 6 +#define MSC01_PCI_INTCFG_TA_MSK 0x00000040 +#define MSC01_PCI_INTCFG_TA_BIT 0x00000040 +#define MSC01_PCI_INTCFG_RTY_SHF 5 +#define MSC01_PCI_INTCFG_RTY_MSK 0x00000020 +#define MSC01_PCI_INTCFG_RTY_BIT 0x00000020 +#define MSC01_PCI_INTCFG_MWP_SHF 4 +#define MSC01_PCI_INTCFG_MWP_MSK 0x00000010 +#define MSC01_PCI_INTCFG_MWP_BIT 0x00000010 +#define MSC01_PCI_INTCFG_MRP_SHF 3 +#define MSC01_PCI_INTCFG_MRP_MSK 0x00000008 +#define MSC01_PCI_INTCFG_MRP_BIT 0x00000008 +#define MSC01_PCI_INTCFG_SWP_SHF 2 +#define MSC01_PCI_INTCFG_SWP_MSK 0x00000004 +#define MSC01_PCI_INTCFG_SWP_BIT 0x00000004 +#define MSC01_PCI_INTCFG_SRP_SHF 1 +#define MSC01_PCI_INTCFG_SRP_MSK 0x00000002 +#define MSC01_PCI_INTCFG_SRP_BIT 0x00000002 +#define MSC01_PCI_INTCFG_SE_SHF 0 +#define MSC01_PCI_INTCFG_SE_MSK 0x00000001 +#define MSC01_PCI_INTCFG_SE_BIT 0x00000001 + +#define MSC01_PCI_INTSTAT_RST_SHF 10 +#define MSC01_PCI_INTSTAT_RST_MSK 0x00000400 +#define MSC01_PCI_INTSTAT_RST_BIT 0x00000400 +#define MSC01_PCI_INTSTAT_MWE_SHF 9 +#define MSC01_PCI_INTSTAT_MWE_MSK 0x00000200 +#define MSC01_PCI_INTSTAT_MWE_BIT 0x00000200 +#define MSC01_PCI_INTSTAT_DTO_SHF 8 +#define MSC01_PCI_INTSTAT_DTO_MSK 0x00000100 +#define MSC01_PCI_INTSTAT_DTO_BIT 0x00000100 +#define MSC01_PCI_INTSTAT_MA_SHF 7 +#define MSC01_PCI_INTSTAT_MA_MSK 0x00000080 +#define MSC01_PCI_INTSTAT_MA_BIT 0x00000080 +#define MSC01_PCI_INTSTAT_TA_SHF 6 +#define MSC01_PCI_INTSTAT_TA_MSK 0x00000040 +#define MSC01_PCI_INTSTAT_TA_BIT 0x00000040 +#define MSC01_PCI_INTSTAT_RTY_SHF 5 +#define MSC01_PCI_INTSTAT_RTY_MSK 0x00000020 +#define MSC01_PCI_INTSTAT_RTY_BIT 0x00000020 +#define MSC01_PCI_INTSTAT_MWP_SHF 4 +#define MSC01_PCI_INTSTAT_MWP_MSK 0x00000010 +#define MSC01_PCI_INTSTAT_MWP_BIT 0x00000010 +#define MSC01_PCI_INTSTAT_MRP_SHF 3 +#define MSC01_PCI_INTSTAT_MRP_MSK 0x00000008 +#define MSC01_PCI_INTSTAT_MRP_BIT 0x00000008 +#define MSC01_PCI_INTSTAT_SWP_SHF 2 +#define MSC01_PCI_INTSTAT_SWP_MSK 0x00000004 +#define MSC01_PCI_INTSTAT_SWP_BIT 0x00000004 +#define MSC01_PCI_INTSTAT_SRP_SHF 1 +#define MSC01_PCI_INTSTAT_SRP_MSK 0x00000002 +#define MSC01_PCI_INTSTAT_SRP_BIT 0x00000002 +#define MSC01_PCI_INTSTAT_SE_SHF 0 +#define MSC01_PCI_INTSTAT_SE_MSK 0x00000001 +#define MSC01_PCI_INTSTAT_SE_BIT 0x00000001 + +#define MSC01_PCI_CFGADDR_BNUM_SHF 16 +#define MSC01_PCI_CFGADDR_BNUM_MSK 0x00ff0000 +#define MSC01_PCI_CFGADDR_DNUM_SHF 11 +#define MSC01_PCI_CFGADDR_DNUM_MSK 0x0000f800 +#define MSC01_PCI_CFGADDR_FNUM_SHF 8 +#define MSC01_PCI_CFGADDR_FNUM_MSK 0x00000700 +#define MSC01_PCI_CFGADDR_RNUM_SHF 2 +#define MSC01_PCI_CFGADDR_RNUM_MSK 0x000000fc + +#define MSC01_PCI_CFGDATA_DATA_SHF 0 +#define MSC01_PCI_CFGDATA_DATA_MSK 0xffffffff + + +#define MSC01_PCI_HEAD0_DID_SHF 16 +#define MSC01_PCI_HEAD0_DID_MSK 0xffff0000 +#define MSC01_PCI_HEAD0_VID_SHF 0 +#define MSC01_PCI_HEAD0_VID_MSK 0x0000ffff +#define MSC01_PCI_HEAD1_PED_SHF 31 +#define MSC01_PCI_HEAD1_PED_MSK 0x80000000 +#define MSC01_PCI_HEAD1_PED_BIT 0x80000000 +#define MSC01_PCI_HEAD1_SSE_SHF 30 +#define MSC01_PCI_HEAD1_SSE_MSK 0x40000000 +#define MSC01_PCI_HEAD1_SSE_BIT 0x40000000 +#define MSC01_PCI_HEAD1_MAR_SHF 29 +#define MSC01_PCI_HEAD1_MAR_MSK 0x20000000 +#define MSC01_PCI_HEAD1_MAR_BIT 0x20000000 +#define MSC01_PCI_HEAD1_TAR_SHF 28 +#define MSC01_PCI_HEAD1_TAR_MSK 0x10000000 +#define MSC01_PCI_HEAD1_TAR_BIT 0x10000000 +#define MSC01_PCI_HEAD1_TAS_SHF 27 +#define MSC01_PCI_HEAD1_TAS_MSK 0x08000000 +#define MSC01_PCI_HEAD1_TAS_BIT 0x08000000 +#define MSC01_PCI_HEAD1_DST_SHF 25 +#define MSC01_PCI_HEAD1_DST_MSK 0x06000000 +#define MSC01_PCI_HEAD1_DST_BIT 0x06000000 +#define MSC01_PCI_HEAD1_MPE_SHF 24 +#define MSC01_PCI_HEAD1_MPE_BIT 0x01000000 +#define MSC01_PCI_HEAD1_MPE_MSK 0x01000000 +#define MSC01_PCI_HEAD1_BB_SHF 23 +#define MSC01_PCI_HEAD1_BB_BIT 0x00800000 +#define MSC01_PCI_HEAD1_BB_MSK 0x00800000 +#define MSC01_PCI_HEAD1_UDF_SHF 22 +#define MSC01_PCI_HEAD1_UDF_BIT 0x00400000 +#define MSC01_PCI_HEAD1_UDF_MSK 0x00400000 +#define MSC01_PCI_HEAD1_66M_SHF 21 +#define MSC01_PCI_HEAD1_66M_BIT 0x00200000 +#define MSC01_PCI_HEAD1_66M_MSK 0x00200000 +#define MSC01_PCI_HEAD1_CAP_SHF 20 +#define MSC01_PCI_HEAD1_CAP_BIT 0x00100000 +#define MSC01_PCI_HEAD1_CAP_MSK 0x00100000 +#define MSC01_PCI_HEAD1_EBB_SHF 9 +#define MSC01_PCI_HEAD1_EBB_BIT 0x00000200 +#define MSC01_PCI_HEAD1_EBB_MSK 0x00000200 +#define MSC01_PCI_HEAD1_SE_SHF 8 +#define MSC01_PCI_HEAD1_SE_BIT 0x00000100 +#define MSC01_PCI_HEAD1_SE_MSK 0x00000100 +#define MSC01_PCI_HEAD1_SC_SHF 7 +#define MSC01_PCI_HEAD1_SC_BIT 0x00000080 +#define MSC01_PCI_HEAD1_SC_MSK 0x00000080 +#define MSC01_PCI_HEAD1_PER_SHF 6 +#define MSC01_PCI_HEAD1_PER_BIT 0x00000040 +#define MSC01_PCI_HEAD1_PER_MSK 0x00000040 +#define MSC01_PCI_HEAD1_VGA_SHF 5 +#define MSC01_PCI_HEAD1_VGA_BIT 0x00000020 +#define MSC01_PCI_HEAD1_VGA_MSK 0x00000020 +#define MSC01_PCI_HEAD1_MWI_SHF 4 +#define MSC01_PCI_HEAD1_MWI_BIT 0x00000010 +#define MSC01_PCI_HEAD1_MWI_MSK 0x00000010 +#define MSC01_PCI_HEAD1_MSC_SHF 3 +#define MSC01_PCI_HEAD1_MSC_BIT 0x00000008 +#define MSC01_PCI_HEAD1_MSC_MSK 0x00000008 +#define MSC01_PCI_HEAD1_EMA_SHF 2 +#define MSC01_PCI_HEAD1_EMA_BIT 0x00000004 +#define MSC01_PCI_HEAD1_EMA_MSK 0x00000004 +#define MSC01_PCI_HEAD1_EMS_SHF 1 +#define MSC01_PCI_HEAD1_EMS_MSK 0x00000002 +#define MSC01_PCI_HEAD1_EMS_BIT 0x00000002 +#define MSC01_PCI_HEAD1_EIO_SHF 0 +#define MSC01_PCI_HEAD1_EIO_MSK 0x00000001 +#define MSC01_PCI_HEAD1_EIO_BIT 0x00000001 +#define MSC01_PCI_HEAD2_CLASS_SHF 8 +#define MSC01_PCI_HEAD2_CLASS_MSK 0xffffff00 +#define MSC01_PCI_HEAD2_RID_SHF 0 +#define MSC01_PCI_HEAD2_RID_MSK 0x000000ff +#define MSC01_PCI_HEAD3_BIST_SHF 24 +#define MSC01_PCI_HEAD3_BIST_MSK 0xff000000 +#define MSC01_PCI_HEAD3_HTYPE_SHF 16 +#define MSC01_PCI_HEAD3_HTYPE_MSK 0x00ff0000 +#define MSC01_PCI_HEAD3_LAT_SHF 8 +#define MSC01_PCI_HEAD3_LAT_MSK 0x0000ff00 +#define MSC01_PCI_HEAD3_CLS_SHF 0 +#define MSC01_PCI_HEAD3_CLS_MSK 0x000000ff +#define MSC01_PCI_HEAD4_BAR_SHF 0 +#define MSC01_PCI_HEAD4_BAR_MSK 0xffffffff +#define MSC01_PCI_HEAD10_CIS_SHF 0 +#define MSC01_PCI_HEAD10_CIS_MSK 0xffffffff +#define MSC01_PCI_HEAD11_SID_SHF 16 +#define MSC01_PCI_HEAD11_SID_MSK 0xffff0000 +#define MSC01_PCI_HEAD11_SVID_SHF 0 +#define MSC01_PCI_HEAD11_SVID_MSK 0x0000ffff +#define MSC01_PCI_HEAD12_EROM_SHF 0 +#define MSC01_PCI_HEAD12_EROM_MSK 0xffffffff +#define MSC01_PCI_HEAD13_CAPP_SHF 0 +#define MSC01_PCI_HEAD13_CAPP_MSK 0x000000ff +#define MSC01_PCI_HEAD15_MAXL_SHF 24 +#define MSC01_PCI_HEAD15_MAXL_MSK 0xff000000 +#define MSC01_PCI_HEAD15_MING_SHF 16 +#define MSC01_PCI_HEAD15_MING_MSK 0x00ff0000 +#define MSC01_PCI_HEAD15_IPIN_SHF 8 +#define MSC01_PCI_HEAD15_IPIN_MSK 0x0000ff00 +#define MSC01_PCI_HEAD15_ILINE_SHF 0 +#define MSC01_PCI_HEAD15_ILINE_MSK 0x000000ff + +/* The defines below are ONLY valid for a MEM bar! */ +#define MSC01_PCI_BAR0_SIZE_SHF 4 +#define MSC01_PCI_BAR0_SIZE_MSK 0xfffffff0 +#define MSC01_PCI_BAR0_P_SHF 3 +#define MSC01_PCI_BAR0_P_MSK 0x00000008 +#define MSC01_PCI_BAR0_P_BIT MSC01_PCI_BAR0_P_MSK +#define MSC01_PCI_BAR0_D_SHF 1 +#define MSC01_PCI_BAR0_D_MSK 0x00000006 +#define MSC01_PCI_BAR0_T_SHF 0 +#define MSC01_PCI_BAR0_T_MSK 0x00000001 +#define MSC01_PCI_BAR0_T_BIT MSC01_PCI_BAR0_T_MSK + + +#define MSC01_PCI_CFG_RA_SHF 17 +#define MSC01_PCI_CFG_RA_MSK 0x00020000 +#define MSC01_PCI_CFG_RA_BIT MSC01_PCI_CFG_RA_MSK +#define MSC01_PCI_CFG_G_SHF 16 +#define MSC01_PCI_CFG_G_MSK 0x00010000 +#define MSC01_PCI_CFG_G_BIT MSC01_PCI_CFG_G_MSK +#define MSC01_PCI_CFG_EN_SHF 15 +#define MSC01_PCI_CFG_EN_MSK 0x00008000 +#define MSC01_PCI_CFG_EN_BIT MSC01_PCI_CFG_EN_MSK +#define MSC01_PCI_CFG_MRTRY_SHF 0 +#define MSC01_PCI_CFG_MRTRY_MSK 0x00000fff + +#define MSC01_PCI_SWAP_IO_SHF 18 +#define MSC01_PCI_SWAP_IO_MSK 0x000c0000 +#define MSC01_PCI_SWAP_IO_NOSWAP 0 +#define MSC01_PCI_SWAP_IO_BYTESWAP 1 +#define MSC01_PCI_SWAP_MEM_SHF 16 +#define MSC01_PCI_SWAP_MEM_MSK 0x00030000 +#define MSC01_PCI_SWAP_MEM_NOSWAP 0 +#define MSC01_PCI_SWAP_MEM_BYTESWAP 1 +#define MSC01_PCI_SWAP_BAR0_SHF 0 +#define MSC01_PCI_SWAP_BAR0_MSK 0x00000003 +#define MSC01_PCI_SWAP_BAR0_NOSWAP 0 +#define MSC01_PCI_SWAP_BAR0_BYTESWAP 1 + +/* + *************************************************************************** + * Registers absolute addresses + *************************************************************************** + */ + +#define MSC01_PCI_ID (MSC01_PCI_REG_BASE + MSC01_PCI_ID_OFS) +#define MSC01_PCI_SC2PMBASL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PMBASL_OFS) +#define MSC01_PCI_SC2PMMSKL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PMMSKL_OFS) +#define MSC01_PCI_SC2PMMAPL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PMMAPL_OFS) +#define MSC01_PCI_SC2PIOBASL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PIOBASL_OFS) +#define MSC01_PCI_SC2PIOMSKL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PIOMSKL_OFS) +#define MSC01_PCI_SC2PIOMAPL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PIOMAPL_OFS) +#define MSC01_PCI_P2SCMSKL (MSC01_PCI_REG_BASE + MSC01_PCI_P2SCMSKL_OFS) +#define MSC01_PCI_P2SCMAPL (MSC01_PCI_REG_BASE + MSC01_PCI_P2SCMAPL_OFS) +#define MSC01_PCI_INTCFG (MSC01_PCI_REG_BASE + MSC01_PCI_INTCFG_OFS) +#define MSC01_PCI_INTSTAT (MSC01_PCI_REG_BASE + MSC01_PCI_INTSTAT_OFS) +#define MSC01_PCI_CFGADDR (MSC01_PCI_REG_BASE + MSC01_PCI_CFGADDR_OFS) +#define MSC01_PCI_CFGDATA (MSC01_PCI_REG_BASE + MSC01_PCI_CFGDATA_OFS) +#define MSC01_PCI_IACK (MSC01_PCI_REG_BASE + MSC01_PCI_IACK_OFS) +#define MSC01_PCI_HEAD0 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD0_OFS) +#define MSC01_PCI_HEAD1 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD1_OFS) +#define MSC01_PCI_HEAD2 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD2_OFS) +#define MSC01_PCI_HEAD3 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD3_OFS) +#define MSC01_PCI_HEAD4 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD4_OFS) +#define MSC01_PCI_HEAD5 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD5_OFS) +#define MSC01_PCI_HEAD6 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD6_OFS) +#define MSC01_PCI_HEAD7 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD7_OFS) +#define MSC01_PCI_HEAD8 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD8_OFS) +#define MSC01_PCI_HEAD9 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD9_OFS) +#define MSC01_PCI_HEAD10 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD10_OFS) +#define MSC01_PCI_HEAD11 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS) +#define MSC01_PCI_HEAD12 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD12_OFS) +#define MSC01_PCI_HEAD13 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD13_OFS) +#define MSC01_PCI_HEAD14 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD14_OFS) +#define MSC01_PCI_HEAD15 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD15_OFS) +#define MSC01_PCI_BAR0 (MSC01_PCI_REG_BASE + MSC01_PCI_BAR0_OFS) +#define MSC01_PCI_CFG (MSC01_PCI_REG_BASE + MSC01_PCI_CFG_OFS) +#define MSC01_PCI_SWAP (MSC01_PCI_REG_BASE + MSC01_PCI_SWAP_OFS) + + +/* + *********************************************************************** + * Register offset addresses and access types + ************************************************************************ + */ + +#define SPD_FUNDAMENTAL_TYPE 2 +#define SPD_ROWS 3 +#define SPD_COL 4 +#define SPD_MODULE_BANKS 5 +#define SPD_MODULE_WIDTH_LO 6 +#define SPD_MODULE_WIDTH_HI 7 +#define SPD_CONFIG_TYPE 11 +#define SPD_RFSH_RT 12 +#define SPD_SDRAM_WIDTH 13 +#define SPD_EC_SDRAM 14 +#define SPD_BURSTLEN 16 +#define SPD_DEVICE_BANKS 17 +#define SPD_CASLAT 18 +#define SPD_CSLAT 19 +#define SPD_WRLAT 20 +#define SPD_MRPT 27 +#define SPD_TRP 27 +#define SPD_RCDM 29 +#define SPD_TRCD 29 +#define SPD_MRPW 30 +#define SPD_TRAS 30 +#define SPD_ROW_DENSITY 31 + + +/* + *********************************************************************** + * Register encodings + ************************************************************************ + */ + +#define SPD_FUNDAMENTAL_TYPE_SDR 4 +#define SPD_FUNDAMENTAL_TYPE_DDR 7 + +#define SPD_ROWS_A_SHF 0 +#define SPD_ROWS_A_MSK (MSK(4) << SPD_ROWS_A_SHF) + +#define SPD_ROWS_B_SHF 4 +#define SPD_ROWS_B_MSK (MSK(4) << SPD_ROWS_B_SHF) + +#define SPD_COL_A_SHF 0 +#define SPD_COL_A_MSK (MSK(4) << SPD_COL_A_SHF) + +#define SPD_COL_B_SHF 4 +#define SPD_COL_B_MSK (MSK(4) << SPD_COL_B_SHF) + +#define SPD_CASLAT_1_SHF 0 +#define SPD_CASLAT_1_MSK (MSK(1) << SPD_CASLAT_1_SHF) +#define SPD_CASLAT_1_BIT SPD_CASLAT_1_MSK + +#define SPD_CASLAT_2_SHF 1 +#define SPD_CASLAT_2_MSK (MSK(1) << SPD_CASLAT_2_SHF) +#define SPD_CASLAT_2_BIT SPD_CASLAT_2_MSK + +#define SPD_CASLAT_3_SHF 2 +#define SPD_CASLAT_3_MSK (MSK(1) << SPD_CASLAT_3_SHF) +#define SPD_CASLAT_3_BIT SPD_CASLAT_3_MSK + +#define SPD_DDRCASLAT_1_0_SHF 0 +#define SPD_DDRCASLAT_1_0_MSK (MSK(1) << SPD_DDRCASLAT_1_0_SHF) +#define SPD_DDRCASLAT_1_0_BIT SPD_DDRCASLAT_4_MSK + +#define SPD_DDRCASLAT_1_5_SHF 1 +#define SPD_DDRCASLAT_1_5_MSK (MSK(1) << SPD_DDRCASLAT_1_5_SHF) +#define SPD_DDRCASLAT_1_5_BIT SPD_DDRCASLAT_1_5_MSK + +#define SPD_DDRCASLAT_2_0_SHF 2 +#define SPD_DDRCASLAT_2_0_MSK (MSK(1) << SPD_DDRCASLAT_2_0_SHF) +#define SPD_DDRCASLAT_2_0_BIT SPD_DDRCASLAT_2_0_MSK + +#define SPD_DDRCASLAT_2_5_SHF 3 +#define SPD_DDRCASLAT_2_5_MSK (MSK(1) << SPD_DDRCASLAT_2_5_SHF) +#define SPD_DDRCASLAT_2_5_BIT SPD_DDRCASLAT_2_5_MSK + +#define SPD_DDRCASLAT_3_0_SHF 4 +#define SPD_DDRCASLAT_3_0_MSK (MSK(1) << SPD_DDRCASLAT_3_0_SHF) +#define SPD_DDRCASLAT_3_0_BIT SPD_DDRCASLAT_3_0_MSK + +#define SPD_CSLAT_0_SHF 0 +#define SPD_CSLAT_0_MSK (MSK(1) << SPD_CASLAT_1_SHF) +#define SPD_CSLAT_0_BIT SPD_CSLAT_0_MSK + +#define SPD_CSLAT_1_SHF 1 +#define SPD_CSLAT_1_MSK (MSK(1) << SPD_CASLAT_2_SHF) +#define SPD_CSLAT_1_BIT SPD_CSLAT_1_MSK + +#define SPD_WRLAT_0_SHF 0 +#define SPD_WRLAT_0_MSK (MSK(1) << SPD_CASLAT_1_SHF) +#define SPD_WRLAT_0_BIT SPD_WRLAT_0_MSK + +#define SPD_WRLAT_1_SHF 1 +#define SPD_WRLAT_1_MSK (MSK(1) << SPD_CASLAT_2_SHF) +#define SPD_WRLAT_1_BIT SPD_WRLAT_1_MSK + +#define SPD_BURSTLEN_8_SHF 3 +#define SPD_BURSTLEN_8_MSK (MSK(1) << SPD_BURSTLEN_8_SHF) +#define SPD_BURSTLEN_8_BIT SPD_BURSTLEN_8_MSK + +#define SPD_BURSTLEN_4_SHF 2 +#define SPD_BURSTLEN_4_MSK (MSK(1) << SPD_BURSTLEN_4_SHF) +#define SPD_BURSTLEN_4_BIT SPD_BURSTLEN_4_MSK + +#define SPD_BURSTLEN_2_SHF 1 +#define SPD_BURSTLEN_2_MSK (MSK(1) << SPD_BURSTLEN_2_SHF) +#define SPD_BURSTLEN_2_BIT SPD_BURSTLEN_2_MSK + +#define SPD_BURSTLEN_1_SHF 0 +#define SPD_BURSTLEN_1_MSK (MSK(1) << SPD_BURSTLEN_1_SHF) +#define SPD_BURSTLEN_1_BIT SPD_BURSTLEN_1_MSK + +#define SPD_CONFIG_TYPE_NONE 0x0 +#define SPD_CONFIG_TYPE_PARITY 0x1 +#define SPD_CONFIG_TYPE_ECC 0x2 + +#define SPD_RFSH_RT_RATE_SHF 0 +#define SPD_RFSH_RT_RATE_MSK (MSK(7) << SPD_RFSH_RT_RATE_SHF) +#define SPD_RFSH_RT_RATE_125 5 +#define SPD_RFSH_RT_RATE_62_5 4 +#define SPD_RFSH_RT_RATE_31_3 3 +#define SPD_RFSH_RT_RATE_15_625 0 +#define SPD_RFSH_RT_RATE_7_8 2 +#define SPD_RFSH_RT_RATE_3_9 1 + +#define SPD_SDRAM_WIDTH_W_SHF 0 +#define SPD_SDRAM_WIDTH_W_MSK (MSK(7) << SPD_SDRAM_WIDTH_W_SHF) +#define SPD_SDRAM_WIDTH_B2_SHF 7 +#define SPD_SDRAM_WIDTH_B2_MSK (MSK(1) << SPD_SDRAM_WIDTH_B2_SHF) +#define SPD_SDRAM_WIDTH_B2_BIT SPD_SDRAM_WIDTH_B2_MSK + +#define SPD_EC_SDRAM_WIDTH_SHF 0 +#define SPD_EC_SDRAM_WIDTH_MSK (MSK(7) << SPD_EC_SDRAM_WIDTH_SHF) + + +/* + *********************************************************************** + * Definitions + *********************************************************************** + */ + +/* The following mapping matches the msc01_system1 testbench used in + * the SOC-it deliverables. In this testbench, the IP blocks are attached + * to the kernel as follows: + * + * IP1: "Testbench Monitor", not used in a real system + * IP2: AHB bridge, PCI bridge, or nothing, depending on testbench build + * IP3: Peripheral bus bridge. + * + * This configuration is reflected by the defines below: + */ +#define MSC01_AHB_REG_BASE MSC01_REGADDR(MSC01_REGSPACE_IP2) +#define MSC01_PCI_REG_BASE MSC01_REGADDR(MSC01_REGSPACE_IP2) +#define MSC01_PBC_REG_BASE MSC01_REGADDR(MSC01_REGSPACE_IP3) + +/* Definitions used for configuration of misc. timing parameters */ +#ifndef MSC01_MC_TIMPAR_TDPL_PC133 +#define MSC01_MC_TIMPAR_TDPL_PC133 2 +#endif + +#ifndef MSC01_MC_TREFRESH_TREF_MIN +#define MSC01_MC_TREFRESH_TREF_MIN 100 +#endif + +/* Physical address setup for core-sys */ + +#define CORE_SYS_MEMORY_BASE MALTA_SYSTEMRAM_BASE /* MEM */ +#define CORE_SYS_MEMORY_SIZE MALTA_SYSTEMRAM_SIZE + +#define CORE_SYS_PCIMEM_BASE CORE_SYS_IP2MEM_BASE1 /* == IP2 */ +#define CORE_SYS_PCIMEM_SIZE10 0x08000000 /* effective size, msc01 v1.0 */ +#define CORE_SYS_PCIMEM_SIZE2N 0x10000000 /* "aligned" size */ +#define CORE_SYS_PCIIO_BASE 0x1b000000 /* 16Mbyte natural alignment (IP2) */ +#define CORE_SYS_PCIIO_SIZE 0x00800000 +#define CORE_SYS_IP2MEM_BASE1 0x10000000 +#define CORE_SYS_IP2MEM_SIZE1 0x08000000 +#define CORE_SYS_IP2MEM_BASE2 0x18000000 +#define CORE_SYS_IP2MEM_SIZE2 0x04000000 + +#define CORE_SYS_IP1MEM_BASE 0x1bc00000 /* IP1 (unused - put behind regbase) */ +#define CORE_SYS_IP1MEM_BASE10 0x1b800000 /* IP1 (msc01 v1.0) */ +#define CORE_SYS_IP1MEM_SIZE 0x00400000 + +#define CORE_SYS_REG_BASE 0x1bc00000 +#define CORE_SYS_REG_SIZE 0x00400000 + +#define CORE_SYS_PBCMEM_BASE 0x1c000000 /* IP3 */ +#define CORE_SYS_PBCMEM_SIZE 0x04000000 +#define CORE_SYS_IP3MEM_SIZE 0x00400000 /* temporary size during start up */ + + +/* PCI Configuration Registers */ + +#define CORE_SYS_PCI_REG(x) (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD0_OFS + (x) + (x)) +#define CORE_SYS_PCIDID CORE_SYS_PCI_REG(0x00) +#define CORE_SYS_PCICMD CORE_SYS_PCI_REG(0x04) +#define CORE_SYS_PCICLASS CORE_SYS_PCI_REG(0x08) +#define CORE_SYS_PCILTIMER CORE_SYS_PCI_REG(0x0c) +#define CORE_SYS_PCIBASE0 CORE_SYS_PCI_REG(0x10) +#define CORE_SYS_PCIINT CORE_SYS_PCI_REG(0x3c) + + +/* + ************************************************************************ + * P R I D R E G I S T E R ( 1 5 ) * + ************************************************************************ + * + * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 + * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Company Opts | Company ID | Procesor ID | Revision | PRId + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ + +#define S_PRIdCoOpt 24 /* Company options (R) */ +#define M_PRIdCoOpt (0xff << S_PRIdCoOpt) +#define S_PRIdCoID 16 /* Company ID (R) */ +#define M_PRIdCoID (0xff << S_PRIdCoID) +#define S_PRIdImp 8 /* Implementation ID (R) */ +#define M_PRIdImp (0xff << S_PRIdImp) +#define S_PRIdRev 0 /* Revision (R) */ +#define M_PRIdRev (0xff << S_PRIdRev) + +#define M_PRId0Fields 0x00000000 +#define M_PRIdRFields 0xffffffff + +/* Values in the Company ID field */ +#define K_PRIdCoID_MIPS 1 +#define K_PRIdCoID_Broadcom 2 +#define K_PRIdCoID_Alchemy 3 +#define K_PRIdCoID_SiByte 4 +#define K_PRIdCoID_SandCraft 5 +#define K_PRIdCoID_Philips 6 +#define K_PRIdCoID_Toshiba 7 +#define K_PRIdCoID_LSI 8 +#define K_PRIdCoID_UNANNOUNCED9 9 +#define K_PRIdCoID_UNANNOUNCED10 10 +#define K_PRIdCoID_Lexra 11 +#define K_PRIdCoID_NextAvailable 12 /* Next available encoding */ + + +/* Values in the implementation number field */ +#define K_PRIdImp_4KC 0x80 /* MIPS32 4Kc with TLB MMU and Release 1 Architecture*/ +#define K_PRIdImp_Jade 0x80 /* Alternate (obsolete) name */ +#define K_PRIdImp_5KC 0x81 /* MIPS64 5Kc/5Kf with TLB MMU and Release 1 Architecture */ +#define K_PRIdImp_Opal 0x81 /* Alternate (obsolete) name */ +#define K_PRIdImp_20KC 0x82 /* MIPS64 20Kc with TLB MMU and Release 1 Architecture */ +#define K_PRIdImp_Ruby 0x82 /* Alternate (obsolete) name */ +#define K_PRIdImp_4KMP 0x83 /* MIPS32 4Kp/4Km with FM MMU and Release 1 Architectur */ +#define K_PRIdImp_JadeLite 0x83 /* Alternate (obsolete) name */ +#define K_PRIdImp_4KEc 0x84 /* MIPS32 4KEc with TLB MMU and Release 1 Architecture */ +#define K_PRIdImp_4KEmp 0x85 /* MIPS32 4KEm/4KEp with FM MMU and Release 1 Architecture */ +#define K_PRIdImp_4KSc 0x86 /* MIPS32 4KSc with TLB MMU and Release 1 Architecture */ +#define K_PRIdImp_M4K 0x87 /* MIPS32 M4K with FM MMU and Release 2 Architecture */ +#define K_PRIdImp_25Kf 0x88 /* MIPS64 25Kf with TLB MMU and Release 1 Architecture */ +#define K_PRIdImp_Amethyst 0x88 /* Alternate (obsolete) name */ +#define K_PRIdImp_5KE 0x89 /* MIPS64 5KE with TLB MMU and Release 2 Architecture */ +#define K_PRIdImp_4KEc_R2 0x90 /* MIPS32 4KEc with TLB MMU and Release 2 Architecture */ +#define K_PRIdImp_4KEmp_R2 0x91 /* MIPS32 4KEm/4KEp with FM MMU and Release 2 Architecture */ +#define K_PRIdImp_4KSd 0x92 /* MIPS32 4KSd with TLB MMU and Release 2 Architecture */ + +#define K_PRIdImp_24K 0x93 /* MIPS32 24K (Topaz) with Release 2 Architecture */ +#define K_PRIdImp_Topaz 0x93 /* Alternate (obsolete) name */ +#define K_PRIdImp_TopazTLB 0x93 /* Alternate (obsolete) name */ + +#define K_PRIdImp_R3000 0x01 +#define K_PRIdImp_R4000 0x04 +#define K_PRIdImp_R10000 0x09 +#define K_PRIdImp_R4300 0x0b +#define K_PRIdImp_R5000 0x23 +#define K_PRIdImp_R5200 0x28 +#define K_PRIdImp_R5400 0x54 + +/* + ************************************************************************ + * C O N F I G R E G I S T E R ( 1 6 ) * + ************************************************************************ + * + * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 + * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * |M| |B| A | A | M |RSVD |V| K | Config + * | | Reserved for Implementations|E| T | R | T | |I| 0 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ + +#define S_ConfigMore 31 /* Additional config registers present (R) */ +#define M_ConfigMore (0x1 << S_ConfigMore) +#define S_ConfigImpl 16 /* Implementation-specific fields */ +#define M_ConfigImpl (0x7fff << S_ConfigImpl) +#define S_ConfigBE 15 /* Denotes big-endian operation (R) */ +#define M_ConfigBE (0x1 << S_ConfigBE) +#define S_ConfigAT 13 /* Architecture type (R) */ +#define M_ConfigAT (0x3 << S_ConfigAT) +#define S_ConfigAR 10 /* Architecture revision (R) */ +#define M_ConfigAR (0x7 << S_ConfigAR) +#define S_ConfigMT 7 /* MMU Type (R) */ +#define M_ConfigMT (0x7 << S_ConfigMT) +#define S_ConfigVI 3 /* Icache is virtual (R) */ +#define M_ConfigVI (0x1 << S_ConfigVI) +#define S_ConfigK0 0 /* Kseg0 coherency algorithm (R/W) */ +#define M_ConfigK0 (0x7 << S_ConfigK0) + +/* + * The following definitions are technically part of the "reserved for + * implementations" field, but are the semi-standard definition used in + * fixed-mapping MMUs to control the cacheability of kuseg and kseg2/3 + * references. For that reason, they are included here, but may be + * overridden by true implementation-specific definitions + */ +#define S_ConfigK23 28 /* Kseg2/3 coherency algorithm (FM MMU only) (R/W) */ +#define M_ConfigK23 (0x7 << S_ConfigK23) +#define S_ConfigKU 25 /* Kuseg coherency algorithm (FM MMU only) (R/W) */ +#define M_ConfigKU (0x7 << S_ConfigKU) + +#define M_Config0Fields 0x00000070 +#define M_ConfigRFields 0x8000ff88 + +/* + * Values in the AT field + */ +#define K_ConfigAT_MIPS32 0 /* MIPS32 */ +#define K_ConfigAT_MIPS64S 1 /* MIPS64 with 32-bit addresses */ +#define K_ConfigAT_MIPS64 2 /* MIPS64 with 32/64-bit addresses */ +#define K_ConfigAT_MAX 2 /* Max value */ + +/* + * Values in the AR field + */ + +#define K_ConfigAR_Rel1 0 /* Release 1 of the architecture */ +#define K_ConfigAR_Rel2 1 /* Release 2 of the architecture */ + +/* + * Values in the MT field + */ +#define K_ConfigMT_NoMMU 0 /* No MMU */ +#define K_ConfigMT_TLBMMU 1 /* Standard TLB MMU */ +#define K_ConfigMT_BATMMU 2 /* Standard BAT MMU */ +#define K_ConfigMT_FMTMMU 3 /* Standard FMT MMU */ +#define K_ConfigMT_FMMMU K_ConfigMT_FMTMMU /* alias for compatibility */ + + +/* + *********************************************************************** + * Definitions + *********************************************************************** + */ + + +/* Known vendors and device IDs */ +#define PCI_VENDID_GALILEO 0x11ab +#define PCI_DEVID_64120 0x4620 + +#define PCI_VENDID_PHILIPS 0x1131 +#define PCI_DEVID_9730 0x9730 + +#define PCI_VENDID_INTEL_A 0x1011 +#define PCI_DEVID_PPB 0x0022 + +#define PCI_VENDID_INTEL 0x8086 +#define PCI_DEVID_PIIX4_BRIDGE 0x7110 +#define PCI_DEVID_PIIX4_IDE 0x7111 +#define PCI_DEVID_PIIX4_USB 0x7112 +#define PCI_DEVID_PIIX4_POWER 0x7113 + +#define PCI_VENDID_SYMBIOS 0x1000 +#define PCI_DEVID_SCSI 0x0001 + +#define PCI_VENDID_AMD 0x1022 +#define PCI_DEVID_79C973 0x2000 + +#define PCI_VENDID_CRYSTAL 0x1013 +#define PCI_DEVID_4281 0x6005 + +#define PCI_VENDID_ALGORITHMICS 0xdf53 /* TBD : Likely to change */ +#define PCI_DEVID_BONITO64 0x0001 /* TBD : May change */ + +#define PCI_VENDID_MIPS 0x153f +#define PCI_DEVID_MSC01 0x0001 /* TBD : May change */ + +/* Local bus number */ +#define PCI_BUS_LOCAL 0 + + +/* from pci.h */ + +/* + *********************************************************************** + * Register encodings + *********************************************************************** + */ + +/* SC */ +#define PCI_SC_CMD_IOS_SHF 0 +#define PCI_SC_CMD_IOS_MSK (MSK(1) << PCI_SC_CMD_IOS_SHF) +#define PCI_SC_CMD_IOS_BIT PCI_SC_CMD_IOS_MSK + +#define PCI_SC_CMD_MS_SHF 1 +#define PCI_SC_CMD_MS_MSK (MSK(1) << PCI_SC_CMD_MS_SHF) +#define PCI_SC_CMD_MS_BIT PCI_SC_CMD_MS_MSK + +#define PCI_SC_CMD_BM_SHF 2 +#define PCI_SC_CMD_BM_MSK (MSK(1) << PCI_SC_CMD_BM_SHF) +#define PCI_SC_CMD_BM_BIT PCI_SC_CMD_BM_MSK + +#define PCI_SC_CMD_PERR_SHF 6 +#define PCI_SC_CMD_PERR_MSK (MSK(1) << PCI_SC_CMD_PERR_SHF) +#define PCI_SC_CMD_PERR_BIT PCI_SC_CMD_PERR_MSK + +#define PCI_SC_CMD_SERR_SHF 8 +#define PCI_SC_CMD_SERR_MSK (MSK(1) << PCI_SC_CMD_SERR_SHF) +#define PCI_SC_CMD_SERR_BIT PCI_SC_CMD_SERR_MSK + +#define PCI_SC_CMD_FBB_SHF 9 +#define PCI_SC_CMD_FBB_MSK (MSK(1) << PCI_SC_CMD_FBB_SHF) +#define PCI_SC_CMD_FBB_BIT PCI_SC_CMD_FBB_MSK + +/* ID */ +#define PCI_ID_DEVID_SHF 16 +#define PCI_ID_DEVID_MSK (MSK(16) << PCI_ID_DEVID_SHF) + +#define PCI_ID_VENDORID_SHF 0 +#define PCI_ID_VENDORID_MSK (MSK(16) << PCI_ID_VENDORID_SHF) + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmsc01h */ diff --git a/h/drv/multi/mz7120sp4.h b/h/drv/multi/mz7120sp4.h new file mode 100644 index 0000000..89dbc26 --- /dev/null +++ b/h/drv/multi/mz7120sp4.h @@ -0,0 +1,98 @@ +/* mz7120sp4.h - header file for Mizar mz7120 sp4 daughter board. */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01f,22sep92,rrr added support for c++ +01e,26may92,rrr the tree shuffle +01d,04oct91,rrr passed through the ansification filter + -changed copyright notice +01c,05oct90,shl added copyright notice. + made #endif ANSI style. +01b,29apr88,gae added definition of INCmz7120sp4h and include m68230.h. +01a,06jan88,miz written. +*/ + +/* +This file contains I/O address and related constants +for the Mizar mz7120 sp4 daughter board. +*/ + +#ifndef __INCmz7120sp4h +#define __INCmz7120sp4h + +#ifdef __cplusplus +extern "C" { +#endif + +/* equates for m68681 serial channel - for more explanation see m68681.h, */ +/* which must be included in any file which also includes this file */ + +#define MZ_68681_BASE ((char *) 0xfe000000) + +#define DUART_MRA (MZ_68681_BASE + 0x03) /* mode reg. A */ +#define DUART_CSRA (MZ_68681_BASE + 0x07) /* clock select reg. A */ +#define DUART_SRA DUART_CSRA /* status reg. A */ +#define DUART_CRA (MZ_68681_BASE + 0x0b) /* command reg. A */ +#define DUART_THRA (MZ_68681_BASE + 0x0f) /* transmit buffer A */ +#define DUART_RHRA DUART_THRA /* receive buffer A */ +#define DUART_ACR (MZ_68681_BASE + 0x13) /* auxiliary control reg. */ +#define DUART_IPCR DUART_ACR /* input port change reg. */ +#define DUART_IMR (MZ_68681_BASE + 0x17) /* int. mask reg. */ +#define DUART_ISR DUART_IMR /* int. status reg. */ +#define DUART_CTUR (MZ_68681_BASE + 0x1b) /* counter timer upper reg. */ +#define DUART_CTLR (MZ_68681_BASE + 0x1f) /* counter timer lower reg. */ +#define DUART_MRB (MZ_68681_BASE + 0x23) /* mode reg. B */ +#define DUART_CSRB (MZ_68681_BASE + 0x27) /* clock select reg. B */ +#define DUART_SRB DUART_CSRB /* status reg. B */ +#define DUART_CRB (MZ_68681_BASE + 0x2b) /* command reg. B */ +#define DUART_THRB (MZ_68681_BASE + 0x2f) /* transmit buffer B */ +#define DUART_RHRB DUART_THRB /* receive buffer B */ +#define DUART_IVR (MZ_68681_BASE + 0x33) /* int. vector reg. */ +#define DUART_OPCR (MZ_68681_BASE + 0x37) /* output port config. reg. */ +#define DUART_IP DUART_OPCR /* input port */ +#define DUART_SOPBC (MZ_68681_BASE + 0x3b) /* set output port bits */ +#define DUART_CTRON DUART_SOPBC /* counter on */ +#define DUART_ROPBC (MZ_68681_BASE + 0x3f) /* reset output port bits */ +#define DUART_CTROFF DUART_ROPBC /* counter off */ + +/* end of equates for m68681 */ + + +/* equates for m68230 pi/t channel - for more explanation see m68230.h, */ +/* which must be included in any file which also includes this file */ + +#define MZ_68230_BASE ((char *) 0xfe000080) + +#define PIT_PGCR (MZ_68230_BASE + 0x83) /* port general control reg. */ +#define PIT_PSRR (MZ_68230_BASE + 0x87) /* port service request reg. */ +#define PIT_PADDR (MZ_68230_BASE + 0x8b) /* port A data direction reg. */ +#define PIT_PBDDR (MZ_68230_BASE + 0x8f) /* port B data direction reg. */ +#define PIT_PCDDR (MZ_68230_BASE + 0x93) /* port C data direction reg. */ +#define PIT_PIVR (MZ_68230_BASE + 0x97) /* port int. vector reg. */ +#define PIT_PACR (MZ_68230_BASE + 0x9b) /* port A control reg. */ +#define PIT_PBCR (MZ_68230_BASE + 0x9f) /* port B control reg. */ +#define PIT_PADR (MZ_68230_BASE + 0xa3) /* port A data reg. */ +#define PIT_PBDR (MZ_68230_BASE + 0xa7) /* port B data reg. */ +#define PIT_PAAR (MZ_68230_BASE + 0xab) /* port A alternate reg. */ +#define PIT_PBAR (MZ_68230_BASE + 0xaf) /* port B alternate reg. */ +#define PIT_PCDR (MZ_68230_BASE + 0xb3) /* port C data reg. */ +#define PIT_PSR (MZ_68230_BASE + 0xb7) /* port status reg. */ +#define PIT_TCR (MZ_68230_BASE + 0xc3) /* timer control reg. */ +#define PIT_TIVR (MZ_68230_BASE + 0xc7) /* timer int. vector reg. */ +#define PIT_CPRHB (MZ_68230_BASE + 0xcf) /* ctr. preload reg. - MSB */ +#define PIT_CPRMB (MZ_68230_BASE + 0xd3) /* ctr. preload reg. - MB */ +#define PIT_CPRLB (MZ_68230_BASE + 0xd7) /* ctr. preload reg. - LSB */ +#define PIT_CRHB (MZ_68230_BASE + 0xdf) /* counter reg. - high byte */ +#define PIT_CRMB (MZ_68230_BASE + 0xe3) /* counter reg. - middle byte */ +#define PIT_CRLB (MZ_68230_BASE + 0xe7) /* counter reg. - low byte */ +#define PIT_TSR (MZ_68230_BASE + 0xeb) /* timer status reg. */ + +/* end of equates for m68230 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmz7120sp4h */ diff --git a/h/drv/multi/nvr4101.h b/h/drv/multi/nvr4101.h new file mode 100644 index 0000000..cb101ea --- /dev/null +++ b/h/drv/multi/nvr4101.h @@ -0,0 +1,350 @@ +/* nvr4101.h - NEC NVR4101 header file */ + +/* Copyright 1984-1997 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01a,11jun97,sru written. +*/ + +/* +This file contains constants for the NEC V4R4101. Register address +definitions for the various subsystems are provided, and some (but +not all) register field definitions are provided. +*/ + +#ifndef __INCnvr4101h +#define __INCnvr4101h + +#include "vxWorks.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define VR4101_ISA_IO8_BASE_ADRS PHYS_TO_K1(0x16000000) +#define VR4101_ISA_IO16_BASE_ADRS PHYS_TO_K1(0x17000000) +#define VR4101_ISA_MEM8_BASE_ADRS PHYS_TO_K1(0x14000000) +#define VR4101_ISA_MEM16_BASE_ADRS PHYS_TO_K1(0x15000000) + +/* interrupt bits in the status register */ + +#define VR4101_SR_ICU_INTERVAL_TIMER (1 << 11) +#define VR4101_SR_ICU_OTHER (1 << 10) + +/* VR4101 register definitions. */ + +#define VR4101_REG_BASE (0x0b000000 | K1BASE) + +#ifdef _ASMLANGUAGE +#define VR4101_ADRS(reg) (VR4101_REG_BASE + (reg)) +#else +#define VR4101_ADRS(reg) ((volatile UINT16 *)(VR4101_REG_BASE + (reg))) +#endif /* _ASMLANGUAGE */ + + +/* BCU registers */ + +#define VR4101_BCUCNTREG VR4101_ADRS(0x00) +#define VR4101_BCUBRREG VR4101_ADRS(0x02) +#define VR4101_BCUBRCNTREG VR4101_ADRS(0x04) +#define VR4101_BCUBCLREG VR4101_ADRS(0x06) +#define VR4101_BCUBCLCNTREG VR4101_ADRS(0x08) +#define VR4101_BCUSPEEDREG VR4101_ADRS(0x0a) +#define VR4101_BCUERRSTREG VR4101_ADRS(0x0c) +#define VR4101_BCUSRFCNT VR4101_ADRS(0x0e) +#define VR4101_PREVIDREG VR4101_ADRS(0x10) + +/* BCUCNTREG bit definitions */ + +#define VR4101_REF1K (1 << 7) +#define VR4101_PAGEROM (1 << 6) +#define VR4101_ROMWEN (1 << 5) +#define VR4101_SRFSTAT (1 << 4) +#define VR4101_BCPUREN (1 << 3) +#define VR4101_RSTOUT (1 << 0) + +/* DMAAU registers */ + +#define VR4101_PADDMAADRLREG VR4101_ADRS(0x20) +#define VR4101_PADDMAADRHREG VR4101_ADRS(0x22) +#define VR4101_SRXDMAADRLREG VR4101_ADRS(0x24) +#define VR4101_SRXDMAADRHREG VR4101_ADRS(0x26) +#define VR4101_STXDMAADRLREG VR4101_ADRS(0x28) +#define VR4101_STXDMAADRHREG VR4101_ADRS(0x2a) +#define VR4101_AUDIODMAADRLREG VR4101_ADRS(0x2c) +#define VR4101_AUDIODMAADRHREG VR4101_ADRS(0x2e) +#define VR4101_KEYDMAADRLREG VR4101_ADRS(0x30) +#define VR4101_KEYDMAADRHREG VR4101_ADRS(0x32) + +/* DCU registers */ + +#define VR4101_DMARSTREG VR4101_ADRS(0x40) +#define VR4101_DMAIDLEREG VR4101_ADRS(0x42) +#define VR4101_DMASENREG VR4101_ADRS(0x44) +#define VR4101_DMAMSKREG VR4101_ADRS(0x46) +#define VR4101_DMAREQREG VR4101_ADRS(0x48) + +/* DMA mask bit definitions */ + +#define VR4101_DMAMSKKIU (1 << 4) +#define VR4101_DMAMSKADU (1 << 3) +#define VR4101_DMAMSKSTX (1 << 2) +#define VR4101_DMAMSKSRX (1 << 1) +#define VR4101_DMAMSKPIU (1 << 0) + +/* CMU register */ + +#define VR4101_CMUCLKMSK VR4101_ADRS(0x60) +#define VR4101_MSKRTC (1 << 6) +#define VR4101_MSKDSIU (1 << 5) +#define VR4101_MSKGIU (1 << 4) +#define VR4101_MSKKIU (1 << 3) +#define VR4101_MSKADU (1 << 2) +#define VR4101_MSKSIU (1 << 1) +#define VR4101_MSKPIU (1 << 0) + +/* ICU system and system mask registers */ + +#define VR4101_ICU_SYSINTREG VR4101_ADRS(0x80) +#define VR4101_ICU_MSYSINTREG VR4101_ADRS(0x8c) +#define VR4101_DOZEPIUINTR (1 << 13) +#define VR4101_DOZEKIUINTR (1 << 12) +#define VR4101_SOFTINTR (1 << 11) +#define VR4101_WRBERRINTR (1 << 10) +#define VR4101_SIUINTR (1 << 9) +#define VR4101_GIUINTR (1 << 8) +#define VR4101_KIUINTR (1 << 7) +#define VR4101_ADUINTR (1 << 6) +#define VR4101_PIUINTR (1 << 5) +#define VR4101_PCMCIAINTR (1 << 4) +#define VR4101_ETIMERINTR (1 << 3) +#define VR4101_RTCLINTR (1 << 2) +#define VR4101_POWERINTR (1 << 1) +#define VR4101_BATINTR (1 << 0) + +/* ICU subsystem status and mask registers */ + +#define VR4101_ICU_PIUINTREG VR4101_ADRS(0x82) +#define VR4101_ICU_ADUINTREG VR4101_ADRS(0x84) +#define VR4101_ICU_KIUINTREG VR4101_ADRS(0x86) +#define VR4101_ICU_GIUINTREG VR4101_ADRS(0x88) +#define VR4101_ICU_SIUINTREG VR4101_ADRS(0x8a) +#define VR4101_ICU_MPIUINTREG VR4101_ADRS(0x8e) +#define VR4101_ICU_MADUINTREG VR4101_ADRS(0x90) +#define VR4101_ICU_MKIUINTREG VR4101_ADRS(0x92) +#define VR4101_ICU_MGIUINTREG VR4101_ADRS(0x94) +#define VR4101_ICU_MSIUINTREG VR4101_ADRS(0x96) +#define VR4101_ICU_NMIREG VR4101_ADRS(0x98) +#define VR4101_ICU_SOFTINTREG VR4101_ADRS(0x9a) + +/* ICU subsystem SIU mask register bit definitions */ + +#define VR4101_ICU_SIU_INTSER0 (1 << 13) +#define VR4101_ICU_SIU_INTSR0 (1 << 12) +#define VR4101_ICU_SIU_INTST0 (1 << 11) +#define VR4101_ICU_SIU_BR (1 << 10) +#define VR4101_ICU_SIU_FE (1 << 9) +#define VR4101_ICU_SIU_DCD (1 << 8) +#define VR4101_ICU_SIU_DSR (1 << 7) +#define VR4101_ICU_SIU_CTS (1 << 6) +#define VR4101_ICU_SIU_RXL (1 << 5) +#define VR4101_ICU_SIU_RXG (1 << 4) +#define VR4101_ICU_SIU_RXE (1 << 3) +#define VR4101_ICU_SIU_RXI (1 << 2) +#define VR4101_ICU_SIU_TXE (1 << 1) +#define VR4101_ICU_SIU_TXI (1 << 0) + +/* PMU registers */ + +#define VR4101_PMUINTREG VR4101_ADRS(0xa0) +#define VR4101_PMUCNTREG VR4101_ADRS(0xa2) +#define VR4101_HALTIMERRST (1 << 2) + +/* RTC registers */ + +#define VR4101_ETIMELREG VR4101_ADRS(0xc4) +#define VR4101_ETIMEMREG VR4101_ADRS(0xc6) +#define VR4101_ETIMEHREG VR4101_ADRS(0xc8) +#define VR4101_ECMPHREG VR4101_ADRS(0xca) +#define VR4101_ECMPLREG VR4101_ADRS(0xcc) +#define VR4101_ECMPMREG VR4101_ADRS(0xce) +#define VR4101_RTCLLREG VR4101_ADRS(0xd0) +#define VR4101_RTCLHREG VR4101_ADRS(0xd2) +#define VR4101_RTCLCNTLREG VR4101_ADRS(0xd4) +#define VR4101_RTCLCNTHREG VR4101_ADRS(0xd6) +#define VR4101_TCLKCNTLREG VR4101_ADRS(0xd8) +#define VR4101_TCLKCNTHREG VR4101_ADRS(0xda) +#define VR4101_RTCINTREG VR4101_ADRS(0xdc) +#define VR4101_RTC_RTCINTR0 (1 << 0) +#define VR4101_RTC_RTCINTR1 (1 << 1) + +/* DSU registers */ + +#define VR4101_DSUCNTREG VR4101_ADRS(0xe0) +#define VR4101_DSUSETREG VR4101_ADRS(0xe2) +#define VR4101_DSUCLRREG VR4101_ADRS(0xe4) +#define VR4101_DSUTIMREG VR4101_ADRS(0xe6) +#define VR4101_DSULOADREG VR4101_ADRS(0xe8) + +/* GIU registers */ + +#define VR4101_GOUTENREG VR4101_ADRS(0x100) +#define VR4101_GPOTDATREG VR4101_ADRS(0x102) +#define VR4101_GINTSTREG VR4101_ADRS(0x104) +#define VR4101_GINTENREG VR4101_ADRS(0x106) +#define VR4101_GCINTSREG VR4101_ADRS(0x108) +#define VR4101_GLINTSREG VR4101_ADRS(0x10a) + +/* The general-purpose I/O pins (GPIO) are enabled and controlled + via identically placed bits in the GIU registers and some of the + ICU registers. This set of pin masks can be used with whichever + registers contain GPIO pin configuration. */ + +#define VR4101_GPIO_PIN_12 (1 << 12) +#define VR4101_GPIO_PIN_11 (1 << 11) +#define VR4101_GPIO_PIN_10 (1 << 10) +#define VR4101_GPIO_PIN_9 (1 << 9) +#define VR4101_GPIO_PIN_8 (1 << 8) +#define VR4101_GPIO_PIN_7 (1 << 7) +#define VR4101_GPIO_PIN_6 (1 << 6) +#define VR4101_GPIO_PIN_5 (1 << 5) +#define VR4101_GPIO_PIN_4 (1 << 4) +#define VR4101_GPIO_PIN_3 (1 << 3) +#define VR4101_GPIO_PIN_2 (1 << 2) +#define VR4101_GPIO_PIN_1 (1 << 1) +#define VR4101_GPIO_PIN_0 (1 << 0) + +/* PIU registers */ + +#define VR4101_PIUDATAREG VR4101_ADRS(0x120) +#define VR4101_PIUCNTREG VR4101_ADRS(0x122) +#define VR4101_PIUINTREG VR4101_ADRS(0x124) +#define VR4101_PIUSIVLREG VR4101_ADRS(0x126) +#define VR4101_PIUSTBLREG VR4101_ADRS(0x128) +#define VR4101_PIUCMDREG VR4101_ADRS(0x12a) +#define VR4101_PIUCIVLREG VR4101_ADRS(0x13e) + +/* SIU registers */ + +#define VR4101_SIURXDATREG VR4101_ADRS(0x140) +#define VR4101_SIUTXDATREG VR4101_ADRS(0x142) +#define VR4101_SIUCNTREG VR4101_ADRS(0x144) +#define VR4101_SIUDLENGTHREG VR4101_ADRS(0x146) +#define VR4101_SIUINTREG VR4101_ADRS(0x148) +#define VR4101_SIURS232CREG VR4101_ADRS(0x14a) +#define VR4101_SIUBAUDSELREG VR4101_ADRS(0x14c) + +/* VR4101_SIUCNTREG definitions */ + +#define VR4101_SIU_RSP (1 << 12) +#define VR4101_SIU_TSP (1 << 11) +#define VR4101_SIU_RVD (1 << 9) +#define VR4101_SIU_TST (1 << 8) +#define VR4101_SIU_TVD (1 << 7) +#define VR4101_SIU_RSE (1 << 6) +#define VR4101_SIU_IME (1 << 5) +#define VR4101_SIU_IRDA_MODE (1 << 3) +#define VR4101_SIU_RS232_MODE (0 << 3) +#define VR4101_SIU_RXE (1 << 2) +#define VR4101_SIU_TXE (1 << 1) +#define VR4101_SIU_SRST (1 << 0) + +/* VR4101_SIUDLENGTHREG definitions */ + +#define VR4101_SIU_STOP_BITS_1 (0 << 8) +#define VR4101_SIU_STOP_BITS_2 (1 << 8) +#define VR4101_SIU_TX_CHAR_WIDTH_SHIFT (0) +#define VR4101_SIU_RX_CHAR_WIDTH_SHIFT (4) + +/* VR4101_SIURS232CREG definitions */ +#define VR4101_SIU_DTR (1 << 1) +#define VR4101_SIU_RTS (1 << 0) + +/* AIU registers */ + +#define VR4101_AIUDATREG VR4101_ADRS(0x162) +#define VR4101_AIURESETREG VR4101_ADRS(0x164) +#define VR4101_AIUMODEREG VR4101_ADRS(0x166) +#define VR4101_AIUSEQENREG VR4101_ADRS(0x168) +#define VR4101_AIUMUTEREG VR4101_ADRS(0x16a) +#define VR4101_AIUSTATREG VR4101_ADRS(0x16c) +#define VR4101_AIUSTPPAGEREG VR4101_ADRS(0x16e) +#define VR4101_AIUVALIDREG VR4101_ADRS(0x170) +#define VR4101_AIUINTRREG VR4101_ADRS(0x172) +#define VR4101_AIUCOUNT0REG VR4101_ADRS(0x174) +#define VR4101_AIUCOUNT1REG VR4101_ADRS(0x176) +#define VR4101_AIUREPNUMREG VR4101_ADRS(0x178) +#define VR4101_AIUBUSENREG VR4101_ADRS(0x17a) + +/* KIU registers */ + +#define VR4101_KIUDATREG VR4101_ADRS(0x180) +#define VR4101_KIUASCANREG VR4101_ADRS(0x184) +#define VR4101_KIUASTOPREG VR4101_ADRS(0x186) +#define VR4101_KIUSCANREG VR4101_ADRS(0x188) +#define VR4101_KIUSTOPREG VR4101_ADRS(0x18a) +#define VR4101_KIUSAPREG VR4101_ADRS(0x18c) +#define VR4101_KIUSCANSREG VR4101_ADRS(0x18e) +#define VR4101_KIUWKSREG VR4101_ADRS(0x190) +#define VR4101_KIUWKIREG VR4101_ADRS(0x192) +#define VR4101_KIUSRNREG VR4101_ADRS(0x194) +#define VR4101_KIUINTREG VR4101_ADRS(0x196) +#define VR4101_KIURSTREG VR4101_ADRS(0x198) +#define VR4101_KIUENREG VR4101_ADRS(0x19a) +#define VR4101_DOZEKEYINTREG VR4101_ADRS(0x19c) +#define VR4101_EVVOLREG VR4101_ADRS(0x19e) + +/* Debug SIU registers */ + +#define VR4101_ASIM00REG VR4101_ADRS(0x1a4) +#define VR4101_ASIM01REG VR4101_ADRS(0x1a6) +#define VR4101_RXB0RREG VR4101_ADRS(0x1a8) +#define VR4101_RXB0LREG VR4101_ADRS(0x1aa) +#define VR4101_RXS0RREG VR4101_ADRS(0x1ac) +#define VR4101_TXS0LREG VR4101_ADRS(0x1ae) +#define VR4101_ASIS0REG VR4101_ADRS(0x1b0) +#define VR4101_INTR0REG VR4101_ADRS(0x1b2) +#define VR4101_BPRM0REG VR4101_ADRS(0x1b6) +#define VR4101_DSIURESETREG VR4101_ADRS(0x1b8) + +/* DSIU subsystem DSIURESETREG bit definitions */ + +#define VR4101_DSIURST (1 << 0) + +/* DSIU subsystem ASIM00REG register bit definitions */ + +#define VR4101_ASIM00REG_RESERVED (1 << 7) +#define VR4101_RXE0 (1 << 6) +#define VR4101_DSIU_PAR_SHIFT 4 +#define VR4101_DSIU_PAR_EVEN (3 << VR4101_DSIU_PAR_SHIFT) +#define VR4101_DSIU_PAR_ODD (2 << VR4101_DSIU_PAR_SHIFT) +#define VR4101_DSIU_PAR_ZERO (1 << VR4101_DSIU_PAR_SHIFT) +#define VR4101_DSIU_PAR_EXTEND (0 << VR4101_DSIU_PAR_SHIFT) +#define VR4101_DSIU_CHARLEN_8 (1 << 3) +#define VR4101_DSIU_CHARLEN_7 (0 << 3) +#define VR4101_DSIU_STOPBITS_2 (1 << 2) +#define VR4101_DSIU_STOPBITS_1 (1 << 2) + +/* DSIU subsystem BPRM0REG register bit definitions */ + +#define VR4101_BRCE0 (1 << 7) + +/* DSIU subsystem INTR0REG register bit definitions */ + +#define VR4101_INTSER0 (1 << 2) +#define VR4101_INTSR0 (1 << 1) +#define VR4101_INTST0 (1 << 0) + +/* DSIU subsystem ASIS0REG register bit definitions */ + +#define VR4101_SOT0 (1 << 7) +#define VR4101_PE0 (1 << 2) +#define VR4101_FE0 (1 << 1) +#define VR4101_OVE0 (1 << 0) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnvr4101h */ diff --git a/h/drv/multi/nvr4102.h b/h/drv/multi/nvr4102.h new file mode 100644 index 0000000..f51dd96 --- /dev/null +++ b/h/drv/multi/nvr4102.h @@ -0,0 +1,412 @@ +/* nvr4102.h - NEC NVR4102 header file */ + +/* Copyright 1984-1997 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01b,22dec97,jmc revised VR4102_ISA_IO_BASE_ADRS for Unified Board rev 1.4. +01a,11jun97,sru written. +*/ + +/* +This file contains constants for the NEC V4R4101. Register address +definitions for the various subsystems are provided, and some (but +not all) register field definitions are provided. +*/ + +#ifndef __INCnvr4102h +#define __INCnvr4102h + +#include "vxWorks.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define VR4102_ICACHE_SIZE 4096 +#define VR4102_DCACHE_SIZE 1024 + +/* +The Unified Evaluation Board uses a different ISA IO base address. +If not using a Unified Evaluation Board, rev 1.4 or later, replace the +following define with the out-commented define that follows. +*/ + +#define VR4102_ISA_IO_BASE_ADRS PHYS_TO_K1(0x16000000) /* unified board */ +/*#define VR4102_ISA_IO_BASE_ADRS PHYS_TO_K1(0x15000000) *//* pre rev 1.4 */ + +/* interrupt bits in the status register */ + +#define VR4102_SR_ICU_INTERVAL_TIMER (1 << 11) +#define VR4102_SR_ICU_OTHER (1 << 10) + +/* VR4102 register definitions. */ + +#define VR4102_REG_BASE (0x0b000000 | K1BASE) + +#ifdef _ASMLANGUAGE +#define VR4102_ADRS(reg) (VR4102_REG_BASE + (reg)) +#else +#define VR4102_ADRS(reg) ((volatile UINT16 *)(VR4102_REG_BASE + (reg))) +#endif /* _ASMLANGUAGE */ + + +/* BCU registers */ + +#define VR4102_BCUCNTREG1 VR4102_ADRS(0x00) +#define VR4102_BCUCNTREG2 VR4102_ADRS(0x02) +#define VR4102_BCUSPEEDREG VR4102_ADRS(0x0a) +#define VR4102_BCUERRSTREG VR4102_ADRS(0x0c) +#define VR4102_BCURFCNTREG VR4102_ADRS(0x0e) +#define VR4102_REVIDREG VR4102_ADRS(0x10) +#define VR4102_BCURCOUNTRE VR4102_ADRS(0x12) +#define VR4102_CLKSPEEDREG VR4102_ADRS(0x14) + +/* BCUCNTREG1 bit definitions */ + +#define VR4102_ROM64 (1 << 15) +#define VR4102_DRAM64 (1 << 14) +#define VR4102_ISAM_LCD (1 << 13) /* XXX set this? */ +#define VR4102_PAGE128 (1 << 12) +#define VR4102_PAGEROM2 (1 << 10) +#define VR4102_PAGEROM0 (1 << 8) +#define VR4102_ROMWEN2 (1 << 6) +#define VR4102_ROMWEN0 (1 << 4) +#define VR4102_BUSHERREN (1 << 2) +#define VR4102_RSTOUT (1 << 0) + +/* BCUCNTREG2 bit definitions */ + +#define VR4102_GMODE (1 << 0) + +/* DMAAU registers */ + +#define VR4102_AIUBALREG VR4102_ADRS(0x20) +#define VR4102_AIUBAHREG VR4102_ADRS(0x22) +#define VR4102_AIUALREG VR4102_ADRS(0x24) +#define VR4102_AIUAHREG VR4102_ADRS(0x26) +#define VR4102_AIUOBALREG VR4102_ADRS(0x28) +#define VR4102_AIUOBAHREG VR4102_ADRS(0x2a) +#define VR4102_AIUOALREG VR4102_ADRS(0x2c) +#define VR4102_AIUOAHREG VR4102_ADRS(0x2e) +#define VR4102_FIRBALREG VR4102_ADRS(0x30) +#define VR4102_FIRBAHREG VR4102_ADRS(0x32) +#define VR4102_FIRALREG VR4102_ADRS(0x34) +#define VR4102_FIRAHREG VR4102_ADRS(0x36) + +/* DCU registers */ + +#define VR4102_DMARSTREG VR4102_ADRS(0x40) +#define VR4102_DMAIDLEREG VR4102_ADRS(0x42) +#define VR4102_DMASENREG VR4102_ADRS(0x44) +#define VR4102_DMAMSKREG VR4102_ADRS(0x46) +#define VR4102_DMAREQREG VR4102_ADRS(0x48) +#define VR4102_TDREG VR4102_ADRS(0x4a) + + +/* DMA mask bit definitions */ + +#define VR4102_DMAMSKAIN (1 << 3) +#define VR4102_DMAMSKAOUT (1 << 2) +#define VR4102_DMAMSKFOUT (1 << 0) + +/* CMU register */ + +#define VR4102_CMUCLKMSK VR4102_ADRS(0x60) +#define VR4102_MSKFFIR (1 << 10) +#define VR4102_MSKSHSP (1 << 9) +#define VR4102_MSKSSIU (1 << 8) /* XXX set this */ +#define VR4102_MSKDSIU (1 << 5) /* XXX set this */ +#define VR4102_MSKFIR (1 << 4) +#define VR4102_MSKKIU (1 << 3) +#define VR4102_MSKADU (1 << 2) +#define VR4102_MSKSIU (1 << 1) /* XXX set this */ +#define VR4102_MSKPIU (1 << 0) + +/* ICU system and system mask registers */ + +#define VR4102_ICU_SYSINT1REG VR4102_ADRS(0x80) +#define VR4102_ICU_MSYSINT1REG VR4102_ADRS(0x8c) +#define VR4102_DOZEPIUINTR (1 << 13) +#define VR4102_SOFTINTR (1 << 11) +#define VR4102_WRBERRINTR (1 << 10) +#define VR4102_SIUINTR (1 << 9) +#define VR4102_GIUINTR (1 << 8) +#define VR4102_KIUINTR (1 << 7) +#define VR4102_AIUINTR (1 << 6) +#define VR4102_PIUINTR (1 << 5) +#define VR4102_ETIMERINTR (1 << 3) +#define VR4102_RTCL1INTR (1 << 2) +#define VR4102_POWERINTR (1 << 1) +#define VR4102_BATINTR (1 << 0) + +#define VR4102_ICU_SYSINT2REG VR4102_ADRS(0x200) +#define VR4102_ICU_MSYSINT2REG VR4102_ADRS(0x206) +#define VR4102_DSIUINTR (1 << 5) +#define VR4102_FIRINTR (1 << 4) +#define VR4102_TCLKINTR (1 << 3) +#define VR4102_HSPINTR (1 << 2) +#define VR4102_LEDINTR (1 << 1) +#define VR4102_RTCL2INTR (1 << 0) + +/* ICU subsystem status and mask registers */ + +#define VR4102_ICU_PIUINTREG VR4102_ADRS(0x82) +#define VR4102_ICU_ADUINTREG VR4102_ADRS(0x84) +#define VR4102_ICU_KIUINTREG VR4102_ADRS(0x86) +#define VR4102_ICU_GIUINTLREG VR4102_ADRS(0x88) +#define VR4102_ICU_DSIUINTREG VR4102_ADRS(0x8a) +#define VR4102_ICU_MPIUINTREG VR4102_ADRS(0x8e) +#define VR4102_ICU_MAIUINTREG VR4102_ADRS(0x90) +#define VR4102_ICU_MKIUINTREG VR4102_ADRS(0x92) +#define VR4102_ICU_MGIUINTLREG VR4102_ADRS(0x94) +#define VR4102_ICU_MDSIUINTREG VR4102_ADRS(0x96) +#define VR4102_ICU_NMIREG VR4102_ADRS(0x98) +#define VR4102_ICU_SOFTINTREG VR4102_ADRS(0x9a) +#define VR4102_ICU_GIUINTHREG VR4102_ADRS(0x202) +#define VR4102_ICU_FIRINTHREG VR4102_ADRS(0x204) +#define VR4102_ICU_MGIUINTHREG VR4102_ADRS(0x208) +#define VR4102_ICU_MFIRINTHREG VR4102_ADRS(0x20a) + +/* ICU MDSIUINTREG bit definitions */ + +#define VR4102_ICU_DSIU_INTSR0 (1 << 9) +#define VR4102_ICU_DSIU_INTST0 (1 << 8) + +/* PMU registers */ + +#define VR4102_PMUINTREG VR4102_ADRS(0xa0) /* verify this adr XXX */ +#define VR4102_PMUCNTREG VR4102_ADRS(0xa2) /* verify this adr XXX */ +#define VR4102_HALTIMERRST (1 << 2) + +/* RTC registers */ + +#define VR4102_ETIMELREG VR4102_ADRS(0xc0) +#define VR4102_ETIMEMREG VR4102_ADRS(0xc2) +#define VR4102_ETIMEHREG VR4102_ADRS(0xc4) +#define VR4102_ECMPLREG VR4102_ADRS(0xc8) +#define VR4102_ECMPMREG VR4102_ADRS(0xca) +#define VR4102_ECMPHREG VR4102_ADRS(0xce) +#define VR4102_RTCL1LREG VR4102_ADRS(0xd0) +#define VR4102_RTCL1HREG VR4102_ADRS(0xd2) +#define VR4102_RTCL1CNTLREG VR4102_ADRS(0xd4) +#define VR4102_RTCL1CNTHREG VR4102_ADRS(0xd6) +#define VR4102_RTCL2LREG VR4102_ADRS(0xd8) +#define VR4102_RTCL2HREG VR4102_ADRS(0xda) +#define VR4102_RTCL2CNTLREG VR4102_ADRS(0xdc) +#define VR4102_RTCL2CNTHREG VR4102_ADRS(0xde) +#define VR4102_TCLKLREG VR4102_ADRS(0x1c0) +#define VR4102_TCLKHREG VR4102_ADRS(0x1c2) +#define VR4102_TCLKCNTLREG VR4102_ADRS(0x1c4) +#define VR4102_TCLKCNTHREG VR4102_ADRS(0x1c6) +#define VR4102_RTCINTREG VR4102_ADRS(0x1de) +#define VR4102_RTC_RTCINTR0 (1 << 0) +#define VR4102_RTC_RTCINTR1 (1 << 1) +#define VR4102_RTC_RTCINTR2 (1 << 2) +#define VR4102_RTC_RTCINTR3 (1 << 3) + +/* DSU registers */ + +#define VR4102_DSUCNTREG VR4102_ADRS(0xe0) +#define VR4102_DSUSETREG VR4102_ADRS(0xe2) +#define VR4102_DSUCLRREG VR4102_ADRS(0xe4) +#define VR4102_DSUTIMREG VR4102_ADRS(0xe6) +#define VR4102_DSULOADREG VR4102_ADRS(0xe8) + +/* GIU registers */ + +#define VR4102_GIUIOSELL VR4102_ADRS(0x100) +#define VR4102_GIUIOSELH VR4102_ADRS(0x102) +#define VR4102_GIUPIODL VR4102_ADRS(0x104) +#define VR4102_GIUPIODH VR4102_ADRS(0x106) +#define VR4102_GIUINTSTATL VR4102_ADRS(0x108) +#define VR4102_GIUINTSTATH VR4102_ADRS(0x10a) +#define VR4102_GIUINTENL VR4102_ADRS(0x10c) +#define VR4102_GIUINTENH VR4102_ADRS(0x10e) +#define VR4102_GIUINTTYPL VR4102_ADRS(0x110) +#define VR4102_GIUINTTYPH VR4102_ADRS(0x112) +#define VR4102_GIUINTALSELL VR4102_ADRS(0x114) +#define VR4102_GIUINTALSELH VR4102_ADRS(0x116) +#define VR4102_GIUINTHTSELL VR4102_ADRS(0x118) +#define VR4102_GIUINTHTSELH VR4102_ADRS(0x11a) +#define VR4102_GIUPODATL VR4102_ADRS(0x11c) +#define VR4102_GIUPODATH VR4102_ADRS(0x11e) + +/* The general-purpose I/O pins (GPIO) are enabled and controlled + via identically placed bits in the GIU registers and some of the + ICU registers. This set of pin masks can be used with whichever + registers contain GPIO pin configuration. */ + +#define VR4102_GPIO_PIN_31 (1 << 15) +#define VR4102_GPIO_PIN_30 (1 << 14) +#define VR4102_GPIO_PIN_29 (1 << 13) +#define VR4102_GPIO_PIN_28 (1 << 12) +#define VR4102_GPIO_PIN_27 (1 << 11) +#define VR4102_GPIO_PIN_26 (1 << 10) +#define VR4102_GPIO_PIN_25 (1 << 9) +#define VR4102_GPIO_PIN_24 (1 << 8) +#define VR4102_GPIO_PIN_23 (1 << 7) +#define VR4102_GPIO_PIN_22 (1 << 6) +#define VR4102_GPIO_PIN_21 (1 << 5) +#define VR4102_GPIO_PIN_20 (1 << 4) +#define VR4102_GPIO_PIN_19 (1 << 3) +#define VR4102_GPIO_PIN_18 (1 << 2) +#define VR4102_GPIO_PIN_17 (1 << 1) +#define VR4102_GPIO_PIN_16 (1 << 0) +#define VR4102_GPIO_PIN_15 (1 << 15) +#define VR4102_GPIO_PIN_14 (1 << 14) +#define VR4102_GPIO_PIN_13 (1 << 13) +#define VR4102_GPIO_PIN_12 (1 << 12) +#define VR4102_GPIO_PIN_11 (1 << 11) +#define VR4102_GPIO_PIN_10 (1 << 10) +#define VR4102_GPIO_PIN_9 (1 << 9) +#define VR4102_GPIO_PIN_8 (1 << 8) +#define VR4102_GPIO_PIN_7 (1 << 7) +#define VR4102_GPIO_PIN_6 (1 << 6) +#define VR4102_GPIO_PIN_5 (1 << 5) +#define VR4102_GPIO_PIN_4 (1 << 4) +#define VR4102_GPIO_PIN_3 (1 << 3) +#define VR4102_GPIO_PIN_2 (1 << 2) +#define VR4102_GPIO_PIN_1 (1 << 1) +#define VR4102_GPIO_PIN_0 (1 << 0) + +/* PIU registers */ + +#define VR4102_PIUCNTREG VR4102_ADRS(0x122) +#define VR4102_PIUINTREG VR4102_ADRS(0x124) +#define VR4102_PIUSIVLREG VR4102_ADRS(0x126) +#define VR4102_PIUSTBLREG VR4102_ADRS(0x128) +#define VR4102_PIUCMDREG VR4102_ADRS(0x12a) +#define VR4102_PIUASCNREG VR4102_ADRS(0x130) +#define VR4102_PIUAMSKREG VR4102_ADRS(0x132) +#define VR4102_PIUCIVLREG VR4102_ADRS(0x13e) +#define VR4102_PIUPB00REG VR4102_ADRS(0x2a0) +#define VR4102_PIUPB01REG VR4102_ADRS(0x2a2) +#define VR4102_PIUPB02REG VR4102_ADRS(0x2a4) +#define VR4102_PIUPB03REG VR4102_ADRS(0x2a6) +#define VR4102_PIUPB10REG VR4102_ADRS(0x2a8) +#define VR4102_PIUPB11REG VR4102_ADRS(0x2aa) +#define VR4102_PIUPB12REG VR4102_ADRS(0x2ac) +#define VR4102_PIUPB13REG VR4102_ADRS(0x2ae) +#define VR4102_PIUAB0REG VR4102_ADRS(0x2b0) +#define VR4102_PIUAB1REG VR4102_ADRS(0x2b2) +#define VR4102_PIUAB2REG VR4102_ADRS(0x2b4) +#define VR4102_PIUAB3REG VR4102_ADRS(0x2b6) +#define VR4102_PIUPB04REG VR4102_ADRS(0x2bc) +#define VR4102_PIUPB14REG VR4102_ADRS(0x2be) + +/* AIU registers */ + +#define VR4102_MDMADATREG VR4102_ADRS(0x160) +#define VR4102_SDMADATREG VR4102_ADRS(0x162) +#define VR4102_SODATREG VR4102_ADRS(0x166) +#define VR4102_SCNTREG VR4102_ADRS(0x168) +#define VR4102_SCNVRREG VR4102_ADRS(0x16a) +#define VR4102_SCNVCUNTREG VR4102_ADRS(0x16c) +#define VR4102_MIDATREG VR4102_ADRS(0x170) +#define VR4102_MCNTREG VR4102_ADRS(0x172) +#define VR4102_MCNVRREG VR4102_ADRS(0x174) +#define VR4102_MCNVCUNTREG VR4102_ADRS(0x176) +#define VR4102_DVALIDREG VR4102_ADRS(0x178) +#define VR4102_SEQREG VR4102_ADRS(0x17a) +#define VR4102_INTREG VR4102_ADRS(0x17c) + +/* KIU registers */ + +#define VR4102_KIUDAT0REG VR4102_ADRS(0x180) +#define VR4102_KIUDAT1REG VR4102_ADRS(0x182) +#define VR4102_KIUDAT2REG VR4102_ADRS(0x184) +#define VR4102_KIUDAT3REG VR4102_ADRS(0x186) +#define VR4102_KIUDAT4REG VR4102_ADRS(0x188) +#define VR4102_KIUDAT5REG VR4102_ADRS(0x18a) + +#define VR4102_KIUSCANREP VR4102_ADRS(0x190) +#define VR4102_DIUSCANS VR4102_ADRS(0x192) +#define VR4102_KIUWKS VR4102_ADRS(0x194) +#define VR4102_KIUWKI VR4102_ADRS(0x196) +#define VR4102_KIUINT VR4102_ADRS(0x198) +#define VR4102_KIURST VR4102_ADRS(0x19a) +#define VR4102_KIUGPEN VR4102_ADRS(0x19c) +#define VR4102_SCANLINE VR4102_ADRS(0x19e) + +/* Debug SIU registers */ + +#define VR4102_PORTREG VR4102_ADRS(0x1a0) /* new XXX */ +#define VR4102_MODEMREG VR4102_ADRS(0x1a2) /* new XXX */ +#define VR4102_ASIM00REG VR4102_ADRS(0x1a4) +#define VR4102_ASIM01REG VR4102_ADRS(0x1a6) +#define VR4102_RXB0RREG VR4102_ADRS(0x1a8) +#define VR4102_RXB0LREG VR4102_ADRS(0x1aa) +#define VR4102_RXS0RREG VR4102_ADRS(0x1ac) +#define VR4102_TXS0LREG VR4102_ADRS(0x1ae) +#define VR4102_ASIS0REG VR4102_ADRS(0x1b0) +#define VR4102_INTR0REG VR4102_ADRS(0x1b2) +#define VR4102_BRG0REG VR4102_ADRS(0x1b4) /* new XXX */ +#define VR4102_BPRM0REG VR4102_ADRS(0x1b6) +#define VR4102_DSIURESETREG VR4102_ADRS(0x1b8) + +/* DSIU subsystem DSIURESETREG bit definitions */ + +#define VR4102_DSIURST (1 << 0) + +/* DSIU subsystem ASIM00REG register bit definitions */ + +#define VR4102_ASIM00REG_RESERVED (1 << 7) +#define VR4102_RXE0 (1 << 6) +#define VR4102_DSIU_PAR_SHIFT 4 +#define VR4102_DSIU_PAR_EVEN (3 << VR4102_DSIU_PAR_SHIFT) +#define VR4102_DSIU_PAR_ODD (2 << VR4102_DSIU_PAR_SHIFT) +#define VR4102_DSIU_PAR_ZERO (1 << VR4102_DSIU_PAR_SHIFT) +#define VR4102_DSIU_PAR_EXTEND (0 << VR4102_DSIU_PAR_SHIFT) +#define VR4102_DSIU_CHARLEN_8 (1 << 3) +#define VR4102_DSIU_CHARLEN_7 (0 << 3) +#define VR4102_DSIU_STOPBITS_2 (1 << 2) +#define VR4102_DSIU_STOPBITS_1 (1 << 2) +#define VR4102_DSIU_SCLS0 (1 << 0) /* new XXX */ + +/* DSIU subsystem BPRM0REG register bit definitions */ + +#define VR4102_BRCE0 (1 << 7) + +/* DSIU subsystem INTR0REG register bit definitions */ + +#define VR4102_INTDCD (1 << 3) +#define VR4102_INTSER0 (1 << 2) +#define VR4102_INTSR0 (1 << 1) +#define VR4102_INTST0 (1 << 0) + +/* DSIU subsystem ASIS0REG register bit definitions */ + +#define VR4102_SOT0 (1 << 7) +#define VR4102_PE0 (1 << 2) +#define VR4102_FE0 (1 << 1) +#define VR4102_OVE0 (1 << 0) + +/* LED registers */ + +#define VR4102_LEDHTSREG VR4102_ADRS(0x240) +#define VR4102_LEDTLSREG VR4102_ADRS(0x242) +#define VR4102_LEDHLTCLREG VR4102_ADRS(0x244) +#define VR4102_LEDHLTCHREG VR4102_ADRS(0x246) +#define VR4102_LEDCNTREG VR4102_ADRS(0x248) +#define VR4102_LEDASTCREG VR4102_ADRS(0x24a) +#define VR4102_LEDINTREG VR4102_ADRS(0x24c) + +/* SIU registers -- (16550-compatible registers not included) */ + +#define VR4102_SIURSEL VR4102_ADRS(0x01000008) + +/* HSP registers */ + +#define VR4102_HSPINIT VR4102_ADRS(0x01000020) +#define VR4102_HSPDATA VR4102_ADRS(0x01000022) +#define VR4102_HSPINDEX VR4102_ADRS(0x01000024) +#define VR4102_HSPID VR4102_ADRS(0x01000028) +#define VR4102_HSPPCS VR4102_ADRS(0x01000029) +#define VR4102_HSPPCTEL VR4102_ADRS(0x01000029) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnvr4102h */ diff --git a/h/drv/multi/nvr4121.h b/h/drv/multi/nvr4121.h new file mode 100644 index 0000000..cfb4734 --- /dev/null +++ b/h/drv/multi/nvr4121.h @@ -0,0 +1,447 @@ +/* nvr4121.h - NEC NVR4121 header file */ + +/* Copyright 1984-1997 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01c,14oct99,jmw fix RTC reg VR4121_ECMPHREG address +01b,07oct99,jmw add vr4102 RTC and new BCU registers +01a,23aug99,jmw created from nvr4102.h for vr4121 bsp + +*/ + +/* +This file contains constants for the NEC V4R4101. Register address +definitions for the various subsystems are provided, and some (but +not all) register field definitions are provided. +*/ + +#ifndef __INCnvr4121h +#define __INCnvr4121h + +#include "vxWorks.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define VR4121_ICACHE_SIZE 16384 +#define VR4121_DCACHE_SIZE 8192 + + +#define VR4121_ISA_IO_BASE_ADRS PHYS_TO_K1(0x15000000) /* vr4121 SDB */ + +/* interrupt bits in the status register */ + +#define VR4121_SR_ICU_INTERVAL_TIMER (1 << 11) +#define VR4121_SR_ICU_OTHER (1 << 10) + +/* VR4121 register definitions. */ + +#define VR4121_REG_BASE (0x0b000000 | K1BASE) + +#ifdef _ASMLANGUAGE +#define VR4121_ADRS(reg) (VR4121_REG_BASE + (reg)) +#else +#define VR4121_ADRS(reg) ((volatile UINT16 *)(VR4121_REG_BASE + (reg))) +#endif /* _ASMLANGUAGE */ + + +/* BCU registers */ + +#define VR4121_BCUCNTREG1 VR4121_ADRS(0x00) +#define VR4121_BCUCNTREG2 VR4121_ADRS(0x02) +#define VR4121_ROMSIZEREG VR4121_ADRS(0x04) /* new */ +#define VR4121_RAMSIZEREG VR4121_ADRS(0x06) /* new */ +#define VR4121_BCUSPEEDREG VR4121_ADRS(0x0a) +#define VR4121_BCUERRSTREG VR4121_ADRS(0x0c) +#define VR4121_BCURFCNTREG VR4121_ADRS(0x0e) +#define VR4121_REVIDREG VR4121_ADRS(0x10) +#define VR4121_BCURCOUNTRE VR4121_ADRS(0x12) +#define VR4121_CLKSPEEDREG VR4121_ADRS(0x14) +#define VR4121_BCUCNTREG3 VR4121_ADRS(0x16) /* new */ +#define VR4121_SDRAMMODEREG VR4121_ADRS(0x1a) /* new */ +#define VR4121_SROMMODEREG VR4121_ADRS(0x1c) /* new */ +#define VR4121_SDRAMCNTREG VR4121_ADRS(0x1e) /* new */ + + +/* BCUCNTREG1 bit definitions */ + +#define VR4121_ROM64 (1 << 15) +#define VR4121_DRAM64 (1 << 14) +#define VR4121_ISAM_LCD (1 << 13) /* XXX set this? */ +#define VR4121_PAGE128 (1 << 12) +#define VR4121_PAGEROM2 (1 << 10) +#define VR4121_PAGEROM0 (1 << 8) +#define VR4121_ROMWEN2 (1 << 6) +#define VR4121_ROMWEN0 (1 << 4) +#define VR4121_BUSHERREN (1 << 2) +#define VR4121_RSTOUT (1 << 0) + +/* BCUCNTREG2 bit definitions */ + +#define VR4121_GMODE (1 << 0) + +/* DMAAU registers */ + +#define VR4121_AIUBALREG VR4121_ADRS(0x20) +#define VR4121_AIUBAHREG VR4121_ADRS(0x22) +#define VR4121_AIUALREG VR4121_ADRS(0x24) +#define VR4121_AIUAHREG VR4121_ADRS(0x26) +#define VR4121_AIUOBALREG VR4121_ADRS(0x28) +#define VR4121_AIUOBAHREG VR4121_ADRS(0x2a) +#define VR4121_AIUOALREG VR4121_ADRS(0x2c) +#define VR4121_AIUOAHREG VR4121_ADRS(0x2e) +#define VR4121_FIRBALREG VR4121_ADRS(0x30) +#define VR4121_FIRBAHREG VR4121_ADRS(0x32) +#define VR4121_FIRALREG VR4121_ADRS(0x34) +#define VR4121_FIRAHREG VR4121_ADRS(0x36) + +/* DCU registers */ + +#define VR4121_DMARSTREG VR4121_ADRS(0x40) +#define VR4121_DMAIDLEREG VR4121_ADRS(0x42) +#define VR4121_DMASENREG VR4121_ADRS(0x44) +#define VR4121_DMAMSKREG VR4121_ADRS(0x46) +#define VR4121_DMAREQREG VR4121_ADRS(0x48) +#define VR4121_TDREG VR4121_ADRS(0x4a) + + +/* DMA mask bit definitions */ + +#define VR4121_DMAMSKAIN (1 << 3) +#define VR4121_DMAMSKAOUT (1 << 2) +#define VR4121_DMAMSKFOUT (1 << 0) + +/* CMU register */ + +#define VR4121_CMUCLKMSK VR4121_ADRS(0x60) +#define VR4121_MSKFFIR (1 << 10) +#define VR4121_MSKSHSP (1 << 9) +#define VR4121_MSKSSIU (1 << 8) /* XXX set this */ +#define VR4121_MSKDSIU (1 << 5) /* XXX set this */ +#define VR4121_MSKFIR (1 << 4) +#define VR4121_MSKKIU (1 << 3) +#define VR4121_MSKADU (1 << 2) +#define VR4121_MSKSIU (1 << 1) /* XXX set this */ +#define VR4121_MSKPIU (1 << 0) + +/* ICU system and system mask registers */ + +#define VR4121_ICU_SYSINT1REG VR4121_ADRS(0x80) +#define VR4121_ICU_MSYSINT1REG VR4121_ADRS(0x8c) +#define VR4121_DOZEPIUINTR (1 << 13) +#define VR4121_SOFTINTR (1 << 11) +#define VR4121_WRBERRINTR (1 << 10) +#define VR4121_SIUINTR (1 << 9) +#define VR4121_GIUINTR (1 << 8) +#define VR4121_KIUINTR (1 << 7) +#define VR4121_AIUINTR (1 << 6) +#define VR4121_PIUINTR (1 << 5) +#define VR4121_ETIMERINTR (1 << 3) +#define VR4121_RTCL1INTR (1 << 2) +#define VR4121_POWERINTR (1 << 1) +#define VR4121_BATINTR (1 << 0) +#define VR4121_ZEROINTR 0 + +#define VR4121_ICU_SYSINT2REG VR4121_ADRS(0x200) +#define VR4121_ICU_MSYSINT2REG VR4121_ADRS(0x206) +#define VR4121_DSIUINTR (1 << 5) +#define VR4121_FIRINTR (1 << 4) +#define VR4121_TCLKINTR (1 << 3) +#define VR4121_HSPINTR (1 << 2) +#define VR4121_LEDINTR (1 << 1) +#define VR4121_RTCL2INTR (1 << 0) + +/* ICU subsystem status and mask registers */ + +#define VR4121_ICU_PIUINTREG VR4121_ADRS(0x82) +#define VR4121_ICU_ADUINTREG VR4121_ADRS(0x84) +#define VR4121_ICU_KIUINTREG VR4121_ADRS(0x86) +#define VR4121_ICU_GIUINTLREG VR4121_ADRS(0x88) +#define VR4121_ICU_DSIUINTREG VR4121_ADRS(0x8a) +#define VR4121_ICU_MPIUINTREG VR4121_ADRS(0x8e) +#define VR4121_ICU_MAIUINTREG VR4121_ADRS(0x90) +#define VR4121_ICU_MKIUINTREG VR4121_ADRS(0x92) +#define VR4121_ICU_MGIUINTLREG VR4121_ADRS(0x94) +#define VR4121_ICU_MDSIUINTREG VR4121_ADRS(0x96) +#define VR4121_ICU_NMIREG VR4121_ADRS(0x98) +#define VR4121_ICU_SOFTINTREG VR4121_ADRS(0x9a) +#define VR4121_ICU_GIUINTHREG VR4121_ADRS(0x202) +#define VR4121_ICU_FIRINTHREG VR4121_ADRS(0x204) +#define VR4121_ICU_MGIUINTHREG VR4121_ADRS(0x208) +#define VR4121_ICU_MFIRINTHREG VR4121_ADRS(0x20a) + +/* ICU MDSIUINTREG bit definitions */ + +#define VR4121_ICU_DSIU_INTSR0 (1 << 9) +#define VR4121_ICU_DSIU_INTST0 (1 << 8) + +/* PMU registers */ + +#define VR4121_PMUINTREG VR4121_ADRS(0xa0) /* verify this adr XXX */ +#define VR4121_PMUCNTREG VR4121_ADRS(0xa2) /* verify this adr XXX */ +#define VR4121_HALTIMERRST (1 << 2) + +/* RTC registers */ + +#define VR4121_ETIMELREG VR4121_ADRS(0xc0) +#define VR4121_ETIMEMREG VR4121_ADRS(0xc2) +#define VR4121_ETIMEHREG VR4121_ADRS(0xc4) +#define VR4121_ECMPLREG VR4121_ADRS(0xc8) +#define VR4121_ECMPMREG VR4121_ADRS(0xca) +#define VR4121_ECMPHREG VR4121_ADRS(0xcc) /* modified XXX was 0xce */ +#define VR4121_RTCL1LREG VR4121_ADRS(0xd0) +#define VR4121_RTCL1HREG VR4121_ADRS(0xd2) +#define VR4121_RTCL1CNTLREG VR4121_ADRS(0xd4) +#define VR4121_RTCL1CNTHREG VR4121_ADRS(0xd6) +#define VR4121_RTCL2LREG VR4121_ADRS(0xd8) +#define VR4121_RTCL2HREG VR4121_ADRS(0xda) +#define VR4121_RTCL2CNTLREG VR4121_ADRS(0xdc) +#define VR4121_RTCL2CNTHREG VR4121_ADRS(0xde) +#define VR4121_TCLKLREG VR4121_ADRS(0x1c0) +#define VR4121_TCLKHREG VR4121_ADRS(0x1c2) +#define VR4121_TCLKCNTLREG VR4121_ADRS(0x1c4) +#define VR4121_TCLKCNTHREG VR4121_ADRS(0x1c6) +#define VR4121_RTCINTREG VR4121_ADRS(0x1de) +#define VR4121_RTC_RTCINTR0 (1 << 0) +#define VR4121_RTC_RTCINTR1 (1 << 1) +#define VR4121_RTC_RTCINTR2 (1 << 2) +#define VR4121_RTC_RTCINTR3 (1 << 3) + +/* define VR4102 RTC registers to use nvr4102RTCTimer.c */ + +#define VR4102_ETIMELREG VR4121_ETIMELREG +#define VR4102_ETIMEMRE VR4121_ETIMEMRE +#define VR4102_ETIMEHREG VR4121_ETIMEHREG +#define VR4102_ECMPLREG VR4121_ECMPLREG +#define VR4102_ECMPMREG VR4121_ECMPMREG +#define VR4102_ECMPHREG VR4121_ECMPHREG +#define VR4102_RTCL1LREG VR4121_RTCL1LREG +#define VR4102_RTCL1HREG VR4121_RTCL1HREG +#define VR4102_RTCL1CNTLREG VR4121_RTCL1CNTLREG +#define VR4102_RTCL1CNTHREG VR4121_RTCL1CNTHREG +#define VR4102_RTCL2LREG VR4121_RTCL2LREG +#define VR4102_RTCL2HREG VR4121_RTCL2HREG +#define VR4102_RTCL2CNTLREG VR4121_RTCL2CNTLREG +#define VR4102_RTCL2CNTHREG VR4121_RTCL2CNTHREG +#define VR4102_TCLKLREG VR4121_TCLKLREG +#define VR4102_TCLKHREG VR4121_TCLKHREG +#define VR4102_TCLKCNTLREG VR4121_TCLKCNTLREG +#define VR4102_TCLKCNTHREG VR4121_TCLKCNTHREG +#define VR4102_RTCINTREG VR4121_RTCINTREG +#define VR4102_RTC_RTCINTR0 VR4121_RTC_RTCINTR0 +#define VR4102_RTC_RTCINTR1 VR4121_RTC_RTCINTR1 +#define VR4102_RTC_RTCINTR2 VR4121_RTC_RTCINTR2 +#define VR4102_RTC_RTCINTR3 VR4121_RTC_RTCINTR3 + +#define VR4102_RTCL1INTR VR4121_RTCL1INTR +#define VR4102_RTCL2INTR VR4121_RTCL2INTR + +#define VR4102_ICU_MSYSINT1REG VR4121_ICU_MSYSINT1REG + +/* DSU registers */ + +#define VR4121_DSUCNTREG VR4121_ADRS(0xe0) +#define VR4121_DSUSETREG VR4121_ADRS(0xe2) +#define VR4121_DSUCLRREG VR4121_ADRS(0xe4) +#define VR4121_DSUTIMREG VR4121_ADRS(0xe6) +#define VR4121_DSULOADREG VR4121_ADRS(0xe8) + +/* GIU registers */ + +#define VR4121_GIUIOSELL VR4121_ADRS(0x100) +#define VR4121_GIUIOSELH VR4121_ADRS(0x102) +#define VR4121_GIUPIODL VR4121_ADRS(0x104) +#define VR4121_GIUPIODH VR4121_ADRS(0x106) +#define VR4121_GIUINTSTATL VR4121_ADRS(0x108) +#define VR4121_GIUINTSTATH VR4121_ADRS(0x10a) +#define VR4121_GIUINTENL VR4121_ADRS(0x10c) +#define VR4121_GIUINTENH VR4121_ADRS(0x10e) +#define VR4121_GIUINTTYPL VR4121_ADRS(0x110) +#define VR4121_GIUINTTYPH VR4121_ADRS(0x112) +#define VR4121_GIUINTALSELL VR4121_ADRS(0x114) +#define VR4121_GIUINTALSELH VR4121_ADRS(0x116) +#define VR4121_GIUINTHTSELL VR4121_ADRS(0x118) +#define VR4121_GIUINTHTSELH VR4121_ADRS(0x11a) +#define VR4121_GIUPODATL VR4121_ADRS(0x11c) +#define VR4121_GIUPODATH VR4121_ADRS(0x11e) + +/* The general-purpose I/O pins (GPIO) are enabled and controlled + via identically placed bits in the GIU registers and some of the + ICU registers. This set of pin masks can be used with whichever + registers contain GPIO pin configuration. */ + +#define VR4121_GPIO_PIN_31 (1 << 15) +#define VR4121_GPIO_PIN_30 (1 << 14) +#define VR4121_GPIO_PIN_29 (1 << 13) +#define VR4121_GPIO_PIN_28 (1 << 12) +#define VR4121_GPIO_PIN_27 (1 << 11) +#define VR4121_GPIO_PIN_26 (1 << 10) +#define VR4121_GPIO_PIN_25 (1 << 9) +#define VR4121_GPIO_PIN_24 (1 << 8) +#define VR4121_GPIO_PIN_23 (1 << 7) +#define VR4121_GPIO_PIN_22 (1 << 6) +#define VR4121_GPIO_PIN_21 (1 << 5) +#define VR4121_GPIO_PIN_20 (1 << 4) +#define VR4121_GPIO_PIN_19 (1 << 3) +#define VR4121_GPIO_PIN_18 (1 << 2) +#define VR4121_GPIO_PIN_17 (1 << 1) +#define VR4121_GPIO_PIN_16 (1 << 0) +#define VR4121_GPIO_PIN_15 (1 << 15) +#define VR4121_GPIO_PIN_14 (1 << 14) +#define VR4121_GPIO_PIN_13 (1 << 13) +#define VR4121_GPIO_PIN_12 (1 << 12) +#define VR4121_GPIO_PIN_11 (1 << 11) +#define VR4121_GPIO_PIN_10 (1 << 10) +#define VR4121_GPIO_PIN_9 (1 << 9) +#define VR4121_GPIO_PIN_8 (1 << 8) +#define VR4121_GPIO_PIN_7 (1 << 7) +#define VR4121_GPIO_PIN_6 (1 << 6) +#define VR4121_GPIO_PIN_5 (1 << 5) +#define VR4121_GPIO_PIN_4 (1 << 4) +#define VR4121_GPIO_PIN_3 (1 << 3) +#define VR4121_GPIO_PIN_2 (1 << 2) +#define VR4121_GPIO_PIN_1 (1 << 1) +#define VR4121_GPIO_PIN_0 (1 << 0) + +/* PIU registers */ + +#define VR4121_PIUCNTREG VR4121_ADRS(0x122) +#define VR4121_PIUINTREG VR4121_ADRS(0x124) +#define VR4121_PIUSIVLREG VR4121_ADRS(0x126) +#define VR4121_PIUSTBLREG VR4121_ADRS(0x128) +#define VR4121_PIUCMDREG VR4121_ADRS(0x12a) +#define VR4121_PIUASCNREG VR4121_ADRS(0x130) +#define VR4121_PIUAMSKREG VR4121_ADRS(0x132) +#define VR4121_PIUCIVLREG VR4121_ADRS(0x13e) +#define VR4121_PIUPB00REG VR4121_ADRS(0x2a0) +#define VR4121_PIUPB01REG VR4121_ADRS(0x2a2) +#define VR4121_PIUPB02REG VR4121_ADRS(0x2a4) +#define VR4121_PIUPB03REG VR4121_ADRS(0x2a6) +#define VR4121_PIUPB10REG VR4121_ADRS(0x2a8) +#define VR4121_PIUPB11REG VR4121_ADRS(0x2aa) +#define VR4121_PIUPB12REG VR4121_ADRS(0x2ac) +#define VR4121_PIUPB13REG VR4121_ADRS(0x2ae) +#define VR4121_PIUAB0REG VR4121_ADRS(0x2b0) +#define VR4121_PIUAB1REG VR4121_ADRS(0x2b2) +#define VR4121_PIUAB2REG VR4121_ADRS(0x2b4) +#define VR4121_PIUAB3REG VR4121_ADRS(0x2b6) +#define VR4121_PIUPB04REG VR4121_ADRS(0x2bc) +#define VR4121_PIUPB14REG VR4121_ADRS(0x2be) + +/* AIU registers */ + +#define VR4121_MDMADATREG VR4121_ADRS(0x160) +#define VR4121_SDMADATREG VR4121_ADRS(0x162) +#define VR4121_SODATREG VR4121_ADRS(0x166) +#define VR4121_SCNTREG VR4121_ADRS(0x168) +#define VR4121_SCNVRREG VR4121_ADRS(0x16a) +#define VR4121_SCNVCUNTREG VR4121_ADRS(0x16c) +#define VR4121_MIDATREG VR4121_ADRS(0x170) +#define VR4121_MCNTREG VR4121_ADRS(0x172) +#define VR4121_MCNVRREG VR4121_ADRS(0x174) +#define VR4121_MCNVCUNTREG VR4121_ADRS(0x176) +#define VR4121_DVALIDREG VR4121_ADRS(0x178) +#define VR4121_SEQREG VR4121_ADRS(0x17a) +#define VR4121_INTREG VR4121_ADRS(0x17c) + +/* KIU registers */ + +#define VR4121_KIUDAT0REG VR4121_ADRS(0x180) +#define VR4121_KIUDAT1REG VR4121_ADRS(0x182) +#define VR4121_KIUDAT2REG VR4121_ADRS(0x184) +#define VR4121_KIUDAT3REG VR4121_ADRS(0x186) +#define VR4121_KIUDAT4REG VR4121_ADRS(0x188) +#define VR4121_KIUDAT5REG VR4121_ADRS(0x18a) + +#define VR4121_KIUSCANREP VR4121_ADRS(0x190) +#define VR4121_DIUSCANS VR4121_ADRS(0x192) +#define VR4121_KIUWKS VR4121_ADRS(0x194) +#define VR4121_KIUWKI VR4121_ADRS(0x196) +#define VR4121_KIUINT VR4121_ADRS(0x198) +#define VR4121_KIURST VR4121_ADRS(0x19a) +#define VR4121_KIUGPEN VR4121_ADRS(0x19c) +#define VR4121_SCANLINE VR4121_ADRS(0x19e) + +/* Debug SIU registers */ + +#define VR4121_PORTREG VR4121_ADRS(0x1a0) /* new XXX */ +#define VR4121_MODEMREG VR4121_ADRS(0x1a2) /* new XXX */ +#define VR4121_ASIM00REG VR4121_ADRS(0x1a4) +#define VR4121_ASIM01REG VR4121_ADRS(0x1a6) +#define VR4121_RXB0RREG VR4121_ADRS(0x1a8) +#define VR4121_RXB0LREG VR4121_ADRS(0x1aa) +#define VR4121_RXS0RREG VR4121_ADRS(0x1ac) +#define VR4121_TXS0LREG VR4121_ADRS(0x1ae) +#define VR4121_ASIS0REG VR4121_ADRS(0x1b0) +#define VR4121_INTR0REG VR4121_ADRS(0x1b2) +#define VR4121_BRG0REG VR4121_ADRS(0x1b4) /* new XXX */ +#define VR4121_BPRM0REG VR4121_ADRS(0x1b6) +#define VR4121_DSIURESETREG VR4121_ADRS(0x1b8) + +/* DSIU subsystem DSIURESETREG bit definitions */ + +#define VR4121_DSIURST (1 << 0) + +/* DSIU subsystem ASIM00REG register bit definitions */ + +#define VR4121_ASIM00REG_RESERVED (1 << 7) +#define VR4121_RXE0 (1 << 6) +#define VR4121_DSIU_PAR_SHIFT 4 +#define VR4121_DSIU_PAR_EVEN (3 << VR4121_DSIU_PAR_SHIFT) +#define VR4121_DSIU_PAR_ODD (2 << VR4121_DSIU_PAR_SHIFT) +#define VR4121_DSIU_PAR_ZERO (1 << VR4121_DSIU_PAR_SHIFT) +#define VR4121_DSIU_PAR_EXTEND (0 << VR4121_DSIU_PAR_SHIFT) +#define VR4121_DSIU_CHARLEN_8 (1 << 3) +#define VR4121_DSIU_CHARLEN_7 (0 << 3) +#define VR4121_DSIU_STOPBITS_2 (1 << 2) +#define VR4121_DSIU_STOPBITS_1 (1 << 2) +#define VR4121_DSIU_SCLS0 (1 << 0) /* new XXX */ + +/* DSIU subsystem BPRM0REG register bit definitions */ + +#define VR4121_BRCE0 (1 << 7) + +/* DSIU subsystem INTR0REG register bit definitions */ + +#define VR4121_INTDCD (1 << 3) +#define VR4121_INTSER0 (1 << 2) +#define VR4121_INTSR0 (1 << 1) +#define VR4121_INTST0 (1 << 0) + +/* DSIU subsystem ASIS0REG register bit definitions */ + +#define VR4121_SOT0 (1 << 7) +#define VR4121_PE0 (1 << 2) +#define VR4121_FE0 (1 << 1) +#define VR4121_OVE0 (1 << 0) + +/* LED registers */ + +#define VR4121_LEDHTSREG VR4121_ADRS(0x240) +#define VR4121_LEDTLSREG VR4121_ADRS(0x242) +#define VR4121_LEDHLTCLREG VR4121_ADRS(0x244) +#define VR4121_LEDHLTCHREG VR4121_ADRS(0x246) +#define VR4121_LEDCNTREG VR4121_ADRS(0x248) +#define VR4121_LEDASTCREG VR4121_ADRS(0x24a) +#define VR4121_LEDINTREG VR4121_ADRS(0x24c) + +/* SIU registers -- (16550-compatible registers not included) */ + +#define VR4121_SIURSEL VR4121_ADRS(0x01000008) + +/* HSP registers */ + +#define VR4121_HSPINIT VR4121_ADRS(0x01000020) +#define VR4121_HSPDATA VR4121_ADRS(0x01000022) +#define VR4121_HSPINDEX VR4121_ADRS(0x01000024) +#define VR4121_HSPID VR4121_ADRS(0x01000028) +#define VR4121_HSPPCS VR4121_ADRS(0x01000029) +#define VR4121_HSPPCTEL VR4121_ADRS(0x01000029) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnvr4121h */ diff --git a/h/drv/multi/nvr4122.h b/h/drv/multi/nvr4122.h new file mode 100644 index 0000000..f7eb042 --- /dev/null +++ b/h/drv/multi/nvr4122.h @@ -0,0 +1,456 @@ +/* nvr4122.h - NEC NVR4122 header file */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,17apr01,sru update after code review +01b,09apr01,sru cleanup after code review +01a,05jan01,sru fix cache sizes +01a,03jan01,sru created. +*/ + +/* +DESCRIPTION +This file contains constants for the NEC VR4122. Register address +definitions for the various subsystems are provided, and some (but +not all) register field definitions are provided. +*/ + +#ifndef __INCnvr4122h +#define __INCnvr4122h + +#include "vxWorks.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define VR4122_ICACHE_SIZE 32768 +#define VR4122_DCACHE_SIZE 16384 + +/* VR4122 register definitions. */ + +#define VR4122_REG_BASE (0x0f000000+K1BASE) + +#ifdef _ASMLANGUAGE +#define VR4122_REG32(reg) (VR4122_REG_BASE + (reg)) +#define VR4122_REG16(reg) (VR4122_REG_BASE + (reg)) +#define VR4122_REG8(reg) (VR4122_REG_BASE + (reg)) +#else +#define VR4122_REG32(reg) ((volatile UINT32 *)(VR4122_REG_BASE + (reg))) +#define VR4122_REG16(reg) ((volatile UINT16 *)(VR4122_REG_BASE + (reg))) +#define VR4122_REG8(reg) ((volatile UINT8 *)(VR4122_REG_BASE + (reg))) +#endif /* _ASMLANGUAGE */ + +/* BCU registers */ + +#define VR4122_BCUCNTREG1 VR4122_REG16(0x00) +#define VR4122_ROMSIZEREG VR4122_REG16(0x04) +#define VR4122_ROMSPEEDREG VR4122_REG16(0x06) +#define VR4122_IO0SPEEDREG VR4122_REG16(0x08) +#define VR4122_IO1SPEEDREG VR4122_REG16(0x0a) +#define VR4122_REVIDREG VR4122_REG16(0x10) +#define VR4122_CLKSPEEDREG VR4122_REG16(0x14) +#define VR4122_BCUCNTREG3 VR4122_REG16(0x16) +#define VR4122_BCUCACHECNTREG VR4122_REG16(0x18) + + +/* BCUCNTREG1 bit definitions */ + +#define VR4122_PAGESIZE 0x3000 +#define VR4122_PAGEROM2 0x0400 +#define VR4122_PAGEROM0 0x0100 +#define VR4122_ROMWEN2 0x0040 +#define VR4122_ROMWEN0 0x0010 + +/* DMAAU registers */ + +#define VR4122_CSIIBALREG VR4122_REG16(0x20) +#define VR4122_CSIIBAHREG VR4122_REG16(0x22) +#define VR4122_CSIIALREG VR4122_REG16(0x24) +#define VR4122_CSIIAHREG VR4122_REG16(0x26) +#define VR4122_CSIOBALREG VR4122_REG16(0x28) +#define VR4122_CSIOBAHREG VR4122_REG16(0x2a) +#define VR4122_CSIOALREG VR4122_REG16(0x2c) +#define VR4122_CSIOAHREG VR4122_REG16(0x2e) +#define VR4122_FIRBALREG VR4122_REG16(0x30) +#define VR4122_FIRBAHREG VR4122_REG16(0x32) +#define VR4122_FIRALREG VR4122_REG16(0x34) +#define VR4122_FIRAHREG VR4122_REG16(0x36) +#define VR4122_RAMBALREG VR4122_REG16(0x1e0) +#define VR4122_RAMBAHREG VR4122_REG16(0x1e2) +#define VR4122_RAMALREG VR4122_REG16(0x1e4) +#define VR4122_RAMAHREG VR4122_REG16(0x1e6) +#define VR4122_IOBALREG VR4122_REG16(0x1e8) +#define VR4122_IOBAHREG VR4122_REG16(0x1ea) +#define VR4122_IOALREG VR4122_REG16(0x1ec) +#define VR4122_IOAHREG VR4122_REG16(0x1ee) + +/* DCU registers */ + +#define VR4122_DMARSTREG VR4122_REG16(0x40) +#define VR4122_DMAIDLEREG VR4122_REG16(0x42) +#define VR4122_DMASENREG VR4122_REG16(0x44) +#define VR4122_DMAMSKREG VR4122_REG16(0x46) +#define VR4122_DMAREQREG VR4122_REG16(0x48) +#define VR4122_TDREG VR4122_REG16(0x4a) +#define VR4122_DMAABITREG VR4122_REG16(0x4c) +#define VR4122_CONTROLREG VR4122_REG16(0x4e) +#define VR4122_BASSCNTLREG VR4122_REG16(0x50) +#define VR4122_BASSCNTHREG VR4122_REG16(0x52) +#define VR4122_CURRENTCNTLREG VR4122_REG16(0x54) +#define VR4122_CURRENTCNTHREG VR4122_REG16(0x56) +#define VR4122_TCINTR VR4122_REG16(0x58) + +/* DMA mask bit definitions */ + +#define VR4122_DMAMSKAIOR 0x0008 +#define VR4122_DMAMSKCOUT 0x0004 +#define VR4122_DMAMSKCIN 0x0002 +#define VR4122_DMAMSKFOUT 0x0001 + +/* CMU register */ + +#define VR4122_CMUCLKMSK VR4122_REG16(0x60) + +#define VR4122_MSKPCIU 0x2000 +#define VR4122_MSKSCSI 0x1000 +#define VR4122_MSKDSIU 0x0800 +#define VR4122_MSKFFIR 0x0400 +#define VR4122_MSKSSIU 0x0100 +#define VR4122_MSKCSI 0x0040 +#define VR4122_MSKFIR 0x0010 +#define VR4122_MSKSIU 0x0002 + +/* ICU system and system mask registers */ + +#define VR4122_SYSINT1REG VR4122_REG16(0x80) +#define VR4122_GIUINTLREG VR4122_REG16(0x88) +#define VR4122_DSIUINTREG VR4122_REG16(0x8a) +#define VR4122_MSYSINT1REG VR4122_REG16(0x8c) +#define VR4122_MGIUINTLREG VR4122_REG16(0x94) +#define VR4122_MDSIUINTREG VR4122_REG16(0x96) +#define VR4122_NMIREG VR4122_REG16(0x98) +#define VR4122_SOFTINTREG VR4122_REG16(0x9a) +#define VR4122_SYSINT2REG VR4122_REG16(0xa0) +#define VR4122_GIUINTHREG VR4122_REG16(0xa2) +#define VR4122_FIRINTREG VR4122_REG16(0xa4) +#define VR4122_MSYSINT2REG VR4122_REG16(0xa6) +#define VR4122_MGIUINTHREG VR4122_REG16(0xa8) +#define VR4122_MFIRINTREG VR4122_REG16(0xaa) +#define VR4122_PCIINTREG VR4122_REG16(0xac) +#define VR4122_SCUINTREG VR4122_REG16(0xae) +#define VR4122_CSIINTREG VR4122_REG16(0xb0) +#define VR4122_MPCIINTREG VR4122_REG16(0xb2) +#define VR4122_MSCUINTREG VR4122_REG16(0xb4) +#define VR4122_MCSIINTREG VR4122_REG16(0xb6) +#define VR4122_BCUINTREG VR4122_REG16(0xb8) +#define VR4122_MBCUINTREG VR4122_REG16(0xba) + +#define VR4122_CLKRUNINTR 0x1000 +#define VR4122_SOFTINTR 0x0800 +#define VR4122_SIUINTR 0x0200 +#define VR4122_GIUINTR 0x0100 +#define VR4122_ETIMERINTR 0x0008 +#define VR4122_RTCL1INTR 0x0004 +#define VR4122_POWERINTR 0x0002 +#define VR4122_BATINTR 0x0001 + +#define VR4122_BCUINTR 0x0200 +#define VR4122_CSIINTR 0x0100 +#define VR4122_SCUINTR 0x0080 +#define VR4122_PCIINTR 0x0040 +#define VR4122_DSIUINTR 0x0020 +#define VR4122_FIRINTR 0x0010 +#define VR4122_TCLKINTR 0x0008 +#define VR4122_LEDINTR 0x0002 +#define VR4122_RTCL2INTR 0x0001 + +/* PMU registers */ + +#define VR4122_PMUINTREG VR4122_REG16(0xc0) +#define VR4122_PMUCNTREG VR4122_REG16(0xc2) +#define VR4122_PMUINT2REG VR4122_REG16(0xc4) +#define VR4122_PMUCNT2REG VR4122_REG16(0xc6) +#define VR4122_PMUWAITREG VR4122_REG16(0xc8) +#define VR4122_PMUTCLKDIVREG VR4122_REG16(0xcc) +#define VR4122_PMUINTRCLKDIVREG VR4122_REG16(0xce) + +#define VR4122_HALTIMERRST 0x0004 + +/* RTC registers */ + +#define VR4122_ETIMELREG VR4122_REG16(0x100) +#define VR4122_ETIMEMREG VR4122_REG16(0x102) +#define VR4122_ETIMEHREG VR4122_REG16(0x104) +#define VR4122_ECMPLREG VR4122_REG16(0x108) +#define VR4122_ECMPMREG VR4122_REG16(0x10a) +#define VR4122_ECMPHREG VR4122_REG16(0x10c) +#define VR4122_RTCL1LREG VR4122_REG16(0x110) +#define VR4122_RTCL1HREG VR4122_REG16(0x112) +#define VR4122_RTCL1CNTLREG VR4122_REG16(0x114) +#define VR4122_RTCL1CNTHREG VR4122_REG16(0x116) +#define VR4122_RTCL2LREG VR4122_REG16(0x118) +#define VR4122_RTCL2HREG VR4122_REG16(0x11a) +#define VR4122_RTCL2CNTLREG VR4122_REG16(0x11c) +#define VR4122_RTCL2CNTHREG VR4122_REG16(0x11e) +#define VR4122_TCLKLREG VR4122_REG16(0x120) +#define VR4122_TCLKHREG VR4122_REG16(0x122) +#define VR4122_TCLKCNTLREG VR4122_REG16(0x124) +#define VR4122_TCLKCNTHREG VR4122_REG16(0x126) +#define VR4122_RTCINTREG VR4122_REG16(0x13e) + +#define VR4122_RTCINTR0 0x0001 +#define VR4122_RTCINTR1 0x0002 +#define VR4122_RTCINTR2 0x0004 +#define VR4122_RTCINTR3 0x0008 + +/* + * The VR4122 RTC module has identical functionality to the VR4102 + * RTC module. In order to use the nvr4102RTCTimer.c driver, we must + * define the VR4102_... constants in terms of the VR4122 values. + */ + +#define VR4102_ETIMELREG VR4122_ETIMELREG +#define VR4102_ETIMEMRE VR4122_ETIMEMRE +#define VR4102_ETIMEHREG VR4122_ETIMEHREG +#define VR4102_ECMPLREG VR4122_ECMPLREG +#define VR4102_ECMPMREG VR4122_ECMPMREG +#define VR4102_ECMPHREG VR4122_ECMPHREG +#define VR4102_RTCL1LREG VR4122_RTCL1LREG +#define VR4102_RTCL1HREG VR4122_RTCL1HREG +#define VR4102_RTCL1CNTLREG VR4122_RTCL1CNTLREG +#define VR4102_RTCL1CNTHREG VR4122_RTCL1CNTHREG +#define VR4102_RTCL2LREG VR4122_RTCL2LREG +#define VR4102_RTCL2HREG VR4122_RTCL2HREG +#define VR4102_RTCL2CNTLREG VR4122_RTCL2CNTLREG +#define VR4102_RTCL2CNTHREG VR4122_RTCL2CNTHREG +#define VR4102_TCLKLREG VR4122_TCLKLREG +#define VR4102_TCLKHREG VR4122_TCLKHREG +#define VR4102_TCLKCNTLREG VR4122_TCLKCNTLREG +#define VR4102_TCLKCNTHREG VR4122_TCLKCNTHREG +#define VR4102_RTCINTREG VR4122_RTCINTREG +#define VR4102_RTC_RTCINTR0 VR4122_RTCINTR0 +#define VR4102_RTC_RTCINTR1 VR4122_RTCINTR1 +#define VR4102_RTC_RTCINTR2 VR4122_RTCINTR2 +#define VR4102_RTC_RTCINTR3 VR4122_RTCINTR3 + +#define VR4102_RTCL1INTR VR4122_RTCL1INTR +#define VR4102_RTCL2INTR VR4122_RTCL2INTR + +#define VR4102_ICU_MSYSINT1REG VR4122_MSYSINT1REG + +/* GIU registers */ + +#define VR4122_GIUIOSELL VR4122_REG16(0x140) +#define VR4122_GIUIOSELH VR4122_REG16(0x142) +#define VR4122_GIUPIODL VR4122_REG16(0x144) +#define VR4122_GIUPIODH VR4122_REG16(0x146) +#define VR4122_GIUINTSTATL VR4122_REG16(0x148) +#define VR4122_GIUINTSTATH VR4122_REG16(0x14a) +#define VR4122_GIUINTENL VR4122_REG16(0x14c) +#define VR4122_GIUINTENH VR4122_REG16(0x14e) +#define VR4122_GIUINTTYPL VR4122_REG16(0x150) +#define VR4122_GIUINTTYPH VR4122_REG16(0x152) +#define VR4122_GIUINTALSELL VR4122_REG16(0x154) +#define VR4122_GIUINTALSELH VR4122_REG16(0x156) +#define VR4122_GIUINTHTSELL VR4122_REG16(0x158) +#define VR4122_GIUINTHTSELH VR4122_REG16(0x15a) +#define VR4122_GIUPODATEN VR4122_REG16(0x15c) +#define VR4122_GIUPODATL VR4122_REG16(0x15e) + +/* + * The general-purpose I/O pins (GPIO) are enabled and controlled via + * identically placed bits in the GIU registers and some of the ICU + * registers. This set of pin masks can be used with whichever registers + * contain GPIO pin configuration. + */ + +#define VR4122_GPIO_PIN_31 0x8000 +#define VR4122_GPIO_PIN_30 0x4000 +#define VR4122_GPIO_PIN_29 0x2000 +#define VR4122_GPIO_PIN_28 0x1000 +#define VR4122_GPIO_PIN_27 0x0800 +#define VR4122_GPIO_PIN_26 0x0400 +#define VR4122_GPIO_PIN_25 0x0200 +#define VR4122_GPIO_PIN_24 0x0100 +#define VR4122_GPIO_PIN_23 0x0080 +#define VR4122_GPIO_PIN_22 0x0040 +#define VR4122_GPIO_PIN_21 0x0020 +#define VR4122_GPIO_PIN_20 0x0010 +#define VR4122_GPIO_PIN_19 0x0008 +#define VR4122_GPIO_PIN_18 0x0004 +#define VR4122_GPIO_PIN_17 0x0002 +#define VR4122_GPIO_PIN_16 0x0001 +#define VR4122_GPIO_PIN_15 0x8000 +#define VR4122_GPIO_PIN_14 0x4000 +#define VR4122_GPIO_PIN_13 0x2000 +#define VR4122_GPIO_PIN_12 0x1000 +#define VR4122_GPIO_PIN_11 0x0800 +#define VR4122_GPIO_PIN_10 0x0400 +#define VR4122_GPIO_PIN_9 0x0200 +#define VR4122_GPIO_PIN_8 0x0100 +#define VR4122_GPIO_PIN_7 0x0080 +#define VR4122_GPIO_PIN_6 0x0040 +#define VR4122_GPIO_PIN_5 0x0020 +#define VR4122_GPIO_PIN_4 0x0010 +#define VR4122_GPIO_PIN_3 0x0008 +#define VR4122_GPIO_PIN_2 0x0004 +#define VR4122_GPIO_PIN_1 0x0002 +#define VR4122_GPIO_PIN_0 0x0001 + +/* SCI registers */ + +#define VR4122_TIMOUTCNTREG VR4122_REG16(0x1000) +#define VR4122_TIMOUTCOUNTREG VR4122_REG16(0x1002) +#define VR4122_ERRLADDRESSREG VR4122_REG16(0x1004) +#define VR4122_ERRHADDRESSREG VR4122_REG16(0x1006) +#define VR4122_SCUINTRREG VR4122_REG16(0x1008) + +/* SDRAMU registers */ + +#define VR4122_SDRAMMODEREG VR4122_REG16(0x400) +#define VR4122_SDRAMCNTREG VR4122_REG16(0x402) +#define VR4122_BCURFCNTREG VR4122_REG16(0x404) +#define VR4122_BCURFCOUNTREG VR4122_REG16(0x406) +#define VR4122_RAMSIZEREG VR4122_REG16(0x408) + +/* PCIU registers */ + +#define VR4122_PCIMMAW1REG VR4122_REG32(0xc00) +#define VR4122_PCIMMAW2REG VR4122_REG32(0xc04) +#define VR4122_PCITAW1REG VR4122_REG32(0xc08) +#define VR4122_PCITAW2REG VR4122_REG32(0xc0c) +#define VR4122_PCIMIOAWREG VR4122_REG32(0xc10) +#define VR4122_PCICONFDREG VR4122_REG32(0xc14) +#define VR4122_PCICONFAREG VR4122_REG32(0xc18) +#define VR4122_PCIMAILREG VR4122_REG32(0xc1c) +#define VR4122_BUSERRADREG VR4122_REG32(0xc24) +#define VR4122_INTCNTSTAREG VR4122_REG32(0xc28) +#define VR4122_PCIEXACCREG VR4122_REG32(0xc2c) +#define VR4122_PCIRECONTREG VR4122_REG32(0xc30) +#define VR4122_PCIENREG VR4122_REG32(0xc34) +#define VR4122_PCICLKSELREG VR4122_REG32(0xc38) +#define VR4122_PCITRDYVREG VR4122_REG32(0xc3c) +#define VR4122_PCICLKRUNREG VR4122_REG16(0xc60) + +#define VR4122_PCICLKSEL_DIV_1 0x2 +#define VR4122_PCICLKSEL_DIV_2 0x0 +#define VR4122_PCICLKSEL_DIV_4 0x1 + +#define VR4122_PCICONFIGDONE 0x00000004 /* PCIENREG */ +#define VR4122_PCICLKRUN 0x0001 /* PCICLKRUNREG */ +#define VR4122_PCISTOPEN 0x8000 /* PCICLKRUNREG */ +#define VR4122_PCIIBA 0xFF000000 /* PCIM*AW*REG */ +#define VR4122_PCIMSK 0x000FE000 /* PCIM*AW*REG, PCITAWnREG */ +#define VR4122_PCIWINEN 0x00001000 /* PCIM*AW*REG, PCITAWnREG */ +#define VR4122_PCIPCIA 0x000000FF /* PCIM*AW*REG */ +#define VR4122_PCIITA 0x000007FF /* PCITAWnREG */ + +/* PCI Config Registers */ + +#define VR4122_PCICONF_IDENT VR4122_REG32(0xd00) +#define VR4122_PCICONF_CMDSR VR4122_REG32(0xd04) +#define VR4122_PCICONF_REVCLASS VR4122_REG32(0xd08) +#define VR4122_PCICONF_CACHELAT VR4122_REG32(0xd0c) +#define VR4122_PCICONF_MAILBA VR4122_REG32(0xd10) +#define VR4122_PCICONF_PCIMBA1 VR4122_REG32(0xd14) +#define VR4122_PCICONF_PCIMBA2 VR4122_REG32(0xd18) +#define VR4122_PCICONF_PCIINT VR4122_REG32(0xd3c) +#define VR4122_PCICONF_RETVAL VR4122_REG32(0xd40) + +/* DSIU registers */ + +#define VR4122_DSIURB VR4122_REG8(0x820) /* SUILC7 = 0, read */ +#define VR4122_DSIUTH VR4122_REG8(0x820) /* SUILC7 = 0, write */ +#define VR4122_DSIUDLL VR4122_REG8(0x820) /* SUILC7 = 1 */ +#define VR4122_DSIUIE VR4122_REG8(0x821) /* SUILC7 = 0 */ +#define VR4122_DSIUDLM VR4122_REG8(0x821) /* SUILC7 = 1 */ +#define VR4122_DSIUIID VR4122_REG8(0x822) /* read */ +#define VR4122_DSIUFC VR4122_REG8(0x822) /* write */ +#define VR4122_DSIULC VR4122_REG8(0x823) +#define VR4122_DSIUMC VR4122_REG8(0x824) +#define VR4122_DSIULS VR4122_REG8(0x825) +#define VR4122_DSIUMS VR4122_REG8(0x826) +#define VR4122_DSIUSC VR4122_REG8(0x827) +#define VR4122_DSIURESET VR4122_SIURESET /* Common with SIU */ + +#define VR4122_DSIU_BASE VR4122_DSIURB +#define VR4122_DSIU_DELTA 1 +#define VR4122_DSIU_XTAL 18432000 /* crystal input to 16550 */ + +#define VR4122_DSIURST 0x0002 /* in SIURESET register */ + +/* LED registers */ + +#define VR4122_LEDHTSREG VR4122_REG16(0x180) +#define VR4122_LEDLTSREG VR4122_REG16(0x182) +#define VR4122_LEDCNTREG VR4122_REG16(0x188) +#define VR4122_LEDASTCREG VR4122_REG16(0x18a) +#define VR4122_LEDINTREG VR4122_REG16(0x18c) + +/* SIU registers */ + +#define VR4122_SIURB VR4122_REG8(0x800) /* SUILC7 = 0, read */ +#define VR4122_SIUTH VR4122_REG8(0x800) /* SUILC7 = 0, write */ +#define VR4122_SIUDLL VR4122_REG8(0x800) /* SUILC7 = 1 */ +#define VR4122_SIUIE VR4122_REG8(0x801) /* SUILC7 = 0 */ +#define VR4122_SIUDLM VR4122_REG8(0x801) /* SUILC7 = 1 */ +#define VR4122_SIUIID VR4122_REG8(0x802) /* read */ +#define VR4122_SIUFC VR4122_REG8(0x802) /* write */ +#define VR4122_SIULC VR4122_REG8(0x803) +#define VR4122_SIUMC VR4122_REG8(0x804) +#define VR4122_SIULS VR4122_REG8(0x805) +#define VR4122_SIUMS VR4122_REG8(0x806) +#define VR4122_SIUSC VR4122_REG8(0x807) +#define VR4122_SIUIRSEL VR4122_REG8(0x808) +#define VR4122_SIURESET VR4122_REG8(0x809) /* common with DSIU */ +#define VR4122_SIUCSEL VR4122_REG8(0x80a) + +#define VR4122_SIU_BASE VR4122_SIURB +#define VR4122_SIU_DELTA 1 +#define VR4122_SIU_XTAL 18432000 /* crystal input to 16550 */ + +#define VR4122_SIURST 0x0001 /* in SIURESET register */ + +/* CSI registers */ + +#define VR4122_CSI_MODEREG VR4122_REG16(0x1a0) +#define VR4122_CSI_CLKSELREG VR4122_REG16(0x1a1) +#define VR4122_CSI_SIRBREG VR4122_REG16(0x1a2) +#define VR4122_CSI_SOTBREG VR4122_REG16(0x1a4) +#define VR4122_CSI_SIRBEREG VR4122_REG16(0x1a6) +#define VR4122_CSI_SOTBFREG VR4122_REG16(0x1a8) +#define VR4122_CSI_SIOREG VR4122_REG16(0x1aa) +#define VR4122_CSI_CNTREG VR4122_REG16(0x1b0) +#define VR4122_CSI_INTREG VR4122_REG16(0x1b2) +#define VR4122_CSI_IFIFOVREG VR4122_REG16(0x1b4) +#define VR4122_CSI_OFIFOVREG VR4122_REG16(0x1b6) +#define VR4122_CSI_IFIFOREG VR4122_REG16(0x1b8) +#define VR4122_CSI_OFIFOREG VR4122_REG16(0x1ba) +#define VR4122_CSI_FIFOTRGREG VR4122_REG16(0x1bc) + +/* FIR registers - not included */ + +/* Clock rate values for different settings of CLKSEL[2:0] pins/jumpers. */ + +#define CPU_PCLOCK_RATE_111 200700000 +#define CPU_PCLOCK_RATE_110 180600000 +#define CPU_PCLOCK_RATE_101 164200000 +#define CPU_PCLOCK_RATE_100 150500000 +#define CPU_PCLOCK_RATE_011 129000000 +#define CPU_PCLOCK_RATE_010 100400000 +#define CPU_PCLOCK_RATE_001 90300000 +#define CPU_PCLOCK_RATE_000 78500000 + +/* Miscellaneous */ + +#define NUM_4122_TTY 2 /* SIU + DSIU */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnvr4122h */ diff --git a/h/drv/multi/nvr4131.h b/h/drv/multi/nvr4131.h new file mode 100644 index 0000000..53bb70e --- /dev/null +++ b/h/drv/multi/nvr4131.h @@ -0,0 +1,466 @@ +/* nvr4131.h - NEC NVR4131 header file */ + +/* Copyright 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,20jun02,sru Added constants for cache control (SPR 78924). +01b,12mar02,sru added VR4131_PCICLKSEL_DIV_3 and VR4131_PCIDMACTRLREG. +01a,10oct01,sru created, based upon nvr4122.h +*/ + +/* +DESCRIPTION +This file contains constants for the NEC Vr4131. Register address +definitions for the various subsystems are provided, and some (but +not all) register field definitions are provided. +*/ + +#ifndef __INCnvr4131h +#define __INCnvr4131h + +#include "vxWorks.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* VR4131 cache sizes */ + +#define VR4131_ICACHE_SIZE 16384 +#define VR4131_DCACHE_SIZE 16384 + +/* VR4131 cache line configuration (config bits in C0_CONFIG) */ + +#define VR4131_ICACHE_LINE_32_MASK (1 << 5) +#define VR4131_DCACHE_LINE_32_MASK (1 << 4) +#define VR4131_CACHE_LINE_SIZE_16 16 +#define VR4131_CACHE_LINE_SIZE_32 32 + +/* VR4131 register definitions. */ + +#define VR4131_REG_BASE (0x0f000000+K1BASE) + +#ifdef _ASMLANGUAGE +#define VR4131_REG32(reg) (VR4131_REG_BASE + (reg)) +#define VR4131_REG16(reg) (VR4131_REG_BASE + (reg)) +#define VR4131_REG8(reg) (VR4131_REG_BASE + (reg)) +#else +#define VR4131_REG32(reg) ((volatile UINT32 *)(VR4131_REG_BASE + (reg))) +#define VR4131_REG16(reg) ((volatile UINT16 *)(VR4131_REG_BASE + (reg))) +#define VR4131_REG8(reg) ((volatile UINT8 *)(VR4131_REG_BASE + (reg))) +#endif /* _ASMLANGUAGE */ + +/* BCU registers */ + +#define VR4131_BCUCNTREG1 VR4131_REG16(0x00) +#define VR4131_ROMSIZEREG VR4131_REG16(0x04) +#define VR4131_ROMSPEEDREG VR4131_REG16(0x06) +#define VR4131_IO0SPEEDREG VR4131_REG16(0x08) +#define VR4131_IO1SPEEDREG VR4131_REG16(0x0a) +#define VR4131_REVIDREG VR4131_REG16(0x10) +#define VR4131_CLKSPEEDREG VR4131_REG16(0x14) +#define VR4131_BCUCNTREG3 VR4131_REG16(0x16) +#define VR4131_BCUCACHECNTREG VR4131_REG16(0x18) + + +/* BCUCNTREG1 bit definitions */ + +#define VR4131_PAGESIZE 0x3000 +#define VR4131_PAGEROM2 0x0400 +#define VR4131_PAGEROM0 0x0100 +#define VR4131_ROMWEN2 0x0040 +#define VR4131_ROMWEN0 0x0010 + +/* DMAAU registers */ + +#define VR4131_CSIIBALREG VR4131_REG16(0x20) +#define VR4131_CSIIBAHREG VR4131_REG16(0x22) +#define VR4131_CSIIALREG VR4131_REG16(0x24) +#define VR4131_CSIIAHREG VR4131_REG16(0x26) +#define VR4131_CSIOBALREG VR4131_REG16(0x28) +#define VR4131_CSIOBAHREG VR4131_REG16(0x2a) +#define VR4131_CSIOALREG VR4131_REG16(0x2c) +#define VR4131_CSIOAHREG VR4131_REG16(0x2e) +#define VR4131_FIRBALREG VR4131_REG16(0x30) +#define VR4131_FIRBAHREG VR4131_REG16(0x32) +#define VR4131_FIRALREG VR4131_REG16(0x34) +#define VR4131_FIRAHREG VR4131_REG16(0x36) +#define VR4131_RAMBALREG VR4131_REG16(0x1e0) +#define VR4131_RAMBAHREG VR4131_REG16(0x1e2) +#define VR4131_RAMALREG VR4131_REG16(0x1e4) +#define VR4131_RAMAHREG VR4131_REG16(0x1e6) +#define VR4131_IOBALREG VR4131_REG16(0x1e8) +#define VR4131_IOBAHREG VR4131_REG16(0x1ea) +#define VR4131_IOALREG VR4131_REG16(0x1ec) +#define VR4131_IOAHREG VR4131_REG16(0x1ee) + +/* DCU registers */ + +#define VR4131_DMARSTREG VR4131_REG16(0x40) +#define VR4131_DMAIDLEREG VR4131_REG16(0x42) +#define VR4131_DMASENREG VR4131_REG16(0x44) +#define VR4131_DMAMSKREG VR4131_REG16(0x46) +#define VR4131_DMAREQREG VR4131_REG16(0x48) +#define VR4131_TDREG VR4131_REG16(0x4a) +#define VR4131_DMAABITREG VR4131_REG16(0x4c) +#define VR4131_CONTROLREG VR4131_REG16(0x4e) +#define VR4131_BASSCNTLREG VR4131_REG16(0x50) +#define VR4131_BASSCNTHREG VR4131_REG16(0x52) +#define VR4131_CURRENTCNTLREG VR4131_REG16(0x54) +#define VR4131_CURRENTCNTHREG VR4131_REG16(0x56) +#define VR4131_TCINTR VR4131_REG16(0x58) + +/* DMA mask bit definitions */ + +#define VR4131_DMAMSKAIOR 0x0008 +#define VR4131_DMAMSKCOUT 0x0004 +#define VR4131_DMAMSKCIN 0x0002 +#define VR4131_DMAMSKFOUT 0x0001 + +/* CMU register */ + +#define VR4131_CMUCLKMSK VR4131_REG16(0x60) + +#define VR4131_MSKPCIU 0x2080 +#define VR4131_MSKSCSI 0x1000 +#define VR4131_MSKDSIU 0x0800 +#define VR4131_MSKFFIR 0x0400 +#define VR4131_MSKSSIU 0x0100 +#define VR4131_MSKCSI 0x0040 +#define VR4131_MSKFIR 0x0010 +#define VR4131_MSKSIU 0x0002 + +/* ICU system and system mask registers */ + +#define VR4131_SYSINT1REG VR4131_REG16(0x80) +#define VR4131_GIUINTLREG VR4131_REG16(0x88) +#define VR4131_DSIUINTREG VR4131_REG16(0x8a) +#define VR4131_MSYSINT1REG VR4131_REG16(0x8c) +#define VR4131_MGIUINTLREG VR4131_REG16(0x94) +#define VR4131_MDSIUINTREG VR4131_REG16(0x96) +#define VR4131_NMIREG VR4131_REG16(0x98) +#define VR4131_SOFTINTREG VR4131_REG16(0x9a) +#define VR4131_SYSINT2REG VR4131_REG16(0xa0) +#define VR4131_GIUINTHREG VR4131_REG16(0xa2) +#define VR4131_FIRINTREG VR4131_REG16(0xa4) +#define VR4131_MSYSINT2REG VR4131_REG16(0xa6) +#define VR4131_MGIUINTHREG VR4131_REG16(0xa8) +#define VR4131_MFIRINTREG VR4131_REG16(0xaa) +#define VR4131_PCIINTREG VR4131_REG16(0xac) +#define VR4131_SCUINTREG VR4131_REG16(0xae) +#define VR4131_CSIINTREG VR4131_REG16(0xb0) +#define VR4131_MPCIINTREG VR4131_REG16(0xb2) +#define VR4131_MSCUINTREG VR4131_REG16(0xb4) +#define VR4131_MCSIINTREG VR4131_REG16(0xb6) +#define VR4131_BCUINTREG VR4131_REG16(0xb8) +#define VR4131_MBCUINTREG VR4131_REG16(0xba) + +#define VR4131_CLKRUNINTR 0x1000 +#define VR4131_SOFTINTR 0x0800 +#define VR4131_SIUINTR 0x0200 +#define VR4131_GIUINTR 0x0100 +#define VR4131_ETIMERINTR 0x0008 +#define VR4131_RTCL1INTR 0x0004 +#define VR4131_POWERINTR 0x0002 +#define VR4131_BATINTR 0x0001 + +#define VR4131_BCUINTR 0x0200 +#define VR4131_CSIINTR 0x0100 +#define VR4131_SCUINTR 0x0080 +#define VR4131_PCIINTR 0x0040 +#define VR4131_DSIUINTR 0x0020 +#define VR4131_FIRINTR 0x0010 +#define VR4131_TCLKINTR 0x0008 +#define VR4131_LEDINTR 0x0002 +#define VR4131_RTCL2INTR 0x0001 + +/* PMU registers */ + +#define VR4131_PMUINTREG VR4131_REG16(0xc0) +#define VR4131_PMUCNTREG VR4131_REG16(0xc2) +#define VR4131_PMUINT2REG VR4131_REG16(0xc4) +#define VR4131_PMUCNT2REG VR4131_REG16(0xc6) +#define VR4131_PMUWAITREG VR4131_REG16(0xc8) +#define VR4131_PMUTCLKDIVREG VR4131_REG16(0xcc) +#define VR4131_PMUINTRCLKDIVREG VR4131_REG16(0xce) + +#define VR4131_HALTIMERRST 0x0004 + +/* RTC registers */ + +#define VR4131_ETIMELREG VR4131_REG16(0x100) +#define VR4131_ETIMEMREG VR4131_REG16(0x102) +#define VR4131_ETIMEHREG VR4131_REG16(0x104) +#define VR4131_ECMPLREG VR4131_REG16(0x108) +#define VR4131_ECMPMREG VR4131_REG16(0x10a) +#define VR4131_ECMPHREG VR4131_REG16(0x10c) +#define VR4131_RTCL1LREG VR4131_REG16(0x110) +#define VR4131_RTCL1HREG VR4131_REG16(0x112) +#define VR4131_RTCL1CNTLREG VR4131_REG16(0x114) +#define VR4131_RTCL1CNTHREG VR4131_REG16(0x116) +#define VR4131_RTCL2LREG VR4131_REG16(0x118) +#define VR4131_RTCL2HREG VR4131_REG16(0x11a) +#define VR4131_RTCL2CNTLREG VR4131_REG16(0x11c) +#define VR4131_RTCL2CNTHREG VR4131_REG16(0x11e) +#define VR4131_TCLKLREG VR4131_REG16(0x120) +#define VR4131_TCLKHREG VR4131_REG16(0x122) +#define VR4131_TCLKCNTLREG VR4131_REG16(0x124) +#define VR4131_TCLKCNTHREG VR4131_REG16(0x126) +#define VR4131_RTCINTREG VR4131_REG16(0x13e) + +#define VR4131_RTCINTR0 0x0001 +#define VR4131_RTCINTR1 0x0002 +#define VR4131_RTCINTR2 0x0004 +#define VR4131_RTCINTR3 0x0008 + +/* + * The VR4131 RTC module has identical functionality to the VR4102 + * RTC module. In order to use the nvr4102RTCTimer.c driver, we must + * define the VR4102_... constants in terms of the VR4131 values. + */ + +#define VR4102_ETIMELREG VR4131_ETIMELREG +#define VR4102_ETIMEMRE VR4131_ETIMEMRE +#define VR4102_ETIMEHREG VR4131_ETIMEHREG +#define VR4102_ECMPLREG VR4131_ECMPLREG +#define VR4102_ECMPMREG VR4131_ECMPMREG +#define VR4102_ECMPHREG VR4131_ECMPHREG +#define VR4102_RTCL1LREG VR4131_RTCL1LREG +#define VR4102_RTCL1HREG VR4131_RTCL1HREG +#define VR4102_RTCL1CNTLREG VR4131_RTCL1CNTLREG +#define VR4102_RTCL1CNTHREG VR4131_RTCL1CNTHREG +#define VR4102_RTCL2LREG VR4131_RTCL2LREG +#define VR4102_RTCL2HREG VR4131_RTCL2HREG +#define VR4102_RTCL2CNTLREG VR4131_RTCL2CNTLREG +#define VR4102_RTCL2CNTHREG VR4131_RTCL2CNTHREG +#define VR4102_TCLKLREG VR4131_TCLKLREG +#define VR4102_TCLKHREG VR4131_TCLKHREG +#define VR4102_TCLKCNTLREG VR4131_TCLKCNTLREG +#define VR4102_TCLKCNTHREG VR4131_TCLKCNTHREG +#define VR4102_RTCINTREG VR4131_RTCINTREG +#define VR4102_RTC_RTCINTR0 VR4131_RTCINTR0 +#define VR4102_RTC_RTCINTR1 VR4131_RTCINTR1 +#define VR4102_RTC_RTCINTR2 VR4131_RTCINTR2 +#define VR4102_RTC_RTCINTR3 VR4131_RTCINTR3 + +#define VR4102_RTCL1INTR VR4131_RTCL1INTR +#define VR4102_RTCL2INTR VR4131_RTCL2INTR + +#define VR4102_ICU_MSYSINT1REG VR4131_MSYSINT1REG + +/* GIU registers */ + +#define VR4131_GIUIOSELL VR4131_REG16(0x140) +#define VR4131_GIUIOSELH VR4131_REG16(0x142) +#define VR4131_GIUPIODL VR4131_REG16(0x144) +#define VR4131_GIUPIODH VR4131_REG16(0x146) +#define VR4131_GIUINTSTATL VR4131_REG16(0x148) +#define VR4131_GIUINTSTATH VR4131_REG16(0x14a) +#define VR4131_GIUINTENL VR4131_REG16(0x14c) +#define VR4131_GIUINTENH VR4131_REG16(0x14e) +#define VR4131_GIUINTTYPL VR4131_REG16(0x150) +#define VR4131_GIUINTTYPH VR4131_REG16(0x152) +#define VR4131_GIUINTALSELL VR4131_REG16(0x154) +#define VR4131_GIUINTALSELH VR4131_REG16(0x156) +#define VR4131_GIUINTHTSELL VR4131_REG16(0x158) +#define VR4131_GIUINTHTSELH VR4131_REG16(0x15a) +#define VR4131_GIUPODATEN VR4131_REG16(0x15c) +#define VR4131_GIUPODATL VR4131_REG16(0x15e) + +/* + * The general-purpose I/O pins (GPIO) are enabled and controlled via + * identically placed bits in the GIU registers and some of the ICU + * registers. This set of pin masks can be used with whichever registers + * contain GPIO pin configuration. + */ + +#define VR4131_GPIO_PIN_31 0x8000 +#define VR4131_GPIO_PIN_30 0x4000 +#define VR4131_GPIO_PIN_29 0x2000 +#define VR4131_GPIO_PIN_28 0x1000 +#define VR4131_GPIO_PIN_27 0x0800 +#define VR4131_GPIO_PIN_26 0x0400 +#define VR4131_GPIO_PIN_25 0x0200 +#define VR4131_GPIO_PIN_24 0x0100 +#define VR4131_GPIO_PIN_23 0x0080 +#define VR4131_GPIO_PIN_22 0x0040 +#define VR4131_GPIO_PIN_21 0x0020 +#define VR4131_GPIO_PIN_20 0x0010 +#define VR4131_GPIO_PIN_19 0x0008 +#define VR4131_GPIO_PIN_18 0x0004 +#define VR4131_GPIO_PIN_17 0x0002 +#define VR4131_GPIO_PIN_16 0x0001 +#define VR4131_GPIO_PIN_15 0x8000 +#define VR4131_GPIO_PIN_14 0x4000 +#define VR4131_GPIO_PIN_13 0x2000 +#define VR4131_GPIO_PIN_12 0x1000 +#define VR4131_GPIO_PIN_11 0x0800 +#define VR4131_GPIO_PIN_10 0x0400 +#define VR4131_GPIO_PIN_9 0x0200 +#define VR4131_GPIO_PIN_8 0x0100 +#define VR4131_GPIO_PIN_7 0x0080 +#define VR4131_GPIO_PIN_6 0x0040 +#define VR4131_GPIO_PIN_5 0x0020 +#define VR4131_GPIO_PIN_4 0x0010 +#define VR4131_GPIO_PIN_3 0x0008 +#define VR4131_GPIO_PIN_2 0x0004 +#define VR4131_GPIO_PIN_1 0x0002 +#define VR4131_GPIO_PIN_0 0x0001 + +/* SCI registers */ + +#define VR4131_TIMOUTCNTREG VR4131_REG16(0x1000) +#define VR4131_TIMOUTCOUNTREG VR4131_REG16(0x1002) +#define VR4131_ERRLADDRESSREG VR4131_REG16(0x1004) +#define VR4131_ERRHADDRESSREG VR4131_REG16(0x1006) +#define VR4131_SCUINTRREG VR4131_REG16(0x1008) + +/* SDRAMU registers */ + +#define VR4131_SDRAMMODEREG VR4131_REG16(0x400) +#define VR4131_SDRAMCNTREG VR4131_REG16(0x402) +#define VR4131_BCURFCNTREG VR4131_REG16(0x404) +#define VR4131_BCURFCOUNTREG VR4131_REG16(0x406) +#define VR4131_RAMSIZEREG VR4131_REG16(0x408) + +/* PCIU registers */ + +#define VR4131_PCIMMAW1REG VR4131_REG32(0xc00) +#define VR4131_PCIMMAW2REG VR4131_REG32(0xc04) +#define VR4131_PCITAW1REG VR4131_REG32(0xc08) +#define VR4131_PCITAW2REG VR4131_REG32(0xc0c) +#define VR4131_PCIMIOAWREG VR4131_REG32(0xc10) +#define VR4131_PCICONFDREG VR4131_REG32(0xc14) +#define VR4131_PCICONFAREG VR4131_REG32(0xc18) +#define VR4131_PCIMAILREG VR4131_REG32(0xc1c) +#define VR4131_BUSERRADREG VR4131_REG32(0xc24) +#define VR4131_INTCNTSTAREG VR4131_REG32(0xc28) +#define VR4131_PCIEXACCREG VR4131_REG32(0xc2c) +#define VR4131_PCIRECONTREG VR4131_REG32(0xc30) +#define VR4131_PCIENREG VR4131_REG32(0xc34) +#define VR4131_PCICLKSELREG VR4131_REG32(0xc38) +#define VR4131_PCITRDYVREG VR4131_REG32(0xc3c) +#define VR4131_PCICLKRUNREG VR4131_REG16(0xc60) +#define VR4131_PCIDMACTRLREG VR4131_REG32(0xc80) + +#define VR4131_PCICLKSEL_DIV_1 0x2 +#define VR4131_PCICLKSEL_DIV_2 0x0 +#define VR4131_PCICLKSEL_DIV_3 0x3 +#define VR4131_PCICLKSEL_DIV_4 0x1 + +#define VR4131_PCICONFIGDONE 0x00000004 /* PCIENREG */ +#define VR4131_PCICLKRUN 0x0001 /* PCICLKRUNREG */ +#define VR4131_PCISTOPEN 0x8000 /* PCICLKRUNREG */ +#define VR4131_PCIIBA 0xFF000000 /* PCIM*AW*REG */ +#define VR4131_PCIMSK 0x000FE000 /* PCIM*AW*REG, PCITAWnREG */ +#define VR4131_PCIWINEN 0x00001000 /* PCIM*AW*REG, PCITAWnREG */ +#define VR4131_PCIPCIA 0x000000FF /* PCIM*AW*REG */ +#define VR4131_PCIITA 0x000007FF /* PCITAWnREG */ + +/* PCI Config Registers */ + +#define VR4131_PCICONF_IDENT VR4131_REG32(0xd00) +#define VR4131_PCICONF_CMDSR VR4131_REG32(0xd04) +#define VR4131_PCICONF_REVCLASS VR4131_REG32(0xd08) +#define VR4131_PCICONF_CACHELAT VR4131_REG32(0xd0c) +#define VR4131_PCICONF_MAILBA VR4131_REG32(0xd10) +#define VR4131_PCICONF_PCIMBA1 VR4131_REG32(0xd14) +#define VR4131_PCICONF_PCIMBA2 VR4131_REG32(0xd18) +#define VR4131_PCICONF_PCIINT VR4131_REG32(0xd3c) +#define VR4131_PCICONF_RETVAL VR4131_REG32(0xd40) + +/* DSIU registers */ + +#define VR4131_DSIURB VR4131_REG8(0x820) /* SUILC7 = 0, read */ +#define VR4131_DSIUTH VR4131_REG8(0x820) /* SUILC7 = 0, write */ +#define VR4131_DSIUDLL VR4131_REG8(0x820) /* SUILC7 = 1 */ +#define VR4131_DSIUIE VR4131_REG8(0x821) /* SUILC7 = 0 */ +#define VR4131_DSIUDLM VR4131_REG8(0x821) /* SUILC7 = 1 */ +#define VR4131_DSIUIID VR4131_REG8(0x822) /* read */ +#define VR4131_DSIUFC VR4131_REG8(0x822) /* write */ +#define VR4131_DSIULC VR4131_REG8(0x823) +#define VR4131_DSIUMC VR4131_REG8(0x824) +#define VR4131_DSIULS VR4131_REG8(0x825) +#define VR4131_DSIUMS VR4131_REG8(0x826) +#define VR4131_DSIUSC VR4131_REG8(0x827) +#define VR4131_DSIURESET VR4131_SIURESET /* Common with SIU */ + +#define VR4131_DSIU_BASE VR4131_DSIURB +#define VR4131_DSIU_DELTA 1 +#define VR4131_DSIU_XTAL 18432000 /* crystal input to 16550 */ + +#define VR4131_DSIURST 0x0002 /* in SIURESET register */ + +/* LED registers */ + +#define VR4131_LEDHTSREG VR4131_REG16(0x180) +#define VR4131_LEDLTSREG VR4131_REG16(0x182) +#define VR4131_LEDCNTREG VR4131_REG16(0x188) +#define VR4131_LEDASTCREG VR4131_REG16(0x18a) +#define VR4131_LEDINTREG VR4131_REG16(0x18c) + +/* SIU registers */ + +#define VR4131_SIURB VR4131_REG8(0x800) /* SUILC7 = 0, read */ +#define VR4131_SIUTH VR4131_REG8(0x800) /* SUILC7 = 0, write */ +#define VR4131_SIUDLL VR4131_REG8(0x800) /* SUILC7 = 1 */ +#define VR4131_SIUIE VR4131_REG8(0x801) /* SUILC7 = 0 */ +#define VR4131_SIUDLM VR4131_REG8(0x801) /* SUILC7 = 1 */ +#define VR4131_SIUIID VR4131_REG8(0x802) /* read */ +#define VR4131_SIUFC VR4131_REG8(0x802) /* write */ +#define VR4131_SIULC VR4131_REG8(0x803) +#define VR4131_SIUMC VR4131_REG8(0x804) +#define VR4131_SIULS VR4131_REG8(0x805) +#define VR4131_SIUMS VR4131_REG8(0x806) +#define VR4131_SIUSC VR4131_REG8(0x807) +#define VR4131_SIUIRSEL VR4131_REG8(0x808) +#define VR4131_SIURESET VR4131_REG8(0x809) /* common with DSIU */ +#define VR4131_SIUCSEL VR4131_REG8(0x80a) + +#define VR4131_SIU_BASE VR4131_SIURB +#define VR4131_SIU_DELTA 1 +#define VR4131_SIU_XTAL 18432000 /* crystal input to 16550 */ + +#define VR4131_SIURST 0x0001 /* in SIURESET register */ + +/* CSI registers */ + +#define VR4131_CSI_MODEREG VR4131_REG16(0x1a0) +#define VR4131_CSI_CLKSELREG VR4131_REG16(0x1a1) +#define VR4131_CSI_SIRBREG VR4131_REG16(0x1a2) +#define VR4131_CSI_SOTBREG VR4131_REG16(0x1a4) +#define VR4131_CSI_SIRBEREG VR4131_REG16(0x1a6) +#define VR4131_CSI_SOTBFREG VR4131_REG16(0x1a8) +#define VR4131_CSI_SIOREG VR4131_REG16(0x1aa) +#define VR4131_CSI_CNTREG VR4131_REG16(0x1b0) +#define VR4131_CSI_INTREG VR4131_REG16(0x1b2) +#define VR4131_CSI_IFIFOVREG VR4131_REG16(0x1b4) +#define VR4131_CSI_OFIFOVREG VR4131_REG16(0x1b6) +#define VR4131_CSI_IFIFOREG VR4131_REG16(0x1b8) +#define VR4131_CSI_OFIFOREG VR4131_REG16(0x1ba) +#define VR4131_CSI_FIFOTRGREG VR4131_REG16(0x1bc) + +/* FIR registers - not included */ + +/* Clock rate values for different settings of CLKSEL[2:0] pins/jumpers. */ + +#define CPU_PCLOCK_RATE_111 200700000 +#define CPU_PCLOCK_RATE_110 180600000 +#define CPU_PCLOCK_RATE_101 164200000 +#define CPU_PCLOCK_RATE_100 150500000 +#define CPU_PCLOCK_RATE_011 129000000 +#define CPU_PCLOCK_RATE_010 100400000 +#define CPU_PCLOCK_RATE_001 90300000 +#define CPU_PCLOCK_RATE_000 78500000 + +/* Miscellaneous */ + +#define NUM_4131_TTY 2 /* SIU + DSIU */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnvr4131h */ diff --git a/h/drv/multi/pccchip.h b/h/drv/multi/pccchip.h new file mode 100644 index 0000000..36f08e2 --- /dev/null +++ b/h/drv/multi/pccchip.h @@ -0,0 +1,197 @@ +/* pccchip.h - Peripheral Channel Controller header */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,06aug96,dat merged from windView branch +01c,17sep93,dzb added TIC_X_COUNTER register defines. +01b,22sep92,rrr added support for c++ +01a,16jun92,ccc created. +*/ + +/* +DESCRIPTION +This file contains I/O addresses and related constants for the PCC +chip. PCC_BASE_ADRS and PRINTER must be defined. +*/ + +#ifndef __INCpccchiph +#define __INCpccchiph + +#ifdef __cplusplus +extern "C" { +#endif + +/* PCC addresses */ + +#define SCSI_DMA_TABLE_ADRS ((long *) (PCC_BASE_ADRS + 0x00)) +#define SCSI_PCC_DMA_ADRS ((long *) (PCC_BASE_ADRS + 0x04)) +#define SCSI_DMA_BYTE_COUNT ((long *) (PCC_BASE_ADRS + 0x08)) + +#define TIC_1_PRELOAD ((short *)(PCC_BASE_ADRS + 0x10)) +#define TIC_2_PRELOAD ((short *)(PCC_BASE_ADRS + 0x14)) + +#define TIC_1_COUNTER ((short *)(PCC_BASE_ADRS + 0x12)) +#define TIC_2_COUNTER ((short *)(PCC_BASE_ADRS + 0x16)) + +#define TIC_1_INT_CTL ((char *) (PCC_BASE_ADRS + 0x18)) +#define TIC_1_CSR ((char *) (PCC_BASE_ADRS + 0x19)) +#define TIC_2_INT_CTL ((char *) (PCC_BASE_ADRS + 0x1a)) +#define TIC_2_CSR ((char *) (PCC_BASE_ADRS + 0x1b)) + +#define ACFAIL_INT_CTL ((char *) (PCC_BASE_ADRS + 0x1c)) +#define WDOG_CSR ((char *) (PCC_BASE_ADRS + 0x1d)) +#define BERR_INT_CTL ((char *) (PCC_BASE_ADRS + 0x22)) +#define ABORT_INT_CTL ((char *) (PCC_BASE_ADRS + 0x24)) + +#define PRINTER_INT_CTL ((char *) (PCC_BASE_ADRS + 0x1e)) +#define PRINTER_CSR ((char *) (PCC_BASE_ADRS + 0x1f)) +#define PRINTER_DATA ((char *) (PRINTER + 0x00)) +#define PRINTER_STATUS ((char *) (PRINTER + 0x00)) + +#define SCSI_DMA_INT_CTL ((char *) (PCC_BASE_ADRS + 0x20)) +#define SCSI_DMA_CSR ((char *) (PCC_BASE_ADRS + 0x21)) +#define SCSI_DMA_TABLE_FC ((char *) (PCC_BASE_ADRS + 0x25)) +#define SCSI_INT_CTL ((char *) (PCC_BASE_ADRS + 0x2a)) + +#define SERIAL_INT_CTL ((char *) (PCC_BASE_ADRS + 0x26)) + +#define LAN_INT_CTL ((char *) (PCC_BASE_ADRS + 0x28)) + +#define SOFT_1_INT_CTL ((char *) (PCC_BASE_ADRS + 0x2c)) +#define SOFT_2_INT_CTL ((char *) (PCC_BASE_ADRS + 0x2e)) + +#define GP_CTL ((char *) (PCC_BASE_ADRS + 0x27)) +#define GP_STATUS ((char *) (PCC_BASE_ADRS + 0x29)) +#define INT_BASE_CTL ((char *) (PCC_BASE_ADRS + 0x2d)) +#define SLAVE_BASE_CTL ((char *) (PCC_BASE_ADRS + 0x2b)) + +#define PCC_REVISION ((char *) (PCC_BASE_ADRS + 0x2f)) + +/* PCC register bit definitions */ + +#define TIC_1_INT_CTL_CLEAR 0x80 /* Clear tic 1 interrupt */ +#define TIC_1_INT_CTL_ENABLE 0x08 /* Enable tic 1 interrupt */ +#define TIC_1_INT_CTL_DISABLE 0x00 /* Disable tic 1 interrupt */ + +#define TIC_1_CSR_CLR_OVF 0x04 /* Clear overflow counter */ +#define TIC_1_CSR_ENABLE 0x03 /* Enable counter */ +#define TIC_1_CSR_DISABLE 0x01 /* Disable tic 1 counter */ +#define TIC_1_CSR_STOP 0x00 /* Load preload */ + +#define TIC_2_INT_CTL_CLEAR 0x80 /* Clear tic 2 interrupt */ +#define TIC_2_INT_CTL_ENABLE 0x08 /* Enable tic 2 interrupt */ +#define TIC_2_INT_CTL_DISABLE 0x00 /* Disable tic 2 interrupt */ + +#define TIC_2_CSR_CLR_OVF 0x04 /* Clear overflow counter */ +#define TIC_2_CSR_ENABLE 0x03 /* Enable counter */ +#define TIC_2_CSR_DISABLE 0x01 /* Disable tic 2 counter */ +#define TIC_2_CSR_STOP 0x00 /* Load preload */ + +#define ACFAIL_INT_CTL_CLEAR 0x80 /* Clear AC fail interrupt */ +#define ACFAIL_INT_CTL_ENABLE 0x08 /* Enable AC fail interrupt */ +#define ACFAIL_INT_CTL_DISABLE 0x00 /* Disable AC fail interrupt */ + +#define WDOG_CSR_TO_CLEAR 0x08 /* Clear wDog time-out */ +#define WDOG_CSR_WD_RESET 0x04 /* wDog activates reset */ +#define WDOG_CSR_WD_CLEAR 0x02 /* Clear wDog */ +#define WDOG_CSR_ENABLE 0x01 /* Enable wDog */ +#define WDOG_CSR_DISABLE 0x00 /* Disable wDog */ + +#define BERR_INT_CTL_CLEAR 0x80 /* Clear bus error interrupt */ +#define BERR_INT_CTL_ENABLE 0x08 /* Enable bus error interrupt */ +#define BERR_INT_CTL_DISABLE 0x00 /* Disable bus error interrupt */ + +#define ABORT_INT_CTL_CLEAR 0x80 /* Clear abort interrupt */ +#define ABORT_INT_CTL_ENABLE 0x08 /* Enable abort interrupt */ +#define ABORT_INT_CTL_DISABLE 0x00 /* Disable abort interrupt */ + +#define SERIAL_INT_CTL_VECT_IN 0x10 /* Interrupt vector from PCC */ +#define SERIAL_INT_CTL_VCHIP 0x00 /* Interrupt vector from chip */ +#define SERIAL_INT_CTL_ENABLE 0x08 /* Enable serial interrupt */ +#define SERIAL_INT_CTL_DISABLE 0x00 /* Disable serial interrupt */ + +#define GP_CTL_RST_SW_DISABLE 0xa0 /* Disable front panel reset */ +#define GP_CTL_RST_SW_ENABLE 0x00 /* Enable front panel reset */ +#define GP_CTL_MASTER_INT_EN 0x10 /* Master interrupt enable */ +#define GP_CTL_MASTER_INT_DIS 0x00 /* Master interrupt disable */ +#define GP_CTL_LOCAL_TO_EN 0x08 /* Enable local bus timeout */ +#define GP_CTL_LOCAL_TO_DIS 0x00 /* Disable local bus timeout */ +#define GP_CTL_PARITY_DISABLE 0x00 /* Disable parity checking */ +#define GP_CTL_PARITY_ENABLE 0x01 /* Enable parity checking */ + +#define GP_STATUS_PU_CLEAR 0x02 /* Clear power-up reset */ +#define GP_STATUS_PARITY_CLEAR 0x01 /* Clear parity error */ + +#define LAN_INT_CTL_ENABLE 0x08 /* Enable LAN interrupt */ +#define LAN_INT_CTL_DISABLE 0x00 /* Disable LAN interrupt */ + +#define SOFT_1_INT_CTL_ENABLE 0x08 /* Enable software 1 interrupt */ +#define SOFT_1_INT_CTL_DISABLE 0x00 /* Disable software 1 interrupt */ + +#define SOFT_2_INT_CTL_ENABLE 0x08 /* Enable software 2 interrupt */ +#define SOFT_2_INT_CTL_DISABLE 0x00 /* Disable software 2 interrupt */ +#define PRNT_INT_CTL_CLR_FAULT 0x40 /* Clear fault interrupt */ +#define PRNT_INT_CTL_CLR_ACK 0x20 /* Clear ACK interrupt */ +#define PRNT_INT_CTL_ACK_FALL 0x10 /* ACK on falling edge */ +#define PRNT_INT_CTL_ACK_RISE 0x00 /* ACK on rising edge */ +#define PRNT_INT_CTL_ENABLE 0x08 /* Enable printer interrupt */ +#define PRNT_INT_CTL_DISABLE 0x00 /* Disable printer interrupt */ + +#define DMA_INT_CTL_PENDING 0x80 /* Interrupt pending */ +#define DMA_INT_CTL_CLEAR 0x80 /* Clear pending interrupt */ +#define DMA_INT_CTL_ENABLE 0x08 /* Enable DMA interrupt */ +#define DMA_INT_CTL_DISABLE 0x00 /* Disable DMA interrupt */ + +#define DMA_CSR_ENABLE 0x01 /* Enable DMA controller */ +#define DMA_CSR_DISABLE 0x00 /* Disable DMA controller */ +#define DMA_CSR_TW 0x02 /* Use table address register */ +#define DMA_CSR_READ 0x00 /* Transfer from SCSI bus */ +#define DMA_CSR_WRITE 0x04 /* Transfer to SCSI bus */ + +#define SCSI_INT_CTL_RESET 0x40 /* Reset SCSI interrupt */ +#define SCSI_INT_CTL_BUS_RESET 0x10 /* Reset SCSI bus */ +#define SCSI_INT_CTL_ENABLE 0x08 /* Enable SCSI interrupt */ +#define SCSI_INT_CTL_DISABLE 0x00 /* Disable SCSI interrupt */ + +/* function declarations */ + +#ifndef _ASMLANGUAGE +#if defined(__STDC__) || defined(__cplusplus) + +#if CPU_FAMILY == I960 +IMPORT STATUS sysIntDisable (); +IMPORT STATUS sysIntEnable (); +IMPORT int sysBusIntAck (); +IMPORT STATUS sysBusIntGen (); +IMPORT STATUS sysMailboxEnable (); +#else /* CPU_FAMILY == I960 */ +IMPORT STATUS sysIntDisable (int intLevel); +IMPORT STATUS sysIntEnable (int intLevel); +IMPORT int sysBusIntAck (int intLevel); +IMPORT STATUS sysBusIntGen (int level, int vector); +IMPORT STATUS sysMailboxEnable (char *mailboxAdrs); +#endif /* CPU_FAMILY == I960 */ + +IMPORT STATUS sysMailboxConnect (FUNCPTR routine, int arg); + +#else /* __STDC__ */ + +IMPORT STATUS sysIntDisable (); +IMPORT STATUS sysIntEnable (); +IMPORT int sysBusIntAck (); +IMPORT STATUS sysBusIntGen (); +IMPORT STATUS sysMailboxEnable (); +IMPORT STATUS sysMailboxConnect (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpccchiph */ diff --git a/h/drv/multi/pccchip2.h b/h/drv/multi/pccchip2.h new file mode 100644 index 0000000..179efaa --- /dev/null +++ b/h/drv/multi/pccchip2.h @@ -0,0 +1,331 @@ +/* pccchip2.h - Peripheral Channel Controller */ + +/* Copyright 1991-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01f,29sep98,fle doc : made it refgen parsable +01e,22sep92,rrr added support for c++ +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01b,12aug91,ccc added CASTINT for long word access to register (lint error). +01a,17jun91,ccc written. +*/ + +#ifdef DOC +#define INCpccchip2h +#endif /* DOC */ + +#ifndef __INCpccchip2h +#define __INCpccchip2h + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This file contains constants for the Paripheral Channel controller. + * The macro PCC2_BASE_ADRS must be defined when including this header. + */ + +#ifdef _ASMLANGUAGE +#define CAST +#define CASTINT +#else +#define CAST (char *) +#define CASTINT (int *) +#endif /* _ASMLANGUAGE */ + +/* on-board access, register definitions */ + +#define PCC2_REG_INTERVAL 1 + +#ifndef PCC2_ADRS /* to permit alternative board addressing */ +#define PCC2_ADRS(reg) (CAST (PCC2_BASE_ADRS + (reg * PCC2_REG_INTERVAL))) +#define PCC2_ADRS_INT(reg) (CASTINT (PCC2_BASE_ADRS + \ + (reg * PCC2_REG_INTERVAL))) +#endif /* PCC2_ADRS */ + +#define PCC2_ID PCC2_ADRS(0x00) /* Chip ID */ +#define PCC2_REVISION PCC2_ADRS(0x01) /* Chip Revision */ +#define PCC2_GCR PCC2_ADRS(0x02) /* General Control Register */ +#define PCC2_VBR PCC2_ADRS(0x03) /* Vector Base Register */ +#define PCC2_TIMER1_CMP PCC2_ADRS_INT(0x04) /* Tick Timer 1 Comp Reg */ +#define PCC2_TIMER1_CMP_UU PCC2_ADRS(0x04) /* Tick Timer 1 Comp Reg - UU */ +#define PCC2_TIMER1_CMP_UL PCC2_ADRS(0x05) /* - UL */ +#define PCC2_TIMER1_CMP_LU PCC2_ADRS(0x06) /* - LU */ +#define PCC2_TIMER1_CMP_LL PCC2_ADRS(0x07) /* - LL */ +#define PCC2_TIMER1_CNT PCC2_ADRS_INT(0x08) /* Tick Timer 1 Count Reg */ +#define PCC2_TIMER1_CNT_UU PCC2_ADRS(0x08) /* Tick Timer 1 Cnt Reg - UU */ +#define PCC2_TIMER1_CNT_UL PCC2_ADRS(0x09) /* - UL */ +#define PCC2_TIMER1_CNT_LU PCC2_ADRS(0x0a) /* - LU */ +#define PCC2_TIMER1_CNT_LL PCC2_ADRS(0x0b) /* - LL */ +#define PCC2_TIMER2_CMP PCC2_ADRS_INT(0x0c) /* Tick Timer 2 Comp Reg */ +#define PCC2_TIMER2_CMP_UU PCC2_ADRS(0x0c) /* Tick Timer 2 Comp Reg - UU */ +#define PCC2_TIMER2_CMP_UL PCC2_ADRS(0x0d) /* - UL */ +#define PCC2_TIMER2_CMP_LU PCC2_ADRS(0x0e) /* - LU */ +#define PCC2_TIMER2_CMP_LL PCC2_ADRS(0x0f) /* - LL */ +#define PCC2_TIMER2_CNT PCC2_ADRS_INT(0x10) /* Tick Timer 2 Count Reg */ +#define PCC2_TIMER2_CNT_UU PCC2_ADRS(0x10) /* Tick Timer 2 Cnt Reg - UU */ +#define PCC2_TIMER2_CNT_UL PCC2_ADRS(0x11) /* - UL */ +#define PCC2_TIMER2_CNT_LU PCC2_ADRS(0x12) /* - LU */ +#define PCC2_TIMER2_CNT_LL PCC2_ADRS(0x13) /* - LL */ +#define PCC2_PRESCALE PCC2_ADRS(0x14) /* Prescaler Count Register */ +#define PCC2_PRESCALE_CLK_ADJ PCC2_ADRS(0x15) /* Prescaler Clock Adjust */ +#define PCC2_TIMER2_CR PCC2_ADRS(0x16) /* Tick Timer 2 Ctrl Reg */ +#define PCC2_TIMER1_CR PCC2_ADRS(0x17) /* Tick Timer 1 Ctrl Reg */ +#define PCC2_GPIICR PCC2_ADRS(0x18) /* GPI Interrupt CR */ +#define PCC2_GPIOCR PCC2_ADRS(0x19) /* GPI/O Control Register */ +#define PCC2_T2_IRQ_CR PCC2_ADRS(0x1a) /* Tick Timer 2 Inter CR */ +#define PCC2_T1_IRQ_CR PCC2_ADRS(0x1b) /* Tick Timer 1 Inter CR */ +#define PCC2_SCC_ERR_SR PCC2_ADRS(0x1c) /* SCC Error Status Register */ +#define PCC2_SCC_MICR PCC2_ADRS(0x1d) /* SCC Modem Inter Ctrl Reg */ +#define PCC2_SCC_TICR PCC2_ADRS(0x1e) /* SCC Transmit Inter CR */ +#define PCC2_SCC_RICR PCC2_ADRS(0x1f) /* SCC Receive Inter CR */ +#define PCC2_MODEM_PIACK PCC2_ADRS(0x23) /* Modem PIACK Register */ +#define PCC2_TRANS_PIACK PCC2_ADRS(0x25) /* Transmit PIACK Register */ +#define PCC2_REC_PIACK PCC2_ADRS(0x27) /* Receive PIACK Register */ +#define PCC2_LANC_ERR_SR PCC2_ADRS(0x28) /* LANC Error Status Register */ +#define PCC2_LANC_IRQ_CR PCC2_ADRS(0x2a) /* LANC Inter Ctrl Reg */ +#define PCC2_LANC_BEICR PCC2_ADRS(0x2b) /* LANC Bus Error Inter CR */ +#define PCC2_SCSI_ERR_SR PCC2_ADRS(0x2c) /* SCSI Error Status Register */ +#define PCC2_SCSI_IRQ_CR PCC2_ADRS(0x2f) /* SCSI Inter Control Reg */ +#define PCC2_PRINTER_ACK_IRQ PCC2_ADRS(0x30) /* Printer ACK Inter Ctrl Reg */ +#define PCC2_PRINTER_FAULT_IRQ PCC2_ADRS(0x31) /* Printer FAULT Inter CR */ +#define PCC2_PRINTER_SEL_IRQ PCC2_ADRS(0x32) /* Printer SEL Inter Ctrl Reg */ +#define PCC2_PRINTER_PE_IRQ PCC2_ADRS(0x33) /* Printer PE Inter Ctrl Reg */ +#define PCC2_PRINTER_BUSY_IRQ PCC2_ADRS(0x34) /* Printer BUSY Inter CR */ +#define PCC2_PRINTER_ISR PCC2_ADRS(0x36) /* Printer Input Status Reg */ +#define PCC2_PRINTER_PCR PCC2_ADRS(0x37) /* Printer Port Control Reg */ +#define PCC2_CHIP_SPEED PCC2_ADRS(0x38) /* Chip Speed Register (WORD) */ +#define PCC2_PRINTER_DATA PCC2_ADRS(0x3a) /* Printer Data Register */ +#define PCC2_IPLR PCC2_ADRS(0x3e) /* Inter Priority Level Reg */ +#define PCC2_IMLR PCC2_ADRS(0x3f) /* Interrupt Mask Level Reg */ + +/* GCR 0x02 General Control Register */ + +#define GCR_FAST_ON 0x01 /* Enable fast access for BBRAM 0 */ +#define GCR_FAST_OFF 0x00 /* Disable fast access for BBRAM 0 */ +#define GCR_MIEN_ON 0x02 /* Master Interrupt Enable 1 */ +#define GCR_MIEN_OFF 0x00 /* Master Interrupt Enable OFF 1 */ +#define GCR_C040 0x04 /* The CPU is an MC68040 2 */ + +/* VBR 0x03 Vector Base Register */ + +#define PCC2_INT_PP_BSY 0x0 /* Printer Port-BSY */ +#define PCC2_INT_PP_PE 0x1 /* Printer Port-PE */ +#define PCC2_INT_PP_SELECT 0x2 /* Printer Port-SELECT */ +#define PCC2_INT_PP_FAULT 0x3 /* Printer Port-FAULT */ +#define PCC2_INT_PP_ACK 0x4 /* Printer Port-ACK */ +#define PCC2_INT_SCSI 0x5 /* SCSI IRQ */ +#define PCC2_INT_LANC_ERR 0x6 /* LANC ERR */ +#define PCC2_INT_LANC 0x7 /* LANC IRQ */ +#define PCC2_INT_TT2 0x8 /* Tick Timer 2 IRQ */ +#define PCC2_INT_TT1 0x9 /* Tick Timer 1 IRQ */ +#define PCC2_INT_GPIO 0xa /* GPIO IRQ */ +#define PCC2_INT_SERIAL_MODEM 0xb /* Serial Modem IRQ (DO NOT USE)*/ +#define PCC2_INT_SERIAL_RX 0xc /* Serial RX IRQ (DO NOT USE) */ +#define PCC2_INT_SERIAL_TX 0xd /* Serial TX IRQ (DO NOT USE) */ + +/* TIMER2_CR 0x16 Tick Timer 2 Control Register */ + +#define TIMER2_CR_CEN 0x01 /* Counter Enable 0 */ +#define TIMER2_CR_DIS 0x00 /* Counter Disable 0 */ +#define TIMER2_CR_COC 0x02 /* Clear On Compare 1 */ +#define TIMER2_CR_COVF 0x04 /* Clear Overflow Counter 2 */ + +/* TIMER1_CR 0x17 Tick Timer 1 Control Register */ + +#define TIMER1_CR_CEN 0x01 /* Counter Enable 0 */ +#define TIMER1_CR_DIS 0x00 /* Counter Disable 0 */ +#define TIMER1_CR_COC 0x02 /* Clear On Compare 1 */ +#define TIMER1_CR_COVF 0x04 /* Clear Overflow Counter 2 */ + +/* GPIICR 0x18 General Purpose Input Interrupt Control Register */ + +#define GPIICR_ICLR 0x08 /* Clear IRQ in edge-sensitive mode 3 */ +#define GPIICR_IEN 0x10 /* Interrupt Enable 4 */ +#define GPIICR_DIS 0x00 /* Interrupt Disable 4 */ +#define GPIICR_INT 0x20 /* Interrupt has occured 5 */ +#define GPIICR_EDGE 0x40 /* Interrupt is Edge sensitive 6 */ +#define GPIICR_LEVEL 0x00 /* Interrupt is Level sensitive 6 */ +#define GPIICR_HIGH_LOW 0x80 /* Interrupt is High to Low (Falling) 7 */ +#define GPIICR_LOW_HIGH 0x00 /* Interrupt is Low to High (rising) 7 */ + +/* GPIOCR 0x19 General Purpose Input/Output Pin Control Register */ + +#define GPIOCR_GPO_HIGH 0x01 /* Set GPIO Pin to a HIGH 0 */ +#define GPIOCR_GPO_LOW 0x00 /* Set GPIO Pin to a LOW 0 */ +#define GPIOCR_GPOE 0x02 /* Set GPIO Pin as an Output 1 */ +#define GPIOCR_GPI 0x04 /* Status of the GPIO bit 2 */ + +/* T2_IRQ_CR 0x1a Tick Timer 2 Interrupt Control Register */ + +#define T2_IRQ_CR_ICLR 0x08 /* Clear IRQ 3 */ +#define T2_IRQ_CR_IEN 0x10 /* Interrupt Enable 4 */ +#define T2_IRQ_CR_DIS 0x00 /* Interrupt Disable 4 */ +#define T2_IRQ_CR_INT 0x20 /* Interrupt Status 5 */ + +/* T1_IRQ_CR 0x1b Tick Timer 1 Interrupt Control Register */ + +#define T1_IRQ_CR_ICLR 0x08 /* Clear IRQ 3 */ +#define T1_IRQ_CR_IEN 0x10 /* Interrupt Enable 4 */ +#define T1_IRQ_CR_DIS 0x00 /* Interrupt Disable 4 */ +#define T1_IRQ_CR_INT 0x20 /* Interrupt Status 5 */ + +/* SCC_ERR_SR 0x1c SCC Error Status Register */ + +#define SCC_ERR_SR_SCLR 0x01 /* Clear Error Status Bits 0 */ +#define SCC_ERR_SR_LTO 0x02 /* Local Time out error 1 */ +#define SCC_ERR_SR_EXT 0x04 /* VMEbus error 2 */ +#define SCC_ERR_SR_PRTY 0x08 /* DRAM Parity Error 3 */ +#define SCC_ERR_SR_RTRY 0x10 /* Retry was needed 4 */ + +/* SCC_MICR 0x1d SCC Modem Interrupt Control Register */ + +#define SCC_MICR_AVEC 0x08 /* The PCC supplies IVEC (do not use) 3 */ +#define SCC_MICR_IEN 0x10 /* Interrupt Enable 4 */ +#define SCC_MICR_DIS 0x00 /* Interrupt Disable 4 */ +#define SCC_MICR_IRQ 0x20 /* An Interrupt has occured 5 */ + +/* SCC_TICR 0x1e SCC Transmit Interrupt Control Register */ + +#define SCC_TICR_AVEC 0x08 /* The PCC supplies IVEC (do no use) 3 */ +#define SCC_TICR_IEN 0x10 /* Interrupt Enable 4 */ +#define SCC_TICR_DIS 0x00 /* Interrupt Disable 4 */ +#define SCC_TICR_IRQ 0x20 /* An Interrupt has occured 5 */ + +/* SCC_RICR 0x1f SCC Receive Interrupt Control Register */ + +#define SCC_RICR_AVEC 0x08 /* PCC supply IVEC (do not use) 3 */ +#define SCC_RICR_IEN 0x10 /* Interrupt Enable 4 */ +#define SCC_RICR_DIS 0x00 /* Interrupt Disable 4 */ +#define SCC_RICR_IRQ 0x20 /* An Intrrupt has occured 5 */ +#define SCC_RICR_NO_SNOOP 0x00 /* Inhibit Snoop 7-6 */ +#define SCC_RICR_SINK_DATA 0x40 /* Sink Data 7-6 */ +#define SCC_RICR_INVALIDATE 0x80 /* Invalidate Line 7-6 */ + +/* LANC_ERR_SR 0x28 LANC Error Status Register */ +#define LANC_ERR_SR_SCLR 0x01 /* Clear Error Status Bits 0 */ +#define LANC_ERR_SR_LTO 0x02 /* Local Time out error 1 */ +#define LANC_ERR_SR_EXT 0x04 /* VMEbus error 2 */ +#define LANC_ERR_SR_PRTY 0x08 /* DRAM Parity Error 3 */ + +/* LANC_IRQ_CR 0x2a LANC Interrupt Control Register */ + +#define LANC_IRQ_CR_ICLR 0x08 /* Clear IRQ in edge mode 3 */ +#define LANC_IRQ_CR_IEN 0x10 /* Interrupt Enable 4 */ +#define LANC_IRQ_CR_DIS 0x00 /* Interrupt Disable 4 */ +#define LANC_IRQ_CR_INT 0x20 /* Interrupt Status 5 */ +#define LANC_IRQ_CR_EDGE 0x40 /* Edge sensitive IRQ 6 */ +#define LANC_IRQ_CR_LEVEL 0x00 /* Level sensitive IRQ 6 */ +#define LANC_IRQ_CR_HIGH_LOW 0x00 /* IRQ on RISING or HIGH 7 */ +#define LANC_IRQ_CR_LOW_HIGH 0x80 /* IRQ on FALLING or LOW 7 */ + +/* LANC_BEICR 0x2b LANC Bus Error Interrupt Control Register */ + +#define LANC_BEICR_ICLR 0x08 /* Clear IRQ 3 */ +#define LANC_BEICR_IEN 0x10 /* Interrupt Enable 4 */ +#define LANC_BEICR_DIS 0x00 /* Interrupt Disable 4 */ +#define LANC_BEICR_IRQ 0x20 /* Interrupt Status 5 */ +#define LANC_BEICR_NO_SNOOP 0x00 /* Inhibit Snoop 7-6 */ +#define LANC_BEICR_SINK_DATA 0x40 /* Sink Data 7-6 */ +#define LANC_BEICR_INVALIDATE 0x80 /* Invalidate Line 7-6 */ + +/* SCSI_ERR_SR 0x2c SCSI Error Status Register */ + +#define SCSI_ERR_SR_SCLR 0x01 /* Clear Error Status Bits 0 */ +#define SCSI_ERR_SR_LTO 0x02 /* Local Time out error 1 */ +#define SCSI_ERR_SR_EXT 0x04 /* VMEbus error 2 */ +#define SCSI_ERR_SR_PRTY 0x08 /* DRAM Parity Error 3 */ + +/* SCSI_IRQ_CR 0x2f SCSI Interrupt Control Register */ + +#define SCSI_IRQ_CR_IEN 0x10 /* Interrupt Enable 4 */ +#define SCSI_IRQ_CR_DIS 0x00 /* Interrupt Disable 4 */ +#define SCSI_IRQ_CR_IRQ 0x20 /* Interrupt Status 5 */ + +/* PRINTER_ACK_IRQ 0x30 Printer ACK Interrupt Control Register */ + +#define PRINTER_ACK_IRQ_ICLR 0x08 /* Clear IRQ in edge mode 3 */ +#define PRINTER_ACK_IRQ_IEN 0x10 /* Interrupt Enable 4 */ +#define PRINTER_ACK_IRQ_DIS 0x00 /* Interrupt Disable 4 */ +#define PRINTER_ACK_IRQ_INT 0x20 /* Interrupt Status 5 */ +#define PRINTER_ACK_IRQ_EDGE 0x40 /* Edge Sensitive IRQ 6 */ +#define PRINTER_ACK_IRQ_LEVEL 0x00 /* Level Sensitive IRQ 6 */ +#define PRINTER_ACK_IRQ_HIGH_LOW 0x00 /* IRQ on HIGH to LOW 7 */ +#define PRINTER_ACK_IRQ_LOW_HIGH 0x80 /* IRQ on LOW to HIGH 7 */ + +/* PRINTER_FAULT_IRQ 0x31 Printer FAULT Interrupt Control Register */ + +#define PRINTER_FAULT_ICLR 0x08 /* Clear IRQ in edge mode 3 */ +#define PRINTER_FAULT_IEN 0x10 /* Interrupt Enable 4 */ +#define PRINTER_FAULT_IRQ_DIS 0x00 /* Interrupt Disable 4 */ +#define PRINTER_FAULT_INT 0x20 /* Interrupt Status 5 */ +#define PRINTER_FAULT_EDGE 0x40 /* Edge Sensitive IRQ 6 */ +#define PRINTER_FAULT_LEVEL 0x00 /* Level Sensitive IRQ 6 */ +#define PRINTER_FAULT_HIGH_LOW 0x00 /* IRQ on HIGH to LOW 7 */ +#define PRINTER_FAULT_LOW_HIGH 0x80 /* IRQ on LOW to HIGH 7 */ + +/* PRINTER_SEL_IRQ 0x32 Printer SEL Interrupt Control Register */ + +#define PRINTER_SEL_IRQ_ICLR 0x08 /* Clear IRQ in edge mode 3 */ +#define PRINTER_SEL_IRQ_IEN 0x10 /* Interrupt Enable 4 */ +#define PRINTER_SEL_IRQ_DIS 0x00 /* Interrupt Disable 4 */ +#define PRINTER_SEL_IRQ_INT 0x20 /* Interrupt Status 5 */ +#define PRINTER_SEL_IRQ_EDGE 0x40 /* Edge Sensitive IRQ 6 */ +#define PRINTER_SEL_IRQ_LEVEL 0x00 /* Level Sensitive IRQ 6 */ +#define PRINTER_SEL_IRQ_HIGH_LOW 0x80 /* IRQ on HIGH to LOW 7 */ +#define PRINTER_SEL_IRQ_LOW_HIGH 0x00 /* IRQ on LOW to HIGH (rising) 7 */ + +/* PRINTER_PE_IRQ 0x33 Printer PE Interrupt Control Register */ + +#define PRINTER_PE_IRQ_ICLR 0x08 /* Clear IRQ in edge mode 3 */ +#define PRINTER_PE_IRQ_IEN 0x10 /* Interrupt Enable 4 */ +#define PRINTER_PE_IRQ_DIS 0x00 /* Interrupt Disable 4 */ +#define PRINTER_PE_IRQ_INT 0x20 /* Interrupt Status 5 */ +#define PRINTER_PE_IRQ_EDGE 0x40 /* Edge Sensitive IRQ 6 */ +#define PRINTER_PE_IRQ_LEVEL 0x00 /* Level Sensitive IRQ 6 */ +#define PRINTER_PE_IRQ_HIGH_LOW 0x80 /* IRQ on HIGH to LOW (falling) 7 */ +#define PRINTER_PE_IRQ_LOW_HIGH 0x00 /* IRQ on LOW to HIGH (rising) 7 */ + +/* PRINTER_BUSY_IRQ 0x34 Printer BUSY Interrupt Control Register */ + +#define PRINTER_BUSY_IRQ_ICLR 0x08 /* Clear IRQ in edge mode 3 */ +#define PRINTER_BUSY_IRQ_IEN 0x10 /* Interrupt Enable 4 */ +#define PRINTER_BUSY_IRQ_DIS 0x00 /* Interrupt Disable 4 */ +#define PRINTER_BUSY_IRQ_INT 0x20 /* Interrupt Status 5 */ +#define PRINTER_BUSY_IRQ_EDGE 0x40 /* Edge Sensitive IRQ 6 */ +#define PRINTER_BUSY_IRQ_LEVEL 0x00 /* Level Sensitive IRQ 6 */ +#define PRINTER_BUSY_IRQ_HIGH_LOW 0x80 /* IRQ on HIGH to LOW (falling) 7 */ +#define PRINTER_BUSY_IRQ_LOW_HIGH 0x00 /* IRQ on LOW to HIGH (rising) 7 */ + +/* PRINTER_ISR 0x36 Printer Input Status Register */ + +#define PRINTER_ISR_BSY 0x01 /* Printer Busy input pin 0 */ +#define PRINTER_ISR_PE 0x02 /* Printer Paper Error input 1 */ +#define PRINTER_ISR_SEL 0x04 /* Printer Select input 2 */ +#define PRINTER_ISR_FLT 0x08 /* Printer FAULT input 3 */ +#define PRINTER_ISR_ACK 0x10 /* Printer Acknowledge input 4 */ +#define PRINTER_ISR_PINT 0x80 /* Printer Interrupt Status 7 */ + +/* PRINTER_PCR 0x37 Printer Port Control Register */ + +#define PRINTER_PCR_MAN 0x01 /* Manual Strobe Control 0 */ +#define PRINTER_PCR_AUTO 0x00 /* Automatic Strobe Control 0 */ +#define PRINTER_PCR_FAST 0x02 /* Fast Strobe Time 1 */ +#define PRINTER_PCR_SLOW 0x00 /* Slow Strobe Time 1 */ +#define PRINTER_PCR_STB_ON 0x04 /* Manual Strobe Active 2 */ +#define PRINTER_PCR_STB_OFF 0x00 /* Manual Strobe Off 2 */ +#define PRINTER_PCR_INP_ON 0x08 /* Input Prime Active 3 */ +#define PRINTER_PCR_INP_OFF 0x00 /* Input Prime Off 3 */ +#define PRINTER_PCR_DOEN 0x10 /* Printer Data Output Enable 4 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpccchip2h */ diff --git a/h/drv/multi/ppc555Siu.h b/h/drv/multi/ppc555Siu.h new file mode 100644 index 0000000..79dc69f --- /dev/null +++ b/h/drv/multi/ppc555Siu.h @@ -0,0 +1,377 @@ +/* ppc555Siu.h - PowerPC 555 Unified System Interface Unit header file */ + +/* Copyright 1984-1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,26aug99,cmc Added new definitions +01b,15apr99.cmc Fixed PISCR_PIRQ values +01a,17mar99,zl created. +*/ + +/* +This file contains constants of the System Interface Unit (SIU) for the +Motorola MPC555 PowerPC microcontroller +*/ + +#ifndef __INCppc555Siuh +#define __INCppc555Siuh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _ASMLANGUAGE +#define CAST(x) +#else /* _ASMLANGUAGE */ +typedef volatile UCHAR VCHAR; /* shorthand for volatile UCHAR */ +typedef volatile INT32 VINT32; /* volatile unsigned word */ +typedef volatile INT16 VINT16; /* volatile unsigned halfword */ +typedef volatile INT8 VINT8; /* volatile unsigned byte */ +typedef volatile UINT32 VUINT32; /* volatile unsigned word */ +typedef volatile UINT16 VUINT16; /* volatile unsigned halfword */ +typedef volatile UINT8 VUINT8; /* volatile unsigned byte */ +#define CAST(x) (x) +#endif /* _ASMLANGUAGE */ + + +/* + * MPC555 SIU internal register/memory map + */ + +/* General SIU registers */ + +#define SIUMCR(base) (CAST(VUINT32 *) (base + 0x2FC000)) /* SIU Module Config*/ +#define SYPCR(base) (CAST(VUINT32 *) (base + 0x2FC004)) /* Protection Ctrl */ +#define SWSR(base) (CAST(VUINT16 *) (base + 0x2FC00E)) /* SW Service Reg */ +#define SIPEND(base) (CAST(VUINT32 *) (base + 0x2FC010)) /* Intr Pending reg */ +#define SIMASK(base) (CAST(VUINT32 *) (base + 0x2FC014)) /* Intr Mask reg */ +#define SIEL(base) (CAST(VUINT32 *) (base + 0x2FC018)) /* Intr Edge Lvl */ +#define SIVEC(base) (CAST(VUINT32 *) (base + 0x2FC01C)) /* Intr Vector reg */ +#define TESR(base) (CAST(VUINT32 *) (base + 0x2FC020)) /* Tx Error Status */ +#define SGPIODT1(base) (CAST(VUINT32 *) (base + 0x2FC024)) /* GP I/O Data reg */ +#define SGPIODT2(base) (CAST(VUINT32 *) (base + 0x2FC028)) /* GP I/O Data reg 2 */ +#define SGPIOCR(base) (CAST(VUINT32 *) (base + 0x2FC02C)) /* GP I/O Control reg */ +#define EMCR(base) (CAST(VUINT32 *) (base + 0x2FC030)) /* Ext Mstr Mode Ctrl */ +#define PDMCR(base) (CAST(VUINT16 *) (base + 0x2FC03C)) /* Pads Module Ctrl */ + +/* MEMC registers */ + +#define BR0(base) (CAST(VUINT32 *) (base + 0x2FC100)) /* Base Reg bank 0 */ +#define OR0(base) (CAST(VUINT32 *) (base + 0x2FC104)) /* Option Reg bank 0*/ +#define BR1(base) (CAST(VUINT32 *) (base + 0x2FC108)) /* Base Reg bank 1 */ +#define OR1(base) (CAST(VUINT32 *) (base + 0x2FC10C)) /* Option Reg bank 1*/ +#define BR2(base) (CAST(VUINT32 *) (base + 0x2FC110)) /* Base Reg bank 2 */ +#define OR2(base) (CAST(VUINT32 *) (base + 0x2FC114)) /* Option Reg bank 2*/ +#define BR3(base) (CAST(VUINT32 *) (base + 0x2FC118)) /* Base Reg bank 3 */ +#define OR3(base) (CAST(VUINT32 *) (base + 0x2FC11C)) /* Option Reg bank 3*/ + +#define DMBR(base) (CAST(VUINT32 *) (base + 0x2FC140)) /* Dual-Mapping Base reg*/ +#define DMOR(base) (CAST(VUINT32 *) (base + 0x2FC144)) /* Dual-Mapping Opt reg*/ +#define MSTAT(base) (CAST(VUINT16 *) (base + 0x2FC178)) /* Memory Status */ + +/* System Integration Timers */ + +#define TBSCR(base) (CAST(VUINT16 *) (base + 0x2FC200)) /* T.B. Status Ctrl */ +#define TBREFF0(base) (CAST(VUINT32 *) (base + 0x2FC204)) /* Time Base Ref 0 */ +#define TBREFF1(base) (CAST(VUINT32 *) (base + 0x2FC208)) /* Time Base Ref 1 */ + +#define RTCSC(base) (CAST(VUINT16 *) (base + 0x2FC220)) /* Clock Status Ctrl*/ +#define RTC(base) (CAST(VUINT32 *) (base + 0x2FC224)) /* RT Clock */ +#define RTSEC(base) (CAST(VUINT32 *) (base + 0x2FC228)) /* RT Alarm Seconds */ +#define RTCAL(base) (CAST(VUINT32 *) (base + 0x2FC22C)) /* Real Time Alarm */ + +#define PISCR(base) (CAST(VUINT16 *) (base + 0x2FC240)) /* PIT Status Ctrl */ +#define PITC(base) (CAST(VUINT32 *) (base + 0x2FC244)) /* PIT Count */ +#define PITR(base) (CAST(VUINT32 *) (base + 0x2FC248)) /* PIT */ + +/* Clock and Reset */ + +#define SCCR(base) (CAST(VUINT32 *) (base + 0x2FC280)) /* System Clock Ctrl*/ +#define PLPRCR(base) (CAST(VUINT32 *) (base + 0x2FC284)) /* PLL, LPower Reset*/ +#define RSR(base) (CAST(VUINT16 *) (base + 0x2FC288)) /* Reset Status Reg */ +#define COLIR(base) (CAST(VUINT16 *) (base + 0x2FC28C)) /* Chg of Lock Int reg*/ +#define VSRMCR(base) (CAST(VUINT16 *) (base + 0x2FC290)) /* VDDSRM Ctrl reg*/ + +/* System Integration Timers Keys */ + +#define TBSCRK(base) (CAST(VUINT32 *) (base + 0x2FC300)) /* TB Stat Ctrl key */ +#define TBREFF0K(base) (CAST(VUINT32 *) (base + 0x2FC304)) /* TB Ref 0 Key */ +#define TBREFF1K(base) (CAST(VUINT32 *) (base + 0x2FC308)) /* TB Ref 1 Key */ +#define TBK(base) (CAST(VUINT32 *) (base + 0x2FC30C)) /* TB & Dec Key */ + +#define RTCSCK(base) (CAST(VUINT32 *) (base + 0x2FC320)) /* RT Stat Ctrl Key */ +#define RTCK(base) (CAST(VUINT32 *) (base + 0x2FC324)) /* RT Clock Key */ +#define RTSECK(base) (CAST(VUINT32 *) (base + 0x2FC328)) /* RT Alarm Second */ +#define RTCALK(base) (CAST(VUINT32 *) (base + 0x2FC32C)) /* R T Alarm Key */ + +#define PISCRK(base) (CAST(VUINT32 *) (base + 0x2FC340)) /* PIT Stat Ctrl Key*/ +#define PITCK(base) (CAST(VUINT32 *) (base + 0x2FC344)) /* PIT Count Key */ + +/* Clock and Reset Keys */ + +#define SCCRK(base) (CAST(VUINT32 *) (base + 0x2FC380)) /* System Clk Ctrl */ +#define PLPRCRK(base) (CAST(VUINT32 *) (base + 0x2FC384)) /* Pll, LP&R Ctrl */ +#define RSRK(base) (CAST(VUINT32 *) (base + 0x2FC388)) /* Reset Status Key */ +#define UMCR(base) (CAST(VUINT32 *) (base + 0x307F80)) /* IMB Module Config */ + +/* + * SIU register bit definitions + */ + +/* SIU Module Configuration register bit definition (SIUMCR - 0x00) */ + +#define SIUMCR_EARB 0x80000000 /* External Abritation */ +#define SIUMCR_EARP 0x70000000 /* Extern Abri. Req. prior.*/ +#define SIUMCR_DSHW 0x00800000 /* Data Showcycles */ +#define SIUMCR_DBGC 0x00600000 /* Debug pins conf */ +#define SIUMCR_DBPC 0x00100000 /* Debug Port pins conf */ +#define SIUMCR_ATWC 0x00080000 /* Addr wrt type enable conf */ +#define SIUMCR_GPC 0x00060000 /* General pins conf */ +#define SIUMCR_DLK 0x00010000 /* Debug Register Lock */ +#define SIUMCR_SC 0x00006000 /* Single-chip select*/ +#define SIUMCR_RCTX 0x00001000 /* Reset conf/timer exp.*/ +#define SIUMCR_MLRC 0x00000C00 /* Multi-level reserv. ctrl*/ +#define SIUMCR_MTSC 0x00000010 /* Memory transfer start ctrl*/ + +/* System Portection Control register bit definition (SYPCR - 0x04) */ + +#define SYPCR_SWTC 0xffff0000 /* Software Watchdog Timer Count */ +#define SYPCR_BMT 0x0000ff00 /* Bus Monitor Timing */ +#define SYPCR_BME 0x00000080 /* Bus Monitor Enable */ +#define SYPCR_SWF 0x00000008 /* Software Watchdog Freeze */ +#define SYPCR_SWE 0x00000004 /* Software Watchdog Enable */ +#define SYPCR_SWRI 0x00000002 /* Software Watchdog Reset/Int Sel */ +#define SYPCR_SWP 0x00000001 /* Software Watchdog Prescale */ + +/* System Interrupt PENDing register bit definition (SIPEND - 0x10) */ + +#define SIPEND_IRQ0 0x80000000 /* Interrupt IRQ0 pending */ +#define SIPEND_LVL0 0x40000000 /* Interrupt LEVEL 0 pending */ +#define SIPEND_IRQ1 0x20000000 /* Interrupt IRQ1 pending */ +#define SIPEND_LVL1 0x10000000 /* Interrupt LEVEL 1 pending */ +#define SIPEND_IRQ2 0x08000000 /* Interrupt IRQ2 pending */ +#define SIPEND_LVL2 0x04000000 /* Interrupt LEVEL 2 pending */ +#define SIPEND_IRQ3 0x02000000 /* Interrupt IRQ3 pending */ +#define SIPEND_LVL3 0x01000000 /* Interrupt LEVEL 3 pending */ +#define SIPEND_IRQ4 0x00800000 /* Interrupt IRQ4 pending */ +#define SIPEND_LVL4 0x00400000 /* Interrupt LEVEL 4 pending */ +#define SIPEND_IRQ5 0x00200000 /* Interrupt IRQ5 pending */ +#define SIPEND_LVL5 0x00100000 /* Interrupt LEVEL 5 pending */ +#define SIPEND_IRQ6 0x00080000 /* Interrupt IRQ6 pending */ +#define SIPEND_LVL6 0x00040000 /* Interrupt LEVEL 6 pending */ +#define SIPEND_IRQ7 0x00020000 /* Interrupt IRQ7 pending */ +#define SIPEND_LVL7 0x00010000 /* Interrupt LEVEL 7 pending */ + +/* System Interrupt MASK register bit definition (SIMASK - 0x14) */ + +#define SIMASK_IRM0 0x80000000 /* Interrupt IRQ0 mask */ +#define SIMASK_LVM0 0x40000000 /* Interrupt LEVEL 0 mask */ +#define SIMASK_IRM1 0x20000000 /* Interrupt IRQ1 mask */ +#define SIMASK_LVM1 0x10000000 /* Interrupt LEVEL 1 mask */ +#define SIMASK_IRM2 0x08000000 /* Interrupt IRQ2 mask */ +#define SIMASK_LVM2 0x04000000 /* Interrupt LEVEL 2 mask */ +#define SIMASK_IRM3 0x02000000 /* Interrupt IRQ3 mask */ +#define SIMASK_LVM3 0x01000000 /* Interrupt LEVEL 3 mask */ +#define SIMASK_IRM4 0x00800000 /* Interrupt IRQ4 mask */ +#define SIMASK_LVM4 0x00400000 /* Interrupt LEVEL 4 mask */ +#define SIMASK_IRM5 0x00200000 /* Interrupt IRQ5 mask */ +#define SIMASK_LVM5 0x00100000 /* Interrupt LEVEL 5 mask */ +#define SIMASK_IRM6 0x00080000 /* Interrupt IRQ6 mask */ +#define SIMASK_LVM6 0x00040000 /* Interrupt LEVEL 6 mask */ +#define SIMASK_IRM7 0x00020000 /* Interrupt IRQ7 mask */ +#define SIMASK_LVM7 0x00010000 /* Interrupt LEVEL 7 mask */ +#define SIMASK_ALL 0xffff0000 /* All interrupt mask */ + +/* System Interrupt Edge Level mask register bit definition (SIEL - 0x1C) */ + +#define SIEL_ED0 0x80000000 /* Interrupt IRQ0 on falling Edge */ +#define SIEL_WM0 0x40000000 /* Interrupt IRQ0 Wake up Mask */ +#define SIEL_ED1 0x20000000 /* Interrupt IRQ1 on falling Edge */ +#define SIEL_WM1 0x10000000 /* Interrupt IRQ1 Wake up Mask */ +#define SIEL_ED2 0x08000000 /* Interrupt IRQ2 on falling Edge */ +#define SIEL_WM2 0x04000000 /* Interrupt IRQ2 Wake up Mask */ +#define SIEL_ED3 0x02000000 /* Interrupt IRQ3 on falling Edge */ +#define SIEL_WM3 0x01000000 /* Interrupt IRQ3 Wake up Mask */ +#define SIEL_ED4 0x00800000 /* Interrupt IRQ4 on falling Edge */ +#define SIEL_WM4 0x00400000 /* Interrupt IRQ4 Wake up Mask */ +#define SIEL_ED5 0x00200000 /* Interrupt IRQ5 on falling Edge */ +#define SIEL_WM5 0x00100000 /* Interrupt IRQ5 Wake up Mask */ +#define SIEL_ED6 0x00080000 /* Interrupt IRQ6 on falling Edge */ +#define SIEL_WM6 0x00040000 /* Interrupt IRQ6 Wake up Mask */ +#define SIEL_ED7 0x00020000 /* Interrupt IRQ7 on falling Edge */ +#define SIEL_WM7 0x00010000 /* Interrupt IRQ7 Wake up Mask */ + +/* Transfert Error Status register bit definition (TESR - 0x20) */ + +#define TESR_IEXT 0x00002000 /* Instr. External Transfer Error Ack */ +#define TESR_IBM 0x00001000 /* Instr. transfer Monitor Time-Out */ +#define TESR_DEXT 0x00000020 /* Data External Transfer Error Ack */ +#define TESR_DBM 0x00000010 /* Data transfer Monitor Time-Out */ + +/* Base Register bit definition (BRx - 0x100) */ + +#define BR_BA_MSK 0xffff8000 /* Base Address Mask */ +#define BR_AT_MSK 0x00007000 /* Address Type Mask */ +#define BR_PS_MSK 0x00000c00 /* Port Size Mask */ +#define BR_PS_8 0x00000400 /* 8 bit port size */ +#define BR_PS_16 0x00000800 /* 16 bit port size */ +#define BR_PS_32 0x00000000 /* 32 bit port size */ +#define BR_WP 0x00000100 /* Write Protect */ +#define BR_WEBS 0x00000020 /* Write-enable/byte-select. */ +#define BR_TBDIP 0x00000010 /* Toggle-burst data in progress. */ +#define BR_LBDIP 0x00000008 /* Late-burst-data-in-progress */ +#define BR_SETA 0x00000004 /* External transfer acknowledge */ +#define BR_BI 0x00000002 /* Burst inhibit */ +#define BR_V 0x00000001 /* Bank valid */ + +/* Option Register bit definition (ORx - 0x104) */ + +#define OR_AM_MSK 0xffff8000 /* Address Mask Mask */ +#define OR_ATM_MSK 0x00007000 /* Address Type Mask Mask */ +#define OR_CSNT_SAM 0x00000800 /* Chip Select Negation Time/ Start */ + /* Address Multiplex */ +#define OR_ACS_MSK 0x00000600 /* Address to Chip Select Setup mask */ +#define OR_ACS_DIV1 0x00000000 /* CS is output at the same time */ +#define OR_ACS_DIV4 0x00000400 /* CS is output 1/4 a clock later */ +#define OR_ACS_DIV2 0x00000600 /* CS is output 1/2 a clock later */ +#define OR_EHTR 0x00000100 /* Extended hold time on read */ +#define OR_SCY_MSK 0x000000f0 /* Cycle Lenght in Clocks */ +#define OR_SCY_0_CLK 0x00000000 /* 0 clock cycles wait states */ +#define OR_SCY_1_CLK 0x00000010 /* 1 clock cycles wait states */ +#define OR_SCY_2_CLK 0x00000020 /* 2 clock cycles wait states */ +#define OR_SCY_3_CLK 0x00000030 /* 3 clock cycles wait states */ +#define OR_SCY_4_CLK 0x00000040 /* 4 clock cycles wait states */ +#define OR_SCY_5_CLK 0x00000050 /* 5 clock cycles wait states */ +#define OR_SCY_6_CLK 0x00000060 /* 6 clock cycles wait states */ +#define OR_SCY_7_CLK 0x00000070 /* 7 clock cycles wait states */ +#define OR_SCY_8_CLK 0x00000080 /* 8 clock cycles wait states */ +#define OR_SCY_9_CLK 0x00000090 /* 9 clock cycles wait states */ +#define OR_SCY_10_CLK 0x000000a0 /* 10 clock cycles wait states */ +#define OR_SCY_11_CLK 0x000000b0 /* 11 clock cycles wait states */ +#define OR_SCY_12_CLK 0x000000c0 /* 12 clock cycles wait states */ +#define OR_SCY_13_CLK 0x000000d0 /* 13 clock cycles wait states */ +#define OR_SCY_14_CLK 0x000000e0 /* 14 clock cycles wait states */ +#define OR_SCY_15_CLK 0x000000f0 /* 15 clock cycles wait states */ +#define OR_BSCY_MSK 0x0000000e /* Burst beats length in clocks. */ +#define OR_BSCY_0_CLK 0x00000000 /* 0 clock cycle wait states */ +#define OR_BSCY_1_CLK 0x00000002 /* 1 clock cycle wait states */ +#define OR_BSCY_2_CLK 0x00000004 /* 2 clock cycle wait states */ +#define OR_BSCY_3_CLK 0x00000006 /* 3 clock cycle wait states */ +#define OR_TRLX 0x00000001 /* Timing Relaxed */ + +/* Memory STATus register bit definition (MSTAT - 0x178) */ + +#define MSTAT_WPER0 0x0080 /* Write Protection Error bank 0 */ +#define MSTAT_WPER1 0x0040 /* Write Protection Error bank 1 */ +#define MSTAT_WPER2 0x0020 /* Write Protection Error bank 2 */ +#define MSTAT_WPER3 0x0010 /* Write Protection Error bank 3 */ + +/* Time Base Status and Contol register bit definition (TBSCR - 0x200) */ + +#define TBSCR_TBIRQ_MSK 0xFF00 /* Time Base IRQ Mask */ +/* The following values were not verified */ +#define TBSCR_TBIRQ_0 0x0100 /* Time Base Interrupt Request LVL 0 */ +#define TBSCR_TBIRQ_1 0x0200 /* Time Base Interrupt Request LVL 1 */ +#define TBSCR_TBIRQ_2 0x0400 /* Time Base Interrupt Request LVL 2 */ +#define TBSCR_TBIRQ_3 0x0800 /* Time Base Interrupt Request LVL 3 */ +#define TBSCR_TBIRQ_4 0x1000 /* Time Base Interrupt Request LVL 4 */ +#define TBSCR_TBIRQ_5 0x2000 /* Time Base Interrupt Request LVL 5 */ +#define TBSCR_TBIRQ_6 0x4000 /* Time Base Interrupt Request LVL 6 */ +#define TBSCR_TBIRQ_7 0x8000 /* Time Base Interrupt Request LVL 7 */ + +#define TBSCR_REFA 0x0080 /* Reference Interrupt Status A */ +#define TBSCR_REFB 0x0040 /* Reference Interrupt Status B */ +#define TBSCR_REFAE 0x0008 /* Second Interrupt Enable A */ +#define TBSCR_REFBE 0x0004 /* Second Interrupt Enable B */ +#define TBSCR_TBF 0x0002 /* Time Base Freeze */ +#define TBSCR_TBE 0x0001 /* Time Base Enable */ + +/* Real Time Clock Status and Control register bit definition (RTCSC - 0x220) */ + +#define RTCSC_RTCIRQ_MSK 0xFF00 /* Real Time Clock IRQ Mask */ +#define RTCSC_RTCIRQ_0 0x0100 /* Real Time Clock IRQ LVL 0 */ +#define RTCSC_RTCIRQ_1 0x0200 /* Real Time Clock IRQ LVL 1 */ +#define RTCSC_RTCIRQ_2 0x0400 /* Real Time Clock IRQ LVL 2 */ +#define RTCSC_RTCIRQ_3 0x0800 /* Real Time Clock IRQ LVL 3 */ +#define RTCSC_RTCIRQ_4 0x1000 /* Real Time Clock IRQ LVL 4 */ +#define RTCSC_RTCIRQ_5 0x2000 /* Real Time Clock IRQ LVL 5 */ +#define RTCSC_RTCIRQ_6 0x4000 /* Real Time Clock IRQ LVL 6 */ +#define RTCSC_RTCIRQ_7 0x8000 /* Real Time Clock IRQ LVL 7 */ +#define RTCSC_SEC 0x0080 /* Once per Second interrupt */ +#define RTCSC_ALR 0x0040 /* Alarm interrupt */ +#define RTCSC_4M 0x0010 /* Real Time Clock at 4 MHz */ +#define RTCSC_SIE 0x0008 /* Second Interrupt Enable */ +#define RTCSC_ALE 0x0004 /* Alarm Interrupt Enable */ +#define RTCSC_RTF 0x0002 /* Real Time Clock Freeze */ +#define RTCSC_RTE 0x0001 /* Real Time Clock Enable */ + +/* PIT Status and Control Register bit definition (PISCR - 0x0240) */ + +#define PISCR_PIRQ_MSK 0xFF00 /* PIT IRQ Mask */ +#define PISCR_PIRQ_0 0x8000 /* PIT IRQ LVL 0 */ +#define PISCR_PIRQ_1 0x4000 /* PIT IRQ LVL 1 */ +#define PISCR_PIRQ_2 0x2000 /* PIT IRQ LVL 2 */ +#define PISCR_PIRQ_3 0x1000 /* PIT IRQ LVL 3 */ +#define PISCR_PIRQ_4 0x0800 /* PIT IRQ LVL 4 */ +#define PISCR_PIRQ_5 0x0400 /* PIT IRQ LVL 5 */ +#define PISCR_PIRQ_6 0x0200 /* PIT IRQ LVL 6 */ +#define PISCR_PIRQ_7 0x0100 /* PIT IRQ LVL 7 */ +#define PISCR_PS 0x0080 /* Periodic interrupt Status */ +#define PISCR_PIE 0x0004 /* Periodic Interrupt Enable */ +#define PISCR_PITF 0x0002 /* Periodic Interrupt Timer Freeze */ +#define PISCR_PTE 0x0001 /* Periodic Timer Enable */ + +/* System Clock Control Register bit definition (SCCR - 0x280) */ + +#define SCCR_DBCT 0x80000000 /* Disable backup clock for timers */ +#define SCCR_COM_MSK 0x60000000 /* Clock output mode */ +#define SCCR_DCSLR 0x10000000 /* Disable clock switching */ +#define SCCR_MFPDL 0x08000000 /* MF and pre-divider lock */ +#define SCCR_LPML 0x04000000 /* LPM lock */ +#define SCCR_TBS 0x02000000 /* Time base source */ +#define SCCR_RTDIV_MSK 0x01000000 /* RTC (and PIT) clock divider */ +#define SCCR_STBUC 0x00800000 /* Switch to backup clock control */ +#define SCCR_PRQEN 0x00200000 /* Power management request enable */ +#define SCCR_RTSEL 0x00100000 /* RTC circuit input source select */ +#define SCCR_BUCS 0x00080000 /* Backup clock status */ +#define SCCR_EBDF_MSK 0x00060000 /* External bus division factor */ +#define SCCR_LME 0x00010000 /* Limp mode enable */ +#define SCCR_EECLK_MSK 0x0000c000 /* Enable engineering clock */ +#define SCCR_ENGDIV_MSK 0x00003f00 /* Engineering clock division factor */ +#define SCCR_DFNL_MSK 0x00000070 /* Division factor low frequency */ +#define SCCR_DFNH_MSK 0x00000007 /* Division factor high frequency */ + +/* Pll, Low Power and Reset Control Register bit definition (PLPRCR - 284) */ + +#define PLPRCR_MF_MSK 0xfff00000 /* Multiplication factor bits */ +#define PLPRCR_MF_SHIFT 0x00000014 /* Multiplication factor shift value */ +#define PLPRCR_LOCS 0x00040000 /* Loss of clock status */ +#define PLPRCR_LOCSS 0x00020000 /* Loss of clock sticky */ +#define PLPRCR_SPLS 0x00010000 /* System PLL lock status */ + +#define PLPRCR_SPLSS 0x00008000 /* SPLL Lock Status Sticky bit */ +#define PLPRCR_TEXPS 0x00004000 /* TEXP Status */ +#define PLPRCR_TMIST 0x00001000 /* Timers Interrupt Status */ +#define PLPRCR_CSRC 0x00000400 /* Clock Source */ +#define PLPRCR_LPM_MSK 0x00000300 /* Low Power Mode mask */ +#define PLPRCR_LPM_NORMAL 0x00000000 /* normal power management mode */ +#define PLPRCR_LPM_DOZE 0x00000100 /* doze power management mode */ +#define PLPRCR_LPM_SLEEP 0x00000200 /* sleep power management mode */ +#define PLPRCR_LPM_DEEP_SLEEP 0x00000300 /* deep sleep power mgt mode */ +#define PLPRCR_LPM_DOWN 0x00000300 /* down power management mode */ +#define PLPRCR_CSR 0x00000080 /* CheskStop Reset value */ +#define PLPRCR_LOLRE 0x00000040 /* Loss Of Lock Reset Enable */ +#define PLPRCR_DIVF_MSK 0x0000001F /* pre-divider in the SPLL circuit */ + +/* BBC module config register */ +#define BBCMCR_BE 0x00002000 /* burst enable */ +#define BBCMCR_ETRE 0x00001000 /* exception relocation enable */ +#define BBCMCR_OERC 0x00000800 /* other exception relocation control */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCppc555Siuh */ diff --git a/h/drv/multi/ppc860Cpm.h b/h/drv/multi/ppc860Cpm.h new file mode 100644 index 0000000..842485a --- /dev/null +++ b/h/drv/multi/ppc860Cpm.h @@ -0,0 +1,1036 @@ +/* ppc860Cpm.h - Motorola PPC860 Communication Processor Module header file */ + +/* Copyright 1984-1998 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,11jan99,cn Corrected/added defines for CP commands (SPR# 20337), + added qualifier volatile where needed (SPR# 24295). +01f,09nov98,cn Added support for Fast Ethernet Controller. +01e,20apr98,map fixed SIMODE definitions [SPR# 20157] +01d,13apr98,map added more SCC definitions. +01c,25mar98,map added SCC, PIP, I2C, CPCR, definitions. +01b,09may96,dzb added CPM_CR_... flags for the CPM command register. +01a,24apr96,tpr created. +*/ + +/* + * This file contains constants of the Communication Processor Unit (SIU) for + * the Motorola MPC860 PowerPC microcontroller. + */ + +#ifndef __INCppc860Cpmh +#define __INCppc860Cpmh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* device and channel structures */ + +/* + * The PPC860SMC_CHAN structure defines a serial I/O channel which + * describes the (TBD) registers for a given channel. + * Also the various SIO driver functions ( ioctl, txStarup, callbackInstall, + * pollInput, polloutput ) that this channel could utilize are declared + * here. + */ + +#ifdef _ASMLANGUAGE +# define SMC_ADRS(reg) (MPC860SMC1_BASE + (reg * MPC860SMC1_REG_OFFSET)) +#else +# define SMC_ADRS(reg) ((VCHAR *)MPC860SMC1_BASE+(reg*MPC860SMC1_REG_OFFSET)) +#endif /* _ASMLANGUAGE */ + +/* SIO -- mpc860 serial channel chip -- register definitions */ + +/* Buffer Descriptor Pointer Definitions */ + +/* Receive BD status bits 16-bit value */ + +#define BD_RX_EMPTY_BIT 0x8000 /* buffer is empty */ +#define BD_RX_WRAP_BIT 0x2000 /* last BD in chain */ +#define BD_RX_INTERRUPT_BIT 0x1000 /* set interrupt when filled */ +#define BD_RX_CON_MODE_BIT 0x0200 /* Continuous Mode bit */ +#define BD_RX_IDLE_CLOSE_BIT 0x0100 /* Close on IDLE recv bit */ +#define BD_RX_BREAK_CLOSE_BIT 0x0020 /* Close on break recv bit */ +#define BD_RX_FRAME_CLOSE_BIT 0x0010 /* Close on frame error bit */ +#define BD_RX_PARITY_ERROR_BIT 0x0008 /* Parity error in last byte */ +#define BD_RX_OVERRUN_ERROR_BIT 0x0002 /* Overrun occurred */ + +/* Transmit BD status bits 16-bit value */ + +#define BD_TX_READY_BIT 0x8000 /* Transmit ready/busy bit */ +#define BD_TX_WRAP_BIT 0x2000 /* last BD in chain */ +#define BD_TX_INTERRUPT_BIT 0x1000 /* set interrupt when emptied */ +#define BD_TX_CON_MODE_BIT 0x0200 /* Continuous Mode bit */ +#define BD_TX_PREABMLE_BIT 0x0100 /* send preamble sequence */ + +#define BD_STATUS_OFFSET 0x00 /* two bytes */ +#define BD_DATA_LENGTH_OFFSET 0x02 /* two bytes */ +#define BD_BUF_POINTER_OFFSET 0x04 /* four bytes */ + +/* SDMA Configuraton Register bit definition (SDCR - 0x30) */ + +#define SDCR_FRZ_MSK 0x00006000 /* Freeze mask */ +#define SDCR_RAID_MSK 0x00000003 /* Risc Controller Arbitration ID */ +#define SDCR_FAID_MSK 0x0000000c /* FEC Arbitration ID mask */ +#define SDCR_FAM_EN 0x00000040 /* FEC Agressive Mode Enable */ +#define SDCR_FAID_BR6 0x00000000 /* FEC Arbitration ID U-Bus priority 6*/ +#define SDCR_FAID_BR5 0x00000004 /* FEC Arbitration ID U-Bus priority 5*/ +#define SDCR_FAID_BR2 0x00000008 /* FEC Arbitration ID U-Bus priority 2*/ +#define SDCR_FAID_BR1 0x0000000c /* FEC Arbitration ID U-Bus priority 1*/ +#define SDCR_RAID_BR6 0x00000000 /* U-BUS arbitration priority 6 (BR6) */ +#define SDCR_RAID_BR5 0x00000001 /* U-BUS arbitration priority 5 (BR5) */ +#define SDCR_RAID_BR2 0x00000002 /* U-BUS arbitration priority 2 (BR2) */ +#define SDCR_RAID_BR1 0x00000003 /* U-BUS arbitration priority 1 (BR1) */ + +/* SDMA Status Register bit definition (SDSR - 0x908) */ + +#define SDSR_SBER 0x80 /* Channel Bus Error */ +#define SDSR_RINT 0x40 /* Reserved Interrupt */ +#define SDSR_DSP2 0x02 /* DSP chain interrupt 2 */ +#define SDSR_DSP1 0x01 /* DSP chain interrupt 1 */ + +/* IDMA Status Register bit definition (IDSR - 0x910) */ + +#define IDSR_OB 0x04 /* Out of Buffer */ +#define IDSR_DONE 0x02 /* IDMA transfert Done */ +#define IDSR_AD 0x01 /* Auxiliry Done */ + +/* Timer Global Configuration Register bit definition (TGCR - 0x980) */ + +#define TGCR_CAS4 0x8000 /* Cascade Timer 3 and 4 */ +#define TGCR_FRZ4 0x4000 /* Freeze timer 4 */ +#define TGCR_STP4 0x2000 /* Stop timer 4 */ +#define TGCR_RST4 0x1000 /* Reset timer 4 */ +#define TGCR_GM2 0x0800 /* Gate Mode for Pin 2 */ +#define TGCR_FRZ3 0x0400 /* Freeze timer 3 */ +#define TGCR_STP3 0x0200 /* Stop timer 3 */ +#define TGCR_RST3 0x0100 /* Reset timer 3 */ +#define TGCR_CAS2 0x0080 /* Cascade Timer 1 and 2 */ +#define TGCR_FRZ2 0x0040 /* Freeze timer 2 */ +#define TGCR_STP2 0x0020 /* Stop timer 2 */ +#define TGCR_RST2 0x0010 /* Reset timer 2 */ +#define TGCR_GM1 0x0008 /* Gate Mode for Pin 1 */ +#define TGCR_FRZ1 0x0004 /* Freeze timer 1 */ +#define TGCR_STP1 0x0002 /* Stop timer 1 */ +#define TGCR_RST1 0x0001 /* Reset timer 1 */ + +/* Timer Mode Register bit definition (TMRx - 0x990) */ + +#define TMR_PS_MSK 0xff00 /* Prescaler Value */ +#define TMR_CE_MSK 0x00c0 /* Capture Edge and Enable Interrupt */ +#define TMR_CE_INTR_DIS 0x0000 /* Disable Interrupt on capture event */ +#define TMR_CE_RISING 0x0040 /* Capture on Rising TINx edge only */ +#define TMR_CE_FALLING 0x0080 /* Capture on Falling TINx edge only */ +#define TMR_CE_ANY 0x00c0 /* Capture on any TINx edge */ +#define TMR_OM 0x0020 /* Output Mode */ +#define TMR_ORI 0x0010 /* Output Reference Interrupt Enable */ +#define TMR_FRR 0x0008 /* Free Run/Restart */ +#define TMR_ICLK_MSK 0x0006 /* Timer Input Clock Source mask */ +#define TMR_ICLK_IN_CAS 0x0000 /* Internally cascaded input */ +#define TMR_ICLK_IN_GEN 0x0002 /* Internal General system clock */ +#define TMR_ICLK_IN_GEN_DIV16 0x0004 /* Internal General system clk div 16 */ +#define TMR_ICLK_TIN_PIN 0x0006 /* TINx pin */ +#define TMR_GE 0x0001 /* Gate Enable */ + +/* Timer Event Register bit definition (TERx - 0x9B0) */ + +#define TER_REF 0x0002 /* Output Reference Event */ +#define TER_CAP 0x0001 /* Capture Event */ + +/* BDG Configuratioon REgister bit definition (BRGC - 0x9F0) */ + +#define BRGC_RST 0x20000 /* Reset BRG */ +#define BRGC_EN 0x10000 /* Enable BRG count */ +#define BRGC_EXTC_MSK 0x08000 /* External Clock Source Mask */ +#define BRGC_EXTC_BRGCLK 0x00000 /* Baud Rate Gen clock source */ +#define BRGC_EXTC_CLK2 0x04000 /* CLK2 pin = BRG source */ +#define BRGC_EXTC_CLK6 0x08000 /* CLK6 pin = BRG source */ +#define BRGC_ATB 0x02000 /* 1 = Autobaud on Rx */ + /* 0 = normal operation */ +#define BRGC_CD_MSK 0x01FFE /* clock divider 12 bit value */ +#define BRGC_CD_SHIFT 0x1 /* shifted up one bit */ +#define BRGC_DIV16 0x00001 /* BRG Clock divide by 16 */ + +/* UART Mode Register bit definition (PSMR - 0x0A08) */ + +#define PSMR_FLC 0x8000 /* Flow Control */ +#define PSMR_SL 0x4000 /* Stop Length */ +#define PSMR_CL_MSK 0x3000 /* Character Length Mask */ +#define PSMR_CL_5_BITS 0x0000 /* Character Length: 5 bits */ +#define PSMR_CL_6_BITS 0x1000 /* Character Length: 6 bits */ +#define PSMR_CL_7_BITS 0x2000 /* Character Length: 7 bits */ +#define PSMR_CL_8_BITS 0x3000 /* Character Length: 8 bits */ +#define PSMR_UM_MSK 0x0c00 /* UART Mode Mask */ +#define PSMR_UM_NORMAL 0x0000 /* UART Mode: normal */ +#define PSMR_UM_NON_AUTO 0x0400 /* UART Mode: multidrop non-automatic */ +#define PSMR_UM_AUTO 0x0c00 /* UART Mode: multidrop automatic */ +#define PSMR_FRZ 0x0200 /* Freeze Transmission */ +#define PSMR_RZS 0x0100 /* Receive Zero Stop bits */ +#define PSMR_SYN 0x0080 /* Synchronous Mode */ +#define PSMR_DRT 0x0040 /* Disable Receiver While Transmitting*/ +#define PSMR_PEN 0x0010 /* Parity Enable */ +#define PSMR_RPN_MSK 0x000c /* Receiver Parity Mode Mask */ +#define PSMR_RPN_ODD 0x0000 /* Receiver Parity Mode: Odd parity */ +#define PSMR_RPN_LOW 0x0004 /* Receiver Parity Mode: Low parity */ +#define PSMR_RPN_EVEN 0x0008 /* Receiver Parity Mode: Even parity */ +#define PSMR_RPN_HIGH 0x000c /* Receiver Parity Mode: High parity */ +#define PSMR_TPN_MSK 0x0003 /* Transmitter Parity Mode Mask */ +#define PSMR_TPN_ODD 0x0000 /* Transmit Parity Mode: Odd parity */ +#define PSMR_TPN_LOW 0x0001 /* Transmit Parity Mode: Low parity */ +#define PSMR_TPN_EVEN 0x0002 /* Transmit Parity Mode: Even parity */ +#define PSMR_TPN_HIGH 0x0003 /* Transmit Parity Mode: High parity */ + +/* CPM - Communication Processor Module */ + +/* Command Register definitions (CPCR - 0x9C0) */ + +#define CPM_CR_FLG 0x0001 /* flag - command executing */ +#define CPM_CR_RESET 0x8000 /* software reset command */ +#define CPM_CR_OPCODE 0x0f00 /* command opcode */ +#define CPM_CR_CHAN(x) (((x) & 0x000f) << 4) +#define CPM_CR_OP(x) (((x) & 0x000f) << 8) + +/* CPCR - Channel Numbers */ + +#define CPM_CR_CHANNEL_SCC1 CPM_CR_CHAN(0x0) /* SCC1 channel */ +#define CPM_CR_CHANNEL_I2C CPM_CR_CHAN(0x1) /* I2C channel */ +#define CPM_CR_CHANNEL_SCC2 CPM_CR_CHAN(0x4) /* SCC2 channel */ +#define CPM_CR_CHANNEL_SPI CPM_CR_CHAN(0x5) /* SPI channel */ +#define CPM_CR_CHANNEL_RTMR CPM_CR_CHAN(0x5) /* RISC timer channel */ +#define CPM_CR_CHANNEL_SCC3 CPM_CR_CHAN(0x8) /* SCC3 channel */ +#define CPM_CR_CHANNEL_SMC1 CPM_CR_CHAN(0x9) /* SMC1 channel */ +#define CPM_CR_CHANNEL_IDMA1 CPM_CR_CHAN(0x1) /* IDMA1 channel */ +#define CPM_CR_CHANNEL_SCC4 CPM_CR_CHAN(0xc) /* SCC4 channel */ +#define CPM_CR_CHANNEL_SMC2 CPM_CR_CHAN(0xd) /* SMC2 channel */ +#define CPM_CR_CHANNEL_PIP CPM_CR_CHAN(0xd) /* PIP channel */ +#define CPM_CR_CHANNEL_IDMA2 CPM_CR_CHAN(0x5) /* IDMA2 channel */ +#define CPM_CR_CHANNEL_DSP1 CPM_CR_CHAN(0x9) /* DSP1 channel */ +#define CPM_CR_CHANNEL_DSP2 CPM_CR_CHAN(0xd) /* DSP2 channel */ + +/* CPCR - opcodes */ + +#define CPM_CR_OPCODE_INIT_RT CPM_CR_OP(0x0) /* Init rx and tx */ +#define CPM_CR_OPCODE_INIT_R CPM_CR_OP(0x1) /* init rx only */ +#define CPM_CR_OPCODE_INIT_T CPM_CR_OP(0x2) /* init tx only */ +#define CPM_CR_OPCODE_HUNT CPM_CR_OP(0x3) /* rx frame hunt mode */ +#define CPM_CR_OPCODE_STOP CPM_CR_OP(0x4) /* stop tx */ +#define CPM_CR_OPCODE_GRSTOP CPM_CR_OP(0x5) /* gracefully stop tx */ +#define CPM_CR_OPCODE_IDMA_INIT CPM_CR_OP(0x5) /* init idma */ +#define CPM_CR_OPCODE_RESTART CPM_CR_OP(0x6) /* restart tx */ +#define CPM_CR_OPCODE_CLOSE CPM_CR_OP(0x7) /* close rx buffer */ +#define CPM_CR_OPCODE_SET_GROUP CPM_CR_OP(0x8) /* set group address */ +#define CPM_CR_OPCODE_SET_ITMR CPM_CR_OP(0x8) /* set itimer */ +#define CPM_CR_OPCODE_GCI_TMO CPM_CR_OP(0x9) /* gci timeout */ +#define CPM_CR_OPCODE_RESET_BCS CPM_CR_OP(0xa) /* blk chk seq reset */ +#define CPM_CR_OPCODE_GCI_ABRT CPM_CR_OP(0xa) /* gci abort request */ +#define CPM_CR_OPCODE_IDMA_STOP CPM_CR_OP(0xb) /* stop idma */ +#define CPM_CR_OPCODE_DSP_START CPM_CR_OP(0xc) /* start DSP */ +#define CPM_CR_OPCODE_DSP_INIT CPM_CR_OP(0xd) /* init DSP */ + +#define CPM_CR_SCC_INIT_RT CPM_CR_OPCODE_INIT_RT /* rx and tx init */ +#define CPM_CR_SCC_INIT_R CPM_CR_OPCODE_INIT_R /* init rx only */ +#define CPM_CR_SCC_INIT_T CPM_CR_OPCODE_INIT_T /* init tx only */ +#define CPM_CR_SCC_HUNT CPM_CR_OPCODE_HUNT /* rx frm hunt mode */ +#define CPM_CR_SCC_STOP CPM_CR_OPCODE_STOP /* stop tx */ +#define CPM_CR_SCC_GRSTOP CPM_CR_OPCODE_GRSTOP /* graceful stop tx */ +#define CPM_CR_SCC_RESTART CPM_CR_OPCODE_RESTART /* restart tx */ +#define CPM_CR_SCC_CLOSE CPM_CR_OPCODE_CLOSE /* close rx buffer */ +#define CPM_CR_SCC_SET_GROUP CPM_CR_OPCODE_SET_GROUP /* set group adrs */ +#define CPM_CR_SCC_RESET_BCS CPM_CR_OPCODE_RESET_BCS /* reset BCS */ + +#define CPM_CR_SMC_INIT_RT CPM_CR_OPCODE_INIT_RT /* rx and tx init */ +#define CPM_CR_SMC_INIT_R CPM_CR_OPCODE_INIT_R /* init rx only */ +#define CPM_CR_SMC_INIT_T CPM_CR_OPCODE_INIT_T /* init tx only */ +#define CPM_CR_SMC_HUNT CPM_CR_OPCODE_HUNT /* rx frm hunt mode */ +#define CPM_CR_SMC_STOP CPM_CR_OPCODE_STOP /* stop tx */ +#define CPM_CR_SMC_RESTART CPM_CR_OPCODE_RESTART /* restart tx */ +#define CPM_CR_SMC_CLOSE CPM_CR_OPCODE_CLOSE /* close rx buffer */ + +#define CPM_CR_SMC_GCI_INIT_RT CPM_CR_OPCODE_INIT_RT /* rx and tx init */ +#define CPM_CR_SMC_GCI_TMO CPM_CR_OPCODE_GCI_TMO /* GCI timeout */ +#define CPM_CR_SMC_GCI_ABORT CPM_CR_OPCODE_GCI_ABRT /* GCI abort */ + +#define CPM_CR_SPI_INIT_RT CPM_CR_OPCODE_INIT_RT /* rx and tx init */ +#define CPM_CR_SPI_INIT_R CPM_CR_OPCODE_INIT_R /* init rx only */ +#define CPM_CR_SPI_INIT_T CPM_CR_OPCODE_INIT_T /* init tx only */ +#define CPM_CR_SPI_CLOSE CPM_CR_OPCODE_CLOSE /* close rx buffer */ + +#define CPM_CR_I2C_INIT_RT CPM_CR_OPCODE_INIT_RT /* rx and tx init */ +#define CPM_CR_I2C_INIT_R CPM_CR_OPCODE_INIT_R /* init rx only */ +#define CPM_CR_I2C_INIT_T CPM_CR_OPCODE_INIT_T /* init tx only */ +#define CPM_CR_I2C_CLOSE CPM_CR_OPCODE_CLOSE /* close rx buffer */ + +#define CPM_CR_IDMA_INIT CPM_CR_OPCODE_IDMA_INIT /* IDMA init */ +#define CPM_CR_IDMA_STOP CPM_CR_OPCODE_IDMA_STOP /* IDMA stop */ + +#define CPM_CR_DSP_START CPM_CR_OPCODE_DSP_START /* DSP start */ +#define CPM_CR_DSP_INIT CPM_CR_OPCODE_DSP_INIT /* DSP init */ + +#define CPM_CR_TIMER_SET CPM_CR_OPCODE_SET_ITMR /* TIMER set */ + +/* UART Even Register bit definition (SCCE - 0x0A10) */ + +#define SCCE_GLR 0x1000 /* Glitch on Receiver */ +#define SCCE_GLT 0x0800 /* Glitch on Transmitter */ +#define SCCE_AB 0x0200 /* Auto Baud */ +#define SCCE_IDL 0x0100 /* Idle Sequence Status Changed */ +#define SCCE_GRA 0x0080 /* Graceful stop complete */ +#define SCCE_BRKE 0x0040 /* Break End */ +#define SCCE_BRKS 0x0020 /* Break Start */ +#define SCCE_CCR 0x0008 /* Control Character Received */ +#define SCCE_BSY 0x0004 /* Busy Condition */ +#define SCCE_TX 0x0002 /* Transmitter Buffer */ +#define SCCE_RX 0x0001 /* Receiver Buffer */ + +/* SCC Status Register bit definition (SCCS - 0x0A17) */ + +#define SCCS_ID 0x01 /* Idle Status */ + +/* SI Mode Register bit definition (SIMODE - 0xAE0) */ + +#define SIMODE_SMC2_MUX 0x80000000 /* connected to mux SI */ +#define SIMODE_SMC2_NMSI 0x00000000 /* NMSI mode */ +#define SIMODE_SMC2CS_BRG1 0x00000000 /* BRG1 is clock source */ +#define SIMODE_SMC2CS_BRG2 0x10000000 /* BRG2 is clock source */ +#define SIMODE_SMC2CS_BRG3 0x20000000 /* BRG3 is clock source */ +#define SIMODE_SMC2CS_BRG4 0x30000000 /* BRG4 is clock source */ +#define SIMODE_SMC2CS_CLK5 0x40000000 /* CLK5 is clock source */ +#define SIMODE_SMC2CS_CLK6 0x50000000 /* CLK6 is clock source */ +#define SIMODE_SMC2CS_CLK7 0x60000000 /* CLK7 is clock source */ +#define SIMODE_SMC2CS_CLK8 0x70000000 /* CLK8 is clock source */ +#define SIMODE_SDMB_MSK 0x0c000000 /* SI Diagnostic Mode - TDM B */ +#define SIMODE_SDMB_NORM 0x00000000 /* Diag Mode-normal operation */ +#define SIMODE_SDMB_ECHO 0x04000000 /* Diag Mode-auto echo */ +#define SIMODE_SDMB_LOOP 0x08000000 /* Diag Mode-internal loopback*/ +#define SIMODE_SDMB_LCTR 0x0C000000 /* Diag Mode-loopback control */ +#define SIMODE_RFSDB_MSK 0x03000000 /* Receive Frame Delay TDM B */ +#define SIMODE_RFSDB_NO_DELAY 0x00000000 /* Receive Delay - No Delay */ +#define SIMODE_RFSDB_1BIT 0x01000000 /* Receive Delay - 1bit delay */ +#define SIMODE_RFSDB_2BIT 0x02000000 /* Receive Delay - 2bit delay */ +#define SIMODE_RFSDB_3BIT 0x03000000 /* Receive Delay - 3bit delay */ +#define SIMODE_DSCB 0x00800000 /* Double Speed Clocl TDM B */ +#define SIMODE_CRTB 0x00400000 /* Common Rcv and Trans. pins */ +#define SIMODE_STZB 0x00200000 /* Set L1TxDx to Zero TDM B */ +#define SIMODE_CEB_FALLING 0x00000000 /* Clock Edge - falling */ +#define SIMODE_CEB_RISING 0x00100000 /* Clock Edge - rising */ +#define SIMODE_FEB_FALLING 0x00000000 /* Frame Sync Edge - falling */ +#define SIMODE_FEB_RISING 0x00080000 /* Frame Sync Edge - rising */ +#define SIMODE_GMB_GCI_SCIT 0x00000000 /* Grant Mode - GCI/SCIT */ +#define SIMODE_GMB_IDL 0x00040000 /* Grant Mode - idle */ +#define SIMODE_TFSDB_MSK 0x00030000 /* Transmit Frame Sync Delay */ +#define SIMODE_TFSDB_NO_DELAY 0x00000000 /* Transmit Delay - No Delay */ +#define SIMODE_TFSDB_1BIT 0x00010000 /* Transmit Delay - 1bit */ +#define SIMODE_TFSDB_2BIT 0x00020000 /* Transmit Delay - 2bit */ +#define SIMODE_TFSDB_3BIT 0x00030000 /* Transmit Delay - 3bit */ + + +#define SIMODE_SMC1_MUX 0x00008000 /* connected to mux SI */ +#define SIMODE_SMC1_NMSI 0x00000000 /* NMSI mode */ +#define SIMODE_SMC1CS_BRG1 0x00000000 /* BRG1 is clock source */ +#define SIMODE_SMC1CS_BRG2 0x00001000 /* BRG2 is clock source */ +#define SIMODE_SMC1CS_BRG3 0x00002000 /* BRG3 is clock source */ +#define SIMODE_SMC1CS_BRG4 0x00003000 /* BRG4 is clock source */ +#define SIMODE_SMC1CS_CLK1 0x00004000 /* CLK1 is clock source */ +#define SIMODE_SMC1CS_CLK2 0x00005000 /* CLK2 is clock source */ +#define SIMODE_SMC1CS_CLK3 0x00006000 /* CLK3 is clock source */ +#define SIMODE_SMC1CS_CLK4 0x00007000 /* CLK4 is clock source */ +#define SIMODE_SDMA_MSK 0x00000c00 /* SI Diagnostic Mode - TDM B */ +#define SIMODE_SDMA_NORM 0x00000000 /* Diag Mode-normal operation */ +#define SIMODE_SDMA_ECHO 0x00000400 /* Diag Mode-auto echo */ +#define SIMODE_SDMA_LOOP 0x00000800 /* Diag Mode-internal loopback*/ +#define SIMODE_SDMA_LCTR 0x00000C00 /* Diag Mode-loopback control */ +#define SIMODE_RFSDA_MSK 0x00000300 /* Receive Frame Delay TDM A */ +#define SIMODE_RFSDA_NO_DELAY 0x00000000 /* Receive Delay - No Delay */ +#define SIMODE_RFSDA_1BIT_DELAY 0x00000100 /* Receive Delay - 1bit delay */ +#define SIMODE_RFSDA_2BIT_DELAY 0x00000200 /* Receive Delay - 2bit delay */ +#define SIMODE_RFSDA_3BIT_DELAY 0x00000300 /* Receive Delay - 3bit delay */ +#define SIMODE_DSCA 0x00000080 /* Double Speed Clocl TDM A */ +#define SIMODE_CRTA 0x00000040 /* Common Rcv and Trans. pins */ +#define SIMODE_STZA 0x00000020 /* Set L1TxDx to Zero TDM A */ +#define SIMODE_CEA_FALLING 0x00000000 /* Clock Edge - falling */ +#define SIMODE_CEA_RISING 0x00000010 /* Clock Edge - rising */ +#define SIMODE_FEA_FALLING 0x00000000 /* Frame Sync Edge - falling */ +#define SIMODE_FEA_RISING 0x00000008 /* Frame Sync Edge - rising */ +#define SIMODE_GMA_GCI_SCIT 0x00000000 /* Grant Mode - GCI/SCIT */ +#define SIMODE_GMA_IDL 0x00000004 /* Grant Mode - idle */ +#define SIMODE_TFSDA_MSK 0x00000003 /* Transmit Frame Sync Delay */ +#define SIMODE_TFSDA_NO_DELAY 0x00000000 /* Transmit Delay - No Delay */ +#define SIMODE_TFSDA_1BIT 0x00000001 /* Transmit Delay - 1bit */ +#define SIMODE_TFSDA_2BIT 0x00000002 /* Transmit Delay - 2bit */ +#define SIMODE_TFSDA_3BIT 0x00000003 /* Transmit Delay - 3bit */ + +/* SI Global Mode Register bit definition (SIGMR - 0xAE4) */ + +#define SIGMR_ENB 0x08 /* Enable Channel B */ +#define SIGMR_ENA 0x04 /* Enable Channel A */ +#define SIGMR_RDM_MSK 0x03 /* Ram Division Mode mask */ + +/* SI Status Register bit definition (SISTR - 0xAE6) */ + +#define SISTR_CRORA 0x80 /* Current Route of TDM A Receiver */ +#define SISTR_CROTA 0x40 /* Current Route of TDM A Transmitter */ +#define SISTR_CRORB 0x20 /* Current Route of TDM B Receiver */ +#define SISTR_CROTB 0x10 /* Current Route of TDM B Transmitter */ + +/* SI Command Register bit definition (SICMR - 0xAE7) */ + +#define SICMR_CSRRA 0x80 /* Change Shadow RAM - TDM A Receiver */ +#define SICMR_CSRTA 0x40 /* Change Shadow RAM - TDM A Transmit */ +#define SICMR_CSRRB 0x20 /* Change Shadow RAM - TDM B Receiver */ +#define SICMR_CSRTB 0x10 /* Change Shadow RAM - TDM B Transmit */ + +/* SI Clock Route Register bit definition (SICR - 0xAEC) */ + +#define SICR_GR4 0x80000000 /* Grant Support of SCC4 */ +#define SICR_SC4_MUX 0x40000000 /* SCC4 Connection - mux SI */ +#define SICR_R4CS_MSK 0x38000000 /* SCC4 Receive Clock Source */ +#define SICR_R4CS_BRG1 0x00000000 /* BRG1 clock source */ +#define SICR_R4CS_BRG2 0x08000000 /* BRG2 clock source */ +#define SICR_R4CS_BRG3 0x10000000 /* BRG3 clock source */ +#define SICR_R4CS_BRG4 0x18000000 /* BRG4 clock source */ +#define SICR_R4CS_CLK5 0x20000000 /* CLK5 clock source */ +#define SICR_R4CS_CLK6 0x28000000 /* CLK6 clock source */ +#define SICR_R4CS_CLK7 0x30000000 /* CLK7 clock source */ +#define SICR_R4CS_CLK8 0x38000000 /* CLK8 clock source */ +#define SICR_T4CS_MSK 0x07000000 /* SCC4 Transmit Clock Source */ +#define SICR_T4CS_BRG1 0x00000000 /* BRG1 clock source */ +#define SICR_T4CS_BRG2 0x01000000 /* BRG2 clock source */ +#define SICR_T4CS_BRG3 0x02000000 /* BRG3 clock source */ +#define SICR_T4CS_BRG4 0x03000000 /* BRG4 clock source */ +#define SICR_T4CS_CLK5 0x04000000 /* CLK5 clock source */ +#define SICR_T4CS_CLK6 0x05000000 /* CLK6 clock source */ +#define SICR_T4CS_CLK7 0x06000000 /* CLK7 clock source */ +#define SICR_T4CS_CLK8 0x07000000 /* CLK8 clock source */ + +#define SICR_GR3 0x00800000 /* Grant Support of SCC3 */ +#define SICR_SC3_MUX 0x00400000 /* SCC3 Connection - mux SI */ +#define SICR_R3CS_MSK 0x00380000 /* SCC3 Receive Clock Source */ +#define SICR_R3CS_BRG1 0x00000000 /* BRG1 clock source */ +#define SICR_R3CS_BRG2 0x00080000 /* BRG2 clock source */ +#define SICR_R3CS_BRG3 0x00100000 /* BRG3 clock source */ +#define SICR_R3CS_BRG4 0x00180000 /* BRG4 clock source */ +#define SICR_R3CS_CLK5 0x00200000 /* CLK5 clock source */ +#define SICR_R3CS_CLK6 0x00280000 /* CLK6 clock source */ +#define SICR_R3CS_CLK7 0x00300000 /* CLK7 clock source */ +#define SICR_R3CS_CLK8 0x00380000 /* CLK8 clock source */ +#define SICR_T3CS_MSK 0x00070000 /* SCC3 Transmit Clock Source */ +#define SICR_T3CS_BRG1 0x00000000 /* BRG1 clock source */ +#define SICR_T3CS_BRG2 0x00010000 /* BRG2 clock source */ +#define SICR_T3CS_BRG3 0x00020000 /* BRG3 clock source */ +#define SICR_T3CS_BRG4 0x00030000 /* BRG4 clock source */ +#define SICR_T3CS_CLK5 0x00040000 /* CLK5 clock source */ +#define SICR_T3CS_CLK6 0x00050000 /* CLK6 clock source */ +#define SICR_T3CS_CLK7 0x00060000 /* CLK7 clock source */ +#define SICR_T3CS_CLK8 0x00070000 /* CLK8 clock source */ + +#define SICR_GR2 0x00008000 /* Grant Support of SCC2 */ +#define SICR_SC2_MUX 0x00004000 /* SCC2 Connection - mux SI */ +#define SICR_R2CS_MSK 0x00003800 /* SCC2 Receive Clock Source */ +#define SICR_R2CS_BRG1 0x00000000 /* BRG1 clock source */ +#define SICR_R2CS_BRG2 0x00000800 /* BRG2 clock source */ +#define SICR_R2CS_BRG3 0x00001000 /* BRG3 clock source */ +#define SICR_R2CS_BRG4 0x00001800 /* BRG4 clock source */ +#define SICR_R2CS_CLK1 0x00002000 /* CLK1 clock source */ +#define SICR_R2CS_CLK2 0x00002800 /* CLK2 clock source */ +#define SICR_R2CS_CLK3 0x00003000 /* CLK3 clock source */ +#define SICR_R2CS_CLK4 0x00003800 /* CLK4 clock source */ +#define SICR_T2CS_MSK 0x00000700 /* SCC2 Transmit Clock Source */ +#define SICR_T2CS_BRG1 0x00000000 /* BRG1 clock source */ +#define SICR_T2CS_BRG2 0x00000100 /* BRG2 clock source */ +#define SICR_T2CS_BRG3 0x00000200 /* BRG3 clock source */ +#define SICR_T2CS_BRG4 0x00000300 /* BRG4 clock source */ +#define SICR_T2CS_CLK1 0x00000400 /* CLK1 clock source */ +#define SICR_T2CS_CLK2 0x00000500 /* CLK2 clock source */ +#define SICR_T2CS_CLK3 0x00000600 /* CLK3 clock source */ +#define SICR_T2CS_CLK4 0x00000700 /* CLK4 clock source */ + +#define SICR_GR1 0x00000080 /* Grant Support of SCC1 */ +#define SICR_SC1_MUX 0x00000040 /* SCC1 Connection - mux SI */ +#define SICR_R1CS_MSK 0x00000038 /* SCC1 Receive Clock Source */ +#define SICR_R1CS_BRG1 0x00000000 /* BRG1 clock source */ +#define SICR_R1CS_BRG2 0x00000008 /* BRG2 clock source */ +#define SICR_R1CS_BRG3 0x00000010 /* BRG3 clock source */ +#define SICR_R1CS_BRG4 0x00000018 /* BRG4 clock source */ +#define SICR_R1CS_CLK1 0x00000020 /* CLK1 clock source */ +#define SICR_R1CS_CLK2 0x00000028 /* CLK2 clock source */ +#define SICR_R1CS_CLK3 0x00000030 /* CLK3 clock source */ +#define SICR_R1CS_CLK4 0x00000038 /* CLK4 clock source */ +#define SICR_T1CS_MSK 0x00000007 /* SCC1 Transmit Clock Source */ +#define SICR_T1CS_BRG1 0x00000000 /* BRG1 clock source */ +#define SICR_T1CS_BRG2 0x00000001 /* BRG2 clock source */ +#define SICR_T1CS_BRG3 0x00000002 /* BRG3 clock source */ +#define SICR_T1CS_BRG4 0x00000003 /* BRG4 clock source */ +#define SICR_T1CS_CLK1 0x00000004 /* CLK1 clock source */ +#define SICR_T1CS_CLK2 0x00000005 /* CLK2 clock source */ +#define SICR_T1CS_CLK3 0x00000006 /* CLK3 clock source */ +#define SICR_T1CS_CLK4 0x00000007 /* CLK4 clock source */ + +/* SI Ram Pointer bit definition (SIRP - 0xAF0) */ + +#define SIRP_VTB_MSK 0x20000000 /* Transmitter B pointer Valid*/ +#define SIRP_TBPTR_MSK 0x1f000000 /* Transmitter B pointer */ +#define SIRP_VTA_MSK 0x00200000 /* Transmitter A pointer Valid*/ +#define SIRP_TAPTR_MSK 0x001f0000 /* Transmitter A pointer */ +#define SIRP_VRB_MSK 0x00002000 /* Receiver B pointer Valid */ +#define SIRP_RBPTR_MSK 0x00001f00 /* Receiver B pointer */ +#define SIRP_VRA_MSK 0x00000020 /* Receiver A pointer Valid */ +#define SIRP_RAPTR_MSK 0x0000001f /* Receiver A pointer */ + +/* SMC UART Event Register bit definition (SMCE - 0x0A86) */ + +#define SMCE_BRK 0x10 /* Break character received */ +#define SMCE_BSY 0x04 /* Busy Condition */ +#define SMCE_TX 0x02 /* Transmit Buffer */ +#define SMCE_RX 0x01 /* Receive Buffer */ +#define SMCE_ALL_EVENTS (SMCE_BRK | SMCE_BSY | SMCE_TX | SMCE_RX) + +/* SMC UART Mask Register bit definition (SMCM - 0x0A8A) */ + +#define SMCM_BRK_MSK 0x10 /* Break character received Mask */ +#define SMCM_BSY_MSK 0x04 /* Busy Condition Mask */ +#define SMCM_TX_MSK 0x02 /* Transmit Buffer Mask */ +#define SMCM_RX_MSK 0x01 /* Receive Buffer Mask */ + +/* equates for CICR register CP interrupt configuration register */ +#define CICR_IRL_LEVEL_0 0x00000000 /* highest interrupt level */ +#define CICR_IRL_LEVEL_1 0x00020000 +#define CICR_IRL_LEVEL_2 0x00040000 +#define CICR_IRL_LEVEL_3 0x00060000 +#define CICR_IRL_LEVEL_4 0x00080000 /* standard value */ +#define CICR_IRL_LEVEL_5 0x000A0000 +#define CICR_IRL_LEVEL_6 0x000C0000 +#define CICR_IRL_LEVEL_7 0x000E0000 /* lowest */ +#define CICR_HP_SRC_STD 0x0001F000 /* highest priority int */ +#define CICR_MASTER_IEN 0x00000080 /* master interrupt enable */ + +/* SPI Mode Register bit definition (SPMODE - 0x0AA0) */ + +#define SPMODE_LOOP 0x4000 /* Loop Mode */ +#define SPMODE_CI 0x2000 /* Clock Invert */ +#define SPMODE_CI_LOW 0x0000 /* Inactive state is low */ +#define SPMODE_CI_HIGH 0x2000 /* Inactive state is high */ +#define SPMODE_CP 0x1000 /* Clock Phase */ +#define SPMODE_CP_MIDDLE 0x0000 /* Clock Phase: middle of the data */ +#define SPMODE_CP_BEGIN 0x1000 /* Clock Phase: Beginning of the data */ +#define SPMODE_DIV16 0x0800 /* BRGCLK Divide by 16 */ +#define SPMODE_REV 0x0400 /* Reverse Data */ +#define SPMODE_MS 0x0200 /* SPI Master */ +#define SPMODE_EN 0x0100 /* Enable SPI */ +#define SPMODE_LEN_MSK 0x00f0 /* Character Length */ +#define SPMODE_LEN_1_BIT 0x0000 /* Character Length: 1 bit */ +#define SPMODE_LEN_2_BITS 0x0010 /* Character Length: 2 bits */ +#define SPMODE_LEN_3_BITS 0x0020 /* Character Length: 3 bits */ +#define SPMODE_LEN_4_BITS 0x0030 /* Character Length: 4 bits */ +#define SPMODE_LEN_5_BITS 0x0040 /* Character Length: 5 bits */ +#define SPMODE_LEN_6_BITS 0x0050 /* Character Length: 6 bits */ +#define SPMODE_LEN_7_BITS 0x0060 /* Character Length: 7 bits */ +#define SPMODE_LEN_8_BITS 0x0070 /* Character Length: 8 bits */ +#define SPMODE_LEN_9_BITS 0x0080 /* Character Length: 9 bits */ +#define SPMODE_LEN_10_BITS 0x0090 /* Character Length: 10 bits */ +#define SPMODE_LEN_11_BITS 0x00a0 /* Character Length: 11 bits */ +#define SPMODE_LEN_12_BITS 0x00b0 /* Character Length: 12 bits */ +#define SPMODE_LEN_13_BITS 0x00c0 /* Character Length: 13 bits */ +#define SPMODE_LEN_14_BITS 0x00d0 /* Character Length: 14 bits */ +#define SPMODE_LEN_15_BITS 0x00e0 /* Character Length: 15 bits */ +#define SPMODE_LEN_16_BITS 0x00f0 /* Character Length: 16 bits */ +#define SPMODE_PM_MSK 0x000f /* BRGCLK Prescale Modulus select mask*/ +#define SPMODE_PM_DIV4 0x0000 /* BRGCLK clock divided by 4 */ +#define SPMODE_PM_DIV8 0x0001 /* BRGCLK clock divided by 8 */ +#define SPMODE_PM_DIV12 0x0002 /* BRGCLK clock divided by 12 */ +#define SPMODE_PM_DIV16 0x0003 /* BRGCLK clock divided by 16 */ +#define SPMODE_PM_DIV20 0x0004 /* BRGCLK clock divided by 20 */ +#define SPMODE_PM_DIV24 0x0005 /* BRGCLK clock divided by 24 */ +#define SPMODE_PM_DIV28 0x0006 /* BRGCLK clock divided by 28 */ +#define SPMODE_PM_DIV32 0x0007 /* BRGCLK clock divided by 32 */ +#define SPMODE_PM_DIV36 0x0008 /* BRGCLK clock divided by 36 */ +#define SPMODE_PM_DIV40 0x0009 /* BRGCLK clock divided by 40 */ +#define SPMODE_PM_DIV44 0x000a /* BRGCLK clock divided by 44 */ +#define SPMODE_PM_DIV48 0x000b /* BRGCLK clock divided by 48 */ +#define SPMODE_PM_DIV52 0x000c /* BRGCLK clock divided by 52 */ +#define SPMODE_PM_DIV56 0x000d /* BRGCLK clock divided by 56 */ +#define SPMODE_PM_DIV60 0x000e /* BRGCLK clock divided by 60 */ +#define SPMODE_PM_DIV64 0x000f /* BRGCLK clock divided by 64 */ + +/* SPI Command Register (SPCOM - 0x0AAD) */ + +#define SPCOM_STR 0x80 /* Start Transmit */ + + +/* SCC Receive Function Code Register bit definition (RFCR) */ + +#define RFCR_BO_MSK 0x18 /* Byte Order Mask */ +#define RFCR_BO_DEC_LE 0x00 /* Byte Order: DEC little endian mode */ +#define RFCR_BO_PPC_LE 0x08 /* Byte Order: PPC little endian mode */ + /* reverse transmission order of */ + /* bytes compared to DEC/Intel mode */ +#define RFCR_BO_MOT_BE 0x18 /* Motorola Big endian mode */ +#define RFCR_AT_MSK 0x07 /* Address Type Mask */ + +/* SCC Transmit Function Code Register bit definition (TFCR) */ + +#define TFCR_BO_MSK 0x18 /* Byte Order Mask */ +#define TFCR_BO_DEC_LE 0x00 /* Byte Order: DEC little endian mode */ +#define TFCR_BO_PPC_LE 0x08 /* Byte Order: PPC little endian mode */ + /* reverse transmission order of */ + /* bytes compared to DEC/Intel mode */ +#define TFCR_BO_MOT_BE 0x18 /* Motorola Big endian mode */ +#define TFCR_AT_MSK 0x07 /* Address Type Mask */ + +/* SMC UART Mode Register bit definition (SMCMR - 0x0A82) */ + +#define SMCMR_CLEN_MSK 0x7800 /* Character Length Mask */ +#define SMCMR_CLEN_0_BIT 0x0000 /* Character Length: 0 bit */ +#define SMCMR_CLEN_1_BIT 0x0800 /* Character Length: 1 bit */ +#define SMCMR_CLEN_2_BITS 0x1000 /* Character Length: 2 bits */ +#define SMCMR_CLEN_3_BITS 0x1800 /* Character Length: 3 bits */ +#define SMCMR_CLEN_4_BITS 0x2000 /* Character Length: 4 bits */ +#define SMCMR_CLEN_5_BITS 0x2800 /* Character Length: 5 bits */ +#define SMCMR_CLEN_6_BITS 0x3000 /* Character Length: 6 bits */ +#define SMCMR_CLEN_7_BITS 0x3800 /* Character Length: 7 bits */ +#define SMCMR_CLEN_8_BITS 0x4000 /* Character Length: 8 bits */ +#define SMCMR_CLEN_9_BITS 0x4800 /* Character Length: 9 bits */ +#define SMCMR_CLEN_10_BITS 0x5000 /* Character Length: 10 bits */ +#define SMCMR_CLEN_11_BITS 0x5800 /* Character Length: 11 bits */ +#define SMCMR_CLEN_12_BITS 0x6000 /* Character Length: 12 bits */ +#define SMCMR_CLEN_13_BITS 0x6800 /* Character Length: 13 bits */ +#define SMCMR_CLEN_14_BITS 0x7000 /* Character Length: 14 bits */ +#define SMCMR_CLEN_15_BITS 0x7800 /* Character Length: 15 bits */ +#define SMCMR_SL 0x0400 /* Stop Length */ +#define SMCMR_SL_1_BIT 0x0000 /* Stop Length: 1 bit */ +#define SMCMR_SL_2_BITS 0x0400 /* Stop Length: 2 bits */ +#define SMCMR_PEN 0x0200 /* Parity Enable */ +#define SMCMR_PM 0x0100 /* Parity Mode */ +#define SMCMR_PM_ODD 0x0000 /* Parity Mode: Odd parity */ +#define SMCMR_PM_EVEN 0x0100 /* Parity Mode: Even parity */ +#define SMCMR_SM_MSK 0x0030 /* SMC Mode Mask */ +#define SMCMR_SM_GCI_SCIT 0x0000 /* SMC Mode: GCI or SCIT support */ +#define SMCMR_SM_UART 0x0020 /* SMC Mode: GCI or SCIT support */ +#define SMCMR_SM_TRANSPARENT 0x0030 /* SMC Mode: Totally transparent */ +#define SMCMR_DM_MSK 0x000c /* Diagnostic Mode Mask */ +#define SMCMR_DM_NORMAL 0x0000 /* Diagnostic Mode: Normal */ +#define SMCMR_DM_LCLB 0x0004 /* Diagnostic Mode: Local Loopback */ +#define SMCMR_DM_ECHO 0x0008 /* Diagnostic Mode: Echo */ +#define SMCMR_TEN 0x0002 /* SMC Transmit Enable */ +#define SMCMR_REN 0x0001 /* SMC Receive Enable */ + +#define SMCMR_STD_MODE (SMCMR_CLEN_9_BITS | \ + SMCMR_SL_1_BIT | \ + SMCMR_SM_UART | \ + SMCMR_DM_NORMAL) + + +#define SCMCR_STD_MODE_ENABLED (SMCMR_STD_MODE | \ + SMCMR_TEN | \ + SMCMR_REN) + +/* CPM Interrupt Vector Register (CIVR - 0x930) */ + +#define CIVR_IVN_MSK 0xf800 /* Interrupt Vector Number */ +#define CIVR_IACK 0x0001 /* Interrupt Acknowledge */ + +/* CPM Interrupt configuration Register (CICR - 0x940) */ + +#define CICR_SCCDP_MSK 0xc00000 /* SCCd Priority Order Mask */ +#define CICR_SCCDP_SCC1 0x000000 /* SCC1 asserts the SCCd */ +#define CICR_SCCDP_SCC2 0x400000 /* SCC2 asserts the SCCd */ +#define CICR_SCCDP_SCC3 0x800000 /* SCC3 asserts the SCCd */ +#define CICR_SCCDP_SCC4 0xc00000 /* SCC4 asserts the SCCd */ +#define CICR_SCCCP_MSK 0x300000 /* SCCc Priority Order Mask */ +#define CICR_SCCCP_SCC1 0x000000 /* SCC1 asserts the SCCc */ +#define CICR_SCCCP_SCC2 0x100000 /* SCC2 asserts the SCCc */ +#define CICR_SCCCP_SCC3 0x200000 /* SCC3 asserts the SCCc */ +#define CICR_SCCCP_SCC4 0x300000 /* SCC4 asserts the SCCc */ +#define CICR_SCCBP_MSK 0x0c0000 /* SCCb Priority Order Mask */ +#define CICR_SCCBP_SCC1 0x000000 /* SCC1 asserts the SCCb */ +#define CICR_SCCBP_SCC2 0x040000 /* SCC2 asserts the SCCb */ +#define CICR_SCCBP_SCC3 0x080000 /* SCC3 asserts the SCCb */ +#define CICR_SCCBP_SCC4 0x0c0000 /* SCC4 asserts the SCCb */ +#define CICR_SCCAP_MSK 0x030000 /* SCCa Priority Order Mask */ +#define CICR_SCCAP_SCC1 0x000000 /* SCC1 asserts the SCCa */ +#define CICR_SCCAP_SCC2 0x010000 /* SCC2 asserts the SCCa */ +#define CICR_SCCAP_SCC3 0x020000 /* SCC3 asserts the SCCa */ +#define CICR_SCCAP_SCC4 0x030000 /* SCC4 asserts the SCCa */ +#define CICR_IRL_MSK 0x00e000 /* Interrupt Request Level */ +#define CICR_IRL_LVL0 0x000000 /* Interrupt Request Level 0 */ +#define CICR_IRL_LVL1 0x002000 /* Interrupt Request Level 1 */ +#define CICR_IRL_LVL2 0x004000 /* Interrupt Request Level 2 */ +#define CICR_IRL_LVL3 0x006000 /* Interrupt Request Level 3 */ +#define CICR_IRL_LVL4 0x008000 /* Interrupt Request Level 4 */ +#define CICR_IRL_LVL5 0x00a000 /* Interrupt Request Level 5 */ +#define CICR_IRL_LVL6 0x00c000 /* Interrupt Request Level 6 */ +#define CICR_IRL_LVL7 0x00e000 /* Interrupt Request Level 7 */ +#define CICR_HP_MSK 0x001f00 /* Highest Priority */ +#define CICR_IEN 0x000080 /* Interrupt Enable */ +#define CICR_SPS 0x000001 /* Spread Priority Scheme */ + +/* CPM Interrupt Pending Register (CIPR - 0x944) */ + +#define CIPR_PC15 0x80000000 /* Parallel I/O Port C[15] */ +#define CIPR_SCC1 0x40000000 /* SCC 1 */ +#define CIPR_SCC2 0x20000000 /* SCC 2 */ +#define CIPR_SCC3 0x10000000 /* SCC 3 */ +#define CIPR_SCC4 0x08000000 /* SCC 4 */ +#define CIPR_PC14 0x04000000 /* Parallel I/O Port C[14] */ +#define CIPR_TIMER1 0x02000000 /* Timer 1 */ +#define CIPR_PC13 0x01000000 /* Parallel I/O Port C[13] */ +#define CIPR_PC12 0x00800000 /* Parallel I/O Port C[12] */ +#define CIPR_SDMA 0x00400000 /* SDMA bus error */ +#define CIPR_IDMA1 0x00200000 /* IDMA 1 */ +#define CIPR_IDMA2 0x00100000 /* IDMA 2 */ +#define CIPR_TIMER2 0x00040000 /* Timer 2 */ +#define CIPR_R_TT 0x00020000 /* Risc Timer Table */ +#define CIPR_I2C 0x00010000 /* I2C */ +#define CIPR_PC11 0x00008000 /* Parallel I/O Port C[11] */ +#define CIPR_PC10 0x00004000 /* Parallel I/O Port C[10] */ +#define CIPR_TIMER3 0x00001000 /* Timer 3 */ +#define CIPR_PC9 0x00000800 /* Parallel I/O Port C[9] */ +#define CIPR_PC8 0x00000400 /* Parallel I/O Port C[8] */ +#define CIPR_PC7 0x00000200 /* Parallel I/O Port C[7] */ +#define CIPR_TIMER4 0x00000080 /* Timer 4 */ +#define CIPR_PC6 0x00000040 /* Parallel I/O Port C[6] */ +#define CIPR_SPI 0x00000020 /* SPI */ +#define CIPR_SMC1 0x00000010 /* SMC 1 */ +#define CIPR_SMC2_PIP 0x00000008 /* SMC 1 */ +#define CIPR_PC5 0x00000004 /* Parallel I/O Port C[5] */ +#define CIPR_PC4 0x00000002 /* Parallel I/O Port C[4] */ + +/* CPM Interrupt Mask Register (CIMR - 0x948) */ + +#define CIMR_PC15 0x80000000 /* Parallel I/O Port C[15] */ +#define CIMR_SCC1 0x40000000 /* SCC 1 */ +#define CIMR_SCC2 0x20000000 /* SCC 2 */ +#define CIMR_SCC3 0x10000000 /* SCC 3 */ +#define CIMR_SCC4 0x08000000 /* SCC 4 */ +#define CIMR_PC14 0x04000000 /* Parallel I/O Port C[14] */ +#define CIMR_TIMER1 0x02000000 /* Timer 1 */ +#define CIMR_PC13 0x01000000 /* Parallel I/O Port C[13] */ +#define CIMR_PC12 0x00800000 /* Parallel I/O Port C[12] */ +#define CIMR_SDMA 0x00400000 /* SDMA bus error */ +#define CIMR_IDMA1 0x00200000 /* IDMA 1 */ +#define CIMR_IDMA2 0x00100000 /* IDMA 2 */ +#define CIMR_TIMER2 0x00040000 /* Timer 2 */ +#define CIMR_R_TT 0x00020000 /* Risc Timer Table */ +#define CIMR_I2C 0x00010000 /* I2C */ +#define CIMR_PC11 0x00008000 /* Parallel I/O Port C[11] */ +#define CIMR_PC10 0x00004000 /* Parallel I/O Port C[10] */ +#define CIMR_TIMER3 0x00001000 /* Timer 3 */ +#define CIMR_PC9 0x00000800 /* Parallel I/O Port C[9] */ +#define CIMR_PC8 0x00000400 /* Parallel I/O Port C[8] */ +#define CIMR_PC7 0x00000200 /* Parallel I/O Port C[7] */ +#define CIMR_TIMER4 0x00000080 /* Timer 4 */ +#define CIMR_PC6 0x00000040 /* Parallel I/O Port C[6] */ +#define CIMR_SPI 0x00000020 /* SPI */ +#define CIMR_SMC1 0x00000010 /* SMC 1 */ +#define CIMR_SMC2_PIP 0x00000008 /* SMC 1 */ +#define CIMR_PC5 0x00000004 /* Parallel I/O Port C[5] */ +#define CIMR_PC4 0x00000002 /* Parallel I/O Port C[4] */ +#define CIMR_ALL 0xfff7defe /* all interrupt masks */ + +/* CPM Interrupt in Service Register (CISR - 0x94c) */ + +#define CISR_PC15 0x80000000 /* Parallel I/O Port C[15] */ +#define CISR_SCC1 0x40000000 /* SCC 1 */ +#define CISR_SCC2 0x20000000 /* SCC 2 */ +#define CISR_SCC3 0x10000000 /* SCC 3 */ +#define CISR_SCC4 0x08000000 /* SCC 4 */ +#define CISR_PC14 0x04000000 /* Parallel I/O Port C[14] */ +#define CISR_TIMER1 0x02000000 /* Timer 1 */ +#define CISR_PC13 0x01000000 /* Parallel I/O Port C[13] */ +#define CISR_PC12 0x00800000 /* Parallel I/O Port C[12] */ +#define CISR_SDMA 0x00400000 /* SDMA bus error */ +#define CISR_IDMA1 0x00200000 /* IDMA 1 */ +#define CISR_IDMA2 0x00100000 /* IDMA 2 */ +#define CISR_TIMER2 0x00040000 /* Timer 2 */ +#define CISR_R_TT 0x00020000 /* Risc Timer Table */ +#define CISR_I2C 0x00010000 /* I2C */ +#define CISR_PC11 0x00008000 /* Parallel I/O Port C[11] */ +#define CISR_PC10 0x00004000 /* Parallel I/O Port C[10] */ +#define CISR_TIMER3 0x00001000 /* Timer 3 */ +#define CISR_PC9 0x00000800 /* Parallel I/O Port C[9] */ +#define CISR_PC8 0x00000400 /* Parallel I/O Port C[8] */ +#define CISR_PC7 0x00000200 /* Parallel I/O Port C[7] */ +#define CISR_TIMER4 0x00000080 /* Timer 4 */ +#define CISR_PC6 0x00000040 /* Parallel I/O Port C[6] */ +#define CISR_SPI 0x00000020 /* SPI */ +#define CISR_SMC1 0x00000010 /* SMC 1 */ +#define CISR_SMC2_PIP 0x00000008 /* SMC 1 */ +#define CISR_PC5 0x00000004 /* Parallel I/O Port C[5] */ +#define CISR_PC4 0x00000002 /* Parallel I/O Port C[4] */ + +/* SCC - Serial Communication Controller */ + + +/* General SCC Mode Register definitions */ + +#define SCC_GSMRL_HDLC 0x00000000 /* HDLC mode */ +#define SCC_GSMRL_APPLETALK 0x00000002 /* AppleTalk mode (LocalTalk) */ +#define SCC_GSMRL_SS7 0x00000003 /* SS7 mode (microcode) */ +#define SCC_GSMRL_UART 0x00000004 /* UART mode */ +#define SCC_GSMRL_PROFI_BUS 0x00000005 /* Profi-Bus mode (microcode) */ +#define SCC_GSMRL_ASYNC_HDLC 0x00000006 /* async HDLC mode (microcode)*/ +#define SCC_GSMRL_V14 0x00000007 /* V.14 mode */ +#define SCC_GSMRL_BISYNC 0x00000008 /* BISYNC mode */ +#define SCC_GSMRL_DDCMP 0x00000009 /* DDCMP mode (microcode) */ +#define SCC_GSMRL_ETHERNET 0x0000000c /* ethernet mode (SCC1 only) */ +#define SCC_GSMRL_ENT 0x00000010 /* enable transmitter */ +#define SCC_GSMRL_ENR 0x00000020 /* enable receiver */ +#define SCC_GSMRL_LOOPBACK 0x00000040 /* local loopback mode */ +#define SCC_GSMRL_ECHO 0x00000080 /* automatic echo mode */ +#define SCC_GSMRL_TENC 0x00000700 /* transmitter encoding method*/ +#define SCC_GSMRL_RENC 0x00003800 /* receiver encoding method */ +#define SCC_GSMRL_RDCR_X8 0x00004000 /* receive DPLL clock x8 */ +#define SCC_GSMRL_RDCR_X16 0x00008000 /* receive DPLL clock x16 */ +#define SCC_GSMRL_RDCR_X32 0x0000c000 /* receive DPLL clock x32 */ +#define SCC_GSMRL_TDCR_X8 0x00010000 /* transmit DPLL clock x8 */ +#define SCC_GSMRL_TDCR_X16 0x00020000 /* transmit DPLL clock x16 */ +#define SCC_GSMRL_TDCR_X32 0x00030000 /* transmit DPLL clock x32 */ +#define SCC_GSMRL_TEND 0x00040000 /* transmitter frame ending */ +#define SCC_GSMRL_TPP_00 0x00180000 /* Tx preamble pattern = 00 */ +#define SCC_GSMRL_TPP_10 0x00080000 /* Tx preamble pattern = 10 */ +#define SCC_GSMRL_TPP_01 0x00100000 /* Tx preamble pattern = 01 */ +#define SCC_GSMRL_TPP_11 0x00180000 /* Tx preamble pattern = 11 */ +#define SCC_GSMRL_TPL_NONE 0x00000000 /* no Tx preamble (default) */ +#define SCC_GSMRL_TPL_8 0x00200000 /* Tx preamble = 1 byte */ +#define SCC_GSMRL_TPL_16 0x00400000 /* Tx preamble = 2 bytes */ +#define SCC_GSMRL_TPL_32 0x00600000 /* Tx preamble = 4 bytes */ +#define SCC_GSMRL_TPL_48 0x00800000 /* Tx preamble = 6 bytes */ +#define SCC_GSMRL_TPL_64 0x00a00000 /* Tx preamble = 8 bytes */ +#define SCC_GSMRL_TPL_128 0x00c00000 /* Tx preamble = 16 bytes */ +#define SCC_GSMRL_TINV 0x01000000 /* DPLL transmit input invert */ +#define SCC_GSMRL_RINV 0x02000000 /* DPLL receive input invert */ +#define SCC_GSMRL_TSNC 0x0c000000 /* transmit sense */ +#define SCC_GSMRL_TCI 0x10000000 /* transmit clock invert */ +#define SCC_GSMRL_EDGE 0x60000000 /* adjustment edge +/- */ + +#define SCC_GSMRH_RSYN 0x00000001 /* receive sync timing*/ +#define SCC_GSMRH_RTSM 0x00000002 /* RTS* mode */ +#define SCC_GSMRH_SYNL 0x0000000c /* sync length */ +#define SCC_GSMRH_TXSY 0x00000010 /* transmitter/receiver sync */ +#define SCC_GSMRH_RFW 0x00000020 /* Rx FIFO width */ +#define SCC_GSMRH_TFL 0x00000040 /* transmit FIFO length */ +#define SCC_GSMRH_CTSS 0x00000080 /* CTS* sampling */ +#define SCC_GSMRH_CDS 0x00000100 /* CD* sampling */ +#define SCC_GSMRH_CTSP 0x00000200 /* CTS* pulse */ +#define SCC_GSMRH_CDP 0x00000400 /* CD* pulse */ +#define SCC_GSMRH_TTX 0x00000800 /* transparent transmitter */ +#define SCC_GSMRH_TRX 0x00001000 /* transparent receiver */ +#define SCC_GSMRH_REVD 0x00002000 /* reverse data */ +#define SCC_GSMRH_TCRC 0x0000c000 /* transparent CRC */ +#define SCC_GSMRH_GDE 0x00010000 /* glitch detect enable */ + +/* SCC UART protocol specific parameters */ + +typedef struct /* SCC_UART_PROTO */ + { + UINT32 res1; /* reserved */ + UINT32 res2; /* reserved */ + UINT16 maxIdl; /* maximum idle characters */ + UINT16 idlc; /* temporary idle counter */ + UINT16 brkcr; /* break count register (transmit) */ + UINT16 parec; /* receive parity error counter */ + UINT16 frmer; /* receive framing error counter */ + UINT16 nosec; /* receive noise counter */ + UINT16 brkec; /* receive break condition counter */ + UINT16 brkln; /* last received break length */ + UINT16 uaddr1; /* uart address character 1 */ + UINT16 uaddr2; /* uart address character 2 */ + UINT16 rtemp; /* temp storage */ + UINT16 toseq; /* transmit out-of-sequence character */ + UINT16 character1; /* control character 1 */ + UINT16 character2; /* control character 2 */ + UINT16 character3; /* control character 3 */ + UINT16 character4; /* control character 4 */ + UINT16 character5; /* control character 5 */ + UINT16 character6; /* control character 6 */ + UINT16 character7; /* control character 7 */ + UINT16 character8; /* control character 8 */ + UINT16 rccm; /* receive control character mask */ + UINT16 rccr; /* receive control character register */ + UINT16 rlbc; /* receive last break character */ + } SCC_UART_PROTO; + +/* SCC UART Protocol Specific Mode Register definitions */ + +#define SCC_UART_PSMR_TPM_ODD 0x0000 /* odd parity mode (Tx) */ +#define SCC_UART_PSMR_TPM_LOW 0x0001 /* low parity mode (Tx) */ +#define SCC_UART_PSMR_TPM_EVEN 0x0002 /* even parity mode (Tx) */ +#define SCC_UART_PSMR_TPM_HIGH 0x0003 /* high parity mode (Tx) */ +#define SCC_UART_PSMR_RPM_ODD 0x0000 /* odd parity mode (Rx) */ +#define SCC_UART_PSMR_RPM_LOW 0x0004 /* low parity mode (Rx) */ +#define SCC_UART_PSMR_RPM_EVEN 0x0008 /* even parity mode (Rx) */ +#define SCC_UART_PSMR_RPM_HIGH 0x000c /* high parity mode (Rx) */ +#define SCC_UART_PSMR_PEN 0x0010 /* parity enable */ +#define SCC_UART_PSMR_DRT 0x0040 /* disable Rx while Tx */ +#define SCC_UART_PSMR_SYN 0x0080 /* synchronous mode */ +#define SCC_UART_PSMR_RZS 0x0100 /* receive zero stop bits */ +#define SCC_UART_PSMR_FRZ 0x0200 /* freeze transmission */ +#define SCC_UART_PSMR_UM_NML 0x0000 /* noraml UART operation */ +#define SCC_UART_PSMR_UM_MULT_M 0x0400 /* multidrop non-auto mode */ +#define SCC_UART_PSMR_UM_MULT_A 0x0c00 /* multidrop automatic mode */ +#define SCC_UART_PSMR_CL_5BIT 0x0000 /* 5 bit character length */ +#define SCC_UART_PSMR_CL_6BIT 0x1000 /* 6 bit character length */ +#define SCC_UART_PSMR_CL_7BIT 0x2000 /* 7 bit character length */ +#define SCC_UART_PSMR_CL_8BIT 0x3000 /* 8 bit character length */ +#define SCC_UART_PSMR_SL 0x4000 /* 1 or 2 bit stop length */ +#define SCC_UART_PSMR_FLC 0x8000 /* flow control */ + +/* SCC UART Event and Mask Register definitions */ + +#define SCC_UART_SCCX_RX 0x0001 /* buffer received */ +#define SCC_UART_SCCX_TX 0x0002 /* buffer transmitted */ +#define SCC_UART_SCCX_BSY 0x0004 /* busy condition */ +#define SCC_UART_SCCX_CCR 0x0008 /* control character received */ +#define SCC_UART_SCCX_BRK_S 0x0020 /* break start */ +#define SCC_UART_SCCX_BRK_E 0x0040 /* break end */ +#define SCC_UART_SCCX_GRA 0x0080 /* graceful stop complete */ +#define SCC_UART_SCCX_IDL 0x0100 /* idle sequence stat changed */ +#define SCC_UART_SCCX_AB 0x0200 /* autobaud lock */ +#define SCC_UART_SCCX_GL_T 0x0800 /* glitch on Tx */ +#define SCC_UART_SCCX_GL_R 0x1000 /* glitch on Rx */ + +/* SCC UART Receive Buffer Descriptor definitions */ + +#define SCC_UART_RX_BD_CD 0x0001 /* carrier detect loss */ +#define SCC_UART_RX_BD_OV 0x0002 /* receiver overrun */ +#define SCC_UART_RX_BD_PR 0x0008 /* parity error */ +#define SCC_UART_RX_BD_FR 0x0010 /* framing error */ +#define SCC_UART_RX_BD_BR 0x0020 /* break received */ +#define SCC_UART_RX_BD_AM 0x0080 /* address match */ +#define SCC_UART_RX_BD_ID 0x0100 /* buf closed on IDLES */ +#define SCC_UART_RX_BD_CM 0x0200 /* continous mode */ +#define SCC_UART_RX_BD_ADDR 0x0400 /* buffer contains address */ +#define SCC_UART_RX_BD_CNT 0x0800 /* control character */ +#define SCC_UART_RX_BD_INT 0x1000 /* interrupt generated */ +#define SCC_UART_RX_BD_WRAP 0x2000 /* wrap back to first BD */ +#define SCC_UART_RX_BD_EMPTY 0x8000 /* buffer is empty */ + +/* SCC UART Transmit Buffer Descriptor definitions */ + +#define SCC_UART_TX_BD_CT 0x0001 /* cts was lost during tx */ +#define SCC_UART_TX_BD_NS 0x0080 /* no stop bit transmitted */ +#define SCC_UART_TX_BD_PREAMBLE 0x0100 /* enable preamble */ +#define SCC_UART_TX_BD_CM 0x0200 /* continous mode */ +#define SCC_UART_TX_BD_ADDR 0x0400 /* buffer contains address */ +#define SCC_UART_TX_BD_CTSR 0x0800 /* normal cts error reporting */ +#define SCC_UART_TX_BD_INT 0x1000 /* interrupt generated */ +#define SCC_UART_TX_BD_WRAP 0x2000 /* wrap back to first BD */ +#define SCC_UART_TX_BD_READY 0x8000 /* buffer is being sent */ + +/* SCC Buffer */ + +typedef struct /* SCC_BUF */ + { + volatile UINT16 statusMode; /* status and control */ + UINT16 dataLength; /* length of data buffer in bytes */ + u_char * dataPointer; /* points to data buffer */ + } SCC_BUF; + +/* SCC Parameters */ + +typedef struct /* SCC_PARAM */ + { /* offset description*/ + volatile INT16 rbase; /* 00 Rx buffer descriptor base address */ + volatile INT16 tbase; /* 02 Tx buffer descriptor base address */ + volatile INT8 rfcr; /* 04 Rx function code */ + volatile INT8 tfcr; /* 05 Tx function code */ + volatile INT16 mrblr; /* 06 maximum receive buffer length */ + volatile INT32 rstate; /* 08 Rx internal state */ + volatile INT32 res1; /* 0C Rx internal data pointer */ + volatile INT16 rbptr; /* 10 Rx buffer descriptor pointer */ + volatile INT16 res2; /* 12 reserved/internal */ + volatile INT32 res3; /* 14 reserved/internal */ + volatile INT32 tstate; /* 18 Tx internal state */ + volatile INT32 res4; /* 1C reserved/internal */ + volatile INT16 tbptr; /* 20 Tx buffer descriptor pointer */ + volatile INT16 res5; /* 22 reserved/internal */ + volatile INT32 res6; /* 24 reserved/internal */ + volatile INT32 rcrc; /* 28 temp receive CRC */ + volatile INT32 tcrc; /* 2C temp transmit CRC */ + } SCC_PARAM; + +typedef struct /* SCC */ + { + SCC_PARAM param; /* SCC parameters */ + char prot[64]; /* protocol specific area */ + } SCC; + +typedef struct /* SCC_REG */ + { + UINT32 gsmrl; /* SCC general mode register - low */ + UINT32 gsmrh; /* SCC eneral mode register - high */ + UINT16 psmr; /* SCC protocol mode register */ + UINT16 res1; /* reserved */ + UINT16 todr; /* SCC transmit on demand */ + UINT16 dsr; /* SCC data sync. register */ + volatile UINT16 scce; /* SCC event register */ + UINT16 res2; /* reserved */ + UINT16 sccm; /* SCC mask register */ + UINT8 res3; /* reserved */ + volatile UINT8 sccs; /* SCC status register */ + } SCC_REG; + +/* PIP related definitions: */ + +#define CPM_PIP_STB 0x00010000 /* printer data-strobe control */ +#define CPM_PIP_ACK 0x00020000 /* printer acknowledge status */ +#define CPM_PIP_BSY 0x00000001 /* printer busy status */ +#define CPM_PIP_SEL 0x00000002 /* printer select status */ +#define CPM_PIP_PE 0x00000004 /* printer paper error status */ +#define CPM_PIP_F 0x00000008 /* printer error/fault status */ +#define CPM_PIP_DATA 0x0000ff00 /* data mask */ + +/* I2C related definitions */ + +/* I2C receive buffer descriptor control/status */ + +#define CPM_I2C_R_CS_E 0x8000 /* empty */ +#define CPM_I2C_R_CS_W 0x2000 /* wrap, final BD in table */ +#define CPM_I2C_R_CS_I 0x1000 /* interrupt */ +#define CPM_I2C_R_CS_L 0x0800 /* buffer closed on start/stop/error */ +#define CPM_I2C_R_CS_OV 0x0002 /* overrun */ + +/* I2C mode register bit definitions */ + +#define CPM_I2C_MODE_REVD 0x0020 /* reverse data */ +#define CPM_I2C_MODE_GCD 0x0010 /* general call disable */ +#define CPM_I2C_MODE_FLT 0x0008 /* clock filter */ +#define CPM_I2C_MODE_PDIV_MASK 0x0006 /* predivider mask */ +#define CPM_I2C_MODE_PDIV_BRGCLK32 0x0000 /* predivider - BRGCLK/32 */ +#define CPM_I2C_MODE_PDIV_BRGCLK16 0x0002 /* predivider - BRGCLK/16 */ +#define CPM_I2C_MODE_PDIV_BRGCLK8 0x0004 /* predivider - BRGCLK/8 */ +#define CPM_I2C_MODE_PDIV_BRGCLK4 0x0006 /* predivider - BRGCLK/4 */ +#define CPM_I2C_MODE_EN 0x0001 /* enable i2c */ + +/* I2C event/mask register bit definitions */ + +#define CPM_I2C_ER_TXE 0x0010 /* transmit error */ +#define CPM_I2C_ER_BSY 0x0004 /* busy condition */ +#define CPM_I2C_ER_TXB 0x0002 /* transmit buffer */ +#define CPM_I2C_ER_RXB 0x0001 /* receive buffer */ + +/* I2C command register bit definitions */ + +#define CPM_I2C_COMMAND_STR 0x0080 /* start transmit */ +#define CPM_I2C_COMMAND_MS 0x0001 /* master/slave mode */ + +/* I2C transmit buffer descriptor control/status */ + +#define CPM_I2C_T_CS_R 0x8000 /* ready */ +#define CPM_I2C_T_CS_W 0x2000 /* wrap, final BD in table */ +#define CPM_I2C_T_CS_I 0x1000 /* interrupt */ +#define CPM_I2C_T_CS_L 0x0800 /* last buffer of message */ +#define CPM_I2C_T_CS_S 0x0400 /* transmit start condition */ +#define CPM_I2C_T_CS_NAK 0x0004 /* no acknowledge */ +#define CPM_I2C_T_CS_UN 0x0002 /* underrun */ +#define CPM_I2C_T_CS_CL 0x0001 /* collision */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCppc860Cpmh */ diff --git a/h/drv/multi/ppc860Siu.h b/h/drv/multi/ppc860Siu.h new file mode 100644 index 0000000..439ac3a --- /dev/null +++ b/h/drv/multi/ppc860Siu.h @@ -0,0 +1,833 @@ +/* ppc860Siu.h - Motorola System Interface Unit header file */ + +/* +Copyright (c) 1984-2005 Wind River Systems, Inc. +The right to copy, distribute, modify or otherwise make use +of this software may be licensed only pursuant to the terms +of an applicable Wind River license agreement. +*/ + +/* Copyright 1997,1998 Motorola, Inc., All Rights Reserved */ + +/* +modification history +-------------------- +01i,29may05,mig Added support for MPC866 PLPRCR register. SPR# 109471 +01h,18sep01,pmr fixed typo in definition of SIUMCR_MLRC_SPKROUT (SPR 64301). +01g,01dec98,cn fixed SPR# 8614. +01f,23jun98,cn added MPC860_REGB_OFFSET and MPC860_DPR_SCC1 macros. +01e,26mar98,map added more LCD definitions. +01d,09dec96,tpr added LCD register definition, corrected typo. +01c,11nov96,tam added extra macros for power management (PLPRCR register). +01b,06nov96,tpr added new macros. +01a,11apr96,tpr created. +*/ + +/* +This file contains constants of the System Interface Unit (SIU) for the +Motorola MPC860 and MPC821 PowerPC microcontroller +*/ + +#ifndef __INCppc860Siuh +#define __INCppc860Siuh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _ASMLANGUAGE +#define CAST(x) +#else /* _ASMLANGUAGE */ +typedef volatile UCHAR VCHAR; /* shorthand for volatile UCHAR */ +typedef volatile INT32 VINT32; /* volatile unsigned word */ +typedef volatile INT16 VINT16; /* volatile unsigned halfword */ +typedef volatile INT8 VINT8; /* volatile unsigned byte */ +typedef volatile UINT32 VUINT32; /* volatile unsigned word */ +typedef volatile UINT16 VUINT16; /* volatile unsigned halfword */ +typedef volatile UINT8 VUINT8; /* volatile unsigned byte */ +#define CAST(x) (x) +#endif /* _ASMLANGUAGE */ + + +/* + * MPC860/MPC821 internal register/memory map (section 17 of prelim. spec) + * note that these are offsets from the value stored in the IMMR + * register, which is in the PowerPC special register address space + * at register number 638 + */ + +/* General SIU registers */ + +#define SIUMCR(base) (CAST(VUINT32 *)((base) + 0x0000)) /* SIU Module Conf*/ +#define SYPCR(base) (CAST(VUINT32 *)((base) + 0x0004)) /* Protection Ctrl */ +#define SWT(base) (CAST(VUINT32 *)((base) + 0x0008)) /* SW watch dog */ +#define SWSR(base) (CAST(VUINT16 *)((base) + 0x000E)) /* SW Service Reg */ +#define SIPEND(base) (CAST(VUINT32 *)((base) + 0x0010)) /* Intr Pending reg*/ +#define SIMASK(base) (CAST(VUINT32 *)((base) + 0x0014)) /* Intr Mask reg */ +#define SIEL(base) (CAST(VUINT32 *)((base) + 0x0018)) /* Intr Edge Lvl */ +#define SIVEC(base) (CAST(VUINT32 *)((base) + 0x001C)) /* Intr Vector reg */ +#define TESR(base) (CAST(VUINT32 *)((base) + 0x0020)) /* Tx Error Status */ +#define SDCR(base) (CAST(VUINT32 *)((base) + 0x0030)) /* SDMA Config Reg */ + +/* PCMCIA registers */ + +#define PBR0(base) (CAST(VUINT32 *)((base) + 0x0080)) /* PCMCIA base 0 */ +#define POR0(base) (CAST(VUINT32 *)((base) + 0x0084)) /* PCMCIA option 0 */ +#define PBR1(base) (CAST(VUINT32 *)((base) + 0x0088)) /* PCMCIA base 1 */ +#define POR1(base) (CAST(VUINT32 *)((base) + 0x008C)) /* PCMCIA option 1 */ +#define PBR2(base) (CAST(VUINT32 *)((base) + 0x0090)) /* PCMCIA base 2 */ +#define POR2(base) (CAST(VUINT32 *)((base) + 0x0094)) /* PCMCIA option 2 */ +#define PBR3(base) (CAST(VUINT32 *)((base) + 0x0098)) /* PCMCIA base 3 */ +#define POR3(base) (CAST(VUINT32 *)((base) + 0x009C)) /* PCMCIA option 3 */ +#define PBR4(base) (CAST(VUINT32 *)((base) + 0x00A0)) /* PCMCIA base 4 */ +#define POR4(base) (CAST(VUINT32 *)((base) + 0x00A4)) /* PCMCIA option 4 */ +#define PBR5(base) (CAST(VUINT32 *)((base) + 0x00A8)) /* PCMCIA base 5 */ +#define POR5(base) (CAST(VUINT32 *)((base) + 0x00AC)) /* PCMCIA option 5 */ +#define PBR6(base) (CAST(VUINT32 *)((base) + 0x00B0)) /* PCMCIA base 6 */ +#define POR6(base) (CAST(VUINT32 *)((base) + 0x00B4)) /* PCMCIA option 6 */ +#define PBR7(base) (CAST(VUINT32 *)((base) + 0x00B8)) /* PCMCIA base 7 */ +#define POR7(base) (CAST(VUINT32 *)((base) + 0x00BC)) /* PCMCIA option 7 */ + +#define PGCRA(base) (CAST(VUINT32 *)((base) + 0x00E0)) /* slot A ctrl */ +#define PGCRB(base) (CAST(VUINT32 *)((base) + 0x00E4)) /* slot B ctrl */ +#define PSCR(base) (CAST(VUINT32 *)((base) + 0x00E8)) /* PCMCIA Status */ +#define PIPR(base) (CAST(VUINT32 *)((base) + 0x00F0)) /* pins value */ +#define PER(base) (CAST(VUINT32 *)((base) + 0x00f8)) /* PCMCIA Enable */ + +/* MEMC registers */ + +#define BR0(base) (CAST(VUINT32 *)((base) + 0x0100)) /* Base Reg bank 0 */ +#define OR0(base) (CAST(VUINT32 *)((base) + 0x0104)) /* Opt Reg bank 0*/ +#define BR1(base) (CAST(VUINT32 *)((base) + 0x0108)) /* Base Reg bank 1 */ +#define OR1(base) (CAST(VUINT32 *)((base) + 0x010C)) /* Opt Reg bank 1*/ +#define BR2(base) (CAST(VUINT32 *)((base) + 0x0110)) /* Base Reg bank 2 */ +#define OR2(base) (CAST(VUINT32 *)((base) + 0x0114)) /* Opt Reg bank 2*/ +#define BR3(base) (CAST(VUINT32 *)((base) + 0x0118)) /* Base Reg bank 3 */ +#define OR3(base) (CAST(VUINT32 *)((base) + 0x011C)) /* Opt Reg bank 3*/ +#define BR4(base) (CAST(VUINT32 *)((base) + 0x0120)) /* Base Reg bank 4 */ +#define OR4(base) (CAST(VUINT32 *)((base) + 0x0124)) /* Opt Reg bank 4*/ +#define BR5(base) (CAST(VUINT32 *)((base) + 0x0128)) /* Base Reg bank 5 */ +#define OR5(base) (CAST(VUINT32 *)((base) + 0x012C)) /* Opt Reg bank 5*/ +#define BR6(base) (CAST(VUINT32 *)((base) + 0x0130)) /* Base Reg bank 6 */ +#define OR6(base) (CAST(VUINT32 *)((base) + 0x0134)) /* Opt Reg bank 6*/ +#define BR7(base) (CAST(VUINT32 *)((base) + 0x0138)) /* Base Reg bank 7 */ +#define OR7(base) (CAST(VUINT32 *)((base) + 0x013C)) /* Opt Reg bank 7*/ + +#define MAR(base) (CAST(VUINT32 *)((base) + 0x0164)) /* Memory Address */ +#define MCR(base) (CAST(VUINT32 *)((base) + 0x0168)) /* Memory Command */ +#define MAMR(base) (CAST(VUINT32 *)((base) + 0x0170)) /* Machine A Mode */ +#define MBMR(base) (CAST(VUINT32 *)((base) + 0x0174)) /* Machine B Mode */ +#define MSTAT(base) (CAST(VUINT16 *)((base) + 0x0178)) /* Memory Status */ +#define MPTPR(base) (CAST(VUINT16 *)((base) + 0x017A)) /* Mem Timer Presc*/ +#define MDR(base) (CAST(VUINT32 *)((base) + 0x017C)) /* Memory Data */ + +/* System Integration Timers */ + +#define TBSCR(base) (CAST(VUINT16 *)((base) + 0x0200)) /* T.B. Status Ctrl*/ +#define TBREFF0(base) (CAST(VUINT32 *)((base) + 0x0204)) /* Time Base Ref 0 */ +#define TBREFF1(base) (CAST(VUINT32 *)((base) + 0x0208)) /* Time Base Ref 1 */ + +#define RTCSC(base) (CAST(VUINT16 *)((base) + 0x0220)) /* Clock Stat Ctrl*/ +#define RTC(base) (CAST(VUINT32 *)((base) + 0x0224)) /* RT Clock */ +#define RTSEC(base) (CAST(VUINT32 *)((base) + 0x0228)) /* RT Alarm Seconds*/ +#define RTCAL(base) (CAST(VUINT32 *)((base) + 0x022C)) /* Real Time Alarm */ + +#define PISCR(base) (CAST(VUINT16 *)((base) + 0x0240)) /* PIT Status Ctrl */ +#define PITC(base) (CAST(VUINT32 *)((base) + 0x0244)) /* PIT Count */ +#define PITR(base) (CAST(VUINT32 *)((base) + 0x0248)) /* PIT */ + +/* Clock and Reset */ + +#define SCCR(base) (CAST(VUINT32 *)((base) + 0x0280)) /* Sys Clock Ctrl*/ +#define PLPRCR(base) (CAST(VUINT32 *)((base) + 0x0284)) /* PLL LPower Reset*/ +#define RSR(base) (CAST(VUINT32 *)((base) + 0x0288)) /* Reset Status Reg*/ + +/* System Integration Timers Keys */ + +#define TBSCRK(base) (CAST(VUINT32 *)((base) + 0x0300)) /* TB Stat Ctrl key*/ +#define TBREFF0K(base) (CAST(VUINT32 *)((base) + 0x0304)) /* TB Ref 0 Key */ +#define TBREFF1K(base) (CAST(VUINT32 *)((base) + 0x0308)) /* TB Ref 1 Key */ +#define TBK(base) (CAST(VUINT32 *)((base) + 0x030C)) /* TB & Dec Key */ + +#define RTCSCK(base) (CAST(VUINT32 *)((base) + 0x0320)) /* RT Stat Ctrl Key*/ +#define RTCK(base) (CAST(VUINT32 *)((base) + 0x0324)) /* RT Clock Key */ +#define RTSECK(base) (CAST(VUINT32 *)((base) + 0x0328)) /* RT Alarm Second */ +#define RTCALK(base) (CAST(VUINT32 *)((base) + 0x032C)) /* R T Alarm Key */ + +#define PISCRK(base) (CAST(VUINT32 *)((base) + 0x0340)) /* PIT Stat Ctrl Key*/ +#define PITCK(base) (CAST(VUINT32 *)((base) + 0x0344)) /* PIT Count Key */ + +/* Clock and Reset Keys */ + +#define SCCRK(base) (CAST(VUINT32 *)((base) + 0x0380)) /* System Clk Ctrl */ +#define PLPRCRK(base) (CAST(VUINT32 *)((base) + 0x0384)) /* Pll, LP&R Ctrl */ +#define RSRK(base) (CAST(VUINT32 *)((base) + 0x0388)) /* Reset Status Key*/ + +/* LCD */ + +#define LCOLR(base) (CAST(VUINT16 *)((base) + 0x0E00)) /* Color Ram */ +#define LCCR(base) (CAST(VUINT32 *)((base) + 0x0840)) /* Config reg */ +#define LCHCR(base) (CAST(VUINT32 *)((base) + 0x0844)) /* Horizontal */ +#define LCVCR(base) (CAST(VUINT32 *)((base) + 0x0848)) /* Vertical */ +#define LCFAA(base) (CAST(VUINT32 *)((base) + 0x0850)) /* Frame A buf */ +#define LCFBA(base) (CAST(VUINT32 *)((base) + 0x0854)) /* Frame B buf */ +#define LCSR(base) (CAST(VUINT8 *) ((base) + 0x0858)) /* Status reg */ + +/* I2C */ + +#define I2MOD(base) (CAST(VUINT8 *)((base) + 0x0860)) /* I2C Mode register*/ +#define I2ADD(base) (CAST(VUINT8 *)((base) + 0x0864)) /* I2C Address reg */ +#define I2BRG(base) (CAST(VUINT8 *)((base) + 0x0868)) /* I2C BRG register */ +#define I2COM(base) (CAST(VUINT8 *)((base) + 0x086C)) /* I2C Command reg */ +#define I2CER(base) (CAST(VUINT8 *)((base) + 0x0870)) /* I2C Event Reg */ +#define I2CMR(base) (CAST(VUINT8 *)((base) + 0x0874)) /* I2C Mask Reg */ + +/* DMA */ + +#define SDAR(base) (CAST(VUINT32 *)((base) + 0x0904)) /* SDMA Address Reg*/ +#define SDSR(base) (CAST(VUINT8 *)((base) + 0x0908)) /* SDMA Status Reg */ +#define SDMR(base) (CAST(VUINT8 *)((base) + 0x090C)) /* SDMA Mask Reg */ +#define IDSR1(base) (CAST(VUINT8 *)((base) + 0x0910)) /* IDMA 1 Status Reg*/ +#define IDMR1(base) (CAST(VUINT8 *)((base) + 0x0914)) /* IDMA 1 Mask Reg */ +#define IDSR2(base) (CAST(VUINT8 *)((base) + 0x0918)) /* IDMA 2 Status Reg*/ +#define IDMR2(base) (CAST(VUINT8 *)((base) + 0x091C)) /* IDMA 2 Mask Reg */ + +/* CPM Interrupt Control registers */ + +#define CIVR(base) (CAST(VUINT16 *)((base) + 0x0930)) /* CP Int vector */ +#define CICR(base) (CAST(VUINT32 *)((base) + 0x0940)) /* CP Int config */ +#define CIPR(base) (CAST(VUINT32 *)((base) + 0x0944)) /* CP Int pending */ +#define CIMR(base) (CAST(VUINT32 *)((base) + 0x0948)) /* CP Int mask reg */ +#define CISR(base) (CAST(VUINT32 *)((base) + 0x094C)) /* CP Int in-serv*/ + +/* Input/Output Port register */ + +#define PADIR(base) (CAST(VUINT16 *)((base) + 0x0950)) /* PA data dir*/ +#define PAPAR(base) (CAST(VUINT16 *)((base) + 0x0952)) /* PA pin assign*/ +#define PAODR(base) (CAST(VUINT16 *)((base) + 0x0954)) /* PA open drain*/ +#define PADAT(base) (CAST(VUINT16 *)((base) + 0x0956)) /* PA data reg */ +#define PCDIR(base) (CAST(VUINT16 *)((base) + 0x0960)) /* PC data dir */ +#define PCPAR(base) (CAST(VUINT16 *)((base) + 0x0962)) /* PC pin assign*/ +#define PCSO(base) (CAST(VUINT16 *)((base) + 0x0964)) /* PC options */ +#define PCDAT(base) (CAST(VUINT16 *)((base) + 0x0966)) /* PC data reg */ +#define PCINT(base) (CAST(VUINT16 *)((base) + 0x0968)) /* PC intr ctrl */ +#define PDDIR(base) (CAST(VUINT16 *)((base) + 0x0970)) /* PD data dir */ +#define PDPAR(base) (CAST(VUINT16 *)((base) + 0x0972)) /* PD pin assign*/ +#define PDDAT(base) (CAST(VUINT16 *)((base) + 0x0976)) /* PD data reg */ + +/* CPM timer register set */ + +#define TGCR(base) (CAST(VUINT16 *)((base) + 0x0980)) /* Tmr Global Cfg */ +#define TMR1(base) (CAST(VUINT16 *)((base) + 0x0990)) /* Tmr 1 Mode Reg */ +#define TMR2(base) (CAST(VUINT16 *)((base) + 0x0992)) /* Tmr 2 Mode Reg */ +#define TRR1(base) (CAST(VUINT16 *)((base) + 0x0994)) /* Tmr 1 Ref Reg */ +#define TRR2(base) (CAST(VUINT16 *)((base) + 0x0996)) /* Tmr 2 Ref Reg */ +#define TCR1(base) (CAST(VUINT16 *)((base) + 0x0998)) /* Tmr 1 Capture */ +#define TCR2(base) (CAST(VUINT16 *)((base) + 0x099A)) /* Tmr 2 Capture */ +#define TCN1(base) (CAST(VUINT16 *)((base) + 0x099C)) /* Tmr 1 Counter */ +#define TCN2(base) (CAST(VUINT16 *)((base) + 0x099E)) /* Tmr 2 Counter */ + +#define TMR3(base) (CAST(VUINT16 *)((base) + 0x09A0)) /* Tmr 3 Mode Reg */ +#define TMR4(base) (CAST(VUINT16 *)((base) + 0x09A2)) /* Tmr 4 Mode Reg */ +#define TRR3(base) (CAST(VUINT16 *)((base) + 0x09A4)) /* Tmr 3 Reference*/ +#define TRR4(base) (CAST(VUINT16 *)((base) + 0x09A6)) /* Tmr 4 Reference*/ +#define TCR3(base) (CAST(VUINT16 *)((base) + 0x09A8)) /* Tmr 3 Capture */ +#define TCR4(base) (CAST(VUINT16 *)((base) + 0x09AA)) /* Tmr 4 Capture */ +#define TCN3(base) (CAST(VUINT16 *)((base) + 0x09AC)) /* Tmr 3 Counter */ +#define TCN4(base) (CAST(VUINT16 *)((base) + 0x09AE)) /* Tmr 4 Counter */ + +#define TER1(base) (CAST(VUINT16 *)((base) + 0x09B0)) /* Tmr 1 Event */ +#define TER2(base) (CAST(VUINT16 *)((base) + 0x09B2)) /* Tmr 2 Event */ +#define TER3(base) (CAST(VUINT16 *)((base) + 0x09B4)) /* Tmr 3 Event */ +#define TER4(base) (CAST(VUINT16 *)((base) + 0x09B6)) /* Tmr 4 Event */ + +/* Communication Processor register set */ + +#define CPCR(base) (CAST(VUINT16 *)((base) + 0x09C0)) /* Com Proc Cmd*/ +#define RCCR(base) (CAST(VUINT16 *)((base) + 0x09C4)) /* RISC Config Reg */ +#define RMDS(base) (CAST(VUINT8 *) ((base) + 0x09C7)) /* RISC Dev Sup stat*/ +#define RMDR(base) (CAST(VUINT32 *)((base) + 0x09C8)) /* Mcode Dev ctrl */ +#define RCTR1(base) (CAST(VUINT16 *)((base) + 0x09CC)) /* RISC Ctrl Trap 1*/ +#define RCTR2(base) (CAST(VUINT16 *)((base) + 0x09CE)) /* RISC Ctrl Trap 2*/ +#define RCTR3(base) (CAST(VUINT16 *)((base) + 0x09D0)) /* RISC Ctrl Trap 3*/ +#define RCTR4(base) (CAST(VUINT16 *)((base) + 0x09D2)) /* RISC Ctrl Trap 4*/ +#define RTER(base) (CAST(VUINT16 *)((base) + 0x09D6)) /* RISC Tmr Event*/ +#define RTMR(base) (CAST(VUINT16 *)((base) + 0x09DA)) /* RISC Tmr Mask */ + +/* Baud Rate Generation Register set */ + +#define BRGC1(base) (CAST(VUINT32 *)((base) + 0x09F0)) /* BRG1 Config Reg */ +#define BRGC2(base) (CAST(VUINT32 *)((base) + 0x09F4)) /* BRG2 Config Reg */ +#define BRGC3(base) (CAST(VUINT32 *)((base) + 0x09F8)) /* BRG3 Config Reg */ +#define BRGC4(base) (CAST(VUINT32 *)((base) + 0x09FC)) /* BRG4 Config Reg */ + +/* SCC 1 register set */ + +#define GSMR_L1(base) (CAST(VUINT32 *)((base) + 0x0A00)) /* SCC1 Gen Mode*/ +#define GSMR_H1(base) (CAST(VUINT32 *)((base) + 0x0A04)) /* SCC1 Gen Mode*/ +#define PSMR1(base) (CAST(VUINT16 *)((base) + 0x0A08)) /* SCC1 Proto Spec */ +#define TODR1(base) (CAST(VUINT16 *)((base) + 0x0A0C)) /* SCC1 Tx Demand*/ +#define DSR1(base) (CAST(VUINT16 *)((base) + 0x0A0E)) /* SCC1 Data Sync */ +#define SCCE1(base) (CAST(VUINT16 *)((base) + 0x0A10)) /* SCC1 Event Reg */ +#define SCCM1(base) (CAST(VUINT16 *)((base) + 0x0A14)) /* SCC1 Mask Reg */ +#define SCCS1(base) (CAST(VUINT8 *) ((base) + 0x0A17)) /* SCC1 Status Reg */ + +/* SCC 2 register set */ + +#define GSMR_L2(base) (CAST(VUINT32 *)((base) + 0x0A20)) /* SCC2 Gen Mode*/ +#define GSMR_H2(base) (CAST(VUINT32 *)((base) + 0x0A24)) /* SCC2 Gen Mode*/ +#define PSMR2(base) (CAST(VUINT16 *)((base) + 0x0A28)) /* SCC2 Proto Spec */ +#define TODR2(base) (CAST(VUINT16 *)((base) + 0x0A2C)) /* SCC2 Tx Demand*/ +#define DSR2(base) (CAST(VUINT16 *)((base) + 0x0A2E)) /* SCC2 Data Sync */ +#define SCCE2(base) (CAST(VUINT16 *)((base) + 0x0A30)) /* SCC2 Event Reg */ +#define SCCM2(base) (CAST(VUINT16 *)((base) + 0x0A34)) /* SCC2 Mask Reg */ +#define SCCS2(base) (CAST(VUINT8 *) ((base) + 0x0A37)) /* SCC2 Status Reg */ + +/* SCC 3 register set */ + +#define GSMR_L3(base) (CAST(VUINT32 *)((base) + 0x0A40)) /* SCC3 Gen Mode*/ +#define GSMR_H3(base) (CAST(VUINT32 *)((base) + 0x0A44)) /* SCC3 Gen Mode*/ +#define PSMR3(base) (CAST(VUINT16 *)((base) + 0x0A48)) /* SCC3 Proto Spec */ +#define TODR3(base) (CAST(VUINT16 *)((base) + 0x0A4C)) /* SCC3 Tx Demand*/ +#define DSR3(base) (CAST(VUINT16 *)((base) + 0x0A4E)) /* SCC3 Data Sync */ +#define SCCE3(base) (CAST(VUINT16 *)((base) + 0x0A50)) /* SCC3 Event Reg */ +#define SCCM3(base) (CAST(VUINT16 *)((base) + 0x0A54)) /* SCC3 Mask Reg */ +#define SCCS3(base) (CAST(VUINT8 *) ((base) + 0x0A57)) /* SCC3 Status Reg */ + +/* SCC 4 register set */ + +#define GSMR_L4(base) (CAST(VUINT32 *)((base) + 0x0A60)) /* SCC4 Gen Mode*/ +#define GSMR_H4(base) (CAST(VUINT32 *)((base) + 0x0A64)) /* SCC4 Gen Mode*/ +#define PSMR4(base) (CAST(VUINT16 *)((base) + 0x0A68)) /* SCC4 Proto Spec */ +#define TODR4(base) (CAST(VUINT16 *)((base) + 0x0A6C)) /* SCC4 Tx Demand*/ +#define DSR4(base) (CAST(VUINT16 *)((base) + 0x0A6E)) /* SCC4 Data Sync */ +#define SCCE4(base) (CAST(VUINT16 *)((base) + 0x0A70)) /* SCC4 Event Reg */ +#define SCCM4(base) (CAST(VUINT16 *)((base) + 0x0A74)) /* SCC2 Mask Reg */ +#define SCCS4(base) (CAST(VUINT8 *) ((base) + 0x0A77)) /* SCC4 Status Reg */ + +/* SMC 1 register set */ + +#define SMCMR1(base) (CAST(VUINT16 *)((base) + 0x0A82)) /* SMC1 Mode Reg */ +#define SMCE1(base) (CAST(VUINT8 *) ((base) + 0x0A86)) /* SMC1 Event Reg */ +#define SMCM1(base) (CAST(VUINT8 *) ((base) + 0x0A8A)) /* SMC1 Mask Reg */ + +/* SMC 2 register set */ + +#define SMCMR2(base) (CAST(VUINT16 *)((base) + 0x0A92)) /* SMC2 Mode Reg */ +#define SMCE2(base) (CAST(VUINT8 *) ((base) + 0x0A96)) /* SMC2/PIP Event*/ +#define SMCM2(base) (CAST(VUINT8 *) ((base) + 0x0A9A)) /* SMC2 Mask Reg */ + +/* SPI regiter set */ + +#define SPMODE(base) (CAST(VUINT16 *)((base) + 0x0AA0)) /* SPI Mode Reg */ +#define SPIE(base) (CAST(VUINT8 *) ((base) + 0x0AA6)) /* SPI Event Reg */ +#define SPIM(base) (CAST(VUINT8 *) ((base) + 0x0AAA)) /* SPI Mask Reg */ +#define SPCOM(base) (CAST(VUINT8 *) ((base) + 0x0AAD)) /* SPI Command Reg */ + +/* PIP register set */ + +#define PIPC(base) (CAST(VUINT16 *)((base) + 0x0AB2)) /* PIP Config Reg */ +#define PTPR(base) (CAST(VUINT16 *)((base) + 0x0AB6)) /* PIP Timing parms*/ +#define PBDIR(base) (CAST(VUINT32 *)((base) + 0x0AB8)) /* PB data dir */ +#define PBPAR(base) (CAST(VUINT32 *)((base) + 0x0ABC)) /* PB pin ass*/ +#define PBODR(base) (CAST(VUINT16 *)((base) + 0x0AC2)) /* PB open drain*/ +#define PBDAT(base) (CAST(VUINT32 *)((base) + 0x0AC4)) /* PB Data Reg*/ + +/* SI register set */ + +#define SIMODE(base) (CAST(VUINT32 *)((base) + 0x0AE0)) /* SI Mode Reg */ +#define SIGMR(base) (CAST(VUINT8 *) ((base) + 0x0AE4)) /* SI Global Mode */ +#define SISTR(base) (CAST(VUINT8 *) ((base) + 0x0AE6)) /* SI Status Reg */ +#define SICMR(base) (CAST(VUINT8 *) ((base) + 0x0AE7)) /* SI Command Reg */ +#define SICR(base) (CAST(VUINT32 *)((base) + 0x0AEC)) /* SI Clock route */ +#define SIRP(base) (CAST(VUINT32 *) ((base) + 0x0AF0)) /* SI RAM pointers*/ +#define SIRAM(base) (CAST(VUINT32 *)((base) + 0x0C00)) /* SI Routing RAM */ + +#define MPC860_REGB_OFFSET 0x2000 /* offset to internal registers */ + +/* Data Param RAM */ + +#define DPRAM(base) (CAST(VUINT32 *) ((base) + MPC860_REGB_OFFSET)) + +/* MPC860 Dual Ported Ram addresses */ + +#define MPC860_DPR_SCC1(base) (CAST(VUINT32 *) ((base) + MPC860_REGB_OFFSET \ + + 0x1c00)) + +/* SIU Module Configuration register bit definition (SIUMCR - 0x00) */ + +#define SIUMCR_EARB 0x80000000 /* External Abritation */ +#define SIUMCR_EARP 0x70000000 /* Extern Abri. Request prior.*/ +#define SIUMCR_DSHW 0x00800000 /* Data Showcycles */ +#define SIUMCR_DBGC 0x00600000 /* Debug pins configuration */ +#define SIUMCR_DBPC 0x00180000 /* Debug Port pins Config. */ +#define SIUMCR_FRC 0x00020000 /* FRZ pin Configuration */ +#define SIUMCR_DLK 0x00010000 /* Debug Register Lock */ +#define SIUMCR_PNCS 0x00008000 /* Parity Non-mem Crtl reg */ +#define SIUMCR_OPAR 0x00004000 /* Odd Parity */ +#define SIUMCR_DPC 0x00002000 /* Data Parity pins Config. */ +#define SIUMCR_MPRE 0x00001000 /* Multi CPU Reserva. Enable */ +#define SIUMCR_MLRC_IRQ4 0x00000000 /* Multi Level Reserva. Ctrl */ +#define SIUMCR_MLRC_3STATES 0x00000400 /* Multi Level Reserva. Ctrl */ +#define SIUMCR_MLRC_KR 0x00000800 /* Multi Level Reserva. Ctrl */ +#define SIUMCR_MLRC_SPKROUT 0x00000c00 /* Multi Level Reserva. Ctrl */ +#define SIUMCR_AEME 0x00000200 /* Asynchro External Master */ +#define SIUMCR_SEME 0x00000100 /* Synchro External Master */ +#define SIUMCR_BSC 0x00000080 /* Byte Select Configuration */ +#define SIUMCR_GB5E 0x00000040 /* GPL_B(5) Enable */ +#define SIUMCR_B2DD 0x00000020 /* Bank 2 Double Drive */ +#define SIUMCR_B3DD 0x00000010 /* Bank 3 Double Drive */ + +/* System Portection Control register bit definition (SYPCR - 0x04) */ + +#define SYPCR_SWTC 0xffff0000 /* Software Watchdog Timer Count */ +#define SYPCR_BMT 0x0000ff00 /* Bus Monitor Timing */ +#define SYPCR_BME 0x00000080 /* Bus Monitor Enable */ +#define SYPCR_SWF 0x00000008 /* Software Watchdog Freeze */ +#define SYPCR_SWE 0x00000004 /* Software Watchdog Enable */ +#define SYPCR_SWRI 0x00000002 /* Software Watchdog Reset/Int Select */ +#define SYPCR_SWP 0x00000001 /* Software Watchdog Prescale */ + +/* System Interrupt PENDing register bit definition (SIPEND - 0x10) */ + +#define SIPEND_IRQ0 0x80000000 /* Interrupt IRQ0 pending */ +#define SIPEND_LVL0 0x40000000 /* Interrupt LEVEL 0 pending */ +#define SIPEND_IRQ1 0x20000000 /* Interrupt IRQ1 pending */ +#define SIPEND_LVL1 0x10000000 /* Interrupt LEVEL 1 pending */ +#define SIPEND_IRQ2 0x08000000 /* Interrupt IRQ2 pending */ +#define SIPEND_LVL2 0x04000000 /* Interrupt LEVEL 2 pending */ +#define SIPEND_IRQ3 0x02000000 /* Interrupt IRQ3 pending */ +#define SIPEND_LVL3 0x01000000 /* Interrupt LEVEL 3 pending */ +#define SIPEND_IRQ4 0x00800000 /* Interrupt IRQ4 pending */ +#define SIPEND_LVL4 0x00400000 /* Interrupt LEVEL 4 pending */ +#define SIPEND_IRQ5 0x00200000 /* Interrupt IRQ5 pending */ +#define SIPEND_LVL5 0x00100000 /* Interrupt LEVEL 5 pending */ +#define SIPEND_IRQ6 0x00080000 /* Interrupt IRQ6 pending */ +#define SIPEND_LVL6 0x00040000 /* Interrupt LEVEL 6 pending */ +#define SIPEND_IRQ7 0x00020000 /* Interrupt IRQ7 pending */ +#define SIPEND_LVL7 0x00010000 /* Interrupt LEVEL 7 pending */ + +/* System Interrupt MASK register bit definition (SIMARK - 0x14) */ + +#define SIMASK_IRM0 0x80000000 /* Interrupt IRQ0 mask */ +#define SIMASK_LVM0 0x40000000 /* Interrupt LEVEL 0 mask */ +#define SIMASK_IRM1 0x20000000 /* Interrupt IRQ1 mask */ +#define SIMASK_LVM1 0x10000000 /* Interrupt LEVEL 1 mask */ +#define SIMASK_IRM2 0x08000000 /* Interrupt IRQ2 mask */ +#define SIMASK_LVM2 0x04000000 /* Interrupt LEVEL 2 mask */ +#define SIMASK_IRM3 0x02000000 /* Interrupt IRQ3 mask */ +#define SIMASK_LVM3 0x01000000 /* Interrupt LEVEL 3 mask */ +#define SIMASK_IRM4 0x00800000 /* Interrupt IRQ4 mask */ +#define SIMASK_LVM4 0x00400000 /* Interrupt LEVEL 4 mask */ +#define SIMASK_IRM5 0x00200000 /* Interrupt IRQ5 mask */ +#define SIMASK_LVM5 0x00100000 /* Interrupt LEVEL 5 mask */ +#define SIMASK_IRM6 0x00080000 /* Interrupt IRQ6 mask */ +#define SIMASK_LVM6 0x00040000 /* Interrupt LEVEL 6 mask */ +#define SIMASK_IRM7 0x00020000 /* Interrupt IRQ7 mask */ +#define SIMASK_LVM7 0x00010000 /* Interrupt LEVEL 7 mask */ +#define SIMASK_ALL 0xffff0000 /* All interrupt mask */ + +/* System Interrupt Edge Level mask register bit definition (SIEL - 0x1C) */ + +#define SIEL_ED0 0x80000000 /* Interrupt IRQ0 on falling Edge */ +#define SIEL_WM0 0x40000000 /* Interrupt IRQ0 Wake up Mask */ +#define SIEL_ED1 0x20000000 /* Interrupt IRQ1 on falling Edge */ +#define SIEL_WM1 0x10000000 /* Interrupt IRQ1 Wake up Mask */ +#define SIEL_ED2 0x08000000 /* Interrupt IRQ2 on falling Edge */ +#define SIEL_WM2 0x04000000 /* Interrupt IRQ2 Wake up Mask */ +#define SIEL_ED3 0x02000000 /* Interrupt IRQ3 on falling Edge */ +#define SIEL_WM3 0x01000000 /* Interrupt IRQ3 Wake up Mask */ +#define SIEL_ED4 0x00800000 /* Interrupt IRQ4 on falling Edge */ +#define SIEL_WM4 0x00400000 /* Interrupt IRQ4 Wake up Mask */ +#define SIEL_ED5 0x00200000 /* Interrupt IRQ5 on falling Edge */ +#define SIEL_WM5 0x00100000 /* Interrupt IRQ5 Wake up Mask */ +#define SIEL_ED6 0x00080000 /* Interrupt IRQ6 on falling Edge */ +#define SIEL_WM6 0x00040000 /* Interrupt IRQ6 Wake up Mask */ +#define SIEL_ED7 0x00020000 /* Interrupt IRQ7 on falling Edge */ +#define SIEL_WM7 0x00010000 /* Interrupt IRQ7 Wake up Mask */ + +/* Transfert Error Status register bit definition (TESR - 0x20) */ + +#define TESR_IEXT 0x00002000 /* Instr. External Transfer Error Ack */ +#define TESR_IBM 0x00001000 /* Instr. transfer Monitor Time-Out */ +#define TESR_IPB 0x00000f00 /* Instr. Parity Error on Byte */ +#define TESR_DEXT 0x00000020 /* Data External Transfer Error Ack */ +#define TESR_DBM 0x00000010 /* Data transfer Monitor Time-Out */ +#define TESR_DPB 0x0000000f /* Data Parity Error on Byte */ + +/* Memory STATus register bit definition (MSTAT - 0x178) */ + +#define MSTAT_PER0 0x8000 /* Parity Error bank 0 */ +#define MSTAT_PER1 0x4000 /* Parity Error bank 1 */ +#define MSTAT_PER2 0x2000 /* Parity Error bank 2 */ +#define MSTAT_PER3 0x1000 /* Parity Error bank 3 */ +#define MSTAT_PER4 0x0800 /* Parity Error bank 4 */ +#define MSTAT_PER5 0x0400 /* Parity Error bank 5 */ +#define MSTAT_PER6 0x0200 /* Parity Error bank 6 */ +#define MSTAT_PER7 0x0100 /* Parity Error bank 7 */ +#define MSTAT_WPER 0x0080 /* Write Protection Error */ + +/* Memory Periodic Timer Prescaler Register bit definition (MPTPR - 0x17A) */ + +#define MPTPR_PTP_MSK 0xff00 /* Periodic Timers Prescaler Mask */ +#define MPTPR_PTP_DIV2 0x2000 /* BRGCLK divided by 2 */ +#define MPTPR_PTP_DIV4 0x1000 /* BRGCLK divided by 4 */ +#define MPTPR_PTP_DIV8 0x0800 /* BRGCLK divided by 8 */ +#define MPTPR_PTP_DIV16 0x0400 /* BRGCLK divided by 16 */ +#define MPTPR_PTP_DIV32 0x0200 /* BRGCLK divided by 32 */ +#define MPTPR_PTP_DIV64 0x0100 /* BRGCLK divided by 64 */ + +/* Base Register bit definition (BRx - 0x100) */ + +#define BR_BA_MSK 0xffff8000 /* Base Address Mask */ +#define BR_AT_MSK 0x00007000 /* Address Type Mask */ +#define BR_PS_MSK 0x00000c00 /* Port Size Mask */ +#define BR_PARE 0x00000200 /* Parity Enable */ +#define BR_WP 0x00000100 /* Write Protect */ +#define BR_MS_MSK 0x000000c0 /* Machine Select Mask */ +#define BR_MS_GPCM 0x00000000 /* G.P.C.M. Machine Select */ +#define BR_MS_UPMA 0x00000080 /* U.P.M.A Machine Select */ +#define BR_MS_UPMB 0x000000c0 /* U.P.M.B Machine Select */ +#define BR_V 0x00000001 /* Bank Valid */ +#define BR_PS_8 0x00000400 /* 8 bit port size */ +#define BR_PS_16 0x00000800 /* 16 bit port size */ +#define BR_PS_32 0x00000000 /* 32 bit port size */ + +/* Option Register bit definition (ORx - 0x104) */ + +#define OR_AM_MSK 0xffff8000 /* Address Mask Mask */ +#define OR_ATM_MSK 0x00007000 /* Address Type Mask Mask */ +#define OR_CSNT_SAM 0x00000800 /* Chip Select Negation Time/ Start */ + /* Address Multiplex */ +#define OR_ACS_MSK 0x00000600 /* Address to Chip Select Setup mask */ +#define OR_ACS_DIV1 0x00000000 /* CS is output at the same time */ +#define OR_ACS_DIV4 0x00000400 /* CS is output 1/4 a clock later */ +#define OR_ACS_DIV2 0x00000600 /* CS is output 1/2 a clock later */ +#define OR_BI 0x00000100 /* Burst inhibit */ +#define OR_SCY_MSK 0x000000f0 /* Cycle Lenght in Clocks */ +#define OR_SCY_0_CLK 0x00000000 /* 0 clock cycles wait states */ +#define OR_SCY_1_CLK 0x00000010 /* 1 clock cycles wait states */ +#define OR_SCY_2_CLK 0x00000020 /* 2 clock cycles wait states */ +#define OR_SCY_3_CLK 0x00000030 /* 3 clock cycles wait states */ +#define OR_SCY_4_CLK 0x00000040 /* 4 clock cycles wait states */ +#define OR_SCY_5_CLK 0x00000050 /* 5 clock cycles wait states */ +#define OR_SCY_6_CLK 0x00000060 /* 6 clock cycles wait states */ +#define OR_SCY_7_CLK 0x00000070 /* 7 clock cycles wait states */ +#define OR_SCY_8_CLK 0x00000080 /* 8 clock cycles wait states */ +#define OR_SCY_9_CLK 0x00000090 /* 9 clock cycles wait states */ +#define OR_SCY_10_CLK 0x000000a0 /* 10 clock cycles wait states */ +#define OR_SCY_11_CLK 0x000000b0 /* 11 clock cycles wait states */ +#define OR_SCY_12_CLK 0x000000c0 /* 12 clock cycles wait states */ +#define OR_SCY_13_CLK 0x000000d0 /* 13 clock cycles wait states */ +#define OR_SCY_14_CLK 0x000000e0 /* 14 clock cycles wait states */ +#define OR_SCY_15_CLK 0x000000f0 /* 15 clock cycles wait states */ +#define OR_SETA 0x00000008 /* External Transfer Acknowledge */ +#define OR_TRLX 0x00000004 /* Timing Relaxed */ + +/* Memory Command Register bit definition (MCR - 0x168) */ + +#define MCR_OP_WRITE 0x00000000 /* Command Opcode: Write */ +#define MCR_OP_READ 0x40000000 /* Command Opcode: Read */ +#define MCR_OP_RUN 0x80000000 /* Command Opcode: Run */ +#define MCR_UM_MSK 0x00800000 /* User Machine mask */ +#define MCR_UM_UPMA 0x00000000 /* User Machine = UPMA */ +#define MCR_UM_UPMB 0x00800000 /* User Machine = UPMB */ +#define MCR_MB_MSK 0x0000e000 /* Memory Bank mask */ +#define MCR_MB_CS0 0x00000000 /* CS0 enabled */ +#define MCR_MB_CS1 0x00002000 /* CS1 enabled */ +#define MCR_MB_CS2 0x00004000 /* CS3 enabled */ +#define MCR_MB_CS3 0x00006000 /* CS3 enabled */ +#define MCR_MB_CS4 0x00008000 /* CS4 enabled */ +#define MCR_MB_CS5 0x0000a000 /* CS5 enabled */ +#define MCR_MB_CS6 0x0000c000 /* CS6 enabled */ +#define MCR_MB_CS7 0x0000e000 /* CS7 enabled */ +#define MCR_MCLF_MSK 0x00000f00 /* Memory Command Loop Field mask */ +#define MCR_MCLF_1X 0x00000100 /* The Cmd Loop is executed 1 time */ +#define MCR_MCLF_2X 0x00000200 /* The Cmd Loop is executed 2 times */ +#define MCR_MCLF_3X 0x00000300 /* The Cmd Loop is executed 3 times */ +#define MCR_MCLF_4X 0x00000400 /* The Cmd Loop is executed 4 times */ +#define MCR_MCLF_5X 0x00000500 /* The Cmd Loop is executed 5 times */ +#define MCR_MCLF_6X 0x00000600 /* The Cmd Loop is executed 6 times */ +#define MCR_MCLF_7X 0x00000700 /* The Cmd Loop is executed 7 times */ +#define MCR_MCLF_8X 0x00000800 /* The Cmd Loop is executed 8 times */ +#define MCR_MCLF_9X 0x00000900 /* The Cmd Loop is executed 9 times */ +#define MCR_MCLF_10X 0x00000a00 /* The Cmd Loop is executed 10 times */ +#define MCR_MCLF_11X 0x00000b00 /* The Cmd Loop is executed 11 times */ +#define MCR_MCLF_12X 0x00000c00 /* The Cmd Loop is executed 12 times */ +#define MCR_MCLF_13X 0x00000d00 /* The Cmd Loop is executed 13 times */ +#define MCR_MCLF_14X 0x00000e00 /* The Cmd Loop is executed 14 times */ +#define MCR_MCLF_15X 0x00000f00 /* The Cmd Loop is executed 15 times */ +#define MCR_MCLF_16X 0x00000000 /* The Cmd Loop is executed 16 times */ +#define MCR_MAD_MSK 0x0000003f /* Machine Address mask */ + +/* Machine A Mode Register bit definition (MAMR - 0x170) */ + +#define MAMR_PTA_MSK 0xff000000 /* Periodic Timer A period mask */ +#define MAMR_PTA_SHIFT 0x00000018 /* Periodic Timer A period shift */ +#define MAMR_PTAE 0x00800000 /* Periodic Timer A Enable */ +#define MAMR_AMA_MSK 0x00700000 /* Addess Multiplexing size A */ +#define MAMR_AMA_TYPE_0 0x00000000 /* Addess Multiplexing Type 0 */ +#define MAMR_AMA_TYPE_1 0x00100000 /* Addess Multiplexing Type 1 */ +#define MAMR_AMA_TYPE_2 0x00200000 /* Addess Multiplexing Type 2 */ +#define MAMR_AMA_TYPE_3 0x00300000 /* Addess Multiplexing Type 3 */ +#define MAMR_AMA_TYPE_4 0x00400000 /* Addess Multiplexing Type 4 */ +#define MAMR_AMA_TYPE_5 0x00500000 /* Addess Multiplexing Type 5 */ +#define MAMR_DSA_MSK 0x00060000 /* Disable Timer period mask */ +#define MAMR_DSA_1_CYCL 0x00000000 /* 1 cycle Disable Period */ +#define MAMR_DSA_2_CYCL 0x00020000 /* 2 cycle Disable Period */ +#define MAMR_DSA_3_CYCL 0x00040000 /* 3 cycle Disable Period */ +#define MAMR_DSA_4_CYCL 0x00060000 /* 4 cycle Disable Period */ +#define MAMR_G0CLA_MSK 0x0000e000 /* General Line 0 Control A */ +#define MAMR_G0CLA_A12 0x00000000 /* General Line 0 : A12 */ +#define MAMR_G0CLA_A11 0x00002000 /* General Line 0 : A11 */ +#define MAMR_G0CLA_A10 0x00004000 /* General Line 0 : A10 */ +#define MAMR_G0CLA_A9 0x00006000 /* General Line 0 : A9 */ +#define MAMR_G0CLA_A8 0x00008000 /* General Line 0 : A8 */ +#define MAMR_G0CLA_A7 0x0000a000 /* General Line 0 : A7 */ +#define MAMR_G0CLA_A6 0x0000b000 /* General Line 0 : A6 */ +#define MAMR_G0CLA_A5 0x0000e000 /* General Line 0 : A5 */ +#define MAMR_GPL_A4DIS 0x00001000 /* GPL_A4 ouput line Disable */ +#define MAMR_RLFA_MSK 0x00000f00 /* Read Loop Field A mask */ +#define MAMR_RLFA_1X 0x00000100 /* The Read Loop is executed 1 time */ +#define MAMR_RLFA_2X 0x00000200 /* The Read Loop is executed 2 times */ +#define MAMR_RLFA_3X 0x00000300 /* The Read Loop is executed 3 times */ +#define MAMR_RLFA_4X 0x00000400 /* The Read Loop is executed 4 times */ +#define MAMR_RLFA_5X 0x00000500 /* The Read Loop is executed 5 times */ +#define MAMR_RLFA_6X 0x00000600 /* The Read Loop is executed 6 times */ +#define MAMR_RLFA_7X 0x00000700 /* The Read Loop is executed 7 times */ +#define MAMR_RLFA_8X 0x00000800 /* The Read Loop is executed 8 times */ +#define MAMR_RLFA_9X 0x00000900 /* The Read Loop is executed 9 times */ +#define MAMR_RLFA_10X 0x00000a00 /* The Read Loop is executed 10 times */ +#define MAMR_RLFA_11X 0x00000b00 /* The Read Loop is executed 11 times */ +#define MAMR_RLFA_12X 0x00000c00 /* The Read Loop is executed 12 times */ +#define MAMR_RLFA_13X 0x00000d00 /* The Read Loop is executed 13 times */ +#define MAMR_RLFA_14X 0x00000e00 /* The Read Loop is executed 14 times */ +#define MAMR_RLFA_15X 0x00000f00 /* The Read Loop is executed 15 times */ +#define MAMR_RLFA_16X 0x00000000 /* The Read Loop is executed 16 times */ +#define MAMR_WLFA_MSK 0x000000f0 /* Write Loop Field A mask */ +#define MAMR_WLFA_1X 0x00000010 /* The Write Loop is executed 1 time */ +#define MAMR_WLFA_2X 0x00000020 /* The Write Loop is executed 2 times */ +#define MAMR_WLFA_3X 0x00000030 /* The Write Loop is executed 3 times */ +#define MAMR_WLFA_4X 0x00000040 /* The Write Loop is executed 4 times */ +#define MAMR_WLFA_5X 0x00000050 /* The Write Loop is executed 5 times */ +#define MAMR_WLFA_6X 0x00000060 /* The Write Loop is executed 6 times */ +#define MAMR_WLFA_7X 0x00000070 /* The Write Loop is executed 7 times */ +#define MAMR_WLFA_8X 0x00000080 /* The Write Loop is executed 8 times */ +#define MAMR_WLFA_9X 0x00000090 /* The Write Loop is executed 9 times */ +#define MAMR_WLFA_10X 0x000000a0 /* The Write Loop is executed 10 times*/ +#define MAMR_WLFA_11X 0x000000b0 /* The Write Loop is executed 11 times*/ +#define MAMR_WLFA_12X 0x000000c0 /* The Write Loop is executed 12 times*/ +#define MAMR_WLFA_13X 0x000000d0 /* The Write Loop is executed 13 times*/ +#define MAMR_WLFA_14X 0x000000e0 /* The Write Loop is executed 14 times*/ +#define MAMR_WLFA_15X 0x000000f0 /* The Write Loop is executed 15 times*/ +#define MAMR_WLFA_16X 0x00000000 /* The Write Loop is executed 16 times*/ +#define MAMR_TLFA_MSK 0x0000000f /* Timer Loop Field A mask */ +#define MAMR_TLFA_1X 0x00000001 /* The Timer Loop is executed 1 time */ +#define MAMR_TLFA_2X 0x00000002 /* The Timer Loop is executed 2 times */ +#define MAMR_TLFA_3X 0x00000003 /* The Timer Loop is executed 3 times */ +#define MAMR_TLFA_4X 0x00000004 /* The Timer Loop is executed 4 times */ +#define MAMR_TLFA_5X 0x00000005 /* The Timer Loop is executed 5 times */ +#define MAMR_TLFA_6X 0x00000006 /* The Timer Loop is executed 6 times */ +#define MAMR_TLFA_7X 0x00000007 /* The Timer Loop is executed 7 times */ +#define MAMR_TLFA_8X 0x00000008 /* The Timer Loop is executed 8 times */ +#define MAMR_TLFA_9X 0x00000009 /* The Timer Loop is executed 9 times */ +#define MAMR_TLFA_10X 0x0000000a /* The Timer Loop is executed 10 times*/ +#define MAMR_TLFA_11X 0x0000000b /* The Timer Loop is executed 11 times*/ +#define MAMR_TLFA_12X 0x0000000c /* The Timer Loop is executed 12 times*/ +#define MAMR_TLFA_13X 0x0000000d /* The Timer Loop is executed 13 times*/ +#define MAMR_TLFA_14X 0x0000000e /* The Timer Loop is executed 14 times*/ +#define MAMR_TLFA_15X 0x0000000f /* The Timer Loop is executed 15 times*/ +#define MAMR_TLFA_16X 0x00000000 /* The Timer Loop is executed 16 times*/ + +/* Machine B Mode Register bit definition (MBMR - 0x174) */ + +#define MAMR_PTB_MSK 0xff000000 /* Periodic Timer B period mask */ +#define MAMR_PTBE 0x00800000 /* Periodic Timer B Enable */ +#define MAMR_AMB_MSK 0x00700000 /* Addess Multiplex size B */ +#define MAMR_DSB_MSK 0x00060000 /* Disable Timer period mask */ +#define MAMR_DSB_1_CYCL 0x00000000 /* 1 cycle Disable Period */ +#define MAMR_DSB_2_CYCL 0x00020000 /* 2 cycle Disable Period */ +#define MAMR_DSB_3_CYCL 0x00040000 /* 3 cycle Disable Period */ +#define MAMR_DSB_4_CYCL 0x00060000 /* 4 cycle Disable Period */ +#define MAMR_G0CLB_MSK 0x0000e000 /* General Line 0 Control B */ +#define MAMR_G0CLB_A12 0x00000000 /* General Line 0 : A12 */ +#define MAMR_G0CLB_A11 0x00002000 /* General Line 0 : A11 */ +#define MAMR_G0CLB_A10 0x00004000 /* General Line 0 : A10 */ +#define MAMR_G0CLB_A9 0x00006000 /* General Line 0 : A9 */ +#define MAMR_G0CLB_A8 0x00008000 /* General Line 0 : A8 */ +#define MAMR_G0CLB_A7 0x0000a000 /* General Line 0 : A7 */ +#define MAMR_G0CLB_A6 0x0000b000 /* General Line 0 : A6 */ +#define MAMR_G0CLB_A5 0x0000e000 /* General Line 0 : A5 */ +#define MAMR_GPL_B4DIS 0x00001000 /* GPL_B4 ouput line Disable */ +#define MAMR_RLFB_MSK 0x00000f00 /* Read Loop Field B mask */ +#define MAMR_RLFB_1X 0x00000100 /* The Read Loop is executed 1 time */ +#define MAMR_RLFB_2X 0x00000200 /* The Read Loop is executed 2 times */ +#define MAMR_RLFB_3X 0x00000300 /* The Read Loop is executed 3 times */ +#define MAMR_RLFB_4X 0x00000400 /* The Read Loop is executed 4 times */ +#define MAMR_RLFB_5X 0x00000500 /* The Read Loop is executed 5 times */ +#define MAMR_RLFB_6X 0x00000600 /* The Read Loop is executed 6 times */ +#define MAMR_RLFB_7X 0x00000700 /* The Read Loop is executed 7 times */ +#define MAMR_RLFB_8X 0x00000800 /* The Read Loop is executed 8 times */ +#define MAMR_RLFB_9X 0x00000900 /* The Read Loop is executed 9 times */ +#define MAMR_RLFB_10X 0x00000a00 /* The Read Loop is executed 10 times */ +#define MAMR_RLFB_11X 0x00000b00 /* The Read Loop is executed 11 times */ +#define MAMR_RLFB_12X 0x00000c00 /* The Read Loop is executed 12 times */ +#define MAMR_RLFB_13X 0x00000d00 /* The Read Loop is executed 13 times */ +#define MAMR_RLFB_14X 0x00000e00 /* The Read Loop is executed 14 times */ +#define MAMR_RLFB_15X 0x00000f00 /* The Read Loop is executed 15 times */ +#define MAMR_RLFB_16X 0x00000000 /* The Read Loop is executed 16 times */ +#define MAMR_WLFB_MSK 0x000000f0 /* Write Loop Field B mask */ +#define MAMR_WLFB_1X 0x00000010 /* The Write Loop is executed 1 time */ +#define MAMR_WLFB_2X 0x00000020 /* The Write Loop is executed 2 times */ +#define MAMR_WLFB_3X 0x00000030 /* The Write Loop is executed 3 times */ +#define MAMR_WLFB_4X 0x00000040 /* The Write Loop is executed 4 times */ +#define MAMR_WLFB_5X 0x00000050 /* The Write Loop is executed 5 times */ +#define MAMR_WLFB_6X 0x00000060 /* The Write Loop is executed 6 times */ +#define MAMR_WLFB_7X 0x00000070 /* The Write Loop is executed 7 times */ +#define MAMR_WLFB_8X 0x00000080 /* The Write Loop is executed 8 times */ +#define MAMR_WLFB_9X 0x00000090 /* The Write Loop is executed 9 times */ +#define MAMR_WLFB_10X 0x000000a0 /* The Write Loop is executed 10 times*/ +#define MAMR_WLFB_11X 0x000000b0 /* The Write Loop is executed 11 times*/ +#define MAMR_WLFB_12X 0x000000c0 /* The Write Loop is executed 12 times*/ +#define MAMR_WLFB_13X 0x000000d0 /* The Write Loop is executed 13 times*/ +#define MAMR_WLFB_14X 0x000000e0 /* The Write Loop is executed 14 times*/ +#define MAMR_WLFB_15X 0x000000f0 /* The Write Loop is executed 15 times*/ +#define MAMR_WLFB_16X 0x00000000 /* The Write Loop is executed 16 times*/ +#define MAMR_TLFB_MSK 0x0000000f /* Timer Loop Field B mask */ +#define MAMR_TLFB_1X 0x00000001 /* The Timer Loop is executed 1 time */ +#define MAMR_TLFB_2X 0x00000002 /* The Timer Loop is executed 2 times */ +#define MAMR_TLFB_3X 0x00000003 /* The Timer Loop is executed 3 times */ +#define MAMR_TLFB_4X 0x00000004 /* The Timer Loop is executed 4 times */ +#define MAMR_TLFB_5X 0x00000005 /* The Timer Loop is executed 5 times */ +#define MAMR_TLFB_6X 0x00000006 /* The Timer Loop is executed 6 times */ +#define MAMR_TLFB_7X 0x00000007 /* The Timer Loop is executed 7 times */ +#define MAMR_TLFB_8X 0x00000008 /* The Timer Loop is executed 8 times */ +#define MAMR_TLFB_9X 0x00000009 /* The Timer Loop is executed 9 times */ +#define MAMR_TLFB_10X 0x0000000a /* The Timer Loop is executed 10 times*/ +#define MAMR_TLFB_11X 0x0000000b /* The Timer Loop is executed 11 times*/ +#define MAMR_TLFB_12X 0x0000000c /* The Timer Loop is executed 12 times*/ +#define MAMR_TLFB_13X 0x0000000d /* The Timer Loop is executed 13 times*/ +#define MAMR_TLFB_14X 0x0000000e /* The Timer Loop is executed 14 times*/ +#define MAMR_TLFB_15X 0x0000000f /* The Timer Loop is executed 15 times*/ +#define MAMR_TLFB_16X 0x00000000 /* The Timer Loop is executed 16 times*/ + +/* Time Base Status and Contol register bit definition (TBSCR - 0x200) */ + +#if FALSE /* XXX TPR TO verify */ + +#define TBSCR_TBIRQ0 0x0100 /* Time Base Interrupt Request 0 */ +#define TBSCR_TBIRQ1 0x0200 /* Time Base Interrupt Request 1 */ +#define TBSCR_TBIRQ2 0x0400 /* Time Base Interrupt Request 2 */ +#define TBSCR_TBIRQ3 0x0800 /* Time Base Interrupt Request 3 */ +#define TBSCR_TBIRQ4 0x1000 /* Time Base Interrupt Request 4 */ +#define TBSCR_TBIRQ5 0x2000 /* Time Base Interrupt Request 5 */ +#define TBSCR_TBIRQ6 0x4000 /* Time Base Interrupt Request 6 */ +#define TBSCR_TBIRQ7 0x8000 /* Time Base Interrupt Request 7 */ + +#endif + +#define TBSCR_REFA 0x0080 /* Reference Interrupt Status A */ +#define TBSCR_REFB 0x0040 /* Reference Interrupt Status B */ +#define TBSCR_REFAE 0x0008 /* Second Interrupt Enable A */ +#define TBSCR_REFBE 0x0004 /* Second Interrupt Enable B */ +#define TBSCR_TBF 0x0002 /* Time Base Freeze */ +#define TBSCR_TBE 0x0001 /* Time Base Enable */ + +/* Real Time Clock Status and Control register bit definition (RTCSC - 0x220) */ + +#define RTCSC_RTCIRQ +#define RTCSC_SEC 0x0080 /* Once per Second interrupt */ +#define RTCSC_ALR 0x0040 /* Alarm interrupt */ +#define RTCSC_38K 0x0010 /* Real Time Clock at 38.4 KHz */ +#define RTCSC_SIE 0x0008 /* Second Interrupt Enable */ +#define RTCSC_ALE 0x0004 /* Alarm Interrupt Enable */ +#define RTCSC_RTF 0x0002 /* Real Time Clock Freeze */ +#define RTCSC_RTE 0x0001 /* Real Time Clock Enable */ + +/* PIT Status and Control Register bit definition (PISCR - 0x0240) */ + +#define PISCR_PIRQ +#define PISCR_PS 0x0080 /* Periodic interrupt Status */ +#define PISCR_PIE 0x0004 /* Periodic Interrupt Enable */ +#define PISCR_PITF 0x0002 /* Periodic Interrupt Timer Freeze */ +#define PISCR_PTE 0x0001 /* Periodic Timer Enable */ + +/* System Clock Control Register bit definition (SCCR - 0x280) */ + +#define SCCR_COM_MSK 0x60000000 /* Clock Output Mode Mask */ +#define SCCR_TBS 0x02000000 /* Time Base Source */ +#define SCCR_RTDIV 0x01000000 /* RTC Clock Dive */ +#define SCCR_RTSEL 0x00800000 /* RTC circuit input source select */ +#define SCCR_CRQEN 0x00400000 /* CPM Request Enable */ +#define SCCR_PRQEN 0x00200000 /* Power Management Request Enable */ +#define SCCR_DFSYNC_MSK 0x00006000 /* Division Factor of SyncCLK Mask */ +#define SCCR_DFBRG_MSK 0x00001800 /* Division Factor of BRGCLK Mask */ +#define SCCR_DFBRG_SHIFT 0x000c /* Division Factor of BRGCLK shift */ +#define SCCR_DFNL_MSK 0x00000700 /* Division Factor Low Frequency Mask */ +#define SCCR_DFNH_MSK 0x000000e0 /* Division Factor High Frequency Mask*/ +#define SCCR_DFLCD_MSK 0x0000001c /* Division Factor of LCD Clock Mask */ +#define SCCR_DFALCD_MSK 0x00000002 /* Add. Division Factor of LCD Clock */ + +/* Pll, Low Power and Reset Control Register bit definition (PLPRCR - 284) */ + +#define PLPRCR_MF_MSK 0xfff00000 /* Multiplication factor bits */ +#define PLPRCR_MF_SHIFT 0x00000014 /* Multiplication factor shift value */ +#define PLPRCR_SPLSS 0x00008000 /* SPLL Lock Status Sticky bit */ +#define PLPRCR_TEXPS 0x00004000 /* TEXP Status */ +#define PLPRCR_TMIST 0x00001000 /* Timers Interrupt Status */ +#define PLPRCR_CSRC 0x00000400 /* Clock Source */ +#define PLPRCR_LPM_MSK 0x00000300 /* Low Power Mode mask */ +#define PLPRCR_LPM_NORMAL 0x00000000 /* normal power management mode */ +#define PLPRCR_LPM_DOZE 0x00000100 /* doze power management mode */ +#define PLPRCR_LPM_SLEEP 0x00000200 /* sleep power management mode */ +#define PLPRCR_LPM_DEEP_SLEEP 0x00000300 /* deep sleep power mgt mode */ +#define PLPRCR_LPM_DOWN 0x00000300 /* down power management mode */ +#define PLPRCR_CSR 0x00000080 /* CheskStop Reset value */ +#define PLPRCR_LOLRE 0x00000040 /* Loss Of Lock Reset Enable */ +#define PLPRCR_FIOPD 0x00000020 /* Force I/O Pull Down */ + +/* Additional PLPRCR bit definitions for the MPC866 */ + +#define PLPRCR_MFN_MSK 0xf8000000 /* Numerator of the multiplication factor */ +#define PLPRCR_MFN_SHIFT 0x0000001b /* Numerator shift */ +#define PLPRCR_MFD_MSK 0x07c00000 /* Denominator minus 1 of the multiplication factor */ +#define PLPRCR_MFD_SHIFT 0x00000016 /* Denominator shift */ +#define PLPRCR_S_MSK 0x00300000 /* Divider after the Double Clock */ +#define PLPRCR_S_SHIFT 0x00000014 /* Divider shift */ +#define PLPRCR_MFI_MSK 0x000f0000 /* Interger part of the multiplication factor */ +#define PLPRCR_MFI_SHIFT 0x00000010 /* Interger part shift */ +#define PLPRCR_PDF_MSK 0x0000001e /* Predivision factor minus 1 */ +#define PLPRCR_PDF_SHIFT 0x00000001 /* Predivision shift */ +#define PLPRCR_DBRMO_MSK 0x00000001 /* DPLL BRM Order bit */ +#define PLPRCR_DBRMO_SHIFT 0x00000000 /* DPLL BRM shift */ + +/* LCD register bit definitions */ + +#define LCD_ENABLE 0x0010 + +/* LCD Panel Configuration Register (LCCR) 0x0840 */ + +#define LCD_IEN 0x00008000 /* LCD interrupt enable */ +#define LCD_CLKP 0x00000800 /* LCD Clock Polarity */ +#define LCD_OEP 0x00000400 /* LCD Output Enable Polarity */ +#define LCD_HSP 0x00000200 /* LCD horizontal sync polarity */ +#define LCD_VSP 0x00000100 /* LCD vertical sync polarity */ +#define LCD_DP 0x00000080 /* LCD data polarity */ +#define LCD_BPIX 0x00000060 /* LCD bits per pixel mask */ +#define LCD_BPIX_8 0x00000060 /* eight bits per pixel setting */ +#define LCD_BPIX_4 0x00000040 /* four bits per pixel setting */ +#define LCD_BPIX_2 0x00000020 /* two bits per pixel setting */ +#define LCD_BPIX_1 0x00000000 /* one bit per pixel setting */ +#define LCD_LBW 0x00000010 /* LCD Bus width */ +#define LCD_LBW_8 0x00000010 /* LCD Bus width 8 */ +#define LCD_LBW_4 0x00000000 /* LCD Bus width 4 */ +#define LCD_SPLT 0x00000008 /* LCD split display mode */ +#define LCD_CLOR 0x00000004 /* LCD color display */ +#define LCD_TFT 0x00000002 /* LCD TFT display */ +#define LCD_PON 0x00000001 /* Panel On/Off control bit */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCppc860Siuh */ diff --git a/h/drv/multi/smcFdc37b78x.h b/h/drv/multi/smcFdc37b78x.h new file mode 100644 index 0000000..8594a08 --- /dev/null +++ b/h/drv/multi/smcFdc37b78x.h @@ -0,0 +1,190 @@ +/* smcFdc37b78x.h - a super i/o initialization include module */ + +/* Copyright 1984-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,28mar00,mks written. +*/ + +/* +DESCRIPTION +This file contains mnemonics for SUPER I/0 (fdc37b78x) chip initialization. +*/ + +#ifndef INCsmcfdc37b78xh +#define INCsmcfdc37b78xh + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* defines */ + +/* wiring-dependent SMCFDC37B78X variables */ +#ifndef SMCFDC37B78X_CONFIG_PORT +#define SMCFDC37B78X_CONFIG_PORT 0x0370 +#endif + +#ifndef SMCFDC37B78X_INDEX_PORT +#define SMCFDC37B78X_INDEX_PORT 0x0370 +#endif + +#ifndef SMCFDC37B78X_DATA_PORT +#define SMCFDC37B78X_DATA_PORT (SMCFDC37B78X_INDEX_PORT + 1) +#endif + +#define SMCFDC37B78XWRT(ioPort, value) sysOutByte (ioPort, value) +#define SMCFDC37B78XRD(ioPort) sysInByte (ioPort) + +/* configuration mode begin command */ +#define SMCFDC37B78X_CONFIG_START 0x55 +/* configuration mode end command */ +#define SMCFDC37B78X_CONFIG_END 0xAA + +/* chip level registers */ + +/* logical device configuration register */ +#define SMCFDC37B7X_LOGDEVCFGREG 0x07 + +/* logical device level registers */ +#define SMCFDC37B78X_LOGDEV_ACTIVATE 0x30 /* activation register */ +#define SMCFDC37B78X_IOBASE_HIGH 0x60 /* i/o base - high byte */ +#define SMCFDC37B78X_IOBASE_LOW 0x61 /* i/o base - low byte */ +#define SMCFDC37B78X_INTERRUPT 0x70 /* interrupt config */ +#define SMCFDC37B78X_MODE 0xF0 /* mode register */ + +/* defined logical devices */ +#define SMCFDC37B78X_FDD 0x00 /* floppy disk drive */ +#define SMCFDC37B78X_LPT1 0x03 /* parallel port */ +#define SMCFDC37B78X_COM1 0x04 /* serial device - port 1 */ +#define SMCFDC37B78X_COM2 0x05 /* serial device - port 2 */ +#define SMCFDC37B78X_KBD 0x07 /* keyboard */ +#define SMCFDC37B78X_AUX 0x08 /* auxiliary i/o */ +#define SMCFDC37B78X_ACPI 0x0A /* ACPI */ + +/* use these defines for enabling specific device. DON'T USE ONE ABOVE. */ +#define SMCFDC37B78X_FDD_EN 0x01 /* floppy disk drive */ +#define SMCFDC37B78X_LPT1_EN 0x02 /* parallel port */ +#define SMCFDC37B78X_COM1_EN 0x04 /* serial device - port 1 */ +#define SMCFDC37B78X_COM2_EN 0x08 /* serial device - port 2 */ +#define SMCFDC37B78X_KBD_EN 0x10 /* keyboard */ + +/* device specific intialization values */ + +#define SMCFDC37B78X_ACT_DEV 0x01 /* activate device */ +#define SMCFDC37B78X_COM_HSM 0x02 /* enable high speed services on COM */ + +#define SMCFDC37B78X_INTR_KBD 0x01 /* irq line # 1 tied to KBD */ +#define SMCFDC37B78X_INTR_COM1 0x04 /* irq line # 4 tied to COM 1 */ +#define SMCFDC37B78X_INTR_COM2 0x03 /* irq line # 5 tied to COM 2 */ +#define SMCFDC37B78X_INTR_LPT1 0x07 /* irq line # 7 tied to LPT */ + +#define SMCFDC37B78X_COM_MCR 0x04 +#define SMCFDC37B78X_COM_MCROUT2 0x08 +#define SMCFDC37B78X_COM_MCROUT2_MASK 0x08 + +#define SMCFDC37B78X_COM1_IOHIGH 0x03 /* COM1, i/o high byte */ +#define SMCFDC37B78X_COM1_IOLOW 0xF8 /* COM1, i/o low byte */ +#define SMCFDC37B78X_COM1_IOBASE 0x03F8 /* COM1, i/o address */ +#define SMCFDC37B78X_COM1_MCR (SMCFDC37B78X_COM1_IOBASE + \ + SMCFDC37B78X_COM_MCR) + +#define SMCFDC37B78X_COM2_IOHIGH 0x02 /* COM2, i/o high byte */ +#define SMCFDC37B78X_COM2_IOLOW 0xF8 /* COM2, i/o low byte */ +#define SMCFDC37B78X_COM2_IOBASE 0x02F8 /* COM2, i/o address */ +#define SMCFDC37B78X_COM2_MCR (SMCFDC37B78X_COM2_IOBASE + \ + SMCFDC37B78X_COM_MCR) + +#define SMCFDC37B78X_LPT1_IOHIGH 0x03 /* LPT1, i/o high byte */ +#define SMCFDC37B78X_LPT1_IOLOW 0xBC /* LPT1, i/o low byte */ +#define SMCFDC37B78X_LPT1_IOBASE 0x03BC /* LPT1, i/o address */ + +/* GPIO Stuff */ + +#define SMCFDC37B78X_IRQMUX_IDX 0xC0 /* IRQ Mux register */ +#define SMCFDC37B78X_IRQ_PARALLEL 0x07 + +#define SMCFDC37B78X_GP53_INDEX 0xD4 /* IRQ 2 pin */ +#define SMCFDC37B78X_GP53_IRQ11_OUT 0x08 +#define SMCFDC37B78X_GP60_INDEX 0xD0 /* IRQ 1 pin */ +#define SMCFDC37B78X_GP60_IRQ1_OUT 0x08 +#define SMCFDC37B78X_GP61_INDEX 0xD1 /* IRQ 3 pin */ +#define SMCFDC37B78X_GP61_IRQ3_OUT 0x08 +#define SMCFDC37B78X_GP62_INDEX 0xD2 /* IRQ 4 pin */ +#define SMCFDC37B78X_GP62_IRQ4_OUT 0x08 +#define SMCFDC37B78X_GP64_INDEX 0xD4 /* IRQ 6 pin */ +#define SMCFDC37B78X_GP64_IRQ6_OUT 0x08 +#define SMCFDC37B78X_GP65_INDEX 0xD5 /* IRQ 7 pin */ +#define SMCFDC37B78X_GP65_IRQ7_OUT 0x08 + +/* defined masks */ +#define SMCFDC37B78X_COM_HSM_MASK 0x00 +#define SMCFDC37B78X_GP_FUNC_MASK 0xBB +#define SMCFDC37B78X_IRQ_PARALLEL_MASK 0x07 +#define SMCFDC37B78X_MASK_ALL 0xFF + +/* keyboard specific defines */ +#define SMCFDC37B78X_KBD_DATA 0x60 /* ISA port addresses */ +#define SMCFDC37B78X_KBD_CTLSTS 0x64 + +#define SMCFDC37B78X_KBD_CCMD_SELFTEST 0xAA /* kbd controller commands */ +#define SMCFDC37B78X_KBD_CCMD_IFCTEST 0xAB +#define SMCFDC37B78X_KBD_CCMD_WRTPORT2 0xD1 + +#define SMCFDC37B78X_KBD_CTLSTS_IBF 0x2 /* kbd status bit [1:0] */ +#define SMCFDC37B78X_KBD_CTLSTS_OBF 0x1 + +#define SMCFDC37B78X_KBD_SELFTEST_PASS 0x55 +#define SMCFDC37B78X_KBD_IFCTEST_PASS 0x00 +#define SMCFDC37B78X_KBD_IRQ_KSC_EN 0xD3 + +#define SMCFDC37B78X_KBD_DELAY() sysWait() + +#define SMCFDC37B78X_KBD_RD_DATA() (SMCFDC37B78X_KBD_DELAY(), \ + sysInByte (SMCFDC37B78X_KBD_DATA)) +#define SMCFDC37B78X_KBD_RD_CTLSTS() (SMCFDC37B78X_KBD_DELAY(), \ + sysInByte (SMCFDC37B78X_KBD_CTLSTS)) +#define SMCFDC37B78X_KBD_WRT_DATA(x) (SMCFDC37B78X_KBD_DELAY(), \ + sysOutByte (SMCFDC37B78X_KBD_DATA, x)) +#define SMCFDC37B78X_KBD_WRT_CTLSTS(x) (SMCFDC37B78X_KBD_DELAY(), \ + sysOutByte (SMCFDC37B78X_KBD_CTLSTS, x)) + +/* typedefs */ + +typedef struct smcFdc37b78x_IoPorts + { + int config; + int index; + int data; + } SMCFDC37B78X_IOPORTS; + +/* function declarations */ + +extern VOID smcFdc37b78xDevCreate (SMCFDC37B78X_IOPORTS *fdc37b78x_iop); +extern VOID smcFdc37b78xInit (int devInitMask); +extern STATUS smcFdc37b78xKbdInit (VOID); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* INCsmcfdc37b78xh */ + + + + + + + + + + + + + + + + + diff --git a/h/drv/multi/stp2003.h b/h/drv/multi/stp2003.h new file mode 100644 index 0000000..918c9df --- /dev/null +++ b/h/drv/multi/stp2003.h @@ -0,0 +1,99 @@ +/* stp2003.h - PCIO: PCI Input Output Controller (Cheerio) */ + +/* Copyright 1984-1998 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,01jan98,mem written. +*/ + +/* +This file contains constants for the stp2003 PCI Input Output Controller +chip (also known as PCIO and Cheerio). +*/ + +#ifndef __INCstp2003h +#define __INCstp2003h + +#ifdef __cplusplus +extern "C" { +#endif + +/* PCI memory region sizes */ +#define PCIO_ROM_SIZE 0x01000000 /* 16Meg */ +#define PCIO_EBUS_SIZE 0x00800000 /* 8Meg */ +#define PCIO_ENET_SIZE 0x00008000 /* 32k */ + +/* EBus offsets with typical uses */ +#define PCIO_CS1_OFFSET 0x00000000 /* TOD/NVRAM */ +#define PCIO_CS2_OFFSET 0x00100000 /* Ebus2 device */ +#define PCIO_CS3_OFFSET 0x00200000 /* Audio */ +#define PCIO_CS4_OFFSET 0x00300000 /* Super IO */ +#define PCIO_CS5_OFFSET 0x00400000 /* sync. serial */ +#define PCIO_CS6_OFFSET 0x00500000 /* SC/lab console/Freq. */ +#define PCIO_CS7_OFFSET 0x00600000 /* Ebus2 device */ +#define PCIO_DCTL1_OFFSET 0x00700000 /* Parallel */ +#define PCIO_DCTL2_OFFSET 0x00702000 /* Audio (playback) */ +#define PCIO_DCTL3_OFFSET 0x00704000 /* Audio (capture) */ +#define PCIO_DCTL4_OFFSET 0x00706000 /* Floppy */ +#define PCIO_TCR1_OFFSET 0x00710000 /* Int. Ctrl Ebus2 */ +#define PCIO_TCR2_OFFSET 0x00710004 /* Int. Ctrl Ebus2 */ +#define PCIO_TCR3_OFFSET 0x00710008 /* Int. Ctrl Ebus2 */ +#define PCIO_FLP_AUX_OFFSET 0x00720000 /* Int. Reg Ebus2 */ +#define PCIO_AUD_AUX_OFFSET 0x00722000 /* Int. Reg Ebus2 */ +#define PCIO_PWR_AUX_OFFSET 0x00724000 /* Int. Reg Ebus2 */ +#define PCIO_LED_AUX_OFFSET 0x00726000 /* Int. Reg Ebus2 */ +#define PCIO_PMD_AUX_OFFSET 0x00728000 /* Int. Reg Ebus2 */ +#define PCIO_FREQ_AUX_OFFSET 0x0072a000 /* Int. Reg Ebus2 */ +#define PCIO_OSC_AUX_OFFSET 0x0072c000 /* Int. Reg Ebus2 */ +#define PCIO_TEMP_AUX_OFFSET 0x0072f000 /* Int. Reg Ebus2 */ +#define PCIO_BNK0_OFFSET 0x00730000 /* Bank 0 (64 words) */ +#define PCIO_BNK1_OFFSET 0x00730100 /* Bank 1 (64 words) */ +#define PCIO_DCSR1_OFFSET 0x00700000 /* DMA1 CSR Reg */ +#define PCIO_DACR1_OFFSET 0x00700004 /* DMA1 addr count Reg */ +#define PCIO_DBCR1_OFFSET 0x00700008 /* DMA1 byte count Reg */ +#define PCIO_DCSR2_OFFSET 0x00702000 /* DMA2 CSR Reg */ +#define PCIO_DACR2_OFFSET 0x00702004 /* DMA2 addr count Reg */ +#define PCIO_DBCR2_OFFSET 0x00702008 /* DMA2 byte count Reg */ +#define PCIO_DCSR3_OFFSET 0x00704000 /* DMA3 CSR Reg */ +#define PCIO_DACR3_OFFSET 0x00704004 /* DMA3 addr count Reg */ +#define PCIO_DBCR3_OFFSET 0x00704008 /* DMA3 byte count Reg */ +#define PCIO_DCSR4_OFFSET 0x00706000 /* DMA4 CSR Reg */ +#define PCIO_DACR4_OFFSET 0x00706004 /* DMA4 addr count Reg */ +#define PCIO_DBCR4_OFFSET 0x00706008 /* DMA4 byte count Reg */ + +/* Bit definitions for a subset of the PCIO registers */ + +#define PCIO_CSR_INT_PEND (1 << 0) +#define PCIO_CSR_ERR_PEND (1 << 1) +#define PCIO_CSR_DRAIN (1 << 2) +#define PCIO_CSR_INT_EN (1 << 4) +#define PCIO_CSR_RESET (1 << 7) +#define PCIO_CSR_WRITE (1 << 8) /* from device to memory */ +#define PCIO_CSR_READ (0 << 8) /* from memory to device */ +#define PCIO_CSR_EN_DMA (1 << 9) +#define PCIO_CSR_CYC_PENDING (1 << 10) +#define PCIO_CSR_DIAG_RD_DONE (1 << 11) +#define PCIO_CSR_DIAG_WR_DONE (1 << 12) +#define PCIO_CSR_EN_CNT (1 << 13) +#define PCIO_CSR_TC (1 << 14) +#define PCIO_CSR_DIS_CSR_DRN (1 << 16) +#define PCIO_CSR_BURST_SIZE_4 (2 << 18) /* burst size in bytes */ +#define PCIO_CSR_BURST_SIZE_16 (0 << 18) +#define PCIO_CSR_BURST_SIZE_32 (1 << 18) +#define PCIO_CSR_BURST_SIZE_64 (3 << 18) +#define PCIO_CSR_DIAG_EN (1 << 20) +#define PCIO_CSR_DIS_ERR_PEND (1 << 22) +#define PCIO_CSR_TCI_DIS (1 << 23) +#define PCIO_CSR_EN_NEXT (1 << 24) +#define PCIO_CSR_DMA_ON (1 << 25) +#define PCIO_CSR_A_LOADED (1 << 26) +#define PCIO_CSR_NA_LOADED (1 << 27) +#define PCIO_CSR_DEV_ID (1 << 28) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCstp2003h */ diff --git a/h/drv/multi/z8536.h b/h/drv/multi/z8536.h new file mode 100644 index 0000000..f99f039 --- /dev/null +++ b/h/drv/multi/z8536.h @@ -0,0 +1,322 @@ +/* z8536.h - zilog CIO (counter,timer,parallel i/o chip) */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01g,22sep92,rrr added support for c++ +01f,26may92,rrr the tree shuffle +01e,04oct91,rrr passed through the ansification filter + -changed TINY and UTINY to INT8 and UINT8 + -changed copyright notice +01d,05oct90,shl added copyright notice. + made #endif ANSI style. +01c,10jan90,shl merged with z8036.h. +01b,11sep89,dab changed U8 to UINT8. +01a,10aug88,rml written +*/ + +/* Note: in the following, the value '0x00' has been replaced by 'ZERO'. + This has been done to provide a way to avoid the 'clr.b' instruction + on the 68000/10 cpu. 'ZERO' should be defined to be a memory location + which holds the value '0x00', this will cause compilers to generate + memory to memory transfers rather than clear instructions. */ + +#ifndef __INCz8536h +#define __INCz8536h + +#ifdef __cplusplus +extern "C" { +#endif + +/* internal register addresses */ + +#define ZCIO_MIC ((UINT8) ZERO) /* Master Interrupt Control */ +#define ZCIO_MCC ((UINT8) 0x01) /* Master Configuration Control */ +#define ZCIO_PAIV ((UINT8) 0x02) /* Port A Interrupt Vector */ +#define ZCIO_PBIV ((UINT8) 0x03) /* Port B Interrupt Vector */ +#define ZCIO_CTIV ((UINT8) 0x04) /* Counter/Timer Interrupt Vector */ + +#define ZCIO_PCDPP ((UINT8) 0x05) /* Port C Data Path Polarity */ +#define ZCIO_PCDD ((UINT8) 0x06) /* Port C Data Direction */ +#define ZCIO_PCSIOC ((UINT8) 0x07) /* Port C Special I/O Control */ +#define ZCIO_PACS ((UINT8) 0x08) /* Port A Command and Status */ +#define ZCIO_PBCS ((UINT8) 0x09) /* Port B Command and Status */ + +#define ZCIO_CT1CS ((UINT8) 0x0a) /* C/T 1 Command and Status */ +#define ZCIO_CT2CS ((UINT8) 0x0b) /* C/T 2 Command and Status */ +#define ZCIO_CT3CS ((UINT8) 0x0c) /* C/T 3 Command and Status */ + +#define ZCIO_PAD ((UINT8) 0x0d) /* Port A Data */ +#define ZCIO_PBD ((UINT8) 0x0e) /* Port B Data */ +#define ZCIO_PCD ((UINT8) 0x0f) /* Port C Data */ + +#define ZCIO_CT1CCMSB ((UINT8) 0x10) /* C/T 1 Current Count (MS Byte) */ +#define ZCIO_CT1CCLSB ((UINT8) 0x11) /* C/T 1 Current Count (LS Byte) */ +#define ZCIO_CT2CCMSB ((UINT8) 0x12) /* C/T 2 Current Count (MS Byte) */ +#define ZCIO_CT2CCLSB ((UINT8) 0x13) /* C/T 2 Current Count (LS Byte) */ +#define ZCIO_CT3CCMSB ((UINT8) 0x14) /* C/T 3 Current Count (MS Byte) */ +#define ZCIO_CT3CCLSB ((UINT8) 0x15) /* C/T 3 Current Count (LS Byte) */ + +#define ZCIO_CT1TCMSB ((UINT8) 0x16) /* C/T 1 Time Constant (MS Byte) */ +#define ZCIO_CT1TCLSB ((UINT8) 0x17) /* C/T 1 Time Constant (LS Byte) */ +#define ZCIO_CT2TCMSB ((UINT8) 0x18) /* C/T 2 Time Constant (MS Byte) */ +#define ZCIO_CT2TCLSB ((UINT8) 0x19) /* C/T 2 Time Constant (LS Byte) */ +#define ZCIO_CT3TCMSB ((UINT8) 0x1a) /* C/T 3 Time Constant (MS Byte) */ +#define ZCIO_CT3TCLSB ((UINT8) 0x1b) /* C/T 3 Time Constant (LS Byte) */ + +#define ZCIO_CT1MS ((UINT8) 0x1c) /* C/T 1 Mode Specification */ +#define ZCIO_CT2MS ((UINT8) 0x1d) /* C/T 2 Mode Specification */ +#define ZCIO_CT3MS ((UINT8) 0x1e) /* C/T 3 Mode Specification */ + +#define ZCIO_CV ((UINT8) 0x1f) /* Current Vector */ + +#define ZCIO_PAMS ((UINT8) 0x20) /* Port A Mode Specification */ +#define ZCIO_PAHS ((UINT8) 0x21) /* Port A Handshake Specification */ +#define ZCIO_PADPP ((UINT8) 0x22) /* Port A Data Path Polarity */ +#define ZCIO_PADD ((UINT8) 0x23) /* Port A Data Direction */ +#define ZCIO_PASIOC ((UINT8) 0x24) /* Port A Special I/O Control */ +#define ZCIO_PAPP ((UINT8) 0x25) /* Port A Pattern Polarity */ +#define ZCIO_PAPT ((UINT8) 0x26) /* Port A Pattern Transition */ +#define ZCIO_PAPM ((UINT8) 0x27) /* Port A Pattern Mask */ + +#define ZCIO_PBMS ((UINT8) 0x28) /* Port B Mode Specification */ +#define ZCIO_PBHS ((UINT8) 0x29) /* Port B Handshake Specification */ +#define ZCIO_PBDPP ((UINT8) 0x2a) /* Port B Data Path Polarity */ +#define ZCIO_PBDD ((UINT8) 0x2b) /* Port B Data Direction */ +#define ZCIO_PBSIOC ((UINT8) 0x2c) /* Port B Special I/O Control */ +#define ZCIO_PBPP ((UINT8) 0x2d) /* Port B Pattern Polarity */ +#define ZCIO_PBPT ((UINT8) 0x2e) /* Port B Pattern Transition */ +#define ZCIO_PBPM ((UINT8) 0x2f) /* Port B Pattern Mask */ + + +/* If a particular CPU board uses Zilog 8036 counter/timer/parallel I/O chip, + * Z8036 should be defined in {target}/sysLib.h. */ + +#ifdef Z8036 + +#define Z8036_MIC(base) ((char *) ((base) + ZCIO_MIC)) +#define Z8036_MCC(base) ((char *) ((base) + ZCIO_MCC)) +#define Z8036_PAIV(base) ((char *) ((base) + ZCIO_PAIV)) +#define Z8036_PBIV(base) ((char *) ((base) + ZCIO_PBIV)) +#define Z8036_CTIV(base) ((char *) ((base) + ZCIO_CTIV)) +#define Z8036_PCDPP(base) ((char *) ((base) + ZCIO_PCDPP)) +#define Z8036_PCDD(base) ((char *) ((base) + ZCIO_PCDD)) +#define Z8036_PCSIOC(base) ((char *) ((base) + ZCIO_PCSIOC)) +#define Z8036_PACS(base) ((char *) ((base) + ZCIO_PACS)) +#define Z8036_PBCS(base) ((char *) ((base) + ZCIO_PBCS)) +#define Z8036_CT1CS(base) ((char *) ((base) + ZCIO_CT1CS)) +#define Z8036_CT2CS(base) ((char *) ((base) + ZCIO_CT2CS)) +#define Z8036_CT3CS(base) ((char *) ((base) + ZCIO_CT3CS)) +#define Z8036_PAD(base) ((char *) ((base) + ZCIO_PAD)) +#define Z8036_PBD(base) ((char *) ((base) + ZCIO_PBD)) +#define Z8036_PCD(base) ((char *) ((base) + ZCIO_PCD)) +#define Z8036_CT1CCMSB(base) ((char *) ((base) + ZCIO_CT1CCMSB)) +#define Z8036_CT1CCLSB(base) ((char *) ((base) + ZCIO_CT1CCLSB)) +#define Z8036_CT2CCMSB(base) ((char *) ((base) + ZCIO_CT2CCMSB)) +#define Z8036_CT2CCLSB(base) ((char *) ((base) + ZCIO_CT2CCLSB)) +#define Z8036_CT3CCMSB(base) ((char *) ((base) + ZCIO_CT3CCMSB)) +#define Z8036_CT3CCLSB(base) ((char *) ((base) + ZCIO_CT3CCLSB)) +#define Z8036_CT1TCMSB(base) ((char *) ((base) + ZCIO_CT1TCMSB)) +#define Z8036_CT1TCLSB(base) ((char *) ((base) + ZCIO_CT1TCLSB)) +#define Z8036_CT2TCMSB(base) ((char *) ((base) + ZCIO_CT2TCMSB)) +#define Z8036_CT2TCLSB(base) ((char *) ((base) + ZCIO_CT2TCLSB)) +#define Z8036_CT3TCMSB(base) ((char *) ((base) + ZCIO_CT3TCMSB)) +#define Z8036_CT3TCLSB(base) ((char *) ((base) + ZCIO_CT3TCLSB)) +#define Z8036_CT1MS(base) ((char *) ((base) + ZCIO_CT1MS)) +#define Z8036_CT2MS(base) ((char *) ((base) + ZCIO_CT2MS)) +#define Z8036_CT3MS(base) ((char *) ((base) + ZCIO_CT3MS)) +#define Z8036_CV(base) ((char *) ((base) + ZCIO_CV)) +#define Z8036_PAMS(base) ((char *) ((base) + ZCIO_PAMS)) +#define Z8036_PAHS(base) ((char *) ((base) + ZCIO_PAHS)) +#define Z8036_PADPP(base) ((char *) ((base) + ZCIO_PADPP)) +#define Z8036_PADD(base) ((char *) ((base) + ZCIO_PADD)) +#define Z8036_PASIOC(base) ((char *) ((base) + ZCIO_PASIOC)) +#define Z8036_PAPP(base) ((char *) ((base) + ZCIO_PAPP)) +#define Z8036_PAPT(base) ((char *) ((base) + ZCIO_PAPT)) +#define Z8036_PAPM(base) ((char *) ((base) + ZCIO_PAPM)) +#define Z8036_PBMS(base) ((char *) ((base) + ZCIO_PBMS)) +#define Z8036_PBHS(base) ((char *) ((base) + ZCIO_PBHS)) +#define Z8036_PBDPP(base) ((char *) ((base) + ZCIO_PBDPP)) +#define Z8036_PBDD(base) ((char *) ((base) + ZCIO_PBDD)) +#define Z8036_PBSIOC(base) ((char *) ((base) + ZCIO_PBSIOC)) +#define Z8036_PBPP(base) ((char *) ((base) + ZCIO_PBPP)) +#define Z8036_PBPT(base) ((char *) ((base) + ZCIO_PBPT)) +#define Z8036_PBPM(base) ((char *) ((base) + ZCIO_PBPM)) + +#endif /* Z8036 */ + + +/* Counter/Timer Mode Specification register values (C/T 1, 2 and 3) */ + +#define ZCIO_CTMS_DCS_PO ((UINT8) ZERO) /* Pulse Output */ +#define ZCIO_CTMS_DCS_OSO ((UINT8) 0x01) /* One-Shot Output */ +#define ZCIO_CTMS_DCS_SWO ((UINT8) 0x02) /* Square-Wave Output */ +#define ZCIO_CTMS_DCS ((UINT8) 0x03) /* output Duty Cycle Selects */ +#define ZCIO_CTMS_REB ((UINT8) 0x04) /* Retrigger Enable Bit */ +#define ZCIO_CTMS_EGE ((UINT8) 0x08) /* External Gate Enable */ +#define ZCIO_CTMS_ETE ((UINT8) 0x10) /* External Trigger Enable */ +#define ZCIO_CTMS_ECE ((UINT8) 0x20) /* External Count Enable */ +#define ZCIO_CTMS_EOE ((UINT8) 0x40) /* External Output Enable */ +#define ZCIO_CTMS_CSC ((UINT8) 0x80) /* Continuous Single Cycle */ + + +/* Master Configuration Control register values */ + +#define ZCIO_MCC_PLC_IND ((UINT8) ZERO) /* port A and B INDependent */ +#define ZCIO_MCC_LC_IND ((UINT8) ZERO) /* counter/timers INDependent */ +#define ZCIO_MCC_LC_GATE ((UINT8) 0x01) /* ct1 output GATEs ct2 */ +#define ZCIO_MCC_LC_TRIG ((UINT8) 0x02) /* ct1 output TRIGgers ct2 */ +#define ZCIO_MCC_LC_CNT ((UINT8) 0x03) /* ct1 output is ct2 CouNT input */ +#define ZCIO_MCC_LC ((UINT8) 0x03) /* counter/timer Link Controls */ +#define ZCIO_MCC_PAE ((UINT8) 0x04) /* Port A Enable */ +#define ZCIO_MCC_PLC ((UINT8) 0x08) /* Port Link Control */ +#define ZCIO_MCC_PLC_LNK ((UINT8) 0x08) /* port A and B are LiNKed */ +#define ZCIO_MCC_CT3PCE ((UINT8) 0x10) /* C/T 3 and Port C Enable */ +#define ZCIO_MCC_CT2E ((UINT8) 0x20) /* Counter/Timer 2 Enable */ +#define ZCIO_MCC_CT1E ((UINT8) 0x40) /* Counter/Timer 1 Enable */ +#define ZCIO_MCC_PBE ((UINT8) 0x80) /* Port B Enable */ + + +/* Master Interrupt Control register values */ + +#define ZCIO_MIC_RESET ((UINT8) 0x01) /* device RESET */ +#define ZCIO_MIC_RJ ((UINT8) 0x02) /* Right Just */ +#define ZCIO_MIC_CTVIS ((UINT8) 0x04) /* C/T Vector Includes Status */ +#define ZCIO_MIC_PBVIS ((UINT8) 0x08) /* Port B Vector Includes Status */ +#define ZCIO_MIC_PAVIS ((UINT8) 0x10) /* Port A Vector Includes Status */ +#define ZCIO_MIC_NV ((UINT8) 0x20) /* No Vector */ +#define ZCIO_MIC_DLC ((UINT8) 0x40) /* Disable Lower Chain */ +#define ZCIO_MIC_MIE ((UINT8) 0x80) /* Master Interrupt Enable */ + + +/* Command and Status resigter values (port A and B and C/T 1, 2 and 3) */ + +#define ZCIO_CS_NC ((UINT8) ZERO) /* Null Code */ +#define ZCIO_CS_CIP ((UINT8) 0x01) /* Count In Progress */ +#define ZCIO_CS_IOE ((UINT8) 0x01) /* Interrupt On Error */ +#define ZCIO_CS_TCB ((UINT8) 0x02) /* Trigger Command Bit */ +#define ZCIO_CS_PMF ((UINT8) 0x02) /* Pattern Match Flag */ +#define ZCIO_CS_IRF ((UINT8) 0x04) /* Input Register Full */ +#define ZCIO_CS_GCB ((UINT8) 0x04) /* Gate Command Bit */ +#define ZCIO_CS_RCC ((UINT8) 0x08) /* Read Counter Control */ +#define ZCIO_CS_ORE ((UINT8) 0x08) /* Output Register Empty */ +#define ZCIO_CS_ERR ((UINT8) 0x10) /* interrupt ERRor */ +#define ZCIO_CS_IP ((UINT8) 0x20) /* Interrupt Pending */ +#define ZCIO_CS_CLIPIUS ((UINT8) 0x20) /* CLear IP and IUS */ +#define ZCIO_CS_IE ((UINT8) 0x40) /* Interrupt Enable */ +#define ZCIO_CS_SIUS ((UINT8) 0x40) /* Set Interrupt Under Service */ +#define ZCIO_CS_CLIUS ((UINT8) 0x60) /* CLear Interrupt Under Service */ +#define ZCIO_CS_IUS ((UINT8) 0x80) /* Interrupt Under Service */ +#define ZCIO_CS_SIP ((UINT8) 0x80) /* Set Interrupt Pending */ +#define ZCIO_CS_CLIP ((UINT8) 0xa0) /* CLear Interrupt Pending */ +#define ZCIO_CS_SIE ((UINT8) 0xc0) /* Set Interrupt Enable */ +#define ZCIO_CS_CLIE ((UINT8) 0xe0) /* CLear Interrupt Enable */ + + +/* Data Direction register values (port A, B and C) */ + +#define ZCIO_DD_OUT ((UINT8) ZERO) /* OUTput bit */ +#define ZCIO_DD_IN ((UINT8) 0xff) /* INput bit */ + + +/* Data Path Polarity register values (port A, B and C) */ + +#define ZCIO_DPP_NONINV ((UINT8) ZERO) /* NON-INVerting */ +#define ZCIO_DPP_INVERT ((UINT8) 0xff) /* INVerting */ + + +/* Port Handshake Specification register values (port A and B) */ + +#define ZCIO_PHS_RWS_RWD ((UINT8) ZERO) /* Request/Wait Disabled */ +#define ZCIO_PHS_DTS_2 ((UINT8) ZERO) /* 2 PCLK cycles */ +#define ZCIO_PHS_HTS_IH ((UINT8) ZERO) /* Interlocked Handshake */ +#define ZCIO_PHS_DTS_4 ((UINT8) 0x01) /* 4 PCLK cycles */ +#define ZCIO_PHS_DTS_6 ((UINT8) 0x02) /* 6 PCLK cycles */ +#define ZCIO_PHS_DTS_8 ((UINT8) 0x03) /* 8 PCLK cycles */ +#define ZCIO_PHS_DTS_10 ((UINT8) 0x04) /* 10 PCLK cycles */ +#define ZCIO_PHS_DTS_12 ((UINT8) 0x05) /* 12 PCLK cycles */ +#define ZCIO_PHS_DTS_14 ((UINT8) 0x06) /* 14 PCLK cycles */ +#define ZCIO_PHS_DTS ((UINT8) 0x07) /* Deskew Time Specification */ +#define ZCIO_PHS_DTS_16 ((UINT8) 0x07) /* 16 PCLK cycles */ +#define ZCIO_PHS_RWS_OW ((UINT8) 0x08) /* Output Wait */ +#define ZCIO_PHS_RWS_IW ((UINT8) 0x18) /* Input Wait */ +#define ZCIO_PHS_RWS_SR ((UINT8) 0x20) /* Special Request */ +#define ZCIO_PHS_RWS_OR ((UINT8) 0x28) /* Output Request */ +#define ZCIO_PHS_RWS_IR ((UINT8) 0x38) /* Input Request */ +#define ZCIO_PHS_RWS ((UINT8) 0x38) /* Request/Wait Specification */ +#define ZCIO_PHS_HTS_SH ((UINT8) 0x40) /* Strobed Handshake */ +#define ZCIO_PHS_HTS_PH ((UINT8) 0x80) /* Pulsed Handshake */ +#define ZCIO_PHS_HTS_3WH ((UINT8) 0xc0) /* 3-Wire Handshake */ +#define ZCIO_PHS_HTS ((UINT8) 0xc0) /* Handshake Type Specification */ + + +/* Interrupt Vector register values (port A and B and C/Ts) */ + +#define ZCIO_IV_ERR ((UINT8) ZERO) /* Error */ +#define ZCIO_IV_CT3 ((UINT8) ZERO) /* Counter/Timer 3 */ +#define ZCIO_IV_CT2 ((UINT8) 0x02) /* Counter/Timer 2 */ +#define ZCIO_IV_PMF ((UINT8) 0x02) /* Pattern Match Flag */ +#define ZCIO_IV_IRF ((UINT8) 0x04) /* Input Register Full */ +#define ZCIO_IV_CT1 ((UINT8) 0x04) /* Counter/Timer 1 */ +#define ZCIO_IV_CTE ((UINT8) 0x06) /* Counter/Timer Error */ +#define ZCIO_IV_ORE ((UINT8) 0x08) /* Output Register Empty */ + + +/* Port Mode Specification register values (port A and B) */ + +#define ZCIO_PMS_PTS_BIT ((UINT8) ZERO) /* BIT port */ +#define ZCIO_PMS_PMS_DPM ((UINT8) ZERO) /* Disable Pattern Match */ +#define ZCIO_PMS_LPM ((UINT8) 0x01) /* Latch on Pattern Match */ +#define ZCIO_PMS_DTE ((UINT8) 0x01) /* Deskew Timer Enable */ +#define ZCIO_PMS_PMS_AND ((UINT8) 0x02) /* "AND" mode */ +#define ZCIO_PMS_PMS_OR ((UINT8) 0x04) /* "OR" mode */ +#define ZCIO_PMS_PMS ((UINT8) 0x06) /* Pattern Mode Specification */ +#define ZCIO_PMS_PMS_PEV ((UINT8) 0x06) /* "Priority Encoded Vector" mode */ +#define ZCIO_PMS_IMO ((UINT8) 0x08) /* Interrupt on Match Only */ +#define ZCIO_PMS_SB ((UINT8) 0x10) /* Single Buffered mode */ +#define ZCIO_PMS_ITB ((UINT8) 0x20) /* Interrupt on Two Bytes */ +#define ZCIO_PMS_PTS_IN ((UINT8) 0x40) /* INput port */ +#define ZCIO_PMS_PTS_OUT ((UINT8) 0x80) /* OUTput port */ +#define ZCIO_PMS_PTS_BI ((UINT8) 0xc0) /* BIdirectal port */ +#define ZCIO_PMS_PTS ((UINT8) 0xc0) /* Port Type Select */ + + +/* Pattern Mask resigter values (port A and B) */ + +#define ZCIO_PM_OFF ((UINT8) ZERO) /* Bit Masked Off (X) */ +#define ZCIO_PM_ANY ((UINT8) ZERO) /* Any Transition (^ or v) */ +#define ZCIO_PM_ZERO ((UINT8) 0xff) /* Zero (0) */ +#define ZCIO_PM_ONE ((UINT8) 0xff) /* One (1) */ +#define ZCIO_PM_0TO1 ((UINT8) 0xff) /* Zero to One Transition (^) */ +#define ZCIO_PM_1TO0 ((UINT8) 0xff) /* One to Zero Transition (v) */ + +/* Pattern Polarity register values (port A and B) */ + +#define ZCIO_PP_OFF ((UINT8) ZERO) /* Bit Masked Off (X) */ +#define ZCIO_PP_ANY ((UINT8) ZERO) /* Any Transition (^ or v) */ +#define ZCIO_PP_ZERO ((UINT8) ZERO) /* Zero (0) */ +#define ZCIO_PP_1TO0 ((UINT8) ZERO) /* One to Zero Transition (v) */ +#define ZCIO_PP_ONE ((UINT8) 0xff) /* One (1) */ +#define ZCIO_PP_0TO1 ((UINT8) 0xff) /* Zero to One Transition (^) */ + +/* Pattern Transition register values (port A and B) */ + +#define ZCIO_PT_OFF ((UINT8) ZERO) /* Bit Masked Off (X) */ +#define ZCIO_PT_ZERO ((UINT8) ZERO) /* Zero (0) */ +#define ZCIO_PT_ONE ((UINT8) ZERO) /* One (1) */ +#define ZCIO_PT_ANY ((UINT8) 0xff) /* Any Transition (^ or v) */ +#define ZCIO_PT_1TO0 ((UINT8) 0xff) /* One to Zero Transition (v) */ +#define ZCIO_PT_0TO1 ((UINT8) 0xff) /* Zero to One Transition (^) */ + +/* Special I/O Control register values (port A B and C) */ + +#define ZCIO_SIO_NORMAL ((UINT8) ZERO) /* NORMAL input or output */ +#define ZCIO_SIO_ODRAIN ((UINT8) 0xff) /* output with Open DRAIN */ +#define ZCIO_SIO_1CATCH ((UINT8) 0xff) /* input with 1's CATCHer */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCz8536h */ diff --git a/h/drv/netif/if_cpm.h b/h/drv/netif/if_cpm.h new file mode 100644 index 0000000..7a5308b --- /dev/null +++ b/h/drv/netif/if_cpm.h @@ -0,0 +1,235 @@ +/* if_cpm.h - Motorola CPM core Ethernet interface header */ + +/* Copyright 1996 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,09nov01,dat Adding obsolescence warnings to outdated drivers +01e,11jan99,cn added qualifier volatile where needed (SPR# 24295). +01d,22jun98,cn added field intMask to SCC_ETHER_DEV. +01c,13apr98,map moved SCC device definitions to ../multi/ppc860Cpm.h + renamed SCC_DEV to SCC_ETHER_DEV +01b,09aug96,dat fixed long wraparound lines +01a,09may96,dzb written. +*/ + +/* +This file contains I/O addresses and related constants for the Motorola +CPM core Ethernet controller used in the M68EN360 and PPC800-series +communications controllers. +*/ + +#ifndef __INCif_cpmh +#define __INCif_cpmh + +#ifdef __cplusplus +extern "C" { +#endif + +#warning "if_cpm driver is obsolete, please use motCpmEnd driver" + +#include "drv/multi/ppc860Cpm.h" + +/* defines */ + +/* General SCC Mode Register definitions */ + +#define SCC_GSMRL_HDLC 0x00000000 /* HDLC mode */ +#define SCC_GSMRL_APPLETALK 0x00000002 /* AppleTalk mode (LocalTalk) */ +#define SCC_GSMRL_SS7 0x00000003 /* SS7 mode (microcode) */ +#define SCC_GSMRL_UART 0x00000004 /* UART mode */ +#define SCC_GSMRL_PROFI_BUS 0x00000005 /* Profi-Bus mode (microcode) */ +#define SCC_GSMRL_ASYNC_HDLC 0x00000006 /* async HDLC mode (microcode)*/ +#define SCC_GSMRL_V14 0x00000007 /* V.14 mode */ +#define SCC_GSMRL_BISYNC 0x00000008 /* BISYNC mode */ +#define SCC_GSMRL_DDCMP 0x00000009 /* DDCMP mode (microcode) */ +#define SCC_GSMRL_ETHERNET 0x0000000c /* ethernet mode (SCC1 only) */ +#define SCC_GSMRL_ENT 0x00000010 /* enable transmitter */ +#define SCC_GSMRL_ENR 0x00000020 /* enable receiver */ +#define SCC_GSMRL_LOOPBACK 0x00000040 /* local loopback mode */ +#define SCC_GSMRL_ECHO 0x00000080 /* automatic echo mode */ +#define SCC_GSMRL_TENC 0x00000700 /* transmitter encoding method*/ +#define SCC_GSMRL_RENC 0x00003800 /* receiver encoding method */ +#define SCC_GSMRL_RDCR_X8 0x00004000 /* receive DPLL clock x8 */ +#define SCC_GSMRL_RDCR_X16 0x00008000 /* receive DPLL clock x16 */ +#define SCC_GSMRL_RDCR_X32 0x0000c000 /* receive DPLL clock x32 */ +#define SCC_GSMRL_TDCR_X8 0x00010000 /* transmit DPLL clock x8 */ +#define SCC_GSMRL_TDCR_X16 0x00020000 /* transmit DPLL clock x16 */ +#define SCC_GSMRL_TDCR_X32 0x00030000 /* transmit DPLL clock x32 */ +#define SCC_GSMRL_TEND 0x00040000 /* transmitter frame ending */ +#define SCC_GSMRL_TPP_00 0x00180000 /* Tx preamble pattern = 00 */ +#define SCC_GSMRL_TPP_10 0x00080000 /* Tx preamble pattern = 10 */ +#define SCC_GSMRL_TPP_01 0x00100000 /* Tx preamble pattern = 01 */ +#define SCC_GSMRL_TPP_11 0x00180000 /* Tx preamble pattern = 11 */ +#define SCC_GSMRL_TPL_NONE 0x00000000 /* no Tx preamble (default) */ +#define SCC_GSMRL_TPL_8 0x00200000 /* Tx preamble = 1 byte */ +#define SCC_GSMRL_TPL_16 0x00400000 /* Tx preamble = 2 bytes */ +#define SCC_GSMRL_TPL_32 0x00600000 /* Tx preamble = 4 bytes */ +#define SCC_GSMRL_TPL_48 0x00800000 /* Tx preamble = 6 bytes */ +#define SCC_GSMRL_TPL_64 0x00a00000 /* Tx preamble = 8 bytes */ +#define SCC_GSMRL_TPL_128 0x00c00000 /* Tx preamble = 16 bytes */ +#define SCC_GSMRL_TINV 0x01000000 /* DPLL transmit input invert */ +#define SCC_GSMRL_RINV 0x02000000 /* DPLL receive input invert */ +#define SCC_GSMRL_TSNC 0x0c000000 /* transmit sense */ +#define SCC_GSMRL_TCI 0x10000000 /* transmit clock invert */ +#define SCC_GSMRL_EDGE 0x60000000 /* adjustment edge +/- */ + +#define SCC_GSMRH_RSYN 0x00000001 /* receive sync timing*/ +#define SCC_GSMRH_RTSM 0x00000002 /* RTS* mode */ +#define SCC_GSMRH_SYNL 0x0000000c /* sync length */ +#define SCC_GSMRH_TXSY 0x00000010 /* transmitter/receiver sync */ +#define SCC_GSMRH_RFW 0x00000020 /* Rx FIFO width */ +#define SCC_GSMRH_TFL 0x00000040 /* transmit FIFO length */ +#define SCC_GSMRH_CTSS 0x00000080 /* CTS* sampling */ +#define SCC_GSMRH_CDS 0x00000100 /* CD* sampling */ +#define SCC_GSMRH_CTSP 0x00000200 /* CTS* pulse */ +#define SCC_GSMRH_CDP 0x00000400 /* CD* pulse */ +#define SCC_GSMRH_TTX 0x00000800 /* transparent transmitter */ +#define SCC_GSMRH_TRX 0x00001000 /* transparent receiver */ +#define SCC_GSMRH_REVD 0x00002000 /* reverse data */ +#define SCC_GSMRH_TCRC 0x0000c000 /* transparent CRC */ +#define SCC_GSMRH_GDE 0x00010000 /* glitch detect enable */ + +/* CPM - Communication Processor Module */ + +/* SCC Ethernet Protocol Specific Mode Register definitions */ + +#define SCC_ETHER_PSMR_NIB_13 0x0000 /* SFD 13 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_14 0x0002 /* SFD 14 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_15 0x0004 /* SFD 15 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_16 0x0006 /* SFD 16 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_21 0x0008 /* SFD 21 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_22 0x000a /* SFD 22 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_23 0x000c /* SFD 23 bits after TENA */ +#define SCC_ETHER_PSMR_NIB_24 0x000e /* SFD 24 bits after TENA */ +#define SCC_ETHER_PSMR_LCW 0x0100 /* late collision window */ +#define SCC_ETHER_PSMR_SIP 0x0200 /* sample input pins */ +#define SCC_ETHER_PSMR_LPB 0x0400 /* loopback operation */ +#define SCC_ETHER_PSMR_SBT 0x0800 /* stop backoff timer */ +#define SCC_ETHER_PSMR_BRO 0x0100 /* broadcast address */ +#define SCC_ETHER_PSMR_PRO 0x0200 /* promiscuous mode */ +#define SCC_ETHER_PSMR_CRC 0x0800 /* CRC selection */ +#define SCC_ETHER_PSMR_IAM 0x1000 /* individual address mode */ +#define SCC_ETHER_PSMR_RSH 0x2000 /* receive short frame */ +#define SCC_ETHER_PSMR_FC 0x4000 /* force collision */ +#define SCC_ETHER_PSMR_HBC 0x8000 /* heartbeat checking*/ + +/* SCC Ethernet Event and Mask Register definitions */ + +#define SCC_ETHER_SCCX_RXB 0x0001 /* buffer received event */ +#define SCC_ETHER_SCCX_TXB 0x0002 /* buffer transmitted event */ +#define SCC_ETHER_SCCX_BSY 0x0004 /* busy condition */ +#define SCC_ETHER_SCCX_RXF 0x0008 /* frame received event */ +#define SCC_ETHER_SCCX_TXE 0x0010 /* transmission error event */ +#define SCC_ETHER_SCCX_GRA 0x0080 /* graceful stop event */ + +/* SCC Ethernet Receive Buffer Descriptor definitions */ + +#define SCC_ETHER_RX_BD_CL 0x0001 /* collision condition */ +#define SCC_ETHER_RX_BD_OV 0x0002 /* overrun condition */ +#define SCC_ETHER_RX_BD_CR 0x0004 /* Rx CRC error */ +#define SCC_ETHER_RX_BD_SH 0x0008 /* short frame received */ +#define SCC_ETHER_RX_BD_NO 0x0010 /* Rx nonoctet aligned frame */ +#define SCC_ETHER_RX_BD_LG 0x0020 /* Rx frame length violation */ +#define SCC_ETHER_RX_BD_M 0x0100 /* miss bit for prom mode */ +#define SCC_ETHER_RX_BD_F 0x0400 /* buffer is first in frame */ +#define SCC_ETHER_RX_BD_L 0x0800 /* buffer is last in frame */ +#define SCC_ETHER_RX_BD_I 0x1000 /* interrupt on receive */ +#define SCC_ETHER_RX_BD_W 0x2000 /* last BD in ring */ +#define SCC_ETHER_RX_BD_E 0x8000 /* buffer is empty */ + +/* SCC Ethernet Transmit Buffer Descriptor definitions */ + +#define SCC_ETHER_TX_BD_CSL 0x0001 /* carrier sense lost */ +#define SCC_ETHER_TX_BD_UN 0x0002 /* underrun */ +#define SCC_ETHER_TX_BD_RC 0x003c /* retry count */ +#define SCC_ETHER_TX_BD_RL 0x0040 /* retransmission limit */ +#define SCC_ETHER_TX_BD_LC 0x0080 /* late collision */ +#define SCC_ETHER_TX_BD_HB 0x0100 /* heartbeat */ +#define SCC_ETHER_TX_BD_DEF 0x0200 /* defer indication */ +#define SCC_ETHER_TX_BD_TC 0x0400 /* auto transmit CRC */ +#define SCC_ETHER_TX_BD_L 0x0800 /* buffer is last in frame */ +#define SCC_ETHER_TX_BD_I 0x1000 /* interrupt on transmit */ +#define SCC_ETHER_TX_BD_W 0x2000 /* last BD in ring */ +#define SCC_ETHER_TX_BD_PAD 0x4000 /* auto pad short frames */ +#define SCC_ETHER_TX_BD_R 0x8000 /* buffer is ready */ + +/* typedefs */ + +/* SCC - Serial Comunications Controller */ + +typedef struct /* SCC_ETHER_PROTO */ + { + UINT32 c_pres; /* preset CRC */ + UINT32 c_mask; /* constant mask for CRC */ + volatile UINT32 crcec; /* CRC error counter */ + volatile UINT32 alec; /* alignment error counter */ + volatile UINT32 disfc; /* discard frame counter */ + UINT16 pads; /* short frame pad value */ + UINT16 ret_lim; /* retry limit threshold */ + volatile UINT16 ret_cnt; /* retry limit counter */ + UINT16 mflr; /* maximum frame length register */ + UINT16 minflr; /* minimum frame length register */ + UINT16 maxd1; /* max DMA1 length register */ + UINT16 maxd2; /* max DMA2 length register */ + volatile UINT16 maxd; /* Rx max DMA */ + volatile UINT16 dma_cnt; /* Rx DMA counter */ + volatile UINT16 max_b; /* max BD byte count */ + UINT16 gaddr1; /* group address filter 1 */ + UINT16 gaddr2; /* group address filter 2 */ + UINT16 gaddr3; /* group address filter 3 */ + UINT16 gaddr4; /* group address filter 4 */ + volatile UINT32 tbuf0_data0; /* save area 0 - current frame */ + volatile UINT32 tbuf0_data1; /* save area 1 - current frame */ + volatile UINT32 tbuf0_rba0; /* ? */ + volatile UINT32 tbuf0_crc; /* ? */ + volatile UINT16 tbuf0_bcnt; /* ? */ + UINT16 paddr1_h; /* physical address 1 (MSB) */ + UINT16 paddr1_m; /* physical address 1 */ + UINT16 paddr1_l; /* physical address 1 (LSB) */ + UINT16 p_per; /* persistence */ + volatile UINT16 rfbd_ptr; /* Rx first BD pointer */ + volatile UINT16 tfbd_ptr; /* Tx first BD pointer */ + volatile UINT16 tlbd_ptr; /* Tx last BD pointer */ + volatile UINT32 tbuf1_data0; /* save area 0 - next frame */ + volatile UINT32 tbuf1_data1; /* ? */ + volatile UINT32 tbuf1_rba0; /* ? */ + volatile UINT32 tbuf1_crc; /* ? */ + volatile UINT16 tbuf1_bcnt; /* ? */ + volatile UINT16 tx_len; /* Tx frame length counter */ + UINT16 iaddr1; /* individual address filter 1 */ + UINT16 iaddr2; /* individual address filter 2 */ + UINT16 iaddr3; /* individual address filter 3 */ + UINT16 iaddr4; /* individual address filter 4 */ + volatile UINT16 boff_cnt; /* backoff counter */ + UINT16 taddr_h; /* temp address (MSB) */ + UINT16 taddr_m; /* temp address */ + UINT16 taddr_l; /* temp address (LSB) */ + } SCC_ETHER_PROTO; + +/* SCC device descriptor */ + +typedef struct /* SCC_ETHER_DEV */ + { + int sccNum; /* number of SCC device */ + int txBdNum; /* number of transmit buf descriptors */ + int rxBdNum; /* number of receive buf descriptors */ + SCC_BUF * txBdBase; /* transmit BD base address */ + SCC_BUF * rxBdBase; /* receive BD base address */ + u_char * txBufBase; /* transmit buffer base address */ + u_char * rxBufBase; /* receive buffer base address */ + UINT32 txBufSize; /* transmit buffer size */ + UINT32 rxBufSize; /* receive buffer size */ + int txBdNext; /* next transmit BD to fill */ + int rxBdNext; /* next receive BD to read */ + volatile SCC * pScc; /* SCC parameter RAM */ + volatile SCC_REG * pSccReg; /* SCC registers */ + UINT32 intMask; /* interrupt acknowledge mask */ + } SCC_ETHER_DEV; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_cpmh */ diff --git a/h/drv/netif/if_cs.h b/h/drv/netif/if_cs.h new file mode 100644 index 0000000..95215ed --- /dev/null +++ b/h/drv/netif/if_cs.h @@ -0,0 +1,310 @@ +/* if_cs.h - Crystal Semiconductor CS8900 network interface header */ + +/* + * Copyright 1996 Crystal Semiconductor Corp. + * Copyright 1990-1996 Wind River Systems, Inc. + */ + +/* +modification history +-------------------- +01a,16dec96,hdn adapted and cleaned up. +*/ + + +#ifndef __INCif_csh +#define __INCif_csh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Individual Address (Ethernet Address) */ + +typedef struct cs_ia /* CS_IA */ + { + USHORT word[3]; + } CS_IA; + +/* Receive Frame Buffer */ + +typedef struct cs_rxbuf /* CS_RXBUF */ + { + struct cs_rxbuf *pNext; + UCHAR status; + UCHAR refCount; + USHORT length; + UCHAR data[SIZEOF_ETHERHEADER + ETHERMTU]; + } CS_RXBUF; + +/* Instance global variables */ + +typedef struct cs_softc /* CS_SOFTC */ + { + struct arpcom arpCom; + USHORT ioAddr; + USHORT intLevel; + USHORT intVector; + USHORT *pPacketPage; + USHORT mediaType; + USHORT configFlags; + CS_RXBUF *pFreeRxBuff; + BOOL inMemoryMode; + BOOL txInProgress; + BOOL resetting; + USHORT rxDepth; + USHORT maxRxDepth; + USHORT maxTxDepth; + UINT loanCount; + } CS_SOFTC; + +/* Receive buffer status */ + +#define CS_RXBUF_FREE 0x0000 +#define CS_RXBUF_ALLOCATED 0x0001 +#define CS_RXBUF_LOANED 0x0002 + +/* Config Flags in cs_softc */ + +#define CS_CFGFLG_MEM_MODE 0x0001 +#define CS_CFGFLG_USE_SA 0x0002 +#define CS_CFGFLG_IOCHRDY 0x0004 +#define CS_CFGFLG_DCDC_POL 0x0008 +#define CS_CFGFLG_FDX 0x0010 +#define CS_CFGFLG_NOT_EEPROM 0x8000 + +/* Media Type in cs_softc */ + +#define CS_MEDIA_AUI 0x0001 +#define CS_MEDIA_10BASE2 0x0002 +#define CS_MEDIA_10BASET 0x0003 + +/* Chip Identification */ + +#define CS_EISA_NUM_CRYSTAL 0x630E +#define CS_PROD_ID_MASK 0xE000 +#define CS_PROD_ID_CS8900 0x0000 +#define CS_PROD_ID_CS8920 0x4000 +#define CS_PROD_ID_CS892X 0x6000 +#define CS_PROD_REV_MASK 0x1F00 + +/* IO Port Offsets */ + +#define CS_PORT_RXTX_DATA 0x0000 +#define CS_PORT_RXTX_DATA_1 0x0002 +#define CS_PORT_TX_CMD 0x0004 +#define CS_PORT_TX_LENGTH 0x0006 +#define CS_PORT_ISQ 0x0008 +#define CS_PORT_PKTPG_PTR 0x000A +#define CS_PORT_PKTPG_DATA 0x000C +#define CS_PORT_PKTPG_DATA_1 0x000E + +/* PacketPage Offsets */ + +#define CS_PKTPG_EISA_NUM 0x0000 +#define CS_PKTPG_PRODUCT_ID 0x0002 +#define CS_PKTPG_IO_BASE 0x0020 +#define CS_PKTPG_INT_NUM 0x0022 +#define CS_PKTPG_MEM_BASE 0x002C +#define CS_PKTPG_EEPROM_CMD 0x0040 +#define CS_PKTPG_EEPROM_DATA 0x0042 +#define CS_PKTPG_RX_CFG 0x0102 +#define CS_PKTPG_RX_CTL 0x0104 +#define CS_PKTPG_TX_CFG 0x0106 +#define CS_PKTPG_BUF_CFG 0x010A +#define CS_PKTPG_LINE_CTL 0x0112 +#define CS_PKTPG_SELF_CTL 0x0114 +#define CS_PKTPG_BUS_CTL 0x0116 +#define CS_PKTPG_TEST_CTL 0x0118 +#define CS_PKTPG_ISQ 0x0120 +#define CS_PKTPG_RX_EVENT 0x0124 +#define CS_PKTPG_TX_EVENT 0x0128 +#define CS_PKTPG_BUF_EVENT 0x012C +#define CS_PKTPG_RX_MISS 0x0130 +#define CS_PKTPG_TX_COL 0x0132 +#define CS_PKTPG_LINE_ST 0x0134 +#define CS_PKTPG_SELF_ST 0x0136 +#define CS_PKTPG_BUS_ST 0x0138 +#define CS_PKTPG_TX_CMD 0x0144 +#define CS_PKTPG_TX_LENGTH 0x0146 +#define CS_PKTPG_IND_ADDR 0x0158 +#define CS_PKTPG_RX_STATUS 0x0400 +#define CS_PKTPG_RX_LENGTH 0x0402 +#define CS_PKTPG_RX_FRAME 0x0404 +#define CS_PKTPG_TX_FRAME 0x0A00 + +/* EEPROM Offsets */ + +#define CS_EEPROM_IND_ADDR_H 0x001C +#define CS_EEPROM_IND_ADDR_M 0x001D +#define CS_EEPROM_IND_ADDR_L 0x001E +#define CS_EEPROM_ISA_CFG 0x001F +#define CS_EEPROM_MEM_BASE 0x0020 +#define CS_EEPROM_XMIT_CTL 0x0023 +#define CS_EEPROM_ADPTR_CFG 0x0024 + +/* Register Numbers */ + +#define CS_REG_NUM_MASK 0x003F +#define CS_REG_NUM_RX_EVENT 0x0004 +#define CS_REG_NUM_TX_EVENT 0x0008 +#define CS_REG_NUM_BUF_EVENT 0x000C +#define CS_REG_NUM_RX_MISS 0x0010 +#define CS_REG_NUM_TX_COL 0x0012 + +/* Self Control Register */ + +#define CS_SELF_CTL_RESET 0x0040 +#define CS_SELF_CTL_HC1E 0x2000 +#define CS_SELF_CTL_HCB1 0x8000 + +/* Self Status Register */ + +#define CS_SELF_ST_INIT_DONE 0x0080 +#define CS_SELF_ST_SI_BUSY 0x0100 +#define CS_SELF_ST_EEP_PRES 0x0200 +#define CS_SELF_ST_EEP_OK 0x0400 +#define CS_SELF_ST_EL_PRES 0x0800 + +/* EEPROM Command Register */ + +#define CS_EEPROM_CMD_READ 0x0200 +#define CS_EEPROM_CMD_ELSEL 0x0400 + +/* Bus Control Register */ + +#define CS_BUS_CTL_USE_SA 0x0200 +#define CS_BUS_CTL_MEM_MODE 0x0400 +#define CS_BUS_CTL_IOCHRDY 0x1000 +#define CS_BUS_CTL_INT_ENBL 0x8000 + +/* Bus Status Register */ + +#define CS_BUS_ST_TX_BID_ERR 0x0080 +#define CS_BUS_ST_RDY4TXNOW 0x0100 + +/* Line Control Register */ + +#define CS_LINE_CTL_RX_ON 0x0040 +#define CS_LINE_CTL_TX_ON 0x0080 +#define CS_LINE_CTL_AUI_ONLY 0x0100 +#define CS_LINE_CTL_10BASET 0x0000 + +/* Test Control Register */ + +#define CS_TEST_CTL_DIS_LT 0x0080 +#define CS_TEST_CTL_ENDEC_LP 0x0200 +#define CS_TEST_CTL_AUI_LOOP 0x0400 +#define CS_TEST_CTL_DIS_BKOFF 0x0800 +#define CS_TEST_CTL_FDX 0x4000 + +/* Receiver Configuration Register */ + +#define CS_RX_CFG_SKIP 0x0040 +#define CS_RX_CFG_RX_OK_IE 0x0100 +#define CS_RX_CFG_CRC_ERR_IE 0x1000 +#define CS_RX_CFG_RUNT_IE 0x2000 +#define CS_RX_CFG_X_DATA_IE 0x4000 +#define CS_RX_CFG_ALL_IE 0x7100 + +/* Receiver Event Register */ + +#define CS_RX_EVENT_DRIBBLE 0x0080 +#define CS_RX_EVENT_RX_OK 0x0100 +#define CS_RX_EVENT_IND_ADDR 0x0400 +#define CS_RX_EVENT_BCAST 0x0800 +#define CS_RX_EVENT_CRC_ERR 0x1000 +#define CS_RX_EVENT_RUNT 0x2000 +#define CS_RX_EVENT_X_DATA 0x4000 + +/* Receiver Control Register */ + +#define CS_RX_CTL_RX_OK_A 0x0100 +#define CS_RX_CTL_MCAST_A 0x0200 +#define CS_RX_CTL_IND_A 0x0400 +#define CS_RX_CTL_BCAST_A 0x0800 +#define CS_RX_CTL_CRC_ERR_A 0x1000 +#define CS_RX_CTL_RUNT_A 0x2000 +#define CS_RX_CTL_X_DATA_A 0x4000 + +/* Transmit Configuration Register */ + +#define CS_TX_CFG_LOSS_CRS_IE 0x0040 +#define CS_TX_CFG_SQE_ERR_IE 0x0080 +#define CS_TX_CFG_TX_OK_IE 0x0100 +#define CS_TX_CFG_OUT_WIN_IE 0x0200 +#define CS_TX_CFG_JABBER_IE 0x0400 +#define CS_TX_CFG_16_COLL_IE 0x8000 +#define CS_TX_CFG_ALL_IE 0x8FC0 + +/* Transmit Event Register */ + +#define CS_TX_EVENT_LOSS_CRS 0x0040 +#define CS_TX_EVENT_SQE_ERR 0x0080 +#define CS_TX_EVENT_TX_OK 0x0100 +#define CS_TX_EVENT_OUT_WIN 0x0200 +#define CS_TX_EVENT_JABBER 0x0400 +#define CS_TX_EVENT_COLL_MASK 0x7800 +#define CS_TX_EVENT_16_COLL 0x8000 + +/* Transmit Command Register */ + +#define CS_TX_CMD_START_5 0x0000 +#define CS_TX_CMD_START_381 0x0080 +#define CS_TX_CMD_START_1021 0x0040 +#define CS_TX_CMD_START_ALL 0x00C0 +#define CS_TX_CMD_FORCE 0x0100 +#define CS_TX_CMD_ONE_COLL 0x0200 +#define CS_TX_CMD_NO_CRC 0x1000 +#define CS_TX_CMD_NO_PAD 0x2000 + +/* Buffer Configuration Register */ + +#define CS_BUF_CFG_SW_INT 0x0040 +#define CS_BUF_CFG_RDY4TX_IE 0x0100 +#define CS_BUF_CFG_TX_UNDR_IE 0x0200 +#define CS_BUF_CFG_RX_MISS_IE 0x0400 + +/* Buffer Event Register */ + +#define CS_BUF_EVENT_SW_INT 0x0040 +#define CS_BUF_EVENT_RDY4TX 0x0100 +#define CS_BUF_EVENT_TX_UNDR 0x0200 +#define CS_BUF_EVENT_RX_MISS 0x0400 + +/* ISA Configuration from EEPROM */ + +#define CS_ISA_CFG_IRQ_MASK 0x000F +#define CS_ISA_CFG_USE_SA 0x0080 +#define CS_ISA_CFG_IOCHRDY 0x0100 +#define CS_ISA_CFG_MEM_MODE 0x8000 + +/* Memory Base from EEPROM */ + +#define CS_MEM_BASE_MASK 0xFFF0 + +/* Adpater Configuration from EEPROM */ + +#define CS_ADPTR_CFG_MEDIA 0x0060 +#define CS_ADPTR_CFG_10BASET 0x0020 +#define CS_ADPTR_CFG_AUI 0x0040 +#define CS_ADPTR_CFG_10BASE2 0x0060 +#define CS_ADPTR_CFG_DCDC_POL 0x0080 + +/* Transmission Control from EEPROM */ + +#define CS_XMIT_CTL_FDX 0x8000 + +/* Miscellaneous definitions */ + +#define CS_MAXLOOP 0x8888 +#define CS_RXBUFCOUNT 16 +#define CS_MC_LOANED 5 + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_csh */ diff --git a/h/drv/netif/if_dc.h b/h/drv/netif/if_dc.h new file mode 100644 index 0000000..afc4dbb --- /dev/null +++ b/h/drv/netif/if_dc.h @@ -0,0 +1,646 @@ +/* if_dc.h - DEC 21x4x Ethernet LAN network interface header */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,09nov01,dat Adding obsolescence warnings to outdated drivers +01g,30oct97,map added definitions for MII/PHY +01f,29oct97,map merged from mv2603/dec21140/dec21140.h (ver 01f) [SPR# 8176] +01e,24feb97,dbt corrected previous modification history +01d,04sep96,dat fixed comment within comment, spr 7106 +01c,05sep95,vin added setup/filter frame defines. +01b,04apr95,caf changed name from "dcPci" to "dc". +01a,02mar95,vin written. +*/ + +#ifndef __INCif_dch +#define __INCif_dch + +#ifdef __cplusplus +extern "C" { +#endif + +#warning "if_dc driver is obsolete, please use dec21x40End driver" + +#define DECPCI_REG_OFFSET 0x08 /* quad word aligned */ + +/* Definitions for the flags field */ + +#define DC_PROMISCUOUS_FLAG 0x01 /* set promiscuous mode */ +#define DC_MULTICAST_FLAG 0x02 /* pass all multicast pkts */ + +/* Modes for 100-Mb/s Ethernet configuration */ + +#define DC_100_MB_FLAG 0x04 /* 100-Mb/s mode */ +#define DC_21140_FLAG 0x08 /* Lance chip is 21140 */ +#define DC_FULLDUPLEX_FLAG 0x10 /* Full Duplex Mode */ +#define DC_SCRAMBLER_FLAG 0x20 /* MII/SYM in scrambler mode */ +#define DC_PCS_FLAG 0x40 /* MII/SYM in symbol mode */ +#define DC_PS_FLAG 0x80 /* Serial Port selected */ +#define DC_ILOOPB_FLAG 0x100 /* Internal Loop Back Mode */ +#define DC_ELOOPB_FLAG 0x200 /* External Loop Back Mode */ +#define DC_HBE_FLAG 0x400 /* Heart Beat Enable Flag */ + +#if (_BYTE_ORDER == _BIG_ENDIAN) +# define PCISWAP(x) LONGSWAP(x) /* processor big endian */ +#else +# define PCISWAP(x) (x) /* processor little endian */ +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + +/* + * Receive Message Descriptor Entry. + * Four words per entry. Number of entries must be a power of two. + */ +typedef struct rDesc + { + ULONG rDesc0; /* status and ownership */ + ULONG rDesc1; /* control & buffer count */ + ULONG rDesc2; /* buffer address 1 */ + ULONG rDesc3; /* buffer address 2 */ + } DC_RDE; + +/* + * Transmit Message Descriptor Entry. + * Four words per entry. Number of entries must be a power of two. + */ +typedef struct tDesc + { + ULONG tDesc0; /* status and ownership */ + ULONG tDesc1; /* control & buffer count */ + ULONG tDesc2; /* buffer address 1 */ + ULONG tDesc3; /* buffer address 2 */ + } DC_TDE; + +#define MIN_RDS 5 /* 5 buffers reasonable minimum */ +#define MIN_TDS 5 /* 5 buffers reasonable minimum */ +#define NUM_RDS 32 /* default number of Recv descriptors */ +#define NUM_TDS 32 /* default number of Xmit descriptors */ + +/* define CSRs and descriptors */ + +#define CSR0 0 /* csr 0 */ +#define CSR1 1 /* csr 1 */ +#define CSR2 2 /* csr 2 */ +#define CSR3 3 /* csr 3 */ +#define CSR4 4 /* csr 4 */ +#define CSR5 5 /* csr 5 */ +#define CSR6 6 /* csr 6 */ +#define CSR7 7 /* csr 7 */ +#define CSR8 8 /* csr 8 */ +#define CSR9 9 /* csr 9 */ +#define CSR10 10 /* csr 10 */ +#define CSR11 11 /* csr 11 */ +#define CSR12 12 /* csr 12 */ +#define CSR13 13 /* csr 13 */ +#define CSR14 14 /* csr 14 */ +#define CSR15 15 /* csr 15 */ + +#define RDESC0 0 /* recv desc 0 */ +#define RDESC1 1 /* recv desc 1 */ +#define RDESC2 2 /* recv desc 2 */ +#define RDESC3 3 /* recv desc 3 */ + +#define TDESC0 0 /* xmit desc 0 */ +#define TDESC1 1 /* xmit desc 1 */ +#define TDESC2 2 /* xmit desc 2 */ +#define TDESC3 3 /* xmit desc 3 */ + +/* command status register read write */ + +#define CSR(base,x) ((ULONG)(base) + ((DECPCI_REG_OFFSET) * (x))) + +#define READ_CSR(base,x) (PCISWAP(*((ULONG *)CSR((base),(x))))) + +#define WRITE_CSR(base,x,val) (*((ULONG *)CSR((base),(x))) = PCISWAP((val))) + + +/* recv xmit descriptor read write */ + +#define DESC(base,x) ((ULONG)(base) + (4 * (x))) + +#define READ_DESC(base,x) (PCISWAP(*((ULONG *)(DESC((base),(x)))))) + +#define WRITE_DESC(base,x,val) (*((ULONG *)(DESC((base),(x)))) = PCISWAP((val))) + +/* Configuration ID Register added for DEC21140 */ + +#define SROM_SIZE 128 +#define CFID_DEVID_MASK 0xFFFF0000 +#define CFID_VENID_MASK 0x0000FFFF + +#define DEC21040_ID 0x00020000 +#define DEC21140_ID 0x00090000 +#define PMC_ETHERNET 0x0000F801 /* Def MAC adrs for DEC PMC */ +#define DEC_PMC_POS 10 /* MAC addr position on a DEC PMC ROM */ + +/* Definitions for fields and bits in the DC_DEVICE */ + +/* CSR0 Bus Mode Register */ + +#define CSR0_RML 0x00200000 /* Read Multiple */ +#define CSR0_TAP_NO 0x00000000 /* no xmit auto polling */ +#define CSR0_TAP_200 0x00020000 /* xmit poll every 200 usecs */ +#define CSR0_TAP_800 0x00040000 /* xmit poll every 800 usecs */ +#define CSR0_TAP_1600 0x00060000 /* xmit poll every 1.6 millsecs */ +#define CSR0_CAL_NO 0x00000000 /* cache address alignment not used */ +#define CSR0_CAL_08 0x00004000 /* 08 longword boundary aligned */ +#define CSR0_CAL_16 0x00008000 /* 16 longword boundary aligned */ +#define CSR0_CAL_32 0x0000c000 /* 32 longword boundary aligned */ +#define CSR0_PBL_0 0x00000000 /* 0 longwords DMA'ed */ +#define CSR0_PBL_1 0x00000100 /* 1 longwords DMA'ed */ +#define CSR0_PBL_2 0x00000200 /* 2 longwords DMA'ed */ +#define CSR0_PBL_4 0x00000400 /* 4 longwords DMA'ed */ +#define CSR0_PBL_8 0x00000800 /* 8 longwords DMA'ed */ +#define CSR0_PBL_16 0x00001000 /* 16 longwords DMA'ed */ +#define CSR0_PBL_32 0x00002000 /* 32 longwords DMA'ed */ +#define CSR0_DAS 0x00010000 /* Diagnostic Address Space */ +#define CSR0_BLE 0x00000080 /* Big/little endian */ +#define CSR0_BAR 0x00000002 /* Bus arbitration */ +#define CSR0_SWR 0x00000001 /* software reset */ + +#define CSR0_PBL_MSK 0x00003F00 /* Dma burst length mask */ +#define CSR0_PBL_VAL(x) (((x) << 8) & CSR0_PBL_MSK) + +#define CSR0_DSL_MSK 0x0000007C /* Descriptor skip length */ +#define CSR0_DSL_VAL(x) (((x) << 2) & CSR0_DSL_MSK) + +/* CSR1 Transmit Poll Demand Register */ + +#define CSR1_TPD 0x00000001 /* Transmit poll demand */ + +/* CSR2 Recieve Poll Demand Register */ + +#define CSR2_RPD 0x00000001 /* Transmit poll demand */ + +/* CSR3 Receive List Base address Register */ + +#define CSR3_RDBA_MSK 0xFFFFFFFC /* long word aligned */ +#define CSR3_RDBA_VAL(x) ((x) & CSR3_RDBA_MSK) + +/* CSR4 Transmit List Base address Register */ + +#define CSR4_TDBA_MSK 0xFFFFFFFC /* long word aligned */ +#define CSR4_TDBA_VAL(x) ((x) & CSR4_TDBA_MSK) + +/* CSR5 Status register */ + +#define CSR5_ERR_PE 0x00000000 /* parity error */ +#define CSR5_ERR_MA 0x00800000 /* Master abort */ +#define CSR5_ERR_TA 0x01000000 /* target abort */ +#define CSR5_TPS_ST 0x00000000 /* Stopped */ +#define CSR5_TPS_RFTD 0x00100000 /* Running Fetch xmit descriptor */ +#define CSR5_TPS_RWET 0x00200000 /* Running Wait for end of Xmission */ +#define CSR5_TPS_RRBM 0x00300000 /* Running Read buff from memory */ +#define CSR5_TPS_RSP 0x00500000 /* Running Set up packet */ +#define CSR5_TPS_STFU 0x00600000 /* Suspended xmit FIFO underflow */ +#define CSR5_TPS_RCTD 0x00700000 /* Running Close xmit descriptor */ + +#define CSR5_RPS_ST 0x00000000 /* stopped reset or stop rcv command */ +#define CSR5_RPS_RFRD 0x00020000 /* Running Fetch rcv descriptor */ +#define CSR5_RPS_RCEP 0x00040000 /* Running Check end of rcv packet */ +#define CSR5_RPS_RWRP 0x00060000 /* Running Wait for rcv packet */ +#define CSR5_RPS_SURB 0x00080000 /* Suspended - unavailable rcv buff */ +#define CSR5_RPS_RCRD 0x000A0000 /* Running close rcv descriptor */ +#define CSR5_RPS_RFFF 0x000C0000 /* flush frame from rcv FIFO */ +#define CSR5_RPS_RQRF 0x000E0000 /* queue the rcv frame into rcv buff */ + +#define CSR5_NIS 0x00010000 /* normal interrupt summary */ +#define CSR5_AIS 0x00008000 /* abnormal interrupt summary */ +#define CSR5_SE 0x00002000 /* system error */ +#define CSR5_LNF 0x00001000 /* link fail */ + +/* DEC21140 specific bit masks */ +#define CSR5_GPTE 0x00000800 /* General Purpose Timer Expire */ + +#define CSR5_FD 0x00000800 /* Full-duplex short frame rcvd */ +#define CSR5_AT 0x00000400 /* AUI / Ten base T Pin */ +#define CSR5_RWT 0x00000200 /* rcv watchdog time-out */ +#define CSR5_RPS 0x00000100 /* rcv process stopped */ +#define CSR5_RU 0x00000080 /* rcv buffer unavailable */ +#define CSR5_RI 0x00000040 /* rcv interrupt */ +#define CSR5_UNF 0x00000020 /* xmit underflow */ +#define CSR5_TJT 0x00000008 /* xmit jabber time-out */ +#define CSR5_TU 0x00000004 /* xmit buffer unavailable */ +#define CSR5_TPS 0x00000002 /* Xmit Process stopped */ +#define CSR5_TI 0x00000001 /* xmit interrupt */ + +#define CSR5_RPS_MSK 0x000E0000 /* Rcv process state mask */ +#define CSR5_TPS_MSK 0x00700000 /* Xmit process state mask */ +#define CSR5_ERR_MSK 0x03800000 /* error mask */ + +/* CSR6 Operation Mode Register */ + +/* DEC21140 specific bit masks */ + +#define CSR6_BIT25 0x02000000 /* BIT MUST ALWAYS BE 1 */ +#define CSR6_SCR 0x01000000 /* scrambler mode enable */ +#define CSR6_PCS 0x00800000 /* PCS mode enable */ +#define CSR6_TTM 0x00400000 /* transmit thresold mode */ +#define CSR6_SF 0x00200000 /* store forward mode */ +#define CSR6_HBD 0x00080000 /* heartbeat disabled */ +#define CSR6_PS 0x00040000 /* MII/SYM port selected */ + +/* Common Bit States for CSR6 */ + +#define CSR6_CAE 0x00020000 /* capture effect enable */ +#define CSR6_BP 0x00010000 /* back pressure */ +#define CSR6_THR_072 0x00000000 /* threshold bytes 72 */ +#define CSR6_THR_096 0x00004000 /* threshold bytes 96 */ +#define CSR6_THR_128 0x00008000 /* threshold bytes 128 */ +#define CSR6_THR_160 0x0000C000 /* threshold bytes 160 */ +#define CSR6_ST 0x00002000 /* start/stop Xmit command */ +#define CSR6_FC 0x00001000 /* Force collision mode */ +#define CSR6_OM_NOR 0x00000000 /* normal mode */ +#define CSR6_OM_ILB 0x00000400 /* internal loopback mode */ +#define CSR6_OM_ELB 0x00000800 /* external loopback mode */ +#define CSR6_FD 0x00000200 /* Full Duplex mode */ +#define CSR6_FKD 0x00000100 /* Flaky oscillator disable */ +#define CSR6_PM 0x00000080 /* Pass all multicast */ +#define CSR6_PR 0x00000040 /* promiscuous mode */ +#define CSR6_SB 0x00000020 /* Start/Stop Back off counter */ +#define CSR6_IF 0x00000010 /* inverse filtering */ +#define CSR6_PB 0x00000008 /* pass bad frames */ +#define CSR6_HO 0x00000004 /* hash only filtering mode */ +#define CSR6_SR 0x00000002 /* start/stop receive command */ +#define CSR6_HP 0x00000001 /* hash/perfect recv filtering mode */ + +/* CSR7 Interrupt Mask register */ + +#define CSR7_NIM 0x00010000 /* normal interrupt mask */ +#define CSR7_AIM 0x00008000 /* abnormal interrupt mask */ +#define CSR7_SEM 0x00002000 /* system error mask */ +#define CSR7_LFM 0x00001000 /* link fail mask */ +#define CSR7_FDM 0x00000800 /* full duplex mask */ +#define CSR7_ATM 0x00000400 /* aui/tp switch mask */ +#define CSR7_RWM 0x00000200 /* rcv watchdog time-out mask */ +#define CSR7_RSM 0x00000100 /* rcv stopped mask */ +#define CSR7_RUM 0x00000080 /* rcv buff unavailable mask */ +#define CSR7_RIM 0x00000040 /* rcv interrupt mask */ +#define CSR7_UNM 0x00000020 /* underflow interrupt mask */ +#define CSR7_TJM 0x00000008 /* xmit jabber timer out mask */ +#define CSR7_TUM 0x00000004 /* xmit buff unavailable mask */ +#define CSR7_TSM 0x00000002 /* xmission stopped mask */ +#define CSR7_TIM 0x00000001 /* xmit interrupt mask */ + + +/* CSR8 Missing Frame Counter */ + +#define CSR8_MFO 0x00010000 /* missed frame overflow */ +#define CSR8_MFC_MSK 0x0000FFFF /* Missed frame counter mask */ + +/* CSR9 Ethernet Address ROM Register */ + +#define CSR9_DNV 0x80000000 /* Data not valid */ +#define CSR9_DAT_MSK 0x000000FF /* data mask */ +#define ENET_ROM_SIZE 8 /* ethernet rom register size */ + + +/* CSR9 Serial Address ROM and MII Management Register for the DEC21140 */ + +#define CSR9_040_DNVAL 0x80000000 /* Data not valid - 21040 */ + +#define CSR9_MDI 0x00080000 /* MII mgmt data in - 21140+ */ +#define CSR9_MDI_SHF 19 +#define CSR9_MII_RD 0x00040000 /* MII mgmt read mode - 21140+ */ +#define CSR9_MII_WR 0x00000000 /* MII mgmt write mode - 21140+ */ +#define CSR9_MDO 0x00020000 /* MII mgmt write data - 21140+ */ +#define CSR9_MDO_SHF 17 +#define CSR9_MDC 0x00010000 /* MII mgmt clock - 21140+ */ +#define CSR9_RD 0x00004000 /* Read command - 21140+ */ +#define CSR9_WR 0x00002000 /* Write command - 21140+ */ +#define CSR9_BR 0x00001000 /* Boot rom select - 21140+ */ +#define CSR9_SR 0x00000800 /* Serial rom select - 21140+ */ +#define CSR9_REG 0x00000400 /* External register select - 21140+ */ +#define CSR9_DATA 0x000000FF /* Data */ +#define CSR9_DATA_OUT 0x00000008 /* Shift read data from SROM - 21140+ */ +#define CSR9_DATA_IN 0x00000004 /* Shift write data into SROM - 21140+*/ +#define CSR9_SROM_CLK 0x00000002 /* SCLK output to SROM - 21140+ */ +#define CSR9_SROM_CS 0x00000001 /* SerialROM chip select - 21140+ */ + +#define CSR9_MII_DBIT_RD(X) (((X) & CSR9_MDI) >> CSR9_MDI_SHF) +#define CSR9_MII_DBIT_WR(X) (((X) & 0x1) << CSR9_MDO_SHF) + +/* CSR10 Reserved */ + + +/* CSR11 Full Duplex Register */ + +#define CSR11_FDACV_MSK 0x0000FFFF /* full duplex auto config mask */ + +/* CSR11 General-Purpose Timer Register for the DEC21140 */ + +#define CSR11_CON_MODE 0x00010000 /* GPT Continuous Mode */ +#define CSR11_VALUE_MASK 0x0000FFFF /* GPT Timer Value Mask */ + +/* CSR12 SIA status Register */ + +#define CSR12_DA0 0x00000080 /* Diagnostic bit all One */ +#define CSR12_DAZ 0x00000040 /* Diagnostic bit all zero */ +#define CSR12_DSP 0x00000020 /* Diagnostic BIST status indicator */ +#define CSR12_DSD 0x00000010 /* Diagnostic Self test done */ +#define CSR12_APS 0x00000008 /* Auto polarity state */ +#define CSR12_LKF 0x00000004 /* link fail status */ +#define CSR12_NCR 0x00000002 /* network connection error */ +#define CSR12_PAUI 0x00000001 /* pin AUI_TP indication */ + +/* CSR12 General-Purpose Registerr for the DEC21140 */ + +#define CSR12_CNTRL_FLAG 0x00000100 /* Control Flag */ +#define CSR12_DATA_MASK 0x000000FF /* Mode and Data Mask */ + +#define INIT_CSR12 CSR12_CNTRL_FLAG | 0x0f /* Base value for CSR12 */ +#define SYM_MODE 0x00000009 /* SYM value for CSR12 */ + +/* CSR13 SIA connectivity Register */ + +#define CSR13_OE57 0x00008000 /* Output enable 5 6 7 */ +#define CSR13_OE24 0x00004000 /* output enable 2 4 */ +#define CSR13_OE13 0x00002000 /* output enable 1 3 */ +#define CSR13_IE 0x00001000 /* input enable */ +#define CSR13_SEL_LED 0x00000f00 /* select LED and external driver */ +#define CSR13_ASE_APLL 0x00000080 /* ase apll start enable */ +#define CSR13_SIM 0x00000040 /* serial iface input multiplexer */ +#define CSR13_ENI 0x00000020 /* encoder Input multiplexer */ +#define CSR13_EDP_SIA 0x00000010 /* pll external input enable */ +#define CSR13_AUI_TP 0x00000008 /* AUI - 10BASE-T or AUI */ +#define CSR13_CAC_CSR 0x00000004 /* auto config register */ +#define CSR13_PS 0x00000002 /* pin AUI_TP select */ +#define CSR13_SRL_SIA 0x00000001 /* srl sia Reset */ + +/* CSR14 SIA xmit rcv Register */ + +#define CSR14_SPP 0x00004000 /* set polarity plus */ +#define CSR14_APE 0x00002000 /* auto polarity enable */ +#define CSR14_LTE 0x00001000 /* link test enable */ +#define CSR14_SQE 0x00000800 /* signal quality generate enable */ +#define CSR14_CLD 0x00000400 /* collision detect enable */ +#define CSR14_CSQ 0x00000200 /* collision squelch enable */ +#define CSR14_RSQ 0x00000100 /* receive squelch enable */ +#define CSR14_CPEN_NC 0x00000030 /* no compensation */ +#define CSR14_CPEN_HP 0x00000020 /* high power mode */ +#define CSR14_CPEN_DM 0x00000010 /* disable mode */ +#define CSR14_LSE 0x00000008 /* link pulse send enable */ +#define CSR14_DREN 0x00000004 /* driver enable */ +#define CSR14_LBK 0x00000002 /* loopback enable */ +#define CSR14_ECEN 0x00000001 /* encoder enable */ + +/* CSR15 SIA general register */ + +#define CSR15_JCK 0x00000004 /* jabber clock */ +#define CSR15_HUJ 0x00000002 /* host unjab */ +#define CSR15_JBD 0x00000001 /* jabber disable */ + +/* CSR15 Watchdog Timer Register for the DEC21140 */ + +#define CSR15_RWR_FLAG 0x00000020 /* Receive Watchdog Release */ +#define CSR15_RWD_FLAG 0x00000010 /* Receive Watchdog Disable */ + +/* receive descriptor */ + +/* receive descriptor 0 */ + +#define RDESC0_OWN 0x80000000 /* Own */ +#define RDESC0_ES 0x00008000 /* Error summary */ +#define RDESC0_LE 0x00004000 +#define RDESC0_DT_SRF 0x00000000 /* serial rcvd frame */ +#define RDESC0_DT_ILF 0x00001000 /* internal loop back frame */ +#define RDESC0_DT_ELF 0x00002000 /* external loop back frame */ +#define RDESC0_RF 0x00000800 /* runt frame */ +#define RDESC0_MF 0x00000400 /* multicast frame */ +#define RDESC0_FD 0x00000200 /* first descriptor */ +#define RDESC0_LS 0x00000100 /* last descriptor */ +#define RDESC0_TL 0x00000080 /* frame too long */ +#define RDESC0_CS 0x00000040 /* collision seen */ +#define RDESC0_FT 0x00000020 /* frame type */ +#define RDESC0_RJ 0x00000010 /* receive watch dog */ +#define RDESC0_DB 0x00000004 /* dribbling bit */ +#define RDESC0_CE 0x00000002 /* crc error */ +#define RDESC0_OF 0x00000001 /* Over flow */ + +#define RDESC0_FL_MSK 0x7FFF0000 /* Frame length mask */ +#define RDESC0_FL_GET(x) (((x) & RDESC0_FL_MSK) >> 16) +#define RDESC0_FL_PUT(x) (((x) << 16) & RDESC0_FL_MSK) + +/* receive descriptor 1 */ + +#define RDESC1_RER 0x02000000 /* recv end of ring */ +#define RDESC1_RCH 0x01000000 /* second address chained */ + +#define RDESC1_RBS2_MSK 0x003FF800 /* RBS2 buffer 2 size */ +#define RDESC1_RBS1_MSK 0x000007FF /* RBS1 buffer 1 size */ + +#define RDESC1_RBS1_VAL(x) ((x) & RDESC1_RBS1_MSK) /* multiple of 4 */ +#define RDESC1_RBS2_VAL(x) (((x) << 11) & RDESC1_RBS2_MSK) + +/* transmit descriptor */ + +/* xmit descriptor 0 */ + +#define TDESC0_OWN 0x80000000 /* own */ +#define TDESC0_ES 0x00008000 /* error summary */ +#define TDESC0_TO 0x00004000 /* xmit jabber time out */ +#define TDESC0_LO 0x00000800 /* loss of carrier */ +#define TDESC0_NC 0x00000400 /* NC No carrier */ +#define TDESC0_LC 0x00000200 /* late collision */ +#define TDESC0_EC 0x00000100 /* excessive collision */ +#define TDESC0_HF 0x00000080 /* heart beat fail */ +#define TDESC0_LF 0x00000004 /* link fail */ +#define TDESC0_UF 0x00000002 /* underflow error */ +#define TDESC0_DE 0x00000001 /* deffered */ + +#define TDESC0_CC_MSK 0x00000078 + +/* xmit descriptor 1 */ + +#define TDESC1_IC 0x80000000 /* interrupt on completion */ +#define TDESC1_LS 0x40000000 /* last segment */ +#define TDESC1_FS 0x20000000 /* first segment */ +#define TDESC1_FT1 0x10000000 /* filtering type */ +#define TDESC1_SET 0x08000000 /* setup packet */ +#define TDESC1_AC 0x04000000 /* add crc disable */ +#define TDESC1_TER 0x02000000 /* xmit end of ring */ +#define TDESC1_TCH 0x01000000 /* second address chained */ +#define TDESC1_DPD 0x00800000 /* disabled padding */ +#define TDESC1_FTO 0x00400000 /* filtering type */ + +#define TDESC1_TBS2_MSK 0x003FF800 /* TBS2 buffer 2 size */ +#define TDESC1_TBS1_MSK 0x000007FF /* TBS2 buffer 1 size */ + +#define TDESC1_TBS1_PUT(x) ((x) & TDESC1_TBS1_MSK) /* multiple of 4 */ +#define TDESC1_TBS2_PUT(x) (((x) << 11) & TDESC1_TBS2_MSK) + +#define FLTR_FRM_SIZE 0xC0 /* filter frm size 192 bytes */ +#define FLTR_FRM_SIZE_ULONGS (FLTR_FRM_SIZE / sizeof (ULONG)) +#define FLTR_FRM_ADRS_NUM 0x10 /* filter frm holds 16 addrs */ +#define FLTR_FRM_ADRS_SIZE 0x06 /* size of each phys addrs */ +#define FLTR_FRM_DEF_ADRS 0xFFFFFFFF /* enet broad cast address */ + +/* MII/PHY defines */ + +#define DC_MAX_PHY 32 /* max number of PHY devices */ +#define DC_MAX_LINK_TOUT 6 /* max link timeout (in secs) */ +#define MII_PREAMBLE ((ULONG) 0xFFFFFFFF) + +/* MII frame header format */ + +#define MII_SOF 0x4 /* start of frame */ +#define MII_RD 0x2 /* op-code: Read */ +#define MII_WR 0x1 /* op-code: Write */ + +/* MII PHY registers */ + +#define MII_PHY_CR 0x00 /* Control Register */ +#define MII_PHY_SR 0x01 /* Status Register */ +#define MII_PHY_ID0 0x02 /* Identifier Register 0 */ +#define MII_PHY_ID1 0x03 /* Identifier Register 1 */ +#define MII_PHY_ANA 0x04 /* Auto Negot'n Advertisement */ +#define MII_PHY_ANLPA 0x05 /* Auto Negot'n Link Partner Ability */ +#define MII_PHY_ANE 0x06 /* Auto Negot'n Expansion */ +#define MII_PHY_ANP 0x07 /* Auto Negot'n Next Page TX */ + +/* ID0 values of PHY devices */ + +#define MII_PHY_ID0_NATIONAL 0x2000 /* National TX */ +#define MII_PHY_ID0_BROADCOM 0x03e0 /* Broadcom T4 */ +#define MII_PHY_ID0_SEEQ 0x0016 /* Seeq T4 */ +#define MII_PHY_ID0_CYPRESS 0x0014 /* Cypress T4 */ + +/* MII_PHY control register */ + +#define MII_PHY_CR_RESET 0x8000 /* reset */ +#define MII_PHY_CR_LOOP 0x4000 /* loopback enable */ +#define MII_PHY_CR_100M 0x2000 /* speed 100Mbps */ +#define MII_PHY_CR_10M 0x0000 /* speed 10Mbps */ +#define MII_PHY_CR_AUTO 0x1000 /* auto speed enable */ +#define MII_PHY_CR_OFF 0x0800 /* powerdown mode */ +#define MII_PHY_CR_ISOLAT 0x0400 /* isolate mode */ +#define MII_PHY_CR_RAN 0x0200 /* restart auto negotiate */ +#define MII_PHY_CR_FDX 0x0100 /* full duplex mode */ +#define MII_PHY_CR_CTE 0x0080 /* collision test enable */ + +/* MII PHY status register */ + +#define MII_PHY_SR_100T4 0x8000 /* 100BASE-T4 capable */ +#define MII_PHY_SR_100TX_FD 0x4000 /* 100BASE-TX Full Duplex capable */ +#define MII_PHY_SR_100TX_HD 0x2000 /* 100BASE-TX Half Duplex capable */ +#define MII_PHY_SR_10TFD 0x1000 /* 10BASE-T Full Duplex capable */ +#define MII_PHY_SR_10THD 0x0800 /* 10BASE-T Half Duplex capable */ +#define MII_PHY_SR_ASS 0x0020 /* Auto Speed Selection Complete*/ +#define MII_PHY_SR_RFD 0x0010 /* Remote Fault Detected */ +#define MII_PHY_SR_AN 0x0008 /* Auto Negotiation capable */ +#define MII_PHY_SR_LNK 0x0004 /* Link Status */ +#define MII_PHY_SR_JABD 0x0002 /* Jabber Detect */ +#define MII_PHY_SR_XC 0x0001 /* Extended Capabilities */ + +/* MII PHY Auto Negotiation Advertisement Register */ + +#define MII_PHY_ANA_TAF 0x03e0 /* Technology Ability Field */ +#define MII_PHY_ANA_T4AM 0x0200 /* T4 Technology Ability Mask */ +#define MII_PHY_ANA_TXAM 0x0180 /* TX Technology Ability Mask */ +#define MII_PHY_ANA_FDAM 0x0140 /* Full Duplex Technology Ability Mask */ +#define MII_PHY_ANA_HDAM 0x02a0 /* Half Duplex Technology Ability Mask */ +#define MII_PHY_ANA_100M 0x0380 /* 100Mb Technology Ability Mask */ +#define MII_PHY_ANA_10M 0x0060 /* 10Mb Technology Ability Mask */ +#define MII_PHY_ANA_CSMA 0x0001 /* CSMA-CD Capable */ + +/* MII PHY Auto Negotiation Remote End Register */ + +#define MII_PHY_ANLPA_NP 0x8000 /* Next Page (Enable) */ +#define MII_PHY_ANLPA_ACK 0x4000 /* Remote Acknowledge */ +#define MII_PHY_ANLPA_RF 0x2000 /* Remote Fault */ +#define MII_PHY_ANLPA_TAF 0x03e0 /* Technology Ability Field */ +#define MII_PHY_ANLPA_T4AM 0x0200 /* T4 Technology Ability Mask */ +#define MII_PHY_ANLPA_TXAM 0x0180 /* TX Technology Ability Mask */ +#define MII_PHY_ANLPA_FDAM 0x0140 /* Full Duplex Technology Ability Mask */ +#define MII_PHY_ANLPA_HDAM 0x02a0 /* Half Duplex Technology Ability Mask */ +#define MII_PHY_ANLPA_100M 0x0380 /* 100Mb Technology Ability Mask */ +#define MII_PHY_ANLPA_10M 0x0060 /* 10Mb Technology Ability Mask */ +#define MII_PHY_ANLPA_CSMA 0x0001 /* CSMA-CD Capable */ + +#if 0 +/* MII defines */ + +#define MII_LINK_STATUS 0x4 +#define MII_WRITE_DATA_POS 17 +#define MII_READ_DATA_POS 19 +#define PHY_ADDR_ALIGN 23 +#define REG_ADDR_ALIGN 18 +#define PHY_CONTROL_REG 0 +#define PHY_STATUS_REG 1 +#define MII_READ_FRAME ((ULONG) 0x60000000) + +#define MII_WRITE ((ULONG) 0x00002000) +#define MII_WRITE_DATA ((ULONG) 0x00020000) +#define MII_WRITE_TS ((ULONG) 0x00042000) +#define MII_READ ((ULONG) 0x00044000) +#define MII_READ_DATA ((ULONG) 0x00080000) +#define MII_CLOCK ((ULONG) 0x00010000) + +#define MII_PHY_CTRL_RES_MSK ((USHORT) 0x007F) +#define MII_PHY_STAT_RES_MSK ((USHORT) 0x07C0) +#define MII_PHY_NWAY_RES_MSK ((USHORT) 0x1C00) +#define MII_PHY_NWAY_EXP_RES_BITS ((USHORT) 0xFFE0) +#endif + +/* SROM Version defines */ + +#define MAX_GP_WRITES 10 +#define MAX_MEDIAS 10 + +/* SROM Version Data types */ + +typedef struct { + UCHAR MediaCode; + UCHAR GPPortData; + USHORT Command; +} CompactFormat; + +typedef struct { + UCHAR Length; + UCHAR Type; + UCHAR BlockData[4]; +} ExtendedFormat0; + +typedef struct { + UCHAR Length; + UCHAR Type; + UCHAR BlockData[40]; +} ExtendedFormat1; + +typedef union InfoBlock { + CompactFormat Compact; + ExtendedFormat0 Extended0; + ExtendedFormat1 Extended1; +} InfoBlock; + +typedef struct { + USHORT ConnType; + UCHAR GPControl; + UCHAR BlockCount; + InfoBlock dcInfoBlock; +} InfoLeaf; + +typedef struct { + UINT ValCSR6; + UINT GPCount; + UINT GPValue[MAX_GP_WRITES]; + UINT GPResetLen; + UINT GPResetValue[MAX_GP_WRITES]; +} MediaSettingsType; + +typedef struct { + UINT ActiveMedia; + UINT MediaFound; + UINT GPMask; + MediaSettingsType MediaArray[MAX_MEDIAS]; + UINT DontSwitch; +} MediaBlocksType; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_dch */ + diff --git a/h/drv/netif/if_eex.h b/h/drv/netif/if_eex.h new file mode 100644 index 0000000..0b3d8b7 --- /dev/null +++ b/h/drv/netif/if_eex.h @@ -0,0 +1,485 @@ +/* if_eex.h - Intel EtherExpress 16 interface header */ + +/* Copyright 1990-1993 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01d,25jan95,hdn added RB_OFFSET and RB_LINK for the Simpact's patch. +01c,20feb94,bcs relabel, recomment extended control register, define AUTODETECT + and remove old connector type symbols +01b,04dec93,bcs made functional, added AL_LOC compile-time option +01a,28nov93,bcs created from if_ei.h (rev. 02h,22sep92) +*/ + +#ifndef __INCif_eexh +#define __INCif_eexh + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* constants needed within this file */ + +#define EEX_AL_LOC /* define to use header-in-data */ + /* feature of 82586 */ + +#define EA_SIZE 6 +#define EH_SIZE 14 /* avoid structure padding issues */ +#define N_MCAST 12 + +/* Size of frame buffers in this driver + * Made even to simplify structure alignment in code */ + +#define FRAME_SIZE ( ( ETHERMTU + EH_SIZE + 1 ) & ~1 ) + +/* Intel EtherExpress 16 board port and bit definitions */ + +/* I/O ports relative to board base port address */ +/* Word registers unless otherwise noted */ + +#define DXREG 0x00 /* Data transfer register */ +#define WRPTR 0x02 /* Write address pointer */ +#define RDPTR 0x04 /* Read address pointer */ +#define CA_CTRL 0x06 /* (byte) Channel Attention */ +#define SEL_IRQ 0x07 /* (byte) IRQ select and enable */ +#define SMB_PTR 0x08 /* Shadow memory bank pointer */ +#define MEMDEC 0x0a /* (byte) Memory address decode */ +#define MEMCTRL 0x0b /* (byte) Memory mapped control */ +#define MEMPC 0x0c /* (byte) MEMCS16 page control */ +#define CONFIG 0x0d /* (byte) Configuration test */ +#define EE_CTRL 0x0e /* (byte) EEPROM control and reset */ +#define MEMECTRL 0x0f /* (byte) Memory control 0xE000 seg*/ +#define AUTOID 0x0f /* (byte) Auto ID register */ + +#define ECR1 0x300e /* (byte) extended control: conn.type */ + /* only exists on newer boards */ +#define SHADOWID 0x300f /* (byte) board subtype/rev. */ + +#define SCB_STATUS 0xc008 /* SCB status word */ +#define SCB_COMMAND 0xc00a /* SCB command word */ +#define SCB_CBL 0xc00c /* SCB command block list head */ +#define SCB_RFA 0xc00e /* SCB received frame area */ + +/* Register bits and bit masks */ + +#define IRQ_SEL 0x07 /* SEL_IRQ: interrupt line code bits */ +#define IRQ_ENB 0x08 /* SEL_IRQ: interrupt enable */ + +#define EEPROM_CLOCK 0x01 /* EE_CTRL: Shift clock pin */ +#define EEPROM_CHIPSEL 0x02 /* EE_CTRL: Chip select for EEPROM */ +#define EEPROM_OUTPUT 0x04 /* EE_CTRL: Data out to EEPROM */ +#define EEPROM_INPUT 0x08 /* EE_CTRL: Data in from EEPROM */ +#define RESET_ASIC 0x40 /* EE_CTRL: Reset board ASIC */ +#define RESET_82586 0x80 /* EE_CTRL: Reset pin of 82586 */ + +/* defined bits in ECR1 port; leave others alone! */ + +#define CONN_INTEGRITY 0x02 /* bit in ECR1 to enable */ + /* link integrity for RJ-45 */ +#define CONN_TRANSCEIVER 0x80 /* write-only bit to enable */ + /* on-board transceiver power */ + /* for BNC or RJ-45 connection */ + +/* Hyundai serial EEPROM operation codes */ + +#define EEPROM_OP_READ 0x06 /* 3 bits, read data */ +#define EEPROM_OP_WRITE 0x05 /* 3 bits, write data */ +#define EEPROM_OP_ERASE 0x07 /* 3 bits, erase data */ +#define EEPROM_OP_EWEN 0x13 /* 5 bits, erase/write enable */ +#define EEPROM_OP_EWDIS 0x10 /* 5 bits, erase/write enable */ + +/* EtherExpress 16 EEPROM memory registers */ + +#define EEX_EEPROM_SETUP 0 /* I/O, IRQ, AUI setup etc. */ +#define EEX_EEPROM_MEMPAGE 1 /* mempage bits, base and select bits */ +#define EEX_EEPROM_EA_LOW 2 /* low-order 16 bits of Ethernet addr.*/ +#define EEX_EEPROM_EA_MID 3 /* middle 16 bits */ +#define EEX_EEPROM_EA_HIGH 4 /* high-order 16 bits */ +#define EEX_EEPROM_TPE_BIT 5 /* bit 0 sez if TPE in use */ +#define EEX_EEPROM_MEMDECODE 6 /* mem decode bits, page 0xe000 bits */ + +/* Important bits in the EERPOM words */ + +#define SETUP_BNC 0x1000 /* set for BNC, clear for AUI/TPE */ +#define MEMPAGE_AUTODETECT 0x0080 /* set for auto-detect of attachment */ +#define TPE_BIT 0x0001 /* set for TPE, clear for other */ + +/* data structure to convert memory setup EEPROM words into register bytes */ + +typedef union mem_setup + { + struct + { + UINT16 memPage; /* from EEX_EEPROM_MEMPAGE */ + UINT16 memDecode; /* from EEX_EEPROM_MEMDECODE */ + } wordView; + struct + { + UINT8 memCtrl; /* to MEMCTRL register */ + UINT8 memPC; /* to MEMPC register */ + UINT8 memDec; /* to MEMDEC register */ + UINT8 memECtrl; /* to MEMECTRL register */ + } byteView; + } MEM_SETUP; + +/* Intel 82586 endian safe link macros and structure definitions */ + +#define LINK_WR(pLink,value) \ + (((pLink)->lsw = (UINT16)((UINT32)(value) & 0x0000ffff)), \ + ((pLink)->msw = (UINT16)(((UINT32)(value) >> 16) & 0x0000ffff))) + +#define LINK_RD(pLink) ((pLink)->lsw | ((pLink)->msw << 16)) + +#define STAT_RD LINK_RD /* statistic read is a link read */ +#define STAT_WR LINK_WR /* statistic write is a link write */ + +typedef UINT16 EEX_SHORTLINK; /* 82586 "offset" field */ +typedef struct eex_link /* EEX_LINK - endian resolvable link */ + { + UINT16 lsw; /* least significant word */ + UINT16 msw; /* most significant word */ + } EEX_LINK; + +typedef struct eex_node /* EEX_NODE - common linked list object */ + { + UINT16 field1; + UINT16 field2; + EEX_LINK lNext; /* link to next node */ + EEX_LINK field4; + UINT16 field5; + UINT16 field6; + UINT8 field7 [EH_SIZE]; + char field8 [ETHERMTU]; + struct eex_node *pNext; /* ptr to next node */ + } EEX_NODE; + +typedef UINT16 EEX_STAT; /* EEX_STAT - 82586 error statistic */ + + + +/* Intel 82586 structure and bit mask definitions */ + +/* System Configuration Pointer and bit field defines */ + +typedef struct scp /* SCP - System Configuration Pointer */ + { + UINT16 scpSysbus; /* SYSBUS */ + UINT16 scpRsv1; /* reserved */ + UINT16 scpRsv2; /* reserved */ + EEX_LINK pIscp; /* ISCP address */ + } SCP; + + +/* Intermediate System Configuration Pointer */ + +typedef struct iscp /* ISCP - Intermediate System Config. Ptr. */ + { + volatile UINT16 iscpBusy; /* i82586 is being initialized */ + EEX_SHORTLINK offsetScb; /* SCB offset */ + EEX_LINK pScb; /* SCB address */ + } ISCP; + + +/* System Control Block and bit field defines */ + +typedef struct scb /* SCB - System Control Block */ + { + volatile UINT16 scbStatus; /* Status Word */ + volatile UINT16 scbCommand; /* Command Word */ + EEX_SHORTLINK pCB; /* command block address */ + EEX_SHORTLINK pRF; /* receive frame area address */ + EEX_STAT crcErr; /* CRC error count */ + EEX_STAT allignErr; /* frames misaligned and CRC err cnt */ + EEX_STAT noResErr; /* no resources error count */ + EEX_STAT ovErr; /* overrun error count */ + } SCB; + +#define SCB_S_RUMASK 0x00f0 /* state mask */ +#define SCB_S_RUIDLE 0x0000 /* RU is idle */ +#define SCB_S_RUSUSP 0x0010 /* RU is suspended */ +#define SCB_S_RUNORSRC 0x0020 /* RU has no resources */ +#define SCB_S_RURSV1 0x0030 /* reserved */ +#define SCB_S_RUREADY 0x0040 /* RU is ready */ +#define SCB_S_CUMASK 0x0f00 /* state mask */ +#define SCB_S_CUIDLE 0x0000 /* CU is idle */ +#define SCB_S_CUSUSP 0x0100 /* CU is suspended */ +#define SCB_S_CUACTIVE 0x0200 /* CU is active */ +#define SCB_S_CURSV1 0x0300 /* reserved */ +#define SCB_S_CURSV2 0x0400 /* reserved */ +#define SCB_S_CURSV3 0x0500 /* reserved */ +#define SCB_S_CURSV4 0x0600 /* reserved */ +#define SCB_S_CURSV5 0x0700 /* reserved */ +#define SCB_S_XMASK 0xf000 /* state mask */ +#define SCB_S_RNR 0x1000 /* RU left the ready state */ +#define SCB_S_CNA 0x2000 /* CU left the active state */ +#define SCB_S_FR 0x4000 /* RU finished receiveing a frame */ +#define SCB_S_CX 0x8000 /* CU finished a cmd with I bit set */ + +#define SCB_C_RUNOP 0x0000 /* NOP */ +#define SCB_C_RUSTART 0x0010 /* start reception of frames */ +#define SCB_C_RURESUME 0x0020 /* resume reception of frames */ +#define SCB_C_RUSUSPEND 0x0030 /* suspend reception of frames */ +#define SCB_C_RUABORT 0x0040 /* abort receiver immediately */ +#define SCB_C_RURSV1 0x0050 /* reserved */ +#define SCB_C_RURSV2 0x0060 /* reserved */ +#define SCB_C_RURSV3 0x0070 /* reserved */ +#define SCB_C_RESET 0x0080 /* reset chip */ +#define SCB_C_CUNOP 0x0000 /* NOP */ +#define SCB_C_CUSTART 0x0100 /* start execution */ +#define SCB_C_CURESUME 0x0200 /* resume execution */ +#define SCB_C_CUSUSPEND 0x0300 /* suspend execution after cur. cmd */ +#define SCB_C_CUABORT 0x0400 /* abort current cmd immediately */ +#define SCB_C_CURSV1 0x0700 /* reserved */ +#define SCB_C_ACK_RNR 0x1000 /* ACK that RU became not ready */ +#define SCB_C_ACK_CNA 0x2000 /* ACK that CU bacame not active */ +#define SCB_C_ACK_FR 0x4000 /* ACK that RU received a frame */ +#define SCB_C_ACK_CX 0x8000 /* ACK that CU completed an action */ + + +/* Action Command Descriptions */ + +typedef struct ac_iasetup /* AC_IASETUP - Individual Address Setup */ + { + UINT8 ciAddress[EA_SIZE]; /* local ethernet address */ + UINT16 ciFill; + } AC_IASETUP; + +typedef struct ac_config /* AC_CONFIG - i82586 Configure */ + { + UINT8 byteCount; /* byte count */ + UINT8 fifoLimit; /* FIFO limit */ + UINT8 srdy_saveBad; /* SRD/~ARDY, save bad frames */ + UINT8 addrLen_loopback; /* address length, loopback */ + UINT8 backoff; /* backoff method */ + UINT8 interframe; /* interframe spacing */ + UINT8 slotTimeLow; /* slot time -low byte */ + UINT8 slotTimeHi_retry; /* slot time -upper 3 bits, max retry */ + UINT8 promiscuous; /* promiscuous mode, other stuff */ + UINT8 carrier_collision; /* carrier sense, collision detect */ + UINT8 minFrame; /* minimum frame length */ + UINT8 notUsed; + UINT16 ccFill; + } AC_CONFIG; + +typedef struct ac_mcast /* AC_MCAST - Multicast Setup */ + { + UINT16 cmMcCount; /* the number of bytes in MC list */ + UINT8 cmAddrList[6 * N_MCAST]; /* mulitcast address list */ + } AC_MCAST; + +typedef struct ac_tdr /* AC_TDR - Time Domain Reflectometry */ + { + UINT16 ctInfo; /* time, link OK, tx err, line err */ + UINT16 ctReserve1; /* reserved */ + } AC_TDR; + +typedef struct ac_dump /* AC_DUMP - Dump */ + { + EEX_SHORTLINK bufAddr; /* address of dump buffer */ + } AC_DUMP; + + +/* Command Frame Description and defines */ + +typedef struct cfd /* CFD - Command Frame Descriptor */ + { + volatile UINT16 cfdStatus; /* command status */ + UINT16 cfdCommand; /* command */ + EEX_SHORTLINK link; /* address of next CB */ + union /* command dependent section */ + { + struct ac_iasetup cfd_iasetup; /* IA setup */ + struct ac_config cfd_config; /* config */ + struct ac_mcast cfd_mcast; /* multicast setup */ + struct ac_tdr cfd_tdr; /* TDR */ + struct ac_dump cfd_dump; /* dump */ + } cfd_cmd; + } CFD; + +#define cfdIASetup cfd_cmd.cfd_iasetup +#define cfdConfig cfd_cmd.cfd_config +#define cfdMcast cfd_cmd.cfd_mcast +#define cfdTransmit cfd_cmd.cfd_transmit +#define cfdTDR cfd_cmd.cfd_tdr +#define cfdDump cfd_cmd.cfd_dump + +#define CFD_C_NOP 0x0000 /* No Operation */ +#define CFD_C_IASETUP 0x0001 /* Individual Address Setup */ +#define CFD_C_CONFIG 0x0002 /* Configure Chip */ +#define CFD_C_MASETUP 0x0003 /* Multicast Setup */ +#define CFD_C_XMIT 0x0004 /* Transmit (see below too ...) */ +#define CFD_C_TDR 0x0005 /* Time Domain Reflectometry */ +#define CFD_C_DUMP 0x0006 /* Dump Registers */ +#define CFD_C_DIAG 0x0007 /* Diagnose */ +#define CFD_C_INT 0x2000 /* 586 interrupts CPU after execution */ +#define CFD_C_SE 0x4000 /* CU should suspend after execution */ +#define CFD_C_EL 0x8000 /* End of command list */ + +#define CFD_S_ABORTED 0x1000 /* Command was aborted via CU Abort */ +#define CFD_S_OK 0x2000 /* Command completed successfully */ +#define CFD_S_BUSY 0x4000 /* CU is executing this command */ +#define CFD_S_COMPLETE 0x8000 /* Command complete */ + + +/* 82586 Transmit/Receive Frames */ + +typedef struct tfd /* TFD - Transmit Frame Descriptor */ + { + volatile UINT16 status; /* status field */ + UINT16 command; /* command field */ + EEX_SHORTLINK lNext; /* link to next desc. */ + EEX_SHORTLINK lBufDesc; /* link to buf desc. */ + } TFD; + +/* special TFD specific command block bit masks */ + +#define CFD_S_COLL_MASK 0x000f /* to access number of collisions */ +#define CFD_S_RETRY 0x0020 /* reached the max number of retries */ +#define CFD_S_HBEAT 0x0040 /* Heartbeat Indicator */ +#define CFD_S_TRDEF 0x0080 /* Transmission Deferred */ +#define CFD_S_DMA_UNDR 0x0100 /* DMA Underrun (no data) */ +#define CFD_S_NO_CTS 0x0200 /* Lost Clear To Send signal */ +#define CFD_S_NO_CRS 0x0400 /* No Carrier Sense */ + + +typedef struct tbd /* TBD - Transmit Buffer Descriptor */ + { + volatile UINT16 actCount; /* Actual byte count */ + EEX_SHORTLINK lNext; /* Address of next buffer descr. */ + EEX_LINK lBufAddr; /* Address of this data buffer */ + } TBD; + +/* TBD bits */ + +#define ACT_COUNT_MASK ~0xc000 /* length fields are 14 bits */ +#define TBD_S_EOF 0x8000 /* End-of-frame bit */ + +#ifdef EEX_AL_LOC +typedef struct tframe /* TFRAME - all-in-one transmit frame */ + { + TFD tfd; + TBD tbd; + char buffer [FRAME_SIZE]; + } TFRAME; +#else +typedef struct tframe /* TFRAME - all-in-one transmit frame */ + { + TFD tfd; + union + { + struct + { + char header [EH_SIZE]; + char data [ETHERMTU]; + } buff_struct; + char buffer [FRAME_SIZE]; + } buff_union; + TBD tbd; + } TFRAME; +#endif /* EEX_AL_LOC */ + + +typedef struct rfd /* RFD - Receive Frame Descriptor */ + { + volatile UINT16 status; /* status field */ + UINT16 command; /* command field */ + EEX_SHORTLINK lNext; /* link to next desc. */ + EEX_SHORTLINK lBufDesc; /* link to buf desc. */ + } RFD; + +/* RFD bit masks */ + +#define RFD_S_EOP 0x0040 /* no EOP flag */ +#define RFD_S_SHORT 0x0080 /* fewer bytes than configured min. */ +#define RFD_S_DMA 0x0100 /* DMA Overrun failure to get bus */ +#define RFD_S_RSRC 0x0200 /* received, but ran out of buffers */ +#define RFD_S_ALGN 0x0400 /* received misaligned with CRC error */ +#define RFD_S_CRC 0x0800 /* received with CRC error */ +#define RFD_S_OK 0x2000 /* frame received successfully */ +#define RFD_S_BUSY 0x4000 /* frame reception ready/in progress */ +#define RFD_S_COMPLETE 0x8000 /* frame reception complete */ + +#define RFD_M_SUSPEND 0x4000 /* suspend RU after receiving frame */ +#define RFD_M_EL 0x8000 /* end of RFD list */ + +typedef struct rbd /* RBD - Receive Buffer Descriptor */ + { + volatile UINT16 actCount; /* Actual byte count */ + EEX_SHORTLINK lNext; /* Address of next buffer descr. */ + EEX_LINK lBufAddr; /* Address of this data buffer */ + UINT16 bufSize; /* Size of data buffer */ + } RBD; + +#define RBD_S_CNT_MASK 0x3fff /* Mask for actual byte count */ +#define RBD_S_F_BIT 0x4000 /* actual count is valid */ +#define RBD_S_EOF 0x8000 /* end of frame */ + +#define RBD_M_EL 0x8000 /* end of RBD list */ + +#ifdef EEX_AL_LOC +typedef struct rframe /* RFRAME - all-in-one received frame */ + { + RFD rfd; + RBD rbd; + char buffer [FRAME_SIZE]; + } RFRAME; +#else +typedef struct rframe /* RFRAME - all-in-one received frame */ + { + RFD rfd; + union + { + struct + { + char header [EH_SIZE]; + char data [ETHERMTU]; + } buff_struct; + char buffer [FRAME_SIZE]; + } buff_union; + RBD rbd; + } RFRAME; +#endif /* EEX_AL_LOC */ + +/* Offsets into xFRAME structures to compute board emmory offsets */ + +#define RF_COMMAND 2 /* command word */ +#define RF_LINK 4 /* link to next RFD */ + +#define RB_OFFSET 6 /* dhe 10/24/94 offset of first RBD */ +#define RB_LINK 2 /* dhe 10/24/94 link to next RBD */ + +#ifdef EEX_AL_LOC +#define RF_ACT_COUNT 8 /* actual count in RBD */ +#define RF_BUFFER 18 /* frame data buffer */ +#else +#define RF_BUFFER 8 /* frame data buffer */ +#define RF_ACT_COUNT (RF_BUFFER + FRAME_SIZE) +#endif /* EEX_AL_LOC */ + +#define TF_COMMAND 2 /* command word */ +#define TF_LINK 4 /* link to next TFD */ + +#ifdef EEX_AL_LOC +#define TF_ACT_COUNT 8 /* actual count in TBD */ +#define TF_BUFFER 16 /* frame data buffer */ +#else +#define TF_BUFFER 8 /* frame header starts here */ +#define TF_OLDLENGTH 20 /* Take length from here */ +#define TF_NEWLENGTH 14 /* put it here to be part of TFD */ +#define TF_ACT_COUNT (RF_BUFFER + FRAME_SIZE) +#endif /* EEX_AL_LOC */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_eexh */ + diff --git a/h/drv/netif/if_eex32.h b/h/drv/netif/if_eex32.h new file mode 100644 index 0000000..722e56d --- /dev/null +++ b/h/drv/netif/if_eex32.h @@ -0,0 +1,67 @@ +/* if_eex32.h - header file for interl EtherExpress Flash 32 */ + +/* Copyright 1984-2002, Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,26apr02,dat Adding cplusplus protection, SPR 75017 +01c,06mar96,hdn moved from config/pc386. +01b,28jun94,vin included in the BSP. +01a,12may94,bcs written +*/ + +#ifndef __INCif_eex32h +#define __INCif_eex32h + +#ifdef __cplusplus +extern "C" { +#endif + + +/* I/O offsets (from EISA slot base address) */ + +#define CA 0x0000 /* 82596 Channel Attention */ +#define PORT 0x0008 /* 82596 PORT (DWORD) */ +#define EISA_ID0 0x0c80 /* EISA Product Identifier byte 0 */ +#define EISA_ID1 0x0c81 /* EISA Product Identifier byte 1 */ +#define EISA_ID2 0x0c82 /* EISA Product Identifier byte 2 */ +#define EISA_ID3 0x0c83 /* EISA Product Identifier byte 3 */ +#define EBC 0x0c84 /* Expansion Board Control */ +#define PLX_CONF0 0x0c88 /* PLX IRQ Control & Preempt Time */ +#define PLX_CONF1 0x0c89 /* PLX USER Pins (media select) */ +#define PLX_CONF2 0x0c8a /* PLX EEPROM Control (NOT USED) */ +#define PLX_CONF3 0x0c8f /* PLX SW Reset, Burst Enable */ +#define NET_IA0 0x0c90 /* Ethernet Individual Address */ + +#define FLCTL0 0x0400 /* Flash Base Address, FWE0- */ +#define FLCTL1 0x0410 /* Flash Base Control */ +#define FLADDR 0x0420 /* Flash High Address Lines */ +#define IRQCTL 0x0430 /* Interrupt Control */ + +/* Important values */ + +#define EEX32_EISA_ID0 0x25 +#define EEX32_EISA_ID1 0xd4 +#define EEX32_EISA_ID2 0x10 +#define EEX32_EISA_ID3 0x10 + + +/* Interrupt control bits (FLEA ASIC) */ + +#define IRQ_EDGE 0x01 /* Interrupt is edge-triggered (RO) */ +#define IRQ_SEL0 0x02 /* IRQ selection bit */ +#define IRQ_SEL1 0x04 /* IRQ selection bit */ +#define IRQ_LATCH 0x08 /* Set to enable latched mode */ +#define IRQ_INTSTAT 0x10 /* Set when interrupt active; write 1 */ + /* to clear interrupt after handling */ +#define IRQ_FORCE_LOW 0x20 /* Set to force IRQ low (disabled) */ +#define IRQ_SW_INT 0x40 /* Set to cause interrupt for testing */ +#define IRQ_EXTEND 0x80 /* Set to enable FLEA IRQs */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_eex32h */ diff --git a/h/drv/netif/if_ei.h b/h/drv/netif/if_ei.h new file mode 100644 index 0000000..3c01a39 --- /dev/null +++ b/h/drv/netif/if_ei.h @@ -0,0 +1,344 @@ +/* if_ei.h - Intel 82596 network interface header */ + +/* Copyright 1990-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02i,09nov01,dat Adding obsolescence warnings to outdated drivers +02h,22sep92,rrr added support for c++ +02g,29jul92,rrr Grabbed ricks if_ei.h header file and checked it in in hope of + getting the ei driver to work. +02f,16jul92,rfs Moved driver specific items to driver file, where they belong. +02e,26may92,rrr the tree shuffle +02d,12nov91,wmd added two elements to EI_SOFTC, wid and transLock. +02c,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +02b,16sep91,rfs added two elements to EI_SOFTC +02a,22jul91,jcf completely rewritten to utilize simplified mode, + rfs added big endian support, reworked buffer loaning. +01e,01may91,elh added rbufRefCnt for buffer loaning support. +01d,08jan91,gae removed CDELAY. +01c,04jan91,gae installed Intel changes and more cleanup. +01b,12dec90,elh cleaned up, merged with if_eivar.h +01a,01nov90,rl written. +*/ + +#ifndef __INCif_eih +#define __INCif_eih + +#ifdef __cplusplus +extern "C" { +#endif + +#warning "if_ei driver is obsolete, please use ei82596End driver" + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* constants needed within this file */ + +#define EH_SIZE 14 /* avoid structure padding issues */ +#define N_MCAST 12 + + +/* Intel 82596 endian safe link macros and structure definitions */ + +#define LINK_WR(pLink,value) \ + (((pLink)->lsw = (UINT16)((UINT32)(value) & 0x0000ffff)), \ + ((pLink)->msw = (UINT16)(((UINT32)(value) >> 16) & 0x0000ffff))) + +#define LINK_RD(pLink) ((pLink)->lsw | ((pLink)->msw << 16)) + +#define STAT_RD LINK_RD /* statistic read is a link read */ +#define STAT_WR LINK_WR /* statistic write is a link write */ + +typedef struct ei_link /* EI_LINK - endian resolvable link */ + { + UINT16 lsw; /* least significant word */ + UINT16 msw; /* most significant word */ + } EI_LINK; + +typedef struct ei_node /* EI_NODE - common linked list object */ + { + UINT16 field1; + UINT16 field2; + EI_LINK lNext; /* link to next node */ + EI_LINK field4; + UINT16 field5; + UINT16 field6; + UINT8 field7 [EH_SIZE]; + char field8 [ETHERMTU]; + struct ei_node *pNext; /* ptr to next node */ + } EI_NODE; + +typedef EI_LINK EI_STAT; /* EI_STAT - 82596 error statistic */ + + +/* Intel 82596 structure and bit mask definitions */ + +/* PORT commands */ + +#define PORT_RESET 0x0 +#define PORT_SELFTEST 0x1 +#define PORT_NEWSCP 0x2 +#define PORT_DUMP 0x3 + + +/* System Configuration Pointer and bit field defines */ + +typedef struct scp /* SCP - System Configuration Pointer */ + { + UINT16 scpRsv1; /* reserved */ + UINT16 scpSysbus; /* SYSBUS */ + UINT16 scpRsv2; /* reserved */ + UINT16 scpRsv3; /* reserved */ + EI_LINK pIscp; /* ISCP address */ + } SCP; + +#define SCP_MODE_82586 0x0000 /* operate in i82586 mode */ +#define SCP_MODE_SEGMENTED 0x0002 /* operate in i82596 segmented mode */ +#define SCP_MODE_LINEAR 0x0004 /* operate in i82596 linear mode */ +#define SCP_EXT_TRIGGER 0x0008 /* ext. trig. of Bus Throttle timers */ +#define SCP_LOCK_DISABLE 0x0010 /* lock function disabled */ +#define SCP_INT_LOW 0x0020 /* interrupt pin is active low */ +#define SCP_SYSBUS_BIT6 0x0040 /* reserved - bit 6 - *MUST BE ONE* */ +#define SCP_SYSBUS_BIT7 0x0080 /* reserved - bit 7 - *MUST BE ZERO* */ + + +/* Intermediate System Configuration Pointer */ + +typedef struct iscp /* ISCP - Intermediate System Config. Ptr. */ + { + volatile UINT16 iscpBusy; /* i82596 is being initialized */ + UINT16 iscpRsv1; /* reserved */ + EI_LINK pScb; /* SCB address */ + } ISCP; + + +/* System Control Block and bit field defines */ + +typedef struct scb /* SCB - System Control Block */ + { + volatile UINT16 scbStatus; /* Status Word */ + volatile UINT16 scbCommand; /* Command Word */ + EI_LINK pCB; /* command block address */ + EI_LINK pRF; /* receive frame area address */ + EI_STAT crcErr; /* CRC error count */ + EI_STAT allignErr; /* frames misaligned and CRC err cnt */ + EI_STAT noResErr; /* no resources error count */ + EI_STAT ovErr; /* overrun error count */ + EI_STAT cdErr; /* collision detected error count */ + EI_STAT frameErr; /* short frame error count */ + UINT16 tOff; /* T-off timer */ + UINT16 tOn; /* T-on timer */ + } SCB; + +#define SCB_S_RUIDLE 0x0000 /* RU is idle */ +#define SCB_S_BTTL 0x0008 /* Bus Throttle timers loaded */ +#define SCB_S_RUMASK 0x00f0 /* state mask */ +#define SCB_S_RUSUSP 0x0010 /* RU is suspended */ +#define SCB_S_RUNORSRC 0x0020 /* RU has no resources */ +#define SCB_S_RURSV1 0x0030 /* reserved */ +#define SCB_S_RUREADY 0x0040 /* RU is ready */ +#define SCB_S_RUNRBD 0x0080 /* RU has no more RBD's */ +#define SCB_S_RUNORSRCR 0x00a0 /* RU no more resources/no more RBD's */ +#define SCB_S_CUMASK 0x0f00 /* state mask */ +#define SCB_S_CUSUSP 0x0100 /* CU is suspended */ +#define SCB_S_CUACTIVE 0x0200 /* CU is active */ +#define SCB_S_CURSV1 0x0300 /* reserved */ +#define SCB_S_CURSV2 0x0400 /* reserved */ +#define SCB_S_CURSV3 0x0500 /* reserved */ +#define SCB_S_CURSV4 0x0600 /* reserved */ +#define SCB_S_CURSV5 0x0700 /* reserved */ +#define SCB_S_XMASK 0xf000 /* state mask */ +#define SCB_S_CUIDLE 0x0000 /* CU is idle */ +#define SCB_S_RNR 0x1000 /* RU left the ready state */ +#define SCB_S_CNA 0x2000 /* CU left the active state */ +#define SCB_S_FR 0x4000 /* RU finished receiveing a frame */ +#define SCB_S_CX 0x8000 /* CU finished a cmd with I bit set */ + +#define SCB_C_RUNOP 0x0000 /* NOP */ +#define SCB_C_RUSTART 0x0010 /* start reception of frames */ +#define SCB_C_RURESUME 0x0020 /* resume reception of frames */ +#define SCB_C_RUSUSPEND 0x0030 /* suspend reception of frames */ +#define SCB_C_RUABORT 0x0040 /* abort receiver immediately */ +#define SCB_C_RURSV1 0x0050 /* reserved */ +#define SCB_C_RURSV2 0x0060 /* reserved */ +#define SCB_C_RURSV3 0x0070 /* reserved */ +#define SCB_C_RESET 0x0080 /* reset chip */ +#define SCB_C_CUNOP 0x0000 /* NOP */ +#define SCB_C_CUSTART 0x0100 /* start execution */ +#define SCB_C_CURESUME 0x0200 /* resume execution */ +#define SCB_C_CUSUSPEND 0x0300 /* suspend execution after cur. cmd */ +#define SCB_C_CUABORT 0x0400 /* abort current cmd immediately */ +#define SCB_C_CULOADBT 0x0500 /* load bus throttle timers after cnt */ +#define SCB_C_CULDBTIMM 0x0600 /* load bus throttle timers now */ +#define SCB_C_CURSV1 0x0700 /* reserved */ +#define SCB_C_ACK_RNR 0x1000 /* ACK that RU became not ready */ +#define SCB_C_ACK_CNA 0x2000 /* ACK that CU bacame not active */ +#define SCB_C_ACK_FR 0x4000 /* ACK that RU received a frame */ +#define SCB_C_ACK_CX 0x8000 /* ACK that CU completed an action */ + + +/* Action Command Descriptions */ + +typedef struct ac_iasetup /* AC_IASETUP - Individual Address Setup */ + { + UINT8 ciAddress[6]; /* local ethernet address */ + UINT16 ciFill; + } AC_IASETUP; + +typedef struct ac_config /* AC_CONFIG - i82596 Configure */ + { + UINT8 ccByte8; /* byte count, prefetched bit*/ + UINT8 ccByte9; /* FIFO limit, monitor bits */ + UINT8 ccByte10; /* save bad frames */ + UINT8 ccByte11; /* address length, loopback */ + UINT8 ccByte12; /* backoff method */ + UINT8 ccByte13; /* interframe spacing */ + UINT8 ccByte14; /* slot time -low byte */ + UINT8 ccByte15; /* slot time -upper 3 bits, max retry */ + UINT8 ccByte16; /* promiscuious mode, CRC, padding */ + UINT8 ccByte17; /* carrier sense, collision detect */ + UINT8 ccByte18; /* minimum frame length */ + UINT8 ccByte19; /* auto retransmit, multicast,... */ + UINT8 ccByte20; /* DCR slot num, full duplex */ + UINT8 ccByte21; /* disable backoff, ... */ + UINT16 ccFill; + } AC_CONFIG; + +typedef struct ac_mcast /* AC_MCAST - Mulitcast Setup */ + { + UINT16 cmMcCount; /* the number of bytes in MC list */ + UINT8 cmAddrList[6 * N_MCAST]; /* mulitcast address list */ + } AC_MCAST; + +typedef struct ac_tdr /* AC_TDR - Time Domain Reflectometry */ + { + UINT16 ctInfo; /* time, link OK, tx err, line err */ + UINT16 ctReserve1; /* reserved */ + } AC_TDR; + +typedef struct ac_dump /* AC_DUMP - Dump */ + { + EI_LINK bufAddr; /* address of dump buffer */ + } AC_DUMP; + + +/* Command Frame Description and defines */ + +typedef struct cfd /* CFD - Command Frame Descriptor */ + { + volatile UINT16 cfdStatus; /* command status */ + UINT16 cfdCommand; /* command */ + EI_LINK link; /* address of next CB */ + union /* command dependent section */ + { + struct ac_iasetup cfd_iasetup; /* IA setup */ + struct ac_config cfd_config; /* config */ + struct ac_mcast cfd_mcast; /* multicast setup */ + struct ac_tdr cfd_tdr; /* TDR */ + struct ac_dump cfd_dump; /* dump */ + } cfd_cmd; + } CFD; + +#define cfdIASetup cfd_cmd.cfd_iasetup +#define cfdConfig cfd_cmd.cfd_config +#define cfdMcast cfd_cmd.cfd_mcast +#define cfdTDR cfd_cmd.cfd_tdr +#define cfdDump cfd_cmd.cfd_dump + +#define CFD_C_NOP 0x0000 /* No Operation */ +#define CFD_C_IASETUP 0x0001 /* Individual Address Setup */ +#define CFD_C_CONFIG 0x0002 /* Configure Chip */ +#define CFD_C_MASETUP 0x0003 /* Multicast Setup */ +#define CFD_C_XMIT 0x0004 /* Transmit (see below too ...) */ +#define CFD_C_TDR 0x0005 /* Time Domain Reflectometry */ +#define CFD_C_DUMP 0x0006 /* Dump Registers */ +#define CFD_C_DIAG 0x0007 /* Diagnose */ +#define CFD_C_INT 0x2000 /* 596 interrupts CPU after execution */ +#define CFD_C_SE 0x4000 /* CU should suspend after execution */ +#define CFD_C_EL 0x8000 /* End of command list */ + +#define CFD_S_ABORTED 0x1000 /* Command was aborted via CU Abort */ +#define CFD_S_OK 0x2000 /* Command completed successfully */ +#define CFD_S_BUSY 0x4000 /* CU is executing this command */ +#define CFD_S_COMPLETE 0x8000 /* Command complete */ + + +/* 82596 Transmit/Receive Frames */ + +typedef struct tfd /* TFD - Transmit Frame Descriptor */ + { + volatile UINT16 status; /* status field */ + UINT16 command; /* command field */ + EI_LINK lNext; /* link to next desc. */ + EI_LINK lBufDesc; /* link to buf desc. */ + UINT16 count; /* length of data */ + UINT16 reserved; /* not used */ + UINT8 enetHdr [EH_SIZE]; /* the ethernet header */ + char enetData [ETHERMTU]; /* transmit data */ + struct tfd *pNext; /* ptr to next desc. */ + } TFD; + +/* special TFD specific command block bit masks */ + +#define CFD_C_TX_FLEX 0x0008 /* Use Flexible Mode */ +#define CFD_C_TX_NOCRC 0x0010 /* Do not insert CRC */ + +#define CFD_S_COLL_MASK 0x000f /* to access number of collisions */ +#define CFD_S_RETRY 0x0020 /* reached the max number of retries */ +#define CFD_S_HBEAT 0x0040 /* Heartbeat Indicator */ +#define CFD_S_TRDEF 0x0080 /* Transmission Deferred */ +#define CFD_S_DMA_UNDR 0x0100 /* DMA Underrun (no data) */ +#define CFD_S_NO_CTS 0x0200 /* Lost Clear To Send signal */ +#define CFD_S_NO_CRS 0x0400 /* No Carrier Sense */ +#define CFD_S_LATE_COLL 0x0800 /* Late collision is detected */ + +#define TFD_CNT_EOF 0x8000 /* all data kept in TFD */ + + +typedef struct rfd /* RFD - Receive Frame Descriptor */ + { + volatile UINT16 status; /* status field */ + UINT16 command; /* command field */ + EI_LINK lNext; /* link to next desc. */ + EI_LINK lBufDesc; /* link to buf desc. */ + volatile UINT16 actualCnt; /* actual byte count */ + UINT16 bufSize; /* buffer size */ + UINT8 enetHdr [EH_SIZE]; /* the ethernet header */ + char enetData [ETHERMTU]; /* received data */ + struct tfd *pNext; /* ptr to next desc. */ + UINT8 refCnt; /* reference count */ + } RFD; + +/* RFD bit masks */ + +#define RFD_S_COLL 0x0001 /* collision during reception */ +#define RFD_S_EOP 0x0040 /* no EOP flag */ +#define RFD_S_MATCH 0x0080 /* dest Addr matched the IA address */ +#define RFD_S_DMA 0x0100 /* DMA Overrun failure to get bus */ +#define RFD_S_RSRC 0x0200 /* received, but ran out of buffers */ +#define RFD_S_ALGN 0x0400 /* received misaligned with CRC error */ +#define RFD_S_CRC 0x0800 /* received with CRC error */ +#define RFD_S_LEN 0x1000 /* received with length error */ +#define RFD_S_OK 0x2000 /* frame received successfully */ +#define RFD_S_BUSY 0x4000 /* frame reception ready/in progress */ +#define RFD_S_COMPLETE 0x8000 /* frame reception complete */ + +#define RFD_M_FLEXMODE 0x0008 /* flexible mode */ +#define RFD_M_SUSPEND 0x4000 /* suspend RU after receiving frame */ +#define RFD_M_EL 0x8000 /* end of RFD list */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_eih */ diff --git a/h/drv/netif/if_eihk.h b/h/drv/netif/if_eihk.h new file mode 100644 index 0000000..99c5093 --- /dev/null +++ b/h/drv/netif/if_eihk.h @@ -0,0 +1,348 @@ +/* if_eihk.h - Intel 82596 network interface header for hkv3500 */ + +/* Copyright 1990-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,09nov01,dat Adding obsolescence warnings to outdated drivers +01a,28apr97,map created from if_ei.h ver 02h. word-align enetData; + use RBD in RFD. [SPR# 3511] +*/ + +#ifndef __INCif_eihkh +#define __INCif_eihkh + +#ifdef __cplusplus +extern "C" { +#endif + +#warning "if_eihk driver is obsolete, please use ei82596End driver" + +#if CPU_FAMILY==I960 +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* constants needed within this file */ + +#define EH_SIZE 14 /* avoid structure padding issues */ +#define N_MCAST 12 + + +/* Intel 82596 endian safe link macros and structure definitions */ + +#define LINK_WR(pLink,value) \ + (((pLink)->lsw = (UINT16)((UINT32)(value) & 0x0000ffff)), \ + ((pLink)->msw = (UINT16)(((UINT32)(value) >> 16) & 0x0000ffff))) + +#define LINK_RD(pLink) ((pLink)->lsw | ((pLink)->msw << 16)) + +#define STAT_RD LINK_RD /* statistic read is a link read */ +#define STAT_WR LINK_WR /* statistic write is a link write */ + +typedef struct ei_link /* EI_LINK - endian resolvable link */ + { + UINT16 lsw; /* least significant word */ + UINT16 msw; /* most significant word */ + } EI_LINK; + +typedef struct ei_node /* EI_NODE - common linked list object */ + { + UINT16 field1; + UINT16 field2; + EI_LINK lNext; /* link to next node */ + EI_LINK field4; + UINT16 field5; + UINT16 field6; + UINT8 field7 [EH_SIZE]; + char field8 [ETHERMTU]; + char pad[2]; /* alignment */ + struct ei_node *pNext; /* ptr to next node */ + } EI_NODE; + +typedef EI_LINK EI_STAT; /* EI_STAT - 82596 error statistic */ + + +/* Intel 82596 structure and bit mask definitions */ + +/* PORT commands */ + +#define PORT_RESET 0x0 +#define PORT_SELFTEST 0x1 +#define PORT_NEWSCP 0x2 +#define PORT_DUMP 0x3 + + +/* System Configuration Pointer and bit field defines */ + +typedef struct scp /* SCP - System Configuration Pointer */ + { + UINT16 scpRsv1; /* reserved */ + UINT16 scpSysbus; /* SYSBUS */ + UINT16 scpRsv2; /* reserved */ + UINT16 scpRsv3; /* reserved */ + EI_LINK pIscp; /* ISCP address */ + } SCP; + +#define SCP_MODE_82586 0x0000 /* operate in i82586 mode */ +#define SCP_MODE_SEGMENTED 0x0002 /* operate in i82596 segmented mode */ +#define SCP_MODE_LINEAR 0x0004 /* operate in i82596 linear mode */ +#define SCP_EXT_TRIGGER 0x0008 /* ext. trig. of Bus Throttle timers */ +#define SCP_LOCK_DISABLE 0x0010 /* lock function disabled */ +#define SCP_INT_LOW 0x0020 /* interrupt pin is active low */ +#define SCP_SYSBUS_BIT6 0x0040 /* reserved - bit 6 - *MUST BE ONE* */ +#define SCP_SYSBUS_BIT7 0x0080 /* reserved - bit 7 - *MUST BE ZERO* */ + + +/* Intermediate System Configuration Pointer */ + +typedef struct iscp /* ISCP - Intermediate System Config. Ptr. */ + { + volatile UINT16 iscpBusy; /* i82596 is being initialized */ + UINT16 iscpRsv1; /* reserved */ + EI_LINK pScb; /* SCB address */ + } ISCP; + + +/* System Control Block and bit field defines */ + +typedef struct scb /* SCB - System Control Block */ + { + volatile UINT16 scbStatus; /* Status Word */ + volatile UINT16 scbCommand; /* Command Word */ + EI_LINK pCB; /* command block address */ + EI_LINK pRF; /* receive frame area address */ + EI_STAT crcErr; /* CRC error count */ + EI_STAT allignErr; /* frames misaligned and CRC err cnt */ + EI_STAT noResErr; /* no resources error count */ + EI_STAT ovErr; /* overrun error count */ + EI_STAT cdErr; /* collision detected error count */ + EI_STAT frameErr; /* short frame error count */ + UINT16 tOff; /* T-off timer */ + UINT16 tOn; /* T-on timer */ + } SCB; + +#define SCB_S_RUIDLE 0x0000 /* RU is idle */ +#define SCB_S_BTTL 0x0008 /* Bus Throttle timers loaded */ +#define SCB_S_RUMASK 0x00f0 /* state mask */ +#define SCB_S_RUSUSP 0x0010 /* RU is suspended */ +#define SCB_S_RUNORSRC 0x0020 /* RU has no resources */ +#define SCB_S_RURSV1 0x0030 /* reserved */ +#define SCB_S_RUREADY 0x0040 /* RU is ready */ +#define SCB_S_RUNRBD 0x0080 /* RU has no more RBD's */ +#define SCB_S_RUNORSRCR 0x00a0 /* RU no more resources/no more RBD's */ +#define SCB_S_CUMASK 0x0f00 /* state mask */ +#define SCB_S_CUSUSP 0x0100 /* CU is suspended */ +#define SCB_S_CUACTIVE 0x0200 /* CU is active */ +#define SCB_S_CURSV1 0x0300 /* reserved */ +#define SCB_S_CURSV2 0x0400 /* reserved */ +#define SCB_S_CURSV3 0x0500 /* reserved */ +#define SCB_S_CURSV4 0x0600 /* reserved */ +#define SCB_S_CURSV5 0x0700 /* reserved */ +#define SCB_S_XMASK 0xf000 /* state mask */ +#define SCB_S_CUIDLE 0x0000 /* CU is idle */ +#define SCB_S_RNR 0x1000 /* RU left the ready state */ +#define SCB_S_CNA 0x2000 /* CU left the active state */ +#define SCB_S_FR 0x4000 /* RU finished receiveing a frame */ +#define SCB_S_CX 0x8000 /* CU finished a cmd with I bit set */ + +#define SCB_C_RUNOP 0x0000 /* NOP */ +#define SCB_C_RUSTART 0x0010 /* start reception of frames */ +#define SCB_C_RURESUME 0x0020 /* resume reception of frames */ +#define SCB_C_RUSUSPEND 0x0030 /* suspend reception of frames */ +#define SCB_C_RUABORT 0x0040 /* abort receiver immediately */ +#define SCB_C_RURSV1 0x0050 /* reserved */ +#define SCB_C_RURSV2 0x0060 /* reserved */ +#define SCB_C_RURSV3 0x0070 /* reserved */ +#define SCB_C_RESET 0x0080 /* reset chip */ +#define SCB_C_CUNOP 0x0000 /* NOP */ +#define SCB_C_CUSTART 0x0100 /* start execution */ +#define SCB_C_CURESUME 0x0200 /* resume execution */ +#define SCB_C_CUSUSPEND 0x0300 /* suspend execution after cur. cmd */ +#define SCB_C_CUABORT 0x0400 /* abort current cmd immediately */ +#define SCB_C_CULOADBT 0x0500 /* load bus throttle timers after cnt */ +#define SCB_C_CULDBTIMM 0x0600 /* load bus throttle timers now */ +#define SCB_C_CURSV1 0x0700 /* reserved */ +#define SCB_C_ACK_RNR 0x1000 /* ACK that RU became not ready */ +#define SCB_C_ACK_CNA 0x2000 /* ACK that CU bacame not active */ +#define SCB_C_ACK_FR 0x4000 /* ACK that RU received a frame */ +#define SCB_C_ACK_CX 0x8000 /* ACK that CU completed an action */ + + +/* Action Command Descriptions */ + +typedef struct ac_iasetup /* AC_IASETUP - Individual Address Setup */ + { + UINT8 ciAddress[6]; /* local ethernet address */ + UINT16 ciFill; + } AC_IASETUP; + +typedef struct ac_config /* AC_CONFIG - i82596 Configure */ + { + UINT8 ccByte8; /* byte count, prefetched bit*/ + UINT8 ccByte9; /* FIFO limit, monitor bits */ + UINT8 ccByte10; /* save bad frames */ + UINT8 ccByte11; /* address length, loopback */ + UINT8 ccByte12; /* backoff method */ + UINT8 ccByte13; /* interframe spacing */ + UINT8 ccByte14; /* slot time -low byte */ + UINT8 ccByte15; /* slot time -upper 3 bits, max retry */ + UINT8 ccByte16; /* promiscuious mode, CRC, padding */ + UINT8 ccByte17; /* carrier sense, collision detect */ + UINT8 ccByte18; /* minimum frame length */ + UINT8 ccByte19; /* auto retransmit, multicast,... */ + UINT8 ccByte20; /* DCR slot num, full duplex */ + UINT8 ccByte21; /* disable backoff, ... */ + UINT16 ccFill; + } AC_CONFIG; + +typedef struct ac_mcast /* AC_MCAST - Mulitcast Setup */ + { + UINT16 cmMcCount; /* the number of bytes in MC list */ + UINT8 cmAddrList[6 * N_MCAST]; /* mulitcast address list */ + } AC_MCAST; + +typedef struct ac_tdr /* AC_TDR - Time Domain Reflectometry */ + { + UINT16 ctInfo; /* time, link OK, tx err, line err */ + UINT16 ctReserve1; /* reserved */ + } AC_TDR; + +typedef struct ac_dump /* AC_DUMP - Dump */ + { + EI_LINK bufAddr; /* address of dump buffer */ + } AC_DUMP; + + +/* Command Frame Description and defines */ + +typedef struct cfd /* CFD - Command Frame Descriptor */ + { + volatile UINT16 cfdStatus; /* command status */ + UINT16 cfdCommand; /* command */ + EI_LINK link; /* address of next CB */ + union /* command dependent section */ + { + struct ac_iasetup cfd_iasetup; /* IA setup */ + struct ac_config cfd_config; /* config */ + struct ac_mcast cfd_mcast; /* multicast setup */ + struct ac_tdr cfd_tdr; /* TDR */ + struct ac_dump cfd_dump; /* dump */ + } cfd_cmd; + } CFD; + +#define cfdIASetup cfd_cmd.cfd_iasetup +#define cfdConfig cfd_cmd.cfd_config +#define cfdMcast cfd_cmd.cfd_mcast +#define cfdTDR cfd_cmd.cfd_tdr +#define cfdDump cfd_cmd.cfd_dump + +#define CFD_C_NOP 0x0000 /* No Operation */ +#define CFD_C_IASETUP 0x0001 /* Individual Address Setup */ +#define CFD_C_CONFIG 0x0002 /* Configure Chip */ +#define CFD_C_MASETUP 0x0003 /* Multicast Setup */ +#define CFD_C_XMIT 0x0004 /* Transmit (see below too ...) */ +#define CFD_C_TDR 0x0005 /* Time Domain Reflectometry */ +#define CFD_C_DUMP 0x0006 /* Dump Registers */ +#define CFD_C_DIAG 0x0007 /* Diagnose */ +#define CFD_C_INT 0x2000 /* 596 interrupts CPU after execution */ +#define CFD_C_SE 0x4000 /* CU should suspend after execution */ +#define CFD_C_EL 0x8000 /* End of command list */ + +#define CFD_S_ABORTED 0x1000 /* Command was aborted via CU Abort */ +#define CFD_S_OK 0x2000 /* Command completed successfully */ +#define CFD_S_BUSY 0x4000 /* CU is executing this command */ +#define CFD_S_COMPLETE 0x8000 /* Command complete */ + + +/* 82596 Transmit/Receive Frames */ + +typedef struct tfd /* TFD - Transmit Frame Descriptor */ + { + volatile UINT16 status; /* status field */ + UINT16 command; /* command field */ + EI_LINK lNext; /* link to next desc. */ + EI_LINK lBufDesc; /* link to buf desc. */ + UINT16 count; /* length of data */ + UINT16 reserved; /* not used */ + UINT8 enetHdr [EH_SIZE]; /* the ethernet header */ + char enetData [ETHERMTU]; /* transmit data */ + char pad[2]; /* alignment */ + struct tfd *pNext; /* ptr to next desc. */ + } TFD; + +/* special TFD specific command block bit masks */ + +#define CFD_C_TX_FLEX 0x0008 /* Use Flexible Mode */ +#define CFD_C_TX_NOCRC 0x0010 /* Do not insert CRC */ + +#define CFD_S_COLL_MASK 0x000f /* to access number of collisions */ +#define CFD_S_RETRY 0x0020 /* reached the max number of retries */ +#define CFD_S_HBEAT 0x0040 /* Heartbeat Indicator */ +#define CFD_S_TRDEF 0x0080 /* Transmission Deferred */ +#define CFD_S_DMA_UNDR 0x0100 /* DMA Underrun (no data) */ +#define CFD_S_NO_CTS 0x0200 /* Lost Clear To Send signal */ +#define CFD_S_NO_CRS 0x0400 /* No Carrier Sense */ +#define CFD_S_LATE_COLL 0x0800 /* Late collision is detected */ + +#define TFD_CNT_EOF 0x8000 /* all data kept in TFD */ + +typedef struct rbd /* RBD - Receive Buffer Descriptor */ + { + volatile UINT16 actualCnt; /* size of real data */ + UINT16 reserved0; + EI_LINK lNext; /* address of the next RBD */ + EI_LINK pData; /* address of a data buffer */ + volatile UINT16 size; /* size of data buffer */ + UINT16 reserved1; + } RBD; + +/* RBD size field bit masks */ + +#define RBD_EL 0x8000 /* last in buffer list */ +#define RBD_P 0x4000 /* prefetched */ + +typedef struct rfd /* RFD - Receive Frame Descriptor */ + { + volatile UINT16 status; /* status field */ + UINT16 command; /* command field */ + EI_LINK lNext; /* link to next desc. */ + EI_LINK lBufDesc; /* link to buf desc. */ + volatile UINT16 actualCnt; /* actual byte count */ + UINT16 bufSize; /* buffer size */ + UINT8 enetHdr [EH_SIZE]; /* the ethernet header */ + char pad[2]; /* aligment */ + char enetData [ETHERMTU]; /* received data */ + struct tfd *pNext; /* ptr to next desc. */ + RBD rbd; + UINT8 refCnt; /* reference count */ + } RFD; + + +/* RFD bit masks */ + +#define RFD_S_COLL 0x0001 /* collision during reception */ +#define RFD_S_EOP 0x0040 /* no EOP flag */ +#define RFD_S_MATCH 0x0080 /* dest Addr matched the IA address */ +#define RFD_S_DMA 0x0100 /* DMA Overrun failure to get bus */ +#define RFD_S_RSRC 0x0200 /* received, but ran out of buffers */ +#define RFD_S_ALGN 0x0400 /* received misaligned with CRC error */ +#define RFD_S_CRC 0x0800 /* received with CRC error */ +#define RFD_S_LEN 0x1000 /* received with length error */ +#define RFD_S_OK 0x2000 /* frame received successfully */ +#define RFD_S_BUSY 0x4000 /* frame reception ready/in progress */ +#define RFD_S_COMPLETE 0x8000 /* frame reception complete */ + +#define RFD_M_FLEXMODE 0x0008 /* flexible mode */ +#define RFD_M_SUSPEND 0x4000 /* suspend RU after receiving frame */ +#define RFD_M_EL 0x8000 /* end of RFD list */ + +#if CPU_FAMILY==I960 +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_eihkh */ diff --git a/h/drv/netif/if_elc.h b/h/drv/netif/if_elc.h new file mode 100644 index 0000000..043b8aa --- /dev/null +++ b/h/drv/netif/if_elc.h @@ -0,0 +1,329 @@ +/* if_elc.h - SMC 8013WC network interface header */ + +/* Copyright 1984-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,03oct94,hdn changed TSTART to TSTART[01] for two TX buffer. +01d,03nov93,hdn made RAMSIZE 16Kbytes. +01c,23jun93,hdn added a structure IRQ_TABLE. +01b,17jun93,hdn renamed to if_elc.h. +01a,09jun92,hdn written. +*/ + + +#ifndef __INCif_elch +#define __INCif_elch + +#ifdef __cplusplus +extern "C" { +#endif + +#define SMC8013WC_RAMSIZE 0x4000 +#define SMC8013WC_TSTART0 0x00 +#define SMC8013WC_TSTART1 0x08 +#define SMC8013WC_PSTART 0x10 +#define SMC8013WC_PSTOP 0x3f + +typedef struct + { + UCHAR rstat; + UCHAR next; + UCHAR lowByteCnt; + UCHAR uppByteCnt; + } ELC_HEADER; + +typedef struct + { +#define collisions stat[0] +#define crcs stat[1] +#define aligns stat[2] +#define missed stat[3] +#define overruns stat[4] +#define disabled stat[5] +#define deferring stat[6] +#define underruns stat[7] +#define aborts stat[8] +#define outofwindow stat[9] +#define heartbeats stat[10] +#define badPacket stat[11] +#define shortPacket stat[12] +#define tnoerror stat[13] +#define rnoerror stat[14] +#define terror stat[15] +#define rerror stat[16] +#define overwrite stat[17] +#define wrapped stat[18] +#define interrupts stat[19] +#define reset stat[20] +#define strayint stat[21] + UINT stat[23]; + } ELC_STAT; + +typedef struct + { + struct arpcom es_ac; +#define es_if es_ac.ac_if +#define es_enaddr es_ac.ac_enaddr + USHORT bicAddr; + USHORT elcAddr; + UINT memAddr; + UINT memSize; + int intLevel; + int intVec; + int config; + UINT transmitPage[2]; + UINT transmitCnt; + ELC_STAT elcStat; + UCHAR next; + UCHAR uppByteCnt; + UCHAR current; + UCHAR imask; + UCHAR istat; + UCHAR tstat; + UCHAR rstat; + UCHAR receiveBuf[0x4000]; + int flags; + UINT txreq; + } ELC_SOFTC; + +typedef struct + { + UCHAR ir2; + UCHAR ir01; + } IRQ_TABLE; + +#define CAST + +/* SMC 83c584 BIC (Bus Interface Controller) */ + +#define BIC_REG_ADDR_INTERVAL 1 +#define BIC_ADRS(base,reg) (CAST (base+(reg*BIC_REG_ADDR_INTERVAL))) + +#define BIC_MSR(base) BIC_ADRS(base,0x00) /* memory select */ +#define BIC_ICR(base) BIC_ADRS(base,0x01) /* interface config */ +#define BIC_IAR(base) BIC_ADRS(base,0x02) /* IO address */ +#define BIC_BIO(base) BIC_ADRS(base,0x03) /* BIOS ROM address */ +#define BIC_IRR(base) BIC_ADRS(base,0x04) /* interrupt request */ +#define BIC_LAAR(base) BIC_ADRS(base,0x05) /* LA address */ +#define BIC_JUMP(base) BIC_ADRS(base,0x06) /* jumpers */ +#define BIC_GP2(base) BIC_ADRS(base,0x07) /* general purpose */ +#define BIC_LAR0(base) BIC_ADRS(base,0x08) /* LAN address */ +#define BIC_LAR1(base) BIC_ADRS(base,0x09) /* LAN address */ +#define BIC_LAR2(base) BIC_ADRS(base,0x0a) /* LAN address */ +#define BIC_LAR3(base) BIC_ADRS(base,0x0b) /* LAN address */ +#define BIC_LAR4(base) BIC_ADRS(base,0x0c) /* LAN address */ +#define BIC_LAR5(base) BIC_ADRS(base,0x0d) /* LAN address */ +#define BIC_ID(base) BIC_ADRS(base,0x0e) /* board ID */ +#define BIC_CKSM(base) BIC_ADRS(base,0x0f) /* checksum */ + +/* MSR: Memory Select Register */ +#define MSR_RST 0x80 +#define MSR_MEN 0x40 +#define MSR_RA18 0x20 +#define MSR_RA17 0x10 +#define MSR_RA16 0x08 +#define MSR_RA15 0x04 +#define MSR_RA14 0x02 +#define MSR_RA13 0x01 + +/* ICR: Interface Configuration Register */ +#define ICR_STO 0x80 +#define ICR_RIO 0x40 +#define ICR_RX7 0x20 +#define ICR_RLA 0x10 +#define ICR_MSZ 0x08 +#define ICR_IR2 0x04 +#define ICR_EAR 0x02 +#define ICR_BIT16 0x01 + +/* IAR: IO Address Register */ +#define IAR_IA15 0x80 +#define IAR_IA14 0x40 +#define IAR_IA13 0x20 +#define IAR_IA9 0x10 +#define IAR_IA8 0x08 +#define IAR_IA7 0x04 +#define IAR_IA6 0x02 +#define IAR_IA5 0x01 + +/* BIO: BIOS ROM Address Register */ +#define BIO_RS1 0x80 +#define BIO_RS0 0x40 +#define BIO_BA18 0x20 +#define BIO_BA17 0x10 +#define BIO_BA16 0x08 +#define BIO_BA15 0x04 +#define BIO_BA14 0x02 +#define BIO_INT 0x01 + +/* EAR: EEROM Address Register */ +#define EAR_EA6 0x80 +#define EAR_EA5 0x40 +#define EAR_EA4 0x20 +#define EAR_EA3 0x10 +#define EAR_RAM 0x08 +#define EAR_RPE 0x04 +#define EAR_RP1 0x02 +#define EAR_RP 0x01 + +/* IRR: Interrupt Request Register */ +#define IRR_IEN 0x80 +#define IRR_IR1 0x40 +#define IRR_IR0 0x20 +#define IRR_FLSH 0x10 +#define IRR_OUT3 0x08 +#define IRR_OUT2 0x04 +#define IRR_OUT1 0x02 +#define IRR_ZWS8 0x01 + +/* LAAR: LA Address Register */ +#define LAAR_M16EN 0x80 +#define LAAR_L16EN 0x40 +#define LAAR_ZWS16 0x20 +#define LAAR_LA23 0x10 +#define LAAR_LA22 0x08 +#define LAAR_LA21 0x04 +#define LAAR_LA20 0x02 +#define LAAR_LA19 0x01 + +/* SMC 83c690 ELC (Ethernet LAN Controller) */ + +#define ELC_REG_ADDR_INTERVAL 1 +#define ELC_ADRS(base,reg) (CAST (base+(reg*ELC_REG_ADDR_INTERVAL))) + +/* page-0, read */ + +#define ELC_CMD(base) ELC_ADRS(base,0x00) /* command */ +#define ELC_TRINCRL(base) ELC_ADRS(base,0x01) /* TRDMA incrementer */ +#define ELC_TRINCRH(base) ELC_ADRS(base,0x02) /* TRDMA incrementer */ +#define ELC_BOUND(base) ELC_ADRS(base,0x03) /* boundary page */ +#define ELC_TSTAT(base) ELC_ADRS(base,0x04) /* transmit status */ +#define ELC_COLCNT(base) ELC_ADRS(base,0x05) /* collision error */ +#define ELC_INTSTAT(base) ELC_ADRS(base,0x07) /* interrupt status */ +#define ELC_RSTAT(base) ELC_ADRS(base,0x0c) /* receive status */ +#define ELC_ALICNT(base) ELC_ADRS(base,0x0d) /* alignment error */ +#define ELC_CRCCNT(base) ELC_ADRS(base,0x0e) /* crc error */ +#define ELC_MPCNT(base) ELC_ADRS(base,0x0f) /* missed packet */ + +/* page-0, write */ + +#define ELC_RSTART(base) ELC_ADRS(base,0x01) /* receive start */ +#define ELC_RSTOP(base) ELC_ADRS(base,0x02) /* receive stop */ +#define ELC_TSTART(base) ELC_ADRS(base,0x04) /* transmit start */ +#define ELC_TCNTL(base) ELC_ADRS(base,0x05) /* transmit counter */ +#define ELC_TCNTH(base) ELC_ADRS(base,0x06) /* transmit counter */ +#define ELC_RBCR0(base) ELC_ADRS(base,0x0a) /* remote byte count */ +#define ELC_RBCR1(base) ELC_ADRS(base,0x0b) /* remote byte count */ +#define ELC_RCON(base) ELC_ADRS(base,0x0c) /* receive config */ +#define ELC_TCON(base) ELC_ADRS(base,0x0d) /* transmit config */ +#define ELC_DCON(base) ELC_ADRS(base,0x0e) /* data config */ +#define ELC_INTMASK(base) ELC_ADRS(base,0x0f) /* interrupt mask */ + +/* page-1, read and write */ + +#define ELC_STA0(base) ELC_ADRS(base,0x01) /* station address */ +#define ELC_STA1(base) ELC_ADRS(base,0x02) /* station address */ +#define ELC_STA2(base) ELC_ADRS(base,0x03) /* station address */ +#define ELC_STA3(base) ELC_ADRS(base,0x04) /* station address */ +#define ELC_STA4(base) ELC_ADRS(base,0x05) /* station address */ +#define ELC_STA5(base) ELC_ADRS(base,0x06) /* station address */ +#define ELC_CURR(base) ELC_ADRS(base,0x07) /* current page */ +#define ELC_MAR0(base) ELC_ADRS(base,0x08) /* multicast address */ +#define ELC_MAR1(base) ELC_ADRS(base,0x09) /* multicast address */ +#define ELC_MAR2(base) ELC_ADRS(base,0x0a) /* multicast address */ +#define ELC_MAR3(base) ELC_ADRS(base,0x0b) /* multicast address */ +#define ELC_MAR4(base) ELC_ADRS(base,0x0c) /* multicast address */ +#define ELC_MAR5(base) ELC_ADRS(base,0x0d) /* multicast address */ +#define ELC_MAR6(base) ELC_ADRS(base,0x0e) /* multicast address */ +#define ELC_MAR7(base) ELC_ADRS(base,0x0f) /* multicast address */ + +/* page-2, read and write */ + +#define ELC_NEXT(base) ELC_ADRS(base,0x05) /* next page */ +#define ELC_BLOCK(base) ELC_ADRS(base,0x06) /* block address */ +#define ELC_ENH(base) ELC_ADRS(base,0x07) /* enable features */ + +/* COMMAND: Command Register */ +#define CMD_PS1 0x80 +#define CMD_PS0 0x40 +#define CMD_CMD5 0x20 +#define CMD_CMD4 0x10 +#define CMD_CMD3 0x08 +#define CMD_TXP 0x04 +#define CMD_STA 0x02 +#define CMD_STP 0x01 + +/* RCON: Receive Configuration Register */ +#define RCON_MON 0x20 +#define RCON_PROM 0x10 +#define RCON_GROUP 0x08 +#define RCON_BROAD 0x04 +#define RCON_RUNTS 0x02 +#define RCON_SEP 0x01 + +/* TCON: Transmit Configuration Register */ +#define TCON_LB1 0x04 +#define TCON_LB0 0x02 +#define TCON_CRCN 0x01 + +/* DCON: Data Configuration Register */ +#define DCON_BSIZE1 0x40 +#define DCON_BSIZE0 0x20 +#define DCON_BUS16 0x01 + +/* INTMASK: Interrupt Mask Register */ +#define IM_XDCE 0x40 +#define IM_CNTE 0x20 +#define IM_OVWE 0x10 +#define IM_TXEE 0x08 +#define IM_RXEE 0x04 +#define IM_PTXE 0x02 +#define IM_PRXE 0x01 + +/* INTSTAT: Interrupt Status Register */ +#define ISTAT_RST 0x80 +#define ISTAT_CNT 0x20 +#define ISTAT_OVW 0x10 +#define ISTAT_TXE 0x08 +#define ISTAT_RXE 0x04 +#define ISTAT_PTX 0x02 +#define ISTAT_PRX 0x01 + +/* TSTAT: Transmit Status Register */ +#define TSTAT_OWC 0x80 +#define TSTAT_CDH 0x40 +#define TSTAT_UNDER 0x20 +#define TSTAT_CRL 0x10 +#define TSTAT_ABORT 0x08 +#define TSTAT_TWC 0x04 +#define TSTAT_NDT 0x02 +#define TSTAT_PTX 0x01 + +/* RSTAT: Receive Status Register */ +#define RSTAT_DFR 0x80 +#define RSTAT_DIS 0x40 +#define RSTAT_GROUP 0x20 +#define RSTAT_MPA 0x10 +#define RSTAT_OVER 0x08 +#define RSTAT_FAE 0x04 +#define RSTAT_CRC 0x02 +#define RSTAT_PRX 0x01 + +/* ENH: Enable Features */ +#define ENH_WAIT1 0x80 +#define ENH_WAIT0 0x40 +#define ENH_SLOT1 0x10 +#define ENH_SLOT0 0x08 + +/* flags - software synchronize bit difinitions */ +#define TXING 0x01 +#define RXING 0x02 +#define TXREQ 0x04 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_elch */ diff --git a/h/drv/netif/if_elt.h b/h/drv/netif/if_elt.h new file mode 100644 index 0000000..ab17fb0 --- /dev/null +++ b/h/drv/netif/if_elt.h @@ -0,0 +1,438 @@ +/* if_elt.h - 3Com EtherLink III network interface header*/ + +/* Copyright 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,19apr02,rcs added obsolescence warning SPR# 76010 +01g,06mar96,hdn added ELT_CTRL. +01f,13oct95,hdn changed reset to elt-reset. +01e,07feb94,bcs added net job queue statistics +01d,23jan94,bcs added timing statistics +01c,16jan94,bcs added rxearly to statistics +01b,08jan94,bcs added statistics structure +01a,09dec93,bcs written. +*/ + + +#ifndef __INCif_elth +#define __INCif_elth + +#ifdef __cplusplus +extern "C" { +#endif + +#warning "if_elt driver is obsolete, please use elt3c509End driver" + + +#ifndef _ASMLANGUAGE + + +#define EA_SIZE 6 /* one Ethernet address */ +#define EH_SIZE 14 /* avoid structure padding issues */ +#define MAX_FRAME_SIZE (EH_SIZE + ETHERMTU) /* capacity of buffer */ + +/* Typedefs for external structures that are not typedef'd in their .h files */ + +typedef struct mbuf MBUF; +typedef struct arpcom IDR; /* Interface Data Record wrapper */ +typedef struct ifnet IFNET; /* real Interface Data Record */ +typedef struct sockaddr SOCK; + +/* ELT driver data structures */ + +typedef struct elt_frame /* frame buffer, list element */ + { + struct elt_frame * lNext; /* linked list pointer */ + u_char refCnt; /* reference count when loaned out */ + UINT16 count; /* bytes left to transmit or */ + /* received so far; initially */ + /* length rounded up to dword */ + /* plus size of "preamble" */ + char * nextByte; /* next byte to transmit or */ + /* next byte to receive into */ + /* Following fields map to FIFO */ + /* transmit packet structure; */ + /* used same way for receive */ + UINT16 length; /* length of contained frame */ + /* received frame includes error */ + UINT16 unassigned; /* pad "preamble" to dword size */ + char header [EH_SIZE]; + char data [ETHERMTU]; + char padToDword [MAX_FRAME_SIZE % sizeof (long)]; + } ELT_FRAME; + + +/* statistics block */ + +typedef struct + { +#define collisions stat[0] +#define crcs stat[1] +#define aligns stat[2] +#define rxnobuffers stat[3] +#define rxoverruns stat[4] +#define disabled stat[5] +#define deferring stat[6] +#define txunderruns stat[7] +#define aborts stat[8] +#define outofwindow stat[9] +#define heartbeats stat[10] +#define badPacket stat[11] +#define shortPacket stat[12] +#define txnoerror stat[13] +#define rxnoerror stat[14] +#define txerror stat[15] +#define rxerror stat[16] +#define overwrite stat[17] +#define wrapped stat[18] +#define interrupts stat[19] +#define elt_reset stat[20] +#define strayint stat[21] +#define multcollisions stat[22] +#define latecollisions stat[23] +#define nocarriers stat[24] +#define jabbers stat[25] +#define txoverruns stat[26] +#define rxunderruns stat[27] +#define rxearly stat[28] +#ifdef ELT_TIMING +#define timerUpdates stat[29] +#define timerOverflow stat[30] +#define timerInvalid stat[31] +#define maxRxLatency stat[32] +#define minRxLatency stat[33] +#define maxIntLatency stat[34] +#define taskQRxOuts stat[35] +#define maxRxTaskQ stat[36] +#define taskQTxOuts stat[37] +#define maxTxTaskQ stat[38] + UINT stat[40]; +#else + UINT stat[30]; +#endif /* ELT_TIMING */ + } ELT_STAT; + +/* The definition of the driver control structure */ + +typedef struct elt_ctrl + { + IDR idr; /* interface data record */ + + BOOL attached; /* indicates attach() called */ + volatile BOOL rxHandling; /* flag, indicates netTask active/queued */ + volatile BOOL txHandling; /* flag, indicates netTask active/queued */ + int nRxFrames; /* how many receive frames to create */ + ELT_FRAME * pFrameArea; /* whole clump of rcv and transmit frames */ + ELT_FRAME * pTxFrame; /* transmit frame buffer (only one) */ + volatile ELT_FRAME *pRxHead; /* head of received frame list */ + ELT_FRAME * pRxTail; /* tail of received frame list */ + volatile ELT_FRAME *pRxCurrent; /* frame currently being received */ + int nLoanFrames;/* count of loanable frame buffers */ + int rxFilter; /* current receive address filter bits */ + int port; /* base I/O port of this board */ + int ivec; /* interrupt vector */ + int intLevel; /* interrupt level */ + int attachment; /* board connector to use (AUI,BNC,TPE) */ + int intMask; /* current board interrupt mask */ + ELT_STAT eltStat; /* statistics */ +#ifdef ELT_TIMING + int interruptTime; /* timer value at ISR, -1 if invalid */ + int maxRxLatency; /* max time to service receive buffer */ +#endif /* ELT_TIMING */ + } ELT_CTRL; + + +/* ELT register offsets, grouped by window number */ + +/* all windows */ + +#define ELT_COMMAND 0x0e /* command register */ +#define ELT_STATUS 0x0e /* status register */ + +/* window number symbols for selection command */ + +#define WIN_CONFIG 0x0000 +#define WIN_OPERATING 0x0001 +#define WIN_ADDRESS 0x0002 +#define WIN_FIFO 0x0003 +#define WIN_DIAGNOSTIC 0x0004 +#define WIN_RESULTS 0x0005 +#define WIN_STATISTICS 0x0006 + +/* window 0, configuration and EEPROM */ + +#define MANUF_ID 0x00 /* manufacturer ID */ +#define PRODUCT_ID 0x02 /* product ID/MCA adapter ID */ +#define CONFIG_CONTROL 0x04 /* configuration control */ +#define ADDRESS_CONFIG 0x06 /* address configuration */ +#define RESOURCE_CONFIG 0x08 /* resource configuration */ +#define EEPROM_CONTROL 0x0a /* EEPROM control */ +#define EEPROM_DATA 0x0c /* EEPROM data in/out */ + +/* window 1, operating set */ + +#define DATA_REGISTER 0x00 /* data (low word) in/out */ +#define DATA_HIGH 0x02 /* data (high word) in/out */ +#define RX_STATUS 0x08 /* received packet status */ +#define TIMER 0x0a /* (byte) interrupt latency timer */ +#define TX_STATUS 0x0b /* (byte) transmit status */ +#define TX_FREE_BYTES 0x0c /* free bytes available in tx FIFO */ + /* also appears in window 3 */ + +/* window 2, station address setup/read */ + +#define ADDRESS_0 0x00 /* (byte) station address 0 */ +#define ADDRESS_1 0x01 /* (byte) station address 1 */ +#define ADDRESS_2 0x02 /* (byte) station address 2 */ +#define ADDRESS_3 0x03 /* (byte) station address 3 */ +#define ADDRESS_4 0x04 /* (byte) station address 4 */ +#define ADDRESS_5 0x05 /* (byte) station address 5 */ + +/* window 3, FIFO management */ + +#define TX_RECLAIM 0x08 /* MCA tx reclaim threshold */ +#define RX_FREE_BYTES 0x0a /* free bytes available in rx FIFO */ +#define TX_FREE_BYTES_3 0x0c /* free bytes available in tx FIFO */ + /* also appears in window 1 */ + /* same offset so can use same macro */ + +/* window 4, diagnostics */ + +#define TX_DIAGNOSTIC 0x00 /* tx diagnostic */ +#define HOST_DIAGNOSTIC 0x02 /* host diagnostic */ +#define FIFO_DIAGNOSTIC 0x04 /* FIFO diagnostic */ +#define NET_DIAGNOSTIC 0x06 /* net diagnostic */ +#define ETHERNET_STATUS 0x08 /* ethernet controller status */ +#define MEDIA_STATUS 0x0a /* media type and status */ + +/* window 5, command results and internal state (read only) */ + +#define TX_START_THRESH 0x00 /* tx start threshold + 4 */ +#define TX_AVAIL_THRESH 0x02 /* tx available threshold */ +#define RX_EARLY_THRESH 0x06 /* rx early threshold */ +#define RX_FILTER 0x08 /* rx filter lower 4 bits */ +#define INTERRUPT_MASK 0x0a /* interrupt mask */ +#define READ_ZERO_MASK 0x0c /* read zero mask */ + +/* window 6, statistics registers (byte regs. MUST be read/written as bytes) */ + +#define CARRIER_LOSTS 0x00 /* (byte) carrier loss during tx */ +#define SQE_FAILURES 0x01 /* (byte) heartbeat loss during tx */ +#define MULT_COLLISIONS 0x02 /* (byte) tx with multiple collis. */ +#define ONE_COLLISIONS 0x03 /* (byte) tx with one collision */ +#define LATE_COLLISIONS 0x04 /* (byte) tx with late collision */ +#define RECV_OVERRUNS 0x05 /* (byte) receive overruns */ +#define GOOD_TRANSMITS 0x06 /* (byte) frames transmitted OK */ +#define GOOD_RECEIVES 0x07 /* (byte) frames received OK */ +#define TX_DEFERRALS 0x08 /* (byte) transmit deferrals */ +#define BYTES_RECEIVED 0x0a /* total bytes received OK */ +#define BYTES_TRANSMITTED 0x0c /* total bytes transmitted OK */ + +/* ISA ID sequence state machine commands */ + +#define ID_PORT 0x0100 /* I/O port to access ID sequence */ + /* could be 0x110..0x1f0 but this */ + /* is a highly unlikely address to */ + /* be used by anything else */ +#define ID_RESET 0x00 /* reset ID state machine */ +#define ID_EEPROM_READ 0x80 /* read EEPROM register addressed by */ + /* last 6 bits of this command */ +#define ID_EEPROM_MASK 0x3f /* these bits here */ +#define ID_SET_TAG 0xd0 /* set tag register to last 3 bits */ +#define ID_TAG_MASK 0x07 /* values 1..7 take tagged adapter */ + /* out of the contention process */ +#define ID_ACTIVATE 0xff /* activate adapter as pre-configured */ + +#define ID_SEQUENCE_INITIAL 0xff /* initial value in ID sequence */ +#define ID_SEQUENCE_LENGTH 255 /* iteration count */ +#define ID_CARRY_BIT 0x100 /* carry out of 8-bit ID value shift */ +#define ID_POLYNOMIAL 0xcf /* XOR this with ID value */ +#define ID_REGISTER_SIZE 16 /* bits in an EEPROM register */ + +/* important EEPROM addresses */ + +#define EE_A_PRODUCT_ID 0x03 /* 3C5xx product id */ +#define EE_A_MANUFACTURER 0x07 /* 3Com mfg. id == 0x6d50 */ +#define EE_A_ADDRESS 0x08 /* address configuration */ +#define EE_A_RESOURCE 0x09 /* resource configuration */ +#define EE_A_OEM_NODE_0 0x0a /* word 0 of OEM Ethernet address */ +#define EE_A_OEM_NODE_1 0x0b /* word 1 of OEM Ethernet address */ +#define EE_A_OEM_NODE_2 0x0c /* word 2 of OEM Ethernet address */ + +#define MANUFACTURER_ID 0x6d50 /* 3Com id code in EEPROM */ + +/* address configuration register fields and values */ + +#define AC_IO_BASE_MASK 0x001f /* I/O base address encoding */ + /* 0-30 select n * 0x10 + 0x200 */ +#define AC_IO_BASE_ZERO 0x0200 /* first encoded address */ +#define AC_IO_BASE_FACTOR 0x10 /* convert code to address range */ +#define AC_IO_BASE_EISA 0x001f /* EISA addressing indicator */ +#define AC_XCVR_MASK 0xc000 /* transciever selection field */ +#define AC_XCVR_TPE 0x0000 /* select twisted-pair (10BASE-T) */ +#define AC_XCVR_AUI 0x4000 /* select AUI (external transceiver) */ +#define AC_XCVR_BNC 0xc000 /* select BNC (10BASE-2); must also */ + /* activate with START_COAX command */ +/* configuration control register bits */ + +#define CC_ENABLE 0x0001 /* set to enable IRQ driver */ +#define CC_RESET 0x0004 /* reset adapter to POR state */ +#define CC_POR_INTERNAL_ENDEC 0x0100 /* use internal encoder/decoder */ +#define CC_POR_10BASETAVAIL 0x0200 /* on-board TPE transceiver available */ +#define CC_POR_TEST_MASK 0x0c00 /* test mode bits */ +#define CC_POR_TEST_RECEIVE 0x0400 /* receive test mode */ +#define CC_POR_TEST_TRANSMIT 0x0800 /* transmit test mode */ +#define CC_POR_TEST_NORMAL 0x0c00 /* normal operation mode */ +#define CC_POR_10BASE2_AVAIL 0x1000 /* on-board coax transceiver available*/ +#define CC_POR_AUI_AVAIL 0x2000 /* on-board AUI connector evailable */ + +/* FIFO diagnostic register bits */ + +#define FD_TX_BC 0x0001 /* TX BIST is complete */ +#define FD_TX_BF 0x0002 /* TX BIST has failed */ +#define FD_TX_BFC 0x0004 /* sets TX BF to test for stuck-at */ +#define FD_TX_BIST 0x0008 /* enable BIST in TX FIFO RAM */ +#define FD_RX_BC 0x0010 /* TRX BIST is complete */ +#define FD_RX_BF 0x0020 /* RX BIST has failed */ +#define FD_RX_BFC 0x0040 /* sets RX BF to test for stuck-at */ +#define FD_RX_BIST 0x0080 /* enable BIST in RX FIFO RAM */ +#define FD_TX_OVERRUN 0x0400 /* host wrote too much data */ +#define FD_RX_OVERRUN 0x0800 /* RX overrun (not necessarily */ + /* packet overrun yet) */ +#define FD_RX_STATUS_OVERRUN 0x1000 /* already 8 packets in RX FIFO */ +#define FD_RX_UNDERRUN 0x2000 /* host read past end of packet */ +#define FD_RX_RECEIVING 0x8000 /* packet being received now */ + +/* media type and status bits */ + +#define MT_S_SQE_ENABLE 0x0008 /* enable SQE error detection */ +#define MT_S_COLLISION 0x0010 /* (?) collision in progress */ +#define MT_S_CARRIER 0x0020 /* (?) carrier sensed currently */ +#define MT_S_JABBER_ENABLE 0x0040 /* enable jabber and polarity detect */ +#define MT_S_LINK_BEAT_ENABLE 0x0080 /* enable TPE link beat */ +#define MT_S_UNSQUELCH 0x0100 /* unsquelch status */ +#define MT_S_JABBER 0x0200 /* jabber status */ +#define MT_S_POLARITY 0x0400 /* polarity swap status */ +#define MT_S_LINK_BEAT 0x0800 /* link beat correct status */ +#define MT_S_SQE 0x1000 /* SQE present status */ +#define MT_S_INTERNAL_ENDEC 0x2000 /* internal encoder/decoder in use */ +#define MT_S_BNC 0x4000 /* BNC transceiver in use */ +#define MT_S_AUI_DISABLE 0x8000 /* AUI interface disabled */ + +/* command opcodes (uppper 5 bits of command register) */ + +#define GLOBAL_RESET 0x0000 /* global reset (powerup equiv.) */ +#define SELECT_WINDOW 0x0800 /* select register window */ +#define START_COAX 0x1000 /* start coaxial transciever */ +#define RX_DISABLE 0x1800 /* disable ethernet receiver */ +#define RX_ENABLE 0x2000 /* enable ethernet receiver */ +#define RX_RESET 0x2800 /* reset ethernet receiver */ +#define RX_DISCARD 0x4000 /* discard remainder of top FIFO pkt */ +#define TX_ENABLE 0x4800 /* enable ethernet transmitter */ +#define TX_DISABLE 0x5000 /* disable ethernet transmitter */ +#define TX_RESET 0x5800 /* reset ethernet transmitter */ +#define REQ_INTERRUPT 0x6000 /* set interrupt requested bit */ +#define ACK_INTERRUPT 0x6800 /* acknowledge interrupt conditions */ +#define MASK_INTERRUPT 0x7000 /* set interrupt mask bits */ +#define MASK_STATUS 0x7800 /* set status mask bits */ + /* the "read zero mask" */ +#define SET_RX_FILTER 0x8000 /* set receive filter bits */ +#define SET_RX_THRESH 0x8800 /* set receive early threshold */ +#define SET_TX_AVAIL 0x9000 /* set transmit available threshold */ +#define SET_TX_START 0x9800 /* set transmit start threshold */ +#define STATS_ENABLE 0xa800 /* enable statistics collection */ +#define STATS_DISABLE 0xb000 /* disable statistics collection */ +#define STOP_COAX 0xb800 /* stop coaxial transciever */ +#define SET_TX_RECLAIM 0xc000 /* (MCA) set tx reclaim threshold */ + +/* receive filter command argument bits */ + +#define RX_F_STATION_IA 0x01 /* accept individual address */ +#define RX_F_MULTICAST 0x02 /* accept multicast (group) addresses */ +#define RX_F_BROADCAST 0x04 /* accept broadcast address */ +#define RX_F_PROMISCUOUS 0x08 /* accept all addresses */ +#define RX_F_NORMAL (RX_F_STATION_IA | RX_F_BROADCAST) + +/* board status bits (also acknowledge and mask bits) */ + +#define INTERRUPT_LATCH 0x0001 /* raise interrupt to host */ +#define ADAPTER_FAILURE 0x0002 /* error unrecoverable by adapter */ + /* tx overrun, rx underrun, or */ + /* hypothetical hardware errors */ +#define TX_COMPLETE 0x0004 /* tx finished with error or */ + /* packet interrupt bit was set */ +#define TX_AVAILABLE 0x0008 /* tx available threshold exceeded */ +#define RX_COMPLETE 0x0010 /* a complete packet is available */ +#define RX_EARLY 0x0020 /* rx early threshold exceeded */ +#define INTERRUPT_REQ 0x0040 /* set by request interrupt command */ +#define UPDATE_STATS 0x0080 /* one or more statistics counters */ + /* needs to be flushed */ +#define STATUS_MASK 0x00ff /* pick status bits out of register */ +#define COMMAND_IN_PROGRESS 0x1000 /* last command still being processed */ +#define WINDOW_MASK 0xe000 /* current register window selection */ + +/* transmit status register bits */ + +#define TX_S_RECLAIM 0x02 /* tx reclaim (MCA only) */ +#define TX_S_OVERFLOW 0x04 /* tx status overflow (lost info) */ +#define TX_S_MAX_COLL 0x08 /* maximum collisions reached */ +#define TX_S_UNDERRUN 0x10 /* underrun, tx reset required */ +#define TX_S_JABBER 0x20 /* jabber error, tx reset required */ +#define TX_S_INTERRUPT 0x40 /* interrupt on successful xmit */ +#define TX_S_COMPLETE 0x80 /* transmission complete */ + /* This bit denotes a valid status */ + /* when set; valid status is popped */ + /* off the stack by a write cycle to */ + /* the transmit status register */ + +/* transmit free bytes constants */ + +#define TX_IDLE_COUNT 0x7f8 /* 2,040; supposed to be 2,044 */ + /* use a >= test to see if tx idle */ + +/* receive status register bits */ + +#define RX_S_CNT_MASK 0x07ff /* received byte count field */ +#define RX_S_CODE_MASK 0x3800 /* error code field */ +#define RX_S_OVERRUN 0x0000 /* overrun error */ +#define RX_S_RUNT 0x1800 /* runt packet error */ +#define RX_S_ALIGN 0x2000 /* alignment (framing) error */ +#define RX_S_CRC 0x2800 /* CRC error */ +#define RX_S_OVERSIZE 0x0800 /* oversize packet error (>1514) */ +#define RX_S_DRIBBLE 0x1000 /* dribble bit(s); this code is */ + /* valid when error bit is not set */ +#define RX_S_ERROR 0x4000 /* error in rx packet, code above */ +#define RX_S_INCOMPLETE 0x8000 /* packet is incomplete or FIFO empty */ + /* opposite of transmit status! */ + +/* transmit packet preamble bits and fields */ + +#define TX_F_LEN_MASK 0x07ff /* length field */ +#define TX_F_INTERRUPT 0x8000 /* interrupt on transmit complete */ +#define TX_F_DWORD_MASK 0xfffc /* mask to round lengths to dword */ +#define TX_F_PREAMBLE_SIZE 4 /* size of packet length "preamble" */ + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS eltattach (int unit, int port, int ivec, int intLevel, + int nRxFrames, int attachment, char *ifName); + +#else + +extern STATUS eltattach (); + +#endif /* __STDC__ */ + + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_elth */ diff --git a/h/drv/netif/if_ene.h b/h/drv/netif/if_ene.h new file mode 100644 index 0000000..b0ce9d7 --- /dev/null +++ b/h/drv/netif/if_ene.h @@ -0,0 +1,224 @@ +/* if_ene.h - Novell/Eagle 2000 network interface header */ + +/* Copyright 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,19apr02,rcs added obsolescence warning SPR# 76010 +01a,01jan94,bcs written. +*/ + + +#ifndef __INCif_eneh +#define __INCif_eneh + +#ifdef __cplusplus +extern "C" { +#endif + +#warning "if_ene driver is obsolete, please use ne2000End driver" + + +#define EA_SIZE 6 /* one Ethernet address */ +#define EH_SIZE 14 /* Ethernet header size */ +#define MAX_FRAME_SIZE (EH_SIZE + ETHERMTU) + +/* NE 2000 on-board memory page addresses */ + +#define NE2000_CONFIG_PAGE 0x00 /* where the Ethernet address is */ +#define NE2000_EADDR_LOC 0x00 /* location within config. page */ +#define NE2000_TSTART 0x40 +#define NE2000_PSTART 0x46 +#define NE2000_PSTOP 0x80 + +#define ENE_PAGESIZE 256 + +typedef struct + { + UCHAR rstat; + UCHAR next; + UCHAR lowByteCnt; + UCHAR uppByteCnt; + } ENE_HEADER; + +typedef struct + { +#define collisions stat[0] +#define crcs stat[1] +#define aligns stat[2] +#define missed stat[3] +#define overruns stat[4] +#define disabled stat[5] +#define deferring stat[6] +#define underruns stat[7] +#define aborts stat[8] +#define outofwindow stat[9] +#define heartbeats stat[10] +#define badPacket stat[11] +#define shortPacket stat[12] +#define tnoerror stat[13] +#define rnoerror stat[14] +#define terror stat[15] +#define rerror stat[16] +#define overwrite stat[17] +#define wrapped stat[18] +#define interrupts stat[19] +#define reset stat[20] +#define strayint stat[21] +#define jabber stat[22] + UINT stat[24]; + } ENE_STAT; + + +#define CAST + +/* NS 8390 (Ethernet LAN Controller) */ + +#define ENE_REG_ADDR_INTERVAL 1 +#define ENE_ADRS(base,reg) (CAST (base+(reg*ENE_REG_ADDR_INTERVAL))) + +/* page-0, read */ + +#define ENE_CMD(base) ENE_ADRS(base,0x00) /* command */ +#define ENE_TRINCRL(base) ENE_ADRS(base,0x01) /* TRDMA incrementer */ +#define ENE_TRINCRH(base) ENE_ADRS(base,0x02) /* TRDMA incrementer */ +#define ENE_BOUND(base) ENE_ADRS(base,0x03) /* boundary page */ +#define ENE_TSTAT(base) ENE_ADRS(base,0x04) /* transmit status */ +#define ENE_COLCNT(base) ENE_ADRS(base,0x05) /* collision error */ +#define ENE_INTSTAT(base) ENE_ADRS(base,0x07) /* interrupt status */ +#define ENE_RSTAT(base) ENE_ADRS(base,0x0c) /* receive status */ +#define ENE_ALICNT(base) ENE_ADRS(base,0x0d) /* alignment error */ +#define ENE_CRCCNT(base) ENE_ADRS(base,0x0e) /* crc error */ +#define ENE_MPCNT(base) ENE_ADRS(base,0x0f) /* missed packet */ + +/* page-0, write */ + +#define ENE_RSTART(base) ENE_ADRS(base,0x01) /* receive start */ +#define ENE_RSTOP(base) ENE_ADRS(base,0x02) /* receive stop */ +#define ENE_TSTART(base) ENE_ADRS(base,0x04) /* transmit start */ +#define ENE_TCNTL(base) ENE_ADRS(base,0x05) /* transmit counter */ +#define ENE_TCNTH(base) ENE_ADRS(base,0x06) /* transmit counter */ +#define ENE_RSAR0(base) ENE_ADRS(base,0x08) /* remote address */ +#define ENE_RSAR1(base) ENE_ADRS(base,0x09) /* remote address */ +#define ENE_RBCR0(base) ENE_ADRS(base,0x0a) /* remote byte count */ +#define ENE_RBCR1(base) ENE_ADRS(base,0x0b) /* remote byte count */ +#define ENE_RCON(base) ENE_ADRS(base,0x0c) /* receive config */ +#define ENE_TCON(base) ENE_ADRS(base,0x0d) /* transmit config */ +#define ENE_DCON(base) ENE_ADRS(base,0x0e) /* data config */ +#define ENE_INTMASK(base) ENE_ADRS(base,0x0f) /* interrupt mask */ + +/* page-1, read and write */ + +#define ENE_STA0(base) ENE_ADRS(base,0x01) /* station address */ +#define ENE_STA1(base) ENE_ADRS(base,0x02) /* station address */ +#define ENE_STA2(base) ENE_ADRS(base,0x03) /* station address */ +#define ENE_STA3(base) ENE_ADRS(base,0x04) /* station address */ +#define ENE_STA4(base) ENE_ADRS(base,0x05) /* station address */ +#define ENE_STA5(base) ENE_ADRS(base,0x06) /* station address */ +#define ENE_CURR(base) ENE_ADRS(base,0x07) /* current page */ +#define ENE_MAR0(base) ENE_ADRS(base,0x08) /* multicast address */ +#define ENE_MAR1(base) ENE_ADRS(base,0x09) /* multicast address */ +#define ENE_MAR2(base) ENE_ADRS(base,0x0a) /* multicast address */ +#define ENE_MAR3(base) ENE_ADRS(base,0x0b) /* multicast address */ +#define ENE_MAR4(base) ENE_ADRS(base,0x0c) /* multicast address */ +#define ENE_MAR5(base) ENE_ADRS(base,0x0d) /* multicast address */ +#define ENE_MAR6(base) ENE_ADRS(base,0x0e) /* multicast address */ +#define ENE_MAR7(base) ENE_ADRS(base,0x0f) /* multicast address */ + +/* page-2, read and write */ + +#define ENE_NEXT(base) ENE_ADRS(base,0x05) /* next page */ +#define ENE_BLOCK(base) ENE_ADRS(base,0x06) /* block address */ +#define ENE_ENH(base) ENE_ADRS(base,0x07) /* enable features */ + +/* NE2000 board registers */ + +#define ENE_DATA(base) ENE_ADRS(base,0x10) /* data window */ +#define ENE_RESET(base) ENE_ADRS(base,0x1f) /* read here to reset */ + + +/* COMMAND: Command Register */ +#define CMD_PAGE2 0x80 +#define CMD_PAGE1 0x40 +#define CMD_PAGE0 0x00 +#define CMD_NODMA 0x20 +#define CMD_RWRITE 0x10 +#define CMD_RREAD 0x08 +#define CMD_TXP 0x04 +#define CMD_START 0x02 +#define CMD_STOP 0x01 + +/* RCON: Receive Configuration Register */ +#define RCON_MON 0x20 +#define RCON_PROM 0x10 +#define RCON_GROUP 0x08 +#define RCON_BROAD 0x04 +#define RCON_RUNTS 0x02 +#define RCON_SEP 0x01 + +/* TCON: Transmit Configuration Register */ +#define TCON_LB1 0x04 +#define TCON_LB0 0x02 +#define TCON_CRCN 0x01 + +/* DCON: Data Configuration Register */ +#define DCON_BSIZE1 0x40 +#define DCON_BSIZE0 0x20 +#define DCON_BUS16 0x01 + +/* INTMASK: Interrupt Mask Register */ +#define IM_XDCE 0x40 +#define IM_CNTE 0x20 +#define IM_OVWE 0x10 +#define IM_TXEE 0x08 +#define IM_RXEE 0x04 +#define IM_PTXE 0x02 +#define IM_PRXE 0x01 + +/* INTSTAT: Interrupt Status Register */ +#define ISTAT_RST 0x80 +#define ISTAT_RDC 0x40 /* remote DMA complete */ +#define ISTAT_CNT 0x20 +#define ISTAT_OVW 0x10 +#define ISTAT_TXE 0x08 +#define ISTAT_RXE 0x04 +#define ISTAT_PTX 0x02 +#define ISTAT_PRX 0x01 + +/* TSTAT: Transmit Status Register */ +#define TSTAT_OWC 0x80 +#define TSTAT_CDH 0x40 +#define TSTAT_UNDER 0x20 +#define TSTAT_CRL 0x10 +#define TSTAT_ABORT 0x08 +#define TSTAT_TWC 0x04 +#define TSTAT_NDT 0x02 +#define TSTAT_PTX 0x01 + +/* RSTAT: Receive Status Register */ +#define RSTAT_DFR 0x80 +#define RSTAT_DIS 0x40 +#define RSTAT_GROUP 0x20 +#define RSTAT_MPA 0x10 +#define RSTAT_OVER 0x08 +#define RSTAT_FAE 0x04 +#define RSTAT_CRC 0x02 +#define RSTAT_PRX 0x01 + +/* ENH: Enable Features */ +#define ENH_WAIT1 0x80 +#define ENH_WAIT0 0x40 +#define ENH_SLOT1 0x10 +#define ENH_SLOT0 0x08 + +/* flags - software synchronize bit definitions */ +#define TXING 0x01 +#define RXING 0x02 +#define TXREQ 0x04 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_eneh */ diff --git a/h/drv/netif/if_esmc.h b/h/drv/netif/if_esmc.h new file mode 100644 index 0000000..2be7cfc --- /dev/null +++ b/h/drv/netif/if_esmc.h @@ -0,0 +1,251 @@ +/* if_esmc.h - SMC 91c9x network interface header */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,09may96,hdn written. +*/ + + +#ifndef INCif_esmch +#define INCif_esmch + +#ifdef __cplusplus +extern "C" { +#endif + + +#define ESMC_BUFSIZE 1536 /* RX/TX buffer size in task level */ +#define ESMC_BUFSIZE_INT (1536*6) /* RX buffer size in int level */ +#define ESMC_PACKETS 18 /* max number of packets */ +#define ESMC_INDEXES (18*6) /* max received packets in int level */ +#define ESMC_9190 3 /* SMC 91c90 */ +#define ESMC_9194 4 /* SMC 91c94 */ +#define ESMC_9195 5 /* SMC 91c95 */ +#define ESMC_91100 7 /* SMC 91c100 */ +#define ESMC_INTR_TIMEOUT 2 /* interrupt timeout */ +#define ESMC_ALLOC_TIMEOUT 8 /* mem allocation timeout */ +#define ESMC_BANK_SELECT 0x0E /* see chip mauual for details */ +#define ESMC_RXING 0x01 /* receving */ +#define ESMC_TXING 0x02 /* transmitting */ + +typedef struct + { + struct arpcom es_ac; /* ethernet common part */ +#define es_if es_ac.ac_if +#define es_enaddr es_ac.ac_enaddr + int ioAddr; /* device I/O address */ + int intVec; /* interrupt vector */ + int intLevel; /* interrupt level */ + int config; /* 10BaseT or AUI */ + int mode; /* 10BaseT or AUI */ + SEMAPHORE esmcSyncSem; /* syncronization semaphore */ + char * pBuft; /* pointer to rx/tx buffer */ + char buft[ESMC_BUFSIZE + 8]; /* rx/tx buffer + alignment pad */ + char * pBufi; /* pointer to rx buffer */ + char * bufi; /* rx buffer + alignment pad */ + char * pStart; /* start pointer for rx buf */ + char * pIn; /* input pointer for rx buf */ + char * pOut; /* output pointer for rx buf */ + char * pEnd; /* end pointer for rx buf */ + char * packetAddr[ESMC_INDEXES]; /* packet address */ + int packetLen[ESMC_INDEXES]; /* packet length */ + int indexIn; /* index for interrupt */ + int indexOut; /* index for output */ + int nIndex; /* number of indexes */ + u_int interrupt; /* counter for interrupt */ + u_int intRcv; /* counter for interrupt */ + u_int intTx; /* counter for interrupt */ + u_int intTxempty; /* counter for interrupt */ + u_int intAlloc; /* counter for interrupt */ + u_int intOverrun; /* counter for interrupt */ + u_int intEph; /* counter for interrupt */ + u_int intErcv; /* counter for interrupt */ + u_int lostCarr; /* lost carr */ + u_int allocTimeout; /* allocation timeout */ + u_int allocFailed; /* allocation failed */ + char flags; /* misc control flags */ + } ESMC_SOFTC; + + +/* BANK 0 I/O Space mapping */ + +#define ESMC_TCR 0x0 /* transmit control register */ +#define ESMC_EPH 0x2 /* EPH status register */ +#define ESMC_RCR 0x4 /* receive control register */ +#define ESMC_COUNTER 0x6 /* counter register */ +#define ESMC_MIR 0x8 /* memory information register */ +#define ESMC_MCR 0xA /* memory configuration register */ + +/* Transmit Control Register */ + +#define ESMC_TCR_EPH_LOOP 0x2000 /* internal loopback at EPH block */ +#define ESMC_TCR_STP_SQET 0x1000 /* stop trans on signal quality error */ +#define ESMC_TCR_FDUPLX 0x0800 /* enable full duplex */ +#define ESMC_TCR_MON_CNS 0x0400 /* monitors the carrier while trans */ +#define ESMC_TCR_NOCRC 0x0100 /* NOT append CRC to frame if set */ +#define ESMC_TCR_PAD 0x0080 /* pad short frames to 64 bytes */ +#define ESMC_TCR_FORCOL 0x0040 /* force collision, then auto resets */ +#define ESMC_TCR_LOOP 0x0020 /* internal loopback */ +#define ESMC_TCR_TXEN 0x0001 /* transmit enabled when set */ +#define ESMC_TCR_RESET 0x0000 /* Disable the transmitter */ + +/* EPH Status Register - stores status of last transmitted frame */ + +#define ESMC_TS_TXUNRN 0x8000 /* tramsmit under run */ +#define ESMC_TS_LINK_OK 0x4000 /* twisted pair link cond */ +#define ESMC_TS_RX_OVRN 0x2000 /* on FIFO overrun... */ +#define ESMC_TS_CTR_ROL 0x1000 /* counter rollover */ +#define ESMC_TS_EXC_DEF 0x0800 /* excessive deferal */ +#define ESMC_TS_LOST_CARR 0x0400 /* ## lost carrier sense */ +#define ESMC_TS_LATCOL 0x0200 /* ## late collision */ +#define ESMC_TS_TX_DEFR 0x0080 /* transmit deferred - auot cleared */ +#define ESMC_TS_LTX_BRD 0x0040 /* last frame was broascast packet */ +#define ESMC_TS_SQET 0x0020 /* ## signal quality error test */ +#define ESMC_TS_16COL 0x0010 /* ## 16 collisions reached */ +#define ESMC_TS_LXT_MULT 0x0008 /* last frame was multicast */ +#define ESMC_TS_MULCOL 0x0004 /* multiple collision detected */ +#define ESMC_TS_SNGLCOL 0x0002 /* single collision detected */ +#define ESMC_TS_TX_SUC 0x0001 /* last Transmit was successful */ + /* ## indicates fatal error */ +/* Recieve control register */ + +#define ESMC_RCR_EPH_RST 0x8000 /* software activated reset */ +#define ESMC_RCR_FILT_CAR 0x4000 /* filter carrier sense 12 bits */ +#define ESMC_RCR_STRIP_CRC 0x0200 /* when set, strips CRC */ +#define ESMC_RCR_RXEN 0x0100 /* ENABLE reciever */ +#define ESMC_RCR_ALMUL 0x0004 /* receive all multicast packets */ +#define ESMC_RCR_PRMS 0x0002 /* enable promiscuous mode */ +#define ESMC_RCR_RX_ABORT 0x0001 /* set if reciever overrun */ +#define ESMC_RCR_RESET 0x0 /* set it to a base state */ + +/* Memory Information Register */ + +#define ESMC_MIR_FREE MIR /* read at any time for free mem */ +#define ESMC_MIR_SIZE MIR+1 /* determine amount of onchip mem */ + + +/* BANK 1 I/O Space mapping */ + +#define ESMC_CONFIG 0x0 /* configuration register */ +#define ESMC_BASE 0x2 /* base address register */ +#define ESMC_ADDR_0 0x4 /* individual address register 0 */ +#define ESMC_ADDR_1 0x6 /* individual address register 1 */ +#define ESMC_ADDR_2 0x8 /* individual address register 2 */ +#define ESMC_GENERAL 0xA /* general purpose register */ +#define ESMC_CONTROL 0xC /* control register */ + +/* Configuration register */ + +#define ESMC_CFG_NO_WAIT_ST 0x1000 /* when set */ +#define ESMC_CFG_FULL_STEP 0x0400 /* AUI, use full step signaling */ +#define ESMC_CFG_SET_SQLCH 0x0200 /* when set squelch level is 240mV */ +#define ESMC_CFG_AUI_SELECT 0x0100 /* when set use AUI */ +#define ESMC_CFG_16BIT 0x0080 /* usually auto set 16/8 selection */ +#define ESMC_CFG_DIS_LINK 0x0040 /* disables link test, TP only */ +#define ESMC_INT_INTR_ZERO 0xf9 /* mask to clear interrrupt setting */ +#define ESMC_INT_SEL_INTR0 0x0 +#define ESMC_INT_SEL_INTR1 0x2 +#define ESMC_INT_SEL_INTR2 0x4 +#define ESMC_INT_SEL_INTR3 0x6 + +/* Control Register */ + +#define ESMC_CTL_RCV_BAD 0x4000 /* when set bad CRC packets received */ +#define ESMC_CTL_PWEDN 0x2000 /* high puts chip in powerdown mode */ +#define ESMC_CTL_AUTO_RELEASE 0x0800 /* transmit memory auto released */ +#define ESMC_CTL_LE_ENABLE 0x0080 /* Link error enable */ +#define ESMC_CTL_CR_ENABLE 0x0040 /* counter rollover enable */ +#define ESMC_CTL_TE_ENABLE 0x0020 /* transmit error enable */ +#define ESMC_CTL_EPROM_SELECT 0x0004 /* EEprom access bit */ + + +/* BANK 2 I/O Space mapping */ + +#define ESMC_MMU 0x0 /* MMU command register */ +#define ESMC_PNR 0x2 /* packet number register */ +#define ESMC_ARR 0x3 /* allocation result register */ +#define ESMC_FIFO 0x4 /* FIFO ports register */ +#define ESMC_PTR 0x6 /* pointer register */ +#define ESMC_DATA_1 0x8 /* data register 1 */ +#define ESMC_DATA_2 0xA /* data register 2 */ +#define ESMC_INT_STAT 0xC /* int status & acknowledge register */ +#define ESMC_INT_ACK 0xC /* int status & acknowledge register */ +#define ESMC_INT_MASK 0xD /* int mask register */ + +/* MMU Command Register */ + +#define ESMC_MMU_BUSY 0x0001 /* set if MMU busy */ +#define ESMC_MMU_ALLOC 0x0020 /* get memory from chip memory/256 */ +#define ESMC_MMU_NOP 0x0000 +#define ESMC_MMU_RESET 0x0040 +#define ESMC_MMU_RX_REMOVE 0x0060 /* remove current RX frame from FIFO */ +#define ESMC_MMU_RX_RELEASE 0x0080 /* also release memory associated */ +#define ESMC_MMU_TX_RELEASE 0x00A0 /* free packet memory in PNR register */ +#define ESMC_MMU_ENQUEUE 0x00C0 /* Enqueue the packet for transmit */ +#define ESMC_MMU_TX_RESET 0x00E0 /* reset TX FIFO's */ + +/* Allocation Result Register */ + +#define ESMC_ARR_FAILED 0x80 + +/* FIFO Ports Register */ + +#define ESMC_FP_RXEMPTY 0x8000 /* no rx packets queued in RX FIFO */ +#define ESMC_FP_TXEMPTY 0x0080 /* no tx packets queued in TX FIFO */ + +/* Pointer Register - address to be accessed in chip memory*/ + +#define ESMC_PTR_RCV 0x8000 /* when set, refers to receive area */ +#define ESMC_PTR_READ 0x2000 /* type of access to follow */ +#define ESMC_PTR_AUTOINC 0x4000 /* auto incs. PTR correct amount */ + +/* Interrupt Detail */ + +#define ESMC_INT_EPH 0x20 /* Set when EPH handler fires */ +#define ESMC_INT_RX_OVRN 0x10 /* set when receiver overruns */ +#define ESMC_INT_ALLOC 0x08 /* set when MMU allocation is done */ +#define ESMC_INT_TX_EMPTY 0x04 /* set id TX_FIFO empty */ +#define ESMC_INT_TX 0x02 /* set when at least one packet sent */ +#define ESMC_INT_RCV 0x01 +#define ESMC_INT_ERCV 0x40 /* for other chip sets */ + +/* Interrupts for chip to generate */ + +#define ESMC_INTERRUPT_MASK (ESMC_INT_EPH | ESMC_INT_RX_OVRN | ESMC_INT_RCV) + + +/* BANK 3 I/O Space mapping */ + +#define ESMC_MULTICAST0 0x0 /* multicast table - WORD 0 */ +#define ESMC_MULTICAST2 0x2 /* multicast table - WORD 1 */ +#define ESMC_MULTICAST4 0x4 /* multicast table - WORD 2 */ +#define ESMC_MULTICAST6 0x6 /* multicast table - WORD 3 */ +#define ESMC_MGMT 0x8 +#define ESMC_REVISION 0xA /* chip set and revision encoded here */ +#define ESMC_ERCV 0xC /* early recieve register */ + +/* Recieve frame status word - located at beginning of each received frame*/ + +#define ESMC_RS_ALGNERR 0x8000 /* frame had alignment error */ +#define ESMC_RS_BRODCAST 0x4000 /* receive frame was broadcast */ +#define ESMC_RS_BADCRC 0x2000 /* CRC error */ +#define ESMC_RS_ODDFRM 0x1000 /* receive frame had odd byte */ +#define ESMC_RS_TOOLONG 0x0800 /* longer then 1518 bytes */ +#define ESMC_RS_TOOSHORT 0x0400 /* shorter then 64 bytes */ +#define ESMC_RS_MULTICAST 0x0001 /* receive frame was multicast */ +#define ESMC_RS_ERROR_MASK (ESMC_RS_ALGNERR | ESMC_RS_BADCRC | ESMC_RS_TOOLONG | ESMC_RS_TOOSHORT) + + +/* Switch bank - done often! */ + +#define ESMC_SWITCH_BANK(x) { sysOutWord(ioaddr + ESMC_BANK_SELECT, x ); } + + +#ifdef __cplusplus +} +#endif + +#endif /* INCif_smc9.h */ diff --git a/h/drv/netif/if_fei.h b/h/drv/netif/if_fei.h new file mode 100644 index 0000000..bc3e689 --- /dev/null +++ b/h/drv/netif/if_fei.h @@ -0,0 +1,413 @@ +/* if_fei.h - Intel 82557 network interface header */ + +/* Copyright 1990-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,09nov01,dat Adding obsolescence warnings to outdated drivers +01e,09mar99,cn added typedef CSR_ID (SPR# 25242). +01d,17mar98,sbs added PCI specific board definitions. +01c.13nov96,hdn added two members to BOARD_INFO. removed two xxxAddrGet(). +01b.06oct96,myz added board specific data structure +01a,02sep96,dzb written, based on v02h of h/drv/netif/if_ei.h. +*/ + +#ifndef __INCif_feih +#define __INCif_feih + +#include "etherLib.h" + +#warning "if_fei is obsolete, please use fei82557End driver" + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +#define MC_FEI MC_EI /* temp */ + +/* board specific infomation */ +typedef struct + { + UINT32 vector; /* interrupt vector number */ + UINT32 baseAddr; /* memory base address for CSR */ + UCHAR enetAddr[6]; /* ethernet address */ + int (*intEnable)(int unit); /* board specific interrupt enable routine */ + int (*intDisable)(int unit); /* board specific interrupt disable routine */ + int (*intAck) (int unit); /* interrupt ack */ + UINT32 (*sysLocalToBus)(int unit,UINT32 localAdr); + UINT32 (*sysBusToLocal)(int unit,UINT32 sysAdr); + + /* configuration parameters, user can override in the BSP */ + UINT8 phyAddr; /* PHY device address, valid addresses: 0-32 */ + UINT8 phySpeed; + UINT8 phyDpx; + UINT8 fill0; + + UINT16 tcbTxThresh; + + UINT16 others; /* allow you write all bits to Mode Control Register in the + PHY device, don't touch it unless you know what you're doing. */ + + UINT32 spare1; + UINT32 spare2; + UINT32 spare3; + UINT32 spare4; + } BOARD_INFO; + +/* Intel PRO-100B PCI specific definitions */ + +#define PRO100B_PCI_VENDOR_ID 0x8086 /* PCI vendor ID */ +#define PRO100B_PCI_DEVICE_ID 0x1229 /* PCI device ID */ + +/* constants needed within this file */ + +#define FEI_MAX_UNITS 4 /* max units supported */ +#define FEI_CFD_DEF 32 /* default number of CFDs */ +#define FEI_RFD_DEF 32 /* default number of RFDs */ +#define FEI_RFD_LOAN 8 /* number RFDs that can be loaned */ +#define EH_SIZE 14 /* avoid structure padding issues */ +#define N_MCAST 12 + +/* Intel 82557 endian safe link macros and structure definitions */ + +#define LINK_WR(pLink,value) \ + (((pLink)->lsw = (UINT16)((UINT32)(value) & 0x0000ffff)), \ + ((pLink)->msw = (UINT16)(((UINT32)(value) >> 16) & 0x0000ffff))) + +#define LINK_RD(pLink) ((pLink)->lsw | ((pLink)->msw << 16)) + +#define STAT_RD LINK_RD /* statistic read is a link read */ +#define STAT_WR LINK_WR /* statistic write is a link write */ +#define PORT_WR LINK_WR /* port write is a link write */ + +typedef struct fei_link /* FEI_LINK - endian resolvable link */ + { + UINT16 lsw; /* least significant word */ + UINT16 msw; /* most significant word */ + } FEI_LINK; + +/* Intel 82557 structure and offset */ + +typedef struct csr /* CSR - Control Status Registers */ + { + volatile UINT16 scbStatus; + volatile UINT16 scbCommand; + + FEI_LINK scbGP; /* 0x04: SCB General Pointer */ + FEI_LINK port; /* 0x08: PORT register */ + UINT16 flashCR; /* 0x0c: FLASH Control Register */ + UINT16 eepromCR; /* 0x0e: EEPROM Control Register */ + FEI_LINK mdiCR; /* 0x10: MDI Control Register */ + FEI_LINK rxbc; /* 0x14: early RCV Byte Count */ + } CSR; + +typedef CSR * CSR_ID; + +#define SCB_STATUS 0x00 /* SCB status byte */ +#define SCB_CMD 0x02 /* SCB command byte */ +#define SCB_POINTER 0x04 /* SCB pointer */ +#define SCB_PORT 0x08 /* SCB port register */ +#define SCB_FLASH 0x0c /* SCB flash control register */ +#define SCB_EEPROM 0x0e /* SCB eeprom control register */ +#define SCB_MDI 0x10 /* SCB mdi control register */ +#define SCB_EARLYRX 0x14 /* SCB early receive byte count */ + +/* SCB Status Word byte mask definitions */ + +#define SCB_S_RUMASK 0x3c /* RU status mask */ +#define SCB_S_RUIDLE 0x00 /* RU is idle */ +#define SCB_S_RUSUSP 0x04 /* RU is suspended */ +#define SCB_S_RUNORSR 0x08 /* RU no more resources */ +#define SCB_S_RURDY 0x10 /* RU is ready */ +#define SCB_S_RUSUSPNR 0x24 /* RU is suspended/no more resources */ +#define SCB_S_RUNORSRBD 0x28 /* RU no more resources/no more RBD's */ +#define SCB_S_RURDYBD 0x30 /* RU is ready/no more RBD's */ +#define SCB_S_CUMASK 0xc0 /* CU status mask */ +#define SCB_S_CUIDLE 0x00 /* CU is idle */ +#define SCB_S_CUSUSP 0x40 /* CU is suspended */ +#define SCB_S_CUACTIVE 0x80 /* CU is active */ +#define SCB_S_MASK 0xff + +/* SCB STAT/ACK byte bit mask definitions */ + +#define SCB_S_STATMASK 0xfc00 /* stat mask */ +#define SCB_S_SWI 0x0400 /* software generated interrupt */ +#define SCB_S_MDI 0x0800 /* An MDI read or write cycle is done */ +#define SCB_S_RNR 0x1000 /* RU left the ready state */ +#define SCB_S_CNA 0x2000 /* CU left the active state */ +#define SCB_S_CI 0x2000 /* CU entered the idle state */ +#define SCB_S_FR 0x4000 /* RU finished receiveing a frame */ +#define SCB_S_CX 0x8000 /* CU finished a cmd with I bit set */ +#define SCB_S_TNO 0x8000 /* Tx command ended with not OK */ + +/* SCB Command byte bit mask definitions */ + +#define SCB_C_RUMASK 0x07 /* RU Command mask */ +#define SCB_C_RUNOP 0x00 /* NOP */ +#define SCB_C_RUSTART 0x01 /* RU start reception of frames */ +#define SCB_C_RURESUME 0x02 /* RU resume reception of frames */ +#define SCB_C_RUABORT 0x04 /* RU abort receiver immediately */ +#define SCB_C_RULDHDS 0x05 /* RU load header data size */ +#define SCB_C_RULDBASE 0x06 /* load RU base address */ +#define SCB_C_RURBDRSM 0x07 /* RBD resume */ +#define SCB_C_CUMASK 0x70 /* CU Command mask */ +#define SCB_C_CUNOP 0x00 /* NOP */ +#define SCB_C_CUSTART 0x10 /* CU start execution */ +#define SCB_C_CURESUME 0x20 /* CU resume execution */ +#define SCB_C_CULDDUMP 0x40 /* load dump counters address */ +#define SCB_C_CUDUMP 0x50 /* dump stat counters */ +#define SCB_C_CULDBASE 0x60 /* load CU base address */ +#define SCB_C_CUDUMPRST 0x70 /* dump and reset stat counters */ +#define SCB_CR_MASK 0xff + +/* SCB Interrupt Control byte bit mask definitions */ + +#define SCB_C_M 0x0100 /* interrupt mask */ +#define SCB_C_SI 0x0200 /* software generated interrupt */ + +typedef struct fei_count /* FEI_COUNT - 82557 statistical counters */ + { + FEI_LINK txGood; /* tx good frames */ + FEI_LINK txMaxCol; /* tx max collisions errors */ + FEI_LINK txLateCol; /* tx late collisions errors */ + FEI_LINK txUnder; /* tx underrun errors */ + FEI_LINK txCRS; /* tx carrier sense loss */ + FEI_LINK txDefer; /* tx deferred */ + FEI_LINK txSglCol; /* tx single collisions */ + FEI_LINK txMultCol; /* tx multiple collisions */ + FEI_LINK txTotCol; /* tx total collisions */ + FEI_LINK rxGood; /* rx good frames */ + FEI_LINK rxCRC; /* rx CRC errors */ + FEI_LINK rxAllgn; /* rx allignment errors */ + FEI_LINK rxRsr; /* rx resource errors */ + FEI_LINK rxOver; /* rx overrun errors */ + FEI_LINK rxCDT; /* rx collision detect errors */ + FEI_LINK rxShort; /* rx short frame errors */ + } FEI_COUNT; + +/* PORT commands */ + +#define FEI_PORT_RESET 0x0 /* PORT reset command */ +#define FEI_PORT_SELFTEST 0x1 /* PORT selftest command */ +#define FEI_PORT_SELRESET 0x2 /* PORT selective reset command */ +#define FEI_PORT_DUMP 0x3 /* PORT dump command */ + +/* Action Command Descriptions */ + +typedef struct ac_iasetup /* AC_IASETUP - Individual Address Setup */ + { + UINT8 ciAddress[6]; /* local ethernet address */ + UINT16 ciFill; + } AC_IASETUP; + +typedef struct ac_config /* AC_CONFIG - i82557 Configure */ + { + UINT8 ccByte0; /* byte count */ + UINT8 ccByte1; /* FIFO limits */ + UINT8 ccByte2; /* adaptive IFS */ + UINT8 ccByte3; /* reserved - set to 0 */ + UINT8 ccByte4; /* rx max byte count */ + UINT8 ccByte5; /* tx max byte count, byte cnt enable */ + UINT8 ccByte6; /* save bf, CI/TNO int, late SCB */ + UINT8 ccByte7; /* underrun retry, short discard */ + UINT8 ccByte8; /* 503/MII */ + UINT8 ccByte9; /* reserved - set to 0 */ + UINT8 ccByte10; /* loopback, reamble, NSAI */ + UINT8 ccByte11; /* linear priority */ + UINT8 ccByte12; /* interframe spacing, L. pri mode */ + UINT8 ccByte13; /* reserved - set to 0 */ + UINT8 ccByte14; /* reserved - set to 0xf2 */ + UINT8 ccByte15; /* CRS+CDT, Broadcast, promisc */ + UINT8 ccByte16; /* reserved - set to 0 */ + UINT8 ccByte17; /* reserved - set to 0x40 */ + UINT8 ccByte18; /* CRC, padding, stripping */ + UINT8 ccByte19; /* full duplex, force full duplex */ + UINT8 ccByte20; /* multi IA */ + UINT8 ccByte21; /* multicast */ + } AC_CONFIG; + +typedef struct ac_mcast /* AC_MCAST - Mulitcast Setup */ + { + UINT16 cmMcCount; /* the number of bytes in MC list */ + UINT8 cmAddrList[6 * N_MCAST];/* mulitcast address list */ + } AC_MCAST; + +typedef struct ac_tcb /* AC_TCB - Transmit Control Blocks */ + { + FEI_LINK pTBD; /* link to tx buf desc array */ + UINT16 count; /* length of data */ + UINT8 txThresh; /* tx threshold */ + UINT8 tbdNum; /* tx buf desc number */ + UINT8 enetHdr [EH_SIZE];/* the ethernet header */ + char enetData [ETHERMTU];/* transmit data */ + UINT16 ccFill; /* padding */ + } AC_TCB; + +/* special TCB-specific command block bit mask definitions */ + +#define CFD_S_TX_DMA_U 0x1000 /* DMA underrun */ +#define TCB_CNT_EOF 0x8000 /* all data kept in TFD */ +#define CFD_C_TX_FLEX 0x0008 /* use flexible mode */ + +typedef struct ac_dump /* AC_DUMP - Dump */ + { + FEI_LINK bufAddr; /* address of dump buffer */ + } AC_DUMP; + +/* special Diag-specific command block bit mask definitions */ + +#define CFD_S_DIAG_F 0x0800 /* diag failed */ + +/* Command Frame Description and defines */ + +typedef struct cfd /* CFD - Command Frame Descriptor */ + { + volatile UINT16 cfdStatus; /* command status field */ + UINT16 cfdCommand; /* command field */ + FEI_LINK link; /* address of next CB */ + union /* command dependent section */ + { + struct ac_iasetup cfd_iasetup; /* IA setup */ + struct ac_config cfd_config; /* config */ + struct ac_mcast cfd_mcast; /* multicast setup */ + struct ac_tcb cfd_tcb; /* transmit */ + struct ac_dump cfd_dump; /* dump */ + } cfd_cmd; + struct cfd * pPrev; /* previos CFD */ + } CFD; + +#define cfdIASetup cfd_cmd.cfd_iasetup +#define cfdConfig cfd_cmd.cfd_config +#define cfdMcast cfd_cmd.cfd_mcast +#define cfdTcb cfd_cmd.cfd_tcb +#define cfdDump cfd_cmd.cfd_dump + +/* Action Status Word bit mask definitions */ + +#define CFD_S_OK 0x2000 /* Command completed successfully */ +#define CFD_S_B 0x4000 /* CU starts access this CFD */ +#define CFD_S_COMPLETE 0x8000 /* Command complete */ + +/* Action Command Word bit mask definitions */ + +#define CFD_C_NOP 0x0000 /* No Operation */ +#define CFD_C_IASETUP 0x0001 /* Individual Address Setup */ +#define CFD_C_CONFIG 0x0002 /* Configure Chip */ +#define CFD_C_MASETUP 0x0003 /* Multicast Setup */ +#define CFD_C_XMIT 0x0004 /* Transmit (see below too ...) */ +#define CFD_C_DUMP 0x0006 /* Dump Registers */ +#define CFD_C_DIAG 0x0007 /* Diagnose */ +#define CFD_C_INT 0x2000 /* 557 interrupts CPU after execution */ +#define CFD_C_SUSP 0x4000 /* CU should suspend after execution */ +#define CFD_C_EL 0x8000 /* End of command list */ + +/* 82557 Receive Frame Descriptors */ + +typedef struct rfd /* RFD - Receive Frame Descriptor */ + { + volatile UINT16 rfdStatus; /* status field */ + UINT16 rfdCommand; /* command field */ + FEI_LINK link; /* link to next rfd */ + FEI_LINK pRBD; /* link to rx buf desc array */ + volatile UINT16 actualCnt; /* actual byte count */ + UINT16 bufSize; /* buffer size */ + UINT8 enetHdr [EH_SIZE];/* the ethernet header */ + char enetData [ETHERMTU];/* received data */ + UINT8 refCnt; /* reference count */ + UINT8 ccFill; /* padding */ + struct rfd * pPrev; /* previos RFD */ + } RFD; + +/* RFD bit mask definitions */ + +#define RFD_S_COLL 0x0001 /* collision during reception */ +#define RFD_S_IA 0x0002 /* individual address match */ +#define RFD_S_RXER 0x0010 /* receive error */ +#define RFD_S_LEN 0x0020 /* type/len field designator */ +#define RFD_S_SHORT 0x0080 /* frame too short */ +#define RFD_S_DMA 0x0100 /* DMA Overrun failure to get bus */ +#define RFD_S_RSRC 0x0200 /* received, but ran out of buffers */ +#define RFD_S_ALGN 0x0400 /* received misaligned with CRC error */ +#define RFD_S_CRC 0x0800 /* received with CRC error */ +#define RFD_S_OK 0x2000 /* frame received successfully */ +#define RFD_S_B 0x4000 /* RU begins accessing this RFD */ +#define RFD_S_COMPLETE 0x8000 /* frame reception complete */ + +#define RFD_C_FLEX 0x0008 /* flexible mode */ +#define RFD_C_HEADER 0x0010 /* frame is a header */ +#define RFD_C_SUSP 0x4000 /* suspend RU after receiving frame */ +#define RFD_C_EL 0x8000 /* end of RFD list */ + +#define RFD_CNT_F 0x4000 /* actual count updated */ +#define RFD_CNT_EOF 0x8000 /* end of frame */ + +/* EEPROM bit definitions */ + +#define FEI_EESK 0x01 /* EEPROM shift clock */ +#define FEI_EECS 0x02 /* EEPROM chip select */ +#define FEI_EEDI 0x04 /* EEPROM data in */ +#define FEI_EEDO 0x08 /* EEPROM data out */ + + +/* Following defines should be in another header file */ + +/* MDI definitions */ + +#define MDI_READ 0x2 +#define MDI_WRITE 0x1 +#define MDI_CTRL_REG 0x0 +#define MDI_STATUS_REG 0x1 + +/* MDI control register bit */ +#define MDI_CR_COLL_TEST 0x80 +#define MDI_CR_FDX 0x100 /* FDX =1, half duplex =0 */ +#define MDI_CR_RESTART 0x200 /* restart auto negotiation */ +#define MDI_CR_ISOLATE 0x400 /* isolate PHY from MII */ +#define MDI_CR_POWER_DOWN 0x800 /* power down */ +#define MDI_CR_SELECT 0x1000 /* auto speed select */ +#define MDI_CR_100 0x2000 /* 0 = 10mb, 1 = 100mb */ +#define MDI_CR_LOOPBACK 0x4000 /* 0 = normal, 1 = loopback */ +#define MDI_CR_RESET 0x8000 /* 0 = normal, 1 = PHY reset */ + +/* MDI Status register bit definitions */ +#define MDI_SR_LINK_STATUS 0x4 /* link Status -- 1 = link */ +#define MDI_SR_AUTO_SELECT 0x8 /* auto speed select capable */ +#define MDI_SR_REMOTE_FAULT 0x10 /* Remote fault detect */ +#define MDI_SR_AUTO_NEG 0x20 /* auto negotiation complete */ +#define MDI_SR_10T_HALF_DPX 0x800 /* 10BaseT half duplex capable */ +#define MDI_SR_10T_FULL_DPX 0x1000 /* 10BaseT full duplex capable */ +#define MDI_SR_TX_HALF_DPX 0x2000 /* TX half duplex capable */ +#define MDI_SR_TX_FULL_DPX 0x4000 /* TX full duplex capable */ +#define MDI_SR_T4 0x8000 /* T4 capable */ + +#define PHY_100MBS 1 +#define PHY_10MBS 0 +#define PHY_AUTO_SPEED 2 + +#define PHY_FULL_DPX 1 +#define PHY_HALF_DPX 0 +#define PHY_AUTO_DPX 2 + +#define PHY_LINK_ERROR 0x10 +#define PHY_AUTO_FAIL 0x20 + +/* PRO/100B definitions */ + +#define EP100B_PCI_VENDOR_ID 0x8086 /* Intel vendor ID */ +#define EP100B_PCI_DEVICE_ID 0x1229 /* PRO/100B device ID */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_feih */ + diff --git a/h/drv/netif/if_fn.h b/h/drv/netif/if_fn.h new file mode 100644 index 0000000..4bf4a76 --- /dev/null +++ b/h/drv/netif/if_fn.h @@ -0,0 +1,263 @@ +/* if_fn.h - structures and defines for the Fujitsu mb86960 NICE device */ + +/* Copyright 1992-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,09nov01,dat Adding obsolescence warnings to outdated drivers +01d,22sep92,rrr added support for c++ +01c,16jun92,jwt passed through the ansification filter + -changed copyright notice +01b,21feb92,rfs modified for Fujitsu SPARClite EVIL board specific. +01a,03feb92,rfs created +*/ + +#ifndef __INCif_fnh +#define __INCif_fnh + +#warning "if_fn is obsolete, please use mb86960End driver" + +#ifdef __cplusplus +extern "C" { +#endif + +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * SECTION: Data Structures + *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ + +typedef struct rx_hdr /* received packet header */ + { + unsigned short status; /* only upper byte used */ + unsigned short len; /* pkt length in little endian order */ + } RX_HDR; +#define RX_HDR_SIZ sizeof(RX_HDR) + + +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * SECTION: Register Addresses + *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ + + +/* NICE registers, defined as offsets from base addr */ + + /* The statically mapped registers. This group of registers is + * always available to the CPU. + * This first group are the data link control registers 0-7. + */ + +#define NICE_STATUS 0x02 /* DLC0,1: Tx and Rx status */ +#define NICE_INTRMASK 0x06 /* DLC2,3: Tx and Rx intr masks */ +#define NICE_MODE 0x0a /* DLC4,5: Tx and Rx modes */ +#define NICE_CONFIG 0x0e /* DLC6,7: configuration bits */ + + + /* The selectable mapped registers. These groups can be mapped in + * or out of the overall register set. The selection of which group + * is currently mapped in is done via control register 2 (DLCR7) in + * the statically mapped register group above. + */ + + + /* the secondary data link control regs */ + +#define NICE_ADDR1 0x12 /* DLC8,9: node addr high word */ +#define NICE_ADDR2 0x16 /* DLC10,11: node addr mid word */ +#define NICE_ADDR3 0x1a /* DLC12,13: node addr low word */ +#define NICE_TDR 0x1e /* DLC14,15: time domain counter */ + + /* the hash table registers */ + +#define NICE_HASH1 0x12 +#define NICE_HASH2 0x16 +#define NICE_HASH3 0x1a +#define NICE_HASH4 0x1e + + /* the buffer memory registers */ + +#define NICE_PORT 0x12 /* BMR8: access port to buffer */ +#define NICE_TRANSMIT 0x16 /* BMR10,11: Tx cmd & coll ctrl */ +#define NICE_DMA 0x1a /* BMR12,13: DMA control */ +#define NICE_STUFF 0x1e + + + +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * SECTION: bit defines for the device registers and receive header status + *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ + +/* The status field of the receive header (RX_HDR above) */ + +#define RX_HDR_STAT_BIT_7 0x8000 /* unused; should read as 0 */ +#define RX_HDR_STAT_BIT_6 0x4000 /* unused; should read as 0 */ +#define RX_HDR_STAT_GOOD 0x2000 /* packet is good */ +#define RX_HDR_STAT_RMT_RST 0x1000 /* packet type = 0x0900 */ +#define RX_HDR_STAT_SHRT_ERR 0x0800 /* short packet error */ +#define RX_HDR_STAT_ALGN_ERR 0x0400 /* alignment error */ +#define RX_HDR_STAT_CRC_ERR 0x0200 /* CRC error */ +#define RX_HDR_STAT_OVR_FLO 0x0100 /* overflow error */ + + /* Note that the short error bit has been observed to be set sporadically + * and is therefore not usable. The overflow bit should never be set, + * since the receiver should not be giving us incomplete packets! The + * lower byte of the status field is currently unused, but has been seen + * to have various bits set. It is probably wise to simply mask this + * byte off to avoid any confusion. + */ + + +/* DLCR0,1 -- the receive and transmit status register */ + +#define DLCR0_TX_DONE 0x8000 /* transmit OK */ +#define DLCR0_NET_BSY 0x4000 /* network is busy, carrier present */ +#define DLCR0_TX_RX 0x2000 /* transmit received good */ +#define DLCR0_CR_LOST 0x1000 /* short packet */ +#define DLCR0_BIT_3 0x0800 /* unused bit; write 0 */ +#define DLCR0_COL 0x0400 /* a collision occurred */ +#define DLCR0_16_COL 0x0200 /* 16 collisions occurred */ +#define DLCR0_BUS_WR_ERR 0x0100 /* buss write error */ + +#define DLCR1_RX_PKT 0x0080 /* received packet ready */ +#define DLCR1_BUS_RD_ERR 0x0040 /* buss read error */ +#define DLCR1_DMA_EOP 0x0020 /* DMA end operation interrupt status */ +#define DLCR1_RMT_RST 0x0010 /* received a remote reset packet */ +#define DLCR1_SHRT_ERR 0x0008 /* short packet error */ +#define DLCR1_ALGN_ERR 0x0004 /* alignment error */ +#define DLCR1_CRC_ERR 0x0002 /* CRC error, CRC does not match FCS */ +#define DLCR1_OVR_FLO 0x0001 /* overflow, no space available */ + + +/* DLCR2,3 -- interrupt masks for receive and transmit status register */ + +#define DLCR2_TX_DONE 0x8000 /* transmit OK intr mask */ +#define DLCR2_BIT_6 0x4000 /* unused; write 0 */ +#define DLCR2_TX_RX 0x2000 /* transmission received good mask */ +#define DLCR2_BIT_4 0x1000 /* unused; write 0 */ +#define DLCR2_BIT_3 0x0800 /* unused; write 0 */ +#define DLCR2_COL 0x0400 /* collision intr mask */ +#define DLCR2_16_COL 0x0200 /* 16 collisions intr mask */ +#define DLCR2_BUS_WR_ERR 0x0100 /* buss write error intr mask */ + +#define DLCR3_RX_PKT 0x0080 /* received packet ready intr mask */ +#define DLCR3_BUS_RD_ERR 0x0040 /* buss read error intr mask */ +#define DLCR3_DMA_EOP 0x0020 /* DMA end operation intr mask */ +#define DLCR3_RMT_RST 0x0010 /* remote reset intr mask */ +#define DLCR3_SHRT_ERR 0x0008 /* short packet error intr mask */ +#define DLCR3_ALGN_ERR 0x0004 /* alignment error intr mask */ +#define DLCR3_CRC_ERR 0x0002 /* CRC error intr mask */ +#define DLCR3_OVR_FLO 0x0001 /* overflow error intr mask */ + + +/* DLCR4,5 -- receiver and transmitter modes register */ + +#define DLCR4_COL_CTR 0xf000 /* collision counter, 4 bits */ +#define DLCR4_BIT_3 0x0800 /* unused; write 0 */ +#define DLCR4_CNTRL 0x0400 /* drives the CNTRL pin; pin 95 */ +#define DLCR4_LBC 0x0200 /* endec loopback; 0 selects */ +#define DLCR4_TX_NO_DEFER 0x0100 /* disable carrier detect on Tx */ + +#define DLCR5_BIT_7 0x0080 /* unused; write 0 */ +#define DLCR5_BUF_EMPTY 0x0040 /* buffer empty */ +#define DLCR5_ACPT_BAD 0x0020 /* accept bad packets */ +#define DLCR5_SHRT_ADD 0x0010 /* use short address, 5 bytes */ +#define DLCR5_ENA_SHRT_PKT 0x0008 /* enable receipt of short packets */ +#define DLCR5_BIT_2 0x0004 /* unused; write 1 */ +#define DLCR5_AF1 0x0002 /* addr filter mode, bit 1 */ +#define DLCR5_AF0 0x0001 /* addr filter mode, bit 0 */ + + +/* DLCR6,7 -- configuration register */ + +#define DLCR6_DISABLE_DLC 0x8000 /* disable data link controller */ +#define DLCR6_BIT_6 0x4000 /* unused; write 1 */ +#define DLCR6_SYS_BUS 0x2000 /* selects width of system bus */ +#define DLCR6_SYS_BUS_8 0x2000 /* system bus is 8 bit */ +#define DLCR6_SYS_BUS_16 0x0000 /* system bus is 16 bit */ +#define DLCR6_BUF_BUS 0x1000 /* selects width of buffer bus */ +#define DLCR6_BUF_BUS_8 0x1000 /* buffer bus is 8 bits */ +#define DLCR6_BUF_BUS_16 0x0000 /* buffer bus is 16 bits */ +#define DLCR6_TBS 0x0c00 /* selects Tx buffer size, 2 bits */ +#define DLCR6_TBS_2KB 0x0000 /* Tx buffer size is 2 KB */ +#define DLCR6_TBS_4KB 0x0400 /* Tx buffer size is 4 KB */ +#define DLCR6_TBS_8KB 0x0800 /* Tx buffer size is 8 KB */ +#define DLCR6_TBS_16KB 0x0c00 /* Tx buffer size is 16 KB */ +#define DLCR6_BS 0x0300 /* selects SRAM buffer size, 2 bits */ +#define DLCR6_BS_8KB 0x0000 /* SRAM buffer size is 8 KB */ +#define DLCR6_BS_16KB 0x0100 /* SRAM buffer size is 16 KB */ +#define DLCR6_BS_32KB 0x0200 /* SRAM buffer size is 32 KB */ +#define DLCR6_BS_64KB 0x0300 /* SRAM buffer size is 64 KB */ + +#define DLCR7_CNF 0x00c0 /* selects chip config, 2 bits */ +#define DLCR7_CNF_NICE 0x0000 /* normal NICE mode */ +#define DLCR7_CNF_MONITOR 0x0040 /* add monitor function */ +#define DLCR7_CNF_BYPASS 0x0080 /* bypass ENDEC */ +#define DLCR7_CNF_TEST 0x00c0 /* test ENDEC */ +#define DLCR7_PWRDN 0x0020 /* selects standby power mode */ +#define DLCR7_PWRDN_ON 0x0000 /* standby mode on */ +#define DLCR7_PWRDN_OFF 0x0020 /* standby mode off */ +#define DLCR7_BIT_4 0x0010 /* unused; write 1 */ +#define DLCR7_REG_BNK 0x000c /* selects register bank, 2 bits */ +#define DLCR7_REG_BNK_DLC 0x0000 /* DLC group 00 is mapped in */ +#define DLCR7_REG_BNK_HASH 0x0004 /* HASH group 01 is mapped in */ +#define DLCR7_REG_BNK_BMR 0x000c /* BMR group 10 is mapped in */ +#define DLCR7_EOP_POL 0x0002 /* selects polarity of EOP pin */ +#define DLCR7_ENDIAN 0x0001 /* selects endian mode of system bus */ +#define DLCR7_ENDIAN_LITTLE 0x0000 /* endian mode is little */ +#define DLCR7_ENDIAN_BIG 0x0001 /* endian mode is big */ + + +/* DLCR8-DLCR13 are the node ID registers when register group 00 is mapped in. + * There are no bit defines for these registers. Given an Ethernet address + * of 11:22:33:44:55:66, the following shows the relationship to these + * registers. + * dlcr8 = 0x11; + * dlcr9 = 0x22; + * ..... + * dlcr13 = 0x66; + */ + + +/* DLCR14,DLCR15 are the time domain reflectometer registers when register + * group 00 is mapped in. There are no bit defines for these registers. + * R14 holds the LSB, R15 the MSB, both are read only. + */ + + +/* BMR8 -- buffer memory port. There are no bit defines for this register. */ + +/* BMR10,11 -- transmit collision control and start command register */ + +#define BMR10_TMST 0x8000 /* transmit start command */ +#define BMR10_PKTS 0x7f00 /* number of packets to transmit */ + +#define BMR11_BIT7 0x0080 /* unused, write with 0 */ +#define BMR11_BIT6 0x0040 /* unused, write with 0 */ +#define BMR11_BIT5 0x0020 /* unused, write with 0 */ +#define BMR11_BIT4 0x0010 /* unused, write with 0 */ +#define BMR11_BIT3 0x0008 /* unused, write with 0 */ +#define BMR11_MASK16 0x0004 /* something to do with 16 colls */ +#define BMR11_RST_TX16 0x0002 /* " */ +#define BMR11_OPT_16_COLL 0x0001 /* " */ + + +/* BMR12,13 -- DMA control register */ + +#define BMR12_BIT7 0x8000 /* unused, write with 0 */ +#define BMR12_BIT6 0x4000 /* unused, write with 0 */ +#define BMR12_BIT5 0x2000 /* unused, write with 0 */ +#define BMR12_BIT4 0x1000 /* unused, write with 0 */ +#define BMR12_BIT3 0x0800 /* unused, write with 0 */ +#define BMR12_BIT2 0x0400 /* unused, write with 0 */ +#define BMR12_DMA_RENA 0x0200 /* DMA read enable */ +#define BMR12_DMA_TENA 0x0100 /* DMA write enable */ + + +/* BMR14 -- to be done */ + +/* BMR15 -- currently no function */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_fnh */ diff --git a/h/drv/netif/if_ln.h b/h/drv/netif/if_ln.h new file mode 100644 index 0000000..bb29e80 --- /dev/null +++ b/h/drv/netif/if_ln.h @@ -0,0 +1,227 @@ +/* if_ln.h - AMD LANCE Ethernet interface header */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01t,09nov01,dat Adding obsolescence warnings to outdated drivers +01s,08apr97,spm restored TMD_ERR #define needed for if_lnsgi driver +01r,26jan96,vin modified for BSD44. +01q,22jun94,dzb removed obsolete definitions. +01p,22sep92,rrr added support for c++ +01o,29jul92,rfs moved driver specific items to driver file, where they belong +01n,26may92,rrr the tree shuffle +01m,04oct91,rrr passed through the ansification filter + -changed copyright notice +01l,25jul91,jwt removed bit fields (added masks) for portability. +01k,18may91,gae reworked lncsr_3b register for Radstone's APEX driver, + and potentially more portable code. +01j,05oct90,shl added copyright notice. + made #endif ANSI style. +01i,07may90,hjb added LN_RMD_RLEN, LN_TMD_TLEN, LN_NUM_RESERVES definitions; + added bufSize, canLoanRmds, freeBufs, nFree and deleted + numOutStandingLoans, loanStats from struct ls_softc. +01h,19apr90,hjb added LN_MIN_FIRST_DATA_CHAIN, LN_MAX_MDS, RMD_ERR, TMD_OWN, + TMD_ERR, TMD_BUFF, TMD_UFLO, TMD_LCAR, ls_flags, + loanRefCnt, loanStats, LS_PROMISCUOUS_FLAG, + LS_MEM_ALLOC_FLAG, LS_PAD_USED_FLAG, + LS_RCV_HANDLING_FLAG, LS_START_OUTPUT_FLAG; + deleted xmitHandlingAtTaskLevel, recvHandlingTaskLevel. +01g,18mar90,hjb added padEnable boolean variable in ls_softc structure. +01f,10nov89,dab added padding to CSR structure for Tadpole lance driver. +01e,02nov89,shl fixed syntax error. +01d,24may89,jcf added recvHandlingAtTaskLevel to ls_softc structure. +01c,21apr89,jcf added memBase, csr0Errs, and xmitHandlingAtTaskLevel + +dnw to ls_softc structure. +01b,09aug88,gae bumped up LN_BUFSIZE to solve large packet problems. +01a,15apr88,dfm written. +*/ + +#ifndef __INCif_lnh +#define __INCif_lnh + +#warning "if_ln driver is obsolete, please use ln7990End driver" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Control block definitions for AMD LANCE (Ethernet) chip. + * This has some of the same (mis)features as the Intel 82586 with + * regards to byte ordering. It assumes that a memory address specifies + * the location of the least significant byte of a multi-byte value. This + * is correct for most Intel & DEC processors, but is wrong for 680x0s. + * As a result, all addresses specified to the chip must have their + * words swapped. At least it has a control bit to automatically swap + * bytes during data transfer dma. (The 82586 is much worse.) + */ + +/* + * Control and Status Register access structure + * WARNING: bit operations should not be done on CSR0! + * Many of the bits are Read/Clear and will be cleared by any other + * bit operation on the register. Note especially that if the + * stop bit is set, all other operations will retain the stopped + * condition. This means that a bit set to do init and start will + * always fail because stop has priority. + */ + +typedef struct + { + /* This union describes a plethora of ways to access the data register */ + union + { + u_short RDP; + u_short lnCSR0; /* RDP if (RAP==0) */ + u_short lnCSR1; /* RDP if (RAP==1) */ + u_short iadr_l; /* Init Block addr bits 15:00 */ + + u_short lnCSR2; /* RDP if (RAP==2) */ + u_short iadr_h; /* Init Block addr bits 23:16 */ + + u_short lnCSR3; /* RDP if (RAP==3) */ + u_short ln_csr3b; + + } ln_csr; + + u_short RAP; + u_short pad; /* XXX Tadpole padding */ + } LN_DEVICE; + +/* Definitions for fields and bits in the LN_DEVICE */ + +#define lncsr_ERR 0x8000 /* (RO) error flag (BABL|CERR|MISS|MERR) */ +#define lncsr_BABL 0x4000 /* (RC) babble transmitter timeout */ +#define lncsr_CERR 0x2000 /* (RC) collision error */ +#define lncsr_MISS 0x1000 /* (RC) missed packet */ +#define lncsr_MERR 0x0800 /* (RC) memory error */ +#define lncsr_RINT 0x0400 /* (RC) receiver interrupt */ +#define lncsr_TINT 0x0200 /* (RC) transmitter interrupt */ +#define lncsr_IDON 0x0100 /* (RC) initialization done */ +#define lncsr_INTR 0x0080 /* (RO) interrupt flag */ +#define lncsr_INEA 0x0040 /* (RW) interrupt enable */ +#define lncsr_RXON 0x0020 /* (RO) receiver on */ +#define lncsr_TXON 0x0010 /* (RO) transmitter on */ +#define lncsr_TDMD 0x0008 /* (WOO)transmit demand */ +#define lncsr_STOP 0x0004 /* (WOO)stop (& reset) chip */ +#define lncsr_STRT 0x0002 /* (RW) start chip */ +#define lncsr_INIT 0x0001 /* (RW) initialize (acces init block) */ + +#define lncsr3_BSWP 0x0004 /* Byte Swap */ +#define lncsr3_ACON 0x0002 /* ALE Control */ +#define lncsr3_BCON 0x0001 /* Byte Control */ + +#define lncsr_0 ln_csr.lnCSR0 +#define lncsr_iadr_l ln_csr.iadr_l +#define lncsr_iadr_h ln_csr.iadr_h + +#define lncsr_INTMASK (lncsr_BABL \ + | lncsr_CERR \ + | lncsr_MISS \ + | lncsr_MERR \ + | lncsr_RINT \ + | lncsr_TINT \ + | lncsr_IDON \ + | lncsr_INEA) +/* + * Initialization Block. + * Specifies addresses of receive and transmit descriptor rings. + */ + +typedef struct lnIB + { + u_short lnIBMode; /* mode register */ + char lnIBPadr [6]; /* PADR: byte swapped ethernet physical addr */ + /* LADRF: logical address filter */ + u_short lnIBLadrfLow; /* least significant word */ + u_short lnIBLadrfMidLow; /* low middle word */ + u_short lnIBLadrfMidHigh; /* high middle word */ + u_short lnIBLadrfHigh; /* most significant word */ + /* RDRA: read ring address */ + u_short lnIBRdraLow; /* low word */ + u_short lnIBRdraHigh; /* high word */ + /* TDRA: transmit ring address */ + u_short lnIBTdraLow; /* low word */ + u_short lnIBTdraHigh; /* high word */ + } ln_ib; + +/* + * Receive Message Descriptor Entry. + * Four words per entry. Number of entries must be a power of two. + */ + +typedef struct lnRMD + { + u_short lnRMD0; /* bits 15:00 of receive buf */ + u_short lnRMD1; /* bits 23:16 of receive buf and status */ + u_short lnRMD2; /* buffer byte count (negative) */ + u_short lnRMD3; /* message byte count */ + } ln_rmd; + +#define lnrmd1_OWN 0x8000 /* Own */ +#define lnrmd1_ERR 0x4000 /* Error */ +#define lnrmd1_FRAM 0x2000 /* Framming Error */ +#define lnrmd1_OFLO 0x1000 /* Overflow */ +#define lnrmd1_CRC 0x0800 /* CRC */ +#define lnrmd1_BUFF 0x0400 /* Buffer Error */ +#define lnrmd1_STP 0x0200 /* Start of Packet */ +#define lnrmd1_ENP 0x0100 /* End of Packet */ +#define lnrmd1_HADR 0x00FF /* High Address */ + +#define RMD_ERR 0x6000 + +#define rbuf_ladr lnRMD0 +#define rbuf_hadr lnRMD1 +#define rbuf_stat lnRMD1 +#define rbuf_bcnt lnRMD2 +#define rbuf_mcnt lnRMD3 + +/* + * Transmit Message Descriptor Entry. + * Four words per entry. Number of entries must be a power of two. + */ + +typedef struct lnTMD + { + u_short lnTMD0; /* bits 15:00 of transmit buf */ + u_short lnTMD1; /* bits 23:16 of transmit buf and status */ + u_short lnTMD2; /* message byte count */ + u_short lnTMD3; /* errors */ + } ln_tmd; + +#define lntmd1_OWN 0x8000 /* Own */ +#define lntmd1_ERR 0x4000 /* Error */ +#define lntmd1_MORE 0x1000 /* More than One Retry */ +#define lntmd1_ONE 0x0800 /* One Retry */ +#define lntmd1_DEF 0x0400 /* Deferred */ +#define lntmd1_STP 0x0200 /* Start of Packet */ +#define lntmd1_ENP 0x0100 /* End of Packet */ +#define lntmd1_HADR 0x00FF /* High Address */ + +#define lntmd3_BUFF 0x8000 /* Buffer Error */ +#define lntmd3_UFLO 0x4000 /* Underflow Error */ +#define lntmd3_LCOL 0x1000 /* Late Collision */ +#define lntmd3_LCAR 0x0800 /* Lost Carrier */ +#define lntmd3_RTRY 0x0400 /* Retry Error */ +#define lntmd3_TDR 0x03FF /* Time Domain Reflectometry */ + +#define TMD_OWN 0x8000 +#define TMD_ERR 0x6000 + +#define TMD_BUFF 0x8000 +#define TMD_UFLO 0x4000 +#define TMD_LCAR 0x0800 + +#define tbuf_ladr lnTMD0 +#define tbuf_hadr lnTMD1 +#define tbuf_stat lnTMD1 +#define tbuf_bcnt lnTMD2 +#define tbuf_err lnTMD3 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_lnh */ diff --git a/h/drv/netif/if_lnPci.h b/h/drv/netif/if_lnPci.h new file mode 100644 index 0000000..7fb9cce --- /dev/null +++ b/h/drv/netif/if_lnPci.h @@ -0,0 +1,196 @@ +/* if_lnPci.h - AMD LANCE 79C970 Ethernet interface header */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,09nov01,dat Adding obsolescence warnings to outdated drivers +01a,11Jan95,vin written from version 01p of if_ln.h. +*/ + +/* +DESCRIPTION +----------- +Pci Bus is inherently little endian. So if a big endian processor is +interfaced with the PCI bus all the values programmed to the registers +on the PCI bus should be swapped. +*/ + +#ifndef __INCif_lnPcih +#define __INCif_lnPcih + +#warning "if_lnPci driver is obsolete, please use ln97xEnd driver" + +#ifdef __cplusplus +extern "C" { +#endif + +#if (_BYTE_ORDER == _BIG_ENDIAN) + +#define PCISWAP(x) LONGSWAP(x) /* processor big endian */ + +#else + +#define PCISWAP(x) (x) /* processor little endian */ + +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + +/* + * Control and Status Register access structure + * WARNING: bit operations should not be done on CSR0! + * Many of the bits are Read/Clear and will be cleared by any other + * bit operation on the register. Note especially that if the + * stop bit is set, all other operations will retain the stopped + * condition. This means that a bit set to do init and start will + * always fail because stop has priority. + */ +typedef struct + { + ULONG rdp; /* register data Port */ + ULONG rap; /* Register Address Port */ + ULONG rr; /* Reset Register */ + ULONG bdp; /* Bus Configuration Register Data Port */ + } LN_DEVICE; + +/* + * Initialization Block. + * Specifies addresses of receive and transmit descriptor rings. + */ +typedef struct lnIB + { + ULONG lnIBMode; /* mode register */ + char lnIBPadr [8]; /* PADR: bswapd ethnt phys address */ + /* LADRF: logical address filter */ + ULONG lnIBLadrfLow; /* least significant long word */ + ULONG lnIBLadrfHigh; /* most significant long word */ + /* RDRA: read ring address */ + ULONG lnIBRdra; /* long word */ + /* TDRA: transmit ring address */ + ULONG lnIBTdra; /* long word */ + } ln_ib; + +/* + * Receive Message Descriptor Entry. + * Four words per entry. Number of entries must be a power of two. + */ +typedef struct lnRMD + { + ULONG lnRMD0; /* bits 31:00 of receive buffer address */ + ULONG lnRMD1; /* status & buffer byte count (negative) */ + ULONG lnRMD2; /* message byte count */ + ULONG lnRMD3; /* reserved */ + } ln_rmd; + +/* + * Transmit Message Descriptor Entry. + * Four words per entry. Number of entries must be a power of two. + */ +typedef struct lnTMD + { + ULONG lnTMD0; /* bits 31:00 of transmit buffer address */ + ULONG lnTMD1; /* message byte count */ + ULONG lnTMD2; /* errors */ + ULONG lnTMD3; /* reserved */ + } ln_tmd; + +/* csr and bcr addresses */ + +#define CSR(x) (x) +#define BCR(x) (x) + +/* Definitions for fields and bits in the LN_DEVICE */ + +#define CSR0_ERR 0x8000 /* (RO) err flg (BABL|CERR|MISS|MERR) */ +#define CSR0_BABL 0x4000 /* (RC) babble transmitter timeout */ +#define CSR0_CERR 0x2000 /* (RC) collision error */ +#define CSR0_MISS 0x1000 /* (RC) missed packet */ +#define CSR0_MERR 0x0800 /* (RC) memory error */ +#define CSR0_RINT 0x0400 /* (RC) receiver interrupt */ +#define CSR0_TINT 0x0200 /* (RC) transmitter interrupt */ +#define CSR0_IDON 0x0100 /* (RC) initialization done */ +#define CSR0_INTR 0x0080 /* (RO) interrupt flag */ +#define CSR0_INEA 0x0040 /* (RW) interrupt enable */ +#define CSR0_RXON 0x0020 /* (RO) receiver on */ +#define CSR0_TXON 0x0010 /* (RO) transmitter on */ +#define CSR0_TDMD 0x0008 /* (WOO)transmit demand */ +#define CSR0_STOP 0x0004 /* (WOO)stop (& reset) chip */ +#define CSR0_STRT 0x0002 /* (RW) start chip */ +#define CSR0_INIT 0x0001 /* (RW) initialize (acces init block) */ + +#define CSR0_INTMASK (CSR0_BABL \ + | CSR0_CERR \ + | CSR0_MISS \ + | CSR0_MERR \ + | CSR0_RINT \ + | CSR0_TINT \ + | CSR0_IDON \ + | CSR0_INEA) + + +#define CSR3_BSWP 0x0004 /* Byte Swap */ + +#define BCR20_SSIZE32 0x0100 +#define BCR20_SWSTYLE_LANCE 0x0000 +#define BCR20_SWSTYLE_ILACC 0x0001 +#define BCR20_SWSTYLE_PCNET 0x0002 + +/* initialization block */ + +#define IB_MODE_TLEN_MSK 0xf0000000 +#define IB_MODE_RLEN_MSK 0x00f00000 + +/* receive descriptor */ + +#define RMD1_OWN 0x80000000 /* Own */ +#define RMD1_ERR 0x40000000 /* Error */ +#define RMD1_FRAM 0x20000000 /* Framming Error */ +#define RMD1_OFLO 0x10000000 /* Overflow */ +#define RMD1_CRC 0x08000000 /* CRC */ +#define RMD1_BUFF 0x04000000 /* Buffer Error */ +#define RMD1_STP 0x02000000 /* Start of Packet */ +#define RMD1_ENP 0x01000000 /* End of Packet */ +#define RMD1_RES 0x00ff0000 /* reserved */ +#define RMD1_CNST 0x0000f000 /* rmd1 constant value */ + +#define RMD1_BCNT_MSK 0x00000fff /* buffer cnt mask */ +#define RMD2_MCNT_MSK 0x00000fff /* message buffer cnt mask */ + +/* transmit descriptor */ + +#define TMD1_OWN 0x80000000 /* Own */ +#define TMD1_ERR 0x40000000 /* Error */ +#define TMD1_MORE 0x10000000 /* More than One Retry */ +#define TMD1_ONE 0x08000000 /* One Retry */ +#define TMD1_DEF 0x04000000 /* Deferred */ +#define TMD1_STP 0x02000000 /* Start of Packet */ +#define TMD1_ENP 0x01000000 /* End of Packet */ +#define TMD1_RES 0x00FF0000 /* High Address */ +#define TMD1_CNST 0x0000f000 /* tmd1 constant value */ + +#define TMD2_BUFF 0x80000000 /* Buffer Error */ +#define TMD2_UFLO 0x40000000 /* Underflow Error */ +#define TMD2_LCOL 0x10000000 /* Late Collision */ +#define TMD2_LCAR 0x08000000 /* Lost Carrier */ +#define TMD2_RTRY 0x04000000 /* Retry Error */ +#define TMD2_TDR 0x03FF0000 /* Time Domain Reflectometry */ + +#define TMD1_BCNT_MSK 0x00000fff /* buffer cnt mask */ + +#define rbuf_adr lnRMD0 +#define rbuf_rmd1 lnRMD1 +#define rbuf_mcnt lnRMD2 +#define rbuf_rmd3 lnRMD3 + +#define tbuf_adr lnTMD0 +#define tbuf_tmd1 lnTMD1 +#define tbuf_tmd2 lnTMD2 +#define tbuf_tmd3 lnTMD3 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_lnPcih */ + + diff --git a/h/drv/netif/if_mbc.h b/h/drv/netif/if_mbc.h new file mode 100644 index 0000000..7ea57d7 --- /dev/null +++ b/h/drv/netif/if_mbc.h @@ -0,0 +1,215 @@ +/* if_mbc.h - Motorola Module Bus Ethernet interface header */ + +/* Copyright 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,19apr02,rcs added obsolescence warning SPR# 76010 +01a,09may96,dzb written. +*/ + +/* +This file contains I/O addresses and related constants for the Motorola +Module Bus Ethernet controller used in the M68EN360 communications +controller. +*/ + +#ifndef __INCif_mbch +#define __INCif_mbch + +#ifdef __cplusplus +extern "C" { +#endif + +#warning "if_mbc driver is obsolete, please use mbcEnd driver" + +/* defines */ + +/* MBC - Module Bus Ethernet controller */ + +#define MBC_IFNAME "mbc" /* device interface name */ + +/* Module Bus Ethernet Controller registers */ + +#define MBC_ECNTL 0x000 /* ethernet control register */ +#define MBC_EDMA 0x002 /* DMA configuration register */ +#define MBC_EMRBLR 0x004 /* max receive buffer length */ +#define MBC_IVEC 0x006 /* interrupt vector register */ +#define MBC_IEVNT 0x008 /* interrupt event */ +#define MBC_IMASK 0x00a /* interrupt mask register */ +#define MBC_ECFG 0x00c /* configurartion register */ +#define MBC_TEST 0x00e /* test register */ +#define MBC_AR 0x010 /* address recognition control */ +#define MBC_ARTAB 0x200 /* address recognition table */ +#define MBC_EBD 0x400 /* buffer descriptors table */ + +/* Ethernet Control register definitions */ + +#define MBC_ECNTL_RES 0x0000 /* ethernet reset */ +#define MBC_ECNTL_RES_OFF 0x0001 /* ethernet reset off */ +#define MBC_ECNTL_ENBL 0x0002 /* ethernet enable */ +#define MBC_ECNTL_GTS 0x0004 /* graceful tx stop */ + +/* Ethernet DMA config/status register definitions */ + +#define MBC_EDMA_BLIM_MSK 0x0007 /* burst limit mask */ +#define MBC_EDMA_BLIM_1 0x0000 /* burst limit, 1 */ +#define MBC_EDMA_BLIM_2 0x0001 /* burst limit, 2 */ +#define MBC_EDMA_BLIM_4 0x0002 /* burst limit, 4 */ +#define MBC_EDMA_BLIM_8 0x0003 /* burst limit, 8 */ +#define MBC_EDMA_BLIM_16 0x0004 /* burst limit, 16 */ +#define MBC_EDMA_BLIM_32 0x0005 /* burst limit, 32 */ +#define MBC_EDMA_BLIM_64 0x0006 /* burst limit, 64 */ +#define MBC_EDMA_BLIM_UNL 0x0007 /* burst limit, unlimited */ +#define MBC_EDMA_WMRK_MSK 0x0018 /* fifo watermark mask */ +#define MBC_EDMA_WMRK_8 0x0000 /* fifo watermark 8 bytes */ +#define MBC_EDMA_WMRK_16 0x0008 /* fifo watermark 16 bytes */ +#define MBC_EDMA_WMRK_24 0x0010 /* fifo watermark 24 bytes */ +#define MBC_EDMA_WMRK_32 0x0018 /* fifo watermark 32 bytes */ +#define MBC_EDMA_TSRLY 0x0020 /* transmit start early */ +#define MBC_EDMA_BDS_MSK 0x00c0 /* bdsize mask */ +#define MBC_EDMA_BDS_SHFT 0x0006 /* shift cnt for bd size */ +#define MBC_EDMA_BDS_8 0x0000 /* bdsize 8tx/120rx */ +#define MBC_EDMA_BDS_16 0x0001 /* bdsize 16tx/112rx */ +#define MBC_EDMA_BDS_32 0x0002 /* bdsize 32tx/96rx */ +#define MBC_EDMA_BDS_64 0x0003 /* bdsize 64tx/64rx */ +#define MBC_EDMA_BDE_MSK 0xfe00 /* bd error # */ +#define MBC_EDMA_BDE_SHFT 0x0009 /* shift cnt for bd error # */ +#define MBC_BD_MAX 128 /* total number of buffer descriptors */ + +/* Interrupt Vector register definitions */ + +#define MBC_IVEC_MSK 0x00ff /* interrupt vector mask */ +#define MBC_IVEC_RX 0x0000 /* receive interrupt */ +#define MBC_IVEC_TX 0x0001 /* transmit interrupt */ +#define MBC_IVEC_NTC 0x0002 /* non time critical interrupt */ +#define MBC_IVEC_TC 0x0003 /* time critical interrupt */ +#define MBC_IVEC_VG 0x0100 /* vector granularity */ + +/* Interrupt Event register definitions */ + +#define MBC_IEVNT_RXB 0x0001 /* receive buffer interrupt */ +#define MBC_IEVNT_TXB 0x0002 /* transmit buffer interrupt */ +#define MBC_IEVNT_BSY 0x0004 /* busy interrupt */ +#define MBC_IEVNT_RXF 0x0008 /* receive frame interrupt */ +#define MBC_IEVNT_TXF 0x0010 /* transmit frame interrupt */ +#define MBC_IEVNT_EBE 0x0020 /* ethernet bus error */ +#define MBC_IEVNT_BOD 0x0040 /* backoff done */ +#define MBC_IEVNT_GRA 0x0080 /* graceful stop complete */ +#define MBC_IEVNT_BTE 0x0100 /* babbling transmitter error */ +#define MBC_IEVNT_BRE 0x0200 /* babbling receiver error */ +#define MBC_IEVNT_HBE 0x0400 /* heartbeat error */ + +/* Interrupt Mask register */ + +#define MBC_IMASK_RXB 0x0001 /* receive buffer interrupt */ +#define MBC_IMASK_TXB 0x0002 /* transmit buffer interrupt */ +#define MBC_IMASK_BSY 0x0004 /* busy interrupt */ +#define MBC_IMASK_RXF 0x0008 /* receive frame interrupt */ +#define MBC_IMASK_TXF 0x0010 /* transmit frame interrupt */ +#define MBC_IMASK_EBE 0x0020 /* ethernet bus error */ +#define MBC_IMASK_BOD 0x0040 /* backoff done */ +#define MBC_IMASK_GRA 0x0080 /* graceful stop complete */ +#define MBC_IMASK_BTE 0x0100 /* babbling transmitter error */ +#define MBC_IMASK_BRE 0x0200 /* babbling receiver error */ +#define MBC_IMASK_HBE 0x0400 /* heartbeat error */ + +/* Ethernet Configuration register definitions */ + +#define MBC_ECFG_LOOP 0x0001 /* internal loopback */ +#define MBC_ECFG_FDEN 0x0002 /* full duplex enable */ +#define MBC_ECFG_HBC 0x0004 /* heartbeat control */ + +/* Address Recognition register definitions */ +/* written only when ethernet controller is disabled */ + +#define MBC_AR_PROM 0x0400 /* promiscuous */ +#define MBC_AR_PAREJ 0x0800 /* phys address reject */ +#define MBC_AR_INDEX 0x4000 /* index enable */ +#define MBC_AR_MULTI_00 0x0000 /* multicast and broadcast */ +#define MBC_AR_MULTI_01 0x1000 /* multicast, but no broadcast */ +#define MBC_AR_MULTI_10 0x2000 /* all multicast and broadcast */ +#define MBC_AR_MULTI_11 0x3000 /* no multicast or broadcast */ +#define MBC_AR_HASH 0x8000 /* hash mode enable */ + +#define MBC_ARTAB_SIZE 64 /* number of entries in the AR table */ + + +/* SCC Ethernet Protocol Specific Mode Register definitions */ + +/* Receive/Transmit Buffer Descriptor */ +#ifndef _ASMLANGUAGE + +typedef struct /* MBC_BD */ + { + UINT16 statusMode; /* status and control */ + UINT16 dataLength; /* length of data buffer in bytes */ + UCHAR * dataPointer; /* points to data buffer */ + } MBC_BD; + +#endif /* _ASMLANGUAGE*/ + + +/* Receive Buffer Descriptor statusMode field definitions */ + +#define MBC_RXBD_CL 0x0001 /* collision condition */ +#define MBC_RXBD_OV 0x0002 /* overrun condition */ +#define MBC_RXBD_CR 0x0004 /* Rx CRC error */ +#define MBC_RXBD_SH 0x0008 /* short frame received */ +#define MBC_RXBD_NO 0x0010 /* Rx nonoctet aligned frame */ +#define MBC_RXBD_LG 0x0020 /* Rx frame length violation */ +#define MBC_RXBD_M 0x0100 /* miss bit for prom mode */ +#define MBC_RXBD_F 0x0400 /* buffer is first in frame */ +#define MBC_RXBD_L 0x0800 /* buffer is last in frame */ +#define MBC_RXBD_I 0x1000 /* interrupt on receive */ +#define MBC_RXBD_W 0x2000 /* last BD in ring */ +#define MBC_RXBD_E 0x8000 /* buffer is empty */ + +/* Transmit Buffer Descriptor statusMode field definitions */ + +#define MBC_TXBD_CSL 0x0001 /* carrier sense lost */ +#define MBC_TXBD_UN 0x0002 /* underrun */ +#define MBC_TXBD_RC 0x003c /* retry count */ +#define MBC_TXBD_RC_SHFT 0x0002 /* shift cnt for RC */ +#define MBC_TXBD_RL 0x0040 /* retransmission limit */ +#define MBC_TXBD_LC 0x0080 /* late collision */ +#define MBC_TXBD_HB 0x0100 /* heartbeat */ +#define MBC_TXBD_DEF 0x0200 /* defer indication */ +#define MBC_TXBD_TC 0x0400 /* auto transmit CRC */ +#define MBC_TXBD_L 0x0800 /* buffer is last in frame */ +#define MBC_TXBD_I 0x1000 /* interrupt on transmit */ +#define MBC_TXBD_W 0x2000 /* last BD in ring */ +#define MBC_TXBD_PAD 0x4000 /* auto pad short frames */ +#define MBC_TXBD_R 0x8000 /* buffer is ready */ +#define MBC_TXBD_ERRS (MBC_TXBD_DEF | MBC_TXBD_HB | \ + MBC_TXBD_LC | MBC_TXBD_RL | \ + MBC_TXBD_UN | MBC_TXBD_CSL) + + +/* typedefs */ + +#ifndef _ASMLANGUAGE + +typedef struct /* MBC_DEV */ + { + int mbcNum; /* number of MBC device */ + UINT8 bdSize; /* buffer descriptor size */ + UINT8 txBdNum; /* number of tx buf descriptors */ + UINT8 rxBdNum; /* number of rx buf descriptors */ + MBC_BD * txBdBase; /* transmit BD array address */ + MBC_BD * rxBdBase; /* receive BD array address */ + u_char * txBufBase; /* transmit buffer pool base address */ + u_char * rxBufBase; /* receive buffer pool base address */ + UINT8 txBdNext; /* next transmit BD to fill */ + UINT8 rxBdNext; /* next receive BD to read */ + volatile char * pDevBase; /* ethenet module base address */ + } MBC_DEV; + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_mbch */ diff --git a/h/drv/netif/if_nicEvb.h b/h/drv/netif/if_nicEvb.h new file mode 100644 index 0000000..174bbac --- /dev/null +++ b/h/drv/netif/if_nicEvb.h @@ -0,0 +1,238 @@ +/* if_nicEvb.h - NIC driver header (for EVB403) */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02d,09nov01,dat Adding obsolescence warnings to outdated drivers +02c,06dec96,cdp changed ARM to DCR_ARM to avoid clash with ARM arch. +02b,29jun95,caf changed name to "nicEvb". +02a,16jun95,amp modified if_nic.h for EVB403. +01j,22sep92,rrr added support for c++ +01i,26may92,rrr the tree shuffle +01h,26may92,ajm got rid of HOST_DEC def's (new compiler) + updated copyright +01g,04oct91,rrr passed through the ansification filter + -changed copyright notice +01f,28sep91,ajm ifdef'd HOST_DEC for compiler problem +01e,02Aug91,rfs simplified device struct, removed we32104 items +01d,05oct90,shl added copyright notice. + made #endif ANSI style. +01c,18sep89,cwp added multiple transmit buffer support. +01b,07sep89,dab added modification history; fixed header. +01a,12jan89,hk written. +*/ + +#ifndef __INCif_nich +#define __INCif_nich + +#warning "if_nicEvb driver is obsolete, please use nicEvbEnd driver" + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef union nic_regs +{ + u_char reg [16]; + struct + { + volatile u_char cr; + volatile u_char pstart; + volatile u_char pstop; + volatile u_char bnry; + volatile u_char tpsr; + volatile u_char tbcr0; + volatile u_char tbcr1; + volatile u_char isr; + volatile u_char rsar0; + volatile u_char rsar1; + volatile u_char rbcr0; + volatile u_char rbcr1; + volatile u_char rcr; + volatile u_char tcr; + volatile u_char dcr; + volatile u_char imr; + } nic_pg0; + struct + { + volatile u_char cr; + volatile u_char par0; + volatile u_char par1; + volatile u_char par2; + volatile u_char par3; + volatile u_char par4; + volatile u_char par5; + volatile u_char curr; + volatile u_char mar0; + volatile u_char mar1; + volatile u_char mar2; + volatile u_char mar3; + volatile u_char mar4; + volatile u_char mar5; + volatile u_char mar6; + volatile u_char mar7; + } nic_pg1; +} NIC_DEVICE; + +#define Cr nic_pg0.cr +#define Pstart nic_pg0.pstart +#define Pstop nic_pg0.pstop +#define Bnry nic_pg0.bnry +#define Tpsr nic_pg0.tpsr +#define Tsr nic_pg0.tpsr +#define Tbcr0 nic_pg0.tbcr0 +#define Tbcr1 nic_pg0.tbcr1 +#define Isr nic_pg0.isr +#define Rsar0 nic_pg0.rsar0 +#define Rsar1 nic_pg0.rsar1 +#define Rbcr0 nic_pg0.rbcr0 +#define Rbcr1 nic_pg0.rbcr1 +#define Rcr nic_pg0.rcr +#define Rsr nic_pg0.rcr +#define Tcr nic_pg0.tcr +#define Dcr nic_pg0.dcr +#define Imr nic_pg0.imr + +#define Par0 nic_pg1.par0 +#define Par1 nic_pg1.par1 +#define Par2 nic_pg1.par2 +#define Par3 nic_pg1.par3 +#define Par4 nic_pg1.par4 +#define Par5 nic_pg1.par5 +#define Curr nic_pg1.curr + +#define NIC_BASE 0xf4000000 +#define NIC_PORT 0xf4000010 +#define NIC_ACC 0xf4000030 +#define NIC_DMA 0xf4000020 + +#define NICRAM_BOT 0x8000 +#define NICRAM_TOP 0xFFFF +#define NICROM_BOT 0x0000 +#define NICROM_TOP 0x001F +#define NICROMSIZ (NICROM_TOP - NICROM_BOT) +#define NICRAMSIZ (NICRAM_TOP - NICRAM_BOT) + +#define PBMASK 0xc0 /* XXX */ +#define ACC_MASK 0x01 /* XXX */ +#define PACKET_SIZE 256 + + +#define PSTART 8 +#define PSTOP 32 +#define MAXXMT 10 +#define BNRY PSTART +#define CURR PSTART+1 +#define XMTBUF 0xe100 + +/* + * CR Register bits (SAME) + */ + +#define STP 0x1 +#define STA 0x2 +#define TXP 0x4 +#define RREAD 0x8 +#define RWRITE 0x10 +#define SPKT 0x18 +#define ABORT 0x20 +#define RPAGE0 0x00 +#define RPAGE1 0x40 +#define RPAGE2 0x80 + +/* + * ISR Register (SAME) + */ + +#define PRX 0x1 +#define PTX 0x2 +#define RXE 0x4 +#define TXE 0x8 +#define OVW 0x10 +#define CNT 0x20 +#define RDC 0x40 +#define RST 0x80 + +/* + * IMR(SAme) + */ + +#define PRXE 0x1 +#define PTXE 0x2 +#define RXEE 0x4 +#define TXEE 0x8 +#define OVWE 0x10 +#define CNTE 0x20 +#define RDCE 0x40 + +/* + * DCR + */ + +#define WTS 0x1 +#define BOS 0x2 +#define LAS 0x4 +#define NOTLS 0x8 +#define DCR_ARM 0x10 +#define FIFO2 0x00 +#define FIFO4 0x20 +#define FIFO8 0x40 +#define FIFO12 0x60 + +/* + * TCR + */ + +#define CRC 0x1 +#define MODE0 0x0 +#define MODE1 0x2 +#define MODE2 0x4 +#define MODE3 0x6 +#define ATD 0x8 +#define OFST 0x10 + +/* + * TSR + */ + +#define TPTX 0x1 +#define COL 0x4 +#define ABT 0x8 +#define CRS 0x10 +#define FU 0x20 +#define CDH 0x40 +#define OWC 0x80 + +/* + * RCR + */ + +#define SEP 0x1 +#define AR 0x2 +#define AB 0x4 +#define AM 0x8 +#define PRO 0x10 +#define MON 0x20 + +/* + * RSR + */ + +#define CRCR 0x2 +#define FAE 0x4 +#define FO 0x8 +#define MPA 0x10 +#define PHY 0x20 +#define DIS 0x40 +#define DFR 0x80 + +#define MINPKTSIZE 64 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_nich */ diff --git a/h/drv/netif/if_sm.h b/h/drv/netif/if_sm.h new file mode 100644 index 0000000..9aa6498 --- /dev/null +++ b/h/drv/netif/if_sm.h @@ -0,0 +1,74 @@ +/* if_sm.h - WRS backplane driver header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01f,22sep92,rrr added support for c++ +01e,16jun92,elh clean up. Added numLoan to smIfAttach. +01d,02jun92,elh the tree shuffle +01c,27may92,elh Incorperated the changes caused from restructuring the + shared memory libraries. +01b,10apr92,elh added masterAddr to store master address. +01a,17nov90,elh written. +*/ + +#ifndef __INCif_smh +#define __INCif_smh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "smPktLib.h" + +/* defines */ + +#define xs_if xs_ac.ac_if /* interface structure */ +#define xs_enaddr xs_ac.ac_enaddr /* ethernet address */ + +#define smIfInputCount(xs, cpu) \ + (xs)->smPktDesc.cpuLocalAdrs [(cpu)].inputList.count + +/* typedefs */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct sm_softc + { + struct arpcom xs_ac; /* common ethernet structure*/ + SM_PKT_DESC smPktDesc; /* shared mem packet desc */ + int taskRecvActive; /* recv task active */ + u_long masterAddr; /* master address */ + int bufFree; /* buffer loaning info */ + } SM_SOFTC; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* function prototypes */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS smIfAttach (int unit, SM_ANCHOR * pAnchor, int maxInputPkts, + int intType, int intArg1, int intArg2, int intArg3, + int ticksPerBeat, int numLoan); +extern void smIfInput (SM_SOFTC * xs); +extern void smIfLoanReturn (SM_SOFTC * xs, SM_PKT * pPkt); + +#else + +extern STATUS smIfAttach (); +extern void smIfInput (); +extern void smIfLoanReturn (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_smh */ diff --git a/h/drv/netif/if_sn.h b/h/drv/netif/if_sn.h new file mode 100644 index 0000000..537fe52 --- /dev/null +++ b/h/drv/netif/if_sn.h @@ -0,0 +1,337 @@ +/* if_sn.h - structures and defines for the DP83932B SONIC device */ + +/* Copyright 1991-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,09nov01,dat Adding obsolescence warnings to outdated drivers +01h,18oct93,cd added extra field to TX_DESC to hold associated mbuf, + defined EXBUS, added timer support. +01g,22sep92,rrr added support for c++ +01f,04jun92,ajm defined appropriate regs volatile +01e,26may92,rrr the tree shuffle +01d,03feb92,rfs minor changes to TX_DESC, moved tunables out to driver +01c,08nov91,rfs adapted from Ironics stuff +01b,29jul91,kjl cleanup in preparation for release +01a,25mar91,kjl adapted from if_ln.h 01j,05oct90,shl +*/ + +#ifndef __INCif_snh +#define __INCif_snh + +#ifdef __cplusplus +extern "C" { +#endif + +#warning "if_sn driver is obsolete, please use sn83932End instead" + +/* DATA STRUCTURES */ + +typedef struct rra_desc /* Receive Resource Descriptor */ + { + unsigned long buff_ptr0; + unsigned long buff_ptr1; + unsigned long buff_wc0; + unsigned long buff_wc1; + } RRA_DESC; +#define RRA_DESC_SIZ sizeof(RRA_DESC) + +/* define NUM_RRA_DESC in the driver source file */ +#define RRA_SIZE (NUM_RRA_DESC * RRA_DESC_SIZ) /* size of area */ + +typedef struct Rx_desc /* Receive Descriptor */ + { + unsigned long status; + unsigned long byte_count; + unsigned long pkt_ptr0; + unsigned long pkt_ptr1; + unsigned long seq_no; + struct Rx_desc *link; + unsigned long in_use; + } RX_DESC; +#define RX_DESC_SIZ sizeof(RX_DESC) + +/* define NUM_RX_DESC in the driver source file */ +#define RDA_SIZE (NUM_RX_DESC * RX_DESC_SIZ) /* Total Bytes */ + +/* values for in_use field */ +#define IN_USE (0) +#define NOT_IN_USE (1) + +/* end-of-list marker for link field */ +#define RX_EOL (RX_DESC *)(1) + +#define CAM_COUNT (16) +#define CAM_SIZE (((CAM_COUNT * 4) * 4) + 4) + +typedef struct Tx_desc /* Transmit Descriptor */ + { + unsigned long status; + unsigned long config; + unsigned long pkt_size; + unsigned long frag_count; +#ifdef MAX_TX_FRAGS + struct frag_desc + { + unsigned long frag_ptr0; + unsigned long frag_ptr1; + unsigned long frag_size; + } frag [MAX_TX_FRAGS]; /* define MAX_TX_FRAGS in driver source file */ +#endif + struct Tx_desc *pLink; /* OUR real link ptr */ + unsigned long flag; /* OUR state flags */ + struct mbuf *pMbuf; /* OUR mbuf associated with descriptor */ + } TX_DESC; +#define TX_DESC_SIZ sizeof(TX_DESC) + +/* define NUM_TX_DESC in the driver source file */ +#define TDA_SIZE (NUM_TX_DESC * TX_DESC_SIZ) + +/* end-of-list marker for link field */ +#define TX_EOL (1) + +/* SONIC registers, defined as data structure */ + +typedef struct sonic + { + volatile unsigned long cr; + volatile unsigned long dcr; + volatile unsigned long rcr; + volatile unsigned long tcr; + volatile unsigned long imr; + volatile unsigned long isr; + volatile unsigned long utda; + volatile unsigned long ctda; + volatile unsigned long fill_20; + volatile unsigned long fill_24; + volatile unsigned long fill_28; + volatile unsigned long fill_2c; + volatile unsigned long fill_30; + volatile unsigned long urda; + volatile unsigned long crda; + volatile unsigned long fill_3c; + volatile unsigned long fill_40; + volatile unsigned long fill_44; + volatile unsigned long fill_48; + volatile unsigned long eobc; + volatile unsigned long urra; + volatile unsigned long rsa; + volatile unsigned long rea; + volatile unsigned long rrp; + volatile unsigned long rwp; + volatile unsigned long fill_64; + volatile unsigned long fill_68; + volatile unsigned long fill_6c; + volatile unsigned long fill_70; + volatile unsigned long fill_74; + volatile unsigned long fill_78; + volatile unsigned long fill_7c; + volatile unsigned long fill_80; + volatile unsigned long cep; + volatile unsigned long cap2; + volatile unsigned long cap1; + volatile unsigned long cap0; + volatile unsigned long ce; + volatile unsigned long cdp; + volatile unsigned long cdc; + volatile unsigned long sr; + volatile unsigned long wt0; + volatile unsigned long wt1; + volatile unsigned long rsc; + volatile unsigned long fill_b0; + volatile unsigned long fill_b4; + volatile unsigned long fill_b8; + volatile unsigned long fill_bc; + volatile unsigned long fill_c0; + volatile unsigned long fill_c4; + volatile unsigned long fill_c8; + volatile unsigned long fill_cc; + volatile unsigned long fill_d0; + volatile unsigned long fill_d4; + volatile unsigned long fill_d8; + volatile unsigned long fill_dc; + volatile unsigned long fill_e0; + volatile unsigned long fill_e4; + volatile unsigned long fill_e8; + volatile unsigned long fill_ec; + volatile unsigned long fill_f0; + volatile unsigned long fill_f4; + volatile unsigned long fill_f8; + volatile unsigned long dcr2; + } SONIC; +#define SONIC_SIZ sizeof(SONIC) + + +/* SONIC registers, defined as direct ptrs. The constant SONIC_BASE_ADDR + * should be defined elsewhere; in board specific header file. + * These defines are NOT used in the VxWorks SONIC driver, but are left + * here for reference. + */ + +#if 0 +#define SONIC_CR (volatile unsigned long *) (SONIC_BASE_ADDR + 0x00) +#define SONIC_DCR (volatile unsigned long *) (SONIC_BASE_ADDR + 0x04) +#define SONIC_RCR (volatile unsigned long *) (SONIC_BASE_ADDR + 0x08) +#define SONIC_TCR (volatile unsigned long *) (SONIC_BASE_ADDR + 0x0c) +#define SONIC_IMR (volatile unsigned long *) (SONIC_BASE_ADDR + 0x10) +#define SONIC_ISR (volatile unsigned long *) (SONIC_BASE_ADDR + 0x14) +#define SONIC_UTDA (volatile unsigned long *) (SONIC_BASE_ADDR + 0x18) +#define SONIC_CTDA (volatile unsigned long *) (SONIC_BASE_ADDR + 0x1c) + +#define SONIC_URDA (volatile unsigned long *) (SONIC_BASE_ADDR + 0x34) +#define SONIC_CRDA (volatile unsigned long *) (SONIC_BASE_ADDR + 0x38) +#define SONIC_EOBC (volatile unsigned long *) (SONIC_BASE_ADDR + 0x4c) +#define SONIC_URRA (volatile unsigned long *) (SONIC_BASE_ADDR + 0x50) +#define SONIC_RSA (volatile unsigned long *) (SONIC_BASE_ADDR + 0x54) +#define SONIC_REA (volatile unsigned long *) (SONIC_BASE_ADDR + 0x58) +#define SONIC_RRP (volatile unsigned long *) (SONIC_BASE_ADDR + 0x5c) +#define SONIC_RWP (volatile unsigned long *) (SONIC_BASE_ADDR + 0x60) +#define SONIC_CEP (volatile unsigned long *) (SONIC_BASE_ADDR + 0x84) +#define SONIC_CAP2 (volatile unsigned long *) (SONIC_BASE_ADDR + 0x88) +#define SONIC_CAP1 (volatile unsigned long *) (SONIC_BASE_ADDR + 0x8c) +#define SONIC_CAP0 (volatile unsigned long *) (SONIC_BASE_ADDR + 0x90) +#define SONIC_CE (volatile unsigned long *) (SONIC_BASE_ADDR + 0x94) +#define SONIC_CDP (volatile unsigned long *) (SONIC_BASE_ADDR + 0x98) +#define SONIC_CDC (volatile unsigned long *) (SONIC_BASE_ADDR + 0x9c) +#define SONIC_RSC (volatile unsigned long *) (SONIC_BASE_ADDR + 0xac) +#define SONIC_SR (volatile unsigned long *) (SONIC_BASE_ADDR + 0xa0) +#define SONIC_WT0 (volatile unsigned long *) (SONIC_BASE_ADDR + 0xa4) +#define SONIC_WT1 (volatile unsigned long *) (SONIC_BASE_ADDR + 0xa8) +#define SONIC_CRCT (volatile unsigned long *) (SONIC_BASE_ADDR + 0xb0) +#define SONIC_FAET (volatile unsigned long *) (SONIC_BASE_ADDR + 0xb4) +#define SONIC_MPT (volatile unsigned long *) (SONIC_BASE_ADDR + 0xb8) + +#define SONIC_CRBA0 (volatile unsigned long *) (SONIC_BASE_ADDR + 0x3c) +#define SONIC_CRBA1 (volatile unsigned long *) (SONIC_BASE_ADDR + 0x40) +#define SONIC_RBWC0 (volatile unsigned long *) (SONIC_BASE_ADDR + 0x44) +#define SONIC_RBWC1 (volatile unsigned long *) (SONIC_BASE_ADDR + 0x48) + +#define SONIC_TPS (volatile unsigned long *) (SONIC_BASE_ADDR + 0x20) +#define SONIC_TFC (volatile unsigned long *) (SONIC_BASE_ADDR + 0x24) +#define SONIC_TSA0 (volatile unsigned long *) (SONIC_BASE_ADDR + 0x28) +#define SONIC_TSA1 (volatile unsigned long *) (SONIC_BASE_ADDR + 0x2c) +#define SONIC_TFS (volatile unsigned long *) (SONIC_BASE_ADDR + 0x30) +#define SONIC_TTDA (volatile unsigned long *) (SONIC_BASE_ADDR + 0x80) +#endif + +/* miscellaneous stuff */ +#define LMASK (0xffff0000) +#define UMASK (0x0000ffff) + +/* Command Register Commands */ +#define LCAM (0x0200) /* Load CAM */ +#define RRRA (0x0100) /* Read RRA */ +#define RST (0x0080) /* Software Reset */ +#define RST_OFF (0x0000) /* Software Reset Off */ +#define ST (0x0020) /* Start Timer */ +#define STP (0x0010) /* Stop Timer */ +#define RXEN (0x0008) /* Receiver Enable */ +#define RXDIS (0x0004) /* Receiver Disable */ +#define TXP (0x0002) /* Transmit Packet */ +#define HTX (0x0001) /* Halt Transmission */ + +/* Data Configuration Register */ +#define EXBUS (0x8000) /* Extended Bus Mode (BVF) */ +#define LBR (0x2000) /* Latched Mode */ +#define PO1 (0x1000) /* Programmable Output 1 */ +#define PO0 (0x0800) /* Programmable Output 0 */ +#define STERM (0x0400) /* Synchronous Transmission */ +#define USR1 (0x0200) /* User Definable Pin 1 */ +#define USR0 (0x0100) /* User Definable Pin 0 */ +#define WC1 (0x0080) /* Wait State Control 1 */ +#define WC0 (0x0040) /* Wait State Control 0 */ +#define WAIT0 (0) /* 0 Wait state */ +#define WAIT1 (WC0) /* 1 Wait state */ +#define WAIT2 (WC1) /* 2 Wait state */ +#define WAIT3 (WC1 | WC0) /* 3 Wait state */ +#define DW (0x0020) /* Data Width Control */ +#define DW_32 (0x0020) /* Data Width 32 bits */ +#define DW_16 (0x0000) /* Data Width 16 bits */ +#define BMS (0x0010) /* Block Mode Select for DMA */ +#define RFT1 (0x0008) /* Receive FIFO threshold 1 */ +#define RFT0 (0x0004) /* Receive FIFO threshold 0 */ +#define TFT1 (0x0002) /* Transmit FIFO Threshold 1 */ +#define TFT0 (0x0001) /* Transmit FIFO Threshold 0 */ + +/* Receive Control Register */ +#define ERR (0x8000) /* Accept packets with errors */ +#define RNT (0x4000) /* Accept Runt packets */ +#define BRD (0x2000) /* Accept broadcast packets */ +#define PRO (0x1000) /* Physical Promiscuous packets */ +#define AMC (0x0800) /* Accept all multicast packets */ +#define LB1 (0x0400) /* Loopback bit 1 */ +#define LB0 (0x0200) /* Loopback bit 0 */ +#define NO_LB (0x0000) /* No Loopback */ +#define MAC_LB (0x0200) /* MAC loopback */ +#define ENDEC_LB (0x0400) /* ENDEC loopback */ +#define XCVR_LB (0x0600) /* Tranceiver loopback */ +#define MC (0x0100) /* Multicast packet received */ +#define BC (0x0080) /* Broadcast packet received */ +#define LPKT (0x0040) /* Last packet in RBA */ +#define CRS (0x0020) /* Carrier Sense Activity */ +#define COL (0x0010) /* Collision activity */ +#define CRCR (0x0008) /* CRC Error */ +#define FAER (0x0004) /* Frame alignment error */ +#define LBK (0x0002) /* Loopback packet revceived */ +#define PRX (0x0001) /* Packet received OK */ + +/* Transmit Control Register */ +#define PINT (0x8000) /* Programmable Interrupt */ +#define POWC (0x4000) /* Programmed out of window collision timer */ +#define CRCI (0x2000) /* CRC Inhibit */ +#define EXDIS (0x1000) /* Disable Excessive Deferal Timer */ +#define EXD (0x0400) /* Excessive Deferal */ +#define DEF (0x0200) /* Defered transmission */ +#define NCRS (0x0100) /* No CRS */ +#define CRSL (0x0080) /* CRS Lost */ +#define EXC (0x0040) /* Excessive Collisions */ +#define OWC (0x0020) /* Out of window collision */ +#define PMB (0x0008) /* Packet monitored bad */ +#define FU (0x0004) /* FIFO underrun */ +#define BCM (0x0002) /* Byte count mismatch */ +#define PTX (0x0001) /* Packet transmitted OK */ + +/* Interrupt Mask Register */ +#define BREN (0x4000) /* Bus Retry Occured Enable */ +#define HBLEN (0x2000) /* Heartbeat lost Enable */ +#define LCDEN (0x1000) /* Load Cam Done Interrupt Enable */ +#define PINTEN (0x0800) /* Programmable Interrupt Enable */ +#define PRXEN (0x0400) /* Packet Received Enable */ +#define PTXEN (0x0200) /* Packet Transmitted OK Enable */ +#define TXEREN (0x0100) /* Transmit Error Enable */ +#define TCEN (0x0080) /* Timer Complete Enable */ +#define RDEEN (0x0040) /* Receive Discriptors Enable */ +#define RBEEN (0x0020) /* Receive Buffers Exhausted Enable */ +#define RBAEEN (0x0010) /* Receive Buffer Area Exceeded Enable */ +#define CRCEN (0x0008) /* CRC Tally counter warning Enable */ +#define FAEEN (0x0004) /* FAE Tally counter warning Enable */ +#define MPEN (0x0002) /* MP Tally counter warning Enable */ +#define RFOEN (0x0001) /* Receive FIFO Overrun Enable */ + +/* Interrupt Status Register */ +#define CLEAR_ISR (0xffff) /* Clear all status */ +#define BR (0x4000) /* Bus Retry Occured */ +#define HBL (0x2000) /* Heartbeat lost */ +#define LCD (0x1000) /* Load Cam Done Interrupt */ +#define PINTS (0x0800) /* Programmable Interrupt Status */ +#define PKTRX (0x0400) /* Packet Received */ +#define TXDN (0x0200) /* Transmition Done */ +#define TXER (0x0100) /* Transmit Error */ +#define TC (0x0080) /* Timer Complete */ +#define RDE (0x0040) /* Receive Discriptors */ +#define RBE (0x0020) /* Receive Buffers Exhausted */ +#define RBAE (0x0010) /* Receive Buffer Area Exceeded */ +#define CRC (0x0008) /* CRC Tally counter warning */ +#define FAE (0x0004) /* FAE Tally counter warning */ +#define MP (0x0002) /* MP Tally counter warning */ +#define RFO (0x0001) /* Receive FIFO Overrun */ + +/* End of Buffer Count Register */ +#define MAX_PACKET_SIZE (0x02f8) /* 760 words */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_snh */ diff --git a/h/drv/netif/if_ultra.h b/h/drv/netif/if_ultra.h new file mode 100644 index 0000000..79a8b6b --- /dev/null +++ b/h/drv/netif/if_ultra.h @@ -0,0 +1,278 @@ +/* if_ultra.h - SMC Elite Ultra network interface header */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,09nov01,dat Adding obsolescence warnings to outdated drivers +01b,30sep94,hdn changed TSTART to TSTART[01] for two TX buffer. +01a,30oct93,hdn written. +*/ + + +#ifndef __INCif_ultrah +#define __INCif_ultrah + +#warning "if_ultra driver is obsolete, please use ultraEnd driver" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ULTRA_RAMSIZE 0x4000 /* 16 Kbytes */ +#define ULTRA_TSTART0 0x00 +#define ULTRA_TSTART1 0x08 +#define ULTRA_PSTART 0x10 +#define ULTRA_PSTOP 0x40 +#define ULTRA_MIN_SIZE ETHERMIN /* 46 */ +#define ULTRA_MAX_SIZE 4096 /* 802.3 10base5 */ + +typedef struct + { + UCHAR rstat; + UCHAR next; + UCHAR lowByteCnt; + UCHAR uppByteCnt; + } ULTRA_HEADER; + +typedef struct + { +#define collisions stat[0] +#define crcs stat[1] +#define aligns stat[2] +#define missed stat[3] +#define overruns stat[4] +#define disabled stat[5] +#define deferring stat[6] +#define underruns stat[7] +#define aborts stat[8] +#define outofwindow stat[9] +#define heartbeats stat[10] +#define badPacket stat[11] +#define shortPacket stat[12] +#define longPacket stat[13] +#define tnoerror stat[14] +#define rnoerror stat[15] +#define terror stat[16] +#define rerror stat[17] +#define overwrite stat[18] +#define wrapped stat[19] +#define interrupts stat[20] +#define reset stat[21] +#define strayint stat[22] + UINT stat[23]; + } ULTRA_STAT; + +typedef struct + { + struct arpcom es_ac; +#define es_if es_ac.ac_if +#define es_enaddr es_ac.ac_enaddr + USHORT ioAddr; + UINT memAddr; + UINT memSize; + int intLevel; + int intVec; + int config; + UINT transmitPage[2]; + UINT transmitCnt; + ULTRA_STAT stat; + UCHAR next; + UCHAR uppByteCnt; + UCHAR current; + UCHAR istat; + UCHAR tstat; + UCHAR rstat; + UCHAR receiveBuf[ULTRA_MAX_SIZE]; + int flags; + } ULTRA_SOFTC; + +typedef struct + { + char irq; + char reg; + } IRQ_TABLE; + +#define CAST + +/* SMC Elite Ultra */ + +#define ULTRA_REG_ADDR_INTERVAL 1 +#define ULTRA_ADRS(base,reg) (CAST (base+(reg*ULTRA_REG_ADDR_INTERVAL))) + +#define CTRL_CON(base) ULTRA_ADRS(base,0x00) /* Control */ +#define CTRL_EEROM(base) ULTRA_ADRS(base,0x01) /* EEROM */ +#define CTRL_HARD(base) ULTRA_ADRS(base,0x04) /* Hardware */ +#define CTRL_BIOS(base) ULTRA_ADRS(base,0x05) /* BIOS page */ +#define CTRL_INT(base) ULTRA_ADRS(base,0x06) /* Interrupt control */ +#define CTRL_REV(base) ULTRA_ADRS(base,0x07) /* Revision */ +#define CTRL_LAN0(base) ULTRA_ADRS(base,0x08) /* SWH=0 LAN address */ +#define CTRL_LAN1(base) ULTRA_ADRS(base,0x09) /* SWH=0 LAN address */ +#define CTRL_LAN2(base) ULTRA_ADRS(base,0x0a) /* SWH=0 LAN address */ +#define CTRL_LAN3(base) ULTRA_ADRS(base,0x0b) /* SWH=0 LAN address */ +#define CTRL_LAN4(base) ULTRA_ADRS(base,0x0c) /* SWH=0 LAN address */ +#define CTRL_LAN5(base) ULTRA_ADRS(base,0x0d) /* SWH=0 LAN address */ +#define CTRL_BDID(base) ULTRA_ADRS(base,0x0e) /* SWH=0 Board ID */ +#define CTRL_CKSM(base) ULTRA_ADRS(base,0x0f) /* SWH=0 Checksum */ + +#define CTRL_PIDL(base) ULTRA_ADRS(base,0x08) /* SWH=1 POS ID */ +#define CTRL_PIDH(base) ULTRA_ADRS(base,0x09) /* SWH=1 POS ID */ +#define CTRL_IOADDR(base) ULTRA_ADRS(base,0x0a) /* SWH=1 IO address */ +#define CTRL_MEMADDR(base) ULTRA_ADRS(base,0x0b) /* SWH=1 MEM address */ +#define CTRL_BIO(base) ULTRA_ADRS(base,0x0c) /* SWH=1 BIOS base */ +#define CTRL_GCON(base) ULTRA_ADRS(base,0x0d) /* SWH=1 Gen control */ + +/* page-0, read */ + +#define LAN_CMD(base) ULTRA_ADRS(base,0x10) /* command */ +#define LAN_BOUND(base) ULTRA_ADRS(base,0x13) /* boundary page */ +#define LAN_TSTAT(base) ULTRA_ADRS(base,0x14) /* transmit status */ +#define LAN_COLCNT(base) ULTRA_ADRS(base,0x15) /* collision error */ +#define LAN_INTSTAT(base) ULTRA_ADRS(base,0x17) /* interrupt status */ +#define LAN_RSTAT(base) ULTRA_ADRS(base,0x1c) /* receive status */ +#define LAN_ALICNT(base) ULTRA_ADRS(base,0x1d) /* alignment error */ +#define LAN_CRCCNT(base) ULTRA_ADRS(base,0x1e) /* crc error */ +#define LAN_MPCNT(base) ULTRA_ADRS(base,0x1f) /* missed packet */ + +/* page-0, write */ + +#define LAN_RSTART(base) ULTRA_ADRS(base,0x11) /* receive start */ +#define LAN_RSTOP(base) ULTRA_ADRS(base,0x12) /* receive stop */ +#define LAN_TSTART(base) ULTRA_ADRS(base,0x14) /* transmit start */ +#define LAN_TCNTL(base) ULTRA_ADRS(base,0x15) /* transmit counter */ +#define LAN_TCNTH(base) ULTRA_ADRS(base,0x16) /* transmit counter */ +#define LAN_RCON(base) ULTRA_ADRS(base,0x1c) /* receive config */ +#define LAN_TCON(base) ULTRA_ADRS(base,0x1d) /* transmit config */ +#define LAN_DCON(base) ULTRA_ADRS(base,0x1e) /* data config */ +#define LAN_INTMASK(base) ULTRA_ADRS(base,0x1f) /* interrupt mask */ + +/* page-1, read and write */ + +#define LAN_STA0(base) ULTRA_ADRS(base,0x11) /* station address */ +#define LAN_STA1(base) ULTRA_ADRS(base,0x12) /* station address */ +#define LAN_STA2(base) ULTRA_ADRS(base,0x13) /* station address */ +#define LAN_STA3(base) ULTRA_ADRS(base,0x14) /* station address */ +#define LAN_STA4(base) ULTRA_ADRS(base,0x15) /* station address */ +#define LAN_STA5(base) ULTRA_ADRS(base,0x16) /* station address */ +#define LAN_CURR(base) ULTRA_ADRS(base,0x17) /* current page */ +#define LAN_MAR0(base) ULTRA_ADRS(base,0x18) /* multicast address */ +#define LAN_MAR1(base) ULTRA_ADRS(base,0x19) /* multicast address */ +#define LAN_MAR2(base) ULTRA_ADRS(base,0x1a) /* multicast address */ +#define LAN_MAR3(base) ULTRA_ADRS(base,0x1b) /* multicast address */ +#define LAN_MAR4(base) ULTRA_ADRS(base,0x1c) /* multicast address */ +#define LAN_MAR5(base) ULTRA_ADRS(base,0x1d) /* multicast address */ +#define LAN_MAR6(base) ULTRA_ADRS(base,0x1e) /* multicast address */ +#define LAN_MAR7(base) ULTRA_ADRS(base,0x1f) /* multicast address */ + +/* page-2, read and write */ + +#define LAN_NEXT(base) ULTRA_ADRS(base,0x15) /* next page */ +#define LAN_ENH(base) ULTRA_ADRS(base,0x17) /* enable features */ + + +/* Control Register */ + +#define CON_RESET 0x80 +#define CON_MENABLE 0x40 + +/* Hardware Support Register */ + +#define HARD_SWH 0x80 + +/* BIOS Page Register */ + +#define BIOS_M16EN 0x80 + +/* Interrupt Control Register */ + +#define INT_ENABLE 0x01 + +/* Command Register */ + +#define CMD_PS1 0x80 +#define CMD_PS0 0x40 +#define CMD_TXP 0x04 +#define CMD_STA 0x02 +#define CMD_STP 0x01 + +/* Receive Configuration Register */ + +#define RCON_MON 0x20 +#define RCON_PROM 0x10 +#define RCON_GROUP 0x08 +#define RCON_BROAD 0x04 +#define RCON_RUNTS 0x02 +#define RCON_SEP 0x01 + +/* Transmit Configuration Register */ + +#define TCON_LB1 0x04 +#define TCON_LB0 0x02 +#define TCON_CRCN 0x01 + +/* Data Configuration Register */ + +#define DCON_BSIZE1 0x40 +#define DCON_BSIZE0 0x20 +#define DCON_BUS16 0x01 + +/* Interrupt Mask Register */ + +#define IM_CNTE 0x20 +#define IM_OVWE 0x10 +#define IM_TXEE 0x08 +#define IM_RXEE 0x04 +#define IM_PTXE 0x02 +#define IM_PRXE 0x01 + +/* Interrupt Status Register */ + +#define ISTAT_RST 0x80 +#define ISTAT_CNT 0x20 +#define ISTAT_OVW 0x10 +#define ISTAT_TXE 0x08 +#define ISTAT_RXE 0x04 +#define ISTAT_PTX 0x02 +#define ISTAT_PRX 0x01 + +/* Transmit Status Register */ + +#define TSTAT_OWC 0x80 +#define TSTAT_CDH 0x40 +#define TSTAT_UNDER 0x20 +#define TSTAT_CRL 0x10 +#define TSTAT_ABORT 0x08 +#define TSTAT_TWC 0x04 +#define TSTAT_NDT 0x02 +#define TSTAT_PTX 0x01 + +/* Receive Status Register */ + +#define RSTAT_DFR 0x80 +#define RSTAT_DIS 0x40 +#define RSTAT_GROUP 0x20 +#define RSTAT_MPA 0x10 +#define RSTAT_OVER 0x08 +#define RSTAT_FAE 0x04 +#define RSTAT_CRC 0x02 +#define RSTAT_PRX 0x01 + +/* Enable Features */ + +#define ENH_WAIT1 0x80 +#define ENH_WAIT0 0x40 +#define ENH_SLOT1 0x10 +#define ENH_SLOT0 0x08 + +/* flags - software synchronize bit difinitions */ + +#define TXING 0x01 +#define RXING 0x02 +#define TXREQ 0x04 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_ultrah */ diff --git a/h/drv/netif/netifDev.h b/h/drv/netif/netifDev.h new file mode 100644 index 0000000..f250dd3 --- /dev/null +++ b/h/drv/netif/netifDev.h @@ -0,0 +1,50 @@ +/* netifDev.h - generic network interface device driver header */ + +/* Copyright 1994-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,11jul96,map added MBC cluster type. +01d,28may96,dzb added CPM cluster type. +01c,07feb96,dzb added NIC_EVB cluster type. +01b,22mar94,dzb added SLIP cluster type. +01a,13oct93,dzb created. +*/ + +/* +DESCRIPTION + +This file contains generic header information for network interface device +drivers. +*/ + +#ifndef __INCnetifDevh +#define __INCnetifDevh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* defines */ + +/* device specific cluster types - used for buffer loaning */ + +#define MC_LANCE ((u_char) 2) /* ln cluster type */ +#define MC_BACKPLANE ((u_char) 3) /* backplane cluster type */ +#define MC_EI ((u_char) 4) /* ei cluster type */ +#define MC_QU ((u_char) 5) /* qu cluster type */ +#define MC_SL ((u_char) 6) /* sl cluster type */ +#define MC_NIC_EVB ((u_char) 7) /* nicEvb cluster type */ +#define MC_CPM ((u_char) 8) /* cpm cluster type */ +#define MC_MBC ((u_char) 9) /* mbe cluster type */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnetifDevh */ diff --git a/h/drv/netif/smNetLib.h b/h/drv/netif/smNetLib.h new file mode 100644 index 0000000..d0fb1ef --- /dev/null +++ b/h/drv/netif/smNetLib.h @@ -0,0 +1,117 @@ +/* smNetLib.h - VxWorks specific backplane driver header file */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01m,03may02,mas made pPkt volatile pointer in loanBuild() (SPR 68334) +01l,21mar02,vvv added doc for copyFromMbufs (SPR #20787) +01k,02oct01,mas added support for all 8 NETIF arguments in smNetAttach2 (4547) +01j,20aug96,vin commented out do_protocol +01i,11aug93,jmm Changed ioctl.h and socket.h to sys/ioctl.h and sys/socket.h +01h,22sep92,rrr added support for c++ +01g,27jul92,elh Added smNetShowInit. +01f,15jun92,elh changed parameter to smNetInetGet. +01e,02jun92,elh the tree shuffle +01d,27may92,elh Incorperated the changes caused from restructuring the + shared memory libraries. Renamed from smVxLib.h +01c,02may92,elh added mask to smNetInit +01b,10apr92,elh added startAddr for sequential addressing. +01a,17nov90,elh written. +*/ + +#ifndef __INCsmNetLibh +#define __INCsmNetLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" +#include "net/mbuf.h" +#include "net/if.h" +#include "netinet/in.h" +#include "netinet/in_var.h" +#include "netinet/if_ether.h" +#include "if_sm.h" +#include "errno.h" +#include "sys/ioctl.h" +#include "etherLib.h" +#include "net/unixLib.h" +#include "net/if_subr.h" +#include "inetLib.h" +#include "stdio.h" + +/* defines */ + +#define NSM 1 + +/* macros needed by backplane driver */ + +IMPORT SM_SOFTC * sm_softc[]; + +#define UNIT_TO_SOFTC(unit) (sm_softc [unit]) +#define etherAddrPtr(eaddr) (eaddr) + +/* + * copyFromMbufs should not be used since it may cause unaligned memory + * accesses. + */ + +#define copyFromMbufs(pData, pMbuf, len) \ + copy_from_mbufs ((pData), (pMbuf), (len)) + +#define copyToMbufs(pData, len, off, pIf) \ + copy_to_mbufs ((pData), (len), (off), (pIf)) + + /* hooks */ +#define outputHook(pIf, pData, bytes) \ + ((etherOutputHookRtn != NULL) && \ + ((*etherOutputHookRtn) ((pIf), (pData), (bytes)))) ? \ + (TRUE) : (FALSE) + +#define inputHook(pIf, pData, bytes) \ + ((etherInputHookRtn != NULL) && \ + ((*etherInputHookRtn)((pIf), (pData), (bytes)))) ? \ + (TRUE) : (FALSE) + +#define deviceValid(unit) ((sm_softc [unit] != NULL) ? TRUE : FALSE) + +/* function prototypes */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS smNetInit (SM_ANCHOR * pAnchor, char * pMem, int memSize, + int tasType, int cpuMax, int maxPktBytes, + u_long startAddr); +extern STATUS smNetAttach (int unit, SM_ANCHOR *pAnchor, int maxInputPkts, + int intType, int intArg1, int intArg2, int intArg3); +extern STATUS smNetAttach2 (int unit, SM_ANCHOR *pAnchor, int maxInputPkts, + int intType, int intArg1, int intArg2, int intArg3, + int masterCpu, int maxTicsWait); +extern STATUS smNetInetGet (char * smName, char * smInet, int cpuNum); +extern void smNetShowInit (void); +extern STATUS smNetShow (char * ifName, BOOL zero); +struct mbuf * loanBuild (SM_SOFTC * xs, SM_PKT volatile * pPkt, u_char * pData, + int len); + +#else + +extern STATUS smNetInit (); +extern STATUS smNetAttach (); +extern STATUS smNetInetGet (); +extern void smNetShowInit (); +extern STATUS smNetShow (); +struct mbuf * loanBuild (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsmNetLibh */ + diff --git a/h/drv/parallel/lptDrv.h b/h/drv/parallel/lptDrv.h new file mode 100644 index 0000000..1e19a6e --- /dev/null +++ b/h/drv/parallel/lptDrv.h @@ -0,0 +1,133 @@ +/* lptDrv.h - IBM-PC LPT */ + +/* Copyright 1984-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,23mar01,sru add register spacing field to LPT_RESOURCE SPR# 65937 +01f,23aug00,jgn move _ASMLANGUAGE guard to prevent header file problems with + assembler builds +01e,04jan00,dat SPR 29875, chg'd SEMAPHOREs to SEM_IDs +01d,22nov99,stv added missing header files (SPR #24014). +01c,10dec97,ms added lptResources import +01b,18oct96,hdn re-written. +01a,13oct94,hdn written. +*/ + +#ifndef __INClptDrvh +#define __INClptDrvh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* includes */ + +#include "iosLib.h" +#include "semLib.h" + +typedef struct lptDev /* LPT_DEV */ + { + DEV_HDR devHdr; + BOOL created; /* TRUE if this device has been created */ + BOOL autofeed; /* TRUE if enable autofeed */ + BOOL inservice; /* TRUE if interrupt in service */ + ULONG data; /* data register */ + ULONG stat; /* status register */ + ULONG ctrl; /* control register */ + int intCnt; /* interrupt count */ + int retryCnt; /* retry count */ + int busyWait; /* loop count for BUSY wait */ + int strobeWait; /* loop count for STROBE wait */ + int timeout; /* timeout second for syncSem */ + int intLevel; /* interrupt level */ + SEM_ID muteSem; /* mutex semaphore */ + SEM_ID syncSem; /* sync semaphore */ + } LPT_DEV; + +typedef struct lptResource /* LPT_RESOURCE */ + { + int ioBase; /* IO base address */ + int intVector; /* interrupt vector */ + int intLevel; /* interrupt level */ + BOOL autofeed; /* TRUE if enable autofeed */ + int busyWait; /* loop count for BUSY wait */ + int strobeWait; /* loop count for STROBE wait */ + int retryCnt; /* retry count */ + int timeout; /* timeout second for syncSem */ + int regDelta; /* register address spacing */ + } LPT_RESOURCE; + +/* IO address (LPT) */ + +#define N_LPT_CHANNELS 3 /* max LPT channels */ + +/* register definitions */ + +#define CAST +#define LPT_REG_ADDR_INTERVAL 1 /* address diff of adjacent regs. */ +#define LPT_ADRS(base,reg) (CAST (base+(reg*LPT_REG_ADDR_INTERVAL))) + +/* register spacing based on header file definition */ + +#define LPT_DATA(base) LPT_ADRS(base,0x00) /* data reg. */ +#define LPT_STAT(base) LPT_ADRS(base,0x01) /* status reg. */ +#define LPT_CTRL(base) LPT_ADRS(base,0x02) /* control reg. */ + +/* register spacing based on resource structure */ + +#define LPT_DATA_RES(resource) (resource->ioBase + (0 * resource->regDelta)) +#define LPT_STAT_RES(resource) (resource->ioBase + (1 * resource->regDelta)) +#define LPT_CTRL_RES(resource) (resource->ioBase + (2 * resource->regDelta)) + +/* control register */ + +#define C_STROBE 0x01 /* STROBE signal */ +#define C_AUTOFEED 0x02 /* AUTOFEED signal */ +#define C_NOINIT 0x04 /* INITIALIZE signal */ +#define C_SELECT 0x08 /* SELECT INPUT signal */ +#define C_ENABLE 0x10 /* ENABLE interrupt */ +#define C_INPUT 0x20 /* DATA DIRECTION control bit */ + +/* status register */ + +#define S_NODERR 0x08 /* Device error */ +#define S_SELECT 0x10 /* Device selected */ +#define S_PERR 0x20 /* Device out of paper */ +#define S_NOACK 0x40 /* Printer ready */ +#define S_NOBUSY 0x80 /* Device busy */ +#define S_MASK 0xb8 /* mask bits */ + +/* ioctl functions */ + +#define LPT_SETCONTROL 0 +#define LPT_GETSTATUS 1 + +IMPORT LPT_RESOURCE lptResources[]; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +STATUS lptDrv (int channels, LPT_RESOURCE *pResource); +STATUS lptDevCreate (char *name, int channel); + +#else + +STATUS lptDrv (); +STATUS lptDevCreate (); + +#endif /* __STDC__ */ + + +#endif /* _ASMLANGUAGE */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INClptDrvh */ diff --git a/h/drv/parallel/m5m82c55afp.h b/h/drv/parallel/m5m82c55afp.h new file mode 100644 index 0000000..93a297b --- /dev/null +++ b/h/drv/parallel/m5m82c55afp.h @@ -0,0 +1,53 @@ +/* m5m82c55afp.h - Mitsubishi 82c55 PPI chip header */ + +/* Copyright 1991-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01d,22sep92,rrr added support for c++ +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01a,16may91,hdn written. +*/ + +#ifndef __INCm5m82c55afph +#define __INCm5m82c55afph + +#ifdef __cplusplus +extern "C" { +#endif + +#define M5M82C55AFP_REG_OFFSET 3 + +#ifndef _ASMLANGUAGE +typedef struct + { + UCHAR pad0[M5M82C55AFP_REG_OFFSET]; + UCHAR portA; + UCHAR pad1[M5M82C55AFP_REG_OFFSET]; + UCHAR portB; + UCHAR pad2[M5M82C55AFP_REG_OFFSET]; + UCHAR portC; + UCHAR pad3[M5M82C55AFP_REG_OFFSET]; + UCHAR control; + } PPI; +#endif /* _ASMLANGUAGE */ + +/* bit value for control register */ +#define PPI_PC_MODE 0x80 +#define PPI_PA_MODE1 0x20 +#define PPI_PA_MODE2 0x40 +#define PPI_PA07_INPUT 0x10 +#define PPI_PC47_INPUT 0x08 +#define PPI_PB_MODE 0x04 +#define PPI_PB07_INPUT 0x02 +#define PPI_PC03_INPUT 0x01 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm5m82c55afph */ diff --git a/h/drv/parallel/m8260IOPort.h b/h/drv/parallel/m8260IOPort.h new file mode 100644 index 0000000..0a587e8 --- /dev/null +++ b/h/drv/parallel/m8260IOPort.h @@ -0,0 +1,113 @@ +/* m8260IOPort.h - Motorola MPC8260 I/O Port header file */ + +/* Copyright 1984-1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,12sep99,ms_ created from m8260Sio.h, 01b +*/ + +/* + * This file contains constants for the I/O Ports in the Motorola + * MPC8260 PowerQUICC II integrated Communications Processor + */ + +#ifndef __INCm8260IOPorth +#define __INCm8260IOPorth +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + + +/* I/O Port Configuration Registers */ + +/*** Port A data direction reg ***/ + +#define M8260_IOP_PADIR(base) ((VINT32 *) ((base) + 0x010D00)) + +/*** Port A pin assign reg ***/ + +#define M8260_IOP_PAPAR(base) ((VINT32 *) ((base) + 0x010D04)) + +/*** Port A special options reg ***/ + +#define M8260_IOP_PASO(base) ((VINT32 *) ((base) + 0x010D08)) + +/*** Port A open drain reg ***/ + +#define M8260_IOP_PAODR(base) ((VINT32 *) ((base) + 0x010D0C)) + +/*** Port A data reg ***/ + +#define M8260_IOP_PADAT(base) ((VINT32 *) ((base) + 0x010D10)) + +/*** Port B data direction reg ***/ + +#define M8260_IOP_PBDIR(base) ((VINT32 *) ((base) + 0x010D20)) + +/*** Port B pin assign reg ***/ + +#define M8260_IOP_PBPAR(base) ((VINT32 *) ((base) + 0x010D24)) + +/*** Port B special options reg ***/ + +#define M8260_IOP_PBSO(base) ((VINT32 *) ((base) + 0x010D28)) + +/*** Port B open drain reg ***/ + +#define M8260_IOP_PBODR(base) ((VINT32 *) ((base) + 0x010D2C)) + +/*** Port B Data register ***/ + +#define M8260_IOP_PBDAT(base) ((VINT32 *) ((base) + 0x010D30)) + +/*** Port C data direction reg ***/ + +#define M8260_IOP_PCDIR(base) ((VINT32 *) ((base) + 0x010D40)) + +/*** Port C pin assign reg ***/ + +#define M8260_IOP_PCPAR(base) ((VINT32 *) ((base) + 0x010D44)) + +/*** Port C special options reg ***/ + +#define M8260_IOP_PCSO(base) ((VINT32 *) ((base) + 0x010D48)) + +/*** Port C open drain reg ***/ + +#define M8260_IOP_PCODR(base) ((VINT32 *) ((base) + 0x010D4C)) + +/*** Port C data reg ***/ + +#define M8260_IOP_PCDAT(base) ((VINT32 *) ((base) + 0x010D50)) + +/*** Port D data direction reg ***/ + +#define M8260_IOP_PDDIR(base) ((VINT32 *) ((base) + 0x010D60)) + +/*** Port D pin assign reg ***/ + +#define M8260_IOP_PDPAR(base) ((VINT32 *) ((base) + 0x010D64)) + +/*** Port D special options reg ***/ + +#define M8260_IOP_PDSO(base) ((VINT32 *) ((base) + 0x010D68)) + +/*** Port D open drain reg ***/ + +#define M8260_IOP_PDODR(base) ((VINT32 *) ((base) + 0x010D6C)) + +/*** Port D data reg ***/ + +#define M8260_IOP_PDDAT(base) ((VINT32 *) ((base) + 0x010D70)) + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm8260IOPorth */ diff --git a/h/drv/pci/iPIIX4.h b/h/drv/pci/iPIIX4.h new file mode 100644 index 0000000..d421be7 --- /dev/null +++ b/h/drv/pci/iPIIX4.h @@ -0,0 +1,94 @@ +/* iPIIX4.h - 82371AB PCI ISA IDE Xcelerator (PIIX4) header */ + +/* +modification history +-------------------- +01a,17oct01,dmh written. +*/ + +/* +This file contains IO address and related constants for the +PIIX4 (PCI to ISA/IDE bridge). Use this instead of iPiix4Pci.h. +*/ + +#ifndef _iPIIX4_h +#define _iPIIX4_h + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* defines */ + +/* PCI to ISA/IDE bridge */ + +#define IPIIX4_PCI_VENID 0x8086 /* PCI config spec for PIIX4 device */ + +#define IPIIX4_PCI_DEV0 0x7110 +#define IPIIX4_PCI_DEV1 0x7111 +#define IPIIX4_PCI_DEV2 0x7112 +#define IPIIX4_PCI_DEV3 0x7113 + +#define IPIIX4_PCI_FUNC0 0x0 +#define IPIIX4_PCI_FUNC1 0x1 +#define IPIIX4_PCI_FUNC2 0x2 +#define IPIIX4_PCI_FUNC3 0x3 + +#define IPIIX4_PCI_INST0 0x0 + +#define IPIIX4_PCI_NOIDX -1 +#define IPIIX4_PCI_NOINT 0xFF + +#define IPIIX4_PCI_XINT_MAX 0x4 /* Max # of interrupt to route */ + +/* PIRQ[A:D]- Suggested interrupt routing and not absolutely required */ + +#define IPIIX4_PCI_XINT1_LVL 0x9 +#define IPIIX4_PCI_XINT2_LVL 0xA +#define IPIIX4_PCI_XINT3_LVL 0xB +#define IPIIX4_PCI_XINT4_LVL 0xC + +#define IPIIX4_PCI_DEVRESD 0x50 /* PCI based PIIX4 registers */ +#define IPIIX4_PCI_DEVRESA 0x5C +#define IPIIX4_PCI_DEVRESB 0x60 +#define IPIIX4_PCI_PCICMD 0x04 +#define IPIIX4_PCI_MLT 0x0D +#define IPIIX4_PCI_BMIBA 0x20 +#define IPIIX4_PCI_IDETIM 0x40 +#define IPIIX4_PCI_PIRQRCA 0x60 +#define IPIIX4_PCI_PIRQRCB 0x61 +#define IPIIX4_PCI_PIRQRCC 0x62 +#define IPIIX4_PCI_PIRQRCD 0x63 +#define IPIIX4_PCI_ELCR1 0x4D0 +#define IPIIX4_PCI_ELCR2 0x4D1 + +#define IPIIX4_PCI_IRQ1ENDEV11 0x0800 /* bit #19 - DEVRESD */ +#define IPIIX4_PCI_RESENDEV5 0x08 /* bit #11 - DEVRESD */ +#define IPIIX4_PCI_KBCENDEV11 0x10000000 /* bit #28 - DEVRESA */ +#define IPIIX4_PCI_KBCEIOEN 0x40000000 /* bit #30 - DEVRESB */ +#define IPIIX4_PCI_PCICMD_BME 0x04 /* bit #2 - PCICMD */ +#define IPIIX4_PCI_PCICMD_IOSE 0x01 /* bit #0 - PCICMD */ +#define IPIIX4_PCI_MLT_MLTCV 0x40 /* bit [7:4] - MLT */ +#define IPIIX4_PCI_BMIBA_RTE 0x1 /* bit #0 - BMIBA */ +#define IPIIX4_PCI_IDETIM_VAL 0xa307a307 /* Pri + Sec Chans */ + +#define IPIIX4_PCI_FD_DCM 0xD6 /* DMA Channel Mode Register */ +#define IPIIX4_PCI_FD_RWAMB 0xDE /* Read/Write All Mask Bits */ +#define IPIIX4_PCI_FD_DCM_CASCADE 0xC0 /* bits [7:6] of DCM */ +#define IPIIX4_PCI_FD_DCM_AUTOINIT 0x10 /* bit [4] of DCM */ +#define IPIIX4_PCI_FD_RWAMB_MASKALL 0x00 + +/* function declarations */ + +extern STATUS iPIIX4Init (); +extern STATUS iPIIX4FdInit (); +extern STATUS iPIIX4KbdInit (); +extern STATUS iPIIX4AtaInit (); +extern STATUS iPIIX4IntrRoute (int pintx, char irq); +extern char iPIIX4GetIntr (int pintx); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _iPIIX4_h */ diff --git a/h/drv/pci/iPiix4Pci.h b/h/drv/pci/iPiix4Pci.h new file mode 100644 index 0000000..0b13f0a --- /dev/null +++ b/h/drv/pci/iPiix4Pci.h @@ -0,0 +1,122 @@ +/* iPiix4Pci.h - 82371AB PCI ISA IDE Xcelerator (PIIX4) header */ + +/* +modification history +-------------------- +01a,28mar00,mks written. +*/ + +/* +This file contains IO address and related constants for the +PIIX4 (PCI to ISA/IDE bridge). +*/ + +#ifndef INCipiix4pcih +#define INCipiix4pcih + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* defines */ + +/* PCI to ISA/IDE bridge */ +#define IPIIX4_PCI_VENID 0x8086 /* PCI config spec for PIIX4 device */ + +#define IPIIX4_PCI_DEV0 0x7110 +#define IPIIX4_PCI_DEV1 0x7111 +#define IPIIX4_PCI_DEV2 0x7112 +#define IPIIX4_PCI_DEV3 0x7113 + +#define IPIIX4_PCI_FUNC0 0x0 +#define IPIIX4_PCI_FUNC1 0x1 +#define IPIIX4_PCI_FUNC2 0x2 +#define IPIIX4_PCI_FUNC3 0x3 + +#define IPIIX4_PCI_INST0 0x0 + +#define IPIIX4_PCI_NOIDX -1 +#define IPIIX4_PCI_NOINT 0xFF + +#ifndef IPIIX4_PCI_DEVMAX +#define IPIIX4_PCI_DEVMAX 0x1 /* Max # of PIIX4 on board */ +#endif + +/* PIRQ[A:D]- Interrupt routing */ +#define IPIIX4_PCI_XINT1_LVL 0x9 +#define IPIIX4_PCI_XINT2_LVL 0xA +#define IPIIX4_PCI_XINT3_LVL 0xB +#define IPIIX4_PCI_XINT4_LVL 0xC + +#ifndef IPIIX4_PCI_XINT_MAX +#define IPIIX4_PCI_XINT_MAX 0x4 /* Max # of interrupt to route */ +#endif + +#define IPIIX4_PCI_DEVRESD 0x50 /* PCI based PIIX4 registers */ +#define IPIIX4_PCI_DEVRESA 0x5C +#define IPIIX4_PCI_DEVRESB 0x60 +#define IPIIX4_PCI_PCICMD 0x04 +#define IPIIX4_PCI_MLT 0x0D +#define IPIIX4_PCI_BMIBA 0x20 +#define IPIIX4_PCI_IDETIM 0x40 +#define IPIIX4_PCI_PIRQRCA 0x60 +#define IPIIX4_PCI_PIRQRCB 0x61 +#define IPIIX4_PCI_PIRQRCC 0x62 +#define IPIIX4_PCI_PIRQRCD 0x63 +#define IPIIX4_PCI_ELCR1 0x4D0 +#define IPIIX4_PCI_ELCR2 0x4D1 + +#define IPIIX4_PCI_IRQ1ENDEV11 0x0800 /* bit #19 - DEVRESD */ +#define IPIIX4_PCI_RESENDEV5 0x08 /* bit #11 - DEVRESD */ +#define IPIIX4_PCI_KBCENDEV11 0x10000000 /* bit #28 - DEVRESA */ +#define IPIIX4_PCI_KBCEIOEN 0x40000000 /* bit #30 - DEVRESB */ +#define IPIIX4_PCI_PCICMD_BME 0x04 /* bit #2 - PCICMD */ +#define IPIIX4_PCI_PCICMD_IOSE 0x01 /* bit #0 - PCICMD */ +#define IPIIX4_PCI_MLT_MLTCV 0x40 /* bit [7:4] - MLT */ +#define IPIIX4_PCI_BMIBA_RTE 0x1 /* bit #0 - BMIBA */ +#define IPIIX4_PCI_IDETIM_VAL 0xa307a307 /* Pri + Sec Chans */ + +#define IPIIX4_PCI_FD_DCM 0xD6 /* DMA Channel Mode Register */ +#define IPIIX4_PCI_FD_RWAMB 0xDE /* Read/Write All Mask Bits */ +#define IPIIX4_PCI_FD_DCM_CASCADE 0xC0 /* bits [7:6] of DCM */ +#define IPIIX4_PCI_FD_DCM_AUTOINIT 0x10 /* bit [4] of DCM */ +#define IPIIX4_PCI_FD_RWAMB_MASKALL 0x00 + +/* typedefs */ + +typedef struct iPiix4PciHandle + { + int busId; + int devId; + short instance; + short handleInUse; + } IPIIX4PCI_HANDLE; + +/* function declarations */ + +extern STATUS iPiix4PciLibInit (VOID); +extern int iPiix4PciDevCreate (int instance); +extern STATUS iPiix4PciIntrRoute (int handle); +extern STATUS iPiix4PciFdInit (int handle); +extern STATUS iPiix4PciKbdInit (int handle); +extern STATUS iPiix4PciAtaInit (int handle); +extern int iPiix4PciGetIntr (int handle); +extern int iPiix4PciGetHandle (int vendId, int devId, int instance); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* INCipiix4pcih */ + + + + + + + + + + + + diff --git a/h/drv/pci/mpc105.h b/h/drv/pci/mpc105.h new file mode 100644 index 0000000..e600c58 --- /dev/null +++ b/h/drv/pci/mpc105.h @@ -0,0 +1,426 @@ +/* mpc105.h - Motorola MPC105 PCI Bridge/Memory Controller */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,10oct96,tam added missing macros. +01a,03apr96,tpr written. +*/ + +/* +This file contains the related constants for the MPC105. +*/ + +#ifndef __INCmpc105h +#define __INCmpc105h + +#ifdef __cplusplus +extern "C" { +#endif + +#define MPC105_VEND_ID 0x00 /* Vendor ID Reg */ +#define MPC105_DEV_ID 0x02 /* Device ID Reg */ +#define MPC105_CMD 0x04 /* Pci Command Reg */ +#define MPC105_STAT 0x06 /* Pci Status Reg */ +#define MPC105_PMCR 0x70 /* Power Management Configuration Reg */ +#define MPC105_MSAR1 0x80 /* Memory Starting Address Register 1 */ +#define MPC105_MSAR2 0x84 /* Memory Starting Address Register 2 */ +#define MPC105_EMSAR1 0x88 /* Extended Memory Start Addr Reg 1 */ +#define MPC105_EMSAR2 0x8c /* Extended Memory Start Addr Reg 2 */ +#define MPC105_MEAR1 0x90 /* Memory Ending Address Register 1 */ +#define MPC105_MEAR2 0x94 /* Memory Ending Address Register 2 */ +#define MPC105_EMEAR1 0x98 /* Extended Memory Ending Addr Reg 1 */ +#define MPC105_EMEAR2 0x9c /* Extended Memory Ending Addr Reg 2 */ +#define MPC105_MBER 0xa0 /* Memory Bank Enable Register */ +#define MPC105_PICR1 0xa8 /* Processor Interface Config. Reg 1 */ +#define MPC105_PICR2 0xac /* Processor Interface Config. Reg 2 */ +#define MPC105_OS_VPR1 0xba /* OS Visible Parameters Register 1 */ +#define MPC105_OS_VPR2 0xbb /* OS Visible Parameters Register 2 */ +#define MPC105_ERR_EN_R1 0xc0 /* Error Enable Register 1 */ +#define MPC105_ERR_DR1 0xc1 /* Error Detection Register 1 */ +#define MPC105_60X_BESR 0xc3 /* 60x Bus Error Status Register */ +#define MPC105_ERR_EN_R2 0xc4 /* Error Enable Register 2 */ +#define MPC105_ERR_DR2 0xc5 /* Error Detection Register 2 */ +#define MPC105_PCI_BESR 0xc7 /* PCI Bus Error Status Register */ +#define MPC105_60XPCI_EAR 0xc8 /* 60x/PCI Error Address Register */ +#define MPC105_MCCR1 0xf0 /* Memory Control Configuration Reg 1 */ +#define MPC105_MCCR2 0xf4 /* Memory Control Configuration Reg 2 */ +#define MPC105_MCCR3 0xf8 /* Memory Control Configuration Reg 3 */ +#define MPC105_MCCR4 0xfc /* Memory Control Configuration Reg 4 */ + +/* External Configuration Registers - Address Map A */ + +#define MPC105_ECR1 0x80000092 /* External Configuration Reg 1 */ +#define MPC105_ECR2 0x8000081c /* External Configuration Reg 2 */ +#define MPC105_ECR3 0x80000850 /* External Configuration Reg 3 */ + +/* Other registers are accessed indirectly via the registers below */ + +#define MPC105_REG_SELECT (int *)0x80000cf8 /* register select */ +#define MPC105_REG_DATA (int *)0x80000cfc /* register data */ +#define MPC105_REG(nn) ((nn << 24) | 0x80) + +/* Pci Command Reg (CMD) - 0x04 */ + +#define CMD_SERR 0x0100 /* enable SERR signal */ +#define CMD_PAR_ERR 0x0040 /* respond to parity errors */ +#define CMD_PCI_MASTER 0x0004 /* generate pci mem. accesses */ +#define CMD_PCI_SLAVE 0x0002 /* respond to pci mem. accesses */ + +/* Pci Status Reg (STAT) - 0x6 */ + +#define STAT_PAR_ERR 0x8000 /* parity error detected */ +#define STAT_SERR 0x4000 /* SERR is asserted */ +#define STAT_MASTER_MST_ABORT 0x2000 /* transaction using master-abort */ +#define STAT_MASTER_TGT_ABORT 0x1000 /* transaction using master-abort */ +#define STAT_TARGET_TGT_ABORT 0x0800 /* transaction using master-abort */ +#define STAT_DATA_PAR_ERR 0x0100 /* data parity error detected */ +#define STAT_NO_RSV_BITS 0xf900 /* non reserved or non hardwired bits */ + + +/* Power Management Configuration Register (PMCR) - 0x70 */ + +#define PMCR_NO_NAP_MSG 0x8000 /* HALT command broadcast */ +#define PMCR_NO_SLEEP_MSG 0x4000 /* Sleep message broadcast */ +#define PMCR_SLEEP_MSG_TYPE 0x2000 /* Sleep message type */ +#define PMCR_LP_REF_EN 0x1000 /* Low-power refresh enable */ +#define PMCR_NO_604_RUN 0x0800 /* Do not assert QACK (PPC604 only) */ +#define PMCR_601_NEED_QREQ 0x0400 /* QREQ requested (PPC601 only) */ +#define PMCR_SUSP_QACK 0x0200 /* Suspend mode will assert QACK */ +#define PMCR_PM 0x0080 /* Power Management enable */ +#define PMCR_DOZE 0x0020 /* Doze mode enable */ +#define PMCR_NAP 0x0010 /* Nap mode enable */ +#define PMCR_SLEEP 0x0008 /* Sleep mode enable */ +#define PMCR_CKO_EN 0x0004 /* test clock output driver enable */ +#define PMCR_CKO_SEL 0x0002 /* Selects the clock source */ +#define PMCR_BR1_WAKE 0x0001 /* Enable awareness of a second CPU */ + +/* Memory Starting Address Register 1 - 0x80 */ + +#define MSAR1_BANK3_MSK 0xff000000 /* Starting addr for bank 3 */ +#define MSAR1_BANK2_MSK 0x00ff0000 /* Starting addr for bank 2 */ +#define MSAR1_BANK1_MSK 0x0000ff00 /* Starting addr for bank 1 */ +#define MSAR1_BANK0_MSK 0x000000ff /* Starting addr for bank 0 */ + +/* Memory Starting Address Register 2 - 0x84 */ + +#define MSAR2_BANK7_MSK 0xff000000 /* Starting addr for bank 7 */ +#define MSAR2_BANK6_MSK 0x00ff0000 /* Starting addr for bank 6 */ +#define MSAR2_BANK5_MSK 0x0000ff00 /* Starting addr for bank 5 */ +#define MSAR2_BANK4_MSK 0x000000ff /* Starting addr for bank 4 */ + +/* Extended Memory Start Address Register 1 - 0x88 */ + +#define EMSAR1_BANK3_MSK 0x03000000 /* Extended starting addr 3 */ +#define EMSAR1_BANK2_MSK 0x00030000 /* Extended starting addr 2 */ +#define EMSAR1_BANK1_MSK 0x00000300 /* Extended starting addr 1 */ +#define EMSAR1_BANK0_MSK 0x00000003 /* Extended starting addr 0 */ + +/* Extended Memory Start Address Register 2 - 0x8c */ + +#define EMSAR2_BANK7_MSK 0x03000000 /* Extended starting addr 7 */ +#define EMSAR2_BANK6_MSK 0x00030000 /* Extended starting addr 6 */ +#define EMSAR2_BANK5_MSK 0x00000300 /* Extended starting addr 5 */ +#define EMSAR2_BANK4_MSK 0x00000003 /* Extended starting addr 4 */ + +/* Memory Ending Address Register 1 - 0x90 */ + +#define MEAR1_BANK3_MSK 0xff000000 /* Ending addr for bank 3 */ +#define MEAR1_BANK2_MSK 0x00ff0000 /* Ending addr for bank 2 */ +#define MEAR1_BANK1_MSK 0x0000ff00 /* Ending addr for bank 1 */ +#define MEAR1_BANK0_MSK 0x000000ff /* Ending addr for bank 0 */ + +/* Memory Ending Address Register 2 - 0x94 */ + +#define MEAR2_BANK7_MSK 0xff000000 /* Ending addr for bank 7 */ +#define MEAR2_BANK6_MSK 0x00ff0000 /* Ending addr for bank 6 */ +#define MEAR2_BANK5_MSK 0x0000ff00 /* Ending addr for bank 5 */ +#define MEAR2_BANK4_MSK 0x000000ff /* Ending addr for bank 4 */ + +/* Extended Memory Ending Address Register 1 - 0x98 */ + +#define EMEAR1_BANK3_MSK 0x03000000 /* Extended ending addr 3 */ +#define EMEAR1_BANK2_MSK 0x00030000 /* Extended ending addr 2 */ +#define EMEAR1_BANK1_MSK 0x00000300 /* Extended ending addr 1 */ +#define EMEAR1_BANK0_MSK 0x00000003 /* Extended ending addr 0 */ + +/* Extended Memory Ending Address Register 2 - 0x9c */ + +#define EMEAR2_BANK7_MSK 0x03000000 /* Extended ending addr 7 */ +#define EMEAR2_BANK6_MSK 0x00030000 /* Extended ending addr 6 */ +#define EMEAR2_BANK5_MSK 0x00000300 /* Extended ending addr 5 */ +#define EMEAR2_BANK4_MSK 0x00000003 /* Extended ending addr 4 */ + +/* Memory Bank Enable Register - 0xa0 */ + +#define MBER_BANK7 0x80 /* Enable/disable bank 7 */ +#define MBER_BANK6 0x40 /* Enable/disable bank 6 */ +#define MBER_BANK5 0x20 /* Enable/disable bank 5 */ +#define MBER_BANK4 0x10 /* Enable/disable bank 4 */ +#define MBER_BANK3 0x08 /* Enable/disable bank 3 */ +#define MBER_BANK2 0x04 /* Enable/disable bank 2 */ +#define MBER_BANK1 0x02 /* Enable/disable bank 1 */ +#define MBER_BANK0 0x01 /* Enable/disable bank 0 */ + +/* Processor Interface Configuration Register 1 (PICR1) - 0xa8 */ + +#define PICR1_CF_CBA_MASK 0xff000000 /* L2 copy-back address mask */ +#define PICR1_CF_CBA(n) ((n)<<24) +#define PICR1_CF_BREAD_WS(n) ((n)<<22) /* Burst read wait states */ +#define PICR1_CF_CACHE_1G 0x00200000 /* L2 cache 0-1Gbyte only */ +#define PICR1_RCS0 0x00100000 /* ROM location: PCI or 60x */ +#define PICR1_XIO_MODE 0x00080000 /* Discontigous IO mode map A */ +#define PICR1_PROC_TYPE_MASK 0x00060000 /* Processor type */ +#define PICR1_PROC_TYPE_601 0x00000000 /* Processor type */ +#define PICR1_PROC_TYPE_603 0x00040000 /* Processor type */ +#define PICR1_PROC_TYPE_604 0x00060000 /* Processor type */ +#define PICR1_XATS 0x00010000 /* Address map: A or B */ +#define PICR1_CF_MP_ID 0x00008000 /* Multiprocessor id */ +#define PICR1_CF_LBA_EN 0x00002000 /* Local bus slave access en */ +#define PICR1_FLASH_WR_EN 0x00001000 /* Flash writes enable */ +#define PICR1_MCP_EN 0x00000800 /* Machine check enable */ +#define PICR1_TEA_EN 0x00000400 /* Transfer error enable */ +#define PICR1_CF_DPARK 0x00000200 /* 60x parked on data bus */ +#define PICR1_NO_PORT_REGS 0x00000080 /* No ext configuration reg */ +#define PICR1_ST_GATH_EN 0x00000040 /* Store gathering of writes */ +#define PICR1_LE_MODE 0x00000020 /* Little-Endian mode */ +#define PICR1_CF_LOOP_SNOOP 0x00000010 /* Snoop looping enable */ +#define PICR1_CF_APARK 0x00000008 /* 60x parked on address bus */ +#define PICR1_SPEC_PCI_READ 0x00000004 /* Speculative PCI reads en */ +#define PICR1_CF_L2_CACHE_MASK 0x00000003 /* L2/multiprocessor config. */ +#define PICR1_CF_L2_NOCACHE 0x00000000 +#define PICR1_CF_L2_WRITE_THROUGH 0x00000001 +#define PICR1_CF_L2_COPY_BACK 0x00000002 +#define PICR1_CF_L2_MP 0x00000003 + + +/* Processor Interface Configuration Register 2 (PICR2) - 0xac */ + +#define PICR2_L2_UPDATE_EN 0x80000000 /* Update cache misses */ +#define PICR2_L2_EN 0x40000000 /* L2 cache enable */ +#define PICR2_CF_FLUSH_L2 0x10000000 /* Initiate L2 cache flush */ +#define PICR2_CF_BYTE_DECODE 0x02000000 /* on-chip byte-write decode */ +#define PICR2_CF_FAST_L2_MODE 0x01000000 /* Fast L2 mode timing */ +#define PICR2_CF_DATA_RAM_TYPE 0x00c00000 /* L2 data RAM type */ +#define PICR2_CF_DATA_RAM_SYNC 0x00000000 +#define PICR2_CF_DATA_RAM_ASYNC 0x00800000 +#define PICR2_CF_WMODE 0x00300000 /* SRAM write timing */ +#define PICR2_CF_WMODE_NORMAL 0x00100000 +#define PICR2_CF_WMODE_DELAY 0x00200000 +#define PICR2_CF_WMODE_EARLY 0x00300000 +#define PICR2_CF_SNOOP_WS(n) ((n)<<18) /* Snoop wait states */ +#define PICR2_CF_MOD_HIGH 0x00020000 /* Cache mod. signal polarity */ +#define PICR2_CF_HIT_HIGH 0x00010000 /* Cache HIT signal polarity */ +#define PICR2_CF_ADDR_ONLY_DISABLE 0x00004000 /* L2 normal operation */ +#define PICR2_CF_HOLD 0x00002000 /* L2 tag address hold */ +#define PICR2_CF_INV_MODE 0x00001000 /* L2 invalidate mode enable */ +#define PICR2_CF_L2_HIT_DELAY(n) ((n)<<9) /* L2 cache hit delay */ +#define PICR2_CF_BURST_RATE 0x00000100 /* L2 cache burst rate */ +#define PICR2_CF_FAST_CASTOUT 0x00000080 /* Fast L2 castout timing */ +#define PICR2_TOE_WIDTH 0x00000040 /* TOE active pulse width */ +#define PICR2_L2_SIZE 0x00000030 /* L2 cache size mask */ +#define PICR2_L2_SIZE_256K 0x00000000 +#define PICR2_L2_SIZE_512K 0x00000010 +#define PICR2_L2_SIZE_1MEG 0x00000020 +#define PICR2_CF_APHASE_WS(n) ((n)<<2) /* Address phase wait states */ +#define PICR2_CF_DOE 0x00000002 /* 1st data read access tim. */ +#define PICR2_CF_WDATA 0x00000001 /* 1st data write setup time */ + + +/* OS Visible Parameters Register 1 - 0xba */ + +#define OS_VPR1_RX_SERR_EN 0X20 /* Assertion of SERR from other PCI */ +#define OS_VPR1_XIO_MODE 0X04 /* Contiguous IO mode address map A */ +#define OS_VPR1_TEA_EN 0X02 /* Transfer error enable */ +#define OS_VPR1_MCP_EN 0X01 /* Machine check enable */ + +/* OS Visible Parameters Register 2 - 0xbb */ + +#define OS_VPR2_FLASH_WR_EN 0x01 /* Flash write enable */ + +/* Error Enable Register 1 (ERR_EN_R1) - 0xc0 */ + +#define ERR_EN_R1_TGT_ABRT 0x80 /* PCI target-abort error */ +#define ERR_EN_R1_TGT_PERR 0x40 /* PCI target PERR */ +#define ERR_EN_R1_MEM_SEL_ER 0x20 /* Memory select error */ +#define ERR_EN_R1_MASTER_PERR 0x10 /* PCI master PERR */ +#define ERR_EN_R1_MEM_RD_PARITY 0x04 /* Memory read parity error */ +#define ERR_EN_R1_MASTER_ABRT 0x02 /* PCI master-abort error */ +#define ERR_EN_R1_60X_BUS_ER 0x01 /* 60x bus error */ + +/* Error Detection Register 1 (ERR_DR1_PCI) - 0xc1 */ + +#define ERR_DR1_PCI_SERR 0x80 /* PCI SERR signaled */ +#define ERR_DR1_TGT_PERR 0x40 /* PCI target PERR */ +#define ERR_DR1_MEM_SEL_ER 0x20 /* Memory select error */ +#define ERR_DR1_60XPCI_CYCLE 0x80 /* 60x/PCI cycle */ +#define ERR_DR1_MEM_RD_PARITY 0x40 /* Memory read parity error */ +#define ERR_DR1_NO_60XBUS_CYCLE 0x03 /* Unsupported 60x bus cycle */ + +/* 60x Bus Error Status Register - 0xc3 */ + +#define BESR_TT0_TT4 0xf8 /* TT0-TT4 signals copy */ +#define BESR_TSIZ0_TSIZ2 0x07 /* TSIZ0-TSIZ2 signals copy */ + +/* Error Enable Register 2 (ERR_EN_R2) - 0xc4 */ + +#define ERR_EN_R2_L2_PARITY 0x10 /* L2 Parity error */ +#define ERR_EN_R2_FLASHROM_WRT 0x01 /* FLASH ROM write error */ + +/* Error Detection Register 2 (ERR_DR2) - 0xc5 */ + +#define ERR_DR2_INVLD_ER_ADR 0x80 /* Invalid error address */ +#define ERR_DR2_L2_PARITY 0x10 /* L2 parity error */ +#define ERR_DR2_FLASHROM_WRT 0x01 /* FLASH ROM write error */ + +/* PCI Bus Error Status Register - 0xc7 */ + +#define PCI_BESR_MSTR_TGT 0x10 /* Master/target status */ +#define PCI_BESR_CBE3_CBE0 0x0f /* C/BE3-C/BE0 copy */ + +/* 60x/PCI Error Address Register - 0xc8 */ + +#define PCI_EAR_A24_A31_MSK 0xff000000 /* 60x: A24-A31 PCI: AD7-AD0 */ +#define PCI_EAR_A16_A23_MSK 0x00ff0000 /* 60x: A16-A23 PCI: AD15-AD8 */ +#define PCI_EAR_A8_A15_MSK 0x0000ff00 /* 60x: A8-A15 PCI: AD23-AD16 */ +#define PCI_EAR_A0_A7_MSK 0x000000ff /* 60x: A0-A7 PCI: AD31-AD24 */ + +/* Memory Control Configuration Register 1 (MCCR1) - 0xf0 */ + +#define MCCR1_ROMNAL_MASK 0xf0000000 +#define MCCR1_ROMNAL(n) ((n)<<28) +#define MCCR1_ROMFAL_MASK 0x0f800000 +#define MCCR1_ROMFAL(n) ((n)<<23) +#define MCCR1_FNR 0x00400000 /* Flash ROM configuration */ +#define MCCR1_32N64 0x00200000 /* 64/32 Bit data bus wide */ +#define MCCR1_BURST 0x00100000 /* Burst mode Rom access */ +#define MCCR1_MEMGO 0x00080000 /* MPC105 RAM interface enable*/ +#define MCCR1_SREN 0x00040000 /* DRam Self Refresh enable */ +#define MCCR1_RAMTYP 0x00020000 /* DRAM type (synch/standard) */ +#define MCCR1_PCKEN 0x00010000 /* Parity Check/gen. enable */ +#define MCCR1_BK7_9BITS 0x00000000 /* Bank 7 - 9 row bits */ +#define MCCR1_BK7_10BITS 0x00004000 /* Bank 7 - 10 row bits */ +#define MCCR1_BK7_11BITS 0x00008000 /* Bank 7 - 11 row bits */ +#define MCCR1_BK7_12BITS 0x0000c000 /* Bank 7 - 12 row bits */ +#define MCCR1_BK6_9BITS 0x00000000 /* Bank 6 - 9 row bits */ +#define MCCR1_BK6_10BITS 0x00001000 /* Bank 6 - 10 row bits */ +#define MCCR1_BK6_11BITS 0x00002000 /* Bank 6 - 11 row bits */ +#define MCCR1_BK6_12BITS 0x00003000 /* Bank 6 - 12 row bits */ +#define MCCR1_BK5_9BITS 0x00000000 /* Bank 5 - 9 row bits */ +#define MCCR1_BK5_10BITS 0x00000400 /* Bank 5 - 10 row bits */ +#define MCCR1_BK5_11BITS 0x00000800 /* Bank 5 - 11 row bits */ +#define MCCR1_BK5_12BITS 0x00000c00 /* Bank 5 - 12 row bits */ +#define MCCR1_BK4_9BITS 0x00000000 /* Bank 4 - 9 row bits */ +#define MCCR1_BK4_10BITS 0x00000100 /* Bank 4 - 10 row bits */ +#define MCCR1_BK4_11BITS 0x00000200 /* Bank 4 - 11 row bits */ +#define MCCR1_BK4_12BITS 0x00000300 /* Bank 4 - 12 row bits */ +#define MCCR1_BK3_9BITS 0x00000000 /* Bank 3 - 9 row bits */ +#define MCCR1_BK3_10BITS 0x00000040 /* Bank 3 - 10 row bits */ +#define MCCR1_BK3_11BITS 0x00000080 /* Bank 3 - 11 row bits */ +#define MCCR1_BK3_12BITS 0x000000c0 /* Bank 3 - 12 row bits */ +#define MCCR1_BK2_9BITS 0x00000000 /* Bank 2 - 9 row bits */ +#define MCCR1_BK2_10BITS 0x00000010 /* Bank 2 - 10 row bits */ +#define MCCR1_BK2_11BITS 0x00000020 /* Bank 2 - 11 row bits */ +#define MCCR1_BK2_12BITS 0x00000030 /* Bank 2 - 12 row bits */ +#define MCCR1_BK1_9BITS 0x00000000 /* Bank 1 - 9 row bits */ +#define MCCR1_BK1_10BITS 0x00000004 /* Bank 1 - 10 row bits */ +#define MCCR1_BK1_11BITS 0x00000008 /* Bank 1 - 11 row bits */ +#define MCCR1_BK1_12BITS 0x0000000c /* Bank 1 - 12 row bits */ +#define MCCR1_BK0_9BITS 0x00000000 /* Bank 0 - 9 row bits */ +#define MCCR1_BK0_10BITS 0x00000001 /* Bank 0 - 10 row bits */ +#define MCCR1_BK0_11BITS 0x00000002 /* Bank 0 - 11 row bits */ +#define MCCR1_BK0_12BITS 0x00000003 /* Bank 0 - 12 row bits */ + +/* Memory Control Configuration Register 2 (MCCR2) - 0xf4 */ + +#define MCCR2_SRF 0xfffc0000 /* Self-refesh entry delay */ +#define MCCR2_REFINT 0x0000fffc /* Refresh interval */ +#define MCCR2_BUF 0x00000002 /* Buffer mode */ +#define MCCR2_WMODE 0x00000001 /* 8 beats per burst */ + +/* Memory Control Configuration Register 3 (MCCR3) - 0xf8 */ + +#define MCCR3_RDTOACT_MSK 0xf0000000 /* Read to active interval */ +#define MCCR3_REFREC_MSK 0x0f000000 /* Refresh to active interval */ +#define MCCR3_RDLAT_MSK 0x00f00000 /* Data latency from read cmd */ +#define MCCR3_RAS6P_MSK 0x00078000 /* RAS assertion interval mask*/ +#define MCCR3_RAS6P(n) ((n)<<15) /* RAS assertion interval */ +#define MCCR3_CAS5_MSK 0x00007000 /* CAS assertion interval mask*/ +#define MCCR3_CAS5(n) ((n)<<12) /* CAS assertion interval */ +#define MCCR3_CP4_MSK 0x00000e00 /* CAS precharge interval mask*/ +#define MCCR3_CP4(n) ((n)<<9) /* CAS precharge interval */ +#define MCCR3_CAS3_MSK 0x000001c0 /* CAS assertion 1st access */ +#define MCCR3_CAS3(n) ((n)<<6) /* CAS assertion 1st access */ +#define MCCR3_RCD2_MSK 0x00000038 /* RAS to CAS delay interval */ +#define MCCR3_RCD2(n) ((n)<<3) /* RAS to CAS delay interval */ +#define MCCR3_RP1_MSK 0x00000007 /* RAS precharge interval */ +#define MCCR3_RP1(n) (n)/* RAS precharge interval */ + +/* Memory Control Configuration Register 4 (MCCR4) - 0xfc */ + +#define MCCR4_PRETOACT 0xf0000000 /* Precharge to act. intvl */ +#define MCCR4_ACTOPRE 0x0f000000 /* Activate to prech. intvl */ +#define MCCR4_WCBUF 0x00200000 /* Memory write buffer type */ +#define MCCR4_RCBUF 0x00100000 /* Memory read buffer type */ +#define MCCR4_SDMODE 0x000fff00 /* SDRAM mode register data */ +#define MCCR4_ACTORW 0x000000f0 /* Act. to read/write intvl */ +#define MCCR4_WRTOACT 0x0000000f /* Write to activate intvl */ + +/* External Configuration Register 1 - 0x80000092 */ + +#define ECR1_LE_MODE 0x02 /* Little-endian mode */ + +/* External Configuration Register 2 - 0x8000081c */ + +#define ECR2_L2_UPDATE_EN 0x80 /* Update cache misses */ +#define ECR2_L2_EN 0x40 /* L2 cache enable */ +#define ECR2_TEA_EN 0x20 /* Transfer error enable */ +#define ECR2_CF_FLUSH_L2 0x10 /* L2 cache flush */ + +/* External Configuration Register 3 - 0x80000850 */ + +#define ECR3_XIO_MODE 0x01 /* Contiguous IO mode address map A*/ + +/* first parameter to mpc105Ioctl */ + +#define MPC105_IOCTL_WRITE 0 +#define MPC105_IOCTL_READ 1 +#define MPC105_IOCTL_OR 2 +#define MPC105_IOCTL_AND 3 +#define MPC105_IOCTL_AND_OR 4 +#define MPC105_IOCTL_AND_NOT 5 + +#define SWAP32(x) ((((x) & 0x000000ff) << 24) | \ + (((x) & 0x0000ff00) << 8) | \ + (((x) & 0x00ff0000) >> 8) | \ + (((unsigned int)(x)) >> 24)) +#define B2L_ENDIAN(x) SWAP32(x) +#define L2B_ENDIAN(x) SWAP32(x) + + +#ifndef _ASMLANGUAGE + +#if defined(__STDC__) || defined(__cplusplus) + +extern void mpc105Init (void * devAddr); +extern void mpc105Dram (void * devAddr, int boardType, int speedMhz); +extern void mpc105Ioctl (int op, int regSize, int regNum, + unsigned int wdata1, unsigned int wdata2); + +#else /* !__STDC__ */ + +extern void mpc105Init (); +extern void mpc105Dram (); +extern void mpc105Ioctl (); + +#endif /* (__STDC__) || (__cplusplus) */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmpc105h */ diff --git a/h/drv/pci/mpc107Pci.h b/h/drv/pci/mpc107Pci.h new file mode 100644 index 0000000..d125cbe --- /dev/null +++ b/h/drv/pci/mpc107Pci.h @@ -0,0 +1,170 @@ +/* mpc107pci.h - MPC107 register Definitions for PCI */ + +/* Copyright 1984-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,11sep00,rcs fix includes +01a,06jun00,bri written +*/ + +#ifndef __INCmpc107Pcih +#define __INCmpc107Pcih + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "drv/multi/mpc107.h" + +/* defines */ + + +/* PCI Definitions */ + +/* PCI CONFIG_ADDR & CONFIG_DATA */ + +#define MPC107_PCI_MSTR_CFG_ADRS mpc107PciMstrCfgAdrs /* Config Address */ +#define MPC107_PCI_MSTR_CFG_ADRS_A 0x80800000 /* Config Address MAP A */ +#define MPC107_PCI_MSTR_CFG_ADRS_B 0xfec00000 /* Config Address MAP B */ +#define MPC107_PCI_MSTR_CFG_SIZE mpc107PciMstrCfgSize /* Config size */ +#define MPC107_PCI_MSTR_CFG_SIZE_A 0x007fffff /* 8MB for PREP map */ +#define MPC107_PCI_MSTR_CFG_SIZE_B 0x002fffff /* 3MB for CHRP map */ + +/* PCI IO space ,CPU View */ + +#define MPC107_PCI_MSTR_IO_LOCAL mpc107PciMstrIoLocal/* CPU to PCI IO addr */ +#define MPC107_PCI_MSTR_IO_LOCAL_A 0x81000000 /* I/O Address MAP A */ +#define MPC107_PCI_MSTR_IO_LOCAL_B 0xfe800000 /* I/O Address MAP B */ +#define MPC107_PCI_MSTR_IO_SIZE mpc107PciMstrIoSize /* I/O SIZE */ +#define MPC107_PCI_MSTR_IO_SIZE_A 0x3E7FFFFF /* I/O SIZE MAP A */ +#define MPC107_PCI_MSTR_IO_SIZE_B 0x003fffff /* I/O SIZE MAP B */ + +/* PCI IO space ,PCI Bus View */ + +#define MPC107_PCI_MSTR_IO_BUS mpc107PciMstrIoBus /* PCI bus view I/O space */ +#define MPC107_PCI_MSTR_IO_BUS_A 0x01000000 /* PCI bus view I/O space MAP A */ +#define MPC107_PCI_MSTR_IO_BUS_B 0x00800000 /* PCI bus view I/O space MAP B */ + + +/* PCI IACK space (read to generate PCI IACK) */ + +#define MPC107_PCI_MSTR_IACK_LOCAL mpc107PciMstrIackLocal /* IACK space */ +#define MPC107_PCI_MSTR_IACK_LOCAL_A 0xbffffff0 /* IACK space MAP A */ +#define MPC107_PCI_MSTR_IACK_LOCAL_B 0xfef00000 /* IACK space MAP B */ +#define MPC107_PCI_MSTR_IACK_SIZE_A 0xf /* IACK size MAP A */ +#define MPC107_PCI_MSTR_IACK_SIZE_B 0xfffff /* IACK size for MAP B */ +#define MPC107_PCI_MSTR_IACK_SIZE mpc107PciMstrIackSize /* IACK size */ + +/* PCI (non-prefetchable) memory space CPU view */ + +#define MPC107_PCI_MSTR_MEMIO_LOCAL mpc107PciMstrMemIoLocal /* PCI memio */ +#define MPC107_PCI_MSTR_MEMIO_LOCAL_A 0xc0000000 /* Mem space MAP A */ +#define MPC107_PCI_MSTR_MEMIO_LOCAL_B 0x80000000 /* Mem space MAP B */ +#define MPC107_PCI_MSTR_MEMIO_SIZE mpc107PciMemorySize /* Mem size */ +#define MPC107_PCI_MSTR_MEMIO_SIZE_A 0x3EFFFFFF /* Mem size MAP A */ +#define MPC107_PCI_MSTR_MEMIO_SIZE_B 0x7CFFFFFF /* Mem size MAP B */ + +/* PCI (non-prefetchable) memory space PCI view */ + +#define MPC107_PCI_MSTR_MEMIO_BUS mpc107PciMstrMemIoBus/* PCI view Memory */ +#define MPC107_PCI_MSTR_MEMIO_BUS_A 0x0 /* PCI bus view Memory MAP A */ +#define MPC107_PCI_MSTR_MEMIO_BUS_B 0x80000000 /* PCI bus view Memory MAP B */ + +/* + * Slave window that makes local (60x bus) memory visible to PCI + * devices. + */ + +#define MPC107_PCI_SLV_MEM_BUS mpc107PciSlvMemBus /* PCI to CPU memory */ +#define MPC107_PCI_SLV_MEM_BUS_A 0x80000000 /* PCI to CPU memory MAP A */ +#define MPC107_PCI_SLV_MEM_BUS_B 0x00000000 /* PCI to CPU memory MAP B */ +#define MPC107_PCI_SLV_MEM_SIZE MPC107_LOCAL_MEM_SIZE /* memory SIZE */ + +/* macro definitions specifically for pciConfigLib and pciAutoConfigLib */ + +/* pciAutoConfigLib */ + +/* PCI prefetchable memory space */ + +#define MPC107_PCI_MEM_ADRS 0 /* Prefetchable memory Address */ +#define MPC107_PCI_MEM_SIZE 0 /* Prefetchable Memory Size */ + +/* PCI (non-prefetchable) memory space */ + +#define MPC107_PCI_MEMIO_ADRS (MPC107_PCI_MSTR_MEMIO_BUS + \ + MPC107_PCI_RSRVD_MEM)/* Address */ + +#define MPC107_PCI_MEMIO_SIZE (MPC107_PCI_MSTR_MEMIO_SIZE - \ + MPC107_PCI_RSRVD_MEM)/* Size */ + + +/* PCI IO space */ + +#define MPC107_PCI_IO_ADRS \ + (MPC107_PCI_MSTR_IO_BUS + MPC107_PCI_RSRVD_IO) /* Address */ + +#define MPC107_PCI_IO_SIZE \ + (MPC107_PCI_MSTR_IO_SIZE - MPC107_PCI_RSRVD_IO) /* Size */ + +#define MPC107_PCI_LAT_TIMER 0xff /* default latency timer value */ +#define MPC107_PCI_MAX_BUS 0xf /* MAX # of PCI buses expected */ +#define MPC107_NUM_PCI_SLOTS 0x4 /* 4 PCI slots: 0 to 3 */ + + +/* Reserved from pciAutoConfig */ + +#define MPC107_PCI_RSRVD_MEM 0 /* PCI Memory Reserved from pciAutoConfig */ +#define MPC107_PCI_RSRVD_IO 0 /* PCI I/O reserved from pciAutoConfig */ + + +/* PCI Access macro's */ + +/* PCI (non-prefetchable) memory adrs to CPU (60x bus) adrs */ + +#define MPC107_PCI_MEMIO2LOCAL(x) \ + ((INT32)(x) + MPC107_PCI_MSTR_MEMIO_LOCAL - MPC107_PCI_MSTR_MEMIO_BUS) + +/* PCI IO memory adrs to CPU (60x bus) adrs */ + +#define MPC107_PCI_IO2LOCAL(x) \ + ((INT32)(x) + MPC107_PCI_MSTR_IO_LOCAL - MPC107_PCI_MSTR_IO_BUS) + +/* 60x bus adrs to PCI (non-prefetchable) memory address */ + +#define MPC107_LOCAL2PCI_MEMIO(x) \ + ((INT32)(x) + MPC107_PCI_SLV_MEM_BUS) + +/* PCI device configuration definitions */ + +#ifndef PCI_CFG_FORCE +# define PCI_CFG_FORCE 0x0 /* UNSUPPORTED */ +#endif + +#ifndef PCI_CFG_AUTO +# define PCI_CFG_AUTO 0x1 /* IS SUPPORTED */ +#endif + +#ifndef PCI_CFG_NONE +# define PCI_CFG_NONE 0x2 /* UNSUPPORTED */ +#endif + +/* PCI configuration type */ + +#ifndef PCI_CFG_TYPE +#define PCI_CFG_TYPE PCI_CFG_AUTO +#endif + +/* function declrations */ + +IMPORT void mpc107MemMapDetect(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmpc107Pcih */ + diff --git a/h/drv/pci/pciAutoConfigLib.h b/h/drv/pci/pciAutoConfigLib.h new file mode 100644 index 0000000..bb90f86 --- /dev/null +++ b/h/drv/pci/pciAutoConfigLib.h @@ -0,0 +1,193 @@ +/* pciAutoConfigLib.h - PCI bus automatic resource allocation facility */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ +/* Copyright 1997,1998 Motorola, Inc. All Rights Reserved */ + +/* +modification history +-------------------- +01g,16oct01,tor Added support macros for pciAutoCfgCtl(), see + pciAutoConfigLib.c for details. +01f,07may99,tm Added pciAutoAddrAlign to perform alignment checking + pciAutoFuncDis-/En-able, pciAutoRegConfig public (SPR 26484) +01e,30mar99,dat SPR 25312, changed class to pciClass +01d,29jul98,scb added roll call capability +01c,29jul98,tm code review changes / added _DEV_DISPLAY attribute +01b,24jul98,tm added int routing offset to PCI_LOC structure + added autoIntRouting boolean to PCI_SYSTEM structure + added protos for pciAutoBusNumberSet, pciAutoDevReset +01a,19feb98,dat written, from Motorola. +*/ + +#ifndef __INCpciAutoConfigLibh +#define __INCpciAutoConfigLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* PCI_LOC attributes */ + +#define PCI_AUTO_ATTR_DEV_EXCLUDE (UINT8)(0x01) /* Exclude this device */ +#define PCI_AUTO_ATTR_DEV_DISPLAY (UINT8)(0x02) /* (S)VGA disp device */ +#define PCI_AUTO_ATTR_DEV_PREFETCH (UINT8)(0x04) /* Device requests PF */ + +#define PCI_AUTO_ATTR_BUS_PREFETCH (UINT8)(0x08) /* Bridge implements */ +#define PCI_AUTO_ATTR_BUS_PCI (UINT8)(0x10) /* PCI-PCI Bridge */ +#define PCI_AUTO_ATTR_BUS_HOST (UINT8)(0x20) /* PCI Host Bridge */ +#define PCI_AUTO_ATTR_BUS_ISA (UINT8)(0x40) /* PCI-ISA Bridge */ +#define PCI_AUTO_ATTR_BUS_4GB_IO (UINT8)(0x80) /* 4G/64K IO Adresses */ + + +/* OPTION COMMANDS for use with pciAutoCfgCtl() */ + +/* 0 used for pSystem structure copy */ +#define PCI_PSYSTEM_STRUCT_COPY 0x0000 + +/* 1-7 reserved for Fast Back To Back functions */ +#define PCI_FBB_ENABLE 0x0001 +#define PCI_FBB_DISABLE 0x0002 +#define PCI_FBB_UPDATE 0x0003 +#define PCI_FBB_STATUS_GET 0x0004 + +/* 8-11 reserved for MAX_LAT */ +#define PCI_MAX_LATENCY_FUNC_SET 0x0008 +#define PCI_MAX_LATENCY_ARG_SET 0x0009 +#define PCI_MAX_LAT_ALL_SET 0x000a +#define PCI_MAX_LAT_ALL_GET 0x000b + +/* 12-15 reserved for message output (logMsg) */ +#define PCI_MSG_LOG_SET 0x000c + +/* 16-47 reserved for pSystem functionality */ +#define PCI_MAX_BUS_SET 0x0010 +#define PCI_MAX_BUS_GET 0x0011 +#define PCI_CACHE_SIZE_SET 0x0012 +#define PCI_CACHE_SIZE_GET 0x0013 +#define PCI_AUTO_INT_ROUTE_SET 0x0014 +#define PCI_AUTO_INT_ROUTE_GET 0x0015 +#define PCI_MEM32_LOC_SET 0x0016 +#define PCI_MEM32_SIZE_SET 0x0017 +#define PCI_MEMIO32_LOC_SET 0x0018 +#define PCI_MEMIO32_SIZE_SET 0x0019 +#define PCI_IO32_LOC_SET 0x001a +#define PCI_IO32_SIZE_SET 0x001b +#define PCI_IO16_LOC_SET 0x001c +#define PCI_IO16_SIZE_SET 0x001d +#define PCI_INCLUDE_FUNC_SET 0x001e +#define PCI_INT_ASSIGN_FUNC_SET 0x001f +#define PCI_BRIDGE_PRE_CONFIG_FUNC_SET 0x0020 +#define PCI_BRIDGE_POST_CONFIG_FUNC_SET 0x0021 +#define PCI_ROLLCALL_FUNC_SET 0x0022 + +/* 48-511 reserved for other memory configuration */ +#define PCI_MEM32_SIZE_GET 0x0030 +#define PCI_MEMIO32_SIZE_GET 0x0031 +#define PCI_IO32_SIZE_GET 0x0032 +#define PCI_IO16_SIZE_GET 0x0033 + +/* 512-0xffff available for misc items */ +#define PCI_TEMP_SPACE_SET 0x0200 +#define PCI_MINIMIZE_RESOURCES 0x0201 + +#ifndef _ASMLANGUAGE + +typedef struct pciMemPtr + { + void * pMem; + int memSize; + } PCI_MEM_PTR; + +typedef struct /* PCI_LOC, a standard bus location */ + { + UINT8 bus; + UINT8 device; + UINT8 function; + UINT8 attribute; + UINT8 offset; /* interrupt routing for this device */ + } PCI_LOC; + +/* PCI identification structure */ + +typedef struct + { + PCI_LOC loc; + UINT devVend; + } PCI_ID; + + +/* obsolete structure */ +typedef struct pciSystem /* PCI_SYSTEM, auto configuration info */ + { + UINT pciMem32; /* 32 bit prefetchable memory location */ + UINT pciMem32Size; /* 32 bit prefetchable memory size */ + UINT pciMemIo32; /* 32 bit non-prefetchable memory location */ + UINT pciMemIo32Size; /* 32 bit non-prefetchable memory size */ + UINT pciIo32; /* 32 bit io location */ + UINT pciIo32Size; /* 32 bit io size */ + UINT pciIo16; /* 16 bit io location */ + UINT pciIo16Size; /* 16 bit io size */ + int maxBus; /* Highest subbus number */ + int cacheSize; /* cache line size */ + UINT maxLatency; /* max latency */ + BOOL autoIntRouting; /* automatic routing strategy */ + STATUS (* includeRtn) /* returns OK to include */ + ( + struct pciSystem * pSystem, + PCI_LOC * pLoc, + UINT devVend + ); + UCHAR (* intAssignRtn) /* returns int line, given int pin */ + ( + struct pciSystem * pSystem, + PCI_LOC * pLoc, + UCHAR pin + ); + void (* bridgePreConfigInit) /* bridge pre-enumeration initialization */ + ( + struct pciSystem * pSystem, + PCI_LOC * pLoc, + UINT devVend + ); + void (* bridgePostConfigInit)/* bridge post-enumeration initialization */ + ( + struct pciSystem * pSystem, + PCI_LOC * pLoc, + UINT devVend + ); + STATUS (* pciRollcallRtn) (); /* Roll call check */ + } PCI_SYSTEM; + +typedef int (*PCI_LOGMSG_FUNC)(char *fmt, int i1, int i2, int i3, int i4, int i5, int i6); +typedef UINT8 (*PCI_MAX_LAT_FUNC)(int bus, int device, int func, void *pArg); +typedef UINT32 (*PCI_MEM_BUS_EXTRA_FUNC)(int bus, int device, int func, void *pArg); +typedef STATUS (*PCI_INCLUDE_FUNC)(PCI_SYSTEM *pSystem, PCI_LOC *pLoc, UINT devVend); +typedef UCHAR (*PCI_INT_ASSIGN_FUNC)(PCI_SYSTEM *pSystem, PCI_LOC *pLoc, UINT devVend); +typedef void (*PCI_BRIDGE_PRE_CONFIG_FUNC)(PCI_SYSTEM *pSystem, PCI_LOC *pLoc, UINT devVend); +typedef void (*PCI_BRIDGE_POST_CONFIG_FUNC)(PCI_SYSTEM *pSystem, PCI_LOC *pLoc, UINT devVend); +typedef STATUS (*PCI_ROLL_CALL_FUNC)(); + +void pciAutoConfig (PCI_SYSTEM *); +STATUS pciAutoGetNextClass ( PCI_SYSTEM *pSystem, PCI_LOC *pciFunc, + UINT *index, UINT pciClass, UINT mask); +STATUS pciAutoBusNumberSet ( PCI_LOC * pPciLoc, UINT primary, UINT secondary, + UINT subordinate); +STATUS pciAutoDevReset ( PCI_LOC * pPciLoc); +STATUS pciAutoAddrAlign ( UINT32 base, UINT32 limit, UINT32 reqSize, + UINT32 *pAlignedBase ); +void pciAutoFuncEnable ( PCI_SYSTEM * pSystem, PCI_LOC * pFunc); +void pciAutoFuncDisable ( PCI_LOC *pPciFunc); +UINT pciAutoRegConfig ( PCI_SYSTEM * pSystem, PCI_LOC *pPciFunc, + UINT baseAddr, UINT nSize, UINT addrInfo); + +void * pciAutoConfigLibInit(void * pArg); +STATUS pciAutoCfgCtl ( void *pCookie, int cmd, void *pArg ); +STATUS pciAutoCfg( void *pCookie ); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpciAutoConfigLibh */ diff --git a/h/drv/pci/pciConfigLib.h b/h/drv/pci/pciConfigLib.h new file mode 100644 index 0000000..f53e7f9 --- /dev/null +++ b/h/drv/pci/pciConfigLib.h @@ -0,0 +1,411 @@ +/* pciConfigLib.h - PCI bus constants header file */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02k,25jul05,mdo Add a more generic Bridge define +02j,23jun05,mdo Adding additional Configuration defines for capabilities. +02i,04apr05,mdo SPR# 106123 - Incorrect bit assignment for + PCI_STATUS_PARITY_ERROR +02h,23jun03,m_h Cardbus support +02g,16oct01,tor Added pciConfigForeachFunc() decl (SPR #8406, et.al.). +02f,26apr00,rcs added #define PCI_CFG_SEC_BUS_RESET SPR 31294 +02e,11apr00,gmk merged from haft branch +02d,29jan00,tm Added Extended Capabilities Pointer (ECP) support for HS-CSR +02c,18aug99,mas merged generic and expanded PCI V2.1 class defs from DMS and + placed results in new file: target/h/pciClass.h +02b,02apr99,tm PCI_CACHE_LINE_SIZE define now more arch-specific (SPR 26291) +02a,10feb99,tm added PCI_BAR_MEM_PREF_MASK and PCI_BAR_ALL_MASK (SPR 25033) +01z,27aug98,tm changed PCI_MAX_BUS default to 255 (SPR 22256) +01y,28jul98,tm PCI_MAX_BUS,.._DEV, .._FUNC moved here from pciConfigLib.c to + allow config.h (included before this file) values to override +01x,24jul98,tm added networking subclass definitions +01w,12jul98,dat added compatibility for pciConfigBDFPack. +01v,29may98,tm added prototypes for pciConfigModify{Byte, Word} +01u,05may98,tm added PCI_MAX_DEV, PCI_MAX_FUNC +01t,24apr98,tm merged BSP rls changes from dat: removed non-ANSI protos (?) +01s,11apr98,tm added prototype for pciDevConfig, SPR 9098 +01r,24mar98,tm added pciConfigModifyLong in support of autoconfig +01q,23mar98,tm added PCI subclass, BAR definitions in support of autoconfig +01p,11mar98,tm renamed from pciIomapLib.h to pciConfigLib.h + scope changed: LOCAL int pciPack() --> int pciConfigBdfPack() +01o,08mar98,tm moved PCI_IN_*, PCI_OUT_* macros here from pciIomapLib.c +01n,04mar98,tm moved pciIomapShow.c prototypes to pciIomapShow.h +01m,04mar98,tm updated argument types on all I/O functions +01l,04mar98,dat added PCI_MECHANISM_0 for user defined config mechanism +01k,04mar98,tm moved config space header definitions to pciHeaderDefs.h +01j,24feb98,tm moved interrupt handling functions to pciIntLib.{c,h} + added PCI class definitions +01i,06dec97,rlp added SNOOZE_MODE, SLEEP_MODE_DIS and PCI_CFG_MODE. +01h,25jun97,jpd added PCI_MECHANISM_3, increased PCI_IRQ_LINES to 32. +01g,12jan97,hdn changed member/variable name "vender" to "vendor". +01f,12jan97,hdn changed member/variable name "class" to "classCode". +01e,03dec96,hdn added header-type bits definitions. +01d,13nov96,hdn added command-bit and address-mask definitions. +01c,06aug96,hdn added a structure PCI_INT_NODE. +01b,28mar96,hdn removed BIOS dependent stuff. +01a,23nov94,bcs written. +*/ + +#ifndef __INCpciConfigLibh +#define __INCpciConfigLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes */ + +#include + + +/* + * Bus Topology Constraints + * + * The following defines specify, by default, the maximum number of busses, + * devices and functions allowed by the PCI 2.1 Specification. + * + * NOTE: config.h MUST be included before this file if either PCI_MAX_BUS, + * PCI_MAX_DEV, or PCI_MAX_FUNC is changed to a BSP-specific value in + * config.h + * + */ + +#ifndef PCI_MAX_BUS +# define PCI_MAX_BUS 255 +#endif /* PCI_MAX_BUS */ + +#ifndef PCI_MAX_DEV +# define PCI_MAX_DEV 32 +#endif /* PCI_MAX_DEV */ + +#ifndef PCI_MAX_FUNC +# define PCI_MAX_FUNC 8 +#endif /* PCI_MAX_FUNC */ + +/* PCI Configuration mechanisms */ + +#define PCI_MECHANISM_0 0 /* non-std user-supplied interface */ +#define PCI_MECHANISM_1 1 /* current PC-AT hardware mechanism */ +#define PCI_MECHANISM_2 2 /* deprecated */ + +/* Configuration I/O addresses for mechanism 1 */ + +#define PCI_CONFIG_ADDR 0x0cf8 /* write 32 bits to set address */ +#define PCI_CONFIG_DATA 0x0cfc /* 8, 16, or 32 bit accesses */ + +/* Configuration I/O addresses for mechanism 2 */ + +#define PCI_CONFIG_CSE 0x0cf8 /* CSE register */ +#define PCI_CONFIG_FORWARD 0x0cfa /* forward register */ +#define PCI_CONFIG_BASE 0xc000 /* base register */ + +/* PCI command bits */ + +#define PCI_CMD_IO_ENABLE 0x0001 /* IO access enable */ +#define PCI_CMD_MEM_ENABLE 0x0002 /* memory access enable */ +#define PCI_CMD_MASTER_ENABLE 0x0004 /* bus master enable */ +#define PCI_CMD_MON_ENABLE 0x0008 /* monitor special cycles enable */ +#define PCI_CMD_WI_ENABLE 0x0010 /* write and invalidate enable */ +#define PCI_CMD_SNOOP_ENABLE 0x0020 /* palette snoop enable */ +#define PCI_CMD_PERR_ENABLE 0x0040 /* parity error enable */ +#define PCI_CMD_WC_ENABLE 0x0080 /* wait cycle enable */ +#define PCI_CMD_SERR_ENABLE 0x0100 /* system error enable */ +#define PCI_CMD_FBTB_ENABLE 0x0200 /* fast back to back enable */ + +/* PCI status bits */ + +#define PCI_STATUS_NEW_CAP 0x0010 +#define PCI_STATUS_66_MHZ 0x0020 +#define PCI_STATUS_UDF 0x0040 +#define PCI_STATUS_FAST_BB 0x0080 +#define PCI_STATUS_DATA_PARITY_ERR 0x0100 +#define PCI_STATUS_TARGET_ABORT_GEN 0x0800 +#define PCI_STATUS_TARGET_ABORT_RCV 0x1000 +#define PCI_STATUS_MASTER_ABORT_RCV 0x2000 +#define PCI_STATUS_ASSERT_SERR 0x4000 +#define PCI_STATUS_PARITY_ERROR 0x8000 + +/* PCI base address mask bits */ + +#define PCI_MEMBASE_MASK ~0xf /* mask for memory base address */ +#define PCI_IOBASE_MASK ~0x3 /* mask for IO base address */ +#define PCI_BASE_IO 0x1 /* IO space indicator */ +#define PCI_BASE_BELOW_1M 0x2 /* memory locate below 1MB */ +#define PCI_BASE_IN_64BITS 0x4 /* memory locate anywhere in 64 bits */ +#define PCI_BASE_PREFETCH 0x8 /* memory prefetchable */ + +/* Base Address Register Memory/IO Attribute bits */ + +#define PCI_BAR_SPACE_MASK (0x01) +#define PCI_BAR_SPACE_IO (0x01) +#define PCI_BAR_SPACE_MEM (0x00) + +#define PCI_BAR_MEM_TYPE_MASK (0x06) +#define PCI_BAR_MEM_ADDR32 (0x00) +#define PCI_BAR_MEM_BELOW_1MB (0x02) +#define PCI_BAR_MEM_ADDR64 (0x04) +#define PCI_BAR_MEM_RESERVED (0x06) + +#define PCI_BAR_MEM_PREF_MASK (0x08) +#define PCI_BAR_MEM_PREFETCH (0x08) +#define PCI_BAR_MEM_NON_PREF (0x00) + +#define PCI_BAR_ALL_MASK (PCI_BAR_SPACE_MASK | \ + PCI_BAR_MEM_TYPE_MASK | \ + PCI_BAR_MEM_PREF_MASK) + +/* PCI header type bits */ + +#define PCI_HEADER_TYPE_MASK 0x7f /* mask for header type */ +#define PCI_HEADER_PCI_CARDBUS 0x02 /* PCI to CardBus bridge */ +#define PCI_HEADER_PCI_PCI 0x01 /* PCI to PCI bridge */ +#define PCI_HEADER_TYPE_BRIDGE 0x01 /* Header Type 1 is not only a PCI2PCI bridge */ +#define PCI_HEADER_TYPE0 0x00 /* normal device header */ +#define PCI_HEADER_MULTI_FUNC 0x80 /* multi function device */ + +/* PCI configuration device and driver */ + +#define SNOOZE_MODE 0x40 /* snooze mode */ +#define SLEEP_MODE_DIS 0x00 /* sleep mode disable */ + +/* Standard device Type 0 configuration register offsets */ +/* Note that only modulo-4 addresses are written to the address register */ + +#define PCI_CFG_VENDOR_ID 0x00 +#define PCI_CFG_DEVICE_ID 0x02 +#define PCI_CFG_COMMAND 0x04 +#define PCI_CFG_STATUS 0x06 +#define PCI_CFG_REVISION 0x08 +#define PCI_CFG_PROGRAMMING_IF 0x09 +#define PCI_CFG_SUBCLASS 0x0a +#define PCI_CFG_CLASS 0x0b +#define PCI_CFG_CACHE_LINE_SIZE 0x0c +#define PCI_CFG_LATENCY_TIMER 0x0d +#define PCI_CFG_HEADER_TYPE 0x0e +#define PCI_CFG_BIST 0x0f +#define PCI_CFG_BASE_ADDRESS_0 0x10 +#define PCI_CFG_BASE_ADDRESS_1 0x14 +#define PCI_CFG_BASE_ADDRESS_2 0x18 +#define PCI_CFG_BASE_ADDRESS_3 0x1c +#define PCI_CFG_BASE_ADDRESS_4 0x20 +#define PCI_CFG_BASE_ADDRESS_5 0x24 +#define PCI_CFG_CIS 0x28 +#define PCI_CFG_SUB_VENDER_ID 0x2c +#define PCI_CFG_SUB_SYSTEM_ID 0x2e +#define PCI_CFG_EXPANSION_ROM 0x30 +#define PCI_CFG_CAP_PTR 0x34 +#define PCI_CFG_RESERVED_0 0x35 +#define PCI_CFG_RESERVED_1 0x38 +#define PCI_CFG_DEV_INT_LINE 0x3c +#define PCI_CFG_DEV_INT_PIN 0x3d +#define PCI_CFG_MIN_GRANT 0x3e +#define PCI_CFG_MAX_LATENCY 0x3f +#define PCI_CFG_SPECIAL_USE 0x41 +#define PCI_CFG_MODE 0x43 + + +/* PCI-to-PCI bridge Type 1 configuration register offsets */ +/* Note that only modulo-4 addresses are written to the address register */ + +#define PCI_CFG_PRIMARY_BUS 0x18 +#define PCI_CFG_SECONDARY_BUS 0x19 +#define PCI_CFG_SUBORDINATE_BUS 0x1a +#define PCI_CFG_SEC_LATENCY 0x1b +#define PCI_CFG_IO_BASE 0x1c +#define PCI_CFG_IO_LIMIT 0x1d +#define PCI_CFG_SEC_STATUS 0x1e +#define PCI_CFG_MEM_BASE 0x20 +#define PCI_CFG_MEM_LIMIT 0x22 +#define PCI_CFG_PRE_MEM_BASE 0x24 +#define PCI_CFG_PRE_MEM_LIMIT 0x26 +#define PCI_CFG_PRE_MEM_BASE_U 0x28 +#define PCI_CFG_PRE_MEM_LIMIT_U 0x2c +#define PCI_CFG_IO_BASE_U 0x30 +#define PCI_CFG_IO_LIMIT_U 0x32 +#define PCI_CFG_ROM_BASE 0x38 +#define PCI_CFG_BRG_INT_LINE 0x3c +#define PCI_CFG_BRG_INT_PIN 0x3d +#define PCI_CFG_BRIDGE_CONTROL 0x3e + +/* PCI-to-CardBus bridge Type 2 configuration register offsets */ + +#define PCI_CFG_CB_CAP_PTR 0x14 +/* 0x15 - reserved */ +#define PCI_CFG_CB_SEC_STATUS 0x16 +#define PCI_CFG_CB_PRIMARY_BUS 0x18 /* PCI bus no. */ +#define PCI_CFG_CB_BUS 0x19 /* CardBus bus no */ +#define PCI_CFG_CB_SUBORDINATE_BUS 0x1a /* Subordinate bus no. */ +#define PCI_CFG_CB_LATENCY_TIMER 0x1b /* CardBus latency timer */ +#define PCI_CFG_CB_MEM_BASE_0 0x1c +#define PCI_CFG_CB_MEM_LIMIT_0 0x20 +#define PCI_CFG_CB_MEM_BASE_1 0x24 +#define PCI_CFG_CB_MEM_LIMIT_1 0x28 +#define PCI_CFG_CB_IO_BASE_0 0x2c +#define PCI_CFG_CB_IO_BASE_0_HI 0x2e +#define PCI_CFG_CB_IO_LIMIT_0 0x30 +#define PCI_CFG_CB_IO_LIMIT_0_HI 0x32 +#define PCI_CFG_CB_IO_BASE_1 0x34 +#define PCI_CFG_CB_IO_BASE_1_HI 0x36 +#define PCI_CFG_CB_IO_LIMIT_1 0x38 +#define PCI_CFG_CB_IO_LIMIT_1_HI 0x3a +#define PCI_CFG_CB_BRIDGE_CONTROL 0x3e +#define PCI_CFG_CB_SUB_VENDOR_ID 0x40 +#define PCI_CFG_CB_SUB_SYSTEM_ID 0x42 +#define PCI_CFG_CB_16BIT_LEGACY 0x44 +/* 0x48 - 0x7f are reserved */ + +/* PCI Bridge Control Register (0x3E) bits */ + +#define PCI_CFG_PARITY_ERROR 0x01 /* Enable parity detection on secondary interface */ +#define PCI_CFG_SERR 0x02 /* SERR enable */ +#define PCI_CFG_ISA_ENABLE 0x04 /* ISA Disable - bit set = disable */ +#define PCI_CFG_VGA_ENABLE 0x08 /* Enable VGA addresses */ +#define PCI_CFG_MASTER_ABORT 0x20 /* Signal master abort */ +#define PCI_CFG_SEC_BUS_RESET 0x40 /* secondary bus reset */ +#define PCI_CFG_FAST_BACK 0x80 /* FBB enabled on secondary */ +#define PCI_CFG_PRI_DIS_TO 0x100 /* Primary Discard Timeout: 2^10 PCI cycles */ +#define PCI_CFG_SEC_DIS_TO 0x200 /* 2ndary Discard Timeout: 2^10 PCI cycles */ +#define PCI_CFG_DIS_TIMER_STAT 0x400 /* Discard Timer status */ +#define PCI_CFG_DIS_TIMER_ENABLE 0x800 /* Discard Timer enable */ + +/* Cardbus Bridge Control Register (0x3E) bits */ + +#define PCI_CFG_CB_PARITY_ERROR 0x01 /* Enable parity detection on secondary interface */ +#define PCI_CFG_CB_SERR 0x02 /* SERR enable */ +#define PCI_CFG_CB_ISA_ENABLE 0x04 /* ISA Disable - bit set = disable */ +#define PCI_CFG_CB_VGA_ENABLE 0x08 /* Enable VGA addresses */ +#define PCI_CFG_CB_MASTER_ABORT 0x20 /* Signal master abort */ +#define PCI_CFG_CB_RESET 0x40 /* Cardbus reset */ +#define PCI_CFG_CB_16BIT_INT 0x80 /* Enable ints for 16-bit cards */ +#define PCI_CFG_CB_PREFETCH0 0x0100 /* Memory 0 prefetch enable */ +#define PCI_CFG_CB_PREFETCH1 0x0200 /* Memory 1 prefetch enable */ +#define PCI_CFG_CB_POST_WRITES 0x0400 /* Posted Writes */ + +/* Extended Capability IDs */ + +#define PCI_EXT_CAP_PCI_PM 0x01 +#define PCI_EXT_CAP_AGP 0x02 +#define PCI_EXT_CAP_VPD 0x03 +#define PCI_EXT_CAP_SLOTID 0x04 +#define PCI_EXT_CAP_MSI 0x05 +#define PCI_EXT_CAP_HOT_SWAP 0x06 +#define PCI_EXT_CAP_PCIX 0x07 +#define PCI_EXT_CAP_DBG_PORT 0x0A +#define PCI_EXT_CAP_CPCI_RES 0x0B +#define PCI_EXT_CAP_HPC 0x0C /* Hot-Plug Ctrl */ +#define PCI_EXT_CAP_EXP 0x10 /* PCI Express */ +#define PCI_EXT_CAP_MSIX 0x11 /* MSI-X */ + +/* CompactPCI Hot Swap Control & Status Register (HSCSR) defines */ + +#define PCI_HS_CSR_RSVD0 0x01 /* Reserved */ +#define PCI_HS_CSR_EIM 0x02 /* ENUM Interrupt Mask */ +#define PCI_HS_CSR_RSVD2 0x04 /* Reserved */ +#define PCI_HS_CSR_LOO 0x08 /* Blue LED On/Off */ +#define PCI_HS_CSR_RSVD4 0x10 /* Reserved */ +#define PCI_HS_CSR_RSVD5 0x20 /* Reserved */ +#define PCI_HS_CSR_EXT 0x40 /* ENUM Status - EXTract */ +#define PCI_HS_CSR_INS 0x80 /* ENUM Status - INSert */ + +/* Conditional defines for new configuration definitions */ + +/* Cache Line Size */ + +#ifndef PCI_CACHE_LINE_SIZE +# if defined(_CACHE_ALIGN_SIZE) +# define PCI_CACHE_LINE_SIZE (_CACHE_ALIGN_SIZE >> 2) +# else +# define PCI_CACHE_LINE_SIZE (32 >> 2) +# endif +#endif /* PCI_CACHE_LINE_SIZE */ + +/* Latency Timer value - 255 PCI clocks */ +#ifndef PCI_LATENCY_TIMER +#define PCI_LATENCY_TIMER 0xff +#endif /* PCI_LATENCY_TIMER */ + +#ifndef _ASMLANGUAGE + +/* + * Configuration space access macros + */ + +#ifndef PCI_IN_BYTE +#define PCI_IN_BYTE(x) sysInByte (x) +#endif + +#ifndef PCI_IN_WORD +#define PCI_IN_WORD(x) sysInWord (x) +#endif + +#ifndef PCI_IN_LONG +#define PCI_IN_LONG(x) sysInLong (x) +#endif + +#ifndef PCI_OUT_BYTE +#define PCI_OUT_BYTE(x,y) sysOutByte (x,y) +#endif + +#ifndef PCI_OUT_WORD +#define PCI_OUT_WORD(x,y) sysOutWord (x,y) +#endif + +#ifndef PCI_OUT_LONG +#define PCI_OUT_LONG(x,y) sysOutLong (x,y) +#endif + +STATUS pciConfigLibInit (int mechanism, ULONG addr0, ULONG addr1, ULONG addr2); +STATUS pciFindDevice (int vendorId, int deviceId, int index, + int * pBusNo, int * pDeviceNo, int * pFuncNo); +STATUS pciFindClass (int classCode, int index, + int * pBusNo, int * pDeviceNo, int * pFuncNo); +STATUS pciConfigInByte (int busNo, int deviceNo, int funcNo, int address, + UINT8 * pData); +STATUS pciConfigInWord (int busNo, int deviceNo, int funcNo, int address, + UINT16 * pData); +STATUS pciConfigInLong (int busNo, int deviceNo, int funcNo, int address, + UINT32 * pData); +STATUS pciConfigOutByte (int busNo, int deviceNo, int funcNo, int address, + UINT8 data); +STATUS pciConfigOutWord (int busNo, int deviceNo, int funcNo, int address, + UINT16 data); +STATUS pciConfigOutLong (int busNo, int deviceNo, int funcNo, int address, + UINT32 data); +STATUS pciSpecialCycle (int busNo, UINT32 message); +int pciConfigBdfPack(int busNo, int deviceNo, int funcNo); +STATUS pciDevConfig ( int pciBusNo, int pciDevNo, int pciFuncNo, + UINT32 devIoBaseAdrs, UINT32 devMemBaseAdrs, + UINT32 command ); +STATUS pciConfigExtCapFind (UINT8 extCapFindId, int bus, int device, + int function, UINT8 * pOffset); + +STATUS pciConfigModifyLong ( int busNo, int deviceNo, int funcNo, int offset, + UINT32 bitMask, UINT32 data ); +STATUS pciConfigModifyWord ( int busNo, int deviceNo, int funcNo, int offset, + UINT16 bitMask, UINT16 data ); +STATUS pciConfigModifyByte ( int busNo, int deviceNo, int funcNo, int offset, + UINT8 bitMask, UINT8 data ); + +/* foreach function */ +typedef STATUS (*PCI_FOREACH_FUNC)(int bus, int dev, int func, void *pArg); + +STATUS pciConfigForeachFunc ( UINT8 bus, BOOL recurse, + PCI_FOREACH_FUNC funcCheckFunc, + void *pArg + ); +#endif /* _ASMLANGUAGE */ + +/* For backward compatibility pciConfigBDFPack == pciConfigBdfPack */ + +#define pciConfigBDFPack pciConfigBdfPack + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpciConfigLibh */ + + diff --git a/h/drv/pci/pciConfigShow.h b/h/drv/pci/pciConfigShow.h new file mode 100644 index 0000000..46ec9f2 --- /dev/null +++ b/h/drv/pci/pciConfigShow.h @@ -0,0 +1,44 @@ +/* pciConfigShow.h - PCI bus show routines*/ + +/* Copyright 1984-1998 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,11mar98,tm renamed to pciConfigShow.h from pciIomapShow.h +01a,04mar98,tm derived from pciIomapLib.h v01m +*/ + +#ifndef __INCpciConfigShowh +#define __INCpciConfigShowh + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifndef _ASMLANGUAGE + +#if defined(__STDC__) || defined(__cplusplus) + +STATUS pciDeviceShow (int busNo); +STATUS pciHeaderShow (int busNo, int deviceNo, int funcNo); +STATUS pciFindDeviceShow(int vendorId, int deviceId, int index); +STATUS pciFindClassShow (int classCode, int index); + +#else /* __STDC__ */ + +STATUS pciDeviceShow (); +STATUS pciHeaderShow (); +STATUS pciFindDeviceShow(); +STATUS pciFindClassShow (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpciConfigShowh */ diff --git a/h/drv/pci/pciExpressLib.h b/h/drv/pci/pciExpressLib.h new file mode 100644 index 0000000..eacaf59 --- /dev/null +++ b/h/drv/pci/pciExpressLib.h @@ -0,0 +1,250 @@ +/* pciExpressLib.h - PCI Express bus constants header file */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,22aug05,mdo Fix defines for gnu +01a,23jun05,mdo Written. +*/ + +#ifndef __INCpciExpressLibh +#define __INCpciExpressLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef BIT +#define BIT (bitNumber) (1 << (bitNumber)) +#endif + +/* PCI Express Capability Register */ + +#define PCI_EXP_CAP_VER 0x000f /* PCI Express Capability Version */ + #define PCI_EXP_VER_1 0x1 /* PCI Express Version - must be 0x1 */ +#define PCI_EXP_CAP_PORT_TYPE 0x00f0 /* Device Port type */ + #define PCI_EXP_TYPE_ENDPOINT 0x0 /* Express Endpoint */ + #define PCI_EXP_TYPE_LEG_END 0x1 /* Legacy Endpoint */ + #define PCI_EXP_TYPE_ROOT_PORT 0x4 /* Root Port */ + #define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */ + #define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ + #define PCI_EXP_TYPE_EXP2PCI 0x7 /* Express-to-PCI/PCI-X Bridge */ + #define PCI_EXP_TYPE_PCI2EXP 0x8 /* PCI/PCI-X Bridge-to-Express */ +#define PCI_EXP_CAP_SLOT_ADDON 0x100 /* Slot implemented */ +#define PCI_EXP_CAP_IRQ 0x3e00 /* Interrupt message no. */ + + +/* PCI Express Device Capabilities Register */ + +#define PCI_EXP_DEVCAP_PAYLOAD 0x07 /* Max_Payload_Size */ + #define PCI_EXP_PAYLOAD_128 0x0 /* 128 bytes max */ + #define PCI_EXP_PAYLOAD_256 0x1 /* 256 bytes max */ + #define PCI_EXP_PAYLOAD_512 0x2 /* 512 bytes max */ + #define PCI_EXP_PAYLOAD_1KB 0x3 /* 1K bytes max */ + #define PCI_EXP_PAYLOAD_2KB 0x4 /* 2K bytes max */ + #define PCI_EXP_PAYLOAD_4KB 0x5 /* 4K bytes max */ +#define PCI_EXP_DEVCAP_PHANTOM 0x18 /* Phantom functions */ + #define PCI_EXP_PHANTOM_NOTAVAIL 0x0 /* Phantom function not available */ + #define PCI_EXP_PHANTOM_MSB 0x1 /* Most Sig Bit of function no.*/ + #define PCI_EXP_PHANTOM_2MSB 0x2 /* 2 Most Sig Bit of function no.*/ + #define PCI_EXP_PHANTOM_3MSB 0x3 /* 3 Most Sig Bit of function no. */ +#define PCI_EXP_DEVCAP_EXT_TAG 0x20 /* Extended tags */ + #define PCI_EXP_EXT_TAG_5BIT 0x0 /* 5 bit Tag */ + #define PCI_EXP_EXT_TAG_8BIT 0x1 /* 8 bit Tag */ +#define PCI_EXP_DEVCAP_L0S 0x1c0 /* EndPt L0s Acceptable Latency */ + #define PCI_EXP_L0S_LT_64NS 0x0 /* Less than 64ns */ + #define PCI_EXP_L0S_64NS_to_128NS 0x1 /* 64ns to less than 128ns */ + #define PCI_EXP_L0S_128NS_to_256NS 0x2 /* 128ns to less than 256ns */ + #define PCI_EXP_L0S_256NS_to_512NS 0x3 /* 256ns to less than 512ns */ + #define PCI_EXP_L0S_512NS_to_1US 0x4 /* 512ns to less than 1us */ + #define PCI_EXP_L0S_1US_to_2US 0x5 /* 1us to less than 2us */ + #define PCI_EXP_L0S_2US_to_4US 0x6 /* 2us to less than 4us */ + #define PCI_EXP_L0S_GT_4US 0x7 /* Greater than 4us */ +#define PCI_EXP_DEVCAP_L1 0xe00 /* EndPt L1 Acceptable Latency */ + #define PCI_EXP_L1_LT_1US 0x0 /* Less than 1us */ + #define PCI_EXP_L1_1US_to_2US 0x1 /* 1us to less than 2us */ + #define PCI_EXP_L1_2US_to_4US 0x2 /* 2us to less than 4us */ + #define PCI_EXP_L1_4US_to_8US 0x3 /* 4us to less than 8us */ + #define PCI_EXP_L1_8US_to_16US 0x4 /* 8us to less than 16us */ + #define PCI_EXP_L1_16US_to_32US 0x5 /* 16us to less than 32us */ + #define PCI_EXP_L1_32US_to_64US 0x6 /* 32us to less than 64us */ + #define PCI_EXP_L1_GT_64US 0x7 /* Greater than 64us */ +#define PCI_EXP_DEVCAP_ATTN_BUTTON 0x1000 /* Attention Button Present */ +#define PCI_EXP_DEVCAP_ATTN_IND 0x2000 /* Attention Indicator Present */ +#define PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Power Indicator Present */ +#define PCI_EXP_DEVCAP_PWR_VAL_LIMIT 0x3fc0000 /* Captured Slot Power Limit Value */ +#define PCI_EXP_DEVCAP_PWR_SCL_LIMIT 0xc000000 /* Captured Slot Power Limit Scale */ + #define PCI_EXP_PWR_SCL_LIMIT_ONE 0x0 /* 1.0 times */ + #define PCI_EXP_PWR_SCL_LIMIT_10TH 0x1 /* 0.1 times */ + #define PCI_EXP_PWR_SCL_LIMIT_100TH 0x2 /* 0.01 times */ + #define PCI_EXP_PWR_SCL_LIMIT_1000TH 0x3 /* 0.001 times */ + /* + * The Slot Power Limit and Slot Power Limit Scale values are either automatically set + * by a "Set Slot Power Limit Message" rec'd from port on downstream end, or + * hardwired to zero. + * + * To calculate Power Limit: + * Pwr Limit (watts) = value of Slot Power Limit x value of Slot Power Limit Scale + */ + + +/* PCI Express Device Control Register */ + +#define PCI_EXP_DEVCTL_CERR_ENB 0x0001 /* Correctable Error Reporting En. */ +#define PCI_EXP_DEVCTL_NFERR_ENB 0x0002 /* Non-Fatal Error Reporting Enable */ +#define PCI_EXP_DEVCTL_FERR_ENB 0x0004 /* Fatal Error Reporting Enable */ +#define PCI_EXP_DEVCTL_URREP_ENB 0x0008 /* Unsupported Request Reporting En. */ +#define PCI_EXP_DEVCTL_RLX_ORD_ENB 0x0010 /* Enable relaxed ordering */ +#define PCI_EXP_DEVCTL_PAYLOAD 0x00e0 /* Max Payload Size */ + /* See Device Capabilities Register for Max Payload bit defines */ +#define PCI_EXP_DEVCTL_EXT_TAG 0x0100 /* Extended Tag Field Enable */ + /* See Device Capabilities Register for Tag Field bit defines */ +#define PCI_EXP_DEVCTL_PHANTOM 0x0200 /* Phantom Functions Enable */ + /* See Device Capabilities Register for Phantom Function bit defines */ +#define PCI_EXP_DEVCTL_AUX_PM_ENB 0x0400 /* Auxiliary Power PM Enable */ +#define PCI_EXP_DEVCTL_NOSNOOP_ENB 0x0800 /* Enable No Snoop */ +#define PCI_EXP_DEVCTL_READ_REQ 0x7000 /* Max Read Request Size */ + #define PCI_EXP_READ_REQ_128 0x0 /* 128 bytes max */ + #define PCI_EXP_READ_REQ_256 0x1 /* 256 bytes max */ + #define PCI_EXP_READ_REQ_512 0x2 /* 512 bytes max */ + #define PCI_EXP_READ_REQ_1KB 0x3 /* 1K bytes max */ + #define PCI_EXP_READ_REQ_2KB 0x4 /* 2K bytes max */ + #define PCI_EXP_READ_REQ_4KB 0x5 /* 4K bytes max */ + + +/* PCI Express Device Status Register */ + +#define PCI_EXP_DEVSTA_CERR_DET 0x1 /* Correctable Error Detected RW1C */ +#define PCI_EXP_DEVSTA_NFERR_DET 0x2 /* Non-Fatal Error Detected RW1C*/ +#define PCI_EXP_DEVSTA_FERR_DET 0x4 /* Fatal Error Detected RW1C */ +#define PCI_EXP_DEVSTA_UNREQ_DET 0x8 /* Unsupported Request Detected */ +#define PCI_EXP_DEVSTA_AUXPWR_DET 0x10 /* AUX Power Detected RO */ +#define PCI_EXP_DEVSTA_TRAN_PEND 0x20 /* Transactions Pending RO */ + + +/* PCI Express Link Capabilities Register */ + +#define PCI_EXP_LNKCAP_LNK_SPD 0xF /* Max Link Speed */ + #define PCI_EXP_LNK_SPD_2PT5GB 0x1 /* 2.5 Gb/s */ +#define PCI_EXP_LNKCAP_LNK_WDTH 0x3F0 /* Max Link Width */ + #define PCI_EXP_LNK_WDTH_1 0x1 /* x1 */ + #define PCI_EXP_LNK_WDTH_2 0x2 /* x2 */ + #define PCI_EXP_LNK_WDTH_4 0x4 /* x4 */ + #define PCI_EXP_LNK_WDTH_8 0x8 /* x8 */ + #define PCI_EXP_LNK_WDTH_12 0xC /* x12 */ + #define PCI_EXP_LNK_WDTH_16 0x10 /* x16 */ + #define PCI_EXP_LNK_WDTH_32 0x20 /* x32 */ +#define PCI_EXP_LNKCAP_ASPM 0xC00 /* Active State Mgmt Support */ + #define PCI_EXP_ASPM_L0 0x1 /* L0s Entry Supported */ + #define PCI_EXP_ASPM_L0_L1 0x3 /* L0s & L1s Supported */ +#define PCI_EXP_LNKCAP_L0_LAT 0x7000 /* L0s Exit Latency */ + /* See Device Capabilities Register for L0 Latency bit defines */ +#define PCI_EXP_LNKCAP_L1_LAT 0x38000 /* L1s Exit Latency */ + /* See Device Capabilities Register for L1 Latency bit defines */ +#define PCI_EXP_LNKCAP_PORTNO 0xFF000000 /* Port Number */ + /* Port Number is assigned in HW */ + + +/* PCI Express Link Control Register */ + +#define PCI_EXP_LNKCTL_ASPM 0x3 /* Active State Mgmt Ctrl */ +#define PCI_EXP_LNKCTL_RCB 0x8 /* Read Completion Boundary */ +#define PCI_EXP_LNKCTL_LNK_DIS 0x10 /* Link Disable */ +#define PCI_EXP_LNKCTL_LNK_TRAIN 0x20 /* Link Retrain; Reads 0 */ +#define PCI_EXP_LNKCTL_CCC 0x40 /* Common Clk Config */ +#define PCI_EXP_LNKCTL_EXT_SYNC 0x80 /* Extended Sync */ + + +/* PCI Express Link Status Register */ + +#define PCI_EXP_LNKSTA_LNK_SPD 0xF /* Link Speed */ + /* See Link Capabilities Register for Link Speed bit defines */ +#define PCI_EXP_LNKSTA_LNK_WDTH 0x3F0 /* Negotiead Link Width */ + /* See Link Capabilities Register for Link Width bit defines */ +#define PCI_EXP_LNKSTA_LNK_TERR 0x400 /* Link Training Error */ +#define PCI_EXP_LNKSTA_LNK_TRAIN 0x800 /* Link Training */ +#define PCI_EXP_LNKSTA_LNK_CLKCFG 0x1000 /* Slot Clk Config. */ + + +/* PCI Express Slot Capabilities Register */ + +#define PCI_EXP_SLTCAP_ATTN_BUT 0x1 /* Attention Button Present */ +#define PCI_EXP_SLTCAP_PWR_CTL 0x2 /* Power Controller Present */ +#define PCI_EXP_SLTCAP_MRL 0x4 /* MRL Sensor Present */ +#define PCI_EXP_SLTCAP_ATTN_IND 0x8 /* Attention Indicator Present */ +#define PCI_EXP_SLTCAP_PWR_IND 0x10 /* Power Indicator Present */ +#define PCI_EXP_SLTCAP_HPL_SUP 0x20 /* Hot Plug Surprise */ +#define PCI_EXP_SLTCAP_HPL_CAP 0x40 /* Hot Plug Capable */ +#define PCI_EXP_SLTCAP_PWR_VAL_LIMIT 0x7F80 /* Slot Pwr Limit Value */ +#define PCI_EXP_SLTCAP_PWR_SCL_LIMIT 0x18000 /* Slot Pwr Limit Scale */ + /* See Device Capabilities Register for Slot Power Scale bit defines */ +#define PCI_EXP_SLTCAP_PHYS_SLOT 0xFFF80000 /* Physical Slot No. */ + + +/* PCI Express Slot Control Register */ + +#define PCI_EXP_SLTCTL_ATTN_BUT_ENB 0x1 /* Attention Button Pressed Enabled */ +#define PCI_EXP_SLTCTL_PWRFLT_DET_ENB 0x2 /* Power Fault Detected Enabled */ +#define PCI_EXP_SLTCTL_MRLSNSR_ENB 0x4 /* MRL Sensor Changed Enabled */ +#define PCI_EXP_SLTCTL_PRES_DET_ENB 0x8 /* Presence Detect Changed Enabled */ +#define PCI_EXP_SLTCTL_CCMPLT_ENB 0x10 /* Command Complete Interrupt Enabled */ +#define PCI_EXP_SLTCTL_HPLINT_ENB 0x20 /* Hot Plug Interrupt Enabled */ +#define PCI_EXP_SLTCTL_ATTN_INDCTL 0xC0 /* Attention Indicator Control */ + #define PCI_EXP_ATTN_INDCTL_ON 0x1 /* Attention Indicator Control */ + #define PCI_EXP_ATTN_INDCTL_BLINK 0x2 /* Attention Indicator Control */ + #define PCI_EXP_ATTN_INDCTL_OFF 0x3 /* Attention Indicator Control */ +#define PCI_EXP_SLTCTL_PWR_INDCTL 0x30 /* Power Indicator Control */ + #define PCI_EXP_PWR_INDCTL_ON 0x1 /* Power Indicator Control */ + #define PCI_EXP_PWR_INDCTL_BLINK 0x2 /* Power Indicator Control */ + #define PCI_EXP_PWR_INDCTL_OFF 0x3 /* Power Indicator Control */ +#define PCI_EXP_SLTCTL_PWR_CTLRCTL 0x400 /* Power Controller Control */ + #define PCI_EXP_PWR_CTLRCTL_ON 0x1 /* Power Controller Control */ + #define PCI_EXP_PWR_CTLRCTL_OFF 0x0 /* Power Controller Control */ + + +/* PCI Express Slot Status Register */ + +#define PCI_EXP_SLTSTA_ATTN_BUT 0x1 /* Attention Button Pressed */ +#define PCI_EXP_SLTCTL_PWRFLT_DET 0x2 /* Power Fault Detected */ +#define PCI_EXP_SLTCTL_MRLSNSR 0x4 /* MRL Sensor Changed */ +#define PCI_EXP_SLTCTL_PRES_DET 0x8 /* Presence Detect Changed */ +#define PCI_EXP_SLTCTL_CCMPLT 0x10 /* Command Completed */ +#define PCI_EXP_SLTCTL_MRLSNSR_STAT 0x20 /* MRL Sensor Status */ + #define PCI_EXP_MRLSNSR_STAT_CLSD 0x0 /* MRL Sensor Status */ + #define PCI_EXP_MRLSNSR_STAT_OPEN 0x1 /* MRL Sensor Status */ +#define PCI_EXP_SLTCTL_PRES_DET_STAT 0x40 /* Presence Detect Status */ + #define PCI_EXP_PRES_DET_STAT_EMPTY 0x0 /* Presence Detect Status */ + #define PCI_EXP_PRES_DET_STAT_PRES 0x1 /* Presence Detect Status */ + + +/* PCI Express Root Control Register */ +#define PCI_EXP_RTCTL 28 /* Root Control */ +#define PCI_EXP_RTCTL_SECEE 0x01 /* System Error on Correctable Error */ +#define PCI_EXP_RTCTL_SENFEE 0x02 /* System Error on Non-Fatal Error */ +#define PCI_EXP_RTCTL_SEFEE 0x04 /* System Error on Fatal Error */ +#define PCI_EXP_RTCTL_PMEIE 0x08 /* PME Interrupt Enable */ +#define PCI_EXP_RTCTL_CRSSVE 0x10 /* CRS Software Visibility Enable */ + +/* PCI Express Root Status Register */ +#define PCI_EXP_RTSTA 32 /* Root Status */ + + +/* Extended Capabilities (PCI-X 2.0 and Express) */ +#define PCI_EXT_CAP_ID(header) (header & 0x0000ffff) +#define PCI_EXT_CAP_VER(header) ((header >> 16) & 0xf) +#define PCI_EXT_CAP_NEXT(header) ((header >> 20) & 0xffc) + +#define PCI_EXT_CAP_ID_ERR 1 +#define PCI_EXT_CAP_ID_VC 2 +#define PCI_EXT_CAP_ID_DSN 3 +#define PCI_EXT_CAP_ID_PWR 4 + + #ifdef __cplusplus +} +#endif + +#endif /* __INCpciExpressLibh */ + + diff --git a/h/drv/pci/pciHeaderDefs.h b/h/drv/pci/pciHeaderDefs.h new file mode 100644 index 0000000..8290cb2 --- /dev/null +++ b/h/drv/pci/pciHeaderDefs.h @@ -0,0 +1,141 @@ +/* pciHeaderDefs.h - PCI bus config space header definitions */ + +/* Copyright 1984-1998 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,26jul05,mdo Add includes for other bus technologies +01b,23jun03,m_h Cardbus support +01a,04mar98,tm adapted from pciIomapLib.h v01j +*/ + +#ifndef __INCpciHeaderDefsh +#define __INCpciHeaderDefsh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "pciXLib.h" +#include "pciExpressLib.h" + +#ifndef _ASMLANGUAGE + +/* structure for the device & bridge header */ + +typedef struct pciHeaderDevice + { + short vendorId; /* vendor ID */ + short deviceId; /* device ID */ + short command; /* command register */ + short status; /* status register */ + char revisionId; /* revision ID */ + char classCode; /* class code */ + char subClass; /* sub class code */ + char progIf; /* programming interface */ + char cacheLine; /* cache line */ + char latency; /* latency time */ + char headerType; /* header type */ + char bist; /* BIST */ + int base0; /* base address 0 */ + int base1; /* base address 1 */ + int base2; /* base address 2 */ + int base3; /* base address 3 */ + int base4; /* base address 4 */ + int base5; /* base address 5 */ + int cis; /* cardBus CIS pointer */ + short subVendorId; /* sub system vendor ID */ + short subSystemId; /* sub system ID */ + int romBase; /* expansion ROM base address */ + int reserved0; /* reserved */ + int reserved1; /* reserved */ + char intLine; /* interrupt line */ + char intPin; /* interrupt pin */ + char minGrant; /* min Grant */ + char maxLatency; /* max Latency */ + } PCI_HEADER_DEVICE; + +typedef struct pciHeaderBridge + { + short vendorId; /* vendor ID */ + short deviceId; /* device ID */ + short command; /* command register */ + short status; /* status register */ + char revisionId; /* revision ID */ + char classCode; /* class code */ + char subClass; /* sub class code */ + char progIf; /* programming interface */ + char cacheLine; /* cache line */ + char latency; /* latency time */ + char headerType; /* header type */ + char bist; /* BIST */ + int base0; /* base address 0 */ + int base1; /* base address 1 */ + char priBus; /* primary bus number */ + char secBus; /* secondary bus number */ + char subBus; /* subordinate bus number */ + char secLatency; /* secondary latency timer */ + char ioBase; /* IO base */ + char ioLimit; /* IO limit */ + short secStatus; /* secondary status */ + short memBase; /* memory base */ + short memLimit; /* memory limit */ + short preBase; /* prefetchable memory base */ + short preLimit; /* prefetchable memory limit */ + int preBaseUpper; /* prefetchable memory base upper 32 bits */ + int preLimitUpper; /* prefetchable memory base upper 32 bits */ + short ioBaseUpper; /* IO base upper 16 bits */ + short ioLimitUpper; /* IO limit upper 16 bits */ + int reserved; /* reserved */ + int romBase; /* expansion ROM base address */ + char intLine; /* interrupt line */ + char intPin; /* interrupt pin */ + short control; /* bridge control */ + } PCI_HEADER_BRIDGE; + +typedef struct pciHeaderCardBusBridge + { + short vendorId; /* vendor ID */ + short deviceId; /* device ID */ + short command; /* command register */ + short status; /* status register */ + char revisionId; /* revision ID */ + char classCode; /* class code */ + char subClass; /* sub class code */ + char progIf; /* programming interface */ + char cacheLine; /* cache line */ + char latency; /* latency time */ + char headerType; /* header type */ + char bist; /* BIST */ + int base0; /* base address 0 */ + char capPtr; /* capabilities pointer */ + char reserved; /* reserved */ + short secStatus; /* secondary status */ + char priBus; /* primary bus number */ + char secBus; /* secondary bus number */ + char subBus; /* subordinate bus number */ + char secLatency; /* secondary latency timer */ + int memBase0; /* memory base 0 */ + int memLimit0; /* memory limit 0 */ + int memBase1; /* memory base 1 */ + int memLimit1; /* memory limit 1 */ + int ioBase0; /* IO base 0 */ + int ioLimit0; /* IO limit 0 */ + int ioBase1; /* IO base 1 */ + int ioLimit1; /* IO limit 1 */ + char intLine; /* interrupt line */ + char intPin; /* interrupt pin */ + short control; /* bridge control */ + short subVendorId; /* sub system vendor ID */ + short subSystemId; /* sub system ID */ + int legacyBase; /* pccard 16-bit legacy mode base */ + } PCI_HEADER_CB_BRIDGE; + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpciHeaderDefsh */ diff --git a/h/drv/pci/pciIntLib.h b/h/drv/pci/pciIntLib.h new file mode 100644 index 0000000..8204159 --- /dev/null +++ b/h/drv/pci/pciIntLib.h @@ -0,0 +1,48 @@ +/* pciIntLib.h - PCI Interrupt support public constants header file */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,19jun00,dat added pciIntDisconnect2, SPR 31194 +01b,04mar98, tm moved pciIntRtn structure to private header file +01a,24feb98, tm derived from pciIomapLib.h v01a from ebsa285 BSP +*/ + +#ifndef __INCpciIntLibh +#define __INCpciIntLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef PCI_IRQ_LINES +#define PCI_IRQ_LINES 32 +#endif /* PCI_IRQ_LINES */ + +#ifndef _ASMLANGUAGE + +#if defined(__STDC__) || defined(__cplusplus) + +STATUS pciIntLibInit (void); +STATUS pciIntConnect (VOIDFUNCPTR * vec, VOIDFUNCPTR rtn, int arg); +STATUS pciIntDisconnect (VOIDFUNCPTR * vec, VOIDFUNCPTR rtn); +STATUS pciIntDisconnect2(VOIDFUNCPTR * vec, VOIDFUNCPTR rtn, int arg); + +#else /* __STDC__ */ + +STATUS pciIntLibInit (); +STATUS pciIntConnect (); +STATUS pciIntDisconnect (); +STATUS pciIntDisconnect2(); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpciIntLibh */ diff --git a/h/drv/pci/pciIomapLib.h b/h/drv/pci/pciIomapLib.h new file mode 100644 index 0000000..ac87e01 --- /dev/null +++ b/h/drv/pci/pciIomapLib.h @@ -0,0 +1,279 @@ +/* pciIomapLib.h - PCI bus constants header file */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,27oct01,dat Adding warnings about obsolete drivers +01h,15oct98,dat SPR 9098, added dllLib.h +01g,12jan97,hdn changed member/variable name "vender" to "vendor". +01f,12jan97,hdn changed member/variable name "class" to "classCode". +01e,03dec96,hdn added header-type bits definitions. +01d,13nov96,hdn added command-bit and address-mask definitions. +01c,06aug96,hdn added a structure PCI_INT_NODE. +01b,28mar96,hdn removed BIOS dependent stuff. +01a,23nov94,bcs written. +*/ + +#ifndef __INCpciIomapLibh +#define __INCpciIomapLibh + +#include "dllLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* +WARNING: The pciIomapLib driver is no longer supported. Please switch +all BSPs to use the pciConfigLib driver instead. +*/ + +#warning "h/drv/pci/pciIomapLib.h is being obsoleted, please use pciConfigLib" + + +/* PCI Configuration mechanisms */ + +#define PCI_MECHANISM_1 1 /* current PC-AT hardware mechanism */ +#define PCI_MECHANISM_2 2 /* deprecated */ + +/* Configuration I/O addresses for mechanism 1 */ + +#define PCI_CONFIG_ADDR 0x0cf8 /* write 32 bits to set address */ +#define PCI_CONFIG_DATA 0x0cfc /* 8, 16, or 32 bit accesses */ + +/* Configuration I/O addresses for mechanism 2 */ + +#define PCI_CONFIG_CSE 0x0cf8 /* CSE register */ +#define PCI_CONFIG_FORWARD 0x0cfa /* forward register */ +#define PCI_CONFIG_BASE 0xc000 /* base register */ + +/* number of IRQs mapped on PCI interrupt */ + +#define PCI_IRQ_LINES 16 + +/* PCI command bits */ + +#define PCI_CMD_IO_ENABLE 0x0001 /* IO access enable */ +#define PCI_CMD_MEM_ENABLE 0x0002 /* memory access enable */ +#define PCI_CMD_MASTER_ENABLE 0x0004 /* bus master enable */ +#define PCI_CMD_MON_ENABLE 0x0008 /* monitor special cycles enable */ +#define PCI_CMD_WI_ENABLE 0x0010 /* write and invalidate enable */ +#define PCI_CMD_SNOOP_ENABLE 0x0020 /* palette snoop enable */ +#define PCI_CMD_PERR_ENABLE 0x0040 /* parity error enable */ +#define PCI_CMD_WC_ENABLE 0x0080 /* wait cycle enable */ +#define PCI_CMD_SERR_ENABLE 0x0100 /* system error enable */ +#define PCI_CMD_FBTB_ENABLE 0x0200 /* fast back to back enable */ + +/* PCI base address mask bits */ + +#define PCI_MEMBASE_MASK ~0xf /* mask for memory base address */ +#define PCI_IOBASE_MASK ~0x3 /* mask for IO base address */ +#define PCI_BASE_IO 0x1 /* IO space indicator */ +#define PCI_BASE_BELOW_1M 0x2 /* memory locate below 1MB */ +#define PCI_BASE_IN_64BITS 0x4 /* memory locate anywhere in 64 bits */ +#define PCI_BASE_PREFETCH 0x8 /* memory prefetchable */ + +/* PCI header type bits */ + +#define PCI_HEADER_TYPE_MASK 0x7f /* mask for header type */ +#define PCI_HEADER_PCI_PCI 0x01 /* PCI to PCI bridge */ +#define PCI_HEADER_MULTI_FUNC 0x80 /* multi function device */ + + +/* Standard device configuration register offsets */ +/* Note that only modulo-4 addresses are written to the address register */ + +#define PCI_CFG_VENDOR_ID 0x00 +#define PCI_CFG_DEVICE_ID 0x02 +#define PCI_CFG_COMMAND 0x04 +#define PCI_CFG_STATUS 0x06 +#define PCI_CFG_REVISION 0x08 +#define PCI_CFG_PROGRAMMING_IF 0x09 +#define PCI_CFG_SUBCLASS 0x0a +#define PCI_CFG_CLASS 0x0b +#define PCI_CFG_CACHE_LINE_SIZE 0x0c +#define PCI_CFG_LATENCY_TIMER 0x0d +#define PCI_CFG_HEADER_TYPE 0x0e +#define PCI_CFG_BIST 0x0f +#define PCI_CFG_BASE_ADDRESS_0 0x10 +#define PCI_CFG_BASE_ADDRESS_1 0x14 +#define PCI_CFG_BASE_ADDRESS_2 0x18 +#define PCI_CFG_BASE_ADDRESS_3 0x1c +#define PCI_CFG_BASE_ADDRESS_4 0x20 +#define PCI_CFG_BASE_ADDRESS_5 0x24 +#define PCI_CFG_CIS 0x28 +#define PCI_CFG_SUB_VENDER_ID 0x2c +#define PCI_CFG_SUB_SYSTEM_ID 0x2e +#define PCI_CFG_EXPANSION_ROM 0x30 +#define PCI_CFG_RESERVED_0 0x34 +#define PCI_CFG_RESERVED_1 0x38 +#define PCI_CFG_DEV_INT_LINE 0x3c +#define PCI_CFG_DEV_INT_PIN 0x3d +#define PCI_CFG_MIN_GRANT 0x3e +#define PCI_CFG_MAX_LATENCY 0x3f + + +/* PCI-to-PCI bridge configuration register offsets */ +/* Note that only modulo-4 addresses are written to the address register */ + +#define PCI_CFG_PRIMARY_BUS 0x18 +#define PCI_CFG_SECONDARY_BUS 0x19 +#define PCI_CFG_SUBORDINATE_BUS 0x1a +#define PCI_CFG_SEC_LATENCY 0x1b +#define PCI_CFG_IO_BASE 0x1c +#define PCI_CFG_IO_LIMIT 0x1d +#define PCI_CFG_SEC_STATUS 0x1e +#define PCI_CFG_MEM_BASE 0x20 +#define PCI_CFG_MEM_LIMIT 0x22 +#define PCI_CFG_PRE_MEM_BASE 0x24 +#define PCI_CFG_PRE_MEM_LIMIT 0x26 +#define PCI_CFG_PRE_MEM_BASE_U 0x28 +#define PCI_CFG_PRE_MEM_LIMIT_U 0x2c +#define PCI_CFG_IO_BASE_U 0x30 +#define PCI_CFG_IO_LIMIT_U 0x32 +#define PCI_CFG_ROM_BASE 0x38 +#define PCI_CFG_BRG_INT_LINE 0x3c +#define PCI_CFG_BRG_INT_PIN 0x3d +#define PCI_CFG_BRIDGE_CONTROL 0x3e + + +#ifndef _ASMLANGUAGE + +/* structure for the device & bridge header */ + +typedef struct pciHeaderDevice + { + short vendorId; /* vendor ID */ + short deviceId; /* device ID */ + short command; /* command register */ + short status; /* status register */ + char revisionId; /* revision ID */ + char classCode; /* class code */ + char subClass; /* sub class code */ + char progIf; /* programming interface */ + char cacheLine; /* cache line */ + char latency; /* latency time */ + char headerType; /* header type */ + char bist; /* BIST */ + int base0; /* base address 0 */ + int base1; /* base address 1 */ + int base2; /* base address 2 */ + int base3; /* base address 3 */ + int base4; /* base address 4 */ + int base5; /* base address 5 */ + int cis; /* cardBus CIS pointer */ + short subVendorId; /* sub system vendor ID */ + short subSystemId; /* sub system ID */ + int romBase; /* expansion ROM base address */ + int reserved0; /* reserved */ + int reserved1; /* reserved */ + char intLine; /* interrupt line */ + char intPin; /* interrupt pin */ + char minGrant; /* min Grant */ + char maxLatency; /* max Latency */ + } PCI_HEADER_DEVICE; + +typedef struct pciHeaderBridge + { + short vendorId; /* vendor ID */ + short deviceId; /* device ID */ + short command; /* command register */ + short status; /* status register */ + char revisionId; /* revision ID */ + char classCode; /* class code */ + char subClass; /* sub class code */ + char progIf; /* programming interface */ + char cacheLine; /* cache line */ + char latency; /* latency time */ + char headerType; /* header type */ + char bist; /* BIST */ + int base0; /* base address 0 */ + int base1; /* base address 1 */ + char priBus; /* primary bus number */ + char secBus; /* secondary bus number */ + char subBus; /* subordinate bus number */ + char secLatency; /* secondary latency timer */ + char ioBase; /* IO base */ + char ioLimit; /* IO limit */ + short secStatus; /* secondary status */ + short memBase; /* memory base */ + short memLimit; /* memory limit */ + short preBase; /* prefetchable memory base */ + short preLimit; /* prefetchable memory limit */ + int preBaseUpper; /* prefetchable memory base upper 32 bits */ + int preLimitUpper; /* prefetchable memory base upper 32 bits */ + short ioBaseUpper; /* IO base upper 16 bits */ + short ioLimitUpper; /* IO limit upper 16 bits */ + int reserved; /* reserved */ + int romBase; /* expansion ROM base address */ + char intLine; /* interrupt line */ + char intPin; /* interrupt pin */ + short control; /* bridge control */ + } PCI_HEADER_BRIDGE; + +typedef struct pciIntRtn + { + DL_NODE node; /* double link list */ + VOIDFUNCPTR routine; /* interrupt handler */ + int parameter; /* parameter of the handler */ + } PCI_INT_RTN; + + +#if defined(__STDC__) || defined(__cplusplus) + +STATUS pciIomapLibInit (int mechanism, int addr0, int addr1, int addr2); +STATUS pciFindDevice (int vendorId, int deviceId, int index, + int * pBusNo, int * pDeviceNo, int * pFuncNo); +STATUS pciFindClass (int classCode, int index, + int * pBusNo, int * pDeviceNo, int * pFuncNo); +STATUS pciConfigInByte (int busNo, int deviceNo, int funcNo, int address, + char * pData); +STATUS pciConfigInWord (int busNo, int deviceNo, int funcNo, int address, + short * pData); +STATUS pciConfigInLong (int busNo, int deviceNo, int funcNo, int address, + int * pData); +STATUS pciConfigOutByte (int busNo, int deviceNo, int funcNo, int address, + char data); +STATUS pciConfigOutWord (int busNo, int deviceNo, int funcNo, int address, + short data); +STATUS pciConfigOutLong (int busNo, int deviceNo, int funcNo, int address, + int data); +STATUS pciSpecialCycle (int busNo, int message); +STATUS pciDeviceShow (int busNo); +STATUS pciHeaderShow (int busNo, int deviceNo, int funcNo); +STATUS pciFindDeviceShow(int vendorId, int deviceId, int index); +STATUS pciFindClassShow (int classCode, int index); +STATUS pciIntConnect (VOIDFUNCPTR *vector, VOIDFUNCPTR routine, + int parameter); +STATUS pciIntDisconnect (VOIDFUNCPTR *vector, VOIDFUNCPTR routine); + +#else /* __STDC__ */ + +STATUS pciIomapLibInit (); +STATUS pciFindDevice (); +STATUS pciFindClass (); +STATUS pciConfigInByte (); +STATUS pciConfigInWord (); +STATUS pciConfigInLong (); +STATUS pciConfigOutByte (); +STATUS pciConfigOutWord (); +STATUS pciConfigOutLong (); +STATUS pciSpecialCycle (); +STATUS pciDeviceShow (); +STATUS pciHeaderShow (); +STATUS pciFindDeviceShow(); +STATUS pciFindClassShow (); +STATUS pciIntConnect (); +STATUS pciIntDisconnect (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpciIomapLibh */ diff --git a/h/drv/pci/pciLocalBus.h b/h/drv/pci/pciLocalBus.h new file mode 100644 index 0000000..856f5f1 --- /dev/null +++ b/h/drv/pci/pciLocalBus.h @@ -0,0 +1,277 @@ +/* pciLocalBus.h - pci bus configuration header */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,02nov01,tor add class info +01i,27oct01,dat Adding warnings about obsolete drivers +01h,05mar97,mas made file C++ compliant (SPR 8117). +01g,21feb97,mas PCI_DEV_IDSEL_MAX conditionally defined here so it can be + specified in config.h; NUM_PCI_DEVS_MAX set to 6 always + (SPR 8026). +01f,08nov96,mas fixed NUM_PCI_DEVS_MAX and PCI_NUM_BAR for MV1300 (SPR 7446). +01e,14aug96,dat changed PCI_READ macro to include address +01d,02aug96,dat rewritten for portability, sprs 6490 and 6594 +01c,24jul96,dds SPR 6819: The PCI_CNFG_HDR structure has been + modified for BIG_ENDIAN architectures. +01b,02feb95,vin cleaned up. +01a,11nov94,vin created. +*/ + +/* +This file contains type declarations for the PCI Header and the +macros in regards to the PCI BUS. This header has been designed +with respect to PCI LOCAL BUS SPECIFICATION REVISION 2.1. Every +device on the PCI BUS has to support 256 byte of configuration +space of which the first 64 bytes is a predefined header portion +defined by the PCI commitee. 64 to 255 bytes is dedicated to the +device specific registers. PCI bus is inherently little endian. +If a big endian processor is being interfaced with a PCI bus then +all the configuration registers have to be swapped and written. +*/ + + +#ifndef INCpciLocalBush +#define INCpciLocalBush + +/* +WARNING: The pciLocalBus driver is no longer supported. Please switch +all BSPs to use the pciConfigLib driver instead. +*/ + +#warning "h/drv/pci/pciLocalBus.h is being obsoleted, please use pciConfigLib" + +#ifdef __cplusplus +extern "C" { +#endif + +#if (_BYTE_ORDER == _BIG_ENDIAN) + +#define PSWAP(x) LONGSWAP(x) /* swap the long word */ + +#else + +#define PSWAP(x) (x) /* pass it as is */ + +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + +/* given a pci base address and longword index, return local address */ + +#ifndef PCI_ADDR +# define PCI_ADDR(base,index) (&((ULONG *)(base))[index]) +#endif + +/* Perform a longword pci read cycle */ + +#ifndef PCI_READ +# define PCI_READ(base,index,addr) \ + (*(ULONG *)addr = PSWAP(*PCI_ADDR(base,index))) +#endif + +/* perform a longword pci write cycle */ + +#ifndef PCI_WRITE +# define PCI_WRITE(base,index,data) (*PCI_ADDR(base,index) = PSWAP(data)) +#endif + +/* + * Configuration space header offsets, all 32 bit accesses + * Always use PSWAP() on the data value. Use macros to + * isolate sub fields within the 32 bit values. + */ + +#define PCI_IDX_DEV_VNDR 0x0 /* dev id, vendor id */ +#define PCI_IDX_ST_CMD 0x1 /* status, command */ +#define PCI_IDX_CLS_REV 0x2 /* class, revision */ +#define PCI_IDX_B_H_L_C 0x3 /* bist,hdr,lat,line_sz */ +#define PCI_IDX_BAR_0 0x4 /* base addr reg 0 */ +#define PCI_IDX_BAR_1 0x5 /* base addr reg 1 */ +#define PCI_IDX_BAR_2 0x6 /* base addr reg 2 */ +#define PCI_IDX_BAR_3 0x7 /* base addr reg 3 */ +#define PCI_IDX_BAR_4 0x8 /* base addr reg 4 */ +#define PCI_IDX_BAR_5 0x9 /* base addr reg 5 */ +#define PCI_IDX_CIS_PTR 0xA /* cardbus CIS ptr */ +#define PCI_IDX_SUB_SVID 0xB /* sub id, sub vendor id */ +#define PCI_IDX_EXP_ROM 0xC /* exp ROM Base Addr */ +#define PCI_IDX_RES_1 0xD /* reserved #1 */ +#define PCI_IDX_RES_2 0xE /* reserved #2 */ +#define PCI_IDX_L_G_I_I 0xF /* lat, grant, pin, lvl */ + +/* Macros to isolate Byte, word fields */ + +#define PCI_DEVICE_ID(x) (MSW(x)) +#define PCI_VENDOR_ID(x) (LSW(x)) + +#define PCI_STATUS(x) (MSW(x)) +#define PCI_COMMAND(x) (LSW(x)) + +#define PCI_CLASS(x) ((x)>>8) +#define PCI_REVISION(x) (LLSB(x)) + +#define PCI_BIST(x) (LMSB(x)) +#define PCI_HDR(x) (LNMSB(x)) +#define PCI_LAT_TMR(x) (LNLSB(x)) +#define PCI_CACHE_LN_SZ(x) (LLSB(x)) +#define PCI_MULTI_FUNC_HDR(x) ((x) & 0x00800000) /* if multi-func device */ + +#define PCI_SUB_ID(x) (MSW(x)) +#define PCI_SUB_VDR_ID(x) (LSW(x)) + +#define PCI_MAX_LAT(x) (LMSB(x)) +#define PCI_MIN_GNT(x) (LNMSB(x)) +#define PCI_INT_PIN(x) (LNLSB(x)) +#define PCI_INT_LINE(x) (LLSB(x)) + +/* misc defines */ + +#define PCI_CNFG_HDR_SIZE 0x40 + +#define PCI_CNFG_HDR_LONGS 0x40 /* nbr of longs in header */ + +/* define for ID_SEL of first PCI device on the PCI bus */ + +#define PCI_DEV_IDSEL (1 << 11) +#ifndef PCI_DEV_IDSEL_MAX +#define PCI_DEV_IDSEL_MAX (31 - 10) /* max # of idsel lines */ +#endif /* PCI_DEV_IDSEL_MAX */ + +# define NUM_PCI_DEVS_MAX (6) /* #of dev idsel lines (slots)*/ + +#define PCI_NUM_BAR NUM_PCI_DEVS_MAX /* nbr of base addr reg's */ + +/* defines for configuration header */ + +#define INVALID_VENDOR_ID 0xffff /* invalid vendor ID */ + +/* device class definitions */ + +/* device built before class code definitions were finalized */ +#define CLASS_BEFORE_STD 0x00 + +#define CLASS_MASS_STORAGE 0x01 /* Mass storage controller */ +#define CLASS_NET_CNTLR 0x02 /* Network controller */ +#define CLASS_DISP_CNTLR 0x03 /* Display controller */ +#define CLASS_MULTI_MEDIA 0x04 /* multimedia device */ +#define CLASS_MEM_CNTLR 0x05 /* memory controller */ +#define CLASS_BRIDGE_DEV 0x06 /* bridge device */ +#define CLASS_COMM 0x07 /* simple communication controller */ +#define CLASS_PERIPH 0x08 /* base system peripherals */ +#define CLASS_INPUT 0x09 /* input devices */ +#define CLASS_DOCK 0x0a /* docking stations */ +#define CLASS_PROCESSOR 0x0b /* processors */ +#define CLASS_SERIAL_BUS 0x0c /* serial bus controllers */ +#define CLASS_WIRELESS 0x0d /* wireless controllers */ +#define CLASS_INTELLIGENT_IO 0x0e /* intelligent I/O controllers */ +#define CLASS_SATELLITE 0x0f /* satellite communications controllers */ +#define CLASS_ENCRYPT 0x10 /* encryption/decryption controllers */ +#define CLASS_DATA_ACQ 0x11 /* data acquisition controllers */ +#define CLASS_UNDEFINED 0xff /* not in any defined class */ + +/* device sub classes */ +#define SUBCLASS_SCSI_CNTLR 0x00 /* SCSI bus controller */ +#define SUBCLASS_IDE_CNTLR 0x01 /* IDE controller */ +#define SUBCLASS_FLOPPY_CNTLR 0x02 /* Floppy disk Controller */ +#define SUBCLASS_IPI_CNTLR 0x03 /* IPI bus controller */ + +#define SUBCLASS_ETHR_CNTLR 0x00 /* ethernet controller */ +#define SUBCLASS_TRNG_CNTLR 0x01 /* token ring controller */ +#define SUBCLASS_FDDI_CNTLR 0x02 /* FDDI controller */ + +#define SUBCLASS_VGA_CNTLR 0x00 /* VGA compatible controller */ +#define SUBCLASS_XGA_CNTLR 0x01 /* XGA compatible controller */ + +#define SUBCLASS_VIDEO 0x00 /* video */ +#define SUBCLASS_AUDIO 0x01 /* audio */ + +#define SUBCLASS_RAM 0x00 /* ram device */ +#define SUBCLASS_FLASH 0x01 /* flash device */ + +#define SUBCLASS_HST_BRDG 0x00 /* host bridge */ +#define SUBCLASS_ISA_BRDG 0x01 /* ISA bridge */ +#define SUBCLASS_EISA_BRDG 0x02 /* EISA bridge */ +#define SUBCLASS_MC_BRDG 0x03 /* MC bridge */ +#define SUBCLASS_PCI_PCI_BRDG 0x04 /* PCI to PCI bridge */ +#define SUBCLASS_PCMCIA_BRDG 0x05 /* PCMCIA bridge */ +#define SUBCLASS_PCI_NUBUS_BRDG 0x06 /* NUBus bridge */ +#define SUBCLASS_CARDBUS_BRDG 0x07 /* CardBus bridge */ + +#define SUBCLASS_OTHER 0x80 /* other devices */ + +/* command and status register layout, bits 10 - 22 are reserved */ + +#define CSR_IO_EN 0x00000001 /* I/O address space enable */ +#define CSR_MEM_EN 0x00000002 /* memory space enable */ +#define CSR_BM_EN 0x00000004 /* bus master enable */ +#define CSR_SP_CYCLS_EN 0x00000008 /* special cycles enable */ +#define CSR_MEM_WRT_INV_EN 0x00000010 /* memry write & invalidate */ +#define CSR_VGA_PLT_SN_EN 0x00000020 /* VGA Pallette snoop */ +#define CSR_PARITY_EN 0x00000040 /* parity error response */ +#define CSR_WAIT_EN 0x00000080 /* wait cycle control */ +#define CSR_SERR_EN 0x00000100 /* SERR# enable */ +#define CSR_FST_BTOB_EN 0x00000200 /* Fast back to back Enable */ + +/* status register layout */ + +/* writing a 1 to any bit will reset that bit, writing 0 has no effect */ + +#define CSR_66MHZ_CAP 0x00200000 /* 66 Mhz Capable */ +#define CSR_UDF_SUPP 0x00400000 /* UDF supported */ +#define CSR_FST_BTOB 0x00800000 /* Fast bk to bk Capable */ +#define CSR_DATA_PTY_DTD 0x01000000 /* Data parity detected */ +#define CSR_DEVSEL_FAST 0x00000000 /* DEVSEL timing fast */ +#define CSR_DEVSEL_MED 0x02000000 /* DEVSEL timing medium */ +#define CSR_DEVSEL_SLOW 0x04000000 /* DEVSEL timing slow */ +#define CSR_SGD_TGT_ABRT 0x08000000 /* signaled target abort */ +#define CSR_RCV_TGT_ABRT 0x10000000 /* received target abort */ +#define CSR_RCV_MST_ABRT 0x20000000 /* received master abort */ +#define CSR_SGD_SYS_ERR 0x40000000 /* signaled system error */ +#define CSR_DTD_PERR 0x80000000 /* detected parity error */ + +/* BIST register layout */ + +#define BIST_REG_BIST_CAPABLE 0x80 /* device supports BIST */ +#define BIST_REG_BIST_START 0x40 /* start built in self test */ + +/* base address register for Memory */ + +#define INDEX_IO 0x00 +#define INDEX_MEM 0x01 +#define BASE_ADDR_IO_MASK 0xfffffffc /* mask for IO base addrs */ +#define BASE_ADDR_MEM_MASK 0xfffffff0 /* mask for mem base addrs */ +#define BASE_ADDR_REG_IO_SPACE 0x00000001 /* device mapped in I/O */ +#define BASE_ADDR_REG_MEM_SPACE 0x00000000 /* device mapped in mem */ +#define BASE_ADDR_REG_MEM_4GIG 0x00000000 /* mapped in A32 space */ +#define BASE_ADDR_REG_MEM_1MEG 0x00000002 /* mapped in lower 1 Meg */ +#define BASE_ADDR_REG_MEM_ANY 0x00000004 /* mapped in A64 space */ +#define BASE_ADDR_REG_MEM_PFTCH 0x00000008 /* prefetechable bit */ + +/* pci function declerations */ +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT STATUS sysPciDevConfig ( + ULONG devPciCnfgAdrs, + ULONG devIoBaseAdrs, + ULONG devMemBaseAdrs, + ULONG command, + FUNCPTR devPciRoutine, + ULONG devPciArg1, + ULONG devPCiArg2 + ); +IMPORT STATUS sysPciDevProbe (ULONG, ULONG, ULONG *); +IMPORT STATUS sysPciDevShow (ULONG *); + +#else + +IMPORT STATUS sysPciDevConfig (); +IMPORT STATUS sysPciDevProbe (); +IMPORT STATUS sysPciDevShow (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* INCpciLocalBush */ diff --git a/h/drv/pci/pciXLib.h b/h/drv/pci/pciXLib.h new file mode 100644 index 0000000..9dce0e8 --- /dev/null +++ b/h/drv/pci/pciXLib.h @@ -0,0 +1,106 @@ +/* pciXLib.h - PCI-X bus constants header file */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,24jun05,mdo Written. +*/ + +#ifndef __INCpciXLibh +#define __INCpciXLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef BIT +#define BIT (bitNumber) (1 << (bitNumber)) +#endif + +/* PCI-X Non-Bridged Configuration Registers */ + +/* PCI-X Capability Command Register */ + +#define PCI_X_CMD 0x02 /* Offset of PCI-X command register */ +#define PCI_X_CMD_DPERR_ENB BIT(0) /* Data Parity Error Recovery Enable */ +#define PCI_X_CMD_RO_ENB BIT(1) /* Enable Relaxed Ordering */ +#define PCI_X_CMD_MAX_READ 0xc /* Max Memory Read Byte Count */ +#define PCI_X_CMD_MAX_SPLIT 0x70 /* Max Outstanding Split Trans. */ + #define PCI_X_MAX_SPLIT_1 0x0 /* 1 Max Outstanding Split Trans. */ + #define PCI_X_MAX_SPLIT_2 0x1 /* 2 Max Outstanding Split Trans. */ + #define PCI_X_MAX_SPLIT_3 0x2 /* 3 Max Outstanding Split Trans. */ + #define PCI_X_MAX_SPLIT_4 0x3 /* 4 Max Outstanding Split Trans. */ + #define PCI_X_MAX_SPLIT_8 0x4 /* 8 Max Outstanding Split Trans. */ + #define PCI_X_MAX_SPLIT_12 0x5 /* 12 Max Outstanding Split Trans. */ + #define PCI_X_MAX_SPLIT_16 0x6 /* 16 Max Outstanding Split Trans. */ + #define PCI_X_MAX_SPLIT_32 0x7 /* 32 Max Outstanding Split Trans. */ + + +/* PCI-X Capability Status Register */ + +#define PCI_X_STATUS 0x04 /* Offset of PCI-X status register */ +#define PCI_X_STATUS_FUNC_NUM 0x7 /* Function Number */ +#define PCI_X_STATUS_DEV_NUM 0xF8 /* Device Number */ +#define PCI_X_STATUS_BUS_NUM 0xFF00 /* Bus Number */ +#define PCI_X_STATUS_64BIT 0x10000 /* 64-bit device */ +#define PCI_X_STATUS_133MHZ 0x20000 /* 133 MHz Capable */ +#define PCI_X_STATUS_SCOMP_DISC 0x40000 /* Split Completion Discarded */ +#define PCI_X_STATUS_UNEX_SCOMP 0x80000 /* Unexpected Split Completion */ +#define PCI_X_STATUS_DEVCPLX 0x100000 /* Device Complexity */ +#define PCI_X_STATUS_MAX_READ 0x600000 /* Designed Max Memory Read Byte Count */ +#define PCI_X_STATUS_MAX_SPLIT 0x3800000 /* Designed Max Outstanding Split Trans. */ +#define PCI_X_STATUS_MAX_CUMRD 0x1c000000 /* Designed Max Cumulative Read Size */ +#define PCI_X_STATUS_SCOMP_ERR 0x20000000 /* Rcv'd Split Completion Error Msg */ +#define PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */ +#define PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */ + + +/* PCI-X Bridged Configuration Registers */ + +/* PCI-X Capability Secondary Status Register */ + +#define PCI_X_SECSTAT 0x02 /* Offset of PCI-X 2ndary status register */ +#define PCI_X_SECSTAT_64BIT 0x1 /* 64-bit device */ +#define PCI_X_SECSTAT_133MHZ 0x2 /* 133MHz Capable */ +#define PCI_X_SECSTAT_SCOMP_DISC 0x4 /* Split Completion Discarded */ +#define PCI_X_SECSTAT_UNEX_SCOMP 0x8 /* Unexpected Split Completion */ +#define PCI_X_SECSTAT_SCOMP_ORUN 0x10 /* Split Completion Overrun */ +#define PCI_X_SECSTAT_SCOMP_DLYD 0x20 /* Split Request Delayed */ +#define PCI_X_SECSTAT_CLKFREQ 0x1C0 /* Secondary Clock Freq. */ + +/* PCI-X Capability Primary Status Register */ + +#define PCI_X_PRISTAT 0x04 /* Offset of bridge status register */ +#define PCI_X_PRISTAT_FUNC_NUM PCI_X_STATUS_FUNC_NUM /* Function Number */ +#define PCI_X_PRISTAT_DEV_NUM PCI_X_STATUS_DEV_NUM /* Device Number */ +#define PCI_X_PRISTAT_BUS_NUM PCI_X_STATUS_BUS_NUM /* Bus Number */ +#define PCI_X_PRISTAT_64BIT PCI_X_STATUS_64BIT /* 64-bit device */ +#define PCI_X_PRISTAT_133MHZ PCI_X_STATUS_133MHZ /* 133 MHz capable */ +#define PCI_X_PRISTAT_SCOMP_DISC PCI_X_STATUS_SCOMP_DISC /* Split Completion Discarded */ +#define PCI_X_PRISTAT_UNEX_SCOMP PCI_X_STATUS_UNEX_SCOMP /* Unexpected Split Completion */ +#define PCI_X_PRISTAT_SCOMP_ORUN 0x100000 /* Split Completion Overrun */ +#define PCI_X_PRISTAT_SCOMP_DLYD 0x200000 /* Split Request Delayed */ + +/* PCI-X Capability Upstream Split Transaction Control Register */ + +#define PCI_X_UP_SXACTION_CTRL 0x08 +#define PCI_X_UP_SXACTION_CAP 0xFF /* Split Xaction Capacity Register RO */ +#define PCI_X_UP_SXACTION_LIMIT 0xFF00 /* Split Xaction Commit Limit Register */ + + +/* PCI-X Capability Downstream Split Transaction Control Register */ + +#define PCI_X_DWN_SXACTION_CTRL 0x0C +#define PCI_X_DWN_SXACTION_CAP PCI_X_UP_SXACTION_CAP /* Split Xaction Capacity Reg. RO */ +#define PCI_X_DWN_SXACTION_LIMIT PCI_X_UP_SXACTION_LIMIT /* Split Xaction Commit Limit Reg. */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpciXLibh */ + + diff --git a/h/drv/pcmcia/cisLib.h b/h/drv/pcmcia/cisLib.h new file mode 100644 index 0000000..0dccb5c --- /dev/null +++ b/h/drv/pcmcia/cisLib.h @@ -0,0 +1,232 @@ +/* cisLib.h - PCMCIA CIS library header */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,02may01,dat added WRS_PACK_ALIGN struct. spr 67168 +01c,16jan97,hdn added CIS_MAX_TUPLES. +01b,22feb96,hdn cleaned up. +01a,10feb95,hdn written +*/ + +#ifndef __INCcislibh +#define __INCcislibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* + * The following packing attribute is needed by code that reads the CIS tuples + * to ensure the structure sizes can be used to calculate the proper offsets. + */ +#ifndef WRS_PACK_ALIGN +# define WRS_PACK_ALIGN(x) __attribute__((packed, aligned(x))) +#endif + + +typedef struct cisTupleA + { + u_char code; + u_char dummy0; + u_char link; + u_char dummy1; + } CIS_TUPLE_A; + +typedef struct cisTupleC + { + u_char code; + u_char link; + } WRS_PACK_ALIGN(2) CIS_TUPLE_C; + + +typedef CIS_TUPLE_C CIS_TUPLE; + +typedef union cisByte2 + { + u_char c[2]; + u_short s; + } CIS_BYTE2; + +typedef union cisByte4 + { + u_char c[4]; + u_int l; + } CIS_BYTE4; + +typedef struct cisIo + { + u_int start; + u_int stop; + } CIS_IO; + +typedef struct cisMem + { + u_int length; + u_int cAddr; + u_int hAddr; + } CIS_MEM; + +typedef struct cisConfig + { + DL_NODE node; /* Double Link Node */ + u_char index; /* configuration index */ + u_char interfaceType; /* interface type */ + u_char vcc[3]; /* vcc */ + u_char vpp1[3]; /* vpp1 */ + u_char vpp2[3]; /* vpp2 */ + u_char ioBuswidth; /* io bus width */ + u_char ioAddrlines; /* io address lines */ + u_char ioRanges; /* io ranges */ + CIS_IO io[16]; /* io window info */ + u_char irqMode; /* IRQ mode */ + u_char irqMask; /* IRQ mask */ + u_char irqLevel; /* IRQ level */ + u_char irqSpecial; /* IRQ special */ + CIS_BYTE2 irqBit; /* IRQ bit */ + CIS_MEM mem[8]; /* memory window info */ + u_char twins; /* twin */ + u_char audio; /* audio */ + u_char readonly; /* read only */ + u_char pwrdown; /* power down */ + } CIS_CONFIG; + + +/* assume max number of tuples in attribute or common memory */ + +#define CIS_MAX_TUPLES 512 + +/* memory window for Tuple and Configuration-register */ + +#define CIS_MEM_TUPLE 0 +#define CIS_MEM_CONFIG 1 + +/* Tuple codes */ + +#define CISTPL_NULL 0x00 +#define CISTPL_DEVICE 0x01 +#define CISTPL_CHECKSUM 0x10 +#define CISTPL_LONGLINK_A 0x11 +#define CISTPL_LONGLINK_C 0x12 +#define CISTPL_LINKTARGET 0x13 +#define CISTPL_NO_LINK 0x14 +#define CISTPL_VERS_1 0x15 +#define CISTPL_ALTSTR 0x16 +#define CISTPL_DEVICE_A 0x17 +#define CISTPL_JEDEC_C 0x18 +#define CISTPL_JEDEC_A 0x19 +#define CISTPL_CONFIG 0x1a +#define CISTPL_CFTABLE_ENTRY 0x1b +#define CISTPL_DEVICE_OC 0x1c +#define CISTPL_DEVICE_OA 0x1d +#define CISTPL_DEVICE_GEO 0x1e +#define CISTPL_DEVICE_GEO_A 0x1f +#define CISTPL_MANFID 0x20 +#define CISTPL_FUNCID 0x21 +#define CISTPL_FUNCE 0x22 +#define CISTPL_SWIL 0x23 +#define CISTPL_VERS_2 0x40 +#define CISTPL_FORMAT 0x41 +#define CISTPL_GEOMETRY 0x42 +#define CISTPL_BYTEORDER 0x43 +#define CISTPL_DATE 0x44 +#define CISTPL_BATTERY 0x45 +#define CISTPL_ORG 0x46 +#define CISTPL_END 0xff + +/* device speed codes */ + +#define DSPEED_NULL 0 +#define DSPEED_250NS 1 +#define DSPEED_200NS 2 +#define DSPEED_150NS 3 +#define DSPEED_100NS 4 +#define DSPEED_EXT 7 + +/* device type codes */ + +#define DTYPE_NULL 0x00 +#define DTYPE_ROM 0x10 +#define DTYPE_OTPROM 0x20 +#define DTYPE_EPROM 0x30 +#define DTYPE_EEPROM 0x40 +#define DTYPE_FLASH 0x50 +#define DTYPE_SRAM 0x60 +#define DTYPE_DRAM 0x70 +#define DTYPE_FUNCSPEC 0xd0 +#define DTYPE_EXTEND 0xe0 + +/* function ID */ + +#define FUNC_MULTI 0x0 +#define FUNC_MEMORY 0x1 +#define FUNC_SERIAL 0x2 +#define FUNC_PARALLEL 0x3 +#define FUNC_FIXEDDISK 0x4 +#define FUNC_VIDEO 0x5 +#define FUNC_LAN 0x6 +#define FUNC_AIMS 0x7 + +/* function extension type and data */ + +#define FUNCE_TYPE_DISK 0x01 +#define FUNCE_DATA_ATA 0x01 + +/* configuration register: configuration option register */ + +#define COR_SRESET 0x80 +#define COR_LEVIREQ 0x40 + +/* configuration register: card configuration and status register */ + +#define CCSR_CHANGED 0x80 +#define CCSR_SIGCHG 0x40 +#define CCSR_IOIS8 0x20 +#define CCSR_AUDIO 0x08 +#define CCSR_PWRDWN 0x04 +#define CCSR_INTR 0x02 + +/* configuration register: pin replacement register */ + +#define PRR_CBVD1 0x80 +#define PRR_CBVD2 0x40 +#define PRR_CRDY 0x20 +#define PRR_CWPROT 0x10 +#define PRR_RBVD1 0x08 +#define PRR_RBVD2 0x04 +#define PRR_RRDY 0x02 +#define PRR_RWPROT 0x01 + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS cisGet (int sock); +extern void cisFree (int sock); +extern STATUS cisConfigregGet (int sock, int reg, int *pValue); +extern STATUS cisConfigregSet (int sock, int reg, int value); +extern void cisShow (int sock); + +#else + +extern STATUS cisGet (); +extern void cisFree (); +extern STATUS cisConfigregGet (); +extern STATUS cisConfigregSet (); +extern void cisShow (); + +#endif /* __STDC__ */ + + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcislibh */ diff --git a/h/drv/pcmcia/pccardLib.h b/h/drv/pcmcia/pccardLib.h new file mode 100644 index 0000000..5bb6d72 --- /dev/null +++ b/h/drv/pcmcia/pccardLib.h @@ -0,0 +1,127 @@ +/* pccardLib.h - PCMCIA network interface header*/ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,30apr02,pmr SPR 76487: fixed configType comment. +01c,11dec97,hdn added TFFS support for flash PC card. +01b,22feb96,hdn cleaned up. +01a,19oct95,hdn written. +*/ + + +#ifndef __INCpccardLibh +#define __INCpccardLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + + +#define ERROR_FIND -2 /* return code from Enabler */ +#define PCCARD_3V 3 /* 3V for Vcc */ +#define PCCARD_5V 5 /* 5V for Vcc or Vpp */ +#define PCCARD_12V 12 /* 12V for Vpp */ +#define PCCARD_IOWIN0 0 /* IO window 0 */ +#define PCCARD_IOWIN1 1 /* IO window 1 */ + +#define PCCARD_FLASH 4 /* flash memory PC card */ + + +typedef struct pccardEnabler + { + int type; /* type of a PC Card */ + void *pResource; /* pointer to PC card resources */ + int resourceNumEnt; /* number of PC card resource elements */ + FUNCPTR enableRtn; /* enable routine */ + FUNCPTR showRtn; /* show routine */ + } PCCARD_ENABLER; + +typedef struct pccardResource + { + int vcc; /* 3,5: Vcc */ + int vpp; /* 5,12: Vpp */ + int ioStart[2]; /* start IO address */ + int ioStop[2]; /* stop IO address */ + int ioExtraws; /* 0-2: extra wait state */ + int memStart; /* start host address */ + int memStop; /* stop host address */ + int memExtraws; /* 0-2: extra wait state */ + int memOffset; /* offset card address */ + int memLength; /* size of the memory */ + } PCCARD_RESOURCE; + +typedef struct ataResource /* PCCARD ATA resources */ + { + PCCARD_RESOURCE resource; /* must be the first member */ + int ctrlType; /* controller type: IDE_LOCAL or ATA_PCMCIA */ + int drives; /* 1,2: number of drives */ + int intVector; /* interrupt vector */ + int intLevel; /* IRQ level */ + int configType; /* or'd configuration flags */ + int semTimeout; /* timeout seconds for sync semaphore */ + int wdgTimeout; /* timeout seconds for watch dog */ + int sockTwin; /* socket number for twin card */ + int pwrdown; /* power down mode */ + } ATA_RESOURCE; + +typedef struct sramResource /* PCCARD SRAM resources */ + { + PCCARD_RESOURCE resource; /* must be the first member */ + } SRAM_RESOURCE; + +typedef struct eltResource /* PCCARD ELT resources */ + { + PCCARD_RESOURCE resource; /* must be the first member */ + int intVector; /* interrupt vector */ + int intLevel; /* IRQ level */ + int rxFrames; /* # of receive frames (0=default) */ + int connector; /* Ethernet connector to use */ + } ELT_RESOURCE; + +typedef struct tffsResource /* PCCARD TFFS resources */ + { + PCCARD_RESOURCE resource; /* must be the first member */ + } TFFS_RESOURCE; + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS pccardMount (int sock, char *pName); +extern STATUS pccardMkfs (int sock, char *pName); +extern STATUS pccardEltEnabler (int sock, ELT_RESOURCE *pEltResource, + int numEnt, FUNCPTR showRtn); +extern STATUS pccardAtaEnabler (int sock, ATA_RESOURCE *pAtaResource, + int numEnt, FUNCPTR showRtn); +extern STATUS pccardSramEnabler (int sock, SRAM_RESOURCE *pSramResource, + int numEnt, FUNCPTR showRtn); +extern STATUS pccardTffsEnabler (int sock, TFFS_RESOURCE *pTffsResource, + int numEnt, FUNCPTR showRtn); +extern void pccardShowInit (void); + +#else + +extern STATUS pccardMount (); +extern STATUS pccardMkfs (); +extern STATUS pccardEltEnabler (); +extern STATUS pccardAtaEnabler (); +extern STATUS pccardSramEnabler (); +extern STATUS pccardTffsEnabler (); +extern void pccardShowInit (); + +#endif /* __STDC__ */ + + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpccardLibh */ diff --git a/h/drv/pcmcia/pcic.h b/h/drv/pcmcia/pcic.h new file mode 100644 index 0000000..56552b2 --- /dev/null +++ b/h/drv/pcmcia/pcic.h @@ -0,0 +1,166 @@ +/* pcic.h - Intel 82365SL PCMCIA Host Bus Adaptor chip header */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ +/* Copyright (c) 1994 David A. Hinds -- All Rights Reserved */ + +/* +modification history +-------------------- +01d,01apr98,hdn added PCIC_ENA_MEMCS16 macro. +01c,19jan98,hdn changed PCIC_VPP_XX macros. +01b,22feb96,hdn cleaned up. +01a,19jan95,hdn written based on David Hinds's version 2.2.3. +*/ + +#ifndef __INCpcich +#define __INCpcich + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + + +#define PCIC_MAX_SOCKS 8 /* number of sockets */ +#define PCIC_MEM_WINDOWS 5 /* number of memory windows */ +#define PCIC_IO_WINDOWS 2 /* number of io windows */ + +/* PCIC compatible chips */ + +#define PCIC_I82365 0x10 /* Intel 82365 */ +#define PCIC_PD672X 0x20 /* Cirrus clone */ +#define PCIC_PD6710 0x30 /* Cirrus clone */ +#define PCIC_VLSI 0x40 /* VLSI clone */ +#define PCIC_IBM 0x50 /* IBM clone */ +#define PCIC_VG468 0x60 /* Vadem clone */ +#define PCIC_RICOH 0x70 /* Ricoh clone */ + +/* Offsets for PCIC registers */ + +#define PCIC_IDENT 0x00 /* Identification and revision */ +#define PCIC_STATUS 0x01 /* Interface status */ +#define PCIC_POWER 0x02 /* Power and RESETDRV control */ +#define PCIC_INTCTL 0x03 /* Interrupt and general control */ +#define PCIC_CSC 0x04 /* Card status change */ +#define PCIC_CSCINT 0x05 /* Card status change int control */ +#define PCIC_ADDRWIN 0x06 /* Address window enable */ +#define PCIC_IOCTL 0x07 /* I/O control */ +#define PCIC_GENCTL 0x16 /* Card detect and general control */ +#define PCIC_GBLCTL 0x1E /* Global control register */ + +/* Offsets for I/O and memory window registers */ + +#define PCIC_IO(win) (0x08+((win)<<2)) +#define PCIC_MEM(win) (0x10+((win)<<3)) +#define PCIC_W_START 0 +#define PCIC_W_STOP 2 +#define PCIC_W_OFF 4 + +/* Flags for PCIC_STATUS */ + +#define PCIC_CS_BVD1 0x01 +#define PCIC_CS_STSCHG 0x01 +#define PCIC_CS_BVD2 0x02 +#define PCIC_CS_SPKR 0x02 +#define PCIC_CS_DETECT 0x0c +#define PCIC_CS_WRPROT 0x10 +#define PCIC_CS_READY 0x20 +#define PCIC_CS_POWERON 0x40 +#define PCIC_CS_GPI 0x80 + +/* Flags for PCIC_POWER */ + +#define PCIC_PWR_OFF 0x00 /* Turn off the socket */ +#define PCIC_VPP_5V 0x05 /* Vpp = 5.0v */ +#define PCIC_VPP_12V 0x0a /* Vpp = 12.0v */ +#define PCIC_VPP_MASK 0x0f /* Mask for turning off Vpp */ +#define PCIC_VCC_5V 0x10 /* Vcc = 5.0v */ +#define PCIC_VCC_3V 0x18 /* Vcc = 3.3v */ +#define PCIC_VCC_MASK 0x18 /* Mask for turning off Vcc */ +#define PCIC_PWR_AUTO 0x20 /* Auto pwr switch enable */ +#define PCIC_PWR_NORESET 0x40 /* Disable RESETDRV on resume */ +#define PCIC_PWR_OUT 0x80 /* Output enable */ + +/* Flags for PCIC_INTCTL */ + +#define PCIC_IRQ_MASK 0x0F +#define PCIC_INTR_ENA 0x10 +#define PCIC_PC_IOCARD 0x20 +#define PCIC_PC_RESET 0x40 +#define PCIC_RING_ENA 0x80 + +/* Flags for PCIC_CSC and PCIC_CSCINT*/ + +#define PCIC_CSC_BVD1 0x01 +#define PCIC_CSC_STSCHG 0x01 +#define PCIC_CSC_BVD2 0x02 +#define PCIC_CSC_READY 0x04 +#define PCIC_CSC_DETECT 0x08 +#define PCIC_CSC_ANY 0x0F +#define PCIC_CSC_GPI 0x10 + +/* Flags for PCIC_ADDRWIN */ + +#define PCIC_ENA_IO(win) (0x40 << (win)) +#define PCIC_ENA_MEM(win) (0x01 << (win)) +#define PCIC_ENA_ALL 0xdf +#define PCIC_ENA_MEMCS16 0x20 + +/* Flags for PCIC_IOCTL */ + +#define PCIC_IOCTL_MASK(win) (0x0F << (win<<2)) +#define PCIC_IOCTL_WAIT(win) (0x08 << (win<<2)) +#define PCIC_IOCTL_0WS(win) (0x04 << (win<<2)) +#define PCIC_IOCTL_CS16(win) (0x02 << (win<<2)) +#define PCIC_IOCTL_16BIT(win) (0x01 << (win<<2)) + +/* Flags for PCIC_GENCTL */ + +#define PCIC_CTL_16DELAY 0x01 +#define PCIC_CTL_RESET_ENA 0x02 +#define PCIC_CTL_GPI_ENA 0x04 +#define PCIC_CTL_GPI_CTL 0x08 +#define PCIC_CTL_RESUME 0x10 +#define PCIC_CTL_SW_IRQ 0x20 + +/* Flags for PCIC_GBLCTL */ + +#define PCIC_GBL_PWRDOWN 0x01 +#define PCIC_GBL_CSC_LEV 0x02 +#define PCIC_GBL_WRBACK 0x04 +#define PCIC_GBL_IRQ_0_LEV 0x08 +#define PCIC_GBL_IRQ_1_LEV 0x10 + +/* Flags for memory window registers */ + +#define PCIC_MEM_16BIT 0x8000 /* In memory start high byte */ +#define PCIC_MEM_0WS 0x4000 +#define PCIC_MEM_WS1 0x8000 /* In memory stop high byte */ +#define PCIC_MEM_WS0 0x4000 +#define PCIC_MEM_WRPROT 0x8000 /* In offset high byte */ +#define PCIC_MEM_REG 0x4000 + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern int pcicInit (int ioBase, int intVec, int intLevel, + FUNCPTR showRtn); +extern void pcicShow (int sock); + +#else + +extern int pcicInit (); +extern void pcicShow (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpcich */ diff --git a/h/drv/pcmcia/pcmciaLib.h b/h/drv/pcmcia/pcmciaLib.h new file mode 100644 index 0000000..0ec3b88 --- /dev/null +++ b/h/drv/pcmcia/pcmciaLib.h @@ -0,0 +1,248 @@ +/* pcmciaLib.h - PCMCIA library header */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ +/* Copyright (c) 1994 David A. Hinds -- All Rights Reserved */ + +/* +modification history +-------------------- +01c,16jan97,hdn added two new members to PCMCIA_CTRL. +01b,22feb96,hdn cleaned up. +01a,19jan95,hdn written based on David Hinds's version 2.2.3. +*/ + +#ifndef __INCpcmciah +#define __INCpcmciah + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" + + +/* pcmciaLib status codes */ + +#define S_pcmciaLib_BATTERY_DEAD (M_pcmciaLib | 1) +#define S_pcmciaLib_BATTERY_WARNING (M_pcmciaLib | 2) + + +#ifndef _ASMLANGUAGE + +#include "dllLib.h" +#include "blkIo.h" +#include "sysLib.h" +#include "dosFsLib.h" +#include "drv/pcmcia/pccardLib.h" + +#define DOS_ID_OFFSET 3 +#define FIRST_PARTITION_SECTOR_OFFSET (0x1be + 8) +#define VXDOS "VXDOS" +#define VXEXT "VXEXT" + +#define PCMCIA_MAX_ARGS 6 /* max args to task level call */ +#define PCMCIA_MAX_MSGS 10 /* max number of PCMCIA event msgs */ +#define MAX_SOCKETS 8 /* XXX */ +#define PCMCIA_CIS_WINDOW 0 /* memory window for CIS */ + + +typedef struct pcmciaCard /* for PC card */ + { + int type; /* card type */ + int sock; /* socket no. */ + int ctrl; /* controller no. */ + BOOL detected; /* TRUE if a card is detected */ + BOOL installed; /* TRUE if a driver is installed */ + BOOL changed; /* TRUE if a card is changed */ + int regBase; /* config register base */ + int regMask; /* config register mask */ + int cardStatus; /* card status */ + int initStatus; /* init status */ + FUNCPTR cscIntr; /* CSC interrupt handler */ + FUNCPTR showRtn; /* show routine */ + DL_LIST cisTupleList; /* CIS tuple link list */ + DL_LIST cisConfigList; /* CIS config tuple link list */ + PCCARD_RESOURCE *pResource; /* resources for the card */ + BLK_DEV *pBlkDev; /* booting for block device */ + NETIF *pNetIf; /* booting for ethernet device */ + DOS_VOL_DESC *pDos; /* DOS file system volume descriptor */ + } PCMCIA_CARD; + +typedef struct pcmciaChip /* for PCMCIA host adapter chip */ + { + int type; /* type of PCMCIA adapter chip */ + char *name; /* name of PCMCIA adapter chip */ + BOOL installed; /* TRUE if it is installed */ + int socks; /* number of sockets supported */ + int flags; /* */ + int intLevel; /* CSC interrupt level */ + int memWindows; /* number of memory windows */ + int ioWindows; /* number of io windows */ + FUNCPTR reset; /* reset routine */ + FUNCPTR status; /* status routine */ + FUNCPTR flagGet; /* flag get routine */ + FUNCPTR flagSet; /* flag set routine */ + FUNCPTR cscOn; /* CSC on routine */ + FUNCPTR cscOff; /* CSC off routine */ + FUNCPTR cscPoll; /* CSC poll routine */ + FUNCPTR irqGet; /* IRQ get routine */ + FUNCPTR irqSet; /* IRQ set routine */ + FUNCPTR iowinGet; /* io window get routine */ + FUNCPTR iowinSet; /* io window set routine */ + FUNCPTR memwinGet; /* memory window get routine */ + FUNCPTR memwinSet; /* memory window set routine */ + FUNCPTR showRtn; /* show routine */ + } PCMCIA_CHIP; + +typedef struct pcmciaCtrl + { + int socks; /* number of sockets */ + int memBase; /* mapping memory base addr */ + PCMCIA_CHIP chip; /* chip structure */ + PCMCIA_CARD card[MAX_SOCKETS]; /* card structure */ + } PCMCIA_CTRL; + +typedef struct pcmciaIowin + { + int window; + int flags; + int extraws; + int start; + int stop; + } PCMCIA_IOWIN; + +typedef struct pcmciaMemwin + { + int window; + int flags; + int extraws; + int start; + int stop; + int cardstart; + } PCMCIA_MEMWIN; + +typedef struct pcmciaAdapter + { + int type; /* type of a PCMCIA adapter chip */ + int ioBase; /* IO base address */ + int intVec; /* CSC interrupt vector */ + int intLevel; /* CSC interrupt level */ + FUNCPTR initRtn; /* initialize routine */ + FUNCPTR showRtn; /* show routine */ + } PCMCIA_ADAPTER; + +typedef struct pcmciaMsg + { + VOIDFUNCPTR func; /* pointer to function to invoke */ + int arg [PCMCIA_MAX_ARGS]; /* args for function */ + } PCMCIA_MSG; + +/* supported PCMCIA host adapter chip type */ + +#define PCMCIA_PCIC 0x01 +#define PCMCIA_TCIC 0x02 + +/* supported PC card type */ + +#define PCCARD_SRAM 0x01 +#define PCCARD_ATA 0x02 +#define PCCARD_LAN_ELT 0x03 + +/* configuration register number */ + +#define CONFIG_OPTION_REG 0 +#define CONFIG_STATUS_REG 1 +#define PIN_REPLACEMENT_REG 2 +#define SOCKET_COPY_REG 3 + +/* bits in configuration option register */ + +#define COPTION_SRESET 0x80 +#define COPTION_LEVIRQ 0x40 + +/* bits in configuration status register */ + +#define CSTATUS_CHANGED 0x80 +#define CSTATUS_SIGCHG 0x40 +#define CSTATUS_IOIS8 0x20 +#define CSTATUS_AUDIO 0x08 +#define CSTATUS_PWRDWN 0x04 +#define CSTATUS_INTR 0x02 + +/* bits in pin replacement register */ + +#define PINREP_CBVD1 0x80 +#define PINREP_CBVD2 0x40 +#define PINREP_CRDYBSY 0x20 +#define PINREP_CWPROT 0x10 +#define PINREP_RBVD1 0x08 +#define PINREP_RBVD2 0x04 +#define PINREP_RRDYBSY 0x02 +#define PINREP_RWPROT 0x01 + + +/* definitions for card status flags */ + +#define PC_WRPROT 0x001 +#define PC_CARDLOCK 0x002 +#define PC_NO_CARD 0x004 +#define PC_IS_CARD 0x008 +#define PC_BATDEAD 0x010 +#define PC_BATWARN 0x020 +#define PC_READY 0x040 +#define PC_DETECT 0x080 +#define PC_POWERON 0x100 +#define PC_GPI 0x200 +#define PC_STSCHG 0x400 + +/* various card configuration flags */ + +#define PC_PWR_OFF 0x00 +#define PC_VCC_MASK 0x03 +#define PC_VCC_3V 0x01 +#define PC_VCC_5V 0x02 +#define PC_VPP_MASK 0x0C +#define PC_VPP_5V 0x04 +#define PC_VPP_12V 0x08 +#define PC_PWR_AUTO 0x10 +#define PC_IOCARD 0x20 +#define PC_RESET 0x40 + +/* flags for I/O port and memory windows */ + +#define MAP_ACTIVE 0x01 +#define MAP_16BIT 0x02 +#define MAP_0WS 0x04 +#define MAP_CS16 0x08 +#define MAP_WRPROT 0x10 +#define MAP_ATTRIB 0x20 + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS pcmciaInit (void); +extern STATUS pcmciaJobAdd (VOIDFUNCPTR func, int arg1, int arg2, + int arg3, int arg4, int arg5, int arg6); +extern void pcmciad (void); +extern void pcmciaShowInit (void); +extern void pcmciaShow (int sock); + +#else + +extern STATUS pcmciaInit (); +extern STATUS pcmciaJobAdd (); +extern void pcmciad (); +extern void pcmciaShowInit (); +extern void pcmciaShow (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpcmciah */ diff --git a/h/drv/pcmcia/pd67.h b/h/drv/pcmcia/pd67.h new file mode 100644 index 0000000..c62fbc9 --- /dev/null +++ b/h/drv/pcmcia/pd67.h @@ -0,0 +1,84 @@ +/* pd67.h - Cirrus CL-PD67xx PCMCIA Host Bus Adaptor chip header */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ +/* Copyright (c) 1994 David A. Hinds -- All Rights Reserved */ + +/* +modification history +-------------------- +01b,22feb96,hdn cleaned up. +01a,12oct95,hdn written based on David Hinds's version 2.2.3. +*/ + +#ifndef __INCpd67h +#define __INCpd67h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + + +#define PD67_MISC_CTL_1 0x16 /* Misc control 1 */ +#define PD67_FIFO_CTL 0x17 /* FIFO control */ +#define PD67_MISC_CTL_2 0x1E /* Misc control 2 */ +#define PD67_CHIP_INFO 0x1f /* Chip information */ + +/* I/O window address offset */ + +#define PD67_IO_OFF(w) (0x36+((w)<<1)) + +/* Timing register sets */ + +#define PD67_TIME_SETUP(n) (0x3a + 3*(n)) +#define PD67_TIME_CMD(n) (0x3b + 3*(n)) +#define PD67_TIME_RECOV(n) (0x3c + 3*(n)) + +/* Flags for PD67_MISC_CTL_1 */ + +#define PD67_MC1_5V_DET 0x01 /* 5v detect */ +#define PD67_MC1_VCC_3V 0x02 /* 3.3v Vcc */ +#define PD67_MC1_PULSE_MGMT 0x04 +#define PD67_MC1_PULSE_IRQ 0x08 +#define PD67_MC1_SPKR_ENA 0x10 +#define PD67_MC1_INPACK_ENA 0x80 + +/* Flags for PD67_FIFO_CTL */ + +#define PD67_FIFO_EMPTY 0x80 + +/* Flags for PD67_MISC_CTL_2 */ + +#define PD67_MC2_FREQ_BYPASS 0x01 +#define PD67_MC2_DYNAMIC_MODE 0x02 +#define PD67_MC2_SUSPEND 0x04 +#define PD67_MC2_5V_CORE 0x08 +#define PD67_MC2_LED_ENA 0x10 /* IRQ 12 is LED enable */ +#define PD67_MC2_3STATE_BIT7 0x20 /* Floppy change bit */ +#define PD67_MC2_DMA_MODE 0x40 +#define PD67_MC2_IRQ15_RI 0x80 /* IRQ 15 is ring enable */ + +/* Flags for PD67_CHIP_INFO */ + +#define PD67_INFO_SLOTS 0x20 /* 0 = 1 slot, 1 = 2 slots */ +#define PD67_INFO_CHIP_ID 0xc0 +#define PD67_INFO_REV 0x1c + +/* Fields in PD67_TIME_* registers */ + +#define PD67_TIME_SCALE 0xc0 +#define PD67_TIME_SCALE_1 0x00 +#define PD67_TIME_SCALE_16 0x40 +#define PD67_TIME_SCALE_256 0x80 +#define PD67_TIME_SCALE_4096 0xc0 +#define PD67_TIME_MULT 0x3f + + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpd67h */ diff --git a/h/drv/pcmcia/ricoh.h b/h/drv/pcmcia/ricoh.h new file mode 100644 index 0000000..525e557 --- /dev/null +++ b/h/drv/pcmcia/ricoh.h @@ -0,0 +1,73 @@ +/* ricoh.h - Ricoh PCMCIA Host Bus Adaptor chip header */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ +/* Copyright (c) 1994 David A. Hinds -- All Rights Reserved */ + +/* +modification history +-------------------- +01b,22feb96,hdn cleaned up. +01a,04dec95,hdn written based on David Hinds's version 2.6.3. +*/ + +#ifndef __INCricohh +#define __INCricohh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + + +#define RF5C_MODE_CTL 0x1f /* Mode control */ +#define RF5C_PWR_CTL 0x2f /* Mixed voltage control */ +#define RF5C_CHIP_ID 0x3a /* Chip identification */ +#define RF5C_MODE_CTL_3 0x3b /* Mode control 3 */ + +/* I/O window address offset */ + +#define RF5C_IO_OFF(w) (0x36+((w)<<1)) + +/* Flags for RF5C_MODE_CTL */ + +#define RF5C_MODE_ATA 0x01 /* ATA mode */ +#define RF5C_MODE_LED_ENA 0x02 /* IRQ 12 is LED */ +#define RF5C_MODE_CA21 0x04 +#define RF5C_MODE_CA22 0x08 +#define RF5C_MODE_CA23 0x10 +#define RF5C_MODE_CA24 0x20 +#define RF5C_MODE_CA25 0x40 +#define RF5C_MODE_3STATE_BIT7 0x80 + +/* Flags for RF5C_PWR_CTL */ + +#define RF5C_PWR_VCC_3V 0x01 +#define RF5C_PWR_IREQ_HIGH 0x02 +#define RF5C_PWR_INPACK_ENA 0x04 +#define RF5C_PWR_5V_DET 0x08 +#define RF5C_PWR_TC_SEL 0x10 /* Terminal Count: irq 11 or 15 */ +#define RF5C_PWR_DREQ_LOW 0x20 +#define RF5C_PWR_DREQ_OFF 0x00 /* DREQ steering control */ +#define RF5C_PWR_DREQ_INPACK 0x40 +#define RF5C_PWR_DREQ_SPKR 0x80 +#define RF5C_PWR_DREQ_IOIS16 0xc0 + +/* Values for RF5C_CHIP_ID */ + +#define RF5C_CHIP_RF5C296 0x32 +#define RF5C_CHIP_RF5C396 0xb2 + +/* Flags for RF5C_MODE_CTL_3 */ + +#define RF5C_MCTL3_DISABLE 0x01 /* Disable PCMCIA interface */ +#define RF5C_MCTL3_DMA_ENA 0x02 + + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCricohh */ diff --git a/h/drv/pcmcia/sramDrv.h b/h/drv/pcmcia/sramDrv.h new file mode 100644 index 0000000..894f1f5 --- /dev/null +++ b/h/drv/pcmcia/sramDrv.h @@ -0,0 +1,70 @@ +/* sramDrv.h - PCMCIA memory driver header file */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,22feb96,hdn cleaned up. +01a,28feb95,hdn written +*/ + +#ifndef __INCsramDrvh +#define __INCsramDrvh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + + +#define DEFAULT_DISK_SIZE 512000 +#define DEFAULT_SEC_SIZE 512 + +#include "private/semLibP.h" +#include "blkIo.h" +#include "iosLib.h" + +typedef struct sramCtrl /* PCMCIA memory device controller */ + { + SEMAPHORE muteSem[MAX_SOCKETS]; /* mutex sem for mutual-exclusion */ + SEMAPHORE syncSem[MAX_SOCKETS]; /* binary sem for syncronization */ + } SRAM_CTRL; + +typedef struct sramDev /* PCMCIA memory block device descriptor */ + { + BLK_DEV blkDev; /* generic block device structure */ + int sock; /* socket no. */ + int blkOffset; /* block offset of this device from ram_addr */ + } SRAM_DEV; + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS sramDrv (int sock); +extern BLK_DEV *sramDevCreate (int sock, int bytesPerBlk, int blksPerTrack, + int nBlocks, int blkOffset); +extern STATUS sramMap (int sock, int type, int start, int stop, + int offset, int extraws); +extern STATUS sramShow (int sock); + +#else /* __STDC__ */ + +extern STATUS sramDrv (); +extern BLK_DEV *sramDevCreate (); +extern STATUS sramMap (); +extern STATUS sramShow (); + +#endif /* __STDC__ */ + + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsramDrvh */ diff --git a/h/drv/pcmcia/tcic.h b/h/drv/pcmcia/tcic.h new file mode 100644 index 0000000..fdcf81f --- /dev/null +++ b/h/drv/pcmcia/tcic.h @@ -0,0 +1,283 @@ +/* tcic.h - Databook TCIC/2 PCMCIA Host Bus Adaptor Chip header */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ +/* Copyright (c) 1994 David A. Hinds -- All Rights Reserved */ + +/* +modification history +-------------------- +01b,22feb96,hdn cleaned up. +01a,03oct95,hdn written based on David Hinds's version 2.2.3. +*/ + +#ifndef __INCtcich +#define __INCtcich + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + + +#define TCIC_MAX_SOCKS 2 /* number of sockets */ +#define TCIC_MEM_WINDOWS 4 /* number of memory windows */ +#define TCIC_IO_WINDOWS 2 /* number of io windows */ + +/* offsets of registers from TCIC_BASE */ + +#define TCIC_DATA 0x00 +#define TCIC_ADDR 0x02 +#define TCIC_SCTRL 0x06 +#define TCIC_SSTAT 0x07 +#define TCIC_MODE 0x08 +#define TCIC_PWR 0x09 +#define TCIC_EDC 0x0A +#define TCIC_ICSR 0x0C +#define TCIC_IENA 0x0D +#define TCIC_AUX 0x0E + +#define TCIC_SS_SHFT 12 +#define TCIC_SS_MASK 0x7000 + +/* Flags for TCIC_ADDR */ + +#define TCIC_ADR2_REG 0x8000 +#define TCIC_ADR2_INDREG 0x0800 + +#define TCIC_ADDR_REG 0x80000000 +#define TCIC_ADDR_SS_SHFT (TCIC_SS_SHFT+16) +#define TCIC_ADDR_SS_MASK (TCIC_SS_MASK<<16) +#define TCIC_ADDR_INDREG 0x08000000 +#define TCIC_ADDR_IO 0x04000000 +#define TCIC_ADDR_MASK 0x03ffffff + +/* Flags for TCIC_SCTRL */ + +#define TCIC_SCTRL_ENA 0x01 +#define TCIC_SCTRL_INCMODE 0x18 +#define TCIC_SCTRL_INCMODE_HOLD 0x00 +#define TCIC_SCTRL_INCMODE_WORD 0x08 +#define TCIC_SCTRL_INCMODE_REG 0x10 +#define TCIC_SCTRL_INCMODE_AUTO 0x18 +#define TCIC_SCTRL_EDCSUM 0x20 +#define TCIC_SCTRL_RESET 0x80 + +/* Flags for TCIC_SSTAT */ + +#define TCIC_SSTAT_6US 0x01 +#define TCIC_SSTAT_10US 0x02 +#define TCIC_SSTAT_PROGTIME 0x04 +#define TCIC_SSTAT_LBAT1 0x08 +#define TCIC_SSTAT_LBAT2 0x10 +#define TCIC_SSTAT_RDY 0x20 /* Inverted */ +#define TCIC_SSTAT_WP 0x40 +#define TCIC_SSTAT_CD 0x80 /* Card detect */ + +/* Flags for TCIC_MODE */ + +#define TCIC_MODE_PGMMASK 0x1f +#define TCIC_MODE_NORMAL 0x00 +#define TCIC_MODE_PGMWR 0x01 +#define TCIC_MODE_PGMRD 0x02 +#define TCIC_MODE_PGMCE 0x04 +#define TCIC_MODE_PGMDBW 0x08 +#define TCIC_MODE_PGMWORD 0x10 +#define TCIC_MODE_AUXSEL_MASK 0xe0 + +/* Registers accessed through TCIC_AUX, by setting TCIC_MODE */ + +#define TCIC_AUX_TCTL (0<<5) +#define TCIC_AUX_PCTL (1<<5) +#define TCIC_AUX_WCTL (2<<5) +#define TCIC_AUX_EXTERN (3<<5) +#define TCIC_AUX_PDATA (4<<5) +#define TCIC_AUX_SYSCFG (5<<5) +#define TCIC_AUX_ILOCK (6<<5) +#define TCIC_AUX_TEST (7<<5) + +/* Flags for TCIC_PWR */ + +#define TCIC_PWR_VCC(sock) (0x01<<(sock)) +#define TCIC_PWR_VCC_MASK 0x03 +#define TCIC_PWR_VPP(sock) (0x08<<(sock)) +#define TCIC_PWR_VPP_MASK 0x18 +#define TCIC_PWR_CLIMENA 0x40 +#define TCIC_PWR_CLIMSTAT 0x80 + +/* Flags for TCIC_ICSR */ + +#define TCIC_ICSR_CLEAR 0x01 +#define TCIC_ICSR_SET 0x02 +#define TCIC_ICSR_STOPCPU 0x04 +#define TCIC_ICSR_ILOCK 0x08 +#define TCIC_ICSR_PROGTIME 0x10 +#define TCIC_ICSR_ERR 0x20 +#define TCIC_ICSR_CDCHG 0x40 +#define TCIC_ICSR_IOCHK 0x80 + +/* Flags for TCIC_IENA */ + +#define TCIC_IENA_CFG_MASK 0x03 +#define TCIC_IENA_CFG_OFF 0x00 /* disabled */ +#define TCIC_IENA_CFG_OD 0x01 /* active low, open drain */ +#define TCIC_IENA_CFG_LOW 0x02 /* active low, totem pole */ +#define TCIC_IENA_CFG_HIGH 0x03 /* active high, totem pole */ +#define TCIC_IENA_ILOCK 0x08 +#define TCIC_IENA_PROGTIME 0x10 +#define TCIC_IENA_ERR 0x20 /* overcurrent or iochk */ +#define TCIC_IENA_CDCHG 0x40 + +/* Flags for TCIC_AUX_WCTL */ + +#define TCIC_WAIT_COUNT_MASK 0x001f +#define TCIC_WAIT_ASYNC 0x0020 +#define TCIC_WAIT_SENSE 0x0040 +#define TCIC_WAIT_SRC 0x0080 +#define TCIC_WCTL_WR 0x0100 +#define TCIC_WCTL_RD 0x0200 +#define TCIC_WCTL_CE 0x0400 +#define TCIC_WCTL_LLBAT1 0x0800 +#define TCIC_WCTL_LLBAT2 0x1000 +#define TCIC_WCTL_LRDY 0x2000 +#define TCIC_WCTL_LWP 0x4000 +#define TCIC_WCTL_LCD 0x8000 + +/* Flags for TCIC_AUX_SYSCFG */ + +#define TCIC_SYSCFG_IRQ_MASK 0x000f +#define TCIC_SYSCFG_MCSFULL 0x0010 +#define TCIC_SYSCFG_IO1723 0x0020 +#define TCIC_SYSCFG_MCSXB 0x0040 +#define TCIC_SYSCFG_ICSXB 0x0080 +#define TCIC_SYSCFG_NOPDN 0x0100 +#define TCIC_SYSCFG_MPSEL_SHFT 9 +#define TCIC_SYSCFG_MPSEL_MASK 0x0e00 +#define TCIC_SYSCFG_MPSENSE 0x2000 +#define TCIC_SYSCFG_AUTOBUSY 0x4000 +#define TCIC_SYSCFG_ACC 0x8000 + +#define TCIC_ILOCK_OUT 0x01 +#define TCIC_ILOCK_SENSE 0x02 +#define TCIC_ILOCK_CRESET 0x04 +#define TCIC_ILOCK_CRESENA 0x08 +#define TCIC_ILOCK_CWAIT 0x10 +#define TCIC_ILOCK_CWAITSNS 0x20 +#define TCIC_ILOCK_HOLD_MASK 0xc0 +#define TCIC_ILOCK_HOLD_CCLK 0xc0 + +#define TCIC_ILOCKTEST_ID_SH 8 +#define TCIC_ILOCKTEST_ID_MASK 0x7f00 +#define TCIC_ILOCKTEST_MCIC_1 0x8000 + +#define TCIC_TEST_DIAG 0x8000 + +/* Indirectly addressed registers */ + +#define TCIC_SCF1(sock) ((sock)<<3) +#define TCIC_SCF2(sock) (((sock)<<3)+2) + +/* Flags for SCF1 */ + +#define TCIC_SCF1_IRQ_MASK 0x000f +#define TCIC_SCF1_IRQ_OFF 0x0000 +#define TCIC_SCF1_IRQOC 0x0010 +#define TCIC_SCF1_PCVT 0x0020 +#define TCIC_SCF1_IRDY 0x0040 +#define TCIC_SCF1_ATA 0x0080 +#define TCIC_SCF1_DMA_SHIFT 8 +#define TCIC_SCF1_DMA_OFF 0 +#define TCIC_SCF1_DREQ2 2 +#define TCIC_SCF1_IOSTS 0x0800 +#define TCIC_SCF1_SPKR 0x1000 +#define TCIC_SCF1_FINPACK 0x2000 +#define TCIC_SCF1_DELWR 0x4000 +#define TCIC_SCF1_HD7IDE 0x8000 + +/* Flags for SCF2 */ + +#define TCIC_SCF2_RI 0x0001 +#define TCIC_SCF2_IDBR 0x0002 +#define TCIC_SCF2_MDBR 0x0004 +#define TCIC_SCF2_MLBAT1 0x0008 +#define TCIC_SCF2_MLBAT2 0x0010 +#define TCIC_SCF2_MRDY 0x0020 +#define TCIC_SCF2_MWP 0x0040 +#define TCIC_SCF2_MCD 0x0080 + +/* Indirect addresses for memory window registers */ + +#define TCIC_MWIN(sock,map) (0x100+(((map)+((sock)<<2))<<3)) +#define TCIC_MBASE_X 2 +#define TCIC_MMAP_X 4 +#define TCIC_MCTL_X 6 + +#define TCIC_MBASE_4K_BIT 0x4000 +#define TCIC_MBASE_HA_SHFT 12 +#define TCIC_MBASE_HA_MASK 0x0fff + +#define TCIC_MMAP_REG 0x8000 +#define TCIC_MMAP_CA_SHFT 12 +#define TCIC_MMAP_CA_MASK 0x3fff + +#define TCIC_MCTL_WSCNT_MASK 0x001f +#define TCIC_MCTL_WCLK 0x0020 +#define TCIC_MCTL_WCLK_CCLK 0x0000 +#define TCIC_MCTL_WCLK_BCLK 0x0020 +#define TCIC_MCTL_QUIET 0x0040 +#define TCIC_MCTL_WP 0x0080 +#define TCIC_MCTL_ACC 0x0100 +#define TCIC_MCTL_KE 0x0200 +#define TCIC_MCTL_EDC 0x0400 +#define TCIC_MCTL_B8 0x0800 +#define TCIC_MCTL_SS_SHFT TCIC_SS_SHFT +#define TCIC_MCTL_SS_MASK TCIC_SS_MASK +#define TCIC_MCTL_ENA 0x8000 + +/* Indirect addresses for I/O window registers */ + +#define TCIC_IWIN(sock,map) (0x200+(((map)+((sock)<<1))<<2)) +#define TCIC_IBASE_X 0 +#define TCIC_ICTL_X 2 + +#define TCIC_ICTL_WSCNT_MASK TCIC_MCTL_WSCNT_MASK +#define TCIC_ICTL_QUIET TCIC_MCTL_QUIET +#define TCIC_ICTL_1K 0x0080 +#define TCIC_ICTL_PASS16 0x0100 +#define TCIC_ICTL_ACC TCIC_MCTL_ACC +#define TCIC_ICTL_TINY 0x0200 +#define TCIC_ICTL_B16 0x0400 +#define TCIC_ICTL_B8 TCIC_MCTL_B8 +#define TCIC_ICTL_BW_MASK (TCIC_ICTL_B16|TCIC_ICTL_B8) +#define TCIC_ICTL_BW_DYN 0 +#define TCIC_ICTL_BW_8 TCIC_ICTL_B8 +#define TCIC_ICTL_BW_16 TCIC_ICTL_B16 +#define TCIC_ICTL_BW_ATA (TCIC_ICTL_B16|TCIC_ICTL_B8) +#define TCIC_ICTL_SS_SHFT TCIC_SS_SHFT +#define TCIC_ICTL_SS_MASK TCIC_SS_MASK +#define TCIC_ICTL_ENA TCIC_MCTL_ENA + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern int tcicInit (int ioBase, int intVec, int intLevel, + FUNCPTR showRtn); +extern void tcicShow (int sock); + + +#else + +extern int tcicInit (); +extern void tcicShow (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtcich */ diff --git a/h/drv/pcmcia/vg468.h b/h/drv/pcmcia/vg468.h new file mode 100644 index 0000000..cdadecf --- /dev/null +++ b/h/drv/pcmcia/vg468.h @@ -0,0 +1,75 @@ +/* vg468.h - Vadem VG-468 PCMCIA Host Bus Adaptor chip header */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ +/* Copyright (c) 1994 David A. Hinds -- All Rights Reserved */ + +/* +modification history +-------------------- +01b,22feb96,hdn cleaned up. +01a,04dec95,hdn written based on David Hinds's version 2.6.3. +*/ + +#ifndef __INCvg468h +#define __INCvg468h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + + +/* Special bit in I365_IDENT used for Vadem chip detection */ + +#define PCIC_IDENT_VADEM 0x08 + +/* Special definitions in I365_POWER */ + +#define VG468_VPP2_MASK 0x0c +#define VG468_VPP2_5V 0x04 +#define VG468_VPP2_12V 0x08 + +/* Unique Vadem registers */ + +#define VG468_CTL 0x38 /* Control register */ +#define VG468_TIMER 0x39 /* Timer control */ +#define VG468_MISC 0x3a /* Miscellaneous */ +#define VG468_GPIO_CFG 0x3b /* GPIO configuration */ +#define VG468_SELECT 0x3d /* Programmable chip select */ +#define VG468_SELECT_CFG 0x3e /* Chip select configuration */ +#define VG468_ATA 0x3f /* ATA control */ + +/* Flags for VG468_CTL */ + +#define VG468_CTL_SLOW 0x01 /* 600ns memory timing */ +#define VG468_CTL_ASYNC 0x02 /* Asynchronous bus clocking */ +#define VG468_CTL_TSSI 0x08 /* Tri-state some outputs */ +#define VG468_CTL_DELAY 0x10 /* Card detect debounce */ +#define VG468_CTL_INPACK 0x20 /* Obey INPACK signal? */ +#define VG468_CTL_POLARITY 0x40 /* VCCEN polarity */ +#define VG468_CTL_COMPAT 0x80 /* Compatibility stuff */ + +/* Flags for VG468_TIMER */ + +#define VG468_TIMER_ZEROPWR 0x10 /* Zero power control */ +#define VG468_TIMER_SIGEN 0x20 /* Power up */ +#define VG468_TIMER_STATUS 0x40 /* Activity timer status */ +#define VG468_TIMER_RES 0x80 /* Timer resolution */ +#define VG468_TIMER_MASK 0x0f /* Activity timer timeout */ + +/* Flags for VT468_MISC */ + +#define VG468_MISC_UNLOCK 0x80 /* Unique register lock */ +#define VG468_MISC_VADEMREV 0x40 /* Vadem revision control */ +#define VG468_MISC_DMAWSB 0x08 /* DMA wait state control */ +#define VG468_MISC_GPIO 0x04 /* General-purpose IO */ + + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvg468h */ diff --git a/h/drv/rtc/hd146818.h b/h/drv/rtc/hd146818.h new file mode 100644 index 0000000..8f36889 --- /dev/null +++ b/h/drv/rtc/hd146818.h @@ -0,0 +1,86 @@ +/* hd146818.h - Hitachi 146818 RTC Real Time Clock header */ + +/* Copyright 1991-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01e,22sep92,rrr added support for c++ +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01b,07jun91,hdn defined HD146818_REG_OFFSET. +01a,26feb91,hdn written. +*/ + +#ifndef __INChd146818h +#define __INChd146818h + +#ifdef __cplusplus +extern "C" { +#endif + +#define HD146818_REG_OFFSET 3 + +#ifndef _ASMLANGUAGE +typedef struct + { + UCHAR pad0[HD146818_REG_OFFSET]; + UCHAR seconds; + UCHAR pad1[HD146818_REG_OFFSET]; + UCHAR secAlarm; + UCHAR pad2[HD146818_REG_OFFSET]; + UCHAR minutes; + UCHAR pad3[HD146818_REG_OFFSET]; + UCHAR minAlarm; + UCHAR pad4[HD146818_REG_OFFSET]; + UCHAR hours; + UCHAR pad5[HD146818_REG_OFFSET]; + UCHAR hrAlarm; + UCHAR pad6[HD146818_REG_OFFSET]; + UCHAR dayOfWeek; + UCHAR pad7[HD146818_REG_OFFSET]; + UCHAR date; + UCHAR pad8[HD146818_REG_OFFSET]; + UCHAR month; + UCHAR pad9[HD146818_REG_OFFSET]; + UCHAR year; + UCHAR pad10[HD146818_REG_OFFSET]; + UCHAR controlA; + UCHAR pad11[HD146818_REG_OFFSET]; + UCHAR controlB; + UCHAR pad12[HD146818_REG_OFFSET]; + UCHAR controlC; + UCHAR pad13[HD146818_REG_OFFSET]; + UCHAR controlD; + } RTC; +#endif /* _ASMLANGUAGE */ + +/* bit values for control register A */ +#define RTC_UIP 0x80 +#define RTC_1MHZ 0x10 +#define RTC_32KHZ 0x20 +#define RTC_DV_RESET 0x60 + +/* bit values for control register B */ +#define RTC_SET 0x80 +#define RTC_PIE 0x40 +#define RTC_AIE 0x20 +#define RTC_UIE 0x10 +#define RTC_SQWE 0x08 +#define RTC_DM 0x04 +#define RTC_24 0x02 +#define RTC_DSE 0x01 + +/* bit values for control register C */ +#define RTC_IRQF 0x80 +#define RTC_PF 0x40 +#define RTC_AF 0x20 +#define RTC_UF 0x10 + +#ifdef __cplusplus +} +#endif + +#endif /* __INChd146818h */ diff --git a/h/drv/rtc/n8570.h b/h/drv/rtc/n8570.h new file mode 100644 index 0000000..203b9aa --- /dev/null +++ b/h/drv/rtc/n8570.h @@ -0,0 +1,167 @@ +/* n8570.h - National Semiconductor real time clock */ + +/* Copyright 1984-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,02mar93.eve upgraded for 5.1 +01a,19mar90,trl written +*/ + +#ifndef __INCn8570h +#define __INCn8570h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* registers */ + +#define DP8570_MSR(base) ((char *) (base) + 0) +#define DP8570_TIM0_CNTRL(base) ((char *) (base) + 1) +#define DP8570_REALTIME_MODE(base) ((char *) (base) + 1) +#define DP8570_TIM1_CNTRL(base) ((char *) (base) + 2) +#define DP8570_OUTPUT_MODE(base) ((char *) (base) + 2) +#define DP8570_PER_FLAG(base) ((char *) (base) + 3) +#define DP8570_INT_CNTRL0(base) ((char *) (base) + 3) +#define DP8570_INT_ROUTING(base) ((char *) (base) + 4) +#define DP8570_INT_CNTRL1(base) ((char *) (base) + 4) +#define DP8570_100s_SEC(base) ((char *) (base) + 5) +#define DP8570_SEC_CNT(base) ((char *) (base) + 6) +#define DP8570_MIN_CNT(base) ((char *) (base) + 7) +#define DP8570_HOUR_CNT(base) ((char *) (base) + 8) +#define DP8570_DAY_OF_MONTH_CNT(base) ((char *) (base) + 9) +#define DP8570_MONTH_CNT(base) ((char *) (base) + 10) +#define DP8570_YEAR_CNT(base) ((char *) (base) + 11) +#define DP8570_UNITS_JULIAN_CNT(base) ((char *) (base) + 12) +#define DP8570_100s_JULIAN_CNT(base) ((char *) (base) + 13) +#define DP8570_DAY_OF_WEEK_CNT(base) ((char *) (base) + 14) +#define DP8570_TIM0_LSB(base) ((char *) (base) + 15) +#define DP8570_TIM0_MSB(base) ((char *) (base) + 16) +#define DP8570_TIM1_LSB(base) ((char *) (base) + 17) +#define DP8570_TIM1_MSB(base) ((char *) (base) + 18) +#define DP8570_SEC_CMP(base) ((char *) (base) + 19) +#define DP8570_MIN_CMP(base) ((char *) (base) + 20) +#define DP8570_HOUR_CMP(base) ((char *) (base) + 21) +#define DP8570_DAY_OF_MONTH_CMP(base) ((char *) (base) + 22) +#define DP8570_MONTH_CMP(base) ((char *) (base) + 23) +#define DP8570_DAY_OF_WEEK_CMP(base) ((char *) (base) + 24) +#define DP8570_SEC_TIME_SAVE(base) ((char *) (base) + 25) +#define DP8570_MIN_TIME_SAVE(base) ((char *) (base) + 26) +#define DP8570_HOUR_TIME_SAVE(base) ((char *) (base) + 27) +#define DP8570_DAY_OF_MONTH_TIME_SAVE(base) ((char *) (base) + 28) +#define DP8570_MONTH_TIME_SAVE(base) ((char *) (base) + 29) +#define DP8570_ONE_BYTE_RAM(base) ((char *) (base) + 30) +#define DP8570_TEST_REG(base) ((char *) (base) + 31) + +#endif /* _ASMLANGUAGE */ + +/* main status register */ + +#define DP8570_INT_PENDING 0x01 +#define DP8570_PWR_FAIL_INT 0x02 +#define DP8570_PERIODIC_INT 0x04 +#define DP8570_ALARM_INT 0x08 +#define DP8570_TIMER0_INT 0x10 +#define DP8570_TIMER1_INT 0x20 +#define DP8570_REG_SET_1_SEL 0x40 +#define DP8570_RAM_PAGE_SEL 0x80 + + +/* timer 0/1 control register */ + +#define DP8570_TIMER_START_STOP 0x01 +#define DP8570_MODE_SEL_M0 0x02 +#define DP8570_MODE_SEL_M1 0x04 +#define DP8570_INPUT_CLK_SEL_C0 0x08 +#define DP8570_INPUT_CLK_SEL_C1 0x10 +#define DP8570_INPUT_CLK_SEL_C2 0x20 +#define DP8570_TIMER_READ 0x40 +#define DP8570_COUNT_HOLD_GATE 0x80 + + +/* periodic flag register */ + +#define DP8570_MINUTES_FLAG 0x01 +#define DP8570_10s_SECONDS_FLAG 0x02 +#define DP8570_SECONDS_FLAG 0x04 +#define DP8570_10e_SECONDS_FLAG 0x08 +#define DP8570_100e_SECONDS_FLAG 0x10 +#define DP8570_MILLISECONDS_FLAG 0x20 +#define DP8570_OSCILLATOR_FAILED 0x40 +#define DP8570_TEST_MODE 0x80 + + +/* interrupt routing register */ + +#define DP8570_PWR_FAIL_ROUTE 0x01 +#define DP8570_PERIODIC_ROUTE 0x02 +#define DP8570_ALARM_ROUTE 0x04 +#define DP8570_TIMER0_ROUTE 0x08 +#define DP8570_TIMER1_ROUTE 0x10 +#define DP8570_PWR_FAIL_DELAY 0x20 +#define DP8570_LOW_BATTERY_FLAG 0x40 +#define DP8570_TIME_SAVE_ENABLE 0x80 + + +/* real time mode register */ + +#define DP8570_LEAP_YEAR_LSB 0x01 +#define DP8570_LEAP_YEAR_MSB 0x02 +#define DP8570_12_24_HOUR_MODE 0x04 +#define DP8570_CLK_START_STOP 0x08 +#define DP8570_INT_OP 0x10 +#define DP8570_TIMER_PF_OP 0x20 +#define DP8570_OSCILLATOR_FREQ1 0x40 +#define DP8570_OSCILLATOR_FREQ2 0x80 + + +/* output mode register */ + +#define DP8570_T1_ACTIVE_HIGH 0x01 +#define DP8570_T1_PUSH_PULL 0x02 +#define DP8570_INT_ACTIVE_HIGH 0x04 +#define DP8570_INT_PUSH_PULL 0x08 +#define DP8570_MFO_ACTIVE_HIGH 0x10 +#define DP8570_MFO_PUSH_PULL 0x20 +#define DP8570_MFO_TIMER0 0x40 +#define DP8570_MFO_OSCILLATOR 0x80 + + +/* interrupt control register 0 */ + +#define DP8570_MINUTES_ENABLE 0x01 +#define DP8570_10s_SECONDS_ENABLE 0x02 +#define DP8570_SECONDS_ENABLE 0x04 +#define DP8570_10e_SECONDS_ENABLE 0x08 +#define DP8570_100e_SECONDS_ENABLE 0x10 +#define DP8570_MILLISECONDS_ENABLE 0x20 +#define DP8570_TIMER0_ENABLE 0x40 +#define DP8570_TIMER1_ENABLE 0x80 + + +/* interrupt control register 1 */ + +#define DP8570_SECOND_CMP_ENABLE 0x01 +#define DP8570_MINUTE_CMP_ENABLE 0x02 +#define DP8570_HOURS_CMP_ENABLE 0x04 +#define DP8570_DOM_CMP_ENABLE 0x08 +#define DP8570_MONTH_CMP_ENABLE 0x10 +#define DP8570_DOY_CMP_ENABLE 0x20 +#define DP8570_ALARM_INT_ENABLE 0x40 +#define DP8570_PWR_FAIL_INT_ENABLE 0x80 + +/* miscellaneous */ + +#define DP8570_PAGE0_RAM_START 0x13 +#define DP8570_PAGE1_RAM_START 0x01 + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCn8570h */ diff --git a/h/drv/rtc/rtc64613.h b/h/drv/rtc/rtc64613.h new file mode 100644 index 0000000..fbad1e7 --- /dev/null +++ b/h/drv/rtc/rtc64613.h @@ -0,0 +1,79 @@ +/* rtc64613.h - Seiko-Epson rtc64613 RTC header file */ + +/* Copyright 1991-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01d,22sep92,rrr added support for c++ +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01a,23may91,hdn written. +*/ + +#ifndef __INCrtc64613h +#define __INCrtc64613h + +#ifdef __cplusplus +extern "C" { +#endif + +#define RTC64613_REG_OFFSET 3 + +#ifndef _ASMLANGUAGE +typedef struct + { + UCHAR pad0[RTC64613_REG_OFFSET]; + UCHAR hz64; + UCHAR pad1[RTC64613_REG_OFFSET]; + UCHAR second; + UCHAR pad2[RTC64613_REG_OFFSET]; + UCHAR minute; + UCHAR pad3[RTC64613_REG_OFFSET]; + UCHAR hour; + UCHAR pad4[RTC64613_REG_OFFSET]; + UCHAR dayWeek; + UCHAR pad5[RTC64613_REG_OFFSET]; + UCHAR date; + UCHAR pad6[RTC64613_REG_OFFSET]; + UCHAR month; + UCHAR pad7[RTC64613_REG_OFFSET]; + UCHAR year; + UCHAR pad8[RTC64613_REG_OFFSET]; + UCHAR alarmHz64; + UCHAR pad9[RTC64613_REG_OFFSET]; + UCHAR alarmSecond; + UCHAR pad10[RTC64613_REG_OFFSET]; + UCHAR alarmMinute; + UCHAR pad11[RTC64613_REG_OFFSET]; + UCHAR alarmHour; + UCHAR pad12[RTC64613_REG_OFFSET]; + UCHAR alarmDayWeek; + UCHAR pad13[RTC64613_REG_OFFSET]; + UCHAR alarmDate; + UCHAR pad14[RTC64613_REG_OFFSET]; + UCHAR controlA; + UCHAR pad15[RTC64613_REG_OFFSET]; + UCHAR controlB; + } RTC; +#endif /* _ASMLANGUAGE */ + +/* bit value for control A register */ +#define RTC_CARRY_FLAG 0x80 +#define RTC_CARRY_INT 0x10 +#define RTC_ALARM_INT 0x08 +#define RTC_ALARM_FLAG 0x01 + +/* bit value for control B register */ +#define RTC_TEST_MODE 0x08 +#define RTC_ADJUST 0x04 +#define RTC_RESET 0x02 +#define RTC_START_STOP 0x01 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrtc64613h */ diff --git a/h/drv/rtc/s62421.h b/h/drv/rtc/s62421.h new file mode 100644 index 0000000..4f5a7a4 --- /dev/null +++ b/h/drv/rtc/s62421.h @@ -0,0 +1,50 @@ +/* s62421.h - Seiko 62421 real time clock */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01e,22sep92,rrr added support for c++ +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -changed copyright notice +01b,05oct90,shl added copyright notice. + made #endif ANSI style. +01a,28nov88,jcf written. +*/ + +/* +This file contains constants for the Seiko 62421. +*/ + +#ifndef __INCs62421h +#define __INCs62421h + +#ifdef __cplusplus +extern "C" { +#endif + +/* RTC 62421 register definition */ + +#define RTC_1_SEC(base) ((char *) ((base) + 0x0)) /* 1 sec. digit */ +#define RTC_10_SEC(base) ((char *) ((base) + 0x1)) /* 10 sec. digit */ +#define RTC_1_MIN(base) ((char *) ((base) + 0x2)) /* 1 min. digit */ +#define RTC_10_MIN(base) ((char *) ((base) + 0x3)) /* 10 min. digit */ +#define RTC_1_HR(base) ((char *) ((base) + 0x4)) /* 1 hour digit */ +#define RTC_10_HR(base) ((char *) ((base) + 0x5)) /* pm/am+10 hr digit */ +#define RTC_1_DAY(base) ((char *) ((base) + 0x6)) /* 1 day digit */ +#define RTC_10_DAY(base) ((char *) ((base) + 0x7)) /* 10 day digit */ +#define RTC_1_MON(base) ((char *) ((base) + 0x8)) /* 1 month digit */ +#define RTC_10_MON(base) ((char *) ((base) + 0x9)) /* 10 month digit */ +#define RTC_1_YR(base) ((char *) ((base) + 0xa)) /* 1 year digit */ +#define RTC_10_YR(base) ((char *) ((base) + 0xb)) /* 10 year digit */ +#define RTC_WEEK(base) ((char *) ((base) + 0xc)) /* week */ +#define RTC_CTR_D(base) ((char *) ((base) + 0xd)) /* control d */ +#define RTC_CTR_E(base) ((char *) ((base) + 0xe)) /* control e */ +#define RTC_CTR_F(base) ((char *) ((base) + 0xf)) /* control f */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCs62421h */ diff --git a/h/drv/rtc/unsupported/hd146818.h b/h/drv/rtc/unsupported/hd146818.h new file mode 100644 index 0000000..8f36889 --- /dev/null +++ b/h/drv/rtc/unsupported/hd146818.h @@ -0,0 +1,86 @@ +/* hd146818.h - Hitachi 146818 RTC Real Time Clock header */ + +/* Copyright 1991-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01e,22sep92,rrr added support for c++ +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01b,07jun91,hdn defined HD146818_REG_OFFSET. +01a,26feb91,hdn written. +*/ + +#ifndef __INChd146818h +#define __INChd146818h + +#ifdef __cplusplus +extern "C" { +#endif + +#define HD146818_REG_OFFSET 3 + +#ifndef _ASMLANGUAGE +typedef struct + { + UCHAR pad0[HD146818_REG_OFFSET]; + UCHAR seconds; + UCHAR pad1[HD146818_REG_OFFSET]; + UCHAR secAlarm; + UCHAR pad2[HD146818_REG_OFFSET]; + UCHAR minutes; + UCHAR pad3[HD146818_REG_OFFSET]; + UCHAR minAlarm; + UCHAR pad4[HD146818_REG_OFFSET]; + UCHAR hours; + UCHAR pad5[HD146818_REG_OFFSET]; + UCHAR hrAlarm; + UCHAR pad6[HD146818_REG_OFFSET]; + UCHAR dayOfWeek; + UCHAR pad7[HD146818_REG_OFFSET]; + UCHAR date; + UCHAR pad8[HD146818_REG_OFFSET]; + UCHAR month; + UCHAR pad9[HD146818_REG_OFFSET]; + UCHAR year; + UCHAR pad10[HD146818_REG_OFFSET]; + UCHAR controlA; + UCHAR pad11[HD146818_REG_OFFSET]; + UCHAR controlB; + UCHAR pad12[HD146818_REG_OFFSET]; + UCHAR controlC; + UCHAR pad13[HD146818_REG_OFFSET]; + UCHAR controlD; + } RTC; +#endif /* _ASMLANGUAGE */ + +/* bit values for control register A */ +#define RTC_UIP 0x80 +#define RTC_1MHZ 0x10 +#define RTC_32KHZ 0x20 +#define RTC_DV_RESET 0x60 + +/* bit values for control register B */ +#define RTC_SET 0x80 +#define RTC_PIE 0x40 +#define RTC_AIE 0x20 +#define RTC_UIE 0x10 +#define RTC_SQWE 0x08 +#define RTC_DM 0x04 +#define RTC_24 0x02 +#define RTC_DSE 0x01 + +/* bit values for control register C */ +#define RTC_IRQF 0x80 +#define RTC_PF 0x40 +#define RTC_AF 0x20 +#define RTC_UF 0x10 + +#ifdef __cplusplus +} +#endif + +#endif /* __INChd146818h */ diff --git a/h/drv/rtc/unsupported/n8570.h b/h/drv/rtc/unsupported/n8570.h new file mode 100644 index 0000000..203b9aa --- /dev/null +++ b/h/drv/rtc/unsupported/n8570.h @@ -0,0 +1,167 @@ +/* n8570.h - National Semiconductor real time clock */ + +/* Copyright 1984-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,02mar93.eve upgraded for 5.1 +01a,19mar90,trl written +*/ + +#ifndef __INCn8570h +#define __INCn8570h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* registers */ + +#define DP8570_MSR(base) ((char *) (base) + 0) +#define DP8570_TIM0_CNTRL(base) ((char *) (base) + 1) +#define DP8570_REALTIME_MODE(base) ((char *) (base) + 1) +#define DP8570_TIM1_CNTRL(base) ((char *) (base) + 2) +#define DP8570_OUTPUT_MODE(base) ((char *) (base) + 2) +#define DP8570_PER_FLAG(base) ((char *) (base) + 3) +#define DP8570_INT_CNTRL0(base) ((char *) (base) + 3) +#define DP8570_INT_ROUTING(base) ((char *) (base) + 4) +#define DP8570_INT_CNTRL1(base) ((char *) (base) + 4) +#define DP8570_100s_SEC(base) ((char *) (base) + 5) +#define DP8570_SEC_CNT(base) ((char *) (base) + 6) +#define DP8570_MIN_CNT(base) ((char *) (base) + 7) +#define DP8570_HOUR_CNT(base) ((char *) (base) + 8) +#define DP8570_DAY_OF_MONTH_CNT(base) ((char *) (base) + 9) +#define DP8570_MONTH_CNT(base) ((char *) (base) + 10) +#define DP8570_YEAR_CNT(base) ((char *) (base) + 11) +#define DP8570_UNITS_JULIAN_CNT(base) ((char *) (base) + 12) +#define DP8570_100s_JULIAN_CNT(base) ((char *) (base) + 13) +#define DP8570_DAY_OF_WEEK_CNT(base) ((char *) (base) + 14) +#define DP8570_TIM0_LSB(base) ((char *) (base) + 15) +#define DP8570_TIM0_MSB(base) ((char *) (base) + 16) +#define DP8570_TIM1_LSB(base) ((char *) (base) + 17) +#define DP8570_TIM1_MSB(base) ((char *) (base) + 18) +#define DP8570_SEC_CMP(base) ((char *) (base) + 19) +#define DP8570_MIN_CMP(base) ((char *) (base) + 20) +#define DP8570_HOUR_CMP(base) ((char *) (base) + 21) +#define DP8570_DAY_OF_MONTH_CMP(base) ((char *) (base) + 22) +#define DP8570_MONTH_CMP(base) ((char *) (base) + 23) +#define DP8570_DAY_OF_WEEK_CMP(base) ((char *) (base) + 24) +#define DP8570_SEC_TIME_SAVE(base) ((char *) (base) + 25) +#define DP8570_MIN_TIME_SAVE(base) ((char *) (base) + 26) +#define DP8570_HOUR_TIME_SAVE(base) ((char *) (base) + 27) +#define DP8570_DAY_OF_MONTH_TIME_SAVE(base) ((char *) (base) + 28) +#define DP8570_MONTH_TIME_SAVE(base) ((char *) (base) + 29) +#define DP8570_ONE_BYTE_RAM(base) ((char *) (base) + 30) +#define DP8570_TEST_REG(base) ((char *) (base) + 31) + +#endif /* _ASMLANGUAGE */ + +/* main status register */ + +#define DP8570_INT_PENDING 0x01 +#define DP8570_PWR_FAIL_INT 0x02 +#define DP8570_PERIODIC_INT 0x04 +#define DP8570_ALARM_INT 0x08 +#define DP8570_TIMER0_INT 0x10 +#define DP8570_TIMER1_INT 0x20 +#define DP8570_REG_SET_1_SEL 0x40 +#define DP8570_RAM_PAGE_SEL 0x80 + + +/* timer 0/1 control register */ + +#define DP8570_TIMER_START_STOP 0x01 +#define DP8570_MODE_SEL_M0 0x02 +#define DP8570_MODE_SEL_M1 0x04 +#define DP8570_INPUT_CLK_SEL_C0 0x08 +#define DP8570_INPUT_CLK_SEL_C1 0x10 +#define DP8570_INPUT_CLK_SEL_C2 0x20 +#define DP8570_TIMER_READ 0x40 +#define DP8570_COUNT_HOLD_GATE 0x80 + + +/* periodic flag register */ + +#define DP8570_MINUTES_FLAG 0x01 +#define DP8570_10s_SECONDS_FLAG 0x02 +#define DP8570_SECONDS_FLAG 0x04 +#define DP8570_10e_SECONDS_FLAG 0x08 +#define DP8570_100e_SECONDS_FLAG 0x10 +#define DP8570_MILLISECONDS_FLAG 0x20 +#define DP8570_OSCILLATOR_FAILED 0x40 +#define DP8570_TEST_MODE 0x80 + + +/* interrupt routing register */ + +#define DP8570_PWR_FAIL_ROUTE 0x01 +#define DP8570_PERIODIC_ROUTE 0x02 +#define DP8570_ALARM_ROUTE 0x04 +#define DP8570_TIMER0_ROUTE 0x08 +#define DP8570_TIMER1_ROUTE 0x10 +#define DP8570_PWR_FAIL_DELAY 0x20 +#define DP8570_LOW_BATTERY_FLAG 0x40 +#define DP8570_TIME_SAVE_ENABLE 0x80 + + +/* real time mode register */ + +#define DP8570_LEAP_YEAR_LSB 0x01 +#define DP8570_LEAP_YEAR_MSB 0x02 +#define DP8570_12_24_HOUR_MODE 0x04 +#define DP8570_CLK_START_STOP 0x08 +#define DP8570_INT_OP 0x10 +#define DP8570_TIMER_PF_OP 0x20 +#define DP8570_OSCILLATOR_FREQ1 0x40 +#define DP8570_OSCILLATOR_FREQ2 0x80 + + +/* output mode register */ + +#define DP8570_T1_ACTIVE_HIGH 0x01 +#define DP8570_T1_PUSH_PULL 0x02 +#define DP8570_INT_ACTIVE_HIGH 0x04 +#define DP8570_INT_PUSH_PULL 0x08 +#define DP8570_MFO_ACTIVE_HIGH 0x10 +#define DP8570_MFO_PUSH_PULL 0x20 +#define DP8570_MFO_TIMER0 0x40 +#define DP8570_MFO_OSCILLATOR 0x80 + + +/* interrupt control register 0 */ + +#define DP8570_MINUTES_ENABLE 0x01 +#define DP8570_10s_SECONDS_ENABLE 0x02 +#define DP8570_SECONDS_ENABLE 0x04 +#define DP8570_10e_SECONDS_ENABLE 0x08 +#define DP8570_100e_SECONDS_ENABLE 0x10 +#define DP8570_MILLISECONDS_ENABLE 0x20 +#define DP8570_TIMER0_ENABLE 0x40 +#define DP8570_TIMER1_ENABLE 0x80 + + +/* interrupt control register 1 */ + +#define DP8570_SECOND_CMP_ENABLE 0x01 +#define DP8570_MINUTE_CMP_ENABLE 0x02 +#define DP8570_HOURS_CMP_ENABLE 0x04 +#define DP8570_DOM_CMP_ENABLE 0x08 +#define DP8570_MONTH_CMP_ENABLE 0x10 +#define DP8570_DOY_CMP_ENABLE 0x20 +#define DP8570_ALARM_INT_ENABLE 0x40 +#define DP8570_PWR_FAIL_INT_ENABLE 0x80 + +/* miscellaneous */ + +#define DP8570_PAGE0_RAM_START 0x13 +#define DP8570_PAGE1_RAM_START 0x01 + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCn8570h */ diff --git a/h/drv/rtc/unsupported/rtc64613.h b/h/drv/rtc/unsupported/rtc64613.h new file mode 100644 index 0000000..fbad1e7 --- /dev/null +++ b/h/drv/rtc/unsupported/rtc64613.h @@ -0,0 +1,79 @@ +/* rtc64613.h - Seiko-Epson rtc64613 RTC header file */ + +/* Copyright 1991-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01d,22sep92,rrr added support for c++ +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01a,23may91,hdn written. +*/ + +#ifndef __INCrtc64613h +#define __INCrtc64613h + +#ifdef __cplusplus +extern "C" { +#endif + +#define RTC64613_REG_OFFSET 3 + +#ifndef _ASMLANGUAGE +typedef struct + { + UCHAR pad0[RTC64613_REG_OFFSET]; + UCHAR hz64; + UCHAR pad1[RTC64613_REG_OFFSET]; + UCHAR second; + UCHAR pad2[RTC64613_REG_OFFSET]; + UCHAR minute; + UCHAR pad3[RTC64613_REG_OFFSET]; + UCHAR hour; + UCHAR pad4[RTC64613_REG_OFFSET]; + UCHAR dayWeek; + UCHAR pad5[RTC64613_REG_OFFSET]; + UCHAR date; + UCHAR pad6[RTC64613_REG_OFFSET]; + UCHAR month; + UCHAR pad7[RTC64613_REG_OFFSET]; + UCHAR year; + UCHAR pad8[RTC64613_REG_OFFSET]; + UCHAR alarmHz64; + UCHAR pad9[RTC64613_REG_OFFSET]; + UCHAR alarmSecond; + UCHAR pad10[RTC64613_REG_OFFSET]; + UCHAR alarmMinute; + UCHAR pad11[RTC64613_REG_OFFSET]; + UCHAR alarmHour; + UCHAR pad12[RTC64613_REG_OFFSET]; + UCHAR alarmDayWeek; + UCHAR pad13[RTC64613_REG_OFFSET]; + UCHAR alarmDate; + UCHAR pad14[RTC64613_REG_OFFSET]; + UCHAR controlA; + UCHAR pad15[RTC64613_REG_OFFSET]; + UCHAR controlB; + } RTC; +#endif /* _ASMLANGUAGE */ + +/* bit value for control A register */ +#define RTC_CARRY_FLAG 0x80 +#define RTC_CARRY_INT 0x10 +#define RTC_ALARM_INT 0x08 +#define RTC_ALARM_FLAG 0x01 + +/* bit value for control B register */ +#define RTC_TEST_MODE 0x08 +#define RTC_ADJUST 0x04 +#define RTC_RESET 0x02 +#define RTC_START_STOP 0x01 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrtc64613h */ diff --git a/h/drv/rtc/unsupported/s62421.h b/h/drv/rtc/unsupported/s62421.h new file mode 100644 index 0000000..4f5a7a4 --- /dev/null +++ b/h/drv/rtc/unsupported/s62421.h @@ -0,0 +1,50 @@ +/* s62421.h - Seiko 62421 real time clock */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01e,22sep92,rrr added support for c++ +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -changed copyright notice +01b,05oct90,shl added copyright notice. + made #endif ANSI style. +01a,28nov88,jcf written. +*/ + +/* +This file contains constants for the Seiko 62421. +*/ + +#ifndef __INCs62421h +#define __INCs62421h + +#ifdef __cplusplus +extern "C" { +#endif + +/* RTC 62421 register definition */ + +#define RTC_1_SEC(base) ((char *) ((base) + 0x0)) /* 1 sec. digit */ +#define RTC_10_SEC(base) ((char *) ((base) + 0x1)) /* 10 sec. digit */ +#define RTC_1_MIN(base) ((char *) ((base) + 0x2)) /* 1 min. digit */ +#define RTC_10_MIN(base) ((char *) ((base) + 0x3)) /* 10 min. digit */ +#define RTC_1_HR(base) ((char *) ((base) + 0x4)) /* 1 hour digit */ +#define RTC_10_HR(base) ((char *) ((base) + 0x5)) /* pm/am+10 hr digit */ +#define RTC_1_DAY(base) ((char *) ((base) + 0x6)) /* 1 day digit */ +#define RTC_10_DAY(base) ((char *) ((base) + 0x7)) /* 10 day digit */ +#define RTC_1_MON(base) ((char *) ((base) + 0x8)) /* 1 month digit */ +#define RTC_10_MON(base) ((char *) ((base) + 0x9)) /* 10 month digit */ +#define RTC_1_YR(base) ((char *) ((base) + 0xa)) /* 1 year digit */ +#define RTC_10_YR(base) ((char *) ((base) + 0xb)) /* 10 year digit */ +#define RTC_WEEK(base) ((char *) ((base) + 0xc)) /* week */ +#define RTC_CTR_D(base) ((char *) ((base) + 0xd)) /* control d */ +#define RTC_CTR_E(base) ((char *) ((base) + 0xe)) /* control e */ +#define RTC_CTR_F(base) ((char *) ((base) + 0xf)) /* control f */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCs62421h */ diff --git a/h/drv/scsi/aic7880.h b/h/drv/scsi/aic7880.h new file mode 100644 index 0000000..01d3a71 --- /dev/null +++ b/h/drv/scsi/aic7880.h @@ -0,0 +1,137 @@ +/* aic7880.h - AIC 7880 SCSI Host Adapter header file */ + +/* Copyright 1984-1998 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,29sep98,fle made it refgen parsable +01d,17mar98,sbs added AIC7880 PCI specific definitions. + added import of aic7880Intr(). +01c,05aug97,dds removed #include "him/custom.h". +01c,05aug97,dds removed #include "him/custom.h". +01b,11jul97,dds added #include "him/custom.h". +01a,19jun97,dds created. +*/ + +/* +DESCRIPTION + +This is the header file for the AIC-7880 driver +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "semLib.h" +#include "scsiLib.h" + +extern int himDebug; + +#undef HIM_DEBUG + +#define HIM_MSG logMsg + +#define HIM_DEBUG_MSG \ + if (himDebug) \ + HIM_MSG + +/* Adaptec AIC 7880 PCI SCSI Host Adapter definitions */ + +#define AIC7880_PCI_VENDOR_ID 0x9004 +#define AIC7880_PCI_DEVICE_ID 0x8178 + +/* AIC 7880 SCSI Host Adapter Segment Pointer structure */ + +typedef struct segmentPtr + { + int dataPtr; + int dataLen; + } SEG_PTR; + +/* AIC 7880 SCSI Host Adapter Thread Structure */ + +typedef struct aic7880Thread + { + SCSI_THREAD scsiThread; /* generic SCSI thread structure */ + struct sp * pScb; /* ptr to SCSI Command block */ + SEG_PTR * segPtr; /* Scatter/Gather Segment Pointer */ + } AIC_7880_THREAD; + +/* AIC 7880 SCSI Controller Structure */ + +typedef struct + { + SCSI_CTRL scsiCtrl; /* generic SCSI controller info */ + struct cfp * aic7880CfpStruct; /* pointer to a 7880 SCSI Ctrlr */ + AIC_7880_THREAD * pHwThread; /* ptr to current thread */ + } AIC_7880_SCSI_CTRL; + +/* Interrupt codes */ + +#define INTMASK 0xe0 + +#define HA_NOT_FOUND 0x00 +#define HA_FOUND 0x01 +#define HA_FOUND_DISABLED 0x81 + +/* Sync offset and period (SXFER register) */ + +#define AIC_7880_MIN_REQ_ACK_OFFSET 1 /* Minimum sync offset */ +#define AIC_7880_MAX_REQ_ACK_OFFSET 8 /* Maximum sync offset */ + +#define AIC_7880_DBLSPD_50 12 +#define AIC_7880_DBLSPD_64 16 +#define AIC_7880_DBLSPD_75 19 + +#define AIC_7880_PERIOD_100 25 +#define AIC_7880_PERIOD_125 31 +#define AIC_7880_PERIOD_150 37 +#define AIC_7880_PERIOD_175 43 +#define AIC_7880_PERIOD_200 49 +#define AIC_7880_PERIOD_225 55 +#define AIC_7880_PERIOD_250 61 +#define AIC_7880_PERIOD_275 67 + +#define AIC_7880_MAX_XFER_WIDTH 2 + +#define SIMPLE_QUEUE_TAG 0x00 +#define HEAD_OF_QUEUE_TAG 0x01 +#define ORDERED_QUEUE_TAG 0x02 + +/* SCB command status */ + +#define AIC_7880_REQUEST_IN_PROGRESS 0x00 /* SCSI request in progress */ +#define AIC_7880_CMD_COMPLETE 0x01 /* SCSI command completed */ +#define AIC_7880_REQUEST_ABORTED 0x02 /* SCSI request aborted */ +#define AIC_7880_CMD_COMP_WITH_ERROR 0x04 /* error executing SCSI request */ +#define AIC_7880_INVALID_REQUEST 0x08 /* invalid SCSI request */ + +/* host adapter status */ + +#define AIC_7880_NO_STATUS 0x00 /* host adapter stat unavailable */ +#define AIC_7880_CMD_ABORT 0x04 /* cmd aborted by host */ +#define AIC_7880_CMD_ABORT_BY_HA 0x05 /* cmd aborted by host adapter */ +#define AIC_7880_UNEXPECTED_BUS_FREE 0x13 /* unexpected bus free */ +#define AIC_7880_PHASE_MISMATCH 0x14 /* phase mismatch detected */ +#define AIC_7880_HA_HW_ERROR 0x20 /* host adapter H/W error */ +#define AIC_7880_BUS_RESET 0x22 /* SCSI bus reset */ +#define AIC_7880_BUS_RESET_OTHER_DEV 0x23 /* SCSI bus reset from other dev */ +#define AIC_7880_SELECT_TIMEOUT 0x11 /* SCSI selection timeout */ +#define AIC_7880_REQ_SENSE_FAILED 0x1b /* SCSI Request Sense Failed */ +#define AIC_7880_SCSI_BUS_RESET 0x44 /* SCSI bus reset */ + +/* imports */ + +IMPORT VOID aic7880Intr (); + +/* + * AIC7880LIB.C + */ + +AIC_7880_SCSI_CTRL * aic7880CtrlCreate (int busNo, int devNo, int scsiBusId); + +#ifdef __cplusplus +} +#endif diff --git a/h/drv/scsi/mb87030.h b/h/drv/scsi/mb87030.h new file mode 100644 index 0000000..5670841 --- /dev/null +++ b/h/drv/scsi/mb87030.h @@ -0,0 +1,24 @@ +/* mb87030.h - Fujitsu MB87030 SPC (SCSI Protocol Controller) header */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01b,26apr02,dat Adding cplusplus protection, SPR 75017 +01a,07nov94,jds written for backward compatability. +*/ + +#ifndef __INCmb87030h +#define __INCmb87030h + +#ifndef INCLUDE_SCSI2 + +#include "mb87030_1.h" + +#else + +#error "mb87030 driver does not support SCSI2" + +#endif /* INCLUDE_SCSI2 */ + +#endif /* __INCmb87030h */ diff --git a/h/drv/scsi/mb87030_1.h b/h/drv/scsi/mb87030_1.h new file mode 100644 index 0000000..0aed5f8 --- /dev/null +++ b/h/drv/scsi/mb87030_1.h @@ -0,0 +1,245 @@ +/* mb87030_1.h - Fujitsu MB87030 SPC (SCSI Protocol Controller) header */ + +/* Copyright 1984-1994 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01n,08nov94,jds renamed for SCSI1 compatability +01m,24sep92,ccc changed spcShow() to return STATUS. +01l,22sep92,rrr added support for c++ +01k,26may92,rrr the tree shuffle +01j,26may92,ajm got rid of HOST_DEC def's (new compiler) + updated copyright +01i,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01h,28sep91,ajm ifdef'd HOST_DEC for compiler problem +01g,19oct90,jcc changed SPC to MB_87030_SCSI_CTRL in ANSI function prototypes. +01f,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01e,20aug90,jcc changed UTINY and USHORT to UINT8 and UINT16, respectively. +01d,18jul90,jcc moved _ASMLANGUAGE conditionals to encompass entire file. +01c,12jul90,jcc renamed MPU_DATA_PARITY_XX to SPC_DATA_PARITY_XX; added + checks for _ASMLANGUAGE around non-assembly legal code. +01b,18jan90,jcc created MB_87030_SCSI_CTRL struct with hook into scsiLib; + replaced old register address macros with pointers. +01a,08apr89,jcc written. +*/ + +#ifndef __INCmb87030_1h +#define __INCmb87030_1h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "scsiLib.h" + +typedef struct /* MB_87030_SCSI_CTRL - Fujitsu mb87030 + SCSI controller info */ + { + SCSI_CTRL scsiCtrl; /* generic SCSI controller info */ + SCSI_PHYS_DEV *pDevToSelect;/* device to select at intr. level or NULL */ + UINT16 defaultSelTimeOut; /* default dev. select time-out (units var.) */ + int spcDataParity; /* sense of the input data parity signal */ + UINT8 selectTempReg; /* value for the TEMP reg. during select */ + int busFreeDelay; /* tWAIT for TCL reg. during select (00-0f) */ + volatile UINT8 *pBdidReg; /* ptr bus device ID reg.*/ + volatile UINT8 *pSctlReg; /* ptr control reg. */ + volatile UINT8 *pScmdReg; /* ptr command reg. */ + volatile UINT8 *pTmodReg; /* ptr transfer mode reg. */ + volatile UINT8 *pIntsReg; /* ptr int. sense (R) / reset int. (W) reg. */ + volatile UINT8 *pPsnsReg; /* ptr phase sense (R) reg. */ + volatile UINT8 *pSdgcReg; /* ptr diagnostic control (W) reg. */ + volatile UINT8 *pSstsReg; /* ptr status (R) reg. */ + volatile UINT8 *pSerrReg; /* ptr error status (R) reg. */ + volatile UINT8 *pPctlReg; /* ptr phase control reg. */ + volatile UINT8 *pMbcReg; /* ptr modified byte counter (R) reg. */ + volatile UINT8 *pDregReg; /* ptr data reg. */ + volatile UINT8 *pTempReg; /* ptr temporary reg. */ + volatile UINT8 *pTchReg; /* ptr transfer counter high byte reg. */ + volatile UINT8 *pTcmReg; /* ptr transfer counter middle byte reg. */ + volatile UINT8 *pTclReg; /* ptr transfer counter low byte reg. */ + volatile UINT8 *pExbfReg; /* ptr external buffer reg. */ + } MB_87030_SCSI_CTRL; + +/* SPC Parity Possibilities */ + +#define SPC_DATA_PARITY_LOW 0 +#define SPC_DATA_PARITY_HIGH 1 +#define SPC_DATA_PARITY_VALID 2 + +/* SPC Control Register Fields */ + +#define SPC_SCTL_RESET_AND_DSBL ((UINT8) 0x80) /* reset and disable */ +#define SPC_SCTL_CTRL_RESET ((UINT8) 0x40) /* control reset */ +#define SPC_SCTL_DIAG_MODE ((UINT8) 0x20) /* diagnostic mode */ +#define SPC_SCTL_ARBIT_ENBL ((UINT8) 0x10) /* arbitration enable */ +#define SPC_SCTL_PARITY_ENBL ((UINT8) 0x08) /* parity enable */ +#define SPC_SCTL_SELECT_ENBL ((UINT8) 0x04) /* select enable */ +#define SPC_SCTL_RESELECT_ENBL ((UINT8) 0x02) /* reselect enable */ +#define SPC_SCTL_INT_ENBL ((UINT8) 0x01) /* interrupt enable */ + +/* SPC Command Register Command Codes */ + +#define SPC_SCMD_CMD_MASK ((UINT8) 0xe0) /* cmd field bit mask */ +#define SPC_SCMD_BUS_RELEASE ((UINT8) 0x00) /* bus release command code */ +#define SPC_SCMD_SELECT ((UINT8) 0x20) /* select command code */ +#define SPC_SCMD_RESET_ATN ((UINT8) 0x40) /* reset ATN command code */ +#define SPC_SCMD_SET_ATN ((UINT8) 0x60) /* set ATN command code */ +#define SPC_SCMD_XFER ((UINT8) 0x80) /* transfer command code */ +#define SPC_SCMD_XFER_PAUSE ((UINT8) 0xa0) /* transfer pause command code */ +#define SPC_SCMD_RESET_ACK_REQ ((UINT8) 0xc0) /* reset ACK/REQ command code */ +#define SPC_SCMD_SET_ACK_REQ ((UINT8) 0xe0) /* set ACK/REQ command code */ + +/* SPC Command Register Fields */ + +#define SPC_SCMD_RESET_OUT ((UINT8) 0x10) /* assert reset line */ +#define SPC_SCMD_INTERCEPT_XFER ((UINT8) 0x08) /* set special transfer mode */ +#define SPC_SCMD_PRG_XFER ((UINT8) 0x04) /* program transfer mode */ +#define SPC_SCMD_TERM_MODE ((UINT8) 0x01) /* termination mode */ + +/* SPC Transfer Mode Register Fields */ + +#define SPC_TMOD_SYNC_XFER ((UINT8) 0x80) /* synchronous transfer */ +#define SPC_TMOD_MAX_OFFSET_MASK ((UINT8) 0x70) /* max. xfer offset bit mask */ +#define SPC_TMOD_MIN_PERIOD_MASK ((UINT8) 0x0c) /* min. xfer period bit mask */ + +/* SPC Interrupt Sense & Reset Register Fields */ + +#define SPC_INTS_SELECTED ((UINT8) 0x80) /* selected interrupt */ +#define SPC_INTS_RESELECTED ((UINT8) 0x40) /* reselected interrupt */ +#define SPC_INTS_DISCONNECT ((UINT8) 0x20) /* disconnect interrupt */ +#define SPC_INTS_COM_COMPLETE ((UINT8) 0x10) /* command complete interrupt */ +#define SPC_INTS_SERVICE_REQ ((UINT8) 0x08) /* service required interrupt */ +#define SPC_INTS_TIMEOUT ((UINT8) 0x04) /* timeout interrupt */ +#define SPC_INTS_HARD_ERROR ((UINT8) 0x02) /* hard error interrupt */ +#define SPC_INTS_RESET_COND ((UINT8) 0x01) /* reset condition interrupt */ + +/* SPC Phase Sense Register Fields */ + +#define SPC_PSNS_REQ ((UINT8) 0x80) /* phase sense REQ line */ +#define SPC_PSNS_ACK ((UINT8) 0x40) /* phase sense ACK line */ +#define SPC_PSNS_ATN ((UINT8) 0x20) /* phase sense ATN line */ +#define SPC_PSNS_SEL ((UINT8) 0x10) /* phase sense SEL line */ +#define SPC_PSNS_BSY ((UINT8) 0x08) /* phase sense BSY line */ +#define SPC_PSNS_MSG ((UINT8) 0x04) /* phase sense MSG line */ +#define SPC_PSNS_C_D ((UINT8) 0x02) /* phase sense C/D line */ +#define SPC_PSNS_I_O ((UINT8) 0x01) /* phase sense I/O line */ +#define SPC_PSNS_PHASE_MASK ((UINT8) 0x07) /* SCSI bus phase mask */ + +/* SPC Diag Control Register Fields */ + +#define SPC_SDGC_DIAG_REQ ((UINT8) 0x80) /* diagnostic mode REQ */ +#define SPC_SDGC_DIAG_ACK ((UINT8) 0x40) /* diagnostic mode ACK */ +#define SPC_SDGC_DIAG_BSY ((UINT8) 0x08) /* diagnostic mode BSY */ +#define SPC_SDGC_DIAG_MSG ((UINT8) 0x04) /* diagnostic mode MSG */ +#define SPC_SDGC_DIAG_C_D ((UINT8) 0x02) /* diagnostic mode C/D */ +#define SPC_SDGC_DIAG_I_O ((UINT8) 0x01) /* diagnostic mode I/O */ + +/* SPC Status Register Fields */ + +#define SPC_SSTS_CONNECTED ((UINT8) 0xc0) /* connected to SCSI */ +#define SPC_SSTS_INITIATOR ((UINT8) 0x80) /* connected as initiator */ +#define SPC_SSTS_TARGET ((UINT8) 0x40) /* connected as target */ +#define SPC_SSTS_BUSY ((UINT8) 0x20) /* SPC busy */ +#define SPC_SSTS_XFER ((UINT8) 0x10) /* transfer in progress */ +#define SPC_SSTS_SCSI_RESET ((UINT8) 0x08) /* SCSI reset status */ +#define SPC_SSTS_TC_0 ((UINT8) 0x04) /* transfer count = 0 */ +#define SPC_SSTS_DREG_FULL ((UINT8) 0x02) /* data register full */ +#define SPC_SSTS_DREG_EMPTY ((UINT8) 0x01) /* data register empty */ + +/* SPC Status Register Status Codes */ + +#define SPC_SSTS_OPER_STAT_MASK ((UINT8) 0xf0) /* bit mask for oper. status */ +#define SPC_SSTS_NO_CONNECT_IDLE ((UINT8) 0x00) /* idle, unconnected to SCSI */ +#define SPC_SSTS_SELECT_WAIT ((UINT8) 0x20) /* waiting for bus free */ +#define SPC_SSTS_TARGET_MANUAL ((UINT8) 0x40) /* target in manual mode */ +#define SPC_SSTS_RESELECT_EXEC ((UINT8) 0x60) /* exec'ing reselect on SCSI */ +#define SPC_SSTS_TARGET_XFER ((UINT8) 0x70) /* target executing transfer */ +#define SPC_SSTS_INITIATOR_MANUAL ((UINT8) 0x80) /* init'r in manual mode */ +#define SPC_SSTS_INITIATOR_WAIT ((UINT8) 0x90) /* init'r waiting on xfer com*/ +#define SPC_SSTS_SELECT_EXEC ((UINT8) 0xa0) /* executing select on SCSI */ +#define SPC_SSTS_INITIATOR_XFER ((UINT8) 0xb0) /* init'r executing transfer */ + +#define SPC_SSTS_DREG_STAT_MASK ((UINT8) 0x03) /* bit mask for dreg. status */ +#define SPC_SSTS_DREG_PARTIAL ((UINT8) 0x00) /* data reg. not empty or full */ +#define SPC_SSTS_DREG_UNDEF ((UINT8) 0x03) /* data reg. state undefined */ + +/* SPC Error Status Register Fields */ + +#define SPC_SERR_TC_PARITY ((UINT8) 0x08) /* transfer counter parity error */ +#define SPC_SERR_PHASE_ERROR ((UINT8) 0x04) /* SCSI phase error */ +#define SPC_SERR_SHORT_PERIOD ((UINT8) 0x02) /* short transfer period error */ +#define SPC_SERR_OFFSET_ERROR ((UINT8) 0x01) /* transfer offset error */ + +/* SPC Error Status Register Status Codes */ + +#define SPC_SERR_PAR_ERROR_MASK ((UINT8) 0xc0)/* bit mask yielding par. error */ +#define SPC_SERR_NO_PAR_ERROR ((UINT8) 0x00)/* no parity error detected */ +#define SPC_SERR_PAR_ERROR_OUT ((UINT8) 0x40)/* parity error on output */ +#define SPC_SERR_PAR_ERROR_IN ((UINT8) 0xc0)/* parity error on input */ + +/* SPC Phase Control Register Fields */ + +#define SPC_PCTL_BF_INT_ENBL ((UINT8) 0x80) /* bus free interrupt enable */ + +/* SPC Phase Control Register Options */ + +#define SPC_PCTL_PHASE_MASK ((UINT8) 0x07) /* bit mask yielding xfer phase */ +#define SPC_PCTL_DATA_OUT ((UINT8) 0x00) /* data out phase */ +#define SPC_PCTL_SELECT ((UINT8) 0x00) /* select phase */ +#define SPC_PCTL_DATA_IN ((UINT8) 0x01) /* data in phase */ +#define SPC_PCTL_RESELECT ((UINT8) 0x01) /* reselect phase */ +#define SPC_PCTL_COMMAND ((UINT8) 0x02) /* command phase */ +#define SPC_PCTL_STATUS ((UINT8) 0x03) /* status phase */ +#define SPC_PCTL_UNUSED_0 ((UINT8) 0x04) /* unused */ +#define SPC_PCTL_UNUSED_1 ((UINT8) 0x05) /* unused */ +#define SPC_PCTL_MESS_OUT ((UINT8) 0x06) /* message out phase */ +#define SPC_PCTL_MESS_IN ((UINT8) 0x07) /* message in phase */ + +/* SPC Bit Manipulation Mneumonics */ + +#define SPC_PRESERVE_BIT (-1) /* preserve the bit's current state */ +#define SPC_PRESERVE_FIELD (0xff) /* preserve the bit field's state */ +#define SPC_RESET_BIT (0) /* reset the bit */ +#define SPC_SET_BIT (1) /* set the bit */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT MB_87030_SCSI_CTRL * mb87030CtrlCreate (UINT8 *spcBaseAdrs, + int regOffset, + UINT clkPeriod, + int spcDataParity, + FUNCPTR spcDmaBytesIn, + FUNCPTR spcDmaBytesOut); +IMPORT STATUS mb87030CtrlInit (MB_87030_SCSI_CTRL *pSpc, + int scsiCtrlBusId, + UINT defaultSelTimeOut, + int scsiPriority); +IMPORT STATUS spcShow (SCSI_CTRL *pSpc); +IMPORT void spcIntr (MB_87030_SCSI_CTRL *pSpc); + +#else + +IMPORT MB_87030_SCSI_CTRL * mb87030CtrlCreate (); +IMPORT STATUS mb87030CtrlInit (); +IMPORT STATUS spcShow (); +IMPORT void spcIntr (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmb87030_1h */ diff --git a/h/drv/scsi/ncr5390.h b/h/drv/scsi/ncr5390.h new file mode 100644 index 0000000..b8f3c7e --- /dev/null +++ b/h/drv/scsi/ncr5390.h @@ -0,0 +1,25 @@ +/* ncr5390.h - NCR 53C90 Advanced SCSI Controller header file */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,26apr02,dat Adding cplusplus protection, SPR 75017 +01a,07nov94,jds written for SCSI1 compatabilty +*/ + +#ifndef __INCncr5390h +#define __INCncr5390h + +#ifndef INCLUDE_SCSI2 + +#include "ncr5390_1.h" + +#else + +#include "ncr5390_2.h" + +#endif /* INCLUDE_SCSI2 */ + +#endif /* __INCncr5390h */ diff --git a/h/drv/scsi/ncr5390_1.h b/h/drv/scsi/ncr5390_1.h new file mode 100644 index 0000000..45b0770 --- /dev/null +++ b/h/drv/scsi/ncr5390_1.h @@ -0,0 +1,257 @@ +/* ncr5390_1.h - NCR 53C90 Advanced SCSI Controller header file */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,07may96,dds fixed for SCSI1 & SCSI2 compatiblity. +01h,08nov94,jds renamed for SCSI1 compatability +01g,22sep92,rrr added support for c++ +01f,27aug92,ccc added function prototypes. +01e,26may92,rrr the tree shuffle +01d,26may92,ajm got rid of HOST_DEC def's (new compiler) +01c,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01b,28sep91,ajm ifdef'd HOST_DEC for compiler problem +01a,16may90,trl written +*/ + +#ifndef __INCncr5390_1h +#define __INCncr5390_1h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "scsiLib.h" + +/* SCSI controller structure */ + +typedef struct /* NCR_5390_SCSI_CTRL - NCR 5390 + SCSI controller info */ + { + SCSI_CTRL scsiCtrl; /* generic SCSI controller info */ + SCSI_PHYS_DEV *pDevToSelect;/* device to select at intr. level or NULL */ + int devType; /* type of device (see define's below) */ + TBOOL slowCableMode; /* TRUE to select slow cable mode */ + TBOOL resetReportDsbl; /* TRUE to disable SCSI bus reset reporting */ + TBOOL parityTestMode; /* TRUE to enable par test mode (DO NOT USE!) */ + TBOOL parityCheckEnbl; /* TRUE to enable parity checking */ + UINT8 defaultSelTimeOut; /* default dev. select time-out (units var.) */ + UINT8 clkCvtFactor; /* value of the clock conversion factor */ + UINT8 savedStatReg; /* status register from last interrupt */ + UINT8 savedIntrReg; /* interrupt register from last interrupt */ + UINT8 savedStepReg; /* sequence step register from last interrupt */ + volatile UINT8 *pTclReg; /* ptr xfer count LSB reg */ + volatile UINT8 *pTchReg; /* ptr xfer count MSB reg */ + volatile UINT8 *pFifoReg; /* ptr FIFO reg */ + volatile UINT8 *pCmdReg; /* ptr command reg */ + volatile UINT8 *pStatReg; /* ptr status reg */ + volatile UINT8 *pIntrReg; /* ptr interrupt reg */ + volatile UINT8 *pStepReg; /* ptr sequence step reg */ + volatile UINT8 *pFlgsReg; /* ptr FIFO flags reg */ + volatile UINT8 *pCfg1Reg; /* ptr configuration 1 reg */ + volatile UINT8 *pClkReg; /* ptr clock conversion factor reg */ + volatile UINT8 *pTestReg; /* ptr test mode reg */ + volatile UINT8 *pCfg2Reg; /* ptr configuration 2 reg */ + } NCR_5390_SCSI_CTRL; + +typedef struct ncr5390functbl + { + FUNCPTR ascCommand; + FUNCPTR ascIntr; + FUNCPTR ascRegRead; + FUNCPTR ascRegWrite; + FUNCPTR ascXferCountGet; + FUNCPTR ascXferCountSet; + FUNCPTR ncr5390CtrlInit; + FUNCPTR ncr5390Show; + } SCSIDRV_FUNC_TBL; + +#if FALSE + +struct scsi + { + int tcl; /* transfer count register, low byte */ + int tch; /* transfer count register, high byte */ + int fifo; /* fifo register */ + int cmd; /* command register */ + int sts_bid; /* status and bus-id register */ + int intsts_tmo; /* interrupt status and timeout register */ + int step_period; /* step and period register */ + int fifoflag_offset; /* fifo flag and offset register */ + int conf1; /* configuration register 1 */ + int clock; /* clock conversion factor register */ + int test; /* test register */ + int conf2; /* configuration register 2 */ + }; + +/* defines for the overlapping registers */ + +#define int_sts intsts_tmo /* interrupt status */ +#define tmo intsts_tmo /* select/reselect timeout */ +#define step step_period /* sequence step */ +#define period step_period /* sync period */ +#define fifo_flags fifoflag_offset /* fifo flags */ +#define offset fifoflag_offset /* sync offset */ + +#endif /* FALSE */ + +/* defines for the overlapping registers */ + +#define pBidReg pStatReg /* select/reselect bus id */ +#define pTmoReg pIntrReg /* select/reselect bus id */ + +/* ASC device types */ + +#define ASC_NCR5390 0 +#define ASC_NCR5390A 1 +#define ASC_NCR5390B 2 +#define ASC_NCR5394 3 +#define ASC_NCR5395 4 +#define ASC_NCR5396 5 + +/* FIFO register */ + +#define NCR5390_FIFO_DEPTH 16 + +/* command register */ + +#define NCR5390_NOP 0x00 +#define NCR5390_FIFO_FLUSH 0x01 +#define NCR5390_CHIP_RESET 0x02 +#define NCR5390_BUS_RESET 0x03 + +#define NCR5390_INFO_TRANSFER 0x10 +#define NCR5390_I_CMD_COMPLETE 0x11 +#define NCR5390_MSG_ACCEPTED 0x12 +#define NCR5390_SET_ATTENTION 0x13 + +#define NCR5390_SEND_MESSAGE 0x20 +#define NCR5390_SEND_STATUS 0x21 +#define NCR5390_SEND_DATA 0x22 +#define NCR5390_DISCONNECT_SEQ 0x23 +#define NCR5390_TERMINATE_SEQ 0x24 +#define NCR5390_T_CMD_COMPLETE 0x25 +#define NCR5390_DISCONNECT 0x27 +#define NCR5390_RCV_MESSAGE 0x28 +#define NCR5390_RCV_COMMAND 0x29 +#define NCR5390_RCV_DATA 0x2a +#define NCR5390_RCV_CMD_SEQ 0x2b + +#define NCR5390_RESELECT 0x40 +#define NCR5390_SELECT 0x41 +#define NCR5390_ATN_SELECT 0x42 +#define NCR5390_STOP_SELECT 0x43 +#define NCR5390_SELECTION_ENBL 0x44 +#define NCR5390_SELECTION_DSBL 0x45 + +#define NCR5390_DMA_OP 0x80 + +/* status register */ + +#define NCR5390_DOUT_PHASE 0x00 +#define NCR5390_DIN_PHASE 0x01 +#define NCR5390_CMND_PHASE 0x02 +#define NCR5390_STAT_PHASE 0x03 +#define NCR5390_MSGOUT_PHASE 0x06 +#define NCR5390_MSGIN_PHASE 0x07 +#define NCR5390_PHASE_MASK 0x07 +#define NCR5390_VAL_GROUP 0x08 +#define NCR5390_TERMINAL_CNT 0x10 +#define NCR5390_PARITY_ERR 0x20 +#define NCR5390_GROSS_ERR 0x40 +#define NCR5390_INTERRUPT 0x80 + +/* interrupt status register */ + +#define NCR5390_SELECTED 0x01 +#define NCR5390_ATN_SELECTED 0x02 +#define NCR5390_RESELECTED 0x04 +#define NCR5390_FUNC_COMPLETE 0x08 +#define NCR5390_BUS_SERVICE 0x10 +#define NCR5390_DISCONNECTED 0x20 +#define NCR5390_ILLEGAL_CMD 0x40 +#define NCR5390_SCSI_RESET 0x80 + +/* fifo flags register */ + +#define NCR5390_MORE_DATA 0x1f + +/* configuration register 1 */ + +#define NCR5390_OWN_ID_MASK 0x07 +#define NCR5390_CHIPTEST_ENBL 0x08 +#define NCR5390_PAR_CHECK_ENBL 0x10 +#define NCR5390_PAR_TEST_ENBL 0x20 +#define NCR5390_RESET_REP_DSBL 0x40 +#define NCR5390_SLOW_CABLE 0x80 + +/* test register */ + +#define NCR5390_TARGET 0x01 +#define NCR5390_INITIATOR 0x02 +#define NCR5390_HIGH_IMP 0x04 + +/* configuration register 2 */ + +#define NCR5390_DMA_PAR_ENBL 0x01 +#define NCR5390_REG_PAR_ENBL 0x02 +#define NCR5390_PARITY_ABORT 0x04 +#define NCR5390_SCSI_2 0x08 +#define NCR5390_DREQ_HIGH_IMP 0x10 + +typedef NCR_5390_SCSI_CTRL ASC; + +/* external declarations */ + +extern SCSIDRV_FUNC_TBL *pNcr5390IfTbl; + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT void ncr5390IfTblInit (); +IMPORT STATUS ascProgBytesIn (SCSI_PHYS_DEV *, UINT8 *, int, int); +IMPORT STATUS ascProgBytesOut (SCSI_PHYS_DEV *, UINT8 *, int, int); +IMPORT NCR_5390_SCSI_CTRL * ncr5390CtrlCreate (UINT8 *, int, UINT, + FUNCPTR, FUNCPTR); + + +#ifndef NCR5390_1_LOCAL_FUNCS +IMPORT void ascCommand (ASC *, FAST int); +IMPORT void ascIntr (ASC *); +IMPORT void ascXferCountGet (FAST ASC *, FAST int *); +IMPORT STATUS ascXferCountSet (FAST ASC *, FAST int); +IMPORT STATUS ncr5390CtrlInit (FAST ASC *, FAST int, FAST UINT, int); +IMPORT STATUS nc5390Show ( FAST SCSI_CTRL *); +#endif + +#else /* __STDC__ */ + +IMPORT void ncr5390IfTblInit (); +IMPORT NCR_5390_SCSI_CTRL * ncr5390CtrlCreate (); +IMPORT STATUS ascProgBytesIn (); +IMPORT STATUS ascProgBytesOut (); + +#ifndef NCR5390_1_LOCAL_FUNCS +IMPORT void ascCommand (); +IMPORT void ascIntr (); +IMPORT void ascXferCountGet (); +IMPORT STATUS ascXferCountSet (); +IMPORT STATUS ncr5390CtrlInit (); +IMPORT STATUS nc5390Show (); +#endif + +#endif /* __STDC__ */ +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCncr5390_1h */ diff --git a/h/drv/scsi/ncr5390_2.h b/h/drv/scsi/ncr5390_2.h new file mode 100644 index 0000000..ef3c5a0 --- /dev/null +++ b/h/drv/scsi/ncr5390_2.h @@ -0,0 +1,273 @@ +/* ncr5390_2.h - NCR 53C90 Advanced SCSI Controller header file */ + +/* +modification history +-------------------- +01a,07may96,dds written (from jaideep) +*/ + +#ifndef __INCncr5390_2h +#define __INCncr5390_2h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "scsiLib.h" +#include "semLib.h" + + +/* ASC state enumeration */ + +typedef enum ascState + { + ASC_STATE_IDLE = 0, + ASC_STATE_SELECT_PENDING, + ASC_STATE_CONNECTED + } ASC_STATE; + +/* SCSI controller structure */ + +typedef struct /* NCR_5390_SCSI_CTRL - NCR 5390 SCSI controller info */ + { + SCSI_CTRL scsiCtrl; /* generic SCSI controller info */ + SEM_ID xferDoneSem; /* semaphore for waiting on transfer */ + UINT clkPeriod; /* period of the controller clock (nsec) */ + UINT maxBytesPerXfer; /* limit of ASC's DMA transfer counter */ + UINT defSelTimeOut; /* default dev. select time-out (usec) */ + FUNCPTR sysScsiDmaStart; /* function for SCSI DMA I/O */ + FUNCPTR sysScsiDmaAbort; /* function for SCSI DMA aborts */ + int sysScsiDmaArg; /* call-back argument for SCSI DMA funcs. */ + int devType; /* type of device (see define's below) */ + TBOOL slowCableMode; /* TRUE to select slow cable mode */ + TBOOL resetReportDsbl; /* TRUE to disable SCSI bus reset reporting */ + TBOOL parityTestMode; /* TRUE to enable par test mode (DO NOT USE!) */ + TBOOL parityCheckEnbl; /* TRUE to enable parity checking */ + UINT8 clkCvtFactor; /* value of the clock conversion factor */ + int chipType; /* chip type (see definitions below) */ + ASC_STATE state; /* current state of controller */ + int selBusId; /* SCSI id of target being selected */ + int reqPhase; /* current info xfer phase of SCSI */ + BOOL xferPending; /* is a transfer pending on the controller ? */ + int xferPhase; /* SCSI phase currently being xferred */ + UINT xferNBytes; /* Number of bytes currently being xfered */ + UINT8 * xferAddr; /* Address of buffer being xfered */ + int xferDirection; /* Direction of current transfer */ + BOOL xferUsingDma; /* Current transfer is using DMA ? */ + BOOL syncDataXfer; /* Synchronous data transfer enabled ? */ + + volatile UINT8 *pTclReg; /* ptr xfer count LSB reg */ + volatile UINT8 *pTchReg; /* ptr xfer count MSB reg */ + volatile UINT8 *pFifoReg; /* ptr FIFO reg */ + volatile UINT8 *pCmdReg; /* ptr command reg */ + volatile UINT8 *pStatReg; /* ptr status reg */ + volatile UINT8 *pIntrReg; /* ptr interrupt reg */ + volatile UINT8 *pStepReg; /* ptr sequence step reg */ + volatile UINT8 *pFlgsReg; /* ptr FIFO flags reg */ + volatile UINT8 *pCfg1Reg; /* ptr configuration 1 reg */ + volatile UINT8 *pClkReg; /* ptr clock conversion factor reg */ + volatile UINT8 *pTestReg; /* ptr test mode reg */ + volatile UINT8 *pCfg2Reg; /* ptr configuration 2 reg (if present) */ + volatile UINT8 *pCfg3Reg; /* ptr configuration 3 reg (if present) */ + volatile UINT8 *pTcxReg; /* ptr to xfer count ext'n reg (if present) */ + } NCR_5390_SCSI_CTRL; + +typedef struct ncr5390functbl + { + FUNCPTR ascCommand; + FUNCPTR ascIntr; + FUNCPTR ascRegRead; + FUNCPTR ascRegWrite; + FUNCPTR ascXferCountGet; + FUNCPTR ascXferCountSet; + FUNCPTR ncr5390CtrlInit; + FUNCPTR ncr5390Show; + } SCSIDRV_FUNC_TBL; + +/* defines for the overlapping registers */ + +#define pBidReg pStatReg /* select/reselect bus id */ +#define pTmoReg pIntrReg /* select/reselect bus id */ + +/* ASC device types */ + +#define ASC_NCR5390 0 +#define ASC_NCR5390A 1 +#define ASC_NCR5390B 2 +#define ASC_NCR5394 3 +#define ASC_NCR5395 4 +#define ASC_NCR5396 5 +#define ASC_NCR53C9X 6 /* as in NCR 89C100 (for frc5ce) */ + +/* FIFO register */ + +#define NCR5390_FIFO_DEPTH 16 + +/* command register */ + +#define NCR5390_NOP 0x00 +#define NCR5390_FIFO_FLUSH 0x01 +#define NCR5390_CHIP_RESET 0x02 +#define NCR5390_BUS_RESET 0x03 + +#define NCR5390_INFO_TRANSFER 0x10 +#define NCR5390_I_CMD_COMPLETE 0x11 +#define NCR5390_MSG_ACCEPTED 0x12 +#define NCR5390_SET_ATTENTION 0x1a +#define NCR5390_UNSET_ATTENTION 0x1b + +#define NCR5390_SEND_MESSAGE 0x20 +#define NCR5390_SEND_STATUS 0x21 +#define NCR5390_SEND_DATA 0x22 +#define NCR5390_DISCONNECT_SEQ 0x23 +#define NCR5390_TERMINATE_SEQ 0x24 +#define NCR5390_T_CMD_COMPLETE 0x25 +#define NCR5390_DISCONNECT 0x27 +#define NCR5390_RCV_MESSAGE 0x28 +#define NCR5390_RCV_COMMAND 0x29 +#define NCR5390_RCV_DATA 0x2a +#define NCR5390_RCV_CMD_SEQ 0x2b + +#define NCR5390_RESELECT 0x40 +#define NCR5390_SELECT 0x41 +#define NCR5390_SELECT_ATN 0x42 +#define NCR5390_SEL_ATN_STOP 0x43 +#define NCR5390_SELECTION_ENBL 0x44 +#define NCR5390_SELECTION_DSBL 0x45 +#define NCR5390_SELECT_ATN3 0x46 + +#define NCR5390_DMA_OP 0x80 + +/* status register */ + +#define NCR5390_DOUT_PHASE 0x00 +#define NCR5390_DIN_PHASE 0x01 +#define NCR5390_CMND_PHASE 0x02 +#define NCR5390_STAT_PHASE 0x03 +#define NCR5390_MSGOUT_PHASE 0x06 +#define NCR5390_MSGIN_PHASE 0x07 +#define NCR5390_PHASE_MASK 0x07 +#define NCR5390_VAL_GROUP 0x08 +#define NCR5390_TERMINAL_CNT 0x10 +#define NCR5390_PARITY_ERR 0x20 +#define NCR5390_GROSS_ERR 0x40 +#define NCR5390_INTERRUPT 0x80 + +/* interrupt status register */ + +#define NCR5390_SELECTED 0x01 +#define NCR5390_ATN_SELECTED 0x02 +#define NCR5390_RESELECTED 0x04 +#define NCR5390_FUNC_COMPLETE 0x08 +#define NCR5390_BUS_SERVICE 0x10 +#define NCR5390_DISCONNECTED 0x20 +#define NCR5390_ILLEGAL_CMD 0x40 +#define NCR5390_SCSI_RESET 0x80 + +/* fifo flags register */ + +#define NCR5390_MORE_DATA 0x1f + +/* configuration register 1 */ + +#define NCR5390_OWN_ID_MASK 0x07 +#define NCR5390_CHIPTEST_ENBL 0x08 +#define NCR5390_PAR_CHECK_ENBL 0x10 +#define NCR5390_PAR_TEST_ENBL 0x20 +#define NCR5390_RESET_REP_DSBL 0x40 +#define NCR5390_SLOW_CABLE 0x80 + +/* test register */ + +#define NCR5390_TARGET 0x01 +#define NCR5390_INITIATOR 0x02 +#define NCR5390_HIGH_IMP 0x04 + +/* configuration register 2 */ + +#define NCR5390_DMA_PAR_ENBL 0x01 +#define NCR5390_REG_PAR_ENBL 0x02 +#define NCR5390_PARITY_ABORT 0x04 +#define NCR5390_SCSI_2 0x08 +#define NCR5390_DREQ_HIGH_IMP 0x10 +#define NCR5390_FEATURE_ENABLE 0x40 /* enable advanced features */ + +/* configuration register 3 */ + +#define NCR5390_FAST_CLOCK 0x01 /* clock freq > 25 MHz */ +#define NCR5390_FAST_SCSI 0x02 /* allow fast SCSI data rates */ +#define NCR5390_CDB10 0x04 /* allow 10-byte group 2 CDBs */ +#define NCR5390_Q_TAG_ENABLE 0x08 /* auto-receive queue tag messages */ +#define NCR5390_CHECK_ID_MSG 0x10 /* check ID msg during (re)selection */ + +/** sequence step register **/ + +#define NCR5390_SEQ_ATNSTOP 0x01 +#define NCR5390_SEQ_OUT 0x04 +#define NCR5390_SEQ_TIME 0x07 +#define NCR5390_SEQ_ERR 0x00 + +/** miscellaneous constants **/ + +#define ASC_SYNC_XFER_PARAMS_ASYNC 0x00 + +#define ASC_MIN_XFER_PERIOD 5 +#define ASC_MAX_XFER_PERIOD 35 +#define ASC_MAX_REQ_ACK_OFFSET 15 + +#define ASC_STAT_BITS 0x07 + +typedef NCR_5390_SCSI_CTRL ASC; + +/* external declarations */ + +IMPORT SCSIDRV_FUNC_TBL *pNcr5390IfTbl; + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT void ncr5390IfTblInit (); +IMPORT void ascIntr ( ASC *); +IMPORT STATUS ncr5390CtrlInit (FAST ASC *, FAST int , FAST UINT, int); + +IMPORT NCR_5390_SCSI_CTRL * ncr5390CtrlCreateScsi2 (UINT8 *baseAdrs, + int regOffset, + UINT clkPeriod, + UINT sysScsiDmaMaxBytes, + FUNCPTR sysScsiDmaXfer, + FUNCPTR sysScsiDmaAbort, + int sysScsiDmaArg); + + +#ifndef NCR5390_2_LOCAL_FUNCS +IMPORT void ascCommand (ASC *pAsc, int cmdCode); +IMPORT void ncr5390Intr (ASC *); +IMPORT void ascXferCountGet (FAST ASC *, FAST UINT *); +IMPORT STATUS ascXferCountSet (FAST ASC *, FAST UINT); +IMPORT STATUS ncr5390CtrlInitScsi2 (FAST ASC *, FAST int , FAST UINT); +IMPORT STATUS ncr5390ShowScsi2 ( FAST NCR_5390_SCSI_CTRL *); +#endif + +#else /* __STDC__ */ + +IMPORT void ncr5390IfTblInit(); +IMPORT NCR_5390_SCSI_CTRL * ncr5390CtrlCreateScsi2 (); + +#ifndef NCR5390_2_LOCAL_FUNCS +IMPORT void ascCommand (); +IMPORT void ncr5390Intr (); +IMPORT void ascXferCountGet (); +IMPORT STATUS ascXferCountSet (); +IMPORT STATUS ncr5390CtrlInitScsi2 (); +IMPORT STATUS ncr5390ShowScsi2 (); +#endif + +#endif /* __STDC__ */ +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCncr5390_2h */ diff --git a/h/drv/scsi/ncr710.h b/h/drv/scsi/ncr710.h new file mode 100644 index 0000000..a50de13 --- /dev/null +++ b/h/drv/scsi/ncr710.h @@ -0,0 +1,25 @@ +/* ncr710.h - NCR 710 Script SCSI Controller header file */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,26apr02,dat Adding cplusplus protection, SPR 75017 +01a,21oct94,jds Created for backward compatability +*/ + +#ifndef __INCncr710h +#define __INCncr710h + +#ifndef INCLUDE_SCSI2 + +#include "ncr710_1.h" + +#else + +#include "ncr710_2.h" + +#endif /* INCLUDE_SCSI2 */ + +#endif /* __INCncr710h */ diff --git a/h/drv/scsi/ncr710Script.h b/h/drv/scsi/ncr710Script.h new file mode 100644 index 0000000..c395490 --- /dev/null +++ b/h/drv/scsi/ncr710Script.h @@ -0,0 +1,25 @@ +/* ncr710Script.h - NCR 710 Script definition header */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,26apr02,dat Adding cplusplus protection, SPR 75017 +01a,23oct94,jds Created for backward compatability +*/ + +#ifndef __INCncr710Scripth +#define __INCncr710Scripth + +#ifndef INCLUDE_SCSI2 + +#include "ncr710Script1.h" + +#else + +#include "ncr710Script2.h" + +#endif /* INCLUDE_SCSI2 */ + +#endif /* __INCncr710Scripth */ diff --git a/h/drv/scsi/ncr710Script1.h b/h/drv/scsi/ncr710Script1.h new file mode 100644 index 0000000..e580665 --- /dev/null +++ b/h/drv/scsi/ncr710Script1.h @@ -0,0 +1,236 @@ +/* ncr710Script1.h - NCR 710 Script definition header */ + +/* Copyright 1984-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,08nov94,jds renamed for SCSI1 compatability +01i,22sep92,rrr added support for c++ +01h,01sep92,ccc fixed warnings. +01g,03jul92,eve change NCRBUG to NCR_COMPILER_BUG +01f,03jul92,eve Merge new header +01e,26jun92,ccc change ASMLANGUAGE to _ASMLANGUAGE. +40b,26may92,rrr the tree shuffle +40a,12nov91,ccc SPECIAL VERSION FOR 5.0.2 68040 RELEASE. +02a,26oct91,eve Add byte definition to turnoff/on the timeout in the script. +01a,23oct91,eve Created script and driver header +*/ + +#ifndef __INCncr710Script1h +#define __INCncr710Script1h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + + +/* Just used to compile the primary file .n that contain + * source code for the ncr compiler. + */ + +#ifdef NCR_COMPILER_BUG +typedef unsigned char UINT8; +typedef unsigned int ULONG; +typedef unsigned int UINT; +#endif /* NCR_COMPILER_BUG */ + +/* Because this file will be include in a script source + * do not include vxWorks header. + */ + +/* Structure for the script. Script takes information from + * this structure, don't change count/pointer group order + * All of these fields must be aligned on a 32bit boundry + */ + +typedef struct ncrCtl + { + UINT device; /* target description. */ + UINT msgOutCount; /* count for message out. */ + UINT8 *pMsgOut; /* message out area. */ + UINT msgInCount; /* count message in (always 1).*/ + UINT8 *pMsgIn; /* message in area. */ + UINT extMsgInCount; /* count ext message in (always 2).*/ + UINT8 *pExtMsgIn; /* extended message in area. */ + UINT cmdCount; /* 24 bit count for scsi command. */ + UINT8 *pCmd; /* pointer to scsi command. */ + UINT dataCount; /* 24 bit user data count. */ + UINT8 *pData; /* pointer to user data buffer. */ + UINT statusCount; /* length of status scsi (always 1). */ + UINT8 *pScsiStatus; /* pointer for scsi status. */ + /* information for reconnect and save pointer. */ + UINT identCount; /* msg in reselect message count. */ + UINT8 *pIdentMsg; /* pointer to local IDent reconnect Message. */ + UINT scriptAddr; /* script start address. */ + UINT *pScsiPhysDev; /* pointer to phys dev info for this nexus. */ + UINT phaseRequested; /* save phase requested by the script at int lvl. */ + /* informations supply by ncr preprocessor. */ + UINT *pReloc; /* pointer to reloc table. */ + UINT *pFirstRtn; /* pointer to the first script routine. */ + /* (Entry point). */ + UINT *scriptPtr; /* pointer to table of addresses */ + /* of script routines. */ + } NCR_CTL; + +/* offset used literally in the script, if a change occurs + * in ncrCtrl structure above you have to change the offset value here + * Because it seems that the ncr compiler does not like a long and + * nested in PASS declaration does not use a macro + */ +#define DEVICEID 0x00 +#define MSGOUTCOUNT 0x04 +#define PMSGOUTCOUNT 0x08 +#define MSGINCOUNT 0x0C +#define PMSGIN 0x10 +#define EXTMSGINCOUNT 0x14 +#define PEXTMSGIN 0x18 +#define CMDCOUNT 0x1C +#define PCMD 0x20 +#define DATACOUNT 0x24 +#define PDATA 0x28 +#define STATUSCOUNT 0x2C +#define PSTATUS 0x30 +#define IDENTCOUNT 0x34 +#define PIDENTMSG 0x38 + +/* Field values for relocate script */ +/* definitions for the relocation table entry_id fields */ +#define SCRIPT_BASE 0x98080000 /* IDentifies a script ptr entry */ +#define MEM_SIZE 0x0F000001 /* IDentifies a script byte size entry*/ +#define DATA_OFFSET 0x88080000 /* IDentifies a data offset entry */ +#define CODE_OFFSET 0x80080000 /* IDentifies a code offset entry */ +#define TABLE_END 0x60000040 /* IDentifies a the end of reloc tbl */ + +/* relocation entry */ +typedef struct relocInfo + { + UINT entryType; /* type of Entry */ + UINT entryValue; /* entry offset */ + } RELOC_INFO; + +/* use both by C and script via scratch register to keep track of the phase + * requested. + */ +#define PHASE_DATAOUT 0x00 /* data out (to target) */ +#define PHASE_DATAIN 0x01 /* data in (from target) */ +#define PHASE_COMMAND 0x02 /* command (to target) */ +#define PHASE_STATUS 0x03 /* status (from target) */ +#define PHASE_UNDEF1 0x04 /* reserved (to target) */ +#define PHASE_UNDEF2 0x05 /* reserved (from target) */ +#define PHASE_MSGOUT 0x06 /* message out (to target) */ +#define PHASE_MSGIN 0x07 /* message in (from target) */ +#define PHASE_DISCON 0x08 /* disconnect */ +#define PHASE_RESEL 0x09 /* ident msg */ +#define PHASE_NOPHASE 0x0a /* phase has yet to be determined */ + +/* Scsi initiator message type Cut/Paste from scsiLib (used in script) */ +#define M_CMD_COMP (0x00) /* command complete msg. */ +#define M_EXT_MSG (0x01) /* extended message msg. */ +#define M_SAV_DAT_P (0x02) /* save data pointer msg. */ +#define M_REST_P (0x03) /* restore pointers msg. */ +#define M_DISC (0x04) /* disconnect msg. */ +#define M_INITOR_DETECT_ERR (0x05) /* initor. detect err msg. */ +#define M_ABORT (0x06) /* abort msg. */ +#define M_MSG_REJECT (0x07) /* message reject msg. */ +#define M_NO_OP (0x08) /* no operation msg. */ +#define M_PARITY_ERR (0x09) /* message parity err msg. */ +#define M_LINK_CMD_COMPLETE (0x0a) /* linked cmd. comp. msg. */ +#define M_LINK_CMD_FLAG_COMP (0x0b) /* link cmd w/flag comp. */ +#define M_BUS_DEVICE_RESET (0x0c) /* bus device reset msg. */ +#define M_IDENT_DISCONNECT (0x40) /* identify disconnect bit */ +#define M_IDENTIFY (0x80) /* identify msg bit mask */ + +#ifndef NCRCOMPILE + +/* due to a script compiler bug */ +#ifdef NCR_COMPILER_BUG +#define EQ = +#endif /* NCR_COMPILER_BUG */ + +/* Return value of intr script instruction for C code. */ +/* As these definitions are share between script and C. */ + +#define MSGOUT_EXPECT 0x0ff01 /* No message out after a selection. */ +#define BAD_PH_BEFORE_CMD 0x0ff02 /* unexecpected phase before command */ + /* phase. */ +#define BAD_PH_AFTER_CMD 0x0ff03 /* unexpected phase after command */ + /* phase. */ +#define MSGIN_EXPECT_AFTER_ST 0x0ff04 /* no message in phase after status */ + /* phase. */ +#define GOOD_END 0x0ff00 /* transaction process properly */ + /* finished. */ +#define ST_CHECK_CONDITION 0x0fffe /* scsi status :check cond. */ +#define ST_BUSY 0x0fffd /* scsi status :busy. */ +#define ST_RESERVED 0x0fffc /* scsi status :reservation conflict. */ +#define ST_UNKNOWN 0x0fffb /* status returned is unknown. */ +#define BAD_PH_AFTER_DATA 0x0ff05 /* unexepected phase after a data */ + /* transfert. */ +#define BAD_MSGIN_BEFORE_CMD 0x0ff06 /* unexpected message in before a */ + /* command phase. */ +#define EXTMSG_BEFORE_CMD 0x0ff07 /* extended message present before */ + /* a command phase. */ +#define SAVDATP_BEFORE_CMD 0x0ff08 /* save data pointer before the */ + /* command phase. */ +#define DISC_BEFORE_CMD 0x0ff09 /* disconnect before the command */ + /* phase. */ +#define SAVDATP_AFTER_CMD 0x0ff10 /* save data pointer after the */ + /* command phase. */ +#define BAD_MSG_AFTER_CMD 0x0ff11 /* unexpected message after the */ + /* command phase. */ +#define EXTMSG_AFTER_CMD 0x0ff12 /* extended message present after the */ + /* command phase. */ +#define DISC_AFTER_CMD 0x0ff13 /* disconnect after a command phase. */ +#define SAVDATP_AFTER_DATA 0x0ff14 /* save data pointer after a data */ + /* transfer. */ +#define BAD_MSG_AFTER_DATA 0x0ff15 /* unexpected message after a data */ + /* transfer. */ +#define EXTMSG_AFTER_DATA 0x0ff16 /* extended message after a data */ + /* transfer. */ +#define DISC_AFTER_DATA 0x0ff17 /* disconnect after a data transfer. */ +#define MSGIN_NOT_AFTER_RESEL 0x0ff18 /* not a message in phase after a */ + /* reselection. */ +#define DATIN_AFTER_RESEL_IDRECV 0x0ff19 /* data in after reselect/message */ + /* identify received. */ +#define DATOUT_AFTER_RESEL_IDRECV 0x0ff20 /* data out after reselection */ + /* message ident received */ +#define MSGIN_AFTER_RESEL_IDRECV 0x0ff21 /* msg in after reselect and */ + /* identify message received.*/ +#define ST_AFTER_RESEL_IDRECV 0x0ff22 /* status after reselect and */ + /* identify message received. */ +#define MSGOUT_AFTER_RESEL_IDRECV 0x0ff23 /* message out out after reselect */ + /* and identify message received. */ +#define PH_UNKNOWN_IDRECV 0x0ff24 /* unknown phase after reselect */ + /* and identify message received. */ +#define SELECT_AS_TARGET 0x0ff25 /* select as a target. */ +#define BAD_MSG_INSTEAD_CMDCOMP 0x0ff26 /* unexpected message instead of */ + /* command complete message. */ +#define REJECT_MSG1 0x0ff27 /* received a reject message. */ +#define ABORT_CLEAR_END 0x0ff28 /* finish script because bus free */ + /* phase condition received. */ +#define PH_UNKNOWN 0x0ff29 /* unknown phase after sortPhase. */ +#define RES_IN_DETECTED 0x0ff2a /* Reserved phase detected. */ +#define RES_OUT_DETECTED 0x0ff2b /* Reserved phase detected. */ +#define RECONNECT_PROCESS 0x0ff2c /* interrupt cpu for reconnected. */ +#define NEW_COMMAND_PROCESS 0x0ff2d /* interrupt cpu to run a new */ + /* command. */ +#define RESTORE_POINTER 0x0ff2e /* interrupt cpu to restore ptr. */ +#define BAD_NEW_CMD 0x0ff2f /* Bogus new command. */ +#define RECONNECT_IN_SELECT 0x0ff30 /* Reconnection during a select. */ + +#else /* NCRCOMPILE */ + +ABSOLUTE B_TIMEO=0x10 ;/* Timout timer bit */ +ABSOLUTE B_CON=0x10 ;/* Connected connection status bit */ +ABSOLUTE B_SIGP=0x20 ;/* SIGP bit position */ +#endif /* NCRCOMPILE */ + + +#endif /* _ASMLANGUAGE */ +#ifdef __cplusplus +} +#endif + +#endif /* __INCncr710Script1h */ diff --git a/h/drv/scsi/ncr710Script2.h b/h/drv/scsi/ncr710Script2.h new file mode 100644 index 0000000..913360d --- /dev/null +++ b/h/drv/scsi/ncr710Script2.h @@ -0,0 +1,224 @@ +/* ncr710Script.h - NCR 710 Script definition header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +03c,03jun94,ihw corrected problem with NCR_COMPILE macro +03b,27may94,ihw documented prior to release +03a,02may94,ihw major modifications to work with new SCSI architecture + supports tagged commands +02a,18feb94,ihw modified for enhanced SCSI library: multiple initiators, + disconnect/reconnect and synchronous transfer supported +01i,22sep92,rrr added support for c++ +01h,01sep92,ccc fixed warnings. +01g,03jul92,eve change NCRBUG to NCR_COMPILER_BUG +01f,03jul92,eve Merge new header +01e,26jun92,ccc change ASMLANGUAGE to _ASMLANGUAGE. +40b,26may92,rrr the tree shuffle +40a,12nov91,ccc SPECIAL VERSION FOR 5.0.2 68040 RELEASE. +02a,26oct91,eve Add byte definition to turnoff/on the timeout in the script. +01a,23oct91,eve Created script and driver header +*/ + +#ifndef __INCncr710Script2h +#define __INCncr710Script2h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#ifndef NCR_COMPILE + +/* + * Entry points defined by PROCs in the script. + */ + +extern ULONG ncr710Wait[]; /* wait for re-select or host cmd */ +extern ULONG ncr710InitStart[]; /* start new initiator thread */ +extern ULONG ncr710InitContinue[]; /* continue an initiator thread */ +extern ULONG ncr710TgtDisconnect[]; /* disconnect from SCSI bus */ + +/* + * Structure giving parameters for block moves using the NCR 710's + * indirect addressing ("MOVE FROM") capability. + */ +typedef struct moveParams + { + ULONG size; /* # bytes to move to/from SCSI */ + UINT8 *addr; /* where in memory they go/come */ + } MOVE_PARAMS; + +/* + * Shared structure defining all information about a SCSI nexus which has + * to be visible to the script. Note that this structure must not be + * changed without corresponding changes to the OFFSET_* definitions below. + * + * IMPORTANT NOTE: Every element in this structure _must_ be aligned on + * a 4-byte boundary, otherwise the script will fail (illegal instruction). + */ +typedef struct ncr710Shared + { + ULONG device; /* target bus ID, sync xfer params */ + MOVE_PARAMS command; /* command bytes sent to target */ + MOVE_PARAMS data; /* data bytes to/from target */ + MOVE_PARAMS status; /* command status byte from target */ + MOVE_PARAMS identOut; /* outgoing identification msg */ + MOVE_PARAMS identIn; /* incoming identification msg */ + MOVE_PARAMS msgOut; /* message bytes sent to target */ + MOVE_PARAMS msgIn; /* message bytes recvd from target */ + MOVE_PARAMS msgInSecond; /* second byte of multi-byte msg */ + MOVE_PARAMS msgInRest; /* remainder of multi-byte message */ + } NCR710_SHARED; + +#endif /* NCR_COMPILE */ + +/* + * The following offsets are used in the script. They _MUST_ be kept in + * sync with the definition of the NCR710_NEXUS structure above. + */ +#define SIZEOF_ULONG 4 +#define SIZEOF_MOVE_PARAMS 8 + +#define OFFSET_DEVICE 0 +#define OFFSET_CMD (OFFSET_DEVICE + SIZEOF_ULONG) +#define OFFSET_DATA (OFFSET_CMD + SIZEOF_MOVE_PARAMS) +#define OFFSET_STATUS (OFFSET_DATA + SIZEOF_MOVE_PARAMS) +#define OFFSET_IDENT_OUT (OFFSET_STATUS + SIZEOF_MOVE_PARAMS) +#define OFFSET_IDENT_IN (OFFSET_IDENT_OUT + SIZEOF_MOVE_PARAMS) +#define OFFSET_MSG_OUT (OFFSET_IDENT_IN + SIZEOF_MOVE_PARAMS) +#define OFFSET_MSG_IN (OFFSET_MSG_OUT + SIZEOF_MOVE_PARAMS) +#define OFFSET_MSG_IN_SECOND (OFFSET_MSG_IN + SIZEOF_MOVE_PARAMS) +#define OFFSET_MSG_IN_REST (OFFSET_MSG_IN_SECOND + SIZEOF_MOVE_PARAMS) + + +/* + * Scratch registers used for data transfer to host + * + */ +#define HOST_FLAGS scratch0 /* host <-> SIOP: flags - see below */ + +#define MSG_OUT_STATE scratch1 /* host <-> SIOP: pending,sent,none */ + +#define MSG_IN_STATE scratch2 /* host <-> SIOP: pending,sent,none */ + +#define TARGET_BUS_ID scratch3 /* host <- SIOP: bus IDs asserted */ +#define CURRENT_PHASE scratch3 /* host <- SIOP: phase in progress */ + +/* Bitmasks for HOST_FLAGS */ + +#define FLAGS_IDENTIFY 0x01 /* assert ATN on select, to IDENTIFY */ + +/* + * These definitions provide meaningful aliases for use in "ncr710Lib.c". + * I don't like #defining names of structure members, but it's better than + * having "scratch0" and so forth all over the place ... Be careful of + * clashes with ordinary variable names. + */ +#define nHostFlags scratch0 /* (r/w) flag bits as defined above */ +#define nMsgOutState scratch1 /* (r/w) state of message out buffer */ +#define nMsgInState scratch2 /* (r/w) state of message in buffer */ +#define nBusIdBits scratch3 /* (r-o) bus ID bits set on reselect */ +#define nBusPhase scratch3 /* (r-o) most recent phase; mismatch */ + + +/* + * SCSI phases - defined here to avoid including "scsiLib.h". Must match ! + */ +#define PHASE_NONE 0xff /* no info transfer pending */ +#define PHASE_DATA_OUT 0 /* data out (to target) */ +#define PHASE_DATA_IN 1 /* data in (from target) */ +#define PHASE_COMMAND 2 /* command (to target) */ +#define PHASE_STATUS 3 /* status (from target) */ +#define PHASE_MSG_OUT 6 /* message out (to target) */ +#define PHASE_MSG_IN 7 /* message in (from target) */ + +/* + * SCSI messages - defined here to avoid including "scsiLib.h". Must match ! + */ +#define M_CMD_COMPLETE 0x00 /* command complete msg. */ +#define M_EXT_MSG 0x01 /* extended message msg. */ +#define M_DISCONNECT 0x04 /* disconnect msg. */ +#define M_ABORT 0x06 /* abort msg. */ +#define M_NO_OP 0x08 /* no operation msg. */ +#define M_ABORT_TAG 0x0d /* abort tag msg. */ + +/* + * SCSI message in status - must match SCSI_MSG_IN_STATE enum in "scsiLib.h" + */ +#define M_IN_NONE 0 /* no message in in progress */ +#define M_IN_SECOND_BYTE 1 /* next byte is second of two */ +#define M_IN_EXT_MSG_LEN 2 /* next byte is ext msg length */ +#define M_IN_EXT_MSG_DATA 3 /* next byte(s) are ext msg data */ + +/* + * SCSI message out status - must match SCSI_MSG_OUT_STATE enum in "scsiLib.h" + */ +#define M_OUT_NONE 0 /* no message out in progress */ +#define M_OUT_PENDING 1 /* message out ready to send */ +#define M_OUT_SENT 2 /* message out has been sent */ + + +/* + * Script status interrupt codes + */ +#define NCR710_READY 0 /* ready to start new host command */ +#define NCR710_SCRIPT_ABORTED 1 /* have aborted a running script */ + +#define NCR710_MESSAGE_OUT_SENT 10 /* have successfully sent a message */ +#define NCR710_MESSAGE_IN_RECVD 11 /* have received a complete message */ +#define NCR710_EXT_MESSAGE_SIZE 12 /* have read size of extended msg */ +#define NCR710_NO_MSG_OUT 13 /* msg out req. with no msg pending */ + +#define NCR710_CMD_COMPLETE 20 /* SCSI command completed */ +#define NCR710_DISCONNECTED 21 /* target has disconnected */ +#define NCR710_RESELECTED 22 /* have been reselected by target */ +#define NCR710_SELECTED 23 /* have been selected as a target */ + +#define NCR710_SPURIOUS_CMD 30 /* spurious interrupt of resel wait */ +#define NCR710_ILLEGAL_PHASE 31 /* target requested phase 4 or 5 */ +#define NCR710_NO_IDENTIFY 32 /* no IDENTIFY after reselection */ + +/* + * Note: the following are not generated by the script, but it seems + * sensible to define them here for continuity. + */ +#define NCR710_PHASE_MISMATCH 50 /* unexpected phase change occurred */ +#define NCR710_SCSI_TIMEOUT 51 /* select, reselect or xfer timeout */ +#define NCR710_SCSI_BUS_RESET 52 /* SCSI bus has been reset */ +#define NCR710_UNEXPECTED_DISCON 53 /* target disconnected unexpectedly */ + +#define NCR710_SINGLE_STEP 60 /* single-step completed */ + +#define NCR710_FATAL_ERROR 99 /* bus error, illegal opcode, etc. */ + + +/* + * NCR 710 register bit definitions + * + * Note: there are similar definitions in "ncr710.h". + */ +#define SBCL_SEL 0x10 /* 1 => SCSI SEL signal asserted */ +#define SBCL_ATN 0x08 /* 1 => SCSI ATN signal asserted */ + +#define SCNTL0_TARGET_MODE 0x01 /* 1 => SIOP is in target mode */ + +#define SCNTL1_CONNECTED 0x10 /* 1 => SIOP is connected to SCSI */ + +#define SIEN_MISMATCH_ATN 0x80 /* 1 => mismatch/ATN intr enabled */ + +#define CTEST2_SIGNAL 0x40 /* 1 => signal pending from host */ + +#define CTEST7_NO_TIMEOUT 0x10 /* 1 => disable all SCSI timeouts */ + + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCncr710Script2h */ diff --git a/h/drv/scsi/ncr710_1.h b/h/drv/scsi/ncr710_1.h new file mode 100644 index 0000000..696b337 --- /dev/null +++ b/h/drv/scsi/ncr710_1.h @@ -0,0 +1,495 @@ +/* ncr710_1.h - NCR 710 Script SCSI Controller header file */ + +/* Copyright 1984-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02m,08nov94,jds renamed for SCSI1 compatability +02l,26sep92,ccc ncr710Show() returns STATUS. +02k,22sep92,rrr added support for c++ +02j,26jul92,rrr removed decl ncr710SyncMsgConvert, was made LOCAL in mod 02i +02i,21jul92,eve clean an move debug macros to ncr710Lib.c. +01h,03jul92,eve merge header with new driver. +01h,03jul92,eve merge header with new driver. +01g,29jun92,ccc fixed compile errors. +01f,26jun92,ccc changed ASMLANGUAGE to _ASMLANGUAGE. +40c,26may92,rrr the tree shuffle +40b,28apr92,wmd Added defines for LITTLE_ENDIAN architectures, and fixed + typo for declaration of ncr710CtrlCreate(), ansified. +40a,12nov91,ccc SPECIAL VERSION FOR 5.0.2 68040 RELEASE. +02a,26oct91,eve Add description of hardware dependant + registers. +01a,23oct91,eve Created driver header +*/ + +#ifndef __INCncr710_1h +#define __INCncr710_1h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "semLib.h" +#include "scsiLib.h" +#include "ncr710Script.h" + +/* Structure used in the ncr710SetHwRegister() and ncr710GetHwRegister(). + * This is used to try to handle the possible differents hardware + * implementation of the chip.This structure must contain the logical value + * wishes e.g 0 sets register bit to null and 1 sets to one. + */ + +typedef struct + { + int ctest4Bit7; /* Host bus multiplex mode */ + int ctest7Bit7; /* Disable/enable burst cache capability */ + int ctest7Bit6; /* Snoop control bit1 */ + int ctest7Bit5; /* Snoop control bit0 */ + int ctest7Bit1; /* invert tt1 pin (sync bus host mode only) */ + int ctest7Bit0; /* enable differential scsi bus capability */ + int ctest8Bit0; /* Set snoop pins mode */ + int dmodeBit7; /* Burst Length transfer bit 1 */ + int dmodeBit6; /* Burst Length transfer bit 0 */ + int dmodeBit5; /* Function code bit FC2 */ + int dmodeBit4; /* Function code bit FC1 */ + int dmodeBit3; /* Program data bit ( FC0) */ + int dmodeBit1; /* user programmable transfer type */ + int dcntlBit5; /* Enable Ack pin */ + int dcntlBit1; /* Enable fast arbitration on host port */ + } NCR710_HW_REGS; + + /* Allocate one context per device ( 8 ID max and 8 LUN max per ID) */ +typedef struct + { + NCR_CTL ncrCtl[SCSI_MAX_BUS_ID + 1][SCSI_MAX_LUN + 1]; + } NCR_CTL_CTXT; + +/* SCSI controller structure */ + +typedef struct /* NCR_710_SCSI_CTRL - NCR710 */ + /* SCSI controller info */ + { + SCSI_CTRL scsiCtrl; /* generic SCSI controller info */ + SEM_ID pMutexData; /* use to protect global siop data */ + SCSI_PHYS_DEV *pDevToSelect;/* device to select at intr. level or NULL */ + + /* Hardware implementation dependencies */ + TBOOL slowCableMode; /* TRUE to select slow cable mode */ + int chipType; /* Device type NCR7X0_TYPE */ + /* Only 710 Supported today */ + int devType; /* type of device (see define's below) */ + UINT8 ctrlIdPow2; /* controller id in power of 2 (1000000=id 7) */ + TBOOL resetReportDsbl; /* TRUE to disable SCSI bus reset reporting */ + TBOOL parityTestMode; /* TRUE enable parity test mode (DO NOT USE) */ + TBOOL parityCheckEnbl; /* TRUE to enable parity checking */ + UINT8 defaultSelTimeOut; /* default dev. select time-out (units var.) */ + UINT8 clkCvtFactor; /* value of the clock conversion factor */ + UINT8 saveIstat; /* Save Reg under interrupt */ + UINT8 saveSstat0; /* Save Reg under interrupt */ + UINT8 saveDstat; /* Save Reg under interrupt */ + UINT8 saveIdentMsg; /* Save Indent message in at interrupt level */ + /* when reconnect. */ + TBOOL commandRequest; /* To check if we are reconnected with a */ + /* request pending */ + UINT saveScriptIntrStat; /* Save intr script status under interrupt */ + SEMAPHORE singleStepSem; /* use to debug script in single step mode */ + NCR_CTL_CTXT *pNcrCtxt; /* pointer to Array of data shared by script */ + /* and driver */ + NCR_CTL *pNcrCtl; /* Current context pointer for intr level */ + NCR_CTL *pNcrCtlCmd; /* current ctxt pointer to the command */ + /* pending */ + NCR710_HW_REGS hwRegs; /* values used for hardware dependant regs */ + volatile UINT8 *pSien; /* SIEN SCSI interrupt enable reg */ + volatile UINT8 *pSdid; /* SDID SCSI destination ID register */ + volatile UINT8 *pScntl1; /* SCTNL1 SCSI control register 1 */ + volatile UINT8 *pScntl0; /* SCTNL0 SCSI control register 0 */ + volatile UINT8 *pSocl; /* SOCL SCSI output control latch reg */ + volatile UINT8 *pSodl; /* SCSI output data latch reg */ + volatile UINT8 *pSxfer; /* SODL SCSI transfer register */ + volatile UINT8 *pScid; /* SCID SCSI chip ID register */ + volatile UINT8 *pSbcl; /* SBCL SCSI bus control lines reg */ + volatile UINT8 *pSbdl; /* SBDL SCSI bus data lines register */ + volatile UINT8 *pSidl; /* SIDL SCSI input data latch reg */ + volatile UINT8 *pSfbr; /* SFBR SCSI first byte received reg */ + volatile UINT8 *pSstat2; /* SSTAT2 SCSI status register 2 */ + volatile UINT8 *pSstat1; /* SSTAT1 SCSI status register 1 */ + volatile UINT8 *pSstat0; /* SSTAT0 SCSI status register 0 */ + volatile UINT8 *pDstat; /* DSTAT DMA status register */ + volatile UINT *pDsa; /* DSA data structure address */ + volatile UINT8 *pCtest3; /* CTEST3 chip test register 3 */ + volatile UINT8 *pCtest2; /* CTEST2 chip test register 2 */ + volatile UINT8 *pCtest1; /* CTEST1 chip test register 1 */ + volatile UINT8 *pCtest0; /* CTEST0 chip test register 0 */ + volatile UINT8 *pCtest7; /* CTEST7 chip test register 7 */ + volatile UINT8 *pCtest6; /* CTEST6 chip test register 6 */ + volatile UINT8 *pCtest5; /* CTEST5 chip test register 5 */ + volatile UINT8 *pCtest4; /* CTEST4 chip test register 4 */ + volatile UINT *pTemp; /* TEMP temporary holding register */ + volatile UINT8 *pLcrc; /* LCRC longitudinal parity register */ + volatile UINT8 *pCtest8; /* CTEST8 chip test register */ + volatile UINT8 *pIstat; /* ISTAT interrupt status register */ + volatile UINT8 *pDfifo; /* DFIFO DMA FIFO control register */ + volatile UINT8 *pDcmd; /* DBC SIOP command register 8bits */ + volatile UINT *pDbc; /* DCMD SIOP command reg (24Bits Reg) */ + volatile UINT *pDnad; /* DNAD DMA buffer ptr (next address) */ + volatile UINT *pDsp; /* DSP SIOP scripts pointer register */ + volatile UINT *pDsps; /* DSPS SIOP scripts ptr save reg */ + volatile UINT8 *pScratch3; /* SCRATCH3 general purpose scratch reg */ + volatile UINT8 *pScratch2; /* SCRATCH2 general purpose scratch reg */ + volatile UINT8 *pScratch1; /* SCRATCH1 general purpose scratch reg */ + volatile UINT8 *pScratch0; /* SCRATCH0 general purpose scratch reg */ + volatile UINT8 *pDcntl; /* DCTNL DMA control register */ + volatile UINT8 *pDwt; /* DWT DMA watchdog timer register */ + volatile UINT8 *pDien; /* DIEN DMA interrupt enable */ + volatile UINT8 *pDmode; /* DMODE DMA operation mode register */ + volatile UINT *pAdder; /* ADDER Adder output Register */ + } NCR_710_SCSI_CTRL; + + +/* Bit Registers definitions for ncr710 */ + +/* SCNTL0 */ +#define B_ARB1 0x80 /* Arbitration bit 1 */ +#define B_ARB0 0x40 /* Arbitration bit 0 */ + /* 00 Simple/11 full */ +#define B_START 0x20 /* Start sequence */ +#define B_WATN 0x10 /* Select w/wo atn */ +#define B_EPC 0x08 /* Parity checking */ +#define B_EPG 0x04 /* Enable parity generation */ +#define B_AAP 0x02 /* Assert ATN on parity error */ +#define B_TRG 0x01 /* Target/initiator mode */ + +/* SCNTL1 */ +#define B_EXC 0x80 /* Extra Data Set up */ +#define B_ADB 0x40 /* Assert Data (SODL) onto scsi */ +#define B_ESR 0x20 /* Enable Select & reselect */ +#define B_CON 0x10 /* connected bit status */ +#define B_RST 0x08 /* Assert Rst on scsi */ +#define B_AESP 0x04 /* Assert even parity -force error */ +#define B_SND 0x02 /* Start send scsi operation */ +#define B_RCV 0x01 /* Start receive scsi operation */ + +/* SIEN (enable int)and SSTAT0 (RO Status) */ +/* Enable interrupt */ +#define B_MA 0x80 /* Enable phase mismatch/Atn Active */ +#define B_FCMP 0x40 /* Enable funtion complete */ +#define B_STO 0x20 /* Enable scsi timout */ +#define B_SEL 0x10 /* Enable sel/resel */ +#define B_SGE 0x08 /* Enable scsi gross error */ +#define B_UDC 0x04 /* Enable unexpected disconnect */ +#define B_RSTE 0x02 /* Enable Rst received */ +#define B_PAR 0x01 /* Enable parity int */ + +/* SXFER */ +#define B_DHP 0x80 /* Disable Halt on parity err */ +#define B_TP2 0x40 /* Synchronous transfer period 2 */ +#define B_TP1 0x20 /* Synchronous transfer period 1 */ +#define B_TP0 0x10 /* Synchronous transfer period 0 */ +#define B_MO3 0x08 /* Maximun scsi Synchronous transfer offset */ +#define B_MO2 0x04 /* Maximun scsi Synchronous transfer offset */ +#define B_MO1 0x02 /* Maximun scsi Synchronous transfer offset */ +#define B_MO0 0x01 /* Maximun scsi Synchronous transfer offset */ + +/* SOCL (RW) and SBCL (RO not latched) */ +#define B_REQ 0x80 /* Assert scsi req */ +#define B_ACK 0x40 /* Assert scsi ack */ +#define B_BSY 0x20 /* Assert scsi busy */ +#define B_SEL 0x10 /* Assert scsi sel */ +#define B_ATN 0x08 /* Assert scsi atn */ +#define B_MSG 0x04 /* Assert scsi msg */ +#define B_CD 0x02 /* Assert scsi c/d */ +#define B_IO 0x01 /* Assert scsi i/o */ +/* SSCF (Write only same @ as SBCL) */ +#define B_SSCF1 0x02 /* prescale clock for scsi core bit 1 */ +#define B_SSCF0 0x01 /* prescale clock for scsi core bit 0 */ + +/* DSTAT (RO) and DIEN (RW enable intr) */ +#define B_DFE 0x80 /* stat :Dma fifo empty */ +#define B_BF 0x20 /* stat :Bus access error */ +#define B_ABT 0x10 /* stat :Abort condition */ +#define B_SSI 0x08 /* stat :Scsi step interrupt */ +#define B_SIR 0x04 /* stat :Script interrupt received */ +#define B_WTD 0x02 /* stat :Watchdog timout */ +#define B_IID 0x01 /* stat :Illegal instruction occur */ + +/* SSTAT1 RO register */ +#define B_ILF 0x80 /* stat :SDIL register contain scsi data */ + /* in async mode only */ +#define B_ORF 0x40 /* stat :SODR output data in sync mode hidden */ +#define B_OLF 0x20 /* stat :SODL Register full (hidden) */ +#define B_AIP 0x10 /* stat :Arbitration in progress */ +#define B_LOA 0x08 /* stat :Lost arbitration */ +#define B_WOA 0x04 /* stat :won arbitration-full arbit mode */ +#define B_RSTNL 0x02 /* stat :current stat of RST line-Not Latched */ +#define B_PARNL 0x01 /* stat :curr stat Parity lines-Not Latched */ + +/* SSTAT2 RO register */ +#define B_FF3 0x80 /* Fifo flag 3 :number of bytes in fifo */ +#define B_FF2 0x40 /* Fifo flag 2 :number of bytes in fifo */ +#define B_FF1 0x20 /* Fifo flag 1 :number of bytes in fifo */ +#define B_FF0 0x10 /* Fifo flag 0 :number of bytes in fifo */ + /* 0000=0 ..... 1000=8 */ +#define B_SPDL 0x08 /* Latched parity line */ +#define B_MSGL 0x04 /* Latched state of MSG line */ +#define B_CDL 0x02 /* Latched state of C/D line */ +#define B_IOL 0x01 /* Latched sate of IO line */ + +/* DFIFO RW register */ +#define B_BO6 0x40 /* Byte offset counter 6 */ +#define B_BO5 0x20 /* Byte offset counter 5 */ +#define B_BO4 0x10 /* Byte offset counter 4 */ +#define B_BO3 0x08 /* Byte offset counter 3 */ +#define B_BO2 0x04 /* Byte offset counter 2 */ +#define B_BO1 0x02 /* Byte offset counter 1 */ +#define B_BO0 0x01 /* Byte offset counter 0 */ + +/* ISTAT RW register */ +#define B_ABORT 0X80 /* Abort operation */ +#define B_SOFTRST 0x40 /* Soft chip reset */ +#define B_SIGP 0x20 /* signal process */ +#define B_CONST 0x08 /* stat connected (reset does'nt disconnect) */ +#define B_SIP 0x02 /* Status scsi interrupt pending */ +#define B_DIP 0x01 /* Status Dma portion interrupt pending */ + +/* DMODE RW register */ +#define B_BL1 0x80 /* Burst Length transfer bit 1 */ +#define B_BL0 0x40 /* Burst Length transfer bit 0 */ + /* 00=1,01=2,10=4,11=8 */ +#define B_FC2 0x20 /* Function code bit 1 user defined */ +#define B_FC1 0x10 /* Function code bit 0 user defined */ +#define B_PD 0x08 /* Program data access */ +#define B_FAM 0x04 /* Fixed Address mode */ +#define B_U0TT0 0x02 /* user programmable transfer type */ +#define B_MAN 0x01 /* Manual start mode ,when set disable */ + /* autostart script when writting in DSP */ +/* DCTNL */ +#define B_CF1 0x80 /* Prescale bit 1 for scsi core */ +#define B_CF0 0x40 /* Prescale bit 0 for scsi core */ + /* involve all timing on scsi */ +#define B_EA 0x20 /* Enable ack (host/chip) */ +#define B_SSM 0x10 /* Enable single step mode */ +#define B_LLM 0x08 /* Enable Low level mode */ +#define B_STD 0x04 /* Start Dma operation used with B_MAN in */ + /* DMODE Register and single step mode */ +#define B_FA 0x02 /* Enable fast arbitration on host port */ +#define B_COM 0x01 /* When 0, enable compatible mode with ncr700 */ + +/* CTEST4 */ +#define B_MUX 0x80 /* Host mux bus mode */ +#define B_ZMOD 0x40 /* Host bus high impedance mode */ +#define B_SZM 0x20 /* Scsi bus high impedance mode */ +#define B_SLBE 0x10 /* Enable loopback mode */ +#define B_SFWR 0x08 /* Scsi fifo write enable */ +#define B_FBL2 0x04 /* Enable bytes lane */ +#define B_FLB1 0x02 /* Bit one mux byte lane */ +#define B_FLB0 0x01 /* Bit zero mux byte lane */ + +/* CTEST5 */ +#define B_ADCK 0x80 /* Increment DNAD register */ +#define B_BBCK 0x40 /* Decrement DBC register */ +#define B_ROFF 0x20 /* Clear offset in scsi sync mode */ +#define B_MASR 0x10 /* set/reset values for bit 3:0 */ +#define B_DDIR 0x08 /* control internel DMAWR (scsi to host) */ +#define B_EOP 0x04 /* control internal EOP (DMA/SCSI) */ +#define B_DREQ 0x02 /* control internal DREQ */ +#define B_DACK 0x01 /* control internal DACK (DMA/SCSI) */ + +/* CTEST7 */ +#define B_CDIS 0x80 /* Disable Burst Cache */ +#define B_SC1 0x40 /* Snoop control bit1 */ +#define B_SC0 0x20 /* Snoop control bit0 */ +#define B_TOUT 0x10 /* disable scsi timout */ +#define B_DFP 0x08 /* Fifo parity bit */ +#define B_EVP 0x04 /* enable even parity on host/fifo */ +#define B_TT1 0x02 /* invert tt1 pin (sync host mode only) */ +#define B_DIFF 0x01 /* Valid differential scsi bus */ + +/* CTEST8 */ +#define B_V3 0x80 /* Chip Revision Bit 3 */ +#define B_V2 0x40 /* Chip Revision Bit 2 */ +#define B_V1 0x20 /* Chip Revision Bit 1 */ +#define B_V0 0x10 /* Chip Revision Bit 0 */ +#define B_FLF 0x08 /* Flush DMA FIFO */ +#define B_CLF 0x04 /* Clear DMA FIFO */ +#define B_FM 0x02 /* Fetch Pin mode */ +#define B_SM 0x01 /* Snoop pins mode */ + +/* offset registers */ + +#if _BYTE_ORDER==_BIG_ENDIAN + +#define OFF_SIEN (0X00) /* scsi interrupt enable reg */ +#define OFF_SDID (0X01) /* scsi destination ID reg */ +#define OFF_SCNTL1 (0X02) /* scsi control reg 1 */ +#define OFF_SCNTL0 (0X03) /* scsi control reg 0 */ +#define OFF_SOCL (0X04) /* scsi output control latch reg */ +#define OFF_SODL (0X05) /* scsi output data latch reg */ +#define OFF_SXFER (0X06) /* scsi transfer reg */ +#define OFF_SCID (0X07) /* scsi chip ID reg */ +#define OFF_SBCL (0X08) /* scsi bus control lines reg */ +#define OFF_SBDL (0X09) /* scsi bus data lines reg */ +#define OFF_SIDL (0X0A) /* scsi input data latch reg */ +#define OFF_SFBR (0X0B) /* scsi first byte received reg */ +#define OFF_SSTAT2 (0X0C) /* scsi status reg 2 */ +#define OFF_SSTAT1 (0X0D) /* scsi status reg 1 */ +#define OFF_SSTAT0 (0X0E) /* scsi status reg 0 */ +#define OFF_DSTAT (0X0F) /* dma status reg */ +#define OFF_DSA (0X10) /* data structure address */ +#define OFF_CTEST3 (0X14) /* chip test reg 3 */ +#define OFF_CTEST2 (0X15) /* chip test reg 2 */ +#define OFF_CTEST1 (0X16) /* chip test reg 1 */ +#define OFF_CTEST0 (0X17) /* chip test reg 0 */ +#define OFF_CTEST7 (0X18) /* chip test reg 7 */ +#define OFF_CTEST6 (0X19) /* chip test reg 6 */ +#define OFF_CTEST5 (0X1A) /* chip test reg 5 */ +#define OFF_CTEST4 (0X1B) /* chip test reg 4 */ +#define OFF_TEMP (0X1C) /* Temporary stack reg */ +#define OFF_LCRC (0X20) /* CRC register */ +#define OFF_CTEST8 (0X21) /* Chip test reg 8 */ +#define OFF_ISTAT (0X22) /* Interrupt status reg */ +#define OFF_DFIFO (0X23) /* DMA FIFO reg */ +#define OFF_DCMD (0X24) /* 8 bit reg DMA command reg */ +#define OFF_DBC (0X24) /* 24 bit Reg DMA byte counter register */ +#define OFF_DNAD (0X28) /* DMA next address for data reg */ +#define OFF_DSP (0X2C) /* DMA scripts pointer reg */ +#define OFF_DSPS (0X30) /* DMA scripts pointer save reg */ +#define OFF_SCRATCH3 (0X34) /* scratch register */ +#define OFF_SCRATCH2 (0X35) /* scratch register */ +#define OFF_SCRATCH1 (0X36) /* scratch register */ +#define OFF_SCRATCH0 (0X37) /* scratch register */ +#define OFF_DCNTL (0X38) /* DMA control reg */ +#define OFF_DWT (0X39) /* DMA watchdog timer */ +#define OFF_DIEN (0X3A) /* DMA interrupt enable reg */ +#define OFF_DMODE (0X3B) /* DMA mode reg */ +#define OFF_ADDER (0X3C) /* internal adder register;don't use */ + +#else /* _BYTE_ORDER==_BIG_ENDIAN */ + +#define OFF_SIEN (0X03) /* scsi interrupt enable reg */ +#define OFF_SDID (0X02) /* scsi destination ID reg */ +#define OFF_SCNTL1 (0X01) /* scsi control reg 1 */ +#define OFF_SCNTL0 (0X00) /* scsi control reg 0 */ +#define OFF_SOCL (0X07) /* scsi output control latch reg */ +#define OFF_SODL (0X06) /* scsi output data latch reg */ +#define OFF_SXFER (0X05) /* scsi transfer reg */ +#define OFF_SCID (0X04) /* scsi chip ID reg */ +#define OFF_SBCL (0X0B) /* scsi bus control lines reg */ +#define OFF_SBDL (0X0A) /* scsi bus data lines reg */ +#define OFF_SIDL (0X09) /* scsi input data latch reg */ +#define OFF_SFBR (0X08) /* scsi first byte received reg */ +#define OFF_SSTAT2 (0X0F) /* scsi status reg 2 */ +#define OFF_SSTAT1 (0X0E) /* scsi status reg 1 */ +#define OFF_SSTAT0 (0X0D) /* scsi status reg 0 */ +#define OFF_DSTAT (0X0C) /* dma status reg */ +#define OFF_DSA (0X10) /* data structure address */ +#define OFF_CTEST3 (0X17) /* chip test reg 3 */ +#define OFF_CTEST2 (0X16) /* chip test reg 2 */ +#define OFF_CTEST1 (0X15) /* chip test reg 1 */ +#define OFF_CTEST0 (0X14) /* chip test reg 0 */ +#define OFF_CTEST7 (0X1B) /* chip test reg 7 */ +#define OFF_CTEST6 (0X1A) /* chip test reg 6 */ +#define OFF_CTEST5 (0X19) /* chip test reg 5 */ +#define OFF_CTEST4 (0X18) /* chip test reg 4 */ +#define OFF_TEMP (0X1C) /* Temporary stack reg */ +#define OFF_LCRC (0X23) /* CRC register */ +#define OFF_CTEST8 (0X22) /* Chip test reg 8 */ +#define OFF_ISTAT (0X21) /* Interrupt status reg */ +#define OFF_DFIFO (0X20) /* DMA FIFO reg */ +#define OFF_DCMD (0X27) /* 8 bit reg DMA command reg */ +#define OFF_DBC (0X24) /* 24 bit Reg DMA byte counter register */ +#define OFF_DNAD (0X28) /* DMA next address for data reg */ +#define OFF_DSP (0X2C) /* DMA scripts pointer reg */ +#define OFF_DSPS (0X30) /* DMA scripts pointer save reg */ +#define OFF_SCRATCH3 (0X37) /* scratch register */ +#define OFF_SCRATCH2 (0X36) /* scratch register */ +#define OFF_SCRATCH1 (0X35) /* scratch register */ +#define OFF_SCRATCH0 (0X36) /* scratch register */ +#define OFF_DCNTL (0X3B) /* DMA control reg */ +#define OFF_DWT (0X3A) /* DMA watchdog timer */ +#define OFF_DIEN (0X39) /* DMA interrupt enable reg */ +#define OFF_DMODE (0X38) /* DMA mode reg */ +#define OFF_ADDER (0X3C) /* internal adder register;don't use */ + +#endif /* _BYTE_ORDER==_BIG_ENDIAN */ + +/* Mask Values */ +#define NCR710_COUNT_MASK ((UINT)0x00ffffff) /* Mask 24 bit value in block */ + /* move description */ +#define INIT_BUS_ID ((UINT)0x00010000) /* initial value for scsi id */ + +/* DMA Fifo register */ +#define NCR710_MAXDMA_BYTE /* fifo deep in bytes 64 */ +#define NCR710_MAXDMA_LONG /* fifo deep in long 16 */ + +/* Sync offset */ +#define NCR710_MAXSYNC_OFF 0x08 /* Maximum sync offset */ +#define NCR710_MAX_XFERP 0x08 /* Maximum sxfer value for TP2-0 */ + +/* Clock conversion factor */ +/* prescale factor for scsi core (dctnl) */ +#define NCR710_16MHZ_DIV 0x80 /* 16-25Mhz chip */ +#define NCR710_25MHZ_DIV 0x40 /* 25-37.5Mhz chip */ +#define NCR710_50MHZ_DIV 0x00 /* 37.5-50Mhz chip */ +#define NCR710_66MHZ_DIV 0xC0 /* 50-66Mhz chip */ + +/* ns x 100 clock period */ +#define NCR710_1667MHZ 5998 /* 16.67Mhz chip */ +#define NCR710_20MHZ 5000 /* 20Mhz chip */ +#define NCR710_25MHZ 4000 /* 25Mhz chip */ +#define NCR710_3750MHZ 2666 /* 37.50Mhz chip */ +#define NCR710_40MHZ 2500 /* 40Mhz chip */ +#define NCR710_50MHZ 2000 /* 50Mhz chip */ +#define NCR710_66MHZ 1515 /* 66Mhz chip */ +#define NCR710_6666MHZ 1500 /* 66Mhz chip */ + +/* Chip Type */ +#define NCR700_TYPE 0x700 /* not Supported */ +#define NCR710_TYPE 0x710 /* supported */ +#define NCR720_TYPE 0x720 /* not supported */ + +/* Macros to acces to ncrShareCtl */ +#define SCRIPTADDR( pSiop,index ) ( pSiop->pNcrCtl->scriptPtr[index]) + +/* Default value to initialize some registers involve + * in the hardware implementation.Those values could be + * overwritten by a bsp call with the ncr710HwSetRegister(). + * The ncr710 Data Manual documentation will you give all + * the light regarding values choose. See also the + * documentation of ncr710SetHwRegister call. + * See below the NCR710_HW_REGS for the meaning of the + * values prefill. + */ +#define DEFAULT_710_HW_REGS { 0,0,0,0,1,0,0,0,0,0,0,0,0,1,0 } + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT NCR_710_SCSI_CTRL * ncr710CtrlCreate (UINT8 *siopBaseAdrs, + UINT clkPeriod); +IMPORT STATUS ncr710CtrlInit (NCR_710_SCSI_CTRL *pSiop, int scsiCtrlBusId, + int scsiPriority); +IMPORT STATUS ncr710Show (SCSI_CTRL *pScsiCtrl); +IMPORT STATUS ncr710SetHwRegister(NCR_710_SCSI_CTRL *pScsiCtrl, + NCR710_HW_REGS *pHwRegs); +IMPORT void ncr710Intr (NCR_710_SCSI_CTRL *pSiop); + +#else /* __STDC__ */ + +IMPORT NCR_710_SCSI_CTRL * ncr710CtrlCreate (); +IMPORT STATUS ncr710CtrlInit (); +IMPORT STATUS ncr710SetHwRegister (); +IMPORT STATUS ncr710Show (); +IMPORT void ncr710Intr (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ +#ifdef __cplusplus +} +#endif + +#endif /* __INCncr710_1h */ diff --git a/h/drv/scsi/ncr710_2.h b/h/drv/scsi/ncr710_2.h new file mode 100644 index 0000000..dd3ecf9 --- /dev/null +++ b/h/drv/scsi/ncr710_2.h @@ -0,0 +1,570 @@ +/* ncr710.h - NCR 710 Script SCSI Controller header file */ + +/* Copyright 1984-1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +04d,03dec98,ihw Added identMsg{Buf,Length} in NCR710_SCSI_CTRL, to + support concatenated IDENTIFY/{SYNC,WIDE} messages. (SPR 24089) +04c,28apr95,jds modified to fit it in WRS tree +04b,27may94,ihw documented prior to release +04a,02may94,ihw major modifications to work with new SCSI architecture + supports tagged commands +03a,18feb94,ihw modified for enhanced SCSI library: multiple initiators, + disconnect/reconnect and synchronous transfer supported +02l,26sep92,ccc ncr710Show() returns STATUS. +02k,22sep92,rrr added support for c++ +02j,26jul92,rrr removed decl ncr710SyncMsgConvert, was made LOCAL in mod 02i +02i,21jul92,eve clean an move debug macros to ncr710Lib.c. +01h,03jul92,eve merge header with new driver. +01g,29jun92,ccc fixed compile errors. +01f,26jun92,ccc changed ASMLANGUAGE to _ASMLANGUAGE. +40c,26may92,rrr the tree shuffle +40b,28apr92,wmd Added defines for LITTLE_ENDIAN architectures, and fixed + typo for declaration of ncr710CtrlCreate(), ansified. +40a,12nov91,ccc SPECIAL VERSION FOR 5.0.2 68040 RELEASE. +02a,26oct91,eve Add description of hardware dependant + registers. +01a,23oct91,eve Created driver header +*/ + +#ifndef __INCncr710_2h +#define __INCncr710_2h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "semLib.h" +#include "scsiLib.h" + + +/* PRIVATE */ + +typedef struct ncr710Thread /* NCR710_THREAD */ + { + SCSI_THREAD scsiThread; /* generic SCSI thread structure */ + struct ncr710Shared * pShMem; /* ptr to SIOP shared data area */ + + /* + * The following is a partial context of the SIOP registers which is + * maintained independently for each thread. It is saved and + * restored by the host when scripts are started and completed. + * + * See "ncr710Script.h" for aliases for the scratch registers ... + */ + UINT8 scratch0; /* image of scratch 0 register */ + UINT8 scratch1; /* image of scratch 1 register */ + UINT8 scratch2; /* image of scratch 2 register */ + UINT8 scratch3; /* image of scratch 3 register */ + + UINT8 sxfer; /* image of sxfer register */ + UINT8 sbcl; /* image of sbcl register */ + } NCR710_THREAD; + + +typedef struct ncr710Event /* NCR710_EVENT */ + { + SCSI_EVENT scsiEvent; /* generic SCSI event */ + UINT remCount; /* remaining byte count (mismatch) */ + } NCR710_EVENT; + +/* + * Script entry point identifiers (see "ncr710StartScript()" if changed) + */ +typedef enum ncr710ScriptEntry + { + NCR710_SCRIPT_WAIT = 0, /* wait for re-select or host cmd */ + NCR710_SCRIPT_INIT_START = 1, /* start an initiator thread */ + NCR710_SCRIPT_INIT_CONTINUE = 2, /* continue an initiator thread */ + NCR710_SCRIPT_TGT_DISCONNECT = 3 /* disconnect a target thread */ + } NCR710_SCRIPT_ENTRY; + + +/* SIOP state enumeration */ + +typedef enum ncr710State + { + NCR710_STATE_IDLE = 0, /* not running any script */ + NCR710_STATE_PASSIVE, /* waiting for reselect or host cmd */ + NCR710_STATE_ACTIVE /* running a client script */ + } NCR710_STATE; + + +/* + * Structure used in the ncr710SetHwRegister() and ncr710GetHwRegister(). + * This is used to try to handle the possible different hardware + * implementations of the chip. This structure must contain the logical + * value one wishes e.g 0 sets register bit to zero and 1 sets to one. + */ +typedef struct + { + int ctest4Bit7; /* Host bus multiplex mode */ + int ctest7Bit7; /* Disable/enable burst cache capability */ + int ctest7Bit6; /* Snoop control bit1 */ + int ctest7Bit5; /* Snoop control bit0 */ + int ctest7Bit1; /* invert tt1 pin (sync bus host mode only) */ + int ctest7Bit0; /* enable differential scsi bus capability */ + int ctest8Bit0; /* Set snoop pins mode */ + int dmodeBit7; /* Burst Length transfer bit 1 */ + int dmodeBit6; /* Burst Length transfer bit 0 */ + int dmodeBit5; /* Function code bit FC2 */ + int dmodeBit4; /* Function code bit FC1 */ + int dmodeBit3; /* Program data bit ( FC0) */ + int dmodeBit1; /* user programmable transfer type */ + int dcntlBit5; /* Enable Ack pin */ + int dcntlBit1; /* Enable fast arbitration on host port */ + } NCR710_HW_REGS; + + +/* + * SCSI controller structure + * + * NOTE: the whole of this structure must be located in memory which is + * guaranteed to be cache-coherent for DMA, as some fields are shared + * with the SCSI controller (esp. msg in/out buffers). + * + * NOTE: some fields in this structure control hardware features which are + * not supported by the current software. + */ +typedef struct /* NCR_710_SCSI_CTRL - NCR710 */ + /* SCSI controller info */ + { + SCSI_CTRL scsiCtrl; /* generic SCSI controller info */ + SEM_ID singleStepSem; /* use to debug script in single step mode */ + + /* Hardware implementation dependencies */ + BOOL slowCableMode; /* TRUE to select slow cable mode */ + int chipType; /* Device type NCR7X0_TYPE */ + /* Only 710 Supported today */ + int devType; /* type of device (see define's below) */ + BOOL resetReportDsbl; /* TRUE to disable SCSI bus reset reporting */ + BOOL parityTestMode; /* TRUE enable parity test mode */ + BOOL parityCheckEnbl; /* TRUE to enable parity checking */ + UINT clkPeriod; /* period of controller clock (nsec x 100) */ + UINT asyncClkPeriod; /* period of SCSI async clock (nsec x 100) */ + NCR710_HW_REGS hwRegs; /* values used for hardware dependent regs */ + + NCR710_STATE state; /* current state of controller */ + /* shared data areas for */ + /* identification & client threads */ + struct ncr710Shared *pIdentShMem; + struct ncr710Shared *pClientShMem; + + NCR710_THREAD *pHwThread; /* thread corresp. to current script run */ + NCR710_THREAD *pNewThread; /* thread to be activated by ISR (if any) */ + BOOL cmdPending; /* TRUE => task wants to start new command */ + BOOL singleStep; /* TRUE => SIOP is in single-step mode */ + + UINT8 identMsg[SCSI_MAX_IDENT_MSG_LENGTH + 5]; /* 5 for wide/sync */ UINT identMsgLength; + + volatile UINT8 *pSien; /* SIEN SCSI interrupt enable reg */ + volatile UINT8 *pSdid; /* SDID SCSI destination ID register */ + volatile UINT8 *pScntl1; /* SCTNL1 SCSI control register 1 */ + volatile UINT8 *pScntl0; /* SCTNL0 SCSI control register 0 */ + volatile UINT8 *pSocl; /* SOCL SCSI output control latch reg */ + volatile UINT8 *pSodl; /* SCSI output data latch reg */ + volatile UINT8 *pSxfer; /* SODL SCSI transfer register */ + volatile UINT8 *pScid; /* SCID SCSI chip ID register */ + volatile UINT8 *pSbcl; /* SBCL SCSI bus control lines reg */ + volatile UINT8 *pSbdl; /* SBDL SCSI bus data lines register */ + volatile UINT8 *pSidl; /* SIDL SCSI input data latch reg */ + volatile UINT8 *pSfbr; /* SFBR SCSI first byte received reg */ + volatile UINT8 *pSstat2; /* SSTAT2 SCSI status register 2 */ + volatile UINT8 *pSstat1; /* SSTAT1 SCSI status register 1 */ + volatile UINT8 *pSstat0; /* SSTAT0 SCSI status register 0 */ + volatile UINT8 *pDstat; /* DSTAT DMA status register */ + volatile UINT *pDsa; /* DSA data structure address */ + volatile UINT8 *pCtest3; /* CTEST3 chip test register 3 */ + volatile UINT8 *pCtest2; /* CTEST2 chip test register 2 */ + volatile UINT8 *pCtest1; /* CTEST1 chip test register 1 */ + volatile UINT8 *pCtest0; /* CTEST0 chip test register 0 */ + volatile UINT8 *pCtest7; /* CTEST7 chip test register 7 */ + volatile UINT8 *pCtest6; /* CTEST6 chip test register 6 */ + volatile UINT8 *pCtest5; /* CTEST5 chip test register 5 */ + volatile UINT8 *pCtest4; /* CTEST4 chip test register 4 */ + volatile UINT *pTemp; /* TEMP temporary holding register */ + volatile UINT8 *pLcrc; /* LCRC longitudinal parity register */ + volatile UINT8 *pCtest8; /* CTEST8 chip test register */ + volatile UINT8 *pIstat; /* ISTAT interrupt status register */ + volatile UINT8 *pDfifo; /* DFIFO DMA FIFO control register */ + volatile UINT8 *pDcmd; /* DBC SIOP command register 8bits */ + volatile UINT *pDbc; /* DCMD SIOP command reg (24Bits Reg) */ + volatile UINT *pDnad; /* DNAD DMA buffer ptr (next address) */ + volatile UINT *pDsp; /* DSP SIOP scripts pointer register */ + volatile UINT *pDsps; /* DSPS SIOP scripts ptr save reg */ + volatile UINT8 *pScratch3; /* SCRATCH3 general purpose scratch reg */ + volatile UINT8 *pScratch2; /* SCRATCH2 general purpose scratch reg */ + volatile UINT8 *pScratch1; /* SCRATCH1 general purpose scratch reg */ + volatile UINT8 *pScratch0; /* SCRATCH0 general purpose scratch reg */ + volatile UINT8 *pDcntl; /* DCTNL DMA control register */ + volatile UINT8 *pDwt; /* DWT DMA watchdog timer register */ + volatile UINT8 *pDien; /* DIEN DMA interrupt enable */ + volatile UINT8 *pDmode; /* DMODE DMA operation mode register */ + volatile UINT *pAdder; /* ADDER Adder output Register */ + + } NCR_710_SCSI_CTRL; + +/* END PRIVATE */ + + +/* Bit Registers definitions for ncr710 */ + +/* SCNTL0 */ +#define B_ARB1 0x80 /* Arbitration bit 1 */ +#define B_ARB0 0x40 /* Arbitration bit 0 */ + /* 00 Simple/11 full */ +#define B_START 0x20 /* Start sequence */ +#define B_WATN 0x10 /* Select w/wo atn */ +#define B_EPC 0x08 /* Parity checking */ +#define B_EPG 0x04 /* Enable parity generation */ +#define B_AAP 0x02 /* Assert ATN on parity error */ +#define B_TRG 0x01 /* Target/initiator mode */ + +/* SCNTL1 */ +#define B_EXC 0x80 /* Extra Data Set up */ +#define B_ADB 0x40 /* Assert Data (SODL) onto scsi */ +#define B_ESR 0x20 /* Enable Select & reselect */ +#define B_CON 0x10 /* connected bit status */ +#define B_RST 0x08 /* Assert Rst on scsi */ +#define B_AESP 0x04 /* Assert even parity -force error */ +#define B_SND 0x02 /* Start send scsi operation */ +#define B_RCV 0x01 /* Start receive scsi operation */ + +/* SIEN (enable int)and SSTAT0 (RO Status) */ +/* Enable interrupt */ +#define B_MA 0x80 /* Enable phase mismatch/Atn Active */ +#define B_FCMP 0x40 /* Enable funtion complete */ +#define B_STO 0x20 /* Enable scsi timout */ +#define B_SEL 0x10 /* Enable sel/resel */ +#define B_SGE 0x08 /* Enable scsi gross error */ +#define B_UDC 0x04 /* Enable unexpected disconnect */ +#define B_RSTE 0x02 /* Enable Rst received */ +#define B_PAR 0x01 /* Enable parity int */ + +/* SXFER */ +#define B_DHP 0x80 /* Disable Halt on parity err */ +#define B_TP2 0x40 /* Synchronous transfer period 2 */ +#define B_TP1 0x20 /* Synchronous transfer period 1 */ +#define B_TP0 0x10 /* Synchronous transfer period 0 */ +#define B_MO3 0x08 /* Maximun scsi Synchronous transfer offset */ +#define B_MO2 0x04 /* Maximun scsi Synchronous transfer offset */ +#define B_MO1 0x02 /* Maximun scsi Synchronous transfer offset */ +#define B_MO0 0x01 /* Maximun scsi Synchronous transfer offset */ + +/* SOCL (RW) and SBCL (RO not latched) */ +#define B_REQ 0x80 /* Assert scsi req */ +#define B_ACK 0x40 /* Assert scsi ack */ +#define B_BSY 0x20 /* Assert scsi busy */ +#define B_SEL 0x10 /* Assert scsi sel */ +#define B_ATN 0x08 /* Assert scsi atn */ +#define B_MSG 0x04 /* Assert scsi msg */ +#define B_CD 0x02 /* Assert scsi c/d */ +#define B_IO 0x01 /* Assert scsi i/o */ +/* SSCF (Write only same @ as SBCL) */ +#define B_SSCF1 0x02 /* prescale clock for scsi core bit 1 */ +#define B_SSCF0 0x01 /* prescale clock for scsi core bit 0 */ + +/* DSTAT (RO) and DIEN (RW enable intr) */ +#define B_DFE 0x80 /* stat :Dma fifo empty */ +#define B_BF 0x20 /* stat :Bus access error */ +#define B_ABT 0x10 /* stat :Abort condition */ +#define B_SSI 0x08 /* stat :Scsi step interrupt */ +#define B_SIR 0x04 /* stat :Script interrupt received */ +#define B_WTD 0x02 /* stat :Watchdog timout */ +#define B_IID 0x01 /* stat :Illegal instruction occur */ + +/* SSTAT1 RO register */ +#define B_ILF 0x80 /* stat :SDIL register contain scsi data */ + /* in async mode only */ +#define B_ORF 0x40 /* stat :SODR output data in sync mode hidden */ +#define B_OLF 0x20 /* stat :SODL Register full (hidden) */ +#define B_AIP 0x10 /* stat :Arbitration in progress */ +#define B_LOA 0x08 /* stat :Lost arbitration */ +#define B_WOA 0x04 /* stat :won arbitration-full arbit mode */ +#define B_RSTNL 0x02 /* stat :current stat of RST line-Not Latched */ +#define B_PARNL 0x01 /* stat :curr stat Parity lines-Not Latched */ + +/* SSTAT2 RO register */ +#define B_FF3 0x80 /* Fifo flag 3 :number of bytes in fifo */ +#define B_FF2 0x40 /* Fifo flag 2 :number of bytes in fifo */ +#define B_FF1 0x20 /* Fifo flag 1 :number of bytes in fifo */ +#define B_FF0 0x10 /* Fifo flag 0 :number of bytes in fifo */ + /* 0000=0 ..... 1000=8 */ +#define B_SPDL 0x08 /* Latched parity line */ +#define B_MSGL 0x04 /* Latched state of MSG line */ +#define B_CDL 0x02 /* Latched state of C/D line */ +#define B_IOL 0x01 /* Latched sate of IO line */ + +/* DFIFO RW register */ +#define B_BO6 0x40 /* Byte offset counter 6 */ +#define B_BO5 0x20 /* Byte offset counter 5 */ +#define B_BO4 0x10 /* Byte offset counter 4 */ +#define B_BO3 0x08 /* Byte offset counter 3 */ +#define B_BO2 0x04 /* Byte offset counter 2 */ +#define B_BO1 0x02 /* Byte offset counter 1 */ +#define B_BO0 0x01 /* Byte offset counter 0 */ + +/* ISTAT RW register */ +#define B_ABORT 0x80 /* Abort operation */ +#define B_SOFTRST 0x40 /* Soft chip reset */ +#define B_SIGP 0x20 /* signal process */ +#define B_CONST 0x08 /* stat connected (reset doesn't disconnect) */ +#define B_SIP 0x02 /* Status scsi interrupt pending */ +#define B_DIP 0x01 /* Status Dma portion interrupt pending */ + +/* DMODE RW register */ +#define B_BL1 0x80 /* Burst Length transfer bit 1 */ +#define B_BL0 0x40 /* Burst Length transfer bit 0 */ + /* 00=1,01=2,10=4,11=8 */ +#define B_FC2 0x20 /* Function code bit 1 user defined */ +#define B_FC1 0x10 /* Function code bit 0 user defined */ +#define B_PD 0x08 /* Program data access */ +#define B_FAM 0x04 /* Fixed Address mode */ +#define B_U0TT0 0x02 /* user programmable transfer type */ +#define B_MAN 0x01 /* Manual start mode ,when set disable */ + /* autostart script when writting in DSP */ +/* DCTNL */ +#define B_CF1 0x80 /* Prescale bit 1 for scsi core */ +#define B_CF0 0x40 /* Prescale bit 0 for scsi core */ + /* involve all timing on scsi */ +#define B_EA 0x20 /* Enable ack (host/chip) */ +#define B_SSM 0x10 /* Enable single step mode */ +#define B_LLM 0x08 /* Enable Low level mode */ +#define B_STD 0x04 /* Start Dma operation used with B_MAN in */ + /* DMODE Register and single step mode */ +#define B_FA 0x02 /* Enable fast arbitration on host port */ +#define B_COM 0x01 /* When 0, enable compatible mode with ncr700 */ + +/* CTEST0 */ +#define B_EAN 0x10 /* Enable active negation */ + +/* CTEST4 */ +#define B_MUX 0x80 /* Host mux bus mode */ +#define B_ZMOD 0x40 /* Host bus high impedance mode */ +#define B_SZM 0x20 /* Scsi bus high impedance mode */ +#define B_SLBE 0x10 /* Enable loopback mode */ +#define B_SFWR 0x08 /* Scsi fifo write enable */ +#define B_FBL2 0x04 /* Enable bytes lane */ +#define B_FLB1 0x02 /* Bit one mux byte lane */ +#define B_FLB0 0x01 /* Bit zero mux byte lane */ + +/* CTEST5 */ +#define B_ADCK 0x80 /* Increment DNAD register */ +#define B_BBCK 0x40 /* Decrement DBC register */ +#define B_ROFF 0x20 /* Clear offset in scsi sync mode */ +#define B_MASR 0x10 /* set/reset values for bit 3:0 */ +#define B_DDIR 0x08 /* control internel DMAWR (scsi to host) */ +#define B_EOP 0x04 /* control internal EOP (DMA/SCSI) */ +#define B_DREQ 0x02 /* control internal DREQ */ +#define B_DACK 0x01 /* control internal DACK (DMA/SCSI) */ + +/* CTEST7 */ +#define B_CDIS 0x80 /* Disable Burst Cache */ +#define B_SC1 0x40 /* Snoop control bit1 */ +#define B_SC0 0x20 /* Snoop control bit0 */ +#define B_TOUT 0x10 /* disable scsi timout */ +#define B_DFP 0x08 /* Fifo parity bit */ +#define B_EVP 0x04 /* enable even parity on host/fifo */ +#define B_TT1 0x02 /* invert tt1 pin (sync host mode only) */ +#define B_DIFF 0x01 /* Valid differential scsi bus */ + +/* CTEST8 */ +#define B_V3 0x80 /* Chip Revision Bit 3 */ +#define B_V2 0x40 /* Chip Revision Bit 2 */ +#define B_V1 0x20 /* Chip Revision Bit 1 */ +#define B_V0 0x10 /* Chip Revision Bit 0 */ +#define B_FLF 0x08 /* Flush DMA FIFO */ +#define B_CLF 0x04 /* Clear DMA FIFO */ +#define B_FM 0x02 /* Fetch Pin mode */ +#define B_SM 0x01 /* Snoop pins mode */ + +/* offset registers */ + +#if _BYTE_ORDER==_BIG_ENDIAN + +#define OFF_SIEN (0X00) /* scsi interrupt enable reg */ +#define OFF_SDID (0X01) /* scsi destination ID reg */ +#define OFF_SCNTL1 (0X02) /* scsi control reg 1 */ +#define OFF_SCNTL0 (0X03) /* scsi control reg 0 */ +#define OFF_SOCL (0X04) /* scsi output control latch reg */ +#define OFF_SODL (0X05) /* scsi output data latch reg */ +#define OFF_SXFER (0X06) /* scsi transfer reg */ +#define OFF_SCID (0X07) /* scsi chip ID reg */ +#define OFF_SBCL (0X08) /* scsi bus control lines reg */ +#define OFF_SBDL (0X09) /* scsi bus data lines reg */ +#define OFF_SIDL (0X0A) /* scsi input data latch reg */ +#define OFF_SFBR (0X0B) /* scsi first byte received reg */ +#define OFF_SSTAT2 (0X0C) /* scsi status reg 2 */ +#define OFF_SSTAT1 (0X0D) /* scsi status reg 1 */ +#define OFF_SSTAT0 (0X0E) /* scsi status reg 0 */ +#define OFF_DSTAT (0X0F) /* dma status reg */ +#define OFF_DSA (0X10) /* data structure address */ +#define OFF_CTEST3 (0X14) /* chip test reg 3 */ +#define OFF_CTEST2 (0X15) /* chip test reg 2 */ +#define OFF_CTEST1 (0X16) /* chip test reg 1 */ +#define OFF_CTEST0 (0X17) /* chip test reg 0 */ +#define OFF_CTEST7 (0X18) /* chip test reg 7 */ +#define OFF_CTEST6 (0X19) /* chip test reg 6 */ +#define OFF_CTEST5 (0X1A) /* chip test reg 5 */ +#define OFF_CTEST4 (0X1B) /* chip test reg 4 */ +#define OFF_TEMP (0X1C) /* Temporary stack reg */ +#define OFF_LCRC (0X20) /* CRC register */ +#define OFF_CTEST8 (0X21) /* Chip test reg 8 */ +#define OFF_ISTAT (0X22) /* Interrupt status reg */ +#define OFF_DFIFO (0X23) /* DMA FIFO reg */ +#define OFF_DCMD (0X24) /* 8 bit reg DMA command reg */ +#define OFF_DBC (0X24) /* 24 bit Reg DMA byte counter register */ +#define OFF_DNAD (0X28) /* DMA next address for data reg */ +#define OFF_DSP (0X2C) /* DMA scripts pointer reg */ +#define OFF_DSPS (0X30) /* DMA scripts pointer save reg */ +#define OFF_SCRATCH3 (0X34) /* scratch register */ +#define OFF_SCRATCH2 (0X35) /* scratch register */ +#define OFF_SCRATCH1 (0X36) /* scratch register */ +#define OFF_SCRATCH0 (0X37) /* scratch register */ +#define OFF_DCNTL (0X38) /* DMA control reg */ +#define OFF_DWT (0X39) /* DMA watchdog timer */ +#define OFF_DIEN (0X3A) /* DMA interrupt enable reg */ +#define OFF_DMODE (0X3B) /* DMA mode reg */ +#define OFF_ADDER (0X3C) /* internal adder register;don't use */ + +#else /* _BYTE_ORDER==_BIG_ENDIAN */ + +#define OFF_SIEN (0X03) /* scsi interrupt enable reg */ +#define OFF_SDID (0X02) /* scsi destination ID reg */ +#define OFF_SCNTL1 (0X01) /* scsi control reg 1 */ +#define OFF_SCNTL0 (0X00) /* scsi control reg 0 */ +#define OFF_SOCL (0X07) /* scsi output control latch reg */ +#define OFF_SODL (0X06) /* scsi output data latch reg */ +#define OFF_SXFER (0X05) /* scsi transfer reg */ +#define OFF_SCID (0X04) /* scsi chip ID reg */ +#define OFF_SBCL (0X0B) /* scsi bus control lines reg */ +#define OFF_SBDL (0X0A) /* scsi bus data lines reg */ +#define OFF_SIDL (0X09) /* scsi input data latch reg */ +#define OFF_SFBR (0X08) /* scsi first byte received reg */ +#define OFF_SSTAT2 (0X0F) /* scsi status reg 2 */ +#define OFF_SSTAT1 (0X0E) /* scsi status reg 1 */ +#define OFF_SSTAT0 (0X0D) /* scsi status reg 0 */ +#define OFF_DSTAT (0X0C) /* dma status reg */ +#define OFF_DSA (0X10) /* data structure address */ +#define OFF_CTEST3 (0X17) /* chip test reg 3 */ +#define OFF_CTEST2 (0X16) /* chip test reg 2 */ +#define OFF_CTEST1 (0X15) /* chip test reg 1 */ +#define OFF_CTEST0 (0X14) /* chip test reg 0 */ +#define OFF_CTEST7 (0X1B) /* chip test reg 7 */ +#define OFF_CTEST6 (0X1A) /* chip test reg 6 */ +#define OFF_CTEST5 (0X19) /* chip test reg 5 */ +#define OFF_CTEST4 (0X18) /* chip test reg 4 */ +#define OFF_TEMP (0X1C) /* Temporary stack reg */ +#define OFF_LCRC (0X23) /* CRC register */ +#define OFF_CTEST8 (0X22) /* Chip test reg 8 */ +#define OFF_ISTAT (0X21) /* Interrupt status reg */ +#define OFF_DFIFO (0X20) /* DMA FIFO reg */ +#define OFF_DCMD (0X27) /* 8 bit reg DMA command reg */ +#define OFF_DBC (0X24) /* 24 bit Reg DMA byte counter register */ +#define OFF_DNAD (0X28) /* DMA next address for data reg */ +#define OFF_DSP (0X2C) /* DMA scripts pointer reg */ +#define OFF_DSPS (0X30) /* DMA scripts pointer save reg */ +#define OFF_SCRATCH3 (0X37) /* scratch register */ +#define OFF_SCRATCH2 (0X36) /* scratch register */ +#define OFF_SCRATCH1 (0X35) /* scratch register */ +#define OFF_SCRATCH0 (0X36) /* scratch register */ +#define OFF_DCNTL (0X3B) /* DMA control reg */ +#define OFF_DWT (0X3A) /* DMA watchdog timer */ +#define OFF_DIEN (0X39) /* DMA interrupt enable reg */ +#define OFF_DMODE (0X38) /* DMA mode reg */ +#define OFF_ADDER (0X3C) /* internal adder register;don't use */ + +#endif /* _BYTE_ORDER==_BIG_ENDIAN */ + +/* Mask Values */ +#define NCR710_COUNT_MASK ((UINT)0x00ffffff) /* Mask 24 bit value in block */ + /* move description */ +/* Shift values for "device" field in shared data structure */ +#define NCR710_TARGET_BUS_ID_SHIFT 16 /* bits 23-16: specify target bus ID */ +#define NCR710_XFER_PARAMS_SHIFT 8 /* bits 15-08: copy of sxfer reg. */ + +/* Sync offset and period (SXFER register) */ +#define NCR710_MAX_REQ_ACK_OFFSET 7 /* Maximum sync offset */ +#define NCR710_MIN_XFER_PERIOD 0 /* Minimum sync period (clks) */ +#define NCR710_MAX_XFER_PERIOD 7 /* Maximum sync period (clks) */ + +#define NCR710_SYNC_XFER_PERIOD_SHIFT 4 + +#define NCR710_SYNC_XFER_PARAMS_ASYNC 0x00 + +/* Synchronous transfer clock division factor (SBCL register bits 1,0 (w-o) */ +#define NCR710_MIN_CLOCK_DIV 0x00 +#define NCR710_MAX_CLOCK_DIV 0x03 +#define NCR710_CLOCK_DIVIDE_ASYNC 0x00 + +/* Clock conversion factor */ +/* prescale factor for scsi core (dctnl) */ +#define NCR710_16MHZ_DIV 0x80 /* 16-25Mhz chip */ +#define NCR710_25MHZ_DIV 0x40 /* 25-37.5Mhz chip */ +#define NCR710_50MHZ_DIV 0x00 /* 37.5-50Mhz chip */ +#define NCR710_66MHZ_DIV 0xC0 /* 50-66Mhz chip */ + +/* ns x 100 clock period */ +#define NCR710_1667MHZ 6000 /* 16.67Mhz chip */ +#define NCR710_20MHZ 5000 /* 20Mhz chip */ +#define NCR710_25MHZ 4000 /* 25Mhz chip */ +#define NCR710_3750MHZ 2667 /* 37.50Mhz chip */ +#define NCR710_40MHZ 2500 /* 40Mhz chip */ +#define NCR710_50MHZ 2000 /* 50Mhz chip */ +#define NCR710_66MHZ 1515 /* 66Mhz chip */ +#define NCR710_6666MHZ 1500 /* 66Mhz chip */ + +/* Chip Type */ +#define NCR700_TYPE 0x700 /* not supported */ +#define NCR710_TYPE 0x710 /* supported */ +#define NCR720_TYPE 0x720 /* not supported */ + +/* Default value to initialize some registers involved + * in the hardware implementation.Those values could be + * overwritten by a bsp call with the ncr710HwSetRegister(). + * The ncr710 Data Manual documentation will you give all + * the light regarding values choose. See also the + * documentation of ncr710SetHwRegister call. + * See above the NCR710_HW_REGS for the meaning of the + * values prefill. + */ +#define DEFAULT_710_HW_REGS { 0,0,0,0,1,0,0,0,0,0,0,0,0,1,0 } + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT NCR_710_SCSI_CTRL * ncr710CtrlCreateScsi2 (UINT8 *siopBaseAdrs, + UINT clkPeriod); +IMPORT STATUS ncr710CtrlInitScsi2 (NCR_710_SCSI_CTRL *pSiop, + int scsiCtrlBusId, int scsiPriority); +IMPORT STATUS ncr710SetHwRegisterScsi2 (NCR_710_SCSI_CTRL *pScsiCtrl, + NCR710_HW_REGS *pHwRegs); +IMPORT void ncr710IntrScsi2 (NCR_710_SCSI_CTRL *pSiop); +IMPORT STATUS ncr710ShowScsi2 (SCSI_CTRL *pScsiCtrl); +IMPORT void ncr710StepEnable (NCR_710_SCSI_CTRL *pSiop, BOOL enable); +IMPORT void ncr710SingleStep (NCR_710_SCSI_CTRL *pSiop, BOOL verbose); + +#else /* __STDC__ */ + +IMPORT NCR_710_SCSI_CTRL * ncr710CtrlCreateScsi2 (); +IMPORT STATUS ncr710CtrlInitScsi2 (); +IMPORT STATUS ncr710SetHwRegisterScsi2 (); +IMPORT void ncr710IntrScsi2 (); +IMPORT STATUS ncr710ShowScsi2 (); +IMPORT void ncr710StepEnable (); +IMPORT void ncr710SingleStep (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ +#ifdef __cplusplus +} +#endif + +#endif /* __INCncr710_2h */ diff --git a/h/drv/scsi/ncr810.h b/h/drv/scsi/ncr810.h new file mode 100644 index 0000000..da8a038 --- /dev/null +++ b/h/drv/scsi/ncr810.h @@ -0,0 +1,833 @@ +/* ncr810.h - NCR 810 Script SCSI Controller header file */ + +/* Copyright 1984-1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,03dec98,ihw Added identMsg{Buf,Length} in NCR810_SCSI_CTRL, to + support concatenated IDENTIFY/{SYNC,WIDE} messages. (SRP 24089) +01f,25jun98,ldt Added definitions for Quadrupler, STEST4, scratch + registers c-j, 895 device id, 50,70,160 MHz speeds + added siopRamBaseAdrs, updated ncr810CtrlCreate (SPR 24089) +01e,23apr98,tm, Added SSTAT2, CTEST5_DFS definitions for SPR 8384 fix +01d,08may97,dat temp fix for SPR 8540 +01c,10mar97,dds SPR 7766: added changes for ncr875 SCSI adapter. +01b,21nov96,myz modified PCI_TO_MEM_OFFSET for i960jx +01a,26may95,jds Created ; adapted from ncr710.h +*/ + +#ifndef __INCncr810h +#define __INCncr810h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "semLib.h" +#include "scsiLib.h" + +/* PRIVATE */ + +typedef struct ncr810Thread /* NCR810_THREAD */ + { + SCSI_THREAD scsiThread; /* generic SCSI thread structure */ + struct ncr810Shared * pShMem; /* ptr to SIOP shared data area */ + + /* + * The following is a partial context of the SIOP registers which is + * maintained independently for each thread. It is saved and + * restored by the host when scripts are started and completed. + * + * See "ncr810Script.h" for aliases for the scratch registers ... + */ + + UINT8 scratcha0; /* image of scratch 0 register */ + UINT8 scratcha1; /* image of scratch 1 register */ + UINT8 scratcha2; /* image of scratch 2 register */ + UINT8 scratcha3; /* image of scratch 3 register */ + UINT8 sxfer; /* image of sxfer register */ + UINT8 scntl3; /* image of scntl3 for sync xfers */ + } NCR810_THREAD; + + +typedef struct ncr810Event /* NCR810_EVENT */ + { + SCSI_EVENT scsiEvent; /* generic SCSI event */ + UINT remCount; /* remaining byte count (mismatch) */ + } NCR810_EVENT; + +/* Script entry point identifiers (see "ncr810StartScript()" if changed) */ + +typedef enum ncr810ScriptEntry + { + NCR810_SCRIPT_WAIT = 0, /* wait for re-select or host cmd */ + NCR810_SCRIPT_INIT_START = 1, /* start an initiator thread */ + NCR810_SCRIPT_INIT_CONTINUE = 2, /* continue an initiator thread */ + NCR810_SCRIPT_TGT_DISCONNECT = 3 /* disconnect a target thread */ + } NCR810_SCRIPT_ENTRY; + + +/* SIOP state enumeration */ + +typedef enum ncr810State + { + NCR810_STATE_IDLE = 0, /* not running any script */ + NCR810_STATE_PASSIVE, /* waiting for reselect or host cmd */ + NCR810_STATE_ACTIVE /* running a client script */ + } NCR810_STATE; + + +/* + * Structure used in the ncr810SetHwRegister() and ncr810GetHwRegister(). + * This is used to try to handle the possible different hardware + * implementations of the chip. This structure must contain the logical + * value one wishes e.g 0 sets register bit to zero and 1 sets to one. + */ + +typedef struct + { + int stest1Bit7; /* Disable external SCSI clock */ + int stest2Bit7; /* SCSI control enable */ + int stest2Bit5; /* Enable differential SCSI bus */ + int stest2Bit2; /* Always WIDE SCSI */ + int stest2Bit1; /* Extend SREQ/SACK filtering */ + int stest3Bit7; /* TolerANT enable */ + int dmodeBit7; /* Burst Length transfer bit 1 */ + int dmodeBit6; /* Burst Length transfer bit 0 */ + int dmodeBit5; /* Source I/O memory enable */ + int dmodeBit4; /* Destination I/O memory enable*/ + int scntl1Bit7; /* Slow cable mode */ + } NCR810_HW_REGS; + + +/* + * SCSI controller structure + * + * NOTE: the entire structure must be located in cache-coherent memory + * safe for DMA transfers. This is because some fields are shared with the + * SCSI controller e.g. Msg In/Out buffers, Data In/Out buffers and the Cmd + * buffer. + * + * NOTE: some fields in this structure control hardware features which are + * not supported by the current software. + */ + +typedef struct /* NCR_810_SCSI_CTRL - NCR810 */ + /* SCSI controller info */ + { + SCSI_CTRL scsiCtrl; /* generic SCSI controller info */ + SEM_ID singleStepSem; /* use to debug script in single step mode */ + + /* Hardware implementation dependencies */ + BOOL slowCableMode; /* TRUE to select slow cable mode */ + int chipType; /* Device type NCR7X0_TYPE */ + /* Only 810 Supported today */ + int devType; /* type of device (see define's below) */ + BOOL resetReportDsbl; /* TRUE to disable SCSI bus reset reporting */ + BOOL parityTestMode; /* TRUE enable parity test mode */ + BOOL parityCheckEnbl; /* TRUE to enable parity checking */ + UINT clkPeriod; /* period of controller clock (nsec x 100) */ + UINT8 clkDiv; /* async and sync clock divider in scntl3 */ + NCR810_HW_REGS hwRegs; /* values used for hardware dependent regs */ + + NCR810_STATE state; /* current state of controller */ + /* shared data areas for */ + /* identification & client threads */ + struct ncr810Shared *pIdentShMem; + struct ncr810Shared *pClientShMem; + + NCR810_THREAD *pHwThread; /* thread corresp. to current script run */ + NCR810_THREAD *pNewThread; /* thread to be activated by ISR (if any) */ + BOOL cmdPending; /* TRUE => task wants to start new command */ + BOOL singleStep; /* TRUE => SIOP is in single-step mode */ + + UINT8 identMsg[SCSI_MAX_IDENT_MSG_LENGTH + 5]; /* 5 for wide/sync */ + UINT identMsgLength; + + volatile UINT8 *pScntl0; /* SCTNL0 SCSI control register 0 */ + volatile UINT8 *pScntl1; /* SCTNL1 SCSI control register 1 */ + volatile UINT8 *pScntl2; /* SCTNL2 SCSI control register 2 */ + volatile UINT8 *pScntl3; /* SCTNL3 SCSI control register 3 */ + volatile UINT8 *pScid; /* SCID SCSI chip ID register */ + volatile UINT8 *pSxfer; /* SODL SCSI transfer register */ + volatile UINT8 *pSdid; /* SDID SCSI destination ID register */ + volatile UINT8 *pGpreg; /* GPREG General Purpose register */ + volatile UINT8 *pSfbr; /* SFBR SCSI first byte received reg */ + volatile UINT8 *pSocl; /* SOCL SCSI output control latch reg */ + volatile UINT8 *pSsid; /* SSID SCSI selector ID */ + volatile UINT8 *pSbcl; /* SBCL SCSI bus control lines reg */ + volatile UINT8 *pDstat; /* DSTAT DMA status register */ + volatile UINT8 *pSstat0; /* SSTAT0 SCSI status register 0 */ + volatile UINT8 *pSstat1; /* SSTAT1 SCSI status register 1 */ + volatile UINT8 *pSstat2; /* SSTAT2 SCSI status register 2 */ + volatile UINT *pDsa; /* DSA data structure address */ + volatile UINT8 *pIstat; /* ISTAT interrupt status register */ + volatile UINT8 *pCtest0; /* CTEST0 chip test register 0 */ + volatile UINT8 *pCtest1; /* CTEST1 chip test register 1 */ + volatile UINT8 *pCtest2; /* CTEST2 chip test register 2 */ + volatile UINT8 *pCtest3; /* CTEST3 chip test register 3 */ + volatile UINT *pTemp; /* TEMP temporary holding register */ + volatile UINT8 *pDfifo; /* DFIFO DMA FIFO control register */ + volatile UINT8 *pCtest4; /* CTEST4 chip test register 4 */ + volatile UINT8 *pCtest5; /* CTEST5 chip test register 5 */ + volatile UINT8 *pCtest6; /* CTEST6 chip test register 6 */ + volatile UINT *pDbc; /* DCMD SIOP command reg (24Bits Reg) */ + volatile UINT8 *pDcmd; /* DBC SIOP command register 8bits */ + volatile UINT *pDnad; /* DNAD DMA buffer ptr (next address) */ + volatile UINT *pDsp; /* DSP SIOP scripts pointer register */ + volatile UINT *pDsps; /* DSPS SIOP scripts ptr save reg */ + volatile UINT8 *pScratcha0; /* SCRATCHA0 general purpose scratch reg */ + volatile UINT8 *pScratcha1; /* SCRATCHA1 general purpose scratch reg */ + volatile UINT8 *pScratcha2; /* SCRATCHA2 general purpose scratch reg */ + volatile UINT8 *pScratcha3; /* SCRATCHA3 general purpose scratch reg */ + volatile UINT8 *pDmode; /* DMODE DMA operation mode register */ + volatile UINT8 *pDien; /* DIEN DMA interrupt enable */ + volatile UINT8 *pDwt; /* DWT DMA watchdog timer register */ + volatile UINT8 *pDcntl; /* DCTNL DMA control register */ + volatile UINT *pAdder; /* ADDER Adder output Register */ + volatile UINT8 *pSien0; /* SIEN0 SCSI interrupt enable Zero reg */ + volatile UINT8 *pSien1; /* SIEN1 SCSI interrupt enable One reg */ + volatile UINT8 *pSist0; /* SIST0 SCSI interrupt status Zero reg */ + volatile UINT8 *pSist1; /* SIST1 SCSI interrupt status One reg */ + volatile UINT8 *pSlpar; /* SLPAR SCSI longitudinal Parity reg */ + volatile UINT8 *pSwide; /* NCR825 specific: SCSI Wide Residue */ + volatile UINT8 *pMacntl; /* MACNTL Memory Access Control reg */ + volatile UINT8 *pGpcntl; /* GPCNTL General Purpose Pin Control */ + volatile UINT8 *pStime0; /* STIME0 SCSI Timer Zero reg */ + volatile UINT8 *pStime1; /* STIME1 SCSI Timer One reg */ + volatile UINT8 *pRespid; /* RESPID Response ID reg */ + volatile UINT8 *pStest0; /* STEST0 SCSI Test Zero reg */ + volatile UINT8 *pStest1; /* STEST1 SCSI Test One reg */ + volatile UINT8 *pStest2; /* STEST2 SCSI Test Two reg */ + volatile UINT8 *pStest3; /* STEST3 SCSI Test Three reg */ + + volatile UINT8 *pStest4; /* STEST4 SCSI Test Four reg */ + + volatile UINT16 *pSidl; /* SIDL SCSI input data latch reg */ + volatile UINT16 *pSodl; /* SCSI output data latch reg */ + volatile UINT16 *pSbdl; /* SBDL SCSI bus data lines register */ + volatile UINT *pScratchb; /* SCRATCHB Scratch Register B */ + + volatile UINT8 *siopRamBaseAdrs; /* ram base address of SIOP */ + + } NCR_810_SCSI_CTRL; + +/* END PRIVATE */ + +/* Data stream swapping macros THESE ARE NOW OBSOLETE */ + +#if (_BYTE_ORDER == _BIG_ENDIAN) +# define BYTE_SWAP_32_BIT(x) LONGSWAP(x) +# define BYTE_SWAP_16_BIT(x) ((LSB(x) << 8) | MSB(x)) +#else +# define BYTE_SWAP_32_BIT(x) (x) +# define BYTE_SWAP_16_BIT(x) (x) +#endif + +/* Bit Registers definitions for ncr810 */ + +/* SCNTL0 */ + +#define SCNTL0_ARB1 0x80 /* Arbitration bit1 and bit0, where */ +#define SCNTL0_ARB0 0x40 /* 00 - simple arb; 11 - full arb. */ +#define SCNTL0_START 0x20 /* Start sequence */ +#define SCNTL0_WATN 0x10 /* Select w/wo atn */ +#define SCNTL0_EPC 0x08 /* Parity checking */ +#define SCNTL0_AAP 0x02 /* Assert ATN on parity error */ +#define SCNTL0_TRG 0x01 /* Target/initiator mode */ + +/* SCNTL1 */ + +#define SCNTL1_EXC 0x80 /* Extra Data Set up */ +#define SCNTL1_ADB 0x40 /* Assert Data (SODL) onto scsi */ +#define SCNTL1_DHP 0x20 /* Disable Halt on Parity Error or ATN (targ) */ +#define SCNTL1_CON 0x10 /* connected bit status */ +#define SCNTL1_RST 0x08 /* Assert Rst on scsi */ +#define SCNTL1_AESP 0x04 /* Assert even parity -force error */ +#define SCNTL1_IARB 0x02 /* Immediate arbitration */ +#define SCNTL1_SST 0x01 /* Start SCSI Transfer */ + +/* SCNTL2 */ + +#define SCNTL2_SDU 0x80 /* SCSI Disconnect Unexpected */ +#define SCNTL2_WSR 0x01 /* Wide SCSI Receive */ + +/* SCNTL3 */ + +#define SCNTL3_ULTRA 0x80 /* Ultra Enable */ +#define SCNTL3_SCF2 0x40 /* Syncronous Clock Conversion Factor bits */ +#define SCNTL3_SCF1 0x20 +#define SCNTL3_SCF0 0x10 +#define SCNTL3_EWS 0x08 /* Enable WIDE SCSI */ +#define SCNTL3_CCF2 0x04 /* Clock Conversion Factor bits */ +#define SCNTL3_CCF1 0x02 +#define SCNTL3_CCF0 0x01 +#define SCNTL3_SCF_MASK 0x70 /* Sync Clock Conv Factor bit mask */ +#define SCNTL3_CCF_MASK 0x07 /* Clock Conv Factor bit mask */ + +/* SCID */ + +#define SCID_RRE 0x40 /* Enable Response to Reselection */ +#define SCID_SRE 0x20 /* Enable Response to Selection */ +#define SCID_ENC2 0x04 /* Encoded SCSI ID bit 2 */ +#define SCID_ENC1 0x02 /* Encoded SCSI ID bit 1 */ +#define SCID_ENC0 0x01 /* Encoded SCSI ID bit 0 */ +#define SCID_ENC_MASK 0x07 /* The Encoded SCSI ID mask */ + +/* SXFER */ + +#define SXFER_TP2 0x80 /* Synchronous transfer period 2 */ +#define SXFER_TP1 0x40 /* Synchronous transfer period 1 */ +#define SXFER_TP0 0x20 /* Synchronous transfer period 0 */ +#define SXFER_MO3 0x08 /* Maximun scsi Synchronous transfer offset */ +#define SXFER_MO2 0x04 /* Maximun scsi Synchronous transfer offset */ +#define SXFER_MO1 0x02 /* Maximun scsi Synchronous transfer offset */ +#define SXFER_MO0 0x01 /* Maximun scsi Synchronous transfer offset */ +#define SXFER_OFFSET 0x0f + +/* SDID */ + +#define SDID_ENC2 0x04 /* Destination SCSI ID bit 2 */ +#define SDID_ENC1 0x02 /* Destination SCSI ID bit 1 */ +#define SDID_ENC0 0x01 /* Destination SCSI ID bit 0 */ +#define SDID_ENC_MASK 0x07 /* The Encoded SCSI ID mask */ + +/* GPREG */ + +/* ??? */ + +/* SFBR */ + +/* No need to specify bits */ + +/* SOCL (RW) and SBCL (RO not latched) */ + +#define B_REQ 0x80 /* Assert scsi req */ +#define B_ACK 0x40 /* Assert scsi ack */ +#define B_BSY 0x20 /* Assert scsi busy */ + +/*#define B_SEL 0x10*/ /* Assert scsi sel */ + +#define B_ATN 0x08 /* Assert scsi atn */ +#define B_MSG 0x04 /* Assert scsi msg */ +#define B_CD 0x02 /* Assert scsi c/d */ +#define B_IO 0x01 /* Assert scsi i/o */ + +/* SSID */ + +#define SSID_VAL 0x80 /* SCSI Valid Bit. ENID is valid only if this + bit is set. */ + +#define SSID_ENC_MASK_7 0x07 /* Binary encoded SCSI ID mask 0-7 */ +#define SSID_ENC_MASK_F 0x0F /* Binary encoded SCSI ID mask 0-15 */ + +#if (SCSI_MAX_BUS_ID == SCSI_MAX_BUS_ID_7) + #define SSID_ENC_MASK SSID_ENC_MASK_7 /* SCSI ID mask 0-7 */ +#else + #define SSID_ENC_MASK SSID_ENC_MASK_F /* SCSI ID mask 0-15 */ +#endif + +/* DSTAT (RO) and DIEN (RW enable intr) */ + +#define B_DFE 0x80 /* Dma fifo empty */ +#define B_MDPE 0x40 /* Master Data Parity Error */ +#define B_BF 0x20 /* Bus Fault */ +#define B_ABT 0x10 /* Abort condition */ +#define B_SSI 0x08 /* Scsi Step Interrupt */ +#define B_SIR 0x04 /* Script Interrupt received */ +#define B_IID 0x01 /* Illegal Instruction Detected */ + +/* SSTAT0 */ + +#define SSTAT0_ILF 0x80 /* SIDL Input Latch Full */ +#define SSTAT0_ORF 0x40 /* SODR Output Register Full */ +#define SSTAT0_OLF 0x20 /* SODL Output Latch Full */ +#define SSTAT0_AIP 0x10 /* Arbitration In Progress */ +#define SSTAT0_LOA 0x01 /* LOst Arbitration */ +#define SSTAT0_WOA 0x02 /* WOn Arbitration */ +#define SSTAT0_RST 0x04 /* SCSI ReSeT signal in the ISTAT register */ +#define SSTAT0_SDP 0x08 /* SCSI SDP/ parity signal */ + +/* SSTAT1 RO register */ + +#define SSTAT1_FF3 0x80 /* Fifo flag 3 :number of bytes in fifo */ +#define SSTAT1_FF2 0x40 /* Fifo flag 2 :number of bytes in fifo */ +#define SSTAT1_FF1 0x20 /* Fifo flag 1 :number of bytes in fifo */ +#define SSTAT1_FF0 0x10 /* Fifo flag 0 :number of bytes in fifo */ + /* 0000=0 ..... 1000=8 */ +#define SSTAT1_SPDL 0x08 /* Latched parity line */ +#define SSTAT1_MSGL 0x04 /* Latched state of MSG line */ +#define SSTAT1_CDL 0x02 /* Latched state of C/D line */ +#define SSTAT1_IOL 0x01 /* Latched sate of IO line */ +#define FIFO_MASK 0xf0 + +/* SSTAT2 */ + +#define SSTAT2_ILF 0x80 /* SIDL MSB full */ +#define SSTAT2_ORF 0x40 /* SODR MSB full */ +#define SSTAT2_OLF 0x20 /* SODL MSB full */ +#define SSTAT2_FF4 0x10 /* FIFO flags bit 4 */ +#define SSTAT2_SPL 0x08 /* Latched SCSI Parity */ +#define SSTAT2_DSP 0x04 /* differential sense pin */ +#define SSTAT2_LDSC 0x02 /* Last Disconnect; used in conjunction with + CON bit in SCNTL1 */ +#define SSTAT2_SDP 0x01 /* SCSI SDP/ parity signal */ + + +/* ISTAT RW register */ + +#define ISTAT_ABRT 0x80 /* Abort operation */ +#define ISTAT_SOFTRST 0x40 /* Soft chip reset */ +#define ISTAT_SIGP 0x20 /* signal process */ +#define ISTAT_SEM 0x10 /* Semaphore */ +#define ISTAT_CON 0x08 /* stat connected (reset doesn't disconnect) */ +#define ISTAT_INTF 0x04 /* set by INTFLY script instruction. Signals + ISRs while scripts are still running */ +#define ISTAT_SIP 0x02 /* SCSI Interrupt Pending */ +#define ISTAT_DIP 0x01 /* Dma Interrupt Pending */ + +/* CTEST1 */ + +/* + * FMT? bits define the bottom bytes in the FIFO that are empty. ? specifies + * the byte lane number. If byte lane3 is empty then FMT3 bit is set. All + * 1's indicate an empty FIFO. + */ + +#define CTEST1_FMT3 0x80 /* Byte lane 3 empty? */ +#define CTEST1_FMT2 0x40 /* Byte lane 2 empty? */ +#define CTEST1_FMT1 0x20 /* Byte lane 1 empty? */ +#define CTEST1_FMT0 0x10 /* Byte lane 0 empty? */ + +/* + * FFL? bits define the top bytes in the FIFO that are full. ? specifies the + * byte lane number. If byte lane3 is full then FFL3 is set. All 1's indicate + * a full FIFO. + */ + +#define CTEST1_FFL3 0x08 /* Byte lane 3 full? */ +#define CTEST1_FFL2 0x04 /* Byte lane 2 full? */ +#define CTEST1_FFL1 0x02 /* Byte lane 1 full? */ +#define CTEST1_FFL0 0x01 /* Byte lane 0 full? */ + +/* CTEST2 */ + +#define CTEST2_DDIR 0x80 /* Data Direction. 1 => From SCSI to board */ +#define CTEST2_SIGP 0x40 /* Signal Process. Same as in ISTAT. When this + register is read SIGP is cleared in ISTAT */ +#define CTEST2_CIO 0x20 /* Configured as I/O XXX ??? */ +#define CTEST2_CM 0x10 /* Configured as Memory XXX ??? */ +#define CTEST2_TEOP 0x04 /* SCSI true end of process */ +#define CTEST2_DREQ 0x02 /* 1 => DREQ is active */ +#define CTEST_DACK 0x01 /* 1 => DACK is inactive */ + +/* CTEST3 */ + +#define CTEST3_V3 0x80 /* Chip Revision Bit 3 */ +#define CTEST3_V2 0x40 /* Chip Revision Bit 2 */ +#define CTEST3_V1 0x20 /* Chip Revision Bit 1 */ +#define CTEST3_V0 0x10 /* Chip Revision Bit 0 */ +#define CTEST3_FLF 0x08 /* Flush DMA FIFO */ +#define CTEST3_CLF 0x04 /* Clear DMA FIFO */ +#define CTEST3_FM 0x02 /* Fetch Pin mode */ +#define CTEST3_WRIE 0x01 /* Write and Invalidate Enable */ + +/* DFIFO */ + +#define DFIFO_BO_MASK 0x7f /* 7 bits of SCSI Byte Offset counter between + SCSI core and DMA core */ + +/* CTEST4 */ + +#define CTEST4_BDIS 0x80 /* Burst transfer DISable */ +#define CTEST4_ZMOD 0x40 /* Host bus high impedance mode */ +#define CTEST4_SZD 0x20 /* Scsi data high impedance mode */ +#define CTEST4_SRTM 0x10 /* Shadow Register Test Mode */ +#define CTEST4_MPEE 0x08 /* Master Parity Error Enable */ +#define CTEST4_FBL2 0x04 /* Enable bytes lane */ +#define CTEST4_FLB1 0x02 /* Bit one mux byte lane */ +#define CTEST4_FLB0 0x01 /* Bit zero mux byte lane */ + +/* CTEST5 */ + +#define CTEST5_ADCK 0x80 /* Increment DNAD register */ +#define CTEST5_BBCK 0x40 /* Decrement DBC register */ +#define CTEST5_DFS 0x20 /* DMA FIFO Size: 0=88, 1=536 bytes */ +#define CTEST5_MASR 0x10 /* set/reset values for bit 3 */ +#define CTEST5_DDIR 0x08 /* control internel DMAWR (scsi to host) */ +#define CTEST5_EOP 0x04 /* control internal EOP (DMA/SCSI) */ +#define CTEST5_DREQ 0x02 /* control internal DREQ */ +#define CTEST5_DACK 0x01 /* control internal DACK (DMA/SCSI) */ + +/* CTEST6 */ + +#define CTEST6_DF_MASK 0xff /* Dma Fifo bits - mask */ + +/* DMODE RW register */ + +#define DMODE_BL1 0x80 /* Burst Length transfer bits; determine the */ +#define DMODE_BL0 0x40 /* number of transfers per bus ownership */ + /* 00=2,01=4,10=8,11=16 */ +#define DMODE_SIOM 0x20 /* Source I/O Memory Enable; 1 => I/O space */ +#define DMODE_DIOM 0x10 /* Destination I/O Memory Enable; " " " */ +#define DMODE_ERL 0x08 /* Enable Read Line; */ +#define DMODE_ERMP 0x04 /* Enable Read Multiple */ +#define DMODE_BOF 0x02 /* Burst Opcode Fetch enable; instrs fetched + in burst mode */ +#define DMODE_MAN 0x01 /* Manual start mode ,when set disable */ + /* autostart script when writting in DSP */ + +/* DCNTL - DMA Control bits */ + +#define DCNTL_CLSE 0x80 /* Cache Line Size Enable */ +#define DCNTL_PFF 0x40 /* Pre-Fetch Flush */ +#define DCNTL_PFEN 0x20 /* Pre-Fetch ENable */ +#define DCNTL_SSM 0x10 /* Single-Step Mode */ +#define DCNTL_IRQM 0x08 /* IRQ Mode */ +#define DCNTL_STD 0x04 /* STart Dma operation; instr. is in DSP */ +#define DCNTL_IRQD 0x02 /* IRQ Disable; 1 => IRQ/ wont be asserted */ +#define DCNTL_COM 0x01 /* Compatability XXX ??? 1 => ncr700 mode ?? */ + +/* SIEN0 (enable intr)and SIST0 (RO Status) */ + +/* Enable interrupt */ + +#define B_MA 0x80 /* Phase Mismatch; initiator interrupt occurs */ +#define B_CMP 0x40 /* Funtion CoMPlete; interrupt when full + arbitration and selection is complete */ +#define B_SEL 0x20 /* Selected; intr when selected as target */ +#define B_RSL 0x10 /* Reselected; intr when reselected */ +#define B_SGE 0x08 /* SCSI Gross Error; intr enable */ +#define B_UDC 0x04 /* Enable Unexpected Disconnect intr */ +#define B_RST 0x02 /* Enable Reset intr */ +#define B_PAR 0x01 /* Enable parity intr */ + +/* SIEN1 (enable intr) and SIST1 (RO status) */ + +#define B_STO 0x04 /* Selection/Reselection Timeout; intr enable */ +#define B_GEN 0x02 /* GENeral purpose timer expired; intr enable */ +#define B_HTH 0x01 /* Handshake to Handshake timer expired; intr */ + +/* MACNTL - Memory Access Control (RW) */ + +#define MACNTL_TYP_MASK 0xf0 /* Identify the chip TYPe */ +#define MACNTL_DWR 0x08 /* Data WRite is local memeory access */ +#define MACNTL_DRD 0x04 /* Data ReaD is local memory access */ +#define MACNTL_PSCPT 0x02 /* Pointer to SCRIPTs is local mem access */ +#define MACNTL_SCPTS 0x01 /* SCRIPTS fetch is local mem access */ + +/* GPCNTL - General Purpose Pin Control (RW) */ + +/* This reg is used to determine if GPREG pins are inputs or outputs */ + +#define GPCNTL_ME 0x80 /* Master Enable; internal bus master is GPIO1*/ +#define GPCNTL_FE 0x40 /* Fetch Enable; internal op-code fetch GPIO0 */ +#define GPCNTL_GPIO1 0x02 /* GPIO1: set - input and reset - output */ +#define GPCNTL_GPIO0 0x01 /* GPIO0: set - input and reset - output */ + +/* STIME0 SCSI Timer Zero (RW) */ + +/* These bits select various timeout values.e.g 0000 => disable; 1111 => 1.6s */ + +#define STIME0_HTH_MASK 0xf0 /* Handshake-To-Handshake timer period mask */ +#define STIME0_SEL_MASK 0x0f /* SELection timeout mask */ + +/* STIME1 SCSI Timer One (RW) */ + +#define STIME1_GEN_MASK 0x0f /* GENeral timer timeout mask */ + +/* STEST0 SCSI Test Zero (RO) */ + +#define STEST0_SSAID_MASK 0x70 /* SCSI Selected As ID */ +#define STEST0_SLT 0x08 /* Selection response logic test */ +#define STEST0_ART 0x04 /* Arbitation Priority encoder Test */ +#define STEST0_SOZ 0x02 /* SCSI Synchronous Offset Zero */ +#define STEST0_SOM 0x01 /* SCSI Synchronous Offset Maximum */ + +/* STEST1 SCSI Test One (RW) */ + +#define STEST1_SCLK 0x80 /* Disables external SCLK and uses PCI internal + SCSI clock */ +#define STEST1_SISO 0x40 /* SCSI Isolation Mode; inputs isolated from + the SCSI bus */ +#define STEST1_QEN 0x08 /* Quadrupler Enable: Power on clock Quadrupler */ +#define STEST1_QSEL 0x04 /* Quadrupler Select: Increase clock to 160 MHz */ + +/* STEST2 SCSI Test Two (RW) */ + +#define STEST2_SCE 0x80 /* SCSI Control Enable */ +#define STEST2_ROF 0x40 /* Reset SCSI OFfset */ + +#define STEST2_DIF 0x20 /* NCR825 specific: SCSI Differential Mode */ +#define STEST2_AWS 0x04 /* NCR825 specific: Always Wide SCSI */ + +#define STEST2_SLB 0x10 /* SCSI Loopback Mode */ +#define STEST2_SZM 0x08 /* SCSI High Impedence Mode */ +#define STEST2_EXT 0x02 /* Extend SREQ/SACK filtering - Should not be + set during FAST SCSI > 5MB/s */ +#define STEST2_LOW 0x01 /* SCSI LOW level mode; no DMA operation occur + and no SCRIPTS execute */ + +/* STEST3 SCSI Test Three (RW) */ + +#define STEST3_TE 0x80 /* Tolerant Enable */ +#define STEST3_STR 0x40 /* SCSI FIFO Test Read */ +#define STEST3_HSC 0x20 /* Halt Scsi Clock */ +#define STEST3_DSI 0x10 /* Disable Single Initiator response (SCSI-1) */ +#define STEST3_TTM 0x04 /* Timer Test Mode */ +#define STEST3_CSF 0x02 /* Clear Scsi Fifo */ +#define STEST3_STW 0x01 /* SCSI Fifo Test Write */ + +/* STEST4 SCSI Test Four (RW) */ + +#define STEST4_SMODE1 0x80 /* SCSI Mode Detect (upper bit) */ +#define STEST4_SMODE0 0x40 /* SCSI Mode Detect (lower bit) */ +#define STEST4_LOCK 0x20 /* Detect Clock Quadrupler Lockup */ + + +/* Two types of register base address. Memory I/O and Cofig base addresses */ + +#define MEMIO_REG_BASE (0x00) +#define CONFIG_REG_BASE (0x80) +#define BASE MEMIO_REG_BASE + +/* _BYTE_ORDER is LITTLE_ENDIAN for PCI devices */ + +#define OFF_SCNTL0 (BASE) /* SCTNL0 SCSI control register 0 */ +#define OFF_SCNTL1 (BASE + 0x01) /* SCTNL1 SCSI control register 1 */ +#define OFF_SCNTL2 (BASE + 0x02) /* SCTNL2 SCSI control register 2 */ +#define OFF_SCNTL3 (BASE + 0x03) /* SCTNL3 SCSI control register 3 */ +#define OFF_SCID (BASE + 0x04) /* SCID SCSI chip ID register */ +#define OFF_SXFER (BASE + 0x05) /* SXFER SCSI chip ID regiester */ +#define OFF_SDID (BASE + 0x06) /* SDID SCSI destination ID register */ +#define OFF_GPREG (BASE + 0x07) /* GPREG General Purpose register */ +#define OFF_SFBR (BASE + 0x08) /* SFBR SCSI first byte received reg */ +#define OFF_SOCL (BASE + 0x09) /* SOCL SCSI output control latch reg */ +#define OFF_SSID (BASE + 0x0a) /* SSID SCSI selector ID */ +#define OFF_SBCL (BASE + 0x0b) /* SBCL SCSI bus control lines reg */ +#define OFF_DSTAT (BASE + 0x0c) /* DSTAT DMA status register */ +#define OFF_SSTAT0 (BASE + 0x0d) /* SSTAT0 SCSI status register 0 */ +#define OFF_SSTAT1 (BASE + 0x0e) /* SSTAT1 SCSI status register 0 */ +#define OFF_SSTAT2 (BASE + 0x0f) /* SSTAT2 SCSI status register 0 */ +#define OFF_DSA (BASE + 0x10) /* DSA data structure address */ +#define OFF_ISTAT (BASE + 0x14) /* ISTAT interrupt status register */ +#define OFF_CTEST0 (BASE + 0x18) /* CTEST0 chip test register 0 */ +#define OFF_CTEST1 (BASE + 0x19) /* CTEST1 chip test register 1 */ +#define OFF_CTEST2 (BASE + 0x1a) /* CTEST2 chip test register 2 */ +#define OFF_CTEST3 (BASE + 0x1b) /* CTEST3 chip test register 3 */ +#define OFF_TEMP (BASE + 0x1c) /* TEMP temporary holding register */ +#define OFF_DFIFO (BASE + 0x20) /* DFIFO DMA FIFO control register */ +#define OFF_CTEST4 (BASE + 0x21) /* CTEST4 chip test register 4 */ +#define OFF_CTEST5 (BASE + 0x22) /* CTEST5 chip test register 5 */ +#define OFF_CTEST6 (BASE + 0x23) /* CTEST6 chip test register 6 */ +#define OFF_DBC (BASE + 0x24) /* DBC SIOP command register 24bits */ +#define OFF_DCMD (BASE + 0x27) /* DCMD SIOP command reg (8Bits Reg) */ +#define OFF_DNAD (BASE + 0x28) /* DNAD DMA buffer ptr (next address) */ +#define OFF_DSP (BASE + 0x2c) /* DSP SIOP scripts pointer register */ +#define OFF_DSPS (BASE + 0x30) /* DSPS SIOP scripts ptr save reg */ +#define OFF_SCRATCHA0 (BASE + 0x34) /* SCRATCHA0 gen purpose scratch reg */ +#define OFF_SCRATCHA1 (BASE + 0x35) /* SCRATCHA1 gen purpose scratch reg */ +#define OFF_SCRATCHA2 (BASE + 0x36) /* SCRATCHA2 gen purpose scratch reg */ +#define OFF_SCRATCHA3 (BASE + 0x37) /* SCRATCHA3 gen purpose scratch reg */ +#define OFF_DMODE (BASE + 0x38) /* DMODE DMA operation mode register */ +#define OFF_DIEN (BASE + 0x39) /* DIEN DMA interrupt enable */ +#define OFF_DWT (BASE + 0x3a) /* DWT DMA watchdog timer register */ +#define OFF_DCNTL (BASE + 0x3b) /* DCTNL DMA control register */ +#define OFF_ADDER (BASE + 0x3c) /* ADDER Adder output Register */ +#define OFF_SIEN0 (BASE + 0x40) /* SIEN0 SCSI interrupt enable 0 reg */ +#define OFF_SIEN1 (BASE + 0x41) /* SIEN1 SCSI interrupt enable 1 reg */ +#define OFF_SIST0 (BASE + 0x42) /* SIST0 SCSI interrupt status 0 reg */ +#define OFF_SIST1 (BASE + 0x43) /* SIST1 SCSI interrupt status 1 reg */ +#define OFF_SLPAR (BASE + 0x44) /* SLPAR SCSI longitudinal Parity reg */ +#define OFF_SWIDE (BASE + 0x45) /* NCR825: SWIDE SCSI Wide Residue */ +#define OFF_MACNTL (BASE + 0x46) /* MACNTL Memory Access Control reg */ +#define OFF_GPCNTL (BASE + 0x47) /* GPCNTL General Purpose Pin Control */ +#define OFF_STIME0 (BASE + 0x48) /* STIME0 SCSI Timer Zero reg */ +#define OFF_STIME1 (BASE + 0x49) /* STIME1 SCSI Timer One reg */ +#define OFF_RESPID (BASE + 0x4a) /* RESPID Response ID reg */ +#define OFF_STEST0 (BASE + 0x4c) /* STEST0 SCSI Test 0 reg */ +#define OFF_STEST1 (BASE + 0x4d) /* STEST1 SCSI Test 1 reg */ +#define OFF_STEST2 (BASE + 0x4e) /* STEST2 SCSI Test 2 reg */ +#define OFF_STEST3 (BASE + 0x4f) /* STEST3 SCSI Test 3 reg */ +#define OFF_SIDL (BASE + 0x50) /* SIDL SCSI input data latch reg */ + +#define OFF_STEST4 (BASE + 0x52) /* STEST4 SCSI Test 4 reg */ + +#define OFF_SODL (BASE + 0x54) /* SCSI output data latch reg */ +#define OFF_SBDL (BASE + 0x58) /* SBDL SCSI bus data lines register */ +#define OFF_SCRATCHB (BASE + 0x5c) /* SCRATCHB Scratch Register B */ + +#define OFF_SCRATCHC (BASE + 0x60) /* SCRATCHC Scratch Register C */ +#define OFF_SCRATCHD (BASE + 0x64) /* SCRATCHD Scratch Register D */ +#define OFF_SCRATCHE (BASE + 0x68) /* SCRATCHE Scratch Register E */ +#define OFF_SCRATCHF (BASE + 0x6c) /* SCRATCHF Scratch Register F */ +#define OFF_SCRATCHG (BASE + 0x70) /* SCRATCHG Scratch Register G */ +#define OFF_SCRATCHH (BASE + 0x74) /* SCRATCHH Scratch Register H */ +#define OFF_SCRATCHI (BASE + 0x78) /* SCRATCHI Scratch Register I */ +#define OFF_SCRATCHJ (BASE + 0x7C) /* SCRATCHJ Scratch Register J */ + +#define NCR810_DEVICE_ID 0x0001 +#define NCR825_DEVICE_ID 0x0003 +#define NCR875_DEVICE_ID 0x000f +#define NCR895_DEVICE_ID 0x000c +#define SYM895_DEVICE_ID NCR895_DEVICE_ID +#define PCI_ID_SYMBIOS 0x1000 + +/* + * NOTICE: The macro PCI_TO_MEM_OFFSET is not to be used anymore. It + * is a BSP specific value, not an architectural value. The BSP should + * update the value ncr810PciMemOffset with the appropriate offset value. + */ + +/* + * When memory is accessed from the PCI bus, the addresses need to contain this + * offset + * + * MAKE NO FURTHER CHANGES HERE SEE SPR 8540 + */ + +#ifndef PCI_TO_MEM_OFFSET +# if (CPU == I960JX) +# define PCI_TO_MEM_OFFSET 0x00000000 +# else +# define PCI_TO_MEM_OFFSET 0x80000000 +# endif +#endif + + +/* Mask Values */ + +#define NCR810_COUNT_MASK ((UINT)0x00ffffff) /* Mask 24 bit value in block */ + /* move description */ +/* Shift values for "device" field in shared data structure */ + +#define NCR810_TARGET_BUS_ID_SHIFT 16 /* bits 23-16: specify target bus ID */ +#define NCR810_XFER_PARAMS_SHIFT 8 /* bits 15-08: copy of sxfer reg. */ + +/* Sync offset and period (SXFER register) */ + +#define NCR810_MIN_REQ_ACK_OFFSET 1 /* Minimum sync offset */ +#define NCR810_MAX_REQ_ACK_OFFSET 8 /* Maximum sync offset */ +/* #define NCR810_MAX_REQ_ACK_OFFSET 31 /@ Maximum sync offset 875/895*/ +#define NCR810_MIN_XFER_PERIOD 0 /* Minimum sync period (clks) */ +#define NCR810_MAX_XFER_PERIOD 7 /* Maximum sync period (clks) */ +#define NCR810_MIN_XFERP 4 /* Minimum value of xferp */ +#define NCR810_MAX_XFERP 11 /* Maximum value of xferp */ + +#define NCR810_SYNC_XFER_PERIOD_SHIFT 5 + +#define NCR810_SYNC_XFER_PARAMS_ASYNC 0x00 + +/* Synchronous transfer clock division factor (SBCL register bits 1,0 (w-o) */ + +#define NCR810_MIN_CLOCK_DIV 0x00 +#define NCR810_MAX_CLOCK_DIV 0x03 +#define NCR810_CLOCK_DIVIDE_ASYNC 0x00 + +/* Clock conversion factor */ + +/* prescale factor for asynchronous scsi core (scntl3) */ + +#define NCR810_16MHZ_ASYNC_DIV 0x01 /* 16.67-25.00Mhz input clock */ +#define NCR810_25MHZ_ASYNC_DIV 0x02 /* 25.01-37.50Mhz input clock */ +#define NCR810_50MHZ_ASYNC_DIV 0x03 /* 37.51-50.00Mhz input clock */ +#define NCR810_66MHZ_ASYNC_DIV 0x04 /* 50.01-66.00Mhz input clock */ + +#define NCR810_75MHZ_ASYNC_DIV 0x04 /* 50.01-75.00Mhz input clock */ + +/* + * Note: 80 Mhz value also has bit for clock doubler + * set. We have to enable clock doubler + * as we enabled the clock quadrupler. haven't included support + * for clock doubler yet. + * + * Note: When Ultra enable bit is set, the Tolerant Enable bit must be set + * also. It is STEST3:TE (bit 7). + * + */ + +#define NCR810_80MHZ_ASYNC_DIV 0x85 /* 75.01-80.00Mhz input clock */ + +/* note 120 MHz normally not used */ + +#define NCR810_160MHZ_ASYNC_DIV 0x87 /* 160.00 Mhz input clock with + clock quadrupler and 40 Mhz + input clock */ + +/* ns x 100 clock period */ + +#define NCR810_1667MHZ 6000 /* 16.67Mhz chip */ +#define NCR810_20MHZ 5000 /* 20Mhz chip */ +#define NCR810_25MHZ 4000 /* 25Mhz chip */ +#define NCR810_3750MHZ 2667 /* 37.50Mhz chip */ +#define NCR810_40MHZ 2500 /* 40Mhz chip */ +#define NCR810_50MHZ 2000 /* 50Mhz chip */ +#define NCR810_66MHZ 1515 /* 66Mhz chip */ +#define NCR810_6666MHZ 1500 /* 66Mhz chip */ +#define NCR810_75MHZ 1333 /* 75Mhz chip */ +#define NCR810_80MHZ 1250 /* 80Mhz chip */ +#define NCR810_160MHZ 625 /* 40Mhz chip with Quadrupler */ + + +#define NCR810_MAX_SYNC_PERIOD NCR810_50MHZ +#define NCR810_MAX_ASYNC_PERIOD NCR810_25MHZ + +/* for ncr875/895 +#define NCR810_MAX_SYNC_PERIOD NCR810_160MHZ +#define NCR810_MAX_ASYNC_PERIOD NCR810_4MHZ +*/ + + +#define NCR810_MAX_XFER_WIDTH 1 /* in transfer width exponent units. 16bits */ + +/* Chip Type */ + +#define NCR700_TYPE 0x700 /* not supported */ +#define NCR810_TYPE 0x810 /* supported */ +#define NCR720_TYPE 0x720 /* not supported */ + +/* + * Default value to initialize some registers involved + * in the hardware implementation.Those values could be + * overwritten by a bsp call with the ncr810HwSetRegister(). + * The ncr810 Data Manual documentation will you give all + * the light regarding values choose. See also the + * documentation of ncr810SetHwRegister call. + * See above the NCR810_HW_REGS for the meaning of the + * values prefill. + */ + +#define DEFAULT_810_HW_REGS {0,0,0,0,0,1,0,0,0,0,0} + +/* function declarations */ + +IMPORT NCR_810_SCSI_CTRL * ncr810CtrlCreate ( + UINT8 *siopBaseAdrs, + UINT clkPeriod, + UINT16 devType); + +IMPORT NCR_810_SCSI_CTRL * ncr810CtrlCreate2 ( + UINT8 *siopBaseAdrs, + UINT clkPeriod, + UINT16 devType, + UINT8 *siopRamBaseAdrs, + UINT8 *siopIOBaseAdrs); + +IMPORT STATUS ncr810CtrlInit (NCR_810_SCSI_CTRL *pSiop, + int scsiCtrlBusId); +IMPORT STATUS ncr810SetHwRegister (NCR_810_SCSI_CTRL *pScsiCtrl, + NCR810_HW_REGS *pHwRegs); +IMPORT void ncr810Intr (NCR_810_SCSI_CTRL *pSiop); +IMPORT STATUS ncr810Show (SCSI_CTRL *pScsiCtrl); +IMPORT void ncr810StepEnable (NCR_810_SCSI_CTRL *pSiop, BOOL enable); +IMPORT void ncr810SingleStep (NCR_810_SCSI_CTRL *pSiop, BOOL verbose); + +#endif /* _ASMLANGUAGE */ +#ifdef __cplusplus +} +#endif + +#endif /* __INCncr810h */ diff --git a/h/drv/scsi/ncr810Script.h b/h/drv/scsi/ncr810Script.h new file mode 100644 index 0000000..c579f6a --- /dev/null +++ b/h/drv/scsi/ncr810Script.h @@ -0,0 +1,227 @@ +/* ncr810Script.h - NCR 810 Script definition header */ + +/* Copyright 1984-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,28jan99,dat Fixed HTH timeout, part of SPR 22597 +01b,21nov96,dds Added compiler directives to turn optmization off when + compiling the ncr810Shared data structure. +01a,25may95,jds Created script and driver header; adapted from ncr710 driver +*/ + +#ifndef __INCncr810Scripth +#define __INCncr810Scripth + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#ifndef NCR_COMPILE + + +/* + * Entry points defined by PROCs in the script. + */ + +extern ULONG ncr810Wait[]; /* wait for re-select or host cmd */ +extern ULONG ncr810InitStart[]; /* start new initiator thread */ +extern ULONG ncr810InitContinue[]; /* continue an initiator thread */ +extern ULONG ncr810TgtDisconnect[]; /* disconnect from SCSI bus */ + +#if CPU_FAMILY==I960 +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + + +/* + * Structure giving parameters for block moves using the NCR 810's + * indirect addressing ("MOVE FROM") capability. + */ + +typedef struct moveParams + { + ULONG size; /* # bytes to move to/from SCSI */ + UINT8 *addr; /* where in memory they go/come */ + } MOVE_PARAMS; + +/* + * Shared structure defining all information about a SCSI nexus which has + * to be visible to the script. Note that this structure must not be + * changed without corresponding changes to the OFFSET_* definitions below. + * + * IMPORTANT NOTE: Every element in this structure _must_ be aligned on + * a 4-byte boundary, otherwise the script will fail (illegal instruction). + */ +typedef struct ncr810Shared + { + ULONG device; /* target bus ID, sync xfer params */ + MOVE_PARAMS command; /* command bytes sent to target */ + MOVE_PARAMS data; /* data bytes to/from target */ + MOVE_PARAMS status; /* command status byte from target */ + MOVE_PARAMS identOut; /* outgoing identification msg */ + MOVE_PARAMS identIn; /* incoming identification msg */ + MOVE_PARAMS msgOut; /* message bytes sent to target */ + MOVE_PARAMS msgIn; /* message bytes recvd from target */ + MOVE_PARAMS msgInSecond; /* second byte of multi-byte msg */ + MOVE_PARAMS msgInRest; /* remainder of multi-byte message */ + } NCR810_SHARED; + +#if CPU_FAMILY==I960 +#pragma align 0 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +#endif /* NCR_COMPILE */ + +/* + * The following offsets are used in the script. They _MUST_ be kept in + * sync with the definition of the NCR810_NEXUS structure above. + */ +#define SIZEOF_ULONG 4 +#define SIZEOF_MOVE_PARAMS 8 + +#define OFFSET_DEVICE 0 +#define OFFSET_CMD (OFFSET_DEVICE + SIZEOF_ULONG) +#define OFFSET_DATA (OFFSET_CMD + SIZEOF_MOVE_PARAMS) +#define OFFSET_STATUS (OFFSET_DATA + SIZEOF_MOVE_PARAMS) +#define OFFSET_IDENT_OUT (OFFSET_STATUS + SIZEOF_MOVE_PARAMS) +#define OFFSET_IDENT_IN (OFFSET_IDENT_OUT + SIZEOF_MOVE_PARAMS) +#define OFFSET_MSG_OUT (OFFSET_IDENT_IN + SIZEOF_MOVE_PARAMS) +#define OFFSET_MSG_IN (OFFSET_MSG_OUT + SIZEOF_MOVE_PARAMS) +#define OFFSET_MSG_IN_SECOND (OFFSET_MSG_IN + SIZEOF_MOVE_PARAMS) +#define OFFSET_MSG_IN_REST (OFFSET_MSG_IN_SECOND + SIZEOF_MOVE_PARAMS) + + +/* + * Scratch registers used for data transfer to host + * + */ +#define HOST_FLAGS scratcha0 /* host <-> SIOP: flags - see below */ + +#define MSG_OUT_STATE scratcha1 /* host <-> SIOP: pending,sent,none */ + +#define MSG_IN_STATE scratcha2 /* host <-> SIOP: pending,sent,none */ + +#define TARGET_BUS_ID scratcha3 /* host <- SIOP: bus IDs asserted */ +#define CURRENT_PHASE scratcha3 /* host <- SIOP: phase in progress */ + +/* Bitmasks for HOST_FLAGS */ + +#define FLAGS_IDENTIFY 0x01 /* assert ATN on select, to IDENTIFY */ + +/* + * These definitions provide meaningful aliases for use in "ncr810Lib.c". + * I don't like #defining names of structure members, but it's better than + * having "scratch0" and so forth all over the place ... Be careful of + * clashes with ordinary variable names. + */ +#define nHostFlags scratcha0 /* (r/w) flag bits as defined above */ +#define nMsgOutState scratcha1 /* (r/w) state of message out buffer */ +#define nMsgInState scratcha2 /* (r/w) state of message in buffer */ +#define nBusIdBits scratcha3 /* (r-o) bus ID bits set on reselect */ +#define nBusPhase scratcha3 /* (r-o) most recent phase; mismatch */ + + +/* + * SCSI phases - defined here to avoid including "scsiLib.h". Must match ! + */ +#define PHASE_NONE 0xff /* no info transfer pending */ +#define PHASE_DATA_OUT 0 /* data out (to target) */ +#define PHASE_DATA_IN 1 /* data in (from target) */ +#define PHASE_COMMAND 2 /* command (to target) */ +#define PHASE_STATUS 3 /* status (from target) */ +#define PHASE_MSG_OUT 6 /* message out (to target) */ +#define PHASE_MSG_IN 7 /* message in (from target) */ + +/* + * SCSI messages - defined here to avoid including "scsiLib.h". Must match ! + */ +#define M_CMD_COMPLETE 0x00 /* command complete msg. */ +#define M_EXT_MSG 0x01 /* extended message msg. */ +#define M_DISCONNECT 0x04 /* disconnect msg. */ +#define M_ABORT 0x06 /* abort msg. */ +#define M_NO_OP 0x08 /* no operation msg. */ +#define M_ABORT_TAG 0x0d /* abort tag msg. */ + +/* + * SCSI message in status - must match SCSI_MSG_IN_STATE enum in "scsiLib.h" + */ +#define M_IN_NONE 0 /* no message in in progress */ +#define M_IN_SECOND_BYTE 1 /* next byte is second of two */ +#define M_IN_EXT_MSG_LEN 2 /* next byte is ext msg length */ +#define M_IN_EXT_MSG_DATA 3 /* next byte(s) are ext msg data */ + +/* + * SCSI message out status - must match SCSI_MSG_OUT_STATE enum in "scsiLib.h" + */ +#define M_OUT_NONE 0 /* no message out in progress */ +#define M_OUT_PENDING 1 /* message out ready to send */ +#define M_OUT_SENT 2 /* message out has been sent */ + + +/* + * Script status interrupt codes + */ +#define NCR810_READY 0 /* ready to start new host command */ +#define NCR810_SCRIPT_ABORTED 1 /* have aborted a running script */ + +#define NCR810_MESSAGE_OUT_SENT 10 /* have successfully sent a message */ +#define NCR810_MESSAGE_IN_RECVD 11 /* have received a complete message */ +#define NCR810_EXT_MESSAGE_SIZE 12 /* have read size of extended msg */ +#define NCR810_NO_MSG_OUT 13 /* msg out req. with no msg pending */ + +#define NCR810_CMD_COMPLETE 20 /* SCSI command completed */ +#define NCR810_DISCONNECTED 21 /* target has disconnected */ +#define NCR810_RESELECTED 22 /* have been reselected by target */ +#define NCR810_SELECTED 23 /* have been selected as a target */ + +#define NCR810_SPURIOUS_CMD 30 /* spurious interrupt of resel wait */ +#define NCR810_ILLEGAL_PHASE 31 /* target requested phase 4 or 5 */ +#define NCR810_NO_IDENTIFY 32 /* no IDENTIFY after reselection */ + +/* + * Note: the following are not generated by the script, but it seems + * sensible to define them here for continuity. + */ +#define NCR810_PHASE_MISMATCH 50 /* unexpected phase change occurred */ +#define NCR810_SCSI_TIMEOUT 51 /* select, reselect or xfer timeout */ +#define NCR810_HANDSHAKE_TIMEOUT 54 /* handshake timeout */ +#define NCR810_SCSI_BUS_RESET 52 /* SCSI bus has been reset */ +#define NCR810_UNEXPECTED_DISCON 53 /* target disconnected unexpectedly */ + +#define NCR810_SINGLE_STEP 60 /* single-step completed */ + +#define NCR810_FATAL_ERROR 99 /* bus error, illegal opcode, etc. */ + + +/* + * NCR 810 register bit definitions + * + * Note: there are similar definitions in "ncr810.h". + */ +#define SBCL_SEL 0x10 /* 1 => SCSI SEL signal asserted */ +#define SBCL_ATN 0x08 /* 1 => SCSI ATN signal asserted */ + +#define SCNTL0_TARGET_MODE 0x01 /* 1 => SIOP is in target mode */ + +#define SCNTL1_CONNECTED 0x10 /* 1 => SIOP is connected to SCSI */ + +#define SIEN0_MISMATCH_ATN 0x80 /* 1 => mismatch/ATN intr enabled */ + +#define CTEST2_SIGNAL 0x40 /* 1 => signal pending from host */ + +#define STIME0_HTH_MASK 0xf0 /* Handshake-to-handshake timeout mask*/ +#define STIME0_SEL_MASK 0x0f /* Select timeout bit-mask */ +#define STIME0_HTH_TIMEOUT 0xd0 /* Handshake-to-handshake timeout valu*/ +#define STIME0_SEL_TIMEOUT 0x0d /* Select timeout value */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCncr810Scripth */ diff --git a/h/drv/scsi/sym895.h b/h/drv/scsi/sym895.h new file mode 100644 index 0000000..8a2e383 --- /dev/null +++ b/h/drv/scsi/sym895.h @@ -0,0 +1,996 @@ +/* sym895.h - SYM 895 Script SCSI Controller header file */ + +/* Copyright 1989-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,23jun00,bsp added description for register access mode macro. +01a,06feb00,bsp Created ; adapted from ncr810.h. +*/ + +#ifndef __INCsym895h +#define __INCsym895h + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "semLib.h" +#include "scsiLib.h" + +/* Bit register definitions for the SYM895 */ + +/* SCSI Control Zero - SCNTL0 */ + +#define SYM895_SCNTL0_ARB1 0x80 /* Arbitration Control Bits. */ +#define SYM895_SCNTL0_ARB0 0x40 /* define Simple or Full arbitration. */ +#define SYM895_SCNTL0_START 0x20 /* Start arbitration sequence */ +#define SYM895_SCNTL0_WATN 0x10 /* SATN/signal ctrl on Start sequence */ +#define SYM895_SCNTL0_EPC 0x08 /* Parity Check enable */ +#define SYM895_SCNTL0_AAP 0x02 /* SATN/ signal control on Parity Error */ +#define SYM895_SCNTL0_TRG 0x01 /* Initator/Target mode set */ + +/* SCSI Control One - SCNTL1 */ + +#define SYM895_SCNTL1_EXC 0x80 /* Extra Clock Period for data setup */ +#define SYM895_SCNTL1_ADB 0x40 /* Asset SCSI Data Bus */ +#define SYM895_SCNTL1_DHP 0x20 /* Disable Halt on Parity/ATN (tgt only) */ +#define SYM895_SCNTL1_CON 0x10 /* Bus Connection status */ +#define SYM895_SCNTL1_RST 0x08 /* Assert RST/ */ +#define SYM895_SCNTL1_AESP 0x04 /* Force parity error on SCSI Bus */ +#define SYM895_SCNTL1_IARB 0x02 /* Immediate arbitration */ +#define SYM895_SCNTL1_SST 0x01 /* Start SCSI transfer */ + +/* SCNTL2 */ + +#define SYM895_SCNTL2_SDU 0x80 /* SCSI Disconnect Unexpected */ +#define SYM895_SCNTL2_CHM 0x40 /* Chained Move (automatically set/reset)*/ +#define SYM895_SCNTL2_SLPMD 0x20 /* Longitudianal parity mode related */ +#define SYM895_SCNTL2_SLPHBEN 0x10 /* Longitudianal parity mode related */ +#define SYM895_SCNTL2_WSS 0x08 /* Wide SCSI Send */ +#define SYM895_SCNTL2_VUE0 0x04 /* Vendor Unique Enhansements related */ +#define SYM895_SCNTL2_VUE1 0x02 /* Vendor Unique Enhansements related */ +#define SYM895_SCNTL2_WSR 0x01 /* Wide SCSI Receive */ + +/* SCNTL3 */ + +#define SYM895_SCNTL3_ULTRA 0x80 /* Ultra Enable */ +#define SYM895_SCNTL3_SCF_MASK 0x70 /* Syncronous Clock Conv. Factor bits */ +#define SYM895_SCNTL3_EWS 0x08 /* Enable WIDE SCSI */ +#define SYM895_SCNTL3_CCF_MASK 0x07 /* Clock Conversion Factor bits */ + +/* SCID */ + +#define SYM895_SCID_RRE 0x40 /* Enable Response to Reselection */ +#define SYM895_SCID_SRE 0x20 /* Enable Response to Selection */ +#define SYM895_SCID_ENC_MASK 0x0f /* The Encoded SCSI ID mask */ + +/* SXFER */ + +#define SYM895_SXFER_XFERP_MASK 0xE0 /* Synchronous transfer period */ +#define SYM895_SXFER_OFF_MASK 0x1f /* Sync. Transfer Max. Offset period */ + +/* SDID */ + +#define SYM895_SDID_ENC_MASK 0x0f /* The Encoded SCSI ID mask */ + +/* GPREG */ + +#define SYM895_GPREG_MASK 0x1f /* Mask for IO pins */ +#define SYM895_GPREG_GPIO4 0x10 /* Programmable IO Pin */ +#define SYM895_GPREG_GPIO3 0x08 /* Programmable IO Pin */ +#define SYM895_GPREG_GPIO2 0x04 /* Programmable IO Pin */ +#define SYM895_GPREG_GPIO1 0x02 /* Programmable IO Pin */ +#define SYM895_GPREG_GPIO0 0x01 /* Programmable IO Pin */ + +/* SOCL */ + +#define SYM895_SOCL_REQ 0x80 /* Assert SCSI REQ/ signal */ +#define SYM895_SOCL_ACK 0x40 /* Assert SCSI ACK/ signal */ +#define SYM895_SOCL_BSY 0x20 /* Assert SCSI BSY/ signal */ +#define SYM895_SOCL_SEL 0x10 /* Assert SCSI SEL/ signal */ +#define SYM895_SOCL_ATN 0x08 /* Assert SCSI ATN/ signal */ +#define SYM895_SOCL_MSG 0x04 /* Assert SCSI MSG/ signal */ +#define SYM895_SOCL_CD 0x02 /* Assert SCSI CD/ signal */ +#define SYM895_SOCL_IO 0x01 /* Assert SCSI IO/ signal */ + +/* SSID */ + +#define SYM895_SSID_VAL 0x80 /* SCSI Valid Bit.*/ +#define SYM895_SSID_ENC_MASK 0x0f /* Binary encoded SCSI ID mask 0-15 */ + +/* SBCL */ + +#define SYM895_SBCL_REQ 0x80 /* Get SCSI REQ/ Status */ +#define SYM895_SBCL_ACK 0x40 /* Get SCSI ACK/ Status */ +#define SYM895_SBCL_BSY 0x20 /* Get SCSI BSY/ Status */ +#define SYM895_SBCL_SEL 0x10 /* Get SCSI SEL/ Status */ +#define SYM895_SBCL_ATN 0x08 /* Get SCSI ATN/ Status */ +#define SYM895_SBCL_MSG 0x04 /* Get SCSI MSG/ Status */ +#define SYM895_SBCL_CD 0x02 /* Get SCSI CD/ Status */ +#define SYM895_SBCL_IO 0x01 /* Get SCSI IO/ Status */ + +/* DSTAT (RO) and DIEN (RW enable intr) */ + +#define SYM895_B_DFE 0x80 /* Dma fifo empty */ +#define SYM895_B_MDPE 0x40 /* Master Data Parity Error */ +#define SYM895_B_BF 0x20 /* Bus Fault */ +#define SYM895_B_ABT 0x10 /* Abort condition */ +#define SYM895_B_SSI 0x08 /* Scsi Step Interrupt */ +#define SYM895_B_SIR 0x04 /* Script Interrupt received */ +#define SYM895_B_IID 0x01 /* Illegal Instruction Detected */ + +/* SSTAT0 */ + +#define SYM895_SSTAT0_ILF 0x80 /* SIDL Input Latch Full */ +#define SYM895_SSTAT0_ORF 0x40 /* SODR Output Register Full */ +#define SYM895_SSTAT0_OLF 0x20 /* SODL Output Latch Full */ +#define SYM895_SSTAT0_AIP 0x10 /* Arbitration In Progress */ +#define SYM895_SSTAT0_LOA 0x08 /* LOst Arbitration */ +#define SYM895_SSTAT0_WOA 0x04 /* WOn Arbitration */ +#define SYM895_SSTAT0_RST 0x02 /* SCSI ReSeT signal in ISTAT reg */ +#define SYM895_SSTAT0_SDP0 0x01 /* SCSI SDP/0 parity signal */ + +/* SSTAT1 RO register */ + +#define SYM895_SSTAT1_FIFO_MASK 0xf0 /* Also..see the SSTAT2 register */ +#define SYM895_SSTAT1_SDP0L 0x08 /* Parity for latched scsi i/p data */ +#define SYM895_SSTAT1_MSG 0x04 /* SCSI:MSG Signal, latched */ +#define SYM895_SSTAT1_CD 0x04 /* SCSI:CD Signal,Latched */ +#define SYM895_SSTAT1_IO 0x04 /* SCSI:IO Signal, Latched */ + +/* SSTAT2 */ + +#define SYM895_SSTAT2_ILF1 0x80 /* SIDL MSB full */ +#define SYM895_SSTAT2_ORF1 0x40 /* SODR MSB full */ +#define SYM895_SSTAT2_OLF1 0x20 /* SODL MSB full */ +#define SYM895_SSTAT2_FF4 0x10 /* FIFO flags bit 4 */ +#define SYM895_SSTAT2_SPL1 0x08 /* Latched SCSI Parity for SIDL */ +#define SYM895_SSTAT2_DM 0x04 /* DIFFSENS Mismatch */ +#define SYM895_SSTAT2_LDSC 0x02 /* Last Disconnect;used in */ + /* conjunction with CON bit in SCNTL1*/ +#define SYM895_SSTAT2_SDP1 0x01 /* SCSI SDP1/ parity signal */ + +/* ISTAT RW register */ + +#define SYM895_ISTAT_ABRT 0x80 /* Abort operation */ +#define SYM895_ISTAT_SOFTRST 0x40 /* Soft chip reset */ +#define SYM895_ISTAT_SIGP 0x20 /* signal process */ +#define SYM895_ISTAT_SEM 0x10 /* Semaphore */ +#define SYM895_ISTAT_CON 0x08 /* stat connected (reset doesn't */ + /* disconnect) */ +#define SYM895_ISTAT_INTF 0x04 /* set by INTFLY script instruction.*/ + /* Signals ISRs while scripts are */ + /* still running */ +#define SYM895_ISTAT_SIP 0x02 /* SCSI Interrupt Pending */ +#define SYM895_ISTAT_DIP 0x01 /* Dma Interrupt Pending */ + +/* CTEST0 */ + +#define SYM895_CTEST1_FMT_MASK 0xf0 /* Byte Empty in DMA Fifo */ +#define SYM895_CTEST1_FFL_MASK 0x0f /* Byte Full in DMA Fifo */ + +/* CTEST2 */ + +#define SYM895_CTEST2_DDIR 0x80 /* Data Direction. 1 => From */ + /* SCSI to board */ +#define SYM895_CTEST2_SIGP 0x40 /* Signal Process. Same as in ISTAT.*/ + /* When this register is read SIGP */ + /* is cleared in ISTAT */ +#define SYM895_CTEST2_CIO 0x20 /* Configured as I/O */ +#define SYM895_CTEST2_CM 0x10 /* Configured as Memory */ +#define SYM895_CTEST2_SRTCH 0x08 /* Configure Scratch regs */ +#define SYM895_CTEST2_TEOP 0x04 /* Scsi True end of process */ +#define SYM895_CTEST2_DREQ 0x02 /* Data Request Status */ +#define SYM895_CTEST2_DACK 0x01 /* Data Acknowledge Status */ + +/* CTEST3 */ + +#define SYM895_CTEST3_REV_MASK 0xf0 /* Chip Revision Mask */ +#define SYM895_CTEST3_FLF 0x08 /* Flush DMA FIFO */ +#define SYM895_CTEST3_CLF 0x04 /* Clear DMA FIFO */ +#define SYM895_CTEST3_FM 0x02 /* Fetch Pin Mode */ +#define SYM895_CTEST3_WRIE 0x01 /* Write and Invalidate Enable */ + +/* DFIFO */ + +#define SYM895_FIFO_112_MASK 0x7f /* 7 bits of Byte Offset counter */ + /* between SCSI core and DMA core */ +#define SYM895_FIFO_816_MASK 0x3ff /* 10 bits (8 - DFIFO, 2 - CTEST5 ) */ + /* of SCSI Byte Offset counter */ + /* between SCSI core and DMA core */ + +/* CTEST4 */ + +#define SYM895_CTEST4_BDIS 0x80 /* Burst transfer DISable */ +#define SYM895_CTEST4_ZMOD 0x40 /* High Impedance Mode */ +#define SYM895_CTEST4_ZSD 0x20 /* SCSI data high impedance */ +#define SYM895_CTEST4_SRTM 0x10 /* Shadow Register Test Mode */ +#define SYM895_CTEST4_MPEE 0x08 /* Master Parity Error Enable */ +#define SYM895_CTEST4_FBL_MASK 0x07 /* Fifo byte control */ + +/* CTEST5 */ + +#define SYM895_CTEST5_ADCK 0x80 /* Increment DNAD register */ +#define SYM895_CTEST5_BBCK 0x40 /* Decrement DBC register */ +#define SYM895_CTEST5_DFS 0x20 /* DMA FIFO Size: 0=112, 1=816 bytes */ +#define SYM895_CTEST5_MASR 0x10 /* Master Ctrl for Set/Reset Pulses */ +#define SYM895_CTEST5_BL2 0x04 /* Burst Length bit 2 */ +#define SYM895_CTEST5_BO9 0x02 /* b9 of DMA Fifo byte offset counter*/ +#define SYM895_CTEST5_BO8 0x01 /* b8 of DMA Fifo byte offset counter*/ + +/* CTEST6 */ + +#define SYM895_CTEST6_DF_MASK 0xff /* Dma Fifo bits - mask */ + +/* DMODE RW register */ + +#define SYM895_DMODE_BL1 0x80 /* Burst Length transfer bits; */ + /* determine the number of transfers */ + /* per bus ownership */ +#define SYM895_DMODE_BL0 0x40 /* 00=2,01=4,10=8,11=16 */ +#define SYM895_DMODE_SIOM 0x20 /* Source I/O Memory Enable; */ + /* 1 => I/O */ +#define SYM895_DMODE_DIOM 0x10 /* Destination I/O Memory Enable; */ +#define SYM895_DMODE_ERL 0x08 /* Enable PCI Read Line command */ +#define SYM895_DMODE_ERMP 0x04 /* Enable PCI Read Multiple command */ +#define SYM895_DMODE_BOF 0x02 /* Burst Opcode Fetch enable; */ + /* instrs fetched in burst mode */ +#define SYM895_DMODE_MAN 0x01 /* Manual start mode ,when set */ + /* disable autostart script when */ + /* writting in DSP */ + +/* DCNTL - DMA Control bits */ + +#define SYM895_DCNTL_CLSE 0x80 /* Cache Line Size Enable */ +#define SYM895_DCNTL_PFF 0x40 /* Pre-Fetch Flush */ +#define SYM895_DCNTL_PFEN 0x20 /* Pre-Fetch ENable */ +#define SYM895_DCNTL_SSM 0x10 /* Single-Step Mode */ +#define SYM895_DCNTL_IRQM 0x08 /* IRQ Mode */ +#define SYM895_DCNTL_STD 0x04 /* Start Dma operation; */ +#define SYM895_DCNTL_IRQD 0x02 /* IRQ Disable */ +#define SYM895_DCNTL_COM 0x01 /* Compatability 1 => ncr700 mode */ + +/* + * SIEN0 (enable intr)and SIST0 (RO Status) + * Enable interrupt + */ + +#define SYM895_B_MA 0x80 /* Phase Mismatch / ATN interrupt*/ +#define SYM895_B_CMP 0x40 /* Funtion CoMPlete; interrupt when full */ + /* arbitration and selection is complete */ +#define SYM895_B_SEL 0x20 /* Selected; intr when selected as tgt */ +#define SYM895_B_RSL 0x10 /* Reselected; intr when reselected */ +#define SYM895_B_SGE 0x08 /* SCSI Gross Error; intr enable */ +#define SYM895_B_UDC 0x04 /* Enable Unexpected Disconnect intr */ +#define SYM895_B_RST 0x02 /* Enable Reset intr */ +#define SYM895_B_PAR 0x01 /* Enable parity intr */ + +/* SIEN1 (enable intr) and SIST1 (RO status) */ + +#define SYM895_B_SBMC 0x10 /* SCSI Bus Mode Change Interrupt */ +#define SYM895_B_STO 0x04 /* Selection/Reselection Timeout */ +#define SYM895_B_GEN 0x02 /* GENeral purpose timer expired */ +#define SYM895_B_HTH 0x01 /* Handshake to Handshake timer expired */ + +/* MACNTL - Memory Access Control (RW) */ + +#define SYM895_MACNTL_TYP_MASK 0xf0 /* Identify the chip type */ +#define SYM895_MACNTL_DWR 0x08 /* Data WRite is local memeory access */ +#define SYM895_MACNTL_DRD 0x04 /* Data ReaD is local memory access */ +#define SYM895_MACNTL_PSCPT 0x02 /* Pointer to SCRIPTs is local mem access*/ +#define SYM895_MACNTL_SCPTS 0x01 /* SCRIPTS fetch is local mem access */ + +/* + * GPCNTL - General Purpose Pin Control (RW) + * This reg is used to determine if GPREG pins are inputs or outputs + */ + +#define SYM895_GPCNTL_ME 0x80 /* Master Enable;internal busmaster:GPIO1*/ +#define SYM895_GPCNTL_FE 0x40 /* Fetch Enable; */ + /* internal op-code fetch GPIO0*/ +#define SYM895_GPCNTL_GPIO4 0x10 /* GPIO4: set - input and reset - output */ +#define SYM895_GPCNTL_GPIO3 0x08 /* GPIO3: set - input and reset - output */ +#define SYM895_GPCNTL_GPIO2 0x04 /* GPIO2: set - input and reset - output */ +#define SYM895_GPCNTL_GPIO1 0x02 /* GPIO1: set - input and reset - output */ +#define SYM895_GPCNTL_GPIO0 0x01 /* GPIO0: set - input and reset - output */ + +/* STIME0 SCSI Timer Zero (RW) */ + +/* These bits select various timeout values.e.g 0000 => disable; 1111 => 1.6s */ + +#define SYM895_STIME0_HTH_MASK 0xf0 /* Handshake-To-Handshake period mask*/ +#define SYM895_STIME0_SEL_MASK 0x0f /* SELection timeout mask */ + +/* STIME1 SCSI Timer One (RW) */ + +#define SYM895_STIME1_HTHBA 0x40 /* HTH Timer Bus Activity Enable */ +#define SYM895_STIME1_GENSF 0x20 /* General Purpose Timer Scale Factor */ +#define SYM895_STIME1_HTHSF 0x10 /* HTH Timer Scale Factor */ +#define SYM895_STIME1_GEN_MASK 0x0f /* GENeral timer timeout mask */ + +/* STEST0 SCSI Test Zero (RO) */ + +#define SYM895_STEST0_SSAID_MASK 0xf0 /* SCSI Selected As ID */ +#define SYM895_STEST0_SLT 0x08 /* Selection response logic test */ +#define SYM895_STEST0_ART 0x04 /* Arbitation Priority encoder Test */ +#define SYM895_STEST0_SOZ 0x02 /* SCSI Synchronous Offset Zero */ +#define SYM895_STEST0_SOM 0x01 /* SCSI Synchronous Offset Maximum */ + +/* STEST1 SCSI Test One (RW) */ + +#define SYM895_STEST1_SCLK 0x80 /* Disables external SCLK and uses */ + /* PCI internal SCSI clock */ +#define SYM895_STEST1_SISO 0x40 /* SCSI Isolation Mode; inputs */ + /* isolated from the SCSI bus */ +#define SYM895_STEST1_QEN 0x08 /* Enable: Power on clock Quadrupler */ +#define SYM895_STEST1_QSEL 0x04 /* Select: Increase clock to 160 MHz */ + +/* STEST2 SCSI Test Two (RW) */ + +#define SYM895_STEST2_SCE 0x80 /* SCSI Control Enable */ +#define SYM895_STEST2_ROF 0x40 /* Reset SCSI OFfset */ +#define SYM895_STEST2_DIF 0x20 /* SCSI Differential Mode */ +#define SYM895_STEST2_SLB 0x10 /* SCSI Loopback Mode */ +#define SYM895_STEST2_SZM 0x08 /* SCSI High-Impedance Mode */ +#define SYM895_STEST2_AWS 0x04 /* Always Wide SCSI */ +#define SYM895_STEST2_EXT 0x02 /* Extend SREQ/SACK filtering - */ + /* Should not be set during FAST */ + /* SCSI> 5MB/s */ +#define SYM895_STEST2_LOW 0x01 /* SCSI LOW level mode; no DMA */ + /* operation occur and no SCRIPTS */ + /* execute */ + +/* STEST3 SCSI Test Three (RW) */ + +#define SYM895_STEST3_TE 0x80 /* Tolerant Enable */ +#define SYM895_STEST3_STR 0x40 /* SCSI FIFO Test Read */ +#define SYM895_STEST3_HSC 0x20 /* Halt Scsi Clock */ +#define SYM895_STEST3_DSI 0x10 /* Disable Single Initiator */ + /* response (SCSI-1) */ +#define SYM895_STEST3_S16 0x08 /* 16-bit System */ +#define SYM895_STEST3_TTM 0x04 /* Timer Test Mode */ +#define SYM895_STEST3_CSF 0x02 /* Clear Scsi Fifo */ +#define SYM895_STEST3_STW 0x01 /* SCSI Fifo Test Write */ + +/* STEST4 SCSI Test Four (R) */ + +#define SYM895_STEST4_SMODE_MASK 0xc0 /* SCSI Mode Detect */ +#define SYM895_STEST4_LOCK 0x20 /* Detect Clock Quadrupler Lockup */ + +/* Byte Offsets of On-Chip Registers from the base address */ + +/* + * The registers can be accessed in two ways.One is using Memory IO base addr + * plus the offset and the other by using PCI config base addr plus offset. + * These registers are part of PCI configuration space for the device. + */ + +#define MEMIO_REG_BASE (0x00) +#define PCI_CONFIG_REG_BASE (0x80) +#define BASE MEMIO_REG_BASE + +/* Little Endian offsets */ + +#define SYM895_OFF_SCNTL0 (BASE) /* SCTNL0 SCSI control register 0 */ +#define SYM895_OFF_SCNTL1 (BASE + 0x01) /* SCTNL1 SCSI control register 1 */ +#define SYM895_OFF_SCNTL2 (BASE + 0x02) /* SCTNL2 SCSI control register 2 */ +#define SYM895_OFF_SCNTL3 (BASE + 0x03) /* SCTNL3 SCSI control register 3 */ +#define SYM895_OFF_SCID (BASE + 0x04) /* SCID SCSI chip ID register */ +#define SYM895_OFF_SXFER (BASE + 0x05) /* SXFER SCSI chip ID register */ +#define SYM895_OFF_SDID (BASE + 0x06) /* SDID SCSI destination ID */ +#define SYM895_OFF_GPREG (BASE + 0x07) /* GPREG General Purpose register */ +#define SYM895_OFF_SFBR (BASE + 0x08) /* SFBR SCSI first byte received */ +#define SYM895_OFF_SOCL (BASE + 0x09) /* SOCL SCSI output control latch */ +#define SYM895_OFF_SSID (BASE + 0x0a) /* SSID SCSI selector ID */ +#define SYM895_OFF_SBCL (BASE + 0x0b) /* SBCL SCSI bus control lines */ +#define SYM895_OFF_DSTAT (BASE + 0x0c) /* DSTAT DMA status register */ +#define SYM895_OFF_SSTAT0 (BASE + 0x0d) /* SSTAT0 SCSI status register 0 */ +#define SYM895_OFF_SSTAT1 (BASE + 0x0e) /* SSTAT1 SCSI status register 0 */ +#define SYM895_OFF_SSTAT2 (BASE + 0x0f) /* SSTAT2 SCSI status register 0 */ +#define SYM895_OFF_DSA (BASE + 0x10) /* 32-bit DSA data structure */ + /* address */ +#define SYM895_OFF_ISTAT (BASE + 0x14) /* 8-bit ISTAT interrupt status */ +#define SYM895_OFF_CTEST0 (BASE + 0x18) /* CTEST0 chip test register 0 */ +#define SYM895_OFF_CTEST1 (BASE + 0x19) /* CTEST1 chip test register 1 */ +#define SYM895_OFF_CTEST2 (BASE + 0x1a) /* CTEST2 chip test register 2 */ +#define SYM895_OFF_CTEST3 (BASE + 0x1b) /* CTEST3 chip test register 3 */ +#define SYM895_OFF_TEMP (BASE + 0x1c) /* 32-bit TEMP temporary holding */ + /* register */ +#define SYM895_OFF_DFIFO (BASE + 0x20) /* DFIFO DMA FIFO control register */ +#define SYM895_OFF_CTEST4 (BASE + 0x21) /* CTEST4 chip test register 4 */ +#define SYM895_OFF_CTEST5 (BASE + 0x22) /* CTEST5 chip test register 5 */ +#define SYM895_OFF_CTEST6 (BASE + 0x23) /* CTEST6 chip test register 6 */ +#define SYM895_OFF_DBC (BASE + 0x24) /* 24-bit DBC SIOP command reg.*/ +#define SYM895_OFF_DCMD (BASE + 0x27) /* 8-bit DCMD SIOP command register */ +#define SYM895_OFF_DNAD (BASE + 0x28) /* 32-bit DNAD DMA buffer ptr */ + /* (next addr) */ +#define SYM895_OFF_DSP (BASE + 0x2c) /* 32-bit DSP SIOP scripts pointer */ + /* register */ +#define SYM895_OFF_DSPS (BASE + 0x30) /* 32-bit DSPS SIOP scripts ptr */ + /* save register */ +#define SYM895_OFF_DMODE (BASE + 0x38) /* DMODE DMA operation mode */ + /* register */ +#define SYM895_OFF_DIEN (BASE + 0x39) /* DIEN DMA interrupt enable */ +#define SYM895_OFF_DWT (BASE + 0x3a) /* DWT DMA watchdog timer register */ +#define SYM895_OFF_DCNTL (BASE + 0x3b) /* DCTNL DMA control register */ +#define SYM895_OFF_ADDER (BASE + 0x3c) /* 32-bit ADDER Adder output */ + /* Register */ +#define SYM895_OFF_SIEN0 (BASE + 0x40) /* SIEN0 SCSI interrupt enable 0 */ + /* register */ +#define SYM895_OFF_SIEN1 (BASE + 0x41) /* SIEN1 SCSI interrupt enable 1 */ + /* register */ +#define SYM895_OFF_SIST0 (BASE + 0x42) /* SIST0 SCSI interrupt status 0 */ + /* register */ +#define SYM895_OFF_SIST1 (BASE + 0x43) /* SIST1 SCSI interrupt status 1 */ + /* register */ +#define SYM895_OFF_SLPAR (BASE + 0x44) /* SLPAR SCSI longitudinal Parity*/ + /* register */ +#define SYM895_OFF_SWIDE (BASE + 0x45) /* SWIDE SCSI Wide Residue */ +#define SYM895_OFF_MACNTL (BASE + 0x46) /* MACNTL Memory Access Control */ + /* register */ +#define SYM895_OFF_GPCNTL (BASE + 0x47) /* GPCNTL General Purpose Pin */ + /* Control */ +#define SYM895_OFF_STIME0 (BASE + 0x48) /* STIME0 SCSI Timer Zero reg */ +#define SYM895_OFF_STIME1 (BASE + 0x49) /* STIME1 SCSI Timer One reg */ +#define SYM895_OFF_RESPID0 (BASE + 0x4a) /* RESPID Response ID register 0 */ +#define SYM895_OFF_RESPID1 (BASE + 0x4b) /* RESPID Response ID register 1 */ +#define SYM895_OFF_STEST0 (BASE + 0x4c) /* STEST0 SCSI Test 0 register */ +#define SYM895_OFF_STEST1 (BASE + 0x4d) /* STEST1 SCSI Test 1 register */ +#define SYM895_OFF_STEST2 (BASE + 0x4e) /* STEST2 SCSI Test 2 register */ +#define SYM895_OFF_STEST3 (BASE + 0x4f) /* STEST3 SCSI Test 3 register */ +#define SYM895_OFF_SIDL (BASE + 0x50) /* 16-bit SIDL SCSI input data */ + /* latch register */ +#define SYM895_OFF_STEST4 (BASE + 0x52) /* STEST4 SCSI Test 4 register */ +#define SYM895_OFF_SODL (BASE + 0x54) /* 16-bit SCSI output data latch */ + /* register */ +#define SYM895_OFF_SBDL (BASE + 0x58) /* 16-bit SBDL SCSI bus data lines */ + /* register */ + +#define SYM895_OFF_SCRATCHA0 (BASE + 0x34) /* SCRATCHA0 gen purpose */ + /* scratch register A0 */ +#define SYM895_OFF_SCRATCHA1 (BASE + 0x35) /* SCRATCHA1 gen purpose */ + /* scratch reg A1 */ +#define SYM895_OFF_SCRATCHA2 (BASE + 0x36) /* SCRATCHA2 gen purpose */ + /* scratch reg A2 */ +#define SYM895_OFF_SCRATCHA3 (BASE + 0x37) /* SCRATCHA3 gen purpose */ + /* scratch reg A3 */ +#define SYM895_OFF_SCRATCHB0 (BASE + 0x5c) /* SCRATCHB0 gen purpose */ + /* scratch reg B0 */ +#define SYM895_OFF_SCRATCHB (BASE + 0x5c) /* SCRATCHB Scratch Register B */ +#define SYM895_OFF_SCRATCHC0 (BASE + 0x60) /* SCRATCHC Scratch Register C */ +#define SYM895_OFF_SCRATCHC1 (BASE + 0x61) /* SCRATCHC Scratch Register C */ +#define SYM895_OFF_SCRATCHC2 (BASE + 0x62) /* SCRATCHC Scratch Register C */ +#define SYM895_OFF_SCRATCHC (BASE + 0x60) /* SCRATCHC Scratch Register C */ +#define SYM895_OFF_SCRATCHD (BASE + 0x64) /* SCRATCHD Scratch Register D */ +#define SYM895_OFF_SCRATCHE (BASE + 0x68) /* SCRATCHE Scratch Register E */ +#define SYM895_OFF_SCRATCHF (BASE + 0x6c) /* SCRATCHF Scratch Register F */ +#define SYM895_OFF_SCRATCHG (BASE + 0x70) /* SCRATCHG Scratch Register G */ +#define SYM895_OFF_SCRATCHH (BASE + 0x74) /* SCRATCHH Scratch Register H */ +#define SYM895_OFF_SCRATCHI (BASE + 0x78) /* SCRATCHI Scratch Register I */ +#define SYM895_OFF_SCRATCHJ (BASE + 0x7C) /* SCRATCHJ Scratch Register J */ + +/* + * The Device Id's (required for finding the device on PCI Bus) + * for the SYM895 Chip. Note that NCR895 and SYM895 are both the same. + * the SCSI division of NCR is now Symbios, which is taken over by LSI logic + */ + +#define NCR810_DEVICE_ID 0x0001 +#define NCR825_DEVICE_ID 0x0003 +#define NCR875_DEVICE_ID 0x000f +#define NCR895_DEVICE_ID 0x000c +#define NCR895A_DEVICE_ID 0x0012 +#define SYM895_DEVICE_ID NCR895_DEVICE_ID +#define PCI_ID_SYMBIOS 0x1000 + +/* + * The Block Move Counter Mask. + * The DBC register in sym895 holds the number of bytes transferred in + * a Block Move instruction. It is also used to hold the least significant + * 24 bits of the first dword of a SCRIPTS fetch. For more details, please + * refer to chap 5, of the 895 data manual. + * The maximum value that it can store is 0x00ffffff (24 bits only). + */ + +#define SYM895_COUNT_MASK ((UINT)0x00ffffff) + +/* + * As a part of the SCSI Thread, the target parameters are to be set + * in the thread context. These parameters are encoded. Device (target)id + * and a copy of the sxfer register are to be encoded in a single 32 bit word. + * Bits 23-16 specify the target bus id(mapped to SDID register) and bits 15-08 + * specify the copy of sxfer register. Refer to 8-8 of PCI-SCSI Programming + * guide. + */ + +#define SYM895_TARGET_BUS_ID_SHIFT 16 +#define SYM895_XFER_PARAMS_SHIFT 8 + +/* + * Allowable SCSI Synchronous Offset and Transfer period values. + * Please refer to chap 2, the Functional description and chap 5, Operating + * registers of sym895 data manual, for more details. + */ + +#define SYM895_MIN_SYNC_OFFSET 1 +#define SYM895_MAX_SYNC_OFFSET 31 +#define SYM895_ASYNC_OFFSET 0 /* Sync. Offset should be 0x00 */ + /* for asynchronous xfers */ + +/* Allowable values for SCSI Sync. transfer period in XFERP register */ + +#define SYM895_MIN_XFERP 4 +#define SYM895_MAX_XFERP 11 /* Not recommended.see the manual */ +#define SYM895_IDEAL_XFERP 4 + +#define SYM895_SYNC_XFER_PERIOD_SHIFT 5 /* PERIOD is Bits 7-5 of XFER reg */ + +/* The Value of sxfer register for asynchronous transfers */ + +#define SYM895_ASYNC_SXFER 0x00 + +/* + * Synchronous Transfer : Clock division factor + * Refer to chap 5, Operating Registers, SCNTL3 register bits SCF2-0 + */ + +#define SYM895_SYNC_MIN_CLK_DIV 1 +#define SYM895_SYNC_MAX_CLK_DIV 7 + +#define SYM895_SYNC_CLK_DIV_1 1 /* SCLK / 1 */ +#define SYM895_SYNC_CLK_DIV_1_5 2 /* SCLK / 1.5 */ +#define SYM895_SYNC_CLK_DIV_2 3 /* SCLK / 2 */ +#define SYM895_SYNC_CLK_DIV_3 4 /* SCLK / 3 */ +#define SYM895_SYNC_CLK_DIV_4 5 /* SCLK / 4 */ +#define SYM895_SYNC_CLK_DIV_6 6 /* SCLK / 6 */ +#define SYM895_SYNC_CLK_DIV_8 7 /* SCLK / 8 */ + +/* + * Asynchronous Transfer : Clock conversion factor + * Refer to chap 5, Operating Registers, SCNTL3 register + * Bits CCF2-0. + */ + +#define SYM895_ASYNC_MIN_CLK_DIV 1 /* 16.67 - 25 MHz */ +#define SYM895_ASYNC_MAX_CLK_DIV 7 /* 160 MHz : The clock quadrupler */ + /* bit must be set */ + +/* prescale factor for asynchronous scsi core (scntl3) */ + +#define SYM895_16MHZ_ASYNC_DIV 0x01 /* 16.67-25.00Mhz input clock */ +#define SYM895_25MHZ_ASYNC_DIV 0x02 /* 25.01-37.50Mhz input clock */ +#define SYM895_3750MHZ_ASYNC_DIV 0x03 /* 37.51-50.00Mhz input clock */ +#define SYM895_50MHZ_ASYNC_DIV 0x04 /* 50.01-75.00Mhz input clock */ + +/* + * Note: 70MHz & 160MHz value has Ultra Enable bit set (b7). + * When Ultra enable bit is set, the Tolerant Enable bit must also be set . + * It is STEST3:TE (bit 7). + */ + +#define SYM895_75MHZ_ASYNC_DIV 0x85 /* 75.01-80.00Mhz input clock */ + +/* 160.00 Mhz input clock with clock quadrupler and 40 Mhz input clock */ + +#define SYM895_160MHZ_ASYNC_DIV 0x87 + +/* Nano Seconds x 100 clock period */ + +#define SYM895_1667MHZ 6000 /* 16.67Mhz chip */ +#define SYM895_20MHZ 5000 /* 20Mhz chip */ +#define SYM895_25MHZ 4000 /* 25Mhz chip */ +#define SYM895_3750MHZ 2667 /* 37.50Mhz chip */ +#define SYM895_40MHZ 2500 /* 40Mhz chip */ +#define SYM895_50MHZ 2000 /* 50Mhz chip */ +#define SYM895_66MHZ 1515 /* 66Mhz chip */ +#define SYM895_6666MHZ 1500 /* 66Mhz chip */ +#define SYM895_75MHZ 1333 /* 75Mhz chip */ +#define SYM895_80MHZ 1250 /* 80Mhz chip */ +#define SYM895_160MHZ 625 /* 40Mhz chip with Quadrupler */ + +/* Timer values for General Purpose Timer (STIME1) */ + +#define SYM895_GEN_DISABLED 0x00 /* Disabled */ +#define SYM895_GEN_128MS 0x0B /* 128 MS */ +#define SYM895_GEN_64MS 0x0A /* 64 MS */ + +/* Various Bus Modes supported by 895 */ + +#define SYM895_BUSMODE_LVD 3 +#define SYM895_BUSMODE_SE 2 +#define SYM895_BUSMODE_HVD 1 + +#define SYM895_BUSMODE_SHIFT 6 + +#define SYM895_MAX_XFER_WIDTH 1 /* in transfer width exponent units.*/ + /* 16bits. */ + +#define SYM895_TYPE 0x895 /* Chip Type; */ + +/* sym895 PCI Resources */ + +#define SYM895_MEMBASE 0xf5200000 +#define SYM895_MEMSIZE 0x00001000 /* memory size for Int.RAM, 4KB */ +#define SYM895_RAM_ADR (SYM895_MEMBASE) +#define SYM895_MEM_ADR (SYM895_MEMBASE + SYM895_MEMSIZE) +#define SYM895_IO_ADR 0xf800 +#define SYM895_INT_LVL 0x0a +#define SYM895_INIT_STATE_MASK (VM_STATE_MASK_FOR_ALL) +#define SYM895_INIT_STATE (VM_STATE_FOR_IO) + +#define SYM895_DEV_MMU_MSK (~(VM_PAGE_SIZE - 1)) /* Mask MMU page */ +#define SYM895_DEV_ADRS_SIZE VM_PAGE_SIZE * 2 /* two pages */ + +/* Controller Options, while creating the Controller Structure */ + +#define SYM895_ENABLE_PARITY_CHECK 0x01 +#define SYM895_ENABLE_SINGLE_STEP 0x02 +#define SYM895_COPY_SCRIPTS 0x04 + +/* SCRIPT ram Size for various controllers */ + +#define SYM895_SCRIPT_RAM_SIZE 4*1024 /* bytes */ + +/* + * Chip register access mode (memory mapped / IO). If SYM895_IO_MAPPED is + * defined, then IO Base Address (PCI BAR 0) is used for all register access. + * If not defined, then Memory Base Address(PCI BAR 1) is used. + */ + +#define SYM895_IO_MAPPED /* IO mapped access by default */ + +/* Loopback diagnostics */ + +#define LOOPBACK_MSG_BYTE 0xa5 +#define LOOPBACK_DATA 0x5a5a + +/* + * Structure , used as an interface between the C Code and the Scripts. + * used for storing data in Block Move instructions. + */ + +typedef struct moveParams + { + + ULONG size; /* # bytes to move to/from SCSI */ + + UINT8 *addr; /* where in memory they go/come */ + + } MOVE_PARAMS; + + +/* + * This has to be defined to include support for SCATTER-GATHER memory + * operations. + */ + +/* #define SCATTER_GATHER */ + +/* Maximum number of scattered data elements. */ + +#define MAX_NO_OF_SCAT_ELEMENTS 255 + +/* + * Structure to hold the scattered data, to be gathered by the SIOP while + * in scripts. Gathered Data is transferred using chained block moves, one + * after the other (block wise) with out the intervention of the host. + */ + +typedef struct scatGather + { + + ULONG noElems; /* No of places to gather the scattered the data */ + + MOVE_PARAMS Elements[MAX_NO_OF_SCAT_ELEMENTS]; + + } SCAT_DATA; + +/* + * Shared structure defining all information about a SCSI connection + * visible to the script. + * For more details, please refer to PCI-SCSI programmers guide (8) + * Every element in this structure _must_ be aligned on + * a 4-byte boundary, otherwise the script will fail (illegal instruction). + */ + +typedef struct sym895Shared + { + + ULONG device; /* target bus ID, sync xfer params */ + + MOVE_PARAMS command; /* command bytes sent to target */ + + MOVE_PARAMS dataIn; /* data bytes from target */ + + MOVE_PARAMS dataOut; /* data bytes to target */ + + MOVE_PARAMS status; /* command status byte from target */ + + MOVE_PARAMS identOut; /* outgoing identification msg */ + + MOVE_PARAMS identIn; /* incoming identification msg */ + + MOVE_PARAMS msgOut; /* message bytes sent to target */ + + MOVE_PARAMS msgIn; /* message bytes recvd from target */ + + MOVE_PARAMS msgInSecond; /* second byte of multi-byte msg */ + + MOVE_PARAMS msgInRest; /* remainder of multi-byte message */ + +#ifdef SCATTER_GATHER + + SCAT_DATA scatData; /* scatter - gather memory moves */ + +#endif + + } SYM895_SHARED; + +/* The Typedefs and the structure definitions */ + +/* + * Shared structure exclusively used by the diagnostic scripts for + * loopback mode. Every element of this structure must be 4-byte aligned. + */ + +typedef struct sym895Loopback +{ + + ULONG device ; /* target bus ID, sync xfer params */ + + MOVE_PARAMS identOut ; /* Identify buffer for loopback mode */ + + MOVE_PARAMS dataOut ; /* data buffer for loopback mode */ + +} SYM895_LOOPBACK; + + +/* Sym895 Thread strcuture. */ + +typedef struct sym895Thread + { + + SCSI_THREAD scsiThread ; /* generic SCSI Thread */ + + struct sym895Shared * pShMem ; /* Pointer to SIOP shared */ + /* data area */ + + struct sym895Shared * pShMemDuplicate ; /* Pointer to SIOP */ + /* shared data area */ + + /* + * Every thread has its own context, which is the image of some of the + * SIOP registers. Whenever the execution comes out of thread, the + * current values of those registers are saved in these variables, and + * retreived, when the execution is back to the thread. + */ + + UINT8 nHostFlags; /* Scratch A register byte 0 */ + UINT8 msgOutStatus; /* Scratch A register byte 1 */ + UINT8 msgInStatus; /* Scratch A register byte 2 */ + UINT8 targetId; /* Scratch A register byte 3 */ + UINT8 busPhase; /* Scratch B register byte 0 */ + + UINT8 sxfer; /* SXFER register */ + UINT8 scntl3; /* SCNTL3 registers */ + + /* scatter gather memory support */ + + UINT8 isScatTransfer; /* Scratch C register byte 0 */ + UINT8 totalScatElements; /* Scratch C register byte 1 */ + UINT8 noRemaining; /* Scratch C register byte 2 */ + + }SYM895_THREAD; + +/* Sym895 Event Structure. */ + +typedef struct sym895Event + { + + SCSI_EVENT scsiEvent ; /* generic SCSI Event */ + UINT remCount ; /* Remaining Byte Count */ + /* (Phase Mismatch) */ + }SYM895_EVENT; + +/* + * Script Entry Point Identifiers. These are the 4 Scripts that VxWorks + * requires. If some more are to be added, they have to be added here and in + * sym895StartScript() to ensure that the script starts when required. + */ + +typedef enum sym895ScriptEntries + { + + SYM895_SCRIPT_WAIT = 0, /* Wait for ReSelect or Host Command */ + SYM895_SCRIPT_INIT_START, /* Start an Initiator Thread */ + SYM895_SCRIPT_INIT_CONTINUE, /* Continue an Initiator Thread */ + SYM895_SCRIPT_TGT_DISCONNECT, /* Disconnect a Target Thread */ + SYM895_SCRIPT_DIAG + + }SYM895_SCRIPT_ENTRY; + +/* SIOP operating States */ + +typedef enum sym895State + { + + SYM895_STATE_IDLE = 0, /* Not running any script */ + SYM895_STATE_PASSIVE, /* Wait for ReSelect or Host Command */ + SYM895_STATE_ACTIVE /* Running a script */ + + }SYM895_STATE; + +/* + * SIOP hardware configuration structure. This is used to set/reset various + * options available in SYM895. This is used as a parameter for the + * sym895SetHWOptions() functions. This is a bit-field structure and has + * to be operated with caution. + * + * Note : AWS bit affects all the SCSI phases while EWS bit affects only the + * data transfers. EWS, unlike AWS, doesn't affect the command, status and + * message phases. + */ + +typedef struct sym895HWOptions + { + + UINT SCLK : 1; /* STEST1:b7,if false,uses PCI Clock for SCSI*/ + UINT QEN : 1; /* STEST1:b3, Clock Quadrapler Enable */ + UINT SCE : 1; /* STEST2:b7,enable assertion of SCSI thro SOCL */ + /* and SODL registers */ + UINT DIF : 1; /* STEST2:b5, enable differential SCSI */ + UINT AWS : 1; /* STEST2:b2, Always Wide SCSI */ + UINT EWS : 1; /* SCNTL3:b3, Enable Wide SCSI */ + UINT EXTEND : 1; /* STEST2:b1, Extend SREQ/SACK filtering */ + UINT TE : 1; /* STEST3:b7, TolerANT Enable */ + UINT BL : 3; /* DMODE:b7,b6, CTEST5:b2 : Burst length */ + /* when set to any of 32/64/128 burst length */ + /* transfers, requires the DMA Fifo size to be */ + /* 816 bytes (ctest5:b5 = 1). */ + UINT SIOM : 1; /* DMODE:b5, Source I/O Memory Enable */ + UINT DIOM : 1; /* DMODE:b4, Destination I/O Memory Enable */ + UINT EXC : 1; /* SCNTL1:b7, Slow Cable Mode */ + UINT ULTRA : 1; /* SCNTL3:b7, Ultra Enable */ + UINT DFS : 1; /* CTEST5:b5, DMA Fifo size 112/816 bytes */ + + }SYM895_HW_OPTIONS; + +/* + * The Default HW Options as the driver initialies the Sym 895 Chip + * These options SHOULD correspond to the above mentioned structure. + * + * Use SCSI Clock and not PCI clock + * Enable Clock Quadrapler + * SCSI signal assertion through regsiters - disable + * Disable High Voltage differential SCSI + * Not always WIDE SCSI + * Enable Wide SCSI + * No filtering via SREQ/ SACK + * TolerANT Enable + * 128 burst transfer + * Disable IO mode for both source and destination + * No slow cable mode + * Ultra SCSI + * DMA Fifo size - 816 bytes + * + * NOTE: These options can be overriden by sym895SetHwOptions() call in + * "sysScsi.c". + */ + +#define SYM895_ULTRA2_SCSI_OPTIONS { 0,1,0,0,0,1,0,1,6,0,0,0,1,1 } + +#define SYM895_FAST_SCSI_OPTIONS { 0,0,0,0,0,1,0,1,6,0,0,0,0,1 } + +/* + * SCSI Controller Structure + * + * This the structure describing the SCSI controller chip and the SCSI + * parameters used on the SCSI Bus. This structure also contains the + * shared memory areas and the Thread information like what threads is + * being executed by the SCRIPT processor currently and what script is + * scheduled to run next etc. + * + * As this structure contains shared memory areas which are accessed + * by both the SCSI controller and the CPU, this entire structure and + * its memory buffers must be located in the cache-coherent memory, safe for + * the dma transfers. + */ + +typedef struct sym895ScsiCtrl + { + + SCSI_CTRL scsiCtrl; /* generic SCSI Controller info. */ + /* used by both the driver and SCSI */ + /* Manager.*/ + + SEM_ID singleStepSem; /* used to debug script */ + + SYM895_STATE state; /* Current state of the controller */ + + UINT clkPeriod; /* Clock Period; nSec*100 */ + + UINT clkDiv; /* SYNC/ASYNC clock divisor */ + + UINT devType; /* Currently 895 */ + + BOOL isParityCheck; /* Enable/Disable Paritychecks on Bus*/ + + BOOL isScriptsCopy; /* Copy SCRIPTS to on-chip RAM */ + + BOOL isCmdPending; /* Is there a new command to start */ + + BOOL isSingleStep; /* is Single Step Debugging enabled */ + + /* + * The following identMsg buffer is used for initialising the pointer + * for the current thread's IdentOut Message buffer. This buffer is also + * defined in the SCSI_THREAD structure and was previously used for the + * IdentOut Message buffer. The additional 5 bytes are for wide/sync SCSI + */ + + UINT8 identMsg[SCSI_MAX_IDENT_MSG_LENGTH + 5]; + + UINT identMsgLength; + + SYM895_THREAD * pCurThread; /* Thread corresponding to current */ + /* running script */ + + SYM895_THREAD * pNewThread; /* Thread to be activated next */ + + SYM895_SHARED * pIdentShMem; /* Shared Data Area for Identification */ + /* Thread */ + + SYM895_SHARED * pClientShMem; /* Shared Data Area for Client thread*/ + + + volatile UINT8 * baseAddress; /* Address where the Chip is mapped */ + /* in memory */ + + volatile UINT8 * siopRamBaseAddress; /* Base Address for internal Ram */ + + SYM895_HW_OPTIONS hwOptions; /* 895 Options used/not being used */ + + }SYM895_SCSI_CTRL; + +/* Function Declarations */ + +IMPORT SYM895_SCSI_CTRL * sym895CtrlCreate ( + UINT8 * siopBaseAdrs, + UINT clkPeriod, + UINT16 devType, + UINT8 * siopRamBaseAdrs, + UINT16 flags + ); + +IMPORT STATUS sym895CtrlInit ( + SYM895_SCSI_CTRL * pSiop, + UINT scsiCtrlBusId + ); + +IMPORT STATUS sym895SetHwOptions ( + SYM895_SCSI_CTRL * pSiop, + SYM895_HW_OPTIONS * pHwRegs + ); + +IMPORT void sym895Intr (SYM895_SCSI_CTRL * pSiop); + +IMPORT STATUS sym895Show (SYM895_SCSI_CTRL * pSiop); + +IMPORT void sym895StepEnable (SYM895_SCSI_CTRL * pSiop, BOOL enable); + +IMPORT void sym895SingleStep (SYM895_SCSI_CTRL * pSiop, BOOL verbose); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus + +} + +#endif /* __cplusplus */ + +#endif /* __INCsym895h */ diff --git a/h/drv/scsi/wd33c93.h b/h/drv/scsi/wd33c93.h new file mode 100644 index 0000000..a0cd884 --- /dev/null +++ b/h/drv/scsi/wd33c93.h @@ -0,0 +1,25 @@ +/* wd33c93.h - SCSI library header file */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,26apr02,dat Adding cplusplus protection, SPR 75017 +01a,10oct94,jds written for SCSI1 and SCSI2 compatability +*/ + +#ifndef __INCwd33c93h +#define __INCwd33c93h + +#ifndef INCLUDE_SCSI2 + +#include "wd33c93_1.h" + +#else + +#include "wd33c93_2.h" + +#endif /* INCLUDE_SCSI2 */ + +#endif /* __INCwd33c93 */ diff --git a/h/drv/scsi/wd33c93_1.h b/h/drv/scsi/wd33c93_1.h new file mode 100644 index 0000000..683dbf9 --- /dev/null +++ b/h/drv/scsi/wd33c93_1.h @@ -0,0 +1,266 @@ +/* wd33c93_1.h - Western Digital WD33C93 SBIC (SCSI-Bus Interface Ctrl) header +*/ + +/* Copyright 1984-1994 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01o,10oct94,jds fixed for SCSI1 and SCSI2 compatability +01n,22sep92,rrr added support for c++ +01m,22jul92,wmd added definition of WDREG. +01l,03jun92,ccc added control register bits. +01k,26may92,rrr the tree shuffle +01j,26may92,ajm got rid of HOST_DEC def's (new compiler) +01i,21apr92,ccc added sbicXferCountSet() declaration. +01h,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01g,28sep91,ajm ifdef'd HOST_DEC for compiler problem +01f,24oct90,dnw declarations for void routines. +01e,19oct90,jcc changed SBIC to WD_33C93_SCSI_CTRL in ANSI function prototypes; + removed unused macros. +01d,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01c,20aug90,jcc changed UTINY to UINT8. +01b,18jul90,jcc moved _ASMLANGUAGE conditionals to encompass entire file. +01a,27feb90,jcc written based on old version from EDI +*/ + +#ifndef __INCwd33c93_1h +#define __INCwd33c93_1h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "scsiLib.h" + +typedef struct /* WD_33C93_SCSI_CTRL - Western Digital wd33c93 + SCSI controller info */ + { + SCSI_CTRL scsiCtrl; /* generic SCSI controller info */ + SCSI_PHYS_DEV *pDevToSelect;/* device to select at intr. level or NULL */ + int devType; /* type of device (see define's below) */ + FUNCPTR sbicScsiReset; /* function to perform RESET on SCSI bus */ + UINT8 scsiStatusCode; /* status code of last interrupt */ + UINT8 defaultSelTimeOut; /* default dev. select time-out (units var.) */ + volatile UINT8 *pAdrsReg; /* ptr address reg.*/ + volatile UINT8 *pAuxStatReg;/* ptr aux. status reg.*/ + volatile UINT8 *pRegFile; /* ptr register file */ + } WD_33C93_SCSI_CTRL; + +typedef struct wd33c93functbl + { + FUNCPTR sbicCommand; + FUNCPTR sbicIntr; + FUNCPTR sbicRegRead; + FUNCPTR sbicRegWrite; + FUNCPTR sbicXferCountGet; + FUNCPTR sbicXferCountSet; + FUNCPTR wd33c93CtrlInit; + FUNCPTR wd33c93Show; + } SCSIDRV_FUNC_TBL; + +/* SBIC device type */ + +#define SBIC_WD33C93 0 +#define SBIC_WD33C93A 1 + +/* SBIC command set */ + +#define SBIC_CMD_RESET ((UINT8) 0x00) +#define SBIC_CMD_ABORT ((UINT8) 0x01) +#define SBIC_CMD_SET_ATN ((UINT8) 0x02) +#define SBIC_CMD_NEG_ACK ((UINT8) 0x03) +#define SBIC_CMD_DISCONNECT ((UINT8) 0x04) +#define SBIC_CMD_RESELECT ((UINT8) 0x05) +#define SBIC_CMD_SEL_ATN ((UINT8) 0x06) +#define SBIC_CMD_SELECT ((UINT8) 0x07) +#define SBIC_CMD_SEL_ATN_XFER ((UINT8) 0x08) +#define SBIC_CMD_SELECT_XFER ((UINT8) 0x09) +#define SBIC_CMD_RESELECT_RECV ((UINT8) 0x0a) +#define SBIC_CMD_RESELECT_SEND ((UINT8) 0x0b) +#define SBIC_CMD_WAIT_SEL_RCV ((UINT8) 0x0c) +#define SBIC_CMD_RECV_CMD ((UINT8) 0x10) +#define SBIC_CMD_RECV_DATA ((UINT8) 0x11) +#define SBIC_CMD_RECV_MSG_OUT ((UINT8) 0x12) +#define SBIC_CMD_RECV_INFO_OUT ((UINT8) 0x13) +#define SBIC_CMD_SEND_STATUS ((UINT8) 0x14) +#define SBIC_CMD_SEND_DATA ((UINT8) 0x15) +#define SBIC_CMD_SEND_MSG_IN ((UINT8) 0x16) +#define SBIC_CMD_SEND_INFO_IN ((UINT8) 0x17) +#define SBIC_CMD_XLATE_ADDR ((UINT8) 0x18) +#define SBIC_CMD_XFER_INFO ((UINT8) 0x20) +#define SBIC_CMD_XFER_PAD ((UINT8) 0x21) +#define SBIC_CMD_SING_BYTE_XFER ((UINT8) 0x80) + +/* Status Register Codes */ + +#define STAT_GROUP(arg) ((arg) & 0xf0) /* reason for interrupt */ +#define STAT_CODE(arg) ((arg) & 0x0f) /* detail about reason */ +#define STAT_XFER(arg) ((arg) & 0x08) /* transfer was in progress */ + +#define STAT_MCI_BITS ((UINT8) 0x07) /* MSG, C/D and I/O bits */ +#define STAT_PHASE_REQ ((UINT8) 0x08) + +#define STAT_GROUP_RESET ((UINT8) 0x00) +#define STAT_GROUP_SUCCESSFUL ((UINT8) 0x10) +#define STAT_GROUP_PAUSE_ABORTED ((UINT8) 0x20) +#define STAT_GROUP_TERMINATED ((UINT8) 0x40) +#define STAT_GROUP_SERVICE_REQ ((UINT8) 0x80) + +#define STAT_SUCC_RESET ((UINT8) 0x00) +#define STAT_SUCC_RESELECT ((UINT8) 0x10) +#define STAT_SUCC_SELECT ((UINT8) 0x11) +#define STAT_SUCC_SEND_RECV ((UINT8) 0x13) +#define STAT_SUCC_SEND_RECV_ATN ((UINT8) 0x14) +#define STAT_SUCC_XLATE_ADRS ((UINT8) 0x15) +#define STAT_SUCC_SEL_XFER ((UINT8) 0x16) +#define STAT_SUCC_XFER_MCI ((UINT8) 0x1f) + +#define STAT_PAUSE_MSG_IN ((UINT8) 0x20) +#define STAT_ABORT_SELX_SAVP ((UINT8) 0x21) /* SEL/Xfer Aborted; Save Ptrs */ +#define STAT_ABORT_SELECT ((UINT8) 0x22) /* SELECT Aborted */ +#define STAT_ABORT_RESELECT ((UINT8) 0x22) /* RESELECT Aborted */ +#define STAT_ABORT_RECV ((UINT8) 0x23) /* ReCeiVe Aborted; No ATN */ +#define STAT_ABORT_SEND ((UINT8) 0x23) /* SeND Aborted; No ATN */ +#define STAT_ABORT_RECV_ATN ((UINT8) 0x24) /* ReCeiVe Aborted; w/ATN */ +#define STAT_ABORT_SEND_ATN ((UINT8) 0x24) /* SeND Aborted; w/ATN */ +#define STAT_ABORT_XFER_MCI ((UINT8) 0x2f) /* Xfer Aborted; new MCI rqst */ + +#define STAT_TERM_INVALID_CMD ((UINT8) 0x40) /* Invalid Command */ +#define STAT_TERM_UNEXP_DISCON ((UINT8) 0x41) /* Unexpected Disconnect */ +#define STAT_TERM_TIMEOUT ((UINT8) 0x42) /* Selection Timeout */ +#define STAT_TERM_PAR_ERR ((UINT8) 0x43) /* Parity Error; No ATN */ +#define STAT_TERM_PAR_ERR_ATN ((UINT8) 0x44) /* Parity Error; w/ATN */ +#define STAT_TERM_ADRS_ERR ((UINT8) 0x45) /* Address exceeds disk bounds */ +#define STAT_TERM_BAD_RESEL ((UINT8) 0x46) /* Wrong target reselected */ +#define STAT_TERM_BAD_BYTE ((UINT8) 0x47) /* Incorrect Message Byte rcvd */ +#define STAT_TERM_UNX_PHASE ((UINT8) 0x4f) /* Unexpected MCI (new phase) */ + +#define STAT_SERV_REQ_RESELECT ((UINT8) 0x80) /* Reselected */ +#define STAT_SERV_REQ_SEL ((UINT8) 0x82) /* Selected; No ATN */ +#define STAT_SERV_REQ_SEL_ATN ((UINT8) 0x83) /* Selected; w/ATN */ +#define STAT_SERV_REQ_ATN ((UINT8) 0x84) /* ATN asserted */ +#define STAT_SERV_REQ_DISCON ((UINT8) 0x85) /* Disconnect */ +#define STAT_SERV_REQ_ASSERTED ((UINT8) 0x8f) /* Request -- MCI gives reason */ + +#define AUX_STAT_REG (0x00) +#define ADDRESS_REG (0x00) +#define GENERIC_REG (0x01) + +#define SBIC_REG_OWN_ID ((UINT8) 0x00) +#define SBIC_REG_CONTROL ((UINT8) 0x01) +#define SBIC_REG_TO_PERIOD ((UINT8) 0x02) +#define SBIC_REG_CDB_1 ((UINT8) 0x03) +#define SBIC_REG_CDB_2 ((UINT8) 0x04) +#define SBIC_REG_TOT_CLY_MSB ((UINT8) 0x05) +#define SBIC_REG_TOT_CLY_LSB ((UINT8) 0x06) +#define SBIC_REG_LOG_ADR_MSB ((UINT8) 0x07) +#define SBIC_REG_LOG_ADR_2SB ((UINT8) 0x08) +#define SBIC_REG_LOG_ADR_3SB ((UINT8) 0x09) +#define SBIC_REG_LOG_ADR_LSB ((UINT8) 0x0a) +#define SBIC_REG_SECTOR_NUM ((UINT8) 0x0b) +#define SBIC_REG_HEAD_NUM ((UINT8) 0x0c) +#define SBIC_REG_CYL_NUM_MSB ((UINT8) 0x0d) +#define SBIC_REG_CYL_NUM_LSB ((UINT8) 0x0e) +#define SBIC_REG_TARGET_LUN ((UINT8) 0x0f) +#define SBIC_REG_TARGET_STAT ((UINT8) 0x0f) +#define SBIC_REG_COMMAND_PHASE ((UINT8) 0x10) +#define SBIC_REG_SYNC_XFER ((UINT8) 0x11) +#define SBIC_REG_XFER_COUNT_MSB ((UINT8) 0x12) +#define SBIC_REG_XFER_COUNT_2SB ((UINT8) 0x13) +#define SBIC_REG_XFER_COUNT_LSB ((UINT8) 0x14) +#define SBIC_REG_DEST_ID ((UINT8) 0x15) +#define SBIC_REG_SOURCE_ID ((UINT8) 0x16) +#define SBIC_REG_SCSI_STATUS ((UINT8) 0x17) +#define SBIC_REG_COMMAND ((UINT8) 0x18) +#define SBIC_REG_DATA ((UINT8) 0x19) +#define SBIC_REG_PADa ((UINT8) 0x1a) +#define SBIC_REG_PADb ((UINT8) 0x1b) +#define SBIC_REG_PADc ((UINT8) 0x1c) +#define SBIC_REG_PADd ((UINT8) 0x1d) +#define SBIC_REG_PADe ((UINT8) 0x1e) +#define SBIC_REG_AUX_STATUS ((UINT8) 0x1f) + +/* auxiliary status register bits */ + +#define SBIC_AUX_STAT_INT_PEND ((UINT8) 0x80) /* interrupt pending bit */ +#define SBIC_AUX_STAT_LCI ((UINT8) 0x40) /* last commmand ignored bit */ +#define SBIC_AUX_STAT_BUSY ((UINT8) 0x20) /* busy bit */ +#define SBIC_AUX_STAT_CMD_IN_PROG ((UINT8) 0x10) /* command in progress bit */ +#define SBIC_AUX_STAT_PAR_ERROR ((UINT8) 0x02) /* parity erro bit */ +#define SBIC_AUX_STAT_DBUF_READY ((UINT8) 0x01) /* data buffer ready bit */ + +/* control register bits */ + +#define SBIC_CTRL_HALT_SPE ((UINT8) 0x01) /* halt on SCSI parity error */ +#define SBIC_CTRL_HALT_ATN ((UINT8) 0x02) /* halt on attention */ +#define SBIC_CTRL_INTM_DIS ((UINT8) 0x04) /* intermediate disconnect */ +#define SBIC_CTRL_END_DIS_INT ((UINT8) 0x08) /* ending disconnect inter */ +#define SBIC_CTRL_HALT_HPE ((UINT8) 0x10) /* halt on host parity error */ +#define SBIC_CTRL_DMA_POLLED ((UINT8) 0x00) /* polled i/o; on DMA */ +#define SBIC_CTRL_DMA_BURST ((UINT8) 0x20) /* burst mode; demand mode */ +#define SBIC_CTRL_DMA_WDBUS ((UINT8) 0x40) /* wd bus mode */ +#define SBIC_CTRL_DMA_BYTE ((UINT8) 0x80) /* regular DMA mode */ + +/* frequency select codes (wd33c93a only) */ + +#define SBIC_FREQ_SELECT_LOW 0x00 /* 8 - 10 MHz clock */ +#define SBIC_FREQ_SELECT_MID 0x40 /* 12 - 15 MHz clock */ +#define SBIC_FREQ_SELECT_HIGH 0x80 /* 16 MHz clock */ + +/* variable declarations */ + +extern SCSI_CTRL *pSysScsiCtrl; +extern SCSIDRV_FUNC_TBL *pWd33c93IfTbl; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void wd33c93IfTblInit (); +extern STATUS sbicProgBytesOut (SCSI_PHYS_DEV *, UINT8 *, int, int); +extern STATUS sbicProgBytesIn (SCSI_PHYS_DEV *, FAST UINT8 *, FAST int, int); +extern WD_33C93_SCSI_CTRL *wd33c93CtrlCreate (UINT8 *, int, UINT, int, + FUNCPTR, FUNCPTR, FUNCPTR); + +#ifndef WD33C93_1_LOCAL_FUNCS +extern STATUS wd33c93CtrlInit (WD_33C93_SCSI_CTRL *, int, UINT, int); +extern STATUS sbicShow (SCSI_CTRL *); +extern void sbicIntr (WD_33C93_SCSI_CTRL *); +extern void sbicCommand (WD_33C93_SCSI_CTRL *, UINT8); +extern void sbicRegWrite (WD_33C93_SCSI_CTRL *, UINT8, UINT8); +extern STATUS sbicXferCountSet (WD_33C93_SCSI_CTRL *, UINT); +#endif + +#else + +extern void wd33c93IfTblInit (); +extern STATUS sbicProgBytesOut (); +extern STATUS sbicProgBytesIn (); +extern WD_33C93_SCSI_CTRL * wd33c93CtrlCreate (); + +#ifndef WD33C93_1_LOCAL_FUNCS +extern STATUS wd33c93CtrlInit (); +extern STATUS sbicShow (); +extern void sbicIntr (); +extern void sbicCommand (); +extern void sbicRegWrite (); +extern STATUS sbicXferCountSet (); +#endif + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwd33c93_1h */ diff --git a/h/drv/scsi/wd33c93_2.h b/h/drv/scsi/wd33c93_2.h new file mode 100644 index 0000000..ab5b3f6 --- /dev/null +++ b/h/drv/scsi/wd33c93_2.h @@ -0,0 +1,332 @@ +/* wd33c93_2.h - Western Digital WD33C93 SBIC (SCSI-2 Interface Ctrl) header */ + +/* Copyright 1984-1995 Wind River Systems, Inc. */ +/* +modification history +-------------------- +03b,20jul95,jds changed wd33c93Intr to sbicIntr to keep it consistent with + previous incarnations of this driver. Integrated into + vxWorks5.2 +03a,16mar95,ihw modified for use with generic SCSI thread manager +02a,14jan94,ihw modified for enhanced SCSI library: multiple initiators, + disconnect/reconnect and synchronous transfer supported +01n,22sep92,rrr added support for c++ +01m,22jul92,wmd added definition of WDREG. +01l,03jun92,ccc added control register bits. +01k,26may92,rrr the tree shuffle +01j,26may92,ajm got rid of HOST_DEC def's (new compiler) +01i,21apr92,ccc added sbicXferCountSet() declaration. +01h,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01g,28sep91,ajm ifdef'd HOST_DEC for compiler problem +01f,24oct90,dnw declarations for void routines. +01e,19oct90,jcc changed SBIC to WD_33C93_SCSI_CTRL in ANSI function prototypes; + removed unused macros. +01d,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01c,20aug90,jcc changed UTINY to UINT8. +01b,18jul90,jcc moved _ASMLANGUAGE conditionals to encompass entire file. +01a,27feb90,jcc written based on old version from EDI +*/ + +#ifndef __INCwd33c93_2h +#define __INCwd33c93_2h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#ifndef INCLUDE_SCSI2 +#define INCLUDE_SCSI2 +#endif + +#include "scsiLib.h" +#include "semLib.h" +#include "msgQLib.h" + +/* SBIC state enumeration */ + +typedef enum sbicState + { + SBIC_STATE_IDLE = 0, + SBIC_STATE_SELECT_PENDING, + SBIC_STATE_CONNECTED + } SBIC_STATE; + + +typedef struct /* WD_33C93_SCSI_CTRL - Western Digital wd33c93 + SCSI controller info */ + { + SCSI_CTRL scsiCtrl; /* generic SCSI controller info */ + SEMAPHORE xferDoneSem; /* semaphore for waiting on transfer */ + UINT clkPeriod; /* period of the controller clock (nsec) */ + UINT defSelTimeOut; /* default dev. select time-out (usec) */ + int devType; /* type of device (see definitions below) */ + FUNCPTR sysScsiDmaStart; /* function for starting SCSI DMA transfer */ + FUNCPTR sysScsiDmaAbort; /* function for aborting SCSI DMA transfer */ + FUNCPTR sysScsiBusReset; /* function for resetting SCSI bus */ + int sysScsiDmaArg; /* call-back argument for SCSI DMA funcs. */ + int sysScsiResetArg; /* call-back argument for bus reset func. */ + SBIC_STATE state; /* current state of controller */ + volatile BOOL initPending; /* need to call post-reset initialisation ? */ + volatile BOOL xferPending; /* information transfer in progress */ + volatile UINT8 *pAdrsReg; /* ptr address reg.*/ + volatile UINT8 *pAuxStatReg;/* ptr aux. status reg.*/ + volatile UINT8 *pRegFile; /* ptr register file */ + } WD_33C93_SCSI_CTRL; + + /* + * Structure that defines the functions that are common between the SCSI-2 + * version of the driver and the SCSI-1 version of the driver. This structure + * provides the facilities so that both versions of the driver can co-exist + * in the same driver library + */ + +typedef struct wd33c93functbl + { + FUNCPTR sbicCommand; + FUNCPTR sbicIntr; + FUNCPTR sbicRegRead; + FUNCPTR sbicRegWrite; + FUNCPTR sbicXferCountGet; + FUNCPTR sbicXferCountSet; + FUNCPTR wd33c93CtrlInit; + FUNCPTR wd33c93Show; + } SCSIDRV_FUNC_TBL; + +/* SBIC device type */ + +#define SBIC_WD33C93 0 +#define SBIC_WD33C93A 1 + +/* SBIC command set */ + +#define SBIC_CMD_RESET ((UINT8) 0x00) +#define SBIC_CMD_ABORT ((UINT8) 0x01) +#define SBIC_CMD_SET_ATN ((UINT8) 0x02) +#define SBIC_CMD_NEG_ACK ((UINT8) 0x03) +#define SBIC_CMD_DISCONNECT ((UINT8) 0x04) +#define SBIC_CMD_RESELECT ((UINT8) 0x05) +#define SBIC_CMD_SEL_ATN ((UINT8) 0x06) +#define SBIC_CMD_SELECT ((UINT8) 0x07) +#define SBIC_CMD_SEL_ATN_XFER ((UINT8) 0x08) +#define SBIC_CMD_SELECT_XFER ((UINT8) 0x09) +#define SBIC_CMD_RESELECT_RECV ((UINT8) 0x0a) +#define SBIC_CMD_RESELECT_SEND ((UINT8) 0x0b) +#define SBIC_CMD_WAIT_SEL_RCV ((UINT8) 0x0c) +#define SBIC_CMD_RECV_CMD ((UINT8) 0x10) +#define SBIC_CMD_RECV_DATA ((UINT8) 0x11) +#define SBIC_CMD_RECV_MSG_OUT ((UINT8) 0x12) +#define SBIC_CMD_RECV_INFO_OUT ((UINT8) 0x13) +#define SBIC_CMD_SEND_STATUS ((UINT8) 0x14) +#define SBIC_CMD_SEND_DATA ((UINT8) 0x15) +#define SBIC_CMD_SEND_MSG_IN ((UINT8) 0x16) +#define SBIC_CMD_SEND_INFO_IN ((UINT8) 0x17) +#define SBIC_CMD_XLATE_ADDR ((UINT8) 0x18) +#define SBIC_CMD_XFER_INFO ((UINT8) 0x20) +#define SBIC_CMD_XFER_PAD ((UINT8) 0x21) +#define SBIC_CMD_SING_BYTE_XFER ((UINT8) 0x80) + +/* Status Register Codes */ + +#define STAT_GROUP(arg) ((arg) & 0xf0) /* reason for interrupt */ +#define STAT_CODE(arg) ((arg) & 0x0f) /* detail about reason */ +#define STAT_XFER(arg) ((arg) & 0x08) /* transfer was in progress */ + +#define STAT_MCI_BITS ((UINT8) 0x07) /* MSG, C/D and I/O bits */ +#define STAT_PHASE_REQ ((UINT8) 0x08) + +#define STAT_GROUP_RESET ((UINT8) 0x00) +#define STAT_GROUP_SUCCESSFUL ((UINT8) 0x10) +#define STAT_GROUP_PAUSE_ABORTED ((UINT8) 0x20) +#define STAT_GROUP_TERMINATED ((UINT8) 0x40) +#define STAT_GROUP_SERVICE_REQ ((UINT8) 0x80) + +#define STAT_SUCC_RESET ((UINT8) 0x00) +#define STAT_SUCC_RESET_ADV ((UINT8) 0x01) /* reset w. advanced features */ +#define STAT_SUCC_RESELECT ((UINT8) 0x10) +#define STAT_SUCC_SELECT ((UINT8) 0x11) +#define STAT_SUCC_SEND_RECV ((UINT8) 0x13) +#define STAT_SUCC_SEND_RECV_ATN ((UINT8) 0x14) +#define STAT_SUCC_XLATE_ADRS ((UINT8) 0x15) +#define STAT_SUCC_SEL_XFER ((UINT8) 0x16) +#define STAT_SUCC_XFER_MCI ((UINT8) 0x1f) + +#define STAT_PAUSE_MSG_IN ((UINT8) 0x20) +#define STAT_ABORT_SELX_SAVP ((UINT8) 0x21) /* SEL/Xfer Aborted; Save Ptrs */ +#define STAT_ABORT_SELECT ((UINT8) 0x22) /* SELECT Aborted */ +#define STAT_ABORT_RESELECT ((UINT8) 0x22) /* RESELECT Aborted */ +#define STAT_ABORT_RECV ((UINT8) 0x23) /* ReCeiVe Aborted; No ATN */ +#define STAT_ABORT_SEND ((UINT8) 0x23) /* SeND Aborted; No ATN */ +#define STAT_ABORT_RECV_ATN ((UINT8) 0x24) /* ReCeiVe Aborted; w/ATN */ +#define STAT_ABORT_SEND_ATN ((UINT8) 0x24) /* SeND Aborted; w/ATN */ +#define STAT_ABORT_XFER_MCI ((UINT8) 0x2f) /* Xfer Aborted; new MCI rqst */ + +#define STAT_TERM_INVALID_CMD ((UINT8) 0x40) /* Invalid Command */ +#define STAT_TERM_UNEXP_DISCON ((UINT8) 0x41) /* Unexpected Disconnect */ +#define STAT_TERM_TIMEOUT ((UINT8) 0x42) /* Selection Timeout */ +#define STAT_TERM_PAR_ERR ((UINT8) 0x43) /* Parity Error; No ATN */ +#define STAT_TERM_PAR_ERR_ATN ((UINT8) 0x44) /* Parity Error; w/ATN */ +#define STAT_TERM_ADRS_ERR ((UINT8) 0x45) /* Address exceeds disk bounds */ +#define STAT_TERM_BAD_RESEL ((UINT8) 0x46) /* Wrong target reselected */ +#define STAT_TERM_BAD_BYTE ((UINT8) 0x47) /* Incorrect Message Byte rcvd */ +#define STAT_TERM_UNX_PHASE ((UINT8) 0x4f) /* Unexpected MCI (new phase) */ + +#define STAT_SERV_REQ_RESELECT ((UINT8) 0x80) /* Reselected */ +#define STAT_SERV_REQ_RESEL_ADV ((UINT8) 0x81) /* Reselected, advanced mode */ +#define STAT_SERV_REQ_SEL ((UINT8) 0x82) /* Selected; No ATN */ +#define STAT_SERV_REQ_SEL_ATN ((UINT8) 0x83) /* Selected; w/ATN */ +#define STAT_SERV_REQ_ATN ((UINT8) 0x84) /* ATN asserted */ +#define STAT_SERV_REQ_DISCON ((UINT8) 0x85) /* Disconnect */ +#define STAT_SERV_REQ_ASSERTED ((UINT8) 0x8f) /* Request -- MCI gives reason */ + +#define AUX_STAT_REG (0x00) +#define ADDRESS_REG (0x00) +#define GENERIC_REG (0x01) + +#define SBIC_REG_OWN_ID ((UINT8) 0x00) +#define SBIC_REG_CONTROL ((UINT8) 0x01) +#define SBIC_REG_TO_PERIOD ((UINT8) 0x02) +#define SBIC_REG_CDB_1 ((UINT8) 0x03) +#define SBIC_REG_CDB_2 ((UINT8) 0x04) +#define SBIC_REG_TOT_CLY_MSB ((UINT8) 0x05) +#define SBIC_REG_TOT_CLY_LSB ((UINT8) 0x06) +#define SBIC_REG_LOG_ADR_MSB ((UINT8) 0x07) +#define SBIC_REG_LOG_ADR_2SB ((UINT8) 0x08) +#define SBIC_REG_LOG_ADR_3SB ((UINT8) 0x09) +#define SBIC_REG_LOG_ADR_LSB ((UINT8) 0x0a) +#define SBIC_REG_SECTOR_NUM ((UINT8) 0x0b) +#define SBIC_REG_HEAD_NUM ((UINT8) 0x0c) +#define SBIC_REG_CYL_NUM_MSB ((UINT8) 0x0d) +#define SBIC_REG_CYL_NUM_LSB ((UINT8) 0x0e) +#define SBIC_REG_TARGET_LUN ((UINT8) 0x0f) +#define SBIC_REG_TARGET_STAT ((UINT8) 0x0f) +#define SBIC_REG_COMMAND_PHASE ((UINT8) 0x10) +#define SBIC_REG_SYNC_XFER ((UINT8) 0x11) +#define SBIC_REG_XFER_COUNT_MSB ((UINT8) 0x12) +#define SBIC_REG_XFER_COUNT_2SB ((UINT8) 0x13) +#define SBIC_REG_XFER_COUNT_LSB ((UINT8) 0x14) +#define SBIC_REG_DEST_ID ((UINT8) 0x15) +#define SBIC_REG_SOURCE_ID ((UINT8) 0x16) +#define SBIC_REG_SCSI_STATUS ((UINT8) 0x17) +#define SBIC_REG_COMMAND ((UINT8) 0x18) +#define SBIC_REG_DATA ((UINT8) 0x19) +#define SBIC_REG_PADa ((UINT8) 0x1a) +#define SBIC_REG_PADb ((UINT8) 0x1b) +#define SBIC_REG_PADc ((UINT8) 0x1c) +#define SBIC_REG_PADd ((UINT8) 0x1d) +#define SBIC_REG_PADe ((UINT8) 0x1e) +#define SBIC_REG_AUX_STATUS ((UINT8) 0x1f) + +/* auxiliary status register bits */ + +#define SBIC_AUX_STAT_INT_PEND ((UINT8) 0x80) /* interrupt pending bit */ +#define SBIC_AUX_STAT_LCI ((UINT8) 0x40) /* last commmand ignored bit */ +#define SBIC_AUX_STAT_BUSY ((UINT8) 0x20) /* busy bit */ +#define SBIC_AUX_STAT_CMD_IN_PROG ((UINT8) 0x10) /* command in progress bit */ +#define SBIC_AUX_STAT_PAR_ERROR ((UINT8) 0x02) /* parity erro bit */ +#define SBIC_AUX_STAT_DBUF_READY ((UINT8) 0x01) /* data buffer ready bit */ + +/* control register bits */ + +#define SBIC_CTRL_HALT_SPE ((UINT8) 0x01) /* halt on SCSI parity error */ +#define SBIC_CTRL_HALT_ATN ((UINT8) 0x02) /* halt on attention */ +#define SBIC_CTRL_INTM_DIS ((UINT8) 0x04) /* intermediate disconnect */ +#define SBIC_CTRL_END_DIS_INT ((UINT8) 0x08) /* ending disconnect inter */ +#define SBIC_CTRL_HALT_HPE ((UINT8) 0x10) /* halt on host parity error */ +#define SBIC_CTRL_DMA_POLLED ((UINT8) 0x00) /* polled i/o; on DMA */ +#define SBIC_CTRL_DMA_BURST ((UINT8) 0x20) /* burst mode; demand mode */ +#define SBIC_CTRL_DMA_WDBUS ((UINT8) 0x40) /* wd bus mode */ +#define SBIC_CTRL_DMA_BYTE ((UINT8) 0x80) /* regular DMA mode */ + +/* synchronous transfer register bits and constants */ + +#define SBIC_SYNC_XFER_PERIOD_SHIFT 4 + +#define SBIC_SYNC_XFER_PARAMS_ASYNC 0x00 + +/* source ID register bits */ + +#define SBIC_SRC_ID_RESEL_ENABLE ((UINT8) 0x80) + +/* control register bits */ + +#define SBIC_CONTROL_DMA_ENABLE ((UINT8) 0x80) + +/* miscellaneous constants */ + +#define SBIC_MAX_REQ_ACK_OFFSET 4 /* possibly 12 for 33C93A ? */ +#define SBIC_MIN_XFER_PERIOD 3 /* native 33C93 units (2 on 93A) */ +#define SBIC_MAX_XFER_PERIOD 8 /* native 33C93 units */ + +#define SBIC_MAX_RESET_WAIT 2 /* max # ticks wait for reset */ + +/* frequency select codes (wd33c93a only) */ + +#define SBIC_FREQ_SELECT_LOW 0x00 /* 8 - 10 MHz clock */ +#define SBIC_FREQ_SELECT_MID 0x40 /* 12 - 15 MHz clock */ +#define SBIC_FREQ_SELECT_HIGH 0x80 /* 16 MHz clock */ + + +/* global imported varaibles */ + +extern SCSI_CTRL *pSysScsiCtrl; +extern SCSIDRV_FUNC_TBL *pWd33c93IfTbl; + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void wd33c93IfTblInit (); +IMPORT void wd33c93Scsi2IfInit (); +IMPORT WD_33C93_SCSI_CTRL * wd33c93CtrlCreateScsi2 (UINT8 *sbicBaseAdrs, + int regOffset, + UINT clkPeriod, + FUNCPTR sysScsiBusReset, + int sysScsiResetArg, + UINT sysScsiDmaMaxBytes, + FUNCPTR sysScsiDmaXfer, + FUNCPTR sysScsiDmaAbort, + int sysScsiDmaArg); +#ifndef WD33C93_2_LOCAL_FUNCS +IMPORT STATUS wd33c93CtrlInit (WD_33C93_SCSI_CTRL *pSbic, + int scsiCtrlBusId, + UINT defaultSelTimeOut); +IMPORT STATUS wd33c93Show (SCSI_CTRL *pScsiCtrl); +IMPORT void sbicIntr (WD_33C93_SCSI_CTRL *pSbic); +IMPORT void sbicCommand (WD_33C93_SCSI_CTRL *, UINT8); +IMPORT void sbicRegWrite (WD_33C93_SCSI_CTRL *, UINT8, UINT8); +IMPORT STATUS sbicXferCountSet (WD_33C93_SCSI_CTRL *, UINT); +#endif + +#else + +extern void wd33c93IfTblInit (); +IMPORT void wd33c93Scsi2IfInit (); +IMPORT WD_33C93_SCSI_CTRL * wd33c93CtrlCreateScsi2 (); + +#ifndef WD33C93_2_LOCAL_FUNCS +IMPORT STATUS wd33c93CtrlInit (); +IMPORT STATUS wd33c93Show (); +IMPORT void sbicIntr (); +IMPORT void sbicCommand (); +IMPORT void sbicRegWrite (); +IMPORT STATUS sbicXferCountSet (); +#endif + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwd33c93_2h */ diff --git a/h/drv/serial/i8042.h b/h/drv/serial/i8042.h new file mode 100644 index 0000000..ade7a46 --- /dev/null +++ b/h/drv/serial/i8042.h @@ -0,0 +1,157 @@ +/* i8042.h - header file for the Intel 8042 Keyboard Controller */ + +/* Copyright 1993-2001 Wind River System, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,06dec01,jlb written. + + + +DESCRIPTION +This file contains the data structures and defines used to manipulate the +Intel 8042 keyboard/mouse driver chip. + +*/ + +#ifndef __INCi8042h +#define __INCi8042h + +#include "tyLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/* status register defines */ + +#define I8042_KBD_OBFULL 0x01 /* output buffer full (data from keyboard) */ +#define I8042_KBD_IBFULL 0x02 /* input buffer full (data to keyboard) */ +#define I8042_KBD_SYSFLAG 0x04 /* system flag (0 power on reset, 1 st ok) */ +#define I8042_KBD_CD 0x08 /* cmd/data (0 data wt on 60, 1 cmd on 64 */ +#define I8042_KBD_KEYL 0x10 /* lock status (0 locked, 1 free) */ +#define I8042_KBD_AUXB 0x20 /* aux device (0 keyboard data, 1 aux data)*/ +#define I8042_KBD_RXTO 0x40 /* General timeout */ +#define I8042_KBD_PARERR 0x80 /* Parity error */ + +/* configuration defines */ + +#define I8042_KBD_INT 0x01 /* Enable keyboard interrupts */ +#define I8042_KBD_AUX_INT 0x02 /* Enable aux device interrupts */ +#define I8042_KBD_OFF 0x10 /* Turn keyboard off */ +#define I8042_KBD_XT 0x20 /* XT Scan codes */ +#define I8042_KBD_AT_TO_XT 0x40 /* Convert AT scan codes to XT scan codes */ + +/* 8042 command defines */ + +#define I8042_KBD_RD_CONFIG 0x20 /* Read the configuration byte */ +#define I8042_KBD_WT_CONFIG 0x60 /* Write the configuration byte */ +#define I8042_KBD_DISABLE_AUX 0xA7 /* Disable aux device */ +#define I8042_KBD_ENABLE_AUX 0xA8 /* Enable aux device */ +#define I8042_KBD_IF_AUX_TEST 0xA9 /* Perform aux interface test */ +#define I8042_KBD_SELF_TEST 0xAA /* Perform keyboard self test */ +#define I8042_KBD_IF_TEST 0xAB /* Perform keyboard interface test */ +#define I8042_KBD_ENABLE 0xAE /* Enable keyboard (sets bit 4 of config) */ +#define I8042_KBD_DISABLE 0xAD /* Disable I8042_KBD (resets bit 4 of config) */ +#define I8042_KBD_WT_AUX 0xD4 /* Write next data to aux device */ + +/* 8042 command results */ + +#define I8042_KBD_IF_OK 0x00 /* Clock and data lines are ok */ +#define I8042_KBD_IF_CLKL 0x01 /* Clock line stuck low */ +#define I8042_KBD_IF_CLKH 0x02 /* Clock line stuck high */ +#define I8042_KBD_IF_DATAL 0x03 /* Data line stuck low */ +#define I8042_KBD_IF_DATAH 0x04 /* Data line stuck high */ +#define I8042_KBD_SF_OK 0x55 /* Passed self test */ +#define I8042_KBD_NO_DEV 0xFF /* No aux device */ + +/* keyboard command defines */ + +#define I8042_KBD_LED_CMD 0xED /* Set LED command */ +#define I8042_KBD_ECHO_CMD 0xEE /* Echo (returns 0xee) */ +#define I8042_KBD_SC_CMD 0xF0 /* Set/Identify scan code */ +#define I8042_KBD_ID_CMD 0xF2 /* Get keyboard id code */ +#define I8042_KBD_RATE_CMD 0xF3 /* Set repetition and delay rates */ +#define I8042_KBD_ENABLE_CMD 0xF4 /* Enable keyboard */ +#define I8042_KBD_STDDIS_CMD 0xF5 /* Standard Disable */ +#define I8042_KBD_STDEN_CMD 0xF6 /* Standard Enable */ +#define I8042_KBD_RESEND_CMD 0xFE /* Resend last character */ +#define I8042_KBD_RESET_CMD 0xFF /* Reset keyboard */ + +/* keyboard command returns */ + +#define I8042_KBD_BAT_OK 0xAA /* BAT Complete code */ +#define I8042_KBD_CMD_ACK 0xFA /* Command Acknowledge */ +#define I8042_KBD_BAT_ERROR 0xFC /* BAT Error code */ + +/* LED defines */ + +#define I8042_KBD_LED_SCROLL 0x01 /* Scroll LED */ +#define I8042_KBD_LED_NUMLOCK 0x02 /* Num Lock LED */ +#define I8042_KBD_LED_CAPLOCK 0x04 /* Caps Lock LED */ + +/* ps2 mouse command defines */ + +#define I8042_KBDM_SR_CMD 0xE8 /* Mouse set resolution */ +#define I8042_KBDM_DS_CMD 0xE9 /* Mouse Determine status */ +#define I8042_KBDM_SS_CMD 0xF3 /* Mouse set sample rate */ +#define I8042_KBDM_ENABLE_CMD 0xF4 /* Mouse enable */ +#define I8042_KBDM_DIS_CMD 0xF5 /* Mouse disable */ +#define I8042_KBDM_SETS_CMD 0xF6 /* Mouse set standard */ +#define I8042_KBDM_RESEND_CMD 0xFE /* Mouse resend last packet */ +#define I8042_KBDM_RESET_CMD 0xFF /* Mouse reset */ + +/* ps2 mouse command returns */ + +#define I8042_KBDM_ID 0x00 /* Mouse identification */ +#define I8042_KBDM_ACK 0xFA /* Command Acknowledge */ +#define I8042_KBDM_RESEND 0xFE /* Resend Request */ + +/* musc definitions */ +#define I8042_READ_DELAY 100 /* Maximum wait time for keyboard */ +#define I8042_WAIT_SEC 2 /* Time to wait for command completion */ + + +/* Register definitions */ +#define I8042_DATA 0 /* Data regsiter offset */ +#define I8042_STAT_CMD 1 /* Status/Command regsiter offset */ + + +/* Register access method, these may be overriden within the BSP config.h file */ +#ifndef I8042_KBD_OUT +#define I8042_KBD_OUT sysOutByte /* Routine to call for output */ +#define I8042_KBD_IN sysInByte /* Routine to call for input */ +#endif /* KBD_OUT */ + + +/* Mouse device control structure */ +typedef struct + { + TY_DEV ty_dev; + WINDML_DEVICE * pDev; + ULONG dataReg; + ULONG statCmdReg; + } I8042_MSE_DEVICE; + + +/* keyboard device descriptor */ +typedef struct + { + TY_DEV tyDev; + WINDML_DEVICE * pDev; + UINT16 kbdFlags; + ULONG oldLedStat; + ULONG dataReg; + ULONG statCmdReg; + } I8042_KBD_DEVICE; + + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCi8042h */ diff --git a/h/drv/serial/m68681.h b/h/drv/serial/m68681.h new file mode 100644 index 0000000..25eec19 --- /dev/null +++ b/h/drv/serial/m68681.h @@ -0,0 +1,254 @@ +/* m68681.h - Motorola M68681 serial chip header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01h,22sep92,rrr added support for c++ +01g,14aug92,caf added TY_CO_DEV and function declarations for 5.1 upgrade. + for 5.0.x compatibility, define INCLUDE_TY_CO_DRV_50 when + including this header. +01f,26may92,rrr the tree shuffle +01e,04oct91,rrr passed through the ansification filter + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01d,05oct90,shl added copyright notice. + made #endif ANSI style. +01c,10sep89,rld added DUART registers. +01b,30apr88,gae added definition INCm68681h. +01a,06jan88,miz written for Mizar Digital Systems. +*/ + +/* +This file contains constants for the Motorola M68681 serial chip. + +The constants DUART_REG_OFFSET and SIO must defined when +including this header file. +*/ + +#ifndef __INCm68681h +#define __INCm68681h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE +#ifndef INCLUDE_TY_CO_DRV_50 + +#include "tyLib.h" + +typedef struct /* TY_CO_DEV */ + { + TY_DEV tyDev; + BOOL created; /* true if this device has really been created */ + char numChannels; /* number of channels to support */ + char *dr; /* data port */ + char *csr; /* clock select register */ + char *cr; /* control register */ + char *sopbc; /* set ouput port bits register */ + char *isr; /* interrupt status register */ + char *mr; /* mode register */ + char *imr; /* interrupt mask register */ + char *ctlr; /* counter timer lower register */ + char *ctur; /* counter timer upper register */ + char *acr; /* auxiliary control register */ + char *ctron; /* counter on */ + char *ctroff; /* counter off */ + char *kimr; /* keep current interrupt mask register value */ + char rem; /* bit for receive-enable mask */ + char tem; /* bit for transmit-enable mask */ + VOIDFUNCPTR tickRtn; /* timer ISR (NULL if none) */ + } TY_CO_DEV; + +#endif /* INCLUDE_TY_CO_DRV_50 */ +#endif /* _ASMLANGUAGE */ + +#define N_CHANNELS 2 /* number of serial channels on chip */ + +#ifdef _ASMLANGUAGE +#define SIO_ADRS(reg) (SIO + (reg * DUART_REG_OFFSET)) +#else +#define SIO_ADRS(reg) ((char *) SIO + (reg * DUART_REG_OFFSET)) +#endif /* _ASMLANGUAGE */ + +/* SIO -- m68681 serial channel chip -- register definitions */ + +#define DUART_MRA SIO_ADRS(0x00) /* mode reg. A */ +#define DUART_CSRA SIO_ADRS(0x01) /* clock select reg. A */ +#define DUART_SRA DUART_CSRA /* status reg. A */ +#define DUART_CRA SIO_ADRS(0x02) /* command reg. A */ +#define DUART_THRA SIO_ADRS(0x03) /* transmit buffer A */ +#define DUART_RHRA DUART_THRA /* receive buffer A */ +#define DUART_ACR SIO_ADRS(0x04) /* auxiliary control reg. */ +#define DUART_IPCR DUART_ACR /* input port change reg. */ +#define DUART_IMR SIO_ADRS(0x05) /* int. mask reg. */ +#define DUART_ISR DUART_IMR /* int. status reg. */ +#define DUART_CTUR SIO_ADRS(0x06) /* counter timer upper reg. */ +#define DUART_CTLR SIO_ADRS(0x07) /* counter timer lower reg. */ +#define DUART_MRB SIO_ADRS(0x08) /* mode reg. B */ +#define DUART_CSRB SIO_ADRS(0x09) /* clock select reg. B */ +#define DUART_SRB DUART_CSRB /* status reg. B */ +#define DUART_CRB SIO_ADRS(0x0a) /* command reg. B */ +#define DUART_THRB SIO_ADRS(0x0b) /* transmit buffer B */ +#define DUART_RHRB DUART_THRB /* receive buffer B */ +#define DUART_IVR SIO_ADRS(0x0c) /* int. vector reg. */ +#define DUART_OPCR SIO_ADRS(0x0d) /* output port config. reg. */ +#define DUART_IP DUART_OPCR /* input port */ +#define DUART_SOPBC SIO_ADRS(0x0e) /* set output port bits */ +#define DUART_CTRON DUART_SOPBC /* counter on */ +#define DUART_ROPBC SIO_ADRS(0x0f) /* reset output port bits */ +#define DUART_CTROFF DUART_ROPBC /* counter off */ + +/* equates for mode reg. A or B, mode 1 */ +#define RX_RTS 0x80 /* 0 = no, 1 = yes */ +#define RX_INT 0x40 /* 0 = RxRDY, 1 = FFULL */ +#define ERR_MODE 0x20 /* 0 = char, 1 = block */ +#define PAR_MODE_MULTI 0x18 /* multi_drop mode */ +#define PAR_MODE_NO 0x10 /* no parity mode */ +#define PAR_MODE_FORCE 0x08 /* force parity mode */ +#define PAR_MODE_YES 0x00 /* parity mode */ +#define PARITY_TYPE 0x04 /* 0 = even, 1 = odd */ +#define BITS_CHAR_8 0x03 /* 8 bits */ +#define BITS_CHAR_7 0x02 /* 7 bits */ +#define BITS_CHAR_6 0x01 /* 6 bits */ +#define BITS_CHAR_5 0x00 /* 5 bits */ +/* equates for mode reg. A or B, mode 2 */ +#define CHAN_MODE_RL 0xc0 /* remote loop */ +#define CHAN_MODE_LL 0x80 /* local loop */ +#define CHAN_MODE_AECHO 0x40 /* auto echo */ +#define CHAN_MODE_NORM 0x00 /* normal */ +#define TX_RTS 0x20 /* 0 = no, 1 = yes */ +#define CTS_ENABLE 0x10 /* 0 = no, 1 = yes */ +#define STOP_BITS_2 0x0f /* 2 */ +#define STOP_BITS_1 0x07 /* 1 */ +/* equates for clock select reg. A or B */ +#define RX_CLK_SEL 0xf0 /* receiver clock select */ +#define RX_CLK_19200 0xc0 /* 19200 */ +#define RX_CLK_9600 0xb0 /* 9600 */ +#define RX_CLK_1800 0xa0 /* 1800 */ +#define RX_CLK_4800 0x90 /* 4800 */ +#define RX_CLK_2400 0x80 /* 2400 */ +#define RX_CLK_2000 0x70 /* 2000 */ +#define RX_CLK_1200 0x60 /* 1200 */ +#define RX_CLK_600 0x50 /* 600 */ +#define RX_CLK_300 0x40 /* 300 */ +#define RX_CLK_150 0x30 /* 150 */ +#define RX_CLK_134_5 0x20 /* 134.5 */ +#define RX_CLK_110 0x10 /* 110 */ +#define RX_CLK_75 0x00 /* 75 */ +#define TX_CLK_SEL 0x0f /* transmitter clock select */ +#define TX_CLK_19200 0x0c /* 19200 */ +#define TX_CLK_9600 0x0b /* 9600 */ +#define TX_CLK_1800 0x0a /* 1800 */ +#define TX_CLK_4800 0x09 /* 4800 */ +#define TX_CLK_2400 0x08 /* 2400 */ +#define TX_CLK_2000 0x07 /* 2000 */ +#define TX_CLK_1200 0x06 /* 1200 */ +#define TX_CLK_600 0x05 /* 600 */ +#define TX_CLK_300 0x04 /* 300 */ +#define TX_CLK_150 0x03 /* 150 */ +#define TX_CLK_134_5 0x02 /* 134.5 */ +#define TX_CLK_110 0x01 /* 110 */ +#define TX_CLK_75 0x00 /* 75 */ +/* equates for status reg. A or B */ +#define RXD_BREAK 0x80 /* 0 = no, 1 = yes */ +#define FRAMING_ERR 0x40 /* 0 = no, 1 = yes */ +#define PARITY_ERR 0x20 /* 0 = no, 1 = yes */ +#define OVERRUN_ERR 0x10 /* 0 = no, 1 = yes */ +#define TXENT 0x08 /* 0 = no, 1 = yes */ +#define TXRDY 0x04 /* 0 = no, 1 = yes */ +#define FFULL 0x02 /* 0 = no, 1 = yes */ +#define RXRDY 0x01 /* 0 = no, 1 = yes */ +/* equates for command reg. A or B */ +/* miscellaneous commands: 0x70 */ +#define STP_BREAK_CMD 0x70 /* stop break command */ +#define STR_BREAK_CMD 0x60 /* start break command */ +#define RST_BRK_INT_CMD 0x50 /* reset break int. command */ +#define RST_ERR_STS_CMD 0x40 /* reset error status command */ +#define RST_TX_CMD 0x30 /* reset transmitter command */ +#define RST_RX_CMD 0x20 /* reset receiver command */ +#define RST_MR_PTR_CMD 0x10 /* reset mr pointer command */ +#define NO_COMMAND 0x00 /* no command */ +#define TX_DISABLE 0x08 /* 0 = no, 1 = yes */ +#define TX_ENABLE 0x04 /* 0 = no, 1 = yes */ +#define RX_DISABLE 0x02 /* 0 = no, 1 = yes */ +#define RX_ENABLE 0x01 /* 0 = no, 1 = yes */ +/* equates for auxiliary control reg. (timer and counter clock selects) */ +#define BRG_SELECT 0x80 /* baud rate generator select */ + /* 0 = set 1; 1 = set 2 */ + /* NOTE above equates are set 2 ONLY */ +#define TMR_EXT_CLK_16 0x70 /* external clock divided by 16 */ +#define TMR_EXT_CLK 0x60 /* external clock */ +#define TMR_IP2_16 0x50 /* ip2 divided by 16 */ +#define TMR_IP2 0x40 /* ip2 */ +#define CTR_EXT_CLK_16 0x30 /* external clock divided by 16 */ +#define CTR_TXCB 0x20 /* channel B transmitter clock */ +#define CTR_TXCA 0x10 /* channel A transmitter clock */ +#define CTR_IP2 0x00 /* ip2 */ +#define DELTA_IP3_INT 0x08 /* delta ip3 int. */ +#define DELTA_IP2_INT 0x04 /* delta ip2 int. */ +#define DELTA_IP1_INT 0x02 /* delta ip1 int. */ +#define DELTA_IP0_INT 0x01 /* delta ip0 int. */ +/* equates for input port change reg. */ +#define DELTA_IP3 0x80 /* 0 = no, 1 = yes */ +#define DELTA_IP2 0x40 /* 0 = no, 1 = yes */ +#define DELTA_IP1 0x20 /* 0 = no, 1 = yes */ +#define DELTA_IP0 0x10 /* 0 = no, 1 = yes */ +#define IP3 0x08 /* 0 = low, 1 = high */ +#define IP2 0x04 /* 0 = low, 1 = high */ +#define IP1 0x02 /* 0 = low, 1 = high */ +#define IP0 0x01 /* 0 = low, 1 = high */ +/* equates for int. mask reg. */ +#define INPUT_DELTA_INT 0x80 /* 0 = off, 1 = on */ +#define BREAK_B_INT 0x40 /* 0 = off, 1 = on */ +#define RX_RDY_B_INT 0x20 /* 0 = off, 1 = on */ +#define TX_RDY_B_INT 0x10 /* 0 = off, 1 = on */ +#define CTR_RDY_INT 0x08 /* 0 = off, 1 = on */ +#define BREAK_A_INT 0x04 /* 0 = off, 1 = on */ +#define RX_RDY_A_INT 0x02 /* 0 = off, 1 = on */ +#define TX_RDY_A_INT 0x01 /* 0 = off, 1 = on */ +/* equates for int. status reg. */ +#define INPUT_DELTA 0x80 /* 0 = no, 1 = yes */ +#define BREAK_B 0x40 /* 0 = no, 1 = yes */ +#define RX_RDY_B 0x20 /* 0 = no, 1 = yes */ +#define TX_RDY_B 0x10 /* 0 = no, 1 = yes */ +#define CTR_RDY 0x08 /* 0 = no, 1 = yes */ +#define BREAK_A 0x04 /* 0 = no, 1 = yes */ +#define RX_RDY_A 0x02 /* 0 = no, 1 = yes */ +#define TX_RDY_A 0x01 /* 0 = no, 1 = yes */ +/* equates for output port config. reg. */ +#define OP7 0x80 /* 0 = OPCR[7], 1 = TxRDYB */ +#define OP6 0x40 /* 0 = OPCR[6], 1 = TxRDYA */ +#define OP5 0x20 /* 0 = OPCR[5], 1 = RxRDYB */ +#define OP4 0x10 /* 0 = OPCR[4], 1 = RxRDYA */ +#define RXCB_1X 0x0c /* RCXB_1X */ +#define TXCB_1X 0x08 /* TXCB_1X */ +#define C_T_OUTPUT 0x04 /* C_T_OUTPUT */ +#define OP3 0x00 /* 0 = OPCR[3] */ +#define RXCA_1X 0x03 /* RXCA_1X */ +#define TXCA_1X 0x02 /* TXCA_1X */ +#define TXCA_16X 0x01 /* TXCA_16X */ +#define OP2 0x00 /* 0 = OPCR[2] */ + +/* function declarations */ + +#ifndef INCLUDE_TY_CO_DRV_50 +#ifndef _ASMLANGUAGE +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT void tyCoInt (int arg); + +#else /* __STDC__ */ + +IMPORT void tyCoInt (); + +#endif /* __STDC__ */ +#endif /* _ASMLANGUAGE */ +#endif /* INCLUDE_TY_CO_DRV_50 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm68681h */ diff --git a/h/drv/serial/pcConsole.h b/h/drv/serial/pcConsole.h new file mode 100644 index 0000000..ef537dc --- /dev/null +++ b/h/drv/serial/pcConsole.h @@ -0,0 +1,221 @@ +/* pcConsole.h - PC Keyboard and VGA Controller header file */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,06dec01,jlb options to send scan codes and set LEDs +01c,12oct99,jmb fix build warning, conflict with SH cpu type +01b,29sep98,fle made it refgen parsable +01a,24sep93,vin created + +*/ + +#ifndef __INCpcConsoleh +#define __INCpcConsoleh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "tyLib.h" + +#define NPARS 16 /* number of escape parameters */ + +/* key board device descriptor */ + +typedef struct + { + BOOL curMode; /* cursor mode TRUE / FALSE */ + int kbdMode; /* keyboard mode Japanese/English */ + UINT16 kbdFlags; /* 16 bit keyboard flags */ + UINT16 kbdState; /* unshift :shift :cntrl:numeric */ + int currCon; /* current console */ + FUNCPTR kbdHook; /* vga console hook */ + BOOL convertChar; /* convert scan codes to ASCII */ + } KBD_CON_DEV; + +/* vga console device descriptor */ + +typedef struct + { + UCHAR * memBase; /* video memory base */ + UCHAR * selReg; /* select register */ + UCHAR * valReg; /* value register */ + int row, col; /* current cursor position */ + UCHAR * curChrPos; /* current character position */ + UCHAR curAttrib; /* current attribute */ + UCHAR defAttrib; /* current default attribute */ + int nrow, ncol; /* current screen geometry */ + int scst, sced; /* scroll region from to */ + BOOL rev; /* revarse mode char */ + BOOL autoWrap; /* auto Wrap mode */ + BOOL sv_rev; /* saved revarse mode char */ + int sv_row, sv_col; /* saved cursor position */ + UCHAR sv_curAttrib; /* saved attributes */ + BOOL scrollCheck; /* scroll check */ + UCHAR * charSet; /* character set Text or Graphics */ + int vgaMode; /* added to support graphics Mode */ + BOOL colorMode; /* color mode MONO / COLOR */ + BOOL insMode; /* insert mode on / off */ + char tab_stop [80]; /* tab stop mark */ + UINT16 escFlags; /* 16 bit escape flags */ + int escParaCount; /* seen escape parameters (count) */ + int escPara[NPARS]; /* parameters */ + BOOL escQuestion; /* ? mark in escape sequence */ + char escResp[10]; /* esc sequence response buffer */ + FUNCPTR vgaHook; /* key board hook */ + } VGA_CON_DEV; + + +/* pc console device descriptor */ + +typedef struct /* CON_DRV_DEV */ + { + TY_DEV tyDev; + BOOL created; /* true if this device is created */ + KBD_CON_DEV * ks; /* pointer to keyboard descriptor */ + VGA_CON_DEV * vs; /* pointer to vga console descriptor */ + } PC_CON_DEV; + +/* + * Keyboard definitions + */ + +#define WAIT_MAX 100 /* Maximum wait time for keyboard */ +#define E0_BASE 0x80 /* enhanced keyboard base */ +#define EXTND_SIZE 16 /* no keys extra with extended code 0xe0 */ + +/* keyboard function table Index */ +#undef SH /* conflicts with SH CPU type */ + +#define AS 0 /* normal character index */ +#define SH 1 /* shift index */ +#define CN 2 /* control index */ +#define NM 3 /* numeric lock index */ +#define CP 4 /* capslock index */ +#define ST 5 /* stop output index */ +#define EX 6 /* extended code index */ +#define ES 7 /* escape and extended code index */ + +/* Keyboard special key flags */ + +#define NORMAL 0x0000 /* normal key */ +#define STP 0x0001 /* capslock flag */ +#define NUM 0x0002 /* numeric lock flag */ +#define CAPS 0x0004 /* scroll lock stop output flag */ +#define SHIFT 0x0008 /* shift flag */ +#define CTRL 0x0010 /* control flag */ +#define EXT 0x0020 /* extended scan code 0xe0 */ +#define ESC 0x0040 /* escape key press */ +#define EW EXT|ESC /* escape and Extend */ +#define E1 0x0080 /* extended scan code with 0xE1 */ +#define PRTSC 0x0100 /* print screen flag */ +#define BRK 0x0200 /* make break flag for keyboard */ + +/* keyboard on off defines */ + +#define K_ON 0xff /* key */ +#define K_OFF 0x00 /* key */ + +/* monitor definitions */ + +#define TEXT_SET 0 /* Normal text set */ +#define GRAPHICS_VT100_SET 1 /* vt100 graphics set */ +#define IBM_GRAPHICS_SET 2 /* IBM graphics character set */ +#define TEXT_MODE 0 /* monitor in text mode */ +#define GRAPHICS_MODE 1 /* monitor in graphics mode */ +#define INSERT_MODE_OFF 0 /* character insert mode off */ +#define INSERT_MODE_ON 1 /* character insert mode on */ +#define FG_ATTR_MASK 0x07 /* foreground attribute mask */ +#define BG_ATTR_MASK 0x70 /* background attribute mask */ +#define INT_BLINK_MASK 0x88 /* intensity and blinking mask */ +#define FORWARD 1 /* scroll direction forward */ +#define BACKWARD 0 /* scroll direction backward */ + +/* escape flags */ + +#define ESC_NORMAL 0x0001 /* normal state */ +#define ESC_ESC 0x0002 /* ESC state */ +#define ESC_BRACE 0x0004 /* ESC [ state */ +#define ESC_GET_PARAMS 0x0008 /* ESC [ n state */ +#define ESC_GOT_PARAMS 0x0010 /* ESC [ n;n;n; state */ +#define ESC_FUNC_KEY 0x0020 /* ESC [ [ state */ +#define ESC_HASH 0x0040 /* ESC # state */ +#define ESC_SET_TEXT 0x0080 /* ESC ( state */ +#define ESC_SET_GPRAHICS 0x0100 /* ESC ) state */ + +/* ioctl and attribute definitions */ + +#define CONIOSETATRB 1001 +#define CONIOGETATRB 1002 +#define CONIOSETKBD 1003 +#define CONIOSCREENREV 1004 +#define CONIOBEEP 1005 +#define CONIOCURSORON 1006 +#define CONIOCURSOROFF 1007 +#define CONIOCURSORMOVE 1008 +#define CONIOCURCONSOLE 1009 +#define CONIOCONVERTSCAN 1010 +#define CONIOLEDS 1011 + +#define UNDERLINE 0x01 /* only if monochrome */ +#define ATRB_FG_BLACK 0x00 +#define ATRB_FG_BLUE 0x01 +#define ATRB_FG_GREEN 0x02 +#define ATRB_FG_CYAN 0x03 +#define ATRB_FG_RED 0x04 +#define ATRB_FG_MAGENTA 0x05 +#define ATRB_FG_BROWN 0x06 +#define ATRB_FG_WHITE 0x07 +#define ATRB_BRIGHT 0x08 +#define ATRB_FG_GRAY (ATRB_FG_BLACK | ATRB_BRIGHT) +#define ATRB_FG_LIGHTBLUE (ATRB_FG_BLUE | ATRB_BRIGHT) +#define ATRB_FG_LIGHTGREEN (ATRB_FG_GREEN | ATRB_BRIGHT) +#define ATRB_FG_LIGHTCYAN (ATRB_FG_CYAN | ATRB_BRIGHT) +#define ATRB_FG_LIGHTRED (ATRB_FG_RED | ATRB_BRIGHT) +#define ATRB_FG_LIGHTMAGENTA (ATRB_FG_MAGENTA | ATRB_BRIGHT) +#define ATRB_FG_YELLOW (ATRB_FG_BROWN | ATRB_BRIGHT) +#define ATRB_FG_BRIGHTWHITE (ATRB_FG_WHITE | ATRB_BRIGHT) +#define ATRB_BG_BLACK 0x00 +#define ATRB_BG_BLUE 0x10 +#define ATRB_BG_GREEN 0x20 +#define ATRB_BG_CYAN 0x30 +#define ATRB_BG_RED 0x40 +#define ATRB_BG_MAGENTA 0x50 +#define ATRB_BG_BROWN 0x60 +#define ATRB_BG_WHITE 0x70 +#define ATRB_BLINK 0x80 +#define ATRB_CHR_REV 0x0100 + +/* function declarations */ +#if defined(__STDC__) || defined(__cplusplus) + +extern void kbdIntr (void); +extern void kbdHrdInit (void); +extern int pcConDrv (void); +extern int pcConDevCreate (char *name, FAST int channel, int rdBufSize, + int wrtBufSize); +extern void vgaHrdInit (void); +extern int vgaWriteString (FAST PC_CON_DEV * pPcCoDv); + +#else +extern void kbdIntr (); +extern void kbdHrdInit (); +extern int pcConDrv (); +extern int pcConDevCreate (); +extern void vgaHrdInit (void); +extern int vgaWriteString (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpcConsoleh */ diff --git a/h/drv/sio/ambaSio.h b/h/drv/sio/ambaSio.h new file mode 100644 index 0000000..80d1285 --- /dev/null +++ b/h/drv/sio/ambaSio.h @@ -0,0 +1,97 @@ +/* ambaSio.h - ARM AMBA UART header file */ + +/* Copyright 1997-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,12apr00,jpd added include of sioLib.h to work with project builds. +01b,19nov97,jpd updated comments/documentation in line with latest standards. +01a,04sep97,jpd written from st16552Sio.h, version 01c. +*/ + +#ifndef __INCambaSioh +#define __INCambaSioh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Register description OF ARM AMBA UART */ + +#ifndef _ASMLANGUAGE + +#include "vxWorks.h" +#include "sioLib.h" + + +/* Register offsets from base address */ + +#define UARTDR 0x00 /* UART data register (R/W) */ +#define RXSTAT 0x04 /* Rx data status register (R/O) */ +#define UMSEOI 0x04 /* Clr modem status changed int (W/O) */ +#define H_UBRLCR 0x08 /* } High middle and low bytes (R/W) */ +#define M_UBRLCR 0x0C /* } of bit rate and line (W/O) */ +#define L_UBRLCR 0x10 /* } register (W/O) */ +#define UARTCON 0x14 /* control register (R/W) */ +#define UARTFLG 0x18 /* FIFO status register (R/O) */ + +/* bit definitions within H_UBRLCR register */ + +#define PARITY_NONE 0x00 /* set no parity */ +#define ONE_STOP 0x00 /* set one stop bit */ +#define FIFO_ENABLE 0x10 /* Enable both FIFOs */ +#define WORD_LEN_5 (0x00 << 5) /* Set UART word lengths */ +#define WORD_LEN_6 (0x01 << 5) +#define WORD_LEN_7 (0x02 << 5) +#define WORD_LEN_8 (0x03 << 5) + + +/* bit definitions within UARTCON register */ + +#define UART_ENABLE 0x01 /* Enable the UART */ + + +/* bit definitions within UARTFLG register */ + +#define FLG_UTXFF (0x01 << 5) /* UART Tx FIFO Full */ +#define FLG_URXFE (0x01 << 4) /* UART Rx FIFO Empty */ + + +typedef struct AMBA_CHAN + { + /* must be first */ + + SIO_CHAN sio; /* standard SIO_CHAN element */ + + /* callbacks */ + + STATUS (*getTxChar) (); /* installed Tx callback routine */ + STATUS (*putRcvChar) (); /* installed Rx callback routine */ + void * getTxArg; /* argument to Tx callback routine */ + void * putRcvArg; /* argument to Rx callback routine */ + + UINT32 * regs; /* AMBA registers */ + UINT8 levelRx; /* Rx Interrupt level for this device */ + UINT8 levelTx; /* Tx Interrupt level for this device */ + + UINT32 channelMode; /* such as INT, POLL modes */ + int baudRate; /* the current baud rate */ + UINT32 xtal; /* UART clock frequency */ + + } AMBA_CHAN; + + +/* function declarations */ + +extern void ambaIntTx (AMBA_CHAN *pChan); +extern void ambaIntRx (AMBA_CHAN *pChan); +extern void ambaDevInit (AMBA_CHAN *pChan); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCambaSioh */ diff --git a/h/drv/sio/cd2400Sio.h b/h/drv/sio/cd2400Sio.h new file mode 100644 index 0000000..ac42f1e --- /dev/null +++ b/h/drv/sio/cd2400Sio.h @@ -0,0 +1,451 @@ +/* cd2400.h - Cirrus Logic CD2400 serial chip header */ + +/* Copyright 1991-1997 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01d,29sep98,fle doc : made it refgen parsable +01c,04mar97,dat SPR 7767, added #ifdef _ASMLANGUAGE +01b,15jun95,ms updated for new driver. +01a,06mar95,myz written (from cd2400Serial.h). +*/ + +/* +*/ + +#ifndef __INCcd2400Sioh +#define __INCcd2400Sioh + +#ifdef __cplusplus +extern "C" { +#endif + +#define N_CHANNELS 4 /* number of serial channels on chip */ + +#ifndef _ASMLANGUAGE + +/* channel descriptors */ + +typedef struct + { + /* always goes first */ + + SIO_DRV_FUNCS * pDrvFuncs; /* driver functions */ + + /* callbacks */ + + STATUS (*getTxChar) (); + STATUS (*putRcvChar) (); + void * getTxArg; + void * putRcvArg; + + BOOL created; + UINT16 int_vec; /* channel interrupt vector base */ + UINT16 chan_num; /* the channel number of this device */ + UINT16 channelMode; + void (*intEnDisable)(int mode); + struct CD2400_QUSART * pQusart; + } CD2400_CHAN; + +/* cd2400 chip descriptor */ + +typedef struct CD2400_QUSART + { + CD2400_CHAN channel[N_CHANNELS]; + UINT16 numChannels; + char * baseAdrs; /* the base address of the device */ + UINT16 regSpacing; + INT16 devMode; /* only one channel in polling mode */ + int baudClkFreq; + BOOL (*rxReady) (struct CD2400_QUSART *); + BOOL (*txReady) (struct CD2400_QUSART *); + } CD2400_QUSART; + +/* on-board access, register definitions */ + +#undef MPCC_ADRS +#define MPCC_ADRS(reg) (pQusart->baseAdrs + (reg * pQusart->regSpacing)) + +/* MPCC -- cd2400 serial channel chip -- register definitions + * Defined in this order which is the order of defined in + * the CIRRUS LOGIC document + */ + +/* GLOBAL REGISTERS */ +#define MPCC_GFRCR MPCC_ADRS(0x81) /* Global Firmware Rev Code Register */ +#define MPCC_TFTC MPCC_ADRS(0x80) /* Transmit FIFO Transfer Count */ +#define MPCC_MEOIR MPCC_ADRS(0x86) /* Modem End of Interrupt Register */ +#define MPCC_TEOIR MPCC_ADRS(0x85) /* Transmit End of Interrupt Register */ +#define MPCC_REOIR MPCC_ADRS(0x84) /* Receive End of Interrupt Register */ +#define MPCC_MISR MPCC_ADRS(0x8b) /* Modem (/Timer) Interrupt Status Re */ +#define MPCC_TISR MPCC_ADRS(0x8a) /* Transmit Interrupt Status Register */ +#define MPCC_RISR MPCC_ADRS(0x88) /* Receive Interrupt Stat Reg (WORD) */ +#define MPCC_RISRL MPCC_ADRS(0x89) /* Receive Interrupt Stat Reg Low */ +#define MPCC_RISRH MPCC_ADRS(0x88) /* Receive Interrupt Stat Reg High */ +#define MPCC_MIR MPCC_ADRS(0xef) /* Modem Interrupt Register */ +#define MPCC_TIR MPCC_ADRS(0xec) /* Transmit Interrupt Register */ +#define MPCC_RIR MPCC_ADRS(0xed) /* Receive Interrupt Register */ +#define MPCC_STK MPCC_ADRS(0xe2) /* Stack Register */ +#define MPCC_TPR MPCC_ADRS(0xda) /* Timer Period Register */ +#define MPCC_PILR1 MPCC_ADRS(0xe3) /* Priority Interrupt Level Reg 1 */ +#define MPCC_PILR2 MPCC_ADRS(0xe0) /* Priority Interrupt Level Reg 2 */ +#define MPCC_PILR3 MPCC_ADRS(0xe1) /* Priority Interrupt Level Reg 3 */ +#define MPCC_CAR MPCC_ADRS(0xee) /* Channel Access Register */ +#define MPCC_RDR MPCC_ADRS(0xf8) /* Receive Data Register */ +#define MPCC_TDR MPCC_ADRS(0xf8) /* Transmit Data Register */ +#define MPCC_DMR MPCC_ADRS(0xf6) /* DMA Mode Register */ + +/* Per-Channel Registers */ + +#define MPCC_LICR MPCC_ADRS(0x26) /* Local Interrupting Channel Reg */ +#define MPCC_LIVR MPCC_ADRS(0x09) /* Local Interrupt Vector Register */ +#define MPCC_CCR MPCC_ADRS(0x13) /* Channel Command Register */ +#define MPCC_STCR MPCC_ADRS(0x12) /* Special Transmit Command Register */ +#define MPCC_IER MPCC_ADRS(0x11) /* Interrupt Enable Register */ +#define MPCC_COR1 MPCC_ADRS(0x10) /* Channel Option Register 1 */ +#define MPCC_COR2 MPCC_ADRS(0x17) /* Channel Option Register 2 */ +#define MPCC_COR3 MPCC_ADRS(0x16) /* Channel Option Register 3 */ +#define MPCC_COR4 MPCC_ADRS(0x15) /* Channel Option Register 4 */ +#define MPCC_COR5 MPCC_ADRS(0x14) /* Channel Option Register 5 */ +#define MPCC_COR6 MPCC_ADRS(0x18) /* Channel Option Register 6 */ +#define MPCC_COR7 MPCC_ADRS(0x07) /* Channel Option Register 7 */ +#define MPCC_CMR MPCC_ADRS(0x1b) /* Channel Mode Register */ +#define MPCC_CSR MPCC_ADRS(0x1a) /* Channel Status Reg (Sync Modes) */ +#define MPCC_DMABSTS MPCC_ADRS(0x19) /* DMA Buffer Status */ +#define MPCC_LNXT MPCC_ADRS(0x2e) /* LNext Character */ +#define MPCC_SCHR1 MPCC_ADRS(0x1f) /* Special Character Register 1 */ +#define MPCC_RFAR1 MPCC_ADRS(0x1f) /* Receive Frame Address Register 1 */ +#define MPCC_SCHR2 MPCC_ADRS(0x1e) /* Special Character Register 2 */ +#define MPCC_RFAR2 MPCC_ADRS(0x1e) /* Receive Frame Address Register 2 */ +#define MPCC_SCHR3 MPCC_ADRS(0x1d) /* Special Character Register 3 */ +#define MPCC_RFAR3 MPCC_ADRS(0x1d) /* Receive Frame Address Register 3 */ +#define MPCC_SCHR4 MPCC_ADRS(0x1c) /* Special Character Register 4 */ +#define MPCC_RFAR4 MPCC_ADRS(0x1c) /* Receive Frame Address Register 4 */ +#define MPCC_SCRL MPCC_ADRS(0x23) /* Special Character Range Low */ +#define MPCC_SCRH MPCC_ADRS(0x22) /* Special Character Range High */ +#define MPCC_RTPR MPCC_ADRS(0x24) /* Receive Timeout Period Register */ +#define MPCC_RTPRL MPCC_ADRS(0x25) /* Receive Timeout Period Reg Low */ +#define MPCC_RTPRH MPCC_ADRS(0x24) /* Receive Timeout Period Reg High */ +#define MPCC_GT1 MPCC_ADRS(0x2a) /* General Timer 1 */ +#define MPCC_GT1L MPCC_ADRS(0x2b) /* General Timer 1 Low */ +#define MPCC_GT1H MPCC_ADRS(0x2a) /* General Timer 1 High */ +#define MPCC_GT2 MPCC_ADRS(0x29) /* General Timer 2 */ +#define MPCC_TTR MPCC_ADRS(0x29) /* Transmit Timer Register */ +#define MPCC_RFOC MPCC_ADRS(0x30) /* Receive FIFO Output Count */ +#define MPCC_TCBADRL MPCC_ADRS(0x3a) /* Transmit Current Buffer Addr Lower */ +#define MPCC_TCBADRH MPCC_ADRS(0x38) /* Transmit Current Buffer Addr Upper */ +#define MPCC_RCBADRL MPCC_ADRS(0x3e) /* Receive Current Buffer Addr Lower */ +#define MPCC_RCBADRH MPCC_ADRS(0x3c) /* Receive Current Buffer Addr Upper */ +#define MPCC_ARBADRL MPCC_ADRS(0x42) /* A Receive Buffer Address Lower */ +#define MPCC_ARBADRU MPCC_ADRS(0x40) /* A Receive Buffer Address Upper */ +#define MPCC_BRBADRL MPCC_ADRS(0x46) /* B Receive Buffer Address Lower */ +#define MPCC_BRBADRU MPCC_ADRS(0x44) /* B Receive Buffer Address Upper */ +#define MPCC_ARBCNT MPCC_ADRS(0x4a) /* A Receive Buffer Count */ +#define MPCC_BRBCNT MPCC_ADRS(0x48) /* B Receive Buffer Count */ +#define MPCC_ARBSTS MPCC_ADRS(0x4f) /* A Receive Buffer Status */ +#define MPCC_BRBSTS MPCC_ADRS(0x4e) /* B Receive Buffer Status */ +#define MPCC_ATBADRL MPCC_ADRS(0x52) /* A Transmit Buffer Address Lower */ +#define MPCC_ATBADRU MPCC_ADRS(0x50) /* B Transmit Buffer Address Upper */ +#define MPCC_BTBADRL MPCC_ADRS(0x56) /* B Transmit Buffer Address Lower */ +#define MPCC_BTBADRU MPCC_ADRS(0x54) /* B Transmit Buffer Address Upper */ +#define MPCC_ATBCNT MPCC_ADRS(0x5a) /* A Buffer Transmit Byte Count */ +#define MPCC_BTBCNT MPCC_ADRS(0x58) /* B Buffer Transmit Byte Count */ +#define MPCC_ATBSTS MPCC_ADRS(0x5f) /* A Transmit Buffer Status */ +#define MPCC_BTBSTS MPCC_ADRS(0x5e) /* B Transmit Buffer Status */ +#define MPCC_MSVRRTS MPCC_ADRS(0xde) /* Modem Signal Value Register - RTS */ +#define MPCC_MSVRDTR MPCC_ADRS(0xdf) /* Modem Signal Value Register - DTR */ +#define MPCC_TBPR MPCC_ADRS(0xc3) /* Transmit Baud Rate Period Register */ +#define MPCC_TCOR MPCC_ADRS(0xc0) /* Transmit Clock Option Register */ +#define MPCC_RBPR MPCC_ADRS(0xcb) /* Receive Baud Rate Period Register */ +#define MPCC_RCOR MPCC_ADRS(0xc8) /* Receive Clock Option Register */ +#define MPCC_CPSR MPCC_ADRS(0xd6) /* CRC Polynomial Select Register */ + +/* Now let's define some register bit values */ + +/* MEOIR 0x86 Modem End of Interrupt Register */ +/* TEOIR 0x85 Transmit End of Interrupt Register */ +/* REOIR 0x84 Receive End of Interrupt Register */ +#define EOIR_SET_TIMER_2 0x20 /* load MISR to timer 2 */ +#define EOIR_SET_TIMER_1 0x10 /* load MISR to timer 1 */ +#define EOIR_TERMINATE_BUF 0x80 /* 1=Terminate buffer in DMA Mode */ +#define EOIR_END_OF_FRAME 0x40 /* 0 = no, 1 = yes */ +#define EOIR_NO_TRANSFER 0x08 /* no data transferred */ +#define EOIR_DIS_EXCEP_CHAR 0x40 /* 0 = no, 1 = yes */ +#define EOIR_TRANSFER 0x00 /* data was transferred */ + +/* MISR 0x8b Modem (/Timer) Interrupt Status Register */ +#define MISR_DSR_CHANGED 0x80 /* 0 = no, 1 = yes */ +#define MISR_CD_CHANGED 0x40 /* 0 = no, 1 = yes */ +#define MISR_CTS_CHANGED 0x20 /* 0 = no, 1 = yes */ +#define MISR_TIMER2_TIMEOUT 0x02 /* 0 = no, 1 = yes */ +#define MISR_TIMER1_TIMEOUT 0x01 /* 0 = no, 1 = yes */ + +/* TISR 0x8a Transmit Interrupt Status Register */ +#define TISR_TRANS_BERR 0x80 /* 0 = no, 1 = yes (Bus error) */ +#define TISR_TRANS_EOF 0x40 /* 0 = no, 1 = yes (End Of Frame) */ +#define TISR_TRANS_EOB 0x20 /* 0 = no, 1 = yes (End Of trans Buf) */ +#define TISR_TRANS_UNDERRUN 0x10 /* 0 = no, 1 = yes */ +#define TISR_TRANS_A_OR_B 0x08 /* 0 = Buffer A, 1 = Buffer B */ +#define TISR_TX_EMPTY 0x02 /* 0 = no, 1 = yes (idle condition) */ +#define TISR_TX_DATA 0x01 /* 0 = no, 1 = yes (below threshold) */ + +/* RISR 0x88 Receive Interrupt Status Register */ +/* RISRL 0x89 Receive Interrupt Status Register Low */ +/* HDLC Mode */ +#define RISR_REC_EOF 0x40 /* 0 = no, 1 = yes */ +#define RISR_REC_ABORT 0x20 /* 0 = no, 1 = yes (term frame) */ +#define RISR_REC_CRC 0x10 /* 0 = no, 1 = yes (CRC error frame) */ +#define RISR_REC_OVERRUN 0x08 /* 0 = no, 1 = yes (Overrun occured) */ +#define RISR_REC_RESIDUAL 0x04 /* 0 = no, 1 = yes (char was partial */ +#define RISR_REC_CLEAR_DCT 0x01 /* 0 = no, 1 = yes (X.21 Clr signal) */ +/* Asynchronous Mode */ +#define RISR_REC_TIMEOUT 0x80 /* 0 = no, 1 = yes (No char rec'd) */ +#define RISR_REC_PARITY_ERR 0x04 /* 0 = no, 1 = yes (Parity error) */ +#define RISR_REC_FRAME_ERR 0x02 /* 0 = no, 1 = yes (Frame error) */ +#define RISR_REC_BREAK 0x01 /* 0 = no, 1 = yes (Break detected) */ + +/* RISRH 0x88 Receive Interrupt Status Register High */ +#define RISR_REC_BERR 0x80 /* 0 = no, 1 = yes (Bus error) */ +#define RISR_REC_EOB 0x20 /* 0 = no, 1 = yes (End Of Buffer) */ +#define RISR_REC_A_OR_B 0x08 /* 0 = Buffer A, 1 = Buffer B */ + +/* MIR 0xef Modem Interrupt Register */ +#define MIR_MODEM_ENABLE 0x80 /* 0 = no, 1 = yes (Modem inter) */ +#define MIR_MODEM_ACTIVE 0x40 /* 0 = no, 1 = yes (Modem Active) */ +#define MIR_MODEM_EOI 0x20 /* 0 = no, 1 = yes (Modem End Of Int) */ + +/* TIR 0xec Transmit Interrupt Register */ +#define TIR_TRANS_ENABLE 0x80 /* 0 = no, 1 = yes (Trans inter) */ +#define TIR_TRANS_ACTIVE 0x40 /* 0 = no, 1 = yes (Trans Active) */ +#define TIR_TRANS_EOI 0x20 /* 0 = no, 1 = yes (Trans End of Int) */ + +/* RIR 0xed Receive Interrupt Register */ +#define RIR_REC_ENABLE 0x80 /* 0 = no, 1 = yes (Rec inter) */ +#define RIR_REC_ACTIVE 0x40 /* 0 = no, 1 = yes (Rec Active) */ +#define RIR_REC_EOI 0x20 /* 0 = no, 1 = yes (Rec End of Int) */ + +/* CAR 0xee Channel Access Register */ +#define CAR_CHANNEL0 0x00 /* Channel 0 1-0 */ +#define CAR_CHANNEL1 0x01 /* Channel 1 1-0 */ +#define CAR_CHANNEL2 0x02 /* Channel 2 1-0 */ +#define CAR_CHANNEL3 0x03 /* Channel 3 1-0 */ + +/* DMR 0xf6 DMA Mode Register */ +#define DMR_BYTE_DMA 0x08 /* Do BYTE DMA always 3 */ +#define DMR_WORD_DMA 0x00 /* Do WORD DMA whenever poss 4 */ + +/* CCR 0x13 Channel Command Register */ +#define CCR_CLEAR_CHANNEL 0x40 /* clear channel 7,6 */ +#define CCR_INIT_CHANNEL 0x20 /* initialize channel 7,5 */ +#define CCR_RESET_ALL 0x10 /* on-chip init ALL CHANNELS 7,4 */ +#define CCR_ENABLE_TRANS 0x08 /* enable transmitter 7,3 */ +#define CCR_DISABLE_TRANS 0x04 /* disable transmitter 7,2 */ +#define CCR_ENABLE_REC 0x02 /* enable receiver 7,1 */ +#define CCR_DISABLE_REC 0x01 /* disable receiver 7,0 */ +#define CCR_CLEAR_TIMER1 0xc0 /* clear general timer 1 7,6 */ +#define CCR_CLEAR_TIMER2 0xa0 /* clear general timer 2 7,5 */ + +/* STCR 0x12 Special Transmit Command Register */ +#define STCR_ABORT_TX 0x40 /* abort transmiss (HDLC) 6 */ +#define STCR_APPD_CMP 0x20 /* append complete (async DMA) 5 */ +#define STCR_SND_SPC 0x08 /* send special character 3 */ +#define STCR_SPECIAL_CHAR1 0x01 /* send special char 1 2-0 */ +#define STCR_SPECIAL_CHAR2 0x02 /* send special char 2 2-0 */ +#define STCR_SPECIAL_CHAR3 0x03 /* send special char 3 2-0 */ +#define STCR_SPECIAL_CHAR4 0x04 /* send special char 4 2-0 */ + +/* IER 0x11 Interrupt Enable Register */ +#define IER_MODEM 0x80 /* modem pin change detect 7 */ +#define IER_RET 0x20 /* Receive Exception Timeout 5 */ +#define IER_RXDATA 0x08 /* Receive Data Interrupt 3 */ +#define IER_TIMER 0x04 /* general timer timeout 2 */ +#define IER_TXEMPTY 0x02 /* transmitter empty 1 */ +#define IER_TXDATA 0x01 /* Transmit Data Interrupt 0 */ + +/* COR1 0x10 Channel Option Register 1 */ +#define COR1_ODD_PARITY 0x80 /* odd parity 7 */ +#define COR1_EVEN_PARITY 0x00 /* even parity 7 */ +#define COR1_NO_PARITY 0x00 /* no parity mode 6-5 */ +#define COR1_FORCE_PARITY 0x20 /* force parity (odd=1/even=0) 6-5 */ +#define COR1_PARITY 0x40 /* normal parity 6-5 */ +#define COR1_IGNORE_PARITY 0x10 /* do not evaluate parity 4 */ +#define COR1_5BITS 0x04 /* 5 data bits 3-0 */ +#define COR1_6BITS 0x05 /* 6 data bits 3-0 */ +#define COR1_7BITS 0x06 /* 7 data bits 3-0 */ +#define COR1_8BITS 0x07 /* 8 data bits 3-0 */ + +/* COR2 0x17 Channel Option Register 2 */ +#define COR2_IXM 0x80 /* xon with any char 7 */ +#define COR2_TXIBE 0x40 /* tx in-band xon/xoff control 6 */ +#define COR2_ETC 0x20 /* embedded tx command enable 5 */ +#define COR2_REMOTE_LOOP 0x08 /* enable remote loopback 3 */ +#define COR2_AUTO_RTS 0x04 /* RTS automatic output enable 2 */ +#define COR2_AUTO_CTS 0x02 /* CTS automatic enable 1 */ +#define COR2_AUTO_DSR 0x01 /* DSR automatic enable 0 */ + +/* COR3 0x16 Channel Option Register 3 */ +#define COR3_ESCDE 0x80 /* extnd spec char det enable 7 */ +#define COR3_RANGE_DETECT 0x40 /* generate special char inter 6 */ +#define COR3_FCT 0x20 /* flow control not passed 5 */ +#define COR3_SCDE 0x10 /* special character detecton 4 */ +#define COR3_1STOP_BIT 0x02 /* 1 stop bit 2-0 */ +#define COR3_1_5STOP_BIT 0x03 /* 1.5 stop bits 2-0 */ +#define COR3_2STOP_BIT 0x04 /* 2 stop bits 2-0 */ + +/* COR4 0x15 Channel Option Register 4 */ +#define COR4_DSR_ZD 0x80 /* 1->0 detect on the DSR* 7 */ +#define COR4_CD_ZD 0x40 /* 1->0 detect on the CD* 6 */ +#define COR4_CTS_ZD 0x20 /* 1->0 detect on the CTS* 5 */ + +/* COR5 0x14 Channel Option Register 5 */ +#define COR5_DSR_OD 0x80 /* 0->1 detect on the DSR* 7 */ +#define COR5_CD_OD 0x40 /* 0->1 detect on the CD* 6 */ +#define COR5_CTS_OD 0x20 /* 0->1 detect on the CTS* 5 */ + +/* COR6 0x18 Channel Option Register 6 */ +#define COR6_NORMAL_CR_NL 0x00 /* no special action on CR/NL 7-5 */ +#define COR6_NL_TO_CR 0x20 /* NL translated to CR 7-5 */ +#define COR6_CR_TO_NL 0x40 /* CR translated to NL 7-5 */ +#define COR6_SWAP_CR_NL 0x60 /* CR->NL, NL->CR 7-5 */ +#define COR6_NO_CR 0x80 /* CR discarded 7-5 */ +#define COR6_NO_CR_NL_TO_CR 0xa0 /* CR discarded, NL->CR 7-5 */ +#define COR6_BRK_EXCEPTION 0x00 /* on break: generate exception 3-4 */ +#define COR6_BRK_TO_NULL 0x08 /* trans to NULL 3-4 */ +#define COR6_BRK_DISCARD 0x18 /* discard character 3-4 */ +/* On Parity/Framing Error: */ +#define COR6_PARITY_EXCEPTION 0x00 /* generate exception interrupt 2-0 */ +#define COR6_PARITY_TO_NULL 0x01 /* translated to a NULL char 2-0 */ +#define COR6_PARITY_IGNORE 0x02 /* ignore error,pass as good 2-0 */ +#define COR6_PARTIY_DISCARD 0x03 /* discard error character 2-0 */ +#define COR6_PARITY_FF_NULL 0x05 /* trans to FF NULL pass as gd 2-0 */ + +/* COR7 0x07 Channel Option Register 7 */ +#define COR7_ISTRIP 0x80 /* strip to 7 bits on input 7 */ +#define COR7_LNEXT 0x40 /* char after LNXT no spec process 6 */ +#define COR7_FCERROR 0x20 /* frlow control on error char 5 */ +#define COR7_NORMAL_CR_NL 0x00 /* on tx CR/NL: no special act 1-0 */ +#define COR7_CR_TO_NL 0x01 /* CR -> NL 1-0 */ +#define COR7_NL_TO_CR_NL 0x02 /* NL -> CR/NL 1-0 */ +#define COR7_CR_TO_NL_NL_TO_CR_NL 0x03 /* CR->NL,NL->CR/NL 1-0 */ + +/* CMR 0x1b Channel Mode Register */ +#define CMR_RX_INTERRUPT 0x00 /* rx tran mode = interrupt 7 */ +#define CMR_RX_DMA 0x80 /* rx tran mode = DMA 7 */ +#define CMR_TX_INTERRUPT 0x00 /* tx tran mode = interrupt 6 */ +#define CMR_TX_DMA 0x40 /* tx tran mode = DMA 6 */ +#define CMR_HDLC_MODE 0x00 /* protocal: HDLC 2-0 */ +#define CMR_BISYNC_MODE 0x01 /* BISYNC 2-0 */ +#define CMR_ASYNC_MODE 0x02 /* ASYNC 2-0 */ +#define CMR_X_21_MODE 0x03 /* X.21 2-0 */ + +/* CSR 0x1a Channel Status Register */ +#define CSR_RX_ENABLE 0x80 /* receiver is enabled 7 */ +#define CSR_RX_FLOFF 0x40 /* receive flow off sent 6 */ +#define CSR_RX_FLON 0x20 /* receive flow on sent 5 */ +#define CSR_TX_ENABLE 0x08 /* transmitter is enabled 3 */ +#define CSR_TX_FLOFF 0x04 /* trans remote stop request 2 */ +#define CSR_TX_FLON 0x02 /* trans remote start request 1 */ + +/* DMABSTS 0x19 DMA Buffer Status */ +#define DMABSTS_RST_APD 0x40 /* reset append mode 6 */ +#define DMABSTS_APPEND 0x10 /* append buffer is in use 4 */ +#define DMABSTS_B_NTBUF 0x08 /* B is next tx buffer 3 */ +#define DMABSTS_TBSY 0x04 /* current tx buffer in use 2 */ +#define DMABSTS_B_NRBUF 0x02 /* B is next rx buffer 1 */ +#define DMABSTS_RBUSY 0x01 /* current rec buffer in use 0 */ + +/* ARBSTS 0x4f A Receive Buffer Status */ +/* BRBSTS 0x4e B Receive Buffer Status */ +#define RBSTS_BUS_ERR 0x80 /* bus error occurred 7 */ +#define RBSTS_EOF 0x40 /* this buffer term frame 6 */ +#define RBSTS_EOB 0x20 /* buffer complete 5 */ +#define RBSTS_2400_OWN 0x01 /* buffer can be used by CD2400 0 */ + +/* ATBSTS 0x5f A Transmit Buffer Status */ +/* BTBSTS 0x5E B Transmit Buffer Status */ +#define TBSTS_BUS_ERR 0x80 /* bus error occurred 7 */ +#define TBSTS_EOF 0x40 /* last in frame/block 6 */ +#define TBSTS_EOB 0x20 /* end of tx buffer reached 5 */ +#define TBSTS_APPEND 0x08 /* data may be appded during tx 3 */ +#define TBSTS_INTR 0x02 /* interrupt required 1 */ +#define TBSTS_2400_OWN 0x01 /* buffer ready to transmit 0 */ + +/* MSVR_RTS 0xde Modem Signal Value Register DTR */ +/* MSVR_DTR 0xdf Modem Signal Value Register DTR */ +#define MSVR_DSR 0x80 /* state of the DSR input 7 */ +#define MSVR_CD 0x40 /* state of the CD input 6 */ +#define MSVR_CTS 0x20 /* state of the CTS input 5 */ +#define MSVR_DTR 0x02 /* state of the DTR output 1 */ +#define MSVR_RTS 0x01 /* state of the RTS output 0 */ + +/* TCOR 0xc0 Transmit Clock Option Register */ +#define TCOR_CLK0 0x00 /* select clock 0 7-5 */ +#define TCOR_CLK1 0x20 /* select clock 1 7-5 */ +#define TCOR_CLK2 0x40 /* select clock 2 7-5 */ +#define TCOR_CLK3 0x60 /* select clock 3 7-5 */ +#define TCOR_CLK4 0x80 /* select clock 4 7-5 */ +#define TCOR_EXTERNAL_CLK 0xc0 /* External clock 7-5 */ +#define TCOR_RECEIVE_CLK 0xe0 /* Receive clock 7-5 */ +#define TCOR_EXT_1X 0x08 /* times 1 extern clock 3 */ +#define TCOR_LLM 0x02 /* enable local loopback 1 */ + +/* TBPR 0xc3 Transmit Baud Rate Period Reg */ +/* RBPR 0xcb Receive Baud Rate Period Reg */ +#define BPR_64000 0x26 /* with clk0 */ +#define BPR_56000 0x2c /* with clk0 */ +#define BPR_38400 0x40 /* with clk0 */ +#define BPR_19200 0x81 /* with clk0 */ +#define BPR_9600 0x40 /* with clk1 */ +#define BPR_7200 0x56 /* with clk1 */ +#define BPR_4800 0x81 /* with clk1 */ +#define BPR_3600 0xad /* with clk1 */ +#define BPR_2400 0x40 /* with clk2 */ +#define BPR_1200 0x81 /* with clk2 */ +#define BPR_600 0x40 /* with clk3 */ +#define BPR_300 0x81 /* with clk3 */ +#define BPR_150 0x40 /* with clk4 */ +#define BPR_110 0x58 /* with clk4 */ +#define BPR_50 0xc2 /* with clk4 */ + +/* RCOR 0xc8 Receive Clock Option Register */ +#define RCOR_TLVAL 0x80 /* transmit line value 7 */ +#define RCOR_DPLL_ENABLE 0x20 /* enable DPLL 5 */ +#define RCOR_DPLL_DISABLE 0x00 /* disable DPLL 5 */ +#define RCOR_DPLL_NRZ 0x00 /* data encoding: NRZ 4-3 */ +#define RCOR_DPLL_NRZI 0x08 /* NRZI 4-3 */ +#define RCOR_DPLL_MANCHESTER 0x10 /* Manches 4-3 */ +#define RCOR_CLK0 0x00 /* select clock 0 2-0 */ +#define RCOR_CLK1 0x01 /* select clock 1 2-0 */ +#define RCOR_CLK2 0x02 /* select clock 2 2-0 */ +#define RCOR_CLK3 0x03 /* select clock 3 2-0 */ +#define RCOR_CLK4 0x04 /* select clock 4 2-0 */ + +/* CPSR 0xd6 CRC Polynomial Select Register */ +#define CPSR_CRC_16 0x01 /* CRC-16 polynomial (Bisync) 0 */ +#define CPSR_CRC_V41 0x00 /* CRC V.41 polynomial (HDLC) 0 */ + +/* function prototypes */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void cd2400HrdInit (CD2400_QUSART *pQusart); +extern void cd2400IntRx (CD2400_CHAN *pDev); +extern void cd2400IntTx (CD2400_CHAN *pDev); +extern void cd2400Int (CD2400_CHAN *pDev); + +#else /* __STDC__ */ + +extern void cd2400HrdInit (); +extern void cd2400IntRx (); +extern void cd2400IntTx (); +extern void cd2400Int (); + +#endif /* __STDC__ */ + +#endif /*__ASM_LANGUAGE*/ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcd2400h */ diff --git a/h/drv/sio/coldfireSio.h b/h/drv/sio/coldfireSio.h new file mode 100644 index 0000000..2c22ecd --- /dev/null +++ b/h/drv/sio/coldfireSio.h @@ -0,0 +1,217 @@ +/* coldfireSio.h - Motorola ColdFire internal UART header file */ + +/* Copyright 1984-1998 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,09jul98,gls Adapted to WRS coding conventions +01a,01may98,mem created, based on m5204Sio.h. +*/ + +/* +This file contains constants and defines for the UART contained in several +of the Motorola ColdFire ports. +*/ + +#ifndef __INCcoldfireSioh +#define __INCcoldfireSioh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "sioLib.h" + +typedef struct + { + SIO_DRV_FUNCS * pDrvFuncs; /* Driver functions */ + /* CallBacks */ + STATUS (*getTxChar)(); + STATUS (*putRcvChar)(); + void * getTxArg; + void * putRcvArg; + + UINT clkRate; /* system clock rate */ + UINT16 mode; /* SIO_MODE */ + unsigned char intVec; + int options; + int intEnable; + UINT baudRate; + UCHAR oprCopy; + UCHAR acrCopy; + UCHAR imrCopy; + + volatile UCHAR *mr; /* UART mode register */ + volatile UCHAR *sr; /* UART status register */ + volatile UCHAR *csr; /* UART clock select register */ + volatile UCHAR *cr; /* UART command register */ + volatile UCHAR *rb; /* UART receive buffer register */ + volatile UCHAR *tb; /* UART transmit buffer register */ + volatile UCHAR *ipcr; /* UART input port change register */ + volatile UCHAR *acr; /* UART auxiliary control register */ + volatile UCHAR *isr; /* UART interrupt status register */ + volatile UCHAR *imr; /* UART interrupt mask register */ + volatile UCHAR *bg1; /* UART baud generator prescale register 1 */ + volatile UCHAR *bg2; /* UART baud generator prescale register 2 */ + volatile UCHAR *ivr; /* UART interrupt vector register */ + volatile UCHAR *ip; /* UART input port register */ + volatile UCHAR *op1; /* UART output port set cmd */ + volatile UCHAR *op2; /* UART output port reset cmd */ + } COLDFIRE_CHAN; + +#endif /* _ASMLANGUAGE */ + +/* register bit definitions */ + +/* MR1 - mode register 1 */ + +#define COLDFIRE_UART_MR1_BC0 (1 << 0) /* bits per char 0 */ +#define COLDFIRE_UART_MR1_BC1 (1 << 1) /* bits per char 1 */ +#define COLDFIRE_UART_MR1_PT (1 << 2) /* parity type */ +#define COLDFIRE_UART_MR1_PM0 (1 << 3) /* parity mode 0 */ +#define COLDFIRE_UART_MR1_PM1 (1 << 4) /* parity mode 1 */ +#define COLDFIRE_UART_MR1_ERR (1 << 5) /* error mode */ +#define COLDFIRE_UART_MR1_RX_IRQ (1 << 6) /* receiver interrupt select */ +#define COLDFIRE_UART_MR1_RX_RTS (1 << 7) /* Rx RTS control */ + +/* Some common modes */ + +#define COLDFIRE_UART_MR1_BITS_CHAR_5 0 +#define COLDFIRE_UART_MR1_BITS_CHAR_6 COLDFIRE_UART_MR1_BC0 +#define COLDFIRE_UART_MR1_BITS_CHAR_7 COLDFIRE_UART_MR1_BC1 +#define COLDFIRE_UART_MR1_BITS_CHAR_8 (COLDFIRE_UART_MR1_BC0 \ + | COLDFIRE_UART_MR1_BC1) +#define COLDFIRE_UART_MR1_NO_PARITY (COLDFIRE_UART_MR1_PM1) +#define COLDFIRE_UART_MR1_PAR_MODE_MULTI (COLDFIRE_UART_MR1_PM0 \ + | COLDFIRE_UART_MR1_PM1) +#define COLDFIRE_UART_MR1_EVEN_PARITY 0 +#define COLDFIRE_UART_MR1_ODD_PARITY COLDFIRE_UART_MR1_PT + +/* MR2 - mode register 2 */ + +#define COLDFIRE_UART_MR2_SB0 (1 << 0) /* stop bit control 0 */ +#define COLDFIRE_UART_MR2_SB1 (1 << 1) /* stop bit control 1 */ +#define COLDFIRE_UART_MR2_SB2 (1 << 2) /* stop bit control 2 */ +#define COLDFIRE_UART_MR2_SB3 (1 << 3) /* stop bit control 3 */ +#define COLDFIRE_UART_MR2_TX_CTS (1 << 4) /* Tx CTS control */ +#define COLDFIRE_UART_MR2_TX_RTS (1 << 5) /* Tx RTS control */ +#define COLDFIRE_UART_MR2_CM0 (1 << 6) /* channel mode 0 */ +#define COLDFIRE_UART_MR2_CM1 (1 << 7) /* channel mode 1 */ + +/* Some common bit lengths */ + +#define COLDFIRE_UART_MR2_STOP_BITS_1 (COLDFIRE_UART_MR2_SB0 \ + | COLDFIRE_UART_MR2_SB1 \ + | COLDFIRE_UART_MR2_SB2) +#define COLDFIRE_UART_MR2_STOP_BITS_2 (COLDFIRE_UART_MR2_SB0 \ + | COLDFIRE_UART_MR2_SB1 \ + | COLDFIRE_UART_MR2_SB2 \ + | COLDFIRE_UART_MR2_SB3) + +/* SR - status register */ + +#define COLDFIRE_UART_SR_RXRDY (1 << 0) /* Rx ready */ +#define COLDFIRE_UART_SR_FFULL (1 << 1) /* FIFO full */ +#define COLDFIRE_UART_SR_TXRDY (1 << 2) /* Tx ready */ +#define COLDFIRE_UART_SR_TXEMP (1 << 3) /* Tx empty */ +#define COLDFIRE_UART_SR_OE (1 << 4) /* overrun error */ +#define COLDFIRE_UART_SR_PE (1 << 5) /* parity error */ +#define COLDFIRE_UART_SR_FE (1 << 6) /* framing error */ +#define COLDFIRE_UART_SR_RB (1 << 7) /* received break */ + +/* CSR - clock select register */ + +#define COLDFIRE_UART_CSR_TCS0 (1 << 0) /* Tx clock select 0 */ +#define COLDFIRE_UART_CSR_TCS1 (1 << 1) /* Tx clock select 1 */ +#define COLDFIRE_UART_CSR_TCS2 (1 << 2) /* Tx clock select 2 */ +#define COLDFIRE_UART_CSR_TCS3 (1 << 3) /* Tx clock select 3 */ +#define COLDFIRE_UART_CSR_RCS0 (1 << 4) /* Rx clock select 0 */ +#define COLDFIRE_UART_CSR_RCS1 (1 << 5) /* Rx clock select 1 */ +#define COLDFIRE_UART_CSR_RCS2 (1 << 6) /* Rx clock select 2 */ +#define COLDFIRE_UART_CSR_RCS3 (1 << 7) /* Rx clock select 3 */ + +#define COLDFIRE_UART_CSR_TIMER_TX (COLDFIRE_UART_CSR_TCS0 \ + | COLDFIRE_UART_CSR_TCS2 \ + | COLDFIRE_UART_CSR_TCS3) +#define COLDFIRE_UART_CSR_TIMER_RX (COLDFIRE_UART_CSR_RCS0 \ + | COLDFIRE_UART_CSR_RCS2 \ + | COLDFIRE_UART_CSR_RCS3) + +/* CR - command register */ + +#define COLDFIRE_UART_CR_RC0 (1 << 0) /* receiver control bit 0 */ +#define COLDFIRE_UART_CR_RC1 (1 << 1) /* receiver control bit 1 */ +#define COLDFIRE_UART_CR_TC0 (1 << 2) /* transmitter control bit 0 */ +#define COLDFIRE_UART_CR_TC1 (1 << 3) /* transmitter control bit 1 */ +#define COLDFIRE_UART_CR_MISC0 (1 << 4) /* misc control bit 0 */ +#define COLDFIRE_UART_CR_MISC1 (1 << 5) /* misc control bit 1 */ +#define COLDFIRE_UART_CR_MISC2 (1 << 6) /* misc control bit 2 */ + +/* Some common commands */ + +#define COLDFIRE_UART_CR_TX_ENABLE (COLDFIRE_UART_CR_TC0) +#define COLDFIRE_UART_CR_TX_DISABLE (COLDFIRE_UART_CR_TC1) +#define COLDFIRE_UART_CR_RX_ENABLE (COLDFIRE_UART_CR_RC0) +#define COLDFIRE_UART_CR_RX_DISABLE (COLDFIRE_UART_CR_RC1) +#define COLDFIRE_UART_CR_RESET_MODE_PTR (COLDFIRE_UART_CR_MISC0) +#define COLDFIRE_UART_CR_RESET_RX (COLDFIRE_UART_CR_MISC1) +#define COLDFIRE_UART_CR_RESET_TX (COLDFIRE_UART_CR_MISC1 \ + | COLDFIRE_UART_CR_MISC0) +#define COLDFIRE_UART_CR_RESET_ERR (COLDFIRE_UART_CR_MISC2) +#define COLDFIRE_UART_CR_RESET_BRK (COLDFIRE_UART_CR_MISC2 \ + | COLDFIRE_UART_CR_MISC0) + +/* ACR - auxiliary control register */ + +#define COLDFIRE_UART_ACR_IEC (1 << 0) /* input enable control */ + +/* IMR - interrupt mask register */ + +#define COLDFIRE_UART_IMR_TXRDY (1 << 0) /* transmitter ready */ +#define COLDFIRE_UART_IMR_RXRDY (1 << 1) /* receiver ready */ +#define COLDFIRE_UART_IMR_DB (1 << 2) /* delta break */ +#define COLDFIRE_UART_IMR_COS (1 << 7) /* change of CTS state */ + +/* ISR - interrupt status register */ + +#define COLDFIRE_UART_ISR_TXRDY (1 << 0) /* transmitter ready */ +#define COLDFIRE_UART_ISR_RXRDY (1 << 1) /* receiver ready */ +#define COLDFIRE_UART_ISR_DB (1 << 2) /* delta break */ +#define COLDFIRE_UART_ISR_COS (1 << 7) /* change of CTS state */ + +/* IP - input port register */ + +#define COLDFIRE_UART_IP_CTS (1 << 0) /* current CTS state */ + +/* OP1 - output set register */ + +#define COLDFIRE_UART_OP1_RTS (1 << 0) /* set RTS */ + +/* OP2 - output reset register */ + +#define COLDFIRE_UART_OP2_RTS (1 << 0) /* clear RTS */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT void coldfireDevInit (COLDFIRE_CHAN *pChan); +IMPORT void coldfireDevInit2 (COLDFIRE_CHAN *pChan); +IMPORT void coldfireInt (COLDFIRE_CHAN *pChan); + +#else /* __STDC__ */ + +IMPORT void coldfireDevInit (); +IMPORT void coldfireDevInit2 (); +IMPORT void coldfireInt (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcoldfireSioh */ diff --git a/h/drv/sio/evbNs16550Sio.h b/h/drv/sio/evbNs16550Sio.h new file mode 100644 index 0000000..08bdd4a --- /dev/null +++ b/h/drv/sio/evbNs16550Sio.h @@ -0,0 +1,88 @@ +/* evbNs16550Sio.h - header file for binary interface NS 16550 UART driver */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,02dec97,db changed type from char to UCHAR for element outByte() in + EVBNS16550_CHAN structure for compatibility with sysLib.h. +01a,07mar96,tam written (from i8250Sio.h) +*/ + +#ifndef __INCevbNs16550Sioh +#define __INCevbNs16550Sioh + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifndef _ASMLANGUAGE + +#include "vxWorks.h" +#include "sioLib.h" + +/* channel data structure */ + +typedef struct EVBNS16550_CHAN + { + SIO_DRV_FUNCS * pDrvFuncs; /* driver functions */ + + STATUS (*getTxChar) (); + STATUS (*putRcvChar) (); + void * getTxArg; + void * putRcvArg; + + UINT16 int_vec; /* interrupt vector number */ + UINT16 channelMode; /* SIO_MODE_[INT | POLL] */ + UCHAR (*inByte) (ULONG); /* routine to read a byte from register */ + void (*outByte)(ULONG,UCHAR); /* routine to write a byte to register */ + + UINT32 clkFreq; /* baud rate generator clock */ + int baudRate; /* baud rate */ + + ULONG lcr; /* UART line control register */ + ULONG lst; /* UART line status register */ + ULONG mdc; /* UART modem control register */ + ULONG msr; /* UART modem status register */ + ULONG ier; /* UART interrupt enable register */ + ULONG iid; /* UART interrupt ID register */ + ULONG brdl; /* UART baud rate register */ + ULONG brdh; /* UART baud rate register */ + ULONG data; /* UART data register */ + } EVBNS16550_CHAN; + +/* register definitions */ + +#define UART_THR 0x00 /* Transmitter holding reg. */ +#define UART_RDR 0x00 /* Receiver data reg. */ +#define UART_BRDL 0x00 /* Baud rate divisor (LSB) */ +#define UART_BRDH 0x01 /* Baud rate divisor (MSB) */ +#define UART_IER 0x01 /* Interrupt enable reg. */ +#define UART_IID 0x02 /* Interrupt ID reg. */ +#define UART_LCR 0x03 /* Line control reg. */ +#define UART_MDC 0x04 /* Modem control reg. */ +#define UART_LST 0x05 /* Line status reg. */ +#define UART_MSR 0x06 /* Modem status reg. */ + + +#if defined(__STDC__) || defined(__cplusplus) + +extern void evbNs16550HrdInit(EVBNS16550_CHAN *pDev); +extern void evbNs16550Int (EVBNS16550_CHAN *pDev); + +#else + +extern void evbNs16550HrdInit(); +extern void evbNs16550Int(); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCevbNs16550Sioh */ diff --git a/h/drv/sio/i8250Sio.h b/h/drv/sio/i8250Sio.h new file mode 100644 index 0000000..3255603 --- /dev/null +++ b/h/drv/sio/i8250Sio.h @@ -0,0 +1,155 @@ +/* i8250Sio.h - header file for binary interface Intel 8250 UART driver */ + +/* Copyright 1984-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,03jun98,hdn changed I8250_IIR_MASK from 6 to 7 to fix the TX-int problem. +01c,22may97,db added macros for all i8250 registers(SPR #7542). +01b,15jun95,ms updated for new driver. +01a,15mar95,myz written (from i8250Serial.h) +*/ + +#ifndef __INCi8250Sioh +#define __INCi8250Sioh + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifndef _ASMLANGUAGE + +#include "vxWorks.h" +#include "sioLib.h" + +/* channel data structure */ + +typedef struct /* I8250_CHAN */ + { + SIO_DRV_FUNCS * pDrvFuncs; /* driver functions */ + + STATUS (*getTxChar) (); /* pointer to xmitr function */ + STATUS (*putRcvChar) (); /* pointer tp rcvr function */ + void * getTxArg; + void * putRcvArg; + + UINT16 int_vec; /* interrupt vector number */ + UINT16 channelMode; /* SIO_MODE_[INT | POLL] */ + UCHAR (*inByte) (int); /* routine to read a byte from register */ + void (*outByte)(int,char); /* routine to write a byte to register */ + + ULONG lcr; /* UART line control register */ + ULONG lst; /* UART line status register */ + ULONG mdc; /* UART modem control register */ + ULONG msr; /* UART modem status register */ + ULONG ier; /* UART interrupt enable register */ + ULONG iid; /* UART interrupt ID register */ + ULONG brdl; /* UART baud rate register */ + ULONG brdh; /* UART baud rate register */ + ULONG data; /* UART data register */ + ULONG options; /* UART hardware options */ + } I8250_CHAN; + + + +typedef struct /* BAUD */ + { + int rate; /* a baud rate */ + int preset; /* counter preset value to write to DUSCC_CTPR[HL]A */ + } BAUD; + +/* register definitions */ + +#define UART_THR 0x00 /* Transmitter holding reg. */ +#define UART_RDR 0x00 /* Receiver data reg. */ +#define UART_BRDL 0x00 /* Baud rate divisor (LSB) */ +#define UART_BRDH 0x01 /* Baud rate divisor (MSB) */ +#define UART_IER 0x01 /* Interrupt enable reg. */ +#define UART_IID 0x02 /* Interrupt ID reg. */ +#define UART_LCR 0x03 /* Line control reg. */ +#define UART_MDC 0x04 /* Modem control reg. */ +#define UART_LST 0x05 /* Line status reg. */ +#define UART_MSR 0x06 /* Modem status reg. */ + +/* equates for interrupt enable register */ + +#define I8250_IER_RXRDY 0x01 /* receiver data ready */ +#define I8250_IER_TBE 0x02 /* transmit bit enable */ +#define I8250_IER_LST 0x04 /* line status interrupts */ +#define I8250_IER_MSI 0x08 /* modem status interrupts */ + +/* equates for interrupt identification register */ + +#define I8250_IIR_IP 0x01 /* interrupt pending bit */ +#define I8250_IIR_MASK 0x07 /* interrupt id bits mask */ +#define I8250_IIR_MSTAT 0x00 /* modem status interrupt */ +#define I8250_IIR_THRE 0X02 /* transmit holding register empty */ +#define I8250_IIR_RBRF 0x04 /* receiver buffer register full */ +#define I8250_IIR_SEOB 0x06 /* serialization error or break */ + +/* equates for line control register */ + +#define I8250_LCR_CS5 0x00 /* 5 bits data size */ +#define I8250_LCR_CS6 0x01 /* 6 bits data size */ +#define I8250_LCR_CS7 0x02 /* 7 bits data size */ +#define I8250_LCR_CS8 0x03 /* 8 bits data size */ +#define I8250_LCR_2_STB 0x04 /* 2 stop bits */ +#define I8250_LCR_1_STB 0x00 /* 1 stop bit */ +#define I8250_LCR_PEN 0x08 /* parity enable */ +#define I8250_LCR_PDIS 0x00 /* parity disable */ +#define I8250_LCR_EPS 0x10 /* even parity slect */ +#define I8250_LCR_SP 0x20 /* stick parity select */ +#define I8250_LCR_SBRK 0x40 /* break control bit */ +#define I8250_LCR_DLAB 0x80 /* divisor latch access enable */ + +/* equates for the modem control register */ + +#define I8250_MCR_DTR 0x01 /* dtr output */ +#define I8250_MCR_RTS 0x02 /* rts output */ +#define I8250_MCR_OUT1 0x04 /* output #1 */ +#define I8250_MCR_OUT2 0x08 /* output #2 */ +#define I8250_MCR_LOOP 0x10 /* loop back */ + +/* equates for line status register */ + +#define I8250_LSR_RXRDY 0x01 /* receiver data available */ +#define I8250_LSR_OE 0x02 /* overrun error */ +#define I8250_LSR_PE 0x04 /* parity error */ +#define I8250_LSR_FE 0x08 /* framing error */ +#define I8250_LSR_BI 0x10 /* break interrupt */ +#define I8250_LSR_THRE 0x20 /* transmit holding register empty */ +#define I8250_LSR_TEMT 0x40 /* transmitter empty */ + +/* equates for modem status register */ + +#define I8250_MSR_DCTS 0x01 /* cts change */ +#define I8250_MSR_DDSR 0x02 /* dsr change */ +#define I8250_MSR_DRI 0x04 /* ring change */ +#define I8250_MSR_DDCD 0x08 /* data carrier change */ +#define I8250_MSR_CTS 0x10 /* complement of cts */ +#define I8250_MSR_DSR 0x20 /* complement of dsr */ +#define I8250_MSR_RI 0x40 /* complement of ring signal */ +#define I8250_MSR_DCD 0x80 /* complement of dcd */ + + +#if defined(__STDC__) || defined(__cplusplus) + +extern void i8250HrdInit(I8250_CHAN *pDev); +extern void i8250Int (I8250_CHAN *pDev); + +#else + +extern void i8250HrdInit(); +extern void i8250Int(); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCi8250h */ diff --git a/h/drv/sio/ixp400Sio.h b/h/drv/sio/ixp400Sio.h new file mode 100644 index 0000000..8a1801d --- /dev/null +++ b/h/drv/sio/ixp400Sio.h @@ -0,0 +1,191 @@ +/* ixp400Sio.h - Intel IXP400 UART header file */ + +/* +Copyright (c) 2002-2004 Wind River Systems, Inc. All rights reserved. +Certain portions of these files may be copyright (c) 2002-2004 Intel +Corporation. +*/ + +/* +modification history +-------------------- +01e,25aug05,m_h SIO for ixdp4xx XSCALE processors +01d,20jul05,m_h serial driver for ixdp465 and related XSCALE BSPs +01c,20dec04,pai Updated copyright notice. +01b,30jan03,jb3 Fix SPR 85040 Serialdata corruption. +01a,05jun02,jb initial version... +*/ + +#ifndef __INCixp400Sioh +#define __INCixp400Sioh + +#ifdef __cplusplus +extern "C" { +#endif + + +/****************************************************************************** + * + * Register descriptions + * + ******************************************************************************/ + +#ifndef _ASMLANGUAGE + +/* Register offsets from base address */ + +#define RBR (0x00) /* receiver buffer register (read only) */ +#define THR (0x00) /* transmit holding register (write only) */ +#define IER (0x01) /* interrupt enable register (r/w) */ +#define IIR (0x02) /* interrupt identification register (read only) */ +#define FCR (0x02) /* FIFO control register (write only) */ +#define LCR (0x03) /* line control register (r/w) */ +#define MCR (0x04) /* modem control register (r/w) */ +#define LSR (0x05) /* line status register (read only) */ +#define MSR (0x06) /* modem status register (read only) */ +#define SCR (0x07) /* scratch pad register (r/w) */ +#define DLL (0x00) /* divisor latch lower byte (r/w) */ +#define DLM (0x01) /* divisor latch upper bytes (r/w) */ + + +/* Line Control Register */ + +#define CHAR_LEN_5 0x00 /* 5bit data length (default) */ +#define CHAR_LEN_6 0x01 /* 6bit data length */ +#define CHAR_LEN_7 0x02 /* 7bit data length */ +#define CHAR_LEN_8 0x03 /* 8bit data length */ +#define LCR_STB_1 0x00 /* 1 stop bit */ +#define LCR_STB_2 0x04 /* 2 stop bits */ +#define LCR_PEN 0x08 /* parity enable */ +#define LCR_PDIS 0x00 /* parity disable */ +#define LCR_EPS 0x10 /* even parity select */ +#define LCR_STCKP 0x20 /* sticky parity select */ +#define LCR_SBRK 0x40 /* set break control */ +#define LCR_DLAB 0x80 /* divisor latch access enable */ + + +/* Line Status Register */ + +#define LSR_DR 0x01 /* data ready */ +#define LSR_OE 0x02 /* overrun error */ +#define LSR_PE 0x04 /* parity error */ +#define LSR_FE 0x08 /* framing error */ +#define LSR_BI 0x10 /* break interrupt */ +#define LSR_TDRQ 0x20 /* transmit data request */ +#define LSR_TEMT 0x40 /* transmitter empty */ +#define LSR_FIFOE 0x80 /* in FIFO mode, set when PE, FE or BI error */ + + +/* Interrupt Enable Register */ + +#define IER_RAVIE 0x01 /* received data available int enable */ +#define IER_TIE 0x02 /* transmitter data request int enable */ +#define IER_RLSE 0x04 /* receiver line status int enable */ +#define IER_MIE 0x08 /* modem status int enable */ +#define IER_RTOIE 0x10 /* receiver timeout int enable */ +#define IER_NRZIE 0x20 /* NZR coding enable */ +#define IER_UUE 0x40 /* UART Unit enable */ +#define IER_DMAE 0x80 /* DMA Requests enable */ + + +/* Interrupt Identification Register */ + +#define IIR_IP 0x00 /* interrupt pending */ +#define IIR_RLS 0x06 /* received line status int */ +#define IIR_RDA 0x04 /* received data available int */ +#define IIR_TIMEOUT 0x0C /* receive data timeout (FIFO mode only) */ +#define IIR_THRE 0x02 /* transmit data request int */ +#define IIR_MSTAT 0x00 /* modem status int */ +#define IIR_FIFOES 0xC0 /* FIFO mode enable status */ + + +/* Modem Control Register */ + +#define MCR_RTS 0x02 /* request to send output */ +#define MCR_OUT1 0x04 /* output #1 */ +#define MCR_OUT2 0x08 /* output #2 */ +#define MCR_LOOP 0x10 /* loopback mode enable */ + +/* Modem Status Register */ + +#define MSR_DCTS 0x01 /* clear to send change */ +#define MSR_CTS 0x10 /* complement of cts input */ + +/* FIFO Control Register */ + +#define FCR_TRFIFOE 0x01 /* enable xmit and rcvr FIFOs */ +#define FCR_RESETRF 0x02 /* reset receiver FIFO */ +#define FCR_RESETTF 0x04 /* reset trasmitter FIFO */ +#define FCR_ITL_1 0x00 /* 1byte receiver trigger level */ +#define FCR_ITL_8 0x40 /* 8byte receiver trigger level */ +#define FCR_ITL_16 0x80 /* 16byte receiver trigger level */ +#define FCR_ITL_32 0xC0 /* 32byte receiver trigger level */ + +/* + * Max iterations for servicing chars during ISR. This value should not be greater + * than 32 i.e. half the UART FIFO size. + * #define IXP400_SIO_MAX_CNT 30 + */ +#define IXP400_SIO_MAX_CNT 32 +#define IXP400_SIO_MAX_RX_CNT 63 +#define IXP400_SIO_MAX_TX_CNT 31 + + +typedef struct /* IXP400_SIO_CHAN */ + { + /* always goes first */ + + SIO_DRV_FUNCS * pDrvFuncs; /* driver functions */ + + /* callbacks */ + void * getTxArg; + void * putRcvArg; + STATUS (*getTxChar) (); /* pointer to xmitr function */ + STATUS (*putRcvChar) (); /* pointer to rcvr function */ + + UINT8 *regs; /* IXP400 UART registers */ + UINT8 level; /* 8259a interrupt level for this device */ + UINT8 ier; /* copy of ier */ + UINT8 lcr; /* copy of lcr */ + UINT8 mcr; /* copy of mcr */ + + UINT16 channelMode; /* such as INT, POLL modes */ + UINT16 regDelta; /* register address spacing */ + int baudRate; + UINT32 xtal; /* UART clock frequency */ + UINT32 options; /* hardware setup options */ + +#ifdef IXP400_SIO_DEBUG + UINT32 rxCount; /* UART statistics counters */ + UINT32 txCount; + UINT32 overrunErr; + UINT32 parityErr; + UINT32 framingErr; + UINT32 breakErr; +#endif + + } IXP400_SIO_CHAN; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void ixp400SioInt (IXP400_SIO_CHAN *); +extern void ixp400SioDevInit (IXP400_SIO_CHAN *); +extern void ixp400SioStatsShow (IXP400_SIO_CHAN *); + +#else + +extern void ixp400SioInt (); +extern void ixp400SioInit (); +extern void ixp400SioStatsShow (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCixp400Sioh */ diff --git a/h/drv/sio/ixp425Sio.h b/h/drv/sio/ixp425Sio.h new file mode 100644 index 0000000..233c8b1 --- /dev/null +++ b/h/drv/sio/ixp425Sio.h @@ -0,0 +1,184 @@ +/* ixp425Sio.h - Intel IXP425 UART header file */ + +/* Copyright 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,30jan03,jb3 Fix SPR 85040 Serialdata corruption. +01a,05jun02,jb initial version... +*/ + +#ifndef __INCixp425Sioh +#define __INCixp425Sioh + +#ifdef __cplusplus +extern "C" { +#endif + + +/****************************************************************************** + * + * Register descriptions + * + ******************************************************************************/ + +#ifndef _ASMLANGUAGE + +/* Register offsets from base address */ + +#define RBR (0x00) /* receiver buffer register (read only) */ +#define THR (0x00) /* transmit holding register (write only) */ +#define IER (0x01) /* interrupt enable register (r/w) */ +#define IIR (0x02) /* interrupt identification register (read only) */ +#define FCR (0x02) /* FIFO control register (write only) */ +#define LCR (0x03) /* line control register (r/w) */ +#define MCR (0x04) /* modem control register (r/w) */ +#define LSR (0x05) /* line status register (read only) */ +#define MSR (0x06) /* modem status register (read only) */ +#define SCR (0x07) /* scratch pad register (r/w) */ +#define DLL (0x00) /* divisor latch lower byte (r/w) */ +#define DLM (0x01) /* divisor latch upper bytes (r/w) */ + + +/* Line Control Register */ + +#define CHAR_LEN_5 0x00 /* 5bit data length (default) */ +#define CHAR_LEN_6 0x01 /* 6bit data length */ +#define CHAR_LEN_7 0x02 /* 7bit data length */ +#define CHAR_LEN_8 0x03 /* 8bit data length */ +#define LCR_STB_1 0x00 /* 1 stop bit */ +#define LCR_STB_2 0x04 /* 2 stop bits */ +#define LCR_PEN 0x08 /* parity enable */ +#define LCR_PDIS 0x00 /* parity disable */ +#define LCR_EPS 0x10 /* even parity select */ +#define LCR_STCKP 0x20 /* sticky parity select */ +#define LCR_SBRK 0x40 /* set break control */ +#define LCR_DLAB 0x80 /* divisor latch access enable */ + + +/* Line Status Register */ + +#define LSR_DR 0x01 /* data ready */ +#define LSR_OE 0x02 /* overrun error */ +#define LSR_PE 0x04 /* parity error */ +#define LSR_FE 0x08 /* framing error */ +#define LSR_BI 0x10 /* break interrupt */ +#define LSR_TDRQ 0x20 /* transmit data request */ +#define LSR_TEMT 0x40 /* transmitter empty */ +#define LSR_FIFOE 0x80 /* in FIFO mode, set when PE, FE or BI error */ + + +/* Interrupt Enable Register */ + +#define IER_RAVIE 0x01 /* received data available int enable */ +#define IER_TIE 0x02 /* transmitter data request int enable */ +#define IER_RLSE 0x04 /* receiver line status int enable */ +#define IER_MIE 0x08 /* modem status int enable */ +#define IER_RTOIE 0x10 /* receiver timeout int enable */ +#define IER_NRZIE 0x20 /* NZR coding enable */ +#define IER_UUE 0x40 /* UART Unit enable */ +#define IER_DMAE 0x80 /* DMA Requests enable */ + + +/* Interrupt Identification Register */ + +#define IIR_IP 0x00 /* interrupt pending */ +#define IIR_RLS 0x06 /* received line status int */ +#define IIR_RDA 0x04 /* received data available int */ +#define IIR_TIMEOUT 0x0C /* receive data timeout (FIFO mode only) */ +#define IIR_THRE 0x02 /* transmit data request int */ +#define IIR_MSTAT 0x00 /* modem status int */ +#define IIR_FIFOES 0xC0 /* FIFO mode enable status */ + + +/* Modem Control Register */ + +#define MCR_RTS 0x02 /* request to send output */ +#define MCR_OUT1 0x04 /* output #1 */ +#define MCR_OUT2 0x08 /* output #2 */ +#define MCR_LOOP 0x10 /* loopback mode enable */ + +/* Modem Status Register */ + +#define MSR_DCTS 0x01 /* clear to send change */ +#define MSR_CTS 0x10 /* complement of cts input */ + +/* FIFO Control Register */ + +#define FCR_TRFIFOE 0x01 /* enable xmit and rcvr FIFOs */ +#define FCR_RESETRF 0x02 /* reset receiver FIFO */ +#define FCR_RESETTF 0x04 /* reset trasmitter FIFO */ +#define FCR_ITL_1 0x00 /* 1byte receiver trigger level */ +#define FCR_ITL_8 0x40 /* 8byte receiver trigger level */ +#define FCR_ITL_16 0x80 /* 16byte receiver trigger level */ +#define FCR_ITL_32 0xC0 /* 32byte receiver trigger level */ + +/* + * Max iterations for servicing chars during ISR. This value should not be greater + * than 32 i.e. half the UART FIFO size. + * #define IXP425_SIO_MAX_CNT 30 + */ +#define IXP425_SIO_MAX_CNT 32 +#define IXP425_SIO_MAX_RX_CNT 63 +#define IXP425_SIO_MAX_TX_CNT 31 + + +typedef struct /* IXP425_SIO_CHAN */ + { + /* always goes first */ + + SIO_DRV_FUNCS * pDrvFuncs; /* driver functions */ + + /* callbacks */ + void * getTxArg; + void * putRcvArg; + STATUS (*getTxChar) (); /* pointer to xmitr function */ + STATUS (*putRcvChar) (); /* pointer to rcvr function */ + + UINT8 *regs; /* IXP425 UART registers */ + UINT8 level; /* 8259a interrupt level for this device */ + UINT8 ier; /* copy of ier */ + UINT8 lcr; /* copy of lcr */ + UINT8 mcr; /* copy of mcr */ + + UINT16 channelMode; /* such as INT, POLL modes */ + UINT16 regDelta; /* register address spacing */ + int baudRate; + UINT32 xtal; /* UART clock frequency */ + UINT32 options; /* hardware setup options */ + +#ifdef IXP425_SIO_DEBUG + UINT32 rxCount; /* UART statistics counters */ + UINT32 txCount; + UINT32 overrunErr; + UINT32 parityErr; + UINT32 framingErr; + UINT32 breakErr; +#endif + + } IXP425_SIO_CHAN; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void ixp425SioInt (IXP425_SIO_CHAN *); +extern void ixp425SioDevInit (IXP425_SIO_CHAN *); +extern void ixp425SioStatsShow (IXP425_SIO_CHAN *); + +#else + +extern void ixp425SioInt (); +extern void ixp425SioInit (); +extern void ixp425SioStatsShow (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCixp425Sioh */ diff --git a/h/drv/sio/m5200PscSio.h b/h/drv/sio/m5200PscSio.h new file mode 100644 index 0000000..d893b33 --- /dev/null +++ b/h/drv/sio/m5200PscSio.h @@ -0,0 +1,90 @@ +/* m5200PscSio.h - Motorola MPC5200 internal UART header file */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25Jun03,pkr created +*/ + +/* +This file contains constants for the UART contained in the Motorola MCF5200. +The constant SIO must defined when +including this header file. +*/ + +#ifndef __INCm5200PscSioh +#define __INCm5200PscSioh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "sioLib.h" + +typedef struct + { + SIO_DRV_FUNCS * pDrvFuncs; /* Driver functions */ + /* CallBacks */ + STATUS (*getTxChar)(); + STATUS (*putRcvChar)(); + void * getTxArg; + void * putRcvArg; + + UINT clkRate; /* system clock rate */ + UINT16 mode; /* SIO_MODE */ + VOIDFUNCPTR *intVec; + int options; + int intEnable; + UINT baudRate; + UCHAR acrCopy; + USHORT imrCopy; + int portNum; + + volatile UCHAR *mr; /* UART mode register */ + volatile USHORT *sr; /* UART status register */ + volatile USHORT *csr; /* UART clock select register */ + volatile UCHAR *cr; /* UART command register */ + volatile ULONG *rb; /* UART receive buffer register */ + volatile UCHAR *tb; /* UART transmit buffer register */ + volatile UCHAR *ipcr; /* UART input port change register */ + volatile UCHAR *acr; /* UART auxiliary control register */ + volatile USHORT *isr; /* UART interrupt status register */ + volatile USHORT *imr; /* UART interrupt mask register */ +#if 0 + volatile UCHAR *ivr; /* UART interrupt vector register */ +#endif + volatile UCHAR *op1; /* UART output port set cmd */ + volatile UCHAR *sicr; /* UART ??? */ + volatile UCHAR *dp; /* UART divisor high */ + volatile UCHAR *dl; /* UART divisor low */ + volatile USHORT *rfalarm; /* UART ??? */ + volatile USHORT *tfalarm; /* UART ??? */ + } M5200_PSC_CHAN; + +#endif /* _ASMLANGUAGE */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT void m5200PscSioDevInit (M5200_PSC_CHAN *pChan); +IMPORT void m5200PscSioDevInit2 (M5200_PSC_CHAN *pChan); +IMPORT void m5200PscSioInt (M5200_PSC_CHAN *pChan); + +#else /* __STDC__ */ + +IMPORT void m5200PscSioDevInit (); +IMPORT void m5200PscSioDevInit2 (); +IMPORT void m5200PscSioInt (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm5200PscSioh */ diff --git a/h/drv/sio/m5204Sio.h b/h/drv/sio/m5204Sio.h new file mode 100644 index 0000000..419bb52 --- /dev/null +++ b/h/drv/sio/m5204Sio.h @@ -0,0 +1,201 @@ +/* m5204Sio.h - Motorola MCF5204 internal UART header file */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,09dec96,mem created. +*/ + +/* +This file contains constants for the UART contained in the Motorola MCF5204. +The constant SIO must defined when +including this header file. +*/ + +#ifndef __INCm5204Sioh +#define __INCm5204Sioh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "sioLib.h" + +typedef struct + { + SIO_DRV_FUNCS * pDrvFuncs; /* Driver functions */ + /* CallBacks */ + STATUS (*getTxChar)(); + STATUS (*putRcvChar)(); + void * getTxArg; + void * putRcvArg; + + UINT clkRate; /* system clock rate */ + UINT16 mode; /* SIO_MODE */ + unsigned char intVec; + int options; + int intEnable; + UINT baudRate; + UCHAR oprCopy; + UCHAR acrCopy; + UCHAR imrCopy; + + volatile UCHAR *mr; /* UART mode register */ + volatile UCHAR *sr; /* UART status register */ + volatile UCHAR *csr; /* UART clock select register */ + volatile UCHAR *cr; /* UART command register */ + volatile UCHAR *rb; /* UART receive buffer register */ + volatile UCHAR *tb; /* UART transmit buffer register */ + volatile UCHAR *ipcr; /* UART input port change register */ + volatile UCHAR *acr; /* UART auxiliary control register */ + volatile UCHAR *isr; /* UART interrupt status register */ + volatile UCHAR *imr; /* UART interrupt mask register */ + volatile UCHAR *bg1; /* UART baud generator prescale register 1 */ + volatile UCHAR *bg2; /* UART baud generator prescale register 2 */ + volatile UCHAR *ivr; /* UART interrupt vector register */ + volatile UCHAR *ip; /* UART input port register */ + volatile UCHAR *op1; /* UART output port set cmd */ + volatile UCHAR *op2; /* UART output port reset cmd */ + } M5204_CHAN; + +#endif /* _ASMLANGUAGE */ + +/* register bit definitions */ + +/* MR1 - mode register 1 */ +#define M5204_UART_MR1_BC0 (1 << 0) /* bits per char 0 */ +#define M5204_UART_MR1_BC1 (1 << 1) /* bits per char 1 */ +#define M5204_UART_MR1_PT (1 << 2) /* parity type */ +#define M5204_UART_MR1_PM0 (1 << 3) /* parity mode 0 */ +#define M5204_UART_MR1_PM1 (1 << 4) /* parity mode 1 */ +#define M5204_UART_MR1_ERR (1 << 5) /* error mode */ +#define M5204_UART_MR1_RX_IRQ (1 << 6) /* receiver interrupt select */ +#define M5204_UART_MR1_RX_RTS (1 << 7) /* Rx RTS control */ + +/* Some common modes */ +#define M5204_UART_MR1_BITS_CHAR_5 0 +#define M5204_UART_MR1_BITS_CHAR_6 M5204_UART_MR1_BC0 +#define M5204_UART_MR1_BITS_CHAR_7 M5204_UART_MR1_BC1 +#define M5204_UART_MR1_BITS_CHAR_8 (M5204_UART_MR1_BC0 \ + | M5204_UART_MR1_BC1) +#define M5204_UART_MR1_NO_PARITY (M5204_UART_MR1_PM1) +#define M5204_UART_MR1_PAR_MODE_MULTI (M5204_UART_MR1_PM0 \ + | M5204_UART_MR1_PM1) +#define M5204_UART_MR1_EVEN_PARITY 0 +#define M5204_UART_MR1_ODD_PARITY M5204_UART_MR1_PT + +/* MR2 - mode register 2 */ +#define M5204_UART_MR2_SB0 (1 << 0) /* stop bit control 0 */ +#define M5204_UART_MR2_SB1 (1 << 1) /* stop bit control 1 */ +#define M5204_UART_MR2_SB2 (1 << 2) /* stop bit control 2 */ +#define M5204_UART_MR2_SB3 (1 << 3) /* stop bit control 3 */ +#define M5204_UART_MR2_TX_CTS (1 << 4) /* Tx CTS control */ +#define M5204_UART_MR2_TX_RTS (1 << 5) /* Tx RTS control */ +#define M5204_UART_MR2_CM0 (1 << 6) /* channel mode 0 */ +#define M5204_UART_MR2_CM1 (1 << 7) /* channel mode 1 */ + +/* Some common bit lengths */ +#define M5204_UART_MR2_STOP_BITS_1 (M5204_UART_MR2_SB0 \ + | M5204_UART_MR2_SB1 \ + | M5204_UART_MR2_SB2) +#define M5204_UART_MR2_STOP_BITS_2 (M5204_UART_MR2_SB0 \ + | M5204_UART_MR2_SB1 \ + | M5204_UART_MR2_SB2 \ + | M5204_UART_MR2_SB3) + +/* SR - status register */ +#define M5204_UART_SR_RXRDY (1 << 0) /* Rx ready */ +#define M5204_UART_SR_FFULL (1 << 1) /* FIFO full */ +#define M5204_UART_SR_TXRDY (1 << 2) /* Tx ready */ +#define M5204_UART_SR_TXEMP (1 << 3) /* Tx empty */ +#define M5204_UART_SR_OE (1 << 4) /* overrun error */ +#define M5204_UART_SR_PE (1 << 5) /* parity error */ +#define M5204_UART_SR_FE (1 << 6) /* framing error */ +#define M5204_UART_SR_RB (1 << 7) /* received break */ + +/* CSR - clock select register */ +#define M5204_UART_CSR_TCS0 (1 << 0) /* Tx clock select 0 */ +#define M5204_UART_CSR_TCS1 (1 << 1) /* Tx clock select 1 */ +#define M5204_UART_CSR_TCS2 (1 << 2) /* Tx clock select 2 */ +#define M5204_UART_CSR_TCS3 (1 << 3) /* Tx clock select 3 */ +#define M5204_UART_CSR_RCS0 (1 << 4) /* Rx clock select 0 */ +#define M5204_UART_CSR_RCS1 (1 << 5) /* Rx clock select 1 */ +#define M5204_UART_CSR_RCS2 (1 << 6) /* Rx clock select 2 */ +#define M5204_UART_CSR_RCS3 (1 << 7) /* Rx clock select 3 */ + +#define M5204_UART_CSR_TIMER_TX (M5204_UART_CSR_TCS0 \ + | M5204_UART_CSR_TCS2 \ + | M5204_UART_CSR_TCS3) +#define M5204_UART_CSR_TIMER_RX (M5204_UART_CSR_RCS0 \ + | M5204_UART_CSR_RCS2 \ + | M5204_UART_CSR_RCS3) + +/* CR - command register */ +#define M5204_UART_CR_RC0 (1 << 0) /* receiver control bit 0 */ +#define M5204_UART_CR_RC1 (1 << 1) /* receiver control bit 1 */ +#define M5204_UART_CR_TC0 (1 << 2) /* transmitter control bit 0 */ +#define M5204_UART_CR_TC1 (1 << 3) /* transmitter control bit 1 */ +#define M5204_UART_CR_MISC0 (1 << 4) /* misc control bit 0 */ +#define M5204_UART_CR_MISC1 (1 << 5) /* misc control bit 1 */ +#define M5204_UART_CR_MISC2 (1 << 6) /* misc control bit 2 */ + +/* Some common commands */ +#define M5204_UART_CR_TX_ENABLE (M5204_UART_CR_TC0) +#define M5204_UART_CR_TX_DISABLE (M5204_UART_CR_TC1) +#define M5204_UART_CR_RX_ENABLE (M5204_UART_CR_RC0) +#define M5204_UART_CR_RX_DISABLE (M5204_UART_CR_RC1) +#define M5204_UART_CR_RESET_MODE_PTR (M5204_UART_CR_MISC0) +#define M5204_UART_CR_RESET_RX (M5204_UART_CR_MISC1) +#define M5204_UART_CR_RESET_TX (M5204_UART_CR_MISC0 \ + | M5204_UART_CR_MISC1) +#define M5204_UART_CR_RESET_ERR (M5204_UART_CR_MISC2) + +/* ACR - auxiliary control register */ +#define M5204_UART_ACR_IEC (1 << 0) /* input enable control */ + +/* IMR - interrupt mask register */ +#define M5204_UART_IMR_TXRDY (1 << 0) /* transmitter ready */ +#define M5204_UART_IMR_RXRDY (1 << 1) /* receiver ready */ +#define M5204_UART_IMR_DB (1 << 2) /* delta break */ +#define M5204_UART_IMR_COS (1 << 7) /* change of CTS state */ + +/* ISR - interrupt status register */ +#define M5204_UART_ISR_TXRDY (1 << 0) /* transmitter ready */ +#define M5204_UART_ISR_RXRDY (1 << 1) /* receiver ready */ +#define M5204_UART_ISR_DB (1 << 2) /* delta break */ +#define M5204_UART_ISR_COS (1 << 7) /* change of CTS state */ + +/* IP - input port register */ +#define M5204_UART_IP_CTS (1 << 0) /* current CTS state */ + +/* OP1 - output set register */ +#define M5204_UART_OP1_RTS (1 << 0) /* set RTS */ + +/* OP2 - output reset register */ +#define M5204_UART_OP2_RTS (1 << 0) /* clear RTS */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT void m5204DevInit (M5204_CHAN *pChan); +IMPORT void m5204DevInit2 (M5204_CHAN *pChan); +IMPORT void m5204Int (M5204_CHAN *pChan); + +#else /* __STDC__ */ + +IMPORT void m5204DevInit (); +IMPORT void m5204DevInit2 (); +IMPORT void m5204Int (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm5204Sioh */ diff --git a/h/drv/sio/m5206Sio.h b/h/drv/sio/m5206Sio.h new file mode 100644 index 0000000..a2bb9a4 --- /dev/null +++ b/h/drv/sio/m5206Sio.h @@ -0,0 +1,201 @@ +/* m5206Sio.h - Motorola MCF5206 internal UART header file */ + +/* Copyright 1984-1997 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,21jan96,kab written +*/ + +/* +This file contains constants for the UART contained in the Motorola MCF5206. +The constant SIO must defined when +including this header file. +*/ + +#ifndef __INCm5206Sioh +#define __INCm5206Sioh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "sioLib.h" + +typedef struct + { + SIO_DRV_FUNCS * pDrvFuncs; /* Driver functions */ + /* CallBacks */ + STATUS (*getTxChar)(); + STATUS (*putRcvChar)(); + void * getTxArg; + void * putRcvArg; + + UINT clkRate; /* system clock rate */ + UINT16 mode; /* SIO_MODE */ + unsigned char intVec; + int options; + int intEnable; + UINT baudRate; + UCHAR oprCopy; + UCHAR acrCopy; + UCHAR imrCopy; + + volatile UCHAR *mr; /* UART mode register */ + volatile UCHAR *sr; /* UART status register */ + volatile UCHAR *csr; /* UART clock select register */ + volatile UCHAR *cr; /* UART command register */ + volatile UCHAR *rb; /* UART receive buffer register */ + volatile UCHAR *tb; /* UART transmit buffer register */ + volatile UCHAR *ipcr; /* UART input port change register */ + volatile UCHAR *acr; /* UART auxiliary control register */ + volatile UCHAR *isr; /* UART interrupt status register */ + volatile UCHAR *imr; /* UART interrupt mask register */ + volatile UCHAR *bg1; /* UART baud generator prescale register 1 */ + volatile UCHAR *bg2; /* UART baud generator prescale register 2 */ + volatile UCHAR *ivr; /* UART interrupt vector register */ + volatile UCHAR *ip; /* UART input port register */ + volatile UCHAR *op1; /* UART output port set cmd */ + volatile UCHAR *op2; /* UART output port reset cmd */ + } M5206_CHAN; + +#endif /* _ASMLANGUAGE */ + +/* register bit definitions */ + +/* MR1 - mode register 1 */ +#define M5206_UART_MR1_BC0 (1 << 0) /* bits per char 0 */ +#define M5206_UART_MR1_BC1 (1 << 1) /* bits per char 1 */ +#define M5206_UART_MR1_PT (1 << 2) /* parity type */ +#define M5206_UART_MR1_PM0 (1 << 3) /* parity mode 0 */ +#define M5206_UART_MR1_PM1 (1 << 4) /* parity mode 1 */ +#define M5206_UART_MR1_ERR (1 << 5) /* error mode */ +#define M5206_UART_MR1_RX_IRQ (1 << 6) /* receiver interrupt select */ +#define M5206_UART_MR1_RX_RTS (1 << 7) /* Rx RTS control */ + +/* Some common modes */ +#define M5206_UART_MR1_BITS_CHAR_5 0 +#define M5206_UART_MR1_BITS_CHAR_6 M5206_UART_MR1_BC0 +#define M5206_UART_MR1_BITS_CHAR_7 M5206_UART_MR1_BC1 +#define M5206_UART_MR1_BITS_CHAR_8 (M5206_UART_MR1_BC0 \ + | M5206_UART_MR1_BC1) +#define M5206_UART_MR1_NO_PARITY (M5206_UART_MR1_PM1) +#define M5206_UART_MR1_PAR_MODE_MULTI (M5206_UART_MR1_PM0 \ + | M5206_UART_MR1_PM1) +#define M5206_UART_MR1_EVEN_PARITY 0 +#define M5206_UART_MR1_ODD_PARITY M5206_UART_MR1_PT + +/* MR2 - mode register 2 */ +#define M5206_UART_MR2_SB0 (1 << 0) /* stop bit control 0 */ +#define M5206_UART_MR2_SB1 (1 << 1) /* stop bit control 1 */ +#define M5206_UART_MR2_SB2 (1 << 2) /* stop bit control 2 */ +#define M5206_UART_MR2_SB3 (1 << 3) /* stop bit control 3 */ +#define M5206_UART_MR2_TX_CTS (1 << 4) /* Tx CTS control */ +#define M5206_UART_MR2_TX_RTS (1 << 5) /* Tx RTS control */ +#define M5206_UART_MR2_CM0 (1 << 6) /* channel mode 0 */ +#define M5206_UART_MR2_CM1 (1 << 7) /* channel mode 1 */ + +/* Some common bit lengths */ +#define M5206_UART_MR2_STOP_BITS_1 (M5206_UART_MR2_SB0 \ + | M5206_UART_MR2_SB1 \ + | M5206_UART_MR2_SB2) +#define M5206_UART_MR2_STOP_BITS_2 (M5206_UART_MR2_SB0 \ + | M5206_UART_MR2_SB1 \ + | M5206_UART_MR2_SB2 \ + | M5206_UART_MR2_SB3) + +/* SR - status register */ +#define M5206_UART_SR_RXRDY (1 << 0) /* Rx ready */ +#define M5206_UART_SR_FFULL (1 << 1) /* FIFO full */ +#define M5206_UART_SR_TXRDY (1 << 2) /* Tx ready */ +#define M5206_UART_SR_TXEMP (1 << 3) /* Tx empty */ +#define M5206_UART_SR_OE (1 << 4) /* overrun error */ +#define M5206_UART_SR_PE (1 << 5) /* parity error */ +#define M5206_UART_SR_FE (1 << 6) /* framing error */ +#define M5206_UART_SR_RB (1 << 7) /* received break */ + +/* CSR - clock select register */ +#define M5206_UART_CSR_TCS0 (1 << 0) /* Tx clock select 0 */ +#define M5206_UART_CSR_TCS1 (1 << 1) /* Tx clock select 1 */ +#define M5206_UART_CSR_TCS2 (1 << 2) /* Tx clock select 2 */ +#define M5206_UART_CSR_TCS3 (1 << 3) /* Tx clock select 3 */ +#define M5206_UART_CSR_RCS0 (1 << 4) /* Rx clock select 0 */ +#define M5206_UART_CSR_RCS1 (1 << 5) /* Rx clock select 1 */ +#define M5206_UART_CSR_RCS2 (1 << 6) /* Rx clock select 2 */ +#define M5206_UART_CSR_RCS3 (1 << 7) /* Rx clock select 3 */ + +#define M5206_UART_CSR_TIMER_TX (M5206_UART_CSR_TCS0 \ + | M5206_UART_CSR_TCS2 \ + | M5206_UART_CSR_TCS3) +#define M5206_UART_CSR_TIMER_RX (M5206_UART_CSR_RCS0 \ + | M5206_UART_CSR_RCS2 \ + | M5206_UART_CSR_RCS3) + +/* CR - command register */ +#define M5206_UART_CR_RC0 (1 << 0) /* receiver control bit 0 */ +#define M5206_UART_CR_RC1 (1 << 1) /* receiver control bit 1 */ +#define M5206_UART_CR_TC0 (1 << 2) /* transmitter control bit 0 */ +#define M5206_UART_CR_TC1 (1 << 3) /* transmitter control bit 1 */ +#define M5206_UART_CR_MISC0 (1 << 4) /* misc control bit 0 */ +#define M5206_UART_CR_MISC1 (1 << 5) /* misc control bit 1 */ +#define M5206_UART_CR_MISC2 (1 << 6) /* misc control bit 2 */ + +/* Some common commands */ +#define M5206_UART_CR_TX_ENABLE (M5206_UART_CR_TC0) +#define M5206_UART_CR_TX_DISABLE (M5206_UART_CR_TC1) +#define M5206_UART_CR_RX_ENABLE (M5206_UART_CR_RC0) +#define M5206_UART_CR_RX_DISABLE (M5206_UART_CR_RC1) +#define M5206_UART_CR_RESET_MODE_PTR (M5206_UART_CR_MISC0) +#define M5206_UART_CR_RESET_RX (M5206_UART_CR_MISC1) +#define M5206_UART_CR_RESET_TX (M5206_UART_CR_MISC0 \ + | M5206_UART_CR_MISC1) +#define M5206_UART_CR_RESET_ERR (M5206_UART_CR_MISC2) + +/* ACR - auxiliary control register */ +#define M5206_UART_ACR_IEC (1 << 0) /* input enable control */ + +/* IMR - interrupt mask register */ +#define M5206_UART_IMR_TXRDY (1 << 0) /* transmitter ready */ +#define M5206_UART_IMR_RXRDY (1 << 1) /* receiver ready */ +#define M5206_UART_IMR_DB (1 << 2) /* delta break */ +#define M5206_UART_IMR_COS (1 << 7) /* change of CTS state */ + +/* ISR - interrupt status register */ +#define M5206_UART_ISR_TXRDY (1 << 0) /* transmitter ready */ +#define M5206_UART_ISR_RXRDY (1 << 1) /* receiver ready */ +#define M5206_UART_ISR_DB (1 << 2) /* delta break */ +#define M5206_UART_ISR_COS (1 << 7) /* change of CTS state */ + +/* IP - input port register */ +#define M5206_UART_IP_CTS (1 << 0) /* current CTS state */ + +/* OP1 - output set register */ +#define M5206_UART_OP1_RTS (1 << 0) /* set RTS */ + +/* OP2 - output reset register */ +#define M5206_UART_OP2_RTS (1 << 0) /* clear RTS */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT void m5206DevInit (M5206_CHAN *pChan); +IMPORT void m5206DevInit2 (M5206_CHAN *pChan); +IMPORT void m5206Int (M5206_CHAN *pChan); + +#else /* __STDC__ */ + +IMPORT void m5206DevInit (); +IMPORT void m5206DevInit2 (); +IMPORT void m5206Int (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm5206Sioh */ diff --git a/h/drv/sio/m68302Sio.h b/h/drv/sio/m68302Sio.h new file mode 100644 index 0000000..13a2fcc --- /dev/null +++ b/h/drv/sio/m68302Sio.h @@ -0,0 +1,109 @@ +/* m68302Sio.h - header file for m68302Sio serial driver */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,22may96,dat added intEnalbe to structure +01a,16apr96,dat written. +*/ + +/* +DESCRIPTION: + +INCLUDE FILES: +sioLib.h drv/multi/m68302.h +*/ + +#ifndef __INCm68302Sioh +#define __INCm68302Sioh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "sioLib.h" + +#include "drv/multi/m68302.h" + +/* per channel structure */ + +typedef struct /* M68302_CHAN */ + { + /* always goes first */ + + SIO_CHAN sio; + + /* callbacks */ + + FUNCPTR getTxChar; + FUNCPTR putRcvChar; + void * getTxArg; + void * putRcvArg; + + /* Must be initialized BEFORE m68302SioInit */ + SCC * pScc; /* serial comm ctlr */ + SCC_REG * pSccReg; /* serial comm ctlr registers */ + SCC_PARAM * pParam; + PROT_UART * pProt; + UINT16 intAck; /* interrupt acknowledge mask */ + int channel; /* channel #, or -1 to disable */ + + /* Initialized by m68302SioInit */ + int options; /* SIO_HW_OPTS */ + int mode; /* current mode (interrupt or poll) */ + int baud; /* baud rate */ + int rxBdNext; /* next rcv buff desc to fill */ + struct m68302Cp * pCp; /* back pointer to M68302_CP */ + + } M68302_CHAN; + +/* per device structure */ + +typedef struct m68302Cp /* M68302_CP */ + { + /* Initialized BEFORE m68302SioInit */ + volatile char * pCr; /* command reset register */ + volatile UINT16 * pSiMask; /* HELP register */ + volatile UINT16 * pSiMode; /* HELP register */ + volatile UINT16 * pImr; /* interrupt mask register */ + volatile UINT16 * pIsr; /* interrupt status register */ + UINT16 imrMask; /* imr value to unmask channels */ + char * buffer; /* buffer area, at least BUF_SIZE */ + int clockRate; /* CPU clock frequency (Hz) */ + BOOL intEnable; /* allow interrupt mode flag */ + + /* See Above for Channel initialization requirements */ + + M68302_CHAN portA; + M68302_CHAN portB; + M68302_CHAN portC; + + } M68302_CP; + +/* function prototypes */ + +#if defined(__STDC__) + +IMPORT VOID m68302SioInit (M68302_CP *pCp); +IMPORT VOID m68302SioInit2 (M68302_CP *pCp); +IMPORT VOID m68302SioInt (M68302_CHAN *pChan); + +#else /* __STDC__ */ + +IMPORT VOID m68302SioInit (); +IMPORT VOID m68302SioInit2 (); +IMPORT VOID m68302SioInt (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm68302Sioh */ diff --git a/h/drv/sio/m68332Sio.h b/h/drv/sio/m68332Sio.h new file mode 100644 index 0000000..4835e8d --- /dev/null +++ b/h/drv/sio/m68332Sio.h @@ -0,0 +1,66 @@ +/* m68332Sio.h - SCC UART device structrue */ + +/* Copyright 1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,22aug95,myz written +*/ + + +#ifndef __INCm68332Sioh +#define __INCm68332Sioh + +#include "drv/multi/m68332.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/* device and channel structures */ + +typedef struct + { + /* always goes first */ + + SIO_DRV_FUNCS * pDrvFuncs; /* driver functions */ + + /* callbacks */ + + STATUS (*getTxChar) (); + STATUS (*putRcvChar) (); + void * getTxArg; + void * putRcvArg; + + UINT16 channelMode; /* SIO_MODE */ + unsigned char intVec; + int baudRate; + int clockRate; /* CPU clock frequency (Hz) */ + volatile UINT16 * sccr0; + volatile UINT16 * sccr1; + volatile UINT16 * scsr; + volatile UINT16 * scdr; + volatile char * qilr; + } M68332_CHAN; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void m68332Int (M68332_CHAN *pDev); +extern void m68332DevInit (M68332_CHAN *pDev); + +#else /* __STDC__ */ + +extern void m68332Int (); +extern void m68332DevInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm68332Sioh */ diff --git a/h/drv/sio/m68360Sio.h b/h/drv/sio/m68360Sio.h new file mode 100644 index 0000000..9584797 --- /dev/null +++ b/h/drv/sio/m68360Sio.h @@ -0,0 +1,66 @@ +/* m68360Sio.h - SCC UART device structrue */ + +/* Copyright 1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,15jun95,ms updated for new driver. +01a,22may95,myz written +*/ + + +#ifndef __INCm68360Sioh +#define __INCm68360Sioh + +#include "drv/multi/m68360.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/* device and channel structures */ + +typedef struct + { + /* always goes first */ + + SIO_DRV_FUNCS * pDrvFuncs; /* driver functions */ + + /* callbacks */ + + STATUS (*getTxChar) (); + STATUS (*putRcvChar) (); + void * getTxArg; + void * putRcvArg; + + UINT16 int_vec; /* interrupt vector number */ + UINT16 channelMode; /* SIO_MODE */ + int baudRate; + int clockRate; /* CPU clock frequency (Hz) */ + int bgrNum; /* number of BRG being used */ + UINT32 * pBaud; /* BRG registers */ + UINT32 regBase; /* register/DPR base address */ + SCC_DEV uart; /* UART SCC device */ + } M68360_CHAN; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void m68360Int (M68360_CHAN *pDev); +extern void m68360DevInit (M68360_CHAN *pDev); + +#else /* __STDC__ */ + +extern void m68360Int (); +extern void m68360DevInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm68360Sioh */ diff --git a/h/drv/sio/m68562Sio.h b/h/drv/sio/m68562Sio.h new file mode 100644 index 0000000..d6440d1 --- /dev/null +++ b/h/drv/sio/m68562Sio.h @@ -0,0 +1,160 @@ +/* m68562.h - Motorola M68562 Serial I/O Chip header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,14nov95,myz removed some element in M68562_CHAN structure. +01c,14nov95,myz added one element int_set in M68562_CHAN structure +01b,15jun95,ms updated for new driver. +01a,14apr95,myz written (using m68562.h) +*/ + +#ifndef __INCm68562Sioh +#define __INCm68562Sioh + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "sioLib.h" +#include "drv/multi/m68562.h" + +#define N_CHANNELS 2 /* number of channels per chip */ + +typedef struct + { + /* always goes first */ + + SIO_DRV_FUNCS * pDrvFuncs; /* driver functions */ + + /* callbacks */ + + STATUS (*getTxChar) (); + STATUS (*putRcvChar) (); + void * getTxArg; + void * putRcvArg; + + USHORT channelMode; + USHORT chan_num; + struct M68562_QUSART *pQusart; /* back pointer to the device */ + char * cmr1; + char * cmr2; + char * ss1r; /* SYN1 /Secondary Adr Reg 1 */ + char * ss2r; /* SYN2 /Secondary Adr Reg 2 */ + char * tpr; /* transmitter parameter Reg */ + char * ttr; /* transmitter timer register */ + char * rpr; /* receiver parameter register */ + char * rtr; /* receiver timer register */ + char * ctprh; /* counter/timer preset register H */ + char * ctprl; /* counter/timer preset register L */ + char * ctcr; /* counter/timer control register */ + char * omr; /* output and miscellaneous register */ + char * cth; /* counter/timer high */ + char * ctl; /* counter/timer low */ + char * pcr; /* pin configuration register */ + char * ccr; /* channel command register */ + char * tx_data; /* transmitter data port */ + char * rx_data; /* receiver data port */ + char * rsr; /* receiver status register */ + char * trsr; /* transmitter/receiver state register */ + char * ictsr; /* input + counter/timer stat register */ + char * ier; /* interrupt enable register */ + + char rx_rdy; /* receiver ready bit */ + char tx_rdy; /* transmitter ready bit */ + + } M68562_CHAN; + +typedef struct M68562_QUSART + { + M68562_CHAN channel[N_CHANNELS]; + USHORT numChannels; + USHORT int_vec; + volatile char * gsr; /* general status register */ + volatile char * ivr; /* interrupt vector register unmodified */ + volatile char * icr; /* interrupt control register */ + volatile char * ivrm; /* interrupt vector register modified */ + } M68562_QUSART; + + + +/* port registers */ + +#define DSC_CMR1A (0x00) /* channel mode reg. 1 */ +#define DSC_CMR2A (0x01) /* channel mode reg. 2 */ +#define DSC_S1RA (0x02) /* secondary adrs reg1 */ +#define DSC_S2RA (0x03) /* secondary adrs reg2 */ +#define DSC_TPRA (0x04) /* tx parameter reg. */ +#define DSC_TTRA (0x05) /* tx timing reg. */ +#define DSC_RPRA (0x06) /* rx parameter reg. */ +#define DSC_RTRA (0x07) /* rx timing reg. */ +#define DSC_CTPRHA (0x08) /* counter preset high */ +#define DSC_CTPRLA (0x09) /* counter preset low */ +#define DSC_CTCRA (0x0a) /* counter control reg. */ +#define DSC_OMRA (0x0b) /* output/misc. reg. */ +#define DSC_CTHA (0x0c) /* counter/timer high */ +#define DSC_CTLA (0x0d) /* counter/timer low */ +#define DSC_PCRA (0x0e) /* pin configuration */ +#define DSC_CCRA (0x0f) /* channel command reg. */ +#define DSC_TXFIFOA (0x10) /* tx FIFO */ +#define DSC_RXFIFOA (0x14) /* rx FIFO */ +#define DSC_RSRA (0x18) /* rx status reg. */ +#define DSC_TRSRA (0x19) /* tx/rx status reg. */ +#define DSC_ICTSRA (0x1a) /* counter status reg. */ +#define DSC_GSR (0x1b) /* general status */ +#define DSC_IERA (0x1c) /* interrupt enable */ +#define DSC_IVR (0x1e) /* interrupt vector */ +#define DSC_ICR (0x1f) /* interrupt control */ +#define DSC_CMR1B (0x20) /* channel mode reg. 1 */ +#define DSC_CMR2B (0x21) /* channel mode reg. 2 */ +#define DSC_S1RB (0x22) /* secondary adrs reg 1 */ +#define DSC_S2RB (0x23) /* secondary adrs reg 2 */ +#define DSC_TPRB (0x24) /* tx parameter reg. */ +#define DSC_TTRB (0x25) /* tx timing reg. */ +#define DSC_RPRB (0x26) /* rx parameter reg. */ +#define DSC_RTRB (0x27) /* rx timing reg. */ +#define DSC_CTPRHB (0x28) /* counter preset high */ +#define DSC_CTPRLB (0x29) /* counter preset low */ +#define DSC_CTCRB (0x2a) /* counter control reg. */ +#define DSC_OMRB (0x2b) /* output/misc. reg. */ +#define DSC_CTHB (0x2c) /* counter/timer high */ +#define DSC_CTLB (0x2d) /* counter/timer low */ +#define DSC_PCRB (0x2e) /* pin configuration */ +#define DSC_CCRB (0x2f) /* channel command reg. */ +#define DSC_TXFIFOB (0x30) /* tx FIFO */ +#define DSC_RXFIFOB (0x34) /* rx FIFO */ +#define DSC_RSRB (0x38) /* rx status reg. */ +#define DSC_TRSRB (0x39) /* tx/rx status reg. */ +#define DSC_ICTSRB (0x3a) /* count/timer status */ +#define DSC_IERB (0x3c) /* interrupt enable */ +#define DSC_IVRM (0x3e) /* int. vec. modified */ + + +/* function declarations */ + +#ifndef _ASMLANGUAGE +#if defined(__STDC__) || defined(__cplusplus) + +extern void m68562TxInt (M68562_CHAN *pDev); +extern void m68562RxInt (M68562_CHAN *pDev); +extern void m68562RxTxErrInt (M68562_CHAN *pDev); +extern void m68562HrdInit (M68562_QUSART *pQusart); + +#else /* __STDC__ */ + +extern void m68562TxInt (); +extern void m68562RxInt (); +extern void m68562RxTxErrInt (); +extern void m68562HrdInit (); + +#endif /* __STDC__ */ +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm68562Sioh */ diff --git a/h/drv/sio/m68681Sio.h b/h/drv/sio/m68681Sio.h new file mode 100644 index 0000000..282d688 --- /dev/null +++ b/h/drv/sio/m68681Sio.h @@ -0,0 +1,395 @@ +/* m68681Sio.h - Motorola M68681 serial chip header file */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,03jun96,dat added opcrCopy and oprCopy fields, new rtns +01a,08feb96,dds created. +*/ + +/* +This file contains constants for the Motorola M68681 serial chip. +The constants DUART_REG_OFFSET and SIO must defined when +including this header file. +*/ + +#ifndef __INCm68681Sioh +#define __INCm68681Sioh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "sioLib.h" + +/* device and channel structures */ + +/* + * The M68681_CHAN structure defines a serial I/O channel which + * describes the baudrate, interrupt mode, control + * registers mode registers and the I/O port registers for a given channel. + * Also the various SIO driver functions ( ioctl, txStarup, callbackInstall, + * pollInput, polloutput ) that this channel could utilize are declared + * here. +*/ + +typedef volatile UCHAR VCHAR; /* shorthand for volatile UCHAR */ + +typedef struct m68681_chan /* M68681_CHAN */ + { + /* always goes first */ + SIO_CHAN sio; /* driver functions */ + + struct m68681_duart *pDuart;/* pointer to the mc68681 DUART */ + + /* callbacks */ + + STATUS (*getTxChar)(); /* pointer to a xmitr function */ + STATUS (*putRcvChar)();/* pointer to a recvr function */ + void * getTxArg; + void * putRcvArg; + + /* control and data register addresses for each channel */ + + VCHAR * mr; /* mode register address */ + VCHAR * sr; /* status register address */ + VCHAR * csr; /* clock select register address */ + VCHAR * cr; /* command register address */ + VCHAR * rb; /* receiver buffer address */ + VCHAR * tb; /* transmit buffer address */ + + UCHAR xmitEnb; /* bit for transmit enable */ + UCHAR rcvrEnb; /* bit for transmit enable */ + UCHAR rxBreak; /* bit for enabling break interrupt */ + + /* misc values */ + + UINT baudRate; /* current baud rate */ + UINT options; /* current options, SIO_HW_OPTS_SET */ + + /* interrupt/polled mode configuration info */ + + UINT mode; /* SIO_MODE_[INT | POLL] */ + UCHAR intVec; /* interrupt vector address */ + UCHAR intType; /* type of vector to supply from M68681 */ + UINT channel; /* channel number (0 or 1) */ + } M68681_CHAN; + +/* This structure defines that the m68681 has two channels */ + +typedef struct m68681_duart /* M68681_DUART */ + { + M68681_CHAN portA; /* port A device descriptor */ + M68681_CHAN portB; /* port B device descriptor */ + + /* The registers defined below are common to both channels */ + + VCHAR * ipcr; /* input port change register address */ + VCHAR * acr; /* auxilliary control register address */ + VCHAR * isr; /* interupt status register address */ + VCHAR * imr; /* interupt mask register address */ + VCHAR * ip; /* input port register address */ + VCHAR * opcr; /* output port config register address */ + VCHAR * sopbc; /* set output port register address */ + VCHAR * ropbc; /* reset output port register address */ + VCHAR * ctroff; /* Counter off */ + VCHAR * ctron; /* counter on */ + VCHAR * ctlr; /* counter timer lower register */ + VCHAR * ctur; /* counter timer upper register */ + VCHAR * ivr; /* interupt vector register address */ + + UCHAR imrCopy; /* stores interrupt mask register value */ + UINT baudFreq; /* baud clock frequency */ + UCHAR acrCopy; /* copy of acr */ + UCHAR opcrCopy; /* copy of opcr */ + UCHAR oprCopy; /* copy of opr */ + + VOIDFUNCPTR tickRtn; /* Timer interrupt service routine */ + void * tickArg; /* pointer to the system clock */ + BOOL intEnable; /* allow interrupt mode flag */ + + } M68681_DUART; + +typedef struct m68681_clock /* M68681_CLK */ + { + M68681_DUART * pDuart; /* pointer to the DUART */ + VOIDFUNCPTR routine; /* user routine */ + void * arg; /* arg for user routine */ + BOOL running; /* current status */ + UINT rate; /* interrupt rate, ticks per second */ + UINT hertz; /* oscillator input rate, hertz */ + UINT min; /* min rate */ + UINT max; /* max rate */ + UINT preload; /* counter/timer preload value */ + } M68681_CLK; + + +#if defined(__STDC__) || defined(__cplusplus) + +/* serial procedures */ +IMPORT void m68681DevInit (M68681_DUART *); +IMPORT void m68681DevInit2 (M68681_DUART *); +IMPORT void m68681Int (M68681_DUART *); +IMPORT void m68681ImrSetClr (M68681_DUART *, UCHAR, UCHAR); +IMPORT void m68681AcrSetClr (M68681_DUART *, UCHAR, UCHAR); +IMPORT void m68681OprSetClr (M68681_DUART *, UCHAR, UCHAR); +IMPORT void m68681OpcrSetClr(M68681_DUART *, UCHAR, UCHAR); +IMPORT UCHAR m68681Imr (M68681_DUART *); +IMPORT UCHAR m68681Acr (M68681_DUART *); +IMPORT UCHAR m68681Opcr (M68681_DUART *); +IMPORT UCHAR m68681Opr (M68681_DUART *); + +/* clock procedures */ +IMPORT STATUS m68681ClkInit (M68681_CLK *, M68681_DUART *); +IMPORT void m68681ClkInt (M68681_CLK *); +IMPORT STATUS m68681ClkConnect(M68681_CLK *, VOIDFUNCPTR, void *); +IMPORT void m68681ClkEnable (M68681_CLK *); +IMPORT void m68681ClkDisable(M68681_CLK *); +IMPORT int m68681ClkRateGet(M68681_CLK *); +IMPORT STATUS m68681ClkRateSet(M68681_CLK *, int); +IMPORT int m68681ClkReadOnFly(M68681_CLK *); + +#else /* __STDC__ */ + +IMPORT void m68681DevInit (); +IMPORT void m68681DevInit2 (); +IMPORT void m68681Int (); +IMPORT void m68681ImrSetClr (); +IMPORT void m68681AcrSetClr (); + +IMPORT STATUS m68681ClkInit (); +IMPORT void m68681ClkInt (); +IMPORT STATUS m68681ClkConnect(); +IMPORT void m68681ClkEnable (); +IMPORT void m68681ClkDisable(); +IMPORT int m68681ClkRateGet(); +IMPORT STATUS m68681ClkRateSet(); +IMPORT int m68681ClkReadOnFly(); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +/* channels */ + +#define M68681_CHANNEL_A 0 +#define M68681_CHANNEL_B 1 + + +#define M68681_N_CHANS 2 /* number of serial channels on chip */ + +#ifdef _ASMLANGUAGE +# define M681_ADRS(reg) (M68681_BASE + (reg * M68681_REG_OFFSET)) +#else +# define M681_ADRS(reg) ((VCHAR *)M68681_BASE+(reg*M68681_REG_OFFSET)) +#endif /* _ASMLANGUAGE */ + +/* SIO -- m68681 serial channel chip -- register definitions */ + +#define M68681_MRA M681_ADRS(0x00) /* R/W: mode reg. A */ +#define M68681_SRA M681_ADRS(0x01) /* R: status reg. A */ +#define M68681_CSRA M681_ADRS(0x01) /* W: clock select reg. A */ +#define M68681_CRA M681_ADRS(0x02) /* W: command reg. A */ +#define M68681_RHRA M681_ADRS(0x03) /* R: receive buffer A */ +#define M68681_THRA M681_ADRS(0x03) /* W: transmit buffer A */ +#define M68681_IPCR M681_ADRS(0x04) /* R: input port change reg. */ +#define M68681_ACR M681_ADRS(0x04) /* W: auxiliary control reg. */ +#define M68681_ISR M681_ADRS(0x05) /* R: int. status reg. */ +#define M68681_IMR M681_ADRS(0x05) /* W: int. mask reg. */ +#define M68681_CUR M681_ADRS(0x06) /* R: current MSB of counter */ +#define M68681_CTUR M681_ADRS(0x06) /* W: counter timer upper reg. */ +#define M68681_CLR M681_ADRS(0x07) /* W: current LSB of counter */ +#define M68681_CTLR M681_ADRS(0x07) /* W: counter timer lower reg. */ +#define M68681_MRB M681_ADRS(0x08) /* R/W: mode reg. B */ +#define M68681_SRB M681_ADRS(0x09) /* R: status reg. B */ +#define M68681_CSRB M681_ADRS(0x09) /* W: clock select reg. B */ +#define M68681_CRB M681_ADRS(0x0a) /* W: command reg. B */ +#define M68681_RHRB M681_ADRS(0x0b) /* R: receive buffer B */ +#define M68681_THRB M681_ADRS(0x0b) /* W: transmit buffer B */ +#define M68681_IVR M681_ADRS(0x0c) /* R/W: int. vector reg. */ +#define M68681_IP M681_ADRS(0x0d) /* R: input port (Unlatched) */ +#define M68681_OPCR M681_ADRS(0x0d) /* W: output port config. reg. */ +#define M68681_CTRON M681_ADRS(0x0e) /* R: counter on */ +#define M68681_SOPBC M681_ADRS(0x0e) /* W: set output port bits */ +#define M68681_CTROFF M681_ADRS(0x0f) /* R: counter off */ +#define M68681_ROPBC M681_ADRS(0x0f) /* W: reset output port bits */ + +/* equates for mode reg. 1 for channel A or B */ + +#define M68681_MR1_RX_RTS 0x80 /* receiver RTS enabled */ +#define M68681_MR1_RX_INT 0x40 /* receiver intrupt enabled */ +#define M68681_MR1_ERR_MODE 0x20 /* block error mode */ +#define M68681_MR1_PAR_MODE_MULTI 0x18 /* multi_drop mode */ +#define M68681_MR1_NO_PARITY 0x10 /* no parity mode */ +#define M68681_MR1_ALWAYS_0 0x08 /* force parity mode */ +#define M68681_MR1_ALWAYS_1 0x0c /* force parity mode */ +#define M68681_MR1_EVEN_PARITY 0x00 /* parity mode */ +#define M68681_MR1_ODD_PARITY 0x04 /* 0 = even, 1 = odd */ +#define M68681_MR1_BITS_CHAR_8 0x03 /* 8 bits */ +#define M68681_MR1_BITS_CHAR_7 0x02 /* 7 bits */ +#define M68681_MR1_BITS_CHAR_6 0x01 /* 6 bits */ +#define M68681_MR1_BITS_CHAR_5 0x00 /* 5 bits */ + +/* equates for mode reg. 2 for channel A or B */ + +#define M68681_MR2_NORMAL_MODE 0x00 /* normal channel mode */ +#define M68681_MR2_AUTO_MODE 0x40 /* automatic channel mode */ +#define M68681_MR2_LOOPBACK_LOCL 0x80 /* local loopback channel mode */ +#define M68681_MR2_LOOPBACK_REMT 0xc0 /* remote loopback channel mode */ +#define M68681_MR2_TX_RTS 0x20 /* transmitter RTS enabled */ +#define M68681_MR2_TX_CTS 0x10 /* transmitter CTS enabled */ +#define M68681_MR2_STOP_BITS_2 0x0f /* 2 stop bits */ +#define M68681_MR2_STOP_BITS_1 0x07 /* 1 stop bit */ + +/* equates for command reg. A or B */ + +#define M68681_CR_NO_COMMAND 0x00 /* no command */ +#define M68681_CR_RST_MR_PTR_CMD 0x10 /* reset mr pointer command */ +#define M68681_CR_RST_RX_CMD 0x20 /* reset receiver command */ +#define M68681_CR_RST_TX_CMD 0x30 /* reset transmitter command */ +#define M68681_CR_RST_ERR_STS_CMD 0x40 /* reset error status cmnd */ +#define M68681_CR_RST_BRK_INT_CMD 0x50 /* reset break int. command */ +#define M68681_CR_STR_BREAK_CMD 0x60 /* start break command */ +#define M68681_CR_STP_BREAK_CMD 0x70 /* stop break command */ + +#define M68681_CR_RX_ENABLE 0x01 /* receiver enabled */ +#define M68681_CR_RX_DISABLE 0x02 /* receiver disabled */ +#define M68681_CR_TX_ENABLE 0x04 /* transmitter enabled */ +#define M68681_CR_TX_DISABLE 0x08 /* transmitter disabled */ + +/* equates for clock select reg. A or B */ + +#define M68681_CSR_RX_SEL 0xf0 /* receiver clock select */ +#define M68681_CSR_RX_38400 0xc0 /* 38400, set 1 */ +#define M68681_CSR_RX_19200 0xc0 /* 19200 */ +#define M68681_CSR_RX_9600 0xb0 /* 9600 */ +#define M68681_CSR_RX_1800 0xa0 /* 1800 */ +#define M68681_CSR_RX_4800 0x90 /* 4800 */ +#define M68681_CSR_RX_2400 0x80 /* 2400 */ +#define M68681_CSR_RX_2000 0x70 /* 2000 */ +#define M68681_CSR_RX_1200 0x60 /* 1200 */ +#define M68681_CSR_RX_600 0x50 /* 600 */ +#define M68681_CSR_RX_300 0x40 /* 300 */ +#define M68681_CSR_RX_150 0x30 /* 150 */ +#define M68681_CSR_RX_134_5 0x20 /* 134.5 */ +#define M68681_CSR_RX_110 0x10 /* 110 */ +#define M68681_CSR_RX_75 0x00 /* 75 */ +#define M68681_CSR_TX_SEL 0x0f /* transmitter clock select */ +#define M68681_CSR_TX_38400 0x0c /* 38400, set 1 */ +#define M68681_CSR_TX_19200 0x0c /* 19200 */ +#define M68681_CSR_TX_9600 0x0b /* 9600 */ +#define M68681_CSR_TX_1800 0x0a /* 1800 */ +#define M68681_CSR_TX_4800 0x09 /* 4800 */ +#define M68681_CSR_TX_2400 0x08 /* 2400 */ +#define M68681_CSR_TX_2000 0x07 /* 2000 */ +#define M68681_CSR_TX_1200 0x06 /* 1200 */ +#define M68681_CSR_TX_600 0x05 /* 600 */ +#define M68681_CSR_TX_300 0x04 /* 300 */ +#define M68681_CSR_TX_150 0x03 /* 150 */ +#define M68681_CSR_TX_134_5 0x02 /* 134.5 */ +#define M68681_CSR_TX_110 0x01 /* 110 */ +#define M68681_CSR_TX_75 0x00 /* 75 */ + +/* equates for status reg. A or B */ + +#define M68681_SR_BREAK 0x80 /* received break */ +#define M68681_SR_FRAMING 0x40 /* framing error */ +#define M68681_SR_PARITY 0x20 /* parity error */ +#define M68681_SR_OVERRUN 0x10 /* overrun error */ +#define M68681_SR_TXEMT 0x08 /* transmitter empty */ +#define M68681_SR_TXRDY 0x04 /* transmitter ready*/ +#define M68681_SR_FFULL 0x02 /* fifo full */ +#define M68681_SR_RXRDY 0x01 /* receiver ready */ + +/* equates for int. status reg. */ + +#define M68681_ISR_INPUT_DELTA_INT 0x80 /* input port change*/ +#define M68681_ISR_BREAK_B_INT 0x40 /* delta break B */ +#define M68681_ISR_RX_RDY_B_INT 0x20 /* rcvr ready / fifo full B */ +#define M68681_ISR_TX_RDY_B_INT 0x10 /* transmitter ready B */ +#define M68681_ISR_CTR_RDY_INT 0x08 /* counter / timer ready */ +#define M68681_ISR_BREAK_A_INT 0x04 /* delta break A */ +#define M68681_ISR_RX_RDY_A_INT 0x02 /* receiver rdy /fifo full A */ +#define M68681_ISR_TX_RDY_A_INT 0x01 /* transmitter ready A */ + +/* equates for int. mask reg. */ + +#define M68681_IMR_CLEAR 0xff /* Clear the imr */ +#define M68681_IMR_INPUT_DELTA 0x80 /* input port change*/ +#define M68681_IMR_BREAK_B 0x40 /* delta break B */ +#define M68681_IMR_RX_RDY_B 0x20 /* rcvr rdy / fifo full B */ +#define M68681_IMR_TX_RDY_B 0x10 /* transmitter ready B */ +#define M68681_IMR_CTR_RDY 0x08 /* counter / timer ready */ +#define M68681_IMR_BREAK_A 0x04 /* delta break A */ +#define M68681_IMR_RX_RDY_A 0x02 /* rcvr ready / fifo full A */ +#define M68681_IMR_TX_RDY_A 0x01 /* transmitter ready A */ + +/* equates for auxiliary control reg. (timer and counter clock selects) */ + +#define M68681_ACR_BRG_SELECT 0x80 /* baud rate gen select */ + /* 0 = set 1; 1 = set 2 */ + /* equates are set 2 ONLY */ +#define M68681_ACR_TMR_EXT_CLK_16 0x70 /* xtnl clock divided by 16 */ +#define M68681_ACR_TMR_EXT_CLK 0x60 /* external clock */ +#define M68681_ACR_TMR_IP2_16 0x50 /* ip2 divided by 16 */ +#define M68681_ACR_TMR_IP2 0x40 /* ip2 */ +#define M68681_ACR_CTR_EXT_CLK_16 0x30 /* xtnl clock divided by 16 */ +#define M68681_ACR_CTR_TXCB 0x20 /* channel B xmitr clock */ +#define M68681_ACR_CTR_TXCA 0x10 /* channel A xmitr clock */ +#define M68681_ACR_CTR_IP2 0x00 /* ip2 */ +#define M68681_ACR_DELTA_IP3_INT 0x08 /* delta ip3 int. */ +#define M68681_ACR_DELTA_IP2_INT 0x04 /* delta ip2 int. */ +#define M68681_ACR_DELTA_IP1_INT 0x02 /* delta ip1 int. */ +#define M68681_ACR_DELTA_IP0_INT 0x01 /* delta ip0 int. */ + +/* equates for input port change reg. */ + +#define M68681_IPCR_DELTA_IP3 0x80 /* 0 = no, 1 = yes */ +#define M68681_IPCR_DELTA_IP2 0x40 /* 0 = no, 1 = yes */ +#define M68681_IPCR_DELTA_IP1 0x20 /* 0 = no, 1 = yes */ +#define M68681_IPCR_DELTA_IP0 0x10 /* 0 = no, 1 = yes */ +#define M68681_IPCR_IP3 0x08 /* 0 = low, 1 = high */ +#define M68681_IPCR_IP2 0x04 /* 0 = low, 1 = high */ +#define M68681_IPCR_IP1 0x02 /* 0 = low, 1 = high */ +#define M68681_IPCR_IP0 0x01 /* 0 = low, 1 = high */ + +/* equates for output port config. reg. */ + +#define M68681_OPCR_OP7 0x80 /* 0 = OPR[7], 1 = TxRDYB */ +#define M68681_OPCR_OP6 0x40 /* 0 = OPR[6], 1 = TxRDYA */ +#define M68681_OPCR_OP5 0x20 /* 0 = OPR[5], 1 = RxRDYB */ +#define M68681_OPCR_OP4 0x10 /* 0 = OPR[4], 1 = RxRDYA */ +#define M68681_OPCR_OP3 0x00 /* 0 = OPR[3] */ +#define M68681_OPCR_RXCB_1X 0x0c /* RCXB_1X */ +#define M68681_OPCR_TXCB_1X 0x08 /* TXCB_1X */ +#define M68681_OPCR_C_T_OUTPUT 0x04 /* C_T_OUTPUT */ + +#define M68681_OPCR_TXCA_16X 0x01 /* TXCA_16X */ +#define M68681_OPCR_TXCA_1X 0x02 /* TXCA_1X */ +#define M68681_OPCR_RXCA_1X 0x03 /* RXCA_1X */ +#define M68681_OPCR_OP2 0x00 /* 0 = OPR[2] */ + +/* Output port bit assignments */ +#define M68681_RTS_A_LOW 0x01 /* 1= low, 0=hi */ +#define M68681_RTS_B_LOW 0x02 /* 1= low, 0=hi */ + +/* Macros for default baud, parity, stop bits & data bits */ + +#define M68681_DEFAULT_BAUD (9600) + +#define M68681_ERROR_STATUS (M68681_SR_BREAK|M68681_SR_FRAMING|M68681_SR_PARITY \ + |M68681_SR_OVERRUN) + +#define M68681_CHAN_A_INT (M68681_ISR_BREAK_A_INT|M68681_ISR_RX_RDY_A_INT \ + |M68681_ISR_TX_RDY_A_INT) + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm68681Sioh */ diff --git a/h/drv/sio/m68901Sio.h b/h/drv/sio/m68901Sio.h new file mode 100644 index 0000000..ed942c2 --- /dev/null +++ b/h/drv/sio/m68901Sio.h @@ -0,0 +1,227 @@ +/* m68901Sio.h - Motorola MC68901 MFP (Multi-Function Peripheral) */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,25may96,sub wrote from m68901.h +*/ + +#ifndef __INCm68901Sioh +#define __INCm68901Sioh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The macro MFP_REG_ADDR_INTERVAL must be defined + * when including this header. + */ + + +#ifdef _ASMLANGUAGE + +#define CAST + +#else /* _ASMLANGUAGE */ + +#define CAST (char *) + +#include "sioLib.h" + +typedef struct + { + SIO_DRV_FUNCS * pDrvFuncs; /* Driver functions */ + /* CallBacks */ + STATUS (*getTxChar)(); + STATUS (*putRcvChar)(); + void * getTxArg; + void * putRcvArg; + + uint32_t baudFreq; /* reference clock, in Hz */ + uint32_t baudRate; /* Baud rate */ + uint16_t baudMin; /* minimum baud rate */ + uint16_t baudMax; /* maximum baud rate */ + char *ucr; /* USART control register */ + char *rsr; /* receiver status register */ + char *tsr; /* transmit status register */ + char *udr; /* USART data register */ + char *imra; + char *imrb; + char *iera; + char *ierb; + char *baud1; /* baud rate 1 generator data register */ + char *baud2; /* baud rate 2 generator data register */ + + /* Mode configuration info */ + uint_t mode; + char intVec; + char intType; + uint_t channel; + } M68901_CHAN; + +#endif /* _ASMLANGUAGE */ + +#define MFP_ADRS(base,reg) (CAST (base+(reg*MFP_REG_ADDR_INTERVAL))) + +/* register definitions */ + +#define MFP_GPIP(base) MFP_ADRS(base,0x00) /* Data I/O port */ +#define MFP_AER(base) MFP_ADRS(base,0x01) /* active edge register */ +#define MFP_DDR(base) MFP_ADRS(base,0x02) /* data direction reg. */ +#define MFP_IERA(base) MFP_ADRS(base,0x03) /* interrupt enable reg A */ +#define MFP_IERB(base) MFP_ADRS(base,0x04) /* interrupt enable reg B */ +#define MFP_IPRA(base) MFP_ADRS(base,0x05) /* int. pending reg A */ +#define MFP_IPRB(base) MFP_ADRS(base,0x06) /* int. pending reg B */ +#define MFP_ISRA(base) MFP_ADRS(base,0x07) /* int. in-service reg A */ +#define MFP_ISRB(base) MFP_ADRS(base,0x08) /* int. in-service reg B */ +#define MFP_IMRA(base) MFP_ADRS(base,0x09) /* interrupt mask reg A */ +#define MFP_IMRB(base) MFP_ADRS(base,0x0a) /* interrupt mask reg B */ +#define MFP_VR(base) MFP_ADRS(base,0x0b) /* vector reg */ +#define MFP_TACR(base) MFP_ADRS(base,0x0c) /* timer A control reg */ +#define MFP_TBCR(base) MFP_ADRS(base,0x0d) /* timer B control reg */ +#define MFP_TCDCR(base) MFP_ADRS(base,0x0e) /* timers C&D control reg */ +#define MFP_TADR(base) MFP_ADRS(base,0x0f) /* timer A data reg */ +#define MFP_TBDR(base) MFP_ADRS(base,0x10) /* timer B data reg */ +#define MFP_TCDR(base) MFP_ADRS(base,0x11) /* timer C data reg */ +#define MFP_TDDR(base) MFP_ADRS(base,0x12) /* timer D data reg */ +#define MFP_SCR(base) MFP_ADRS(base,0x13) /* sync char reg */ +#define MFP_UCR(base) MFP_ADRS(base,0x14) /* USART control reg */ +#define MFP_RSR(base) MFP_ADRS(base,0x15) /* receiver status reg */ +#define MFP_TSR(base) MFP_ADRS(base,0x16) /* transmitter status reg */ +#define MFP_UDR(base) MFP_ADRS(base,0x17) /* USART data reg */ + +/* vector number offsets */ + +#define MFP_INT_GP0 0x00 /* general purpose I0 */ +#define MFP_INT_GP1 0x01 /* general purpose I1 */ +#define MFP_INT_GP2 0x02 /* general purpose I2 */ +#define MFP_INT_GP3 0x03 /* general purpose I3 */ +#define MFP_INT_TIMER_D 0x04 /* timer D */ +#define MFP_INT_TIMER_C 0x05 /* timer C */ +#define MFP_INT_GP4 0x06 /* general purpose I4 */ +#define MFP_INT_GP5 0x07 /* general purpose I5 */ +#define MFP_INT_TIMER_B 0x08 /* timer B */ +#define MFP_INT_TX_ERR 0x09 /* transmit error */ +#define MFP_INT_TRANS 0x0a /* transmit buffer empty */ +#define MFP_INT_RX_ERR 0x0b /* receive error */ +#define MFP_INT_RECV 0x0c /* receive buffer full */ +#define MFP_INT_TIMER_A 0x0d /* timer A */ +#define MFP_INT_GP6 0x0e /* general purpose I6 */ +#define MFP_INT_GP7 0x0f /* general purpose I7 */ + +/* fields of vector register (VR) */ + +#define MFP_VR_SOFT 0x08 /* software acknowledge interrupts */ + +/* fields of interrupt enable A (IERA), interrupt pending A (IPRA), */ +/* interrupt in-service A (ISRA), interrupt mask A (IMRA) */ + +#define MFP_A_TIMER_B 0x01 /* timer B */ +#define MFP_A_TX_ERR 0x02 /* transmitter error */ +#define MFP_A_TX_EMPTY 0x04 /* transmitter buffer empty */ +#define MFP_A_RX_ERR 0x08 /* receiver error */ +#define MFP_A_RX_FULL 0x10 /* receiver buffer full */ +#define MFP_A_TIMER_A 0x20 /* timer A */ +#define MFP_A_GPIP6 0x40 /* general purpose i/o 6 */ +#define MFP_A_GPIP7 0x80 /* general purpose i/o 7 */ + +/* fields of interrupt enable B (IERB), interrupt pending B (IPRB), */ +/* interrupt in-service B (ISRB), interrupt mask B (IMRB) */ + +#define MFP_B_GPIP0 0x01 /* general purpose i/o 0 */ +#define MFP_B_GPIP1 0x02 /* general purpose i/o 1 */ +#define MFP_B_GPIP2 0x04 /* general purpose i/o 2 */ +#define MFP_B_GPIP3 0x08 /* general purpose i/o 3 */ +#define MFP_B_TIMER_D 0x10 /* timer D */ +#define MFP_B_TIMER_C 0x20 /* timer C */ +#define MFP_B_GPIP4 0x40 /* general purpose i/o 4 */ +#define MFP_B_GPIP5 0x80 /* general purpose i/o 5 */ + +/* fields of usart control register (UCR) */ + +#define MFP_UCR_16X 0x80 /* divide clock souce by 16 */ +#define MFP_UCR_8BIT 0x00 /* 8 bit word length */ +#define MFP_UCR_7BIT 0x20 /* 7 bit word length */ +#define MFP_UCR_6BIT 0x40 /* 6 bit word length */ +#define MFP_UCR_5BIT 0x60 /* 5 bit word length */ +#define MFP_UCR_SYNC 0x00 /* synchronous */ +#define MFP_UCR_1STOP 0x08 /* one stop bit */ +#define MFP_UCR_1_AND_HALF_STOP 0x10 /* one and a half stop bits */ +#define MFP_UCR_2STOP 0x18 /* two stop bits */ +#define MFP_UCR_NO_PARITY 0x00 /* disable parity */ +#define MFP_UCR_EVEN_PARITY 0x06 /* enable even parity */ +#define MFP_UCR_ODD_PARITY 0x04 /* enable odd parity */ + +/* fields of receiver status register (RSR) */ + +#define MFP_RSR_RX_ENABLE 0x01 /* enable receiver */ +#define MFP_RSR_SYNC_STRIP_ENABLE 0x02 /* strip sync characters */ +#define MFP_RSR_CHAR_IN_PROGRESS 0x04 /* receiving a character */ +#define MFP_RSR_BREAK_DETECT 0x08 /* break detect */ +#define MFP_RSR_FRAME_ERROR 0x10 /* framing error */ +#define MFP_RSR_PARITY_ERROR 0x20 /* parity error */ +#define MFP_RSR_OVERRUN_ERROR 0x40 /* overrun error */ +#define MFP_RSR_BUFFER_FULL 0x80 /* receive buffer full */ + +/* fields of transmitter status register (TSR) */ + +#define MFP_TSR_TX_ENABLE 0x01 /* enable receiver */ +#define MFP_TSR_HI_Z 0x00 /* hi - Z */ +#define MFP_TSR_LOW 0x02 /* LOW */ +#define MFP_TSR_HIGH 0x04 /* HIGH */ +#define MFP_TSR_LOOP 0x06 /* LOOP */ +#define MFP_TSR_BREAK 0x08 /* transmit break */ +#define MFP_TSR_EOT 0x10 /* end of transmission */ +#define MFP_TSR_AUTO_TURNAROUND 0x20 /* parity error */ +#define MFP_TSR_UNDERRUN_ERROR 0x40 /* overrun error */ +#define MFP_TSR_BUFFER_EMPTY 0x80 /* transmit buffer empty */ + +/* fields of timer control registers */ + +#define MFP_TCR_A_MASK 0xf /* timer A mask */ +#define MFP_TCR_B_MASK 0xf /* timer B mask */ +#define MFP_TCR_C_MASK 0x70 /* timer C mask */ +#define MFP_TCR_D_MASK 0x7 /* timer D mask */ +#define MFP_TCR_RESET 0x10 /* reset timer A&B */ +#define MFP_TCR_STOP 0x00 /* stop timer */ +#define MFP_TCR_DELAY_4 0x11 /* delay mode, divide by 4 prescale */ +#define MFP_TCR_DELAY_10 0x22 /* delay mode, divide by 10 prescale */ +#define MFP_TCR_DELAY_16 0x33 /* delay mode, divide by 16 prescale */ +#define MFP_TCR_DELAY_50 0x44 /* delay mode, divide by 50 prescale */ +#define MFP_TCR_DELAY_64 0x55 /* delay mode, divide by 64 prescale */ +#define MFP_TCR_DELAY_100 0x66 /* delay mode, divide by 100 prescale */ +#define MFP_TCR_DELAY_200 0x77 /* delay mode, divide by 200 prescale */ +#define MFP_TCR_EVENT 0x8 /* event count mode */ +#define MFP_TCR_PULSE_4 0x9 /* pulse mode, divide by 4 prescale */ +#define MFP_TCR_PULSE_10 0xa /* pulse mode, divide by 10 prescale */ +#define MFP_TCR_PULSE_16 0xb /* pulse mode, divide by 16 prescale */ +#define MFP_TCR_PULSE_50 0xc /* pulse mode, divide by 50 prescale */ +#define MFP_TCR_PULSE_64 0xd /* pulse mode, divide by 64 prescale */ +#define MFP_TCR_PULSE_100 0xe /* pulse mode, divide by 100 prescale */ +#define MFP_TCR_PULSE_200 0xf /* pulse mode, divide by 200 prescale */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT void m68901DevInit (M68901_CHAN *pChan); +IMPORT void m68901IntWr (M68901_CHAN *pChan); +IMPORT void m68901IntRd (M68901_CHAN *pChan); + +#else /* __STDC__ */ + +IMPORT void m68901DevInit (); +IMPORT void m68901IntWr (); +IMPORT void m68901IntRd (); + +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm68901Sioh */ diff --git a/h/drv/sio/m8260Brg.h b/h/drv/sio/m8260Brg.h new file mode 100644 index 0000000..af8019f --- /dev/null +++ b/h/drv/sio/m8260Brg.h @@ -0,0 +1,134 @@ +/* m8260Brg.h - Motorola MPC8260 Baud Rate Generators header file */ + +/* Copyright 1984-1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,12sep99,ms_ created from m8260Cpm.h, 01d. +*/ + +/* + * This file contains constants for the Baud Rate Generators (BRGs) + * in the Motorola MPC8260 PowerQUICC II integrated Communications + * Processor + */ + +#ifndef __INCm8260Brgh +#define __INCm8260Brgh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef M8260ABBREVIATIONS +#define M8260ABBREVIATIONS + +#ifdef _ASMLANGUAGE +#define CAST(x) +#else /* _ASMLANGUAGE */ +typedef volatile UCHAR VCHAR; /* shorthand for volatile UCHAR */ +typedef volatile INT32 VINT32; /* volatile unsigned word */ +typedef volatile INT16 VINT16; /* volatile unsigned halfword */ +typedef volatile INT8 VINT8; /* volatile unsigned byte */ +typedef volatile UINT32 VUINT32; /* volatile unsigned word */ +typedef volatile UINT16 VUINT16; /* volatile unsigned halfword */ +typedef volatile UINT8 VUINT8; /* volatile unsigned byte */ +#define CAST(x) (x) +#endif /* _ASMLANGUAGE */ + +#endif /* M8260ABBREVIATIONS */ + +#ifndef M8260_32_WR +#define M8260_32_WR(addr, value) (* ((UINT32 *)(addr)) = ((UINT32) (value))) +#endif + +#ifndef M8260_16_WR +#define M8260_16_WR(addr, value) (* ((UINT16 *)(addr)) = ((UINT16) (value))) +#endif + +#ifndef M8260_8_WR +#define M8260_8_WR(addr, value) (* ((UINT8 *)(addr)) = ((UINT8) (value))) +#endif + +#ifndef M8260_32_RD +#define M8260_32_RD(addr, value) ((value) = (* (UINT32 *) ((UINT32 *)(addr)))) +#endif + +#ifndef M8260_16_RD +#define M8260_16_RD(addr, value) ((value) = (* (UINT16 *) ((UINT16 *)(addr)))) +#endif + +#ifndef M8260_8_RD +#define M8260_8_RD(addr, value) ((value) = (* (UINT8 *) ((UINT8 *)(addr)))) +#endif + +#ifndef M8260_NTH_REG_WR_32 +#define M8260_NTH_REG_WR_32(regVal, regBase, offsetNext, n) \ + { \ + VINT32 *pReg = (VINT32 *) \ + (immrVal + \ + regBase + \ + ((n-1) * offsetNext)); \ + M8260_32_WR(pReg, regVal); \ + } +#endif + +#define M8260_BRGC_WR(value, brgc) \ + M8260_NTH_REG_WR_32(value, \ + M8260_BRGC_BASE, \ + M8260_BRGC_OFFSET_NEXT_BRGC, \ + brgc) + +/* + * MPC8260 internal register/memory map (section 17 of prelim. spec) + * note that these are offsets from the value stored in the IMMR + * register. Also note that in the MPC8260, the IMMR is not a special + * purpose register, but it is memory mapped. + */ + +/* Baud Rate Generators */ + +#define M8260_BRGC_BASE 0x000119F0 +#define M8260_BRGC_OFFSET_NEXT_BRGC 0x00000004 + +#define M8260_BRGC_RD(regVal, brg) \ + { \ + VINT32 *pReg = (VINT32 *) \ + (immrVal + \ + M8260_BRGC_BASE + \ + ((brg - 1) * M8260_BRGC_OFFSET_NEXT_BRGC)); \ + M8260_32_RD(pReg, regVal); \ + } + +#define M8260_BRGC_SET_BITS(bitmap) \ + { \ + UINT32 regVal; \ + VINT32 *pReg = (VINT32 *) \ + (immrVal + \ + M8260_BRGC_BASE + \ + (scc * M8260_BRGC_OFFSET_NEXT_BRGC)); \ + M8260_32_RD(pReg, regVal); \ + M8260_32_WR(pReg, (regVal | bitmap)); \ + } + +/* macros used in the configuration registers */ + +#define M8260_BRGC_CD_MASK 0x00001FFE /* clock divider mask */ +#define M8260_BRGC_CD_SHIFT 0x1 /* to shift CD into position */ +#define M8260_BRGC_RST 0x00020000 /* Reset BRG */ +#define M8260_BRGC_EN 0x00010000 /* Enable BRG count */ +#define M8260_BRGC_EXTC_BRGCLK 0x0 /* clock comes from BRGCKL */ +#define M8260_BRGC_EXTC_CLK3_9 0x1 /* clock comes from pin 3 or 9 */ +#define M8260_BRGC_EXTC_CLK5_15 0x2 /* clock comes from pin 5 or 15 */ +#define M8260_BRGC_EXTC_MASK 0x0000C000 /* External Clock Source Mask */ +#define M8260_BRGC_EXTC_SHIFT 0xE /* shift EXTC 14 bits to position */ +#define M8260_BRGC_ATB 0x00002000 /* 1 = Autobaud on Rx */ + /* 0 = normal operation */ + #define M8260_BRGC_DIV16 0x00000001 /* BRG Clock divide by 16 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm8260Brgh */ diff --git a/h/drv/sio/m8260Cp.h b/h/drv/sio/m8260Cp.h new file mode 100644 index 0000000..db97547 --- /dev/null +++ b/h/drv/sio/m8260Cp.h @@ -0,0 +1,154 @@ +/* m8260Cp.h - Motorola MPC8260 Communications Processor header file */ + +/* Copyright 1984-1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,12sep99,ms_ created from m8260Cpm.h, 01d. +*/ + +/* + * This file contains constants for the Communication Processor in + * the Motorola MPC8260 PowerQUICC II integrated Communications Processor + */ + +#ifndef __INCm8260Cph +#define __INCm8260Cph + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef M8260ABBREVIATIONS +#define M8260ABBREVIATIONS + +#ifdef _ASMLANGUAGE +#define CAST(x) +#else /* _ASMLANGUAGE */ +typedef volatile UCHAR VCHAR; /* shorthand for volatile UCHAR */ +typedef volatile INT32 VINT32; /* volatile unsigned word */ +typedef volatile INT16 VINT16; /* volatile unsigned halfword */ +typedef volatile INT8 VINT8; /* volatile unsigned byte */ +typedef volatile UINT32 VUINT32; /* volatile unsigned word */ +typedef volatile UINT16 VUINT16; /* volatile unsigned halfword */ +typedef volatile UINT8 VUINT8; /* volatile unsigned byte */ +#define CAST(x) (x) +#endif /* _ASMLANGUAGE */ + +#endif /* M8260ABBREVIATIONS */ + +/* + * MPC8260 internal register/memory map (section 17 of prelim. spec) + * note that these are offsets from the value stored in the IMMR + * register. Also note that in the MPC8260, the IMMR is not a special + * purpose register, but it is memory mapped. + */ + +/* Command Register definitions (CPCR - 0x119C0) */ + +#define M8260_CPCR(base) (CAST(VUINT32 *)((base) + 0x119C0)) /* CPCR */ +#define M8260_CPCR_LATENCY (65536 * 400) /* worst case exec latency */ + +#define M8260_CPCR_RESET 0x80000000 /* software reset command */ +#define M8260_CPCR_PAGE_MSK 0x7c000000 /* RAM page number */ +#define M8260_CPCR_SBC_MSK 0x03e00000 /* sub-block code */ +#define M8260_CPCR_RES1 0x001e0000 /* reserved */ +#define M8260_CPCR_FLG 0x00010000 /* flag - command executing */ +#define M8260_CPCR_RES2 0x0000c000 /* reserved */ +#define M8260_CPCR_MCN_MSK 0x00003fc0 /* MCC channel number */ +#define M8260_CPCR_RES3 0x00000030 /* reserved */ +#define M8260_CPCR_OP_MSK 0x0000000f /* command opcode */ +#define M8260_CPCR_PAGE_SHIFT 0x1a /* get to the page field */ +#define M8260_CPCR_SBC_SHIFT 0x15 /* get to the SBC field */ +#define M8260_CPCR_MCN_SHIFT 0x6 /* get to the MCC field */ +#define M8260_CPCR_OP_SHIFT 0x0 /* get to the opcode field */ +#define M8260_CPCR_MCN_HDLC 0x0 /* protocol code: HDLC */ +#define M8260_CPCR_MCN_ATM 0xa /* protocol code: ATM */ +#define M8260_CPCR_MCN_ETH 0xc /* protocol code: ETH */ +#define M8260_CPCR_MCN_TRANS 0xf /* protocol code: TRANS */ + +#define M8260_CPCR_OP(x) \ + (((x) << M8260_CPCR_OP_SHIFT) & M8260_CPCR_OP_MSK) + +#define M8260_CPCR_SBC(x) \ + (((x) << M8260_CPCR_SBC_SHIFT) & M8260_CPCR_SBC_MSK) + +#define M8260_CPCR_PAGE(x) \ + (((x) << M8260_CPCR_PAGE_SHIFT) & M8260_CPCR_PAGE_MSK) + +#define M8260_CPCR_MCN(x) \ + (((x) << M8260_CPCR_MCN_SHIFT) & M8260_CPCR_MCN_MSK) + +/* CPCR - Sub-block code */ + +#define M8260_CPCR_SBC_FCC1 0x10 /* FCC1 channel */ +#define M8260_CPCR_SBC_ATM_FCC1 0x0e /* ATM on FCC1 */ +#define M8260_CPCR_SBC_FCC2 0x11 /* FCC2 channel */ +#define M8260_CPCR_SBC_ATM_FCC2 0x0e /* ATM on FCC2 */ +#define M8260_CPCR_SBC_FCC3 0x12 /* FCC3 channel */ +#define M8260_CPCR_SBC_SCC1 0x04 /* SCC1 channel */ +#define M8260_CPCR_SBC_SCC2 0x05 /* SCC2 channel */ +#define M8260_CPCR_SBC_SCC3 0x06 /* SCC3 channel */ +#define M8260_CPCR_SBC_SCC4 0x07 /* SCC4 channel */ +#define M8260_CPCR_SBC_SMC1 0x08 /* SMC1 channel */ +#define M8260_CPCR_SBC_SMC2 0x09 /* SMC2 channel */ +#define M8260_CPCR_SBC_RAND 0x0e /* RAND channel */ +#define M8260_CPCR_SBC_SPI 0x0a /* SPI */ +#define M8260_CPCR_SBC_I2C 0x0b /* I2C */ +#define M8260_CPCR_SBC_TIMER 0x0f /* TIMER */ +#define M8260_CPCR_SBC_MCC1 0x1c /* MCC1 channel */ +#define M8260_CPCR_SBC_MCC2 0x1d /* MCC2 channel */ +#define M8260_CPCR_SBC_IDMA1 0x14 /* IDMA1 channel */ +#define M8260_CPCR_SBC_IDMA2 0x15 /* IDMA2 channel */ +#define M8260_CPCR_SBC_IDMA3 0x16 /* IDMA3 channel */ +#define M8260_CPCR_SBC_IDMA4 0x17 /* IDMA4 channel */ + +/* CPCR - Page code */ + +#define M8260_CPCR_PAGE_FCC1 0x04 /* FCC1 channel */ +#define M8260_CPCR_PAGE_FCC2 0x05 /* FCC2 channel */ +#define M8260_CPCR_PAGE_FCC3 0x06 /* FCC3 channel */ +#define M8260_CPCR_PAGE_SCC1 0x00 /* SCC1 channel */ +#define M8260_CPCR_PAGE_SCC2 0x01 /* SCC2 channel */ +#define M8260_CPCR_PAGE_SCC3 0x02 /* SCC3 channel */ +#define M8260_CPCR_PAGE_SCC4 0x03 /* SCC4 channel */ +#define M8260_CPCR_PAGE_SMC1 0x07 /* SMC1 channel */ +#define M8260_CPCR_PAGE_SMC2 0x08 /* SMC2 channel */ +#define M8260_CPCR_PAGE_RAND 0x0a /* RAND channel */ +#define M8260_CPCR_PAGE_SPI 0x09 /* SPI */ +#define M8260_CPCR_PAGE_I2C 0x0a /* I2C */ +#define M8260_CPCR_PAGE_TIMER 0x0a /* TIMER */ +#define M8260_CPCR_PAGE_MCC1 0x07 /* MCC1 channel */ +#define M8260_CPCR_PAGE_MCC2 0x08 /* MCC2 channel */ +#define M8260_CPCR_PAGE_IDMA1 0x07 /* IDMA1 channel */ +#define M8260_CPCR_PAGE_IDMA2 0x08 /* IDMA2 channel */ +#define M8260_CPCR_PAGE_IDMA3 0x09 /* IDMA3 channel */ +#define M8260_CPCR_PAGE_IDMA4 0x0a /* IDMA4 channel */ + +/* CPCR - opcodes */ + +#define M8260_CPCR_RT_INIT 0x0 /* Init rx and tx */ +#define M8260_CPCR_RX_INIT 0x1 /* init rx only */ +#define M8260_CPCR_TX_INIT 0x2 /* init tx only */ +#define M8260_CPCR_HUNT 0x3 /* rx frame hunt mode */ +#define M8260_CPCR_TX_STOP 0x4 /* stop tx */ +#define M8260_CPCR_TX_GRSTOP 0x5 /* gracefully stop tx */ +#define M8260_CPCR_TX_RESTART 0x6 /* restart tx */ +#define M8260_CPCR_RX_CLOSE 0x7 /* close rx buffer */ +#define M8260_CPCR_SET_GROUP 0x8 /* set group address */ +#define M8260_CPCR_SET_TMR 0x8 /* set timer */ +#define M8260_CPCR_GCI_TMO 0x9 /* gci timeout */ +#define M8260_CPCR_IDMA_START 0x9 /* start idma */ +#define M8260_CPCR_MCC_RX_STOP 0x9 /* stop rx on MCC */ +#define M8260_CPCR_ATM_TX 0xa /* ATM transmit */ +#define M8260_CPCR_BCS_RESET 0xa /* blk chk seq reset */ +#define M8260_CPCR_GCI_ABRT 0xa /* gci abort request */ +#define M8260_CPCR_IDMA_STOP 0xb /* stop idma */ +#define M8260_CPCR_RANDOM 0xc /* random number */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm8260Cph */ diff --git a/h/drv/sio/m8260CpmMux.h b/h/drv/sio/m8260CpmMux.h new file mode 100644 index 0000000..f6d3e6f --- /dev/null +++ b/h/drv/sio/m8260CpmMux.h @@ -0,0 +1,228 @@ +/* m8260Mux.h - Motorola MPC8260 CPM Multiplexor header file */ + +/* Copyright 1984-1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,12sep99,ms_ created from m8260Cpm.h, 01d. +*/ + +/* + * This file contains constants for the Communications Processor Module's + * Multiplexor (CMX) in the Motorola MPC8260 PowerQUICC II integrated + * Communications Processor + */ + +#ifndef __INCm8260CpmMuxh +#define __INCm8260CpmMuxh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef M8260ABBREVIATIONS +#define M8260ABBREVIATIONS + +#ifdef _ASMLANGUAGE +#define CAST(x) +#else /* _ASMLANGUAGE */ +typedef volatile UCHAR VCHAR; /* shorthand for volatile UCHAR */ +typedef volatile INT32 VINT32; /* volatile unsigned word */ +typedef volatile INT16 VINT16; /* volatile unsigned halfword */ +typedef volatile INT8 VINT8; /* volatile unsigned byte */ +typedef volatile UINT32 VUINT32; /* volatile unsigned word */ +typedef volatile UINT16 VUINT16; /* volatile unsigned halfword */ +typedef volatile UINT8 VUINT8; /* volatile unsigned byte */ +#define CAST(x) (x) +#endif /* _ASMLANGUAGE */ + +#endif /* M8260ABBREVIATIONS */ + +/* + * MPC8260 internal register/memory map (section 17 of prelim. spec) + * note that these are offsets from the value stored in the IMMR + * register. Also note that in the MPC8260, the IMMR is not a special + * purpose register, but it is memory mapped. + */ + +/* CPM mux FCC clock route register */ + +#define M8260_CMXFCR(base) (CAST(VUINT32 *)((base) + 0x11B04)) + +/* CPM mux SCC clock route register */ + +#define M8260_CMXSCR(base) (CAST(VUINT32 *)((base) + 0x11B08)) + +/* CMX FCC Clock Route Register bit definition (CMXFCR - 0x11B04) */ + +#define M8260_CMXFCR_GR1 0x80000000 /* Grant Support of FCC1 */ +#define M8260_CMXFCR_FC1_MUX 0x40000000 /* FCC1 Connection - mux SI */ +#define M8260_CMXFCR_R1CS_MSK 0x38000000 /* FCC1 Receive Clock Source */ +#define M8260_CMXFCR_R1CS_BRG5 0x00000000 /* BRG5 clock source */ +#define M8260_CMXFCR_R1CS_BRG6 0x08000000 /* BRG6 clock source */ +#define M8260_CMXFCR_R1CS_BRG7 0x10000000 /* BRG7 clock source */ +#define M8260_CMXFCR_R1CS_BRG8 0x18000000 /* BRG8 clock source */ +#define M8260_CMXFCR_R1CS_CLK9 0x20000000 /* CLK9 clock source */ +#define M8260_CMXFCR_R1CS_CLK10 0x28000000 /* CLK10 clock source */ +#define M8260_CMXFCR_R1CS_CLK11 0x30000000 /* CLK11 clock source */ +#define M8260_CMXFCR_R1CS_CLK12 0x38000000 /* CLK12 clock source */ +#define M8260_CMXFCR_T1CS_MSK 0x07000000 /* FCC1 Transmit Clock Source */ +#define M8260_CMXFCR_T1CS_BRG5 0x00000000 /* BRG5 clock source */ +#define M8260_CMXFCR_T1CS_BRG6 0x01000000 /* BRG6 clock source */ +#define M8260_CMXFCR_T1CS_BRG7 0x02000000 /* BRG7 clock source */ +#define M8260_CMXFCR_T1CS_BRG8 0x03000000 /* BRG8 clock source */ +#define M8260_CMXFCR_T1CS_CLK9 0x04000000 /* CLK9 clock source */ +#define M8260_CMXFCR_T1CS_CLK10 0x05000000 /* CLK10 clock source */ +#define M8260_CMXFCR_T1CS_CLK11 0x06000000 /* CLK11 clock source */ +#define M8260_CMXFCR_T1CS_CLK12 0x07000000 /* CLK12 clock source */ + +#define M8260_CMXFCR_GR2 0x00800000 /* Grant Support of FCC2 */ +#define M8260_CMXFCR_FC2_MUX 0x00400000 /* FCC2 Connection - mux SI */ +#define M8260_CMXFCR_R2CS_MSK 0x00380000 /* FCC2 Receive Clock Source */ +#define M8260_CMXFCR_R2CS_BRG5 0x00000000 /* BRG5 clock source */ +#define M8260_CMXFCR_R2CS_BRG6 0x00080000 /* BRG6 clock source */ +#define M8260_CMXFCR_R2CS_BRG7 0x00100000 /* BRG7 clock source */ +#define M8260_CMXFCR_R2CS_BRG8 0x00180000 /* BRG8 clock source */ +#define M8260_CMXFCR_R2CS_CLK13 0x00200000 /* CLK13 clock source */ +#define M8260_CMXFCR_R2CS_CLK14 0x00280000 /* CLK14 clock source */ +#define M8260_CMXFCR_R2CS_CLK15 0x00300000 /* CLK15 clock source */ +#define M8260_CMXFCR_R2CS_CLK16 0x00380000 /* CLK16 clock source */ +#define M8260_CMXFCR_T2CS_MSK 0x00070000 /* FCC2 Transmit Clock Source */ +#define M8260_CMXFCR_T2CS_BRG5 0x00000000 /* BRG5 clock source */ +#define M8260_CMXFCR_T2CS_BRG6 0x00010000 /* BRG6 clock source */ +#define M8260_CMXFCR_T2CS_BRG7 0x00020000 /* BRG7 clock source */ +#define M8260_CMXFCR_T2CS_BRG8 0x00030000 /* BRG8 clock source */ +#define M8260_CMXFCR_T2CS_CLK13 0x00040000 /* CLK13 clock source */ +#define M8260_CMXFCR_T2CS_CLK14 0x00050000 /* CLK14 clock source */ +#define M8260_CMXFCR_T2CS_CLK15 0x00060000 /* CLK15 clock source */ +#define M8260_CMXFCR_T2CS_CLK16 0x00070000 /* CLK16 clock source */ + +#define M8260_CMXFCR_GR3 0x00008000 /* Grant Support of FCC3 */ +#define M8260_CMXFCR_FC3_MUX 0x00004000 /* FCC3 Connection - mux SI */ +#define M8260_CMXFCR_R3CS_MSK 0x00003800 /* FCC3 Receive Clock Source */ +#define M8260_CMXFCR_R3CS_BRG5 0x00000000 /* BRG5 clock source */ +#define M8260_CMXFCR_R3CS_BRG6 0x00000800 /* BRG6 clock source */ +#define M8260_CMXFCR_R3CS_BRG7 0x00001000 /* BRG7 clock source */ +#define M8260_CMXFCR_R3CS_BRG8 0x00001800 /* BRG8 clock source */ +#define M8260_CMXFCR_R3CS_CLK13 0x00002000 /* CLK13 clock source */ +#define M8260_CMXFCR_R3CS_CLK14 0x00002800 /* CLK14 clock source */ +#define M8260_CMXFCR_R3CS_CLK15 0x00003000 /* CLK15 clock source */ +#define M8260_CMXFCR_R3CS_CLK16 0x00003800 /* CLK16 clock source */ +#define M8260_CMXFCR_T3CS_MSK 0x00000700 /* FCC3 Transmit Clock Source */ +#define M8260_CMXFCR_T3CS_BRG5 0x00000000 /* BRG5 clock source */ +#define M8260_CMXFCR_T3CS_BRG6 0x00000100 /* BRG6 clock source */ +#define M8260_CMXFCR_T3CS_BRG7 0x00000200 /* BRG7 clock source */ +#define M8260_CMXFCR_T3CS_BRG8 0x00000300 /* BRG8 clock source */ +#define M8260_CMXFCR_T3CS_CLK13 0x00000400 /* CLK13 clock source */ +#define M8260_CMXFCR_T3CS_CLK14 0x00000500 /* CLK14 clock source */ +#define M8260_CMXFCR_T3CS_CLK15 0x00000600 /* CLK15 clock source */ +#define M8260_CMXFCR_T3CS_CLK16 0x00000700 /* CLK16 clock source */ + +/* CMX SCC Clock Route Register bit definition (CMXSCR - 0x11B08) */ + +#define M8260_CMXSCR_GR1 0x80000000 /* Grant Support of SCC1 */ +#define M8260_CMXSCR_SC1_MUX 0x40000000 /* SCC1 Connection - mux SI */ +#define M8260_CMXSCR_R1CS_MSK 0x38000000 /* SCC1 Receive Clock Source */ +#define M8260_CMXSCR_R1CS_BRG1 0x00000000 /* BRG1 clock source */ +#define M8260_CMXSCR_R1CS_BRG2 0x08000000 /* BRG2 clock source */ +#define M8260_CMXSCR_R1CS_BRG3 0x10000000 /* BRG3 clock source */ +#define M8260_CMXSCR_R1CS_BRG4 0x18000000 /* BRG4 clock source */ +#define M8260_CMXSCR_R1CS_CLK11 0x20000000 /* CLK11 clock source */ +#define M8260_CMXSCR_R1CS_CLK12 0x28000000 /* CLK12 clock source */ +#define M8260_CMXSCR_R1CS_CLK3 0x30000000 /* CLK3 clock source */ +#define M8260_CMXSCR_R1CS_CLK4 0x38000000 /* CLK4 clock source */ +#define M8260_CMXSCR_T1CS_MSK 0x07000000 /* SCC1 Transmit Clock Source */ +#define M8260_CMXSCR_T1CS_BRG1 0x00000000 /* BRG1 clock source */ +#define M8260_CMXSCR_T1CS_BRG2 0x01000000 /* BRG2 clock source */ +#define M8260_CMXSCR_T1CS_BRG3 0x02000000 /* BRG3 clock source */ +#define M8260_CMXSCR_T1CS_BRG4 0x03000000 /* BRG4 clock source */ +#define M8260_CMXSCR_T1CS_CLK11 0x04000000 /* CLK11 clock source */ +#define M8260_CMXSCR_T1CS_CLK12 0x05000000 /* CLK12 clock source */ +#define M8260_CMXSCR_T1CS_CLK3 0x06000000 /* CLK3 clock source */ +#define M8260_CMXSCR_T1CS_CLK4 0x07000000 /* CLK4 clock source */ + +#define M8260_CMXSCR_GR2 0x00800000 /* Grant Support of SCC2 */ +#define M8260_CMXSCR_SC2_MUX 0x00400000 /* SCC2 Connection - mux SI */ +#define M8260_CMXSCR_R2CS_MSK 0x00380000 /* SCC2 Receive Clock Source */ +#define M8260_CMXSCR_R2CS_BRG1 0x00000000 /* BRG1 clock source */ +#define M8260_CMXSCR_R2CS_BRG2 0x00080000 /* BRG2 clock source */ +#define M8260_CMXSCR_R2CS_BRG3 0x00100000 /* BRG3 clock source */ +#define M8260_CMXSCR_R2CS_BRG4 0x00180000 /* BRG4 clock source */ +#define M8260_CMXSCR_R2CS_CLK11 0x00200000 /* CLK11 clock source */ +#define M8260_CMXSCR_R2CS_CLK12 0x00280000 /* CLK12 clock source */ +#define M8260_CMXSCR_R2CS_CLK3 0x00300000 /* CLK3 clock source */ +#define M8260_CMXSCR_R2CS_CLK4 0x00380000 /* CLK4 clock source */ +#define M8260_CMXSCR_T2CS_MSK 0x00070000 /* SCC2 Transmit Clock Source */ +#define M8260_CMXSCR_T2CS_BRG1 0x00000000 /* BRG1 clock source */ +#define M8260_CMXSCR_T2CS_BRG2 0x00010000 /* BRG2 clock source */ +#define M8260_CMXSCR_T2CS_BRG3 0x00020000 /* BRG3 clock source */ +#define M8260_CMXSCR_T2CS_BRG4 0x00030000 /* BRG4 clock source */ +#define M8260_CMXSCR_T2CS_CLK11 0x00040000 /* CLK11 clock source */ +#define M8260_CMXSCR_T2CS_CLK12 0x00050000 /* CLK12 clock source */ +#define M8260_CMXSCR_T2CS_CLK3 0x00060000 /* CLK3 clock source */ +#define M8260_CMXSCR_T2CS_CLK4 0x00070000 /* CLK4 clock source */ + +#define M8260_CMXSCR_GR3 0x00008000 /* Grant Support of SCC3 */ +#define M8260_CMXSCR_SC3_MUX 0x00004000 /* SCC3 Connection - mux SI */ +#define M8260_CMXSCR_R3CS_MSK 0x00003800 /* SCC3 Receive Clock Source */ +#define M8260_CMXSCR_R3CS_BRG1 0x00000000 /* BRG1 clock source */ +#define M8260_CMXSCR_R3CS_BRG2 0x00000800 /* BRG2 clock source */ +#define M8260_CMXSCR_R3CS_BRG3 0x00001000 /* BRG3 clock source */ +#define M8260_CMXSCR_R3CS_BRG4 0x00001800 /* BRG4 clock source */ +#define M8260_CMXSCR_R3CS_CLK5 0x00002000 /* CLK5 clock source */ +#define M8260_CMXSCR_R3CS_CLK6 0x00002800 /* CLK6 clock source */ +#define M8260_CMXSCR_R3CS_CLK7 0x00003000 /* CLK7 clock source */ +#define M8260_CMXSCR_R3CS_CLK8 0x00003800 /* CLK8 clock source */ +#define M8260_CMXSCR_T3CS_MSK 0x00000700 /* SCC3 Transmit Clock Source */ +#define M8260_CMXSCR_T3CS_BRG1 0x00000000 /* BRG1 clock source */ +#define M8260_CMXSCR_T3CS_BRG2 0x00000100 /* BRG2 clock source */ +#define M8260_CMXSCR_T3CS_BRG3 0x00000200 /* BRG3 clock source */ +#define M8260_CMXSCR_T3CS_BRG4 0x00000300 /* BRG4 clock source */ +#define M8260_CMXSCR_T3CS_CLK5 0x00000400 /* CLK5 clock source */ +#define M8260_CMXSCR_T3CS_CLK6 0x00000500 /* CLK6 clock source */ +#define M8260_CMXSCR_T3CS_CLK7 0x00000600 /* CLK7 clock source */ +#define M8260_CMXSCR_T3CS_CLK8 0x00000700 /* CLK8 clock source */ + +#define M8260_CMXSCR_GR4 0x00000080 /* Grant Support of SCC4 */ +#define M8260_CMXSCR_SC4_MUX 0x00000040 /* SCC4 Connection - mux SI */ +#define M8260_CMXSCR_R4CS_MSK 0x00000038 /* SCC4 Receive Clock Source */ +#define M8260_CMXSCR_R4CS_BRG1 0x00000000 /* BRG1 clock source */ +#define M8260_CMXSCR_R4CS_BRG2 0x00000008 /* BRG2 clock source */ +#define M8260_CMXSCR_R4CS_BRG3 0x00000010 /* BRG3 clock source */ +#define M8260_CMXSCR_R4CS_BRG4 0x00000018 /* BRG4 clock source */ +#define M8260_CMXSCR_R4CS_CLK1 0x00000020 /* CLK1 clock source */ +#define M8260_CMXSCR_R4CS_CLK2 0x00000028 /* CLK2 clock source */ +#define M8260_CMXSCR_R4CS_CLK3 0x00000030 /* CLK3 clock source */ +#define M8260_CMXSCR_R4CS_CLK4 0x00000038 /* CLK4 clock source */ +#define M8260_CMXSCR_T4CS_MSK 0x00000007 /* SCC4 Transmit Clock Source */ +#define M8260_CMXSCR_T4CS_BRG1 0x00000000 /* BRG1 clock source */ +#define M8260_CMXSCR_T4CS_BRG2 0x00000001 /* BRG2 clock source */ +#define M8260_CMXSCR_T4CS_BRG3 0x00000002 /* BRG3 clock source */ +#define M8260_CMXSCR_T4CS_BRG4 0x00000003 /* BRG4 clock source */ +#define M8260_CMXSCR_T4CS_CLK1 0x00000004 /* CLK1 clock source */ +#define M8260_CMXSCR_T4CS_CLK2 0x00000005 /* CLK2 clock source */ +#define M8260_CMXSCR_T4CS_CLK3 0x00000006 /* CLK3 clock source */ +#define M8260_CMXSCR_T4CS_CLK4 0x00000007 /* CLK4 clock source */ + +/* CMX SMC Clock Route Register bit definition (CMXSMR - 0x11B0C) */ + +#define M8260_CMXSMR_SMC1_MUX 0x80000000 /* SMC1 Connection mux*/ +#define M8260_CMXSMR_SMC1CS_MSK 0x30000000 /* SMC1 Clock Source */ +#define M8260_CMXSMR_SMC1CS_BRG1 0x00000000 /* BRG1 clock source */ +#define M8260_CMXSMR_SMC1CS_BRG7 0x10000000 /* BRG7 clock source */ +#define M8260_CMXSMR_SMC1CS_CLK7 0x20000000 /* CLK7 clock source */ +#define M8260_CMXSMR_SMC1CS_CLK9 0x30000000 /* CLK9 clock source */ + +#define M8260_CMXSMR_SMC2_MUX 0x08000000 /* SMC2 Connection mux*/ +#define M8260_CMXSMR_SMC2CS_MSK 0x03000000 /* SMC2 Clock Source */ +#define M8260_CMXSMR_SMC2CS_BRG2 0x00000000 /* BRG2 clock source */ +#define M8260_CMXSMR_SMC2CS_BRG8 0x01000000 /* BRG8 clock source */ +#define M8260_CMXSMR_SMC2CS_CLK19 0x02000000 /* CLK19 clock source */ +#define M8260_CMXSMR_SMC2CS_CLK20 0x03000000 /* CLK20 clock source */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm8260CpmMuxh */ diff --git a/h/drv/sio/m8260Scc.h b/h/drv/sio/m8260Scc.h new file mode 100644 index 0000000..6a86569 --- /dev/null +++ b/h/drv/sio/m8260Scc.h @@ -0,0 +1,271 @@ +/* m8260Scc.h - Motorola MPC8260 Serial Communications Controller header file */ + +/* Copyright 1984-1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,12sep99,ms_ created from m8260Cpm.h, 01d. +*/ + +/* + * This file contains constants for the Serial Communications Controllers + * (SCCs) in the Motorola MPC8260 PowerQUICC II integrated Communications + * Processor + */ + +#ifndef __INCm8260Scch +#define __INCm8260Scch + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef M8260ABBREVIATIONS +#define M8260ABBREVIATIONS + +#ifdef _ASMLANGUAGE +#define CAST(x) +#else /* _ASMLANGUAGE */ +typedef volatile UCHAR VCHAR; /* shorthand for volatile UCHAR */ +typedef volatile INT32 VINT32; /* volatile unsigned word */ +typedef volatile INT16 VINT16; /* volatile unsigned halfword */ +typedef volatile INT8 VINT8; /* volatile unsigned byte */ +typedef volatile UINT32 VUINT32; /* volatile unsigned word */ +typedef volatile UINT16 VUINT16; /* volatile unsigned halfword */ +typedef volatile UINT8 VUINT8; /* volatile unsigned byte */ +#define CAST(x) (x) +#endif /* _ASMLANGUAGE */ + +#endif /* M8260ABBREVIATIONS */ + +/* + * MPC8260 internal register/memory map (section 17 of prelim. spec) + * note that these are offsets from the value stored in the IMMR + * register. Also note that in the MPC8260, the IMMR is not a special + * purpose register, but it is memory mapped. + */ + + +/* SCC Parameter Ram */ + +#define M8260_SCC_PRAM_BASE 0x00008000 +#define M8260_SCC_PRAM_OFFSET_NEXT_PRAM 0x00000100 + +#define M8260_SCC_PRAM_RBASE 0x00000000 +#define M8260_SCC_PRAM_TBASE 0x00000002 +#define M8260_SCC_PRAM_RFCR 0x00000004 +#define M8260_SCC_PRAM_TFCR 0x00000005 +#define M8260_SCC_PRAM_MRBLR 0x00000006 + +#define M8260_SCC_UART_PRAM_PAREC 0x0000003E +#define M8260_SCC_UART_PRAM_FRMEC 0x00000040 +#define M8260_SCC_UART_PRAM_NOSEC 0x00000042 +#define M8260_SCC_UART_PRAM_BRKEC 0x00000044 + + +/* SCC - Serial Communication Controller */ + +#define M8260_SCC_BASE 0x00011A00 +#define M8260_SCC_OFFSET_NEXT_SCC 0x00000020 + +#define M8260_GSMR_L_OFFSET 0x00000000 +#define M8260_GSMR_H_OFFSET 0x00000004 +#define M8260_PSMR_OFFSET 0x00000008 +#define M8260_TODR_OFFSET 0x0000000C +#define M8260_DSR_OFFSET 0x0000000E +#define M8260_SCCE_OFFSET 0x00000010 +#define M8260_SCCM_OFFSET 0x00000014 +#define M8260_SCCS_OFFSET 0x00000017 + + +/* General SCC Mode Register definitions */ + +#define M8260_SCC_GSMRL_HDLC 0x00000000 /* HDLC mode */ + +/* AppleTalk mode (LocalTalk) */ + +#define M8260_SCC_GSMRL_APPLETALK 0x00000002 + +/* SS7 mode (microcode) */ + +#define M8260_SCC_GSMRL_SS7 0x00000003 +#define M8260_SCC_GSMRL_UART 0x00000004 /* UART mode */ + +/* Profi-Bus mode (microcode) */ + +#define M8260_SCC_GSMRL_PROFI_BUS 0x00000005 + +/* async HDLC mode (microcode)*/ + +#define M8260_SCC_GSMRL_ASYNC_HDLC 0x00000006 +#define M8260_SCC_GSMRL_V14 0x00000007 /* V.14 mode */ +#define M8260_SCC_GSMRL_BISYNC 0x00000008 /* BISYNC mode */ + +/* DDCMP mode (microcode) */ + +#define M8260_SCC_GSMRL_DDCMP 0x00000009 + +/* enable bits for transmit and receive */ + +#define M8260_SCC_GSMRL_ENT 0x00000010 /* enable transmitter */ +#define M8260_SCC_GSMRL_ENR 0x00000020 /* enable receiver */ + +/* local loopback mode */ + +#define M8260_SCC_GSMRL_LOOPBACK 0x00000040 + +/* automatic echo mode */ + +#define M8260_SCC_GSMRL_ECHO 0x00000080 + +/* transmitter encoding method*/ + +#define M8260_SCC_GSMRL_TENC 0x00000700 + +/* receiver encoding method */ + +#define M8260_SCC_GSMRL_RENC 0x00003800 + +/* receive DPLL clock x8 */ + +#define M8260_SCC_GSMRL_RDCR_X8 0x00004000 + +/* receive DPLL clock x16 */ + +#define M8260_SCC_GSMRL_RDCR_X16 0x00008000 + +/* receive DPLL clock x32 */ + +#define M8260_SCC_GSMRL_RDCR_X32 0x0000c000 + +/* transmit DPLL clock x8 */ + +#define M8260_SCC_GSMRL_TDCR_X8 0x00010000 + +/* transmit DPLL clock x16 */ + +#define M8260_SCC_GSMRL_TDCR_X16 0x00020000 + +/* transmit DPLL clock x32 */ + +#define M8260_SCC_GSMRL_TDCR_X32 0x00030000 + + +#define M8260_SCC_GSMRL_TEND 0x00040000 /* transmitter frame ending */ +#define M8260_SCC_GSMRL_TPP_00 0x00180000 /* Tx preamble pattern = 00 */ +#define M8260_SCC_GSMRL_TPP_10 0x00080000 /* Tx preamble pattern = 10 */ +#define M8260_SCC_GSMRL_TPP_01 0x00100000 /* Tx preamble pattern = 01 */ +#define M8260_SCC_GSMRL_TPP_11 0x00180000 /* Tx preamble pattern = 11 */ + +/* no Tx preamble (default) */ + +#define M8260_SCC_GSMRL_TPL_NONE 0x00000000 + +/* Tx preamble = 1 byte */ + +#define M8260_SCC_GSMRL_TPL_8 0x00200000 +#define M8260_SCC_GSMRL_TPL_16 0x00400000 /* Tx preamble = 2 bytes */ +#define M8260_SCC_GSMRL_TPL_32 0x00600000 /* Tx preamble = 4 bytes */ +#define M8260_SCC_GSMRL_TPL_48 0x00800000 /* Tx preamble = 6 bytes */ +#define M8260_SCC_GSMRL_TPL_64 0x00a00000 /* Tx preamble = 8 bytes */ +#define M8260_SCC_GSMRL_TPL_128 0x00c00000 /* Tx preamble = 16 bytes */ +#define M8260_SCC_GSMRL_TINV 0x01000000 /* DPLL transmit input invert */ +#define M8260_SCC_GSMRL_RINV 0x02000000 /* DPLL receive input invert */ +#define M8260_SCC_GSMRL_TSNC 0x0c000000 /* transmit sense */ +#define M8260_SCC_GSMRL_TCI 0x10000000 /* transmit clock invert */ +#define M8260_SCC_GSMRL_EDGE 0x60000000 /* adjustment edge +/- */ + +#define M8260_SCC_GSMRH_RSYN 0x00000001 /* receive sync timing*/ +#define M8260_SCC_GSMRH_RTSM 0x00000002 /* RTS* mode */ +#define M8260_SCC_GSMRH_SYNL 0x0000000c /* sync length */ +#define M8260_SCC_GSMRH_TXSY 0x00000010 /* transmitter/receiver sync */ +#define M8260_SCC_GSMRH_RFW 0x00000020 /* Rx FIFO width */ +#define M8260_SCC_GSMRH_TFL 0x00000040 /* transmit FIFO length */ +#define M8260_SCC_GSMRH_CTSS 0x00000080 /* CTS* sampling */ +#define M8260_SCC_GSMRH_CDS 0x00000100 /* CD* sampling */ +#define M8260_SCC_GSMRH_CTSP 0x00000200 /* CTS* pulse */ +#define M8260_SCC_GSMRH_CDP 0x00000400 /* CD* pulse */ +#define M8260_SCC_GSMRH_TTX 0x00000800 /* transparent transmitter */ +#define M8260_SCC_GSMRH_TRX 0x00001000 /* transparent receiver */ +#define M8260_SCC_GSMRH_REVD 0x00002000 /* reverse data */ +#define M8260_SCC_GSMRH_TCRC 0x0000c000 /* transparent CRC */ +#define M8260_SCC_GSMRH_GDE 0x00010000 /* glitch detect enable */ + +/* SCC UART Protocol Specific Mode Register definitions */ + +#define M8260_SCC_UART_PSMR_TPM_ODD 0x0000 /* odd parity mode (Tx) */ +#define M8260_SCC_UART_PSMR_TPM_LOW 0x0001 /* low parity mode (Tx) */ +#define M8260_SCC_UART_PSMR_TPM_EVEN 0x0002 /* even parity mode (Tx) */ +#define M8260_SCC_UART_PSMR_TPM_HIGH 0x0003 /* high parity mode (Tx) */ +#define M8260_SCC_UART_PSMR_RPM_ODD 0x0000 /* odd parity mode (Rx) */ +#define M8260_SCC_UART_PSMR_RPM_LOW 0x0004 /* low parity mode (Rx) */ +#define M8260_SCC_UART_PSMR_RPM_EVEN 0x0008 /* even parity mode (Rx) */ +#define M8260_SCC_UART_PSMR_RPM_HIGH 0x000c /* high parity mode (Rx) */ +#define M8260_SCC_UART_PSMR_PEN 0x0010 /* parity enable */ +#define M8260_SCC_UART_PSMR_DRT 0x0040 /* disable Rx while Tx */ +#define M8260_SCC_UART_PSMR_SYN 0x0080 /* synchronous mode */ +#define M8260_SCC_UART_PSMR_RZS 0x0100 /* receive zero stop bits */ +#define M8260_SCC_UART_PSMR_FRZ 0x0200 /* freeze transmission */ +#define M8260_SCC_UART_PSMR_UM_NML 0x0000 /* noraml UART operation */ +#define M8260_SCC_UART_PSMR_UM_MULT_M 0x0400 /* multidrop non-auto mode */ +#define M8260_SCC_UART_PSMR_UM_MULT_A 0x0c00 /* multidrop automatic mode */ +#define M8260_SCC_UART_PSMR_CL_5BIT 0x0000 /* 5 bit character length */ +#define M8260_SCC_UART_PSMR_CL_6BIT 0x1000 /* 6 bit character length */ +#define M8260_SCC_UART_PSMR_CL_7BIT 0x2000 /* 7 bit character length */ +#define M8260_SCC_UART_PSMR_CL_8BIT 0x3000 /* 8 bit character length */ +#define M8260_SCC_UART_PSMR_SL 0x4000 /* 1 or 2 bit stop length */ +#define M8260_SCC_UART_PSMR_FLC 0x8000 /* flow control */ + +/* SCC UART Event and Mask Register definitions */ + +#define M8260_SCC_UART_SCCX_RX 0x0001 /* buffer received */ +#define M8260_SCC_UART_SCCX_TX 0x0002 /* buffer transmitted */ +#define M8260_SCC_UART_SCCX_BSY 0x0004 /* busy condition */ +#define M8260_SCC_UART_SCCX_CCR 0x0008 /* control character received */ +#define M8260_SCC_UART_SCCX_BRK_S 0x0020 /* break start */ +#define M8260_SCC_UART_SCCX_BRK_E 0x0040 /* break end */ +#define M8260_SCC_UART_SCCX_GRA 0x0080 /* graceful stop complete */ +#define M8260_SCC_UART_SCCX_IDL 0x0100 /* idle sequence stat changed */ +#define M8260_SCC_UART_SCCX_AB 0x0200 /* autobaud lock */ +#define M8260_SCC_UART_SCCX_GL_T 0x0800 /* glitch on Tx */ +#define M8260_SCC_UART_SCCX_GL_R 0x1000 /* glitch on Rx */ +#define M8260_SCC_UART_SCCX_ALL_EVENTS 0xFFFF /* all events */ + +/* SCC UART Receive Buffer Descriptor definitions */ + +#define M8260_SCC_UART_RX_BD_CD 0x0001 /* carrier detect loss */ +#define M8260_SCC_UART_RX_BD_OV 0x0002 /* receiver overrun */ +#define M8260_SCC_UART_RX_BD_PR 0x0008 /* parity error */ +#define M8260_SCC_UART_RX_BD_FR 0x0010 /* framing error */ +#define M8260_SCC_UART_RX_BD_BR 0x0020 /* break received */ +#define M8260_SCC_UART_RX_BD_AM 0x0080 /* address match */ +#define M8260_SCC_UART_RX_BD_ID 0x0100 /* buf closed on IDLES */ +#define M8260_SCC_UART_RX_BD_CM 0x0200 /* continous mode */ +#define M8260_SCC_UART_RX_BD_ADDR 0x0400 /* buffer contains address */ +#define M8260_SCC_UART_RX_BD_CNT 0x0800 /* control character */ +#define M8260_SCC_UART_RX_BD_INT 0x1000 /* interrupt generated */ +#define M8260_SCC_UART_RX_BD_WRAP 0x2000 /* wrap back to first BD */ +#define M8260_SCC_UART_RX_BD_EMPTY 0x8000 /* buffer is empty */ + +/* SCC UART Transmit Buffer Descriptor definitions */ + +#define M8260_SCC_UART_TX_BD_CT 0x0001 /* cts was lost during tx */ +#define M8260_SCC_UART_TX_BD_NS 0x0080 /* no stop bit transmitted */ +#define M8260_SCC_UART_TX_BD_PREAMBLE 0x0100 /* enable preamble */ +#define M8260_SCC_UART_TX_BD_CM 0x0200 /* continous mode */ +#define M8260_SCC_UART_TX_BD_ADDR 0x0400 /* buffer contains address */ +#define M8260_SCC_UART_TX_BD_CTSR 0x0800 /* normal cts error reporting */ +#define M8260_SCC_UART_TX_BD_INT 0x1000 /* interrupt generated */ +#define M8260_SCC_UART_TX_BD_WRAP 0x2000 /* wrap back to first BD */ +#define M8260_SCC_UART_TX_BD_READY 0x8000 /* buffer is being sent */ + +/* Miscellaneous SCC UART definitions */ + +#define M8260_SCC_POLL_OUT_DELAY 10000 /* polled mode delay */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm8260Scch */ diff --git a/h/drv/sio/m8260Sio.h b/h/drv/sio/m8260Sio.h new file mode 100644 index 0000000..841090b --- /dev/null +++ b/h/drv/sio/m8260Sio.h @@ -0,0 +1,116 @@ +/* m8260Sio.h - Motorola MPC8260 SIO header file */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,05jun02,pmr SPR 78051: fixed typo +01d,09may02,gjc Fixing SPR #75922. +01c,12sep99,ms_ move I/O Port definitions to m8260IOPort.h +01b,15jul99,ms_ fix to meet coding standards +01a,08mar99,ms_ adapted from h/drv/multi/ppc860Cpm.h +*/ + +/* + * This file contains constants for an SIO using the Serial + * Communications Controller (SCC) of the Communications Processor + * Module (CPM) of the Motorola MPC8260 PowerPC microcontroller. + */ + +#ifndef __INCm8260Sioh +#define __INCm8260Sioh +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "sioLib.h" + +/* defines */ + +#define DEFAULT_BAUD 9600 + +#ifndef SCC_BUF +#define SCC_BUF VINT8 /* byte so that offset works */ +#endif + +typedef struct + { + + /* must be first */ + + SIO_DRV_FUNCS *pDrvFuncs; /* driver functions */ + + /* callbacks */ + + STATUS (* getTxChar) (); /* pointer to xmit function */ + STATUS (* putRcvChar) (); /* pointer to recv function */ + void * getTxArg; + void * putRcvArg; + + VINT16 channelMode; /* polled or interrupt driven */ + int baudRate; + int sccNum; /* SCC associated with this channel */ + + VINT32 immrVal; /* Internal Memory Map Register */ + char * pBdBase; /* Buffer Descriptor base */ + char * rcvBufferAddr; /* address of receive buffer */ + char * txBufferAddr; /* address of transmit buffer */ + + char ch; + + VINT16 * pRBASE; + VINT16 * pTBASE; + + } M8260_SCC_CHAN; + +#define M8260_SCC_BD_SIZE 8 /* size, in bytes, of a single BD */ + +#define M8260_SCC_RCV_BD_OFF 0 /* offset from BD base to receive BD */ +#define M8260_SCC_TX_BD_OFF M8260_SCC_BD_SIZE + +/* offset from BD base to transmit BD, since there is just one BD each */ + +#define M8260_SCC_BD_STAT_OFF 0 /* offset to status field */ +#define M8260_SCC_BD_LEN_OFF 2 /* offset to data length field */ +#define M8260_SCC_BD_ADDR_OFF 4 /* offset to address pointer field */ + +#define M8260_SCC_NEXT_SCC_OFF 0x20 /* offset between SCCs */ + +#define M8260_SCC_32_WR(addr, value) (* ((UINT32 *)(addr)) = ((UINT32) (value))) + +#define M8260_SCC_16_WR(addr, value) (* ((UINT16 *)(addr)) = ((UINT16) (value))) + +#define M8260_SCC_8_WR(addr, value) (* ((UINT8 *)(addr)) = ((UINT8) (value))) + +#define M8260_SCC_32_RD(addr, value) ((value) = (* (UINT32 *) ((UINT32 *)(addr)))) + +#define M8260_SCC_16_RD(addr, value) ((value) = (* (UINT16 *) ((UINT16 *)(addr)))) + +#define M8260_SCC_8_RD(addr, value) ((value) = (* (UINT8 *) ((UINT8 *)(addr)))) + + + +#if defined(__STDC__) + +IMPORT void m8260SioDevInit (M8260_SCC_CHAN *); +IMPORT void m8260SioInt (M8260_SCC_CHAN *); +IMPORT UINT32 vxImmrGet (void); + +#else /* __STDC__ */ + +IMPORT void m8260SioDevInit (); +IMPORT void m8260SioInt (); +IMPORT UINT32 vxImmrGet (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm8260Sioh */ diff --git a/h/drv/sio/mb86940Sio.h b/h/drv/sio/mb86940Sio.h new file mode 100644 index 0000000..6d986d5 --- /dev/null +++ b/h/drv/sio/mb86940Sio.h @@ -0,0 +1,75 @@ +/* mb86940.h - Fujitsu SPARClite companion chip */ + +/* Copyright 1984-1991 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01a,31jul95,myz written +*/ + +/* +This file contains SIO data structures for the Fujitsu mb86940 companion chip. +*/ + +#ifndef __INCmb86940Sioh +#define __INCmb86940Sioh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "arch/sparc/mb86940.h" +#include "sioLib.h" + + +typedef struct MB86940_CHAN + { + /* always goes first */ + + SIO_DRV_FUNCS * pDrvFuncs; /* driver functions */ + + /* callbacks */ + + STATUS (*getTxChar) (); + STATUS (*putRcvChar) (); + void * getTxArg; + void * putRcvArg; + + USHORT channelMode; + USHORT chan_num; + int baudRate; + + volatile int *cp; /* control port I/O address */ + volatile int *dp; /* data port I/O address */ + USHORT txIntLevel; + USHORT rxIntLevel; + USHORT txIntVec; + USHORT rxIntVec; + + UINT (*asiGeth) (void * ); + void (*asiSeth) (void * , UINT ); + STATUS (*baudSet) (int ); + STATUS (*intEnable)(int); + STATUS (*intDisable)(int); + } MB86940_CHAN; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) +extern void mb86940DevInit (MB86940_CHAN *); +extern void mb86940IntRx (MB86940_CHAN *); +extern void mb86940IntTx (MB86940_CHAN *); + +#else /* __STDC__ */ +extern void mb86940DevInit (); +extern void mb86940IntRx (); +extern void mb86940IntTx (); + +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmb86940h */ diff --git a/h/drv/sio/ns16552Sio.h b/h/drv/sio/ns16552Sio.h new file mode 100644 index 0000000..c88335c --- /dev/null +++ b/h/drv/sio/ns16552Sio.h @@ -0,0 +1,214 @@ +/* ns16552.h - National Semiconductor 16552 DUART header file */ + +/* Copyright 1984-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,07sep04,mdo Documentation fixes for apigen +01e,11may04,rec remove manual errors +01d,12apr00,dra Add include of sioLib.h +01c,08may97,db added elements options and mcr to NS16550_CHAN structure to + implement hardware options & modem control(SPRs #7570, #7082). +01b,01nov95,myz removed #if CPU=I960XX ... in NS16550_CHAN structure +01a,24oct95,myz written from ns16552.h. +*/ + +#ifndef __INCns16552Sioh +#define __INCns16552Sioh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + ********************************************************************* + * Copyright (c) 1990,1991 Intel Corporation + * + * Intel hereby grants you permission to copy, modify, and + * distribute this software and its documentation. Intel grants + * this permission provided that the above copyright notice + * appears in all copies and that both the copyright notice and + * this permission notice appear in supporting documentation. In + * addition, Intel grants this permission provided that you + * prominently mark as not part of the original any modifications + * made to this software or documentation, and that the name of + * Intel Corporation not be used in advertising or publicity + * pertaining to distribution of the software or the documentation + * without specific, written prior permission. + * + * Intel Corporation does not warrant, guarantee or make any + * representations regarding the use of, or the results of the use + * of, the software and documentation in terms of correctness, + * accuracy, reliability, currentness, or otherwise; and you rely + * on the software, documentation and results solely at your own risk. + * + *\NOMANUAL + ********************************************************************** +*/ + +/* + ****************************************************************************** + * + * REGISTER DESCRIPTION OF NATIONAL 16552 DUART + * + * $Id: ns16552.h,v 2.1 1993/06/07 15:07:59 wise active $ + * + *\NOMANUAL + ******************************************************************************* +*/ + +#ifndef _ASMLANGUAGE + +#include "sioLib.h" + +/* Register offsets from base address */ + +#define RBR 0x00 /* receiver buffer register */ +#define THR 0x00 /* transmit holding register */ +#define DLL 0x00 /* divisor latch */ +#define IER 0x01 /* interrupt enable register */ +#define DLM 0x01 /* divisor latch(MS) */ +#define IIR 0x02 /* interrupt identification register */ +#define FCR 0x02 /* FIFO control register */ +#define LCR 0x03 /* line control register */ +#define MCR 0x04 /* modem control register */ +#define LSR 0x05 /* line status register */ +#define MSR 0x06 /* modem status register */ +#define SCR 0x07 /* scratch register */ + +#define BAUD_LO(baud) ((XTAL/(16*baud)) & 0xff) +#define BAUD_HI(baud) (((XTAL/(16*baud)) & 0xff00) >> 8) + +/* Line Control Register */ + +#define CHAR_LEN_5 0x00 /* 5bits data size */ +#define CHAR_LEN_6 0x01 /* 6bits data size */ +#define CHAR_LEN_7 0x02 /* 7bits data size */ +#define CHAR_LEN_8 0x03 /* 8bits data size */ +#define LCR_STB 0x04 /* 2 stop bits */ +#define ONE_STOP 0x00 /* one stop bit */ +#define LCR_PEN 0x08 /* parity enable */ +#define PARITY_NONE 0x00 /* parity disable */ +#define LCR_EPS 0x10 /* even parity select */ +#define LCR_SP 0x20 /* stick parity select */ +#define LCR_SBRK 0x40 /* break control bit */ +#define LCR_DLAB 0x80 /* divisor latch access enable */ +#define DLAB LCR_DLAB + +/* Line Status Register */ + +#define LSR_DR 0x01 /* data ready */ +#define RxCHAR_AVAIL LSR_DR /* data ready */ +#define LSR_OE 0x02 /* overrun error */ +#define LSR_PE 0x04 /* parity error */ +#define LSR_FE 0x08 /* framing error */ +#define LSR_BI 0x10 /* break interrupt */ +#define LSR_THRE 0x20 /* transmit holding register empty */ +#define LSR_TEMT 0x40 /* transmitter empty */ +#define LSR_FERR 0x80 /* in fifo mode, set when PE,FE or BI error */ + +/* Interrupt Identification Register */ + +#define IIR_IP 0x01 +#define IIR_ID 0x0e +#define IIR_RLS 0x06 /* received line status */ +#define Rx_INT IIR_RLS /* received line status */ +#define IIR_RDA 0x04 /* received data available */ +#define RxFIFO_INT IIR_RDA /* received data available */ +#define IIR_THRE 0x02 /* transmit holding register empty */ +#define TxFIFO_INT IIR_THRE +#define IIR_MSTAT 0x00 /* modem status */ +#define IIR_TIMEOUT 0x0c /* char receive timeout */ + +/* Interrupt Enable Register */ + +#define IER_ERDAI 0x01 /* received data avail. & timeout int */ +#define RxFIFO_BIT IER_ERDAI +#define IER_ETHREI 0x02 /* transmitter holding register empty int */ +#define TxFIFO_BIT IER_ETHREI +#define IER_ELSI 0x04 /* receiver line status int enable */ +#define Rx_BIT IER_ELSI +#define IER_EMSI 0x08 /* modem status int enable */ + +/* Modem Control Register */ + +#define MCR_DTR 0x01 /* dtr output */ +#define DTR MCR_DTR +#define MCR_RTS 0x02 /* rts output */ +#define MCR_OUT1 0x04 /* output #1 */ +#define MCR_OUT2 0x08 /* output #2 */ +#define MCR_LOOP 0x10 /* loopback enable */ + +/* Modem Status Register */ + +#define MSR_DCTS 0x01 /* cts change */ +#define MSR_DDSR 0x02 /* dsr change */ +#define MSR_TERI 0x04 /* ring indicator change */ +#define MSR_DDCD 0x08 /* data carrier indicator change */ +#define MSR_CTS 0x10 /* complement of cts */ +#define MSR_DSR 0x20 /* complement of dsr */ +#define MSR_RI 0x40 /* complement of ring signal */ +#define MSR_DCD 0x80 /* complement of dcd */ + +/* FIFO Control Register */ + +#define FCR_EN 0x01 /* enable xmit and rcvr */ +#define FIFO_ENABLE FCR_EN +#define FCR_RXCLR 0x02 /* clears rcvr fifo */ +#define RxCLEAR FCR_RXCLR +#define FCR_TXCLR 0x04 /* clears xmit fifo */ +#define TxCLEAR FCR_TXCLR +#define FCR_DMA 0x08 /* dma */ +#define FCR_RXTRIG_L 0x40 /* rcvr fifo trigger lvl low */ +#define FCR_RXTRIG_H 0x80 /* rcvr fifo trigger lvl high */ + +typedef struct /* NS16550_CHAN * */ + { + /* always goes first */ + + SIO_DRV_FUNCS * pDrvFuncs; /* driver functions */ + + /* callbacks */ + + STATUS (*getTxChar) (); /* pointer to xmitr function */ + STATUS (*putRcvChar) (); /* pointer to rcvr function */ + void * getTxArg; + void * putRcvArg; + + UINT8 *regs; /* NS16552 registers */ + UINT8 level; /* 8259a interrupt level for this device */ + UINT8 ier; /* copy of ier */ + UINT8 lcr; /* copy of lcr, not used by ns16552 driver */ + UINT8 mcr; /* copy of modem control register */ + UINT8 pad1; + + UINT16 channelMode; /* such as INT, POLL modes */ + UINT16 regDelta; /* register address spacing */ + int baudRate; + UINT32 xtal; /* UART clock frequency */ + UINT32 options; /* hardware setup options */ + + } NS16550_CHAN; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void ns16550Int (NS16550_CHAN *); +extern void ns16550DevInit (NS16550_CHAN *); + +#else + +extern void ns16550Int (); +extern void ns16550DevInit (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCns16552Sioh */ diff --git a/h/drv/sio/nvr4101DSIUSio.h b/h/drv/sio/nvr4101DSIUSio.h new file mode 100644 index 0000000..59aeb9e --- /dev/null +++ b/h/drv/sio/nvr4101DSIUSio.h @@ -0,0 +1,70 @@ +/* nvr4101DSIUSio.h - header file for nvr4101 DSIU serial driver */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,26apr02,dat Adding cplusplus protection, SPR 75017 +01a,23jun97,sru written. +*/ + +#ifndef __INCnvr4101DSIUSioh +#define __INCnvr4101DSIUSioh + +#include "sioLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* definitions */ + +#define VR4101_DSIU_PARITY_ODD 2 +#define VR4101_DSIU_PARITY_EVEN 3 +#define VR4101_DSIU_PARITY_ZERO 1 + +/* device and channel structures */ + +typedef struct + { + /* must be first */ + + SIO_CHAN sio; /* standard SIO_CHAN element */ + + /* callbacks */ + + STATUS (*getTxChar) (); + STATUS (*putRcvChar) (); + void * getTxArg; + void * putRcvArg; + + /* configuration (set before calling DevInit) */ + int parityStyle; /* only the listed styles are allowed */ + int wordLength; /* only 7 and 8 are supported */ + + /* state */ + int channelMode; /* current mode (interrupt or poll) */ + int txActive; /* transmitter active state */ + int baudRate; /* for faster lookup */ + } NVR4101_DSIU_CHAN; + +/* function prototypes */ + +#if defined(__STDC__) + +extern void nvr4101DSIUDevInit (NVR4101_DSIU_CHAN *pChan); +extern void nvr4101DSIUInt (NVR4101_DSIU_CHAN *pChan); + +#else /* __STDC__ */ + +extern void nvr4101DSIUDevInit (); +extern void nvr4101DSIUInt (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnvr4101DSIUSioh */ diff --git a/h/drv/sio/nvr4101SIUSio.h b/h/drv/sio/nvr4101SIUSio.h new file mode 100644 index 0000000..7a9d58a --- /dev/null +++ b/h/drv/sio/nvr4101SIUSio.h @@ -0,0 +1,70 @@ +/* nvr4101SIUSio.h - header file for nvr4101 SIU serial driver */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,26apr02,dat Adding cplusplus protection, SPR 75017 +01a,11jun97,sru written. +*/ + +#ifndef __INCnvr4101SIUSioh +#define __INCnvr4101SIUSioh + +#include "sioLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* device and channel structures */ + +typedef struct + { + /* must be first */ + + SIO_CHAN sio; /* standard SIO_CHAN element */ + + /* callbacks */ + + STATUS (*getTxChar) (); + STATUS (*putRcvChar) (); + void * getTxArg; + void * putRcvArg; + + /* send and receive buffers */ + char * pTxBuf; /* transmit buffer */ + char * pRxBuf; /* receive buffer */ + UINT16 * pTxWord; /* last word of tx buffer */ + UINT16 * pRxWord; /* last word of rx buffer */ + + /* state */ + int channelMode; /* current mode (interrupt or poll) */ + int txActive; /* transmitter active state */ + int baudRate; /* for faster lookup */ + } NVR4101_SIU_CHAN; + +/* definitions */ + +#define DMA_PAGE_SIZE (2048) + +/* function prototypes */ + +#if defined(__STDC__) + +extern void nvr4101SIUDevInit (NVR4101_SIU_CHAN *pChan); +extern void nvr4101SIUInt (NVR4101_SIU_CHAN *pChan); + +#else /* __STDC__ */ + +extern void nvr4101SIUDevInit (); +extern void nvr4101SIUInt (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnvr4101SIUSioh */ diff --git a/h/drv/sio/nvr4102DSIUSio.h b/h/drv/sio/nvr4102DSIUSio.h new file mode 100644 index 0000000..d1f951d --- /dev/null +++ b/h/drv/sio/nvr4102DSIUSio.h @@ -0,0 +1,70 @@ +/* nvr4102DSIUSio.h - header file for nvr4102 DSIU serial driver */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,26apr02,dat Adding cplusplus protection, SPR 75017 +01a,19aug97,sru written. +*/ + +#ifndef __INCnvr4102DSIUSioh +#define __INCnvr4102DSIUSioh + +#include "sioLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* definitions */ + +#define VR4102_DSIU_PARITY_ODD 2 +#define VR4102_DSIU_PARITY_EVEN 3 +#define VR4102_DSIU_PARITY_ZERO 1 + +/* device and channel structures */ + +typedef struct + { + /* must be first */ + + SIO_CHAN sio; /* standard SIO_CHAN element */ + + /* callbacks */ + + STATUS (*getTxChar) (); + STATUS (*putRcvChar) (); + void * getTxArg; + void * putRcvArg; + + /* configuration (set before calling DevInit) */ + int parityStyle; /* only the listed styles are allowed */ + int wordLength; /* only 7 and 8 are supported */ + + /* state */ + int channelMode; /* current mode (interrupt or poll) */ + int txActive; /* transmitter active state */ + int baudRate; /* for faster lookup */ + } NVR4102_DSIU_CHAN; + +/* function prototypes */ + +#if defined(__STDC__) + +extern void nvr4102DSIUDevInit (NVR4102_DSIU_CHAN *pChan); +extern void nvr4102DSIUInt (NVR4102_DSIU_CHAN *pChan); + +#else /* __STDC__ */ + +extern void nvr4102DSIUDevInit (); +extern void nvr4102DSIUInt (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnvr4102DSIUSioh */ diff --git a/h/drv/sio/ppc403Sio.h b/h/drv/sio/ppc403Sio.h new file mode 100644 index 0000000..eaa73cc --- /dev/null +++ b/h/drv/sio/ppc403Sio.h @@ -0,0 +1,179 @@ +/* ppc403Sio.h - header file for PPC403GA SPU driver */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,13feb96,tam written (from i8250Sio.h) +*/ + +#ifndef __INCppc403Sioh +#define __INCppc403Sioh + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifndef _ASMLANGUAGE + +#include "vxWorks.h" +#include "sioLib.h" + +/* channel data structure */ + +typedef struct PPC403_CHAN + { + SIO_DRV_FUNCS * pDrvFuncs; /* driver functions */ + + STATUS (*getTxChar) (); + STATUS (*putRcvChar) (); + void * getTxArg; + void * putRcvArg; + + UINT16 int_vec; /* interrupt vector number */ + UCHAR (*inByte) (int); /* routine to read a byte from reg. */ + void (*outByte)(int,char); /* routine to write a byte to reg. */ + + int baudRate; /* baud rate */ + UINT32 clkFreq; /* baud rate generator clock */ + uint_t mode; /* SIO_MODE_[INT | POLL] */ + + volatile char *spctl; /* spu control register */ + volatile char *sphs; /* spu handshake status register */ + volatile char *spls; /* spu line status register */ + volatile char *sprb; /* spu receive buffer */ + volatile char *sprc; /* spu receiver command register */ + volatile char *sptb; /* spu transfer buffer */ + volatile char *sptc; /* spu transfer command register */ + } PPC403_CHAN; + +#define _TY_RX_VEC 4 +#define _TY_RX_INT_LVL 4 +#define _TY_TX_VEC 5 +#define _TY_TX_INT_LVL 5 + +#define DEFAULT_BAUD 9600 /* default uart baud rate */ + +/* register definitions */ + +/* memory mapped i/o registers */ + +#define _PPC403GA_SPLS 0x40000000 /* line status register read/clear */ +#define _PPC403GA_SPHS 0x40000002 /* handshake status register r/clear */ +#define _PPC403GA_BRDH 0x40000004 /* baudrate divisor high reg r/w */ +#define _PPC403GA_BRDL 0x40000005 /* baudrate divisor low reg r/w */ +#define _PPC403GA_SPCTL 0x40000006 /* control register r/w */ +#define _PPC403GA_SPRC 0x40000007 /* receiver command register r/w */ +#define _PPC403GA_SPTC 0x40000008 /* transmitter command register r/w */ +#define _PPC403GA_SPRB 0x40000009 /* receive buffer r */ +#define _PPC403GA_SPTB 0x40000009 /* transmit buffer w */ + +/* masks and definitions for serial port control register */ + +#define _SPCTL_LM_MASK 0xc0 /* loop back modes */ +#define _SPCTL_DTR_MASK 0x20 /* data terminal ready 0-inactive */ +#define _SPCTL_RTS_MASK 0x10 /* request to send 0-inactive */ +#define _SPCTL_DB_MASK 0x08 /* data bits mask */ +#define _SPCTL_PE_MASK 0x04 /* parity enable */ +#define _SPCTL_PTY_MASK 0x02 /* parity */ +#define _SPCTL_SB_MASK 0x01 /* stop bit mask */ + +#define _SPCTL_LM_NORM 0x00 /* normal operation */ +#define _SPCTL_LM_LOOP 0x40 /* internal loopback mode */ +#define _SPCTL_LM_ECHO 0x80 /* automatic echo mode */ +#define _SPCTL_LM_RES 0xc0 /* reserved */ + +#define _SPCTL_DTR_ACTIVE _SPCTL_DTR_MASK /* DTR is active */ +#define _SPCTL_RTS_ACTIVE _SPCTL_RTS_MASK /* RTS is active */ +#define _SPCTL_DB_8_BITS _SPCTL_DB_MASK /* 8 data bits */ +#define _SPCTL_DB_7_BITS 0x00 /* 7 data bits */ +#define _SPCTL_PE_ENABLE _SPCTL_PE_MASK /* parity enabled */ +#define _SPCTL_PTY_EVEN 0x00 /* even parity */ +#define _SPCTL_PTY_ODD _SPCTL_PTY_MASK /* odd parity */ +#define _SPCTL_SB_1_BIT 0x00 /* one stop bit */ +#define _SPCTL_SB_2_BIT _SPCTL_SB_MASK /* two stop bit */ + +/* serial port handshake register */ + +#define _SPHS_DIS_MASK 0x80 /* DSR input inactive error mask */ +#define _SPHS_CS_MASK 0x40 /* CTS input inactive error mask */ +#define _SPHS_DIS_ACT 0x00 /* dsr input is active */ +#define _SPHS_DIS_INACT _SPHS_DIS_MASK /* dsr input is inactive */ +#define _SPHS_CS_ACT 0x00 /* cts input is active */ +#define _SPHS_CS_INACT _SPHS_CS_MASK /* cts input is active */ + +/* serial port line status register */ + +#define _SPLS_RBR_MASK 0x80 /* receive buffer ready mask */ +#define _SPLS_FE_MASK 0x40 /* framing error */ +#define _SPLS_OE_MASK 0x20 /* overrun error */ +#define _SPLS_PE_MASK 0x10 /* parity error */ +#define _SPLS_LB_MASK 0x08 /* line break */ +#define _SPLS_TBR_MASK 0x04 /* transmit buffer ready */ +#define _SPLS_TSR_MASK 0x02 /* transmit shift register ready */ + +#define _SPLS_RBR_FULL _SPLS_RBR_MASK /* receive buffer is full */ +#define _SPLS_FE_ERROR _SPLS_FE_MASK /* framing error detected */ +#define _SPLS_OE_ERROR _SPLS_OE_MASK /* overrun error detected */ +#define _SPLS_PE_ERROR _SPLS_PE_MASK /* parity error detected */ +#define _SPLS_LB_BREAK _SPLS_LB_MASK /* line break detected */ +#define _SPLS_TBR_EMPTY _SPLS_TBR_MASK /* transmit buffer is ready */ +#define _SPLS_TSR_EMPTY _SPLS_TSR_MASK /* transmit shift register is empty */ + +#define _SPLS_RX_ERR (_SPLS_LB_BREAK | _SPLS_FE_MASK | _SPLS_OE_MASK | \ + _SPLS_PE_MASK) + +/* serial port reciever command register */ + +#define _SPRC_ER_MASK 0x80 /* enable receiver mask */ +#define _SPRC_DME_MASK 0x60 /* dma mode */ +#define _SPRC_EIE_MASK 0x10 /* error interrupt enable mask */ +#define _SPRC_PME_MASK 0x08 /* pause mode mask */ + +#define _SPRC_ER_ENABLE _SPRC_ER_MASK /* receiver enabled */ +#define _SPRC_DME_DISABLE 0x00 /* dma disabled */ +#define _SPRC_DME_RXRDY 0x20 /* dma disabled, RxRDY interrupt enabled*/ +#define _SPRC_DME_ENABLE2 0x40 /* dma enabled,receiver src channel 2 */ +#define _SPRC_DME_ENABLE3 0x60 /* dma enabled,receiver src channel 3 */ +#define _SPRC_PME_HARD _SPRC_PME_MASK /* RTS controlled by hardware */ +#define _SPRC_PME_SOFT 0x00 /* RTS controlled by software */ + +/* serial port transmit command register */ + +#define _SPTC_ET_MASK 0x80 /* transmiter enable mask */ +#define _SPTC_DME_MASK 0x60 /* dma mode mask */ +#define _SPTC_TIE_MASK 0x10 /* empty interrupt enable mask */ +#define _SPTC_EIE_MASK 0x08 /* error interrupt enable mask */ +#define _SPTC_SPE_MASK 0x04 /* stop/pause mask */ +#define _SPTC_TB_MASK 0x02 /* transmit break mask */ + +#define _SPTC_ET_ENABLE _SPTC_ET_MASK /* transmiter enabled */ +#define _SPTC_DME_DISABLE 0x00 /* transmiter disabled, TBR intr disabled */ +#define _SPTC_DME_TBR 0x20 /* transmiter disabled, TBR intr enabled*/ +#define _SPTC_DME_CHAN_2 0x40 /* dma enabled, destination chann 2 */ +#define _SPTC_DME_CHAN_3 0x60 /* dma enabled, destination chann 3 */ + + +#if defined(__STDC__) || defined(__cplusplus) + +extern void ppc403DevInit (PPC403_CHAN *pDev); +extern void ppc403IntRd (PPC403_CHAN *pDev); +extern void ppc403IntWr (PPC403_CHAN *pDev); + +#else + +extern void ppc403DevInit (); +extern void ppc403IntRd (); +extern void ppc403IntWr (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCppc403Sioh */ diff --git a/h/drv/sio/ppc555SciSio.h b/h/drv/sio/ppc555SciSio.h new file mode 100644 index 0000000..ab9fa62 --- /dev/null +++ b/h/drv/sio/ppc555SciSio.h @@ -0,0 +1,180 @@ +/* ppc555SciSio.h - header file for ppc555Sci serial driver */ + +/* Copyright 1984-1997 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,22mar99,zl written based on templateSio.h, m68332Sio.h and m68332.h +*/ + +#ifndef __INCppc555SciSioh +#define __INCppc555SciSioh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "sioLib.h" +#include "drv/multi/ppc555Siu.h" + +/* + * Additional hardware options to the ones in sioLib.h + */ + +#define QUEUED 0x100 + +/* + * QSM - Register definitions for the Queued Serial Module (QSM) + */ + +#define PPC555_QSM_MCR(base) ((VUINT16 *) (base + 0x305000)) +#define PPC555_QSM_TEST(base) ((VUINT16 *) (base + 0x305002)) +#define PPC555_QSM_DSCI_ILR(base) ((VUINT16 *) (base + 0x305004)) +#define PPC555_QSM_QSPI_ILR(base) ((VUINT16 *) (base + 0x305006)) +#define PPC555_QSM_SCI1_CR0(base) ((VUINT16 *) (base + 0x305008)) +#define PPC555_QSM_SCI1_CR1(base) ((VUINT16 *) (base + 0x30500a)) +#define PPC555_QSM_SCI1_SR(base) ((VUINT16 *) (base + 0x30500c)) +#define PPC555_QSM_SCI1_DR(base) ((VUINT16 *) (base + 0x30500e)) +#define PPC555_QSM_QPDR(base) ((VUINT16 *) (base + 0x305014)) +#define PPC555_QSM_QPAR(base) ((VUINT8 *) (base + 0x305016)) +#define PPC555_QSM_QDDR(base) ((VUINT8 *) (base + 0x305017)) +#define PPC555_QSM_SPCR0(base) ((VUINT16 *) (base + 0x305018)) +#define PPC555_QSM_SPCR1(base) ((VUINT16 *) (base + 0x30501a)) +#define PPC555_QSM_SPCR2(base) ((VUINT16 *) (base + 0x30501c)) +#define PPC555_QSM_SPCR3(base) ((VUINT8 *) (base + 0x30501e)) +#define PPC555_QSM_SPSR(base) ((VUINT8 *) (base + 0x30501f)) +#define PPC555_QSM_SCI2_CR0(base) ((VUINT16 *) (base + 0x305020)) +#define PPC555_QSM_SCI2_CR1(base) ((VUINT16 *) (base + 0x305022)) +#define PPC555_QSM_SCI2_SR(base) ((VUINT16 *) (base + 0x305024)) +#define PPC555_QSM_SCI2_DR(base) ((VUINT16 *) (base + 0x305026)) +#define PPC555_QSM_QSCI1_CR(base) ((VUINT16 *) (base + 0x305028)) +#define PPC555_QSM_QSCI1_SR(base) ((VUINT16 *) (base + 0x30502a)) +#define PPC555_QSM_QSCI1_SCTQ(base) ((VUINT16 *) (base + 0x30502c)) +#define PPC555_QSM_QSCI1_SCRQ(base) ((VUINT16 *) (base + 0x30504c)) + + +/* QSM_DSCI_ILR - DSCI Interrupt Level Register */ + +#define QSM_QILR_SCI_MSK 0x8f00 /* SCI interrupt level mask */ +#define QSM_QILR_SCI_SHIFT 8 /* SCI interrupt level shift */ + +/* QSM_SCCR0 - Control Register 0 */ + +#define QSM_SCCR0_OTHR 0x8000 /* Select baud rate source clk */ +#define QSM_SCCR0_LNKBD 0x4000 /* Link baud */ +#define QSM_SCCR0_SCBR_MSK 0x1FFF /* Baud rate mask */ + + +/* QSM_SCCR1 - Control Register 1 */ + +#define QSM_SCCR1_SBK 0x0001 /* send break */ +#define QSM_SCCR1_RWU 0x0002 /* receiver wakeup enable */ +#define QSM_SCCR1_RE 0x0004 /* receiver enable */ +#define QSM_SCCR1_TE 0x0008 /* transmitter enable */ +#define QSM_SCCR1_ILIE 0x0010 /* idle-line interrupt enable */ +#define QSM_SCCR1_RIE 0x0020 /* receiver interrupt enable */ +#define QSM_SCCR1_TCIE 0x0040 /* transmit complete interrupt enable */ +#define QSM_SCCR1_TIE 0x0080 /* transmit interrupt enable */ +#define QSM_SCCR1_WAKE 0x0100 /* wakeup by address mark */ +#define QSM_SCCR1_M 0x0200 /* mode select: 0= 8 data bits, 1 = 9 */ +#define QSM_SCCR1_PE 0x0400 /* parity enable */ +#define QSM_SCCR1_PT 0x0800 /* parity type: 1=Odd, 0=Even */ +#define QSM_SCCR1_ILT 0x1000 /* idle line detect type */ +#define QSM_SCCR1_WOMS 0x2000 /* wired or mode for SCI Pins */ +#define QSM_SCCR1_LOOPS 0x4000 /* test SCI operation */ + +/* QSM_SCSR - Status Register */ + +#define QSM_SCSR_PF 0x0001 /* parity error flag */ +#define QSM_SCSR_FE 0x0002 /* framing error flag */ +#define QSM_SCSR_NF 0x0004 /* noise error flag */ +#define QSM_SCSR_OR 0x0008 /* overrun error flag */ +#define QSM_SCSR_IDLE 0x0010 /* idle-line detected flag */ +#define QSM_SCSR_RAF 0x0020 /* receiver active flag */ +#define QSM_SCSR_RDRF 0x0040 /* receive data register full flag */ +#define QSM_SCSR_TC 0x0080 /* transmit complete */ +#define QSM_SCSR_TDRE 0x0100 /* transmit date register empty flag */ + +/* QSM_QSCCR - Queued SCI Control Register */ + +#define QSM_QSCCR_QTPNT_MSK 0xF000 /* Queue transmit pointer */ +#define QSM_QSCCR_QTHFI 0x0800 /* Rcv queue top-half full intr. */ +#define QSM_QSCCR_QBHFI 0x0400 /* Rcv queue bottom-half full intr. */ +#define QSM_QSCCR_QTHEI 0x0200 /* Xmt queue top-half empty intr. */ +#define QSM_QSCCR_QBHEI 0x0100 /* Xmt queue bottom-half empty intr. */ +#define QSM_QSCCR_QTE 0x0040 /* Queue transmit enable */ +#define QSM_QSCCR_QRE 0x0020 /* Queue receive enable */ +#define QSM_QSCCR_QTWE 0x0010 /* Queue transmit wrap enable */ +#define QSM_QSCCR_QTSZ_MSK 0x000F /* Queue transfer size */ + +/* QSM_SCSR - Queued SCI Status Register */ + +#define QSM_QSCSR_QOR 0x1000 /* Receiver queue overrun error */ +#define QSM_QSCSR_QTHF 0x0800 /* Receiver queue top-half full */ +#define QSM_QSCSR_QBHF 0x0400 /* Receiver queue bottom-half full */ +#define QSM_QSCSR_QTHE 0x0200 /* Xmitter queue top-half empty */ +#define QSM_QSCSR_QBHE 0x0100 /* Xmitter queue bottom-half empty */ +#define QSM_QSCSR_QRPNT_MSK 0x00F0 /* Queue receive pointer */ +#define QSM_QSCSR_QPEND_MSK 0x000F /* Queue pending */ + + +/* + * device and channel structures + */ + +typedef struct + { + /* must be first */ + + SIO_CHAN sio; /* standard SIO_CHAN element */ + + /* callbacks */ + + STATUS (*getTxChar) (); + STATUS (*putRcvChar) (); + void * getTxArg; + void * putRcvArg; + + /* register addresses */ + + volatile UINT16 * sccr0; /* control register 0 */ + volatile UINT16 * sccr1; /* control register 1 */ + volatile UINT16 * scsr; /* status register */ + volatile UINT16 * scdr; /* data register */ + volatile UINT16 * scilr; /* interrupt level register */ + volatile UINT16 * qsccr; /* queued control register */ + volatile UINT16 * qscsr; /* queued status register */ + volatile UINT16 * scrq; /* receive queue */ + volatile UINT16 * sctq; /* transmit queue */ + + /* misc */ + + int intLevel; + int baudRate; + int clockRate; /* CPU clock frequency (Hz) */ + int mode; /* current mode (interrupt or poll) */ + int options; /* Hardware options */ + } PPC555SCI_CHAN; + + + +/* + * function prototypes + */ + +IMPORT void ppc555SciDevInit (PPC555SCI_CHAN *pChan); +IMPORT void ppc555SciDevInit2(PPC555SCI_CHAN *pChan); +IMPORT void ppc555SciInt (PPC555SCI_CHAN *pChan); + + +#endif /* _ASMLANGUAGE */ + + +#endif /* __STDC__ */ +#ifdef __cplusplus +} + +#endif /* __INCppc555SciSioh */ diff --git a/h/drv/sio/ppc860Sio.h b/h/drv/sio/ppc860Sio.h new file mode 100644 index 0000000..132ac90 --- /dev/null +++ b/h/drv/sio/ppc860Sio.h @@ -0,0 +1,686 @@ +/* Copyright 1984-1998 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,07jan99,cn fixed properly SPR# 22503 and SPR# 24296. +01f,22oct98,cn added missing parenthesis in some defines (SPR# 22503). +01e,13apr98,map moved SCC device definitions to ../multi/ppc860Cpm.h + renamed SCC_DEV to SCC_UART_DEV +01d,26mar98,map added SMC, SCC, PIP defines. +01c,24may96,tpr changed statusMode from VINT16 to VUINT16. +01b,22apr96,cah change definitions to be offsets from a known #define + constant, rather than from a run-time IMMR register value. + Changes are required in sysSerial.c for this as well. +01a,11apr96,cah created. +*/ + +/* + * This file contains constants for the Motorola MPC860 PowerPC + * microcontroller chip. + */ + +#ifndef __INCppc860Sioh +#define __INCppc860Sioh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "sioLib.h" +#include "drv/multi/ppc860Cpm.h" +#include "drv/multi/ppc860Siu.h" + +/* device and channel structures */ + +/* + * The PPC860SMC_CHAN structure defines a serial I/O channel which + * describes the (TBD) registers for a given channel. + * Also the various SIO driver functions ( ioctl, txStarup, callbackInstall, + * pollInput, polloutput ) that this channel could utilize are declared + * here. + */ + + +/* roughly things copied in structure form from multi/m68360.h */ + +/* MPC860 Dual Ported Ram addresses */ + +#define PPC860_DPR_SCC1(dprbase) ((VINT32 *) ((dprbase) + 0x1c00)) +#define PPC860_DPR_I2C(dprbase) ((VINT32 *) ((dprbase) + 0x1c80)) +#define PPC860_DPR_MISC(dprbase) ((VINT32 *) ((dprbase) + 0x1cb0)) +#define PPC860_DPR_IDMA1(dprbase) ((VINT32 *) ((dprbase) + 0x1cc0)) +#define PPC860_DPR_SCC2(dprbase) ((VINT32 *) ((dprbase) + 0x1d00)) +#define PPC860_DPR_SPI(dprbase) ((VINT32 *) ((dprbase) + 0x1d80)) +#define PPC860_DPR_TMR(dprbase) ((VINT32 *) ((dprbase) + 0x1db0)) +#define PPC860_DPR_IDMA2(dprbase) ((VINT32 *) ((dprbase) + 0x1dc0)) +#define PPC860_DPR_SCC3(dprbase) ((VINT32 *) ((dprbase) + 0x1e00)) +#define PPC860_DPR_SMC1(dprbase) ((VINT32 *) ((dprbase) + 0x1e80)) +#define PPC860_DPR_DSP1(dprbase) ((VINT32 *) ((dprbase) + 0x1ec0)) +#define PPC860_DPR_SCC4(dprbase) ((VINT32 *) ((dprbase) + 0x1f00)) +#define PPC860_DPR_SMC2(dprbase) ((VINT32 *) ((dprbase) + 0x1f80)) +#define PPC860_DPR_DSP2(dprbase) ((VINT32 *) ((dprbase) + 0x1fc0)) + +/* + * dual-ported parameter RAM SMC offsets + * access these with SMC_RBASE(base_dpram_addr_of_this_SMC1) + * base_dpram_addr_of_this_SMC1 == PPC860_DPR_SMC1(dprbase) + * or == PPC860_DPR_SMC2(dprbase) + */ +#define SMC_RBASE(base) ((VINT16 *) ((base) + 0x00)) /* Rx Buff Descr Base */ +#define SMC_TBASE(base) ((VINT16 *) ((base) + 0x02)) /* Tx Buff Descr Base */ +#define SMC_RFCR(base) ((VINT8 *) ((base) + 0x04)) /* Rx Function Code */ +#define SMC_TFCR(base) ((VINT8 *) ((base) + 0x05)) /* Tx Function Code */ +#define SMC_MRBLR(base) ((VINT16 *) ((base) + 0x06)) /* Max Rcv Buff Length */ +#define SMC_RSTATE(base) ((VINT32 *) ((base) + 0x08)) /* Rx Internal State */ +#define SMC_RBPTR(base) ((VINT16 *) ((base) + 0x10)) /* Rx Buffer Pointer */ +#define SMC_TSTATE(base) ((VINT32 *) ((base) + 0x18)) /* Tx Internal State */ +#define SMC_TBPTR(base) ((VINT16 *) ((base) + 0x20)) /* Tx Buffer Pointer */ +#define SMC_MAX_IDL(base) ((VINT16 *) ((base) + 0x28)) /* Max Idle characters */ +#define SMC_IDLC(base) ((VINT16 *) ((base) + 0x2A)) /* Temp Idle counter */ +#define SMC_BRKLN(base) ((VINT16 *) ((base) + 0x2C)) /* Last Rx Break length*/ +#define SMC_BRKEC(base) ((VINT16 *) ((base) + 0x2E)) /* Rx Brk Cond counter */ +#define SMC_BRKCR(base) ((VINT16 *) ((base) + 0x30)) /* Break Count reg (Tx)*/ +#define SMC_RMASK(base) ((VINT16 *) ((base) + 0x32)) /* Temp bit mask */ + +/* dual ported parameter RAM PIP offsets */ + +#define PIP_RBASE(base) ((VINT16 *)((base) + 0x00)) /* Rx Buff Descr Base */ +#define PIP_TBASE(base) ((VINT16 *)((base) + 0x01)) /* Tx Buff Descr Base */ +#define PIP_CFCR(base) ((VINT8 *)((base) + 0x04)) /* Cent. Function Code */ +#define PIP_SMASK(base) ((VINT8 *)((base) + 0x05)) /* Status mask */ + +/* + * dual-ported parameter RAM SCC offsets + * access these with SCC_RBASE(base_dpram_addr_of_this_SCC1) + * base_dpram_addr_of_this_SCC1 == PPC860_DPR_SCC1(dprbase) + * or == PPC860_DPR_SCC1(dprbase) + */ + +#define SCC_RBASE(base) ((VINT16 *) ((base) + 0x00)) /* Rx Buff Descr Base */ +#define SCC_TBASE(base) ((VINT16 *) ((base) + 0x02)) /* Tx Buff Descr Base */ +#define SCC_RFCR(base) ((VINT8 *) ((base) + 0x04)) /* Rx Function Code */ +#define SCC_TFCR(base) ((VINT8 *) ((base) + 0x05)) /* Tx Function Code */ +#define SCC_MRBLR(base) ((VINT16 *) ((base) + 0x06)) /* Max Rcv Buff Length */ +#define SCC_RSTATE(base) ((VINT32 *) ((base) + 0x08)) /* Rx Internal State */ +#define SCC_RBPTR(base) ((VINT16 *) ((base) + 0x10)) /* Rx Buffer Pointer */ +#define SCC_TSTATE(base) ((VINT32 *) ((base) + 0x18)) /* Tx Internal State */ +#define SCC_TBPTR(base) ((VINT16 *) ((base) + 0x20)) /* Tx Buffer Pointer */ +#define SCC_RCRC(base) ((VINT16 *) ((base) + 0x28)) /* Max Idle characters */ +#define SCC_TCRC(base) ((VINT16 *) ((base) + 0x2C)) /* Max Idle characters */ +#define SCC_MAX_IDL(base) ((VINT16 *) ((base) + 0x38)) /* Max Idle characters */ +#define SCC_IDLC(base) ((VINT16 *) ((base) + 0x3A)) /* Temp Idle counter */ +#define SCC_BRKCR(base) ((VINT16 *) ((base) + 0x3C)) /* Break Count Reg (Tx)*/ +#define SCC_PAREC(base) ((VINT16 *) ((base) + 0x3E)) /* Rx Parity Err Cnt */ +#define SCC_FRMEC(base) ((VINT16 *) ((base) + 0x40)) /* Rx Frame Err Cnt */ +#define SCC_NOSEC(base) ((VINT16 *) ((base) + 0x42)) /* Receive Noise Cnt */ + +/* + * dual-ported parameter RAM I2C offsets + * access these with I2C_RPBASE(base_dpram_addr_of_I2C) + */ + +#define I2C_RPBASE(base) ((VINT16 *) ((char *)base + 0x2C)) + + + +typedef struct /* SMC_BUF */ + { + VUINT16 statusMode; /* status and control */ + VINT16 dataLength; /* length of data buffer in bytes */ + u_char * dataPointer; /* points to data buffer */ + } SMC_BUF; + +typedef struct /* SMC_PARAM */ + { /* offset description*/ + VINT16 rbase; /* 00 Rx buffer descriptor base address */ + VINT16 tbase; /* 02 Tx buffer descriptor base address */ + VINT8 rfcr; /* 04 Rx function code */ + VINT8 tfcr; /* 05 Tx function code */ + VINT16 mrblr; /* 06 maximum receive buffer length */ + VINT32 rstate; /* 08 Rx internal state */ + VINT32 res1; /* 0C Rx internal data pointer */ + VINT16 rbptr; /* 10 Rx buffer descriptor pointer */ + VINT16 res2; /* 12 reserved/internal */ + VINT32 res3; /* 14 reserved/internal */ + VINT32 tstate; /* 18 Tx internal state */ + VINT32 res4; /* 1C reserved/internal */ + VINT16 tbptr; /* 20 Tx buffer descriptor pointer */ + VINT16 res5; /* 22 reserved/internal */ + VINT32 res6; /* 24 reserved/internal */ + VINT16 maxidl; /* 28 Maximum idle characters */ + VINT16 idlc; /* 2A temporary idle counter */ + VINT16 brkln; /* 2C last recv break length */ + VINT16 brkec; /* 2E recv break condition counter */ + VINT16 brkcr; /* 30 xmit break count register */ + VINT16 r_mask; /* 32 temporary bit mask */ + } SMC_PARAM; + +typedef struct /* SMC */ + { + SMC_PARAM param; /* SMC parameters */ + } SMC; + +typedef struct /* SMC_REG */ + { + VINT16 smcmr; /* SMC Mode register */ + VINT8 res1[2]; /* reserved */ + VINT8 smce; /* SMC Event register */ + VINT8 res2[3]; /* reserved */ + VINT8 smcm; /* SMC Mask register */ + } SMC_REG; + +/* SMC device descriptor */ + +typedef struct /* SMC_DEV */ + { + int smcNum; /* number of SMC device (1 or 2)*/ + int txBdNum; /* number of transmit buf descriptors */ + int rxBdNum; /* number of receive buf descriptors */ + SMC_BUF * txBdBase; /* transmit BD base address */ + SMC_BUF * rxBdBase; /* receive BD base address */ + u_char * txBufBase; /* transmit buffer base address */ + u_char * rxBufBase; /* receive buffer base address */ + VINT32 txBufSize; /* transmit buffer size */ + VINT32 rxBufSize; /* receive buffer size */ + int txBdNext; /* next transmit BD to fill */ + int rxBdNext; /* next receive BD to read */ + volatile SMC * pSmc; /* SMC parameter RAM. Must point */ + /* at DPRAM area for SMC1 or SMC2 */ + volatile SMC_REG * pSmcReg; /* SMC registers must point at */ + /* SMCMR1 or SMCMR2 */ + VINT32 intMask; /* interrupt acknowledge mask */ + } SMC_DEV; + +/* SCC device descriptor */ + +typedef struct /* SCC_UART_DEV */ + { + int sccNum; /* number of SCC device */ + int txBdNum; /* number of transmit buf descriptors */ + int rxBdNum; /* number of receive buf descriptors */ + SCC_BUF * txBdBase; /* transmit BD base address */ + SCC_BUF * rxBdBase; /* receive BD base address */ + u_char * txBufBase; /* transmit buffer base address */ + u_char * rxBufBase; /* receive buffer base address */ + VINT32 txBufSize; /* transmit buffer size */ + VINT32 rxBufSize; /* receive buffer size */ + int txBdNext; /* next transmit BD to fill */ + int rxBdNext; /* next receive BD to read */ + volatile SCC * pScc; /* SCC parameter RAM */ + volatile SCC_REG * pSccReg; /* SCC registers */ + VINT32 intMask; /* interrupt acknowledge mask */ + } SCC_UART_DEV; + +typedef struct /* I2C_PARAM */ + { /* offset description */ + VINT16 rbase; /* 00 Rx buffer descriptors base address */ + VINT16 tbase; /* 02 Tx buffer descriptors base address */ + VINT8 rfcr; /* 04 Rx function code */ + VINT8 tfcr; /* 05 Tx function code */ + VINT16 mrblr; /* 06 maximum receive buffer length */ + VINT32 ris; /* 08 Rx internal state */ + VINT32 ridp; /* 0c Rx internal data pointer */ + VINT16 rbptr; /* 10 Rx buffer descriptor pointer */ + VINT16 ribc; /* 12 Rx internal byte count */ + VINT32 rt; /* 14 Rx temp */ + VINT32 tis; /* 18 Tx internal state */ + VINT32 tidp; /* 1c Tx internal data pointer */ + VINT16 tbptr; /* 20 Tx buffer descriptor pointer */ + VINT16 tibc; /* 22 Tx internal byte count */ + VINT32 tt; /* 24 Tx temp */ + VINT32 notused; /* 28 not used */ + VINT16 rpbase; /* 2c relocatable parameter RAM base */ + VINT16 reserved; /* 2e reserved */ + } I2C_PARAM; + +/* standard dual-mode serial driver header structure follows */ + +typedef struct ppc860_chan /* PPC860SMC_CHAN */ + { + /* always goes first */ + SIO_DRV_FUNCS *pDrvFuncs; /* driver functions */ + + /* callbacks */ + + STATUS (*getTxChar)(); /* pointer to a xmitr function */ + STATUS (*putRcvChar)();/* pointer to a recvr function */ + void * getTxArg; + void * putRcvArg; + + VINT16 int_vec; /* interrupt vector number */ + VINT16 channelMode; /* SIO_MODE */ + int baudRate; + int clockRate; /* CPU clock frequency (Hz) */ + int bgrNum; /* number of BRG being used */ + VINT32 * pBaud; /* BRG registers */ + VINT32 regBase; /* register/DPR base address */ + SMC_DEV uart; /* UART SCC device */ + } PPC860SMC_CHAN; + + +/* serial procedures */ +IMPORT void ppc860DevInit (PPC860SMC_CHAN *); +IMPORT void ppc860Int (PPC860SMC_CHAN *); +IMPORT void ppc800DevInit (PPC860SMC_CHAN *); +IMPORT void ppc800Int (PPC860SMC_CHAN *); + +/* standard dual-mode serial driver header structure follows - SCC */ + +typedef struct ppc860Scc_chan /* PPC860SCC_CHAN */ + { + /* always goes first */ + + SIO_DRV_FUNCS *pDrvFuncs; /* driver functions */ + + /* callbacks */ + + STATUS (*getTxChar)(); /* pointer to a xmitr function */ + STATUS (*putRcvChar)();/* pointer to a recvr function */ + void * getTxArg; + void * putRcvArg; + + VINT16 int_vec; /* interrupt vector number */ + VINT16 channelMode; /* SIO_MODE */ + int baudRate; + int clockRate; /* CPU clock frequency (Hz) */ + int bgrNum; /* number of BRG being used */ + VINT32 * pBaud; /* BRG registers */ + VINT32 regBase; /* register/DPR base address */ + SCC_UART_DEV uart; /* UART SCC device */ + } PPC860SCC_CHAN; + +/* function declarations */ + +IMPORT void ppc860SccInt (PPC860SCC_CHAN *); +IMPORT void ppc860SccDevInit (PPC860SCC_CHAN *); + +/* channels */ + +#define PPC860_CHANNEL_A 0 +#define PPC860_CHANNEL_B 1 + +#define PPC860SMC_N_CHANS 2 /* number of serial channels on chip */ + +/* SIO -- mpc860 serial channel chip -- register definitions */ + +/* Buffer Descriptor Pointer Definitions */ + +/* Receive BD status bits 16-bit value */ + +#define BD_RX_EMPTY_BIT 0x8000 /* buffer is empty */ +#define BD_RX_WRAP_BIT 0x2000 /* last BD in chain */ +#define BD_RX_INTERRUPT_BIT 0x1000 /* set interrupt when filled */ +#define BD_RX_CON_MODE_BIT 0x0200 /* Continuous Mode bit */ +#define BD_RX_IDLE_CLOSE_BIT 0x0100 /* Close on IDLE recv bit */ +#define BD_RX_BREAK_CLOSE_BIT 0x0020 /* Close on break recv bit */ +#define BD_RX_FRAME_CLOSE_BIT 0x0010 /* Close on frame error bit */ +#define BD_RX_PARITY_ERROR_BIT 0x0008 /* Parity error in last byte */ +#define BD_RX_OVERRUN_ERROR_BIT 0x0002 /* Overrun occurred */ + +/* Transmit BD status bits 16-bit value */ + +#define BD_TX_READY_BIT 0x8000 /* Transmit ready/busy bit */ +#define BD_TX_WRAP_BIT 0x2000 /* last BD in chain */ +#define BD_TX_INTERRUPT_BIT 0x1000 /* set interrupt when emptied */ +#define BD_TX_CON_MODE_BIT 0x0200 /* Continuous Mode bit */ +#define BD_TX_PREAMBLE_BIT 0x0100 /* send preamble sequence */ + +#define BD_STATUS_OFFSET 0x00 /* two bytes */ +#define BD_DATA_LENGTH_OFFSET 0x02 /* two bytes */ +#define BD_BUF_POINTER_OFFSET 0x04 /* four bytes */ + +/* + * MPC860 internal register/memory map (section 17 of prelim. spec) + * note that these are offsets from the value stored in the IMMR + * register, which is in the PowerPC special register address space + * at register number 638 + */ + +/**** SIU module configuration ***/ +#define MPC860_SIUMCR(base) ((VINT32 *) ((base) + 0x00)) +/**** System Protection Control ***/ +#define MPC860_SYPCR(base) ((VINT32 *) ((base) + 0x04)) +/**** SW watch dog timer value ***/ +#define MPC860_SWT(base) ((VINT32 *) ((base) + 0x08)) +/*** Software service reg ***/ +#define MPC860_SWSR(base) ((VINT16 *) ((base) + 0x0E)) +/*** Interrupt pending reg ***/ +#define MPC860_SIPEND(base) ((VINT32 *) ((base) + 0x10)) +/*** Interrupt Mask reg ***/ +#define MPC860_SIMASK(base) ((VINT32 *) ((base) + 0x14)) +/*** Interrupt Edge level mask ***/ +#define MPC860_SIEL(base) ((VINT32 *) ((base) + 0x18)) +/*** Interrupt Vector reg ***/ +#define MPC860_SIVEC(base) ((VINT32 *) ((base) + 0x1C)) +/*** Transfer error status ***/ +#define MPC860_TESR(base) ((VINT32 *) ((base) + 0x20)) +/*** SDMA Config reg ***/ +#define MPC860_SDCR(base) ((VINT32 *) ((base) + 0x30)) + +/*** CP Interrupt vector reg ***/ +#define MPC860_CIVR(base) ((VINT16 *) ((base) + 0x930)) +/*** CP Interrupt config reg ***/ +#define MPC860_CICR(base) ((VINT32 *) ((base) + 0x940)) +/*** CP Interrupt pending reg ***/ +#define MPC860_CIPR(base) ((VINT32 *) ((base) + 0x944)) +/*** CP Interrupt mask reg ***/ +#define MPC860_CIMR(base) ((VINT32 *) ((base) + 0x948)) +/*** CP Interrupt in-service reg ***/ +#define MPC860_CISR(base) ((VINT32 *) ((base) + 0x94C)) +/*** Port A data direction reg ***/ +#define MPC860_PADIR(base) ((VINT16 *) ((base) + 0x950)) +/*** Port A pin assign reg ***/ +#define MPC860_PAPAR(base) ((VINT16 *) ((base) + 0x952)) +/*** Port A open drain reg ***/ +#define MPC860_PAODR(base) ((VINT16 *) ((base) + 0x954)) +/*** Port A data reg ***/ +#define MPC860_PADAT(base) ((VINT16 *) ((base) + 0x956)) +/*** Port C data direction reg ***/ +#define MPC860_PCDIR(base) ((VINT16 *) ((base) + 0x960)) +/*** Port C pin assign reg ***/ +#define MPC860_PCPAR(base) ((VINT16 *) ((base) + 0x962)) +/*** Port C special options reg ***/ +#define MPC860_PCSO(base) ((VINT16 *) ((base) + 0x964)) +/*** Port C data reg ***/ +#define MPC860_PCDAT(base) ((VINT16 *) ((base) + 0x966)) +/*** Port C interrupt control reg ***/ +#define MPC860_PCINT(base) ((VINT16 *) ((base) + 0x968)) +/*** Port D data direction reg ***/ +#define MPC860_PDDIR(base) ((VINT16 *) ((base) + 0x970)) +/*** Port D pin assign reg ***/ +#define MPC860_PDPAR(base) ((VINT16 *) ((base) + 0x972)) +/*** Port D data reg ***/ +#define MPC860_PDDAT(base) ((VINT16 *) ((base) + 0x976)) + +/*** Comm processor cmd reg ***/ +#define MPC860_CPCR(base) ((VINT16 *) ((base) + 0x9C0)) +/*** RISC config reg ***/ +#define MPC860_RCCR(base) ((VINT16 *) ((base) + 0x9C4)) +/*** RISC dev support status reg ***/ +#define MPC860_RMDS(base) ((VINT8 *) ((base) + 0x9C7)) +/*** RISC ucode dev spt control reg ***/ +#define MPC860_RMDR(base) ((VINT32 *) ((base) + 0x9C8)) +/*** RISC controller trap reg 1 ***/ +#define MPC860_RCTR1(base) ((VINT16 *) ((base) + 0x9CC)) +/*** RISC controller trap reg 2 ***/ +#define MPC860_RCTR2(base) ((VINT16 *) ((base) + 0x9CE)) +/*** RISC controller trap reg 3 ***/ +#define MPC860_RCTR3(base) ((VINT16 *) ((base) + 0x9D0)) +/*** RISC controller trap reg 4 ***/ +#define MPC860_RCTR4(base) ((VINT16 *) ((base) + 0x9D2)) +/*** RISC Timers event reg ***/ +#define MPC860_RTER(base) ((VINT16 *) ((base) + 0x9D6)) +/*** RISC Timers mask reg ***/ +#define MPC860_RTMR(base) ((VINT16 *) ((base) + 0x9DA)) + +/*** baud rate generation register set ***/ +/*** BRG1 configuration reg ***/ +#define MPC860_BRGC1(base) ((VINT32 *) ((base) + 0x9F0)) +/*** BRG2 configuration reg ***/ +#define MPC860_BRGC2(base) ((VINT32 *) ((base) + 0x9F4)) +/*** BRG3 configuration reg ***/ +#define MPC860_BRGC3(base) ((VINT32 *) ((base) + 0x9F8)) +/*** BRG4 configuration reg ***/ +#define MPC860_BRGC4(base) ((VINT32 *) ((base) + 0x9FC)) +/*** SCC1 Mode reg low ***/ +#define MPC860_GSMR_L1(base) ((VINT32 *) ((base) + 0xA00)) +/*** SCC1 Mode reg High ***/ +#define MPC860_GSMR_H1(base) ((VINT32 *) ((base) + 0xA04)) +/*** SCC1 Protocol Specific Mode reg ***/ +#define MPC860_PSMR1(base) ((VINT16 *) ((base) + 0xA08)) +/*** SCC1 Transmit-On-Demand reg ***/ +#define MPC860_TODR1(base) ((VINT16 *) ((base) + 0xA0C)) +/*** SCC1 Data Synchronization reg ***/ +#define MPC860_DSR1(base) ((VINT16 *) ((base) + 0xA0E)) +/*** SCC1 Event reg ***/ +#define MPC860_SCCE1(base) ((VINT16 *) ((base) + 0xA10)) +/*** SCC1 Mask reg ***/ +#define MPC860_SCCM1(base) ((VINT16 *) ((base) + 0xA14)) +/*** SCC1 Status reg ***/ +#define MPC860_SCCS1(base) ((VINT8 *) ((base) + 0xA17)) + +/*** SCC2 Mode reg low ***/ +#define MPC860_GSMR_L2(base) ((VINT32 *) ((base) + 0xA20)) +/*** SCC2 Mode reg High ***/ +#define MPC860_GSMR_H2(base) ((VINT32 *) ((base) + 0xA24)) +/*** SCC2 Protocol Specific Mode reg ***/ +#define MPC860_PSMR2(base) ((VINT16 *) ((base) + 0xA28)) +/*** SCC2 Transmit-On-Demand reg ***/ +#define MPC860_TODR2(base) ((VINT16 *) ((base) + 0xA2C)) +/*** SCC2 Data Synchronization reg ***/ +#define MPC860_DSR2(base) ((VINT16 *) ((base) + 0xA2E)) +/*** SCC2 Event reg ***/ +#define MPC860_SCCE2(base) ((VINT16 *) ((base) + 0xA30)) +/*** SCC2 Mask reg ***/ +#define MPC860_SCCM2(base) ((VINT16 *) ((base) + 0xA34)) +/*** SCC2 Status reg ***/ +#define MPC860_SCCS2(base) ((VINT8 *) ((base) + 0xA37)) + +/*** SCC3 Mode reg low ***/ +#define MPC860_GSMR_L3(base) ((VINT32 *) ((base) + 0xA40)) +/*** SCC3 Mode reg High ***/ +#define MPC860_GSMR_H3(base) ((VINT32 *) ((base) + 0xA44)) +/*** SCC3 Protocol Specific Mode reg ***/ +#define MPC860_PSMR3(base) ((VINT16 *) ((base) + 0xA48)) +/*** SCC3 Transmit-On-Demand reg ***/ +#define MPC860_TODR3(base) ((VINT16 *) ((base) + 0xA4C)) +/*** SCC3 Data Synchronization reg ***/ +#define MPC860_DSR3(base) ((VINT16 *) ((base) + 0xA4E)) +/*** SCC3 Event reg ***/ +#define MPC860_SCCE3(base) ((VINT16 *) ((base) + 0xA50)) +/*** SCC3 Mask reg ***/ +#define MPC860_SCCM3(base) ((VINT16 *) ((base) + 0xA54)) +/*** SCC3 Status reg ***/ +#define MPC860_SCCS3(base) ((VINT8 *) ((base) + 0xA57)) + +/*** SCC4 Mode reg low ***/ +#define MPC860_GSMR_L4(base) ((VINT32 *) ((base) + 0xA60)) +/*** SCC4 Mode reg High ***/ +#define MPC860_GSMR_H4(base) ((VINT32 *) ((base) + 0xA64)) +/*** SCC4 Protocol Specific Mode reg ***/ +#define MPC860_PSMR4(base) ((VINT16 *) ((base) + 0xA68)) +/*** SCC4 Transmit-On-Demand reg ***/ +#define MPC860_TODR4(base) ((VINT16 *) ((base) + 0xA6C)) +/*** SCC4 Data Synchronization reg ***/ +#define MPC860_DSR4(base) ((VINT16 *) ((base) + 0xA6E)) +/*** SCC4 Event reg ***/ +#define MPC860_SCCE4(base) ((VINT16 *) ((base) + 0xA70)) +/*** SCC4 Mask reg ***/ +#define MPC860_SCCM4(base) ((VINT16 *) ((base) + 0xA74)) +/*** SCC4 Status reg ***/ +#define MPC860_SCCS4(base) ((VINT8 *) ((base) + 0xA77)) + +/*** SMC1 Mode reg ***/ +#define MPC860_SMCMR1(base) ((VINT16 *) ((base) + 0xA82)) +/*** SMC1 Event reg ***/ +#define MPC860_SMCE1(base) ((VINT8 *) ((base) + 0xA86)) +/*** SMC1 Mask reg ***/ +#define MPC860_SMCM1(base) ((VINT8 *) ((base) + 0xA8A)) +/*** SMC2 Mode reg ***/ +#define MPC860_SMCMR2(base) ((VINT16 *) ((base) + 0xA92)) +/*** SMC2 or PIP Event reg ***/ +#define MPC860_SMCE2(base) ((VINT8 *) ((base) + 0xA96)) +/*** SMC2 Mask reg ***/ +#define MPC860_SMCM2(base) ((VINT8 *) ((base) + 0xA9A)) + +/*** SPI Mode reg ***/ +#define MPC860_SPMODE(base) ((VINT16 *) ((base) + 0xAA0)) +/*** SPI Event reg ***/ +#define MPC860_SPIE(base) ((VINT8 *) ((base) + 0xAA6)) +/*** SPI Mask reg ***/ +#define MPC860_SPIM(base) ((VINT8 *) ((base) + 0xAAA)) +/*** SPI Command reg ***/ +#define MPC860_SPCOM(base) ((VINT8 *) ((base) + 0xAAD)) + +/*** PIP Configuration reg ***/ +#define MPC860_PIPC(base) ((VINT16 *) ((base) + 0xAB2)) +/*** PIP Timing params reg ***/ +#define MPC860_PTPR(base) ((VINT16 *) ((base) + 0xAB6)) +/*** Port B data direction reg ***/ +#define MPC860_PBDIR(base) ((VINT32 *) ((base) + 0xAB8)) +/*** Port B pin assign reg ***/ +#define MPC860_PBPAR(base) ((VINT32 *) ((base) + 0xABC)) +/*** Port B open drain reg ***/ +#define MPC860_PBODR(base) ((VINT16 *) ((base) + 0xAC2)) +/*** Port B Data register ***/ +#define MPC860_PBDAT(base) ((VINT32 *) ((base) + 0xAC4)) + +/*** SI Mode reg ***/ +#define MPC860_SIMODE(base) ((VINT32 *) ((base) + 0xAE0)) +/*** SI Global Mode reg ***/ +#define MPC860_SIGMR(base) ((VINT8 *) ((base) + 0xAE4)) +/*** SI Status reg ***/ +#define MPC860_SISTR(base) ((VINT8 *) ((base) + 0xAE6)) +/*** SI Command reg ***/ +#define MPC860_SICMR(base) ((VINT8 *) ((base) + 0xAE7)) +/*** SI Clock route reg ***/ +#define MPC860_SICR(base) ((VINT32 *) ((base) + 0xAEC)) +/*** SI RAM pointers reg ***/ +#define MPC860_SIRP(base) ((VINT32 *) ((base) + 0xAF0)) +/*** SI Routing RAM base addr ***/ +#define MPC860_SIRAM_BASE(base) ((base) + 0xC00) + +/*** Data Param RAM base addr ***/ +#define MPC860_DPRAM_BASE(base) ((base) + 0x2000) + +/* Register Equates By Bit */ + +/* Equates for Baud Rate Generation Registers */ +#define MPC860_BRGC_RST 0x20000 /* 1 = reset BRG */ +#define MPC860_BRGC_ENABLE_CNT 0x10000 /* 1 = enable clocks to BRG */ +#define MPC860_BRGC_BRGCLK_SRC 0x00000 /* Baud Rate Gen clock src */ +#define MPC860_BRGC_CLK2_SRC 0x04000 /* CLK2 pin = BRG source */ +#define MPC860_BRGC_CLK6_SRC 0x08000 /* CLK6 pin = BRG source */ +#define MPC860_BRGC_AUTOBAUD 0x02000 /* 1 = autobaud on Rx */ + /* 0 = normal operation */ +#define MPC860_BRGC_CLKDIV_MASK 0x01FFE /* 12 bit value */ +#define MPC860_BRGC_CLKDIV_SHIFT 0x1 /* shifted up one bit */ +#define MPC860_BRGC_PRESCALE_16 0x00001 /* 1 = divide-by-16 clock */ + +/* Equates for SIMODE register */ +#define MPC860_SIMODE_SMC2_MUX 0x80000000 /* connected to mux SI */ +#define MPC860_SIMODE_SMC2_NMSI 0x00000000 /* connected to mux SI */ +#define MPC860_SIMODE_SMC2_BRG1 0x00000000 /* BRG1 is clock source */ +#define MPC860_SIMODE_SMC2_BRG2 0x10000000 /* BRG2 is clock source */ +#define MPC860_SIMODE_SMC2_BRG3 0x20000000 /* BRG3 is clock source */ +#define MPC860_SIMODE_SMC2_BRG4 0x30000000 /* BRG4 is clock source */ +#define MPC860_SIMODE_SMC2_CLK5 0x40000000 /* CLK5 is clock source */ +#define MPC860_SIMODE_SMC2_CLK6 0x50000000 /* CLK6 is clock source */ +#define MPC860_SIMODE_SMC2_CLK7 0x60000000 /* CLK7 is clock source */ +#define MPC860_SIMODE_SMC2_CLK8 0x70000000 /* CLK8 is clock source */ + +#define MPC860_SIMODE_SMC1_MUX 0x00008000 /* connected to mux SI */ +#define MPC860_SIMODE_SMC1_NMSI 0x00000000 /* connected to mux SI */ +#define MPC860_SIMODE_SMC1_BRG1 0x00000000 /* BRG1 is clock source */ +#define MPC860_SIMODE_SMC1_BRG2 0x00001000 /* BRG2 is clock source */ +#define MPC860_SIMODE_SMC1_BRG3 0x00002000 /* BRG3 is clock source */ +#define MPC860_SIMODE_SMC1_BRG4 0x00003000 /* BRG4 is clock source */ +#define MPC860_SIMODE_SMC1_CLK1 0x00004000 /* CLK1 is clock source */ +#define MPC860_SIMODE_SMC1_CLK2 0x00005000 /* CLK2 is clock source */ +#define MPC860_SIMODE_SMC1_CLK3 0x00006000 /* CLK3 is clock source */ +#define MPC860_SIMODE_SMC1_CLK4 0x00007000 /* CLK4 is clock source */ + +#define MPC860_SIMODE_TDMB_NORM 0x00000000 /* normal operation */ +#define MPC860_SIMODE_TDMB_ECHO 0x04000000 /* auto echo */ +#define MPC860_SIMODE_TDMB_LOOP 0x08000000 /* internal loopback */ +#define MPC860_SIMODE_TDMB_LCTR 0x0C000000 /* loopback control */ + +/* + * Equates for SMCE SM UART-mode Event Register + * writing a one to these location clears an event/interrupt + */ +#define MPC860_SMCE_UART_BRK_EVENT 0x10 /* break char received */ +#define MPC860_SMCE_UART_BSY_EVENT 0x04 /* char discarded no bufs */ +#define MPC860_SMCE_UART_TX_EVENT 0x02 /* char transmitted */ +#define MPC860_SMCE_UART_RX_EVENT 0x01 /* char received */ +#define MPC860_SMCE_UART_ALL_EVENTS ( \ + MPC860_SMCE_UART_BRK_EVENT | \ + MPC860_SMCE_UART_BSY_EVENT | \ + MPC860_SMCE_UART_TX_EVENT | \ + MPC860_SMCE_UART_RX_EVENT ) + + +/* + * Equates for SMCM SM UART-mode Mask Register + * writing a one to these locations masks an event/interrupt + */ +#define MPC860_SMCM_UART_BRK_MASK 0x10 /* break char received */ +#define MPC860_SMCM_UART_BSY_MASK 0x04 /* char discarded no bufs */ +#define MPC860_SMCM_UART_TX_MASK 0x02 /* char transmitted */ +#define MPC860_SMCM_UART_RX_MASK 0x01 /* char received */ + +/* Equates for CICR register CP interrupt configuration register */ +#define MPC860_CICR_IRL_LEVEL_0 0x00000000 /* highest interrupt level */ +#define MPC860_CICR_IRL_LEVEL_1 0x00020000 +#define MPC860_CICR_IRL_LEVEL_2 0x00040000 +#define MPC860_CICR_IRL_LEVEL_3 0x00060000 +#define MPC860_CICR_IRL_LEVEL_4 0x00080000 /* standard value */ +#define MPC860_CICR_IRL_LEVEL_5 0x000A0000 +#define MPC860_CICR_IRL_LEVEL_6 0x000C0000 +#define MPC860_CICR_IRL_LEVEL_7 0x000E0000 /* lowest */ +#define MPC860_CICR_HP_SRC_STD 0x0001F000 /* highest priority int */ +#define MPC860_CICR_MASTER_IEN 0x00000080 /* master interrupt enable */ + +/* Equates for CIMR register CP interrupt mask register */ +#define MPC860_CIMR_SCC1_MASK 0x40000000 /* mask SCC1 interrupt */ +#define MPC860_CIMR_SCC2_MASK 0x20000000 /* mask SCC2 interrupt */ +#define MPC860_CIMR_SMC1_MASK 0x00000010 /* mask SMC1 interrupt */ +#define MPC860_CIMR_SMC2_MASK 0x00000008 /* mask SMC2 interrupt */ + +/* Equates for RFCR register receive function code register */ +#define MPC860_RFCR_DEC_LE 0x00 /* DEC little endian mode */ +#define MPC860_RFCR_PPC_LE 0x08 /* PPC little endian mode */ + /* reverse transmission order of */ + /* bytes compared to DEC/Intel mode */ +#define MPC860_RFCR_MOT_BE 0x18 /* big endian mode */ + +/* Equates for TFCR register transmission function code register */ +#define MPC860_TFCR_DEC_LE 0x00 /* DEC little endian mode */ +#define MPC860_TFCR_PPC_LE 0x08 /* PPC little endian mode */ + /* reverse transmission order of */ + /* bytes compared to DEC/Intel mode */ +#define MPC860_TFCR_MOT_BE 0x18 /* big endian mode */ + +/* Equates for SMC Mode Register SMCMR */ +#define MPC860_SMCMR_CLEN_MASK 0x7800 /* # bits in char minus one */ + /* set to # data bits + # parity */ + /* bits + # stop bits */ +#define MPC860_SMCMR_CLEN_STD 0x4800 /* for 8-N-1 std serial I/O */ +#define MPC860_SMCMR_STOPLEN_1 0x0000 /* stop length = 1 */ +#define MPC860_SMCMR_STOPLEN_2 0x0400 /* stop length = 2 */ +#define MPC860_SMCMR_NO_PARITY 0x0000 /* parity disabled */ +#define MPC860_SMCMR_PARITY 0x0200 /* parity enabled */ +#define MPC860_SMCMR_PARITY_ODD 0x0000 /* odd parity if enabled */ +#define MPC860_SMCMR_PARITY_EVEN 0x0100 /* even parity if enabled */ +#define MPC860_SMCMR_GCI_MODE 0x0000 /* GCI or SCIT mode */ +#define MPC860_SMCMR_UART_MODE 0x0020 /* UART mode */ +#define MPC860_SMCMR_TRANS_MODE 0x0030 /* totally transparent mode */ +#define MPC860_SMCMR_NORM_MODE 0x0000 /* normal operation mode */ +#define MPC860_SMCMR_LOOP_MODE 0x0004 /* local loopback mode */ +#define MPC860_SMCMR_ECHO_MODE 0x0008 /* echo mode */ +#define MPC860_SMCMR_TX_ENABLE 0x0002 /* enable transmitter */ +#define MPC860_SMCMR_TX_DISABLE 0x0000 /* disable transmitter */ +#define MPC860_SMCMR_RX_ENABLE 0x0001 /* enable receiver */ +#define MPC860_SMCMR_RX_DISABLE 0x0000 /* disable receiver */ + +#define MPC860_SMCMR_STD_MODE ( \ + MPC860_SMCMR_CLEN_STD | \ + MPC860_SMCMR_STOPLEN_1 | \ + MPC860_SMCMR_NO_PARITY | \ + MPC860_SMCMR_UART_MODE | \ + MPC860_SMCMR_NORM_MODE ) +#define MPC860_SCMCR_STD_MODE_ENABLED ( \ + MPC860_SMCMR_STD_MODE | \ + MPC860_SMCMR_TX_ENABLE | \ + MPC860_SMCMR_RX_ENABLE ) + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCppc860Sioh */ diff --git a/h/drv/sio/rm9000x2glSio.h b/h/drv/sio/rm9000x2glSio.h new file mode 100644 index 0000000..0c4e361 --- /dev/null +++ b/h/drv/sio/rm9000x2glSio.h @@ -0,0 +1,212 @@ +/* rm9000x2glSio.h - rm9000x2gl DUART header file */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,13apr05,rlg fix for misplacement of assembly if def, discoverd in build of bootroms +01a,05apr05,rlg created for rm9000x2gl (yosemite). Created from the + wind river ns16552Sio.h file, version 01f,07sep04. +*/ + +#ifndef __INCrm9000x2glSioh +#define __INCrm9000x2glSioh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + ********************************************************************* + * Copyright (c) 1990,1991 Intel Corporation + * + * Intel hereby grants you permission to copy, modify, and + * distribute this software and its documentation. Intel grants + * this permission provided that the above copyright notice + * appears in all copies and that both the copyright notice and + * this permission notice appear in supporting documentation. In + * addition, Intel grants this permission provided that you + * prominently mark as not part of the original any modifications + * made to this software or documentation, and that the name of + * Intel Corporation not be used in advertising or publicity + * pertaining to distribution of the software or the documentation + * without specific, written prior permission. + * + * Intel Corporation does not warrant, guarantee or make any + * representations regarding the use of, or the results of the use + * of, the software and documentation in terms of correctness, + * accuracy, reliability, currentness, or otherwise; and you rely + * on the software, documentation and results solely at your own risk. + * + *\NOMANUAL + ********************************************************************** +*/ + +/* + ****************************************************************************** + * + * REGISTER DESCRIPTION OF RM9000x2gl DUART + * + * $Id: rm9000x2gl.h,v 1.0 1993/06/07 15:07:59 wise active $ + * + *\NOMANUAL + ******************************************************************************* +*/ + + + +/* Register offsets from base address */ + +#define RBR 0x08 /* receiver buffer register */ +#define THR 0x0C /* transmit holding register */ +#define DLL 0x10 /* divisor latch */ +#define IER 0x14 /* interrupt enable register */ +#define DLM 0x18 /* divisor latch(MS) */ +#define IIR 0x1C /* interrupt identification register */ +#define FCR 0x20 /* FIFO control register */ +#define LCR 0x24 /* line control register */ +#define MCR 0x28 /* modem control register */ +#define LSR 0x2C /* line status register */ +#define MSR 0x30 /* modem status register */ +#define SCR 0x34 /* scratch register */ + +#define BAUD_LO(baud) ((XTAL/(16*baud)) & 0xff) +#define BAUD_HI(baud) (((XTAL/(16*baud)) & 0xff00) >> 8) + +/* Line Control Register */ + +#define CHAR_LEN_5 0x00 /* 5bits data size */ +#define CHAR_LEN_6 0x01 /* 6bits data size */ +#define CHAR_LEN_7 0x02 /* 7bits data size */ +#define CHAR_LEN_8 0x03 /* 8bits data size */ +#define LCR_STB 0x04 /* 2 stop bits */ +#define ONE_STOP 0x00 /* one stop bit */ +#define LCR_PEN 0x08 /* parity enable */ +#define PARITY_NONE 0x00 /* parity disable */ +#define LCR_EPS 0x10 /* even parity select */ +#define LCR_SP 0x20 /* stick parity select */ +#define LCR_SBRK 0x40 /* break control bit */ +#define LCR_DLAB 0x80 /* divisor latch access enable */ +#define DLAB LCR_DLAB + +/* Line Status Register */ + +#define LSR_DR 0x01 /* data ready */ +#define RxCHAR_AVAIL LSR_DR /* data ready */ +#define LSR_OE 0x02 /* overrun error */ +#define LSR_PE 0x04 /* parity error */ +#define LSR_FE 0x08 /* framing error */ +#define LSR_BI 0x10 /* break interrupt */ +#define LSR_THRE 0x20 /* transmit holding register empty */ +#define LSR_TEMT 0x40 /* transmitter empty */ +#define LSR_FERR 0x80 /* in fifo mode, set when PE,FE or BI error */ + +/* Interrupt Identification Register */ + +#define IIR_IP 0x01 +#define IIR_ID 0x0e +#define IIR_RLS 0x06 /* received line status */ +#define Rx_INT IIR_RLS /* received line status */ +#define IIR_RDA 0x04 /* received data available */ +#define RxFIFO_INT IIR_RDA /* received data available */ +#define IIR_THRE 0x02 /* transmit holding register empty */ +#define TxFIFO_INT IIR_THRE +#define IIR_MSTAT 0x00 /* modem status */ +#define IIR_TIMEOUT 0x0c /* char receive timeout */ + +/* Interrupt Enable Register */ + +#define IER_ERDAI 0x01 /* received data avail. & timeout int */ +#define RxFIFO_BIT IER_ERDAI +#define IER_ETHREI 0x02 /* transmitter holding register empty int */ +#define TxFIFO_BIT IER_ETHREI +#define IER_ELSI 0x04 /* receiver line status int enable */ +#define Rx_BIT IER_ELSI +#define IER_EMSI 0x08 /* modem status int enable */ + +/* Modem Control Register */ + +#define MCR_DTR 0x01 /* dtr output */ +#define DTR MCR_DTR +#define MCR_RTS 0x02 /* rts output */ +#define MCR_OUT1 0x04 /* output #1 */ +#define MCR_OUT2 0x08 /* output #2 */ +#define MCR_LOOP 0x10 /* loopback enable */ + +/* Modem Status Register */ + +#define MSR_DCTS 0x01 /* cts change */ +#define MSR_DDSR 0x02 /* dsr change */ +#define MSR_TERI 0x04 /* ring indicator change */ +#define MSR_DDCD 0x08 /* data carrier indicator change */ +#define MSR_CTS 0x10 /* complement of cts */ +#define MSR_DSR 0x20 /* complement of dsr */ +#define MSR_RI 0x40 /* complement of ring signal */ +#define MSR_DCD 0x80 /* complement of dcd */ + +/* FIFO Control Register */ + +#define FCR_EN 0x01 /* enable xmit and rcvr */ +#define FIFO_ENABLE FCR_EN +#define FCR_RXCLR 0x02 /* clears rcvr fifo */ +#define RxCLEAR FCR_RXCLR +#define FCR_TXCLR 0x04 /* clears xmit fifo */ +#define TxCLEAR FCR_TXCLR +#define FCR_DMA 0x08 /* dma */ +#define FCR_RXTRIG_L 0x40 /* rcvr fifo trigger lvl low */ +#define FCR_RXTRIG_H 0x80 /* rcvr fifo trigger lvl high */ + +#ifndef _ASMLANGUAGE + +#include "sioLib.h" + +typedef struct /* RM9000x2gl_CHAN * */ + { + /* always goes first */ + + SIO_DRV_FUNCS * pDrvFuncs; /* driver functions */ + + /* callbacks */ + + STATUS (*getTxChar) (); /* pointer to xmitr function */ + STATUS (*putRcvChar) (); /* pointer to rcvr function */ + void * getTxArg; + void * putRcvArg; + + UINT8 *regs; /* RM9000x2gl registers */ + UINT8 level; /* 8259a interrupt level for this device */ + UINT8 ier; /* copy of ier */ + UINT8 lcr; /* copy of lcr, not used by rm9000x2gl driver */ + UINT8 mcr; /* copy of modem control register */ + UINT8 pad1; + + UINT16 channelMode; /* such as INT, POLL modes */ + UINT16 regDelta; /* register address spacing */ + int baudRate; + UINT32 xtal; /* UART clock frequency */ + UINT32 options; /* hardware setup options */ + + } RM9000x2gl_CHAN; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void rm9000x2glInt (RM9000x2gl_CHAN *); +extern void rm9000x2glDevInit (RM9000x2gl_CHAN *); + +#else + +extern void rm9000x2glInt (); +extern void rm9000x2glDevInit (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrm9000x2glSioh */ diff --git a/h/drv/sio/sa1100Sio.h b/h/drv/sio/sa1100Sio.h new file mode 100644 index 0000000..62eda7d --- /dev/null +++ b/h/drv/sio/sa1100Sio.h @@ -0,0 +1,101 @@ +/* sa1100Sio.h - Digital Semiconductor SA-1100 UART header file */ + +/* Copyright 1998-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,12apr00,jpd added include of sioLib.h to work with project builds. +01a,22jan98,jpd written from ambaSio.h, version 01b. +*/ + +#ifndef __INCsa1100Sioh +#define __INCsa1100Sioh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Register description of SA-1100 UART */ + +#ifndef _ASMLANGUAGE + +#include "vxWorks.h" +#include "sioLib.h" + +/* Register offsets from base address */ + +#define UTCR0 0x00 /* UART Control Register 0 */ +#define UTCR1 0x04 /* UART Control Register 1 */ +#define UTCR2 0x08 /* UART Control Register 2 */ +#define UTCR3 0x0C /* UART Control Register 3 */ +#define UTDR 0x14 /* UART Control Register */ +#define UTSR0 0x1C /* UART Status Register 0 */ +#define UTSR1 0x20 /* UART Status Register 1 */ + +/* bit definitions within UTCR0 register */ + +#define PARITY_NONE 0x00 /* set no parity */ +#define ONE_STOP 0x00 /* set one stop bit */ +#define WORD_LEN_8 (1 << 3) /* set 8 data bits */ + + +/* bit definitions within UTCR3 register */ + +#define UTCR3_RXE 0x01 /* Receiver Enable */ +#define UTCR3_TXE 0x02 /* Transmitter Enable */ +#define UTCR3_RIM 0x08 /* Rx Interrupt Mask */ +#define UTCR3_TIM 0x10 /* Tx Interrupt Mask */ + + +/* bit definitions within UTSR0 register */ + +#define UTSR0_TFS (1 << 0) /* Tx FIFO Service Request */ +#define UTSR0_RFS (1 << 1) /* Rx FIFO Service Request */ +#define UTSR0_RID (1 << 2) /* Receiver Idle */ +#define UTSR0_RBB (1 << 3) /* Rx beginning of Break */ +#define UTSR0_REB (1 << 4) /* Rx end of break */ +#define UTSR0_EIF (1 << 5) /* Error in FIFO */ + + +/* bit definitions within UTSR1 register */ + +#define UTSR1_RNE (1 << 1) /* Receiver FIFO Not Empty */ +#define UTSR1_TNF (1 << 2) /* Transmitter FIFO Not Full */ + + +typedef struct SA1100_CHAN + { + /* must be first */ + + SIO_CHAN sio; /* standard SIO_CHAN element */ + + /* callbacks */ + + STATUS (*getTxChar) (); /* installed Tx callback routine */ + STATUS (*putRcvChar) (); /* installed Rx callback routine */ + void * getTxArg; /* argument to Tx callback routine */ + void * putRcvArg; /* argument to Rx callback routine */ + + UINT32 * regs; /* UART registers */ + UINT8 level; /* Interrupt level for this device */ + + UINT32 channelMode; /* such as INT, POLL modes */ + int baudRate; /* the current baud rate */ + UINT32 xtal; /* UART clock frequency */ + + } SA1100_CHAN; + + +/* function declarations */ + +extern void sa1100Int (SA1100_CHAN *pChan); +extern void sa1100DevInit (SA1100_CHAN *pChan); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsa1100Sioh */ diff --git a/h/drv/sio/sab82532Sio.h b/h/drv/sio/sab82532Sio.h new file mode 100644 index 0000000..e8e032c --- /dev/null +++ b/h/drv/sio/sab82532Sio.h @@ -0,0 +1,113 @@ +/* sab82532Sio.h - Siemens 82532 DUART header file */ + +/* +modification history +-------------------- +01a,25nov97,mem written. +*/ + +#ifndef __INCsab82532Sioh +#define __INCsab82532Sioh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "vxWorks.h" +#include "sioLib.h" + +#endif /* _ASMLANGUAGE */ + +/* Register offsets from base address (ASYNC mode only) */ + +#define SAB82532_RFIFO 0x00 /* r : rfifo 0 */ +#define SAB82532_XFIFO 0x00 /* w: xfifo 0 */ +#define SAB82532_STAR 0x20 /* r : status register */ +#define SAB82532_CMDR 0x20 /* w: command register */ +#define SAB82532_MODE 0x22 /* rw: mode register */ +#define SAB82532_TIMR 0x23 /* rw: timer register */ +#define SAB82532_XON 0x24 /* rw: XON character */ +#define SAB82532_XOFF 0x25 /* rw: XOFF character */ +#define SAB82532_TCR 0x26 /* rw: termination character register */ +#define SAB82532_DAFO 0x27 /* rw: data format */ +#define SAB82532_RFC 0x28 /* rw: rfifo control register */ +#define SAB82532_RBCL 0x2a /* r : receive byte count low */ +#define SAB82532_XBCL 0x2a /* w: transmit byte count low */ +#define SAB82532_RBCH 0x2b /* r : receive byte count high */ +#define SAB82532_XBCH 0x2b /* w: transmit byte count high */ +#define SAB82532_CCR0 0x2c /* rw: channel config register 0 */ +#define SAB82532_CCR1 0x2d /* rw: channel config register 1 */ +#define SAB82532_CCR2 0x2e /* rw: channel config register 2 */ +#define SAB82532_CCR3 0x2f /* rw: channel config register 3 */ +#define SAB82532_TSAX 0x30 /* w: time-slot assignment transmit */ +#define SAB82532_TSAR 0x31 /* w: time-slot assignment receive */ +#define SAB82532_XCCR 0x32 /* w: transmit channel capacity register */ +#define SAB82532_RCCR 0x33 /* w: receive channel capacity register */ +#define SAB82532_VSTR 0x34 /* r : version status */ +#define SAB82532_BGR 0x34 /* w: baud rate generator register */ +#define SAB82532_TIC 0x35 /* w: transmit immediate character */ +#define SAB82532_MXN 0x36 /* w: mask XON character */ +#define SAB82532_MXF 0x37 /* w: mask XOFF character */ +#define SAB82532_GIS 0x38 /* r : global interrupt status */ +#define SAB82532_IVA 0x38 /* w: interrupt vector address */ +#define SAB82532_IPC 0x39 /* rw: interrupt port configuration */ +#define SAB82532_ISR0 0x3a /* r : interrupt status 0 */ +#define SAB82532_IMR0 0x3a /* w: interrupt mask 0 */ +#define SAB82532_ISR1 0x3b /* r : interrupt status 1 */ +#define SAB82532_IMR1 0x3b /* w: interrupt mask 1 */ +#define SAB82532_PVR 0x3c /* rw: port value register */ +#define SAB82532_PIS 0x3d /* r : port interrupt status */ +#define SAB82532_PIM 0x3d /* w: port interrupt mask */ +#define SAB82532_PCR 0x3e /* rw: port configuration register */ +#define SAB82532_CCR4 0x3f /* rw: channel config register 4 */ + +#ifndef _ASMLANGUAGE + +typedef struct SAB82532_CHAN + { + /* always goes first */ + + SIO_DRV_FUNCS * pDrvFuncs; /* driver functions */ + + /* callbacks */ + + STATUS (*getTxChar) (); + STATUS (*putRcvChar) (); + void * getTxArg; + void * putRcvArg; + + volatile UINT8 * regs; /* SAB82532 registers */ + + UINT16 channelMode; /* such as INT, POLL modes */ + int baudRate; + UINT32 xtal; /* UART clock frequency */ + } SAB82532_CHAN; + +typedef struct SAB82532_DUART + { + SAB82532_CHAN channel[2]; + } SAB82532_DUART; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void sab82532Int (SAB82532_DUART *); +extern void sab82532DevInit (SAB82532_DUART *); + +#else + +extern void sab82532Int (); +extern void sab82532DevInit (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsab82532Sioh */ diff --git a/h/drv/sio/shSciSio.h b/h/drv/sio/shSciSio.h new file mode 100644 index 0000000..a897c87 --- /dev/null +++ b/h/drv/sio/shSciSio.h @@ -0,0 +1,225 @@ +/* shSciSio.h - header file for Hitachi SH on-chip SCI serial driver */ + +/* Copyright 1996-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01p,15feb01,hk add #ifdef SCI_TYPE_SH7604 to adjust baud rate for SH7604. +01o,09nov00,csi modification to optimize SMR and BRR define +01n,30aug00,zl added 30MHz PCLK support for SH7600 +01m,20aug00,hk merged SH7040 to SH7600. +01l,04aug00,rsh Add frequency defines for sh7729 +01k,31may00,frf SH7751 for T2 +01j,29dec98,hk merged for SH7750,SH7729,SH7700,SH7600,SH7410,SH7040,SH7000. +01i,10aug98,jmb add 57600 baud for Manta-DSP. +01h,09jul98,jmb add support for Manta-SH3 frequencies. +01g,01jun98,jmb added "options" to support SIO_HW_OPTS_GET. +01f,19may98,jmc added support for SH-DSP and SH3-DSP. +01g,18sep98,hk fixed SH7750 support for 33.33MHz PCLK. +01f,02jul98,st added SH7750 support. +01e,14jan98,jmc added baud rate table entries for 20/10/5MHz. +01d,25apr97,hk changed SH704X to SH7040. +01c,21mar97,hk added SCI_BAUD typedef. enhanced defs for smr and brr. +01b,10mar97,hk renamed this header as shSciSio.h from shSio.h. changed + SH_CHAN to SCI_CHAN. deleted SH_DUSART. changed function + prototype names to shSciXyz. changed definition layout. +01a,16dec96,kn derived from templateSio.h +*/ + +#ifndef __INCshSciSioh +#define __INCshSciSioh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "sioLib.h" + + +/* device channel structure */ + +typedef struct + { + /* always goes first */ + + SIO_DRV_FUNCS * pDrvFuncs; /* driver functions */ + + /* callbacks */ + + STATUS (*getTxChar) (); + STATUS (*putRcvChar) (); + void * getTxArg; + void * putRcvArg; + + /* register addresses */ + + volatile UINT8 * smr; /* serial mode register */ + volatile UINT8 * brr; /* bit rate register */ + volatile UINT8 * scr; /* serial control register */ + volatile UINT8 * tdr; /* transmit data register */ + volatile UINT8 * ssr; /* serial status register */ + volatile UINT8 * rdr; /* receive data register */ + + int mode; /* current mode (interrupt or poll) */ + int baud; /* baud rate */ + UINT options; /* data format */ + } SCI_CHAN; + + +/* entry structure for baud-rate table */ + +typedef struct + { + int rate; /* baud-rate to be set */ + UINT8 cksVal; /* clock select bits for smr */ + UINT8 brrVal; /* value to set in brr */ + } SCI_BAUD; + + +/* bit values for smr (serial mode register) */ + +#define SCI_SMR_ASYNC 0x00 /* async mode */ +#define SCI_SMR_SYNC 0x80 /* synchronous mode */ +#define SCI_SMR_8_BITS 0x00 /* 8 bits data */ +#define SCI_SMR_7_BITS 0x40 /* 7 bits data */ +#define SCI_SMR_PAR_DIS 0x00 /* parity disable */ +#define SCI_SMR_PAR_EN 0x20 /* parity enable */ +#define SCI_SMR_PAR_EVEN 0x00 /* even parity */ +#define SCI_SMR_PAR_ODD 0x10 /* odd parity */ +#define SCI_SMR_1_STOP 0x00 /* 1 stop bit */ +#define SCI_SMR_2_STOP 0x08 /* 2 stop bit */ +#define SCI_SMR_MP_DIS 0x00 /* multiprocessor format disable */ +#define SCI_SMR_MP_EN 0x04 /* multiprocessor format enable */ +#define SCI_SMR_CKS_MASK 0xfc /* mask for clock select bits */ + +#ifdef SYS_PCLK_FREQ +# define SCI_FREQ SYS_PCLK_FREQ +#else +# ifdef SCI_TYPE_SH7604 +# define SCI_FREQ (SYS_CPU_FREQ / 4) +# else /* SH704x, SH705x */ +# define SCI_FREQ SYS_CPU_FREQ +# endif +#endif + +/* + * To calculate BRR value, the following formula used. + * BRR = (FREQ / (32 * 4^n) * BaudRate)) - 1 + * + * In the following macros are used + * SMR_VALUE is n + * CLK_DIVIDE(y) 4^n + * + * In the BRR_VALUE macro the extra mutiplication, division and addition + * is used to get correct rounding. + */ + +#define SMR_VALUE(x) (((SCI_FREQ/(64*32*(x))) >= 64) ? 3 : \ + ((SCI_FREQ/(64*32*(x))) >= 16) ? 2 : \ + ((SCI_FREQ/(64*32*(x))) >= 4) ? 1 : 0) + +#define CLK_DIVIDE(y) (((SCI_FREQ/(64*32*(y))) >= 64) ? 64 : \ + ((SCI_FREQ/(64*32*(y))) >= 16) ? 16 : \ + ((SCI_FREQ/(64*32*(y))) >= 4) ? 4 : 1) + +#define BRR_FORMULA(s) (((10*SCI_FREQ)/(32*CLK_DIVIDE(s)*(s))-5)/10) + +#define BRR_VALUE(z) ((BRR_FORMULA(z) > 255) ? 0 : BRR_FORMULA(z)) + +#define SCI_SMR_CKS_50 SMR_VALUE(50) +#define SCI_SMR_CKS_75 SMR_VALUE(75) +#define SCI_SMR_CKS_110 SMR_VALUE(110) +#define SCI_SMR_CKS_134 SMR_VALUE(134) +#define SCI_SMR_CKS_150 SMR_VALUE(150) +#define SCI_SMR_CKS_200 SMR_VALUE(200) +#define SCI_SMR_CKS_300 SMR_VALUE(300) +#define SCI_SMR_CKS_600 SMR_VALUE(600) +#define SCI_SMR_CKS_1200 SMR_VALUE(1200) +#define SCI_SMR_CKS_1800 SMR_VALUE(1800) +#define SCI_SMR_CKS_2400 SMR_VALUE(2400) +#define SCI_SMR_CKS_3600 SMR_VALUE(3600) +#define SCI_SMR_CKS_4800 SMR_VALUE(4800) +#define SCI_SMR_CKS_7200 SMR_VALUE(7200) +#define SCI_SMR_CKS_9600 SMR_VALUE(9600) +#define SCI_SMR_CKS_19200 SMR_VALUE(19200) +#define SCI_SMR_CKS_31250 SMR_VALUE(31250) +#define SCI_SMR_CKS_38400 SMR_VALUE(38400) +#define SCI_SMR_CKS_57600 SMR_VALUE(57600) +#define SCI_SMR_CKS_115200 SMR_VALUE(115200) +#define SCI_SMR_CKS_500000 SMR_VALUE(500000) + + +/* bit values for brr (bit rate register) */ + +#define SCI_BRR_50 BRR_VALUE(50) +#define SCI_BRR_75 BRR_VALUE(75) +#define SCI_BRR_110 BRR_VALUE(110) +#define SCI_BRR_134 BRR_VALUE(134) +#define SCI_BRR_150 BRR_VALUE(150) +#define SCI_BRR_200 BRR_VALUE(200) +#define SCI_BRR_300 BRR_VALUE(300) +#define SCI_BRR_600 BRR_VALUE(600) +#define SCI_BRR_1200 BRR_VALUE(1200) +#define SCI_BRR_1800 BRR_VALUE(1800) +#define SCI_BRR_2400 BRR_VALUE(2400) +#define SCI_BRR_3600 BRR_VALUE(3600) +#define SCI_BRR_4800 BRR_VALUE(4800) +#define SCI_BRR_7200 BRR_VALUE(9600) +#define SCI_BRR_9600 BRR_VALUE(9600) +#define SCI_BRR_19200 BRR_VALUE(19200) +#define SCI_BRR_31250 BRR_VALUE(31250) +#define SCI_BRR_38400 BRR_VALUE(38400) +#define SCI_BRR_57600 BRR_VALUE(57600) +#define SCI_BRR_115200 BRR_VALUE(115200) +#define SCI_BRR_500000 BRR_VALUE(500000) + + +/* bit values for scr (serial control register) */ + +#define SCI_SCR_TIE 0x80 /* transmit interrupt enable */ +#define SCI_SCR_RIE 0x40 /* receive interrupt enable */ +#define SCI_SCR_TXE 0x20 /* transmit enable */ +#define SCI_SCR_RXE 0x10 /* receive enable */ +#ifdef JMC_NEVER /* JMC Can this be removed ! */ +#define SCI_SCR_MPIE 0x08 /* multiprocessor interrupt enable */ +#endif +#define SCI_SCR_TEIE 0x04 /* transmit end interrupt enable */ + + +/* bit values for ssr (serial status register) */ + +#define SCI_SSR_TDRE 0x80 /* transmit data register empty */ +#define SCI_SSR_RDRF 0x40 /* receive data register full */ +#define SCI_SSR_ORER 0x20 /* overrun error */ +#define SCI_SSR_FER 0x10 /* framing error */ +#define SCI_SSR_PER 0x08 /* parity error */ +#define SCI_SSR_TEND 0x04 /* transmit end */ +#ifdef JMC_NEVER /* JMC Can this be removed ! */ +#define SCI_SSR_MPB 0x02 /* multiprocessor bit */ +#define SCI_SSR_MPBT 0x01 /* multiprocessor bit transfer */ +#endif + +/* function prototypes */ + +#if defined(__STDC__) + +extern void shSciDevInit (SCI_CHAN *pChan); +extern void shSciIntRcv (SCI_CHAN *pChan); +extern void shSciIntTx (SCI_CHAN *pChan); +extern void shSciIntErr (SCI_CHAN *pChan); + +#else /* __STDC__ */ + +extern void shSciDevInit (); +extern void shSciIntRcv (); +extern void shSciIntTx (); +extern void shSciIntErr (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCshSciSioh */ diff --git a/h/drv/sio/shScifSio.h b/h/drv/sio/shScifSio.h new file mode 100644 index 0000000..32492fd --- /dev/null +++ b/h/drv/sio/shScifSio.h @@ -0,0 +1,147 @@ +/* shScifSio.h - header file for Renesas SH on-chip SCIF serial driver */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01o,05nov02,h_k added tfdr2 to SCIF_CHAN for SH7760 support. (SPR #105971) +01n,06mar02,h_k added lsr2 and ss2r2 to SCIF_CHAN and SCIF_LSR2_ORER and + SCIF_SS2R2_ORER definitions (SPR #73777). +01m,15nov00,csi modification to optimize SMR and BRR define +01l,30aug00,zl added 30MHz PCLK support for SH7600 +01k,04aug00,rsh Add 33.33Mhz frequency defines for sh7729 +01j,31may00,frf SH7751 for T2 +01i,05mar99,hk Sorted out CPU conditional order. +01h,26nov98,hk Added support for SH7750. +01g,10aug98,jmb reg size fix. +01f,10aug98,jmb bugfix. +01e,10aug98,jmb Added support for Manta-DSP. +01d,30jul98,jmb Added support for Manta-SH3 frequencies. +01c,30may98,jmb Added options to support multiple data formats. +01b,23may98,jmb Fixed decl's and FCR2 macros, transmit triggers. +01a,20may98,jmb Created. +*/ + +#ifndef __INCshScifSioh +#define __INCshScifSioh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "sioLib.h" +#include "drv/sio/shSciSio.h" + +#if (CPU==SH7750) +#define SZ_SMR2 UINT16 +#define SZ_SCR2 UINT16 +#define SZ_FCR2 UINT16 +#else +#define SZ_SMR2 UINT8 +#define SZ_SCR2 UINT8 +#define SZ_FCR2 UINT8 +#endif + +/* device channel structure */ + +typedef struct + { + /* always goes first */ + + SIO_DRV_FUNCS * pDrvFuncs; /* driver functions */ + + /* callbacks */ + + STATUS (*getTxChar) (); + STATUS (*putRcvChar) (); + void * getTxArg; + void * putRcvArg; + + /* info */ + + int mode; /* current mode (interrupt or poll) */ + int baud; /* baud rate */ + UINT options; /* data format options */ + + /* register addresses */ + + volatile SZ_SMR2 * smr2; /* serial mode register */ + volatile UINT8 * brr2; /* bit rate register */ + volatile SZ_SCR2 * scr2; /* serial control register */ + volatile UINT8 * sfdr2; /* transmit FIFO data register */ + volatile UINT16 * ssr2; /* serial status register */ + volatile UINT8 * frdr2; /* receive FIFO data register */ + volatile SZ_FCR2 * fcr2; /* FIFO control register */ + volatile UINT16 * fdr2; /* data count set register */ + volatile UINT16 * lsr2; /* line status register */ + volatile UINT8 * ss2r2; /* serial status 2 register */ + volatile UINT16 * tfdr2; /* transmit data count set register */ + } SCIF_CHAN; + +/* Maximum FIFO length */ + +#define SCIF_FIFO_LEN 16 + +/* Bit values for FIFO control register */ + +#define SCIF_FCR2_RTRG 0xc0 /* Read mask for receive trigger */ +#define SCIF_FCR2_RTRG_1 0x00 /* 1 char in FIFO triggers receive */ +#define SCIF_FCR2_RTRG_4 0x40 /* 4 chars in FIFO triggers receive */ +#define SCIF_FCR2_RTRG_8 0x80 /* 8 chars in FIFO triggers receive */ +#define SCIF_FCR2_RTRG_14 0xc0 /* 14 chars in FIFO triggers receive */ + +#define SCIF_FCR2_TTRG 0x30 /* Read mask for transmit trigger */ +#define SCIF_FCR2_TTRG_8 0x00 /* */ +#define SCIF_FCR2_TTRG_4 0x10 /* */ +#define SCIF_FCR2_TTRG_2 0x20 /* */ +#define SCIF_FCR2_TTRG_1 0x30 /* */ + +#define SCIF_FCR2_MCE 0x8 /* Enable RTS/CTS signals */ +#define SCIF_FCR2_TFRST 0x4 /* Clear transmit FIFO on reset */ +#define SCIF_FCR2_RFRST 0x2 /* Clear receive RIFO on reset */ +#define SCIF_FCR2_LOOP 0x1 /* Loopback mode */ + +/* bit values for ssr (serial status register) */ + +#define SCIF_SSR2_ER 0x80 /* framing or parity error */ +#define SCIF_SSR2_TEND 0x40 /* tranmission end indicator */ +#define SCIF_SSR2_TDFE 0x20 /* transmit data FIFO empty */ +#define SCIF_SSR2_BRK 0x10 /* break signal received */ +#define SCIF_SSR2_FER 0x08 /* framing error */ +#define SCIF_SSR2_PER 0x04 /* parity error */ +#define SCIF_SSR2_RDF 0x02 /* receive FIFO full */ +#define SCIF_SSR2_DR 0x01 /* data ready in receive FIFO */ + +/* bit value for lsr (line status register) */ + +#define SCIF_LSR2_ORER 0x1 /* overrun error */ + +/* bit value for ss2r (serial status 2 register) */ + +#define SCIF_SS2R2_ORER 0x1 /* overrun error */ + +/* function prototypes */ + +#if defined(__STDC__) + +extern void shScifDevInit (SCIF_CHAN *pChan); +extern void shScifIntRcv (SCIF_CHAN *pChan); +extern void shScifIntTx (SCIF_CHAN *pChan); +extern void shScifIntErr (SCIF_CHAN *pChan); + +#else /* __STDC__ */ + +extern void shScifDevInit (); +extern void shScifIntRcv (); +extern void shScifIntTx (); +extern void shScifIntErr (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCshScifSioh */ + diff --git a/h/drv/sio/st16552Sio.h b/h/drv/sio/st16552Sio.h new file mode 100644 index 0000000..220ca29 --- /dev/null +++ b/h/drv/sio/st16552Sio.h @@ -0,0 +1,202 @@ +/* st16552Sio.h - Startech (Exar) 16552 DUART header file */ + +/* Copyright 1984-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,12apr00,jpd added include of sioLib.h to work with project builds. +01d,01dec97,jpd updated to latest standards. +01c,04apr97,jpd added ST16552_MUX struct for mutltiplexing interrupts. +01b,01apr97,jpd changed UINT16s to UINT32s for efficiency on ARM. +01a,18jul96,jpd written from ns16552Sio.h, version 01a. +*/ + +#ifndef __INCst16552Sioh +#define __INCst16552Sioh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Copyright (c) 1990,1991 Intel Corporation + * + * Intel hereby grants you permission to copy, modify, and + * distribute this software and its documentation. Intel grants + * this permission provided that the above copyright notice + * appears in all copies and that both the copyright notice and + * this permission notice appear in supporting documentation. In + * addition, Intel grants this permission provided that you + * prominently mark as not part of the original any modifications + * made to this software or documentation, and that the name of + * Intel Corporation not be used in advertising or publicity + * pertaining to distribution of the software or the documentation + * without specific, written prior permission. + * + * Intel Corporation does not warrant, guarantee or make any + * representations regarding the use of, or the results of the use + * of, the software and documentation in terms of correctness, + * accuracy, reliability, currentness, or otherwise; and you rely + * on the software, documentation and results solely at your own risk. + */ + + +/* REGISTER DESCRIPTION OF STARTECH 16552 DUART */ + +#ifndef _ASMLANGUAGE + +#include "vxWorks.h" +#include "sioLib.h" + + +/* Register offsets from base address */ + +#define RBR 0x00 /* Receive Holding Register (R/O) */ +#define THR 0x00 /* Transmit Holding Register (W/O)*/ +#define DLL 0x00 /* Divisor Latch Low */ +#define IER 0x01 /* Interrupt Enable Register */ +#define DLM 0x01 /* Divisor Latch Middle */ +#define IIR 0x02 /* Interupt identification Register (R/O) */ +#define FCR 0x02 /* FIFO Control register (W/O) */ +#define LCR 0x03 /* Line Control Register */ +#define MCR 0x04 /* Modem Control Register */ +#define LSR 0x05 /* Line Status register */ +#define MSR 0x06 /* Modem Status Register */ +#define SCR 0x07 /* Scratchpad Register */ + +#define BAUD_LO(baud) ((XTAL/(16*baud)) & 0xFF) +#define BAUD_HI(baud) (((XTAL/(16*baud)) & 0xFF00) >> 8) + +/* Line Control Register values */ + +#define CHAR_LEN_5 0x00 +#define CHAR_LEN_6 0x01 +#define CHAR_LEN_7 0x02 +#define CHAR_LEN_8 0x03 +#define LCR_STB 0x04 /* Stop bit control */ +#define ONE_STOP 0x00 /* One stop bit! */ +#define LCR_PEN 0x08 /* Parity Enable */ +#define PARITY_NONE 0x00 +#define LCR_EPS 0x10 /* Even Parity Select */ +#define LCR_SP 0x20 /* Force Parity */ +#define LCR_SBRK 0x40 /* Start Break */ +#define LCR_DLAB 0x80 /* Divisor Latch Access Bit */ +#define DLAB LCR_DLAB + +/* Line Status Register */ + +#define LSR_DR 0x01 /* Data Ready */ +#define RxCHAR_AVAIL LSR_DR +#define LSR_OE 0x02 /* Overrun Error */ +#define LSR_PE 0x04 /* Parity Error */ +#define LSR_FE 0x08 /* Framing Error */ +#define LSR_BI 0x10 /* Received Break Signal */ +#define LSR_THRE 0x20 /* Transmit Holding Register Empty */ +#define LSR_TEMT 0x40 /* THR and FIFO empty */ +#define LSR_FERR 0x80 /* Parity, Framing error or break in FIFO */ + +/* Interrupt Identification Register */ + +#define IIR_IP 0x01 /* Interrupt Pending */ +#define IIR_ID 0x0E /* Interrupt source mask */ +#define IIR_RLS 0x06 /* Rx Line Status Int */ +#define Rx_INT IIR_RLS +#define IIR_RDA 0x04 /* Rx Data Available */ +#define RxFIFO_INT IIR_RDA +#define IIR_THRE 0x02 /* THR Empty */ +#define TxFIFO_INT IIR_THRE +#define IIR_MSTAT 0x00 /* Modem Status Register Int */ +#define IIR_TIMEOUT 0x0C /* Rx Data Timeout */ + +/* Interrupt Enable Register */ + +#define IER_ERDAI 0x01 /* Enable Rx Data Available Int */ +#define RxFIFO_BIT IER_ERDAI +#define IER_ETHREI 0x02 /* Enable THR Empty Int */ +#define TxFIFO_BIT IER_ETHREI +#define IER_ELSI 0x04 /* Enable Line Status Int */ +#define Rx_BIT IER_ELSI +#define IER_EMSI 0x08 /* Enable Modem Status Int */ + +/* Modem Control Register */ + +#define MCR_DTR 0x01 /* state of DTR output */ +#define DTR MCR_DTR +#define MCR_RTS 0x02 /* state of RTS output */ +#define MCR_OUT1 0x04 /* UNUSED in ST16552 */ +#define MCR_INT 0x08 /* Int Mode */ +#define MCR_LOOP 0x10 /* Enable Loopback mode */ + +/* Modem Status Register */ + +#define MSR_DCTS 0x01 /* change in CTS */ +#define MSR_DDSR 0x02 /* change in DSR */ +#define MSR_TERI 0x04 /* change in RI */ +#define MSR_DDCD 0x08 /* change in DCD */ +#define MSR_CTS 0x10 /* state of CTS input */ +#define MSR_DSR 0x20 /* state of DSR input */ +#define MSR_RI 0x40 /* state of RI input */ +#define MSR_DCD 0x80 /* state of DCD input */ + +/* FIFO Control Register */ + +#define FCR_EN 0x01 /* FIFO Enable */ +#define FIFO_ENABLE FCR_EN +#define FCR_RXCLR 0x02 /* Rx FIFO Clear */ +#define RxCLEAR FCR_RXCLR +#define FCR_TXCLR 0x04 /* Tx FIFO Clear */ +#define TxCLEAR FCR_TXCLR +#define FCR_DMA 0x08 /* FIFO Mode Control */ +#define FCR_RXTRIG_L 0x40 /* FIFO Trigger level Low */ +#define FCR_RXTRIG_H 0x80 /* FIFO Trigger level High */ + + +typedef struct st16552_chan /* ST16552_CHAN */ + { + /* must be first */ + + SIO_CHAN sio; /* standard SIO_CHAN element */ + + /* callbacks */ + + STATUS (*getTxChar) (); /* installed Tx callback routine */ + STATUS (*putRcvChar) (); /* installed Rx callback routine */ + void * getTxArg; /* argument to Tx callback routine */ + void * putRcvArg; /* argument to Rx callback routine */ + + UINT8 * regs; /* ST16552 registers */ + UINT8 level; /* Interrupt level for this device */ + UINT8 ier; /* copy of IER */ + UINT8 lcr; /* copy of LCR */ + + UINT32 channelMode; /* such as INT, POLL modes */ + UINT32 regDelta; /* register address spacing */ + int baudRate; /* the current baud rate */ + UINT32 xtal; /* UART clock frequency */ + + } ST16552_CHAN; + + +/* structure used as parameter to multiplexed interrupt handler */ + +typedef struct st16552_mux /* ST16552_MUX */ + { + int nextChan; /* next channel to examine on int */ + ST16552_CHAN * pChan; /* array of ST16552_CHAN structs */ + } ST16552_MUX; + + +/* function declarations */ + +extern void st16552Int (ST16552_CHAN *); +extern void st16552MuxInt(ST16552_MUX *); +extern void st16552DevInit (ST16552_CHAN *); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCst16552Sioh */ diff --git a/h/drv/sio/templateSio.h b/h/drv/sio/templateSio.h new file mode 100644 index 0000000..39d681f --- /dev/null +++ b/h/drv/sio/templateSio.h @@ -0,0 +1,78 @@ +/* templateSio.h - header file for template serial driver */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,26apr02,dat Adding cplusplus protection, SPR 75017 +01e,29sep01,dat Rework for adaptor type struct, new API is just + create and destroy. +01d,01jul97,db added registers and defines for modem control. +01c,24feb97,dat used SIO_CHAN as first structure element, + instead of SIO_DRV_FUNCS *. +01b,17dec96,dat added 'options' to chan structure. +01a,02aug95,ms written. +*/ + +#ifndef __INCtemplateSioh +#define __INCtemplateSioh + +#include "sioLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This driver for a generic SIO device only uses 8 bit reads/writes. + * These are the register offsets for our fictitious device. + * + * Control Register 0x0 (write) + * Status Register 0x0 (read) + * Data register 0x1 (read/write) + * Modem Status Register 0x2 (read) + * Modem Control Register 0x2 (write) + * Baud Rate Control Reg. 0x3 (read/write) + * + * The template driver uses 3 interrupt vectors. + * Receive Interrupt 0x0 + * Transmit Interrupt 0x1 + * Error/Modem Interrupt 0x2 + * + * Other adaptor functions used include: + * intConnect, intDisconnect. + */ + +#define TEMPLATE_CSR_ID 0x0 /* register offsets */ +#define TEMPLATE_DATA_ID 0x1 +#define TEMPLATE_MSR_ID 0x2 +#define TEMPLATE_BAUD_ID 0x3 + +#define TEMPLATE_RXINT_ID 0x0 /* vector offsets */ +#define TEMPLATE_TXINT_ID 0x1 +#define TEMPLATE_ERRINT_ID 0x2 + +/* + * Here is the real API for creating and destroying an instance of a template + * SIO device. Use the standard sioLib functions + * for manipulating the device. The only really device specific + * functions are for creation and destruction. + */ + +IMPORT SIO_CHAN * templateSioCreate /* create an instance */ + ( + UINT32 ioBase, /* device adaptor specific data */ + UINT32 vecBase, /* vector base number */ + UINT32 intLevel, /* interrupt level for vectors */ + UINT32 clkFreq /* device clock frequency */ + ); + +IMPORT STATUS templateSioDestroy /* destroy an instance */ + (SIO_CHAN *); /* must be a template SIO type object */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtemplateSioh */ diff --git a/h/drv/sio/z8530Sio.h b/h/drv/sio/z8530Sio.h new file mode 100644 index 0000000..f530327 --- /dev/null +++ b/h/drv/sio/z8530Sio.h @@ -0,0 +1,342 @@ +/* z8530Sio.h - header file for binary interface z8530 driver */ + +/* Copyright 1984-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,20may97,db added element options to Z8530_CHAN structure to + implement hardware options & modem control(SPR #1037). +01c,13oct95,ms added comments for what fields need to be set by the BSP +01b,15jun95,ms updated for new driver structure +01a,20dec94,ms written (from z8530Serial.h). +*/ + +#ifndef __INCwdbz8530h +#define __INCwdbz8530h + +#include "sioLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* device and channel structures */ + +/* The BSP must initilize all Z8530_CHAN fields which say "BSP:" */ + +typedef struct /* Z8530_CHAN */ + { + /* always goes first */ + + SIO_DRV_FUNCS * pDrvFuncs; /* driver functions */ + + /* callbacks */ + + STATUS (*getTxChar) (); /* pointer to xmitr function */ + STATUS (*putRcvChar) (); /* pointer to rcvr functione */ + void * getTxArg; + void * putRcvArg; + + /* control and data register addresses */ + + volatile char * cr; /* BSP: control register I/O address */ + volatile char * dr; /* BSP: data port I/O address */ + + /* misc values */ + + int baudFreq; /* BSP: baud clock frequency */ + int baudRate; /* baud rate */ + int options; /* hardware options */ + char writeReg5; /* BSP: write register 5 value */ + char writeReg11; /* BSP: write register 11 value */ + char writeReg14; /* BSP: write register 14 value */ + + /* interrupt/polled mode configuration info */ + + uint_t mode; /* SIO_MODE_[INT | POLL] */ + char intVec; /* BSP: interrupt vector address */ + char intType; /* BSP: type of vector to supply from 8530 */ + uint_t channel; /* channel number (0 or 1) */ + } Z8530_CHAN; + +typedef struct + { + Z8530_CHAN portA; /* port A device descriptor */ + Z8530_CHAN portB; /* port B device descriptor */ + } Z8530_DUSART; + +/* channels */ + +#define SCC_CHANNEL_A 0 +#define SCC_CHANNEL_B 1 + +/* bit values for write register 0 */ +/* command register */ + +#define SCC_WR0_SEL_WR0 0x00 +#define SCC_WR0_SEL_WR1 0x01 +#define SCC_WR0_SEL_WR2 0x02 +#define SCC_WR0_SEL_WR3 0x03 +#define SCC_WR0_SEL_WR4 0x04 +#define SCC_WR0_SEL_WR5 0x05 +#define SCC_WR0_SEL_WR6 0x06 +#define SCC_WR0_SEL_WR7 0x07 +#define SCC_WR0_SEL_WR8 0x08 +#define SCC_WR0_SEL_WR9 0x09 +#define SCC_WR0_SEL_WR10 0x0a +#define SCC_WR0_SEL_WR11 0x0b +#define SCC_WR0_SEL_WR12 0x0c +#define SCC_WR0_SEL_WR13 0x0d +#define SCC_WR0_SEL_WR14 0x0e +#define SCC_WR0_SEL_WR15 0x0f +#define SCC_WR0_NULL_CODE 0x00 +#define SCC_WR0_RST_INT 0x10 +#define SCC_WR0_SEND_ABORT 0x18 +#define SCC_WR0_EN_INT_RX 0x20 +#define SCC_WR0_RST_TX_INT 0x28 +#define SCC_WR0_ERR_RST 0x30 +#define SCC_WR0_RST_HI_IUS 0x38 +#define SCC_WR0_RST_RX_CRC 0x40 +#define SCC_WR0_RST_TX_CRC 0x80 +#define SCC_WR0_RST_TX_UND 0xc0 + +/* write register 2 */ +/* interrupt vector */ + +/* bit values for write register 1 */ +/* tx/rx interrupt and data transfer mode definition */ + +#define SCC_WR1_EXT_INT_EN 0x01 +#define SCC_WR1_TX_INT_EN 0x02 +#define SCC_WR1_PARITY 0x04 +#define SCC_WR1_RX_INT_DIS 0x00 +#define SCC_WR1_RX_INT_FIR 0x08 +#define SCC_WR1_INT_ALL_RX 0x10 +#define SCC_WR1_RX_INT_SPE 0x18 +#define SCC_WR1_RDMA_RECTR 0x20 +#define SCC_WR1_RDMA_FUNC 0x40 +#define SCC_WR1_RDMA_EN 0x80 + +/* bit values for write register 3 */ +/* receive parameters and control */ + +#define SCC_WR3_RX_EN 0x01 +#define SCC_WR3_SYNC_CHAR 0x02 +#define SCC_WR3_ADR_SEARCH 0x04 +#define SCC_WR3_RX_CRC_EN 0x08 +#define SCC_WR3_ENTER_HUNT 0x10 +#define SCC_WR3_AUTO_EN 0x20 +#define SCC_WR3_RX_5_BITS 0x00 +#define SCC_WR3_RX_7_BITS 0x40 +#define SCC_WR3_RX_6_BITS 0x80 +#define SCC_WR3_RX_8_BITS 0xc0 + +/* bit values for write register 4 */ +/* tx/rx misc parameters and modes */ + +#define SCC_WR4_PAR_EN 0x01 +#define SCC_WR4_PAR_EVEN 0x02 +#define SCC_WR4_SYNC_EN 0x00 +#define SCC_WR4_1_STOP 0x04 +#define SCC_WR4_2_STOP 0x0c +#define SCC_WR4_8_SYNC 0x00 +#define SCC_WR4_16_SYNC 0x10 +#define SCC_WR4_SDLC 0x20 +#define SCC_WR4_EXT_SYNC 0x30 +#define SCC_WR4_1_CLOCK 0x00 +#define SCC_WR4_16_CLOCK 0x40 +#define SCC_WR4_32_CLOCK 0x80 +#define SCC_WR4_64_CLOCK 0xc0 + +/* bit values for write register 5 */ +/* transmit parameter and controls */ + +#define SCC_WR5_TX_CRC_EN 0x01 +#define SCC_WR5_RTS 0x02 +#define SCC_WR5_SDLC 0x04 +#define SCC_WR5_TX_EN 0x08 +#define SCC_WR5_SEND_BRK 0x10 + +#define SCC_WR5_TX_5_BITS 0x00 +#define SCC_WR5_TX_7_BITS 0x20 +#define SCC_WR5_TX_6_BITS 0x40 +#define SCC_WR5_TX_8_BITS 0x60 +#define SCC_WR5_DTR 0x80 + +/* write register 6 */ +/* sync chars or sdlc address field */ + +/* write register 7 */ +/* sync char or sdlc flag */ + +/* write register 8 */ +/* transmit buffer */ + +/* bit values for write register 9 */ +/* master interrupt control */ + +#define SCC_WR9_VIS 0x01 +#define SCC_WR9_NV 0x02 +#define SCC_WR9_DLC 0x04 +#define SCC_WR9_MIE 0x08 +#define SCC_WR9_STATUS_HI 0x10 +#define SCC_WR9_NO_RST 0x00 +#define SCC_WR9_CH_B_RST 0x40 +#define SCC_WR9_CH_A_RST 0x80 +#define SCC_WR9_HDWR_RST 0xc0 + +/* bit values for write register 10 */ +/* misc tx/rx control bits */ + +#define SCC_WR10_6_BIT_SYNC 0x01 +#define SCC_WR10_LOOP_MODE 0x02 +#define SCC_WR10_ABORT_UND 0x04 +#define SCC_WR10_MARK_IDLE 0x08 +#define SCC_WR10_ACT_POLL 0x10 +#define SCC_WR10_NRZ 0x00 +#define SCC_WR10_NRZI 0x20 +#define SCC_WR10_FM1 0x40 +#define SCC_WR10_FM0 0x60 +#define SCC_WR10_CRC_PRESET 0x80 + +/* bit values for write register 11 */ +/* clock mode control */ + +#define SCC_WR11_OUT_XTAL 0x00 +#define SCC_WR11_OUT_TX_CLK 0x01 +#define SCC_WR11_OUT_BR_GEN 0x02 +#define SCC_WR11_OUT_DPLL 0x03 +#define SCC_WR11_TRXC_OI 0x04 +#define SCC_WR11_TX_RTXC 0x00 +#define SCC_WR11_TX_TRXC 0x08 +#define SCC_WR11_TX_BR_GEN 0x10 +#define SCC_WR11_TX_DPLL 0x18 +#define SCC_WR11_RX_RTXC 0x00 +#define SCC_WR11_RX_TRXC 0x20 +#define SCC_WR11_RX_BR_GEN 0x40 +#define SCC_WR11_RX_DPLL 0x60 +#define SCC_WR11_RTXC_XTAL 0x80 + +/* write register 12 */ +/* lower byte of baud rate generator time constant */ + +/* write register 13 */ +/* upper byte of baud rate generator time constant */ + +/* bit values for write register 14 */ +/* misc control bits */ + +#define SCC_WR14_BR_EN 0x01 +#define SCC_WR14_BR_SRC 0x02 +#define SCC_WR14_DTR_FUNC 0x04 +#define SCC_WR14_AUTO_ECHO 0x08 +#define SCC_WR14_LCL_LOOP 0x10 +#define SCC_WR14_NULL 0x00 +#define SCC_WR14_SEARCH 0x20 +#define SCC_WR14_RST_CLK 0x40 +#define SCC_WR14_DIS_DPLL 0x60 +#define SCC_WR14_SRC_BR 0x80 +#define SCC_WR14_SRC_RTXC 0xa0 +#define SCC_WR14_FM_MODE 0xc0 +#define SCC_WR14_NRZI 0xe0 + +/* bit values for write register 15 */ +/* external/status interrupt control */ + +#define SCC_WR15_ZERO_CNT 0x02 +#define SCC_WR15_CD_IE 0x08 +#define SCC_WR15_SYNC_IE 0x10 +#define SCC_WR15_CTS_IE 0x20 +#define SCC_WR15_TX_UND_IE 0x40 +#define SCC_WR15_BREAK_IE 0x80 + +/* bit values for read register 0 */ +/* tx/rx buffer status and external status */ + +#define SCC_RR0_RX_AVAIL 0x01 +#define SCC_RR0_ZERO_CNT 0x02 +#define SCC_RR0_TX_EMPTY 0x04 +#define SCC_RR0_CD 0x08 +#define SCC_RR0_SYNC 0x10 +#define SCC_RR0_CTS 0x20 +#define SCC_RR0_TX_UND 0x40 +#define SCC_RR0_BREAK 0x80 + +/* bit values for read register 1 */ + +#define SCC_RR1_ALL_SENT 0x01 +#define SCC_RR1_RES_CD_2 0x02 +#define SCC_RR1_RES_CD_1 0x01 +#define SCC_RR1_RES_CD_0 0x08 +#define SCC_RR1_PAR_ERR 0x10 +#define SCC_RR1_RX_OV_ERR 0x20 +#define SCC_RR1_CRC_ERR 0x40 +#define SCC_RR1_END_FRAME 0x80 + +/* read register 2 */ +/* interrupt vector */ + +/* bit values for read register 3 */ +/* interrupt pending register */ + +#define SCC_RR3_B_EXT_IP 0x01 +#define SCC_RR3_B_TX_IP 0x02 +#define SCC_RR3_B_RX_IP 0x04 +#define SCC_RR3_A_EXT_IP 0x08 +#define SCC_RR3_A_TX_IP 0x10 +#define SCC_RR3_A_RX_IP 0x20 + +/* read register 8 */ +/* receive data register */ + +/* bit values for read register 10 */ +/* misc status bits */ + +#define SCC_RR10_ON_LOOP 0x02 +#define SCC_RR10_LOOP_SEND 0x10 +#define SCC_RR10_2_CLK_MIS 0x40 +#define SCC_RR10_1_CLK_MIS 0x80 + +/* read register 12 */ +/* lower byte of time constant */ + +/* read register 13 */ +/* upper byte of time constant */ + +/* bit values for read register 15 */ +/* external/status ie bits */ + +#define SCC_RR15_ZERO_CNT 0x02 +#define SCC_RR15_CD_IE 0x08 +#define SCC_RR15_SYNC_IE 0x10 +#define SCC_RR15_CTS_IE 0x20 +#define SCC_RR15_TX_UND_IE 0x40 +#define SCC_RR15_BREAK_IE 0x80 + +#if defined(__STDC__) || defined(__cplusplus) + +extern void z8530DevInit (Z8530_DUSART *pDusart); + +extern void z8530IntWr (Z8530_CHAN * pChan); +extern void z8530IntRd (Z8530_CHAN * pChan); +extern void z8530IntEx (Z8530_CHAN * pChan); +extern void z8530Int (Z8530_DUSART *pDusart); + +#else /* __STDC__ */ + +extern void z8530DevInit (); + +extern void z8530IntWr (); +extern void z8530IntRd (); +extern void z8530IntEx (); +extern void z8530Int (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbz8530h */ + diff --git a/h/drv/sound/ac97.h b/h/drv/sound/ac97.h new file mode 100644 index 0000000..f0f08f4 --- /dev/null +++ b/h/drv/sound/ac97.h @@ -0,0 +1,198 @@ +/* ac97.h - AC97 header file */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,18apr01,dmh public api provided for manually adjusting codec registers +01b,31oct00,dmh extended to support ac97mixer.c +01a,14mar00,jlb written. +*/ + +#ifndef __INCac97h +#define __INCac97h + +#include +#include + +#if __cplusplus +extern "C" { +#endif + +/* + + DESCRIPTION + + This file provides definitions for the Intel Audio Codec 97 + + */ + + +#define AC97_RESET 0x0000 /* Reset */ +#define AC97_MASTER_VOL_STEREO 0x0002 /* Line Out */ +#define AC97_HEADPHONE_VOL 0x0004 +#define AC97_MASTER_VOL_MONO 0x0006 +#define AC97_MASTER_TONE 0x0008 +#define AC97_PCBEEP_VOL 0x000a +#define AC97_PHONE_VOL 0x000c +#define AC97_MIC_VOL 0x000e +#define AC97_LINEIN_VOL 0x0010 +#define AC97_CD_VOL 0x0012 +#define AC97_VIDEO_VOL 0x0014 +#define AC97_AUX_VOL 0x0016 +#define AC97_PCMOUT_VOL 0x0018 +#define AC97_RECORD_SELECT 0x001a +#define AC97_RECORD_GAIN 0x001c +#define AC97_RECORD_GAIN_MIC 0x001e +#define AC97_GENERAL_PURPOSE 0x0020 +#define AC97_3D_CONTROL 0x0022 +#define AC97_MODEM_RATE 0x0024 +#define AC97_POWER_CONTROL 0x0026 + +/* registers 0x0028 - 0x0058 are reserved */ + +/* AC'97 2.0 */ +#define AC97_EXTENDED_ID 0x0028 /* Extended Audio ID */ +#define AC97_EXTENDED_STATUS 0x002A /* Extended Audio Status */ +#define AC97_PCM_FRONT_DAC_RATE 0x002C /* PCM Front DAC Rate */ +#define AC97_PCM_SURR_DAC_RATE 0x002E /* PCM Surround DAC Rate */ +#define AC97_PCM_LFE_DAC_RATE 0x0030 /* PCM LFE DAC Rate */ +#define AC97_PCM_LR_DAC_RATE 0x0032 /* PCM LR DAC Rate */ +#define AC97_PCM_MIC_ADC_RATE 0x0034 /* PCM MIC ADC Rate */ +#define AC97_CENTER_LFE_MASTER 0x0036 /* Center + LFE Master Volume */ +#define AC97_SURROUND_MASTER 0x0038 /* Surround (Rear) Master Volume */ +#define AC97_RESERVED_3A 0x003A /* Reserved */ +/* range 0x3c-0x58 - MODEM */ + +/* registers 0x005a - 0x007a are vendor reserved */ + +#define AC97_VENDOR_ID1 0x007c +#define AC97_VENDOR_ID2 0x007e + +/* volume control bit defines */ + +#define AC97_MUTE 0x8000 +#define AC97_MICBOOST 0x0040 +#define AC97_LEFTVOL 0x3f00 +#define AC97_RIGHTVOL 0x003f + +/* record mux defines */ + +#define AC97_RECMUX_MIC 0x0000 +#define AC97_RECMUX_CD 0x0101 +#define AC97_RECMUX_VIDEO 0x0202 /* not used */ +#define AC97_RECMUX_AUX 0x0303 +#define AC97_RECMUX_LINE 0x0404 +#define AC97_RECMUX_STEREO_MIX 0x0505 +#define AC97_RECMUX_MONO_MIX 0x0606 +#define AC97_RECMUX_PHONE 0x0707 + + +/* general purpose register bit defines */ + +#define AC97_GP_LPBK 0x0080 /* Loopback mode */ +#define AC97_GP_MS 0x0100 /* Mic Select 0=Mic1, 1=Mic2 */ +#define AC97_GP_MIX 0x0200 /* Mono output select 0=Mix, 1=Mic */ +#define AC97_GP_RLBK 0x0400 /* Remote Loopback - Modem line codec */ +#define AC97_GP_LLBK 0x0800 /* Local Loopback - Modem Line codec */ +#define AC97_GP_LD 0x1000 /* Loudness 1=on */ +#define AC97_GP_3D 0x2000 /* 3D Enhancement 1=on */ +#define AC97_GP_ST 0x4000 /* Stereo Enhancement 1=on */ +#define AC97_GP_POP 0x8000 /* Pcm Out Path, 0=pre 3D, 1=post 3D */ + + +/* powerdown control and status bit defines */ + +/* status */ +#define AC97_PWR_MDM 0x0010 /* Modem section ready */ +#define AC97_PWR_REF 0x0008 /* Vref nominal */ +#define AC97_PWR_ANL 0x0004 /* Analog section ready */ +#define AC97_PWR_DAC 0x0002 /* DAC section ready */ +#define AC97_PWR_ADC 0x0001 /* ADC section ready */ + +/* control */ +#define AC97_PWR_PR0 0x0100 /* ADC and Mux powerdown */ +#define AC97_PWR_PR1 0x0200 /* DAC powerdown */ +#define AC97_PWR_PR2 0x0400 /* Output mixer powerdown (Vref on) */ +#define AC97_PWR_PR3 0x0800 /* Output mixer powerdown (Vref off) */ +#define AC97_PWR_PR4 0x1000 /* AC-link powerdown */ +#define AC97_PWR_PR5 0x2000 /* Internal Clk disable */ +#define AC97_PWR_PR6 0x4000 /* HP amp powerdown */ +#define AC97_PWR_PR7 0x8000 /* Modem off - if supported */ + +/* useful power states */ +#define AC97_PWR_D0 0x0000 /* everything on */ +#define AC97_PWR_D1 AC97_PWR_PR0 | AC97_PWR_PR1 | AC97_PWR_PR4 +#define AC97_PWR_D2 AC97_PWR_PR0 | AC97_PWR_PR1 | \ + AC97_PWR_PR2 | AC97_PWR_PR3 | AC97_PWR_PR4 +#define AC97_PWR_D3 AC97_PWR_PR0 | AC97_PWR_PR1 | \ + AC97_PWR_PR2 | AC97_PWR_PR3 | AC97_PWR_PR4 +#define AC97_PWR_ANLOFF AC97_PWR_PR2 | AC97_PWR_PR3 + +/* Total number of defined registers. */ +#define AC97_REG_CNT 64 + + struct ac97_dev; +struct ac97mixtable_entry; +struct ac97_fd; + +typedef struct ac97mixtable_entry + { + int reg:8; + unsigned bits:4; + unsigned ofs:4; + unsigned stereo:1; + unsigned mute:1; + unsigned recidx:4; + unsigned mask:1; + } AC97MIXTABLE_ENTRY; + +typedef struct ac97_fd + { + struct ac97_dev * pDev; + UINT32 devs; + UINT32 recSrc; + UINT32 recDevs; + SEM_ID semId; + } AC97_FD; + +typedef struct ac97_dev + { + DEV_HDR devHdr; + FUNCPTR init; + FUNCPTR read; + FUNCPTR write; + UINT32 key; + AC97MIXTABLE_ENTRY mix[32]; + AC97_FD mixer_fd; + } AC97_DEV; + + +#ifndef AC97MIXER_C +/* public api for custom applications + note: an AC97_DEV* may be obtained using iosDevFind, + iosNextDevGet, or iosFdDevFind*/ + +extern void ac97Write(AC97_DEV * pDev, UINT32 reg, UINT16 val); +extern UINT16 ac97Read(AC97_DEV * pDev, UINT32 reg); + +/* api to be used only by sound controller drivers + since only sound controllers understand how to read + and write to AC97 registers */ + +extern STATUS ac97MixerDrv(); +extern AC97_DEV* ac97MixerDevCreate(DEV_HDR* pDev, FUNCPTR rd, FUNCPTR wr); +#else +STATUS ac97MixerDrv(); +AC97_DEV* ac97MixerDevCreate(DEV_HDR* pDev, FUNCPTR rd, FUNCPTR wr); +void ac97Write(AC97_DEV * pDev, UINT32 reg, UINT16 val); +UINT16 ac97Read(AC97_DEV * pDev, UINT32 reg); +#endif + + +#if __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INCac97h */ diff --git a/h/drv/sound/sb16drv.h b/h/drv/sound/sb16drv.h new file mode 100644 index 0000000..0206903 --- /dev/null +++ b/h/drv/sound/sb16drv.h @@ -0,0 +1,230 @@ +/* sb16drv.h - global comment */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,21sep01,dat Fix ANSI violations for diab compiler +01b,03feb00,jk updated to reflect new sb16drv.c code drop. +01a,14oct99,jk extracted from file sb16drv.c. +*/ + +/* +DESCRIPTION + +*/ + +#ifndef __INCsb16drvh +#define __INCsb16drvh + +#include "drv/sound/sound_dma.h" +#include "drv/sound/sound_ioctl.h" + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#define INT_NUM_IRQ0 0x20 +#define INT_VEC_GET(irq) (INT_NUM_IRQ0 + irq) + +/* I/O ports */ + +#define SBP( codec, x ) ( (codec) -> port + s_b_SB_##x ) +#define SBP1( port, x ) ( (port) + s_b_SB_##x ) + +#define s_b_SB_RESET 0x6 +#define s_b_SB_READ 0xa +#define s_b_SB_WRITE 0xc +#define s_b_SB_COMMAND 0xc +#define s_b_SB_STATUS 0xc +#define s_b_SB_DATA_AVAIL 0xe +#define s_b_SB_DATA_AVAIL_16 0xf +#define s_b_SB_MIXER_ADDR 0x4 +#define s_b_SB_MIXER_DATA 0x5 +#define s_b_SB_OPL3_LEFT 0x0 +#define s_b_SB_OPL3_RIGHT 0x2 +#define s_b_SB_OPL3_BOTH 0x8 + +/* dsp commands + */ +#define SB_DSP_SAMPLE_RATE 0x40 +#define SB_DSP_SAMPLE_RATE_OUT 0x41 +#define SB_DSP_SAMPLE_RATE_IN 0x42 +#define SB_DSP_MONO_8BIT 0xa0 +#define SB_DSP_MONO_16BIT 0xa4 +#define SB_DSP_STEREO_8BIT 0xa8 +#define SB_DSP_STEREO_16BIT 0xac +#define SB_DSP4_OUT16_AI 0xb6 +#define SB_DSP4_IN16_AI 0xbe +#define SB_DSP4_OUT8_AI 0xc6 +#define SB_DSP4_IN8_AI 0xce +#define SB_DSP_DMA8_OFF 0xd0 +#define SB_DSP_SPEAKER_ON 0xd1 +#define SB_DSP_SPEAKER_OFF 0xd3 +#define SB_DSP_DMA8_ON 0xd4 +#define SB_DSP_DMA16_OFF 0xd5 +#define SB_DSP_DMA16_ON 0xd6 +#define SB_DSP_DMA16_EXIT 0xd9 +#define SB_DSP_DMA8_EXIT 0xda +#define SB_DSP_GET_VERSION 0xe1 + +/* dsp input/output formats + */ +#define SB_DSP4_MODE_UNS_MONO 0x00 +#define SB_DSP4_MODE_SIGN_MONO 0x10 +#define SB_DSP4_MODE_UNS_STEREO 0x20 +#define SB_DSP4_MODE_SIGN_STEREO 0x30 + +/* OPL3 commands + */ +#define TEST_REGISTER 0x01 +#define TIMER_CONTROL_REGISTER 0x04 /* Left side */ +#define CONNECTION_SELECT_REGISTER 0x04 /* Right side */ +#define OPL3_MODE_REGISTER 0x05 /* Right side */ +#define KEYON_BLOCK 0xb0 /* Left side ???*/ +#define PERCUSSION_REGISTER 0xbd /* Left side only */ + +#define TIMER1_REGISTER 0x02 +#define TIMER2_REGISTER 0x03 + +/* TEST_REGISTER options + */ +#define ENABLE_WAVE_SELECT 0x20 + +/* TIMER_CONTROL_REGISTER options + */ +#define IRQ_RESET 0x80 +#define TIMER1_MASK 0x40 +#define TIMER2_MASK 0x20 + +/* OPL3_MODE_REGISTER options + */ +#define OPL3_ENABLE 0x01 + +/* Mixer commands + */ +#define SB_MIXER_MASTER_DEV 0x30 +#define SB_MIXER_PCM_DEV 0x32 +#define SB_MIXER_SYNTH_DEV 0x34 +#define SB_MIXER_CD_DEV 0x36 +#define SB_MIXER_LINE_DEV 0x38 +#define SB_MIXER_MIC_DEV 0x3a +#define SB_MIXER_SPEAKER_DEV 0x3b +#define SB_MIXER_OUTPUT_SW 0x3c +#define SB_MIXER_IGAIN_DEV 0x3f +#define SB_MIXER_OGAIN_DEV 0x41 +#define SB_MIXER_MIC_AGC 0x43 +#define SB_MIXER_TREBLE_DEV 0x44 +#define SB_MIXER_BASS_DEV 0x46 +#define SB_MIXER_IRQ_NR 0x80 +#define SB_MIXER_DMA_NR 0x81 +#define SB_MIXER_IRQ_STAT 0x82 +#define SB_MIXER_MPU_NR 0x84 + +#define RATE_MIN 4000 +#define RATE_MAX 44100 + +#define MAX_DMA_MSGS 2 +#define MAX_DMA_SIZE 32768 + +#define TASK_PRIORITY 0 +#define TASK_OPTIONS 0 +#define TASK_STACK_SIZE 2048 + +typedef struct +{ + char *name; + int reg; + int max_value; + int shift; + int unknownfield; +} MIXER_INFO; + +typedef struct +{ + char *buffer; + int length; + int direction; +} DMA_MSG; + +typedef struct snd_fd_struct SND_FD; +typedef struct dsp_fd_struct DSP_FD; +typedef struct mixer_fd_struct MIXER_FD; + +typedef struct +{ + DEV_HDR devHdr; + + unsigned short port; /* base port of DSP chip */ + unsigned short mpu_port; /* MPU port for SB DSP 4.0+ */ + unsigned short irq; /* IRQ number of DSP chip */ + unsigned short dma8; /* 8-bit DMA */ + unsigned short dma16; /* 16-bit DMA */ + + unsigned short version; /* version of DSP chip */ + + SEM_ID devSem; + SEM_ID intSem; + SEM_ID bufSem; + MSG_Q_ID dmaQ; + + DSP_FD *pDsp; + MIXER_FD *pMixer; + + int dmaIndex; + + int tid; + int taskBusy; + int dmaAuto; + +} SND_DEV; + +struct snd_fd_struct +{ + SND_DEV *pDev; + + FUNCPTR fdClose; + FUNCPTR fdRead; + FUNCPTR fdWrite; + FUNCPTR fdIoctl; +}; + +struct dsp_fd_struct +{ + SND_FD dev; + + int dmaDirection; + int dmaChannel; + + snd_info_t info; +}; + +struct mixer_fd_struct +{ + SND_FD dev; +}; + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +STATUS sb16Drv (void); +STATUS sb16DevCreate (char *devName, int port, int irq, int dma8, int dma16); + +#else + +STATUS sb16Drv (); +STATUS sb16DevCreate (); + +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCsb16drvh */ + diff --git a/h/drv/sound/sound_dma.h b/h/drv/sound/sound_dma.h new file mode 100644 index 0000000..b56be53 --- /dev/null +++ b/h/drv/sound/sound_dma.h @@ -0,0 +1,198 @@ +/* sound_dma.h - i8237Dma helper functions */ + +/* Copyright 1999-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,26apr02,dat Adding cplusplus protection, SPR 75017 +01a,03oct99,spm created. +*/ + +#ifndef _INCsound_dmah +#define _INCsound_dmah + +#include "drv/dma/i8237Dma.h" +#include "cacheLib.h" +#include "sysLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * DMA transfers are limited to the lower 16MB of _physical_ memory. + * + */ +#define MAX_DMA_ADDRESS 0xFFFFFF + +/* DMA page registers + */ +#define DMA_PAGE_0 0x87 +#define DMA_PAGE_1 0x83 +#define DMA_PAGE_2 0x81 +#define DMA_PAGE_3 0x82 +#define DMA_PAGE_5 0x8B +#define DMA_PAGE_6 0x89 +#define DMA_PAGE_7 0x8A + +/* enable/disable a DMA channel + */ +static __inline__ void enable_dma (unsigned int dmanr) +{ + if (dmanr <= 3) + sysOutByte (DMA1_MASK_SINGLE, dmanr); + else + sysOutByte (DMA2_MASK_SINGLE, dmanr & 3); +} + +static __inline__ void disable_dma (unsigned int dmanr) +{ + if (dmanr <= 3) + sysOutByte (DMA1_MASK_SINGLE, dmanr | 4); + else + sysOutByte (DMA2_MASK_SINGLE, (dmanr & 3) | 4); +} + + +/* Clear the 'DMA Pointer Flip Flop'. + * Write 0 for LSB/MSB, 1 for MSB/LSB access. + */ +static __inline__ void clear_dma_ff (unsigned int dmanr) +{ + if (dmanr <= 3) + sysOutByte (DMA1_CLEAR_FF, 0); + else + sysOutByte (DMA2_CLEAR_FF, 0); +} + + +/* set mode for a DMA channel + */ +static __inline__ void set_dma_mode (unsigned int dmanr, char mode) +{ + if (dmanr <= 3) + sysOutByte (DMA1_MODE, mode | dmanr); + else + sysOutByte (DMA2_MODE, mode | (dmanr&3)); +} + + +/* Set the page register bits of the transfer address. + */ +static __inline__ void set_dma_page (unsigned int dmanr, char pagenr) +{ + switch (dmanr) + { + case 0: + sysOutByte (DMA_PAGE_0, pagenr); + break; + case 1: + sysOutByte (DMA_PAGE_1, pagenr); + break; + case 2: + sysOutByte (DMA_PAGE_2, pagenr); + break; + case 3: + sysOutByte (DMA_PAGE_3, pagenr); + break; + case 5: + sysOutByte (DMA_PAGE_5, pagenr); + break; + case 6: + sysOutByte (DMA_PAGE_6, pagenr); + break; + case 7: + sysOutByte (DMA_PAGE_7, pagenr); + break; + } +} + + +/* Set transfer address & page bits for a DMA channel. + */ +static __inline__ void set_dma_addr (unsigned int dmanr, unsigned int a) +{ + set_dma_page (dmanr, a>>16); + + if (dmanr <= 3) + { + sysOutByte (((dmanr&3)<<1) + DMA1_BASE, a & 0xff); + sysOutByte (((dmanr&3)<<1) + DMA1_BASE, (a>>8) & 0xff); + } + else + { + sysOutByte (((dmanr&3)<<2) + DMA2_BASE, (a>>1) & 0xff); + sysOutByte (((dmanr&3)<<2) + DMA2_BASE, (a>>9) & 0xff); + } +} + + +/* Set transfer size (max 64k for DMA1..3, 128k for DMA5..7) for + * a DMA channel. + */ +static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count) +{ + count--; + if (dmanr <= 3) + { + sysOutByte (((dmanr&3)<<1) + 1 + DMA1_BASE, count & 0xff); + sysOutByte (((dmanr&3)<<1) + 1 + DMA1_BASE, (count>>8) & 0xff); + } + else + { + sysOutByte (((dmanr&3)<<2) + 2 + DMA2_BASE, (count>>1) & 0xff); + sysOutByte (((dmanr&3)<<2) + 2 + DMA2_BASE, (count>>9) & 0xff); + } +} + +static __inline__ int get_dma_residue(unsigned int dmanr) +{ + unsigned int io_port = + (dmanr<=3) ? ((dmanr&3)<<1) + 1 + DMA1_BASE + : ((dmanr&3)<<2) + 2 + DMA2_BASE; + /* using short to get 16-bit wrap around */ + unsigned short count; + + count = 1 + (unsigned char)sysInByte (io_port); + count += (unsigned char)sysInByte (io_port) << 8; + + return (dmanr<=3) ? count : (count<<1); +} + +/* Don't use the vxWorks dmaSetup + */ +#define dmaSetup __inline__dmaSetup + +/* Instead, use this one. + */ +static __inline__ void dmaSetup (int mode, char *buf, int size, int dma) +{ + disable_dma (dma); + sysDelay (); + clear_dma_ff (dma); + sysDelay (); + set_dma_mode (dma, mode); + set_dma_addr (dma, (int)buf); + set_dma_count (dma, size); + sysDelay (); + enable_dma (dma); +} + +static __inline__ int dmaResidue (int dma) +{ + int residue; + + disable_dma (dma); + clear_dma_ff (dma); + residue = get_dma_residue (dma); + enable_dma (dma); + + return residue; +} + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsound_dmah */ diff --git a/h/drv/sound/sound_ioctl.h b/h/drv/sound/sound_ioctl.h new file mode 100644 index 0000000..402c260 --- /dev/null +++ b/h/drv/sound/sound_ioctl.h @@ -0,0 +1,52 @@ +/* sound_ioctl.h - Sound driver generic interface */ + +/* Copyright 1999-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,26apr02,dat Adding cplusplus protection, SPR 75017 +01a,03oct99,spm created. +*/ + + +#ifndef _INCsound_ioctlh +#define _INCsound_ioctlh + +#ifndef linux +#include "ioLib.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct +{ + unsigned long rate; /* Samples per second */ + unsigned int stereo; /* 0=mono, 1=stereo */ + unsigned int sampleSize; /* 8 or 16 bits per sample */ + unsigned int uLaw; /* 1 = uLaw, 0 = PCM */ +} snd_info_t; + +#define SNDCTL_BASE 0x4000 + +#define SNDCTL_DSP_SYNC (SNDCTL_BASE + 0x01) +#define SNDCTL_DSP_GETBLKSIZE (SNDCTL_BASE + 0x02) + +#define SNDCTL_DSP_SPEED (SNDCTL_BASE + 0x11) +#define SNDCTL_DSP_STEREO (SNDCTL_BASE + 0x12) +#define SNDCTL_DSP_SAMPLESIZE (SNDCTL_BASE + 0x13) +#define SNDCTL_DSP_SETFORMAT (SNDCTL_BASE + 0x14) + +#define SNDCTL_GET_INFO (SNDCTL_BASE + 0x21) +#define SNDCTL_SET_INFO (SNDCTL_BASE + 0x22) + +#define SNDCTL_SET_VOLUME (SNDCTL_BASE + 0x23) +#define SNDCTL_GET_VOLUME (SNDCTL_BASE + 0x24) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsound_ioctlh */ diff --git a/h/drv/sound/soundcard.h b/h/drv/sound/soundcard.h new file mode 100644 index 0000000..0bcb727 --- /dev/null +++ b/h/drv/sound/soundcard.h @@ -0,0 +1,1405 @@ +/* soundcard.h - Sound Support header file */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,15sep00,jlb Upgrade to release OSS release 3.9.2 +01a,15mar00,jlb port to VxWorks +*/ + +/* + +DESCRIPTION + +This file is the standard soundcard.h file that is present from the Open +Sound System (OSS) with minor modifications to function within the Vxworks +framework. + +*/ +#ifndef SOUNDCARD_H +#define SOUNDCARD_H +/* + * Copyright by Hannu Savolainen 1993-1999 + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. 2. + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(__cplusplus) +#define EXTERNC extern "C" +#else +#define EXTERNC extern +#endif /* EXTERN_C_WRAPPERS */ + +/* + * OSS interface version. With versions earlier than 3.6 this value is + * an integer with value less than 361. In versions 3.6 and later + * it's a six digit hexadecimal value. For example value + * of 0x030600 represents OSS version 3.6.0. + * Use ioctl(fd, OSS_GETVERSION, &int) to get the version number of + * the currently active driver. + */ +#define SOUND_VERSION 0x030902 +#define OPEN_SOUND_SYSTEM + +#if defined(__hpux) && !defined(_HPUX_SOURCE) +# error "-D_HPUX_SOURCE must be used when compiling OSS applications" +#endif + +#ifdef linux +/* In Linux we need to be prepared for cross compiling */ +#include +#else +# ifdef __FreeBSD__ +# include +# else +# include +# endif +#endif + +/* + * Supported card ID numbers (Should be somewhere else?) + */ + +#define SNDCARD_ADLIB 1 +#define SNDCARD_SB 2 +#define SNDCARD_PAS 3 +#define SNDCARD_GUS 4 +#define SNDCARD_MPU401 5 +#define SNDCARD_SB16 6 +#define SNDCARD_SB16MIDI 7 +#define SNDCARD_UART6850 8 +#define SNDCARD_GUS16 9 +#define SNDCARD_MSS 10 +#define SNDCARD_PSS 11 +#define SNDCARD_SSCAPE 12 +#define SNDCARD_PSS_MPU 13 +#define SNDCARD_PSS_MSS 14 +#define SNDCARD_SSCAPE_MSS 15 +#define SNDCARD_TRXPRO 16 +#define SNDCARD_TRXPRO_SB 17 +#define SNDCARD_TRXPRO_MPU 18 +#define SNDCARD_MAD16 19 +#define SNDCARD_MAD16_MPU 20 +#define SNDCARD_CS4232 21 +#define SNDCARD_CS4232_MPU 22 +#define SNDCARD_MAUI 23 +#define SNDCARD_PSEUDO_MSS 24 +#define SNDCARD_GUSPNP 25 +#define SNDCARD_UART401 26 +/* Soundcard numbers 27 to N are reserved. Don't add more numbers here */ + +/*********************************** + * IOCTL Commands for /dev/sequencer + */ + +#ifndef __SIOWR +#if defined(__hpux) || (defined(_IOWR) && (defined(_AIX) || (!defined(sun) && !defined(sparc) && !defined(__INCioctlh) && !defined(__Lynx__)))) +/* Use already defined ioctl defines if they exist (except with Sun and some others) */ +#define SIOCPARM_MASK IOCPARM_MASK +#define SIOC_VOID IOC_VOID +#define SIOC_OUT IOC_OUT +#define SIOC_IN IOC_IN +#define SIOC_INOUT IOC_INOUT +#define __SIOC_SIZE _IOC_SIZE +#define __SIOC_DIR _IOC_DIR +#define __SIOC_NONE _IOC_NONE +#define __SIOC_READ _IOC_READ +#define __SIOC_WRITE _IOC_WRITE +#define __SIO _IO +#define __SIOR _IOR +#define __SIOW _IOW +#define __SIOWR _IOWR +#else + +/* Ioctl's have the command encoded in the lower word, + * and the size of any in or out parameters in the upper + * word. The high 2 bits of the upper word are used + * to encode the in/out status of the parameter; for now + * we restrict parameters to at most 8191 bytes. + */ +/* #define SIOCTYPE (0xff<<8) */ +#define SIOCPARM_MASK 0x1fff /* parameters must be < 8192 bytes */ +#define SIOC_VOID 0x00000000 /* no parameters */ +#define SIOC_OUT 0x20000000 /* copy out parameters */ +#define SIOC_IN 0x40000000 /* copy in parameters */ +#define SIOC_INOUT (SIOC_IN|SIOC_OUT) +/* the 0x20000000 is so we can distinguish new ioctl's from old */ +#define __SIO(x,y) ((int)(SIOC_VOID|(x<<8)|y)) +#define __SIOR(x,y,t) ((int)(SIOC_OUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) +#define __SIOW(x,y,t) ((int)(SIOC_IN|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) +#define __SIOWR(x,y,t) ((int)(SIOC_INOUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) +#define __SIOC_SIZE(x) ((x>>16)&SIOCPARM_MASK) +#define __SIOC_DIR(x) (x & 0xf0000000) +#define __SIOC_NONE SIOC_VOID +#define __SIOC_READ SIOC_OUT +#define __SIOC_WRITE SIOC_IN +# endif /* _IOWR */ +#endif /* !__SIOWR */ + +#define SNDCTL_SEQ_RESET __SIO ('Q', 0) +#define SNDCTL_SEQ_SYNC __SIO ('Q', 1) +#define SNDCTL_SYNTH_INFO __SIOWR('Q', 2, struct synth_info) +#define SNDCTL_SEQ_CTRLRATE __SIOWR('Q', 3, int) /* Set/get timer resolution (HZ) */ +#define SNDCTL_SEQ_GETOUTCOUNT __SIOR ('Q', 4, int) +#define SNDCTL_SEQ_GETINCOUNT __SIOR ('Q', 5, int) +#define SNDCTL_SEQ_PERCMODE __SIOW ('Q', 6, int) +#define SNDCTL_FM_LOAD_INSTR __SIOW ('Q', 7, struct sbi_instrument) /* Obsolete. Don't use!!!!!! */ +#define SNDCTL_SEQ_TESTMIDI __SIOW ('Q', 8, int) +#define SNDCTL_SEQ_RESETSAMPLES __SIOW ('Q', 9, int) +#define SNDCTL_SEQ_NRSYNTHS __SIOR ('Q',10, int) +#define SNDCTL_SEQ_NRMIDIS __SIOR ('Q',11, int) +#define SNDCTL_MIDI_INFO __SIOWR('Q',12, struct midi_info) +#define SNDCTL_SEQ_THRESHOLD __SIOW ('Q',13, int) +#define SNDCTL_SYNTH_MEMAVL __SIOWR('Q',14, int) /* in=dev#, out=memsize */ +#define SNDCTL_FM_4OP_ENABLE __SIOW ('Q',15, int) /* in=dev# */ +#define SNDCTL_SEQ_PANIC __SIO ('Q',17) +#define SNDCTL_SEQ_OUTOFBAND __SIOW ('Q',18, struct seq_event_rec) +#define SNDCTL_SEQ_GETTIME __SIOR ('Q',19, int) +#define SNDCTL_SYNTH_ID __SIOWR('Q',20, struct synth_info) +#define SNDCTL_SYNTH_CONTROL __SIOWR('Q',21, struct synth_control) +#define SNDCTL_SYNTH_REMOVESAMPLE __SIOWR('Q',22, struct remove_sample) + +typedef struct synth_control +{ + int devno; /* Synthesizer # */ + char data[4000]; /* Device spesific command/data record */ +}synth_control; + +typedef struct remove_sample +{ + int devno; /* Synthesizer # */ + int bankno; /* MIDI bank # (0=General MIDI) */ + int instrno; /* MIDI instrument number */ +} remove_sample; + +typedef struct seq_event_rec { + unsigned char arr[8]; +} seq_event_rec; + +#define SNDCTL_TMR_TIMEBASE __SIOWR('T', 1, int) +#define SNDCTL_TMR_START __SIO ('T', 2) +#define SNDCTL_TMR_STOP __SIO ('T', 3) +#define SNDCTL_TMR_CONTINUE __SIO ('T', 4) +#define SNDCTL_TMR_TEMPO __SIOWR('T', 5, int) +#define SNDCTL_TMR_SOURCE __SIOWR('T', 6, int) +# define TMR_INTERNAL 0x00000001 +# define TMR_EXTERNAL 0x00000002 +# define TMR_MODE_MIDI 0x00000010 +# define TMR_MODE_FSK 0x00000020 +# define TMR_MODE_CLS 0x00000040 +# define TMR_MODE_SMPTE 0x00000080 +#define SNDCTL_TMR_METRONOME __SIOW ('T', 7, int) +#define SNDCTL_TMR_SELECT __SIOW ('T', 8, int) + +/* + * Some big endian/little endian handling macros + */ + +#if defined(_AIX) || defined(AIX) || defined(sparc) || defined(__hppa) || defined(PPC) +/* Big endian machines */ +# define _PATCHKEY(id) (0xfd00|id) +# define AFMT_S16_NE AFMT_S16_BE +# define AFMT_U16_NE AFMT_U16_BE +# define AFMT_S32_NE AFMT_S32_BE +#else +# define _PATCHKEY(id) ((id<<8)|0xfd) +# define AFMT_S16_NE AFMT_S16_LE +# define AFMT_U16_NE AFMT_U16_LE +# define AFMT_S32_NE AFMT_S32_LE +#endif + +/* + * Sample loading mechanism for internal synthesizers (/dev/sequencer) + * The following patch_info structure has been designed to support + * Gravis UltraSound. It tries to be universal format for uploading + * sample based patches but is probably too limited. + */ + +struct patch_info { + unsigned short key; /* Use WAVE_PATCH here */ +#define WAVE_PATCH _PATCHKEY(0x04) +#define GUS_PATCH WAVE_PATCH + + short device_no; /* Synthesizer number */ + short instr_no; /* Midi pgm# */ + + unsigned int mode; +/* + * The least significant byte has the same format than the GUS .PAT + * files + */ +#define WAVE_16_BITS 0x01 /* bit 0 = 8 or 16 bit wave data. */ +#define WAVE_UNSIGNED 0x02 /* bit 1 = Signed - Unsigned data. */ +#define WAVE_LOOPING 0x04 /* bit 2 = looping enabled-1. */ +#define WAVE_BIDIR_LOOP 0x08 /* bit 3 = Set is bidirectional looping. */ +#define WAVE_LOOP_BACK 0x10 /* bit 4 = Set is looping backward. */ +#define WAVE_SUSTAIN_ON 0x20 /* bit 5 = Turn sustaining on. (Env. pts. 3)*/ +#define WAVE_ENVELOPES 0x40 /* bit 6 = Enable envelopes - 1 */ +#define WAVE_FAST_RELEASE 0x80 /* bit 7 = Shut off immediately after note off */ + /* (use the env_rate/env_offs fields). */ +/* Linux specific bits */ +#define WAVE_VIBRATO 0x00010000 /* The vibrato info is valid */ +#define WAVE_TREMOLO 0x00020000 /* The tremolo info is valid */ +#define WAVE_SCALE 0x00040000 /* The scaling info is valid */ +#define WAVE_FRACTIONS 0x00080000 /* Fraction information is valid */ +/* Reserved bits */ +#define WAVE_ROM 0x40000000 /* For future use */ +#define WAVE_MULAW 0x20000000 /* For future use */ +/* Other bits must be zeroed */ + + int len; /* Size of the wave data in bytes */ + int loop_start, loop_end; /* Byte offsets from the beginning */ + +/* + * The base_freq and base_note fields are used when computing the + * playback speed for a note. The base_note defines the tone frequency + * which is heard if the sample is played using the base_freq as the + * playback speed. + * + * The low_note and high_note fields define the minimum and maximum note + * frequencies for which this sample is valid. It is possible to define + * more than one samples for an instrument number at the same time. The + * low_note and high_note fields are used to select the most suitable one. + * + * The fields base_note, high_note and low_note should contain + * the note frequency multiplied by 1000. For example value for the + * middle A is 440*1000. + */ + + unsigned int base_freq; + unsigned int base_note; + unsigned int high_note; + unsigned int low_note; + int panning; /* -128=left, 127=right */ + int detuning; + +/* New fields introduced in version 1.99.5 */ + + /* Envelope. Enabled by mode bit WAVE_ENVELOPES */ + unsigned char env_rate[ 6 ]; /* GUS HW ramping rate */ + unsigned char env_offset[ 6 ]; /* 255 == 100% */ + + /* + * The tremolo, vibrato and scale info are not supported yet. + * Enable by setting the mode bits WAVE_TREMOLO, WAVE_VIBRATO or + * WAVE_SCALE + */ + + unsigned char tremolo_sweep; + unsigned char tremolo_rate; + unsigned char tremolo_depth; + + unsigned char vibrato_sweep; + unsigned char vibrato_rate; + unsigned char vibrato_depth; + + int scale_frequency; + unsigned int scale_factor; /* from 0 to 2048 or 0 to 2 */ + + int volume; + int fractions; + int reserved1; + int spare[2]; + char data[1]; /* The waveform data starts here */ + }; + +struct sysex_info { + short key; /* Use SYSEX_PATCH or MAUI_PATCH here */ +#define SYSEX_PATCH _PATCHKEY(0x05) +#define MAUI_PATCH _PATCHKEY(0x06) + short device_no; /* Synthesizer number */ + int len; /* Size of the sysex data in bytes */ + unsigned char data[1]; /* Sysex data starts here */ + }; + +/* + * /dev/sequencer input events. + * + * The data written to the /dev/sequencer is a stream of events. Events + * are records of 4 or 8 bytes. The first byte defines the size. + * Any number of events can be written with a write call. There + * is a set of macros for sending these events. Use these macros if you + * want to maximize portability of your program. + * + * Events SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO. Are also input events. + * (All input events are currently 4 bytes long. Be prepared to support + * 8 byte events also. If you receive any event having first byte >= 128, + * it's a 8 byte event. + * + * The events are documented at the end of this file. + * + * Normal events (4 bytes) + * There is also a 8 byte version of most of the 4 byte events. The + * 8 byte one is recommended. + */ +#define SEQ_NOTEOFF 0 +#define SEQ_FMNOTEOFF SEQ_NOTEOFF /* Just old name */ +#define SEQ_NOTEON 1 +#define SEQ_FMNOTEON SEQ_NOTEON +#define SEQ_WAIT TMR_WAIT_ABS +#define SEQ_PGMCHANGE 3 +#define SEQ_FMPGMCHANGE SEQ_PGMCHANGE +#define SEQ_SYNCTIMER TMR_START +#define SEQ_MIDIPUTC 5 +#define SEQ_DRUMON 6 /*** OBSOLETE ***/ +#define SEQ_DRUMOFF 7 /*** OBSOLETE ***/ +#define SEQ_ECHO TMR_ECHO /* For synching programs with output */ +#define SEQ_AFTERTOUCH 9 +#define SEQ_CONTROLLER 10 + +/******************************************* + * Midi controller numbers + ******************************************* + * Controllers 0 to 31 (0x00 to 0x1f) and + * 32 to 63 (0x20 to 0x3f) are continuous + * controllers. + * In the MIDI 1.0 these controllers are sent using + * two messages. Controller numbers 0 to 31 are used + * to send the MSB and the controller numbers 32 to 63 + * are for the LSB. Note that just 7 bits are used in MIDI bytes. + */ + +#define CTL_BANK_SELECT 0x00 +#define CTL_MODWHEEL 0x01 +#define CTL_BREATH 0x02 +/* undefined 0x03 */ +#define CTL_FOOT 0x04 +#define CTL_PORTAMENTO_TIME 0x05 +#define CTL_DATA_ENTRY 0x06 +#define CTL_MAIN_VOLUME 0x07 +#define CTL_BALANCE 0x08 +/* undefined 0x09 */ +#define CTL_PAN 0x0a +#define CTL_EXPRESSION 0x0b +/* undefined 0x0c */ +/* undefined 0x0d */ +/* undefined 0x0e */ +/* undefined 0x0f */ +#define CTL_GENERAL_PURPOSE1 0x10 +#define CTL_GENERAL_PURPOSE2 0x11 +#define CTL_GENERAL_PURPOSE3 0x12 +#define CTL_GENERAL_PURPOSE4 0x13 +/* undefined 0x14 - 0x1f */ + +/* undefined 0x20 */ +/* The controller numbers 0x21 to 0x3f are reserved for the */ +/* least significant bytes of the controllers 0x00 to 0x1f. */ +/* These controllers are not recognised by the driver. */ + +/* Controllers 64 to 69 (0x40 to 0x45) are on/off switches. */ +/* 0=OFF and 127=ON (intermediate values are possible) */ +#define CTL_DAMPER_PEDAL 0x40 +#define CTL_SUSTAIN 0x40 /* Alias */ +#define CTL_HOLD 0x40 /* Alias */ +#define CTL_PORTAMENTO 0x41 +#define CTL_SOSTENUTO 0x42 +#define CTL_SOFT_PEDAL 0x43 +/* undefined 0x44 */ +#define CTL_HOLD2 0x45 +/* undefined 0x46 - 0x4f */ + +#define CTL_GENERAL_PURPOSE5 0x50 +#define CTL_GENERAL_PURPOSE6 0x51 +#define CTL_GENERAL_PURPOSE7 0x52 +#define CTL_GENERAL_PURPOSE8 0x53 +/* undefined 0x54 - 0x5a */ +#define CTL_EXT_EFF_DEPTH 0x5b +#define CTL_TREMOLO_DEPTH 0x5c +#define CTL_CHORUS_DEPTH 0x5d +#define CTL_DETUNE_DEPTH 0x5e +#define CTL_CELESTE_DEPTH 0x5e /* Alias for the above one */ +#define CTL_PHASER_DEPTH 0x5f +#define CTL_DATA_INCREMENT 0x60 +#define CTL_DATA_DECREMENT 0x61 +#define CTL_NONREG_PARM_NUM_LSB 0x62 +#define CTL_NONREG_PARM_NUM_MSB 0x63 +#define CTL_REGIST_PARM_NUM_LSB 0x64 +#define CTL_REGIST_PARM_NUM_MSB 0x65 +/* undefined 0x66 - 0x78 */ +/* reserved 0x79 - 0x7f */ + +/* Pseudo controllers (not midi compatible) */ +#define CTRL_PITCH_BENDER 255 +#define CTRL_PITCH_BENDER_RANGE 254 +#define CTRL_EXPRESSION 253 /* Obsolete */ +#define CTRL_MAIN_VOLUME 252 /* Obsolete */ +#define SEQ_BALANCE 11 +#define SEQ_VOLMODE 12 + +/* + * Volume mode defines how volumes are used + */ + +#define VOL_METHOD_ADAGIO 1 +#define VOL_METHOD_LINEAR 2 + +/* + * Note! SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO are used also as + * input events. + */ + +/* + * Event codes 0xf0 to 0xfc are reserved for future extensions. + */ + +#define SEQ_FULLSIZE 0xfd /* Long events */ +/* + * SEQ_FULLSIZE events are used for loading patches/samples to the + * synthesizer devices. These events are passed directly to the driver + * of the associated synthesizer device. There is no limit to the size + * of the extended events. These events are not queued but executed + * immediately when the write() is called (execution can take several + * seconds of time). + * + * When a SEQ_FULLSIZE message is written to the device, it must + * be written using exactly one write() call. Other events cannot + * be mixed to the same write. + * + * For FM synths (YM3812/OPL3) use struct sbi_instrument and write it to the + * /dev/sequencer. Don't write other data together with the instrument structure + * Set the key field of the structure to FM_PATCH. The device field is used to + * route the patch to the corresponding device. + * + * For wave table use struct patch_info. Initialize the key field + * to WAVE_PATCH. + */ +#define SEQ_PRIVATE 0xfe /* Low level HW dependent events (8 bytes) */ +#define SEQ_EXTENDED 0xff /* Extended events (8 bytes) OBSOLETE */ + +/* + * Record for FM patches + */ + +typedef unsigned char sbi_instr_data[32]; + +struct sbi_instrument { + unsigned short key; /* FM_PATCH or OPL3_PATCH */ +#define FM_PATCH _PATCHKEY(0x01) +#define OPL3_PATCH _PATCHKEY(0x03) + short device; /* Synth# (0-4) */ + int channel; /* Program# to be initialized */ + sbi_instr_data operators; /* Register settings for operator cells (.SBI format) */ + }; + +struct synth_info { /* Read only */ + char name[30]; + int device; /* 0-N. INITIALIZE BEFORE CALLING */ + int synth_type; +#define SYNTH_TYPE_FM 0 +#define SYNTH_TYPE_SAMPLE 1 +#define SYNTH_TYPE_MIDI 2 /* Midi interface */ + + int synth_subtype; +#define FM_TYPE_ADLIB 0x00 +#define FM_TYPE_OPL3 0x01 +#define MIDI_TYPE_MPU401 0x401 + +#define SAMPLE_TYPE_BASIC 0x10 +#define SAMPLE_TYPE_GUS SAMPLE_TYPE_BASIC + + int perc_mode; /* No longer supported */ + int nr_voices; + int nr_drums; /* Obsolete field */ + int instr_bank_size; + unsigned int capabilities; +#define SYNTH_CAP_PERCMODE 0x00000001 /* No longer used */ +#define SYNTH_CAP_OPL3 0x00000002 /* Set if OPL3 supported */ +#define SYNTH_CAP_INPUT 0x00000004 /* Input (MIDI) device */ + int dummies[19]; /* Reserve space */ + }; + +struct sound_timer_info { + char name[32]; + int caps; + }; + +#define MIDI_CAP_MPU401 1 /* MPU-401 intelligent mode */ + +struct midi_info { + char name[30]; + int device; /* 0-N. INITIALIZE BEFORE CALLING */ + unsigned int capabilities; /* To be defined later */ + int dev_type; + int dummies[18]; /* Reserve space */ + }; + +/******************************************** + * ioctl commands for the /dev/midi## + */ +typedef struct { + unsigned char cmd; + char nr_args, nr_returns; + unsigned char data[30]; + } mpu_command_rec; + +#define SNDCTL_MIDI_PRETIME __SIOWR('m', 0, int) +#define SNDCTL_MIDI_MPUMODE __SIOWR('m', 1, int) +#define SNDCTL_MIDI_MPUCMD __SIOWR('m', 2, mpu_command_rec) + +/******************************************** + * IOCTL commands for /dev/dsp and /dev/audio + */ + +#define SNDCTL_DSP_RESET __SIO ('P', 0) +#define SNDCTL_DSP_SYNC __SIO ('P', 1) +#define SNDCTL_DSP_SPEED __SIOWR('P', 2, int) +#define SNDCTL_DSP_STEREO __SIOWR('P', 3, int) +#define SNDCTL_DSP_GETBLKSIZE __SIOWR('P', 4, int) +#define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT +#define SNDCTL_DSP_CHANNELS __SIOWR('P', 6, int) +#define SOUND_PCM_WRITE_CHANNELS SNDCTL_DSP_CHANNELS +#define SOUND_PCM_WRITE_FILTER __SIOWR('P', 7, int) +#define SNDCTL_DSP_POST __SIO ('P', 8) +#define SNDCTL_DSP_SUBDIVIDE __SIOWR('P', 9, int) +#define SNDCTL_DSP_SETFRAGMENT __SIOWR('P',10, int) + +/* Audio data formats (Note! U8=8 and S16_LE=16 for compatibility) */ +#define SNDCTL_DSP_GETFMTS __SIOR ('P',11, int) /* Returns a mask */ +#define SNDCTL_DSP_SETFMT __SIOWR('P',5, int) /* Selects ONE fmt*/ +# define AFMT_QUERY 0x00000000 /* Return current fmt */ +# define AFMT_MU_LAW 0x00000001 +# define AFMT_A_LAW 0x00000002 +# define AFMT_IMA_ADPCM 0x00000004 +# define AFMT_U8 0x00000008 +# define AFMT_S16_LE 0x00000010 /* Little endian signed 16*/ +# define AFMT_S16_BE 0x00000020 /* Big endian signed 16 */ +# define AFMT_S8 0x00000040 +# define AFMT_U16_LE 0x00000080 /* Little endian U16 */ +# define AFMT_U16_BE 0x00000100 /* Big endian U16 */ +# define AFMT_MPEG 0x00000200 /* MPEG (2) audio */ + +/* 32 bit formats (MSB aligned) formats */ +# define AFMT_S32_LE 0x00001000 +# define AFMT_S32_BE 0x00002000 + +/* + * Buffer status queries. + */ +typedef struct audio_buf_info { + int fragments; /* # of available fragments (partially usend ones not counted) */ + int fragstotal; /* Total # of fragments allocated */ + int fragsize; /* Size of a fragment in bytes */ + + int bytes; /* Available space in bytes (includes partially used fragments) */ + /* Note! 'bytes' could be more than fragments*fragsize */ + } audio_buf_info; + +#define SNDCTL_DSP_GETOSPACE __SIOR ('P',12, audio_buf_info) +#define SNDCTL_DSP_GETISPACE __SIOR ('P',13, audio_buf_info) +#define SNDCTL_DSP_NONBLOCK __SIO ('P',14) +#define SNDCTL_DSP_GETCAPS __SIOR ('P',15, int) +# define DSP_CAP_REVISION 0x000000ff /* Bits for revision level (0 to 255) */ +# define DSP_CAP_DUPLEX 0x00000100 /* Full duplex record/playback */ +# define DSP_CAP_REALTIME 0x00000200 /* Real time capability */ +# define DSP_CAP_BATCH 0x00000400 /* Device has some kind of */ + /* internal buffers which may */ + /* cause some delays and */ + /* decrease precision of timing */ +# define DSP_CAP_COPROC 0x00000800 /* Has a coprocessor */ + /* Sometimes it's a DSP */ + /* but usually not */ +# define DSP_CAP_TRIGGER 0x00001000 /* Supports SETTRIGGER */ +# define DSP_CAP_MMAP 0x00002000 /* Supports mmap() */ + +#define SNDCTL_DSP_GETTRIGGER __SIOR ('P',16, int) +#define SNDCTL_DSP_SETTRIGGER __SIOW ('P',16, int) +# define PCM_ENABLE_INPUT 0x00000001 +# define PCM_ENABLE_OUTPUT 0x00000002 + +typedef struct count_info { + int bytes; /* Total # of bytes processed */ + int blocks; /* # of fragment transitions since last time */ + int ptr; /* Current DMA pointer value */ + } count_info; + +#define SNDCTL_DSP_GETIPTR __SIOR ('P',17, count_info) +#define SNDCTL_DSP_GETOPTR __SIOR ('P',18, count_info) + +typedef struct buffmem_desc { + unsigned *buffer; + int size; + } buffmem_desc; +#define SNDCTL_DSP_MAPINBUF __SIOR ('P', 19, buffmem_desc) +#define SNDCTL_DSP_MAPOUTBUF __SIOR ('P', 20, buffmem_desc) +#define SNDCTL_DSP_SETSYNCRO __SIO ('P', 21) +#define SNDCTL_DSP_SETDUPLEX __SIO ('P', 22) +#define SNDCTL_DSP_GETODELAY __SIOR ('P', 23, int) +#define SNDCTL_DSP_GETOUTVOL __SIOR ('P', 24, int) +#define SNDCTL_DSP_SETOUTVOL __SIOWR('P', 24, int) + +/* + * Application's profile defines the way how playback underrun situations should be handled. + * + * APF_NORMAL (the default) and APF_NETWORK make the driver to cleanup the + * playback buffer whenever an underrun occurs. This consumes some time + * preven's looping the existing buffer. + * APF_CPUINTENS is intended to be set by CPU intensive applications which + * are likely to run out of time occasionally. In this mode the buffer cleanup is + * disabled which saves CPU time but also let's the previous buffer content to + * be played during the "pause" after the underrun. + */ +#define SNDCTL_DSP_PROFILE __SIOW ('P', 23, int) +#define APF_NORMAL 0 /* Normal applications */ +#define APF_NETWORK 1 /* Underruns probably caused by an "external" delay */ +#define APF_CPUINTENS 2 /* Underruns probably caused by "overheating" the CPU */ + +#define SOUND_PCM_READ_RATE __SIOR ('P', 2, int) +#define SOUND_PCM_READ_CHANNELS __SIOR ('P', 6, int) +#define SOUND_PCM_READ_BITS __SIOR ('P', 5, int) +#define SOUND_PCM_READ_FILTER __SIOR ('P', 7, int) + +/* Some alias names */ +#define SOUND_PCM_WRITE_BITS SNDCTL_DSP_SETFMT +#define SOUND_PCM_WRITE_RATE SNDCTL_DSP_SPEED +#define SOUND_PCM_POST SNDCTL_DSP_POST +#define SOUND_PCM_RESET SNDCTL_DSP_RESET +#define SOUND_PCM_SYNC SNDCTL_DSP_SYNC +#define SOUND_PCM_SUBDIVIDE SNDCTL_DSP_SUBDIVIDE +#define SOUND_PCM_SETFRAGMENT SNDCTL_DSP_SETFRAGMENT +#define SOUND_PCM_GETFMTS SNDCTL_DSP_GETFMTS +#define SOUND_PCM_SETFMT SNDCTL_DSP_SETFMT +#define SOUND_PCM_GETOSPACE SNDCTL_DSP_GETOSPACE +#define SOUND_PCM_GETISPACE SNDCTL_DSP_GETISPACE +#define SOUND_PCM_NONBLOCK SNDCTL_DSP_NONBLOCK +#define SOUND_PCM_GETCAPS SNDCTL_DSP_GETCAPS +#define SOUND_PCM_GETTRIGGER SNDCTL_DSP_GETTRIGGER +#define SOUND_PCM_SETTRIGGER SNDCTL_DSP_SETTRIGGER +#define SOUND_PCM_SETSYNCRO SNDCTL_DSP_SETSYNCRO +#define SOUND_PCM_GETIPTR SNDCTL_DSP_GETIPTR +#define SOUND_PCM_GETOPTR SNDCTL_DSP_GETOPTR +#define SOUND_PCM_MAPINBUF SNDCTL_DSP_MAPINBUF +#define SOUND_PCM_MAPOUTBUF SNDCTL_DSP_MAPOUTBUF + +/* + * ioctl calls to be used in communication with coprocessors and + * DSP chips. + */ + +typedef struct copr_buffer { + int command; /* Set to 0 if not used */ + int flags; +#define CPF_NONE 0x0000 +#define CPF_FIRST 0x0001 /* First block */ +#define CPF_LAST 0x0002 /* Last block */ + int len; + int offs; /* If required by the device (0 if not used) */ + + unsigned char data[4000]; /* NOTE! 4000 is not 4k */ + } copr_buffer; + +typedef struct copr_debug_buf { + int command; /* Used internally. Set to 0 */ + int parm1; + int parm2; + int flags; + int len; /* Length of data in bytes */ + } copr_debug_buf; + +typedef struct copr_msg { + int len; + unsigned char data[4000]; + } copr_msg; + +#define SNDCTL_COPR_RESET __SIO ('C', 0) +#define SNDCTL_COPR_LOAD __SIOWR('C', 1, copr_buffer) +#define SNDCTL_COPR_RDATA __SIOWR('C', 2, copr_debug_buf) +#define SNDCTL_COPR_RCODE __SIOWR('C', 3, copr_debug_buf) +#define SNDCTL_COPR_WDATA __SIOW ('C', 4, copr_debug_buf) +#define SNDCTL_COPR_WCODE __SIOW ('C', 5, copr_debug_buf) +#define SNDCTL_COPR_RUN __SIOWR('C', 6, copr_debug_buf) +#define SNDCTL_COPR_HALT __SIOWR('C', 7, copr_debug_buf) +#define SNDCTL_COPR_SENDMSG __SIOWR('C', 8, copr_msg) +#define SNDCTL_COPR_RCVMSG __SIOR ('C', 9, copr_msg) + +/********************************************* + * IOCTL commands for /dev/mixer + */ + +/* + * Mixer devices + * + * There can be up to 20 different analog mixer channels. The + * SOUND_MIXER_NRDEVICES gives the currently supported maximum. + * The SOUND_MIXER_READ_DEVMASK returns a bitmask which tells + * the devices supported by the particular mixer. + */ + +#define SOUND_MIXER_NRDEVICES 28 +#define SOUND_MIXER_VOLUME 0 +#define SOUND_MIXER_BASS 1 +#define SOUND_MIXER_TREBLE 2 +#define SOUND_MIXER_SYNTH 3 +#define SOUND_MIXER_PCM 4 +#define SOUND_MIXER_SPEAKER 5 +#define SOUND_MIXER_LINE 6 +#define SOUND_MIXER_MIC 7 +#define SOUND_MIXER_CD 8 +#define SOUND_MIXER_IMIX 9 /* Recording monitor */ +#define SOUND_MIXER_ALTPCM 10 +#define SOUND_MIXER_RECLEV 11 /* Recording level */ +#define SOUND_MIXER_IGAIN 12 /* Input gain */ +#define SOUND_MIXER_OGAIN 13 /* Output gain */ +/* + * The AD1848 codec and compatibles have three line level inputs + * (line, aux1 and aux2). Since each card manufacturer have assigned + * different meanings to these inputs, it's inpractical to assign + * specific meanings (line, cd, synth etc.) to them. + */ +#define SOUND_MIXER_LINE1 14 /* Input source 1 (aux1) */ +#define SOUND_MIXER_LINE2 15 /* Input source 2 (aux2) */ +#define SOUND_MIXER_LINE3 16 /* Input source 3 (line) */ +#define SOUND_MIXER_DIGITAL1 17 /* Digital (input) 1 */ +#define SOUND_MIXER_DIGITAL2 18 /* Digital (input) 2 */ +#define SOUND_MIXER_DIGITAL3 19 /* Digital (input) 3 */ +#define SOUND_MIXER_PHONEIN 20 /* Phone input */ +#define SOUND_MIXER_PHONEOUT 21 /* Phone output */ +#define SOUND_MIXER_VIDEO 22 /* Video/TV (audio) in */ +#define SOUND_MIXER_RADIO 23 /* Radio in */ +#define SOUND_MIXER_MONITOR 24 /* Monitor (usually mic) volume */ +#define SOUND_MIXER_DEPTH 25 /* 3D "depth"/"space" parameter */ +#define SOUND_MIXER_CENTER 26 /* 3D "center" parameter */ +#define SOUND_MIXER_MIDI 27 /* Alternative for "synth" */ + +/* Some on/off settings (SOUND_SPECIAL_MIN - SOUND_SPECIAL_MAX) */ +/* Not counted to SOUND_MIXER_NRDEVICES, but use the same number space */ +#define SOUND_ONOFF_MIN 28 +#define SOUND_ONOFF_MAX 30 + +/* Note! Number 31 cannot be used since the sign bit is reserved */ +#define SOUND_MIXER_NONE 31 + +/* + * The following unsupported macros are no longer functional. + * Use SOUND_MIXER_PRIVATE# macros in future. + */ +#define SOUND_MIXER_ENHANCE SOUND_MIXER_NONE +#define SOUND_MIXER_MUTE SOUND_MIXER_NONE +#define SOUND_MIXER_LOUD SOUND_MIXER_NONE + + +#define SOUND_DEVICE_LABELS {"Vol ", "Bass ", "Trebl", "Synth", "Pcm ", "Spkr ", "Line ", \ + "Mic ", "CD ", "Mix ", "Pcm2 ", "Rec ", "IGain", "OGain", \ + "Line1", "Line2", "Line3", "Digital1", "Digital2", "Digital3", \ + "PhoneIn", "PhoneOut", "Video", "Radio", "Monitor", \ + "Depth", "Center", "MIDI"} + +#define SOUND_DEVICE_NAMES {"vol", "bass", "treble", "synth", "pcm", "speaker", "line", \ + "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", \ + "line1", "line2", "line3", "dig1", "dig2", "dig3", \ + "phin", "phout", "video", "radio", "monitor", \ + "depth", "center", "midi"} + +/* Device bitmask identifiers */ + +#define SOUND_MIXER_RECSRC 0xff /* Arg contains a bit for each recording source */ +#define SOUND_MIXER_DEVMASK 0xfe /* Arg contains a bit for each supported device */ +#define SOUND_MIXER_RECMASK 0xfd /* Arg contains a bit for each supported recording source */ +#define SOUND_MIXER_CAPS 0xfc +# define SOUND_CAP_EXCL_INPUT 0x00000001 /* Only one recording source at a time */ +#define SOUND_MIXER_STEREODEVS 0xfb /* Mixer channels supporting stereo */ + +/* Device mask bits */ + +#define SOUND_MASK_VOLUME (1 << SOUND_MIXER_VOLUME) +#define SOUND_MASK_BASS (1 << SOUND_MIXER_BASS) +#define SOUND_MASK_TREBLE (1 << SOUND_MIXER_TREBLE) +#define SOUND_MASK_SYNTH (1 << SOUND_MIXER_SYNTH) +#define SOUND_MASK_PCM (1 << SOUND_MIXER_PCM) +#define SOUND_MASK_SPEAKER (1 << SOUND_MIXER_SPEAKER) +#define SOUND_MASK_LINE (1 << SOUND_MIXER_LINE) +#define SOUND_MASK_MIC (1 << SOUND_MIXER_MIC) +#define SOUND_MASK_CD (1 << SOUND_MIXER_CD) +#define SOUND_MASK_IMIX (1 << SOUND_MIXER_IMIX) +#define SOUND_MASK_ALTPCM (1 << SOUND_MIXER_ALTPCM) +#define SOUND_MASK_RECLEV (1 << SOUND_MIXER_RECLEV) +#define SOUND_MASK_IGAIN (1 << SOUND_MIXER_IGAIN) +#define SOUND_MASK_OGAIN (1 << SOUND_MIXER_OGAIN) +#define SOUND_MASK_LINE1 (1 << SOUND_MIXER_LINE1) +#define SOUND_MASK_LINE2 (1 << SOUND_MIXER_LINE2) +#define SOUND_MASK_LINE3 (1 << SOUND_MIXER_LINE3) +#define SOUND_MASK_DIGITAL1 (1 << SOUND_MIXER_DIGITAL1) +#define SOUND_MASK_DIGITAL2 (1 << SOUND_MIXER_DIGITAL2) +#define SOUND_MASK_DIGITAL3 (1 << SOUND_MIXER_DIGITAL3) +#define SOUND_MASK_PHONEIN (1 << SOUND_MIXER_PHONEIN) +#define SOUND_MASK_PHONEOUT (1 << SOUND_MIXER_PHONEOUT) +#define SOUND_MASK_RADIO (1 << SOUND_MIXER_RADIO) +#define SOUND_MASK_VIDEO (1 << SOUND_MIXER_VIDEO) +#define SOUND_MASK_MONITOR (1 << SOUND_MIXER_MONITOR) +#define SOUND_MASK_DEPTH (1 << SOUND_MIXER_DEPTH) +#define SOUND_MASK_CENTER (1 << SOUND_MIXER_CENTER) +#define SOUND_MASK_MIDI (1 << SOUND_MIXER_MIDI) + +/* Obsolete macros */ +#define SOUND_MASK_MUTE (1 << SOUND_MIXER_MUTE) +#define SOUND_MASK_ENHANCE (1 << SOUND_MIXER_ENHANCE) +#define SOUND_MASK_LOUD (1 << SOUND_MIXER_LOUD) + +#define MIXER_READ(dev) __SIOR('M', dev, int) +#define SOUND_MIXER_READ_VOLUME MIXER_READ(SOUND_MIXER_VOLUME) +#define SOUND_MIXER_READ_BASS MIXER_READ(SOUND_MIXER_BASS) +#define SOUND_MIXER_READ_TREBLE MIXER_READ(SOUND_MIXER_TREBLE) +#define SOUND_MIXER_READ_SYNTH MIXER_READ(SOUND_MIXER_SYNTH) +#define SOUND_MIXER_READ_PCM MIXER_READ(SOUND_MIXER_PCM) +#define SOUND_MIXER_READ_SPEAKER MIXER_READ(SOUND_MIXER_SPEAKER) +#define SOUND_MIXER_READ_LINE MIXER_READ(SOUND_MIXER_LINE) +#define SOUND_MIXER_READ_MIC MIXER_READ(SOUND_MIXER_MIC) +#define SOUND_MIXER_READ_CD MIXER_READ(SOUND_MIXER_CD) +#define SOUND_MIXER_READ_IMIX MIXER_READ(SOUND_MIXER_IMIX) +#define SOUND_MIXER_READ_ALTPCM MIXER_READ(SOUND_MIXER_ALTPCM) +#define SOUND_MIXER_READ_RECLEV MIXER_READ(SOUND_MIXER_RECLEV) +#define SOUND_MIXER_READ_IGAIN MIXER_READ(SOUND_MIXER_IGAIN) +#define SOUND_MIXER_READ_OGAIN MIXER_READ(SOUND_MIXER_OGAIN) +#define SOUND_MIXER_READ_LINE1 MIXER_READ(SOUND_MIXER_LINE1) +#define SOUND_MIXER_READ_LINE2 MIXER_READ(SOUND_MIXER_LINE2) +#define SOUND_MIXER_READ_LINE3 MIXER_READ(SOUND_MIXER_LINE3) + +/* Obsolete macros */ +#define SOUND_MIXER_READ_MUTE MIXER_READ(SOUND_MIXER_MUTE) +#define SOUND_MIXER_READ_ENHANCE MIXER_READ(SOUND_MIXER_ENHANCE) +#define SOUND_MIXER_READ_LOUD MIXER_READ(SOUND_MIXER_LOUD) + +#define SOUND_MIXER_READ_RECSRC MIXER_READ(SOUND_MIXER_RECSRC) +#define SOUND_MIXER_READ_DEVMASK MIXER_READ(SOUND_MIXER_DEVMASK) +#define SOUND_MIXER_READ_RECMASK MIXER_READ(SOUND_MIXER_RECMASK) +#define SOUND_MIXER_READ_STEREODEVS MIXER_READ(SOUND_MIXER_STEREODEVS) +#define SOUND_MIXER_READ_CAPS MIXER_READ(SOUND_MIXER_CAPS) + +#define MIXER_WRITE(dev) __SIOWR('M', dev, int) +#define SOUND_MIXER_WRITE_VOLUME MIXER_WRITE(SOUND_MIXER_VOLUME) +#define SOUND_MIXER_WRITE_BASS MIXER_WRITE(SOUND_MIXER_BASS) +#define SOUND_MIXER_WRITE_TREBLE MIXER_WRITE(SOUND_MIXER_TREBLE) +#define SOUND_MIXER_WRITE_SYNTH MIXER_WRITE(SOUND_MIXER_SYNTH) +#define SOUND_MIXER_WRITE_PCM MIXER_WRITE(SOUND_MIXER_PCM) +#define SOUND_MIXER_WRITE_SPEAKER MIXER_WRITE(SOUND_MIXER_SPEAKER) +#define SOUND_MIXER_WRITE_LINE MIXER_WRITE(SOUND_MIXER_LINE) +#define SOUND_MIXER_WRITE_MIC MIXER_WRITE(SOUND_MIXER_MIC) +#define SOUND_MIXER_WRITE_CD MIXER_WRITE(SOUND_MIXER_CD) +#define SOUND_MIXER_WRITE_IMIX MIXER_WRITE(SOUND_MIXER_IMIX) +#define SOUND_MIXER_WRITE_ALTPCM MIXER_WRITE(SOUND_MIXER_ALTPCM) +#define SOUND_MIXER_WRITE_RECLEV MIXER_WRITE(SOUND_MIXER_RECLEV) +#define SOUND_MIXER_WRITE_IGAIN MIXER_WRITE(SOUND_MIXER_IGAIN) +#define SOUND_MIXER_WRITE_OGAIN MIXER_WRITE(SOUND_MIXER_OGAIN) +#define SOUND_MIXER_WRITE_LINE1 MIXER_WRITE(SOUND_MIXER_LINE1) +#define SOUND_MIXER_WRITE_LINE2 MIXER_WRITE(SOUND_MIXER_LINE2) +#define SOUND_MIXER_WRITE_LINE3 MIXER_WRITE(SOUND_MIXER_LINE3) + +/* Obsolete macros */ +#define SOUND_MIXER_WRITE_MUTE MIXER_WRITE(SOUND_MIXER_MUTE) +#define SOUND_MIXER_WRITE_ENHANCE MIXER_WRITE(SOUND_MIXER_ENHANCE) +#define SOUND_MIXER_WRITE_LOUD MIXER_WRITE(SOUND_MIXER_LOUD) + +#define SOUND_MIXER_WRITE_RECSRC MIXER_WRITE(SOUND_MIXER_RECSRC) + +typedef struct mixer_info +{ + char id[16]; + char name[32]; + int modify_counter; + int fillers[10]; +} mixer_info; + +typedef struct _old_mixer_info /* Obsolete */ +{ + char id[16]; + char name[32]; +} _old_mixer_info; + +#define SOUND_MIXER_INFO __SIOR ('M', 101, mixer_info) +#define SOUND_OLD_MIXER_INFO __SIOR ('M', 101, _old_mixer_info) + +/* + * A mechanism for accessing "proprietary" mixer features. This method + * permits passing 128 bytes of arbitrary data between a mixer application + * and the mixer driver. Interpretation of the record is defined by + * the particular mixer driver. + */ +typedef unsigned char mixer_record[128]; + +#define SOUND_MIXER_ACCESS __SIOWR('M', 102, mixer_record) + +/* + * The SOUND_MIXER_PRIVATE# commands can be redefined by low level drivers. + * These features can be used when accessing device specific features. + */ +#define SOUND_MIXER_PRIVATE1 __SIOWR('M', 111, int) +#define SOUND_MIXER_PRIVATE2 __SIOWR('M', 112, int) +#define SOUND_MIXER_PRIVATE3 __SIOWR('M', 113, int) +#define SOUND_MIXER_PRIVATE4 __SIOWR('M', 114, int) +#define SOUND_MIXER_PRIVATE5 __SIOWR('M', 115, int) + +/* + * SOUND_MIXER_GETLEVELS and SOUND_MIXER_SETLEVELS calls can be used + * for querying current mixer settings from the driver and for loading + * default volume settings _prior_ activating the mixer (loading + * doesn't affect current state of the mixer hardware). These calls + * are for internal use only. + */ + +typedef struct mixer_vol_table { + int num; /* Index to volume table */ + char name[32]; + int levels[32]; +} mixer_vol_table; + +#define SOUND_MIXER_GETLEVELS __SIOWR('M', 116, mixer_vol_table) +#define SOUND_MIXER_SETLEVELS __SIOWR('M', 117, mixer_vol_table) + +/* + * An ioctl for identifying the driver version. It will return value + * of the SOUND_VERSION macro used when compiling the driver. + * This call was introduced in OSS version 3.6 and it will not work + * with earlier versions (returns EINVAL). + */ +#define OSS_GETVERSION __SIOR ('M', 118, int) + +/************************************************* + * Extended mixer interface (OSS 4.0 and later) * + *************************************************/ +#define SYSINFO_FILL_SIZE 256 + +typedef struct oss_sysinfo { + char product[32]; /* For example OSS/Free, OSS/Linux or OSS/Solaris */ + char version[32]; /* For example 4.0a */ + int versionnum; /* See OSS_GETVERSION */ + char options[128]; /* Reserved */ + + int numaudios; /* # of audio/dsp devices */ + int openedaudio[8]; /* Bit mask telling which audio devices are busy */ + + int numsynths; /* # of availavle synth devices */ + int nummidis; /* # of available MIDI ports */ + int numtimers; /* # of available timer devices */ + int nummixers; /* # of mixer devices */ + + int filler[SYSINFO_FILL_SIZE];/* For future expansion (set to -1) */ +} oss_sysinfo; + +typedef struct oss_mixext { + int dev; /* Mixer device number */ + int ctrl; /* Controller number */ + int type; /* Entry type */ +# define MIXT_DEVROOT 0 /* Device root entry */ +# define MIXT_GROUP 1 /* Controller group */ +# define MIXT_ONOFF 2 /* OFF (0) or ON (1) */ +# define MIXT_ENUM 3 /* Enumerated (0 to maxvalue) */ +# define MIXT_MONOSLIDER 4 /* Mono slider (0 to 100) */ +# define MIXT_STEREOSLIDER 5 /* Stereo slider (dual 0 to 100) */ +# define MIXT_MESSAGE 6 /* (Readable) textual message */ +# define MIXT_MONOVU 7 /* VU meter value (mono) */ +# define MIXT_STEREOVU 8 /* VU meter value (stereo) */ +# define MIXT_MONOPEAK 9 /* VU meter peak value (mono) */ +# define MIXT_STEREOPEAK 10 /* VU meter peak value (stereo) */ +# define MIXT_RADIOGROUP 11 /* Radio button group */ +# define MIXT_MARKER 12 /* Separator between normal and extension entries */ +# define MIXT_VALUE 13 /* Decimal value entry */ +# define MIXT_HEXVALUE 14 /* Hexadecimal value entry */ + int maxvalue; /* Possible value range (0 to maxvalue) */ + int flags; +# define MIXF_READABLE 0x00000001 /* Has readable value */ +# define MIXF_WRITEABLE 0x00000002 /* Has writeable value */ + char id[16]; /* Mnemonic ID (for linking with user space info) */ + int parent; /* Entry# of parent (group) node (-1 if root) */ + + void *handler; /* Internal use */ + + char data[64]; /* Misc data (entry type dependent) */ + +} oss_mixext; + +typedef struct oss_mixext_root { + char id[16]; + char name[48]; +} oss_mixext_root; + +typedef struct oss_mixer_value +{ + int dev; + int ctrl; + int value; + int flags; /* Reserved for future use. Initialize to 0 */ + int filler[8]; /* Reserved for future use. Initialize to 0 */ +}oss_mixer_value; + +#define OSS_SYSINFO __SIOR ('X', 1, oss_sysinfo) + +#define SNDCTL_MIX_NRMIX __SIOR ('X', 2, int) +#define SNDCTL_MIX_NREXT __SIOWR('X', 3, int) +#define SNDCTL_MIX_EXTINFO __SIOWR('X', 4, oss_mixext) +#define SNDCTL_MIX_READ __SIOWR('X', 5, oss_mixer_value) +#define SNDCTL_MIX_WRITE __SIOWR('X', 6, oss_mixer_value) + +/* + * Level 2 event types for /dev/sequencer + */ + +/* + * The 4 most significant bits of byte 0 specify the class of + * the event: + * + * 0x8X = system level events, + * 0x9X = device/port specific events, event[1] = device/port, + * The last 4 bits give the subtype: + * 0x02 = Channel event (event[3] = chn). + * 0x01 = note event (event[4] = note). + * (0x01 is not used alone but always with bit 0x02). + * event[2] = MIDI message code (0x80=note off etc.) + * + */ + +#define EV_SEQ_LOCAL 0x80 +#define EV_TIMING 0x81 +#define EV_CHN_COMMON 0x92 +#define EV_CHN_VOICE 0x93 +#define EV_SYSEX 0x94 +/* + * Event types 200 to 220 are reserved for application use. + * These numbers will not be used by the driver. + */ + +/* + * Events for event type EV_CHN_VOICE + */ + +#define MIDI_NOTEOFF 0x80 +#define MIDI_NOTEON 0x90 +#define MIDI_KEY_PRESSURE 0xA0 + +/* + * Events for event type EV_CHN_COMMON + */ + +#define MIDI_CTL_CHANGE 0xB0 +#define MIDI_PGM_CHANGE 0xC0 +#define MIDI_CHN_PRESSURE 0xD0 +#define MIDI_PITCH_BEND 0xE0 + +#define MIDI_SYSTEM_PREFIX 0xF0 + +/* + * Timer event types + */ +#define TMR_WAIT_REL 1 /* Time relative to the prev time */ +#define TMR_WAIT_ABS 2 /* Absolute time since TMR_START */ +#define TMR_STOP 3 +#define TMR_START 4 +#define TMR_CONTINUE 5 +#define TMR_TEMPO 6 +#define TMR_ECHO 8 +#define TMR_CLOCK 9 /* MIDI clock */ +#define TMR_SPP 10 /* Song position pointer */ +#define TMR_TIMESIG 11 /* Time signature */ + +/* + * Local event types + */ +#define LOCL_STARTAUDIO 1 +#define LOCL_STARTAUDIO2 2 +#define LOCL_STARTAUDIO3 3 +#define LOCL_STARTAUDIO4 4 + +#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS) +/* + * Some convenience macros to simplify programming of the + * /dev/sequencer interface + * + * These macros define the API which should be used when possible. + */ +#define SEQ_DECLAREBUF() SEQ_USE_EXTBUF() + +void seqbuf_dump(void); /* This function must be provided by programs */ + +EXTERNC int OSS_init(int seqfd, int buflen); +EXTERNC void OSS_seqbuf_dump(int fd, unsigned char *buf, int buflen); +EXTERNC void OSS_seq_advbuf(int len, int fd, unsigned char *buf, int buflen); +EXTERNC void OSS_seq_needbuf(int len, int fd, unsigned char *buf, int buflen); +EXTERNC void OSS_patch_caching(int dev, int chn, int patch, + int fd, unsigned char *buf, int buflen); +EXTERNC void OSS_drum_caching(int dev, int chn, int patch, + int fd, unsigned char *buf, int buflen); +EXTERNC void OSS_write_patch(int fd, unsigned char *buf, int len); +EXTERNC int OSS_write_patch2(int fd, unsigned char *buf, int len); + +#define SEQ_PM_DEFINES int __foo_bar___ +#ifdef OSSLIB +# define SEQ_USE_EXTBUF() \ + EXTERNC unsigned char *_seqbuf; \ + EXTERNC int _seqbuflen;EXTERNC int _seqbufptr +# define SEQ_DEFINEBUF(len) SEQ_USE_EXTBUF();static int _requested_seqbuflen=len +# define _SEQ_ADVBUF(len) OSS_seq_advbuf(len, seqfd, _seqbuf, _seqbuflen) +# define _SEQ_NEEDBUF(len) OSS_seq_needbuf(len, seqfd, _seqbuf, _seqbuflen) +# define SEQ_DUMPBUF() OSS_seqbuf_dump(seqfd, _seqbuf, _seqbuflen) + +# define SEQ_LOAD_GMINSTR(dev, instr) \ + OSS_patch_caching(dev, -1, instr, seqfd, _seqbuf, _seqbuflen) +# define SEQ_LOAD_GMDRUM(dev, drum) \ + OSS_drum_caching(dev, -1, drum, seqfd, _seqbuf, _seqbuflen) +#else /* !OSSLIB */ + +# define SEQ_LOAD_GMINSTR(dev, instr) +# define SEQ_LOAD_GMDRUM(dev, drum) + +# define SEQ_USE_EXTBUF() \ + EXTERNC unsigned char _seqbuf[]; \ + EXTERNC int _seqbuflen;EXTERNC int _seqbufptr + +#ifndef USE_SIMPLE_MACROS +/* Sample seqbuf_dump() implementation: + * + * SEQ_DEFINEBUF (2048); -- Defines a buffer for 2048 bytes + * + * int seqfd; -- The file descriptor for /dev/sequencer. + * + * void + * seqbuf_dump () + * { + * if (_seqbufptr) + * if (write (seqfd, _seqbuf, _seqbufptr) == -1) + * { + * perror ("write /dev/sequencer"); + * exit (-1); + * } + * _seqbufptr = 0; + * } + */ + +#define SEQ_DEFINEBUF(len) unsigned char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0 +#define _SEQ_NEEDBUF(len) if ((_seqbufptr+(len)) > _seqbuflen) seqbuf_dump() +#define _SEQ_ADVBUF(len) _seqbufptr += len +#define SEQ_DUMPBUF seqbuf_dump +#else +/* + * This variation of the sequencer macros is used just to format one event + * using fixed buffer. + * + * The program using the macro library must define the following macros before + * using this library. + * + * #define _seqbuf name of the buffer (unsigned char[]) + * #define _SEQ_ADVBUF(len) If the applic needs to know the exact + * size of the event, this macro can be used. + * Otherwise this must be defined as empty. + * #define _seqbufptr Define the name of index variable or 0 if + * not required. + */ +#define _SEQ_NEEDBUF(len) /* empty */ +#endif +#endif /* !OSSLIB */ + +#define SEQ_VOLUME_MODE(dev, mode) {_SEQ_NEEDBUF(8);\ + _seqbuf[_seqbufptr] = SEQ_EXTENDED;\ + _seqbuf[_seqbufptr+1] = SEQ_VOLMODE;\ + _seqbuf[_seqbufptr+2] = (dev);\ + _seqbuf[_seqbufptr+3] = (mode);\ + _seqbuf[_seqbufptr+4] = 0;\ + _seqbuf[_seqbufptr+5] = 0;\ + _seqbuf[_seqbufptr+6] = 0;\ + _seqbuf[_seqbufptr+7] = 0;\ + _SEQ_ADVBUF(8);} + +/* + * Midi voice messages + */ + +#define _CHN_VOICE(dev, event, chn, note, parm) \ + {_SEQ_NEEDBUF(8);\ + _seqbuf[_seqbufptr] = EV_CHN_VOICE;\ + _seqbuf[_seqbufptr+1] = (dev);\ + _seqbuf[_seqbufptr+2] = (event);\ + _seqbuf[_seqbufptr+3] = (chn);\ + _seqbuf[_seqbufptr+4] = (note);\ + _seqbuf[_seqbufptr+5] = (parm);\ + _seqbuf[_seqbufptr+6] = (0);\ + _seqbuf[_seqbufptr+7] = 0;\ + _SEQ_ADVBUF(8);} + +#define SEQ_START_NOTE(dev, chn, note, vol) \ + _CHN_VOICE(dev, MIDI_NOTEON, chn, note, vol) + +#define SEQ_STOP_NOTE(dev, chn, note, vol) \ + _CHN_VOICE(dev, MIDI_NOTEOFF, chn, note, vol) + +#define SEQ_KEY_PRESSURE(dev, chn, note, pressure) \ + _CHN_VOICE(dev, MIDI_KEY_PRESSURE, chn, note, pressure) + +/* + * Midi channel messages + */ + +#define _CHN_COMMON(dev, event, chn, p1, p2, w14) \ + {_SEQ_NEEDBUF(8);\ + _seqbuf[_seqbufptr] = EV_CHN_COMMON;\ + _seqbuf[_seqbufptr+1] = (dev);\ + _seqbuf[_seqbufptr+2] = (event);\ + _seqbuf[_seqbufptr+3] = (chn);\ + _seqbuf[_seqbufptr+4] = (p1);\ + _seqbuf[_seqbufptr+5] = (p2);\ + *(short *)&_seqbuf[_seqbufptr+6] = (w14);\ + _SEQ_ADVBUF(8);} +/* + * SEQ_SYSEX permits sending of sysex messages. (It may look that it permits + * sending any MIDI bytes but it's absolutely not possible. Trying to do + * so _will_ cause problems with MPU401 intelligent mode). + * + * Sysex messages are sent in blocks of 1 to 6 bytes. Longer messages must be + * sent by calling SEQ_SYSEX() several times (there must be no other events + * between them). First sysex fragment must have 0xf0 in the first byte + * and the last byte (buf[len-1] of the last fragment must be 0xf7. No byte + * between these sysex start and end markers cannot be larger than 0x7f. Also + * lengths of each fragments (except the last one) must be 6. + * + * Breaking the above rules may work with some MIDI ports but is likely to + * cause fatal problems with some other devices (such as MPU401). + */ +#define SEQ_SYSEX(dev, buf, len) \ + {int ii, ll=(len); \ + unsigned char *bufp=buf;\ + if (ll>6)ll=6;\ + _SEQ_NEEDBUF(8);\ + _seqbuf[_seqbufptr] = EV_SYSEX;\ + _seqbuf[_seqbufptr+1] = (dev);\ + for(ii=0;ii>8)&0xff);\ + _seqbuf[_seqbufptr+7] = 0;\ + _SEQ_ADVBUF(8);} +/* + * The following 5 macros are incorrectly implemented and obsolete. + * Use SEQ_BENDER and SEQ_CONTROL (with proper controller) instead. + */ +#define SEQ_PITCHBEND(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER, value) +#define SEQ_BENDER_RANGE(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER_RANGE, value) +#define SEQ_EXPRESSION(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_EXPRESSION, value*128) +#define SEQ_MAIN_VOLUME(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_MAIN_VOLUME, (value*16383)/100) +#define SEQ_PANNING(dev, voice, pos) SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2) +#if 0 +#define SEQ_PANNING(dev, voice, pos) {_SEQ_NEEDBUF(8);\ + _seqbuf[_seqbufptr] = SEQ_EXTENDED;\ + _seqbuf[_seqbufptr+1] = SEQ_BALANCE;\ + _seqbuf[_seqbufptr+2] = (dev);\ + _seqbuf[_seqbufptr+3] = (voice);\ + (char)_seqbuf[_seqbufptr+4] = (pos);\ + _seqbuf[_seqbufptr+5] = 0;\ + _seqbuf[_seqbufptr+6] = 0;\ + _seqbuf[_seqbufptr+7] = 1;\ + _SEQ_ADVBUF(8);} +#endif + +/* + * Timing and syncronization macros + */ + +#define _TIMER_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\ + _seqbuf[_seqbufptr+0] = EV_TIMING; \ + _seqbuf[_seqbufptr+1] = (ev); \ + _seqbuf[_seqbufptr+2] = 0;\ + _seqbuf[_seqbufptr+3] = 0;\ + *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \ + _SEQ_ADVBUF(8);} + +#define SEQ_START_TIMER() _TIMER_EVENT(TMR_START, 0) +#define SEQ_STOP_TIMER() _TIMER_EVENT(TMR_STOP, 0) +#define SEQ_CONTINUE_TIMER() _TIMER_EVENT(TMR_CONTINUE, 0) +#define SEQ_WAIT_TIME(ticks) _TIMER_EVENT(TMR_WAIT_ABS, ticks) +#define SEQ_DELTA_TIME(ticks) _TIMER_EVENT(TMR_WAIT_REL, ticks) +#define SEQ_ECHO_BACK(key) _TIMER_EVENT(TMR_ECHO, key) +#define SEQ_SET_TEMPO(value) _TIMER_EVENT(TMR_TEMPO, value) +#define SEQ_SONGPOS(pos) _TIMER_EVENT(TMR_SPP, pos) +#define SEQ_TIME_SIGNATURE(sig) _TIMER_EVENT(TMR_TIMESIG, sig) + +/* + * Local control events + */ + +#define _LOCAL_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\ + _seqbuf[_seqbufptr+0] = EV_SEQ_LOCAL; \ + _seqbuf[_seqbufptr+1] = (ev); \ + _seqbuf[_seqbufptr+2] = 0;\ + _seqbuf[_seqbufptr+3] = 0;\ + *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \ + _SEQ_ADVBUF(8);} + +#define SEQ_PLAYAUDIO(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO, devmask) +#define SEQ_PLAYAUDIO2(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO2, devmask) +#define SEQ_PLAYAUDIO3(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO3, devmask) +#define SEQ_PLAYAUDIO4(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO4, devmask) +/* + * Events for the level 1 interface only + */ + +#define SEQ_MIDIOUT(device, byte) {_SEQ_NEEDBUF(4);\ + _seqbuf[_seqbufptr] = SEQ_MIDIPUTC;\ + _seqbuf[_seqbufptr+1] = (byte);\ + _seqbuf[_seqbufptr+2] = (device);\ + _seqbuf[_seqbufptr+3] = 0;\ + _SEQ_ADVBUF(4);} + +/* + * Patch loading. + */ +#ifdef OSSLIB +# define SEQ_WRPATCH(patchx, len) \ + OSS_write_patch(seqfd, (char*)(patchx), len) +# define SEQ_WRPATCH2(patchx, len) \ + OSS_write_patch2(seqfd, (char*)(patchx), len) +#else +# define SEQ_WRPATCH(patchx, len) \ + {if (_seqbufptr) SEQ_DUMPBUF();\ + if (write(seqfd, (char*)(patchx), len)==-1) \ + perror("Write patch: /dev/sequencer");} +# define SEQ_WRPATCH2(patchx, len) \ + (SEQ_DUMPBUF(), write(seqfd, (char*)(patchx), len)) +#endif + +#endif +#endif diff --git a/h/drv/timer/CIOTimer.h b/h/drv/timer/CIOTimer.h new file mode 100644 index 0000000..45b9fe7 --- /dev/null +++ b/h/drv/timer/CIOTimer.h @@ -0,0 +1,51 @@ +/* CIOTimer.h - header for Zilog CIO timer driver */ + +/* Copyright 1984-2002, Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,26apr02,dat Adding cplusplus protection, SPR 75017 +01a,18feb94,gah Created to allow the use of (prototyped) functions outside of + sysLib.c +*/ + +#ifndef __INCCIOTimerh +#define __INCCIOTimerh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Function prototypes: */ + +void sysCioInt (void); +void sysClkInt (void); +STATUS sysClkConnect ( + FUNCPTR routine, /* routine called at each system clock interrupt */ + int arg /* argument with which to call routine */ + ); +void sysClkDisable (void); +void sysClkEnable (void); +int sysClkRateGet (void); /* Now returns int, not UINT32. gah, 2/2/94 */ +STATUS sysClkRateSet ( + int ticksPerSecond /* number of clock interrupts per second */ + ); +void sysAuxClkInt (void); +STATUS sysAuxClkConnect ( + FUNCPTR routine, /* routine called at each aux. clock interrupt */ + int arg /* argument with which to call routine */ + ); +void sysAuxClkDisable (void); +void sysAuxClkEnable (void); +int sysAuxClkRateGet (void); /* Now returns int, not UINT32. gah, 2/2/94 */ +STATUS sysAuxClkRateSet ( + int ticksPerSecond /* number of clock interrupts per second */ + ); +void sysHwInit2 (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCCIOTimerh */ diff --git a/h/drv/timer/ambaTimer.h b/h/drv/timer/ambaTimer.h new file mode 100644 index 0000000..47dd9a2 --- /dev/null +++ b/h/drv/timer/ambaTimer.h @@ -0,0 +1,82 @@ +/* ambaTimer.h - ARM AMBA timer header */ + +/* Copyright 1996-1997 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,31oct01,rec integrator AP changes +01c,24nov97,jpd renamed from amba.h to ambaTimer.h. +01b,18aug97,jpd Added timers 3 and 4, added TC_EXTERNAL definition. +01a,10jul96,jpd Written, based on i8253.h version 01b. +*/ + +#ifndef __INCambaTimerh +#define __INCambaTimerh + +#ifdef __cplusplus +extern "C" { +#endif + +/* default definitions */ + + +/* register definitions */ + +#ifndef AMBA_BASE_OFFSET +#define AMBA_BASE_OFFSET 0X20 +#endif + +#define AMBA_TIMER_T1LOAD(base) \ + (volatile UINT32 *)((base) + 0x00) /* T1 Load (R/W) */ +#define AMBA_TIMER_T1VALUE(base) \ + (volatile UINT32 *)((base) + 0x04) /* T1 Value (R/O) */ +#define AMBA_TIMER_T1CTRL(base) \ + (volatile UINT32 *)((base) + 0x08) /* T1 Control (R/W) */ +#define AMBA_TIMER_T1CLEAR(base) \ + (volatile UINT32 *)((base) + 0x0C) /* T1 Clear (W/O) */ + +#define AMBA_TIMER_T2LOAD(base) \ + (volatile UINT32 *)((base) + AMBA_BASE_OFFSET + 0x00) /* T2 Load (R/W) */ +#define AMBA_TIMER_T2VALUE(base) \ + (volatile UINT32 *)((base) + AMBA_BASE_OFFSET + 0x04) /* T2 Value (R/O) */ +#define AMBA_TIMER_T2CTRL(base) \ + (volatile UINT32 *)((base) + AMBA_BASE_OFFSET + 0x08) /* T2 Control (R/W) */ +#define AMBA_TIMER_T2CLEAR(base) \ + (volatile UINT32 *)((base) + AMBA_BASE_OFFSET + 0x0C) /* T2 Clear (W/O) */ + +#define AMBA_TIMER_T3LOAD(base) \ + (volatile UINT32 *)((base) + 2 * AMBA_BASE_OFFSET + 0x00) /* T3 Load (R/W) */ +#define AMBA_TIMER_T3VALUE(base) \ + (volatile UINT32 *)((base) + 2 * AMBA_BASE_OFFSET + 0x04) /* T3 Value (R/O) */ +#define AMBA_TIMER_T3CTRL(base) \ + (volatile UINT32 *)((base) + 2 * AMBA_BASE_OFFSET + 0x08) /* T3 Control (R/W) */ +#define AMBA_TIMER_T3CLEAR(base) \ + (volatile UINT32 *)((base) + 2 * AMBA_BASE_OFFSET + 0x0C) /* T3 Clear (W/O) */ + +#define AMBA_TIMER_T4LOAD(base) \ + (volatile UINT32 *)((base) + 3 * AMBA_BASE_OFFSET + 0x00) /* T4 Load (R/W) */ +#define AMBA_TIMER_T4VALUE(base) \ + (volatile UINT32 *)((base) + 3 * AMBA_BASE_OFFSET + 0x04) /* T4 Value (R/O) */ +#define AMBA_TIMER_T4CTRL(base) \ + (volatile UINT32 *)((base) + 3 * AMBA_BASE_OFFSET + 0x08) /* T4 Control (R/W) */ +#define AMBA_TIMER_T4CLEAR(base) \ + (volatile UINT32 *)((base) + 3 * AMBA_BASE_OFFSET + 0x0C) /* T4 Clear (W/O) */ + +/* Timer Control register bit definitions */ + +#define TC_DIV1 0 +#define TC_DIV16 (1<<2) +#define TC_DIV256 (1<<3) +#define TC_EXTERNAL (3<<2) +#define TC_PERIODIC (1<<6) +#define TC_FREERUN 0 +#define TC_ENABLE (1<<7) +#define TC_DISABLE 0 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCambaTimerh */ + diff --git a/h/drv/timer/amd8111Timer.h b/h/drv/timer/amd8111Timer.h new file mode 100644 index 0000000..5396e70 --- /dev/null +++ b/h/drv/timer/amd8111Timer.h @@ -0,0 +1,29 @@ +/* amd8111Timer.h - AMD8111 Timer register definitions. */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01a,07jul05,gtf New +*/ + +#ifndef __INCamd81111Timerh +#define __INCamd81111Timerh + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCamd8111Timerh */ diff --git a/h/drv/timer/coldfireTimer.h b/h/drv/timer/coldfireTimer.h new file mode 100644 index 0000000..7b48e65 --- /dev/null +++ b/h/drv/timer/coldfireTimer.h @@ -0,0 +1,68 @@ +/* coldfireTimer.h - ColdFire Timer header */ + +/* +modification history +-------------------- +01b,03apr01,dh support for 5272 added (allows external definition of TER type) +01b,19oct01,dee Merge from T2.1.0 release +01a,13apr98,mem written +*/ + +#ifndef __INCcoldfireTimerh +#define __INCcoldfireTimerh + +/* +This file contains constants and typedefs for the timer contained in several +of the Motorola ColdFire ports. +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +/* To change the size of the TER register, define the DEFINED_cfTer_t macro + and supply a typedef for cfTer_t. +*/ +#ifndef DEFINED_cfTer_t +#define DEFINED_cfTer_t +typedef UINT8 cfTer_t; +#endif + +/* defines */ + +#define COLDFIRE_TMR_CE_DIS (0 << 6) /* disable int on capture */ +#define COLDFIRE_TMR_CE_RISE (1 << 6) /* capture on rising edge */ +#define COLDFIRE_TMR_CE_FALL (2 << 6) /* capture on falling edge */ +#define COLDFIRE_TMR_CE_ANY (3 << 6) /* capture on any edge */ +#define COLDFIRE_TMR_OM (1 << 5) /* output mode */ +#define COLDFIRE_TMR_ORI (1 << 4) /* output ref int enable */ +#define COLDFIRE_TMR_FRR (1 << 3) /* free run/restart */ +#define COLDFIRE_TMR_CLK_STOP (0 << 1) /* stop count */ +#define COLDFIRE_TMR_CLK_BUS (1 << 1) /* system bus clock */ +#define COLDFIRE_TMR_CLK_BUS16 (2 << 1) /* system bus clock / 16 */ +#define COLDFIRE_TMR_CLK_TIN (3 << 1) /* TIN pin */ +#define COLDFIRE_TMR_EN (1 << 0) /* enable (reset) timer */ + +#define COLDFIRE_TER_REF (1 << 1) /* output reference event */ +#define COLDFIRE_TER_CAP (1 << 0) /* capture event */ + +/* typedefs */ + +typedef struct + { + volatile UINT16 *tmr; /* timer mode register */ + volatile cfTer_t *ter; /* timer event register */ + volatile UINT16 *tcn; /* timer counter register */ + volatile UINT16 *tcr; /* timer capture register */ + volatile UINT16 *trr; /* timer reference register */ + volatile void *imr; /* interrupt mask register */ + + int imrSize; /* size of IMR in bytes */ + ULONG imrMask; /* mask bit in IMR register */ + } COLDFIRE_TIMER; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcoldfireTimerh */ diff --git a/h/drv/timer/dga001Timer.h b/h/drv/timer/dga001Timer.h new file mode 100644 index 0000000..9acc0cf --- /dev/null +++ b/h/drv/timer/dga001Timer.h @@ -0,0 +1,17 @@ +/* dga001Timer.h - Densan DGA-001 Timer */ + +/* Copyright 1997-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,26apr02,dat Adding cplusplus protection, SPR 75017 +01a,12jul97,hk created. +*/ + +/* +DESCRIPTION +This file contains constants for the Densan DGA-001 timer. +*/ + +#include "drv/vme/dga001Vme.h" diff --git a/h/drv/timer/i8253.h b/h/drv/timer/i8253.h new file mode 100644 index 0000000..0f3c7f1 --- /dev/null +++ b/h/drv/timer/i8253.h @@ -0,0 +1,41 @@ +/* i8253.h - Intel 8253 PIT (Programmable Interrupt Timer) */ + +/* Copyright 1984-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,16jun93,hdn updated to 5.1. +01a,20may92,hdn written. +*/ + +#ifndef __INCi8253h +#define __INCi8253h + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The macro PIT_REG_ADDR_INTERVAL must be defined + * when including this header. + */ + +/* default definitions */ + +#define CAST + +#define PIT_ADRS(base,reg) (CAST (base+(reg*PIT_REG_ADDR_INTERVAL))) + +/* register definitions */ + +#define PIT_CNT0(base) PIT_ADRS(base,0x00) /* Counter 0. */ +#define PIT_CNT1(base) PIT_ADRS(base,0x01) /* Counter 1. */ +#define PIT_CNT2(base) PIT_ADRS(base,0x02) /* Counter 2. */ +#define PIT_CMD(base) PIT_ADRS(base,0x03) /* Control word. */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCi8253h */ diff --git a/h/drv/timer/i8254.h b/h/drv/timer/i8254.h new file mode 100644 index 0000000..b187e6c --- /dev/null +++ b/h/drv/timer/i8254.h @@ -0,0 +1,180 @@ +/* i8254.h - intel 8254 timer header */ + +/* +modification history +-------------------- +01h,25sep98,cdp added ARM support. +01g,24feb97,bjl moved #if CPU_FAMILY==MIPS after #ifdef __cplusplus + removed first #endif INCi8254h + added #endif CPU_FAMILY==MIPS +01f,22sep92,rrr added support for c++ +01e,26may92,rrr the tree shuffle +01d,28oct91,wmd added #pragmas as defined by Intel. +01c,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01b,20apr90,ajm merged in MIPS BSP version for now, must resolve later. +01a,20aug91,del installed. +*/ + + +#ifndef __INCi8254h +#define __INCi8254h + +#ifdef __cplusplus +extern "C" { +#endif + +#if (CPU_FAMILY == MIPS) || (CPU_FAMILY == ARM) +/* + +* INTERNAL +* On some BSPs, the output of counter2 drives the input to counters 0 +* and 1. This mandates setup of counter2 before counters 0 and 1 can be +* programmed. On hkv3500, counter 2's input is being driven at 3.6864Mhz +* by the STAR card. + +*/ + +#define PAD 3 + +#ifndef _ASMLANGUAGE + +typedef struct { + unsigned char counter0;unsigned char pad0[PAD];/* counter 0 */ + unsigned char counter1;unsigned char pad1[PAD];/* counter 1 */ + unsigned char counter2;unsigned char pad2[PAD];/* counter 2 */ + unsigned char cntrl_word;unsigned char pad3[PAD];/* control word */ +}TIMER; + +#endif /* _ASMLANGUAGE */ + +/* +* control word definitions +*/ + +#define CW_BCDMD 0x1 /* operate in BCD mode */ +#define CW_COUNTLCH 0x00 /* counter latch command */ +#define CW_LSBYTE 0x10 /* r/w least signif. byte only */ +#define CW_MSBYTE 0x20 /* r/w most signif. byte only */ +#define CW_BOTHBYTE 0x30 /* r/w 16 bits, lsb then msb */ +#define CW_READBK 0xc0 /* read-back command */ +#define CW_MODE(x) ((x)<<1) /* set mode to x */ +#define CW_SELECT(x) ((x)<<6) /* select counter x */ + +/* +* Mode defs +*/ + +#define MD_TERMCOUNT 0x0 /* interrupt on terminal count */ +#define MD_HWONESHOT 0x1 /* hw retriggerable one shot */ +#define MD_RATEGEN 0x2 /* rate generator */ +#define MD_SQUAREWV 0x3 /* square wave generator */ +#define MD_SWTRIGSB 0x4 /* software triggered strobe */ +#define MD_HWTRIGSB 0x5 /* hardware triggered strobe */ + +#else /* CPU_FAMILY==MIPS */ + + +/******************************************************************/ +/* Copyright (c) 1989, Intel Corporation + + Intel hereby grants you permission to copy, modify, and + distribute this software and its documentation. Intel grants + this permission provided that the above copyright notice + appears in all copies and that both the copyright notice and + this permission notice appear in supporting documentation. In + addition, Intel grants this permission provided that you + prominently mark as not part of the original any modifications + made to this software or documentation, and that the name of + Intel Corporation not be used in advertising or publicity + pertaining to distribution of the software or the documentation + without specific, written prior permission. + + Intel Corporation does not warrant, guarantee or make any + representations regarding the use of, or the results of the use + of, the software and documentation in terms of correctness, + accuracy, reliability, currentness, or otherwise; and you rely + on the software, documentation and results solely at your own + risk. */ +/******************************************************************/ +/*-------------------------------------------------------------*/ +/* + * i8254.h header for 82c54-2 timer/counter + * + */ +/*-------------------------------------------------------------*/ + +#if CPU_FAMILY == I960 +#pragma align 1 +#endif + +typedef volatile struct + { + unsigned char counter_0; + unsigned char counter_1; + unsigned char counter_2; + unsigned char control_word; + } I82C54; + +#if CPU_FAMILY == I960 +#pragma align 0 +#endif + +/* Control Word Format */ +#define SC(sc) ((sc)<<6) +#define RW(rw) ((rw)<<4) +#define MODE(m) ((m)<<1) +#define BCD (1) + +/* Control Words */ + +#define SEL_CNT_0 0x00 +#define SEL_CNT_1 0x40 +#define SEL_CNT_2 0x80 +#define READ_BACK 0xc0 +#define READ_BACK_0 0xc2 +#define READ_BACK_1 0xc4 +#define READ_BACK_2 0xc8 + +#define RW_LATCH 0x00 +#define RW_LO_BYTE 0x10 +#define RW_HI_BYTE 0x20 +#define RW_HI_LO_BYTES 0x30 + +#define WRT_CNT_0_LO (SEL_CNT_0 | RW_LO_BYTE) +#define WRT_CNT_1_LO (SEL_CNT_1 | RW_LO_BYTE) +#define WRT_CNT_2_LO (SEL_CNT_2 | RW_LO_BYTE) +#define WRT_CNT_0_HI (SEL_CNT_0 | RW_HI_BYTE) +#define WRT_CNT_1_HI (SEL_CNT_1 | RW_HI_BYTE) +#define WRT_CNT_2_HI (SEL_CNT_2 | RW_HI_BYTE) +#define WRT_CNT_0_HI_LO (SEL_CNT_0 | RW_HI_LO_BYTES) +#define WRT_CNT_1_HI_LO (SEL_CNT_1 | RW_HI_LO_BYTES) +#define WRT_CNT_2_HI_LO (SEL_CNT_2 | RW_HI_LO_BYTES) + +/* Readback Commands */ +#define READBACK (3<<6) +#define LATCH_COUNT (1<<4) +#define LATCH_STATUS (1<<5) +#define CNT_0 (1<<1) +#define CNT_1 (1<<2) +#define CNT_2 (1<<3) + +/* Status Bits */ +#define OUTPUT_BIT (1<<7) +#define NULL_COUNT_BIT (1<<6) +#define RW1_BIT (1<<5) +#define RW0_BIT (1<<4) +#define M2_BIT (1<<3) +#define M1_BIT (1<<2) +#define M0_BIT (1<<1) +#define BCD_BIT (1<<0) + +#endif /* CPU_FAMILY==MIPS */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCi8254h */ diff --git a/h/drv/timer/ixp400Timer.h b/h/drv/timer/ixp400Timer.h new file mode 100644 index 0000000..f978e69 --- /dev/null +++ b/h/drv/timer/ixp400Timer.h @@ -0,0 +1,71 @@ +/* ixp400Timer.h - ixp400 processor timer library */ + +/* +Copyright (c) 2002-2004 Wind River Systems, Inc. All rights reserved. +Certain portions of these files may be copyright (c) 2002-2004 Intel +Corporation. +*/ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01e,24aug05,m_h vxWorks 6.1 support +01d,20dec04,pai Updated copyright notice. +01c,09jul03,m_h multiple callouts from auxClk +01b,27feb03,jb3 add C++ protection +01a,05jun02,jb initial version... +*/ + +#ifndef INCixp400Timerh +#define INCixp400Timerh + +#ifdef __cplusplus +extern "C" { +#endif + +#define SYS_CLK_RATE_MIN (10) /* Minimum rate at which the system clock can run */ +#define SYS_CLK_RATE_MAX (1000) /* 1000 ticks, Maximum rate at which the system clock can run */ + +/* Do not actually have an auxiliary clock */ +#define AUX_CLK_RATE_MIN (10) /* Minimum rate at which the auxiliary clock can run */ +#define AUX_CLK_RATE_MAX (1000) /* 1000 ticks, Maximum rate at which the auxiliary clock can run */ + + +/* auxClk functionality used within this BSP */ +STATUS ixpAuxClkConnect (FUNCPTR routine, int arg); +void ixpAuxClkDisconnect (void); +void ixpAuxClkDisable (void); +void ixpAuxClkEnable (void); +int ixpAuxClkRateGet (void); +STATUS ixpAuxClkRateSet (int ticksPerSecond); + + +/* 50MHz emulation mode for ixp465 */ +BOOL ixpTimer20NsEmulSet(BOOL useEmul); +BOOL ixpTimer20NsEmulGet(void); +BOOL ixpAuxTimer20NsEmulSet(BOOL useEmul); +BOOL ixpAuxTimer20NsEmulGet(void); + +void ixp400WatchDogInt (void); +STATUS ixp400WatchDogConnect(FUNCPTR routine, int arg); +STATUS ixp400WatchDogEnable(void); +STATUS ixp400WatchDogDisable (void); +UINT32 ixp400WatchdogPeriod (void); +STATUS ixp400WatchDogPeriodSet(UINT32 counts); +UINT32 ixp400WatchDogFreq (void); +void ixp400WatchDogService(void); + +/* Assembly specific defs */ +#ifndef _ASMLANGUAGE +#endif + + +#ifdef __cplusplus +} +#endif + + +#endif /* INCixp400Timer.h */ + diff --git a/h/drv/timer/m5200GPTimer.h b/h/drv/timer/m5200GPTimer.h new file mode 100644 index 0000000..63bd470 --- /dev/null +++ b/h/drv/timer/m5200GPTimer.h @@ -0,0 +1,101 @@ +/* m5200GPTimer.h - Motorola MPC5200 General Purpose Timer (GPT) driver */ + +/* Copyright 2000-2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,06dec03,pdr created + +*/ + +#ifndef __INCm5200GPTimerh +#define __INCm5200GPTimerh + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* routines */ + +/* TMU3 routines */ +IMPORT STATUS sysUserClkConnect ( FUNCPTR routine, int arg ); +IMPORT void sysUserClkDisable ( void ); +IMPORT void sysUserClkEnable ( void ); +IMPORT int sysUserClkRateGet ( void ); +IMPORT STATUS sysUserClkRateSet ( int ticksPerSecond ); +IMPORT BOOL sysUserClkIsRunning ( void ); + +/* TMU4 routines */ +IMPORT STATUS sysUserAuxClkConnect ( FUNCPTR routine, int arg ); +IMPORT void sysUserAuxClkDisable ( void ); +IMPORT void sysUserAuxClkEnable ( void ); +IMPORT int sysUserAuxClkRateGet ( void ); +IMPORT STATUS sysUserAuxClkRateSet ( int ticksPerSecond ); +IMPORT BOOL sysUserAuxClkIsRunning ( void ); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* __INCm5200GPTimerh */ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/h/drv/timer/m5200SliceTimer.h b/h/drv/timer/m5200SliceTimer.h new file mode 100644 index 0000000..97e9613 --- /dev/null +++ b/h/drv/timer/m5200SliceTimer.h @@ -0,0 +1,50 @@ +/* m5200SliceTimer.h - PowerPC Slice Timer (SLT) header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,15sep03,pdr created. +*/ + +/* +DESCRIPTION +This file contains header information for PowerPC Slice timer routines. +*/ + +#ifndef __INCm5200SliceTimerh +#define __INCm5200SliceTimerh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +#ifndef _ASMLANGUAGE +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT STATUS sysAuxClkConnect (FUNCPTR routine, int arg); +IMPORT void sysAuxClkDisable (void); +IMPORT void sysAuxClkEnable (void); +IMPORT int sysAuxClkRateGet (void); +IMPORT STATUS sysAuxClkRateSet (int ticksPerSecond); + +#else /* __STDC__ */ + +IMPORT STATUS sysAuxClkConnect (); +IMPORT void sysAuxClkDisable (); +IMPORT void sysAuxClkEnable (); +IMPORT int sysAuxClkRateGet (); +IMPORT STATUS sysAuxClkRateSet (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm5200SliceTimerh */ diff --git a/h/drv/timer/m5m82c54fp.h b/h/drv/timer/m5m82c54fp.h new file mode 100644 index 0000000..dd43ee7 --- /dev/null +++ b/h/drv/timer/m5m82c54fp.h @@ -0,0 +1,59 @@ +/* m5m82c54fp.h - Mitsubishi 82c54 PIT chip header */ + +/* Copyright 1991-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01d,22sep92,rrr added support for c++ +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01a,23may91,hdn written. +*/ + +#ifndef __INCm5m82c54fph +#define __INCm5m82c54fph + +#ifdef __cplusplus +extern "C" { +#endif + +#define M5M82C54FP_REG_OFFSET 3 + +#ifndef _ASMLANGUAGE +typedef struct + { + UCHAR pad0[M5M82C54FP_REG_OFFSET]; + UCHAR counter0; + UCHAR pad1[M5M82C54FP_REG_OFFSET]; + UCHAR counter1; + UCHAR pad2[M5M82C54FP_REG_OFFSET]; + UCHAR counter2; + UCHAR pad3[M5M82C54FP_REG_OFFSET]; + UCHAR control; + } PIT; +#endif /* _ASMLANGUAGE */ + +/* bit value for control register */ +#define PIT_SELECT_COUNTER0 0x00 +#define PIT_SELECT_COUNTER1 0x40 +#define PIT_SELECT_COUNTER2 0x80 +#define PIT_RL_LATCH 0x00 +#define PIT_RL_LOW 0x10 +#define PIT_RL_HIGH 0x20 +#define PIT_RL_LOWHIGH 0x30 +#define PIT_MODE0 0x00 +#define PIT_MODE1 0x02 +#define PIT_MODE2 0x04 +#define PIT_MODE3 0x06 +#define PIT_MODE4 0x08 +#define PIT_MODE5 0x0a +#define PIT_BCD 0x01 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm5m82c54fph */ diff --git a/h/drv/timer/m8260Clock.h b/h/drv/timer/m8260Clock.h new file mode 100644 index 0000000..1c64745 --- /dev/null +++ b/h/drv/timer/m8260Clock.h @@ -0,0 +1,66 @@ +/* m8260Clock - Motorola MPC8260 Clock header file */ + +/* Copyright 1984-1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,12sep99,ms_ created from m8260Cpm.h, 01d. +*/ + +/* + * This file contains constants for the clock block in the Motorola + * MPC8260 PowerQUICC II integrated Communications Processor + */ + +#ifndef __INCm8260Clockh +#define __INCm8260Clockh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef M8260ABBREVIATIONS +#define M8260ABBREVIATIONS + +#ifdef _ASMLANGUAGE +#define CAST(x) +#else /* _ASMLANGUAGE */ +typedef volatile UCHAR VCHAR; /* shorthand for volatile UCHAR */ +typedef volatile INT32 VINT32; /* volatile unsigned word */ +typedef volatile INT16 VINT16; /* volatile unsigned halfword */ +typedef volatile INT8 VINT8; /* volatile unsigned byte */ +typedef volatile UINT32 VUINT32; /* volatile unsigned word */ +typedef volatile UINT16 VUINT16; /* volatile unsigned halfword */ +typedef volatile UINT8 VUINT8; /* volatile unsigned byte */ +#define CAST(x) (x) +#endif /* _ASMLANGUAGE */ + +#endif /* M8260ABBREVIATIONS */ + +/* + * MPC8260 internal register/memory map (section 17 of prelim. spec) + * note that these are offsets from the value stored in the IMMR + * register. Also note that in the MPC8260, the IMMR is not a special + * purpose register, but it is memory mapped. + */ + +/* System Clock Control Register */ + +#define M8260_SCCR(base) (CAST(VUINT32 *)((base) + 0x10c80)) + +/* System Clock Control Register bit definition (SCCR - 0x10c80) */ + +#define M8260_SCCR_RES_MSK 0xfffffff8 /* reserved field Mask */ +#define M8260_SCCR_CPM_LOW 0x00000004 /* CPM and SIU low power */ +#define M8260_SCCR_DFBRG_4 0x00000000 /* divide by 4 */ +#define M8260_SCCR_DFBRG_16 0x00000001 /* divide by 16 */ +#define M8260_SCCR_DFBRG_64 0x00000002 /* divide by 64 */ +#define M8260_SCCR_DFBRG_128 0x00000003 /* divide by 128 */ +#define M8260_SCCR_TBS 0x02000000 /* Time Base Source */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm8260Clockh */ diff --git a/h/drv/timer/m8260Timer.h b/h/drv/timer/m8260Timer.h new file mode 100644 index 0000000..48fb315 --- /dev/null +++ b/h/drv/timer/m8260Timer.h @@ -0,0 +1,123 @@ +/* m8260Timer.h */ + +/* Copyright 1984-1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,15jul99,ms_ make compliant with our coding standards +01b,21may99,ms_ local +01a,17apr99,ms_ adapted from ppc860Timer.h ref 01c +*/ + +/* +DESCRIPTION +This file contains header information for PowerPC timer routines. +*/ + +#ifndef __INCm8260Timerh +#define __INCm8260Timerh + +#ifdef __cplusplus +extern "C" { +#endif + +/* CPM Timer Register sets */ + +/* Timer 1 and Timer 2 Global Configuration Register */ + +#define M8260_TGCR1(base) (CAST(VUINT8 *)((base) + 0x10D80)) + +/* Timer 3 and Timer 4 Global Configuration Register */ + +#define M8260_TGCR2(base) (CAST(VUINT8 *)((base) + 0x10D84)) + +/* CPM Timer Mode Registers */ + +#define M8260_TMR1(base) (CAST(VUINT16 *)((base) + 0x10D90)) /* Timer 1 */ +#define M8260_TMR2(base) (CAST(VUINT16 *)((base) + 0x10D92)) /* Timer 2 */ +#define M8260_TMR3(base) (CAST(VUINT16 *)((base) + 0x10DA0)) /* Timer 3 */ +#define M8260_TMR4(base) (CAST(VUINT16 *)((base) + 0x10DA2)) /* Timer 4 */ + +/* CPM Timer Reference Registers */ + +#define M8260_TRR1(base) (CAST(VUINT16 *)((base) + 0x10D94)) /* Timer 1 */ +#define M8260_TRR2(base) (CAST(VUINT16 *)((base) + 0x10D96)) /* Timer 2 */ +#define M8260_TRR3(base) (CAST(VUINT16 *)((base) + 0x10DA4)) /* Timer 3 */ +#define M8260_TRR4(base) (CAST(VUINT16 *)((base) + 0x10DA6)) /* Timer 4 */ + +/* CPM Timer Capture Registers */ + +#define M8260_TCR1(base) (CAST(VUINT16 *)((base) + 0x10D98)) /* Timer 1 */ +#define M8260_TCR2(base) (CAST(VUINT16 *)((base) + 0x10D9A)) /* Timer 2 */ +#define M8260_TCR3(base) (CAST(VUINT16 *)((base) + 0x10DA8)) /* Timer 3 */ +#define M8260_TCR4(base) (CAST(VUINT16 *)((base) + 0x10DAA)) /* Timer 4 */ + +/* CPM Timer Counters */ + +#define M8260_TCN1(base) (CAST(VUINT16 *)((base) + 0x10D9C)) /* Timer 1 */ +#define M8260_TCN2(base) (CAST(VUINT16 *)((base) + 0x10D9E)) /* Timer 2 */ +#define M8260_TCN3(base) (CAST(VUINT16 *)((base) + 0x10DAC)) /* Timer 3 */ +#define M8260_TCN4(base) (CAST(VUINT16 *)((base) + 0x10DAE)) /* Timer 4 */ + +/* CPM Timer Event Registers */ + +#define M8260_TER1(base) (CAST(VUINT16 *)((base) + 0x10DB0)) /* Timer 1 */ +#define M8260_TER2(base) (CAST(VUINT16 *)((base) + 0x10DB2)) /* Timer 2 */ +#define M8260_TER3(base) (CAST(VUINT16 *)((base) + 0x10DB4)) /* Timer 3 */ +#define M8260_TER4(base) (CAST(VUINT16 *)((base) + 0x10DB6)) /* Timer 4 */ + +/* CPM Timer Bit Definitions */ + +/* Timer Global Configuration Register Bit Definitions */ + +#define M8260_TGCR_CAS2 0x80 /* Cascade Timers 1 and 2*/ +#define M8260_TGCR_STP2 0x20 /* Stop timer 2 */ +#define M8260_TGCR_RST2 0x10 /* Reset timer 2 */ +#define M8260_TGCR_GM1 0x08 /* Gate Mode for TGATE1 */ +#define M8260_TGCR_STP1 0x02 /* Stop timer 1 */ +#define M8260_TGCR_RST1 0x01 /* Reset timer 1 */ + +#define M8260_TGCR_CAS4 0x80 /* Cascade Timers 3 and 4*/ +#define M8260_TGCR_STP4 0x20 /* Stop timer 4 */ +#define M8260_TGCR_RST4 0x10 /* Reset timer 4 */ +#define M8260_TGCR_GM2 0x08 /* Gate Mode for TGATE2 */ +#define M8260_TGCR_STP3 0x02 /* Stop timer 3 */ +#define M8260_TGCR_RST3 0x01 /* Reset timer 3 */ + + +/* Timer Mode Register Bit Definitions */ + +#define M8260_TMR_PS_MSK 0xff00 /* Mask for Prescaler Value */ +#define M8260_TMR_CE_MSK 0x00c0 /* Capture Edge and Enable Interrupt */ +#define M8260_TMR_CE_INTR_DIS 0x0000 /* Disable Interrupt on capture event */ +#define M8260_TMR_CE_RISING 0x0040 /* Capture on Rising TINx edge only */ +#define M8260_TMR_CE_FALLING 0x0080 /* Capture on Falling TINx edge only */ +#define M8260_TMR_CE_ANY 0x00c0 /* Capture on any TINx edge */ +#define M8260_TMR_OM 0x0020 /* Output Mode */ +#define M8260_TMR_ORI 0x0010 /* Output Reference Interrupt Enable */ +#define M8260_TMR_FRR 0x0008 /* Free Run/Restart */ +#define M8260_TMR_ICLK_MSK 0x0006 /* Timer Input Clock Source mask */ +#define M8260_TMR_ICLK_IN_CAS 0x0000 /* Internally cascaded input */ +#define M8260_TMR_ICLK_IN_GEN 0x0002 /* Internal General system clock */ +/* Internal General system clk div 16 */ +#define M8260_TMR_ICLK_IN_GEN_DIV16 0x0004 +#define M8260_TMR_ICLK_TIN_PIN 0x0006 /* TINx pin */ +#define M8260_TMR_GE 0x0001 /* Gate Enable */ + +/* Timer Event Register Bit Definitions */ + +#define M8260_TER_REF 0x0002 /* Output Reference Event */ +#define M8260_TER_CAP 0x0001 /* Capture Event */ + +/* Other Timer Defines */ + +#define M8260_TRR_SIZE 16 /* number bits in Reference Register */ +#define M8260_TMR_PS_MIN 0x00 /* minimum prescale value */ +#define M8260_TMR_PS_MAX 0xff00 /* maximum prescale value */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm8260Timerh */ diff --git a/h/drv/timer/mc146818.h b/h/drv/timer/mc146818.h new file mode 100644 index 0000000..2645de5 --- /dev/null +++ b/h/drv/timer/mc146818.h @@ -0,0 +1,73 @@ +/* mc146818.h - Motorolla ? 146818 RTC (Real Time Clock) */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,13apr01,hdn added macros for status register A, B, C, D. +01b,09nov93,vin moved AUX_CLK_RATE_MIN and AUX_CLK_RATE_MAX macro definitions + to config.h +01a,17aug93,hdn written. +*/ + +#ifndef __INCmc146818h +#define __INCmc146818h + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifndef _ASMLANGUAGE + +typedef struct + { + int rate; + char bits; + } CLK_RATE; + +#endif /* _ASMLANGUAGE */ + + +/* offset of status register A, B, C, D */ + +#define MC146818_STATUS_A 0x0a /* Status Register A */ +#define MC146818_STATUS_B 0x0b /* Status Register B */ +#define MC146818_STATUS_C 0x0c /* Status Register C */ +#define MC146818_STATUS_D 0x0d /* Status Register D */ + +/* bit values for status register A - RW except UIP */ + +#define MC146818_UIP 0x80 /* Update In Progress */ +#define MC146818_DV_BITS 0x70 /* Divider Bits */ +#define MC146818_RS_BITS 0x0f /* Rate Selection Bits */ + +/* bit values for status register B - RW */ + +#define MC146818_SET 0x80 /* Set to 1 (abort update) */ +#define MC146818_PIE 0x40 /* Periodic Int Enable */ +#define MC146818_AIE 0x20 /* Alarm Int Enable */ +#define MC146818_UIE 0x10 /* Update-ended Int Enable */ +#define MC146818_SQWE 0x08 /* Square Wave Enable */ +#define MC146818_DM 0x04 /* Date Mode */ +#define MC146818_24 0x02 /* 1=24-hour 0=12-hour */ +#define MC146818_DSE 0x01 /* Daylight Saving Enable */ + +/* bit values for status register C - R */ + +#define MC146818_IRQF 0x80 /* Int Request Flag */ +#define MC146818_PF 0x40 /* Periodic Int Flag */ +#define MC146818_AF 0x20 /* Alarm Int Flag */ +#define MC146818_UF 0x10 /* Update-ended Int Flag */ + +/* bit values for status register D - R */ + +#define MC146818_VRT 0x80 /* Valid RAM and Time */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmc146818h */ diff --git a/h/drv/timer/ppc403Timer.h b/h/drv/timer/ppc403Timer.h new file mode 100644 index 0000000..24b0870 --- /dev/null +++ b/h/drv/timer/ppc403Timer.h @@ -0,0 +1,53 @@ +/* ppc403Timerh.h - PPC 403 Timers header */ + +/* Copyright 1984-2002, Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,26apr02,dat Adding cplusplus protection, SPR 75017 +01b,19sep01,pch Fix reversal of PIT and FIT in comments (for SPR 20698) +01a,23feb96,tam created. +*/ + + +#ifndef __INCppc403Timerh +#define __INCppc403Timerh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define _PPC403_TSR_ENW 0x80000000 /* enable next watchdog mask */ +#define _PPC403_TSR_WIS 0x40000000 /* WDT interrupt status mask */ +#define _PPC403_TSR_WRS 0x30000000 /* watchdog reset status mask */ +#define _PPC403_TSR_PIS 0x08000000 /* PIT interrupt status mask */ +#define _PPC403_TSR_FIS 0x04000000 /* FIT interrupt status mask */ + +#define _PPC403_TCR_WP 0xC0000000 /* watchdog period mask */ +#define _PPC403_TCR_WRC 0x30000000 /* wdog reset control mask */ +#define _PPC403_TCR_WIE 0x08000000 /* WDT interrupt enable mask */ +#define _PPC403_TCR_PIE 0x04000000 /* PIT interrupt enable mask */ +#define _PPC403_TCR_FP 0x03000000 /* FIT period mask */ +#define _PPC403_TCR_FIE 0x00800000 /* FIT interrupt enable mask */ +#define _PPC403_TCR_ARE 0x00400000 /* auto-reload enable mask */ + +/* typedefs */ + +typedef struct { + UINT32 fitPeriod; /* Fixed Interval Timer periods */ + UINT32 fpMask; /* corresponding TCR mask */ +}FIT_PERIOD; + +typedef struct { + UINT32 wdtPeriod; /* Watchdog Timer periods */ + UINT32 fpMask; /* corresponding TCR mask */ +}WDT_PERIOD; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCppc403Timerh */ diff --git a/h/drv/timer/ppcDecTimer.h b/h/drv/timer/ppcDecTimer.h new file mode 100644 index 0000000..2eeec02 --- /dev/null +++ b/h/drv/timer/ppcDecTimer.h @@ -0,0 +1,52 @@ +/* ppcDecTimer.h - PowerPC Timer header */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,27apr95,caf changed "60x" to "Dec", removed PPC60x_TIMER_INT_VECTOR macro. +01b,25jan95,vin cleanup. +01a,20jan95,kvk created. +*/ + +/* +DESCRIPTION +This file contains header information for PowerPC timer routines. +*/ + +#ifndef __INCppcDecTimerh +#define __INCppcDecTimerh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +#ifndef _ASMLANGUAGE +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT STATUS sysClkConnect (FUNCPTR routine, int arg); +IMPORT void sysClkDisable (void); +IMPORT void sysClkEnable (void); +IMPORT int sysClkRateGet (void); +IMPORT STATUS sysClkRateSet (int ticksPerSecond); + +#else /* __STDC__ */ + +IMPORT STATUS sysClkConnect (); +IMPORT void sysClkDisable (); +IMPORT void sysClkEnable (); +IMPORT int sysClkRateGet (); +IMPORT STATUS sysClkRateSet (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCppcDecTimerh */ diff --git a/h/drv/timer/ppcZ8536Timer.h b/h/drv/timer/ppcZ8536Timer.h new file mode 100644 index 0000000..659280d --- /dev/null +++ b/h/drv/timer/ppcZ8536Timer.h @@ -0,0 +1,342 @@ +/* ppcZ8536Timer.h - zilog CIO (counter,timer,parallel i/o chip) */ + +/* Copyright 1984-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,13apr00,dat added prototypes for driver entry points +01b,18jan99,sut remove ZCIO_DD_OUT, and added ZCIO_DD_PORT_x marcos (SPR 23111) +01a,07nov95,kvk created from version 01g of z8536.h for PPC. +*/ + +/* Note: in the following, the value '0x00' has been replaced by 'ZERO'. + This has been done to provide a way to avoid the 'clr.b' instruction + on the 68000/10 cpu. 'ZERO' should be defined to be a memory location + which holds the value '0x00', this will cause compilers to generate + memory to memory transfers rather than clear instructions. */ + +#ifndef __INCppcZ8536Timerh +#define __INCppcZ8536Timerh + +#ifdef __cplusplus +extern "C" { +#endif + +/* internal register addresses */ + +#define ZCIO_MIC ((UINT8) ZERO) /* Master Interrupt Control */ +#define ZCIO_MCC ((UINT8) 0x01) /* Master Configuration Control */ +#define ZCIO_PAIV ((UINT8) 0x02) /* Port A Interrupt Vector */ +#define ZCIO_PBIV ((UINT8) 0x03) /* Port B Interrupt Vector */ +#define ZCIO_CTIV ((UINT8) 0x04) /* Counter/Timer Interrupt Vector */ + +#define ZCIO_PCDPP ((UINT8) 0x05) /* Port C Data Path Polarity */ +#define ZCIO_PCDD ((UINT8) 0x06) /* Port C Data Direction */ +#define ZCIO_PCSIOC ((UINT8) 0x07) /* Port C Special I/O Control */ +#define ZCIO_PACS ((UINT8) 0x08) /* Port A Command and Status */ +#define ZCIO_PBCS ((UINT8) 0x09) /* Port B Command and Status */ + +#define ZCIO_CT1CS ((UINT8) 0x0a) /* C/T 1 Command and Status */ +#define ZCIO_CT2CS ((UINT8) 0x0b) /* C/T 2 Command and Status */ +#define ZCIO_CT3CS ((UINT8) 0x0c) /* C/T 3 Command and Status */ + +#define ZCIO_PAD ((UINT8) 0x0d) /* Port A Data */ +#define ZCIO_PBD ((UINT8) 0x0e) /* Port B Data */ +#define ZCIO_PCD ((UINT8) 0x0f) /* Port C Data */ + +#define ZCIO_CT1CCMSB ((UINT8) 0x10) /* C/T 1 Current Count (MS Byte) */ +#define ZCIO_CT1CCLSB ((UINT8) 0x11) /* C/T 1 Current Count (LS Byte) */ +#define ZCIO_CT2CCMSB ((UINT8) 0x12) /* C/T 2 Current Count (MS Byte) */ +#define ZCIO_CT2CCLSB ((UINT8) 0x13) /* C/T 2 Current Count (LS Byte) */ +#define ZCIO_CT3CCMSB ((UINT8) 0x14) /* C/T 3 Current Count (MS Byte) */ +#define ZCIO_CT3CCLSB ((UINT8) 0x15) /* C/T 3 Current Count (LS Byte) */ + +#define ZCIO_CT1TCMSB ((UINT8) 0x16) /* C/T 1 Time Constant (MS Byte) */ +#define ZCIO_CT1TCLSB ((UINT8) 0x17) /* C/T 1 Time Constant (LS Byte) */ +#define ZCIO_CT2TCMSB ((UINT8) 0x18) /* C/T 2 Time Constant (MS Byte) */ +#define ZCIO_CT2TCLSB ((UINT8) 0x19) /* C/T 2 Time Constant (LS Byte) */ +#define ZCIO_CT3TCMSB ((UINT8) 0x1a) /* C/T 3 Time Constant (MS Byte) */ +#define ZCIO_CT3TCLSB ((UINT8) 0x1b) /* C/T 3 Time Constant (LS Byte) */ + +#define ZCIO_CT1MS ((UINT8) 0x1c) /* C/T 1 Mode Specification */ +#define ZCIO_CT2MS ((UINT8) 0x1d) /* C/T 2 Mode Specification */ +#define ZCIO_CT3MS ((UINT8) 0x1e) /* C/T 3 Mode Specification */ + +#define ZCIO_CV ((UINT8) 0x1f) /* Current Vector */ + +#define ZCIO_PAMS ((UINT8) 0x20) /* Port A Mode Specification */ +#define ZCIO_PAHS ((UINT8) 0x21) /* Port A Handshake Specification */ +#define ZCIO_PADPP ((UINT8) 0x22) /* Port A Data Path Polarity */ +#define ZCIO_PADD ((UINT8) 0x23) /* Port A Data Direction */ +#define ZCIO_PASIOC ((UINT8) 0x24) /* Port A Special I/O Control */ +#define ZCIO_PAPP ((UINT8) 0x25) /* Port A Pattern Polarity */ +#define ZCIO_PAPT ((UINT8) 0x26) /* Port A Pattern Transition */ +#define ZCIO_PAPM ((UINT8) 0x27) /* Port A Pattern Mask */ + +#define ZCIO_PBMS ((UINT8) 0x28) /* Port B Mode Specification */ +#define ZCIO_PBHS ((UINT8) 0x29) /* Port B Handshake Specification */ +#define ZCIO_PBDPP ((UINT8) 0x2a) /* Port B Data Path Polarity */ +#define ZCIO_PBDD ((UINT8) 0x2b) /* Port B Data Direction */ +#define ZCIO_PBSIOC ((UINT8) 0x2c) /* Port B Special I/O Control */ +#define ZCIO_PBPP ((UINT8) 0x2d) /* Port B Pattern Polarity */ +#define ZCIO_PBPT ((UINT8) 0x2e) /* Port B Pattern Transition */ +#define ZCIO_PBPM ((UINT8) 0x2f) /* Port B Pattern Mask */ + + +/* If a particular CPU board uses Zilog 8036 counter/timer/parallel I/O chip, + * Z8036 should be defined in {target}/sysLib.h. */ + +#ifdef Z8036 + +#define Z8036_MIC(base) ((char *) ((base) + ZCIO_MIC)) +#define Z8036_MCC(base) ((char *) ((base) + ZCIO_MCC)) +#define Z8036_PAIV(base) ((char *) ((base) + ZCIO_PAIV)) +#define Z8036_PBIV(base) ((char *) ((base) + ZCIO_PBIV)) +#define Z8036_CTIV(base) ((char *) ((base) + ZCIO_CTIV)) +#define Z8036_PCDPP(base) ((char *) ((base) + ZCIO_PCDPP)) +#define Z8036_PCDD(base) ((char *) ((base) + ZCIO_PCDD)) +#define Z8036_PCSIOC(base) ((char *) ((base) + ZCIO_PCSIOC)) +#define Z8036_PACS(base) ((char *) ((base) + ZCIO_PACS)) +#define Z8036_PBCS(base) ((char *) ((base) + ZCIO_PBCS)) +#define Z8036_CT1CS(base) ((char *) ((base) + ZCIO_CT1CS)) +#define Z8036_CT2CS(base) ((char *) ((base) + ZCIO_CT2CS)) +#define Z8036_CT3CS(base) ((char *) ((base) + ZCIO_CT3CS)) +#define Z8036_PAD(base) ((char *) ((base) + ZCIO_PAD)) +#define Z8036_PBD(base) ((char *) ((base) + ZCIO_PBD)) +#define Z8036_PCD(base) ((char *) ((base) + ZCIO_PCD)) +#define Z8036_CT1CCMSB(base) ((char *) ((base) + ZCIO_CT1CCMSB)) +#define Z8036_CT1CCLSB(base) ((char *) ((base) + ZCIO_CT1CCLSB)) +#define Z8036_CT2CCMSB(base) ((char *) ((base) + ZCIO_CT2CCMSB)) +#define Z8036_CT2CCLSB(base) ((char *) ((base) + ZCIO_CT2CCLSB)) +#define Z8036_CT3CCMSB(base) ((char *) ((base) + ZCIO_CT3CCMSB)) +#define Z8036_CT3CCLSB(base) ((char *) ((base) + ZCIO_CT3CCLSB)) +#define Z8036_CT1TCMSB(base) ((char *) ((base) + ZCIO_CT1TCMSB)) +#define Z8036_CT1TCLSB(base) ((char *) ((base) + ZCIO_CT1TCLSB)) +#define Z8036_CT2TCMSB(base) ((char *) ((base) + ZCIO_CT2TCMSB)) +#define Z8036_CT2TCLSB(base) ((char *) ((base) + ZCIO_CT2TCLSB)) +#define Z8036_CT3TCMSB(base) ((char *) ((base) + ZCIO_CT3TCMSB)) +#define Z8036_CT3TCLSB(base) ((char *) ((base) + ZCIO_CT3TCLSB)) +#define Z8036_CT1MS(base) ((char *) ((base) + ZCIO_CT1MS)) +#define Z8036_CT2MS(base) ((char *) ((base) + ZCIO_CT2MS)) +#define Z8036_CT3MS(base) ((char *) ((base) + ZCIO_CT3MS)) +#define Z8036_CV(base) ((char *) ((base) + ZCIO_CV)) +#define Z8036_PAMS(base) ((char *) ((base) + ZCIO_PAMS)) +#define Z8036_PAHS(base) ((char *) ((base) + ZCIO_PAHS)) +#define Z8036_PADPP(base) ((char *) ((base) + ZCIO_PADPP)) +#define Z8036_PADD(base) ((char *) ((base) + ZCIO_PADD)) +#define Z8036_PASIOC(base) ((char *) ((base) + ZCIO_PASIOC)) +#define Z8036_PAPP(base) ((char *) ((base) + ZCIO_PAPP)) +#define Z8036_PAPT(base) ((char *) ((base) + ZCIO_PAPT)) +#define Z8036_PAPM(base) ((char *) ((base) + ZCIO_PAPM)) +#define Z8036_PBMS(base) ((char *) ((base) + ZCIO_PBMS)) +#define Z8036_PBHS(base) ((char *) ((base) + ZCIO_PBHS)) +#define Z8036_PBDPP(base) ((char *) ((base) + ZCIO_PBDPP)) +#define Z8036_PBDD(base) ((char *) ((base) + ZCIO_PBDD)) +#define Z8036_PBSIOC(base) ((char *) ((base) + ZCIO_PBSIOC)) +#define Z8036_PBPP(base) ((char *) ((base) + ZCIO_PBPP)) +#define Z8036_PBPT(base) ((char *) ((base) + ZCIO_PBPT)) +#define Z8036_PBPM(base) ((char *) ((base) + ZCIO_PBPM)) + +#endif /* Z8036 */ + + +/* Counter/Timer Mode Specification register values (C/T 1, 2 and 3) */ + +#define ZCIO_CTMS_DCS_PO ((UINT8) ZERO) /* Pulse Output */ +#define ZCIO_CTMS_DCS_OSO ((UINT8) 0x01) /* One-Shot Output */ +#define ZCIO_CTMS_DCS_SWO ((UINT8) 0x02) /* Square-Wave Output */ +#define ZCIO_CTMS_DCS ((UINT8) 0x03) /* output Duty Cycle Selects */ +#define ZCIO_CTMS_REB ((UINT8) 0x04) /* Retrigger Enable Bit */ +#define ZCIO_CTMS_EGE ((UINT8) 0x08) /* External Gate Enable */ +#define ZCIO_CTMS_ETE ((UINT8) 0x10) /* External Trigger Enable */ +#define ZCIO_CTMS_ECE ((UINT8) 0x20) /* External Count Enable */ +#define ZCIO_CTMS_EOE ((UINT8) 0x40) /* External Output Enable */ +#define ZCIO_CTMS_CSC ((UINT8) 0x80) /* Continuous Single Cycle */ + + +/* Master Configuration Control register values */ + +#define ZCIO_MCC_PLC_IND ((UINT8) ZERO) /* port A and B INDependent */ +#define ZCIO_MCC_LC_IND ((UINT8) ZERO) /* counter/timers INDependent */ +#define ZCIO_MCC_LC_GATE ((UINT8) 0x01) /* ct1 output GATEs ct2 */ +#define ZCIO_MCC_LC_TRIG ((UINT8) 0x02) /* ct1 output TRIGgers ct2 */ +#define ZCIO_MCC_LC_CNT ((UINT8) 0x03) /* ct1 output is ct2 CouNT input */ +#define ZCIO_MCC_LC ((UINT8) 0x03) /* counter/timer Link Controls */ +#define ZCIO_MCC_PAE ((UINT8) 0x04) /* Port A Enable */ +#define ZCIO_MCC_PLC ((UINT8) 0x08) /* Port Link Control */ +#define ZCIO_MCC_PLC_LNK ((UINT8) 0x08) /* port A and B are LiNKed */ +#define ZCIO_MCC_CT3PCE ((UINT8) 0x10) /* C/T 3 and Port C Enable */ +#define ZCIO_MCC_CT2E ((UINT8) 0x20) /* Counter/Timer 2 Enable */ +#define ZCIO_MCC_CT1E ((UINT8) 0x40) /* Counter/Timer 1 Enable */ +#define ZCIO_MCC_PBE ((UINT8) 0x80) /* Port B Enable */ + + +/* Master Interrupt Control register values */ + +#define ZCIO_MIC_RESET ((UINT8) 0x01) /* device RESET */ +#define ZCIO_MIC_RJ ((UINT8) 0x02) /* Right Just */ +#define ZCIO_MIC_CTVIS ((UINT8) 0x04) /* C/T Vector Includes Status */ +#define ZCIO_MIC_PBVIS ((UINT8) 0x08) /* Port B Vector Includes Status */ +#define ZCIO_MIC_PAVIS ((UINT8) 0x10) /* Port A Vector Includes Status */ +#define ZCIO_MIC_NV ((UINT8) 0x20) /* No Vector */ +#define ZCIO_MIC_DLC ((UINT8) 0x40) /* Disable Lower Chain */ +#define ZCIO_MIC_MIE ((UINT8) 0x80) /* Master Interrupt Enable */ + + +/* Command and Status resigter values (port A and B and C/T 1, 2 and 3) */ + +#define ZCIO_CS_NC ((UINT8) ZERO) /* Null Code */ +#define ZCIO_CS_CIP ((UINT8) 0x01) /* Count In Progress */ +#define ZCIO_CS_IOE ((UINT8) 0x01) /* Interrupt On Error */ +#define ZCIO_CS_TCB ((UINT8) 0x02) /* Trigger Command Bit */ +#define ZCIO_CS_PMF ((UINT8) 0x02) /* Pattern Match Flag */ +#define ZCIO_CS_IRF ((UINT8) 0x04) /* Input Register Full */ +#define ZCIO_CS_GCB ((UINT8) 0x04) /* Gate Command Bit */ +#define ZCIO_CS_RCC ((UINT8) 0x08) /* Read Counter Control */ +#define ZCIO_CS_ORE ((UINT8) 0x08) /* Output Register Empty */ +#define ZCIO_CS_ERR ((UINT8) 0x10) /* interrupt ERRor */ +#define ZCIO_CS_IP ((UINT8) 0x20) /* Interrupt Pending */ +#define ZCIO_CS_CLIPIUS ((UINT8) 0x20) /* CLear IP and IUS */ +#define ZCIO_CS_IE ((UINT8) 0x40) /* Interrupt Enable */ +#define ZCIO_CS_SIUS ((UINT8) 0x40) /* Set Interrupt Under Service */ +#define ZCIO_CS_CLIUS ((UINT8) 0x60) /* CLear Interrupt Under Service */ +#define ZCIO_CS_IUS ((UINT8) 0x80) /* Interrupt Under Service */ +#define ZCIO_CS_SIP ((UINT8) 0x80) /* Set Interrupt Pending */ +#define ZCIO_CS_CLIP ((UINT8) 0xa0) /* CLear Interrupt Pending */ +#define ZCIO_CS_SIE ((UINT8) 0xc0) /* Set Interrupt Enable */ +#define ZCIO_CS_CLIE ((UINT8) 0xe0) /* CLear Interrupt Enable */ + + +/* Data Direction register values (port A, B and C) */ +#ifndef ZCIO_DD_PORT_A +#define ZCIO_DD_PORT_A ((UINT8) ZERO) /* OUTput bit */ +#endif + +#ifndef ZCIO_DD_PORT_B +#define ZCIO_DD_PORT_B ((UINT8) ZERO) /* OUTput bit */ +#endif + + +#ifndef ZCIO_DD_PORT_C +#define ZCIO_DD_PORT_C ((UINT8) ZERO) /* OUTput bit */ +#endif + + +#define ZCIO_DD_IN ((UINT8) 0xff) /* INput bit */ + + +/* Data Path Polarity register values (port A, B and C) */ + +#define ZCIO_DPP_NONINV ((UINT8) ZERO) /* NON-INVerting */ +#define ZCIO_DPP_INVERT ((UINT8) 0xff) /* INVerting */ + + +/* Port Handshake Specification register values (port A and B) */ + +#define ZCIO_PHS_RWS_RWD ((UINT8) ZERO) /* Request/Wait Disabled */ +#define ZCIO_PHS_DTS_2 ((UINT8) ZERO) /* 2 PCLK cycles */ +#define ZCIO_PHS_HTS_IH ((UINT8) ZERO) /* Interlocked Handshake */ +#define ZCIO_PHS_DTS_4 ((UINT8) 0x01) /* 4 PCLK cycles */ +#define ZCIO_PHS_DTS_6 ((UINT8) 0x02) /* 6 PCLK cycles */ +#define ZCIO_PHS_DTS_8 ((UINT8) 0x03) /* 8 PCLK cycles */ +#define ZCIO_PHS_DTS_10 ((UINT8) 0x04) /* 10 PCLK cycles */ +#define ZCIO_PHS_DTS_12 ((UINT8) 0x05) /* 12 PCLK cycles */ +#define ZCIO_PHS_DTS_14 ((UINT8) 0x06) /* 14 PCLK cycles */ +#define ZCIO_PHS_DTS ((UINT8) 0x07) /* Deskew Time Specification */ +#define ZCIO_PHS_DTS_16 ((UINT8) 0x07) /* 16 PCLK cycles */ +#define ZCIO_PHS_RWS_OW ((UINT8) 0x08) /* Output Wait */ +#define ZCIO_PHS_RWS_IW ((UINT8) 0x18) /* Input Wait */ +#define ZCIO_PHS_RWS_SR ((UINT8) 0x20) /* Special Request */ +#define ZCIO_PHS_RWS_OR ((UINT8) 0x28) /* Output Request */ +#define ZCIO_PHS_RWS_IR ((UINT8) 0x38) /* Input Request */ +#define ZCIO_PHS_RWS ((UINT8) 0x38) /* Request/Wait Specification */ +#define ZCIO_PHS_HTS_SH ((UINT8) 0x40) /* Strobed Handshake */ +#define ZCIO_PHS_HTS_PH ((UINT8) 0x80) /* Pulsed Handshake */ +#define ZCIO_PHS_HTS_3WH ((UINT8) 0xc0) /* 3-Wire Handshake */ +#define ZCIO_PHS_HTS ((UINT8) 0xc0) /* Handshake Type Specification */ + + +/* Interrupt Vector register values (port A and B and C/Ts) */ + +#define ZCIO_IV_ERR ((UINT8) ZERO) /* Error */ +#define ZCIO_IV_CT3 ((UINT8) ZERO) /* Counter/Timer 3 */ +#define ZCIO_IV_CT2 ((UINT8) 0x02) /* Counter/Timer 2 */ +#define ZCIO_IV_PMF ((UINT8) 0x02) /* Pattern Match Flag */ +#define ZCIO_IV_IRF ((UINT8) 0x04) /* Input Register Full */ +#define ZCIO_IV_CT1 ((UINT8) 0x04) /* Counter/Timer 1 */ +#define ZCIO_IV_CTE ((UINT8) 0x06) /* Counter/Timer Error */ +#define ZCIO_IV_ORE ((UINT8) 0x08) /* Output Register Empty */ + + +/* Port Mode Specification register values (port A and B) */ + +#define ZCIO_PMS_PTS_BIT ((UINT8) ZERO) /* BIT port */ +#define ZCIO_PMS_PMS_DPM ((UINT8) ZERO) /* Disable Pattern Match */ +#define ZCIO_PMS_LPM ((UINT8) 0x01) /* Latch on Pattern Match */ +#define ZCIO_PMS_DTE ((UINT8) 0x01) /* Deskew Timer Enable */ +#define ZCIO_PMS_PMS_AND ((UINT8) 0x02) /* "AND" mode */ +#define ZCIO_PMS_PMS_OR ((UINT8) 0x04) /* "OR" mode */ +#define ZCIO_PMS_PMS ((UINT8) 0x06) /* Pattern Mode Specification */ +#define ZCIO_PMS_PMS_PEV ((UINT8) 0x06) /* "Priority Encoded Vector" mode */ +#define ZCIO_PMS_IMO ((UINT8) 0x08) /* Interrupt on Match Only */ +#define ZCIO_PMS_SB ((UINT8) 0x10) /* Single Buffered mode */ +#define ZCIO_PMS_ITB ((UINT8) 0x20) /* Interrupt on Two Bytes */ +#define ZCIO_PMS_PTS_IN ((UINT8) 0x40) /* INput port */ +#define ZCIO_PMS_PTS_OUT ((UINT8) 0x80) /* OUTput port */ +#define ZCIO_PMS_PTS_BI ((UINT8) 0xc0) /* BIdirectal port */ +#define ZCIO_PMS_PTS ((UINT8) 0xc0) /* Port Type Select */ + + +/* Pattern Mask resigter values (port A and B) */ + +#define ZCIO_PM_OFF ((UINT8) ZERO) /* Bit Masked Off (X) */ +#define ZCIO_PM_ANY ((UINT8) ZERO) /* Any Transition (^ or v) */ +#define ZCIO_PM_ZERO ((UINT8) 0xff) /* Zero (0) */ +#define ZCIO_PM_ONE ((UINT8) 0xff) /* One (1) */ +#define ZCIO_PM_0TO1 ((UINT8) 0xff) /* Zero to One Transition (^) */ +#define ZCIO_PM_1TO0 ((UINT8) 0xff) /* One to Zero Transition (v) */ + +/* Pattern Polarity register values (port A and B) */ + +#define ZCIO_PP_OFF ((UINT8) ZERO) /* Bit Masked Off (X) */ +#define ZCIO_PP_ANY ((UINT8) ZERO) /* Any Transition (^ or v) */ +#define ZCIO_PP_ZERO ((UINT8) ZERO) /* Zero (0) */ +#define ZCIO_PP_1TO0 ((UINT8) ZERO) /* One to Zero Transition (v) */ +#define ZCIO_PP_ONE ((UINT8) 0xff) /* One (1) */ +#define ZCIO_PP_0TO1 ((UINT8) 0xff) /* Zero to One Transition (^) */ + +/* Pattern Transition register values (port A and B) */ + +#define ZCIO_PT_OFF ((UINT8) ZERO) /* Bit Masked Off (X) */ +#define ZCIO_PT_ZERO ((UINT8) ZERO) /* Zero (0) */ +#define ZCIO_PT_ONE ((UINT8) ZERO) /* One (1) */ +#define ZCIO_PT_ANY ((UINT8) 0xff) /* Any Transition (^ or v) */ +#define ZCIO_PT_1TO0 ((UINT8) 0xff) /* One to Zero Transition (v) */ +#define ZCIO_PT_0TO1 ((UINT8) 0xff) /* Zero to One Transition (^) */ + +/* Special I/O Control register values (port A B and C) */ + +#define ZCIO_SIO_NORMAL ((UINT8) ZERO) /* NORMAL input or output */ +#define ZCIO_SIO_ODRAIN ((UINT8) 0xff) /* output with Open DRAIN */ +#define ZCIO_SIO_1CATCH ((UINT8) 0xff) /* input with 1's CATCHer */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT UINT sysZ8536Init (void); +IMPORT void sysCioReset (volatile UINT8 * pCio); +IMPORT void sysClkIntCIO (void); + +#else /* __STDC__ */ + +IMPORT UINT sysZ8536Init (); +IMPORT void sysCioReset (); +IMPORT void sysClkIntCIO (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCppcZ8536Timerh */ diff --git a/h/drv/timer/quiccTimer.h b/h/drv/timer/quiccTimer.h new file mode 100644 index 0000000..b077adb --- /dev/null +++ b/h/drv/timer/quiccTimer.h @@ -0,0 +1,109 @@ +/* quiccTimer.h */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,2mar05,dtr adapted from m8260Timer. +*/ + +/* +DESCRIPTION +This file contains header information for PowerPC timer routines. +*/ + +#ifndef __INCquiccTimerh +#define __INCquiccTimerh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Real Time Clock Module Registers */ + +#define RTCNR 0x00300 +#define RTLDR 0x00304 +#define RTPSR 0x00308 +#define RTCTR 0x0030c +#define RTEVR 0x00310 +#define RTALR 0x00314 + +#define QUICC_RTCNR(base) (CAST(VUINT32 *)((base) | RTCNR)) +#define QUICC_RTLDR(base) (CAST(VUINT32 *)((base) | RTLDR)) +#define QUICC_RTPSR(base) (CAST(VUINT32 *)((base) | RTPSR)) +#define QUICC_RTCTR(base) (CAST(VUINT32 *)((base) | RTCTR)) +#define QUICC_RTEVR(base) (CAST(VUINT32 *)((base) | RTEVR)) +#define QUICC_RTALR(base) (CAST(VUINT32 *)((base) | RTALR)) + +/* Periodic Interval Timer Registers */ + +#define PTCNR 0x00400 +#define PTLDR 0x00404 +#define PTPSR 0x00408 +#define PTCTR 0x0040c +#define PTEVR 0x00410 + +#define QUICC_PTCNR(base) (CAST(VUINT32 *)((base) | PTCNR)) +#define QUICC_PTLDR(base) (CAST(VUINT32 *)((base) | PTLDR)) +#define QUICC_PTPSR(base) (CAST(VUINT32 *)((base) | PTPSR)) +#define QUICC_PTCTR(base) (CAST(VUINT32 *)((base) | PTCTR)) +#define QUICC_PTEVR(base) (CAST(VUINT32 *)((base) | PTEVR)) + +/* Global Timers Module 1 */ + +/* + Example usage: + + *QUICC_GTCFR1(immrVal, GTM1_MODULE_BASE) = 0 ; + or + *QUICC_GTCFR1(immrVal, GTM2_MODLUE_BASE) = 0 ; +*/ + +#define QUICC_GTCFR1(base,mbase) (CAST(VUINT8 *)((base) | (mbase) | 0x00000)) +#define QUICC_GTCFR2(base,mbase) (CAST(VUINT8 *)((base) | (mbase) | 0x00004)) +#define QUICC_GTMDR1(base,mbase) (CAST(VUINT16 *)((base) | (mbase) | 0x00010)) +#define QUICC_GTMDR2(base,mbase) (CAST(VUINT16 *)((base) | (mbase) | 0x00012)) + +/* 16 bit mode */ +#define QUICC_GTRFR1(base,mbase) (CAST(VUINT16 *)((base) | (mbase) | 0x00014)) +#define QUICC_GTRFR2(base,mbase) (CAST(VUINT16 *)((base) | (mbase) | 0x00016)) +#define QUICC_GTCPR1(base,mbase) (CAST(VUINT16 *)((base) | (mbase) | 0x00018)) +#define QUICC_GTCPR2(base,mbase) (CAST(VUINT16 *)((base) | (mbase) | 0x0001a)) +#define QUICC_GTCNR1(base,mbase) (CAST(VUINT16 *)((base) | (mbase) | 0x0001c)) +#define QUICC_GTCNR2(base,mbase) (CAST(VUINT16 *)((base) | (mbase) | 0x0001e)) +/* 32 bit cascaded mode */ +#define QUICC_GTRFR1_2(base,mbase) (CAST(VUINT32 *)((base) | (mbase) | 0x00014)) +#define QUICC_GTCPR1_2(base,mbase) (CAST(VUINT32 *)((base) | (mbase) | 0x00018)) +#define QUICC_GTCNR1_2(base,mbase) (CAST(VUINT32 *)((base) | (mbase) | 0x0001c)) + +#define QUICC_GTMDR3(base,mbase) (CAST(VUINT16 *)((base) | (mbase) | 0x00020)) +#define QUICC_GTMDR4(base,mbase) (CAST(VUINT16 *)((base) | (mbase) | 0x00022)) + +/* 16 bit mode */ +#define QUICC_GTRFR3(base,mbase) (CAST(VUINT16 *)((base) | (mbase) | 0x00024)) +#define QUICC_GTRFR4(base,mbase) (CAST(VUINT16 *)((base) | (mbase) | 0x00026)) +#define QUICC_GTCPR3(base,mbase) (CAST(VUINT16 *)((base) | (mbase) | 0x00028)) +#define QUICC_GTCPR4(base,mbase) (CAST(VUINT16 *)((base) | (mbase) | 0x0002a)) +#define QUICC_GTCNR3(base,mbase) (CAST(VUINT16 *)((base) | (mbase) | 0x0002c)) +#define QUICC_GTCNR4(base,mbase) (CAST(VUINT16 *)((base) | (mbase) | 0x0002e)) +/* 32 bit cascaded mode */ +#define QUICC_GTRFR3_4(base,mbase) (CAST(VUINT32 *)((base) | (mbase) | 0x00024)) +#define QUICC_GTCPR3_4(base,mbase) (CAST(VUINT32 *)((base) | (mbase) | 0x00028)) +#define QUICC_GTCNR3_4(base,mbase) (CAST(VUINT32 *)((base) | (mbase) | 0x0002c)) + + +#define QUICC_GTEVR1(base,mbase) (CAST(VUINT16 *)((base) | (mbase) | 0x00030)) +#define QUICC_GTEVR2(base,mbase) (CAST(VUINT16 *)((base) | (mbase) | 0x00032)) +#define QUICC_GTEVR3(base,mbase) (CAST(VUINT16 *)((base) | (mbase) | 0x00034)) +#define QUICC_GTEVR4(base,mbase) (CAST(VUINT16 *)((base) | (mbase) | 0x00036)) +#define QUICC_GTPSR1(base,mbase) (CAST(VUINT16 *)((base) | (mbase) | 0x00038)) +#define QUICC_GTPSR2(base,mbase) (CAST(VUINT16 *)((base) | (mbase) | 0x0003a)) +#define QUICC_GTPSR3(base,mbase) (CAST(VUINT16 *)((base) | (mbase) | 0x0003c)) +#define QUICC_GTPSR4(base,mbase) (CAST(VUINT16 *)((base) | (mbase) | 0x0003e)) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCquiccTimerh */ diff --git a/h/drv/timer/sa1100Timer.h b/h/drv/timer/sa1100Timer.h new file mode 100644 index 0000000..1ca5a51 --- /dev/null +++ b/h/drv/timer/sa1100Timer.h @@ -0,0 +1,31 @@ +/* sa1100Timer.h - Digital Semiconductor SA-1100 timer header file */ + +/* Copyright 1997-1998 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,15dec97,cdp created from 01d of cma220. +*/ + +#ifndef __INCsa1100Timerh +#define __INCsa1100Timerh + +#ifdef __cplusplus +extern "C" { +#endif + +/* register definitions */ + +#define SA1100_TIMER_CSR_OSCR (SA1100_TIMER_BASE + 0x10) /* OSCR (R/W) */ +#define SA1100_TIMER_CSR_OSMR_0 (SA1100_TIMER_BASE + 0x00) /* OSMR[0] (R/W) */ +#define SA1100_TIMER_CSR_OSMR_1 (SA1100_TIMER_BASE + 0x04) /* OSMR[1] (R/W) */ +#define SA1100_TIMER_CSR_OSMR_2 (SA1100_TIMER_BASE + 0x08) /* OSMR[2] (R/W) */ +#define SA1100_TIMER_CSR_OSSR (SA1100_TIMER_BASE + 0x14) /* OSSR (R/W) */ +#define SA1100_TIMER_CSR_OIER (SA1100_TIMER_BASE + 0x1C) /* OIER (R/W) */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsa1100Timerh */ diff --git a/h/drv/timer/sa1501Timer.h b/h/drv/timer/sa1501Timer.h new file mode 100644 index 0000000..06eafa2 --- /dev/null +++ b/h/drv/timer/sa1501Timer.h @@ -0,0 +1,81 @@ +/* sa1501Timer.h - Digital Semiconductor SA-1501 timer header */ + +/* Copyright 1996-1998 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,25nov98,jpd written, based on ambaTimer.h version 01c. +*/ + +#ifndef __INCsa1501Timerh +#define __INCsa1501Timerh + +#ifdef __cplusplus +extern "C" { +#endif + +/* register definitions */ + +#ifndef _ASMLANGUAGE +#define SA1501_TIMER_T0LIMIT(base) \ + (volatile UINT32 *)((base) + 0x00) /* T0 Limit (R/W) */ +#define SA1501_TIMER_T0VALUE(base) \ + (volatile UINT32 *)((base) + 0x10) /* T0 Value (R/O) */ +#define SA1501_TIMER_T0RESET(base) \ + (volatile UINT32 *)((base) + 0x50) /* T0 Reset (R/W) */ + +#define SA1501_TIMER_T1LIMIT(base) \ + (volatile UINT32 *)((base) + 0x04) /* T1 Limit (R/W) */ +#define SA1501_TIMER_T1VALUE(base) \ + (volatile UINT32 *)((base) + 0x14) /* T1 Value (R/O) */ +#define SA1501_TIMER_T1RESET(base) \ + (volatile UINT32 *)((base) + 0x54) /* T1 Reset (R/W) */ + +#define SA1501_TIMER_T2LIMIT(base) \ + (volatile UINT32 *)((base) + 0x08) /* T2 Limit (R/W) */ +#define SA1501_TIMER_T2VALUE(base) \ + (volatile UINT32 *)((base) + 0x18) /* T2 Value (R/O) */ +#define SA1501_TIMER_T2RESET(base) \ + (volatile UINT32 *)((base) + 0x58) /* T2 Reset (R/W) */ + +#define SA1501_TIMER_T3LIMIT(base) \ + (volatile UINT32 *)((base) + 0x0C) /* T3 Limit (R/W) */ +#define SA1501_TIMER_T3VALUE(base) \ + (volatile UINT32 *)((base) + 0x1C) /* T3 Value (R/O) */ +#define SA1501_TIMER_T3RESET(base) \ + (volatile UINT32 *)((base) + 0x5C) /* T3 Reset (R/W) */ + +#define SA1501_TIMER_WDCTL(base) \ + (volatile UINT32 *)((base) + 0x7C) /* T3 watchdog ctrl (W/O) */ + +#else /* _ASMLANGUAGE */ + +#define SA1501_TIMER_T0LIMIT(base) ((base) + 0x00) +#define SA1501_TIMER_T0VALUE(base) ((base) + 0x10) +#define SA1501_TIMER_T0RESET(base) ((base) + 0x50) + +#define SA1501_TIMER_T1LIMIT(base) ((base) + 0x04) +#define SA1501_TIMER_T1VALUE(base) ((base) + 0x14) +#define SA1501_TIMER_T1RESET(base) ((base) + 0x54) + +#define SA1501_TIMER_T2LIMIT(base) ((base) + 0x08) +#define SA1501_TIMER_T2VALUE(base) ((base) + 0x18) +#define SA1501_TIMER_T2RESET(base) ((base) + 0x58) + +#define SA1501_TIMER_T3LIMIT(base) ((base) + 0x0C) +#define SA1501_TIMER_T3VALUE(base) ((base) + 0x1C) +#define SA1501_TIMER_T3RESET(base) ((base) + 0x5C) + +#define SA1501_TIMER_WDCTL(base) ((base) + 0x7C) + + +#endif /* _ASMLANGUAGE */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsa1501Timerh */ + diff --git a/h/drv/timer/timerDev.h b/h/drv/timer/timerDev.h new file mode 100644 index 0000000..fccad86 --- /dev/null +++ b/h/drv/timer/timerDev.h @@ -0,0 +1,85 @@ +/* timerDev.h - Generic Timer header */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,06nov03,rec add sysOneShotEnable and sysOneShotDisable prototypes +01e,27aug03,rec add power management prototypes +01d,06aug96,dat merged in timestamp support +01c,22sep92,rrr added support for c++ +01b,07jul92,ccc change name to timerDev.h +01a,22jun92,ccc created. +*/ + +/* +DESCRIPTION +This file contains header information for generic timer routines. +*/ + +#ifndef __INCtimerDevh +#define __INCtimerDevh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +#ifndef _ASMLANGUAGE +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT STATUS sysClkConnect (FUNCPTR routine, int arg); +IMPORT void sysClkDisable (void); +IMPORT void sysClkEnable (void); +IMPORT int sysClkRateGet (void); +IMPORT STATUS sysClkRateSet (int ticksPerSecond); +IMPORT STATUS sysAuxClkConnect (FUNCPTR routine, int arg); +IMPORT void sysAuxClkDisable (void); +IMPORT void sysAuxClkEnable (void); +IMPORT int sysAuxClkRateGet (void); +IMPORT STATUS sysAuxClkRateSet (int ticksPerSecond); +IMPORT STATUS sysTimestampConnect (FUNCPTR routine, int arg); +IMPORT STATUS sysTimestampEnable (void); +IMPORT STATUS sysTimestampDisable (void); +IMPORT UINT32 sysTimestampFreq (void); +IMPORT UINT32 sysTimestampPeriod (void); +IMPORT UINT32 sysTimestamp (void); +IMPORT UINT32 sysTimestampLock (void); +IMPORT void sysOneShotEnable (int nTicks); +IMPORT ULONG sysOneShotDisable (void); +IMPORT void sysOneShotInit (void); + +#else /* __STDC__ */ + +IMPORT STATUS sysClkConnect (); +IMPORT void sysClkDisable (); +IMPORT void sysClkEnable (); +IMPORT int sysClkRateGet (); +IMPORT STATUS sysClkRateSet (); +IMPORT STATUS sysAuxClkConnect (); +IMPORT void sysAuxClkDisable (); +IMPORT void sysAuxClkEnable (); +IMPORT int sysAuxClkRateGet (); +IMPORT STATUS sysAuxClkRateSet (); +IMPORT STATUS sysTimestampConnect (); +IMPORT STATUS sysTimestampEnable (); +IMPORT STATUS sysTimestampDisable (); +IMPORT UINT32 sysTimestampFreq (); +IMPORT UINT32 sysTimestampPeriod (); +IMPORT UINT32 sysTimestamp (); +IMPORT UINT32 sysTimestampLock (); +IMPORT void sysOneShotEnable (); +IMPORT ULONG sysOneShotDisable (); +IMPORT void sysOneShotInit (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtimerDevh */ diff --git a/h/drv/timer/timestampDev.h b/h/drv/timer/timestampDev.h new file mode 100644 index 0000000..2fac533 --- /dev/null +++ b/h/drv/timer/timestampDev.h @@ -0,0 +1,18 @@ +/* timestampDev.h - timestamp device header */ + +/* Copyright 1993-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,26apr02,dat Adding cplusplus protection, SPR 75017 +01b,06aug96,dat timestamp info was merged into timerDev.h +01a,17sep93,dzb created. +*/ + +/* +DESCRIPTION +This file contains header information for generic timestamp device routines. +*/ + +#include "drv/timer/timerDev.h" /* everything is in timerDev.h now */ diff --git a/h/drv/timer/z8536.h b/h/drv/timer/z8536.h new file mode 100644 index 0000000..f99f039 --- /dev/null +++ b/h/drv/timer/z8536.h @@ -0,0 +1,322 @@ +/* z8536.h - zilog CIO (counter,timer,parallel i/o chip) */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01g,22sep92,rrr added support for c++ +01f,26may92,rrr the tree shuffle +01e,04oct91,rrr passed through the ansification filter + -changed TINY and UTINY to INT8 and UINT8 + -changed copyright notice +01d,05oct90,shl added copyright notice. + made #endif ANSI style. +01c,10jan90,shl merged with z8036.h. +01b,11sep89,dab changed U8 to UINT8. +01a,10aug88,rml written +*/ + +/* Note: in the following, the value '0x00' has been replaced by 'ZERO'. + This has been done to provide a way to avoid the 'clr.b' instruction + on the 68000/10 cpu. 'ZERO' should be defined to be a memory location + which holds the value '0x00', this will cause compilers to generate + memory to memory transfers rather than clear instructions. */ + +#ifndef __INCz8536h +#define __INCz8536h + +#ifdef __cplusplus +extern "C" { +#endif + +/* internal register addresses */ + +#define ZCIO_MIC ((UINT8) ZERO) /* Master Interrupt Control */ +#define ZCIO_MCC ((UINT8) 0x01) /* Master Configuration Control */ +#define ZCIO_PAIV ((UINT8) 0x02) /* Port A Interrupt Vector */ +#define ZCIO_PBIV ((UINT8) 0x03) /* Port B Interrupt Vector */ +#define ZCIO_CTIV ((UINT8) 0x04) /* Counter/Timer Interrupt Vector */ + +#define ZCIO_PCDPP ((UINT8) 0x05) /* Port C Data Path Polarity */ +#define ZCIO_PCDD ((UINT8) 0x06) /* Port C Data Direction */ +#define ZCIO_PCSIOC ((UINT8) 0x07) /* Port C Special I/O Control */ +#define ZCIO_PACS ((UINT8) 0x08) /* Port A Command and Status */ +#define ZCIO_PBCS ((UINT8) 0x09) /* Port B Command and Status */ + +#define ZCIO_CT1CS ((UINT8) 0x0a) /* C/T 1 Command and Status */ +#define ZCIO_CT2CS ((UINT8) 0x0b) /* C/T 2 Command and Status */ +#define ZCIO_CT3CS ((UINT8) 0x0c) /* C/T 3 Command and Status */ + +#define ZCIO_PAD ((UINT8) 0x0d) /* Port A Data */ +#define ZCIO_PBD ((UINT8) 0x0e) /* Port B Data */ +#define ZCIO_PCD ((UINT8) 0x0f) /* Port C Data */ + +#define ZCIO_CT1CCMSB ((UINT8) 0x10) /* C/T 1 Current Count (MS Byte) */ +#define ZCIO_CT1CCLSB ((UINT8) 0x11) /* C/T 1 Current Count (LS Byte) */ +#define ZCIO_CT2CCMSB ((UINT8) 0x12) /* C/T 2 Current Count (MS Byte) */ +#define ZCIO_CT2CCLSB ((UINT8) 0x13) /* C/T 2 Current Count (LS Byte) */ +#define ZCIO_CT3CCMSB ((UINT8) 0x14) /* C/T 3 Current Count (MS Byte) */ +#define ZCIO_CT3CCLSB ((UINT8) 0x15) /* C/T 3 Current Count (LS Byte) */ + +#define ZCIO_CT1TCMSB ((UINT8) 0x16) /* C/T 1 Time Constant (MS Byte) */ +#define ZCIO_CT1TCLSB ((UINT8) 0x17) /* C/T 1 Time Constant (LS Byte) */ +#define ZCIO_CT2TCMSB ((UINT8) 0x18) /* C/T 2 Time Constant (MS Byte) */ +#define ZCIO_CT2TCLSB ((UINT8) 0x19) /* C/T 2 Time Constant (LS Byte) */ +#define ZCIO_CT3TCMSB ((UINT8) 0x1a) /* C/T 3 Time Constant (MS Byte) */ +#define ZCIO_CT3TCLSB ((UINT8) 0x1b) /* C/T 3 Time Constant (LS Byte) */ + +#define ZCIO_CT1MS ((UINT8) 0x1c) /* C/T 1 Mode Specification */ +#define ZCIO_CT2MS ((UINT8) 0x1d) /* C/T 2 Mode Specification */ +#define ZCIO_CT3MS ((UINT8) 0x1e) /* C/T 3 Mode Specification */ + +#define ZCIO_CV ((UINT8) 0x1f) /* Current Vector */ + +#define ZCIO_PAMS ((UINT8) 0x20) /* Port A Mode Specification */ +#define ZCIO_PAHS ((UINT8) 0x21) /* Port A Handshake Specification */ +#define ZCIO_PADPP ((UINT8) 0x22) /* Port A Data Path Polarity */ +#define ZCIO_PADD ((UINT8) 0x23) /* Port A Data Direction */ +#define ZCIO_PASIOC ((UINT8) 0x24) /* Port A Special I/O Control */ +#define ZCIO_PAPP ((UINT8) 0x25) /* Port A Pattern Polarity */ +#define ZCIO_PAPT ((UINT8) 0x26) /* Port A Pattern Transition */ +#define ZCIO_PAPM ((UINT8) 0x27) /* Port A Pattern Mask */ + +#define ZCIO_PBMS ((UINT8) 0x28) /* Port B Mode Specification */ +#define ZCIO_PBHS ((UINT8) 0x29) /* Port B Handshake Specification */ +#define ZCIO_PBDPP ((UINT8) 0x2a) /* Port B Data Path Polarity */ +#define ZCIO_PBDD ((UINT8) 0x2b) /* Port B Data Direction */ +#define ZCIO_PBSIOC ((UINT8) 0x2c) /* Port B Special I/O Control */ +#define ZCIO_PBPP ((UINT8) 0x2d) /* Port B Pattern Polarity */ +#define ZCIO_PBPT ((UINT8) 0x2e) /* Port B Pattern Transition */ +#define ZCIO_PBPM ((UINT8) 0x2f) /* Port B Pattern Mask */ + + +/* If a particular CPU board uses Zilog 8036 counter/timer/parallel I/O chip, + * Z8036 should be defined in {target}/sysLib.h. */ + +#ifdef Z8036 + +#define Z8036_MIC(base) ((char *) ((base) + ZCIO_MIC)) +#define Z8036_MCC(base) ((char *) ((base) + ZCIO_MCC)) +#define Z8036_PAIV(base) ((char *) ((base) + ZCIO_PAIV)) +#define Z8036_PBIV(base) ((char *) ((base) + ZCIO_PBIV)) +#define Z8036_CTIV(base) ((char *) ((base) + ZCIO_CTIV)) +#define Z8036_PCDPP(base) ((char *) ((base) + ZCIO_PCDPP)) +#define Z8036_PCDD(base) ((char *) ((base) + ZCIO_PCDD)) +#define Z8036_PCSIOC(base) ((char *) ((base) + ZCIO_PCSIOC)) +#define Z8036_PACS(base) ((char *) ((base) + ZCIO_PACS)) +#define Z8036_PBCS(base) ((char *) ((base) + ZCIO_PBCS)) +#define Z8036_CT1CS(base) ((char *) ((base) + ZCIO_CT1CS)) +#define Z8036_CT2CS(base) ((char *) ((base) + ZCIO_CT2CS)) +#define Z8036_CT3CS(base) ((char *) ((base) + ZCIO_CT3CS)) +#define Z8036_PAD(base) ((char *) ((base) + ZCIO_PAD)) +#define Z8036_PBD(base) ((char *) ((base) + ZCIO_PBD)) +#define Z8036_PCD(base) ((char *) ((base) + ZCIO_PCD)) +#define Z8036_CT1CCMSB(base) ((char *) ((base) + ZCIO_CT1CCMSB)) +#define Z8036_CT1CCLSB(base) ((char *) ((base) + ZCIO_CT1CCLSB)) +#define Z8036_CT2CCMSB(base) ((char *) ((base) + ZCIO_CT2CCMSB)) +#define Z8036_CT2CCLSB(base) ((char *) ((base) + ZCIO_CT2CCLSB)) +#define Z8036_CT3CCMSB(base) ((char *) ((base) + ZCIO_CT3CCMSB)) +#define Z8036_CT3CCLSB(base) ((char *) ((base) + ZCIO_CT3CCLSB)) +#define Z8036_CT1TCMSB(base) ((char *) ((base) + ZCIO_CT1TCMSB)) +#define Z8036_CT1TCLSB(base) ((char *) ((base) + ZCIO_CT1TCLSB)) +#define Z8036_CT2TCMSB(base) ((char *) ((base) + ZCIO_CT2TCMSB)) +#define Z8036_CT2TCLSB(base) ((char *) ((base) + ZCIO_CT2TCLSB)) +#define Z8036_CT3TCMSB(base) ((char *) ((base) + ZCIO_CT3TCMSB)) +#define Z8036_CT3TCLSB(base) ((char *) ((base) + ZCIO_CT3TCLSB)) +#define Z8036_CT1MS(base) ((char *) ((base) + ZCIO_CT1MS)) +#define Z8036_CT2MS(base) ((char *) ((base) + ZCIO_CT2MS)) +#define Z8036_CT3MS(base) ((char *) ((base) + ZCIO_CT3MS)) +#define Z8036_CV(base) ((char *) ((base) + ZCIO_CV)) +#define Z8036_PAMS(base) ((char *) ((base) + ZCIO_PAMS)) +#define Z8036_PAHS(base) ((char *) ((base) + ZCIO_PAHS)) +#define Z8036_PADPP(base) ((char *) ((base) + ZCIO_PADPP)) +#define Z8036_PADD(base) ((char *) ((base) + ZCIO_PADD)) +#define Z8036_PASIOC(base) ((char *) ((base) + ZCIO_PASIOC)) +#define Z8036_PAPP(base) ((char *) ((base) + ZCIO_PAPP)) +#define Z8036_PAPT(base) ((char *) ((base) + ZCIO_PAPT)) +#define Z8036_PAPM(base) ((char *) ((base) + ZCIO_PAPM)) +#define Z8036_PBMS(base) ((char *) ((base) + ZCIO_PBMS)) +#define Z8036_PBHS(base) ((char *) ((base) + ZCIO_PBHS)) +#define Z8036_PBDPP(base) ((char *) ((base) + ZCIO_PBDPP)) +#define Z8036_PBDD(base) ((char *) ((base) + ZCIO_PBDD)) +#define Z8036_PBSIOC(base) ((char *) ((base) + ZCIO_PBSIOC)) +#define Z8036_PBPP(base) ((char *) ((base) + ZCIO_PBPP)) +#define Z8036_PBPT(base) ((char *) ((base) + ZCIO_PBPT)) +#define Z8036_PBPM(base) ((char *) ((base) + ZCIO_PBPM)) + +#endif /* Z8036 */ + + +/* Counter/Timer Mode Specification register values (C/T 1, 2 and 3) */ + +#define ZCIO_CTMS_DCS_PO ((UINT8) ZERO) /* Pulse Output */ +#define ZCIO_CTMS_DCS_OSO ((UINT8) 0x01) /* One-Shot Output */ +#define ZCIO_CTMS_DCS_SWO ((UINT8) 0x02) /* Square-Wave Output */ +#define ZCIO_CTMS_DCS ((UINT8) 0x03) /* output Duty Cycle Selects */ +#define ZCIO_CTMS_REB ((UINT8) 0x04) /* Retrigger Enable Bit */ +#define ZCIO_CTMS_EGE ((UINT8) 0x08) /* External Gate Enable */ +#define ZCIO_CTMS_ETE ((UINT8) 0x10) /* External Trigger Enable */ +#define ZCIO_CTMS_ECE ((UINT8) 0x20) /* External Count Enable */ +#define ZCIO_CTMS_EOE ((UINT8) 0x40) /* External Output Enable */ +#define ZCIO_CTMS_CSC ((UINT8) 0x80) /* Continuous Single Cycle */ + + +/* Master Configuration Control register values */ + +#define ZCIO_MCC_PLC_IND ((UINT8) ZERO) /* port A and B INDependent */ +#define ZCIO_MCC_LC_IND ((UINT8) ZERO) /* counter/timers INDependent */ +#define ZCIO_MCC_LC_GATE ((UINT8) 0x01) /* ct1 output GATEs ct2 */ +#define ZCIO_MCC_LC_TRIG ((UINT8) 0x02) /* ct1 output TRIGgers ct2 */ +#define ZCIO_MCC_LC_CNT ((UINT8) 0x03) /* ct1 output is ct2 CouNT input */ +#define ZCIO_MCC_LC ((UINT8) 0x03) /* counter/timer Link Controls */ +#define ZCIO_MCC_PAE ((UINT8) 0x04) /* Port A Enable */ +#define ZCIO_MCC_PLC ((UINT8) 0x08) /* Port Link Control */ +#define ZCIO_MCC_PLC_LNK ((UINT8) 0x08) /* port A and B are LiNKed */ +#define ZCIO_MCC_CT3PCE ((UINT8) 0x10) /* C/T 3 and Port C Enable */ +#define ZCIO_MCC_CT2E ((UINT8) 0x20) /* Counter/Timer 2 Enable */ +#define ZCIO_MCC_CT1E ((UINT8) 0x40) /* Counter/Timer 1 Enable */ +#define ZCIO_MCC_PBE ((UINT8) 0x80) /* Port B Enable */ + + +/* Master Interrupt Control register values */ + +#define ZCIO_MIC_RESET ((UINT8) 0x01) /* device RESET */ +#define ZCIO_MIC_RJ ((UINT8) 0x02) /* Right Just */ +#define ZCIO_MIC_CTVIS ((UINT8) 0x04) /* C/T Vector Includes Status */ +#define ZCIO_MIC_PBVIS ((UINT8) 0x08) /* Port B Vector Includes Status */ +#define ZCIO_MIC_PAVIS ((UINT8) 0x10) /* Port A Vector Includes Status */ +#define ZCIO_MIC_NV ((UINT8) 0x20) /* No Vector */ +#define ZCIO_MIC_DLC ((UINT8) 0x40) /* Disable Lower Chain */ +#define ZCIO_MIC_MIE ((UINT8) 0x80) /* Master Interrupt Enable */ + + +/* Command and Status resigter values (port A and B and C/T 1, 2 and 3) */ + +#define ZCIO_CS_NC ((UINT8) ZERO) /* Null Code */ +#define ZCIO_CS_CIP ((UINT8) 0x01) /* Count In Progress */ +#define ZCIO_CS_IOE ((UINT8) 0x01) /* Interrupt On Error */ +#define ZCIO_CS_TCB ((UINT8) 0x02) /* Trigger Command Bit */ +#define ZCIO_CS_PMF ((UINT8) 0x02) /* Pattern Match Flag */ +#define ZCIO_CS_IRF ((UINT8) 0x04) /* Input Register Full */ +#define ZCIO_CS_GCB ((UINT8) 0x04) /* Gate Command Bit */ +#define ZCIO_CS_RCC ((UINT8) 0x08) /* Read Counter Control */ +#define ZCIO_CS_ORE ((UINT8) 0x08) /* Output Register Empty */ +#define ZCIO_CS_ERR ((UINT8) 0x10) /* interrupt ERRor */ +#define ZCIO_CS_IP ((UINT8) 0x20) /* Interrupt Pending */ +#define ZCIO_CS_CLIPIUS ((UINT8) 0x20) /* CLear IP and IUS */ +#define ZCIO_CS_IE ((UINT8) 0x40) /* Interrupt Enable */ +#define ZCIO_CS_SIUS ((UINT8) 0x40) /* Set Interrupt Under Service */ +#define ZCIO_CS_CLIUS ((UINT8) 0x60) /* CLear Interrupt Under Service */ +#define ZCIO_CS_IUS ((UINT8) 0x80) /* Interrupt Under Service */ +#define ZCIO_CS_SIP ((UINT8) 0x80) /* Set Interrupt Pending */ +#define ZCIO_CS_CLIP ((UINT8) 0xa0) /* CLear Interrupt Pending */ +#define ZCIO_CS_SIE ((UINT8) 0xc0) /* Set Interrupt Enable */ +#define ZCIO_CS_CLIE ((UINT8) 0xe0) /* CLear Interrupt Enable */ + + +/* Data Direction register values (port A, B and C) */ + +#define ZCIO_DD_OUT ((UINT8) ZERO) /* OUTput bit */ +#define ZCIO_DD_IN ((UINT8) 0xff) /* INput bit */ + + +/* Data Path Polarity register values (port A, B and C) */ + +#define ZCIO_DPP_NONINV ((UINT8) ZERO) /* NON-INVerting */ +#define ZCIO_DPP_INVERT ((UINT8) 0xff) /* INVerting */ + + +/* Port Handshake Specification register values (port A and B) */ + +#define ZCIO_PHS_RWS_RWD ((UINT8) ZERO) /* Request/Wait Disabled */ +#define ZCIO_PHS_DTS_2 ((UINT8) ZERO) /* 2 PCLK cycles */ +#define ZCIO_PHS_HTS_IH ((UINT8) ZERO) /* Interlocked Handshake */ +#define ZCIO_PHS_DTS_4 ((UINT8) 0x01) /* 4 PCLK cycles */ +#define ZCIO_PHS_DTS_6 ((UINT8) 0x02) /* 6 PCLK cycles */ +#define ZCIO_PHS_DTS_8 ((UINT8) 0x03) /* 8 PCLK cycles */ +#define ZCIO_PHS_DTS_10 ((UINT8) 0x04) /* 10 PCLK cycles */ +#define ZCIO_PHS_DTS_12 ((UINT8) 0x05) /* 12 PCLK cycles */ +#define ZCIO_PHS_DTS_14 ((UINT8) 0x06) /* 14 PCLK cycles */ +#define ZCIO_PHS_DTS ((UINT8) 0x07) /* Deskew Time Specification */ +#define ZCIO_PHS_DTS_16 ((UINT8) 0x07) /* 16 PCLK cycles */ +#define ZCIO_PHS_RWS_OW ((UINT8) 0x08) /* Output Wait */ +#define ZCIO_PHS_RWS_IW ((UINT8) 0x18) /* Input Wait */ +#define ZCIO_PHS_RWS_SR ((UINT8) 0x20) /* Special Request */ +#define ZCIO_PHS_RWS_OR ((UINT8) 0x28) /* Output Request */ +#define ZCIO_PHS_RWS_IR ((UINT8) 0x38) /* Input Request */ +#define ZCIO_PHS_RWS ((UINT8) 0x38) /* Request/Wait Specification */ +#define ZCIO_PHS_HTS_SH ((UINT8) 0x40) /* Strobed Handshake */ +#define ZCIO_PHS_HTS_PH ((UINT8) 0x80) /* Pulsed Handshake */ +#define ZCIO_PHS_HTS_3WH ((UINT8) 0xc0) /* 3-Wire Handshake */ +#define ZCIO_PHS_HTS ((UINT8) 0xc0) /* Handshake Type Specification */ + + +/* Interrupt Vector register values (port A and B and C/Ts) */ + +#define ZCIO_IV_ERR ((UINT8) ZERO) /* Error */ +#define ZCIO_IV_CT3 ((UINT8) ZERO) /* Counter/Timer 3 */ +#define ZCIO_IV_CT2 ((UINT8) 0x02) /* Counter/Timer 2 */ +#define ZCIO_IV_PMF ((UINT8) 0x02) /* Pattern Match Flag */ +#define ZCIO_IV_IRF ((UINT8) 0x04) /* Input Register Full */ +#define ZCIO_IV_CT1 ((UINT8) 0x04) /* Counter/Timer 1 */ +#define ZCIO_IV_CTE ((UINT8) 0x06) /* Counter/Timer Error */ +#define ZCIO_IV_ORE ((UINT8) 0x08) /* Output Register Empty */ + + +/* Port Mode Specification register values (port A and B) */ + +#define ZCIO_PMS_PTS_BIT ((UINT8) ZERO) /* BIT port */ +#define ZCIO_PMS_PMS_DPM ((UINT8) ZERO) /* Disable Pattern Match */ +#define ZCIO_PMS_LPM ((UINT8) 0x01) /* Latch on Pattern Match */ +#define ZCIO_PMS_DTE ((UINT8) 0x01) /* Deskew Timer Enable */ +#define ZCIO_PMS_PMS_AND ((UINT8) 0x02) /* "AND" mode */ +#define ZCIO_PMS_PMS_OR ((UINT8) 0x04) /* "OR" mode */ +#define ZCIO_PMS_PMS ((UINT8) 0x06) /* Pattern Mode Specification */ +#define ZCIO_PMS_PMS_PEV ((UINT8) 0x06) /* "Priority Encoded Vector" mode */ +#define ZCIO_PMS_IMO ((UINT8) 0x08) /* Interrupt on Match Only */ +#define ZCIO_PMS_SB ((UINT8) 0x10) /* Single Buffered mode */ +#define ZCIO_PMS_ITB ((UINT8) 0x20) /* Interrupt on Two Bytes */ +#define ZCIO_PMS_PTS_IN ((UINT8) 0x40) /* INput port */ +#define ZCIO_PMS_PTS_OUT ((UINT8) 0x80) /* OUTput port */ +#define ZCIO_PMS_PTS_BI ((UINT8) 0xc0) /* BIdirectal port */ +#define ZCIO_PMS_PTS ((UINT8) 0xc0) /* Port Type Select */ + + +/* Pattern Mask resigter values (port A and B) */ + +#define ZCIO_PM_OFF ((UINT8) ZERO) /* Bit Masked Off (X) */ +#define ZCIO_PM_ANY ((UINT8) ZERO) /* Any Transition (^ or v) */ +#define ZCIO_PM_ZERO ((UINT8) 0xff) /* Zero (0) */ +#define ZCIO_PM_ONE ((UINT8) 0xff) /* One (1) */ +#define ZCIO_PM_0TO1 ((UINT8) 0xff) /* Zero to One Transition (^) */ +#define ZCIO_PM_1TO0 ((UINT8) 0xff) /* One to Zero Transition (v) */ + +/* Pattern Polarity register values (port A and B) */ + +#define ZCIO_PP_OFF ((UINT8) ZERO) /* Bit Masked Off (X) */ +#define ZCIO_PP_ANY ((UINT8) ZERO) /* Any Transition (^ or v) */ +#define ZCIO_PP_ZERO ((UINT8) ZERO) /* Zero (0) */ +#define ZCIO_PP_1TO0 ((UINT8) ZERO) /* One to Zero Transition (v) */ +#define ZCIO_PP_ONE ((UINT8) 0xff) /* One (1) */ +#define ZCIO_PP_0TO1 ((UINT8) 0xff) /* Zero to One Transition (^) */ + +/* Pattern Transition register values (port A and B) */ + +#define ZCIO_PT_OFF ((UINT8) ZERO) /* Bit Masked Off (X) */ +#define ZCIO_PT_ZERO ((UINT8) ZERO) /* Zero (0) */ +#define ZCIO_PT_ONE ((UINT8) ZERO) /* One (1) */ +#define ZCIO_PT_ANY ((UINT8) 0xff) /* Any Transition (^ or v) */ +#define ZCIO_PT_1TO0 ((UINT8) 0xff) /* One to Zero Transition (v) */ +#define ZCIO_PT_0TO1 ((UINT8) 0xff) /* Zero to One Transition (^) */ + +/* Special I/O Control register values (port A B and C) */ + +#define ZCIO_SIO_NORMAL ((UINT8) ZERO) /* NORMAL input or output */ +#define ZCIO_SIO_ODRAIN ((UINT8) 0xff) /* output with Open DRAIN */ +#define ZCIO_SIO_1CATCH ((UINT8) 0xff) /* input with 1's CATCHer */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCz8536h */ diff --git a/h/drv/usb/target/usbIsp1582.h b/h/drv/usb/target/usbIsp1582.h new file mode 100644 index 0000000..e0d52a5 --- /dev/null +++ b/h/drv/usb/target/usbIsp1582.h @@ -0,0 +1,353 @@ +/* usbIsp1582.h - Definitions for Philips ISP 1582 USB target controller */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01b,15jun04,hch Merge after ISP1582 driver testing done on MIPS, SH. +01b,19jul04,ami Coding Convention Changes +01a,19apr04,ami First +*/ + +/* +DESCRIPTION + +Defines constants related to the Philips ISP 1582 USB device (target) IC. +*/ + +#ifndef __INCusbIsp1582h +#define __INCusbIsp1582h + +#ifdef __cplusplus +extern "C" { +#endif + + +/* defines */ + +/* ISP 1582 Endpoint Index */ + +#define ISP1582_ENDPT_0_RX 0x0 /* Control Out Endpoint */ +#define ISP1582_ENDPT_1_RX 0x2 /* Out Endpoint 1 */ +#define ISP1582_ENDPT_2_RX 0x4 /* Out Endpoint 2 */ +#define ISP1582_ENDPT_3_RX 0x6 /* Out Endpoint 3 */ +#define ISP1582_ENDPT_4_RX 0x8 /* Out Endpoint 4 */ +#define ISP1582_ENDPT_5_RX 0xA /* Out Endpoint 5 */ +#define ISP1582_ENDPT_6_RX 0xC /* Out Endpoint 6 */ +#define ISP1582_ENDPT_7_RX 0xE /* Out Endpoint 7 */ + +#define ISP1582_ENDPT_0_TX 0x1 /* Control In Endpoint */ +#define ISP1582_ENDPT_1_TX 0x3 /* In Endpoint 1 */ +#define ISP1582_ENDPT_2_TX 0x5 /* In Endpoint 2 */ +#define ISP1582_ENDPT_3_TX 0x7 /* In Endpoint 3 */ +#define ISP1582_ENDPT_4_TX 0x9 /* In Endpoint 4 */ +#define ISP1582_ENDPT_5_TX 0xB /* In Endpoint 5 */ +#define ISP1582_ENDPT_6_TX 0xD /* In Endpoint 6 */ +#define ISP1582_ENDPT_7_TX 0xF /* In Endpoint 7 */ + +/* ISP 1582 I/O registers */ + +/* Initialization Registers */ +#define ISP1582_ADDRESS_REG 0x00 /* Address Register */ +#define ISP1582_MODE_REG 0x0C /* Mode Register */ +#define ISP1582_INT_CONFIG_REG 0x10 /* Interrupt Config. Reg. */ +#define ISP_1582_OTG_REG 0x12 /* OTG Register */ +#define ISP_1582_INT_ENABLE_REG 0x14 /* Interrupt Enable Reg. */ + +/* Dataflow Registers */ +#define ISP1582_ENDPT_INDEX_REG 0x2C /* Endpoint Index Register */ +#define ISP1582_CNTL_FUNC_REG 0x28 /* Control Function Register */ +#define ISP1582_DATA_PORT_REG 0x20 /* Data Port Register */ +#define ISP1582_BUF_LEN_REG 0x1C /* Buffer Length Register */ +#define ISP1582_BUF_STATUS_REG 0x1E /* Buffer Status Register */ +#define ISP1582_ENDPT_MAXPSIZE_REG 0x04 /* Max. Packet Size Register */ +#define ISP1582_ENDPT_TYPE_REG 0x08 /* Endpoint Type Regsiter */ + +/* DMA Registers */ +#define ISP1582_DMA_COMMAND_REG 0x30 /* DMA Command Register */ +#define ISP1582_DMA_TRANS_CNT_REG 0x34 /* DMA Transfer Counter Reg. */ +#define ISP1582_DMA_CONFIG_REG 0x38 /* DMA Config. Register */ +#define ISP1582_DMA_HARDWARE_REG 0x3C /* DMA Hardware Register */ +#define ISP1582_DMA_INT_RESN_REG 0x50 /* DMA Interrupt Reason Reg */ +#define ISP1582_DMA_INT_ENBL_REG 0x54 /* DMA Interrupt Enable Reg. */ +#define ISP1582_DMA_ENDPT_REG 0x58 /* DMA Endpoint Regsiter */ +#define ISP1582_DMA_BURST_COUNT_REG 0x64 /* DMA Burst Count Regsiter */ + +/* General Register */ +#define ISP1582_INT_REG 0x18 /* Interrupt Register */ +#define ISP1582_CHIP_ID_REG 0x70 /* Chip ID */ +#define ISP1582_FRM_NUM_REG 0x74 /* Frame Number Register */ +#define ISP1582_SCRATCH_REG 0x78 /* Scratch Regsiter */ +#define ISP1582_UNLOCK_DEV_REG 0x7C /* Device Unlock Register */ +#define ISP1582_TEST_MODE_REG 0x84 /* Test Mode Regsiter */ + +/* ISP 1582 endpoints */ + +#define ISP1582_NUM_ENDPOINTS 16 /* number of endpoints */ + +/* Maximum FIFO Size */ +#define ISP1582_FIFO_SIZE 8192 /* 8 KBytes */ + +/* address register (read/write 1 byte) */ + +#define ISP1582_ADRS_REG_ADRS_MASK 0x7f /* address bits */ +#define ISP1582_ADRS_REG_ENABLE 0x80 /* enable bit */ + +/* mode register (read/write 2 bytes) */ + +#define ISP1582_MODE_REG_MASK 0x03FF /* Mode Regsiter Mask */ +#define ISP1582_MODE_REG_SOFTCT 0x0001 /* Soft Connect */ +#define ISP1582_MODE_REG_POWRON 0x0002 /* Power On */ +#define ISP1582_MODE_REG_WKUPCS 0x0004 /* Wake Up on Select */ +#define ISP1582_MODE_REG_GLINTENA 0x0008 /* Global Interrupt Enable */ +#define ISP1582_MODE_REG_SFRESET 0x0010 /* Soft Reset */ +#define ISP1582_MODE_REG_GOSUSP 0x0020 /* Suspend Mode */ +#define ISP1582_MODE_REG_SNDRSU 0x0040 /* Resume Signal */ +#define ISP1582_MODE_REG_CLKAON 0x0080 /* Clock Always On */ +#define ISP1582_MODE_REG_VBUSSTAT 0x0100 /* V-Bus Status */ +#define ISP1582_MODE_REG_DMACLKON 0x0200 /* DMA Clock Always On */ + +/* interupt configuration register (read/write 1 byte) */ + +/* Control Debugging Modes */ +#define ISP1582_INT_CONF_REG_CDBGMOD_MASK 0xC0 /* Control Mode Mask */ +#define ISP1582_INT_CONF_REG_CDBGMOD_ACK_NAK 0x00 /* Interrupts on all */ + /*ACKS & NAKS on Control */ + /* Endpoint */ + +#define ISP1582_INT_CONF_REG_CDBGMOD_ACK_ONLY 0x01 /* Interrupts on only */ + /* ACKS on Control */ + /* Endpoint */ +#define ISP1582_INT_CONF_REG_CDBGMOD_ACK_FST_NAK 0x02 /*Interrupts on all ACKS */ + /* and first NAK on */ + /* control endpoint */ +#define ISP1582_INT_CONF_REG_CDBGMOD_SHIFT(b) ((b)<<6) /* Shift Value */ + +/* Data Debug Mode IN */ +#define ISP1582_INT_CONF_REG_DDBGMODIN_MASK 0x30 /* Data Debug Mode IN */ + /* Mask Value*/ +#define ISP1582_INT_CONF_REG_DDBGMODIN_ACK_NAK 0x00 /* Interrupts on */ + /* ACKs and NAKs on */ + /* IN Endpoint */ +#define ISP1582_INT_CONF_REG_DDBGMODIN_ACK_ONLY 0x01 /* Interrupts on only */ + /* ACKS on IN Endpoint*/ + +#define ISP1582_INT_CONF_REG_DDBGMODIN_ACK_FST_NAK 0x02 /* Interrupts on all */ + /* ACKS and first NAK */ + /* on IN endpoint */ +#define ISP1582_INT_CONF_REG_DDBGMODIN_SHIFT(b) ((b)<<4) /* Shift Value */ + +/* Data Debug Mode Out */ +#define ISP1582_INT_CONF_REG_DDBGMODOUT_MASK 0x0C /* Data Debug Mode OUT*/ + /* Mask Value */ +#define ISP1582_INT_CONF_REG_DDBGMODOUT_ACK_NAK_NYET 0x00 /* Interrupts on */ + /* ACKs, NYETs and */ + /* NAKs on OUT */ + /* Endpoint */ +#define ISP1582_INT_CONF_REG_DDBGMODOUT_ACK_NYET 0x01 /* Interrupts on only */ + /* ACKS & NYETs on */ + /* OUT Endpoint */ + +#define ISP1582_INT_CONF_REG_DDBGMODOUT_ACK__NYET_FST_NAK 0x02 /* Interrupts */ + /* on ACKS, */ + /* NYETs & */ + /* first NAK */ + +#define ISP1582_INT_CONF_REG_DDBGMODOUT_SHIFT(b) ((b)<<2) /* Shift Value */ + +/* Interrupt Level Bit */ +#define ISP1582_INT_CONF_REG_INTLVL_PULSED 0x02 /* Pulsed Mode */ + +/* Interrupt Polarity Bit */ +#define ISP1582_INT_CONF_REG_INTPOL_HIGH 0x01 /* Polarity */ + + +/* Interrupt Enable Register (read/write 4 bytes) */ + +#define ISP1582_INT_ENABLE_REG_MASK 0x03FFFFFF /* Mask Value */ +#define ISP1582_INT_ENABLE_REG_IEBRST 0x0001 /* Bus Reset */ +#define ISP1582_INT_ENABLE_REG_IESOF 0x0002 /* Start of Frame */ +#define ISP1582_INT_ENABLE_REG_IEPSOF 0x0004 /* Pseudo Start of Frame */ +#define ISP1582_INT_ENABLE_REG_IESUSP 0x0008 /* Suspend */ +#define ISP1582_INT_ENABLE_REG_IERESM 0x0010 /* Resume */ +#define ISP1582_INT_ENABLE_REG_IEHS_STA 0x0020 /* High Speed Detection */ +#define ISP1582_INT_ENABLE_REG_IEDMA 0x0040 /* DMA */ +#define ISP1582_INT_ENABLE_REG_IEVBUS 0x0080 /* V-Bus Detection */ +#define ISP1582_INT_ENABLE_REG_IEP0SETUP 0x0100 /* Setup Buffer on Endpt 0 */ + +/* To enable the endpoints for interrupts. The value of "b" should be one of + * endpoint Index. + */ +#define ISP1582_INT_ENABLE_REG_ENDPT_SFT_VAL 0xA /* Shift Value */ +#define ISP1582_INT_ENABLE_REG_ENDPT_SET(b) (1 << ((b) + \ + ISP1582_INT_ENABLE_REG_ENDPT_SFT_VAL)) + +/* Endpoint Index Register (read/write 1 byte) */ + +#define ISP1582_ENDPT_INDEX_REG_MASK 0x3F /* Index Register Mask */ +#define ISP1582_ENDPT_INDEX_REG_EP0SETUP 0x20 /* Setup Buffer */ +#define ISP1582_ENDPT_INDEX_REG_DIR_MASK 0x01 /* Direction Mask */ + +/* Control Function Register (read/write 1 byte) + * This register is an indexed register. Prior to accessing this register + * the endpoint index register must always be set. + */ + +#define ISP1582_CNTL_FUNC_REG_MASK 0x1F /* Control Function Reg Mask */ +#define ISP1582_CNTL_FUNC_REG_STALL 0x01 /* Stall the indexed endpoint */ +#define ISP1582_CNTL_FUNC_REG_STATUS 0x02 /* Status of Indexed Endpoint */ +#define ISP1582_CNTL_FUNC_REG_DSEN 0x04 /* Data Stage Enable */ +#define ISP1582_CNTL_FUNC_REG_VENDP 0x08 /* Validate Indexed Endpoint */ +#define ISP1582_CNTL_FUNC_REG_CLBUF 0x10 /* Clear Indexed Endpoint */ + +/* Buffer Status Register (read 1 byte) */ + +#define ISP1582_BUF_STATUS_REG_MASK 0x03 /* Buffer Status Reg. Mask */ +#define ISP1582_BUF_STATUS_REG_BOTH_EMPT 0x00 /* Both buffers are empty */ +#define ISP1582_BUF_STATUS_REG_ONE_FILL 0x01 /*One of the buffers is filled*/ +#define ISP1582_BUF_STATUS_REG_TWO_FILL 0x02 /*One of the buffers is filled*/ +#define ISP1582_BUF_STATUS_REG_BOTH_FILLED 0x03 /* Both buffers are filled */ + +/* Endpoint Max Packet Size Register (read/write 2 bytes) */ + +#define ISP1582_ENDPT_MAXPSIZE_REG_MASK 0x1FFF /* Max. Packet Size Reg Mask */ +#define ISP1582_ENDPT_MAXPSIZE_REG_MAXP_MASK 0x07FF /* Packet Size Mask */ +#define ISP1582_ENDPT_MAXPSIZE_REG_NTRANS_MASK 0x1800 /* NTRANS Mask Value */ + +/* Definitions for number of transactions per frame */ +#define ISP1582_NTRANS_1 0x0 /* 1 packet per microframe */ +#define ISP1582_NTRANS_2 0x1 /* 2 packets per microframe */ +#define ISP1582_NTRANS_3 0x2 /* 3 packet per microframe */ + +/* Definitions for Max Packet Size */ + +#define ISP1582_MAXPSIZE_8 0x0008 /* Max Packet Size - 8 */ +#define ISP1582_MAXPSIZE_16 0x0010 /* Max Packet Size - 16 */ +#define ISP1582_MAXPSIZE_32 0x0020 /* Max Packet Size - 32 */ +#define ISP1582_MAXPSIZE_64 0x0040 /* Max Packet Size - 64 */ +#define ISP1582_MAXPSIZE_128 0x0080 /* Max Packet Size - 128 */ +#define ISP1582_MAXPSIZE_256 0x0100 /* Max Packet Size - 256 */ +#define ISP1582_MAXPSIZE_512 0x0200 /* Max Packet Size - 512 */ +#define ISP1582_MAXPSIZE_3024 0x0400 /* Max Packet Size - 3024 */ + +/* Definition for Setting the number of transaction in Endpoint Max Packet + * Size Register. + */ +#define ISP1582_ENDPT_MAXPSIZE_REG_NTRANS_SHIFT_VAL 0xB /* Shift Value */ +#define ISP1582_ENDPT_MAXPSIZE_REG_SHIFT_NTRANS(b) ((b) << \ + ISP1582_ENDPT_MAXPSIZE_REG_NTRANS_SHIFT_VAL) + +/* Endpoint Type Register (read/write 2 bytes) */ + +#define ISP1582_ENDPT_TYPE_REG_MASK 0x1F /* Endpt. Type Reg. Mask */ +#define ISP1582_ENDPT_TYPE_REG_EPTYPE_NOT_USED 0x00 /* Not used */ +#define ISP1582_ENDPT_TYPE_REG_EPTYPE_ISO 0x01 /* Isochronous Type */ +#define ISP1582_ENDPT_TYPE_REG_EPTYPE_BULK 0x02 /* Bulk Type */ +#define ISP1582_ENDPT_TYPE_REG_EPTYPE_INTP 0x03 /* Interrupt Type */ +#define ISP1582_ENDPT_TYPE_REG_DOUBLE_BUF 0x04 /* Double Buffering */ +#define ISP1582_ENDPT_TYPE_REG_ENDPT_ENABLE 0x08 /* Endpoint Enable */ +#define ISP1582_ENDPT_TYPE_REG_NOEMPKT 0x10 /* No Empty Packet */ + +/* DMA Command Register (write 1 byte) */ + +#define ISP1582_DMA_COMMAND_REG_GDMA_READ 0x00 /* GDMA Read */ +#define ISP1582_DMA_COMMAND_REG_GDMA_WRITE 0x01 /* GDMA Write */ +#define ISP1582_DMA_COMMAND_REG_VAL_BUF 0x0E /* Validate Buffer */ +#define ISP1582_DMA_COMMAND_REG_CLR_BUF 0x0F /* Clear Buffer */ +#define ISP1582_DMA_COMMAND_REG_DMA_RESET 0x11 /* DMA Reset */ +#define ISP1582_DMA_COMMAND_REG_GDMA_STOP 0x13 /* GDMA Stop */ + +/* DMA Configuration Register (read/write 2 byte) */ + +#define ISP1582_DMA_CONFIG_REG_WIDTH_8 0x00 /* 8 bit bus width */ +#define ISP1582_DMA_CONFIG_REG_WIDTH_16 0x01 /* 16 bit bus width */ +#define ISP1582_DMA_CONFIG_REG_MODE_00 0x00 /* Config Mode 0 */ +#define ISP1582_DMA_CONFIG_REG_MODE_01 0x01 /* Config Mode 1 */ +#define ISP1582_DMA_CONFIG_REG_MODE_10 0x10 /* Config Mode 2 */ +#define ISP1582_DMA_CONFIG_REG_MODE_SHIFT_VAL 0x02 /* Config Shift Value */ +#define ISP1582_DMA_CONFIG_REG_MODE_SET(b) ((b) << \ + ISP1582_DMA_CONFIG_REG_MODE_SHIFT_VAL) +#define ISP1582_DMA_CONFIG_REG_MODE_DIS_XFER_CNT 0x80 /* DMA Transfer Count */ + +/* DMA Hardware Register (read/write 1 byte) */ + +#define ISP1582_DMA_HARDWARE_REG_READ_POL 0x01 /* DIOR is active high */ +#define ISP1582_DMA_HARDWARE_REG_WRITE_POL 0x02 /* DIOW is active high */ +#define ISP1582_DMA_HARDWARE_REG_DREQ_POL 0x04 /* DREQ is active high */ +#define ISP1582_DMA_HARDWARE_REG_ACK_POL 0x08 /* DACK is active high */ +#define ISP1582_DMA_HARDWARE_REG_EOT_POL 0x20 /* EOT is acitve high */ +#define ISP1582_DMA_HARDWARE_REG_ENDIAN_00 0x00 /* Normal Representaion */ +#define ISP1582_DMA_HARDWARE_REG_ENDIAN_01 0x01 /* Swapped Representaion */ +#define ISP1582_DMA_HARDWARE_REG_ENDIAN_SHIFT_VAL 0x06 /* Endianess Shift Val */ +#define ISP1582_DMA_HARDWARE_REG_READ_ENDIAN_SET(b) ((b) << \ + ISP1582_DMA_HARDWARE_REG_ENDIAN_SHIFT_VAL) /* Endianess Val */ + +/* DMA Interrupt Reason Register (read/write 2 bytes) */ + +#define ISP1582_DMA_INT_RESN_MASK 0x9D00 /* DMA Int. Reason Reg Mask */ +#define ISP1582_DMA_INT_RESN_REG_DMA_XFER_OK 0x0100 /* DMA Trans.Counter Int */ +#define ISP1582_DMA_INT_RESN_REG_INT_EOT 0x0400 /* Int. EOT Interrupt */ +#define ISP1582_DMA_INT_RESN_REG_EXT_EOT 0x0800 /* Ext. EOT Interrupt */ +#define ISP1582_DMA_INT_RESN_REG_GDMA_STOP 0x1000 /* GDMA Stop Interrupt */ +#define ISP1582_DMA_INT_RESN_REG_TEST3 0x8000 /* Test3 Interrupt */ + +/* DMA Interrupt Enable Register (read/write 2 bytes ) */ + +#define ISP1582_DMA_INT_ENBL_REG_IE_DMA_XFER_OK 0x0100 /*DMA Trans.Counter Int*/ +#define ISP1582_DMA_INT_ENBL_REG_IE_INT_EOT 0x0400 /* Int. EOT Interrupt */ +#define ISP1582_DMA_INT_ENBL_REG_IE_EXT_EOT 0x0800 /* Ext. EOT Interrupt */ +#define ISP1582_DMA_INT_ENBL_REG_IE_GDMA_STOP 0x1000 /* GDMA Stop Interrupt*/ +#define ISP1582_DMA_INT_ENBL_REG_IE_TEST4 0x8000 /* Test Interrupt */ + +/* DMA Endpoint Regsiter (read/write 1 byte) */ + +#define ISP1582_DMA_ENDPOINT_REG_MASK 0x0F /* DMA Endpoint Mask */ + +/* Interrupt Register (read/write 4 bytes) */ + +#define ISP1582_INT_REG_CLEAR 0x03FFFDFF /* To clear all interrupts */ +#define ISP1582_INT_REG_BRST 0x0001 /* Bus Reset */ +#define ISP1582_INT_REG_SOF 0x0002 /* Start of Frame */ +#define ISP1582_INT_REG_PSOF 0x0004 /* Pseudo Start of Frame */ +#define ISP1582_INT_REG_SUSP 0x0008 /* Suspend */ +#define ISP1582_INT_REG_RESM 0x0010 /* Resume */ +#define ISP1582_INT_REG_HS_STA 0x0020 /* High Speed Detection */ +#define ISP1582_INT_REG_DMA 0x0040 /* DMA */ +#define ISP1582_INT_REG_VBUS 0x0080 /* V-Bus Detection */ +#define ISP1582_INT_REG_EP0SETUP 0x0100 /* Setup Buffer on Endpt 0 */ +#define ISP1582_INT_ENDPT_MASK 0x03FFFC00 /* Int. Register Mask */ +#define ISP1582_INT_REG_ENDPT_SFT_VAL 0xA /* Endpoint Shift Value */ + +#define ISP1582_INT_REG_ENDPT_SET(b) ((b) << ISP1582_INT_REG_ENDPT_SFT_VAL) + +/* ISP 1582 signature (read through Read Chip Id command) */ + +#define ISP1582_CHIP_ID_MASK 0xFFFF00 /* Chip ID Mask */ +#define ISP1582_CHIP_ID 0x158200 /* ISP 1582 Chip ID */ +#define ISP1582_CHIP_VER 0x000010 /* Version Number */ + +/* Frame Number Register (read 2 bytes) */ +#define ISP1582_FRM_NUM_REG_SOFR_MASK 0x07FF /* SOF Mask */ +#define ISP1582_FRM_NUM_REG_MSOFR_MASK 0x3800 /* MSOF Mask */ +#define ISP1582_FRM_NUM_REG_MSOFR_VAL(b) (((b) & \ + ISP1582_FRM_NUM_REG_MSOFR_MASK) >> 0xB) /* Shift Value */ + +/* Unlock Device Register (write 2 bytes) */ +#define ISP1582_UNLOCK_DEV_REG_CODE 0xAA37 /* Device Unlock Code */ + +/* Test Mode Register (read/write 1 byte) */ + +#define ISP1582_TEST_MODE_REG_SE0_ACK 0x01 /* Sets DP & DM to HS State */ +#define ISP1582_TEST_MODE_REG_JSTATE 0x02 /* Sets to J-STATE */ +#define ISP1582_TEST_MODE_REG_KSTATE 0x04 /* Sets to K-STATE */ +#define ISP1582_TEST_MODE_REG_PRBS 0x08 /* Predetermined randon pattern*/ +#define ISP1582_TEST_MODE_REG_FORCEFS 0x10 /* Forces to FS mode only */ +#define ISP1582_TEST_MODE_REG_FORCEHS 0x80 /* Forces to HS mode only */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbIsp1582h */ diff --git a/h/drv/usb/target/usbIsp1582Debug.h b/h/drv/usb/target/usbIsp1582Debug.h new file mode 100644 index 0000000..6f0e844 --- /dev/null +++ b/h/drv/usb/target/usbIsp1582Debug.h @@ -0,0 +1,50 @@ +/* usbIsp1582Debug.h - Defines the debug macros used by the ISP1582 sub-modules */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01d,26oct04,ami Debug Messages Changes +01c,06oct04,ami SPR #94684 Fix +01b,12jul04,ami Coding Convention Changes +01a,28apr04,ami First. +*/ + +/* +DESCRIPTION + +Defines the debug macros which are used by the usbPdiusbd12 sub-modules +*/ +#ifndef __INCusbIsp1582Debugh +#define __INCusbIsp1582Debugh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include + +/* defines */ + +#define USBISP1582_DEBUG_MSG 0x01 /* For Debugging Log Messages */ +#define USBISP1582_DEBUG_ERR 0x02 /* For Error Log Messages */ + +extern void usbPeriLogMsg (char *,int,int,int,int,int,int); + +#define USBISP1582_DEBUG \ + if (usbIsp1582Debug & USBISP1582_DEBUG_MSG) \ + usbPeriLogMsg /* debugging Macros */ + +#define USBISP1582_ERROR \ + if (usbIsp1582Debug & USBISP1582_DEBUG_ERR) \ + usbPeriLogMsg /* error macros */ + +extern UINT32 usbIsp1582Debug; /* Define the debugging flag */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbIsp1582Debugh */ diff --git a/h/drv/usb/target/usbIsp1582Eval.h b/h/drv/usb/target/usbIsp1582Eval.h new file mode 100644 index 0000000..6090e59 --- /dev/null +++ b/h/drv/usb/target/usbIsp1582Eval.h @@ -0,0 +1,87 @@ +/* usbIsp1582Eval.h - Definitions for Philips ISP 1582 eval board */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01d,02aug04,mta Modification History Changes +01c,19jul04,ami Coding Convention Changes +01b,01jun04,mta Changes for Interrupt Mode +01a,21apr04,ami First. +*/ + +/* +DESCRIPTION + +Defines constants related to the Philips ISP 1582 evaluation board. +*/ + +#ifndef __INCusbIsp1582Evalh +#define __INCusbIsp1582Evalh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "usb/usbPciLib.h" /* PCI bus functions */ + + +/* defines */ + +/* evaluation board I/O address offsets */ + +/* + * There are four ports that are utilized by the firmware. The Address port is + * a gateway for the PCI bus to assign the register address to the ISP1582. + * The Data port holds the 16-bit data that is to be written to or read out + * from the ISP1582 register. The Control port has only a single function: to + * mask the interrupt from the ISP1582. This allows the processor to branch to + * the interrupt service routine to clear the respective interrupt. The DMA + * port controls the function of the external master DMA controller. + */ + +#define ISP1582EVAL_ADDRESS_PORT 0 /* address port */ +#define ISP1582EVAL_DATA_PORT 2 /* data port */ +#define ISP1582EVAL_CNTL_PORT 4 /* control port */ +#define ISP1582EVAL_DMA_PORT 6 /* dma port */ + +/* default settings for DMA */ + +#define ISP1582EVAL_DEFAULT_DMA 6 /* default DMA channel */ + +/* macros used to read/write ISP 1582 registers. ISP 1582 uses 16 bit bus + * access. So all read/ writes to/from the registers will be 16 bits read + * write. + */ + +#define OUT_ISP1582_CMD(pTarget,b) \ + USB_PCI_WORD_OUT (pTarget->ioBase + ISP1582EVAL_ADDRESS_PORT , (b)) + /* Macro to write in address port */ +#define OUT_ISP1582_DATA(pTarget,b) \ + USB_PCI_WORD_OUT (pTarget->ioBase + ISP1582EVAL_DATA_PORT , (b)) + /* Macro to write on data port */ + +#define IN_ISP1582_DATA(pTarget) \ + USB_PCI_WORD_IN (pTarget->ioBase + ISP1582EVAL_DATA_PORT) + /* Macro to read from data port */ + +#define OUT_ISP1582_CNTL(pTarget,b) \ + USB_PCI_WORD_OUT (pTarget->ioBase + ISP1582EVAL_CNTL_PORT , (b)) + /* Macro to write on Control Port */ + +#define OUT_ISP1582_DMA(pTarget,b) \ + USB_PCI_WORD_OUT (pTarget->ioBase + ISP1582EVAL_DMA_PORT , (b)) + /* Macro to write on DMA Port */ + +#define IN_ISP1582_DMA(pTarget) \ + USB_PCI_WORD_OUT (pTarget->ioBase + ISP1582EVAL_DMA_PORT) + /* Macro to read on DMA port */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbIsp1582Evalh */ diff --git a/h/drv/usb/target/usbIsp1582Tcd.h b/h/drv/usb/target/usbIsp1582Tcd.h new file mode 100644 index 0000000..fb7d44d --- /dev/null +++ b/h/drv/usb/target/usbIsp1582Tcd.h @@ -0,0 +1,76 @@ +/* usbIsp1582Tcd.h - Definitions used by PDIUSBD12 TCD */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01d,02aug04,mta Modification History Changes +01c,19jul04,ami Coding Convention Changes +01b,01jun04,mta Changes for Interrupt Mode +01a,21apr04,ami First. +*/ + +/* +DESCRIPTION + +Defines structures used by Philips PDIUSBD12 TCD. +*/ + + +#ifndef __INCusbIsp1582Tcdh +#define __INCusbIsp1582Tcdh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Bitmap for IN and OUT Endpoints Supported */ + +#define USB_ISP1582_TCD_OUT_ENDPOINT 0x000000FF /* bitmap for Out endpoint */ +#define USB_ISP1582_TCD_IN_ENDPOINT 0x00FF0000 /* bitmap for In endpoint */ + + +/* typedefs */ + +typedef struct usbTcdIsp1582Target /* USB_TCD_ISP1582_TARGET */ + { + UINT32 ioBase; /* IO Base */ + UINT16 irq; /* IRQ Number */ + UINT16 dma; /* DMA Channel */ + USB_HAL_ISR_CALLBACK usbHalIsr; /* HAL ISR Callback */ + pVOID usbHalIsrParam; /* HAL ISR Parameter */ + UINT8 deviceAddress; /* Device Address */ + UINT32 bufSize; /* Buffer Size */ + UINT16 endpointIndexInUse; /* Endpoint Index being used */ + BOOL dmaInUse; /* Flag for DMA in use or not */ + UINT8 dmaEndpointId; /* DMA Endpoint ID */ + UINT8 dmaEndptNotInUse; /* DMA Endpoint not being used */ + BOOL dmaEot; /* DMA End of Transfer */ + UINT16 endptIntPending; /* Bitmap showing Pending Endpoint Int */ + BOOL setupIntPending; /* Setup Interrupt occured */ + UINT16 dmaXferLen; /* DMA Transfer Length */ + BOOL controlINStatusPending; /* Control IN Status Pending Report */ + BOOL controlOUTStatusPending;/* Control OUT Status Pending Report */ +#ifdef ISP1582_POLLING + THREAD_HANDLE threadId; /* Polling Mode Thread Handle */ +#endif + } USB_TCD_ISP1582_TARGET, *pUSB_TCD_ISP1582_TARGET; + +typedef struct usbTcdIsp1582Endpoint /* USB_TCD_ISP1582_ENDPOINT */ + { + UINT8 endpointIndex; /* Endpoint Index */ + UINT16 transferType; /* Endpoint Transfer Type */ + UINT8 direction; /* Direction */ + UINT16 maxPacketSize; /* Max Packet Size */ + BOOL isDoubleBufSup; /* Double Buffering */ + } USB_TCD_ISP1582_ENDPOINT, *pUSB_TCD_ISP1582_ENDPOINT; + +/* function declaration */ +extern VOID usbTcdIsp1582Isr(pVOID param); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbIsp1582Tcdh */ diff --git a/h/drv/usb/target/usbNET2280.h b/h/drv/usb/target/usbNET2280.h new file mode 100644 index 0000000..67c1c26 --- /dev/null +++ b/h/drv/usb/target/usbNET2280.h @@ -0,0 +1,427 @@ +/* usbNET2280.h - Definitions for NetChip NET 2280 USB target controller */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01g,30sep04,pdg Removed the endianness macros and function calls for register + reads and writes +01f,29sep04,ami Changes related to Mips Testing +01e,20sep04,ami NET2280 tested in High Speed +01d,17sep04,ami After Control, Interrupt IN and Bulk OUT Testing +01c,08sep04,ami Code Review Incorporated +01b,03sep04,ami Design Changes +01a,29jun04,pmr written. +*/ + +/* +DESCRIPTION + +Defines constants related to the NetChip NET 2280 USB device (target) IC. +*/ + +#ifndef __INCusbNet2280h +#define __INCusbNet2280h + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include "usb/usbPciLib.h" +#include "cacheLib.h" + +/* defines */ + +/* Endpoint Indices */ + +#define NET2280_ENDPT_0_OUT 0x0 /* Endpoint 0 OUT */ +#define NET2280_ENDPT_A 0x1 /* Endpoint A */ +#define NET2280_ENDPT_B 0x2 /* Endpoint B */ +#define NET2280_ENDPT_C 0x3 /* Endpoint C */ +#define NET2280_ENDPT_D 0x4 /* Endpoint D */ +#define NET2280_ENDPT_E 0x5 /* Endpoint E */ +#define NET2280_ENDPT_F 0x6 /* Endpoint F */ +#define NET2280_ENDPT_0_IN 0x7 /* Endpoint 0 IN */ + +#define NET2280_ENDPT_CFGOUT 0xA /* Endpoint CFG OUT */ +#define NET2280_ENDPT_CFGIN 0xB /* Endpoint CFG IN */ +#define NET2280_ENDPT_PCIOUT 0xC /* Endpoint PCI OUT */ +#define NET2280_ENDPT_PCIIN 0xD /* Endpoint PCI IN */ +#define NET2280_ENDPT_STATIN 0xF /* ENDpoint STATIN */ + + +/* Main Control Registers */ + +#define NET2280_DEVINIT_REG 0x00 /* Device Initialization */ +#define NET2280_EECTL_REG 0x04 /* EEPROM Control */ +#define NET2280_EECLKFREQ_REG 0x08 /* EEPROM Clock Frequency */ +#define NET2280_PCIIRQENB0_REG 0x10/* PCI Interrupt Request Enable 0*/ +#define NET2280_PCIIRQENB1_REG 0x14/* PCI Interrupt Request Enable 1*/ +#define NET2280_CPUIRQENB0_REG 0x18/* CPU Interrupt Request Enable 0*/ +#define NET2280_CPUIRQENB1_REG 0x1C/* CPU Interrupt Request Enable 1*/ +#define NET2280_USBIRQENB1_REG 0x24/* USB Interrupt Request Enable 1*/ +#define NET2280_IRQSTAT0_REG 0x28 /* Interrupt Request Status 0*/ +#define NET2280_IRQSTAT1_REG 0x2C /* Interrupt Request Status 1*/ +#define NET2280_IDXADDR_REG 0x30 /* Index Regsiter Address */ +#define NET2280_IDXDATA_REG 0x34 /* Index Register Data */ +#define NET2280_FIFOCTL_REG 0x38 /* FIFO Control */ +#define NET2280_MEMADDR_REG 0x40 /* FIFO Memory Diagnostic addr*/ +#define NET2280_MEMDATA0_REG 0x44 /* FIFO Memory Diagnostic Data0*/ +#define NET2280_MEMDATA1_REG 0x48 /* FIFO Memory Diagnostic Data1*/ +#define NET2280_GPIOCTL_REG 0x50 /* General Purpose Control Reg.*/ +#define NET2280_GPIOSTAT_REG 0x54 /* General Purpose Status Reg */ + +/* USB Control Registers */ + +#define NET2280_STDRSP_REG 0x80 /* Standard Response Regsiter */ +#define NET2280_PRODVENDID_REG 0x84 /* Product/Vendor ID */ +#define NET2280_RELNUM_REG 0x88 /* Release Number */ +#define NET2280_USBCTL_REG 0x8C /* USB Control */ +#define NET2280_USBSTAT_REG 0x90 /* USB Status */ +#define NET2280_XCVRDIAG_REG 0x94 /* Transceiver Mode Regsiter */ +#define NET2280_SETUP0123_REG 0x98 /* Setup Bytes 0,1,2,3 */ +#define NET2280_SETUP4567_REG 0x9C /* Setup Bytes 4,5,6,7 */ +#define NET2280_OURADDR_REG 0xA4 /* Address Register */ +#define NET2280_OURCONFIG_REG 0xA8 /* Configuration Register */ + +/* PCI Control Registers */ + +#define NET2280_PCIMSTCTL_REG 0x100 /* PCI Master Control */ +#define NET2280_PCIMSTADDR_REG 0x104 /* PCI Master Address */ +#define NET2280_PCIMSTDATA_REG 0x108 /* PCI Master Data */ +#define NET2280_PCIMSTSTAT_REG 0x10C /* PCI Master Status */ + +/* DMA Registers */ + +#define NET2280_DMACTL_OFFSET(x) \ + (NET2280_DMA_REG_BASE(x) + 0x00) /* DMA Control */ +#define NET2280_DMASTAT_OFFSET(x) \ + (NET2280_DMA_REG_BASE(x) + 0x04) /* DMA Status */ +#define NET2280_DMACOUNT_OFFSET(x) \ + (NET2280_DMA_REG_BASE(x) + 0x10) /* DMA Count */ +#define NET2280_DMAADDR_OFFSET(x) \ + (NET2280_DMA_REG_BASE(x) + 0x14) /* DMA Address */ +#define NET2280_DMADESC_OFFSET(x) \ + (NET2280_DMA_REG_BASE(x) + 0x18) /* DMA Descriptor */ + +/* + * DMA channels are permanently associated with endpoints. The driver will + * select the DMA channel based upon which endpoint is being used. The base + * address should be added with the offset of the register + */ + +#define NET2280_DMA_REG_BASE(x) (0x160 + 0x20 * x) + +/* Dedicated Endpoint Registers */ + +#define NET2280_DEP_CFG_OFFSET 0x0 /* DEP_CFG Offset */ +#define NET2280_DEP_RSP_OFFSET 0x4 /* DEP_RES Offset */ + +#define NET2280_DEP_CFGOUT_REG_BASE 0x200 /* CFG OUT Base */ +#define NET2280_DEP_CFGIN_REG_BASE 0x210 /* CFG IN Base */ +#define NET2280_DEP_PCIOUT_REG_BASE 0x220 /* PCI OUT Base */ +#define NET2280_DEP_PCIIN_REG_BASE 0x230 /* PCI IN Base */ +#define NET2280_DEP_STATIN_REG_BASE 0x240 /* STAT IN Base */ + +/* Configurable Endpoint / FIFO Registers */ + +#define NET2280_EP_CFG_OFFSET(x) \ + (NET2280_EP_REG_BASE(x) + 0x00) /* endpt config. offset */ +#define NET2280_EP_RSP_OFFSET(x) \ + (NET2280_EP_REG_BASE(x) + 0x04) /* endpt response offset */ +#define NET2280_EP_IRQENB_OFFSET(x) \ + (NET2280_EP_REG_BASE(x) + 0x08) /* endpt intr enable offset */ +#define NET2280_EP_STAT_OFFSET(x) \ + (NET2280_EP_REG_BASE(x) + 0x0C) /* endpt status offset */ +#define NET2280_EP_AVAIL_OFFSET(x) \ + (NET2280_EP_REG_BASE(x) + 0x10) /* endpt avail offset */ +#define NET2280_EP_DATA_OFFSET(x) \ + (NET2280_EP_REG_BASE(x) + 0x14) /* endpt data offset */ + +/* + * Every endpoint has a seperate set of register. Add the endpoint register + * offset with the base address + */ + +#define NET2280_EP_REG_BASE(x) (0x300 + 0x20 * x) + +/* Indexed Registers */ + +#define NET2280_DIAG_IDX 0x00 /* Diagnostic Control Reg */ +#define NET2280_PKTLEN_IDX 0x01 /* Packet Length Reg */ +#define NET2280_FRAME_IDX 0x02 /* Frame Counter Reg */ +#define NET2280_CHIPREV_IDX 0x03 /* Chip Revision Reg */ +#define NET2280_HS_MAXPOWER_IDX 0x06 /* HS Max Power Reg */ +#define NET2280_FS_MAXPOWER_IDX 0x07 /* FS Max Power Reg */ +#define NET2280_HS_INTPOLL_RATE_IDX 0x08 /* HS Int Polling Rate */ +#define NET2280_FS_INTPOLL_RATE_IDX 0x09 /* FS Int Poling Rate */ +#define NET2280_HS_NAK_RATE_IDX 0x0A /* HS NAK Rate Reg */ +#define NET2280_SCRATCH_IDX 0x0B /* Scratch Pad */ + +#define NET2280_EP_X_HS_MAXPKT_IDX(x) (0x10 + x * 0x10) +#define NET2280_EP_X_FS_MAXPKT_IDX(x) (0x11 + x * 0x10) + +/* Bits & Masks */ + +#define NET2280_OURADDR_REG_MASK 0x7F /* OURADDR: Address Mask */ +#define NET2280_OURADDR_REG_FI 0x80 /* OURADDR: Force Immediate */ + +#define NET2280_USBSTAT_REG_MASK 0xF0 /* USBSTAT: Register Mask */ +#define NET2280_USBSTAT_REG_GENDEVREMWKUP 0x10 /* USBSTAT: */ + /* Generate Remote */ + /* Wakeup */ +#define NET2280_USBSTAT_REG_GENRES 0x20 /* USBSTAT: Generate Resume */ +#define NET2280_USBSTAT_FS 0x40 /* USBSTAT: Full Speed */ +#define NET2280_USBSTAT_HS 0x80 /* USBSTAT: High Speed */ + + +#define NET2280_USBCTL_REG_MASK 0x00FF3EFF /* USBCTL: Reg Mask */ +#define NET2280_USBCTL_REG_SERNUMID 0x00FF0000 /* USBCTL: Serial */ + /* Index Number */ +#define NET2280_USBCTL_REG_PRODIDEN 0x00002000 /* USBCTL: Prod ID */ +#define NET2280_USBCTL_REG_VENDIDEN 0x00001000 /* USBCTL: Vend ID */ +#define NET2280_USBCTL_REG_RPWE 0x00000800 /* USBCTL: Rem WKUP */ +#define NET2280_USBCTL_REG_VBUSPIN 0x00000400 /* USBCTL: VBUS */ +#define NET2280_USBCTL_REG_SUSPIMM 0x00000080 /* USBCTL: SUSP IMMD */ +#define NET2280_USBCTL_REG_SPUD 0x00000040 /* USBCTL: Self Powered*/ +#define NET2280_USBCTL_REG_RWS 0x00000020 /* USBCTL: Rem WKUP Sup */ +#define NET2280_USBCTL_REG_USBDE 0x00000008 /* USBCTL: USB Detect Enb */ +#define NET2280_USBCTL_REG_DRWUE 0x00000002 /* USBCTL: Dev Remote */ + /* Wake Enable*/ +#define NET2280_USBCTL_REG_SPWRSTAT 0x00000001 /* USBCTL: Self Powered */ + /* Status */ + +#define NET2280_FRAME_REG_MASK 0x7FF /* FRAME: Frame Mask */ + +#define NET2280_DEVINIT_REG_MASK 0xFFF /* DEVINIT: Reg Mask */ +#define NET2280_DEVINIT_REG_FRC_PCI_RESET 0x080 /* DEVINIT: Force PCI Reset */ +#define NET2280_DEVINIT_REG_PCI_ID 0x040 /* DEVINIT: PCI ID */ +#define NET2280_DEVINIT_PCIEN 0x020 /* DEVINIT: PCI Enable */ +#define NET2280_DEVINIT_FIFO_RESET 0x010 /* DEVINIT: FIFO Reset */ +#define NET2280_DEVINIT_CFG_RESET 0x008 /* DEVINIT: CFG Reset */ +#define NET2280_DEVINIT_PCI_RESET 0x004 /* DEVINIT: PCI Reset */ +#define NET2280_DEVINIT_USB_RESET 0x002 /* DEVINIT: USB Reset */ +#define NET2280_DEVINIT_8051_RESET 0x001 /* DEVINIT: 851 Reset */ +#define NET2280_DEVINIT_FULL_RESET (NET2280_DEVINIT_FIFO_RESET | \ + NET2280_DEVINIT_USB_RESET | \ + NET2280_DEVINIT_8051_RESET) +#define NET2280_DEVINIT_CLK_FREQ (8 << 8)/* DEVINIT: CLK FREQUENCY */ + +/* Interrupt enable registers (CPU, PCI, & USB) */ + +#define NET2280_XIRQENB0_SETUP 0x00000080 +#define NET2280_XIRQENB0_EP(x) (1 << x) +#define NET2280_XIRQENB0_MASK 0x000000FF + +#define NET2280_XIRQENB1_REG_MASK 0x8E1B3FDF /* Reg. Mask */ +#define NET2280_XIRQENB1_INTEN 0x80000000 /* XIRQENB1: PCI INT Enable*/ +#define NET2280_XIRQENB1_PSCINTEN 0x08000000 /* XIRQENB1: PWR State */ + /* Change Interrupt Enable */ +#define NET2280_XIRQENB1_PCIARTTIMEOUT 0x04000000 /* XIRQENB1: PCI Arbiter */ + /* Timeout Interrupt Enable */ +#define NET2280_XIRQENB1_PCIPARITYERR 0x02000000 /* PCI Parity Error */ +#define NET2280_XIRQENB1_PCIRTYABORT 0x00020000 /* PCI Retry Abort */ +#define NET2280_XIRQENB1_PCIMASCYCLEDN 0x00010000 /* PCI Master Cycle Done */ +#define NET2280_XIRQENB1_GPIO 0x00002000 /* General I/O */ +#define NET2280_XIRQENB1_DMA(x) (0x00000100 << x) /* DMA Int Enable */ +#define NET2280_XIRQENB1_EEPD 0x00000100 /* EEPROM done */ +#define NET2280_XIRQENB1_VBUS 0x00000080 /* VBUS change */ +#define NET2280_XIRQENB1_CS 0x00000040 /* control status */ +#define NET2280_XIRQENB1_RPRESET 0x00000010 /* root port reset */ +#define NET2280_XIRQENB1_SUSP 0x00000008 /* suspend request */ +#define NET2280_XIRQENB1_SUSREQCHG 0x00000004 /* susp. req. change */ +#define NET2280_XIRQENB1_RESM 0x00000002 /* resume */ +#define NET2280_XIRQENB1_SOF 0x00000001 /* start-of-frame */ + +/* Interrupt status registers - status bits are cleared by writing a 1 */ + +#define NET2280_IRQENB0_SETUP 0x00000080 +#define NET2280_IRQENB0_EP(x) (1 << x) +#define NET2280_IRQENB0_EPMASK 0x0000007F + +#define NET2280_IRQENB1_REG_MASK 0x8E1B3FDF /* Reg. Mask */ +#define NET2280_IRQENB1_INTEN 0x80000000 /* IRQENB1: PCI INT */ +#define NET2280_IRQENB1_PSCINTEN 0x08000000 /* IRQENB1: PWR State */ + /* Change Interrupt */ +#define NET2280_IRQENB1_PCIARTTIMEOUT 0x04000000 /* XIRQENB1: PCI Arbiter */ + /* Timeout Interrupt */ +#define NET2280_IRQENB1_PCIPARITYERR 0x02000000 /* PCI Parity Error */ +#define NET2280_IRQENB1_PCIRTYABORT 0x00020000 /* PCI Retry Abort */ +#define NET2280_IRQENB1_PCIMASCYCLEDN 0x00010000 /* PCI Master Cycle Done */ +#define NET2280_IRQENB1_GPIO 0x00002000 /* General I/O */ +#define NET2280_IRQENB1_DMA(x) (0x00000100 << x) /* DMA Int */ +#define NET2280_IRQENB1_EEPD 0x00000100 /* EEPROM done */ +#define NET2280_IRQENB1_VBUS 0x00000080 /* VBUS change */ +#define NET2280_IRQENB1_CS 0x00000040 /* control status */ +#define NET2280_IRQENB1_RPRESET 0x00000010 /* root port reset */ +#define NET2280_IRQENB1_SUSP 0x00000008 /* suspend request */ +#define NET2280_IRQENB1_SUSREQCHG 0x00000004 /* susp. req. change */ +#define NET2280_IRQENB1_RESM 0x00000002 /* resume */ +#define NET2280_IRQENB1_SOF 0x00000001 /* start-of-frame */ +#define NET2280_IRQENB1_DMA_SHIFT 9 /* DMA shift value */ + +/* DMA registers */ + +#define NET2280_DMACTL_SG_INT_EN 0x02000000 /* scatter/gather int */ +#define NET2280_DMACTL_SGE 0x00010000 /* scatter/gather en */ +#define NET2280_DMACTL_ASE 0x00000010 /* auto start enable */ +#define NET2280_DMACTL_PREENB 0x00000008 /* dma preempt enable */ +#define NET2280_DMACTL_FIFOVAL 0x00000004 /* dma fifo validate */ +#define NET2280_DMACTL_EN 0x00000002 /* dma enable */ +#define NET2280_DMACTL_ADDRHOLD 0x00000001 /* dma address hold */ + +#define NET2280_DMASTAT_SG_INT 0x02000000 /* scatter/gather */ +#define NET2280_DMASTAT_TD_INT 0x01000000 /* transact. done */ +#define NET2280_DMASTAT_ABORT 0x00000002 /* abort DMA trans. */ +#define NET2280_DMASTAT_START 0x00000001 /* start DMA trans. */ + +#define NET2280_DMACOUNT_VB 0x80000000 /* DMA valid bit */ +#define NET2280_DMACOUNT_DIR 0x40000000 /* DMA direction */ +#define NET2280_DMACOUNT_DIE 0x20000000 /* done int. enable */ +#define NET2280_DMACOUNT_BC 0x00FFFFFF /* Byte count */ + +/* Test Mode Register */ + +#define NET2280_XCVRDIAG_TEST_MASK 0x07000000 /* XCVRDIAG: Mask bits */ +#define NET2280_XCVRDIAG_TEST_SHIFT_VAL 24 +#define NET2280_XCVRDIAG_TEST_MODE_SET(x) \ + ((x) << NET2280_XCVRDIAG_TEST_SHIFT_VAL) + +/* Endpoint registers */ +#define NET2280_EP_STAT_FIFOVC 0x0F000000 /* FIFO valid count */ +#define NET2280_EP_STAT_HBOUTPID 0x00C00000 /* high bw OUT PID */ +#define NET2280_EP_STAT_TIMEOUT 0x00200000 /* time out */ +#define NET2280_EP_STAT_STALLSNT 0x00100000 /* stall sent */ +#define NET2280_EP_STAT_INNAKSNT 0x00080000 /* USB IN NAK Sent */ +#define NET2280_EP_STAT_INACKRCV 0x00040000 /* USB IN ACK Sent */ +#define NET2280_EP_STAT_OPNAKSNT 0x00020000 /* USB OUT NAK Sent */ +#define NET2280_EP_STAT_OUTACKSNT 0x00010000 /* USB OUT ACK Sent */ +#define NET2280_EP_STAT_FIFO_OVERF 0x00002000 /* USB FIFO Overflow */ +#define NET2280_EP_STAT_FIFO_UNDERF 0x00001000 /* USB FIFO Underflow*/ +#define NET2280_EP_STAT_FIFO_FULL 0x00000800 /* USB FIFO Full */ +#define NET2280_EP_STAT_FIFO_EMPTY 0x00000400 /* USB FIFO Empty */ +#define NET2280_EP_STAT_FIFO_FLUSH 0x00000200 /* USB FIFO Flush */ +#define NET2280_EP_STAT_SPOD 0x00000040 /* Short Packet Out */ + /* Done Interrupt */ +#define NET2280_EP_STAT_SPT 0x00000020 /* Short Packet */ + /* Transmitted Intpt */ +#define NET2280_EP_STAT_NAKOUT 0x00000010 /* NAK OUT Packets */ +#define NET2280_EP_STAT_DPR 0x00000008 /* Data Packet */ + /* Received Interrupt */ +#define NET2280_EP_STAT_DPT 0x00000004 /* Data Packet */ + /* Trnasmitted Intpt */ +#define NET2280_EP_STAT_DOPT 0x00000002 /* Data OUT Token Int */ +#define NET2280_EP_STAT_DIT 0x00000001 /* Data IN Toke Int */ + +#define NET2280_EP_CFG_REG_MASK 0x0007078F /* EP_CFG: Mask Value */ +#define NET2280_EP_CFG_EBC 0x00070000 /* EP_CFG: */ + /* Ept byte count */ +#define NET2280_EP_CFG_ENABLE 0x00000400 /* EP_CFG: endpt enable*/ +#define NET2280_EP_CFG_TYPE_INT 0x00000300 /* EP_CFG: interrupt */ + /* endpt type */ +#define NET2280_EP_CFG_TYPE_BULK 0x00000200 /* EP_CFG: bulk endpt */ +#define NET2280_EP_CFG_TYPE_ISO 0x00000100 /* EP_CFG: iso endpt */ +#define NET2280_EP_CFG_TYPE_MASK 0x00000300 /* EP_CFG: Ept type */ +#define NET2280_EP_CFG_DIRECTION 0x00000080 /* EP_CFG: Ept dir */ +#define NET2280_EP_CFG_NUMBER 0x0000000F /* EP_CFG: Ept no */ +#define NET2280_EP_CFG_DIR_SHIFT 7 /* EP_CFG: dir shift */ +#define NET2280_EP_CFG_TYPE_SHIFT 8 /* EP_CFG: type shift */ +#define NET2280_EP_CFG_BYTE_CNT_SHIFT 16 + +/* Endpoint response register - bits are cleared on 0:7 and set on 8:15 */ + +#define NET2280_EP_RSP_NAKOUT 0x00000080 +#define NET2280_EP_RSP_HIDSTAT 0x00000040 +#define NET2280_EP_RSP_FCRCERR 0x00000020 +#define NET2280_EP_RSP_INTMODE 0x00000010 +#define NET2280_EP_RSP_CSPH 0x00000008 /* ctrl stat ph. h/s */ +#define NET2280_EP_RSP_NAKOUTMOD 0x00000004 +#define NET2280_EP_RSP_TOGGLE 0x00000002 +#define NET2280_EP_RSP_STALL 0x00000001 /* endpoint halt */ +#define NET2280_EP_RSP_SET(x) (x << 8) +#define NET2280_EP_RSP_CLEAR(x) (x) + +/* Endpoint Interrupts */ +#define NET2280_EP_IRQENB_SPOD 0x00000040 /* short pkt out done */ +#define NET2280_EP_IRQENB_SPT 0x00000020 /* short pkt trans. */ +#define NET2280_EP_IRQENB_DPR 0x00000008 /* data pkt recv'd */ +#define NET2280_EP_IRQENB_DPT 0x00000004 /* data pkt trans. */ +#define NET2280_EP_IRQENB_DOPT 0x00000002 /* data out/ping token*/ +#define NET2280_EP_IRQENB_DIT 0x00000001 /* data in token */ +#define NET2280_EP_IRQENB_DEFAULT (NET2280_EP_IRQENB_SPOD | \ + NET2280_EP_IRQENB_SPT | \ + NET2280_EP_IRQENB_DPR | \ + NET2280_EP_IRQENB_DPT | \ + NET2280_EP_IRQENB_DOPT | \ + NET2280_EP_IRQENB_DIT) +#define NET2280_EP_IRQEBN_MASK 0x7F + +/* NET 2280 endpoints */ + +#define NET2280_NUM_ENDPOINTS 8 /* 6 generic endpoint */ + /* 2 control endpoint */ + /* should be reported */ + /* to HAL */ +/* NET 2280 DMA channels */ + +#define NET2280_DMA_CHANS 4 + +#define NET2280_DMA_ENPT_MASK 0xF + +/* FIFO Configurations */ + +#define NET2280_FIFOCTL_CFG0 0 /* configuration 0 */ +#define NET2280_FIFOCTL_CFG1 1 /* configuration 1 */ +#define NET2280_FIFOCTL_CFG2 2 /* configuration 2 */ + +#define NET2280_FIFOCTL_CFG_MASK 0x03 /* Fifo config mask */ + +/* Maximum Packet Size */ +#define NET2280_MAXPSIZE_8 0x0008 +#define NET2280_MAXPSIZE_16 0x0010 +#define NET2280_MAXPSIZE_32 0x0020 +#define NET2280_MAXPSIZE_64 0x0040 +#define NET2280_MAXPSIZE_128 0x0080 +#define NET2280_MAXPSIZE_256 0x0100 +#define NET2280_MAXPSIZE_512 0x0200 +#define NET2280_MAXPSIZE_1024 0x0400 + +/* Definitions for number of transactions per frame */ +#define NET2280_NTRANS_1 0x0 /* 1 packet per microframe */ +#define NET2280_NTRANS_2 0x1 /* 2 packets per microframe */ +#define NET2280_NTRANS_3 0x2 /* 3 packet per microframe */ +#define NET2280_NTRANS_SHIFT 11 + +/* Device product / vendor information */ +#define NET2280_PRODVENDID_PROD_MASK 0xFFFF0000 +#define NET2280_PROD_ID 0x2280 +#define NET2280_PRODID_SHIFT 16 + +/* Macros for reading from and writing to the net2280 registers */ + + +#define NET2280_CFG_READ(pTarget,offset) \ + TO_LITTLEL(*(UINT32 *)(pTarget->ioBase[0] + offset)) + +#define NET2280_8051_READ(pTarget,offset) \ + TO_LITTLEL(*(UINT32 *)(pTarget->ioBase[1] + offset)) + +#define NET2280_FIFO_READ(pTarget,offset) \ + TO_LITTLEL(*(UINT32 *)(pTarget->ioBase[2] + offset)) + +#define NET2280_CFG_WRITE(pTarget,offset,value) \ + (*(UINT32 *)(pTarget->ioBase[0] + offset) = FROM_LITTLEL(value)) + +#define NET2280_8051_WRITE(pTarget,offset, value) \ + (*(UINT32 *)(pTarget->ioBase[1] + offset) = FROM_LITTLEL(value)) + +#define NET2280_FIFO_WRITE(pTarget,offset,value) \ + (*(UINT32 *)(pTarget->ioBase[2] + offset) = FROM_LITTLEL(value)) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbNet2280h */ diff --git a/h/drv/usb/target/usbNET2280Tcd.h b/h/drv/usb/target/usbNET2280Tcd.h new file mode 100644 index 0000000..d032c28 --- /dev/null +++ b/h/drv/usb/target/usbNET2280Tcd.h @@ -0,0 +1,118 @@ +/* usbNET2280Tcd.h - Definitions used by NET2280 TCD */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01g,30sep04,pdg DMA testing fix +01f,23sep04,pdg Fix for short packet handling +01e,22sep04,pdg Fix for setting the address +01d,21sep04,pdg Full speed testing fixes +01c,08sep04,ami Code Review Comments Incorporated +01b,03sep04,gpg incorporated the design changes +01a,30jun04,pmr adapted from usbisp1582Tcd.h, version 01b. +*/ + +/* +DESCRIPTION + +Defines structures used by NetChip NET2280 TCD. +*/ + + +#ifndef __INCusbNET2280Tcdh +#define __INCusbNET2280Tcdh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "usbTcdNET2280Lib.h" +#include "usbNET2280.h" + +/* defines */ + +#define USB_NET2280_TCD_ENDPOINT_BITMAP 0x007F007F + +/* Endpoint Direction */ + +#define USB_TCD_ENDPT_OUT 0 /* direction -OUT */ +#define USB_TCD_ENDPT_IN 1 /* direction - IN */ + +/* typedefs */ + +/* + * USB_TCD_NET2280_TARGET is a structure maintained by the net2280 TCD + * for holding information required for the net2280 Target controller + * operation. + */ + +typedef struct usbTcdNET2280Target + { + UINT32 ioBase[NET2280_NO_OF_PCI_BADDR]; /* IO base array */ + UINT8 irq; /* IRQ value */ + USB_HAL_ISR_CALLBACK usbHalIsr; /* HAL ISR pointer */ + pVOID usbHalIsrParam; /* HAL ISR parameter */ + UINT8 endpointIndexInUse; /* bitmap for endpoint usage */ + UINT8 endptIntPending; /* + * bitmap for endpoint + * interrupts. + */ + BOOL setupIntPending; /* + * flag indicating a + * setup interrupt. + */ + UINT8 speed; /* TC operational speed */ + UINT8 dmaEot; /* + * bitmap + * for dma EOTs on endpoints + */ + BOOL statusINPending; /* + * Flag indicating that + * status IN is pending + */ + BOOL statusOUTPending; /* + * Flag indicating that + * status OUT is pending + */ + + UINT32 addressTobeSet; /* + * Value to be written to + * OURADDR register. + */ + + } USB_TCD_NET2280_TARGET, *pUSB_TCD_NET2280_TARGET; + +/* + * USB_TCD_NET2280_ENDPOINT is a structure maintained by the net2280 TCD + * for holding information required about an endpoint + */ + +typedef struct usbTcdNET2280Endpoint + { + UINT8 endpointIndex; /* endpoint index */ + UINT8 transferType; /* transfer type */ + UINT8 direction; /* direction of the endpoint */ + UINT16 maxPacketSize; /* Maximum packet size for the endpoint */ + UINT32 dataLength; /* Available data in FIFO */ + +#ifdef NET2280_DMA_SUPPORTED + UINT16 dmaTransferLength;/* DMA transfer length */ + BOOL isDmaSupported; /* Flag indicating dma support */ + BOOL dmaInUse; /* Flag indicating the dma usage */ + UCHAR * dmaBuffer; /* Buffer for DMA */ + BOOL shortPacket; /* Flag indicating a short packet */ + +#endif + + } USB_TCD_NET2280_ENDPOINT, *pUSB_TCD_NET2280_ENDPOINT; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbNET2280Tcdh */ + diff --git a/h/drv/usb/target/usbPdiusbd12.h b/h/drv/usb/target/usbPdiusbd12.h new file mode 100644 index 0000000..3182f6f --- /dev/null +++ b/h/drv/usb/target/usbPdiusbd12.h @@ -0,0 +1,230 @@ +/* usbPdiusbd12.h - Definitions for Philips PDIUSBD12 USB target controller */ + +/* Copyright 1999-2004 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01d,02aug04,mta Modification History Changes +01c,19jul04,ami Coding Convnetion Changes +01b,15mar04,mta catagorized existing macros +01a,05aug99,rcb First. +*/ + +/* +DESCRIPTION + +Defines constants related to the Philips PDIUSBD12 USB device (target) IC. +*/ + +#ifndef __INCusbPdiusbd12h +#define __INCusbPdiusbd12h + +#ifdef __cplusplus +extern "C" { +#endif + + +/* defines */ + +/* PDIUSBD12 signature (read through Read Chip Id command) + * + * NOTE: The value of the signature has been determined empirically. The + * official data sheet for the PDIUSBD12 does not discuss the Read Chip ID + * command, but sample code from Philips reveals the existence of the + * command. + */ + +#define D12_CHIP_ID_MASK 0xffff /* Chip ID Mask */ +#define D12_CHIP_ID 0x1012 /* Chip ID */ + + +/* PDIUSBD12 I/O registers */ + +#define D12_DATA_REG 0 /* data register (r/w) */ +#define D12_CMD_REG 1 /* command register (write only) */ + + +/* PDIUSBD12 endpoints */ + +#define D12_NUM_ENDPOINTS 6 /* number of endpoints */ + +/* PDIUSBD12 endpoint numbers */ + +#define D12_ENDPOINT_NO_0 0 /* Endpoint Number 0 */ +#define D12_ENDPOINT_NO_1 1 /* Endpoint Number 1 */ +#define D12_ENDPOINT_NO_2 2 /* Endpoint Number 2 */ + + +/* PDIUSBD12 endpoint indexes */ + +#define D12_ENDPOINT_CONTROL_OUT 0 /* control OUT endpoint */ +#define D12_ENDPOINT_CONTROL_IN 1 /* control IN endpoint */ +#define D12_ENDPOINT_1_OUT 2 /* endpoint 1 OUT */ +#define D12_ENDPOINT_1_IN 3 /* endpoint 1 IN */ +#define D12_ENDPOINT_2_OUT 4 /* endpoint 2 OUT */ +#define D12_ENDPOINT_2_IN 5 /* endpoint 2 IN */ + + +/* max endpoint packet lengths */ + +#define D12_MAX_PKT_CONTROL 16 /* Control Packet Size */ +#define D12_MAX_PKT_ENDPOINT_1 16 /* Endpoint 1 Packet Size */ +#define D12_MAX_PKT_ENDPOINT_2_NON_ISO 64 /* mode 0 */ +#define D12_MAX_PKT_ENDPOINT_2_ISO_OUT 128 /* mode 1 */ +#define D12_MAX_PKT_ENDPOINT_2_ISO_IN 128 /* mode 2 */ +#define D12_MAX_PKT_ENDPOINT_2_ISO_IO 64 /* mode 3 */ + + +/* PDIUSBD12 commands */ + +/* initialization commands */ +#define D12_CMD_SET_ADDRESS 0xd0 /* write 1 byte */ +#define D12_CMD_SET_ENDPOINT_ENABLE 0xd8 /* write 1 byte */ +#define D12_CMD_SET_MODE 0xf3 /* write 2 bytes */ +#define D12_CMD_SET_DMA 0xfb /* write/read 1 byte */ + +/* data flow commands */ + +#define D12_CMD_READ_INTERRUPT_REG 0xf4 /* read 2 bytes */ +#define D12_CMD_READ_BUFFER 0xf0 /* read n bytes */ +#define D12_CMD_WRITE_BUFFER 0xf0 /* write n bytes */ +#define D12_CMD_ACK_SETUP 0xf1 /* none */ +#define D12_CMD_CLEAR_BUFFER 0xf2 /* none */ +#define D12_CMD_VALIDATE_BUFFER 0xfa /* none */ + +/* general commands */ + +#define D12_CMD_SEND_RESUME 0xf6 /* none */ +#define D12_CMD_READ_CURRENT_FRAME_NO 0xf5 /* read 1 or 2 bytes */ +#define D12_CMD_READ_CHIP_ID 0xfd /* read 2 bytes */ + +/* following cmds must be OR'd with endpoint selector: D12_ENDPOINT_xxxx */ + + +#define D12_CMD_SELECT_ENDPOINT 0x00 /* read 1 byte (optional) */ +#define D12_CMD_READ_LAST_TRANS_STATUS 0x40 /* read 1 byte */ +#define D12_CMD_SET_ENDPOINT_STATUS 0x40 /* write 1 byte */ + + +/* set address command (write 1 byte) */ + +#define D12_CMD_SA_ADRS_MASK 0x7f /* address */ +#define D12_CMD_SA_ENABLE 0x80 /* enable */ + + +/* set endpoint enable command (write 1 byte) */ + +#define D12_CMD_SEE_ENABLE 0x01 /* generic/isoch endpt enable */ + + +/* set mode command (write 2 bytes) */ + +/* first byte... */ + +#define D12_CMD_SM_CFG_NO_LAZYCLOCK 0x02 /* no lazyclock */ +#define D12_CMD_SM_CFG_CLOCK_RUNNING 0x04 /* clock running */ +#define D12_CMD_SM_CFG_INTERRUPT_MODE 0x08 /* interrupt mode */ +#define D12_CMD_SM_CFG_SOFTCONNECT 0x10 /* SoftConnect */ + +#define D12_CMD_SM_CFG_MODE_MASK 0xc0 +#define D12_CMD_SM_CFG_MODE0_NON_ISO 0x00 /* mode 0, non-iso */ +#define D12_CMD_SM_CFG_MODE1_ISO_OUT 0x40 /* mode 1, iso-out */ +#define D12_CMD_SM_CFG_MODE2_ISO_IN 0x80 /* mode 2, iso-in */ +#define D12_CMD_SM_CFG_MODE3_ISO_IO 0xc0 /* mode 3, iso-io */ + +/* second byte... */ + +#define D12_CMD_SM_CLK_DIV_FACTOR_MASK 0x0f /* clock division factor */ +#define D12_CMD_SM_CLK_DIV_DEFAULT 0x0b /* default = 11 */ +#define D12_CMD_SM_CLK_SET_TO_ONE 0x40 /* bit must be set to 1 */ +#define D12_CMD_SM_CLK_SOF_ONLY_INTRPT 0x80 /* SOF-only interrupt */ + + +/* set dma command (read/write 1 byte) */ + +#define D12_CMD_SD_DMA_SINGLE_CYCLE 0x00 /* single cycle DMA */ +#define D12_CMD_SD_DMA_BURST_4 0x01 /* burst (4 cycle) DMA */ +#define D12_CMD_SD_DMA_BURST_8 0x02 /* burst (8 cycle) DMA */ +#define D12_CMD_SD_DMA_BURST_16 0x03 /* burst (16 cycle) DMA */ +#define D12_CMD_SD_DMA_ENABLE 0x04 /* dma enable */ +#define D12_CMD_SD_DMA_DIRECTION_MASK 0x08 /* mask for direction */ +#define D12_CMD_SD_DMA_DIRECTION_WRITE 0x08 /* '1' = dma write */ +#define D12_CMD_SD_DMA_DIRECTION_READ 0x00 /* '0' = dma read */ +#define D12_CMD_SD_AUTO_RELOAD 0x10 /* dma auto restart */ +#define D12_CMD_SD_SOF_INTRPT 0x20 /* enable SOF interrupt */ +#define D12_CMD_SD_ENDPT_2_OUT_INTRPT 0x40 /* intrpt when valid packet */ +#define D12_CMD_SD_ENDPT_2_IN_INTRPT 0x80 /* intrpt when valid packet */ + + +/* read interrupt register (read 2 bytes) */ + +/* first byte... */ + +#define D12_CMD_RIR_ENDPOINT_INT_MASK 0x003F /* Endpoint Int. Mask */ +#define D12_CMD_RIR_CONTROL_OUT 0x0001 /* control out endpoint */ +#define D12_CMD_RIR_CONTROL_IN 0x0002 /* control in endpoint */ +#define D12_CMD_RIR_ENDPOINT_1_OUT 0x0004 /* endpoint 1 OUT */ +#define D12_CMD_RIR_ENDPOINT_1_IN 0x0008 /* endpoint 1 IN */ +#define D12_CMD_RIR_ENDPOINT_2_OUT 0x0010 /*endpoint 2 OUT (main OUT)*/ +#define D12_CMD_RIR_ENDPOINT_2_IN 0x0020 /* endpoint 2 IN (main IN) */ +#define D12_CMD_RIR_BUS_RESET 0x0040 /* bus reset */ +#define D12_CMD_RIR_SUSPEND 0x0080 /* suspend change */ + +/* second byte... */ + +#define D12_CMD_RIR_DMA_EOT 0x0100 /* DMA EOT */ + + +/* select endpoint command (optional read 1 byte) */ + +#define D12_CMD_SE_FULL_EMPTY 0x01 /* '1' = bfr full, '0' = empty */ +#define D12_CMD_SE_STALL 0x02 /* '1' = endpoint stall */ + + +/* read last transaction status command (read 1 byte) */ + +#define D12_CMD_RLTS_DATA_SUCCESS 0x01 /* xmit/rcv data success */ +#define D12_CMD_RLTS_SETUP_PACKET 0x20 /* Setup packet */ +#define D12_CMD_RLTS_DATA1 0x40 /* DATA0/DATA1 indicator */ +#define D12_CMD_RLTS_STATUS_SKIPPED 0x80 /* previous status not read */ + +#define D12_CMD_RLTS_ERROR_CODE_MASK 0x1e /* error code */ +#define D12_CMD_RLTS_ERROR_CODE_SHIFT 1 + +#define D12_CMD_RLTS_ERROR_CODE(b) \ + (((b) & D12_CMD_RLTS_ERROR_CODE_MASK) >> D12_CMD_RLTS_ERROR_CODE_SHIFT) + +#define D12_CMD_RLTS_ERROR_NONE 0x0 /* no error */ +#define D12_CMD_RLTS_ERROR_PID_ENCODE 0x1 /* PID encoding error */ +#define D12_CMD_RLTS_ERROR_PID_UNKNOWN 0x2 /* unknown PID */ +#define D12_CMD_RLTS_ERROR_EXPECTED_PKT 0x3 /* unexpected packet */ +#define D12_CMD_RLTS_ERROR_TOKEN_CRC 0x4 /* token CRC error */ +#define D12_CMD_RLTS_ERROR_DATA_CRC 0x5 /* data CRC error */ +#define D12_CMD_RLTS_ERROR_TIME_OUT 0x6 /* time out error */ +#define D12_CMD_RLTS_ERROR_END_OF_PKT 0x8 /* unexpected end of packet */ +#define D12_CMD_RLTS_ERROR_NAK 0x9 /* sent or received NAK */ +#define D12_CMD_RLTS_ERROR_STALL 0xa /* sent stall */ +#define D12_CMD_RLTS_ERROR_OVERFLOW 0xb /* packet too long for bfr */ +#define D12_CMD_RLTS_ERROR_BITSTUFF 0xd /* bitstuff error */ +#define D12_CMD_RLTS_ERROR_DATA_TOGGLE 0xf /* wrong data toggle */ + + +/* set endpoint status command (write 1 byte) */ + +#define D12_CMD_SES_STALLED 0x01 /* stalled */ +#define D12_CMD_SES_UNSTALLED 0x00 /* unstalled */ + +/* read current frame number command (read 1 or 2 bytes) */ + +/* LSB is in first byte (8 bits) , MSB is in second byte (3 bits). + * 11 bits total. */ + +#define D12_CMD_RCFN_MSB_MASK 0x07 /* mask for MSB */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbPdiusbd12h */ diff --git a/h/drv/usb/target/usbPdiusbd12Debug.h b/h/drv/usb/target/usbPdiusbd12Debug.h new file mode 100644 index 0000000..5aab5c7 --- /dev/null +++ b/h/drv/usb/target/usbPdiusbd12Debug.h @@ -0,0 +1,52 @@ +/* usbPdiusbd12Debug.h - Defines the debug macros used by the PDIUSBD12 sub-modules */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01d,26oct04,ami Debug Messages Changes +01c,06oct04,ami SPR #94684 Fix +01b,19jul04,ami Coding Convention Changes +01a,18mar04,ami First. +*/ + +/* +DESCRIPTION + +Defines the debug macros which are used by the usbPdiusbd12 sub-modules + +*/ +#ifndef __INCusbPdiusbd12Debugh +#define __INCusbPdiusbd12Debugh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include + +extern void usbPeriLogMsg (char *,int,int,int,int,int,int); + +/* defines */ + +#define USBPDIUSBD12_DEBUG_MSG 0x01 /* For Debuging Macros */ +#define USBPDIUSBD12_DEBUG_ERR 0x02 /* For Error Macros */ + +#define USBPDIUSBD12_DEBUG \ + if (usbPdiusbd12Debug & USBPDIUSBD12_DEBUG_MSG) \ + usbPeriLogMsg /* debugging Macros */ + +#define USBPDIUSBD12_ERROR \ + if (usbPdiusbd12Debug & USBPDIUSBD12_DEBUG_ERR) \ + usbPeriLogMsg /* error Macros */ + +extern UINT32 usbPdiusbd12Debug; /* Define the debugging flag */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbPdiusbd12Debugh */ diff --git a/h/drv/usb/target/usbPdiusbd12Eval.h b/h/drv/usb/target/usbPdiusbd12Eval.h new file mode 100644 index 0000000..9be2281 --- /dev/null +++ b/h/drv/usb/target/usbPdiusbd12Eval.h @@ -0,0 +1,110 @@ +/* usbPdiusbd12Eval.h - Definitions for Philips PDIUSBD12 eval board */ + +/* Copyright 1999-2004 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01d,02aug04,mta Modification History Changes +01c,19jul04,ami Coding Convention Changes +01b,15mar04,mta defined structures for target and endpoint +01a,05aug99,rcb First. +*/ + +/* +DESCRIPTION + +Defines constants related to the Philips PDIUSBD12 evaluation board. +*/ + +#ifndef __INCusbPdiusbd12Evalh +#define __INCusbPdiusbd12Evalh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "drv/usb/target/usbPdiusbd12.h" /* Philips PDIUSBD12 defn */ +#include "usb/target/usbIsaLib.h" /* ISA bus functions */ + + + +/* defines */ + +#define EVAL_DEBUG /* For evaluation kit */ + +/* evaluation board I/O address offsets */ + +#define D12EVAL_D12REG 0 /* base of PDIUSBD12 registers */ +#define D12EVAL_GIN_REG 2 /* general input register */ +#define D12EVAL_GOUT_REG 3 /* general output register */ + + +/* default settings for I/O, IRQ, DMA */ + +#define D12EVAL_DEFAULT_IOBASE 0x368 /* default base I/O address */ +#define D12EVAL_DEFAULT_IRQ 7 /* default IRQ channel */ +#define D12EVAL_DEFAULT_DMA 3 /* default DMA channel */ + + +/* general input port */ + +#define D12EVAL_GIN_S1 0x01 /* key S1, '0' for pressed */ +#define D12EVAL_GIN_S2 0x02 /* key S2, '0' for pressed */ +#define D12EVAL_GIN_S3 0x04 /* key S3, '0' for pressed */ +#define D12EVAL_GIN_S4 0x08 /* key S4, '0' for pressed */ +#define D12EVAL_GIN_GOODLINK 0x10 /* D12 GoodLink pin state */ +#define D12EVAL_BUS_POWER 0x20 /* USB bus power state */ + /* '1' for USB VBUS present */ +#define D12EVAL_SUSPEND 0x40 /* D12 SUSPEND pin state */ +#define D12EVAL_INTN 0x80 /* D12 INT_N pin state */ + + +/* general output port */ + +#define D12EVAL_GOUT_LED_D2 0x01 /* LED D2, '1' lights up LED */ +#define D12EVAL_GOUT_LED_D3 0x02 /* LED D3, '1' lights up LED */ +#define D12EVAL_GOUT_LED_D4 0x04 /* LED D4, '1' lights up LED */ +#define D12EVAL_GOUT_LED_D5 0x08 /* LED D5, '1' lights up LED */ +#define D12EVAL_GOUT_SUSPEND 0x40 /* suspend control */ + /* '1' forces D12 SUSPEND low */ +#define D12EVAL_GOUT_INTENB 0x80 /* interrupt enable */ + /* '1' enables interrupt */ + +/* LEDs on PDIUSBD12 evaluation board used for debugging. */ + +#define ATTACH_LED D12EVAL_GOUT_LED_D2 /* Attach LED */ +#define ENABLE_LED D12EVAL_GOUT_LED_D3 /* Enable LED */ +#define INT_THREAD_LED D12EVAL_GOUT_LED_D4 /* Interupt LED */ + +/* macros used to read/write PDIUSBD12 registers */ + +#define OUT_D12_CMD(pTarget,b) \ + USB_ISA_BYTE_OUT (pTarget->ioBase + D12EVAL_D12REG + D12_CMD_REG, (b)) + /* Macro to write Command byte */ + +#define OUT_D12_DATA(pTarget,b) \ + USB_ISA_BYTE_OUT (pTarget->ioBase + D12EVAL_D12REG + D12_DATA_REG, (b)) + /* Macro to write Data byte */ + +#define IN_D12_DATA(pTarget) \ + USB_ISA_BYTE_IN (pTarget->ioBase + D12EVAL_D12REG + D12_DATA_REG) + /* Macro to read Data Byte */ + +/* macros used to read/write PDIUSBD12 eval general IN/OUT registers */ + +#define OUT_EVAL_GOUT(pTarget,b) \ + USB_ISA_BYTE_OUT (pTarget->ioBase + D12EVAL_GOUT_REG, (b)) + /* Macro to write into eval kit register */ + +#define IN_EVAL_GIN(pTarget) \ + USB_ISA_BYTE_IN (pTarget->ioBase + D12EVAL_GIN_REG) + /* Macro to read from eval kit register */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbPdiusbd12Evalh */ diff --git a/h/drv/usb/target/usbPdiusbd12Tcd.h b/h/drv/usb/target/usbPdiusbd12Tcd.h new file mode 100644 index 0000000..91114e5 --- /dev/null +++ b/h/drv/usb/target/usbPdiusbd12Tcd.h @@ -0,0 +1,94 @@ +/* usbPdiusbd12Tcd.h - Definitions used by PDIUSBD12 TCD */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01c,02aug04,mta Modification History Changes +01b,19jul04,ami Coding Convention Changes +01a,15mar04,mta First. +*/ + +/* +DESCRIPTION + +Defines structures used by Philips PDIUSBD12 TCD. +*/ + + +#ifndef __INCusbPdiusbd12Tcdh +#define __INCusbPdiusbd12Tcdh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "usb/target/usbTcd.h" /* generic TCD interface */ + +/* defines */ + +/* Bitmap for IN and OUT Endpoints Supported */ + +#define USB_PDIUSBD12_TCD_OUT_ENDPOINT 0x00000007 /* bitmap for Out endpoint */ +#define USB_PDIUSBD12_TCD_IN_ENDPOINT 0x00070000 /* bitmap for In endpoint */ + +extern UINT32 usbPdiusbd12Debug; +/* typedefs */ + +/* USB_TCD_PDIUSBD12_TARGET + * + * USB_TCD_PDIUSBD12_TARGET is the primary data structure created to manage + * an individual target controller. + */ + + +typedef struct usbTcdPdiusbd12Target /* USB_TCD_PDIUSBD12_TARGET */ + { + + UINT32 ioBase; /* base Address */ + UINT16 irq; /* irq Number */ + UINT16 dma; /* dma Channel */ + USB_HAL_ISR_CALLBACK usbHalIsr; /* hal Isr */ + pVOID usbHalIsrParam; /* isr Parameter */ + UINT8 goutByte; /* gout byte */ + UINT8 configByte; /* configuration byte */ + UINT8 clkDivByte; /* clock division byte */ + UINT8 dmaByte; /* dma byte */ + UINT16 epMainCount; /* main endpoint count */ + UINT8 epMainGenericCount; /* generic count */ + UINT16 epOneAndTwoCount; /* endpoint 1 & 2 Count */ + BOOL dmaInUse; /* dma inuse or not */ + UINT16 dmaEndpointId; /* dma endpoint id */ + BOOL dmaEot; /* dma end of transfer */ + UINT8 endpointIndexInUse; /* endpoint indexes in use */ + UINT8 deviceAddress; /* device address */ + UINT8 endptIntPending;/* pending endpoint interrutps */ + UINT8 uLastTransactionStatus[D12_NUM_ENDPOINTS]; + /* last transaction in endpoint */ + BOOL setupErpPending;/* setup ERP is pending */ + +#ifdef PDIUSBD12_POLLING + THREAD_HANDLE threadId; /* polling thread handler */ +#endif + + } USB_TCD_PDIUSBD12_TARGET, *pUSB_TCD_PDIUSBD12_TARGET; + + +typedef struct usbTcdPdiusbd12Endpoint /* USB_TCD_PDIUSBD12_ENDPOINT */ + { + UINT8 endpointNo; /* endpoint Number */ + UINT8 endpointIndex; /* endpoint index */ + UINT16 dmaXfrLen; /* dma transfer length */ + UINT16 transferType; /* transfer type */ + UINT8 direction; /* direction */ + UINT16 maxPacketSize; /* max packet size */ + } USB_TCD_PDIUSBD12_ENDPOINT, *pUSB_TCD_PDIUSBD12_ENDPOINT; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbPdiusbd12Tcdh */ diff --git a/h/drv/usb/target/usbTargKbdLib.h b/h/drv/usb/target/usbTargKbdLib.h new file mode 100644 index 0000000..50aa2f0 --- /dev/null +++ b/h/drv/usb/target/usbTargKbdLib.h @@ -0,0 +1,34 @@ +/* usbTargKbdLib.h - Defines exported interface from usbTargKbdLib */ + +/* Copyright 1999-2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01b,19jul04,ami Coding Convention Changes +01a,18aug99,rcb First. +*/ + +#ifndef __INCusbTargKbdLibh +#define __INCusbTargKbdLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* function declaration */ + +extern VOID usbTargKbdCallbackInfo (struct usbTargCallbackTable ** ppCallbacks, + pVOID *pCallbackParam); + + +extern STATUS usbTargKbdInjectReport (pHID_KBD_BOOT_REPORT pReport, + UINT16 reportLen); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbTargKbdLibh */ diff --git a/h/drv/usb/target/usbTargMsLib.h b/h/drv/usb/target/usbTargMsLib.h new file mode 100644 index 0000000..002b2df --- /dev/null +++ b/h/drv/usb/target/usbTargMsLib.h @@ -0,0 +1,78 @@ +/* usbTargMsLib.h - Defines for USB mass storage driver */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,23jul04,ami Coding Convention Changes +01c,21jul04,pdg Changed IRP_CALLBACK to ERP_CALLBACK +01b,19jul04,hch created the file element +01a,15mar04,jac written. +*/ + +/* +DESCRIPTION + +Defines the USB mass storage driver interface to the USB target controller +driver (TCD). + +*/ + +#ifndef _USBTARGMSLIB_H +#define _USBTARGMSLIB_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define USB_DEBUG_PRINT + +#define USE_SCSI_SUBCLASS /* SCSI Protocol */ + +#ifdef USE_SCSI_SUBCLASS +#undef USE_RBC_SUBCLASS +#else +#define USE_RBC_SUBCLASS /* RBC Protocol */ +#endif + +#ifdef USB_DEBUG_PRINT + void usbDbgPrint(char *fmt, ...); /* Debug messages */ +#else + #define usbDbgPrint +#endif + + +/* function declaration */ + +extern USB_BULK_CBW *usbMsCBWGet(void); +extern USB_BULK_CBW *usbMsCBWInit(void); +extern USB_BULK_CSW *usbMsCSWInit(void); +extern USB_BULK_CSW *usbMsCSWGet(void); + +extern STATUS usbMsBulkInStall(void); +extern STATUS usbMsBulkInUnStall(void); +extern STATUS usbMsBulkOutStall(void); +extern STATUS usbMsBulkOutUnStall(void); +extern BOOL usbMsIsConfigured(void); +extern BOOL usbMsBulkInErpInUseFlagGet(void); +extern BOOL usbMsBulkOutErpInUseFlagGet(void); +extern VOID usbMsBulkInErpInUseFlagSet(BOOL state); +extern VOID usbMsBulkOutErpInUseFlagSet(BOOL state); + +extern VOID usbTargMsCallbackInfo (struct usbTargCallbackTable ** ppCallbacks, + VOID ** pCallbackParam); + +extern STATUS usbMsBulkInErpInit (UINT8 * pData, UINT32 size, + ERP_CALLBACK erpCallback, pVOID usrPtr); + +extern STATUS usbMsBulkOutErpInit (UINT8 * pData, UINT32 size, + ERP_CALLBACK erpCallback,pVOID usrPtr); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/drv/usb/target/usbTargPhilipsD12EvalLib.h b/h/drv/usb/target/usbTargPhilipsD12EvalLib.h new file mode 100644 index 0000000..929d8c7 --- /dev/null +++ b/h/drv/usb/target/usbTargPhilipsD12EvalLib.h @@ -0,0 +1,36 @@ +/* usbTargPhilipsD12EvalLib.h - Defines usbTargPhilipsD12EvalLib interface */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01a,03sep99,rcb First. +*/ + +#ifndef __INCusbTargPhilipsD12EvalLibh +#define __INCusbTargPhilipsD12EvalLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* function prototypes */ + +VOID usbTargPhilipsD12EvalCallbackInfo + ( + pUSB_TARG_CALLBACK_TABLE *ppCallbacks, + pVOID *pCallbackParam + ); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbTargPhilipsD12EvalLibh */ + + +/* End of file. */ + diff --git a/h/drv/usb/target/usbTargPrnLib.h b/h/drv/usb/target/usbTargPrnLib.h new file mode 100644 index 0000000..1bb161a --- /dev/null +++ b/h/drv/usb/target/usbTargPrnLib.h @@ -0,0 +1,33 @@ +/* usbTargPrnLib.h - Defines exported interface from usbTargPrnLib */ + +/* Copyright 1999-2004 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01b,19jul04,ami Coding Convention Changes +01a,18aug99,rcb First. +*/ + +#ifndef __INCusbTargPrnLibh +#define __INCusbTargPrnLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* function declaration */ + +extern VOID usbTargPrnCallbackInfo (pUSB_TARG_CALLBACK_TABLE *ppCallbacks, + pVOID *pCallbackParam); + +extern STATUS usbTargPrnDataInfo (pUINT8 *ppBfr, pUINT16 pActLen); + +extern STATUS usbTargPrnDataRestart (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbTargPrnLibh */ diff --git a/h/drv/usb/target/usbTargRbcCmd.h b/h/drv/usb/target/usbTargRbcCmd.h new file mode 100644 index 0000000..a95a07c --- /dev/null +++ b/h/drv/usb/target/usbTargRbcCmd.h @@ -0,0 +1,299 @@ +/* usbTargRbcCmd.h - Mass Storage RBC command library header*/ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,23jul04,ami Coding Convention Changes +01b,19jul04,hch created the file element +01a,15mar04,jac written. +*/ + +#ifndef _WRS_TARG_RBC_CMD_H_ +#define _WRS_TARG_RBC_CMD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#if (defined(BYTES_PER_BLOCK) || defined(BLKS_PER_TRACK) || defined(BLK_OFFSET)) +#error previous definition of BYTES_PER_BLOCK, BLKS_PER_TRACK, & BLK_OFFSET +#endif + + +#ifndef BYTES_PER_BLOCK + #define BYTES_PER_BLOCK 512 /* user configuration parameter */ +#endif + +#ifndef BLKS_PER_TRACK + #define BLKS_PER_TRACK 16 /* user configuration parameter */ +#endif + +#ifndef NUM_BLOCKS + #define NUM_BLOCKS BLKS_PER_TRACK * 4 /* number of blocks */ +#endif + +#ifndef BLK_OFFSET + #define BLK_OFFSET 0 /* user configuration parameter */ +#endif + +#define DEVICE_ID_LGTH 8 /* device id length */ +#define DEVICE_ID 'V','x','W','o','r','k','s',':' /* device id */ + +#define USB_MS_CBIO_DRV 0 /* CBIO DRIVE */ +#define USB_MS_RAM_DRV 1 /* RAM DRIVE */ +#define USB_MS_BLK_DRV USB_MS_CBIO_DRV + + +/* SCSI Sense codes */ + +#define SCSI_SENSE_NO_SENSE 0x00 /* no specific sense key info */ + /* no error */ +#define SCSI_SENSE_RECOVERED_ERROR 0x01 /* last command completed with */ + /* some recovery action by UFI */ +#define SCSI_SENSE_NOT_READY 0x02 /* UFI device can't be accessed */ +#define SCSI_SENSE_MEDIUM_ERROR 0x03 /* flaw in the mediaum */ +#define SCSI_SENSE_HARDWARE_ERROR 0x04 /* non-recoverable hardware failure */ +#define SCSI_SENSE_ILLEGAL_REQUEST 0x05 /* illegal paramter in command */ +#define SCSI_SENSE_UNIT_ATTENTION 0x06 /* removeable media may have been */ + /* changed or UFI device reset */ +#define SCSI_SENSE_DATA_PROTECT 0x07 /* write protected media */ +#define SCSI_SENSE_BLANK_CHECK 0x08 /* device encountered a blank */ + /* medium while reading or non-blank*/ + /* medium while writing */ +#define SCSI_SENSE_UNIQUE 0x09 /* vendor specific conditions */ +#define SCSI_SENSE_COPY_ABORTED 0x0A /* copy aborted */ +#define SCSI_SENSE_ABORTED_COMMAND 0x0B /* UFI device aborted the command */ +#define SCSI_SENSE_EQUAL 0x0C +#define SCSI_SENSE_VOL_OVERFLOW 0x0D /* buffer overflow */ +#define SCSI_SENSE_MISCOMPARE 0x0E /* data mismatch occured */ +#define SCSI_SENSE_RESERVED 0x0F /* reserved */ + +/* Additional Sense codes (ASC) */ + +#define SCSI_ADSENSE_NO_SENSE 0x00 /* no sense key- no error */ +#define SCSI_ADSENSE_LUN_NOT_READY 0x04 /* logical drive not ready */ +#define SCSI_ADSENSE_ILLEGAL_COMMAND 0x20 /* illegal command */ +#define SCSI_ADSENSE_ILLEGAL_BLOCK 0x21 /* block address out of range */ +#define SCSI_ADSENSE_INVALID_PARAMETER 0x26 /* paramter value invalid */ +#define SCSI_ADSENSE_INVALID_LUN 0x25 /* logical unit not supported */ +#define SCSI_ADSENSE_INVALID_CDB 0x24 /* invalid command packet */ +#define SCSI_ADSENSE_MUSIC_AREA 0xA0 /* additional sense code */ +#define SCSI_ADSENSE_DATA_AREA 0xA1 /* additional sense code */ +#define SCSI_ADSENSE_VOLUME_OVERFLOW 0xA7 /* volume overflow */ + +#define SCSI_ADSENSE_NO_MEDIA_IN_DEVICE 0x3A /* media not present */ +#define SCSI_ADSENSE_FORMAT_ERROR 0x31 /* format command failed */ +#define SCSI_ADSENSE_CMDSEQ_ERROR 0x2C /* command sequence error */ +#define SCSI_ADSENSE_MEDIUM_CHANGED 0x28 /* media changed */ +#define SCSI_ADSENSE_BUS_RESET 0x29 /* bus reset detected */ +#define SCSI_ADWRITE_PROTECT 0x27 /* write protected */ +#define SCSI_ADSENSE_TRACK_ERROR 0x14 /* recorded track not found */ +#define SCSI_ADSENSE_SAVE_ERROR 0x39 /* saving parameters not */ + /* supported */ +#define SCSI_ADSENSE_SEEK_ERROR 0x15 /* seek error */ +#define SCSI_ADSENSE_REC_DATA_NOECC 0x17 /* recoverd data with retries */ +#define SCSI_ADSENSE_REC_DATA_ECC 0x18 /* recovered data with ecc */ +#define SCSI_PARAMETER_LIST_LENGTH_ERROR 0x1A /* paramter list length error */ + +/* SCSI Additional sense code qualifier (ASCQ) */ + +#define SCSI_SENSEQ_FORMAT_IN_PROGRESS 0x04 /*format in progress*/ + /* LUN not supported */ +#define SCSI_SENSEQ_INIT_COMMAND_REQUIRED 0x02 /* initialization */ + /* required */ +#define SCSI_SENSEQ_MANUAL_INTERVENTION_REQUIRED 0x03 /*manual intervention*/ +#define SCSI_SENSEQ_BECOMING_READY 0x01 /* becoming ready */ +#define SCSI_SENSEQ_FILEMARK_DETECTED 0x01 /*file mark detected*/ +#define SCSI_SENSEQ_SETMARK_DETECTED 0x03 /* set mark detected*/ +#define SCSI_SENSEQ_END_OF_MEDIA_DETECTED 0x02 /* end of media */ +#define SCSI_SENSEQ_BEGINNING_OF_MEDIA_DETECTED 0x04 /* start of media */ +#define SCSI_SENSEQ_ILLEGAL_POWER_CONDITION_REQUEST 0x05 /* bad power */ + /* conditions*/ +/* typedefs */ + +typedef struct stdInquiryData /* STD_INQUIRY_DATA */ + { + UINT8 devQualType; /* peripheral device type */ + UINT8 RemovableMedia; /* removeable media bit */ + UINT8 version; /* 0x0 The device does not claim */ + /* conformance to any standard. */ + UINT8 byte3; /* response data format in lower 4 bits */ + /* upper 4 bits reserved */ + UINT8 additionalLgth; /* length of parameters in bytes */ + UINT8 sccs; + UINT8 byte6; /* reserved */ + UINT8 byte7; /* reserved */ + UINT8 vendorId[8]; /* vendor indentification */ + UINT8 productId[16]; /* producat indentification */ + UINT8 productRevLevel[4]; /* product revision data */ + /* 36 bytes is the minimum required */ + UINT8 vendorSpecific[20]; /* vendor specific info */ + UINT8 byte56; /* Reserved */ + UINT8 reserved1; /* reserved - 1 */ + UINT16 versionDescriptor[8]; /* version descripttion */ + UINT8 reserved2[22]; /* reservered - 2 */ + } WRS_PACK_ALIGN(1) STD_INQUIRY_DATA, *pSTD_INQUIRY_DATA; + + +typedef struct vpdSupportedPage /* VPD_SUPPORTED_PAGE */ + { + UINT8 devQualType; /* peripheral device type */ + UINT8 pageCode; /* page code */ + UINT8 reserved; /* reserved */ + UINT8 pageLgth; /* page length */ + UINT8 page_0; + UINT8 page_80; + UINT8 page_83; + }WRS_PACK_ALIGN(1) VPD_SUPPORTED_PAGE, *pVPD_SUPPORTED_PAGE; + +typedef struct commandData /* COMMAND_DATA */ + { + UINT8 devQualType; /* peripheral device type */ + UINT8 support; /* future support */ + UINT8 reserved[2]; /* reserved */ + UINT8 cdbSize; /* command block size */ + UINT8 cdbOpCode; /* operation opcode */ + UINT8 cdbUsageMap; /* command usage map */ + } WRS_PACK_ALIGN(1) COMMAND_DATA, *pCOMMAND_DATA; + +typedef struct vpdDeviceIdDescriptor /* VPD_DEVICE_ID_DESCRIPTOR */ + { + UINT8 codeSet; + UINT8 assocIdType; + UINT8 reserved; /* reserved */ + UINT8 idLgth; /* device id descriptor length */ + UINT8 devId[DEVICE_ID_LGTH]; /* device id */ + } WRS_PACK_ALIGN(1) VPD_DEVICE_ID_DESCRIPTOR, *pVPD_DEVICE_ID_DESCRIPTOR; + +typedef struct vpdDeviceIdPge /* VPD_DEVICE_ID_PAGE */ + { + UINT8 devQualType; /* peripheral device type */ + UINT8 pageCode; /* page code */ + UINT8 reserved; /* reserved */ + UINT8 pageLgth; /* page lenght */ + VPD_DEVICE_ID_DESCRIPTOR devIdDescr;/* device descriptor id */ + } WRS_PACK_ALIGN(1) VPD_DEVICE_ID_PAGE, *pVPD_DEVICE_ID_PAGE; + +typedef struct vpdUnitSerialNumPage /* VPD_UNIT_SERIAL_NUM_PAGE */ + { + UINT8 devQualType; /* peripheral device type */ + UINT8 pageCode; /* page code */ + UINT8 reserved; /* reserved */ + UINT8 pageLgth; /* page length */ + UINT8 serialNum[24]; /* serial number */ + } WRS_PACK_ALIGN(1) VPD_UNIT_SERIAL_NUM_PAGE, *pVPD_UNIT_SERIAL_NUM_PAGE; + +typedef struct modeParameterHeader /* MODE_PARAMETER_HEADER */ + { + UINT8 dataLen; /* mode data length */ + UINT8 mediumType; /* type of media */ + UINT8 deviceParameter; /* device paramter */ + UINT8 blockDescriptorLgth; /* block desc. length */ + } WRS_PACK_ALIGN(1) MODE_PARAMETER_HEADER, *pMODE_PARAMETER_HEAD; + +typedef struct modeParamterPage /* MODE_PARAMETER_PAGE */ + { + UINT8 pageCode; /* page code */ + UINT8 pageLth; /* page length */ + UINT8 writeCacheDisable; /* cache disabled for writes */ + UINT8 logicalBlockSize[2]; /* logical block size */ + UINT8 numberOfLogicalBlocks[5];/* number of logical blocks */ + UINT8 powerPerformance; /* power performance */ + UINT8 byte11; /* reserved */ + UINT8 reserved; + }WRS_PACK_ALIGN(1) MODE_PARAMETER_PAGE, *pMODE_PARAMETER_PAGE; + +typedef struct modeParametrList /* MODE_PARAMETER_LIST */ + { + MODE_PARAMETER_HEADER header; /* MODE_PARAMETER_HEADER */ + MODE_PARAMETER_PAGE params; /* MODE_PARAMETER_PAGE */ + } WRS_PACK_ALIGN(1) MODE_PARAMETER_LIST, *pMODE_PARAMETER_LIST; + +typedef struct senseData /* SENSE_DATA */ + { + UINT8 responseCode; /* request code */ + UINT8 obsolete; /* zero always */ + UINT8 senseKey; /* sense key - depends on command */ + UINT8 info[4]; /* info field - command specific */ + UINT8 additionalSenseLgth; /* additional data to follow */ + /* UFI device set this to 10 */ + UINT8 cmdSpecificInfo[4]; /* command specific info */ + UINT8 asc; /* additional sense code */ + UINT8 ascq; /* additional sense code qualifier */ + UINT8 fieldReplaceableUnitCode;/* optional field set to zero */ + UINT8 senseKeySpecific[3]; /* reserved for additiona data */ + } WRS_PACK_ALIGN(1) SENSE_DATA, *pSENSE_DATA; + +typedef struct capacityData /* CAPACITY_DATA */ + { + UINT8 lba_3; /* logical block address - byte 3 */ + UINT8 lba_2; /* logical block address - byte 2 */ + UINT8 lba_1; /* logical block address - byte 1 */ + UINT8 lba_0; /* logical block address - byte 0 */ + UINT8 blockLen_3; /* block length - byte 3 */ + UINT8 blockLen_2; /* block length - byte 2 */ + UINT8 blockLen_1; /* block length - byte 1 */ + UINT8 blockLen_0; /* block length - byte 0 */ + } WRS_PACK_ALIGN(1) CAPACITY_DATA, *pCAPACITY_DATA; + +/* function declaration */ + +extern pVOID usbTargRbcBlockDevGet (void); + +extern STATUS usbTargRbcBlockDevSet (pVOID *blkDev); + +extern STATUS usbTargRbcBlockDevCreate (void); + +extern STATUS usbTargRbcRead (UINT8 arg[10], UINT8 ** pData, UINT32 *size); + +extern STATUS usbTargRbcCapacityRead (UINT8 arg[10], + UINT8 ** pData,UINT32 *size); + +extern STATUS usbTargRbcStartStop (UINT8 arg[6]); + +extern STATUS usbTargRbcPreventAllowRemoval (UINT8 arg[6]); + +extern STATUS usbTargRbcVerify (UINT8 arg[10]); + +extern STATUS usbTargRbcWrite (UINT8 arg[10], UINT8 ** pData, UINT32 * size); + +extern STATUS usbTargRbcInquiry (UINT8 cmd[6], UINT8 ** pData, UINT32 * size); + +extern STATUS usbTargRbcModeSelect (UINT8 arg[6], UINT8 ** pData, UINT32 *size); + +extern STATUS usbTargRbcModeSense (UINT8 arg[6], UINT8 ** pData, UINT32 *size); + +extern STATUS usbTargRbcTestUnitReady (UINT8 arg[6]); + +extern STATUS usbTargRbcBufferWrite (UINT8 arg[10], UINT8 **pData, + UINT32 *size); + +extern STATUS usbTargRbcFormat (UINT8 arg[6]); + +extern STATUS usbTargRbcPersistentReserveIn (UINT8 arg[10], UINT8 ** pData, + UINT32 * size); + +extern STATUS usbTargRbcPersistentReserveOut (UINT8 arg[10], UINT8 ** pData, + UINT32 * size); + +extern STATUS usbTargRbcRelease (UINT8 arg[6]); + +extern STATUS usbTargRbcRequestSense (UINT8 arg[6], UINT8 ** pData, + UINT32 *size); + +extern STATUS usbTargRbcReserve (UINT8 arg[6]); + +extern STATUS usbTargRbcCacheSync (UINT8 arg[10]); + +extern STATUS usbTargRbcVendorSpecific (UINT8 arg[10], UINT8 **pData, + UINT32 *size); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/drv/usb/target/usbTargRbcLib.h b/h/drv/usb/target/usbTargRbcLib.h new file mode 100644 index 0000000..ebda9f4 --- /dev/null +++ b/h/drv/usb/target/usbTargRbcLib.h @@ -0,0 +1,33 @@ +/* usbTargRbcLib.h - Mass Storage RBC library header*/ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,23jul04,ami Coding Convention Changes +01b,19jul04,hch created the file element +01a,15mar04,jac written. +*/ + +#ifndef _USB_RBC_LIB_H +#define _USB_RBC_LIB_H + +#ifdef __cplusplus +extern "C" { +#endif + +extern VOID bulkOutErpCallbackCBW (pVOID erp); + +extern VOID bulkInErpCallbackCSW (pVOID erp); + +extern VOID bulkInErpCallbackData (pVOID erp); + +extern VOID bulkOutErpCallbackData (pVOID erp); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/h/drv/usb/target/usbTcd.h b/h/drv/usb/target/usbTcd.h new file mode 100644 index 0000000..ae32e70 --- /dev/null +++ b/h/drv/usb/target/usbTcd.h @@ -0,0 +1,344 @@ +/* usbTcd.h - Defines generic interface to USB target controller drivers */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01b,18sep01,wef merge from wrs.tor2_0.usb1_1-f for veloce +01d,07may01,wef changed module number to be (module sub num << 8) | + M_usbPeriphLib +01c,02may01,wef changed module number to be M_ + M_usbPeriphLib +01b,05dec00,wef moved Module number defs to vwModNum.h - add this + to #includes +01a,04aug99,rcb First. +*/ + +/* +DESCRIPTION + +Defines the generic interface to a USB target controller driver (TCD). +*/ + + +#ifndef __INCusbTcdh +#define __INCusbTcdh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include "usb/usbHandleLib.h" +#include "usb/usb.h" +#include "vwModNum.h" /* USB Module Number Def's */ + + +/* defines */ + +/* TRB function codes */ + +#define TCD_FNC_ATTACH 0x0000 /* attach/init */ +#define TCD_FNC_DETACH 0x0001 /* detach/shutdown */ +#define TCD_FNC_ENABLE 0x0002 /* enable target channel */ +#define TCD_FNC_DISABLE 0x0003 /* disable target channel */ + +#define TCD_FNC_ADDRESS_SET 0x0100 /* set device address */ +#define TCD_FNC_ENDPOINT_ASSIGN 0x0101 /* assigns an endpoint */ +#define TCD_FNC_ENDPOINT_RELEASE 0x0102 /* releases an endpoint */ +#define TCD_FNC_SIGNAL_RESUME 0x0103 /* drive resume signalling */ +#define TCD_FNC_ENDPOINT_STATE_SET 0x0104 /* set endpoint state */ + +#define TCD_FNC_CURRENT_FRAME_GET 0x0200 /* get current frame number */ +#define TCD_FNC_ERP_SUBMIT 0x0201 /* submit an ERP for exection */ +#define TCD_FNC_ERP_CANCEL 0x0202 /* cancel a pending ERP */ + + +/* TRB result codes */ + +/* + * USB errnos are defined as being part of the USB peripheral Module, as are + * all vxWorks module numbers, but the USB Module number is further divided + * into sub-modules. Each sub-module has upto 255 values for its own error + * codes + */ + +#define USB_TCD_SUB_MODULE 2 + +#define M_usbTcdLib ( (USB_TCD_SUB_MODULE << 8) | M_usbPeriphLib ) + +#define tcdErr(x) (M_usbTcdLib | (x)) + +#define S_usbTcdLib_BAD_PARAM tcdErr(1) +#define S_usbTcdLib_BAD_HANDLE tcdErr(2) +#define S_usbTcdLib_OUT_OF_MEMORY tcdErr(3) +#define S_usbTcdLib_OUT_OF_RESOURCES tcdErr(4) +#define S_usbTcdLib_NOT_IMPLEMENTED tcdErr(5) +#define S_usbTcdLib_GENERAL_FAULT tcdErr(6) +#define S_usbTcdLib_NOT_INITIALIZED tcdErr(7) +#define S_usbTcdLib_INT_HOOK_FAILED tcdErr(8) +#define S_usbTcdLib_HW_NOT_READY tcdErr(9) +#define S_usbTcdLib_NOT_SUPPORTED tcdErr(10) +#define S_usbTcdLib_ERP_CANCELED tcdErr(11) +#define S_usbTcdLib_CANNOT_CANCEL tcdErr(12) +#define S_usbTcdLib_SHUTDOWN tcdErr(13) +#define S_usbTcdLib_DATA_TOGGLE_FAULT tcdErr(14) +#define S_usbTcdLib_PID_MISMATCH tcdErr(15) +#define S_usbTcdLib_COMM_FAULT tcdErr(16) +#define S_usbTcdLib_NEW_SETUP_PACKET tcdErr(17) + + +/* endpoint characteristics */ + +#define TCD_ENDPOINT_IN_OK 0x0001 /* host->device capable */ +#define TCD_ENDPOINT_OUT_OK 0x0002 /* device->host capable */ +#define TCD_ENDPOINT_CTRL_OK 0x0010 /* capable of control xfr */ +#define TCD_ENDPOINT_BULK_OK 0x0020 /* capable of bulk xfr */ +#define TCD_ENDPOINT_INT_OK 0x0040 /* capable of interrupt xfr */ +#define TCD_ENDPOINT_ISOCH_OK 0x0080 /* capable of isoch xfr */ +#define TCD_ENDPOINT_IN_USE 0x0100 /* endpoint has pipe */ + + +/* managment codes passed to USB_TCD_MANAGEMENT_CALLBACK (below) */ + +#define TCD_MNGMT_ATTACH 1 /* initial TCD attachment */ +#define TCD_MNGMT_DETACH 2 /* TCD detach */ +#define TCD_MNGMT_VBUS_DETECT 3 /* Vbus detected */ +#define TCD_MNGMT_VBUS_LOST 4 /* Vbus lost */ +#define TCD_MNGMT_BUS_RESET 5 /* bus reset */ +#define TCD_MNGMT_SUSPEND 6 /* suspend signalling detected */ +#define TCD_MNGMT_RESUME 7 /* resume signalling detected */ + + +/* endpoint states */ + +#define TCD_ENDPOINT_STALL 0x01 +#define TCD_ENDPOINT_UNSTALL 0x02 +#define TCD_ENDPOINT_DATA0 0x04 + + +/* typedefs */ + +typedef GENERIC_HANDLE TCD_HANDLE, *pTCD_HANDLE; + + +/* primary TCD entry point */ + +typedef STATUS (*USB_TCD_EXEC_FUNC) (pVOID pTrb); + + +/* management notification callback function */ + +typedef VOID (*USB_TCD_MNGMT_CALLBACK) + ( + pVOID mngmtCallbackParam, /* caller-defined param */ + TCD_HANDLE handle, /* channel */ + UINT16 mngmtCode /* management code */ + ); + + +/* USB_TARG_ENDPOINT_INFO + * + * NOTE: The xxxMaxPacketSize fields indicate the maximum packet size which the + * endpoint can support. Since control pipes are always bidirectional, only a + * single value is given. However, for a given endpoint in bulk, interrupt, or + * isochronous mode, there may be additional limitations depending on how other + * endpoints are configured, so separate IN, OUT, and INOUT figures are provided. + * For example, if two endpoints are configured for isochronous operation at + * endpoint number 2 (ie., one IN and one OUT), the isochInOutMaxPacketSize figure + * would apply. When configuring endpoints in this way, the caller should + * specify the direction as USB_DIR_INOUT. The actual direction for an endpoint + * will be determined based on its capability as indicated in the flags field. + */ + +typedef struct usb_targ_endpoint_info + { + UINT16 endpointId; /* TCD-assigned endpoint ID */ + UINT16 flags; /* endpoint characteristics */ + + UINT16 endpointNumMask; /* mask of allowed endpoint numbers */ + + UINT32 ctlMaxPacketSize; /* max packet size in control mode */ + + UINT32 bulkInMaxPacketSize; /* max packet size in bulk IN mode */ + UINT32 bulkOutMaxPacketSize; /* max packet size in bulk OUT mode */ + UINT32 bulkInOutMaxPacketSize; /* max packet size in bulk I/O mode */ + + UINT32 intInMaxPacketSize; /* max packet size in intrpt IN mode */ + UINT32 intOutMaxPacketSize; /* max packet size in intrpt OUT mode */ + UINT32 intInOutMaxPacketSize; /* max packet size in intrpt I/O mode */ + + UINT32 isochInMaxPacketSize; /* max packet size in isoch IN mode */ + UINT32 isochOutMaxPacketSize; /* max packet size in isoch OUT mode */ + UINT32 isochInOutMaxPacketSize; /* max packet size in isoch I/O mode */ + + UINT16 endpointNum; /* currently assigned endpoint num */ + UINT16 configuration; /* current configuration */ + UINT16 interface; /* current interface */ + UINT16 transferType; /* current transfer type */ + UINT16 direction; /* current direction */ + + UINT16 maxPacketSize; /* max packet size as configured */ + + } USB_TARG_ENDPOINT_INFO, *pUSB_TARG_ENDPOINT_INFO; + + +/* + * TRB_HEADER + * + * All requests to a TCD begin with a TRB (TCD Request Block) header. + */ + +typedef struct trb_header + { + TCD_HANDLE handle; /* I/O caller's TCD client handle */ + UINT16 function; /* IN TCD function code */ + UINT16 trbLength; /* IN Length of the total TRB */ + } TRB_HEADER, *pTRB_HEADER; + + +/* + * TRB_ATTACH + */ + +typedef struct trb_attach + { + TRB_HEADER header; /* TRB header */ + pVOID tcdParam; /* IN TCD-specific parameter */ + + USB_TCD_MNGMT_CALLBACK mngmtCallback; + /* IN caller's management callback */ + pVOID mngmtCallbackParam; /* IN param to mngmt callback */ + + UINT16 speed; /* OUT target speed: USB_SPEED_xxxx */ + UINT16 numEndpoints; /* OUT number of endpoints supported */ + pUSB_TARG_ENDPOINT_INFO pEndpoints; + /* OUT ptr to array of endpoints */ + } TRB_ATTACH, *pTRB_ATTACH; + + +/* + * TRB_DETACH + */ + +typedef struct trb_detach + { + TRB_HEADER header; /* TRB header */ + } TRB_DETACH, *pTRB_DETACH; + + +/* + * TRB_ENABLE_DISABLE + */ + +typedef struct trb_enable_disable + { + TRB_HEADER header; /* TRB header */ + } TRB_ENABLE_DISABLE, *pTRB_ENABLE_DISABLE; + + +/* + * TRB_ADDRESS_SET + */ + +typedef struct trb_address_set + { + TRB_HEADER header; /* TRB header */ + UINT16 deviceAddress; /* IN new device address */ + } TRB_ADDRESS_SET, *pTRB_ADDRESS_SET; + + +/* + * TRB_SIGNAL_RESUME + */ + +typedef struct trb_signal_resume + { + TRB_HEADER header; /* TRB header */ + } TRB_SIGNAL_RESUME, *pTRB_SIGNAL_RESUME; + + +/* + * TRB_ENDPOINT_ASSIGN + */ + +typedef struct trb_endpoint_assign + { + TRB_HEADER header; /* TRB header */ + UINT16 endpointId; /* IN TCD-assigned endpoint ID */ + UINT16 endpointNum; /* IN newly assigned endpoint num */ + UINT16 configuration; /* IN new configuration */ + UINT16 interface; /* IN new interface */ + UINT16 transferType; /* IN new transfer type */ + UINT16 direction; /* IN new direction */ + } TRB_ENDPOINT_ASSIGN, *pTRB_ENDPOINT_ASSIGN; + + +/* + * TRB_ENDPOINT_RELEASE + */ + +typedef struct trb_endpoint_release + { + TRB_HEADER header; /* TRB header */ + UINT16 endpointId; /* IN TCD-assigned endpoint Id */ + } TRB_ENDPOINT_RELEASE, *pTRB_ENDPOINT_RELEASE; + + +/* + * TRB_ENDPOINT_STATE_SET + */ + +typedef struct trb_endpoint_state_set + { + TRB_HEADER header; /* TRB header */ + UINT16 endpointId; /* IN endpoint Id */ + UINT16 state; /* IN TCD_ENDPOINT_xxxx bitmask */ + } TRB_ENDPOINT_STATE_SET, *pTRB_ENDPOINT_STATE_SET; + + +/* + * TRB_CURRENT_FRAME_GET + */ + +typedef struct trb_current_frame_get + { + TRB_HEADER header; /* TRB header */ + UINT16 frameNo; /* OUT current frame number */ + } TRB_CURRENT_FRAME_GET, *pTRB_CURRENT_FRAME_GET; + + +/* + * TRB_ERP_SUBMIT + */ + +typedef struct trb_erp_submit + { + TRB_HEADER header; /* TRB header */ + pUSB_ERP pErp; /* IN ptr to IRP */ + } TRB_ERP_SUBMIT, *pTRB_ERP_SUBMIT; + + +/* + * TRB_ERP_CANCEL + */ + +typedef struct trb_erp_cancel + { + TRB_HEADER header; /* TRB header */ + pUSB_ERP pErp; /* IN ptr to IPR to be canceled */ + } TRB_ERP_CANCEL, *pTRB_ERP_CANCEL; + + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbTcdh */ + + +/* End of file. */ + diff --git a/h/drv/usb/target/usbTcdIsp1582EvalLib.h b/h/drv/usb/target/usbTcdIsp1582EvalLib.h new file mode 100644 index 0000000..d606e31 --- /dev/null +++ b/h/drv/usb/target/usbTcdIsp1582EvalLib.h @@ -0,0 +1,46 @@ +/* usbTcdIsp1582EvalLib.h -Defines interface to Philips usbTcdIsp1582EvalLib.c*/ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01b,19jul04,ami Coding Convention Changes +01a,21apr04,ami First. +*/ + +/* +DESCRIPTION + +Defines the interface to the USB TCD (target controller driver) for the Philips +ISP 1582 evaluation board. +*/ + +#ifndef __INCusbTcdIsp1582EvalLibh +#define __INCusbTcdIsp1582EvalLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* typedefs */ + +typedef struct usbTcdIsp1582Params /* USB_TCD_ISP1582_PARAMS */ + { + + UINT32 ioBase; /* Base I/O address range */ + UINT16 irq; /* IRQ channel */ + UINT16 dma; /* DMA channel */ + } USB_TCD_ISP1582_PARAMS, *pUSB_TCD_ISP1582_PARAMS; + + +/* function declaration */ + +extern STATUS usbTcdIsp1582EvalExec (pVOID pTrb);/* Primary TCD entry point */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbTcdIsp1582EvalLibh */ diff --git a/h/drv/usb/target/usbTcdNET2280Debug.h b/h/drv/usb/target/usbTcdNET2280Debug.h new file mode 100644 index 0000000..ab251d3 --- /dev/null +++ b/h/drv/usb/target/usbTcdNET2280Debug.h @@ -0,0 +1,55 @@ +/* usbTcdNET2280Debug.h - Debug macros for Net2280 TCD */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01e,26oct04,ami Debug Messages Changes +01d,06oct04,ami SPR #94684 Fix +01c,17sep04,ami Declaration of usbNET2280Debug flag moved +01b,08sep04,ami Code Review Comments Incorporated +01a,03sep04,gpd written +*/ + +/* +DESCRIPTION + +This file contains the macro definitions used for debugging the +Netchip2280 TCD. +*/ +#ifndef __INCusbTcdNET2280Debugh +#define __INCusbTcdNET2280Debugh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include + +extern void usbPeriLogMsg (char *,int,int,int,int,int,int); + +/* defines */ + +#define USBNET2280_DEBUG_MSG 0x01 +#define USBNET2280_DEBUG_ERR 0x02 + +#define USB_NET2280_DEBUG \ + if (usbNET2280Debug & USBNET2280_DEBUG_MSG) \ + usbPeriLogMsg /* debugging Macros */ + +#define USB_NET2280_ERROR \ + if (usbNET2280Debug & USBNET2280_DEBUG_ERR) \ + usbPeriLogMsg /* error Macros */ + +/* Define the debugging flag */ + +extern UINT32 usbNET2280Debug; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbTcdNET2280Debugh */ + diff --git a/h/drv/usb/target/usbTcdNET2280Lib.h b/h/drv/usb/target/usbTcdNET2280Lib.h new file mode 100644 index 0000000..803b1b9 --- /dev/null +++ b/h/drv/usb/target/usbTcdNET2280Lib.h @@ -0,0 +1,48 @@ +/* usbTcdNet2280Lib.h - Interfaces of Net2280 TCD */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01c,18sep04,ami Change in usbTcdNET2280Exec Function Name +01b,08sep04,ami Code Review Comments Incorporated +01a,03sep04,gpd written +*/ + +/* +DESCRIPTION + +This file contains the interface data structures and the functions which +can be used by the application and the Netchip2280 TCD. +*/ + + +#ifndef __INCusbTcdNet2280Libh +#define __INCusbTcdNet2280Libh + +#ifdef __cplusplus +extern "C" { +#endif + +#define NET2280_NO_OF_PCI_BADDR 3 /* Number of base addresses */ + +/* typedefs */ + +/* USB_TCD_NET2280_PARAMS-tcd parameters */ + +typedef struct usbTcdNET2280Params + { + UINT32 ioBase[NET2280_NO_OF_PCI_BADDR]; /* IO base array */ + UINT8 irq; /* IRQ value */ + } USB_TCD_NET2280_PARAMS, *pUSB_TCD_NET2280_PARAMS; + +/* function declarations */ + +extern STATUS usbTcdNET2280Exec (pVOID pTrb); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbTcdNet2280Libh */ diff --git a/h/drv/usb/target/usbTcdPdiusbd12EvalLib.h b/h/drv/usb/target/usbTcdPdiusbd12EvalLib.h new file mode 100644 index 0000000..240ae72 --- /dev/null +++ b/h/drv/usb/target/usbTcdPdiusbd12EvalLib.h @@ -0,0 +1,55 @@ +/* usbTcdPdiusbd12EvalLib.h - Defines interface to Philips usbTcdPdiusbd12Lib.c */ + +/* Copyright 1999-2004 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01b,21jul04,hch Create the element in tl_drv_t22_usb-int branch + Merge from development branch +01b,19jul04,ami Coding Convention Changes +01a,05aug99,rcb First. +*/ + +/* +DESCRIPTION + +Defines the interface to the USB TCD (target controller driver) for the Philips +PDIUSBD12 evaluation board. +*/ + +#ifndef __INCusbTcdPdiusbd12EvalLibh +#define __INCusbTcdPdiusbd12EvalLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* typedefs */ + +/* USB_TCD_PDIUSBD12_PARAMS + * + * The to the USB_TCD_ATTACH function for this TCD must be a pointer + * to the following structure. The caller must initialize the structure with the + * correct parameters for the hardware to be attached. + */ + +typedef struct usbTcdPdiusbd12Params /* USB_TCD_PDIUSBD12_PARAMS */ + { + UINT32 ioBase; /* Base I/O address range */ + UINT16 irq; /* IRQ channel (e.g., 5 = IRQ5) */ + UINT16 dma; /* DMA channel (e.g., 3 = DMA3) */ + } USB_TCD_PDIUSBD12_PARAMS, *pUSB_TCD_PDIUSBD12_PARAMS; + + +/* function declarations */ + +extern STATUS usbTcdPdiusbd12EvalExec (pVOID pTrb); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbTcdPdiusbd12EvalLibh */ diff --git a/h/drv/usb/usbAcmLib.h b/h/drv/usb/usbAcmLib.h new file mode 100644 index 0000000..65fad12 --- /dev/null +++ b/h/drv/usb/usbAcmLib.h @@ -0,0 +1,350 @@ +/* usbAcmLib.h - USB Communications / ACM Class Class Driver definitions */ + +/* Copyright 2000-2001 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01d,07may01,wef changed module number to be (module num << 8) | M_usbHostLib +01c,02may01,wef changed module number to be M_ + M_usbHostLib +01b,05dec00,wef moved Module number defs to vwModNum.h - add vwModNum.h + to #includes +01a,19sep00,bri Created +*/ + +#ifndef __INCusbAcmLibh +#define __INCusbAcmLibh + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* includes */ + +#include "vxWorks.h" +#include "string.h" +#include "sioLib.h" +#include "errno.h" +#include "ctype.h" +#include "logLib.h" + +#include "usb/usbPlatform.h" +#include "usb/ossLib.h" /* operations system srvcs */ +#include "usb/usb.h" /* general USB definitions */ +#include "usb/usbListLib.h" /* linked list functions */ +#include "usb/usbdLib.h" /* USBD interface */ +#include "usb/usbLib.h" /* USB utility functions */ + +#include "usb/usbCommdevices.h" + +#include "vwModNum.h" /* USB Module Number Def's */ + +/* defines */ + +/* communication feature selection codes */ + +#define USB_ACM_COMM_FEATURE_RESERVED 0x00 +#define USB_ACM_COMM_FEATURE_ABSTRACT_STATE 0x01 +#define USB_ACM_COMM_FEATURE_COUNTRY_SETTING 0x02 + +#define USB_ACM_IDLE_END_POINTS 0x0001 +#define USB_ACM_ENABLE_MULTIPLEX_CALLMGMT 0x0002 + +/* Line coding */ + +#define USB_ACM_STOPBITS_1 0 +#define USB_ACM_STOPBITS_1_5 1 +#define USB_ACM_STOPBITS_2 2 + +#define USB_ACM_PARITY_NONE 0 +#define USB_ACM_PARITY_ODD 1 +#define USB_ACM_PARITY_EVEN 2 +#define USB_ACM_PARITY_MARK 3 +#define USB_ACM_PARITY_SPACE 4 + +/* Control Line State Setting */ + +#define USB_ACM_HALFDPLX_ENABLE_CARRIER 0x2 +#define USB_ACM_DTE_PRESENT 0x1 + +/* UART (Serial) State masks */ + +#define USB_ACM_SSTATE_RX_CARRIER 0x0001 +#define USB_ACM_SSTATE_TX_CARRIER 0x0002 +#define USB_ACM_SSTATE_BREAK 0x0004 +#define USB_ACM_SSTATE_RING_SIGNAL 0x0008 +#define USB_ACM_SSTATE_FRAMING 0x0010 +#define USB_ACM_SSTATE_PARITY 0x0020 +#define USB_ACM_SSTATE_OVERRUN 0x0040 + + +/* baudrate range supported */ + +#define USB_ACM_BAUD_MIN 4800 +#define USB_ACM_BAUD_MAX 56000 + +/* + * Abstract Control Model Requests and Notifications + */ + +#define USB_ACM_REQ_SEND_ENCAP 0x0000 +#define USB_ACM_REQ_GET_ENCAP 0x0001 +#define USB_ACM_REQ_FEATURE_SET 0x0002 +#define USB_ACM_REQ_FEATURE_GET 0x0003 +#define USB_ACM_REQ_FEATURE_CLEAR 0x0004 +#define USB_ACM_REQ_LINE_CODING_SET 0x0020 +#define USB_ACM_REQ_LINE_CODING_GET 0x0021 +#define USB_ACM_REQ_CTRL_LINE_STATE_SET 0x0022 +#define USB_ACM_REQ_SEND_BREAK 0x0023 + +#define USB_ACM_NOTIFY_NET_CONN 0x0000 +#define USB_ACM_NOTIFY_RESP_AVAIL 0x0001 +#define USB_ACM_NOTIFY_SERIAL_STATE 0x0020 + +/* Error codes as set by usbAcmLib */ + +/* usbEnetLib error values */ + +/* + * USB errnos are defined as being part of the USB host Module, as are all + * vxWorks module numbers, but the USB Module number is further divided into + * sub-modules. Each sub-module has upto 255 values for its own error codes + */ + +#define USB_ACM_SUB_MODULE 10 + +#define M_usbAcmLib ( (USB_ACM_SUB_MODULE << 8) | M_usbHostLib ) + +#define usbAcmErr(x) (M_usbAcmLib | (x)) + +#define S_usbAcmLib_NOT_INITIALIZED usbAcmErr (1) +#define S_usbAcmLib_BAD_PARAM usbAcmErr (2) +#define S_usbAcmLib_OUT_OF_MEMORY usbAcmErr (3) +#define S_usbAcmLib_OUT_OF_RESOURCES usbAcmErr (4) +#define S_usbAcmLib_GENERAL_FAULT usbAcmErr (5) +#define S_usbAcmLib_QUEUE_FULL usbAcmErr (6) +#define S_usbAcmLib_QUEUE_EMPTY usbAcmErr (7) +#define S_usbAcmLib_NOT_IMPLEMENTED usbAcmErr (8) +#define S_usbAcmLib_USBD_FAULT usbAcmErr (9) +#define S_usbAcmLib_NOT_REGISTERED usbAcmErr (10) +#define S_usbAcmLib_NOT_LOCKED usbAcmErr (11) + +/* Callback Codes */ + +#define USB_ACM_CALLBACK_ATTACH (0x1<<8) +#define USB_ACM_CALLBACK_DETACH (0x1<<9) +#define USB_ACM_CALLBACK_SIO_TX (0x1<<10) +#define USB_ACM_CALLBACK_SIO_RX (0x1<<11) +#define USB_ACM_CALLBACK_BLK_RX (0x1<<12) +#define USB_ACM_CALLBACK_MODEM_CMD (0x1<<13) + +/* We use this Bit to see if the callback is for a Block send */ + +#define USB_ACM_CALLBACK_BLK_TX 0x0100 + + +/* IOCTL codes */ + +/* VxWorks SIO Model Ioctl codes */ + +#define USB_ACM_SIO_BAUD_SET SIO_BAUD_SET +#define USB_ACM_SIO_BAUD_GET SIO_BAUD_GET +#define USB_ACM_SIO_MODE_SET SIO_MODE_SET +#define USB_ACM_SIO_MODE_GET SIO_MODE_GET +#define USB_ACM_SIO_AVAIL_MODES_GET SIO_AVAIL_MODES_GET +#define USB_ACM_SIO_HW_OPTIONS_SET SIO_HW_OPTS_SET +#define USB_ACM_SIO_HW_OPTIONS_GET SIO_HW_OPTS_GET +#define USB_ACM_SIO_HUP SIO_HUP +#define USB_ACM_SIO_OPEN SIO_OPEN + +/* Ioctl codes to support the usb ACM specification.*/ + +#define acmIoctl(x) (0x8000 | x) + +#define USB_ACM_SIO_SEND_ENCAP acmIoctl(USB_ACM_REQ_SEND_ENCAP) +#define USB_ACM_SIO_GET_ENCAP acmIOctl(USB_ACM_REQ_GET_ENCAP) +#define USB_ACM_SIO_FEATURE_SET acmIoctl(USB_ACM_REQ_FEATURE_SET) +#define USB_ACM_SIO_FEATURE_GET acmIoctl(USB_ACM_REQ_FEATURE_GET) +#define USB_ACM_SIO_FEATURE_CLEAR acmIoctl(USB_ACM_REQ_FEATURE_CLEAR) +#define USB_ACM_SIO_LINE_CODING_SET acmIoctl(USB_ACM_REQ_LINE_CODING_SET) +#define USB_ACM_SIO_LINE_CODING_GET acmIoctl(USB_ACM_REQ_LINE_CODING_GET) +#define USB_ACM_SIO_SEND_BREAK acmIoctl(USB_ACM_REQ_SEND_BREAK) +#define USB_ACM_SIO_CTRL_LINE_STATE_SET \ + acmIoctl(USB_ACM_REQ_CTRL_LINE_STATE_SET) +#define USB_ACM_SIO_MAX_BUF_SIZE_GET acmIoctl(0x00aa) + + +/* Buffer Sizes */ + +#define ACM_OUT_BFR_SIZE 512 /* size of output bfr */ +#define ACM_IN_BFR_SIZE 512 /* size of input bfr */ +#define ACM_INTR_BFR_SIZE 512 /* size of input bfr */ + +/* typedefs */ + +/* + * usbAcmLib allows client to obtain notification of certain types of events + * by registering a callback routine for each of the events that are of interest + * to the client. The attach codes are described in usbAcmLib.h. + * + * The USB_ACM_CALLBACK defines a callback routine which will be invoked + * by usbAcmLib.c when any of these events happen, provided that the user + * registered a callback for such an event. + * Note that all these fields are not required for all of the events. + * They will be filled NULL or ZERO (0) when the callback is executed. + * + */ + +typedef STATUS (*USB_ACM_CALLBACK) + ( + pVOID arg, /* caller-defined argument */ + SIO_CHAN * pChan, /* pointer to affected SIO_CHAN */ + UINT16 callbackType, /* defined as USB_ACM_CALLBACK_xxxx */ + UINT8 * pBuf, /* pointer to data buffer, if any data */ + /* transfer is involved. Otherwise NULL */ + UINT16 count /* No of bytes of data transferred */ + /* if a data transfer is involved. */ + /* 0 otherwise. */ + ); + +typedef struct acmLineCode { + UINT32 baudRate; /* Data terminal rate in Bits per sec*/ + UINT8 noOfStopBits; /* 1, 1.5 or 2 */ + UINT8 parityType; /* None, Even, Odd, Mark or Space */ + UINT8 noOfDataBits; /* 5,6,7,8 or 16 */ + }LINE_CODE; + + +/* + * The structure we associate each Modem with. + */ + + +typedef struct acmStruct { + + SIO_CHAN sioChan; /* must be first field */ + + int unitNo; /* modem device */ + + LINK sioLink; /* linked list of acmStructs */ + + UINT16 lockCount; /* Count of times structure locked */ + + USBD_NODE_ID nodeId; /* modem node Id */ + + UINT16 vendorId; /* The information which */ + UINT16 productId; /* allows to identify an SIO_CHAN */ + UINT16 serialNo; /* uniquely */ + + UINT16 configuration; /* configuration reported as a modem */ + UINT16 ifaceCommClass; /* Communication Interface Class */ + UINT16 ifaceCommAltSetting; /* Alternate Setting */ + UINT16 ifaceDataClass; /* Data Interface Class */ + UINT16 ifaceDataAltSetting; /* Alternate Setting */ + UINT16 protocol; /* protocol reported by device */ + + BOOL connected; /* TRUE if modem currently connected */ + + USBD_PIPE_HANDLE outPipeHandle; /* USBD pipe handle for bulk OUT pipe */ + USB_IRP outIrp; /* IRP to transmit output data */ + BOOL outIrpInUse; /* TRUE while IRP is outstanding */ + UINT8 * outBfr; /* pointer to output buffer */ + UINT16 outBfrLen; /* maximum size of output buffer */ + UINT32 outErrors; /* count of IRP failures */ + + USBD_PIPE_HANDLE inPipeHandle; /* USBD pipe handle for bulk IN pipe */ + USB_IRP inIrp; /* IRP to monitor input from printer */ + BOOL inIrpInUse; /* TRUE while IRP is outstanding */ + UINT8 * inBfr; /* pointer to input buffer */ + UINT16 inBfrLen; /* size of input buffer */ + UINT32 inErrors; /* count of IRP failures */ + + USBD_PIPE_HANDLE intrPipeHandle; /* USBD pipe handle for bulk OUT pipe */ + USB_IRP intrIrp; /* IRP to transmit output data */ + BOOL intrIrpInUse; /* TRUE while IRP is outstanding */ + UINT8 * intrBfr; /* pointer to output buffer */ + UINT16 intrBfrLen; /* size of output buffer */ + UINT32 intrErrors; /* count of IRP failures */ + + struct acmLineCode lineCode; /* Communication Settings */ + int options; /* SIO style options */ + + int mode; /* always SIO_MODE_INT */ + UINT16 maxPktSize; /* Maximum size for Block Transfers */ + + UINT16 callbackStatus; /* Tells whether a callback is */ + /* installed or Not */ + + STATUS (*getTxCharCallback) (); /* tx callback */ + void * getTxCharArg; /* tx callback argument */ + + STATUS (*putRxCharCallback) (); /* rx callback */ + void * putRxCharArg; /* rx callback argument */ + + USB_ACM_CALLBACK putRxBlockCallback;/* Block Rx callback */ + void * putRxBlockArg; /* Block Rx Callback Argument */ + + USB_ACM_CALLBACK putModemResponseCallback; /* Modem Response callback */ + void * putModemResponseArg; /* Modem Response Callback Arg */ + + } USB_ACM_SIO_CHAN, *pUSB_ACM_SIO_CHAN; + + +/* function prototypes */ + +STATUS usbAcmLibInit (void); +STATUS usbAcmLibShutdown (void); + +STATUS usbAcmSioChanLock + ( + SIO_CHAN *pChan /* SIO_CHAN to be marked as in use */ + ); + +STATUS usbAcmSioChanUnlock + ( + SIO_CHAN *pChan /* SIO_CHAN to be marked as unused */ + ); + +int usbAcmCallbackRegister + ( + SIO_CHAN * pChan, /* SIO_CHAN */ + int callbackType, /* Callback Type */ + FUNCPTR callback, /* callback to be registered */ + pVOID arg /* user-defined arg to callback */ + ); + +STATUS usbAcmCallbackRemove + ( + SIO_CHAN * pChan, /* Channel */ + UINT callbackType, /* Callback type for which callback */ + USB_ACM_CALLBACK callback /* is to be de-installed */ + ); + +STATUS usbAcmBlockSend + ( + SIO_CHAN * pChan, /* Channel for Block Transmission */ + UINT8 * pBuf, /* data to be transmitted */ + UINT16 count /* no of bytes to be transmitted */ + ); + +STATUS usbAcmModemCommandSend + ( + SIO_CHAN * pChan, /* Channel */ + UINT8 * pBuf, /* Pointer to command buffer */ + UINT16 count /* no of command bytes */ + ); + +int usbAcmIoctl + ( + SIO_CHAN * pChan, /* Channel */ + int request, /* IOCTL request */ + void * pBuf /* buffer */ + ); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCusbAcmLibh */ diff --git a/h/drv/usb/usbBulkDevLib.h b/h/drv/usb/usbBulkDevLib.h new file mode 100644 index 0000000..a538116 --- /dev/null +++ b/h/drv/usb/usbBulkDevLib.h @@ -0,0 +1,351 @@ +/* usbBulkDevLib.h - USB Bulk only Mass Storage class header file */ + +/* + * Copyright (c) 1999-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01r,12oct05,hch Add usbBulkStatusCheckBypassSet function definition +01q,21sep05,hch Update USB_BULK_DEV_XBD_LUN structure for XBD instantiation + and zero size disk support +01p,01aug05,hch move *Ioctl() and *StatusChk() functions to usbBulkDevLibP.h +01o,13jun05,hch Change for USB bulk driver XBD implementation + add geometry and format params macro + make usbBulkDevIoctl and usbBulkDevStatusChk external +01n,14mar05,ami SPR #106153 (Introduction of macro for mode sense header + length) +01m,07dec04,hch Fixed SPR #93797 +01l,05dec04,hch Merge fix for SPR #94946 from Alexandre Dietsch. +01j,04aug04,hch added WRS_PACK_ALIGN(1) for usbBulkCbw and usbBulkCsw +01i,02apr04,cfc Merge bulkResetEnable() +01h,07nov03,mdg Added support for multiple LUN's and card insertion + removal and show routines. +01g,07may01,wef changed module number to be (module num << 8) | M_usbHostLib +01f,02may01,wef changed module number to be M_ + M_usbHostLib +01e,30mar01,wef added READ10/WRITE10 command +01d,05dec00,wef moved Module number defs to vwModNum.h - add this + to #includes, removed command status codes that lived + here and in usbCbiUfiDevLib.h and put into own file in + h/usb/usbMassStorage.h +01c,02sep00,bri added support for multiple devices. +01b,04aug00,bri updated as per review. +01a,22may00,bri created. +*/ + +#ifndef __INCusbBulkDevLibh +#define __INCusbBulkDevLibh + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* includes */ + +#include /* USB Module Number Def's */ +#include /* Command Status codes */ +#include /* XBD library header */ +#include /* event frame work library header */ + +/* Module number and error code definitions */ + + +/* + * USB errnos are defined as being part of the USB host Module, as are all + * vxWorks module numbers, but the USB Module number is further divided into + * sub-modules. Each sub-module has upto 255 values for its own error codes + */ + +#define USB_BULK_SUB_MODULE 11 + +#define M_usbBulkLib ( (USB_BULK_SUB_MODULE << 8) | M_usbHostLib ) + +#define usbBulkErr(x) (M_usbBulkLib | (x)) + +#define S_usbBulkDevLib_NOT_INITIALIZED usbBulkErr (1) +#define S_usbBulkDevLib_BAD_PARAM usbBulkErr (2) +#define S_usbBulkDevLib_OUT_OF_MEMORY usbBulkErr (3) +#define S_usbBulkDevLib_OUT_OF_RESOURCES usbBulkErr (4) +#define S_usbBulkDevLib_GENERAL_FAULT usbBulkErr (5) +#define S_usbBulkDevLib_QUEUE_FULL usbBulkErr (6) +#define S_usbBulkDevLib_QUEUE_EMPTY usbBulkErr (7) +#define S_usbBulkDevLib_NOT_IMPLEMENTED usbBulkErr (8) +#define S_usbBulkDevLib_USBD_FAULT usbBulkErr (9) +#define S_usbBulkDevLib_NOT_REGISTERED usbBulkErr (10) +#define S_usbBulkDevLib_NOT_LOCKED usbBulkErr (11) + +#define USB_CLASS_MASS_STORAGE 0x08 /* USB Mass storage class code */ +#define USB_SUBCLASS_SCSI_COMMAND_SET 0x06 /* SCSI command set definition */ +#define USB_INTERFACE_PROTOCOL_BULK_ONLY 0x50 /* BULK only interface protocol*/ +#define USB_SUBCLASS_SFF8070I 0x05 /* USB SFF8070I subclass */ + +/* + * usbBulkDevIoctl function codes - chosen outside existing IO control + * codes supported by file systems + */ + +#define USB_BULK_DESCRIPTOR_GET 0xF0 /* Shows all descriptors */ +#define USB_BULK_DEV_RESET 0xF1 /* Class-specific reset */ +#define USB_BULK_MAX_LUN 0xF2 /* Max. LUN on the device */ +#define USB_BULK_EJECT_MEDIA 0xF3 /* Eject media command */ + + +/* Bulk only protocol constants */ + +#define USB_CBW_SIGNATURE 0x43425355 /* Command block ID */ +#define USB_CBW_TAG 0xA5A5A5A5 /* Command block Tag */ +#define USB_CSW_SIGNATURE 0x53425355 /* Status block ID */ + +#define USB_CBW_DIR_NONE 0x00 /* No direction => no data xfer */ +#define USB_CBW_DIR_OUT 0x00 /* Direction OUT - to device */ +#define USB_CBW_DIR_IN 0x80 /* Direction IN - from device */ +#define USB_CBW_LUN_MASK 0x0F /* Mask for LUN field in CBW */ +#define USB_CBW_CBLEN_MASK 0x1F /* Mask for Command length field*/ +#define USB_CBW_LENGTH 0x1F /* Length of CBW */ +#define USB_CBW_MAX_CBLEN 0x10 /* Max. length of command block */ +#define USB_CSW_LENGTH 0x0D /* Length of CSW */ + +/* Status code in CSW */ + +#define USB_CSW_STATUS_PASS 0x00 /* CBW Command success */ +#define USB_CSW_STATUS_FAIL 0x01 /* CBW Command failed */ +#define USB_CSW_PHASE_ERROR 0x02 /* Phase Error */ + +/* IRP Time out in millisecs */ + +#define USB_BULK_IRP_TIME_OUT 5000 + +/* SCSI Commands and related constants */ + +#define USB_SCSI_WRITE6 0x0A /* 6-byte WRITE command */ +#define USB_SCSI_WRITE10 0x2A /* 6-byte WRITE command */ +#define USB_SCSI_READ6 0x08 /* 6-byte READ command */ +#define USB_SCSI_READ10 0x28 /* 10-byte READ command */ +#define USB_SCSI_INQUIRY 0x12 /* Standard INQUIRY command */ +#define USB_SCSI_START_STOP_UNIT 0x1B /* Start Stop Unit command */ +#define USB_SCSI_REQ_SENSE 0x03 /* REQUEST SENSE data */ +#define USB_SCSI_TEST_UNIT_READY 0x00 /* TEST UNIT READY command */ +#define USB_SCSI_READ_CAPACITY 0x25 /* READ CAPACITY command */ +#define USB_SCSI_PREVENT_REMOVAL 0x1E /* Prevent media removal */ +#define USB_SCSI_FORMAT_UNIT 0x04 /* FORMAT UNIT Command */ +#define USB_SCSI_MODE_SENSE 0x1A /* MODE SENSE Command */ + +/* specific bit definitions in SCSI commands */ + +#define USB_SCSI_STD_INQUIRY_LEN 0x24 /* Length of std INQUIRY data */ +#define USB_SCSI_REQ_SENSE_LEN 0x0E /* Length of Req Sense data */ +#define USB_SCSI_READ_CAP_LEN 0x08 /* Length of RD_CAP response */ +#define USB_SCSI_INQUIRY_RMB_BIT 0x80 /* Media Type bit */ +#define USB_SCSI_START_STOP_LOEJ 0x02 /* Media load eject bit */ +#define USB_SCSI_START_STOP_START 0x01 /* Media start bit */ + +/* definitions with in request sense data */ + +#define USB_SCSI_SENSE_KEY_OFFSET 0x02 /* Sense key offset in sense */ +#define USB_SCSI_SENSE_ASC 0x0C /* Add'tl sense code offset */ +#define USB_SCSI_SENSE_ASCQ 0x0D /* Add'tl sense code qualifier */ +#define USB_SCSI_SENSE_CUR_ERR 0x70 /* code for Current Errors */ +#define USB_SCSI_SENSE_KEY_MASK 0x0F /* Mask for sense key */ +#define USB_SCSI_KEY_NO_SENSE 0x00 /* No specific sense key */ +#define USB_SCSI_KEY_NOT_READY 0x02 /* Not ready value for key */ +#define USB_SCSI_KEY_UNIT_ATTN 0x06 /* Unit Attn value for key */ +#define USB_SCSI_KEY_HW_ERROR 0x04 /* Hardware Err value for key */ +#define USB_SCSI_ASC_NO_MEDIA 0x3A /* Media not present code */ +#define USB_SCSI_ASC_MEDIA_CHANGE 0x28 /* Media change code */ +#define USB_SCSI_ASC_RESET 0x29 /* Reset or media change code */ +#define USB_SCSI_MODE_SENSE_PAGE_CODE 0x3f /* Mode Sense page code */ +#define USB_SCSI_MODE_SENSE_ALLOC_LEN 0x40 /* Mode Sense allocation length*/ +#define USB_SCSI_MODE_SENSE_GEOMETRY_PAGE_CODE 0x04 /* Mode Sense geometry + * command page code + */ +#define USB_SCSI_MODE_SENSE_GEOMETRY_ALLOC_LEN 0x20 /* Mode Sense geometry + * allocation length + */ +#define USB_SCSI_MODE_SENSE_FORMAT_PARAMS_PAGE_CODE 0x03 /* Mode Sense format + * unit command page + * code + */ +#define USB_SCSI_MODE_SENSE_FORMAT_PARAMS_ALLOC_LEN 0x20 /* Mode Sense format + * unit allocation + * length + */ +#define USB_SCSI_MODE_SENSE_HEADER_ALLOC_LEN 0x04 /* Mode Sense length + * for block header + */ +#define USB_SCSI_SEC_PER_TRACK_OFFSET 0x12 /* offset for sec per track info + * in format params page + */ +#define USB_SCSI_CYLINDER_OFFSET 0x9 /* offset for cylinder info in + * rigid drive geometry page + */ +#define USB_SCSI_HEADS_OFFSET 0xd /* offset for heads info in rigid + * drive geometry page + */ + +/* default device geometry info */ +#define USB_BULK_DEV_DEFAULT_SECS_PER_TRACK 0x3f /* Default secPerTrack info */ + +/* device create flag bits */ + +/* + * The fourth parameter to usbBulkBlkDevCreate is an int inteded to be a bit + * field. The first bit is used to determine which type of SCSI read / write + * command is used. All other bits are undefined and available for furture use. + */ + +#define USB_SCSI_FLAG_READ_WRITE10 0x00000001 /* READ/WRITE10 */ +#define USB_SCSI_FLAG_READ_WRITE6 0x00000000 /* READ/WRITE6 */ + + +/* Class specific commands */ + +#define USB_BULK_RESET 0xFF /* Mass storage reset command */ +#define USB_BULK_GET_MAX_LUN 0xFE /* Acquire Max. LUN command */ + +/* Attach codes used by USB_BULK_ATTACH_CALLBACK. */ + +#define USB_BULK_ATTACH 0 /* Bulk-only Device attached */ +#define USB_BULK_REMOVE 1 /* Bulk-only Device removed */ + + +/* Swap macros */ + +/* + * SCSI Response is in BIG ENDIAN format. Needs swapping on LITTLE ENDIAN + * platforms. + */ + +#if (_BYTE_ORDER == _BIG_ENDIAN) + +#define USB_SCSI_SWAP_32 +#define USB_SCSI_SWAP_16 + +#else + +#define USB_SCSI_SWAP_32(x) LONGSWAP((UINT)x) +#define USB_SCSI_SWAP_16(x) ((LSB(x) << 8)|MSB(x)) + +#endif + +/* + * Command blocks for Bulk-only devices are in LITTLE ENDIAN format. Need + * swapping on BIG ENDIAN platforms. + */ + +#if (_BYTE_ORDER == _BIG_ENDIAN) + +#define USB_BULK_SWAP_32(x) LONGSWAP((UINT)x) +#define USB_BULK_SWAP_16(x) ((LSB(x) << 8)|MSB(x)) + +#else /* _BYTE_ORDER == _BIG_ENDIAN */ + +#define USB_BULK_SWAP_32 +#define USB_BULK_SWAP_16 + +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + +typedef struct usbBulkDevXbdLun + { + XBD usbBulkXbdDev; /* XBD structure for this device */ + SEM_ID usbBulkXbdMutex; /* lock for this wraper */ + SEM_ID usbBulkXbdReady; /* work available for service */ + BOOL usbBulkXbdReadyChanged; /* Ready Changed bit */ + FUNCPTR usbBulkDevRd; /* driver read function pointer */ + FUNCPTR usbBulkDevWrt; /* driver write function pointer */ + struct bio * usbBulkXbdQueueh; /* List of bios to process */ + struct bio * usbBulkXbdQueuet; /* Tail of the bio list */ + int usbBulkXbdService; /* Service task for this wrapper */ + int usbBulkRWMode; /* device read write mode */ + BOOL usbBulkXbdRemovable; /* if the device is removable */ + UINT8 blkLun; /* lun value for this unit */ + BOOL blkDrvEmpty; /* if the drive has no media */ + UINT32 blkNumBlks; /* number of blocks */ + UINT32 blkOffset; /* device offset */ + UINT8 blkVendorInfo[8]; /* vendor info */ + UINT8 blkProdId[16]; /* product id */ + UINT8 blkProdRev[4]; /* product revision id */ + BOOL usbBulkXbdInstantiated; /* USB XBD instantiation flag */ + SEM_ID usbBulkXbdSyncId; /* used for XBD instantiation */ + BOOL usbBulkXbdInserted; /* USB device insertion flag */ + } USB_BULK_DEV_XBD_LUN, *pUSB_BULK_DEV_XBD_LUN; + +/* Maximum number of logical units per device supported */ +#define MAX_LUN 5 + +/* command block wrapper */ + +typedef struct usbBulkCbw + { + UINT32 signature; /* CBW Signature */ + UINT32 tag; /* Tag field */ + UINT32 dataXferLength; /* Size of data (bytes) */ + UINT8 direction; /* direction bit */ + UINT8 lun; /* Logical Unit Number */ + UINT8 length; /* Length of command block */ + UINT8 CBD [USB_CBW_MAX_CBLEN];/* buffer for command block */ + } WRS_PACK_ALIGN(1) USB_BULK_CBW, *pUSB_BULK_CBW; + + +typedef struct usbBulkCsw + { + UINT32 signature; /* CBW Signature */ + UINT32 tag; /* Tag field */ + UINT32 dataResidue; /* Size of residual data(bytes) */ + UINT8 status; /* buffer for command block */ + } WRS_PACK_ALIGN(1) USB_BULK_CSW, *pUSB_BULK_CSW; + +/* USB_BULK_ATTACH_CALLBACK defines a callback routine which will be + * invoked by usbBulkDevLib.c when the attachment or removal of a MSC/SCSI/ + * BULK-ONLY device is detected. When the callback is invoked with an attach + * code of USB_BULK_ATTACH, the nodeId represents the ID of newly added device. + * When the attach code is USB_BULK_REMOVE, nodeId points to the Bulk-only device + * which is no longer attached. + */ + +typedef VOID (*USB_BULK_ATTACH_CALLBACK) + ( + pVOID arg, /* caller-defined argument */ + USBD_NODE_ID nodeId, /* nodeId of the bulk-only device */ + UINT16 attachCode /* attach or remove code */ + ); + +/* function prototypes */ + +STATUS usbBulkDevInit (void); +STATUS usbBulkDevShutDown (int errCode); +STATUS usbBulkDynamicAttachRegister ( USB_BULK_ATTACH_CALLBACK callback, + pVOID arg); + +XBD * usbBulkBlkDevCreate (USBD_NODE_ID nodeId, UINT8 lun, UINT32 numBlks, + UINT32 blkOffset, UINT32 flags); + +STATUS usbBulkDynamicAttachUnregister ( USB_BULK_ATTACH_CALLBACK callback, + pVOID arg); +STATUS usbBulkDevLock (USBD_NODE_ID nodeId); +STATUS usbBulkDevUnlock (USBD_NODE_ID nodeId); +STATUS usbBulkDriveResetEnable( BOOL enable ); +UINT8 usbBulkGetMaxLun (USBD_NODE_ID nodeId); + +BOOL usbBulkDriveEmpty (USBD_NODE_ID nodeId, UINT8 lun); +void usbBulkDriveShow(USBD_NODE_ID nodeId, UINT8 lun); +void usbBulkDevShow(USBD_NODE_ID nodeId); +void usbBulkShow(void); +void usbBulkStatusCheckBypassSet(BOOL); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus + +} + +#endif /* __cplusplus */ + +#endif /* __INCusbBulkDevLibh */ diff --git a/h/drv/usb/usbBulkDevLibP.h b/h/drv/usb/usbBulkDevLibP.h new file mode 100644 index 0000000..198e525 --- /dev/null +++ b/h/drv/usb/usbBulkDevLibP.h @@ -0,0 +1,45 @@ +/* usbBulkDevLibP.h - USB Bulk only Mass Storage class private header file */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01d,07oct05,hch Add usbBulkStatusCheckBypass function definition +01c,21sep05,hch Add usbBulkXbdTest, usbBulkXbdEject, usbBulkXbdMediaTest +01b,08aug05,hch change return value of usbBulkDevIoctl from STATUS to int +01a,01aug05,hch Created. +*/ + +#ifndef __INCusbBulkDevLibPh +#define __INCusbBulkDevLibPh + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* function prototype */ + +int usbBulkDevIoctl (XBD * pBlkDev, int request, void * someArg); +STATUS usbBulkDevStatusChk (XBD *); +int usbBulkXbdTest (pUSB_BULK_DEV_XBD_LUN); +int usbBulkXbdEject (pUSB_BULK_DEV_XBD_LUN); +int usbBulkXbdMediaTest (pUSB_BULK_DEV_XBD_LUN); +BOOL usbBulkStatusCheckBypass(); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCusbBulkDevLibPh */ diff --git a/h/drv/usb/usbCbiUfiDevLib.h b/h/drv/usb/usbCbiUfiDevLib.h new file mode 100644 index 0000000..d3ba092 --- /dev/null +++ b/h/drv/usb/usbCbiUfiDevLib.h @@ -0,0 +1,322 @@ +/* usbCbiUfiDevLib.h - USB CBI Mass Storage class driver for UFI sub-class */ + +/* + * Copyright (c) 1989-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01k,22sep05,hch Update USB_CBI_UFI_DEV structure for XBD instantiation + and zero size disk support +01j,01aug05,hch Moved the *Ioctl() and *StChk() to private header file +01i,09jul05,hch Add the USB_CBI_UFI_DEV type definition for XBD implementation +01h,28mar05,pdg Usage of hardware accessable memory changed +01g,18feb05,ami Macros added to support USB_UFI_READ_FORMAT_CAPACITY command +01f,07may01,wef changed module number to be (module num << 8) | M_usbHostLib +01e,02may01,wef changed module number to be M_ + M_usbHostLib +01d,05dec00,wef moved Module number defs to vwModNum.h - add this + to #includes, removed command status codes that lived + here and in usbBulkDevLib.h and put into own file in + h/usb/usbMassStorage.h +01c,02sep00,bri added support for multiple devices. +01b,04aug00,bri updated as per review. +01a,26jun00,bri created. +*/ + +#ifndef __INCusbCbiUfiDevLibh +#define __INCusbCbiUfiDevLibh + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* includes */ + +#include /* USB Module Number Def's */ +#include /* Command status codes */ +#include /* XBD library header */ +#include /* Event Frame Work library header */ + +/* Module number and error code definitions */ + +/* + * USB errnos are defined as being part of the USB host Module, as are all + * vxWorks module numbers, but the USB Module number is further divided into + * sub-modules. Each sub-module has upto 255 values for its own error codes + */ + +#define USB_CBI_SUB_MODULE 12 + +#define M_usbCbiUfiLib ( (USB_CBI_SUB_MODULE << 8) | M_usbHostLib ) + +#define usbCbiUfiErr(x) (M_usbCbiUfiLib | (x)) + +#define S_usbCbiUfiDevLib_OUT_OF_RESOURCES usbCbiUfiErr (1) +#define S_usbCbiUfiDevLib_USBD_FAULT usbCbiUfiErr (2) +#define S_usbCbiUfiDevLib_NOT_INITIALIZED usbCbiUfiErr (3) +#define S_usbCbiUfiDevLib_BAD_PARAM usbCbiUfiErr (4) +#define S_usbCbiUfiDevLib_OUT_OF_MEMORY usbCbiUfiErr (5) +#define S_usbCbiUfiDevLib_NOT_REGISTERED usbCbiUfiErr (6) +#define S_usbCBiUfiDevLib_NOT_LOCKED usbCbiUfiErr (7) + +#define USB_CLASS_MASS_STORAGE 0x08 /* USB Mass storage class code */ +#define USB_SUBCLASS_UFI_COMMAND_SET 0x04 /* UFI command set definition */ +#define USB_INTERFACE_PROTOCOL_CBI 0x00 /* CBI interface protocol */ + +#define USB_UFI_MAX_CMD_LEN 0x0C /* UFI Maximum command length */ +#define USB_UFI_INT_STATUS_LEN 2 /* Length of status data */ + +/* UFI Commands */ + +#define USB_UFI_FORMAT_UNIT 0x04 /* UFI Format Unit command */ +#define USB_UFI_INQUIRY 0x12 /* UFI Inquiry command */ +#define USB_UFI_MODE_SELECT 0x55 /* UFI Mode Select command */ +#define USB_UFI_MODE_SENSE 0x5A /* UFI Mode Sense command */ +#define USB_UFI_PREVENT_MEDIA_REMOVAL 0x1E /* UFI Prevent/ Allow media */ + /* removal command */ +#define USB_UFI_READ10 0x28 /* UFI 10-byte Read comamnd */ +#define USB_UFI_READ12 0xA8 /* UFI 12-byte Read command */ +#define USB_UFI_READ_CAPACITY 0x25 /* UFI Read Capacity command */ +#define USB_UFI_READ_FORMAT_CAPACITY 0x23 /* UFI Read Format capacities*/ +#define USB_UFI_REQUEST_SENSE 0x03 /* UFI Request sense command */ +#define USB_UFI_REZERO 0x01 /* UFI Rezero command */ +#define USB_UFI_SEEK10 0x2B /* UFI 10-byte Seek command */ +#define USB_UFI_SEND_DIAGNOSTIC 0x1D /* UFI Send Diagnostic cmd */ +#define USB_UFI_START_STOP_UNIT 0x1B /* UFI Start Stop unit cmd */ +#define USB_UFI_TEST_UNIT_READY 0x00 /* UFI Test Unit Ready cmd */ +#define USB_UFI_VERIFY 0x2F /* UFI Verify command */ +#define USB_UFI_WRITE10 0x2A /* UFI 10-byte Write command */ +#define USB_UFI_WRITE12 0xAA /* UFI 12-byte Write command */ +#define USB_UFI_WRITE_AND_VERIFY 0x2E /* UFI Write and Verify cmd */ + + +/* Bit Definitions with in UFI Command blocks */ + +#define USB_UFI_FORMAT_FMTDATA 0x10 /* Format Data bit */ +#define USB_UFI_FORMAT_FMT_DEFECT 0x07 /* Defect List format */ +#define USB_UFI_MODE_SEL_PF 0x10 /* Page Format bit */ +#define USB_UFI_MEDIA_REMOVAL_BIT 0x01 /* Prevent media removal */ +#define USB_UFI_INQUIRY_RMB_BIT 0x80 /* Removable bit */ +#define USB_UFI_START_STOP_LOEJ 0x02 /* Media load eject bit */ +#define USB_UFI_WRITE_PROTECT_BIT 0x80 /* Write protect bit */ + +/* Ioctl Control codes */ + +#define USB_UFI_ALL_DESCRIPTOR_GET 0xF0 /* Shows all descriptors */ +#define USB_UFI_DEV_RESET 0xF1 /* Performs command reset*/ + +/* Miscellaneous Definitions */ + +#define UFI_STD_REQ_SENSE_LEN 0x12 /* Request sense data length */ +#define UFI_STD_INQUIRY_LEN 0x24 /* Length of Inquiry data */ +#define USB_UFI_MS_HEADER_LEN 0x08 /* Mode sense Header Length */ + +/* Mode Sense Flexible Disk Page Lengh */ +#define USB_UFI_FLEXIBLE_DISK_PAGE_LEN 0x20 + +/* Mode Sense Flexible Disk Page code */ +#define USB_UFI_FLEXIBLE_DISK_PAGE_CODE 0x05 + +/* Disk head offset in Mode Sense Flexible Disk Page */ +#define USB_UFI_MS_HEADS_OFFSET 0x04 + +/* Disk Cylinder offset in Mode Sense Flexible Disk Page */ +#define USB_UFI_MS_CYLINDER_OFFSET 0x08 + +/* Disk Sector Per Track offset n Mode Sense Flexible Disk Page */ +#define USB_UFI_MS_SPT_OFFSET 0x05 + +#define USB_FORMAT_UNIT_PARAM_LEN 0x0C /* Paramter List length for */ + /* format command */ +#define UFI_READ_FORMAT_MAX_LENGTH 0xFF /* Maximum transfer length for */ + /* Read format capacity command */ +#define USB_FORMAT_DESC_LEN 0x08 /* format descriptor lenght */ + +#define USB_UFI_DIR_IN 0x80 /* Direction bit -> to host */ +#define USB_UFI_DIR_OUT 0x00 /* Direction bit -> to device */ + +#define USB_UFI_SENSE_KEY_OFFSET 0x02 /* Sense key offset in sense */ +#define USB_UFI_SENSE_ASC 0x0C /* Add'tl sense code offset */ +#define USB_UFI_SENSE_ASCQ 0x0D /* Add'tl sense code qualifier */ +#define USB_UFI_SENSE_KEY_MASK 0x0F /* Mask for sense key */ +#define USB_UFI_KEY_UNIT_ATTN 0x06 /* Unit Attn value for key */ +#define USB_UFI_KEY_NOT_READY 0x02 /* Not ready value for key */ +#define USB_UFI_ASC_NO_MEDIA 0x3A /* Media not present code */ +#define USB_UFI_ASC_MEDIA_CHANGE 0x28 /* Media change code */ + +/* Sense key values */ + +#define USB_UFI_NO_SENSE 0x00 /* No Sense data */ +#define USB_UFI_RECOVERED_ERROR 0x01 /* Recovered from error */ +#define USB_UFI_NOT_READY 0x02 /* Device is not ready */ +#define USB_UFI_MEDIUM_ERROR 0x03 /* Flaw in the medium or data */ +#define USB_UFI_HARDWARE_ERROR 0x04 /* Non-recoverable h/w error */ +#define USB_UFI_ILL_REQUEST 0x05 /* Illegal parameter in command */ +#define USB_UFI_UNIT_ATTN 0x06 /* Media change or reset */ +#define USB_UFI_DATA_PROTECT 0x07 /* Media write protect */ + +/* ASC and ASCQ combinations */ + + + + +#define USB_UFI_COMMAND_SUCCESS 0x0000 /* No sense data-success */ +#define USB_UFI_RECOVERED_DATA_WITH_RETRIES 0x1701 +#define USB_UFI_RECOVERED_DATA_WITH_ECC 0x1800 +#define USB_UFI_BECOMING_READY 0x0401 +#define USB_UFI_INITIALIZATION_REQUIRED 0x0402 +#define USB_UFI_FORMAT_IN_PROGRESS 0x0404 +#define USB_UFI_DEVICE_IS_BUSY 0x04ff +#define USB_UFI_NO_REFERENCE_POSITION_FOUND 0x0600 +#define USB_UFI_COMMUNICATION_FAILURE 0x0800 +#define USB_UFI_COMMUNICATION_TIMEOUT 0x0801 +#define USB_UFI_COMMUNICATION_OVERRUN 0x0880 +#define USB_UFI_MEDIUM_NOT_PRESENT 0x3a00 +#define USB_UFI_INTERFACE_FAILURE 0x5400 +#define USB_UFI_INSUFFICIENT_RESOURCES 0x8000 +#define USB_UFI_UNKNOWN_ERROR 0xffff +#define USB_UFI_NO_SEEK_COMPLETE 0x0200 +#define USB_UFI_WRITE_FAULT 0x0300 +#define USB_UFI_ID_CRC_ERROR 0x1000 +#define USB_UFI_UNRECOVERED_READ_ERROR 0x1100 +#define USB_UFI_ADDRESS_MARK_NOT_FOUND_FOR_ID_FIELD 0x1200 +#define USB_UFI_ADDRESS_MARK_NOT_FOUND_FOR_DATA_FIELD 0x1300 +#define USB_UFI_RECORDED_ENTITY_NOT_FOUND 0x1400 +#define USB_UFI_CANNOT_READ_MEDIUM_UNKNOWN_FORMAT 0x3001 +#define USB_UFI_FORMAT_COMMAND_FAILED 0x3101 +#define USB_UFI_DIAGNOSTIC_FAILURE 0x4000 +#define USB_UFI_PARAMETER_LIST_LENGTH_ERROR 0x1a00 +#define USB_UFI_INVALID_COMMAND_OPERATION_CODE 0x2000 +#define USB_UFI_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE 0x2100 +#define USB_UFI_INVALID_FIELD_IN_COMMAND_PACKET 0x2400 +#define USB_UFI_LOGICAL_UNIT_NOT_SUPPORTED 0x2500 +#define USB_UFI_INVALID_FIELD_IN_PARAMETER_LIST 0x2600 +#define USB_UFI_PARAMETER_NOT_SUPPORTED 0x2601 +#define USB_UFI_PARAMETER_VALUE_INVALID 0x2602 +#define USB_UFI_SAVING_PARAMETERS_NOT_SUPPORT 0x3900 +#define USB_UFI_MEDIA_CHANGE 0x2800 /* Media change */ +#define USB_UFI_POWER_ON_RESET 0x2900 /* Power on reset */ +#define USB_UFI_COMMANDS_CLEARED_BY_ANOTHER_INITIATOR 0x2f00 +#define USB_UFI_WRITE_PROTECT 0x2700 /* Write protected media */ +#define USB_UFI_OVERLAPPED_COMMAND_ATTEMPTED 0x4e00 + +#define USB_CBI_IRP_TIME_OUT 5000 + +/* Attach codes used by USB_UFI_ATTACH_CALLBACK. */ + +#define USB_UFI_ATTACH 0 /* CBI_UFI Device attached */ +#define USB_UFI_REMOVE 1 /* CBI_UFI Device removed */ + +/* Swap macros */ + +#if (_BYTE_ORDER == _BIG_ENDIAN) + +#define USB_SWAP_32 +#define USB_SWAP_16 + +#else /* _BYTE_ORDER == _BIG_ENDIAN */ + +#define USB_SWAP_32(x) LONGSWAP((UINT)x) +#define USB_SWAP_16(x) ((LSB(x) << 8)|MSB(x)) + +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + +/* typedefs */ + +typedef struct usbUfiCmdBlock + { + UINT dataXferLen; /* data transfer length */ + UINT direction; /* direction of data transfer */ + UINT8 * pCmd; /* UFI Command block */ + } USB_UFI_CMD_BLOCK, *pUSB_UFI_CMD_BLOCK; + +typedef struct usbCbiUfiDev + { + XBD usbCbiUfiXbdDev; /* Vxworks block device structure */ + /* Must be the first one */ + USBD_NODE_ID cbiUfiDevId; /* USBD node ID of the device */ + SEM_ID usbCbiUfiXbdMutex; /* lock for this Wrapper */ + SEM_ID usbCbiUfiReady; /* work available for service */ + UINT16 configuration; /* Configuration value */ + UINT16 interface; /* Interface number */ + UINT16 altSetting; /* Alternate setting of interface */ + UINT16 outEpAddress; /* Bulk out EP address */ + UINT16 inEpAddress; /* Bulk in EP address */ + UINT16 intrEpAddress; /* Interrupt EP address */ + USBD_PIPE_HANDLE outPipeHandle; /* Pipe handle for Bulk out EP */ + USBD_PIPE_HANDLE inPipeHandle; /* Pipe handle for Bulk in EP */ + USBD_PIPE_HANDLE intrPipeHandle; /* Pipe handle for interrupt EP */ + USB_IRP inIrp; /* IRP used for bulk-in data */ + USB_IRP outIrp; /* IRP used for bulk-out data */ + USB_IRP statusIrp; /* IRP used for status data */ + USB_UFI_CMD_BLOCK ufiCmdBlk; /* Store for UFI Command block */ + UINT8 * bulkInData; /* Pointer for bulk-in data */ + UINT8 * bulkOutData; /* Pointer for bulk-out data */ + UINT8 * pIntrStatus; /* Store for Status bytes */ + UINT16 lockCount; /* Count of times structure locked*/ + UINT16 inEpAddressMaxPkt; /* Max In Pipe Packet size */ + UINT16 outEpAddressMaxPkt;/* Max Out Pipe Packet size */ + FUNCPTR usbCbiUfiDevRd; /* funciton pointer to device read */ + FUNCPTR usbCbiUfiDevWrt; /* funciton pointer to device write */ + BOOL connected; /* TRUE if CBI_UFI device connected */ + SEM_HANDLE cbiUfiIrpSem; /* Semaphore for IRP Synchronisation */ + LINK cbiUfiDevLink; /* Link to other USB_CBI_UFI devices */ + int usbCbiUfiRWMode; /* device is write protected or not */ + struct bio * usbCbiUfiXbdQueueh;/* List of bios to process */ + struct bio * usbCbiUfiXbdQueuet;/* tail of the bio list */ + int usbCbiUfiXbdService;/* Service task for this wrapper */ + BOOL usbCbiUfiDevReadyChanged; /* ready changed bit */ + BOOL usbCbiUfiDevRemovable; /* if the device is removable */ + BOOL usbCbiUfiXbdDrvEmpty; /* if the device is empty */ + BOOL usbCbiXbdInstantiated; /* XBD instantiation flag */ + SEM_ID usbCbiXbdSyncId; /* used for XBD instantiation */ + BOOL usbCbiXbdInserted; /* USB device insertion flag */ + } USB_CBI_UFI_DEV, *pUSB_CBI_UFI_DEV; + + +/* USB_UFI_ATTACH_CALLBACK defines a callback routine which will be + * invoked by usbCbiUfiDevLib.c when the attachment or removal of a CBI_UFI + * device is detected. When the callback is invoked with an attach code of + * USB_UFI_ATTACH, the nodeId represents the ID of newly added device. When + * the attach code is USB_UFI_REMOVE, nodeId points to the CBI_UFI device which + * is no longer attached. + */ + +typedef VOID (*USB_UFI_ATTACH_CALLBACK) + ( + pVOID arg, /* caller-defined argument */ + USBD_NODE_ID nodeId, /* nodeId of the UFI device */ + UINT16 attachCode /* attach or remove code */ + ); + +/* function prototypes */ + +STATUS usbCbiUfiDevInit (void); +STATUS usbCbiUfiDevShutDown (int errCode); +STATUS usbCbiUfiDynamicAttachRegister ( USB_UFI_ATTACH_CALLBACK callback, + pVOID arg); +XBD * usbCbiUfiBlkDevCreate (USBD_NODE_ID nodeId); + +STATUS usbCbiUfiDynamicAttachUnregister ( USB_UFI_ATTACH_CALLBACK callback, + pVOID arg); +STATUS usbCbiUfiDevLock (USBD_NODE_ID nodeId); +STATUS usbCbiUfiDevUnlock (USBD_NODE_ID nodeId); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus + +} + +#endif /* __cplusplus */ + +#endif /* __INCusbCbiUfiDevLibh */ + diff --git a/h/drv/usb/usbCbiUfiDevLibP.h b/h/drv/usb/usbCbiUfiDevLibP.h new file mode 100644 index 0000000..40f702d --- /dev/null +++ b/h/drv/usb/usbCbiUfiDevLibP.h @@ -0,0 +1,43 @@ +/* usbCbiUfiDevLibP.h - USB CBI Mass Storage UFI driver private header */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01c,22sep05,hch Add usbCbiXbdTest, usbCbiXbdEject, usbCbiXbdMediaTest +01b,08aug05,hch change return value of usbCbiUfiDevIoctl from STATUS to int +01a,01aug05,hch Created. +*/ + +#ifndef __INCusbCbiUfiDevLibPh +#define __INCusbCbiUfiDevLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* function prototype */ + +int usbCbiUfiDevIoctl (XBD *, int, void *); +STATUS usbCbiUfiDevStChk (XBD *); +int usbCbiXbdTest (pUSB_CBI_UFI_DEV); +int usbCbiXbdEject (pUSB_CBI_UFI_DEV); +int usbCbiXbdMediaTest (pUSB_CBI_UFI_DEV); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCusbCbiUfiDevLibh */ + diff --git a/h/drv/usb/usbHcd.h b/h/drv/usb/usbHcd.h new file mode 100644 index 0000000..51c8a19 --- /dev/null +++ b/h/drv/usb/usbHcd.h @@ -0,0 +1,327 @@ +/* usbHcd.h - General definitions for a USB HCD (Host Controller Driver) */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01i,18sep01,wef merge from wrs.tor2_0.usb1_1-f for veloce +01h,07may01,wef changed module number to be (module num << 8) | M_usbHostLib +01g,02may01,wef changed module number to be M_ + M_usbHostLib +01f,05dec00,wef moved Module number defs to vwModNum.h - add this + to #includes +01e,26jan00,rcb Change "bytesPerFrame" field in HRB_PIPE_CREATE to + "bandwidth" and redefined as UINT32. +01d,29nov99,rcb Remove obsolete function HCD_FNC_BUS_RESET. + Increase frame number fields to 32-bits. +01c,23nov99,rcb Replace bandwidth alloc/release functions with pipe + create/destroy functions...generalizes approach for use + with OHCI HCD. +01b,07sep99,rcb Add management callback to attach function. +01a,03jun99,rcb First. +*/ + +/* +DESCRIPTION + +This file defines the interface to a USB HCD (Host Controller Driver). This +interface is generic across HCD implementations. + +NOTE: All HCD functions execute synchronously. However, all HCD functions +have been designed to allow for rapid processing. Delayed results, such as the +completion of an IRP, are reported through callbacks. + +NOTE: The USB specification states that a host controller will incorporate the +"root hub". The caller of the HCD, generally the USBD, communicates with this +root hub using the same IRPs that are used to communicate with other USB +devices and hubs. The HCD is responsible for recognizing IRPs addressed to +the root hub and processing them correctly, often by emulating the USB request +behavior of the root hub. +*/ + + +#ifndef __INCusbHcdh +#define __INCusbHcdh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "usb/usbHandleLib.h" +#include "usb/usb.h" +#include "vwModNum.h" /* USB Module Number Def's */ + + +/* defines */ + +/* HRB function codes */ + +#define HCD_FNC_ATTACH 0x0000 /* attach/init */ +#define HCD_FNC_DETACH 0x0001 /* detach/shutdown */ + +#define HCD_FNC_SET_BUS_STATE 0x0100 /* set bus suspend/resume state */ +#define HCD_FNC_SOF_INTERVAL_GET 0x0101 /* retrieve SOF interval */ +#define HCD_FNC_SOF_INTERVAL_SET 0x0102 /* set SOF interval */ + +#define HCD_FNC_CURRENT_FRAME_GET 0x0200 /* get current frame no */ +#define HCD_FNC_IRP_SUBMIT 0x0201 /* submit an IRP for exection */ +#define HCD_FNC_IRP_CANCEL 0x0202 /* cancel a pending IRP */ + +#define HCD_FNC_PIPE_CREATE 0x0300 /* create pipe & reserve bandwidth */ +#define HCD_FNC_PIPE_DESTROY 0x0301 /* destroy pipe */ +#define HCD_FNC_PIPE_MODIFY 0x0302 /* modify pipe parameters */ + + +/* HRB result codes */ + +/* + * USB errnos are defined as being part of the USB host Module, as are all + * vxWorks module numbers, but the USB Module number is further divided into + * sub-modules. Each sub-module has upto 255 values for its own error codes + */ + +#define USB_HCD_SUB_MODULE 4 + +#define M_usbHcdLib ( (USB_HCD_SUB_MODULE << 8) | M_usbHostLib ) + +#define hcdErr(x) (M_usbHcdLib | (x)) + +#define S_usbHcdLib_BAD_CLIENT hcdErr(1) +#define S_usbHcdLib_BAD_PARAM hcdErr(2) +#define S_usbHcdLib_BAD_HANDLE hcdErr(3) +#define S_usbHcdLib_OUT_OF_MEMORY hcdErr(4) +#define S_usbHcdLib_OUT_OF_RESOURCES hcdErr(5) +#define S_usbHcdLib_NOT_IMPLEMENTED hcdErr(6) +#define S_usbHcdLib_GENERAL_FAULT hcdErr(7) +#define S_usbHcdLib_NOT_INITIALIZED hcdErr(8) +#define S_usbHcdLib_INT_HOOK_FAILED hcdErr(9) +#define S_usbHcdLib_STRUCT_SIZE_FAULT hcdErr(10) +#define S_usbHcdLib_HW_NOT_READY hcdErr(11) +#define S_usbHcdLib_NOT_SUPPORTED hcdErr(12) +#define S_usbHcdLib_SHUTDOWN hcdErr(13) +#define S_usbHcdLib_IRP_CANCELED hcdErr(14) +#define S_usbHcdLib_STALLED hcdErr(15) +#define S_usbHcdLib_DATA_BFR_FAULT hcdErr(16) +#define S_usbHcdLib_BABBLE hcdErr(17) +#define S_usbHcdLib_CRC_TIMEOUT hcdErr(18) +#define S_usbHcdLib_TIMEOUT hcdErr(19) +#define S_usbHcdLib_BITSTUFF_FAULT hcdErr(20) +#define S_usbHcdLib_SHORT_PACKET hcdErr(21) +#define S_usbHcdLib_CANNOT_CANCEL hcdErr(22) +#define S_usbHcdLib_BANDWIDTH_FAULT hcdErr(23) +#define S_usbHcdLib_SOF_INTERVAL_FAULT hcdErr(24) +#define S_usbHcdLib_DATA_TOGGLE_FAULT hcdErr(25) +#define S_usbHcdLib_PID_FAULT hcdErr(26) +#define S_usbHcdLib_ISOCH_FAULT hcdErr(27) + + +/* management events */ + +#define HCD_MNGMT_RESUME 1 /* remote resume */ + + +/* bus states, bit mask */ + +#define HCD_BUS_SUSPEND 0x0001 +#define HCD_BUS_RESUME 0x0002 + + +/* typedefs */ + +/* HCD_CLIENT_HANDLE */ + +typedef GENERIC_HANDLE HCD_CLIENT_HANDLE, *pHCD_CLIENT_HANDLE; + + +/* HCD_PIPE_HANDLE */ + +typedef GENERIC_HANDLE HCD_PIPE_HANDLE, *pHCD_PIPE_HANDLE; + + +/* + * HCD_EXEC_FUNC + * + * HCD_EXEC_FUNC is the primary entry point for an HCD. The caller passes + * HRBs (HCD Request Blocks) through this interface for execution by the HCD. + */ + +typedef STATUS (*HCD_EXEC_FUNC) (pVOID pHrb); + + +/* management notification callback function */ + +typedef VOID (*USB_HCD_MNGMT_CALLBACK) + ( + pVOID mngmtCallbackParam, /* caller-defined param */ + HCD_CLIENT_HANDLE handle, /* handle to host controller */ + UINT16 busNo, /* bus number */ + UINT16 mngmtCode /* management code */ + ); + + +/* + * HRB_HEADER + * + * All requests to an HCD begin with an HRB (HCD Request Block) header. + */ + +typedef struct hrb_header + { + HCD_CLIENT_HANDLE handle; /* I/O caller's HCD client handle */ + UINT16 function; /* IN HCD function code */ + UINT16 hrbLength; /* IN Length of the total HRB */ + } HRB_HEADER, *pHRB_HEADER; + + +/* + * HRB_ATTACH + */ + +typedef struct hrb_attach + { + HRB_HEADER header; /* HRB header */ + pVOID param; /* IN HCD-specific parameter */ + USB_HCD_MNGMT_CALLBACK mngmtCallback; + /* IN USBD's callback for mngmt events */ + pVOID mngmtCallbackParam; /* IN USBD-defined parameter to callback */ + UINT16 busCount; /* OUT number of buses managed by HCD */ + } HRB_ATTACH, *pHRB_ATTACH; + + +/* + * HRB_DETACH + */ + +typedef struct hrb_detach + { + HRB_HEADER header; /* HRB header */ + } HRB_DETACH, *pHRB_DETACH; + + +/* + * HRB_BUS_RESET + */ + +typedef struct hrb_bus_reset + { + HRB_HEADER header; /* HRB header */ + UINT16 busNo; /* IN bus number to reset */ + } HRB_BUS_RESET, *pHRB_BUS_RESET; + + +/* + * HRB_SET_BUS_STATE + */ + +typedef struct hrb_set_bus_state + { + HRB_HEADER header; /* HRB header */ + UINT16 busNo; /* IN bus number */ + UINT16 busState; /* IN new bus state, HCD_BUS_xxxx */ + } HRB_SET_BUS_STATE, *pHRB_SET_BUS_STATE; + + +/* + * HRB_CURRENT_FRAME_GET + */ + +typedef struct hrb_current_frame_get + { + HRB_HEADER header; /* HRB header */ + UINT16 busNo; /* IN bus index: 0, 1, ... */ + UINT32 frameNo; /* OUT current frame number */ + UINT32 frameWindow; /* OUT frame window size */ + } HRB_CURRENT_FRAME_GET, *pHRB_CURRENT_FRAME_GET; + + +/* + * HRB_PIPE_CREATE + */ + +typedef struct hrb_pipe_create + { + HRB_HEADER header; /* HRB header */ + UINT16 busNo; /* IN bus index: 0, 1, ... */ + UINT16 busAddress; /* IN bus address of USB device */ + UINT16 endpoint; /* IN endpoint on device */ + UINT16 transferType; /* IN transfer type */ + UINT16 direction; /* IN transfer/pipe direction */ + UINT16 speed; /* IN transfer speed */ + UINT16 maxPacketSize; /* IN packet size */ + UINT32 bandwidth; /* IN bandwidth required by pipe */ + UINT16 interval; /* IN service interval */ + UINT32 time; /* OUT calculated transfer time in nanoseconds */ + HCD_PIPE_HANDLE pipeHandle; /* OUT pipe handle */ + } HRB_PIPE_CREATE, *pHRB_PIPE_CREATE; + + +/* + * HRB_PIPE_DESTROY + */ + +typedef struct hrb_pipe_destroy + { + HRB_HEADER header; /* HRB header */ + HCD_PIPE_HANDLE pipeHandle; /* IN pipe to be destroyed */ + } HRB_PIPE_DESTROY, *pHRB_PIPE_DESTROY; + + +/* + * HRB_PIPE_MODIFY + */ + +typedef struct hrb_pipe_modify + { + HRB_HEADER header; /* HRB header */ + HCD_PIPE_HANDLE pipeHandle; /* IN pipe to modify */ + UINT16 busAddress; /* IN new bus address, or 0 if unchanged */ + UINT16 maxPacketSize; /* IN new max packet size, or 0 if unchanged */ + } HRB_PIPE_MODIFY, *pHRB_PIPE_MODIFY; + + +/* + * HRB_IRP_SUBMIT + */ + +typedef struct hrb_irp_submit + { + HRB_HEADER header; /* HRB header */ + HCD_PIPE_HANDLE pipeHandle; /* IN pipe to which IRP is directed */ + pUSB_IRP pIrp; /* IN ptr to IRP */ + } HRB_IRP_SUBMIT, *pHRB_IRP_SUBMIT; + + +/* + * HRB_IRP_CANCEL + */ + +typedef struct hrb_irp_cancel + { + HRB_HEADER header; /* HRB header */ + pUSB_IRP pIrp; /* IN ptr to IPR to be canceled */ + } HRB_IRP_CANCEL, *pHRB_IRP_CANCEL; + + +/* + * HRB_SOF_INTERVAL_GET_SET + */ + +typedef struct hrb_sof_interval_get_set + { + HRB_HEADER header; /* HRB header */ + UINT16 busNo; /* IN bus index */ + UINT16 sofInterval; /* I/O SOF interval */ + } HRB_SOF_INTERVAL_GET_SET, *pHRB_SOF_INTERVAL_GET_SET; + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbHcdh */ + + +/* End of file. */ + diff --git a/h/drv/usb/usbHcdOhciLib.h b/h/drv/usb/usbHcdOhciLib.h new file mode 100644 index 0000000..79f15a2 --- /dev/null +++ b/h/drv/usb/usbHcdOhciLib.h @@ -0,0 +1,48 @@ +/* usbHcdOhciLib.h - Defines entry point for OHCI HCD */ + +/* Copyright 2000 Wind River Systems, Inc. */ +/* +Modification history +-------------------- +01a,23nov99,rcb First. +*/ + +/* +DESCRIPTION + +This file exports the primary entry point for the OHCI host controller +driver for USB. + +The to the HRB_ATTACH request should be a pointer to a +PCI_CFG_HEADER which contains the PCI configuration header for the +open host controller to be managed. Each invocation of the HRB_ATTACH +function will return an HCD_CLIENT_HANDLE for which a single host controller +will be exposed. +*/ + + +#ifndef __INCusbHcdOhciLibh +#define __INCusbHcdOhciLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* function prototypes */ + +STATUS usbHcdOhciExec + ( + pVOID pHrb /* HRB to be executed */ + ); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbHcdOhciLibh */ + + +/* End of file. */ + diff --git a/h/drv/usb/usbHcdUhciLib.h b/h/drv/usb/usbHcdUhciLib.h new file mode 100644 index 0000000..15a7243 --- /dev/null +++ b/h/drv/usb/usbHcdUhciLib.h @@ -0,0 +1,48 @@ +/* usbHcdUhciLib.h - Defines entry point for UHCI HCD */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01b,23nov99,rcb Remove comment block for usbHcdUhciExec(). +01a,09jun99,rcb First. +*/ + +/* +DESCRIPTION + +This file exports the primary entry point for the UHCI host controller +driver for USB. + +The to the HRB_ATTACH request should be a pointer to a +PCI_CFG_HEADER which contains the PCI configuration header for the +universal host controller to be managed. Each invocation of the HRB_ATTACH +function will return an HCD_CLIENT_HANDLE for which a single host controller +will be exposed. +*/ + + +#ifndef __INCusbHcdUhciLibh +#define __INCusbHcdUhciLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +STATUS usbHcdUhciExec + ( + pVOID pHrb /* HRB to be executed */ + ); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbHcdUhciLibh */ + + +/* End of file. */ + diff --git a/h/drv/usb/usbKeyboardLib.h b/h/drv/usb/usbKeyboardLib.h new file mode 100644 index 0000000..4277a99 --- /dev/null +++ b/h/drv/usb/usbKeyboardLib.h @@ -0,0 +1,122 @@ +/* usbKeyboardLib.h - USB keyboard SIO driver definitions */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01e,18sep01,wef merge from wrs.tor2_0.usb1_1-f for veloce +01d,07may01,wef changed module number to be (module num << 8) | M_usbHostLib +01c,02may01,wef changed module number to be M_ + M_usbHostLib +01b,05dec00,wef moved Module number defs to vwModNum.h - add this + to #includes +01a,27jul99,rcb First. +*/ + +#ifndef __INCusbKeyboardLibh +#define __INCusbKeyboardLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include "sioLib.h" +#include "usb/usbPlatform.h" +#include "vwModNum.h" /* USB Module Number Def's */ + + +/* defines */ + +/* usbKeyboardLib error values */ + +/* + * USB errnos are defined as being part of the USB host Module, as are all + * vxWorks module numbers, but the USB Module number is further divided into + * sub-modules. Each sub-module has upto 255 values for its own error codes + */ + +#define USB_KEYBOARD_SUB_MODULE 6 + +#define M_usbKeyboardLib ( (USB_KEYBOARD_SUB_MODULE << 8) | \ + M_usbHostLib ) + +#define usbKbdErr(x) (M_usbKeyboardLib | (x)) + +#define S_usbKeyboardLib_NOT_INITIALIZED usbKbdErr (1) +#define S_usbKeyboardLib_BAD_PARAM usbKbdErr (2) +#define S_usbKeyboardLib_OUT_OF_MEMORY usbKbdErr (3) +#define S_usbKeyboardLib_OUT_OF_RESOURCES usbKbdErr (4) +#define S_usbKeyboardLib_GENERAL_FAULT usbKbdErr (5) +#define S_usbKeyboardLib_QUEUE_FULL usbKbdErr (6) +#define S_usbKeyboardLib_QUEUE_EMPTY usbKbdErr (7) +#define S_usbKeyboardLib_NOT_IMPLEMENTED usbKbdErr (8) +#define S_usbKeyboardLib_USBD_FAULT usbKbdErr (9) +#define S_usbKeyboardLib_NOT_REGISTERED usbKbdErr (10) +#define S_usbKeyboardLib_NOT_LOCKED usbKbdErr (11) + + +/* USB_KBD_xxxx define "attach codes" used by USB_KBD_ATTACH_CALLBACK. */ + +#define USB_KBD_ATTACH 0 /* new keyboard attached */ +#define USB_KBD_REMOVE 1 /* keyboard has been removed */ + /* SIO_CHAN no longer valid */ + + +/* typedefs */ + +/* USB_KBD_ATTACH_CALLBACK defines a callback routine which will be + * invoked by usbKeyboardLib.c when the attachment or removal of a keyboard + * is detected. When the callback is invoked with an attach code of + * USB_KBD_ATTACH, the pSioChan points to a newly created SIO_CHAN. When + * the attach code is USB_KBD_REMOVE, the pSioChan points to a pSioChan + * for a keyboard which is no longer attached. + */ + +typedef VOID (*USB_KBD_ATTACH_CALLBACK) + ( + pVOID arg, /* caller-defined argument */ + SIO_CHAN *pChan, /* pointer to affected SIO_CHAN */ + UINT16 attachCode /* defined as USB_KBD_xxxx */ + ); + + +/* function prototypes */ + +STATUS usbKeyboardDevInit (void); +STATUS usbKeyboardDevShutdown (void); + +STATUS usbKeyboardDynamicAttachRegister + ( + USB_KBD_ATTACH_CALLBACK callback, /* new callback to be registered */ + pVOID arg /* user-defined arg to callback */ + ); + +STATUS usbKeyboardDynamicAttachUnRegister + ( + USB_KBD_ATTACH_CALLBACK callback, /* callback to be unregistered */ + pVOID arg /* user-defined arg to callback */ + ); + +STATUS usbKeyboardSioChanLock + ( + SIO_CHAN *pChan /* SIO_CHAN to be marked as in use */ + ); + +STATUS usbKeyboardSioChanUnlock + ( + SIO_CHAN *pChan /* SIO_CHAN to be marked as unused */ + ); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbKeyboardLibh */ + + +/* End of file. */ + diff --git a/h/drv/usb/usbKlsiEnd.h b/h/drv/usb/usbKlsiEnd.h new file mode 100644 index 0000000..99bba32 --- /dev/null +++ b/h/drv/usb/usbKlsiEnd.h @@ -0,0 +1,291 @@ +/* usbKlsiEnd.h - USB Klsi End driver header */ + +/* Copyright 2000-2001 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01h,07may01,wef undid 01f +01g,07may01,wef changed module number to be (module num << 8) | M_usbHostLib +01f,03may01,wef changed pUsbListDev to pUSB_KLSI_DEV +01e,02may01,wef changed module number to be M_ + M_usbHostLib +01d,30apr01,wef changed USB_DEV struct to USB_KLSI_DEV +01c,05dec00,wef moved Module number defs to vwModNum.h - add this + to #includes +02b,11aug00,sab KLSI_DEVICE structure modified, added ENET_IRP structure. +01a,02may00,vis Created +*/ + +#ifndef __INCusbklsiEndh +#define __INCusbklsiEndh + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* includes */ + +#include "endLib.h" +#include "usb/usbEnet.h" +#include "vwModNum.h" /* USB Module Number Def's */ + + +/* defines */ + +/* Error Numbers as set the usbEnetLib */ + +/* usbEnetLib error values */ + +/* + * USB errnos are defined as being part of the USB host Module, as are all + * vxWorks module numbers, but the USB Module number is further divided into + * sub-modules. Each sub-module has upto 255 values for its own error codes + */ + +#define USB_KLSI_SUB_MODULE 13 + +#define M_usbKlsiLib ( (USB_KLSI_SUB_MODULE << 8) | M_usbHostLib ) + +#define usbKlsiErr(x) (M_usbKlsiLib | (x)) + +#define S_usbKlsiLib_NOT_INITIALIZED usbKlsiErr (1) +#define S_usbKlsiLib_BAD_PARAM usbKlsiErr (2) +#define S_usbKlsiLib_OUT_OF_MEMORY usbKlsiErr (3) +#define S_usbKlsiLib_OUT_OF_RESOURCES usbKlsiErr (4) +#define S_usbKlsiLib_GENERAL_FAULT usbKlsiErr (5) +#define S_usbKlsiLib_QUEUE_FULL usbKlsiErr (6) +#define S_usbKlsiLib_QUEUE_EMPTY usbKlsiErr (7) +#define S_usbKlsiLib_NOT_IMPLEMENTED usbKlsiErr (8) +#define S_usbKlsiLib_USBD_FAULT usbKlsiErr (9) +#define S_usbKlsiLib_NOT_REGISTERED usbKlsiErr (10) +#define S_usbKlsiLib_NOT_LOCKED usbKlsiErr (11) + + + +/* Klsi specific constants */ + +/* List of Vendor Ids and Product Ids of devices employing KLSI adapter */ + +#define NETGEAR_VENDOR_ID 0x0846 +#define NETGEAR_PRODUCT_ID 0x1001 + +#define SMC_VENDOR_ID 0x0707 +#define SMC_PRODUCT_ID 0x0100 + + +/* Packet Filter Bitmap Constants */ + +#define PACKET_TYPE_MULTICAST 0x10 +#define PACKET_TYPE_BROADCAST 0x08 +#define PACKET_TYPE_DIRECTED 0x04 +#define PACKET_TYPE_ALL_MULTICAST 0x02 +#define PACKET_TYPE_PROMISCOUS 0x01 + + +/* Vendor Specific Commands */ + +#define USB_REQ_KLSI_ETHDESC_GET 0x00 +#define USB_REQ_KLSI_SET_MCAST_FILTER 0x01 +#define USB_REQ_KLSI_SET_PACKET_FILTER 0x02 +#define USB_REQ_KLSI_GET_STATS 0x03 +#define USB_REQ_KLSI_GET_AUX_INPUTS 0x04 +#define USB_REQ_KLSI_SET_AUX_OUTPUTS 0x05 +#define USB_REQ_KLSI_SET_TEMP_MAC 0x06 +#define USB_REQ_KLSI_GET_TEMP_MAC 0x07 +#define USB_REQ_KLSI_SET_URB_SIZE 0x08 +#define USB_REQ_KLSI_SET_SOFS_TO_WAIT 0x09 +#define USB_REQ_KLSI_SET_EVEN_PACKETS 0x0a +#define USB_REQ_KLSI_SCAN 0xff + + +/* Offsets for reading the Ethernet Functional Descriptor */ + +#define KLSI_OFFSET_MACADRS 3 +#define KLSI_OFFSET_STAT_BMP 9 +#define KLSI_OFFSET_SEGMENT_SIZE 13 +#define KLSI_OFFSET_MCAST 15 + +/* Buffer Sizes */ + +#define KLSI_OUT_BFR_SIZE 1550 /* size of output bfr */ +#define KLSI_IN_BFR_SIZE 1550 /* size of input bfr */ +#define KLSI_M_BULK_NUM 512 /* number of mbulks */ +#define KLSI_CL_NUMBER 256 /* number of clusters */ + + +#define KLSI_INTERRUPT_TO_USE 100 /* interrupt used in */ + /* downloading firmware */ +#define USB_KLSI_ATTACH 0 /* KLSI Device attached */ +#define USB_KLSI_REMOVE 1 /* KLSI Device removed */ + + + +/* typedefs */ + +/* + * usb Device structure + * This structure is a priliminary structure and is used in the + * call back functions for dynamic attachment. + * Later when the final end_obj structure is created, this structure + * will be linked to the end_obj structure. + */ + +typedef struct usb_klsi_dev + { + LINK devLink; /* linked list of device structs */ + USBD_NODE_ID nodeId; /* Node Id of the device */ + VOID * pDevStructure; /* link to KLSI_DEVICE Structure */ + UINT16 configuration; /* configuration of the device */ + UINT16 interface; /* interface of the device */ + UINT16 vendorId; /* vendor identification number */ + UINT16 productId; /* product identification number */ + BOOL connected; /* TRUE if KLSI device connected */ + UINT16 lockCount; /* Count of times structure locked */ + + }USB_KLSI_DEV, *pUsbListDev; + + +/* + * Statistics, to be maintained by the device/driver + * As on today all the stats are not supported by the driver. + */ + +typedef struct klsi_stats + { + + UINT32 bitmap; /* bitmap indicating the supported stats */ + /* This bitmap will be in the same way as given */ + /* in the Function descriptor of the device. */ + /* Corresponding bit will be set if the stat is */ + /* supported both by the device and the driver */ + + UINT32 xmitOk; /* Frames Transmitted without errors. XMIT_OK */ + UINT32 rvcOk; /* Frames received without errors. RVC_OK */ + UINT32 xmitErr; /* Frames not transmitted or transmitted with errors */ + UINT32 rvcErr; /* Frames recd. with errors that are not delivered */ + /* to usb Host */ + UINT32 rvcNoBuf; /* Frames missed, nobuffers */ + UINT32 rvcCrcErr; /* Frames recd. with CRC or FCS error */ + UINT32 rvcOverRun; /* Frames not recd. due to over run */ + + }KLSI_STATS, *pKlsiStats; + +/* + * the multicast filter support details. + */ + +typedef struct klsi_mcast + { + + UINT8 isMCastPerfect; /* if TRUE, the device supports perfect */ + /* multicast address filtering (no hashing) */ + + UINT16 noMCastFilters; /* No.of Multicast Address filters Supported */ + + }KLSI_MCAST_DETAILS, *pKlsiMCastDetails; + +/* + * Irp buffer structure + */ + + typedef struct klsi_enet_irp + { + USB_IRP outIrp; /* IRP to transmit output data */ + BOOL outIrpInUse; /* TRUE while IRP is outstanding */ + } KLSI_ENET_IRP; + + +/* + * Usb Ethernet END Device structure.. + * This structure is used both by the file usbKlsiEnd.c. + */ + +typedef struct klsi_device + { + END_OBJ endObj; /* must be first field */ + + USB_KLSI_DEV * pDev; /* the device info */ + + UINT8 unit; + + UINT8 communicateOk; /* TRUE after Starting */ + /* and FALSE if stopped */ + + UINT8 macAdrs[6]; /* MAC adress */ + + CL_POOL_ID pClPoolId; /* Pointer to the Cluster Pool */ + + BOOL connected; /* TRUE if device is currently connected */ + + USBD_PIPE_HANDLE outPipeHandle; /* USBD pipe handle for bulk OUT pipe */ + + KLSI_ENET_IRP * pEnetIrp; /* pointer to details of Irp structure*/ + int noOfIrps; /* no of Irps */ + + int txIrpIndex; /* What the last submitted IRP is */ + + UINT8 * outBfr; /* pointer to output buffer */ + UINT16 outBfrLen; /* size of output buffer */ + UINT32 outErrors; /* count of IRP failures */ + + USBD_PIPE_HANDLE inPipeHandle; /* USBD pipe handle for bulk IN pipe */ + USB_IRP inIrp; /* IRP to monitor input from printer */ + BOOL inIrpInUse; /* TRUE while IRP is outstanding */ + + UINT8 ** pInBfrArray; /* pointer to input buffers */ + int noOfInBfrs; /* no of input buffers*/ + int rxIndex; /* where current buffer is */ + + UINT16 inBfrLen; /* size of input buffer */ + UINT32 inErrors; /* count of IRP failures */ + + KLSI_STATS stats; /* Statistics */ + + KLSI_MCAST_DETAILS mCastFilters; /* Multicast address filter details */ + + UINT16 maxSegmentSize; /* Max. Segment supported by the device */ + + UINT8 maxPower; /* Max. Power Consumption of the device */ + /* in 2mA units */ + + } KLSI_DEVICE, *pKlsiDevCtrl; + + +/* USB_KLSI_ATTACH_CALLBACK defines a callback routine which will be + * invoked by usbKlsiEnd.c when the attachment or removal of a KLSI + * device is detected. When the callback is invoked with an attach code of + * USB_KLSI_ATTACH, the nodeId represents the ID of newly added device. When + * the attach code is USB_KLSI_REMOVE, nodeId points to the KLSI device which + * is no longer attached. + */ + +typedef VOID (*USB_KLSI_ATTACH_CALLBACK) + ( + pVOID arg, /* caller-defined argument */ + USBD_NODE_ID nodeId, /* nodeId of the KLSI device */ + UINT16 attachCode /* attach or remove code */ + ); + + +LOCAL UINT16 klsiAdapterList[][2] = { + { NETGEAR_VENDOR_ID, NETGEAR_PRODUCT_ID }, + { SMC_VENDOR_ID, SMC_PRODUCT_ID } + }; + +/* function prototypes*/ + +STATUS usbKlsiDynamicAttachRegister ( USB_KLSI_ATTACH_CALLBACK callback, + pVOID arg); +STATUS usbKlsiDynamicAttachUnregister ( USB_KLSI_ATTACH_CALLBACK callback, + pVOID arg); +STATUS usbKlsiDevLock (USBD_NODE_ID nodeId); +STATUS usbKlsiDevUnlock (USBD_NODE_ID nodeId); + + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCusbKlsiEndh */ diff --git a/h/drv/usb/usbMouseLib.h b/h/drv/usb/usbMouseLib.h new file mode 100644 index 0000000..04dbeba --- /dev/null +++ b/h/drv/usb/usbMouseLib.h @@ -0,0 +1,127 @@ +/* usbMouseLib.h - USB mouse SIO driver definitions */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01e,18sep01,wef merge from wrs.tor2_0.usb1_1-f for veloce +01d,07may01,wef changed module number to be (module num << 8) | M_usbHostLib +01c,02may01,wef changed module number to be M_ + M_usbHostLib +01b,05dec00,wef moved Module number defs to vwModNum.h - add this + to #includes +01a,07oct99,rcb First. +*/ + +#ifndef __INCusbMouseLibh +#define __INCusbMouseLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include "sioLib.h" +#include "usb/usbPlatform.h" +#include "usb/usbHid.h" +#include "vwModNum.h" /* USB Module Number Def's */ + + +/* defines */ + +/* usbMouseLib error values */ + +/* + * USB errnos are defined as being part of the USB host Module, as are all + * vxWorks module numbers, but the USB Module number is further divided into + * sub-modules. Each sub-module has upto 255 values for its own error codes + */ + +#define USB_MOUSE_SUB_MODULE 8 + +#define M_usbMouseLib ( (USB_MOUSE_SUB_MODULE << 8) | M_usbHostLib ) + +#define usbMseErr(x) (M_usbMouseLib | (x)) + +#define S_usbMouseLib_NOT_INITIALIZED usbMseErr (1) +#define S_usbMouseLib_BAD_PARAM usbMseErr (2) +#define S_usbMouseLib_OUT_OF_MEMORY usbMseErr (3) +#define S_usbMouseLib_OUT_OF_RESOURCES usbMseErr (4) +#define S_usbMouseLib_GENERAL_FAULT usbMseErr (5) +#define S_usbMouseLib_QUEUE_FULL usbMseErr (6) +#define S_usbMouseLib_QUEUE_EMPTY usbMseErr (7) +#define S_usbMouseLib_NOT_IMPLEMENTED usbMseErr (8) +#define S_usbMouseLib_USBD_FAULT usbMseErr (9) +#define S_usbMouseLib_NOT_REGISTERED usbMseErr (10) +#define S_usbMouseLib_NOT_LOCKED usbMseErr (11) + + +/* Additional callback types for "callbackInstall" function */ + +#define SIO_CALLBACK_PUT_MOUSE_REPORT 128 + + +/* USB_MSE_xxxx define "attach codes" used by USB_MSE_ATTACH_CALLBACK. */ + +#define USB_MSE_ATTACH 0 /* new mouse attached */ +#define USB_MSE_REMOVE 1 /* mouse has been removed */ + /* SIO_CHAN no longer valid */ + + +/* typedefs */ + +/* USB_MSE_ATTACH_CALLBACK defines a callback routine which will be + * invoked by usbMouseLib.c when the attachment or removal of a mouse + * is detected. When the callback is invoked with an attach code of + * USB_MSE_ATTACH, the pSioChan points to a newly created SIO_CHAN. When + * the attach code is USB_MSE_REMOVE, the pSioChan points to a pSioChan + * for a mouse which is no longer attached. + */ + +typedef VOID (*USB_MSE_ATTACH_CALLBACK) + ( + pVOID arg, /* caller-defined argument */ + SIO_CHAN *pChan, /* pointer to affected SIO_CHAN */ + UINT16 attachCode /* defined as USB_MSE_xxxx */ + ); + + +/* function prototypes */ + +STATUS usbMouseDevInit (void); +STATUS usbMouseDevShutdown (void); + +STATUS usbMouseDynamicAttachRegister + ( + USB_MSE_ATTACH_CALLBACK callback, /* new callback to be registered */ + pVOID arg /* user-defined arg to callback */ + ); + +STATUS usbMouseDynamicAttachUnRegister + ( + USB_MSE_ATTACH_CALLBACK callback, /* callback to be unregistered */ + pVOID arg /* user-defined arg to callback */ + ); + +STATUS usbMouseSioChanLock + ( + SIO_CHAN *pChan /* SIO_CHAN to be marked as in use */ + ); + +STATUS usbMouseSioChanUnlock + ( + SIO_CHAN *pChan /* SIO_CHAN to be marked as unused */ + ); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbMouseLibh */ + + +/* End of file. */ + diff --git a/h/drv/usb/usbNC1080End.h b/h/drv/usb/usbNC1080End.h new file mode 100644 index 0000000..e670287 --- /dev/null +++ b/h/drv/usb/usbNC1080End.h @@ -0,0 +1,266 @@ +/* usbNC1080End.h - USB Netchip End driver header */ + +/* Copyright 2000-2001 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01d,07may01,wef changed module number to be (module num << 8) | M_usbHostLib +01c,03may01,wef changed pUsbListDev to USB_NC1080_DEV, moved attach_request + definition to .c file from .h file. +01b,02may01,wef changed module number to be M_ + M_usbHostLib +01a,02may00,bri Created +*/ + +#ifndef __INCusbNC1080Endh +#define __INCusbNC1080Endh + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* includes */ + +#include "vxWorks.h" +#include "usb/usbEnet.h" +#include "endLib.h" + +/* defines */ + +/* vendor and product id's */ + +#define NETCHIP_PRODUCT_ID 0x1080 +#define NETCHIP_VENDOR_ID 0x0525 + + +/* NetChip Register Definitions */ + +#define NETCHIP_USBCTL ((UINT8)0x04) /* USB Control */ +#define NETCHIP_TTL ((UINT8)0x10) /* Time to Live */ +#define NETCHIP_STATUS ((UINT8)0x11) /* Status */ + +#define NETCHIP_REQ_REGISTER_READ ((UINT8)0x10) /* bRequest */ + +#define NETCHIP_TTLVAL 255 /* msec*/ + +/* Control Register */ + +#define USBCTL_WRITABLE_MASK 0x1f0f +/* bits 15-13 reserved */ +#define USBCTL_ENABLE_LANG (1 << 12) +#define USBCTL_ENABLE_MFGR (1 << 11) +#define USBCTL_ENABLE_PROD (1 << 10) +#define USBCTL_ENABLE_SERIAL (1 << 9) +#define USBCTL_ENABLE_DEFAULTS (1 << 8) +/* bits 7-4 reserved */ +#define USBCTL_FLUSH_OTHER (1 << 3) +#define USBCTL_FLUSH_THIS (1 << 2) +#define USBCTL_DISCONN_OTHER (1 << 1) +#define USBCTL_DISCONN_THIS (1 << 0) + + /* Status register */ + +#define STATUS_PORT_A (1 << 15) + +#define STATUS_CONN_OTHER (1 << 14) +#define STATUS_SUSPEND_OTHER (1 << 13) +#define STATUS_MAILBOX_OTHER (1 << 12) +#define STATUS_PACKETS_OTHER(n) (((n) >> 8) && 0x03) + +#define STATUS_CONN_THIS (1 << 6) +#define STATUS_SUSPEND_THIS (1 << 5) +#define STATUS_MAILBOX_THIS (1 << 4) +#define STATUS_PACKETS_THIS(n) (((n) >> 0) && 0x03) + +#define STATUS_UNSPEC_MASK 0x0c8c +#define STATUS_NOISE_MASK ((u16)~(0x0303|STATUS_UNSPEC_MASK)) + + + +/* Configuration items */ + +#define NETCHIP_MTU 296 + +#define NETCHIP_BUFSIZ (NETCHIP_MTU + ENET_HDR_REAL_SIZ + 6) +#define EH_SIZE (14) + +#define NETCHIP_SPEED_10M 10000000 /* 10Mbs */ +#define NETCHIP_SPEED_100M 100000000 /* 100Mbs */ +#define NETCHIP_SPEED NETCHIP_SPEED_10M + +/* A shortcut for getting the hardware address from the MIB II stuff. */ + +#define NETCHIP_HADDR(pEnd) \ + ((pEnd)->mib2Tbl.ifPhysAddress.phyAddress) + +#define NETCHIP_HADDR_LEN(pEnd) \ + ((pEnd)->mib2Tbl.ifPhysAddress.addrLength) + +#define CLIENT_NAME "usbNC1080Lib" + +#define NETCHIP_NAME "netChip" +#define NETCHIP_NAME_LEN (sizeof(NETCHIP_NAME)) + +/* Buffer definitions */ + +#define NETCHIP_NUM_IN_BFRS 10 +#define NETCHIP_NUM_OUT_BFRS 10 + +#define NETCHIP_OUT_BFR_SIZE 1000 +#define NETCHIP_IN_BFR_SIZE 1000 + +/* Error Numbers as set the usbNC1080Lib */ + +/* usbEnetLib error values */ + +/* + * USB errnos are defined as being part of the USB host Module, as are all + * vxWorks module numbers, but the USB Module number is further divided into + * sub-modules. Each sub-module has upto 255 values for its own error codes + */ + +#define USB_NC1080_SUB_MODULE 15 + +#define M_usbNC1080Lib ( (USB_NC1080_SUB_MODULE << 8) | M_usbHostLib ) + +#define usbNetChipErr(x) (M_usbNC1080Lib | (x)) + +#define S_usbNC1080Lib_NOT_INITIALIZED usbNetChipErr (1) +#define S_usbNC1080Lib_BAD_PARAM usbNetChipErr (2) +#define S_usbNC1080Lib_OUT_OF_MEMORY usbNetChipErr (3) +#define S_usbNC1080Lib_OUT_OF_RESOURCES usbNetChipErr (4) +#define S_usbNC1080Lib_GENERAL_FAULT usbNetChipErr (5) +#define S_usbNC1080Lib_QUEUE_FULL usbNetChipErr (6) +#define S_usbNC1080Lib_QUEUE_EMPTY usbNetChipErr (7) +#define S_usbNC1080Lib_NOT_IMPLEMENTED usbNetChipErr (8) +#define S_usbNC1080Lib_USBD_FAULT usbNetChipErr (9) +#define S_usbNC1080Lib_NOT_REGISTERED usbNetChipErr (10) +#define S_usbNC1080Lib_NOT_LOCKED usbNetChipErr (11) + +/* NETCHIP Device attached */ +#define USB_NETCHIP_ATTACH 0 + +/* NETCHIP Device removed */ +#define USB_NETCHIP_REMOVE 1 + +/* typedefs */ + +/* + * usb Device structure + * This structure is a priliminary structure and is used in the + * call back functions for dynamic attachment. + * Later when the final end_obj structure is created, this structure + * will be linked to the end_obj structure. + */ + +typedef struct usb_nc1080_dev + { + LINK devLink; /* linked list of device structs */ + USBD_NODE_ID nodeId; /* Node Id of the device */ + VOID * pDevStructure; /* Net chip device structure*/ + UINT16 configuration; /* configuration of the device */ + UINT16 interface; /* interface of the device */ + + UINT16 vendorId; /* these three fields together */ + UINT16 productId; /* uniquely */ + UINT16 serialNo; /* identify a device */ + + UINT8 maxPower; /* Max. Power Consumption of the device */ + BOOL connected; /* TRUE if device is connected */ + UINT16 lockCount; + + } USB_NC1080_DEV; + +/* The definition of the driver control structure */ + +typedef struct usb_nc1080_end_device + { + END_OBJ endObj; /* The class we inherit from. */ + int unit; /* unit number */ + long flags; /* Our local flags. */ + UCHAR enetAddr[6]; /* ethernet address */ + CL_POOL_ID pClPoolId; /* cluster pool */ + BOOL rxHandling; /* rcv task is scheduled */ + + /* usb specifics */ + USB_NC1080_DEV * pDev; /* the device info */ + + USBD_PIPE_HANDLE outPipeHandle; /* USBD pipe handle for Tx pipe */ + USBD_PIPE_HANDLE inPipeHandle; /* USBD pipe handle for Rx pipe */ + + USB_IRP outIrp; /* IRP to transmit output data */ + BOOL outIrpInUse; /* TRUE while IRP is outstanding */ + + USB_IRP inIrp; /* IRP to monitor input from printer */ + BOOL inIrpInUse; /* TRUE while IRP is outstanding */ + + int txBufIndex; /* What the last submitted IRP is */ + int rxBufIndex; /* where current buffer is */ + + int noOfInBfrs; /* no of input buffers*/ + int noOfIrps; /* no of Irps */ + + UINT16 outBfrLen; /* size of output buffer */ + UINT16 inBfrLen; /* size of input buffer */ + + UINT8 ** pOutBfrArray; /*pointer to Output buffers*/ + UINT8 ** pInBfrArray; /* pointer to input buffers */ + + int txPkts; /* used for packet_id of the Header */ + + + UINT32 outErrors; /* count of IRP failures */ + UINT32 inErrors; /* count of IRP failures */ + + } NC1080_END_DEV; + +/* + * As mentioned earlier, the data needs to be packetized before sending + * to the Netchip1080 device for transmission. Also the received data + * has to be de-packetized before we send it up. The packetizing protocol + * is + * ----------------------------- + * |header| data |footer| + * ----------------------------- + * + * the header , footer format is given here + */ + +typedef struct netchip_header + { + UINT16 hdr_len; /* sizeof netchip_header */ + UINT16 packet_len; /* packet size */ + UINT16 packet_id; /* detects dropped packets */ + + /* + * This is the minimum header required. If anything else is to be there, + * the netchip_header struct should continue like.. + * UINT16 vendorId; + * UINT16 productId; + * ... + */ + + }NC_HEADER; + +typedef struct netchip_footer + { + + UINT16 packet_id; /* for cross checking */ + + }NC_FOOTER; + + +typedef VOID (*USB_NETCHIP_ATTACH_CALLBACK) + ( + pVOID arg, /* caller-defined argument */ + USB_NC1080_DEV * pDev, /* structure of netchip device */ + UINT16 attachCode /* attach or remove code */ + ); /*added for Multiple devices */ + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCusbNC1080Endh */ diff --git a/h/drv/usb/usbOhci.h b/h/drv/usb/usbOhci.h new file mode 100644 index 0000000..3549606 --- /dev/null +++ b/h/drv/usb/usbOhci.h @@ -0,0 +1,543 @@ +/* usbOhci.h - USB OHCI controller definitions */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01b,28jan00,rcb Redefine page masks for isochronous TDs. +01a,04oct99,rcb First. +*/ +/* +DESCRIPTION + +Defines the USB OHCI (Open Host Controller Interface) register file +interface and memory structures shared between USB software and the OHCI +hardware. + +Please refer to the OpenHCI Specification, Release 1.0a or later, for more +information. +*/ + +#ifndef __INCusbOhcih +#define __INCusbOhcih + +#ifdef __cplusplus +extern "C" { +#endif + + +/* defines */ + +/* OpenHCI PCI class defintion */ + +#define OHCI_CLASS 0x0c /* BASEC value for serial bus */ +#define OHCI_SUBCLASS 0x03 /* SCC value for USB */ +#define OHCI_PGMIF 0x10 /* OpenHCI */ + + +/* completion codes */ + +#define OHCI_CC_NO_ERROR 0x0 /* no errors detected */ +#define OHCI_CC_CRC 0x1 /* CRC error */ +#define OHCI_CC_BITSTUFF 0x2 /* bit stuffing error */ +#define OHCI_CC_DATA_TOGGLE 0x3 /* data toggle mismatch */ +#define OHCI_CC_STALL 0x4 /* endpoint stall */ +#define OHCI_CC_NO_RESPONSE 0x5 /* device not responding */ +#define OHCI_CC_PID_CHECK 0x6 /* check bits on PID failed */ +#define OHCI_CC_UNEXPECTED_PID 0x7 /* unexpected PID */ +#define OHCI_CC_DATA_OVERRUN 0x8 /* packet exceeded MPS */ +#define OHCI_CC_DATA_UNDERRUN 0x9 /* packet less than MPS */ +#define OHCI_CC_BFR_OVERRUN 0xc /* host bus couldn't keep up */ +#define OHCI_CC_BFR_UNDERRUN 0xd /* host bus couldn't keep up */ +#define OHCI_CC_NOT_ACCESSED 0xe /* set by software */ + + +/* typedefs */ + +/* Host Controller Operational Registers + * + * NOTE: The following values are offsets relative to the base of the memory + * window allocated for the OHCI controller. + */ + +#define OHCI_HC_REVISION 0x0 +#define OHCI_HC_CONTROL 0x4 +#define OHCI_HC_COMMAND_STATUS 0x8 +#define OHCI_HC_INT_STATUS 0xc +#define OHCI_HC_INT_ENABLE 0x10 +#define OHCI_HC_INT_DISABLE 0x14 +#define OHCI_HC_HCCA 0x18 +#define OHCI_HC_PERIOD_CUR_ED 0x1c +#define OHCI_HC_CONTROL_HEAD_ED 0x20 +#define OHCI_HC_CONTROL_CUR_ED 0x24 +#define OHCI_HC_BULK_HEAD_ED 0x28 +#define OHCI_HC_BULK_CUR_ED 0x2c +#define OHCI_HC_DONE_HEAD 0x30 +#define OHCI_HC_FM_INTERVAL 0x34 +#define OHCI_HC_FM_REMAINING 0x38 +#define OHCI_HC_FM_NUMBER 0x3c +#define OHCI_HC_PERIODIC_START 0x40 +#define OHCI_HC_LS_THRESHOLD 0x44 +#define OHCI_HC_RH_DESCR_A 0x48 +#define OHCI_HC_RH_DESCR_B 0x4c +#define OHCI_HC_RH_STATUS 0x50 +#define OHCI_HC_RH_PORT_STATUS 0x54 /* array of port regs */ + + +/* OHCI_HC_REVISION register */ + +#define OHCI_RREV_REV_MASK 0x000000ff /* BCD OpenHCI revision */ + + +/* OHCI_HC_CONTROL register */ + +#define OHCI_CTL_CBSR_MASK 0x00000003 /* contro/bulk srvc ratio */ +#define OHCI_CTL_CBSR_ROT 0 +#define OHCI_CTL_CBSR_1TO1 0x00000000 +#define OHCI_CTL_CBSR_2TO1 0x00000001 +#define OHCI_CTL_CBSR_3TO1 0x00000002 +#define OHCI_CTL_CBSR_4TO1 0x00000003 + +#define OHCI_CTL_PLE 0x00000004 /* periodic list enable */ +#define OHCI_CTL_IE 0x00000008 /* isochronous list enable */ +#define OHCI_CTL_CLE 0x00000010 /* control list enable */ +#define OHCI_CTL_BLE 0x00000020 /* bulk list enable */ + +#define OHCI_CTL_HCFS_MASK 0x000000c0 /* host controller func state */ +#define OHCI_CTL_HCFS_RESET 0x00000000 /* UsbReset */ +#define OHCI_CTL_HCFS_RESUME 0x00000040 /* UsbResume */ +#define OHCI_CTL_HCFS_OP 0x00000080 /* UsbOperational */ +#define OHCI_CTL_HCFS_SUSPEND 0x000000c0 /* UsbSuspend */ + +#define OHCI_CTL_IR 0x00000100 /* interrupt routing */ +#define OHCI_CTL_RWC 0x00000200 /* remote wakeup connected */ +#define OHCI_CTL_RWE 0x00000400 /* remote wakeup enable */ + +/* macros to format/retrieve OHCI_TCL_CBSR (control/bulk ratio) field */ + +#define OHCI_CTL_CBSR(x) (((x) & OHCI_CTL_CBSR_MASK) >> OHCI_CTL_CBSR_ROT) +#define OHCI_CTL_CBSR_FMT(x) (((x) << OHCI_CTL_CBSR_ROT) & OHCI_CTL_CBSR_MASK) + + +/* OHCI_HC_COMMAND_STATUS register */ + +#define OHCI_CS_HCR 0x00000001 /* host controller reset */ +#define OHCI_CS_CLF 0x00000002 /* control list filled */ +#define OHCI_CS_BLF 0x00000004 /* bulk list filled */ +#define OHCI_CS_OCR 0x00000008 /* ownership change request */ + +#define OHCI_CS_SOC_MASK 0x00030000 /* scheduling overrun count */ +#define OHCI_CS_SOC_ROT 16 + +/* macro to retrieve OHCI_CS_SOC (control/bulk ratio) field */ + +#define OHCI_CS_SOC(x) (((x) & OHCI_CS_SOC_MASK) >> OHCI_CS_SOC_ROT) + + +/* OHCI_HC_INT_STATUS, OHCI_HC_INT_ENABLE, and OHCI_HC_INT_DISABLE registers */ + +#define OHCI_INT_SO 0x00000001 /* scheduling overrun */ +#define OHCI_INT_WDH 0x00000002 /* writeback done head */ +#define OHCI_INT_SF 0x00000004 /* start of frame */ +#define OHCI_INT_RD 0x00000008 /* resume detected */ +#define OHCI_INT_UE 0x00000010 /* unrecoverable error */ +#define OHCI_INT_FNO 0x00000020 /* frame number overflow */ +#define OHCI_INT_RHSC 0x00000040 /* root hub status change */ +#define OHCI_INT_OC 0x40000000 /* ownership change */ +#define OHCI_INT_MIE 0x80000000 /* master interrupt enable */ + + +/* OHCI_HC_FM_INTERVAL register */ + +#define OHCI_FMI_FI_MASK 0x00003fff /* frame interval */ +#define OHCI_FMI_FI_ROT 0 +#define OHCI_FMI_FI_DEFAULT 11999 + +#define OHCI_FMI_FSMPS_MASK 0x7fff0000 /* FS largest data packet */ +#define OHCI_FMI_FSMPS_ROT 16 + +#define OHCI_FMI_FIT 0x80000000 /* frame interval toggle */ + +/* macros to format/retrieve OHCI_FMI_FI (frame interval) field */ + +#define OHCI_FMI_FI(x) (((x) & OHCI_FMI_FI_MASK) >> OHCI_FMI_FI_ROT) +#define OHCI_FMI_FI_FMT(x) (((x) << OHCI_FMI_FI_ROT) & OHCI_FMI_FI_MASK) + +/* macros to format/retrieve OHCI_FMI_FSMPS (FS largest data packet) field */ + +#define OHCI_FMI_FSMPS(x) (((x) & OHCI_FMI_FSMPS_MASK) >> OHCI_FMI_FSMPS_ROT) +#define OHCI_FMI_FSMPS_FMT(x) (((x) << OHCI_FMI_FSMPS_ROT) & OHCI_FMI_FSMPS_MASK) + + +/* OHCI_HC_FM_REMAINING register */ + +#define OHCI_FMR_FR_MASK 0x00003fff /* frame remaining */ +#define OHCI_FMR_FR_ROT 0 + +#define OHCI_FMR_FRT 0x80000000 /* frame remaining toggle */ + +/* macro to retrieve OHCI_FMI_FR (frame remaining) field */ + +#define OHCI_FMI_FR(x) (((x) & OHCI_FMI_FR_MASK) >> OHCI_FMI_FR_ROT) + + +/* OHCI_HC_FM_NUMBER register */ + +#define OHCI_FMN_FN_MASK 0x0000ffff /* frame number */ +#define OHCI_FMN_FN_ROT 0 + +/* macro to retrieve OHCI_FMN_FN (frame number) field */ + +#define OHCI_FMN_FN(x) (((x) & OHCI_FMN_FN_MASK) >> OHCI_FMN_FN_ROT) + +/* OHCI_FRAME_WINDOW defines the frame number range supported by OHCI. */ + +#define OHCI_FRAME_WINDOW 0x10000 + + +/* OHCI_HC_PERIODIC_START register */ + +#define OHCI_PS_PS_MASK 0x00003fff /* periodic start */ +#define OHCI_PS_PS_ROT 0 + +/* macros to format/retrieve OHCI_PS_PS (perodic start) field */ + +#define OHCI_PS_PS(x) (((x) & OHCI_PS_PS_MASK) >> OHCI_PS_PS_ROT) +#define OHCI_PS_PS_FMT(x) (((x) << OHCI_PS_PS_ROT) & OHCI_PS_PS_MASK) + + +/* OHCI_LS_THRESHOLD resgister */ + +#define OHCI_LS_LST_MASK 0x000003ff /* lowspeed threshold */ +#define OHCI_LS_LST_ROT 0 + +/* macros to format/retrieve OHCI_LS_LST (low speed threshold) field */ + +#define OHCI_LS_LST(x) (((x) & OHCI_LS_LST_MASK) >> OHCI_LS_LST_ROT) +#define OHCI_LS_LST_FMT(x) (((x) << OHCI_LS_LST_ROT) & OHCI_LS_LST_MASK) + + +/* OHCI_RH_DESCR_A register */ + +#define OHCI_RHDA_NDP_MASK 0x000000ff /* number of downstream ports */ +#define OHCI_RHDA_NDP_ROT 0 + +#define OHCI_RHDA_PSM 0x00000100 /* power swithcing mode */ +#define OHCI_RHDA_NPS 0x00000200 /* no power switching */ +#define OHCI_RHDA_DT 0x00000400 /* device type */ +#define OHCI_RHDA_OCPM 0x00000800 /* overcurrent protection mode */ +#define OHCI_RHDA_NOCP 0x00001000 /* no overcurrent protection */ + +#define OHCI_RHDA_POTPGT_MASK 0xff000000 /* power on to pwr good time */ +#define OHCI_RHDA_POTPGT_ROT 24 + +/* macro to retrieve OHCI_RHDA_NDP (nbr of downstream ports) field */ + +#define OHCI_RHDA_NDP(x) (((x) & OHCI_RHDA_NDP_MASK) >> OHCI_RHDA_NDP_ROT) + +/* macro to retrieve OHCI_RHDA_POTPGT (pwr on to pwr good time) field */ + +#define OHCI_RHDA_POTPGT(x) (((x) & OHCI_RHDA_POTPGT_MASK) >> OHCI_RHDA_POTPGT_ROT) + + +/* OHCI_RH_DESCR_B register */ + +#define OHCI_RHDB_DR_MASK 0x0000ffff /* device removable */ +#define OHCI_RHDB_DR_ROT 0 + +#define OHCI_RHDB_PPCM_MASK 0xffff0000 /* port power control mask */ +#define OHCI_RHDB_PPCM_ROT 0 + +/* macros to format/retrieve OHCI_RHDB_DR (device removable) field */ + +#define OHCI_RHDB_DR(x) (((x) & OHCI_RHDB_DR_MASK) >> OHCI_RHDB_DR_ROT) +#define OHCI_RHDB_DR_FMT(x) (((x) << OHCI_RHDB_DR_ROT) & OHCI_RHDB_DR_MASK) + +/* macros to format/retrieve OHCI_RHDB_PPCM (port pwr control mask) field */ + +#define OHCI_RHDB_PPCM(x) (((x) & OHCI_RHDB_PPCM_MASK) >> OHCI_RHDB_PPCM_ROT) +#define OHCI_RHDB_PPCM_FMT(x) (((x) << OHCI_RHDB_PPCM_ROT) & OHCI_RHDB_PPCM_MASK) + + +/* OHCI_RH_STATUS register */ + +#define OHCI_RHS_LPS 0x00000001 /* local power status */ +#define OHCI_RHS_CLR_GPWR 0x00000001 /* write '1' to clear global pwr */ +#define OHCI_RHS_OCI 0x00000002 /* over current indicator */ +#define OHCI_RHS_DRWE 0x00008000 /* device remote wakeup enable */ +#define OHCI_RHS_SET_RWE 0x00008000 /* write '1' to set remote wakeup */ +#define OHCI_RHS_LPSC 0x00010000 /* local power status change */ +#define OHCI_RHS_SET_GPWR 0x00010000 /* write '1' to set global pwr */ +#define OHCI_RHS_OCIC 0x00020000 /* over current indicator change */ +#define OHCI_RHS_CRWE 0x80000000 /* clear remote wakeup enable */ +#define OHCI_RHS_CLR_RWE 0x80000000 /* write '1' to clear wakeup enable */ + + +/* OHCI_RH_PORT_STATUS register(s) */ + +#define OHCI_RHPS_CCS 0x00000001 /* current connect status */ +#define OHCI_RHPS_CLR_PE 0x00000001 /* write '1' to clear port enable */ +#define OHCI_RHPS_PES 0x00000002 /* port enable status */ +#define OHCI_RHPS_SET_PE 0x00000002 /* write '1' to set port enable */ +#define OHCI_RHPS_PSS 0x00000004 /* port suspend status */ +#define OHCI_RHPS_SET_PS 0x00000004 /* write '1' to set port suspend */ +#define OHCI_RHPS_POCI 0x00000008 /* port over current indicator */ +#define OHCI_RHPS_CLR_PS 0x00000008 /* write '1' to clear port suspend */ +#define OHCI_RHPS_PRS 0x00000010 /* port reset status */ +#define OHCI_RHPS_PPS 0x00000100 /* port power status */ +#define OHCI_RHPS_SET_PWR 0x00000100 /* write '1' to set port power */ +#define OHCI_RHPS_LSDA 0x00000200 /* low speed device attached */ +#define OHCI_RHPS_CLR_PWR 0x00000200 /* write '1' to clear port power */ +#define OHCI_RHPS_CSC 0x00010000 /* connect status change */ +#define OHCI_RHPS_PESC 0x00020000 /* port enable status change */ +#define OHCI_RHPS_PSSC 0x00040000 /* port suspend status change */ +#define OHCI_RHPS_OCIC 0x00080000 /* port over current indicator chg */ +#define OHCI_RHPS_PRSC 0x00100000 /* port reset status change */ + + +/* OHCI_ED - OHCI Endpoint Descriptor + * + * NOTE: OHCI_ED must be aligned to a 16-byte boundary, + */ + +#define OHCI_ED_ALIGNMENT 16 /* alignment */ + +typedef struct ohci_ed + { + UINT32 control; /* control word */ + UINT32 tdTail; /* TD queue tail pointer */ + UINT32 tdHead; /* TD queue head pointer */ + UINT32 nextEd; /* next OHCI_ED */ + } OHCI_ED, *pOHCI_ED; + +#define OHCI_ED_LEN 16 /* expected size of OHCI_ED */ +#define OHCI_ED_ACTLEN sizeof (OHCI_ED) /* actual */ + + +/* OHCI_ED.control definitions */ + +#define OHCI_EDCTL_FA_MASK 0x0000007f /* function address */ +#define OHCI_EDCTL_FA_ROT 0 + +#define OHCI_EDCTL_EN_MASK 0x00000780 /* endpoint number */ +#define OHCI_EDCTL_EN_ROT 7 + +#define OHCI_EDCTL_DIR_MASK 0x00001800 /* direction */ +#define OHCI_EDCTL_DIR_TD 0x00000000 /* get direction from TD */ +#define OHCI_EDCTL_DIR_OUT 0x00000800 /* OUT */ +#define OHCI_EDCTL_DIR_IN 0x00001000 /* get direction from TD */ + +#define OHCI_EDCTL_SPD_MASK 0x00002000 /* speed */ +#define OHCI_EDCTL_SPD_FULL 0x00000000 /* full speed (12mbit) device */ +#define OHCI_EDCTL_SPD_LOW 0x00002000 /* low speed device */ + +#define OHCI_EDCTL_SKIP 0x00004000 /* skip ED */ + +#define OHCI_EDCTL_FMT_MASK 0x00008000 /* TD format */ +#define OHCI_EDCTL_FMT_GEN 0x00000000 /* general: ctl/bulk/int */ +#define OHCI_EDCTL_FMT_ISO 0x00008000 /* isochronous TDs */ + +#define OHCI_EDCTL_MPS_MASK 0x07ff0000 /* maximum packet size */ +#define OHCI_EDCTL_MPS_ROT 16 + +/* macros to format/retrieve control.FA (function address) field */ + +#define OHCI_EDCTL_FA(x) (((x) & OHCI_EDCTL_FA_MASK) >> OHCI_EDCTL_FA_ROT) +#define OHCI_EDCTL_FA_FMT(x) (((x) << OHCI_EDCTL_FA_ROT) & OHCI_EDCTL_FA_MASK) + +/* macros to format/retrieve control.EN (endpoint number) field */ + +#define OHCI_EDCTL_EN(x) (((x) & OHCI_EDCTL_EN_MASK) >> OHCI_EDCTL_EN_ROT) +#define OHCI_EDCTL_EN_FMT(x) (((x) << OHCI_EDCTL_EN_ROT) & OHCI_EDCTL_EN_MASK) + +/* macros to format/retrieve control.MPS (max packet size) field */ + +#define OHCI_EDCTL_MPS(x) (((x) & OHCI_EDCTL_MPS_MASK) >> OHCI_EDCTL_MPS_ROT) +#define OHCI_EDCTL_MPS_FMT(x) (((x) << OHCI_EDCTL_MPS_ROT) & OHCI_EDCTL_MPS_MASK) + + +/* Memory pointer definitions. + * + * NOTE: Some/all of these definitions apply to the OHCI_ED.tdTail, tdHead, and + * nextEd fields. + */ + +#define OHCI_PTR_MEM_MASK 0xfffffff0 /* mask for memory pointer */ +#define OHCI_PTR_HALTED 0x00000001 /* indicates TD queue is halted */ +#define OHCI_PTR_TGL_CARRY 0x00000002 /* toggle carry */ + +#define OHCI_PAGE_SIZE 0x00001000 /* 4k pages */ +#define OHCI_PAGE_MASK 0xfffff000 /* page # mask */ + +#define OHCI_ISO_OFFSET_MASK 0x00000fff /* mask for 4k page */ +#define OHCI_ISO_OFFSET_BP0 0x00000000 /* offset within BufferPage0 page */ +#define OHCI_ISO_OFFSET_BE 0x00001000 /* offset within BufferEnd page */ + + +/* OHCI_TD_GEN - OHCI Transfer Descriptor - General: Ctl/Bulk/Int + * + * NOTE: Must be aligned to 16 byte boundary. + */ + +#define OHCI_TD_GEN_ALIGNMENT 16 /* alignment */ + +typedef struct ohci_td_gen + { + UINT32 control; /* control word */ + UINT32 cbp; /* current buffer pointer */ + UINT32 nextTd; /* next TD */ + UINT32 be; /* buffer end */ + } OHCI_TD_GEN, *pOHCI_TD_GEN; + +#define OHCI_TD_GEN_LEN 16 /* expected size of OHCI_TD_ISO */ +#define OHCI_TD_GEN_ACTLEN sizeof (OHCI_TD_GEN) /* actual */ + + +/* OHCI_TD_GEN.control definitions */ + +#define OHCI_TGCTL_BFR_RND 0x00040000 /* buffer rounding */ + +#define OHCI_TGCTL_PID_MASK 0x00180000 /* direction/PID */ +#define OHCI_TGCTL_PID_SETUP 0x00000000 /* SETUP */ +#define OHCI_TGCTL_PID_OUT 0x00080000 /* OUT */ +#define OHCI_TGCTL_PID_IN 0x00100000 /* IN */ + +#define OHCI_TGCTL_DI_MASK 0x00e00000 /* delay interrupt */ +#define OHCI_TGCTL_DI_ROT 21 +#define OHCI_TGCTL_DI_NONE 7 + +#define OHCI_TGCTL_TOGGLE_DATA0 0x00000000 /* indicates DATA0 */ +#define OHCI_TGCTL_TOGGLE_DATA1 0x01000000 /* indicates DATA1 */ +#define OHCI_TGCTL_TOGGLE_USEED 0x00000000 /* use toggle from ED */ +#define OHCI_TGCTL_TOGGLE_USETD 0x02000000 /* use toggle from TD */ + +#define OHCI_TGCTL_ERRCNT_MASK 0x0c000000 /* error count */ + +#define OHCI_TGCTL_CC_MASK 0xf0000000 /* condition code */ +#define OHCI_TGCTL_CC_ROT 28 + +/* macros to format/retrieve control.DI (delay interrupt) field */ + +#define OHCI_TGCTL_DI(x) (((x) & OHCI_TGCTL_DI_MASK) >> OHCI_TGCTL_DI_ROT) +#define OHCI_TGCTL_DI_FMT(x) (((x) << OHCI_TGCTL_DI_ROT) & OHCI_TGCTL_DI_MASK) + +/* macro to retrieve control.CC (completion code) field */ + +#define OHCI_TGCTL_CC(x) (((x) & OHCI_TGCTL_CC_MASK) >> OHCI_TGCTL_CC_ROT) + + +/* OHCI_TD_ISO - OHCI Transfer Descriptor - Isochronous + * + * NOTE: Must be aligned to 32 byte boundary. + */ + +#define OHCI_TD_ISO_ALIGNMENT 32 /* alignment */ +#define OHCI_ISO_PSW_CNT 8 /* count of pkt status words */ + +typedef struct ohci_td_iso + { + UINT32 control; /* control word */ + UINT32 bp0; /* buffer page 0 */ + UINT32 nextTd; /* next TD */ + UINT32 be; /* buffer end */ + UINT16 psw [OHCI_ISO_PSW_CNT]; /* array of packet status words */ + } OHCI_TD_ISO, *pOHCI_TD_ISO; + +#define OHCI_TD_ISO_LEN 32 /* expected size of OHCI_TD_ISO */ +#define OHCI_TD_ISO_ACTLEN sizeof (OHCI_TD_ISO) /* actual */ + + +/* OHCI_TD_ISO.control definitions */ + +#define OHCI_TICTL_SF_MASK 0x0000ffff /* starting frame */ +#define OHCI_TICTL_SF_ROT 0 + +#define OHCI_TICTL_DI_MASK 0x00e00000 /* delay interrupt */ +#define OHCI_TICTL_DI_ROT 21 +#define OHCI_TICTL_DI_NONE 7 + +#define OHCI_TICTL_FC_MASK 0x07000000 /* frame count */ +#define OHCI_TICTL_FC_ROT 24 +#define OHCI_FC_SIZE_MASK 0x7 /* mask for 3-bit count */ + +#define OHCI_TICTL_CC_MASK 0xf0000000 /* condition code */ +#define OHCI_TICTL_CC_ROT 28 + +/* macros to format/retrieve control.SF (starting frame) field */ + +#define OHCI_TICTL_SF(x) (((x) & OHCI_TICTL_SF_MASK) >> OHCI_TICTL_SF_ROT) +#define OHCI_TICTL_SF_FMT(x) (((x) << OHCI_TICTL_SF_ROT) & OHCI_TICTL_SF_MASK) + +/* Macros to retrieve/format control.FC (frame count) field + * + * NOTE: OHCI frame count is one less than the real frame count. The macros + * compensate automatically. + */ + +#define OHCI_TICTL_FC(x) ((((x) & OHCI_TICTL_FC_MASK) >> OHCI_TICTL_FC_ROT) + 1) +#define OHCI_TICTL_FC_FMT(x) ((((x) - 1) & OHCI_FC_SIZE_MASK) << OHCI_TICTL_FC_ROT) + +/* macro to retrieve control.CC (completion code) field */ + +#define OHCI_TICTL_CC(x) (((x) & OHCI_TICTL_CC_MASK) >> OHCI_TICTL_CC_ROT) + + +/* OHCI_TD_ISO.psw definitions */ + +#define OHCI_TIPSW_SIZE_MASK 0x07ff /* size of packet */ +#define OHCI_TIPSW_SIZE_ROT 0 + +#define OHCI_TIPSW_CC_MASK 0xf000 /* completion code */ +#define OHCI_TIPSW_CC_ROT 12 + +/* macro to retrieve psw.size field */ + +#define OHCI_TIPSW_SIZE(x) (((x) & OHCI_TIPSW_SIZE_MASK) >> OHCI_TIPSW_SIZE_ROT) + +/* macro to retrieve psw.CC (completion code) field */ + +#define OHCI_TIPSW_CC(x) (((x) & OHCI_TIPSW_CC_MASK) >> OHCI_TIPSW_CC_ROT) +#define OHCI_TIPSW_CC_FMT(x) (((x) << OHCI_TIPSW_CC_ROT) & OHCI_TIPSW_CC_MASK) + + +/* OHCI_HCCA - Host Controller Communications Area + * + * NOTE: This structure must be aligned to a 256 byte boundary. + */ + +#define OHCI_HCCA_ALIGNMENT 256 /* HCCA alignment requirement */ +#define OHCI_INT_ED_COUNT 32 /* count of interrupt ED heads */ +#define OHCI_HCCA_HC_RESERVED 120 /* count of reserved bytes */ +#define OHCI_HCCA_LEN 256 /* expected size of structure */ + +typedef struct ohci_hcca + { + UINT32 intEdTable [OHCI_INT_ED_COUNT]; /* ptrs to interrupt EDs */ + UINT16 frameNo; /* frame no in low 16-bits */ + UINT16 pad1; /* set to 0 when updating frameNo */ + UINT32 doneHead; /* ptr to first completed TD */ + UINT8 hcReserved [OHCI_HCCA_HC_RESERVED]; /* reserved by HC */ + } OHCI_HCCA, *pOHCI_HCCA; + +#define OHCI_HCCA_LEN 256 /* expected size of structure */ +#define OHCI_HCCA_ACTLEN sizeof (OHCI_HCCA) /* actual size */ + + +/* If the low bit of the doneHead field is written as '1' by the HC, then + * an additional interrupt condition is present and the host controller driver + * should interrogate the HcInterruptStatus register to determine the cause. + */ + +#define OHCI_DONE_HEAD_OTHER_INT 0x00000001 + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbOhcih */ + + +/* End of file. */ + diff --git a/h/drv/usb/usbPegasusEnd.h b/h/drv/usb/usbPegasusEnd.h new file mode 100644 index 0000000..76565c4 --- /dev/null +++ b/h/drv/usb/usbPegasusEnd.h @@ -0,0 +1,347 @@ +/* usbPegasusEnd.h - USB Pegasus End driver header */ + +/* Copyright 2000-2002 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01l,10aug05,ami usbPegasusEndUninit() routine added in declaration + usbPegasusDynamicAttachUnregister() added +01k,23Feb04,hch Updated the PEGASUS_DEVICE structure to eliminate the receive + cluster pool memeber for SPR #106581 +01k,16jan05,hch Increased the number of IRPs submitted +01j,23jun04,hch Add the Pegasus control registers definition +01i,14oct03,nrv update pegasus_device struct +01h,29aug03,nrv mods for pegasus2 +01g,13dec01,wef merge from veloce view +01f,01aug01,wef fixed the #ifndef, was all lowercase +01e,07may01,wef changed module number to be (module num << 8) | M_usbHostLib +01d,02may01,wef changed module number to be M_ + M_usbHostLib +01c,30apr01,wef changed USB_DEV USB_PEGASUS_DEV +01b,05dec00,wef moved Module number defs to vwModNum.h - add this + to #includes +01a,02may00,bri Created +*/ + +#ifndef __INCusbPegasusEndh +#define __INCusbPegasusEndh + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* includes */ + +#include "endLib.h" +#include "usb/usbEnet.h" +#include "vwModNum.h" /* USB Module Number Def's */ + + +/* defines */ + +/* Error Numbers as set the usbEnetLib */ + +/* usbEnetLib error values */ + +/* + * USB errnos are defined as being part of the USB host Module, as are all + * vxWorks module numbers, but the USB Module number is further divided into + * sub-modules. Each sub-module has upto 255 values for its own error codes + */ + +#define USB_PEGASUS_SUB_MODULE 14 + +#define M_usbPegasusLib ( (USB_PEGASUS_SUB_MODULE << 8) | M_usbHostLib ) + +#define usbPegasusErr(x) (M_usbPegasusLib | (x)) + +#define S_usbPegasusLib_NOT_INITIALIZED usbPegasusErr (1) +#define S_usbPegasusLib_BAD_PARAM usbPegasusErr (2) +#define S_usbPegasusLib_OUT_OF_MEMORY usbPegasusErr (3) +#define S_usbPegasusLib_OUT_OF_RESOURCES usbPegasusErr (4) +#define S_usbPegasusLib_GENERAL_FAULT usbPegasusErr (5) +#define S_usbPegasusLib_QUEUE_FULL usbPegasusErr (6) +#define S_usbPegasusLib_QUEUE_EMPTY usbPegasusErr (7) +#define S_usbPegasusLib_NOT_IMPLEMENTED usbPegasusErr (8) +#define S_usbPegasusLib_USBD_FAULT usbPegasusErr (9) +#define S_usbPegasusLib_NOT_REGISTERED usbPegasusErr (10) +#define S_usbPegasusLib_NOT_LOCKED usbPegasusErr (11) + +#define SOHOWARE_VENDOR_ID 0x15e8 +#define SOHOWARE_PRODUCT_ID 0x9110 + +#define BELKIN_VENDOR_ID 0x050d +#define BELKIN_PRODUCT_ID 0x0121 + + +/* Pegasus Control Registers definition */ + +#define PEGASUS_CTL0_INCLUDE_RXCRC 0x01 +#define PEGASUS_CTL0_ALLMULTI 0x02 +#define PEGASUS_CTL0_STOP_BACKOFF 0x04 +#define PEGASUS_CTL0_RXSTAT_APPEND 0x08 +#define PEGASUS_CTL0_WAKEON_ENB 0x10 +#define PEGASUS_CTL0_RXPAUSE_ENB 0x20 +#define PEGASUS_CTL0_RX_ENB 0x40 +#define PEGASUS_CTL0_TX_ENB 0x80 + +#define PEGASUS_CTL1_HOMELAN 0x04 +#define PEGASUS_CTL1_RESETMAC 0x08 +#define PEGASUS_CTL1_SPEEDSEL 0x10 /* 0 = 10mbps, 1 = 100mbps */ +#define PEGASUS_CTL1_DUPLEX 0x20 /* 0 = half, 1 = full */ +#define PEGASUS_CTL1_DELAYHOME 0x40 + +#define PEGASUS_CTL2_EP3_CLR 0x01 /* reading EP3 clrs status regs */ +#define PEGASUS_CTL2_RX_BADFRAMES 0x02 +#define PEGASUS_CTL2_RX_PROMISC 0x04 +#define PEGASUS_CTL2_LOOPBACK 0x08 +#define PEGASUS_CTL2_EEPROMWR_ENB 0x10 +#define PEGASUS_CTL2_EEPROM_LOAD 0x20 + +/* Attach codes used by USB_PEGASUS_ATTACH_CALLBACK. */ + +#define USB_PEGASUS_ATTACH 0 /* PEGASUS Device attached */ +#define USB_PEGASUS_REMOVE 1 /* PEGASUS Device removed */ + +/* Vendor Specific Commands */ + +#define USB_REQ_PEGASUS_REG_GET 0x00 +#define USB_REQ_PEGASUS_SET_REG_SINGLE 0x01 +#define USB_REQ_PEGASUS_SET_REG_MULTIPLE 0x02 + +#define USB_PEGASUS_REG_ENET_CONTL 0x00 +#define USB_PEGASUS_REG_MCAST_TABL 0x08 +#define USB_PEGASUS_REG_ENET_ADRS 0x10 +#define USB_PEGASUS_REG_EEPROM_OFFSET 0x20 +#define USB_PEGASUS_REG_EEPROM_DATA 0x21 +#define USB_PEGASUS_REG_PHY_ADRS 0x25 +#define USB_PEGASUS_REG_PHY_DATA 0x26 +#define USB_PEGASUS_REG_PHY_ACC_CNTL 0x28 +#define USB_PEGASUS_REG_GPIO_CNTL0 0x7e +#define USB_PEGASUS_REG_GPIO_CNTL1 0x7f + +#define USB_PEGASUS_GET_BMREQ 0xc0 +#define USB_PEGASUS_GET_BREQ 0xf0 +#define USB_PEGASUS_SET_BMREQ 0x40 +#define USB_PEGASUS_SET_BREQ 0xf1 + +#undef ETHER_MAP_IP_MULTICAST +/* Offsets for reading the Ethernet Functional Descriptor */ + +#define PEGASUS_OFFSET_MACADRS 3 +#define PEGASUS_OFFSET_STAT_BMP 9 +#define PEGASUS_OFFSET_SEGMENT_SIZE 13 +#define PEGASUS_OFFSET_MCAST 15 + +#define PEGASUS_M_BLK_NUM 512 +#define PEGASUS_CL_NUM 256 + +/* Buffer Sizes */ + +#define PEGASUS_OUT_BFR_SIZE 1550 /* size of output bfr */ +#define PEGASUS_IN_BFR_SIZE 1550 /* size of input bfr */ +#define PEGASUS_NO_IN_BFRS 40 /* No of Input Buffers */ +#define PEGASUS_NO_OUT_IRPS 20 /* No of IRPs submitted */ + +#define USB_PEGASUS_ATTACH 0 /* CBI_UFI Device attached */ +#define USB_PEGASUS_REMOVE 1 /* CBI_UFI Device removed */ + +#define PEGASUS_NAME "usb" +#define PEGASUS_DESCRIPTION "usb" +#define PEGASUS_NAME_LEN sizeof(PEGASUS_NAME)+1 + +/* typedefs */ + +/* + * usb Device structure + * This structure is a priliminary structure and is used in the + * call back functions for dynamic attachment. + * Later when the final end_obj structure is created, this structure + * will be linked to the end_obj structure. + */ + +typedef struct usb_pegasus_dev + { + LINK devLink; /* linked list of device structs */ + USBD_NODE_ID nodeId; /* Node Id of the device */ + UINT16 configuration; /* configuration of the device */ + UINT16 interface; /* interface of the device */ + UINT16 vendorId; /* Pegasus Device Vendor ID */ + UINT16 productId; /* Pegasus Device Product ID */ + UINT16 lockCount; /* Count of times structure locked*/ + BOOL connected; + VOID * pPegasusDev; + }USB_PEGASUS_DEV, *pUsbPegasusListDev; + + +/* + * Statistics, to be maintained by the device/driver + * As on today all the stats are not supported by the driver. + */ + +typedef struct pegasus_stats + { + + UINT32 bitmap; /* bitmap indicating the supported stats */ + /* This bitmap will be in the same way as given */ + /* in the Function descriptor of the device. */ + /* Corresponding bit will be set if the stat is */ + /* supported both by the device and the driver */ + + UINT32 xmitOk; /* Frames Transmitted without errors. XMIT_OK */ + UINT32 rvcOk; /* Frames received without errors. RVC_OK */ + UINT32 xmitErr; /* Frames not transmitted or transmitted with errors */ + UINT32 rvcErr; /* Frames recd. with errors that are not delivered */ + /* to usb Host */ + UINT32 rvcNoBuf; /* Frames missed, nobuffers */ + UINT32 rvcCrcErr; /* Frames recd. with CRC or FCS error */ + UINT32 rvcOverRun; /* Frames not recd. due to over run */ + + }PEGASUS_STATS, *pPegasusStats; + +/* + * the multicast filter support details. + */ + +typedef struct pegasus_mcast + { + + UINT8 isMCastPerfect; /* if TRUE, the device supports perfect */ + /* multicast address filtering (no hashing) */ + + UINT16 noMCastFilters; /* No.of Multicast Address filters Supported */ + + }PEGASUS_MCAST_DETAILS, *pPegasusMCastDetails; + +/* + * Irp buffer structure + */ + + typedef struct pegasus_enet_irp + { + USB_IRP outIrp; /* IRP to transmit output data */ + BOOL outIrpInUse; /* TRUE while IRP is outstanding */ + } PEGASUS_ENET_IRP; + +/* USB_PEGASUS_ATTACH_CALLBACK defines a callback routine which will be + * invoked by usbPegasusEnd.c when the attachment or removal of a Pegasus + * device is detected. When the callback is invoked with an attach code of + * USB_PEGASUS_ATTACH, the nodeId represents the ID of newly added device. + * When the attach code is USB_PEGASUS_REMOVE, nodeId points to the + * PEGASUS device which is no longer attached. + */ + +typedef VOID (*USB_PEGASUS_ATTACH_CALLBACK) + ( + pVOID arg, /* caller-defined argument */ + USB_PEGASUS_DEV * pDev, /* the device info */ + UINT16 attachCode /* attach or remove code */ + ); + +/* Attach request for user callback */ + +typedef struct attach_request + { + LINK reqLink; /* linked list of requests */ + USB_PEGASUS_ATTACH_CALLBACK callback; /* client callback routine */ + pVOID callbackArg; /* client callback argument*/ + } ATTACH_REQUEST, *pATTACH_REQUEST; + +/* + * Usb Ethernet END Device structure.. + * This structure is used both by the file usbPegasusEnd.c. + */ + +typedef struct pegasus_device + { + END_OBJ endObj; /* must be first field */ + + USB_PEGASUS_DEV * pDev; /* the device info */ + + UINT8 unit; + + USBD_NODE_ID nodeId; /* Node Id of the device */ + + UINT8 communicateOk; /* TRUE after Starting */ + /* and FALSE if stopped */ + + UINT8 macAdrs[6]; /* MAC adress */ + + CL_POOL_ID pClPoolId; /* Pointer to the Cluster Pool */ + + BOOL connected; /* TRUE if device is currently connected */ + + USBD_PIPE_HANDLE outPipeHandle; /* USBD pipe handle for bulk OUT pipe */ + + PEGASUS_ENET_IRP * pEnetIrp; /* pointer to details of Irp structure*/ + + int noOfIrps; /* no of Irps */ + + int txIrpIndex; /* What the last submitted IRP is */ + + UINT8 * outBfr; /* pointer to output buffer */ + UINT16 outBfrLen; /* size of output buffer */ + UINT32 outErrors; /* count of IRP failures */ + + USBD_PIPE_HANDLE inPipeHandle; /* USBD pipe handle for bulk IN pipe */ + USB_IRP inIrp; /* IRP to monitor input from printer */ + BOOL inIrpInUse; /* TRUE while IRP is outstanding */ + + int noOfInBfrs; /* no of input buffers*/ + UINT8 ** pOutBfrArray; /* pointer to output buffers */ + + UINT16 inBfrLen; /* size of input buffer */ + UINT32 inErrors; /* count of IRP failures */ + + PEGASUS_STATS stats; /* Statistics */ + LINK pegasusDevLink; /* Link to other Pegasus devices */ + PEGASUS_MCAST_DETAILS mCastFilters; /* Multicast address filter details */ + + UINT16 maxSegmentSize; /* Max. Segment supported by the device */ + + UINT8 maxPower; /* Max. Power Consumption of the device */ + /* in 2mA units */ + BOOL txStall; /* Indicates we ran out of TX IRP's */ + BOOL txActive; /* Indicates there is a TX IRP in process with the USB Stack */ + + } PEGASUS_DEVICE, *pPegasusDevCtrl; + +LOCAL UINT16 pegasusAdapterList[][2] = { + { SOHOWARE_VENDOR_ID, SOHOWARE_PRODUCT_ID }, + { BELKIN_VENDOR_ID, BELKIN_PRODUCT_ID } + }; + +/* Swap macros */ + +#if (_BYTE_ORDER == _BIG_ENDIAN) + +#define USB_PEGASUS_SWAP_32(x) LONGSWAP((UINT)x) +#define USB_PEGASUS_SWAP_16(x) ((LSB(x) << 8)|MSB(x)) + +#else /* _BYTE_ORDER == _BIG_ENDIAN */ + +#define USB_PEGASUS_SWAP_32 +#define USB_PEGASUS_SWAP_16 + +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + +/* fucntion prototypes */ + +STATUS usbPegasusDevLock (USBD_NODE_ID nodeId); +STATUS usbPegasusDevUnlock (USBD_NODE_ID nodeId); +STATUS usbPegasusDynamicAttachRegister (USB_PEGASUS_ATTACH_CALLBACK callback, + pVOID arg); +STATUS usbPegasusDynamicAttachUnregister (USB_PEGASUS_ATTACH_CALLBACK callback, + pVOID arg); + +STATUS usbPegasusEndInit(void); +STATUS usbPegasusEndUninit (void); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCusbPegasusEndh */ + diff --git a/h/drv/usb/usbPrinterLib.h b/h/drv/usb/usbPrinterLib.h new file mode 100644 index 0000000..bf9215b --- /dev/null +++ b/h/drv/usb/usbPrinterLib.h @@ -0,0 +1,132 @@ +/* usbPrinterLib.h - USB printer SIO driver definitions */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01f,11may04,hch merge after D12 driver testing +01f,04may04,??? Support for cancelling a print job +01e,18sep01,wef merge from wrs.tor2_0.usb1_1-f for veloce +01d,07may01,wef changed module number to be (module num << 8) | M_usbHostLib +01c,02may01,wef changed module number to be M_ + M_usbHostLib +01b,05dec00,wef moved Module number defs to vwModNum.h - add this + to #includes +01a,01sep99,rcb First. +*/ + +#ifndef __INCusbPrinterLibh +#define __INCusbPrinterLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include "sioLib.h" +#include "usb/usbPlatform.h" +#include "vwModNum.h" /* USB Module Number Def's */ + + +/* defines */ + +/* usbPrinterLib error values */ + +/* + * USB errnos are defined as being part of the USB host Module, as are all + * vxWorks module numbers, but the USB Module number is further divided into + * sub-modules. Each sub-module has upto 255 values for its own error codes + */ + +#define USB_PRINTER_SUB_MODULE 7 + +#define M_usbPrinterLib ( ( USB_PRINTER_SUB_MODULE << 8) | M_usbHostLib ) + +#define usbPrnErr(x) (M_usbPrinterLib | (x)) + +#define S_usbPrinterLib_NOT_INITIALIZED usbPrnErr (1) +#define S_usbPrinterLib_BAD_PARAM usbPrnErr (2) +#define S_usbPrinterLib_OUT_OF_MEMORY usbPrnErr (3) +#define S_usbPrinterLib_OUT_OF_RESOURCES usbPrnErr (4) +#define S_usbPrinterLib_GENERAL_FAULT usbPrnErr (5) +#define S_usbPrinterLib_QUEUE_FULL usbPrnErr (6) +#define S_usbPrinterLib_QUEUE_EMPTY usbPrnErr (7) +#define S_usbPrinterLib_NOT_IMPLEMENTED usbPrnErr (8) +#define S_usbPrinterLib_USBD_FAULT usbPrnErr (9) +#define S_usbPrinterLib_NOT_REGISTERED usbPrnErr (10) +#define S_usbPrinterLib_NOT_LOCKED usbPrnErr (11) + + +/* USB_PRN_xxxx define "attach codes" used by USB_PRN_ATTACH_CALLBACK. */ + +#define USB_PRN_ATTACH 0 /* new printer attached */ +#define USB_PRN_REMOVE 1 /* printer has been removed */ + /* SIO_CHAN no longer valid */ + + +/* IOCTL codes unique to usbPrinterLib. */ + +#define SIO_USB_PRN_DEVICE_ID_GET 0x8000 +#define SIO_USB_PRN_PROTOCOL_GET 0x8001 +#define SIO_USB_PRN_STATUS_GET 0x8002 +#define SIO_USB_PRN_SOFT_RESET 0x8003 +#define SIO_USB_PRN_CANCEL 0x8004 + + +/* typedefs */ + +/* USB_PRN_ATTACH_CALLBACK defines a callback routine which will be + * invoked by usbPrinterLib.c when the attachment or removal of a printer + * is detected. When the callback is invoked with an attach code of + * USB_PRN_ATTACH, the pSioChan points to a newly created SIO_CHAN. When + * the attach code is USB_PRN_REMOVE, the pSioChan points to a pSioChan + * for a printer which is no longer attached. + */ + +typedef VOID (*USB_PRN_ATTACH_CALLBACK) + ( + pVOID arg, /* caller-defined argument */ + SIO_CHAN *pChan, /* pointer to affected SIO_CHAN */ + UINT16 attachCode /* defined as USB_PRN_xxxx */ + ); + + +/* function prototypes */ + +STATUS usbPrinterDevInit (void); +STATUS usbPrinterDevShutdown (void); + +STATUS usbPrinterDynamicAttachRegister + ( + USB_PRN_ATTACH_CALLBACK callback, /* new callback to be registered */ + pVOID arg /* user-defined arg to callback */ + ); + +STATUS usbPrinterDynamicAttachUnRegister + ( + USB_PRN_ATTACH_CALLBACK callback, /* callback to be unregistered */ + pVOID arg /* user-defined arg to callback */ + ); + +STATUS usbPrinterSioChanLock + ( + SIO_CHAN *pChan /* SIO_CHAN to be marked as in use */ + ); + +STATUS usbPrinterSioChanUnlock + ( + SIO_CHAN *pChan /* SIO_CHAN to be marked as unused */ + ); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbPrinterLibh */ + + +/* End of file. */ + diff --git a/h/drv/usb/usbSpeakerLib.h b/h/drv/usb/usbSpeakerLib.h new file mode 100644 index 0000000..aa8ff06 --- /dev/null +++ b/h/drv/usb/usbSpeakerLib.h @@ -0,0 +1,198 @@ +/* usbSpeakerLib.h - Definitions for USB speaker class driver */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01e,18sep01,wef merge from wrs.tor2_0.usb1_1-f for veloce +01d,07may01,wef changed module number to be (module num << 8) | M_usbHostLib +01c,02may01,wef changed module number to be M_ + M_usbHostLib +01b,05dec00,wef moved Module number defs to vwModNum.h - add this + to #includes +01a,12jan00,rcb First. +*/ + +#ifndef __INCusbSpeakerLibh +#define __INCusbSpeakerLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include "seqIo.h" +#include "usb/usbPlatform.h" +#include "vwModNum.h" /* USB Module Number Def's */ + + +/* defines */ + +/* usbSpeakerLib error values */ + +/* + * USB errnos are defined as being part of the USB host Module, as are all + * vxWorks module numbers, but the USB Module number is further divided into + * sub-modules. Each sub-module has upto 255 values for its own error codes + */ + +#define USB_SPEAKER_SUB_MODULE 9 + +#define M_usbSpeakerLib ( (USB_SPEAKER_SUB_MODULE << 8) | M_usbHostLib ) + +#define usbSpkrErr(x) (M_usbSpeakerLib | (x)) + +#define S_usbSpeakerLib_NOT_INITIALIZED usbSpkrErr (1) +#define S_usbSpeakerLib_BAD_PARAM usbSpkrErr (2) +#define S_usbSpeakerLib_OUT_OF_MEMORY usbSpkrErr (3) +#define S_usbSpeakerLib_OUT_OF_RESOURCES usbSpkrErr (4) +#define S_usbSpeakerLib_GENERAL_FAULT usbSpkrErr (5) +#define S_usbSpeakerLib_NOT_IMPLEMENTED usbSpkrErr (6) +#define S_usbSpeakerLib_USBD_FAULT usbSpkrErr (7) +#define S_usbSpeakerLib_NOT_REGISTERED usbSpkrErr (8) +#define S_usbSpeakerLib_NOT_LOCKED usbSpkrErr (9) + + +/* USB_SPKR_xxxx define "attach codes" used by USB_SPKR_ATTACH_CALLBACK. */ + +#define USB_SPKR_ATTACH 0 /* new speaker attached */ +#define USB_SPKR_REMOVE 1 /* speaker has been removed */ + /* SEQ_DEV no longer valid */ + + +/* IOCTL codes unique to usbSpeakerLib. */ + +#define USB_SPKR_IOCTL_GET_FORMAT_COUNT 0x8000 +#define USB_SPKR_IOCTL_GET_FORMAT_LIST 0x8001 + +#define USB_SPKR_IOCTL_GET_CHANNEL_COUNT 0x8010 +#define USB_SPKR_IOCTL_GET_CHANNEL_CONFIG 0x8011 +#define USB_SPKR_IOCTL_GET_CHANNEL_CAPS 0x8012 + +#define USB_SPKR_IOCTL_SET_AUDIO_FORMAT 0x8020 +#define USB_SPKR_IOCTL_OPEN_AUDIO_STREAM 0x8021 +#define USB_SPKR_IOCTL_CLOSE_AUDIO_STREAM 0x8022 +#define USB_SPKR_IOCTL_AUDIO_STREAM_STATUS 0x8023 + +#define USB_SPKR_IOCTL_SET_MUTE 0x8030 +#define USB_SPKR_IOCTL_SET_VOLUME 0x8031 +#define USB_SPKR_IOCTL_SET_BASS 0x8032 +#define USB_SPKR_IOCTL_SET_MID 0x8033 +#define USB_SPKR_IOCTL_SET_TREBLE 0x8034 + + +/* Status bit mask returned by USB_SPKR_IOCTL_AUDIO_STREAM_STATUS. */ + +#define USB_SPKR_STATUS_OPEN 0x0001 +#define USB_SPKR_STATUS_DATA_IN_BFR 0x0002 + + +/* typedefs */ + +/* USB_SPKR_ATTACH_CALLBACK defines a callback routine which will be + * invoked by usbSpeakerLib.c when the attachment or removal of a speaker + * is detected. When the callback is invoked with an attach code of + * USB_SPKR_ATTACH, the pSeqDev points to a newly created SEQ_DEV. When + * the attach code is USB_SPKR_REMOVE, the pSeqDev points to a pSeqDev + * for a speaker which is no longer attached. + */ + +typedef VOID (*USB_SPKR_ATTACH_CALLBACK) + ( + pVOID arg, /* caller-defined argument */ + SEQ_DEV *pSeqDev, /* pointer to affected SEQ_DEV */ + UINT16 attachCode /* defined as USB_SPKR_xxxx */ + ); + + +/* USB_SPKR_CTL_CAPS defines the capabilities of a given speaker control */ + +typedef struct usb_spkr_ctl_caps + { + BOOL supported; /* true if capability supported */ + UINT16 res; /* resolution of capability */ + INT16 min; /* minimum setting */ + INT16 max; /* maximum setting */ + INT16 cur; /* current setting */ + } USB_SPKR_CTL_CAPS, *pUSB_SPKR_CTL_CAPS; + + +/* USB_SPKR_CHANNEL_CAPS defines the audio capabilities for a given channel. */ + +typedef struct usb_spkr_channel_caps + { + UINT16 capsLen; /* length of this structure */ + + USB_SPKR_CTL_CAPS mute; /* mute */ + USB_SPKR_CTL_CAPS volume; /* volume */ + USB_SPKR_CTL_CAPS bass; /* bass */ + USB_SPKR_CTL_CAPS mid; /* mid-range */ + USB_SPKR_CTL_CAPS treble; /* treble */ + + } USB_SPKR_CHANNEL_CAPS, *pUSB_SPKR_CHANNEL_CAPS; + + +/* USB_SPKR_AUDIO_FORMAT defines an audio format supported by the speaker. */ + +typedef struct usb_spkr_audio_format + { + UINT8 interface; /* interface number */ + UINT8 altSetting; /* alternate setting for this fmt */ + UINT8 delay; /* internal delay on this endpoint */ + UINT8 endpoint; /* endpoint to receive data */ + UINT16 maxPacketSize; /* max packet size for endpoint */ + UINT16 formatTag; /* format tag */ + UINT8 formatType; /* type I, II, or III. */ + + /* fields for Type I & III formats */ + UINT8 channels; /* number of channels */ + UINT8 subFrameSize; /* size of audio sub frame */ + UINT8 bitRes; /* bit resolution per sample */ + UINT32 sampleFrequency; /* frequency specified by caller */ + + /* Fields for Type II formats */ + UINT16 maxBitRate; /* max bps supported by interface */ + UINT16 samplesPerFrame; /* nbr of audio samples per frame */ + + } USB_SPKR_AUDIO_FORMAT, *pUSB_SPKR_AUDIO_FORMAT; + + +/* function prototypes */ + +STATUS usbSpeakerDevInit (void); +STATUS usbSpeakerDevShutdown (void); + +STATUS usbSpeakerDynamicAttachRegister + ( + USB_SPKR_ATTACH_CALLBACK callback, /* new callback to be registered */ + pVOID arg /* user-defined arg to callback */ + ); + +STATUS usbSpeakerDynamicAttachUnRegister + ( + USB_SPKR_ATTACH_CALLBACK callback, /* callback to be unregistered */ + pVOID arg /* user-defined arg to callback */ + ); + +STATUS usbSpeakerSeqDevLock + ( + SEQ_DEV *pSeqDev /* SEQ_DEV to be marked as in use */ + ); + +STATUS usbSpeakerSeqDevUnlock + ( + SEQ_DEV *pSeqDev /* SEQ_DEV to be marked as unused */ + ); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbSpeakerLibh */ + + +/* End of file. */ + diff --git a/h/drv/usb/usbTransUnit.h b/h/drv/usb/usbTransUnit.h new file mode 100644 index 0000000..0393f9e --- /dev/null +++ b/h/drv/usb/usbTransUnit.h @@ -0,0 +1,211 @@ +/* usbTransUnit.h - Translation Unit definitions */ + +/* Copyright 2003 - 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,06jan05,ami added irpMutext in USBTU_PIPE_INFO structure. (SPR #102674) +*/ + +/* +DESCRIPTION +This file defines constants and structures related to the Translation +Unit. +*/ + +#ifndef __INCusbTransUnith +#define __INCusbTransUnith + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + + +#include +#include /* general USB definitions */ +#include /* USB utility functions */ +#include /* USBD interface */ +#include /* os specific services */ +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +/* defines */ + +/* String length definition */ + +#define USBTU_NAME_LEN 32 /* Maximum length for name */ + +extern void usbLogMsg (char *,int,int,int,int,int,int); + +#ifdef DEBUG_DETAIL +#define USBTU_LOG(str) \ + usbLogMsg ( "%s (%d): %s \n ",(INT32)__FILE__, __LINE__, (int) str,0,0,0) +#else +#define USBTU_LOG(str) +#endif + + +/* Wind View Event ID's */ + +#define USBTU_WV_CLIENT_INIT 23000 /* Client Initialization event ID */ +#define USBTU_WV_CLIENT_TRANSFER 23001 /* Client Data Transfer event ID */ +#define USBTU_WV_CLIENT_STD 23002 /* Client Standard Requests event ID */ +#define USBTU_WV_USBD_INIT 23003 /* USBD Initialization/Shutdown event ID */ + +/* Wind View Event Filter */ + +#define USBTU_WV_FILTER 0x00000001 + +/* Wind View Event Log Message Size */ + +#define USBTU_WV_LOGSIZE 80 + + +/* Typedefs */ + +/* + * USBTU_EVENTCODE + */ + +typedef enum usbtu_eventcode + { + ADDDEVICE, /* device attachment event code */ + REMOVEDEVICE, /* device removal event code */ + SUSPENDDEVICE, /* device suspend event code */ + RESUMEDEVICE, /* device resume event code */ + IRPCOMPLETE /* IRP completion event code */ + } USBTU_EVENTCODE; + +/* + * USBTU_DEVICE_DRIVER + */ + +typedef struct usbtu_device_driver + { + UINT16 class; /* device class code */ + UINT16 subclass; /* device subclass code */ + UINT16 protocol; /* device protocol code */ + INT8 clientName[USBTU_NAME_LEN]; /* client name */ + USBD_ATTACH_CALLBACK attachCallback; /* attach/detach callback */ + USBD_MNGMT_CALLBACK mngmtCallback; /* managemnt callback */ + pVOID mngmtCallbackParam; /* management callback param */ + MSG_Q_ID msgQid; /* message queue id for client */ + MSG_Q_ID msgQidIrpComplete; /* message queue id for IrpComplete */ + THREAD_HANDLE threadHandle; /* thread handle */ + THREAD_HANDLE irpThreadHandle; /* thread handle */ + pUSBHST_DEVICE_DRIVER pDriverData; /* pointer to driver data */ + LINK tuDriverLink; /* pointer to next in list */ + } USBTU_DEVICE_DRIVER, *pUSBTU_DEVICE_DRIVER; + +/* + * USBTU_NODE_INFO + */ + +typedef struct usbtu_node_info + { + UINT32 hDevice; /* handle to the device */ + UINT16 configuration; /* device configuration */ + UINT16 interface; /* device interface */ + MSG_Q_ID msgQid; /* message queue id of client */ + LINK devLink; /* link */ + } USBTU_NODE_INFO, *pUSBTU_NODE_INFO; + +/* + * USBTU_IRP + */ + +typedef struct usbtu_irp + { + pUSB_IRP pIrp; + struct usbtu_irp* nextIrp; + struct usbtu_irp* prevIrp; + } USBTU_IRP, * pUSBTU_IRP; + +/* + * USBTU_PIPE_INFO + */ + +typedef struct usbtu_pipe_info + { + UINT32 hDevice; /* handle to the device */ + UINT8 endpointAddress; /* endpointaddress of pipe */ + UINT16 transferType; /* transfer type on pipe */ + pUSBTU_IRP irpList; /* list of irp pending on pipe */ + UINT8 markedForDeletion; /* indicates if pipe is marked for deletion */ + UINT32 uMaxPacketSize; /* Maximum packet size for the endpoint */ + SEM_ID pipeDelete; + UINT32 bandwidth; + MUTEX_HANDLE irpMutex; /* for synchronisation */ + } USBTU_PIPE_INFO, *pUSBTU_PIPE_INFO; + +/* + * USBTU_IRPCONTEXT + */ + +typedef struct usbtu_irpcontext + { + UINT32 urbIndex; /* index into array urbPtr */ + pUSBHST_URB urbPtr; /* array of USBHST_URB's */ + UINT32 urbCompleteCount; /* URB completion count */ + MSG_Q_ID msgQid; /* message queue id of client */ + pUSBTU_PIPE_INFO pipeInfo; /* pte to pipe info structure */ + } USBTU_IRPCONTEXT, *pUSBTU_IRPCONTEXT; + +/* + * USBTU_CLIENTMSG + */ + +typedef struct usbtu_clientmsg + { + USBTU_EVENTCODE eventCode; /* event code */ + pUSB_IRP pIrp; /* pointer to IRP structure */ + UINT32 hDevice; /* handle to device */ + UINT16 interface; /* device interface */ + }USBTU_CLIENTMSG, *pUSBTU_CLIENTMSG; + +/* + * USBTU_TUMSG + */ + +typedef struct usbtu_tumsg + { + USBTU_EVENTCODE eventCode; /* event code */ + UINT32 hDevice; /* handle to device */ + UINT16 interface; /* device interface */ + pVOID* ppDriverData; /* pointer to driver data */ + } USBTU_TUMSG, *pUSBTU_TUMSG; + + +/* global variable declarations */ + +extern UINT32 usbtuInitWvFilter; +extern LIST_HEAD usbtuClientList; /* list of clients registered with USBD */ +extern LIST_HEAD usbtuDevList; /* list of devices attached to USB */ +extern THREAD_HANDLE usbtuThreadId; /* thread id of Translation Unit thread */ +extern MSG_Q_ID usbtuMsgQid; /* message queue id of Translation Unit */ +extern MUTEX_HANDLE usbtuMutex; /* mutex of Translation Unit */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbTransUnith */ + + +/* End of file. */ + + diff --git a/h/drv/usb/usbTransUnitTypes.h b/h/drv/usb/usbTransUnitTypes.h new file mode 100644 index 0000000..412158f --- /dev/null +++ b/h/drv/usb/usbTransUnitTypes.h @@ -0,0 +1,34 @@ +/* usbtuTypes.h - Typedefines used in USB 2.0 host stack */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + + +/* +DESCRIPTION + +This file contains the data types used in the USB Host Stack +*/ +#ifndef __INCusbtuTypesh +#define __INCusbtuTypesh + +/* typedefs */ + + +#ifdef TYPE_REDEFINED +typedef enum _BOOLEAN + { + FALSE = 0, + TRUE + }BOOLEAN; +#else +typedef long BOOLEAN; +#endif + + + +typedef void * PVOID; +typedef unsigned char* PUCHAR; +typedef unsigned int *PUINT32; + +#endif /* __INCusbtuTypesh */ +/* end of file. */ diff --git a/h/drv/usb/usbUhci.h b/h/drv/usb/usbUhci.h new file mode 100644 index 0000000..1261879 --- /dev/null +++ b/h/drv/usb/usbUhci.h @@ -0,0 +1,416 @@ +/* usbUhci.h - UHCI hardware interface definitions */ + +/* Copyright 2000 Wind River Systems, Inc. */ +/* +Modification history +-------------------- +01b,10may99,rcb Update style per suggestions from Claudio at WRS. +01a,27apr99,rcb First. +*/ + +#ifndef __INCusbUhcih +#define __INCusbUhcih + +#ifdef __cplusplus +extern "C" { +#endif + +/* +DESCRIPTION + +Defines the USB UHCI (Universal Host Controller Interface) register file +interface and memory structures shared between USB software and the UHCI +hardware. + +Please refer to Intel's UHCI specification, Revision 1.1 or later, for more +information. + +NOTE: The memory structures must not be padded, so the compiler must be +set to use the "no packing" or "0-byte packing" option. Compile-time checks +are included in this file to ensure that structures compile to the correct +size. +*/ + + +/*************************************************************************** + * Register Definitions + ***************************************************************************/ + +/* + * UHCI registers in the regular I/O address space. + */ + +#define UHCI_USBCMD 0x0 /* r/w WORD USB Command */ +#define UHCI_USBSTS 0x2 /* r/wc WORD USB Status */ +#define UHCI_USBINTR 0x4 /* r/w WORD USB Interrupt Enable */ +#define UHCI_FRNUM 0x6 /* r/w WORD Frame Number */ +#define UHCI_FRBASEADD 0x8 /* r/w DWORD Frame List Base Address */ +#define UHCI_SOFMOD 0xc /* r/w BYTE Start of Frame Modify */ +#define UHCI_PORTSC1 0x10 /* r/wc WORD Port 1 Status/Control */ +#define UHCI_PORTSC2 0x12 /* r/wc WORD Port 2 Status/Control */ + +/* + * PCI registers relevant to UHCI in configuration space. + */ + +#define UHCI_PCI_CLASSC 0x9 /* r/o 24-bits Class Code Register */ +#define UHCI_PCI_USBBASE 0x20 /* r/w DWORD IO Space Base Address */ +#define UHCI_PCI_SBRN 0x60 /* r/o BYTE Serial Bus Release No. */ + +/* + * UHCI_USBCMD register definition. + */ + +#define UHCI_CMD_MAXP 0x0080 /* Max Packet */ + /* 1=64 bytes, 0=32 bytes */ +#define UHCI_CMD_CF 0x0040 /* Configure Flag */ +#define UHCI_CMD_SWDBG 0x0020 /* Software Debug. */ + /* 1=debug mode, 0=normal mode */ +#define UHCI_CMD_FGR 0x0010 /* Force Global Resume. */ + /* 1=host ctlr sends global resume */ +#define UHCI_CMD_EGSM 0x0008 /* Enter Global Suspect Mode */ + /* 1=host ctlr enters global suspend */ +#define UHCI_CMD_GRESET 0x0004 /* Global reset */ + /* 1=host ctlr sends global reset */ +#define UHCI_CMD_HCRESET 0x0002 /* Host Controller Reset */ + /* 1=host ctlr reset */ +#define UHCI_CMD_RS 0x0001 /* Run/Stop. */ + /* 1=run, 0=stop */ + + +/* + * UHCI_USBSTS register definition. + */ + +#define UHCI_STS_HALTED 0x0020 /* Host Controller Halted */ +#define UHCI_STS_PROCERR 0x0010 /* Host Controller Process Error */ +#define UHCI_STS_HOSTERR 0x0008 /* Host System Error */ +#define UHCI_STS_RESUME 0x0004 /* Resume Detect */ +#define UHCI_STS_USBERR 0x0002 /* USB Error Interrupt */ +#define UHCI_STS_USBINT 0x0001 /* USB Interrupt */ + +/* + * UHCI_USBINTR register definition. + */ + +#define UHCI_INTR_SHORT 0x0008 /* Short Packet Interrupt Enable */ + /* 1=Enabled, 0=Disabled */ +#define UHCI_INTR_COMPLETE 0x0004 /* Interrupt On Complete Enable */ + /* 1=Enabled, 0=Disabled */ +#define UHCI_INTR_RESUME 0x0002 /* Resume Interrupt Enable */ + /* 1=Enabled, 0=Disabled */ +#define UHCI_INTR_TIME_CRC 0x0001 /* Timeout/CRC Interrupt Enable */ + /* 1=Enabled, 0=Disabled */ + +/* + * UHCI_FRNUM register definition. + */ + +#define UHCI_FRN_MASK 0x07ff /* The low 11-bits of UHCI_FRNUM contain */ + /* the current USB frame number. */ + +/* + * UHCI_FLBASEADD register definition. + * + * Bits 31:12 of this register define bits 31:12, respectively, of the base + * address of the UHCI frame list in physical memory. The frame list must be + * aligned on a 4k boundary. + */ + + +/* + * UHCI_SOFMOD register definition. + */ + +#define UHCI_SOF_MASK 0x7f /* The low 7-bits of UHCI_SOFMOD contain */ + /* a count from 0..127 which is added to */ + /* UHCI_SOF_BASE to determine start-of- */ + /* frame timing. */ + +#define UHCI_SOF_BASE 11936 /* Base value for start-of-frame timing */ +#define UHCI_SOF_MAX 12063 /* max value for start-of-frame timing */ +#define UHCI_SOF_DEFAULT 64 /* UHCI_SOFMOD defaults to 64, yielding */ + /* a default start-of-frame timing of */ + /* 11936+64 = 12000. */ + +/* + * UHCI_PORTSCn register definition. + */ + +#define UHCI_PORT_SUSPEND 0x1000 /* Suspend state */ + /* 1=port in suspend, 0=not suspended */ +#define UHCI_PORT_RESET 0x0200 /* Port reset */ + /* 1=Port is in reset, 0=port not reset */ +#define UHCI_PORT_LOWSPEED 0x0100 /* Low Speed Device Attached */ + /* 1=low speed dev, 0=full speed dev */ +#define UHCI_PORT_RESUME 0x0040 /* Resume Detect */ + /* 1=resume detected/driven, 0=no resume */ +#define UHCI_PORT_LINESTS 0x0030 /* Line Status */ + /* bit 4=D+, bit 5=D- logical levels */ +#define UHCI_PORT_ENBCHG 0x0008 /* Port Enable/Disable Change */ + /* 1=port status changed, 0=no change */ +#define UHCI_PORT_ENABLE 0x0004 /* Port Enabled/Disabled */ + /* 1=Enable, 0=Disable */ +#define UHCI_PORT_CNCTCHG 0x0002 /* Connect Status Change */ + /* 1=Connect status changed, 0=no change */ +#define UHCI_PORT_CNCTSTS 0x0001 /* Current Connect Status */ + /* 1=Device present, 0=no device */ + +/* + * UHCI_PCI_CLASSC register definition. + */ + +#define UHCI_CLASSC_BASEC_MASK 0xff0000 /* Base class code mask */ +#define UHCI_CLASSC_BASEC_ROT 16 /* Base class code bit loc */ + +#define UHCI_CLASSC_SCC_MASK 0x00ff00 /* Sub-Class code mask */ +#define UHCI_CLASSC_SCC_ROT 8 /* Sub-Class code bit loc */ + +#define UHCI_CLASSC_PI_MASK 0x0000ff /* Programming Interface mask */ +#define UHCI_CLASSC_PI_ROT 0 /* Programming Interface bit loc */ + +/* Macros to retrieve class code fields */ + +#define UHCI_CLASSC_BASEC(x) \ + (((x) & UHCI_CLASSC_BASEC_MASK) >> UHCI_CLASSC_BASEC_ROT) + +#define UHCI_CLASSC_SCC(x) \ + (((x) & UHCI_CLASSC_SCC_MASK) >> UHCI_CLASSC_SCC_ROT) + +#define UHCI_CLASSC_PI(x) \ + (((x) & UHCI_CLASSC_PI_MASK) >> UHCI_CLASSC_PI_ROT) + +#define UHCI_CLASS 0x0c /* BASEC value for serial bus */ +#define UHCI_SUBCLASS 0x03 /* SCC value for USB */ +#define UHCI_PGMIF 0x00 /* no specific pgm i/f defined */ + + +/* + * UHCI_PCI_USBBASE register definition. + */ + +#define UHCI_USBBASE_MASK 0x0000ffe0 /* Bits 15:5 define I/O base */ + +/* Macro to retrieve base address */ + +#define UHCI_USBBASE(x) ((x) & UHCI_USBBASE_MASK) + + +/* + * UHCI_PCI_SBRN register definition. + * + * Bits 7:0 define the USB release number supported by the host controller + */ + +#define UHCI_SBRN_PREREL 0x00 /* Pre-release 1.0 */ +#define UHCI_SBRN_REL10 0x10 /* Release 1.0 */ + + +/* number of ports on a UHC */ + +#define UHCI_PORTS 2 + + +/* + * UHCI_FRAME_WINDOW defines the maximum number of frames "into the future" + * for which an isochronous transfer may be scheduled. + */ + +#define UHCI_FRAME_WINDOW 1024 /* 1024 entries in frame list */ + + +/* values for emulated UHC hub descriptor */ + +#define UHCI_PWR_ON_2_PWR_GOOD 1 /* = 2msec for pwr on to pwr good */ +#define UHCI_HUB_CONTR_CURRENT 0 /* 0 mA for hub ctlr current */ +#define UHCI_HUB_INTERVAL 0xff /* hub service interval */ + + +/*************************************************************************** + * Memory Structure Definitions + ***************************************************************************/ + +/* + * UHCI link pointers, including frame list pointers and the pointers found + * in UHCI_TD and UHCI_QH structures, use the same basic structure as defined + * below. The exception is the VF (Depth/Breadth select) which is only used + * in the UHCI_TD structure. + */ + +#define UHCI_LINK_PTR_MASK 0xfffffff0 /* Adrs of first obj */ + +#define UHCI_LINK_VF 0x00000004 /* Depth/Breadth select */ + /* 1=Depth first, 0=breadth first */ + +#define UHCI_LINK_QH 0x00000002 /* QH/TD Select */ +#define UHCI_LINK_TD 0x00000000 /* 1=QH, 0=TD */ + +#define UHCI_LINK_TERMINATE 0x00000001 /* Terminate */ + /* 1=End of list, 0=pointer valid */ + + +/* the UHCI frame list has 1024 entries (1024 @ 4 bytes each = 4k) */ + +#define UHCI_FRAME_LIST_ENTRIES 1024 +#define UHCI_FRAME_LIST_ALIGNMENT 4096 + +#define UHCI_TD_ALIGNMENT 16 +#define UHCI_QH_ALIGNMENT 16 + + +/* + * UHCI_FRAME_LIST + * + * NOTE: Frame list must be allocated on a 4k page boundary + */ + +typedef struct uhci_frame_list + { + UINT32 linkPtr [UHCI_FRAME_LIST_ENTRIES]; /* pointers to TD or QH */ + } UHCI_FRAME_LIST, *pUHCI_FRAME_LIST; + + +/* + * Transfer Descriptor. + * + * NOTE: Each TD must be aligned on a 16-byte boundary. + */ + +typedef struct uhci_td + { + UINT32 linkPtr; /* Link Pointer to another TD or QH */ + UINT32 ctlSts; /* Control and Status */ + UINT32 token; /* Token for packet header */ + UINT32 bfrPtr; /* Data buffer pointer */ + UINT32 software [4]; /* 4 DWORDs reserved for software */ + } UHCI_TD, *pUHCI_TD; + +#define UHCI_TD_LEN 32 /* TD length required by UHCI hardware */ +#define UHCI_TD_ACTLEN sizeof (UHCI_TD) + +/* + * UHCI_TD.CtlSts definition. + */ + +#define UHCI_TDCS_SHORT 0x20000000 /* Short Packet Detect */ + /* 1=Enable, 0=Disable */ + +#define UHCI_TDCS_ERRCTR_MASK 0x18000000 /* Error Counter Mask */ +#define UHCI_TDCS_ERRCTR_NOLIM 0x00000000 /* No limit */ +#define UHCI_TDCS_ERRCTR_1ERR 0x08000000 /* 1 error */ +#define UHCI_TDCS_ERRCTR_2ERR 0x10000000 /* 2 errors */ +#define UHCI_TDCS_ERRCTR_3ERR 0x18000000 /* 3 errors */ + +#define UHCI_TDCS_LOWSPEED 0x04000000 /* Low Speed Device */ + /* 1=low speed dev, 0=full speed */ +#define UHCI_TDCS_ISOCH 0x02000000 /* Isochronous Select */ + /* 1=isoch TD, 0=non-isoch TD */ +#define UHCI_TDCS_COMPLETE 0x01000000 /* Interrupt on Complete */ + /* 1=Issue IOC */ + + /* Cmd execution status bits */ +#define UHCI_TDCS_STS_ACTIVE 0x00800000 /* Active */ +#define UHCI_TDCS_STS_STALLED 0x00400000 /* Stalled */ +#define UHCI_TDCS_STS_DBUFERR 0x00200000 /* Data buffer error */ +#define UHCI_TDCS_STS_BABBLE 0x00100000 /* Babble Detected */ +#define UHCI_TDCS_STS_NAK 0x00080000 /* NAK Received */ +#define UHCI_TDCS_STS_TIME_CRC 0x00040000 /* CRC/Timeout error */ +#define UHCI_TDCS_STS_BITSTUFF 0x00020000 /* Bitstuff error */ + +#define UHCI_TDCS_ACTLEN_MASK 0x000007ff /* Actual Length mask */ +#define UHCI_TDCS_ACTLEN_ROT 0 /* Actual length bit loc */ + +#define UHCI_PACKET_SIZE_MASK 0x000007ff /* Mask for 11-bit field */ + + +/* Macro to retrieve UHCI_TDCS_ACTLEN + * + * NOTE: UHCI actlen is one less than the real length. + * The macro compensates automatically. + */ + +#define UHCI_TDCS_ACTLEN(x) \ + ((((x) >> UHCI_TDCS_ACTLEN_ROT) + 1) & UHCI_PACKET_SIZE_MASK) + + +/* + * UHCI_TD.Token definition. + */ + +#define UHCI_TDTOK_MAXLEN_MASK 0xffe00000 /* Maximum length mask */ +#define UHCI_TDTOK_MAXLEN_ROT 21 /* Maximum length bit loc */ + +#define UHCI_TDTOK_DATA_TOGGLE 0x00080000 /* Data Toggle */ + /* 0=DATA0, 1=DATA1 */ + +#define UHCI_TDTOK_ENDPT_MASK 0x00078000 /* Endpoint Mask */ +#define UHCI_TDTOK_ENDPT_ROT 15 /* Endpoint bit loc */ + +#define UHCI_TDTOK_DEVADRS_MASK 0x00007f00 /* Device Address Mask */ +#define UHCI_TDTOK_DEVADRS_ROT 8 /* Device Address bit loc */ + +#define UHCI_TDTOK_PID_MASK 0x000000ff /* Packet ID mask */ +#define UHCI_TDTOK_PID_ROT 0 /* Packet ID bit loc */ + + +/* Macros to retrieve/format UHCI_TDTOK_MAXLEN + * + * NOTE: UHCI maxlen is one less than the real length. The macro + * compensates automatically. + */ + +#define UHCI_TDTOK_MAXLEN(x) \ + ((((x) >> UHCI_TDTOK_MAXLEN_ROT) + 1) & UHCI_PACKET_SIZE_MASK) + +#define UHCI_TDTOK_MAXLEN_FMT(x) \ + ((((x) - 1) & UHCI_PACKET_SIZE_MASK) << UHCI_TDTOK_MAXLEN_ROT) + +/* Macros to retrieve/format UHCI_TDTOK_ENDPT */ + +#define UHCI_TDTOK_ENDPT(x) \ + (((x) & UHCI_TDTOK_ENDPT_MASK) >> UHCI_TDTOK_ENDPT_ROT) + +#define UHCI_TDTOK_ENDPT_FMT(x) \ + (((x) << UHCI_TDTOK_ENDPT_ROT) & UHCI_TDTOK_ENDPT_MASK) + +/* Macros to retrieve/format UHCI_TDTOK_DEVADRS */ + +#define UHCI_TDTOK_DEVADRS(x) \ + (((x) & UHCI_TDTOK_DEVADRS_MASK) >> UHCI_TDTOK_DEVADRS_ROT) + +#define UHCI_TDTOK_DEVADRS_FMT(x) \ + (((x) << UHCI_TDTOK_DEVADRS_ROT) & UHCI_TDTOK_DEVADRS_MASK) + +/* Macros to retrieve/format UHCI_TDTOK_PID */ + +#define UHCI_TDTOK_PID(x) \ + (((x) & UHCI_TDTOK_PID_MASK) >> UHCI_TDTOK_PID_ROT) + +#define UHCI_TDTOK_PID_FMT(x) \ + (((x) << UHCI_TDTOK_PID_ROT) & UHCI_TDTOK_PID_MASK) + +/* + * Queue Head. + * + * NOTE: Each Queue Head (QH) must be aligned on a 16-byte boundary. + */ + +typedef struct uhci_qh + { + UINT32 qhLink; /* Link pointer to next QH */ + UINT32 tdLink; /* Link to queue element */ + } UHCI_QH, *pUHCI_QH; + +#define UHCI_QH_LEN 8 /* QH length required by UHCI hardware */ +#define UHCI_QH_ACTLEN sizeof (UHCI_QH) + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbUhcih */ + + +/* End of file. */ + diff --git a/h/drv/vme/busLocal.h b/h/drv/vme/busLocal.h new file mode 100644 index 0000000..064b432 --- /dev/null +++ b/h/drv/vme/busLocal.h @@ -0,0 +1,48 @@ +/* busLocal.h - sysBusToLocal/sysLocalToBus header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,22sep92,rrr added support for c++ +01a,16jun92,ccc created. +*/ + +/* +DESCRIPTION +This file contains header information for the sysBusToLocal() and +sysLocalToBus() routines. +*/ + +#ifndef __INCbusLocalh +#define __INCbusLocalh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +#ifndef _ASMLANGUAGE +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT STATUS sysLocalToBusAdrs (int adrsSpace, char *localAdrs, + char **pBusAdrs); +IMPORT STATUS sysBusToLocalAdrs (int adrsSpace, char *busAdrs, + char **pLocalAdrs); + +#else /* __STDC__ */ + +IMPORT STATUS sysLocalToBusAdrs (); +IMPORT STATUS sysBusToLocalAdrs (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCbusLocalh */ diff --git a/h/drv/vme/dga001Vme.h b/h/drv/vme/dga001Vme.h new file mode 100644 index 0000000..5355b98 --- /dev/null +++ b/h/drv/vme/dga001Vme.h @@ -0,0 +1,529 @@ +/* dga001Vme.h - Densan DGA-001 VMEbus Interface Controller */ + +/* Copyright 1994-1997 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01l,12jul97,hk renamed as dga001Vme.h from drv/multi/dga001.h. +01k,15jan96,hk added support for DVE-SH7043. +01j,10nov95,hk changed CSR to DGA_CSR. +01i,09nov95,hk fixed CSR1_1_RRS, but not used. did some code reviewing. +01h,04jul95,hk modified some macro names. +01g,07jun95,hk changed CSR20/CSR21 bit defs. copyright to '95. +01f,15dec94,sa wrote CSR13_0, CSR15_0, CSR16_0, CSR17, IFR0, IFR1, IFR3. +01e,14nov94,hk wrote CSR18_1. +01d,09nov94,sa write CSR12, CSR14 and CSR23. +01c,19oct94,sa write CSR19 to CSR21 +01b,08sep94,sa write to CSR7 +01a,07sep94,sa derived from 01e of vmechip.h. +*/ + +#ifdef DOC +#define INCdga001Vmeh +#endif /* DOC */ + +#ifndef __INCdga001Vmeh +#define __INCdga001Vmeh + +#ifdef __cplusplus +extern "C" { +#endif + +/* +This file contains constants for the Densan DGA-001 VMEbus Interface. +The macro DGA001_BASE_ADRS must be defined when using local bus addresses +defined in this header. The macro IFR_BUS_BASE_ADRS must be defined when +using VMEbus addresses defined in this header. + +The following standards have been adopted in the creation of this file. + +Registers in the CSR have the prefix "DGA_CSR". And "DGA_CSR0_0" means most +low address of CSR0 register. + +Registers in the IFR have the prefix "DGA_IFR" when addressed locally and +the prefix "IFR_BUS" when addressed from the VMEbus. The bit definitions +are shared. + +The registers are listed in ascending (numerical) order; the definitions +for each register start with a header, e.g.: + + Register Register Register Register + Mnemonic Number Address Name + | | | | + v v v v +/@*********************************************************************** +* CSR0_0 0x00 0x00 local bus control and status* +***********************************************************************@/ + +The format of the definitions is as follows. The define name always +starts with the register mnemonic it is associated with. The [7-0] +number at the end of the comment indicates the bit position to which the +the define applies. In the definition of PURSTF, for example, the 7 +indicates bit 7: + | + v +#define CSR1_0_PURSTF 0x80 /@ power-up status bit 7 @/ + +If the define applies to more than one bit, then the applicable bit +range is specified by two digits. In the following example, +CSR0_LBT applies to the two bit field, bits 5-4: + | + v +#define CSR0_0_LBT 0x10 /@ local bus time-out (mask) 54 @/ + +If no bit field is given, then the define applies to the whole register. +*/ + + +#define DGA001_LONG_ADRS(offset) \ + ((volatile UINT32 *)(DGA001_BASE_ADRS + offset)) + +#if defined(TARGET_DVE7604) || defined(TARGET_DVE7043) +#define DGA001_BYTE_ADRS(offset) \ + ((volatile UINT8 *)(DGA001_BASE_ADRS + DGA001_BYTE_ACCESS_OFFSET + offset)) +#else +#define DGA001_BYTE_ADRS(offset) \ + ((volatile UINT8 *)(DGA001_BASE_ADRS + offset)) +#endif /* TARGET_DVE7604 */ + +/* + * Control and Status Register (CSR) definitions. + * + * only the local CPU can access the LCSR. + */ + +#define DGA_CSR0 DGA001_LONG_ADRS(0x00) +#define DGA_CSR0_0 DGA001_BYTE_ADRS(0x00) +#define DGA_CSR0_1 DGA001_BYTE_ADRS(0x01) +#define DGA_CSR0_2 DGA001_BYTE_ADRS(0x02) +#define DGA_CSR0_3 DGA001_BYTE_ADRS(0x03) +#define DGA_CSR1 DGA001_LONG_ADRS(0x04) +#define DGA_CSR1_0 DGA001_BYTE_ADRS(0x04) +#define DGA_CSR1_1 DGA001_BYTE_ADRS(0x05) +#define DGA_CSR1_2 DGA001_BYTE_ADRS(0x06) +#define DGA_CSR1_3 DGA001_BYTE_ADRS(0x07) +#define DGA_CSR2 DGA001_LONG_ADRS(0x08) +#define DGA_CSR2_0 DGA001_BYTE_ADRS(0x08) +#define DGA_CSR2_1 DGA001_BYTE_ADRS(0x09) +#define DGA_CSR2_2 DGA001_BYTE_ADRS(0x0a) +#define DGA_CSR2_3 DGA001_BYTE_ADRS(0x0b) +#define DGA_CSR3 DGA001_LONG_ADRS(0x0c) +#define DGA_CSR3_0 DGA001_BYTE_ADRS(0x0c) +#define DGA_CSR3_1 DGA001_BYTE_ADRS(0x0d) +#define DGA_CSR3_2 DGA001_BYTE_ADRS(0x0e) +#define DGA_CSR3_3 DGA001_BYTE_ADRS(0x0f) +#define DGA_CSR4 DGA001_LONG_ADRS(0x10) +#define DGA_CSR4_0 DGA001_BYTE_ADRS(0x10) +#define DGA_CSR4_1 DGA001_BYTE_ADRS(0x11) +#define DGA_CSR4_2 DGA001_BYTE_ADRS(0x12) +#define DGA_CSR4_3 DGA001_BYTE_ADRS(0x13) +#define DGA_CSR5 DGA001_LONG_ADRS(0x14) +#define DGA_CSR5_0 DGA001_BYTE_ADRS(0x14) +#define DGA_CSR5_1 DGA001_BYTE_ADRS(0x15) +#define DGA_CSR5_2 DGA001_BYTE_ADRS(0x16) +#define DGA_CSR5_3 DGA001_BYTE_ADRS(0x17) +#define DGA_CSR6 DGA001_LONG_ADRS(0x18) +#define DGA_CSR6_0 DGA001_BYTE_ADRS(0x18) +#define DGA_CSR6_1 DGA001_BYTE_ADRS(0x19) +#define DGA_CSR6_2 DGA001_BYTE_ADRS(0x1a) +#define DGA_CSR6_3 DGA001_BYTE_ADRS(0x1b) +#define DGA_CSR7 DGA001_LONG_ADRS(0x1c) +#define DGA_CSR7_0 DGA001_BYTE_ADRS(0x1c) +#define DGA_CSR7_1 DGA001_BYTE_ADRS(0x1d) +#define DGA_CSR7_2 DGA001_BYTE_ADRS(0x1e) +#define DGA_CSR7_3 DGA001_BYTE_ADRS(0x1f) +#define DGA_CSR8 DGA001_LONG_ADRS(0x21) +#define DGA_CSR9 DGA001_LONG_ADRS(0x24) +#define DGA_CSR10 DGA001_LONG_ADRS(0x28) +#define DGA_CSR10_0 DGA001_BYTE_ADRS(0x28) +#define DGA_CSR10_1 DGA001_BYTE_ADRS(0x29) +#define DGA_CSR10_2 DGA001_BYTE_ADRS(0x2a) +#define DGA_CSR10_3 DGA001_BYTE_ADRS(0x2b) +#define DGA_CSR11 DGA001_LONG_ADRS(0x2c) +#define DGA_CSR11_0 DGA001_BYTE_ADRS(0x2c) +#define DGA_CSR11_1 DGA001_BYTE_ADRS(0x2d) +#define DGA_CSR11_2 DGA001_BYTE_ADRS(0x2e) +#define DGA_CSR11_3 DGA001_BYTE_ADRS(0x2f) +#define DGA_CSR12 DGA001_LONG_ADRS(0x30) +#define DGA_CSR13 DGA001_LONG_ADRS(0x34) +#define DGA_CSR14 DGA001_LONG_ADRS(0x38) +#define DGA_CSR15 DGA001_LONG_ADRS(0x3c) +#define DGA_CSR16 DGA001_LONG_ADRS(0x40) +#define DGA_CSR17 DGA001_LONG_ADRS(0x44) +#define DGA_CSR18 DGA001_LONG_ADRS(0x48) +#define DGA_CSR18_1 DGA001_BYTE_ADRS(0x49) +#define DGA_CSR18_2 DGA001_BYTE_ADRS(0x4a) +#define DGA_CSR18_3 DGA001_BYTE_ADRS(0x4b) +#define DGA_CSR19 DGA001_LONG_ADRS(0x4c) +#define DGA_CSR19_0 DGA001_BYTE_ADRS(0x4c) +#define DGA_CSR19_1 DGA001_BYTE_ADRS(0x4d) +#define DGA_CSR19_2 DGA001_BYTE_ADRS(0x4e) +#define DGA_CSR19_3 DGA001_BYTE_ADRS(0x4f) +#define DGA_CSR20 DGA001_LONG_ADRS(0x50) +#define DGA_CSR21 DGA001_LONG_ADRS(0x54) +#define DGA_CSR22 DGA001_LONG_ADRS(0x58) +#define DGA_CSR23 DGA001_LONG_ADRS(0x5c) +#define DGA_CSR24 DGA001_LONG_ADRS(0x60) +#define DGA_CSR25 DGA001_LONG_ADRS(0x64) +#define DGA_CSR26 DGA001_LONG_ADRS(0x68) +#define DGA_CSR27 DGA001_LONG_ADRS(0x6c) + +/* + * Interface Register (IFR) definitions. + * + * All registers of the IFR are accessible to both the local processor + * and to other VMEbus masters. + */ + +#define DGA_IFR0 DGA001_LONG_ADRS(0x70) +#define DGA_IFR1 DGA001_LONG_ADRS(0x74) +#define DGA_IFR2 DGA001_LONG_ADRS(0x78) +#define DGA_IFR3 DGA001_LONG_ADRS(0x7c) + +/************************************************************************* +* CSR0_0 0x00 0x00 local bus control * +*************************************************************************/ + +#define CSR0_0_LBT_DIS 0x30 /* local bus time-out disable 5-4 */ +#define CSR0_0_LBT_256 0x20 /* local bus time-out 256 clks 5-4 */ +#define CSR0_0_LBT_128 0x10 /* local bus time-out 128 clks 5-4 */ +#define CSR0_0_LBT_64 0x00 /* local bus time-out 64 clks 5-4 */ + +#define CSR0_0_TAOUTE 0x08 /* local bus TAOUT enable 3 */ + +/************************************************************************* +* CSR0_1 0x00 0x01 bus error control and status * +*************************************************************************/ + +#define CSR0_1_BERDYO 0x80 /* activate RDYO# upon bus error 7 */ + +#define CSR0_1_LBTOUT 0x04 /* local bus time-out (status) 2 */ +#define CSR0_1_RQTOUT 0x02 /* request time-out (status) 1 */ +#define CSR0_1_VMEBERR 0x01 /* VMEbus bus error (status) 0 */ + +/************************************************************************* +* CSR0_2 0x00 0x02 general purpose output enable * +*************************************************************************/ + +#define CSR0_2_GPOE7 0x80 /* general purpose output 7 enable 7 */ +#define CSR0_2_GPOE6 0x40 /* general purpose output 6 enable 6 */ +#define CSR0_2_GPOE5 0x20 /* general purpose output 5 enable 5 */ +#define CSR0_2_GPOE4 0x10 /* general purpose output 4 enable 4 */ +#define CSR0_2_GPOE3 0x08 /* general purpose output 3 enable 3 */ +#define CSR0_2_GPOE2 0x04 /* general purpose output 2 enable 2 */ +#define CSR0_2_GPOE1 0x02 /* general purpose output 1 enable 1 */ +#define CSR0_2_GPOE0 0x01 /* general purpose output 0 enable 0 */ + +/************************************************************************* +* CSR0_3 0x00 0x03 general purpose I/O * +*************************************************************************/ + +#define CSR0_3_GPIO7 0x80 /* general purpose I/O 7 7 */ +#define CSR0_3_GPIO6 0x40 /* general purpose I/O 6 6 */ +#define CSR0_3_GPIO5 0x20 /* general purpose I/O 5 5 */ +#define CSR0_3_GPIO4 0x10 /* general purpose I/O 4 4 */ +#define CSR0_3_GPIO3 0x08 /* general purpose I/O 3 3 */ +#define CSR0_3_GPIO2 0x04 /* general purpose I/O 2 2 */ +#define CSR0_3_GPIO1 0x02 /* general purpose I/O 1 1 */ +#define CSR0_3_GPIO0 0x01 /* general purpose I/O 0 0 */ + +/************************************************************************* +* CSR1_0 0x01 0x04 reset control and status * +*************************************************************************/ + +#define CSR1_0_PURSTF 0x80 /* power-up reset (status) 7 */ + +#define CSR1_0_RSWEN 0x40 /* reset switch enable 6 */ +#define CSR1_0_RSWSYS 0x20 /* VMEbus SYSRESET enable 5 */ + +/************************************************************************* +* CSR1_1 0x01 0x05 system controller configuration * +*************************************************************************/ + +#define CSR1_1_SYSCON 0x80 /* system controller (status) 7 */ + +#define CSR1_1_RRS 0x10 /* round robin arbitration 4 */ +#define CSR1_1_PRI 0x00 /* prioritized arbitration 4 */ + +#define CSR1_1_ARBT_DIS 0x0c /* arbitration time-out disable 3-2 */ +#define CSR1_1_ARBT_63 0x08 /* arbitration time-out 63 usec 3-2 */ +#define CSR1_1_ARBT_31 0x04 /* arbitration time-out 31 usec 3-2 */ +#define CSR1_1_ARBT_15 0x00 /* arbitration time-out 15 usec 3-2 */ + +#define CSR1_1_SBT_DIS 0x03 /* VME bus time-out disable 1-0 */ +#define CSR1_1_SBT_511 0x02 /* VME bus time-out 511 usec 1-0 */ +#define CSR1_1_SBT_255 0x01 /* VME bus time-out 255 usec 1-0 */ +#define CSR1_1_SBT_127 0x00 /* VME bus time-out 127 usec 1-0 */ + +/************************************************************************* +* CSR1_2 0x01 0x06 VMEbus requester control * +*************************************************************************/ + +#define CSR1_2_DWB 0x80 /* VMEbus request 7 */ +#define CSR1_2_OWN 0x40 /* VMEbus request (status) 6 */ + +#define CSR1_2_RQT_DIS 0x30 /* request time-out disable 5-4 */ +#define CSR1_2_RQT_1023 0x20 /* request time-out 1023 usec 5-4 */ +#define CSR1_2_RQT_511 0x10 /* request time-out 511 usec 5-4 */ +#define CSR1_2_RQT_255 0x00 /* request time-out 255 usec 5-4 */ + +#define CSR1_2_RNV 0x0c /* release never 3-2 */ +#define CSR1_2_RBC 0x08 /* release when bus clear 3-2 */ +#define CSR1_2_RWD 0x04 /* release when done 3-2 */ +#define CSR1_2_ROR 0x00 /* release on request 3-2 */ + +#define CSR1_2_BR3 0x03 /* VMEbus request level 3 1-0 */ +#define CSR1_2_BR2 0x02 /* VMEbus request level 2 1-0 */ +#define CSR1_2_BR1 0x01 /* VMEbus request level 1 1-0 */ +#define CSR1_2_BR0 0x00 /* VMEbus request level 0 1-0 */ + +/************************************************************************* +* CSR1_3 0x01 0x07 VMEbus master control * +*************************************************************************/ + +#define CSR1_3_RMC 0x80 /* read-modify-write cycle 7 */ + +#define CSR1_3_AAMEN 0x40 /* addess modifier code enable 6 */ +#define CSR1_3_AAMDIS 0x00 /* addess modifier code disable 6 */ +#define CSR1_3_AAM 0x3f /* addess modifier code (mask) 5-0 */ + +/************************************************************************* +* CSR2_0 0x02 0x08 unused * +* to * +* CSR3_1 0x03 0x0d unused * +*************************************************************************/ + +/************************************************************************* +* CSR3_2 0x03 0x0e interface register address * +*************************************************************************/ + +#define CSR3_2_IFRA_H 0xff /* interface register addess (mask) 7-0 */ + +/************************************************************************* +* CSR3_3 0x03 0x0f interface register address * +*************************************************************************/ + +#define CSR3_3_IFRA_L 0xf0 /* interface register addess (mask) 7-4 */ + +#define CSR3_3_IFRSUP 0x02 /* respond to supervisor 1 */ +#define CSR3_3_IFRUSR 0x01 /* respond to user 0 */ + +/************************************************************************* +* CSR4_01 0x04 0x10 slave address 0 * +*************************************************************************/ + +#define CSR4_01_SL0A 0xffff /* slave addess 0 (mask) 15-0 */ + +/************************************************************************* +* CSR4_23 0x04 0x12 address mask 0 * +*************************************************************************/ + +#define CSR4_23_AM0A 0xffff /* address mask 0 (mask) 15-0 */ + +/************************************************************************* +* CSR5_01 0x05 0x14 mapping address 0 * +*************************************************************************/ + +#define CSR5_01_MP0A 0xffff /* mapping address 0 (mask) 15-0 */ + +/************************************************************************* +* CSR5_23 0x05 0x16 slave control 0 * +*************************************************************************/ + +#define CSR5_23_A32EN0 0x0020 /* respond to extended 5 */ +#define CSR5_23_A24EN0 0x0010 /* respond to standard 4 */ +#define CSR5_23_SUPER0 0x0008 /* respond to supervisor 3 */ +#define CSR5_23_USER0 0x0004 /* respond to user 2 */ +#define CSR5_23_PRGRM0 0x0002 /* respond to program 1 */ +#define CSR5_23_DATA0 0x0001 /* respond to data 0 */ + +/************************************************************************* +* CSR6_01 0x06 0x18 save address 1 * +*************************************************************************/ + +#define CSR6_01_SL0A 0xffff /* slave addess 1 (mask) 15-0 */ + +/************************************************************************* +* CSR6_23 0x06 0x1a address mask 1 * +*************************************************************************/ + +#define CSR6_23_AM0A 0xffff /* address mask 1 (mask) 15-0 */ + +/************************************************************************* +* CSR7_01 0x07 0x1c mapping addess 1 * +*************************************************************************/ + +#define CSR7_01_MP0A 0xffff /* mapping address 1 (mask) 15-0 */ + +/************************************************************************* +* CSR7_23 0x07 0x1e slave control 1 * +*************************************************************************/ + +#define CSR7_23_A32EN0 0x0020 /* respond to extended 5 */ +#define CSR7_23_A24EN0 0x0010 /* respond to standard 4 */ +#define CSR7_23_SUPER0 0x0008 /* respond to supervisor 3 */ +#define CSR7_23_USER0 0x0004 /* respond to user 2 */ +#define CSR7_23_PRGRM0 0x0002 /* respond to program 1 */ +#define CSR7_23_DATA0 0x0001 /* respond to data 0 */ + +/************************************************************************* +* CSR12 0x0c 0x30 tick timer 0 control * +*************************************************************************/ + +#define CSR12_TT0CEN 0x80000000 /* tick timer 0 enable */ + +/************************************************************************* +* CSR13 0x0d 0x34 tick timer 0 counter * +*************************************************************************/ + +#define CSR13_TT0OCL 0x80000000 /* overflow counter clear */ + +/************************************************************************* +* CSR14 0x0e 0x38 tick timer 1 control * +*************************************************************************/ + +#define CSR14_TT1CEN 0x80000000 /* tick timer 1 enable */ + +/************************************************************************* +* CSR15 0x0f 0x3c tick timer 1 counter * +*************************************************************************/ + +#define CSR15_TT1OCL 0x80000000 /* overflow counter clear */ + +/************************************************************************* +* CSR16 0x10 0x40 watchdog timer control * +*************************************************************************/ + +#define CSR16_WDTCEN 0x80000000 /* watchdog timer enable */ +#define CSR16_WDTSFE 0x40000000 /* watchdog timer SYSFAIL enable*/ + +/************************************************************************* +* CSR17 0x11 0x44 watchdog timer counter * +*************************************************************************/ + +#define CSR17_WDTCLR 0x80000000 /* watchdog timer counter clear */ +#define CSR17_WDTOUT 0x01000000 /* watchdog timeout (status) */ + +/************************************************************************* +* CSR18_1 0x12 0x49 interrupt sense mode control * +*************************************************************************/ + +#define CSR18_1_ACFLVL 0x80 /* ACFAIL int level(1)/edge(0) sense 7 */ +#define CSR18_1_ABTLVL 0x40 /* ABORT int level(1)/edge(0) sense 6 */ +#define CSR18_1_SFLVL 0x20 /* SYSFAIL int level(1)/edge(0) sense 5 */ + +/************************************************************************* +* CSR20 0x14 0x50 interrupt status * +*************************************************************************/ + +#define CSR20_ACFIRQ 0x80000000 /* ACFAIL interrupt 31 */ +#define CSR20_ABTIRQ 0x40000000 /* ABORT interrupt 30 */ +#define CSR20_SFIRQ 0x20000000 /* SYSFAIL interrupt 29 */ +#define CSR20_BERIRQ 0x10000000 /* BERR interrupt 28 */ +#define CSR20_IAKIRQ 0x08000000 /* IAK interrupt 27 */ +#define CSR20_SRQIRQ 0x04000000 /* SRQ interrupt 26 */ +#define CSR20_SAKIRQ 0x02000000 /* SAKF interrupt 25 */ + +#define CSR20_GP7IRQ 0x00800000 /* GP7 interrupt 23 */ +#define CSR20_DMAIRQ 0x00400000 /* DMA interrupt 22 */ +#define CSR20_TT1IRQ 0x00200000 /* TT1 interrupt 21 */ +#define CSR20_TT0IRQ 0x00100000 /* TT0 interrupt 20 */ +#define CSR20_GP3IRQ 0x00080000 /* GP3 interrupt 19 */ +#define CSR20_GP2IRQ 0x00040000 /* GP2 interrupt 18 */ +#define CSR20_GP1IRQ 0x00020000 /* GP1 interrupt 17 */ +#define CSR20_GP0IRQ 0x00010000 /* GP0 interrupt 16 */ + +#define CSR20_SWIRQ7 0x00008000 /* SWIRQ7 interrupt 15 */ +#define CSR20_SWIRQ6 0x00004000 /* SWIRQ6 interrupt 14 */ +#define CSR20_SWIRQ5 0x00002000 /* SWIRQ5 interrupt 13 */ +#define CSR20_SWIRQ4 0x00001000 /* SWIRQ4 interrupt 12 */ +#define CSR20_SWIRQ3 0x00000800 /* SWIRQ3 interrupt 11 */ +#define CSR20_SWIRQ2 0x00000400 /* SWIRQ2 interrupt 10 */ +#define CSR20_SWIRQ1 0x00000200 /* SWIRQ1 interrupt 9 */ +#define CSR20_SWIRQ0 0x00000100 /* SWIRQ0 interrupt 8 */ + +#define CSR20_VMIRQ7 0x00000080 /* VMIRQ7 interrupt 7 */ +#define CSR20_VMIRQ6 0x00000040 /* VMIRQ7 interrupt 6 */ +#define CSR20_VMIRQ5 0x00000020 /* VMIRQ7 interrupt 5 */ +#define CSR20_VMIRQ4 0x00000010 /* VMIRQ4 interrupt 4 */ +#define CSR20_VMIRQ3 0x00000008 /* VMIRQ3 interrupt 3 */ +#define CSR20_VMIRQ2 0x00000004 /* VMIRQ2 interrupt 2 */ +#define CSR20_VMIRQ1 0x00000002 /* VMIRQ1 interrupt 1 */ + +/************************************************************************* +* CSR21 0x14 0x50 interrupt enable * +*************************************************************************/ + +#define CSR21_ACFIEN 0x80000000 /* ACFAIL interrupt 31 */ +#define CSR21_ABTIEN 0x40000000 /* ABORT interrupt 30 */ +#define CSR21_SFIEN 0x20000000 /* SYSFAIL interrupt 29 */ +#define CSR21_BERIEN 0x10000000 /* BERR interrupt 28 */ +#define CSR21_IAKIEN 0x08000000 /* IAK interrupt 27 */ +#define CSR21_SRQIEN 0x04000000 /* SRQ interrupt 26 */ +#define CSR21_SAKIEN 0x02000000 /* SAKF interrupt 25 */ + +#define CSR21_GP7IEN 0x00800000 /* GP7 interrupt 23 */ +#define CSR21_DMAIEN 0x00400000 /* DMA interrupt 22 */ +#define CSR21_TT1IEN 0x00200000 /* TT1 interrupt 21 */ +#define CSR21_TT0IEN 0x00100000 /* TT0 interrupt 20 */ +#define CSR21_GP3IEN 0x00080000 /* GP3 interrupt 19 */ +#define CSR21_GP2IEN 0x00040000 /* GP2 interrupt 18 */ +#define CSR21_GP1IEN 0x00020000 /* GP1 interrupt 17 */ +#define CSR21_GP0IEN 0x00010000 /* GP0 interrupt 16 */ + +#define CSR21_SWIEN7 0x00008000 /* SWIRQ7 interrupt 15 */ +#define CSR21_SWIEN6 0x00004000 /* SWIRQ6 interrupt 14 */ +#define CSR21_SWIEN5 0x00002000 /* SWIRQ5 interrupt 13 */ +#define CSR21_SWIEN4 0x00001000 /* SWIRQ4 interrupt 12 */ +#define CSR21_SWIEN3 0x00000800 /* SWIRQ3 interrupt 11 */ +#define CSR21_SWIEN2 0x00000400 /* SWIRQ2 interrupt 10 */ +#define CSR21_SWIEN1 0x00000200 /* SWIRQ1 interrupt 9 */ +#define CSR21_SWIEN0 0x00000100 /* SWIRQ0 interrupt 8 */ + +#define CSR21_VMIEN7 0x00000080 /* VMIRQ7 interrupt 7 */ +#define CSR21_VMIEN6 0x00000040 /* VMIRQ7 interrupt 6 */ +#define CSR21_VMIEN5 0x00000020 /* VMIRQ7 interrupt 5 */ +#define CSR21_VMIEN4 0x00000010 /* VMIRQ4 interrupt 4 */ +#define CSR21_VMIEN3 0x00000008 /* VMIRQ3 interrupt 3 */ +#define CSR21_VMIEN2 0x00000004 /* VMIRQ2 interrupt 2 */ +#define CSR21_VMIEN1 0x00000002 /* VMIRQ1 interrupt 1 */ + +/************************************************************************* +* CSR23 0x16 0x5c interrupt clear * +*************************************************************************/ + +#define CSR23_ACFICL 0x80000000 /* ACFAIL clear 31 */ +#define CSR23_ABTICL 0x40000000 /* ABORT clear 30 */ +#define CSR23_SFICL 0x20000000 /* SYSFAIL clear 29 */ +#define CSR23_IAKICL 0x08000000 /* IAK clear 27 */ +#define CSR23_SRQICL 0x04000000 /* SRQ clear 26 */ +#define CSR23_SAKICL 0x02000000 /* SAK clear 25 */ +#define CSR23_DMAICL 0x00400000 /* DMA clear 22 */ +#define CSR23_TT1ICL 0x00200000 /* TT1 clear 21 */ +#define CSR23_TT0ICL 0x00100000 /* TT0 clear 20 */ + +/************************************************************************* +* IFR0 0x1c 0x70 interface register 0 * +*************************************************************************/ + +#define IFR0_SRQF 0x80000000 /* SRQ clear 31 */ + +/************************************************************************* +* IFR1 0x1d 0x74 interface register 1 * +*************************************************************************/ + +#define IFR1_SAKF 0x80000000 /* SAK clear 31 */ + +/************************************************************************* +* IFR3 0x1f 0x7c interface register 3 * +*************************************************************************/ + +#define IFR3_SWREN 0x80000000 /* software reset enable bit 31 */ + +#ifdef __cplusplus +} +#endif + +#endif /* INCdga001Vmeh */ diff --git a/h/drv/vme/ivac.h b/h/drv/vme/ivac.h new file mode 100644 index 0000000..49c446b --- /dev/null +++ b/h/drv/vme/ivac.h @@ -0,0 +1,659 @@ +/* ivac.h - Ironics/VTC's VME Address Controller (VAC) constants */ + +/* +modification history +-------------------- +01f,22sep92,rrr added support for c++ +01e,07jul92,jwt cleaned up ANSI compiler warnings. +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01b,31jan91,rjt initial release to windriver after many minor fixes. +01a,25jul90,rjt writen by modifying IV-SPRC sparcmon version. +*/ + +#ifndef __INCivach +#define __INCivach + +#ifdef __cplusplus +extern "C" { +#endif + +/* +Assembly language files should turn off type declarations by not +including those portions of this include file, this is done by +placing a "#define _ASMLANGUAGE" statement before this file is +included in any other files. + +Also, in order to incorparate stronger typing of all constants, and to +allow the same constants to be typed in C files,yet usable in +assembly files. An unorthadox method of TYPING is used by CONDITIONALLY +#define'ing the constant TYPES. If no _ASMLANGUAGE #define is present, +then the type is defined to a blank space, otherwise it is defined +to be a C type. This looks weird but works nicely. +*/ + + +/* +Naming of register names and constants was done ( or was attempted ) so that +the front end of the names would indicate a related group while the tail +end of the names would further define the purpose of the name. Some groups +often contained sub-groups. Also some names don't follow this convention for +the sake of readability and other reasons. + +An H_ prefix indicates that the constant is typed as a pointer to +unsigned short register. +An B_ prefix indicates that the constant is typed as a pointer to +unsigned char register. + +Because of unpredictability of structure sizing and placement for +different compilers, we use contants to access each register. + +Most constants are defined for consistancy in name AND intended usage. +BIT MANIPUATION is set up so that each bit field has 3 or more defines +associated with it. + +1. BIT VALUE MASK +2. ASSERTED VALUE(S) +3. DEASERTED VALUE + +Where ASSERTED VALUE = 0 and dasserted value = 0xff for ACTIVE LOW SIGNALS +or vice versa, +where ASSERTED VALUE = 0xff and dasserted value = 0 for ACTIVE HIGH SIGNALS. + +The active high bits may also be something other than 0xff for +multi-bit fields. EG: for at 2 bit active high field there may be +4 asserted values associated with it: 0x00 0x01 0x02 0x03. + +the bit field should be altered as follows: + new_reg_value = (old_reg_val & ~MASK) | (MASK & VALUE ) + +REGISTER BIT STATUS for a bit field has 2 or more defines associated with it. + +1. BIT MASK +2. POSSIBLE BIT VALUE +3. . +4 . + +returned_bit_field_status = MASK & reg_value + +Most constants are declared immediatly after the register they are used in. +Some constants are shared between more than 1 register and are only defined +once after the first register. +*/ + + +/* IMPORTANT NOTICE: NOT ALL CONSTANTS HAVE BEEN TESTED */ + + +/* The following #defines allow or disallow C types */ +#ifndef _ASMLANGUAGE +/* C code typing */ +#ifndef P_VA_TYPE +#define P_VA_TYPE (unsigned short *) +#endif +#ifndef VA_TYPE +#define VA_TYPE (unsigned short) +#endif +#else +/* No typing allowing in assembly */ +#define VA_TYPE +#define P_VA_TYPE +#endif /* _ASMLANGUAGE */ + + +#define VAC_ADR 0xfffd0000 +#define VAC_TYPE unsigned short + +/* +IMPORTANT +Some boards may require a special routine to access the VAC registers. +Example: a board whose cache must be bypassed to ensure register integrity. +If they do, there should be vaXetReg() macros #define'd to call that +special routine. Otherwise the following vaXetReg() macros will be used. +For portability reasons, it might be a good idea to only use vaXetReg() +to alter any VAC registers in C code. If this macro is insufficient +then "#undef vaRegSet" and write a C routine (or another macro) to replace it. +*/ + +#ifndef vaRegSet +#define vaRegSet(hReg,val) (*(hReg) = (VAC_TYPE) (val)) +#endif /* vaRegSet */ +#ifndef vaRegGet +#define vaRegGet(bReg) *(bReg) +#endif /* vaRegGet */ + +/* Slave Select mask and base registers */ +#define H_VAC_SLS1_MASK P_VA_TYPE (VAC_ADR + 0x0000) +#define H_VAC_SLS1_BASE P_VA_TYPE (VAC_ADR + 0x0100) +#define H_VAC_SLS0_MASK P_VA_TYPE (VAC_ADR + 0x0200) +#define H_VAC_SLS0_BASE P_VA_TYPE (VAC_ADR + 0x0300) + + +/* group & module Addr. decodes for IPC Reg. */ +#define H_VAC_ICFSEL P_VA_TYPE(VAC_ADR + 0x0400) +#define GROUP_BASE_MASK 0xff00 +#define MODULE_BASE_MASK 0x00ff +#define GROUP_SHIFT 0x0000 +#define MODULE_SHIFT 0x0008 + +/* DRAM Upper Limit Mask Register */ +#define H_VAC_DRAM_MASK P_VA_TYPE (VAC_ADR + 0x0500) + +/* Boundry 2 Address Reg. */ +#define H_VAC_B2_BASE P_VA_TYPE (VAC_ADR + 0x0600) + +/* Boundry 3 Address Reg. */ +#define H_VAC_B3_BASE P_VA_TYPE (VAC_ADR + 0x0700 ) + +/* A24 Base Address Reg. */ +#define H_VAC_A24_BASE P_VA_TYPE (VAC_ADR + 0x0800 ) + +/* Region 1,2,3 Attribute Reg. */ +#define H_VAC_R1_ATTRIB P_VA_TYPE (VAC_ADR + 0x0900) +#define H_VAC_R2_ATTRIB P_VA_TYPE (VAC_ADR + 0x0a00) +#define H_VAC_R3_ATTRIB P_VA_TYPE (VAC_ADR + 0x0b00 ) + +#define ATR_DATA_SZ_MASK VA_TYPE 0x8000 +#define ATR_D16 VA_TYPE 0x8000 +#define ATR_D32 VA_TYPE 0x0 + +#define ATR_ADR_SZ_MASK VA_TYPE 0x6000 +#define ATR_A16 VA_TYPE 0x2000 +#define ATR_A24 VA_TYPE 0x0000 +#define ATR_A32 VA_TYPE 0x4000 + +#define ATR_CACHE_MASK VA_TYPE 0x1000 +#define ATR_CACHE_INHIBIT VA_TYPE 0x1000 +#define ATR_CACHE_ENABLE VA_TYPE 0x0000 + +#define ATR_SEGMENT_MAP_MASK VA_TYPE 0x0c00 +#define ATR_NULL VA_TYPE 0x0 +#define ATR_SHR VA_TYPE 0x0400 +#define ATR_VSB VA_TYPE 0x0800 +#define ATR_VME VA_TYPE 0x0c00 + + +/* Dsack Timing Control Reg. */ +#define H_VAC_IO4_DSACK_CTL P_VA_TYPE (VAC_ADR + 0x0c00) +#define H_VAC_IO5_DSACK_CTL P_VA_TYPE (VAC_ADR + 0x0d00) +#define H_VAC_SHR_DSACK_CTL P_VA_TYPE (VAC_ADR + 0x0e00) +#define H_VAC_EPROM_DSACK_CTL P_VA_TYPE (VAC_ADR + 0x0f00) +#define H_VAC_IO0_DSACK_CTL P_VA_TYPE (VAC_ADR + 0x1000) +#define H_VAC_IO1_DSACK_CTL P_VA_TYPE (VAC_ADR + 0x1100) +#define H_VAC_IO2_DSACK_CTL P_VA_TYPE (VAC_ADR + 0x1200) +#define H_VAC_IO3_DSACK_CTL P_VA_TYPE (VAC_ADR + 0x1300) + +#define DSACK_DELAY_MASK 0xE000 +#define DSACK_DELAY_0 0x0000 +#define DSACK_DELAY_1 0x2000 +#define DSACK_DELAY_2 0x4000 +#define DSACK_DELAY_3 0x6000 +#define DSACK_DELAY_4 0x8000 +#define DSACK_DELAY_5 0xA000 +#define DSACK_DELAY_6 0xC000 +#define DSACK_DELAY_7 0xE000 + +#define DSACK1_ENABLE 0x1000 +#define DSASK0_ENABLE 0x0800 + +#define DSACK_RECOVERY_MASK 0x0700 +#define RECOVERY_DELAY_0 0x0000 +#define RECOVERY_DELAY_1 0x0100 +#define RECOVERY_DELAY_2 0x0200 +#define RECOVERY_DELAY_3 0x0300 +#define RECOVERY_DELAY_4 0x0400 +#define RECOVERY_DELAY_5 0x0500 +#define RECOVERY_DELAY_6 0x0600 +#define RECOVERY_DELAY_7 0x0700 + +#define IORD_DELAY_MASK 0x00c0 +#define IORD_DELAY_0 0x0000 +#define IORD_DELAY_1 0x0040 +#define IORD_DELAY_2 0x0080 +#define IORD_DELAY_3 0x00c0 + +#define IOWR_DELAY_MASK 0x0030 +#define IOWR_DELAY_0 0x0000 +#define IOWR_DELAY_1 0x0010 +#define IOWR_DELAY_2 0x0020 +#define IOWR_DELAY_3 0x0030 + +#define IOSELI_DELAY_MASK 0x000c +#define IOSELI_DELAY_0 0x0000 +#define IOSELI_DELAY_1 0x0004 +#define IOSELI_DELAY_2 0x0008 +#define IOSELI_DELAY_3 0x000c + +#define IORD_CYCLE_END_CTL 0x0002 +#define IOWR_CYCLE_END_CTL 0x0001 + +/* Decode Control Register */ +#define H_VAC_DECODE_CTL P_VA_TYPE (VAC_ADR + 0x1400) + +#define SLACKDR VA_TYPE 0x8000 +#define QDRAM VA_TYPE 0x4000 + +/* slave 1 device selection */ +#define SL1_MASK VA_TYPE 0x3000 +#define SL1DS1 VA_TYPE 0x2000 +#define SL1DS0 VA_TYPE 0x1000 +#define SL1_EPROM VA_TYPE 0x0000 +#define SL1_VSB VA_TYPE 0x1000 +#define SL1_SHRCS VA_TYPE 0x2000 +#define SL1_DRAM VA_TYPE 0x3000 + +#define SL1A32 VA_TYPE 0x0800 +#define SL1A16 VA_TYPE 0x0400 +#define QSL0 VA_TYPE 0x0200 +#define QSL1 VA_TYPE 0x0100 +#define QICF VA_TYPE 0x0080 +#define QBNDRY VA_TYPE 0x0040 +#define ACKDR VA_TYPE 0x0020 +#define REDSL1 VA_TYPE 0x0010 +#define REDSL0 VA_TYPE 0x0008 +#define DRDLY1 VA_TYPE 0x0004 +#define DRDLY0 VA_TYPE 0x0002 +#define QBFPU VA_TYPE 0x0001 + +/* VAC interrupt status register and its bit mask constants */ +#define H_VAC_IRQ_STAT P_VA_TYPE (VAC_ADR +0x1500 ) + + +#define VAC_IRQ_PIO9 VA_TYPE 0x8000 +#define VAC_IRQ_PIO8 VA_TYPE 0x4000 +#define VAC_IRQ_PIO7 VA_TYPE 0x2000 +#define VAC_IRQ_PIO4 VA_TYPE 0x1000 +#define VAC_IRQ_MBX VA_TYPE 0x0800 +#define VAC_IRQ_TMR VA_TYPE 0x0400 +#define VAC_IRQ_SIOA VA_TYPE 0x0200 +#define VAC_IRQ_SIOB VA_TYPE 0x0100 + + +/* VAC IRQ signal map and control register */ +#define H_VAC_IRQ_CTL P_VA_TYPE (VAC_ADR +0x1600 ) + +/* +The values are designed to be used as follows. The interrupt +source on the VAC and the actual PIO signals to the VIC are +combined to produce a VAC interrupt control value, or bit map, +that can be used with a mask value to toggle the control bits. + +Example: + control bit map IRQ pin dest VAC IRQ source + #define IRQ_VAC_TMR_CTL_MAP (IRQ_DEST_PIO10 << IRQ_VAC_SRC_TMR) + +To remove a VAC interrupt you must disable and enable the VAC interrupt +via the VAC Interrupt Control Register. + +Clear the IRQ map to disable the IRQ: + + sysVacFieldSet (H_VAC_IRQ_CTL, IRQ_VAC_TMR_CTL_MASK, + (IRQ_VAC_TMR_CTL_MAP & VAC_IRQ_DISABLE)); + +Map it back in to enable the IRQ: + + sysVacFieldSet (H_VAC_IRQ_CTL, IRQ_VAC_TMR_CTL_MASK, + (IRQ_VAC_TMR_CTL_MAP & VAC_IRQ_ENABLE)); +*/ + +#define IRQ_PIO9_CTL_MASK VA_TYPE 0xc000 +#define IRQ_PIO8_CTL_MASK VA_TYPE 0x3000 +#define IRQ_PIO7_CTL_MASK VA_TYPE 0x0c00 +#define IRQ_PIO4_CTL_MASK VA_TYPE 0x0300 +#define IRQ_MBX_CTL_MASK VA_TYPE 0x00c0 +#define IRQ_SIOA_CTL_MASK VA_TYPE 0x0030 +#define IRQ_SIOB_CTL_MASK VA_TYPE 0x000c +#define IRQ_VAC_TMR_CTL_MASK VA_TYPE 0x0003 + +#define VAC_IRQ_DISABLE 0 +#define VAC_IRQ_ENABLE 0xffff + + +/* shift values to map the pio signal destination */ +#define IRQ_SRC_PIO9 VA_TYPE 0xE +#define IRQ_SRC_PIO8 VA_TYPE 0xC +#define IRQ_SRC_PIO7 VA_TYPE 0xA +#define IRQ_SRC_PIO4 VA_TYPE 0x8 +#define IRQ_SRC_MBX VA_TYPE 0x6 +#define IRQ_SRC_SIOA VA_TYPE 0x4 +#define IRQ_SRC_SIOB VA_TYPE 0x2 +#define IRQ_SRC_VAC_TMR VA_TYPE 0x0 + +/* pio signal destination */ +#define IRQ_DEST_NULL 0 +#define IRQ_DEST_PIO7 1 +#define IRQ_DEST_PIO10 2 +#define IRQ_DEST_PIO11 3 + + + +/* device present flags */ +#define H_VAC_DEVICE_LOC P_VA_TYPE (VAC_ADR +0x1700 ) + +#define IOSEL5_PRESENT VA_TYPE 0x0020 +#define IOSEL4_PRESENT VA_TYPE 0x0010 +#define IOSEL3_PRESENT VA_TYPE 0x0008 +#define IOSEL2_PRESENT VA_TYPE 0x0004 +#define IOSEL1_PRESENT VA_TYPE 0x0002 +#define IOSEL0_PRESENT VA_TYPE 0x0001 + +/* this reg used to init pio data out values */ +#define H_VAC_PIO_DATA P_VA_TYPE (VAC_ADR +0x1800 ) + +/* read only - contains login levels of pio pins */ +#define H_VAC_PIO_PIN P_VA_TYPE (VAC_ADR +0x1900 ) + +/* set up the direction of pio */ +#define H_VAC_PIO_DIR P_VA_TYPE (VAC_ADR + 0x1a00) + +/* assign functions to the pio */ +#define H_VAC_PIO_FUNC P_VA_TYPE (VAC_ADR + 0x1b00) + +/* pio bit mask defines */ +#define PIO0 VA_TYPE 0x0001 +#define PIO1 VA_TYPE 0x0002 +#define PIO2 VA_TYPE 0x0004 +#define PIO3 VA_TYPE 0x0008 +#define PIO4 VA_TYPE 0x0010 +#define PIO5 VA_TYPE 0x0020 +#define PIO6 VA_TYPE 0x0040 +#define PIO7 VA_TYPE 0x0080 +#define PIO8 VA_TYPE 0x0100 +#define PIO9 VA_TYPE 0x0200 +#define PIO10 VA_TYPE 0x0400 +#define PIO11 VA_TYPE 0x0800 +#define PIO12 VA_TYPE 0x1000 +#define PIO13 VA_TYPE 0x2000 +#define PIO9_DEBOUNCE_ENABLE VA_TYPE 0x4000 +#define CPU_SPACE_EMULATE VA_TYPE 0x8000 + +#define TXDA_TO_PIO0 VA_TYPE 0x0001 +#define RXTA_TO_PIO1 VA_TYPE 0x0002 +#define TXDB_TO_PIO2 VA_TYPE 0x0004 +#define TXDB_TO_PIO3 VA_TYPE 0x0008 +#define IORD_TO_PIO4 VA_TYPE 0x0010 +#define IOWR_TO_PIO5 VA_TYPE 0x0020 +#define IOSEL3_TO_PIO6 VA_TYPE 0x0040 +#define PIO7IRQ_TO_PIO7 VA_TYPE 0x0080 +#define IOSEL4_TO_PIO8 VA_TYPE 0x0100 +#define IOSEL5_TO_PIO9 VA_TYPE 0x0200 +#define PIO10IRQ_TO_PIO10 VA_TYPE 0x0400 +#define PIO11IRQ_TO_PIO10 VA_TYPE 0x0800 +#define SHRCS_TO_PIO12 VA_TYPE 0x1000 +#define IOSEL2_TO_PIO13 VA_TYPE 0x2000 +#define PIO9_DEBOUNCE_DISABLE VA_TYPE 0x4000 +#define CPU_SPACE_EMULATE_VIA_IOSEL5 VA_TYPE 0x8000 + +/* SIO STUFF */ + +/* +Get table for BAUD_PRESCALE_INIT VALS: + +NOTE +The SIO baud rate divisor is dependent on CPU_CLOCK +and is derived from the following formula + + / CPU clock rate \ + divisor = truncate | ---------------------------- + 0.5 | + \ 16 * (MAX baud rate desired) / + +where divisor > 8. + +This value is loaded into the top byte of the VAC CPU +clock divisor. + +The baud rate selection table will allow selection of +8 different baud rates. Each lower than the MAX baud rate +by a power of 2. If 9600 baud is the MAX baud rate, then +the following powers are available: + +baud select value baud rate + 7 76800 don't use + 6 19200 + 5 9600 + 4 4800 + 3 2400 + 2 1200 + 1 600 + 0 300 +*/ + +/* max rate cpu clk divisor */ +/* check these values for roundup */ +#define BAUD_9600_CLK_20MHz 0x2000 +#define BAUD_9600_CLK_25MHz 0x2800 +#define BAUD_9600_CLK_32MHz 0x3400 +#define BAUD_9600_CLK_33MHz 0x3500 + +#define BAUD_19200_CLK_20MHz 0x0fff /*subtract one from above formula*/ +#define BAUD_19200_CLK_25MHz 0x1400 +#define BAUD_19200_CLK_32MHz 0x1a00 +#define BAUD_19200_CLK_33MHz 0x1a00 +#define BAUD_19200_CLK_40MHz 0x2000 + +/*Baud Rate Prescaler used on CPU Clk. */ +#define H_VAC_BAUD_PRESCALE P_VA_TYPE (VAC_ADR + 0x1c00) + +/* control register */ +#define H_VAC_SIOA_MODE P_VA_TYPE (VAC_ADR + 0x1d00) + +/* control bits for both sioa and siob */ +#define SIO_CTL_ENABLE VA_TYPE 0xfcff +#define SIO_CTL_DISABLE VA_TYPE 0x0300 + +/* the following are masks */ +#define PARITY_ENABLE VA_TYPE 0x8000 +#define EVEN_PARITY VA_TYPE 0x4000 +#define EIGHT_BITS VA_TYPE 0x2000 + +#define BAUD_RATE_MASK VA_TYPE 0x1c00 + +#define RESET_RECV VA_TYPE 0x0200 +#define RESET_XMIT VA_TYPE 0x0100 +#define XMITER VA_TYPE 0x0080 +#define RECVER VA_TYPE 0x0040 +#define SEND_BREAK VA_TYPE 0x0020 +#define TXDA_TO_RXDA VA_TYPE 0x0010 + +/* NOTE: vac sio data bytes are taken from high 8 bits !! */ + +/* xmit data */ +#define H_VAC_SIOA_XMIT P_VA_TYPE (VAC_ADR + 0x1e00) + +/* control register */ +#define H_VAC_SIOB_MODE P_VA_TYPE (VAC_ADR + 0x1f00) + +/* rec data */ +#define H_VAC_SIOA_RECV P_VA_TYPE (VAC_ADR + 0x2000) +#define H_VAC_SIOB_RECV P_VA_TYPE (VAC_ADR + 0x2100) + +/* xmit data */ +#define H_VAC_SIOB_XMIT P_VA_TYPE (VAC_ADR + 0x2200) + +/* sio interrupt mask regs */ +#define H_VAC_SIOA_IRQ_MASK P_VA_TYPE (VAC_ADR + 0x2300) +#define H_VAC_SIOB_IRQ_MASK P_VA_TYPE (VAC_ADR + 0x2400) + +#define SINGLE_CHAR_RECV_MASK VA_TYPE 0x8000 +#define FIFO_FULL_MASK VA_TYPE 0x4000 +#define BREAK_CHANGE_MASK VA_TYPE 0x2000 +#define ERROR_MASK VA_TYPE 0x1000 +#define XMIT_READY_MASK VA_TYPE 0x0800 +#define XMIT_EMPTY_MASK VA_TYPE 0x0400 + +#define SIO_MASK_ENABLE VA_TYPE 0xffff +#define SIO_MASK_DISABLE VA_TYPE 0x0000 + + +/* sio status regs */ +#define H_VAC_SIOA_STAT P_VA_TYPE (VAC_ADR + 0x2500) +#define H_VAC_SIOB_STAT P_VA_TYPE (VAC_ADR + 0x2600) + +#define CHAR_READY VA_TYPE 0x8000 +#define FIFO_FULL VA_TYPE 0x4000 +#define BREAK_CHANGE VA_TYPE 0x2000 +#define PARITY_ERROR VA_TYPE 0x1000 +#define FRAMING_ERROR VA_TYPE 0x0800 +#define OVERRUN_ERROR VA_TYPE 0x0400 +#define XMIT_READY VA_TYPE 0x0200 +#define XMIT_EMPTY VA_TYPE 0x0100 + +/* VAC TIMER STUFF */ + +#define H_VAC_TMR_DATA P_VA_TYPE (VAC_ADR + 0x2700) +#define H_VAC_TMR_CTL P_VA_TYPE (VAC_ADR + 0x2800) + +#define PRESCALER_IN_MASK VA_TYPE 0x3f00 +#define PRESCALER_IN_SHIFT 8 + +/* use this to read the instantaneous count value of prescaler */ +#define PRESCALER_OUT_MASK VA_TYPE 0x003f + +#define VAC_20MHZ_CPU_1MHZ_PRESCALER (19 << PRESCALER_IN_SHIFT) +#define VAC_25MHZ_CPU_1MHZ_PRESCALER (24 << PRESCALER_IN_SHIFT) +#define VAC_33MHZ_CPU_1MHZ_PRESCALER (32 << PRESCALER_IN_SHIFT) +#define VAC_40MHZ_CPU_1MHZ_PRESCALER (39 << PRESCALER_IN_SHIFT) + +/* Load command disables timer and then loads the interal timer registers */ +/* with the values in the prescaler control bits and the timer data register */ +#define RUN_LOAD_MASK VA_TYPE 0x4000 +#define RUN_CMD VA_TYPE 0x4000 +#define STOP_N_LOAD_CMD VA_TYPE 0x0000 + +/* You can set the timer to only produce a single irq after the time */ +/* has elapsed or reset the counter for continuous irqs */ +#define SINGLE_CONT_MASK VA_TYPE 0x8000 +#define SINGLE_IRQ_CMD VA_TYPE 0x8000 +#define CONT_IRQ_CMD VA_TYPE 0x0000 + +/************************************************************************* +* The vac timer rate is calculated as follows: +* +* +* / CPU_CLOCK \ +* | ------------------- | +* \ prescaler value + 1 / +*timer rate = ------------------------------ +* (65536 - time data reg. value) +* +* +* where prescaler is set to an arbitrary value. +* +* +*this gives us a time data register value of +* +* +* / CPU_CLOCK \ +* | ------------------- | +* \ prescaler value + 1 / +*timer data val = 65536 - ---------------------------- +* reqested timer rate +* +* +* +* +*PROGRAMING EXAMPLE: +* +* +*to get a 100Hz time rate with a 25MHz cpu clock +* +* - arbitrarily set prescaler value to 24 which will produce a +* 1MHz time period for each count in the time data register +* +* +* / 25000000 \ +* | --------- | +* \ 24 + 1 / +* time data val = 65536 - ------------- = 55536 = 0xd8f0 +* 100 +* +* +* - set prescaler +* *H_VAC_TMR_CTL = (*H_VAC_TMR_CTL & ~PRSCALER_IN_MASK) | +* VAC_25MHZ_CPU_1MHZ_PRESCALER ; +* - set timer data register +* *H_VAC_TMR_DATA = 0x8df0 ; +* +* - disable timer and load above values into internal registers +* *H_VAC_TMR_CTL = (*H_VAC_TMR_CTL & ~RUN_LOAD_MASK) | STOP_N_LOAD_CMD ; +* +* - set control for continuous operation +* *H_VAC_TMR_CTL = (*H_VAC_TMR_CTL & ~SINGLE_CONT_MASK) | CONT_CMD ; +* +* - start timer +* *H_VAC_TMR_CTL = (*H_VAC_TMR_CTL & ~RUN_LOAD_MASK) | RUN_CMD ; +* +***************************************************************************/ + + +/* Vac ID Reg. Read to Startup */ +#define H_VAC_ID_GO P_VA_TYPE (VAC_ADR + 0x2900) + + + +/* now for some generic io Macros */ +/* These macros are designed so that they can be dropped into a generic */ +/* serial handler, They are intended to be the basic building blocks used */ +/* to port any serial handler to use the VAC. */ + +#ifndef _ASMLANGUAGE + + +#define SIOA 0 +#define SIOB 1 + +/*the following macros expect SIOA or SIOB for u arg-there's no error checking*/ + +#define XMITER_EMPTY(u) ( XMIT_EMPTY & vaRegGet( H_VAC_SIOA_STAT + \ + ((u)* ( H_VAC_SIOB_STAT - H_VAC_SIOA_STAT ) ) ) ) +#define XMITER_READY(u) ( XMIT_READY & vaRegGet( H_VAC_SIOA_STAT + \ + ((u)* ( H_VAC_SIOB_STAT - H_VAC_SIOA_STAT ) ) ) ) +#define RECVER_READY(u) ( CHAR_READY & vaRegGet( H_VAC_SIOA_STAT + \ + ((u)* ( H_VAC_SIOB_STAT - H_VAC_SIOA_STAT ) ) ) ) + +#define XMIT_CHAR(u,ch) vaRegSet( H_VAC_SIOA_XMIT + \ + ((u)* ( H_VAC_SIOB_XMIT - H_VAC_SIOA_XMIT ) ) , \ + (unsigned short)( ((unsigned short)(ch))<<8 ) ) + +#define RECV_CHAR(u,pc) *(pc) = (unsigned char)(0x00ff & \ + vaRegGet( H_VAC_SIOA_RECV + \ + ((u)* ( H_VAC_SIOB_RECV - H_VAC_SIOA_RECV ) ) ) ) + +#define POLLING + +/* The following P_GETC and P_PUTC macros are designed for POLLING only!!! */ +/* NOTE: The delay loops may need to be altered depending on the board rev. */ +#ifdef POLLING + +/* P_PUTC(u,ch) - output char "ch" to "u" where "u" is SIOA or SIOB */ +/* add delay, NOTE: no fifo stuff allowed */ + +#define P_PUTC(u,ch) \ + while ( ! XMITER_READY( (u) ) ) ; \ + XMIT_CHAR( (u),(ch) ); \ + while ( XMITER_READY( (u) ) ) + + +/* P_GETC(u,pc) - input char into char pointer "pc" from */ +/* "u" where "u" is SIOA or SIOB */ + +#define P_GETC(u,pc) \ + { \ + int x; \ + while ( ! RECVER_READY( (u) ) ) \ + for(x=0;x<100;x++) ; \ + RECV_CHAR( (u), (pc) ) ; \ + } + +#endif /* POLLING */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCivach */ diff --git a/h/drv/vme/unsupported/busLocal.h b/h/drv/vme/unsupported/busLocal.h new file mode 100644 index 0000000..064b432 --- /dev/null +++ b/h/drv/vme/unsupported/busLocal.h @@ -0,0 +1,48 @@ +/* busLocal.h - sysBusToLocal/sysLocalToBus header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,22sep92,rrr added support for c++ +01a,16jun92,ccc created. +*/ + +/* +DESCRIPTION +This file contains header information for the sysBusToLocal() and +sysLocalToBus() routines. +*/ + +#ifndef __INCbusLocalh +#define __INCbusLocalh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +#ifndef _ASMLANGUAGE +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT STATUS sysLocalToBusAdrs (int adrsSpace, char *localAdrs, + char **pBusAdrs); +IMPORT STATUS sysBusToLocalAdrs (int adrsSpace, char *busAdrs, + char **pLocalAdrs); + +#else /* __STDC__ */ + +IMPORT STATUS sysLocalToBusAdrs (); +IMPORT STATUS sysBusToLocalAdrs (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCbusLocalh */ diff --git a/h/drv/vme/unsupported/dga001Vme.h b/h/drv/vme/unsupported/dga001Vme.h new file mode 100644 index 0000000..5355b98 --- /dev/null +++ b/h/drv/vme/unsupported/dga001Vme.h @@ -0,0 +1,529 @@ +/* dga001Vme.h - Densan DGA-001 VMEbus Interface Controller */ + +/* Copyright 1994-1997 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01l,12jul97,hk renamed as dga001Vme.h from drv/multi/dga001.h. +01k,15jan96,hk added support for DVE-SH7043. +01j,10nov95,hk changed CSR to DGA_CSR. +01i,09nov95,hk fixed CSR1_1_RRS, but not used. did some code reviewing. +01h,04jul95,hk modified some macro names. +01g,07jun95,hk changed CSR20/CSR21 bit defs. copyright to '95. +01f,15dec94,sa wrote CSR13_0, CSR15_0, CSR16_0, CSR17, IFR0, IFR1, IFR3. +01e,14nov94,hk wrote CSR18_1. +01d,09nov94,sa write CSR12, CSR14 and CSR23. +01c,19oct94,sa write CSR19 to CSR21 +01b,08sep94,sa write to CSR7 +01a,07sep94,sa derived from 01e of vmechip.h. +*/ + +#ifdef DOC +#define INCdga001Vmeh +#endif /* DOC */ + +#ifndef __INCdga001Vmeh +#define __INCdga001Vmeh + +#ifdef __cplusplus +extern "C" { +#endif + +/* +This file contains constants for the Densan DGA-001 VMEbus Interface. +The macro DGA001_BASE_ADRS must be defined when using local bus addresses +defined in this header. The macro IFR_BUS_BASE_ADRS must be defined when +using VMEbus addresses defined in this header. + +The following standards have been adopted in the creation of this file. + +Registers in the CSR have the prefix "DGA_CSR". And "DGA_CSR0_0" means most +low address of CSR0 register. + +Registers in the IFR have the prefix "DGA_IFR" when addressed locally and +the prefix "IFR_BUS" when addressed from the VMEbus. The bit definitions +are shared. + +The registers are listed in ascending (numerical) order; the definitions +for each register start with a header, e.g.: + + Register Register Register Register + Mnemonic Number Address Name + | | | | + v v v v +/@*********************************************************************** +* CSR0_0 0x00 0x00 local bus control and status* +***********************************************************************@/ + +The format of the definitions is as follows. The define name always +starts with the register mnemonic it is associated with. The [7-0] +number at the end of the comment indicates the bit position to which the +the define applies. In the definition of PURSTF, for example, the 7 +indicates bit 7: + | + v +#define CSR1_0_PURSTF 0x80 /@ power-up status bit 7 @/ + +If the define applies to more than one bit, then the applicable bit +range is specified by two digits. In the following example, +CSR0_LBT applies to the two bit field, bits 5-4: + | + v +#define CSR0_0_LBT 0x10 /@ local bus time-out (mask) 54 @/ + +If no bit field is given, then the define applies to the whole register. +*/ + + +#define DGA001_LONG_ADRS(offset) \ + ((volatile UINT32 *)(DGA001_BASE_ADRS + offset)) + +#if defined(TARGET_DVE7604) || defined(TARGET_DVE7043) +#define DGA001_BYTE_ADRS(offset) \ + ((volatile UINT8 *)(DGA001_BASE_ADRS + DGA001_BYTE_ACCESS_OFFSET + offset)) +#else +#define DGA001_BYTE_ADRS(offset) \ + ((volatile UINT8 *)(DGA001_BASE_ADRS + offset)) +#endif /* TARGET_DVE7604 */ + +/* + * Control and Status Register (CSR) definitions. + * + * only the local CPU can access the LCSR. + */ + +#define DGA_CSR0 DGA001_LONG_ADRS(0x00) +#define DGA_CSR0_0 DGA001_BYTE_ADRS(0x00) +#define DGA_CSR0_1 DGA001_BYTE_ADRS(0x01) +#define DGA_CSR0_2 DGA001_BYTE_ADRS(0x02) +#define DGA_CSR0_3 DGA001_BYTE_ADRS(0x03) +#define DGA_CSR1 DGA001_LONG_ADRS(0x04) +#define DGA_CSR1_0 DGA001_BYTE_ADRS(0x04) +#define DGA_CSR1_1 DGA001_BYTE_ADRS(0x05) +#define DGA_CSR1_2 DGA001_BYTE_ADRS(0x06) +#define DGA_CSR1_3 DGA001_BYTE_ADRS(0x07) +#define DGA_CSR2 DGA001_LONG_ADRS(0x08) +#define DGA_CSR2_0 DGA001_BYTE_ADRS(0x08) +#define DGA_CSR2_1 DGA001_BYTE_ADRS(0x09) +#define DGA_CSR2_2 DGA001_BYTE_ADRS(0x0a) +#define DGA_CSR2_3 DGA001_BYTE_ADRS(0x0b) +#define DGA_CSR3 DGA001_LONG_ADRS(0x0c) +#define DGA_CSR3_0 DGA001_BYTE_ADRS(0x0c) +#define DGA_CSR3_1 DGA001_BYTE_ADRS(0x0d) +#define DGA_CSR3_2 DGA001_BYTE_ADRS(0x0e) +#define DGA_CSR3_3 DGA001_BYTE_ADRS(0x0f) +#define DGA_CSR4 DGA001_LONG_ADRS(0x10) +#define DGA_CSR4_0 DGA001_BYTE_ADRS(0x10) +#define DGA_CSR4_1 DGA001_BYTE_ADRS(0x11) +#define DGA_CSR4_2 DGA001_BYTE_ADRS(0x12) +#define DGA_CSR4_3 DGA001_BYTE_ADRS(0x13) +#define DGA_CSR5 DGA001_LONG_ADRS(0x14) +#define DGA_CSR5_0 DGA001_BYTE_ADRS(0x14) +#define DGA_CSR5_1 DGA001_BYTE_ADRS(0x15) +#define DGA_CSR5_2 DGA001_BYTE_ADRS(0x16) +#define DGA_CSR5_3 DGA001_BYTE_ADRS(0x17) +#define DGA_CSR6 DGA001_LONG_ADRS(0x18) +#define DGA_CSR6_0 DGA001_BYTE_ADRS(0x18) +#define DGA_CSR6_1 DGA001_BYTE_ADRS(0x19) +#define DGA_CSR6_2 DGA001_BYTE_ADRS(0x1a) +#define DGA_CSR6_3 DGA001_BYTE_ADRS(0x1b) +#define DGA_CSR7 DGA001_LONG_ADRS(0x1c) +#define DGA_CSR7_0 DGA001_BYTE_ADRS(0x1c) +#define DGA_CSR7_1 DGA001_BYTE_ADRS(0x1d) +#define DGA_CSR7_2 DGA001_BYTE_ADRS(0x1e) +#define DGA_CSR7_3 DGA001_BYTE_ADRS(0x1f) +#define DGA_CSR8 DGA001_LONG_ADRS(0x21) +#define DGA_CSR9 DGA001_LONG_ADRS(0x24) +#define DGA_CSR10 DGA001_LONG_ADRS(0x28) +#define DGA_CSR10_0 DGA001_BYTE_ADRS(0x28) +#define DGA_CSR10_1 DGA001_BYTE_ADRS(0x29) +#define DGA_CSR10_2 DGA001_BYTE_ADRS(0x2a) +#define DGA_CSR10_3 DGA001_BYTE_ADRS(0x2b) +#define DGA_CSR11 DGA001_LONG_ADRS(0x2c) +#define DGA_CSR11_0 DGA001_BYTE_ADRS(0x2c) +#define DGA_CSR11_1 DGA001_BYTE_ADRS(0x2d) +#define DGA_CSR11_2 DGA001_BYTE_ADRS(0x2e) +#define DGA_CSR11_3 DGA001_BYTE_ADRS(0x2f) +#define DGA_CSR12 DGA001_LONG_ADRS(0x30) +#define DGA_CSR13 DGA001_LONG_ADRS(0x34) +#define DGA_CSR14 DGA001_LONG_ADRS(0x38) +#define DGA_CSR15 DGA001_LONG_ADRS(0x3c) +#define DGA_CSR16 DGA001_LONG_ADRS(0x40) +#define DGA_CSR17 DGA001_LONG_ADRS(0x44) +#define DGA_CSR18 DGA001_LONG_ADRS(0x48) +#define DGA_CSR18_1 DGA001_BYTE_ADRS(0x49) +#define DGA_CSR18_2 DGA001_BYTE_ADRS(0x4a) +#define DGA_CSR18_3 DGA001_BYTE_ADRS(0x4b) +#define DGA_CSR19 DGA001_LONG_ADRS(0x4c) +#define DGA_CSR19_0 DGA001_BYTE_ADRS(0x4c) +#define DGA_CSR19_1 DGA001_BYTE_ADRS(0x4d) +#define DGA_CSR19_2 DGA001_BYTE_ADRS(0x4e) +#define DGA_CSR19_3 DGA001_BYTE_ADRS(0x4f) +#define DGA_CSR20 DGA001_LONG_ADRS(0x50) +#define DGA_CSR21 DGA001_LONG_ADRS(0x54) +#define DGA_CSR22 DGA001_LONG_ADRS(0x58) +#define DGA_CSR23 DGA001_LONG_ADRS(0x5c) +#define DGA_CSR24 DGA001_LONG_ADRS(0x60) +#define DGA_CSR25 DGA001_LONG_ADRS(0x64) +#define DGA_CSR26 DGA001_LONG_ADRS(0x68) +#define DGA_CSR27 DGA001_LONG_ADRS(0x6c) + +/* + * Interface Register (IFR) definitions. + * + * All registers of the IFR are accessible to both the local processor + * and to other VMEbus masters. + */ + +#define DGA_IFR0 DGA001_LONG_ADRS(0x70) +#define DGA_IFR1 DGA001_LONG_ADRS(0x74) +#define DGA_IFR2 DGA001_LONG_ADRS(0x78) +#define DGA_IFR3 DGA001_LONG_ADRS(0x7c) + +/************************************************************************* +* CSR0_0 0x00 0x00 local bus control * +*************************************************************************/ + +#define CSR0_0_LBT_DIS 0x30 /* local bus time-out disable 5-4 */ +#define CSR0_0_LBT_256 0x20 /* local bus time-out 256 clks 5-4 */ +#define CSR0_0_LBT_128 0x10 /* local bus time-out 128 clks 5-4 */ +#define CSR0_0_LBT_64 0x00 /* local bus time-out 64 clks 5-4 */ + +#define CSR0_0_TAOUTE 0x08 /* local bus TAOUT enable 3 */ + +/************************************************************************* +* CSR0_1 0x00 0x01 bus error control and status * +*************************************************************************/ + +#define CSR0_1_BERDYO 0x80 /* activate RDYO# upon bus error 7 */ + +#define CSR0_1_LBTOUT 0x04 /* local bus time-out (status) 2 */ +#define CSR0_1_RQTOUT 0x02 /* request time-out (status) 1 */ +#define CSR0_1_VMEBERR 0x01 /* VMEbus bus error (status) 0 */ + +/************************************************************************* +* CSR0_2 0x00 0x02 general purpose output enable * +*************************************************************************/ + +#define CSR0_2_GPOE7 0x80 /* general purpose output 7 enable 7 */ +#define CSR0_2_GPOE6 0x40 /* general purpose output 6 enable 6 */ +#define CSR0_2_GPOE5 0x20 /* general purpose output 5 enable 5 */ +#define CSR0_2_GPOE4 0x10 /* general purpose output 4 enable 4 */ +#define CSR0_2_GPOE3 0x08 /* general purpose output 3 enable 3 */ +#define CSR0_2_GPOE2 0x04 /* general purpose output 2 enable 2 */ +#define CSR0_2_GPOE1 0x02 /* general purpose output 1 enable 1 */ +#define CSR0_2_GPOE0 0x01 /* general purpose output 0 enable 0 */ + +/************************************************************************* +* CSR0_3 0x00 0x03 general purpose I/O * +*************************************************************************/ + +#define CSR0_3_GPIO7 0x80 /* general purpose I/O 7 7 */ +#define CSR0_3_GPIO6 0x40 /* general purpose I/O 6 6 */ +#define CSR0_3_GPIO5 0x20 /* general purpose I/O 5 5 */ +#define CSR0_3_GPIO4 0x10 /* general purpose I/O 4 4 */ +#define CSR0_3_GPIO3 0x08 /* general purpose I/O 3 3 */ +#define CSR0_3_GPIO2 0x04 /* general purpose I/O 2 2 */ +#define CSR0_3_GPIO1 0x02 /* general purpose I/O 1 1 */ +#define CSR0_3_GPIO0 0x01 /* general purpose I/O 0 0 */ + +/************************************************************************* +* CSR1_0 0x01 0x04 reset control and status * +*************************************************************************/ + +#define CSR1_0_PURSTF 0x80 /* power-up reset (status) 7 */ + +#define CSR1_0_RSWEN 0x40 /* reset switch enable 6 */ +#define CSR1_0_RSWSYS 0x20 /* VMEbus SYSRESET enable 5 */ + +/************************************************************************* +* CSR1_1 0x01 0x05 system controller configuration * +*************************************************************************/ + +#define CSR1_1_SYSCON 0x80 /* system controller (status) 7 */ + +#define CSR1_1_RRS 0x10 /* round robin arbitration 4 */ +#define CSR1_1_PRI 0x00 /* prioritized arbitration 4 */ + +#define CSR1_1_ARBT_DIS 0x0c /* arbitration time-out disable 3-2 */ +#define CSR1_1_ARBT_63 0x08 /* arbitration time-out 63 usec 3-2 */ +#define CSR1_1_ARBT_31 0x04 /* arbitration time-out 31 usec 3-2 */ +#define CSR1_1_ARBT_15 0x00 /* arbitration time-out 15 usec 3-2 */ + +#define CSR1_1_SBT_DIS 0x03 /* VME bus time-out disable 1-0 */ +#define CSR1_1_SBT_511 0x02 /* VME bus time-out 511 usec 1-0 */ +#define CSR1_1_SBT_255 0x01 /* VME bus time-out 255 usec 1-0 */ +#define CSR1_1_SBT_127 0x00 /* VME bus time-out 127 usec 1-0 */ + +/************************************************************************* +* CSR1_2 0x01 0x06 VMEbus requester control * +*************************************************************************/ + +#define CSR1_2_DWB 0x80 /* VMEbus request 7 */ +#define CSR1_2_OWN 0x40 /* VMEbus request (status) 6 */ + +#define CSR1_2_RQT_DIS 0x30 /* request time-out disable 5-4 */ +#define CSR1_2_RQT_1023 0x20 /* request time-out 1023 usec 5-4 */ +#define CSR1_2_RQT_511 0x10 /* request time-out 511 usec 5-4 */ +#define CSR1_2_RQT_255 0x00 /* request time-out 255 usec 5-4 */ + +#define CSR1_2_RNV 0x0c /* release never 3-2 */ +#define CSR1_2_RBC 0x08 /* release when bus clear 3-2 */ +#define CSR1_2_RWD 0x04 /* release when done 3-2 */ +#define CSR1_2_ROR 0x00 /* release on request 3-2 */ + +#define CSR1_2_BR3 0x03 /* VMEbus request level 3 1-0 */ +#define CSR1_2_BR2 0x02 /* VMEbus request level 2 1-0 */ +#define CSR1_2_BR1 0x01 /* VMEbus request level 1 1-0 */ +#define CSR1_2_BR0 0x00 /* VMEbus request level 0 1-0 */ + +/************************************************************************* +* CSR1_3 0x01 0x07 VMEbus master control * +*************************************************************************/ + +#define CSR1_3_RMC 0x80 /* read-modify-write cycle 7 */ + +#define CSR1_3_AAMEN 0x40 /* addess modifier code enable 6 */ +#define CSR1_3_AAMDIS 0x00 /* addess modifier code disable 6 */ +#define CSR1_3_AAM 0x3f /* addess modifier code (mask) 5-0 */ + +/************************************************************************* +* CSR2_0 0x02 0x08 unused * +* to * +* CSR3_1 0x03 0x0d unused * +*************************************************************************/ + +/************************************************************************* +* CSR3_2 0x03 0x0e interface register address * +*************************************************************************/ + +#define CSR3_2_IFRA_H 0xff /* interface register addess (mask) 7-0 */ + +/************************************************************************* +* CSR3_3 0x03 0x0f interface register address * +*************************************************************************/ + +#define CSR3_3_IFRA_L 0xf0 /* interface register addess (mask) 7-4 */ + +#define CSR3_3_IFRSUP 0x02 /* respond to supervisor 1 */ +#define CSR3_3_IFRUSR 0x01 /* respond to user 0 */ + +/************************************************************************* +* CSR4_01 0x04 0x10 slave address 0 * +*************************************************************************/ + +#define CSR4_01_SL0A 0xffff /* slave addess 0 (mask) 15-0 */ + +/************************************************************************* +* CSR4_23 0x04 0x12 address mask 0 * +*************************************************************************/ + +#define CSR4_23_AM0A 0xffff /* address mask 0 (mask) 15-0 */ + +/************************************************************************* +* CSR5_01 0x05 0x14 mapping address 0 * +*************************************************************************/ + +#define CSR5_01_MP0A 0xffff /* mapping address 0 (mask) 15-0 */ + +/************************************************************************* +* CSR5_23 0x05 0x16 slave control 0 * +*************************************************************************/ + +#define CSR5_23_A32EN0 0x0020 /* respond to extended 5 */ +#define CSR5_23_A24EN0 0x0010 /* respond to standard 4 */ +#define CSR5_23_SUPER0 0x0008 /* respond to supervisor 3 */ +#define CSR5_23_USER0 0x0004 /* respond to user 2 */ +#define CSR5_23_PRGRM0 0x0002 /* respond to program 1 */ +#define CSR5_23_DATA0 0x0001 /* respond to data 0 */ + +/************************************************************************* +* CSR6_01 0x06 0x18 save address 1 * +*************************************************************************/ + +#define CSR6_01_SL0A 0xffff /* slave addess 1 (mask) 15-0 */ + +/************************************************************************* +* CSR6_23 0x06 0x1a address mask 1 * +*************************************************************************/ + +#define CSR6_23_AM0A 0xffff /* address mask 1 (mask) 15-0 */ + +/************************************************************************* +* CSR7_01 0x07 0x1c mapping addess 1 * +*************************************************************************/ + +#define CSR7_01_MP0A 0xffff /* mapping address 1 (mask) 15-0 */ + +/************************************************************************* +* CSR7_23 0x07 0x1e slave control 1 * +*************************************************************************/ + +#define CSR7_23_A32EN0 0x0020 /* respond to extended 5 */ +#define CSR7_23_A24EN0 0x0010 /* respond to standard 4 */ +#define CSR7_23_SUPER0 0x0008 /* respond to supervisor 3 */ +#define CSR7_23_USER0 0x0004 /* respond to user 2 */ +#define CSR7_23_PRGRM0 0x0002 /* respond to program 1 */ +#define CSR7_23_DATA0 0x0001 /* respond to data 0 */ + +/************************************************************************* +* CSR12 0x0c 0x30 tick timer 0 control * +*************************************************************************/ + +#define CSR12_TT0CEN 0x80000000 /* tick timer 0 enable */ + +/************************************************************************* +* CSR13 0x0d 0x34 tick timer 0 counter * +*************************************************************************/ + +#define CSR13_TT0OCL 0x80000000 /* overflow counter clear */ + +/************************************************************************* +* CSR14 0x0e 0x38 tick timer 1 control * +*************************************************************************/ + +#define CSR14_TT1CEN 0x80000000 /* tick timer 1 enable */ + +/************************************************************************* +* CSR15 0x0f 0x3c tick timer 1 counter * +*************************************************************************/ + +#define CSR15_TT1OCL 0x80000000 /* overflow counter clear */ + +/************************************************************************* +* CSR16 0x10 0x40 watchdog timer control * +*************************************************************************/ + +#define CSR16_WDTCEN 0x80000000 /* watchdog timer enable */ +#define CSR16_WDTSFE 0x40000000 /* watchdog timer SYSFAIL enable*/ + +/************************************************************************* +* CSR17 0x11 0x44 watchdog timer counter * +*************************************************************************/ + +#define CSR17_WDTCLR 0x80000000 /* watchdog timer counter clear */ +#define CSR17_WDTOUT 0x01000000 /* watchdog timeout (status) */ + +/************************************************************************* +* CSR18_1 0x12 0x49 interrupt sense mode control * +*************************************************************************/ + +#define CSR18_1_ACFLVL 0x80 /* ACFAIL int level(1)/edge(0) sense 7 */ +#define CSR18_1_ABTLVL 0x40 /* ABORT int level(1)/edge(0) sense 6 */ +#define CSR18_1_SFLVL 0x20 /* SYSFAIL int level(1)/edge(0) sense 5 */ + +/************************************************************************* +* CSR20 0x14 0x50 interrupt status * +*************************************************************************/ + +#define CSR20_ACFIRQ 0x80000000 /* ACFAIL interrupt 31 */ +#define CSR20_ABTIRQ 0x40000000 /* ABORT interrupt 30 */ +#define CSR20_SFIRQ 0x20000000 /* SYSFAIL interrupt 29 */ +#define CSR20_BERIRQ 0x10000000 /* BERR interrupt 28 */ +#define CSR20_IAKIRQ 0x08000000 /* IAK interrupt 27 */ +#define CSR20_SRQIRQ 0x04000000 /* SRQ interrupt 26 */ +#define CSR20_SAKIRQ 0x02000000 /* SAKF interrupt 25 */ + +#define CSR20_GP7IRQ 0x00800000 /* GP7 interrupt 23 */ +#define CSR20_DMAIRQ 0x00400000 /* DMA interrupt 22 */ +#define CSR20_TT1IRQ 0x00200000 /* TT1 interrupt 21 */ +#define CSR20_TT0IRQ 0x00100000 /* TT0 interrupt 20 */ +#define CSR20_GP3IRQ 0x00080000 /* GP3 interrupt 19 */ +#define CSR20_GP2IRQ 0x00040000 /* GP2 interrupt 18 */ +#define CSR20_GP1IRQ 0x00020000 /* GP1 interrupt 17 */ +#define CSR20_GP0IRQ 0x00010000 /* GP0 interrupt 16 */ + +#define CSR20_SWIRQ7 0x00008000 /* SWIRQ7 interrupt 15 */ +#define CSR20_SWIRQ6 0x00004000 /* SWIRQ6 interrupt 14 */ +#define CSR20_SWIRQ5 0x00002000 /* SWIRQ5 interrupt 13 */ +#define CSR20_SWIRQ4 0x00001000 /* SWIRQ4 interrupt 12 */ +#define CSR20_SWIRQ3 0x00000800 /* SWIRQ3 interrupt 11 */ +#define CSR20_SWIRQ2 0x00000400 /* SWIRQ2 interrupt 10 */ +#define CSR20_SWIRQ1 0x00000200 /* SWIRQ1 interrupt 9 */ +#define CSR20_SWIRQ0 0x00000100 /* SWIRQ0 interrupt 8 */ + +#define CSR20_VMIRQ7 0x00000080 /* VMIRQ7 interrupt 7 */ +#define CSR20_VMIRQ6 0x00000040 /* VMIRQ7 interrupt 6 */ +#define CSR20_VMIRQ5 0x00000020 /* VMIRQ7 interrupt 5 */ +#define CSR20_VMIRQ4 0x00000010 /* VMIRQ4 interrupt 4 */ +#define CSR20_VMIRQ3 0x00000008 /* VMIRQ3 interrupt 3 */ +#define CSR20_VMIRQ2 0x00000004 /* VMIRQ2 interrupt 2 */ +#define CSR20_VMIRQ1 0x00000002 /* VMIRQ1 interrupt 1 */ + +/************************************************************************* +* CSR21 0x14 0x50 interrupt enable * +*************************************************************************/ + +#define CSR21_ACFIEN 0x80000000 /* ACFAIL interrupt 31 */ +#define CSR21_ABTIEN 0x40000000 /* ABORT interrupt 30 */ +#define CSR21_SFIEN 0x20000000 /* SYSFAIL interrupt 29 */ +#define CSR21_BERIEN 0x10000000 /* BERR interrupt 28 */ +#define CSR21_IAKIEN 0x08000000 /* IAK interrupt 27 */ +#define CSR21_SRQIEN 0x04000000 /* SRQ interrupt 26 */ +#define CSR21_SAKIEN 0x02000000 /* SAKF interrupt 25 */ + +#define CSR21_GP7IEN 0x00800000 /* GP7 interrupt 23 */ +#define CSR21_DMAIEN 0x00400000 /* DMA interrupt 22 */ +#define CSR21_TT1IEN 0x00200000 /* TT1 interrupt 21 */ +#define CSR21_TT0IEN 0x00100000 /* TT0 interrupt 20 */ +#define CSR21_GP3IEN 0x00080000 /* GP3 interrupt 19 */ +#define CSR21_GP2IEN 0x00040000 /* GP2 interrupt 18 */ +#define CSR21_GP1IEN 0x00020000 /* GP1 interrupt 17 */ +#define CSR21_GP0IEN 0x00010000 /* GP0 interrupt 16 */ + +#define CSR21_SWIEN7 0x00008000 /* SWIRQ7 interrupt 15 */ +#define CSR21_SWIEN6 0x00004000 /* SWIRQ6 interrupt 14 */ +#define CSR21_SWIEN5 0x00002000 /* SWIRQ5 interrupt 13 */ +#define CSR21_SWIEN4 0x00001000 /* SWIRQ4 interrupt 12 */ +#define CSR21_SWIEN3 0x00000800 /* SWIRQ3 interrupt 11 */ +#define CSR21_SWIEN2 0x00000400 /* SWIRQ2 interrupt 10 */ +#define CSR21_SWIEN1 0x00000200 /* SWIRQ1 interrupt 9 */ +#define CSR21_SWIEN0 0x00000100 /* SWIRQ0 interrupt 8 */ + +#define CSR21_VMIEN7 0x00000080 /* VMIRQ7 interrupt 7 */ +#define CSR21_VMIEN6 0x00000040 /* VMIRQ7 interrupt 6 */ +#define CSR21_VMIEN5 0x00000020 /* VMIRQ7 interrupt 5 */ +#define CSR21_VMIEN4 0x00000010 /* VMIRQ4 interrupt 4 */ +#define CSR21_VMIEN3 0x00000008 /* VMIRQ3 interrupt 3 */ +#define CSR21_VMIEN2 0x00000004 /* VMIRQ2 interrupt 2 */ +#define CSR21_VMIEN1 0x00000002 /* VMIRQ1 interrupt 1 */ + +/************************************************************************* +* CSR23 0x16 0x5c interrupt clear * +*************************************************************************/ + +#define CSR23_ACFICL 0x80000000 /* ACFAIL clear 31 */ +#define CSR23_ABTICL 0x40000000 /* ABORT clear 30 */ +#define CSR23_SFICL 0x20000000 /* SYSFAIL clear 29 */ +#define CSR23_IAKICL 0x08000000 /* IAK clear 27 */ +#define CSR23_SRQICL 0x04000000 /* SRQ clear 26 */ +#define CSR23_SAKICL 0x02000000 /* SAK clear 25 */ +#define CSR23_DMAICL 0x00400000 /* DMA clear 22 */ +#define CSR23_TT1ICL 0x00200000 /* TT1 clear 21 */ +#define CSR23_TT0ICL 0x00100000 /* TT0 clear 20 */ + +/************************************************************************* +* IFR0 0x1c 0x70 interface register 0 * +*************************************************************************/ + +#define IFR0_SRQF 0x80000000 /* SRQ clear 31 */ + +/************************************************************************* +* IFR1 0x1d 0x74 interface register 1 * +*************************************************************************/ + +#define IFR1_SAKF 0x80000000 /* SAK clear 31 */ + +/************************************************************************* +* IFR3 0x1f 0x7c interface register 3 * +*************************************************************************/ + +#define IFR3_SWREN 0x80000000 /* software reset enable bit 31 */ + +#ifdef __cplusplus +} +#endif + +#endif /* INCdga001Vmeh */ diff --git a/h/drv/vme/unsupported/ivac.h b/h/drv/vme/unsupported/ivac.h new file mode 100644 index 0000000..49c446b --- /dev/null +++ b/h/drv/vme/unsupported/ivac.h @@ -0,0 +1,659 @@ +/* ivac.h - Ironics/VTC's VME Address Controller (VAC) constants */ + +/* +modification history +-------------------- +01f,22sep92,rrr added support for c++ +01e,07jul92,jwt cleaned up ANSI compiler warnings. +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01b,31jan91,rjt initial release to windriver after many minor fixes. +01a,25jul90,rjt writen by modifying IV-SPRC sparcmon version. +*/ + +#ifndef __INCivach +#define __INCivach + +#ifdef __cplusplus +extern "C" { +#endif + +/* +Assembly language files should turn off type declarations by not +including those portions of this include file, this is done by +placing a "#define _ASMLANGUAGE" statement before this file is +included in any other files. + +Also, in order to incorparate stronger typing of all constants, and to +allow the same constants to be typed in C files,yet usable in +assembly files. An unorthadox method of TYPING is used by CONDITIONALLY +#define'ing the constant TYPES. If no _ASMLANGUAGE #define is present, +then the type is defined to a blank space, otherwise it is defined +to be a C type. This looks weird but works nicely. +*/ + + +/* +Naming of register names and constants was done ( or was attempted ) so that +the front end of the names would indicate a related group while the tail +end of the names would further define the purpose of the name. Some groups +often contained sub-groups. Also some names don't follow this convention for +the sake of readability and other reasons. + +An H_ prefix indicates that the constant is typed as a pointer to +unsigned short register. +An B_ prefix indicates that the constant is typed as a pointer to +unsigned char register. + +Because of unpredictability of structure sizing and placement for +different compilers, we use contants to access each register. + +Most constants are defined for consistancy in name AND intended usage. +BIT MANIPUATION is set up so that each bit field has 3 or more defines +associated with it. + +1. BIT VALUE MASK +2. ASSERTED VALUE(S) +3. DEASERTED VALUE + +Where ASSERTED VALUE = 0 and dasserted value = 0xff for ACTIVE LOW SIGNALS +or vice versa, +where ASSERTED VALUE = 0xff and dasserted value = 0 for ACTIVE HIGH SIGNALS. + +The active high bits may also be something other than 0xff for +multi-bit fields. EG: for at 2 bit active high field there may be +4 asserted values associated with it: 0x00 0x01 0x02 0x03. + +the bit field should be altered as follows: + new_reg_value = (old_reg_val & ~MASK) | (MASK & VALUE ) + +REGISTER BIT STATUS for a bit field has 2 or more defines associated with it. + +1. BIT MASK +2. POSSIBLE BIT VALUE +3. . +4 . + +returned_bit_field_status = MASK & reg_value + +Most constants are declared immediatly after the register they are used in. +Some constants are shared between more than 1 register and are only defined +once after the first register. +*/ + + +/* IMPORTANT NOTICE: NOT ALL CONSTANTS HAVE BEEN TESTED */ + + +/* The following #defines allow or disallow C types */ +#ifndef _ASMLANGUAGE +/* C code typing */ +#ifndef P_VA_TYPE +#define P_VA_TYPE (unsigned short *) +#endif +#ifndef VA_TYPE +#define VA_TYPE (unsigned short) +#endif +#else +/* No typing allowing in assembly */ +#define VA_TYPE +#define P_VA_TYPE +#endif /* _ASMLANGUAGE */ + + +#define VAC_ADR 0xfffd0000 +#define VAC_TYPE unsigned short + +/* +IMPORTANT +Some boards may require a special routine to access the VAC registers. +Example: a board whose cache must be bypassed to ensure register integrity. +If they do, there should be vaXetReg() macros #define'd to call that +special routine. Otherwise the following vaXetReg() macros will be used. +For portability reasons, it might be a good idea to only use vaXetReg() +to alter any VAC registers in C code. If this macro is insufficient +then "#undef vaRegSet" and write a C routine (or another macro) to replace it. +*/ + +#ifndef vaRegSet +#define vaRegSet(hReg,val) (*(hReg) = (VAC_TYPE) (val)) +#endif /* vaRegSet */ +#ifndef vaRegGet +#define vaRegGet(bReg) *(bReg) +#endif /* vaRegGet */ + +/* Slave Select mask and base registers */ +#define H_VAC_SLS1_MASK P_VA_TYPE (VAC_ADR + 0x0000) +#define H_VAC_SLS1_BASE P_VA_TYPE (VAC_ADR + 0x0100) +#define H_VAC_SLS0_MASK P_VA_TYPE (VAC_ADR + 0x0200) +#define H_VAC_SLS0_BASE P_VA_TYPE (VAC_ADR + 0x0300) + + +/* group & module Addr. decodes for IPC Reg. */ +#define H_VAC_ICFSEL P_VA_TYPE(VAC_ADR + 0x0400) +#define GROUP_BASE_MASK 0xff00 +#define MODULE_BASE_MASK 0x00ff +#define GROUP_SHIFT 0x0000 +#define MODULE_SHIFT 0x0008 + +/* DRAM Upper Limit Mask Register */ +#define H_VAC_DRAM_MASK P_VA_TYPE (VAC_ADR + 0x0500) + +/* Boundry 2 Address Reg. */ +#define H_VAC_B2_BASE P_VA_TYPE (VAC_ADR + 0x0600) + +/* Boundry 3 Address Reg. */ +#define H_VAC_B3_BASE P_VA_TYPE (VAC_ADR + 0x0700 ) + +/* A24 Base Address Reg. */ +#define H_VAC_A24_BASE P_VA_TYPE (VAC_ADR + 0x0800 ) + +/* Region 1,2,3 Attribute Reg. */ +#define H_VAC_R1_ATTRIB P_VA_TYPE (VAC_ADR + 0x0900) +#define H_VAC_R2_ATTRIB P_VA_TYPE (VAC_ADR + 0x0a00) +#define H_VAC_R3_ATTRIB P_VA_TYPE (VAC_ADR + 0x0b00 ) + +#define ATR_DATA_SZ_MASK VA_TYPE 0x8000 +#define ATR_D16 VA_TYPE 0x8000 +#define ATR_D32 VA_TYPE 0x0 + +#define ATR_ADR_SZ_MASK VA_TYPE 0x6000 +#define ATR_A16 VA_TYPE 0x2000 +#define ATR_A24 VA_TYPE 0x0000 +#define ATR_A32 VA_TYPE 0x4000 + +#define ATR_CACHE_MASK VA_TYPE 0x1000 +#define ATR_CACHE_INHIBIT VA_TYPE 0x1000 +#define ATR_CACHE_ENABLE VA_TYPE 0x0000 + +#define ATR_SEGMENT_MAP_MASK VA_TYPE 0x0c00 +#define ATR_NULL VA_TYPE 0x0 +#define ATR_SHR VA_TYPE 0x0400 +#define ATR_VSB VA_TYPE 0x0800 +#define ATR_VME VA_TYPE 0x0c00 + + +/* Dsack Timing Control Reg. */ +#define H_VAC_IO4_DSACK_CTL P_VA_TYPE (VAC_ADR + 0x0c00) +#define H_VAC_IO5_DSACK_CTL P_VA_TYPE (VAC_ADR + 0x0d00) +#define H_VAC_SHR_DSACK_CTL P_VA_TYPE (VAC_ADR + 0x0e00) +#define H_VAC_EPROM_DSACK_CTL P_VA_TYPE (VAC_ADR + 0x0f00) +#define H_VAC_IO0_DSACK_CTL P_VA_TYPE (VAC_ADR + 0x1000) +#define H_VAC_IO1_DSACK_CTL P_VA_TYPE (VAC_ADR + 0x1100) +#define H_VAC_IO2_DSACK_CTL P_VA_TYPE (VAC_ADR + 0x1200) +#define H_VAC_IO3_DSACK_CTL P_VA_TYPE (VAC_ADR + 0x1300) + +#define DSACK_DELAY_MASK 0xE000 +#define DSACK_DELAY_0 0x0000 +#define DSACK_DELAY_1 0x2000 +#define DSACK_DELAY_2 0x4000 +#define DSACK_DELAY_3 0x6000 +#define DSACK_DELAY_4 0x8000 +#define DSACK_DELAY_5 0xA000 +#define DSACK_DELAY_6 0xC000 +#define DSACK_DELAY_7 0xE000 + +#define DSACK1_ENABLE 0x1000 +#define DSASK0_ENABLE 0x0800 + +#define DSACK_RECOVERY_MASK 0x0700 +#define RECOVERY_DELAY_0 0x0000 +#define RECOVERY_DELAY_1 0x0100 +#define RECOVERY_DELAY_2 0x0200 +#define RECOVERY_DELAY_3 0x0300 +#define RECOVERY_DELAY_4 0x0400 +#define RECOVERY_DELAY_5 0x0500 +#define RECOVERY_DELAY_6 0x0600 +#define RECOVERY_DELAY_7 0x0700 + +#define IORD_DELAY_MASK 0x00c0 +#define IORD_DELAY_0 0x0000 +#define IORD_DELAY_1 0x0040 +#define IORD_DELAY_2 0x0080 +#define IORD_DELAY_3 0x00c0 + +#define IOWR_DELAY_MASK 0x0030 +#define IOWR_DELAY_0 0x0000 +#define IOWR_DELAY_1 0x0010 +#define IOWR_DELAY_2 0x0020 +#define IOWR_DELAY_3 0x0030 + +#define IOSELI_DELAY_MASK 0x000c +#define IOSELI_DELAY_0 0x0000 +#define IOSELI_DELAY_1 0x0004 +#define IOSELI_DELAY_2 0x0008 +#define IOSELI_DELAY_3 0x000c + +#define IORD_CYCLE_END_CTL 0x0002 +#define IOWR_CYCLE_END_CTL 0x0001 + +/* Decode Control Register */ +#define H_VAC_DECODE_CTL P_VA_TYPE (VAC_ADR + 0x1400) + +#define SLACKDR VA_TYPE 0x8000 +#define QDRAM VA_TYPE 0x4000 + +/* slave 1 device selection */ +#define SL1_MASK VA_TYPE 0x3000 +#define SL1DS1 VA_TYPE 0x2000 +#define SL1DS0 VA_TYPE 0x1000 +#define SL1_EPROM VA_TYPE 0x0000 +#define SL1_VSB VA_TYPE 0x1000 +#define SL1_SHRCS VA_TYPE 0x2000 +#define SL1_DRAM VA_TYPE 0x3000 + +#define SL1A32 VA_TYPE 0x0800 +#define SL1A16 VA_TYPE 0x0400 +#define QSL0 VA_TYPE 0x0200 +#define QSL1 VA_TYPE 0x0100 +#define QICF VA_TYPE 0x0080 +#define QBNDRY VA_TYPE 0x0040 +#define ACKDR VA_TYPE 0x0020 +#define REDSL1 VA_TYPE 0x0010 +#define REDSL0 VA_TYPE 0x0008 +#define DRDLY1 VA_TYPE 0x0004 +#define DRDLY0 VA_TYPE 0x0002 +#define QBFPU VA_TYPE 0x0001 + +/* VAC interrupt status register and its bit mask constants */ +#define H_VAC_IRQ_STAT P_VA_TYPE (VAC_ADR +0x1500 ) + + +#define VAC_IRQ_PIO9 VA_TYPE 0x8000 +#define VAC_IRQ_PIO8 VA_TYPE 0x4000 +#define VAC_IRQ_PIO7 VA_TYPE 0x2000 +#define VAC_IRQ_PIO4 VA_TYPE 0x1000 +#define VAC_IRQ_MBX VA_TYPE 0x0800 +#define VAC_IRQ_TMR VA_TYPE 0x0400 +#define VAC_IRQ_SIOA VA_TYPE 0x0200 +#define VAC_IRQ_SIOB VA_TYPE 0x0100 + + +/* VAC IRQ signal map and control register */ +#define H_VAC_IRQ_CTL P_VA_TYPE (VAC_ADR +0x1600 ) + +/* +The values are designed to be used as follows. The interrupt +source on the VAC and the actual PIO signals to the VIC are +combined to produce a VAC interrupt control value, or bit map, +that can be used with a mask value to toggle the control bits. + +Example: + control bit map IRQ pin dest VAC IRQ source + #define IRQ_VAC_TMR_CTL_MAP (IRQ_DEST_PIO10 << IRQ_VAC_SRC_TMR) + +To remove a VAC interrupt you must disable and enable the VAC interrupt +via the VAC Interrupt Control Register. + +Clear the IRQ map to disable the IRQ: + + sysVacFieldSet (H_VAC_IRQ_CTL, IRQ_VAC_TMR_CTL_MASK, + (IRQ_VAC_TMR_CTL_MAP & VAC_IRQ_DISABLE)); + +Map it back in to enable the IRQ: + + sysVacFieldSet (H_VAC_IRQ_CTL, IRQ_VAC_TMR_CTL_MASK, + (IRQ_VAC_TMR_CTL_MAP & VAC_IRQ_ENABLE)); +*/ + +#define IRQ_PIO9_CTL_MASK VA_TYPE 0xc000 +#define IRQ_PIO8_CTL_MASK VA_TYPE 0x3000 +#define IRQ_PIO7_CTL_MASK VA_TYPE 0x0c00 +#define IRQ_PIO4_CTL_MASK VA_TYPE 0x0300 +#define IRQ_MBX_CTL_MASK VA_TYPE 0x00c0 +#define IRQ_SIOA_CTL_MASK VA_TYPE 0x0030 +#define IRQ_SIOB_CTL_MASK VA_TYPE 0x000c +#define IRQ_VAC_TMR_CTL_MASK VA_TYPE 0x0003 + +#define VAC_IRQ_DISABLE 0 +#define VAC_IRQ_ENABLE 0xffff + + +/* shift values to map the pio signal destination */ +#define IRQ_SRC_PIO9 VA_TYPE 0xE +#define IRQ_SRC_PIO8 VA_TYPE 0xC +#define IRQ_SRC_PIO7 VA_TYPE 0xA +#define IRQ_SRC_PIO4 VA_TYPE 0x8 +#define IRQ_SRC_MBX VA_TYPE 0x6 +#define IRQ_SRC_SIOA VA_TYPE 0x4 +#define IRQ_SRC_SIOB VA_TYPE 0x2 +#define IRQ_SRC_VAC_TMR VA_TYPE 0x0 + +/* pio signal destination */ +#define IRQ_DEST_NULL 0 +#define IRQ_DEST_PIO7 1 +#define IRQ_DEST_PIO10 2 +#define IRQ_DEST_PIO11 3 + + + +/* device present flags */ +#define H_VAC_DEVICE_LOC P_VA_TYPE (VAC_ADR +0x1700 ) + +#define IOSEL5_PRESENT VA_TYPE 0x0020 +#define IOSEL4_PRESENT VA_TYPE 0x0010 +#define IOSEL3_PRESENT VA_TYPE 0x0008 +#define IOSEL2_PRESENT VA_TYPE 0x0004 +#define IOSEL1_PRESENT VA_TYPE 0x0002 +#define IOSEL0_PRESENT VA_TYPE 0x0001 + +/* this reg used to init pio data out values */ +#define H_VAC_PIO_DATA P_VA_TYPE (VAC_ADR +0x1800 ) + +/* read only - contains login levels of pio pins */ +#define H_VAC_PIO_PIN P_VA_TYPE (VAC_ADR +0x1900 ) + +/* set up the direction of pio */ +#define H_VAC_PIO_DIR P_VA_TYPE (VAC_ADR + 0x1a00) + +/* assign functions to the pio */ +#define H_VAC_PIO_FUNC P_VA_TYPE (VAC_ADR + 0x1b00) + +/* pio bit mask defines */ +#define PIO0 VA_TYPE 0x0001 +#define PIO1 VA_TYPE 0x0002 +#define PIO2 VA_TYPE 0x0004 +#define PIO3 VA_TYPE 0x0008 +#define PIO4 VA_TYPE 0x0010 +#define PIO5 VA_TYPE 0x0020 +#define PIO6 VA_TYPE 0x0040 +#define PIO7 VA_TYPE 0x0080 +#define PIO8 VA_TYPE 0x0100 +#define PIO9 VA_TYPE 0x0200 +#define PIO10 VA_TYPE 0x0400 +#define PIO11 VA_TYPE 0x0800 +#define PIO12 VA_TYPE 0x1000 +#define PIO13 VA_TYPE 0x2000 +#define PIO9_DEBOUNCE_ENABLE VA_TYPE 0x4000 +#define CPU_SPACE_EMULATE VA_TYPE 0x8000 + +#define TXDA_TO_PIO0 VA_TYPE 0x0001 +#define RXTA_TO_PIO1 VA_TYPE 0x0002 +#define TXDB_TO_PIO2 VA_TYPE 0x0004 +#define TXDB_TO_PIO3 VA_TYPE 0x0008 +#define IORD_TO_PIO4 VA_TYPE 0x0010 +#define IOWR_TO_PIO5 VA_TYPE 0x0020 +#define IOSEL3_TO_PIO6 VA_TYPE 0x0040 +#define PIO7IRQ_TO_PIO7 VA_TYPE 0x0080 +#define IOSEL4_TO_PIO8 VA_TYPE 0x0100 +#define IOSEL5_TO_PIO9 VA_TYPE 0x0200 +#define PIO10IRQ_TO_PIO10 VA_TYPE 0x0400 +#define PIO11IRQ_TO_PIO10 VA_TYPE 0x0800 +#define SHRCS_TO_PIO12 VA_TYPE 0x1000 +#define IOSEL2_TO_PIO13 VA_TYPE 0x2000 +#define PIO9_DEBOUNCE_DISABLE VA_TYPE 0x4000 +#define CPU_SPACE_EMULATE_VIA_IOSEL5 VA_TYPE 0x8000 + +/* SIO STUFF */ + +/* +Get table for BAUD_PRESCALE_INIT VALS: + +NOTE +The SIO baud rate divisor is dependent on CPU_CLOCK +and is derived from the following formula + + / CPU clock rate \ + divisor = truncate | ---------------------------- + 0.5 | + \ 16 * (MAX baud rate desired) / + +where divisor > 8. + +This value is loaded into the top byte of the VAC CPU +clock divisor. + +The baud rate selection table will allow selection of +8 different baud rates. Each lower than the MAX baud rate +by a power of 2. If 9600 baud is the MAX baud rate, then +the following powers are available: + +baud select value baud rate + 7 76800 don't use + 6 19200 + 5 9600 + 4 4800 + 3 2400 + 2 1200 + 1 600 + 0 300 +*/ + +/* max rate cpu clk divisor */ +/* check these values for roundup */ +#define BAUD_9600_CLK_20MHz 0x2000 +#define BAUD_9600_CLK_25MHz 0x2800 +#define BAUD_9600_CLK_32MHz 0x3400 +#define BAUD_9600_CLK_33MHz 0x3500 + +#define BAUD_19200_CLK_20MHz 0x0fff /*subtract one from above formula*/ +#define BAUD_19200_CLK_25MHz 0x1400 +#define BAUD_19200_CLK_32MHz 0x1a00 +#define BAUD_19200_CLK_33MHz 0x1a00 +#define BAUD_19200_CLK_40MHz 0x2000 + +/*Baud Rate Prescaler used on CPU Clk. */ +#define H_VAC_BAUD_PRESCALE P_VA_TYPE (VAC_ADR + 0x1c00) + +/* control register */ +#define H_VAC_SIOA_MODE P_VA_TYPE (VAC_ADR + 0x1d00) + +/* control bits for both sioa and siob */ +#define SIO_CTL_ENABLE VA_TYPE 0xfcff +#define SIO_CTL_DISABLE VA_TYPE 0x0300 + +/* the following are masks */ +#define PARITY_ENABLE VA_TYPE 0x8000 +#define EVEN_PARITY VA_TYPE 0x4000 +#define EIGHT_BITS VA_TYPE 0x2000 + +#define BAUD_RATE_MASK VA_TYPE 0x1c00 + +#define RESET_RECV VA_TYPE 0x0200 +#define RESET_XMIT VA_TYPE 0x0100 +#define XMITER VA_TYPE 0x0080 +#define RECVER VA_TYPE 0x0040 +#define SEND_BREAK VA_TYPE 0x0020 +#define TXDA_TO_RXDA VA_TYPE 0x0010 + +/* NOTE: vac sio data bytes are taken from high 8 bits !! */ + +/* xmit data */ +#define H_VAC_SIOA_XMIT P_VA_TYPE (VAC_ADR + 0x1e00) + +/* control register */ +#define H_VAC_SIOB_MODE P_VA_TYPE (VAC_ADR + 0x1f00) + +/* rec data */ +#define H_VAC_SIOA_RECV P_VA_TYPE (VAC_ADR + 0x2000) +#define H_VAC_SIOB_RECV P_VA_TYPE (VAC_ADR + 0x2100) + +/* xmit data */ +#define H_VAC_SIOB_XMIT P_VA_TYPE (VAC_ADR + 0x2200) + +/* sio interrupt mask regs */ +#define H_VAC_SIOA_IRQ_MASK P_VA_TYPE (VAC_ADR + 0x2300) +#define H_VAC_SIOB_IRQ_MASK P_VA_TYPE (VAC_ADR + 0x2400) + +#define SINGLE_CHAR_RECV_MASK VA_TYPE 0x8000 +#define FIFO_FULL_MASK VA_TYPE 0x4000 +#define BREAK_CHANGE_MASK VA_TYPE 0x2000 +#define ERROR_MASK VA_TYPE 0x1000 +#define XMIT_READY_MASK VA_TYPE 0x0800 +#define XMIT_EMPTY_MASK VA_TYPE 0x0400 + +#define SIO_MASK_ENABLE VA_TYPE 0xffff +#define SIO_MASK_DISABLE VA_TYPE 0x0000 + + +/* sio status regs */ +#define H_VAC_SIOA_STAT P_VA_TYPE (VAC_ADR + 0x2500) +#define H_VAC_SIOB_STAT P_VA_TYPE (VAC_ADR + 0x2600) + +#define CHAR_READY VA_TYPE 0x8000 +#define FIFO_FULL VA_TYPE 0x4000 +#define BREAK_CHANGE VA_TYPE 0x2000 +#define PARITY_ERROR VA_TYPE 0x1000 +#define FRAMING_ERROR VA_TYPE 0x0800 +#define OVERRUN_ERROR VA_TYPE 0x0400 +#define XMIT_READY VA_TYPE 0x0200 +#define XMIT_EMPTY VA_TYPE 0x0100 + +/* VAC TIMER STUFF */ + +#define H_VAC_TMR_DATA P_VA_TYPE (VAC_ADR + 0x2700) +#define H_VAC_TMR_CTL P_VA_TYPE (VAC_ADR + 0x2800) + +#define PRESCALER_IN_MASK VA_TYPE 0x3f00 +#define PRESCALER_IN_SHIFT 8 + +/* use this to read the instantaneous count value of prescaler */ +#define PRESCALER_OUT_MASK VA_TYPE 0x003f + +#define VAC_20MHZ_CPU_1MHZ_PRESCALER (19 << PRESCALER_IN_SHIFT) +#define VAC_25MHZ_CPU_1MHZ_PRESCALER (24 << PRESCALER_IN_SHIFT) +#define VAC_33MHZ_CPU_1MHZ_PRESCALER (32 << PRESCALER_IN_SHIFT) +#define VAC_40MHZ_CPU_1MHZ_PRESCALER (39 << PRESCALER_IN_SHIFT) + +/* Load command disables timer and then loads the interal timer registers */ +/* with the values in the prescaler control bits and the timer data register */ +#define RUN_LOAD_MASK VA_TYPE 0x4000 +#define RUN_CMD VA_TYPE 0x4000 +#define STOP_N_LOAD_CMD VA_TYPE 0x0000 + +/* You can set the timer to only produce a single irq after the time */ +/* has elapsed or reset the counter for continuous irqs */ +#define SINGLE_CONT_MASK VA_TYPE 0x8000 +#define SINGLE_IRQ_CMD VA_TYPE 0x8000 +#define CONT_IRQ_CMD VA_TYPE 0x0000 + +/************************************************************************* +* The vac timer rate is calculated as follows: +* +* +* / CPU_CLOCK \ +* | ------------------- | +* \ prescaler value + 1 / +*timer rate = ------------------------------ +* (65536 - time data reg. value) +* +* +* where prescaler is set to an arbitrary value. +* +* +*this gives us a time data register value of +* +* +* / CPU_CLOCK \ +* | ------------------- | +* \ prescaler value + 1 / +*timer data val = 65536 - ---------------------------- +* reqested timer rate +* +* +* +* +*PROGRAMING EXAMPLE: +* +* +*to get a 100Hz time rate with a 25MHz cpu clock +* +* - arbitrarily set prescaler value to 24 which will produce a +* 1MHz time period for each count in the time data register +* +* +* / 25000000 \ +* | --------- | +* \ 24 + 1 / +* time data val = 65536 - ------------- = 55536 = 0xd8f0 +* 100 +* +* +* - set prescaler +* *H_VAC_TMR_CTL = (*H_VAC_TMR_CTL & ~PRSCALER_IN_MASK) | +* VAC_25MHZ_CPU_1MHZ_PRESCALER ; +* - set timer data register +* *H_VAC_TMR_DATA = 0x8df0 ; +* +* - disable timer and load above values into internal registers +* *H_VAC_TMR_CTL = (*H_VAC_TMR_CTL & ~RUN_LOAD_MASK) | STOP_N_LOAD_CMD ; +* +* - set control for continuous operation +* *H_VAC_TMR_CTL = (*H_VAC_TMR_CTL & ~SINGLE_CONT_MASK) | CONT_CMD ; +* +* - start timer +* *H_VAC_TMR_CTL = (*H_VAC_TMR_CTL & ~RUN_LOAD_MASK) | RUN_CMD ; +* +***************************************************************************/ + + +/* Vac ID Reg. Read to Startup */ +#define H_VAC_ID_GO P_VA_TYPE (VAC_ADR + 0x2900) + + + +/* now for some generic io Macros */ +/* These macros are designed so that they can be dropped into a generic */ +/* serial handler, They are intended to be the basic building blocks used */ +/* to port any serial handler to use the VAC. */ + +#ifndef _ASMLANGUAGE + + +#define SIOA 0 +#define SIOB 1 + +/*the following macros expect SIOA or SIOB for u arg-there's no error checking*/ + +#define XMITER_EMPTY(u) ( XMIT_EMPTY & vaRegGet( H_VAC_SIOA_STAT + \ + ((u)* ( H_VAC_SIOB_STAT - H_VAC_SIOA_STAT ) ) ) ) +#define XMITER_READY(u) ( XMIT_READY & vaRegGet( H_VAC_SIOA_STAT + \ + ((u)* ( H_VAC_SIOB_STAT - H_VAC_SIOA_STAT ) ) ) ) +#define RECVER_READY(u) ( CHAR_READY & vaRegGet( H_VAC_SIOA_STAT + \ + ((u)* ( H_VAC_SIOB_STAT - H_VAC_SIOA_STAT ) ) ) ) + +#define XMIT_CHAR(u,ch) vaRegSet( H_VAC_SIOA_XMIT + \ + ((u)* ( H_VAC_SIOB_XMIT - H_VAC_SIOA_XMIT ) ) , \ + (unsigned short)( ((unsigned short)(ch))<<8 ) ) + +#define RECV_CHAR(u,pc) *(pc) = (unsigned char)(0x00ff & \ + vaRegGet( H_VAC_SIOA_RECV + \ + ((u)* ( H_VAC_SIOB_RECV - H_VAC_SIOA_RECV ) ) ) ) + +#define POLLING + +/* The following P_GETC and P_PUTC macros are designed for POLLING only!!! */ +/* NOTE: The delay loops may need to be altered depending on the board rev. */ +#ifdef POLLING + +/* P_PUTC(u,ch) - output char "ch" to "u" where "u" is SIOA or SIOB */ +/* add delay, NOTE: no fifo stuff allowed */ + +#define P_PUTC(u,ch) \ + while ( ! XMITER_READY( (u) ) ) ; \ + XMIT_CHAR( (u),(ch) ); \ + while ( XMITER_READY( (u) ) ) + + +/* P_GETC(u,pc) - input char into char pointer "pc" from */ +/* "u" where "u" is SIOA or SIOB */ + +#define P_GETC(u,pc) \ + { \ + int x; \ + while ( ! RECVER_READY( (u) ) ) \ + for(x=0;x<100;x++) ; \ + RECV_CHAR( (u), (pc) ) ; \ + } + +#endif /* POLLING */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCivach */ diff --git a/h/drv/vme/unsupported/mb86986Vme.h b/h/drv/vme/unsupported/mb86986Vme.h new file mode 100644 index 0000000..ea2adc8 --- /dev/null +++ b/h/drv/vme/unsupported/mb86986Vme.h @@ -0,0 +1,437 @@ +/* mb86986Vme.h - Fujitsu MB86986 MBus to VMEbus Interface Controller header */ + +/* Copyright 1994-1995 Wind River Systems, Inc. */ + +/* Copyright 1994-1995 FORCE COMPUTERS */ + +/* +modification history +-------------------- +01c,15mar95,vin integrated with 5.2. +01b,11apr94,lsr suppressed the MVIC_MBUS_ID define to be sure that + the ID is somewhere defined. +01a,01jun93,tkj original MVIC release (Derived from vbic.h 01e). +*/ + +/* +This header file defines the register layout of the Fujitsu MB86986 +MBus to VMEbus Interface Controller chip (MVIC) and supplies alpha-numeric +equivalences for register bit definitions. +*/ + +/* _PFN = 24 bit Page frame number = Physical address >> PAGE_SHIFT */ +/* This is needed because the full physical address is 36 bits. */ + +/* _OFS = Offset from preceeding _PFN entry. */ +/* This can be used to compute both the virtual and physical addresses. */ + +#ifndef __INCmb86986Vmeh +#define __INCmb86986Vmeh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* typedefs */ + +typedef struct /* MVICInit - MVIC chip initialization data for mvicInit() */ + { + FUNCPTR mvicNmiRoutine; /* MVIC A16 NMI: Interrupt handler */ + int mvicNmiArg; /* Argument for above */ + FUNCPTR mvicDdRoutine; /* MVIC DMA Done Int: Int. Handler */ + int mvicDdArg; /* Argument for above */ + FUNCPTR mvicDeRoutine; /* MVIC DMA Error Int: Int. Handler */ + int mvicDeArg; /* Argument for above */ + FUNCPTR mvicSeRoutine; /* MVIC Slave Error Int: Int. Handler*/ + int mvicSeArg; /* Argument for above */ + FUNCPTR mvicMeRoutine; /*MVIC Master Error Int: Int. Handler*/ + int mvicMeArg; /* Argument for above */ + UINT mvicMbar; /* MBAR - MBus Base Address Register */ + UINT mvicVmcr; /* VMCR - VMEbus Master Configuration*/ + UINT mvicVscr; /* VSCR - VMEbus Slave Configuration */ + UINT mvicVasmbar; /* VASMBAR - VMEbus A16 Slave */ + UINT mvicVa16rnr; /* VA16RNR - VMEbus A16 Reset & NMI */ + void * mvicVrtBase; /* First virtual address of A24 VDMA */ + void * mvicVrtTop; /* Last virtual address of A24 VDMA */ + } MVICInit; + +#endif /* _ASMLANGUAGE */ + +/****************************************************************************** +* +* Control register definitions +*/ + + /* Add MVIC's MBus ID to a _PFN */ +#define MVIC_PFN_WITH_MID(pfn) ((0x01000*MVIC_MBUS_ID)+(pfn)) + +#define MVIC_PFN MVIC_PFN_WITH_MID(0xff0fff) /* Chip Physical Address */ + +#define MVIC_MIR_OFS 0xffc /* MBus ID Register */ +#define MVIC_MBAR_OFS 0xff8 /* MBUS Base Address Register */ + +#define MVIC_VMCR_OFS 0xff0 /* VMEbus Master Configuration Register */ +#define MVIC_VSCR_OFS 0xfe8 /* VMEbus Slave Configuration Register */ +#define MVIC_VASMBAR_OFS 0xfe0 /*VMEbus A16 Slave MBus Base Address Register*/ +#define MVIC_VA16RNR_OFS 0xfd8 /* VMEbus A16 Reset & NMI Register */ +#define MVIC_DCSR_OFS 0xfd0 /* DMA Control Shadow Register */ +#define MVIC_DMRSASR_OFS 0xfc8 /* DMA MBus Read Starting Address Register */ +#define MVIC_DMWSASR_OFS 0xfc0 /* DMA MBus Write Starting Address Register */ +#define MVIC_DNCBPR_OFS 0xfb8 /* DMA Next Command Block Pointer Register */ +#define MVIC_ISR_OFS 0xfb0 /* MVIC Interrupt Status Register */ +#define MVIC_SENDI_OFS 0xfa0 /* VMEbus Send Interrupt Register */ +#define MVIC_VL7IAR_OFS 0xf7c /* VMEbus Level 7 Int. Acknowledge Register */ +#define MVIC_VL6IAR_OFS 0xf78 /* VMEbus Level 6 Int. Acknowledge Register */ +#define MVIC_VL5IAR_OFS 0xf74 /* VMEbus Level 5 Int. Acknowledge Register */ +#define MVIC_VL4IAR_OFS 0xf70 /* VMEbus Level 4 Int. Acknowledge Register */ +#define MVIC_VL3IAR_OFS 0xf6c /* VMEbus Level 3 Int. Acknowledge Register */ +#define MVIC_VL2IAR_OFS 0xf68 /* VMEbus Level 2 Int. Acknowledge Register */ +#define MVIC_VL1IAR_OFS 0xf64 /* VMEbus Level 1 Int. Acknowledge Register */ +#define MVIC_VTBAR_OFS 0x000 /* VDMA Translation Base Address Register */ + +/****************************************************************************** +* Control register field definitions +*/ + +/* +* MVIC_MIR -- MBus ID Register +*/ + +#define MVIC_MIR (*(UINT *) (MMU_MVIC_VA+MVIC_MIR_OFS)) + +/* MVIC_MIR_PART -- Part number */ +#define MVIC_MIR_PART_MASK 0xffff0000 +#define MVIC_MIR_PART_SHIFT 16 + +/* MVIC_MIR_DEV -- Device number */ +#define MVIC_MIR_DEV_MASK 0x0000ff00 +#define MVIC_MIR_DEV_SHIFT 8 + +/* MVIC_MIR_REV -- Revision */ +#define MVIC_MIR_REV_MASK 0x000000f0 +#define MVIC_MIR_REV_SHIFT 4 + +/* MVIC_MIR_VEN -- Vendor */ +#define MVIC_MIR_VEN_MASK 0x0000000f +#define MVIC_MIR_VEN_SHIFT 0 + +/* +* MVIC_MBAR -- MBus Base Address Register +*/ + +#define MVIC_MBAR (*(UINT *) (MMU_MVIC_VA+MVIC_MBAR_OFS)) + +/* MVIC_MBAR_NVMSBA -- (MBus -> VME) Normal VME MBus Slave Base Address */ +#define MVIC_MBAR_NVMSBA_MASK 0xf0000000 +#define MVIC_MBAR_NVMSBA_SHIFT 28 + +/* MVIC_MBAR_BVMSBA -- (MBus -> VME) Block mode VME MBus Slave Base Address */ +#define MVIC_MBAR_BVMSBA_MASK 0x0f000000 +#define MVIC_MBAR_BVMSBA_SHIFT 24 + +/* MVIC_MBAR_UVMSBA -- + (MBus -> VME) User defined addr modifier VME MBus Slave Base Address */ +#define MVIC_MBAR_UVMSBA_MASK 0x00f00000 +#define MVIC_MBAR_UVMSBA_SHIFT 20 + +/* MVIC_MBAR_MMBA -- (A32, A24 VME -> MBus) MBus Master Base Address */ +#define MVIC_MBAR_MMBA_MASK 0x0000fff0 +#define MVIC_MBAR_MMBA_SHIFT 4 + +/* MVIC_MBAR_TT -- Timer Test */ +#define MVIC_MBAR_TT_MASK 0x00000008 +#define MVIC_MBAR_TT_ENABLE 0x00000008 +#define MVIC_MBAR_TT_ENABLE_NOT 0 +#define MVIC_MBAR_TT_DISABLE MVIC_MBAR_TT_ENABLE_NOT + +/* MVIC_MBAR_LB -- Loopback */ +#define MVIC_MBAR_LB_MASK 0x00000004 +#define MVIC_MBAR_LB_ENABLE 0x00000004 +#define MVIC_MBAR_LB_ENABLE_NOT 0 +#define MVIC_MBAR_LB_DISABLE MVIC_MBAR_LB_ENABLE_NOT + +/* MVIC_MBAR_MR -- (MBus -> VME) MBus Retry Period */ +#define MVIC_MBAR_MR_MASK 0x00000003 /* Time @ 33 1/3 MHz */ +#define MVIC_MBAR_MR_1024 0x00000000 /* 30.7 usec */ +#define MVIC_MBAR_MR_256 0x00000001 /* 7.7 usec */ +#define MVIC_MBAR_MR_64 0x00000002 /* 1.9 usec */ +#define MVIC_MBAR_MR_NONE 0x00000003 /* No time out */ + +/* +* MVIC_VMCR -- VMEbus Master Configuration Register -- Read/Write +*/ + +#define MVIC_VMCR (*(UINT *) (MMU_MVIC_VA+MVIC_VMCR_OFS)) + +/* MVIC_VMCR_VMSA32ASE -- + (A32 VME -> MBus) VME MBus Slave A32 Address space enable */ +#define MVIC_VMCR_VMSA32ASE_MASK 0x80000000 +#define MVIC_VMCR_VMSA32ASE_ENABLE 0x80000000 +#define MVIC_VMCR_VMSA32ASE_ENABLE_NOT 0 +#define MVIC_VMCR_VMSA32ASE_DISABLE MVIC_VMCR_VMSA32ASE_ENABLE_NOT + +/* MVIC_VMCR_VMSA24ASE -- + (A24 VME -> MBus) VME MBus Slave A24 Address space enable */ +#define MVIC_VMCR_VMSA24ASE_MASK 0x40000000 +#define MVIC_VMCR_VMSA24ASE_ENABLE 0x40000000 +#define MVIC_VMCR_VMSA24ASE_ENABLE_NOT 0 +#define MVIC_VMCR_VMSA24ASE_DISABLE MVIC_VMCR_VMSA24ASE_ENABLE_NOT + +/* MVIC_VMCR_VMSA16ASE -- + (A16 VME -> MBus) VME MBus Slave A16 Address space enable */ +#define MVIC_VMCR_VMSA16ASE_MASK 0x20000000 +#define MVIC_VMCR_VMSA16ASE_ENABLE 0x20000000 +#define MVIC_VMCR_VMSA16ASE_ENABLE_NOT 0 +#define MVIC_VMCR_VMSA16ASE_DISABLE MVIC_VMCR_VMSA16ASE_ENABLE_NOT + +/* MVIC_VMCR_A32UAM -- (MBus -> A32 VME) A32 User defined Address Modifier */ +#define MVIC_VMCR_A32UAM_MASK 0x0f000000 +#define MVIC_VMCR_A32UAM_SHIFT 24 + +/* MVIC_VMCR_A24UAM -- (MBus -> A24 VME) A24 User defined Address Modifier */ +#define MVIC_VMCR_A24UAM_MASK 0x00f00000 +#define MVIC_VMCR_A24UAM_SHIFT 20 + +/* MVIC_VMCR_A16UAM -- (MBus -> A16 VME) A16 User defined Address Modifier */ +#define MVIC_VMCR_A16UAM_MASK 0x000f0000 +#define MVIC_VMCR_A16UAM_SHIFT 16 + +/* MVIC_VMCR_DVMA -- (A24 VME -> MBus) A24 DVMA Base Address */ +#define MVIC_VMCR_DVMA_MASK 0x00007800 +#define MVIC_VMCR_DVMA_SHIFT 11 + +/* MVIC_VMCR_IRL -- (-> VME) Interrupt Request Level */ +#define MVIC_VMCR_IRL_MASK 0x00000700 +#define MVIC_VMCR_IRL_SHIFT 8 + +/* MVIC_VMCR_DT -- (MBus -> VME) VMEbus DTACK Time-out */ +#define MVIC_VMCR_DT_MASK 0x000000c0 /* Time @ 33 1/3 MHz */ +#define MVIC_VMCR_DT_2048 0x00000000 /* 61.4 usec */ +#define MVIC_VMCR_DT_512 0x00000040 /* 15.4 usec */ +#define MVIC_VMCR_DT_128 0x00000080 /* 3.8 usec */ +#define MVIC_VMCR_DT_NONE 0x000000c0 /* No time out */ + +/* MVIC_VMCR_BRT -- (MBus -> VME) VMEbus Bus Request Time-out */ +#define MVIC_VMCR_BRT_MASK 0x00000030 /* Time @ 33 1/3 MHz */ +#define MVIC_VMCR_BRT_64K 0x00000000 /* 1,966.1 usec */ +#define MVIC_VMCR_BRT_16K 0x00000010 /* 491.5 usec */ +#define MVIC_VMCR_BRT_512 0x00000020 /* 12.8 usec */ +#define MVIC_VMCR_BRT_NONE 0x00000030 /* No time out */ + +/* MVIC_VMCR_BRL -- (MBus -> VME) Bus Request Level */ +#define MVIC_VMCR_BRL_MASK 0x0000000c +#define MVIC_VMCR_BRL_SHIFT 2 + +/* MVIC_VMCR_VAM -- VMEbus Arbiter Mode */ +#define MVIC_VMCR_VAM_MASK 0x00000002 +#define MVIC_VMCR_VAM_ROUND_ROBIN 0x00000002 +#define MVIC_VMCR_VAM_FIXED 0 + +/* MVIC_VMCR_S1E -- Slot 1 Enable */ +#define MVIC_VMCR_S1E_MASK 0x00000001 +#define MVIC_VMCR_S1E_ENABLE 0x00000001 +#define MVIC_VMCR_S1E_ENABLE_NOT 0 +#define MVIC_VMCR_S1E_DISABLE MVIC_VMCR_S1E_ENABLE_NOT + +/* +* MVIC_VSCR -- VMEbus Slave Configuration Register -- Read/Write +*/ + +#define MVIC_VSCR (*(UINT *) (MMU_MVIC_VA+MVIC_VSCR_OFS)) + +/* MVIC_VSCR_WSZ -- (A32 VME -> MBus) A32 VME Slave Window Size */ +#define MVIC_VSCR_WSZ_MASK 0x0f000000 +#define MVIC_VSCR_WSZ_16M 0x00000000 +#define MVIC_VSCR_WSZ_32M 0x01000000 +#define MVIC_VSCR_WSZ_64M 0x02000000 +#define MVIC_VSCR_WSZ_128M 0x03000000 +#define MVIC_VSCR_WSZ_256M 0x04000000 +#define MVIC_VSCR_WSZ_512M 0x05000000 +#define MVIC_VSCR_WSZ_1024M 0x06000000 +#define MVIC_VSCR_WSZ_2048M 0x07000000 +#define MVIC_VSCR_WSZ_4096M 0x08000000 +#define MVIC_VSCR_WSZ_SHIFT 24 + +/* MVIC_VSCR_WST -- (A32 VME -> MBus) A32 VME Slave Window Start */ +#define MVIC_VSCR_WST_MASK 0x00ff0000 +#define MVIC_VSCR_WST_SHIFT 16 + +/* MVIC_VSCR_SBA -- (A16 VME -> MBus) A16 Slave VME Base Address */ +#define MVIC_VSCR_SBA_MASK 0x0000ffff +#define MVIC_VSCR_SBA_SHIFT 0 + +/* +* MVIC_VASMBAR -- + (A16 VME -> MBus) VMEbus A16 Slave MBus Base Address Register +*/ + +#define MVIC_VASMBAR (*(UINT *) (MMU_MVIC_VA + MVIC_VASMBAR_OFS)) + +/* +* MVIC_VA16RNR -- + (A16 VME -> MBus) VMEbus A16 Reset & NMI Register -- Read/Write +*/ + +#define MVIC_VA16RNR (*(UINT *) (MMU_MVIC_VA + MVIC_VA16RNR_OFS)) + +/* Reset */ +/* MVIC_VA16RNR_VA16SRA -- (A16 VME ->) VMEbus A16 Slave Reset Address */ +#define MVIC_VA16RNR_VA16SRA_MASK 0xfffe0000 +#define MVIC_VA16RNR_VA16SRA_SHIFT 17 + +/* MVIC_VA16RNR_A16SRE -- (A16 VME ->) A16 Reset Enable */ +#define MVIC_VA16RNR_A16RE_MASK 0x00010000 +#define MVIC_VA16RNR_A16RE_ENABLE 0x00010000 +#define MVIC_VA16RNR_A16RE_ENABLE_NOT 0 +#define MVIC_VA16RNR_A16RE_DISABLE MVIC_VA16RNR_A16RE_ENABLE_NOT + +/* MVIC_VA16RNR_VA16SR -- + (A16 VME ->) VMEbus A16 Slave Reset Address & Enable (Composite) */ +#define MVIC_VA16RNR_VA16SR_MASK 0xffff0000 +#define MVIC_VA16RNR_VA16SR_SHIFT 16 + +/* NMI */ +/* MVIC_VA16RNR_VA16SNA -- (A16 VME ->) VMEbus A16 Slave NMI Address */ +#define MVIC_VA16RNR_VA16SNA_MASK 0x00000fffe +#define MVIC_VA16RNR_VA16SNA_SHIFT 1 + +/* MVIC_VA16RNR_A16NE -- (A16 VME ->) A16 NMI Enable */ +#define MVIC_VA16RNR_A16NE_MASK 0x00000001 +#define MVIC_VA16RNR_A16NE_ENABLE 0x00000001 +#define MVIC_VA16RNR_A16NE_ENABLE_NOT 0 +#define MVIC_VA16RNR_A16NE_DISABLE MVIC_VA16RNR_A16NE_ENABLE_NOT + +/* MVIC_VA16RNR_VA16SN -- + (A16 VME ->) VMEbus A16 Slave NMI Address & Enable (Composite) */ +#define MVIC_VA16RNR_VA16SN_MASK 0x0000ffff +#define MVIC_VA16RNR_VA16SN_SHIFT 0 + +/* +* MVIC_ISR -- MVIC Interrupt Status Register -- Read only +*/ + +#define MVIC_ISR (*(UINT *) (MMU_MVIC_VA + MVIC_ISR_OFS)) + +/* MVIC_ISR_DB -- DMA Busy */ +#define MVIC_ISR_DB_MASK 0x80000000 +#define MVIC_ISR_DB_BUSY 0x80000000 +#define MVIC_ISR_DB_IDLE 0 + +/* MVIC_ISR_A16N -- (A16 VME -> MBus) A16 NMI (Used as mailbox interrupt) */ +#define MVIC_ISR_A16N_MASK 0x00000010 +#define MVIC_ISR_A16N_SET 0x00000010 +#define MVIC_ISR_A16N_CLEARED 0 + +/* MVIC_ISR_DD -- DMA Done */ +#define MVIC_ISR_DD_MASK 0x00000008 +#define MVIC_ISR_DD_SET 0x00000008 +#define MVIC_ISR_DD_CLEARED 0 + +/* MVIC_ISR_DE -- DMA Error */ +#define MVIC_ISR_DE_MASK 0x00000004 +#define MVIC_ISR_DE_SET 0x00000004 +#define MVIC_ISR_DE_CLEARED 0 + +/* MVIC_ISR_SE -- (VME -> MBus) Slave Error */ +#define MVIC_ISR_SE_MASK 0x00000002 +#define MVIC_ISR_SE_SET 0x00000002 +#define MVIC_ISR_SE_CLEARED 0 + +/* MVIC_ISR_ME -- (MBus -> VME) Master Error */ +#define MVIC_ISR_ME_MASK 0x00000001 +#define MVIC_ISR_ME_SET 0x00000001 +#define MVIC_ISR_ME_CLEARED 0 + +/* +* MVIC_SENDI -- (-> VME) VMEbus Send Interrupt Register -- Read/Write +*/ + +#define MVIC_SENDI (*(UINT *) (MMU_MVIC_VA + MVIC_SENDI_OFS)) + +/* MVIC_SENDI_ISTAT -- Interrupt status */ +#define MVIC_SENDI_ISTAT_MASK 0x80000000 +#define MVIC_SENDI_ISTAT_ENABLE 0x80000000 +#define MVIC_SENDI_ISTAT_ENABLE_NOT 0 +#define MVIC_SENDI_ISTAT_DISABLE MVIC_SENDI_ISTAT_ENABLE_NOT + +/* MVIC_SENDI_IVEC -- Interrupt vector */ +#define MVIC_SENDI_IVEC_MASK 0x000000ff +#define MVIC_SENDI_IVEC_SHIFT 0 + +/* +* MVIC_VL1IAR to MVIC_VL7IAR -- + (<- VME) VMEbus Level xxx Interrupt Acknowledge Register +*/ + +#define MVIC_VL7IAR_VA (MMU_MVIC_VA + MVIC_VL7IAR_OFS) +#define MVIC_VL6IAR_VA (MMU_MVIC_VA + MVIC_VL6IAR_OFS) +#define MVIC_VL5IAR_VA (MMU_MVIC_VA + MVIC_VL5IAR_OFS) +#define MVIC_VL4IAR_VA (MMU_MVIC_VA + MVIC_VL4IAR_OFS) +#define MVIC_VL3IAR_VA (MMU_MVIC_VA + MVIC_VL3IAR_OFS) +#define MVIC_VL2IAR_VA (MMU_MVIC_VA + MVIC_VL2IAR_OFS) +#define MVIC_VL1IAR_VA (MMU_MVIC_VA + MVIC_VL1IAR_OFS) + +#define MVIC_VL7IAR ((int *) MVIC_VL7IAR_VA) +#define MVIC_VL6IAR ((int *) MVIC_VL6IAR_VA) +#define MVIC_VL5IAR ((int *) MVIC_VL5IAR_VA) +#define MVIC_VL4IAR ((int *) MVIC_VL4IAR_VA) +#define MVIC_VL3IAR ((int *) MVIC_VL3IAR_VA) +#define MVIC_VL2IAR ((int *) MVIC_VL2IAR_VA) +#define MVIC_VL1IAR ((int *) MVIC_VL1IAR_VA) + +/* +* MVIC_VTBAR -- (VME -> MBus) 256 x VDMA Translation Base Address Register +*/ + +#define MVIC_VTBAR ((UINT *) (MMU_MVIC_VA+MVIC_VTBAR_OFS)) + +#define MVIC_VTBAR_VALID_MASK 0x00020000 +#define MVIC_VTBAR_VALID_VALID 0x00020000 +#define MVIC_VTBAR_VALID_VALID_NOT 0 +#define MVIC_VTBAR_VALID_INVALID MVIC_VTBAR_VALID_VALID_NOT + +#define MVIC_VTBAR_VDMA_MASK 0x0001ffff +#define MVIC_VTBAR_VDMA_SHIFT 0 + +#define MVIC_VTBAR_VVDMA_MASK 0x0003ffff /* Composite */ +#define MVIC_VTBAR_VVDMA_SHIFT 0 + +/* +* MBus address output of MVIC A24 VDMA Translation +*/ + +#define MVIC_VDMA_PFN_MMBA_MASK 0xf00000 /* MBAR_MMBA Portion */ +#define MVIC_VDMA_PFN_MMBA_SHIFT (24-4) /* Must be the same */ + /* for all pages */ + +#define MVIC_VDMA_PHY_ZERO_MASK 0xe0000000 /* Must be zero */ + +#define MVIC_VDMA_PHY_VTBAR_MASK 0x1ffff000 /* VTBAR_VDMA Portion*/ +#define MVIC_VDMA_PHY_VTBAR_SHIFT 12 + +#ifndef _ASMLANGUAGE + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS mvicInit (MVICInit * initData); +extern STATUS mvicMailboxEnable (char *mailboxAdrs); +extern BOOL mvicProcessInt (void); +#else /* __STDC__ */ + +extern STATUS mvicInit (); +extern STATUS mvicMailboxEnable (); +extern BOOL mvicProcessInt (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmb86986Vmeh */ diff --git a/h/drv/vme/unsupported/vbic.h b/h/drv/vme/unsupported/vbic.h new file mode 100644 index 0000000..e9e6703 --- /dev/null +++ b/h/drv/vme/unsupported/vbic.h @@ -0,0 +1,226 @@ +/* vbic.h - SBE VBIC Chip Set header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01e,22sep92,rrr added support for c++ +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01b,05oct90,shl added copyright notice. + made #endif ANSI style. +01a,10sep89,rld original SBE release. +*/ + +/* +This header file defines the register layout of the SBE VMEbus +Interface Controller chip (VBIC) and supplies alpha-numeric +equivalences for register bit definitions. +*/ + +#ifndef __INCvbich +#define __INCvbich + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _ASMLANGUAGE +#define VBIC_ADRS(reg) (VBIC + (reg*VBIC_REG_OFFSET)) +#else +#define VBIC_ADRS(reg) ((char *) VBIC + (reg*VBIC_REG_OFFSET)) +#endif /* _ASMLANGUAGE */ + +#define VBIC_VECTNMI VBIC_ADRS(0x00) /* NMI vector */ +#define VBIC_VECTLIR1 VBIC_ADRS(0x01) /* Local vectors */ +#define VBIC_VECTLIR2 VBIC_ADRS(0x02) +#define VBIC_VECTLIR3 VBIC_ADRS(0x03) +#define VBIC_VECTLIR4 VBIC_ADRS(0x04) +#define VBIC_VECTLIR5 VBIC_ADRS(0x05) +#define VBIC_VECTLIR6 VBIC_ADRS(0x06) +#define VBIC_VECTLIR7 VBIC_ADRS(0x07) +#define VBIC_VECTLIR8 VBIC_ADRS(0x08) +#define VBIC_VECTLIR9 VBIC_ADRS(0x09) +#define VBIC_VECTLI10 VBIC_ADRS(0x0a) +#define VBIC_VECTVIG VBIC_ADRS(0x0b) /* VMEbus Interrupt Generator */ +#define VBIC_VECTMSM VBIC_ADRS(0x0c) /* Millisecond Marker */ +#define VBIC_VECTVME VBIC_ADRS(0x0d) /* VMEbus interrupter for VIR1-7 */ + +#define VBIC_IRMASKA VBIC_ADRS(0x0e) /* Interrupt enable register A */ +#define M_LIR1 0x02 /* Enable level 1 interrupt */ +#define M_LIR2 0x04 /* Enable level 2 interrupt */ +#define M_LIR3 0x08 /* Enable level 3 interrupt */ +#define M_LIR4 0x10 /* Enable level 4 interrupt */ +#define M_LIR5 0x20 /* Enable level 5 interrupt */ +#define M_LIR6 0x40 /* Enable level 6 interrupt */ +#define M_LIR7 0x80 /* Enable level 7 interrupt */ + +#define VBIC_IRMASKB VBIC_ADRS(0x0f) /* Interrupt enable register B */ +#define M_LIR8 0x01 /* Enable level 8 interrupt */ +#define M_LIR9 0x02 /* Enable level 9 interrupt */ +#define M_LIR10 0x04 /* Enable level 10 interrupt */ +#define M_MSM 0x40 /* Enable MSM interrupt */ +#define M_VIG 0x80 /* Enable VIG interrupt */ + +#define VBIC_IRMASKC VBIC_ADRS(0x10) /* Interrupt enable register C */ +#define M_VIR1 0x02 /* Enable VME level 1 interrupt */ +#define M_VIR2 0x04 /* Enable VME level 2 interrupt */ +#define M_VIR3 0x08 /* Enable VME level 3 interrupt */ +#define M_VIR4 0x10 /* Enable VME level 4 interrupt */ +#define M_VIR5 0x20 /* Enable VME level 5 interrupt */ +#define M_VIR6 0x40 /* Enable VME level 6 interrupt */ +#define M_VIR7 0x80 /* Enable VME level 7 interrupt */ + +#define VBIC_IRSCANA VBIC_ADRS(0x11) /* Interrupt Request status A */ +#define S_LIR1 0x02 /* Asserting level 1 intr */ +#define S_LIR2 0x04 /* Asserting level 2 intr */ +#define S_LIR3 0x08 /* Asserting level 3 intr */ +#define S_LIR4 0x10 /* Asserting level 4 intr */ +#define S_LIR5 0x20 /* Asserting level 5 intr */ +#define S_LIR6 0x40 /* Asserting level 6 intr */ +#define S_LIR7 0x80 /* Asserting level 7 intr */ + +#define VBIC_IRSCANB VBIC_ADRS(0x12) /* Interrupt Request status B */ +#define S_LIR8 0x01 /* Asserting level 8 intr */ +#define S_LIR9 0x02 /* Asserting level 9 intr */ +#define S_LIR10 0x04 /* Asserting level 10 intr */ +#define S_MSM 0x40 /* Asserting MSM intr */ +#define S_VIG 0x80 /* Asserting VIG intr */ + +#define VBIC_IRSCANC VBIC_ADRS(0x13) /* VIR1-7 Int Request status C */ +#define S_VIR1 0x02 /* Asserting VME level 1 intr */ +#define S_VIR2 0x04 /* Asserting VME level 2 intr */ +#define S_VIR3 0x08 /* Asserting VME level 3 intr */ +#define S_VIR4 0x10 /* Asserting VME level 4 intr */ +#define S_VIR5 0x20 /* Asserting VME level 5 intr */ +#define S_VIR6 0x40 /* Asserting VME level 6 intr */ +#define S_VIR7 0x80 /* Asserting VME level 7 intr */ + +#define VBIC_VBICCTL VBIC_ADRS(0x14) /* VBIC Control */ +#define VBC_NONMIV 0 /* NMI uses VECTNMI as vector */ +#define VBC_NMIV 0x80 /* NMI is auto-vectored */ + +#define VBIC_ICLIR1 VBIC_ADRS(0x15) /* Interruptor Config */ +#define VBIC_ICLIR2 VBIC_ADRS(0x16) +#define VBIC_ICLIR3 VBIC_ADRS(0x17) +#define VBIC_ICLIR4 VBIC_ADRS(0x18) +#define VBIC_ICLIR5 VBIC_ADRS(0x19) +#define VBIC_ICLIR6 VBIC_ADRS(0x1a) +#define VBIC_ICLIR7 VBIC_ADRS(0x1b) +#define VBIC_ICLIR8 VBIC_ADRS(0x1c) +#define VBIC_ICLIR9 VBIC_ADRS(0x1d) +#define VBIC_ICLIR10 VBIC_ADRS(0x1e) +#define ICL_AUTOV 0x80 /* Auto-vectored interrupt */ +#define ICL_EXTV 0x40 /* External vectored interrupt */ +#define ICL_EDGE 0x20 /* Edge sensitive interrupter */ +#define ICL_LEVEL 0x00 /* Level sensitive interrupter */ +#define ICL_HIGH 0x10 /* Active high / rising edge */ +#define ICL_LOW 0x00 /* Active low / falling edge */ + +#define VBIC_ICVIR1 VBIC_ADRS(0x1f) /* VME Interruptor Config */ +#define VBIC_ICVIR2 VBIC_ADRS(0x20) +#define VBIC_ICVIR3 VBIC_ADRS(0x21) +#define VBIC_ICVIR4 VBIC_ADRS(0x22) +#define VBIC_ICVIR5 VBIC_ADRS(0x23) +#define VBIC_ICVIR6 VBIC_ADRS(0x24) +#define VBIC_ICVIR7 VBIC_ADRS(0x25) + +#define VBIC_ICVIG VBIC_ADRS(0x26) /* VIG Interrupter Config */ +#define VBIC_ICMSM VBIC_ADRS(0x27) /* MSM Interruptor Config */ +#define VBIC_MSMCTL VBIC_ADRS(0x28) /* Millisecond Marker Control */ +#define MSM_IRQEN 0x80 /* MSM interrupter is enabled */ +#define MSM_HALTED 0x40 /* MSM is halted */ +#define MSM_MSEC1 0x20 /* MSM is in 1ms mode */ +#define MSM_TEST 0x10 /* MSM is in test mode */ +#define MSM_NORMAL 2 /* cmd: set to normal (~test) */ +#define MSM_SEC1 3 /* cmd: 1ms interrupt mode */ +#define MSM_SEC10 4 /* cmd: 10ms interrupt mode */ +#define MSM_STOP 5 /* cmd: stops MSM counter */ +#define MSM_GO 6 /* cmd: starts MSM counter */ +#define MSM_INIT 7 /* cmd: sets MSM counter to 0 */ + +#define VBIC_VIRSID1 VBIC_ADRS(0x29) /* StsID latched from VME level 1 */ +#define VBIC_VIRSID2 VBIC_ADRS(0x2a) +#define VBIC_VIRSID3 VBIC_ADRS(0x2b) +#define VBIC_VIRSID4 VBIC_ADRS(0x2c) +#define VBIC_VIRSID5 VBIC_ADRS(0x2d) +#define VBIC_VIRSID6 VBIC_ADRS(0x2e) +#define VBIC_VIRSID7 VBIC_ADRS(0x2f) + +#define VBIC_RSTCTL VBIC_ADRS(0x30) /* Software Reset Control */ +#define VBIC_RESET 0x6a /* cmd: resets VBIC */ +#define VBIC_SLOTSTAT VBIC_ADRS(0x37) /* Slot-1 status */ +#define SLOT1 0x80 /* slot 1 jumper installed */ +#define VBIC_VOUTCTL VBIC_ADRS(0x40) /* VME Interrupt Output Control */ +#define VIG_GEN_1 0x01 /* Generate bus intr level 1 */ +#define VIG_GEN_2 0x02 /* Generate bus intr level 2 */ +#define VIG_GEN_3 0x03 /* Generate bus intr level 3 */ +#define VIG_GEN_4 0x04 /* Generate bus intr level 4 */ +#define VIG_GEN_5 0x05 /* Generate bus intr level 5 */ +#define VIG_GEN_6 0x06 /* Generate bus intr level 6 */ +#define VIG_GEN_7 0x07 /* Generate bus intr level 7 */ +#define VIG_PEND_1 0x02 /* Pending bus intr level 1 */ +#define VIG_PEND_2 0x04 /* Pending bus intr level 2 */ +#define VIG_PEND_3 0x08 /* Pending bus intr level 3 */ +#define VIG_PEND_4 0x10 /* Pending bus intr level 4 */ +#define VIG_PEND_5 0x20 /* Pending bus intr level 5 */ +#define VIG_PEND_6 0x40 /* Pending bus intr level 6 */ +#define VIG_PEND_7 0x80 /* Pending bus intr level 7 */ + +#define VBIC_VOUTSID1 VBIC_ADRS(0x41) /* StsID to send for VME level 1 */ +#define VBIC_VOUTSID2 VBIC_ADRS(0x42) /* StsID to send for VME level 2 */ +#define VBIC_VOUTSID3 VBIC_ADRS(0x43) /* StsID to send for VME level 3 */ +#define VBIC_VOUTSID4 VBIC_ADRS(0x44) /* StsID to send for VME level 4 */ +#define VBIC_VOUTSID5 VBIC_ADRS(0x45) /* StsID to send for VME level 5 */ +#define VBIC_VOUTSID6 VBIC_ADRS(0x46) /* StsID to send for VME level 6 */ +#define VBIC_VOUTSID7 VBIC_ADRS(0x47) /* StsID to send for VME level 7 */ + +#define VBIC_VIGCTL VBIC_ADRS(0x48) /* VMEbus Intr Generator Control */ +#define VIG_ENABLE_1 0x02 /* Enable VME int ACK interrupt */ +#define VIG_ENABLE_2 0x04 +#define VIG_ENABLE_3 0x08 +#define VIG_ENABLE_4 0x10 +#define VIG_ENABLE_5 0x20 +#define VIG_ENABLE_6 0x40 +#define VIG_ENABLE_7 0x80 + +#define VBIC_VIASR VBIC_ADRS(0x49) /* VMEbus Intr Ack Status */ +#define SR_IACK_1 0x02 /* Level 1 IACK completed */ +#define SR_IACK_2 0x04 /* Level 2 IACK completed */ +#define SR_IACK_3 0x08 /* Level 3 IACK completed */ +#define SR_IACK_4 0x10 /* Level 4 IACK completed */ +#define SR_IACK_5 0x20 /* Level 5 IACK completed */ +#define SR_IACK_6 0x40 /* Level 6 IACK completed */ +#define SR_IACK_7 0x80 /* Level 7 IACK completed */ + +#define VBIC_SRCLR VBIC_ADRS(0x4a) /* VIASR Bit CLear */ +#define SRCLR_1 0x01 /* Clear bit 1 of VIASR */ +#define SRCLR_2 0x02 /* Clear bit 2 of VIASR */ +#define SRCLR_3 0x03 /* Clear bit 3 of VIASR */ +#define SRCLR_4 0x04 /* Clear bit 4 of VIASR */ +#define SRCLR_5 0x05 /* Clear bit 5 of VIASR */ +#define SRCLR_6 0x06 /* Clear bit 6 of VIASR */ +#define SRCLR_7 0x07 /* Clear bit 7 of VIASR */ + +#define VBIC_SYSCTL VBIC_ADRS(0x4b) /* System Control Register */ +#define BUS_TIME_16 0x00 /* 16us timeout period */ +#define BUS_TIME_32 0x40 /* 32us timeout period */ +#define BUS_TIME_64 0x80 /* 64us timeout period */ +#define BUS_TIME_128 0xc0 /* 128us timeout period */ +#define BUS_ARB_RRS 0x00 /* Round robin */ +#define BUS_ARB_PRRS 0x20 /* Priority round robin */ +#define BUS_ARB_PRI 0x30 /* Absolute priority */ +#define BUS_LVL_0 0x00 /* Use bus request level 0 */ +#define BUS_LVL_1 0x04 /* Use bus request level 1 */ +#define BUS_LVL_2 0x08 /* Use bus request level 2 */ +#define BUS_LVL_3 0x0c /* Use bus request level 3 */ +#define BUS_REL_ROR 0x00 /* Release bus on request */ +#define BUS_REL_RWD 0x02 /* Release bus when done */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvbich */ diff --git a/h/drv/vme/unsupported/vic068.h b/h/drv/vme/unsupported/vic068.h new file mode 100644 index 0000000..9d3b3c2 --- /dev/null +++ b/h/drv/vme/unsupported/vic068.h @@ -0,0 +1,701 @@ +/* vic068.h - VMEbus Interface Controller */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01k,22sep92,rrr added support for c++ +01j,26may92,rrr the tree shuffle +01i,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01h,06may91,nfs moved ifdef's to ensure clean mangening +01g,30apr91,nfs added ifdef for documentation +01f,25apr91,nfs corrected VME_ICGS and VME_ICMS defines (rs33 document error) + corrected VME_SET_ADRS and VME_CLR_ADRS (VIC document error) + ICR5 defines removed, revisions are referred to by their hex + code (f1,f2,f3,f4,f5 and f8 are currently valid) +01e,25mar91,del re-definition of VIC_ADRS and VME_ICF_ADRS permitted +01d,25mar91,nfs re-written + jcf +01c,25nov90,gae WRS cleanup. +01b,22mar90,eve general cleanup +01a,12mar89,fwa written. +*/ + +#ifdef DOC +#define INCvic068h +#endif /* DOC */ + +#ifndef __INCvic068h +#define __INCvic068h + +#ifdef __cplusplus +extern "C" { +#endif + +/* +This file contains constants for the VTC VMEbus Interface controller. +The macro VIC_BASE_ADRS must be defined when including this header. + +The following standards have been adopted in the creation of this file. + +Register definitions which provide access to the VIC chip locally +(on-board) have the prefix "VIC". Register definitions which provide +access to the VIC chip via the VMEbus (off-board) have the prefix +"VME". + +The registers are listed in ascending (numerical) order; the definitions +for each register are started with a header eg. + + Register Register Register Register + Mnemonic Number Address Name + | | | | + v v v v +***************************************************************** +* VIICR 0x01 0x03 VME Interrupter Irq Control Reg * +***************************************************************** + +in some cases where a number of registers have the same definitions the +header looks like this eg. + +**************************************************************** +* VICR1 0x02 0x07 VME Interrupt Control Reg #1 * +* to * +* VICR7 0x08 0x1f VME Interrupt Control Reg #7 * +**************************************************************** + +The format of the definitions is as follows; the define name always +starts with the register mnemonic it is associated with. The [7-0] +number at the end of the comment indicates the bit position the define +applies to; the definition ICGICR_IRQ_EN_ICGS3, in the following +example, the 7 applies to bit 7 + | | + v v + define ICGICR_IRQ_EN_ICGS3 0x00 * enable ICGS3 local int 7 * + +If the define applies to more than one bit, then the applicable bit +range is specified by two digits; in the following example ICGICR_IRQ_EN_ICGS, +applies to the four bit field, bits 7-4. + | + v + define ICGICR_IRQ_EN_ICGS 0x00 * enable all ICGS local int's 74 * + +If no bit field is given, then the define applies to the whole register. +*/ + +#ifdef _ASMLANGUAGE +#define CAST +#else +/* #define CAST (UCHAR *) */ +#define CAST (char *) +#endif /* _ASMLANGUAGE */ + +/* on-board access, register definitions */ + +#define VIC_REG_INTERVAL 4 + +#ifndef VIC_ADRS /* to permit alternative board addressing */ +#define VIC_ADRS(reg) (CAST (VIC_BASE_ADRS + (reg * VIC_REG_INTERVAL) + 3)) +#endif /* VIC_ADRS */ + +#define VIC_VIICR VIC_ADRS(0x00) /* VME Interrupter Irq Control Reg */ +#define VIC_VICR1 VIC_ADRS(0x01) /* VME Interrupt Control Reg #1 */ +#define VIC_VICR2 VIC_ADRS(0x02) /* VME Interrupt Control Reg #2 */ +#define VIC_VICR3 VIC_ADRS(0x03) /* VME Interrupt Control Reg #3 */ +#define VIC_VICR4 VIC_ADRS(0x04) /* VME Interrupt Control Reg #4 */ +#define VIC_VICR5 VIC_ADRS(0x05) /* VME Interrupt Control Reg #5 */ +#define VIC_VICR6 VIC_ADRS(0x06) /* VME Interrupt Control Reg #6 */ +#define VIC_VICR7 VIC_ADRS(0x07) /* VME Interrupt Control Reg #7 */ +#define VIC_DSICR VIC_ADRS(0x08) /* DMA Status Int Control Reg */ +#define VIC_LICR1 VIC_ADRS(0x09) /* Local Interrupt Control Reg #1 */ +#define VIC_LICR2 VIC_ADRS(0x0a) /* Local Interrupt Control Reg #2 */ +#define VIC_LICR3 VIC_ADRS(0x0b) /* Local Interrupt Control Reg #3 */ +#define VIC_LICR4 VIC_ADRS(0x0c) /* Local Interrupt Control Reg #4 */ +#define VIC_LICR5 VIC_ADRS(0x0d) /* Local Interrupt Control Reg #5 */ +#define VIC_LICR6 VIC_ADRS(0x0e) /* Local Interrupt Control Reg #6 */ +#define VIC_LICR7 VIC_ADRS(0x0f) /* Local Interrupt Control Reg #7 */ +#define VIC_ICGICR VIC_ADRS(0x10) /* ICGS Interrupt Control Reg */ +#define VIC_ICMICR VIC_ADRS(0x11) /* ICMS Interrupt Control Reg */ +#define VIC_EGICR VIC_ADRS(0x12) /* Error Group Int Control Reg */ +#define VIC_ICGIVBR VIC_ADRS(0x13) /* ICGS Interrupt Vector Base Reg */ +#define VIC_ICMIVBR VIC_ADRS(0x14) /* ICMS Interrupt Vector Base Reg */ +#define VIC_LIVBR VIC_ADRS(0x15) /* Local Int Vector Base Reg */ +#define VIC_EGIVBR VIC_ADRS(0x16) /* Error Group Int Vec Base Reg */ +#define VIC_ICSR VIC_ADRS(0x17) /* Interprocessor Comm Switch Reg */ +#define VIC_ICR0 VIC_ADRS(0x18) /* Interprocessor Comm. Reg #0 */ +#define VIC_ICR1 VIC_ADRS(0x19) /* Interprocessor Comm. Reg #1 */ +#define VIC_ICR2 VIC_ADRS(0x1a) /* Interprocessor Comm. Reg #2 */ +#define VIC_ICR3 VIC_ADRS(0x1b) /* Interprocessor Comm. Reg #3 */ +#define VIC_ICR4 VIC_ADRS(0x1c) /* Interprocessor Comm. Reg #4 */ +#define VIC_ICR5 VIC_ADRS(0x1d) /* Interprocessor Comm. Reg #5 */ +#define VIC_ICR6 VIC_ADRS(0x1e) /* Interprocessor Comm. Reg #6 */ +#define VIC_ICR7 VIC_ADRS(0x1f) /* Interprocessor Comm. Reg #7 */ +#define VIC_VIRSR VIC_ADRS(0x20) /* VME Interrupt Request/Stat. Reg */ +#define VIC_VIVR1 VIC_ADRS(0x21) /* VME Interrupt Vector Reg #1 */ +#define VIC_VIVR2 VIC_ADRS(0x22) /* VME Interrupt Vector Reg #2 */ +#define VIC_VIVR3 VIC_ADRS(0x23) /* VME Interrupt Vector Reg #3 */ +#define VIC_VIVR4 VIC_ADRS(0x24) /* VME Interrupt Vector Reg #4 */ +#define VIC_VIVR5 VIC_ADRS(0x25) /* VME Interrupt Vector Reg #5 */ +#define VIC_VIVR6 VIC_ADRS(0x26) /* VME Interrupt Vector Reg #6 */ +#define VIC_VIVR7 VIC_ADRS(0x27) /* VME Interrupt Vector Reg #7 */ +#define VIC_TTR VIC_ADRS(0x28) /* Transfer Time-out Reg */ +#define VIC_LBTR VIC_ADRS(0x29) /* Local Bus Timing Reg */ +#define VIC_BTDR VIC_ADRS(0x2a) /* Block Transfer Definition Reg */ +#define VIC_ICR VIC_ADRS(0x2b) /* Interface Configuration Reg */ +#define VIC_ARCR VIC_ADRS(0x2c) /* Arbiter/Requester Config. Reg */ +#define VIC_AMSR VIC_ADRS(0x2d) /* AM Source Reg */ +#define VIC_BESR VIC_ADRS(0x2e) /* Bus Error Status Reg */ +#define VIC_DSR VIC_ADRS(0x2f) /* DMA Status Reg */ +#define VIC_SS0CR0 VIC_ADRS(0x30) /* Slave Select 0/Control Reg #0 */ +#define VIC_SS0CR1 VIC_ADRS(0x31) /* Slave Select 0/Control Reg #1 */ +#define VIC_SS1CR0 VIC_ADRS(0x32) /* Slave Select 1/Control Reg #0 */ +#define VIC_SS1CR1 VIC_ADRS(0x33) /* Slave Select 1/Control Reg #1 */ +#define VIC_RCR VIC_ADRS(0x34) /* Release Control Reg */ +#define VIC_BTCR VIC_ADRS(0x35) /* Block Transfer Control Reg */ +#define VIC_BTLR0 VIC_ADRS(0x36) /* Block Transfer Length Reg #0 */ +#define VIC_BTLR1 VIC_ADRS(0x37) /* Block Transfer Length Reg #1 */ +#define VIC_SRR VIC_ADRS(0x38) /* System Reset Reg */ + +/* off-board access, register definitions */ + +#define VME_ICF_REG_INTERVAL 2 + +#ifndef VME_ICF_ADRS /* to permit alternative off-board addressing */ +#define VME_ICF_ADRS(adrs, icf, type, reg) \ + (CAST (adrs + icf + (reg * VME_ICF_REG_INTERVAL) + type )) +#endif /* VME_ICF_ADRS */ + +/* Interprocessor Communication Facility - icf */ + +#define VME_ICR 0x00 /* IC Registers ICR0-7 */ +#define VME_ICGS 0x10 /* IC Global Switches ICGS0-3 */ +#define VME_ICMS 0x20 /* IC Module Switches ICMS0-3 */ + +/* Type of register access - type */ + +#define VME_ODD_ADRS 0x01 /* ICR always accessed at odd byte addresses */ + +#define VME_SET_ADRS 0x01 /* ICGS and ICMS set switch access */ +#define VME_CLR_ADRS 0x00 /* ICGS and ICMS clear switch access */ + +#define VME_ICR0(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICR,VME_ODD_ADRS,0) +#define VME_ICR1(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICR,VME_ODD_ADRS,1) +#define VME_ICR2(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICR,VME_ODD_ADRS,2) +#define VME_ICR3(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICR,VME_ODD_ADRS,3) +#define VME_ICR4(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICR,VME_ODD_ADRS,4) +#define VME_ICR5(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICR,VME_ODD_ADRS,5) +#define VME_ICR6(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICR,VME_ODD_ADRS,6) +#define VME_ICR7(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICR,VME_ODD_ADRS,7) + +#define VME_ICGS0_SET(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICGS,VME_SET_ADRS,0) +#define VME_ICGS0_CLR(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICGS,VME_CLR_ADRS,0) +#define VME_ICGS1_SET(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICGS,VME_SET_ADRS,1) +#define VME_ICGS1_CLR(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICGS,VME_CLR_ADRS,1) +#define VME_ICGS2_SET(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICGS,VME_SET_ADRS,2) +#define VME_ICGS2_CLR(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICGS,VME_CLR_ADRS,2) +#define VME_ICGS3_SET(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICGS,VME_SET_ADRS,3) +#define VME_ICGS3_CLR(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICGS,VME_CLR_ADRS,3) + +#define VME_ICMS0_SET(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICMS,VME_SET_ADRS,0) +#define VME_ICMS0_CLR(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICMS,VME_CLR_ADRS,0) +#define VME_ICMS1_SET(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICMS,VME_SET_ADRS,1) +#define VME_ICMS1_CLR(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICMS,VME_CLR_ADRS,1) +#define VME_ICMS2_SET(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICMS,VME_SET_ADRS,2) +#define VME_ICMS2_CLR(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICMS,VME_CLR_ADRS,2) +#define VME_ICMS3_SET(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICMS,VME_SET_ADRS,3) +#define VME_ICMS3_CLR(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICMS,VME_CLR_ADRS,3) + +/**************************************************************** +* VIICR 0x00 0x03 VME Interrupter Irq Control Reg * +*****************************************************************/ + +#define VIICR_IRQ_LVL_MASK 0x07 /* local interrupt level mask 7 */ +#define VIICR_IRQ_DISABLE 0x80 /* disable interrupter IRQ 7 */ + +/*************************************************************** +* VICR1 0x01 0x07 VME Interrupt Control Reg #1 * +* to * +* VICR7 0x07 0x1f VME Interrupt Control Reg #7 * +****************************************************************/ + +#define VICR_IRQ_LVL_MASK 0x07 /* local interrupt level mask 7 */ +#define VICR_IRQ_DISABLE 0x80 /* disable interrupt IRQ 7 */ + +/*************************************************************** +* DSICR 0x08 0x23 DMA Status Int Control Reg * +****************************************************************/ + +#define DSICR_IRQ_LVL_MASK 0x07 /* local interrupt level mask 7 */ +#define DSICR_IRQ_DISABLE 0x80 /* disable DMA termination IRQ 7 */ + +/*************************************************************** +* LICR1 0x09 0x27 Local Interrupt Control Reg #1 * +* to * +* LICR7 0x0f 0x3f Local Interrupt Control Reg #7 * +****************************************************************/ + +#define LICR_IRQ_LVL_MASK 0x07 /* local interrupt level mask */ +#define LICR_IRQ_STATE 0x08 /* LIRQ(i) state 3 */ +#define LICR_IRQ_VEC_DEV 0x00 /* device supplies vector 4 */ +#define LICR_IRQ_VEC_VIC 0x10 /* VIC supplies vector 4 */ +#define LICR_IRQ_LEVEL 0x00 /* level sensitive 5 */ +#define LICR_IRQ_EDGE 0x20 /* edge sensitive 5 */ +#define LICR_IRQ_ACTIVEL 0x00 /* active low 6 */ +#define LICR_IRQ_ACTIVEH 0x40 /* active high 6 */ +#define LICR_IRQ_ENABLE 0x00 /* enable IRQ 7 */ +#define LICR_IRQ_DISABLE 0x80 /* disable IRQ 7 */ + +/*************************************************************** +* ICGICR 0x10 0x43 ICGS Interrupt Control Reg * +****************************************************************/ + +#define ICGICR_IRQ_LVL_MASK 0x07 /* local interrupt level mask */ +#define ICGICR_IRQ_ICGS0_ENA 0x00 /* enable ICGS0 local interrpt 4 */ +#define ICGICR_IRQ_ICGS0_DIS 0x10 /* disable ICGS0 local interrpt 4 */ +#define ICGICR_IRQ_ICGS1_ENA 0x00 /* enable ICGS1 local interrpt 5 */ +#define ICGICR_IRQ_ICGS1_DIS 0x20 /* disable ICGS1 local interrpt 5 */ +#define ICGICR_IRQ_ICGS2_ENA 0x00 /* enable ICGS2 local interrpt 6 */ +#define ICGICR_IRQ_ICGS2_DIS 0x40 /* disable ICGS2 local interrpt 6 */ +#define ICGICR_IRQ_ICGS3_ENA 0x00 /* enable ICGS3 local interrpt 7 */ +#define ICGICR_IRQ_ICGS3_DIS 0x80 /* disable ICGS3 local interrpt 7 */ + +/*************************************************************** +* ICMICR 0x11 0x47 ICMS Interrupt Control Reg * +****************************************************************/ + +#define ICMICR_IRQ_LVL_MASK 0x07 /* local interrupt level mask */ +#define ICMICR_IRQ_ICMS0_DIS 0x10 /* disable ICMS0 local interrpt 4 */ +#define ICMICR_IRQ_ICMS1_DIS 0x20 /* disable ICMS1 local interrpt 5 */ +#define ICMICR_IRQ_ICMS2_DIS 0x40 /* disable ICMS2 local interrpt 6 */ +#define ICMICR_IRQ_ICMS3_DIS 0x80 /* disable ICMS3 local interrpt 7 */ + +/*************************************************************** +* EGICR 0x12 0x4b Error Group Int Control Reg * +****************************************************************/ + +#define EGICR_IRQ_LVL_MASK 0x07 /* local interrupt level mask */ +#define EGICR_IRQ_SYSFAIL_ENA 0x00 /* enable SYSFAIL* local int 4 */ +#define EGICR_IRQ_SYSFAIL_DIS 0x10 /* disable SYSFAIL* local int 4 */ +#define EGICR_IRQ_ABTTO_ENA 0x00 /* enable arbitration time out 5 */ +#define EGICR_IRQ_ABTTO_DIS 0x20 /* disable arbitration time out 5 */ +#define EGICR_IRQ_WPFAIL_ENA 0x00 /* enable write post fail 6 */ +#define EGICR_IRQ_WPFAIL_DIS 0x40 /* disable write post fail 6 */ +#define EGICR_IRQ_ACFAIL_ENA 0x00 /* enable ACFAIL* local int 7 */ +#define EGICR_IRQ_ACFAIL_DIS 0x80 /* disable ACFAIL* local int 7 */ + +/*************************************************************** +* ICGIVBR 0x13 0x4f ICGS Interrupt Vector Base Reg * +****************************************************************/ + +/* Identity of interrupting ICGS (read only) */ + +#define ICGIVBR_ICGS0 0x00 /* ICGS0 10 */ +#define ICGIVBR_ICGS1 0x01 /* ICGS1 10 */ +#define ICGIVBR_ICGS2 0x02 /* ICGS2 10 */ +#define ICGIVBR_ICGS3 0x03 /* ICGS3 10 */ +#define ICGIVBR_VEC_MASK 0xfc /* ICGS vector base mask */ + +/*************************************************************** +* ICMIVBR 0x14 0x53 ICMS Interrupt Vector Base Reg * +****************************************************************/ + +/* Identity of interrupting ICMS (read only) */ + +#define ICMIVBR_ICMS0 0x00 /* ICMS0 10 */ +#define ICMIVBR_ICMS1 0x01 /* ICMS1 10 */ +#define ICMIVBR_ICMS2 0x02 /* ICMS2 10 */ +#define ICMIVBR_ICMS3 0x03 /* ICMS3 10 */ +#define ICMIVBR_VEC_MASK 0xfc /* ICMI vector base mask */ + +/*************************************************************** +* LIVBR 0x15 0x57 Local Int Vector Base Reg * +****************************************************************/ + +/* Identity of local interrupt (read only) */ + +#define LIVBR_LIRQ1 0x01 /* LIRQ1 20 */ +#define LIVBR_LIRQ2 0x02 /* LIRQ2 20 */ +#define LIVBR_LIRQ3 0x03 /* LIRQ3 20 */ +#define LIVBR_LIRQ4 0x04 /* LIRQ4 20 */ +#define LIVBR_LIRQ5 0x05 /* LIRQ5 20 */ +#define LIVBR_LIRQ6 0x06 /* LIRQ6 20 */ +#define LIVBR_LIRQ7 0x07 /* LIRQ7 20 */ +#define LIVBR_VEC_MASK 0xf8 /* LIRQ vector base mask */ + +/*************************************************************** +* EGIVBR 0x16 0x5b Error Group Int Vec Base Reg * +****************************************************************/ + +/* Error Conditions (read only) */ + +#define EGIVBR_ACFAIL 0x00 /* ACFAIL* error condition 20 */ +#define EGIVBR_WPFAIL 0x01 /* write post fail error cond 20 */ +#define EGIVBR_ABTTO 0x02 /* arbitration time out err con 20 */ +#define EGIVBR_SYSFAIL 0x03 /* SYSFAIL* error condition 20 */ +#define EGIVBR_VIIA 0x04 /* VMEbus Interrupter Interrupt 20 */ + /* Acknowledge error condition 20 */ +#define EGIVBR_DMAI 0x05 /* DMA Interrupt 20 */ +#define EGIVBR_VEC_MASK 0xf8 /* EGIRQ vector base mask */ + +/*************************************************************** +* ICSR 0x17 0x5f Interprocessor Comm Switch Reg * +****************************************************************/ + +#define ICSR_ICMS0 0x01 /* set ICMS0 0 */ +#define ICSR_ICMS1 0x02 /* set ICMS1 1 */ +#define ICSR_ICMS2 0x04 /* set ICMS2 2 */ +#define ICSR_ICMS3 0x08 /* set ICMS3 3 */ + +/* ICGS (read only) */ + +#define ICSR_ICGS0 0x10 /* set ICGS0 4 */ +#define ICSR_ICGS1 0x20 /* set ICGS1 5 */ +#define ICSR_ICGS2 0x40 /* set ICGS2 6 */ +#define ICSR_ICGS3 0x80 /* set ICGS3 7 */ + +/*************************************************************** +* ICR0 0x18 0x63 Interprocessor Comm. Reg #0 * +* to * +* ICR4 0x1c 0x73 Interprocessor Comm. Reg #4 * +****************************************************************/ + +/* none */ + +/*************************************************************** +* ICR5 0x1d 0x77 Interprocessor Comm. Reg #5 * +* (VIC ID Register) * +****************************************************************/ + +/* none - revisions are referred to by the hex code */ + +/*************************************************************** +* ICR6 0x1e 0x7b Interprocessor Comm. Reg #6 * +****************************************************************/ + +/* XXX should the following fields be 6 or 7 bits wide ? */ + +#define ICR6_HALT 0x3d /* VIC detected VME HALT 50 */ +#define ICR6_IRESET 0x3e /* VIC performing reset function 50 */ +#define ICR6_SYSRESET 0x3f /* VMEbus SYSRESET 50 */ +#define ICR6_HALT_IRESET 0x40 /* VMEbus HALT or IRESET asserted 6 */ +#define ICR6_SYSFAIL 0x40 /* assert SYSFAIL 6 */ +#define ICR6_ACFAIL 0x80 /* ACFAIL state 7 */ + +/*************************************************************** +* ICR7 0x1f 0x7f Interprocessor Comm. Reg #7 * +****************************************************************/ + +#define ICR7_ICR0 0x01 /* ICR0 semaphore 0 */ +#define ICR7_ICR1 0x02 /* ICR1 semaphore 1 */ +#define ICR7_ICR2 0x04 /* ICR2 semaphore 2 */ +#define ICR7_ICR3 0x08 /* ICR3 semaphore 3 */ +#define ICR7_ICR4 0x10 /* ICR4 semaphore 4 */ +#define ICR7_MASTER 0x20 /* the VIC is VMEbus master 5 */ +#define ICR7_RESET 0x40 /* assert RESET* and HALT* 6 */ +#define ICR7_SYSFAIL_INH 0x80 /* inhibit SYSFAIL* assertion 7 */ + +/***************************************************************** +* VIRSR 0x20 0x83 VME Interrupt Request/Status Reg * +******************************************************************/ + +#define VIRSR_IRQ_ENA 0x01 /* VMEbus interrupt enable 0 */ +#define VIRSR_IRQ1 0x02 /* assert on VMEbus, VME IRQ 1 1 */ +#define VIRSR_IRQ2 0x04 /* assert on VMEbus, VME IRQ 2 2 */ +#define VIRSR_IRQ3 0x08 /* assert on VMEbus, VME IRQ 3 3 */ +#define VIRSR_IRQ4 0x10 /* assert on VMEbus, VME IRQ 4 4 */ +#define VIRSR_IRQ5 0x20 /* assert on VMEbus, VME IRQ 5 5 */ +#define VIRSR_IRQ6 0x40 /* assert on VMEbus, VME IRQ 6 6 */ +#define VIRSR_IRQ7 0x80 /* assert on VMEbus, VME IRQ 7 7 */ + +/*************************************************************** +* VIVR1 0x21 0x87 VME Interrupt Vector Reg #1 * +* to * +* VIVR7 0x27 0xaf VME Interrupt Vector Reg #7 * +****************************************************************/ + +/* none */ + +/*************************************************************** +* TTR 0x28 0xa3 Transfer Time-out Reg * +****************************************************************/ + +#define TTR_VTO_ACQ_EXC 0x00 /* exclude aquisition time 0 */ +#define TTR_VTO_ACQ_INC 0x01 /* include aquisition time 0 */ +#define TTR_ARBTO 0x02 /* arbitration timeout occured 1 */ +#define TTR_LTO_4 0x00 /* local 4 us time out 42 */ +#define TTR_LTO_16 0x04 /* local 16 us time out 42 */ +#define TTR_LTO_32 0x08 /* local 32 us time out 42 */ +#define TTR_LTO_64 0x0c /* local 64 us time out 42 */ +#define TTR_LTO_128 0x10 /* local 128 us time out 42 */ +#define TTR_LTO_256 0x14 /* local 256 us time out 42 */ +#define TTR_LTO_512 0x18 /* local 512 us time out 42 */ +#define TTR_LTO_INF 0x1c /* local infinite time out 42 */ +#define TTR_VTO_4 0x00 /* VMEbus 4 us time out 75 */ +#define TTR_VTO_16 0x20 /* VMEbus 16 us time out 75 */ +#define TTR_VTO_32 0x40 /* VMEbus 32 us time out 75 */ +#define TTR_VTO_64 0x60 /* VMEbus 64 us time out 75 */ +#define TTR_VTO_128 0x80 /* VMEbus 128 us time out 75 */ +#define TTR_VTO_256 0xa0 /* VMEbus 256 us time out 75 */ +#define TTR_VTO_512 0xc0 /* VMEbus 512 us time out 75 */ +#define TTR_VTO_INF 0xe0 /* VMEbus infinite time out 75 */ + +/*************************************************************** +* LBTR 0x29 0xa7 Local Bus Timing Reg * +****************************************************************/ + +#define LBTR_PASL_2 0x00 /* PAS low 2 * 64 MHz clocks 30 */ +#define LBTR_PASL_3 0x01 /* PAS low 3 * 64 MHz clocks 30 */ +#define LBTR_PASL_4 0x02 /* PAS low 4 * 64 MHz clocks 30 */ +#define LBTR_PASL_5 0x03 /* PAS low 5 * 64 MHz clocks 30 */ +#define LBTR_PASL_6 0x04 /* PAS low 6 * 64 MHz clocks 30 */ +#define LBTR_PASL_7 0x05 /* PAS low 7 * 64 MHz clocks 30 */ +#define LBTR_PASL_8 0x06 /* PAS low 8 * 64 MHz clocks 30 */ +#define LBTR_PASL_9 0x07 /* PAS low 9 * 64 MHz clocks 30 */ +#define LBTR_PASL_10 0x08 /* PAS low 10 * 64 MHz clocks 30 */ +#define LBTR_PASL_11 0x09 /* PAS low 11 * 64 MHz clocks 30 */ +#define LBTR_PASL_12 0x0a /* PAS low 12 * 64 MHz clocks 30 */ +#define LBTR_PASL_13 0x0b /* PAS low 13 * 64 MHz clocks 30 */ +#define LBTR_PASL_14 0x0c /* PAS low 14 * 64 MHz clocks 30 */ +#define LBTR_PASL_15 0x0d /* PAS low 15 * 64 MHz clocks 30 */ +#define LBTR_PASL_16 0x0e /* PAS low 16 * 64 MHz clocks 30 */ +#define LBTR_PASL_17 0x0f /* PAS low 17 * 64 MHz clocks 30 */ + +#define LBTR_DS_1 0x00 /* DS 1 * 64 MHz clocks 4 */ +#define LBTR_DS_2 0x10 /* DS 2 * 64 MHz clocks 4 */ + +#define LBTR_PASH_1 0x00 /* PAS high 1 * 64 MHz clocks 75 */ +#define LBTR_PASH_2 0x20 /* PAS high 2 * 64 MHz clocks 75 */ +#define LBTR_PASH_3 0x40 /* PAS high 3 * 64 MHz clocks 75 */ +#define LBTR_PASH_4 0x60 /* PAS high 4 * 64 MHz clocks 75 */ +#define LBTR_PASH_5 0x80 /* PAS high 5 * 64 MHz clocks 75 */ +#define LBTR_PASH_6 0xa0 /* PAS high 6 * 64 MHz clocks 75 */ +#define LBTR_PASH_7 0xc0 /* PAS high 7 * 64 MHz clocks 75 */ +#define LBTR_PASH_8 0xe0 /* PAS high 8 * 64 MHz clocks 75 */ + +/*************************************************************** +* BTDR 0x2a 0xab Block Transfer Definition Reg * +****************************************************************/ + +#define BTDR_DPADEN 0x01 /* enable dual path DPADEN 0 */ +#define BTDR_AMSR 0x02 /* use AMSR for BT add modifier 1 */ +#define BTDR_LBTDMA_ENA 0x04 /* enable local BT 256 byte DMA 2 */ +#define BTDR_VBTDMA_ENA 0x08 /* enable VME BT 256 byte DMA 3 */ + +/*************************************************************** +* ICR 0x2b 0xaf Interface Configuration Reg * +****************************************************************/ + +#define ICR_SCON 0x01 /* system controller pin 0 */ +#define ICR_TURBO 0x02 /* speed up transfers 1 */ +#define ICR_MORE_SETTLE_TIME 0x04 /* add 1 64 MHz intvl to async pins2 */ +#define ICR_DLK_RMC_NO_RETRY 0x08 /* enable deadlock signalling 3 */ +#define ICR_DLK_RETRY 0x10 /* signal deadlock with HALT* 4 */ +#define ICR_REQ_RMC 0x20 /* request bus if RMC* is asserted 5 */ +#define ICR_AS_STRETCH 0x40 /* strech AS* 6 */ +#define ICR_AS_SIZE 0x80 /* use size information for AS* 7 */ + +/*************************************************************** +* ARCR 0x2c 0xb3 Arbiter/Requester Config. Reg * +****************************************************************/ + +#define ARCR_NOT_FAIR 0x00 /* disable fairness 30 */ +#define ARCR_NO_TOUT 0x0f /* disable timeout 30 */ +#define ARCR_DRAM_REFRESH 0x10 /* enable DRAM refresh 4 */ + +#define ARCR_VBRL_BR0 0x00 /* VME bus request level BR0 65 */ +#define ARCR_VBRL_BR1 0x20 /* VME bus request level BR1 65 */ +#define ARCR_VBRL_BR2 0x40 /* VME bus request level BR2 65 */ +#define ARCR_VBRL_BR3 0x60 /* VME bus request level BR3 65 */ + +#define ARCR_RND_ROBIN 0x00 /* select round robin arbitration 7 */ +#define ARCR_PRIORITY 0x80 /* select priority arbitration 7 */ + +/*************************************************************** +* AMSR 0x2d 0xb7 AM Source Reg * +****************************************************************/ + + /* Extended (A32) address modifier codes */ + +#define AMSR_EXT_USR_DATA 0x09 /* user data 50 */ +#define AMSR_EXT_USR_PROG 0x0a /* user program access 50 */ +#define AMSR_EXT_USR_BLOCK 0x0b /* user block transfer access 50 */ +#define AMSR_EXT_SPR_DATA 0x0d /* supervisory data access 50 */ +#define AMSR_EXT_SPR_PROG 0x0e /* supervisory program access 50 */ +#define AMSR_EXT_SPR_BLOCK 0x0f /* super block transfer access 50 */ + + /* AMSR_Short (A16) address modifier codes */ + +#define AMSR_SHT_USR_ACCESS 0x29 /* user access 50 */ +#define AMSR_SHT_SPR_ACCESS 0x2d /* supervisory access 50 */ + + /* AMSR_Standard (A24) address modifier codes */ + +#define AMSR_STD_USR_DATA 0x39 /* user data 50 */ +#define AMSR_STD_USR_PROG 0x3a /* user program access 50 */ +#define AMSR_STD_USR_BLOCK 0x3b /* user block transfer access 50 */ +#define AMSR_STD_SPR_DATA 0x3d /* supervisory data access 50 */ +#define AMSR_STD_SPR_PROG 0x3e /* supervisory program access 50 */ +#define AMSR_STD_SPR_BLOCK 0x3f /* super block transfer access 50 */ + + /* AMSR_during slave access/cycles */ + +#define AMSR_SLV_CMP_ALL 0x00 /* all 6 add modifier bits comp 6 */ +#define AMSR_SLV_CMP_3MSB 0x40 /* only 3 most significant add 6 */ + /* modifier bits compared */ + + /* Master access/cycles */ + +#define AMSR_MSTR_CMP_ALL 0x00 /* all 6 add modifier bits used 7 */ +#define AMSR_MSTR_CMP_3MSB 0x80 /* only 3 most significant add 7 */ + /* modifier bits used */ + +/*************************************************************** +* BESR 0x2e 0xbb Bus Error Status Reg * +****************************************************************/ + +#define BESR_LBTOA 0x01 /* local bus time out during 0 */ + /* attempted acquisition */ +#define BESR_SA_SLSEL1 0x02 /* self-access by SLSEL1 1 */ +#define BESR_SA_SLSEL0 0x04 /* self-access by SLSEL0 2 */ +#define BESR_LBTO 0x08 /* local bus time out 3 */ +#define BESR_VBTO 0x10 /* VMEbus time out (bus master) 4 */ +#define BESR_VBERR 0x20 /* VMEbus bus error BERR* 5 */ +#define BESR_LBERR 0x40 /* local bus error LBERR* 6 */ +#define BESR_MASTER 0x80 /* the VIC is VMEbus master 7 */ + +/*************************************************************** +* DSR 0x2f 0xbf DMA Status Reg * +****************************************************************/ + +#define DSR_INTER_DMA 0x01 /* interleaved DMA in progress 0 */ +#define DSR_LBERR_DMA 0x02 /* local bus error LBERR* during DMA 1 */ +#define DSR_VBERR_DMA 0x04 /* VMEbus bus error BERR* during DMA 2 */ +#define DSR_LBERR 0x08 /* local bus error LBERR* asserted 3 */ +#define DSR_VBERR 0x10 /* VMEbus bus error BERR* asserted 4 */ +#define DSR_BTDMA 0x60 /* VME/local 256 byte address error 65 */ +#define DSR_MASTER_WP 0x80 /* master write post info is stored 7 */ + +/****************************************************************/ +/* SS0CR0 0x30 0xc3 Slave Select 0/Control Reg #0 */ +/* and */ +/* SS1CR0 0x32 0xcb Slave Select 1/Control Reg #0 */ +/****************************************************************/ + +/* SS0CR0 and SS1CR0 */ + +#define SSCR0_BLT_NONE 0x00 /* no block transfer allowed 10 */ +#define SSCR0_BLT_LOCAL 0x01 /* emulate blck trans on local bus 10 */ +#define SSCR0_BLT_ACC 0x02 /* accelerated block transfer 10 */ + +#define SSCR0_ASIZ_A32 0x00 /* A32 address size 32 */ +#define SSCR0_ASIZ_A24 0x04 /* A24 address size 32 */ +#define SSCR0_ASIZ_A16 0x08 /* A16 address size 32 */ +#define SSCR0_ASIZ_AMREG 0x0c /* use Addr Modifier source reg 32 */ + +#define SSCR0_SLSEL_D32 0x10 /* D32 SLSEL[01]* data size 4 */ +#define SSCR0_SLSEL_D16 0x00 /* D32 SLSEL[01]* data size 4 */ + +#define SSCR0_SLSEL_SPR 0x20 /* supervisory SLSEL[01]* access only 5 */ +#define SSCR0_SLSEL_ALL 0x00 /* all modes SLSEL[01]* access 5 */ + +/* SS1CR0 */ + +#define SSCR0_MASTER_WP 0x40 /* enable master write posting 6 */ +#define SSCR0_MASTER_NWP 0x00 /* no master write posting 6 */ + +#define SSCR0_SLAVE_WP 0x80 /* enable slave write posting 7 */ +#define SSCR0_SLAVE_NWP 0x00 /* no slave write posting 7 */ + +/* SS0CR0 */ + +#define SSCR0_TIMER_MASK 0x3f /* timer field mask */ +#define SSCR0_TIMER_DIS 0x00 /* timer disabled 76 */ +#define SSCR0_TIMER_50 0x40 /* 50 Hz timer (output on LIRQ2*) 76 */ +#define SSCR0_TIMER_1000 0x80 /* 1000 Hz timer (outpt on LIRQ2*) 76 */ +#define SSCR0_TIMER_100 0xc0 /* 100 Hz timer (output on LIRQ2*) 76 */ + +/*************************************************************** +* SS0CR1 0x31 0xc7 Slave Select 0/Control Reg #1 * +* and * +* SS1CR1 0x33 0xcf Slave Select 1/Control Reg #1 * +****************************************************************/ + +#define SSCR1_DTACK_0 0x00 /* 0 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_2 0x01 /* 2 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_25 0x02 /* 2.5 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_3 0x03 /* 3 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_35 0x04 /* 3.5 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_4 0x05 /* 4 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_45 0x06 /* 4.5 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_5 0x07 /* 5 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_55 0x08 /* 5.5 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_6 0x09 /* 6 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_65 0x0a /* 6.5 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_7 0x0b /* 7 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_75 0x0c /* 7.5 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_8 0x0d /* 8 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_85 0x0e /* 8.5 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_9 0x0f /* 9 x 64 Mhz DTACK* delay 30 */ + +#define SSCR1_DSACK_0 0x00 /* 0 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_2 0x10 /* 2 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_25 0x20 /* 2.5 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_3 0x30 /* 3 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_35 0x40 /* 3.5 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_4 0x50 /* 4 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_45 0x60 /* 4.5 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_5 0x70 /* 5 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_55 0x80 /* 5.5 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_6 0x90 /* 6 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_65 0xa0 /* 6.5 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_7 0xb0 /* 7 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_75 0xc0 /* 7.5 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_8 0xd0 /* 8 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_85 0xe0 /* 8.5 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_9 0xf0 /* 9 x 64 Mhz DTACK* delay 74 */ + +/*************************************************************** +* RCR 0x34 0xd3 Release Control Reg * +****************************************************************/ + +#define RCR_ROR 0x00 /* release on request 76 */ +#define RCR_RWD 0x40 /* release when done 76 */ +#define RCR_ROC 0x80 /* release on BCLR* 76 */ +#define RCR_BCAP 0xc0 /* bus capture and hold 76 */ + +/*************************************************************** +* BTCR 0x35 0xd7 Block Transfer Control Reg * +****************************************************************/ + +#define BTCR_LCIP_MASK 0x0f /* local cycle interl've period mk 30 */ + +#define BTCR_DMA_WRITE 0x10 /* write DMA enable 4 */ + + /* Note: bits 7, 6 and 5 are mutually exclusive */ + +#define BTCR_MBT 0x20 /* enable MOVEM type block trsfer 5 */ +#define BTCR_VDMA_GO 0x40 /* initiate VME DMA block trsfer 6 */ +#define BTCR_LDMA_GO 0x80 /* initiate local DMA block trsfer 7 */ + +/*************************************************************** +* BTLR0 0x36 0xdb Block Transfer Length Reg #0 * +* and * +* BTLR1 0x37 0xdf Block Transfer Length Reg #1 * +****************************************************************/ + +/* none */ + +/*************************************************************** +* SRR 0x38 0xe3 System Reset Reg * +****************************************************************/ + +#define SRR_SYSRESET 0xf0 /* assert SYSRESET on the VMEbus and */ + /* reset all reset-able VIC registers */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvic068h */ diff --git a/h/drv/vme/unsupported/vme2Pci.h b/h/drv/vme/unsupported/vme2Pci.h new file mode 100644 index 0000000..9a62282 --- /dev/null +++ b/h/drv/vme/unsupported/vme2Pci.h @@ -0,0 +1,112 @@ +/* vme2Pci.h - vme2pci chip configuration header */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,13nov96,mas added VME2PCI_IO_OFFSET (SPR 7475). +01c,28feb95,caf removed MSW() macro (now in vxWorks.h). +01b,20jan95,vin clean up & enhancements. +01a,09jan95,kvk created. +*/ + +/* +This file contains type declarations for the vme2pci chip Header +and the macros for the PCI BUS. This header has been designed +with respect to Genesis 1.5 Engineering Specification Version 1.0A. +Configuration registers have to be accessed as long words. +*/ + + +#ifndef INCvme2Pcih +#define INCvme2Pcih + + +#ifdef _ASMLANGUAGE +#define CASTB +#else +#define CASTB (char *) +#endif /* _ASMLANGUAGE */ + + +#define VME2PCI_REG_INTERVAL 4 + +/* to permit alternative board addressing */ +#ifndef VME2PCI_IACK_ADRS +#define VME2PCI_IACK_ADRS(reg) (CASTB (VME2PCI_BASE_ADRS + \ + (0xF007) + \ + (reg * VME2PCI_REG_INTERVAL))) +#endif /* VME2PCI_ADRS */ + +/* + * Defines for the VME2PCI interrupt acknowledge registers + */ + +#define VME2PCI_IACK_LEVEL1 VME2PCI_IACK_ADRS(0x00) +#define VME2PCI_IACK_LEVEL2 VME2PCI_IACK_ADRS(0x01) +#define VME2PCI_IACK_LEVEL3 VME2PCI_IACK_ADRS(0x02) +#define VME2PCI_IACK_LEVEL4 VME2PCI_IACK_ADRS(0x03) +#define VME2PCI_IACK_LEVEL5 VME2PCI_IACK_ADRS(0x04) +#define VME2PCI_IACK_LEVEL6 VME2PCI_IACK_ADRS(0x05) +#define VME2PCI_IACK_LEVEL7 VME2PCI_IACK_ADRS(0x06) + + +/* configuration space header */ + +typedef struct + { +#if (_BYTE_ORDER == _BIG_ENDIAN) + UINT16 pciSlvEndAddr1; /* slave end addr1 0x40 */ + UINT16 pciSlvStrtAddr1; /* slave start addr1 0x42 */ + UINT16 pciSlvEnable1; /* pci slave enable 1 0x44 */ + UINT16 pciSlvAddrOffset1; /* addr offset 1 0x46 */ + UINT16 pciSlvEndAddr2; /* slave end addr2 0x48 */ + UINT16 pciSlvStrtAddr2; /* slave start addr2 0x4A */ + UINT16 pciSlvEnable2; /* pci slave enable 2 0x4C */ + UINT16 pciSlvAddrOffset2; /* addr offset 2 0x4E */ +#else + UINT16 pciSlvStrtAddr1; /* slave start addr1 0x40 */ + UINT16 pciSlvEndAddr1; /* slave end addr1 0x42 */ + UINT16 pciSlvAddrOffset1; /* addr offset 1 0x44 */ + UINT16 pciSlvEnable1; /* pci slave enable 1 0x46 */ + UINT16 pciSlvStrtAddr2; /* slave start addr2 0x48 */ + UINT16 pciSlvEndAddr2; /* slave end addr2 0x4A */ + UINT16 pciSlvAddrOffset2; /* addr offset 2 0x4C */ + UINT16 pciSlvEnable2; /* pci slave enable 2 0x4E */ +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + UINT32 pciIntEnable; /* pending intrpt enabl 0x50 */ + + } VME2PCI_CNFG_HDR; + + +#define VME2PCI_CNFG_OFFSET 0x40 /* offset vme2Pci specific part */ +#define VME2PCI_IO_OFFSET 0xF840 /* offset vme2Pci specific IO space */ + +/* vme2pci device specific masks */ + +#define VME2PCI_SLV_ADDR_MASK 0xffff0000 /* pci slave addr mask */ +#define VME2PCI_SLV_EN_MASK 0x00010000 /* slave enable mask */ +#define VME2PCI_INT_MASK 0x00000008 /* vme2PCI interrupt mask */ +#define VME2PCI_INT_LVL_MASK 0x00000007 /* vme2PCI intr level mask */ + +#define VME2PCI_INT_LVL_GET(x) (x & VME2PCI_INT_LVL_MASK) + +#define VME2PCI_SLAVE_ENABLE 0x0001 /* slave enable flag */ +#define VME2PCI_INT_ENABLE 0x00000008 /* Vme2PCI interrupt enable */ + +/* pci function declerations */ +#if defined(__STDC__) || defined(__cplusplus) + +extern int sysVme2PciInit (VME2PCI_CNFG_HDR * pVme2PciCnfgHdr, + ULONG vme2PciCnfgBase); + +#else + +extern int sysVme2PciInit (); + +#endif /* __STDC__ */ + +#endif /* INCvme2Pcih */ + + diff --git a/h/drv/vme/unsupported/vmechip.h b/h/drv/vme/unsupported/vmechip.h new file mode 100644 index 0000000..26e701b --- /dev/null +++ b/h/drv/vme/unsupported/vmechip.h @@ -0,0 +1,333 @@ +/* vmechip.h - Motorola MVME6000 VMEbus Interface Controller */ + +/* Copyright 1991-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01f,29sep98,fle doc : made it refgen parsable +01e,22sep92,rrr added support for c++ +01d,03jun92,ccc added a few more constants. +01c,26may92,rrr the tree shuffle +01b,02jan92,caf fixed GLOBAL_0 bits. changed copyright notice. +01a,19dec91,caf written. +*/ + +#ifdef DOC +#define INCvmechiph +#endif /* DOC */ + +#ifndef __INCvmechiph +#define __INCvmechiph + +#ifdef __cplusplus +extern "C" { +#endif + +/* +This file contains constants for the Motorola MVME6000 VMEbus Interface. +The macro VMECHIP_BASE_ADRS must be defined when using local bus addresses +defined in this header. The macro GCSR_BUS_BASE_ADRS must be defined when +using VMEbus addresses defined in this header. + +The following standards have been adopted in the creation of this file. + +Registers in the LCSR have the prefix "LCSR". + +Registers in the GCSR have the prefix "GCSR" when addressed locally and the +prefix "GCSR_BUS" when addressed from the VMEbus. The bit definitions are +shared. + +The registers are listed in ascending (numerical) order; the definitions +for each register start with a header, e.g.: + + Register Register Register Register + Mnemonic Number Address Name + | | | | + v v v v +************************************************************************* +* SYS_CONF 0x00 0x01 system controller config * +************************************************************************* + +In cases where a number of registers have the same definitions, the +header looks like this: + +************************************************************************* +* GP_CSR_0 0x13 0x27 general purpose CSR 0 * +* to * +* GP_CSR_4 0x17 0x2f general purpose CSR 4 * +************************************************************************* + +The format of the definitions is as follows. The define name always +starts with the register mnemonic it is associated with. The [7-0] +number at the end of the comment indicates the bit position to which the +the define applies. In the definition of RQST_CONF_DWB, for example, +the 7 indicates bit 7: + | + v + define RQST_CONF_DWB 0x80 * device wants bus 7 * + +If the define applies to more than one bit, then the applicable bit +range is specified by two digits. In the following example, +TMO_CONF_VBTO_2048 applies to the two bit field, bits 5-4: + | + v + define TMO_CONF_VBTO_2048 0x10 * VMEbus time-out 2048 * T 54 * + +If no bit field is given, then the define applies to the whole register. +*/ + +#ifdef _ASMLANGUAGE +#define CAST +#else +#define CAST (char *) +#endif /* _ASMLANGUAGE */ + +#define VMECHIP_REG_INTERVAL 2 + +#ifndef VMECHIP_ADRS /* to permit alternative board addressing */ +#define VMECHIP_ADRS(reg) \ + (CAST (VMECHIP_BASE_ADRS + 1 + (reg * VMECHIP_REG_INTERVAL))) +#endif /* VMECHIP_ADRS */ + +/* + * Local Control and Status Register (LCSR) definitions. + * + * Only the local CPU can access the LCSR. + */ + +#define LCSR_SYS_CONF VMECHIP_ADRS(0x00) /* system controller config */ +#define LCSR_RQST_CONF VMECHIP_ADRS(0x01) /* requester configuration */ +#define LCSR_MASTER_CONF VMECHIP_ADRS(0x02) /* master configuration */ +#define LCSR_SLAVE_CONF VMECHIP_ADRS(0x03) /* slave configuration */ +#define LCSR_TMO_CONF VMECHIP_ADRS(0x04) /* timer configuration */ +#define LCSR_SLAVE_AM VMECHIP_ADRS(0x05) /* slave address modifier */ +#define LCSR_MASTER_AM VMECHIP_ADRS(0x06) /* master address modifier */ +#define LCSR_INT_MASK VMECHIP_ADRS(0x07) /* interrupt handler mask */ +#define LCSR_UTIL_INT_MASK VMECHIP_ADRS(0x08) /* utility interrupt mask */ +#define LCSR_UTIL_VEC_BASE VMECHIP_ADRS(0x09) /* utility interrupt vector */ +#define LCSR_INT_REQ VMECHIP_ADRS(0x0a) /* interrupt request */ +#define LCSR_INT_STATUS_ID VMECHIP_ADRS(0x0b) /* status/ID */ +#define LCSR_BERR_STATUS VMECHIP_ADRS(0x0c) /* bus error status */ +#define LCSR_GCSR_BASE_ADRS VMECHIP_ADRS(0x0d) /* GCSR base address */ + + +/* + * Global Control and Status Register (GCSR) definitions. + * + * All registers of the GCSR are accessible to both the local processor + * and to other VMEbus masters. + */ + +/* local addresses for the GCSR */ + +#define GCSR_GLOBAL_0 VMECHIP_ADRS(0x10) /* global 0 */ +#define GCSR_GLOBAL_1 VMECHIP_ADRS(0x11) /* global 1 */ +#define GCSR_BOARD_ID VMECHIP_ADRS(0x12) /* board ID */ +#define GCSR_GP_CSR_0 VMECHIP_ADRS(0x13) /* general purpose CSR 0 */ +#define GCSR_GP_CSR_1 VMECHIP_ADRS(0x14) /* general purpose CSR 1 */ +#define GCSR_GP_CSR_2 VMECHIP_ADRS(0x15) /* general purpose CSR 2 */ +#define GCSR_GP_CSR_3 VMECHIP_ADRS(0x16) /* general purpose CSR 3 */ +#define GCSR_GP_CSR_4 VMECHIP_ADRS(0x17) /* general purpose CSR 4 */ + +/* VMEbus addresses for the GCSR */ + +#define GCSR_BUS_REG_INTERVAL 2 + +#ifndef GCSR_BUS_ADRS /* to permit alternative off-board addressing */ +#define GCSR_BUS_ADRS(reg) \ + (CAST (GCSR_BUS_BASE_ADRS + 1 + (reg * GCSR_BUS_REG_INTERVAL))) +#endif /* GCSR_BUS_ADRS */ + +#define GCSR_BUS_GLOBAL_0 GCSR_BUS_ADRS(0x00) /* global 0 on VMEbus */ +#define GCSR_BUS_GLOBAL_1 GCSR_BUS_ADRS(0x01) /* global 1 on VMEbus */ +#define GCSR_BUS_BOARD_ID GCSR_BUS_ADRS(0x02) /* board ID on VMEbus */ +#define GCSR_BUS_GP_CSR_0 GCSR_BUS_ADRS(0x03) /* general purp. 0 on VMEbus */ +#define GCSR_BUS_GP_CSR_1 GCSR_BUS_ADRS(0x04) /* general purp. 1 on VMEbus */ +#define GCSR_BUS_GP_CSR_2 GCSR_BUS_ADRS(0x05) /* general purp. 2 on VMEbus */ +#define GCSR_BUS_GP_CSR_3 GCSR_BUS_ADRS(0x06) /* general purp. 3 on VMEbus */ +#define GCSR_BUS_GP_CSR_4 GCSR_BUS_ADRS(0x07) /* general purp. 4 on VMEbus */ + + +/* SYS_CONF 0x00 0x01 system controller config */ + +#define SYS_CONF_SCON 0x01 /* system controller on (status) 0 */ +#define SYS_CONF_SRESET 0x02 /* system reset 1 */ +#define SYS_CONF_BRDFAIL 0x04 /* board fail 2 */ +#define SYS_CONF_ROBIN 0x08 /* round robin select 3 */ +#define SYS_CONF_PRIORITY 0x00 /* priority mode select 3 */ + +/* RQST_CONF 0x01 0x03 requester configuration */ + +#define RQST_CONF_RQLEV 0x03 /* VMEbus request level (mask) 10 */ +#define RQST_CONF_RQLEV_0 0x00 /* VMEbus request level 0 10 */ +#define RQST_CONF_RQLEV_1 0x01 /* VMEbus request level 1 10 */ +#define RQST_CONF_RQLEV_2 0x02 /* VMEbus request level 2 10 */ +#define RQST_CONF_RQLEV_3 0x03 /* VMEbus request level 3 10 */ + +#define RQST_CONF_RNEVER 0x08 /* release never 3 */ +#define RQST_CONF_RWD 0x10 /* release when done 4 */ +#define RQST_CONF_ROR 0x00 /* release on request 4 */ +#define RQST_CONF_RONR 0x20 /* request on no request 5 */ +#define RQST_CONF_DHB 0x40 /* device has bus (status) 6 */ +#define RQST_CONF_DWB 0x80 /* device wants bus 7 */ + +/* MASTER_CONF 0x02 0x05 master configuration */ + +#define MASTER_CONF_MASD16 0x01 /* master D16 0 */ +#define MASTER_CONF_MASD32 0x00 /* master D32, D16, D8 0 */ +#define MASTER_CONF_MASA32 0x00 /* master A32 1 */ +#define MASTER_CONF_MASA24 0x02 /* master A24 1 */ +#define MASTER_CONF_MASA16 0x04 /* master A16 2 */ +#define MASTER_CONF_MASUAT 0x08 /* master unaligned transfers 3 */ +#define MASTER_CONF_CFILL 0x10 /* cache fill 4 */ +#define MASTER_CONF_MASWP 0x20 /* master write-posting (CAUTION) 5 */ +#define MASTER_CONF_020 0x40 /* local CPU is a 68020 6 */ +#define MASTER_CONF_DDTACK 0x80 /* extra delay for 33MHz 020/030 7 */ + +/* SLAVE_CONF 0x03 0x07 slave configuration */ + +#define SLAVE_CONF_SLVD16 0x01 /* slave D16 0 */ +#define SLAVE_CONF_SLVWP 0x20 /* slave write-posting (CAUTION) 5 */ +#define SLAVE_CONF_SLVEN 0x80 /* slave enable 7 */ +#define SLAVE_CONF_SLVDIS 0x00 /* slave disable 7 */ + +/* TMO_CONF 0x04 0x09 timer configuration */ + +#define TMO_CONF_LBTO 0x03 /* local bus time-out (mask) 10 */ +#define TMO_CONF_LBTO_1024 0x00 /* local bus time-out 1024 * T 10 */ +#define TMO_CONF_LBTO_2048 0x01 /* local bus time-out 2048 * T 10 */ +#define TMO_CONF_LBTO_4096 0x02 /* local bus time-out 4096 * T 10 */ +#define TMO_CONF_LBTO_DIS 0x03 /* local bus time-out disabled 10 */ + +#define TMO_CONF_ACTO 0x0c /* access time-out (mask) 32 */ +#define TMO_CONF_ACTO_1024 0x00 /* access time-out 1024 * T 32 */ +#define TMO_CONF_ACTO_16384 0x04 /* access time-out 16384 * T 32 */ +#define TMO_CONF_ACTO_524 0x08 /* access time-out 524290 * T 32 */ +#define TMO_CONF_ACTO_DIS 0x0c /* access time-out disabled 32 */ + +#define TMO_CONF_VBTO 0x30 /* VMEbus time-out (mask) 54 */ +#define TMO_CONF_VBTO_1024 0x00 /* VMEbus time-out 1024 * T 54 */ +#define TMO_CONF_VBTO_2048 0x10 /* VMEbus time-out 2048 * T 54 */ +#define TMO_CONF_VBTO_4096 0x20 /* VMEbus time-out 4096 * T 54 */ +#define TMO_CONF_VBTO_DIS 0x30 /* VMEbus time-out disabled 54 */ + +#define TMO_CONF_ARBTO 0x40 /* arbitration timer 6 */ + +/* SLAVE_AM 0x05 0x0b slave address modifier */ + +#define SLAVE_AM_DATA 0x01 /* respond to data 0 */ +#define SLAVE_AM_PROGRAM 0x02 /* respond to program 1 */ +#define SLAVE_AM_BLOCK 0x04 /* respond to block (never set) 2 */ + +#define SLAVE_AM_SHORT 0x08 /* respond to short 3 */ +#define SLAVE_AM_STND 0x10 /* respond to standard 4 */ +#define SLAVE_AM_EXTED 0x20 /* respond to extended 5 */ + +#define SLAVE_AM_USER 0x40 /* respond to user 6 */ +#define SLAVE_AM_SUPER 0x80 /* respond to supervisor 7 */ + +/* MASTER_AM 0x06 0x0d master address modifier */ + +#define MASTER_AM_AM 0x3f /* address modifier code (mask) 50 */ + +#define MASTER_AM_AMSEL 0x80 /* address modifier select 7 */ +#define MASTER_AM_DYNAMIC 0x00 /* AM code dynamically determined 7 */ + +/* INT_MASK 0x07 0x0f interrupt handler mask */ + +#define INT_MASK_IEN1 0x02 /* VMEbus IRQ1 interrupt enable 1 */ +#define INT_MASK_IEN2 0x04 /* VMEbus IRQ2 interrupt enable 2 */ +#define INT_MASK_IEN3 0x08 /* VMEbus IRQ3 interrupt enable 3 */ +#define INT_MASK_IEN4 0x10 /* VMEbus IRQ4 interrupt enable 4 */ +#define INT_MASK_IEN5 0x20 /* VMEbus IRQ5 interrupt enable 5 */ +#define INT_MASK_IEN6 0x40 /* VMEbus IRQ6 interrupt enable 6 */ +#define INT_MASK_IEN7 0x80 /* VMEbus IRQ7 interrupt enable 7 */ +#define INT_MASK_DISABLE 0x00 /* Disable VMEbus interrupts */ + +/* UTIL_INT_MASK 0x08 0x11 utility interrupt mask */ + +#define UTIL_INT_MASK_SIGLEN 0x02 /* signal low interrupt enable 1 */ +#define UTIL_INT_MASK_LM0EN 0x04 /* loc. monitor 0 intrpt. enable 2 */ +#define UTIL_INT_MASK_IACKEN 0x08 /* IACK interrupt enable 3 */ +#define UTIL_INT_MASK_LM1EN 0x10 /* loc. monitor 1 intrpt. enable 4 */ +#define UTIL_INT_MASK_SIGHEN 0x20 /* signal high interrupt enable 5 */ +#define UTIL_INT_MASK_SFIEN 0x40 /* SYSFAIL interrupt enable 6 */ +#define UTIL_INT_MASK_WPERREN 0x80 /* write posting bus error enable 7 */ +#define UTIL_INT_MASK_DISABLE 0x00 /* Disable utility interrupts */ + +/* UTIL_VEC_BASE 0x09 0x13 utility interrupt vector */ + +#define UTIL_VEC_BASE_UID 0x07 /* utility interrupt ID (mask) 20 */ +#define UTIL_VEC_BASE_SIGLP 0x01 /* signal low 20 */ +#define UTIL_VEC_BASE_LM0 0x02 /* location monitor 0 20 */ +#define UTIL_VEC_BASE_IACK 0x03 /* IACK 20 */ +#define UTIL_VEC_BASE_LM1 0x04 /* location monitor 1 20 */ +#define UTIL_VEC_BASE_SIGHP 0x05 /* signal high 20 */ +#define UTIL_VEC_BASE_SYSFAIL 0x06 /* SYSFAIL 20 */ +#define UTIL_VEC_BASE_WPBERR 0x07 /* write post bus error 20 */ + +#define UTIL_VEC_BASE_UVB 0xf8 /* utility vector base (mask) 73 */ + +/* INT_REQ 0x0a 0x15 interrupt request */ + +#define INT_REQ_UID 0x07 /* interrupt request (mask) 20 */ +#define INT_REQ_NONE 0x00 /* none 20 */ +#define INT_REQ_IRQ1 0x01 /* IRQ1 20 */ +#define INT_REQ_IRQ2 0x02 /* IRQ2 20 */ +#define INT_REQ_IRQ3 0x03 /* IRQ3 20 */ +#define INT_REQ_IRQ4 0x04 /* IRQ4 20 */ +#define INT_REQ_IRQ5 0x05 /* IRQ5 20 */ +#define INT_REQ_IRQ6 0x06 /* IRQ6 20 */ +#define INT_REQ_IRQ7 0x07 /* IRQ7 20 */ + +/* INT_STATUS_ID 0x0b 0x17 status/ID */ + +/* none */ + +/* BERR_STATUS 0x0c 0x19 bus error status */ + +#define BERR_STATUS_LBTO 0x01 /* local bus time-out 0 */ +#define BERR_STATUS_ACTO 0x02 /* access time-out 1 */ +#define BERR_STATUS_VBERR 0x04 /* VMEbus bus error 2 */ +#define BERR_STATUS_RMCERR 0x08 /* RMC lock error 3 */ + +/* GCSR_BASE_ADRS 0x0d 0x1b GCSR base address */ + +#define GCSR_BASE_ADRS 0x0f /* GCSR base address (mask) 30 */ +#define GCSR_BASE_ADRS_NONE 0x0f /* GCSR not mapped on VMEbus 30 */ + +/* GLOBAL_0 0x10 0x21 global 0 */ + +#define GLOBAL_0_CHIP_ID 0x0f /* chip ID (mask) 30 */ + +#define GLOBAL_0_LM0 0x10 /* location monitor 0 4 */ +#define GLOBAL_0_LM1 0x20 /* location monitor 1 5 */ +#define GLOBAL_0_LM2 0x40 /* location monitor 2 6 */ +#define GLOBAL_0_LM3 0x80 /* location monitor 3 7 */ + +/* GLOBAL_1 0x11 0x23 global 1 */ + +#define GLOBAL_1_SIGLP 0x01 /* signal low priority 0 */ +#define GLOBAL_1_SIGHP 0x02 /* signal high priority 1 */ +#define GLOBAL_1_BRDFAIL 0x10 /* board fail 4 */ +#define GLOBAL_1_ISF 0x20 /* inhibit SYSFAIL 5 */ +#define GLOBAL_1_SCON 0x40 /* system controller on (status) 6 */ +#define GLOBAL_1_R_AND_H 0x80 /* reset and hold 7 */ + +/* BOARD_ID 0x12 0x25 board ID */ + +/* none */ + +/* + * GP_CSR_0 0x13 0x27 general purpose CSR 0 + * to + * GP_CSR_4 0x17 0x2f general purpose CSR 4 + */ + +/* none */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvmechiph */ diff --git a/h/drv/vme/unsupported/vmechip2.h b/h/drv/vme/unsupported/vmechip2.h new file mode 100644 index 0000000..259d661 --- /dev/null +++ b/h/drv/vme/unsupported/vmechip2.h @@ -0,0 +1,1141 @@ +/* vmechip2.h - VMEbus Interface Controller */ + +/* Copyright 1991-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,26apr02,dat Adding cplusplus protection, SPR 75017 +01h,02nov98,fle removed all the full star-comment-lines in order for refgen + to parse this file +01g,03jan97,mas casting for VC2GCSR_* set to CASTUC from CASTINT (SPR 3389). +01f,19nov96,mas fixed comment lines per SPR 5428. +01e,12jan93,ccc added Miscellaneous Control Register for new chips. +01d,17jun92,ccc fixed typo, SPR 1353. +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01a,17jun91,ccc written. +*/ + +#ifdef DOC +#define __INCvmechip2h +#endif /* DOC */ + +#ifndef __INCvmechip2h +#define __INCvmechip2h + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This file contains constants for the mv167 VMEbus Interface controller. + * The macros VMECHIP2_BASE_ADRS and VC2BUS_BASE_ADRS must be defined + * when including this header. + + * The registers are listed in ascending (numerical) order; the definitions + * for each register are started with a header eg. + */ + +#ifdef _ASMLANGUAGE +#define CASTUC +#define CASTINT +#else +#define CASTUC (UCHAR *) +#define CASTINT (int *) +#endif /* _ASMLANGUAGE */ + +/* + * on-board access, register definitions + * these registers MUST BE WRITTEN 4-BYTE WRITES ONLY + * they can be read as byte, two-bytes or 4-bytes. + */ + +#define VMECHIP2_REG_INTERVAL 1 + +#ifndef VMECHIP2_ADRS /* to permit alternative board addressing */ +#define VMECHIP2_ADRS(reg) (CASTINT (VMECHIP2_BASE_ADRS + \ + (reg * VMECHIP2_REG_INTERVAL))) +#define VC2GCSR_ADRS(reg) (CASTUC (VMECHIP2_BASE_ADRS + 0x100 + \ + (reg * VMECHIP2_REG_INTERVAL))) +#endif /* VMECHIP2_ADRS */ + +#ifndef VC2BUS_ADRS /* to permit alternative board addressing */ +#define VC2BUS_ADRS(reg) (CASTINT (VC2BUS_BASE_ADRS + (reg))) +#endif /* VC2BUS_ADRS */ + +/* WRITES MUST BE 4-BYTE WRITES ONLY */ +/* + * VMEbus Slave Ending Address Register 1 0x00 31-16 + * VMEbus Slave Starting Address Register 1 0x00 15-00 + */ +#define VMECHIP2_VSAR1 VMECHIP2_ADRS(0x00) +/* + * VMEbus Slave Ending Address Register 2 0x04 31-16 + * VMEbus Slave Starting Address Register 2 0x04 15-00 + */ +#define VMECHIP2_VSAR2 VMECHIP2_ADRS(0x04) +/* + * VMEbus Slave Address Translation Address Reg 1 0x08 31-16 + * VMEbus Slave Adrs Translation Select Reg 1 0x08 15-00 + */ +#define VMECHIP2_VSATR1 VMECHIP2_ADRS(0x08) +/* + * VMEbus Slave Adrs Translation Address Reg 2 0x0c 31-16 + * VMEbus Slave Adrs Translation Select Reg 2 0x0c 15-00 + */ +#define VMECHIP2_VSATR2 VMECHIP2_ADRS(0x0c) +/* + * VMEbus Slave Write Post and Snoop Control Reg 2 0x10 31-24 + * VMEbus Slave Address Modifier Select Reg 2 0x10 23-16 + * VMEbus Slave Write Post and Snoop Control Reg 1 0x10 15-08 + * VMEbus Slave Address Modifier Select Reg 1 0x10 07-00 + */ +#define VMECHIP2_VSAMSR VMECHIP2_ADRS(0x10) +/* + * Local Bus Slave Ending Address Reg 1 0x14 31-16 + * Local Bus Slave Starting Address Reg 1 0x14 16-00 + */ +#define VMECHIP2_LBSAR1 VMECHIP2_ADRS(0x14) +/* + * Local Bus Slave Ending Address Reg 2 0x18 31-16 + * Local Bus Slave Starting Address Reg 2 0x18 15-00 + */ +#define VMECHIP2_LBSAR2 VMECHIP2_ADRS(0x18) +/* + * Local Bus Slave Ending Address Reg 3 0x1c 31-16 + * Local Bus Slave Starting Address Reg 3 0x1c 15-00 + */ +#define VMECHIP2_LBSAR3 VMECHIP2_ADRS(0x1c) +/* + * Local Bus Slave Ending Address Reg 4 0x20 31-16 + * Local Bus Slave Starting Address Reg 4 0x20 15-00 + */ +#define VMECHIP2_LBSAR4 VMECHIP2_ADRS(0x20) +/* + * Local Bus Slave Address Translation Adrs Reg 1 0x24 31-16 + * Local Bus Slave Address Translation Sel Reg 1 0x24 15-00 + */ +#define VMECHIP2_LBSATR1 VMECHIP2_ADRS(0x24) +/* + * Local Bus Slave Attribute Reg 4 0x28 31-24 + * Local Bus Slave Attribute Reg 3 0x28 23-16 + * Local Bus Slave Attribute Reg 2 0x28 15-08 + * Local Bus Slave Attribute Reg 1 0x28 07-00 + */ +#define VMECHIP2_LBSAR VMECHIP2_ADRS(0x28) +/* + * VMEbus Slave GCSR Group Address Reg 0x2c 31-24 + * VMEbus Slave GCSR Board Address Reg 0x2c 23-20 + * Local Bus To VMEbus Enable Control Reg 0x2c 19-16 + * Local Bus To VMEbus I/O Control Reg 0x2c 15-08 + * ROM Control Reg 0x2c 07-00 + */ +#define VMECHIP2_LBTVCR VMECHIP2_ADRS(0x2c) +/* + * EPROM Decoder, SRAM and DMA Control Register 0x30 23-16 + * Local Bus To VMEbus Requester Control Reg 0x30 15-08 + * DMAC Control Register 1 0x30 07-00 + */ +#define VMECHIP2_DMACR1 VMECHIP2_ADRS(0x30) +/* + * DMAC Control Register 2 0x34 15-08 + * DMAC Control Register 2 0x34 07-00 + */ +#define VMECHIP2_DMACR2 VMECHIP2_ADRS(0x34) +/* + * DMAC Local Bus Address Counter 0x38 31-00 + */ +#define VMECHIP2_DMACLBAC VMECHIP2_ADRS(0x38) +/* + * DMAC VMEbus Address Counter 0x3c 31-00 + */ +#define VMECHIP2_DMACVAC VMECHIP2_ADRS(0x3c) +/* + * DMAC Byte Counter 0x40 31-00 + */ +#define VMECHIP2_DMACBC VMECHIP2_ADRS(0x40) +/* + * Table Address Counter 0x44 31-00 + */ +#define VMECHIP2_TAC VMECHIP2_ADRS(0x44) +/* + * VMEbus Interrupter Control Register 0x48 31-24 + * VMEbus Interrupter Vector Register 0x48 23-16 + * MPU Status and DMA Interrupt Count Register 0x48 15-08 + * DMAC Status Register 0x48 07-00 + */ +#define VMECHIP2_ICR VMECHIP2_ADRS(0x48) +/* + * VMEbus Arbiter Timeout Control Register 0x4c 31-24 + * DMAC Ton/Toff Timers and VMEbus Global Timeout 0x4c 23-16 + * VME Access, Local Bus and Watchdog Timeout 0x4c 15-08 + * Prescaler Control Register 0x4c 07-00 + */ +#define VMECHIP2_TIMEOUTCR VMECHIP2_ADRS(0x4c) +/* + * Tick Timer 1 Compair Register 0x50 31-00 + */ +#define VMECHIP2_TTCOMP1 VMECHIP2_ADRS(0x50) +/* + * Tick Timer 1 Counter 0x54 31-00 + */ +#define VMECHIP2_TTCOUNT1 VMECHIP2_ADRS(0x54) +/* + * Tick Timer 2 Compair Register 0x58 31-00 + */ +#define VMECHIP2_TTCOMP2 VMECHIP2_ADRS(0x58) +/* + * Tick Timer 2 Counter 0x5c 31-00 + */ +#define VMECHIP2_TTCOUNT2 VMECHIP2_ADRS(0x5c) +/* + * Board Control Register 0x60 31-24 + * Watchdog Timer Control Register 0x60 23-16 + * Tick Timer 2 Control Register 0x60 15-08 + * Tick Timer 1 Control Register 0x60 07-00 + */ +#define VMECHIP2_TIMERCR VMECHIP2_ADRS(0x60) +/* + * Prescaler Counter 0x64 31-00 + */ +#define VMECHIP2_PRESCALE_CNT VMECHIP2_ADRS(0x64) +/* + * Local Bus Interrupter Status Reg (24-31) 0x68 31-24 + * Local Bus Interrupter Status Reg (16-23) 0x68 23-16 + * Local Bus Interrupter Status Reg (8-15) 0x68 15-08 + * Local Bus Interrupter Status Reg (0-7) 0x68 07-00 + */ +#define VMECHIP2_LBISR VMECHIP2_ADRS(0x68) +/* + * Local Bus Interrupter Enable Reg (24-31) 0x6c 31-24 + * Local Bus Interrupter Enable Reg (16-23) 0x6c 24-16 + * Local Bus Interrupter Enable Reg (8-15) 0x6c 15-08 + * Local Bus Interrupter Enable Reg (0-7) 0x6c 07-00 + */ +#define VMECHIP2_LBIER VMECHIP2_ADRS(0x6c) +/* + * Software Interrupt Set Register (8-15) 0x70 15-08 + */ +#define VMECHIP2_SISR VMECHIP2_ADRS(0x70) +/* + * Interrupt Clear Register (24-31) 0x74 31-24 + * Interrupt Clear Register (16-23) 0x74 23-16 + * Interrupt Clear Register (08-15) 0x74 15-08 + */ +#define VMECHIP2_ICLR VMECHIP2_ADRS(0x74) +/* + * Interrupt Level Register 1 (24-31) 0x78 31-24 + * Interrupt Level Register 1 (16-23) 0x78 23-16 + * Interrupt Level Register 1 (8-15) 0x78 15-08 + * Interrupt Level Register 1 (0-7) 0x78 07-00 + */ +#define VMECHIP2_ILR1 VMECHIP2_ADRS(0x78) +/* + * Interrupt Level Register 2 (24-31) 0x7c 31-24 + * Interrupt Level Register 2 (16-23) 0x7c 23-16 + * Interrupt Level Register 2 (8-15) 0x7c 15-08 + * Interrupt Level Register 2 (0-7) 0x7c 07-00 + */ +#define VMECHIP2_ILR2 VMECHIP2_ADRS(0x7c) +/* + * Interrupt Level Register 3 (24-31) 0x80 31-24 + * Interrupt Level Register 3 (16-23) 0x80 23-16 + * Interrupt Level Register 3 (8-15) 0x80 15-08 + * Interrupt Level Register 3 (0-7) 0x80 07-00 + */ +#define VMECHIP2_ILR3 VMECHIP2_ADRS(0x80) +/* + * Interrupt Level Register 4 (24-31) 0x84 31-24 + * Interrupt Level Register 4 (16-23) 0x84 23-16 + * Interrupt Level Register 4 (8-15) 0x84 15-08 + * Interrupt Level Register 4 (0-7) 0x84 07-00 + */ +#define VMECHIP2_ILR4 VMECHIP2_ADRS(0x84) +/* + * Vector Base Register 0x88 31-24 + * I/O Control Register 1 0x88 23-16 + * I/O Control Register 2 0x88 15-08 + * I/O Control Register 3 0x88 07-00 + */ +#define VMECHIP2_IOCR VMECHIP2_ADRS(0x88) +/* + * Miscellaneous Control Register 0x8c 07-00 + */ +#define VMECHIP2_MISCCR VMECHIP2_ADRS(0x8c) + +/* These Global Status and Control Register are 16-bit registers + * accessible from both the VMEbus and the local bus. + * They are byte accessible registers. + */ + +#define VC2GCSR_REVISION VC2GCSR_ADRS(0x02) /* VMEchip2 Rev Reg */ +#define VC2GCSR_ID VC2GCSR_ADRS(0x03) /* VMEchip2 ID Reg */ +#define VC2GCSR_LM_SIG VC2GCSR_ADRS(0x06) /* VMEchip2 LM/SIG Reg */ +#define VC2GCSR_BSCR VC2GCSR_ADRS(0x07) /* Board Stat/Cont Reg */ +#define VC2GCSR_GPR0H VC2GCSR_ADRS(0x0a) /* General Purpose Reg 0 */ +#define VC2GCSR_GPR0L VC2GCSR_ADRS(0x0b) /* General Purpose Reg 0 */ +#define VC2GCSR_GPR1H VC2GCSR_ADRS(0x0e) /* General Purpose Reg 1 */ +#define VC2GCSR_GPR1L VC2GCSR_ADRS(0x0f) /* General Purpose Reg 1 */ +#define VC2GCSR_GPR2H VC2GCSR_ADRS(0x12) /* General Purpose Reg 2 */ +#define VC2GCSR_GPR2L VC2GCSR_ADRS(0x13) /* General Purpose Reg 2 */ +#define VC2GCSR_GPR3H VC2GCSR_ADRS(0x16) /* General Purpose Reg 3 */ +#define VC2GCSR_GPR3L VC2GCSR_ADRS(0x17) /* General Purpose Reg 3 */ +#define VC2GCSR_GPR4H VC2GCSR_ADRS(0x1a) /* General Purpose Reg 4 */ +#define VC2GCSR_GPR4L VC2GCSR_ADRS(0x1b) /* General Purpose Reg 4 */ +#define VC2GCSR_GPR5H VC2GCSR_ADRS(0x1e) /* General Purpose Reg 5 */ +#define VC2GCSR_GPR5L VC2GCSR_ADRS(0x1f) /* General Purpose Reg 5 */ + +#define VC2BUS_REVISION VC2BUS_ADRS(0x00) /* Revision Reg */ +#define VC2BUS_ID VC2BUS_ADRS(0x01) /* ID Reg */ +#define VC2BUS_LM_SIG VC2BUS_ADRS(0x02) /* LM/SIG Reg */ +#define VC2BUS_BSCR VC2BUS_ADRS(0x03) /* Board Stat/Cont Reg */ +#define VC2BUS_GPR0H VC2BUS_ADRS(0x04) /* General Purpose Reg 0 */ +#define VC2BUS_GPR0L VC2BUS_ADRS(0x05) /* General Purpose Reg 0 */ +#define VC2BUS_GPR1H VC2BUS_ADRS(0x06) /* General Purpose Reg 1 */ +#define VC2BUS_GPR1L VC2BUS_ADRS(0x07) /* General Purpose Reg 1 */ +#define VC2BUS_GPR2H VC2BUS_ADRS(0x08) /* General Purpose Reg 2 */ +#define VC2BUS_GPR2L VC2BUS_ADRS(0x09) /* General Purpose Reg 2 */ +#define VC2BUS_GPR3H VC2BUS_ADRS(0x0a) /* General Purpose Reg 3 */ +#define VC2BUS_GPR3L VC2BUS_ADRS(0x0b) /* General Purpose Reg 3 */ +#define VC2BUS_GPR4H VC2BUS_ADRS(0x0c) /* General Purpose Reg 4 */ +#define VC2BUS_GPR4L VC2BUS_ADRS(0x0d) /* General Purpose Reg 4 */ +#define VC2BUS_GPR5H VC2BUS_ADRS(0x0e) /* General Purpose Reg 5 */ +#define VC2BUS_GPR5L VC2BUS_ADRS(0x0f) /* General Purpose Reg 5 */ + +/* NOW LET'S DEFINE THE BITS FOR THESE REGISTERS */ + +/* + * VMEbus Slave Write Post and Snoop Control Reg 2 0x10 31-24 + * VMEbus Slave Address Modifier Select Reg 2 0x10 23-16 + * VMEbus Slave Write Post and Snoop Control Reg 1 0x10 15-08 + * VMEbus Slave Address Modifier Select Reg 1 0x10 07-00 + */ +#define VSAMSR2_SNP_INHIBIT 0x00 /* Snoop Inhibited 26-25 */ +#define VSAMSR2_SNP_WSD (1 << 25) /* Write-Sink Data 26-25 */ +#define VSAMSR2_SNP_WI (2 << 25) /* Write-Invalidate 26-25 */ +#define VSAMSR2_WP (1 << 24) /* Write Posting Enabled 24 */ +#define VSAMSR2_SUP (1 << 23) /* 2nd map to supervi 23 */ +#define VSAMSR2_USR (1 << 22) /* 2nd map to user 22 */ +#define VSAMSR2_A32 (1 << 21) /* 2nd map to extend access 21 */ +#define VSAMSR2_A24 (1 << 20) /* 2nd map to stanard access 20 */ +#define VSAMSR2_D64 (1 << 19) /* 2nd map to D64 block acc 19 */ +#define VSAMSR2_BLK (1 << 18) /* 2nd map to block access 18 */ +#define VSAMSR2_PGM (1 << 17) /* 2nd map to program access 17 */ +#define VSAMSR2_DAT (1 << 16) /* 2nd map to data access 16 */ +#define VSAMSR1_SNP_INHIBIT 0x00 /* Snoop Inhibited 10-9 */ +#define VSAMSR1_SNP_WSD (1 << 9) /* Write-Sink Data 10-9 */ +#define VSAMSR1_SNP_WI (2 << 9) /* Write-Invalidate 10-9 */ +#define VSAMSR1_WP (1 << 8) /* Write Posting Enabled 8 */ +#define VSAMSR1_SUP (1 << 7) /* 1st map to supervi 7 */ +#define VSAMSR1_USR (1 << 6) /* 1st map to user 6 */ +#define VSAMSR1_A32 (1 << 5) /* 1st map to extended access 5 */ +#define VSAMSR1_A24 (1 << 4) /* 1st map to standard access 4 */ +#define VSAMSR1_D64 (1 << 3) /* 1st map to D64 block acces 3 */ +#define VSAMSR1_BLK (1 << 2) /* 1st map to block access 2 */ +#define VSAMSR1_PGM (1 << 1) /* 1st map to program access 1 */ +#define VSAMSR1_DAT 0x01 /* 1st map to data access 0 */ + +/* + * Local Bus Slave Attribute Register 4 0x28 31-24 + * Local Bus Slave Attribute Register 3 0x28 23-16 + * Local Bus Slave Attribute Register 2 0x28 15-08 + * Local Bus Slave Attribute Register 1 0x28 07-00 + */ +#define LBSAR4_D16 (1 << 31) /* D16 data transfers 31 */ +#define LBSAR4_D32 0x00 /* D32 data transfers 31 */ +#define LBSAR4_WP_ENABLE (1 << 30) /* Write posting enabled 30 */ +#define LBSAR4_WP_DISABLE 0x00 /* Write posting disabled 30 */ +/* The following are for the Address Modifier equates 29-24 */ +#define LBSAR4_AM_STD_SUP_ASCENDING VME_AM_STD_SUP_ASCENDING << 24 +#define LBSAR4_AM_STD_SUP_PGM VME_AM_STD_SUP_PGM << 24 +#define LBSAR4_AM_STD_SUP_DATA VME_AM_STD_SUP_DATA << 24 +#define LBSAR4_AM_STD_USR_ASCENDING VME_AM_STD_USR_ASCENDING << 24 +#define LBSAR4_AM_STD_USR_PGM VME_AM_STD_USR_PGM << 24 +#define LBSAR4_AM_STD_USR_DATA VME_AM_STD_USR_DATA << 24 +#define LBSAR4_AM_SUP_SHORT_IO VME_AM_SUP_SHORT_IO << 24 +#define LBSAR4_AM_USR_SHORT_IO VME_AM_USR_SHORT_IO << 24 +#define LBSAR4_AM_EXT_SUP_ASCENDING VME_AM_EXT_SUP_ASCENDING << 24 +#define LBSAR4_AM_EXT_SUP_PGM VME_AM_EXT_SUP_PGM << 24 +#define LBSAR4_AM_EXT_SUP_DATA VME_AM_EXT_SUP_DATA << 24 +#define LBSAR4_AM_EXT_USR_ASCENDING VME_AM_EXT_USR_ASCENDING << 24 +#define LBSAR4_AM_EXT_USR_PGM VME_AM_EXT_USR_PGM << 24 +#define LBSAR4_AM_EXT_USR_DATA VME_AM_EXT_USR_DATA << 24 + +#define LBSAR3_D16 (1 << 23) /* D16 data transfers 23 */ +#define LBSAR3_D32 0x00 /* D32 data transfers 23 */ +#define LBSAR3_WP_ENABLE (1 << 22) /* Write posting enabled 22 */ +#define LBSAR3_WP_DISABLE 0x00 /* Write posting disabled 22 */ +/* The following are for the Address Modifier equates 21-16 */ +#define LBSAR3_AM_STD_SUP_ASCENDING VME_AM_STD_SUP_ASCENDING << 16 +#define LBSAR3_AM_STD_SUP_PGM VME_AM_STD_SUP_PGM << 16 +#define LBSAR3_AM_STD_SUP_DATA VME_AM_STD_SUP_DATA << 16 +#define LBSAR3_AM_STD_USR_ASCENDING VME_AM_STD_USR_ASCENDING << 16 +#define LBSAR3_AM_STD_USR_PGM VME_AM_STD_USR_PGM << 16 +#define LBSAR3_AM_STD_USR_DATA VME_AM_STD_USR_DATA << 16 +#define LBSAR3_AM_SUP_SHORT_IO VME_AM_SUP_SHORT_IO << 16 +#define LBSAR3_AM_USR_SHORT_IO VME_AM_USR_SHORT_IO << 16 +#define LBSAR3_AM_EXT_SUP_ASCENDING VME_AM_EXT_SUP_ASCENDING << 16 +#define LBSAR3_AM_EXT_SUP_PGM VME_AM_EXT_SUP_PGM << 16 +#define LBSAR3_AM_EXT_SUP_DATA VME_AM_EXT_SUP_DATA << 16 +#define LBSAR3_AM_EXT_USR_ASCENDING VME_AM_EXT_USR_ASCENDING << 16 +#define LBSAR3_AM_EXT_USR_PGM VME_AM_EXT_USR_PGM << 16 +#define LBSAR3_AM_EXT_USR_DATA VME_AM_EXT_USR_DATA << 16 + +#define LBSAR2_D16 (1 << 15) /* D16 data transfers 15 */ +#define LBSAR2_D32 0x00 /* D32 data transfers 15 */ +#define LBSAR2_WP_ENABLE (1 << 14) /* Write posting enabled 14 */ +#define LBSAR2_WP_DISABLE 0x00 /* Write posting disabled 14 */ +/* The following are for the Address Modifier equates 13-8 */ +#define LBSAR2_AM_STD_SUP_ASCENDING VME_AM_STD_SUP_ASCENDING << 8 +#define LBSAR2_AM_STD_SUP_PGM VME_AM_STD_SUP_PGM << 8 +#define LBSAR2_AM_STD_SUP_DATA VME_AM_STD_SUP_DATA << 8 +#define LBSAR2_AM_STD_USR_ASCENDING VME_AM_STD_USR_ASCENDING << 8 +#define LBSAR2_AM_STD_USR_PGM VME_AM_STD_USR_PGM << 8 +#define LBSAR2_AM_STD_USR_DATA VME_AM_STD_USR_DATA << 8 +#define LBSAR2_AM_SUP_SHORT_IO VME_AM_SUP_SHORT_IO << 8 +#define LBSAR2_AM_USR_SHORT_IO VME_AM_USR_SHORT_IO << 8 +#define LBSAR2_AM_EXT_SUP_ASCENDING VME_AM_EXT_SUP_ASCENDING << 8 +#define LBSAR2_AM_EXT_SUP_PGM VME_AM_EXT_SUP_PGM << 8 +#define LBSAR2_AM_EXT_SUP_DATA VME_AM_EXT_SUP_DATA << 8 +#define LBSAR2_AM_EXT_USR_ASCENDING VME_AM_EXT_USR_ASCENDING << 8 +#define LBSAR2_AM_EXT_USR_PGM VME_AM_EXT_USR_PGM << 8 +#define LBSAR2_AM_EXT_USR_DATA VME_AM_EXT_USR_DATA << 8 + +#define LBSAR1_D16 (1 << 7) /* D16 data transfers 7 */ +#define LBSAR1_D32 0x00 /* D32 data transfers 7 */ +#define LBSAR1_WP_ENABLE (1 << 6) /* Write posting enabled 6 */ +#define LBSAR1_WP_DISABLE 0x00 /* Write posting disabled 6 */ +/* The following are for the Address Modifier equates 5-0 */ +#define LBSAR1_AM_STD_SUP_ASCENDING VME_AM_STD_SUP_ASCENDING +#define LBSAR1_AM_STD_SUP_PGM VME_AM_STD_SUP_PGM +#define LBSAR1_AM_STD_SUP_DATA VME_AM_STD_SUP_DATA +#define LBSAR1_AM_STD_USR_ASCENDING VME_AM_STD_USR_ASCENDING +#define LBSAR1_AM_STD_USR_PGM VME_AM_STD_USR_PGM +#define LBSAR1_AM_STD_USR_DATA VME_AM_STD_USR_DATA +#define LBSAR1_AM_SUP_SHORT_IO VME_AM_SUP_SHORT_IO +#define LBSAR1_AM_USR_SHORT_IO VME_AM_USR_SHORT_IO +#define LBSAR1_AM_EXT_SUP_ASCENDING VME_AM_EXT_SUP_ASCENDING +#define LBSAR1_AM_EXT_SUP_PGM VME_AM_EXT_SUP_PGM +#define LBSAR1_AM_EXT_SUP_DATA VME_AM_EXT_SUP_DATA +#define LBSAR1_AM_EXT_USR_ASCENDING VME_AM_EXT_USR_ASCENDING +#define LBSAR1_AM_EXT_USR_PGM VME_AM_EXT_USR_PGM +#define LBSAR1_AM_EXT_USR_DATA VME_AM_EXT_USR_DATA + +/* + * VMEbus Slave GCSR Group Address Reg 0x2c 31-24 + * VMEbus Slave GCSR Board Address Reg 0x2c 23-20 + * Local Bus To VMEbus Enable Control Reg 0x2c 19-16 + * Local Bus to VMEbus I/O Control Reg 0x2c 15-08 + * ROM Control Reg 0x2c 07-00 + */ + +#define LBTVCR_EN4 (1 << 19) /* 4th VMEbus decoder enable 19 */ +#define LBTVCR_EN3 (1 << 18) /* 3rd VMEbus decoder enable 18 */ +#define LBTVCR_EN2 (1 << 17) /* 2nd VMEbus decoder enable 17 */ +#define LBTVCR_EN1 (1 << 16) /* 1st VMEbus decoder enable 16 */ +#define LBTVCR_I2EN (1 << 15) /* Enable F page decoder 15 */ +#define LBTVCR_I2WP (1 << 14) /* Page F Write Post Enable 14 */ +#define LBTVCR_I2SUP (1 << 13) /* Supervisor AM for Page F 13 */ +#define LBTVCR_I2USR 0x00 /* User AM for Page F 13 */ +#define LBTVCR_I2PROG (1 << 12) /* Program AM for Page F 12 */ +#define LBTVCR_I2DATA 0x00 /* Data AM for Page F 12 */ +#define LBTVCR_I1EN (1 << 11) /* Short I/O Enabled 11 */ +#define LBTVCR_I1D16 (1 << 10) /* D16 data for Short I/O 10 */ +#define LBTVCR_I1D32 0x00 /* D32 data for Short I/O 10 */ +#define LBTVCR_I1WP (1 << 9) /* Write Post for Short I/O 9 */ +#define LBTVCR_I1SUP (1 << 8) /* Supvisor AM for Short I/O 8 */ +#define LBTVCR_I1USR 0x00 /* User AM for Short I/O 8 */ +#define LBTVCR_8MBIT 0x00 /* 8 MBit Chips 7-6 */ +#define LBTVCR_4MBIT (1 << 6) /* 4 MBit Chips 7-6 */ +#define LBTVCR_2MBIT (2 << 6) /* 2 MBit Chips 7-6 */ +#define LBTVCR_1MBIT (3 << 6) /* 1 MBit Chips 7-6 */ + +/* B ROMs SPEED DEFINED FOR 25MHz BUS CLOCK */ +#define LBTVCR_B365NS 0x00 /* 365 ns B EPROM Access 5-3 */ +#define LBTVCR_B325NS (1 << 3) /* 325 ns B EPROM Access 5-3 */ +#define LBTVCR_B285NS (2 << 3) /* 285 ns B EPROM Access 5-3 */ +#define LBTVCR_B245NS (3 << 3) /* 245 ns B EPROM Access 5-3 */ +#define LBTVCR_B205NS (4 << 3) /* 205 ns B EPROM Access 5-3 */ +#define LBTVCR_B165NS (5 << 3) /* 165 ns B EPROM Access 5-3 */ +#define LBTVCR_B125NS (6 << 3) /* 125 ns B EPROM Access 5-3 */ +#define LBTVCR_B85NS (7 << 3) /* 85 ns B EPROM Access 5-3 */ + +/* A ROMs SPEED DEFINED FOR 25MHz BUS CLOCK */ +#define LBTVCR_A365NS 0x00 /* 365 ns A EPROM Access 2-0 */ +#define LBTVCR_A325NS 0x01 /* 325 ns A EPROM Access 2-0 */ +#define LBTVCR_A285NS 0x02 /* 285 ns A EPROM Access 2-0 */ +#define LBTVCR_A245NS 0x03 /* 245 ns A EPROM Access 2-0 */ +#define LBTVCR_A205NS 0x04 /* 205 ns A EPROM Access 2-0 */ +#define LBTVCR_A165NS 0x05 /* 165 ns A EPROM Access 2-0 */ +#define LBTVCR_A125NS 0x06 /* 125 ns A EPROM Access 2-0 */ +#define LBTVCR_A85NS 0x07 /* 85 ns A EPROM Access 2-0 */ + +/* + * EPROM Decoder, SRAM and DMA Control Register 0x30 23-16 + * Local Bus To VMEbus Requester Control Reg 0x30 15-08 + * DMAC Control Register 1 0x30 07-00 + */ + +#define DMACR1_ROM0_ON (1 << 20) /* Map EPROM to $00000000 20 */ +#define DMACR1_ROM0_OFF 0x00 /* No Map EPROM to $00000000 20 */ +#define DMACR1_SNOOP_INHIBIT 0x00 /* Snoop Inhibited 19-18 */ +#define DMACR1_SINK_DATA (1 << 18) /* Sink Data 19-18 */ +#define DMACR1_INVALIDATE (2 << 18) /* Invalidate 19-18 */ +#define DMACR1_165NS 0x00 /* 165 ns SRAM Access Time 17-16 */ +#define DMACR1_125NS (1 << 16) /* 125 ns SRAM Access Time 17-16 */ +#define DMACR1_85NS (2 << 16) /* 85 ns SRAM Access Time 17-16 */ +#define DMACR1_45NS (3 << 16) /* 45 ns SRAM Access Time 17-16 */ +#define DMACR1_ROBIN (1 << 15) /* Arbiter in Round Robin 15 */ +#define DMACR1_PRIORITY 0x00 /* Arbiter in Priority 15 */ +#define DMACR1_DHB (1 << 14) /* VMEbus acquired from DWB 14 */ +#define DMACR1_DWB (1 << 13) /* VMEbus held 13 */ +#define DMACR1_LVFAIR (1 << 11) /* Requester in fair mode 11 */ +#define DMACR1_LVRWD (1 << 10) /* Release When Done 10 */ +#define DMACR1_LVROR 0x00 /* Relase On Request 10 */ +#define DMACR1_LVREQ_L0 0x00 /* Request Level 0 9-8 */ +#define DMACR1_LVREQ_L1 (1 << 8) /* Request Level 1 9-8 */ +#define DMACR1_LVREQ_L2 (2 << 8) /* Request Level 2 9-8 */ +#define DMACR1_LVREQ_L3 (3 << 8) /* Request Level 3 9-8 */ +#define DMACR1_DHALT (1 << 7) /* Halt at end of Command 7 */ +#define DMACR1_DEN (1 << 6) /* DMAC enabled 6 */ +#define DMACR1_DTBL (1 << 5) /* Command chaining mode 5 */ +#define DMACR1_DFAIR (1 << 4) /* Operates in fair mode 4 */ +#define DMACR1_TIMER_BRX 0x00 /* Release with Timer & BRx 3-2 */ +#define DMACR1_TIMER (1 << 2) /* Release with Timer 3-2 */ +#define DMACR1_BRX (2 << 2) /* Release with BRx 3-2 */ +#define DMACR1_TIMER_OR_BRX (3 << 2) /* Release with Timer or BRx 3-2 */ +#define DMACR1_DREQ_L0 0x00 /* VMEbus request Level 0 1-0 */ +#define DMACR1_DREQ_L1 0x01 /* VMEbus request Level 1 1-0 */ +#define DMACR1_DREQ_L2 0x02 /* VMEbus request Level 2 1-0 */ +#define DMACR1_DREQ_L3 0x03 /* VMEbus request Level 3 1-0 */ + +/* + * DMAC Control Register 2 0x34 15-08 + * DMAC Control Register 2 0x34 07-00 + */ + +#define DMACR2_INTE (1 << 15) /* Interrupt Enabel 15 */ +#define DMACR2_SNOOP_INHIBIT 0x00 /* Snoop Inhibited 14-13 */ +#define DMACR2_SINK_DATA (1 << 13) /* Sink Data 14-13 */ +#define DMACR2_INVALIDATE (2 << 13) /* Invalidate 14-13 */ +#define DMACR2_VINC (1 << 11) /* Increment Address on DMA 11 */ +#define DMACR2_LINC (1 << 10) /* Increment Local Addr DMA 10 */ +#define DMACR2_TO_VME (1 << 9) /* Transfer to VMEbus 9 */ +#define DMACR2_TO_LOCAL 0x00 /* Transfer to Local bus 9 */ +#define DMACR2_D16 (1 << 8) /* D16 on the VMEbus 8 */ +#define DMACR2_D32 0x00 /* D32 on the VMEbus 8 */ +#define DMACR2_NO_BLOCK 0x00 /* Block Transfers Disabled 7-6 */ +#define DMACR2_D32_BLOCK (1 << 6) /* D32 Block Transfer VMEbus 7-6 */ +#define DMACR2_D64_BLOCK (3 << 6) /* D64 Block Transfer VMEbus 7-6 */ +#define DMACR2_AM_STD_SUP_ASCENDING VME_AM_STD_SUP_ASCENDING +#define DMACR2_AM_STD_SUP_PGM VME_AM_STD_SUP_PGM +#define DMACR2_AM_STD_SUP_DATA VME_AM_STD_SUP_DATA +#define DMACR2_AM_STD_USR_ASCENDING VME_AM_STD_USR_ASCENDING +#define DMACR2_AM_STD_USR_PGM VME_AM_STD_USR_PGM +#define DMACR2_AM_STD_USR_DATA VME_AM_STD_USR_DATA +#define DMACR2_AM_SUP_SHORT_IO VME_AM_SUP_SHORT_IO +#define DMACR2_AM_USR_SHORT_IO VME_AM_USR_SHORT_IO +#define DMACR2_AM_EXT_SUP_ASCENDING VME_AM_EXT_SUP_ASCENDING +#define DMACR2_AM_EXT_SUP_PGM VME_AM_EXT_SUP_PGM +#define DMACR2_AM_EXT_SUP_DATA VME_AM_EXT_SUP_DATA +#define DMACR2_AM_EXT_USR_ASCENDING VME_AM_EXT_USR_ASCENDING +#define DMACR2_AM_EXT_USR_PGM VME_AM_EXT_USR_PGM +#define DMACR2_AM_EXT_USR_DATA VME_AM_EXT_USR_DATA + +/* + * VMEbus Interrupter Control Register 0x48 31-24 + * VMEbus Interrupter Vector Register 0x48 23-16 + * MPU Status and DMA Interrupt Count Register 0x48 15-08 + * DMAC Status Register 0x48 07-00 + */ + +#define ICR_IRQ1_INTERRUPTER 0x00 /* Intrptr connected to IRQ1 30-29 */ +#define ICR_IRQ1_TIMER1 (1 << 29) /* Timer 1 connected to IRQ1 30-29 */ +#define ICR_IRQ1_TIMER2 (3 << 29) /* Timer 2 connected to IRQ2 30-29 */ +#define ICR_IRQ_CLEAR (1 << 28) /* Clear VMEbus IRQ 28 */ +#define ICR_IRQ_STATUS (1 << 27) /* IRQ not acknowledged 27 */ +#define ICR_IRQ_L1 (1 << 24) /* Generate VME IRQ level 1 26-24 */ +#define ICR_IRQ_L2 (2 << 24) /* level 2 26-24 */ +#define ICR_IRQ_L3 (3 << 24) /* level 3 26-24 */ +#define ICR_IRQ_L4 (4 << 24) /* level 4 26-24 */ +#define ICR_IRQ_L5 (5 << 24) /* level 5 26-24 */ +#define ICR_IRQ_L6 (6 << 24) /* level 6 26-24 */ +#define ICR_IRQ_L7 (7 << 24) /* level 7 26-24 */ +#define ICR_MCLR (1 << 11) /* Clear MPU status bits 11 */ +#define ICR_MLBE (1 << 10) /* MPU received a TEA 10 */ +#define ICR_MLPE (1 << 9) /* MPU -TEA + Parity error 9 */ +#define ICR_MLOB (1 << 8) /* MPU -TEA + Off board 8 */ +#define ICR_MLTO (1 << 7) /* MPU -TEA + Local Time Out 7 */ +#define ICR_DLBE (1 << 6) /* DMAC received a TEA 6 */ +#define ICR_DLPE (1 << 5) /* DMAC -TEA + Parity Error 5 */ +#define ICR_DLOB (1 << 4) /* DMAC -TEA + Off Board 4 */ +#define ICR_DLTO (1 << 3) /* DMAC -TEA + Locl Time Out 3 */ +#define ICR_TBL (1 << 2) /* DMAC error reading command 2 */ +#define ICR_VME (1 << 1) /* DMAC got VMEbus BERR 1 */ +#define ICR_DONE 1 /* DMAC finished 0 */ + +/* + * VMEbus Arbiter Timeout Control Register 0x4c 31-24 + * DMAC Ton/Toff Timers and VMEbus Global Timeout 0x4c 23-16 + * VME Access, Local Bus and Watchdog Timeout 0x4c 15-08 + * Prescaler Control Register 0x4c 07-00 + */ + +#define TIMEOUTCR_ARBTO (1 << 24) /* Enable Grant Timeout 24 */ +#define TIMEOUTCR_OFF_0US 0x00 /* DMAC off VMEbus for 0us 23-21 */ +#define TIMEOUTCR_OFF_16US (1 << 21) /* 16us 23-21 */ +#define TIMEOUTCR_OFF_32US (2 << 21) /* 32us 23-21 */ +#define TIMEOUTCR_OFF_64US (3 << 21) /* 64us 23-21 */ +#define TIMEOUTCR_OFF_128US (4 << 21) /* 128us 23-21 */ +#define TIMEOUTCR_OFF_256US (5 << 21) /* 256us 23-21 */ +#define TIMEOUTCR_OFF_512US (6 << 21) /* 512us 23-21 */ +#define TIMEOUTCR_OFF_1024US (7 << 21) /* 1024us 23-21 */ +#define TIMEOUTCR_ON_16US 0x00 /* DMAC on VMEbus for 16us 20-18 */ +#define TIMEOUTCR_ON_32US (1 << 18) /* 32us 20-18 */ +#define TIMEOUTCR_ON_64US (2 << 18) /* 64us 20-18 */ +#define TIMEOUTCR_ON_128US (3 << 18) /* 128us 20-18 */ +#define TIMEOUTCR_ON_256US (4 << 18) /* 256us 20-18 */ +#define TIMEOUTCR_ON_512US (5 << 18) /* 512us 20-18 */ +#define TIMEOUTCR_ON_1024US (6 << 18) /* 1024us 20-18 */ +#define TIMEOUTCR_ON_DONE (7 << 18) /* DMAC on VMEbus until done 20-18 */ +#define TIMEOUTCR_VGTO_8US 0x00 /* VMEbus global timeout 8us 17-16 */ +#define TIMEOUTCR_VGTO_64US (1 << 16) /* 16us 17-16 */ +#define TIMEOUTCR_VGTO_256US (2 << 16) /* 256us 17-16 */ +#define TIMEOUTCR_VGTO_DISABLE (3 << 16) /* global timeout disabled 17-16 */ +#define TIMEOUTCR_VATO_64US 0x00 /* VMEbus timeout 64us 15-14 */ +#define TIMEOUTCR_VATO_1MS (1 << 14) /* 1ms 15-14 */ +#define TIMEOUTCR_VATO_32MS (2 << 14) /* 32ms 15-14 */ +#define TIMEOUTCR_VATO_DISABLE (3 << 14) /* access timeout disabled 15-14 */ +#define TIMEOUTCR_LBTO_8US 0x00 /* Local Bus Timeout 8us 13-12 */ +#define TIMEOUTCR_LBTO_64US (1 << 12) /* 64us 13-12 */ +#define TIMEOUTCR_LBTO_256US (2 << 12) /* 256us 13-12 */ +#define TIMEOUTCR_LBTO_DISABLE (3 << 12) /* Local Timeout Disabled 13-12 */ +#define TIMEOUTCR_WDTO_512US 0x00 /* Watchdog Timeout 512us 11-08 */ +#define TIMEOUTCR_WDTO_1MS (1 << 8) /* Watchdog Timeout 1ms 11-08 */ +#define TIMEOUTCR_WDTO_2MS (2 << 8) /* Watchdog Timeout 2ms 11-08 */ +#define TIMEOUTCR_WDTO_4MS (3 << 8) /* Watchdog Timeout 4ms 11-08 */ +#define TIMEOUTCR_WDTO_8MS (4 << 8) /* Watchdog Timeout 8ms 11-08 */ +#define TIMEOUTCR_WDTO_16MS (5 << 8) /* Watchdog Timeout 16ms 11-08 */ +#define TIMEOUTCR_WDTO_32MS (6 << 8) /* Watchdog Timeout 32ms 11-08 */ +#define TIMEOUTCR_WDTO_64MS (7 << 8) /* Watchdog Timeout 64ms 11-08 */ +#define TIMEOUTCR_WDTO_128MS (8 << 8) /* Watchdog Timeout 128ms 11-08 */ +#define TIMEOUTCR_WDTO_256MS (9 << 8) /* Watchdog Timeout 256ms 11-08 */ +#define TIMEOUTCR_WDTO_512MS (10 << 8) /* Watchdog Timeout 512ms 11-08 */ +#define TIMEOUTCR_WDTO_1S (11 << 8) /* Watchdog Timeout 1s 11-08 */ +#define TIMEOUTCR_WDTO_4S (12 << 8) /* Watchdog Timeout 4s 11-08 */ +#define TIMEOUTCR_WDTO_16S (13 << 8) /* Watchdog Timeout 16s 11-08 */ +#define TIMEOUTCR_WDTO_32S (14 << 8) /* Watchdog Timeout 32s 11-08 */ +#define TIMEOUTCR_WDTO_64S (15 << 8) /* Watchdog Timeout 64s 11-08 */ + +/* + * Board Control Register 0x60 31-24 + * Watchdog Timer Control Register 0x60 23-16 + * Tick Timer 2 Control Register 0x60 15-08 + * Tick Timer 1 Control Register 0x60 07-00 + */ + +#define TIMERCR_SCON (1 << 30) /* Board is System Cont 30 */ +#define TIMERCR_SFFL (1 << 29) /* VMEbus SYSFAIL is assertd 29 */ +#define TIMERCR_BRFLI (1 << 28) /* Board Fail is asserted 28 */ +#define TIMERCR_PURS (1 << 27) /* Power-Up Reset 27 */ +#define TIMERCR_CPURS (1 << 26) /* Clear Power-Up Reset 26 */ +#define TIMERCR_BDFLO (1 << 25) /* Assert the BRDFAIL Signal 25 */ +#define TIMERCR_RSWE (1 << 24) /* Enable Reset Switch 24 */ +#define TIMERCR_RSWD 0x00 /* Disable Reset Switch 24 */ +#define TIMERCR_SRST (1 << 23) /* Assert SYSRESET on VMEbus 23 */ +#define TIMERCR_WDCS (1 << 22) /* Clear watchdog timeout 22 */ +#define TIMERCR_WDCC (1 << 21) /* Reset watchdog counter 21 */ +#define TIMERCR_WDTO (1 << 20) /* Watchdog Timeout occurd 20 */ +#define TIMERCR_WDBFE (1 << 19) /* Set Board Fail on WD TO 19 */ +#define TIMERCR_WDSYSRESET (1 << 18) /* Set SYSRESET on WD TO 18 */ +#define TIMERCR_WDLRESET 0x00 /* Set LRESET on WD TO 18 */ +#define TIMERCR_WDRSE (1 << 17) /* RESET on Watchdog Timeout 17 */ +#define TIMERCR_WDEN (1 << 16) /* Enable Watchdog Timeout 16 */ +#define TIMERCR_WDDIS 0x00 /* Disable Watchdog Timeout 16 */ +#define TIMERCR_TT2_COVF (1 << 10) /* Clear Over Flow Counter 10 */ +#define TIMERCR_TT2_COC (1 << 9) /* Clear On Compare 9 */ +#define TIMERCR_TT2_EN (1 << 8) /* Enable Counter 8 */ +#define TIMERCR_TT1_COVF (1 << 2) /* Clear Over Flow Counter 2 */ +#define TIMERCR_TT1_COC (1 << 1) /* Clear On Compare 1 */ +#define TIMERCR_TT1_EN 1 /* Enable Counter 0 */ + +/* Local Bus Interrupter Status Register 0x68 31-00 */ + +#define LBISR_ACF (1 << 31) /* VMEbus ACFAIL Interrupt 31 */ +#define LBISR_AB (1 << 30) /* ABORT Switch Interrupt 30 */ +#define LBISR_SYSF (1 << 29) /* VMEbus SYSFAIL Interrupt 29 */ +#define LBISR_MWP (1 << 28) /* VMEbus master write post 28 */ +#define LBISR_PE (1 << 27) /* External Inter (parity) 27 */ +#define LBISR_VI1E (1 << 26) /* VMEbus IRQ1 edge Intr 26 */ +#define LBISR_TIC2 (1 << 25) /* Tick Timer 2 Interrupt 25 */ +#define LBISR_TIC1 (1 << 24) /* Tick Timer 1 Interrupt 24 */ +#define LBISR_VIA (1 << 23) /* VMEbus Inter Ack Inter 23 */ +#define LBISR_DMA (1 << 22) /* DMAC Interrupt 22 */ +#define LBISR_SIG3 (1 << 21) /* GCSR SIG3 interrupt 21 */ +#define LBISR_SIG2 (1 << 20) /* GCSR SIG2 interrupt 20 */ +#define LBISR_SIG1 (1 << 19) /* GCSR SIG1 interrupt 19 */ +#define LBISR_SIG0 (1 << 18) /* GCSR SIG0 interrupt 18 */ +#define LBISR_LM1 (1 << 17) /* GCSR LM1 interrupt 17 */ +#define LBISR_LM0 (1 << 16) /* GCSR LM0 interrupt 16 */ +#define LBISR_SW7 (1 << 15) /* Software 7 interrupt 15 */ +#define LBISR_SW6 (1 << 14) /* Software 6 interrupt 14 */ +#define LBISR_SW5 (1 << 13) /* Software 5 interrupt 13 */ +#define LBISR_SW4 (1 << 12) /* Software 4 interrupt 12 */ +#define LBISR_SW3 (1 << 11) /* Software 3 interrupt 11 */ +#define LBISR_SW2 (1 << 10) /* Software 2 interrupt 10 */ +#define LBISR_SW1 (1 << 9) /* Software 1 interrupt 9 */ +#define LBISR_SW0 (1 << 8) /* Software 0 interrupt 8 */ +#define LBISR_VME7 (1 << 6) /* VMEbus IRQ7 interrupt 6 */ +#define LBISR_VME6 (1 << 5) /* VMEbus IRQ6 interrupt 5 */ +#define LBISR_VME5 (1 << 4) /* VMEbus IRQ5 interrupt 4 */ +#define LBISR_VME4 (1 << 3) /* VMEbus IRQ4 interrupt 3 */ +#define LBISR_VME3 (1 << 2) /* VMEbus IRQ3 interrupt 2 */ +#define LBISR_VME2 (1 << 1) /* VMEbus IRQ2 interrupt 1 */ +#define LBISR_VME1 1 /* VMEbus IRQ1 interrupt 0 */ + +/* Local Bus Interrupter Enable Register 0x6c 31-00 */ + +#define LBIER_EACF (1 << 31) /* Enable VMEbus ACFAIL IRQ 31 */ +#define LBIER_EAB (1 << 30) /* Enable ABORT switch IRQ 30 */ +#define LBIER_ESYSF (1 << 29) /* Enable VMEbus SYSFAIL IRQ 29 */ +#define LBIER_EMWP (1 << 28) /* Enable VMEbus WPE IRQ 28 */ +#define LBIER_EPE (1 << 27) /* Enable Parity Error IRQ 27 */ +#define LBIER_EVI1E (1 << 26) /* Enable VMEbus IRQ1 IRQ 26 */ +#define LBIER_ETIC2 (1 << 25) /* Enable Tick Timer 2 IRQ 25 */ +#define LBIER_ETIC1 (1 << 24) /* Enable Tick Timer 1 IRQ 24 */ + +#define LBIER_EVIA (1 << 23) /* Enable VME Intptr Ack IRQ 23 */ +#define LBIER_EDMA (1 << 22) /* Enable DMAC IRQ 22 */ +#define LBIER_ESIG3 (1 << 21) /* Enable GCSR SIG3 IRQ 21 */ +#define LBIER_ESIG2 (1 << 20) /* Enable GCSR SIG2 IRQ 20 */ +#define LBIER_ESIG1 (1 << 19) /* Enable GCSR SIG1 IRQ 19 */ +#define LBIER_ESIG0 (1 << 18) /* Enable GCSR SIG0 IRQ 18 */ +#define LBIER_ELM1 (1 << 17) /* Enable GCSR LM1 IRQ 17 */ +#define LBIER_ELM0 (1 << 16) /* Enable GCSR LM0 IRQ 16 */ + +#define LBIER_ESW7 (1 << 15) /* Enable Software 7 Inter 15 */ +#define LBIER_ESW6 (1 << 14) /* Enable Software 6 Inter 14 */ +#define LBIER_ESW5 (1 << 13) /* Enable Software 5 Inter 13 */ +#define LBIER_ESW4 (1 << 12) /* Enable Software 4 Inter 12 */ +#define LBIER_ESW3 (1 << 11) /* Enable Software 3 Inter 11 */ +#define LBIER_ESW2 (1 << 10) /* Enable Software 2 Inter 10 */ +#define LBIER_ESW1 (1 << 9) /* Enable Software 1 Inter 9 */ +#define LBIER_ESW0 (1 << 8) /* Enable Software 0 Inter 8 */ + +#define LBIER_EIRQ7 (1 << 6) /* Enable VMEbus IRQ7 Inter 6 */ +#define LBIER_EIRQ6 (1 << 5) /* Enable VMEbus IRQ6 Inter 5 */ +#define LBIER_EIRQ5 (1 << 4) /* Enable VMEbus IRQ5 Inter 4 */ +#define LBIER_EIRQ4 (1 << 3) /* Enable VMEbus IRQ4 Inter 3 */ +#define LBIER_EIRQ3 (1 << 2) /* Enable VMEbus IRQ3 Inter 2 */ +#define LBIER_EIRQ2 (1 << 1) /* Enable VMEbus IRQ2 Inter 1 */ +#define LBIER_EIRQ1 1 /* Enable VMEbus IRQ1 Inter 0 */ + +/* Software Interrupt Set Register 0x70 15-08 */ + +#define SISR_SSW7 (1 << 15) /* Set Software 7 Interrupt 15 */ +#define SISR_SSW6 (1 << 14) /* Set Software 6 Interrupt 14 */ +#define SISR_SSW5 (1 << 13) /* Set Software 5 Interrupt 13 */ +#define SISR_SSW4 (1 << 12) /* Set Software 4 Interrupt 12 */ +#define SISR_SSW3 (1 << 11) /* Set Software 3 Interrupt 11 */ +#define SISR_SSW2 (1 << 10) /* Set Software 2 Interrupt 10 */ +#define SISR_SSW1 (1 << 9) /* Set Software 1 Interrupt 9 */ +#define SISR_SSW0 (1 << 8) /* Set Software 0 Interrupt 8 */ + +/* Interrupt Clear Register 0x74 31-08 */ + +#define ICLR_CACF (1 << 31) /* Clr VMEbus ACFAIL Inter 31 */ +#define ICLR_CAB (1 << 30) /* Clr ABORT Switch Inter 30 */ +#define ICLR_CSYSF (1 << 29) /* Clr VMEbus SYSFAIL Inter 29 */ +#define ICLR_CMWP (1 << 28) /* Clr VME Master Write Post 28 */ +#define ICLR_CPE (1 << 27) /* Clr Ext Inter (PARITY) 27 */ +#define ICLR_CVI1E (1 << 26) /* Clr VME IRQ1 Edge Inter 26 */ +#define ICLR_CTIC2 (1 << 25) /* Clr Tick Timer 2 Inter 25 */ +#define ICLR_CTIC1 (1 << 24) /* Clr Tick Timer 1 Inter 24 */ + +#define ICLR_CVIA (1 << 23) /* Clr VMEbus Interrupt Ack 23 */ +#define ICLR_CDMA (1 << 22) /* Clr DMA Controller Inter 22 */ +#define ICLR_CSIG3 (1 << 21) /* Clr GCSR SIG3 Interrupt 21 */ +#define ICLR_CSIG2 (1 << 20) /* Clr GCSR SIG2 Interrupt 20 */ +#define ICLR_CSIG1 (1 << 19) /* Clr GCSR SIG1 Interrupt 19 */ +#define ICLR_CSIG0 (1 << 18) /* Clr GCSR SIG0 Interrupt 18 */ +#define ICLR_CLM1 (1 << 17) /* Clr GCSR LM1 Interrupt 17 */ +#define ICLR_CLM0 (1 << 16) /* Clr GCSR LM0 Interrupt 16 */ + +#define ICLR_CSW7 (1 << 15) /* Clr Software 7 Interrupt 15 */ +#define ICLR_CSW6 (1 << 14) /* Clr Software 6 Interrupt 14 */ +#define ICLR_CSW5 (1 << 13) /* Clr Software 5 Interrupt 13 */ +#define ICLR_CSW4 (1 << 12) /* Clr Software 4 Interrupt 12 */ +#define ICLR_CSW3 (1 << 11) /* Clr Software 3 Interrupt 11 */ +#define ICLR_CSW2 (1 << 10) /* Clr Software 2 Interrupt 10 */ +#define ICLR_CSW1 (1 << 9) /* Clr Software 1 Interrupt 9 */ +#define ICLR_CSW0 (1 << 8) /* Clr Software 0 Interrupt 8 */ + +/* Interrupt Level Register 1 0x78 31-00 */ + +#define ILR1_ACF_LEVEL1 (1 << 28) /* ACFAIL Inter on Level 1 30-28 */ +#define ILR1_ACF_LEVEL2 (2 << 28) /* ACFAIL Inter on Level 2 30-28 */ +#define ILR1_ACF_LEVEL3 (3 << 28) /* ACFAIL Inter on Level 3 30-28 */ +#define ILR1_ACF_LEVEL4 (4 << 28) /* ACFAIL Inter on Level 4 30-28 */ +#define ILR1_ACF_LEVEL5 (5 << 28) /* ACFAIL Inter on Level 5 30-28 */ +#define ILR1_ACF_LEVEL6 (6 << 28) /* ACFAIL Inter on Level 6 30-28 */ +#define ILR1_ACF_LEVEL7 (7 << 28) /* ACFAIL Inter on Level 7 30-28 */ + +#define ILR1_AB_LEVEL1 (1 << 24) /* ABORT Inter on Level 1 26-24 */ +#define ILR1_AB_LEVEL2 (2 << 24) /* ABORT Inter on Level 2 26-24 */ +#define ILR1_AB_LEVEL3 (3 << 24) /* ABORT Inter on Level 3 26-24 */ +#define ILR1_AB_LEVEL4 (4 << 24) /* ABORT Inter on Level 4 26-24 */ +#define ILR1_AB_LEVEL5 (5 << 24) /* ABORT Inter on Level 5 26-24 */ +#define ILR1_AB_LEVEL6 (6 << 24) /* ABORT Inter on Level 6 26-24 */ +#define ILR1_AB_LEVEL7 (7 << 24) /* ABORT Inter on Level 7 26-24 */ + +#define ILR1_SYSF_LEVEL1 (1 << 20) /* SYSFAIL Inter on Lvl 1 22-20 */ +#define ILR1_SYSF_LEVEL2 (2 << 20) /* SYSFAIL Inter on Lvl 2 22-20 */ +#define ILR1_SYSF_LEVEL3 (3 << 20) /* SYSFAIL Inter on Lvl 3 22-20 */ +#define ILR1_SYSF_LEVEL4 (4 << 20) /* SYSFAIL Inter on Lvl 4 22-20 */ +#define ILR1_SYSF_LEVEL5 (5 << 20) /* SYSFAIL Inter on Lvl 5 22-20 */ +#define ILR1_SYSF_LEVEL6 (6 << 20) /* SYSFAIL Inter on Lvl 6 22-20 */ +#define ILR1_SYSF_LEVEL7 (7 << 20) /* SYSFAIL Inter on Lvl 7 22-20 */ + +#define ILR1_WPE_LEVEL1 (1 << 16) /* Master Write Post Lvl 1 18-16 */ +#define ILR1_WPE_LEVEL2 (2 << 16) /* Master Write Post Lvl 2 18-16 */ +#define ILR1_WPE_LEVEL3 (3 << 16) /* Master Write Post Lvl 3 18-16 */ +#define ILR1_WPE_LEVEL4 (4 << 16) /* Master Write Post Lvl 4 18-16 */ +#define ILR1_WPE_LEVEL5 (5 << 16) /* Master Write Post Lvl 5 18-16 */ +#define ILR1_WPE_LEVEL6 (6 << 16) /* Master Write Post Lvl 6 18-16 */ +#define ILR1_WPE_LEVEL7 (7 << 16) /* Master Write Post Lvl 7 18-16 */ + +#define ILR1_PE_LEVEL1 (1 << 12) /* Parity Error on Level 1 14-12 */ +#define ILR1_PE_LEVEL2 (2 << 12) /* Parity Error on Level 2 14-12 */ +#define ILR1_PE_LEVEL3 (3 << 12) /* Parity Error on Level 3 14-12 */ +#define ILR1_PE_LEVEL4 (4 << 12) /* Parity Error on Level 4 14-12 */ +#define ILR1_PE_LEVEL5 (5 << 12) /* Parity Error on Level 5 14-12 */ +#define ILR1_PE_LEVEL6 (6 << 12) /* Parity Error on Level 6 14-12 */ +#define ILR1_PE_LEVEL7 (7 << 12) /* Parity Error on Level 7 14-12 */ + +#define ILR1_IRQ1E_LEVEL1 (1 << 8) /* VMEbus IRQ1 edge on Lvl 1 10-8 */ +#define ILR1_IRQ1E_LEVEL2 (2 << 8) /* VMEbus IRQ1 edge on Lvl 2 10-8 */ +#define ILR1_IRQ1E_LEVEL3 (3 << 8) /* VMEbus IRQ1 edge on Lvl 3 10-8 */ +#define ILR1_IRQ1E_LEVEL4 (4 << 8) /* VMEbus IRQ1 edge on Lvl 4 10-8 */ +#define ILR1_IRQ1E_LEVEL5 (5 << 8) /* VMEbus IRQ1 edge on Lvl 5 10-8 */ +#define ILR1_IRQ1E_LEVEL6 (6 << 8) /* VMEbus IRQ1 edge on Lvl 6 10-8 */ +#define ILR1_IRQ1E_LEVEL7 (7 << 8) /* VMEbus IRQ1 edge on Lvl 7 10-8 */ + +#define ILR1_TICK2_LEVEL1 (1 << 4) /* Tick Timer 2 Inter Lvl 1 6-4 */ +#define ILR1_TICK2_LEVEL2 (2 << 4) /* Tick Timer 2 Inter Lvl 2 6-4 */ +#define ILR1_TICK2_LEVEL3 (3 << 4) /* Tick Timer 2 Inter Lvl 3 6-4 */ +#define ILR1_TICK2_LEVEL4 (4 << 4) /* Tick Timer 2 Inter Lvl 4 6-4 */ +#define ILR1_TICK2_LEVEL5 (5 << 4) /* Tick Timer 2 Inter Lvl 5 6-4 */ +#define ILR1_TICK2_LEVEL6 (6 << 4) /* Tick Timer 2 Inter Lvl 6 6-4 */ +#define ILR1_TICK2_LEVEL7 (7 << 4) /* Tick Timer 2 Inter Lvl 7 6-4 */ + +#define ILR1_TICK1_LEVEL1 1 /* Tick Timer 1 Inter Lvl 1 6-4 */ +#define ILR1_TICK1_LEVEL2 2 /* Tick Timer 1 Inter Lvl 2 6-4 */ +#define ILR1_TICK1_LEVEL3 3 /* Tick Timer 1 Inter Lvl 3 6-4 */ +#define ILR1_TICK1_LEVEL4 4 /* Tick Timer 1 Inter Lvl 4 6-4 */ +#define ILR1_TICK1_LEVEL5 5 /* Tick Timer 1 Inter Lvl 5 6-4 */ +#define ILR1_TICK1_LEVEL6 6 /* Tick Timer 1 Inter Lvl 6 6-4 */ +#define ILR1_TICK1_LEVEL7 7 /* Tick Timer 1 Inter Lvl 7 6-4 */ + +/* Interrupt Level Register 2 0x7c 31-00 */ + +#define ILR2_VIA_LEVEL1 (1 << 28) /* VMEbus Intrptr Ack Lvl 1 30-28 */ +#define ILR2_VIA_LEVEL2 (2 << 28) /* VMEbus Intrptr Ack Lvl 2 30-28 */ +#define ILR2_VIA_LEVEL3 (3 << 28) /* VMEbus Intrptr Ack Lvl 3 30-28 */ +#define ILR2_VIA_LEVEL4 (4 << 28) /* VMEbus Intrptr Ack Lvl 4 30-28 */ +#define ILR2_VIA_LEVEL5 (5 << 28) /* VMEbus Intrptr Ack Lvl 5 30-28 */ +#define ILR2_VIA_LEVEL6 (6 << 28) /* VMEbus Intrptr Ack Lvl 6 30-28 */ +#define ILR2_VIA_LEVEL7 (7 << 28) /* VMEbus Intrptr Ack Lvl 7 30-28 */ + +#define ILR2_DMA_LEVEL1 (1 << 24) /* DMA Controller Int Lvl 1 26-24 */ +#define ILR2_DMA_LEVEL2 (2 << 24) /* DMA Controller Int Lvl 2 26-24 */ +#define ILR2_DMA_LEVEL3 (3 << 24) /* DMA Controller Int Lvl 3 26-24 */ +#define ILR2_DMA_LEVEL4 (4 << 24) /* DMA Controller Int Lvl 4 26-24 */ +#define ILR2_DMA_LEVEL5 (5 << 24) /* DMA Controller Int Lvl 5 26-24 */ +#define ILR2_DMA_LEVEL6 (6 << 24) /* DMA Controller Int Lvl 6 26-24 */ +#define ILR2_DMA_LEVEL7 (7 << 24) /* DMA Controller Int Lvl 7 26-24 */ + +#define ILR2_SIG3_LEVEL1 (1 << 20) /* GCSR SIG3 Int on Level 1 22-20 */ +#define ILR2_SIG3_LEVEL2 (2 << 20) /* GCSR SIG3 Int on Level 2 22-20 */ +#define ILR2_SIG3_LEVEL3 (3 << 20) /* GCSR SIG3 Int on Level 3 22-20 */ +#define ILR2_SIG3_LEVEL4 (4 << 20) /* GCSR SIG3 Int on Level 4 22-20 */ +#define ILR2_SIG3_LEVEL5 (5 << 20) /* GCSR SIG3 Int on Level 5 22-20 */ +#define ILR2_SIG3_LEVEL6 (6 << 20) /* GCSR SIG3 Int on Level 6 22-20 */ +#define ILR2_SIG3_LEVEL7 (7 << 20) /* GCSR SIG3 Int on Level 7 22-20 */ + +#define ILR2_SIG2_LEVEL1 (1 << 16) /* GCSR SIG2 Int on Level 1 18-16 */ +#define ILR2_SIG2_LEVEL2 (2 << 16) /* GCSR SIG2 Int on Level 2 18-16 */ +#define ILR2_SIG2_LEVEL3 (3 << 16) /* GCSR SIG2 Int on Level 3 18-16 */ +#define ILR2_SIG2_LEVEL4 (4 << 16) /* GCSR SIG2 Int on Level 4 18-16 */ +#define ILR2_SIG2_LEVEL5 (5 << 16) /* GCSR SIG2 Int on Level 5 18-16 */ +#define ILR2_SIG2_LEVEL6 (6 << 16) /* GCSR SIG2 Int on Level 6 18-16 */ +#define ILR2_SIG2_LEVEL7 (7 << 16) /* GCSR SIG2 Int on Level 7 18-16 */ + +#define ILR2_SIG1_LEVEL1 (1 << 12) /* GCSR SIG1 Int on Level 1 14-12 */ +#define ILR2_SIG1_LEVEL2 (2 << 12) /* GCSR SIG1 Int on Level 2 14-12 */ +#define ILR2_SIG1_LEVEL3 (3 << 12) /* GCSR SIG1 Int on Level 3 14-12 */ +#define ILR2_SIG1_LEVEL4 (4 << 12) /* GCSR SIG1 Int on Level 4 14-12 */ +#define ILR2_SIG1_LEVEL5 (5 << 12) /* GCSR SIG1 Int on Level 5 14-12 */ +#define ILR2_SIG1_LEVEL6 (6 << 12) /* GCSR SIG1 Int on Level 6 14-12 */ +#define ILR2_SIG1_LEVEL7 (7 << 12) /* GCSR SIG1 Int on Level 7 14-12 */ + +#define ILR2_SIG0_LEVEL1 (1 << 8) /* GCSR SIG0 Int on Level 1 10-8 */ +#define ILR2_SIG0_LEVEL2 (2 << 8) /* GCSR SIG0 Int on Level 2 10-8 */ +#define ILR2_SIG0_LEVEL3 (3 << 8) /* GCSR SIG0 Int on Level 3 10-8 */ +#define ILR2_SIG0_LEVEL4 (4 << 8) /* GCSR SIG0 Int on Level 4 10-8 */ +#define ILR2_SIG0_LEVEL5 (5 << 8) /* GCSR SIG0 Int on Level 5 10-8 */ +#define ILR2_SIG0_LEVEL6 (6 << 8) /* GCSR SIG0 Int on Level 6 10-8 */ +#define ILR2_SIG0_LEVEL7 (7 << 8) /* GCSR SIG0 Int on Level 7 10-8 */ + +#define ILR2_LM1_LEVEL1 (1 << 4) /* GCSR LM1 Int on Level 1 6-4 */ +#define ILR2_LM1_LEVEL2 (2 << 4) /* GCSR LM1 Int on Level 2 6-4 */ +#define ILR2_LM1_LEVEL3 (3 << 4) /* GCSR LM1 Int on Level 3 6-4 */ +#define ILR2_LM1_LEVEL4 (4 << 4) /* GCSR LM1 Int on Level 4 6-4 */ +#define ILR2_LM1_LEVEL5 (5 << 4) /* GCSR LM1 Int on Level 5 6-4 */ +#define ILR2_LM1_LEVEL6 (6 << 4) /* GCSR LM1 Int on Level 6 6-4 */ +#define ILR2_LM1_LEVEL7 (7 << 4) /* GCSR LM1 Int on Level 7 6-4 */ + +#define ILR2_LM0_LEVEL1 1 /* GCSR LM0 Int on Level 1 2-0 */ +#define ILR2_LM0_LEVEL2 2 /* GCSR LM0 Int on Level 2 2-0 */ +#define ILR2_LM0_LEVEL3 3 /* GCSR LM0 Int on Level 3 2-0 */ +#define ILR2_LM0_LEVEL4 4 /* GCSR LM0 Int on Level 4 2-0 */ +#define ILR2_LM0_LEVEL5 5 /* GCSR LM0 Int on Level 5 2-0 */ +#define ILR2_LM0_LEVEL6 6 /* GCSR LM0 Int on Level 6 2-0 */ +#define ILR2_LM0_LEVEL7 7 /* GCSR LM0 Int on Level 7 2-0 */ + +/* Interrupt Level Register 3 0x80 31-00 */ + +#define ILR3_SW7_LEVEL7 (7 << 28) /* Software Inter 7 on Lvl 7 30-28 */ +#define ILR3_SW7_LEVEL7 (7 << 28) /* Software Inter 7 on Lvl 7 30-28 */ +#define ILR3_SW7_LEVEL7 (7 << 28) /* Software Inter 7 on Lvl 7 30-28 */ +#define ILR3_SW7_LEVEL7 (7 << 28) /* Software Inter 7 on Lvl 7 30-28 */ +#define ILR3_SW7_LEVEL7 (7 << 28) /* Software Inter 7 on Lvl 7 30-28 */ +#define ILR3_SW7_LEVEL7 (7 << 28) /* Software Inter 7 on Lvl 7 30-28 */ +#define ILR3_SW7_LEVEL7 (7 << 28) /* Software Inter 7 on Lvl 7 30-28 */ + +#define ILR3_SW6_LEVEL1 (1 << 24) /* Software Inter 6 on Lvl 1 26-24 */ +#define ILR3_SW6_LEVEL2 (2 << 24) /* Software Inter 6 on Lvl 2 26-24 */ +#define ILR3_SW6_LEVEL3 (3 << 24) /* Software Inter 6 on Lvl 3 26-24 */ +#define ILR3_SW6_LEVEL4 (4 << 24) /* Software Inter 6 on Lvl 4 26-24 */ +#define ILR3_SW6_LEVEL5 (5 << 24) /* Software Inter 6 on Lvl 5 26-24 */ +#define ILR3_SW6_LEVEL6 (6 << 24) /* Software Inter 6 on Lvl 6 26-24 */ +#define ILR3_SW6_LEVEL7 (7 << 24) /* Software Inter 6 on Lvl 7 26-24 */ + +#define ILR3_SW5_LEVEL1 (1 << 20) /* Software Inter 5 on Lvl 1 22-20 */ +#define ILR3_SW5_LEVEL2 (2 << 20) /* Software Inter 5 on Lvl 2 22-20 */ +#define ILR3_SW5_LEVEL3 (3 << 20) /* Software Inter 5 on Lvl 3 22-20 */ +#define ILR3_SW5_LEVEL4 (4 << 20) /* Software Inter 5 on Lvl 4 22-20 */ +#define ILR3_SW5_LEVEL5 (5 << 20) /* Software Inter 5 on Lvl 5 22-20 */ +#define ILR3_SW5_LEVEL6 (6 << 20) /* Software Inter 5 on Lvl 6 22-20 */ +#define ILR3_SW5_LEVEL7 (7 << 20) /* Software Inter 5 on Lvl 7 22-20 */ + +#define ILR3_SW4_LEVEL1 (1 << 16) /* Software Inter 4 on Lvl 1 18-16 */ +#define ILR3_SW4_LEVEL2 (2 << 16) /* Software Inter 4 on Lvl 2 18-16 */ +#define ILR3_SW4_LEVEL3 (3 << 16) /* Software Inter 4 on Lvl 3 18-16 */ +#define ILR3_SW4_LEVEL4 (4 << 16) /* Software Inter 4 on Lvl 4 18-16 */ +#define ILR3_SW4_LEVEL5 (5 << 16) /* Software Inter 4 on Lvl 5 18-16 */ +#define ILR3_SW4_LEVEL6 (6 << 16) /* Software Inter 4 on Lvl 6 18-16 */ +#define ILR3_SW4_LEVEL7 (7 << 16) /* Software Inter 4 on Lvl 7 18-16 */ + +#define ILR3_SW3_LEVEL1 (1 << 12) /* Software Inter 3 on Lvl 1 14-12 */ +#define ILR3_SW3_LEVEL2 (2 << 12) /* Software Inter 3 on Lvl 2 14-12 */ +#define ILR3_SW3_LEVEL3 (3 << 12) /* Software Inter 3 on Lvl 3 14-12 */ +#define ILR3_SW3_LEVEL4 (4 << 12) /* Software Inter 3 on Lvl 4 14-12 */ +#define ILR3_SW3_LEVEL5 (5 << 12) /* Software Inter 3 on Lvl 5 14-12 */ +#define ILR3_SW3_LEVEL6 (6 << 12) /* Software Inter 3 on Lvl 6 14-12 */ +#define ILR3_SW3_LEVEL7 (7 << 12) /* Software Inter 3 on Lvl 7 14-12 */ + +#define ILR3_SW2_LEVEL1 (1 << 8) /* Software Inter 2 on Lvl 1 10-8 */ +#define ILR3_SW2_LEVEL2 (2 << 8) /* Software Inter 2 on Lvl 2 10-8 */ +#define ILR3_SW2_LEVEL3 (3 << 8) /* Software Inter 2 on Lvl 3 10-8 */ +#define ILR3_SW2_LEVEL4 (4 << 8) /* Software Inter 2 on Lvl 4 10-8 */ +#define ILR3_SW2_LEVEL5 (5 << 8) /* Software Inter 2 on Lvl 5 10-8 */ +#define ILR3_SW2_LEVEL6 (6 << 8) /* Software Inter 2 on Lvl 6 10-8 */ +#define ILR3_SW2_LEVEL7 (7 << 8) /* Software Inter 2 on Lvl 7 10-8 */ + +#define ILR3_SW1_LEVEL1 (1 << 4) /* Software Inter 1 on Lvl 1 6-4 */ +#define ILR3_SW1_LEVEL2 (2 << 4) /* Software Inter 1 on Lvl 2 6-4 */ +#define ILR3_SW1_LEVEL3 (3 << 4) /* Software Inter 1 on Lvl 3 6-4 */ +#define ILR3_SW1_LEVEL4 (4 << 4) /* Software Inter 1 on Lvl 4 6-4 */ +#define ILR3_SW1_LEVEL5 (5 << 4) /* Software Inter 1 on Lvl 5 6-4 */ +#define ILR3_SW1_LEVEL6 (6 << 4) /* Software Inter 1 on Lvl 6 6-4 */ +#define ILR3_SW1_LEVEL7 (7 << 4) /* Software Inter 1 on Lvl 7 6-4 */ + +#define ILR3_SW0_LEVEL1 1 /* Software Inter 0 on Lvl 1 2-0 */ +#define ILR3_SW0_LEVEL2 2 /* Software Inter 0 on Lvl 2 2-0 */ +#define ILR3_SW0_LEVEL3 3 /* Software Inter 0 on Lvl 3 2-0 */ +#define ILR3_SW0_LEVEL4 4 /* Software Inter 0 on Lvl 4 2-0 */ +#define ILR3_SW0_LEVEL5 5 /* Software Inter 0 on Lvl 5 2-0 */ +#define ILR3_SW0_LEVEL6 6 /* Software Inter 0 on Lvl 6 2-0 */ +#define ILR3_SW0_LEVEL7 7 /* Software Inter 0 on Lvl 7 2-0 */ + +/* Interrupt Level Register 4 0x84 31-00 */ + +#define ILR4_VIRQ7_LEVEL1 (1 << 24) /* VMEbus IRQ7 on Level 1 26-24 */ +#define ILR4_VIRQ7_LEVEL2 (2 << 24) /* VMEbus IRQ7 on Level 2 26-24 */ +#define ILR4_VIRQ7_LEVEL3 (3 << 24) /* VMEbus IRQ7 on Level 3 26-24 */ +#define ILR4_VIRQ7_LEVEL4 (4 << 24) /* VMEbus IRQ7 on Level 4 26-24 */ +#define ILR4_VIRQ7_LEVEL5 (5 << 24) /* VMEbus IRQ7 on Level 5 26-24 */ +#define ILR4_VIRQ7_LEVEL6 (6 << 24) /* VMEbus IRQ7 on Level 6 26-24 */ +#define ILR4_VIRQ7_LEVEL7 (7 << 24) /* VMEbus IRQ7 on Level 7 26-24 */ + +#define ILR4_VIRQ6_LEVEL1 (1 << 20) /* VMEbus IRQ6 on Level 1 22-20 */ +#define ILR4_VIRQ6_LEVEL2 (2 << 20) /* VMEbus IRQ6 on Level 2 22-20 */ +#define ILR4_VIRQ6_LEVEL3 (3 << 20) /* VMEbus IRQ6 on Level 3 22-20 */ +#define ILR4_VIRQ6_LEVEL4 (4 << 20) /* VMEbus IRQ6 on Level 4 22-20 */ +#define ILR4_VIRQ6_LEVEL5 (5 << 20) /* VMEbus IRQ6 on Level 5 22-20 */ +#define ILR4_VIRQ6_LEVEL6 (6 << 20) /* VMEbus IRQ6 on Level 6 22-20 */ +#define ILR4_VIRQ6_LEVEL7 (7 << 20) /* VMEbus IRQ6 on Level 7 22-20 */ + +#define ILR4_VIRQ5_LEVEL1 (1 << 16) /* VMEbus IRQ5 on Level 1 18-16 */ +#define ILR4_VIRQ5_LEVEL2 (2 << 16) /* VMEbus IRQ5 on Level 2 18-16 */ +#define ILR4_VIRQ5_LEVEL3 (3 << 16) /* VMEbus IRQ5 on Level 3 18-16 */ +#define ILR4_VIRQ5_LEVEL4 (4 << 16) /* VMEbus IRQ5 on Level 4 18-16 */ +#define ILR4_VIRQ5_LEVEL5 (5 << 16) /* VMEbus IRQ5 on Level 5 18-16 */ +#define ILR4_VIRQ5_LEVEL6 (6 << 16) /* VMEbus IRQ5 on Level 6 18-16 */ +#define ILR4_VIRQ5_LEVEL7 (7 << 16) /* VMEbus IRQ5 on Level 7 18-16 */ + +#define ILR4_VIRQ4_LEVEL1 (1 << 12) /* VMEbus IRQ4 on Level 1 14-12 */ +#define ILR4_VIRQ4_LEVEL2 (2 << 12) /* VMEbus IRQ4 on Level 2 14-12 */ +#define ILR4_VIRQ4_LEVEL3 (3 << 12) /* VMEbus IRQ4 on Level 3 14-12 */ +#define ILR4_VIRQ4_LEVEL4 (4 << 12) /* VMEbus IRQ4 on Level 4 14-12 */ +#define ILR4_VIRQ4_LEVEL5 (5 << 12) /* VMEbus IRQ4 on Level 5 14-12 */ +#define ILR4_VIRQ4_LEVEL6 (6 << 12) /* VMEbus IRQ4 on Level 6 14-12 */ +#define ILR4_VIRQ4_LEVEL7 (7 << 12) /* VMEbus IRQ4 on Level 7 14-12 */ + +#define ILR4_VIRQ3_LEVEL1 (1 << 8) /* VMEbus IRQ3 on Level 1 10-8 */ +#define ILR4_VIRQ3_LEVEL2 (2 << 8) /* VMEbus IRQ3 on Level 2 10-8 */ +#define ILR4_VIRQ3_LEVEL3 (3 << 8) /* VMEbus IRQ3 on Level 3 10-8 */ +#define ILR4_VIRQ3_LEVEL4 (4 << 8) /* VMEbus IRQ3 on Level 4 10-8 */ +#define ILR4_VIRQ3_LEVEL5 (5 << 8) /* VMEbus IRQ3 on Level 5 10-8 */ +#define ILR4_VIRQ3_LEVEL6 (6 << 8) /* VMEbus IRQ3 on Level 6 10-8 */ +#define ILR4_VIRQ3_LEVEL7 (7 << 8) /* VMEbus IRQ3 on Level 7 10-8 */ + +#define ILR4_VIRQ2_LEVEL1 (1 << 4) /* VMEbus IRQ2 on Level 1 6-4 */ +#define ILR4_VIRQ2_LEVEL2 (2 << 4) /* VMEbus IRQ2 on Level 2 6-4 */ +#define ILR4_VIRQ2_LEVEL3 (3 << 4) /* VMEbus IRQ2 on Level 3 6-4 */ +#define ILR4_VIRQ2_LEVEL4 (4 << 4) /* VMEbus IRQ2 on Level 4 6-4 */ +#define ILR4_VIRQ2_LEVEL5 (5 << 4) /* VMEbus IRQ2 on Level 5 6-4 */ +#define ILR4_VIRQ2_LEVEL6 (6 << 4) /* VMEbus IRQ2 on Level 6 6-4 */ +#define ILR4_VIRQ2_LEVEL7 (7 << 4) /* VMEbus IRQ2 on Level 7 6-4 */ + +#define ILR4_VIRQ1_LEVEL1 1 /* VMEbus IRQ1 on Level 1 2-0 */ +#define ILR4_VIRQ1_LEVEL2 2 /* VMEbus IRQ1 on Level 2 2-0 */ +#define ILR4_VIRQ1_LEVEL3 3 /* VMEbus IRQ1 on Level 3 2-0 */ +#define ILR4_VIRQ1_LEVEL4 4 /* VMEbus IRQ1 on Level 4 2-0 */ +#define ILR4_VIRQ1_LEVEL5 5 /* VMEbus IRQ1 on Level 5 2-0 */ +#define ILR4_VIRQ1_LEVEL6 6 /* VMEbus IRQ1 on Level 6 2-0 */ +#define ILR4_VIRQ1_LEVEL7 7 /* VMEbus IRQ1 on Level 7 2-0 */ + +/* + * Vector Base Register 0x88 31-24 + * I/O Control Register 1 0x88 23-16 + * I/O Control Register 2 0x88 15-08 + * I/O Control Register 3 0x88 07-00 + */ + +#define IOCR_MEIN (1 << 23) /* Enable Interrupts 23 */ +#define IOCR_SYSFL (1 << 22) /* SYSFAIL VMEbus Status 22 */ +#define IOCR_ACFL (1 << 21) /* ACFAIL VMEbus Status 21 */ +#define IOCR_ABRTL (1 << 20) /* ABORT Switch Status 20 */ +#define IOCR_GPOEN3 (1 << 19) /* GPIO3 Set as Output 19 */ +#define IOCR_GPIEN3 0x00 /* GPIO3 Set as Input 19 */ +#define IOCR_GPOEN2 (1 << 18) /* GPIO2 Set as Output 18 */ +#define IOCR_GPIEN2 0x00 /* GPIO2 Set as Input 18 */ +#define IOCR_GPOEN1 (1 << 17) /* GPIO1 Set as Output 17 */ +#define IOCR_GPIEN1 0x00 /* GPIO1 Set as Input 17 */ +#define IOCR_GPOEN0 (1 << 16) /* GPIO0 Set as Output 16 */ +#define IOCR_GPIEN0 0x00 /* GPIO0 Set as Input 16 */ + +#define IOCR_GPIOO3_HIGH (1 << 15) /* GPIO3 set to HIGH 15 */ +#define IOCR_GPIOO3_LOW 0x00 /* GPIO3 set to LOW 15 */ +#define IOCR_GPIOO2_HIGH (1 << 14) /* GPIO2 set to HIGH 14 */ +#define IOCR_GPIOO2_LOW 0x00 /* GPIO2 set to LOW 14 */ +#define IOCR_GPIOO1_HIGH (1 << 13) /* GPIO1 set to HIGH 13 */ +#define IOCR_GPIOO1_LOW 0x00 /* GPIO1 set to LOW 13 */ +#define IOCR_GPIOO0_HIGH (1 << 12) /* GPIO0 set to HIGH 12 */ +#define IOCR_GPIOO0_LOW 0x00 /* GPIO0 set to LOW 12 */ +#define IOCR_GPIOI3 (1 << 11) /* GPIO3 Status 11 */ +#define IOCR_GPIOI2 (1 << 10) /* GPIO2 Status 10 */ +#define IOCR_GPIOI1 (1 << 9) /* GPIO1 Status 9 */ +#define IOCR_GPIOI0 (1 << 8) /* GPIO0 Status 8 */ + +#define IOCR_GPI7 (1 << 7) /* GPI7 Status 7 */ +#define IOCR_GPI6 (1 << 6) /* GPI6 Status 6 */ +#define IOCR_GPI5 (1 << 5) /* GPI5 Status 5 */ +#define IOCR_GPI4 (1 << 4) /* GPI4 Status 4 */ +#define IOCR_GPI3 (1 << 3) /* GPI3 Status 3 */ +#define IOCR_GPI2 (1 << 2) /* GPI2 Status 2 */ +#define IOCR_GPI1 (1 << 1) /* GPI1 Status 1 */ +#define IOCR_GPI0 1 /* GPI0 Status 0 */ + +/* Miscellaneous Control Register 0x8c 07-00 */ + +#define MISCCR_DISSRAM (1 << 5) /* Disable SRAM decoder 5 */ + +/* VMEchip2 LM/SIG Register 0x06 */ + +#define LM_SIG_LM3 0x80 /* Location Monitor 3 7 */ +#define LM_SIG_LM2 0x40 /* Location Monitor 2 6 */ +#define LM_SIG_LM1 0x20 /* Location Monitor 1 5 */ +#define LM_SIG_LM0 0x10 /* Location Monitor 0 4 */ +#define LM_SIG_SIG3 0x08 /* SIG3 3 */ +#define LM_SIG_SIG2 0x04 /* SIG2 2 */ +#define LM_SIG_SIG1 0x02 /* SIG1 1 */ +#define LM_SIG_SIG0 0x01 /* SIG0 0 */ + +/* VMEchip2 Board Status/Control Register 0x07 */ + +#define BSCR_RST 0x80 /* Allow VMEbus master reset 7 */ +#define BSCR_ISF 0x40 /* Inhibit SYSFAIL to VMEbus 6 */ +#define BSCR_BF 0x20 /* Board Fail active 5 */ +#define BSCR_SCON 0x10 /* Board is System Controller 4 */ +#define BSCR_SYSFL 0x08 /* Board Driving SYSFAIL 3 */ + + +/* + * Local Bus Interrupter Summary (2-65 of '167 manual) + * These are values for the interrupt vector related to various + * interrupts generated locally. + */ + +/* These have the upper 4 bits defined by the contents of + * vector base register 1 + */ +#define LBIV_SOFTWARE0 0x08 +#define LBIV_SOFTWARE1 0x09 +#define LBIV_SOFTWARE2 0x0a +#define LBIV_SOFTWARE3 0x0b +#define LBIV_SOFTWARE4 0x0c +#define LBIV_SOFTWARE5 0x0d +#define LBIV_SOFTWARE6 0x0e +#define LBIV_SOFTWARE7 0x0f + +/* These have the upper 4 bits defined by the contents of + * vector base register 0 + */ +#define LBIV_GCSR_LM0 0x00 +#define LBIV_GCSR_LM1 0x01 +#define LBIV_GCSR_SIG0 0x02 +#define LBIV_GCSR_SIG1 0x03 +#define LBIV_GCSR_SIG2 0x04 +#define LBIV_GCSR_SIG3 0x05 +#define LBIV_DMAC 0x06 +#define LBIV_VIA 0x07 +#define LBIV_TT1 0x08 +#define LBIV_TT2 0x09 +#define LBIV_VIRQ1_ES 0x0a +#define LBIV_PARITY_ERROR 0x0b +#define LBIV_VMWPE 0x0c +#define LBIV_VME_SYSFAIL 0x0d +#define LBIV_ABORT 0x0e +#define LBIV_VME_ACFAIL 0x0f + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvmechip2h */ diff --git a/h/drv/vme/unsupported/vsam.h b/h/drv/vme/unsupported/vsam.h new file mode 100644 index 0000000..13b0dfb --- /dev/null +++ b/h/drv/vme/unsupported/vsam.h @@ -0,0 +1,150 @@ +/* vsam.h - SBE VSAM Chip Set header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01e,22sep92,rrr added support for c++ +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01b,05oct90,shl added copyright notice. + made #endif ANSI style. +01a,10sep89,rld original SBE release. +*/ + +/* +This header file defines the register layout of the SBE VMEbus +Slave Address Manager chip (VSAM) and supplies alpha-numeric +equivalences for register bit definitions. +*/ + +#ifndef __INCvsamh +#define __INCvsamh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _ASMLANGUAGE +#define VSAM_ADRS(reg) (VSAM + (reg * VSAM_REG_OFFSET)) +#else +#define VSAM_ADRS(reg) ((char *) VSAM + (reg * VSAM_REG_OFFSET)) +#endif /* _ASMLANGUAGE */ + +/* Location Monitor */ + +#define VSAM_LM_VAC_0 VSAM_ADRS(0x00) /* VME Address Register 0 */ +#define VSAM_LM_VAC_1 VSAM_ADRS(0x01) /* VME Address Register 1 */ +#define VSAM_LM_VAC_2 VSAM_ADRS(0x02) /* VME Address Register 2 */ +#define VSAM_LM_VAC_3 VSAM_ADRS(0x03) /* VME Address Register 3 */ +#define VSAM_LM_BLKS_UPR VSAM_ADRS(0x04) /* VME Block Size */ +#define VSAM_LM_BLKS_LWR VSAM_ADRS(0x05) /* VME Block Size */ +#define LM_BLK_2 0x0000 /* 2 byte size */ +#define LM_BLK_4 0x0002 /* 4 byte size */ +#define LM_BLK_8 0x0006 /* 8 byte size */ +#define LM_BLK_16 0x000e /* 16 byte size */ +#define LM_BLK_32 0x001e /* 32 byte size */ +#define LM_BLK_64 0x003e /* 64 byte size */ +#define LM_BLK_128 0x007e /* 128 byte size */ +#define LM_BLK_256 0x00fe /* 256 byte size */ +#define LM_BLK_512 0x01fe /* 512 byte size */ +#define LM_BLK_1K 0x03fe /* 1K byte size */ +#define LM_BLK_2K 0x07fe /* 2K byte size */ +#define LM_BLK_4K 0x0ffe /* 4K byte size */ +#define LM_BLK_8K 0x1ffe /* 8K byte size */ +#define LM_BLK_16K 0x3ffe /* 16K byte size */ +#define LM_BLK_32K 0x7ffe /* 32K byte size */ +#define LM_BLK_64K 0xfffe /* 64K byte size */ + +#define VSAM_LM_AMU0 VSAM_ADRS(0x06) /* User Defined VME AM code #1 */ +#define VSAM_LM_AMU1 VSAM_ADRS(0x07) /* User Defined VME AM code #2 */ +#define VSAM_LM_CTR VSAM_ADRS(0x08) /* Counter */ +#define VSAM_LM_MC VSAM_ADRS(0x0a) /* Match count */ +#define VSAM_LM_CMD VSAM_ADRS(0x0c) /* Location Monitor Command */ +#define LM_CMD_FLAG 0x08 /* Command Flag */ +#define LM_CMD_DISABLE 0x0b /* cmd: disable Loc Monitor */ +#define LM_CMD_ENABLE 0x0c /* cmd: enable Loc Monitor */ +#define LM_CMD_READ_CNTR 0x0e /* cmd: read Monitor counter */ +#define LM_CMD_WRITE_CNTR 0x0f /* cmd: write Monitor counter */ +#define VSAM_LM_CTL VSAM_ADRS(0x0d) /* Location Monitor Control */ +#define LM_AMU0_ENABLE 0x04 /* Enable AMU0 usage */ +#define LM_AMU1_ENABLE 0x08 /* Enable AMU1 usage */ +#define LM_MODE_NONE 0x00 /* No address monitoring */ +#define LM_MODE_A16 0x01 /* Select A16 monitoring */ +#define LM_MODE_A24 0x02 /* Select A24 monitoring */ +#define LM_MODE_A32 0x03 /* Select A32 monitoring */ +#define VSAM_LM_VSL_UPR VSAM_ADRS(0x0e) /* VME Status Latch */ +#define LM_VSL_UAT 0x80 /* Decoded UAT transfer */ +#define LM_VSL_WORD 0x40 /* Decoded Word transfer */ +#define LM_VSL_BYTE 0x20 /* Decoded Byte transfer */ +#define LM_VSL_WRITE 0x10 /* Latched VWRITE* signal */ +#define LM_VSL_LDS1 0x08 /* Latched VDS1* signal */ +#define LM_VSL_LDS0 0x04 /* Latched VDS0* signal */ +#define LM_VSL_LA01 0x02 /* Latched VA1 signal */ +#define LM_VSL_LLWORD 0x01 /* Latched VLWORD* signal */ +#define VSAM_LM_VSL_LWR VSAM_ADRS(0x0f) /* VME Status Latch */ +#define LM_VSL_LIACK 0x80 /* Latched VIACK* signal */ +#define LM_VSL_AMASK 0x3f /* Mask for AM codes */ +#define VSAM_LM_AMR VSAM_ADRS(0x10) /* Regular VME AM codes */ +#define LM_AM_SUPER 0x38 /* Respond to supervisor */ +#define LM_AM_NONPRIV 0x07 /* Respond to non-privilege */ +#define LM_AM_SUP_ASCENDING 0x20 /* AMF */ +#define LM_AM_SUP_PGM 0x10 /* AME */ +#define LM_AM_SUP_DATA 0x08 /* AMD */ +#define LM_AM_USR_ASCENDING 0x04 /* AMB */ +#define LM_AM_USR_PGM 0x02 /* AMA */ +#define LM_AM_USR_DATA 0x01 /* AM9 */ +#define VSAM_LM_VEC VSAM_ADRS(0x11) /* Interrupt Vector */ + +/* Shared Memory */ + +#define VSAM_SM_BAV_UPR VSAM_ADRS(0x12) /* Base Addr on VMEbus */ +#define VSAM_SM_BAV_LWR VSAM_ADRS(0x13) /* Base Addr on VMEbus */ +#define VSAM_SM_BLKS VSAM_ADRS(0x14) /* Block Size */ +#define SM_BLK_64K 0x00 /* 64K byte size */ +#define SM_BLK_128K 0x01 /* 128K byte size */ +#define SM_BLK_256K 0x03 /* 256K byte size */ +#define SM_BLK_512K 0x07 /* 512K byte size */ +#define SM_BLK_1MB 0x0f /* 1MB byte size */ +#define SM_BLK_2MB 0x1f /* 2MB byte size */ +#define SM_BLK_4MB 0x3f /* 4MB byte size */ +#define SM_BLK_8MB 0x7f /* 8MB byte size */ +#define VSAM_SM_BAL VSAM_ADRS(0x15) /* Base Addr on Local Bus */ +#define VSAM_SM_AM VSAM_ADRS(0x16) /* AM codes */ +#define SM_AM_A32 0x80 /* 32-bit address response */ +#define SM_AM_A24 0x00 /* 24-bit address response */ +#define SM_AM_SUPER 0x38 /* Respond to supervisor */ +#define SM_AM_NONPRIV 0x07 /* Respond to non-privilege */ +#define SM_AM_SUP_ASCENDING 0x20 /* AMF */ +#define SM_AM_SUP_PGM 0x10 /* AME */ +#define SM_AM_SUP_DATA 0x08 /* AMD */ +#define SM_AM_USR_ASCENDING 0x04 /* AMB */ +#define SM_AM_USR_PGM 0x02 /* AMA */ +#define SM_AM_USR_DATA 0x01 /* AM9 */ +#define VSAM_IO_BAV_UPR VSAM_ADRS(0x18) /* Short I/O Base Address */ +#define VSAM_IO_BAV_LWR VSAM_ADRS(0x19) /* Short I/O Base Address */ +#define VSAM_IO_AM VSAM_ADRS(0x1a) /* Short I/O AM codes */ +#define EN_29 0x01 /* Short supervisory AM */ +#define EN_2D 0x02 /* Short non-priv AM */ +#define EN_MBX 0x04 /* Assertion of mailbox int */ + +/* Mailbox and Status Functions */ + +#define VSAM_MBX_VEC VSAM_ADRS(0x1b) /* Mailbox Intr Vector */ +#define VSAM_MBX_ISR VSAM_ADRS(0x1c) /* Interrupt Status Register */ +#define MBXP 0x80 /* Mailbox intr is pending */ +#define LMQP 0x40 /* Loc Monitor intr is pending */ +#define MBXEN 0x08 /* Mailbox intr is enabled */ +#define LMQEN 0x04 /* Loc Monitor is enabled */ +#define VSAM_MBX_USER VSAM_ADRS(0x1d) /* User Defined Register */ +#define MBX_RESET 0xa5 /* VMEbus resets local board */ +#define VSAM_MAILBOX_UPR VSAM_ADRS(0x1e)/* Mailbox Register */ +#define VSAM_MAILBOX_LWR VSAM_ADRS(0x1f)/* Mailbox Write Code Register */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvsamh */ diff --git a/h/drv/vme/unsupported/vsbchip2.h b/h/drv/vme/unsupported/vsbchip2.h new file mode 100644 index 0000000..c62beb3 --- /dev/null +++ b/h/drv/vme/unsupported/vsbchip2.h @@ -0,0 +1,151 @@ +/* vsbchip2.h - VSBchip2 Interface Controller */ + +/* Copyright 1994-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,15nov96,dat fixed SPR 4046, offset for VSBCHIP2_PTR was corrected. +01a,16feb94,dzb written. +*/ + +/* +DESCRIPTION +This file contains constants for the VSBchip2 interface controller. +*/ + +#ifdef DOC +#define __INCvsbchip2h +#endif /* DOC */ + +#ifndef __INCvsbchip2h +#define __INCvsbchip2h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _ASMLANGUAGE +#define CAST +#define CAST_US +#define CAST_UL +#else +#define CAST (char *) +#define CAST_US (unsigned short *) +#define CAST_UL (unsigned long *) +#endif /* _ASMLANGUAGE */ + +#ifndef VSBCHIP2_BASE_ADRS +#define VSBCHIP2_BASE_ADRS 0xfff41000 +#endif /* VSBCHIP2_BASE_ADRS */ + +#ifndef VSBCHIP2_REG_INTERVAL +#define VSBCHIP2_REG_INTERVAL 1 +#endif /* VSBCHIP2_REG_INTERVAL */ + +#ifndef VSB_ADRS +#define VSB_ADRS(reg) (CAST VSBCHIP2_BASE_ADRS + (reg * VSBCHIP2_REG_INTERVAL)) +#endif /* VSB_ADRS */ + +#ifndef VSB_ADRS_US +#define VSB_ADRS_US(reg) (CAST_US VSB_ADRS(reg)) +#endif /* VSB_ADRS_US */ + +#ifndef VSB_ADRS_UL +#define VSB_ADRS_UL(reg) (CAST_UL VSB_ADRS(reg)) +#endif /* VSB_ADRS_UL */ + + +/**********************************/ +/* VSBCHIP2 register locations: */ +/**********************************/ + +#define VSBCHIP2_CCCSR VSB_ADRS_US (0x000) /* Chip Control/Status Reg */ +#define VSBCHIP2_LIVBR VSB_ADRS_US (0x002) /* Local Int Vector Base Reg */ +#define VSBCHIP2_LISR VSB_ADRS_US (0x004) /* Local Interrupt Status Reg */ +#define VSBCHIP2_LIER VSB_ADRS_US (0x006) /* Local Interrupt Enable Reg */ +#define VSBCHIP2_LILR VSB_ADRS_UL (0x008) /* Local Interrupt Level Reg */ +#define VSBCHIP2_VRCSR VSB_ADRS_US (0x010) /* VSB Req Control/Status Reg */ +#define VSBCHIP2_TCR VSB_ADRS_US (0x014) /* Timer Control Register */ +#define VSBCHIP2_TCPR VSB_ADRS_US (0x016) /* Timer Clock Prescale Reg */ +#define VSBCHIP2_LS1ARR VSB_ADRS_UL (0x018) /* Local Bus Slave Addr Reg 1 */ +#define VSBCHIP2_LS1AOR VSB_ADRS_US (0x01c) /* Local Bus Slave Off Reg 1 */ +#define VSBCHIP2_LS1AR VSB_ADRS_US (0x01e) /* Local Bus Slave Attr Reg 1 */ +#define VSBCHIP2_LS2ARR VSB_ADRS_UL (0x020) /* Local Bus Slave Addr Reg 2 */ +#define VSBCHIP2_LS2AOR VSB_ADRS_US (0x024) /* Local Bus Slave Off Reg 2 */ +#define VSBCHIP2_LS2AR VSB_ADRS_US (0x026) /* Local Bus Slave Attr Reg 2 */ +#define VSBCHIP2_LS3ARR VSB_ADRS_UL (0x028) /* Local Bus Slave Addr Reg 3 */ +#define VSBCHIP2_LS3AOR VSB_ADRS_US (0x02c) /* Local Bus Slave Off Reg 3 */ +#define VSBCHIP2_LS3AR VSB_ADRS_US (0x02e) /* Local Bus Slave Attr Reg 3 */ +#define VSBCHIP2_LS4ARR VSB_ADRS_UL (0x030) /* Local Bus Slave Addr Reg 4 */ +#define VSBCHIP2_LS4AOR VSB_ADRS_US (0x034) /* Local Bus Slave Off Reg 4 */ +#define VSBCHIP2_LS4AR VSB_ADRS_US (0x036) /* Local Bus Slave Attr Reg 4 */ +#define VSBCHIP2_LEAR VSB_ADRS_UL (0x074) /* Local Error Address Reg */ +#define VSBCHIP2_PCCR VSB_ADRS_UL (0x078) /* Prescaler Current Cnt Reg */ +#define VSBCHIP2_PTR VSB_ADRS_UL (0x07C) /* Prescaler Test Register */ +#define VSBCHIP2_EAR VSB_ADRS_UL (0x100) /* EVSB Attention Register */ +#define VSBCHIP2_ETASR VSB_ADRS_UL (0x104) /* EVSB Test-And-Set Reg */ +#define VSBCHIP2_GPR1 VSB_ADRS_UL (0x108) /* General Purpose Reg 1 */ +#define VSBCHIP2_GPR2 VSB_ADRS_UL (0x10c) /* General Purpose Reg 2 */ +#define VSBCHIP2_VESR VSB_ADRS_UL (0x110) /* VSB Error Status Register */ +#define VSBCHIP2_VICR VSB_ADRS (0x114) /* VSB Interrupt Control Reg */ +#define VSBCHIP2_VIVR VSB_ADRS (0x115) /* VSB Interrupt Vector Reg */ +#define VSBCHIP2_VIER VSB_ADRS (0x116) /* VSB Interrupt Enable Reg */ +#define VSBCHIP2_VISR VSB_ADRS (0x117) /* VSB Interrupt Status Reg */ +#define VSBCHIP2_VS1ARR VSB_ADRS_UL (0x118) /* VSB Slave Addr Range Reg 1 */ +#define VSBCHIP2_VS1AOR VSB_ADRS_US (0x11c) /* VSB Slave Addr Off Reg 1 */ +#define VSBCHIP2_VS1AR VSB_ADRS_US (0x11e) /* VSB Slave Attribute Reg 1 */ +#define VSBCHIP2_VS2ARR VSB_ADRS_UL (0x120) /* VSB Slave Addr Range Reg 2 */ +#define VSBCHIP2_VS2AOR VSB_ADRS_US (0x124) /* VSB Slave Addr Off Reg 2 */ +#define VSBCHIP2_VS2AR VSB_ADRS_US (0x126) /* VSB Slave Attribute Reg 2 */ + +/**********************************/ +/* VSBCHIP2 register definitions: */ +/**********************************/ + +/* VSBCHIP2_VRCSR register definitions: */ + +#define VRCSR_LVRWD 0x0100 /* release when done */ + +/* VSBCHIP2_VTCR register definitions: */ + +#define VTCR_VARBTD 0x1000 /* VSB arbitration timer disable */ +#define VTCR_VATS_32MS 0x0800 /* VSB access timer select (32 msecs) */ +#define VTCR_VATS_DIS 0x0c00 /* VSB access timer select (32 msecs) */ +#define VTCR_VTXS_256US 0x0200 /* VSB transfer timer select (256 usecs) */ +#define VTCR_VTXS_DIS 0x0300 /* VSB transfer timer select disabled */ + + +/* VSBCHIP2_LS1AR register definitions: */ + +#define LS1AR_REN 0x8000 /* read enable (when set, read access) */ +#define LS1AR_WEN 0x4000 /* write enable (when set, write access) */ +#define LS1AR_WPE 0x0800 /* write post enable */ +#define LS1AR_BNCEN 0x0080 /* bounce mode enable */ + +#define LS1AR_VSP1 0x0020 +#define LS1AR_VSP0 0x0010 + + +/* VSBCHIP2_VS1AR register definitions: */ + +#define VS1AR_REN 0x8000 /* read enable (when set, read access) */ +#define VS1AR_WEN 0x4000 /* write enable (when set, write access) */ +#define VS1AR_POR 0x2000 /* participate on read */ +#define VS1AR_POW 0x1000 /* participate on write */ +#define VS1AR_WPE 0x0800 /* write post enable */ +#define VS1AR_SAS 0x0400 /* system address space */ +#define VS1AR_ALTAS 0x0200 /* alternate address space */ +#define VS1AR_IOAS 0x0100 /* I/O address space */ +#define VS1AR_LOCK 0x0040 /* lock local bus on block transfers */ + +#define VS1AR_LBTS1 0x0008 +#define VS1AR_LBTS0 0x0004 +#define VS1AR_LBSC1 0x0002 +#define VS1AR_LBSC0 0x0001 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvsbchip2h */ diff --git a/h/drv/vme/vbic.h b/h/drv/vme/vbic.h new file mode 100644 index 0000000..e9e6703 --- /dev/null +++ b/h/drv/vme/vbic.h @@ -0,0 +1,226 @@ +/* vbic.h - SBE VBIC Chip Set header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01e,22sep92,rrr added support for c++ +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01b,05oct90,shl added copyright notice. + made #endif ANSI style. +01a,10sep89,rld original SBE release. +*/ + +/* +This header file defines the register layout of the SBE VMEbus +Interface Controller chip (VBIC) and supplies alpha-numeric +equivalences for register bit definitions. +*/ + +#ifndef __INCvbich +#define __INCvbich + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _ASMLANGUAGE +#define VBIC_ADRS(reg) (VBIC + (reg*VBIC_REG_OFFSET)) +#else +#define VBIC_ADRS(reg) ((char *) VBIC + (reg*VBIC_REG_OFFSET)) +#endif /* _ASMLANGUAGE */ + +#define VBIC_VECTNMI VBIC_ADRS(0x00) /* NMI vector */ +#define VBIC_VECTLIR1 VBIC_ADRS(0x01) /* Local vectors */ +#define VBIC_VECTLIR2 VBIC_ADRS(0x02) +#define VBIC_VECTLIR3 VBIC_ADRS(0x03) +#define VBIC_VECTLIR4 VBIC_ADRS(0x04) +#define VBIC_VECTLIR5 VBIC_ADRS(0x05) +#define VBIC_VECTLIR6 VBIC_ADRS(0x06) +#define VBIC_VECTLIR7 VBIC_ADRS(0x07) +#define VBIC_VECTLIR8 VBIC_ADRS(0x08) +#define VBIC_VECTLIR9 VBIC_ADRS(0x09) +#define VBIC_VECTLI10 VBIC_ADRS(0x0a) +#define VBIC_VECTVIG VBIC_ADRS(0x0b) /* VMEbus Interrupt Generator */ +#define VBIC_VECTMSM VBIC_ADRS(0x0c) /* Millisecond Marker */ +#define VBIC_VECTVME VBIC_ADRS(0x0d) /* VMEbus interrupter for VIR1-7 */ + +#define VBIC_IRMASKA VBIC_ADRS(0x0e) /* Interrupt enable register A */ +#define M_LIR1 0x02 /* Enable level 1 interrupt */ +#define M_LIR2 0x04 /* Enable level 2 interrupt */ +#define M_LIR3 0x08 /* Enable level 3 interrupt */ +#define M_LIR4 0x10 /* Enable level 4 interrupt */ +#define M_LIR5 0x20 /* Enable level 5 interrupt */ +#define M_LIR6 0x40 /* Enable level 6 interrupt */ +#define M_LIR7 0x80 /* Enable level 7 interrupt */ + +#define VBIC_IRMASKB VBIC_ADRS(0x0f) /* Interrupt enable register B */ +#define M_LIR8 0x01 /* Enable level 8 interrupt */ +#define M_LIR9 0x02 /* Enable level 9 interrupt */ +#define M_LIR10 0x04 /* Enable level 10 interrupt */ +#define M_MSM 0x40 /* Enable MSM interrupt */ +#define M_VIG 0x80 /* Enable VIG interrupt */ + +#define VBIC_IRMASKC VBIC_ADRS(0x10) /* Interrupt enable register C */ +#define M_VIR1 0x02 /* Enable VME level 1 interrupt */ +#define M_VIR2 0x04 /* Enable VME level 2 interrupt */ +#define M_VIR3 0x08 /* Enable VME level 3 interrupt */ +#define M_VIR4 0x10 /* Enable VME level 4 interrupt */ +#define M_VIR5 0x20 /* Enable VME level 5 interrupt */ +#define M_VIR6 0x40 /* Enable VME level 6 interrupt */ +#define M_VIR7 0x80 /* Enable VME level 7 interrupt */ + +#define VBIC_IRSCANA VBIC_ADRS(0x11) /* Interrupt Request status A */ +#define S_LIR1 0x02 /* Asserting level 1 intr */ +#define S_LIR2 0x04 /* Asserting level 2 intr */ +#define S_LIR3 0x08 /* Asserting level 3 intr */ +#define S_LIR4 0x10 /* Asserting level 4 intr */ +#define S_LIR5 0x20 /* Asserting level 5 intr */ +#define S_LIR6 0x40 /* Asserting level 6 intr */ +#define S_LIR7 0x80 /* Asserting level 7 intr */ + +#define VBIC_IRSCANB VBIC_ADRS(0x12) /* Interrupt Request status B */ +#define S_LIR8 0x01 /* Asserting level 8 intr */ +#define S_LIR9 0x02 /* Asserting level 9 intr */ +#define S_LIR10 0x04 /* Asserting level 10 intr */ +#define S_MSM 0x40 /* Asserting MSM intr */ +#define S_VIG 0x80 /* Asserting VIG intr */ + +#define VBIC_IRSCANC VBIC_ADRS(0x13) /* VIR1-7 Int Request status C */ +#define S_VIR1 0x02 /* Asserting VME level 1 intr */ +#define S_VIR2 0x04 /* Asserting VME level 2 intr */ +#define S_VIR3 0x08 /* Asserting VME level 3 intr */ +#define S_VIR4 0x10 /* Asserting VME level 4 intr */ +#define S_VIR5 0x20 /* Asserting VME level 5 intr */ +#define S_VIR6 0x40 /* Asserting VME level 6 intr */ +#define S_VIR7 0x80 /* Asserting VME level 7 intr */ + +#define VBIC_VBICCTL VBIC_ADRS(0x14) /* VBIC Control */ +#define VBC_NONMIV 0 /* NMI uses VECTNMI as vector */ +#define VBC_NMIV 0x80 /* NMI is auto-vectored */ + +#define VBIC_ICLIR1 VBIC_ADRS(0x15) /* Interruptor Config */ +#define VBIC_ICLIR2 VBIC_ADRS(0x16) +#define VBIC_ICLIR3 VBIC_ADRS(0x17) +#define VBIC_ICLIR4 VBIC_ADRS(0x18) +#define VBIC_ICLIR5 VBIC_ADRS(0x19) +#define VBIC_ICLIR6 VBIC_ADRS(0x1a) +#define VBIC_ICLIR7 VBIC_ADRS(0x1b) +#define VBIC_ICLIR8 VBIC_ADRS(0x1c) +#define VBIC_ICLIR9 VBIC_ADRS(0x1d) +#define VBIC_ICLIR10 VBIC_ADRS(0x1e) +#define ICL_AUTOV 0x80 /* Auto-vectored interrupt */ +#define ICL_EXTV 0x40 /* External vectored interrupt */ +#define ICL_EDGE 0x20 /* Edge sensitive interrupter */ +#define ICL_LEVEL 0x00 /* Level sensitive interrupter */ +#define ICL_HIGH 0x10 /* Active high / rising edge */ +#define ICL_LOW 0x00 /* Active low / falling edge */ + +#define VBIC_ICVIR1 VBIC_ADRS(0x1f) /* VME Interruptor Config */ +#define VBIC_ICVIR2 VBIC_ADRS(0x20) +#define VBIC_ICVIR3 VBIC_ADRS(0x21) +#define VBIC_ICVIR4 VBIC_ADRS(0x22) +#define VBIC_ICVIR5 VBIC_ADRS(0x23) +#define VBIC_ICVIR6 VBIC_ADRS(0x24) +#define VBIC_ICVIR7 VBIC_ADRS(0x25) + +#define VBIC_ICVIG VBIC_ADRS(0x26) /* VIG Interrupter Config */ +#define VBIC_ICMSM VBIC_ADRS(0x27) /* MSM Interruptor Config */ +#define VBIC_MSMCTL VBIC_ADRS(0x28) /* Millisecond Marker Control */ +#define MSM_IRQEN 0x80 /* MSM interrupter is enabled */ +#define MSM_HALTED 0x40 /* MSM is halted */ +#define MSM_MSEC1 0x20 /* MSM is in 1ms mode */ +#define MSM_TEST 0x10 /* MSM is in test mode */ +#define MSM_NORMAL 2 /* cmd: set to normal (~test) */ +#define MSM_SEC1 3 /* cmd: 1ms interrupt mode */ +#define MSM_SEC10 4 /* cmd: 10ms interrupt mode */ +#define MSM_STOP 5 /* cmd: stops MSM counter */ +#define MSM_GO 6 /* cmd: starts MSM counter */ +#define MSM_INIT 7 /* cmd: sets MSM counter to 0 */ + +#define VBIC_VIRSID1 VBIC_ADRS(0x29) /* StsID latched from VME level 1 */ +#define VBIC_VIRSID2 VBIC_ADRS(0x2a) +#define VBIC_VIRSID3 VBIC_ADRS(0x2b) +#define VBIC_VIRSID4 VBIC_ADRS(0x2c) +#define VBIC_VIRSID5 VBIC_ADRS(0x2d) +#define VBIC_VIRSID6 VBIC_ADRS(0x2e) +#define VBIC_VIRSID7 VBIC_ADRS(0x2f) + +#define VBIC_RSTCTL VBIC_ADRS(0x30) /* Software Reset Control */ +#define VBIC_RESET 0x6a /* cmd: resets VBIC */ +#define VBIC_SLOTSTAT VBIC_ADRS(0x37) /* Slot-1 status */ +#define SLOT1 0x80 /* slot 1 jumper installed */ +#define VBIC_VOUTCTL VBIC_ADRS(0x40) /* VME Interrupt Output Control */ +#define VIG_GEN_1 0x01 /* Generate bus intr level 1 */ +#define VIG_GEN_2 0x02 /* Generate bus intr level 2 */ +#define VIG_GEN_3 0x03 /* Generate bus intr level 3 */ +#define VIG_GEN_4 0x04 /* Generate bus intr level 4 */ +#define VIG_GEN_5 0x05 /* Generate bus intr level 5 */ +#define VIG_GEN_6 0x06 /* Generate bus intr level 6 */ +#define VIG_GEN_7 0x07 /* Generate bus intr level 7 */ +#define VIG_PEND_1 0x02 /* Pending bus intr level 1 */ +#define VIG_PEND_2 0x04 /* Pending bus intr level 2 */ +#define VIG_PEND_3 0x08 /* Pending bus intr level 3 */ +#define VIG_PEND_4 0x10 /* Pending bus intr level 4 */ +#define VIG_PEND_5 0x20 /* Pending bus intr level 5 */ +#define VIG_PEND_6 0x40 /* Pending bus intr level 6 */ +#define VIG_PEND_7 0x80 /* Pending bus intr level 7 */ + +#define VBIC_VOUTSID1 VBIC_ADRS(0x41) /* StsID to send for VME level 1 */ +#define VBIC_VOUTSID2 VBIC_ADRS(0x42) /* StsID to send for VME level 2 */ +#define VBIC_VOUTSID3 VBIC_ADRS(0x43) /* StsID to send for VME level 3 */ +#define VBIC_VOUTSID4 VBIC_ADRS(0x44) /* StsID to send for VME level 4 */ +#define VBIC_VOUTSID5 VBIC_ADRS(0x45) /* StsID to send for VME level 5 */ +#define VBIC_VOUTSID6 VBIC_ADRS(0x46) /* StsID to send for VME level 6 */ +#define VBIC_VOUTSID7 VBIC_ADRS(0x47) /* StsID to send for VME level 7 */ + +#define VBIC_VIGCTL VBIC_ADRS(0x48) /* VMEbus Intr Generator Control */ +#define VIG_ENABLE_1 0x02 /* Enable VME int ACK interrupt */ +#define VIG_ENABLE_2 0x04 +#define VIG_ENABLE_3 0x08 +#define VIG_ENABLE_4 0x10 +#define VIG_ENABLE_5 0x20 +#define VIG_ENABLE_6 0x40 +#define VIG_ENABLE_7 0x80 + +#define VBIC_VIASR VBIC_ADRS(0x49) /* VMEbus Intr Ack Status */ +#define SR_IACK_1 0x02 /* Level 1 IACK completed */ +#define SR_IACK_2 0x04 /* Level 2 IACK completed */ +#define SR_IACK_3 0x08 /* Level 3 IACK completed */ +#define SR_IACK_4 0x10 /* Level 4 IACK completed */ +#define SR_IACK_5 0x20 /* Level 5 IACK completed */ +#define SR_IACK_6 0x40 /* Level 6 IACK completed */ +#define SR_IACK_7 0x80 /* Level 7 IACK completed */ + +#define VBIC_SRCLR VBIC_ADRS(0x4a) /* VIASR Bit CLear */ +#define SRCLR_1 0x01 /* Clear bit 1 of VIASR */ +#define SRCLR_2 0x02 /* Clear bit 2 of VIASR */ +#define SRCLR_3 0x03 /* Clear bit 3 of VIASR */ +#define SRCLR_4 0x04 /* Clear bit 4 of VIASR */ +#define SRCLR_5 0x05 /* Clear bit 5 of VIASR */ +#define SRCLR_6 0x06 /* Clear bit 6 of VIASR */ +#define SRCLR_7 0x07 /* Clear bit 7 of VIASR */ + +#define VBIC_SYSCTL VBIC_ADRS(0x4b) /* System Control Register */ +#define BUS_TIME_16 0x00 /* 16us timeout period */ +#define BUS_TIME_32 0x40 /* 32us timeout period */ +#define BUS_TIME_64 0x80 /* 64us timeout period */ +#define BUS_TIME_128 0xc0 /* 128us timeout period */ +#define BUS_ARB_RRS 0x00 /* Round robin */ +#define BUS_ARB_PRRS 0x20 /* Priority round robin */ +#define BUS_ARB_PRI 0x30 /* Absolute priority */ +#define BUS_LVL_0 0x00 /* Use bus request level 0 */ +#define BUS_LVL_1 0x04 /* Use bus request level 1 */ +#define BUS_LVL_2 0x08 /* Use bus request level 2 */ +#define BUS_LVL_3 0x0c /* Use bus request level 3 */ +#define BUS_REL_ROR 0x00 /* Release bus on request */ +#define BUS_REL_RWD 0x02 /* Release bus when done */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvbich */ diff --git a/h/drv/vme/vic068.h b/h/drv/vme/vic068.h new file mode 100644 index 0000000..9d3b3c2 --- /dev/null +++ b/h/drv/vme/vic068.h @@ -0,0 +1,701 @@ +/* vic068.h - VMEbus Interface Controller */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01k,22sep92,rrr added support for c++ +01j,26may92,rrr the tree shuffle +01i,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01h,06may91,nfs moved ifdef's to ensure clean mangening +01g,30apr91,nfs added ifdef for documentation +01f,25apr91,nfs corrected VME_ICGS and VME_ICMS defines (rs33 document error) + corrected VME_SET_ADRS and VME_CLR_ADRS (VIC document error) + ICR5 defines removed, revisions are referred to by their hex + code (f1,f2,f3,f4,f5 and f8 are currently valid) +01e,25mar91,del re-definition of VIC_ADRS and VME_ICF_ADRS permitted +01d,25mar91,nfs re-written + jcf +01c,25nov90,gae WRS cleanup. +01b,22mar90,eve general cleanup +01a,12mar89,fwa written. +*/ + +#ifdef DOC +#define INCvic068h +#endif /* DOC */ + +#ifndef __INCvic068h +#define __INCvic068h + +#ifdef __cplusplus +extern "C" { +#endif + +/* +This file contains constants for the VTC VMEbus Interface controller. +The macro VIC_BASE_ADRS must be defined when including this header. + +The following standards have been adopted in the creation of this file. + +Register definitions which provide access to the VIC chip locally +(on-board) have the prefix "VIC". Register definitions which provide +access to the VIC chip via the VMEbus (off-board) have the prefix +"VME". + +The registers are listed in ascending (numerical) order; the definitions +for each register are started with a header eg. + + Register Register Register Register + Mnemonic Number Address Name + | | | | + v v v v +***************************************************************** +* VIICR 0x01 0x03 VME Interrupter Irq Control Reg * +***************************************************************** + +in some cases where a number of registers have the same definitions the +header looks like this eg. + +**************************************************************** +* VICR1 0x02 0x07 VME Interrupt Control Reg #1 * +* to * +* VICR7 0x08 0x1f VME Interrupt Control Reg #7 * +**************************************************************** + +The format of the definitions is as follows; the define name always +starts with the register mnemonic it is associated with. The [7-0] +number at the end of the comment indicates the bit position the define +applies to; the definition ICGICR_IRQ_EN_ICGS3, in the following +example, the 7 applies to bit 7 + | | + v v + define ICGICR_IRQ_EN_ICGS3 0x00 * enable ICGS3 local int 7 * + +If the define applies to more than one bit, then the applicable bit +range is specified by two digits; in the following example ICGICR_IRQ_EN_ICGS, +applies to the four bit field, bits 7-4. + | + v + define ICGICR_IRQ_EN_ICGS 0x00 * enable all ICGS local int's 74 * + +If no bit field is given, then the define applies to the whole register. +*/ + +#ifdef _ASMLANGUAGE +#define CAST +#else +/* #define CAST (UCHAR *) */ +#define CAST (char *) +#endif /* _ASMLANGUAGE */ + +/* on-board access, register definitions */ + +#define VIC_REG_INTERVAL 4 + +#ifndef VIC_ADRS /* to permit alternative board addressing */ +#define VIC_ADRS(reg) (CAST (VIC_BASE_ADRS + (reg * VIC_REG_INTERVAL) + 3)) +#endif /* VIC_ADRS */ + +#define VIC_VIICR VIC_ADRS(0x00) /* VME Interrupter Irq Control Reg */ +#define VIC_VICR1 VIC_ADRS(0x01) /* VME Interrupt Control Reg #1 */ +#define VIC_VICR2 VIC_ADRS(0x02) /* VME Interrupt Control Reg #2 */ +#define VIC_VICR3 VIC_ADRS(0x03) /* VME Interrupt Control Reg #3 */ +#define VIC_VICR4 VIC_ADRS(0x04) /* VME Interrupt Control Reg #4 */ +#define VIC_VICR5 VIC_ADRS(0x05) /* VME Interrupt Control Reg #5 */ +#define VIC_VICR6 VIC_ADRS(0x06) /* VME Interrupt Control Reg #6 */ +#define VIC_VICR7 VIC_ADRS(0x07) /* VME Interrupt Control Reg #7 */ +#define VIC_DSICR VIC_ADRS(0x08) /* DMA Status Int Control Reg */ +#define VIC_LICR1 VIC_ADRS(0x09) /* Local Interrupt Control Reg #1 */ +#define VIC_LICR2 VIC_ADRS(0x0a) /* Local Interrupt Control Reg #2 */ +#define VIC_LICR3 VIC_ADRS(0x0b) /* Local Interrupt Control Reg #3 */ +#define VIC_LICR4 VIC_ADRS(0x0c) /* Local Interrupt Control Reg #4 */ +#define VIC_LICR5 VIC_ADRS(0x0d) /* Local Interrupt Control Reg #5 */ +#define VIC_LICR6 VIC_ADRS(0x0e) /* Local Interrupt Control Reg #6 */ +#define VIC_LICR7 VIC_ADRS(0x0f) /* Local Interrupt Control Reg #7 */ +#define VIC_ICGICR VIC_ADRS(0x10) /* ICGS Interrupt Control Reg */ +#define VIC_ICMICR VIC_ADRS(0x11) /* ICMS Interrupt Control Reg */ +#define VIC_EGICR VIC_ADRS(0x12) /* Error Group Int Control Reg */ +#define VIC_ICGIVBR VIC_ADRS(0x13) /* ICGS Interrupt Vector Base Reg */ +#define VIC_ICMIVBR VIC_ADRS(0x14) /* ICMS Interrupt Vector Base Reg */ +#define VIC_LIVBR VIC_ADRS(0x15) /* Local Int Vector Base Reg */ +#define VIC_EGIVBR VIC_ADRS(0x16) /* Error Group Int Vec Base Reg */ +#define VIC_ICSR VIC_ADRS(0x17) /* Interprocessor Comm Switch Reg */ +#define VIC_ICR0 VIC_ADRS(0x18) /* Interprocessor Comm. Reg #0 */ +#define VIC_ICR1 VIC_ADRS(0x19) /* Interprocessor Comm. Reg #1 */ +#define VIC_ICR2 VIC_ADRS(0x1a) /* Interprocessor Comm. Reg #2 */ +#define VIC_ICR3 VIC_ADRS(0x1b) /* Interprocessor Comm. Reg #3 */ +#define VIC_ICR4 VIC_ADRS(0x1c) /* Interprocessor Comm. Reg #4 */ +#define VIC_ICR5 VIC_ADRS(0x1d) /* Interprocessor Comm. Reg #5 */ +#define VIC_ICR6 VIC_ADRS(0x1e) /* Interprocessor Comm. Reg #6 */ +#define VIC_ICR7 VIC_ADRS(0x1f) /* Interprocessor Comm. Reg #7 */ +#define VIC_VIRSR VIC_ADRS(0x20) /* VME Interrupt Request/Stat. Reg */ +#define VIC_VIVR1 VIC_ADRS(0x21) /* VME Interrupt Vector Reg #1 */ +#define VIC_VIVR2 VIC_ADRS(0x22) /* VME Interrupt Vector Reg #2 */ +#define VIC_VIVR3 VIC_ADRS(0x23) /* VME Interrupt Vector Reg #3 */ +#define VIC_VIVR4 VIC_ADRS(0x24) /* VME Interrupt Vector Reg #4 */ +#define VIC_VIVR5 VIC_ADRS(0x25) /* VME Interrupt Vector Reg #5 */ +#define VIC_VIVR6 VIC_ADRS(0x26) /* VME Interrupt Vector Reg #6 */ +#define VIC_VIVR7 VIC_ADRS(0x27) /* VME Interrupt Vector Reg #7 */ +#define VIC_TTR VIC_ADRS(0x28) /* Transfer Time-out Reg */ +#define VIC_LBTR VIC_ADRS(0x29) /* Local Bus Timing Reg */ +#define VIC_BTDR VIC_ADRS(0x2a) /* Block Transfer Definition Reg */ +#define VIC_ICR VIC_ADRS(0x2b) /* Interface Configuration Reg */ +#define VIC_ARCR VIC_ADRS(0x2c) /* Arbiter/Requester Config. Reg */ +#define VIC_AMSR VIC_ADRS(0x2d) /* AM Source Reg */ +#define VIC_BESR VIC_ADRS(0x2e) /* Bus Error Status Reg */ +#define VIC_DSR VIC_ADRS(0x2f) /* DMA Status Reg */ +#define VIC_SS0CR0 VIC_ADRS(0x30) /* Slave Select 0/Control Reg #0 */ +#define VIC_SS0CR1 VIC_ADRS(0x31) /* Slave Select 0/Control Reg #1 */ +#define VIC_SS1CR0 VIC_ADRS(0x32) /* Slave Select 1/Control Reg #0 */ +#define VIC_SS1CR1 VIC_ADRS(0x33) /* Slave Select 1/Control Reg #1 */ +#define VIC_RCR VIC_ADRS(0x34) /* Release Control Reg */ +#define VIC_BTCR VIC_ADRS(0x35) /* Block Transfer Control Reg */ +#define VIC_BTLR0 VIC_ADRS(0x36) /* Block Transfer Length Reg #0 */ +#define VIC_BTLR1 VIC_ADRS(0x37) /* Block Transfer Length Reg #1 */ +#define VIC_SRR VIC_ADRS(0x38) /* System Reset Reg */ + +/* off-board access, register definitions */ + +#define VME_ICF_REG_INTERVAL 2 + +#ifndef VME_ICF_ADRS /* to permit alternative off-board addressing */ +#define VME_ICF_ADRS(adrs, icf, type, reg) \ + (CAST (adrs + icf + (reg * VME_ICF_REG_INTERVAL) + type )) +#endif /* VME_ICF_ADRS */ + +/* Interprocessor Communication Facility - icf */ + +#define VME_ICR 0x00 /* IC Registers ICR0-7 */ +#define VME_ICGS 0x10 /* IC Global Switches ICGS0-3 */ +#define VME_ICMS 0x20 /* IC Module Switches ICMS0-3 */ + +/* Type of register access - type */ + +#define VME_ODD_ADRS 0x01 /* ICR always accessed at odd byte addresses */ + +#define VME_SET_ADRS 0x01 /* ICGS and ICMS set switch access */ +#define VME_CLR_ADRS 0x00 /* ICGS and ICMS clear switch access */ + +#define VME_ICR0(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICR,VME_ODD_ADRS,0) +#define VME_ICR1(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICR,VME_ODD_ADRS,1) +#define VME_ICR2(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICR,VME_ODD_ADRS,2) +#define VME_ICR3(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICR,VME_ODD_ADRS,3) +#define VME_ICR4(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICR,VME_ODD_ADRS,4) +#define VME_ICR5(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICR,VME_ODD_ADRS,5) +#define VME_ICR6(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICR,VME_ODD_ADRS,6) +#define VME_ICR7(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICR,VME_ODD_ADRS,7) + +#define VME_ICGS0_SET(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICGS,VME_SET_ADRS,0) +#define VME_ICGS0_CLR(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICGS,VME_CLR_ADRS,0) +#define VME_ICGS1_SET(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICGS,VME_SET_ADRS,1) +#define VME_ICGS1_CLR(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICGS,VME_CLR_ADRS,1) +#define VME_ICGS2_SET(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICGS,VME_SET_ADRS,2) +#define VME_ICGS2_CLR(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICGS,VME_CLR_ADRS,2) +#define VME_ICGS3_SET(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICGS,VME_SET_ADRS,3) +#define VME_ICGS3_CLR(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICGS,VME_CLR_ADRS,3) + +#define VME_ICMS0_SET(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICMS,VME_SET_ADRS,0) +#define VME_ICMS0_CLR(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICMS,VME_CLR_ADRS,0) +#define VME_ICMS1_SET(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICMS,VME_SET_ADRS,1) +#define VME_ICMS1_CLR(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICMS,VME_CLR_ADRS,1) +#define VME_ICMS2_SET(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICMS,VME_SET_ADRS,2) +#define VME_ICMS2_CLR(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICMS,VME_CLR_ADRS,2) +#define VME_ICMS3_SET(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICMS,VME_SET_ADRS,3) +#define VME_ICMS3_CLR(baseAdrs) VME_ICF_ADRS(baseAdrs,VME_ICMS,VME_CLR_ADRS,3) + +/**************************************************************** +* VIICR 0x00 0x03 VME Interrupter Irq Control Reg * +*****************************************************************/ + +#define VIICR_IRQ_LVL_MASK 0x07 /* local interrupt level mask 7 */ +#define VIICR_IRQ_DISABLE 0x80 /* disable interrupter IRQ 7 */ + +/*************************************************************** +* VICR1 0x01 0x07 VME Interrupt Control Reg #1 * +* to * +* VICR7 0x07 0x1f VME Interrupt Control Reg #7 * +****************************************************************/ + +#define VICR_IRQ_LVL_MASK 0x07 /* local interrupt level mask 7 */ +#define VICR_IRQ_DISABLE 0x80 /* disable interrupt IRQ 7 */ + +/*************************************************************** +* DSICR 0x08 0x23 DMA Status Int Control Reg * +****************************************************************/ + +#define DSICR_IRQ_LVL_MASK 0x07 /* local interrupt level mask 7 */ +#define DSICR_IRQ_DISABLE 0x80 /* disable DMA termination IRQ 7 */ + +/*************************************************************** +* LICR1 0x09 0x27 Local Interrupt Control Reg #1 * +* to * +* LICR7 0x0f 0x3f Local Interrupt Control Reg #7 * +****************************************************************/ + +#define LICR_IRQ_LVL_MASK 0x07 /* local interrupt level mask */ +#define LICR_IRQ_STATE 0x08 /* LIRQ(i) state 3 */ +#define LICR_IRQ_VEC_DEV 0x00 /* device supplies vector 4 */ +#define LICR_IRQ_VEC_VIC 0x10 /* VIC supplies vector 4 */ +#define LICR_IRQ_LEVEL 0x00 /* level sensitive 5 */ +#define LICR_IRQ_EDGE 0x20 /* edge sensitive 5 */ +#define LICR_IRQ_ACTIVEL 0x00 /* active low 6 */ +#define LICR_IRQ_ACTIVEH 0x40 /* active high 6 */ +#define LICR_IRQ_ENABLE 0x00 /* enable IRQ 7 */ +#define LICR_IRQ_DISABLE 0x80 /* disable IRQ 7 */ + +/*************************************************************** +* ICGICR 0x10 0x43 ICGS Interrupt Control Reg * +****************************************************************/ + +#define ICGICR_IRQ_LVL_MASK 0x07 /* local interrupt level mask */ +#define ICGICR_IRQ_ICGS0_ENA 0x00 /* enable ICGS0 local interrpt 4 */ +#define ICGICR_IRQ_ICGS0_DIS 0x10 /* disable ICGS0 local interrpt 4 */ +#define ICGICR_IRQ_ICGS1_ENA 0x00 /* enable ICGS1 local interrpt 5 */ +#define ICGICR_IRQ_ICGS1_DIS 0x20 /* disable ICGS1 local interrpt 5 */ +#define ICGICR_IRQ_ICGS2_ENA 0x00 /* enable ICGS2 local interrpt 6 */ +#define ICGICR_IRQ_ICGS2_DIS 0x40 /* disable ICGS2 local interrpt 6 */ +#define ICGICR_IRQ_ICGS3_ENA 0x00 /* enable ICGS3 local interrpt 7 */ +#define ICGICR_IRQ_ICGS3_DIS 0x80 /* disable ICGS3 local interrpt 7 */ + +/*************************************************************** +* ICMICR 0x11 0x47 ICMS Interrupt Control Reg * +****************************************************************/ + +#define ICMICR_IRQ_LVL_MASK 0x07 /* local interrupt level mask */ +#define ICMICR_IRQ_ICMS0_DIS 0x10 /* disable ICMS0 local interrpt 4 */ +#define ICMICR_IRQ_ICMS1_DIS 0x20 /* disable ICMS1 local interrpt 5 */ +#define ICMICR_IRQ_ICMS2_DIS 0x40 /* disable ICMS2 local interrpt 6 */ +#define ICMICR_IRQ_ICMS3_DIS 0x80 /* disable ICMS3 local interrpt 7 */ + +/*************************************************************** +* EGICR 0x12 0x4b Error Group Int Control Reg * +****************************************************************/ + +#define EGICR_IRQ_LVL_MASK 0x07 /* local interrupt level mask */ +#define EGICR_IRQ_SYSFAIL_ENA 0x00 /* enable SYSFAIL* local int 4 */ +#define EGICR_IRQ_SYSFAIL_DIS 0x10 /* disable SYSFAIL* local int 4 */ +#define EGICR_IRQ_ABTTO_ENA 0x00 /* enable arbitration time out 5 */ +#define EGICR_IRQ_ABTTO_DIS 0x20 /* disable arbitration time out 5 */ +#define EGICR_IRQ_WPFAIL_ENA 0x00 /* enable write post fail 6 */ +#define EGICR_IRQ_WPFAIL_DIS 0x40 /* disable write post fail 6 */ +#define EGICR_IRQ_ACFAIL_ENA 0x00 /* enable ACFAIL* local int 7 */ +#define EGICR_IRQ_ACFAIL_DIS 0x80 /* disable ACFAIL* local int 7 */ + +/*************************************************************** +* ICGIVBR 0x13 0x4f ICGS Interrupt Vector Base Reg * +****************************************************************/ + +/* Identity of interrupting ICGS (read only) */ + +#define ICGIVBR_ICGS0 0x00 /* ICGS0 10 */ +#define ICGIVBR_ICGS1 0x01 /* ICGS1 10 */ +#define ICGIVBR_ICGS2 0x02 /* ICGS2 10 */ +#define ICGIVBR_ICGS3 0x03 /* ICGS3 10 */ +#define ICGIVBR_VEC_MASK 0xfc /* ICGS vector base mask */ + +/*************************************************************** +* ICMIVBR 0x14 0x53 ICMS Interrupt Vector Base Reg * +****************************************************************/ + +/* Identity of interrupting ICMS (read only) */ + +#define ICMIVBR_ICMS0 0x00 /* ICMS0 10 */ +#define ICMIVBR_ICMS1 0x01 /* ICMS1 10 */ +#define ICMIVBR_ICMS2 0x02 /* ICMS2 10 */ +#define ICMIVBR_ICMS3 0x03 /* ICMS3 10 */ +#define ICMIVBR_VEC_MASK 0xfc /* ICMI vector base mask */ + +/*************************************************************** +* LIVBR 0x15 0x57 Local Int Vector Base Reg * +****************************************************************/ + +/* Identity of local interrupt (read only) */ + +#define LIVBR_LIRQ1 0x01 /* LIRQ1 20 */ +#define LIVBR_LIRQ2 0x02 /* LIRQ2 20 */ +#define LIVBR_LIRQ3 0x03 /* LIRQ3 20 */ +#define LIVBR_LIRQ4 0x04 /* LIRQ4 20 */ +#define LIVBR_LIRQ5 0x05 /* LIRQ5 20 */ +#define LIVBR_LIRQ6 0x06 /* LIRQ6 20 */ +#define LIVBR_LIRQ7 0x07 /* LIRQ7 20 */ +#define LIVBR_VEC_MASK 0xf8 /* LIRQ vector base mask */ + +/*************************************************************** +* EGIVBR 0x16 0x5b Error Group Int Vec Base Reg * +****************************************************************/ + +/* Error Conditions (read only) */ + +#define EGIVBR_ACFAIL 0x00 /* ACFAIL* error condition 20 */ +#define EGIVBR_WPFAIL 0x01 /* write post fail error cond 20 */ +#define EGIVBR_ABTTO 0x02 /* arbitration time out err con 20 */ +#define EGIVBR_SYSFAIL 0x03 /* SYSFAIL* error condition 20 */ +#define EGIVBR_VIIA 0x04 /* VMEbus Interrupter Interrupt 20 */ + /* Acknowledge error condition 20 */ +#define EGIVBR_DMAI 0x05 /* DMA Interrupt 20 */ +#define EGIVBR_VEC_MASK 0xf8 /* EGIRQ vector base mask */ + +/*************************************************************** +* ICSR 0x17 0x5f Interprocessor Comm Switch Reg * +****************************************************************/ + +#define ICSR_ICMS0 0x01 /* set ICMS0 0 */ +#define ICSR_ICMS1 0x02 /* set ICMS1 1 */ +#define ICSR_ICMS2 0x04 /* set ICMS2 2 */ +#define ICSR_ICMS3 0x08 /* set ICMS3 3 */ + +/* ICGS (read only) */ + +#define ICSR_ICGS0 0x10 /* set ICGS0 4 */ +#define ICSR_ICGS1 0x20 /* set ICGS1 5 */ +#define ICSR_ICGS2 0x40 /* set ICGS2 6 */ +#define ICSR_ICGS3 0x80 /* set ICGS3 7 */ + +/*************************************************************** +* ICR0 0x18 0x63 Interprocessor Comm. Reg #0 * +* to * +* ICR4 0x1c 0x73 Interprocessor Comm. Reg #4 * +****************************************************************/ + +/* none */ + +/*************************************************************** +* ICR5 0x1d 0x77 Interprocessor Comm. Reg #5 * +* (VIC ID Register) * +****************************************************************/ + +/* none - revisions are referred to by the hex code */ + +/*************************************************************** +* ICR6 0x1e 0x7b Interprocessor Comm. Reg #6 * +****************************************************************/ + +/* XXX should the following fields be 6 or 7 bits wide ? */ + +#define ICR6_HALT 0x3d /* VIC detected VME HALT 50 */ +#define ICR6_IRESET 0x3e /* VIC performing reset function 50 */ +#define ICR6_SYSRESET 0x3f /* VMEbus SYSRESET 50 */ +#define ICR6_HALT_IRESET 0x40 /* VMEbus HALT or IRESET asserted 6 */ +#define ICR6_SYSFAIL 0x40 /* assert SYSFAIL 6 */ +#define ICR6_ACFAIL 0x80 /* ACFAIL state 7 */ + +/*************************************************************** +* ICR7 0x1f 0x7f Interprocessor Comm. Reg #7 * +****************************************************************/ + +#define ICR7_ICR0 0x01 /* ICR0 semaphore 0 */ +#define ICR7_ICR1 0x02 /* ICR1 semaphore 1 */ +#define ICR7_ICR2 0x04 /* ICR2 semaphore 2 */ +#define ICR7_ICR3 0x08 /* ICR3 semaphore 3 */ +#define ICR7_ICR4 0x10 /* ICR4 semaphore 4 */ +#define ICR7_MASTER 0x20 /* the VIC is VMEbus master 5 */ +#define ICR7_RESET 0x40 /* assert RESET* and HALT* 6 */ +#define ICR7_SYSFAIL_INH 0x80 /* inhibit SYSFAIL* assertion 7 */ + +/***************************************************************** +* VIRSR 0x20 0x83 VME Interrupt Request/Status Reg * +******************************************************************/ + +#define VIRSR_IRQ_ENA 0x01 /* VMEbus interrupt enable 0 */ +#define VIRSR_IRQ1 0x02 /* assert on VMEbus, VME IRQ 1 1 */ +#define VIRSR_IRQ2 0x04 /* assert on VMEbus, VME IRQ 2 2 */ +#define VIRSR_IRQ3 0x08 /* assert on VMEbus, VME IRQ 3 3 */ +#define VIRSR_IRQ4 0x10 /* assert on VMEbus, VME IRQ 4 4 */ +#define VIRSR_IRQ5 0x20 /* assert on VMEbus, VME IRQ 5 5 */ +#define VIRSR_IRQ6 0x40 /* assert on VMEbus, VME IRQ 6 6 */ +#define VIRSR_IRQ7 0x80 /* assert on VMEbus, VME IRQ 7 7 */ + +/*************************************************************** +* VIVR1 0x21 0x87 VME Interrupt Vector Reg #1 * +* to * +* VIVR7 0x27 0xaf VME Interrupt Vector Reg #7 * +****************************************************************/ + +/* none */ + +/*************************************************************** +* TTR 0x28 0xa3 Transfer Time-out Reg * +****************************************************************/ + +#define TTR_VTO_ACQ_EXC 0x00 /* exclude aquisition time 0 */ +#define TTR_VTO_ACQ_INC 0x01 /* include aquisition time 0 */ +#define TTR_ARBTO 0x02 /* arbitration timeout occured 1 */ +#define TTR_LTO_4 0x00 /* local 4 us time out 42 */ +#define TTR_LTO_16 0x04 /* local 16 us time out 42 */ +#define TTR_LTO_32 0x08 /* local 32 us time out 42 */ +#define TTR_LTO_64 0x0c /* local 64 us time out 42 */ +#define TTR_LTO_128 0x10 /* local 128 us time out 42 */ +#define TTR_LTO_256 0x14 /* local 256 us time out 42 */ +#define TTR_LTO_512 0x18 /* local 512 us time out 42 */ +#define TTR_LTO_INF 0x1c /* local infinite time out 42 */ +#define TTR_VTO_4 0x00 /* VMEbus 4 us time out 75 */ +#define TTR_VTO_16 0x20 /* VMEbus 16 us time out 75 */ +#define TTR_VTO_32 0x40 /* VMEbus 32 us time out 75 */ +#define TTR_VTO_64 0x60 /* VMEbus 64 us time out 75 */ +#define TTR_VTO_128 0x80 /* VMEbus 128 us time out 75 */ +#define TTR_VTO_256 0xa0 /* VMEbus 256 us time out 75 */ +#define TTR_VTO_512 0xc0 /* VMEbus 512 us time out 75 */ +#define TTR_VTO_INF 0xe0 /* VMEbus infinite time out 75 */ + +/*************************************************************** +* LBTR 0x29 0xa7 Local Bus Timing Reg * +****************************************************************/ + +#define LBTR_PASL_2 0x00 /* PAS low 2 * 64 MHz clocks 30 */ +#define LBTR_PASL_3 0x01 /* PAS low 3 * 64 MHz clocks 30 */ +#define LBTR_PASL_4 0x02 /* PAS low 4 * 64 MHz clocks 30 */ +#define LBTR_PASL_5 0x03 /* PAS low 5 * 64 MHz clocks 30 */ +#define LBTR_PASL_6 0x04 /* PAS low 6 * 64 MHz clocks 30 */ +#define LBTR_PASL_7 0x05 /* PAS low 7 * 64 MHz clocks 30 */ +#define LBTR_PASL_8 0x06 /* PAS low 8 * 64 MHz clocks 30 */ +#define LBTR_PASL_9 0x07 /* PAS low 9 * 64 MHz clocks 30 */ +#define LBTR_PASL_10 0x08 /* PAS low 10 * 64 MHz clocks 30 */ +#define LBTR_PASL_11 0x09 /* PAS low 11 * 64 MHz clocks 30 */ +#define LBTR_PASL_12 0x0a /* PAS low 12 * 64 MHz clocks 30 */ +#define LBTR_PASL_13 0x0b /* PAS low 13 * 64 MHz clocks 30 */ +#define LBTR_PASL_14 0x0c /* PAS low 14 * 64 MHz clocks 30 */ +#define LBTR_PASL_15 0x0d /* PAS low 15 * 64 MHz clocks 30 */ +#define LBTR_PASL_16 0x0e /* PAS low 16 * 64 MHz clocks 30 */ +#define LBTR_PASL_17 0x0f /* PAS low 17 * 64 MHz clocks 30 */ + +#define LBTR_DS_1 0x00 /* DS 1 * 64 MHz clocks 4 */ +#define LBTR_DS_2 0x10 /* DS 2 * 64 MHz clocks 4 */ + +#define LBTR_PASH_1 0x00 /* PAS high 1 * 64 MHz clocks 75 */ +#define LBTR_PASH_2 0x20 /* PAS high 2 * 64 MHz clocks 75 */ +#define LBTR_PASH_3 0x40 /* PAS high 3 * 64 MHz clocks 75 */ +#define LBTR_PASH_4 0x60 /* PAS high 4 * 64 MHz clocks 75 */ +#define LBTR_PASH_5 0x80 /* PAS high 5 * 64 MHz clocks 75 */ +#define LBTR_PASH_6 0xa0 /* PAS high 6 * 64 MHz clocks 75 */ +#define LBTR_PASH_7 0xc0 /* PAS high 7 * 64 MHz clocks 75 */ +#define LBTR_PASH_8 0xe0 /* PAS high 8 * 64 MHz clocks 75 */ + +/*************************************************************** +* BTDR 0x2a 0xab Block Transfer Definition Reg * +****************************************************************/ + +#define BTDR_DPADEN 0x01 /* enable dual path DPADEN 0 */ +#define BTDR_AMSR 0x02 /* use AMSR for BT add modifier 1 */ +#define BTDR_LBTDMA_ENA 0x04 /* enable local BT 256 byte DMA 2 */ +#define BTDR_VBTDMA_ENA 0x08 /* enable VME BT 256 byte DMA 3 */ + +/*************************************************************** +* ICR 0x2b 0xaf Interface Configuration Reg * +****************************************************************/ + +#define ICR_SCON 0x01 /* system controller pin 0 */ +#define ICR_TURBO 0x02 /* speed up transfers 1 */ +#define ICR_MORE_SETTLE_TIME 0x04 /* add 1 64 MHz intvl to async pins2 */ +#define ICR_DLK_RMC_NO_RETRY 0x08 /* enable deadlock signalling 3 */ +#define ICR_DLK_RETRY 0x10 /* signal deadlock with HALT* 4 */ +#define ICR_REQ_RMC 0x20 /* request bus if RMC* is asserted 5 */ +#define ICR_AS_STRETCH 0x40 /* strech AS* 6 */ +#define ICR_AS_SIZE 0x80 /* use size information for AS* 7 */ + +/*************************************************************** +* ARCR 0x2c 0xb3 Arbiter/Requester Config. Reg * +****************************************************************/ + +#define ARCR_NOT_FAIR 0x00 /* disable fairness 30 */ +#define ARCR_NO_TOUT 0x0f /* disable timeout 30 */ +#define ARCR_DRAM_REFRESH 0x10 /* enable DRAM refresh 4 */ + +#define ARCR_VBRL_BR0 0x00 /* VME bus request level BR0 65 */ +#define ARCR_VBRL_BR1 0x20 /* VME bus request level BR1 65 */ +#define ARCR_VBRL_BR2 0x40 /* VME bus request level BR2 65 */ +#define ARCR_VBRL_BR3 0x60 /* VME bus request level BR3 65 */ + +#define ARCR_RND_ROBIN 0x00 /* select round robin arbitration 7 */ +#define ARCR_PRIORITY 0x80 /* select priority arbitration 7 */ + +/*************************************************************** +* AMSR 0x2d 0xb7 AM Source Reg * +****************************************************************/ + + /* Extended (A32) address modifier codes */ + +#define AMSR_EXT_USR_DATA 0x09 /* user data 50 */ +#define AMSR_EXT_USR_PROG 0x0a /* user program access 50 */ +#define AMSR_EXT_USR_BLOCK 0x0b /* user block transfer access 50 */ +#define AMSR_EXT_SPR_DATA 0x0d /* supervisory data access 50 */ +#define AMSR_EXT_SPR_PROG 0x0e /* supervisory program access 50 */ +#define AMSR_EXT_SPR_BLOCK 0x0f /* super block transfer access 50 */ + + /* AMSR_Short (A16) address modifier codes */ + +#define AMSR_SHT_USR_ACCESS 0x29 /* user access 50 */ +#define AMSR_SHT_SPR_ACCESS 0x2d /* supervisory access 50 */ + + /* AMSR_Standard (A24) address modifier codes */ + +#define AMSR_STD_USR_DATA 0x39 /* user data 50 */ +#define AMSR_STD_USR_PROG 0x3a /* user program access 50 */ +#define AMSR_STD_USR_BLOCK 0x3b /* user block transfer access 50 */ +#define AMSR_STD_SPR_DATA 0x3d /* supervisory data access 50 */ +#define AMSR_STD_SPR_PROG 0x3e /* supervisory program access 50 */ +#define AMSR_STD_SPR_BLOCK 0x3f /* super block transfer access 50 */ + + /* AMSR_during slave access/cycles */ + +#define AMSR_SLV_CMP_ALL 0x00 /* all 6 add modifier bits comp 6 */ +#define AMSR_SLV_CMP_3MSB 0x40 /* only 3 most significant add 6 */ + /* modifier bits compared */ + + /* Master access/cycles */ + +#define AMSR_MSTR_CMP_ALL 0x00 /* all 6 add modifier bits used 7 */ +#define AMSR_MSTR_CMP_3MSB 0x80 /* only 3 most significant add 7 */ + /* modifier bits used */ + +/*************************************************************** +* BESR 0x2e 0xbb Bus Error Status Reg * +****************************************************************/ + +#define BESR_LBTOA 0x01 /* local bus time out during 0 */ + /* attempted acquisition */ +#define BESR_SA_SLSEL1 0x02 /* self-access by SLSEL1 1 */ +#define BESR_SA_SLSEL0 0x04 /* self-access by SLSEL0 2 */ +#define BESR_LBTO 0x08 /* local bus time out 3 */ +#define BESR_VBTO 0x10 /* VMEbus time out (bus master) 4 */ +#define BESR_VBERR 0x20 /* VMEbus bus error BERR* 5 */ +#define BESR_LBERR 0x40 /* local bus error LBERR* 6 */ +#define BESR_MASTER 0x80 /* the VIC is VMEbus master 7 */ + +/*************************************************************** +* DSR 0x2f 0xbf DMA Status Reg * +****************************************************************/ + +#define DSR_INTER_DMA 0x01 /* interleaved DMA in progress 0 */ +#define DSR_LBERR_DMA 0x02 /* local bus error LBERR* during DMA 1 */ +#define DSR_VBERR_DMA 0x04 /* VMEbus bus error BERR* during DMA 2 */ +#define DSR_LBERR 0x08 /* local bus error LBERR* asserted 3 */ +#define DSR_VBERR 0x10 /* VMEbus bus error BERR* asserted 4 */ +#define DSR_BTDMA 0x60 /* VME/local 256 byte address error 65 */ +#define DSR_MASTER_WP 0x80 /* master write post info is stored 7 */ + +/****************************************************************/ +/* SS0CR0 0x30 0xc3 Slave Select 0/Control Reg #0 */ +/* and */ +/* SS1CR0 0x32 0xcb Slave Select 1/Control Reg #0 */ +/****************************************************************/ + +/* SS0CR0 and SS1CR0 */ + +#define SSCR0_BLT_NONE 0x00 /* no block transfer allowed 10 */ +#define SSCR0_BLT_LOCAL 0x01 /* emulate blck trans on local bus 10 */ +#define SSCR0_BLT_ACC 0x02 /* accelerated block transfer 10 */ + +#define SSCR0_ASIZ_A32 0x00 /* A32 address size 32 */ +#define SSCR0_ASIZ_A24 0x04 /* A24 address size 32 */ +#define SSCR0_ASIZ_A16 0x08 /* A16 address size 32 */ +#define SSCR0_ASIZ_AMREG 0x0c /* use Addr Modifier source reg 32 */ + +#define SSCR0_SLSEL_D32 0x10 /* D32 SLSEL[01]* data size 4 */ +#define SSCR0_SLSEL_D16 0x00 /* D32 SLSEL[01]* data size 4 */ + +#define SSCR0_SLSEL_SPR 0x20 /* supervisory SLSEL[01]* access only 5 */ +#define SSCR0_SLSEL_ALL 0x00 /* all modes SLSEL[01]* access 5 */ + +/* SS1CR0 */ + +#define SSCR0_MASTER_WP 0x40 /* enable master write posting 6 */ +#define SSCR0_MASTER_NWP 0x00 /* no master write posting 6 */ + +#define SSCR0_SLAVE_WP 0x80 /* enable slave write posting 7 */ +#define SSCR0_SLAVE_NWP 0x00 /* no slave write posting 7 */ + +/* SS0CR0 */ + +#define SSCR0_TIMER_MASK 0x3f /* timer field mask */ +#define SSCR0_TIMER_DIS 0x00 /* timer disabled 76 */ +#define SSCR0_TIMER_50 0x40 /* 50 Hz timer (output on LIRQ2*) 76 */ +#define SSCR0_TIMER_1000 0x80 /* 1000 Hz timer (outpt on LIRQ2*) 76 */ +#define SSCR0_TIMER_100 0xc0 /* 100 Hz timer (output on LIRQ2*) 76 */ + +/*************************************************************** +* SS0CR1 0x31 0xc7 Slave Select 0/Control Reg #1 * +* and * +* SS1CR1 0x33 0xcf Slave Select 1/Control Reg #1 * +****************************************************************/ + +#define SSCR1_DTACK_0 0x00 /* 0 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_2 0x01 /* 2 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_25 0x02 /* 2.5 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_3 0x03 /* 3 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_35 0x04 /* 3.5 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_4 0x05 /* 4 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_45 0x06 /* 4.5 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_5 0x07 /* 5 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_55 0x08 /* 5.5 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_6 0x09 /* 6 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_65 0x0a /* 6.5 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_7 0x0b /* 7 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_75 0x0c /* 7.5 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_8 0x0d /* 8 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_85 0x0e /* 8.5 x 64 Mhz DTACK* delay 30 */ +#define SSCR1_DTACK_9 0x0f /* 9 x 64 Mhz DTACK* delay 30 */ + +#define SSCR1_DSACK_0 0x00 /* 0 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_2 0x10 /* 2 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_25 0x20 /* 2.5 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_3 0x30 /* 3 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_35 0x40 /* 3.5 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_4 0x50 /* 4 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_45 0x60 /* 4.5 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_5 0x70 /* 5 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_55 0x80 /* 5.5 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_6 0x90 /* 6 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_65 0xa0 /* 6.5 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_7 0xb0 /* 7 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_75 0xc0 /* 7.5 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_8 0xd0 /* 8 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_85 0xe0 /* 8.5 x 64 Mhz DTACK* delay 74 */ +#define SSCR1_DSACK_9 0xf0 /* 9 x 64 Mhz DTACK* delay 74 */ + +/*************************************************************** +* RCR 0x34 0xd3 Release Control Reg * +****************************************************************/ + +#define RCR_ROR 0x00 /* release on request 76 */ +#define RCR_RWD 0x40 /* release when done 76 */ +#define RCR_ROC 0x80 /* release on BCLR* 76 */ +#define RCR_BCAP 0xc0 /* bus capture and hold 76 */ + +/*************************************************************** +* BTCR 0x35 0xd7 Block Transfer Control Reg * +****************************************************************/ + +#define BTCR_LCIP_MASK 0x0f /* local cycle interl've period mk 30 */ + +#define BTCR_DMA_WRITE 0x10 /* write DMA enable 4 */ + + /* Note: bits 7, 6 and 5 are mutually exclusive */ + +#define BTCR_MBT 0x20 /* enable MOVEM type block trsfer 5 */ +#define BTCR_VDMA_GO 0x40 /* initiate VME DMA block trsfer 6 */ +#define BTCR_LDMA_GO 0x80 /* initiate local DMA block trsfer 7 */ + +/*************************************************************** +* BTLR0 0x36 0xdb Block Transfer Length Reg #0 * +* and * +* BTLR1 0x37 0xdf Block Transfer Length Reg #1 * +****************************************************************/ + +/* none */ + +/*************************************************************** +* SRR 0x38 0xe3 System Reset Reg * +****************************************************************/ + +#define SRR_SYSRESET 0xf0 /* assert SYSRESET on the VMEbus and */ + /* reset all reset-able VIC registers */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvic068h */ diff --git a/h/drv/vme/vme2Pci.h b/h/drv/vme/vme2Pci.h new file mode 100644 index 0000000..9a62282 --- /dev/null +++ b/h/drv/vme/vme2Pci.h @@ -0,0 +1,112 @@ +/* vme2Pci.h - vme2pci chip configuration header */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,13nov96,mas added VME2PCI_IO_OFFSET (SPR 7475). +01c,28feb95,caf removed MSW() macro (now in vxWorks.h). +01b,20jan95,vin clean up & enhancements. +01a,09jan95,kvk created. +*/ + +/* +This file contains type declarations for the vme2pci chip Header +and the macros for the PCI BUS. This header has been designed +with respect to Genesis 1.5 Engineering Specification Version 1.0A. +Configuration registers have to be accessed as long words. +*/ + + +#ifndef INCvme2Pcih +#define INCvme2Pcih + + +#ifdef _ASMLANGUAGE +#define CASTB +#else +#define CASTB (char *) +#endif /* _ASMLANGUAGE */ + + +#define VME2PCI_REG_INTERVAL 4 + +/* to permit alternative board addressing */ +#ifndef VME2PCI_IACK_ADRS +#define VME2PCI_IACK_ADRS(reg) (CASTB (VME2PCI_BASE_ADRS + \ + (0xF007) + \ + (reg * VME2PCI_REG_INTERVAL))) +#endif /* VME2PCI_ADRS */ + +/* + * Defines for the VME2PCI interrupt acknowledge registers + */ + +#define VME2PCI_IACK_LEVEL1 VME2PCI_IACK_ADRS(0x00) +#define VME2PCI_IACK_LEVEL2 VME2PCI_IACK_ADRS(0x01) +#define VME2PCI_IACK_LEVEL3 VME2PCI_IACK_ADRS(0x02) +#define VME2PCI_IACK_LEVEL4 VME2PCI_IACK_ADRS(0x03) +#define VME2PCI_IACK_LEVEL5 VME2PCI_IACK_ADRS(0x04) +#define VME2PCI_IACK_LEVEL6 VME2PCI_IACK_ADRS(0x05) +#define VME2PCI_IACK_LEVEL7 VME2PCI_IACK_ADRS(0x06) + + +/* configuration space header */ + +typedef struct + { +#if (_BYTE_ORDER == _BIG_ENDIAN) + UINT16 pciSlvEndAddr1; /* slave end addr1 0x40 */ + UINT16 pciSlvStrtAddr1; /* slave start addr1 0x42 */ + UINT16 pciSlvEnable1; /* pci slave enable 1 0x44 */ + UINT16 pciSlvAddrOffset1; /* addr offset 1 0x46 */ + UINT16 pciSlvEndAddr2; /* slave end addr2 0x48 */ + UINT16 pciSlvStrtAddr2; /* slave start addr2 0x4A */ + UINT16 pciSlvEnable2; /* pci slave enable 2 0x4C */ + UINT16 pciSlvAddrOffset2; /* addr offset 2 0x4E */ +#else + UINT16 pciSlvStrtAddr1; /* slave start addr1 0x40 */ + UINT16 pciSlvEndAddr1; /* slave end addr1 0x42 */ + UINT16 pciSlvAddrOffset1; /* addr offset 1 0x44 */ + UINT16 pciSlvEnable1; /* pci slave enable 1 0x46 */ + UINT16 pciSlvStrtAddr2; /* slave start addr2 0x48 */ + UINT16 pciSlvEndAddr2; /* slave end addr2 0x4A */ + UINT16 pciSlvAddrOffset2; /* addr offset 2 0x4C */ + UINT16 pciSlvEnable2; /* pci slave enable 2 0x4E */ +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + UINT32 pciIntEnable; /* pending intrpt enabl 0x50 */ + + } VME2PCI_CNFG_HDR; + + +#define VME2PCI_CNFG_OFFSET 0x40 /* offset vme2Pci specific part */ +#define VME2PCI_IO_OFFSET 0xF840 /* offset vme2Pci specific IO space */ + +/* vme2pci device specific masks */ + +#define VME2PCI_SLV_ADDR_MASK 0xffff0000 /* pci slave addr mask */ +#define VME2PCI_SLV_EN_MASK 0x00010000 /* slave enable mask */ +#define VME2PCI_INT_MASK 0x00000008 /* vme2PCI interrupt mask */ +#define VME2PCI_INT_LVL_MASK 0x00000007 /* vme2PCI intr level mask */ + +#define VME2PCI_INT_LVL_GET(x) (x & VME2PCI_INT_LVL_MASK) + +#define VME2PCI_SLAVE_ENABLE 0x0001 /* slave enable flag */ +#define VME2PCI_INT_ENABLE 0x00000008 /* Vme2PCI interrupt enable */ + +/* pci function declerations */ +#if defined(__STDC__) || defined(__cplusplus) + +extern int sysVme2PciInit (VME2PCI_CNFG_HDR * pVme2PciCnfgHdr, + ULONG vme2PciCnfgBase); + +#else + +extern int sysVme2PciInit (); + +#endif /* __STDC__ */ + +#endif /* INCvme2Pcih */ + + diff --git a/h/drv/vme/vmechip.h b/h/drv/vme/vmechip.h new file mode 100644 index 0000000..26e701b --- /dev/null +++ b/h/drv/vme/vmechip.h @@ -0,0 +1,333 @@ +/* vmechip.h - Motorola MVME6000 VMEbus Interface Controller */ + +/* Copyright 1991-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01f,29sep98,fle doc : made it refgen parsable +01e,22sep92,rrr added support for c++ +01d,03jun92,ccc added a few more constants. +01c,26may92,rrr the tree shuffle +01b,02jan92,caf fixed GLOBAL_0 bits. changed copyright notice. +01a,19dec91,caf written. +*/ + +#ifdef DOC +#define INCvmechiph +#endif /* DOC */ + +#ifndef __INCvmechiph +#define __INCvmechiph + +#ifdef __cplusplus +extern "C" { +#endif + +/* +This file contains constants for the Motorola MVME6000 VMEbus Interface. +The macro VMECHIP_BASE_ADRS must be defined when using local bus addresses +defined in this header. The macro GCSR_BUS_BASE_ADRS must be defined when +using VMEbus addresses defined in this header. + +The following standards have been adopted in the creation of this file. + +Registers in the LCSR have the prefix "LCSR". + +Registers in the GCSR have the prefix "GCSR" when addressed locally and the +prefix "GCSR_BUS" when addressed from the VMEbus. The bit definitions are +shared. + +The registers are listed in ascending (numerical) order; the definitions +for each register start with a header, e.g.: + + Register Register Register Register + Mnemonic Number Address Name + | | | | + v v v v +************************************************************************* +* SYS_CONF 0x00 0x01 system controller config * +************************************************************************* + +In cases where a number of registers have the same definitions, the +header looks like this: + +************************************************************************* +* GP_CSR_0 0x13 0x27 general purpose CSR 0 * +* to * +* GP_CSR_4 0x17 0x2f general purpose CSR 4 * +************************************************************************* + +The format of the definitions is as follows. The define name always +starts with the register mnemonic it is associated with. The [7-0] +number at the end of the comment indicates the bit position to which the +the define applies. In the definition of RQST_CONF_DWB, for example, +the 7 indicates bit 7: + | + v + define RQST_CONF_DWB 0x80 * device wants bus 7 * + +If the define applies to more than one bit, then the applicable bit +range is specified by two digits. In the following example, +TMO_CONF_VBTO_2048 applies to the two bit field, bits 5-4: + | + v + define TMO_CONF_VBTO_2048 0x10 * VMEbus time-out 2048 * T 54 * + +If no bit field is given, then the define applies to the whole register. +*/ + +#ifdef _ASMLANGUAGE +#define CAST +#else +#define CAST (char *) +#endif /* _ASMLANGUAGE */ + +#define VMECHIP_REG_INTERVAL 2 + +#ifndef VMECHIP_ADRS /* to permit alternative board addressing */ +#define VMECHIP_ADRS(reg) \ + (CAST (VMECHIP_BASE_ADRS + 1 + (reg * VMECHIP_REG_INTERVAL))) +#endif /* VMECHIP_ADRS */ + +/* + * Local Control and Status Register (LCSR) definitions. + * + * Only the local CPU can access the LCSR. + */ + +#define LCSR_SYS_CONF VMECHIP_ADRS(0x00) /* system controller config */ +#define LCSR_RQST_CONF VMECHIP_ADRS(0x01) /* requester configuration */ +#define LCSR_MASTER_CONF VMECHIP_ADRS(0x02) /* master configuration */ +#define LCSR_SLAVE_CONF VMECHIP_ADRS(0x03) /* slave configuration */ +#define LCSR_TMO_CONF VMECHIP_ADRS(0x04) /* timer configuration */ +#define LCSR_SLAVE_AM VMECHIP_ADRS(0x05) /* slave address modifier */ +#define LCSR_MASTER_AM VMECHIP_ADRS(0x06) /* master address modifier */ +#define LCSR_INT_MASK VMECHIP_ADRS(0x07) /* interrupt handler mask */ +#define LCSR_UTIL_INT_MASK VMECHIP_ADRS(0x08) /* utility interrupt mask */ +#define LCSR_UTIL_VEC_BASE VMECHIP_ADRS(0x09) /* utility interrupt vector */ +#define LCSR_INT_REQ VMECHIP_ADRS(0x0a) /* interrupt request */ +#define LCSR_INT_STATUS_ID VMECHIP_ADRS(0x0b) /* status/ID */ +#define LCSR_BERR_STATUS VMECHIP_ADRS(0x0c) /* bus error status */ +#define LCSR_GCSR_BASE_ADRS VMECHIP_ADRS(0x0d) /* GCSR base address */ + + +/* + * Global Control and Status Register (GCSR) definitions. + * + * All registers of the GCSR are accessible to both the local processor + * and to other VMEbus masters. + */ + +/* local addresses for the GCSR */ + +#define GCSR_GLOBAL_0 VMECHIP_ADRS(0x10) /* global 0 */ +#define GCSR_GLOBAL_1 VMECHIP_ADRS(0x11) /* global 1 */ +#define GCSR_BOARD_ID VMECHIP_ADRS(0x12) /* board ID */ +#define GCSR_GP_CSR_0 VMECHIP_ADRS(0x13) /* general purpose CSR 0 */ +#define GCSR_GP_CSR_1 VMECHIP_ADRS(0x14) /* general purpose CSR 1 */ +#define GCSR_GP_CSR_2 VMECHIP_ADRS(0x15) /* general purpose CSR 2 */ +#define GCSR_GP_CSR_3 VMECHIP_ADRS(0x16) /* general purpose CSR 3 */ +#define GCSR_GP_CSR_4 VMECHIP_ADRS(0x17) /* general purpose CSR 4 */ + +/* VMEbus addresses for the GCSR */ + +#define GCSR_BUS_REG_INTERVAL 2 + +#ifndef GCSR_BUS_ADRS /* to permit alternative off-board addressing */ +#define GCSR_BUS_ADRS(reg) \ + (CAST (GCSR_BUS_BASE_ADRS + 1 + (reg * GCSR_BUS_REG_INTERVAL))) +#endif /* GCSR_BUS_ADRS */ + +#define GCSR_BUS_GLOBAL_0 GCSR_BUS_ADRS(0x00) /* global 0 on VMEbus */ +#define GCSR_BUS_GLOBAL_1 GCSR_BUS_ADRS(0x01) /* global 1 on VMEbus */ +#define GCSR_BUS_BOARD_ID GCSR_BUS_ADRS(0x02) /* board ID on VMEbus */ +#define GCSR_BUS_GP_CSR_0 GCSR_BUS_ADRS(0x03) /* general purp. 0 on VMEbus */ +#define GCSR_BUS_GP_CSR_1 GCSR_BUS_ADRS(0x04) /* general purp. 1 on VMEbus */ +#define GCSR_BUS_GP_CSR_2 GCSR_BUS_ADRS(0x05) /* general purp. 2 on VMEbus */ +#define GCSR_BUS_GP_CSR_3 GCSR_BUS_ADRS(0x06) /* general purp. 3 on VMEbus */ +#define GCSR_BUS_GP_CSR_4 GCSR_BUS_ADRS(0x07) /* general purp. 4 on VMEbus */ + + +/* SYS_CONF 0x00 0x01 system controller config */ + +#define SYS_CONF_SCON 0x01 /* system controller on (status) 0 */ +#define SYS_CONF_SRESET 0x02 /* system reset 1 */ +#define SYS_CONF_BRDFAIL 0x04 /* board fail 2 */ +#define SYS_CONF_ROBIN 0x08 /* round robin select 3 */ +#define SYS_CONF_PRIORITY 0x00 /* priority mode select 3 */ + +/* RQST_CONF 0x01 0x03 requester configuration */ + +#define RQST_CONF_RQLEV 0x03 /* VMEbus request level (mask) 10 */ +#define RQST_CONF_RQLEV_0 0x00 /* VMEbus request level 0 10 */ +#define RQST_CONF_RQLEV_1 0x01 /* VMEbus request level 1 10 */ +#define RQST_CONF_RQLEV_2 0x02 /* VMEbus request level 2 10 */ +#define RQST_CONF_RQLEV_3 0x03 /* VMEbus request level 3 10 */ + +#define RQST_CONF_RNEVER 0x08 /* release never 3 */ +#define RQST_CONF_RWD 0x10 /* release when done 4 */ +#define RQST_CONF_ROR 0x00 /* release on request 4 */ +#define RQST_CONF_RONR 0x20 /* request on no request 5 */ +#define RQST_CONF_DHB 0x40 /* device has bus (status) 6 */ +#define RQST_CONF_DWB 0x80 /* device wants bus 7 */ + +/* MASTER_CONF 0x02 0x05 master configuration */ + +#define MASTER_CONF_MASD16 0x01 /* master D16 0 */ +#define MASTER_CONF_MASD32 0x00 /* master D32, D16, D8 0 */ +#define MASTER_CONF_MASA32 0x00 /* master A32 1 */ +#define MASTER_CONF_MASA24 0x02 /* master A24 1 */ +#define MASTER_CONF_MASA16 0x04 /* master A16 2 */ +#define MASTER_CONF_MASUAT 0x08 /* master unaligned transfers 3 */ +#define MASTER_CONF_CFILL 0x10 /* cache fill 4 */ +#define MASTER_CONF_MASWP 0x20 /* master write-posting (CAUTION) 5 */ +#define MASTER_CONF_020 0x40 /* local CPU is a 68020 6 */ +#define MASTER_CONF_DDTACK 0x80 /* extra delay for 33MHz 020/030 7 */ + +/* SLAVE_CONF 0x03 0x07 slave configuration */ + +#define SLAVE_CONF_SLVD16 0x01 /* slave D16 0 */ +#define SLAVE_CONF_SLVWP 0x20 /* slave write-posting (CAUTION) 5 */ +#define SLAVE_CONF_SLVEN 0x80 /* slave enable 7 */ +#define SLAVE_CONF_SLVDIS 0x00 /* slave disable 7 */ + +/* TMO_CONF 0x04 0x09 timer configuration */ + +#define TMO_CONF_LBTO 0x03 /* local bus time-out (mask) 10 */ +#define TMO_CONF_LBTO_1024 0x00 /* local bus time-out 1024 * T 10 */ +#define TMO_CONF_LBTO_2048 0x01 /* local bus time-out 2048 * T 10 */ +#define TMO_CONF_LBTO_4096 0x02 /* local bus time-out 4096 * T 10 */ +#define TMO_CONF_LBTO_DIS 0x03 /* local bus time-out disabled 10 */ + +#define TMO_CONF_ACTO 0x0c /* access time-out (mask) 32 */ +#define TMO_CONF_ACTO_1024 0x00 /* access time-out 1024 * T 32 */ +#define TMO_CONF_ACTO_16384 0x04 /* access time-out 16384 * T 32 */ +#define TMO_CONF_ACTO_524 0x08 /* access time-out 524290 * T 32 */ +#define TMO_CONF_ACTO_DIS 0x0c /* access time-out disabled 32 */ + +#define TMO_CONF_VBTO 0x30 /* VMEbus time-out (mask) 54 */ +#define TMO_CONF_VBTO_1024 0x00 /* VMEbus time-out 1024 * T 54 */ +#define TMO_CONF_VBTO_2048 0x10 /* VMEbus time-out 2048 * T 54 */ +#define TMO_CONF_VBTO_4096 0x20 /* VMEbus time-out 4096 * T 54 */ +#define TMO_CONF_VBTO_DIS 0x30 /* VMEbus time-out disabled 54 */ + +#define TMO_CONF_ARBTO 0x40 /* arbitration timer 6 */ + +/* SLAVE_AM 0x05 0x0b slave address modifier */ + +#define SLAVE_AM_DATA 0x01 /* respond to data 0 */ +#define SLAVE_AM_PROGRAM 0x02 /* respond to program 1 */ +#define SLAVE_AM_BLOCK 0x04 /* respond to block (never set) 2 */ + +#define SLAVE_AM_SHORT 0x08 /* respond to short 3 */ +#define SLAVE_AM_STND 0x10 /* respond to standard 4 */ +#define SLAVE_AM_EXTED 0x20 /* respond to extended 5 */ + +#define SLAVE_AM_USER 0x40 /* respond to user 6 */ +#define SLAVE_AM_SUPER 0x80 /* respond to supervisor 7 */ + +/* MASTER_AM 0x06 0x0d master address modifier */ + +#define MASTER_AM_AM 0x3f /* address modifier code (mask) 50 */ + +#define MASTER_AM_AMSEL 0x80 /* address modifier select 7 */ +#define MASTER_AM_DYNAMIC 0x00 /* AM code dynamically determined 7 */ + +/* INT_MASK 0x07 0x0f interrupt handler mask */ + +#define INT_MASK_IEN1 0x02 /* VMEbus IRQ1 interrupt enable 1 */ +#define INT_MASK_IEN2 0x04 /* VMEbus IRQ2 interrupt enable 2 */ +#define INT_MASK_IEN3 0x08 /* VMEbus IRQ3 interrupt enable 3 */ +#define INT_MASK_IEN4 0x10 /* VMEbus IRQ4 interrupt enable 4 */ +#define INT_MASK_IEN5 0x20 /* VMEbus IRQ5 interrupt enable 5 */ +#define INT_MASK_IEN6 0x40 /* VMEbus IRQ6 interrupt enable 6 */ +#define INT_MASK_IEN7 0x80 /* VMEbus IRQ7 interrupt enable 7 */ +#define INT_MASK_DISABLE 0x00 /* Disable VMEbus interrupts */ + +/* UTIL_INT_MASK 0x08 0x11 utility interrupt mask */ + +#define UTIL_INT_MASK_SIGLEN 0x02 /* signal low interrupt enable 1 */ +#define UTIL_INT_MASK_LM0EN 0x04 /* loc. monitor 0 intrpt. enable 2 */ +#define UTIL_INT_MASK_IACKEN 0x08 /* IACK interrupt enable 3 */ +#define UTIL_INT_MASK_LM1EN 0x10 /* loc. monitor 1 intrpt. enable 4 */ +#define UTIL_INT_MASK_SIGHEN 0x20 /* signal high interrupt enable 5 */ +#define UTIL_INT_MASK_SFIEN 0x40 /* SYSFAIL interrupt enable 6 */ +#define UTIL_INT_MASK_WPERREN 0x80 /* write posting bus error enable 7 */ +#define UTIL_INT_MASK_DISABLE 0x00 /* Disable utility interrupts */ + +/* UTIL_VEC_BASE 0x09 0x13 utility interrupt vector */ + +#define UTIL_VEC_BASE_UID 0x07 /* utility interrupt ID (mask) 20 */ +#define UTIL_VEC_BASE_SIGLP 0x01 /* signal low 20 */ +#define UTIL_VEC_BASE_LM0 0x02 /* location monitor 0 20 */ +#define UTIL_VEC_BASE_IACK 0x03 /* IACK 20 */ +#define UTIL_VEC_BASE_LM1 0x04 /* location monitor 1 20 */ +#define UTIL_VEC_BASE_SIGHP 0x05 /* signal high 20 */ +#define UTIL_VEC_BASE_SYSFAIL 0x06 /* SYSFAIL 20 */ +#define UTIL_VEC_BASE_WPBERR 0x07 /* write post bus error 20 */ + +#define UTIL_VEC_BASE_UVB 0xf8 /* utility vector base (mask) 73 */ + +/* INT_REQ 0x0a 0x15 interrupt request */ + +#define INT_REQ_UID 0x07 /* interrupt request (mask) 20 */ +#define INT_REQ_NONE 0x00 /* none 20 */ +#define INT_REQ_IRQ1 0x01 /* IRQ1 20 */ +#define INT_REQ_IRQ2 0x02 /* IRQ2 20 */ +#define INT_REQ_IRQ3 0x03 /* IRQ3 20 */ +#define INT_REQ_IRQ4 0x04 /* IRQ4 20 */ +#define INT_REQ_IRQ5 0x05 /* IRQ5 20 */ +#define INT_REQ_IRQ6 0x06 /* IRQ6 20 */ +#define INT_REQ_IRQ7 0x07 /* IRQ7 20 */ + +/* INT_STATUS_ID 0x0b 0x17 status/ID */ + +/* none */ + +/* BERR_STATUS 0x0c 0x19 bus error status */ + +#define BERR_STATUS_LBTO 0x01 /* local bus time-out 0 */ +#define BERR_STATUS_ACTO 0x02 /* access time-out 1 */ +#define BERR_STATUS_VBERR 0x04 /* VMEbus bus error 2 */ +#define BERR_STATUS_RMCERR 0x08 /* RMC lock error 3 */ + +/* GCSR_BASE_ADRS 0x0d 0x1b GCSR base address */ + +#define GCSR_BASE_ADRS 0x0f /* GCSR base address (mask) 30 */ +#define GCSR_BASE_ADRS_NONE 0x0f /* GCSR not mapped on VMEbus 30 */ + +/* GLOBAL_0 0x10 0x21 global 0 */ + +#define GLOBAL_0_CHIP_ID 0x0f /* chip ID (mask) 30 */ + +#define GLOBAL_0_LM0 0x10 /* location monitor 0 4 */ +#define GLOBAL_0_LM1 0x20 /* location monitor 1 5 */ +#define GLOBAL_0_LM2 0x40 /* location monitor 2 6 */ +#define GLOBAL_0_LM3 0x80 /* location monitor 3 7 */ + +/* GLOBAL_1 0x11 0x23 global 1 */ + +#define GLOBAL_1_SIGLP 0x01 /* signal low priority 0 */ +#define GLOBAL_1_SIGHP 0x02 /* signal high priority 1 */ +#define GLOBAL_1_BRDFAIL 0x10 /* board fail 4 */ +#define GLOBAL_1_ISF 0x20 /* inhibit SYSFAIL 5 */ +#define GLOBAL_1_SCON 0x40 /* system controller on (status) 6 */ +#define GLOBAL_1_R_AND_H 0x80 /* reset and hold 7 */ + +/* BOARD_ID 0x12 0x25 board ID */ + +/* none */ + +/* + * GP_CSR_0 0x13 0x27 general purpose CSR 0 + * to + * GP_CSR_4 0x17 0x2f general purpose CSR 4 + */ + +/* none */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvmechiph */ diff --git a/h/drv/vme/vmechip2.h b/h/drv/vme/vmechip2.h new file mode 100644 index 0000000..259d661 --- /dev/null +++ b/h/drv/vme/vmechip2.h @@ -0,0 +1,1141 @@ +/* vmechip2.h - VMEbus Interface Controller */ + +/* Copyright 1991-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,26apr02,dat Adding cplusplus protection, SPR 75017 +01h,02nov98,fle removed all the full star-comment-lines in order for refgen + to parse this file +01g,03jan97,mas casting for VC2GCSR_* set to CASTUC from CASTINT (SPR 3389). +01f,19nov96,mas fixed comment lines per SPR 5428. +01e,12jan93,ccc added Miscellaneous Control Register for new chips. +01d,17jun92,ccc fixed typo, SPR 1353. +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01a,17jun91,ccc written. +*/ + +#ifdef DOC +#define __INCvmechip2h +#endif /* DOC */ + +#ifndef __INCvmechip2h +#define __INCvmechip2h + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This file contains constants for the mv167 VMEbus Interface controller. + * The macros VMECHIP2_BASE_ADRS and VC2BUS_BASE_ADRS must be defined + * when including this header. + + * The registers are listed in ascending (numerical) order; the definitions + * for each register are started with a header eg. + */ + +#ifdef _ASMLANGUAGE +#define CASTUC +#define CASTINT +#else +#define CASTUC (UCHAR *) +#define CASTINT (int *) +#endif /* _ASMLANGUAGE */ + +/* + * on-board access, register definitions + * these registers MUST BE WRITTEN 4-BYTE WRITES ONLY + * they can be read as byte, two-bytes or 4-bytes. + */ + +#define VMECHIP2_REG_INTERVAL 1 + +#ifndef VMECHIP2_ADRS /* to permit alternative board addressing */ +#define VMECHIP2_ADRS(reg) (CASTINT (VMECHIP2_BASE_ADRS + \ + (reg * VMECHIP2_REG_INTERVAL))) +#define VC2GCSR_ADRS(reg) (CASTUC (VMECHIP2_BASE_ADRS + 0x100 + \ + (reg * VMECHIP2_REG_INTERVAL))) +#endif /* VMECHIP2_ADRS */ + +#ifndef VC2BUS_ADRS /* to permit alternative board addressing */ +#define VC2BUS_ADRS(reg) (CASTINT (VC2BUS_BASE_ADRS + (reg))) +#endif /* VC2BUS_ADRS */ + +/* WRITES MUST BE 4-BYTE WRITES ONLY */ +/* + * VMEbus Slave Ending Address Register 1 0x00 31-16 + * VMEbus Slave Starting Address Register 1 0x00 15-00 + */ +#define VMECHIP2_VSAR1 VMECHIP2_ADRS(0x00) +/* + * VMEbus Slave Ending Address Register 2 0x04 31-16 + * VMEbus Slave Starting Address Register 2 0x04 15-00 + */ +#define VMECHIP2_VSAR2 VMECHIP2_ADRS(0x04) +/* + * VMEbus Slave Address Translation Address Reg 1 0x08 31-16 + * VMEbus Slave Adrs Translation Select Reg 1 0x08 15-00 + */ +#define VMECHIP2_VSATR1 VMECHIP2_ADRS(0x08) +/* + * VMEbus Slave Adrs Translation Address Reg 2 0x0c 31-16 + * VMEbus Slave Adrs Translation Select Reg 2 0x0c 15-00 + */ +#define VMECHIP2_VSATR2 VMECHIP2_ADRS(0x0c) +/* + * VMEbus Slave Write Post and Snoop Control Reg 2 0x10 31-24 + * VMEbus Slave Address Modifier Select Reg 2 0x10 23-16 + * VMEbus Slave Write Post and Snoop Control Reg 1 0x10 15-08 + * VMEbus Slave Address Modifier Select Reg 1 0x10 07-00 + */ +#define VMECHIP2_VSAMSR VMECHIP2_ADRS(0x10) +/* + * Local Bus Slave Ending Address Reg 1 0x14 31-16 + * Local Bus Slave Starting Address Reg 1 0x14 16-00 + */ +#define VMECHIP2_LBSAR1 VMECHIP2_ADRS(0x14) +/* + * Local Bus Slave Ending Address Reg 2 0x18 31-16 + * Local Bus Slave Starting Address Reg 2 0x18 15-00 + */ +#define VMECHIP2_LBSAR2 VMECHIP2_ADRS(0x18) +/* + * Local Bus Slave Ending Address Reg 3 0x1c 31-16 + * Local Bus Slave Starting Address Reg 3 0x1c 15-00 + */ +#define VMECHIP2_LBSAR3 VMECHIP2_ADRS(0x1c) +/* + * Local Bus Slave Ending Address Reg 4 0x20 31-16 + * Local Bus Slave Starting Address Reg 4 0x20 15-00 + */ +#define VMECHIP2_LBSAR4 VMECHIP2_ADRS(0x20) +/* + * Local Bus Slave Address Translation Adrs Reg 1 0x24 31-16 + * Local Bus Slave Address Translation Sel Reg 1 0x24 15-00 + */ +#define VMECHIP2_LBSATR1 VMECHIP2_ADRS(0x24) +/* + * Local Bus Slave Attribute Reg 4 0x28 31-24 + * Local Bus Slave Attribute Reg 3 0x28 23-16 + * Local Bus Slave Attribute Reg 2 0x28 15-08 + * Local Bus Slave Attribute Reg 1 0x28 07-00 + */ +#define VMECHIP2_LBSAR VMECHIP2_ADRS(0x28) +/* + * VMEbus Slave GCSR Group Address Reg 0x2c 31-24 + * VMEbus Slave GCSR Board Address Reg 0x2c 23-20 + * Local Bus To VMEbus Enable Control Reg 0x2c 19-16 + * Local Bus To VMEbus I/O Control Reg 0x2c 15-08 + * ROM Control Reg 0x2c 07-00 + */ +#define VMECHIP2_LBTVCR VMECHIP2_ADRS(0x2c) +/* + * EPROM Decoder, SRAM and DMA Control Register 0x30 23-16 + * Local Bus To VMEbus Requester Control Reg 0x30 15-08 + * DMAC Control Register 1 0x30 07-00 + */ +#define VMECHIP2_DMACR1 VMECHIP2_ADRS(0x30) +/* + * DMAC Control Register 2 0x34 15-08 + * DMAC Control Register 2 0x34 07-00 + */ +#define VMECHIP2_DMACR2 VMECHIP2_ADRS(0x34) +/* + * DMAC Local Bus Address Counter 0x38 31-00 + */ +#define VMECHIP2_DMACLBAC VMECHIP2_ADRS(0x38) +/* + * DMAC VMEbus Address Counter 0x3c 31-00 + */ +#define VMECHIP2_DMACVAC VMECHIP2_ADRS(0x3c) +/* + * DMAC Byte Counter 0x40 31-00 + */ +#define VMECHIP2_DMACBC VMECHIP2_ADRS(0x40) +/* + * Table Address Counter 0x44 31-00 + */ +#define VMECHIP2_TAC VMECHIP2_ADRS(0x44) +/* + * VMEbus Interrupter Control Register 0x48 31-24 + * VMEbus Interrupter Vector Register 0x48 23-16 + * MPU Status and DMA Interrupt Count Register 0x48 15-08 + * DMAC Status Register 0x48 07-00 + */ +#define VMECHIP2_ICR VMECHIP2_ADRS(0x48) +/* + * VMEbus Arbiter Timeout Control Register 0x4c 31-24 + * DMAC Ton/Toff Timers and VMEbus Global Timeout 0x4c 23-16 + * VME Access, Local Bus and Watchdog Timeout 0x4c 15-08 + * Prescaler Control Register 0x4c 07-00 + */ +#define VMECHIP2_TIMEOUTCR VMECHIP2_ADRS(0x4c) +/* + * Tick Timer 1 Compair Register 0x50 31-00 + */ +#define VMECHIP2_TTCOMP1 VMECHIP2_ADRS(0x50) +/* + * Tick Timer 1 Counter 0x54 31-00 + */ +#define VMECHIP2_TTCOUNT1 VMECHIP2_ADRS(0x54) +/* + * Tick Timer 2 Compair Register 0x58 31-00 + */ +#define VMECHIP2_TTCOMP2 VMECHIP2_ADRS(0x58) +/* + * Tick Timer 2 Counter 0x5c 31-00 + */ +#define VMECHIP2_TTCOUNT2 VMECHIP2_ADRS(0x5c) +/* + * Board Control Register 0x60 31-24 + * Watchdog Timer Control Register 0x60 23-16 + * Tick Timer 2 Control Register 0x60 15-08 + * Tick Timer 1 Control Register 0x60 07-00 + */ +#define VMECHIP2_TIMERCR VMECHIP2_ADRS(0x60) +/* + * Prescaler Counter 0x64 31-00 + */ +#define VMECHIP2_PRESCALE_CNT VMECHIP2_ADRS(0x64) +/* + * Local Bus Interrupter Status Reg (24-31) 0x68 31-24 + * Local Bus Interrupter Status Reg (16-23) 0x68 23-16 + * Local Bus Interrupter Status Reg (8-15) 0x68 15-08 + * Local Bus Interrupter Status Reg (0-7) 0x68 07-00 + */ +#define VMECHIP2_LBISR VMECHIP2_ADRS(0x68) +/* + * Local Bus Interrupter Enable Reg (24-31) 0x6c 31-24 + * Local Bus Interrupter Enable Reg (16-23) 0x6c 24-16 + * Local Bus Interrupter Enable Reg (8-15) 0x6c 15-08 + * Local Bus Interrupter Enable Reg (0-7) 0x6c 07-00 + */ +#define VMECHIP2_LBIER VMECHIP2_ADRS(0x6c) +/* + * Software Interrupt Set Register (8-15) 0x70 15-08 + */ +#define VMECHIP2_SISR VMECHIP2_ADRS(0x70) +/* + * Interrupt Clear Register (24-31) 0x74 31-24 + * Interrupt Clear Register (16-23) 0x74 23-16 + * Interrupt Clear Register (08-15) 0x74 15-08 + */ +#define VMECHIP2_ICLR VMECHIP2_ADRS(0x74) +/* + * Interrupt Level Register 1 (24-31) 0x78 31-24 + * Interrupt Level Register 1 (16-23) 0x78 23-16 + * Interrupt Level Register 1 (8-15) 0x78 15-08 + * Interrupt Level Register 1 (0-7) 0x78 07-00 + */ +#define VMECHIP2_ILR1 VMECHIP2_ADRS(0x78) +/* + * Interrupt Level Register 2 (24-31) 0x7c 31-24 + * Interrupt Level Register 2 (16-23) 0x7c 23-16 + * Interrupt Level Register 2 (8-15) 0x7c 15-08 + * Interrupt Level Register 2 (0-7) 0x7c 07-00 + */ +#define VMECHIP2_ILR2 VMECHIP2_ADRS(0x7c) +/* + * Interrupt Level Register 3 (24-31) 0x80 31-24 + * Interrupt Level Register 3 (16-23) 0x80 23-16 + * Interrupt Level Register 3 (8-15) 0x80 15-08 + * Interrupt Level Register 3 (0-7) 0x80 07-00 + */ +#define VMECHIP2_ILR3 VMECHIP2_ADRS(0x80) +/* + * Interrupt Level Register 4 (24-31) 0x84 31-24 + * Interrupt Level Register 4 (16-23) 0x84 23-16 + * Interrupt Level Register 4 (8-15) 0x84 15-08 + * Interrupt Level Register 4 (0-7) 0x84 07-00 + */ +#define VMECHIP2_ILR4 VMECHIP2_ADRS(0x84) +/* + * Vector Base Register 0x88 31-24 + * I/O Control Register 1 0x88 23-16 + * I/O Control Register 2 0x88 15-08 + * I/O Control Register 3 0x88 07-00 + */ +#define VMECHIP2_IOCR VMECHIP2_ADRS(0x88) +/* + * Miscellaneous Control Register 0x8c 07-00 + */ +#define VMECHIP2_MISCCR VMECHIP2_ADRS(0x8c) + +/* These Global Status and Control Register are 16-bit registers + * accessible from both the VMEbus and the local bus. + * They are byte accessible registers. + */ + +#define VC2GCSR_REVISION VC2GCSR_ADRS(0x02) /* VMEchip2 Rev Reg */ +#define VC2GCSR_ID VC2GCSR_ADRS(0x03) /* VMEchip2 ID Reg */ +#define VC2GCSR_LM_SIG VC2GCSR_ADRS(0x06) /* VMEchip2 LM/SIG Reg */ +#define VC2GCSR_BSCR VC2GCSR_ADRS(0x07) /* Board Stat/Cont Reg */ +#define VC2GCSR_GPR0H VC2GCSR_ADRS(0x0a) /* General Purpose Reg 0 */ +#define VC2GCSR_GPR0L VC2GCSR_ADRS(0x0b) /* General Purpose Reg 0 */ +#define VC2GCSR_GPR1H VC2GCSR_ADRS(0x0e) /* General Purpose Reg 1 */ +#define VC2GCSR_GPR1L VC2GCSR_ADRS(0x0f) /* General Purpose Reg 1 */ +#define VC2GCSR_GPR2H VC2GCSR_ADRS(0x12) /* General Purpose Reg 2 */ +#define VC2GCSR_GPR2L VC2GCSR_ADRS(0x13) /* General Purpose Reg 2 */ +#define VC2GCSR_GPR3H VC2GCSR_ADRS(0x16) /* General Purpose Reg 3 */ +#define VC2GCSR_GPR3L VC2GCSR_ADRS(0x17) /* General Purpose Reg 3 */ +#define VC2GCSR_GPR4H VC2GCSR_ADRS(0x1a) /* General Purpose Reg 4 */ +#define VC2GCSR_GPR4L VC2GCSR_ADRS(0x1b) /* General Purpose Reg 4 */ +#define VC2GCSR_GPR5H VC2GCSR_ADRS(0x1e) /* General Purpose Reg 5 */ +#define VC2GCSR_GPR5L VC2GCSR_ADRS(0x1f) /* General Purpose Reg 5 */ + +#define VC2BUS_REVISION VC2BUS_ADRS(0x00) /* Revision Reg */ +#define VC2BUS_ID VC2BUS_ADRS(0x01) /* ID Reg */ +#define VC2BUS_LM_SIG VC2BUS_ADRS(0x02) /* LM/SIG Reg */ +#define VC2BUS_BSCR VC2BUS_ADRS(0x03) /* Board Stat/Cont Reg */ +#define VC2BUS_GPR0H VC2BUS_ADRS(0x04) /* General Purpose Reg 0 */ +#define VC2BUS_GPR0L VC2BUS_ADRS(0x05) /* General Purpose Reg 0 */ +#define VC2BUS_GPR1H VC2BUS_ADRS(0x06) /* General Purpose Reg 1 */ +#define VC2BUS_GPR1L VC2BUS_ADRS(0x07) /* General Purpose Reg 1 */ +#define VC2BUS_GPR2H VC2BUS_ADRS(0x08) /* General Purpose Reg 2 */ +#define VC2BUS_GPR2L VC2BUS_ADRS(0x09) /* General Purpose Reg 2 */ +#define VC2BUS_GPR3H VC2BUS_ADRS(0x0a) /* General Purpose Reg 3 */ +#define VC2BUS_GPR3L VC2BUS_ADRS(0x0b) /* General Purpose Reg 3 */ +#define VC2BUS_GPR4H VC2BUS_ADRS(0x0c) /* General Purpose Reg 4 */ +#define VC2BUS_GPR4L VC2BUS_ADRS(0x0d) /* General Purpose Reg 4 */ +#define VC2BUS_GPR5H VC2BUS_ADRS(0x0e) /* General Purpose Reg 5 */ +#define VC2BUS_GPR5L VC2BUS_ADRS(0x0f) /* General Purpose Reg 5 */ + +/* NOW LET'S DEFINE THE BITS FOR THESE REGISTERS */ + +/* + * VMEbus Slave Write Post and Snoop Control Reg 2 0x10 31-24 + * VMEbus Slave Address Modifier Select Reg 2 0x10 23-16 + * VMEbus Slave Write Post and Snoop Control Reg 1 0x10 15-08 + * VMEbus Slave Address Modifier Select Reg 1 0x10 07-00 + */ +#define VSAMSR2_SNP_INHIBIT 0x00 /* Snoop Inhibited 26-25 */ +#define VSAMSR2_SNP_WSD (1 << 25) /* Write-Sink Data 26-25 */ +#define VSAMSR2_SNP_WI (2 << 25) /* Write-Invalidate 26-25 */ +#define VSAMSR2_WP (1 << 24) /* Write Posting Enabled 24 */ +#define VSAMSR2_SUP (1 << 23) /* 2nd map to supervi 23 */ +#define VSAMSR2_USR (1 << 22) /* 2nd map to user 22 */ +#define VSAMSR2_A32 (1 << 21) /* 2nd map to extend access 21 */ +#define VSAMSR2_A24 (1 << 20) /* 2nd map to stanard access 20 */ +#define VSAMSR2_D64 (1 << 19) /* 2nd map to D64 block acc 19 */ +#define VSAMSR2_BLK (1 << 18) /* 2nd map to block access 18 */ +#define VSAMSR2_PGM (1 << 17) /* 2nd map to program access 17 */ +#define VSAMSR2_DAT (1 << 16) /* 2nd map to data access 16 */ +#define VSAMSR1_SNP_INHIBIT 0x00 /* Snoop Inhibited 10-9 */ +#define VSAMSR1_SNP_WSD (1 << 9) /* Write-Sink Data 10-9 */ +#define VSAMSR1_SNP_WI (2 << 9) /* Write-Invalidate 10-9 */ +#define VSAMSR1_WP (1 << 8) /* Write Posting Enabled 8 */ +#define VSAMSR1_SUP (1 << 7) /* 1st map to supervi 7 */ +#define VSAMSR1_USR (1 << 6) /* 1st map to user 6 */ +#define VSAMSR1_A32 (1 << 5) /* 1st map to extended access 5 */ +#define VSAMSR1_A24 (1 << 4) /* 1st map to standard access 4 */ +#define VSAMSR1_D64 (1 << 3) /* 1st map to D64 block acces 3 */ +#define VSAMSR1_BLK (1 << 2) /* 1st map to block access 2 */ +#define VSAMSR1_PGM (1 << 1) /* 1st map to program access 1 */ +#define VSAMSR1_DAT 0x01 /* 1st map to data access 0 */ + +/* + * Local Bus Slave Attribute Register 4 0x28 31-24 + * Local Bus Slave Attribute Register 3 0x28 23-16 + * Local Bus Slave Attribute Register 2 0x28 15-08 + * Local Bus Slave Attribute Register 1 0x28 07-00 + */ +#define LBSAR4_D16 (1 << 31) /* D16 data transfers 31 */ +#define LBSAR4_D32 0x00 /* D32 data transfers 31 */ +#define LBSAR4_WP_ENABLE (1 << 30) /* Write posting enabled 30 */ +#define LBSAR4_WP_DISABLE 0x00 /* Write posting disabled 30 */ +/* The following are for the Address Modifier equates 29-24 */ +#define LBSAR4_AM_STD_SUP_ASCENDING VME_AM_STD_SUP_ASCENDING << 24 +#define LBSAR4_AM_STD_SUP_PGM VME_AM_STD_SUP_PGM << 24 +#define LBSAR4_AM_STD_SUP_DATA VME_AM_STD_SUP_DATA << 24 +#define LBSAR4_AM_STD_USR_ASCENDING VME_AM_STD_USR_ASCENDING << 24 +#define LBSAR4_AM_STD_USR_PGM VME_AM_STD_USR_PGM << 24 +#define LBSAR4_AM_STD_USR_DATA VME_AM_STD_USR_DATA << 24 +#define LBSAR4_AM_SUP_SHORT_IO VME_AM_SUP_SHORT_IO << 24 +#define LBSAR4_AM_USR_SHORT_IO VME_AM_USR_SHORT_IO << 24 +#define LBSAR4_AM_EXT_SUP_ASCENDING VME_AM_EXT_SUP_ASCENDING << 24 +#define LBSAR4_AM_EXT_SUP_PGM VME_AM_EXT_SUP_PGM << 24 +#define LBSAR4_AM_EXT_SUP_DATA VME_AM_EXT_SUP_DATA << 24 +#define LBSAR4_AM_EXT_USR_ASCENDING VME_AM_EXT_USR_ASCENDING << 24 +#define LBSAR4_AM_EXT_USR_PGM VME_AM_EXT_USR_PGM << 24 +#define LBSAR4_AM_EXT_USR_DATA VME_AM_EXT_USR_DATA << 24 + +#define LBSAR3_D16 (1 << 23) /* D16 data transfers 23 */ +#define LBSAR3_D32 0x00 /* D32 data transfers 23 */ +#define LBSAR3_WP_ENABLE (1 << 22) /* Write posting enabled 22 */ +#define LBSAR3_WP_DISABLE 0x00 /* Write posting disabled 22 */ +/* The following are for the Address Modifier equates 21-16 */ +#define LBSAR3_AM_STD_SUP_ASCENDING VME_AM_STD_SUP_ASCENDING << 16 +#define LBSAR3_AM_STD_SUP_PGM VME_AM_STD_SUP_PGM << 16 +#define LBSAR3_AM_STD_SUP_DATA VME_AM_STD_SUP_DATA << 16 +#define LBSAR3_AM_STD_USR_ASCENDING VME_AM_STD_USR_ASCENDING << 16 +#define LBSAR3_AM_STD_USR_PGM VME_AM_STD_USR_PGM << 16 +#define LBSAR3_AM_STD_USR_DATA VME_AM_STD_USR_DATA << 16 +#define LBSAR3_AM_SUP_SHORT_IO VME_AM_SUP_SHORT_IO << 16 +#define LBSAR3_AM_USR_SHORT_IO VME_AM_USR_SHORT_IO << 16 +#define LBSAR3_AM_EXT_SUP_ASCENDING VME_AM_EXT_SUP_ASCENDING << 16 +#define LBSAR3_AM_EXT_SUP_PGM VME_AM_EXT_SUP_PGM << 16 +#define LBSAR3_AM_EXT_SUP_DATA VME_AM_EXT_SUP_DATA << 16 +#define LBSAR3_AM_EXT_USR_ASCENDING VME_AM_EXT_USR_ASCENDING << 16 +#define LBSAR3_AM_EXT_USR_PGM VME_AM_EXT_USR_PGM << 16 +#define LBSAR3_AM_EXT_USR_DATA VME_AM_EXT_USR_DATA << 16 + +#define LBSAR2_D16 (1 << 15) /* D16 data transfers 15 */ +#define LBSAR2_D32 0x00 /* D32 data transfers 15 */ +#define LBSAR2_WP_ENABLE (1 << 14) /* Write posting enabled 14 */ +#define LBSAR2_WP_DISABLE 0x00 /* Write posting disabled 14 */ +/* The following are for the Address Modifier equates 13-8 */ +#define LBSAR2_AM_STD_SUP_ASCENDING VME_AM_STD_SUP_ASCENDING << 8 +#define LBSAR2_AM_STD_SUP_PGM VME_AM_STD_SUP_PGM << 8 +#define LBSAR2_AM_STD_SUP_DATA VME_AM_STD_SUP_DATA << 8 +#define LBSAR2_AM_STD_USR_ASCENDING VME_AM_STD_USR_ASCENDING << 8 +#define LBSAR2_AM_STD_USR_PGM VME_AM_STD_USR_PGM << 8 +#define LBSAR2_AM_STD_USR_DATA VME_AM_STD_USR_DATA << 8 +#define LBSAR2_AM_SUP_SHORT_IO VME_AM_SUP_SHORT_IO << 8 +#define LBSAR2_AM_USR_SHORT_IO VME_AM_USR_SHORT_IO << 8 +#define LBSAR2_AM_EXT_SUP_ASCENDING VME_AM_EXT_SUP_ASCENDING << 8 +#define LBSAR2_AM_EXT_SUP_PGM VME_AM_EXT_SUP_PGM << 8 +#define LBSAR2_AM_EXT_SUP_DATA VME_AM_EXT_SUP_DATA << 8 +#define LBSAR2_AM_EXT_USR_ASCENDING VME_AM_EXT_USR_ASCENDING << 8 +#define LBSAR2_AM_EXT_USR_PGM VME_AM_EXT_USR_PGM << 8 +#define LBSAR2_AM_EXT_USR_DATA VME_AM_EXT_USR_DATA << 8 + +#define LBSAR1_D16 (1 << 7) /* D16 data transfers 7 */ +#define LBSAR1_D32 0x00 /* D32 data transfers 7 */ +#define LBSAR1_WP_ENABLE (1 << 6) /* Write posting enabled 6 */ +#define LBSAR1_WP_DISABLE 0x00 /* Write posting disabled 6 */ +/* The following are for the Address Modifier equates 5-0 */ +#define LBSAR1_AM_STD_SUP_ASCENDING VME_AM_STD_SUP_ASCENDING +#define LBSAR1_AM_STD_SUP_PGM VME_AM_STD_SUP_PGM +#define LBSAR1_AM_STD_SUP_DATA VME_AM_STD_SUP_DATA +#define LBSAR1_AM_STD_USR_ASCENDING VME_AM_STD_USR_ASCENDING +#define LBSAR1_AM_STD_USR_PGM VME_AM_STD_USR_PGM +#define LBSAR1_AM_STD_USR_DATA VME_AM_STD_USR_DATA +#define LBSAR1_AM_SUP_SHORT_IO VME_AM_SUP_SHORT_IO +#define LBSAR1_AM_USR_SHORT_IO VME_AM_USR_SHORT_IO +#define LBSAR1_AM_EXT_SUP_ASCENDING VME_AM_EXT_SUP_ASCENDING +#define LBSAR1_AM_EXT_SUP_PGM VME_AM_EXT_SUP_PGM +#define LBSAR1_AM_EXT_SUP_DATA VME_AM_EXT_SUP_DATA +#define LBSAR1_AM_EXT_USR_ASCENDING VME_AM_EXT_USR_ASCENDING +#define LBSAR1_AM_EXT_USR_PGM VME_AM_EXT_USR_PGM +#define LBSAR1_AM_EXT_USR_DATA VME_AM_EXT_USR_DATA + +/* + * VMEbus Slave GCSR Group Address Reg 0x2c 31-24 + * VMEbus Slave GCSR Board Address Reg 0x2c 23-20 + * Local Bus To VMEbus Enable Control Reg 0x2c 19-16 + * Local Bus to VMEbus I/O Control Reg 0x2c 15-08 + * ROM Control Reg 0x2c 07-00 + */ + +#define LBTVCR_EN4 (1 << 19) /* 4th VMEbus decoder enable 19 */ +#define LBTVCR_EN3 (1 << 18) /* 3rd VMEbus decoder enable 18 */ +#define LBTVCR_EN2 (1 << 17) /* 2nd VMEbus decoder enable 17 */ +#define LBTVCR_EN1 (1 << 16) /* 1st VMEbus decoder enable 16 */ +#define LBTVCR_I2EN (1 << 15) /* Enable F page decoder 15 */ +#define LBTVCR_I2WP (1 << 14) /* Page F Write Post Enable 14 */ +#define LBTVCR_I2SUP (1 << 13) /* Supervisor AM for Page F 13 */ +#define LBTVCR_I2USR 0x00 /* User AM for Page F 13 */ +#define LBTVCR_I2PROG (1 << 12) /* Program AM for Page F 12 */ +#define LBTVCR_I2DATA 0x00 /* Data AM for Page F 12 */ +#define LBTVCR_I1EN (1 << 11) /* Short I/O Enabled 11 */ +#define LBTVCR_I1D16 (1 << 10) /* D16 data for Short I/O 10 */ +#define LBTVCR_I1D32 0x00 /* D32 data for Short I/O 10 */ +#define LBTVCR_I1WP (1 << 9) /* Write Post for Short I/O 9 */ +#define LBTVCR_I1SUP (1 << 8) /* Supvisor AM for Short I/O 8 */ +#define LBTVCR_I1USR 0x00 /* User AM for Short I/O 8 */ +#define LBTVCR_8MBIT 0x00 /* 8 MBit Chips 7-6 */ +#define LBTVCR_4MBIT (1 << 6) /* 4 MBit Chips 7-6 */ +#define LBTVCR_2MBIT (2 << 6) /* 2 MBit Chips 7-6 */ +#define LBTVCR_1MBIT (3 << 6) /* 1 MBit Chips 7-6 */ + +/* B ROMs SPEED DEFINED FOR 25MHz BUS CLOCK */ +#define LBTVCR_B365NS 0x00 /* 365 ns B EPROM Access 5-3 */ +#define LBTVCR_B325NS (1 << 3) /* 325 ns B EPROM Access 5-3 */ +#define LBTVCR_B285NS (2 << 3) /* 285 ns B EPROM Access 5-3 */ +#define LBTVCR_B245NS (3 << 3) /* 245 ns B EPROM Access 5-3 */ +#define LBTVCR_B205NS (4 << 3) /* 205 ns B EPROM Access 5-3 */ +#define LBTVCR_B165NS (5 << 3) /* 165 ns B EPROM Access 5-3 */ +#define LBTVCR_B125NS (6 << 3) /* 125 ns B EPROM Access 5-3 */ +#define LBTVCR_B85NS (7 << 3) /* 85 ns B EPROM Access 5-3 */ + +/* A ROMs SPEED DEFINED FOR 25MHz BUS CLOCK */ +#define LBTVCR_A365NS 0x00 /* 365 ns A EPROM Access 2-0 */ +#define LBTVCR_A325NS 0x01 /* 325 ns A EPROM Access 2-0 */ +#define LBTVCR_A285NS 0x02 /* 285 ns A EPROM Access 2-0 */ +#define LBTVCR_A245NS 0x03 /* 245 ns A EPROM Access 2-0 */ +#define LBTVCR_A205NS 0x04 /* 205 ns A EPROM Access 2-0 */ +#define LBTVCR_A165NS 0x05 /* 165 ns A EPROM Access 2-0 */ +#define LBTVCR_A125NS 0x06 /* 125 ns A EPROM Access 2-0 */ +#define LBTVCR_A85NS 0x07 /* 85 ns A EPROM Access 2-0 */ + +/* + * EPROM Decoder, SRAM and DMA Control Register 0x30 23-16 + * Local Bus To VMEbus Requester Control Reg 0x30 15-08 + * DMAC Control Register 1 0x30 07-00 + */ + +#define DMACR1_ROM0_ON (1 << 20) /* Map EPROM to $00000000 20 */ +#define DMACR1_ROM0_OFF 0x00 /* No Map EPROM to $00000000 20 */ +#define DMACR1_SNOOP_INHIBIT 0x00 /* Snoop Inhibited 19-18 */ +#define DMACR1_SINK_DATA (1 << 18) /* Sink Data 19-18 */ +#define DMACR1_INVALIDATE (2 << 18) /* Invalidate 19-18 */ +#define DMACR1_165NS 0x00 /* 165 ns SRAM Access Time 17-16 */ +#define DMACR1_125NS (1 << 16) /* 125 ns SRAM Access Time 17-16 */ +#define DMACR1_85NS (2 << 16) /* 85 ns SRAM Access Time 17-16 */ +#define DMACR1_45NS (3 << 16) /* 45 ns SRAM Access Time 17-16 */ +#define DMACR1_ROBIN (1 << 15) /* Arbiter in Round Robin 15 */ +#define DMACR1_PRIORITY 0x00 /* Arbiter in Priority 15 */ +#define DMACR1_DHB (1 << 14) /* VMEbus acquired from DWB 14 */ +#define DMACR1_DWB (1 << 13) /* VMEbus held 13 */ +#define DMACR1_LVFAIR (1 << 11) /* Requester in fair mode 11 */ +#define DMACR1_LVRWD (1 << 10) /* Release When Done 10 */ +#define DMACR1_LVROR 0x00 /* Relase On Request 10 */ +#define DMACR1_LVREQ_L0 0x00 /* Request Level 0 9-8 */ +#define DMACR1_LVREQ_L1 (1 << 8) /* Request Level 1 9-8 */ +#define DMACR1_LVREQ_L2 (2 << 8) /* Request Level 2 9-8 */ +#define DMACR1_LVREQ_L3 (3 << 8) /* Request Level 3 9-8 */ +#define DMACR1_DHALT (1 << 7) /* Halt at end of Command 7 */ +#define DMACR1_DEN (1 << 6) /* DMAC enabled 6 */ +#define DMACR1_DTBL (1 << 5) /* Command chaining mode 5 */ +#define DMACR1_DFAIR (1 << 4) /* Operates in fair mode 4 */ +#define DMACR1_TIMER_BRX 0x00 /* Release with Timer & BRx 3-2 */ +#define DMACR1_TIMER (1 << 2) /* Release with Timer 3-2 */ +#define DMACR1_BRX (2 << 2) /* Release with BRx 3-2 */ +#define DMACR1_TIMER_OR_BRX (3 << 2) /* Release with Timer or BRx 3-2 */ +#define DMACR1_DREQ_L0 0x00 /* VMEbus request Level 0 1-0 */ +#define DMACR1_DREQ_L1 0x01 /* VMEbus request Level 1 1-0 */ +#define DMACR1_DREQ_L2 0x02 /* VMEbus request Level 2 1-0 */ +#define DMACR1_DREQ_L3 0x03 /* VMEbus request Level 3 1-0 */ + +/* + * DMAC Control Register 2 0x34 15-08 + * DMAC Control Register 2 0x34 07-00 + */ + +#define DMACR2_INTE (1 << 15) /* Interrupt Enabel 15 */ +#define DMACR2_SNOOP_INHIBIT 0x00 /* Snoop Inhibited 14-13 */ +#define DMACR2_SINK_DATA (1 << 13) /* Sink Data 14-13 */ +#define DMACR2_INVALIDATE (2 << 13) /* Invalidate 14-13 */ +#define DMACR2_VINC (1 << 11) /* Increment Address on DMA 11 */ +#define DMACR2_LINC (1 << 10) /* Increment Local Addr DMA 10 */ +#define DMACR2_TO_VME (1 << 9) /* Transfer to VMEbus 9 */ +#define DMACR2_TO_LOCAL 0x00 /* Transfer to Local bus 9 */ +#define DMACR2_D16 (1 << 8) /* D16 on the VMEbus 8 */ +#define DMACR2_D32 0x00 /* D32 on the VMEbus 8 */ +#define DMACR2_NO_BLOCK 0x00 /* Block Transfers Disabled 7-6 */ +#define DMACR2_D32_BLOCK (1 << 6) /* D32 Block Transfer VMEbus 7-6 */ +#define DMACR2_D64_BLOCK (3 << 6) /* D64 Block Transfer VMEbus 7-6 */ +#define DMACR2_AM_STD_SUP_ASCENDING VME_AM_STD_SUP_ASCENDING +#define DMACR2_AM_STD_SUP_PGM VME_AM_STD_SUP_PGM +#define DMACR2_AM_STD_SUP_DATA VME_AM_STD_SUP_DATA +#define DMACR2_AM_STD_USR_ASCENDING VME_AM_STD_USR_ASCENDING +#define DMACR2_AM_STD_USR_PGM VME_AM_STD_USR_PGM +#define DMACR2_AM_STD_USR_DATA VME_AM_STD_USR_DATA +#define DMACR2_AM_SUP_SHORT_IO VME_AM_SUP_SHORT_IO +#define DMACR2_AM_USR_SHORT_IO VME_AM_USR_SHORT_IO +#define DMACR2_AM_EXT_SUP_ASCENDING VME_AM_EXT_SUP_ASCENDING +#define DMACR2_AM_EXT_SUP_PGM VME_AM_EXT_SUP_PGM +#define DMACR2_AM_EXT_SUP_DATA VME_AM_EXT_SUP_DATA +#define DMACR2_AM_EXT_USR_ASCENDING VME_AM_EXT_USR_ASCENDING +#define DMACR2_AM_EXT_USR_PGM VME_AM_EXT_USR_PGM +#define DMACR2_AM_EXT_USR_DATA VME_AM_EXT_USR_DATA + +/* + * VMEbus Interrupter Control Register 0x48 31-24 + * VMEbus Interrupter Vector Register 0x48 23-16 + * MPU Status and DMA Interrupt Count Register 0x48 15-08 + * DMAC Status Register 0x48 07-00 + */ + +#define ICR_IRQ1_INTERRUPTER 0x00 /* Intrptr connected to IRQ1 30-29 */ +#define ICR_IRQ1_TIMER1 (1 << 29) /* Timer 1 connected to IRQ1 30-29 */ +#define ICR_IRQ1_TIMER2 (3 << 29) /* Timer 2 connected to IRQ2 30-29 */ +#define ICR_IRQ_CLEAR (1 << 28) /* Clear VMEbus IRQ 28 */ +#define ICR_IRQ_STATUS (1 << 27) /* IRQ not acknowledged 27 */ +#define ICR_IRQ_L1 (1 << 24) /* Generate VME IRQ level 1 26-24 */ +#define ICR_IRQ_L2 (2 << 24) /* level 2 26-24 */ +#define ICR_IRQ_L3 (3 << 24) /* level 3 26-24 */ +#define ICR_IRQ_L4 (4 << 24) /* level 4 26-24 */ +#define ICR_IRQ_L5 (5 << 24) /* level 5 26-24 */ +#define ICR_IRQ_L6 (6 << 24) /* level 6 26-24 */ +#define ICR_IRQ_L7 (7 << 24) /* level 7 26-24 */ +#define ICR_MCLR (1 << 11) /* Clear MPU status bits 11 */ +#define ICR_MLBE (1 << 10) /* MPU received a TEA 10 */ +#define ICR_MLPE (1 << 9) /* MPU -TEA + Parity error 9 */ +#define ICR_MLOB (1 << 8) /* MPU -TEA + Off board 8 */ +#define ICR_MLTO (1 << 7) /* MPU -TEA + Local Time Out 7 */ +#define ICR_DLBE (1 << 6) /* DMAC received a TEA 6 */ +#define ICR_DLPE (1 << 5) /* DMAC -TEA + Parity Error 5 */ +#define ICR_DLOB (1 << 4) /* DMAC -TEA + Off Board 4 */ +#define ICR_DLTO (1 << 3) /* DMAC -TEA + Locl Time Out 3 */ +#define ICR_TBL (1 << 2) /* DMAC error reading command 2 */ +#define ICR_VME (1 << 1) /* DMAC got VMEbus BERR 1 */ +#define ICR_DONE 1 /* DMAC finished 0 */ + +/* + * VMEbus Arbiter Timeout Control Register 0x4c 31-24 + * DMAC Ton/Toff Timers and VMEbus Global Timeout 0x4c 23-16 + * VME Access, Local Bus and Watchdog Timeout 0x4c 15-08 + * Prescaler Control Register 0x4c 07-00 + */ + +#define TIMEOUTCR_ARBTO (1 << 24) /* Enable Grant Timeout 24 */ +#define TIMEOUTCR_OFF_0US 0x00 /* DMAC off VMEbus for 0us 23-21 */ +#define TIMEOUTCR_OFF_16US (1 << 21) /* 16us 23-21 */ +#define TIMEOUTCR_OFF_32US (2 << 21) /* 32us 23-21 */ +#define TIMEOUTCR_OFF_64US (3 << 21) /* 64us 23-21 */ +#define TIMEOUTCR_OFF_128US (4 << 21) /* 128us 23-21 */ +#define TIMEOUTCR_OFF_256US (5 << 21) /* 256us 23-21 */ +#define TIMEOUTCR_OFF_512US (6 << 21) /* 512us 23-21 */ +#define TIMEOUTCR_OFF_1024US (7 << 21) /* 1024us 23-21 */ +#define TIMEOUTCR_ON_16US 0x00 /* DMAC on VMEbus for 16us 20-18 */ +#define TIMEOUTCR_ON_32US (1 << 18) /* 32us 20-18 */ +#define TIMEOUTCR_ON_64US (2 << 18) /* 64us 20-18 */ +#define TIMEOUTCR_ON_128US (3 << 18) /* 128us 20-18 */ +#define TIMEOUTCR_ON_256US (4 << 18) /* 256us 20-18 */ +#define TIMEOUTCR_ON_512US (5 << 18) /* 512us 20-18 */ +#define TIMEOUTCR_ON_1024US (6 << 18) /* 1024us 20-18 */ +#define TIMEOUTCR_ON_DONE (7 << 18) /* DMAC on VMEbus until done 20-18 */ +#define TIMEOUTCR_VGTO_8US 0x00 /* VMEbus global timeout 8us 17-16 */ +#define TIMEOUTCR_VGTO_64US (1 << 16) /* 16us 17-16 */ +#define TIMEOUTCR_VGTO_256US (2 << 16) /* 256us 17-16 */ +#define TIMEOUTCR_VGTO_DISABLE (3 << 16) /* global timeout disabled 17-16 */ +#define TIMEOUTCR_VATO_64US 0x00 /* VMEbus timeout 64us 15-14 */ +#define TIMEOUTCR_VATO_1MS (1 << 14) /* 1ms 15-14 */ +#define TIMEOUTCR_VATO_32MS (2 << 14) /* 32ms 15-14 */ +#define TIMEOUTCR_VATO_DISABLE (3 << 14) /* access timeout disabled 15-14 */ +#define TIMEOUTCR_LBTO_8US 0x00 /* Local Bus Timeout 8us 13-12 */ +#define TIMEOUTCR_LBTO_64US (1 << 12) /* 64us 13-12 */ +#define TIMEOUTCR_LBTO_256US (2 << 12) /* 256us 13-12 */ +#define TIMEOUTCR_LBTO_DISABLE (3 << 12) /* Local Timeout Disabled 13-12 */ +#define TIMEOUTCR_WDTO_512US 0x00 /* Watchdog Timeout 512us 11-08 */ +#define TIMEOUTCR_WDTO_1MS (1 << 8) /* Watchdog Timeout 1ms 11-08 */ +#define TIMEOUTCR_WDTO_2MS (2 << 8) /* Watchdog Timeout 2ms 11-08 */ +#define TIMEOUTCR_WDTO_4MS (3 << 8) /* Watchdog Timeout 4ms 11-08 */ +#define TIMEOUTCR_WDTO_8MS (4 << 8) /* Watchdog Timeout 8ms 11-08 */ +#define TIMEOUTCR_WDTO_16MS (5 << 8) /* Watchdog Timeout 16ms 11-08 */ +#define TIMEOUTCR_WDTO_32MS (6 << 8) /* Watchdog Timeout 32ms 11-08 */ +#define TIMEOUTCR_WDTO_64MS (7 << 8) /* Watchdog Timeout 64ms 11-08 */ +#define TIMEOUTCR_WDTO_128MS (8 << 8) /* Watchdog Timeout 128ms 11-08 */ +#define TIMEOUTCR_WDTO_256MS (9 << 8) /* Watchdog Timeout 256ms 11-08 */ +#define TIMEOUTCR_WDTO_512MS (10 << 8) /* Watchdog Timeout 512ms 11-08 */ +#define TIMEOUTCR_WDTO_1S (11 << 8) /* Watchdog Timeout 1s 11-08 */ +#define TIMEOUTCR_WDTO_4S (12 << 8) /* Watchdog Timeout 4s 11-08 */ +#define TIMEOUTCR_WDTO_16S (13 << 8) /* Watchdog Timeout 16s 11-08 */ +#define TIMEOUTCR_WDTO_32S (14 << 8) /* Watchdog Timeout 32s 11-08 */ +#define TIMEOUTCR_WDTO_64S (15 << 8) /* Watchdog Timeout 64s 11-08 */ + +/* + * Board Control Register 0x60 31-24 + * Watchdog Timer Control Register 0x60 23-16 + * Tick Timer 2 Control Register 0x60 15-08 + * Tick Timer 1 Control Register 0x60 07-00 + */ + +#define TIMERCR_SCON (1 << 30) /* Board is System Cont 30 */ +#define TIMERCR_SFFL (1 << 29) /* VMEbus SYSFAIL is assertd 29 */ +#define TIMERCR_BRFLI (1 << 28) /* Board Fail is asserted 28 */ +#define TIMERCR_PURS (1 << 27) /* Power-Up Reset 27 */ +#define TIMERCR_CPURS (1 << 26) /* Clear Power-Up Reset 26 */ +#define TIMERCR_BDFLO (1 << 25) /* Assert the BRDFAIL Signal 25 */ +#define TIMERCR_RSWE (1 << 24) /* Enable Reset Switch 24 */ +#define TIMERCR_RSWD 0x00 /* Disable Reset Switch 24 */ +#define TIMERCR_SRST (1 << 23) /* Assert SYSRESET on VMEbus 23 */ +#define TIMERCR_WDCS (1 << 22) /* Clear watchdog timeout 22 */ +#define TIMERCR_WDCC (1 << 21) /* Reset watchdog counter 21 */ +#define TIMERCR_WDTO (1 << 20) /* Watchdog Timeout occurd 20 */ +#define TIMERCR_WDBFE (1 << 19) /* Set Board Fail on WD TO 19 */ +#define TIMERCR_WDSYSRESET (1 << 18) /* Set SYSRESET on WD TO 18 */ +#define TIMERCR_WDLRESET 0x00 /* Set LRESET on WD TO 18 */ +#define TIMERCR_WDRSE (1 << 17) /* RESET on Watchdog Timeout 17 */ +#define TIMERCR_WDEN (1 << 16) /* Enable Watchdog Timeout 16 */ +#define TIMERCR_WDDIS 0x00 /* Disable Watchdog Timeout 16 */ +#define TIMERCR_TT2_COVF (1 << 10) /* Clear Over Flow Counter 10 */ +#define TIMERCR_TT2_COC (1 << 9) /* Clear On Compare 9 */ +#define TIMERCR_TT2_EN (1 << 8) /* Enable Counter 8 */ +#define TIMERCR_TT1_COVF (1 << 2) /* Clear Over Flow Counter 2 */ +#define TIMERCR_TT1_COC (1 << 1) /* Clear On Compare 1 */ +#define TIMERCR_TT1_EN 1 /* Enable Counter 0 */ + +/* Local Bus Interrupter Status Register 0x68 31-00 */ + +#define LBISR_ACF (1 << 31) /* VMEbus ACFAIL Interrupt 31 */ +#define LBISR_AB (1 << 30) /* ABORT Switch Interrupt 30 */ +#define LBISR_SYSF (1 << 29) /* VMEbus SYSFAIL Interrupt 29 */ +#define LBISR_MWP (1 << 28) /* VMEbus master write post 28 */ +#define LBISR_PE (1 << 27) /* External Inter (parity) 27 */ +#define LBISR_VI1E (1 << 26) /* VMEbus IRQ1 edge Intr 26 */ +#define LBISR_TIC2 (1 << 25) /* Tick Timer 2 Interrupt 25 */ +#define LBISR_TIC1 (1 << 24) /* Tick Timer 1 Interrupt 24 */ +#define LBISR_VIA (1 << 23) /* VMEbus Inter Ack Inter 23 */ +#define LBISR_DMA (1 << 22) /* DMAC Interrupt 22 */ +#define LBISR_SIG3 (1 << 21) /* GCSR SIG3 interrupt 21 */ +#define LBISR_SIG2 (1 << 20) /* GCSR SIG2 interrupt 20 */ +#define LBISR_SIG1 (1 << 19) /* GCSR SIG1 interrupt 19 */ +#define LBISR_SIG0 (1 << 18) /* GCSR SIG0 interrupt 18 */ +#define LBISR_LM1 (1 << 17) /* GCSR LM1 interrupt 17 */ +#define LBISR_LM0 (1 << 16) /* GCSR LM0 interrupt 16 */ +#define LBISR_SW7 (1 << 15) /* Software 7 interrupt 15 */ +#define LBISR_SW6 (1 << 14) /* Software 6 interrupt 14 */ +#define LBISR_SW5 (1 << 13) /* Software 5 interrupt 13 */ +#define LBISR_SW4 (1 << 12) /* Software 4 interrupt 12 */ +#define LBISR_SW3 (1 << 11) /* Software 3 interrupt 11 */ +#define LBISR_SW2 (1 << 10) /* Software 2 interrupt 10 */ +#define LBISR_SW1 (1 << 9) /* Software 1 interrupt 9 */ +#define LBISR_SW0 (1 << 8) /* Software 0 interrupt 8 */ +#define LBISR_VME7 (1 << 6) /* VMEbus IRQ7 interrupt 6 */ +#define LBISR_VME6 (1 << 5) /* VMEbus IRQ6 interrupt 5 */ +#define LBISR_VME5 (1 << 4) /* VMEbus IRQ5 interrupt 4 */ +#define LBISR_VME4 (1 << 3) /* VMEbus IRQ4 interrupt 3 */ +#define LBISR_VME3 (1 << 2) /* VMEbus IRQ3 interrupt 2 */ +#define LBISR_VME2 (1 << 1) /* VMEbus IRQ2 interrupt 1 */ +#define LBISR_VME1 1 /* VMEbus IRQ1 interrupt 0 */ + +/* Local Bus Interrupter Enable Register 0x6c 31-00 */ + +#define LBIER_EACF (1 << 31) /* Enable VMEbus ACFAIL IRQ 31 */ +#define LBIER_EAB (1 << 30) /* Enable ABORT switch IRQ 30 */ +#define LBIER_ESYSF (1 << 29) /* Enable VMEbus SYSFAIL IRQ 29 */ +#define LBIER_EMWP (1 << 28) /* Enable VMEbus WPE IRQ 28 */ +#define LBIER_EPE (1 << 27) /* Enable Parity Error IRQ 27 */ +#define LBIER_EVI1E (1 << 26) /* Enable VMEbus IRQ1 IRQ 26 */ +#define LBIER_ETIC2 (1 << 25) /* Enable Tick Timer 2 IRQ 25 */ +#define LBIER_ETIC1 (1 << 24) /* Enable Tick Timer 1 IRQ 24 */ + +#define LBIER_EVIA (1 << 23) /* Enable VME Intptr Ack IRQ 23 */ +#define LBIER_EDMA (1 << 22) /* Enable DMAC IRQ 22 */ +#define LBIER_ESIG3 (1 << 21) /* Enable GCSR SIG3 IRQ 21 */ +#define LBIER_ESIG2 (1 << 20) /* Enable GCSR SIG2 IRQ 20 */ +#define LBIER_ESIG1 (1 << 19) /* Enable GCSR SIG1 IRQ 19 */ +#define LBIER_ESIG0 (1 << 18) /* Enable GCSR SIG0 IRQ 18 */ +#define LBIER_ELM1 (1 << 17) /* Enable GCSR LM1 IRQ 17 */ +#define LBIER_ELM0 (1 << 16) /* Enable GCSR LM0 IRQ 16 */ + +#define LBIER_ESW7 (1 << 15) /* Enable Software 7 Inter 15 */ +#define LBIER_ESW6 (1 << 14) /* Enable Software 6 Inter 14 */ +#define LBIER_ESW5 (1 << 13) /* Enable Software 5 Inter 13 */ +#define LBIER_ESW4 (1 << 12) /* Enable Software 4 Inter 12 */ +#define LBIER_ESW3 (1 << 11) /* Enable Software 3 Inter 11 */ +#define LBIER_ESW2 (1 << 10) /* Enable Software 2 Inter 10 */ +#define LBIER_ESW1 (1 << 9) /* Enable Software 1 Inter 9 */ +#define LBIER_ESW0 (1 << 8) /* Enable Software 0 Inter 8 */ + +#define LBIER_EIRQ7 (1 << 6) /* Enable VMEbus IRQ7 Inter 6 */ +#define LBIER_EIRQ6 (1 << 5) /* Enable VMEbus IRQ6 Inter 5 */ +#define LBIER_EIRQ5 (1 << 4) /* Enable VMEbus IRQ5 Inter 4 */ +#define LBIER_EIRQ4 (1 << 3) /* Enable VMEbus IRQ4 Inter 3 */ +#define LBIER_EIRQ3 (1 << 2) /* Enable VMEbus IRQ3 Inter 2 */ +#define LBIER_EIRQ2 (1 << 1) /* Enable VMEbus IRQ2 Inter 1 */ +#define LBIER_EIRQ1 1 /* Enable VMEbus IRQ1 Inter 0 */ + +/* Software Interrupt Set Register 0x70 15-08 */ + +#define SISR_SSW7 (1 << 15) /* Set Software 7 Interrupt 15 */ +#define SISR_SSW6 (1 << 14) /* Set Software 6 Interrupt 14 */ +#define SISR_SSW5 (1 << 13) /* Set Software 5 Interrupt 13 */ +#define SISR_SSW4 (1 << 12) /* Set Software 4 Interrupt 12 */ +#define SISR_SSW3 (1 << 11) /* Set Software 3 Interrupt 11 */ +#define SISR_SSW2 (1 << 10) /* Set Software 2 Interrupt 10 */ +#define SISR_SSW1 (1 << 9) /* Set Software 1 Interrupt 9 */ +#define SISR_SSW0 (1 << 8) /* Set Software 0 Interrupt 8 */ + +/* Interrupt Clear Register 0x74 31-08 */ + +#define ICLR_CACF (1 << 31) /* Clr VMEbus ACFAIL Inter 31 */ +#define ICLR_CAB (1 << 30) /* Clr ABORT Switch Inter 30 */ +#define ICLR_CSYSF (1 << 29) /* Clr VMEbus SYSFAIL Inter 29 */ +#define ICLR_CMWP (1 << 28) /* Clr VME Master Write Post 28 */ +#define ICLR_CPE (1 << 27) /* Clr Ext Inter (PARITY) 27 */ +#define ICLR_CVI1E (1 << 26) /* Clr VME IRQ1 Edge Inter 26 */ +#define ICLR_CTIC2 (1 << 25) /* Clr Tick Timer 2 Inter 25 */ +#define ICLR_CTIC1 (1 << 24) /* Clr Tick Timer 1 Inter 24 */ + +#define ICLR_CVIA (1 << 23) /* Clr VMEbus Interrupt Ack 23 */ +#define ICLR_CDMA (1 << 22) /* Clr DMA Controller Inter 22 */ +#define ICLR_CSIG3 (1 << 21) /* Clr GCSR SIG3 Interrupt 21 */ +#define ICLR_CSIG2 (1 << 20) /* Clr GCSR SIG2 Interrupt 20 */ +#define ICLR_CSIG1 (1 << 19) /* Clr GCSR SIG1 Interrupt 19 */ +#define ICLR_CSIG0 (1 << 18) /* Clr GCSR SIG0 Interrupt 18 */ +#define ICLR_CLM1 (1 << 17) /* Clr GCSR LM1 Interrupt 17 */ +#define ICLR_CLM0 (1 << 16) /* Clr GCSR LM0 Interrupt 16 */ + +#define ICLR_CSW7 (1 << 15) /* Clr Software 7 Interrupt 15 */ +#define ICLR_CSW6 (1 << 14) /* Clr Software 6 Interrupt 14 */ +#define ICLR_CSW5 (1 << 13) /* Clr Software 5 Interrupt 13 */ +#define ICLR_CSW4 (1 << 12) /* Clr Software 4 Interrupt 12 */ +#define ICLR_CSW3 (1 << 11) /* Clr Software 3 Interrupt 11 */ +#define ICLR_CSW2 (1 << 10) /* Clr Software 2 Interrupt 10 */ +#define ICLR_CSW1 (1 << 9) /* Clr Software 1 Interrupt 9 */ +#define ICLR_CSW0 (1 << 8) /* Clr Software 0 Interrupt 8 */ + +/* Interrupt Level Register 1 0x78 31-00 */ + +#define ILR1_ACF_LEVEL1 (1 << 28) /* ACFAIL Inter on Level 1 30-28 */ +#define ILR1_ACF_LEVEL2 (2 << 28) /* ACFAIL Inter on Level 2 30-28 */ +#define ILR1_ACF_LEVEL3 (3 << 28) /* ACFAIL Inter on Level 3 30-28 */ +#define ILR1_ACF_LEVEL4 (4 << 28) /* ACFAIL Inter on Level 4 30-28 */ +#define ILR1_ACF_LEVEL5 (5 << 28) /* ACFAIL Inter on Level 5 30-28 */ +#define ILR1_ACF_LEVEL6 (6 << 28) /* ACFAIL Inter on Level 6 30-28 */ +#define ILR1_ACF_LEVEL7 (7 << 28) /* ACFAIL Inter on Level 7 30-28 */ + +#define ILR1_AB_LEVEL1 (1 << 24) /* ABORT Inter on Level 1 26-24 */ +#define ILR1_AB_LEVEL2 (2 << 24) /* ABORT Inter on Level 2 26-24 */ +#define ILR1_AB_LEVEL3 (3 << 24) /* ABORT Inter on Level 3 26-24 */ +#define ILR1_AB_LEVEL4 (4 << 24) /* ABORT Inter on Level 4 26-24 */ +#define ILR1_AB_LEVEL5 (5 << 24) /* ABORT Inter on Level 5 26-24 */ +#define ILR1_AB_LEVEL6 (6 << 24) /* ABORT Inter on Level 6 26-24 */ +#define ILR1_AB_LEVEL7 (7 << 24) /* ABORT Inter on Level 7 26-24 */ + +#define ILR1_SYSF_LEVEL1 (1 << 20) /* SYSFAIL Inter on Lvl 1 22-20 */ +#define ILR1_SYSF_LEVEL2 (2 << 20) /* SYSFAIL Inter on Lvl 2 22-20 */ +#define ILR1_SYSF_LEVEL3 (3 << 20) /* SYSFAIL Inter on Lvl 3 22-20 */ +#define ILR1_SYSF_LEVEL4 (4 << 20) /* SYSFAIL Inter on Lvl 4 22-20 */ +#define ILR1_SYSF_LEVEL5 (5 << 20) /* SYSFAIL Inter on Lvl 5 22-20 */ +#define ILR1_SYSF_LEVEL6 (6 << 20) /* SYSFAIL Inter on Lvl 6 22-20 */ +#define ILR1_SYSF_LEVEL7 (7 << 20) /* SYSFAIL Inter on Lvl 7 22-20 */ + +#define ILR1_WPE_LEVEL1 (1 << 16) /* Master Write Post Lvl 1 18-16 */ +#define ILR1_WPE_LEVEL2 (2 << 16) /* Master Write Post Lvl 2 18-16 */ +#define ILR1_WPE_LEVEL3 (3 << 16) /* Master Write Post Lvl 3 18-16 */ +#define ILR1_WPE_LEVEL4 (4 << 16) /* Master Write Post Lvl 4 18-16 */ +#define ILR1_WPE_LEVEL5 (5 << 16) /* Master Write Post Lvl 5 18-16 */ +#define ILR1_WPE_LEVEL6 (6 << 16) /* Master Write Post Lvl 6 18-16 */ +#define ILR1_WPE_LEVEL7 (7 << 16) /* Master Write Post Lvl 7 18-16 */ + +#define ILR1_PE_LEVEL1 (1 << 12) /* Parity Error on Level 1 14-12 */ +#define ILR1_PE_LEVEL2 (2 << 12) /* Parity Error on Level 2 14-12 */ +#define ILR1_PE_LEVEL3 (3 << 12) /* Parity Error on Level 3 14-12 */ +#define ILR1_PE_LEVEL4 (4 << 12) /* Parity Error on Level 4 14-12 */ +#define ILR1_PE_LEVEL5 (5 << 12) /* Parity Error on Level 5 14-12 */ +#define ILR1_PE_LEVEL6 (6 << 12) /* Parity Error on Level 6 14-12 */ +#define ILR1_PE_LEVEL7 (7 << 12) /* Parity Error on Level 7 14-12 */ + +#define ILR1_IRQ1E_LEVEL1 (1 << 8) /* VMEbus IRQ1 edge on Lvl 1 10-8 */ +#define ILR1_IRQ1E_LEVEL2 (2 << 8) /* VMEbus IRQ1 edge on Lvl 2 10-8 */ +#define ILR1_IRQ1E_LEVEL3 (3 << 8) /* VMEbus IRQ1 edge on Lvl 3 10-8 */ +#define ILR1_IRQ1E_LEVEL4 (4 << 8) /* VMEbus IRQ1 edge on Lvl 4 10-8 */ +#define ILR1_IRQ1E_LEVEL5 (5 << 8) /* VMEbus IRQ1 edge on Lvl 5 10-8 */ +#define ILR1_IRQ1E_LEVEL6 (6 << 8) /* VMEbus IRQ1 edge on Lvl 6 10-8 */ +#define ILR1_IRQ1E_LEVEL7 (7 << 8) /* VMEbus IRQ1 edge on Lvl 7 10-8 */ + +#define ILR1_TICK2_LEVEL1 (1 << 4) /* Tick Timer 2 Inter Lvl 1 6-4 */ +#define ILR1_TICK2_LEVEL2 (2 << 4) /* Tick Timer 2 Inter Lvl 2 6-4 */ +#define ILR1_TICK2_LEVEL3 (3 << 4) /* Tick Timer 2 Inter Lvl 3 6-4 */ +#define ILR1_TICK2_LEVEL4 (4 << 4) /* Tick Timer 2 Inter Lvl 4 6-4 */ +#define ILR1_TICK2_LEVEL5 (5 << 4) /* Tick Timer 2 Inter Lvl 5 6-4 */ +#define ILR1_TICK2_LEVEL6 (6 << 4) /* Tick Timer 2 Inter Lvl 6 6-4 */ +#define ILR1_TICK2_LEVEL7 (7 << 4) /* Tick Timer 2 Inter Lvl 7 6-4 */ + +#define ILR1_TICK1_LEVEL1 1 /* Tick Timer 1 Inter Lvl 1 6-4 */ +#define ILR1_TICK1_LEVEL2 2 /* Tick Timer 1 Inter Lvl 2 6-4 */ +#define ILR1_TICK1_LEVEL3 3 /* Tick Timer 1 Inter Lvl 3 6-4 */ +#define ILR1_TICK1_LEVEL4 4 /* Tick Timer 1 Inter Lvl 4 6-4 */ +#define ILR1_TICK1_LEVEL5 5 /* Tick Timer 1 Inter Lvl 5 6-4 */ +#define ILR1_TICK1_LEVEL6 6 /* Tick Timer 1 Inter Lvl 6 6-4 */ +#define ILR1_TICK1_LEVEL7 7 /* Tick Timer 1 Inter Lvl 7 6-4 */ + +/* Interrupt Level Register 2 0x7c 31-00 */ + +#define ILR2_VIA_LEVEL1 (1 << 28) /* VMEbus Intrptr Ack Lvl 1 30-28 */ +#define ILR2_VIA_LEVEL2 (2 << 28) /* VMEbus Intrptr Ack Lvl 2 30-28 */ +#define ILR2_VIA_LEVEL3 (3 << 28) /* VMEbus Intrptr Ack Lvl 3 30-28 */ +#define ILR2_VIA_LEVEL4 (4 << 28) /* VMEbus Intrptr Ack Lvl 4 30-28 */ +#define ILR2_VIA_LEVEL5 (5 << 28) /* VMEbus Intrptr Ack Lvl 5 30-28 */ +#define ILR2_VIA_LEVEL6 (6 << 28) /* VMEbus Intrptr Ack Lvl 6 30-28 */ +#define ILR2_VIA_LEVEL7 (7 << 28) /* VMEbus Intrptr Ack Lvl 7 30-28 */ + +#define ILR2_DMA_LEVEL1 (1 << 24) /* DMA Controller Int Lvl 1 26-24 */ +#define ILR2_DMA_LEVEL2 (2 << 24) /* DMA Controller Int Lvl 2 26-24 */ +#define ILR2_DMA_LEVEL3 (3 << 24) /* DMA Controller Int Lvl 3 26-24 */ +#define ILR2_DMA_LEVEL4 (4 << 24) /* DMA Controller Int Lvl 4 26-24 */ +#define ILR2_DMA_LEVEL5 (5 << 24) /* DMA Controller Int Lvl 5 26-24 */ +#define ILR2_DMA_LEVEL6 (6 << 24) /* DMA Controller Int Lvl 6 26-24 */ +#define ILR2_DMA_LEVEL7 (7 << 24) /* DMA Controller Int Lvl 7 26-24 */ + +#define ILR2_SIG3_LEVEL1 (1 << 20) /* GCSR SIG3 Int on Level 1 22-20 */ +#define ILR2_SIG3_LEVEL2 (2 << 20) /* GCSR SIG3 Int on Level 2 22-20 */ +#define ILR2_SIG3_LEVEL3 (3 << 20) /* GCSR SIG3 Int on Level 3 22-20 */ +#define ILR2_SIG3_LEVEL4 (4 << 20) /* GCSR SIG3 Int on Level 4 22-20 */ +#define ILR2_SIG3_LEVEL5 (5 << 20) /* GCSR SIG3 Int on Level 5 22-20 */ +#define ILR2_SIG3_LEVEL6 (6 << 20) /* GCSR SIG3 Int on Level 6 22-20 */ +#define ILR2_SIG3_LEVEL7 (7 << 20) /* GCSR SIG3 Int on Level 7 22-20 */ + +#define ILR2_SIG2_LEVEL1 (1 << 16) /* GCSR SIG2 Int on Level 1 18-16 */ +#define ILR2_SIG2_LEVEL2 (2 << 16) /* GCSR SIG2 Int on Level 2 18-16 */ +#define ILR2_SIG2_LEVEL3 (3 << 16) /* GCSR SIG2 Int on Level 3 18-16 */ +#define ILR2_SIG2_LEVEL4 (4 << 16) /* GCSR SIG2 Int on Level 4 18-16 */ +#define ILR2_SIG2_LEVEL5 (5 << 16) /* GCSR SIG2 Int on Level 5 18-16 */ +#define ILR2_SIG2_LEVEL6 (6 << 16) /* GCSR SIG2 Int on Level 6 18-16 */ +#define ILR2_SIG2_LEVEL7 (7 << 16) /* GCSR SIG2 Int on Level 7 18-16 */ + +#define ILR2_SIG1_LEVEL1 (1 << 12) /* GCSR SIG1 Int on Level 1 14-12 */ +#define ILR2_SIG1_LEVEL2 (2 << 12) /* GCSR SIG1 Int on Level 2 14-12 */ +#define ILR2_SIG1_LEVEL3 (3 << 12) /* GCSR SIG1 Int on Level 3 14-12 */ +#define ILR2_SIG1_LEVEL4 (4 << 12) /* GCSR SIG1 Int on Level 4 14-12 */ +#define ILR2_SIG1_LEVEL5 (5 << 12) /* GCSR SIG1 Int on Level 5 14-12 */ +#define ILR2_SIG1_LEVEL6 (6 << 12) /* GCSR SIG1 Int on Level 6 14-12 */ +#define ILR2_SIG1_LEVEL7 (7 << 12) /* GCSR SIG1 Int on Level 7 14-12 */ + +#define ILR2_SIG0_LEVEL1 (1 << 8) /* GCSR SIG0 Int on Level 1 10-8 */ +#define ILR2_SIG0_LEVEL2 (2 << 8) /* GCSR SIG0 Int on Level 2 10-8 */ +#define ILR2_SIG0_LEVEL3 (3 << 8) /* GCSR SIG0 Int on Level 3 10-8 */ +#define ILR2_SIG0_LEVEL4 (4 << 8) /* GCSR SIG0 Int on Level 4 10-8 */ +#define ILR2_SIG0_LEVEL5 (5 << 8) /* GCSR SIG0 Int on Level 5 10-8 */ +#define ILR2_SIG0_LEVEL6 (6 << 8) /* GCSR SIG0 Int on Level 6 10-8 */ +#define ILR2_SIG0_LEVEL7 (7 << 8) /* GCSR SIG0 Int on Level 7 10-8 */ + +#define ILR2_LM1_LEVEL1 (1 << 4) /* GCSR LM1 Int on Level 1 6-4 */ +#define ILR2_LM1_LEVEL2 (2 << 4) /* GCSR LM1 Int on Level 2 6-4 */ +#define ILR2_LM1_LEVEL3 (3 << 4) /* GCSR LM1 Int on Level 3 6-4 */ +#define ILR2_LM1_LEVEL4 (4 << 4) /* GCSR LM1 Int on Level 4 6-4 */ +#define ILR2_LM1_LEVEL5 (5 << 4) /* GCSR LM1 Int on Level 5 6-4 */ +#define ILR2_LM1_LEVEL6 (6 << 4) /* GCSR LM1 Int on Level 6 6-4 */ +#define ILR2_LM1_LEVEL7 (7 << 4) /* GCSR LM1 Int on Level 7 6-4 */ + +#define ILR2_LM0_LEVEL1 1 /* GCSR LM0 Int on Level 1 2-0 */ +#define ILR2_LM0_LEVEL2 2 /* GCSR LM0 Int on Level 2 2-0 */ +#define ILR2_LM0_LEVEL3 3 /* GCSR LM0 Int on Level 3 2-0 */ +#define ILR2_LM0_LEVEL4 4 /* GCSR LM0 Int on Level 4 2-0 */ +#define ILR2_LM0_LEVEL5 5 /* GCSR LM0 Int on Level 5 2-0 */ +#define ILR2_LM0_LEVEL6 6 /* GCSR LM0 Int on Level 6 2-0 */ +#define ILR2_LM0_LEVEL7 7 /* GCSR LM0 Int on Level 7 2-0 */ + +/* Interrupt Level Register 3 0x80 31-00 */ + +#define ILR3_SW7_LEVEL7 (7 << 28) /* Software Inter 7 on Lvl 7 30-28 */ +#define ILR3_SW7_LEVEL7 (7 << 28) /* Software Inter 7 on Lvl 7 30-28 */ +#define ILR3_SW7_LEVEL7 (7 << 28) /* Software Inter 7 on Lvl 7 30-28 */ +#define ILR3_SW7_LEVEL7 (7 << 28) /* Software Inter 7 on Lvl 7 30-28 */ +#define ILR3_SW7_LEVEL7 (7 << 28) /* Software Inter 7 on Lvl 7 30-28 */ +#define ILR3_SW7_LEVEL7 (7 << 28) /* Software Inter 7 on Lvl 7 30-28 */ +#define ILR3_SW7_LEVEL7 (7 << 28) /* Software Inter 7 on Lvl 7 30-28 */ + +#define ILR3_SW6_LEVEL1 (1 << 24) /* Software Inter 6 on Lvl 1 26-24 */ +#define ILR3_SW6_LEVEL2 (2 << 24) /* Software Inter 6 on Lvl 2 26-24 */ +#define ILR3_SW6_LEVEL3 (3 << 24) /* Software Inter 6 on Lvl 3 26-24 */ +#define ILR3_SW6_LEVEL4 (4 << 24) /* Software Inter 6 on Lvl 4 26-24 */ +#define ILR3_SW6_LEVEL5 (5 << 24) /* Software Inter 6 on Lvl 5 26-24 */ +#define ILR3_SW6_LEVEL6 (6 << 24) /* Software Inter 6 on Lvl 6 26-24 */ +#define ILR3_SW6_LEVEL7 (7 << 24) /* Software Inter 6 on Lvl 7 26-24 */ + +#define ILR3_SW5_LEVEL1 (1 << 20) /* Software Inter 5 on Lvl 1 22-20 */ +#define ILR3_SW5_LEVEL2 (2 << 20) /* Software Inter 5 on Lvl 2 22-20 */ +#define ILR3_SW5_LEVEL3 (3 << 20) /* Software Inter 5 on Lvl 3 22-20 */ +#define ILR3_SW5_LEVEL4 (4 << 20) /* Software Inter 5 on Lvl 4 22-20 */ +#define ILR3_SW5_LEVEL5 (5 << 20) /* Software Inter 5 on Lvl 5 22-20 */ +#define ILR3_SW5_LEVEL6 (6 << 20) /* Software Inter 5 on Lvl 6 22-20 */ +#define ILR3_SW5_LEVEL7 (7 << 20) /* Software Inter 5 on Lvl 7 22-20 */ + +#define ILR3_SW4_LEVEL1 (1 << 16) /* Software Inter 4 on Lvl 1 18-16 */ +#define ILR3_SW4_LEVEL2 (2 << 16) /* Software Inter 4 on Lvl 2 18-16 */ +#define ILR3_SW4_LEVEL3 (3 << 16) /* Software Inter 4 on Lvl 3 18-16 */ +#define ILR3_SW4_LEVEL4 (4 << 16) /* Software Inter 4 on Lvl 4 18-16 */ +#define ILR3_SW4_LEVEL5 (5 << 16) /* Software Inter 4 on Lvl 5 18-16 */ +#define ILR3_SW4_LEVEL6 (6 << 16) /* Software Inter 4 on Lvl 6 18-16 */ +#define ILR3_SW4_LEVEL7 (7 << 16) /* Software Inter 4 on Lvl 7 18-16 */ + +#define ILR3_SW3_LEVEL1 (1 << 12) /* Software Inter 3 on Lvl 1 14-12 */ +#define ILR3_SW3_LEVEL2 (2 << 12) /* Software Inter 3 on Lvl 2 14-12 */ +#define ILR3_SW3_LEVEL3 (3 << 12) /* Software Inter 3 on Lvl 3 14-12 */ +#define ILR3_SW3_LEVEL4 (4 << 12) /* Software Inter 3 on Lvl 4 14-12 */ +#define ILR3_SW3_LEVEL5 (5 << 12) /* Software Inter 3 on Lvl 5 14-12 */ +#define ILR3_SW3_LEVEL6 (6 << 12) /* Software Inter 3 on Lvl 6 14-12 */ +#define ILR3_SW3_LEVEL7 (7 << 12) /* Software Inter 3 on Lvl 7 14-12 */ + +#define ILR3_SW2_LEVEL1 (1 << 8) /* Software Inter 2 on Lvl 1 10-8 */ +#define ILR3_SW2_LEVEL2 (2 << 8) /* Software Inter 2 on Lvl 2 10-8 */ +#define ILR3_SW2_LEVEL3 (3 << 8) /* Software Inter 2 on Lvl 3 10-8 */ +#define ILR3_SW2_LEVEL4 (4 << 8) /* Software Inter 2 on Lvl 4 10-8 */ +#define ILR3_SW2_LEVEL5 (5 << 8) /* Software Inter 2 on Lvl 5 10-8 */ +#define ILR3_SW2_LEVEL6 (6 << 8) /* Software Inter 2 on Lvl 6 10-8 */ +#define ILR3_SW2_LEVEL7 (7 << 8) /* Software Inter 2 on Lvl 7 10-8 */ + +#define ILR3_SW1_LEVEL1 (1 << 4) /* Software Inter 1 on Lvl 1 6-4 */ +#define ILR3_SW1_LEVEL2 (2 << 4) /* Software Inter 1 on Lvl 2 6-4 */ +#define ILR3_SW1_LEVEL3 (3 << 4) /* Software Inter 1 on Lvl 3 6-4 */ +#define ILR3_SW1_LEVEL4 (4 << 4) /* Software Inter 1 on Lvl 4 6-4 */ +#define ILR3_SW1_LEVEL5 (5 << 4) /* Software Inter 1 on Lvl 5 6-4 */ +#define ILR3_SW1_LEVEL6 (6 << 4) /* Software Inter 1 on Lvl 6 6-4 */ +#define ILR3_SW1_LEVEL7 (7 << 4) /* Software Inter 1 on Lvl 7 6-4 */ + +#define ILR3_SW0_LEVEL1 1 /* Software Inter 0 on Lvl 1 2-0 */ +#define ILR3_SW0_LEVEL2 2 /* Software Inter 0 on Lvl 2 2-0 */ +#define ILR3_SW0_LEVEL3 3 /* Software Inter 0 on Lvl 3 2-0 */ +#define ILR3_SW0_LEVEL4 4 /* Software Inter 0 on Lvl 4 2-0 */ +#define ILR3_SW0_LEVEL5 5 /* Software Inter 0 on Lvl 5 2-0 */ +#define ILR3_SW0_LEVEL6 6 /* Software Inter 0 on Lvl 6 2-0 */ +#define ILR3_SW0_LEVEL7 7 /* Software Inter 0 on Lvl 7 2-0 */ + +/* Interrupt Level Register 4 0x84 31-00 */ + +#define ILR4_VIRQ7_LEVEL1 (1 << 24) /* VMEbus IRQ7 on Level 1 26-24 */ +#define ILR4_VIRQ7_LEVEL2 (2 << 24) /* VMEbus IRQ7 on Level 2 26-24 */ +#define ILR4_VIRQ7_LEVEL3 (3 << 24) /* VMEbus IRQ7 on Level 3 26-24 */ +#define ILR4_VIRQ7_LEVEL4 (4 << 24) /* VMEbus IRQ7 on Level 4 26-24 */ +#define ILR4_VIRQ7_LEVEL5 (5 << 24) /* VMEbus IRQ7 on Level 5 26-24 */ +#define ILR4_VIRQ7_LEVEL6 (6 << 24) /* VMEbus IRQ7 on Level 6 26-24 */ +#define ILR4_VIRQ7_LEVEL7 (7 << 24) /* VMEbus IRQ7 on Level 7 26-24 */ + +#define ILR4_VIRQ6_LEVEL1 (1 << 20) /* VMEbus IRQ6 on Level 1 22-20 */ +#define ILR4_VIRQ6_LEVEL2 (2 << 20) /* VMEbus IRQ6 on Level 2 22-20 */ +#define ILR4_VIRQ6_LEVEL3 (3 << 20) /* VMEbus IRQ6 on Level 3 22-20 */ +#define ILR4_VIRQ6_LEVEL4 (4 << 20) /* VMEbus IRQ6 on Level 4 22-20 */ +#define ILR4_VIRQ6_LEVEL5 (5 << 20) /* VMEbus IRQ6 on Level 5 22-20 */ +#define ILR4_VIRQ6_LEVEL6 (6 << 20) /* VMEbus IRQ6 on Level 6 22-20 */ +#define ILR4_VIRQ6_LEVEL7 (7 << 20) /* VMEbus IRQ6 on Level 7 22-20 */ + +#define ILR4_VIRQ5_LEVEL1 (1 << 16) /* VMEbus IRQ5 on Level 1 18-16 */ +#define ILR4_VIRQ5_LEVEL2 (2 << 16) /* VMEbus IRQ5 on Level 2 18-16 */ +#define ILR4_VIRQ5_LEVEL3 (3 << 16) /* VMEbus IRQ5 on Level 3 18-16 */ +#define ILR4_VIRQ5_LEVEL4 (4 << 16) /* VMEbus IRQ5 on Level 4 18-16 */ +#define ILR4_VIRQ5_LEVEL5 (5 << 16) /* VMEbus IRQ5 on Level 5 18-16 */ +#define ILR4_VIRQ5_LEVEL6 (6 << 16) /* VMEbus IRQ5 on Level 6 18-16 */ +#define ILR4_VIRQ5_LEVEL7 (7 << 16) /* VMEbus IRQ5 on Level 7 18-16 */ + +#define ILR4_VIRQ4_LEVEL1 (1 << 12) /* VMEbus IRQ4 on Level 1 14-12 */ +#define ILR4_VIRQ4_LEVEL2 (2 << 12) /* VMEbus IRQ4 on Level 2 14-12 */ +#define ILR4_VIRQ4_LEVEL3 (3 << 12) /* VMEbus IRQ4 on Level 3 14-12 */ +#define ILR4_VIRQ4_LEVEL4 (4 << 12) /* VMEbus IRQ4 on Level 4 14-12 */ +#define ILR4_VIRQ4_LEVEL5 (5 << 12) /* VMEbus IRQ4 on Level 5 14-12 */ +#define ILR4_VIRQ4_LEVEL6 (6 << 12) /* VMEbus IRQ4 on Level 6 14-12 */ +#define ILR4_VIRQ4_LEVEL7 (7 << 12) /* VMEbus IRQ4 on Level 7 14-12 */ + +#define ILR4_VIRQ3_LEVEL1 (1 << 8) /* VMEbus IRQ3 on Level 1 10-8 */ +#define ILR4_VIRQ3_LEVEL2 (2 << 8) /* VMEbus IRQ3 on Level 2 10-8 */ +#define ILR4_VIRQ3_LEVEL3 (3 << 8) /* VMEbus IRQ3 on Level 3 10-8 */ +#define ILR4_VIRQ3_LEVEL4 (4 << 8) /* VMEbus IRQ3 on Level 4 10-8 */ +#define ILR4_VIRQ3_LEVEL5 (5 << 8) /* VMEbus IRQ3 on Level 5 10-8 */ +#define ILR4_VIRQ3_LEVEL6 (6 << 8) /* VMEbus IRQ3 on Level 6 10-8 */ +#define ILR4_VIRQ3_LEVEL7 (7 << 8) /* VMEbus IRQ3 on Level 7 10-8 */ + +#define ILR4_VIRQ2_LEVEL1 (1 << 4) /* VMEbus IRQ2 on Level 1 6-4 */ +#define ILR4_VIRQ2_LEVEL2 (2 << 4) /* VMEbus IRQ2 on Level 2 6-4 */ +#define ILR4_VIRQ2_LEVEL3 (3 << 4) /* VMEbus IRQ2 on Level 3 6-4 */ +#define ILR4_VIRQ2_LEVEL4 (4 << 4) /* VMEbus IRQ2 on Level 4 6-4 */ +#define ILR4_VIRQ2_LEVEL5 (5 << 4) /* VMEbus IRQ2 on Level 5 6-4 */ +#define ILR4_VIRQ2_LEVEL6 (6 << 4) /* VMEbus IRQ2 on Level 6 6-4 */ +#define ILR4_VIRQ2_LEVEL7 (7 << 4) /* VMEbus IRQ2 on Level 7 6-4 */ + +#define ILR4_VIRQ1_LEVEL1 1 /* VMEbus IRQ1 on Level 1 2-0 */ +#define ILR4_VIRQ1_LEVEL2 2 /* VMEbus IRQ1 on Level 2 2-0 */ +#define ILR4_VIRQ1_LEVEL3 3 /* VMEbus IRQ1 on Level 3 2-0 */ +#define ILR4_VIRQ1_LEVEL4 4 /* VMEbus IRQ1 on Level 4 2-0 */ +#define ILR4_VIRQ1_LEVEL5 5 /* VMEbus IRQ1 on Level 5 2-0 */ +#define ILR4_VIRQ1_LEVEL6 6 /* VMEbus IRQ1 on Level 6 2-0 */ +#define ILR4_VIRQ1_LEVEL7 7 /* VMEbus IRQ1 on Level 7 2-0 */ + +/* + * Vector Base Register 0x88 31-24 + * I/O Control Register 1 0x88 23-16 + * I/O Control Register 2 0x88 15-08 + * I/O Control Register 3 0x88 07-00 + */ + +#define IOCR_MEIN (1 << 23) /* Enable Interrupts 23 */ +#define IOCR_SYSFL (1 << 22) /* SYSFAIL VMEbus Status 22 */ +#define IOCR_ACFL (1 << 21) /* ACFAIL VMEbus Status 21 */ +#define IOCR_ABRTL (1 << 20) /* ABORT Switch Status 20 */ +#define IOCR_GPOEN3 (1 << 19) /* GPIO3 Set as Output 19 */ +#define IOCR_GPIEN3 0x00 /* GPIO3 Set as Input 19 */ +#define IOCR_GPOEN2 (1 << 18) /* GPIO2 Set as Output 18 */ +#define IOCR_GPIEN2 0x00 /* GPIO2 Set as Input 18 */ +#define IOCR_GPOEN1 (1 << 17) /* GPIO1 Set as Output 17 */ +#define IOCR_GPIEN1 0x00 /* GPIO1 Set as Input 17 */ +#define IOCR_GPOEN0 (1 << 16) /* GPIO0 Set as Output 16 */ +#define IOCR_GPIEN0 0x00 /* GPIO0 Set as Input 16 */ + +#define IOCR_GPIOO3_HIGH (1 << 15) /* GPIO3 set to HIGH 15 */ +#define IOCR_GPIOO3_LOW 0x00 /* GPIO3 set to LOW 15 */ +#define IOCR_GPIOO2_HIGH (1 << 14) /* GPIO2 set to HIGH 14 */ +#define IOCR_GPIOO2_LOW 0x00 /* GPIO2 set to LOW 14 */ +#define IOCR_GPIOO1_HIGH (1 << 13) /* GPIO1 set to HIGH 13 */ +#define IOCR_GPIOO1_LOW 0x00 /* GPIO1 set to LOW 13 */ +#define IOCR_GPIOO0_HIGH (1 << 12) /* GPIO0 set to HIGH 12 */ +#define IOCR_GPIOO0_LOW 0x00 /* GPIO0 set to LOW 12 */ +#define IOCR_GPIOI3 (1 << 11) /* GPIO3 Status 11 */ +#define IOCR_GPIOI2 (1 << 10) /* GPIO2 Status 10 */ +#define IOCR_GPIOI1 (1 << 9) /* GPIO1 Status 9 */ +#define IOCR_GPIOI0 (1 << 8) /* GPIO0 Status 8 */ + +#define IOCR_GPI7 (1 << 7) /* GPI7 Status 7 */ +#define IOCR_GPI6 (1 << 6) /* GPI6 Status 6 */ +#define IOCR_GPI5 (1 << 5) /* GPI5 Status 5 */ +#define IOCR_GPI4 (1 << 4) /* GPI4 Status 4 */ +#define IOCR_GPI3 (1 << 3) /* GPI3 Status 3 */ +#define IOCR_GPI2 (1 << 2) /* GPI2 Status 2 */ +#define IOCR_GPI1 (1 << 1) /* GPI1 Status 1 */ +#define IOCR_GPI0 1 /* GPI0 Status 0 */ + +/* Miscellaneous Control Register 0x8c 07-00 */ + +#define MISCCR_DISSRAM (1 << 5) /* Disable SRAM decoder 5 */ + +/* VMEchip2 LM/SIG Register 0x06 */ + +#define LM_SIG_LM3 0x80 /* Location Monitor 3 7 */ +#define LM_SIG_LM2 0x40 /* Location Monitor 2 6 */ +#define LM_SIG_LM1 0x20 /* Location Monitor 1 5 */ +#define LM_SIG_LM0 0x10 /* Location Monitor 0 4 */ +#define LM_SIG_SIG3 0x08 /* SIG3 3 */ +#define LM_SIG_SIG2 0x04 /* SIG2 2 */ +#define LM_SIG_SIG1 0x02 /* SIG1 1 */ +#define LM_SIG_SIG0 0x01 /* SIG0 0 */ + +/* VMEchip2 Board Status/Control Register 0x07 */ + +#define BSCR_RST 0x80 /* Allow VMEbus master reset 7 */ +#define BSCR_ISF 0x40 /* Inhibit SYSFAIL to VMEbus 6 */ +#define BSCR_BF 0x20 /* Board Fail active 5 */ +#define BSCR_SCON 0x10 /* Board is System Controller 4 */ +#define BSCR_SYSFL 0x08 /* Board Driving SYSFAIL 3 */ + + +/* + * Local Bus Interrupter Summary (2-65 of '167 manual) + * These are values for the interrupt vector related to various + * interrupts generated locally. + */ + +/* These have the upper 4 bits defined by the contents of + * vector base register 1 + */ +#define LBIV_SOFTWARE0 0x08 +#define LBIV_SOFTWARE1 0x09 +#define LBIV_SOFTWARE2 0x0a +#define LBIV_SOFTWARE3 0x0b +#define LBIV_SOFTWARE4 0x0c +#define LBIV_SOFTWARE5 0x0d +#define LBIV_SOFTWARE6 0x0e +#define LBIV_SOFTWARE7 0x0f + +/* These have the upper 4 bits defined by the contents of + * vector base register 0 + */ +#define LBIV_GCSR_LM0 0x00 +#define LBIV_GCSR_LM1 0x01 +#define LBIV_GCSR_SIG0 0x02 +#define LBIV_GCSR_SIG1 0x03 +#define LBIV_GCSR_SIG2 0x04 +#define LBIV_GCSR_SIG3 0x05 +#define LBIV_DMAC 0x06 +#define LBIV_VIA 0x07 +#define LBIV_TT1 0x08 +#define LBIV_TT2 0x09 +#define LBIV_VIRQ1_ES 0x0a +#define LBIV_PARITY_ERROR 0x0b +#define LBIV_VMWPE 0x0c +#define LBIV_VME_SYSFAIL 0x0d +#define LBIV_ABORT 0x0e +#define LBIV_VME_ACFAIL 0x0f + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvmechip2h */ diff --git a/h/drv/vme/vsam.h b/h/drv/vme/vsam.h new file mode 100644 index 0000000..13b0dfb --- /dev/null +++ b/h/drv/vme/vsam.h @@ -0,0 +1,150 @@ +/* vsam.h - SBE VSAM Chip Set header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01e,22sep92,rrr added support for c++ +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01b,05oct90,shl added copyright notice. + made #endif ANSI style. +01a,10sep89,rld original SBE release. +*/ + +/* +This header file defines the register layout of the SBE VMEbus +Slave Address Manager chip (VSAM) and supplies alpha-numeric +equivalences for register bit definitions. +*/ + +#ifndef __INCvsamh +#define __INCvsamh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _ASMLANGUAGE +#define VSAM_ADRS(reg) (VSAM + (reg * VSAM_REG_OFFSET)) +#else +#define VSAM_ADRS(reg) ((char *) VSAM + (reg * VSAM_REG_OFFSET)) +#endif /* _ASMLANGUAGE */ + +/* Location Monitor */ + +#define VSAM_LM_VAC_0 VSAM_ADRS(0x00) /* VME Address Register 0 */ +#define VSAM_LM_VAC_1 VSAM_ADRS(0x01) /* VME Address Register 1 */ +#define VSAM_LM_VAC_2 VSAM_ADRS(0x02) /* VME Address Register 2 */ +#define VSAM_LM_VAC_3 VSAM_ADRS(0x03) /* VME Address Register 3 */ +#define VSAM_LM_BLKS_UPR VSAM_ADRS(0x04) /* VME Block Size */ +#define VSAM_LM_BLKS_LWR VSAM_ADRS(0x05) /* VME Block Size */ +#define LM_BLK_2 0x0000 /* 2 byte size */ +#define LM_BLK_4 0x0002 /* 4 byte size */ +#define LM_BLK_8 0x0006 /* 8 byte size */ +#define LM_BLK_16 0x000e /* 16 byte size */ +#define LM_BLK_32 0x001e /* 32 byte size */ +#define LM_BLK_64 0x003e /* 64 byte size */ +#define LM_BLK_128 0x007e /* 128 byte size */ +#define LM_BLK_256 0x00fe /* 256 byte size */ +#define LM_BLK_512 0x01fe /* 512 byte size */ +#define LM_BLK_1K 0x03fe /* 1K byte size */ +#define LM_BLK_2K 0x07fe /* 2K byte size */ +#define LM_BLK_4K 0x0ffe /* 4K byte size */ +#define LM_BLK_8K 0x1ffe /* 8K byte size */ +#define LM_BLK_16K 0x3ffe /* 16K byte size */ +#define LM_BLK_32K 0x7ffe /* 32K byte size */ +#define LM_BLK_64K 0xfffe /* 64K byte size */ + +#define VSAM_LM_AMU0 VSAM_ADRS(0x06) /* User Defined VME AM code #1 */ +#define VSAM_LM_AMU1 VSAM_ADRS(0x07) /* User Defined VME AM code #2 */ +#define VSAM_LM_CTR VSAM_ADRS(0x08) /* Counter */ +#define VSAM_LM_MC VSAM_ADRS(0x0a) /* Match count */ +#define VSAM_LM_CMD VSAM_ADRS(0x0c) /* Location Monitor Command */ +#define LM_CMD_FLAG 0x08 /* Command Flag */ +#define LM_CMD_DISABLE 0x0b /* cmd: disable Loc Monitor */ +#define LM_CMD_ENABLE 0x0c /* cmd: enable Loc Monitor */ +#define LM_CMD_READ_CNTR 0x0e /* cmd: read Monitor counter */ +#define LM_CMD_WRITE_CNTR 0x0f /* cmd: write Monitor counter */ +#define VSAM_LM_CTL VSAM_ADRS(0x0d) /* Location Monitor Control */ +#define LM_AMU0_ENABLE 0x04 /* Enable AMU0 usage */ +#define LM_AMU1_ENABLE 0x08 /* Enable AMU1 usage */ +#define LM_MODE_NONE 0x00 /* No address monitoring */ +#define LM_MODE_A16 0x01 /* Select A16 monitoring */ +#define LM_MODE_A24 0x02 /* Select A24 monitoring */ +#define LM_MODE_A32 0x03 /* Select A32 monitoring */ +#define VSAM_LM_VSL_UPR VSAM_ADRS(0x0e) /* VME Status Latch */ +#define LM_VSL_UAT 0x80 /* Decoded UAT transfer */ +#define LM_VSL_WORD 0x40 /* Decoded Word transfer */ +#define LM_VSL_BYTE 0x20 /* Decoded Byte transfer */ +#define LM_VSL_WRITE 0x10 /* Latched VWRITE* signal */ +#define LM_VSL_LDS1 0x08 /* Latched VDS1* signal */ +#define LM_VSL_LDS0 0x04 /* Latched VDS0* signal */ +#define LM_VSL_LA01 0x02 /* Latched VA1 signal */ +#define LM_VSL_LLWORD 0x01 /* Latched VLWORD* signal */ +#define VSAM_LM_VSL_LWR VSAM_ADRS(0x0f) /* VME Status Latch */ +#define LM_VSL_LIACK 0x80 /* Latched VIACK* signal */ +#define LM_VSL_AMASK 0x3f /* Mask for AM codes */ +#define VSAM_LM_AMR VSAM_ADRS(0x10) /* Regular VME AM codes */ +#define LM_AM_SUPER 0x38 /* Respond to supervisor */ +#define LM_AM_NONPRIV 0x07 /* Respond to non-privilege */ +#define LM_AM_SUP_ASCENDING 0x20 /* AMF */ +#define LM_AM_SUP_PGM 0x10 /* AME */ +#define LM_AM_SUP_DATA 0x08 /* AMD */ +#define LM_AM_USR_ASCENDING 0x04 /* AMB */ +#define LM_AM_USR_PGM 0x02 /* AMA */ +#define LM_AM_USR_DATA 0x01 /* AM9 */ +#define VSAM_LM_VEC VSAM_ADRS(0x11) /* Interrupt Vector */ + +/* Shared Memory */ + +#define VSAM_SM_BAV_UPR VSAM_ADRS(0x12) /* Base Addr on VMEbus */ +#define VSAM_SM_BAV_LWR VSAM_ADRS(0x13) /* Base Addr on VMEbus */ +#define VSAM_SM_BLKS VSAM_ADRS(0x14) /* Block Size */ +#define SM_BLK_64K 0x00 /* 64K byte size */ +#define SM_BLK_128K 0x01 /* 128K byte size */ +#define SM_BLK_256K 0x03 /* 256K byte size */ +#define SM_BLK_512K 0x07 /* 512K byte size */ +#define SM_BLK_1MB 0x0f /* 1MB byte size */ +#define SM_BLK_2MB 0x1f /* 2MB byte size */ +#define SM_BLK_4MB 0x3f /* 4MB byte size */ +#define SM_BLK_8MB 0x7f /* 8MB byte size */ +#define VSAM_SM_BAL VSAM_ADRS(0x15) /* Base Addr on Local Bus */ +#define VSAM_SM_AM VSAM_ADRS(0x16) /* AM codes */ +#define SM_AM_A32 0x80 /* 32-bit address response */ +#define SM_AM_A24 0x00 /* 24-bit address response */ +#define SM_AM_SUPER 0x38 /* Respond to supervisor */ +#define SM_AM_NONPRIV 0x07 /* Respond to non-privilege */ +#define SM_AM_SUP_ASCENDING 0x20 /* AMF */ +#define SM_AM_SUP_PGM 0x10 /* AME */ +#define SM_AM_SUP_DATA 0x08 /* AMD */ +#define SM_AM_USR_ASCENDING 0x04 /* AMB */ +#define SM_AM_USR_PGM 0x02 /* AMA */ +#define SM_AM_USR_DATA 0x01 /* AM9 */ +#define VSAM_IO_BAV_UPR VSAM_ADRS(0x18) /* Short I/O Base Address */ +#define VSAM_IO_BAV_LWR VSAM_ADRS(0x19) /* Short I/O Base Address */ +#define VSAM_IO_AM VSAM_ADRS(0x1a) /* Short I/O AM codes */ +#define EN_29 0x01 /* Short supervisory AM */ +#define EN_2D 0x02 /* Short non-priv AM */ +#define EN_MBX 0x04 /* Assertion of mailbox int */ + +/* Mailbox and Status Functions */ + +#define VSAM_MBX_VEC VSAM_ADRS(0x1b) /* Mailbox Intr Vector */ +#define VSAM_MBX_ISR VSAM_ADRS(0x1c) /* Interrupt Status Register */ +#define MBXP 0x80 /* Mailbox intr is pending */ +#define LMQP 0x40 /* Loc Monitor intr is pending */ +#define MBXEN 0x08 /* Mailbox intr is enabled */ +#define LMQEN 0x04 /* Loc Monitor is enabled */ +#define VSAM_MBX_USER VSAM_ADRS(0x1d) /* User Defined Register */ +#define MBX_RESET 0xa5 /* VMEbus resets local board */ +#define VSAM_MAILBOX_UPR VSAM_ADRS(0x1e)/* Mailbox Register */ +#define VSAM_MAILBOX_LWR VSAM_ADRS(0x1f)/* Mailbox Write Code Register */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvsamh */ diff --git a/h/drv/vme/vsbchip2.h b/h/drv/vme/vsbchip2.h new file mode 100644 index 0000000..c62beb3 --- /dev/null +++ b/h/drv/vme/vsbchip2.h @@ -0,0 +1,151 @@ +/* vsbchip2.h - VSBchip2 Interface Controller */ + +/* Copyright 1994-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,15nov96,dat fixed SPR 4046, offset for VSBCHIP2_PTR was corrected. +01a,16feb94,dzb written. +*/ + +/* +DESCRIPTION +This file contains constants for the VSBchip2 interface controller. +*/ + +#ifdef DOC +#define __INCvsbchip2h +#endif /* DOC */ + +#ifndef __INCvsbchip2h +#define __INCvsbchip2h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _ASMLANGUAGE +#define CAST +#define CAST_US +#define CAST_UL +#else +#define CAST (char *) +#define CAST_US (unsigned short *) +#define CAST_UL (unsigned long *) +#endif /* _ASMLANGUAGE */ + +#ifndef VSBCHIP2_BASE_ADRS +#define VSBCHIP2_BASE_ADRS 0xfff41000 +#endif /* VSBCHIP2_BASE_ADRS */ + +#ifndef VSBCHIP2_REG_INTERVAL +#define VSBCHIP2_REG_INTERVAL 1 +#endif /* VSBCHIP2_REG_INTERVAL */ + +#ifndef VSB_ADRS +#define VSB_ADRS(reg) (CAST VSBCHIP2_BASE_ADRS + (reg * VSBCHIP2_REG_INTERVAL)) +#endif /* VSB_ADRS */ + +#ifndef VSB_ADRS_US +#define VSB_ADRS_US(reg) (CAST_US VSB_ADRS(reg)) +#endif /* VSB_ADRS_US */ + +#ifndef VSB_ADRS_UL +#define VSB_ADRS_UL(reg) (CAST_UL VSB_ADRS(reg)) +#endif /* VSB_ADRS_UL */ + + +/**********************************/ +/* VSBCHIP2 register locations: */ +/**********************************/ + +#define VSBCHIP2_CCCSR VSB_ADRS_US (0x000) /* Chip Control/Status Reg */ +#define VSBCHIP2_LIVBR VSB_ADRS_US (0x002) /* Local Int Vector Base Reg */ +#define VSBCHIP2_LISR VSB_ADRS_US (0x004) /* Local Interrupt Status Reg */ +#define VSBCHIP2_LIER VSB_ADRS_US (0x006) /* Local Interrupt Enable Reg */ +#define VSBCHIP2_LILR VSB_ADRS_UL (0x008) /* Local Interrupt Level Reg */ +#define VSBCHIP2_VRCSR VSB_ADRS_US (0x010) /* VSB Req Control/Status Reg */ +#define VSBCHIP2_TCR VSB_ADRS_US (0x014) /* Timer Control Register */ +#define VSBCHIP2_TCPR VSB_ADRS_US (0x016) /* Timer Clock Prescale Reg */ +#define VSBCHIP2_LS1ARR VSB_ADRS_UL (0x018) /* Local Bus Slave Addr Reg 1 */ +#define VSBCHIP2_LS1AOR VSB_ADRS_US (0x01c) /* Local Bus Slave Off Reg 1 */ +#define VSBCHIP2_LS1AR VSB_ADRS_US (0x01e) /* Local Bus Slave Attr Reg 1 */ +#define VSBCHIP2_LS2ARR VSB_ADRS_UL (0x020) /* Local Bus Slave Addr Reg 2 */ +#define VSBCHIP2_LS2AOR VSB_ADRS_US (0x024) /* Local Bus Slave Off Reg 2 */ +#define VSBCHIP2_LS2AR VSB_ADRS_US (0x026) /* Local Bus Slave Attr Reg 2 */ +#define VSBCHIP2_LS3ARR VSB_ADRS_UL (0x028) /* Local Bus Slave Addr Reg 3 */ +#define VSBCHIP2_LS3AOR VSB_ADRS_US (0x02c) /* Local Bus Slave Off Reg 3 */ +#define VSBCHIP2_LS3AR VSB_ADRS_US (0x02e) /* Local Bus Slave Attr Reg 3 */ +#define VSBCHIP2_LS4ARR VSB_ADRS_UL (0x030) /* Local Bus Slave Addr Reg 4 */ +#define VSBCHIP2_LS4AOR VSB_ADRS_US (0x034) /* Local Bus Slave Off Reg 4 */ +#define VSBCHIP2_LS4AR VSB_ADRS_US (0x036) /* Local Bus Slave Attr Reg 4 */ +#define VSBCHIP2_LEAR VSB_ADRS_UL (0x074) /* Local Error Address Reg */ +#define VSBCHIP2_PCCR VSB_ADRS_UL (0x078) /* Prescaler Current Cnt Reg */ +#define VSBCHIP2_PTR VSB_ADRS_UL (0x07C) /* Prescaler Test Register */ +#define VSBCHIP2_EAR VSB_ADRS_UL (0x100) /* EVSB Attention Register */ +#define VSBCHIP2_ETASR VSB_ADRS_UL (0x104) /* EVSB Test-And-Set Reg */ +#define VSBCHIP2_GPR1 VSB_ADRS_UL (0x108) /* General Purpose Reg 1 */ +#define VSBCHIP2_GPR2 VSB_ADRS_UL (0x10c) /* General Purpose Reg 2 */ +#define VSBCHIP2_VESR VSB_ADRS_UL (0x110) /* VSB Error Status Register */ +#define VSBCHIP2_VICR VSB_ADRS (0x114) /* VSB Interrupt Control Reg */ +#define VSBCHIP2_VIVR VSB_ADRS (0x115) /* VSB Interrupt Vector Reg */ +#define VSBCHIP2_VIER VSB_ADRS (0x116) /* VSB Interrupt Enable Reg */ +#define VSBCHIP2_VISR VSB_ADRS (0x117) /* VSB Interrupt Status Reg */ +#define VSBCHIP2_VS1ARR VSB_ADRS_UL (0x118) /* VSB Slave Addr Range Reg 1 */ +#define VSBCHIP2_VS1AOR VSB_ADRS_US (0x11c) /* VSB Slave Addr Off Reg 1 */ +#define VSBCHIP2_VS1AR VSB_ADRS_US (0x11e) /* VSB Slave Attribute Reg 1 */ +#define VSBCHIP2_VS2ARR VSB_ADRS_UL (0x120) /* VSB Slave Addr Range Reg 2 */ +#define VSBCHIP2_VS2AOR VSB_ADRS_US (0x124) /* VSB Slave Addr Off Reg 2 */ +#define VSBCHIP2_VS2AR VSB_ADRS_US (0x126) /* VSB Slave Attribute Reg 2 */ + +/**********************************/ +/* VSBCHIP2 register definitions: */ +/**********************************/ + +/* VSBCHIP2_VRCSR register definitions: */ + +#define VRCSR_LVRWD 0x0100 /* release when done */ + +/* VSBCHIP2_VTCR register definitions: */ + +#define VTCR_VARBTD 0x1000 /* VSB arbitration timer disable */ +#define VTCR_VATS_32MS 0x0800 /* VSB access timer select (32 msecs) */ +#define VTCR_VATS_DIS 0x0c00 /* VSB access timer select (32 msecs) */ +#define VTCR_VTXS_256US 0x0200 /* VSB transfer timer select (256 usecs) */ +#define VTCR_VTXS_DIS 0x0300 /* VSB transfer timer select disabled */ + + +/* VSBCHIP2_LS1AR register definitions: */ + +#define LS1AR_REN 0x8000 /* read enable (when set, read access) */ +#define LS1AR_WEN 0x4000 /* write enable (when set, write access) */ +#define LS1AR_WPE 0x0800 /* write post enable */ +#define LS1AR_BNCEN 0x0080 /* bounce mode enable */ + +#define LS1AR_VSP1 0x0020 +#define LS1AR_VSP0 0x0010 + + +/* VSBCHIP2_VS1AR register definitions: */ + +#define VS1AR_REN 0x8000 /* read enable (when set, read access) */ +#define VS1AR_WEN 0x4000 /* write enable (when set, write access) */ +#define VS1AR_POR 0x2000 /* participate on read */ +#define VS1AR_POW 0x1000 /* participate on write */ +#define VS1AR_WPE 0x0800 /* write post enable */ +#define VS1AR_SAS 0x0400 /* system address space */ +#define VS1AR_ALTAS 0x0200 /* alternate address space */ +#define VS1AR_IOAS 0x0100 /* I/O address space */ +#define VS1AR_LOCK 0x0040 /* lock local bus on block transfers */ + +#define VS1AR_LBTS1 0x0008 +#define VS1AR_LBTS0 0x0004 +#define VS1AR_LBSC1 0x0002 +#define VS1AR_LBSC0 0x0001 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvsbchip2h */ diff --git a/h/drv/vxfusion/distIfUdp.h b/h/drv/vxfusion/distIfUdp.h new file mode 100644 index 0000000..1af0a95 --- /dev/null +++ b/h/drv/vxfusion/distIfUdp.h @@ -0,0 +1,88 @@ +/* distIfUdp.h - UDP adapter initialization routine (VxFusion) */ + +/* Copyright 1999-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,16oct01,jws ARM support +01c,11jun99,drm Changing default ring buffer size to 256. +01b,29oct98,drm removed maxTBufs argument from distIfUdpInit() +01a,31jul98,drm initial version +*/ + +#ifndef __INCdistIfUdph +#define __INCdistIfUdph + +#include "vxWorks.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * The NET_HDR structure encapsulates the fields needed by the Network Layer + * (L3) of the VxFusion protocol stack. These fields are encapsulated at a + * header at this level to allow for the flexibility of different types of + * interfaces. Interfaces with small MTU sizes may wish to use smaller headers + * to increase throughput, while interfacs with larger MTU sizes may wish to + * use larger headers to allow larger messages to be sent. The values that + * need to be set for the fields of the structure below are passed to/from + * the Network Layer within the TBuf structure. + * + * The NET_HDR structure may also be used to store values such as priority + * which may be lost if the transport doesn't support message priorities. + */ + +/* defines */ + +/* get rid of this next when underscore issue is settled */ + +#ifndef _WRS_PACK_ALIGN +# define _WRS_PACK_ALIGN(m) WRS_PACK_ALIGN(m) +#endif + + +#define UDP_IO_PORT 5011 /* UDP port for node to node comm */ +#define UDP_MTU_BUF_SZ 1500 /* MTU size to use for packets */ +#define UDP_RING_BUF_SZ 256 /* Window size used by network protocol */ +#define UDP_MAX_FRAGS 10 /* Max # fragments msg can be broken into */ + +/* typedefs */ + +typedef struct + { + uint16_t pktId; /* Packet ID */ + uint16_t pktAck; /* Last Packet ID Acked */ + uint16_t pktFragSeq; /* Fragmented packet sequence number */ + uint16_t pktLen; /* Packet Length */ + uint16_t pktType; /* Packet type (DATA, ACK,...) */ + uint16_t pktFlags; /* Packet flags HDR,MORE_MF, and/or BROADCAST */ + uint16_t priority; /* Priority */ + } _WRS_PACK_ALIGN(2) NET_HDR; /* Network Header */ + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +STATUS distIfUdpInit + ( + void *pConf, /* ptr to configuration struct */ + FUNCPTR *pStartup /* Ptr to startup routine */ + ); + +#else /* __STDC__ */ + +STATUS distIfUdpInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCdistIfUdph */ + + + diff --git a/h/drv/wdb/vision/visionTmdDrv.h b/h/drv/wdb/vision/visionTmdDrv.h new file mode 100644 index 0000000..664be4d --- /dev/null +++ b/h/drv/wdb/vision/visionTmdDrv.h @@ -0,0 +1,52 @@ +/* visionTmdDrv.h - header file for Wind River Transparent Mode Driver */ + +/* Copyright 1986-2002 Wind River Systems Inc. */ + +/* +modification history +-------------------- +01f,21dec01,g_h Rename to visionTmdDrv.h +01e,01dec01,g_h Cleaning for T2.2 +01d,05may01,g_h renaming module name to visionTMDrv.h and cleaning +01c,09apr01,rnr Changed to be a small I/O subsystem +01b,07feb01,g_h renaming module name and cleaning +01a,15may97,est written. +*/ + +#ifndef __INCvisionTmdDrvh +#define __INCvisionTmdDrvh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define TX_BUF_EMPTY 0x0000 +#define TX_READY TX_BUF_EMPTY +#define TX_BUF_NOT_EMPTY 0x8000 +#define TX_NOT_READY TX_BUF_NOT_EMPTY +#define RX_BUF_EMPTY 0x0000 +#define RX_READY RX_BUF_NOT_EMPTY +#define RX_BUF_NOT_EMPTY 0x8000 +#define RX_NOT_READY RX_BUF_EMPTY + +/* typedefs */ + +typedef struct + { + u_short status; + u_short count; + u_char buf[VISION_PKT_MTU]; + } TMD_DESCRIPTOR; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvisionTmdDrvh */ + + + + + diff --git a/h/drv/wdb/vision/wdbVisionDrv.h b/h/drv/wdb/vision/wdbVisionDrv.h new file mode 100644 index 0000000..571e2de --- /dev/null +++ b/h/drv/wdb/vision/wdbVisionDrv.h @@ -0,0 +1,131 @@ +/* wdbVisionDrv.h - header file for Wind River Generic Vision Driver */ + +/* Copyright 1986-2005 Wind River Systems Inc. */ + +/* +modification history +-------------------- +01c,11may05,j_b add return value to CREATE_CRITSECT (SPR# 107058) +01b,05may01,g_h renaming to wdbVisionDrv.h and cleaning +01a,09apr01,rnr written. +*/ + +#ifndef __INCwdbVisionDrvh +#define __INCwdbVisionDrvh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" +#include "semLib.h" + +/* defines */ + +#define VISION_DEFAULT_POLL_PRI 200 /* Rx polling task priority */ +#define VISION_DEFAULT_POLL_DELAY 2 /* Polling Task delay tick */ + +#define VISION_PKT_MTU 1488 /* Maximum Transmission Unit */ + +#define VISION_MAX_PTASK_DELAY 50 /* Maximum poll loop delay */ +#define VISION_MIN_PTASK_PRIOR 5 /* Maximum polltask priority */ +#define VISION_MAX_PTASK_PRIOR 255 /* Minimum polltask priority */ + /* (MIN/MAX reversed,0 is high) */ + +#define TX_BUFFER_SIZE (VISION_PKT_MTU * 2) /* default queue sizes */ +#define RX_BUFFER_SIZE (VISION_PKT_MTU * 2) /* changed with ioctl() */ +#define LOOP_BUFFER_SIZE (VISION_PKT_MTU * 10) /* Loopback space */ + +/* Tx/Rx Modes: used in ioctl() case statements */ + +#define VISION_POLL_MODE 0x0001 /* Polled / Pseudo Interrupt */ +#define VISION_PINTR_MODE 0x0002 +#define VISION_PISR_MODE 0x0004 +#define VISION_BLOCKED_MODE 0x0008 /* Blocking / Non-Blocking */ +#define VISION_NONBLOCKED_MODE 0x0010 +#define VISION_BUFFERED_MODE 0x0020 /* Buffered / Non-Buffered */ +#define VISION_NONBUFFERED_MODE 0x0040 +#define VISION_LPBK_MODE 0x0080 /* Normal / Loopback Mode */ +#define VISION_NORMAL_MODE 0x0100 +#define VISION_TX_QUEUE_SIZE 0x0200 /* Tx/Rx Queue Sizes */ +#define VISION_RX_QUEUE_SIZE 0x0400 +#define VISION_PTASK_PRIORITY 0x0800 /* Change pTask Priority */ +#define VISION_PTASK_DELAY 0x1000 /* Change pTask Loop Delay */ + +/* Driver States */ + +#define VISION_STATE_CLOSED 0 +#define VISION_STATE_OPEN 1 + +/* Tx/Rx Buffering Queues */ + +typedef struct + { + int nofChars; /* Number of bytes currently stored */ + int size; /* Maximum size of the queue */ + int head; /* Current start of data in queue buffer */ + int tail; /* Current end of data in queue buffer */ + char *pData; /* Buffer where data is stored */ + } VISION_QUEUE; + +/* MACRO definitions for operating system specific calls */ + +#define MEMCOPY(d, s, c) memcpy(d, s, c) + +typedef SEM_ID CRITSECT; + +#define CREATE_CRITSECT(s) (s = semMCreate(SEM_Q_FIFO)) +#define REMOVE_CRITSECT(s) semDelete(s) +#define ENTER_CRITSECT(s) semTake(s,WAIT_FOREVER) +#define EXIT_CRITSECT(s) semGive(s) + +/* + * DELAY_TASK - places the current task or thread to sleep for c msecs/ticks + */ + +#define DELAY_TASK(c) taskDelay(c) + +/* VDRIV_DEV - Wind River Vision Device descriptor */ + +typedef struct + { + DEV_HDR devHdr; /* DEV_HDR must com first */ + char state; /* State of the driver */ + char *pDeviceName; /* device name: etd/0 */ + int opMode; /* Poll/Pseudo Interrupt Mode */ + int rdWrMode; /* read/write mode */ + int bufferMode; /* Buffering mode */ + int blockMode; /* Blocking mode */ + int loopMode; /* Diagnostic loopback */ + int pollDelay; /* Polling Task Delay */ + int pollTaskId; /* Polling Task Id */ + VISION_QUEUE txQueue; /* Transmit buffer */ + VISION_QUEUE rxQueue; /* Receive buffer */ + VISION_QUEUE loopQueue; /* Loopback queue */ + CRITSECT txCrSection; /* Xmit Queue protection */ + CRITSECT rxCrSection; /* Recv Queue protection */ + CRITSECT loopCrSection; /* Loopback Queue protection */ + V_DRIVER_INTERFACE inter; /* Interface structure */ + } VDRIV_DEV ; + +/* function prototypes */ + +#if defined(__STDC__) + +IMPORT int visionDriverInit (void); +IMPORT int visionDriverCreate (char *, int, int, int, int, int); + +#else /* __STDC__ */ + +IMPORT int visionDriverInit (); +IMPORT int visionDriverCreate (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbVisionDrvh */ diff --git a/h/drv/wdb/vision/wdbVisionDrvIF.h b/h/drv/wdb/vision/wdbVisionDrvIF.h new file mode 100644 index 0000000..c5f33e6 --- /dev/null +++ b/h/drv/wdb/vision/wdbVisionDrvIF.h @@ -0,0 +1,116 @@ +/* wdbVisionDrvIF.h - Interface definitions/declations for vision DRIVER */ + +/* Copyright 1986-2002 Wind River Systems Inc. */ + +/* +modification history +-------------------- +01c,01dec01,g_h Cleaning for T2.2 +01b,05may01,g_h rename to wdbVisionDrvIF.h +01a,09apr01,rnr written. +*/ + +#ifndef __INCwdbVisionDrvIFh +#define __INCwdbVisionDrvIFh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define VDR_SUCCESS 0 /* Indicates success of requested operation */ +#define VDR_FAILURE 1 /* Indicates failure of requested operation */ + /* */ +#define VDR_WRITE_COMPLETE 0 /* Previously requested WRITE is done */ +#define VDR_WRITE_PENDING 1 /* Previously requested WRITE is not done */ + /* */ +#define VDR_DATA_FOUND 0 /* Data is pending on the receive channel */ +#define VDR_DATA_NONE 1 /* Data is NOT pending on the receive channel */ + +/* typedefs */ + +typedef unsigned char VDR_UCHAR; /* Host independent unsigned 1-byte unit */ +typedef unsigned long VDR_ULONG; /* Host independent unsigned 4-byte unit */ +typedef void * VDR_PDATA; /* Host independent void 4-byte unit */ + +#if defined(__STDC__) + +/* Open/Close prototypes */ + +typedef VDR_ULONG (*VDR_OPEN_PTR) (VDR_PDATA priv); +typedef VDR_ULONG (*VDR_CLOSE_PTR) (VDR_PDATA priv); + +/* Read/Write prototypes */ + +typedef VDR_ULONG (*VDR_READ_STATUS_PTR) (VDR_PDATA priv, VDR_ULONG * status); +typedef VDR_ULONG (*VDR_WRITE_STATUS_PTR) (VDR_PDATA priv, VDR_ULONG * status); + +/* ReadStatus/WriteStatus prototypes */ + +typedef VDR_ULONG (*VDR_READ_PTR) (VDR_PDATA priv, VDR_UCHAR * pData, + VDR_ULONG maxSize, VDR_ULONG * rcvBytes); + +typedef VDR_ULONG (*VDR_WRITE_PTR) (VDR_PDATA priv, VDR_UCHAR * pData, VDR_ULONG size); + +#else /* __STDC__ */ + +/* Open/Close prototypes */ + +typedef VDR_ULONG (*VDR_OPEN_PTR)(); +typedef VDR_ULONG (*VDR_CLOSE_PTR)(); + +/* Read/Write prototypes */ + +typedef VDR_ULONG (*VDR_READ_STATUS_PTR )(); +typedef VDR_ULONG (*VDR_WRITE_STATUS_PTR)(); + +/* ReadStatus/WriteStatus prototypes */ + +typedef VDR_ULONG (*VDR_READ_PTR)(); +typedef VDR_ULONG (*VDR_WRITE_PTR)(); + +#endif /* __STDC__ */ + +/* + * This data structure represent the interface exchange between + * the High-Level Vision driver ( wdbVisioDrv ) and the Low-Level I/O + * subsystem driver. vDriver code will make an initialization + * call into the Low-Level code. The Low-Level code will setup + * the function pointer fields with the addresses of routines + * that perform that particular operation. Also the Low-Level + * I/O will fill in the PrivateData field with a value which is + * of meaining to the Low-Level driver. This data will be given + * back to the Low-Level driver on every request. + */ + +typedef struct vDriverInterface + { + VDR_OPEN_PTR openFunc; /* Addr of OPEN routine */ + VDR_CLOSE_PTR closeFunc; /* Addr of CLOSE routine */ + VDR_READ_PTR readFunc; /* Addr of the READ routine */ + VDR_WRITE_PTR writeFunc; /* Addr of the WRITE routine */ + VDR_READ_STATUS_PTR readStatusFunc; /* Addr of the READ STATUS routine */ + VDR_WRITE_STATUS_PTR writeStatusFunc; /* Addr of the WRITE STATUS routine */ + VDR_PDATA privateData; /* Private data space */ + } V_DRIVER_INTERFACE; + +/* function prototypes */ + +/* Prototype for the Initialization call */ + +#if defined(__STDC__) + +typedef VDR_ULONG (*VDR_INIT_PTR) (V_DRIVER_INTERFACE * interfaceData); + +#else /* __STDC__ */ + +typedef VDR_ULONG (*VDR_INIT_PTR)(); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbVisionDrvIFh */ diff --git a/h/drv/wdb/vision/wdbVisionPktDrv.h b/h/drv/wdb/vision/wdbVisionPktDrv.h new file mode 100644 index 0000000..1b8ff53 --- /dev/null +++ b/h/drv/wdb/vision/wdbVisionPktDrv.h @@ -0,0 +1,89 @@ +/* wdbVisionPktDrv.h - header file for Wind River Vision Driver WDB agent packet driver */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,12jan02,g_h Renaming filed name in WDB_VISION_PKT_DEV struct +01g,01dec01,g_h Cleaning for T2.2 +01f,07may01,g_h add the FIX_IP_VH macro +01e,06may01,g_h add support for visionPORT +01d,05may01,g_h renaming moulde name to wdbVisionPktDrv.h and cleaning +01c,07feb01,g_h renaming module name and cleaning +01b,03may97,est adapted for EST Background mode emulator +01a,23aug95,ms written. +*/ + +#ifndef __INCwdbVisionPktDrvh +#define __INCwdbVisionPktDrvh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "sioLib.h" +#include "wdb/wdb.h" +#include "wdb/wdbCommIfLib.h" +#include "wdb/wdbMbufLib.h" + +/* defines */ + +/* Patch for TMD/usrWdb.c structure problem (SENS) */ + +#define FIX_IP_VH + +#define WDB_VISION_PKT_MTU 1488 /* MUST MATCH VISION_PKT_MTU */ + /* in wdbVisionDrv.h */ + +/* lower WDB_MTU to WDB_VISION_PKT_MTU for Wind River Vision Connections */ + +#if (WDB_MTU > WDB_VISION_PKT_MTU) +#undef WDB_MTU +#define WDB_MTU WDB_VISION_PKT_MTU +#endif /* (WDB_MTU > WDB_VISION_PKT_MTU) */ + +#define VISION_DUMMY_PORT ((u_short)0x1237) /* port number for wdb packet */ +#define VISION_DUMMY_IP_ADRS 0x12345678 /* ip address for wdb packet */ + +#define IP_HDR_SIZE 20 /* UDP/IP Header Information */ +#define UDP_HDR_SIZE 8 +#define UDP_IP_HDR_SIZE (IP_HDR_SIZE + UDP_HDR_SIZE) + +/* data types */ + +typedef struct + { + WDB_DRV_IF wdbDrvIf; /* This must be first */ + int fileFd; /* Vision Driver file descriptor from open() */ + int pollTaskId; /* Polling Task Id */ + int mode; /* current mode - poll or int (not used) */ + bool_t inputBusy; + bool_t outputBusy; + char * pRxBuffer; /* Input Buffer, loaned to agent on receipt */ + int bytesRead; + char * pTxBuffer; /* Output Buffer, chain of mbufs */ + int bytesWritten; + } WDB_VISION_PKT_DEV; + + +/* function prototypes */ + +#if defined(__STDC__) + +IMPORT int wdbVisionPktDevInit (WDB_VISION_PKT_DEV *pPktDev, void (*stackRcv)()); + +#else /* __STDC__ */ + +IMPORT int wdbVisionPktDevInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbVisionPktDrvh */ + diff --git a/h/drv/wdb/wdbBdmPktDrv.h b/h/drv/wdb/wdbBdmPktDrv.h new file mode 100644 index 0000000..5ece625 --- /dev/null +++ b/h/drv/wdb/wdbBdmPktDrv.h @@ -0,0 +1,61 @@ +/* wdbBdmPktDrv.h - header file for WDB agents bdm packet driver */ + +/* Copyright 1998-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,26apr02,dat Adding cplusplus protection, SPR 75017 +01a,16jun98,vrd written. +*/ + +/* +This is an unsupported release of the Background Debug Mode (BDM) Back +End. It is provided AS IS with no warranties of any kind. +*/ + +#ifndef __INCwdbBdmPktDrvh +#define __INCwdbBdmPktDrvh + +/* includes */ + +#include "sioLib.h" +#include "wdb/wdb.h" +#include "wdb/wdbCommIfLib.h" +#include "wdb/wdbMbufLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define WDB_BDM_PKT_MTU 1500 /* MTU of this driver */ + +/* data types */ + +typedef struct /* hidden */ + { + WDB_DRV_IF wdbDrvIf; /* a packet dev must have this first */ + u_int mode; /* current mode - poll or int */ + } WDB_BDM_PKT_DEV; + +/* function prototypes */ + +#if defined(__STDC__) + +extern STATUS wdbBdmPktDevInit (WDB_BDM_PKT_DEV *pPktDev, + void (*stackRcv)()); + +#else /* __STDC__ */ + +extern STATUS wdbBdmPktDevInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbBdmPktDrvh */ + diff --git a/h/drv/wdb/wdbEndPktDrv.h b/h/drv/wdb/wdbEndPktDrv.h new file mode 100644 index 0000000..d3afd03 --- /dev/null +++ b/h/drv/wdb/wdbEndPktDrv.h @@ -0,0 +1,114 @@ +/* wdbEndPktLib.h - header file for WDB agents END based packet driver */ + +/* Copyright 1996-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01l,10feb04,dbt Decreased MTU to 512 to avoid packet fragmentation (this is + not supported with WDB END driver). +01k,26apr02,dat Adding cplusplus protection, SPR 75017 +01j,30oct01,jhw Copied version TOR3_1-RC-1. +01i,02aug99,dbt added WDB standalone agent support. +01h,26feb99,dbt set WDB END driver MTU to 1500. +01g,25sep97,gnn SENS beta feedback fixes +01f,22aug97,gnn update of polled mode. +01e,19aug97,gnn changes due to new buffering scheme. +01d,21jan97,gnn added a source NET_ADDRESS. +01c,04nov96,gnn change the MTU size +01b,23oct96,gnn name changes to follow coding standards +01a,01jul96,gnn written. +*/ + +#ifndef __INCwdbEndPktLibh +#define __INCwdbEndPktLibh + +/* includes */ + +#include "end.h" +#include "wdb/wdb.h" +#include "wdb/wdbCommIfLib.h" +#include "wdb/wdbMbufLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define WDB_END_PKT_MTU 512 /* MTU of this driver */ + +/* data types */ + +typedef struct /* hidden */ + { + WDB_DRV_IF wdbDrvIf; /* a packet dev must have this first */ + + u_int mode; /* current mode - poll or int */ + + /* END Cookie since we bind to a lower layer. */ + + void* pCookie; + + /* input buffer - loaned to the agent when a packet arrives */ + + bool_t inputBusy; + M_BLK_ID pInBlk; + + /* Need a place to store outgoing packet for the driver. */ + + M_BLK_ID pOutBlk; + + /* output buffers - a chain of mbufs given to us by the agent */ + + bool_t outputBusy; + + /* device register addresses etc */ + + /* Addressing information. + * We have to fake the addressing because the last thing we + * want is to have to try and broadcast an ARP to find the + * hardware address of the remote side. + * The solution is to keep track of the last IP address that + * we communicated with and the associated hardware address + * for that host. + * If we don't have that info then we send the IP packet + * in a broadcast Ethernet packet (ff:ff:ff:ff:ff:ff) so + * so that the host will see it. This limits our ability + * to do system level debugging with things like Ethernet + * to the local network. + */ + + M_BLK_ID lastHAddr; + M_BLK_ID srcAddr; + + /* device IP address */ + + struct in_addr ipAddr; + } WDB_END_PKT_DEV; + +/* function prototypes */ + +#if defined(__STDC__) + +extern STATUS wdbEndPktDevInit + ( + WDB_END_PKT_DEV *pPktDev, /* device structure to init */ + void (*stackRcv)(), /* receive packet callback (udpRcv) */ + char * pDevice, /* Device (ln, ie, etc.) that we wish to */ + /* bind to. */ + int unit /* unit number (0, 1, etc.) */ + ); + +#else /* __STDC__ */ + +extern STATUS wdbEndPktDevInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbEndPktLibh */ + diff --git a/h/drv/wdb/wdbNetromPktDrv.h b/h/drv/wdb/wdbNetromPktDrv.h new file mode 100644 index 0000000..0ccb93f --- /dev/null +++ b/h/drv/wdb/wdbNetromPktDrv.h @@ -0,0 +1,63 @@ +/* wdbNetcomPktDrv.h - header file for debug agents NETROM packet driver */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,26apr02,dat Adding cplusplus protection, SPR 75017 +01c,25oct95,ms changed params to wdbNetromPktDevInit. +01b,28jun95,tpr added pollDelay argument in wdbNetromPktDevInit(). +01a,28jun95,ms written. +*/ + +#ifndef __INCwdbNetcomPktLibh +#define __INCwdbNetcomPktLibh + +/* includes */ + +#include "wdb/wdb.h" +#include "wdb/wdbCommIfLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define NETROM_MTU 500 + +/* data types */ + +typedef struct /* hidden */ + { + WDB_DRV_IF wdbDrvIf; /* first field for any packet device */ + char inBuf [NETROM_MTU]; /* input buffer */ + BOOL inBufFull; /* input buffer is full */ + int bytesRead; /* bytes read into input buffer */ + } WDB_NETROM_PKT_DEV; + +/* function prototypes */ + +#if defined(__STDC__) + +extern void wdbNetromPktDevInit (WDB_NETROM_PKT_DEV *pPktDev, + caddr_t dpBase, + int width, + int index, + int numAccess, + void (*stackRcv)(), + int pollDelay); + +#else /* __STDC__ */ + +extern void wdbNetromPktDevInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbNetcomPktLibh */ + diff --git a/h/drv/wdb/wdbPipePktDrv.h b/h/drv/wdb/wdbPipePktDrv.h new file mode 100644 index 0000000..f2cfa57 --- /dev/null +++ b/h/drv/wdb/wdbPipePktDrv.h @@ -0,0 +1,75 @@ +/* wdbPipePktLib.h - header file for WDB agents pipe packet driver */ + +/* Copyright 1998-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,26apr02,dat Adding cplusplus protection, SPR 75017 +01c,21may98,dbt modified wdbPipePktDevInit prototype. +01b,09apr98,pdn fixed the WDB_PIPE_PKT_MTU to match w/ tgtsvr. +01a,11mar98,pdn written. +*/ + +#ifndef __INCwdbPipePktLibh +#define __INCwdbPipePktLibh + +/* includes */ + +#include "sioLib.h" +#include "wdb/wdb.h" +#include "wdb/wdbCommIfLib.h" +#include "wdb/wdbMbufLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define WDB_PIPE_PKT_MTU 1500 /* MTU of this driver */ + +/* data types */ + +typedef struct /* hidden */ + { + WDB_DRV_IF wdbDrvIf; /* a packet dev must have this first */ + + u_int mode; /* current mode - poll or int */ + + /* input buffer - loaned to the agent when a packet arrives */ + + bool_t inputBusy; + char inBuf [WDB_PIPE_PKT_MTU + sizeof(short)]; + + /* output buffers - a chain of mbufs given to us by the agent */ + + bool_t outputBusy; + + int h2t_fd; + int t2h_fd; + + /* device register addresses etc */ + + } WDB_PIPE_PKT_DEV; + +/* function prototypes */ + +#if defined(__STDC__) + +extern STATUS wdbPipePktDevInit (WDB_PIPE_PKT_DEV *pPktDev, + /* device specific init params, */ + void (*stackRcv)()); + +#else /* __STDC__ */ + +extern STATUS wdbPipePktDevInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbPipePktLibh */ + diff --git a/h/drv/wdb/wdbSlipPktDrv.h b/h/drv/wdb/wdbSlipPktDrv.h new file mode 100644 index 0000000..622f4ef --- /dev/null +++ b/h/drv/wdb/wdbSlipPktDrv.h @@ -0,0 +1,73 @@ +/* wdbSlipPktLib.h - header file for WDB agents SLIP packet driver */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,26apr02,dat Adding cplusplus protection, SPR 75017 +01b,15jun95,ms changed SIO_DEV to SIO_CHAN +01a,20dec94,ms written. +*/ + +#ifndef __INCwdbSlipPktLibh +#define __INCwdbSlipPktLibh + +/* includes */ + +#include "sioLib.h" +#include "wdb/wdb.h" +#include "wdb/wdbCommIfLib.h" +#include "wdb/wdbMbufLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define SLMTU 1006 /* be compatible with BSD 4.3 SLIP */ + +/* data types */ + +typedef struct /* hidden */ + { + WDB_DRV_IF wdbDrvIf; /* all packet device have this */ + SIO_CHAN * pSioChan; /* underlying serial channel */ + + u_int mode; + + /* only one input buffer at a time for RPC's */ + + u_int inputState; + caddr_t inBufPtr; + char inBufBase [SLMTU]; + caddr_t inBufEnd; + + /* output is a chain of mbufs */ + + struct mbuf * pMbuf; + u_int outputState; + int outputIx; + } WDB_SLIP_PKT_DEV; + +/* function prototypes */ + +#if defined(__STDC__) + +extern void wdbSlipPktDevInit (WDB_SLIP_PKT_DEV *pPktDev, + SIO_CHAN *pSioChan, + void (*inputRtn)()); + +#else /* __STDC__ */ + +extern void wdbSlipPktDevInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbSlipPktLibh */ + diff --git a/h/drv/wdb/wdbTemplatePktDrv.h b/h/drv/wdb/wdbTemplatePktDrv.h new file mode 100644 index 0000000..1699bff --- /dev/null +++ b/h/drv/wdb/wdbTemplatePktDrv.h @@ -0,0 +1,70 @@ +/* wdbTemplatePktLib.h - header file for WDB agents template packet driver */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,26apr02,dat Adding cplusplus protection, SPR 75017 +01a,23aug95,ms written. +*/ + +#ifndef __INCwdbTemplatePktLibh +#define __INCwdbTemplatePktLibh + +/* includes */ + +#include "sioLib.h" +#include "wdb/wdb.h" +#include "wdb/wdbCommIfLib.h" +#include "wdb/wdbMbufLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define WDB_TEMPLATE_PKT_MTU 1000 /* MTU of this driver */ + +/* data types */ + +typedef struct /* hidden */ + { + WDB_DRV_IF wdbDrvIf; /* a packet dev must have this first */ + + u_int mode; /* current mode - poll or int */ + + /* input buffer - loaned to the agent when a packet arrives */ + + bool_t inputBusy; + char inBuf [WDB_TEMPLATE_PKT_MTU]; + + /* output buffers - a chain of mbufs given to us by the agent */ + + bool_t outputBusy; + + /* device register addresses etc */ + + } WDB_TEMPLATE_PKT_DEV; + +/* function prototypes */ + +#if defined(__STDC__) + +extern void wdbTemplatePktDevInit (WDB_TEMPLATE_PKT_DEV *pPktDev, + /* device specific init params, */ + void (*stackRcv)()); + +#else /* __STDC__ */ + +extern void wdbTemplatePktDevInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbTemplatePktLibh */ + diff --git a/h/drv/wdb/wdbUlipPktDrv.h b/h/drv/wdb/wdbUlipPktDrv.h new file mode 100644 index 0000000..32b283f --- /dev/null +++ b/h/drv/wdb/wdbUlipPktDrv.h @@ -0,0 +1,56 @@ +/* wdbUlipPktDrv.h - header file for WDB agents ULIP packet driver */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,26apr02,dat Adding cplusplus protection, SPR 75017 +01a,28jun95,ms written. +*/ + +#ifndef __INCwdbUlipPktLibh +#define __INCwdbUlipPktLibh + +/* includes */ + +#include "wdb/wdb.h" +#include "wdb/wdbCommIfLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define ULIP_MTU 1500 + +/* bimodal ULIP device */ + +typedef struct /* hidden */ + { + WDB_DRV_IF wdbDrvIf; /* must come first for wdbUdpLib */ + int ulipFd; /* UNIX fd of ULIP device */ + bool_t inBufLocked; /* state of input buffer */ + char inBuf[ULIP_MTU]; /* input buffer */ + } WDB_ULIP_PKT_DEV; + +/* function prototypes */ + +#if defined(__STDC__) + +extern void wdbUlipPktDevInit (WDB_ULIP_PKT_DEV *pPktDev, char * ulipDev, + void (*inputRtn)()); + +#else /* __STDC__ */ + +extern void wdbUlipPktDevInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbUlipPktLibh */ + diff --git a/h/drv/wdb/wdbVioDrv.h b/h/drv/wdb/wdbVioDrv.h new file mode 100644 index 0000000..f22b74c --- /dev/null +++ b/h/drv/wdb/wdbVioDrv.h @@ -0,0 +1,40 @@ +/* wdbVioDrv.h - header file for remote debug packet library */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,26apr02,dat Adding cplusplus protection, SPR 75017 +01a,28jun95,ms written. +*/ + +#ifndef __INCwdbVioDrvh +#define __INCwdbVioDrvh + +/* includes */ + +#include "wdb/wdb.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* function prototypes */ + +#if defined(__STDC__) + +extern void wdbVioDrv (char * devName); + +#else /* __STDC__ */ + +extern void wdbPktDevInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbVioDrvh */ + diff --git a/h/drv/wlan/dot11Bsp.h b/h/drv/wlan/dot11Bsp.h new file mode 100644 index 0000000..6737597 --- /dev/null +++ b/h/drv/wlan/dot11Bsp.h @@ -0,0 +1,109 @@ +/* dot11Bsp.h - Contains definitions used to communicate with the BSP */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification History +-------------------- +02e,09sep05,rb Added countryCode as boot parameter +02d,25jan05,rb Made security components optionally buildable +02c,07jan05,rb Added members to dot11BspFuncs for 802.1X Integration +02b,01nov04,rb Added settings for security policy +02a,25aug04,rb Wind River Wireless Ethernet Driver 2.0 FCS +*/ + +/* +DESCRIPTION + +This file contains the definitions necessary for the DOT11 Frameowrk to load +the Atheros cards from the BSP, as defined in sysAr521xEnd.c + +*/ + +#ifndef __INCdot11Bsph +#define __INCdot11Bsph +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* This structure is used to hold basic default WLAN configuration parameters +that are used by the device driver on start up. They can be defined by +the user through the project facility or by making modifications to this +file and using the command line build option */ +typedef struct dot11_default_config_s + { + char* ssid; /* Default SSID */ + UINT32 mode; /* Default Station mode */ + UINT32 radio; /* Default radio */ + UINT32 channel; /* Default channel */ + UINT32 country; + + UINT32 secPol; /* Security Policy : a bitmap of allowed sec. policies */ + UINT32 authPol; /* Authentication Policy: specifies 802.1X or PSK */ + UINT32 ciphPol; /* Cipher Policy: Specifies list of allowed ciphers */ + + UINT8 preSharedKey[64]; /* If authPol == PSK, then this contains the PSK*/ + char * rsnPassphrase; + } DOT11_DEFAULT_CONFIG; + +typedef struct dot11_bsp_func + { + /* Connect interrupt handler to vector */ + void (*sysIntConnect)(int, int, int, STATUS*); + /* Disconnect interrupt handler from vector */ + void (*sysIntDisconnect)(int, int, int, STATUS*); + /* System level interrupt enable */ + void (*sysIntEnable)(INT32, STATUS*); + /* System level interrupt disable */ + void (*sysIntDisable)(INT32, STATUS*); + /* Micro second delay */ + void (*sysUsDelay)(int); + /* Cache invalidate function */ + STATUS (*sysCacheInvalidate)(void*, UINT32); + /* Cache flush function */ + STATUS (*sysCacheFlush)(void*, UINT32); + /* Converts bus address to CPU address */ + UINT32 (*sysPhysToVirt) (UINT32); + /* Converts CPU address to bus address */ + UINT32 (*sysVirtToPhys) (UINT32); + /* Write buffer flush function */ + STATUS (*sysWbufFlush)(); + /* Memory poll deallocation function */ + void (*sysDmaMemFree)(UINT32); + + /* SME types declared here so that the configlettes / cmd line can + include or exclude them at will */ + STATUS (*essInit)(DOT11_FW*); + STATUS (*ibssInit)(DOT11_FW*); + STATUS (*apInit)(DOT11_FW*); + STATUS (*rsnInit)(DOT11_FW*); + + + } DOT11_BSP_FUNC; + +typedef struct dot11_bsp_info + { + UINT32 magicNum; /* version */ + UINT32 memBaseAddr; /* Mem base */ + UINT32 ivec; /* IRQ vector */ + UINT32 ilevel; /* IRQ level */ + UINT16 pciVendorId; /* PCI Vendor Id */ + UINT16 pciSubVendorId; /* PCI Subvendor Id*/ + UINT16 pciDeviceId; /* PCI Dev ID */ + UINT16 pciSubDeviceId; /* PCI Sub dev Id */ + UINT32 dmaBuffAddr; /* DMA buffer addr */ + UINT32 dmaBufSize; /* dma Buffer Size */ + UINT32 cacheLineSz; /* cache line size */ + UINT32 cfgFlag; /* configuration flag */ + UINT8 pciChipSetRev; /* chipset version */ + DOT11_BSP_FUNC* binding; /* access function provided by BSP */ + DOT11_DEFAULT_CONFIG* config; /* Default configuration */ + } DOT11_BSP_INFO; + +#define DOT11_BSP_INFO_VER_0 0x1001 + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* __INCdot11Bsph */ + diff --git a/h/drv/wlan/dot11HddLib.h b/h/drv/wlan/dot11HddLib.h new file mode 100644 index 0000000..2d80a37 --- /dev/null +++ b/h/drv/wlan/dot11HddLib.h @@ -0,0 +1,29 @@ +/* dot11HddLib.h - Contains function prototypes for the built-in HDD types*/ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification History +-------------------- +02a,25aug04,rb Wind River Wireless Ethernet Driver 2.0 FCS +*/ + +#ifndef __INCdot11HddLibh +#define __INCdot11HddLibh +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Atheros device driver chip set device and vendor identifiers */ +#define AR_PCI_VEN_ID (0x168C) +#define AR_PCI_DEV_AR5211 (0x0012) +#define AR_PCI_DEV_AR5212 (0x0013) + +/* This is the initialize function for the AR521X driver for Atheros based +802.11 A/B/G solutions using the Atheros 5211/5212 MAC */ +STATUS ar52Initialize ( DOT11_FW * pDot11 ); + +#ifdef __cplusplus + } +#endif /* __cplusplus */ +#endif /* __INCdot11JddLibh */ diff --git a/h/drv/wlan/dot11Lib.h b/h/drv/wlan/dot11Lib.h new file mode 100644 index 0000000..b3d7e4f --- /dev/null +++ b/h/drv/wlan/dot11Lib.h @@ -0,0 +1,2161 @@ +/* dot11Lib.h - Contains the main definitions for the 802.11 Framework. */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification History +-------------------- +03u,09sep05,rb Added countryCode as boot parameter +03t,25aug05,rb Added 11d info to channel structure +03t,30aug05,rb Removed EIOCSUNICASTKEYNUM and related +03s,19aug05,rb Added Turbo support +03r,19aug05,rb Increased timeout time for Windows stations +03q,04aug04,rb Moved DOT11_CHANNEL_LIST to dot11UsrLib.h +03p,04aug05,rb Increase default passive scan time to be greater than default + beacon interval +03o,03aug05,rb Implemented user authentication callback +03n,28jul05,rb Added hdd->calTime +03m,28jul05,rb Added hdd->calTimer +03l,25jul05,rb Removed pAp->pmCount +03k,20jul05,rb Fix #warning +03j,14jul05,rb Implemented KSL memory pool, moved lastSeq into pDot11 +03i,14jul05,rb Move pmState to SME_OBJ to alllow DOT11_MODE_NONE config +03h,10jun05,rb Added RSN passphrase caching and 4way timer +03g,18may05,rb Fix for bug B0367 - TSN does not work on Sta +03f,28apr05,rb Added _BIT definition to dot11UsrLib.h; Moved encryption types + to usrLib +03e,25apr05,rb Moved definitions needed for IOCTLs from dot11Lib.h to + dot11UsrLib.h +03d,22apr05,rb Added authentication callback wrapper +03c,15apr05,rb Corrected 4-way retry time to value specified by standard +03b,14apr05,rb Added support fr Transmit Power Scaling (WIOCSTXPOWERSCALE) +03a,06apr05,rb Fix for SPR 107235: data path does not handle non-ethernet + packets correctly +02z,09mar05,rb Change prototype of pDot11->sme->ksl.show +02y,09mar05,rb Added hdd->hwVersionGet +02x,08mar05,rb Added dtimPacketFlush() to HDD_OBJ +02w,03mar05,rb Security code review changes +02v,01mar05,rb Modified definition of WIOCSDOT1XPORTSTATUS and + WIOCSAUTHCALLBACK +02u,16feb05,rb Renumbered IOCTLs to work with RTP management +02t,11feb05,rb Increased timeout +02s,11feb05,rb Adjusted EAPOL-timeout +02r,04feb05,rb Added B/G compatibility mode +02q,02feb05,rb Resolved vxWorks 6.0 compatability issue (cioTimer.h) +02p,26jan05,rb Implemented SKA +02o,25jan05,rb Made security components optionally buildable +02n,21jan05,rb Added hdd->countryCodeChange() and hdd->macAddrChange() +02m,21jan05,rb Removed some dead IOCTLs +02l,20jan05,rb Added new security stats, MIC ctrmsrs +02k,17jan05,rb Revised DOT11_SCAN_REQ structure +02j,06jan05,rb Added decrypt & MIC error counters, MIC countermeasures +02i,05jan05,rb Fix for SPR 103854 - Need to update reference in TXD to use + MBlks +02h,04jan05,rb Added gtkRecalc member to RSN_OBJ +02g,23dec04,rb Memory footprint reduction +02f,21dec04,rb Added WPA2/802.11i support +02e,01nov04,rb Added security policy parameters +02d,27oct04,rb Added WEP Key Mapping Support +02c,03oct04,rb Changes from dot11SmeApLib.c and dot11SmeIbssLib.c code review +02b,26aug04,rb Fix for SPR 101351 : Supplicant does not work on LE + architectures. +02a,25aug04,rb Wind River Wireless Ethernet Driver 2.0 FCS +*/ + +#ifndef __INCdot11Libh +#define __INCdot11Libh +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include +#include +#include +#include +#include +#include +#include "dot11UsrLib.h" + +/************************************************************************ +* USER MODIFIABLE PARAMETERS +************************************************************************/ + +/* Memory initialization constants */ +#define DOT11_NUMCL 256 +#define DOT11_NUMCLBLK DOT11_NUMCL +#define DOT11_NUMMBLK DOT11_NUMCL * 2 + +/* +* DOT11_FOURWAY_MSG_TIMEOUT - specified the amount of time the RSN libraries +* will wait for a response to an EAPOL-KEY message before assuming the +* message is lost and retrying +*/ +#define DOT11_FOURWAY_MSG_TIMEOUT (sysClkRateGet() / 2) /* 500 ms */ + +/* +* DOT11_FOURWAY_GLOBAL_TIMEOUT - specified the amount of time the RSN libraries +* will wait for the fourway handshake to complete before resetting the +* connection. +*/ +#define DOT11_FOURWAY_GLOBAL_TIMEOUT (sysClkRateGet() * 3 / 2) /* 1500 ms */ + +/* +* DOT11_FOURWAY_8021X_TIMEOUT - specified the amount of time the RSN libraries +* will wait for the 802.1X auth to finish and the fourway handshake to +* commence before resetting the connection. +*/ +#define DOT11_FOURWAY_8021X_TIMEOUT (sysClkRateGet() * 20) /* 20 sec */ + +/* +* DOT11_FOURWAY_TIMEOUT_MAX - Maximum number of times that the RSN libraries +* will resent an EAPOL-KEY message before assuming that there is an +* error and giving up. +*/ +#define DOT11_FOURWAY_TIMEOUT_MAX 5 + + +/* +* DOT11_FRAGMENT_TIMEOUT_TICKS - The maximum delay between fragments, in +* ticks of the kernel clock. Since the kernel clock is really +* coarse, pretty much any value is reasonable - fragments should not +* be delayed by much time at all. +*/ +#define DOT11_FRAGMENT_TIMEOUT_TICKS 10 + +/* +* DOT11_KSL_POOL_SIZE - The number of entries in the KSL pool. This represents +* an upper limit on the number of stations or APs that the device can +* keep track of. This number should be increased for a device that +* will be operated in an extremely busy environment +*/ +#define DOT11_KSL_POOL_SIZE 64 + +/* +* DOT11_KSL_CLEANUP_TIME - The time between cleanups of the KSL. Every +* DOT11_KSL_CLEANUP_TIME seconds, the KSL cleanup task runs, to check +* for any stale/inactive KSL entries and return them to the free pool. +*/ +#define DOT11_KSL_CLEANUP_TIME (sysClkRateGet() * 60 * 2) /* 2 min */ +/* +* DOT11_KSL_MAX_AGE - This is the amount of time a station can be inactive for +* before the KSL considers it to be "inactive". Entries with an +* inactivity time older than this value are eligible for deletion next +* time the KSL cleanup task runs. +*/ +#define DOT11_KSL_MAX_AGE (sysClkRateGet() * 60 * 5) /* 5 min */ + + +/************************************************************************ +* CONSTANT PARAMETERS - Do not change anything below this point +************************************************************************/ + +/* Forward declaration of DOT11_FW so the objects below can use it */ +typedef struct dot11Framework DOT11_FW; + +/* Include the slave header files */ + +#include "drv/wlan/dot11SmeIbssLib.h" +#include "drv/wlan/dot11SmeEssLib.h" +#include "drv/wlan/dot11SmeApLib.h" + +typedef unsigned long long int DOT11_UINT64; + +/* This is a really handy macro that we're going to need. We'll define it if +it's not already defined */ +#ifndef _BIT +#define _BIT(x) (1<<(x)) +#endif + + +#define DOT11_MAC_ADDR_STR "%02x:%02x:%02x:%02x:%02x:%02x" + +#define DOT11_MAC_ADDR(x) (x)[0],(x)[1],(x)[2],(x)[3],(x)[4],(x)[5] +#define DOT11_IS_MCAST(x) (((x)[0] & 0x01) == 0x01) + + +/* These macros convert between native byte oder and the oder used by the PCI +bus, Little Endian */ +#if (_BYTE_ORDER == _BIG_ENDIAN) +#define DOT11_LE_TO_CPU_16(x) (((x) >> 8) | (((x) & 0xff) << 8)) +#define DOT11_CPU_TO_LE_16(x) (((x) >> 8) | (((x) & 0xff) << 8)) +#define DOT11_LE_TO_CPU_32(x) LONGSWAP(x) +#define DOT11_CPU_TO_LE_32(x) LONGSWAP(x) + +#define DOT11_BCOPY_LE_TO_CPU(src, dst, len) dot11BcopySwap(src,dst,len) + +#else +#define DOT11_LE_TO_CPU_16(x) (x) +#define DOT11_CPU_TO_LE_16(x) (x) +#define DOT11_LE_TO_CPU_32(x) (x) +#define DOT11_CPU_TO_LE_32(x) (x) + +#define DOT11_BCOPY_LE_TO_CPU(src, dst, len) bcopy(src,dst,len) +#endif + +/************************************************************************* +*Debugging macros that control the debug levels +**************************************************************************/ + +/* *** undefine this to get rid of all debugging in the driver. This might +be desirable for production builds */ +#define DOT11_DEBUG_GLOBAL +#ifdef DOT11_DEBUG_GLOBAL + +/* Debug level definitions */ +#define DOT11_DEBUG_ALL 0 /* Always log message */ +#define DOT11_DEBUG_FATAL 1 /* Non-recoverable error */ +#define DOT11_DEBUG_ERROR 2 /* Recoverable error */ +#define DOT11_DEBUG_INFO 3 /* Information message */ +#define DOT11_DEBUG_FLOOD 4 /* Packet traces, info in a loop */ +#define DOT11_DEBUG_NONE 99 /* Do not print any debug info */ + +/* Debug area definitions */ +#define DOT11_AREA_ALL 0 /* Don't use for macro */ +#define DOT11_AREA_INIT 1 +#define DOT11_AREA_SME 2 +#define DOT11_AREA_DPE 3 +#define DOT11_AREA_HDD 4 +#define DOT11_AREA_INT 5 +#define DOT11_AREA_RSN 6 +#define DOT11_MAX_DEBUG_AREAS 7 + +IMPORT INT32 dot11DebugArray[DOT11_MAX_DEBUG_AREAS]; + +#define DOT11_LOG(level, area, message) \ + if ((level) <= dot11DebugArray[(area)]) logMsg message + +/* DOT11_LOG_FLUSH is used after passing a string parameter to cause logLib +to execute immediately. This should not be used on the critical path */ +#define DOT11_LOG_FLUSH taskDelay(0) + +/* DOT11_ASSERT() is no longer supported, but it is necessary to keep it in +for a while for backwards compatability */ +#define DOT11_ASSERT(x) + +#else /* ! DOT11_DEBUG_GLOBAL */ + +#define DOT11_LOG(level, area, message) +#define DOT11_LOG_FLUSH +#define DOT11_ASSERT(x) +#endif /* DOT11_DEBUG_GLOBAL */ + + + +/* Channel flags */ +#define DOT11_RADIO_UNKNOWN -1 + +/* These modes are not currently implemented */ +#define DOT11_RADIO_MAX 0x20 + +/* The total number of the above modes that we support. +It is used in ar52SuppRateGet() */ +#define DOT11_RADIO_SUPP_MODES 3 + +#define DOT11_CHANNEL_INVALID 0 + +IMPORT const char * dot11ModeStr[]; +IMPORT const char * dot11ModeNames[]; +IMPORT const char * dot11BcastMAC; +IMPORT const char * dot11NullMAC; +IMPORT const char * dot11EncryptNames[]; +IMPORT const char * dot114wayStateNames[]; +IMPORT const char * dot11SecPolNames[]; +IMPORT const char * dot11AuthPolNames[]; +IMPORT const char * dot11AuthTypeStr[]; + +/* Values for hdd.pmState */ +#define DOT11_PMMODE_ACTIVE 1 +#define DOT11_PMMODE_POWERSAVE 2 + +#define DOT11_SNAP_HEADER_LEN 8 + +typedef struct +{ + UINT16 snap; + UINT16 control; /* first byte contain actual control field */ + UINT16 orgCode; + UINT16 protocol; +} _WRS_PACK_ALIGN(1) DOT11_LLC_HEADER; + +#define DOT11_LLC_RFC1024 0x00F8 +#define DOT11_LLC_8021H 0x0000 + +#define DOT11_ETHER_HEADER_LEN 14 +#define DOT11_FCS_SIZE 4 /* Size of Frame Checksum field */ + +#define DOT11_MTU 2304 +#define DOT11_MAX_PACKET 2346 +#define DOT11_ETHERMTU 1500 +#define DOT11_MAXRATE 54 + +/* Fix for SPR 101351 - preswap DOT1X_ETHERTYPE, then swap it back for BE +archs */ +#define DOT1X_ETHERTYPE DOT11_CPU_TO_LE_16(0x8e88) + +#define DOT1X_CALLBACK_ASSOC (1) /* Callback called due to association*/ +#define DOT1X_CALLBACK_DISASSOC (2) /* Callback called due to disassociation*/ + +/* These definitions are used with WIOCSDOT1XPORTSTATE */ +#define DOT11_DOT1XPORT_UNCONTROLLED 0 +#define DOT11_DOT1XPORT_CLOSED 1 +#define DOT11_DOT1XPORT_OPEN 2 + +/* The maximum association ID is limited by the fact that there are only 14 +bits available in the field to use */ +#define DOT11_MAX_AID ((1 << 14) - 1) + + +/* The time that a STA waits for a response on each channel when doing an +active scan */ +#define DOT11_SCAN_ACTIVE_DWELL_TIME ((sysClkRateGet() / 50) + 1) + +/* The time that a STA listens for beacons on each channel when doing a +passive scan */ +#define DOT11_SCAN_PASSIVE_DWELL_TIME (sysClkRateGet() * 2 / 5) /* 400 ms */ + +/* The beacon response time is the amount of time it takes the beacon to go +from the tranmitter to the beacon receive routine. This time is measured in + 802.11 time units. */ +#define DOT11_BEACON_RESP_TIME 1 + +/* The default DTIM time is the default number of beacons between DTIMS */ +#define DOT11_DEFAULT_DTIM_PERIOD 2 + +/* The following definitions control the behaviour of the transmit queue */ +#define DOT11_TX_SEM_WAIT 30 /* ticks */ +#define DOT11_TX_QUEUE_LIFETIME 90 /* ticks */ + +/* A magic number used to represent the "ANY" SSID */ +#define DOT11_SSID_NONE ((char)-1) + +/* The size of an OUI = 3 bytes */ +#define DOT11_OUI_SIZE 3 + +/* A macro to convert between timestamps and times in 802.11 timeunits + (1024 us). This macro assumes the parameter is a DOT11_TIMESTAMP. */ +#define DOT11_TSF_TO_TU(tsf) ((tsf.low >> 10) | (tsf.high << 22)) +/***************************************************************************/ +/* IEEE 802.11 Header Information */ +/***************************************************************************/ + +/* This is the header for a standard packet (no WDS). What follows depends on +the specific type of the packet, as detailed in the frame control header */ +typedef struct + { + UINT16 frameCtrl; + UINT16 duration; + UINT8 addr1[DOT11_ADDR_LEN]; + UINT8 addr2[DOT11_ADDR_LEN]; + UINT8 addr3[DOT11_ADDR_LEN]; + UINT16 seqCtrl; + } _WRS_PACK_ALIGN(1) DOT11_HEADER; + +/* Fields in the Frame Control Header */ +#define DOT11_FCTL_VERSION_MASK 0x0003 +#define DOT11_FCTL_VERSION_SHIFT _BIT(0) + +#define DOT11_FCTL_TYPE_MASK 0x000C +#define DOT11_FCTL_TYPE_SHIFT _BIT(2) + +#define DOT11_FCTL_SUBTYPE_MASK 0x00F0 +#define DOT11_FCTL_SUBTYPE_SHIFT _BIT(4) + +#define DOT11_FCTL_TO_DS _BIT(8) +#define DOT11_FCTL_FROM_DS _BIT(9) +#define DOT11_FCTL_MORE_FRAG _BIT(10) +#define DOT11_FCTL_RETRY _BIT(11) +#define DOT11_FCTL_PM _BIT(12) +#define DOT11_FCTL_MORE_DATA _BIT(13) +#define DOT11_FCTL_WEP _BIT(14) +#define DOT11_FCTL_ORDER _BIT(15) + +/* Frame types */ +#define DOT11_FTYPE_DATA 0x8 +#define DOT11_FTYPE_MGMT 0x0 +#define DOT11_FTYPE_CTRL 0x4 + +/* Frame subtypes */ +#define DOT11_STYPE_ASSOC_REQ 0x00 +#define DOT11_STYPE_ASSOC_RESP 0x10 +#define DOT11_STYPE_REASSOC_REQ 0x20 +#define DOT11_STYPE_REASSOC_RESP 0x30 +#define DOT11_STYPE_PROBE_REQ 0x40 +#define DOT11_STYPE_PROBE_RESP 0x50 +#define DOT11_STYPE_BEACON 0x80 +#define DOT11_STYPE_ATIM 0x90 +#define DOT11_STYPE_DISASSOC 0xa0 +#define DOT11_STYPE_AUTH 0xb0 +#define DOT11_STYPE_DEAUTH 0xc0 +#define DOT11_STYPE_PS_POLL 0xa0 +#define DOT11_STYPE_RTS 0xb0 +#define DOT11_STYPE_CTS 0xc0 +#define DOT11_STYPE_ACK 0xd0 +#define DOT11_STYPE_DATA 0x00 +#define DOT11_STYPE_DATA_NULL 0x40 + +/* The DOT11_FTYPE macro masks off the frame type and subtype portions of the +frame control header, which is passed in */ +#define DOT11_FTYPE(frameCtrl) ((frameCtrl) & (DOT11_FCTL_TYPE_MASK | \ + DOT11_FCTL_SUBTYPE_MASK)) +/* Merged subtypes and types used with DOT11_FTYPE macro */ +#define DOT11_TYPE_ASSOC_REQ 0x00 +#define DOT11_TYPE_ASSOC_RESP 0x10 +#define DOT11_TYPE_REASSOC_REQ 0x20 +#define DOT11_TYPE_REASSOC_RESP 0x30 +#define DOT11_TYPE_PROBE_REQ 0x40 +#define DOT11_TYPE_PROBE_RESP 0x50 +#define DOT11_TYPE_BEACON 0x80 +#define DOT11_TYPE_ATIM 0x90 +#define DOT11_TYPE_DISASSOC 0xa0 +#define DOT11_TYPE_AUTH 0xb0 +#define DOT11_TYPE_DEAUTH 0xc0 +#define DOT11_TYPE_PS_POLL 0xa4 +#define DOT11_TYPE_RTS 0xb4 +#define DOT11_TYPE_CTS 0xc4 +#define DOT11_TYPE_ACK 0xd4 +#define DOT11_TYPE_DATA 0x08 +#define DOT11_TYPE_DATA_NULL 0x48 + +/* The RX MAP is passed to the HDD as an array of 64 function pointers. */ +#define DOT11_RX_MAP_NUM 64 + +/* This is a macro that gives an RX MAP index given the frame control header*/ +#define DOT11_FCTL_TO_RXMAP_INDEX(x) (((x) & 0xfc) >> 2) + +#define DOT11_RXMAP_ASSOC_REQ DOT11_FCTL_TO_RXMAP_INDEX(0x00) +#define DOT11_RXMAP_ASSOC_RESP DOT11_FCTL_TO_RXMAP_INDEX(0x10) +#define DOT11_RXMAP_REASSOC_REQ DOT11_FCTL_TO_RXMAP_INDEX(0x20) +#define DOT11_RXMAP_REASSOC_RESP DOT11_FCTL_TO_RXMAP_INDEX(0x30) +#define DOT11_RXMAP_PROBE_REQ DOT11_FCTL_TO_RXMAP_INDEX(0x40) +#define DOT11_RXMAP_PROBE_RESP DOT11_FCTL_TO_RXMAP_INDEX(0x50) +#define DOT11_RXMAP_BEACON DOT11_FCTL_TO_RXMAP_INDEX(0x80) +#define DOT11_RXMAP_ATIM DOT11_FCTL_TO_RXMAP_INDEX(0x90) +#define DOT11_RXMAP_DISASSOC DOT11_FCTL_TO_RXMAP_INDEX(0xa0) +#define DOT11_RXMAP_AUTH DOT11_FCTL_TO_RXMAP_INDEX(0xb0) +#define DOT11_RXMAP_DEAUTH DOT11_FCTL_TO_RXMAP_INDEX(0xc0) +#define DOT11_RXMAP_PSPOLL DOT11_FCTL_TO_RXMAP_INDEX(0xa4) +#define DOT11_RXMAP_RTS DOT11_FCTL_TO_RXMAP_INDEX(0xb4) +#define DOT11_RXMAP_CTS DOT11_FCTL_TO_RXMAP_INDEX(0xc4) +#define DOT11_RXMAP_ACK DOT11_FCTL_TO_RXMAP_INDEX(0xd4) +#define DOT11_RXMAP_CFEND DOT11_FCTL_TO_RXMAP_INDEX(0xe4) +#define DOT11_RXMAP_CFENDACK DOT11_FCTL_TO_RXMAP_INDEX(0xf4) +#define DOT11_RXMAP_DATA DOT11_FCTL_TO_RXMAP_INDEX(0x08) +#define DOT11_RXMAP_DATA_CFACK DOT11_FCTL_TO_RXMAP_INDEX(0x18) +#define DOT11_RXMAP_DATA_CFPOLL DOT11_FCTL_TO_RXMAP_INDEX(0x28) +#define DOT11_RXMAP_DATA_CFACKPOLL DOT11_FCTL_TO_RXMAP_INDEX(0x38) +#define DOT11_RXMAP_DATA_NULL DOT11_FCTL_TO_RXMAP_INDEX(0x48) +#define DOT11_RXMAP_CF_ACK DOT11_FCTL_TO_RXMAP_INDEX(0x58) +#define DOT11_RXMAP_CF_POLL DOT11_FCTL_TO_RXMAP_INDEX(0x68) +#define DOT11_RXMAP_CF_ACK_POLL DOT11_FCTL_TO_RXMAP_INDEX(0x78) + + + + +/* The mask to get fragment number from the seqctl field */ +#define DOT11_SEQCTL_FRAGNUM 0x000f +#define DOT11_SEQCTL_SEQ 0xfff0 + +#define DOT11_WEP_IV_SIZE 4 +#define DOT11_WEP_EXT_IV_SIZE 4 +#define DOT11_EXT_IV _BIT(5) +#define DOT11_WEP_ICV_SIZE 4 +#define DOT11_MIC_LEN 8 + + +typedef struct + { + UINT32 low; + UINT32 high; + } DOT11_TIMESTAMP; + +typedef UINT16 DOT11_FCTL; +typedef UINT16 DOT11_DURATION; +typedef UINT16 DOT11_BEACON_RATE; +typedef UINT16 DOT11_LISTEN_INT; +typedef UINT16 DOT11_STATUS; +typedef UINT16 DOT11_AID; + +/* Mask to get the AID out of the AID field - bits 14 and 15 are always set */ +#define DOT11_AID_MASK 0x3fff +#define DOT11_AID_MASK_POS 0xc000 + +/* These are definitions for the element IDs found in Information Element +fields in Management Frames as per 7.3.2 of IEEE 802.11(2003) */ +#define DOT11_ELEMID_SSID 0 +#define DOT11_ELEMID_SUPP_RATES 1 +#define DOT11_ELEMID_FH_PARAM 2 +#define DOT11_ELEMID_DS_PARAM 3 +#define DOT11_ELEMID_CF_PARAM 4 +#define DOT11_ELEMID_TIM 5 +#define DOT11_ELEMID_IBSS 6 +#define DOT11_ELEMID_COUNTRY 7 +#define DOT11_ELEMID_HOP_PARAM 8 +#define DOT11_ELEMID_HOP_TABLE 9 +#define DOT11_ELEMID_REQUEST 10 +#define DOT11_ELEMID_CHALLENGE 16 +#define DOT11_ELEMID_CHALLENGE_EXT 17 +#define DOT11_ELEMID_ERP 42 +#define DOT11_ELEMID_RSN 48 +#define DOT11_ELEMID_EXT_RATES 50 +#define DOT11_ELEMID_WPA 221 +#define DOT11_ELEMID_KDE 221 /* Yes - the same as WPA */ + +/* These are the possible STATUS codes that can be returned in an Auth +or Assoc Rsp frame */ +#define DOT11_STATUS_OK 0 +#define DOT11_STATUS_FAIL 1 +#define DOT11_STATUS_CAP_UNSUPPORT 10 +#define DOT11_STATUS_NO_ASSOC 11 +#define DOT11_STATUS_ASSOC_DENIED 12 +#define DOT11_STATUS_AUTH_UNSUPPORT 13 +#define DOT11_STATUS_BAD_SEQ 14 +#define DOT11_STATUS_CHAL_FAIL 15 +#define DOT11_STATUS_TIMEOUT 16 +#define DOT11_STATUS_NO_MORE_ASSOC 17 +#define DOT11_STATUS_RATE_UNSUPPORT 18 + +#define DOT11_STATUS_INVALID_IE 40 +#define DOT11_STATUS_POLICY_REJECT 46 + + +/* These are the possible reason codes that can be used in a deauth / disassoc*/ +#define DOT11_REASON_UNSPECIFIED 1 +#define DOT11_REASON_NO_LONGER_VALID 2 +#define DOT11_REASON_DEAUTH_LEAVING 3 +#define DOT11_REASON_INACTIVITY 4 +#define DOT11_REASON_AP_FULL 5 +#define DOT11_REASON_NOT_AUTH 6 +#define DOT11_REASON_NOT_ASSOC 7 +#define DOT11_REASON_DISASSOC_LEAVING 8 +#define DOT11_REASON_ASSOC_NOT_AUTH 9 +#define DOT11_REASON_MIC_FAILURE 14 +#define DOT11_REASON_FOURWAY_TIMEOUT 15 + + +#define DOT11_AUTH_CHAL_MAX 253 +#define DOT11_AUTH_CHAL_SIZE 128 + +#define DOT11_IE_HEADER_SIZE 2 /* size of the length and elementId */ +#define DOT11_IE_MAX_SIZE 255 + +/************************************************************************** +* DOT11_IE_GENERIC - A structure holding an information element of +* indeterminate type +***************************************************************************/ +typedef struct + { + UINT8 elementId; + UINT8 length; + UINT8 data[DOT11_IE_MAX_SIZE]; /* Arbitary amount of data - use ptr once typed */ + } _WRS_PACK_ALIGN(1) DOT11_IE_GENERIC; + + +/************************************************************************** +* DOT11_IE_SSID - A structure holding the SSID Information Element. Note +* that the ssid field may be up to 32 bytes long. +***************************************************************************/ +typedef struct + { + UINT8 elementId; + UINT8 length; + char ssid[DOT11_SSID_LEN]; + } _WRS_PACK_ALIGN(1) DOT11_IE_SSID; + +/************************************************************************** +* DOT11_IE_CFP - PCF information element +***************************************************************************/ +typedef struct + { + UINT8 elementId; + UINT8 length; /* Should always be 6 */ + UINT8 cfpCount; + UINT8 cfpPeriod; + UINT16 cfpMaxDuration; /* Maximum duration of CFP */ + UINT16 cfpRemDuration; /* Duration left in current CFP */ + } _WRS_PACK_ALIGN(1) DOT11_IE_CFP; + +/************************************************************************** +* DOT11_IE_SUPP_RATES - The Supported Rates Information Element +***************************************************************************/ +#define DOT11_IE_SUPP_RATES_MAX 8 +#define DOT11_RATE_MAX 8 + +typedef struct + { + UINT8 elementId; + UINT8 length; + UINT8 rates[DOT11_IE_SUPP_RATES_MAX]; + } _WRS_PACK_ALIGN(1) DOT11_IE_SUPP_RATES; + +/************************************************************************** +* DOT11_IE_CHAL_TEXT - Challenge text for shared key authentication +***************************************************************************/ +typedef struct + { + UINT8 elementId; + UINT8 length; + char chalText[DOT11_AUTH_CHAL_MAX]; + } _WRS_PACK_ALIGN(1) DOT11_IE_CHAL_TEXT; + + +/************************************************************************** +* DOT11_IE_EXT_RATES - The Extended Rates Information Element +***************************************************************************/ +#define DOT11_IE_EXT_RATES_MAX 253 +typedef struct + { + UINT8 elementId; + UINT8 length; + UINT8 rates[DOT11_IE_EXT_RATES_MAX]; + } _WRS_PACK_ALIGN(1) DOT11_IE_EXT_RATES; + +/************************************************************************** +* DOT11_IE_TIM - Traffic Indication Message IE +***************************************************************************/ +#define DOT11_MAX_PVB 251 /* Maximum size of Partial Virtual Bm*/ +#define DOT11_TIM_TI 0x1 /* Traffic ind. bit in bmControl */ +#define DOT11_TIM_MIN_LEN 4 /* Length of empty TIM */ +#define DOT11_TIM_HDR_LEN 5 /* Length of TIM header */ +typedef struct + { + UINT8 elementId; + UINT8 length; + UINT8 dtimCount; + UINT8 dtimPeriod; + UINT8 bitmapCtrl; + UINT8 pvb[DOT11_MAX_PVB]; + } _WRS_PACK_ALIGN(1) DOT11_IE_TIM; + +/************************************************************************** +* DOT11_IE_IBSS - IBSS parameters. +***************************************************************************/ +typedef struct + { + UINT8 elementId; + UINT8 length; + UINT16 atimWindow; + } _WRS_PACK_ALIGN(1) DOT11_IE_IBSS; + +/************************************************************************** +* DOT11_IE_COUNTRY - 802.11d parmameters +***************************************************************************/ +typedef struct + { + UINT8 elementId; + UINT8 length; + char data[DOT11_SSID_LEN]; + } _WRS_PACK_ALIGN(1) DOT11_IE_COUNTRY; + + +/************************************************************************** +* DOT11_IE_ERP - Extended Rate Phy (802.11g) parameters +***************************************************************************/ +#define DOT11_ERP_NONERP_PRESENT _BIT(0) +#define DOT11_ERP_USE_PROTECTION _BIT(1) +#define DOT11_ERP_LONG_PREAMBLE _BIT(2) +typedef struct + { + UINT8 elementId; + UINT8 length; + UINT8 erpInfo; + } _WRS_PACK_ALIGN(1) DOT11_IE_ERP; + + + +/************************************************************************** +* DOT11_ASSOC_RESP_PACKET - An association response packet +***************************************************************************/ +typedef struct + { + DOT11_HEADER header; /* 802.11 Mgmt Header */ + UINT16 capabilities; /* 16 bit capabilities field */ + UINT16 status; /* 16 bit Status field */ + UINT16 aid; + DOT11_IE_SUPP_RATES rates; + } _WRS_PACK_ALIGN(1) DOT11_ASSOC_RESP_PACKET; + +/************************************************************************** +* DOT11_PS_POLL_PACKET - A powersave-poll packet +***************************************************************************/ +typedef struct + { + UINT16 frameCtrl; + UINT16 aid; /* Assoc AI with bit 14,15 set */ + UINT8 bssid[DOT11_ADDR_LEN]; + UINT8 ta[DOT11_ADDR_LEN]; + } _WRS_PACK_ALIGN(1) DOT11_PS_POLL_PACKET; + +/************************************************************************** +* DOT11_AUTH_PACKET - An authentication packet +***************************************************************************/ +typedef struct + { + DOT11_HEADER header; + UINT16 authAlg; + UINT16 authSeq; + UINT16 status; + DOT11_IE_CHAL_TEXT challenge; + } _WRS_PACK_ALIGN(1) DOT11_AUTH_PACKET; + + + +#define DOT11_PTK_LEN 64 +#define DOT11_GMK_LEN 32 +#define DOT11_GTK_LEN 32 /* MAX - only 128 bits for AES */ +#define DOT11_KEK_LEN 16 +#define DOT11_KCK_LEN 16 +#define DOT11_TK_LEN 32 /* MAX - only 128 bits for AES */ +#define DOT11_TK_AES_LEN 16 +#define DOT11_TK_TKIP_LEN 32 +#define DOT11_RSN_PASSPHRASE_MAX 63 +/* The length of the global key counter, in bytes. It should be 256 bits */ +#define DOT11_GKC_LEN 32 +#define DOT11_PMK_LEN 32 +typedef UINT8 DOT11_PMK[DOT11_PMK_LEN]; + +#define DOT11_PRF_KEY_MAX 128 +#define DOT11_PRF_PREFIX_MAX 64 +#define DOT11_PRF_DATA_MAX 256 + +/************************************************************************** +* DOT11_EAPOL_KEY_PKT - This structure contains the format of an EAPOL-Key +* Packet. Most EAPOL packets are parsed in the 802.1X +* code, with the exception of this frame. +**************************************************************************/ +#define DOT11_EAPOL_REPLAY_LEN 8 +#define DOT11_EAPOL_KEYRSC_LEN 8 +#define DOT11_EAPOL_KEYID_LEN 8 +#define DOT11_EAPOL_IV_LEN 16 +#define DOT11_EAPOL_MIC_LEN 16 +#define DOT11_NONCE_LEN 32 + +/* This structure includes the EAPOL Header. Note that the EAPOL-Key packet is +misaligned due to the field - data should be accessed using byte +operations only. */ +typedef struct + { + /* EAPOL Packet Header */ + UINT8 version; + UINT8 eapolType; + UINT16 length; + + /* EAPOL-Key Packet */ + UINT8 type; + UINT8 keyInfo[sizeof(UINT16)]; + UINT8 keyLen[sizeof(UINT16)]; + UINT8 replayCtr[DOT11_EAPOL_REPLAY_LEN]; + UINT8 nonce[DOT11_NONCE_LEN]; + UINT8 iv[DOT11_EAPOL_IV_LEN]; + UINT8 rcvSeqCtr[8]; + UINT8 keyId[DOT11_EAPOL_KEYID_LEN]; /* Reserved in 802.11 */ + UINT8 mic[DOT11_EAPOL_MIC_LEN]; + UINT8 keyDataLen[2]; + + /* The key data would follow here, if any */ + } _WRS_PACK_ALIGN(1) DOT11_EAPOL_KEY_PKT; + + +/* The size of the EAPOL packet header */ +#define DOT11_EAPOL_HEADER_SIZE 4 + +/* The defined EAPOL type for an EAPOL-key packet */ +#define DOT11_EAPOL_TYPE_KEY 3 + +#define DOT11_EAPOL_VERSION 1 + +/* The defined keytype for IEEE 802.11 */ +#define DOT11_EAPOL_KEYTYPE_WPA 254 +#define DOT11_EAPOL_KEYTYPE_11i 2 + +#define DOT11_RSN_MAX_KDE 1024 + +/* The length of the KDE header is calculated as follows: +* +* type 1 +* length 1 does not include type or length fields +* OUI 3 +* dataType 1 +*/ +#define DOT11_EAPOL_KDE_HEADER_LEN 6 + +/* A GTK KDE element has additional overhead - 2 bytes for the keyId */ +#define DOT11_EAPOL_KDE_GTK_HEADER_LEN 8 + +#define DOT11_EAPOL_KDE_TYPE_GTK 1 +#define DOT11_EAPOL_KDE_TYPE_STAKEY 2 +#define DOT11_EAPOL_KDE_TYPE_MACADDR 3 +#define DOT11_EAPOL_KDE_TYPE_PMKID 4 + +#define DOT11_EAPOL_KDE_KEYINDEX 3 + +#define DOT11_EAPOL_KDE_TXENABLE _BIT(2) + +/* This structure represents a GTK KDE in 802.11i */ +typedef struct + { + UINT8 type; + UINT8 length; + UINT8 oui[3]; + UINT8 dataType; + UINT8 keyId; + UINT8 reserved; + UINT8 gtk[DOT11_GTK_LEN]; + } DOT11_KDE; + +#define DOT11_KEYTYPE_PAIRWISE _BIT(3) +#define DOT11_KEYTYPE_GROUP 0 +/* Bit set in the key information field. +Note, these use bytes accesses. The below is in the first byte [0] */ +#define DOT11_EAPOL_INFO_DESC_AES 2 +#define DOT11_EAPOL_INFO_DESC_RC4 1 +#define DOT11_EAPOL_INFO_DESC_MASK 0x3 + +#define DOT11_EAPOL_INFO_KEY_MASK 0x30 + + +#define DOT11_EAPOL_INFO_KEYTYPE _BIT(3) + +#define DOT11_EAPOL_INFO_INSTALL _BIT(6) +#define DOT11_EAPOL_INFO_NO_INSTALL 0 + +#define DOT11_EAPOL_INFO_ACK _BIT(7) +#define DOT11_EAPOL_INFO_NO_ACK 0 + +/* This info is in the second byte [1] */ + +#define DOT11_EAPOL_INFO_MIC _BIT(8) +#define DOT11_EAPOL_INFO_NO_MIC 0 + +#define DOT11_EAPOL_INFO_SECURE _BIT(9) +#define DOT11_EAPOL_INFO_NO_SECURE 0 + +#define DOT11_EAPOL_INFO_ERROR _BIT(10) +#define DOT11_EAPOL_INFO_NO_ERROR 0 + +#define DOT11_EAPOL_INFO_REQUEST _BIT(11) +#define DOT11_EAPOL_INFO_NO_REQUEST 0 + +#define DOT11_EAPOL_INFO_ENCRYPT _BIT(12) +#define DOT11_EAPOL_INFO_NO_ENCRYPT 0 + +#define DOT11_EAPOL_NO_KEY_RSC NULL +#define DOT11_EAPOL_NO_NONCE NULL +#define DOT11_EAPOL_NO_RSN_IE NULL +#define DOT11_EAPOL_NO_GTK NULL +#define DOT11_EAPOL_NO_KEY_DATA NULL + +/* These are the keyInfo combinations that are tested on in +dot11RsnEapolReceive() */ +#define DOT11_EAPOL_4WAY_MASK DOT11_EAPOL_INFO_KEYTYPE | \ + DOT11_EAPOL_INFO_INSTALL | DOT11_EAPOL_INFO_ACK | DOT11_EAPOL_INFO_MIC | \ + DOT11_EAPOL_INFO_SECURE | DOT11_EAPOL_INFO_ERROR | \ + DOT11_EAPOL_INFO_REQUEST + +#define DOT11_EAPOL_4WAY_A (DOT11_KEYTYPE_PAIRWISE | DOT11_EAPOL_INFO_ACK) +#define DOT11_EAPOL_4WAY_B (DOT11_KEYTYPE_PAIRWISE | DOT11_EAPOL_INFO_MIC) +#define DOT11_EAPOL_4WAY_C (DOT11_KEYTYPE_PAIRWISE | DOT11_EAPOL_INFO_ACK | \ + DOT11_EAPOL_INFO_MIC) +#define DOT11_EAPOL_4WAY_D (DOT11_KEYTYPE_PAIRWISE | DOT11_EAPOL_INFO_MIC) +#define DOT11_EAPOL_GROUP_1 (DOT11_KEYTYPE_GROUP | DOT11_EAPOL_INFO_ACK | \ + DOT11_EAPOL_INFO_MIC) +#define DOT11_EAPOL_GROUP_2 (DOT11_KEYTYPE_GROUP | DOT11_EAPOL_INFO_MIC) + + +#define DOT11_GROUP_REKEY_TIME (sysClkRateGet() * 60 * 2) + +/* This defines the number of bytes to remove from the front of the RC4 +keystream in order to discard bytes that may reveal key bits */ +#define DOT11_EAPOL_RC4_OFFSET 256 + + +/* This is the size of a TSC (for TKIP) or a PN (for AES). They both serve +the same function, they just depend on the chosen algorithm */ +#define DOT11_TSC_LEN 6 + +#define DOT11_BYTEARRAY_INC(ba, numBytes) {\ + int i=-1;\ + do {\ + ba[++i]++;\ + } while ((ba[i] == 0) && (i<(numBytes-1)));} + +#define DOT11_BYTEARRAY_INC_BE(ba, numBytes) {\ + int i = numBytes;\ + do {\ + ba[--i]++;\ + } while ((ba[i] == 0) && (i >= 0));} + + +/* This copies the given byte array, reversing the order of the bytes */ +#define DOT11_BE_COPY(src,dst,len) {\ + int i;\ + for (i = 0; i < len; i++) {\ + (dst)[(len-1)-i] = (src)[i];\ + }} + + +#define DOT11_KSL_HASH(macAddr) ((macAddr[3]) ^ (macAddr[4]) ^ (macAddr[5])) +#define DOT11_KSL_MAX_HASH 256 + + +/* The amount of time te KSL entry allocation routines will wait for the +semaphore before giving up */ +#define DOT11_KSL_ALLOC_TIME (sysClkRateGet() / 8) + +/* The value of staticCount for a dynamic KSL entry */ +#define DOT11_KSL_DYNAMIC 0 + + +/************************************************************************** +* DOT11_FOURWAY_STATE - definitions used in pKsl->fourWayState +***************************************************************************/ +/* States that apply to both the AP and the STA */ +#define DOT11_FOURWAY_INIT 0 +#define DOT11_FOURWAY_ESTABLISHED 10 + +/* States that apply to the AP */ +#define DOT11_FOURWAY_SENT_1 1 +#define DOT11_FOURWAY_GOT_2 2 +#define DOT11_FOURWAY_SENT_3 3 +#define DOT11_FOURWAY_GOT_4 4 + +/* States that apply to the STA */ +#define DOT11_FOURWAY_GOT_1 6 +#define DOT11_FOURWAY_SENT_2 7 +#define DOT11_FOURWAY_GOT_3 8 +#define DOT11_FOURWAY_SENT_4 9 + + +/************************************************************************** +* DOT11_AUTH_ALGS - Supported MAC layer authentication algorithms +***************************************************************************/ +#define DOT11_AUTH_OPEN 0 +#define DOT11_AUTH_SHARED_KEY 1 +#define DOT11_AUTH_NETWORK_EAP 128 + +/* This isn't an official 802.11 authtype, but it is used by the driver to +mean "any" authtype */ +#define DOT11_AUTH_ALL 3 + +/***************************************************************************** +* DOT11_AUTH_SEQ - macros for ease of reading +***************************************************************************/ + +#define DOT11_AUTH_SEQ_1 1 +#define DOT11_AUTH_SEQ_2 2 +#define DOT11_AUTH_SEQ_3 3 +#define DOT11_AUTH_SEQ_4 4 + + +/************************************************************************** +* RATE CONTROL TASK +***************************************************************************/ +#define DOT11_RC_DEPTH 256 /* Must be power of two */ + +/* Reevaluate the link this many packets. */ +#define DOT11_RC_EVAL (DOT11_RC_DEPTH / 2) + +#define DOT11_RC_STATUS_SUCCESS 1 +#define DOT11_RC_STATUS_RETRY_OK 2 +#define DOT11_RC_STATUS_RETRY_FAIL 3 +#define DOT11_RC_STATUS_FAIL 4 + + +/* This determines how often the rate control task runs, in seconds. */ +#define DOT11_RC_EVAL_TIME 2 /* Seconds */ + +#define DOT11_RC_TASK_NAME "tDot11RC%d" +#define DOT11_RC_TASK_PRI 70 +#define DOT11_RC_STACK_SIZE (10 * 1024) + +/* These values specify the threshold for a rate change. They are expressed in +the ratio of total packets to failed packets or retries (note: more than one +retry per packet is possible) to avoid floating point math. A higher value +represents a more stable link*/ + +#define DOT11_RC_DOWN_T_TO_R 6 /* 5 == 20 % retries */ +#define DOT11_RC_DOWN_T_TO_F 500 /* 1000 == 0.01 % failure */ + +#define DOT11_RC_UP_T_TO_R 50 /* 33 ~= 3% retries */ +#define DOT11_RC_UP_T_TO_F 8000 /* 6250 == 0.016 % retries */ + +/* How many retries a failed packet counts as. Adjusting this affects how much +a missed packet affects the rate */ +#define DOT11_RC_RETRY_FAIL_WEIGHT 16 + +/* The minimum number of packets that need to be received in order for the +rate control algorithm to run. */ +#define DOT11_RC_MIN_PACKET 4 + +/************************************************************************* +* DOT11_COUNTRY_DISC - Country discovery structure, used by +* dot11SmeEssCcChoose() +**************************************************************************/ + +#define DOT11_SCAN_COUNTRY_MAX 8 + +typedef struct + { + int countryCode; + int num; + } DOT11_COUNTRY_DISC; + + +/* Different power-save modes */ +#define DOT11_POWER_ACTIVE 0 +#define DOT11_POWER_SLEEP 1 +#define DOT11_POWER_PROB 2 + +/************************************************************************* +* DOT11_RC_INFO - Info for the rate control task. Part of SME. +**************************************************************************/ +typedef struct dot11_rc_info + { + /* The number of packets since the last time the RC task was run on this + KSL entry. */ + UINT32 packetTotal; + + /* Running sum of the number of retries since the last time the RC task + was run on this KSL entry. */ + UINT32 retryTotal; + + /* Running sum of the number of transmit failures (usually due to excessive + retries) since the last time the RC task was run */ + UINT32 failureTotal; + + /* Running sum of the SSI since the last time the RC task was run. Div by + "packetTotal" to get the average SSI */ + UINT32 ackTotal; + + } DOT11_RC_INFO; + + + + +/************************************************************************** +* DOT11_KSL_ENTRY - An entry in the Known Station List +***************************************************************************/ +typedef struct kslEntry + { + struct kslEntry * pNext; + + /* The static count is the count of the number of reasons why this entry + is static (reasons include valid ACL entry or key mapping entry). As one + entry is cleared, the count is decremented, until the entry becomes + dynamic again (count <= 0) */ + int staticCount; + + UINT8 macAddr[DOT11_ADDR_LEN]; + int dot11Mode; /* Is it an AP, STA or IBSS */ + UINT32 timestamp; /* When did we last hear from it */ + DOT11_RC_INFO rcInfo ; /* Rate control info, stats */ + DOT11_RATES suppRates; /* Supported rates for entry */ + UINT16 capabilities; /* 802.11 capabilities field */ + + /* Rates used to communicate with this station. It is the intersection + of the supported rates for this station, the supported rates for the + remote station and the allowed rates as set by the user. Note that + these rates are expected to be in order from slowest to fastest. */ + DOT11_RATES actualRates; + + UINT32 currentTxRate; + UINT32 currentTxRateIndex; + UINT32 lastRxRate; + + /* This values is used to inform the HDD which key mapping entry is to be + used for this destination. This is the unicast key for this station. If + not set, then the multicast key from the DPE will be used if present. The + decryptIndex is used only with TKIP to allow for separate TX and RX + entries (different MICs). */ + INT32 uniDecryptIndex; + INT32 uniEncryptIndex; + UINT32 uniEncryptType; + + /* The SSID that this entry is connected to. */ + char ssid[DOT11_SSID_LEN + 1]; + + /* This KSL_Entry is access controlled. The type of control is left + up to the controlling SME module */ + BOOL accessControlled; + + /* These entries are used by WIOCSDOT1XPORTSTATUS to determine if packets + are allowed to be transmitted through the port */ + BOOL dot1xControlled; + BOOL dot1xAllowed; + + /* These records are used to keep track of the advertised security + policies */ + UINT32 secPol; + UINT32 authPol; + UINT32 ciphPol; + UINT32 groupPol; + UINT32 rsnCap; + + /* These records keep track of the chosen security policies */ + UINT32 negSecPol; + UINT32 negAuthPol; + + /* This contains the Pairwise Master key, and a flag determining whether + this is a valid PMK */ + UINT8 pmk[DOT11_PMK_LEN]; + BOOL pmkValid; + + /* The variables control the state of the four-way state machine. The + timer is used to wait a limited time for a reply before retransmitting */ + UINT32 fourWayState; + + INT32 fourWayGlobalTimer; + INT32 eapolMsgTimer; + + /* The dervied keys are generated from the combination of the PMK, the + local nonce and the remote nonce */ + BOOL derivedKeysValid; + UINT8 kck[DOT11_KCK_LEN]; + UINT8 kek[DOT11_KCK_LEN]; + UINT8 tk[DOT11_TK_LEN]; + + /* The EAPOL replay counter is used for the fourway key exchange, and keeps + track of the last key number observed or used */ + UINT8 eapolReplay[DOT11_EAPOL_REPLAY_LEN]; + + /* The nonce information governs whether we have a valid nonce, and + whether our information about the remote nonce is valid */ + UINT8 localNonce[DOT11_NONCE_LEN]; + BOOL localNonceValid; + UINT8 remoteNonce[DOT11_NONCE_LEN]; + BOOL remoteNonceValid; + + /* These elements store the last WPA oe RSN IE used by the enitity to which + the KSL record points. This is used in the fourway handshake to compare + against to ensure the IE has not been tampered with */ + UINT8 lastRsnIe[DOT11_IE_MAX_SIZE]; + UINT8 lastWpaIe[DOT11_IE_MAX_SIZE]; + + /* The transmit sequence counters store the packet number of the last + packet transmitted to this station, as well as the last packet received + from this station */ + UINT8 tscUniTx[DOT11_TSC_LEN]; + UINT8 tscUniRx[DOT11_TSC_LEN]; + + /* Reflects the number of times that this entity has failed the fourway + handshake */ + UINT32 fourWayTimeouts; + + /* The tickGet() of the last connection attempt. This is used by + dot11KslSSIDLookup() so that the same AP will not always be chosen if it + is rejecting connection attempts */ + UINT32 lastAttempt; + + /* The "type" union reflects the type of the KSL entry, NOT the SME */ + union + { + struct /* KSL_ENTRY is an AP */ + { + int channel; /* Last channel we heard from entry on*/ + int mode; /* PHY mode last heard in */ + int ssi; /* Last SSI we heard from entry on */ + + int aid; /* Association ID, if associated */ + + /* The shared key buffer stores the last challenge text that was + sent to the STA */ + UINT8 skaBuffer[DOT11_AUTH_CHAL_MAX]; + int skaLength; + + /* Offset of TIM IE in beacon packets in bytes from start of pkt*/ + UINT32 timIeOffset; + + /* Offset of byte in complete virtual bitmap */ + UINT32 timByteOffset; + + /* Mask of byte pointed to by timByteOffset for this STA */ + UINT32 timMask; + + /* Information stripped from last received beacon */ + BOOL beaconSync; + DOT11_TIMESTAMP lastBeaconTsf; + UINT32 beaconPeriod; + UINT32 dtimPeriod; + UINT32 dtimCount; + UINT32 cfpPeriod; + UINT32 cfpCount; + UINT32 cfpDuration; + + UINT32 lastProbation; + + /* 802.11g compatibility information */ + BOOL useProtection; + BOOL useShortTimeslot; + BOOL useLongPreamble; + + /* 802.11d information */ + UINT32 countryCode; + + } ap; + struct /* KSL_ENTRY is a station in ESS mode */ + { + int rate; /* Last rate we heard from entry on */ + int aid; /* Association ID */ + BOOL authenticatedSka; /* Has passed stage 1 of SKA */ + BOOL authenticated; /* Has passed final stage of auth */ + BOOL associated; /* Assoc success sent */ + + /* The shared key buffer stores the last challenge text that was + sent to the STA */ + UINT8 skaBuffer[DOT11_AUTH_CHAL_MAX]; + int skaLength; + + BOOL ratesUpdated; /* Do we have rates for this device */ + + BOOL powerManaged; /* Whether this station is in PM */ + + M_BLK_ID pmQueueHead; /* Removal point */ + M_BLK_ID pmQueueTail; /* Insertion point */ + + } sta; + struct /* KSL_ENTRY is a STA in IBSS mode */ + { + int channel; /* Last channel it was heard on */ + int mode; /* PHY mode last heard in */ + int ssi; + + UINT16 atimWindow; + UINT16 beaconInterval; /* BI used by this sta */ + + UINT8 bssid[DOT11_ADDR_LEN]; /* BSSID it's connected to */ + + DOT11_TIMESTAMP lastBeaconTsf; /* Their TSF */ + DOT11_TIMESTAMP ourTsf; /* When we received it */ + + BOOL ratesUpdated; /* Do we have rates for this device */ + + /* 802.11d information */ + UINT32 countryCode; + } ibss; + } type; + } DOT11_KSL_ENTRY; + + +/************************************************************************** +* DOT11_FRAGMENT - Reassembly space for ingress fragment +***************************************************************************/ +typedef struct + { + BOOL used; /* Determines if this slot is used */ + UINT8 addr2[DOT11_ADDR_LEN]; + UINT8 addr1[DOT11_ADDR_LEN]; + UINT16 sequence; /* seq out of seqCtl field */ + INT32 lastFrag; /* The last fragment that was received */ + + int timerId; /* Identifies timer */ + + M_BLK_ID pHead; /* The head of the reassembled packet*/ + M_BLK_ID pLast; /* Pointer to last MBlk for convenience */ + } DOT11_FRAGMENT; +#define DOT11_MAX_REASSEMBLY 16 + +/************************************************************************** +* DOT11_REASSEMBLY - Structure used to store packet statistics +***************************************************************************/ +typedef struct + { + DOT11_FRAGMENT packet[DOT11_MAX_REASSEMBLY]; + } DOT11_REASSEMBLY; + +#define DOT11_FRAGMENT_LAST _BIT(15) +#define DOT11_FRAGMENT_MASK 0x000f + +#define DOT11_FRAGMENT_MIN_SIZE 256 + +#define DOT11_FRAGMENT_MAX_NUM 16 + + +typedef struct + { + int a; + } DOT11_SW_KEY_TABLE; + +typedef struct + { + int a; + } DOT11_TX_POWER_RANGE; + + + + + +#define DOT11_MAX_DEFAULT_KEY 4 +#define DOT11_MAX_KEYS 64 + +/* This is a magic number passed to pDot11->hdd->hwEncryptionKeySet() to +signal it to look for the first available unicast key slot */ +#define DOT11_KEYINDEX_SEARCH 65536 + +/* This is a parameter passed to hdd->rawSend() that specifies no encryption*/ +#define DOT11_KEYINDEX_NONE -1 + + + + +/************************************************************************** +* DOT11_KEYTAB_ENTRY - An entry in the soft key table +***************************************************************************/ +typedef struct + { + BOOL used; + DOT11_KSL_ENTRY * pKsl; + } DOT11_KEYTAB_ENTRY; + + + + +/***************************************************************************** +* DOT11_RX_FUNC - A type representing a function pointer to a receive function +* as used by the rxMap in the Hdd. +*****************************************************************************/ +typedef STATUS (* DOT11_RX_FUNC)(DOT11_FW * pDot11, M_BLK_ID pMblk, + UINT32 rate, UINT8 ssi); + +/***************************************************************************** +* DOT11_RX_FILTER - Filter describing which packets will be received by the +* hardware +*****************************************************************************/ + +#define DOT11_RX_FILTER_NONE 0 + +/* DOT11_RX_FILTER_UNI - Unicast packets, with the stations addr in addr1 */ +#define DOT11_RX_FILTER_UNI _BIT(0) + +/* DOT11_RX_FILTER_MULTI - Multicast packets matching filter */ +#define DOT11_RX_FILTER_MULTI _BIT(1) + +/* DOT11_RX_FILTER_BROAD - Broadcast (non-matching BSSID)packets */ +#define DOT11_RX_FILTER_BROAD _BIT(1) + +/* DOT11_RX_FILTER_BEACON - Beacons */ +#define DOT11_RX_FILTER_BEACON _BIT(2) + +/* DOT11_RX_FILTER_PROBE_REQ - Broadcast management packets */ +#define DOT11_RX_FILTER_PROBE_REQ _BIT(3) + +/* DOT11_RX_FILTER_CONTROL - All 802.11 Control frames */ +#define DOT11_RX_FILTER_CONTROL _BIT(4) + +/* DOT11_RX_FILTER_PROMISC - All frames */ +#define DOT11_RX_FILTER_PROMISC _BIT(5) + + +IMPORT const char * dot11StateNames[]; + +#define DOT11_DEFAULT_AUTH_TIMEOUT (sysClkRateGet() / 20) +#define DOT11_DEFAULT_ASSOC_TIMEOUT (sysClkRateGet() / 20) + + +/***************************************************************************** +* DPE_OBJ - Object representing the Data Path Entity +*****************************************************************************/ +typedef struct /* DPE_OBJ */ + { + STATUS (*free)(DOT11_FW * pDot11); + STATUS (*endSend)(END_OBJ * pEnd, M_BLK_ID pMblk); + STATUS (*endReceive)(DOT11_FW * pDot11, M_BLK_ID pMblk, + UINT32 rate, UINT8 SSI); + STATUS (*fragThresholdSet)(DOT11_FW * pDot11, UINT32 fragThresh); + STATUS (*fragThresholdGet)(DOT11_FW * pDot11, + UINT32 * fragThresh); + STATUS (*endPollSend)(END_OBJ* pEnd, M_BLK_ID pMblk); + STATUS (*endPollRcv)(END_OBJ* pEnd, M_BLK_ID pMblk); + STATUS (*transmitQueueFlush)(DOT11_FW * pDot11); + + /* The reassembly buffer stores packet fragments awaiting reassembly */ + DOT11_REASSEMBLY reassemblyBuff; + + /* Packets above this size will be fragmented */ + UINT32 fragThreshold; + + + DOT11_EX_POLICY exclusionPolicy; + + /* These are the multicast keys for the device (multicast as in "all + devices, not as in unicast and multicast packets) */ + DOT11_ENCRYPT_TYPE multiEncryptType; + UINT32 multiEncryptIndex; + + /* Counters for TKIP/AES multicast packets */ + UINT8 tscMultiTx[DOT11_TSC_LEN]; + UINT8 tscMultiRx[DOT11_TSC_LEN]; + + UINT8 gmk[DOT11_GMK_LEN]; + UINT8 gtk[DOT11_GTK_LEN]; + BOOL gtkValid; + UINT8 gNonce[DOT11_NONCE_LEN]; + + /* Timer for group re-keying */ + INT32 groupRekeyTimer; + UINT32 groupRekeyTime; + + /* This array keeps track of the mappings between encrypt and decrypt keys + for the shared keys. It will be set to {0,1,2,3} unless a TKIP key + (requiring a separate encrypt key) is present in the shared keys, in + which case, the appropriate entry in the array will reflect the encrypt + key to be used. */ + UINT8 decryptToEncrypt[DOT11_MAX_DEFAULT_KEY]; + + /* This specifies the last initialization vector used on an egress packet*/ + UINT32 currentIV; + + /* Protects the order of the transmission path */ + SEM_ID transmitSem; + + /* This queues up packets that attempted transmission while the link was + not up. Upon resumption of the link, these packets will be sent before any + fresh packets. Use a head and tail for quick insertion and removal.*/ + M_BLK_ID transmitQueueHead; + M_BLK_ID transmitQueueTail; + + } DPE_OBJ; + +/***************************************************************************** +* DOT11_KSL_OBJ - the Known Station List object +*****************************************************************************/ +typedef struct /* DOT11_KSL_OBJ */ + { + /* The init routine, dot11KslInit() is called directly from the SME to + create this structure */ + STATUS (*free)(DOT11_FW * pDot11); + STATUS (*show)(int unitNum); + STATUS (*lock)(DOT11_FW * pDot11); + STATUS (*unlock)(DOT11_FW * pDot11); + + STATUS (*flush)(DOT11_FW * pDot11); + + DOT11_KSL_ENTRY * (*lookup)(DOT11_FW * pDot11, UINT8 * macAddr); + DOT11_KSL_ENTRY * (*ssidLookup)(DOT11_FW * pDot11, char * ssid, + int dot11Mode); + + DOT11_KSL_ENTRY * (*rxUpdate)(DOT11_FW * pDot11, UINT8 * macAddr, + int rate, int ssi); + DOT11_KSL_ENTRY * (*txUpdate)(DOT11_FW * pDot11, UINT8 * macAddr, + BOOL success, UINT32 nRetries, + UINT32 ackSSI); + DOT11_KSL_ENTRY * (*add)(DOT11_FW * pDot11, UINT8 * macAddr); + STATUS (*delete)(DOT11_FW * pDot11, DOT11_KSL_ENTRY * pKsl); + STATUS (*lastAttemptReset)(DOT11_FW * pDot11); + + + /* Private data members */ + + /* This is the pointer to the head of the free pool of KSL entries and the + semaphore to guard the LL */ + DOT11_KSL_ENTRY * pPool; + DOT11_KSL_ENTRY * pFreeEntry; + int poolUsed; + int poolMaxUsed; + SEM_ID poolSem; + + DOT11_KSL_ENTRY * list[DOT11_KSL_MAX_HASH]; + SEM_ID lockSem; /* Table protection */ + + int cleanupTimer; + + + } DOT11_KSL_OBJ; + +/***************************************************************************** +* DOT11_RSN_OBJ - Specialized SME OBJ for RSN use. Only used in SME_OBJ +*****************************************************************************/ +typedef struct /* DOT11_RSN_OBJ */ + { + + STATUS (*free)(DOT11_FW * pDot11); + INT32 (*rsnIeCreate)(DOT11_FW * pDot11, DOT11_KSL_ENTRY * pKsl, + UINT8 * buffer); + INT32 (*wpaIeCreate)(DOT11_FW * pDot11, DOT11_KSL_ENTRY * pKsl, + UINT8 * buffer); + STATUS (*ieProcess)(DOT11_FW * pDot11, DOT11_KSL_ENTRY * pKsl, + UINT8 * buffer); + UINT32 (*groupPolicyRecalc)(DOT11_FW * pDot11, + DOT11_KSL_ENTRY * pKsl); + STATUS (*eapolPktReceive)(DOT11_FW * pDot11, M_BLK_ID pMblk); + + STATUS (*pskSet)(DOT11_FW * pDot11, const UINT8 * pKey); + STATUS (*pmkSet)(DOT11_FW * pDot11, const UINT8 * pKey); + STATUS (*passphraseSet)(DOT11_FW * pDot11, const char * passphrase); + + STATUS (*fourwayStart)(DOT11_FW * pDot11, DOT11_KSL_ENTRY * pKsl); + STATUS (*fourwayTimeout)(DOT11_FW * pDot11, DOT11_KSL_ENTRY * pKsl); + STATUS (*gtkRecalc)(DOT11_FW * pDot11, DOT11_KSL_ENTRY * pKsl, + BOOL force); + STATUS (*micFailureProcess)(DOT11_FW * pDot11, UINT8 * srcAddr); + + UINT8 globalKeyCounter[DOT11_GKC_LEN]; + + /* Keeps track of the tickGet() of the last MIC failure. Used by + dot11RsnMicFailureProcess() to enforce TKIP countermeasures. */ + INT32 lastMicFailure; + + /* TRUE if TKIP countermeasures are active. Prevents association to and + from stations with TKIP cipher */ + BOOL micLockout; + + /* timerId for the dot11RsnMicReenable() */ + UINT32 micLockoutTimer; + + /* The source address of the packet that had the MIC error */ + UINT8 micLockoutAddr[DOT11_ADDR_LEN]; + + } DOT11_RSN_OBJ; + +/***************************************************************************** +* DOT11_ESS_OBJ - Specialized SME OBJ for ESS use. Only used in SME_OBJ +*****************************************************************************/ +typedef struct /* DOT11_ESS_OBJ */ + { + /* PRIVATE */ + DOT11_ESS_SM sm; /* State machine object */ + + MSG_Q_ID scanMsgQ; /* Message queue for scan task */ + int scanTaskId; /* TID for deleting scan task */ + + int probationTimer; /* Timer to recove from link p */ + + int authTimer; /* Timer for auth and assoc */ + + /* This is a pointer to the KSL_ENTRY of the currently connected BSS */ + DOT11_KSL_ENTRY * pKslAp; + + } DOT11_ESS_OBJ; + +/***************************************************************************** +* DOT11_IBSS_OBJ - Specialized SME OBJ for IBSS use. Only used in SME_OBJ +*****************************************************************************/ +typedef struct /* DOT11_IBSS_OBJ */ + { + M_BLK_ID pMblkBeacon; /* Cluster allocated for beacons */ + BOOL beaconing; /* Tue if beacons are being sent */ + BOOL syncBeacon; /* Are we sync'd to the IBSS's bcns */ + + int stateTid; /* Task ID of state task; for del */ + MSG_Q_ID stateMsgQ; /* Message queue for state task */ + + int state; /* Current state of SM */ + + int beaconInterval; /* Time (in tu) between beacons */ + int atimWindow; /* Window after beacon for ATIM */ + + /* This is the pointer to the KSL_ENTRY that we used to create the + IBSS. This is just one station in the IBSS, but it should be sufficient + to get the IBSS parameters from. If we get a beacon with a later timestamp + than this one, then we can shift to using that one */ + DOT11_KSL_ENTRY * pKslIbss; + } DOT11_IBSS_OBJ; + +/***************************************************************************** +* DOT11_AP_OBJ - Specialized SME OBJ for AP use. Only used in SME_OBJ +*****************************************************************************/ +/* The timeout for the TIVB is small so that we don't break beacons waiting +for it */ +#define DOT11_TIVB_SEM_TIMEOUT (2) + +typedef struct /* DOT11_AP_OBJ */ + { + int channel; + M_BLK_ID pMblkBeacon; /* Cluster allocated for beacons */ + int beaconInterval; /* Time (in tu) between beacons */ + DOT11_IE_TIM * pTim; /* Pointer to the TIM IE */ + UINT8 tivb[DOT11_MAX_PVB]; /* Complete TIVB */ + INT32 tivbStart; /* Start of real data in the tivb*/ + INT32 tivbStop; /* End of data in the tivb */ + SEM_ID tivbSem; /* Sem protecting TIVB */ + + UINT32 dtimPeriod; /* number of bcns per DTIM */ + UINT32 dtimCount; /* number of bcns until DTIM */ + UINT32 cfpPeriod; /* number of bcns per CFP */ + UINT32 cfpCount; /* number of bcns until CFP */ + UINT32 cfpDuration; /* Length of CFP, in tu */ + + BOOL respondBcastSsid; /* Respond to requests for ANY ssid */ + BOOL showSsidInBeacon; /* Respond to requests for ANY ssid */ + + int beaconTid; /* Beacon task-ID */ + SEM_ID beaconSem; /* Semaphore to wake beacontask */ + + UINT32 aclMode; /* Access Control List mode */ + + UINT16 lastAid; /* Last AID allocated */ + + /* A pointer to the real raw packet send */ + STATUS (*origRawPacketSend)(DOT11_FW * pDot11, M_BLK_ID pMBlk, int rate, + int keyIndex); + + /* 802.11g compatibility info */ + + /* Set to TRUE if a non-ERP station is present in 11g network */ + BOOL nonErpPresent; + + /* Set to TRUE if all ERP stations are required to use protection */ + BOOL useProtection; + + /* Set to TRUE if use of short time slot is allowed in this BSS */ + BOOL useShortTimeslot; + + /* Set to TRUE if use of short preamble is not allowed in this BSS */ + BOOL useLongPreamble; + + /* Pointer to the ERP IE in the beacon, for easy updating of 802.11g info + as stations join. Can be NULL is not in 11g mode */ + DOT11_IE_ERP * pErpIe; + + /* Pointer to the capabilities field in the beacon */ + UINT16 * pCaps; + + } DOT11_AP_OBJ; + +/***************************************************************************** +* SME_OBJ - Object representing the Station Management Entity. +*****************************************************************************/ +typedef struct /* SME_OBJ */ + { + /* PUBLIC members */ + + + /* Frees the entire SME, including the current SME module, if necessary */ + STATUS (*free)(DOT11_FW * pDot11); + + /* Starts the specified mode. Will de-init old mode if one was started */ + STATUS (*modeStart)(DOT11_FW * pDot11, int dot11Mode); + + /* Frees just the current SME module */ + STATUS (*modeStop)(DOT11_FW * pDot11); + + /* A helper function called by modeStop that stops the currently selected + SME module */ + STATUS (*modeFree)(DOT11_FW * pDot11); + + /* Show routine for the specific mode */ + STATUS (*modeShow)(DOT11_FW *); + + int (*endIoctl)(END_OBJ* pDrvCtrl, unsigned int cmd, caddr_t data); + + /* IOCTL routines specific to the SME type. Implemented in + dot11SmeXXXLib.c */ + int (*smeSpecificIoctl)(DOT11_FW * pDrvCtrl, unsigned int cmd, + caddr_t data); + + /* IOCTL routines common to all SME types. Implemented in dot11SmeLib.c */ + int (*smeCommonIoctl)(DOT11_FW * pDrvCtrl, unsigned int cmd, caddr_t data); + + /* Notifies the SME about link events */ + VOID (*linkEventNotify)(DOT11_FW * pDot11, int event); + + /* Perform a BSS scan */ + INT32 (*bssScanDo)(DOT11_FW * pDot11, char * ssid, + DOT11_SCAN_RESULTS * results, int numresults); + + int (*dot11StateGet)(DOT11_FW * pDot11); + + STATUS (*endMCastAddrGet)(END_OBJ* pEnd,MULTI_TABLE* pTable); + STATUS (*endMCastAddrAdd)(END_OBJ* pEnd, char * address); + STATUS (*endMCastAddrDel)(END_OBJ* pEnd, char * address); + STATUS (*reset)(DOT11_FW * pDot11); + + STATUS (*txMultiRateSet)(DOT11_FW * pDot11, UINT32 rate); + UINT32 (*txMultiRateGet)(DOT11_FW * pDot11); + STATUS (*txUniRateSet)(DOT11_FW * pDot11, DOT11_RATES * pRate); + STATUS (*txUniRateGet)(DOT11_FW * pDot11, DOT11_RATES * pRate); + + /* PRIVATE */ + STATUS (*nullDataSend)(DOT11_FW * pDot11,UINT8 * pDstAddr, BOOL toDs); + + STATUS (*probeReqSend)(DOT11_FW * pDot11,DOT11_IE_SSID * pSsid, + DOT11_RATES * pRates); + + STATUS (*authSend)(DOT11_FW * pDot11, UINT8 * pDstMacAddr, UINT16 authAlg, + UINT16 authSeq, UINT16 status, int chalLen, + UINT8 * pChallenge); + STATUS (*assocReqSend)(DOT11_FW * pDot11, UINT8 * pDstMacAddr, + DOT11_CAPABILITIES * pCap, UINT16 listenInt, + DOT11_IE_SSID *pSsid, DOT11_RATES * pRates); + STATUS (*assocRspSend)(DOT11_FW * pDot11, UINT8 * pDstMacAddr, + DOT11_CAPABILITIES * pCap, UINT16 status, + UINT16 aid, DOT11_RATES * pRates); + STATUS (*deauthSend)(DOT11_FW * pDot11, UINT8 * pDstAddr, UINT16 reason); + STATUS (*disassocSend)(DOT11_FW * pDot11, UINT8 * pDstAddr, UINT16 reason); + DOT11_RX_FUNC assocReceive; + DOT11_RX_FUNC disassocReceive; + DOT11_RX_FUNC authReceive; + DOT11_RX_FUNC deauthReceive; + DOT11_RX_FUNC beaconReceive; + DOT11_RX_FUNC nullDataReceive; + DOT11_RX_FUNC pollReceive; + + STATUS (*essJoin)(DOT11_FW * pDot11, char * pSsid); + UINT32 (*linkStatusGet)(DOT11_FW * pDot11); + UINT32 (*assocCallback)(DOT11_FW * pDot11, DOT11_KSL_ENTRY * pKsl, + UINT32 event); + + /* Called by the HDD when it needs the beacon updated. Only used for AP + mode */ + STATUS (*beaconUpdate)(DOT11_FW * pDot11); + + /* Regenerates the list of channels that match the current radio mode */ + STATUS (*scanListBuild)(DOT11_FW * pDot11); + + /* Determines whether a BSS scan will send Probe Requests and use info from + Probe Responses to locate BSSes. */ + BOOL activeScan; + + /* Determines whether a BSS scan will use info from Beacons to locate + BSSes. */ + BOOL passiveScan; + DOT11_CHANNEL_LIST scanList; + + /* The TID for the rate control task. Used in the deinitialization of the + SME. */ + int rateControlTask; + + /* This semaphore is given to force an update of the rc task. */ + SEM_ID rcForceUpdate; + + /* Rates that this station supports, in IEEE 802.11 format (ie. in units of + 500 kbps, with 0x80 masked over for basic (required) rates) */ + DOT11_RATES suppRates; + + /* These are the rates that the user wishes to use. They may or may not + be a subset of the supported rates - the intersection of the two sets will + be used */ + DOT11_RATES allowedRates; + + /* This is the rate that is used to transmit management and control frames, + as well and multicast and broadcast frames. It is typically one of the + station's basic rates, but is not required to be */ + UINT32 bcastRate; + + /* The desired broadcast rate is that set by WIOCSBCASTRATE. It is taken + into consideration when choosing a new bcast rate. If this rate is not in + the BSS basic rate set, the next lowest basic rate will be chosen. */ + UINT32 desiredBcastRate; + + /* This is the list of channels available and the mode they're available + in */ + DOT11_CHANNEL_LIST channelList; + + /* This is the default authentication method for a station, and the allowed + authentication method for an AP */ + UINT32 authType; + + /* This controls whether power management mode in on in ESS mode */ + BOOL powerManagement; + + /* This is the 802.1X authentication callback. The ESS and AP modules will + call this function if they associate (or associate someone) or disassociate + */ + FUNCPTR dot1xAuthCallback; + UINT32 dot1xAuthCallbackParam; + + /* The user callback is used to register a callback whereby the user is + notified of changes to the drivers state */ + FUNCPTR userAuthCallback; + + /* These are accumulators that are used for calculating the bytes/s stats*/ + DOT11_UINT64 accRxBytesPerSec; + DOT11_UINT64 accRxBytesPer16Sec; + DOT11_UINT64 accTxBytesPerSec; + DOT11_UINT64 accTxBytesPer16Sec; + + /* These are the timout values, in ticks, for authentication and + association messages. These are dynamic because the MIB wants to manage + them */ + UINT32 authTimeout; + UINT32 assocTimeout; + + /* TRUE if 802.11d support is turned on. This effects all modes of + operation */ + BOOL multiDomainEnabled; + + /* This is the SME specific object.v */ + union + { + DOT11_ESS_OBJ ess; + DOT11_IBSS_OBJ ibss; + DOT11_AP_OBJ ap; + } type; + + /* The KSL object that implements the KSL*/ + DOT11_KSL_OBJ ksl; + + /* The Object containing routines and data for managing the RSNA */ + DOT11_RSN_OBJ rsn; + + } SME_OBJ; + + +/***************************************************************************** +* HDD_OBJ - Object representing the Hardware Device Driver abstraction +*****************************************************************************/ +typedef struct /* HDD_OBJ */ + { + STATUS (*initialize)(DOT11_FW * pDot11); + STATUS (*free)(DOT11_FW * pDot11); + STATUS (*bringUp)(DOT11_FW * pDot11); + STATUS (*takeDown)(DOT11_FW * pDot11); + STATUS (*start)(DOT11_FW * pDot11); + STATUS (*stop)(DOT11_FW * pDot11); + STATUS (*show)(DOT11_FW * pDot11); + STATUS (*psPollSend)(DOT11_FW * pDot11); + STATUS (*rawPacketSend)(DOT11_FW * pDot11, M_BLK_ID pMBlk, int rate, + int keyIndex); + STATUS (*dtimPacketAdd)(DOT11_FW * pDot11, M_BLK_ID pMBlk, int rate, + int keyIndex); + STATUS (*dtimPacketFlush)(DOT11_FW * pDot11); + STATUS (*rxMapRegisterInit)(DOT11_FW * pDot11,DOT11_RX_FUNC rxMap[]); + STATUS (*rxMapRegisterSet)(DOT11_FW *pDot11,int entry,DOT11_RX_FUNC rxMap); + STATUS (*macAddrGet)(DOT11_FW * pDot11, UINT8 * pmacAddr ); + STATUS (*channelSet)(DOT11_FW * pDot11, int channel, int mode); + STATUS (*channelGet)(DOT11_FW * pDot11, int * channel, int * mode); + STATUS (*channelListGet)(DOT11_FW * pDot11, + DOT11_CHANNEL_INFO * pChannelInfo); + STATUS (*pmStateSet)(DOT11_FW * pDot11, BOOL pmState); + BOOL (*pmStateGet)(DOT11_FW * pDot11); + STATUS (*probStateSet)(DOT11_FW * pDot11, BOOL probState); + STATUS (*bssidSet)(DOT11_FW * pDot11, UINT8 * bssid, INT32 AID, + UINT32 timOffset); + STATUS (*suppRatesGet)(DOT11_FW * pDot11, DOT11_RATES * pRates); + STATUS (*hwEncryptionKeySet)(DOT11_FW * pDot11, UINT8 * macAddr, + UINT32 keyNum, DOT11_KEY * pKey); + STATUS (*hwEncryptionKeyDel)(DOT11_FW * pDot11, UINT32 keyNum); + int (*hwEncryptionKeyMaxGet)(DOT11_FW * pDot11); + + STATUS (*staBeaconSync)(DOT11_FW * pDot11); + + STATUS (*beaconStart)(DOT11_FW * pDot11, M_BLK_ID pMblk, + INT32 nextBeacon, int beaconInterval, int atimWin); + STATUS (*beaconStop)(DOT11_FW * pDot11); + + STATUS (*rtsThresholdSet)(DOT11_FW * pDot11, UINT32 rtsThreshold); + UINT32 (*rtsThresholdGet)(DOT11_FW * pDot11); + + VOID (*rxFilterSet)(DOT11_FW * pDot11, UINT32 rxFilter); + + UINT32 (*nextDtimGet)(DOT11_FW * pDot11); + + STATUS (*multicastAddressDel)(DOT11_FW * pDot11, char * pAddress); + STATUS (*multicastAddressAdd)(DOT11_FW * pDot11, char * pAddress); + + UINT32 (*cardTypeGet)(DOT11_FW * pDot11); + + STATUS (*tsfGet)(DOT11_FW * pDot11, DOT11_TIMESTAMP * pTsf); + + STATUS (*countryCodeChange)(DOT11_FW * pDot11); + + STATUS (*macAddrChange)(DOT11_FW * pDot11, UINT8 * macAddr); + + STATUS (*txParamsSet)(DOT11_FW * pDot11, BOOL useShortPreamble, + BOOL use11gProt, BOOL use11gShortSlot); + STATUS (*controlRateSet)(DOT11_FW * pDot11, UINT8 ctrlRate); + + STATUS (*hwVersGet)(DOT11_FW * pDot11, char * buffer); + STATUS (*frameLongRetrySet)(DOT11_FW * pDot11, UINT32 longRetry); + STATUS (*frameLongRetryGet)(DOT11_FW * pDot11, UINT32 *longRetry); + STATUS (*frameShortRetrySet)(DOT11_FW * pDot11, UINT32 shortRetry); + STATUS (*frameShortRetryGet)(DOT11_FW * pDot11, UINT32 *shortRetry); + STATUS (*txPowerScaleSet)(DOT11_FW * pDot11, UINT32 scale); + STATUS (*txPowerScaleGet)(DOT11_FW * pDot11, UINT32 * scale); + + STATUS (*countryCodeIeGet)(DOT11_FW * pDot11, UINT8 * pIe); + int (*countryCodeNumGet)(DOT11_FW * pDot11, char * country); + + int dot11Type; /* Are we an AP, STA in ESS or IBSS */ + + /* Packets larger than this threhsold get sent using CTS/RTS protection*/ + UINT32 ctsRtsThreshold; + + /* This describes the wireless mode that the card is currently in. It + cannot contain more than one mode (unlike pDot11->radioMode) since + it represents a physical setting */ + int curMode; + + /* This is the channel that the card is currently tuned to */ + int curChannel; + + DOT11_CHANNEL_INFO * pCurChannel; + + void * pHw; /* A pointer to a hardware specific data structure */ + + int pmState; /* Current state of power management */ + + UINT32 maxSleepTime; /* in milliseconds */ + + DOT11_RX_FUNC rxMap[DOT11_RX_MAP_NUM]; + + /* The information about the beacon task */ + int beaconTid; + SEM_ID beaconSem; + + /* The watchdog that is used to defer interrupts for a bit if tNetTask + overflows */ + WDOG_ID intReenableWdog; + /* Keeps track of the current value of the exponential backoff. */ + int intRenableTime; + + /* Keeps track of which keys are currently in use. Applicable only to + unicast keys */ + DOT11_KEYTAB_ENTRY keyTab[DOT11_MAX_KEYS]; + + /* Used for the periodic hardware calibration timer */ + int calTimer; + int calTime; + + } HDD_OBJ; + + +/***************************************************************************** +* DOT11_FW - The wireless framework object; the root object of the driver +*****************************************************************************/ +struct dot11Framework + { + /* the END_OBJ must go first so that we can use the pEnd to reference this + struct. Conceptually, we are extending the END_OBJ */ + END_OBJ endObj; + + STATUS (*endLoad)(char * initString, void * pBSP); + STATUS (*endUnload)(END_OBJ * pEnd); + STATUS (*endStart)(END_OBJ * pEnd); + STATUS (*endStop)(END_OBJ * pEnd); + STATUS (*debugLevelGet)(END_OBJ * pEnd,int area); + STATUS (*debugLevelSet)(DOT11_FW * pDot11, int area, int level); + + UINT8 macAddr[6]; + + /* The Station Management Entity handles management and control frames + and performs most aspects of the 802.11 protocol. */ + SME_OBJ * sme; + + /* The Hardware Device Driver implements the card-specific routines to + talk to the card. */ + HDD_OBJ * hdd; + + /* The Data Path Entity handles data packets, implementing the receive and + transmit path */ + DPE_OBJ * dpe; + + /* The type of device - ESS, IBSS or AP */ + INT32 dot11Mode; + + /* The unit number of the device */ + INT32 unitNum; + + /* Base address of the device's registers */ + UINT32 baseAddr; + + /* Base address for the memory pool */ + UINT32 dmaBufAddr; /* Address of the DMA buffer */ + UINT32 dmaBufSize; /* Total size of the DMA buffer */ + UINT32 dmaBufUsed; /* How much has already been allocated */ + + /* Interrupt request line assigned to the card */ + INT32 intVector; + INT32 intLevel; + + /* PCI Device ID for HDD chipset dection */ + UINT32 pciDeviceId; + + /* PCI Vendor ID for HDD chipset dection */ + UINT32 pciVendorId; + + /* PCI Device ID for HDD chipset dection */ + UINT32 pciSubDeviceId; + + /* PCI Vendor ID for HDD chipset dection */ + UINT32 pciSubVendorId; + + /* PCI Vendor ID for HDD chipset dection */ + UINT32 pciChipRevId; + + /* Size of the cache line. Typically 8 or 32 bytes. Always power of 2 */ + int cacheLineSize; + + /* The SSID to which the user would like us to join. Note that this may + be the broadcast addr, in which case the currentSsid may be different */ + char desiredSsid[DOT11_SSID_LEN + 1]; + + /* The SSID that the SME is currently working with. Since there may be + more than AP with a given SSID, this does not uniquely identify the + network */ + char currentSsid[DOT11_SSID_LEN + 1]; + + /* Radio type - controls which channels the card is allowed to access */ + UINT32 radioMode; + + /* Default channel - if the device needs a channel to create an AP or a + new IBSS, this is the channel chosen. This setting does not do anything + in ESS mode. */ + int defaultChannel; + + /* Current connected BSSID. This does uniquely identify the network, since + each BSS has to have a unique BSSID.*/ + UINT8 bssid[DOT11_ADDR_LEN]; + + /* Country code - controls which channels and transmit power levels are + available */ + int countryCode; + + /* Current link status */ + int linkStatus; + + /* Packet statistics */ + DOT11_STATS stats; + + CL_POOL_ID pClPool; /* Pointer to cluster pool for END use */ + M_CL_CONFIG mClBlkConfig; /* mbuf config table */ + CL_DESC clDescTbl; /* Cluster description table */ + + /* Contains the MUX function table */ + NET_FUNCS dot11EndFuncTable; + + /* Timer IDs for the statistics rate timers */ + int oneSecTimer; + int sixteenSecTimer; + + /* These are the parameters that control WPA and 802.11 mode */ + UINT32 secPol; /* Security Policy : a bitmap of allowed sec. policies */ + UINT32 authPol; /* Authentication Policy: specifies 802.1X or PSK */ + UINT32 ciphPol; /* Cipher Policy: Specifies list of allowed ciphers */ + + char rsnPassphrase[DOT11_PASSPHRASE_LEN+1]; + char rsnPassLastSsid[DOT11_SSID_LEN + 1]; + UINT8 preSharedKey[64]; /* If authPol == PSK, then this contains the PSK*/ + BOOL pskValid; + + /* This is the sequence number of the last packet received; used for duplicate detection as a fix to SPR 110780 */ + UINT16 lastSeq; + + }; /* No typedef since it had to be forward declared. See DOT11_FW above*/ + +typedef struct + { + void (*sysUsDelay) (int); + STATUS (*cacheInval) (void *, UINT32); + STATUS (*cacheFlush) (void *, UINT32); + UINT32 (*physToVirt) (UINT32); + UINT32 (*virtToPhys) (UINT32); + void (*sysIntConnect) (int vector, int func, + int params, STATUS *result); + void (*sysIntDisconnect) (int vector, int func, + int params, STATUS *result); + + void (*sysIntEnable) (INT32, STATUS *); + void (*sysIntDisable) (INT32, STATUS *); + + /* Declare the SME init functions here, so that there are no hard links + for when we want to run them */ + STATUS (*essInit)(DOT11_FW * pDot11); + STATUS (*ibssInit)(DOT11_FW * pDot11); + STATUS (*apInit)(DOT11_FW * pDot11); + STATUS (*rsnInit)(DOT11_FW * pDot11); + void (*dmaMemFree)(UINT32); + } DOT11_BSP_FUNCS; +IMPORT DOT11_BSP_FUNCS dot11BspFuncs; + + + + +/*################################################################*/ +/* These are internal calls that are only callable from within the kernel */ +/*################################################################*/ + +typedef struct + { + INT32 status; /* Port status */ + UINT8 macAddr[6]; /* mac address of the port */ + } _WRS_PACK_ALIGN(1) DOT11_DOT1X_PORTSTATUS; + +typedef struct param_s + { + UINT32 callback; /* Callback event handler */ + UINT32 cookie; /* private data */ + } _WRS_PACK_ALIGN(1) DOT11_DOT1X_PARAMS; + +/* Give dot1x port status change callback */ +#define WIOCSDOT1XPORTSTATUS _IOW('x', 0x01, DOT11_DOT1X_PORTSTATUS) + +/* Register authentication callback FUNCPTR */ +#define WIOCSAUTHCALLBACK _IOW('x', 0x02, DOT11_DOT1X_PARAMS) + +/* Set the PMK */ +#define WIOCSPMK _IOWU('x', 0x03, DOT11_PMK) + + + +/* +* LEGACY IOCTL DEFINITIONS +*/ + +#ifndef EIOCSWEPTYPE + #define EIOCSWEPTYPE (0x21d) /* Set WEP type - 64 bit or 128 bit */ +#endif +#ifndef EIOCGWEPSTATUS + #define EIOCGWEPSTATUS (0x20f) /* Get WEP status*/ +#endif +#ifndef EIOCSWEP + #define EIOCSWEP (0x210) /* Enable/disable WEP*/ +#endif +#ifndef EIOCSWEPKEY0 + #define EIOCSWEPKEY0 (0x211) /* Set WEP key 0*/ +#endif +#ifndef EIOCSWEPKEY1 + #define EIOCSWEPKEY1 (0x212) /* Set WEP key 1*/ +#endif +#ifndef EIOCSWEPKEY2 + #define EIOCSWEPKEY2 (0x213) /* Set WEP key 2*/ +#endif +#ifndef EIOCSWEPKEY3 + #define EIOCSWEPKEY3 (0x214) /* Set WEP key 3*/ +#endif +#ifndef EIOCSWEPDEFAULTKEY + #define EIOCSWEPDEFAULTKEY (0x215) /* Set WEP key 3*/ +#endif +#ifndef EIOCSAUTHCALLBACK + #define EIOCSAUTHCALLBACK (0x24B) /* Register authentication callback */ +#endif +#ifndef EIOCS802DOT1XMODE + #define EIOCS802DOT1XMODE (0x24C) /* Set 802.1x mode */ +#endif +#ifndef EIOCG802DOT1XMODE + #define EIOCG802DOT1XMODE (0x24D) /* Get 802.1x mode status */ +#endif +#ifndef EIOCGCONNECTEDBSSID + #define EIOCGCONNECTEDBSSID (0x220) /* Get BSSID */ +#endif +#ifndef EIOCSAUTHCALLBACK + #define EIOCSAUTHCALLBACK (0x24B) /* Get BSSID */ +#endif + +/* +* Public prototypes +*/ + +/* Initialization functions */ +END_OBJ * dot11EndLoad(char * initString, void * pBSP); + +STATUS dot11HddInit(DOT11_FW * pDot11); + +STATUS dot11DpeInit(DOT11_FW * pDot11); + +STATUS dot11SmeInit(DOT11_FW * pDot11); + +STATUS dot11RsnInit(DOT11_FW * pDot11); + +INT32 dot11DebugLevelGet(int area); + +STATUS dot11DebugLevelSet(int area, int level); + +IMPORT void dot11BcopySwap(const char * src, char * dst, int length ); + +IMPORT INT32 sysClkRateGet(); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* __INCdot11Libh */ + diff --git a/h/drv/wlan/dot11RsnLib.h b/h/drv/wlan/dot11RsnLib.h new file mode 100644 index 0000000..fe63900 --- /dev/null +++ b/h/drv/wlan/dot11RsnLib.h @@ -0,0 +1,80 @@ +/* dot11RsnLib.h - Contains definitions for the 802.11 RSN Library */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification History +-------------------- +01c,20jan05,rb Implement MIC countermeasures +01b,14jan05,rb Added AESKW macros +01a,8nov04,rb Initial revision +*/ + +#ifndef __INCdot11RsnLibh +#define __INCdot11RsnLibh +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/*************************************************************************** +* DOT11_RSN_IE - Used for 802.11i and WPA IEs +****************************************************************************/ +typedef struct + { + UINT8 oui[3]; + UINT8 suiteType; + } _WRS_PACK_ALIGN(1) DOT11_RSN_SUITE; + +typedef struct + { + UINT8 elementId; + UINT8 length; + UINT16 version; + DOT11_RSN_SUITE grpCipherSuite; + + /* The rest of the fields are variable length and optional, so we'll let + them be dynamically generated and not represented in this structure */ + + } _WRS_PACK_ALIGN(1) DOT11_RSN_IE; + +#define DOT11_RSN_IE_VERSION 1 +#define DOT11_RSN_OUI_0 0x00 +#define DOT11_RSN_OUI_1 0x0f +#define DOT11_RSN_OUI_2 0xac + + +#define DOT11_WPA_IE_VERSION 1 +#define DOT11_WPA_OUI_0 0x00 +#define DOT11_WPA_OUI_1 0x50 +#define DOT11_WPA_OUI_2 0xf2 + +/* These are the values from 7.3.2.25.1 of IEEE 802.11i for cipher suites */ +#define DOT11_RSN_SUITE_GROUP 0 +#define DOT11_RSN_SUITE_WEP40 1 +#define DOT11_RSN_SUITE_WEP104 5 +#define DOT11_RSN_SUITE_TKIP 2 +#define DOT11_RSN_SUITE_AES 4 + +/* These are the values from 7.3.2.25.2 of IEEE 802.11 for auth suites */ +#define DOT11_RSN_SUITE_8021X 1 +#define DOT11_RSN_SUITE_PSK 2 + +#define DOT11_AUTH_SUITE_TO_AUTHPOL(x) x + +/* This is used in the WPA IE to distinguish which WPA feature is being +advertised */ +#define DOT11_WPA_SUITE_ADVERTISEMENT 1 + +#define DOT11_SHA_DIGESTLEN 20 /* Bytes */ +#define DOT11_PBKDF2_ITERATION 4096 +#define DOT11_PBKDF2_MINCHAR 32 +#define DOT11_PBKDF2_MAXCHAR 126 + +#define DOT11_AESKW_IV_LEN 8 + +#define DOT11_MIC_FAILURE_TIME (sysClkRateGet() * 60) + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* __INCdot11RsnLibh */ diff --git a/h/drv/wlan/dot11SmeApLib.h b/h/drv/wlan/dot11SmeApLib.h new file mode 100644 index 0000000..735536b --- /dev/null +++ b/h/drv/wlan/dot11SmeApLib.h @@ -0,0 +1,36 @@ +/* dot11SmeApLib.h - Contains the main definitions for Ap Mode. */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification History +-------------------- +02a,25aug04,rb Wind River Wireless Ethernet Driver 2.0 FCS +*/ + +#ifndef __INCdot11SmeApLibh +#define __INCdot11SmeApLibh +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "vxWorks.h" + +/* These are the state variables for the ACL */ +#define DOT11_AP_ACL_DISABLED 0 +#define DOT11_AP_ACL_ALLOW 1 +#define DOT11_AP_ACL_DENY 2 + +/* Values used for dot11SmeApPsFlush() */ +#define DOT11_PM_FLUSH TRUE +#define DOT11_PM_SINGLE FALSE + +/* Return values from dot11SmeApPsFlush() */ +#define DOT11_PM_NO_DATA 0 +#define DOT11_PM_LAST_DATA 1 +#define DOT11_PM_MORE_DATA 2 + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* __INCdot11SmeApLibh */ diff --git a/h/drv/wlan/dot11SmeEssLib.h b/h/drv/wlan/dot11SmeEssLib.h new file mode 100644 index 0000000..d1813d6 --- /dev/null +++ b/h/drv/wlan/dot11SmeEssLib.h @@ -0,0 +1,172 @@ +/* dot11SmeEssLib.h - Contains the main definitions for Ess Mode. */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification History +-------------------- +02a,25aug04,rb Wind River Wireless Ethernet Driver 2.0 FCS +*/ + +#ifndef __INCdot11SmeEssLibh +#define __INCdot11SmeEssLibh +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "vxWorks.h" + +/************************************************************************** +* DOT11_ESS_SM - State machine for the ESS SME +***************************************************************************/ +typedef struct /* DOT11_ESS_SM */ + { + STATUS (*resetReqProcess)(DOT11_FW * pDot11); + STATUS (*joinReqProcess)(DOT11_FW * pDot11); + STATUS (*bssDiscoveredProcess)(DOT11_FW * pDot11); + STATUS (*authSuccessProcess)(DOT11_FW * pDot11); + STATUS (*authTimeoutProcess)(DOT11_FW * pDot11); + STATUS (*authFailProcess)(DOT11_FW * pDot11); + STATUS (*assocSuccessProcess)(DOT11_FW * pDot11); + STATUS (*assocFailProcess)(DOT11_FW * pDot11); + STATUS (*assocTimeoutProcess)(DOT11_FW * pDot11); + STATUS (*deauthProcess)(DOT11_FW * pDot11); + STATUS (*disassocProcess)(DOT11_FW * pDot11); + STATUS (*lqNoSignalProcess)(DOT11_FW * pDot11); + STATUS (*lqProbationProcess)(DOT11_FW * pDot11); + STATUS (*lqMakeDoProcess)(DOT11_FW * pDot11); + STATUS (*sharedKeyProcess)(DOT11_FW * pDot11); + + SEM_ID smLockSem; + MSG_Q_ID eventQueue; + int currentState; + int stateTaskId; + + } DOT11_ESS_SM; + +#define DOT11_ESS_STATE_TASK_NAME "tEssState%d" +#define DOT11_ESS_STATE_TASK_PRI 66 +#define DOT11_ESS_STATE_TASK_STACK (4 * 1024) +#define DOT11_ESS_STATE_MAX_MSG 64 +#define DOT11_ESS_STATE_TASK_SHUTDOWN_TIME ((sysClkRateGet() / 50) + 2) +#define DOT11_ESS_STATE_LOCK_TIME (sysClkRateGet() / 4) + +/***************************************************************************** +* DOT11_ESS_EVENTS - Events that drive the ESS state machine +*****************************************************************************/ + +/* RESET_REQ - can be called from any state. Will bring the device back to the +NO_ESS state */ +#define DOT11_ESS_RESET_REQ 1 + +/* JOIN_REQ - called from any state. Used to join a new BSS. Will move the +SM to the SEARCHING state */ +#define DOT11_ESS_JOIN_REQ 2 + +/* BSS_DISCOVERED - generated from the SCANNING or LINK_PROB states when a new +BSS matching the scanning criteria has been found */ +#define DOT11_ESS_BSS_DISCOVERED 3 + +/* AUTH_SUCCESS - Generated from the AUTHENTICATING state when the +authentication was successful */ +#define DOT11_ESS_AUTH_SUCCESS 4 + +/* TIMEOUT - Generated from the AUTHENTICATING or ASSOCIATING states when the +station failed to complete assoc or auth in the specified time */ +#define DOT11_ESS_AUTH_TIMEOUT 5 + +/* AUTH_FAIL - Generated by the AUTHENTICATING state when the AP denies the +station authentication */ +#define DOT11_ESS_AUTH_FAIL 6 + +/* ASSOC_SUCCESS - Generated by the ASSOCIATING state when the station +completes association successfully */ +#define DOT11_ESS_ASSOC_SUCCESS 7 + +/* ASSOC_FAIL - Generated by the ASSOCIATING state when the station is denied +association */ +#define DOT11_ESS_ASSOC_FAIL 8 + +/* ASSOC_TIMEOUT - Generated by the ASSOCIATING state when the AP does not +respond*/ +#define DOT11_ESS_ASSOC_TIMEOUT 9 + +/* DEAUTH - Generated in response to a user request to de-authenticate the +station. If associated, a deassociation occurs before the actual +deauthentication packet is sent out. */ +#define DOT11_ESS_DEAUTH 10 + +/* DISASSOC - Generated in response to a user request to disassociate the +station. */ +#define DOT11_ESS_DISASSOC 11 + +/* LQ_NO_SIGNAL - Generated in the CONNECTED state when the station has not +received a packet (or beacon) from the AP in a set time period. */ +#define DOT11_ESS_LQ_NO_SIGNAL 12 + +/* LQ_PROBATION - Generated in the CONNECTED state when the average signal +level drops below a set threshold */ +#define DOT11_ESS_LQ_PROBATION 13 + +/* LQ_MAKE_DO - Generated in the LINK_PROB state when a stronger AP in the ESS +cannot be found */ +#define DOT11_ESS_LQ_MAKE_DO 14 + +/* SHUTDOWN - a pseudo-event that shuts down the ESS state machine and frees +all resources used by it */ +#define DOT11_ESS_SHUTDOWN 15 + +/* DOT11_ESS_SKA - generated from ATHENTICATING state when shared key +is being used. It signifies the receipt of stage 2, and triggers the +transmittion of stage 3. */ +#define DOT11_ESS_SKA 16 + + +/***************************************************************************** +* DOT11_ESS_STATES - Possible states for the ESS SM +*****************************************************************************/ +typedef enum + { + SME_ESS_NOESS = 0, /* Base initialized state. Not operational */ + SME_ESS_SCANNING, /* Looking for a specific ESS or any ESS */ + SME_ESS_AUTHENTICATING,/* Chose an ESS - sent auth seq 1 */ + SME_ESS_AUTH_SHARED, /* In the middle of a SKA exchange, sent #3 */ + SME_ESS_ASSOCIATING, /* Authenticated. Send Assoc Req. */ + SME_ESS_CONNECTED, /* Authenticated and associated. Fully connected*/ + SME_ESS_LINK_PROB, /* Looking for better AP. Still connectect to old*/ + SNE_ESS_STATES_MAX + } SME_ESS_STATE; + +/***************************************************************************** +* DOT11_ESS_SCAN_MESSAGES - Messages passed to the ESS Scan task +******************************************************************************/ +#define DOT11_ESS_SCAN_MAX_MSGS 16 +#define DOT11_ESS_SCAN_TASK_PRI (DOT11_ESS_STATE_TASK_PRI + 1) +#define DOT11_ESS_SCAN_TASK_STACK 4096 +#define DOT11_ESS_SCAN_TASK_NAME "tDot11Scan%d" +#define DOT11_ESS_SCAN_WAIT (sysClkRateGet() / 4) + +/* This is the amount of time that is required between probation periods. +If the device tried to enter probation more frequently than this, the +eevent will be dropped */ +#define DOT11_ESS_PROBATION_MIN_DELAY (sysClkRateGet() * 30) + +typedef enum + { + DOT11_ESS_SCAN_START, + DOT11_ESS_SCAN_STOP, + DOT11_ESS_PROB_START, + DOT11_ESS_PROB_STOP + } DOT11_ESS_SCAN_MESSAGE; + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* __INCdot11SmeEssLibh */ + + + + + + diff --git a/h/drv/wlan/dot11SmeIbssLib.h b/h/drv/wlan/dot11SmeIbssLib.h new file mode 100644 index 0000000..9c9ff0a --- /dev/null +++ b/h/drv/wlan/dot11SmeIbssLib.h @@ -0,0 +1,69 @@ +/* dot11SmeIbssLib.h - Contains the main definitions for IBSS Mode. */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification History +-------------------- +02a,25aug04,rb Wind River Wireless Ethernet Driver 2.0 FCS +*/ + +#ifndef __INCdot11SmeIbssLibh +#define __INCdot11SmeIbssLibh +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "vxWorks.h" + +/* Wait two ticks for a task to delete itself */ +#define DOT11_IBSS_TASK_DELETE_TIMEOUT 2 + +/*********************************************************************** +* IBSS STATE TASK - This section contains definitions used by the state +* task +************************************************************************/ + +/* These are the parameters used to set up the stat task */ +#define DOT11_IBSS_STATE_TASK_NAME "tIbssState%d" +#define DOT11_IBSS_STATE_TASK_PRI 166 +#define DOT11_IBSS_STATE_TASK_STACK 3000 +#define DOT11_IBSS_STATE_MAX_MSGS 64 + +/* States that are possible in the IBSS state machine */ +typedef enum + { + DOT11_IBSS_STATE_NOIBSS, /* Initial state */ + DOT11_IBSS_STATE_SEARCHING, /* Performing a search for the IBSS */ + DOT11_IBSS_STATE_SYNC, + DOT11_IBSS_STATE_CONNECTED /* Connected to an IBSS */ + } DOT11_IBSS_STATE; + +/* Events that are passed to the event queue thought sme->linkEventNotify() */ +typedef enum + { + DOT11_IBSS_EV_RESET, + DOT11_IBSS_EV_JOIN_REQ, + DOT11_IBSS_EV_SYNC_IBSS, + DOT11_IBSS_EV_CREATE_IBSS, + DOT11_IBSS_EV_JOIN_IBSS, + DOT11_IBSS_EV_SHUTDOWN + } DOT11_IBSS_EV; + +#define DOT11_IBSS_BEACON_START_IMMED 0 +#define DOT11_IBSS_BEACON_START_RESUME -1 + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* __INCdot11SmeIbssLibh */ + + + + + + + + + diff --git a/h/drv/wlan/dot11SmeLib.h b/h/drv/wlan/dot11SmeLib.h new file mode 100644 index 0000000..60db20b --- /dev/null +++ b/h/drv/wlan/dot11SmeLib.h @@ -0,0 +1,41 @@ +/* dot11SmeLib.h - Contains PRIVATE definitions for intra-SME use */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification History +-------------------- +02a,25aug04,rb Wind River Wireless Ethernet Driver 2.0 FCS +*/ + +#ifndef __INCdot11SmeLibh +#define __INCdot11SmeLibh +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include + +/* Known station list functions */ +STATUS dot11KslInit(DOT11_FW * pDot11); + +/* Station Management Entity functions */ +STATUS dot11SmeEssInit(DOT11_FW * pDot11 ); + +STATUS dot11SmeActualRateCalc(DOT11_FW * pDot11, DOT11_RATES * pRates1, + DOT11_RATES * pRates2, + DOT11_RATES * pRates3, + DOT11_RATES * pActualRates); + +STATUS dot11SmeRateSort (DOT11_RATES * pRates ); + + + + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* __INCdot11SmeLibh */ + + diff --git a/h/drv/wlan/dot11Test.h b/h/drv/wlan/dot11Test.h new file mode 100644 index 0000000..8533e7f --- /dev/null +++ b/h/drv/wlan/dot11Test.h @@ -0,0 +1,79 @@ +/* dot11SmeLib.h - Contains PRIVATE definitions for intra-SME use */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification History +-------------------- +01b,22sep05,rb Fix bad prototype of dot11ChannelSet() +01a,12sep05,rb Initial verson +*/ + +/* +DESCRIPTION + +This file contains prototypes for using dot11Test.c. To use this module, include "802.11 command line utilities and test routines" from Workbench + +*/ + + +#ifndef __INCdot11Testh +#define __INCdot11Testh +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include + + +STATUS dot11TestIoctl(int ifNum, int cmd, caddr_t data); + +VOID dot11TestInit(void); +STATUS dot11SSIDSet(int ifNum, char * ssid); +STATUS dot11SSIDGet(int ifNum); +STATUS dot11ModeSet(int ifNum,int mode); +STATUS dot11ModeNone(int ifNum); +STATUS dot11ModeEss(int ifNum); +STATUS dot11ModeIbss(int ifNum); +STATUS dot11ModeAp(int ifNum); +STATUS dot11PmSet(int ifNum, BOOL pmEnabled); +STATUS dot11ChannelSet(int ifNum,int channel); +STATUS dot11SecPolSet(int ifNum, int secPol); +STATUS dot11AuthPolSet(int ifNum,int authPol); +STATUS dot11CipherPolSet(int ifNum, int cipherPol); +STATUS dot11PassphraseSet(int ifNum, char * passphrase); +STATUS dot11PskSet(int ifNum,UINT8 *psk); +STATUS dot11WepSet(int ifNum,int encryptType); +STATUS dot11WepDefaultKeySet(int ifNum,int keySlot); +STATUS dot11WepSkSet(int ifNum,int authType); +STATUS dot11TxPowerScaleSet(int ifNum, UINT32 scale ); +STATUS dot11WepKeySet(int ifNum,int keySlot, UINT8 * keyData ); +STATUS dot11RateSet(int ifNum, int numRates, ...); +STATUS dot11CtsRtsSet(int ifNum, int rtsThreshold); +STATUS dot11FragThreshSet(int ifNum, int fragThresh); +STATUS dot11RadioModeSet(int ifNum, int radioMode ); +STATUS dot11LongRetrySet(int ifNum, int retry); +STATUS dot11ShortRetrySet(int ifNum,int retry); +STATUS dot11LongRetryGet(int ifNum); +STATUS dot11ShortRetryGet(int ifNum); +STATUS dot11CountryCodeSet(int ifNum,int cc); +STATUS dot11SuppRateGet(int ifNum); +STATUS dot111ChannelGet(int ifNum); +STATUS dot11AuthTypeSet(int ifNum,int cc); +STATUS dot11Stats(int ifNum); +STATUS dot11Scan(int ifNum,char * ssid); +STATUS dot11ChannelListGet(int ifNum); +STATUS dot11BeaconSet(int ifNum,int beaconInterval); +STATUS dot11MultiDomainSet(int ifNum,BOOL enable); +STATUS dot11SSIDHide(int ifNum,UINT32 ssidFeatures); +STATUS dot11ScanTypeSet(int ifNum, UINT32 scanType); +STATUS dot11ScanTypeGet(int ifNum); + + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* __INCdot11Testh */ + + diff --git a/h/drv/wlan/dot11TimerLib.h b/h/drv/wlan/dot11TimerLib.h new file mode 100644 index 0000000..80c2d67 --- /dev/null +++ b/h/drv/wlan/dot11TimerLib.h @@ -0,0 +1,17 @@ +/* dot11TimerLib.h - Contains the main definitions for the 802.11 timer fw*/ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification History +-------------------- +02a,25aug04,rb Wind River Wireless Ethernet Driver 2.0 FCS +*/ + +#include + +STATUS dot11TimerInit(); +STATUS dot11TimerDestroy(); +int dot11TimerAdd(int delayTicks, FUNCPTR action, int param0, int param1); +STATUS dot11TimerDel(int timerId); +STATUS dot11TimerShow(); diff --git a/h/drv/wlan/dot11UsrLib.h b/h/drv/wlan/dot11UsrLib.h new file mode 100644 index 0000000..20c1fbe --- /dev/null +++ b/h/drv/wlan/dot11UsrLib.h @@ -0,0 +1,1033 @@ +/* dot11UsrLib.h - Contains the definitions required by users of DOT11 lib */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* +Modification History +-------------------- +01k,12sep05,rb Added WIOCSSCANTYPE +01j,25aug05,rb Modified channel structures for 802.11d +01j,30aug05,rb Removed legacy IOCTL definitions and added WIOCDPAIRWISEKEY +01i,19aug05,rb Added macros for turbo mode +01h,04aug05,rb Added WIOCGCHANNELLIST +01g,03aug05,rb Added WIOCSUSERAUTHCALLBACK +01f,28apr05,rb Added _BIT definition to dot11UsrLib.h; Moved encryption types + to usrLib +01e,27apr05,rb Extended DOT11_STATS for SPR 108017 +01d,25apr05,rb Moved definitions needed for IOCTLs from dot11Lib.h to + dot11UsrLib.h +01c,14apr05,rb Added support fr Transmit Power Scaling (WIOCSTXPOWERSCALE) +01b,09mar05,rb Added WIOCGHWVERS +01a,21feb05,rb Initial split from dot11Lib.h +*/ + +/* +DESCRIPTION + +This file contains all of the definitions required to manage the Wind River +Wirelss Ethernet Driver. + +*/ + + +#ifndef __INCdot11UsrLibh +#define __INCdot11UsrLibh +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/***************************************************************************** +* Public DOT11 Data structures and definitions +*****************************************************************************/ +#ifndef _BIT +#define _BIT(x) (1<<(x)) +#endif + + +/************************************************************************** +* DOT11_SSID - Structure representing an SSID +***************************************************************************/ +#define DOT11_SSID_LEN 32 +typedef char DOT11_SSID[DOT11_SSID_LEN + 1]; + +/************************************************************************** +* DOT11_ADDR - An 802.11 hardware address. Same as MAC address. +***************************************************************************/ +#define DOT11_ADDR_LEN 6 +typedef UINT8 DOT11_ADDR[DOT11_ADDR_LEN]; + +/************************************************************************** +* DOT11_RATES - A set of rates in IEEE format (units of 500 kb/s). Rates +* are listed in ascending order. If relevent, required +* rates are specified by setting bit 7, otherwise this +* bit is clear. +**************************************************************************/ +#define DOT11_MAX_RATES 256 +typedef struct + { + int length; + UINT8 rates[DOT11_MAX_RATES]; + } _WRS_PACK_ALIGN(1) DOT11_RATES; + +/* Routines for manipulating rates according to the IEEE standard */ +#define DOT11_RATE(x) (((x) & 0x7f) / 2) +#define DOT11_RATE_MASK(x) (((x) & 0x7f)) +#define DOT11_IS_BRATE(x) (((x) & 0x80) == 0x80) + +/************************************************************************** +* DOT11_KEY - An 802.11 Encryption Key. +***************************************************************************/ +typedef unsigned long int DOT11_KEY_TYPE; + +#define DOT11_KEY_TYPE_NONE 0 +#define DOT11_KEY_TYPE_WEP40 DOT11_CIPHPOL_WEP40 +#define DOT11_KEY_TYPE_WEP104 DOT11_CIPHPOL_WEP104 +#define DOT11_KEY_TYPE_TKIP DOT11_CIPHPOL_TKIP +#define DOT11_KEY_TYPE_AES DOT11_CIPHPOL_AES + +#define DOT11_KEY_TYPE_MAX (DOT11_KEY_TYPE_AES + 1) + +#define DOT11_WEP40_KEY_SIZE 5 /* Bytes */ +#define DOT11_WEP104_KEY_SIZE 13 /* Bytes */ +#define DOT11_AES_KEY_SIZE 16 /* Bytes */ +#define DOT11_TKIP_KEY_SIZE 32 /* 16 Bytes key, 2x8 bytes MIC */ + +typedef struct + { + DOT11_KEY_TYPE keyType; + INT32 keySlot; /* Keyslot key was installed to */ + UINT8 macAddr[DOT11_ADDR_LEN]; + union + { + UINT8 wep40[DOT11_WEP40_KEY_SIZE]; + UINT8 wep104[DOT11_WEP104_KEY_SIZE]; + UINT8 aes[DOT11_AES_KEY_SIZE]; + UINT8 tkip[DOT11_TKIP_KEY_SIZE]; + } type; + } DOT11_KEY; + +/* This is the length of the pre-shared key for WPA and 802.11i. */ +#define DOT11_PSK_LEN 64 /* bytes */ +typedef UINT8 DOT11_PSK[DOT11_PSK_LEN]; + + +#define DOT11_PASSPHRASE_LEN 63 +typedef char DOT11_PASSPHRASE[DOT11_PASSPHRASE_LEN]; + +#define DOT11_HWVERS_BUF_LEN 256 +typedef char DOT11_HWVERS_BUF[DOT11_HWVERS_BUF_LEN]; + +/**************************************************************************** +* DOT11_CAPABILITIES - This is the Capabilities field of Management Frames as +* per 7.3.1.4 of IEEE 802.11(2003) +****************************************************************************/ +typedef UINT16 DOT11_CAPABILITIES; + +#define DOT11_CAP_ISESS _BIT(0) +#define DOT11_CAP_ISIBSS _BIT(1) +#define DOT11_CAP_CFPOLLABLE _BIT(2) +#define DOT11_CAP_CFPOLLREQ _BIT(3) +#define DOT11_CAP_PRIVACY _BIT(4) +#define DOT11_CAP_SHORT_PREAMBLE _BIT(5) +#define DOT11_CAP_PBCC _BIT(6) +#define DOT11_CAP_CHANNEL_AGILITY _BIT(7) +#define DOT11_CAP_SHORT_TIME_SLOT _BIT(10) + +/**************************************************************************** +* DOT11_COUNTRY_CODES - the list of available country codes that can be passed +* to WIOCSCOUNTRYCODE. More country codes can be found +* in ISO 3166, but this is the current list supported +* by the available hardware. +*****************************************************************************/ + +/* DOT11_COUNTRY_NONE can only be used as a default country on a station. If +it is set as the default country, then 802.11d MUST be used to find the +current country. If no country-advertising APs are found, then the station +will not transmit anything */ + +#define DOT11_COUNTRY_NONE 0 + +#define DOT11_COUNTRY_ALBANIA 8 +#define DOT11_COUNTRY_ALGERIA 12 +#define DOT11_COUNTRY_ARGENTINA 32 +#define DOT11_COUNTRY_ARMENIA 51 +#define DOT11_COUNTRY_AUSTRALIA 36 +#define DOT11_COUNTRY_AUSTRIA 40 +#define DOT11_COUNTRY_AZERBAIJAN 31 +#define DOT11_COUNTRY_BAHRAIN 48 +#define DOT11_COUNTRY_BELARUS 112 +#define DOT11_COUNTRY_BELGIUM 56 +#define DOT11_COUNTRY_BELIZE 84 +#define DOT11_COUNTRY_BOLIVIA 68 +#define DOT11_COUNTRY_BRAZIL 76 +#define DOT11_COUNTRY_BRUNEI_DARUSSALAM 96 +#define DOT11_COUNTRY_BULGARIA 100 +#define DOT11_COUNTRY_CANADA 124 +#define DOT11_COUNTRY_CHILE 152 +#define DOT11_COUNTRY_CHINA 156 +#define DOT11_COUNTRY_COLOMBIA 170 +#define DOT11_COUNTRY_COSTA_RICA 188 +#define DOT11_COUNTRY_CROATIA 191 +#define DOT11_COUNTRY_CYPRUS 196 +#define DOT11_COUNTRY_CZECH 203 +#define DOT11_COUNTRY_DENMARK 208 +#define DOT11_COUNTRY_DOMINICAN_REPUBLIC 214 +#define DOT11_COUNTRY_ECUADOR 218 +#define DOT11_COUNTRY_EGYPT 818 +#define DOT11_COUNTRY_EL_SALVADOR 222 +#define DOT11_COUNTRY_ESTONIA 233 +#define DOT11_COUNTRY_FAEROE_ISLANDS 234 +#define DOT11_COUNTRY_FINLAND 246 +#define DOT11_COUNTRY_FRANCE 250 +#define DOT11_COUNTRY_FRANCE2 255 +#define DOT11_COUNTRY_GEORGIA 268 +#define DOT11_COUNTRY_GERMANY 276 +#define DOT11_COUNTRY_GREECE 300 +#define DOT11_COUNTRY_GUATEMALA 320 +#define DOT11_COUNTRY_HONDURAS 340 +#define DOT11_COUNTRY_HONG_KONG 344 +#define DOT11_COUNTRY_HUNGARY 348 +#define DOT11_COUNTRY_ICELAND 352 +#define DOT11_COUNTRY_INDIA 356 +#define DOT11_COUNTRY_INDONESIA 360 +#define DOT11_COUNTRY_IRAN 364 +#define DOT11_COUNTRY_IRAQ 368 +#define DOT11_COUNTRY_IRELAND 372 +#define DOT11_COUNTRY_ISRAEL 376 +#define DOT11_COUNTRY_ITALY 380 +#define DOT11_COUNTRY_JAMAICA 388 +#define DOT11_COUNTRY_JAPAN 392 +#define DOT11_COUNTRY_JAPAN1 393 +#define DOT11_COUNTRY_JAPAN2 394 +#define DOT11_COUNTRY_JAPAN3 395 +#define DOT11_COUNTRY_JAPAN4 396 +#define DOT11_COUNTRY_JAPAN5 397 +#define DOT11_COUNTRY_JORDAN 400 +#define DOT11_COUNTRY_KAZAKHSTAN 398 +#define DOT11_COUNTRY_KENYA 404 +#define DOT11_COUNTRY_KOREA_NORTH 408 +#define DOT11_COUNTRY_KOREA_ROC 410 +#define DOT11_COUNTRY_KOREA_ROC2 411 +#define DOT11_COUNTRY_KUWAIT 414 +#define DOT11_COUNTRY_LATVIA 428 +#define DOT11_COUNTRY_LEBANON 422 +#define DOT11_COUNTRY_LIBYA 434 +#define DOT11_COUNTRY_LIECHTENSTEIN 438 +#define DOT11_COUNTRY_LITHUANIA 440 +#define DOT11_COUNTRY_LUXEMBOURG 442 +#define DOT11_COUNTRY_MACAU 446 +#define DOT11_COUNTRY_MACEDONIA 807 +#define DOT11_COUNTRY_MALAYSIA 458 +#define DOT11_COUNTRY_MEXICO 484 +#define DOT11_COUNTRY_MONACO 492 +#define DOT11_COUNTRY_MOROCCO 504 +#define DOT11_COUNTRY_NETHERLANDS 528 +#define DOT11_COUNTRY_NEW_ZEALAND 554 +#define DOT11_COUNTRY_NICARAGUA 558 +#define DOT11_COUNTRY_NORWAY 578 +#define DOT11_COUNTRY_OMAN 512 +#define DOT11_COUNTRY_PAKISTAN 586 +#define DOT11_COUNTRY_PANAMA 591 +#define DOT11_COUNTRY_PARAGUAY 600 +#define DOT11_COUNTRY_PERU 604 +#define DOT11_COUNTRY_PHILIPPINES 608 +#define DOT11_COUNTRY_POLAND 616 +#define DOT11_COUNTRY_PORTUGAL 620 +#define DOT11_COUNTRY_PUERTO_RICO 630 +#define DOT11_COUNTRY_QATAR 634 +#define DOT11_COUNTRY_ROMANIA 642 +#define DOT11_COUNTRY_RUSSIA 643 +#define DOT11_COUNTRY_SAUDI_ARABIA 682 +#define DOT11_COUNTRY_SINGAPORE 702 +#define DOT11_COUNTRY_SLOVAKIA 703 +#define DOT11_COUNTRY_SLOVENIA 705 +#define DOT11_COUNTRY_SOUTH_AFRICA 710 +#define DOT11_COUNTRY_SPAIN 724 +#define DOT11_COUNTRY_SWEDEN 752 +#define DOT11_COUNTRY_SWITZERLAND 756 +#define DOT11_COUNTRY_SYRIA 760 +#define DOT11_COUNTRY_TAIWAN 158 +#define DOT11_COUNTRY_THAILAND 764 +#define DOT11_COUNTRY_TRINIDAD_Y_TOBAGO 780 +#define DOT11_COUNTRY_TUNISIA 788 +#define DOT11_COUNTRY_TURKEY 792 +#define DOT11_COUNTRY_UAE 784 +#define DOT11_COUNTRY_UKRAINE 804 +#define DOT11_COUNTRY_UNITED_KINGDOM 826 +#define DOT11_COUNTRY_UNITED_STATES 840 +#define DOT11_COUNTRY_URUGUAY 858 +#define DOT11_COUNTRY_UZBEKISTAN 860 +#define DOT11_COUNTRY_VENEZUELA 862 +#define DOT11_COUNTRY_VIET_NAM 704 +#define DOT11_COUNTRY_YEMEN 887 +#define DOT11_COUNTRY_ZIMBABWE 716 + + +/***************************************************************************** +* Public DOT11 IOCTL Commands +*****************************************************************************/ +#include "sys/ioctl.h" + +/* For backwards compatability, define the "user mode" IOCTL macros manually +if they are not already defined. They should be defined in vxWorks 6.1 and +higher */ + +#ifndef IOC_USER +#define IOC_USER 0x8000 +#endif /* IOC_USER */ + +#ifndef _IOU +#define _IOU(x,y) (IOC_USER | _IO(x,y)) +#endif + +#ifndef _IORU +#define _IORU(x,y,t) (IOC_USER | _IOR(x,y,t)) +#endif + +#ifndef _IOWU +#define _IOWU(x,y,t) (IOC_USER | _IOW(x,y,t)) +#endif + +#ifndef _IOWRU +#define _IOWRU(x,y,t) (IOC_USER | _IOWR(x,y,t)) +#endif + +/*************************************************************************** +* WIOCGSTATS - Get Card Statistics +****************************************************************************/ + +typedef struct /* DOT11_STATS */ + { + /* total number of packets (after reassembly) both unicast and + multicast data frames. */ + UINT32 rxFrames; + + /* total number of received fragments, both data and + management, multicast and unicast. */ + UINT32 rxFragments; + + /* total number of received multicast data fragments */ + UINT32 rxMcastFragments; + + /* total bytes of data received, all frame types and destinations */ + unsigned long long int rxTotalBytes; + + /* Number of frames erroneously retransmitted; frames with same sequence + number as the one previous */ + UINT32 rxDuplicates; + + /* Number of frames dropped by the hardware due to Frame CheckSum + failure */ + UINT32 rxFCSError; + + /* Number of frames dropped due to miscellaneous errors */ + UINT32 rxHardwareError; + + /* Number of frames received that were unable to be decoded, most likely + due to incorrect encryption keys */ + UINT32 rxDecryptError; + + /* Michael failures. This statistic only applies to TKIP frames */ + UINT32 rxMicFailure; + + /* Number of unencrypted frames received and dropped while encryption is + turned on */ + UINT32 rxExcludeUnencrypted; + + /* Number of received frames that were dropped due to the receive port + being 802.1X unauthorized */ + UINT32 rxDot1xDropped; + + /* Frames that were dropped because there wasn't room in the reassembly + queue, because all fragments were not received in the specified timeout + period, or beacause an out-of-order fragment was received. */ + UINT32 rxCantReassemble; + + /* The number of data bytes that were received in the last second, updated + every second. */ + UINT32 rxBytesPerSec; + + /* The nubmer of databytes received in the last sixteen seconds, updated + every sixteen seconds. */ + UINT32 rxBytesPer16Sec; + + /* The total number of data frames (before fragmentation) transmitted */ + UINT32 txFrames; + + /* The total number of fragments (data and management) transmitted */ + UINT32 txFragments; + + /* The total number of multicast data frames transmitted */ + UINT32 txMcastFragments; + + /* The total number of bytes in all packets transmitted */ + unsigned long long int txTotalBytes; + + /* The number of packets that were succesfully transmitted after one or + more retries */ + UINT32 txRetry; + + /* The number of packets that were transmitted after more than one retry */ + UINT32 txRetryMultiple; + + /* The number of packets that were not transmitted due to too many + retries */ + UINT32 txRetryFailure; + + /* The number of times a transmitted frame failed to get an ACK from the + receiver */ + UINT32 txAckFailure; + + /* The number of RTS frames transmitted to which a CTS was never + received */ + UINT32 txRTSFailure; + + /* The number of RTS frames transmitted to which a CTS was received */ + UINT32 txRTSSuccess; + + /* The number of egress frames dropped due to hardware failure or queue + overflow */ + UINT32 txHardwareError; + + /* The number of egress data frames dropped due to the 802.1X port being + unauthorized. */ + UINT32 txDot1xDropped; + + /* The number of data bytes transmitted in the last second, updated every + second */ + UINT32 txBytesPerSec; + + /* The number of data bytes transmitted in the last sixteen seconds, + updated every sixteen seconds */ + UINT32 txBytesPer16Sec; + + /* The number of four-way handshakes that completed successfully, as far + as this unit can tell. Note that this cannot catch errors that occured on + a station on the last frame sent to the AP */ + UINT32 fourWaySuccess; + + /* The number of four-way handshakes that failed at this unit. */ + UINT32 fourWayFailure; + + /* The number of group key exchanges that completed successfully, as far as + this unit can tell. Note that this cannot detect problems with the last + packet a station sends to the AP if this unit is a station. */ + UINT32 groupExchangeSuccess; + + /* The number of group key exchanges that failed */ + UINT32 groupExchangeFailure; + + } DOT11_STATS; + +#define WIOCGSTATS _IORU('w', 0x001, DOT11_STATS) + +/*************************************************************************** +* WIOCGLINKSTAT - Get Link Status +****************************************************************************/ + +/* Link Status */ +#define DOT11_LINK_SLEEP 2 +#define DOT11_LINK_UP 1 +#define DOT11_LINK_DOWN 0 + +#define WIOCGLINKSTAT _IORU('w', 0x002, UINT32) + +/*************************************************************************** +* WIOCGDESIREDSSID - Get Wireless Network Name +****************************************************************************/ +#define WIOCGDESIREDSSID _IORU('w', 0x003, DOT11_SSID) + +/*************************************************************************** +* WIOCSSSID - Set Wireless Network Name +****************************************************************************/ +#define WIOCSSSID _IOWU('w', 0x004, DOT11_SSID) + +/*************************************************************************** +* WIOCGCONNECTEDSSID - Get current BSS +****************************************************************************/ +#define WIOCGCONNECTEDSSID _IORU('w', 0x005, DOT11_SSID) + +/*************************************************************************** +* WIOCGCONNECTEDBSSID - Get connected BSSID +****************************************************************************/ +#define WIOCGCONNECTEDBSSID _IORU('w', 0x006, DOT11_ADDR) + +/*************************************************************************** +* WIOCGTXRATE - Get current transmit rate +****************************************************************************/ +#define WIOCGTXRATE _IORU('w', 0x007, UINT32) + +/*************************************************************************** +* WIOCSTXRATE - Set Transmit Speed +****************************************************************************/ +#define WIOCSTXRATE _IOWU('w', 0x008, DOT11_RATES) + +/*************************************************************************** +* WIOCGPWRMAN - Get Power Management Status +****************************************************************************/ +#define WIOCGPWRMAN _IORU('w', 0x009, UINT32) + +/*************************************************************************** +* WIOCSPWRMAN - Set Power Management Status +****************************************************************************/ +#define DOT11_PWRMAN_ENABLED TRUE +#define DOT11_PWRMAN_DISABLED FALSE + +#define WIOCSPWRMAN _IOU('w', 0x00a) + +/*************************************************************************** +* WIOCGCOMMQUAL - Get Communications Quality +****************************************************************************/ +#define WIOCGCOMMQUAL _IORU('w', 0x00b, UINT32) + +/*************************************************************************** +* WIOCGCARDTYPE - Get Card Type +****************************************************************************/ +#define WIOCGCARDTYPE _IORU('w', 0x00c, UINT32) + +/*************************************************************************** +* WIOCGCHANNEL - Get Channel +****************************************************************************/ +#define WIOCGCHANNEL _IORU('w', 0x00d, UINT32) + +/*************************************************************************** +* WIOCSCHANNEL - Set Channel +****************************************************************************/ +#define WIOCSCHANNEL _IOU('w', 0x00e) + +/*************************************************************************** +* WIOCGWEPAVAIL - Get WEP Availability +****************************************************************************/ +#define WIOCGWEPAVAIL _IORU('w', 0x00f, UINT32) + +/*************************************************************************** +* WIOCSWEPKEY0 - Set value for WEP KEY 0 +****************************************************************************/ +#define WIOCSWEPKEY0 _IOWU('w', 0x010, DOT11_KEY) + +/*************************************************************************** +* WIOCSWEPKEY1 - Set value for WEP KEY 1 +****************************************************************************/ +#define WIOCSWEPKEY1 _IOWU('w', 0x011, DOT11_KEY) + +/*************************************************************************** +* WIOCSWEPKEY2 - Set value for WEP KEY 2 +****************************************************************************/ +#define WIOCSWEPKEY2 _IOWU('w', 0x012, DOT11_KEY) + +/*************************************************************************** +* WIOCSWEPKEY3 - Set value for WEP KEY 3 +****************************************************************************/ +#define WIOCSWEPKEY3 _IOWU('w', 0x013, DOT11_KEY) + +/*************************************************************************** +* WIOCSWEPDEFAULTKEY - Set WEP default key +****************************************************************************/ +#define WIOCSWEPDEFAULTKEY _IOU('w', 0x014) + +/*************************************************************************** +* WIOCGENCRYPTTYPE - Get current encryption type +****************************************************************************/ +#define WIOCGENCRYPTTYPE _IORU('w', 0x015, UINT32) + +/*************************************************************************** +* WIOCSENCRYPTTYPE - Set current encryption type +****************************************************************************/ +typedef enum + { + DOT11_ENCRYPT_NONE, + DOT11_ENCRYPT_WEP40, + DOT11_ENCRYPT_WEP104, + DOT11_ENCRYPT_MAX /* Number of entries in enumeration */ + } DOT11_ENCRYPT_TYPE; + +#define WIOCSENCRYPTTYPE _IOU('w', 0x016) + +/*************************************************************************** +* WIOCAACLSTA - Add a STA to AP authentication list +****************************************************************************/ +#define WIOCAACLSTA _IOWU('w', 0x017, DOT11_ADDR) + +/*************************************************************************** +* WIOCDACLSTA - Delete a STA from AP auth list +****************************************************************************/ +#define WIOCDACLSTA _IOWU('w', 0x018, DOT11_ADDR) + +/*************************************************************************** +* WIOCSEXUNENCRYPT - Set exclude unencrypted +****************************************************************************/ +typedef enum + { + DOT11_EX_UNENCRYPTED, /* Exclude all unencrypted packets */ + DOT11_EX_DOT1X, /* Exclude all unencrypted packets except EAPOL */ + DOT11_EX_NONE /* Allow unencrypted and encrypted traffic */ + } DOT11_EX_POLICY; + +#define WIOCSEXUNENCRYPT _IOU('w', 0x019) + +/*************************************************************************** +* WIOCGEXUNENCRYPT - Get exclude unencrypted +****************************************************************************/ +#define WIOCGEXUNENCRYPT _IORU('w', 0x01a, UINT32) + +/*************************************************************************** +* WIOCGAUTHTYPE - Get Authentication protocol UINT32 * +****************************************************************************/ +#define DOT11_AUTHTYPE_OPEN 1 /* Open system authentication */ +#define DOT11_AUTHTYPE_SKA 2 /* Shared key authentication */ +#define DOT11_AUTHTYPE_ALL 3 /* Allow all available authentication type */ +#define WIOCGAUTHTYPE _IORU('w', 0x01b, UINT32) + +/*************************************************************************** +* WIOCSAUTHTYPE - Set Authentication protocol UINT32 +****************************************************************************/ +#define WIOCSAUTHTYPE _IOU('w', 0x01c) + +/*************************************************************************** +* WIOCSBEACONRATE - Set rate for AP beaconing UINT32 +****************************************************************************/ +#define WIOCSBEACONRATE _IOU('w', 0x01e) + +/*************************************************************************** +* WIOCGBEACONRATE - Get rate for AP beaconing UINT32 * +****************************************************************************/ +#define WIOCGBEACONRATE _IORU('w', 0x01f, UINT32) + +/*************************************************************************** +* WIOCGMAC - Get MAC address UNIT32 * +****************************************************************************/ +#define WIOCGMAC _IORU('w', 0x020, DOT11_ADDR) + +/*************************************************************************** +* WIOCSCTSRTS - Set CTS/RTS UINT32 +****************************************************************************/ +#define DOT11_CTSRTS_MAX 2307 +#define WIOCSCTSRTS _IOU('w', 0x021) + +/*************************************************************************** +* WIOCGCTSRTS - Get CTS/RTS UINT32 * +****************************************************************************/ +#define WIOCGCTSRTS _IORU('w', 0x022, UINT32) + +/*************************************************************************** +* WIOCSSHORTRETRY - Set Short Retry Limit +****************************************************************************/ +#define WIOCSSHORTRETRY _IOU('w', 0x023) + +/*************************************************************************** +* WIOCGSHORTRETRY - Get Short Retry Limit +****************************************************************************/ +#define WIOCGSHORTRETRY _IORU('w', 0x024, UINT32) + +/*************************************************************************** +* WIOCSLONGRETRY - Set Long Retry Limit +****************************************************************************/ +#define WIOCSLONGRETRY _IOU('w', 0x025) + +/*************************************************************************** +* WIOCGLONGRETRY - Get Long Retry Limit +****************************************************************************/ +#define WIOCGLONGRETRY _IORU('w', 0x026, UINT32) + +/*************************************************************************** +* WIOCSFRAGTHRESH - Set Fragmentation threshold UINT32 +****************************************************************************/ +#define WIOCSFRAGTHRESH _IOU('w', 0x027) + +/*************************************************************************** +* WIOCGFRAGTHRESH - Get Fragmentation threshold UINT32 * +****************************************************************************/ +#define WIOCGFRAGTHRESH _IORU('w', 0x028, UINT32) + +/*************************************************************************** +* WIOCSMAXTXLIFE - Set Max Transmit MSDU Life +****************************************************************************/ +#define WIOCSMAXTXLIFE _IOU('w', 0x029) + +/*************************************************************************** +* WIOCGMAXTXLIFE - Get Max Transmit MSDU Life +****************************************************************************/ +#define WIOCGMAXTXLIFE _IORU('w', 0x02a, UINT32) + +/*************************************************************************** +* WIOCSMAXRXLIFE - Set Max Receive Lifetime +****************************************************************************/ +#define WIOCSMAXRXLIFE _IOU('w', 0x02b) + +/*************************************************************************** +* WIOCGMAXRXLIFE - Get Max Receive Lifetime +****************************************************************************/ +#define WIOCGMAXRXLIFE _IORU('w', 0x02c, UINT32) + +/*************************************************************************** +* WIOCSPREAMBLE - Set preamble length UINT32 +****************************************************************************/ +#define WIOCSPREAMBLE _IOU('w', 0x02d) + +/*************************************************************************** +* WIOCGPREAMBLE - Get preamble length UINT32 * +****************************************************************************/ +#define WIOCGPREAMBLE _IORU('w', 0x02e, UINT32) + +/*************************************************************************** +* WIOCSAUTHRESPTO - Set Authentication response timeout UINT32 +****************************************************************************/ +#define WIOCSAUTHRESPTO _IOU('w', 0x02f) + +/*************************************************************************** +* WIOCGAUTHRESPTO - Get Authentication response timeout UINT32 * +****************************************************************************/ +#define WIOCGAUTHRESPTO _IORU('w', 0x030, UINT32) + +/* WIOCSUNICASTKEYNUM, WIOCGUNICASTKEYNUM, WIOCSMULTICASTKEYNUM, +WIOCGMULTICASTKEYNUM are all invalid IOCTLs as of the 2.2 version. */ + +/*************************************************************************** +* WIOCSADVSECURITY - Set advanced security options UINT32 +****************************************************************************/ +#define DOT11_ADVSEC_HIDE_SSID _BIT(0) +#define DOT11_ADVSEC_BLOCK_BCAST_SSID _BIT(1) + +#define WIOCSADVSECURITY _IOU('w', 0x035) + +/*************************************************************************** +* WIOCGADVSECURITY - Get advanced security options UINT32 * +****************************************************************************/ +#define WIOCGADVSECURITY _IORU('w', 0x036, UINT32) + +/*************************************************************************** +* WIOCSOCCUPANCY - Set Medium Occupancy Limit +****************************************************************************/ +#define WIOCSOCCUPANCY _IOU('w', 0x037) + +/*************************************************************************** +* WIOCGOCCUPANCY - Get Medium Occupancy Limit +****************************************************************************/ +#define WIOCGOCCUPANCY _IORU('w', 0x038, UINT32) + +/*************************************************************************** +* WIOCGCFPPOLL - Get CFP Pollable UNIT 32 * +****************************************************************************/ +#define WIOCGCFPPOLL _IORU('w', 0x039, UINT32) + +/*************************************************************************** +* WIOCSCFPPERIOD - Set CFP Period +****************************************************************************/ +#define WIOCSCFPPERIOD _IOU('w', 0x03a) + +/*************************************************************************** +* WIOCGCFPPERIOD - Get CFP Period +****************************************************************************/ +#define WIOCGCFPPERIOD _IORU('w', 0x03b, UINT32) + +/*************************************************************************** +* WIOCSCFPMAX - Set CFP Max Duration +****************************************************************************/ +#define WIOCSCFPMAX _IOU('w', 0x03c) + +/*************************************************************************** +* WIOCGCFPMAX - Get CFP Max duration +****************************************************************************/ +#define WIOCGCFPMAX _IORU('w', 0x03d, UINT32) + +/*************************************************************************** +* WIOCSDTIMRATE - Set DTIM rate +****************************************************************************/ +#define WIOCSDTIMRATE _IOU('w', 0x03e) + +/*************************************************************************** +* WIOCGDTIMRATE - Get DTIM rate +****************************************************************************/ +#define WIOCGDTIMRATE _IORU('w', 0x03f, UINT32) + +/*************************************************************************** +* WIOCGSUPPTXRATE - Get Supported Tx rates +****************************************************************************/ +#define WIOCGSUPPTXRATE _IORU('w', 0x040, DOT11_RATES) + +/*************************************************************************** +* WIOCGSUPPRXRATE - Get Supported Rx Rates +****************************************************************************/ +#define WIOCGSUPPRXRATE _IORU('w', 0x041, DOT11_RATES) + +/*************************************************************************** +* WIOCSASSOCRESPTIME - Set association response timeout +****************************************************************************/ +#define WIOCSASSOCRESPTIME _IOU('w', 0x042) + +/*************************************************************************** +* WIOCGASSOCRESPTIME - Get association response timeout +****************************************************************************/ +#define WIOCGASSOCRESPTIME _IORU('w', 0x043, UINT32) + +/*************************************************************************** +* WIOCSBCASTRATE - Set Transmit Speed (Multi & broad) | UINT32 +****************************************************************************/ +#define WIOCSBCASTRATE _IOU('w', 0x044) + +/*************************************************************************** +* WIOCGBCASTRATE - Get Transmit Speed (Multi & broad) | UINT32 +****************************************************************************/ +#define WIOCGBCASTRATE _IORU('w', 0x045, UINT32) + +/*************************************************************************** +* WIOCSRADIOMODE - Set Radio Mode (allowed freqs) | UINT32 +****************************************************************************/ +#define DOT11_RADIO_NONE 0 +#define DOT11_RADIO_11a _BIT(0) +#define DOT11_RADIO_11b _BIT(1) +#define DOT11_RADIO_11g _BIT(2) +#define DOT11_RADIO_TURBOg _BIT(3) +#define DOT11_RADIO_TURBOa _BIT(4) +#define DOT11_RADIO_ANY 0x1f + +#define WIOCSRADIOMODE _IOU('w', 0x046) + +/*************************************************************************** +* WIOCGRADIOMODE - Get Radio Mode (allowed freqs) | UINT32 * +****************************************************************************/ +#define WIOCGRADIOMODE _IORU('w', 0x047, UINT32) + +/*************************************************************************** +* WIOCSDOT11MODE - Set Dot11 Mode (SME mode) | UINT32 +****************************************************************************/ +#define DOT11_MODE_NONE 0 +#define DOT11_MODE_ESS 1 +#define DOT11_MODE_IBSS 2 +#define DOT11_MODE_AP 3 + +#define WIOCSDOT11MODE _IOU('w', 0x048) + +/*************************************************************************** +* WIOCGDOT11MODE - Get Dot11 Mode (SME mode) | UINT32 * +****************************************************************************/ +#define WIOCGDOT11MODE _IORU('w', 0x049, UINT32) + +/*************************************************************************** +* WIOCSACLMODE - Set the Access Control List Mode | UINT32 +****************************************************************************/ +#define DOT11_ACL_DISABLED 0 +#define DOT11_ACL_ALLOW 1 +#define DOT11_ACL_DENY 2 + +#define WIOCSACLMODE _IOU('w', 0x04a) + +/*************************************************************************** +* WIOCGACLMODE - Set the Access Control List Mode | UINT32 +****************************************************************************/ +#define WIOCGACLMODE _IORU('w', 0x04b, UINT32) + +/*************************************************************************** +* WIOCGWEPDEFAULTKEY - Set WEP default key UINT32 +****************************************************************************/ +#define WIOCGWEPDEFAULTKEY _IORU('w', 0x04c, UINT32) + +/*************************************************************************** +* WIOCSDESIREDSSID - Set Wireless Network Name char * +****************************************************************************/ +#define WIOCSDESIREDSSID _IOWU('w', 0x04d, DOT11_SSID) + +/*************************************************************************** +* WIOCUNSUPPORTED - Used to force an ERROR code from the IOCTL +****************************************************************************/ +#define WIOCUNSUPPORTED _IOU('w', 0x04e) + +/*************************************************************************** +* WIOCAPAIRWISEKEY - Adds a pairwise key and returns the keyslot in the passed structure +****************************************************************************/ +#define WIOCAPAIRWISEKEY _IOWU('w', 0x04f, DOT11_KEY) + +/*************************************************************************** +* WIOCSSECPOL - Set the available security policies +****************************************************************************/ +#define DOT11_SECPOL_NONE 0 +#define DOT11_SECPOL_TSN _BIT(0) +#define DOT11_SECPOL_WPA _BIT(1) +#define DOT11_SECPOL_11i _BIT(2) + +#define WIOCSSECPOL _IOU('w', 0x050) + +/*************************************************************************** +* WIOCGSECPOL - Gt the available security policies +****************************************************************************/ +#define WIOCGSECPOL _IORU('w', 0x051, UINT32) + +/*************************************************************************** +* WIOCSAUTHPOL - Set the available authentication policies +****************************************************************************/ +#define DOT11_AUTHPOL_NONE 0 +#define DOT11_AUTHPOL_8021X _BIT(0) +#define DOT11_AUTHPOL_PSK _BIT(1) +#define DOT11_AUTHPOL_MAX (DOT11_AUTHPOL_PSK + 1) + +#define WIOCSAUTHPOL _IOU('w', 0x052) + +/*************************************************************************** +* WIOCGAUTHPOL - Get the available authentication policies +****************************************************************************/ +#define WIOCGAUTHPOL _IORU('w', 0x053, UINT32) + +/*************************************************************************** +* WIOCSCIPHPOL - Set the available cipher suites +****************************************************************************/ +#define DOT11_CIPHPOL_NONE 0 +#define DOT11_CIPHPOL_WEP40 _BIT(0) +#define DOT11_CIPHPOL_WEP104 _BIT(1) +#define DOT11_CIPHPOL_TKIP _BIT(2) +#define DOT11_CIPHPOL_AES _BIT(3) +#define DOT11_CIPHPOL_MAX (DOT11_CIPHPOL_AES + 1) + +#define WIOCSCIPHPOL _IOU('w', 0x054) + +/*************************************************************************** +* WIOCGCIPHPOL - Get the available cipher suites +****************************************************************************/ +#define WIOCGCIPHPOL _IORU('w', 0x055, UINT32) + +/*************************************************************************** +* WIOCSPSK - Set the pre-shared key +****************************************************************************/ +#define WIOCSPSK _IOWU('w', 0x56, DOT11_PSK) + +/*************************************************************************** +* WIOCSPASSPHRASE - Sets the pre-shared key using a passphrase +****************************************************************************/ +#define WIOCSPASSPHRASE _IOWU('w', 0x57, DOT11_PASSPHRASE) + +/*************************************************************************** +* WIOCBSSSCAN - Performs a BSS scan and waits for the results +****************************************************************************/ + +typedef struct + { + /* SSID of the detected BSS. empty string if SSID is hidden. */ + char ssid[DOT11_SSID_LEN + 1]; + + /* 802.11 capabilities field. See DOT11_CAP_... macros */ + UINT16 capabilities; + DOT11_RATES rates; + UINT16 beaconInterval; + int channel; + UINT8 ssi; + } DOT11_SCAN_RESULTS; + +typedef struct + { + /* The SSID to search for */ + char ssid[DOT11_SSID_LEN + 1]; + + /* The number of entries in the pre-allocated array */ + int maxResults; + + /* The pointer to the pre-allocated array in which to put the results */ + DOT11_SCAN_RESULTS * pResults; + + /* After WIOCBSSCAN is called, the number of results placed in the array */ + int numResults; + + } DOT11_SCAN_REQ; + +#define WIOCBSSSCAN _IOWRU('w', 0x058, DOT11_SCAN_REQ) + +/*************************************************************************** +* WIOCSCOUNTRYCODE - Sets the current country code +****************************************************************************/ +#define WIOCSCOUNTRYCODE _IOU('w', 0x059) + +/*************************************************************************** +* WIOCGCOUNTRYCODE - Returns the current country code +****************************************************************************/ +#define WIOCGCOUNTRYCODE _IORU('w', 0x5a, UINT32) + +/*************************************************************************** +* WIOCS80211D - Enable 802.11d support +****************************************************************************/ +#define WIOCS80211D _IOU('w', 0x5b) + +/*************************************************************************** +* WIOCG80211D - Returns current status of 802.11d +****************************************************************************/ +#define WIOCG80211D _IORU('w', 0x5c, UINT32) + +#define WIOCSBULK _IOU('w', 0x5d) + +/*************************************************************************** +*WIOCGHWVERS - Returns hardware information string +****************************************************************************/ +#define WIOCGHWVERS _IORU('w', 0x5e, DOT11_HWVERS_BUF) + +/*************************************************************************** +* WIOCGTXPOWERSCALE - Gets the current tx power scaling factor +****************************************************************************/ +#define WIOCGTXPOWERSCALE _IORU('w', 0x5f, UINT32) + +/*************************************************************************** +* WIOCSTXPOWERSCALE - Sets the current tx power scaling factor +****************************************************************************/ +#define DOT11_TXPOWER_MAX 0 +#define DOT11_TXPOWER_66 1 +#define DOT11_TXPOWER_50 2 +#define DOT11_TXPOWER_33 3 +#define DOT11_TXPOWER_MIN 4 + +#define WIOCSTXPOWERSCALE _IOU('w', 0x60) + +/*************************************************************************** +* WIOCSUSERAUTHCALLBACK - Sets the current user authentication callback +****************************************************************************/ +#define DOT11_CALLBACK_CONNECT (1) /* Callback called due to association*/ +#define DOT11_CALLBACK_DISCONNECT (2) /* Callback called due to disassociation*/ + +#define WIOCSUSERAUTHCALLBACK _IOW('w', 0x61, FUNCPTR) + +/*************************************************************************** +* WIOCDPAIRWISEKEY - Removes a WEP key mapping key added by WIOCAPAIRWISEKEY +****************************************************************************/ +#define WIOCDPAIRWISEKEY _IOWU('w', 0x62, DOT11_ADDR) + + +/*************************************************************************** +* WIOCGCHANNELLIST - Returns a list of the channels supported by the current +* country code. +****************************************************************************/ + +/* The maximum number of channels in a channel list */ +#define DOT11_MAX_CHANNELS 64 + +typedef struct + { + int channel; + int freq; + UINT32 mode; + BOOL activeScanAllowed; + } DOT11_CHANNEL_INFO; + +typedef struct + { + int numChannels; + DOT11_CHANNEL_INFO channels[DOT11_MAX_CHANNELS]; + } DOT11_CHANNEL_LIST; + +#define WIOCGCHANNELLIST _IOWRU('w', 0x63, DOT11_CHANNEL_LIST) + +/*************************************************************************** +* WIOCSSCANTYPE - Enables active and/or passive scanning for ESS/IBSS modes +****************************************************************************/ +/* Values for sme.scanType. One or both of these values can be set */ +#define DOT11_SCANTYPE_ACTIVE _BIT(0) +#define DOT11_SCANTYPE_PASSIVE _BIT(1) + +#define WIOCSSCANTYPE _IOU('w', 0x64) + +/*************************************************************************** +* WIOCGSCANTYPE - Returns current scan types in use. +****************************************************************************/ +#define WIOCGSCANTYPE _IORU('w', 0x64, UINT32) + + + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* __INCdot11UsrLibh */ diff --git a/h/drv/xbd/bio.h b/h/drv/xbd/bio.h new file mode 100644 index 0000000..8a8eef0 --- /dev/null +++ b/h/drv/xbd/bio.h @@ -0,0 +1,50 @@ +/* bio.h - Block I/O Transaction Header File */ + +/* Copyright 2004 Wind River Systems, Inc */ + +/* +modification history +-------------------- +01d,07mar05,rfr Added NULLSECTOR constant +01c,10feb05,rfr Added bio_alloc and bio_free. +01b,10feb05,rfr Changed block_t to sector_t +01a,03feb05,rfr Added global initialization function. +*/ + +#ifndef __INCbioh +#define __INCbioh + + +#include + +typedef long long sector_t; /* a block index */ + +#define NULLSECTOR -1L + +#define BIO_READ 0x0001 +#define BIO_WRITE 0x0002 + +struct xbd; + +struct bio { + device_t bio_dev; /* The allocator of this bio */ + sector_t bio_blkno; /* The Block Number of this bio */ + unsigned bio_bcount; /* Total number of bytes in this segment */ + void *bio_data; /* bio_bcount bytes of data */ + unsigned bio_resid; /* Residual count for this segment */ + unsigned bio_error; /* Error code for this segment */ + unsigned bio_flags; /* Flags. At least BIO_READ and BIO_WRITE */ + void (*bio_done)(struct bio *); /* Completion function for this segment */ + void *bio_caller1; /* Caller supplied data */ + struct bio *bio_chain; /* The next segment or NULL */ +}; + + +STATUS bioInit(); + +void bio_done(struct bio *, int); + +void *bio_alloc(device_t, int); +void bio_free(void *); + +#endif diff --git a/h/drv/xbd/xbd.h b/h/drv/xbd/xbd.h new file mode 100644 index 0000000..483da01 --- /dev/null +++ b/h/drv/xbd/xbd.h @@ -0,0 +1,103 @@ +/* xbd.h - Extended Block Device Header File */ + +/* + * Copyright (c) 2004-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01m,25aug05,pcm added XBD_STACK_COMPLETE ioctl and xbdEventInstantiated +01l,12aug05,rfr Added media changed event +01k,08aug05,rfr Added XBD_TEST ioctl command +01j,01jul05,rfr Added XBD_GETBASENAME ioctl() command +01i,24jun05,rfr Added total block count to struct xbd_geometry +01h,24jun05,rfr Fixed name collision in XBD_GEOMETRY +01g,23may05,rfr Added ioctl commands +01f,14apr05,rfr Added event and category types +01e,25mar05,rfr Adapting to the new device.h +01d,10feb05,rfr Changed block_t to sector_t +01c,04feb05,rfr Added initialization function. +01b,03feb05,pcm formatting changes +*/ + +#ifndef __INCxbdh +#define __INCxbdh + +/* includes */ +#include "vxWorks.h" + +#include +#include + + +extern UINT16 xbdEventCategory; +extern UINT16 xbdEventPrimaryInsert; +extern UINT16 xbdEventRemove; +extern UINT16 xbdEventSecondaryInsert; +extern UINT16 xbdEventSoftInsert; +extern UINT16 xbdEventMediaChanged; +extern UINT16 xbdEventInstantiated; + +struct xbd; + +struct xbd_funcs + { + int (*xf_ioctl) (struct xbd * dev, int cmd, void * arg); + int (*xf_strategy) (struct xbd * dev, struct bio * bio); + int (*xf_dump) (struct xbd * dev, sector_t pos, void * data, size_t size); + }; + +/* typedefs */ + +typedef struct xbd + { + struct device xbd_dev; + struct xbd_funcs * xbd_funcs; + unsigned xbd_blocksize; + sector_t xbd_nblocks; + } XBD, * XBD_ID; + +typedef struct xbd_geometry + { + unsigned heads; + unsigned long long cylinders; + unsigned secs_per_track; + sector_t total_blocks; + unsigned blocksize; + } XBD_GEOMETRY; + +typedef enum xbd_level {XBD_TOP=0, XBD_PART=1, XBD_BASE=2} XBD_LEVEL; + + +STATUS xbdInit(); + +int xbdAttach (XBD * xbd, struct xbd_funcs * funcs, const char * name, + unsigned blocksize, sector_t nblocks, device_t * result); +void xbdDetach (XBD * xbd); + +/* These functions access the driver */ + +int xbdIoctl (device_t d, int cmd, void * arg); +int xbdStrategy (device_t d, struct bio * bio); +int xbdDump (device_t d, sector_t pos, void * data, size_t size); +int xbdSize (device_t d, long long * result); + +int xbdNBlocks (device_t d, sector_t * result); +int xbdBlockSize (device_t d, unsigned * result); + +/* ioctl commands */ + +#define XBD_GETGEOMETRY 0xbd000001 /* Extract disk Geometry */ +#define XBD_SYNC 0xbd000002 /* Flush Block device */ +#define XBD_SOFT_EJECT 0xbd000003 /* Eject and raise SoftInsert */ +#define XBD_HARD_EJECT 0xbd000004 /* Eject and raise Insert */ +#define XBD_GETBASENAME 0xbd000005 /* Retrieve name of base XBD */ +#define XBD_TEST 0xbd000006 /* Request XBD test its validity */ +#define XBD_STACK_COMPLETE 0xbd000007 /* XBD stack is initialized */ + +#endif diff --git a/h/dsi/backend/dsiSockLib.h b/h/dsi/backend/dsiSockLib.h new file mode 100644 index 0000000..505fd7b --- /dev/null +++ b/h/dsi/backend/dsiSockLib.h @@ -0,0 +1,171 @@ +/* dsiSockLib.h - DSI sockets backend */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,10feb05,dlk Embed socket semaphores in struct socket, and remove + so_timeoSem and so_lingerSem. +01g,23sep04,bwa added dsiDomainAdd() prototype. +01f,19aug04,bwa added dsiDataPoolShow() and dsiSysPoolShow() prototypes. +01e,16aug04,bwa updated dsiPoolInit() prototype. +01d,11jun04,ymz removed compiler warning +01c,31may04,bwa added DSI_PKT_SZ and DSI_SB_ALLOC macro. +01b,12may04,bwa modified dsiPoolInit() prototype's parameters list. +01a,18mar04,bwa written, copied from bsdSockLib.h +*/ + +#ifndef __INCdsiSockLibh +#define __INCdsiSockLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include +#include +#include +#include +#include +#include +#include + +/* DSI buffer pools */ + +extern NET_POOL_ID _pDsiDpool; +extern NET_POOL_ID _pDsiSysPool; + +/* allocation of clusters for address holders and PCBs */ + +#define DSI_SO_ALLOC(ds) (void *) netClusterGet(_pDsiSysPool, \ + netClPoolIdGet(_pDsiSysPool, (sizeof(ds)), TRUE)) +#define DSI_PCB_ALLOC(ds) DSI_SO_ALLOC(ds) +#define DSI_ADDR_ALLOC(ds) DSI_SO_ALLOC(ds) + +#define DSI_SO_FREE(x) netClFree (_pDsiSysPool, (UCHAR *)(x)) +#define DSI_PCB_FREE(x) DSI_SO_FREE(x) +#define DSI_ADDR_FREE(x) DSI_SO_FREE(x) + +/* wrapper macros */ + +#define DSI_SB_LOCK(sb, wf) ((sb)->sb_flags & SB_LOCK ? \ + (((wf) == M_WAITOK) ? dsiSbLock(sb) : EWOULDBLOCK) : \ + (((sb)->sb_flags |= SB_LOCK), 0)) + +/* release lock on sockbuf sb */ +#define DSI_SB_UNLOCK(sb) { \ + (sb)->sb_flags &= ~SB_LOCK; \ + if ((sb)->sb_flags & SB_WANT) { \ + (sb)->sb_flags &= ~SB_WANT; \ + wakeup (&(sb)->sb_Sem); \ + } \ +} + +#define DSI_SO_R_WAKEUP(so) \ + do \ + { \ + if (sb_notify(&(so)->so_rcv)) \ + dsiSbWakeup((so), &(so)->so_rcv, SELREAD); \ + } while ((0)) + +#define DSI_SO_W_WAKEUP(so) \ + do { \ + if (sb_notify(&(so)->so_snd)) \ + dsiSbWakeup((so), &(so)->so_snd, SELWRITE); \ + } while ((0)) + +/* + * DSI_PKT_SZ - compute the size and cnt of a DSI packet + * + * void DSI_PKT_SZ + * ( + * mbuf * pMbuf, /# the packet in mbuf form #/ + * int sz, /# return value: packet size #/ + * int cnt /# return value: cluster count #/ + * ) + */ + +#define DSI_PKT_SZ(pMbuf, sz, cnt) \ + do \ + { \ + struct mbuf * DSI_PKT_SZ_pCur = (pMbuf); \ + while (DSI_PKT_SZ_pCur != NULL) \ + { \ + sz += DSI_PKT_SZ_pCur->m_len; \ + cnt += MSIZE; \ + if (DSI_PKT_SZ_pCur->m_flags & M_EXT) \ + cnt += DSI_PKT_SZ_pCur->m_extSize; \ + DSI_PKT_SZ_pCur = DSI_PKT_SZ_pCur->m_next; \ + } \ + } \ + while ((0)) + +#define DSI_SB_ALLOC(pSb, sz, cnt) \ + do \ + { \ + (pSb)->sb_cc += sz; \ + (pSb)->sb_mbcnt += cnt; \ + } \ + while ((0)) + +/* function declarations */ + +extern STATUS dsiDomainAdd (struct domain * pDomain); +extern SOCK_FUNC *dsiSockLibInit (void); +extern void dsiSysPoolShow (void); +extern void dsiDataPoolShow (void); +extern STATUS dsiPoolInit (NET_POOL_CONFIG_PARAMS * pPools); +extern STATUS dsiConnect (struct socket *so, struct sockaddr *name, int namelen); +extern STATUS dsiConnectWithTimeout (struct socket *so, struct sockaddr *adrs, + int adrsLen, struct timeval *timeVal); +extern STATUS dsiGetpeername (struct socket *so, struct sockaddr *name, int *namelen); +extern STATUS dsiGetsockname (struct socket *so, struct sockaddr *name, int *namelen); +extern STATUS dsiGetsockopt (struct socket *so, int level, int optname, char *optval, + int *optlen); +extern STATUS dsiSetsockopt (struct socket *so, int level, int optname, char *optval, + int optlen); +extern STATUS dsiShutdown (struct socket *so, int how); +extern int dsiAccept (struct socket **pSo, struct sockaddr *addr, int *addrlen); +extern int dsiRecv (struct socket *so, char *buf, int bufLen, int flags); +extern int dsiRecvfrom (struct socket *so, char *buf, int bufLen, int flags, + struct sockaddr *from, int *pFromLen); +extern int dsiRecvmsg (struct socket *so, struct msghdr *mp, int flags); +extern int dsiSend (struct socket *so, char *buf, int bufLen, int flags); +extern int dsiSendmsg (struct socket *so, struct msghdr *mp, int flags); +extern int dsiSendto (struct socket *so, caddr_t buf, int bufLen, int flags, + struct sockaddr *to, int tolen); +extern STATUS dsiZbufSockRtn (void); +extern struct socket * dsiSoAlloc (void); +extern struct socket * dsiSoNewConn3 (struct socket * head, int connstatus, + struct proc * p); +extern int dsiSoCreate (int dom, struct socket ** aso, int type, + int proto, struct proc * p); + +extern void dsiSoFree(struct socket * so); +extern int dsiSoClose(struct socket * so); +extern int dsiSoAbort(struct socket * so); +extern void dsiSoIsConnected (struct socket *so); +extern void dsiSoIsDisconnected (struct socket *so); +extern void dsiSoCantSendMore (struct socket *so); +extern void dsiSoCantRcvMore (struct socket *so); +extern int dsiSbLock (struct sockbuf *sb); +extern void dsiSbWakeup (struct socket *so, struct sockbuf *sb, + SELECT_TYPE wakeupType); +extern int dsiControlNotSupp (struct socket *so, u_long cmd, caddr_t data, + struct ifnet *ifp, struct proc *p); +extern int dsiRcvoobNotSupp (struct socket *so, struct mbuf *m, int flags); +extern int dsiSenseNull (struct socket *so, struct stat *sb); +int dsiSoReserve (struct socket *so, u_long sndcc, u_long rcvcc); +int dsiSbReserve (struct sockbuf *sb, u_long cc, struct socket *so, + struct proc *p); +extern int dsiSbWait (struct sockbuf *sb); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdsisocklibh */ + diff --git a/h/dsi/backend/dsiUtilLib.h b/h/dsi/backend/dsiUtilLib.h new file mode 100644 index 0000000..41c0916 --- /dev/null +++ b/h/dsi/backend/dsiUtilLib.h @@ -0,0 +1,32 @@ +/* dsiUtilLib.h - DSI stack utilities header */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,17aug04,dlk written. +*/ + +#ifndef __INCdsiUtilLibh +#define __INCdsiUtilLibh + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern STATUS dsiLockInit (void); +extern int dsiLock (void); +extern void dsiUnlock (int); + +extern STATUS dsiTsleep (SEM_ID semId, int timeo_val); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdsiUtilLibh */ + diff --git a/h/dsi/private/salClientP.h b/h/dsi/private/salClientP.h new file mode 100644 index 0000000..0c2dc6b --- /dev/null +++ b/h/dsi/private/salClientP.h @@ -0,0 +1,43 @@ +/* salClientP.h - socket application library client private header file */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,16feb05,ebh rename sockopt struct to salSockopt (it conflicts with + target/h/wrn/coreip/net/socketvar.h) +01d,19may04,ymz coding convention alignment. +01c,08apr04,ymz code review changes. +01b,23feb04,ymz changed salClient to socket fd. +01a,26nov03,als created. +*/ + +#ifndef __INCsalClientPh +#define __INCsalClientPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "dsi/salClient.h" +#include "dsi/private/salCommonP.h" + +/* function declarations */ + +extern int salSnsClientCreate (void); +extern STATUS salSnsClientDelete (int sockfd); +extern STATUS salSnsClientReplyCheck (int actualSize, int expectedSize); +extern int salAttach (struct addrinfo * pSockInfoList, + struct salSockopt * pSockOptions, int numOptions); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsalClientPh */ + + + diff --git a/h/dsi/private/salCommonP.h b/h/dsi/private/salCommonP.h new file mode 100644 index 0000000..d93eddb --- /dev/null +++ b/h/dsi/private/salCommonP.h @@ -0,0 +1,94 @@ +/* salCommonP.h - socket application library common private header file */ + +/* Copyright 2003 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,26may04,ymz updated debugging info due to file merging. +01f,06may04,ymz fixed salEvtRtn build error for wvLib.c. +01e,29apr04,ymz added salEvtRtn definition. +01d,20feb04,ymz code review changes +01c,05dec03,als add debugging code support to RTP space +01b,03dec03,als restrict debugging code to kernel space only +01a,26nov03,als created +*/ + +#ifndef __INCsalCommonPh +#define __INCsalCommonPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "dsi/salCommon.h" + +/* defines */ + +#ifdef _WRS_KERNEL +/* uncomment the following line to include SAL debugging code in kernel apps */ +/* #define SAL_DEBUG_ON */ +#else +/* uncomment the following line to include SAL debugging code in RTP apps */ +/* #define SAL_DEBUG_ON */ +#endif + +#ifdef SAL_DEBUG_ON /* define SAL debugging tools */ + +#ifdef _WRS_KERNEL +/* use logMsg() to display debugging messages in kernel apps */ +#include "logLib.h" +#else +/* logMsg() isn't available to RTP apps, so use printf() instead */ +#include "stdio.h" +#define logMsg printf +#endif + +/* output levels used for SAL debugging, in order of decreasing importance +*/ +#define SAL_DEBUG_NONE 0 /* disable debug output */ +#define SAL_DEBUG_SEVERE 1 /* for an unexpected error path */ +#define SAL_DEBUG_ERROR 3 /* for an expected error path */ +#define SAL_DEBUG_SUCCESS 5 /* for a success path */ +#define SAL_DEBUG_CONTROL 7 /* for a change in control */ +#define SAL_DEBUG_ALL 9 /* for super-detailed info */ + +/* define the current debug level */ + +#define SAL_DEBUG_LEVEL SAL_DEBUG_NONE + +/* macro that prints out debugging info using logMsg + - level: minimum debug level required to activate output + - format: printf-style format string + - value: single numeric value that can be referenced by "format" + macro automatically includes the name of the invoking function +*/ +#define SAL_DEBUG(level, format, value) \ + if (SAL_DEBUG_LEVEL >= (level)) \ + { logMsg ("%s: " format "\n", \ + (int)__FUNCTION__, (int)value, 0, 0, 0, 0); } \ + else \ + { /* prevent accidental mismatch with nested if's */ } + +/* current debugging level used for SAL debugging; + the higher the value, the more output is shown +*/ + +#else /* alternate SAL debugging tools (when no debugging is required) */ + +/* macro that prints out debugging info does nothing */ +#define SAL_DEBUG(level, format, value) + +#endif /* SAL_DEBUG_ON */ + +#ifdef __cplusplus +} +#endif + +extern VOIDFUNCPTR salEvtRtn; /* windview - level 1 event logging */ + /* defined in funcBind.c */ + +#endif /* __INCsalCommonPh */ + diff --git a/h/dsi/private/salServerP.h b/h/dsi/private/salServerP.h new file mode 100644 index 0000000..d903ef3 --- /dev/null +++ b/h/dsi/private/salServerP.h @@ -0,0 +1,64 @@ +/* salServerP.h - socket application library server private header file */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,10jun04,ymz made salRegister and salUnregister private. +01b,01mar04,ymz code review changes +01a,26nov03,als created +*/ + +#ifndef __INCsalServerPh +#define __INCsalServerPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "dsi/salServer.h" +#include "dsi/private/salCommonP.h" + +/* defines */ + +/* number of backlog for SAL server listening */ + +#define SAL_LISTEN_BACKLOG 15 + +/* typedef */ + +/* SAL server handle */ + +typedef struct salServer /* socket application server */ + { + struct salServer * magic; /* structure integrity check */ + snsServDesc service; /* service descriptor */ + fd_set allSockets; /* all server sockets */ + fd_set readSockets; /* sockets used with read fn */ + int numSockets; /* # of server sockets */ + int maxSockfd; /* upper bound on server's fd's */ + SAL_SERV_RTN acceptFn; + /* accept processing routine */ + SAL_SERV_RTN readFn; + /* read processing routine */ + } SAL_SERVER; + +/* function declarations */ + +extern SAL_SERVER_ID salInit (void); +extern STATUS salTerm (SAL_SERVER_ID servId); +extern snsServDesc salRegister (const char * name, + struct addrinfo * pSockInfoList); +extern STATUS salDeregister (snsServDesc service); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsalServerPh */ + + + diff --git a/h/dsi/private/snsLibP.h b/h/dsi/private/snsLibP.h new file mode 100644 index 0000000..576ace9 --- /dev/null +++ b/h/dsi/private/snsLibP.h @@ -0,0 +1,390 @@ +/* snsLibP.h - Socket Name Service library private header file */ + +/* + * Copyright (c) 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01j,10may05,ebh update to use a single instance for distributed SAL + ensure all fields are 32-bit values for dsal messaging +01i,25apr05,ebh fix structure for distributed removal messages +01h,07mar05,ebh added sockaddr_max structure to the sns_register_reply struct + added distributed SAL define(s) +01g,01sep04,ymz added snsPatchMatch prototyping. +01f,19may04,ymz coding convention alignment. +01e,13apr04,ymz code review changes. +01d,30mar04,ymz added new messaging types. +01c,02mar04,ymz code review changes +01b,09feb04,ymz add RTP cleanup, and URL support. +01a,26nov03,als created. +*/ + +#ifndef __INCsnsLibPh +#define __INCsnsLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" +#include "netdb.h" +#include "dsi/snsLib.h" +#include "sys/un.h" + +/* defines */ + +/* socket address used by SNS server */ + +#define SNS_SERVER_PATH "/comp/socket/0x405" + +/* + * alias for the largest possible socket address structure + * (currently an AF_LOCAL-type socket address) + */ + +#define sockaddr_max sockaddr_un + +/* number of attempts connecting to the SNS server */ + +#define SNS_INIT_RETRY 12 + +/* retry internal in ticks */ + +#define SNS_INIT_TIMEOUT 10 + +/* wildcards characters */ + +#define SNS_WILDCARDS "*?" + +/* reserved characters not allowed as service name */ + +#define SNS_URL_RESERVES_FULL "*?@:#/<>%|[]{},\\ \'&;=+$" + +/* SNS_URL_RESERVES minus wildcards characters */ + +#define SNS_URL_RESERVES_LESS_WILDCARD "@:#/<>%|[]{},\\ \'&;=+$" + +/* define size of a service name plus text version of its scope */ + +#define SAL_SERV_NAME_SCOPE_MAXSIZE \ + (SAL_SERV_NAME_MAXSIZE+sizeof(SNS_SCOPE_LONGEST_ENTRY_STR)) + +/* Distributed SAL entries */ + +#define DSAL_SNS_DEFAULT_TYPE 51 /* default SAL TIPC type */ +#define DSAL_SNS_DEFAULT_INSTANCE 51 /* default SAL TIPC instance */ +#define DSAL_VERSION 0 /* version of DSAL, part of CMD */ +#define DSAL_REMOTE_NODE_ID ((RTP_ID)(-2)) /* indicate remote owner */ +#define DSAL_INVALID_SOCKFD (-1) /* sock fd that is not active */ +#define DSAL_NAMES_MSG_SIZE_MAX 1000 /* maximum msg payload size */ + +/* typedefs */ + +typedef struct /* distributed SAL message */ + { + UINT32 cmd; /* DSAL Command */ + char bytes[1]; /* empty */ + } DSAL_BASE_MSG; + +/* + * The contents of the DSAL_ADD_MSG are placed inside the DSAL_GENERIC_NAME_MSG + * and this structure is not used directly. + */ +typedef struct /* dSAL add one name message */ + { + UINT32 cmd; /* DSAL Command */ + UINT32 ai_flags; /* AI_PASSIVE, AI_CANONNAME, ... */ + UINT32 ai_family; /* AF_xxx */ + UINT32 ai_socktype; /* SOCK_xxx */ + UINT32 ai_protocol; /* sockProtocol */ + UINT32 scope; /* service scope */ + /* the following indented fields are fairly TIPC specific + * - other protocols may modify these and the receiver would have + * to base processing on the ai_family field above. */ + /* probably best to make the following a union when other protocols added */ + UINT32 ai_id_ref; /* TIPC port ID reference */ + UINT32 ai_id_node; /* TIPC port ID node */ + /* the name field was added to the end of this message so that the + * null terminator can be the terminator of the record. A subsequent + * record could then be appended directly starting with the first + * field after 'cmd'. */ + char name[SAL_SERV_NAME_SCOPE_MAXSIZE]; /* service name (4 byte padded)*/ + } DSAL_ADD_MSG; + +/* + * The structure of a message that is sent across the network. set up to + * be aligned to an integer. The structure is that of DSAL_ADD_MSG but + * potentially with the record (less the cmd field) portion repeated for + * each name to add. + */ +typedef struct /* dSAL add name(s) message */ + { + UINT32 spaceholder[DSAL_NAMES_MSG_SIZE_MAX/sizeof(UINT32) + 1]; + } DSAL_GENERIC_NAME_MSG; + +/* + * The sns_remove_msg structure is not used directly, but the removal message + * sent across the network uses the fields in this order and meaning when + * constructing and destructing the message. + */ +typedef struct /* dSAL remove name message */ + { + UINT32 cmd; /* DSAL Command */ + UINT32 scope; /* service scope of the entry */ + /* the following is fairly TIPC specific - other protocols may modify + * and the receiver will have to base everything on the ai_family above. */ + /* probably best to make the following a union when other protocols added */ + UINT32 ai_id_ref; /* TIPC port ID reference */ + UINT32 ai_id_node; /* TIPC port ID node */ + /* note that all fields above are 32-bit aligned if required */ + char name[SAL_SERV_NAME_MAXSIZE]; /* service name (4 byte padded) */ + } DSAL_REMOVE_MSG; + +typedef struct /* dSAL SNS server change message */ + { + UINT32 cmd; /* DSAL Command */ + UINT32 nodeId; /* node number of SNS server */ + UINT32 ref; /* socket ref of SNS server */ + } DSAL_SNS_MSG; + +typedef struct /* dSAL Get Names message */ + { + UINT32 cmd; /* DSAL Command */ + } DSAL_SNS_GET_NAMES_MSG; + + +typedef struct serv_sock /* service socked info */ + { + struct addrinfo sockInfo; /* info for first/next socket */ + struct sockaddr_max sockAddr; /* socket address */ + } SNS_SERV_SOCK; + +enum sns_cmd_value /* SNS message codes */ + { + SNS_CMD_NOOP = 0, + SNS_CMD_REGISTER = 1, /* register a service */ + SNS_CMD_REGCONT = 2, /* continue the registeration */ + SNS_CMD_DEREGISTER = 3, /* deregister */ + SNS_CMD_REMOVE = 4, /* SNS entry remove by name */ + SNS_CMD_FINDSERV = 5, /* find a service */ + SNS_CMD_GETSOCK = 6, /* get a service sock info */ + SNS_CMD_NEXTSERV = 7, /* find the next service */ + SNS_CMD_CLEANUP = 8, /* cleanup services of dead RTP */ + SNS_CMD_MAX + }; + +enum dsal_cmd_value /* DSAL message codes */ + { + DSAL_CMD_SNS_WITHDRAWN = 20, /* specified node has disappeared */ + DSAL_CMD_SNS_PUBLISHED = 21, /* specified node has appeared */ + DSAL_CMD_GET_NAMES = 22, /* request full database */ + DSAL_CMD_ADD_NAMES = 23, /* specified names are available */ + DSAL_CMD_REMOVE_NAMES = 24, /* specified names are removed */ + DSAL_CMD_MAX + }; + + /* SERVICE REGISTRATION MESSAGE STRUCTURES */ + +typedef struct sns_register_msg /* service registration message */ + { + uint8_t cmd; /* SNS_CMD_REGISTER */ + RTP_ID rtpId; /* RTP making request */ + int scope; /* scope (NONE forces decode) */ + char name[SAL_SERV_NAME_SCOPE_MAXSIZE]; /* service name or pattern */ + struct addrinfo sockInfo; /* first socket to register */ + struct sockaddr_max sockAddr; /* socket address */ + BOOL done; /* TRUE if no more to register */ + } SNS_REGISTER_MSG; + +typedef struct sns_register_reply /* service registration reply */ + { + snsServDesc service; /* service descriptor */ + int regErrno; /* registration result */ + } SNS_REGISTER_REPLY_MSG; + + /* CONTINUE SERVICE REGISTRATION MESSAGE STRUCTURES */ + +typedef struct sns_regcont_msg /* continue registration message */ + { + uint8_t cmd; /* SNS_CMD_REGCONT */ + RTP_ID rtpId; /* RTP making request */ + snsServDesc service; /* service descriptor */ + struct addrinfo sockInfo; /* next socket to register */ + struct sockaddr_max sockAddr; /* socket address */ + BOOL done; /* TRUE if no more to register */ + } SNS_REGCONT_MSG; + + /* note: uses the same reply as a service registration msg */ + + /* SERVICE DEREGISTRATION MESSAGE STRUCTURES */ + +typedef struct sns_deregister_msg /* service deregistration message */ + { + uint8_t cmd; /* SNS_CMD_DEREGISTER */ + RTP_ID rtpId; /* RTP making request */ + snsServDesc service; /* service descriptor */ + } SNS_DEREGISTER_MSG; + +typedef struct sns_deregister_reply /* service deregistration reply */ + { + int deregErrno; /* deregistration result */ + } SNS_DEREGISTER_REPLY_MSG; + + /* SERVICE REMOVAL BY NAME MESSAGE STRUCTURES */ + +typedef struct sns_remove_msg /* service remove message */ + { + uint8_t cmd; /* SNS_CMD_REMOVE */ + RTP_ID rtpId; /* RTP making the request */ + int scope; /* service scope of entry */ + char name[SAL_SERV_NAME_SCOPE_MAXSIZE]; /* service name or pattern */ + } SNS_REMOVE_MSG; + +typedef struct sns_remove_reply /* service remove reply */ + { + int removeErrno; /* deregistration result */ + } SNS_REMOVE_REPLY_MSG; + + /* FIND SERVICE MESSAGE STRUCTURES */ + +typedef struct sns_findserv_msg /* find service message */ + { + uint8_t cmd; /* SNS_CMD_FINDSERV */ + BOOL findSocket; /* TRUE for salSocketFind req */ + /* FALSE for salNameFind req */ + snsServDesc service; /* last matching addr */ + RTP_ID rtpId; /* RTP making request */ + char name[SAL_SERV_NAME_SCOPE_MAXSIZE]; /* service name or pattern */ + } SNS_FINDSERV_MSG; + + /* note: uses the same reply as a get socket info message */ + + /* GET SOCKET INFO MESSAGE STRUCTURES */ + +typedef struct sns_getsock_msg /* get socket info message */ + { + uint8_t cmd; /* SNS_CMD_GETSOCK */ + RTP_ID rtpId; /* RTP making request */ + snsServDesc service; /* service descriptor */ + int numSockets; /* # sockets already gotten */ + } SNS_GETSOCK_MSG; + + /* reply to sns_findserv_msg or sns_getsock_msg */ + +typedef struct sns_get_namesock_reply /* get name or socket reply */ + { + snsServDesc service; /* service descriptor */ + int getSockErrno; /* error # (if invalid service) */ + BOOL done; /* TRUE if no more info to get */ + union { /* server socket or name info */ + SNS_SERV_SOCK servSocketinfo; /* server socket info */ + char name[SAL_SERV_NAME_SCOPE_MAXSIZE]; /* service name or pattern */ + } serNameSockInfo; /* server socket or name info */ +#define serName serNameSockInfo.name +#define servSockInfo serNameSockInfo.servSocketinfo.sockInfo +#define servSockAddr serNameSockInfo.servSocketinfo.sockAddr + } SNS_GET_NAMESOCK_REPLY_MSG; + + /* GET NEXT SERVICE MESSAGE STRUCTURES */ + +typedef struct sns_nextserv_msg /* get next service message */ + { + uint8_t cmd; /* SNS_CMD_NEXTSERV */ + snsServDesc service; /* last known service */ + } SNS_NEXTSERV_MSG; + +typedef struct sns_nextserv_reply /* get next service reply */ + { + snsServDesc service; /* service descriptor */ + int nextServErrno; /* error # (if invalid service) */ + BOOL servAvail; /* service completely registered */ + RTP_ID servOwner; /* RTP that registered service */ + int servScope; /* service scope */ + char servName[SAL_SERV_NAME_SCOPE_MAXSIZE]; /* service name or pattern */ + } SNS_NEXTSERV_REPLY_MSG; + + /* RTP SERVICE CLEANUP MESSAGE STRUCTURES */ + +typedef struct sns_serv_cleanup + { + uint8_t cmd; /* SNS_CMD_CLEANUP */ + RTP_ID rtpId; /* rtp being deleted */ + } SNS_SERV_CLEANUP_MSG; + + /* GENERIC MESSAGE STRUCTURES */ + +union sns_msg /* summary of all SNS protocol messages */ + { + SNS_REGISTER_MSG reg_msg; + SNS_REGISTER_REPLY_MSG regreply_msg; + SNS_REGCONT_MSG regcont_msg; + SNS_DEREGISTER_MSG dereg_msg; + SNS_DEREGISTER_REPLY_MSG deregreply_msg; + SNS_REMOVE_MSG remove_msg; + SNS_REMOVE_REPLY_MSG remreply_msg; + SNS_FINDSERV_MSG findserv_msg; + SNS_GETSOCK_MSG getsock_msg; + SNS_GET_NAMESOCK_REPLY_MSG getnmsockreply_msg; + SNS_NEXTSERV_MSG nextserv_msg; + SNS_NEXTSERV_REPLY_MSG nextservreply_msg; + SNS_SERV_CLEANUP_MSG servcleanup_msg; + }; + +/* size of largest message used by SNS */ + +#define SNS_MSG_MAXSIZE sizeof (union sns_msg) + +struct sns_dsal_msg + { + union /* summary of all Distributed SAL messages */ + { + DSAL_BASE_MSG base_msg; + DSAL_SNS_MSG node_msg; + DSAL_SNS_GET_NAMES_MSG get_msg; + DSAL_ADD_MSG add_msg; + DSAL_REMOVE_MSG remove_msg; + } dsal; + }; + +/* size of largest message used by Distributed SAL */ + +#define DSAL_MSG_MAXSIZE sizeof (struct sns_dsal_msg) + +struct sns_max_msg /* largest possible SNS message */ + { + uint8_t cmd; /* command byte */ + char dummy[SNS_MSG_MAXSIZE-1]; /* space for rest of message */ + }; + + +struct sns_scope_info /* scope information structure */ + { + int value; /* numeric form of scope */ + char * exactScope; /* exact scope */ + char * uptoScope; /* text form of exact scope */ + char * displayScope; /* displayed text for snsShow */ + }; + +/* function declarations */ + +extern int snsPatMatch (const char * pat, const char * str); + +/* externs */ + +/* table used in converting text form of scope to numeric form */ + +extern const struct sns_scope_info snsScopeTbl[]; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsnsLibPh */ diff --git a/h/dsi/salClient.h b/h/dsi/salClient.h new file mode 100644 index 0000000..907e0fc --- /dev/null +++ b/h/dsi/salClient.h @@ -0,0 +1,47 @@ +/* salClient.h - socket application library client header file */ + +/* Copyright 2003 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,19may04,ymz modified for coding convention +01e,08apr04,ymz code review modifications. +01d,31mar04,ymz renamed salFind to salSocketFind, added salNameFind. +01c,11mar04,ymz removed salClose and client structure. +01b,20feb04,ymz code review changes +01a,26nov03,als created +*/ + +#ifndef __INCsalClienth +#define __INCsalClienth + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" +#include "netdb.h" +#include "dsi/salCommon.h" + +/* function declarations */ + +extern int salOpen (const char * servId); +extern int salCall (int sockfd, void * pSendBuff, int sendLen, + void * pRecvBuff, int recvLen); + +extern STATUS salSocketFind (const char * name, int sockFamily, + int sockType, int sockProtocol, + struct addrinfo ** ppSockInfoList); +extern int salNameFind (const char * pattern, + char servName[][SAL_SERV_NAME_MAXSIZE], int num, + void ** ppCookie); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsalClienth */ + diff --git a/h/dsi/salCommon.h b/h/dsi/salCommon.h new file mode 100644 index 0000000..9c0cac7 --- /dev/null +++ b/h/dsi/salCommon.h @@ -0,0 +1,64 @@ +/* salCommon.h - socket application library common header file */ + +/* Copyright 2003-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,16feb05,ebh rename sockopt struct to salSockopt (it conflicts with + target/h/wrn/coreip/net/socketvar.h) +01d,09feb05,vvv temporary change to workaround sockopt redefinition +01c,20apr04,ymz code review changes. +01b,03dec03,als snsLib error codes now part of salLib. +01a,26nov03,als created. +*/ + +#ifndef __INCsalCommonh +#define __INCsalCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vwModNum.h" + +/* defines */ + +/* error codes */ +#define S_salLib_INTERNAL_ERROR (M_salLib | 0x0001) +#define S_salLib_INVALID_ARGUMENT (M_salLib | 0x0002) +#define S_salLib_SNS_UNAVAILABLE (M_salLib | 0x0003) +#define S_salLib_SNS_DID_NOT_REPLY (M_salLib | 0x0004) +#define S_salLib_SNS_PROTOCOL_ERROR (M_salLib | 0x0005) +#define S_salLib_CLIENT_SOCKET_ERROR (M_salLib | 0x0006) +#define S_salLib_SERVER_SOCKET_ERROR (M_salLib | 0x0007) +#define S_salLib_SERVER_EXIT (M_salLib | 0x0008) +#define S_salLib_SNS_INTERNAL_ERROR (M_salLib | 0x0009) +#define S_salLib_SNS_OUT_OF_MEMORY (M_salLib | 0x000a) +#define S_salLib_INVALID_SERVICE_ID (M_salLib | 0x000b) +#define S_salLib_INVALID_SERVICE_DESCRIPTOR (M_salLib | 0x000c) +#define S_salLib_SERVICE_NOT_FOUND (M_salLib | 0x000d) +#define S_salLib_SERVICE_ALREADY_EXISTS (M_salLib | 0x000e) +#define S_salLib_NO_SOCKET_FOUND (M_salLib | 0x000f) + +#define SAL_SERV_NAME_MAXSIZE 63 /* max length for an SAL service name */ + /* (including trailing null) */ + +/* typedefs */ + +struct salSockopt /* socket option structure */ + { + int so_level; /* option level */ + int so_name; /* option name */ + void * so_value; /* ptr to option value */ + int so_length; /* option length */ + }; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsalCommonh */ + diff --git a/h/dsi/salServer.h b/h/dsi/salServer.h new file mode 100644 index 0000000..bd76dda --- /dev/null +++ b/h/dsi/salServer.h @@ -0,0 +1,78 @@ +/* salServer.h - socket application library server header file */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,16feb05,ebh rename sockopt struct to salSockopt (it conflicts with + target/h/wrn/coreip/net/socketvar.h) +01f,07jun04,ymz removed private functions. +01e,19may04,ymz changed for coding convention. +01d,13apr04,ymz code review changes. +01c,30mar04,ymz added salRemove, modified to event based cleanup. +01b,13feb04,ymz added timeoutFn entry to salServer. +01a,26nov03,als created +*/ + +#ifndef __INCsalServerh +#define __INCsalServerh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" +#include "netdb.h" +#include "dsi/snsLib.h" + +/* typedefs */ + +/* SAL server processing routine type */ + +typedef enum + { + SAL_RTN_READ = 1, /* socket read routine Id */ + SAL_RTN_ACCEPT /* socket accept routine Id */ + } SAL_RTN_TYPE; + +/* return value from SAL processing routine indicating salRun what to do */ + +typedef enum + { + SAL_SOCK_KEEP, /* keep the socket */ + SAL_SOCK_CLOSE, /* close the socket */ + SAL_SOCK_IGNORE, /* do not polling the socket any more */ + SAL_RUN_TERMINATE /* terminate salRun */ + } SAL_RTN_STATUS; + +/* typedef SAL server processing routine */ + +typedef SAL_RTN_STATUS (* SAL_SERV_RTN)(int sockfd, void * pData); + +typedef struct salServer * SAL_SERVER_ID; + +/* function declarations */ + +extern SAL_SERVER_ID salCreate (const char * name, int sockFamily, + int sockType, int sockProtocol, + const struct salSockopt * options, + int numOptions); + +extern STATUS salDelete (SAL_SERVER_ID servId); + +extern STATUS salServerRtnSet (SAL_SERVER_ID servId, SAL_RTN_TYPE id, + SAL_SERV_RTN rtn); + +extern STATUS salRun (SAL_SERVER_ID servId, void * pData); + +extern STATUS salRemove (const char * name); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsalServerh */ + diff --git a/h/dsi/snsLib.h b/h/dsi/snsLib.h new file mode 100644 index 0000000..7c58f2f --- /dev/null +++ b/h/dsi/snsLib.h @@ -0,0 +1,92 @@ +/* snsLib.h - Socket Name Service library header file */ + +/* + * Copyright (c) 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01j,10may05,ebh parameterize SNS server type and instance for DSAL +01i,18apr05,ebh added parameter to snsServer declaration + added truncated scopy strings for snsShow command +01h,05jan05,bwa made listen socket's backlog configurable (SPR#102955). +01g,19may04,ymz changed for coding convention alignment. +01f,13apr04,ymz code review changes. +01e,30mar04,ymz changed scope expression syntax. +01d,01mar04,ymz code review changes. +01c,09feb04,ymz added URL support. +01b,03dec03,als snsLib error codes now part of salLib. +01a,26nov03,als created. +*/ + +#ifndef __INCsnsLibh +#define __INCsnsLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vwModNum.h" +#include "dsi/salCommon.h" + +/* defines */ + +/* define service scope string used in the URL, must be in lower case */ + +#define SNS_SCOPE_URL_DELIMITER '@' + +#define SNS_SCOPE_PRIVATE_STR "private" +#define SNS_SCOPE_UPTO_PRIVATE_STR "upto_private" +#define SNS_SCOPE_NODE_STR "node" +#define SNS_SCOPE_UPTO_NODE_STR "upto_node" +#define SNS_SCOPE_CLUSTER_STR "cluster" +#define SNS_SCOPE_UPTO_CLUSTER_STR "upto_cluster" +#define SNS_SCOPE_SYSTEM_STR "system" +#define SNS_SCOPE_UPTO_SYSTEM_STR "upto_system" +/* !! MAKE SURE THE NEXT ENTRY IS THE LONGEST SCOPE ENTRY - used internally !!*/ +#define SNS_SCOPE_LONGEST_ENTRY_STR "longest_scope" + +#define SNS_SCOPE_SHOW_PRIVATE_STR "priv" +#define SNS_SCOPE_SHOW_NODE_STR "node" +#define SNS_SCOPE_SHOW_CLUSTER_STR "clust" +#define SNS_SCOPE_SHOW_SYSTEM_STR "systm" + +#define SNS_URL_SCHEME "sns:" + +#define SNS_NUM_SCOPES 4 /* number of SNS scopes supported */ + +/* typedefs */ + +enum sns_scopes_value /* SNS service scope */ + { + /* define in the increasing scale and value */ + + SNS_SCOPE_NONE = -1, /* unassigned value (used by overrideScope) */ + SNS_SCOPE_PRIVATE = 1, /* address space (kernel/rtp) scope */ + SNS_SCOPE_NODE = 3, /* local processor scope */ + SNS_SCOPE_CLUSTER = 5, /* multiprocessor support using TIPC */ + SNS_SCOPE_SYSTEM = 7 /* multiprocessor support not yet available */ + }; + +typedef void * snsServDesc; /* SNS service descriptor */ + +/* function declarations */ + +extern STATUS snsServer (const int backlog, const int distributedFlag, + const int snsServerType, const int snsServerInstance); +extern void snsShow (const char * name); +extern STATUS dsalMonitor (const unsigned int dsalSnsServerType, + const unsigned int dsalSnsServerInstance); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsnsLibh */ diff --git a/h/dsi/un/unCompLib.h b/h/dsi/un/unCompLib.h new file mode 100644 index 0000000..9f9fdfe --- /dev/null +++ b/h/dsi/un/unCompLib.h @@ -0,0 +1,29 @@ +/* unCompLib.h - AF_LOCAL/COMP protocol initialization header file */ + +/* Copyright 2003-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,04jan05,bwa removed 'Inst' part of init routine names (SPR#103232). +01b,26nov03,bwa moved errno definitions to netinet/unLib.h +01a,05nov03,bwa written +*/ + +#ifndef __INCunCompLibh +#define __INCunCompLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function prototypes */ + +STATUS unCompInit (void * pInitValues); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCunCompLibh */ + diff --git a/h/dsi/un/unLib.h b/h/dsi/un/unLib.h new file mode 100644 index 0000000..9baa148 --- /dev/null +++ b/h/dsi/un/unLib.h @@ -0,0 +1,38 @@ +/* unLib.h - AF_LOCAL domain initialization header file */ + +/* Copyright 2003-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,04jan05,bwa removed 'Inst' part of init routine names (SPR#103232). +01c,24feb04,bwa added PROTOCOL_SWITCH_FULL definition +01b,26nov03,bwa moved protos/unCompLib.h errno definitions here +01a,10oct03,bwa written +*/ + +#ifndef __INCunLibh +#define __INCunLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* errnos */ + +#define S_unLib_ALREADY_INITIALIZED (M_unLib | 0x0001) +#define S_unLib_COMP_ALREADY_INITIALIZED (M_unLib | 0x0002) +#define S_unLib_PROTOCOL_SWITCH_FULL (M_unLib | 0x0003) + +/* function prototypes */ + +STATUS unInit (void * pInitValues); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCunLibh */ + diff --git a/h/dsi/un/unShow.h b/h/dsi/un/unShow.h new file mode 100644 index 0000000..65c43e7 --- /dev/null +++ b/h/dsi/un/unShow.h @@ -0,0 +1,29 @@ +/* unShow.h - header file for AF_LOCAL show routine functionalities */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,26jan04,bwa written +*/ + +#ifndef __INCunShowh +#define __INCunShowh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +extern void unShowInit (void); +extern void uncompShowInit (void); +extern void unstatShow (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCunShowh */ + diff --git a/h/dsi/un/uncomp.h b/h/dsi/un/uncomp.h new file mode 100644 index 0000000..adb468e --- /dev/null +++ b/h/dsi/un/uncomp.h @@ -0,0 +1,27 @@ +/* uncomp.h - AF_LOCAL/COMP protocol header file */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,05nov03,bwa written +*/ + +#ifndef __INCuncomph +#define __INCuncomph + +#ifdef __cplusplus +extern "C" { +#endif + +/* function prototypes */ + +void uncomp_init (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCuncomph */ + diff --git a/h/dsi/un/uncomp_fsm.h b/h/dsi/un/uncomp_fsm.h new file mode 100644 index 0000000..4f293d4 --- /dev/null +++ b/h/dsi/un/uncomp_fsm.h @@ -0,0 +1,36 @@ +/* uncomp_fsm.h - AF_LOCAL/COMP protocol: Finite state machine */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,30sep03,bwa written. +*/ + +#ifndef __INCuncomp_fsmh +#define __INCuncomp_fsmh + +#ifdef __cplusplus +extern "C" { +#endif + +/* COMP state machine state definitions */ + +#define UNCOMPS_NSTATES 6 /* number of defined states */ + +/* STATE VALUE [ WHO? ] HOW & WHEN */ +/* ------------------------------------------------------------------------- */ +#define UNCOMPS_CLOSED 0 /* [ both ] before connect()/after close() */ +#define UNCOMPS_REQUEST 1 /* [ client ] connect() issued before accept()*/ +#define UNCOMPS_LISTENING 2 /* [ server ] listen() issued */ +#define UNCOMPS_EXCHANGING 3 /* [ both ] connect() accepted by accept() */ +#define UNCOMPS_DONE_SEND 4 /* [ both ] shutdown (write) issued by self */ +#define UNCOMPS_DONE_RECV 5 /* [ both ] shutdown (write) issued by peer */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCuncomp_fsmh */ + diff --git a/h/dsi/un/uncomp_var.h b/h/dsi/un/uncomp_var.h new file mode 100644 index 0000000..159de2e --- /dev/null +++ b/h/dsi/un/uncomp_var.h @@ -0,0 +1,54 @@ +/* uncomp_var.h - AF_LOCAL/COMP protocol control block definition */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,12apr04,bwa moved DS_xxx macros to h/dsiSockLib.h. +01b,20jan04,bwa added pRegQTail field; renamed pExpQ field to pExpQTail; + added pRecvPacket field; + removed selfGenCnt and xxxMaxData fields; + removed _ASM_LANGUAGE references. +01a,30sep03,bwa written. +*/ + +#ifndef __INCuncomp_varh +#define __INCuncomp_varh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include + +/* data structures */ + +typedef struct uncompcb /* AF_LOCAL/COMP protocol control block */ + { /* ------------------------------------- */ + DL_NODE node; /* 0x00: entry in the uncomp socket list */ + struct socket * pSelfSocket; /* 0x08: back pointer to socket */ + struct socket * pPeerSocket; /* 0x0c: connected socket */ + uint16_t selfState; /* 0x10: state of socket */ + uint16_t selfName; /* 0x12: name of socket (/comp/socket/X) */ + struct mbuf * pLastReg; /* 0x14: ptr to last regular message */ + struct mbuf * pLastExp; /* 0x18: ptr to last express message */ + struct mbuf * pRecvPacket; /* 0x1c: ptr to packet being received */ + uint16_t hiwatermark; /* 0x1e: largest amount of data queued */ + uint16_t dropped; /* 0x20: amount of packets dropped */ + } UNCOMPCB; /* 0x24: TOTAL SIZE */ + +/* useful macros */ + +#define SO_TO_UNCOMPCB(so) ((struct uncompcb *)(so->so_pcb)) +#define UNCOMPCB_TO_SO(cb) ((struct socket *)(cb->pSelfSocket)) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCuncomp_varh */ + diff --git a/h/dsmLib.h b/h/dsmLib.h new file mode 100644 index 0000000..512467c --- /dev/null +++ b/h/dsmLib.h @@ -0,0 +1,105 @@ +/* dsmLib.h - disassembler library header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02f,17apr03,dbt Added SIMLINUX support. +02e,03mar03,jeg Updated simsolaris header file +02d,22oct01,dee Merge from T2.1.0 ColdFire +02c,01mar00,frf Add SH4 support for T2. +02b,23apr97,hk added SH support. +02b,14aug97,cym added SIMNT support. +02b,28nov96,cdp added ARM support. +02a,14sep94,caf added PPC support. +01s,12jul95,ism added simsolaris support +01r,19mar95,dvs removed #ifdef TRON - tron no longer supported. +01q,02dec93,pad added Am29k family support. +01p,11aug93,gae vxsim hppa. +01o,20jun93,gae vxsim. +01n,09jun93,hdn added support for I80X86 +01m,22sep92,rrr added support for c++ +01l,04jul92,jcf cleaned up. +01k,26may92,rrr the tree shuffle + -changed includes to have absolute path from h/ +01j,09jan92,jwt converted CPU==SPARC to CPU_FAMILY==SPARC. +01i,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01h,10seo91,wmd fixed typo in comments. +01g,02aug91,ajm added MIPS support +01f,19jul91,gae renamed architecture specific include file to be xx.h. +01e,29apr91,hdn added defines and macros for TRON architecture. +01d,25oct90,shl fixed CPU_FAMILY logic so 68k and sparc won't clash when + compiling for sparc. +01c,05oct90,shl added copyright notice. + made #endif ANSI style. +01b,28sep90,del include i960/dsmLib.h. +01a,07aug89,gae written. +*/ + +#ifndef __INCdsmLibh +#define __INCdsmLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#if CPU_FAMILY==I960 +#include "arch/i960/dsmI960Lib.h" +#endif /* CPU_FAMILY==I960 */ + +#if CPU_FAMILY==MC680X0 +#include "arch/mc68k/dsmMc68kLib.h" +#endif /* CPU_FAMILY==MC680X0 */ + +#if CPU_FAMILY==COLDFIRE +#include "arch/coldfire/dsmColdfireLib.h" +#endif /* CPU_FAMILY==COLDFIRE */ + +#if CPU_FAMILY==MIPS +#include "arch/mips/dsmMipsLib.h" +#endif /* CPU_FAMILY==MIPS */ + +#if CPU_FAMILY==PPC +#include "arch/ppc/dsmPpcLib.h" +#endif /* CPU_FAMILY==PPC */ + +#if CPU_FAMILY==SPARC +#include "arch/sparc/dsmSparcLib.h" +#endif /* CPU_FAMILY==SPARC */ + +#if CPU_FAMILY==SIMSPARCSOLARIS +#include "arch/simsolaris/dsmSimsolarisLib.h" +#endif /* CPU_FAMILY==SIMSPARCSOLARIS */ + +#if CPU_FAMILY==SIMLINUX +#include "arch/simlinux/dsmSimlinuxLib.h" +#endif /* CPU_FAMILY==SIMLINUX */ + +#if CPU_FAMILY==SIMNT +#include "arch/simnt/dsmSimntLib.h" +#endif /* CPU_FAMILY==SIMNT */ + +#if CPU_FAMILY==I80X86 +#include "arch/i86/dsmI86Lib.h" +#endif /* CPU_FAMILY==I80X86 */ + +#if CPU_FAMILY==AM29XXX +#include "arch/am29k/dsmAm29kLib.h" +#endif /* CPU_FAMILY==AM29XXX */ + +#if CPU_FAMILY==SH +#include "arch/sh/dsmShLib.h" +#endif /* CPU_FAMILY==SH */ + +#if CPU_FAMILY==ARM +#include "arch/arm/dsmArmLib.h" +#endif /* CPU_FAMILY==ARM */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdsmLibh */ diff --git a/h/dspLib.h b/h/dspLib.h new file mode 100644 index 0000000..146a20b --- /dev/null +++ b/h/dspLib.h @@ -0,0 +1,89 @@ +/* dspLib.h - dsp coprocessor support library header */ + +/* + * Copyright (C) 1998, 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01c,27jul05,pes Handle MIPS DSP include file. +01b,08aug98,kab fixed default typedef of DSP_CONTEXT. Cleanup after review. +01a,22jul98,mem written. +*/ + +#ifndef __INCdspLibh +#define __INCdspLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE +#include +#endif /* _ASMLANGUAGE */ + +#if (CPU_FAMILY==SH) +#include +#elif (CPU_FAMILY==MIPS) +#include +#else +#define DSPREG_SET DSP_CONTEXT +typedef ULONG DSP_CONTEXT; /* in case of allocation */ +#endif /* CPU_FAMILY==SH */ + +#ifndef _ASMLANGUAGE + +/* variable declarations */ + +IMPORT REG_INDEX dspRegName[]; /* dsp data register table */ +IMPORT REG_INDEX dspCtlRegName[]; /* dsp control register table */ +IMPORT WIND_TCB *pDspTaskIdPrevious; /* task id for deferred exceptions */ +IMPORT FUNCPTR dspCreateHookRtn; /* arch dependent create hook routine */ +IMPORT FUNCPTR dspDisplayHookRtn; /* arch dependent display routine */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +/* + * The interface is set in os/dspLib.c through dspInit(). Some of + * the functions are actually implemented in architecture dependent + * files. + */ +IMPORT void dspInit (void); +IMPORT void dspShowInit (void); +IMPORT void dspTaskRegsShow (int task); +IMPORT STATUS dspTaskRegsGet (int task, DSPREG_SET *pDspRegSet); +IMPORT STATUS dspTaskRegsSet (int task, DSPREG_SET *pDspRegSet); +IMPORT STATUS dspProbe (void); +IMPORT void dspRestore (DSP_CONTEXT *pDspContext); +IMPORT void dspSave (DSP_CONTEXT *pDspContext); +IMPORT void dspRegsToCtx (DSPREG_SET *pDspRegSet, DSP_CONTEXT *pDspContext); +IMPORT void dspCtxToRegs (DSP_CONTEXT *pDspContext, DSPREG_SET *pDspRegSet); + +#else + +IMPORT void dspInit (); +IMPORT void dspShowInit (); +IMPORT void dspTaskRegsShow (); +IMPORT STATUS dspTaskRegsGet (); +IMPORT STATUS dspTaskRegsSet (); +IMPORT STATUS dspProbe (); +IMPORT void dspRestore (); +IMPORT void dspSave (); +IMPORT void dspRegsToCtx (); +IMPORT void dspCtxToRegs (); + +#endif /* __STDC__ */ +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdspLibh */ diff --git a/h/ecoff.h b/h/ecoff.h new file mode 100644 index 0000000..e442adf --- /dev/null +++ b/h/ecoff.h @@ -0,0 +1,798 @@ +/* ecoff.h - MIPS common object file format header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,22sep92,rrr added support for c++ +01i,23jul92,ajm added MAX_SCN define +01h,04jul92,jcf cleaned up. +01g,23jun92,ajm quiet ansi warnings +01f,26may92,rrr the tree shuffle +01e,17may92,ajm introduced to new.master +01d,20feb92,ajm added little endian bitfields for swaps +01c,15jan92,ajm got rid of #define mips sections +01c,01dec91,ajm added mips definitions for AOUTHDR +01b,26jul90,rtp added MIPSELMAGIC definition. +02a,28jun90,dcb derived from coffAout.h. +01a,05feb88,ecs derived from UniPlus+ System V Release 2 a.out.h., plus + all the files that it included, and the files that those + files, in turn, included. Now all one big happy file. +*/ + +#ifndef __INCecoffh +#define __INCecoffh + +#ifdef __cplusplus +extern "C" { +#endif + +/* COMMON OBJECT FILE FORMAT + + + + File Organization: + + _______________________________________________ INCLUDE FILE + |_______________HEADER_DATA___________________| + | | + | File Header | "filehdr.h" + |.............................................| + | | + | Auxilliary Header Information | "aouthdr.h" + | | + |_____________________________________________| + | | + | ".text" section header | "snnhdr.h" + | | + |.............................................| + | | + | ".data" section header | '' + | | + |.............................................| + | | + | ".bss" section header | '' + | | + |_____________________________________________| + |______________RAW_DATA_______________________| + | | + | ".text" section data (rounded to 4 | + | bytes) | + |.............................................| + | | + | ".data" section data (rounded to 4 | + | bytes) | + |_____________________________________________| + |____________RELOCATION_DATA__________________| + | | + | ".text" section relocation data | "reloc.h" + | | + |.............................................| + | | + | ".data" section relocation data | '' + | | + |_____________________________________________| + |__________LINE_NUMBER_DATA_(SDB)_____________| + | | + | ".text" section line numbers | "linenum.h" + | | + |.............................................| + | | + | ".data" section line numbers | '' + | | + |_____________________________________________| + |________________SYMBOL_TABLE_________________| + | | + | ".text", ".data" and ".bss" section | "syms.h" + | symbols | "storclass.h" + | | + |_____________________________________________| + + + + OBJECT FILE COMPONENTS + + HEADER FILES: (of historical interest only) + /usr/include/filehdr.h + /usr/include/aouthdr.h + /usr/include/snnhdr.h + /usr/include/reloc.h + /usr/include/linenum.h + /usr/include/syms.h + /usr/include/storclass.h + + STANDARD FILE: + vw/h/coffAout.h "object file" */ + +/* Unix magic numbers found in optional header */ + +#undef OMAGIC /* undefine for a.out overlaps */ +#undef NMAGIC +#undef ZMAGIC +#undef LIBMAGIC +#undef N_BADMAG +#define OMAGIC 0x107 +#define NMAGIC 0x108 +#define ZMAGIC 0x106 +#define LIBMAGIC 0x123 +#define N_BADMAG(x) \ + (((x).magic)!=OMAGIC && ((x).magic)!=NMAGIC && ((x).magic)!=ZMAGIC && \ + ((x).magic)!=LIBMAGIC) + +/* + * Coff files produced by the mips loader are guaranteed to have the raw data + * for the sections follow the headers in this order: .text, .rdata, .data and + * .sdata the sum of the sizes of last three is the value in dsize in the + * optional header. This is all done for the benefit of the programs that + * have to load these objects so only the file header and optional header + * have to be inspected. The macro N_TXTOFF() takes pointers to file header + * and optional header and returns the file offset to the start of the raw + * data for the .text section. The raw data for the three data sections + * follows the start of the .text section by the value of tsize in the optional + * header. + * + * Object files produced by pre 0.23 versions of the compiler had their sections + * rounded to 8 byte boundaries. 0.23 and later versions have their sections + * rounded to 16 (SCNROUND) byte boundaries. + */ + +#undef N_TXTOFF /* undefined for a.out overlap */ +#define N_TXTOFF(f, a) \ +((a).magic == ZMAGIC || (a).magic == LIBMAGIC ? 0 : \ + ((a).vstamp < 23 ? \ + ((FILHSZ + AOUTHSZ + (f).f_nscns * SCNHSZ + 7) & 0xfffffff8) : \ + ((FILHSZ + AOUTHSZ + (f).f_nscns * SCNHSZ + SCNROUND-1) & ~(SCNROUND-1)) ) ) + +/*********************************************filehdr.h********************/ + +/* @(#)filehdr.h 2.1 */ +struct filehdr { + unsigned short f_magic; /* magic number */ + unsigned short f_nscns; /* number of sections */ + long f_timdat; /* time & date stamp */ + long f_symptr; /* file pointer to symtab */ + long f_nsyms; /* number of symtab entries */ + unsigned short f_opthdr; /* sizeof(optional hdr) */ + unsigned short f_flags; /* flags */ + }; + + +/* + * Bits for f_flags: + * + * F_RELFLG relocation info stripped from file + * F_EXEC file is executable (i.e. no unresolved + * external references) + * F_LNNO line nunbers stripped from file + * F_LSYMS local symbols stripped from file + * F_MINMAL this is a minimal object file (".m") output of fextract + * F_UPDATE this is a fully bound update file, output of ogen + * F_SWABD this file has had its bytes swabbed (in names) + * F_AR16WR this file created on AR16WR machine(e.g. 11/70) + * F_AR32WR this file created on AR32WR machine(e.g. vax) + * F_AR32W this file created on AR32W machine (e.g. 3b,maxi) + * F_PATCH file contains "patch" list in optional header + * F_NODF (minimal file only) no decision functions for + * replaced functions + */ + +#define F_RELFLG 0000001 +#define F_EXEC 0000002 +#define F_LNNO 0000004 +#define F_LSYMS 0000010 +#define F_MINMAL 0000020 +#define F_UPDATE 0000040 +#define F_SWABD 0000100 +#define F_AR16WR 0000200 +#define F_AR32WR 0000400 +#define F_AR32W 0001000 +#define F_PATCH 0002000 +#define F_NODF 0002000 + + +/* + * Magic Numbers + */ + + /* Basic-16 */ + +#define B16MAGIC 0502 +#define BTVMAGIC 0503 + + /* x86 */ + +#define X86MAGIC 0510 +#define XTVMAGIC 0511 + + /* n3b */ +/* + * NOTE: For New 3B, the old values of magic numbers + * will be in the optional header in the structure + * "aouthdr" (identical to old 3B aouthdr). + */ + +#define N3BMAGIC 0550 +#define NTVMAGIC 0551 + + /* XL */ +#define XLMAGIC 0540 + + /* MAC-32 3b-5 */ + +#define FBOMAGIC 0560 +#define RBOMAGIC 0562 +#define MTVMAGIC 0561 + + + /* VAX 11/780 and VAX 11/750 */ + + /* writeable text segments */ +#define VAXWRMAGIC 0570 + /* readonly sharable text segments */ +#define VAXROMAGIC 0575 + + + /* Motorola 68000 */ +#define MC68MAGIC 0520 /* System V/68 magic number */ +#define MC68TVMAGIC 0521 /* Bell only */ +#define M68MAGIC 0210 /* Bell only */ +#define M68TVMAGIC 0211 /* Bell only */ + + /* UniSoft additions for 68000 */ +#define M68NSMAGIC 0510 /* Non Shared */ + + /* IBM 370 */ +#define U370WRMAGIC 0530 /* writeble text segments */ +#define U370ROMAGIC 0535 /* readonly sharable text segments */ + +#define FILHDR struct filehdr +#define FILHSZ sizeof(FILHDR) + + /* MIPS */ +#define MIPSEBMAGIC 0x0160 /* big endian target and host */ +#define MIPSELMAGIC 0x0162 /* little endian target and host */ +#define SMIPSEBMAGIC 0x6001 /* big endian target, little endian host */ +#define SMIPSELMAGIC 0x6201 /* little endian target, big endian host */ + +/*********************************************aouthdr.h********************/ + +/* + * static char ID_aouth[] = "@(#)aouthdr.h 2.1 "; + */ + +typedef struct aouthdr { + short magic; /* see magic.h */ + short vstamp; /* version stamp */ + long tsize; /* text size in bytes, padded to FW + bdry */ + long dsize; /* initialized data " " */ + long bsize; /* uninitialized data " " */ + long entry; /* entry pt. */ + long text_start; /* base of text used for this file */ + long data_start; /* base of data used for this file */ + long bss_start; /* base of bss used for this file */ + long gprmask; /* general purpose register mask */ + long cprmask[4]; /* co-processor register masks */ + long gp_value; /* the gp value used for this object */ +} AOUTHDR; +#define AOUTHSZ sizeof(AOUTHDR) + +/*********************************************snnhdr.h*********************/ + +/* @(#)scnhdr.h 2.1 */ +struct scnhdr { + char s_name[8]; /* section name */ + long s_paddr; /* physical address */ + long s_vaddr; /* virtual address */ + long s_size; /* section size */ + long s_scnptr; /* file ptr to raw data for section */ + long s_relptr; /* file ptr to relocation */ + long s_lnnoptr; /* file ptr to line numbers */ + unsigned short s_nreloc; /* number of relocation entries */ + unsigned short s_nlnno; /* number of line number entries */ + long s_flags; /* flags */ + }; + +#define SCNHDR struct scnhdr +#define SCNHSZ sizeof(SCNHDR) +#define SCNROUND ((long)16) + +/* + * Define constants for names of "special" sections + */ + +#define _TEXT ".text" +#define _INIT ".init" +#define _RDATA ".rdata" +#define _DATA ".data" +#define _LIT8 ".lit8" +#define _LIT4 ".lit4" +#define _SDATA ".sdata" +#define _BSS ".bss" +#define _SBSS ".sbss" +#define _LIB ".lib" +#define _UCODE ".ucode" + + + + +/* + * The low 4 bits of s_flags is used as a section "type" + */ + +#define STYP_REG 0x00 /* "regular" section: + allocated, relocated, loaded */ +#define STYP_DSECT 0x01 /* "dummy" section: + not allocated, relocated, + not loaded */ +#define STYP_NOLOAD 0x02 /* "noload" section: + allocated, relocated, + not loaded */ +#define STYP_GROUP 0x04 /* "grouped" section: + formed of input sections */ +#define STYP_PAD 0x08 /* "padding" section: + not allocated, not relocated, + loaded */ +#define STYP_COPY 0x10 /* "copy" section: + for decision function used + by field update; not + allocated, not relocated, + loaded; reloc & lineno + entries processed normally */ +#define STYP_TEXT 0x20 /* section contains text only */ +#define STYP_DATA 0x40 /* section contains data only */ +#define STYP_BSS 0x80 /* section contains bss only */ + +/* + * In a minimal file or an update file, a new function + * (as compared with a replaced function) is indicated by S_NEWFCN + */ + +#define S_NEWFCN 0x10 + +/* + * In 3b Update Files (output of ogen), sections which appear in SHARED + * segments of the Pfile will have the S_SHRSEG flag set by ogen, to inform + * dufr that updating 1 copy of the proc. will update all process invocations. + */ + +#define S_SHRSEG 0x20 + +/*********************************************reloc.h**********************/ + +/* @(#)reloc.h 2.1 */ +struct reloc { + long r_vaddr; /* (virtual) address of reference */ + unsigned r_symndx:24, /* index into symbol table */ + r_reserved:3, + r_type:4, /* relocation type */ + r_extern:1; /* external flag */ + }; + +#define RELOC struct reloc +#define RELSZ sizeof(RELOC) + +/* bitfields swapped for little endian conversions */ + +struct reloc_le { + long r_vaddr; /* (virtual) address of reference */ + unsigned r_extern:1, /* external flag */ + r_type:4, /* relocation type */ + r_reserved:3, + r_symndx:24; /* index into symbol table */ + }; + +#define RELOC_LE struct reloc_le +#define RELSZ_LE sizeof(RELOC_LE) + +/* + * section numbers for relocation entries + */ + +#define R_SN_TEXT 1 +#define R_SN_INIT 7 +#define R_SN_RDATA 2 +#define R_SN_DATA 3 +#define R_SN_SDATA 4 +#define R_SN_SBSS 5 +#define R_SN_BSS 6 +#define R_SN_LIT8 8 +#define R_SN_LIT4 9 + +/* + * relocation types for all products and generics + */ + +/* + * All generics + * reloc. already performed to symbol in the same section + */ +#define R_ABS 0 + +/* + * MIPS + * 16 bit reference + * 32 bit reference + * 26 bit jump reference + * hi 16 bits + * lo 16 bits + * global pointer offset + * literal + */ +#define R_REFHALF 1 +#define R_REFWORD 2 +#define R_JMPADDR 3 +#define R_REFHI 4 +#define R_REFLO 5 +#define R_GPREL 6 +#define R_LITERAL 7 + +/* + * X86 generic + * 8-bit offset reference in 8-bits + * 8-bit offset reference in 16-bits + * 12-bit segment reference + * auxiliary relocation entry + */ +#define R_OFF8 07 +#define R_OFF16 010 +#define R_SEG12 011 +#define R_AUX 013 + +/* + * B16 and X86 generics + * 16-bit direct reference + * 16-bit "relative" reference + * 16-bit "indirect" (TV) reference + */ +#define R_DIR16 01 +#define R_REL16 02 +#define R_IND16 03 + +/* + * 3B generic + * 24-bit direct reference + * 24-bit "relative" reference + * 16-bit optimized "indirect" TV reference + * 24-bit "indirect" TV reference + * 32-bit "indirect" TV reference + */ +#define R_DIR24 04 +#define R_REL24 05 +#define R_OPT16 014 +#define R_IND24 015 +#define R_IND32 016 + +/* + * 3B and M32 generics + * 32-bit direct reference + */ +#define R_DIR32 06 + +/* + * M32 generic + * 32-bit direct reference with bytes swapped + */ +#define R_DIR32S 012 + +/* + * DEC Processors VAX 11/780 and VAX 11/750 + * + */ + +#define R_RELBYTE 017 +#define R_RELWORD 020 +#define R_RELLONG 021 +#define R_PCRBYTE 022 +#define R_PCRWORD 023 +#define R_PCRLONG 024 + + + +/* + * Motorola 68000 + * + * ... uses R_RELBYTE, R_RELWORD, R_RELLONG, R_PCRBYTE and R_PCRWORD as for + * DEC machines above. + */ + + /* Definition of a "TV" relocation type */ + +/*********************************************linenum.h********************/ + +/* @(#)linenum.h 2.1 */ +/* There is one line number entry for every + "breakpointable" source line in a section. + Line numbers are grouped on a per function + basis; the first entry in a function grouping + will have l_lnno = 0 and in place of physical + address will be the symbol table index of + the function name. +*/ +struct lineno +{ + union + { + long l_symndx ; /* sym. table index of function name + iff l_lnno == 0 */ + long l_paddr ; /* (physical) address of line number */ + } l_addr ; + unsigned short l_lnno ; /* line number */ +} ; + +#define LINENO struct lineno +#define LINESZ 6 /* sizeof(LINENO) */ + +/*****************************************syms.h/storclass.h***********/ + +/* @(#)syms.h 2.1 */ +/* Storage Classes are defined in storclass.h */ +/* @(#)storclass.h 2.1 */ +/* + * STORAGE CLASSES + */ + +#define C_EFCN -1 /* physical end of function */ +#define C_NULL 0 +#define C_AUTO 1 /* automatic variable */ +#define C_EXT 2 /* external symbol */ +#define C_STAT 3 /* static */ +#define C_REG 4 /* register variable */ +#define C_EXTDEF 5 /* external definition */ +#define C_LABEL 6 /* label */ +#define C_ULABEL 7 /* undefined label */ +#define C_MOS 8 /* member of structure */ +#define C_ARG 9 /* function argument */ +#define C_STRTAG 10 /* structure tag */ +#define C_MOU 11 /* member of union */ +#define C_UNTAG 12 /* union tag */ +#define C_TPDEF 13 /* type definition */ +#define C_USTATIC 14 /* undefined static */ +#define C_ENTAG 15 /* enumeration tag */ +#define C_MOE 16 /* member of enumeration */ +#define C_REGPARM 17 /* register parameter */ +#define C_FIELD 18 /* bit field */ +#define C_BLOCK 100 /* ".bb" or ".eb" */ +#define C_FCN 101 /* ".bf" or ".ef" */ +#define C_EOS 102 /* end of structure */ +#define C_FILE 103 /* file name */ + + /* + * The following storage class is a "dummy" used only by STS + * for line number entries reformatted as symbol table entries + */ + +#define C_LINE 104 +#define C_ALIAS 105 /* duplicate tag */ +#define C_HIDDEN 106 /* special storage class for external */ + /* symbols in dmert public libraries */ + +/* Number of characters in a symbol name */ +#define SYMNMLEN 8 +/* Number of characters in a file name */ +#define FILNMLEN 14 +/* Number of array dimensions in auxiliary entry */ +#define DIMNUM 4 + + +struct syment +{ + union + { + char _n_name[SYMNMLEN]; /* old COFF version */ + struct + { + long _n_zeroes; /* new == 0 */ + long _n_offset; /* offset into string table */ + } _n_n; + char *_n_nptr[2]; /* allows for overlaying */ + } _n; + long n_value; /* value of symbol */ + short n_scnum; /* section number */ + unsigned short n_type; /* type and derived type */ + char n_sclass; /* storage class */ + char n_numaux; /* number of aux. entries */ +}; + +#define n_name _n._n_name +#define n_nptr _n._n_nptr[1] +#define n_zeroes _n._n_n._n_zeroes +#define n_offset _n._n_n._n_offset + +/* + Relocatable symbols have a section number of the + section in which they are defined. Otherwise, section + numbers have the following meanings: +*/ + /* undefined symbol */ +#define N_UNDEF 0 + /* value of symbol is absolute */ +#define N_ABSLT -1 + /* special debugging symbol -- value of symbol is meaningless */ +#define N_DEBUG -2 + /* indicates symbol needs transfer vector (preload) */ +#define N_TV (unsigned short)-3 + + /* indicates symbol needs transfer vector (postload) */ + +#define P_TV (unsigned short)-4 + +/* + The fundamental type of a symbol packed into the low + 4 bits of the word. +*/ + +#define _EF ".ef" + +#define T_NULL 0 +#define T_ARG 1 /* function argument (only used by compiler) */ +#define T_CHAR 2 /* character */ +#define T_SHORT 3 /* short integer */ +#define T_INT 4 /* integer */ +#define T_LONG 5 /* long integer */ +#define T_FLOAT 6 /* floating point */ +#define T_DOUBLE 7 /* double word */ +#define T_STRUCT 8 /* structure */ +#define T_UNION 9 /* union */ +#define T_ENUM 10 /* enumeration */ +#define T_MOE 11 /* member of enumeration */ +#define T_UCHAR 12 /* unsigned character */ +#define T_USHORT 13 /* unsigned short */ +#define T_UINT 14 /* unsigned integer */ +#define T_ULONG 15 /* unsigned long */ + +/* + * derived types are: + */ + +#define DT_NON 0 /* no derived type */ +#define DT_PTR 1 /* pointer */ +#define DT_FCN 2 /* function */ +#define DT_ARY 3 /* array */ + +/* + * type packing constants + */ + +#define N_BTMASK 017 +#define N_TMASK 060 +#define N_TMASK1 0300 +#define N_TMASK2 0360 +#define N_BTSHFT 4 +#define N_TSHIFT 2 + +/* + * MACROS + */ + + /* Basic Type of x */ + +#define BTYPE(x) ((x) & N_BTMASK) + + /* Is x a pointer ? */ + +#define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT)) + + /* Is x a function ? */ + +#define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT)) + + /* Is x an array ? */ + +#define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT)) + + /* Is x a structure, union, or enumeration TAG? */ + +#define ISTAG(x) ((x)==C_STRTAG || (x)==C_UNTAG || (x)==C_ENTAG) + +#define INCREF(x) ((((x)&~N_BTMASK)<>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK)) + +/* + * AUXILIARY ENTRY FORMAT + */ + +union auxent +{ + struct + { + long x_tagndx; /* str, un, or enum tag indx */ + union + { + struct + { + unsigned short x_lnno; /* declaration line number */ + unsigned short x_size; /* str, union, array size */ + } x_lnsz; + long x_fsize; /* size of function */ + } x_misc; + union + { + struct /* if ISFCN, tag, or .bb */ + { + long x_lnnoptr; /* ptr to fcn line # */ + long x_endndx; /* entry ndx past block end */ + } x_fcn; + struct /* if ISARY, up to 4 dimen. */ + { + unsigned short x_dimen[DIMNUM]; + } x_ary; + } x_fcnary; + unsigned short x_tvndx; /* tv index */ + } x_sym; + struct + { + char x_fname[FILNMLEN]; + } x_file; + struct + { + long x_scnlen; /* section length */ + unsigned short x_nreloc; /* number of relocation entries */ + unsigned short x_nlinno; /* number of line numbers */ + } x_scn; + + struct + { + long x_tvfill; /* tv fill value */ + unsigned short x_tvlen; /* length of .tv */ + unsigned short x_tvran[2]; /* tv range */ + } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ +}; + +#define SYMENT struct syment +#define SYMESZ 18 /* sizeof(SYMENT) */ + +#define AUXENT union auxent +#define AUXESZ 18 /* sizeof(AUXENT) */ + +/* Defines for "special" symbols */ + +#define _ETEXT "etext" +#define _EDATA "edata" +#define _END "end" + +#ifdef _START +#undef _START +#define _START "_start" +#endif /* _START */ + +#define _TVORIG "_tvorig" +#define _TORIGIN "_torigin" +#define _DORIGIN "_dorigin" + +#define _SORIGIN "_sorigin" + +/* + * Simple values for n_type. VxWorks symbol defines. + */ + +#define N_UNDF 0x0 /* undefined */ +#define N_ABS 0x2 /* absolute */ +#define N_TEXT 0x4 /* text */ +#define N_DATA 0x6 /* data */ +#define N_BSS 0x8 /* bss */ +#define N_COMM 0x12 /* common (internal to ld) */ +#define N_FN 0x1f /* file name symbol */ + +#define N_EXT 01 /* external bit, or'ed in */ +#define N_TYPE 0x1e /* mask for all the type bits */ + +#define MAX_SCNS 11 +#define NO_SCNS 0 + +/* + * Sdb entries have some of the N_STAB bits set. + * These are given in + */ + +#define N_STAB 0xe0 /* if any of these bits set, a SDB entry */ + +/******************************************************************************/ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCecoffh */ diff --git a/h/ecoffSyms.h b/h/ecoffSyms.h new file mode 100644 index 0000000..a272243 --- /dev/null +++ b/h/ecoffSyms.h @@ -0,0 +1,814 @@ +/* ecoffSyms.h - MIPS ECOFF symbols definitions header */ + +/* Copyright 1984-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,04nov94,kdl merge cleanup - added missing comment marks. +01h,30sep93,caf removed AUXINT() macro and associated global variable. +01g,22sep92,rrr added support for c++ +01f,04jul92,jcf cleaned up. +01e,23jun92,ajm quiet ansi warnings +01d,26may92,rrr the tree shuffle +01c,17may92,ajm introduced to new.master +01b,20feb92,ajm added little endian bitfield defs +01a,15jan92,ajm written from mips syms.h, symconst.h, sym.h, stsupport.h +*/ + +#ifndef __INCecoffSymsh +#define __INCecoffSymsh + +#ifdef __cplusplus +extern "C" { +#endif + +/* --------------------------------------------------------- */ +/* | Copyright (c) 1986, 1989 MIPS Computer Systems, Inc. | */ +/* | All Rights Reserved. | */ +/* --------------------------------------------------------- */ + +/* Copyright (c) 1984 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +/* Defines for "special" symbols */ + +#define _ETEXT "etext" +#define _EDATA "edata" +#define _END "end" + +/* + * The displacement of the gp is from the start of the small data section + * is GP_DISP. The GP_PAD is the padding of the gp area so small negitive + * offset from gp relocation values can allways be used. + */ + +#define GP_PAD 16 +#define GP_DISP (32768 - GP_PAD) +#define GP_SIZE (GP_DISP+32767) + +/* "special" symbols for starts of sections */ + +#define _FTEXT "_ftext" +#define _FDATA "_fdata" +#define _FBSS "_fbss" +#define _GP "_gp" +#define _PROCEDURE_TABLE "_procedure_table" +#define _PROCEDURE_TABLE_SIZE "_procedure_table_size" +#define _PROCEDURE_STRING_TABLE "_procedure_string_table" +#define _COBOL_MAIN "_cobol_main" +#define _START "__start" + +/* --------------------------------------------------------- */ +/* | Copyright (c) 1986, 1989 MIPS Computer Systems, Inc. | */ +/* | All Rights Reserved. | */ +/* --------------------------------------------------------- */ + +/* (C) Copyright 1984 by Third Eye Software, Inc. + * + * Third Eye Software, Inc. grants reproduction and use rights to + * all parties, PROVIDED that this comment is maintained in the copy. + * + * Third Eye makes no claims about the applicability of this + * symbol table to a particular use. + */ + +/* glevels for field in FDR */ +#define GLEVEL_0 2 +#define GLEVEL_1 1 +#define GLEVEL_2 0 /* for upward compat reasons. */ +#define GLEVEL_3 3 + +/* magic number fo symheader */ +#define magicSym 0x7009 + +/* Language codes */ +#define langC 0 +#define langPascal 1 +#define langFortran 2 +#define langAssembler 3 /* one Assembley inst might map to many mach */ +#define langMachine 4 +#define langNil 5 +#define langAda 6 +#define langPl1 7 +#define langCobol 8 +#define langMax 9 /* maximun allowed 32 -- 5 bits */ + +/* The following are value definitions for the fields in the SYMR */ + +/* + * Storage Classes + */ + +#define scNil 0 +#define scText 1 /* text symbol */ +#define scData 2 /* initialized data symbol */ +#define scBss 3 /* un-initialized data symbol */ +#define scRegister 4 /* value of symbol is register number */ +#define scAbs 5 /* value of symbol is absolute */ +#define scUndefined 6 /* who knows? */ +#define scCdbLocal 7 /* variable's value is IN se->va.?? */ +#define scBits 8 /* this is a bit field */ +#define scCdbSystem 9 /* variable's value is IN CDB's address space */ +#define scDbx 9 /* overlap dbx internal use */ +#define scRegImage 10 /* register value saved on stack */ +#define scInfo 11 /* symbol contains debugger information */ +#define scUserStruct 12 /* address in struct user for current process */ +#define scSData 13 /* load time only small data */ +#define scSBss 14 /* load time only small common */ +#define scRData 15 /* load time only read only data */ +#define scVar 16 /* Var parameter (fortran,pascal) */ +#define scCommon 17 /* common variable */ +#define scSCommon 18 /* small common */ +#define scVarRegister 19 /* Var parameter in a register */ +#define scVariant 20 /* Variant record */ +#define scSUndefined 21 /* small undefined(external) data */ +#define scInit 22 /* .init section symbol */ +#define scBasedVar 23 /* Fortran or PL/1 ptr based var */ +#define scMax 32 + + +/* + * Symbol Types + */ + +#define stNil 0 /* Nuthin' special */ +#define stGlobal 1 /* external symbol */ +#define stStatic 2 /* static */ +#define stParam 3 /* procedure argument */ +#define stLocal 4 /* local variable */ +#define stLabel 5 /* label */ +#define stProc 6 /* " " Procedure */ +#define stBlock 7 /* beginnning of block */ +#define stEnd 8 /* end (of anything) */ +#define stMember 9 /* member (of anything - struct/union/enum */ +#define stTypedef 10 /* type definition */ +#define stFile 11 /* file name */ +#define stRegReloc 12 /* register relocation */ +#define stForward 13 /* forwarding address */ +#define stStaticProc 14 /* load time only static procs */ +#define stConstant 15 /* const */ +#define stStaParam 16 /* Fortran static parameters */ + /* Psuedo-symbols - internal to debugger */ +#define stStr 60 /* string */ +#define stNumber 61 /* pure number (ie. 4 NOR 2+2) */ +#define stExpr 62 /* 2+2 vs. 4 */ +#define stType 63 /* post-coersion SER */ +#define stMax 64 + +/* definitions for fields in TIR */ + +/* type qualifiers for ti.tq0 -> ti.(itqMax-1) */ +#define tqNil 0 /* bt is what you see */ +#define tqPtr 1 /* pointer */ +#define tqProc 2 /* procedure */ +#define tqArray 3 /* duh */ +#define tqFar 4 /* longer addressing - 8086/8 land */ +#define tqVol 5 /* volatile */ +#define tqMax 8 + +/* basic types as seen in ti.bt */ +#define btNil 0 /* undefined */ +#define btAdr 1 /* address - integer same size as pointer */ +#define btChar 2 /* character */ +#define btUChar 3 /* unsigned character */ +#define btShort 4 /* short */ +#define btUShort 5 /* unsigned short */ +#define btInt 6 /* int */ +#define btUInt 7 /* unsigned int */ +#define btLong 8 /* long */ +#define btULong 9 /* unsigned long */ +#define btFloat 10 /* float (real) */ +#define btDouble 11 /* Double (real) */ +#define btStruct 12 /* Structure (Record) */ +#define btUnion 13 /* Union (variant) */ +#define btEnum 14 /* Enumerated */ +#define btTypedef 15 /* defined via a typedef, isymRef points */ +#define btRange 16 /* subrange of int */ +#define btSet 17 /* pascal sets */ +#define btComplex 18 /* fortran complex */ +#define btDComplex 19 /* fortran double complex */ +#define btIndirect 20 /* forward or unnamed typedef */ +#define btFixedDec 21 /* Fixed Decimal */ +#define btFloatDec 22 /* Float Decimal */ +#define btString 23 /* Varying Length Character String */ +#define btBit 24 /* Aligned Bit String */ +#define btPicture 25 /* Picture */ +#define btVoid 26 /* void */ +#define btMax 64 + +#if (MFG == MIPS) +/* optimization type codes */ +#define otNil 0 +#define otReg 1 /* move var to reg */ +#define otBlock 2 /* begin basic block */ +#define otProc 3 /* procedure */ +#define otInline 4 /* inline procedure */ +#define otEnd 5 /* whatever you started */ +#define otMax 6 /* KEEP UP TO DATE */ +#endif /* (MFG == MIPS) */ + +/* --------------------------------------------------------- */ +/* | Copyright (c) 1986, 1989 MIPS Computer Systems, Inc. | */ +/* | All Rights Reserved. | */ +/* --------------------------------------------------------- */ + +/* (C) Copyright 1984 by Third Eye Software, Inc. + * + * Third Eye Software, Inc. grants reproduction and use rights to + * all parties, PROVIDED that this comment is maintained in the copy. + * + * Third Eye makes no claims about the applicability of this + * symbol table to a particular use. + */ + +/* + * This file contains the definition of the Third Eye Symbol Table. + * + * Symbols are assumed to be in 'encounter order' - i.e. the order that + * the things they represent were encountered by the compiler/assembler/loader. + * EXCEPT for globals! These are assumed to be bunched together, + * probably right after the last 'normal' symbol. Globals ARE sorted + * in ascending order. + * + * ----------------------------------------------------------------------- + * A brief word about Third Eye naming/use conventions: + * + * All arrays and index's are 0 based. + * All "ifooMax" values are the highest legal value PLUS ONE. This makes + * them good for allocating arrays, etc. All checks are "ifoo < ifooMax". + * + * "isym" Index into the SYMbol table. + * "ipd" Index into the Procedure Descriptor array. + * "ifd" Index into the File Descriptor array. + * "iss" Index into String Space. + * "cb" Count of Bytes. + * "rgPd" array whose domain is "0..ipdMax-1" and RanGe is PDR. + * "rgFd" array whose domain is "0..ifdMax-1" and RanGe is FDR. + */ + + +/* + * Symbolic Header (HDR) structure. + * As long as all the pointers are set correctly, + * we don't care WHAT order the various sections come out in! + * + * A file produced solely for the use of CDB will probably NOT have + * any instructions or data areas in it, as these are available + * in the original. + */ + +typedef struct { + short magic; /* to verify validity of the table */ + short vstamp; /* version stamp */ + long ilineMax; /* number of line number entries */ + long cbLine; /* number of bytes for line number entries */ + long cbLineOffset; /* offset to start of line number entries*/ + long idnMax; /* max index into dense number table */ + long cbDnOffset; /* offset to start dense number table */ + long ipdMax; /* number of procedures */ + long cbPdOffset; /* offset to procedure descriptor table */ + long isymMax; /* number of local symbols */ + long cbSymOffset; /* offset to start of local symbols*/ + long ioptMax; /* max index into optimization symbol entries */ + long cbOptOffset; /* offset to optimization symbol entries */ + long iauxMax; /* number of auxillary symbol entries */ + long cbAuxOffset; /* offset to start of auxillary symbol entries*/ + long issMax; /* max index into local strings */ + long cbSsOffset; /* offset to start of local strings */ + long issExtMax; /* max index into external strings */ + long cbSsExtOffset; /* offset to start of external strings */ + long ifdMax; /* number of file descriptor entries */ + long cbFdOffset; /* offset to file descriptor table */ + long crfd; /* number of relative file descriptor entries */ + long cbRfdOffset; /* offset to relative file descriptor table */ + long iextMax; /* max index into external symbols */ + long cbExtOffset; /* offset to start of external symbol entries*/ + /* If you add machine dependent fields, add them here */ + } HDRR, *pHDRR; +#define cbHDRR sizeof(HDRR) +#define hdrNil ((pHDRR)0) + +/* + * The FDR and PDR structures speed mapping of address <-> name. + * They are sorted in ascending memory order and are kept in + * memory by CDB at runtime. + */ + +/* + * File Descriptor + * + * There is one of these for EVERY FILE, whether compiled with + * full debugging symbols or not. The name of a file should be + * the path name given to the compiler. This allows the user + * to simply specify the names of the directories where the COMPILES + * were done, and we will be able to find their files. + * A field whose comment starts with "R - " indicates that it will be + * setup at runtime. + */ +typedef struct fdr { + unsigned long adr; /* memory address of beginning of file */ + long rss; /* file name (of source, if known) */ + long issBase; /* file's string space */ + long cbSs; /* number of bytes in the ss */ + long isymBase; /* beginning of symbols */ + long csym; /* count file's of symbols */ + long ilineBase; /* file's line symbols */ + long cline; /* count of file's line symbols */ + long ioptBase; /* file's optimization entries */ + long copt; /* count of file's optimization entries */ + short ipdFirst; /* start of procedures for this file */ + short cpd; /* count of procedures for this file */ + long iauxBase; /* file's auxiliary entries */ + long caux; /* count of file's auxiliary entries */ + long rfdBase; /* index into the file indirect table */ + long crfd; /* count file indirect entries */ + unsigned lang: 5; /* language for this file */ + unsigned fMerge : 1; /* whether this file can be merged */ + unsigned fReadin : 1; /* true if it was read in (not just created) */ + unsigned fBigendian : 1;/* if set, was compiled on big endian machine */ + /* aux's will be in compile host's sex */ + unsigned glevel : 2; /* level this file was compiled with */ + unsigned reserved : 22; /* reserved for future use */ + long cbLineOffset; /* byte offset from header for this file ln's */ + long cbLine; /* size of lines for this file */ + } FDR, *pFDR; +#define cbFDR sizeof(FDR) +#define fdNil ((pFDR)0) +#define ifdNil -1 +#define ifdTemp 0 +#define ilnNil -1 + + +/* + * Procedure Descriptor + * + * There is one of these for EVERY TEXT LABEL. + * If a procedure is in a file with full symbols, then isym + * will point to the PROC symbols, else it will point to the + * global symbol for the label. + */ + +typedef struct pdr { + unsigned long adr; /* memory address of start of procedure */ + long isym; /* start of local symbol entries */ + long iline; /* start of line number entries*/ + long regmask; /* save register mask */ + long regoffset; /* save register offset */ + long iopt; /* start of optimization symbol entries*/ + long fregmask; /* save floating point register mask */ + long fregoffset; /* save floating point register offset */ + long frameoffset; /* frame size */ + short framereg; /* frame pointer register */ + short pcreg; /* offset or reg of return pc */ + long lnLow; /* lowest line in the procedure */ + long lnHigh; /* highest line in the procedure */ + long cbLineOffset; /* byte offset for this procedure from the fd base */ + } PDR, *pPDR; +#define cbPDR sizeof(PDR) +#define pdNil ((pPDR) 0) +#define ipdNil -1 + +/* + * The structure of the runtime procedure descriptor created by the loader + * for use by the static exception system. + */ +typedef struct runtime_pdr { + unsigned long adr; /* memory address of start of procedure */ + long regmask; /* save register mask */ + long regoffset; /* save register offset */ + long fregmask; /* save floating point register mask */ + long fregoffset; /* save floating point register offset */ + long frameoffset; /* frame size */ + short framereg; /* frame pointer register */ + short pcreg; /* offset or reg of return pc */ + long irpss; /* index into the runtime string table */ + long reserved; + struct exception_info *exception_info;/* pointer to exception array */ +} RPDR, *pRPDR; +#define cbRPDR sizeof(RPDR) +#define rpdNil ((pRPDR) 0) + +/* + * Line Numbers + * + * Line Numbers are segregated from the normal symbols because they + * are [1] smaller , [2] are of no interest to your + * average loader, and [3] are never needed in the middle of normal + * scanning and therefore slow things down. + * + * By definition, the first LINER for any given procedure will have + * the first line of a procedure and represent the first address. + */ + +typedef long LINER, *pLINER; +#define lineNil ((pLINER)0) +#define cbLINER sizeof(LINER) +#define ilineNil -1 + + + +/* + * The Symbol Structure (GFW, to those who Know!) + */ + +typedef struct { + long iss; /* index into String Space of name */ + long value; /* value of symbol */ + unsigned st : 6; /* symbol type */ + unsigned sc : 5; /* storage class - text, data, etc */ + unsigned reserved : 1; /* reserved */ + unsigned index : 20; /* index into sym/aux table */ + } SYMR, *pSYMR; +/* + * Now SYMR with Little Endian bitfields for swaps + */ + +typedef struct { + long iss; /* index into String Space of name */ + long value; /* value of symbol */ + unsigned index : 20; /* index into sym/aux table */ + unsigned reserved : 1; /* reserved */ + unsigned sc : 5; /* storage class - text, data, etc */ + unsigned st : 6; /* symbol type */ + } SYMR_LE, *pSYMR_LE; + +#define symNil ((pSYMR)0) +#define cbSYMR sizeof(SYMR) +#define isymNil -1 +#define indexNil 0xfffff +#define issNil -1 +#define issNull 0 + + +/* The following converts a memory resident string to an iss. + * This hack is recognized in SbFIss, in sym.c of the debugger. + */ +#define IssFSb(sb) (0x80000000 | ((unsigned long)(sb))) + +/* E X T E R N A L S Y M B O L R E C O R D + * + * Same as the SYMR except it contains file context to determine where + * the index is. + */ +typedef struct { + unsigned jmptbl:1; /* symbol is a jump table entry for shlibs */ + unsigned cobol_main:1; /* symbol is a cobol main procedure */ + unsigned reserved:14; /* reserved for future use */ + short ifd; /* where the iss and index fields point into */ + SYMR asym; /* symbol for the external */ + } EXTR, *pEXTR; +/* + * + * Now EXTR with Litte Endian bit fields for swaps + * + */ + +typedef struct { + unsigned reserved:14; /* reserved for future use */ + unsigned cobol_main:1; /* symbol is a cobol main procedure */ + unsigned jmptbl:1; /* symbol is a jump table entry for shlibs */ + short ifd; /* where the iss and index fields point into */ + SYMR asym; /* symbol for the external */ + } EXTR_LE, *pEXTR_LE; + +#define extNil ((pEXTR)0) +#define cbEXTR sizeof(EXTR) + + +/* A U X I L L A R Y T Y P E I N F O R M A T I O N */ + +/* + * Type Information Record + */ +typedef struct { + unsigned fBitfield : 1; /* set if bit width is specified */ + unsigned continued : 1; /* indicates additional TQ info in next AUX */ + unsigned bt : 6; /* basic type */ + unsigned tq4 : 4; + unsigned tq5 : 4; + /* ---- 16 bit boundary ---- */ + unsigned tq0 : 4; + unsigned tq1 : 4; /* 6 type qualifiers - tqPtr, etc. */ + unsigned tq2 : 4; + unsigned tq3 : 4; + } TIR, *pTIR; +#define cbTIR sizeof(TIR) +#define tiNil ((pTIR)0) +#define itqMax 6 + +/* + * Relative symbol record + * + * If the rfd field is 4095, the index field indexes into the global symbol + * table. + */ + +typedef struct { + unsigned rfd : 12; /* index into the file indirect table */ + unsigned index : 20; /* index int sym/aux/iss tables */ + } RNDXR, *pRNDXR; +#define cbRNDXR sizeof(RNDXR) +#define rndxNil ((pRNDXR)0) + +/* dense numbers or sometimes called block numbers are stored in this type, + * a rfd of 0xffffffff is an index into the global table. + */ +typedef struct { + unsigned long rfd; /* index into the file table */ + unsigned long index; /* index int sym/aux/iss tables */ + } DNR, *pDNR; +#define cbDNR sizeof(DNR) +#define dnNil ((pDNR)0) + + + +/* + * Auxillary information occurs only if needed. + * It ALWAYS occurs in this order when present. + + isymMac used by stProc only + TIR type info + TIR additional TQ info (if first TIR was not enough) + rndx if (bt == btStruct,btUnion,btEnum,btSet,btRange, + btTypedef): + rsym.index == iaux for btSet or btRange + else rsym.index == isym + dimLow btRange, btSet + dimMac btRange, btSet + rndx0 As many as there are tq arrays + dimLow0 + dimHigh0 + ... + rndxMax-1 + dimLowMax-1 + dimHighMax-1 + width in bits if (bit field), width in bits. + */ +#define cAuxMax (6 + (idimMax*3)) + +/* a union of all possible info in the AUX universe */ +typedef union { + TIR ti; /* type information record */ + RNDXR rndx; /* relative index into symbol table */ + long dnLow; /* low dimension */ + long dnHigh; /* high dimension */ + long isym; /* symbol table index (end of proc) */ + long iss; /* index into string space (not used) */ + long width; /* width for non-default sized struc fields */ + long count; /* count of ranges for variant arm */ + } AUXU, *pAUXU; +#define cbAUXU sizeof(AUXU) +#define auxNil ((pAUXU)0) +#define iauxNil -1 + + +/* + * Optimization symbols + * + * Optimization symbols contain some overlap information with the normal + * symbol table. In particular, the proc information + * is somewhat redundant but necessary to easily find the other information + * present. + * + * All of the offsets are relative to the beginning of the last otProc + */ + +typedef struct { + unsigned ot: 8; /* optimization type */ + unsigned value: 24; /* address where we are moving it to */ + RNDXR rndx; /* points to a symbol or opt entry */ + unsigned long offset; /* relative offset this occured */ + } OPTR, *pOPTR; +#define optNil ((pOPTR) 0) +#define cbOPTR sizeof(OPTR) +#define ioptNil -1 + +/* + * File Indirect + * + * When a symbol is referenced across files the following procedure is used: + * 1) use the file index to get the File indirect entry. + * 2) use the file indirect entry to get the File descriptor. + * 3) add the sym index to the base of that file's sym table + * + */ + +typedef long RFDT, *pRFDT; +#define cbRFDT sizeof(RFDT) +#define rfdNil -1 + +/* + * The file indirect table in the mips loader is known as an array of FITs. + * This is done to keep the code in the loader readable in the area where + * these tables are merged. Note this is only a name change. + */ +typedef long FIT, *pFIT; +#define cbFIT sizeof(FIT) +#define ifiNil -1 +#define fiNil ((pFIT) 0) + +/* Dense numbers + * + * Rather than use file index, symbol index pairs to represent symbols + * and globals, we use dense number so that they can be easily embeded + * in intermediate code and the programs that process them can + * use direct access tabls instead of hash table (which would be + * necesary otherwise because of the sparse name space caused by + * file index, symbol index pairs. Dense number are represented + * by RNDXRs. + */ + +/* + * The following table defines the meaning of each SYM field as + * a function of the "st". (scD/B == scData OR scBss) + * + * Note: the value "isymMac" is used by symbols that have the concept + * of enclosing a block of related information. This value is the + * isym of the first symbol AFTER the end associated with the primary + * symbol. For example if a procedure was at isym==90 and had an + * isymMac==155, the associated end would be at isym==154, and the + * symbol at 155 would probably (although not necessarily) be the + * symbol for the next procedure. This allows rapid skipping over + * internal information of various sorts. "stEnd"s ALWAYS have the + * isym of the primary symbol that started the block. + * + +ST SC VALUE INDEX +-------- ------ -------- ------@0@a,04jul92,jcf cleaned up. +stFile scText address isymMac +stLabel scText address --- +stGlobal scD/B address iaux +stStatic scD/B address iaux +stParam scAbs offset iaux +stLocal scAbs offset iaux +stProc scText address iaux (isymMac is first AUX) +stStaticProc scText address iaux (isymMac is first AUX) + +stMember scNil ordinal --- (if member of enum) +stMember scNil byte offset iaux (if member of struct/union) +stMember scBits bit offset iaux (bit field spec) + +stBlock scText address isymMac (text block) +stBlock scNil cb isymMac (struct/union member define) +stBlock scNil cMembers isymMac (enum member define) + +stEnd scText address isymStart +stEnd scNil ------- isymStart (struct/union/enum) + +stTypedef scNil ------- iaux +stRegReloc sc??? value old register number +stForward sc??? new address isym to original symbol + +stConstant scInfo value --- (scalar) +stConstant scInfo iss --- (complex, e.g. string) + + * + */ + +/* --------------------------------------------------------- */ +/* | Copyright (c) 1986, 1989 MIPS Computer Systems, Inc. | */ +/* | All Rights Reserved. | */ +/* --------------------------------------------------------- */ +/* Revision 2.1.1.1 1993/06/07 15:55:11 wise + * project.initialize + * + * Revision 1.1 1993/06/07 11:11:14 wise + */ +/* + * Author Mark I. Himelstein + * Date Started 5/15/85 + * Purpose provide support to uc to produce mips symbol tables. + */ + +#if FALSE + +/* removed because global variable in header file causes compile problems */ + +AUXU _auxtemp; +#define AUXINT(c) ((_auxtemp.isym = c), _auxtemp) + +#endif /* FALSE */ + +/* the following struct frames the FDR dtructure and is used at runtime + * to access the objects in the FDR with pointers (since the FDR + * only has indeces. + */ +typedef struct { + pFDR pfd; /* file descriptor for this file */ + pSYMR psym; /* symbols for this file */ + long csymMax; /* max allocated */ + pAUXU paux; /* auxiliaries for this file */ + long cauxMax; /* max allocated */ + char *pss; /* strings space for this file */ + long cbssMax; /* max bytes allowed in ss */ + pOPTR popt; /* optimization table for this file */ + long coptMax; /* max allocated */ + pLINER pline; /* lines for this file */ + long clineMax; /* max allocated */ + pRFDT prfd; /* file indirect for this file */ + long crfdMax; /* max allocated */ + pPDR ppd; /* procedure descriptor tables */ + long cpdMax; /* max allocated */ + long freadin; /* set if read in */ + } CFDR, *pCFDR; +#define cbCFDR sizeof (CFDR) +#define cfdNil ((pCFDR) 0) +#define icfdNil -1 + + +/* the following struct embodies the HDRR dtructure and is used at runtime + * to access the objects in the HDRR with pointers (since the HDRR + * only has indeces. + */ +typedef struct { + long fappend; /* are we appending to this beast ? */ + pCFDR pcfd; /* the compile time file descriptors */ + pFDR pfd; /* all of the file descriptors in this cu */ + long cfd; /* count of file descriptors */ + long cfdMax; /* max file descriptors */ + pSYMR psym; /* the symbols for this cu */ + pEXTR pext; /* externals for this cu */ + long cext; /* number of externals */ + long cextMax; /* max currently allowed */ + char *pssext; /* string space for externals */ + long cbssext; /* # of bytes in ss */ + long cbssextMax; /* # of bytes allowed in ss */ + pAUXU paux; /* auxiliaries for this cu */ + char *pss; /* string space for this cu */ + pDNR pdn; /* dense number table for this cu */ + long cdn; /* number of dn's */ + long cdnMax; /* max currently allowed */ + pOPTR popt; /* optimization table for this cu */ + pLINER pline; /* lines for this cu */ + pRFDT prfd; /* file indirect for this cu */ + pPDR ppd; /* procedure descriptor tables */ + int flags; /* which has been read in already */ + int fswap; /* do dubtables need to be swapped */ + HDRR hdr; /* header from disk */ + } CHDRR, *pCHDRR; +#define cbCHDRR sizeof (CHDRR) +#define chdrNil ((pCHDRR) 0) +#define ichdrNil -1 + +/* constants and macros */ + +#define ST_FILESINIT 25 /* initial number of files */ +#define ST_STRTABINIT 512 /* initial number of bytes in strring space */ +#define ST_EXTINIT 32 /* initial number of symbols/file */ +#define ST_SYMINIT 64 /* initial number of symbols/file */ +#define ST_AUXINIT 64 /* initial number of auxiliaries/file */ +#define ST_LINEINIT 512 /* initial number of auxiliaries/file */ +#define ST_PDINIT 32 /* initial number of procedures in one file */ +#define ST_DNINIT 128 /* initial # of dense numbers */ +#define ST_FDISS 1 /* we expect a fd's iss to be this */ +#define ST_IDNINIT 2 /* start the dense num tab with this entry */ +#define ST_PROCTIROFFSET 1 /* offset from aux of proc's tir */ +#define ST_RELOC 1 /* this sym has been reloced already */ + +#define ST_EXTIFD 0x7fffffff /* ifd for externals */ +#define ST_RFDESCAPE 0xfff /* rndx.rfd escape says next aux is rfd */ +#define ST_ANONINDEX 0xfffff /* rndx.index for anonymous names */ +#define ST_PEXTS 0x01 /* mask, if set externals */ +#define ST_PSYMS 0x02 /* mask, if set symbols */ +#define ST_PLINES 0x04 /* mask, if set lines */ +#define ST_PHEADER 0x08 /* mask, if set headers */ +#define ST_PDNS 0x10 /* mask, if set dense numbers */ +#define ST_POPTS 0x20 /* mask, if set optimization entries */ +#define ST_PRFDS 0x40 /* mask, if set file indirect entries */ +#define ST_PSSS 0x80 /* mask, if set string space */ +#define ST_PPDS 0x100 /* mask, if set proc descriptors */ +#define ST_PFDS 0x200 /* mask, if set file descriptors */ +#define ST_PAUXS 0x400 /* mask, if set auxiliaries */ +#define ST_PSSEXTS 0x800 /* mask, if set external string space */ + +#define ST_FCOMPLEXBT(bt) ((bt == btStruct) || (bt == btUnion) || (bt == btTypedef) || (bt == btEnum)) +#define valueNil 0 +#define export + +/* + * Constants to describe aux types used in swap_aux( , ,type); + */ +#define ST_AUX_TIR 0 +#define ST_AUX_RNDXR 1 +#define ST_AUX_DNLOW 2 +#define ST_AUX_DNMAC 3 +#define ST_AUX_ISYM 4 +#define ST_AUX_ISS 5 +#define ST_AUX_WIDTH 6 + +/* Revision 2.1.1.1 1993/06/07 15:55:11 wise + * project.initialize + * + * Revision 1.1 1993/06/07 11:11:14 wise + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCecoffSymsh */ diff --git a/h/edrErrLogLib.h b/h/edrErrLogLib.h new file mode 100644 index 0000000..9000762 --- /dev/null +++ b/h/edrErrLogLib.h @@ -0,0 +1,202 @@ +/* edrErrLogLib - edrErrLogLib header file */ + +/* Copyright (c) 2003 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01h,17sep04,md add prototypes for node protection functions +01g,26aug04,md make record size configurable +01f,05aug04,md added committed state tracking +01e,30mar04,md bump payload size to 4096 bytes +01d,16feb04,md general cleanup and documentation +01c,06nov03,aim reworked iterators +01b,05nov03,aim reworked for intLock/intUnlock +01a,24oct03,aim created +*/ + +#ifndef __INCedrErrLogLib_h +#define __INCedrErrLogLib_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + +/* + +The structure of the error log in memory is as follows: + + +------------------------+ ----+ + | endianness | | + | magic | | + | version | | + +-> | payloadSize | | + | | nodeSize | | -- EDR_ERR_LOG_HEADER + | | size | | + | | nPages | | + | | nHeaderPages | | + | | *pageProtect | | + | | osVersion | | + | | cpuType | | + | | reserved [32] | | + | +------------------------+ ----+ + +--- | checksum | + +------------------------+ + | modCount | + +------------------------+ + | genCount | + +------------------------+ + | bootCount | + +------------------------+ + | missedErrors | + +------------------------+ + | reserved [32] | + +------------------------+ + +------------------------+ ----+ + | maxNodeCount | | + | oldestNode | | + | nextNode | |-- EDR_ERR_LOG_NODE_LIST + | nodeCount | | + | reserved [32] | | + +------------------------+ | + +------------------------+ | + | status | ---------+ + | position | | | + | genCount | | | + | logGenCount | | |-- EDR_ERR_LOG_NODE + | bootCount | | | + | committed | | | + | reserved [32] | | | + | data [] | ---------+ + +------------------------+ | + | status | | + | position | | + | genCount | | + | logGenCount | | + | bootCount | | + | committed | | + | reserved [32] | | + | data [] | | + +------------------------+ | + | status | | + | position | | + | genCount | | + | logGenCount | | + | bootCount | | + | committed | | + | reserved [32] | | + | data [] | | + +------------------------+ | + | status | | + | position | | + | genCount | | + | logGenCount | | + | bootCount | | + | committed | | + | reserved [32] | | + | data [] | | + +------------------------+ | + | . | | + | . | | + | . | | + | . | | + | . | | + +------------------------+ ----+ +*/ + +/* default payload size for each record */ + +#define EDR_ERR_LOG_PAYLOAD_SIZE 4096 + +/* minimum payload size for each record */ + +#define EDR_ERR_LOG_MIN_PAYLOAD_SIZE 512 + +typedef struct edr_err_log_node + { + int status; /* current status of this node */ + UINT32 position; /* abs position of record in log */ + UINT32 genCount; /* generation count of node */ + UINT32 logGenCount; /* log gen count we belong to */ + UINT32 bootCount; /* boot count indicator */ + UINT32 committed; /* committed/uncommitted state */ + UINT32 reserved [32]; /* reserved for future use */ + char data [1]; /* payload */ + } EDR_ERR_LOG_NODE; + +typedef struct edr_err_log_node_list + { + int maxNodeCount; /* maximum number of nodes */ + int oldestNode; /* index of oldest node */ + int nextNode; /* index of next free node */ + int nodeCount; /* number of nodes[] inuse */ + UINT32 reserved [32]; /* reserved for future use */ + EDR_ERR_LOG_NODE node [1]; /* variable-sized set of nodes */ + } EDR_ERR_LOG_NODE_LIST; + +typedef struct edr_err_log_header + { + int endianness; /* endianness identifier */ + int magic; /* log identifier */ + int version; /* log version number */ + int payloadSize; /* payload size (in bytes) */ + int nodeSize; /* node size (in bytes) */ + int size; /* log size (in bytes) */ + UINT32 nPages; /* log size (in pages) */ + UINT32 nHeaderPages; /* number of pages for header */ + UINT32 *pageProtect; /* page protection counts */ + UINT32 osVersion; /* version of OS/ED&R */ + UINT32 cpuType; /* WindRiver CPU type code */ + UINT32 reserved [32]; /* reserved for future use */ + } EDR_ERR_LOG_HEADER; + +typedef struct edr_err_log + { + EDR_ERR_LOG_HEADER header; /* log header */ + INT32 checksum; /* checksum for the header */ + + UINT32 modCount; /* co-modification count */ + UINT32 genCount; /* generation count of error log */ + UINT32 bootCount; /* boot count indicator */ + UINT32 missedErrors; /* missed error count */ + UINT32 reserved [32]; /* reserved for future use */ + EDR_ERR_LOG_NODE_LIST nodeList; /* nodes; must be last member */ + } EDR_ERR_LOG; + +typedef struct edr_err_log_iter + { + EDR_ERR_LOG * pLog; /* log instance being iterated */ + int nodeCount; /* number of nodes to iterate */ + int nodeIndex; /* current node */ + int maxNodeCount; /* maximum node count */ + } EDR_ERR_LOG_ITER; + +BOOL edrErrLogValidate (EDR_ERR_LOG * pLog); +EDR_ERR_LOG * edrErrLogCreate (void * pAddr, int size, int recordSize); +BOOL edrErrLogIterCreate (EDR_ERR_LOG * pLog, EDR_ERR_LOG_ITER * pIter, + int start, int count); +EDR_ERR_LOG_NODE * edrErrLogIterNext (EDR_ERR_LOG_ITER * pIter); +EDR_ERR_LOG * edrErrLogAttach (void * pAddr); +BOOL edrErrLogClear (EDR_ERR_LOG * pLog); +BOOL edrErrLogNodeCommit (EDR_ERR_LOG * pLog, EDR_ERR_LOG_NODE * pNode); +EDR_ERR_LOG_NODE * edrErrLogNodeAlloc (EDR_ERR_LOG * pLog); +int edrErrLogNodeCount (EDR_ERR_LOG * pLog); +int edrErrLogSize (EDR_ERR_LOG * pLog); +int edrErrLogMaxNodeCount (EDR_ERR_LOG * pLog); +int edrErrLogNodePosition (EDR_ERR_LOG * pLog, EDR_ERR_LOG_NODE *pNode); +int edrErrLogNodeClear (EDR_ERR_LOG * pLog, EDR_ERR_LOG_NODE * pNode); +int edrErrLogRemoveHead (EDR_ERR_LOG * pLog); +STATUS edrErrLogHeaderProtect (EDR_ERR_LOG *pLog); +STATUS edrErrLogHeaderUnprotect (EDR_ERR_LOG *pLog); +STATUS edrErrLogNodeProtect (EDR_ERR_LOG *pLog, EDR_ERR_LOG_NODE *pNode); +STATUS edrErrLogNodeUnprotect (EDR_ERR_LOG *pLog, EDR_ERR_LOG_NODE *pNode); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCedrErrLogLib_h */ diff --git a/h/edrLib.h b/h/edrLib.h new file mode 100644 index 0000000..4d47a77 --- /dev/null +++ b/h/edrLib.h @@ -0,0 +1,489 @@ +/* edrLib.h - Error Detection and Reporting subsystem */ + +/* Copyright (c) 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +03d,12aug05,yvp Moved vxLibCfgDefsP.h to h/sys. +03c,25jul04,md added scalability of injection macros +03b,23sep04,md fix macros to avoid warnings +03a,10sep04,md added passing injection message to policy handlers +02z,26aug04,md make record size configurable +02y,23aug04,md added new style hook routines +02x,29jul04,md added edrSystemDebugModeInit() +02w,21jul04,md add text injection hook prototypes +02v,30jun04,md fix for SPR 98727 +02u,07jun04,md add additional fields for a memory map +02t,21may04,md added inject options +02s,11may04,md added support for encoding OS version +02r,06may04,md added prototype for edrShellCmdInit() +02p,28apr04,elg Modify EDR macro prototype. +02o,06apr04,pes clean up compilation warnings. +02n,20apr04,md move private entries to edrLibP.h +02m,30mar04,md convert some fields to ascii instead of binary data +02l,11mar04,md add ED&R printf like output routines +02k,03feb04,md move common RTP defines to edrLibCommon.h +02j,11nov03,dbs update policy handler prototypes +02i,06nov03,dbs add INIT facility +02h,04nov03,dbs move error-log and record structures into edrErrLogLib.h +02g,31oct03,dbs add support for user-mode (RTP) error injection +02f,24oct03,dbs re-implement stack tracing +02e,15oct03,dbs add API to get boot count +02d,06oct03,dbs re-introduce optional stack-trace arg to EDR_USER_INJECT +02c,29sep03,dbs use setjmp() to get current regs in user-inject case +02b,25sep03,dbs implement ED&R system policies +02a,24sep03,dbs add prototype for edrHelp, add stack trace to REBOOT event +01z,18sep03,dbs add user inject macro +01y,17sep03,dbs add pre- and post-hooks +01x,17sep03,dbs add hook for error-injection +01w,12sep03,dbs reduce interrupt latency, introduce N-deep buffering +01v,11sep03,dbs record init failures, display in edrShow as necessary +01u,10sep03,dbs add edrErrorInject wrapper, remove reliance on funcptr +01t,29aug03,dbs update after review comments +01s,19aug03,dbs add ED&R system debug mode flag +01r,18aug03,dbs fix error codes +01q,18aug03,dbs add _func_edrErrorInject +01p,13aug03,aim added symbol names to stack trace +01o,11aug03,aim added boot count to error log header +01n,07aug03,dbs add extended ED&R show routines +01m,06aug03,dbs allow for more than one PM arena +01l,04aug03,dbs move 'missed errors' count into error-log +01k,31jul03,dbs use named constants for stack-trace and code-dump +01j,31jul03,dbs add separate edrShow component +01i,31jul03,dbs add transaction-like guards against errors early in boot +01h,30jul03,dbs add edrErrorRecordShow routine +01g,28jul03,dbs change 'location' to 'facility' and allow more of them +01f,28jul03,dbs add more error codes +01e,25jul03,dbs add fields to allow version checking + introduce EDR_ERROR_LOG structure +01d,18jul03,dbs improve printing of error records +01c,18jul03,dbs update for memLogLib changes +01b,17jul03,dbs add error codes +01a,15jul03,dsellars created +*/ + +#ifndef __INCedrLib_h +#define __INCedrLib_h + +#include +#include "vxWorks.h" +#include "setjmp.h" +#include "edrErrLogLib.h" +#include "regs.h" +#include "excLib.h" +#include "edrLibCommon.h" +#include "sys/vxLibCfgDefsP.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* version of ED&R record format we're currently using */ + +#define EDR_VERSION 1 + +/* IMPORTANT: do NOT add members to the middle of this structure, only + * to the end (but before 'text'). Offsets to the textual data are + * stored as offsets from the beginning of the structure, so it it + * still possible to read an OLDER kind of error-record. + * + * The 'size' field determines the actual number of bytes in the + * entire record, including all the trailing text. The 'size_of' field + * indicates the size of the structure (i.e. sizeof(EDR_ERROR_RECORD) + * at the time the system which generated this record was + * compiled. This allows edrLib to handle error records from older + * systems compatibly. + */ + +typedef struct edr_error_record + { + UINT32 version; /* version identifier */ + UINT32 size; /* actual size of entire record */ + /* incl. trailing text */ + UINT32 size_of; /* sizeof(EDR_ERROR_RECORD) */ + UINT32 kind; /* severity / facility */ + UINT32 flags; /* error-record options */ + UINT32 ticks; /* VxWorks time stamp */ + time_t time; /* calendar time */ + UINT32 osVersion; /* version of OS/ED&R */ + UINT32 cpuNumber; /* CPU number (e.g. for MP) */ + UINT32 cpuType; /* WindRiver CPU type code */ + UINT32 bootCycle; /* the bootCount this error */ + /* was recorded in. */ + int taskIdCurrent; /* ID of executing task */ + int rtpIdCurrent; /* ID of executing RTP */ + int rtpAddrStart; /* start address of RTP space */ + int rtpAddrEnd; /* end address of RTP space */ + INSTR * codeAddress; /* address of code fragment */ + int lineNumber; /* line number in source file */ + int reserved[8]; /* reserved for future use */ + int offsetFileName; /* offset to source file name */ + int offsetTaskName; /* offset to task name */ + int offsetRtpName; /* offset to RTP name */ + int offsetMemoryMap; /* offset to memory map */ + int offsetExcinfo; /* offset to exception info */ + int offsetRegisters; /* offset to registers */ + int offsetDisassembly; /* offset to code disassembly */ + int offsetTraceback; /* offset to stack traceback */ + int offsetPayload; /* offset to text payload */ + /*************** IMPORTANT: ADD NEW FIELDS HERE! ********************/ + char text [4]; /* beginning of all textual info*/ + } EDR_ERROR_RECORD; + +/* mask and shift counts for encoding version number in osVersion field */ + +#define EDR_OS_VERSION_MAJOR_MASK 0xff +#define EDR_OS_VERSION_MAJOR_SHIFT 16 +#define EDR_OS_VERSION_MINOR_MASK 0xff +#define EDR_OS_VERSION_MINOR_SHIFT 8 +#define EDR_OS_VERSION_MAINT_MASK 0xff +#define EDR_OS_VERSION_MAINT_SHIFT 0 + +/* optional information which may be provided for RTP policy handling */ + +typedef struct + { + RTP_ID rtpId; /* RTP's id */ + int taskId; /* task id within RTP */ + int options; /* options to use when deleting */ + int status; /* exit status to provide when deleting */ + int vector; /* exception vector number */ + char * pEsf; /* exception frame pointer */ + REG_SET * pRegs; /* exception register set */ + EXC_INFO * pExcInfo; /* exception information */ + BOOL isException; /* are we handling an exception? */ + const char *msg; /* ED&R record optional message */ + } EDR_RTP_INFO; + +/* optional information which may be provided for task policy handling */ + +typedef struct + { + int taskId; /* task's id */ + int status; /* exit status to use when deleting */ + int vector; /* exception vector number */ + char * pEsf; /* exception frame pointer */ + REG_SET * pRegs; /* exception register set */ + EXC_INFO * pExcInfo; /* exception information */ + BOOL isException; /* are we handling an exception? */ + const char *msg; /* ED&R record optional message */ + } EDR_TASK_INFO; + +/* optional information which may be provided for interrupt policy handling */ + +typedef struct + { + int vector; /* exception vector number */ + char * pEsf; /* exception frame pointer */ + REG_SET * pRegs; /* exception register set */ + EXC_INFO * pExcInfo; /* exception information */ + BOOL isException; /* are we handling an exception? */ + const char *msg; /* ED&R record optional message */ + } EDR_INTERRUPT_INFO; + +/* optional information which may be provided for init policy handling */ + +typedef struct + { + int vector; /* exception vector number */ + char * pEsf; /* exception frame pointer */ + REG_SET * pRegs; /* exception register set */ + EXC_INFO * pExcInfo; /* exception information */ + BOOL isException; /* are we handling an exception? */ + const char *msg; /* ED&R record optional message */ + } EDR_INIT_INFO; + +/* + * The type of a hook-function for error injection. It gets called + * back for every error that is injected. + */ + +typedef void (*EDR_ERRINJ_HOOK_FUNCPTR) ( + int kind, /* severity | facility */ + const char * fileName, /* name of source file */ + int lineNumber, /* line number of source code */ + void * address, /* faulting address */ + const char * msg /* additional text string */ + ); + +/* + * The type of a hook-function for additional text error injection. It gets + * called back for every error that is injected. + */ + +typedef int (*EDR_ERRINJ_TEXT_HOOK_FUNCPTR) ( + char * p, /* pointer to buffer */ + int size, /* size of buffer */ + int kind, /* severity | facility */ + const char * fileName, /* name of source file */ + int lineNumber, /* line number of source code */ + void * address /* faulting address */ + ); + +/* + * The type of a hook-function for pre/post hooks. + */ + +typedef void (*EDR_HOOK_FUNCPTR) ( + int type /* pre/post injection indicator */ + ); + +#define EDR_HOOK_TYPE_PRE 0 /* hook called pre injection */ +#define EDR_HOOK_TYPE_POST 1 /* hook called post injectsion */ + +/* defines */ + +/* init status - 0,1 are boolean uninit/init, negative values are errors */ + +#define EDR_INIT_UNINITIALIZED (0) +#define EDR_INIT_OK (1) +#define EDR_INIT_edrErrLogCreate_FAILED (-1) +#define EDR_INIT_edrErrLogAttach_FAILED (-2) +#define EDR_INIT_pmRegionSize_FAILED (-3) +#define EDR_INIT_pmRegionAddr_FAILED (-4) +#define EDR_INIT_pmRegionProtect_FAILED (-5) +#define EDR_INIT_pmRegionCreate_FAILED (-6) +#define EDR_INIT_PM_FAILURE (-7) +#define EDR_INIT_ERROR_LOG_NEWER (-8) + +/* maximum number of inject hook callout routines */ + +#define EDR_MAX_INJECT_HOOK_RTNS 16 /* general injection hooks */ +#define EDR_MAX_INJECT_TEXT_HOOK_RTNS 16 /* text injection hooks */ +#define EDR_MAX_INJECT_PP_HOOK_RTNS 16 /* pre/post injection hooks */ + +/* system generated ED&R fatal messages */ + +/* Kernel fatal errors */ + +#define EDR_KERNEL_FATAL_INJECT_FULL(taskInfo, regs, excinfo, pc, reason) \ + do { \ + EDR_TASK_INFO *p = taskInfo; \ + EDR_INJECT(EDR_SEVERITY_FATAL | EDR_FACILITY_KERNEL, \ + __FILE__, __LINE__, regs, excinfo, pc, reason); \ + if ((p != NULL)) \ + p->msg = reason; \ + edrKernelFatalPolicyHandler(taskInfo); \ + } while ((0)) + +#ifdef INCLUDE_FULL_EDR_STUBS +# define EDR_KERNEL_FATAL_INJECT(taskInfo, regs, excinfo, pc, reason) \ + EDR_KERNEL_FATAL_INJECT_FULL(taskInfo, regs, excinfo, pc, reason) +#else +# define EDR_KERNEL_FATAL_INJECT(taskInfo, regs, excinfo, pc, reason) \ + edrKernelFatalPolicyHandler(taskInfo) +#endif + + +/* Interrupt fatal errors */ + +#define EDR_INTERRUPT_FATAL_INJECT_FULL(intInfo, regs, excinfo, pc, reason) \ + do { \ + EDR_INTERRUPT_INFO *p = intInfo; \ + EDR_INJECT(EDR_SEVERITY_FATAL | EDR_FACILITY_INTERRUPT, \ + __FILE__, __LINE__, regs, excinfo, pc, reason); \ + if ((p != NULL)) \ + p->msg = reason; \ + edrInterruptFatalPolicyHandler(intInfo); \ + } while ((0)) + +#ifdef INCLUDE_FULL_EDR_STUBS +# define EDR_INTERRUPT_FATAL_INJECT(intInfo, regs, excinfo, pc, reason) \ + EDR_INTERRUPT_FATAL_INJECT_FULL(intInfo, regs, excinfo, pc, reason) +#else +# define EDR_INTERRUPT_FATAL_INJECT(intInfo, regs, excinfo, pc, reason) \ + edrInterruptFatalPolicyHandler(intInfo) +#endif + + +/* Init fatal errors */ + +#define EDR_INIT_FATAL_INJECT_FULL(initInfo, regs, excinfo, pc, reason) \ + do { \ + EDR_INIT_INFO *p = initInfo; \ + EDR_INJECT(EDR_SEVERITY_FATAL | EDR_FACILITY_INIT, \ + __FILE__, __LINE__, regs, excinfo, pc, reason); \ + if ((p != NULL)) \ + p->msg = reason; \ + edrInitFatalPolicyHandler(initInfo); \ + } while ((0)) + +#ifdef INCLUDE_FULL_EDR_STUBS +# define EDR_INIT_FATAL_INJECT(initInfo, regs, excinfo, pc, reason) \ + EDR_INIT_FATAL_INJECT_FULL(initInfo, regs, excinfo, pc, reason) +#else +# define EDR_INIT_FATAL_INJECT(initInfo, regs, excinfo, pc, reason) \ + edrInitFatalPolicyHandler(initInfo) +#endif + + +/* RTP fatal errors */ + +#define EDR_RTP_FATAL_INJECT_FULL(rtpInfo, regs, excinfo, pc, reason) \ + do { \ + EDR_RTP_INFO *p = rtpInfo; \ + EDR_INJECT(EDR_SEVERITY_FATAL | EDR_FACILITY_RTP, \ + __FILE__, __LINE__, regs, excinfo, pc, reason); \ + if ((p != NULL)) \ + p->msg = reason; \ + edrRtpFatalPolicyHandler(rtpInfo); \ + } while ((0)) + +#ifdef INCLUDE_FULL_EDR_STUBS +# define EDR_RTP_FATAL_INJECT(rtpInfo, regs, excinfo, pc, reason) \ + EDR_RTP_FATAL_INJECT_FULL(rtpInfo, regs, excinfo, pc, reason) +#else +# define EDR_RTP_FATAL_INJECT(rtpInfo, regs, excinfo, pc, reason) \ + edrRtpFatalPolicyHandler(rtpInfo) +#endif + + +/* system generated ED&R boot/reboot messages */ + +#define EDR_BOOT_INJECT(msg) \ + EDR_INJECT_TRACE(EDR_SEVERITY_INFO, EDR_FACILITY_BOOT, \ + EDR_EXCLUDE_MEMORYMAP, FALSE, msg) + +#define EDR_REBOOT_INJECT(msg) \ + EDR_INJECT_TRACE(EDR_SEVERITY_INFO, EDR_FACILITY_REBOOT, \ + EDR_EXCLUDE_REGISTERS, TRUE, msg) + + +/* user generated ED&R messages */ + +#define EDR_USER_INFO_INJECT(trace, msg) \ + EDR_INJECT_TRACE(EDR_SEVERITY_INFO, EDR_FACILITY_USER, 0, trace, msg) + +#define EDR_USER_WARNING_INJECT(trace, msg) \ + EDR_INJECT_TRACE(EDR_SEVERITY_WARNING, EDR_FACILITY_USER, 0, trace, msg) + +#define EDR_USER_FATAL_INJECT(trace, msg) \ + EDR_INJECT_TRACE(EDR_SEVERITY_FATAL, EDR_FACILITY_USER, 0, trace, msg) + + +/* macros for injecting ED&R records */ + +#define EDR_INJECT(kind, file, line, regs, exc, addr, msg) \ + edrErrorInjectStub (kind, file, line, regs, exc, addr, msg) + +#define EDR_INJECT_TRACE_FULL(sev, fac, opt, trace, msg) \ + do { \ + REG_SET *pRegs = NULL; \ + jmp_buf env; \ + int doTrace=trace; \ + if ((doTrace != 0) && (setjmp(env) == 0)) { pRegs = &env[0].reg; } \ + EDR_INJECT(sev|fac|opt, __FILE__, __LINE__, pRegs, NULL, NULL, msg); \ + } while ((0)) + +#ifdef INCLUDE_FULL_EDR_STUBS +# define EDR_INJECT_TRACE(sev, fac, opt, trace, msg) \ + EDR_INJECT_TRACE_FULL(sev, fac, opt, trace, msg) +#else +# define EDR_INJECT_TRACE(sev, fac, opt, trace, msg) \ + EDR_INJECT(sev|fac|opt, NULL, 0, NULL, NULL, NULL, msg) +#endif + + +/* globals */ + +extern BOOL edrLibInstalled; + +/* functions */ + +extern void* edrPmArena (UINT32*); +extern int edrPmRegion (void); + +extern int edrLibInit (BOOL isNew, int recordSize); + +extern STATUS edrSymLibInit (void); + +extern STATUS edrErrorInjectStub + ( + int kind, /* severity | facility */ + const char * fileName, /* name of source file */ + int lineNumber, /* line number of source code */ + const REG_SET * pRegSet, /* current register values */ + const EXC_INFO * pExcInfo, /* CPU-specific exception info */ + void* addr, /* faulting address (e.g. PC) */ + const char * msg /* additional text string */ + ); + +extern STATUS edrErrorInject + ( + int kind, /* severity | facility | option */ + const char * fileName, /* name of source file */ + int lineNumber, /* line number of source code */ + const REG_SET * pRegSet, /* current register values */ + const EXC_INFO * pExcInfo, /* CPU-specific exception info */ + void* addr, /* faulting address (e.g. PC) */ + const char * msg /* additional text string */ + ); + +extern int edrErrorRecordCount (void); + +extern STATUS edrErrorRecordDecode + ( + EDR_ERROR_RECORD* pER, /* pointer to error record */ + char * pBuf, /* pointer to output buffer */ + int bufSize /* size of output buffer */ + ); + +extern STATUS edrErrorLogClear (void); + +/* debug flag manipulation routines */ + +extern STATUS edrSystemDebugModeInit (void); +extern BOOL edrSystemDebugModeGet (void); +extern void edrSystemDebugModeSet (BOOL mode); +extern BOOL edrIsDebugMode(void); + +/* hook manipulation routines */ + +extern STATUS edrErrorInjectHookAdd (EDR_ERRINJ_HOOK_FUNCPTR hook); +extern STATUS edrErrorInjectHookDelete (EDR_ERRINJ_HOOK_FUNCPTR hook); + +extern STATUS edrErrorInjectPrePostHookAdd (VOIDFUNCPTR hook); +extern STATUS edrErrorInjectPrePostHookDelete (VOIDFUNCPTR hook); + +extern STATUS edrErrorInjectTextHookAdd (EDR_ERRINJ_TEXT_HOOK_FUNCPTR hook); +extern STATUS edrErrorInjectTextHookDelete (EDR_ERRINJ_TEXT_HOOK_FUNCPTR hook); + +extern int edrBootCountGet (void); + +extern STATUS edrPolicyHandlerHookAdd (VOIDFUNCPTR hook); +extern STATUS edrPolicyHandlerHookRemove (void); +extern VOIDFUNCPTR edrPolicyHandlerHookGet (void); + +/* system policy routines */ + +extern void edrKernelFatalPolicyHandler (EDR_TASK_INFO *); +extern void edrInterruptFatalPolicyHandler (EDR_INTERRUPT_INFO *); +extern void edrRtpFatalPolicyHandler (EDR_RTP_INFO *); +extern void edrInitFatalPolicyHandler (EDR_INIT_INFO *); + +/* show routines */ + +extern STATUS edrShowInit (void); +extern STATUS edrShow (int start, int count, int facility, int severity); +extern STATUS edrFatalShow (int start, int count); +extern STATUS edrInfoShow (int start, int count); +extern STATUS edrIntShow (int start, int count); +extern STATUS edrInitShow (int start, int count); +extern STATUS edrRebootShow (int start, int count); +extern STATUS edrBootShow (int start, int count); +extern STATUS edrKernelShow (int start, int count); +extern STATUS edrUserShow (int start, int count); +extern STATUS edrRtpShow (int start, int count); + +/* misc routines */ + +extern STATUS edrClear (void); +extern STATUS edrHelp (void); +extern STATUS edrShellCmdInit (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCedrLib_h */ diff --git a/h/edrLibCommon.h b/h/edrLibCommon.h new file mode 100644 index 0000000..cc9daa9 --- /dev/null +++ b/h/edrLibCommon.h @@ -0,0 +1,87 @@ +/* edrLibCommon.h - Error Detection and Reporting subsystem */ + +/* Copyright (c) 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,23aug04,md add additional errno values +01c,07jun04,md add memory map option flag +01b,21may04,md add option flags +01a,02feb04,md created +*/ + +#ifndef __INCedrLibCommon_h +#define __INCedrLibCommon_h + +#include +#include "vxWorks.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/* defines */ + +/* severity levels */ + +#define EDR_SEVERITY_FATAL 0x00001 +#define EDR_SEVERITY_NONFATAL 0x00002 +#define EDR_SEVERITY_WARNING 0x00003 +#define EDR_SEVERITY_INFO 0x00004 + +#define EDR_SEVERITY_MASK 0x0000f + +/* facilities for system/kernel space use */ + +#define EDR_FACILITY_KERNEL 0x00010 /* VxWorks kernel events */ +#define EDR_FACILITY_INTERRUPT 0x00020 /* interrupt handler events */ +#define EDR_FACILITY_INIT 0x00030 /* system startup events */ +#define EDR_FACILITY_BOOT 0x00040 /* system boot events */ +#define EDR_FACILITY_REBOOT 0x00050 /* system restart events */ + +/* facilities for user-level (RTP) space use */ + +#define EDR_FACILITY_RTP 0x00100 /* RTP system events */ +#define EDR_FACILITY_USER 0x00200 /* user generated events */ + +#define EDR_FACILITY_MASK 0x00ff0 + +/* error injection options */ + +#define EDR_EXCLUDE_REGISTERS 0x01000 /* don't include registers */ +#define EDR_EXCLUDE_TRACEBACK 0x02000 /* don't include stack trace */ +#define EDR_EXCLUDE_EXCINFO 0x04000 /* don't include exc info */ +#define EDR_EXCLUDE_DISASSEMBLY 0x08000 /* don't include code dis. */ +#define EDR_EXCLUDE_MEMORYMAP 0x10000 /* don't include memory map */ + +#define EDR_OPTIONS_MASK 0xff000 + +/* error codes */ + +#define S_edrLib_NOT_INITIALIZED (M_edrLib | 1) +#define S_edrLib_ERRLOG_CORRUPTED (M_edrLib | 2) +#define S_edrLib_ERRLOG_INCOMPATIBLE (M_edrLib | 3) +#define S_edrLib_PROTECTION_FAILURE (M_edrLib | 4) +#define S_edrLib_PMREGION_ERROR (M_edrLib | 5) +#define S_edrLib_INVALID_OPTION (M_edrLib | 6) +#define S_edrLib_INJECT_HOOK_TABLE_FULL (M_edrLib | 7) +#define S_edrLib_INJECT_HOOK_NOT_FOUND (M_edrLib | 8) +#define S_edrLib_TEXT_HOOK_TABLE_FULL (M_edrLib | 9) +#define S_edrLib_TEXT_HOOK_NOT_FOUND (M_edrLib | 10) +#define S_edrLib_PP_HOOK_TABLE_FULL (M_edrLib | 11) +#define S_edrLib_PP_HOOK_NOT_FOUND (M_edrLib | 12) + +/* ED&R mode flags */ + +#define EDR_FLAG_DEBUG 0x01 +#define EDR_FLAG_MASK 0x7fffffff + +extern int edrFlagsGet(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCedrLibCommon_h */ diff --git a/h/elf.h b/h/elf.h new file mode 100644 index 0000000..80e2af2 --- /dev/null +++ b/h/elf.h @@ -0,0 +1,395 @@ +/* elf.h - standard header file used by ld, ar, as & loaders */ + +/* + * Copyright (c) 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + + +/* +modification history +-------------------- +01p,17aug05,dbt Updated to use a specific architecture specific file for + simulators. +01o,25jul05,v_r Complete loader's XXX review. + Added EM_COLDFIRE. +01n,13jun05,jmp added missing elfI86.h inclusion. +01m,18sep04,jn Move towards shared code for host and target loaders +01l,11apr04,jn Add extra section flags for gnu read only data sections +01k,27mar04,jn Make elf.h and elftypes.h shared with the host (target + server) +01j,20jun03,nwd Deliver of Tornado 2.2 Cumulative Patch 1 +01a,30apr03,jn derived from Diab elftypes.h header file + /vobs/rome_diab_lib/dlib/include/include.unx/ + elf.h@@/main/15 + and /.wind_vxw_h/river/target/h/vxWorks.h@@/main/tor2/1 + (for elements of Wind River coding standards). + Changed definition of STT_ARM_TFUNC to STT_LOPROC and + added definition of STT_ARM_16BIT (using STT_HIPROC). + Added arch-specific include's. +*/ + +#ifndef __INCelfh +#define __INCelfh + +#ifdef __cplusplus +extern "C" { +#endif + +/************** Exported data, types and macros *****************/ + +#include /* Include the vxWorks version, not the host version. */ + +/* + * Elf header + */ +#define EI_NIDENT 16 + +typedef struct { + unsigned char e_ident[EI_NIDENT]; + Elf32_Half e_type; + Elf32_Half e_machine; + Elf32_Word e_version; + Elf32_Addr e_entry; + Elf32_Off e_phoff; + Elf32_Off e_shoff; + Elf32_Word e_flags; + Elf32_Half e_ehsize; + Elf32_Half e_phentsize; + Elf32_Half e_phnum; + Elf32_Half e_shentsize; + Elf32_Half e_shnum; + Elf32_Half e_shstrndx; +} Elf32_Ehdr; + +#define EHDRSZ sizeof(Elf32_Ehdr) + +/* + * e_ident[] values + */ +#define EI_MAG0 0 +#define EI_MAG1 1 +#define EI_MAG2 2 +#define EI_MAG3 3 +#define EI_CLASS 4 +#define EI_DATA 5 +#define EI_VERSION 6 +#define EI_PAD 7 + +#define ELFMAG0 0x7f +#define ELFMAG1 'E' +#define ELFMAG2 'L' +#define ELFMAG3 'F' +#define ELFMAG "\177ELF" +#define SELFMAG 4 + +/* + * EI_CLASS + */ +#define ELFCLASSNONE 0 +#define ELFCLASS32 1 +#define ELFCLASS64 2 + +/* + * EI_DATA + */ +#define ELFDATANONE 0 +#define ELFDATA2LSB 1 +#define ELFDATA2MSB 2 + +/* + * e_type + */ +#define ET_NONE 0 +#define ET_REL 1 +#define ET_EXEC 2 +#define ET_DYN 3 +#define ET_CORE 4 +#define ET_LOPROC 0xff00 +#define ET_HIPROC 0xffff + +/* + * e_machine + */ +#define EM_NONE 0 /* No machine */ +#define EM_M32 1 /* AT&T WE 32100 */ +#define EM_SPARC 2 /* SPARC */ +#define EM_386 3 /* Intel 80386 */ +#define EM_68K 4 /* Motorola 68000 */ +#define EM_88K 5 /* Motorola 88000 */ +#define EM_486 6 /* Intel 80486 */ +#define EM_860 7 /* Intel 80860 */ +#define EM_MIPS 8 /* MIPS RS3000 Big-Endian */ +#define EM_MIPS_RS4_BE 10 /* MIPS RS4000 Big-Endian */ +#define EM_PPC_OLD 17 /* PowerPC - old */ +#define EM_PPC 20 /* PowerPC */ +#define EM_RCE_OLD 25 /* RCE - old */ +#define EM_NEC_830 36 /* NEC 830 series */ +#define EM_RCE 39 /* RCE */ +#define EM_MCORE 39 /* MCORE */ +#define EM_ARM 40 /* ARM */ +#define EM_SH 42 /* SH */ +#define EM_COLDFIRE 52 /* Motorola ColdFire */ +#define EM_SC 58 /* SC */ +#define EM_M32R 36929 /* M32R */ +#define EM_NEC 36992 /* NEC 850 series */ + +/* + * e_flags + */ +#define EF_PPC_EMB 0x80000000 + +#define EF_MIPS_NOREORDER 0x00000001 +#define EF_MIPS_PIC 0x00000002 +#define EF_MIPS_CPIC 0x00000004 +#define EF_MIPS_ARCH 0xf0000000 +#define EF_MIPS_ARCH_MIPS_2 0x10000000 +#define EF_MIPS_ARCH_MIPS_3 0x20000000 + +/* + * e_version and EI_VERSION + */ +#define EV_NONE 0 +#define EV_CURRENT 1 + +/* + * Special section indexes + */ +#define SHN_UNDEF 0 +#define SHN_LORESERVE 0xff00 +#define SHN_LOPROC 0xff00 +#define SHN_HIPROC 0xff1f +#define SHN_ABS 0xfff1 +#define SHN_COMMON 0xfff2 +#define SHN_HIRESERVE 0xffff + +#define SHN_GHCOMMON 0xff00 +/* + * Section header + */ +typedef struct { + Elf32_Word sh_name; + Elf32_Word sh_type; /* SHT_... */ + Elf32_Word sh_flags; /* SHF_... */ + Elf32_Addr sh_addr; + Elf32_Off sh_offset; + Elf32_Word sh_size; + Elf32_Word sh_link; + Elf32_Word sh_info; + Elf32_Word sh_addralign; + Elf32_Word sh_entsize; +} Elf32_Shdr; + +#define SHDRSZ sizeof(Elf32_Shdr) + +/* + * sh_type + */ +#define SHT_NULL 0 +#define SHT_PROGBITS 1 +#define SHT_SYMTAB 2 +#define SHT_STRTAB 3 +#define SHT_RELA 4 +#define SHT_HASH 5 +#define SHT_DYNAMIC 6 +#define SHT_NOTE 7 +#define SHT_NOBITS 8 +#define SHT_REL 9 +#define SHT_SHLIB 10 +#define SHT_DYNSYM 11 +#define SHT_COMDAT 12 +#define SHT_LOPROC 0x70000000 +#define SHT_HIPROC 0x7fffffff +#define SHT_LOUSER 0x80000000 +#define SHT_HIUSER 0xffffffff + +/* + * sh_flags + */ +#define SHF_WRITE 0x1 +#define SHF_ALLOC 0x2 +#define SHF_EXECINSTR 0x4 +#define SHF_MASKPROC 0xf0000000 +#define SHF_MERGE 0x10 /* not part of all ELF ABI docs */ +#define SHF_STRINGS 0x20 /* not part of all ELF ABI docs */ + +/* + * Symbol table + */ +typedef struct { + Elf32_Word st_name; + Elf32_Addr st_value; + Elf32_Word st_size; + unsigned char st_info; + unsigned char st_other; + Elf32_Half st_shndx; +} Elf32_Sym; + +#define STN_UNDEF 0 + +#define STB_LOCAL 0 +#define STB_GLOBAL 1 +#define STB_WEAK 2 +#define STB_LOPROC 13 +#define STB_HIPROC 15 + +#define STT_NOTYPE 0 +#define STT_OBJECT 1 +#define STT_FUNC 2 +#define STT_SECTION 3 +#define STT_FILE 4 +#define STT_LOPROC 13 +#define STT_HIPROC 15 + +/* + * The STT_ARM_TFUNC type is used by the gnu compiler to mark Thumb + * functions. The STT_ARM_16BIT type is the thumb equivalent of an + * object. They are not part of the ARM ABI or EABI - they come from gnu. + */ + +#define STT_ARM_TFUNC STT_LOPROC /* GNU Thumb function */ +#define STT_ARM_16BIT STT_HIPROC /* GNU Thumb label */ + +#define ELF32_ST_BIND(info) ((info) >> 4) +#define ELF32_ST_TYPE(info) ((info) & 0xf) +#define ELF32_ST_INFO(bind,type) (((bind)<<4)+((type)&0xf)) + +/* + * Relocation + */ +typedef struct { + Elf32_Addr r_offset; + Elf32_Word r_info; +} Elf32_Rel; + +typedef struct { + Elf32_Addr r_offset; + Elf32_Word r_info; + Elf32_Sword r_addend; +} Elf32_Rela; + +#define ELF32_R_SYM(info) ((info)>>8) +#define ELF32_R_TYPE(info) ((unsigned char)(info)) +#define ELF32_R_INFO(sym,type) (((sym)<<8)+(unsigned char)(type)) + +/* + * Program header + */ +typedef struct { + Elf32_Word p_type; + Elf32_Off p_offset; + Elf32_Addr p_vaddr; + Elf32_Addr p_paddr; + Elf32_Word p_filesz; + Elf32_Word p_memsz; + Elf32_Word p_flags; + Elf32_Word p_align; +} Elf32_Phdr; + +#define PHDRSZ sizeof(Elf32_Phdr) + +/* + * p_type + */ +#define PT_NULL 0 +#define PT_LOAD 1 +#define PT_DYNAMIC 2 +#define PT_INTERP 3 +#define PT_NOTE 4 +#define PT_SHLIB 5 +#define PT_PHDR 6 +#define PT_LOPROC 0x70000000 +#define PT_HIPROC 0x7fffffff + +/* + * p_flags + */ +#define PF_X 0x1 +#define PF_W 0x2 +#define PF_R 0x4 +#define PF_MASKPROC 0xf0000000 + +typedef struct { + Elf32_Sword d_tag; + union { + Elf32_Word d_val; + Elf32_Addr d_ptr; + } d_un; +} Elf32_Dyn; + +#define DT_NULL 0 +#define DT_NEEDED 1 +#define DT_PLTRELSZ 2 +#define DT_PLTGOT 3 +#define DT_HASH 4 +#define DT_STRTAB 5 +#define DT_SYMTAB 6 +#define DT_RELA 7 +#define DT_RELASZ 8 +#define DT_RELAENT 9 +#define DT_STRSZ 10 +#define DT_SYMENT 11 +#define DT_INIT 12 +#define DT_FINI 13 +#define DT_SONAME 14 +#define DT_RPATH 15 +#define DT_SYMBOLIC 16 +#define DT_REL 17 +#define DT_RELSZ 18 +#define DT_RELENT 19 +#define DT_PLTREL 20 +#define DT_DEBUG 21 +#define DT_TEXTREL 22 +#define DT_JMPREL 23 +#define DT_LOPROC 0x70000000 +#define DT_HIPROC 0x7fffffff + +#ifdef CPU + +#if (CPU_FAMILY == SIMSPARCSOLARIS) +#include "arch/simsolaris/elfSparc.h" +#endif /* (CPU_FAMILY == SIMSPARCSOLARIS) */ + +#if (CPU_FAMILY == MIPS) +#include "arch/mips/elfMips.h" +#endif /* (CPU_FAMILY) */ + +#if (CPU_FAMILY == PPC) +#include "arch/ppc/elfPpc.h" +#endif /* (CPU_FAMILY) */ + +#if (CPU_FAMILY == SH) +#include "arch/sh/elfSh.h" +#endif /* (CPU_FAMILY) */ + +#if (CPU_FAMILY == ARM) +#include "arch/arm/elfArm.h" +#endif /* (CPU_FAMILY) */ + +#if (CPU_FAMILY == COLDFIRE) +#include "arch/coldfire/elfColdfire.h" +#endif /* (CPU_FAMILY) */ + +#if (CPU_FAMILY == I80X86) +#include "arch/i86/elfI86.h" +#endif /* (CPU_FAMILY == I80X86) */ + +#if (CPU_FAMILY == SIMLINUX) +#include "arch/simlinux/elfI86.h" +#endif /* (CPU_FAMILY == SIMLINUX) */ + +#if (CPU_FAMILY == SIMNT) +#include "arch/simnt/elfI86.h" +#endif /* (CPU_FAMILY == SIMNT) */ + + +#endif /* CPU */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCelfh */ diff --git a/h/elftypes.h b/h/elftypes.h new file mode 100644 index 0000000..99a0e01 --- /dev/null +++ b/h/elftypes.h @@ -0,0 +1,44 @@ +/* elftypes.h - typedefs of elf types for vxWorks */ + +/* + * Copyright (c) 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify, or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01d,25jul05,v_r Updated copyright. +01c,27mar04,jn Make elf.h and elftypes.h shared with the host (target + server) +01b,20jun03,nwd Deliver of Tornado 2.2 Cumulative Patch 1 +01a,30apr03,jn derived from Diab elftypes.h header file + /vobs/rome_diab_lib/dlib/include/include.unx/ + elftypes.h@@/main/1 + and /.wind_vxw_h/river/target/h/vxWorks.h@@/main/tor2/1 + (for elements of Wind River coding standards) +*/ + +#ifndef __INCelftypesh +#define __INCelftypesh + +#ifdef __cplusplus +extern "C" { +#endif + +/************** Exported data, types and macros *****************/ + +typedef unsigned long Elf32_Addr; +typedef unsigned short Elf32_Half; +typedef unsigned long Elf32_Off; +typedef long Elf32_Sword; +typedef unsigned long Elf32_Word; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCelftypesh */ diff --git a/h/end.h b/h/end.h new file mode 100644 index 0000000..75e9181 --- /dev/null +++ b/h/end.h @@ -0,0 +1,433 @@ +/* end.h - Structure for the MUX and END API*/ + +/* + * Copyright (c) 1996-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +03q,31aug05,kch Renamed END_ERR_IFMTU_CHANGE to END_ERR_L2NOTIFY. Added + l2notify_params structure definition (SPR #112068). +03p,29aug05,dlk Move END_RCVJOBQ_INFO definition here from endCommon.h, as + it is not usable from user space. Add jobQueueLib.h include. +03o,23aug05,kch Added END_ERR_IFMTU_CHANGE define. +03n,14aug05,niq Add parameters for ingress QOS support +03m,03aug05,kch Added endObjId to END_OBJ. Also modified formAddress and + packetDataGet function pointers in NET_FUNCS to have + unspecified argument list. +03l,24jun05,wap Add ifmedia support +03k,21feb05,dlk Move selected parts of this file to endCommon.h, to support + tunnelled END ioctls. +03j,25nov03,wap Merge in changes from Snowflake +03i,29sep03,rp merged from base6_networking_itn2-int +03h,13jan03,rae Merged from velocecp branch +03g,23oct01,rae merge from truestack (fix some ioctl values) +03f,16oct01,rcs added END_ERR_NO_BUF flag to notify mux of driver cluster + exhaustion. SPR# 70545 +01z,13jul01,ann added a flag for RFC2233 driver support to eliminate the + global mibStyle variable +03e,09nov00,spm removed pNptCookie from END_OBJ for binary compatibility +03d,07nov00,spm removed nptFlag from END_OBJ for T2 END binary compatibility +03d,25oct00,niq Merge RFC2233 changes from open_stack-p1-r1 branch + 03c,10mar00,ead Modifed the END object to support RFC + variables +03c,16oct00,spm merged version 01v from tor3_0_x branch (base version 01r): + adds backward compatibility fixes and support for multiple + snarf protocols and link-level broadcasts +03b,29apr99,pul Upgraded NPT phase3 code to tor2.0.0 +03a,29mar99,pul altered END_QUERY struct to conform to WRS coding standard +02z,24mar99,sj NET_PROTOCOL flags field is used by MUX +02y,05mar99,sj added END_QUERY; added END_ERR_FLAGS +02x,02mar99,sj fixed IOCTL values so that last byte of IOCTL cmd is <255 +02w,22feb99,sj added EIOCGBCASTADDR, EIOCGADDRLEN, EIOCGBIND ioctls +01v,15oct98,pul changed the call back routines not to specify argument list +01u,08oct98,sj EIOCGNPT ioctl command for NPT +01t,29sep98,fle doc : made it refgen parsable +01s,10sep98,pul added endBind and EIOCGNPT command +01r,25aug98,n_s update comments for DEV_OBJ. spr 21546. +01q,17jan98,gnn fixed a bug in output filtering. +01p,08dec97,gnn END code review fixes. +01o,17oct97,vin added llHdrInfo, changed prototypes. +01n,03oct97,gnn fixed SPR 8986, added proper function prototypes +01m,25sep97,gnn SENS beta feedback fixes +01l,19aug97,gnn changes due to new buffering scheme. +01k,12aug97,gnn changes necessitated by MUX/END update. +01j,02jun97,gnn added EIOCGMWIDTH to get memory width from driver. +01i,15may97,gnn added outputFilter element to device structure. +01h,07apr97,gnn added END_TBL_ENTRY for new boot loading code. +01g,26feb97,gnn Added END_BUF_MUX and END_BUF_DRIVER defines. +01f,21jan97,gnn removed all buffer loaning stuff. + added buffer pool variables and calls. + added a IOCTL to get the minimumb first buffer in a + scatter/gather system. +01e,27nov96,gnn added MIB 2 Ioctl. +01d,07nov96,gnn fixed the flags fields to be int. +01c,23oct96,gnn name changes to follow coding standards. +01b,22oct96,gnn added pragmas for the i960. + removed netVector structure and added a pNext pointer + to the NET_BUFFER. + added function pointers for the start and stop routines. + changed the ioctls to be noun->verb +01a,18apr96,gnn written. + +*/ + +/* +DESCRIPTION + +This file defines all the structures uses by the MUX and any END. These +structures are either passed by functions in either the MUX or END +or stored by the MUX. +*/ + +#ifndef __INCendh +#define __INCendh + +#include +#include +#include +#include +#include +#include /* For JOB_QUEUE_ID */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * ERROR Return for device blocked on transmit. + */ + +#define END_ERR_BLOCK -2 + +/* + * ERROR protocol defines. These are stored in a 32 bit word in the + * end_err structure. User apps can have the upper 16 bits, we get the + * lower 16. + * + * Note that the LINKDOWN and LINKUP error codes are semantically + * different from UP and DOWN. The former indicate a link change event + * due to cable disconnection, remote end fault or signal loss, while + * the latter indicate administrative changes in the interface state, + * such as the stop/start routines in the driver being manually invoked + * by the user. It is possible for the interface to be administratively + * up (chip is turned on and running) but still issue a link down event + * (e.g. if the cable is suddenly unplugged). + */ +#define END_ERR_INFO 1 /* Information only */ +#define END_ERR_WARN 2 /* Warning */ +#define END_ERR_RESET 3 /* Device has reset. */ +#define END_ERR_DOWN 4 /* Device has gone down. */ +#define END_ERR_UP 5 /* Device has come back on line. */ +#define END_ERR_FLAGS 6 /* Device flags changed */ +#define END_ERR_NO_BUF 7 /* Device's cluster pool exhausted. */ +#define END_ERR_LINKDOWN 8 /* Device's link is down */ +#define END_ERR_LINKUP 9 /* Device's link is up */ +#define END_ERR_L2NOTIFY 10 /* layer 2 notification */ + +typedef struct end_err + { + INT32 errCode; /* Error code, see above. */ + char* pMesg; /* NULL terminated error message */ + void* pSpare; /* Pointer to user defined data. */ + } END_ERR; + +/* + * The L2NOTIFY_PARAMS is used for the END_ERR_L2NOTIFY. When the message + * END_ERR_L2NOTIFY is sent, it is the pSpare pointer in the END_ERR + * which points to an L2NOTIFY_PARAMS. + * + * sets to true if a port is attached to the layer 2, false + * if the port is detached from layer 2. If is true for END + * device, the interface's if_output routine is expected to use the + * pEnd->pFuncTable->formAddress to construct its ethernet header. For + * NPT-style device, the should be ignore for now (actual + * bahavior is currently not defined). + * + * indicates the mtu size upper layer protocols (e.g. IP) should + * apply to the interface. The newMtu size will be set to the existing + * hardware mtu size if the following applies: + * 1) hardware indicates it supports hardware VLAN tagging (e.g. the + * IFCAP_VLAN_HWTAGGING in if_capabilities is set), or + * 2) hardware doesn't support hardware VLAN tagging but capable of handling + * larger mtu that may include a software-appended VLAN header (e.g. the + * IFCAP_VLAN_MTU flag is set in if_capabilities) + * If none of the above is true, the existing hardware mtu size will be + * reduced by 4 bytes and reflects in . + */ +typedef struct l2notify_params { + BOOL l2Attached; /* true if port is attached to layer 2, false if detach */ + unsigned long newMtu; +} L2NOTIFY_PARAMS; + +/* A specific instance of an Ethernet multicast address. */ +typedef struct + { + NODE node; /* How we stay in a list. */ + char addr[6]; /* address */ + long refcount; /* no. claims to this addr*/ + } ETHER_MULTI; + +typedef struct + { + long len; /* Length of table in bytes. */ + char *pTable; /* Pointer to entries. */ + } MULTI_TABLE; + +/* structure used as a vehicle to move data during a EIOCQUERY ioctl */ + +typedef struct + { + int query; /* the query */ + int queryLen; /* length of data expected/returned */ + char queryData[4]; /* allocate a minimum of 4 bytes; expandable upto 120 */ + } END_QUERY; + +/* Query system Query commands */ + +#define END_BIND_QUERY 0x1 + +/* + * + * DEV_OBJ - device specific control object + * + * The DEV_OBJ structure is the glue linking the device generic END_OBJ + * structure with the device specific data object referenced by pDevice. + */ + +typedef struct dev_obj + { + char name[END_NAME_MAX]; + int unit; + char description[END_DESC_MAX]; + void* pDevice; /* Pointer back to the device data. */ + } DEV_OBJ; + +/* +* +* LL_HDR_INFO - link level Header info +* +* This data structure defines information that is only relevant to +* a stack receive routine. +* +*/ + +typedef struct llHdrInfo + { + int destAddrOffset; /* destination addr offset in mBlk */ + int destSize; /* destination address size */ + int srcAddrOffset; /* source address offset in mBlk */ + int srcSize; /* source address size */ + int ctrlAddrOffset; /* control info offset in mBlk */ + int ctrlSize; /* control info size */ + int pktType; /* type of the packet */ + int dataOffset; /* data offset in the mBlk */ + } LL_HDR_INFO; + +struct proto_entry; +struct protocol_binding; + +/* + * + * endObject - the basic end object that everyone derives from + * + * This data structure defines a device independant amount of state + * that is maintained by all drivers/devices. + * Each specific device (Lance, Intel, etc.) derives from this object + * first and then incorporates it's own data structures after it. + * + */ +typedef struct end_object + { + NODE node; +#ifndef _WRS_VXWORKS_5_X + BOOL nptFlagSpace; /* Had indicated type of interface: END or NPT. Now: UNUSED */ +#endif /* _WRS_VXWORKS_5_X */ + DEV_OBJ devObject; /* Root of the device heirarchy. */ + STATUS (*receiveRtn) (); /* MUX routine to call on reception. */ + struct proto_entry * pSnarf; /* First snarf protocol */ + struct proto_entry * pTyped; /* First typed protocol */ + struct proto_entry * pPromisc; /* First promiscuous protocol */ + struct proto_entry * pStop; /* End of protocols */ + UINT32 nProtoSlots; /* Number of slots in protocol table */ + int endStyle; /* END, NPT, MULTI, ... */ + BOOL attached; /* Indicates unit is attached. */ + + SEM_ID txSem; /* Transmitter semaphore. */ + long flags; /* Various flags. */ + struct net_funcs *pFuncTable; /* Function table. */ + M2_INTERFACETBL mib2Tbl; /* MIBII counters. */ + LIST multiList; /* Head of the multicast address list */ + int nMulti; /* Number of elements in the list. */ + struct protocol_binding * outputFilter; /* Optional output filter */ + NET_POOL_ID pNetPool; /* Memory cookie used by MUX buffering. */ + M2_ID * pMib2Tbl; /* RFC 2233 MIB objects */ + struct end_object * dummyBinding; /* dummy protocol binding */ + + unsigned short endObjId; /* END/NPT device ID for Layer 2 */ +/* #ifdef QOS */ + STATUS (*origReceiveRtn) (); /*Original MUX routine to call on reception.*/ + int (*qosHookRtn) (); /* Packet classifier hook routine. */ +/* #endif /@ QOS @/ */ + } END_OBJ; + +/* + * + * NET_FUNCS - driver function table + * + * This is a table that is created, one per driver, to hold all the + * function pointers for that driver. In this way we can have only one + * instance to this structer, but one pointer per netDevice structure. + */ + +typedef struct net_funcs + { + STATUS (*start) (END_OBJ*); /* Driver's start func. */ + STATUS (*stop) (END_OBJ*); /* Driver's stop func. */ + STATUS (*unload) (END_OBJ*); /* Driver's unload func. */ + int (*ioctl) (END_OBJ*, int, caddr_t); /* Driver's ioctl func. */ + STATUS (*send) (END_OBJ* , M_BLK_ID); /* Driver's send func. */ + STATUS (*mCastAddrAdd) (END_OBJ*, char*); /* Driver's mcast add func. */ + STATUS (*mCastAddrDel) (END_OBJ*, char*); /* Driver's mcast delete func. */ + STATUS (*mCastAddrGet) (END_OBJ*, MULTI_TABLE*); + /* Driver's mcast get fun. */ + STATUS (*pollSend) (END_OBJ*, M_BLK_ID); /* Driver's polling send func. */ + STATUS (*pollRcv) (END_OBJ*, M_BLK_ID); /* Driver's polling recv func. */ + + /* + * The minimum required arguments for (*formAddress)() are: + * (*formAddress)(M_BLK_ID, M_BLK_ID, M_BLK_ID, BOOL) + */ + M_BLK_ID (*formAddress) (); /* Driver's addr formation func. */ + + /* + * The minimum required arguments for (*packetDataGet)() are + * (*packetDataGet)(M_BLK_ID, LL_HDR_INFO *) + */ + STATUS (*packetDataGet) (); /* Driver's packet data get func. */ + STATUS (*addrGet) (M_BLK_ID, M_BLK_ID, M_BLK_ID, M_BLK_ID, M_BLK_ID); + /* Driver's packet addr get func. */ + int (*endBind) (void*, void*, void*, long type); + /* information exchange between */ + /* network service and network driver */ + } NET_FUNCS; + + +/* This structure is a row in our run time END table. + * Each row contains all the units started on a particular named device. + * I.e. all devices that are Lance 7990 Ethernet will be in the list + * off of the row with the name "ln". + */ + +typedef struct end_tbl_row + { + NODE node; /* Needed by our list processing library. */ + char name[END_NAME_MAX]; /* Name of the devices in row. (ln, etc.) */ + LIST units; /* List of devices, i.e. 0, 1, etc.. */ + } END_TBL_ROW; + +/* This is the structure that is used by the BSP to build up a table + * of END devices to be started at boot time. + */ +typedef struct end_tbl_entry + { + int unit; /* This device's unit # */ + END_OBJ* (*endLoadFunc) (char*, void*); /* The Load function. */ + char* endLoadString; /* The load string. */ + BOOL endLoan; /* Do we loan buffers? */ + void* pBSP; /* BSP private */ + BOOL processed; /* Has this been processed? */ + } END_TBL_ENTRY; + +#define END_TBL_END NULL + +/* + * Definitions and structures for polled stats counters. + */ + +typedef unsigned long long endCounter; + +typedef struct /*endIfCounters*/ + { + endCounter ifInErrors; + endCounter ifInDiscards; + endCounter ifInUnknownProtos; + endCounter ifInOctets; + endCounter ifInUcastPkts; + endCounter ifInMulticastPkts; + endCounter ifInBroadcastPkts; + + endCounter ifOutErrors; + endCounter ifOutDiscards; + endCounter ifOutOctets; + endCounter ifOutUcastPkts; + endCounter ifOutMulticastPkts; + endCounter ifOutBroadcastPkts; + } END_IFCOUNTERS; + +#define END_IFINERRORS_VALID 0x00000001 +#define END_IFINDISCARDS_VALID 0x00000002 +#define END_IFINUNKNOWNPROTOS_VALID 0x00000004 +#define END_IFINOCTETS_VALID 0x00000008 +#define END_IFINUCASTPKTS_VALID 0x00000010 +#define END_IFINMULTICASTPKTS_VALID 0x00000020 +#define END_IFINBROADCASTPKTS_VALID 0x00000040 + +#define END_IFOUTERRORS_VALID 0x00010000 +#define END_IFOUTDISCARDS_VALID 0x00020000 +#define END_IFOUTUNKNOWNPROTOS_VALID 0x00040000 +#define END_IFOUTOCTETS_VALID 0x00080000 +#define END_IFOUTUCASTPKTS_VALID 0x00100000 +#define END_IFOUTMULTICASTPKTS_VALID 0x00200000 +#define END_IFOUTBROADCASTPKTS_VALID 0x00400000 + +typedef struct /*endIfDrvConf*/ + { + int ifPollInterval; + UINT32 ifValidCounters; + void * ifWatchdog; + END_OBJ * ifEndObj; + void * ifMuxCookie; + FUNCPTR ifPollRtn; + } END_IFDRVCONF; + +/* + * Structure used by EIOCGRCVJOBQ ioctl to retrieve the IDs of job queues + * used by an END interface to deliver packets to the stack. In the + * future we may support multiple job queues per interface; at present, + * there is a limit of just one. However, the ioctl interface is capable + * of reporting more than one. + * + * The MUX initializes numRcvJobQs with the number of available slots + * in the array qIds. The driver checks numRcvJobQs; if this is less + * than the actual number of job queues used by the interface to deliver + * received packets to the stack, the driver sets numRcvJobQs to the actual + * number of queues it uses, returns ENOSPC, and does not modify the array + * qIds. Otherwise, numRcvJobQs is greater than or equal to the number of + * receive job queues used by the interface, and the driver should write + * the actual number of queues into numRcvJobQs, write the JOB_QUEUE_IDs + * of the queues into the initial elements of the array qIds in any convenient + * order, and return OK. + * + * AT PRESENT, ONLY ONE RECEIVE JOB QUEUE IS PERMITTED PER INTERFACE. + * + * Defined here rather than in endCommon.h since the job queue IDs aren't + * usable in user space. + */ + +typedef struct _END_RCVJOBQ_INFO + { + UINT32 numRcvJobQs; /* # job qs on which interface delivers packets */ + JOB_QUEUE_ID qIds [1]; /* variable length array of job queue IDs. */ + } END_RCVJOBQ_INFO; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCendh */ diff --git a/h/endCommon.h b/h/endCommon.h new file mode 100644 index 0000000..9b68027 --- /dev/null +++ b/h/endCommon.h @@ -0,0 +1,333 @@ +/* endCommon.h - MUX/END API shared between kernel and user space */ + +/* Copyright 1984 - 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,29aug05,dlk Move END_RCVJOBQ_INFO definition into end.h, as it is + not usable from user space. +01d,12aug05,dlk Removed IPv6 checksumming capabilities bits. Use the + (previously) IPv4-only capabilities for both IPv4 and IPv6. +01c,26jul05,dlk Added EIOCGRCVJOBQ. Recoded IFMEDIA ioctls to use structure + rather than pointer to structure as type. + Decreased cap_available and cap_enabled to 32 bits in + END_CAPABILITIES; it doesn't make sense for these to be + larger than the csum_flags members. +01b,24jun05,wap Add ifmedia support +01a,21feb05,dlk Extracted from end.h. Corrected ioctl codes. +*/ + +/* +DESCRIPTION + +This file defines the parts of the MUX/END API visible to RTP +space, primarily via the SIOCMUXPASSTHRU ioctl. It also defines +all END ioctl codes, even those not presently usable from an RTP. + +SEE ALSO: end.h +*/ + +#ifndef __INCendCommonh +#define __INCendCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "m2Lib.h" /* For MIBII counters. */ +#include "lstLib.h" /* List library for linked structures. */ +#include "sys/ioctl.h" + +/* END driver/interface variants */ + +#define END_STYLE_END 0 +#define END_STYLE_NPT 1 +#define END_STYLE_MULTI 2 + +/* + * + * Flags defined for the END. + * + */ + +#define END_DEBUG 0x1000 + +/* Flag denoting the support for RFC 2233 MIB variables */ + +#define END_MIB_2233 0x10000 /* RFC2233 supported - value chosen to + * prevent conflict with IFF_* flags in if.h + */ + +#define END_INIT_STR_MAX 255 +#define END_PROTO_NAME_MAX 32 +#define END_NAME_MAX 8 /* The maximum length of a device name */ +#define END_DESC_MAX 80 /* The maximum length of device desription. */ + +/* + * This structure is used by the EIOCGIFCAP and EIOCSIFCAP ioctls. + * + * For EIOCGIFCAP, the driver returns all fields according to its + * current settings. The stack need not initialize any of the fields. + * + * For EIOCSIFCAP, the stack sets cap_enabled, and the driver then + * sets all fields accordingly. The bits on in cap_enabled on exit + * should be a subset of the bits set by the stack (and of course a + * subset of cap_available). It is not an error if the stack + * requests in cap_enabled capabilities which the interface doesn't + * have; it just won't get them. csum_flags_tx and csum_flags_rx + * contain the translation of cap_enabled into CSUM flags for tx + * and rx, and provide more detailed information about the particular + * operations supported. For example, if IFCAP_TXCSUM and IFCAP_TCPSEG + * are on in cap_enabled, the driver might set csum_flags_tx to a + * subset of (CSUM_IP|CSUM_TCP|CSUM_UDP|CSUM_FRAGMENT|CSUM_TCP_SEG). + * + * See mbuf.h for CSUM flags. XXX - mbuf.h is a BSD-specific file, + * whereas these flags should be defined for all protocols, even + * though they are protocol specific. Consider moving them here. + */ + +typedef struct _END_CAPABILITIES + { + uint32_t cap_available; /* supported capabilities (RO) */ + uint32_t cap_enabled; /* subset of above which are enabled (RW) */ + uint32_t csum_flags_tx; /* cap_enabled mapped to CSUM flags for TX (RO) */ + uint32_t csum_flags_rx; /* cap_enabled mapped to CSUM flags for RX (RO) */ + } END_CAPABILITIES; + +/* Interface capabilities flags for cap_available, cap_enabled fields: */ + +#define IFCAP_RXCSUM 0x0001 /* can offload cksum on RX (IPv4) */ +#define IFCAP_TXCSUM 0x0002 /* can offload cksum on TX (IPv4) */ +#define IFCAP_NETCONS 0x0004 /* can be a network console */ +#define IFCAP_VLAN_MTU 0x0008 /* VLAN-compatible MTU */ +#define IFCAP_VLAN_HWTAGGING 0x0010 /* hardware VLAN tag support */ +#define IFCAP_JUMBO_MTU 0x0020 /* 9000 byte MTU supported */ +#define IFCAP_TCPSEG 0x0040 /* can do IPv4/TCP segmentation */ +#define IFCAP_IPSEC 0x0080 /* can do IPsec */ + +/* + * Removed IPv6 checksumming capabilities bits. Administratively, we + * use IFCAP_RXCSUM, IFCAP_TXCSUM, and IFCAP_TCPSEG to control the + * capabilities for both IPv4 and IPv6. + */ + +#define IFCAP_IPCOMP 0x0800 /* can do IPcomp */ + +#define IFCAP_CAP0 0x1000 /* Vendor specific capability #0 */ +#define IFCAP_CAP1 0x2000 /* Vendor specific capability #1 */ +#define IFCAP_CAP2 0x4000 /* Vendor specific capability #2 */ +#define IFCAP_CAP3 0x8000 /* Vendor specific capability #3 */ + +/* + * This structure is used by the EIOCGIFMEDIA and EIOCSIFMEDIA ioctls. + */ + +typedef struct _END_MEDIA + { + UINT32 endMediaActive; + UINT32 endMediaStatus; + } END_MEDIA; + +/* + * This structure is used by the EIOCGMEDIALIST ioctl. It returns + * the default media setting and a variable length list of media + * types that the driver supports. + */ + +typedef struct _END_MEDIALIST + { + UINT32 endMediaListDefault; + UINT32 endMediaListLen; + UINT32 endMediaList[1]; + } END_MEDIALIST; + + +/* + * + * End Specific IOCTL commands. + * + * The following are the end specific IOCTL commands. This is a place + * holder for them until we places them into the system ioctl.h file. + * + * EIOC stands for END ioctl, just as SIOC stands for socket ioctl. + * + * User defined IOCTLS should use the command byte 'e' (for END) and should + * start at 128. Numbers 0 through 127 are reserved by Wind River Systems. + */ + +#undef END_IOCTL_BIN_COMPAT + +#ifdef END_IOCTL_BIN_COMPAT + +/* + * Obsoleted END IOCTL codes. These codes are incorrect for one + * or more reasons: + * - Some are group 'i' when they should be 'e'. + * - Many specify the type of the pointer rather than the thing pointed to. + * - Some use _IOW(..,..,NULL) rather than _IO(..,..). + * - Some we wish to make usable from RTP space, so they need IOC_USER. + * + * The original set of END IOCTL commands started with number 260 and continued + * upwards. The value 260 or higher cannot be accomodated within the LSByte + * reserved for it by the _IO[RW] macros(sys/ioctl.h). + * + * However the numbers, 260 through 274, that were used did not + * alter the value of the command byte('i') in the IOCTL command and + * are equivalent to the numbers 4 through 18 used below. This preserves + * binary compatibility with END drivers that were built using the old defines. + * + * This list of IOCTLS with command byte 'i' SHOULD NOT BE EXTENDED BEYOND 18 + * + */ + +/* Device commands */ +#define OEIOCSFLAGS _IOW('i', 4, int) /* Set device flag */ +#define OEIOCGFLAGS _IOR('i', 5, int) /* Get device flag */ +#define OEIOCSADDR _IOW('i', 6, char *) /* Set device address */ +#define OEIOCGADDR _IOR('i', 7, char *) /* Get device address */ +#define OEIOCGFBUF _IOR('i', 8, int) /* Get min 1st buf for chaining. */ +#define OEIOCGMWIDTH _IOR('i', 9, int) /* Get device memory width. */ + +/* Multicast commands */ +#define OEIOCMULTIADD _IOW('i', 10, char *) /* add m'cast addr */ +#define OEIOCMULTIDEL _IOW('i', 11, char *) /* del m'cast addr */ +#define OEIOCMULTIGET _IOWR('i', 12, MULTI_TABLE)/* get m'cast addr */ + +/* Miscellaneous functions */ +#define OEIOCSRCVCB _IOW('i', 13, FUNCPTR) /* Set receive callback */ +#define OEIOCPOLLSTART _IOW('i', 14, NULL) /* Start polling. */ +#define OEIOCPOLLSTOP _IOW('i', 15, NULL) /* Stop polling. */ + +/* MibII functions */ +#define OEIOCGMIB2 _IOR('i', 16, M2_INTERFACETBL *) + +/* Name function. */ +#define OEIOCGNAME _IOR('i', 17, char *) /* get the device name */ + +/* Header length fucntion. */ +#define OEIOCGHDRLEN _IOR('i', 18, int) /* get the header length */ + +/* + * The IOCTL commands below were introduced by the Network Protocol Toolkit + * The command byte is set to 'e' for END and numbers 1 thro' 127 are reserved + * for WRS. + * Below we start at 20 to allow room for the above 'i' based IOCTLS to be + * converted to 'e' based IOCTLS sometime in the future. + */ + +/* Toolkit device or not */ +#define OEIOCGNPT _IOR('e', 20, NULL) /* return true for toolkit device*/ + +/* Broadcast address */ +#define OEIOCGBCASTADDR _IOR('e', 21, char *) /* return Broadcast addr */ + +/* More MibII functions */ +#define OEIOCSMIB2233 _IOW('e', 24, IF_SETENTRY *) + +/* MTU for Point to Multipoint */ +#define OEIOCGMTU _IOR('e', 26, MTU_QUERY *) + +/* MIB allocation for RFC2233 */ +#define OEIOCSMIBINIT _IOW('e', 29, NULL) + +/* Obtain END Style of driver */ +#define OEIOCGSTYLE _IOR('e', 30, int) + +/* Obtain or set interface capabilities (e.g. hardware offload) */ +#define OEIOCGIFCAP _IOR('e', 31, END_CAPABILITIES *) +#define OEIOCSIFCAP _IOWR('e', 32, END_CAPABILITIES *) + +#endif /* END_IOCTL_BIN_COMPAT */ + + +typedef unsigned char END_PHYADDR [MAXIFPHYADDR]; +typedef char END_NAME [END_NAME_MAX]; + +/* + * Ioctls EIOCSFLAGS through EIOCGHDRLEN were initially misdefined + * as 'i' group ioctls. Also several END ioctls specified an incorrect + * type for the argument, frequently the type of the pointer rather than + * the thing pointed to. We correct them here. The old values are + * above. + * + * Certain of these ioctls have been marked with IOC_USER to enable + * use from an RTP via SIOCMUXPASSTHRU. We do this only for ioctls + * not requiring access to kernel structurs, and only for 'read only' + * ioctls (for now). It may be desirable in the future to allow + * some sorts of 'write' access from RTP space. + */ + +/* Device commands */ +#define EIOCSFLAGS _IOW('e', 4, int) /* Set device flag */ +#define EIOCGFLAGS _IORU('e', 5, int) /* Get device flag */ +#define EIOCSADDR _IOW('e', 6, END_PHYADDR) /* Set device address */ +#define EIOCGADDR _IORU('e', 7, END_PHYADDR) /* Get device address */ +#define EIOCGFBUF _IORU('e', 8, int) /* Get min 1st buf for chaining. */ +#define EIOCGMWIDTH _IORU('e', 9, int) /* Get device memory width. */ + +/* Multicast commands */ +#define EIOCMULTIADD _IOW('e', 10, END_PHYADDR) /* add m'cast addr */ +#define EIOCMULTIDEL _IOW('e', 11, END_PHYADDR) /* del m'cast addr */ +#define EIOCMULTIGET _IOWR('e', 12, MULTI_TABLE)/* get m'cast addr */ + +/* Miscellaneous functions */ +#define EIOCSRCVCB _IOW('e', 13, FUNCPTR) /* Set receive callback */ +#define EIOCPOLLSTART _IO('e', 14) /* Start polling. */ +#define EIOCPOLLSTOP _IO('e', 15) /* Stop polling. */ + +/* MibII functions */ +#define EIOCGMIB2 _IORU('e', 16, M2_INTERFACETBL) + +/* Name function. */ +#define EIOCGNAME _IORU('e', 17, END_NAME) /* get the device name */ + +/* Header length fucntion. */ +#define EIOCGHDRLEN _IORU('e', 18, int) /* get the header length */ + +/* Toolkit device or not */ +#define EIOCGNPT _IOU('e', 20) /* return true in case of toolkit device*/ + +/* Broadcast address */ +#define EIOCGBCASTADDR _IORU('e', 21, END_PHYADDR) /* return Broadcast addr */ + +/* Query IOCTL command */ +#define EIOCQUERY _IOWR('e', 22, END_QUERY) + +/* More MibII functions */ + +#define EIOCGMIB2233 _IOR('e', 23, M2_ID *) /* pointer */ +#define EIOCSMIB2233 _IOW('e', 24, IF_SETENTRY) +#define EIOCGMCASTLIST _IOR('e', 25, LIST *) /* pointer */ + +/* MTU for Point to Multipoint */ +#define EIOCGMTU _IOWR('e', 26, MTU_QUERY) + +/* Access driver's internal 2233 stats counters */ +#define EIOCGPOLLCONF _IOR('e', 27, END_IFDRVCONF *) /* pointer */ +#define EIOCGPOLLSTATS _IOR('e', 28, END_IFCOUNTERS *) /* pointer */ + +/* MIB allocation for RFC2233 */ +#define EIOCSMIBINIT _IO('e', 29) + +/* Obtain END Style of driver */ +#define EIOCGSTYLE _IORU('e', 30, int) + +/* Obtain or set interface capabilities (e.g. hardware offload) */ +#define EIOCGIFCAP _IORU('e', 31, END_CAPABILITIES) +#define EIOCSIFCAP _IOWR('e', 32, END_CAPABILITIES) + +/* Obtain or set media status */ +#define EIOCGMEDIALIST _IOR('e', 33, END_MEDIALIST) +#define EIOCGIFMEDIA _IOR('e', 34, END_MEDIA) +#define EIOCSIFMEDIA _IOWR('e', 35, END_MEDIA) + +/* Obtain list of receive job queues for interface */ +#define EIOCGRCVJOBQ _IOWR('e', 36, END_RCVJOBQ_INFO) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCendCommonh */ diff --git a/h/endLib.h b/h/endLib.h new file mode 100644 index 0000000..61cfda6 --- /dev/null +++ b/h/endLib.h @@ -0,0 +1,278 @@ +/* endLib.h - definitions for Enhanced Network Drivers */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01y,25jun04,rcs added END_NET_POOL_INIT & END_NET_POOL_CREATE +01x,14jun04,vvv fixed endM2 stuff (SPR #98070) +01w,22apr04,rae endM2Packet does not belong here +01v,16apr04,rae Add endM2Init() etc. +01u,25feb04,vvv fixed memory leak (SPR #92692) +01t,25nov03,wap Merge in changes from Snowflake +01s,29sep03,rp merged from base6_networking_itn2-int +01r,22jan03,rcs Added MBLK_SIZE and CLBLK_SIZE +01q,13jan03,rae Merged from velocecp branch (SPR 83033) +01p,17may02,rcs add for MIB-II interface callbacks. SPR# 77478 +01o,08nov01,wap Add missing prototype for txRcvRtnCall() +01n,10oct01,rae update copyright +01m,27jun01,rcs Merge Tor2.0.2 to Tornado-Comp-Drv +01l,23oct00,rae fixed SPR #33687 by removing semicolon from END_OBJ_READY +01k,16oct00,spm merged version 01k from tor3_0_x branch (base version 01j): + adds link-level broadcast support +01j,29apr99,pul Upgraded NPT phase3 code to tor2.0.0 +01i,18mar99,sj fixed typo in TK_RCV_RTN_CALL +01h,08dec97,gnn END code review fixes. +01g,17oct97,vin changed prototypes. +01f,25sep97,gnn SENS beta feedback fixes +01e,19aug97,gnn changes due to new buffering scheme. +01d,12aug97,gnn changes necessitated by MUX/END update. +01c,07apr97,map Added more prototypes and END_OBJ_UNLOAD. +01b,03feb97,gnn Added speed as an argument to MIB stuff. +01a,26dec96,gnn written. + +*/ + +/* +DESCRIPTION + +This include file contains definitions used by the Enhanced Network Driver +library (endLib.c) and by all of the ENDs. + +If the macro END_MACROS is set during compilation then all of the functions in +the library will included as macros instead of functions, otherwise all of the +routines will be functions. This is a time/space tradeoff that can be made at +compile time. + +INCLUDE FILES: +*/ + +#ifndef __INCendLibh +#define __INCendLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include "wrn/netVersion.h" + +#include "end.h" +#include "muxLib.h" + +/* defines */ + +#define MBLK_SIZE 64 +#define CLBLK_SIZE 64 + +#define END_NET_POOL_CREATE 0 +#define END_NET_POOL_INIT 1 + +#define MIB2_IN_ERRS 0 +#define MIB2_IN_UCAST 1 +#define MIB2_OUT_ERRS 2 +#define MIB2_OUT_UCAST 3 + +#define MIB_ALLOC(m2Id, ifType, enetAddr, addrLen, mtu, speed, name, unit) \ +if ((pMibRtn != NULL) && (pMibRtn->mibAlloc != NULL)) \ + ((* (pMibRtn->mibAlloc)) (m2Id, ifType, (UINT8 *)enetAddr, addrLen, mtu, \ + speed, name, unit)) + +#define MIB_FREE(m2Id) \ +if ((pMibRtn != NULL) && (pMibRtn->mibFree != NULL)) \ + ((* (pMibRtn->mibFree)) (m2Id)) + +#define MIB_CNT_UPDATE(m2Id, cntName, pktData, pktLen) \ +if ((pMibRtn != NULL) && (pMibRtn->mibCntUpdate != NULL)) \ + ((* (pMibRtn->mibCntUpdate)) (m2Id, cntName, pktLen, pktData)) + +#define MIB_VAR_UPDATE(m2Id, varName, data) \ +if ((pMibRtn != NULL) && (pMibRtn->mibVarUpdate != NULL)) \ + ((* (pMibRtn->mibVarUpdate)) (m2Id, varName, (caddr_t)data)) + + +#ifdef END_MACROS + +#define END_RCV_RTN_CALL(pEnd,pMblk) \ + { \ + if ((pEnd)->receiveRtn) \ + { \ + (pEnd)->receiveRtn ((pEnd), pMblk,NULL,NULL,NULL,NULL); \ + } \ + else \ + netMblkClChainFree (pMblk); \ + } + +#define TK_RCV_RTN_CALL(pEnd,pMblk, netSvcOffset, netSvcType, \ + uniPromiscuous, pSpareData) \ + { \ + if ((pEnd)->receiveRtn) \ + { \ + (pEnd)->receiveRtn ((pEnd), pMblk, netSvcOffset, netSvcType, \ + uniPromiscuous, pSpareData); \ + } \ + else \ + netMblkClChainFree (pMblk); \ + } + +#define END_TX_SEM_TAKE(pEnd,tmout) \ + (semTake ((pEnd)->txSem,tmout)) + +#define END_TX_SEM_GIVE(pEnd) \ + (semGive ((pEnd)->txSem)) + +#define END_FLAGS_CLR(pEnd,clrBits) \ + ((pEnd)->flags &= ~(clrBits)) + +#define END_FLAGS_SET(pEnd,setBits) \ + ((pEnd)->flags |= (setBits)) + +#define END_FLAGS_GET(pEnd) \ + ((pEnd)->flags) + +#define END_MULTI_LST_CNT(pEnd) \ + (lstCount (&(pEnd)->multiList)) + +#define END_MULTI_LST_FIRST(pEnd) \ + (ETHER_MULTI *)(lstFirst (&(pEnd)->multiList)) + +#define END_MULTI_LST_NEXT(pCurrent) \ + (ETHER_MULTI *)(lstNext (&pCurrent->node)) + +#define END_DEV_NAME(end) \ + (end.devObject.name) + +#define END_OBJECT_UNLOAD(pEnd) \ + (endObjectUnload (pEnd)) + +#define END_OBJ_INIT(pEnd,pDev,name,unit,pFuncs, pDesc) \ + endObjInit ((pEnd),pDev,name,unit,pFuncs, pDesc) + +#define END_OBJ_READY(pEnd, flags) \ + endObjFlagSet ((pEnd),flags) + +#define END_ERR_ADD(pEnd,code,value) \ + (mib2ErrorAdd(&(pEnd)->mib2Tbl, code, value)) + +#define END_MIB_INIT(pEnd,type,addr,addrLen,mtu,speed) \ + (mib2Init(&(pEnd)->mib2Tbl, type,addr, addrLen, mtu, speed)) +#else + +#define END_RCV_RTN_CALL(pEnd,pData) \ + endRcvRtnCall((pEnd), pData) + +#define TK_RCV_RTN_CALL(pEnd,pData, netSvcOffset, netSvcType, \ + uniPromiscuous, pSpareData) \ + tkRcvRtnCall((pEnd), pData, netSvcOffset, netSvcType, \ + uniPromiscuous, pSpareData) + +#define END_TX_SEM_TAKE(pEnd,tmout) \ + endTxSemTake((pEnd), tmout) + +#define END_TX_SEM_GIVE(pEnd) \ + endTxSemGive(pEnd) + +#define END_FLAGS_CLR(pEnd,clrBits) \ + endFlagsClr((pEnd), clrBits) + +#define END_FLAGS_SET(pEnd,setBits) \ + endFlagsSet((pEnd), setBits) + +#define END_FLAGS_GET(pEnd) \ + (endFlagsGet((pEnd))) + +#define END_MULTI_LST_CNT(pEnd) \ + (endMultiLstCnt((pEnd))) + +#define END_MULTI_LST_FIRST(pEnd) \ + (endMultiLstFirst((pEnd))) + +#define END_MULTI_LST_NEXT(pCurrent) \ + (endMultiLstNext((pCurrent))) + +#define END_DEV_NAME(pEnd) \ + (endDevName((pEnd))) + +#define END_OBJECT_UNLOAD(pEnd) \ + endObjectUnload((pEnd)) + +#define END_OBJ_UNLOAD(X) END_OBJECT_UNLOAD(X) + + +#define END_OBJ_INIT(pEnd,pDev,name,unit,pFuncs, pDescription) \ + endObjInit ((pEnd),pDev,name,unit,pFuncs, pDescription) + +#define END_OBJ_READY(pEnd, flags) \ + endObjFlagSet ((pEnd),flags) + +#define END_ERR_ADD(pEnd,code,value) \ + (mib2ErrorAdd(&(pEnd)->mib2Tbl, code, value)) + +#define END_MIB_INIT(pEnd,type,addr,len,mtu,speed) \ + (mib2Init(&(pEnd)->mib2Tbl, type, addr, len, mtu, speed)) +#endif /* END_MACROS */ + +/* typedefs */ + +typedef struct mib_routines + { + FUNCPTR mibAlloc; + FUNCPTR mibFree; + FUNCPTR mibCntUpdate; + FUNCPTR mibVarUpdate; + } MIB_ROUTINES; + + +/* globals */ + +IMPORT MIB_ROUTINES * pMibRtn; +IMPORT FUNCPTR endM2Packet; + +/* locals */ + +/* forward declarations */ + +STATUS endMibIfInit (FUNCPTR pMibAllocRtn, FUNCPTR pMibFreeRtn, + FUNCPTR pMibCtrUpdate, FUNCPTR pMibVarUpdate); +STATUS endObjInit (END_OBJ* pEndObj, DEV_OBJ* pDevice, + char* pBaseName ,int unit, NET_FUNCS* pFuncTable, + char* pDescription); +STATUS endObjFlagSet (END_OBJ*,UINT); +STATUS mib2Init (M2_INTERFACETBL*,long,UCHAR*,int, int, int); +STATUS mib2ErrorAdd (M2_INTERFACETBL*, int, int); +void endTxSemTake (END_OBJ*, int); +void endTxSemGive (END_OBJ*); +void endRcvRtnCall (END_OBJ*, M_BLK_ID); +void tkRcvRtnCall (END_OBJ *, M_BLK_ID, long, long, BOOL, void *); +void endObjectUnload (END_OBJ*); +void endFlagsSet (END_OBJ *, int); +void endFlagsClr (END_OBJ *, int); +int endFlagsGet (END_OBJ *); +ETHER_MULTI* endMultiLstFirst (END_OBJ *); +ETHER_MULTI* endMultiLstNext (ETHER_MULTI *); +M_BLK_ID endEtherAddressForm (M_BLK_ID pNBuff, M_BLK_ID pSrcAddr, + M_BLK_ID pDstAddr, BOOL bcastFlag); +M_BLK_ID end8023AddressForm (M_BLK_ID pNBuff, M_BLK_ID pSrcAddr, + M_BLK_ID pDstAddr, BOOL bcastFlag); +STATUS endEtherPacketDataGet (M_BLK_ID pMblk, LL_HDR_INFO * pLinkHdrInfo); +STATUS endEtherPacketAddrGet (M_BLK_ID pMblk, + M_BLK_ID pSrc, + M_BLK_ID pDst, + M_BLK_ID pESrc, + M_BLK_ID pEDst); +STATUS endEtherResolve (void* arg1, void* arg2, void* arg3, void* arg4, + void* arg5, void* arg6); + +STATUS endPollStatsInit (void *, FUNCPTR); +STATUS endM2Init (END_OBJ *, long, UCHAR *, int, int, int, UINT); +STATUS endM2Free (END_OBJ *); +STATUS endM2Ioctl (END_OBJ *, UINT32, caddr_t); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCendLibh */ diff --git a/h/envLib.h b/h/envLib.h new file mode 100644 index 0000000..c43ce66 --- /dev/null +++ b/h/envLib.h @@ -0,0 +1,68 @@ +/* envLib.h - environment varable library header file */ + +/* + * Copyright (c) 1990-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01k,27apr05,kk add NOMANUAL to environ macro for apigen (SPR# 108372) +01j,17mar04,pad Added envGet() prototype. +01i,22sep92,rrr added support for c++ +01h,19jul92,smb moved prototype for getenv to stdlib.h + added include stdlib.h +01g,04jul92,jcf cleaned up. +01f,26may92,rrr the tree shuffle +01e,09dec91,rrr fixed bad prototype (envShow). +01d,04oct91,rrr passed through the ansification filter + -changed copyright notice +01c,05oct90,shl added copyright notice. + made #endif ANSI style. +01b,01aug90,jcf cleanup. +01a,12jul90,rdc written. +*/ + + +#ifndef __INCenvLibh +#define __INCenvLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "taskLib.h" +#include "stdlib.h" + +/******************************************************************************* +* +* environ - environment pointer +* +* The following macro is provided for code that manipulates the environment +* variable array directly. +* +* \NOMANUAL +*/ + +#define environ \ + ( \ + (taskIdCurrent->ppEnviron == NULL) ? \ + ppGlobalEnviron : taskIdCurrent->ppEnviron \ + ) + +extern STATUS envLibInit (BOOL installHooks); +extern STATUS envPrivateCreate (int taskId, int envSource); +extern STATUS envPrivateDestroy (int taskId); +extern char ** envGet (int taskId); +extern STATUS putenv (char * pEnvString); +extern void envShow (int taskId); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCenvLibh */ diff --git a/h/envoy.h b/h/envoy.h new file mode 100644 index 0000000..0759146 --- /dev/null +++ b/h/envoy.h @@ -0,0 +1,989 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/vxworks/envoy.h,v 1.6 2002/05/23 19:42:41 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1994-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* +modification history +-------------------- +01h,02may05,job vxWorks-specific definition of SNMP_DH_RAND moves here +01g,19apr05,job update copyright notices +01f,06oct04,job draw processor alignment from vxWorks header files +01e,26nov03,ps copyright update +01d,05nov03,ps merge from latest on ickthwa_devel_branch.nh +01c,19apr98,ann changed ENVOY_SNMP_INIT_LOCK macro +01b,04jun96,rjc changed #if defined to #if +01a,01may96,rjc Added copyright header +*/ + +/* envoy/port/sunos/envoy.h + * configuration for Envoy on VxWorks + */ + +/* + * $Date: 2002/05/23 19:42:41 $ + * $Revision: 1.6 $ + * $Author: josh $ + * + * $Log: envoy.h,v $ + * Revision 1.6 2002/05/23 19:42:41 josh + * updates to support the entity MIB + * + * Revision 1.5 2002/04/05 13:45:18 andre + * Add ENVOY_AX_GET_CONNID user-exit. + * + * Revision 1.4 2002/04/04 15:23:15 andre + * Clean up; change enum params to int. + * + * Revision 1.2 2001/11/07 14:26:53 tneale + * Added wm to include path + * + * Revision 1.1.1.1 2001/11/05 17:47:17 tneale + * Tornado shuffle + * + * Revision 1.7.4.3 2001/10/29 21:42:50 josh + * adding a spot for the proxy forwarding routine + * + * Revision 1.7.4.2 2001/09/24 16:44:39 josh + * add a prototype for a function + * + * Revision 1.7.4.1 2001/08/24 15:35:20 josh + * add nonvolatile access definitions for proxy and community tables + * + * Revision 1.7 2001/04/13 18:09:25 josh + * merging in changes from kingfisher branch + * + * Revision 1.6 2000/07/26 19:39:31 josh + * fixing a broken comment + * + * Revision 1.5 2000/06/09 14:57:35 josh + * updating header files to correspond with new installation options and + * new code + * + * Revision 1.4.2.5 2001/03/12 22:09:03 tneale + * Updated copyright + * + * Revision 1.4.2.4 2000/12/07 22:09:56 tneale + * Added definition for ENVOY_AX_SA_MIB_ROOT_NODE + * + * Revision 1.4.2.3 2000/10/26 21:36:00 josh + * fixing a few bugs in the vxWorks AgentX master agent + * + * Revision 1.4.2.2 2000/10/18 20:05:41 josh + * added a definition for ENVOY_SNMP_FREE_LOCK_TAG() and removed + * responsibility for cleaning continue lock from + * snmpHookPrivRelease() + * + * Revision 1.4.2.1 2000/10/13 21:33:16 josh + * AgentX updates + * + * Revision 1.4 2000/03/08 20:01:13 josh + * SNMPv3 support for the vxWorks port of Envoy + * + * Revision 1.3 2000/03/07 21:23:37 josh + * overwriting old envoy.h withnew one corresponding to new demo + * + * Revision 7.0 1996/03/18 20:25:29 sar + * Updated rev to 7.0 and copyright ot 96 + * + * Revision 6.5 1996/02/27 00:03:03 sar + * Updated partytime to be usectime + * + * Revision 6.4 1995/11/14 22:37:59 sar + * If proxy is installed release_private is proxy_release_private + * + * Revision 6.3 1995/11/10 23:59:08 sar + * stopped using the pre & post set user exits for the nvview stuff + * + * Revision 6.2 1995/11/06 20:05:22 sar + * Removed validate_community's dependency on install v1 + * removed validate_address & validate_vesion + * + * Revision 6.1 1995/10/20 23:15:55 sar + * remvoed party, context and acl macros + * + * Revision 6.0 1995/05/31 22:00:33 sra + * Release 6.0. + * + * Revision 5.6 1995/05/22 19:39:24 sar + * Modified the lock code to add some new macros. + * + * Revision 5.5 1995/05/02 23:39:31 sar + * Added the envoy timer macros. + * + * Revision 5.4 1995/05/01 21:58:15 sar + * Put the example lock macros in an ifdef block + * + * Revision 5.3 1995/05/01 20:59:29 sra + * Have to test CONFIG_PREAMBLE with #ifdef, not #if. + * + * Revision 5.2 1994/11/01 17:59:04 sar + * *_add_mod routines now take a flag as well as an data block. + * + * Revision 5.1 1994/09/29 20:39:39 sar + * added macros for a simple locking scheme to test the compiliation of + * our code + * Modified the macros for use with the non volatile storage stuff to + * use the new (as of fall 94) scheme. + * + * Revision 5.0 1994/05/16 16:47:41 sar + * Updated revision to 5.0 and copyright to include 1994 + * + * Revision 4.3 1994/05/12 17:24:05 sar + * moved the include for nvutils.h to make it available for everybody + * that needs it. + * + * Revision 4.2 1994/05/10 20:21:45 sar + * moved view defines aroudn so they are available in other than v2 settings. + * + * Revision 4.1 1994/05/09 21:06:41 sar + * Added define for SNMP_RESETSYSUPTIME to be nothing. + * + * Revision 4.0 1993/06/24 17:44:26 sar + * Updated rev to 4.0 and copyright to 93 + * + * Revision 1.1 1993/06/09 19:33:45 dab + * Initial revision + * + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include + +#ifdef INSTALL_ON_BIG_ENDIAN +#undef INSTALL_ON_BIG_ENDIAN +#endif + +#ifdef INSTALL_ON_LITTLE_ENDIAN +#undef INSTALL_ON_LITTLE_ENDIAN +#endif + +#if (_BYTE_ORDER == _BIG_ENDIAN) +#define INSTALL_ON_BIG_ENDIAN 1 +#define INSTALL_ON_LITTLE_ENDIAN 0 +#elif (_BYTE_ORDER == _LITTLE_ENDIAN) +#define INSTALL_ON_LITTLE_ENDIAN 1 +#define INSTALL_ON_BIT_ENDIAN 0 +#endif + +#ifdef INSTALL_ENVOY_SNMP_LOCK +#include +#endif /* INSTALL_ENVOY_SNMP_LOCK */ + + +#ifdef CONFIG_PREAMBLE + +/***************************************************************** + * + * System Includes: + * + * The SNMP uses memcpy(), memset(), and strlen(). The appropriate + * include file should be put here to see that these routines are + * properly declared. If no such include file exists on the system + * then declare memcpy() and memset() here directly. The SNMP also + * uses min() and max(). Include the system's definition or use the + * macros supplied below. + *****************************************************************/ +#include + + + +/***************************************************************** + * Memory allocation routines. The SNMP needs to allocate memory to + * decode the packet into and also to store the response data for GET's + * and GET-NEXT's. + *****************************************************************/ + +/*---------------------------------------------------------------- + * Make sure that the routines used by the SNMP_memory_alloc() and + * SNMP_memory_free() macros are declared. If system memory routines + * are used (e.g. malloc() and free()) then include the appropriate + * system header file here. + ----------------------------------------------------------------*/ +extern void * snmpdMemoryAlloc (size_t); +extern void snmpdMemoryFree (void *); + +#define SNMP_memory_alloc(p) snmpdMemoryAlloc (p) +#define SNMP_memory_free(p) snmpdMemoryFree (p) + + + + +/* Define the maximum packet size this implementation will accept. */ +/* There is no hard upper limit. SNMP_MAX_PACKET_SIZE should not be */ +/* reduced below the value of SNMP_MIN_PACKET_SIZE. */ + +/* xxxxxxxxxxxxxxxxxxxxxxxxxxx*/ + +#define SNMP_MAX_PACKET_SIZE (8*1024) +#define SNMP_MIN_PACKET_SIZE 484 /* shouldn't change */ + +/* Say what is the maximum number of components of an object identifer */ +/* which we can handle, including those in the instance. */ +#define MAX_OID_COUNT 32 + +#if (INSTALL_ENVOY_SNMP_LOCK) +typedef SEM_ID ENVOY_LOCK_T; +#endif + + +#define ENVOY_SA_SET_TIMEOUT 100000 + +#else /* CONFIG_PREAMBLE */ + +/***************************************************************** + * + * The following macro definitions allow access to the user configurable + * part of the SNMP code. + * + *****************************************************************/ + +/***************************************************************** + * Include any declarations needed for the routines specified below + * by the macros. Don't put here because this file is + * included by that one. + *****************************************************************/ + +/*---------------------------------------------------------------- + SNMP_validate_community -- Check an operation against the community name. + +Parameters: + SNMP_PKT_T *pkt The received packet (decoded format) + SNMPADDR_T *src Source of the packet + SNMPADDR_T *dst Destination of the packet (most likely + the address of the machine on which this + code is running.) + +Returns: + This procedure should return 0 if happy with the community and + 1 if not. + + This routine should fill in the packet structure with the mib + view mask associated with the community string. + This routine may hang additional data onto the "private" field of + the packet structure. The user will be given the opportinity to + release that memory via SNMP_release_private(). + + ----------------------------------------------------------------*/ + +extern int snmpIoCommunityValidate __((SNMP_PKT_T *, SNMPADDR_T *, \ + SNMPADDR_T *)); +#define SNMP_validate_community(pkt, src, dst) \ + snmpIoCommunityValidate (pkt, src, dst) + +#if (INSTALL_ENVOY_SNMP_RFC1445_VIEWS) + +#if 0 /* not supported for vxWorks agent */ + +#include + +#define SNMP_VIEW_CREATE_TEST(PKT, NEW) SNMP_NV_View_Add_Mod(NEW, 0) +#define SNMP_VIEW_UPDATE_TEST(PKT, OLD, NEW) SNMP_NV_View_Add_Mod(NEW, 0) +#define SNMP_VIEW_DESTROY_TEST(PKT, OLD) SNMP_NV_View_Add_Mod(OLD, 1) +#define SNMP_VIEW_BACKOUT_HOOK(NEW) SNMP_NV_Clean() +#define SNMP_VIEW_CREATE_UNDO(NEW) (SNMP_NV_Clean(), 0) +#define SNMP_VIEW_UPDATE_UNDO(OLD, NEW) (SNMP_NV_Clean(), 0) +#define SNMP_VIEW_DESTROY_UNDO(OLD) (SNMP_NV_Clean(), 0) +#define SNMP_VIEW_DESTROY_BACKOUT(OLD) SNMP_NV_Clean() +#define SNMP_VIEW_FINISHED SNMP_NV_Doit() + + +#endif /* 0 (not supported for vxWorks agent) */ + +#endif /* version2, master agent, v2 views */ + +#if (INSTALL_ENVOY_SNMP_RFC2275_VIEWS) +#include + +#define SNMP_VIEW_2275_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_view_2275_test(PKT, VBP, CUR, NEW) +#define SNMP_VIEW_2275_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_view_2275_test(PKT, VBP, CUR, NEW) +#define SNMP_VIEW_2275_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_view_2275_test(PKT, VBP, CUR, NEW) + +#define SNMP_VIEW_2275_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_view_2275_set(PKT, VBP, CUR, NEW) +#define SNMP_VIEW_2275_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_view_2275_set(PKT, VBP, CUR, NEW) +#define SNMP_VIEW_2275_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_view_2275_set(PKT, VBP, CUR, NEW) + +#define SNMP_VIEW_2275_DESTROY_BACKOUT(CUR, NEW) \ + snmp_view_2275_backout(CUR, NEW) +#define SNMP_VIEW_2275_CREATE_BACKOUT(CUR, NEW) \ + snmp_view_2275_backout(CUR, NEW) +#define SNMP_VIEW_2275_UPDATE_BACKOUT(CUR, NEW) \ + snmp_view_2275_backout(CUR, NEW) + +#define SNMP_VIEW_2275_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_view_2275_undo(PKT, VBP, CUR, SAV) +#define SNMP_VIEW_2275_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_view_2275_undo(PKT, VBP, CUR, SAV) +#define SNMP_VIEW_2275_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_view_2275_undo(PKT, VBP, CUR, SAV) + +#define SNMP_VIEW_2275_FINISHED() snmp_view_2275_finished() + +#endif /* #if (INSTALL_ENVOY_SNMP_RFC2275_VIEWS) */ + + +/***************************************************************** + If version 3 is installed we may need the following macros. + + ENVOY_TIME - returns a clock with a granularity of seconds + PARAMETERS: none + returns: bits32_t + + SNMP_validate_address + This routine gives the user a chance to examine the address + information as well as most of the packet itself before a v3 + packet is processed. The routine must attach the address + information to the packet. It may attach a non-default mib + tree if desired. Note: in some error cases the packet will + not be decoded when this routine is called. + + Parameters: + SNMP_PKT_T *pkt The received packet (decoded format) + SNMPADDR_T *src Source of the packet + SNMPADDR_T *dst Destination of the packet (most likely + the address of the machine on which this + code is running.) + returns: + 0 - ok + 1 - failure, drop the packet + + + Lastly are are a series of macros that will connect the method + routines we supplied for the v3 tables to your non-volatile + storage areas. You should consult the manuals for more information + about these macros. +*****************************************************************/ +#if INSTALL_ENVOY_SNMP_VERSION_3 +#include + +extern bits32_t snmpSecsGet(void); +#define ENVOY_TIME() snmpSecsGet() + + +extern int snmpIoAddressValidate __((SNMP_PKT_T *, SNMPADDR_T *, \ + SNMPADDR_T *)); +#define SNMP_validate_address(pkt, src, dst) \ + snmpIoAddressValidate (pkt, src, dst) +#if INSTALL_ENVOY_SNMP_V3_NOTIFY + +extern int envoy_taddress_to_snmpaddr(SNMPADDR_T *, OBJ_ID_T *, EBUFFER_T *); +extern int envoy_snmpaddr_to_taddress(SNMPADDR_T *, OBJ_ID_T *, EBUFFER_T *); + +#define ENVOY_TADDRESS_TO_SNMPADDR(A, D, T) \ + envoy_taddress_to_snmpaddr(A, D, T) + + +#define ENVOY_SNMPADDR_TO_TADDRESS(A, D, T) \ + envoy_snmpaddr_to_taddress(A, D, T) +#endif + +#define SNMP_V3_GROUP_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_group_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_GROUP_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_group_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_GROUP_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_group_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_GROUP_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_group_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_GROUP_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_group_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_GROUP_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_group_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_GROUP_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_group_backout(CUR, NEW) +#define SNMP_V3_GROUP_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_group_backout(CUR, NEW) +#define SNMP_V3_GROUP_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_group_backout(CUR, NEW) + +#define SNMP_V3_GROUP_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_group_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_GROUP_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_group_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_GROUP_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_group_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_GROUP_FINISHED() snmp_v3_group_finished() + + +#define SNMP_V3_ACCESS_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_access_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_ACCESS_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_access_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_ACCESS_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_access_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_ACCESS_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_access_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_ACCESS_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_access_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_ACCESS_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_access_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_ACCESS_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_access_backout(CUR, NEW) +#define SNMP_V3_ACCESS_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_access_backout(CUR, NEW) +#define SNMP_V3_ACCESS_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_access_backout(CUR, NEW) + +#define SNMP_V3_ACCESS_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_access_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_ACCESS_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_access_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_ACCESS_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_access_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_ACCESS_FINISHED() snmp_v3_access_finished() + + +#define SNMP_V3_USER_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_user_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_USER_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_user_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_USER_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_user_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_USER_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_user_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_USER_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_user_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_USER_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_user_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_USER_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_user_backout(CUR, NEW) +#define SNMP_V3_USER_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_user_backout(CUR, NEW) +#define SNMP_V3_USER_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_user_backout(CUR, NEW) + +#define SNMP_V3_USER_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_user_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_USER_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_user_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_USER_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_user_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_USER_FINISHED() snmp_v3_user_finished() + +#define SNMP_V3_TADDR_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_taddr_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_TADDR_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_taddr_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_TADDR_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_taddr_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_TADDR_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_taddr_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_TADDR_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_taddr_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_TADDR_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_taddr_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_TADDR_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_taddr_backout(CUR, NEW) +#define SNMP_V3_TADDR_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_taddr_backout(CUR, NEW) +#define SNMP_V3_TADDR_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_taddr_backout(CUR, NEW) + +#define SNMP_V3_TADDR_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_taddr_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_TADDR_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_taddr_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_TADDR_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_taddr_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_TADDR_FINISHED() snmp_v3_taddr_finished() + +#define SNMP_V3_TPARAM_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_tparam_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_TPARAM_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_tparam_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_TPARAM_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_tparam_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_TPARAM_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_tparam_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_TPARAM_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_tparam_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_TPARAM_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_tparam_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_TPARAM_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_tparam_backout(CUR, NEW) +#define SNMP_V3_TPARAM_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_tparam_backout(CUR, NEW) +#define SNMP_V3_TPARAM_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_tparam_backout(CUR, NEW) + +#define SNMP_V3_TPARAM_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_tparam_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_TPARAM_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_tparam_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_TPARAM_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_tparam_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_TPARAM_FINISHED() snmp_v3_tparam_finished() + +#define SNMP_V3_NOTIFY_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_notify_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_NOTIFY_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_notify_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_NOTIFY_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_notify_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_NOTIFY_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_notify_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_NOTIFY_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_notify_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_NOTIFY_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_notify_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_NOTIFY_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_notify_backout(CUR, NEW) +#define SNMP_V3_NOTIFY_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_notify_backout(CUR, NEW) +#define SNMP_V3_NOTIFY_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_notify_backout(CUR, NEW) + +#define SNMP_V3_NOTIFY_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_notify_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_NOTIFY_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_notify_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_NOTIFY_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_notify_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_NOTIFY_FINISHED() snmp_v3_notify_finished() + +#define SNMP_V3_NPROF_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_nprof_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_NPROF_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_nprof_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_NPROF_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_nprof_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_NPROF_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_nprof_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_NPROF_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_nprof_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_NPROF_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_nprof_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_NPROF_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_nprof_backout(CUR, NEW) +#define SNMP_V3_NPROF_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_nprof_backout(CUR, NEW) +#define SNMP_V3_NPROF_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_nprof_backout(CUR, NEW) + +#define SNMP_V3_NPROF_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_nprof_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_NPROF_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_nprof_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_NPROF_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_nprof_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_NPROF_FINISHED() snmp_v3_nprof_finished() + +#define SNMP_V3_NFILT_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_nfilt_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_NFILT_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_nfilt_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_NFILT_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_nfilt_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_NFILT_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_nfilt_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_NFILT_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_nfilt_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_NFILT_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_nfilt_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_NFILT_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_nfilt_backout(CUR, NEW) +#define SNMP_V3_NFILT_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_nfilt_backout(CUR, NEW) +#define SNMP_V3_NFILT_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_nfilt_backout(CUR, NEW) + +#define SNMP_V3_NFILT_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_nfilt_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_NFILT_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_nfilt_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_NFILT_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_nfilt_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_NFILT_FINISHED() snmp_v3_nfilt_finished() + +#define SNMP_V3_PROXY_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_proxy_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_PROXY_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_proxy_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_PROXY_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_proxy_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_PROXY_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_proxy_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_PROXY_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_proxy_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_PROXY_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_proxy_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_PROXY_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_proxy_backout(CUR, NEW) +#define SNMP_V3_PROXY_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_proxy_backout(CUR, NEW) +#define SNMP_V3_PROXY_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_proxy_backout(CUR, NEW) + +#define SNMP_V3_PROXY_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_proxy_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_PROXY_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_proxy_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_PROXY_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_proxy_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_PROXY_FINISHED() snmp_v3_proxy_finished() + +#define SNMP_V3_COMM_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_community_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_COMM_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_community_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_COMM_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_community_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_COMM_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_community_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_COMM_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_community_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_COMM_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_community_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_COMM_DESTROY_BACKOUT(CUR, NEW) \ + snmp_community_backout(CUR, NEW) +#define SNMP_V3_COMM_CREATE_BACKOUT(CUR, NEW) \ + snmp_community_backout(CUR, NEW) +#define SNMP_V3_COMM_UPDATE_BACKOUT(CUR, NEW) \ + snmp_community_backout(CUR, NEW) + +#define SNMP_V3_COMM_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_community_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_COMM_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_community_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_COMM_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_community_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_COMM_FINISHED() snmp_community_finished() + +#if INSTALL_ENVOY_SNMP_V3_PROXY +void snmpSendProxyPkt __((SNMPADDR_T *, SNMPADDR_T *, + PTR_T, ALENGTH_T)); + +#define ENVOY_SNMP_SEND_PROXY(FOR, LOC, PKT, SIZ) \ + snmpSendProxyPkt((FOR), (LOC), (PKT), (SIZ)) +#endif /* #if INSTALL_ENVOY_SNMP_V3_PROXY */ + +#if INSTALL_SNMP_V3_DIFFIE_HELLMAN +#define SNMP_DH_RAND() snmpDHRand() +#endif + +#endif /* #if INSTALL_ENVOY_SNMP_VERSION_3 */ + +#if (INSTALL_ENVOY_EPI_MASTER) +#define SNMP_RESETSYSUPTIME +#endif + +#if (INSTALL_ENVOY_AGENTX_MASTER) || (INSTALL_ENVOY_ENTITY_MIB) +extern bits32_t envoyGetSysUpTime(); + +#define ENVOY_GET_SYSUPTIME(CON) envoyGetSysUpTime(CON) +#endif /* #if (INSTALL_ENVOY_AGENTX_MASTER) || (INSTALL_ENVOY_ENTITY_MIB) */ + +/* Routines required by agentx */ +#if INSTALL_ENVOY_AGENTX_MASTER + +/* This placeholders eliminate need to include axapi.h and */ +/* the attendant duplicate definitions that can occur. */ + +struct AX_CONNENT_S; +struct AX_CONN_S; + +/* Master agent routines and macros */ +extern bits32_t envoyAxConnEntry (bits32_t axConnID, int matchFlag, struct AX_CONNENT_S *pConnEntry); +extern bits32_t envoyAxGetConnID (struct AX_CONN_S *pCE); + +#define ENVOY_AX_CONN_ENTRY(INDEX, MATCH_TYPE, P_CONNENT) envoyAxConnEntry(INDEX, MATCH_TYPE, P_CONNENT) +#define ENVOY_AX_GET_CONNID(CONN_ENTRY) envoyAxGetConnID(CONN_ENTRY) + +#endif /* #if INSTALL_ENVOY_AGENTX_MASTER */ + +#if INSTALL_ENVOY_AGENTX_SUB +/* then we do the subagent agentx macros */ + +extern int envoy_ax_sa_mib_root_node __((PTR_T, SNMP_PKT_T *)); + +#define ENVOY_AX_SA_MIB_ROOT_NODE(CKE, PKT) envoy_ax_sa_mib_root_node(CKE, PKT) +#define ENVOY_AX_SA_TIMEOUT 1000 + +#endif /* #if INSTALL_ENVOY_AGENTX_SUB */ + + + +/*---------------------------------------------------------------- + SNMP_release_private -- Get rid of a any private data attached to the packet + structure. May be left undefined in which case nothing + is done with the private field when the SNMP packet + structure is freed. + + Parameters: + SNMP_PKT_T *pkt The packet itself + + Returns: Nothing + ----------------------------------------------------------------*/ + +extern void snmpHookPrivRelease __((SNMP_PKT_T*)); +#define SNMP_release_private(pkt) snmpHookPrivRelease (pkt) + + + +#if (INSTALL_ENVOY_SNMP_PROXY) +extern void proxy_release_private __((SNMP_PKT_T *)); +#define SNMP_release_private(pkt) proxy_release_private(pkt) +#endif /* (INSTALL_ENVOY_SNMP_PROXY) */ + + + +/*---------------------------------------------------------------- + SNMP_user_get_encode_buffer -- Allows the user the opportunity to get the + buffer that the SNMP packet will be encoded into. + If not used then leave undefined. + + Parameters: + SNMP_PKT_T *pkt The packet being encoded. + unsigned int need The amount of storage needed. + EBUFFER_T *ebuffp The ebuffer to fill in with the actual + buffer. + + Returns: + 0 successful + 1 not successful + ----------------------------------------------------------------*/ +/* #define SNMP_user_get_encode_buffer(pkt, need, ebuffp) 0 */ + + +/*---------------------------------------------------------------- + SNMP_trace_input + SNMP_trace_output + -- for implementing packet tracing through the + SNMP code. May not be left undefined but may + instead be defined as nothing. + + Parameters: + SNMP_PKT_T *pkt The packet being traced + + Returns: Nothing + + ----------------------------------------------------------------*/ + +extern void snmpTraceInput (SNMP_PKT_T *); + +#define SNMP_TRACE_INPUT(pkt) snmpTraceInput (pkt) +#define SNMP_TRACE_OUTPUT(pkt) + +/***************************************************************** + * The next series of macros are hooks into the processing of SET PDUs. + * For most uses you should be able to leave these undefined. + *****************************************************************/ + +/*---------------------------------------------------------------- + SNMP_validate_set_pdu -- Perform a global validation of a SET PDU. + + Parameters: + SNMP_PKT_T *pkt The packet itself + + Returns: + -1 If the PDU is bad and should be rejected with a GEN_ERR. + 0 If the PDU is good and normal handling should proceed. + +1 If the PDU is good and this routine has performed all of + the set operations internally. + ----------------------------------------------------------------*/ + +extern int snmpHookSetPduValidate __((SNMP_PKT_T*)); +#define SNMP_validate_set_pdu(pkt) snmpHookSetPduValidate (pkt) + + +/*---------------------------------------------------------------- + SNMP_user_pre_set -- Perform a global validation of a SET PDU after all of the + test procedures have been called and given the "go ahead". + + Parameters: + SNMP_PKT_T *pkt The packet itself + + Returns: + -1 If the PDU is bad and should be rejected with a GEN_ERR. + 0 If the PDU is good and normal handling should proceed. + +1 If the PDU is good and this routine has performed all of + the set operations internally. + ----------------------------------------------------------------*/ + + +extern int snmpHookPreSet __((SNMP_PKT_T*)); +#define SNMP_user_pre_set(pkt) snmpHookPreSet(pkt) + + + + +/*---------------------------------------------------------------- + SNMP_user_post_set -- Perform any final activities after all of the set + procedures have been called. + + Parameters: + SNMP_PKT_T *pkt The packet itself + + Returns: Nothing + ----------------------------------------------------------------*/ + + +extern int snmpHookPostSet __((SNMP_PKT_T*)); +#define SNMP_user_post_set snmpHookPostSet + +/************************************************************************************* +* set failed routine +*/ + +extern int snmpHookSetFailed __((SNMP_PKT_T*)); +#define SNMP_user_set_failed snmpHookSetFailed + + + + +#if (INSTALL_ENVOY_SNMP_LOCK) + +#define ENVOY_SNMP_LOCK(name) ENVOY_LOCK_T name +#define ENVOY_SNMP_LOCK_EXTERN(name) extern ENVOY_LOCK_T name + +#define ENVOY_SNMP_INIT_LOCK(name) (name) = semBCreate (SEM_Q_PRIORITY, SEM_FULL) + +#define ENVOY_SNMP_FREE_LOCK_TAG(name, tag) semDelete ((name)) + +#define ENVOY_SNMP_GET_READ_LOCK(name) semTake (name, WAIT_FOREVER) +#define ENVOY_SNMP_GET_WRITE_LOCK(name) semTake (name, WAIT_FOREVER) +#define ENVOY_SNMP_RELEASE_READ_LOCK(name) semGive (name) +#define ENVOY_SNMP_RELEASE_WRITE_LOCK(name) semGive (name) + +#endif /* (INSTALL_ENVOY_SNMP_LOCK) */ + + +extern void envoy_call_timer __((bits32_t, void (*)(void))); +extern bits32_t envoy_now __((void)); + +#define ENVOY_CALL_TIMER(T, H) envoy_call_timer(T, H) +#define ENVOY_NOW() envoy_now() + +/* Definitions for use with the Virtual Stack features. + * SNMP_VIRTUAL_STACK_NUM specifies the number of virtual stacks for whcih we + * should add community and context information. + * SNMP_SET_VIRTUAL_STACK specifies the function to call to actually change + * the virtual stack we wish to use + * NAMING_SCOPE_PREFIX specifies the string to be prepended to the stack number + * for use within a community string or context name. + * ENT_LOGICAL_DESCR specifies the string to be prepended to the description in + * the entity table + * ENT_LOGICAL_TADDRESS specifies the address to be used in the entity table + */ + +#if INSTALL_SNMP_VXWORKS_VIRTUAL_STACK + +#define SNMP_VIRTUAL_STACK_NUM 2 +#define SNMP_SET_VIRTUAL_STACK virtualStackNumTaskIdSet + +#define NAMING_SCOPE_PREFIX "VS" + +#if INSTALL_SNMP_VXWORKS_VS_ENTITY +#define ENT_LOGICAL_DESCR "Virtual Stack #" +#define ENT_LOGICAL_TADDRESS "192.168.0.52" +#endif /* INSTALL_SNMP_VXWORKS_VS_ENTITY */ + + +/* Routines for use with the dynamic naming features. This feature allows + * community strings or context names to be dynamically configured instead + * of being statically built at compile time. This feature is useful with + * the virtual stack option to allow new community strings or context names + * to be added (removed) as a virtual is created (destroyed). + */ + +extern void defaultCommunityStringsRegister __((bits32_t)); + +#define DEFAULT_COMMUNITIES_REGISTER(vsNum) \ + defaultCommunityStringsRegister (vsNum) + +extern void vsCommunityStringsRegister __((int)); + +#define VS_COMMUNITY_REGISTER(vsNum) \ + vsCommunityStringsRegister (vsNum) + + +#if INSTALL_ENVOY_SNMP_VERSION_3 + +extern void defaultContextNamesRegister __((bits32_t)); + +#define DEFAULT_CONTEXTS_REGISTER(vsNum) \ + defaultContextNamesRegister (vsNum) + +extern void vsContextNameRegister __((int)); + +#define VS_CONTEXT_REGISTER(vsNum) \ + vsContextNameRegister (vsNum) + +#endif /* INSTALL_ENVOY_SNMP_VERSION_3 */ + +#endif /* INSTALL_SNMP_VXWORKS_VIRTUAL_STACK */ + + +#define snmpdGroupByGetprocAndInstance group_by_getproc_and_instance +#define snmpdVbRowLooseExtract vb_extract_row_loose +#define snmpdVbRowExtract vb_extract_row +#define snmpdContinue SNMP_Continue_function +#define SNMP_user_set_failed snmpHookSetFailed + + + +#endif /* CONFIG_PREAMBLE */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ diff --git a/h/errno.h b/h/errno.h new file mode 100644 index 0000000..17c5129 --- /dev/null +++ b/h/errno.h @@ -0,0 +1,197 @@ +/* errno.h - errno numbers */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)errno.h 7.1 (Berkeley) 6/4/86 + */ + +/* +modification history +-------------------- +01r,24jan05,vvv added EDQUOT +01q,05nov03,mcm Adding EFPOS, EILSEQ +01p,21jun00,rsh upgrade to dosFs 2.0 +01p,10feb99,spm added comments for STREAMS errors and updated ERRMAX value +01o,30jun98,lrn added ERRNO_PX_FLAG and MAP_ERRNO_2_POSIX (SPR#20700) +01n,20aug95,jag added ENOSR ENOSTR EPROTO EBADMSG ENODATA ETIME ENOMSG +01m,15nov93,dvs added ENOSYS and ECANCELED +01l,13nov92,dnw added conditional definition of errno for non-ANSI (SPR #1771) +01k,02oct92,srh added c++ version of errno macro +01j,22sep92,rrr added support for c++ +01i,18jul92,smb finished ANSI merge +01i,08jul92,smb Phase 1 of ANSI merge +01h,04jul92,jcf cleaned up. +01g,26may92,rrr the tree shuffle +01f,04oct91,rrr passed through the ansification filter + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01e,25oct90,dnw removed some unused definitions. +01d,05oct90,shl added copyright notice. +01c,24sep90,elr ifdef'd errno declaration for assembly. +01b,13jul90,dnw added declaration of errno for ANSI compliance +*/ + +#ifndef __INCerrnoh +#define __INCerrnoh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types/vxANSI.h" + +/* + * POSIX Error codes + */ + +#define EPERM 1 /* Not owner */ +#define ENOENT 2 /* No such file or directory */ +#define ESRCH 3 /* No such process */ +#define EINTR 4 /* Interrupted system call */ +#define EIO 5 /* I/O error */ +#define ENXIO 6 /* No such device or address */ +#define E2BIG 7 /* Arg list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file number */ +#define ECHILD 10 /* No children */ +#define EAGAIN 11 /* No more processes */ +#define ENOMEM 12 /* Not enough core */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +#define ENOTEMPTY 15 /* Directory not empty */ +#define EBUSY 16 /* Mount device busy */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Cross-device link */ +#define ENODEV 19 /* No such device */ +#define ENOTDIR 20 /* Not a directory*/ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* File table overflow */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Not a typewriter */ +#define ENAMETOOLONG 26 /* File name too long */ +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Illegal seek */ +#define EROFS 30 /* Read-only file system */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ +#define EDEADLK 33 /* Resource deadlock avoided */ +#define ENOLCK 34 /* No locks available */ +#define ENOTSUP 35 /* Unsupported value */ +#define EMSGSIZE 36 /* Message size */ + +/* ANSI math software */ +#define EDOM 37 /* Argument too large */ +#define ERANGE 38 /* Result too large */ + +/* ipc/network software */ + + /* argument errors */ +#define EDESTADDRREQ 40 /* Destination address required */ +#define EPROTOTYPE 41 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 42 /* Protocol not available */ +#define EPROTONOSUPPORT 43 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 44 /* Socket type not supported */ +#define EOPNOTSUPP 45 /* Operation not supported on socket */ +#define EPFNOSUPPORT 46 /* Protocol family not supported */ +#define EAFNOSUPPORT 47 /* Addr family not supported */ +#define EADDRINUSE 48 /* Address already in use */ +#define EADDRNOTAVAIL 49 /* Can't assign requested address */ +#define ENOTSOCK 50 /* Socket operation on non-socket */ + + /* operational errors */ +#define ENETUNREACH 51 /* Network is unreachable */ +#define ENETRESET 52 /* Network dropped connection on reset*/ +#define ECONNABORTED 53 /* Software caused connection abort */ +#define ECONNRESET 54 /* Connection reset by peer */ +#define ENOBUFS 55 /* No buffer space available */ +#define EISCONN 56 /* Socket is already connected */ +#define ENOTCONN 57 /* Socket is not connected */ +#define ESHUTDOWN 58 /* Can't send after socket shutdown */ +#define ETOOMANYREFS 59 /* Too many references: can't splice */ +#define ETIMEDOUT 60 /* Connection timed out */ +#define ECONNREFUSED 61 /* Connection refused */ +#define ENETDOWN 62 /* Network is down */ +#define ETXTBSY 63 /* Text file busy */ +#define ELOOP 64 /* Too many levels of symbolic links */ +#define EHOSTUNREACH 65 /* No route to host */ +#define ENOTBLK 66 /* Block device required */ +#define EHOSTDOWN 67 /* Host is down */ + +/* non-blocking and interrupt i/o */ +#define EINPROGRESS 68 /* Operation now in progress */ +#define EALREADY 69 /* Operation already in progress */ +#define EWOULDBLOCK 70 /* Operation would block */ + +#define ENOSYS 71 /* Function not implemented */ + +/* aio errors (should be under posix) */ +#define ECANCELED 72 /* Operation canceled */ + + +/* specific STREAMS errno values */ +#define ENOSR 74 /* Insufficient memory */ +#define ENOSTR 75 /* STREAMS device required */ +#define EPROTO 76 /* Generic STREAMS error */ +#define EBADMSG 77 /* Invalid STREAMS message */ +#define ENODATA 78 /* Missing expected message data */ +#define ETIME 79 /* STREAMS timeout occurred */ +#define ENOMSG 80 /* Unexpected message type */ + +#define EFPOS 81 /* File positioning error */ +#define EILSEQ 82 /* Illegal byte sequence. */ + +/* error codes used by network stack */ + +#define EDQUOT 83 /* routing error */ + +#define ERRMAX 84 + +/* for module specific error codes which can be mapped to one of the above */ +#define ERRNO_PX_FLAG (1<<15) + +/* macro to map module-specific error codes to POSIX if applicable */ +#define MAP_ERRNO_2_POSIX(errno) \ + (((errno) & ERRNO_PX_FLAG)? (errno) &= 0x7fff : (errno) ) + + +/* Definition of errno */ + +#ifndef _ASMLANGUAGE + +#if defined(__STDC__) || defined(__cplusplus) +extern int * __errno(void); +#else +extern int * __errno(); +#endif /* __STDC__ */ + + +#ifdef __cplusplus + +inline int &__errnoRef() + { + return (*__errno()); + } + +#define errno __errnoRef() + +#else + +#define errno (*__errno()) + +#endif /* __cplusplus */ + +#endif /* _ASMLANGUAGE */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCerrnoh */ diff --git a/h/errnoLib.h b/h/errnoLib.h new file mode 100644 index 0000000..90f10d0 --- /dev/null +++ b/h/errnoLib.h @@ -0,0 +1,60 @@ +/* errnoLib.h - error status library header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,22sep92,rrr added support for c++ +01i,18jul92,smb added include errno.h. +01i,09jul92,smb move function declarations from errno.h +01h,04jul92,jcf cleaned up. +01g,26may92,rrr the tree shuffle +01f,26nov91,llk added S_errnoLib_NO_STAT_SYM_TBL. + removed errno and function prototypes (already in errno.h). +01e,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01d,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01c,02mar90,jcf changed to support _errno. +01b,05jun88,dnw changed stsLib to errnoLib. +01a,29apr88,gae written. +*/ + +#ifndef __INCerrnoLibh +#define __INCerrnoLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "errno.h" + +/* status codes */ + +#define S_errnoLib_NO_STAT_SYM_TBL (M_errnoLib | 1) + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS errnoOfTaskSet (int taskId, int errorValue); +extern STATUS errnoSet (int errorValue); +extern int errnoGet (void); +extern int errnoOfTaskGet (int taskId); + +#else /* __STDC__ */ + +extern STATUS errnoOfTaskSet (); +extern STATUS errnoSet (); +extern int errnoGet (); +extern int errnoOfTaskGet (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCerrnoLibh */ diff --git a/h/esf.h b/h/esf.h new file mode 100644 index 0000000..30ba4f2 --- /dev/null +++ b/h/esf.h @@ -0,0 +1,95 @@ +/* esf.h - exception stack frames */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02e,17apr03,dbt Added SIMLINUX support. +02d,22oct01,dee Merge fro T2.1.0 ColdFire +02c,01mar00,frf Add SH4 support for T2. +02b,23apr97,hk added SH support. +02b,15aug97,cym added SIMNT support. +02b,28nov96,cdp added ARM support. +02a,26may94,yao added PPC support. +01o,19mar95,dvs removed #ifdef TRON - tron no longer supported. +01n,02dec93,pme added Am29K family support +01m,11aug93,gae vxsim hppa. +01l,20jun93,gae vxsim. +01k,09jun93,hdn added support for I80X86 +01j,22sep92,rrr added support for c++ +01i,04jul92,jcf cleaned up. +01h,26may92,rrr the tree shuffle + -changed includes to have absolute path from h/ +01g,09jan92,jwt converted CPU==SPARC to CPU_FAMILY==SPARC. +01f,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01e,02aug91,ajm added MIPS support +01d,19jul91,gae renamed architecture specific include file to be xx.h. +01c,29apr91,hdn added defines and macros for TRON architecture. +01b,05oct90,shl added copyright notice. + made #endif ANSI style. +01a,07aug89,gae written. +*/ + +#ifndef __INCesfh +#define __INCesfh + +#ifdef __cplusplus +extern "C" { +#endif + +#if (CPU_FAMILY==MC680X0) +#include "arch/mc68k/esfMc68k.h" +#endif /* CPU_FAMILY==MC680X0 */ + +#if (CPU_FAMILY==COLDFIRE) +#include "arch/coldfire/esfColdfire.h" +#endif /* CPU_FAMILY==COLDFIRE */ + +#if (CPU_FAMILY==SPARC) +#include "arch/sparc/esfSparc.h" +#endif /* CPU_FAMILY==SPARC */ + +#if (CPU_FAMILY==SIMSPARCSOLARIS) +#include "arch/simsolaris/esfSimsolaris.h" +#endif /* CPU_FAMILY==SIMSPARCSOLARIS */ + +#if (CPU_FAMILY==SIMLINUX) +#include "arch/simlinux/esfSimlinux.h" +#endif /* CPU_FAMILY==SIMLINUX */ + +#if (CPU_FAMILY==SIMNT) +#include "arch/simnt/esfSimnt.h" +#endif /* CPU_FAMILY==SIMNT */ + +#if (CPU_FAMILY==MIPS) +#include "arch/mips/esfMips.h" +#endif /* MIPS */ + +#if (CPU_FAMILY==PPC) +#include "arch/ppc/esfPpc.h" +#endif /* CPU_FAMILY==PPC */ + +#if (CPU_FAMILY==I80X86) +#include "arch/i86/esfI86.h" +#endif /* CPU_FAMILY==I80X86 */ + +#if (CPU_FAMILY==AM29XXX) +#include "arch/am29k/esfAm29k.h" +#endif /* CPU_FAMILY==AM29XXX */ + +#if (CPU_FAMILY==SH) +#include "arch/sh/esfSh.h" +#endif /* CPU_FAMILY==SH */ + +#if CPU_FAMILY==ARM +#include "arch/arm/esfArm.h" +#endif /* CPU_FAMILY==ARM */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCesfh */ diff --git a/h/etherLib.h b/h/etherLib.h new file mode 100644 index 0000000..5531851 --- /dev/null +++ b/h/etherLib.h @@ -0,0 +1,94 @@ +/* etherLib.h - ethernet hook routines header */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01k,10oct01,rae update copyright +01j,17dec96,gnn removed some prototypes to have variable args +01k,22oct96,gnn added support for the etherTypeGet call. + added the ENET_HDR typedef. +01j,22sep92,rrr added support for c++ +01i,04jul92,jcf cleaned up. +01h,26may92,rrr the tree shuffle + -changed includes to have absolute path from h/ +01g,26feb92,elh added prototypes for ether{Input,Output}HookDelete. +01f,04oct91,rrr passed through the ansification filter + -changed includes to have absolute path from h/ + -fixed #else and #endif + -changed copyright notice +01e,15jan91,shl included "if.h" and "if_ether.h" so ifnet and ether_header + are defined before the prototypes. +01d,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01c,07aug90,shl added INCetherLibh to #endif. +01b,01nov87,dnw added etherOutputHookRtn. +01a,28aug87,dnw written +*/ + +#ifndef __INCetherLibh +#define __INCetherLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "net/if.h" +#include "netinet/if_ether.h" + +IMPORT FUNCPTR etherInputHookRtn; +IMPORT FUNCPTR etherOutputHookRtn; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* defints */ +typedef struct enet_hdr + { + char dst [6]; + char src [6]; + USHORT type; + } ENET_HDR; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#define ENET_HDR_SIZ sizeof(ENET_HDR) +#define ENET_HDR_REAL_SIZ 14 + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS etherAddrResolve (struct ifnet *pIf, char *targetAddr, + char *eHdr, int numTries, int numTicks); +extern STATUS etherInputHookAdd (); +extern STATUS etherOutput (struct ifnet *pIf, struct ether_header + *pEtherHeader, char *pData, int dataLength); +extern STATUS etherOutputHookAdd (); +extern void etherInputHookDelete (); +extern void etherOutputHookDelete (); + +extern USHORT etherTypeGet (char *pPacket); + +#else /* __STDC__ */ + +extern STATUS etherAddrResolve (); +extern STATUS etherInputHookAdd (); +extern STATUS etherOutput (); +extern STATUS etherOutputHookAdd (); +extern void etherInputHookDelete (); +extern void etherOutputHookDelete (); +extern USHORT etherTypeGet (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCetherLibh */ diff --git a/h/etherMultiLib.h b/h/etherMultiLib.h new file mode 100644 index 0000000..3bcfdd7 --- /dev/null +++ b/h/etherMultiLib.h @@ -0,0 +1,64 @@ +/* etherMultiLib.h - definitions for the Ethernet multicast library */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,12aug97,gnn cleaned up dependencies for multicast handling. +01c,23oct96,gnn name changes to follow coding standards. +01b,07may96,gnn added routines to handle non-IP based multicast + addresses. + Added list handling library. +01a,15apr96,gnn written. + +*/ + +/* +DESCRIPTION + +This header file describes data structures and function prototypes for +the ethernet multicast library. + +INCLUDE FILES: +*/ + +#ifndef __INCetherMultiLibh +#define __INCetherMultiLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include "lstLib.h" +#include "end.h" +#include "netinet/if_ether.h" + +/* defints */ + +/* typedefs */ + +/* globals */ + +/* locals */ + +/* forward declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern int etherMultiAdd(LIST *pList, char* pAddress ); +extern int etherMultiDel(LIST* pList, char* pAddress); +extern int etherMultiGet(LIST *pList, MULTI_TABLE* pTable); +#else /* __STDC__ */ + +extern int etherMultiAdd(); +extern int etherMultiDel(); +extern int etherMultiGet(); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCetherMultiLibh */ diff --git a/h/eventLib.h b/h/eventLib.h new file mode 100644 index 0000000..88e9f4e --- /dev/null +++ b/h/eventLib.h @@ -0,0 +1,112 @@ +/* eventLib.h - events library header file */ + +/* Copyright 2001-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,18nov02,bwa Added EVENTS_KEEP_UNWANTED option (SPR 84417). +01d,15jan02,bwa Removed events 25 to 32 from list of events available to user. +01c,13nov01,bwa Changed EVENTxx defs to VXEVxx. +01b,17oct01,bwa Added #include "vwModNum.h". Added 2 errnos. +01a,20sep01,bwa Created +*/ + +#ifndef __INCeventLibh +#define __INCeventLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "vwModNum.h" + +/* errnos */ + +#define S_eventLib_TIMEOUT (M_eventLib | 0x0001) +#define S_eventLib_NOT_ALL_EVENTS (M_eventLib | 0x0002) +#define S_eventLib_ALREADY_REGISTERED (M_eventLib | 0x0003) +#define S_eventLib_EVENTSEND_FAILED (M_eventLib | 0x0004) +#define S_eventLib_ZERO_EVENTS (M_eventLib | 0x0005) +#define S_eventLib_TASK_NOT_REGISTERED (M_eventLib | 0x0006) +#define S_eventLib_NULL_TASKID_AT_INT_LEVEL (M_eventLib | 0x0007) + +/* options */ + +#define EVENTS_WAIT_ALL 0x00 /* wait for all events to occur */ +#define EVENTS_WAIT_ANY 0x01 /* wait for one of many events */ +#define EVENTS_RETURN_ALL 0x02 /* return all events received */ +#define EVENTS_KEEP_UNWANTED 0x04 /* don't clear unwanted events */ +#define EVENTS_FETCH 0x80 /* return events received immediately */ + +/* resource-related options */ + +#define EVENTS_OPTIONS_NONE 0x00 +#define EVENTS_SEND_ONCE 0x01 /* unregister events after eventSend */ +#define EVENTS_ALLOW_OVERWRITE 0x02 /* can overwrite previous registration */ +#define EVENTS_SEND_IF_FREE 0x04 /* send events in xxxEvStart() */ + +/* + * Defines for all 24 events available to users. Events 25 to 32 are reserved + * for system use and should never be used outside of that scope + */ + +#define VXEV01 0x00000001 +#define VXEV02 0x00000002 +#define VXEV03 0x00000004 +#define VXEV04 0x00000008 +#define VXEV05 0x00000010 +#define VXEV06 0x00000020 +#define VXEV07 0x00000040 +#define VXEV08 0x00000080 +#define VXEV09 0x00000100 +#define VXEV10 0x00000200 +#define VXEV11 0x00000400 +#define VXEV12 0x00000800 +#define VXEV13 0x00001000 +#define VXEV14 0x00002000 +#define VXEV15 0x00004000 +#define VXEV16 0x00008000 +#define VXEV17 0x00010000 +#define VXEV18 0x00020000 +#define VXEV19 0x00040000 +#define VXEV20 0x00080000 +#define VXEV21 0x00100000 +#define VXEV22 0x00200000 +#define VXEV23 0x00400000 +#define VXEV24 0x00800000 + +#define VXEV_USER_MASK 0x00ffffff + +#ifndef _ASMLANGUAGE + +/* function declaration */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS eventSend (int taskId, UINT32 events); +extern STATUS eventReceive ( + UINT32 events, + UINT8 options, + int timeout, + UINT32 *eventsReceived + ); +extern STATUS eventClear (void); + +#else + +extern STATUS eventSend (); +extern STATUS eventReceive (); +extern STATUS eventClear (); + +#endif + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCeventLibh */ + diff --git a/h/eventLibCommon.h b/h/eventLibCommon.h new file mode 100644 index 0000000..31ff03a --- /dev/null +++ b/h/eventLibCommon.h @@ -0,0 +1,111 @@ +/* eventLibCommon.h - common events library header file */ + +/* Copyright 2001-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,26feb04,dcc moved VX_EVT_CTL_CMD definition to the not-assembly part of + the file. +01a,05sep03,dcc written based on v01e of the kernel version of eventLib.h +*/ + +#ifndef __INCeventLibCommonh +#define __INCeventLibCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "vwModNum.h" + +/* errnos */ + +#define S_eventLib_TIMEOUT (M_eventLib | 0x0001) +#define S_eventLib_NOT_ALL_EVENTS (M_eventLib | 0x0002) +#define S_eventLib_ALREADY_REGISTERED (M_eventLib | 0x0003) +#define S_eventLib_EVENTSEND_FAILED (M_eventLib | 0x0004) +#define S_eventLib_ZERO_EVENTS (M_eventLib | 0x0005) +#define S_eventLib_TASK_NOT_REGISTERED (M_eventLib | 0x0006) +#define S_eventLib_NULL_TASKID_AT_INT_LEVEL (M_eventLib | 0x0007) + +/* options */ + +#define EVENTS_WAIT_ALL 0x00 /* wait for all events to occur */ +#define EVENTS_WAIT_ANY 0x01 /* wait for one of many events */ +#define EVENTS_RETURN_ALL 0x02 /* return all events received */ +#define EVENTS_KEEP_UNWANTED 0x04 /* don't clear unwanted events */ +#define EVENTS_FETCH 0x80 /* return events received immediately */ + +/* resource-related options */ + +#define EVENTS_OPTIONS_NONE 0x00 +#define EVENTS_SEND_ONCE 0x01 /* unregister events after eventSend */ +#define EVENTS_ALLOW_OVERWRITE 0x02 /* can overwrite previous registration */ +#define EVENTS_SEND_IF_FREE 0x04 /* send events in xxxEvStart() */ + + +/* + * Defines for all 24 events available to users. Events 25 to 32 are reserved + * for system use and should never be used outside of that scope + */ + +#define VXEV01 0x00000001 +#define VXEV02 0x00000002 +#define VXEV03 0x00000004 +#define VXEV04 0x00000008 +#define VXEV05 0x00000010 +#define VXEV06 0x00000020 +#define VXEV07 0x00000040 +#define VXEV08 0x00000080 +#define VXEV09 0x00000100 +#define VXEV10 0x00000200 +#define VXEV11 0x00000400 +#define VXEV12 0x00000800 +#define VXEV13 0x00001000 +#define VXEV14 0x00002000 +#define VXEV15 0x00004000 +#define VXEV16 0x00008000 +#define VXEV17 0x00010000 +#define VXEV18 0x00020000 +#define VXEV19 0x00040000 +#define VXEV20 0x00080000 +#define VXEV21 0x00100000 +#define VXEV22 0x00200000 +#define VXEV23 0x00400000 +#define VXEV24 0x00800000 + +#define VXEV_USER_MASK 0x00ffffff + +#ifndef _ASMLANGUAGE + +/* typedefs */ + +typedef struct events_desc + { + UINT32 wanted; /* 0x00: events wanted */ + UINT32 received; /* 0x04: all events received */ + UINT8 options; /* 0x08: user options */ + } EVENTS_DESC; + +/* function declaration */ + +extern STATUS eventSend (int taskId, UINT32 events); +extern STATUS eventReceive ( + UINT32 events, + UINT8 options, + int timeout, + UINT32 *eventsReceived + ); +extern STATUS eventClear (void); + + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCeventLibCommonh */ + diff --git a/h/excLib.h b/h/excLib.h new file mode 100644 index 0000000..8c21f4e --- /dev/null +++ b/h/excLib.h @@ -0,0 +1,154 @@ +/* excLib.h - exception library header */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +02l,28sep05,kk remove deprecated message in excJobAdd() +02k,08feb05,pch SPR 102772: add errno S_excLib_INTERRUPT_STACK_OVERFLOW +02j,22oct04,pch SPR 92598: add errno S_excLib_EXCEPTION_STACK_OVERFLOW +02i,04sep04,dbt Fixed excJobAdd() declaration. +02h,02sep04,ans Deprecate excJobAdd +02g,09oct03,pcm corrected declaration of printExc() +02f,17apr03,dbt Added SIMLINUX support. +02e,13nov01,yvp Added excExtendedVectors - support for extended branch + vectors. Also moved private functions into the newly created + h/privare/excLibP.h. +02d,22oct01,dee Merge from T2.1.0 ColdFire +02c,01mar00,frf Add SH4 support for T2. +02b,23apr97,hk added SH support. +02b,15aug97,cym added SIMNT support. +02b,28nov96,cdp added ARM support. +02a,26may94,yao added PPC support. +01y,12jul95,ism added simsolaris support +01x,19mar95,dvs removed #ifdef TRON - tron no longer supported. +01w,29jan94,gae added ASMLANGUAGE around typedef. +01v,02dec93,pme added Am29K family support +01u,15oct93,cd added #ifndef _ASMLANGUAGE. +01t,11aug93,gae vxsim hppa. +01s,20jun93,gae vxsim. +01r,09jun93,hdn added support for I80X86 +01q,22sep92,rrr added support for c++ +01p,02aug92,jcf removed excDeliverHook decl/added excShowInit. +01o,27jul92,rrr added excDeliverHook decl +01n,04jul92,jcf cleaned up. +01m,26may92,rrr the tree shuffle + -changed includes to have absolute path from h/ +01l,20jan92,yao added ANSI function prototype for excInfoShow(), printExc(). + added EXC_FAULT_TAB. +01k,09jan92,jwt added ANSI function prototype for excJobAdd(). +01j,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01i,02aug91,ajm added MIPS support +01h,19jul91,gae renamed architecture specific include file to be xx.h. +01g,22may91,wmd made to include "CPU/excLib.h". +01f,29apr91,hdn added TRON defines and macros. +01e,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01d,29sep90,del added include i960/exc960Lib.h for I960 CPU_FAMILY +01c,01aug90,jcf padded EXC_INFO to four byte boundary. + changed USHORT to UINT16. +01b,28apr89,mcl added SPARC. +01a,28may88,dnw written +*/ + +#ifndef __INCexcLibh +#define __INCexcLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#define S_excLib_EXCEPTION_STACK_OVERFLOW (M_excLib | 1) +#define S_excLib_INTERRUPT_STACK_OVERFLOW (M_excLib | 2) + +#if CPU_FAMILY==I960 +#include +#endif /* CPU_FAMILY==I960 */ + +#if CPU_FAMILY==MC680X0 +#include +#endif /* CPU_FAMILY==MC680X0 */ + +#if CPU_FAMILY==COLDFIRE +#include +#endif /* CPU_FAMILY==COLDFIRE */ + +#if CPU_FAMILY==MIPS +#include +#endif /* CPU_FAMILY==MIPS */ + +#if CPU_FAMILY==PPC +#include +#endif /* CPU_FAMILY==PPC */ + +#if CPU_FAMILY==SPARC +#include +#endif /* CPU_FAMILY==SPARC */ + +#if CPU_FAMILY==SIMSPARCSOLARIS +#include +#endif /* CPU_FAMILY==SIMSPARCSOLARIS */ + +#if CPU_FAMILY==SIMLINUX +#include +#endif /* CPU_FAMILY==SIMLINUX */ + +#if CPU_FAMILY==SIMNT +#include +#endif /* CPU_FAMILY==SIMNT */ + +#if CPU_FAMILY==I80X86 +#include +#endif /* CPU_FAMILY==I80X86 */ + +#if CPU_FAMILY==AM29XXX +#include +#endif /* CPU_FAMILY==AM29XXX */ + +#if CPU_FAMILY==SH +#include +#endif /* CPU_FAMILY==SH */ + +#if CPU_FAMILY==ARM +#include +#endif /* CPU_FAMILY==ARM */ + + +#ifndef _ASMLANGUAGE + +typedef struct excfaultTab + { + int faultType; /* fault type */ + int subtype; /* fault sub type */ + int signal; /* signal */ + int code; /* code */ + } EXC_FAULT_TAB; + +/* function declarations */ + +extern STATUS excShowInit (void); +extern void excHookAdd (FUNCPTR excepHook); +extern STATUS excJobAdd (VOIDFUNCPTR func, int arg1, int arg2, int arg3, + int arg4, int arg5, int arg6); +extern void printExc (char * fmt, int arg1, int arg2, int arg3, + int arg4, int arg5); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCexcLibh */ diff --git a/h/fcntl.h b/h/fcntl.h new file mode 100644 index 0000000..57f9117 --- /dev/null +++ b/h/fcntl.h @@ -0,0 +1,56 @@ +/* fcntl.h - standard header */ + +/* + * Copyright (c) 1991-1992, 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01i,06aug05,pad Fixed usage of _WRS_KERNEL macro and updated copyright. +01h,03aug05,hya added fcntl() +01g,09may05,hya changed user APIs for POSIX compliance. +01f,22sep92,rrr added support for c++ +01e,18sep92,smb added prototypes for open and creat. +01d,29jul92,smb rearranged for the stdio library. +01c,04jul92,jcf cleaned up. +01b,26may92,rrr the tree shuffle +01a,05dec91,rrr written. +*/ + +#ifndef __INCfcntlh +#define __INCfcntlh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#define O_NDELAY _FNDELAY /* Non-blocking I/O (4.2 style) */ + +int fcntl (int fd, int cmd, ...); + +#ifdef _WRS_KERNEL + +extern int open (const char *, int, int); +extern int creat (const char *, int); + +#else + +extern int open (const char *, int, ...); +extern int creat (const char *, mode_t ); + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfcntlh */ diff --git a/h/fioLib.h b/h/fioLib.h new file mode 100644 index 0000000..d0cd8e7 --- /dev/null +++ b/h/fioLib.h @@ -0,0 +1,75 @@ +/* fioLib.h - header for formatted i/o library */ + +/* Copyright 1984-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01o,14may95,p_m added fioLibInit() prototype. +01n,20jul92,jmm removed declaration of itob() +01m,13nov92,dnw made include of stdarg.h conditional on __STDC__ +01l,22sep92,rrr added support for c++ +01k,02aug92,jcf added printExc(). +01j,04jul92,jcf cleaned up. +01i,26may92,rrr the tree shuffle +01h,04dec91,rrr some more ansi cleanup. +01g,04oct91,rrr passed through the ansification filter + -changed includes to have absolute path from h/ + -fixed #else and #endif + -changed copyright notice +01f,24mar91,del added include of varargs.h. +01e,05oct90,shl added ANSI function prototypes. + added copyright notice. + made #endif ANSI style. +01d,07aug90,shl added INCfioLibh to #endif. +01c,10jun90,dnw removed S_fioLib_UNEXPECTED_EOF (no longer returned by fioRead) + This file is now just a place holder! +01b,24dec86,gae changed stsLib.h to vwModNum.h. +01a,07aug84,ecs written +*/ + +#ifndef __INCfioLibh +#define __INCfioLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) || defined(__cplusplus) +#include "stdarg.h" +#endif /* __STDC__ */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void fioLibInit (void); +extern void fioFltInstall (FUNCPTR formatRtn, FUNCPTR scanRtn); +extern int fioFormatV (const char *fmt, va_list vaList, + FUNCPTR outRoutine, int outarg); +extern char * nindex (char *buffer, int c, int n); +extern int fioScanV (const char *fmt, FUNCPTR getRtn, int getArg, + int *pUnget, va_list vaList); +extern int fioRead (int fd, char *buffer, int maxbytes); +extern int fioRdString (int fd, char string[], int maxbytes); +extern void printExc (char* fmt, int arg1, int arg2, int arg3, + int arg4, int arg5); + +#else + +extern void fioLibInit (); +extern void fioFltInstall (); +extern int fioFormatV (); +extern char * nindex (); +extern int fioScanV (); +extern int fioRead (); +extern int fioRdString (); +extern void printExc (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfioLibh */ diff --git a/h/fppLib.h b/h/fppLib.h new file mode 100644 index 0000000..84d5df5 --- /dev/null +++ b/h/fppLib.h @@ -0,0 +1,122 @@ +/* fppLib.h - floating-point coprocessor support library header */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + + +/* +modification history +-------------------- +02f,19apr05,dr Cleanup +02e,17apr03,dbt Added SIMLINUX support. +02d,22oct01,dee Merge from T2.1.0 ColdFire +02c,01mar00,frf Add SH4 support for T2. +02b,23apr97,hk added SH support. +02b,15aug97,cym added SIMNT support. +02b,28nov96,cdp added ARM support. +02a,26may94,yao added PPC support. +01u.26may95,ms added prototypes for fppRegsToCtx and fppCtxToRegs. +01u,12jul95,ism added simsolaris support +01t,19mar95,dvs removed #ifdef TRON - tron no longer supported. +01s,02dec93,pme added Am29K family support +01r,11aug93,gae vxsim hppa. +01q,20jun93,gae vxsim. +01p,09jun93,hdn added support for I80X86 +01o,22sep92,rrr added support for c++ +01n,19sep92,jcf ifdef _ASMLANGUAGE of taskLib.h +01m,19sep92,smb added include of taskLib.h +01l,04jul92,jcf cleaned up. +01k,26may92,rrr the tree shuffle + -changed includes to have absolute path from h/ +01j,20feb92,yao changed ANSI function propotype declaration for + fppTaskRegs{S,G}et() and removed CPU_FAMILY conditionals. +01i,09jan92,jwt converted CPU==SPARC to CPU_FAMILY==SPARC. +01h,01nov91,wmd modified prototype of fpregs in fppTaskRegsGet() to be double. +01g,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01f,20aug91,ajm added MIPS support. +01e,14aug91,del added include for I960KB support. +01d,19jul91,gae renamed architecture specific include file to be xx.h. +01c,29apr91,hdn added defines and macros for TRON architecture. +01b,05oct90,shl added copyright notice. + made #endif ANSI style. +01a,07aug89,gae written. +*/ + +#ifndef __INCfppLibh +#define __INCfppLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE +#include "taskLib.h" +#endif /* _ASMLANGUAGE */ + +#if CPU_FAMILY==COLDFIRE +#include "arch/coldfire/fppColdfireLib.h" +#endif /* CPU==COLDFIRE */ + +#if CPU_FAMILY==MIPS +#include "arch/mips/fppMipsLib.h" +#endif /* MIPS */ + +#if CPU_FAMILY==PPC +#include "arch/ppc/fppPpcLib.h" +#endif /* CPU_FAMILY==PPC */ + +#if CPU_FAMILY==SIMSPARCSOLARIS +#include "arch/simsolaris/fppSimsolarisLib.h" +#endif /* CPU_FAMILY==SIMSPARCSOLARIS */ + +#if CPU_FAMILY==SIMNT +#include "arch/simnt/fppSimntLib.h" +#endif /* CPU_FAMILY==SIMNT */ + +#if CPU_FAMILY==SIMLINUX +#include "arch/simlinux/fppSimlinuxLib.h" +#endif /* CPU_FAMILY==SIMLINUX */ + +#if CPU_FAMILY==I80X86 +#include "arch/i86/fppI86Lib.h" +#endif /* CPU_FAMILY==I80X86 */ + +#if CPU_FAMILY==SH +#include "arch/sh/fppShLib.h" +#endif /* CPU_FAMILY==SH */ + +#if CPU_FAMILY==ARM +#include "arch/arm/fppArmLib.h" +#endif /* CPU_FAMILY==ARM */ + +/* function declarations */ + +#ifndef _ASMLANGUAGE + +extern void fppInit (void); +extern void fppShowInit (void); +extern void fppTaskRegsShow (int task); +extern STATUS fppTaskRegsGet (int task, FPREG_SET *pFpRegSet); +extern STATUS fppTaskRegsSet (int task, FPREG_SET *pFpRegSet); +extern STATUS fppProbe (void); +extern void fppRestore (FP_CONTEXT *pFpContext); +extern void fppSave (FP_CONTEXT *pFpContext); +extern void fppRegsToCtx (FPREG_SET *pFpRegSet, FP_CONTEXT *pFpContext); +extern void fppCtxToRegs (FP_CONTEXT *pFpContext, FPREG_SET *pFpRegSet); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfppLibh */ diff --git a/h/fsEventUtilLib.h b/h/fsEventUtilLib.h new file mode 100644 index 0000000..14ddf8a --- /dev/null +++ b/h/fsEventUtilLib.h @@ -0,0 +1,42 @@ +/* fsEventUtilLib.h - header file for the fsEventUtilLib component */ + +/* +* Copyright (c) 2005 Wind River Systems, Inc. +* +* The right to copy, distribute, modify or otherwise make use +* of this software may be licensed only pursuant to the terms +* of an applicable Wind River license agreement. +*/ + +/* +modification history +-------------------- +01c,11jul05,jlk fixed typo in fsEventUtilLibInit() prototype +01b,23jun05,jlk renamed file +01a,22jun05,jlk written +*/ + +#ifndef __INCfsEventUtilLibh +#define __INCfsEventUtilLibh + +typedef struct pathWaitStruct + { + char * path; + SEM_ID waitSem; + } FS_PATH_WAIT_STRUCT; + + +#ifdef __cplusplus +extern "C" { +#endif + +extern STATUS fsEventUtilLibInit (void); +extern STATUS fsPathAddedEventSetup (FS_PATH_WAIT_STRUCT *, char *); +extern void fsPathAddedEventRaise (char *); +extern STATUS fsWaitForPath (FS_PATH_WAIT_STRUCT *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/fsMonitor.h b/h/fsMonitor.h new file mode 100644 index 0000000..55aa510 --- /dev/null +++ b/h/fsMonitor.h @@ -0,0 +1,75 @@ +/* fsMonitor.h - header file for the fsMonitor component */ + +/* +* Copyright (c) 2005 Wind River Systems, Inc. +* +* The right to copy, distribute, modify or otherwise make use +* of this software may be licensed only pursuant to the terms +* of an applicable Wind River license agreement. +*/ + +/* +modification history +-------------------- +01e,29sep05,rfr Changed return type of exported functions +01d,01jul05,rfr Added prototype for fsmNameMap() +01c,24may05,pcm added PBR_xxx defines +01b,18may05,jlk changed instantiator to take XBD id as well as vol. name +01a,06may05,rfr written +*/ + +#ifndef __INCfsMonitorh +#define __INCfsMonitorh + +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +/* +* MAX_NAME_MAP is the maximum number of characters that a name-mapping function +* may map into. Pragmatically, this is the largest pathname which may be used +* as the root path by an automatically inserted device/filesystem combination. +*/ +#define MAX_NAME_MAP 20 + +/* + * The PBR_xxx defines mark the minimum set of info required for a + * partition boot record. + */ + +#define PBR_JMP 0x00 /* x86 jump instruction (3 bytes) */ +#define PBR_SYS_ID 0x03 /* system ID string (8 bytes) */ +#define PBR_BYTES_PER_BLK 0x0b /* bytes per block (2 bytes) */ +#define PBR_NUM_BLKS 0x20 /* # of blocks on vol (4 bytes) */ + +/* +* Not that we maintain a terminating NUL in fsmName_t. This is so we can pass it +* to functions requiring a NUL terminated string +*/ +typedef char fsmName_t[MAX_NAME_MAP+1]; + + +typedef STATUS (*fsmProbeFunc)(device_t xbdDev); +typedef STATUS (*fsmInstFunc)(device_t xbdDev, char *volName); + +STATUS fsMonitorInit(); + +STATUS fsmProbeInstall(fsmProbeFunc probe, fsmInstFunc inst); +STATUS fsmProbeUninstall(fsmProbeFunc probe); + +STATUS fsmNameInstall(char *driver, char *volume); +STATUS fsmNameUninstall(char *driver); + +STATUS fsmGetDriver(char *volume, devname_t driver); +STATUS fsmGetVolume(char *driver, fsmName_t volume); + +STATUS fsmNameMap(devname_t xbdName, fsmName_t path); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/ftpLib.h b/h/ftpLib.h new file mode 100644 index 0000000..252dcc2 --- /dev/null +++ b/h/ftpLib.h @@ -0,0 +1,192 @@ +/* ftpLib.h - arpa File Transfer Protocol library header */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01n,06jun02,elr Change return for ftpTransientFatalInstall() +01m,23may02,elr added temporary global flag to bypass PASSIVE mode +01l,22may02,elr Changed API of ftpCommandEnhanced() and ftpReplyGetEnhanced() + for PASSIVE mode support + Added function ftpDataConnInitPassiveMode () + Added ftpLibDebugOptionsSet() +01k,12mar02,elr Added error return codes + Replaced ftpErrorSuppress with ftplDebug (SPR 71496) +01j,22sep92,rrr added support for c++ +01i,11sep92,jmm added external definition for ftpErrorSupress (for spr #1257) +01h,04jul92,jcf cleaned up. +01g,26may92,rrr the tree shuffle +01f,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01e,19oct90,shl changed ftpCommand() to use variable length argument list. +01d,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01c,07aug90,shl added INCftpLibh to #endif. +01b,20mar87,dnw prepended FTP_ to reply codes. +01a,07nov86,dnw written +*/ + +#ifndef __INCftpLibh +#define __INCftpLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* For debugging options */ + +#define FTPL_DEBUG_OFF 0 /* No debugging messages */ +#define FTPL_DEBUG_INCOMING 1 /* Show all incoming responses */ +#define FTPL_DEBUG_OUTGOING 2 /* Show all outgoing commands */ +#define FTPL_DEBUG_ERRORS 4 /* Display all errors and warnings that occur */ + +/* For FTP specification see RFC-765 */ + +/* Reply codes for ftpReplyGet(). (Major numbers 1xx-5xx) */ + +#define FTP_PRELIM 1 /* positive preliminary */ +#define FTP_COMPLETE 2 /* positive completion */ +#define FTP_CONTINUE 3 /* positive intermediate */ +#define FTP_TRANSIENT 4 /* transient negative completion */ +#define FTP_ERROR 5 /* permanent negative completion */ + +/* Detailed reply codes for ftpReplyGetEnhanced() */ + +#define FTP_PASSIVE_REPLY 227 /* Command not supported */ +#define FTP_COMMAND_NOT_SUPPORTED 502 /* Command not supported */ +#define FTP_NOACTION 550 /* requested action not taken */ + +/* Type codes */ + +#define TYPE_A 1 /* ASCII */ +#define TYPE_E 2 /* EBCDIC */ +#define TYPE_I 3 /* image */ +#define TYPE_L 4 /* local byte size */ + +/* Form codes */ + +#define FORM_N 1 /* non-print */ +#define FORM_T 2 /* telnet format effectors */ +#define FORM_C 3 /* carriage control (ASA) */ + +/* Structure codes */ + +#define STRU_F 1 /* file (no record structure) */ +#define STRU_R 2 /* record structure */ +#define STRU_P 3 /* page structure */ + +/* Mode types */ + +#define MODE_S 1 /* stream */ +#define MODE_B 2 /* block */ +#define MODE_C 3 /* compressed */ + +/* Record Tokens */ + +#define REC_ESC '\377' /* Record-mode Escape */ +#define REC_EOR '\001' /* Record-mode End-of-Record */ +#define REC_EOF '\002' /* Record-mode End-of-File */ + +/* Block Header */ + +#define BLK_EOR 0x80 /* Block is End-of-Record */ +#define BLK_EOF 0x40 /* Block is End-of-File */ +#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */ +#define BLK_RESTART 0x10 /* Block is Restart Marker */ + +#define BLK_BYTECOUNT 2 /* Bytes in this block */ + +/* error values */ + +/* + * Note that for unexpected responses, the low-order byte of the eror code + * contains the reponse code. + */ +#define S_ftpLib_ILLEGAL_VALUE (M_ftpLib | 1) +#define S_ftpLib_TRANSIENT_RETRY_LIMIT_EXCEEDED (M_ftpLib | 2) +#define S_ftpLib_FATAL_TRANSIENT_RESPONSE (M_ftpLib | 3) + +#define S_ftpLib_REMOTE_SERVER_STATUS_221 (M_ftpLib | 221) +#define S_ftpLib_REMOTE_SERVER_STATUS_226 (M_ftpLib | 226) +#define S_ftpLib_REMOTE_SERVER_STATUS_257 (M_ftpLib | 257) +#define S_ftpLib_REMOTE_SERVER_ERROR_422 (M_ftpLib | 422) +#define S_ftpLib_REMOTE_SERVER_ERROR_425 (M_ftpLib | 425) +#define S_ftpLib_REMOTE_SERVER_ERROR_450 (M_ftpLib | 450) +#define S_ftpLib_REMOTE_SERVER_ERROR_451 (M_ftpLib | 451) +#define S_ftpLib_REMOTE_SERVER_ERROR_452 (M_ftpLib | 452) +#define S_ftpLib_REMOTE_SERVER_ERROR_500 (M_ftpLib | 500) +#define S_ftpLib_REMOTE_SERVER_ERROR_501 (M_ftpLib | 501) +#define S_ftpLib_REMOTE_SERVER_ERROR_502 (M_ftpLib | 502) +#define S_ftpLib_REMOTE_SERVER_ERROR_503 (M_ftpLib | 503) +#define S_ftpLib_REMOTE_SERVER_ERROR_504 (M_ftpLib | 504) +#define S_ftpLib_REMOTE_SERVER_ERROR_520 (M_ftpLib | 520) +#define S_ftpLib_REMOTE_SERVER_ERROR_521 (M_ftpLib | 521) +#define S_ftpLib_REMOTE_SERVER_ERROR_530 (M_ftpLib | 530) +#define S_ftpLib_REMOTE_SERVER_ERROR_550 (M_ftpLib | 550) +#define S_ftpLib_REMOTE_SERVER_ERROR_551 (M_ftpLib | 551) +#define S_ftpLib_REMOTE_SERVER_ERROR_552 (M_ftpLib | 552) +#define S_ftpLib_REMOTE_SERVER_ERROR_553 (M_ftpLib | 553) +#define S_ftpLib_REMOTE_SERVER_ERROR_554 (M_ftpLib | 554) + +/* externals */ + +extern BOOL ftplDebug; /* print error message, defined in funcBind.c */ + +/* disable passive mode - XXX this will be removed in the next release XXX */ + +extern BOOL ftplPasvModeDisable; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS ftpLogin (int ctrlSock, char *user, char *passwd, char *account); +extern STATUS ftpXfer (char *host, char *user, char *passwd, char *acct, + char *cmd, char *dirname, char *filename, + int *pCtrlSock, int *pDataSock); +extern int ftpCommand (int ctrlSock, char *fmt, int arg1, int arg2, + int arg3, int arg4, int arg5, int arg6); +extern int ftpCommandEnhanced (int ctrlSock, char *fmt, int arg1, int arg2, + int arg3, int arg4, int arg5, int arg6, + char *replyString, + int replyStringLength); +extern int ftpDataConnGet (int dataSock); +extern int ftpDataConnInit (int ctrlSock); +extern int ftpDataConnInitPassiveMode (int ctrlSock); +extern int ftpHookup (char *host); +extern void ftpLibDebugOptionsSet (UINT32 options); +extern int ftpReplyGet (int ctrlSock, BOOL expecteof); +extern int ftpReplyGetEnhanced (int ctrlSock, BOOL expecteof, char *replyString, + int replyStringLength); +extern STATUS ftpTransientConfigSet (UINT32 maxRetryCount, UINT32 retryInterval); +extern STATUS ftpTransientConfigGet (UINT32 *maxRetryCount, UINT32 *retryInterval); +extern STATUS ftpTransientFatalInstall (FUNCPTR configlette); +#else /* __STDC__ */ + +extern STATUS ftpLogin (); +extern STATUS ftpXfer (); +extern int ftpCommand (); +extern int ftpCommandEnhanced (); +extern int ftpDataConnGet (); +extern int ftpDataConnInit (); +extern int ftpDataConnInitPassiveMode (); +extern int ftpHookup (); +extern void ftpLibDebugOptionsSet (); +extern int ftpReplyGet (); +extern int ftpReplyGetEnhanced (); +extern STATUS ftpPrelimConfigSet (); +extern STATUS ftpTransientConfigSet (); +extern STATUS ftpLogin (); +extern STATUS ftpXfer (); +extern STATUS ftpTransientFatalInstall (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCftpLibh */ diff --git a/h/ftpdLib.h b/h/ftpdLib.h new file mode 100644 index 0000000..3de78cf --- /dev/null +++ b/h/ftpdLib.h @@ -0,0 +1,49 @@ +/* ftpdLib.h - header file for ftpdLib.c */ + +/* Copyright 1984 - 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,22feb99,spm recovered version replaced by merge from vxw5_3_x branch; + removed duplicate history entry 01g describing existing change +01g,10dec97,spm changed prototype for ftpdInit to support configurable + password authentication (SPR #8602); removed unused + prototype for ftpdTask routine +01f,22sep92,rrr added support for c++ +01e,04jul92,jcf cleaned up. +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01b,05oct90,dnw deleted ftpdWorkTask(). +01a,05oct90,shl created. +*/ + +#ifndef __INCftpdLibh +#define __INCftpdLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS ftpdInit (FUNCPTR, int stackSize); +extern STATUS ftpdDelete (void); + +#else /* __STDC__ */ + +extern STATUS ftpdInit (); +extern void ftpdDelete (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCftpdLibh */ diff --git a/h/generic.h b/h/generic.h new file mode 100644 index 0000000..2c5379b --- /dev/null +++ b/h/generic.h @@ -0,0 +1,82 @@ +/*ident "@(#)cop4:stdlib/incl/generic.h 1.1" */ +/******************************************************************************* + +C++ source for the C++ Language System, Release 3.0. This product +is a new release of the original cfront developed in the computer +science research center of AT&T Bell Laboratories. + +Copyright (c) 1991 AT&T and UNIX System Laboratories, Inc. +Copyright (c) 1984, 1989, 1990 AT&T. All Rights Reserved. + +THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE of AT&T and UNIX System +Laboratories, Inc. The copyright notice above does not evidence +any actual or intended publication of such source code. + +*******************************************************************************/ + +#ifndef GENERICH + +#define GENERICH 1 + +/* macros to paste tokens together to form new names */ +/* BSD and SystemV cpp's have different mechanisms for pasting tokens + together: worse yet, suns run under BSD but have SYSV mechanism. + ANSI C has defined a new way. +*/ + +#ifdef __STDC__ +/* ANSI C preprocessors will not expand the arguments to a macro; + * so we need to add a level of indirection to allow macro expansion of + * arguments. (Reiser preprocessors allowed the first arg to be expanded; + * this method will allow both to be expanded, which is better than none.) + */ +#define name2(a,b) _name2_aux(a,b) +#define _name2_aux(a,b) a##b +#define name3(a,b,c) _name3_aux(a,b,c) +#define _name3_aux(a,b,c) a##b##c +#define name4(a,b,c,d) _name4_aux(a,b,c,d) +#define _name4_aux(a,b,c,d) a##b##c##d + +#else +#ifdef sun +/*System V way: although BSD is true*/ + +#define name2(a,b) a/**/b +#define name3(a,b,c) a/**/b/**/c +#define name4(a,b,c,d) a/**/b/**/c/**/d + +#else +#ifdef BSD +/*BSD way:*/ + +#define name2(a,b) a\ +b +#define name3(a,b,c) a\ +b\ +c +#define name4(a,b,c,d) a\ +b\ +c\ +d + +#else +/*System V way:*/ +#define name2(a,b) a/**/b +#define name3(a,b,c) a/**/b/**/c +#define name4(a,b,c,d) a/**/b/**/c/**/d +#endif +#endif +#endif + +#define declare(a,t) name2(a,declare)(t) +#define implement(a,t) name2(a,implement)(t) +#define declare2(a,t1,t2) name2(a,declare2)(t1,t2) +#define implement2(a,t1,t2) name2(a,implement2)(t1,t2) + + +extern int genericerror(int,char*); +typedef int (*GPT)(int,char*); +#define set_handler(generic,type,x) name4(set_,type,generic,_handler)(x) +#define errorhandler(generic,type) name3(type,generic,handler) +#define callerror(generic,type,a,b) (*errorhandler(generic,type))(a,b) +#endif diff --git a/h/hashLib.h b/h/hashLib.h new file mode 100644 index 0000000..16b731f --- /dev/null +++ b/h/hashLib.h @@ -0,0 +1,96 @@ +/* hashLib.h - hash table library header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,26jun03,to merged from AE1.1: de-classified, + moved private definitions to private/hashLibP.h. +01i,23oct01,rae undo 01h +01h,10oct01,rae merge from truestack ver 01i base 01g +01g,22sep92,rrr added support for c++ +01f,04jul92,jcf cleaned up. +01e,26may92,rrr the tree shuffle +01d,04oct91,rrr passed through the ansification filter + -changed copyright notice +01c,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01b,26jun90,jcf remove hash id error status. +01a,17nov89,jcf written. +*/ + +#ifndef __INChashLibh +#define __INChashLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "sllLib.h" + + +/* status codes */ + +#define S_hashLib_KEY_CLASH (M_hashLib | 1) + + +/* type definitions */ + +typedef SL_NODE HASH_NODE; /* HASH_NODE */ + +typedef struct hashtbl * HASH_ID; + + +/* These hash nodes are used by the hashing functions in hashLib(1) */ + +typedef struct /* H_NODE_INT */ + { + HASH_NODE node; /* linked list node (must be first) */ + int key; /* hash node key */ + int data; /* hash node data */ + } H_NODE_INT; + +typedef struct /* H_NODE_STRING */ + { + HASH_NODE node; /* linked list node (must be first) */ + char * string; /* hash node key */ + int data; /* hash node data */ + } H_NODE_STRING; + + +/* function declarations */ + +extern BOOL hashKeyCmp (H_NODE_INT * pMatchHNode, + H_NODE_INT * pHNode, int keyCmpArg); +extern BOOL hashKeyStrCmp (H_NODE_STRING * pMatchHNode, + H_NODE_STRING * pHNode, int keyCmpArg); +extern HASH_ID hashTblCreate (int sizeLog2, FUNCPTR keyCmpRtn, + FUNCPTR keyRtn, int keyArg); +extern HASH_NODE * hashTblEach (HASH_ID hashId, FUNCPTR routine, + int routineArg); +extern HASH_NODE * hashTblFind (HASH_ID hashId, HASH_NODE * pMatchNode, + int keyCmpArg); +extern STATUS hashLibInit (void); +extern STATUS hashTblDelete (HASH_ID hashId); +extern STATUS hashTblDestroy (HASH_ID hashId, BOOL dealloc); +extern STATUS hashTblInit (HASH_ID pHashTbl, SL_LIST * pTblMem, + int sizeLog2, FUNCPTR keyCmpRtn, + FUNCPTR keyRtn, int keyArg); +extern STATUS hashTblPut (HASH_ID hashId, HASH_NODE * pHashNode); +extern STATUS hashTblRemove (HASH_ID hashId, HASH_NODE * pHashNode); +extern STATUS hashTblTerminate (HASH_ID hashId); +extern int hashFuncIterScale (int elements, H_NODE_STRING * pHNode, + int seed); +extern int hashFuncModulo (int elements, H_NODE_INT * pHNode, + int divisor); +extern int hashFuncMultiply (int elements, H_NODE_INT * pHNode, + int multiplier); + +#ifdef __cplusplus +} +#endif + +#endif /* __INChashLibh */ diff --git a/h/hookLib.h b/h/hookLib.h new file mode 100644 index 0000000..b5eeb89 --- /dev/null +++ b/h/hookLib.h @@ -0,0 +1,123 @@ +/* hookLib.h - Generic hook management library header */ + +/* + * Copyright (c) 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01f,09sep05,yvp Deleted prototypes for hookLibInit & hookShowInit (SPR 106485). +01e,24jan05,aeg added hookShow() function prototype (SPR #106381). +01d,29apr04,cjj Added hookShowInit() prototype and added "extern" to all + prototype declarations. +01c,08mar04,yvp Corrected doc error for HOOK_INVOKE_CHECK_RETURN. +01b,16feb04,yvp Added S_hookLib_HOOK_TABLE_NULL. +01a,18nov03,yvp written. +*/ + +/* +DESCRIPTION +*/ + +#ifndef __INChookLibh +#define __INChookLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include +#include + +/* generic status codes for hookLib */ + +#define S_hookLib_HOOK_TABLE_FULL (M_hookLib | 1) +#define S_hookLib_HOOK_NOT_FOUND (M_hookLib | 2) +#define S_hookLib_HOOK_TABLE_NULL (M_hookLib | 3) + +#ifndef _ASMLANGUAGE + +/****************************************************************************** +* +* HOOK_INVOKE_VOID_RETURN - Invoke all hooks in a table. +* +* This macro calls all hook functions added into the given hook table +* of size . The called functions are not expected to return anything +* (return values are not checked). The argument is a typecast +* that is applied to all function pointers in the table. This is done for +* type checking purposes. The argument is a parenthesis-enclosed +* argument list that is passed verbatim to each hook function called. +* +* NOMANUAL +*/ + +#define HOOK_INVOKE_VOID_RETURN(tbl,sz,typecast,arglist) \ + { \ + int ix; \ + \ + for (ix = 0; ix < sz; ix++) \ + { \ + if ((typecast)tbl[ix] != (typecast)NULL) \ + (*(typecast)tbl[ix])arglist; \ + else \ + break; \ + } \ + } + +/****************************************************************************** +* +* HOOK_INVOKE_CHECK_RETURN - Invoke all hooks in a table, performing return +* value checking. +* +* This macro calls all hook functions added into the given hook table +* of size . The return value from each called function is compared with +* , and hook execution stops if they differ. In that case, any +* remaining hooks are not executed. The argument is a typecast +* that is applied to all function pointers in the table. This is done for +* type checking purposes. The must be a parenthesis-enclosed +* argument list that is passed verbatim to each hook function called. +* +* NOMANUAL +*/ + +#define HOOK_INVOKE_CHECK_RETURN(tbl,sz,typecast,arglist,keepGoing,pRetval) \ + { \ + int ix, val; \ + \ + for (ix = 0; ix < sz; ix++) \ + { \ + if (((typecast)tbl[ix] != (typecast)NULL) && \ + (val = (((*(typecast)tbl[ix])arglist) != keepGoing))) \ + { \ + *(pRetval) = val; \ + break; \ + } \ + } \ + } + + +/* function declarations */ + +extern STATUS hookAddToTail (void *, void * [], int); +extern STATUS hookAddToHead (void *, void * [], int); +extern STATUS hookDelete (void *, void * [], int); +extern BOOL hookFind (void *, void * [], int); + +#ifdef _WRS_KERNEL +extern void hookShow (FUNCPTR table[], int maxEntries); +#endif /* _WRS_KERNEL */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INChookLibh */ diff --git a/h/hostLib.h b/h/hostLib.h new file mode 100644 index 0000000..f75593e --- /dev/null +++ b/h/hostLib.h @@ -0,0 +1,100 @@ +/* hostLib.h - header for hostLib.c */ + +/* Copyright 1984-1997 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01k,20aug97,jag added function declations for hostTblSearchByAddr(), + hostTblSearchByName() (SPR #9175) +01j,19may97,spm added S_hostLib_INVALID_PARAMETER error value +01i,22sep92,rrr added support for c++ +01h,27jul92,elh Moved hostShow to netShow. +01g,04jul92,jcf cleaned up. +01f,26may92,rrr the tree shuffle +01e,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01d,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01c,13apr89,shl added MAXHOSTNAMELEN. +01b,04jun88,gae changed S_remLib_* to S_hostLib_*. +01a,28may88,dnw extracted from remLib.h +*/ + +#ifndef __INChostLibh +#define __INChostLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "lstLib.h" +#include "netinet/in.h" + +#define MAXHOSTNAMELEN 64 + +/* status messages */ + +#define S_hostLib_UNKNOWN_HOST (M_hostLib | 1) +#define S_hostLib_HOST_ALREADY_ENTERED (M_hostLib | 2) +#define S_hostLib_INVALID_PARAMETER (M_hostLib | 3) + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct hostname_struct + { + struct hostname_struct *link; + char *name; + } HOSTNAME; + +typedef struct + { + NODE node; + HOSTNAME hostName; + struct in_addr netAddr; + } HOSTENTRY; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS hostAdd (char *hostName, char *hostAddr); +extern STATUS hostDelete (char *name, char *addr); +extern STATUS hostGetByAddr (int addr, char *name); +extern int gethostname (char *name, int nameLen); +extern int hostGetByName (char *name); +extern int sethostname (char *name, int nameLen); +extern void hostTblInit (void); +extern int hostTblSearchByName (char *name); +extern STATUS hostTblSearchByAddr (int addr, char *name); + + + +#else /* __STDC__ */ + +extern STATUS hostAdd (); +extern STATUS hostDelete (); +extern STATUS hostGetByAddr (); +extern int gethostname (); +extern int hostGetByName (); +extern int sethostname (); +extern void hostTblInit (); +extern int hostTblSearchByName (); +extern STATUS hostTblSearchByAddr (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INChostLibh */ diff --git a/h/hpAout.h b/h/hpAout.h new file mode 100644 index 0000000..4fbf534 --- /dev/null +++ b/h/hpAout.h @@ -0,0 +1,264 @@ +/* hpAout.h - HP/UX a.out header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,22sep92,rrr added support for c++ +01g,18sep92,jcf cleaned up some more. +01f,04jul92,jcf cleaned up. +01e,26may92,rrr the tree shuffle +01d,04oct91,rrr passed through the ansification filter + -changed copyright notice +01c,05oct90,shl added copyright notice. + made #endif ANSI style. +01b,12dec87,gae added modification history; included HP/UX's magic.h. +01a,12dec87,hin borrowed from HP/UX a.out.h file. +*/ + +#ifndef __INChpAouth +#define __INChpAouth + +#ifdef __cplusplus +extern "C" { +#endif + +/* See WRS: comments where changed */ + +/* HPUX_ID: @(#)a.out.h 27.5 85/06/27 */ + +/* + * Layout of a.out file : + * _________________________ + * | header | + * |_______________________| + * | text section | + * |_______________________| + * | data section | + * |_______________________| + * | pascal section | + * |_______________________| + * | symbol table | + * |_______________________| + * | debug name table | + * |_______________________| + * | source line table | + * |_______________________| + * | value table | + * |_______________________| + * | text relocation area | + * |_______________________| + * | data relocation area | + * |_______________________| + * + * header: 0 + * text: sizeof(header) + * data: sizeof(header)+textsize + * MIS: sizeof(header)+textsize+datasize + * LEST: sizeof(header)+textsize+datasize+ + * MISsize + * DNTT sizeof(header)+textsize+datasize+ + * MISsize+LESTsize + * SLT sizeof(header)+textsize+datasize+ + * MISsize+LESTsize+DNTTsize + * VT sizeof(header)+textsize+datasize+ + * MISsize+LESTsize+DNTTsize+SLTsize + * text relocation: sizeof(header)+textsize+datasize+ + * MISsize+LESTsize+DNTTsize+SLTsize+ + * VTsize + * data relocation: sizeof(header)+textsize+datasize+ + * MISsize+LESTsize+DNTTsize+SLTsize+ + * VTsize+rtextsize + * + * NOTE - header, data, and text are padded to a multiple of + * EXEC_PAGESIZE bytes (using EXEC_ALIGN macro) in + * demand-load files. + * + */ + +/* header of a.out files */ + +/*#include */ +/*#include included for all machines */ + +/*------------------------start-of-magic.h------------------------------------*/ +/* @(#) $Revision: 2.1 $ */ + +/* + magic.h: info about HP-UX "magic numbers" +*/ + +/* where to find the magic number in a file and what it looks like: */ +#define MAGIC_OFFSET 0L + +struct magic + { + unsigned short int system_id; + unsigned short int file_type; + }; +typedef struct magic MAGIC; + +/* predefined (required) file types: */ +#define RELOC_MAGIC 0x106 /* relocatable only */ +#define EXEC_MAGIC 0x107 /* normal executable */ +#define SHARE_MAGIC 0x108 /* shared executable */ + +#define AR_MAGIC 0xFF65 + +/* optional (implementation-dependent) file types: */ +#define DEMAND_MAGIC 0x10B /* demand-load executable */ + +/* predefined HP-UX target system machine IDs */ +#define HP9000_ID 0x208 +#define HP98x6_ID 0x20A +#define HP9000S200_ID 0x20C +/*--------------------------end-of-magic.h------------------------------------*/ + +/* WRS: munge name to not conflict with usual a.out.h */ +struct execHP { +/* 0 */ MAGIC a_magic; /* magic number */ +/* 4 */ short a_stamp; /* version id */ +/* 6 */ short a_unused; +/* 8 */ long a_sparehp; +/* 12 */ long a_text; /* size of text segment */ +/* 16 */ long a_data; /* size of data segment */ +/* 20 */ long a_bss; /* size of bss segment */ +/* 24 */ long a_trsize; /* text relocation size */ +/* 28 */ long a_drsize; /* data relocation size */ +/* 32 */ long a_pasint; /* pascal interface size */ +/* 36 */ long a_lesyms; /* symbol table size */ +/* 40 */ long a_dnttsize; /* debug name table size */ +/* 44 */ long a_entry; /* entry point */ +/* 48 */ long a_sltsize; /* source line table size */ +/* 52 */ long a_vtsize; /* value table size */ +/* 56 */ long a_spare3; +/* 60 */ long a_spare4; +}; + +#define EXEC_PAGESIZE 4096 /* not always the same as the MMU page size */ +#define EXEC_PAGESHIFT 12 /* log2(EXEC_PAGESIZE) */ +#define EXEC_ALIGN(bytes) (((bytes)+EXEC_PAGESIZE-1) & ~(EXEC_PAGESIZE-1)) + +# define TEXT_OFFSET(hdr) ((hdr).a_magic.file_type == DEMAND_MAGIC ? \ + EXEC_ALIGN(sizeof(hdr)) : sizeof(hdr)) + +# define DATA_OFFSET(hdr) ((hdr).a_magic.file_type == DEMAND_MAGIC ? \ + EXEC_ALIGN(sizeof(hdr)) + \ + EXEC_ALIGN((hdr).a_text) : \ + sizeof(hdr) + (hdr).a_text) + +# define MODCAL_OFFSET(hdr) ((hdr).a_magic.file_type == DEMAND_MAGIC ? \ + EXEC_ALIGN(sizeof(hdr)) + \ + EXEC_ALIGN((hdr).a_text) + \ + EXEC_ALIGN((hdr).a_data) : \ + sizeof(hdr) + (hdr).a_text + (hdr).a_data) + +# define LESYM_OFFSET(hdr) MODCAL_OFFSET(hdr) + (hdr).a_pasint +# define DNTT_OFFSET(hdr) LESYM_OFFSET(hdr) + (hdr).a_lesyms +# define SLT_OFFSET(hdr) DNTT_OFFSET(hdr) + (hdr).a_dnttsize +# define VT_OFFSET(hdr) SLT_OFFSET(hdr) + (hdr).a_sltsize +# define RTEXT_OFFSET(hdr) VT_OFFSET(hdr) + (hdr).a_vtsize +# define RDATA_OFFSET(hdr) RTEXT_OFFSET(hdr) + (hdr).a_trsize +# define DNTT_SIZE(hdr) (hdr).a_dnttsize +# define VT_SIZE(hdr) (hdr).a_vtsize +# define SLT_SIZE(hdr) (hdr).a_sltsize + + +/* macros which define various positions in file based on an exec: filhdr */ +#define TEXTPOS TEXT_OFFSET(filhdr) +#define DATAPOS DATA_OFFSET(filhdr) +#define MODCALPOS MODCAL_OFFSET(filhdr) +#define LESYMPOS LESYM_OFFSET(filhdr) +#define DNTTPOS DNTT_OFFSET(filhdr) +#define SLTPOS SLT_OFFSET(filhdr) +#define VTPOS VT_OFFSET(filhdr) +#define RTEXTPOS RTEXT_OFFSET(filhdr) +#define RDATAPOS RDATA_OFFSET(filhdr) + +/* symbol management */ +/* WRS: munge name to not conflict with usual a.out.h */ +struct nlistHP { + long n_value; + unsigned char n_type; + unsigned char n_length; /* length of ascii symbol name */ + short n_almod; + short n_unused; +}; + +#define A_MAGIC1 FMAGIC /* normal */ +#define A_MAGIC2 NMAGIC /* read-only text */ + +/* relocation commands */ +/* WRS: munge name to not conflict with usual a.out.h */ +struct r_infoHP { /* mit= reloc{rpos,rsymbol,rsegment,rsize,rdisp} */ + long r_address; /* position of relocation in segment */ + short r_symbolnum; /* id of the symbol of external relocations */ + char r_segment; /* RTEXT, RDATA, RBSS, REXTERN, or RNOOP */ + char r_length; /* RBYTE, RWORD, or RLONG */ +}; + +/* symbol types */ +#define EXTERN 040 /* = 0x20 */ +#define ALIGN 020 /* = 0x10 */ /* special alignment symbol type */ +#define UNDEF 00 +#define ABS 01 +#define TEXT 02 +#define DATA 03 +#define BSS 04 +#define COMM 05 /* internal use only */ +#define REG 06 + +/* relocation regions */ +#define RTEXT 00 +#define RDATA 01 +#define RBSS 02 +#define REXT 03 +#define RNOOP 077 /* no-op relocation record, does nothing */ + +/* relocation sizes */ +#define RBYTE 00 +#define RWORD 01 +#define RLONG 02 +#define RALIGN 03 /* special reloc flag to support .align symbols */ + + /* values for type flag */ +#define N_UNDF_ 0 /* undefined */ +#define N_TYPE_ 037 +#define N_FN_ 037 /* file name symbol */ +#define N_ABS_ 01 /* absolute */ +#define N_TEXT_ 02 /* text symbol */ +#define N_DATA_ 03 /* data symbol */ +#define N_BSS_ 04 /* bss symbol */ +#define N_REG_ 024 /* register name */ +#define N_EXT_ 040 /* external bit, or'ed in */ +#define FORMAT_ "%06o" /* to print a value */ +#define SYMLENGTH_ 255 /* maximum length of a symbol */ + +#ifdef WRS_UNWANTED + +/* WRS: the following is not needed (and possibly conflicts) */ + +/* These suffixes must also be maintained in the cc shell file */ + +#define OUT_NAME "a.out" +#define OBJ_SUFFIX ".o" +#define C_SUFFIX ".c" +#define ASM_SUFFIX ".s" + +#define N_BADTYPE(x) (((x).a_magic.file_type)!=EXEC_MAGIC&&\ + ((x).a_magic.file_type)!=SHARE_MAGIC&&\ + ((x).a_magic.file_type)!=DEMAND_MAGIC&&\ + ((x).a_magic.file_type)!=RELOC_MAGIC) + +#define N_BADMACH(x) ((x).a_magic.system_id!=HP9000S200_ID&&\ + (x).a_magic.system_id!=HP98x6_ID) +#define N_BADMAG(x) (N_BADTYPE(x) || N_BADMACH(x)) + +#endif /* WRS_UNWANTED */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INChpAouth */ diff --git a/h/hrFsLib.h b/h/hrFsLib.h new file mode 100644 index 0000000..6e738ee --- /dev/null +++ b/h/hrFsLib.h @@ -0,0 +1,179 @@ +/* hrfsLib.h - Highly reliabe file system header file */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* modification history +-------------------- +01z,26aug05,jlk Added HRFS_BAD_CHAR macro +01y,05aug05,jlk Added prototype for hrfsChkDsk() +01x,04aug05,jlk Moved formatter function pointer, hrfsFmtRtn, from hrFsLibP.h +01w,03aug05,pcm changed parameters to hrfsDevLibInit() +01v,26jul05,jlk removed unused errnos +01u,22jul05,jlk code review changes +01t,17jun05,jlk removed format structure. Adjusted and added formatter + prototypes +01s,07jun05,jlk added format structure +01r,18may05,jlk updated errnos and added prototypes +01q,10may05,pcm changed parameters to hrfsFormat() +01p,29apr05,jlk updated HRFS version numbers. +01o,29apr05,jlk updated errnos. +01n,25apr05,jlk added version #defines and id string from hrFsLibP.h +01m,21apr05,jlk updated HRFS errno codes +01l,18apr05,pcm moved _PC_xxx macros for pathconf() to unistd.h +01k,18apr05,pcm added _PC_xxx macros for pathconf stuff +01j,11apr05,pcm changed HRFS_MAX_FILENAME_LEN from 252 to 251 +01i,10mar05,act remove phys block size parameter to hrfsDevCreate +01h,09mar05,pcm added hrfsFormat() and hrfsFormatLibInit() +01g,08mar05,jlk hrfsDevCreate() uses a device_t now for the XBD +01f,08mar05,pcm added hrfsDevLibInit() +01e,08mar05,jlk added another errno +01d,21feb05,jlk added an errno +01c,01feb05,pcm fixed compiler errors +01b,01feb05,pcm added HRFS time routines +01a,24jan05,jlk written +*/ + +#ifndef __INChrfsLib +#define __INChrfsLib + +/* includes */ + +#include "vxWorks.h" + +#include "ioLib.h" +#include "time.h" +#include "drv/xbd/xbd.h" + +/* defines */ + +/* Identifiers and version numbers */ +#define HRFS_ID_STRING "WR_HRFS" + +#define HRFS_MAJOR_VERSION 0x01 +#define HRFS_MINOR_VERSION 0x01 + +/* The maximum chars in a path, excluding EOS */ +#define HRFS_MAX_PATH_LEN PATH_MAX +/* The maximum chars in a file name, including EOS */ +#define HRFS_MAX_FILENAME_LEN (251) +/* Defines a character that is not allowed in file/directory name */ +#define HRFS_BAD_CHAR (':') +/* Defines how deeply nested subdirs can be */ +#define HRFS_MAX_DIRECTORY_DEPTH MAX_DIRNAMES +/* Defines how many hard links to a file can exist */ +#define HRFS_MAX_HARD_LINKS ((linkCount_t) -1) + +/* Limits for the logical block sizes */ + +/* The minium supported logical block size in bytes */ +#define HRFS_MIN_LOGICAL_BLK_SIZE 512 +/* The minium supported logical block size in bytes as a power of 2 */ +#define HRFS_MIN_LOGICAL_BLK_SIZE_2 9 +/* The maximum supported logical block size in bytes */ +#define HRFS_MAX_LOGICAL_BLK_SIZE (8192) +/* The maximum supported logical block size in bytes as a power of 2 */ +#define HRFS_MAX_LOGICAL_BLK_SIZE_2 13 + +/* Limits for the physical block sizes */ + +/* The minium supported logical block size in bytes */ +#define HRFS_MIN_PHYSICAL_BLK_SIZE 512 +/* The minium supported logical block size in bytes as a power of 2 */ +#define HRFS_MIN_PHYSICAL_BLK_SIZE_2 9 +/* The maximum supported logical block size in bytes */ +#define HRFS_MAX_PHYSICAL_BLK_SIZE HRFS_MAX_LOGICAL_BLK_SIZE +/* The maximum supported logical block size in bytes as a power of 2 */ +#define HRFS_MAX_PHYSICAL_BLK_SIZE_2 HRFS_MAX_LOGICAL_BLK_SIZE_2 + + +#define HRFS_DEV_MIN_BUFFERS 6 /* minimum # of buffers for HRFS devices */ + +/* error codes */ + +#define S_hrfsLib_DISK_FULL (M_hrfsLib | 1) +#define S_hrfsLib_OUT_OF_INODES (M_hrfsLib | 2) +#define S_hrfsLib_INVALID_TMR (M_hrfsLib | 3) +#define S_hrfsLib_UNKNOWN_VOLUME_FORMAT (M_hrfsLib | 4) +#define S_hrfsLib_BLOCK_NOT_FOUND (M_hrfsLib | 5) +#define S_hrfsLib_INODE_JOURNAL_FULL (M_hrfsLib | 6) + +/* macros */ + +/* + * Convert the number of ticks to milliseconds (rounding down). This macro + * does not guard against overflow. That would only be an issue on incredibly + * large tick count conversions. For example, if the system clock rate were + * 1 million ticks per second, the overflow could be encountered after the + * equivalent of 585 years worth of ticks. + */ + +#define TICKS_TO_MILLISECONDS(x) ((1000ULL * (x)) / sysClkRateGet ()) + +/* + * Convert the number of milliseconds to ticks (rounding down). This macro + * does not guard against overflow. That would only be an issue on incredibly + * large millisecond conversions. For example, if the system clock rate were + * 1 million ticks per second, the overflow would be encountered after over + * half a million years worth of milliseconds. + */ + +#define MILLISECONDS_TO_TICKS(x) (((x) * sysClkRateGet ()) / 1000ULL); + + +/* typedefs */ +/* Time in HRFS is a 64 bit signed quantity of ms since 1970 */ +typedef INT64 hrfsTime_t; + +typedef struct hrfs_tm + { + struct tm tm; /* original [tm] structure. */ + int msec; /* milliseconds after the second - [0..999] */ + } HRFS_TM; + + +typedef struct hrfs_dev * HRFS_DEV_ID; +typedef struct hrfs_volume_desc * HRFS_VOLUME_DESC_ID; + +/* forward declarations */ + +#ifdef __cplusplus +extern "C" { +#endif +extern STATUS (*hrfsFmtRtn)( char *path, UINT64 diskSize, UINT32 blockSize, + UINT32 files ); + +extern STATUS hrfsFormatLibInit (void); +extern STATUS hrfsFormatFd (int fd, UINT64 diskSize, + UINT32 blkSize, UINT32 numInodes); +extern STATUS hrfsFormat (char *path, UINT64 diskSize, + UINT32 blkSize, UINT32 numInodes); + +extern STATUS hrfsDevLibInit (int maxBufs, int maxFiles); +extern HRFS_DEV_ID hrfsDevCreate (char * pDevName, device_t xbd, int numBufs, + int maxFiles); +extern STATUS hrfsDevCreate2 (device_t xbdId, devname_t pDevName); +extern STATUS hrfsDevDelete (HRFS_DEV_ID hrfsDevId); +extern int hrfsDiskProbe (device_t xbdDevice); + +extern hrfsTime_t hrfsTimeGet (void); +extern void hrfsTimeSet (hrfsTime_t msec); +extern int hrfsAscTime (HRFS_TM * pHrfsTm, char * pBuffer, + size_t bufLength); +extern STATUS hrfsTimeSplit (hrfsTime_t msec, HRFS_TM * pHrfsTm); +extern hrfsTime_t hrfsTimeCondense (HRFS_TM * pHrfsTm); + +extern STATUS hrfsChkDsk (char *path, int verbLevel, int flag); + + +#ifdef __cplusplus + } +#endif + +#endif /* __INChrfsLib */ + diff --git a/h/hwif/util/hwMemLib.h b/h/hwif/util/hwMemLib.h new file mode 100644 index 0000000..0aefa94 --- /dev/null +++ b/h/hwif/util/hwMemLib.h @@ -0,0 +1,54 @@ +/* hwMemLib.h -- hardware memory allocation library header file */ + +/* Copyright (c) 2005 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01a,31Jan05,tor created +*/ + +#ifndef INC_HWMEMLIB_H +#define INC_HWMEMLIB_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +/* defines */ + +#define HWMEM_MAX_ALLOC 4096 + +#define VMR_MINSIZE (1<<2) /* minimum size to allocate */ + +/* typedefs */ + +/* globals */ + +IMPORT char hwMemPool[]; + +/* locals */ + +/* forward declarations */ + +void hwMemLibInit(); +STATUS hwMemPoolCreate + ( + char * pMem, + int size + ); +char * hwMemAlloc(int reqSize); +STATUS hwMemFree(char * pMem); +void * hwVMRInit(char * pSpace, int size); +void * hwVMRAlloc(void * pVMRCookie, int alignShift); +char * hwVMRAddrGet(void * pVMRCookie); +STATUS hwVMRDeActivate(void * pVMRCookie); +void hwMemInit(); + +#ifdef __cplusplus +} +#endif + +#endif /* INC_HWMEMLIB_H */ diff --git a/h/hwif/vxbus/busLib.h b/h/hwif/vxbus/busLib.h new file mode 100644 index 0000000..4f0e053 --- /dev/null +++ b/h/hwif/vxbus/busLib.h @@ -0,0 +1,527 @@ +/* busLib.h - vxBus subsystem header file */ + +/* Copyright (c) 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,20sep05,pdg Fixed warning(SPR #112565) +01b,01sep05,mdo Add vxb prefix +01a,10aug05,mdo Phase in new access method +17Jan05,tor written +*/ + +#ifndef _INC_BUSLIB_H +#define _INC_BUSLIB_H +#define _INC_BUSCONNECTLIB_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include + +/* defines */ + +/* vxbDevRegInfo->devID */ +#define VXB_DEVID_DEVICE 0 +#define VXB_DEVID_BUSCTRL 1 + +/* vxbDevRegInfo->busID */ +#define VXB_BUSID_LOCAL 1 /* processor local bus */ +#define VXB_BUSID_PLB 1 /* alt name for local bus */ +#define VXB_BUSID_NEXUS 1 /* alt name for local bus */ +#define VXB_BUSID_VME 2 /* VME */ +#define VXB_BUSID_PCI 3 /* PCI */ +#define VXB_BUSID_PCIX 4 /* PCI w/ PCI-X ext */ +#define VXB_BUSID_PCIEXPRESS 5 /* PCI w/ PCI-Express ext */ +#define VXB_BUSID_HYPERTRANSPORT 6 /* PCI w/ HyperTransport ext */ +#define VXB_BUSID_RAPIDIO 7 /* RapidIO */ + +/* vxbDevRegInfo->busVer */ +#define BUS_VERSION_1 1 + +#define MAX_DRV_NAME_LEN 31 /* 31-byte device names */ + +/* vxbDevIterate flags */ +#define VXB_ITERATE_INSTANCES 1 /* instances */ +#define VXB_ITERATE_ORPHANS 2 /* dev w/o drv */ +#define VXB_ITERATE_VERBOSE 8 /* print diagnostics while running */ + +/* method used for unlinking a device from the driver */ + +#define VXB_METHOD_DRIVER_UNLINK 1 + +/* 0x1b-0xff: standard MethodIDs reserved for future use */ + +#define FIRST_CUSTOM_BUS_ACCESS_METHOD 0x00000100 + + +/* byte-order and other bus access method flags */ + + +/* flags for operation and debug 0x01000000 ... 0x80000000 */ +#define BUSAF_VERBOSE 0x01000000 + +/* + * FreeBSD methods use the address of a set of descriptions + * as the method ID. This macro, when expanded, fits into + * the vxbDeviceMethod structure defined below. + */ +#define DEVMETHOD(NAME, FUNC) { (UINT32)&NAME##_desc, (FUNCPTR) FUNC } +#define METHOD_DECL(NAME) IMPORT char NAME##_desc[]; + +typedef struct vxbDeviceMethod device_method_t; + +/* forward structure/typedefs definitions */ + +typedef struct vxbDev BUS_DEVICE; +typedef struct vxbDev * BUS_DEVICE_ID; + +typedef struct vxbAccessList HARDWARE_ACCESS; + +typedef struct drvBusFuncs DRIVER_INITIALIZATION; +typedef struct vxbDevRegInfo DRIVER_REGISTRATION; +typedef struct vxbDeviceMethod DRIVER_METHOD; + +/* typedefs */ + +/* + * An alternative method for bus controllers to provide the + * methods used by downstream devices. This structure is + * provided so that the controller can provide a null-terminated + * list of method/handler pairs. + * + * When a driver fetches the access methods, the standard methods + * are used first. If the method is not one of the standard + * methods (specified in the vxbAccessList structure), or if the + * method specified is NULL in the controller's standard methods, + * then the vxbAccessMethodsGet() routine searches through any + * methods listed in the pMethods field of the vxbAccessList + * structure. + * + * In addition, this structure is used by all devices to provide + * services to OS modules such as power management. + */ + +struct vxbDeviceMethod + { + UINT32 devMethodId; + FUNCPTR handler; + }; + +/*=============================================================== +* +* vxbBusTypeInfo - structure containing busType entry points +* +* This structure provides entry points into the busType +* for use by the bus sub-system during initialization and +* operation. +* +*/ + +struct vxbBusTypeInfo + { + UINT32 busID; /* busID */ + struct vxbBusTypeInfo * pNext; + +/*=============================================================== +* +* The first routines are used during system boot, during +* bus enumeration and configuration. +*/ + + /* init1 */ + + STATUS (*busTypeInit1) + ( + ); + + /* init2 */ + + STATUS (*busTypeInit2) + ( + ); + + /* connect */ + + STATUS (*busTypeConnect) + ( + ); + + /* check for new devices */ + + BOOL (*busTypeNewDevPresent) + ( + ); + + /* check whether device and driver match */ + + BOOL (*busDevMatch) + ( + struct vxbDevRegInfo * pDriver, + struct vxbDev * pDev + ); + + }; + + +/* + * Keep track of busses which are known to be present on the system. + * This is only used internally, so the structure definition is here + * instead of in the header file. + */ + +struct vxbBusPresent + { + struct vxbBusPresent * pNext; + struct vxbBusTypeInfo * pBusType; + struct vxbDev * pCtlr; + struct vxbDev * instList; + struct vxbDev * devList; + }; + +/* + * This structure identifies the driver to the bus subsystem. + * It is used for driver registration with the bus subsystem. + * + * Each driver or bus controller calls the vxbDevRegister() + * routine (prototype is shown below) with a pointer to a + * structure declared by the driver. The information in the + * structure is static, so it can be included in the driver's + * initialized data segment. + * + * This structure should never be used directly. Instead, + * each bus type defines a structure of its own, with this + * structure as the first element (included, not as a pointer). + * The bus-defined structure may contain additional information, + * such as DEV_ID and VEND_ID on the PCI bus. To get access + * to these structures, include the bus{TYPE}Lib.h file, e.g. + * "pciBusLib.h" or "busRioLib.h". + */ + +struct vxbDevRegInfo + { + + /* for next bus type */ + + struct vxbDevRegInfo * pNext; + + /* device or bus controller: BUS_DEVID_DEVICE or BUS_DEVID_BUSCTRL */ + UINT32 devID; + + /* bus type and bus subsystem version */ + UINT32 busID; + UINT32 busVer; + + /* dev/drv name */ + char drvName[MAX_DRV_NAME_LEN+1]; + + /* default registration functions */ + struct drvBusFuncs * pDrvBusFuncs; + struct vxbDeviceMethod * pMethods; + + /* NULL probe routine indicates always true */ + + BOOL (*devProbe) + ( + struct vxbDev * pDevInfo /* device info */ + ); + + }; + +/*=============================================================== +* +* drvBusFuncs - structure containing driver entry points +* +* This structure provides entry points into the driver +* for use by the bus sub-system during initialization and +* operation. +* +*/ + +struct drvBusFuncs + { + +/*=============================================================== +* +* The first routines are used during system boot, during +* bus enumeration and configuration. +*/ + + /* initialize driver and device */ + /* called (indirectly) from sysHwInit2() */ + /* may be empty function [nullDrv()] for normal drivers */ + void (*devInstanceInit) + ( + struct vxbDev * pDevInfo /* device info */ + ); + + /* initialize driver and device - second level */ + /* called (indirectly) from sysHwInit2() */ + /* may be empty function [nullDrv()] for bus controller drivers */ + void (*devInstanceInit2) + ( + struct vxbDev * pDevInfo /* device info */ + ); + + /* connect to higher level entity */ + /* called (indirectly) at the end of sysHwInit2() */ + /* may be empty function [nullDrv()] for bus controllers */ + void (*devInstanceConnect) + ( + struct vxbDev * pDevInfo /* device info */ + ); + + }; + +/* + * The following structures are used during bus and device + * configuration. Drivers must have already registered with + * the bus subsystem. This information is used during the + * bus probe and enumeration phase. + * + * Note that the bus subsystem provides a pCookie pointer, + * which can optionally be used by the specific bus + * implementation. + */ + +struct vxbDev + { + /* for bus subsystem internal use */ + + struct vxbDev * pNext; + struct vxbBusPresent * pParentBus; /* parent bus */ + UINT32 versionCounter; /* version number */ + + /* access functions for use by driver */ + + struct vxbAccessList * pAccess; + + /* access functions provided by driver */ + + struct vxbDeviceMethod * pMethods; + + /* register base addresses */ + + void * pRegBase[10]; + + /* bus-specific information */ + + union + { + struct vxbBusPresent * pSubordinateBus; + void * pDevPrivate; + } u; + + void * pBusSpecificDevInfo; + UINT32 busID; + + /* interrupt information */ + + void * pIntrInfo; + + /* device name */ + + char * pName; + + /* driver registration info */ + + struct vxbDevRegInfo * pDriver; + + /* per-driver info */ + + void * pDrvCtrl; + + }; + +/* hcfResource.hcfType values */ +#define HCF_RES_STRING 1 +#define HCF_RES_INT 2 +#define HCF_RES_ADDR 3 +#define RES_STRING 1 +#define RES_INT 2 +#define RES_ADDR 3 + +/* global data */ + +/* vxBus methods */ + +IMPORT char paramArraySet_desc[]; +IMPORT char paramListSet_desc[]; + +IMPORT struct vxbAccessList * _archAccessFuncs; + +/* forward declarations */ + +IMPORT STATUS vxbDriverUnregister(struct vxbDevRegInfo *pDriver); +IMPORT char * vxbBusTypeString(int busType); +IMPORT struct vxbDev * vxbDevStructAlloc(int flags); +IMPORT void vxbDevStructFree(struct vxbDev * pDev); + +IMPORT STATUS vxbIntConnect + ( + struct vxbDev * pDev, + int index, + VOIDFUNCPTR pIsr, + void * pArg + ); +IMPORT STATUS vxbIntDisconnect + ( + struct vxbDev * pDev, + int index, + VOIDFUNCPTR pIsr, + void * pArg + ); +IMPORT STATUS vxbIntEnable + ( + struct vxbDev * pDev, + int index, + VOIDFUNCPTR pIsr, + void * pArg + ); +IMPORT STATUS vxbIntDisable + ( + struct vxbDev * pDev, + int index, + VOIDFUNCPTR pIsr, + void * pArg + ); + +IMPORT STATUS vxbDevRegister + ( + struct vxbDevRegInfo * pDevInfo /* per-bus recognition info */ + ); + +IMPORT STATUS vxbBusTypeRegister + ( + struct vxbBusTypeInfo * pBusType + ); + +IMPORT STATUS vxbBusTypeUnregister + ( + struct vxbBusTypeInfo * pBusType + ); + +IMPORT STATUS vxbDevError(); /* driver does not support specified functionality */ +IMPORT STATUS nullDrv(); /* no action required */ +IMPORT BOOL noDev(); /* returns FALSE */ + +IMPORT STATUS vxbBusAnnounce + ( + struct vxbDev * pBusDev, /* bus controller */ + UINT32 busID /* bus type */ + ); +IMPORT STATUS vxbDeviceAnnounce + ( + struct vxbDev * pBusDev + ); + +IMPORT STATUS vxbDevRemovalAnnounce + ( + struct vxbDev * pBusDev + ); + +IMPORT STATUS vxbLibInit(); + +IMPORT STATUS vxbDevMethodRun + ( + UINT32 method, + void * pArg + ); +IMPORT FUNCPTR vxbDevMethodGet(struct vxbDev * pDev, UINT32 method); +IMPORT STATUS vxbDevIterate + ( + FUNCPTR func, /* function to call */ + void * pArg, /* 2nd argument to func */ + UINT32 flags /* flags to determine what to do */ + ); +IMPORT STATUS vxbDevPath + ( + struct vxbDev * pBusDev, /* device */ + FUNCPTR func, /* func @ each ctlr */ + void * pArg /* 2nd arg to func */ + ); +IMPORT void vxBusShow(int verboseLevel); + +IMPORT STATUS vxbInit(); +IMPORT STATUS vxbDevInit(); +IMPORT STATUS vxbDevConnect(); +struct vxbDev * vxbDevParent(struct vxbDev * pDev); + +struct vxbAccessList * vxbAccessListGet + ( + struct vxbDev * pDev + ); + +FUNCPTR vxbAccessMethodGet + ( + struct vxbDev * pDev, + UINT32 accessType + ); + +/* + * The following structure is used during configuration. The + * BSP provides interrupt routing information in a table containing + * the routines that drivers use to enable, disable, and acknowledge + * interrupts on interrupt controllers between the device and the + * driver. + * + * It's possible that this information may be kept on a per-device + * basis. + * + * The configuration file contains a reference to this information, + * and stores the information in the HCF record for any device. + * The interrupt vector/irq information is extracted from the HCF + * record by the routine devResourceIntrGet(), which also checks + * for this information. + */ + +struct hwIntRoute + { + /* + * NOTE: if the following entries are modified, you must + * also modify the busAccessList structure, above. + */ + + /* ensure that the bus controller does not prevent the specified interrupt */ + + STATUS (*busIntEnable) + ( + struct vxbDev * pDevInfo, /* device info */ + int intNo, /* additional vector info */ + VOIDFUNCPTR pISR, /* IRQ */ + void * pArg + ); + + STATUS (*busIntDisable) + ( + struct vxbDev * pDevInfo, /* device info */ + int intNo, /* additional vector info */ + VOIDFUNCPTR pISR, /* IRQ */ + void * pArg + ); + + /* clear interrupt on bus controller */ + + STATUS (*busIntAcknowledge) + ( + struct vxbDev * pDevInfo, /* device info */ + int intNo, /* additional vector info */ + VOIDFUNCPTR pISR, /* IRQ */ + void * pArg + ); + }; + +#ifdef __cplusplus +} +#endif + +#endif /* _INC_BUSLIB_H */ + + + + + diff --git a/h/hwif/vxbus/hwConf.h b/h/hwif/vxbus/hwConf.h new file mode 100644 index 0000000..3e4778a --- /dev/null +++ b/h/hwif/vxbus/hwConf.h @@ -0,0 +1,76 @@ +/* hwconf.h - hardware configuration resources */ + +/* Copyright (c) 2005 Wind River Systems, Inc. All rights are reserved. */ + +/* +modification history +-------------------- +01a,10May05,tor created +*/ + +#ifndef INC_hwconfH +#define INC_hwconfH + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include + +/* defines */ + +/* typedefs */ + +typedef const struct hcfResource HCF_RESOURCE; +typedef const struct hcfDevice HCF_DEVICE; + +struct hcfResource + { + char * name; + UINT32 type; + union + { + void * addr; + char * string; + UINT32 integer; + } u; + }; + +struct hcfDevice + { + char * devName; + int devUnit; + int busType; + int busIndex; + int count; + const struct hcfResource * pResource; + }; + +/* globals */ + +IMPORT const VOIDFUNCPTR hcfDriverList[]; +IMPORT const int hcfDriverNum; + +IMPORT const struct hcfDevice hcfDeviceList[]; +IMPORT const int hcfDeviceNum; + +/* locals */ + +/* forward declarations */ + +STATUS devResourceGet + ( + const struct hcfDevice * pDevice, + char * name, + int type, + void ** pDest + ); + +#ifdef __cplusplus +} +#endif + +#endif /* INC_hwconfH */ diff --git a/h/hwif/vxbus/pciBusLib.h b/h/hwif/vxbus/pciBusLib.h new file mode 100644 index 0000000..e9cb908 --- /dev/null +++ b/h/hwif/vxbus/pciBusLib.h @@ -0,0 +1,103 @@ +/* pciBusLib.h - PCI bus header file */ + +/* Copyright (c) 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,01sep05,mdo Add vxb prefix +01a,10aug05,mdo Phase in new access method +17Jan05,tor written +*/ + +#ifndef INC_BUSPCILIB_H +#define INC_BUSPCILIB_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define PCI_CONTROLLER_METHOD_CFG_READ 0x01 +#define PCI_CONTROLLER_METHOD_CFG_WRITE 0x02 +#define PCI_CONTROLLER_METHOD_BUS_ACCESS_OVERRIDE 0x03 + +/* typedefs */ + +typedef struct busPciID PCI_DEVVEND; +typedef struct busPciRegInfo PCI_DRIVER_REGISTRATION; +typedef struct busPciDevInfo PCI_HARDWARE; +typedef struct busPciIntrInfo PCI_INTERRUPT_RECORD; + +/* + * The PCI busType uses DEV_ID and VEND_ID to pair devices up + * with their drivers. The driver provides a busPciRegInfo + * structure when it registers with the bus subsystem. If the + * bus subsystem finds that the driver registered a bus type + * of PCI (or one of the PCI variants), and finds that PCI is + * present on the system, then the bus subsystem calls the + * PCI-specific device check routine. + * + * In addition, the PCI bus tracks the standard bus, device, + * and function values. + */ + +struct busPciID + { + UINT16 pciDevId; + UINT16 pciVendId; + }; + +struct busPciRegInfo + { + struct vxbDevRegInfo b; + int idListLen; + struct busPciID * idList; + }; + +struct busPciDevInfo + { + void * pCookie; + UINT8 pciBus; + UINT8 pciDev; + UINT8 pciFunc; + UINT16 pciDevId; + UINT16 pciVendId; + }; + +struct busPciIntrInfo + { + void * pCookie; /* PCI bus cookie: see pciAutoConfigLib */ + + /* [b,d,f] */ + UINT8 pciBus; /* bus: device identification */ + UINT8 pciDev; /* device: device identification */ + /* function: not required. */ + + /* PCI interrupt lines */ + UINT32 intA; /* interrupt vector on int-A */ + UINT32 intB; /* interrupt vector on int-B */ + UINT32 intC; /* interrupt vector on int-C */ + UINT32 intD; /* interrupt vector on int-D */ + + /* interrupt route functions */ + FUNCPTR intEnable; /* enable interrupt line on intr controller */ + FUNCPTR intDisable; /* disable interrupt line on intr controller */ + FUNCPTR intAcknowledge; /* acknowledge & clear int line on intr ctrl */ + }; + +IMPORT STATUS pciBusLibInit(); +IMPORT STATUS pciRegister(); +IMPORT void pciBusAnnounceDevices + ( + struct vxbAccessList * pArg, + struct vxbDev * pDev, + void * pCookie + ); + +#ifdef __cplusplus +} +#endif + +#endif /* INC_BUSPCILIB_H */ diff --git a/h/hwif/vxbus/plbBusLib.h b/h/hwif/vxbus/plbBusLib.h new file mode 100644 index 0000000..1f2789c --- /dev/null +++ b/h/hwif/vxbus/plbBusLib.h @@ -0,0 +1,64 @@ +/* plbBusLib.h - Processor Local Bus header file */ + +/* Copyright (c) 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,16sep05,jb Adding interrupt level support +01b,01sep05,mdo Add vxb prefix +01a,10aug05,mdo Phase in new access method +17Jan05,tor written +*/ + +#ifndef INC_PLBBUSLIB_H +#define INC_PLBBUSLIB_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/* defines */ + +/* typedefs */ + +typedef struct plbDevEntry PLB_DEVICE_ENTRY; +typedef struct busPlbRegInfo PLB_DRIVER_REGISTRATION; +typedef struct plbIntrEntry PLB_INTERRUPT; + +struct plbIntrEntry + { + int numVectors; + UINT32 * intVecList; + UINT32 * intLvlList; + }; + +struct plbDevEntry + { + void * baseAddress; + char drvName[MAX_DRV_NAME_LEN+1]; + int numVectors; + UINT32 * intVecList; + UINT32 * intLvlList; + }; + +struct busPlbRegInfo + { + struct vxbDevRegInfo b; + }; + +/* global data */ + +/* forward declarations */ + +IMPORT STATUS plbInit1(); +IMPORT STATUS plbBusLibInit(); +IMPORT void plbRegister(void); + + +#ifdef __cplusplus +} +#endif + +#endif /* INC_PLBBUSLIB_H */ diff --git a/h/icmpLib.h b/h/icmpLib.h new file mode 100644 index 0000000..b46496e --- /dev/null +++ b/h/icmpLib.h @@ -0,0 +1,63 @@ +/* icmpLib.h -- VxWorks ICMP Library header file */ + +/* Copyright 1990-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,10oct01,rae merge from truestack (ip.h, S_icmpLib_INVALID_ARGUMENT) +01g,22sep92,rrr added support for c++ +01f,04jul92,jcf cleaned up. +01e,30jun92,jmm moved checksum() declarations to vxLib.h +01d,11jun92,elh changed parameters to ipHeaderCreate. +01c,26may92,rrr the tree shuffle +01b,17apr92,elh moved shared routine prototypes here (from bootpLib). +01a,11jun91,elh created. +*/ + +#ifndef __INCicmpLibh +#define __INCicmpLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vwModNum.h" +#include "net/if.h" +#include "netinet/ip.h" + +/* errors */ + +#define S_icmpLib_TIMEOUT (M_icmpLib | 1) +#define S_icmpLib_NO_BROADCAST (M_icmpLib | 2) +#define S_icmpLib_INVALID_INTERFACE (M_icmpLib | 3) +#define S_icmpLib_INVALID_ARGUMENT (M_icmpLib | 4) + +/* function prototypes */ + +#if defined(__STDC__) || defined(__cplusplus) + +STATUS icmpMaskGet (char *ifName, char *src, char *dst, int *pSubnet); +void ipHeaderCreate (int proto, struct in_addr *pSrcAddr, + struct in_addr *pDstAddr, struct ip *pih, + int length); +u_char * ipHeaderVerify (struct ip *pih, int length, int proto); +STATUS etherSend (struct ifnet *pIf, struct ip *pDatagram, int length); + + +#else /* __STDC__ */ + +STATUS icmpMaskGet (); +void ipHeaderCreate (); +u_char * ipHeaderVerify (); +STATUS etherSend (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCicmpLibh */ diff --git a/h/ifIndexLib.h b/h/ifIndexLib.h new file mode 100644 index 0000000..96a2223 --- /dev/null +++ b/h/ifIndexLib.h @@ -0,0 +1,31 @@ +/* ifIndexLib.h - interface index library header */ + +/* Copyright 2000 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,29mar01,spm file creation: copied from version 01c of tor2_0.open_stack + branch (wpwr VOB) for unified code base +*/ + +#ifndef __INCifIndexLibh +#define __INCifIndexLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* function declarations */ + +extern void ifIndexLibInit(void); +extern void ifIndexLibShutdown(void); +extern int ifIndexAlloc(void); +extern BOOL ifIndexTest(int ifIndex); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCifIndexLibh */ diff --git a/h/ifLib.h b/h/ifLib.h new file mode 100644 index 0000000..29d4290 --- /dev/null +++ b/h/ifLib.h @@ -0,0 +1,83 @@ +/* ifLib.h - network interface library header */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,10oct01,rae merge from truestack ver 01j, base 01d +01d,06oct98,ham added ifAddrAdd. +01c,02sep93,elh changed param name to ifunit +01b,22sep92,rrr added support for c++ +01a,04jul92,jcf cleaned up. +01b,26may92,rrr the tree shuffle +01a,10dec91,gae written. + +rrr +*/ + +#ifndef __INCifLibh +#define __INCifLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) +extern STATUS ifAddrAdd (char *interfaceName, char *interfaceAddress, + char *broadcastAddress, int subnetMask); +extern STATUS ifAddrSet (char *interfaceName, char *interfaceAddress); +extern STATUS ifAddrDelete (char *interfaceName, char *interfaceAddress); +extern STATUS ifAddrGet (char *interfaceName, char *interfaceAddress); +extern STATUS ifBroadcastSet (char *interfaceName, char *broadcastAddress); +extern STATUS ifBroadcastGet (char *interfaceName, char *broadcastAddress); +extern STATUS ifDstAddrSet (char *interfaceName, char *dstAddress); +extern STATUS ifDstAddrGet (char *interfaceName, char *dstAddress); +extern STATUS ifMaskSet (char *interfaceName, int netMask); +extern STATUS ifMaskGet (char *interfaceName, int *netMask); +extern STATUS ifFlagChange (char *interfaceName, int flags, BOOL on); +extern STATUS ifFlagSet (char *interfaceName, int flags); +extern STATUS ifFlagGet (char *interfaceName, int *flags); +extern STATUS ifMetricSet (char *interfaceName, int metric); +extern STATUS ifMetricGet (char *interfaceName, int *pMetric); +extern int ifRouteDelete (char *ifName, int unit); +extern struct ifnet *ifunit (char *ifname); +extern struct ifnet *ifIndexToIfpNoLock (int ifIndex); +extern struct ifnet *ifIndexToIfp (int ifIndex); +extern unsigned short ifNameToIfIndex (char *ifname); +extern STATUS ifIndexToIfName (unsigned short ifIndex, char *ifname); +extern STATUS ifUnnumberedSet(char *, char *, char *, char *); +extern int ifAllRoutesDelete (char *, int); +#else +extern STATUS ifAddrAdd (); +extern STATUS ifAddrSet (); +extern STATUS ifAddrDelete (); +extern STATUS ifAddrGet (); +extern STATUS ifBroadcastSet (); +extern STATUS ifBroadcastGet (); +extern STATUS ifDstAddrSet (); +extern STATUS ifDstAddrGet (); +extern STATUS ifMaskSet (); +extern STATUS ifMaskGet (); +extern STATUS ifFlagChange (); +extern STATUS ifFlagSet (); +extern STATUS ifFlagGet (); +extern STATUS ifMetricSet (); +extern STATUS ifMetricGet (); +extern int ifRouteDelete (); +extern struct ifnet *ifunit (); +extern struct ifnet *ifIndexToIfpNoLock (); +extern struct ifnet *ifIndexToIfp (); +extern unsigned short ifNameToIfIndex (); +extern STATUS ifIndexToIfName (); +extern STATUS ifUnnumberedSet (); +extern int ifAllRoutesDelete (); + +#endif /* __STDC__ */ +#ifdef __cplusplus +} +#endif + +#endif /* __INCifLibh */ diff --git a/h/if_bp.h b/h/if_bp.h new file mode 100644 index 0000000..b95abb0 --- /dev/null +++ b/h/if_bp.h @@ -0,0 +1,73 @@ +/* if_bp.c - backplane network header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,22sep92,rrr added support for c++ +01h,15sep92,jcf added prototypes. +01g,04jul92,jcf cleaned up. +01f,26may92,rrr the tree shuffle +01e,04oct91,rrr passed through the ansification filter + -changed copyright notice +01d,05oct90,shl added copyright notice. + made #endif ANSI style. +01c,08nov89,shl added ifdef to prevent inclusion of vxWorks.h more than once. +01b,06mar89,jcf added read-location mailbox types. +01a,14jun87,dnw written +*/ + +#ifndef __INCif_bph +#define __INCif_bph + +#ifdef __cplusplus +extern "C" { +#endif + +/* backplane interrupt methods */ + +#define BP_INT_NONE 0 /* no interrupt - poll instead */ + +#define BP_INT_MAILBOX_1 1 /* mailbox write byte to bus adrs */ +#define BP_INT_MAILBOX_2 2 /* mailbox write word to bus adrs */ +#define BP_INT_MAILBOX_4 3 /* mailbox write long to bus adrs */ + /* arg1 = bus address space + * arg2 = bus address + * arg3 = value + */ + +#define BP_INT_BUS 4 /* generate bus interrupt */ + /* arg1 = interrupt level + * arg2 = interrupt vector + */ + +#define BP_INT_MAILBOX_R1 5 /* mailbox read byte to bus adrs */ +#define BP_INT_MAILBOX_R2 6 /* mailbox read word to bus adrs */ +#define BP_INT_MAILBOX_R4 7 /* mailbox read long to bus adrs */ + /* arg1 = bus address space + * arg2 = bus address + * arg3 = value + */ +/* function prototypes */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS bpattach (int unit, char *pAnchor, int procNum, int intType, + int intArg1, int intArg2, int intArg3); +extern STATUS bpInit (char *pAnchor, char *pMem, int memSize, BOOL tasOK); +extern void bpShow (char *bpName, BOOL zero); + +#else /* __STDC__ */ + +extern STATUS bpattach (); +extern STATUS bpInit (); +extern void bpShow (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_bph */ diff --git a/h/if_sl.h b/h/if_sl.h new file mode 100644 index 0000000..218edb4 --- /dev/null +++ b/h/if_sl.h @@ -0,0 +1,50 @@ +/* if_sl.h - Serial Line IP header */ + +/* Copyright 1984-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,29jan96,gnn added support for user configurable MTU +01h,22mar94,dzb added CSLIP support. +01g,22sep92,rrr added support for c++ +01f,15sep92,jcf added slip interface prototypes. +01e,04jul92,jcf cleaned up. +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -changed copyright notice +01b,05oct90,shl added copyright notice. + made #endif ANSI style. +01a,18jul89,hjb written. +*/ + +#ifndef __INCif_slh +#define __INCif_slh + +#ifdef __cplusplus +extern "C" { +#endif + +#define S_if_sl_INVALID_UNIT_NUMBER (M_if_sl | 1) +#define S_if_sl_UNIT_UNINITIALIZED (M_if_sl | 2) +#define S_if_sl_UNIT_ALREADY_INITIALIZED (M_if_sl | 3) + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS slipInit (int unit, char *devName, char *myAddr, + char *peerAddr, int baud, BOOL compressEnable, + BOOL compressAllow, int mtu); +extern STATUS slipBaudSet (int unit, int baud); + +#else /* __STDC__ */ + +extern STATUS slipInit (); +extern STATUS slipBaudSet (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_slh */ diff --git a/h/in.h b/h/in.h new file mode 100644 index 0000000..80c37e2 --- /dev/null +++ b/h/in.h @@ -0,0 +1,26 @@ +/* in.h - obsolete vxWorks 5.0 header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,29sep92,rrr changed name of __INCinh to avoid conflict +01b,22sep92,rrr added support for c++ +01a,19sep92,smb written for compatibility with 5.0 +*/ + +#ifndef __INCobsolete_inh +#define __INCobsolete_inh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "netinet/in.h" + +#ifdef __cplusplus +} +#endif + +#endif /* __INCobsolete_inh */ diff --git a/h/inetLib.h b/h/inetLib.h new file mode 100644 index 0000000..eee1bf2 --- /dev/null +++ b/h/inetLib.h @@ -0,0 +1,79 @@ +/* inetLib.h - header for Internet address manipulation routines */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01l,16dec93,jag Added definition for inet_aton. +01k,09aug93,elh removed definitions of inet_addr, inet_ntoa, + inet_makeaddr, and inet_network (SPR 2268). +01j,22sep92,rrr added support for c++ +01i,04jul92,jcf cleaned up. +01h,26may92,rrr the tree shuffle + -changed includes to have absolute path from h/ +01g,04oct91,rrr passed through the ansification filter + -changed includes to have absolute path from h/ + -changed VOID to void + -changed copyright notice +01f,19oct90,shl added #include "in.h". +01e,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01d,10aug90,dnw added declaration of inet_ntoa_b(). +01c,24mar88,ecs added include of types.h. +01b,15dec87,gae added INET_ADDR_LEN; used IMPORTs on function decl's. +01a,01nov87,llk written +*/ + +#ifndef __INCinetLibh +#define __INCinetLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "sys/types.h" +#include "netinet/in.h" +#include "arpa/inet.h" + +/* status codes */ + +#define S_inetLib_ILLEGAL_INTERNET_ADDRESS (M_inetLib | 1) +#define S_inetLib_ILLEGAL_NETWORK_NUMBER (M_inetLib | 2) + +/* length of ASCII represention of inet addresses, eg. "90.0.0.0" */ + +#define INET_ADDR_LEN 18 + +/* function declarations */ + + +#if defined(__STDC__) || defined(__cplusplus) + +extern int inet_lnaof (int inetAddress); +extern int inet_netof (struct in_addr inetAddress); +extern void inet_makeaddr_b (int netAddr, int hostAddr, + struct in_addr *pInetAddr); +extern void inet_netof_string (char *inetString, char *netString); +extern void inet_ntoa_b (struct in_addr inetAddress, char *pString); +extern STATUS inet_aton (char * pString, struct in_addr * inetAddress); + + +#else /* __STDC__ */ + +extern int inet_lnaof (); +extern int inet_netof (); +extern void inet_makeaddr_b (); +extern void inet_netof_string (); +extern void inet_ntoa_b (); +extern STATUS inet_aton (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCinetLibh */ diff --git a/h/intLib.h b/h/intLib.h new file mode 100644 index 0000000..7f695a7 --- /dev/null +++ b/h/intLib.h @@ -0,0 +1,168 @@ +/* intLib.h - interrupt library header file */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02e,04oct04,mdo Documentation fixes for apigen +02d,22aug03,to added _WRS_INT_LOCK()/_WRS_INT_UNLOCK() macros. + deleted K&R style prototypes. +02c,07may03,pes PAL conditional compilation cleanup. Phase 2. +02b,29aug01,hdn included arch/i86/intI86Lib.h for arch specific stuff +02a,14dec00,pai added intEnable and intDisable for all T2 arches (SPR #63046). + AM29XXX, SIMSPARCSUNOS, and TRON are explicitly excluded. +01z,11sep00,hk changed to include intShLib.h for Hitachi SH architecture. +01y,01sep00,hk added intVBRSet() and _func_intConnectHook prototype for SH. +01x,03jun98,hdn added intHandlerCreateX86() prototype. +01w,25nov97,cdp moved ARM-specific things to arch/arm/intArmLib.h. +01v,28oct97,kkk added INT_NON_PREEMPT_MODEL macro. +01u,19aug97,cdp added intLibInit, INT_PREEMPT_MODEL and INT_HDWE_LOCK_LVL. +01t,27feb97,cdp added intEnable and intDisable for ARM. +01s,13dec96,tpr added #if/#endif arround intEnable() & intDisable() prototypes. +01r,09dec96,tpr added intEnable() & intDisable() prototypes. +01q,29nov96,kkk added prototypes for MIPS routines in the __STDC__ section. + took out intEnable & intDisable. (conflicts with PPC). +01p,25nov96,kkk added prototypes for MIPS interrupt routines. +01o,15jun95,ms added intRegsLock, intRegsUnlock prototypes +01n,02dec93,tpr removed am29200Intr3Connect() and am29200Intr3Drv(). + tpr added am29200Intr3DeMuxConnect(). + tpr added am29200Intr3Connect() and am29200Intr3Drv() for am29200. + pad added am29k family support. +01m,15oct92,jwt added intVecTableWriteEnable() prototype for SPARC. +01l,22sep92,rrr added support for c++ +01k,27jul92,rdc added S_intLib_VEC_TABLE_WP_UNAVAILABLE and + intVecTableWriteProtect (). +01j,04jul92,jcf cleaned up. +01i,26may92,rrr the tree shuffle +01h,10jan92,jwt added intAckConfig(), intTBRSet() prototypes for SPARC. +01g,04oct91,rrr passed through the ansification filter + -changed VOID to void + -changed copyright notice +01f,08apr91,jdi added NOMANUAL to prevent mangen. +01e,23oct90,shl fixed misspelling in intUnlock(). + changed intConnect() to take a VOIDFUNCPTR. +01d,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01c,10aug90,dnw added declaration of intVecSet(). +01b,15jul90,dnw added INT_CONTEXT() +01a,11apr90,jcf written. +*/ + +#ifndef __INCintLibh +#define __INCintLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "vwModNum.h" +#include "regs.h" + + +/* status codes */ + +#define S_intLib_NOT_ISR_CALLABLE (M_intLib | 1) +#define S_intLib_VEC_TABLE_WP_UNAVAILABLE (M_intLib | 2) + + +/* variable declarations */ + +IMPORT int intCnt; /* count of nested interrupt service routines */ + + +/* macros */ + +#define INT_CONTEXT() (intCnt > 0) /* same as intContext() in intLib.c */ + +/* +* +* INT_RESTRICT - restrict access of a routine from interrupt use +* +* RETURNS: OK if called from task level, or ERROR if called from interrupt +* level. +* +* NOMANUAL +*/ + +#define INT_RESTRICT() \ + ( \ + ((intCnt > 0) ? errno = S_intLib_NOT_ISR_CALLABLE, ERROR : OK) \ + ) + +/* function declarations */ + +extern STATUS intConnect (VOIDFUNCPTR * vector, VOIDFUNCPTR routine, + int parameter); +extern STATUS intDisconnect (VOIDFUNCPTR * vector, VOIDFUNCPTR routine, + int parameter); +extern FUNCPTR intHandlerCreate (FUNCPTR routine, int parameter); +extern void intLockLevelSet (int newLevel); +extern int intLockLevelGet (void); +extern BOOL intContext (void); +extern int intCount (void); +extern void intVecBaseSet (FUNCPTR *baseAddr); +extern FUNCPTR *intVecBaseGet (void); +extern void intVecSet (FUNCPTR *vector, FUNCPTR function); +extern FUNCPTR intVecGet (FUNCPTR *vector); +extern int intLevelSet (int level); +extern int intLock (void); +extern int intUnlock (int oldSR); +extern int intRegsLock (REG_SET *pRegs); +extern void intRegsUnlock (REG_SET *pRegs, int lockKey); +extern STATUS intVecTableWriteProtect (void); + +#if (CPU_FAMILY == SPARC) +extern void intAckConfig (); +extern void intTBRSet (FUNCPTR *baseAddr); +extern STATUS intVecTableWriteEnable (void); +#endif + +#if (CPU_FAMILY == AM29XXX) +extern FUNCPTR intHandlerCreateAm29k (FUNCPTR *vector, FUNCPTR routine, + int parameter); +#endif /* (CPU_FAMILY == AM29XXX) */ + +#if (CPU == AM29200) +extern STATUS am29200Intr3DeMuxConnect (VOIDFUNCPTR deMuxFct, int parameter); +#endif /* (CPU == AM29200) */ + +#if ((CPU_FAMILY != AM29XXX) || (CPU_FAMILY != SIMSPARCSUNOS) || \ + (CPU_FAMILY != TRON)) +extern int intDisable (int); +extern int intEnable (int); +#endif /* ((CPU_FAMILY != AM29XXX)) || ((CPU_FAMILY != ...)) */ + +#if (CPU_FAMILY == MIPS) +#include "arch/mips/intMipsLib.h" +#endif /* CPU_FAMILY == MIPS */ + +#if (CPU_FAMILY == ARM) +#include "arch/arm/intArmLib.h" +#endif /* (CPU_FAMILY == ARM) */ + +#if (CPU_FAMILY == I80X86) +#include "arch/i86/intI86Lib.h" +#endif /* (CPU_FAMILY == I80X86) */ + +#if (CPU_FAMILY == SH) +#include "arch/sh/intShLib.h" +#endif /* (CPU_FAMILY == SH) */ + +/* use inline intLock()/intUnlock(), if available and requested */ + +#if defined (_WRS_HAS_IL_INT_LOCK) && defined (_WRS_USE_IL_INT_LOCK) +#define _WRS_INT_LOCK() __inlineIntLock() +#define _WRS_INT_UNLOCK(key) __inlineIntUnlock(key) +#else +#define _WRS_INT_LOCK() intLock() +#define _WRS_INT_UNLOCK(key) intUnlock(key) +#endif /* defined (_WRS_HAS_IL_INT_LOCK) && defined (_WRS_USE_IL_INT_LOCK) */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCintLibh */ diff --git a/h/ioLib.h b/h/ioLib.h new file mode 100644 index 0000000..08ae710 --- /dev/null +++ b/h/ioLib.h @@ -0,0 +1,504 @@ +/* ioLib.h - I/O interface library header */ + +/* Copyright 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +06h,28sep05,pcm changed SEM_ID countMSem in DEV_HDR to BOOL drvRefFlag +06g,07sep05,pad Fixed prototype of user-side routines isatty(), read() and + write() (SPR 112005). +06f,03aug05,hya added struct fcntl_arg +06g,11aug05,rfr Added S_ioLib_MEDIA_CHANGED errno value +06f,15jul05,pad Removed some function prototypes already declared in unistd.h + (user-side only). +06e,13jul05,hya made removability change. +06d,20jun05,hya Added NOSTATTBL mark to errno defines. +06c,09may05,hya changed user APIs for POSIX compliance. +06b,28mar05,hya added struct RENAME_STRUCT. +06a,01mar05,hya added new ioctl commands +05z,07feb05,hya added missing RTP prototypes +05y,10jan05,hya Increase MAX_DIRNAMES to 148 +05x,09nov04,rfr Added FIOCOMMITFS (commit a transactional file system) +05w,01oct04,yvp Change lseek args to use off_t (for Posix). +05v,23sep04,yvp Added (get/set)prlimit. +05u,10sep04,jyo SPR 100119: RT11FsLib has be obsoleted. This is reflected in + this file. +05t,11may04,dat 97227, chg ioGlobalStdSet from void to STATUS +05s,04mar04,dat adding dup and dup2 APIs +05r,18feb04,dat adding _getcwd for RTP space, adding all APIs from ioLib.c, + deprecating the ones not avail in RTP space. +05q,06dec03,dat new errno numeric values +05p,07nov03,dat ioctl is shared rtn +05o,25sep03,job Added ifdef _WRS_KERNEL sections to allow ioLib.h to be + used from user and kernel mode builds. +05o,28jul03,dat removed old 960 pragma, full proto for ioFullFileNameGet(). + changed 64 bit ioctl numbers. +05n,22oct02,dat documenting ioctl number ranges (SPR 7187) +05m,18jul02,jkf SPR#24332, added S_ioLib_CANT_OVERWRITE_DIR (12) + Added FIOMOVE. +05l,29aug00,jgn add const to function prototypes (SPR #30492) +05k,13dec99,jkf added _ASMLANGUAGE, changed 64 bit ioctl to ascend +05j,03mar02,jkf SPR#24332, added S_ioLib_CANT_OVERWRITE_DIR (12), orig by chn +05i,03dec98,lrn add FIOTRUNC64 (SPR#23692) +05h,15oct98,lrn added 64-bit ioctl codes for dosFsLib and rawFsLib +05g,29aug95,hdn added S_ioLib_UNFORMATED for floppy disk driver. +05f,29dec93,jmm added FIOTIMESET for utime() support + added FIOINODETONAME to translate inodes to names + added FIOFSTATFSGET to get information for fstatfs() +05e,02oct92,srh added FIOGETFL ioctl code +05d,22sep92,rrr added support for c++ +05c,18sep92,smb moved open and creat prototypes to fcntl.h. +05b,16sep92,kdl added include of unistd.h; added L_* definitions for compat. +05a,02aug92,jcf added creat(). +04z,29jul92,smb added include for fcntl.h. removed fopen options. +04y,22jul92,kdl added include of stdio.h if using delete() macro. +04x,22jul92,kdl removed references to delete(); added conditional macro + definition for delete() to use remove() instead. +04w,04jul92,jcf cleaned up. +04v,30jun92,kdl added FIONCONTIG and FIOTRUNC ioctl codes; added CONTIG_MAX. +04u,26may92,rrr the tree shuffle +04t,05dec91,rrr moved O_ and L_ macros to their posix header files +04s,26nov91,llk fixed delete() prototype. +04r,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed READ, WRITE and UPDATE to O_RDONLY O_WRONLY and + O_RDWR + -changed VOID to void + -changed copyright notice +04q,10jun91.del added pragma for gnu960 alignment. +04o,20oct90,dnw removed "iosLib.h" and declaration that required it. +04n,19oct90,shl added #include "iosLib.h". +04m,05oct90,dnw deleted private routines. + added chdir(), getcwd(), remove(), rename() +04l,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +04k,10aug90,dnw added declaration of ioDefDirGet(). +04j,11jul90,jcc added FIOSCSICOMMAND. +04i,14jun90,kdl added FIOUNMOUNT. +04h,25may90,dnw added include of limits.h and defined MAX_FILENAME_LENGTH + in terms of PATH_MAX +04g,20apr90,kdl added FIOREADDIR, FIOFSTATGET. +04f,01apr90,llk added S_ioLib_NAME_TOO_LONG. + decreased MAX_DIRNAMES. +04e,17mar90,rdc added FIOSELECT and FIOUNSELECT. + dab changed O_CREAT and O_TRUNC values (from 0x80 and 0x100 to + 001000 and 002000). fixed spelling of S_ioLib_CANCELLED. + kdl added MS-DOS functions: FIONFREE, FIOMKDIR, FIORMDIR, + FIOLABELGET, FIOLABELSET, FIOATTRIBSET, FIOCONTIG. +04d,27jul89,hjb added ty protocol hook stuff: FIOPROTOHOOK,FIOPROTOARG + FIORBUFSET,FIOWBUFSET,FIORFLUSH,FIOWFLUSH. +04c,21apr89,dab added FIOSYNC for sync to disk. +04b,18nov88,dnw removed NOT_GENERIC stuff. +04a,22jun88,dnw moved READ, WRITE, and UPDATE back to vxWorks.h. +03z,04jun88,llk added MAX_DIRNAMES and S_ioLib_NO_DEVICE_NAME_IN_PATH for path + parsing. + added FSTAT for file types (inspired by nfs). + added DEFAULT_FILE_PERM and DEFAULT_DIR_PERM for newly created + files and directories. +03y,30apr88,gae got read/write modes right. +03x,29mar88,gae added FIOISATTY. Added UNIX style open() and lseek() flags. + moved READ, WRITE, and UPDATE here from vxWorks.h. +03w,31dec87,jlf added FOLLOW_LINK. +03v,01oct87,gae added FIOGETNAME for all file descriptors. + added FIO[SG]ETOPTIONS for line options on devices. +03u,09sep87,dnw added FIONBIO for sockets. + added FIONMSGS for pipes. +03t,09sep87,dnw added FIOSQUEEZE and HD_1, HD_2 for rt-11 disks. +03s,09jun87,ecs added S_ioLib_CANCELED & FIOCANCEL. +03r,14feb87,dnw added S_ioLib_NO_FILENAME. +03q,04feb87,llk added FIODISKCHANGE. +03p,24dec86,gae changed stsLib.h to vwModNum.h. +03o,01dec86,dnw increased MAX_FILENAME_LENGTH from 32 to 100. +03n,20nov86,dnw added S_ioLib_DISK_NOT_PRESENT. +03m,17oct86,gae added S_ioLib_WRITE_PROTECTED. +03l,21may86,llk corrected comments. +03k,23mar86,jlf changed GENERIC to NOT_GENERIC +03j,08mar86,dnw added S_ioLib_DEVICE_TIMEOUT. +*/ + +#ifndef __INCioLibh +#define __INCioLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_DIRNAMES 148 /* max directory names in path*/ +#define MAX_FILENAME_LENGTH (PATH_MAX + 1) /* max chars in filename + * including EOS*/ + +/* I/O status codes */ + +/* + * Always use the VxWorks macro name in WRS vxWorks source code. This just + * allows end-customers to use posix errno values in their posix code. + * + * NOSTATTBL mark at end will exclude those errno definitions from being + * included into statSymTbl, which may hide generic errno strings by + * those IO specifics in printErrno, etc. + */ + +#define S_ioLib_NO_DRIVER ENXIO /* NOSTATTBL */ +#define S_ioLib_UNKNOWN_REQUEST ENOSYS /* NOSTATTBL */ +#define S_ioLib_DEVICE_ERROR EIO /* NOSTATTBL */ +#define S_ioLib_DEVICE_TIMEOUT EIO /* NOSTATTBL */ +#define S_ioLib_WRITE_PROTECTED EACCES /* NOSTATTBL */ +#define S_ioLib_DISK_NOT_PRESENT ENXIO /* NOSTATTBL */ +#define S_ioLib_NO_FILENAME EINVAL /* NOSTATTBL */ +#define S_ioLib_CANCELLED ECANCELED /* NOSTATTBL */ +#define S_ioLib_NO_DEVICE_NAME_IN_PATH ENODEV /* NOSTATTBL */ +#define S_ioLib_NAME_TOO_LONG ENAMETOOLONG /* NOSTATTBL */ +#define S_ioLib_UNFORMATED EIO /* NOSTATTBL */ +#define S_ioLib_CANT_OVERWRITE_DIR EISDIR /* NOSTATTBL */ + +/* +* This errno is used by drivers to communicate the media changed condition to +* Core I/O - it should not be used outside of the I/O system +*/ +#define S_ioLib_MEDIA_CHANGED (M_ioLib | 1) + + +/* + * Ioctl function number ranges: + * + * 0x00000000 - 0x1FFFFFFF - reserved for WindRiver use + * 0x20000000 - 0x2FFFFFFF - unix style ioctls (networking) + * 0x30000000 - 0x3FFFFFFF - User reserved codes + * 0x40000000 - 0x4FFFFFFF - unix style ioctls (networking) + * 0x50000000 - 0x7FFFFFFF - reserved for future use + * 0x80000000 - 0x8FFFFFFF - unix style ioctls (networking) + * 0x90000000 - 0xBFFFFFFF - reserved for future use + * 0XC0000000 - 0xCFFFFFFF - unix style ioctls (networking) + * 0xD0000000 - 0xFFFFFFFE - reserved for future use + * 0xFFFFFFFF reserved, invalid code number + * + * For VxWorks sub systems, the recommended way to generate + * ioctl numbers is to use the module number (shifted right) as a base. + * This will be okay as long as module numbers are not more than + * 16 bits in length. (remember, module numbers are already + * shifted left 16 bits). + * + * i.e. #define SUBSYS_IOCTL_1 ((M_subSystem>>8) | 1) + */ + +/* ioctl function codes */ + +#define FIONREAD 1 /* get num chars available to read */ +#define FIOFLUSH 2 /* flush any chars in buffers */ +#define FIOOPTIONS 3 /* set options (FIOSETOPTIONS) */ +#define FIOBAUDRATE 4 /* set serial baud rate */ +#define FIODISKFORMAT 5 /* format disk */ +#define FIODISKINIT 6 /* initialize disk directory */ +#define FIOSEEK 7 /* set current file char position */ +#define FIOWHERE 8 /* get current file char position */ +#define FIODIRENTRY 9 /* return a directory entry (obsolete)*/ +#define FIORENAME 10 /* rename a directory entry */ +#define FIOREADYCHANGE 11 /* return TRUE if there has been a + media change on the device */ +#define FIONWRITE 12 /* get num chars still to be written */ +#define FIODISKCHANGE 13 /* set a media change on the device */ +#define FIOCANCEL 14 /* cancel read or write on the device */ +#define FIOSQUEEZE 15 /* OBSOLETED since RT11 is obsoleted */ +#define FIONBIO 16 /* set non-blocking I/O; SOCKETS ONLY!*/ +#define FIONMSGS 17 /* return num msgs in pipe */ +#define FIOGETNAME 18 /* return file name in arg */ +#define FIOGETOPTIONS 19 /* get options */ +#define FIOSETOPTIONS FIOOPTIONS /* set options */ +#define FIOISATTY 20 /* is a tty */ +#define FIOSYNC 21 /* sync to disk */ +#define FIOPROTOHOOK 22 /* specify protocol hook routine */ +#define FIOPROTOARG 23 /* specify protocol argument */ +#define FIORBUFSET 24 /* alter the size of read buffer */ +#define FIOWBUFSET 25 /* alter the size of write buffer */ +#define FIORFLUSH 26 /* flush any chars in read buffers */ +#define FIOWFLUSH 27 /* flush any chars in write buffers */ +#define FIOSELECT 28 /* wake up process in select on I/O */ +#define FIOUNSELECT 29 /* wake up process in select on I/O */ +#define FIONFREE 30 /* get free byte count on device */ +#define FIOMKDIR 31 /* create a directory */ +#define FIORMDIR 32 /* remove a directory */ +#define FIOLABELGET 33 /* get volume label */ +#define FIOLABELSET 34 /* set volume label */ +#define FIOATTRIBSET 35 /* set file attribute */ +#define FIOCONTIG 36 /* allocate contiguous space */ +#define FIOREADDIR 37 /* read a directory entry (POSIX) */ +#define FIOFSTATGET 38 /* get file status info */ +#define FIOUNMOUNT 39 /* unmount disk volume */ +#define FIOSCSICOMMAND 40 /* issue a SCSI command */ +#define FIONCONTIG 41 /* get size of max contig area on dev */ +#define FIOTRUNC 42 /* truncate file to specified length */ +#define FIOGETFL 43 /* get file mode, like fcntl(F_GETFL) */ +#define FIOTIMESET 44 /* change times on a file for utime() */ +#define FIOINODETONAME 45 /* given inode number, return filename*/ +#define FIOFSTATFSGET 46 /* get file system status info */ +#define FIOMOVE 47 /* move file, ala mv, (mv not rename) */ + +/* 64-bit ioctl codes, "long long *" expected as 3rd argument */ + +#define FIOCHKDSK 48 +#define FIOCONTIG64 49 +#define FIONCONTIG64 50 +#define FIONFREE64 51 +#define FIONREAD64 52 +#define FIOSEEK64 53 +#define FIOWHERE64 54 +#define FIOTRUNC64 55 + +#define FIOCOMMITFS 56 +#define FIODATASYNC 57 /* sync to I/O data integrity */ +#define FIOLINK 58 /* create a link */ +#define FIOUNLINK 59 /* remove a link */ +#define FIOACCESS 60 /* support POSIX access() */ +#define FIOPATHCONF 61 /* support POSIX pathconf() */ +#define FIOFCNTL 62 /* support POSIX fcntl() */ +#define FIOCHMOD 63 /* support POSIX chmod() */ + +/* TODO: need to consolidate ioctl codes from a few files to avoid collision */ + + +/* ioctl option values */ + +#define OPT_ECHO 0x01 /* echo input */ +#define OPT_CRMOD 0x02 /* lf -> crlf */ +#define OPT_TANDEM 0x04 /* ^S/^Q flow control protocol */ +#define OPT_7_BIT 0x08 /* strip parity bit from 8 bit input */ +#define OPT_MON_TRAP 0x10 /* enable trap to monitor */ +#define OPT_ABORT 0x20 /* enable shell restart */ +#define OPT_LINE 0x40 /* enable basic line protocol */ + +#define OPT_RAW 0 /* raw mode */ + +#define OPT_TERMINAL (OPT_ECHO | OPT_CRMOD | OPT_TANDEM | \ + OPT_MON_TRAP | OPT_7_BIT | OPT_ABORT | OPT_LINE) + +#define CONTIG_MAX -1 /* "count" for FIOCONTIG if requesting + * maximum contiguous space on dev + */ + +/* miscellaneous */ + +#define FOLLOW_LINK -2 /* value for driver to return */ + +#define DEFAULT_FILE_PERM 0000640 /* default file permissions + unix style rw-r----- */ +#define DEFAULT_DIR_PERM 0000750 /* default directory permissions + unix style rwxr-x--- */ + +/* file types -- NOTE: these values are specified in the NFS protocol spec */ + +#define FSTAT_DIR 0040000 /* directory */ +#define FSTAT_CHR 0020000 /* character special file */ +#define FSTAT_BLK 0060000 /* block special file */ +#define FSTAT_REG 0100000 /* regular file */ +#define FSTAT_LNK 0120000 /* symbolic link file */ +#define FSTAT_NON 0140000 /* named socket */ + +/* Device Header values */ + +#define DEV_HDR_REMOVABLE 0x0001 + +/* ioctl augmented arguments */ + +#ifndef _ASMLANGUAGE +/* the following is obsolete and only used now by rt-11 */ + +typedef struct /* REQ_DIR_ENTRY */ + { + int entryNum; /* number of directory entry */ + char name[MAX_FILENAME_LENGTH]; /* name of file */ + int nChars; /* number of chars in file */ + short day; /* creation day of month */ + short month; /* creation month of year */ + short year; /* creation year of era */ + } REQ_DIR_ENTRY; + +/* INODE_TO_NAME_IOCTL is used to call FIOINODETONAME */ + +typedef struct + { + ULONG inode; /* file inode */ + char * fileName; /* pointer to string to hold file name */ + } INODE_TO_NAME_IOCTL; + +/* + * Used to provide for fcntl support via ioctl + */ +typedef struct fcntl_arg + { + int command; /* 2nd arg of fcntl */ + void *data; /* the data in/out */ + } FCNTL_ARG; + +/* disk formats */ + +#define SS_1D_8 1 /* single side, single density, 8" */ +#define SS_2D_8 2 /* single side, double density, 8" */ +#define DS_1D_8 3 /* double side, single density, 8" */ +#define DS_2D_8 4 /* double side, double density, 8" */ +#define SS_1D_5 5 /* single side, single density, 5 1/4" */ +#define SS_2D_5 6 /* single side, double density, 5 1/4" */ +#define DS_1D_5 7 /* double side, single density, 5 1/4" */ +#define DS_2D_5 8 /* double side, double density, 5 1/4" */ + +#define HD_1 129 /* hard disk - type 1 */ +#define HD_2 130 /* hard disk - type 2 */ + +/* iosDevDelete & iosDrvRemove return codes */ +#define DELETE_DONE OK +#define REFCNT_NOT_ZERO 1 +#define DELETE_ERROR ERROR + +/* globals */ + +/* APIs common to Kernel and RTP Space */ + +extern STATUS unlink (const char *); +extern int dup (int); +extern int dup2 (int, int); +extern int rename (const char *, const char *); +extern off_t lseek (int, off_t, int); +extern int readv (int fd, struct iovec *iov, int iovcnt); +extern int writev (int fd, struct iovec * iov, int iovcnt); +extern STATUS ioDefPathSet (const char * name); +extern void ioDefPathGet (char * pathname); +extern STATUS chdir (const char *); +extern char * getcwd (char *, int); +extern char * getwd (char * pathname); + +#ifdef _WRS_KERNEL + +/* APIs unique to Kernel */ +extern int open (const char *, int, int); +extern int creat (const char *, int); +extern int read (int, char *, size_t); +extern int write (int, char *, size_t); +extern int ioctl (int fd, int function, int arg); +extern STATUS close (int); +extern STATUS remove (const char *); +extern BOOL isatty (int fd); + +extern int ioMaxLinkLevels; /* max number of symbolic links to traverse */ + +/* external structures (prevents include loops) */ + +typedef struct dev_hdr /* DEV_HDR - device header for all device structures */ + { + DL_NODE node; /* device linked list node */ + short drvNum; /* driver number for this device */ + const char *name; /* device name */ + int drvRefCount; /* counter of concurrent driver invocations */ + UINT32 drvRefFlag; /* driver reference flags */ + void *pDrvEntry; /* driver table of this device */ + FUNCPTR deleteDrv; /* driver called upon device delete */ + } DEV_HDR; + +/* + * Used to provide for both new and old file names in rename and move. + * Device driver ioctl can cast the 3rd arg as a pointer to + * RENAME_STRUCT. If not interested, it remains compatible + * with a pointer to new, destination file name string. + */ +typedef struct + { + char newname [MAX_FILENAME_LENGTH]; /* New, destination file name */ + char *oldname; /* Old, original file name */ + } RENAME_STRUCT; + +extern STATUS ioFullFileNameGet (const char * pathName, + struct dev_hdr ** ppDevHdr, + char * fullFileName); +extern STATUS ioDefPathCat (const char * name); +extern void ioDefDevGet (char * devName); /* RTP ??? */ +extern void ioDefDirGet (char * dirName); /* RTP ??? */ +extern int ioGlobalStdGet (int stdFd); +extern STATUS ioGlobalStdSet (int stdFd, int newFd); +extern int ioTaskStdGet (int taskId, int stdFd); +extern STATUS ioTaskStdSet (int taskId, int stdFd, int newFd); + +#else + +/* APIs unique to RTP space */ + +extern int open (const char *, int, ...); +extern int creat (const char *, mode_t); +extern ssize_t read (int, void *, size_t); +extern ssize_t write (int, const void *, size_t); + +extern int ioctl (int fd, int function, ...); +extern int close (int); +extern int remove (const char *); + +extern int isatty (int fd); +extern char * _getcwd (char *, int); +extern int _open (const char *, int, int); +extern int _ioctl (int fd, int function, int arg); +extern int dup (int); +extern int dup2 (int,int); +extern int pipe (int fildes[2]); +extern int getprlimit (int idtype, int id, int resource, + struct rlimit * rlp); +extern int setprlimit (int idtype, int id, int resource, + struct rlimit * rlp); +extern size_t rtpIoTableSizeGet (RTP_ID rtpId); +extern STATUS rtpIoTableSizeSet (RTP_ID rtpId, size_t newSize); +/* also select, pipeDevCreate, pipeDevDelete */ + +/* Deprecated declarations of kernel only APIs */ + +extern int ioMaxLinkLevels _WRS_DEPRECATED("not avail in RTP"); + +extern STATUS ioFullFileNameGet () _WRS_DEPRECATED("not avail in RTP"); +extern STATUS ioDefPathCat () _WRS_DEPRECATED("not avail in RTP"); +extern void ioDefDevGet () _WRS_DEPRECATED("not avail in RTP"); +extern void ioDefDirGet () _WRS_DEPRECATED("not avail in RTP"); +extern int ioGlobalStdGet () _WRS_DEPRECATED("not avail in RTP"); +extern STATUS ioGlobalStdSet () _WRS_DEPRECATED("not avail in RTP"); +extern int ioTaskStdGet () _WRS_DEPRECATED("not avail in RTP"); +extern STATUS ioTaskStdSet () _WRS_DEPRECATED("not avail in RTP"); + +#endif + +#endif /* #ifndef _ASMLANGUAGE */ + +/* Conditional definition of delete() for compatibility with earlier VxWorks */ + +#define __DELETE_FUNC FALSE /* change to TRUE to use delete() */ + +#if __DELETE_FUNC +#include "stdio.h" +#define delete(filename) remove(filename) +#endif /* __DELETE_FUNC */ + + +/* Miscellaneous obsolete definitions, for backward compatibility */ + +#define L_SET SEEK_SET /* see unistd.h */ +#define L_INCR SEEK_CUR +#define L_XTND SEEK_END + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCioLibh */ + + + + diff --git a/h/ioQLib.h b/h/ioQLib.h new file mode 100644 index 0000000..f41270c --- /dev/null +++ b/h/ioQLib.h @@ -0,0 +1,108 @@ +/* ioQLib.h - I/O queue library header file */ + +/* Copyright 1993-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01c,29apr05,hya added IO_DSYNC. +01b,26jan94,kdl changed name to ioQLib.h. +01a,04apr93,elh written. +*/ + +#ifndef __INCioQLibh +#define __INCioQLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include +#include +#include + +/* typedefs */ + +typedef struct io_node /* I/O node */ + { + NODE node; /* list node */ + int op; /* op IO_READ | IO_WRITE */ + int prio; /* priority */ + int taskId; /* initiating task id */ + int retVal; /* return value */ + int errorVal; /* error value */ + VOIDFUNCPTR doneRtn; /* done routine */ + int value; + } IO_NODE; + +typedef struct io_q /* I/O queue */ + { + LIST workQ; /* list structure */ + LIST waitQ; /* list structure */ + VOIDFUNCPTR lock; /* lock routine */ + VOIDFUNCPTR unlock; /* unlock routine */ + int lockArg; /* arg for lock/unlock */ + } IO_Q; + +/* defines */ + +/* i/o operations */ + +#define IO_READ 0 /* READ operation */ +#define IO_WRITE 1 /* WRITE operation */ +#define IO_SYNC 2 /* Sync operation */ +#define IO_DSYNC 3 /* Data sync operation */ + +/* i/o synchronization and operations */ + +#define IOQ_LOCK(pQ) ((*(pQ)->lock) ((pQ)->lockArg)) +#define IOQ_UNLOCK(pQ) ((*(pQ)->unlock) ((pQ)->lockArg)) + +#define IOQ_WORK_ADD(pQ, pNode, prio) \ + ioQAdd (&(pQ)->workQ, (pNode), (prio)) + +#define IOQ_WORK_ADD_HEAD(pQ, pNode) \ + lstInsert (&(pQ)->workQ, NULL, &(pNode)->node) + +#define IOQ_WAIT_ADD(pQ, pNode, prio) \ + ioQAdd (&(pQ)->waitQ, (pNode), (prio)) + +#define IOQ_WORK_DELETE(pQ, pNode) lstDelete (&(pQ)->workQ, &(pNode)->node) +#define IOQ_WAIT_DELETE(pQ, pNode) lstDelete (&(pQ)->waitQ, &(pNode)->node) + +/* forward declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void ioQInit (IO_Q * pQ, VOIDFUNCPTR pLock, VOIDFUNCPTR pUnlock, + int lockArg); +extern void ioQNodeDone (IO_NODE * pNode); +extern void ioQLockSem (SEM_ID semId); +extern void ioQUnlockSem (SEM_ID semId); +extern void ioQAdd (LIST * pQ, IO_NODE * pNode, int prio); +extern void ioQDelete (IO_Q * pQ, IO_NODE * pNode); +extern IO_NODE * ioQEach (LIST * pQ, FUNCPTR pRoutine, int arg1, int arg2); + +#else /* __STDC__ */ + +extern void ioQInit (); +extern void ioQNodeDone (); +extern void ioQLockSem (); +extern void ioQUnlockSem (); +extern void ioQAdd (); +extern void ioQDelete (); +extern IO_NODE * ioQEach (); + +#endif /* __STDC__ */ +#ifdef __cplusplus +} +#endif + +#endif /* __INCioQLibh */ diff --git a/h/ioctl.h b/h/ioctl.h new file mode 100644 index 0000000..8204454 --- /dev/null +++ b/h/ioctl.h @@ -0,0 +1,11 @@ +/* ioctl.h - obsolete vxWorks 5.0 header file */ + +/* Copyright 1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,09feb93,rrr written for compatibility with 5.0 +*/ + +#include "sys/ioctl.h" diff --git a/h/iosLib.h b/h/iosLib.h new file mode 100644 index 0000000..3c9d62d --- /dev/null +++ b/h/iosLib.h @@ -0,0 +1,148 @@ +/* iosLib.h - I/O system header file */ + +/* Copyright 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +02f,19aug05,hya added iosDevResume(). +02e,09aug05,hya added iosDevReplace() & iosDevSuspend(). +02d,26jul05,hya Added iosDevDelCallback(). +02c,20jun05,hya Added NOSTATTBL mark to errno defines. +02b,03may04,dat adding new API iosFdDrvValue, SPR 96744 +02a,01mar04,dat new API iosFdMaxFiles(). +01z,17feb04,dat Separating public and private APIs +01y,02dec03,dat POSIX error values +01x,07nov03,dat adding const to arguments +01w,31oct03,dat new ios interfaces for FD_ENTRYs +01v,28jul03,dat moved DEV_HDR to ioLib.h, removed non-ANSI prototypes, + changed args to iosDevFind to (const char *). +01u,03oct01,dcb Fix SPR 20033. iosFdSet uses malloc without checking return + code. +01t,15jan93,wmd added S_iosLib_INVALID_ETHERNET_ADDRESS +01s,22sep92,rrr added support for c++ +01r,23aug92,jcf added iosShowInit() prototype. + changed to use dllLib. +01q,04jul92,jcf cleaned up. +01p,26may92,rrr the tree shuffle +01o,04oct91,rrr passed through the ansification filter + -changed VOID to void + -changed copyright notice +01n,05oct90,dnw deleted private routines. +01m,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01l,10aug90,dnw added declaration of iosFdFree(). +01k,07may90,hjb added IMPORT declaration of iosFdDevFind(). +01j,30jun88,llk added definition of iosNextDevGet(). +01i,04jun88,llk removed S_iosLib_INVALID_DEVICE_NAME. +01h,12apr88,gae moved defn's of FD_ENTRY & DRV_ENTRY to iosLib.c. +01g,16dec87,jlf changed de_dummy field in DRV_ENTRY to de_inuse. +01f,30sep87,gae added name field to FD_ENTRY. +01e,29apr87,dnw added S_iosLib_CONTROLLER_NOT_PRESENT. +01d,24dec86,gae changed stsLib.h to vwModNum.h. +01c,01dec86,dnw changed DEV_HDR.name to be ptr to name instead array of name. +01b,07aug84,ecs added status codes and include of stsLib.h +01a,08jun84,dnw written +*/ + +#ifndef __INCiosLibh +#define __INCiosLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "ioLib.h" +#include "dllLib.h" +#include "vwModNum.h" + +/* status codes + * + * NOSTATTBL mark at end will exclude those errno definitions from being + * included into statSymTbl, which may hide generic errno strings by + * those IO specifics in printErrno, etc. + */ + +#define S_iosLib_DEVICE_NOT_FOUND ENODEV /* NOSTATTBL */ +#define S_iosLib_DRIVER_GLUT ENOMEM /* NOSTATTBL */ +#define S_iosLib_INVALID_FILE_DESCRIPTOR EBADF /* NOSTATTBL */ +#define S_iosLib_TOO_MANY_OPEN_FILES EMFILE /* NOSTATTBL */ +#define S_iosLib_CONTROLLER_NOT_PRESENT ENXIO /* NOSTATTBL */ +#define S_iosLib_DUPLICATE_DEVICE_NAME EINVAL /* NOSTATTBL */ +#define S_iosLib_INVALID_ETHERNET_ADDRESS EINVAL /* NOSTATTBL */ + + +/* PUBLIC function declarations */ + +extern STATUS iosInit (int max_drivers, int max_files, + const char *nullDevName); +extern void iosShowInit (void); + +extern int iosDrvInstall (FUNCPTR pCreate, FUNCPTR pDelete, FUNCPTR pOpen, + FUNCPTR pClose, FUNCPTR pRead, FUNCPTR pWrite, + FUNCPTR pIoctl); +extern STATUS iosDrvRemove (int drvnum, BOOL forceClose); +extern void iosDrvShow (void); + +extern STATUS iosDevAdd (DEV_HDR *pDevHdr, const char *name, int drvnum); +extern STATUS iosDevReplace (DEV_HDR *pDevHdr, const char *name, + int drvnum); +extern STATUS iosDevSuspend (DEV_HDR *pDevHdr); +extern STATUS iosDevResume (DEV_HDR *pDevHdr); +extern int iosDevDelete (DEV_HDR *pDevHdr); +extern STATUS iosDevDelCallback (DEV_HDR *pDevHdr, FUNCPTR pCallback); +extern void iosDevShow (void); + +extern void iosFdShow (void); + +extern int iosFdNew (DEV_HDR *pDevHdr, const char *name, int value); +extern DEV_HDR *iosFdDevFind (int fd); +extern int iosFdDrvValue (int fd, int drvNum); +extern void iosFdFree (int fd); +extern size_t iosFdMaxFiles (void); + +extern DEV_HDR *iosDevFind (const char *name, const char *(* pNameTail)); +extern DEV_HDR *iosNextDevGet (DEV_HDR *pDev); + + +/* PRIVATE function declarations */ + +#ifndef __INCiosLibPh + +extern int iosOpen (DEV_HDR *pDevHdr, const char *fileName, + int flags, int mode) + _WRS_DEPRECATED("not a public API"); +extern int iosCreate (DEV_HDR *pDevHdr, const char *fileName, int mode) + _WRS_DEPRECATED("not a public API"); +extern int iosDelete (DEV_HDR *pDevHdr, const char *fileName) + _WRS_DEPRECATED("not a public API"); +extern int iosIoctl (int fd, int function, int arg) + _WRS_DEPRECATED("not a public API"); +extern int iosRead (int fd, char *buffer, int maxbytes) + _WRS_DEPRECATED("not a public API"); +extern int iosWrite (int fd, char *buffer, int nbytes) + _WRS_DEPRECATED("not a public API"); +extern STATUS iosClose (int fd) + _WRS_DEPRECATED("not a public API"); + +extern STATUS iosFdSet (int fd, DEV_HDR *pDevHdr, const char *name, + int value) + _WRS_DEPRECATED("not a public API"); + +extern int iosFdValue (int fd) + _WRS_DEPRECATED("use iosFdDrvValue instead"); + +#endif /* __INCiosLibPh */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCiosLibh */ diff --git a/h/iosScLib.h b/h/iosScLib.h new file mode 100644 index 0000000..28ab303 --- /dev/null +++ b/h/iosScLib.h @@ -0,0 +1,39 @@ +/* iosScLib.h - real time process IO system library header file */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,21oct03,dat written, from rtpLib.h, v01i +*/ + +#ifndef __INCiosScLibh +#define __INCiosScLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" +#include "rtpLibCommon.h" + +/* defines */ + +/* externs */ + +#ifndef _ASMLANGUAGE + +/* function declarations */ + +extern STATUS iosScLibInit (void); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCiosScLibh */ diff --git a/h/ipProto.h b/h/ipProto.h new file mode 100644 index 0000000..a93c1ae --- /dev/null +++ b/h/ipProto.h @@ -0,0 +1,75 @@ +/* ipProto.h - defines for the bsd protocol pseudo-device driver */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01p,10oct01,rae merge from truestack (SPRs 29668, 65773) +01o,07nov00,spm moved nptFlag from END_OBJ for T2 END binary compatibility +01n,17oct00,spm merged from version 01m of tor3_x branch (base version 01i): + added backward compatibility for END devices +01m,02aug99,pul adding #include if_ether.h +01l,29apr99,pul Upgraded NPT phase3 code to tor2.0.0 +01k,02mar99,pul protoType for ipAttach(), SPR# 24253 +01j,08aug98,ann Included if_ether.h to reference idr +01i,08dec97,gnn END code review fixes. +01h,25sep97,gnn SENS beta feedback fixes +01g,19aug97,gnn changes due to new buffering scheme. +01f,12aug97,gnn changes necessitated by MUX/END update. +01e,02jun97,gnn Added added memWidth to structure. +01d,21mar97,map Added pRefCntHead, removed nLoan from BSD_DRV_CTRL. +01c,22jan97,gnn Added new private flags that is seperate from if flags. +01b,21jan97,gnn Removed buffer loaning stuff. + Added reference count information. + Added minFirstBuf for scatter/gather. +01a,17dec96,gnn written. + +*/ + +#ifndef __INCipProtoh +#define __INCipProtoh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "netinet/if_ether.h" + +/* defints */ + +/* typedefs */ +typedef struct ip_drv_ctrl + { + struct arpcom idr; /* Interface Data Record */ + void* pArpCookie; + void* pIpCookie; + int attached; + BOOL nptFlag; /* Indicates type of interface: END or NPT. */ + M_BLK_ID pSrc; /* source address and type (for END device). */ + M_BLK_ID pDst; /* dest. address and type (for END device). */ + char * pDstAddr; /* cluster containing dest. address */ + } IP_DRV_CTRL; + +/* The array of driver control structures */ + +extern IP_DRV_CTRL ipDrvCtrl[]; + +/* forward declarations */ + +/* globals */ +IMPORT int ipAttach (int unit, char *pDevice); +IMPORT STATUS ipDetach (int unit, char *pDevice); +IMPORT void *ipMuxCookieGet (unsigned short ifIndex); + +/* locals */ + +/* forward declarations */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCipProtoh */ diff --git a/h/isrLib.h b/h/isrLib.h new file mode 100644 index 0000000..2870cf3 --- /dev/null +++ b/h/isrLib.h @@ -0,0 +1,67 @@ +/* isrLib.h - ISR objects header */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,29oct03,kam ISR Object code inspection mods +01b,04jun03,kam removed definition of ISR_ID and moved to vxWind.h +01a,03jun03,kam written. +*/ + +#ifndef __INCisrLibh +#define __INCisrLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" +#include "vwModNum.h" + +/* status codes */ + +#define S_isrLib_ISR_NOT_INIT (M_isrLib | 1) +#define S_isrLib_INVALID_PARAM (M_isrLib | 2) + +/* typedefs */ + +typedef struct isr_desc + { + ISR_ID isrId; /* ISR_ID */ + char * name; /* name */ + UINT isrTag; /* interrupt tag */ + UINT count; /* # of times this ISR has been invoked */ + UINT serviceCount; /* # of times this ISR has returned OK */ + UINT64 cpuTime; /* cpu time spent in ISR */ + int options; /* ISR object options */ + + FUNCPTR handlerRtn; /* pointer to handler routine */ + int arg; /* parameter to be passed to routine */ + } ISR_DESC; + +/* externs */ + +/* variables */ + +extern ISR_ID isrIdCurrent; + +/* routines */ + +extern ISR_ID isrCreate (char * name, UINT isrTag, FUNCPTR handler, + int parameter, UINT options); +extern STATUS isrDelete (ISR_ID isrId); +extern STATUS isrInvoke (ISR_ID isrId); +extern ISR_ID isrIdSelf (void); +extern STATUS isrInfoGet (ISR_ID isrId, ISR_DESC * pIsrDesc); + +extern STATUS isrShow (ISR_ID isrId); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCisrLibh */ diff --git a/h/iv.h b/h/iv.h new file mode 100644 index 0000000..7b92068 --- /dev/null +++ b/h/iv.h @@ -0,0 +1,103 @@ +/* iv.h - interrupt vectors */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02e,17apr03,dbt Added SIMLINUX support. +02d,22oct01,dee Merge from T2.1.0 ColdFire +02c,01mar00,frf Add SH4 support for T2. +02b,23apr97,hk added SH support. +02b,15aug97,cym added SIMNT support. +02b,28nov96,cdp added ARM support. +02a,26may94,yao added PPC support. +01r,12jul95,ism added simsolaris support +01q,19mar95,dvs removed #ifdef TRON - tron no longer supported. +01p,02dec93,pme added Am29K family support +01o,11aug93,gae vxsim hppa. +01n,20jun93,gae vxsim. +01m,09jun93,hdn added support for I80X86 +01l,22sep92,rrr added support for c++ +01k,04jul92,jcf cleaned up. +01j,26may92,rrr the tree shuffle + -changed includes to have absolute path from h/ +01i,09jan92,jwt converted CPU==SPARC to CPU_FAMILY==SPARC. +01h,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01g,02Aug91,ajm included MIPS support +01f,19jul91,gae renamed architecture specific include file to be xx.h. +01e,29apr91,hdn added defines and macros for TRON architecture. +01d,25oct90,shl fixed CPU_FAMILY logic so 68k and sparc won't clash when + compiling for sparc. +01c,05oct90,shl added copyright notice. + made #endif ANSI style. +01b,28sep90,del added include i960/iv.h for I960 CPU_FAMILY. +01a,07aug89,gae written. +*/ + +#ifndef __INCivh +#define __INCivh + +#ifdef __cplusplus +extern "C" { +#endif + +#if CPU_FAMILY==I960 +#include "arch/i960/ivI960.h" +#endif /* CPU_FAMILY==I960 */ + +#if CPU_FAMILY==MC680X0 +#include "arch/mc68k/ivMc68k.h" +#endif /* CPU_FAMILY==MC680X0 */ + +#if CPU_FAMILY==COLDFIRE +#include "arch/coldfire/ivColdfire.h" +#endif /* CPU_FAMILY==COLDFIRE */ + +#if CPU_FAMILY==MIPS +#include "arch/mips/ivMips.h" +#endif /* CPU_FAMILY==MIPS */ + +#if CPU_FAMILY==PPC +#include "arch/ppc/ivPpc.h" +#endif /* CPU_FAMILY==PPC */ + +#if CPU_FAMILY==SIMLINUX +#include "arch/simlinux/ivSimlinux.h" +#endif /* CPU_FAMILY==SIMLINUX */ + +#if CPU_FAMILY==SIMNT +#include "arch/simnt/ivSimnt.h" +#endif /* CPU_FAMILY==SIMNT */ + +#if CPU_FAMILY==SIMSPARCSOLARIS +#include "arch/simsolaris/ivSimsolaris.h" +#endif /* CPU_FAMILY==SIMSPARCSOLARIS */ + +#if CPU_FAMILY==SPARC +#include "arch/sparc/ivSparc.h" +#endif /* CPU_FAMILY==SPARC */ + +#if CPU_FAMILY==I80X86 +#include "arch/i86/ivI86.h" +#endif /* CPU_FAMILY==I80X86 */ + +#if CPU_FAMILY==AM29XXX +#include "arch/am29k/ivAm29k.h" +#endif /* CPU_FAMILY==AM29XXX */ + +#if CPU_FAMILY==SH +#include "arch/sh/ivSh.h" +#endif /* CPU_FAMILY==SH */ + +#if CPU_FAMILY==ARM +#include "arch/arm/ivArm.h" +#endif /* CPU_FAMILY==ARM */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCivh */ diff --git a/h/kernelLib.h b/h/kernelLib.h new file mode 100644 index 0000000..8aed1c9 --- /dev/null +++ b/h/kernelLib.h @@ -0,0 +1,66 @@ +/* kernelLib.h - header file for kernelLib.c */ + +/* + * Copyright (c) 1990-1992, 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01h,31aug05,jln added kernelRoundRobinInstall() +01g,16aug05,jln remove roundRobinLib.h +01f,02aug05,jln Added WIND_SCHED_DESC struct +01e,22sep92,rrr added support for c++ +01d,04jul92,jcf cleaned up. +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01a,05oct90,shl created. +*/ + +#ifndef __INCkernelLibh +#define __INCkernelLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +/* typedefs */ + +/* kernel scheduer description structure */ + +typedef struct wind_sched_desc + { + Q_CLASS_ID readyQClassId; /* readyQ Id */ + void * readyQInitArg1; /* readyQ init arg 1 */ + void * readyQInitArg2; /* readyQ init arg 2 */ + } WIND_SCHED_DESC; + +/* extern */ + +extern WIND_SCHED_DESC vxKernelSchedDesc; /* kernel scheduler structure */ +extern BOOL roundRobinHookInstalled; /* flag shows round robin hooked */ +extern FUNCPTR _func_kernelRoundRobinHook;/* pointer to kernelRoundRobinHook */ + +/* function declarations */ + +extern char * kernelVersion (void); +extern STATUS kernelTimeSlice (int ticks); +extern void kernelInit (FUNCPTR rootRtn, unsigned rootMemSize, + char *pMemPoolStart, char *pMemPoolEnd, + unsigned intStackSize, int lockOutLevel); +extern STATUS kernelRoundRobinInstall (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCkernelLibh */ diff --git a/h/ledLib.h b/h/ledLib.h new file mode 100644 index 0000000..bbe96de --- /dev/null +++ b/h/ledLib.h @@ -0,0 +1,132 @@ +/* ledLib.h - header file for ledLib.c */ + +/* Copyright 1999-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01k,10nov03,bpn Added ledModeDefaultNameGet() and ledModeNameGet() prototypes. +01j,24oct03,bpn Added ledCompletionSet() and ledComplete() prototypes. +01i,23sep03,bpn Added LED_MODE_FUNCS structure and prototype of the + initialization functions for the vi and emacs mode style. +01h,29aug03,bpn Added ledHistoryLineAllocate(), ledHistoryFree(), + ledHistoryAdd(), ledHistAdd() prototypes. +01g,25jun03,bpn Added ledHistoryCreate(), ledHistoryClone() and + ledHistorySet() prototypes. +01f,28mar03,bpn Changed ledRead() declaration. +01e,20mar03,bpn Changed ledRegister() to ledModeRegister(). +01d,17mar03,lcs Add function declarations for new led registry functionality. +01c,14mar03,bpn Removed MAX_SHELL_LINE. Changed ledOpen() declaration. +01b,28feb03,lcs Port to host. +01a,17feb03,bpn Created from version "01c,26apr00,jmp" of the tor3_1 branch. +*/ + +#ifndef __INCledLibh +#define __INCledLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#ifndef HOST +#include +#else +#include +#endif + +#include + +/* defines */ + +#define STA_CHAR 0x01 /* go to the start of the line CTRL-A */ +#define LEFT_CHAR 0x02 /* move cursor back one char CTRL-B */ +#define CMP_CHAR 0x04 /* symbol name & path completion CTRL-D */ +#define SYN_CHAR 0x04 /* print synopsys of the function */ +#define END_CHAR 0x05 /* go to the end of the line CTRL-E */ +#define RIGHT_CHAR 0x06 /* move cursor foward one char CTRL-E */ +#define BEL_CHAR 0x07 /* bell */ +#define BKS_CHAR 0x08 /* Back Space char */ +#define DEN_CHAR 0x0b /* delete from cursor to the end CTRL-K */ +#define RDW_CHAR 0x0c /* redraw CTRL-L */ +#define DOWN_CHAR 0x0e /* Get next command in the history */ +#define UP_CHAR 0x10 /* Get previous command in the history */ +#define DLI_CHAR 0x15 /* delete line char CTRL-U */ +#define HTM_CHAR 0x17 /* ^W ask Web Browser to display help */ +#define ESC_CHAR 0x1b /* escape */ +#define BRK_CHAR 0x5b /* bracket [ (escape sequence) */ +#define RET_CHAR '\n' /* return */ +#define TAB_CHAR '\t' /* symbol name and path completion */ +#define NON_CHAR '?' /* non-printable char. representation */ + +#ifndef WIN32 +#define DEL_KEY 0x7f /* Del char (termcap=kD) */ +#define INS_KEY 0x32 /* Insert key */ +#define UP_KEY 0x41 /* Up key (termcap=ku) */ +#define DOWN_KEY 0x42 /* Down key (termcap=kd) */ +#define RIGHT_KEY 0x43 /* Right key (termcap=kr) */ +#define LEFT_KEY 0x44 /* Left key (termcap=kl) */ +#else /* WIN32 */ +#define BKS_KEY 0x08 /* Back Space */ +#define END_KEY 0x23 /* End key */ +#define HOME_KEY 0x24 /* Home key */ +#define LEFT_KEY 0x25 /* Left key */ +#define UP_KEY 0x26 /* Up key */ +#define RIGHT_KEY 0x27 /* Right key */ +#define DOWN_KEY 0x28 /* Down key */ +#define DEL_KEY 0x2e /* Del char */ +#endif /* WIN32 */ + +#ifdef HOST +#define REBOOT_CHAR 0x18 /* reboot charactere */ +#endif /* HOST */ + +/* Typedefs */ + +typedef struct /* LED_MODE_FUNCS */ + { + NODE node; + const char * ledModeName; /* led mode name */ + FUNCPTR ledModeReadFunc; /* read function */ + } LED_MODE_FUNCS; + +typedef struct led * LED_ID; +typedef struct ctx_hist * LED_HIST; + +/* Function Declarations */ + +IMPORT LED_ID ledOpen(int inFd, int outFd, int histSize); +IMPORT STATUS ledClose (LED_ID ledId); +IMPORT int ledRead (LED_ID ledId, char * string, UINT maxBytes); +IMPORT void ledControl (LED_ID ledId, int inFd, int outFd, int histSize); +IMPORT void ledHistAdd (LED_ID ledId, char * line); +IMPORT void ledCompletionSet (LED_ID ledId, FUNCPTR completionRtn); + +IMPORT LED_HIST ledHistoryCreate (UINT histSize, UINT lineSize); +IMPORT LED_HIST ledHistoryClone (LED_HIST history); +IMPORT void ledHistorySet (LED_ID ledId, LED_HIST history); +IMPORT STATUS ledHistoryLineAllocate (LED_HIST history, UINT lineSize); +IMPORT void ledHistoryFree (LED_HIST history); +IMPORT void ledHistoryAdd (LED_HIST history, char * line); + +IMPORT STATUS ledModeRegister (FUNCPTR ledModeInitFunc); +IMPORT STATUS ledModeSet (LED_ID ledId, const char * name); +IMPORT const char * ledModeDefaultNameGet (void); +IMPORT const char * ledModeNameGet (LED_ID ledId); + +/* Functions call at boot time */ + +IMPORT STATUS emacsLedLibInit (LED_MODE_FUNCS * pLedModeFuncs); +IMPORT STATUS viLedLibInit (LED_MODE_FUNCS * pLedModeFuncs); + +/* Functions available for the different LED mode modules */ + +IMPORT STATUS ledComplete (LED_ID ledId, char * line, UINT lineSize, + UINT * pCursorPos, char completionChar); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCledLibh */ diff --git a/h/limits.h b/h/limits.h new file mode 100644 index 0000000..9cd3134 --- /dev/null +++ b/h/limits.h @@ -0,0 +1,90 @@ +/* limits.h - limits header file */ + +/* + * Copyright (c) 1992-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01l,02aug05,kk added DELAYTIMER_MAX +01k,04jul05,hya Added more macros. +01j,01mar05,gls added _POSIX macros definitins from time.h (SPR #105358) +01i,05may04,pad set NGROUPS_MAX and SSIZE_MAX to, respectively, + _POSIX_NGROUPS_MAX and _POSIX_SSIZE_MAX (SPR 94100). +01h,07dec01,sn use toolchain specific limits.h +01g,01may94,kdl added missing mod hist for 01f. +01f,06dec93,dvs added POSIX AIO defines. +01e,24sep92,smb removed POSIX ifdef. +01d,22sep92,rrr added support for c++ +01c,04jul92,jcf cleaned up. +01b,03jul92,smb merged ANSI limits +01a,29jul91,rrr written. +*/ + +#ifndef __INClimitsh +#define __INClimitsh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types/vxANSI.h" + +/* include the toolchain's notion of limits.h */ +#ifndef TOOL_FAMILY +# define TOOL_FAMILY gnu +#endif + +#define _TOOL_HDR_STRINGIFY(x) #x +#define _TOOL_HDR(tc, file) _TOOL_HDR_STRINGIFY(tool/tc/file) +#define _TOOL_HEADER(file) _TOOL_HDR(TOOL_FAMILY,file) + +#include _TOOL_HEADER(limits.h) + +#define NGROUPS_MAX _POSIX_NGROUPS_MAX /* POSIX extensions */ +#define SSIZE_MAX _POSIX_SSIZE_MAX +#define DATAKEYS_MAX _PARM_DATAKEYS_MAX +#define AIO_LISTIO_MAX 10 /* needs _PARM in types/vxParams.h */ +#define AIO_PRIO_DELTA_MAX 254 /* needs _PARM in types/vxParams.h */ + +#define _POSIX_AIO_LISTIO_MAX 2 +#define _POSIX_AIO_MAX 1 +#define _POSIX_ARG_MAX 4096 +#define _POSIX_CHILD_MAX 6 +#define _POSIX_CLOCKRES_MIN 20 +#define _POSIX_DELAYTIMER_MAX 32 +#define _POSIX_LINK_MAX 8 +#define _POSIX_MAX_CANON 255 +#define _POSIX_MAX_INPUT 255 +#define _POSIX_NAME_MAX 14 +#define _POSIX_NGROUPS_MAX 0 +#define _POSIX_OPEN_MAX 16 +#define _POSIX_PATH_MAX 255 +#define _POSIX_PIPE_BUF 512 +#define _POSIX_SSIZE_MAX 32767 +#define _POSIX_STREAM_MAX 8 +#define _POSIX_TIMER_MAX 32 +#define _POSIX_TZNAME_MAX 3 +#define _POSIX_DATAKEYS_MAX 16 + +#define FILESIZEBITS 63 /* max bits to represent file size */ +#define NAME_MAX _PARM_NAME_MAX /* max filename length excluding EOS */ +#define PATH_MAX _PARM_PATH_MAX /* max pathname length excluding EOS */ +#define SYMLINK_MAX 0 /* max symbolic link to a file */ +#define MAX_CANON _POSIX_MAX_CANON /* max bytes in line in tty line mode */ +#define MAX_INPUT _POSIX_MAX_INPUT /* max size of a tty char input buffer */ +#define LINK_MAX _POSIX_LINK_MAX /* max # of links to a single file */ +#define PIPE_BUF -1 /* max # bytes atomic in write to a pipe */ + +#define DELAYTIMER_MAX _POSIX_DELAYTIMER_MAX /* required by POSIX */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INClimitsh */ diff --git a/h/loadAoutLib.h b/h/loadAoutLib.h new file mode 100644 index 0000000..0df56a8 --- /dev/null +++ b/h/loadAoutLib.h @@ -0,0 +1,45 @@ +/* loadAoutLib.h - a.out object module loader library header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01b,22sep92,rrr added support for c++ +01a,18jun92,ajm written for object module independant loadLib +*/ + +#ifndef __INCloadAoutLibh +#define __INCloadAoutLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "symLib.h" + + +/* status codes */ + +#define S_loadAoutLib_TOO_MANY_SYMBOLS (M_loadAoutLib | 1) + +/* function declarations */ + + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS loadAoutInit (); +extern STATUS bootAoutInit (); + +#else /* __STDC__ */ + +extern STATUS loadAoutInit (); +extern STATUS bootAoutInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCloadAoutLibh */ diff --git a/h/loadCoffLib.h b/h/loadCoffLib.h new file mode 100644 index 0000000..ccc04cd --- /dev/null +++ b/h/loadCoffLib.h @@ -0,0 +1,611 @@ +/* loadCoffLib.h - coff object module header */ + +/* Copyright 1984-1998 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01m,10jul98,cdp added ARM endian flags. +01l,24oct97,cdp added more Thumb relocation types and status code + S_loadLib_NO_RELOCATION_ROUTINE. +01k,12jun97,cdp added ARM R_RELTHUMB23 and Thumb storage classes. + removed unused RVA32 relocation type. +01j,28nov96,cdp added ARM support. +01i,11mar94,pme added bootCoffInit() prototype (SPR# 2947). +01h,09jul93,pme added Am29K family support. +01g,22sep92,rrr added support for c++ +01f,18sep92,jcf removed nested comment. +01e,11sep92,ajm changed OFFSET_MASK to OFFSET24_MASK due to b.out redefines, + fixed #ifndef define +01d,29jul92,rrr removed moduleLib.h if no CPU is defined. +01c,28jul92,jmm removed CPU_FAMILY = I960 ifdefs + changed return of ldCoffModAtSym to MODULE_ID +01b,17jul92,rrr added extern to functions. +01a,21may92,wmd received from Intel. + +*/ + +#ifndef __INCloadCoffLibh +#define __INCloadCoffLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef CPU +#include "symLib.h" +#include "moduleLib.h" +#endif + +/****************************************************************************** + * + * This file describes a COFF object file. + * + ******************************************************************************/ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/******************************* FILE HEADER *******************************/ + +struct filehdr { + unsigned short f_magic; /* magic number */ + unsigned short f_nscns; /* number of sections */ + long f_timdat; /* time & date stamp */ + long f_symptr; /* file pointer to symtab */ + long f_nsyms; /* number of symtab entries */ + unsigned short f_opthdr; /* sizeof(optional hdr) */ + unsigned short f_flags; /* flags */ +}; + + +/* Bits for f_flags: + * F_RELFLG relocation info stripped from file + * F_EXEC file is executable (no unresolved external references) + * F_LNNO line numbers stripped from file + * F_LSYMS local symbols stripped from file + * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax) + * F_PIC file contains position-independent code + * F_PID file contains position-independent data + * F_LINKPID file is suitable for linking w/pos-indep code or data + */ +#define F_RELFLG 0x0001 +#define F_EXEC 0x0002 +#define F_LNNO 0x0004 +#define F_LSYMS 0x0008 +#if (CPU_FAMILY == ARM) +#define F_AR32WR 0x0100 /* file is 32-bit little-endian */ +#define F_AR32W 0x0200 /* file is 32-bit big-endian */ +#else +#define F_AR32WR 0x0010 +#endif +#define F_PIC 0x0040 +#define F_PID 0x0080 +#define F_LINKPID 0x0100 + +#define F_CCINFO 0x0800 + /* FOR GNU/960 VERSION ONLY! + * + * Set only if cc_info data (for 2-pass compiler optimization) is + * appended to the end of the object file. + * + * Since cc_info data is removed when a file is stripped, we can assume + * that its presence implies the presence of a symbol table in the file, + * with the cc_info block immediately following. + * + * A COFF symbol table does not necessarily require a string table. + * When cc_info is present we separate it from the symbol info with a + * delimiter word of 0xfffffff, which simplifies testing for presence + * of a string table: if the word following the symbol table is not + * 0xffffffff, it is the string table length; the string table must be + * skipped over before the delimiter (and cc_info) can be read. + * + * The format/meaning of the cc_data block are known only to the + * compiler (and, to a lesser extent, the linker) except for the first + * 4 bytes, which contain the length of the block (including those 4 + * bytes). This length is stored in a machine-independent format, and + * can be retrieved with the CI_U32_FM_BUF macro in cc_info.h . + */ + + +/* Intel 80960 (I960) processor flags. + * F_I960TYPE == mask for processor type field. + */ +#define F_I960TYPE 0xf000 +#define F_I960CORE 0x1000 +#define F_I960KB 0x2000 +#define F_I960SB 0x2000 +#define F_I960MC 0x3000 +#define F_I960XA 0x4000 +#define F_I960CA 0x5000 +#define F_I960KA 0x6000 +#define F_I960SA 0x6000 + +/* + * i80960 Magic Numbers + */ +#define I960ROMAGIC 0x160 /* read-only text segments */ +#define I960RWMAGIC 0x161 /* read-write text segments */ + +#define I960BADMAG(x) (((x).f_magic!=I960ROMAGIC) && ((x).f_magic!=I960RWMAGIC)) + +/* + * Am29K Magic Numbers + */ +#define AM29KBIGMAGIC 0572 /* Am29K big endian */ +#define AM29KLITTLEMAGIC 0573 /* Am29K little endian */ + +#define AM29KBADMAG(x) (((x).f_magic!=AM29KBIGMAGIC) && \ + ((x).f_magic!=AM29KLITTLEMAGIC)) + +/* + * ARM Magic Number + */ +#define ARMMAGIC 0xa00 + + +#define FILHDR struct filehdr +#define FILHSZ sizeof(FILHDR) + +#undef N_TXTOFF /* undefined for a.out overlap */ +#define N_TXTOFF(f) \ + ((f).f_opthdr == 0) ? \ + (FILHSZ + (f).f_nscns * SCNHSZ ) : \ + (FILHSZ + AOUTSZ + (f).f_nscns * SCNHSZ ) + +/************************* AOUT "OPTIONAL HEADER" *************************/ + +#define OMAGIC 0407 +#define NMAGIC 0410 + +typedef struct aouthdr { + short magic; /* type of file */ + short vstamp; /* version stamp */ + unsigned long tsize; /* text size in bytes, padded to FW bdry*/ + unsigned long dsize; /* initialized data " " */ + unsigned long bsize; /* uninitialized data " " */ + unsigned long entry; /* entry pt. */ + unsigned long text_start; /* base of text used for this file */ + unsigned long data_start; /* base of data used for this file */ +#if (CPU_FAMILY == I960) + unsigned long tagentries; /* number of tag entries to follow */ + /* ALWAYS 0 FOR 960 */ +#endif /* (CPU_FAMILY == I960) */ +} AOUTHDR; + +#define AOUTSZ (sizeof(AOUTHDR)) + + +/****************************** SECTION HEADER ******************************/ + +struct scnhdr { + char s_name[8]; /* section name */ + long s_paddr; /* physical address, aliased s_nlib */ + long s_vaddr; /* virtual address */ + long s_size; /* section size */ + long s_scnptr; /* file ptr to raw data for section */ + long s_relptr; /* file ptr to relocation */ + long s_lnnoptr; /* file ptr to line numbers */ + unsigned short s_nreloc; /* number of relocation entries */ + unsigned short s_nlnno; /* number of line number entries*/ + long s_flags; /* flags */ +#if (CPU_FAMILY == I960) + unsigned long s_align; /* section alignment */ +#endif /* (CPU_FAMILY == I960) */ +}; + +/* + * names of "special" sections + */ +#define _TEXT ".text" +#define _DATA ".data" +#define _BSS ".bss" + +/* + * s_flags "type" + */ + /* TYPE ALLOCATED? RELOCATED? LOADED? */ + /* ---- ---------- ---------- ------- */ +#define STYP_REG 0x0000 /* regular yes yes yes */ +#define STYP_DSECT 0x0001 /* dummy no yes no */ +#define STYP_NOLOAD 0x0002 /* noload yes yes no */ +#define STYP_GROUP 0x0004 /* grouped */ +#define STYP_PAD 0x0008 /* padding no no yes */ +#define STYP_COPY 0x0010 /* copy no no yes */ +#define STYP_INFO 0x0200 /* comment no no no */ + +#define STYP_TEXT 0x0020 /* section contains text */ +#define STYP_DATA 0x0040 /* section contains data */ +#define STYP_BSS 0x0080 /* section contains bss */ +#define STYP_LIT 0x8000 /* section contains literal */ + +/* + * additional section type for global registers which will + * be relocatable for the Am29K. + */ +#define STYP_BSSREG 0x1200 /* Global register area (like STYP_INFO) */ +#define STYP_ENVIR 0x2200 /* Environment (like STYP_INFO) */ +#define STYP_ABS 0x4000 /* Absolute (allocated, not reloc, loaded) */ + +#define SCNHDR struct scnhdr +#define SCNHSZ sizeof(SCNHDR) + + +/******************************* LINE NUMBERS *******************************/ + +/* 1 line number entry for every "breakpointable" source line in a section. + * Line numbers are grouped on a per function basis; first entry in a function + * grouping will have l_lnno = 0 and in place of physical address will be the + * symbol table index of the function name. + */ +struct lineno{ + union { + long l_symndx; /* function name symbol index, iff l_lnno == 0*/ + long l_paddr; /* (physical) address of line number */ + } l_addr; + unsigned short l_lnno; /* line number */ + char padding[2]; /* force alignment */ +}; + +#define LINENO struct lineno +#define LINESZ sizeof(LINENO) + + +/********************************** SYMBOLS **********************************/ + +#define SYMNMLEN 8 /* # characters in a symbol name */ +#define FILNMLEN 14 /* # characters in a file name */ +#define DIMNUM 4 /* # array dimensions in auxiliary entry */ + +#if (CPU_FAMILY == I960) +struct syment { + union { + char _n_name[SYMNMLEN]; /* old COFF version */ + struct { + long _n_zeroes; /* new == 0 */ + long _n_offset; /* offset into string table */ + } _n_n; + char *_n_nptr[2]; /* allows for overlaying */ + } _n; + long n_value; /* value of symbol */ + short n_scnum; /* section number */ + unsigned short n_flags; /* copy of flags from filhdr */ + unsigned long n_type; /* type and derived type */ + char n_sclass; /* storage class */ + char n_numaux; /* number of aux. entries */ + char pad2[2]; /* force alignment */ +}; + +#define SYMENT struct syment +#define SYMESZ sizeof(SYMENT) +#else /* (CPU_FAMILY == I960) */ + +struct syment { + union { + char _n_name[SYMNMLEN]; /* old COFF version */ + struct { + long _n_zeroes; /* new == 0 */ + long _n_offset; /* offset into string table */ + } _n_n; + char *_n_nptr[2]; /* allows for overlaying */ + } _n; + long n_value; /* value of symbol */ + short n_scnum; /* section number */ + unsigned short n_type; /* type and derived type */ + char n_sclass; /* storage class */ + char n_numaux; /* number of aux. entries */ +}; + +#define SYMENT struct syment +#define SYMESZ sizeof(SYMENT) /* don't use sizeof since some compilers */ + /* may add padding in the structure */ +#endif /* (CPU_FAMILY == I960) */ + +#define n_name _n._n_name +#define n_ptr _n._n_nptr[1] +#define n_zeroes _n._n_n._n_zeroes +#define n_offset _n._n_n._n_offset + + +/* + * Relocatable symbols have number of the section in which they are defined, + * or one of the following: + */ +#define N_UNDEF ((short)0) /* undefined symbol */ +#define N_ABS ((short)-1) /* value of symbol is absolute */ +#define N_DEBUG ((short)-2) /* debugging symbol -- value is meaningless */ +#define N_TV ((short)-3) /* indicates symbol needs preload transfer vector */ +#define P_TV ((short)-4) /* indicates symbol needs postload transfer vector*/ + +/* + * Symbol storage classes + */ +#define C_EFCN -1 /* physical end of function */ +#define C_NULL 0 +#define C_AUTO 1 /* automatic variable */ +#define C_EXT 2 /* external symbol */ +#define C_STAT 3 /* static */ +#define C_REG 4 /* register variable */ +#define C_EXTDEF 5 /* external definition */ +#define C_LABEL 6 /* label */ +#define C_ULABEL 7 /* undefined label */ +#define C_MOS 8 /* member of structure */ +#define C_ARG 9 /* function argument */ +#define C_STRTAG 10 /* structure tag */ +#define C_MOU 11 /* member of union */ +#define C_UNTAG 12 /* union tag */ +#define C_TPDEF 13 /* type definition */ +#define C_USTATIC 14 /* undefined static */ +#define C_ENTAG 15 /* enumeration tag */ +#define C_MOE 16 /* member of enumeration */ +#define C_REGPARM 17 /* register parameter */ +#define C_FIELD 18 /* bit field */ +#if (CPU_FAMILY == AM29XXX) +#define C_GLBLREG 19 /* global register */ +#define C_EXTREG 20 /* external global register */ +#define C_DEFREG 21 /* ext. def. of global register */ +#else /* (CPU_FAMILY == AM29XXX) */ +#define C_AUTOARG 19 /* auto argument */ +#endif /* (CPU_FAMILY == AM29XXX) */ +#define C_BLOCK 100 /* ".bb" or ".eb" */ +#define C_FCN 101 /* ".bf" or ".ef" */ +#define C_EOS 102 /* end of structure */ +#define C_FILE 103 /* file name */ +#define C_LINE 104 /* line # reformatted as symbol table entry */ +#define C_ALIAS 105 /* duplicate tag */ +#define C_HIDDEN 106 /* ext symbol in dmert public lib */ +#define C_SCALL 107 /* Procedure reachable via system call */ +#define C_LEAFEXT 108 /* Global leaf procedure, "call" via BAL */ +#define C_LEAFSTAT 113 /* Static leaf procedure, "call" via BAL */ +#if (CPU_FAMILY == ARM) +#define C_THUMBEXT (128 | C_EXT) +#define C_THUMBSTAT (128 | C_STAT) +#define C_THUMBLABEL (128 | C_LABEL) +#define C_THUMBEXTFUNC (C_THUMBEXT + 20) +#define C_THUMBSTATFUNC (C_THUMBSTAT + 20) +#endif + + +/* + * Type of a symbol, in low 5 bits of n_type + */ +#define T_NULL 0 +#define T_VOID 1 /* function argument (only used by compiler) */ +#define T_CHAR 2 /* character */ +#define T_SHORT 3 /* short integer */ +#define T_INT 4 /* integer */ +#define T_LONG 5 /* long integer */ +#define T_FLOAT 6 /* floating point */ +#define T_DOUBLE 7 /* double word */ +#define T_STRUCT 8 /* structure */ +#define T_UNION 9 /* union */ +#define T_ENUM 10 /* enumeration */ +#define T_MOE 11 /* member of enumeration*/ +#define T_UCHAR 12 /* unsigned character */ +#define T_USHORT 13 /* unsigned short */ +#define T_UINT 14 /* unsigned integer */ +#define T_ULONG 15 /* unsigned long */ +#define T_LNGDBL 16 /* long double */ + +/* + * derived types, in n_type + */ +#define DT_NON 0 /* no derived type */ +#define DT_PTR 1 /* pointer */ +#define DT_FCN 2 /* function */ +#define DT_ARY 3 /* array */ + +#if (CPU_FAMILY == AM29XXX) || (CPU_FAMILY == ARM) +#define N_BTMASK 0xf +#define N_TMASK 0x30 +#define N_BTSHFT 4 +#define N_TSHIFT 2 +#else /* (CPU_FAMILY == AM29XXX) */ +#define N_BTMASK 0x1f +#define N_TMASK 0x60 +#define N_BTSHFT 5 +#define N_TSHIFT 2 +#endif /* (CPU_FAMILY == AM29XXX) */ + +#define BTYPE(x) ((x) & N_BTMASK) + +#define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT)) +#define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT)) +#define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT)) +#define ISTAG(x) ((x)==C_STRTAG||(x)==C_UNTAG||(x)==C_ENTAG) + + +#define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK)) + +union auxent { + struct { + long x_tagndx; /* str, un, or enum tag indx */ + union { + struct { + unsigned short x_lnno; /* declaration line number */ + unsigned short x_size; /* str/union/array size */ + } x_lnsz; + long x_fsize; /* size of function */ + } x_misc; + union { + struct { /* if ISFCN, tag, or .bb */ + long x_lnnoptr; /* ptr to fcn line # */ + long x_endndx; /* entry ndx past block end */ + } x_fcn; + struct { /* if ISARY, up to 4 dimen. */ + unsigned short x_dimen[DIMNUM]; + } x_ary; + } x_fcnary; + unsigned short x_tvndx; /* tv index */ + } x_sym; + + union { + char x_fname[FILNMLEN]; + struct { + long x_zeroes; + long x_offset; + } x_n; + } x_file; + + struct { + long x_scnlen; /* section length */ + unsigned short x_nreloc; /* # relocation entries */ + unsigned short x_nlinno; /* # line numbers */ + } x_scn; + + struct { + long x_tvfill; /* tv fill value */ + unsigned short x_tvlen; /* length of .tv */ + unsigned short x_tvran[2]; /* tv range */ + } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ + +#if (CPU_FAMILY == I960) + /****************************************** + * I960-specific *2nd* aux. entry formats + ******************************************/ + struct { + long x_stindx; /* sys. table entry */ + } x_sc; /* system call entry */ + + struct { + unsigned long x_balntry; /* BAL entry point */ + } x_bal; /* BAL-callable function */ + + struct { + unsigned long x_timestamp; /* time stamp */ + char x_idstring[20]; /* producer identity string */ + } x_ident; /* Producer ident info */ + + char a[sizeof(struct syment)]; /* force auxent/syment sizes to match */ +#endif /* (CPU_FAMILY == I960) */ +}; + +#define AUXENT union auxent +#define AUXESZ sizeof(AUXENT) + +#define _ETEXT "_etext" + +/********************** RELOCATION DIRECTIVES **********************/ + +struct reloc { + long r_vaddr; /* Virtual address of reference */ + long r_symndx; /* Index into symbol table */ + unsigned short r_type; /* Relocation type */ +#if (CPU_FAMILY == I960) + char pad[2]; /* Unused */ +#elif (CPU_FAMILY == ARM) + char pad[4]; /* Unused */ +#endif +}; + +/* Only values of r_type GNU/960 cares about */ +#define R_RELLONG 17 /* Direct 32-bit relocation */ +#define R_IPRMED 25 /* 24-bit ip-relative relocation */ +#define R_OPTCALL 27 /* 32-bit optimizable call (leafproc/sysproc) */ +#define R_OPTCALLX 28 /* 64-bit optimizable call (leafproc/sysproc) */ + +/* Only values of r_type GNU/29k cares about */ +#define R_ABS 0 /* reference is absolute */ + +#define R_IREL 030 /* instruction relative (jmp/call) */ +#define R_IABS 031 /* instruction absolute (jmp/call) */ +#define R_ILOHALF 032 /* instruction low half (const) */ +#define R_IHIHALF 033 /* instruction high half (consth) part 1 */ +#define R_IHCONST 034 /* instruction high half (consth) part 2 */ + /* constant offset of R_IHIHALF relocation */ +#define R_BYTE 035 /* relocatable byte value */ +#define R_HWORD 036 /* relocatable halfword value */ +#define R_WORD 037 /* relocatable word value */ + +#define R_IGLBLRC 040 /* instruction global register RC */ +#define R_IGLBLRA 041 /* instruction global register RA */ +#define R_IGLBLRB 042 /* instruction global register RB */ + +/* values of r_type for GNU/ARM */ +#define R_RELBYTE 0x00 /* byte relative */ +#define R_RELWORD 0x01 /* word relative */ +#define R_RELARMLONG 0x02 /* long relative */ +#define R_RELARM26 0x03 /* 26-bit relative */ +#define R_DONEARM26 0x07 /* already allocated */ +#define R_RELTHUMB9 0x0c /* 9 bit PC-relative */ +#define R_RELTHUMB12 0x0d /* 12 bit PC-relative */ +#define R_RELTHUMB23 0x0e /* 23 bit PC-relative */ +#define R_DONETHUMB23 0x0f /* Completed 23 bit PC-relative */ + + +#define RELOC struct reloc +#define RELSZ sizeof(RELOC) + +#define SYMS_ABSOLUTE 2 /* to flag absolute symbols */ +#define BAL_ENTRY 0x10 /* I80960 BAL entry point to function */ +#define OFFSET24_MASK 0x00ffffff /* mask for 24bit offsets */ +#define BAL_OPCODE 0x0b000000 /* opcode for branch and link */ +#define BALXG14_OPCODE 0x85f03000 /* opcode for balx absolute addr, g14 */ +#define CALL_OPCODE 0x09000000 /* opcode for call instruction */ +#define B_OPCODE 0x08000000 /* opcode for branch instruction */ +#define CALLS_OPCODE 0x66000000 /* opcode for calls instruction */ + +/* 29K instructions */ + +#define ASSERT_OPCODE 0x50000000 /* opcode for assert except eq, neq */ +#define ASEQ_OPCODE 0x70000000 /* opcode for assert eq */ +#define ASNEQ_OPCODE 0x72000000 /* opcode for assert neq */ +#define EMULATE_OPCODE 0xd7000000 /* opcode for emulate */ + +#define REG_MASK 0xff /* register bits in opcode */ +#define REG_A_OFFSET 8 /* offset for register A in opcode */ +#define REG_B_OFFSET 0 /* offset for register B in opcode */ +#define REG_C_OFFSET 16 /* offset for register C in opcode */ + +/* status codes */ + +#define S_loadLib_FILE_READ_ERROR (M_loadCoffLib | 1) +#define S_loadLib_REALLOC_ERROR (M_loadCoffLib | 2) +#define S_loadLib_JMPADDR_ERROR (M_loadCoffLib | 3) +#define S_loadLib_NO_REFLO_PAIR (M_loadCoffLib | 4) +#define S_loadLib_GPREL_REFERENCE (M_loadCoffLib | 5) +#define S_loadLib_UNRECOGNIZED_RELOCENTRY (M_loadCoffLib | 6) +#define S_loadLib_REFHALF_OVFL (M_loadCoffLib | 7) +#define S_loadLib_FILE_ENDIAN_ERROR (M_loadCoffLib | 8) +#define S_loadLib_UNEXPECTED_SYM_CLASS (M_loadCoffLib | 9) +#define S_loadLib_UNRECOGNIZED_SYM_CLASS (M_loadCoffLib | 10) +#define S_loadLib_HDR_READ (M_loadCoffLib | 11) +#define S_loadLib_OPTHDR_READ (M_loadCoffLib | 12) +#define S_loadLib_SCNHDR_READ (M_loadCoffLib | 13) +#define S_loadLib_READ_SECTIONS (M_loadCoffLib | 14) +#define S_loadLib_LOAD_SECTIONS (M_loadCoffLib | 15) +#define S_loadLib_RELOC_READ (M_loadCoffLib | 16) +#define S_loadLib_SYMHDR_READ (M_loadCoffLib | 17) +#define S_loadLib_EXTSTR_READ (M_loadCoffLib | 18) +#define S_loadLib_EXTSYM_READ (M_loadCoffLib | 19) +#define S_loadLib_NO_RELOCATION_ROUTINE (M_loadCoffLib | 20) + + +/* function declarations */ + +#ifdef CPU +#if defined(__STDC__) || defined(__cplusplus) +extern STATUS loadCoffInit (); +extern STATUS bootCoffInit (); +extern MODULE_ID ldCoffModAtSym (int fd, int symFlag, char **ppText, + char **ppData, char **ppBss, SYMTAB_ID symTbl); + +#else /* __STDC__ */ +extern STATUS loadCoffInit (); +extern STATUS bootCoffInit (); +extern MODULE_ID ldCoffModAtSym (); + +#endif /* __STDC__ */ +#endif + + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCloadCoffLibh */ diff --git a/h/loadEcoffComm.h b/h/loadEcoffComm.h new file mode 100644 index 0000000..892dfa8 --- /dev/null +++ b/h/loadEcoffComm.h @@ -0,0 +1,54 @@ +/* loadEcoffComm.h - UNIX ECOFF object module common library header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01c,22sep92,rrr added support for c++ +01b,23jul92,jmm added include of ecoff.h +01a,23jul92,ajm created +*/ + +#ifndef __INCloadEcoffCommh +#define __INCloadEcoffCommh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "ecoff.h" + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void swapCoffoptHdr (AOUTHDR *pOptHdr); + +extern void swapCoffhdr (FILHDR *pHdr); + +extern STATUS ecoffHdrRead (int fd, FILHDR *pHdr, BOOL *pSwap); + +extern STATUS ecoffOpthdrRead (int fd, AOUTHDR *pOptHdr, FILHDR *pHdr, + BOOL swapTables); + +extern void swabLong ( char input[], char output[] ); + +#else /* __STDC__ */ + +extern void swapCoffoptHdr (); + +extern void swapCoffhdr (); + +extern STATUS ecoffHdrRead (); + +extern STATUS ecoffOpthdrRead (); + +extern void swabLong (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCloadEcoffCommh */ diff --git a/h/loadEcoffLib.h b/h/loadEcoffLib.h new file mode 100644 index 0000000..9228a75 --- /dev/null +++ b/h/loadEcoffLib.h @@ -0,0 +1,59 @@ +/* loadEcoffLib.h - object module dependant loader library header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01c,22sep92,rrr added support for c++ +01b,12sep92,ajm got rid of bootEcoffInit prototype +01a,27may92,ajm written +*/ + +#ifndef __INCloadEcoffLibh +#define __INCloadEcoffLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "symLib.h" + +/* status codes */ + +#define S_loadEcoffLib_HDR_READ (M_loadEcoffLib | 1) +#define S_loadEcoffLib_OPTHDR_READ (M_loadEcoffLib | 2) +#define S_loadEcoffLib_SCNHDR_READ (M_loadEcoffLib | 3) +#define S_loadEcoffLib_READ_SECTIONS (M_loadEcoffLib | 4) +#define S_loadEcoffLib_LOAD_SECTIONS (M_loadEcoffLib | 5) +#define S_loadEcoffLib_RELOC_READ (M_loadEcoffLib | 6) +#define S_loadEcoffLib_SYMHDR_READ (M_loadEcoffLib | 7) +#define S_loadEcoffLib_EXTSTR_READ (M_loadEcoffLib | 8) +#define S_loadEcoffLib_EXTSYM_READ (M_loadEcoffLib | 9) +#define S_loadEcoffLib_GPREL_REFERENCE (M_loadEcoffLib | 10) +#define S_loadEcoffLib_JMPADDR_ERROR (M_loadEcoffLib | 11) +#define S_loadEcoffLib_NO_REFLO_PAIR (M_loadEcoffLib | 12) +#define S_loadEcoffLib_UNRECOGNIZED_RELOCENTRY (M_loadEcoffLib | 13) +#define S_loadEcoffLib_REFHALF_OVFL (M_loadEcoffLib | 14) +#define S_loadEcoffLib_UNEXPECTED_SYM_CLASS (M_loadEcoffLib | 15) +#define S_loadEcoffLib_UNRECOGNIZED_SYM_CLASS (M_loadEcoffLib | 16) +#define S_loadEcoffLib_FILE_READ_ERROR (M_loadEcoffLib | 17) +#define S_loadEcoffLib_FILE_ENDIAN_ERROR (M_loadEcoffLib | 18) + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS loadEcoffInit (); + +#else /* __STDC__ */ + +extern STATUS loadEcoffInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCloadEcoffLibh */ diff --git a/h/loadElfLib.h b/h/loadElfLib.h new file mode 100644 index 0000000..0ab06f0 --- /dev/null +++ b/h/loadElfLib.h @@ -0,0 +1,100 @@ +/* loadElfLib.h - ELF-specific loader library header */ + +/* + * Copyright (c) 1996-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software may be + * licensed only pursuant to the terms of an applicable Wind River license + * agreement. + */ + +/* +modification history +-------------------- +01g,16aug05,jeg Fixed build and DLL load failure +01f,25jul05,v_r Updated copyright. +01e,31mar05,v_r Fixed SPR #98274 (loader backward compatibility errno + review). +01d,17sep04,jn Move towards shared files +01c,05apr04,jn Clean up - remove unused declarations and + development-related comments +01b,05sep01,jn changing ARM to ELF and created loadElfLibP.h - + moved utility macros and private type and structure + definitions to loadElfLibP.h +01a,20jun96,dbt written from /host/include/loadelf.h v01c + and /host/include/elfppc.h v01c +*/ + +#ifndef __INCloadElfLibh +#define __INCloadElfLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HOST +#else +#include "vwModNum.h" +#endif /* HOST */ + +#include "elf.h" + +#include "private/loadElfLibP.h" + +/* Defines */ + +#define MAX_SEC_LEN 256 + +/* status codes */ + +#define S_loadElfLib_HDR_READ (M_loadElfLib | 1) +#define S_loadElfLib_HDR_ERROR (M_loadElfLib | 2) +#define S_loadElfLib_PHDR_MALLOC (M_loadElfLib | 3) /* obsoleted */ +#define S_loadElfLib_PHDR_READ (M_loadElfLib | 4) /* obsoleted */ +#define S_loadElfLib_SHDR_MALLOC (M_loadElfLib | 5) /* obsoleted */ +#define S_loadElfLib_SHDR_READ (M_loadElfLib | 6) +#define S_loadElfLib_READ_SECTIONS (M_loadElfLib | 7) +#define S_loadElfLib_LOAD_SECTIONS (M_loadElfLib | 8) /* obsoleted */ +#define S_loadElfLib_LOAD_PROG (M_loadElfLib | 9) /* obsoleted */ +#define S_loadElfLib_SYMTAB (M_loadElfLib | 10) /* obsoleted */ +#define S_loadElfLib_RELA_SECTION (M_loadElfLib | 11) +#define S_loadElfLib_SCN_READ (M_loadElfLib | 12) /* obsoleted */ +#define S_loadElfLib_SDA_MALLOC (M_loadElfLib | 13) /* obsoleted */ +#define S_loadElfLib_SST_READ (M_loadElfLib | 15) /* obsoleted */ + +#define S_loadElfLib_JMPADDR_ERROR (M_loadElfLib | 20) /* obsoleted */ +#define S_loadElfLib_GPREL_REFERENCE (M_loadElfLib | 21) /* obsoleted */ +#define S_loadElfLib_UNRECOGNIZED_RELOCENTRY (M_loadElfLib | 22) +#define S_loadElfLib_RELOC (M_loadElfLib | 23) +#define S_loadElfLib_UNSUPPORTED (M_loadElfLib | 24) +#define S_loadElfLib_REL_SECTION (M_loadElfLib | 25) + +#define S_loadElfLib_INVALID_ARGUMENT (M_loadElfLib | 27) +#define S_loadElfLib_RELOCATION_OFFSET_TOO_LARGE (M_loadElfLib | 28) +#define S_loadElfLib_RELOCATION_UNIT_NOT_INSTALLED (M_loadElfLib | 29) + +/* function declarations */ + +#ifdef HOST +extern DLL_EXPORT STATUS loadElfInit (void); +/* + * These funcs are called through function pointers to make it possible to + * support architecture relocation units that can be loaded or unloaded by a + * single target server (since the loader code is shared between the host and + * target). + */ + +extern BOOL (* pElfArchVerify) (UINT32); + +extern STATUS (* pElfArchReloc) (BOOL, LOAD_MODULE_INFO *, Elf32_Shdr *, + SCN_ADRS, INT64, SYM_INFO_TBL); + +#else +extern STATUS loadElfInit (void); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCloadElfLibh */ diff --git a/h/loadLib.h b/h/loadLib.h new file mode 100644 index 0000000..87520db --- /dev/null +++ b/h/loadLib.h @@ -0,0 +1,123 @@ +/* loadLib.h - object module loader library header */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software may be + * licensed only pursuant to the terms of an applicable Wind River license + * agreement. + */ + +/* +modification history +-------------------- +02b,25jul05,v_r Updated copyright. +02a,18mar05,v_r Fixed SPR #98274 (loader errno backward compatibility + review). + Includes cleanups. +01z,01mar05,v_r Moved pLoadRoutine() prototype to loadLibP.h. +01y,18sep04,jn Move toward shared code on host and target +01x,08jun04,jn Rename generic errno string +01w,05apr04,jn Clean up - remove unused declarations and development-related + comments +01v,08may02,fmk - add LOAD_COMMON flags + - move non-public declarations for loadModuleAtSym(), + loadModuleGet(),addSegNames() and loadSegmentsAllocate() + to loadLibP.h +01u,30oct96,elp Added LOAD_LOADED_BY_TGTSVR flag + syncLoadRtn function + pointer. +01t,01oct96,elp added LOAD_MODULE_INFO_ONLY flag (SPR# 6775). +01s,22sep92,rrr added support for c++ +01r,22jul92,jmm removed NO_TRACK_MODULE define + moved SEG_INFO here from various loaders + added prototypes for addSegNames and loadSegmentsAllocate +01q,21jul92,jmm added HIDDEN_MODULE define +01p,18jun92,ajm made object module independant +01o,26may92,rrr the tree shuffle +01n,14may92,ajm rewritten for object module independent loadLib + updated copyright +01m,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01l,02aug91,ajm added mips specific error entries +01k,24mar91,del added I960 defines. +01j,05oct90,dnw deleted private routines. +01i,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01h,07aug90,shl added INCloadLibh to #endif. +01g,05jun88,dnw changed ldLib to loadLib. +01f,07aug87,ecs added LD_NO_ADDRESS. +01e,24dec86,gae changed stsLib.h to vwModNum.h. +01d,10aug84,dnw removed unused status code: S_ldLib_UNDEFINED_SYMBOL. +01c,07aug84,ecs added include of stsLib.h + added status codes + added inclusion test +01b,29jun84,ecs changed values of *_SYMBOLS so default would be GLOBAL_SYMBOLS +01a,27apr84,dnw written +*/ + +#ifndef __INCloadLibh +#define __INCloadLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "moduleLib.h" + +/* status codes */ + +#define S_loadLib_ROUTINE_NOT_INSTALLED (M_loadLib | 1) +#define S_loadLib_TOO_MANY_SYMBOLS (M_loadLib | 2) /* obsoleted */ +#define S_loadLib_ILLEGAL_FLAGS_COMBINATION (M_loadLib | 3) +#define S_loadLib_INVALID_ARGUMENT (M_loadLib | 4) +#define S_loadLib_UNDEFINED_REFERENCES (M_loadLib | 5) + +/* + * 'old' load flags - now primarily used by 'ld', but loadModule can + * be called with these load flags, so these values must not be used for + * other load flags. + */ + +#define NO_SYMBOLS -1 +#define GLOBAL_SYMBOLS 0 +#define ALL_SYMBOLS 1 + +/* load flags */ + +#define LOAD_NO_SYMBOLS 0x2 +#define LOAD_LOCAL_SYMBOLS 0x4 +#define LOAD_GLOBAL_SYMBOLS 0x8 +#define LOAD_ALL_SYMBOLS (LOAD_LOCAL_SYMBOLS | LOAD_GLOBAL_SYMBOLS) +#define HIDDEN_MODULE 0x10 /* Don't display module */ + /* from moduleShow() */ + +#define LOAD_FULLY_LINKED 0x20 /* unsupported */ +#define LOAD_NO_DOWNLOAD 0x40 /* unsupported */ +#define LOAD_SYMTAB_FILE (LOAD_FULLY_LINKED | LOAD_NO_DOWNLOAD ) +#define LOAD_CORE_FILE LOAD_SYMTAB_FILE + + +#define LOAD_COMMON_MATCH_NONE 0x100 /* Only alloc, no search (default) */ +#define LOAD_COMMON_MATCH_USER 0x200 /* Core file excluded from search */ +#define LOAD_COMMON_MATCH_ALL 0x400 /* Core file included in search */ + +#define LOAD_CPLUS_XTOR_AUTO 0x1000 /* call C++ constructors on load */ +#define LOAD_CPLUS_XTOR_MANUAL 0x2000 /* do not call C++ constructors */ + +#define LOAD_MODULE_INFO_ONLY 0x1000000 /* host/target symtbls sync */ +#define LOAD_LOADED_BY_TGTSVR 0x2000000 /* host/target symtbls sync */ + +#define LD_NO_ADDRESS ((char *) NONE) + +/* function declarations */ + +extern MODULE_ID loadModule (int fd, int symFlag); +extern MODULE_ID loadModuleAt (int fd, int symFlag, char **ppText, + char **ppData, char **ppBss); +#ifdef __cplusplus +} +#endif + +#endif /* __INCloadLibh */ diff --git a/h/loadPecoffLib.h b/h/loadPecoffLib.h new file mode 100644 index 0000000..b81b556 --- /dev/null +++ b/h/loadPecoffLib.h @@ -0,0 +1,419 @@ +/* loadPecoffLib.h - Pecoff object module header */ + +/* Copyright 1998-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,23oct01,pad Added PE section flag extensions. Tidied up a bit. +01a,25mar98,cym written based on loadCoffLib.h. +*/ + +#ifndef __INCloadPecoffLibh +#define __INCloadPecoffLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef CPU +#include "symLib.h" +#include "moduleLib.h" +#endif + +/****************************************************************************** + * + * This file describes a PECOFF object file. + * + ******************************************************************************/ + +/******************************* DOS EXE HEADER ****************************/ +struct dosheader { + unsigned short e_magic; + unsigned short e_cblp; + unsigned short e_cp; + unsigned short e_crlc; + unsigned short e_cparhdr; + unsigned short e_minalloc; + unsigned short e_maxalloc; + unsigned short e_ss; + unsigned short e_sp; + unsigned short e_csum; + unsigned short e_ip; + unsigned short e_cs; + unsigned short e_lfarlc; + unsigned short e_ovno; + unsigned short e_res[4]; + unsigned short e_oemid; + unsigned short e_oeminfo; + unsigned short e_res2[10]; + unsigned long e_lfanew; /* Offset to the COFF image header */ + }; + + +/******************************* FILE HEADER *******************************/ + +struct filehdr { + unsigned short f_magic; /* magic number */ + unsigned short f_nscns; /* number of sections */ + long f_timdat; /* time & date stamp */ + long f_symptr; /* file pointer to symtab */ + long f_nsyms; /* number of symtab entries */ + unsigned short f_opthdr; /* sizeof(optional hdr) */ + unsigned short f_flags; /* flags */ +}; + +/* Bits for f_flags: + * F_RELFLG relocation info stripped from file + * F_EXEC file is executable (no unresolved external references) + * F_LNNO line numbers stripped from file + * F_LSYMS local symbols stripped from file + * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax) + * F_PIC file contains position-independent code + * F_PID file contains position-independent data + * F_LINKPID file is suitable for linking w/pos-indep code or data + */ +#define F_RELFLG 0x0001 +#define F_EXEC 0x0002 +#define F_LNNO 0x0004 +#define F_LSYMS 0x0008 +#define F_AR32WR 0x0010 +#define F_PIC 0x0040 +#define F_PID 0x0080 +#define F_LINKPID 0x0100 + +#define F_CCINFO 0x0800 + +/* Additional magic values from the PE format */ + +#define IMAGE_NT_SIGNATURE 0x00004550 +#define IMAGE_DOS_SIGNATURE 0x5A4D +#define IMAGE_FILE_MACHINE_I386 0x14c + +#define FILHDR struct filehdr +#define FILHSZ sizeof(FILHDR) + +#undef N_TXTOFF /* undefined for a.out overlap */ +#define N_TXTOFF(f) \ + ((f).f_opthdr == 0) ? \ + (FILHSZ + (f).f_nscns * SCNHSZ ) : \ + (FILHSZ + AOUTSZ + (f).f_nscns * SCNHSZ ) + +/************************* AOUT "OPTIONAL HEADER" *************************/ + +#define OMAGIC 0407 +#define NMAGIC 0410 + +typedef struct aouthdr { + short magic; /* type of file */ + short vstamp; /* version stamp */ + unsigned long tsize; /* text size in bytes, padded to FW bdry*/ + unsigned long dsize; /* initialized data " " */ + unsigned long bsize; /* uninitialized data " " */ + unsigned long entry; /* entry pt. */ + unsigned long text_start; /* base of text used for this file */ + unsigned long data_start; /* base of data used for this file */ + unsigned long image_base; /* offset for the image (add above) */ + unsigned long section_align; /* ?? */ + unsigned long file_align; /* ?? */ +} PEOPTION; + +#define PEOPTSZ (sizeof(PEOPTION)) + + +/****************************** SECTION HEADER ******************************/ + +struct scnhdr { + char s_name[8]; /* section name */ + long s_paddr; /* physical address, aliased s_nlib */ + long s_vaddr; /* virtual address */ + long s_size; /* section size */ + long s_scnptr; /* file ptr to raw data for section */ + long s_relptr; /* file ptr to relocation */ + long s_lnnoptr; /* file ptr to line numbers */ + unsigned short s_nreloc; /* number of relocation entries */ + unsigned short s_nlnno; /* number of line number entries*/ + long s_flags; /* flags */ +}; + +/* + * names of "special" sections + */ +#define _TEXT ".text" +#define _DATA ".data" +#define _BSS ".bss" + +/* s_flags "type" */ + /* TYPE ALLOCATED? RELOCATED? LOADED? */ + /* ---- ---------- ---------- ------- */ +#define STYP_REG 0x0000 /* regular yes yes yes */ +#define STYP_DSECT 0x0001 /* dummy no yes no */ +#define STYP_NOLOAD 0x0002 /* noload yes yes no */ +#define STYP_GROUP 0x0004 /* grouped */ +#define STYP_PAD 0x0008 /* padding no no yes */ +#define STYP_COPY 0x0010 /* copy no no yes */ +#define STYP_INFO 0x0200 /* comment no no no */ + +#define STYP_TEXT 0x0020 /* section contains text */ +#define STYP_DATA 0x0040 /* section contains data */ +#define STYP_BSS 0x0080 /* section contains bss */ +#define STYP_DRECTVE 0x0a00 /* section contains drectve */ +#define STYP_LIT 0x8000 /* section contains literal */ + +#define STYP_DISCARDABLE 0x01000000 /* Section can be discarded ?? */ + +/* + * Additional section types specific to the PE format. These are the types + * actually used by the GNU toolchain along with the STYP_{TEXT|DATA|BSS} + * types. Their definitions come from gnu/include/coff/pe.h + */ + +#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 /* section can be discarded */ +#define IMAGE_SCN_MEM_EXECUTE 0x20000000 /* section is executable */ +#define IMAGE_SCN_MEM_READ 0x40000000 /* section is readable */ +#define IMAGE_SCN_MEM_WRITE 0x80000000 /* section is writable */ + + +#define SCNHDR struct scnhdr +#define SCNHSZ sizeof(SCNHDR) + + +/******************************* LINE NUMBERS *******************************/ + +/* 1 line number entry for every "breakpointable" source line in a section. + * Line numbers are grouped on a per function basis; first entry in a function + * grouping will have l_lnno = 0 and in place of physical address will be the + * symbol table index of the function name. + */ +struct lineno{ + union { + long l_symndx; /* function name symbol index, iff l_lnno == 0*/ + long l_paddr; /* (physical) address of line number */ + } l_addr; + unsigned short l_lnno; /* line number */ + char padding[2]; /* force alignment */ +}; + +#define LINENO struct lineno +#define LINESZ sizeof(LINENO) + + +/********************************** SYMBOLS **********************************/ + +#define SYMNMLEN 8 /* # characters in a symbol name */ +#define FILNMLEN 14 /* # characters in a file name */ +#define DIMNUM 4 /* # array dimensions in auxiliary entry */ + +struct syment { + union { + char _n_name[SYMNMLEN]; /* old COFF version */ + struct { + long _n_zeroes; /* new == 0 */ + long _n_offset; /* offset into string table */ + } _n_n; + char *_n_nptr[2]; /* allows for overlaying */ + } _n; + long n_value; /* value of symbol */ + short n_scnum; /* section number */ + unsigned short n_type; /* type and derived type */ + char n_sclass; /* storage class */ + char n_numaux; /* number of aux. entries */ +}; + +#define SYMENT struct syment +#define SYMESZ sizeof(SYMENT) /* don't use sizeof since some compilers */ + /* may add padding in the structure */ +#define n_name _n._n_name +#define n_ptr _n._n_nptr[1] +#define n_zeroes _n._n_n._n_zeroes +#define n_offset _n._n_n._n_offset + + +/* + * Relocatable symbols have number of the section in which they are defined, + * or one of the following: + */ +#define N_UNDEF ((short)0) /* undefined symbol */ +#define N_ABS ((short)-1) /* value of symbol is absolute */ +#define N_DEBUG ((short)-2) /* debugging symbol -- value is meaningless */ +#define N_TV ((short)-3) /* indicates symbol needs preload transfer vector */ +#define P_TV ((short)-4) /* indicates symbol needs postload transfer vector*/ + +/* + * Symbol storage classes + */ +#define C_EFCN -1 /* physical end of function */ +#define C_NULL 0 +#define C_AUTO 1 /* automatic variable */ +#define C_EXT 2 /* external symbol */ +#define C_STAT 3 /* static */ +#define C_REG 4 /* register variable */ +#define C_EXTDEF 5 /* external definition */ +#define C_LABEL 6 /* label */ +#define C_ULABEL 7 /* undefined label */ +#define C_MOS 8 /* member of structure */ +#define C_ARG 9 /* function argument */ +#define C_STRTAG 10 /* structure tag */ +#define C_MOU 11 /* member of union */ +#define C_UNTAG 12 /* union tag */ +#define C_TPDEF 13 /* type definition */ +#define C_USTATIC 14 /* undefined static */ +#define C_ENTAG 15 /* enumeration tag */ +#define C_MOE 16 /* member of enumeration */ +#define C_REGPARM 17 /* register parameter */ +#define C_FIELD 18 /* bit field */ +#define C_AUTOARG 19 /* auto argument */ +#define C_BLOCK 100 /* ".bb" or ".eb" */ +#define C_FCN 101 /* ".bf" or ".ef" */ +#define C_EOS 102 /* end of structure */ +#define C_FILE 103 /* file name */ +#define C_LINE 104 /* line # reformatted as symbol table entry */ +#define C_ALIAS 105 /* duplicate tag */ +#define C_HIDDEN 106 /* ext symbol in dmert public lib */ +#define C_SCALL 107 /* Procedure reachable via system call */ +#define C_LEAFEXT 108 /* Global leaf procedure, "call" via BAL */ +#define C_LEAFSTAT 113 /* Static leaf procedure, "call" via BAL */ + + +/* + * Type of a symbol, in low 5 bits of n_type + */ +#define T_NULL 0 +#define T_VOID 1 /* function argument (only used by compiler) */ +#define T_CHAR 2 /* character */ +#define T_SHORT 3 /* short integer */ +#define T_INT 4 /* integer */ +#define T_LONG 5 /* long integer */ +#define T_FLOAT 6 /* floating point */ +#define T_DOUBLE 7 /* double word */ +#define T_STRUCT 8 /* structure */ +#define T_UNION 9 /* union */ +#define T_ENUM 10 /* enumeration */ +#define T_MOE 11 /* member of enumeration*/ +#define T_UCHAR 12 /* unsigned character */ +#define T_USHORT 13 /* unsigned short */ +#define T_UINT 14 /* unsigned integer */ +#define T_ULONG 15 /* unsigned long */ +#define T_LNGDBL 16 /* long double */ + +/* + * derived types, in n_type + */ +#define DT_NON 0 /* no derived type */ +#define DT_PTR 1 /* pointer */ +#define DT_FCN 2 /* function */ +#define DT_ARY 3 /* array */ + +#define N_BTMASK 0x1f +#define N_TMASK 0x60 +#define N_BTSHFT 5 +#define N_TSHIFT 2 + +#define BTYPE(x) ((x) & N_BTMASK) + +#define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT)) +#define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT)) +#define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT)) +#define ISTAG(x) ((x)==C_STRTAG||(x)==C_UNTAG||(x)==C_ENTAG) + + +#define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK)) + +union auxent { + struct { + long x_tagndx; /* str, un, or enum tag indx */ + union { + struct { + unsigned short x_lnno; /* declaration line number */ + unsigned short x_size; /* str/union/array size */ + } x_lnsz; + long x_fsize; /* size of function */ + } x_misc; + union { + struct { /* if ISFCN, tag, or .bb */ + long x_lnnoptr; /* ptr to fcn line # */ + long x_endndx; /* entry ndx past block end */ + } x_fcn; + struct { /* if ISARY, up to 4 dimen. */ + unsigned short x_dimen[DIMNUM]; + } x_ary; + } x_fcnary; + unsigned short x_tvndx; /* tv index */ + } x_sym; + + union { + char x_fname[FILNMLEN]; + struct { + long x_zeroes; + long x_offset; + } x_n; + } x_file; + + struct { + long x_scnlen; /* section length */ + unsigned short x_nreloc; /* # relocation entries */ + unsigned short x_nlinno; /* # line numbers */ + } x_scn; + + struct { + long x_tvfill; /* tv fill value */ + unsigned short x_tvlen; /* length of .tv */ + unsigned short x_tvran[2]; /* tv range */ + } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ + +}; + +#define AUXENT union auxent +#define AUXESZ sizeof(AUXENT) + +#define _ETEXT "_etext" + +/********************** RELOCATION DIRECTIVES **********************/ + +struct reloc { + long r_vaddr; /* Virtual address of reference */ + long r_symndx; /* Index into symbol table */ + unsigned short r_type; /* Relocation type */ +}; + +#define IMAGE_REL_I386_DIR32 0x0006 +#define IMAGE_REL_I386_REL32 0x0014 + +#define RELOC struct reloc +#define RELSZ sizeof(RELOC) + +/* status codes */ + +#define S_loadLib_FILE_READ_ERROR (M_loadPecoffLib | 1) +#define S_loadLib_REALLOC_ERROR (M_loadPecoffLib | 2) +#define S_loadLib_JMPADDR_ERROR (M_loadPecoffLib | 3) +#define S_loadLib_NO_REFLO_PAIR (M_loadPecoffLib | 4) +#define S_loadLib_GPREL_REFERENCE (M_loadPecoffLib | 5) +#define S_loadLib_UNRECOGNIZED_RELOCENTRY (M_loadPecoffLib | 6) +#define S_loadLib_REFHALF_OVFL (M_loadPecoffLib | 7) +#define S_loadLib_FILE_ENDIAN_ERROR (M_loadPecoffLib | 8) +#define S_loadLib_UNEXPECTED_SYM_CLASS (M_loadPecoffLib | 9) +#define S_loadLib_UNRECOGNIZED_SYM_CLASS (M_loadPecoffLib | 10) +#define S_loadLib_HDR_READ (M_loadPecoffLib | 11) +#define S_loadLib_OPTHDR_READ (M_loadPecoffLib | 12) +#define S_loadLib_SCNHDR_READ (M_loadPecoffLib | 13) +#define S_loadLib_READ_SECTIONS (M_loadPecoffLib | 14) +#define S_loadLib_LOAD_SECTIONS (M_loadPecoffLib | 15) +#define S_loadLib_RELOC_READ (M_loadPecoffLib | 16) +#define S_loadLib_SYMHDR_READ (M_loadPecoffLib | 17) +#define S_loadLib_EXTSTR_READ (M_loadPecoffLib | 18) +#define S_loadLib_EXTSYM_READ (M_loadPecoffLib | 19) + + +/* function declarations */ + +extern STATUS loadPecoffInit (void); +extern MODULE_ID ldPecoffModAtSym (int fd, int symFlag, char **ppText, + char **ppData, char **ppBss, + SYMTAB_ID symTbl); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCloadPecoffLibh */ diff --git a/h/loadSomCoffLib.h b/h/loadSomCoffLib.h new file mode 100644 index 0000000..fa58457 --- /dev/null +++ b/h/loadSomCoffLib.h @@ -0,0 +1,58 @@ +/* loadSomCoffLib.h - object module dependant loader library header */ + +/* Copyright 1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,13may98,ms added prototype for loadSomCoffInit. +01a,12sep93,yao written. +*/ + +#ifndef __INCloadSomCoffLibh +#define __INCloadSomCoffLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "symLib.h" + +/* status codes */ + +#define S_loadSomCoffLib_HDR_READ (M_loadSomCoffLib | 1) +#define S_loadSomCoffLib_AUXHDR_READ (M_loadSomCoffLib | 2) +#define S_loadSomCoffLib_SYM_READ (M_loadSomCoffLib | 3) +#define S_loadSomCoffLib_SYMSTR_READ (M_loadSomCoffLib | 4) +#define S_loadSomCoffLib_OBJ_FMT (M_loadSomCoffLib | 5) +#define S_loadSomCoffLib_SPHDR_ALLOC (M_loadSomCoffLib | 6) +#define S_loadSomCoffLib_SPHDR_READ (M_loadSomCoffLib | 7) +#define S_loadSomCoffLib_SUBSPHDR_ALLOC (M_loadSomCoffLib | 8) +#define S_loadSomCoffLib_SUBSPHDR_READ (M_loadSomCoffLib | 9) +#define S_loadSomCoffLib_SPSTRING_ALLOC (M_loadSomCoffLib | 10) +#define S_loadSomCoffLib_SPSTRING_READ (M_loadSomCoffLib | 11) +#define S_loadSomCoffLib_INFO_ALLOC (M_loadSomCoffLib | 12) +#define S_loadSomCoffLib_LOAD_SPACE (M_loadSomCoffLib | 13) +#define S_loadSomCoffLib_RELOC_ALLOC (M_loadSomCoffLib | 14) +#define S_loadSomCoffLib_RELOC_READ (M_loadSomCoffLib | 15) +#define S_loadSomCoffLib_RELOC_NEW (M_loadSomCoffLib | 16) +#define S_loadSomCoffLib_RELOC_VERSION (M_loadSomCoffLib | 17) + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS loadSomCoffInit (void); + +#else /* __STDC__ */ + +extern STATUS loadSomCoffInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCloadSomCoffLibh */ diff --git a/h/locale.h b/h/locale.h new file mode 100644 index 0000000..ccdf50b --- /dev/null +++ b/h/locale.h @@ -0,0 +1,86 @@ +/* locale.h - locale header file */ + +/* Copyright 1992-1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,17feb99,mrs Add C++ support for NULL, (SPR #25079). +01e,21jul96,dbt moved localeconv() definition (SPR #3627). +01d,15oct92,rrr silenced warnings +01c,22sep92,rrr added support for c++ +01b,12jul92,smb modified definition of localconv for MIPS cpp. +01a,08jul92,smb written. +*/ + +#ifndef __INClocaleh +#define __INClocaleh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types/vxANSI.h" + +#ifndef NULL +#if defined __GNUG__ +#define NULL (__null) +#else +#if !defined(__cplusplus) && 0 +#define NULL ((void*)0) +#else +#define NULL (0) +#endif +#endif +#endif + +#define LC_ALL 1 +#define LC_COLLATE 2 +#define LC_CTYPE 3 +#define LC_MONETARY 4 +#define LC_NUMERIC 5 +#define LC_TIME 6 + +struct lconv + { + char *decimal_point; /* LC_NUMERIC */ + char *thousands_sep; + char *grouping; + char *int_curr_symbol; /* LC_MONETARY */ + char *currency_symbol; + char *mon_decimal_point; + char *mon_thousands_sep; + char *mon_grouping; + char *positive_sign; + char *negative_sign; + char int_frac_digits; + char frac_digits; + char p_cs_precedes; + char p_sep_by_space; + char n_cs_precedes; + char n_sep_by_space; + char p_sign_posn; + char n_sign_posn; + }; + +extern struct lconv __locale; + +#if defined(__STDC__) || defined(__cplusplus) + +extern char *setlocale(int __category, const char *___locale); +extern struct lconv *localeconv(void); + +#else /* __STDC__ */ + +extern char *setlocale(); +extern struct lconv *localeconv(); + +#endif /* __STDC__ */ + +#define localeconv() (&__locale) + +#ifdef __cplusplus +} +#endif + +#endif /* __INClocaleh */ diff --git a/h/logLib.h b/h/logLib.h new file mode 100644 index 0000000..f816cb0 --- /dev/null +++ b/h/logLib.h @@ -0,0 +1,68 @@ +/* logLib.h - message logging library header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,11feb93,jcf added __PROTOTYPE_5_0 for compatibility. +01i,22sep92,rrr added support for c++ +01h,17jul92,gae undid 01e. +01g,04jul92,jcf cleaned up. +01f,26may92,rrr the tree shuffle +01e,05mar92,gae changed logMsg() to be true variable args. +01d,04oct91,rrr passed through the ansification filter + -changed VOID to void + -changed copyright notice +01c,19oct90,shl changed logMsg() to use variable length argument list. +01b,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01a,10aug90,dnw written +*/ + +#ifndef __INClogLibh +#define __INClogLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS logFdAdd (int fd); +extern STATUS logFdDelete (int fd); +extern STATUS logInit (int fd, int maxMsgs); + +#ifdef __PROTOTYPE_5_0 +extern int logMsg (char *fmt, ...); +#else +extern int logMsg (char *fmt, int arg1, int arg2, + int arg3, int arg4, int arg5, int arg6); +#endif /* __PROTOTYPE_5_0 */ + +extern void logFdSet (int fd); +extern void logShow (void); +extern void logTask (void); + +#else /* __STDC__ */ + +extern STATUS logFdAdd (); +extern STATUS logFdDelete (); +extern STATUS logInit (); +extern int logMsg (); +extern void logFdSet (); +extern void logShow (); +extern void logTask (); + +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INClogLibh */ diff --git a/h/loginLib.h b/h/loginLib.h new file mode 100644 index 0000000..d1ac4e2 --- /dev/null +++ b/h/loginLib.h @@ -0,0 +1,80 @@ +/* loginLib.h - user password/login subroutine library header file */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01u,26apr04,bpn Added loginPrompt2() prototype to fix SPR#96149. +01t,12feb04,asr added #ifdef _WRS_KERNEL sections to allow loginLib.h + to be included from user and kernel mode builds. Also + added loginVerifyArgs structure for sysctl use. +01s,22sep92,rrr added support for c++ +01r,04jul92,jcf cleaned up. +01q,26may92,rrr the tree shuffle +01p,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01o,19aug91,rrr fixed the ansi prototype for loginUserAdd +01d,01may91,jdi added ifndef for DOC. +01c,21jan91,shl fixed arguments type in loginUserAdd(). +01b,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01a,18apr90,shl written. +*/ + +#ifndef __INCloginLibh +#define __INCloginLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" + +#ifndef DOC +#define MAX_LOGIN_NAME_LEN 80 +#define MAX_PASSWORD_LEN 80 +#define MAX_LOGIN_ENTRY 80 +#endif /* DOC */ + +/* status messages */ + +#define S_loginLib_UNKNOWN_USER (M_loginLib | 1) +#define S_loginLib_USER_ALREADY_EXISTS (M_loginLib | 2) +#define S_loginLib_INVALID_PASSWORD (M_loginLib | 3) + +/* structure for passing login user info to sysctl */ +struct loginVerifyArgs + { + char name[MAX_LOGIN_NAME_LEN+1]; + char passwd[MAX_PASSWORD_LEN+1]; + }; + +/* function declarations */ + +extern void loginInit (void); +extern STATUS loginUserVerify (char * name, char * passwd); + +#ifdef _WRS_KERNEL +extern STATUS loginDefaultEncrypt (char * in, char * out); +extern STATUS loginPrompt (char * userName); +extern STATUS loginUserAdd (char name[MAX_LOGIN_NAME_LEN], + char passwd[MAX_PASSWORD_LEN]); +extern STATUS loginUserDelete (char * name, char * passwd); +extern void loginEncryptInstall (FUNCPTR rtn, int var); +extern void loginStringSet (char * newString); +extern void loginUserShow (void); + +/* Private prototype */ + +extern STATUS loginPrompt2 (char * userName, BOOL withTimeout); +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCloginLibh */ diff --git a/h/lstLib.h b/h/lstLib.h new file mode 100644 index 0000000..efd3090 --- /dev/null +++ b/h/lstLib.h @@ -0,0 +1,112 @@ +/* lstLib.h - doubly linked list library header */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01n,19sep01,pcm added lstLibInit () (SPR 20698) +01m,02apr93,edm ifdef'd out non-ASMLANGUAGE portions +01l,22sep92,rrr added support for c++ +01k,04jul92,jcf cleaned up. +01j,26may92,rrr the tree shuffle +01i,04oct91,rrr passed through the ansification filter + -changed VOID to void + -changed copyright notice +01h,23oct90,shl included "vxWorks.h" so include file order isn't crucial. +01g,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01f,10aug90,dnw added declaration of lstInsert(). +01e,07aug90,shl added IMPORT type to function declarations. +01d,21may86,llk added forward declaration of lstNStep. +01c,03jun84,dnw changed list.{head,tail} to list.node. + added declarations of lst{First,Last,Next,Previous}. +01b,27jan84,ecs added inclusion test. +01b,15mar83,dnw changed name from lstlb to lstLib +*/ + +#ifndef __INClstLibh +#define __INClstLibh + +#ifndef _ASMLANGUAGE + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + +/* type definitions */ + +typedef struct node /* Node of a linked list. */ + { + struct node *next; /* Points at the next node in the list */ + struct node *previous; /* Points at the previous node in the list */ + } NODE; + + +/* HIDDEN */ + +typedef struct /* Header for a linked list. */ + { + NODE node; /* Header list node */ + int count; /* Number of nodes in list */ + } LIST; + +/* END_HIDDEN */ + + +/* function declarations */ + + +#if defined(__STDC__) || defined(__cplusplus) + +extern void lstLibInit (void); +extern NODE * lstFirst (LIST *pList); +extern NODE * lstGet (LIST *pList); +extern NODE * lstLast (LIST *pList); +extern NODE * lstNStep (NODE *pNode, int nStep); +extern NODE * lstNext (NODE *pNode); +extern NODE * lstNth (LIST *pList, int nodenum); +extern NODE * lstPrevious (NODE *pNode); +extern int lstCount (LIST *pList); +extern int lstFind (LIST *pList, NODE *pNode); +extern void lstAdd (LIST *pList, NODE *pNode); +extern void lstConcat (LIST *pDstList, LIST *pAddList); +extern void lstDelete (LIST *pList, NODE *pNode); +extern void lstExtract (LIST *pSrcList, NODE *pStartNode, NODE *pEndNode, + LIST *pDstList); +extern void lstFree (LIST *pList); +extern void lstInit (LIST *pList); +extern void lstInsert (LIST *pList, NODE *pPrev, NODE *pNode); + +#else /* __STDC__ */ + +extern void lstLibInit (); +extern NODE * lstFirst (); +extern NODE * lstGet (); +extern NODE * lstLast (); +extern NODE * lstNStep (); +extern NODE * lstNext (); +extern NODE * lstNth (); +extern NODE * lstPrevious (); +extern int lstCount (); +extern int lstFind (); +extern void lstAdd (); +extern void lstConcat (); +extern void lstDelete (); +extern void lstExtract (); +extern void lstFree (); +extern void lstInit (); +extern void lstInsert (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* ~ _ASMLANGUAGE */ + +#endif /* __INClstLibh */ diff --git a/h/m2IfLib.h b/h/m2IfLib.h new file mode 100644 index 0000000..7dcfc21 --- /dev/null +++ b/h/m2IfLib.h @@ -0,0 +1,26 @@ +/* m2IfLib.h - VxWorks MIB-II interface to SNMP Agent */ + +/* Copyright 1984-1993 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01f,11feb00,ann written for RFC 2233 implementation +*/ + +#ifndef __INCm2IfLibh +#define __INCm2IfLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "m2Lib.h" +#include "end.h" + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm2Libh */ diff --git a/h/m2Lib.h b/h/m2Lib.h new file mode 100644 index 0000000..32cecaa --- /dev/null +++ b/h/m2Lib.h @@ -0,0 +1,1118 @@ +/* m2Lib.h - VxWorks MIB-II interface to SNMP Agent */ + +/* Copyright 1984 - 2002 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01i,22apr02,rae Fixed MAXOIDLENGH typo (SPR #73303) +01h,05dec01,vvv changed M2_IFSTACKTBL index to unsigned (SPR #71316) +01g,10oct01,rae merge from truestack ver 01n, base o1f +01f,25oct00,niq Merge RFC2233 changes from open_stack-p1-r1 branch +01j,18may00,ann merging from post R1 to include RFC2233 and the ipRouteMask + bug fix +01i,14apr00,ann adding changes to make ipRouteMask writeable +01h,28mar00,rae merging in IGMPv2 changes +01g,10mar00,ead added function declaration for m2IfStackTblUpdate +01f,11feb00,ann making changes for RFC 2233 implementation +01e,24mar99,ead added m2SetIfLastChange() declaration (SPR #23290) +01d,10sep98,ann added doc to M2_INTERFACETBL fields spr# 21078 +01c,11apr97,rjc fixed bad value of error define +01b,05feb97,rjc added new error codes to support phase-2 ospf mib +01a,08dec93,jag written +*/ + +#ifndef __INCm2Libh +#define __INCm2Libh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "net/if.h" +#include "avlLib.h" + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* m2Lib.c Error Codes */ + +#define S_m2Lib_INVALID_PARAMETER (M_m2Lib | 1) +#define S_m2Lib_ENTRY_NOT_FOUND (M_m2Lib | 2) +#define S_m2Lib_TCPCONN_FD_NOT_FOUND (M_m2Lib | 3) +#define S_m2Lib_INVALID_VAR_TO_SET (M_m2Lib | 4) +#define S_m2Lib_CANT_CREATE_SYS_SEM (M_m2Lib | 5) +#define S_m2Lib_CANT_CREATE_IF_SEM (M_m2Lib | 6) +#define S_m2Lib_CANT_CREATE_ROUTE_SEM (M_m2Lib | 7) +#define S_m2Lib_ARP_PHYSADDR_NOT_SPECIFIED (M_m2Lib | 8) +#define S_m2Lib_IF_TBL_IS_EMPTY (M_m2Lib | 9) +#define S_m2Lib_IF_CNFG_CHANGED (M_m2Lib | 10) +#define S_m2Lib_TOO_BIG (M_m2Lib | 11) +#define S_m2Lib_BAD_VALUE (M_m2Lib | 12) +#define S_m2Lib_READ_ONLY (M_m2Lib | 13) +#define S_m2Lib_GEN_ERR (M_m2Lib | 14) + +#define ETHERADDRLEN 6 +#define M2DISPLAYSTRSIZE 256 +#define MAXOIDLENGTH 40 +#define MAXIFPHYADDR 16 + +/* defines for enumerated types as specified by RFC 1213 */ + +/* possible values for ifType (found in IANA-MIB) */ + +#define M2_ifType_other 1 /* none of the following */ +#define M2_ifType_regular1822 2 +#define M2_ifType_hdh1822 3 +#define M2_ifType_ddnX25 4 +#define M2_ifType_rfc877x25 5 +#define M2_ifType_ethernetCsmacd 6 +#define M2_ifType_ethernet_csmacd M2_ifType_ethernetCsmacd +#define M2_ifType_iso88023Csmacd 7 +#define M2_ifType_iso88023_csmacd M2_ifType_iso88023Csmacd +#define M2_ifType_iso88024TokenBus 8 +#define M2_ifType_iso88024_tokenBus M2_ifType_iso88024TokenBus +#define M2_ifType_iso88025TokenRing 9 +#define M2_ifType_iso88025_tokenRing M2_ifType_iso88025TokenRing +#define M2_ifType_iso88026Man 10 +#define M2_ifType_iso88026_man M2_ifType_iso88026Man +#define M2_ifType_starLan 11 +#define M2_ifType_proteon10Mbit 12 +#define M2_ifType_proteon80Mbit 13 +#define M2_ifType_hyperchannel 14 +#define M2_ifType_fddi 15 +#define M2_ifType_lapb 16 +#define M2_ifType_sdlc 17 +#define M2_ifType_ds1 18 /* DS1-MIB */ +#define M2_ifType_e1 19 /* Obsolete see DS1-MIB */ +#define M2_ifType_basicISDN 20 +#define M2_ifType_primaryISDN 21 +#define M2_ifType_propPointToPointSerial 22 /* proprietary serial */ +#define M2_ifType_ppp 23 +#define M2_ifType_softwareLoopback 24 +#define M2_ifType_eon 25 /* CLNP over IP */ +#define M2_ifType_ethernet3Mbit 26 +#define M2_ifType_nsip 27 /* XNS over IP */ +#define M2_ifType_slip 28 /* generic SLIP */ +#define M2_ifType_ultra 29 /* ULTRA technologies */ +#define M2_ifType_ds3 30 /* DS3-MIB */ +#define M2_ifType_sip 31 /* SMDS, coffee */ +#define M2_ifType_frameRelay 32 /* DTE only. */ +#define M2_ifType_rs232 33 +#define M2_ifType_para 34 /* parallel-port */ +#define M2_ifType_arcnet 35 /* arcnet */ +#define M2_ifType_arcnetPlus 36 /* arcnet plus */ +#define M2_ifType_atm 37 /* ATM cells */ +#define M2_ifType_miox25 38 +#define M2_ifType_sonet 39 /* SONET or SDH */ +#define M2_ifType_x25ple 40 +#define M2_ifType_iso88022llc 41 +#define M2_ifType_localTalk 42 +#define M2_ifType_smdsDxi 43 +#define M2_ifType_frameRelayService 44 /* FRNETSERV-MIB */ +#define M2_ifType_v35 45 +#define M2_ifType_hssi 46 +#define M2_ifType_hippi 47 +#define M2_ifType_modem 48 /* Generic modem */ +#define M2_ifType_aal5 49 /* AAL5 over ATM */ +#define M2_ifType_sonetPath 50 +#define M2_ifType_sonetVT 51 +#define M2_ifType_smdsIcip 52 /* SMDS InterCarrier Interface */ +#define M2_ifType_propVirtual 53 /* proprietary virtual/internal */ +#define M2_ifType_propMultiplexor 54 /* proprietary multiplexing */ +#define M2_ifType_ieee80212 55 /* 100BaseVG */ +#define M2_ifType_fibreChannel 56 /* Fibre Channel */ +#define M2_ifType_hippiInterface 57 /* HIPPI interfaces */ +#define M2_ifType_frameRelayInterconnect 58 /* Obsolete use either 32 or 44 */ +#define M2_ifType_aflane8023 59 /* ATM Emulated LAN for 802.3 */ +#define M2_ifType_aflane8025 60 /* ATM Emulated LAN for 802.5 */ +#define M2_ifType_cctEmul 61 /* ATM Emulated circuit */ +#define M2_ifType_fastEther 62 /* Fast Ethernet (100BaseT) */ +#define M2_ifType_isdn 63 /* ISDN and X.25 */ +#define M2_ifType_v11 64 /* CCITT V.11/X.21 */ +#define M2_ifType_v36 65 /* CCITT V.36 */ +#define M2_ifType_g703at64k 66 /* CCITT G703 at 64Kbps */ +#define M2_ifType_g703at2mb 67 /* Obsolete see DS1-MIB */ +#define M2_ifType_qllc 68 /* SNA QLLC */ +#define M2_ifType_fastEtherFX 69 /* Fast Ethernet (100BaseFX) */ +#define M2_ifType_channel 70 /* channel */ +#define M2_ifType_ieee80211 71 /* radio spread spectrum */ +#define M2_ifType_ibm370parChan 72 /* IBM 360/370 OEMI Channel */ +#define M2_ifType_escon 73 /* IBM Enterprise Systems Cnx */ +#define M2_ifType_dlsw 74 /* Data Link Switching */ +#define M2_ifType_isdns 75 /* ISDN S/T interface */ +#define M2_ifType_isdnu 76 /* ISDN U interface */ +#define M2_ifType_lapd 77 /* Link Access Protocol D */ +#define M2_ifType_ipSwitch 78 /* IP Switching Objects */ +#define M2_ifType_rsrb 79 /* Remote Source Route Bridging */ +#define M2_ifType_atmLogical 80 /* ATM Logical Port */ +#define M2_ifType_ds0 81 /* Digital Signal Level 0 */ +#define M2_ifType_ds0Bundle 82 /* ds0s on the same ds1 */ +#define M2_ifType_bsc 83 /* Bisynchronous Protocol */ +#define M2_ifType_async 84 /* Asynchronous Protocol */ +#define M2_ifType_cnr 85 /* Combat Net Radio */ +#define M2_ifType_iso88025Dtr 86 /* ISO 802.5r DTR */ +#define M2_ifType_eplrs 87 /* Ext Pos Loc Report Sys */ +#define M2_ifType_arap 88 /* Appletalk Remote Access Proto */ +#define M2_ifType_propCnls 89 /* Proprietary Cnx-less Proto */ +#define M2_ifType_hostPad 90 /* CCITT-ITU X.29 PAD Protocol */ +#define M2_ifType_termPad 91 /* CCITT-ITU X.3 PAD Facility */ +#define M2_ifType_frameRelayMPI 92 /* Multiproto Interconnect FR */ +#define M2_ifType_x213 93 /* CCITT-ITU X213 */ +#define M2_ifType_adsl 94 /* Asymmetric DSL */ +#define M2_ifType_radsl 95 /* Rate-Adapt. DSL */ +#define M2_ifType_sdsl 96 /* Symmetric DSL */ +#define M2_ifType_vdsl 97 /* Very H-Speed DSL */ +#define M2_ifType_iso88025CRFPInt 98 /* ISO 802.5 CRFP */ +#define M2_ifType_myrinet 99 /* Myricom Myrinet */ +#define M2_ifType_voiceEM 100 /* voice recEive and transMit */ +#define M2_ifType_voiceFXO 101 /* voice Foreign Exchg Office */ +#define M2_ifType_voiceFXS 102 /* voice Foreign Exchg Station */ +#define M2_ifType_voiceEncap 103 /* voice encapsulation */ +#define M2_ifType_voiceOverIp 104 /* voice over IP encapsulation */ +#define M2_ifType_atmDxi 105 /* ATM DXI */ +#define M2_ifType_atmFuni 106 /* ATM FUNI */ +#define M2_ifType_atmIma 107 /* ATM IMA */ +#define M2_ifType_pppMultilinkBundle 108 /* PPP Multilink Bundle */ +#define M2_ifType_ipOverCdlc 109 /* IBM ipOverCdlc */ +#define M2_ifType_ipOverClaw 110 /* IBM Common Link Access */ +#define M2_ifType_stackToStack 111 /* IBM stackToStack */ +#define M2_ifType_virtualIpAddress 112 /* IBM VIPA */ +#define M2_ifType_mpc 113 /* IBM multi-protocol channel */ +#define M2_ifType_ipOverAtm 114 /* IBM ipOverAtm */ +#define M2_ifType_iso88025Fiber 115 /* ISO 802.5j Fiber Token Ring */ +#define M2_ifType_tdlc 116 /* IBM twinaxial data link */ +#define M2_ifType_gigabitEthernet 117 /* Gigabit Ethernet */ +#define M2_ifType_hdlc 118 /* HDLC */ +#define M2_ifType_lapf 119 /* LAP F */ +#define M2_ifType_v37 120 /* V.37 */ +#define M2_ifType_x25mlp 121 /* Multi-Link Protocol */ +#define M2_ifType_x25huntGroup 122 /* X25 Hunt Group */ +#define M2_ifType_trasnpHdlc 123 /* Transp HDLC */ +#define M2_ifType_interleave 124 /* Interleave channel */ +#define M2_ifType_fast 125 /* Fast channel */ +#define M2_ifType_ip 126 /* IP (APPN HPR in IP networks) */ +#define M2_ifType_docsCableMaclayer 127 /* CATV Mac Layer */ +#define M2_ifType_docsCableDownstream 128 /* CATV Downstream interface */ +#define M2_ifType_docsCableUpstream 129 /* CATV Upstream interface */ +#define M2_ifType_a12MppSwitch 130 /* Avalon Parallel Processor */ +#define M2_ifType_tunnel 131 /* Encapsulation interface */ +#define M2_ifType_coffee 132 /* coffee pot */ +#define M2_ifType_ces 133 /* Circuit Emulation Service */ +#define M2_ifType_atmSubInterface 134 /* ATM Sub Interface */ +#define M2_ifType_l2vlan 135 /* Layer 2 V-LAN using 802.1Q */ +#define M2_ifType_l3ipvlan 136 /* Layer 3 V-LAN using IP */ +#define M2_ifType_l3ipxvlan 137 /* Layer 3 V-LAN using IPX */ +#define M2_ifType_digitalPowerline 138 /* IP over Power Lines */ +#define M2_ifType_mediaMailOverIp 139 /* Multimedia Mail over IP */ +#define M2_ifType_dtm 140 /* Dynamic sync Transfer Mode */ +#define M2_ifType_dcn 141 /* Data Communications Network */ +#define M2_ifType_ipForward 142 /* IP Forwarding Interface */ +#define M2_ifType_msdsl 143 /* Multi-rate Symmetric DSL */ +#define M2_ifType_ieee1394 144 /* IEEE1394 High Perf Serial Bus */ +#define M2_ifType_if_gsn 145 /* HIPPI-6400 */ +#define M2_ifType_dvbRccMacLayer 146 /* DVB-RCC MAC Layer */ +#define M2_ifType_dvbRccDownstream 147 /* DVB-RCC Downstream Channel */ +#define M2_ifType_dvbRccUpstream 148 /* DVB-RCC Upstream Channel */ +#define M2_ifType_atmVirtual 149 /* ATM Virtual Interface */ +#define M2_ifType_mplsTunnel 150 /* MPLS Tunnel Virtual Interface */ +#define M2_ifType_srp 151 /* Spatial Reuse Protocol */ +#define M2_ifType_voiceOverAtm 152 /* Voice Over ATM */ +#define M2_ifType_voiceOverFrameRelay 153 /* Voice Over Frame Relay */ +#define M2_ifType_idsl 154 /* DSL over ISDN */ +#define M2_ifType_compositeLink 155 /* Avici Composite Link */ +#define M2_ifType_ss7SigLink 156 /* SS7 Signaling Link */ +#define M2_ifType_pmp 157 /* Point to Multipoint */ + +/* packet control used for stat counting routines (in or out) */ + +#define M2_PACKET_IN 1 +#define M2_PACKET_OUT 2 + +/* interface attach/insert and detach/remove */ + +#define M2_IF_TABLE_INSERT 1 +#define M2_IF_TABLE_REMOVE 2 + +/* stack layer insert/remove */ +#define M2_STACK_TABLE_INSERT 1 +#define M2_STACK_TABLE_REMOVE 2 + +/* interface mib styles used by the MUX/drivers */ + +#define MIB_STYLE_1213 1 +#define MIB_STYLE_2233 2 + +/* interface counter IDs */ + +#define M2_ctrId_ifInOctets 1 +#define M2_ctrId_ifInUcastPkts 2 +#define M2_ctrId_ifInNUcastPkts 3 +#define M2_ctrId_ifInDiscards 4 +#define M2_ctrId_ifInErrors 5 +#define M2_ctrId_ifInUnknownProtos 6 +#define M2_ctrId_ifOutOctets 7 +#define M2_ctrId_ifOutUcastPkts 8 +#define M2_ctrId_ifOutNUcastPkts 9 +#define M2_ctrId_ifOutDiscards 10 +#define M2_ctrId_ifOutErrors 11 +#define M2_ctrId_ifInMulticastPkts 12 +#define M2_ctrId_ifInBroadcastPkts 13 +#define M2_ctrId_ifOutMulticastPkts 14 +#define M2_ctrId_ifOutBroadcastPkts 15 +#define M2_ctrId_ifHCInOctets 16 +#define M2_ctrId_ifHCInUcastPkts 17 +#define M2_ctrId_ifHCInMulticastPkts 18 +#define M2_ctrId_ifHCInBroadcastPkts 19 +#define M2_ctrId_ifHCOutOctets 20 +#define M2_ctrId_ifHCOutUcastPkts 21 +#define M2_ctrId_ifHCOutMulticastPkts 22 +#define M2_ctrId_ifHCOutBroadcastPkts 23 + +/* interface variable IDs */ + +#define M2_varId_ifAdminStatus 1 +#define M2_varId_ifLinkUpDownTrapEnable 2 +#define M2_varId_ifMtu 3 +#define M2_varId_ifPromiscuousMode 4 +#define M2_varId_ifPhysAddress 5 +#define M2_varId_ifDescr 6 +#define M2_varId_ifOperStatus 7 +#define M2_varId_ifAlias 8 +#define M2_varId_ifOutQLen 9 +#define M2_varId_ifSpecific 10 +#define M2_varId_ifName 11 +#define M2_varId_ifType 12 +#define M2_varId_ifHighSpeed 13 +#define M2_varId_ifSpeed 14 +#define M2_varId_ifConnectorPresent 15 +#define M2_varId_ifLastChange 16 + +/* possible values for ifAdminStatus */ + +#define M2_ifAdminStatus_up 1 +#define M2_ifAdminStatus_down 2 +#define M2_ifAdminStatus_testing 3 + +/* possible values for ifOperStatus */ + +#define M2_ifOperStatus_up 1 +#define M2_ifOperStatus_down 2 +#define M2_ifOperStatus_testing 3 + +/* possible values for ifPromiscuousMode */ + +#define M2_ifPromiscuousMode_on 1 +#define M2_ifPromiscuousMode_off 2 + +/* Row Status defines */ + +#define ROW_ACTIVE 1 +#define ROW_NOTINSERVICE 2 +#define ROW_NOTREADY 3 +#define ROW_CREATEANDGO 4 +#define ROW_CREATEANDWAIT 5 +#define ROW_DESTROY 6 + +/* Storage type defines */ + +#define STORAGE_OTHER 1 +#define STORAGE_VOLATILE 2 +#define STORAGE_NONVOLATILE 3 + +/* Boolean Values */ + +#define M2_TRUE 1 +#define M2_FALSE 2 + +/* defines for all the objects in the interface table */ + +#define M2_IFLASTCHANGE 1 +#define M2_IFINOCTETS 2 +#define M2_IFINUCASTPKTS 3 +#define M2_IFINNUCASTPKTS 4 +#define M2_IFINDISCARDS 5 +#define M2_IFINERRORS 6 +#define M2_IFINUNKNOWNPROTOS 7 +#define M2_IFOUTOCTETS 8 +#define M2_IFOUTUCASTPKTS 9 +#define M2_IFOUTNUCASTPKTS 10 +#define M2_IFOUTDISCARDS 11 +#define M2_IFOUTERRORS 12 +#define M2_IFOUTQLEN 13 +#define M2_IFINMULTICASTPKTS 14 +#define M2_IFINBROADCASTPKTS 15 +#define M2_IFOUTMULTICASTPKTS 16 +#define M2_IFOUTBROADCASTPKTS 17 +#define M2_IFHCINOCTETS 18 +#define M2_IFHCINUCASTPKTS 19 +#define M2_IFHCINMULTICASTPKTS 20 +#define M2_IFHCINBROADCASTPKTS 21 +#define M2_IFHCOUTOCTETS 22 +#define M2_IFHCOUTUCASTPKTS 23 +#define M2_IFHCOUTMULTICASTPKTS 24 +#define M2_IFHCOUTBROADCASTPKTS 25 +#define M2_IFLINKUPDOWNTRAPENABLE 26 +#define M2_IFHIGHSPEED 27 +#define M2_IFPROMISCUOUSMODE 28 +#define M2_IFCONNECTORPRESENT 29 + +/* defines for rcvAddr table entries */ +#define M2_IFRCVADDRSTATUS 1 +#define M2_IFRCVADDRTYPE 2 + +/* possible values for ipForwarding */ + +#define M2_ipForwarding_forwarding 1 +#define M2_ipForwarding_not_forwarding 2 + +/* possible values for ipRouteType */ + +#define M2_ipRouteType_other 1 +#define M2_ipRouteType_invalid 2 +#define M2_ipRouteType_direct 3 +#define M2_ipRouteType_indirect 4 + +/* possible values for ipRouteProto */ + +#define M2_ipRouteProto_other 1 +#define M2_ipRouteProto_local 2 +#define M2_ipRouteProto_netmgmt 3 +#define M2_ipRouteProto_icmp 4 +#define M2_ipRouteProto_egp 5 +#define M2_ipRouteProto_ggp 6 +#define M2_ipRouteProto_hello 7 +#define M2_ipRouteProto_rip 8 +#define M2_ipRouteProto_is_is 9 +#define M2_ipRouteProto_es_is 10 +#define M2_ipRouteProto_ciscoIgrp 11 +#define M2_ipRouteProto_bbnSpfIgp 12 +#define M2_ipRouteProto_ospf 13 +#define M2_ipRouteProto_bgp 14 + +/* possible values for ipNetToMediaType */ + +#define M2_ipNetToMediaType_other 1 +#define M2_ipNetToMediaType_invalid 2 +#define M2_ipNetToMediaType_dynamic 3 +#define M2_ipNetToMediaType_static 4 + +/* possible values for tcpRtoAlgorithm */ + +#define M2_tcpRtoAlgorithm_other 1 +#define M2_tcpRtoAlgorithm_constant 2 +#define M2_tcpRtoAlgorithm_rsre 3 +#define M2_tcpRtoAlgorithm_vanj 4 + +/* possible values for tcpConnState */ + +#define M2_tcpConnState_closed 1 +#define M2_tcpConnState_listen 2 +#define M2_tcpConnState_synSent 3 +#define M2_tcpConnState_synReceived 4 +#define M2_tcpConnState_established 5 +#define M2_tcpConnState_finWait1 6 +#define M2_tcpConnState_finWait2 7 +#define M2_tcpConnState_closeWait 8 +#define M2_tcpConnState_lastAck 9 +#define M2_tcpConnState_closing 10 +#define M2_tcpConnState_timeWait 11 +#define M2_tcpConnState_deleteTCB 12 + + +/* + * When using vxWorks SNMP this constants must have the same value as NEXT and + * EXACT + */ + +#define M2_EXACT_VALUE 0xA0 +#define M2_NEXT_VALUE 0xA1 + + + /* defines for IGMP varToSet */ +#define M2_var_igmpInterfaceQueryInterval 1 +#define M2_var_igmpInterfaceStatus 2 +#define M2_var_igmpInterfaceVersion 4 +#define M2_var_igmpInterfaceQueryMaxResponseTime 8 +#define M2_var_igmpInterfaceRobustness 16 +#define M2_var_igmpInterfaceLastMembQueryIntvl 32 + + + +/* IGMP defines from leaf.h generated file */ + +#define LEAF_igmpInterfaceIfIndex 1 +#define MIN_igmpInterfaceIfIndex 1L +#define MAX_igmpInterfaceIfIndex 2147483647L +#define LEAF_igmpInterfaceQueryInterval 2 +#define LEAF_igmpInterfaceStatus 3 +#define VAL_igmpInterfaceStatus_active 1L +#define VAL_igmpInterfaceStatus_notInService 2L +#define VAL_igmpInterfaceStatus_notReady 3L +#define VAL_igmpInterfaceStatus_createAndGo 4L +#define VAL_igmpInterfaceStatus_createAndWait 5L +#define VAL_igmpInterfaceStatus_destroy 6L +#define LEAF_igmpInterfaceVersion 4 +#define LEAF_igmpInterfaceQuerier 5 +#define LEAF_igmpInterfaceQueryMaxResponseTime 6 +#define LEAF_igmpInterfaceVersion1QuerierTimer 9 +#define LEAF_igmpInterfaceWrongVersionQueries 10 +#define LEAF_igmpInterfaceJoins 11 +#define LEAF_igmpInterfaceGroups 13 +#define LEAF_igmpInterfaceRobustness 14 +#define LEAF_igmpInterfaceLastMembQueryIntvl 15 +#define LEAF_igmpInterfaceProxyIfIndex 16 +#define MIN_igmpInterfaceProxyIfIndex 0L +#define MAX_igmpInterfaceProxyIfIndex 2147483647L +#define LEAF_igmpInterfaceQuerierUpTime 17 +#define LEAF_igmpInterfaceQuerierExpiryTime 18 +#define LEAF_igmpCacheAddress 1 +#define LEAF_igmpCacheIfIndex 2 +#define MIN_igmpCacheIfIndex 1L +#define MAX_igmpCacheIfIndex 2147483647L +#define LEAF_igmpCacheSelf 3 +#define VAL_igmpCacheSelf_true 1L +#define VAL_igmpCacheSelf_false 2L +#define LEAF_igmpCacheLastReporter 4 +#define LEAF_igmpCacheUpTime 5 +#define LEAF_igmpCacheExpiryTime 6 +#define LEAF_igmpCacheStatus 7 +#define VAL_igmpCacheStatus_active 1L +#define VAL_igmpCacheStatus_notInService 2L +#define VAL_igmpCacheStatus_notReady 3L +#define VAL_igmpCacheStatus_createAndGo 4L +#define VAL_igmpCacheStatus_createAndWait 5L +#define VAL_igmpCacheStatus_destroy 6L +#define LEAF_igmpCacheVersion1HostTimer 8 + + +/* simple type used for imitating 64 bit integers */ + +typedef struct ui64 + { + UINT high; + UINT low; + } UI64; + +/* + * UI64_ZERO - Zero a UI64 struct + * + * PARAMETERS: UI64 * Pointer to the object to be zeroed. + */ +#define UI64_ZERO(N) (N)->high = (N)->low = 0L + +/* + * UI64_ADD32 - Add a UINT to a UI64 + * + * PARAMETERS: UI64 * pointer to the object to be updated + * UINT the quantity to add in. + * + * RESTRICTIONS: This routine will wrap the object if necessary and not give + * any warning about having done so. + */ +#define UI64_ADD32(N, I) (N)->low += I; if ((N)->low < I) (N)->high++ + +/* + * UI64_SUB64 - Subtract two UI64s + * + * PARAMETERS: UI64 * the result goes here + * UI64 * Subtract from this object + * UI64 * the object to subtract + * + * RESTRICTIONS: This routine will wrap the object if necessary and not give + * any warning about having done so. + */ +#define UI64_SUB64(X, Y, Z) (X)->low = (Y)->low - (Z)->low; \ + (X)->high = (Y)->high - (Z)->high; \ + if ((X)->low > (Y)->low) (X)->high-- + +/* + * UI64_COPY - Copy one UI64 to another + * + * PARAMETERS: UI64 * the result goes here + * UI64 * copy from this object + */ +#define UI64_COPY(X, Y) (X)->low = (Y)->low; (X)->high = (Y)->high + +/* + * UI64_COMP - Compare two UI64s + * + * PARAMETERS: UI64 * The two objects to compare + * UI64 * + * + * RETURNS: < 0 if the first is smaller than the second + * > 0 if the first is greater than the second + * 0 if they are equal. + */ +#define UI64_COMP(X, Y) \ + (((X)->high == (Y)->high) ? \ + (((X)->low == (Y)->low) ? (0) : (((X)->low > (Y)->low) ? (1) : (-1))) : \ + (((X)->high > (Y)->high) ? (1) : (-1))) + + +typedef struct + { + long idLength; /* Length of the object identifier */ + long idArray [MAXOIDLENGTH]; /* Object Id numbers */ + + } M2_OBJECTID; + +typedef struct + { + long addrLength; /* Length of address */ + unsigned char phyAddress [MAXIFPHYADDR]; /* physical address value */ + + } M2_PHYADDR; + + +/* + * The structures that follow are based on the MIB-II RFC-1213. Each field in + * each of the structures has the same name as the name specified in by the RFC. + * Please refer to the RFC for a complete description of the variable and its + * semantics. + */ + + +/* System Group bit fields that map to variables that can be set */ + +#define M2SYSNAME 0x01 +#define M2SYSCONTACT 0x02 +#define M2SYSLOCATION 0x04 + +typedef struct + { + unsigned char sysDescr [M2DISPLAYSTRSIZE]; + M2_OBJECTID sysObjectID; + unsigned long sysUpTime; + unsigned char sysContact [M2DISPLAYSTRSIZE]; + unsigned char sysName [M2DISPLAYSTRSIZE]; + unsigned char sysLocation [M2DISPLAYSTRSIZE]; + long sysServices; + + } M2_SYSTEM; + + +/* Interface group variables */ + +typedef struct + { + long ifNumber; /* Number of Interfaces in the System */ + ULONG ifTableLastChange; /* Time the ifTable was last changed */ + ULONG ifStackLastChange; /* Time the stackTable was last changed */ + } M2_INTERFACE; + + +/* values as per RFC 1215 */ + +#define M2_LINK_DOWN_TRAP 2 +#define M2_LINK_UP_TRAP 3 + +#define M2_LINK_UP_DOWN_TRAP_ENABLED 1 +#define M2_LINK_UP_DOWN_TRAP_DISABLED 2 + +#define M2_PROMISCUOUS_MODE_ON 1 +#define M2_PROMISCUOUS_MODE_OFF 2 + +#define M2_CONNECTOR_PRESENT 1 +#define M2_CONNECTOR_NOT_PRESENT 2 + +typedef struct + { + int ifIndex; /* Unique value for each interface */ + char ifDescr [M2DISPLAYSTRSIZE]; /* Information about the interface */ + long ifType; /* Type of interface */ + long ifMtu; /* Max size of datagram for the interface */ + unsigned long ifSpeed; /* Interface's current bandwidth in bits/sec */ + M2_PHYADDR ifPhysAddress; /* Mac layer address of the interface */ + long ifAdminStatus; /* Desired state for the interface */ + long ifOperStatus; /* Current operational status of the interface */ + unsigned long ifLastChange; /* Value of sysUpTime when interface entered + its current operational state */ + unsigned long ifInOctets; /* Number of octets received on the interface */ + unsigned long ifInUcastPkts; /* Number of subnetwork-unicast packets + delivered to a higher-layer protocol */ + unsigned long ifInNUcastPkts; /* Number of non-unicast packets delivered + to a higher layer protocol */ + unsigned long ifInDiscards; /* Number of inbound packets discarded */ + unsigned long ifInErrors; /* Inbound packets that contained errors */ + unsigned long ifInUnknownProtos; /* Inbound packets discarded due to unknown + or unsupported protocol */ + unsigned long ifOutOctets; /* Number of octets transmitted on the interface */ + unsigned long ifOutUcastPkts; /* Number of packets transmitted to subnet + unicast address */ + unsigned long ifOutNUcastPkts; /* Number of packets sent to non-unicast + address */ + unsigned long ifOutDiscards; /* Number of outbound packets discarded */ + unsigned long ifOutErrors; /* Number of outbound packets that could not + be transmitted due to errors */ + unsigned long ifOutQLen; /* Length of output packet queue */ + M2_OBJECTID ifSpecific; /* Reference to MIB definitions specific to + particular media being used */ + } M2_INTERFACETBL; + +/* The RFC 2233 additions to the ifTable */ + +typedef struct + { + char ifName [M2DISPLAYSTRSIZE]; + ULONG ifInMulticastPkts; + ULONG ifInBroadcastPkts; + ULONG ifOutMulticastPkts; + ULONG ifOutBroadcastPkts; + UI64 ifHCInOctets; + UI64 ifHCInUcastPkts; + UI64 ifHCInMulticastPkts; + UI64 ifHCInBroadcastPkts; + UI64 ifHCOutOctets; + UI64 ifHCOutUcastPkts; + UI64 ifHCOutMulticastPkts; + UI64 ifHCOutBroadcastPkts; + UINT ifLinkUpDownTrapEnable; + ULONG ifHighSpeed; + UINT ifPromiscuousMode; + UINT ifConnectorPresent; + char ifAlias [M2DISPLAYSTRSIZE]; + ULONG ifCounterDiscontinuityTime; + } M2_2233TBL; + +/* Update Routines */ + +typedef struct M2_ID_S M2_ID; +typedef struct M2_IFSTACKTBL_S M2_IFSTACKTBL; +typedef STATUS (* M2_PKT_COUNT_RTN) (M2_ID *, UINT, UCHAR *, ULONG); +typedef STATUS (* M2_CTR_UPDATE_RTN) (M2_ID *, UINT, ULONG); +typedef STATUS (* M2_VAR_UPDATE_RTN) (M2_ID *, UINT, caddr_t); + +/* Combination of the above interface structs */ + +typedef struct + { + M2_INTERFACETBL mibIfTbl; /* the RFC 1213 objects */ + M2_2233TBL mibXIfTbl; /* the RFC 2233 extension */ + } M2_DATA; + +/* The interface table struct for RFC 2233 compliance */ + +struct M2_ID_S + { + M2_DATA m2Data; /* the interface table */ + M2_PKT_COUNT_RTN m2PktCountRtn; /* packet counter function */ + M2_CTR_UPDATE_RTN m2CtrUpdateRtn; /* counter increment function */ + M2_VAR_UPDATE_RTN m2VarUpdateRtn; /* variable update routine */ + }; + +/* The structure for the ifStack table as described in RFC 2233 */ + +struct M2_IFSTACKTBL_S + { + UINT index; /* The ifIndex */ + int status; /* status of relationship */ + struct M2_IFSTACKTBL_S * pNextLower; /* Pointer to the next relation */ + }; + +/* The structure for the ifRcv address table as described in RFC 2233 */ + +typedef struct M2_IFRCVADDRTBL_S + { + M2_PHYADDR ifRcvAddrAddr;/* The physical address for which + * system will accept pkts/frames + */ + int ifRcvAddrStatus; /* The rowStatus */ + int ifRcvAddrType; /* The address type */ + struct M2_IFRCVADDRTBL_S * pNextEntry; /* Next pointer */ + } M2_IFRCVADDRTBL; + +/* The structure for the ifIndex value and corresponding ifnet pointer */ + +typedef struct M2_IFINDEX_S + { + AVL_NODE ifNode; /* Node representing an if in AVL tree */ + int ifType; /* Interface type */ + int ifIndex; /* Unique value for each interface */ + M2_OBJECTID ifOid; /* I/F Object Id */ + void * pIfStats; /* Pointer to the driver specific + * structure + */ + M2_IFSTACKTBL * pNextLower; /* List of lower sub-layers */ + M2_IFRCVADDRTBL * pRcvAddr; /* rcvAddr list */ + + /* Ioctl to munge interface flags */ + /* Called from m2IfTblEntrySet to change the values in */ + /* the ifnet structure in a non-protocol-specific way. */ + /* Callbacks are bad for tor3 (so I've heard). */ + int (*ifIoctl) (struct socket*, u_long, caddr_t); + STATUS (*rcvAddrGet) (struct ifnet *, struct M2_IFINDEX_S *); + BOOL mibStyle; /* RFC2233 supported if true */ + } M2_IFINDEX; + +/* Structure to perform the set operation for if table */ + +typedef struct ifSetentry + { + unsigned int varToSet; + int ifIndex; + long ifAdminStatus; + UINT ifPromiscuousMode; + UINT ifLinkUpDownTrapEnable; + char ifAlias[M2DISPLAYSTRSIZE]; + } IF_SETENTRY; + +/* IP group bit fields that map to variables that can be set */ + +#define M2_IPFORWARDING 0x01 +#define M2_IPDEFAULTTTL 0x02 + +typedef struct + { + long ipForwarding; + long ipDefaultTTL; + unsigned long ipInReceives; + unsigned long ipInHdrErrors; + unsigned long ipInAddrErrors; + unsigned long ipForwDatagrams; + unsigned long ipInUnknownProtos; + unsigned long ipInDiscards; + unsigned long ipInDelivers; + unsigned long ipOutRequests; + unsigned long ipOutDiscards; + unsigned long ipOutNoRoutes; + long ipReasmTimeout; + unsigned long ipReasmReqds; + unsigned long ipReasmOKs; + unsigned long ipReasmFails; + unsigned long ipFragOKs; + unsigned long ipFragFails; + unsigned long ipFragCreates; + unsigned long ipRoutingDiscards; + + } M2_IP; + + +/* IP Address Table group */ + +typedef struct + { + unsigned long ipAdEntAddr; + long ipAdEntIfIndex; + unsigned long ipAdEntNetMask; + long ipAdEntBcastAddr; + long ipAdEntReasmMaxSize; + + } M2_IPADDRTBL; + +/* IP Routing Table group */ + +typedef struct + { + unsigned long ipRouteDest; + long ipRouteIfIndex; + long ipRouteMetric1; + long ipRouteMetric2; + long ipRouteMetric3; + long ipRouteMetric4; + unsigned long ipRouteNextHop; + long ipRouteType; + long ipRouteProto; + long ipRouteAge; + unsigned long ipRouteMask; + long ipRouteMetric5; + M2_OBJECTID ipRouteInfo; + + } M2_IPROUTETBL; + +/* IP route table entry bit fields that map to variables that can be set */ + +#define M2_IP_ROUTE_DEST 1 +#define M2_IP_ROUTE_NEXT_HOP 2 +#define M2_IP_ROUTE_TYPE 4 +#define M2_IP_ROUTE_MASK 8 + +/* IP Address Translation Table group */ + +typedef struct + { + long ipNetToMediaIfIndex; + M2_PHYADDR ipNetToMediaPhysAddress; + unsigned long ipNetToMediaNetAddress; + long ipNetToMediaType; + + } M2_IPATRANSTBL; + +/* ICMP group */ + +typedef struct + { + unsigned long icmpInMsgs; + unsigned long icmpInErrors; + unsigned long icmpInDestUnreachs; + unsigned long icmpInTimeExcds; + unsigned long icmpInParmProbs; + unsigned long icmpInSrcQuenchs; + unsigned long icmpInRedirects; + unsigned long icmpInEchos; + unsigned long icmpInEchoReps; + unsigned long icmpInTimestamps; + unsigned long icmpInTimestampReps; + unsigned long icmpInAddrMasks; + unsigned long icmpInAddrMaskReps; + unsigned long icmpOutMsgs; + unsigned long icmpOutErrors; + unsigned long icmpOutDestUnreachs; + unsigned long icmpOutTimeExcds; + unsigned long icmpOutParmProbs; + unsigned long icmpOutSrcQuenchs; + unsigned long icmpOutRedirects; + unsigned long icmpOutEchos; + unsigned long icmpOutEchoReps; + unsigned long icmpOutTimestamps; + unsigned long icmpOutTimestampReps; + unsigned long icmpOutAddrMasks; + unsigned long icmpOutAddrMaskReps; + + } M2_ICMP; + + +/* TCP Group */ + +typedef struct + { + long tcpRtoAlgorithm; + long tcpRtoMin; + long tcpRtoMax; + long tcpMaxConn; + unsigned long tcpActiveOpens; + unsigned long tcpPassiveOpens; + unsigned long tcpAttemptFails; + unsigned long tcpEstabResets; + unsigned long tcpCurrEstab; + unsigned long tcpInSegs; + unsigned long tcpOutSegs; + unsigned long tcpRetransSegs; + unsigned long tcpInErrs; + unsigned long tcpOutRsts; + + } M2_TCPINFO; + + +/* TCP Connection Table Entry */ + +typedef struct + { + long tcpConnState; + unsigned long tcpConnLocalAddress; + long tcpConnLocalPort; + unsigned long tcpConnRemAddress; + long tcpConnRemPort; + + } M2_TCPCONNTBL; + + +/* User Datagram Protocol Group */ + +typedef struct + { + unsigned long udpInDatagrams; + unsigned long udpNoPorts; + unsigned long udpInErrors; + unsigned long udpOutDatagrams; + + } M2_UDP; + +/* UDP Connection Table Entry */ + +typedef struct + { + unsigned long udpLocalAddress; + long udpLocalPort; + + } M2_UDPTBL; +/* IGMP */ +typedef struct + { + ULONG igmpInterfaceIfIndex; + ULONG igmpInterfaceQueryInterval; + ULONG igmpInterfaceStatus; + ULONG igmpInterfaceVersion; + ULONG igmpInterfaceQuerier; + ULONG igmpInterfaceQueryMaxResponseTime; + ULONG igmpInterfaceQuerierPresentTimeout; + ULONG igmpInterfaceLeaveEnabled; + ULONG igmpInterfaceVersion1QuerierTimer; + ULONG igmpInterfaceWrongVersionQueries; + ULONG igmpInterfaceJoins; + ULONG igmpInterfaceLeaves; + ULONG igmpInterfaceGroups; + ULONG igmpInterfaceRobustness; + ULONG igmpInterfaceQuerierUpTime; + ULONG igmpInterfaceLastMembQueryIntvl; + } M2_IGMP; + +typedef struct + { + ULONG igmpCacheAddress; + ULONG igmpCacheIfIndex; + ULONG igmpCacheSelf; /* was BOOLEAN */ + ULONG igmpCacheLastReporter; + ULONG igmpCacheUpTime; + ULONG igmpCacheExpiryTime; + ULONG igmpCacheStatus; + ULONG igmpCacheVersion1HostTimer; + } M2_IGMP_CACHE; + + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS m2SysInit (char * mib2SysDescr, char * mib2SysContact, + char * mib2SysLocation, M2_OBJECTID * pObjectId); + +extern STATUS m2SysGroupInfoGet (M2_SYSTEM * pSysInfo); +extern STATUS m2SysGroupInfoSet (unsigned int varToSet, M2_SYSTEM * pSysInfo); +extern STATUS m2SysDelete (void); + +extern M2_ID * m2IfAlloc (ULONG, UCHAR *, ULONG, ULONG, ULONG, char *, int); +extern STATUS m2IfFree (M2_ID *); +extern STATUS m2IfGenericPacketCount (M2_ID *, UINT, UCHAR *, ULONG); +extern STATUS m2IfCounterUpdate (M2_ID *, UINT, ULONG); +extern STATUS m2IfVariableUpdate (M2_ID *, UINT, caddr_t); +extern STATUS m2IfPktCountRtnInstall (M2_ID *, M2_PKT_COUNT_RTN); +extern STATUS m2IfCtrUpdateRtnInstall (M2_ID *, M2_CTR_UPDATE_RTN); +extern STATUS m2IfVarUpdateRtnInstall (M2_ID *, M2_VAR_UPDATE_RTN); +extern STATUS m2If8023PacketCount (M2_ID *, UINT, UCHAR *, ULONG); + +extern STATUS m2IfInit (FUNCPTR pTrapRtn, void * pTrapArg); +extern STATUS m2IfTableUpdate (struct ifnet *, UINT, + int (*func) (struct socket*, u_long, caddr_t), + STATUS (func2) (struct ifnet*, M2_IFINDEX*)); +extern STATUS m2IfGroupInfoGet (M2_INTERFACE * pIfInfo); +extern STATUS m2IfTblEntryGet (int search, void * pIfTblEntry); +extern STATUS m2IfTblEntrySet (void *); +extern STATUS m2IfStackTblUpdate (UINT lowerIndex, UINT higherIndex, int action); +extern STATUS m2IfStackEntryGet (int, int *, M2_IFSTACKTBL *); +extern STATUS m2IfStackEntrySet (int, M2_IFSTACKTBL *); +extern STATUS m2IfRcvAddrEntryGet (int, int *, M2_IFRCVADDRTBL *); +extern STATUS m2IfRcvAddrEntrySet (int, int, M2_IFRCVADDRTBL *); +extern STATUS m2IfDelete (void); + +extern STATUS m2IpInit (int maxRouteTableSize); +extern STATUS m2IpGroupInfoGet (M2_IP * pIpInfo); +extern STATUS m2IpGroupInfoSet (unsigned int varToSet, M2_IP * pIpInfo); + +extern STATUS + m2IpAddrTblEntryGet (int search, M2_IPADDRTBL * pIpAddrTblEnry); + +extern STATUS +m2IpRouteTblEntryGet (int search, M2_IPROUTETBL * pIpRouteTblEntry); + +extern STATUS +m2IpRouteTblEntrySet (int varToSet, M2_IPROUTETBL * pIpRouteTblEntry); + +extern STATUS + m2IpAtransTblEntryGet (int search, M2_IPATRANSTBL * pIpAtEntry); +extern STATUS + m2IpAtransTblEntrySet (M2_IPATRANSTBL * pIpAtEntry); +extern STATUS m2IpDelete (void); + +extern STATUS m2IcmpInit (void); +extern STATUS m2IcmpGroupInfoGet (M2_ICMP * pIcmpInfo); + +extern STATUS m2TcpInit (void); +extern STATUS m2TcpGroupInfoGet (M2_TCPINFO * pTcpInfo); + +extern STATUS m2TcpConnEntryGet (int search, M2_TCPCONNTBL * pTcpConnEntry); +extern STATUS m2TcpConnEntrySet (M2_TCPCONNTBL * pTcpConnEntry); + +extern STATUS m2UdpInit (void); +extern STATUS m2UdpGroupInfoGet (M2_UDP * pUdpInfo); + +extern STATUS m2UdpTblEntryGet (int search, M2_UDPTBL * pUdpEntry); +STATUS m2Init (char * mib2SysDescr, char * mib2SysContact, + char * mib2SysLocation, M2_OBJECTID * pMib2SysObjectId, + FUNCPTR pTrapRtn, void * pTrapArg, int maxRouteTableSize); +extern STATUS m2Delete (void); +extern STATUS m2TcpDelete (void); +extern STATUS m2UdpDelete (void); +extern STATUS m2IcmpDelete (void); +extern STATUS m2SetIfLastChange (int ifIndex); +extern STATUS m2IgmpInterfaceEntrySet(M2_IGMP *data, int varsToSet); +extern STATUS m2IgmpInterfaceEntryGet(M2_IGMP *data); +extern STATUS m2IgmpInterfaceEntryNextGet(M2_IGMP *data); +extern STATUS m2IgmpCacheEntryGet(M2_IGMP_CACHE *data); +extern STATUS m2IgmpCacheEntryNextGet(M2_IGMP_CACHE *data); +extern M2_IGMP_CACHE * igmpCacheEntry_first(void); +extern M2_IGMP_CACHE * igmpCacheEntry_next_inst(M2_IGMP_CACHE * data); +extern unsigned igmpCacheEntry_build_instance(M2_IGMP_CACHE * data, int * inst); + +#else /* __STDC__ */ + +extern STATUS m2SysInit (); +extern STATUS m2SysGroupInfoGet (); +extern STATUS m2SysGroupInfoSet (); +extern STATUS m2SysDelete (); +extern M2_ID * m2IfAlloc (); +extern STATUS m2IfFree (); +extern STATUS m2IfGenericPacketCount (); +extern STATUS m2IfCounterUpdate (); +extern STATUS m2IfVariableUpdate (); +extern STATUS m2IfPktCountRtnInstall (); +extern STATUS m2IfCtrUpdateRtnInstall (); +extern STATUS m2IfVarUpdateRtnInstall (); +extern STATUS m2If8023PacketCount (); +extern STATUS m2IfInit (); +extern STATUS m2IfTableUpdate (); +extern STATUS m2IfGroupInfoGet (); +extern STATUS m2IfTblEntryGet (); +extern STATUS m2IfTblEntrySet (); +extern STATUS m2IfStackTblUpdate (); +extern STATUS m2IfStackEntryGet (); +extern STATUS m2IfStackEntrySet (); +extern STATUS m2IfRcvAddrEntryGet (); +extern STATUS m2IfRcvAddrEntrySet (); +extern STATUS m2IfDelete (); +extern STATUS m2IpInit (); +extern STATUS m2IpGroupInfoGet (); +extern STATUS m2IpGroupInfoSet (); +extern STATUS m2IpAddrTblEntryGet (); +extern STATUS m2IpRouteTblEntryGet (); +extern STATUS m2IpRouteTblEntrySet (); +extern STATUS m2IpAtransTblEntryGet (); +extern STATUS m2IpAtransTblEntrySet (); +extern STATUS m2IpDelete (); +extern STATUS m2IcmpInit (); +extern STATUS m2IcmpGroupInfoGet (); +extern STATUS m2TcpInit (); +extern STATUS m2TcpGroupInfoGet (); +extern STATUS m2TcpConnEntryGet (); +extern STATUS m2TcpConnEntrySet (); +extern STATUS m2UdpInit (); +extern STATUS m2UdpGroupInfoGet (); +extern STATUS m2UdpTblEntryGet (); +extern STATUS m2Init (); +extern STATUS m2Delete (); +extern STATUS m2TcpDelete (); +extern STATUS m2UdpDelete (); +extern STATUS m2IcmpDelete (); +extern STATUS m2SetIfLastChange (); +extern STATUS m2IgmpInterfaceEntrySet(); +extern STATUS m2IgmpInterfaceEntryGet(); +extern STATUS m2IgmpInterfaceEntryNextGet(); +extern STATUS m2IgmpCacheEntryGet(); +extern STATUS m2IgmpCacheEntryNextGet(); +extern M2_IGMP_CACHE * igmpCacheEntry_first(); +extern M2_IGMP_CACHE * igmpCacheEntry_next_inst(); +extern unsigned igmpCacheEntry_build_instance(); +#endif /* __STDC__ */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm2Libh */ diff --git a/h/make/README.TXT b/h/make/README.TXT new file mode 100644 index 0000000..cb61205 --- /dev/null +++ b/h/make/README.TXT @@ -0,0 +1,63 @@ + README.TXT for target/h/make Directory + -------------------------------------- + +There are makefile fragments that are copied here during the install +process that are to be used for backward compatibility with older versions +of third party products. Please do not refer to these files nor use these +files for building your runtime objects or executable. + +The files copied to this directory for backward compatibiltiy are: + +defs.arm +defs.gnu +defs.mips +make.ARMARCH4_Tgnu +make.ARMARCH4_Tgnube +make.ARMARCH4gnu +make.ARMARCH4gnube +make.ARMARCH5_Tgnu +make.ARMARCH5_Tgnube +make.ARMARCH5gnu +make.ARMARCH5gnube +make.CPU32gnu +make.FR500gnu +make.I80386gnu +make.I80486gnu +make.MC68000gnu +make.MC68010gnu +make.MC68020gnu +make.MC68040gnu +make.MC68060gnu +make.MC68LC040gnu +make.MCF5200gnu +make.MCF5400gnu +make.MCORE15gnu +make.MIPS32gnu +make.MIPS32gnule +make.MIPS32sfgnu +make.MIPS32sfgnule +make.MIPS32sfr3kgnu +make.MIPS64gnu +make.MIPS64gnule +make.PENTIUM2gnu +make.PENTIUM3gnu +make.PENTIUM4gnu +make.PENTIUMgnu +make.PPC403gnu +make.PPC405gnu +make.PPC440gnu +make.PPC603gnu +make.PPC604gnu +make.PPC860gnu +make.SH7600gnu +make.SH7700gnu +make.SH7700gnule +make.SH7750gnu +make.SH7750gnule +make.SIMNTgnu +make.SIMSPARCSOLARISgnu +make.STRONGARMgnu +make.STRONGARMgnube +make.XSCALEgnu +make.XSCALEgnube +toolMacros.h diff --git a/h/make/config/comps/coreip/defs.default b/h/make/config/comps/coreip/defs.default new file mode 100644 index 0000000..65ea1ec --- /dev/null +++ b/h/make/config/comps/coreip/defs.default @@ -0,0 +1,48 @@ +# defs.default - Core IP (coreIP) specific default make defines. +# +# Copyright 1996-2004 Wind River Systems, Inc. +# +# # modification history +# -------------------- +# 00e,19oct04,tf Add -DWRS_IPSEC option if FEATURE_COREIP_IPSEC is set to +# true (BaseMSP-B0336). +# 00d,11sep04,tf Add -DINCLUDE_IPFW_HOOKS option if FEATURE_COREIP_IPFW_HOOKS is +# set to true (BaseMSP-B0146). Also commented out lines for +# FEATURE_COREIP_VIRTUAL and FEATURE_COREIP_IPV6. Replaced +# ADDED_CFLAGS with EXTRA_DEFINE. +# 00c,18apr04,tf Removed FEATURE_COREIP_IPV6 conditional; used 'override' +# instead of 'export' to extend ADDED_CFLAGS variable. +# 00b,30apr04,blc Created macros for ROUTER and IPV6. +# 00a,03mar04,tf Created. +# +# DESCRIPTION +# This file defines any macros that are used in configuring coreIp for specific +# features. A given feature that includes coreIp needs to set the appropriate +# deature macro to 'true' so that coreIp is configured for that feature. This +# is done in $TGT_DIR)/h/make/config/featureSet/$(FEATURE_SET)/defs.defaults. +# +TGT_DIR=$(WIND_BASE)/target + +ifeq ($(EXTRA_DEFINE),) +export EXTRA_DEFINE = +endif + +ifeq ($(FEATURE_COREIP_IPFW_HOOKS),true) +override EXTRA_DEFINE+=-DINCLUDE_IPFW_HOOKS +endif + +ifeq ($(FEATURE_COREIP_ROUTER),true) +override EXTRA_DEFINE+=-DROUTER_STACK +endif + +ifeq ($(FEATURE_COREIP_VIRTUAL),true) +override EXTRA_DEFINE+=-DVIRTUAL_STACK +endif + +ifeq ($(FEATURE_COREIP_IPV6),true) +override EXTRA_DEFINE+=-DINET6 +endif + +ifeq ($(FEATURE_COREIP_IPSEC),true) +override EXTRA_DEFINE+=-DWRS_IPSEC +endif diff --git a/h/make/config/comps/coreip/defs.docs b/h/make/config/comps/coreip/defs.docs new file mode 100644 index 0000000..a0d5497 --- /dev/null +++ b/h/make/config/comps/coreip/defs.docs @@ -0,0 +1,29 @@ +# defs.docs - makefile fragment for specifying documentation parameters +# +# modification history +# -------------------- +# 01d,12sep05,vvv updated version number +# 01c,29apr05,kkz Updating for new directory paths +# 01b,27oct04,tpw Force apigen for Medusa doc builds. +# 01a,26oct04,tpw created +# +# DESCRIPTION +# This file contains settings to configure the documentation build for the +# networking stack component kernel side. A companion file exists for user +# mode: $(WIND_BASE)/target/usr/make/config/comps/coreip/defs.docs + +include $(WIND_BASE)/target/h/make/config/defs.version + +ifeq ($(KERNEL_MAJOR_VERSION),6) + +DOC_DIR = $(DOCS_ROOT)/com.windriver.ide.doc.wr_net_stack/wr_net_stack_kernel_api_reference_3.0 +DOC_BOOK = Wind_River_Network_Stack_3.0 +DOC_CHAPTER = Wind_River_Network_Stack_Kernel_API + +else + +# Force apigen for Medusa doc build. Only needed on kernel side. +# +REFGEN_SH = $(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen -nostrict -missingok + +endif diff --git a/h/make/config/comps/coreip/defs.subdirs b/h/make/config/comps/coreip/defs.subdirs new file mode 100644 index 0000000..491cfb2 --- /dev/null +++ b/h/make/config/comps/coreip/defs.subdirs @@ -0,0 +1,51 @@ +# defs.subdirs - Core IP (coreIP) specific SUBDIR definition. +# +# Copyright 1996-2004 Wind River Systems, Inc. +# +# # modification history +# -------------------- +# 00c,08jul04,tf Fix Base B0006: make rclean broken on Windows. +# 00b,09jun04,tf Added drv/wdb to SUBDIRS. +# 00a,03mar04,tf Written. +# +# DESCRIPTION +# This file defines the list of subdirs to be built for coreIp. This +# file is included by '$(WIND_BASE)/target/h/make/config/common/defs.subdirs' +# if the feature set being built includes coreIp comps +# (i.e., if COMPONENT_CORE_IP==true). +# +# Note that SUBDIRS is extended to include coreIp sub-directories. +# + +TGT_DIR=$(WIND_BASE)/target + +# The dual stack is included; build the new coreIp way. + +export COREIP_BASE=$(TGT_DIR)/src/wrn/coreip + +ifneq ($(patsubst %/,%, $(dir $(wildcard $(TGT_DIR)/src/drv/end/Makefile))),) +SUBDIRS += drv/end +endif + +ifneq ($(patsubst %/,%, $(dir $(wildcard $(TGT_DIR)/src/rpc/Makefile))),) +SUBDIRS += rpc +endif + +ifneq ($(patsubst %/,%, $(dir $(wildcard $(TGT_DIR)/src/drv/wdb/Makefile))),) +SUBDIRS += drv/wdb +endif + +ifneq ($(COREIP_BASE),) +SUBDIRS += wrn/coreip +endif + +### +# +# This lines were commented out because of a 'make rclean' problem on a +# Windows host (SPR #99176) +# +# END_DIR = $(patsubst %/,%, $(dir $(wildcard $(TGT_DIR)/src/drv/end/Makefile))) +# RPC_DIR = $(patsubst %/,%, $(dir $(wildcard $(TGT_DIR)/src/rpc/Makefile))) +# WDB_DIR = $(patsubst %/,%, $(dir $(wildcard $(TGT_DIR)/src/drv/wdb/Makefile))) +# +# SUBDIRS += $(RPC_DIR) $(END_DIR) $(WDB_DIR) $(COREIP_BASE) diff --git a/h/make/config/comps/coreip/rules.default b/h/make/config/comps/coreip/rules.default new file mode 100644 index 0000000..0d3eb37 --- /dev/null +++ b/h/make/config/comps/coreip/rules.default @@ -0,0 +1,12 @@ +# rules.default - Core IP (coreIp) specific default make rules. +# +# Copyright 1996-2004 Wind River Systems, Inc. +# +# # modification history +# -------------------- +# 00a,03mar04,tf Created. +# +# DESCRIPTION +# This file is provided if coreIp specific make rules are required. +# +TGT_DIR=$(WIND_BASE)/target diff --git a/h/make/config/comps/dot1x/defs.default b/h/make/config/comps/dot1x/defs.default new file mode 100644 index 0000000..bb836e8 --- /dev/null +++ b/h/make/config/comps/dot1x/defs.default @@ -0,0 +1,15 @@ +# defs.default - DOT1X (dot1x) specific default make defines. +# +# Copyright 1996-2004 Wind River Systems, Inc. +# +# # modification history +# -------------------- +# 00a,03mar04,tf Created. +# +# DESCRIPTION +# This file defines any macros that are used in configuring dot1x for specific +# features. A given feature that includes dot1x needs to set the appropriate +# deature macro to 'true' so that dot1x is configured for that feature. This +# is done in $TGT_DIR)/h/make/config/featureSet/$(FEATURE_SET)/defs.defaults. +# +TGT_DIR=$(WIND_BASE)/target diff --git a/h/make/config/comps/dot1x/defs.docs b/h/make/config/comps/dot1x/defs.docs new file mode 100644 index 0000000..50e3f8e --- /dev/null +++ b/h/make/config/comps/dot1x/defs.docs @@ -0,0 +1,28 @@ +# defs.docs - makefile fragment for specifying documentation parameters +# +# modification history +# -------------------- +# 01c,13sep05,rb Updated version numbers +# 01b,30may05,tpw Add -set KERNEL for Argus doc build. +# 01a,12may05,tpw created +# +# DESCRIPTION +# This file contains settings to configure the documentation build for the +# wireless security component. + +include $(WIND_BASE)/target/h/make/config/defs.version + +ifeq ($(KERNEL_MAJOR_VERSION),6) + +DOC_DIR = $(DOCS_ROOT)/com.windriver.ide.doc.wr_wireless_security/wr_wireless_security_api_reference_2.1 +DOC_BOOK = Wind_River_Wireless_Security_2.1 +DOC_CHAPTER = Wind_River_Wireless_Security_API_Reference,_2.1 + +else + +# Force apigen for VxWorks 5.x doc build. Only needed on kernel side. +# +REFGEN_SH = $(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen \ + -nostrict -missingok -set KERNEL + +endif diff --git a/h/make/config/comps/dot1x/defs.subdirs b/h/make/config/comps/dot1x/defs.subdirs new file mode 100644 index 0000000..aba5f00 --- /dev/null +++ b/h/make/config/comps/dot1x/defs.subdirs @@ -0,0 +1,23 @@ +# defs.subdirs - DOT1X (dot1x) specific SUBDIR definition. +# +# Copyright 1996-2004 Wind River Systems, Inc. +# +# # modification history +# -------------------- +# 00b,08jul04,tf Fix Base B0007: Uninstalled comps should not be compiled. +# 00a,03mar04,tf Written. +# +# DESCRIPTION +# This file defines the list of subdirs to be built for dot1x. This +# file is included by '$(WIND_BASE)/target/h/make/config/common/defs.subdirs' +# if the feature set being built includes dot1x comps +# (i.e., if COMPONENT_DOT1X==true). +# +# Note that SUBDIRS is extended to include dot1x sub-directories. +# + +TGT_DIR=$(WIND_BASE)/target + +ifneq ($(patsubst %/,%, $(dir $(wildcard $(TGT_DIR)/src/wrn/dot1x/Makefile))),) +SUBDIRS += wrn/dot1x +endif diff --git a/h/make/config/comps/dot1x/rules.default b/h/make/config/comps/dot1x/rules.default new file mode 100644 index 0000000..48db49c --- /dev/null +++ b/h/make/config/comps/dot1x/rules.default @@ -0,0 +1,12 @@ +# rules.default - DOT1X (dot1x) specific default make rules. +# +# Copyright 1996-2004 Wind River Systems, Inc. +# +# # modification history +# -------------------- +# 00a,03mar04,tf Created. +# +# DESCRIPTION +# This file is provided if dot1x specific make rules are required. +# +TGT_DIR=$(WIND_BASE)/target diff --git a/h/make/config/comps/ipSec/defs.default b/h/make/config/comps/ipSec/defs.default new file mode 100644 index 0000000..72f9c6f --- /dev/null +++ b/h/make/config/comps/ipSec/defs.default @@ -0,0 +1,130 @@ +# defs.default - IPSEC specific default make defines. +# +# Copyright 1996-2004 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 00c,10jun05,djp Added default feature values +# 00c,12may05,rob Added more IPsec features +# 00b,10may05,rob Added IPsec features +# 00a,03mar04,tf Created. +# +# DESCRIPTION +# This file defines any macros that are used in configuring IPSEC for specific +# features. A given feature that includes IPSEC needs to set the appropriate +# deature macro to 'true' so thato IPSEC is configured for that feature. This +# is done in $(TGT_DIR)/h/make/config/featureSet/$(FEATURE_SET)/defs.defaults. +# +ifeq ($(TGT_DIR),) +TGT_DIR=$(WIND_BASE)/target +endif + +# +# Set feature options +# +# A feature is enabled by setting the applicable value to true +# + +export FEATURE_IPSEC_CERTIFICATES = true +export FEATURE_IPSEC_NO_CERT_CHAIN = false +export FEATURE_IPSEC_COUNTERS_IPSEC = true +export FEATURE_IPSEC_COUNTERS_IKE = true +export FEATURE_IPSEC_LOGGING = true +export FEATURE_IPSEC_SEND_INITIAL_CONTACT = true +export FEATURE_IPSEC_MEMORY_ROUTINES = false +export FEATURE_IPSEC_PMTU = true +export FEATURE_IPSEC_QUEUING = false +export FEATURE_WRN_SUPPRESS_INBOUND_MONOTONIC_PADDING_CHECK = false +export FEATURE_IKE_PASSIVE_RESPONDER = true + +# Inherit network stack related configuration +# If network stack is not part of this compilation, then +# use default values (false for both) + +ifeq ($(FEATURE_COREIP_IPV6),true) +export FEATURE_IPSEC_IPV6 = true +else +# Default Value: +export FEATURE_IPSEC_IPV6 = false +endif +ifeq ($(FEATURE_COREIP_VIRTUAL),true) +export FEATURE_IPSEC_VIRTUAL_STACK = true +else +# Default Value: +export FEATURE_IPSEC_VIRTUAL_STACK = false +endif + +# +# Virtual stack is not valid in user SPACE, so ensure it +# is turned off. +# + +ifeq ($(SPACE),user) +export FEATURE_IPSEC_VIRTUAL_STACK = false +endif +ifeq ($(SPACE),USER) +export FEATURE_IPSEC_VIRTUAL_STACK = false +endif + +# +# At this point we have the feature set values set. Next +# convert feature values to compile time definitions +# + +ifeq ($(EXTRA_DEFINE),) +export EXTRA_DEFINE = +endif + +override EXTRA_DEFINE+=-DWRS_IPSEC + +ifeq ($(FEATURE_IPSEC_CERTIFICATES),true) +override EXTRA_DEFINE+=-DIKE_CERTIFICATE_SUPPORT +endif + +ifeq ($(FEATURE_IPSEC_NO_CERT_CHAIN),true) +override EXTRA_DEFINE+=-DNO_IKE_CERT_CHAIN +endif + +ifeq ($(FEATURE_IPSEC_COUNTERS_IPSEC),true) +override EXTRA_DEFINE+=-DINCLUDE_COUNTERS_IPSEC +endif + +ifeq ($(FEATURE_IPSEC_COUNTERS_IKE),true) +override EXTRA_DEFINE+=-DINCLUDE_COUNTERS_IKE +endif + +ifeq ($(FEATURE_IPSEC_LOGGING),true) +override EXTRA_DEFINE+=-DINCLUDE_LOGGING_IPSEC +endif + +ifeq ($(FEATURE_IPSEC_SEND_INITIAL_CONTACT),true) +override EXTRA_DEFINE+=-DIKE_ALWAYS_SEND_INITIAL_CONTACT +endif + +ifeq ($(FEATURE_IPSEC_MEMORY_ROUTINES),true) +override EXTRA_DEFINE+=-DINCLUDE_IPSEC_MEMORY_ROUTINES +endif + +ifeq ($(FEATURE_IPSEC_PMTU),true) +override EXTRA_DEFINE+=-DIPSEC_PMTU +endif + +ifeq ($(FEATURE_IPSEC_QUEUING),true) +override EXTRA_DEFINE+=-D__IPSEC_QUEUING__ +endif + +ifeq ($(FEATURE_IPSEC_IPV6),true) +override EXTRA_DEFINE+=-DINET6 +endif + +ifeq ($(FEATURE_IPSEC_VIRTUAL_STACK),true) +override EXTRA_DEFINE+=-DVIRTUAL_STACK +endif + +ifeq ($(FEATURE_IPSEC_SUPPRESS_INBOUND_MONOTONIC_PADDING_CHECK),true) +override EXTRA_DEFINE+=-DWRN_SUPPRESS_INBOUND_MONOTONIC_PADDING_CHECK +endif + +ifeq ($(FEATURE_IKE_PASSIVE_RESPONDER),true) +override EXTRA_DEFINE+=-DIKE_PASSIVE_RESPONDER +endif diff --git a/h/make/config/comps/ipSec/defs.docs b/h/make/config/comps/ipSec/defs.docs new file mode 100644 index 0000000..0bede23 --- /dev/null +++ b/h/make/config/comps/ipSec/defs.docs @@ -0,0 +1,28 @@ +# defs.docs - makefile fragment for specifying documentation parameters +# +# modification history +# -------------------- +# 01c,15sep05,lll Update to version 3.2 +# 01b,30may05,tpw Add -set KERNEL for Argus doc build. +# 01a,12may05,tpw created +# +# DESCRIPTION +# This file contains settings to configure the documentation build for the +# Ipsec and IKE component. + +include $(WIND_BASE)/target/h/make/config/defs.version + +ifeq ($(KERNEL_MAJOR_VERSION),6) + +DOC_DIR = $(DOCS_ROOT)/com.windriver.ide.doc.wr_ipsec_ike/wr_ipsec_ike_api_reference_3.2 +DOC_BOOK = Wind_River_IPsec_and_IKE_3.2 +DOC_CHAPTER = Wind_River_IPsec_and_IKE_API_Reference,_3.2 + +else + +# Force apigen for VxWorks 5.x doc build. Only needed on kernel side. +# +REFGEN_SH = $(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen \ + -nostrict -missingok -set KERNEL + +endif diff --git a/h/make/config/comps/ipSec/defs.subdirs b/h/make/config/comps/ipSec/defs.subdirs new file mode 100644 index 0000000..7d7d754 --- /dev/null +++ b/h/make/config/comps/ipSec/defs.subdirs @@ -0,0 +1,23 @@ +# defs.subdirs - IPSEC specific SUBDIR definition. +# +# Copyright 1996-2004 Wind River Systems, Inc. +# +# # modification history +# -------------------- +# 00b,08jul04,tf Fix Base B0007: Uninstalled comps should not be compiled. +# 00a,03mar04,tf Written. +# +# DESCRIPTION +# This file defines the list of subdirs to be built for IPSEC. This +# file is included by '$(WIND_BASE)/target/h/make/config/common/defs.subdirs' +# if the feature set being built includes IPSEC comps +# (i.e., if COMPONENT_IPSEC==true). +# +# Note that SUBDIRS is extended to include IPSEC sub-directories. +# + +TGT_DIR=$(WIND_BASE)/target + +ifneq ($(patsubst %/,%, $(dir $(wildcard $(TGT_DIR)/src/wrn/ipsec-ike/Makefile))),) +SUBDIRS += wrn/ipsec-ike +endif diff --git a/h/make/config/comps/ipSec/rules.default b/h/make/config/comps/ipSec/rules.default new file mode 100644 index 0000000..3cbf7d5 --- /dev/null +++ b/h/make/config/comps/ipSec/rules.default @@ -0,0 +1,12 @@ +# rules.default - IPSEC specific default make rules. +# +# Copyright 1996-2004 Wind River Systems, Inc. +# +# # modification history +# -------------------- +# 00a,03mar04,tf Created. +# +# DESCRIPTION +# This file is provided if IPSEC specific make rules are required. +# +TGT_DIR=$(WIND_BASE)/target diff --git a/h/make/config/comps/ppp/defs.default b/h/make/config/comps/ppp/defs.default new file mode 100644 index 0000000..f68adf1 --- /dev/null +++ b/h/make/config/comps/ppp/defs.default @@ -0,0 +1,25 @@ +# defs.default - PPP specific default make defines. +# +# Copyright 1996-2004 Wind River Systems, Inc. +# +# # modification history +# -------------------- +# 00b,09jul04,tf Fix Base MSP B0217: Remove dependency on SNMP. +# 00a,03mar04,tf Created. +# +# DESCRIPTION +# This file defines any macros that are used in configuring PPP for specific +# features. A given feature that includes PPP needs to set the appropriate +# deature macro to 'true' so that PPP is configured for that feature. This +# is done in $TGT_DIR)/h/make/config/featureSet/$(FEATURE_SET)/defs.defaults. +# +TGT_DIR=$(WIND_BASE)/target + +## +# SNMP has to be built if PPP is included +# +# +# PPP is no longer dependent on SNMP. +# ifneq ($(COMPONENT_SNMP),true) +# export COMPONENT_SNMP=true +# endif diff --git a/h/make/config/comps/ppp/defs.docs b/h/make/config/comps/ppp/defs.docs new file mode 100644 index 0000000..db4c5e8 --- /dev/null +++ b/h/make/config/comps/ppp/defs.docs @@ -0,0 +1,25 @@ +# defs.docs - makefile fragment for specifying documentation parameters +# +# modification history +# -------------------- +# 01a,14sep05,ijm created +# +# DESCRIPTION +# This file contains settings to configure the documentation build for the +# PPP component kernel side. + +include $(WIND_BASE)/target/h/make/config/defs.version + +ifeq ($(KERNEL_MAJOR_VERSION),6) + +DOC_DIR = $(DOCS_ROOT)/com.windriver.ide.doc.wr_ppp/wr_ppp_kernel_api_reference_2.2 +DOC_BOOK = Wind_River_PPP_Kernel_API_Reference_2.2 +DOC_CHAPTER = Wind_River_PPP_API + +else + +# Force apigen for VxWorks 5.x doc build. Only needed on kernel side. +# +REFGEN_SH = $(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen -nostrict -missingok + +endif diff --git a/h/make/config/comps/ppp/defs.subdirs b/h/make/config/comps/ppp/defs.subdirs new file mode 100644 index 0000000..eed29b2 --- /dev/null +++ b/h/make/config/comps/ppp/defs.subdirs @@ -0,0 +1,28 @@ +# defs.subdirs - PPP specific SUBDIR definition. +# +# Copyright 1996-2004 Wind River Systems, Inc. +# +# # modification history +# -------------------- +# 00b,08jul04,tf Fix Base B0007: Uninstalled comps should not be compiled. +# 00a,03mar04,tf Written. +# +# DESCRIPTION +# This file defines the list of subdirs to be built for PPP. This +# file is included by '$(WIND_BASE)/target/h/make/config/common/defs.subdirs' +# if the feature set being built includes PPP +# (i.e., if COMPONENT_PPP==true). +# +# Note that SUBDIRS is extended to include coreIp sub-directories. +# +TGT_DIR=$(WIND_BASE)/target + +ifneq ($(patsubst %/,%, $(dir $(wildcard $(TGT_DIR)/src/ppp/Makefile))),) + +ifneq ($(patsubst %/,%, $(dir $(wildcard $(TGT_DIR)/src/pfw/Makefile))),) +SUBDIRS += pfw +endif + +SUBDIRS += ppp + +endif diff --git a/h/make/config/comps/ppp/rules.default b/h/make/config/comps/ppp/rules.default new file mode 100644 index 0000000..7a86cbf --- /dev/null +++ b/h/make/config/comps/ppp/rules.default @@ -0,0 +1,12 @@ +# rules.default - PPP specific default make rules. +# +# Copyright 1996-2004 Wind River Systems, Inc. +# +# # modification history +# -------------------- +# 00a,03mar04,tf Created. +# +# DESCRIPTION +# This file is provided if PPP specific make rules are required. +# +TGT_DIR=$(WIND_BASE)/target diff --git a/h/make/config/comps/radius/defs.default b/h/make/config/comps/radius/defs.default new file mode 100644 index 0000000..c915233 --- /dev/null +++ b/h/make/config/comps/radius/defs.default @@ -0,0 +1,15 @@ +# defs.default - RADIUS specific default make defines. +# +# Copyright 1996-2004 Wind River Systems, Inc. +# +# # modification history +# -------------------- +# 00a,03mar04,tf Created. +# +# DESCRIPTION +# This file defines any macros that are used in configuring RADIUS for specific +# features. A given feature that includes RADIUS needs to set the appropriate +# deature macro to 'true' so that RADIUS is configured for that feature. This +# is done in $TGT_DIR)/h/make/config/featureSet/$(FEATURE_SET)/defs.defaults. +# +TGT_DIR=$(WIND_BASE)/target diff --git a/h/make/config/comps/radius/defs.docs b/h/make/config/comps/radius/defs.docs new file mode 100644 index 0000000..7ae86d9 --- /dev/null +++ b/h/make/config/comps/radius/defs.docs @@ -0,0 +1,29 @@ +# defs.docs - makefile fragment for specifying documentation parameters +# +# modification history +# -------------------- +# 01d,13sep05,ijm Update RADIUS release to 1.3 +# 01c,30may05,tpw Specify kernel-only in VxWorks 6 manual name. +# 01b,30may05,tpw Add -set KERNEL for Argus doc build. +# 01a,12may05,tpw created +# +# DESCRIPTION +# This file contains settings to configure the documentation build for the +# RADIUS Client component. + +include $(WIND_BASE)/target/h/make/config/defs.version + +ifeq ($(KERNEL_MAJOR_VERSION),6) + +DOC_DIR = $(DOCS_ROOT)/com.windriver.ide.doc.wr_radius_client/wr_radius_client_kernel_api_reference_1.3 +DOC_BOOK = Wind_River_RADIUS_Client_1.3 +DOC_CHAPTER = Wind_River_RADIUS_Client_Kernel_API_Reference,_1.3 + +else + +# Force apigen for VxWorks 5.x doc build. Only needed on kernel side. +# +REFGEN_SH = $(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen \ + -nostrict -missingok -set KERNEL + +endif diff --git a/h/make/config/comps/radius/defs.subdirs b/h/make/config/comps/radius/defs.subdirs new file mode 100644 index 0000000..51cd2c3 --- /dev/null +++ b/h/make/config/comps/radius/defs.subdirs @@ -0,0 +1,51 @@ +# defs.subdirs - RADIUS specific SUBDIR definition. +# +# Copyright 1996-2004 Wind River Systems, Inc. +# +# # modification history +# -------------------- +# 00b,08jul04,tf Fix Base B0007: Uninstalled comps should not be compiled. +# 00a,03mar04,tf Written. +# +# DESCRIPTION +# This file defines the list of subdirs to be built for RADIUS. This +# file is included by '$(WIND_BASE)/target/h/make/config/common/defs.subdirs' +# if the feature set being built includes RADIUS comps +# (i.e., if COMPONENT_RADIUS==true). +# +# Note that SUBDIRS is extended to include RADIUS sub-directories. +# + +TGT_DIR=$(WIND_BASE)/target + +### +# If RADIUS is not installed, donot build any of the other directories. +# +ifneq ($(patsubst %/,%, $(dir $(wildcard $(TGT_DIR)/src/wrn/radius/Makefile))),) +SUBDIRS += wrn/radius + +ifneq ($(patsubst %/,%, $(dir $(wildcard $(TGT_DIR)/src/wrn/nvram/Makefile))),) +SUBDIRS += wrn/nvram +endif + +ifneq ($(patsubst %/,%, $(dir $(wildcard $(TGT_DIR)/src/wrn/rwos/Makefile))),) +SUBDIRS += wrn/rwos +endif + +ifneq ($(patsubst %/,%, $(dir $(wildcard $(TGT_DIR)/src/wrn/rwutils/Makefile))),) +SUBDIRS += wrn/rwutils +endif +endif + +### +# +# This lines were commented out because of a 'make rclean' problem on a +# Windows host (SPR #99176) and to avoid compilation if RADIUS is not +# installed (Base B0007). +# +# RADIUS_DIRS = $(TGT_DIR)/src/wrn/radius \ +# $(TGT_DIR)/src/wrn/nvram \ +# $(TGT_DIR)/src/wrn/rwos \ +# $(TGT_DIR)/src/wrn/rwutils +# +# SUBDIRS += $(RADIUS_DIRS) diff --git a/h/make/config/comps/radius/rules.default b/h/make/config/comps/radius/rules.default new file mode 100644 index 0000000..29b11b9 --- /dev/null +++ b/h/make/config/comps/radius/rules.default @@ -0,0 +1,12 @@ +# rules.default - RADIUS specific default make rules. +# +# Copyright 1996-2004 Wind River Systems, Inc. +# +# # modification history +# -------------------- +# 00a,03mar04,tf Created. +# +# DESCRIPTION +# This file is provided if RADIUS specific make rules are required. +# +TGT_DIR=$(WIND_BASE)/target diff --git a/h/make/config/comps/security/defs.default b/h/make/config/comps/security/defs.default new file mode 100644 index 0000000..18b3848 --- /dev/null +++ b/h/make/config/comps/security/defs.default @@ -0,0 +1,16 @@ +# defs.default - Security specific default make defines. +# +# Copyright 1996-2004 Wind River Systems, Inc. +# +# # modification history +# -------------------- +# 01a,08feb05,tf Created. +# +# DESCRIPTION +# This file defines any macros that are used in configuring Security for +# specific features. A given feature that includes Security needs to set the +# appropriate deature macro to 'true' so that Security is configured for that +# feature. This is done in +# $TGT_DIR)/h/make/config/featureSet/$(FEATURE_SET)/defs.defaults. +# +TGT_DIR=$(WIND_BASE)/target diff --git a/h/make/config/comps/security/defs.docs b/h/make/config/comps/security/defs.docs new file mode 100644 index 0000000..d6cf44a --- /dev/null +++ b/h/make/config/comps/security/defs.docs @@ -0,0 +1,28 @@ +# defs.docs - makefile fragment for specifying documentation parameters +# +# modification history +# -------------------- +# 01c,13sep05,cdw updated component version +# 01b,30may05,tpw Add -set KERNEL for Argus doc build. +# 01a,12may05,tpw created +# +# DESCRIPTION +# This file contains settings to configure the documentation build for the +# Security Libraries component. + +include $(WIND_BASE)/target/h/make/config/defs.version + +ifeq ($(KERNEL_MAJOR_VERSION),6) + +DOC_DIR = $(DOCS_ROOT)/com.windriver.ide.doc.wr_security_libraries/wr_security_libraries_api_reference_1.1 +DOC_BOOK = Wind_River_Security_Libraries_1.1 +DOC_CHAPTER = Wind_River_Security_Libraries_API_Reference,_1.1 + +else + +# Force apigen for VxWorks 5.x doc build. Only needed on kernel side. +# +REFGEN_SH = $(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen \ + -nostrict -missingok -set KERNEL + +endif diff --git a/h/make/config/comps/security/defs.subdirs b/h/make/config/comps/security/defs.subdirs new file mode 100644 index 0000000..aeced7f --- /dev/null +++ b/h/make/config/comps/security/defs.subdirs @@ -0,0 +1,26 @@ +# defs.subdirs - Security specific SUBDIR definition. +# +# Copyright 1996-2004 Wind River Systems, Inc. +# +# # modification history +# -------------------- +# 00b,08jul04,tf Fix Base B0007: Uninstalled comps should not be compiled. +# 00a,03mar04,tf Written. +# +# DESCRIPTION +# This file defines the list of subdirs to be built for Security. This +# file is included by '$(WIND_BASE)/target/h/make/config/common/defs.subdirs' +# if the feature set being built includes Security comps +# (i.e., if COMPONENT_Security==true). +# +# Note that SUBDIRS is extended to include Security sub-directories. +# + +TGT_DIR=$(WIND_BASE)/target + +### +# If Security is not installed, donot build any of the other directories. +# +ifneq ($(patsubst %/,%, $(dir $(wildcard $(TGT_DIR)/src/security/Makefile))),) +SUBDIRS += security +endif diff --git a/h/make/config/comps/security/rules.default b/h/make/config/comps/security/rules.default new file mode 100644 index 0000000..c716029 --- /dev/null +++ b/h/make/config/comps/security/rules.default @@ -0,0 +1,12 @@ +# rules.default - Security specific default make rules. +# +# Copyright 1996-2004 Wind River Systems, Inc. +# +# # modification history +# -------------------- +# 00a,03mar04,tf Created. +# +# DESCRIPTION +# This file is provided if Security specific make rules are required. +# +TGT_DIR=$(WIND_BASE)/target diff --git a/h/make/config/comps/ssl/defs.default b/h/make/config/comps/ssl/defs.default new file mode 100644 index 0000000..fac7855 --- /dev/null +++ b/h/make/config/comps/ssl/defs.default @@ -0,0 +1,15 @@ +# defs.default - OPENSSL specific default make defines. +# +# Copyright 1996-2004 Wind River Systems, Inc. +# +# # modification history +# -------------------- +# 00a,03mar04,tf Created. +# +# DESCRIPTION +# This file defines any macros that are used in configuring OPENSSL for specific +# features. A given feature that includes OPENSSL needs to set the appropriate +# deature macro to 'true' so that OPENSSL is configured for that feature. This +# is done in $TGT_DIR)/h/make/config/featureSet/$(FEATURE_SET)/defs.defaults. +# +TGT_DIR=$(WIND_BASE)/target diff --git a/h/make/config/comps/ssl/defs.docs b/h/make/config/comps/ssl/defs.docs new file mode 100644 index 0000000..162092b --- /dev/null +++ b/h/make/config/comps/ssl/defs.docs @@ -0,0 +1,27 @@ +# defs.docs - makefile fragment for specifying documentation parameters +# +# modification history +# -------------------- +# 01b,13sep05,cdw updated component version +# 01a,12may05,tpw created +# +# DESCRIPTION +# This file contains settings to configure the documentation build for the +# SSL component. + +include $(WIND_BASE)/target/h/make/config/defs.version + +ifeq ($(KERNEL_MAJOR_VERSION),6) + +DOC_DIR = $(DOCS_ROOT)/com.windriver.ide.doc.wr_ssl/wr_ssl_api_reference_1.1 +DOC_BOOK = Wind_River_SSL_1.1 +DOC_CHAPTER = Wind_River_SSL_API_Reference,_1.1 + +else + +# Force apigen for VxWorks 5.x doc build. Only needed on kernel side. +# +REFGEN_SH = $(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen \ + -nostrict -missingok -set KERNEL + +endif diff --git a/h/make/config/comps/ssl/defs.subdirs b/h/make/config/comps/ssl/defs.subdirs new file mode 100644 index 0000000..2c42fd3 --- /dev/null +++ b/h/make/config/comps/ssl/defs.subdirs @@ -0,0 +1,26 @@ +# defs.subdirs - OPENSSL specific SUBDIR definition. +# +# Copyright 1996-2004 Wind River Systems, Inc. +# +# # modification history +# -------------------- +# 00b,08jul04,tf Fix Base B0007: Uninstalled comps should not be compiled. +# 00a,03mar04,tf Written. +# +# DESCRIPTION +# This file defines the list of subdirs to be built for OPENSSL. This +# file is included by '$(WIND_BASE)/target/h/make/config/common/defs.subdirs' +# if the feature set being built includes OPENSSL comps +# (i.e., if COMPONENT_OPENSSL==true). +# +# Note that SUBDIRS is extended to include OPENSSL sub-directories. +# + +TGT_DIR=$(WIND_BASE)/target + +### +# If OPENSSL is not installed, donot build any of the other directories. +# +ifneq ($(patsubst %/,%, $(dir $(wildcard $(TGT_DIR)/src/ssl/Makefile))),) +SUBDIRS += ssl +endif diff --git a/h/make/config/comps/ssl/rules.default b/h/make/config/comps/ssl/rules.default new file mode 100644 index 0000000..6998b9b --- /dev/null +++ b/h/make/config/comps/ssl/rules.default @@ -0,0 +1,12 @@ +# rules.default - OPENSSL specific default make rules. +# +# Copyright 1996-2004 Wind River Systems, Inc. +# +# # modification history +# -------------------- +# 00a,03mar04,tf Created. +# +# DESCRIPTION +# This file is provided if OPENSSL specific make rules are required. +# +TGT_DIR=$(WIND_BASE)/target diff --git a/h/make/config/comps/tipc/defs.docs b/h/make/config/comps/tipc/defs.docs new file mode 100644 index 0000000..40805d8 --- /dev/null +++ b/h/make/config/comps/tipc/defs.docs @@ -0,0 +1,20 @@ +# defs.docs - makefile fragment for specifying documentation parameters +# +# modification history +# -------------------- +# 01b,20sep05,mze mods for TIPC1.2 +# 01a,24may05,mze created +# +# DESCRIPTION +# This file contains settings to configure the documentation build for the +# TIPC component + +include $(WIND_BASE)/target/h/make/config/defs.version + +ifeq ($(KERNEL_MAJOR_VERSION),6) + +DOC_DIR = $(DOCS_ROOT)/com.windriver.ide.doc.wr_tipc/wr_tipc_kernel_api_reference_1.2 +DOC_BOOK = Wind_River_TIPC_1.2 +DOC_CHAPTER = Wind_River_TIPC_Kernel_API_Reference,_1.2 + +endif diff --git a/h/make/config/comps/usb/defs.docs b/h/make/config/comps/usb/defs.docs new file mode 100644 index 0000000..41a3087 --- /dev/null +++ b/h/make/config/comps/usb/defs.docs @@ -0,0 +1,35 @@ +# defs.docs - makefile fragment for specifying documentation parameters +# +# modification history +# -------------------- +# 01c,25may05,kkz Updating doc locations +# 01b,29apr05,kkz Updating docs directory path +# 01a,28oct04,tpw created +# +# DESCRIPTION +# This file contains settings to configure the documentation build for the +# USB component. It is expected that the variable DOC_AREA_USB be set to one +# of 'usb', 'usb2', or 'usb_drivers' before including this file. + +include $(WIND_BASE)/target/h/make/config/defs.version + +ifeq ($(KERNEL_MAJOR_VERSION),6) + +DOC_DIR = $(DOCS_ROOT)/com.windriver.ide.doc.wr_usb/wr_usb_kernel_api_reference_2.2 +DOC_BOOK = Wind_River_USB_2.2 +DOC_CHAPTER = Wind_River_USB_API + +# These lines separaed the USB parts into separate chapters and directories. +# No longer needed (but left for reference just in case) +#DOC_DIR = $(DOCS_ROOT)/com.windriver.ide.doc.wr_usb/wr_usb_kernel_api_reference_2.2/$(DOC_AREA_USB) +#ifeq ($(DOC_AREA_USB),usb) +#DOC_CHAPTER = Wind_River_USB_API +#endif +#ifeq ($(DOC_AREA_USB),usb2) +#DOC_CHAPTER = Wind_River_USB2_API +#endif +#ifeq ($(DOC_AREA_USB),usb_drivers) +#DOC_CHAPTER = Wind_River_USB_Drivers_API +#endif +# +endif diff --git a/h/make/config/comps/wlan/defs.default b/h/make/config/comps/wlan/defs.default new file mode 100644 index 0000000..3e032f2 --- /dev/null +++ b/h/make/config/comps/wlan/defs.default @@ -0,0 +1,16 @@ +# defs.default - Wireless LAN (WLAN) specific default make defines. +# +# Copyright 1996-2004 Wind River Systems, Inc. +# +# # modification history +# -------------------- +# 00b,09jul04,tf Fix Base MSP B0217: Remove dependency on SNMP. +# 00a,03mar04,tf Created. +# +# DESCRIPTION +# This file defines any macros that are used in configuring WLAN for specific +# features. A given feature that includes WLAN needs to set the appropriate +# deature macro to 'true' so that WLAN is configured for that feature. This +# is done in $TGT_DIR)/h/make/config/featureSet/$(FEATURE_SET)/defs.defaults. +# +TGT_DIR=$(WIND_BASE)/target diff --git a/h/make/config/comps/wlan/defs.docs b/h/make/config/comps/wlan/defs.docs new file mode 100644 index 0000000..4982f80 --- /dev/null +++ b/h/make/config/comps/wlan/defs.docs @@ -0,0 +1,28 @@ +# defs.docs - makefile fragment for specifying documentation parameters +# +# modification history +# -------------------- +# 01c,13sep05,rb Updated version numbers +# 01b,30may05,tpw Add -set KERNEL for Argus doc build. +# 01a,12may05,tpw created +# +# DESCRIPTION +# This file contains settings to configure the documentation build for the +# wireless ethernet driver component. + +include $(WIND_BASE)/target/h/make/config/defs.version + +ifeq ($(KERNEL_MAJOR_VERSION),6) + +DOC_DIR = $(DOCS_ROOT)/com.windriver.ide.doc.wr_wireless_ethernet_driver/wr_wireless_ethernet_driver_api_reference_2.2 +DOC_BOOK = Wind_River_Wireless_Ethernet_Driver_2.2 +DOC_CHAPTER = Wind_River_Wireless_Ethernet_Driver_API_Reference,_2.2 + +else + +# Force apigen for VxWorks 5.x doc build. Only needed on kernel side. +# +REFGEN_SH = $(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen \ + -nostrict -missingok -set KERNEL + +endif diff --git a/h/make/config/comps/wlan/defs.subdirs b/h/make/config/comps/wlan/defs.subdirs new file mode 100644 index 0000000..3bb899b --- /dev/null +++ b/h/make/config/comps/wlan/defs.subdirs @@ -0,0 +1,33 @@ +# defs.subdirs - Wireless LAN (WLAN) specific SUBDIR definition. +# +# Copyright 1996-2004 Wind River Systems, Inc. +# +# # modification history +# -------------------- +# 00d,28sep04,dxb Changed file names to detect driver to be more specific. +# 00c,10aug04,dxb Changed absolute paths to relative paths. +# 00b,08jul04,tf Fix Base B0007: Uninstalled comps should not be compiled. +# 00a,03mar04,tf Written. +# +# DESCRIPTION +# This file defines the list of subdirs to be built for WLAN. This +# file is included by '$(WIND_BASE)/target/h/make/config/common/defs.subdirs' +# if the feature set being built includes WLAN comps +# (i.e., if COMPONENT_WLAN==true). +# +# Note that SUBDIRS is extended to include WLAN sub-directories. +# +TGT_DIR=$(WIND_BASE)/target + +IS_DOT11B := $(wildcard $(TGT_DIR)/h/wrn/wlan/intPrismHw.h) +IS_DOT11ABG := $(wildcard $(TGT_DIR)/h/drv/wlan/dot11HddLib.h) + +# first build the original 802.11b driver if it exists +ifneq ($(IS_DOT11B),) +SUBDIRS += wrn/wlan +endif + +# next build the new 802.11a/b/g driver if it exists +ifneq ($(IS_DOT11ABG),) +SUBDIRS += drv/wlan +endif diff --git a/h/make/config/comps/wlan/rules.default b/h/make/config/comps/wlan/rules.default new file mode 100644 index 0000000..0e42fb9 --- /dev/null +++ b/h/make/config/comps/wlan/rules.default @@ -0,0 +1,12 @@ +# rules.default - Wireless LAN (WLAN) specific default make rules. +# +# Copyright 1996-2004 Wind River Systems, Inc. +# +# # modification history +# -------------------- +# 00a,03mar04,tf Created. +# +# DESCRIPTION +# This file is provided if WLAN specific make rules are required. +# +TGT_DIR=$(WIND_BASE)/target diff --git a/h/make/config/defs.version b/h/make/config/defs.version new file mode 100644 index 0000000..d46f636 --- /dev/null +++ b/h/make/config/defs.version @@ -0,0 +1,11 @@ +# defs.version - makefile fragment for specifying key version numbers +# +# modification history +# -------------------- +# 01b,26oct04,tpw Bump KERNEL_MAJOR_VERSION to 6 for VxWorks 6.0 +# 01a,26oct04,tpw created +# +# DESCRIPTION +# This file contains default definitions for key version numbers. + +KERNEL_MAJOR_VERSION = 6 diff --git a/h/make/defs.bsp b/h/make/defs.bsp new file mode 100644 index 0000000..d45a099 --- /dev/null +++ b/h/make/defs.bsp @@ -0,0 +1,316 @@ +# defs.bsp - bsp default makefile definitions +# +# Copyright 1984-2005, Wind River Systems, Inc. +# +# modification history +# -------------------- +# 04z,22apr05,edc Added resource definitions that support packaging of a bsp. +# 04y,07apr05,edc Search paths for header files under components +# 04x,18jan05,lei prj build with diab/gnu (SPR 103339) +# 04w,23sep04,dlk Add OPT_DEFINE in CC_DEFINES. +# 04v,07sep04,j_b new warning settings (SPR 100237) +# 04u,26aug04,mem Search target/config/comps/src after target/src/config for +# includes. +# 04u,03sep04,fle Added CDF_OVERRIDE macro +# 04t,12jul04,fle Moved ADRS_DEFINE definitions to defs.memory +# 04s,10jun04,fle Added ADRS_DEFINE to CC_DEFINES +# 04r,18may04,dlk Remove include of defs.option, now included via defs.link. +# 04q,13mar04,dlk Support option builds. +# 04p,22mar04,dbt Make sure projects are built with both diab & gnu for +# VxSim. +# 04o,23feb04,fle Removed UP directory include from CC_INCLUDE, since UP is +# never defined +# 04n,15jan04,cmf add pentium projects for diab +# 04m,12nov03,rlm Added h/wrn/coreip to CC_INCLUDE definition +# 04m,07nov03,c_c Unified build rules with WIN32 hosts. +# 04l,15oct03,dat Diab error/warning update, Step 1, BSPs built with +# warning level set to medium. +# 04k,25sep03,job Added _WRS_KERNEL to CC_DEFINE macro +# 04l,26sep03,xav Add SIZE macro in the substitution list +# 04k,21aug03,xav Substitute any / with \\ on win32 for CC, AS, AR,...decl +# 04j,19mar02,rbl project flags should be different for vxApp and vxWorks +# 04i,19mar02,dat Adding CFLAGS_PIC & CC_PIC for bootInit.o (72825) +# 04h,14dec01,dat update to include full diab build as part of RELEASE +# 04g,06dec01,dat New project defaults per arch +# 04f,04dec01,dat New release sub-macros +# 04e,12nov01,j_s moved libraries and libraries search path definitions to +# defs.link +# 04f,13nov01,dat activating prj_default as part of release +# 04e,05nov01,rbl define compiler and assembler flags for the project +# facility +# 04d,10nov01,tam added use of TOOL_COMMON_DIR; fixed definition of +# LD_LINK_PATH +# 04c,08nov01,tam fixed Windows build after repackaging changes +# 04b,30oct01,tam removed CC_LIB from cyclic linking +# 04a,29oct01,tam added auto-generation of LD_LINK_LIBS. Removed +# LD_LINK_LIBS_EXTRA. +# 03z,23oct01,tam added extra -l entries +# 03y,19oct01,j_s remove LD_LINK_LIST, just use LD_LINK_LIBS +# 03x,19oct01,jab added CC_ARCH_SPEC to CASFLAGS +# 03w,18oct01,dat Moving tool defines to tool specific files +# 03v,19sep01,dat Adding TOOL_FAMILY, added include of make.$CPU$TOOL, +# and defs.$HOST +# 03u,17sep01,sn moved definitions of MUNCH_FLAGS and related macros to +# defs.gnu +# 03t,07sep01,dat Gnu-diab adding h/tool/$TOOL to include path +# 03t,31jul01,mem Fix munch for diab. +# 03s,24jul01,r_s diab specific rules added +# 03r,24apr00,dat SPR 30819, fix project link of ROM images +# 03q,10aug00,rec add LD_ENDIAN_FLAG +# 03p,23mar01,roz Fix check for GNU compiler. +# 03o,13mar01,sn Use $(OPTION_LANG_ASM) instead of the explicit flag +# Added $(OPTION_LANG_ASM) to $(CASFLAGS) to ensure +# correct dependency gen in BSP builds +# 03n,12mar01,sn Spell -x assembler-with-cpp without the space to +# ensure correct extraction by the project facility +# 03m,06dec00,sn removed -xc +# 03l,16oct00,sn link against CC_LIB +# 03k,09oct00,sn removed -nostdinc +# 03j,23feb99,sn merge POST_MUNCH and MUNCH, add MUNCH_FLAGS +# -traditional -> -fdollars-in-identifiers +# 03i,22feb99,fle added mkboot to DOC_FILES +# 03h,17nov98,sn removed ORDER_CTORS +# 03g,11nov98,sn partially link using LD_PARTIAL +# 03f,11nov98,sn munch -> orderCtors $(NM) +# 03e,15oct98,ms reworked MUNCH definition so it works on windows 95/98. +# 03d,21sep98,sn removed -fno-implicit-templates from C++_COMPILER +# see defs.default for detailed comment +# 03c,06may98,yp added sysTffs to DOC_FILES +# 03b,06may98,cym added DEFAULT_RULE +# 03a,09feb98,sn added -fno-implicit-templates to C++_COMPILER +# 02i,02apr98,pcn Removed Objcopy changes from Tempest view +# 02h,15dec97,pcn Added Objcopy in BSP build. +# 02g,20jan97,yp added -P to CFLAGS_AS to suppress "#line" directives +# 02f,06dec97,yp moved soft-float back to CFLAGS +# 02e,02jan97,dat added DOC_FLAGS, EXTRA_DOC_FLAGS +# 02d,17dec96,yp moved soft-float to OPTIM macros so drvs get built without it +# 02c,04oct96,yp added .cxx sufix +# 02b,31oct96,yp added definition for GCC_EXEC_PREFIX. added TCL def. +# added CFLAGS_AS. redid CFLAGS and C++FLAGS for new build +# 02a,31oct96,kkk fixed typo in C++FLAGS line. +# 01z,21jun96,dat added -traditional to COMPILE_SYMTBL (#6517), +# added copyright +# 01y,01apr96,srh added Rogue Wave multithread defns. +# 01x,13nov95,jeh added CF define, changed CXX define to $(CC). +# 01w,13nov95,jeh renamed C++ define to be CXX. +# 01v,11nov95,jeh fixed typo in C++FLAGS define (missing $ in $(C++_COMPILER)) +# 01u,07nov95,p_m Removed previous change +# 01t,04nov95,p_m Added sysSerial to DOC_FILES +# 01s,01nov95,yp Added rules for C++ support +# 01r,24oct95,dat recovered CONFIG_ALL and changed CC_INCLUDE, moved LIB_EXTRA +# 01q,20jun95,yp removed -pedatic flag. added machros for bin tool names +# 01p,15jun95,yp removed defintions for CPU and TOOL. +# 01o,01jun95,yp derived from make.defaults +# +# DESCRIPTION +# This file is included into bsp makefiles to define the default makefile +# definitions. After the include the Makefile may customize the definitions +# found here to suit the circumstance. +# +# Redefinitions of make variables earlier than the include of this file will +# have no affect. +# +# This file is only for command line builds from the BSP directory. It is +# not used for any project or component builds. See defs.project for project +# build definitions. It is used to create projects from the command line, but +# not to build them. +# + +# map TOOL to TOOL_FAMILY, if not already done in BSP Makefile + +ifeq ($(TOOL_FAMILY),) +ifeq ($(findstring gnu,$(TOOL)),gnu) +TOOL_FAMILY = gnu +else +ifeq ($(findstring diab,$(TOOL)),diab) +TOOL_FAMILY = diab +endif +endif +endif + +#in case we are on a WIN32 host ... +WIND_BASE := $(subst \,/,$(WIND_BASE)) + +.SUFFIXES: .cpp .out .cxx + +## exe target is the cannonical starting point. + +default : exe + +## most targets will make vxWorks by default + +DEFAULT_RULE = vxWorks + +## TARGET_DIR still used for backward compatibility + +BSP_NAME = $(TARGET_DIR) + +## default flags + +CFLAGS = $(CC_ARCH_SPEC) $(CC_COMPILER) $(CC_OPTIM) $(CC_WARNINGS) \ + $(CC_INCLUDE) $(CC_DEFINES) $(ADDED_CFLAGS) \ + $(CC_SOFT_FLOAT) + +C++FLAGS = $(CC_ARCH_SPEC) $(C++_COMPILER) $(CC_OPTIM) $(C++_WARNINGS) \ + $(CC_INCLUDE) $(CC_DEFINES) $(ADDED_C++FLAGS) \ + $(CC_SOFT_FLOAT) + +CASFLAGS = $(CC_ARCH_SPEC) $(OPTION_PP) $(OPTION_LANG_ASM) $(CC_INCLUDE)\ + $(CC_DEFINES) + +CFLAGS_AS = $(CC_ARCH_SPEC) $(CC_COMPILER) $(CC_OPTIM) $(CC_INCLUDE) \ + $(CC_DEFINES) $(ADDED_CFLAGS) $(OPTION_PP_AS) \ + $(OPTION_LANG_ASM) + +# Special flags for Position Independent Code (bootInit.o) + +CFLAGS_PIC = $(CC_ARCH_SPEC) $(CC_COMPILER) $(CC_OPTIM) $(CC_WARNINGS) \ + $(CC_INCLUDE) $(CC_DEFINES) $(ADDED_CFLAGS) $(CC_PIC) \ + $(CC_SOFT_FLOAT) + +# BSP default warning level is medium, the most comparable to previous setting. + +CC_WARNINGS = $(CC_WARNINGS_MED) +C++_WARNINGS = $(CC_WARNINGS_MED) + +CC_OPTIM = $(CC_OPTIM_TARGET) + +CC_INCLUDE = $(INCLUDE_CC) $(EXTRA_INCLUDE) $(OPTION_INCLUDE_DIR). \ + $(OPTION_INCLUDE_DIR)$(CONFIG_ALL) \ + $(OPTION_INCLUDE_DIR)$(TGT_DIR)/h \ + $(OPTION_INCLUDE_DIR)$(TGT_DIR)/h/wrn/coreip \ + $(OPTION_INCLUDE_DIR)$(TGT_DIR)/src/config \ + $(OPTION_INCLUDE_DIR)$(TGT_DIR)/config/comps/src \ + $(OPTION_INCLUDE_DIR)$(TGT_DIR)/config/comps/src/dosfs2 \ + $(OPTION_INCLUDE_DIR)$(TGT_DIR)/src/drv + +WIND_VXCONFIG := $(subst \,/,$(WIND_VXCONFIG)) +WIND_COMPONENTS_INCLUDES := $(subst \,/,$(WIND_COMPONENTS_INCLUDES)) + +ifeq ($(WIND_HOST_TYPE),x86-win32) + EXTRA_INCLUDE += $(foreach dir,$(subst ;, ,$(WIND_COMPONENTS_INCLUDES)), $(OPTION_INCLUDE_DIR)$(dir)) + EXTRA_INCLUDE += $(foreach dir,$(subst ;, ,$(WIND_VXCONFIG)), $(OPTION_INCLUDE_DIR)$(dir)/src) + EXTRA_INCLUDE += $(foreach dir,$(subst ;, ,$(WIND_VXCONFIG)), $(OPTION_INCLUDE_DIR)$(dir)/h) +else + EXTRA_INCLUDE += $(foreach dir,$(subst :, ,$(WIND_COMPONENTS_INCLUDES)), $(OPTION_INCLUDE_DIR)$(dir)) + EXTRA_INCLUDE += $(foreach dir,$(subst :, ,$(WIND_VXCONFIG)), $(OPTION_INCLUDE_DIR)$(dir)/src) + EXTRA_INCLUDE += $(foreach dir,$(subst :, ,$(WIND_VXCONFIG)), $(OPTION_INCLUDE_DIR)$(dir)/h) +endif + +EXTRA_INCLUDE += $(COMPONENT_INCLUDES) + + +CC_DEFINES = $(OPTION_DEFINE_MACRO)CPU=$(CPU) \ + $(OPTION_DEFINE_MACRO)TOOL_FAMILY=$(TOOL_FAMILY) \ + $(OPTION_DEFINE_MACRO)TOOL=$(TOOL) \ + $(OPTION_DEFINE_MACRO)_WRS_KERNEL \ + $(DEFINE_CC) $(EXTRA_DEFINE) $(OPT_DEFINE) + +CDF_OVERRIDE = $(OPTION_DEFINE_MACRO)CDF_OVERRIDE=TRUE + +COMPILE_SYMTBL = $(CC) $(OPTION_OBJECT_ONLY) $(OPTION_DOLLAR_SYMBOLS) $(CFLAGS) + +## compiler and assembler flags for the project facility + +CFLAGS_PROJECT_REMOVE = $(CC_PROJECT_OPTIMIZE_FLAGS) \ + $(PROJECT_BSP_FLAGS_EXTRA) +CFLAGS_PROJECT_STRIPPED = $(filter-out $(CFLAGS_PROJECT_REMOVE),$(C++FLAGS)) +CFLAGS_PROJECT = -g $(CFLAGS_PROJECT_STRIPPED) + +CFLAGS_AS_PROJECT_STRIPPED = $(filter-out $(CFLAGS_PROJECT_REMOVE),$(CFLAGS_AS)) +CFLAGS_AS_PROJECT = -g $(CFLAGS_AS_PROJECT_STRIPPED) + +## set default values for ROM_LINK_ADRS, TGT_DIR, for old Makefiles + +ifeq ($(ROM_LINK_ADRS),) +ROM_LINK_ADRS = $(ROM_TEXT_ADRS) +endif + +ifeq ($(TGT_DIR),) +TGT_DIR = $(WIND_BASE)/target +else +#in case we are on a WIN32 host ... +TGT_DIR := $(subst \,/,$(TGT_DIR)) +endif + +## standard list of BSP modules + +MACH_DEP = sysALib.o sysLib.o $(MACH_EXTRA) $(ADDED_MODULES) + +## linker script definitions + +include $(TGT_DIR)/h/make/defs.link + +## documentation files + +DOC_FILES = sysLib tyCoDrv sysTffs mkboot +DOC_FLAGS = $(OPTION_DEFINE_MACRO)DOC $(OPTION_DEFINE_MACRO)INCLUDE_SCSI \ + $(OPTION_DEFINE_MACRO)INCLUDE_SHOW_ROUTINES $(EXTRA_DOC_FLAGS) + +# Now include the CPU/TOOL make file and any host specific definitions + +include $(TGT_DIR)/h/tool/$(TOOL_FAMILY)/make.$(CPU)$(TOOL) +include $(TGT_DIR)/h/make/defs.$(WIND_HOST_TYPE) + + +## Release macros are for WRS internal release process only. + +RELEASE = $(RELEASE_PRE) $(RELEASE_CMD) $(RELEASE_PRJ) $(RELEASE_POST) +RELEASE_PRE = +RELEASE_POST = + +## Default project builds, arch sensitive + +# ARM, MIPS, PPC, SH +# build 2 projects, gnu project has 4 build specs, diab project also has 4 +# (These should be in the arch specific tool files, not here) + +ifeq ($(VX_CPU_FAMILY),arm) + RELEASE_PRJ = prj_gnu prj_diab +endif + +ifeq ($(VX_CPU_FAMILY),mips) + RELEASE_PRJ = prj_gnu prj_diab +endif + +ifeq ($(VX_CPU_FAMILY),ppc) + RELEASE_PRJ = prj_gnu prj_diab +endif + +ifeq ($(VX_CPU_FAMILY),sh) + RELEASE_PRJ = prj_gnu prj_diab +endif + +ifeq ($(VX_CPU_FAMILY),pentium) + RELEASE_PRJ = prj_gnu prj_diab +endif + +# Simulators: one project with 2 build specs + +ifeq ($(VX_CPU_FAMILY),simpc) + RELEASE_PRJ = prj_gnu_def prj_diab_def +endif + +ifeq ($(VX_CPU_FAMILY),simso) + RELEASE_PRJ = prj_gnu_def prj_diab_def +endif + +ifeq ($(VX_CPU_FAMILY),simlinux) + RELEASE_PRJ = prj_gnu_def prj_diab_def +endif + +# all else defaults to a single project with 4 build specs + +ifeq ($(RELEASE_PRJ),) + RELEASE_PRJ = prj_default +endif + +# default command line builds + +ifeq ($(RELEASE_CMD),) + RELEASE_CMD = vxWorks vxWorks.st bootrom.hex +endif + +# Include resource definitions that support packaging of a bsp + +-include $(WIND_HOME)/setup/make/defs.resourcelist diff --git a/h/make/defs.default b/h/make/defs.default new file mode 100644 index 0000000..32153fa --- /dev/null +++ b/h/make/defs.default @@ -0,0 +1,183 @@ +# defs.default - default makefile definitions +# +# Copyright 1984-2005, Wind River Systems +# +# modification history +# -------------------- +# 02y,15sep05,kkz Updating version number for API docs +# 02x,29apr05,kkz Changing doc directory path +# 02w,19apr05,tpw Adjust to new docs location as of WB18 +# 02v,28mar05,spm Added -include rules.gpp. +# 02u,16feb05,pee Added CFLAGS_$< +# 02t,14oct04,dlk Added OPT_DEFINE in CC_DEFINES +# 02s,14oct04,job Added DOC_KERNEL definition +# 02r,17sep04,job Changed C++_WARNINGS value to CC_WARNINGS_LOW (SPR#101877) +# 02q,12jul04,fle Moved ADRS_DEFINE definitions to defs.memory +# 02p,01jun04,fle Added CFLAGS_ADRS to CFLAGS +# 02q,27may04,dgp change DOCS_ROOT, DOC_DIR, and DOC_CHAPTER +# 02p,25may04,tpw Switch on -missingok to reduce doc build error output. +# 02o,16feb04,c_c Added the depend extention setting here +# + fix for SPR 88968. +# 02n,12jan04,bjl changed default CPU for doc builds, changed doc flags. +# 02m,11nov03,rlm Added wrn/coreip to CC_INCLUDE definition +# 02m,07nov03,c_c Unified build rules with WIN32 hosts. +# 02l,15oct03,dat Diab error/warning update, step 1 generate warnings for +# error conditions to be fixed by tech line people. +# 02k,17sep03,job Added _WRS_KERNEL to CC_DEFINES macro +# 02j,08may02,wsl change default libraries chapter name +# 02i,19mar02,dat Adding CFLAGS_PIC & CC_PIC for bootInit.o (72825) +# 02h,12mar02,wsl change DOC_CHAPTER from "Libraries" to "Standard Libraries" +# 02g,31jan02,dgp change VxWorks_Reference_Manual to VxWorks_API_Reference +# 02f,21jan02,sn removed unused C++_TEMPLATE_INST +# 02e,23oct01,jab moved toolchain specifics out +# 02d,11oct01,dat SPR 20403, CC_OPTIM_DRIVER needs -fvolatile by default +# 02c,19sep01,dat Adding TOOL_FAMILY +# 02b,17sep01,sn moved definitions of MUNCH_FLAGS and related macros to defs.gnu +# 02a,06sep01,dat Gnu-Diab, adding h/tool/$TOOL to CC_INCLUDE +# 01z,27aug01,wsl add man pages +# 01y,24jul01,r_s Diab sections should not set GCC_ make variables +# 01x,24jul01,r_s changing the make 'ifeq' conditional to work with 'gnu', +# 'sfgnu', 'sfgnule' etc for TOOL +# 01w,24jul01,r_s diab specific rules added +# 01v,28feb01,t_m merge in XScale changes +# 01u,23mar01,roz Fix check for GNU compiler. +# 01t,13mar01,sn Use $(OPTION_LANG_ASM) instead of the explicit flag +# Added $(OPTION_LANG_ASM) to $(CASFLAGS) to ensure +# correct dependency gen in BSP builds +# 01s,12mar01,sn Spell -x assembler-with-cpp without the space to +# ensure correct handling by the project facility +# 01t,01feb01,mem Added LD_PARTIAL_FLAGS and LDFLAGS +# 01s,06dec00,sn removed -xc +# 01v,04jan01,mem Remove -P from assembler invocation. +# 01r,09oct00,sn removed -nostdinc +# 01q,04mar99,sn added machinery to handle large projects +# 01p,18feb99,sn merge POST_MUNCH and MUNCH, add MUNCH_FLAGS +# 01o,02feb99,sn added defs of MUNCH and POST_MUNCH +# 01n,05jan99,fle added the DOC_OPTS_XXX flags +# 01m,25nov98,fle made doc book and chapter be variables and not hard coded +# anymore +# 01l,11nov98,sn partially link using LD_PARTIAL +# 01k,10nov98,fle doc : changed the DOCS_TARGET value +# 01j,21sep98,sn added new macro, C++_TEMPLATE_INST +# 01i,18aug98,fle added DOCS_DIR and DOCS_TARGET variables +# 01h,07may98,sn Sorted this modification history correctly +# (Re)added the flag -fno-implicit-templates to C++_COMPILER +# 01g,02apr98,pcn Removed Objcopy changes from Tempest view +# 01f,15dec97,pcn Added Objcopy in BSP build. +# 01e,10oct97,cym added OPTION_ macros to remove "GNU-centric" flags for VC++. +# 01d,20jan97,yp added -P to CFLAGS_AS to suppress "#line" directives +# 01c,06jan97,yp moved soft-float back to CFLAGS +# 01b,17dec96,yp moved soft-float to OPTIM macros so drvs get built without it +# 01a,07may96,yp derived from defs.bsp +# +# DESCRIPTION +# This file is included in Makefiles to establish defaults. The Makefiles may +# customize these definitions to suit the circumstance. +# +# Redefinitions of make variables earlier than the include of this file will +# have no affect. +# + +.SUFFIXES: .cpp .out .mib .cxx + +## default CPU and TOOL settings + +CPU=PPC604 +TOOL=gnu + +# NOTE: we redefine MAKETAIL and CLEANTAIL: provbably unsupported from now on + +MAKETAIL = +CLEANTAIL = + +## default flags + +CFLAGS = $(CC_ARCH_SPEC) $(CC_COMPILER) $(CC_OPTIM) $(CC_WARNINGS) \ + $(CC_INCLUDE) $(CC_DEFINES) $(CC_SOFT_FLOAT) $(ADDED_CFLAGS) \ + $(CFLAGS_$<) + +C++FLAGS = $(CC_ARCH_SPEC) $(C++_COMPILER) $(CC_OPTIM) $(C++_WARNINGS) \ + $(CC_INCLUDE) $(CC_DEFINES) $(CC_SOFT_FLOAT) $(ADDED_C++FLAGS) + +CASFLAGS = $(CC_ARCH_SPEC) $(OPTION_PP) $(OPTION_LANG_ASM) $(CC_INCLUDE)\ + $(CC_DEFINES) + +CFLAGS_AS = $(CC_ARCH_SPEC) $(CC_COMPILER) $(CC_OPTIM) $(CC_INCLUDE) \ + $(CC_DEFINES) $(OPTION_PP_AS) $(OPTION_LANG_ASM) \ + $(ADDED_CFLAGS) + +# For Position Independant Code (bootInit.o) +CFLAGS_PIC = $(CC_ARCH_SPEC) $(CC_COMPILER) $(CC_OPTIM) $(CC_WARNINGS) \ + $(CC_INCLUDE) $(CC_DEFINES) $(CC_PIC) $(CC_SOFT_FLOAT) \ + $(ADDED_CFLAGS) + +# new default is the low setting. Library code MUST be error/warning free at +# this level. + +CC_WARNINGS = $(CC_WARNINGS_LOW) + +C++_WARNINGS = $(CC_WARNINGS_LOW) + +CC_OPTIM = $(CC_OPTIM_NORMAL) + +CC_INCLUDE = $(PRE_INCLUDE) $(OPTION_INCLUDE_DIR)$(TGT_DIR)/h \ + $(OPTION_INCLUDE_DIR)$(TGT_DIR)/h/wrn/coreip \ + $(INCLUDE_CC) $(EXTRA_INCLUDE) + +CC_DEFINES = $(OPTION_DEFINE_MACRO)CPU=$(CPU) \ + $(OPTION_DEFINE_MACRO)TOOL_FAMILY=$(TOOL_FAMILY) \ + $(OPTION_DEFINE_MACRO)TOOL=$(TOOL) \ + $(OPTION_DEFINE_MACRO)_WRS_KERNEL \ + $(DEFINE_CC) $(EXTRA_DEFINE) $(OPT_DEFINE) + +COMPILE_SYMTBL = $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS) + +C++_COMPILER = $(OPTION_ANSI) + +# We have this only because win95 host does not allow -DCPU=$(CPU) to be +# passed as one parameter + +CC_DEPFLAGS = $(CC_OPTIM) $(CC_WARNINGS) $(CC_INCLUDE) $(CC_COMPILER) \ + $(DEFINE_CC) $(EXTRA_DEFINE) $(OPT_DEFINE) +CXX_DEPFLAGS = $(CC_OPTIM) $(CC_INCLUDE) $(C++_WARNINGS) $(C++_COMPILER) \ + $(DEFINE_CC) $(EXTRA_DEFINE) $(OPT_DEFINE) $(ADDED_C++FLAGS) + +TARGET=default + +## top of vxWorks tree + +BIN_DIR=$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin + +## CPU/TOOL build extension name + +BUILD_EXT = $(CPU)$(LIB_DIR_TAG)$(TOOL)-$(WIND_HOST_TYPE) + +## docs flags and variables + +DOCS_ROOT = $(WIND_DOCS)/extensions/eclipse/plugins +DOC_DIR = $(DOCS_ROOT)/com.windriver.ide.doc.vxworks/vxworks_kernel_api_reference_6.2 +MAN_PAGE_DIR = $(WIND_BASE)/man +DOC_BOOK = VxWorks_APIs +DOC_CHAPTER = Kernel_APIs +DOC_KERNEL = KERNEL +DOC_OPTS = $(DOC_OPTS_MAN) +MAN_PAGE_OPTS = $(DOC_OPTS_MAN) -config Auto2txt +DOC_OPTS_C_TCL = -config CTcl2html +DOC_OPTS_CPP = -cpp +DOC_OPTS_FILE = -config File2html +DOC_OPTS_MAN = -mg -nostrict -missingok + + +## map TOOL to TOOL_FAMILY, if not already done elsewhere (it should) + +ifeq ($(TOOL_FAMILY),) +ifeq ($(findstring gnu,$(TOOL)),gnu) +TOOL_FAMILY = gnu +else +ifeq ($(findstring diab,$(TOOL)),diab) +TOOL_FAMILY = diab +endif +endif +endif + +-include $(WIND_BASE)/target/h/make/rules.gpp diff --git a/h/make/defs.drivers b/h/make/defs.drivers new file mode 100644 index 0000000..871534d --- /dev/null +++ b/h/make/defs.drivers @@ -0,0 +1,19 @@ +# defs.drivers - default documentation definitions for drivers +# +# Copyright 2005, Wind River Systems +# +# modification history +# -------------------- +# 01b,15sep05,kkz Updated to 6.2 +# 01a,15aug05,kkz Created +# +# DESCRIPTION +# This file is included in driver Makefiles to establish documentation defaults. +# +# +## docs flags and variables + +DOC_DIR = $(DOCS_ROOT)/com.windriver.ide.doc.vxworks/vxworks_drivers_api_reference_6.2 +DOC_BOOK = VxWorks_APIs +DOC_CHAPTER = Driver_APIs + diff --git a/h/make/defs.library b/h/make/defs.library new file mode 100644 index 0000000..fb5f32d --- /dev/null +++ b/h/make/defs.library @@ -0,0 +1,148 @@ +# defs.library - Host independent definitions for making libraries +# +# Copyright 2003, Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01k,21jul05,yvp Added _WRS_LIB_BUILD +# 01j,17may04,yvp Split SCGEN_DERIVED_FILES into SCGEN_DERIVED_GENERIC etc. +# 01i,21apr04,dlk Refine below change: do not skip CPU variant submake +# for this directory if DEFS_PAL is defined; but if +# this isn't an option library, don't build the common +# (non-variant) library. +# 01h,15mar04,dlk Do not skip directory if DEFS_PAL is defined. +# 01g,13mar04,dlk Support option builds. Fix mod history. +# 01f,yvp Changed SCGEN_DERIVED_FILES to match ver 02a of scgen.tcl script. +# 01e,.......,yvp Added more files to SCGEN_DERIVED_FILES. +# 01d,.......,yvp Removed genc.* from SCGEN_DERIVED_FILES; added syscallTbl.h +# 01c,.......,kk removed syscall.c from SCGEN_DERIVED_FILES +# 01b,.......,yvp Added SCGEN_DERIVED_FILES. +# 01a,.......,c_c written from rules.library v 02b +# +# DESCRIPTION +# This file is included by every Makefile in the run-time (not BSPs). +# This file contains makefile efinitions that are host independent for creating +# vxWorks libraries. +# +# +# INCLUDES +# $(TGT_DIR)/h/make/defs.option +# $(TGT_DIR)/h/make/defs.default +# $(TGT_DIR)/h/tool/$(TOOL_FAMILY)/make.$(CPU)$(TOOL) +# $(TGT_DIR)/h/make/defs.$(WIND_HOST_TYPE) + +# avoid multiple inclusion + +ifeq ($(DEFS_LIBRARY),) +DEFS_LIBRARY = TRUE + +# By default object files are installed in the toolchain independent object +# directory if LIB_BASE_NAME is set, that is when LIB_COMMON is not set. + +ifeq ($(LIB_COMMON),) +LIB_COMMON = true +endif + +## New Archive Directory Hierarchy (LIB_BASE_NAME != ""): + +ifneq ($(LIB_BASE_NAME),) + +# - Object modules are installed in the toolchain dependent directory +# if LIB_COMMON is equal to false, and in the toolchain independent +# directory otherwise. +# - Objects modules populate the archive whose name is selected by +# LIB_BASE_NAME +# - Note that LIB_DIR_TAG is only set when building archive(s) for CPU +# variants. + +ifeq ($(LIBDIRBASE),) +ifeq ($(findstring false,$(LIB_COMMON)),false) +LIBDIRBASE = $(VX_CPU_FAMILY)/$(CPU)/$(TOOL)$(LIB_DIR_TAG) +else +LIBDIRBASE = $(VX_CPU_FAMILY)/$(CPU)/$(TOOL_COMMON_DIR)$(LIB_DIR_TAG) +endif +endif + +ifeq ($(LIBNAME),) +LIBNAME = $(LIBDIRBASE)/lib$(LIB_BASE_NAME)$(OPT).a +endif +ifeq ($(LIBDIRNAME),) +LIBDIRNAME = $(LIBDIRBASE)/obj$(LIB_BASE_NAME)$(OPT) +endif + +endif # ifeq ($(LIB_BASE_NAME),) + + +## Build of specific target archive(s) via VX_ARCHIVE_LIST: +# If VX_ARCHIVE_LIST is set only the specified target archive(s) are built. +# This means that source directories not contributing to these archive(s) +# are skipped. VX_ARCHIVE_LIST is used with CPU variant builds. + +ifneq ($(VX_ARCHIVE_LIST),) +ifeq ($(LIB_BASE_NAME),) +SKIP_DIR = true +else +## For now we assume $(VX_ARCHIVE_LIST) contains library names +# undecorated with $(OPT). +ifneq ($(filter lib$(LIB_BASE_NAME).a, $(VX_ARCHIVE_LIST)), \ + lib$(LIB_BASE_NAME).a) +SKIP_DIR = true +endif +endif +endif + +include $(TGT_DIR)/h/make/defs.option + +## If we are doing an option build, skip directories which +# don't build libraries specified in LIB_BASE_NAMES$(OPT). +# However, src/arch needs to be built to get the variant +# builds of its subdirectories, even though its own Makefile +# doesn't specify LIB_BASE_NAME. More generally, we don't +# skip directories where defs.pal has been included. +# Note, this assumes defs.pal is included before this file. + +ifneq ($(OPT),) + +ifeq ($(LIB_BASE_NAME),) +SKIP_DIR = true +SKIP_CLEAN = true +else +ifeq ($(filter $(LIB_BASE_NAME),$(LIB_BASE_NAMES$(OPT))),) +SKIP_DIR = true +SKIP_CLEAN = true +endif +endif # ifeq ($(LIB_BASE_NAME),) + +# Don't skip if this is the top level of a PAL/cpu-variant build +ifneq ($(DEFS_PAL),) +ifneq ($(NO_RECURSE), TRUE) +# nevertheless, don't build the common library +ifeq ($(SKIP_DIR), true) +SKIP_LIB = true +endif +SKIP_DIR = +SKIP_CLEAN = +endif +endif # ifneq ($(DEFS_PAL),) + +endif # ifneq ($(OPT),) + +ifeq ($(WIND_HOST_TYPE),x86-win32) +WIND_BASE := $(subst \,/,$(WIND_BASE)) +endif + +TGT_DIR=$(WIND_BASE)/target + +include $(TGT_DIR)/h/make/defs.default +include $(TGT_DIR)/h/tool/$(TOOL_FAMILY)/make.$(CPU)$(TOOL) +include $(TGT_DIR)/h/make/defs.$(WIND_HOST_TYPE) + +CC_DEFINES += $(OPTION_DEFINE_MACRO)_WRS_LIB_BUILD +# This should come after including make.$(CPU)$(TOOL) + +SCGEN_DERIVED_GENERIC = $(TGT_DIR)/h/syscall.h $(TGT_DIR)/h/syscallTbl.h +SCGEN_DERIVED_ARCH = $(TGT_DIR)/h/arch/$(ARCH_DIR)/syscallArgs$(ABI_SPEC).h + +SCGEN_DERIVED_FILES = $(SCGEN_DERIVED_GENERIC) $(SCGEN_DERIVED_ARCH) + +endif # ifeq ($DEFS_LIBRARY),) diff --git a/h/make/defs.link b/h/make/defs.link new file mode 100644 index 0000000..13213fc --- /dev/null +++ b/h/make/defs.link @@ -0,0 +1,135 @@ +# defs.link - libraries and libraries search path definitions +# +# Copyright 1984-2005, Wind River Systems, Inc. +# +# modification history +# -------------------- +# 04l,15sep05,jlb Use CPU_CLASS to access middleware component archives +# 04k,28apr05,edc Fixed component libpaths from WS_ROOT_DIR such that it +# propagates the macro when WS_ROOT_DIR is defined as UNKNOWN +# during VIP create time. +# 04j,22apr05,edc Did not (could not) break up lines 82-89. +# 04i,22apr05,edc Added component libpaths from the workspace directory, +# broke long lines, and added comments. +# 04h,19may04,dlk Include defs.option from this file. +# 04g,03feb04,dlk support option builds. +# 04f,30jan03,pch add LD_LINK_PATH_ATEND +# 04e,12nov01,j_s written +# +# DESCRIPTION +# This file defines OS libraries VX_OS_LIBS and the library search paths +# LD_LINK_PATH. LIBS is also defined here which includes LIB_EXTRA and +# VX_OS_LIBS by default. It can be overwitten by project. This file is +# included by both defs.bsp and defs.project + +include $(TGT_DIR)/h/make/defs.option + +## libraries +# +# LD_LINK_PATH: list of paths that ld search for archive libraries. +# It includes the tool independant and dependant directories, as +# well as any additional directory specified via +# LD_LINK_PATH_EXTRA. +# LD_LINK_LIBS: list of libraries searched by ld in the paths defined by +# LD_LINK_PATH. This list is automatically generated and +# corresponds to all of the libraries located in the directories +# specified in LD_LINK_PATH whose name is of the form libXXX.a. +# + +LD_LINK_PATH = $(LD_LINK_PATH_EXTRA) \ + -L$(TGT_DIR)/lib/$(VX_CPU_FAMILY)/$(CPU)/$(TOOL) +LD_LINK_PATH += -L$(TGT_DIR)/lib/$(VX_CPU_FAMILY)/$(CPU)/$(TOOL_COMMON_DIR) + +# ifneq ($(LD_LINK_PATH_ATEND),) +LD_LINK_PATH += $(LD_LINK_PATH_ATEND) +# endif + +LIBS_PRESENT = $(notdir $(foreach dir, $(subst -L,, $(LD_LINK_PATH)), \ + $(wildcard $(dir)/lib*.a))) + +# The option libraries are those containing a dash '-' in their name. +# No non-option library may contain a dash. + +OPT_LIBS_PRESENT = $(notdir $(foreach dir, $(subst -L,, $(LD_LINK_PATH)), \ + $(wildcard $(dir)/lib*-*.a))) + +ifneq ($(OPT),) +OPT_LIBS = $(filter %$(OPT).a, $(LIBS_PRESENT)) +THIS_OPT_LIBS = $(patsubst %,lib%.a,$(LIB_BASE_NAMES$(OPT))) +else +OPT_LIBS = +THIS_OPT_LIBS = +endif + +# Remove any option libraries, and also any libraries replaced +# by option libraries for the present $(OPT) value. + +NONOPT_LIBS = $(filter-out $(OPT_LIBS_PRESENT) $(THIS_OPT_LIBS), \ + $(LIBS_PRESENT)) + +LD_LINK_LIBS = $(patsubst lib%.a,-l%, $(OPT_LIBS) $(NONOPT_LIBS)) + +ifeq ($(CPU_CLASS),) +CPU_CLASS = $(CPU) +endif + +# +# VX_OS_LIBS: libraries present in LD_LINK_PATH and +# $(TGT_DIR)/lib/lib$(CPU)$(TOOL)vx.a. Supposedly, only OS libraries +# should be there. +# LIBS: customer's libraries and VX_OS_LIBS +# + +VX_OS_LIBS = $(LD_LINK_LIBS) $(TGT_DIR)/lib/lib$(CPU)$(TOOL)vx.a +LIBS = $(LIB_EXTRA) $(VX_OS_LIBS) + +# Add component libpaths from the workspace directory WS_ROOT_DIR + +ifeq ($(WS_ROOT_DIR),UNKNOWN) + WS_ROOT_DIR_LIBPATH = $$(WS_ROOT_DIR)/obj/$(WIND_PLATFORM)/krnl/lib + COMP_LD_LINK_PATH += -L$(WS_ROOT_DIR_LIBPATH)/$(VX_CPU_FAMILY)/$(CPU_CLASS)/$(TOOL) + COMP_LD_LINK_PATH += -L$(WS_ROOT_DIR_LIBPATH)/$(VX_CPU_FAMILY)/$(CPU_CLASS)/$(TOOL_COMMON_DIR) +else + ifneq ($(WS_ROOT_DIR),) + WS_ROOT_DIR_LIBPATH = $(WS_ROOT_DIR)/obj/$(WIND_PLATFORM)/krnl/lib + COMP_LD_LINK_PATH += -L$(WS_ROOT_DIR_LIBPATH)/$(VX_CPU_FAMILY)/$(CPU_CLASS)/$(TOOL) + COMP_LD_LINK_PATH += -L$(WS_ROOT_DIR_LIBPATH)/$(VX_CPU_FAMILY)/$(CPU_CLASS)/$(TOOL_COMMON_DIR) + COMP_LIBS_PRESENT += $(notdir $(wildcard $(WS_ROOT_DIR_LIBPATH)/$(VX_CPU_FAMILY)/$(CPU_CLASS)/$(TOOL)/lib*.a)) + COMP_LIBS_PRESENT += $(notdir $(wildcard $(WS_ROOT_DIR_LIBPATH)/$(VX_CPU_FAMILY)/$(CPU_CLASS)/$(TOOL_COMMON_DIR)/lib*.a)) + endif +endif + +# Add component libpaths and modules defined in WIND_COMPONENT_LIBPATHS and +# WIND_COMPONENT_MODULES + +WIND_COMPONENTS_LIBPATHS := $(subst \,/,$(WIND_COMPONENTS_LIBPATHS)) +WIND_COMPONENTS_MODULES := $(subst \,/,$(WIND_COMPONENTS_MODULES)) + +ifeq ($(WIND_HOST_TYPE),x86-win32) + COMP_LD_LINK_PATH += $(foreach dir,$(subst ;, ,$(WIND_COMPONENTS_LIBPATHS)), \ + -L$(dir)/$(VX_CPU_FAMILY)/$(CPU_CLASS)/$(TOOL)) + COMP_LD_LINK_PATH += $(foreach dir,$(subst ;, ,$(WIND_COMPONENTS_LIBPATHS)), \ + -L$(dir)/$(VX_CPU_FAMILY)/$(CPU_CLASS)/$(TOOL_COMMON_DIR)) + COMP_LIBNAMES = $(foreach name,$(subst ;, ,$(WIND_COMPONENTS_LIBNAMES)),lib$(name).a) + COMP_MODULES = $(foreach file,$(subst ;, ,$(WIND_COMPONENTS_MODULES)), $(file)) +else + COMP_LD_LINK_PATH += $(foreach dir,$(subst :, ,$(WIND_COMPONENTS_LIBPATHS)), \ + -L$(dir)/$(VX_CPU_FAMILY)/$(CPU_CLASS)/$(TOOL)) + COMP_LD_LINK_PATH += $(foreach dir,$(subst :, ,$(WIND_COMPONENTS_LIBPATHS)), \ + -L$(dir)/$(VX_CPU_FAMILY)/$(CPU_CLASS)/$(TOOL_COMMON_DIR)) + COMP_LIBNAMES = $(foreach name,$(subst :, ,$(WIND_COMPONENTS_LIBNAMES)),lib$(name).a) + COMP_MODULES = $(foreach file,$(subst :, ,$(WIND_COMPONENTS_MODULES)), $(file)) +endif + +COMP_LIBS_PRESENT += $(notdir $(foreach dir,$(WIND_COMPONENTS_LIBPATHS),\ + $(wildcard $(dir)/$(VX_CPU_FAMILY)/$(CPU_CLASS)/$(TOOL)/lib*.a))) +COMP_LIBS_PRESENT += $(notdir $(foreach dir,$(WIND_COMPONENTS_LIBPATHS),\ + $(wildcard $(dir)/$(VX_CPU_FAMILY)/$(CPU_CLASS)/$(TOOL_COMMON_DIR)/lib*.a))) + +COMP_LD_LINK_LIBS = $(patsubst lib%.a,-l%,$(filter $(COMP_LIBNAMES),$(COMP_LIBS_PRESENT))) + +COMP_LIBS = $(COMPONENT_MODULES) $(COMP_MODULES) $(COMPONENT_LIBRARIES) \ + $(COMP_LD_LINK_LIBS) + +LD_LINK_PATH += $(COMP_LD_LINK_PATH) + diff --git a/h/make/defs.memory b/h/make/defs.memory new file mode 100644 index 0000000..7846de9 --- /dev/null +++ b/h/make/defs.memory @@ -0,0 +1,90 @@ +# defs.memory - memory oriented build definitions +# +# Copyright 2004 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01a,02jul04,fle written + +# DESCRIPTION +# This build definition file sets the ADRS_MACROS and ADRS_DEFINE build macros. +# +# The ADRS_MACROS build macro list the build macros the kernel configuration +# tool will have to get from cdf files, and write in the kernel configuration +# Makefile. +# +# The ADRS_DEFINE build macros is part of the CC_DEFINES, and is passed to the +# compilers as a definition macro +# +# TREE +# This file is included by : +# +# $(TGT_DIR)/h/make/rules.memory +# +# SEE ALSO: vxprj + +# default values for some later comparisons + +DEFAULT_ADJUST_VMA = 0 +DEFAULT_VMA_START = 0 +DEFAULT_DATA_SEG_ALIGN = 1 + +ADRS_MACROS += RAM_LOW_ADRS RAM_HIGH_ADRS LOCAL_MEM_LOCAL_ADRS \ + ADJUST_VMA DATA_SEG_ALIGN + +ADRS_DEFINE = + +# the addresses may be defined with 0x values, or just hex value without +# the leading 0x, we should make sure ADRS_DEFINE does not add extra 0x when it +# is not required + +# LOCAL_MEM_LOCAL_ADRS should be given to the compilers + +ifdef LOCAL_MEM_LOCAL_ADRS + ifneq ($(findstring 0x, $(LOCAL_MEM_LOCAL_ADRS)),) +ADRS_DEFINE += $(OPTION_DEFINE_MACRO)LOCAL_MEM_LOCAL_ADRS=$(LOCAL_MEM_LOCAL_ADRS) + else +ADRS_DEFINE += $(OPTION_DEFINE_MACRO)LOCAL_MEM_LOCAL_ADRS=0x$(LOCAL_MEM_LOCAL_ADRS) + endif +endif + +# RAM_LOW_ADRS should be given to the compilers + +ifdef RAM_LOW_ADRS + ifneq ($(findstring 0x, $(RAM_LOW_ADRS)),) +ADRS_DEFINE += $(OPTION_DEFINE_MACRO)RAM_LOW_ADRS=$(RAM_LOW_ADRS) + else +ADRS_DEFINE += $(OPTION_DEFINE_MACRO)RAM_LOW_ADRS=0x$(RAM_LOW_ADRS) + endif +endif + +# RAM_HIGH_ADRS should be given to the compilers + +ifdef RAM_HIGH_ADRS + ifneq ($(findstring 0x, $(RAM_HIGH_ADRS)),) +ADRS_DEFINE += $(OPTION_DEFINE_MACRO)RAM_HIGH_ADRS=$(RAM_HIGH_ADRS) + else +ADRS_DEFINE += $(OPTION_DEFINE_MACRO)RAM_HIGH_ADRS=0x$(RAM_HIGH_ADRS) + endif +endif + +# DATA_SEG_ALIGN is not meant to be given to the compiler, just the linker +# scripts + +ifdef DATA_SEG_ALIGN + ifneq ($(findstring 0x, $(DATA_SEG_ALIGN)),) +LD_DATA_SEG_ALIGN = $(strip $(LD_DATA_SEG_ALIGN_FLAG))=$(DATA_SEG_ALIGN) + else +LD_DATA_SEG_ALIGN = $(strip $(LD_DATA_SEG_ALIGN_FLAG))=0x$(DATA_SEG_ALIGN) + endif +else +DATA_SEG_ALIGN = $(DEFAULT_DATA_SEG_ALIGN) +LD_DATA_SEG_ALIGN = $(strip $(LD_DATA_SEG_ALIGN_FLAG))=$(DATA_SEG_ALIGN) +endif + +# ADJUST_VMA is used only if it is different from the DEFAULT_ADJUST_VMA. +# If it is not set yet, just set it to DEFAULT_ADJUST_VMA + +ifndef ADJUST_VMA +ADJUST_VMA = $(DEFAULT_ADJUST_VMA) +endif diff --git a/h/make/defs.option b/h/make/defs.option new file mode 100644 index 0000000..01153ba --- /dev/null +++ b/h/make/defs.option @@ -0,0 +1,183 @@ +# defs.option - makefile definitions related to option builds +# +# Copyright (c) 1984-2005 Wind River Systems, Inc. +# +# The right to copy, distribute, modify or otherwise make use +# of this software may be licensed only pursuant to the terms +# of an applicable Wind River license agreement. +# +# +# modification history +# -------------------- +# 01h,15apr05,kch Changed 'inet6_fr' to '-inet6_fr' and 'inet6_vs_fr' +# to '-inet6_vs_fr'. +# 01g,14apr05,kch Fixed SUPPORTED_OPTIONS such that virtual stack build +# options will be supported for MSP only. Added ROUTER_STACK +# setting to virtual stack option builds. +# 01f,31mar05,kch Added the -vs, -vs_fr, -inet6_vs and inet6_vs_fr build +# options for virtual stack. +# 01e,23sep04,dlk Use OPT_DEFINE instead of EXTRA_DEFINE. Using +# EXTRA_DEFINE requires 'override', which breaks later +# additions to EXTRA_DEFINE (e.g. in some BSPs) which +# don't use 'override'. +# 01d,02sep04,dlk Remove dsi from -inet6 builds. Tighten check +# on OPT validity. Add aim to free build libraries. +# Do not modify ADDED_CFLAGS. +# 01c,04may04,dlk Added the -inet6_fr build option. Remove references +# to the fpio library. +# 01b,20apr04,dlk Added -inet6 build option. +# 01a,04feb04,dlk written. +# +# DESCRIPTION +# +# This file is included in Makefiles to establish information related +# to option builds, in particular the lists of libraries which support +# particular option builds. +# + +# Protect against multiple inclusion. +ifeq ($(DEFS_OPTION),) +DEFS_OPTION = TRUE + +# For GPP build, the environment variable $FEATURE_SET is either set to "gpp" +# or simply not defined at all. Here it is assumed that the top-level Feature +# Set Makefile (if exist) has verified the setting of the $FEATURE_SET +# variable (if defined). + +ifeq ($(FEATURE_SET),) +_GPP_BUILD = TRUE +else +ifeq ($(FEATURE_SET),gpp) +_GPP_BUILD = TRUE +endif +endif + +# Supported build options for all products + +SUPPORTED_OPTIONS = -fr -inet6 -inet6_fr + +# Supported build options for MSP platform products. +ifeq ($(_GPP_BUILD),) +SUPPORTED_OPTIONS += -vs -vs_fr -inet6_vs -inet6_vs_fr +endif + +# Check that OPT is valid. If not, fail. + +_empty_ = +_space_ = $(_empty_) $(_empty_) + +ifneq ($(OPT),) +ifneq ($(findstring $(_space_),$(OPT)),) +$(error OPT may not contain spaces: "$(OPT)") +endif +ifeq ($(filter $(OPT), $(SUPPORTED_OPTIONS)),) +$(error OPT="$(OPT)" is unsupported. Allowed: $(SUPPORTED_OPTIONS)) +endif +endif + +ifeq ($(OPT),-fr) + export _FREE_VERSION := 1 + OPT_DEFINE += -D_FREE_VERSION + +# Temporary hack until network makefiles check OPT before +# defining INCLUDE_WVNETD. +ifeq ($(LIB_BASE_NAME),net) + OPT_DEFINE += -UINCLUDE_WVNETD +endif + +endif + +LIB_BASE_NAMES-fr := net arch os wind hwdb aim + + +ifeq ($(OPT),-inet6) + export _INET6_BUILD := 1 + OPT_DEFINE += -DINET6 +endif + +LIB_BASE_NAMES-inet6 := net ppp + +ifeq ($(OPT),-inet6_fr) + export _INET6_BUILD := 1 + export _FREE_VERSION := 1 + OPT_DEFINE += -D_FREE_VERSION -DINET6 + +# Temporary hack until network makefiles check OPT before +# defining INCLUDE_WVNETD. +ifeq ($(LIB_BASE_NAME),net) + OPT_DEFINE += -UINCLUDE_WVNETD +endif + +endif # ifeq ($(OPT),-inet6_fr) + +# This should be the union of LIB_BASE_NAMES-fr and LIB_BASE_NAMES-inet6 + +LIB_BASE_NAMES-inet6_fr := $(LIB_BASE_NAMES-inet6) +LIB_BASE_NAMES-inet6_fr += \ + $(filter-out $(LIB_BASE_NAMES-inet6),$(LIB_BASE_NAMES-fr)) + + +# For (ipv4 only) virtual stack support (OPT=-vs) + +ifeq ($(OPT),-vs) + export _VIRTUAL_STACK_BUILD := 1 + OPT_DEFINE += -DVIRTUAL_STACK -DROUTER_STACK +endif + +# For virtual stack, the rpc directory must be rebuild. +LIB_BASE_NAMES-vs := $(LIB_BASE_NAMES-inet6) rpc + + +# For (ipv4 only) virtual stack + free build support (OPT=-vs_fr) + +ifeq ($(OPT),-vs_fr) + export _VIRTUAL_STACK_BUILD := 1 + export _FREE_VERSION := 1 + OPT_DEFINE += -D_FREE_VERSION -DVIRTUAL_STACK -DROUTER_STACK + +# Temporary hack until network makefiles check OPT before +# defining INCLUDE_WVNETD. +ifeq ($(LIB_BASE_NAME),net) + OPT_DEFINE += -UINCLUDE_WVNETD +endif + +endif # ifeq ($(OPT),-vs_fr) + +LIB_BASE_NAMES-vs_fr := $(LIB_BASE_NAMES-vs) +LIB_BASE_NAMES-vs_fr += \ + $(filter-out $(LIB_BASE_NAMES-vs),$(LIB_BASE_NAMES-fr)) + + +# For virtual stack + inet6 support (OPT=-inet6_vs) + +ifeq ($(OPT),-inet6_vs) + export _INET6_BUILD := 1 + export _VIRTUAL_STACK_BUILD := 1 + OPT_DEFINE += -DINET6 -DVIRTUAL_STACK -DROUTER_STACK +endif + +LIB_BASE_NAMES-inet6_vs := $(LIB_BASE_NAMES-vs) + + +# For virtual stack + inet6 + free build support (OPT=-inet6_vs_fr) + +ifeq ($(OPT),-inet6_vs_fr) + export _INET6_BUILD := 1 + export _VIRTUAL_STACK_BUILD := 1 + export _FREE_VERSION := 1 + OPT_DEFINE += -DINET6 -D_FREE_VERSION -DVIRTUAL_STACK -DROUTER_STACK + +# Temporary hack until network makefiles check OPT before +# defining INCLUDE_WVNETD. +ifeq ($(LIB_BASE_NAME),net) + OPT_DEFINE += -UINCLUDE_WVNETD +endif + +endif # ifeq ($(OPT),-inet6_vs_fr) + +LIB_BASE_NAMES-inet6_vs_fr := $(LIB_BASE_NAMES-vs) +LIB_BASE_NAMES-inet6_vs_fr += \ + $(filter-out $(LIB_BASE_NAMES-vs),$(LIB_BASE_NAMES-fr)) + + +endif # ifeq ($(DEFS_OPTION),) diff --git a/h/make/defs.pal b/h/make/defs.pal new file mode 100644 index 0000000..0a29455 --- /dev/null +++ b/h/make/defs.pal @@ -0,0 +1,58 @@ +# defs.pal - PAL related definitions for making libraries +# +# Copyright 2003, Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01d,29apr05,md added CPU variant make depend +# 01c,15mar04,dlk Set DEFS_PAL. Fix modification history. +# 01b,.......,c_c Added a definition for cleaning the CPU variant dependent +# libraries. +# 01a,.......,c_c written from rules.library v 02b +# + +## CPU variant builds: +# List of CPU variant builds: CPU_VARIANT_TAG_LIST +# This list is computed for the current CPU/TOOL combinaison. Note that CPU +# variant build(s) are started as part of the 'Default' rule (see rules.library) + +# Defining DEFS_PAL non-empty is needed in defs.library by the option build +# logic to ensure we don't skip any directory including this file, +# particularly src/arch. +DEFS_PAL = TRUE + +include $(TGT_DIR)/h/make/defs.library + +ifneq ($(CPU_VARIANT_LIST),) +CPU_VARIANT_TAG_LIST_TMP1 = \ + $(foreach cpuVariantTag, $(CPU_VARIANT_LIST), \ + $(filter $(CPU)$(TOOL), \ + $(CPU_VARIANT_CPU_TOOL_LIST$(cpuVariantTag)))$(cpuVariantTag)) +CPU_VARIANT_TAG_LIST_TMP2 = $(filter $(CPU)$(TOOL)%, \ + $(CPU_VARIANT_TAG_LIST_TMP1)) +CPU_VARIANT_TAG_LIST = $(patsubst $(CPU)$(TOOL)%, %, \ + $(CPU_VARIANT_TAG_LIST_TMP2)) + +# Generate list of make commands for CPU variant builds: CPU_VARIANT_MAKE_CMD + +ifneq ($(CPU_VARIANT_TAG_LIST),) +CPU_VARIANT_MAKE_CMD = echo "Build of CPU variants" +CPU_VARIANT_MAKE_CMD += $(foreach cpuVariant, $(CPU_VARIANT_TAG_LIST), \ + $(CMD_SEPARATOR) $(MAKE) CPU=$(CPU) TOOL=$(TOOL) LIB_DIR_TAG=$(cpuVariant) \ + VX_ARCHIVE_LIST="$(VX_ARCHIVE_LIST$(cpuVariant))" TARGET=$(TARGET) \ + NO_RECURSE=TRUE) + +CPU_VARIANT_MAKE_CLEAN = echo "Removal of CPU variants" +CPU_VARIANT_MAKE_CLEAN += $(foreach cpuVariant, $(CPU_VARIANT_TAG_LIST), \ + $(CMD_SEPARATOR) $(MAKE) CPU=$(CPU) TOOL=$(TOOL) LIB_DIR_TAG=$(cpuVariant) \ + VX_ARCHIVE_LIST="$(VX_ARCHIVE_LIST$(cpuVariant))" TARGET=$(TARGET) \ + NO_RECURSE=TRUE rclean) + +CPU_VARIANT_MAKE_DEPEND = echo "Build of CPU variant depend files" +CPU_VARIANT_MAKE_DEPEND += $(foreach cpuVariant, $(CPU_VARIANT_TAG_LIST), \ + $(CMD_SEPARATOR) $(MAKE) CPU=$(CPU) TOOL=$(TOOL) LIB_DIR_TAG=$(cpuVariant) \ + VX_ARCHIVE_LIST="$(VX_ARCHIVE_LIST$(cpuVariant))" TARGET=$(TARGET) \ + NO_RECURSE=TRUE rdepend) +endif +endif + diff --git a/h/make/defs.project b/h/make/defs.project new file mode 100644 index 0000000..7934e1f --- /dev/null +++ b/h/make/defs.project @@ -0,0 +1,119 @@ +# defs.project - project default makefile definitions +# +# Copyright 1984-2004, Wind River Systems, Inc. +# +# modification history +# -------------------- +# 02d,08Aug05,pee added definition of files generated by configGen +# 02c,09sep04,fle SPR#88074 : added PRJ_MAKEFILE +# 02b,09feb04,fle Adapted to new host utilities locations +# 02a,19aug03,fle removed references to cxrGen.tcl and mxrGen.tcl +# SPR#88802 : use WTXTCL macro for TRIM_TOOL +# 01z,15jan02,rbl define a WIND_PROJECT_MAKEFILE variable so we can tell +# if it's a project build +# 01y,12nov01,j_s changed to include defs.link for libraries definitions +# 01x,20oct01,dat Relocating tool specific macro +# 01w,25sep01,dat Default values for TOOL_FAMILY +# 01v,17sep01,sn moved definitions of LARGE_PROJECT, MUNCH_FLAGS and related +# macros to defs.gnu; moved uses of LARGE_PROJECT to +# rules.project +# 01u,13jul01,t_m fix test for SIM CPU type definitions +# 01t,20apr01,mem Add LD_ENDIAN_FLAG +# 01s,23mar01,roz Fix check for GNU compiler. +# 01r,25jan00,dra Suppress warnings when compiling symbol table. +# 01q,02nov99,dra Added back hack for collect2. +# 01p,27oct99,rsh Add definition of OBJCPY +# 01o,10aug99,jld Revert LARGE_PROJECT change -- no longer using T1 compiler. +# 01n,23jun99,rsh Edit to turn off LARGE_PROJECT facility so that it will +# work with T1 compiler. +# 01m,31mar99,tdl added $(LD_PARTIAL_LAST_FLAGS) +# 01l,04mar99,sn added machinery to handle large projects +# 01k,18feb99,sn merge POST_MUNCH and MUNCH, add MUNCH_FLAGS +# 01j,17nov98,sn reworked munch +# 01i,11nov98,sn partially link using LD_PARTIAL +# 01h,11nov98,sn munch -> orderCtors +# 01g,05nov98,ms -traditional -> -fdollars-in-identifiers +# 01f,30oct98,yh added TRIM_TOOL. +# 01e,26oct98,ms added Cy's OPTION_* flags +# 01e,08apr99,bc Merge in objcopy invocations from Aeolus +# 01d,29jun98,ms removed "-n" from NM_GLOB_FLAGS +# 01c,29jun98,ms added NM_GLOB_FLAGS, MXR_USR_OBJS. +# 01c,26jun98,ms tool suffix change: VX_CPU_FAMILY->TOOLENV. +# 01b,02apr98,pcn Removed Objcopy changes from Tempest view +# 01a,10oct97,ms written based on defs.bsp +# +# DESCRIPTION +# This file is included into project makefiles to define the default makefile +# definitions. After the include the Makefile may customize the definitions +# found here to suit the circumstance. +# +# Redefinitions of make variables earlier than the include of this file will +# have no affect. +# + +.SUFFIXES: .cpp .out .cxx +.PRECIOUS: %_downLoadable %_rom %_romCompressed %_romResident %_reloc %.o +.PHONY: __always_build__ clean + +## exe target is the cannonical starting point. + +default : exe + +## toolchain binaries + +CFG_GEN = $(TCL) $(WIND_BASE)/host/resource/hutils/tcl/configGen.tcl +TRIM_TOOL = $(TCL) $(WIND_BASE)/host/resource/hutils/tcl/trim.tcl + +## generated files +CFG_GEN_FILES = $(PRJ_DIR)/prjConfig.c $(PRJ_DIR)/prjComps.h $(PRJ_DIR)/prjParams.h $(PRJ_DIR)/linkSyms.c + +## module cross reference macros +# by default, just generate xref's for the main vxWorks archive, +# and regenerate the xref every time the archive changes + +MXR_LIBS = $(TGT_DIR)/lib/lib$(CPU)$(TOOL)vx.a +MXR_USR_OBJS = $(filter-out linkSyms.o prjConfig.o, $(PRJ_OBJS)) +MXR_DEPEND = $(MXR_LIBS) + +## bsp flags + + +COMPILE_TRADITIONAL = $(CC) $(OPTION_OBJECT_ONLY) $(OPTION_DOLLAR_SYMBOLS)\ + $(CFLAGS) +COMPILE_SYMTBL = $(CC) $(OPTION_OBJECT_ONLY) $(OPTION_DOLLAR_SYMBOLS)\ + $(CFLAGS) $(OPTION_NO_WARNINGS) + +COMP_DIR = $(TGT_DIR)/config/comps +DATA_SEG_PAD_C = $(COMP_DIR)/src/dataSegPad.c +VERSION_C = $(COMP_DIR)/src/version.c +USR_ENTRY_C = $(COMP_DIR)/src/usrEntry.c + +## libraries + +include $(TGT_DIR)/h/make/defs.link + +# map TOOL to TOOL_FAMILY, if not already done elsewhere (it should). +# Do not expand to include other tools, define TOOL_FAMILY directly +# in the relevent Makefile. + +ifeq ($(TOOL_FAMILY),) +ifeq ($(findstring gnu,$(TOOL)),gnu) +TOOL_FAMILY = gnu +else +ifeq ($(findstring diab,$(TOOL)),diab) +TOOL_FAMILY = diab +endif +endif +endif + +ifndef PRJ_MAKEFILE +PRJ_MAKEFILE = $(PRJ_DIR)/Makefile +endif + +## this is a project build + +WIND_PROJECT_MAKEFILE = TRUE + +include $(TGT_DIR)/h/make/defs.$(WIND_HOST_TYPE) +include $(TGT_DIR)/h/make/defs.$(PRJ_TYPE) +include $(TGT_DIR)/h/tool/$(TOOL_FAMILY)/make.$(CPU)$(TOOL) diff --git a/h/make/defs.singleCpuVariant b/h/make/defs.singleCpuVariant new file mode 100644 index 0000000..5cf09bb --- /dev/null +++ b/h/make/defs.singleCpuVariant @@ -0,0 +1,19 @@ +# defs.singleCpuVariant - support for building a single CPU_VARIANT +# +# Copyright 2005, Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01a,20sep05,pch written +# +# This fragment is to be included into the Makefile in only those directories +# whose contents must be built differently for each CPU_VARIANT. It translates +# the ONLY_CPU_VARIANT setting from vxprj into a LIB_DIR_TAG setting which +# will cause the appropriate variant-dependent build flags to be used. +# ONLY_CPU_VARIANT is examined nowhere else, and is not intended to be set +# by the "normal" build mechanism (which builds all applicable variants for +# the current CPU and TOOL). + +ifneq ($(ONLY_CPU_VARIANT),) + LIB_DIR_TAG=$(ONLY_CPU_VARIANT) +endif diff --git a/h/make/defs.sun4-solaris2 b/h/make/defs.sun4-solaris2 new file mode 100644 index 0000000..11c8ba4 --- /dev/null +++ b/h/make/defs.sun4-solaris2 @@ -0,0 +1,19 @@ +# defs.sun4-solaris2 - Host specific default definitions +# +# modification history +# -------------------- +# 01e,02apr98,pcn Removed Objcopy changes from Tempest view +# 01d,15dec97,pcn Added Objcopy in BSP build. +# 01c,02jul96,dat SPR 6141, proper use of TGT_DIR +# 01b,04dec95,ms changed RM so solaris won't complain if no file is specified +# 01a,01jun95,yp created +# +# DESCRIPTION +# This file contains default definitions, and flags used in building targets +# that are host specific to sun4-solaris2. + +TGT_DIR=$(WIND_BASE)/target +include $(TGT_DIR)/h/make/defs.unix + +RM = rm -f "" + diff --git a/h/make/defs.unix b/h/make/defs.unix new file mode 100644 index 0000000..b22c0dd --- /dev/null +++ b/h/make/defs.unix @@ -0,0 +1,179 @@ +# defs.unix - standard unix host specific makefile +# +# Copyright 1995-2005, Wind River Systems. +# +# modification history +# -------------------- +# 02o,06sep05,h_k added USRENTRY. (SPR #111954) +# 02n,09may05,j_c merging 02l and 02m changes from the 2 branches +# 02m,22apr05,h_a Redoing a LIB_ROOT change that was erratically undone +# 02m,19apr05,tpw Adjust to new docs location as of WB18 +# 02l,18Apr05,pee Added support for precomp objects +# 02l,07apr05,h_a Definition of LIB_ROOT for externel lib targets +# 02l,07apr05,h_a LIB_ROOT to replace $(TGT_DIR)/lib for building components +# 02k,02sep04,c_c Modified tclsh location. +# 02j,07jul04,c_c Removed usage of romfs_image.h. +# 02i,15jul04,kab SPR 99488: requires /bin/echo +# 02h,26may04,dgp remove references to refgen.tcl +# 02g,26apr04,f_b Removed absolute path to objcopy to prepare for new +# directory structure and align with how nm & size are found +# 02f,20feb04,c_c Avoid eror message if no file is given to sed. +# 02e,09feb04,fle Adapted to new host utilities locations +# 02d,12jan04,pad Now call directly makeSymTbl.tcl instead of the Unix and +# Windows wrapper files (SPR #92936). +# 02c,01dec03,c_c Added macros for postprocessing dependencies. +# 02b,26nov03,bpn Fixed DIRCHAR macro. +# 02a,07nov03,c_c Unified build rules with WIN32 hosts. +# 01z,09oct03,md make ROMFS location resident in project root +# 01y,02jul03,md added ROMFS variables +# 01x,17apr02,jab added NULL_DEVICE make variable +# 01w,14dec01,tam added CMD_SEPARATOR def +# 01v,02nov01,tam added RMDIR +# 01u,01nov01,jab added MKDIR +# 01t,20oct01,dat Relocting tool specific macros +# 01s,27aug01,wsl add man pages +# 01r,19dec00,rec add endian flag to CPP definition +# 01q,06dec00,sn removed -xc +# 01q,08apr99,bc Merge in objcopy invocations from Aeolus +# 01p,07sep98,fle added doc related variable : DOCS_ROOT +# 01o,02apr98,pcn Removed Objcopy changes from Tempest view +# 01n,25feb98,ms added NOP def, removed VX_CPU_FAMILY=$(TOOLENV) from CPP +# 01m,15dec97,pcn Added Objcopy in BSP build. +# 01l,20oct97,tm added constants to support objcopy gated by USE_OBJCOPY flag +# 01k,10oct97,ms added MV and ECHO. Don't define USRCONFIG, BOOTINIT, ... +# macros if using new build rules. +# 01j,17aug96,yp Added definition of LIBDIR and BSPBUILD_TCL and DIRCHAR +# 01i,18aug96,ms use deflate to compress bootROM images +# 01h,18apr96,dat +# +yp added MKPREP +# 01g,06mar96,dat removed makeVersion +# 01f,13nov95,p_m added DEMO_DIR. +# 01e,03nov95,yp Made CPP arch specific so .s.o targets don't get generate +# 01d,24oct95,dat recovered CONFIG_ALL macro +# 01c,29jun95,kkk added VXSIZE definition. +# 01b,19jun95,yp allowed arch. specific tools to be inherited from +# make.$(CPU)$(TOOL) +# 01a,01jun95,yp created +# +# DESCRIPTION +# This file contains default definitions, and flags used in building targets +# that are host specific to a standard unix environment. + + +## directories + +BIN_DIR = $(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin +FOUNDATION_DIR = $(WIND_FOUNDATION_PATH)/$(WIND_HOST_TYPE)/bin + +ifeq ($(WIND_PROJECT_MAKEFILE),) +TGT_DIR = $(WIND_BASE)/target +endif + +ifeq ($(LIB_ROOT),) +LIB_ROOT = $(TGT_DIR)/lib +else +override LIB_ROOT := $(subst \,/,$(LIB_ROOT)) +endif + +CONFIG_ALL = $(TGT_DIR)/config/all +DEMO_DIR = $(TGT_DIR)/lib/obj$(CPU)$(TOOL)test +LIBDIR = $(LIB_ROOT)/$(LIBDIRNAME) +PRECOMPBASE = $(TGT_DIR)/precomp +PRECOMPDIR = $(TGT_DIR)/precomp/$(LIBDIRNAME) +RESOURCE_DIR = $(WIND_BASE)/host/resource + +## doc files + +DOCS_ROOT = $(WIND_DOCS)/extensions/eclipse/plugins +MAN_PAGE_DIR = $(WIND_BASE)/man +DOC_OPTS = $(DOC_OPTS_MAN) +DOC_OPTS_C_TCL = -config CTcl2html +DOC_OPTS_CPP = -cpp +DOC_OPTS_FILE = -config File2html +DOC_OPTS_MAN = -mg -missingok + +## tools + +ENV_BIN = VX_CPU_FAMILY=$(TOOLENV) $(BIN_DIR)/ +EXTRACT_BIN = $(OBJCPY) $(EXTRACT_BIN_FLAG) +BINXSYM = $(OBJCPY) $(EXTRACT_SYM_FLAG) +BINHEX = $(OBJCPY) $(EXTRACT_HEX_FLAG) +BINCONV = $(OBJCPY) +COMPRESS = $(ENV_BIN)deflate +ROMSIZEPROG = $(ENV_BIN)romsize +VXSIZEPROG = $(ENV_BIN)vxsize +MKSYMTBL = $(TCL) $(WIND_BASE)/host/resource/hutils/tcl/makeSymTbl.tcl \ + $(TOOLENV) +BINTOASM = $(ENV_BIN)binToAsm +MKPREP = $(ENV_BIN)mkprep +MG = $(ENV_BIN)mg +MKROMFS = $(ENV_BIN)mkromfs +LDOUT_SYMS = true +LDOUT_CONV = true +LDOUT_HOST = true +MV_BIN = echo +MKDIR = mkdir -p +RMDIR = rm -f -r +RM = rm -f +MV = mv +ECHO = /bin/echo +CP = cp +SED = sed +TR = tr +ASM_P1 = cat +ASM_P2 = cat +TARGET = +BSPBUILD_TCL = $(BIN_DIR)/bspBuild.tcl +NOP = \# + +## macro for postprocessing dependencies + +PROCESS_DEP = if [ -f $@ ]; then \ + $(SED) -e 's|^.*\.o|\$$\(LIBDIR\)/&|g' \ + -e "s|$(TGT_DIR)|\\$$\(TGT_DIR\)|g" \ + -e "s|$(WIND_GNU_PATH)|\\$$\(WIND_GNU_PATH\)|g" \ + -e "s|$(WIND_DIAB_PATH)|\\$$\(WIND_DIAB_PATH\)|g" \ + -e "s|$(WIND_BASE)|\\$$\(WIND_BASE\)|g" $@ > $@.post; \ + $(MV) $@.post $@; fi + +PROCESS_DEP_PRECOMP = if [ -f $@.precomp ]; then \ + $(SED) -e 's|^.*\.o|\$$\(PRECOMPDIR\)/&|g' \ + -e "s|$(TGT_DIR)|\\$$\(TGT_DIR\)|g" \ + -e "s|$(WIND_GNU_PATH)|\\$$\(WIND_GNU_PATH\)|g" \ + -e "s|$(WIND_DIAB_PATH)|\\$$\(WIND_DIAB_PATH\)|g" \ + -e "s|$(WIND_BASE)|\\$$\(WIND_BASE\)|g" $@.precomp >> $@; \ + $(RM) $@.precomp; fi + +BSP_PROCESS_DEP = if [ -f $@ ]; then \ + $(SED) -e "s|$(CONFIG_ALL)|\\$$\(CONFIG_ALL\)|g" \ + -e "s|$(TGT_DIR)|\\$$\(TGT_DIR\)|g" \ + -e "s|$(WIND_GNU_PATH)|\\$$\(WIND_GNU_PATH\)|g" \ + -e "s|$(WIND_DIAB_PATH)|\\$$\(WIND_DIAB_PATH\)|g" \ + -e "s|$(WIND_BASE)|\\$$\(WIND_BASE\)|g" $@ > $@.post; \ + $(MV) $@.post $@; fi + +## DIRCHAR exists for compatibility reason. It should be removed +DIRCHAR = / + +## We now rely on the path to get the right tcl exe. +TCL = tclsh + +# REFGEN = $(WTXTCL) $(RESOURCE_DIR)/doctools/apigen.pl +HTMLLINK = $(WTXTCL) $(RESOURCE_DIR)/doctools/htmlLink.tcl +HTMLBOOK = $(WTXTCL) $(RESOURCE_DIR)/doctools/htmlBook.tcl + +ifneq ($(NEW_RULES),TRUE) +## files + +USRCONFIG = $(CONFIG_ALL)/usrConfig.c +USRENTRY = $(CONFIG_ALL)/usrEntry.c +BOOTCONFIG = $(CONFIG_ALL)/bootConfig.c +BOOTINIT = $(CONFIG_ALL)/bootInit.c +DATASEGPAD = $(CONFIG_ALL)/dataSegPad.c +CONFIG_ALL_H = $(CONFIG_ALL)/configAll.h +endif + +## Miscellaneous + +CMD_SEPARATOR = ; +NULL_DEVICE = /dev/null diff --git a/h/make/defs.vxApp b/h/make/defs.vxApp new file mode 100644 index 0000000..cdee9bd --- /dev/null +++ b/h/make/defs.vxApp @@ -0,0 +1,14 @@ +# defs.vxApp - makefile target definitions for vxWorks application projects +# +# modification history +# -------------------- +# 01a,30may02,cjs added modhist. Got rid of linkedObjs.o reference and +# changed ARCHIVE too. +# + +ifeq ($(DEFAULT_RULE),) +DEFAULT_RULE = $(basename $(notdir $(PRJ_FILE))).out +endif +ifeq ($(ARCHIVE),) +ARCHIVE = $(basename $(notdir $(PRJ_FILE))).a +endif diff --git a/h/make/defs.vxWorks b/h/make/defs.vxWorks new file mode 100644 index 0000000..defc0bc --- /dev/null +++ b/h/make/defs.vxWorks @@ -0,0 +1,92 @@ +# defs.vxWorks - vxworks default makefile definitions +# +# Copyright 1984-2004, Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01k,10aug04,fle SPR#100638 : wrong values used for ROM Flags +# 01j,04mar04,fle Added CC_ROM_FLAGS +# 01i,25sep03,dat adding _WRS_KERNEL to compile flags (TEMPORARY) +# 01h,23jul03,jmp always define MAKE_SYM if INCLUDE_STANDALONE_SYM_TBL is not +# defined. +# 01g,28jan02,sn always build ctdt.o +# 01f,24apr00,dat SPR 30819, fix project link of ROM images +# 01e,11apr00,dra Added RES_LDFLAGS where needed. +# 01d,05may99,bc fix BINXSYM command for objcopy version. +# 01c,07jul98,ms fixed MAKE_SYM definition. +# 01b,29jun98,ms renamed vxWorks_downLoadable to just vxWorks. +# 01a,10oct97,ms written based on defs.bsp. +# +# DESCRIPTION +# This file is included into project makefiles for vxWorks based projects. +# It overrides some of the defintions from defs.project +# + +## link addresses + +ifeq ($(ROM_LINK_ADRS),) +ROM_LINK_ADRS = $(ROM_TEXT_ADRS) +endif + +# HELP: Temporary fix to get -D_WRS_KERNEL into the project build of a +# VxWorks image. + +CC_ROM_FLAGS = -DRAM_DATA_ADRS=0x$(RAM_LOW_ADRS) \ + -DRAM_DST_ADRS=0x$(RAM_LOW_ADRS) +CC_ROM_HIGHLOW_FLAGS = -DRAM_DATA_ADRS=0x$(RAM_HIGH_ADRS) \ + -DRAM_DST_ADRS=0x$(RAM_LOW_ADRS) +LD_RAM_FLAGS = -Ttext $(RAM_LOW_ADRS) + +LD_ROM_RES_FLAGS= $(ROM_LDFLAGS) $(RES_LDFLAGS) -Ttext $(ROM_LINK_ADRS) \ + -Tdata $(RAM_LOW_ADRS) +CC_ROM_RES_FLAGS= -DROM_RESIDENT $(CC_ROM_FLAGS) + +LD_ROM_CPY_FLAGS= $(ROM_LDFLAGS) $(RES_LDFLAGS) -Ttext $(ROM_LINK_ADRS) \ + -Tdata $(RAM_HIGH_ADRS) +CC_ROM_CPY_FLAGS= -DROM_COPY $(CC_ROM_HIGHLOW_FLAGS) + +LD_ROM_CMP_FLAGS= $(ROM_LDFLAGS) $(RES_LDFLAGS) -Ttext $(ROM_LINK_ADRS) \ + -Tdata $(RAM_HIGH_ADRS) +CC_ROM_CMP_FLAGS= -DROM_COMPRESS $(CC_ROM_HIGHLOW_FLAGS) + +# default build images + +ifeq ($(DEFAULT_RULE),) +DEFAULT_RULE = vxWorks +endif +RELEASE = vxWorks + +# For simplicity always build ctdt.o (an array of compiler generated +# static initializers). + +POSTLINK_MODULES += ctdt.o + +# If INCLUDE_STANDALONE_SYM_TBL component is included, then add the symbol +# table module to POSTLINK_MODULES. Otherwise MAKE_SYM is always defined, +# so that vxWorks symbol table is always built (to match behavior with bsp +# build), and can be used by components like INCLUDE_NET_SYM_TBL or +# INCLUDE_PASS_FS_TBL. + +ifneq ($(findstring INCLUDE_STANDALONE_SYM_TBL, $(COMPONENTS)),) +POSTLINK_MODULES += symTbl.o +else +define MAKE_SYM + $(BINXSYM) $@ $@.sym +endef +define MAKE_SYM_CVT + $(LDOUT_SYMS) $@.sym +endef +endif + + +## XXX - for backwards compatibility + +LD_LOW_FLAGS = LOW_FLAGS +LD_HIGH_FLAGS = HIGH_FLAGS +ifeq ($(LD_LOW_FLAGS), HIGH_FLAGS) +RAM_LOW_ADRS = $(RAM_HIGH_ADRS) +endif +ifeq ($(LD_HIGH_FLAGS), LOW_FLAGS) +RAM_HIGH_ADRS = $(RAM_LOW_ADRS) +endif + diff --git a/h/make/defs.vxcom b/h/make/defs.vxcom new file mode 100644 index 0000000..9e45817 --- /dev/null +++ b/h/make/defs.vxcom @@ -0,0 +1,28 @@ +# defs.vxcom - makefile target rules for vxcom and vxdcom +# +# modification history +# -------------------- +# 01c,22oct01,dbs add extra subdirs to vxcom build +# 01b,19oct01,dbs add config to allow derived files to be checked in +# 01a,19sep01,nel created + +VXDCOM_BUILD_HOST=t2 + +VXCOM_BASE = $(WIND_BASE)/target/src/vxcom +VXDCOM_BASE = $(WIND_BASE)/target/src/vxdcom + +VXCOM_PUBLIC_H_DIR = $(WIND_BASE)/target/src/vxcom/veloce-hack +VXCOM_PRIVATE_H_DIR = $(WIND_BASE)/target/src/vxcom/veloce-hack +VXCOM_PS_DIR = $(WIND_BASE)/target/src/vxcom/veloce-hack +VXCOM_GUID_DIR = $(WIND_BASE)/target/src/vxcom/veloce-hack + +VXDCOM_PUBLIC_H_DIR = $(WIND_BASE)/target/src/vxcom/veloce-hack +VXDCOM_PRIVATE_H_DIR = $(WIND_BASE)/target/src/vxcom/veloce-hack +VXDCOM_PS_DIR = $(WIND_BASE)/target/src/vxcom/veloce-hack +VXDCOM_GUID_DIR = $(WIND_BASE)/target/src/vxcom/veloce-hack + +VXCOM_NO_AUTOMATIC_IDLCOMP = 1 + +VXCOM_EXTRA_CFLAGS = -I$(WIND_BASE)/target/src/vxcom/veloce-hack + +VXCOM_EXTRA_SUBDIRS = veloce-hack diff --git a/h/make/defs.x86-freebsd b/h/make/defs.x86-freebsd new file mode 100644 index 0000000..cd59f81 --- /dev/null +++ b/h/make/defs.x86-freebsd @@ -0,0 +1,15 @@ +# defs.x86-freebsd - Host specific default definitions +# +# modification history +# -------------------- +# 01a,13dec99,dra created, based on defs.sun4-solaris2 rev 01e. +# +# DESCRIPTION +# This file contains default definitions, and flags used in building targets +# that are host specific to x86-freebsd. + +TGT_DIR=$(WIND_BASE)/target +include $(TGT_DIR)/h/make/defs.unix + +RM = rm -f "" + diff --git a/h/make/defs.x86-linux2 b/h/make/defs.x86-linux2 new file mode 100644 index 0000000..08c05ff --- /dev/null +++ b/h/make/defs.x86-linux2 @@ -0,0 +1,19 @@ +# defs.x86-linux2 - Host specific default definitions +# +# Copyright 2003-2004 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01c,15jul04,kab SPR 99488: requires /bin/echo +# 01b,25jun04,fle SPR#98612 : defined ECHO as echo -e +# 01a,17jul03,dbt copied from defs.sun4-solaris2 +# +# DESCRIPTION +# This file contains default definitions, and flags used in building targets +# that are host specific to x86-linux2. + +TGT_DIR=$(WIND_BASE)/target +include $(TGT_DIR)/h/make/defs.unix + +ECHO = /bin/echo -e +RM = rm -f "" diff --git a/h/make/defs.x86-win32 b/h/make/defs.x86-win32 new file mode 100644 index 0000000..7a88c1b --- /dev/null +++ b/h/make/defs.x86-win32 @@ -0,0 +1,127 @@ +# defs.x86-win32 - Host specific default definitions +# +# Copyright 1995-2004 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 02p,18apr05,pee added support for precomp objects +# 02o,25jun04,fle SPR#98612 : defined ECHO as echo -e +# 02n,20feb04,c_c Avoid eror message if no file is given to sed. +# 02m,12jan04,c_c Fixed SPR 93116. +# 02l,01dec03,c_c Added dependencies processing overrides. +# 02k,07nov03,c_c Unified build rules with WIN32 hosts. +# 02j,09oct03,md make ROMFS location resident in project root +# 02i,02jul03,md added ROMFS variables +# 02h,17apr02,jab added NULL_DEVICE make variable +# 02g,04feb02,fmk change definition of MKSYMTBL to add .bat for x86-win32 +# 02f,11dec01,rbl add OUTPUT_OPTION to get implicit rules working better on +# Windows. +# Don't redefine TGT_DIR if already defined, especially not +# with a backslash: project defines TGT_DIR with a forward +# slash and make is sensitive to the difference +# 02f,14dec01,tam added CMD_SEPARATOR def +# 02e,02nov01,tam added RMDIR +# 02d,01nov01,jab added MKDIR +# 02c,20oct01,dat Relocting tool specific macros +# 02b,29may01,jb Adding big-endian support +# 01z,19dec00,rec add endian flag to CPP definition +# 01y,06dec00,sn removed -xc +# 01x,18jan99,sn removed hack that worked around collect2 bug (now fixed) +# 01w,05jan99,fle added the DOC_OPTS_XXX flags +# 01v,07dec98,sn added comment indicating changes that will be required +# when we get collect2 working on windows. +# 01u,10nov98,fle added DOCS_DIR variable for man pages generation +# 01t,26oct98,fle added WTXTCL, REFGEN, HTMLLINK and HTMLBOOK variables for +# documentation generation +# 01t,08apr99,bc Merge in objcopy invocations from Aeolus +# 01s,21jul98,cym changed cpp$(ARCH) to cc$(ARCH) -E +# 01q,16jun98,sn Corrected definition of CPP +# 01p,02apr98,pcn Removed Objcopy changes from Tempest view +# 01o,15dec97,pcn Added Objcopy in BSP build. +# 01n,10oct97,ms added MV and ECHO. Don't define USRCONFIG, BOOTINIT, ... +# macros if using new build rules. +# 01m,21jan97,j_k Fixed DIRCHAR to be result of a macro. +# 01l,17aug96,yp Added definition of LIBDIR and BSPBUILD_TCL and DIRCHAR +# 01k,18aug96,ms use deflate to compress bootROM images +# 01j,06jun96,dat SPR 6141, proper use of TGT_DIR +# 01i,18apr96,dat +# +yp added MKPREP +# 01h,06mar96,dat removed makeVersion +# 01g,13nov95,p_m added DEMO_DIR. +# 01f,03nov95,yp Made CPP arch specific .s.o targets don't get generate +# 01g,24oct95,dat recovered CONFIG_ALL +# 01f,31jul95,jmb changed 'rm' to 'vxrm' and added CC_DEBUG +# 01e,28jul95,sks removed 'echo' and replaced with '@rem' for 'true' +# 01d,25jul95,jmb added VX_CPU_FAMILY for romsize and vxsize +# 01c,14jul95,yp added definition for VXSIZEPROG +# 01b,19jun95,yp allowed arch. specific tools to be inherited from +# make.$(CPU)$(TOOL) +# 01a,01jun95,yp created +# +# DESCRIPTION +# This file contains default definitions, and flags used in building targets +# that are host specific to win32. +# + +MAKESHELL = sh.exe + +WIND_BASE := $(subst \,/,$(WIND_BASE)) + +ifeq ($(LIBNAME),) +LIBNAME = lib$(CPU)$(TOOL)vx.a +endif + +ifeq ($(LIBDIRNAME),) +LIBDIRNAME = obj$(CPU)$(TOOL)vx +endif + +include $(TGT_DIR)/h/make/defs.unix + + +## make internals + +# used by make for its predefined implicit rules. It is already +# set for UNIX (compiled in to make), but it is not set for +# Windows. + +OUTPUT_OPTION = -o $@ + +# override some Unix definitions +NULL_DEVICE := NULL +VXSIZEPROG = $(BIN_DIR)/vxsize $(VX_CPU_FAMILY) +ROMSIZEPROG = $(BIN_DIR)/romsize $(VX_CPU_FAMILY) +ECHO = echo -e + +## those overrides take care of '\r' management when processing dependencies, +## plus the translation of '\' path delimiter that DIAB gives, to '/' +## also take care of :// path that GNU may produce. + +PROCESS_DEP = if [ -f $@ ]; then \ + $(TR) -d '\r'< $@ > $@.tr; \ + $(RM) $@; \ + $(SED) -e 's|\\|/|g' -e 's|//|/|g' \ + -e 's|^.*\.o|\$$\(LIBDIR\)/&|g' \ + -e "s|$(TGT_DIR)|\\$$\(TGT_DIR\)|g" \ + -e "s|$(WIND_BASE)|\\$$\(WIND_BASE\)|g" \ + -e 's|/$$|\\|g' $@.tr > $@; \ + $(RM) $@.tr; fi + +PROCESS_DEP_PRECOMP = if [ -f $@.precomp ]; then \ + $(TR) -d '\r'< $@.precomp > $@.precomp.tr; \ + $(RM) $@.precomp; \ + $(SED) -e 's|\\|/|g' -e 's|//|/|g' \ + -e 's|^.*\.o|\$$\(PRECOMPDIR\)/&|g' \ + -e "s|$(TGT_DIR)|\\$$\(TGT_DIR\)|g" \ + -e "s|$(WIND_BASE)|\\$$\(WIND_BASE\)|g" \ + -e 's|/$$|\\|g' $@.precomp.tr >> $@; \ + $(RM) $@.precomp.tr; fi + +BSP_PROCESS_DEP = if [ -f $@ ]; then \ + $(TR) -d '\r'< $@ > $@.tr; \ + $(RM) $@; \ + $(SED) -e 's|\\|/|g' -e 's|//|/|g' \ + -e "s|$(CONFIG_ALL)|\\$$\(CONFIG_ALL\)|g" \ + -e "s|$(TGT_DIR)|\\$$\(TGT_DIR\)|g" \ + -e "s|$(WIND_BASE)|\\$$\(WIND_BASE\)|g" \ + -e 's|/$$|\\|g' $@.tr > $@; \ + $(RM) $@.tr; fi diff --git a/h/make/make.PENTIUM2gnu b/h/make/make.PENTIUM2gnu new file mode 100644 index 0000000..c1643b3 --- /dev/null +++ b/h/make/make.PENTIUM2gnu @@ -0,0 +1,33 @@ +# +# This make fragments is used by SETUP to ensure backward compatibility for our +# pre-veloce partner products. This file MUST NOT be used for anything else. +# + +# SETUP install directory +SETUP_INSTALL_DIR = d:\Tornado2.2 + +# if WIND_BASE not set, set it +# if WIND_BASE is set but wrong one, reset it +ifeq ($(WIND_BASE),) +WIND_BASE = $(SETUP_INSTALL_DIR) +else +ifneq ($(WIND_BASE),$(SETUP_INSTALL_DIR)) +WIND_BASE = $(SETUP_INSTALL_DIR) +endif +endif + +ifeq ($(TOOL_FAMILY),) +ifeq ($(findstring gnu,$(TOOL)),gnu) +TOOL_FAMILY = gnu +else +ifeq ($(findstring diab,$(TOOL)),diab) +TOOL_FAMILY = diab +endif +endif +endif + +ifeq ($(TGT_DIR),) +TGT_DIR = $(WIND_BASE)/target +endif + +include $(TGT_DIR)/h/tool/$(TOOL_FAMILY)/make.$(CPU)$(TOOL) diff --git a/h/make/make.PENTIUM3gnu b/h/make/make.PENTIUM3gnu new file mode 100644 index 0000000..c1643b3 --- /dev/null +++ b/h/make/make.PENTIUM3gnu @@ -0,0 +1,33 @@ +# +# This make fragments is used by SETUP to ensure backward compatibility for our +# pre-veloce partner products. This file MUST NOT be used for anything else. +# + +# SETUP install directory +SETUP_INSTALL_DIR = d:\Tornado2.2 + +# if WIND_BASE not set, set it +# if WIND_BASE is set but wrong one, reset it +ifeq ($(WIND_BASE),) +WIND_BASE = $(SETUP_INSTALL_DIR) +else +ifneq ($(WIND_BASE),$(SETUP_INSTALL_DIR)) +WIND_BASE = $(SETUP_INSTALL_DIR) +endif +endif + +ifeq ($(TOOL_FAMILY),) +ifeq ($(findstring gnu,$(TOOL)),gnu) +TOOL_FAMILY = gnu +else +ifeq ($(findstring diab,$(TOOL)),diab) +TOOL_FAMILY = diab +endif +endif +endif + +ifeq ($(TGT_DIR),) +TGT_DIR = $(WIND_BASE)/target +endif + +include $(TGT_DIR)/h/tool/$(TOOL_FAMILY)/make.$(CPU)$(TOOL) diff --git a/h/make/make.PENTIUM4gnu b/h/make/make.PENTIUM4gnu new file mode 100644 index 0000000..c1643b3 --- /dev/null +++ b/h/make/make.PENTIUM4gnu @@ -0,0 +1,33 @@ +# +# This make fragments is used by SETUP to ensure backward compatibility for our +# pre-veloce partner products. This file MUST NOT be used for anything else. +# + +# SETUP install directory +SETUP_INSTALL_DIR = d:\Tornado2.2 + +# if WIND_BASE not set, set it +# if WIND_BASE is set but wrong one, reset it +ifeq ($(WIND_BASE),) +WIND_BASE = $(SETUP_INSTALL_DIR) +else +ifneq ($(WIND_BASE),$(SETUP_INSTALL_DIR)) +WIND_BASE = $(SETUP_INSTALL_DIR) +endif +endif + +ifeq ($(TOOL_FAMILY),) +ifeq ($(findstring gnu,$(TOOL)),gnu) +TOOL_FAMILY = gnu +else +ifeq ($(findstring diab,$(TOOL)),diab) +TOOL_FAMILY = diab +endif +endif +endif + +ifeq ($(TGT_DIR),) +TGT_DIR = $(WIND_BASE)/target +endif + +include $(TGT_DIR)/h/tool/$(TOOL_FAMILY)/make.$(CPU)$(TOOL) diff --git a/h/make/make.PENTIUMgnu b/h/make/make.PENTIUMgnu new file mode 100644 index 0000000..c1643b3 --- /dev/null +++ b/h/make/make.PENTIUMgnu @@ -0,0 +1,33 @@ +# +# This make fragments is used by SETUP to ensure backward compatibility for our +# pre-veloce partner products. This file MUST NOT be used for anything else. +# + +# SETUP install directory +SETUP_INSTALL_DIR = d:\Tornado2.2 + +# if WIND_BASE not set, set it +# if WIND_BASE is set but wrong one, reset it +ifeq ($(WIND_BASE),) +WIND_BASE = $(SETUP_INSTALL_DIR) +else +ifneq ($(WIND_BASE),$(SETUP_INSTALL_DIR)) +WIND_BASE = $(SETUP_INSTALL_DIR) +endif +endif + +ifeq ($(TOOL_FAMILY),) +ifeq ($(findstring gnu,$(TOOL)),gnu) +TOOL_FAMILY = gnu +else +ifeq ($(findstring diab,$(TOOL)),diab) +TOOL_FAMILY = diab +endif +endif +endif + +ifeq ($(TGT_DIR),) +TGT_DIR = $(WIND_BASE)/target +endif + +include $(TGT_DIR)/h/tool/$(TOOL_FAMILY)/make.$(CPU)$(TOOL) diff --git a/h/make/make.SIMNTgnu b/h/make/make.SIMNTgnu new file mode 100644 index 0000000..c1643b3 --- /dev/null +++ b/h/make/make.SIMNTgnu @@ -0,0 +1,33 @@ +# +# This make fragments is used by SETUP to ensure backward compatibility for our +# pre-veloce partner products. This file MUST NOT be used for anything else. +# + +# SETUP install directory +SETUP_INSTALL_DIR = d:\Tornado2.2 + +# if WIND_BASE not set, set it +# if WIND_BASE is set but wrong one, reset it +ifeq ($(WIND_BASE),) +WIND_BASE = $(SETUP_INSTALL_DIR) +else +ifneq ($(WIND_BASE),$(SETUP_INSTALL_DIR)) +WIND_BASE = $(SETUP_INSTALL_DIR) +endif +endif + +ifeq ($(TOOL_FAMILY),) +ifeq ($(findstring gnu,$(TOOL)),gnu) +TOOL_FAMILY = gnu +else +ifeq ($(findstring diab,$(TOOL)),diab) +TOOL_FAMILY = diab +endif +endif +endif + +ifeq ($(TGT_DIR),) +TGT_DIR = $(WIND_BASE)/target +endif + +include $(TGT_DIR)/h/tool/$(TOOL_FAMILY)/make.$(CPU)$(TOOL) diff --git a/h/make/make.SIMSPARCSOLARISgnu b/h/make/make.SIMSPARCSOLARISgnu new file mode 100644 index 0000000..c1643b3 --- /dev/null +++ b/h/make/make.SIMSPARCSOLARISgnu @@ -0,0 +1,33 @@ +# +# This make fragments is used by SETUP to ensure backward compatibility for our +# pre-veloce partner products. This file MUST NOT be used for anything else. +# + +# SETUP install directory +SETUP_INSTALL_DIR = d:\Tornado2.2 + +# if WIND_BASE not set, set it +# if WIND_BASE is set but wrong one, reset it +ifeq ($(WIND_BASE),) +WIND_BASE = $(SETUP_INSTALL_DIR) +else +ifneq ($(WIND_BASE),$(SETUP_INSTALL_DIR)) +WIND_BASE = $(SETUP_INSTALL_DIR) +endif +endif + +ifeq ($(TOOL_FAMILY),) +ifeq ($(findstring gnu,$(TOOL)),gnu) +TOOL_FAMILY = gnu +else +ifeq ($(findstring diab,$(TOOL)),diab) +TOOL_FAMILY = diab +endif +endif +endif + +ifeq ($(TGT_DIR),) +TGT_DIR = $(WIND_BASE)/target +endif + +include $(TGT_DIR)/h/tool/$(TOOL_FAMILY)/make.$(CPU)$(TOOL) diff --git a/h/make/makearch.mf b/h/make/makearch.mf new file mode 100644 index 0000000..d0ef6a1 --- /dev/null +++ b/h/make/makearch.mf @@ -0,0 +1,16 @@ +# makearch.mf - Makefile to create vxWorks archive +# +# modification history +# -------------------- +# 01b,08nov01,tam added TGT_DIR use +# 01a,10jul96,yp written +# +# DESCRIPTION +# Given the name of the archiver ranlib and library name create the library +# with all of object files (*.o) in the current directory. One of the primary +# reasons for doing things this way is the confusion between long and short +# filenames in windows 95 +# + +default : + $(AR) crus $(TGT_DIR)\lib\$(LIBNAME) $(wildcard *.o) diff --git a/h/make/rules-apps.sun4-solaris2 b/h/make/rules-apps.sun4-solaris2 new file mode 100644 index 0000000..5482101 --- /dev/null +++ b/h/make/rules-apps.sun4-solaris2 @@ -0,0 +1,4 @@ +#rules-apps.sun4-solaris2 + +include $(TGT_DIR)/h/make/rules-apps.unix + diff --git a/h/make/rules-apps.unix b/h/make/rules-apps.unix new file mode 100644 index 0000000..bd5d095 --- /dev/null +++ b/h/make/rules-apps.unix @@ -0,0 +1,86 @@ +#rules-apps.unix + +.NeverBuilt : appsclean + +# applibsall builds both applib types (downloadable .o and linkable .a) as well +# as any subdirectories. +applibsall : applib objapplib applibsubdirs + +# Linkable .a +applib : $(TGT_DIR)/lib/$(APPLIBNAME) + +# Downloadable .o. +objapplib : $(TGT_DIR)/lib/$(APPLIBDIRNAME)/$(OBJAPPLIBNAME) + +# Since we need to force the rules to execute so that applibs will be +# generated from existing objects, we need to prevent them from executing +# if there are no objects, since the linker will fail. +ifneq ($(LIBOBJS),) + +# By specifying FORCE as a dependency, we force the rules to be executed +# even if no object modules needed to be recompiled. This allows the +# applibs to be regenerated using existing objects instead of having to +# recompile all of them if we touched one. + +$(TGT_DIR)/lib/$(APPLIBNAME): $(LIBOBJS) FORCE + $(AR) r $@ $(LIBOBJS) + +# If the applib already exists, copy it to a temporary file, link the new +# objects to a different temporary file, then link to the target applib. +$(TGT_DIR)/lib/$(APPLIBDIRNAME)/$(OBJAPPLIBNAME): $(LIBOBJS) FORCE + @ - if [ -d $(@D) ] ; then \ + echo ; \ + else \ + mkdir $(@D) ; \ + fi + @-$(RM) $(@D)/temp1.o $(@D)/temp2.o + @ - if [ -w $@ ] ; then \ + $(CP) $@ $(@D)/temp2.o; \ + fi + @-$(RM) $@ + $(LD) $(LD_PARTIAL_FLAGS) -nostdlib -r -o $(@D)/temp1.o $(LIBOBJS) + @ - if [ -w $(@D)/temp2.o ] ; then \ + ($(LD) $(LD_PARTIAL_FLAGS) -nostdlib -r -o $@ $(@D)/temp1.o $(@D)/temp2.o); \ + else \ + ($(LD) $(LD_PARTIAL_FLAGS) -nostdlib -r -o $@ $(@D)/temp1.o); \ + fi + @-$(RM) $(@D)/temp1.o $(@D)/temp2.o + +FORCE: + +else + +$(TGT_DIR)/lib/$(APPLIBNAME): $(LIBOBJS) + +$(TGT_DIR)/lib/$(APPLIBDIRNAME)/$(OBJAPPLIBNAME): + +endif + +# if APPLIBSUBDIRS is not null we need to build the subdirectories before building +# the current directory. + +# if we have APPLIBSUBDIRS +ifneq ($(APPLIBSUBDIRS),) + +# Because APPLIBSUBDIRS and SUBDIRS (used for creating the vxWorks archive) will +# often contain the same directories, and therefore will often generate the +# same targets below, we have to play some games to generate unique target names. +# We do this by placing a | on each end of the directory name for the rule +# generation but then strip it off when spawning the recursive make. +FAKE_APPLIBSUBDIRS := $(foreach dir,$(APPLIBSUBDIRS),|$(dir)|) + +applibsubdirs : $(FAKE_APPLIBSUBDIRS) + +$(FAKE_APPLIBSUBDIRS):: + cd $(subst |,,$@) && $(MAKE) CPU=$(CPU) TOOL=$(TOOL) applibsall + +else + +applibsubdirs : + +endif + +applibsclean : + -$(RM) $(TGT_DIR)/lib/$(APPLIBNAME) + -$(RM) $(TGT_DIR)/lib/$(APPLIBDIRNAME)/$(OBJAPPLIBNAME) + diff --git a/h/make/rules-apps.x86-freebsd b/h/make/rules-apps.x86-freebsd new file mode 100644 index 0000000..b998881 --- /dev/null +++ b/h/make/rules-apps.x86-freebsd @@ -0,0 +1,4 @@ +#rules-apps.x86-freebsd + +include $(TGT_DIR)/h/make/rules-apps.unix + diff --git a/h/make/rules-apps.x86-linux2 b/h/make/rules-apps.x86-linux2 new file mode 100644 index 0000000..bd5d095 --- /dev/null +++ b/h/make/rules-apps.x86-linux2 @@ -0,0 +1,86 @@ +#rules-apps.unix + +.NeverBuilt : appsclean + +# applibsall builds both applib types (downloadable .o and linkable .a) as well +# as any subdirectories. +applibsall : applib objapplib applibsubdirs + +# Linkable .a +applib : $(TGT_DIR)/lib/$(APPLIBNAME) + +# Downloadable .o. +objapplib : $(TGT_DIR)/lib/$(APPLIBDIRNAME)/$(OBJAPPLIBNAME) + +# Since we need to force the rules to execute so that applibs will be +# generated from existing objects, we need to prevent them from executing +# if there are no objects, since the linker will fail. +ifneq ($(LIBOBJS),) + +# By specifying FORCE as a dependency, we force the rules to be executed +# even if no object modules needed to be recompiled. This allows the +# applibs to be regenerated using existing objects instead of having to +# recompile all of them if we touched one. + +$(TGT_DIR)/lib/$(APPLIBNAME): $(LIBOBJS) FORCE + $(AR) r $@ $(LIBOBJS) + +# If the applib already exists, copy it to a temporary file, link the new +# objects to a different temporary file, then link to the target applib. +$(TGT_DIR)/lib/$(APPLIBDIRNAME)/$(OBJAPPLIBNAME): $(LIBOBJS) FORCE + @ - if [ -d $(@D) ] ; then \ + echo ; \ + else \ + mkdir $(@D) ; \ + fi + @-$(RM) $(@D)/temp1.o $(@D)/temp2.o + @ - if [ -w $@ ] ; then \ + $(CP) $@ $(@D)/temp2.o; \ + fi + @-$(RM) $@ + $(LD) $(LD_PARTIAL_FLAGS) -nostdlib -r -o $(@D)/temp1.o $(LIBOBJS) + @ - if [ -w $(@D)/temp2.o ] ; then \ + ($(LD) $(LD_PARTIAL_FLAGS) -nostdlib -r -o $@ $(@D)/temp1.o $(@D)/temp2.o); \ + else \ + ($(LD) $(LD_PARTIAL_FLAGS) -nostdlib -r -o $@ $(@D)/temp1.o); \ + fi + @-$(RM) $(@D)/temp1.o $(@D)/temp2.o + +FORCE: + +else + +$(TGT_DIR)/lib/$(APPLIBNAME): $(LIBOBJS) + +$(TGT_DIR)/lib/$(APPLIBDIRNAME)/$(OBJAPPLIBNAME): + +endif + +# if APPLIBSUBDIRS is not null we need to build the subdirectories before building +# the current directory. + +# if we have APPLIBSUBDIRS +ifneq ($(APPLIBSUBDIRS),) + +# Because APPLIBSUBDIRS and SUBDIRS (used for creating the vxWorks archive) will +# often contain the same directories, and therefore will often generate the +# same targets below, we have to play some games to generate unique target names. +# We do this by placing a | on each end of the directory name for the rule +# generation but then strip it off when spawning the recursive make. +FAKE_APPLIBSUBDIRS := $(foreach dir,$(APPLIBSUBDIRS),|$(dir)|) + +applibsubdirs : $(FAKE_APPLIBSUBDIRS) + +$(FAKE_APPLIBSUBDIRS):: + cd $(subst |,,$@) && $(MAKE) CPU=$(CPU) TOOL=$(TOOL) applibsall + +else + +applibsubdirs : + +endif + +applibsclean : + -$(RM) $(TGT_DIR)/lib/$(APPLIBNAME) + -$(RM) $(TGT_DIR)/lib/$(APPLIBDIRNAME)/$(OBJAPPLIBNAME) + diff --git a/h/make/rules-apps.x86-win32 b/h/make/rules-apps.x86-win32 new file mode 100644 index 0000000..a8816fe --- /dev/null +++ b/h/make/rules-apps.x86-win32 @@ -0,0 +1,10 @@ +#rules-apps.x86-win32 +# +# modification history +# -------------------- +# 01a,22oct03,c_c Merged with Unix rules +# +# DESCRIPTION +# This file contains rules that are host specific to sun4-solaris2 platform. + +include $(WIND_BASE)/target/h/make/rules-app.unix diff --git a/h/make/rules-lib.sun4-solaris2 b/h/make/rules-lib.sun4-solaris2 new file mode 100644 index 0000000..824dd61 --- /dev/null +++ b/h/make/rules-lib.sun4-solaris2 @@ -0,0 +1,10 @@ +# rules-lib.sun4-solaris2 - host specific rules +# +# modification history +# -------------------- +# 01a,01jun95,yp created +# +# DESCRIPTION +# This file contains rules that are host specific to sun4-solaris2 platform. + +include $(WIND_BASE)/target/h/make/rules-lib.unix diff --git a/h/make/rules-lib.unix b/h/make/rules-lib.unix new file mode 100644 index 0000000..3b8d812 --- /dev/null +++ b/h/make/rules-lib.unix @@ -0,0 +1,258 @@ +# rules-lib.unix - Host specific default definitions +# +# modification history +# -------------------- +# 02j,15sep05,kkz Updating version number for API docs +# 02i,18aug05,pee Filtering object list for dependency generation +# 02h,31may05,md,pee move dependencies to object directory +# 02k,29apr05,kkz Changing doc directory path +# 02j,26apr05,pee Forcing library update with MAKE_LIBDIR +# 02i,07apr05,h_a LIB_ROOT to replace $(TGT_DIR)/lib for building components +# 02h,18apr05,pee added support for precomp objects. +# 02g,22apr05,h_a LIB_ROOT changes for external lib targets +# 02f,14feb05,bpn Removed shell command directory from doc link rule. +# 02e,14oct04,job Set KERNEL condition when building docs +# 02d,26may04,dgp modify default output directory for docs build +# 02c,13mar04,dlk When library exists, do not archive an empty set of +# objects newer than the library. +# 02b,04mar04,c_c Fixed library build introduced by the SPR 92805 fix. +# 02a,25feb04,c_c Fixed SPR 92805 +# 01z,20feb04,c_c Dependencies rework. +# 01y,12jan04,bjl changed refgen to apigen. +# 01x,26dec03,dat ignore errors during dependency generation +# 01w,28nov03,c_c Use dependencies processing macro. +# 01v,07nov03,c_c Unified build rules with WIN32 hosts. +# 01u,01sep03,fle SPR#84899 : do not use make -C anymore, rather change +# directory first, and call make +# 01t,19aug03,fle SPR#88802 : modified depend.tcl use since it now takes +# output file as an argument +# 01s,12nov01,dbs fix dependency-build warnings for C++ source +# 01r,01nov01,jab added LIBDIR directory creation +# 01q,24oct01,jab fixed dependency generation +# 01p,23oct01,jab cleaned up dependency rules +# 01o,27aug01,wsl add man pages and other doc niceties +# 01n,24jul01,r_s changing the make 'ifeq' conditional to work with 'gnu', +# 'sfgnu', 'sfgnule' etc for TOOL +# 01m,24jul01,r_s diab specific rules added +# 01l,05jan99,fle added the DOC_OPTS_XXX flags +# + made synopsis rule use refLib (refgen) +# 01k,25nov98,fle doc : made man rule use variables DOC_BOOK and DOC_CHAPTER +# 01j,10nov98,fle doc : made doc generated in DOC_DIR, and not in a hard +# coded destination, so we can over write it +# 01i,08sep98,fle changed refgen options format since refgen.tcl +# 01h,02sep98,fle doc : replaced mangen with refgen +# 01g,31aug98,ms fixed LIBNAME creation rule when no objects exist +# 01f,28jul98,pr added "/" to LIBDIR path +# 01e,02apr98,pcn Removed Objcopy changes from Tempest view +# 01d,02dec97,jmp added synopsis rules. +# 01c,04oct96,yp added LOCAL_CLEAN to clean objs +# 01b,17may96,yp brought clean rule here +# 01a,07may96,yp created +# +# DESCRIPTION +# This file contains the makefile rules that are specific to unix to build +# vxWorks libraries. It is included by rules.library where rules common to +# all hosts and the default rule exist. This file contains rules for managing +# archives on Unix hosts using sub-shells. If the archive is write-able we +# update it. If not we assume that it is a link you want to break or that it +# doesn't exist. The archive are created from where the object files exist to +# avoid including paths in the archive. +# +# The dependency list is generated by target depend.$(BUILD_EXT) +# which creates a dependency list for all files c,s and cpp suffixes. +# +# Sub directories to be built are expected to be defined in the SUBDIRS macro. +# if it not defined the subdirs target is not seen. +# +# We build the man pages in the directories specified in the macro SUBDIRS +# before we deal with DOC_FILES in the current directory + +ifeq ($(LIBNAME),) +LIBNAME = lib$(CPU)$(TOOL)vx.a +endif + +LIBOBJS_DIRS = $(LIBDIR) + +ifneq ($(strip $(LIBOBJS_PRECOMP)),) +LIBOBJS_DIRS += $(PRECOMPDIR) +endif + +lib: $(LIBOBJS_DIRS) $(LIB_ROOT)/$(LIBNAME) + +clean: + $(RM) $(LIBOBJS) $(LIBOBJS:.o=.d) $(LOCAL_CLEAN) +# This is believed to be obsolete. If it is needed we can bring it back +# ifneq ($(CLEANTAIL),) +# $(MAKE) -f Makefile CPU=$(CPU) TOOL=$(TOOL) \ +# $(CLEANTAIL) \ +# CLEANTAIL='') +# endif + +$(LIB_ROOT)/$(LIBNAME): $(MAKE_LIBDIR) $(LIBOBJS) + @ - if [ -w $@ ] ; then \ + (cd $(LIBDIR); \ + if [ "x$?" != "x" ] ; then \ + echo "$(AR) crus " $@ $?; \ + $(AR) crus $@ $(notdir $?); \ + fi)\ + else \ + (cd $(LIBDIR); \ + $(RM) $@; \ + echo "$(AR) crus " $@ $(LIBDIR)/"*.o"; \ + $(AR) crus $@ *.o; \ + ) \ + fi + +LIBOBJS_DEPEND = $(filter-out $(foreach file, $(NODEPENDOBJS), $(LIBDIR)/$(file)), $(LIBOBJS)) + +depend: $(filter %.dummy_d, $(LIBOBJS_DEPEND:.o=.dummy_d)) + - @ : + +# Dependency list generation. We generate dependencies for the intersection of +# files listed in OBJS and file present in the local directory, and remove those +# specified in the NODEPENDOBJS list + +depend.$(BUILD_EXT): Makefile + - @ $(RM) $@ + - @ echo "Creating depend.$(BUILD_EXT)" + +ifneq ($(strip $(filter-out $(NODEPENDOBJS), $(filter $(OBJS:.o=.c), \ + $(wildcard *.c)))),) + $(CC) $(OPTION_DEPEND_GEN) $(CFLAGS) $(filter-out $(NODEPENDOBJS), \ + $(filter $(OBJS:.o=.c), $(wildcard *.c))) >>$@; +endif +ifneq ($(strip $(filter-out $(NODEPENDOBJS), $(filter $(OBJS:.o=.s), \ + $(wildcard *.s)))),) + $(CPP) $(OPTION_DEPEND_GEN) $(CASFLAGS) $(filter-out $(NODEPENDOBJS), \ + $(filter $(OBJS:.o=.s), $(wildcard *.s))) >>$@; +endif +ifneq ($(strip $(filter-out $(NODEPENDOBJS), $(filter $(OBJS:.o=.cpp), \ + $(wildcard *.cpp)))),) + $(CC) $(OPTION_DEPEND_GEN) $(CFLAGS) $(filter-out $(NODEPENDOBJS), \ + $(filter $(OBJS:.o=.cpp), $(wildcard *.cpp))) >>$@; +endif + + +# Post process the dependencies to substitute WIND variables + + - @ $(PROCESS_DEP) + +ifneq ($(strip $(filter-out $(NODEPENDOBJS), $(filter $(OBJS_PRECOMP:.o=.c), \ + $(wildcard *.c)))),) + $(CC) $(OPTION_DEPEND_GEN) $(CFLAGS) $(filter-out $(NODEPENDOBJS), \ + $(filter $(OBJS_PRECOMP:.o=.c), $(wildcard *.c))) >>$@.precomp; +endif +ifneq ($(strip $(filter-out $(NODEPENDOBJS), $(filter $(OBJS_PRECOMP:.o=.s), \ + $(wildcard *.s)))),) + $(CPP) $(OPTION_DEPEND_GEN) $(CASFLAGS) $(filter-out $(NODEPENDOBJS), \ + $(filter $(OBJS_PRECOMP:.o=.s), $(wildcard *.s))) >>$@.precomp; +endif +ifneq ($(strip $(filter-out $(NODEPENDOBJS), $(filter $(OBJS_PRECOMP:.o=.cpp), \ + $(wildcard *.cpp)))),) + $(CC) $(OPTION_DEPEND_GEN) $(CFLAGS) $(filter-out $(NODEPENDOBJS), \ + $(filter $(OBJS_PRECOMP:.o=.cpp), $(wildcard *.cpp))) >>$@.precomp; +endif + + - @ $(PROCESS_DEP_PRECOMP) + +# if SUBDIRS is not null we need to build the subdirectories before building +# the current directory. + +# if we have SUBDIRS +ifneq ($(SUBDIRS),) + +subdirs : $(SUBDIRS) + +$(SUBDIRS):: + cd $@ && $(MAKE) CPU=$(CPU) TOOL=$(TOOL) $(TARGET) + +# No SUBDIRS +else +subdirs: + +endif + +######## +# +# doc rules + +# re-define the DOC_DIR for the libraries as the default DOC_DIR is for BSPs + +DOC_DIR = $(DOCS_ROOT)/com.windriver.ide.doc.vxworks/vxworks_kernel_api_reference_6.2 + +DOC_OPTS = -mg -nostrict -missingok + +# When the desired set of directories to be documented is different from the +# directories whose software must be built (common for component products), +# set DOCSUBDIRS to the subdirectories to be documented. + +ifeq ($(DOCSUBDIRS),) +DOCSUBDIRS = $(SUBDIRS) +endif + +ifneq ($(DOCSUBDIRS),) + +# define the man target and the default output directory for libraries + +man: + -for DIR in $(DOCSUBDIRS) ; \ + do ( cd $$DIR; $(MAKE) CPU=$(CPU) TOOL=$(TOOL) man ) ; \ + done + -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen $(DOC_OPTS) \ + -book $(DOC_BOOK) -chapter $(DOC_CHAPTER) -out $(DOC_DIR) \ + -set $(DOC_KERNEL) $(DOC_FILES) + -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen $(MAN_PAGE_OPTS) \ + -book $(DOC_BOOK) -chapter $(DOC_CHAPTER) -out $(MAN_PAGE_DIR) \ + -set $(DOC_KERNEL) $(DOC_FILES) + @date + +link :: + -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/htmlLink -R \ + $(DOCS_ROOT)/com.windriver.ide.doc.vxworks + +synopsis :: + -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/syngen \ + -d $(WIND_BASE)/host/resource/synopsis $(DOC_FILES) + for DIR in $(DOCSUBDIRS) ; \ + do ( cd $$DIR; $(MAKE) CPU=$(CPU) TOOL=$(TOOL) synopsis ) ; \ + done + @date + +clean_synopsis :: + for DIR in $(DOCSUBDIRS) ; \ + do ( cd $$DIR; $(MAKE) CPU=$(CPU) TOOL=$(TOOL) clean_synopsis ) ; \ + done +ifneq ($(DOC_FILES),) + $(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/syngen -clean \ + -d $(WIND_BASE)/host/resource/synopsis +endif + +# No DOCSUBDIRS +else + +man: + -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen $(DOC_OPTS) \ + -book $(DOC_BOOK) -chapter $(DOC_CHAPTER) -out $(DOC_DIR) \ + -set $(DOC_KERNEL) $(DOC_FILES) + -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen $(MAN_PAGE_OPTS) \ + -book $(DOC_BOOK) -chapter $(DOC_CHAPTER) -out $(MAN_PAGE_DIR) \ + -set $(DOC_KERNEL) $(DOC_FILES) + @date + +synopsis :: +ifneq ($(DOC_FILES),) + -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/syngen \ + -d $(WIND_BASE)/host/resource/synopsis $(DOC_FILES) + @date +endif + +clean_synopsis :: +ifneq ($(DOC_FILES),) + $(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/syngen -clean \ + -d $(WIND_BASE)/host/resource/synopsis +endif +endif + +# end doc rules +# +###### diff --git a/h/make/rules-lib.x86-freebsd b/h/make/rules-lib.x86-freebsd new file mode 100644 index 0000000..c553917 --- /dev/null +++ b/h/make/rules-lib.x86-freebsd @@ -0,0 +1,10 @@ +# rules-lib.x86-freebsd - host specific rules +# +# modification history +# -------------------- +# 01a,12dec99,dra created +# +# DESCRIPTION +# This file contains rules that are host specific to x86-freebsd platform. + +include $(WIND_BASE)/target/h/make/rules-lib.unix diff --git a/h/make/rules-lib.x86-linux2 b/h/make/rules-lib.x86-linux2 new file mode 100644 index 0000000..3b8d812 --- /dev/null +++ b/h/make/rules-lib.x86-linux2 @@ -0,0 +1,258 @@ +# rules-lib.unix - Host specific default definitions +# +# modification history +# -------------------- +# 02j,15sep05,kkz Updating version number for API docs +# 02i,18aug05,pee Filtering object list for dependency generation +# 02h,31may05,md,pee move dependencies to object directory +# 02k,29apr05,kkz Changing doc directory path +# 02j,26apr05,pee Forcing library update with MAKE_LIBDIR +# 02i,07apr05,h_a LIB_ROOT to replace $(TGT_DIR)/lib for building components +# 02h,18apr05,pee added support for precomp objects. +# 02g,22apr05,h_a LIB_ROOT changes for external lib targets +# 02f,14feb05,bpn Removed shell command directory from doc link rule. +# 02e,14oct04,job Set KERNEL condition when building docs +# 02d,26may04,dgp modify default output directory for docs build +# 02c,13mar04,dlk When library exists, do not archive an empty set of +# objects newer than the library. +# 02b,04mar04,c_c Fixed library build introduced by the SPR 92805 fix. +# 02a,25feb04,c_c Fixed SPR 92805 +# 01z,20feb04,c_c Dependencies rework. +# 01y,12jan04,bjl changed refgen to apigen. +# 01x,26dec03,dat ignore errors during dependency generation +# 01w,28nov03,c_c Use dependencies processing macro. +# 01v,07nov03,c_c Unified build rules with WIN32 hosts. +# 01u,01sep03,fle SPR#84899 : do not use make -C anymore, rather change +# directory first, and call make +# 01t,19aug03,fle SPR#88802 : modified depend.tcl use since it now takes +# output file as an argument +# 01s,12nov01,dbs fix dependency-build warnings for C++ source +# 01r,01nov01,jab added LIBDIR directory creation +# 01q,24oct01,jab fixed dependency generation +# 01p,23oct01,jab cleaned up dependency rules +# 01o,27aug01,wsl add man pages and other doc niceties +# 01n,24jul01,r_s changing the make 'ifeq' conditional to work with 'gnu', +# 'sfgnu', 'sfgnule' etc for TOOL +# 01m,24jul01,r_s diab specific rules added +# 01l,05jan99,fle added the DOC_OPTS_XXX flags +# + made synopsis rule use refLib (refgen) +# 01k,25nov98,fle doc : made man rule use variables DOC_BOOK and DOC_CHAPTER +# 01j,10nov98,fle doc : made doc generated in DOC_DIR, and not in a hard +# coded destination, so we can over write it +# 01i,08sep98,fle changed refgen options format since refgen.tcl +# 01h,02sep98,fle doc : replaced mangen with refgen +# 01g,31aug98,ms fixed LIBNAME creation rule when no objects exist +# 01f,28jul98,pr added "/" to LIBDIR path +# 01e,02apr98,pcn Removed Objcopy changes from Tempest view +# 01d,02dec97,jmp added synopsis rules. +# 01c,04oct96,yp added LOCAL_CLEAN to clean objs +# 01b,17may96,yp brought clean rule here +# 01a,07may96,yp created +# +# DESCRIPTION +# This file contains the makefile rules that are specific to unix to build +# vxWorks libraries. It is included by rules.library where rules common to +# all hosts and the default rule exist. This file contains rules for managing +# archives on Unix hosts using sub-shells. If the archive is write-able we +# update it. If not we assume that it is a link you want to break or that it +# doesn't exist. The archive are created from where the object files exist to +# avoid including paths in the archive. +# +# The dependency list is generated by target depend.$(BUILD_EXT) +# which creates a dependency list for all files c,s and cpp suffixes. +# +# Sub directories to be built are expected to be defined in the SUBDIRS macro. +# if it not defined the subdirs target is not seen. +# +# We build the man pages in the directories specified in the macro SUBDIRS +# before we deal with DOC_FILES in the current directory + +ifeq ($(LIBNAME),) +LIBNAME = lib$(CPU)$(TOOL)vx.a +endif + +LIBOBJS_DIRS = $(LIBDIR) + +ifneq ($(strip $(LIBOBJS_PRECOMP)),) +LIBOBJS_DIRS += $(PRECOMPDIR) +endif + +lib: $(LIBOBJS_DIRS) $(LIB_ROOT)/$(LIBNAME) + +clean: + $(RM) $(LIBOBJS) $(LIBOBJS:.o=.d) $(LOCAL_CLEAN) +# This is believed to be obsolete. If it is needed we can bring it back +# ifneq ($(CLEANTAIL),) +# $(MAKE) -f Makefile CPU=$(CPU) TOOL=$(TOOL) \ +# $(CLEANTAIL) \ +# CLEANTAIL='') +# endif + +$(LIB_ROOT)/$(LIBNAME): $(MAKE_LIBDIR) $(LIBOBJS) + @ - if [ -w $@ ] ; then \ + (cd $(LIBDIR); \ + if [ "x$?" != "x" ] ; then \ + echo "$(AR) crus " $@ $?; \ + $(AR) crus $@ $(notdir $?); \ + fi)\ + else \ + (cd $(LIBDIR); \ + $(RM) $@; \ + echo "$(AR) crus " $@ $(LIBDIR)/"*.o"; \ + $(AR) crus $@ *.o; \ + ) \ + fi + +LIBOBJS_DEPEND = $(filter-out $(foreach file, $(NODEPENDOBJS), $(LIBDIR)/$(file)), $(LIBOBJS)) + +depend: $(filter %.dummy_d, $(LIBOBJS_DEPEND:.o=.dummy_d)) + - @ : + +# Dependency list generation. We generate dependencies for the intersection of +# files listed in OBJS and file present in the local directory, and remove those +# specified in the NODEPENDOBJS list + +depend.$(BUILD_EXT): Makefile + - @ $(RM) $@ + - @ echo "Creating depend.$(BUILD_EXT)" + +ifneq ($(strip $(filter-out $(NODEPENDOBJS), $(filter $(OBJS:.o=.c), \ + $(wildcard *.c)))),) + $(CC) $(OPTION_DEPEND_GEN) $(CFLAGS) $(filter-out $(NODEPENDOBJS), \ + $(filter $(OBJS:.o=.c), $(wildcard *.c))) >>$@; +endif +ifneq ($(strip $(filter-out $(NODEPENDOBJS), $(filter $(OBJS:.o=.s), \ + $(wildcard *.s)))),) + $(CPP) $(OPTION_DEPEND_GEN) $(CASFLAGS) $(filter-out $(NODEPENDOBJS), \ + $(filter $(OBJS:.o=.s), $(wildcard *.s))) >>$@; +endif +ifneq ($(strip $(filter-out $(NODEPENDOBJS), $(filter $(OBJS:.o=.cpp), \ + $(wildcard *.cpp)))),) + $(CC) $(OPTION_DEPEND_GEN) $(CFLAGS) $(filter-out $(NODEPENDOBJS), \ + $(filter $(OBJS:.o=.cpp), $(wildcard *.cpp))) >>$@; +endif + + +# Post process the dependencies to substitute WIND variables + + - @ $(PROCESS_DEP) + +ifneq ($(strip $(filter-out $(NODEPENDOBJS), $(filter $(OBJS_PRECOMP:.o=.c), \ + $(wildcard *.c)))),) + $(CC) $(OPTION_DEPEND_GEN) $(CFLAGS) $(filter-out $(NODEPENDOBJS), \ + $(filter $(OBJS_PRECOMP:.o=.c), $(wildcard *.c))) >>$@.precomp; +endif +ifneq ($(strip $(filter-out $(NODEPENDOBJS), $(filter $(OBJS_PRECOMP:.o=.s), \ + $(wildcard *.s)))),) + $(CPP) $(OPTION_DEPEND_GEN) $(CASFLAGS) $(filter-out $(NODEPENDOBJS), \ + $(filter $(OBJS_PRECOMP:.o=.s), $(wildcard *.s))) >>$@.precomp; +endif +ifneq ($(strip $(filter-out $(NODEPENDOBJS), $(filter $(OBJS_PRECOMP:.o=.cpp), \ + $(wildcard *.cpp)))),) + $(CC) $(OPTION_DEPEND_GEN) $(CFLAGS) $(filter-out $(NODEPENDOBJS), \ + $(filter $(OBJS_PRECOMP:.o=.cpp), $(wildcard *.cpp))) >>$@.precomp; +endif + + - @ $(PROCESS_DEP_PRECOMP) + +# if SUBDIRS is not null we need to build the subdirectories before building +# the current directory. + +# if we have SUBDIRS +ifneq ($(SUBDIRS),) + +subdirs : $(SUBDIRS) + +$(SUBDIRS):: + cd $@ && $(MAKE) CPU=$(CPU) TOOL=$(TOOL) $(TARGET) + +# No SUBDIRS +else +subdirs: + +endif + +######## +# +# doc rules + +# re-define the DOC_DIR for the libraries as the default DOC_DIR is for BSPs + +DOC_DIR = $(DOCS_ROOT)/com.windriver.ide.doc.vxworks/vxworks_kernel_api_reference_6.2 + +DOC_OPTS = -mg -nostrict -missingok + +# When the desired set of directories to be documented is different from the +# directories whose software must be built (common for component products), +# set DOCSUBDIRS to the subdirectories to be documented. + +ifeq ($(DOCSUBDIRS),) +DOCSUBDIRS = $(SUBDIRS) +endif + +ifneq ($(DOCSUBDIRS),) + +# define the man target and the default output directory for libraries + +man: + -for DIR in $(DOCSUBDIRS) ; \ + do ( cd $$DIR; $(MAKE) CPU=$(CPU) TOOL=$(TOOL) man ) ; \ + done + -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen $(DOC_OPTS) \ + -book $(DOC_BOOK) -chapter $(DOC_CHAPTER) -out $(DOC_DIR) \ + -set $(DOC_KERNEL) $(DOC_FILES) + -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen $(MAN_PAGE_OPTS) \ + -book $(DOC_BOOK) -chapter $(DOC_CHAPTER) -out $(MAN_PAGE_DIR) \ + -set $(DOC_KERNEL) $(DOC_FILES) + @date + +link :: + -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/htmlLink -R \ + $(DOCS_ROOT)/com.windriver.ide.doc.vxworks + +synopsis :: + -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/syngen \ + -d $(WIND_BASE)/host/resource/synopsis $(DOC_FILES) + for DIR in $(DOCSUBDIRS) ; \ + do ( cd $$DIR; $(MAKE) CPU=$(CPU) TOOL=$(TOOL) synopsis ) ; \ + done + @date + +clean_synopsis :: + for DIR in $(DOCSUBDIRS) ; \ + do ( cd $$DIR; $(MAKE) CPU=$(CPU) TOOL=$(TOOL) clean_synopsis ) ; \ + done +ifneq ($(DOC_FILES),) + $(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/syngen -clean \ + -d $(WIND_BASE)/host/resource/synopsis +endif + +# No DOCSUBDIRS +else + +man: + -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen $(DOC_OPTS) \ + -book $(DOC_BOOK) -chapter $(DOC_CHAPTER) -out $(DOC_DIR) \ + -set $(DOC_KERNEL) $(DOC_FILES) + -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen $(MAN_PAGE_OPTS) \ + -book $(DOC_BOOK) -chapter $(DOC_CHAPTER) -out $(MAN_PAGE_DIR) \ + -set $(DOC_KERNEL) $(DOC_FILES) + @date + +synopsis :: +ifneq ($(DOC_FILES),) + -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/syngen \ + -d $(WIND_BASE)/host/resource/synopsis $(DOC_FILES) + @date +endif + +clean_synopsis :: +ifneq ($(DOC_FILES),) + $(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/syngen -clean \ + -d $(WIND_BASE)/host/resource/synopsis +endif +endif + +# end doc rules +# +###### diff --git a/h/make/rules-lib.x86-win32 b/h/make/rules-lib.x86-win32 new file mode 100644 index 0000000..cefe82d --- /dev/null +++ b/h/make/rules-lib.x86-win32 @@ -0,0 +1,11 @@ +# rules-lib.x86-win32 - host specific rules +# +# modification history +# -------------------- +# 02a,24sep03,c_c now use unix defaults +# +# DESCRIPTION +# This file contains the makefile rules that are specific to Windows to build +# vxWorks libraries. + +include $(WIND_BASE)/target/h/make/rules-lib.unix diff --git a/h/make/rules.apps b/h/make/rules.apps new file mode 100644 index 0000000..b9db7da --- /dev/null +++ b/h/make/rules.apps @@ -0,0 +1,30 @@ +# rules.apps + +# This file depends on rules.library having been included elsewhere. +# Eventually, one of these files may include the other. +# +# Must do applibsclean first so that we can ensure that only one munch is +# performed on the file. It follows that when trying to only re-compile +# some files, you must make all from the top-most level so that all files +# get placed in the app files. +# +# Building applibsubdirs causes all subdirectories named in APPLIBSUBDIRS to +# build into the .o and .a by building applibsall. The resulting .o needs +# to be munched when done, so we do that here. + +# Provided for T1 compatibility. + +ifeq ($(MUNCH),) +MUNCH=munch +endif + +applibs: applibsclean applibsall applibsubdirs + $(CP) $(LIB_ROOT)/$(APPLIBDIRNAME)/$(OBJAPPLIBNAME) $(LIB_ROOT)/$(APPLIBDIRNAME)/temp1.o + $(NM) $(LIB_ROOT)/$(APPLIBDIRNAME)/temp1.o | $(MUNCH) > $(LIB_ROOT)/$(APPLIBDIRNAME)/ctdt.c + $(CC) -c $(C++FLAGS) -traditional $(LIB_ROOT)/$(APPLIBDIRNAME)/ctdt.c -o $(LIB_ROOT)/$(APPLIBDIRNAME)/ctdt.o + $(LD) $(LD_PARTIAL_FLAGS) -o $(LIB_ROOT)/$(APPLIBDIRNAME)/$(OBJAPPLIBNAME) $(LIB_ROOT)/$(APPLIBDIRNAME)/temp1.o $(LIB_ROOT)/$(APPLIBDIRNAME)/ctdt.o + @ $(RM) $(LIB_ROOT)/$(APPLIBDIRNAME)/ctdt.c $(LIB_ROOT)/$(APPLIBDIRNAME)/ctdt.o $(LIB_ROOT)/$(APPLIBDIRNAME)/temp1.o + +include $(TGT_DIR)/h/make/rules-apps.$(WIND_HOST_TYPE) + + diff --git a/h/make/rules.bsp b/h/make/rules.bsp new file mode 100644 index 0000000..6177ad6 --- /dev/null +++ b/h/make/rules.bsp @@ -0,0 +1,947 @@ +# rules.bsp - makefile target rules for BSP +# +# Copyright 1984-2005, Wind River Systems, Inc. +# +# modification history +# -------------------- +# 04f,06sep05,h_k added usrEntry.o for bootrom build. (SPR #111954) +# 04e,25apr05,tpw Override DOC_DIR to set new BSP-specific docs plugin. +# 04d,22apr05,edc Added COMP_LIBS to link line and dependency of VxWorks +# rules. Also added rules that support packaging of a BSP. +# 04c,03feb05,mdo Update for B6 Validation Testing +# 04b,28sep04,dlk Added OPT_DEFINE to EXTRA_CFLAGS in makeMacros. +# 04a,24aug04,rec SPR 100961 bootrom_res build fix +# 03z,18aug04,rec SPR 100125 - fix vxWorks.st_rom rules +# 03y,28jul04,c_c Fixed build. +# 03x,07jul04,c_c Removed usage of romfs_image.h. +# 03x,02jul04,fle Made it include rules.memory +# + added vma adjust command when needed +# 03w,25jun04,fle SPR#98612 : speed up makeMacros +# 03v,09feb04,fle Adapted to new host utilities locations +# 03u,30jan04,fle Made clean rule use wildcards +# 03t,08dec03,tpw Condense ten .hex rules down into one. +# Remove renamed *.c files before copying to create them. +# 03s,24oct03,fle SPR#90904 : added POST_HEX_BUILD_RULE to all .hex rules +# 03r,02jul03,md adding ROMFS rules and variables +# 03q,30apr02,cym adding HEX_FLAGS to makeMacros +# 03p,27mar02,dat Remove intermediate files to keep view small, SPR 72823, +# new targets clean_release, clean_cmdLine, clean_prj +# 03o,19mar02,dat Adding CFLAGS_PIC for bootInit.o (72825) +# 03n,14feb02,jab use LD_PARTIAL_LAST_FLAGS in last link for .out targets +# 03m,31jan02,fmk remove redirection operator to generate symTbl.c +# 03l,13dec01,jab added make variable BOOTCONFIG_FLAGS +# 03k,10dec01,dat Fixing subst commands +# 03k,07dec01,tpw Remove HEX_HIGH_FLAGS and HEX_LOW_FLAGS, and fix proj %.hex +# 03j,05dec01,dat added prj_gnu_def, prj_gnu_all, prj_diab_all, prj_diab_def, +# prj_default_one +# 03i,04dec01,dat fix prj_gnu and prj_diab to ignore MAKEFLAGS values +# 03h,04dec01,j_s add exporting of LD_LINK_PATH back +# 03g,26nov01,j_s changed LIBS to contain reference to VX_OS_LIBS instead of +# its snapshot value, added rule 'makeMacrosReferred' +# 03f,15nov01,jtp generate vxImage.o to provide target-server symbols for +# the vxWorks.st_rom configuration +# 03e,14nov01,pch Add "test" target +# 03d,13nov01,dat new release rule, fix to bootrom +# 03c,05nov01,rbl add project compiler and assembler flags +# 03b,08nov01,tpw Add general %.bin rule. +# 03a,05nov01,dat New targets prj_gnu and prj_diab +# 02z,06nov01,tpw Add %.old rule to facilitate conversions to old OMFs +# 02y,24oct01,rbl add extra macros to makeMacros for diab support +# 02x,30oct01,tam removed CC_LIB from cyclic linking +# 02w,29oct01,jab updated rules for ld scripts +# 02v,09oct01,j_s remove LD_LINK_LIST, just use LD_LINK_LIBS +# add support for build dependency on archives: vpath and +# expansion of '-l' +# 02u,18oct01,dat Moving tool defines to tool specific files +# 02t,01oct01,dat Added CPU TOOL args to bsp2prj, consistent use of $BSP_NAME +# 02s,25sep01,dat Gnu-Diab infrastructure, added include rules.$HOST +# 02r,06aug01,mem Update for rearragement of runtime libraries. +# 02q,31oct00,scm add post build rules... +# 02p,06apr00,dra Added HEX_LOW_FLAGS and HEX_HIGH_FLAGS to support FRV +# (Venus) toolchain. +# 02o,31mar00,rsh final merge es.tor2_0.mcore to tor2_0_0.es.coretools +# 02n,01mar00,rsh removing remove of LIB_EXTRA since I'm nolonger using a bsp +# archive of sio driver and the remove shouldn't be here +# anyway +# 02m,08feb00,jld add clean rule for LIB_EXTRA. +# 02l,27oct99,tpw Add RES_LDFLAGS, like ROM_LDFLAGS but for resident images. +# 02k,26oct99,tpw Fix two bugs in the objcopy changes. +# 02j,01mar99,yp Added rules for building files with cc extentions SPR 20293 +# 02i,23feb99,sn removed references to $(POST_MUNCH) +# 02h,18jan99,sn removed hack mentioned below (collect2 now fixed) +# 02g,07dec98,sn hacked bsp2prj rule so that default projects created +# on unix work on windows too. +# 02f,17nov98,sn added LD_PARTIAL_FLAGS back to makeMacros, undid 02d +# 02e,11nov98,sn partially link using LD_PARTIAL +# clean now removes .rpo files too +# 02d,11nov98,sn munch -> orderCtors +# 02c,05Nov98,ms -traditional -> -fdollars-in-identifiers +# 02b,23Oct98,ms make implicit rules overridable from make.CPUTOOL. +# 02c,21apr99,bc Alter BINXSYM command line for objcopy interface. +# 02b,08apr99,bc Merge in objcopy invocations from Aeolus +# 02a,28aug98,jmp added bsp2proj as part of the release rule. +# 01z,29jun98,jmp removed from makeMacros rule all macros defined in +# BSPs Makefiles. +# 01y,25jun98,ms added more macros to makeMacros rule +# 01x,02apr98,pcn Removed Objcopy changes from Tempest view +# 01w,15dec97,pcn Added Objcopy in BSP build. +# 01v,04mar97,tpr changed bootrom_res_res_high.hex by bootrom_res_high.hex +# (SPR 8095) +# 01u,13dec96,map Remove symTbl.c in target rule `clean' [SPR# 2637] +# 01t,09dec96,tpr Added rule to remove ctdt.c for the 'clean' target. +# 01s,04oct96,yp Added rules for building files with cxx extentions +# 01r,23oct96,yp redid treatment of .s files so we don't create tmp +# 01q,26sep96,dat removed edit 01k, was harming sparc & 960 BSPs. (SPR 7238) +# 01p,19sep96,tpr merge PPC to tor1_0_1 release. +# 01o,29aug96,ms removed "-f -b 15" after $(COMPRESS). +# 01n,22aug96,map added romInit.o dependency to romInit_res* rules to fix +# SPR# 7063 +# 01m,25jul96,tam replaced mips specific rom resident targets by ppc ones. +# 01l,23jul96,kkk fixed build rules for romInit_res*.o for. +# 01k,22jul96,tam added $(BOOT_EXTRA) where it was missing. +# 01j,04apr96,srh added munching. +# 01i,08mar96,yp added -P in implicite .s.o rule. +# 01h,06mar96,dat new rules for version.o +# 01g,13nov95,jeh restored .cpp.o implicit rule +# 01f,08nov95,jeh removed .cpp.o implicit rule +# 01e,01nov95,p_m added LIB to rom_res build command +# 01d,01nov95,yp added implicit rules for C++ +# 01c,30oct95,dat added targets vxWorks.res_rom_nosym and +# vxWorks.res_rom_nosym_mips +# 01b,27jun95,kkk added VXSIZE. +# 01a,12jun95,yp created from makeTarget2 v03d. +# +# DESCRIPTION +# This file contains rules used in building targets. +# +# This file is only used for command line builds from the BSP directory. +# It is not used for any project or component builds. Changes made here +# affect only command line builds. See rules.project for project build rules. +# +# +# VARIABLES +# The following variables must be defined (or not, as appropriate): +# +# ROM_SIZE number of bytes of ROM space as in config.h +# LOCAL_MEM_SIZE target RAM size as in config.h +# BINHEX binary->hex file conversion program +# HEX_FLAGS BINHEX program options +# LD_LOW_FLAGS ld(1) options for code in low memory +# LD_HIGH_FLAGS ld options for code in high memory +# LD_PARTIAL_FLAGS ld flags for linking partially complete objects +# LDDEPS host-specific dependencies prerequisite to linking +# LDOUT_CONV hpToBsd, coffToBsd, gswab, /bin/cat, etc. +# COMPILE_SYMTBL hide flags needed to get compiler to swallow symTbl.c +# ROM_ENTRY rom entry point (typically &romInit) +# SYS_ENTRY system entry point (typically &sysInit) +# USR_ENTRY compressed system entry point (typically &usrInit) +# +# The following variables are optionally defined: +# +# LDFLAGS standard ld flags for vxWorks & ROMs. +# ROM_LDFLAGS ld flags specific to ROM image +# RES_LDFLAGS ld flags specific to resident ROM image +# MACH_EXTRA extra modules for all boot/vxWorks images +# BOOT_EXTRA extra modules for compressed images only +# RELEASE images made as part of WRS release step +# OBJCOPY_OLD_OMF objcopy options to convert to an old OMF +# +# CONSTANTS +# CPU cpu type +# +# TREE +# Include tree for a PPC604 bsp on an x86-linux2 host: +# +# +-> defs.bsp +# | +-> defs.link +# | | +-> defs.option +# | +-> make.PPC604diab +# | | +-> defs.ppc +# | | +-> defs.diab +# | | +-> defs.common +# | +-> defs.x86-linux2 +# | +-> defs.unix +# +-> rules.bsp +# +-> rules.memory +# | +-> defs.memory +# +-> rules.x86-linux2 + +include $(TGT_DIR)/h/make/rules.memory + +################################################################################ +# +# Dependency search path of .a files +# + +vpath %.a $(subst -L,,$(LD_LINK_PATH)) + +################################################################################ +# +# meta build targets +# + +## make will default to "exe" + +exe : vxWorks + +release : $(RELEASE) + +BSP2PRJ_SCRIPT = $(WIND_BASE)/host/resource/hutils/tcl/bsp2prj.tcl + +# Use the default tool, build a project with just the one default build spec +# For backward compatibility purposes. + +bsp2prj prj_default_one: + $(TCL) $(BSP2PRJ_SCRIPT) $(CPU) $(TOOL) + +# Do all 4 build specs using the default TOOL + +prj_default: + $(TCL) $(BSP2PRJ_SCRIPT) $(CPU) $(TOOL) all + +# prj_gnu_all - ignore the default TOOL, use gnu to build all 4 build specs +# +# Have to clear MAKEFLAGS so subsequent makes won't pick up any conflicting +# values. + +prj_gnu prj_gnu_all: + MAKEFLAGS= $(TCL) $(BSP2PRJ_SCRIPT) $(CPU) $(subst diab,gnu,$(TOOL)) all + +# prj_gnu_def - ignore the default TOOL, use gnu to build one build spec +# +# Have to clear MAKEFLAGS so subsequent makes won't pick up any conflicting +# values. + +prj_gnu_def: + MAKEFLAGS= $(TCL) $(BSP2PRJ_SCRIPT) $(CPU) $(subst diab,gnu,$(TOOL)) + +# prj_diab_all - ignore the default TOOL, use diab to build all 4 build specs. +# +# Have to clear MAKEFLAGS so subsequent makes won't pick up any conflicting +# values. + +prj_diab prj_diab_all: + MAKEFLAGS= $(TCL) $(BSP2PRJ_SCRIPT) $(CPU) $(subst gnu,diab,$(TOOL)) all + +# prj_diab_def - ignore the default TOOL, use diab to build one build spec. +# +# Have to clear MAKEFLAGS so subsequent makes won't pick up any conflicting +# values. + +prj_diab_def: + MAKEFLAGS= $(TCL) $(BSP2PRJ_SCRIPT) $(CPU) $(subst gnu,diab,$(TOOL)) + +# clean up temp files in projects +clean_prj: + - MAKEFLAGS= $(TCL) $(BSP2PRJ_SCRIPT) $(CPU) $(subst gnu,diab,$(TOOL)) \ + clean + - MAKEFLAGS= $(TCL) $(BSP2PRJ_SCRIPT) $(CPU) $(subst diab,gnu,$(TOOL)) \ + clean + +# clean up temp files in BSP directory +clean_cmdLine: + - $(RM) $(wildcard *.o) $(wildcard *.rpo) $(wildcard ctdt.c) \ + $(wildcard symTbl.c) \ + $(wildcard $(basename $(ROMFS_IMAGE)).* $(ROMFS_CONTENT)) + +# clean up everything in BSP for a fresh rebuild +clean : clean_cmdLine + - $(RM) $(wildcard vxWorks*) $(wildcard bootrom*) \ + $(wildcard depend.$(BSP_NAME)) + +# clean up all temp files from a release view +clean_release: clean_cmdLine clean_prj + +ifeq ($(IMPLICIT_RULE_S_O),) +.s.o : + @ $(RM) $@ + $(CC) $(CFLAGS_AS) $(OPTION_OBJECT_ONLY) -o $@ $< +endif + +ifeq ($(IMPLICIT_RULE_C_O),) +.c.o : + @ $(RM) $@ + $(CC) $(CFLAGS) $(OPTION_OBJECT_ONLY) $< +endif + +ifeq ($(IMPLICIT_RULE_CXX_O),) +# rule for munchless C++ compiles +.cpp.o : + @ $(RM) $@ + $(CXX) $(C++FLAGS) $(OPTION_OBJECT_ONLY) $< + +.cxx.o : + @ $(RM) $@ + $(CXX) $(C++FLAGS) $(OPTION_OBJECT_ONLY) $< + +.cc.o : + @ $(RM) $@ + $(CXX) $(C++FLAGS) $(OPTION_OBJECT_ONLY) $< + +# C++ compile and munch +.cpp.out : + @ $(RM) $@ + $(CXX) $(C++FLAGS) $(OPTION_OBJECT_ONLY) $< + @ $(RM) $@ ctdt.c + $(NM) $*.o | $(MUNCH) > ctdt.c + $(MAKE) CC_COMPILER="$(OPTION_DOLLAR_SYMBOLS)" ctdt.o + $(LD_PARTIAL) $(LD_PARTIAL_LAST_FLAGS) -o $@ $*.o ctdt.o + @ $(RM) ctdt.c ctdt.o + +.cxx.out : + @ $(RM) $@ + $(CXX) $(C++FLAGS) $(OPTION_OBJECT_ONLY) $< + @ $(RM) $@ ctdt.c + $(NM) $*.o | $(MUNCH) > ctdt.c + $(MAKE) CC_COMPILER="$(OPTION_DOLLAR_SYMBOLS)" ctdt.o + $(LD_PARTIAL) $(LD_PARTIAL_LAST_FLAGS) -o $@ $*.o ctdt.o + @ $(RM) ctdt.c ctdt.o + +.cc.out : + @ $(RM) $@ + $(CXX) $(C++FLAGS) $(OPTION_OBJECT_ONLY) $< + @ $(RM) $@ ctdt.c + $(NM) $*.o | $(MUNCH) > ctdt.c + $(MAKE) CC_COMPILER="$(OPTION_DOLLAR_SYMBOLS)" ctdt.o + $(LD_PARTIAL) $(LD_PARTIAL_LAST_FLAGS) -o $@ $*.o ctdt.o + @ $(RM) ctdt.c ctdt.o +endif + +# only build ROMFS image if the prototype directory is found +ROMFS_TARGET = $(ROMFS_IMAGE) + +################################################################################ +# +# machine dependent targets + +romInit_res.o: depend.$(BSP_NAME) romInit.s romInit.o + - @ $(RM) $@ + $(CC) $(CFLAGS_AS) -DROM_RESIDENT -DRAM_DST_ADRS=0x$(RAM_LOW_ADRS) \ + $(OPTION_OBJECT_ONLY) -o $@ romInit.s + +romInit_res_low.o: depend.$(BSP_NAME) romInit.s romInit.o + - @ $(RM) $@ + $(CC) $(CFLAGS_AS) -DROM_RESIDENT -DRAM_DST_ADRS=0x$(RAM_LOW_ADRS) \ + $(OPTION_OBJECT_ONLY) -o $@ romInit.s + +romInit_res_high.o: depend.$(BSP_NAME) romInit.s romInit.o + - @ $(RM) $@ + $(CC) $(CFLAGS_AS) -DROM_RESIDENT -DRAM_DST_ADRS=0x$(RAM_HIGH_ADRS) \ + $(OPTION_OBJECT_ONLY) -o $@ romInit.s + +usrConfig.o : depend.$(BSP_NAME) $(USRCONFIG) + - @ $(RM) $@ + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS) $(USRCONFIG) -o $@ + +usrConfig_st.o : depend.$(BSP_NAME) $(USRCONFIG) usrConfig.o + - @ $(RM) $@ + - @ $(RM) usrConfig_st.c + $(CP) $(USRCONFIG) usrConfig_st.c + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS) -DSTANDALONE usrConfig_st.c + - @ $(RM) usrConfig_st.c + +usrEntry.o : depend.$(BSP_NAME) $(USRENTRY) + - @ $(RM) $@ + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS) $(BOOTCONFIG_FLAGS) $(USRENTRY) + +bootConfig.o : depend.$(BSP_NAME) $(BOOTCONFIG) + - @ $(RM) $@ + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS) $(BOOTCONFIG_FLAGS) $(BOOTCONFIG) + +# Use CFLAGS_PIC for all non-rom-resident bootInit objects +bootInit.o : depend.$(BSP_NAME) $(BOOTINIT) + - @ $(RM) $@ + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS_PIC) $(BOOTINIT) + +bootInit_res.o : depend.$(BSP_NAME) $(BOOTINIT) bootInit.o + - @ $(RM) $@ + - @ $(RM) bootInit_res.c + $(CP) $(BOOTINIT) bootInit_res.c + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS) -DROM_RESIDENT bootInit_res.c + - @ $(RM) bootInit_res.c + +bootInit_res_low.o : depend.$(BSP_NAME) $(BOOTINIT) + - @ $(RM) $@ + - @ $(RM) bootInit_res_low.c + $(CP) $(BOOTINIT) bootInit_res_low.c + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS) -DROM_RESIDENT \ + -DRAM_DST_ADRS=0x$(RAM_LOW_ADRS) bootInit_res_low.c + - @ $(RM) bootInit_res_low.c + +bootInit_res_high.o : depend.$(BSP_NAME) $(BOOTINIT) + - @ $(RM) $@ + - @ $(RM) bootInit_res_high.c + $(CP) $(BOOTINIT) bootInit_res_high.c + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS) -DROM_RESIDENT \ + -DRAM_DST_ADRS=0x$(RAM_HIGH_ADRS) bootInit_res_high.c + - @ $(RM) bootInit_res_high.c + +bootInit_uncmp.o : depend.$(BSP_NAME) $(BOOTINIT) bootInit.o + - @ $(RM) $@ + - @ $(RM) bootInit_uncmp.c + $(CP) $(BOOTINIT) bootInit_uncmp.c + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS_PIC) -DUNCOMPRESS bootInit_uncmp.c + - @ $(RM) bootInit_uncmp.c + +bootInit_st.o : depend.$(BSP_NAME) $(BOOTINIT) bootInit.o + - @ $(RM) $@ + - @ $(RM) bootInit_st.c + $(CP) $(BOOTINIT) bootInit_st.c + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS_PIC) \ + -DRAM_DST_ADRS=0x$(RAM_LOW_ADRS) bootInit_st.c + - @ $(RM) bootInit_st.c + +bootInit_uncmp_res.o : depend.$(BSP_NAME) $(BOOTINIT) bootInit.o + - @ $(RM) $@ + - @ $(RM) bootInit_uncmp_res.c + $(CP) $(BOOTINIT) bootInit_uncmp_res.c + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS) -DROM_RESIDENT -DUNCOMPRESS \ + bootInit_uncmp_res.c + - @ $(RM) bootInit_uncmp_res.c + +dataSegPad.o: depend.$(BSP_NAME) $(DATASEGPAD) $(CONFIG_ALL_H) config.h + - @ $(RM) $@ + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS) $(DATASEGPAD) -o $@ + +############################################################################## +# +# Rule for generating ROMFS filesystem. +# + +include $(TGT_DIR)/h/make/rules.fs + +################################################################################ +# +# 3 rules for objcopy flags: START_FLAGS & HEX_FLAGS, NO_VMA_FLAGS, VMA_FLAGS + +# 1st rule: if NO_VMA_FLAGS==VMA_FLAGS(==0), create final output file. + +ifeq ($(strip $(NO_VMA_FLAGS)),$(strip $(VMA_FLAGS))) +BINHEX_OUTPUT_FILE = $@ +else +BINHEX_OUTPUT_FILE = out.tmp1 +endif + +# 2nd rule: if NO_VMA_FLAGS!=0 && VMA_FLAGS==0, create final output file. +# Note: NO_VMA_FLAGS!=0 will be tested each time. + +ifeq ($(strip $(VMA_FLAGS)),) +BINCONV_OUTPUT_FILE = $@ +else +BINCONV_OUTPUT_FILE = out.tmp2 +endif + +# 3rd rule: if VMA_FLAGS!=0 && NO_VMA_FLAGS==0, use out.tmp1 else out.tmp2. +# Note: VMA_FLAGS!=0 will be tested each time. + +ifeq ($(strip $(NO_VMA_FLAGS)),) +BINCONV_INPUT_FILE = out.tmp1 +else +BINCONV_INPUT_FILE = out.tmp2 +endif + +################################## vxWorks ##################################### +# +# vxWorks - normal vxWorks system +# vxWorks.sym - symbol table of vxWorks + +vxWorks vxWorks.sym : depend.$(BSP_NAME) usrConfig.o $(ROMFS_IMAGE) dataSegPad.o \ + $(MACH_DEP) $(LDDEPS) $(patsubst -l%,lib%.a,$(COMP_LIBS)) \ + $(patsubst -l%,lib%.a,$(LIBS)) $(CC_LIB) + - @ $(RM) vxWorks vxWorks.sym + - @ $(RM) version.o + - @ $(RM) vxWorks.tmp ctdt.c ctdt.o + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS) -o version.o \ + $(CONFIG_ALL)/version.c + $(LD_PARTIAL) \ + -o vxWorks.tmp $(MACH_DEP) usrConfig.o $(ROMFS_IMAGE) version.o \ + $(LD_PARTIAL_START_GROUP) $(LD_LINK_PATH) $(COMP_LIBS) $(LIBS) \ + $(LD_PARTIAL_END_GROUP) $(CC_LIB) + $(NM) vxWorks.tmp | $(MUNCH) > ctdt.c + $(MAKE) CC_COMPILER="$(OPTION_DOLLAR_SYMBOLS)" ctdt.o + $(LD) $(LDFLAGS) $(LD_ENTRY_OPT) $(SYS_ENTRY) $(LD_LOW_FLAGS) \ + -o vxWorks dataSegPad.o vxWorks.tmp ctdt.o $(LD_DATA_SEG_ALIGN) \ + $(LD_SCRIPT_RAM) + - @ $(RM) vxWorks.tmp + $(LDOUT_HOST) vxWorks + $(LDOUT_CONV) vxWorks + $(BINXSYM) vxWorks vxWorks.sym + $(LDOUT_SYMS) vxWorks.sym + $(VXSIZEPROG) -v $(RAM_HIGH_ADRS) $(RAM_LOW_ADRS) vxWorks +ifneq ($(ADJUST_VMA), $(DEFAULT_ADJUST_VMA)) + $(KERNEL_VMA_ADJUST) $@ +endif + +# vxWorks_rom - rommable version of VxWorks (without standalone symbol table) +# This is typically used when making an application in ROM that doesn't +# include the shell and the symbol table. Since these applications are +# usually smaller, this version doesn't use ROM compression. + +vxWorks_rom : depend.$(BSP_NAME) bootInit_uncmp.o romInit.o \ + dataSegPad.o usrConfig.o $(ROMFS_IMAGE) $(MACH_DEP) $(LDDEPS) \ + $(patsubst -l%,lib%.a,$(COMP_LIBS)) \ + $(patsubst -l%,lib%.a,$(LIBS)) $(CC_LIB) + - @ $(RM) $@ + - @ $(RM) $(IMI) + - @ $(RM) $(IBR) + - @ $(RM) version.o + - @ $(RM) ctmp.o ctdt.c ctdt.o + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS) -o version.o \ + $(CONFIG_ALL)/version.c + $(LD_PARTIAL) -o ctmp.o usrConfig.o $(ROMFS_IMAGE) \ + $(MACH_DEP) version.o \ + $(LD_PARTIAL_START_GROUP) $(LD_LINK_PATH) $(COMP_LIBS) $(LIBS) \ + $(LD_PARTIAL_END_GROUP) $(CC_LIB) + $(NM) ctmp.o | $(MUNCH) > ctdt.c + $(MAKE) CC_COMPILER="$(OPTION_DOLLAR_SYMBOLS)" ctdt.o + $(LD) $(LDFLAGS) $(LD_ENTRY_OPT) $(ROM_ENTRY) $(LD_LOW_FLAGS) \ + -o $@ romInit.o bootInit_uncmp.o dataSegPad.o ctmp.o ctdt.o \ + $(LD_DATA_SEG_ALIGN) $(LD_SCRIPT_RAM) + - @ $(RM) ctmp.o + $(LDOUT_HOST) $@ + $(ROMSIZEPROG) -b $(ROM_SIZE) $@ + $(LDOUT_CONV) $@ + +# vxWorks.st - standalone VxWorks with symbol table linked in +# This builds a VxWorks image that contains the symbol table linked in, +# instead of loading it over the network. + +vxWorks.st : depend.$(BSP_NAME) usrConfig_st.o $(ROMFS_IMAGE) dataSegPad.o \ + $(MACH_DEP) $(LDDEPS) $(patsubst -l%,lib%.a,$(COMP_LIBS)) \ + $(patsubst -l%,lib%.a,$(LIBS)) $(CC_LIB) + - @ $(RM) $@ + - @ $(RM) symTbl.c + - @ $(RM) symTbl.o + - @ $(RM) tmp.o + - @ $(RM) tmp.2 + - @ $(RM) version.o + - @ $(RM) ctdt.c ctdt.o + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS) -o version.o \ + $(CONFIG_ALL)/version.c + $(LD_PARTIAL) -o tmp.o dataSegPad.o $(MACH_DEP) usrConfig_st.o \ + $(ROMFS_IMAGE) version.o \ + $(LD_PARTIAL_START_GROUP) $(LD_LINK_PATH) \ + $(COMP_LIBS) $(LIBS) $(LD_PARTIAL_END_GROUP) $(CC_LIB) + $(NM) tmp.o | $(MUNCH) >ctdt.c + $(MAKE) CC_COMPILER="$(OPTION_DOLLAR_SYMBOLS)" ctdt.o + $(CP) tmp.o tmp.2 + $(LDOUT_SYMS) tmp.o + $(MKSYMTBL) tmp.o symTbl.c + $(COMPILE_SYMTBL) symTbl.c + $(LD) $(LDFLAGS) $(LD_ENTRY_OPT) $(SYS_ENTRY) $(LD_LOW_FLAGS) -o $@ \ + tmp.2 symTbl.o ctdt.o $(LD_DATA_SEG_ALIGN) $(LD_SCRIPT_RAM) + $(LDOUT_SYMS) $@ + $(LDOUT_CONV) $@ + $(VXSIZEPROG) -v $(RAM_HIGH_ADRS) $(RAM_LOW_ADRS) vxWorks.st + - @ $(RM) tmp.? +ifneq ($(ADJUST_VMA), $(DEFAULT_ADJUST_VMA)) + $(KERNEL_VMA_ADJUST) vxWorks.st +endif + +# vxWorks.st_rom - rommable standalone version using ROM compression +# This builds a standalone VxWorks image that can be put in ROM. +# It includes a linked in symbol table so that a complete VxWorks with +# shell and symbol table can be put in ROM. Since these systems tend to +# be larger, ROM compression is used. +# This rule also creates vxImage.o for use as a "core" file (to provide +# a symbol table) for the target server. +# Note: this uses larger EEPROMs, the user is advised to check the +# macros for ROM sizes and offsets for compatibility. + +vxWorks.st.Z.s : depend.$(BSP_NAME) usrConfig_st.o $(ROMFS_IMAGE) dataSegPad.o \ + $(MACH_DEP) $(LDDEPS) $(patsubst -l%,lib%.a,$(COMP_LIBS)) \ + $(patsubst -l%,lib%.a,$(LIBS)) $(CC_LIB) + - @ $(RM) $@ + - @ $(RM) tmp.o + - @ $(RM) tmp.1 + - @ $(RM) tmp.2 + - @ $(RM) tmp.3 + - @ $(RM) tmp.Z + - @ $(RM) symTbl.c + - @ $(RM) symTbl.o + - @ $(RM) version.o + - @ $(RM) ctdt.c ctdt.o + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS) -o version.o \ + $(CONFIG_ALL)/version.c + $(LD_PARTIAL) -o tmp.1 dataSegPad.o $(MACH_DEP) usrConfig_st.o \ + $(ROMFS_IMAGE) version.o $(LD_PARTIAL_START_GROUP) \ + $(LD_LINK_PATH) $(COMP_LIBS) $(LIBS) $(LD_PARTIAL_END_GROUP) $(CC_LIB) + $(NM) tmp.1 | $(MUNCH) >ctdt.c + $(MAKE) CC_COMPILER="$(OPTION_DOLLAR_SYMBOLS)" ctdt.o + $(CP) tmp.1 tmp.o + $(LDOUT_SYMS) tmp.o + $(MKSYMTBL) tmp.o symTbl.c + $(COMPILE_SYMTBL) symTbl.c + $(LD) -o tmp.2 $(LDFLAGS) $(ROM_LDFLAGS) $(LD_ENTRY_OPT) $(SYS_ENTRY) \ + $(LD_LOW_FLAGS) tmp.1 symTbl.o ctdt.o $(LD_DATA_SEG_ALIGN) \ + $(LD_SCRIPT_RAM) + $(CP) tmp.2 vxImage.o + $(LDOUT_HOST) tmp.2 + $(LDOUT_CONV) tmp.2 + $(EXTRACT_BIN) tmp.2 tmp.3 + $(COMPRESS) < tmp.3 >tmp.Z + $(BINTOASM) tmp.Z > $@ + - @ $(RM) tmp.? + +vxWorks.st_rom : depend.$(BSP_NAME) bootInit_st.o romInit.o \ + vxWorks.st.Z.o $(LDDEPS) $(patsubst -l%,lib%.a,$(COMP_LIBS)) \ + $(patsubst -l%,lib%.a,$(LIBS)) $(CC_LIB) $(BOOT_EXTRA) + - @ $(RM) $(IMI) + - @ $(RM) $(IBR) + - @ $(RM) version.o + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS) -o version.o \ + $(CONFIG_ALL)/version.c + $(LD) $(LDFLAGS) $(LD_ENTRY_OPT) $(ROM_ENTRY) $(LD_HIGH_FLAGS) \ + -o $@ romInit.o bootInit_st.o version.o $(BOOT_EXTRA) \ + $(LD_START_GROUP) $(LD_LINK_PATH) $(COMP_LIBS) $(LIBS) $(LD_END_GROUP) \ + $(CC_LIB) vxWorks.st.Z.o $(LD_DATA_SEG_NOALIGN) $(LD_SCRIPT_RAM) + $(ROMSIZEPROG) -b $(ROM_SIZE) $@ + $(LDOUT_CONV) $@ + $(POST_BUILD_RULE) + +# vxWorks.res_rom - rommable standalone version without compression +# This builds a standalone VxWorks image that can be put in ROM. +# It includes a linked in symbol table so that a complete VxWorks with +# shell and symbol table can be put in ROM. Only the data segment +# of this ROM image is copied into RAM. + +vxWorks.res_rom: depend.$(BSP_NAME) bootInit_res.o romInit_res.o \ + usrConfig_st.o $(ROMFS_IMAGE) $(MACH_DEP) $(LDDEPS) \ + $(patsubst -l%,lib%.a,$(COMP_LIBS)) \ + $(patsubst -l%,lib%.a,$(LIBS)) $(CC_LIB) + - @ $(RM) $@ tmp.o + - @ $(RM) tmp.1 + - @ $(RM) symTbl.c + - @ $(RM) symTbl.o + - @ $(RM) $(IMI) + - @ $(RM) $(IBR) + - @ $(RM) version.o + - @ $(RM) ctdt.c ctdt.o + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS) -o version.o \ + $(CONFIG_ALL)/version.c + $(LD_PARTIAL) -o tmp.o $(MACH_DEP) usrConfig_st.o \ + $(ROMFS_IMAGE) version.o \ + $(LD_PARTIAL_START_GROUP) $(LD_LINK_PATH) $(COMP_LIBS) $(LIBS) \ + $(LD_PARTIAL_END_GROUP) $(CC_LIB) + $(NM) tmp.o | $(MUNCH) > ctdt.c + $(MAKE) CC_COMPILER="$(OPTION_DOLLAR_SYMBOLS)" ctdt.o + $(CP) tmp.o tmp.1 + $(LDOUT_SYMS) tmp.1 + $(MKSYMTBL) tmp.1 symTbl.c + $(COMPILE_SYMTBL) symTbl.c + $(LD) -o $@ $(LDFLAGS) $(RES_LDFLAGS) $(ROM_LDFLAGS) $(LD_ENTRY_OPT) \ + $(ROM_ENTRY) $(RES_LOW_FLAGS) romInit_res.o bootInit_res.o \ + symTbl.o tmp.o $(LD_START_GROUP) $(LD_LINK_PATH) $(COMP_LIBS) $(LIBS) \ + $(LD_END_GROUP) $(CC_LIB) ctdt.o $(LD_SCRIPT_ROM) + $(LDOUT_HOST) $@ + $(ROMSIZEPROG) -b $(ROM_SIZE) $@ + $(LDOUT_CONV) $@ + - @ $(RM) tmp.? + +vxWorks.res_rom_res_low: depend.$(BSP_NAME) bootInit_res_low.o \ + romInit_res_low.o usrConfig_st.o $(ROMFS_IMAGE) $(MACH_DEP) \ + $(LDDEPS) $(patsubst -l%,lib%.a,$(COMP_LIBS)) \ + $(patsubst -l%,lib%.a,$(LIBS)) $(CC_LIB) + - @ $(RM) $@ + - @ $(RM) tmp.o + - @ $(RM) tmp.1 + - @ $(RM) symTbl.c + - @ $(RM) symTbl.o + - @ $(RM) $(IMI) + - @ $(RM) $(IBR) + - @ $(RM) version.o + - @ $(RM) ctdt.c ctdt.o + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS) -o version.o \ + $(CONFIG_ALL)/version.c + $(LD_PARTIAL) -o tmp.o $(MACH_DEP) usrConfig_st.o \ + $(ROMFS_IMAGE) version.o \ + $(LD_PARTIAL_START_GROUP) $(LD_LINK_PATH) $(COMP_LIBS) $(LIBS) \ + $(LD_PARTIAL_END_GROUP) $(CC_LIB) + $(NM) tmp.o | $(MUNCH) >ctdt.c + $(MAKE) CC_COMPILER="$(OPTION_DOLLAR_SYMBOLS)" ctdt.o + $(CP) tmp.o tmp.1 + $(LDOUT_SYMS) tmp.1 + $(MKSYMTBL) tmp.1 symTbl.c + $(COMPILE_SYMTBL) symTbl.c + $(LD) -o $@ $(LDFLAGS) $(RES_LDFLAGS) $(ROM_LDFLAGS) $(LD_ENTRY_OPT) \ + $(ROM_ENTRY) $(RES_LOW_FLAGS) romInit_res_low.o \ + bootInit_res_low.o symTbl.o tmp.o ctdt.o $(LD_SCRIPT_ROM) + $(LDOUT_HOST) $@ + $(ROMSIZEPROG) -b $(ROM_SIZE) $@ + $(LDOUT_CONV) $@ + - @ $(RM) tmp.? + +# vxWorks.res_rom_nosym - rommable standalone version without symbol table +# This builds a standalone VxWorks image that can be put in ROM. +# There is no symbol table. Only the data segment +# of this ROM image is copied into RAM. + +vxWorks.res_rom_nosym: depend.$(BSP_NAME) bootInit_res.o romInit_res.o \ + usrConfig.o $(ROMFS_IMAGE) $(MACH_DEP) $(LDDEPS) \ + $(patsubst -l%,lib%.a,$(COMP_LIBS)) \ + $(patsubst -l%,lib%.a,$(LIBS)) $(CC_LIB) + - @ $(RM) $@ tmp.o + - @ $(RM) tmp.1 + - @ $(RM) symTbl.c + - @ $(RM) symTbl.o + - @ $(RM) $(IMI) + - @ $(RM) $(IBR) + - @ $(RM) version.o + - @ $(RM) ctmp.o ctdt.c ctdt.o + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS) -o version.o \ + $(CONFIG_ALL)/version.c + $(LD_PARTIAL) -o ctmp.o $(LDFLAGS) usrConfig.o $(ROMFS_IMAGE) \ + $(MACH_DEP) version.o \ + $(LD_PARTIAL_START_GROUP) $(LD_LINK_PATH) $(COMP_LIBS) $(LIBS) \ + $(LD_PARTIAL_END_GROUP) $(CC_LIB) + $(NM) ctmp.o | $(MUNCH) >ctdt.c + $(MAKE) CC_COMPILER="$(OPTION_DOLLAR_SYMBOLS)" ctdt.o + $(LD) -o $@ $(LDFLAGS) $(RES_LDFLAGS) $(ROM_LDFLAGS) $(LD_ENTRY_OPT) \ + $(ROM_ENTRY) $(RES_LOW_FLAGS) romInit_res.o bootInit_res.o \ + ctmp.o ctdt.o $(LD_SCRIPT_ROM) + - @ $(RM) ctmp.o + $(LDOUT_HOST) $@ + $(ROMSIZEPROG) -b $(ROM_SIZE) $@ + $(LDOUT_CONV) $@ + +vxWorks.res_rom_nosym_res_low: depend.$(BSP_NAME) bootInit_res_low.o \ + romInit_res_low.o usrConfig.o $(ROMFS_IMAGE) $(MACH_DEP) \ + $(LDDEPS) $(patsubst -l%,lib%.a,$(COMP_LIBS)) \ + $(patsubst -l%,lib%.a,$(LIBS)) $(CC_LIB) + - @ $(RM) $@ + - @ $(RM) tmp.o + - @ $(RM) tmp.1 + - @ $(RM) symTbl.c + - @ $(RM) symTbl.o + - @ $(RM) $(IMI) + - @ $(RM) $(IBR) + - @ $(RM) version.o + - @ $(RM) ctmp.o ctdt.c ctdt.o + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS) -o version.o \ + $(CONFIG_ALL)/version.c + $(LD_PARTIAL) -o ctmp.o usrConfig.o $(ROMFS_IMAGE) \ + $(MACH_DEP) version.o \ + $(LD_PARTIAL_START_GROUP) $(LD_LINK_PATH) $(COMP_LIBS) $(LIBS) \ + $(LD_PARTIAL_END_GROUP) $(CC_LIB) + $(NM) ctmp.o | $(MUNCH) >ctdt.c + $(MAKE) CC_COMPILER="$(OPTION_DOLLAR_SYMBOLS)" ctdt.o + $(LD) -o $@ $(LDFLAGS) $(RES_LDFLAGS) $(ROM_LDFLAGS) $(LD_ENTRY_OPT) \ + $(ROM_ENTRY) $(RES_LOW_FLAGS) romInit_res_low.o \ + bootInit_res_low.o ctmp.o ctdt.o $(LD_SCRIPT_ROM) + - @ $(RM) ctmp.o + $(ROMSIZEPROG) -b $(ROM_SIZE) $@ + $(LDOUT_CONV) $@ + - @ $(RM) tmp.? + +################################# bootrom ###################################### +# +# bootrom - compressed bootrom object module +# bootrom.hex - compressed bootrom hex format +# bootrom_uncmp - noncompressed bootrom object module +# bootrom_uncmp.hex - noncompressed bootrom hex format +# +# Bootroms do not normally contain static C++ objects. Therefore, the +# rules below do not contain steps to munch VxWorks. If you add static +# objects to your bootrom configuration, you will need to munch your +# bootrom image. See the rules for the vxWorks image, above, for an example. +# + +bootrom.Z.s : depend.$(BSP_NAME) usrEntry.o bootConfig.o $(MACH_DEP) $(LDDEPS) \ + $(patsubst -l%,lib%.a,$(LIBS)) $(CC_LIB) + - @ $(RM) $@ + - @ $(RM) tmp.o + - @ $(RM) tmp.out + - @ $(RM) tmp.Z + - @ $(RM) version.o + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS) -o version.o \ + $(CONFIG_ALL)/version.c + $(LD) -o tmp.o $(LDFLAGS) $(ROM_LDFLAGS) $(LD_ENTRY_OPT) $(USR_ENTRY) \ + $(LD_HIGH_FLAGS) usrEntry.o bootConfig.o version.o $(MACH_DEP) $(CC_LIB) \ + $(LD_START_GROUP) $(LD_LINK_PATH) $(LIBS) $(LD_END_GROUP) \ + $(CC_LIB) $(LD_DATA_SEG_NOALIGN) $(LD_SCRIPT_RAM) + $(LDOUT_HOST) tmp.o + $(EXTRACT_BIN) tmp.o tmp.out + $(COMPRESS) < tmp.out > tmp.Z + $(BINTOASM) tmp.Z >bootrom.Z.s + - @ $(RM) tmp.o + - @ $(RM) tmp.out + - @ $(RM) tmp.Z + +bootrom : depend.$(BSP_NAME) bootInit.o romInit.o bootrom.Z.o \ + $(LDDEPS) $(patsubst -l%,lib%.a,$(LIBS)) $(CC_LIB) \ + $(BOOT_EXTRA) + - @ $(RM) $@ + - @ $(RM) $(IMI) + - @ $(RM) $(IBR) + - @ $(RM) version.o + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS) -o version.o \ + $(CONFIG_ALL)/version.c + $(LD) $(LDFLAGS) $(LD_ENTRY_OPT) $(ROM_ENTRY) $(LD_LOW_FLAGS) \ + -o $@ romInit.o bootInit.o version.o $(BOOT_EXTRA) \ + bootrom.Z.o $(CC_LIB) \ + $(LD_START_GROUP) $(LD_LINK_PATH) $(LIBS) $(LD_END_GROUP) \ + $(CC_LIB) $(LD_DATA_SEG_NOALIGN) $(LD_SCRIPT_RAM) + $(ROMSIZEPROG) -b $(ROM_SIZE) $@ + $(LDOUT_CONV) $@ + $(POST_BUILD_RULE) + +bootrom_uncmp : depend.$(BSP_NAME) bootInit_uncmp.o romInit.o \ + bootConfig.o $(MACH_DEP) $(LDDEPS) \ + $(patsubst -l%,lib%.a,$(LIBS)) $(CC_LIB) + - @ $(RM) $@ + - @ $(RM) $(IMI) + - @ $(RM) $(IBR) + - @ $(RM) version.o + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS) -o version.o \ + $(CONFIG_ALL)/version.c + $(LD) $(LDFLAGS) $(ROM_LDFLAGS) $(LD_ENTRY_OPT) $(ROM_ENTRY) \ + $(LD_HIGH_FLAGS) -o $@ romInit.o bootInit_uncmp.o version.o \ + bootConfig.o $(MACH_DEP) $(LD_START_GROUP) $(LD_LINK_PATH) \ + $(LIBS) $(LD_END_GROUP) $(CC_LIB) $(LD_DATA_SEG_NOALIGN) \ + $(LD_SCRIPT_RAM) + $(ROMSIZEPROG) -b $(ROM_SIZE) $@ + $(LDOUT_CONV) $@ + +bootrom_res : depend.$(BSP_NAME) bootInit_res.o romInit_res.o \ + bootConfig.o $(MACH_DEP) $(LDDEPS) \ + $(patsubst -l%,lib%.a,$(LIBS)) $(CC_LIB) + - @ $(RM) $@ + - @ $(RM) $(IMI) + - @ $(RM) $(IBR) + - @ $(RM) version.o + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS) -o version.o \ + $(CONFIG_ALL)/version.c + $(LD) $(LDFLAGS) $(RES_LDFLAGS) $(ROM_LDFLAGS) $(LD_ENTRY_OPT) \ + $(ROM_ENTRY) $(RES_HIGH_FLAGS) -o $@ romInit_res.o \ + bootInit_res.o version.o bootConfig.o $(MACH_DEP) \ + $(LD_START_GROUP) $(LD_LINK_PATH) $(LIBS) $(LD_END_GROUP) \ + $(CC_LIB) $(LD_SCRIPT_ROM) + $(ROMSIZEPROG) -b $(ROM_SIZE) $@ + $(LDOUT_CONV) $@ + +bootrom_res_high : depend.$(BSP_NAME) bootInit_res_high.o \ + romInit_res_high.o bootConfig.o $(MACH_DEP) \ + $(LDDEPS) $(patsubst -l%,lib%.a,$(LIBS)) $(CC_LIB) + - @ $(RM) $@ + - @ $(RM) $(IMI) + - @ $(RM) $(IBR) + - @ $(RM) version.o + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS) -o version.o \ + $(CONFIG_ALL)/version.c + $(LD) $(LDFLAGS) $(RES_LDFLAGS) $(ROM_LDFLAGS) $(LD_ENTRY_OPT) \ + $(ROM_ENTRY) $(RES_HIGH_FLAGS) -o $@ romInit_res_high.o \ + bootInit_res_high.o version.o bootConfig.o $(MACH_DEP) \ + $(LD_START_GROUP) $(LD_LINK_PATH) $(LIBS) $(LD_END_GROUP) \ + $(CC_LIB) $(LD_SCRIPT_ROM) + $(ROMSIZEPROG) -b $(ROM_SIZE) $@ + $(LDOUT_CONV) $@ + +imi : $(IBR) + $(LD) -o $@ $(LD_IMI_ADRS) $(IBR) + +############################################################################### +# +# %.old - convert to old OMF's on targets that migrated to ELF +# +# Used by command-line users + +%.old: % + - @ $(RM) $@ + $(BINCONV) $(OBJCOPY_OLD_OMF) $< $@ + +############################################################################### +# +# %.bin - convert to binary image +# +# Used by command-line users + +%.bin: % + - @ $(RM) $@ + $(EXTRACT_BIN) $< $@ + +############################################################################### +# +# %.hex - convert kernel and bootrom executables to S-record image +# +# Used by command-line users + +%.hex: % depend.$(BSP_NAME) $(IMI) + - @ $(RM) $@ + - @ $(RM) out.tmp* + $(BINHEX) $(START_FLAGS) $(HEX_FLAGS) \ + $(SECT_SPEC)$<$(TXT_OFFSET) $(BINHEX_OUTPUT_FILE) +ifneq ($(strip $(NO_VMA_FLAGS)),) + $(BINCONV) $(NO_VMA_FLAGS) out.tmp1 $(BINCONV_OUTPUT_FILE) +endif +ifneq ($(strip $(VMA_FLAGS)),) + $(BINCONV) $(VMA_FLAGS) $(BINCONV_INPUT_FILE) $@$(MAP_EXT) +endif + - @ $(RM) $(wildcard out.tmp*) + - @ $(MV_BIN) + $(POST_HEX_BUILD_RULE) + +############################################################################### +# +# headerMacros - output the values of all header macros +# +# Used by the project creation scripts + +headerMacros: + @ $(CPP_PRINT_MACROS) $(CDF_OVERRIDE) sysLib.c + +############################################################################### +# +# makeMacrosReferred - output makefile-macros referred by project +# + +makeMacrosReferred: + $(NOP) VX_OS_LIBS = $(VX_OS_LIBS) + +############################################################################### +# +# makeMacros - output makefile-macros related to toolchain settings +# +# Used by the project creation scripts + +makeMacros: + @ $(ECHO) '$(NOP) CPU = $(CPU)\n\ +$(NOP) TOOL = $(TOOL)\n\ +$(NOP) AR = $(AR)\n\ +$(NOP) CC = $(CC)\n\ +$(NOP) CPP = $(CPP)\n\ +$(NOP) NM = $(NM)\n\ +$(NOP) SIZE = $(SIZE)\n\ +$(NOP) AS = $(AS)\n\ +$(NOP) LD = $(LD)\n\ +$(NOP) CFLAGS_AS = $(CFLAGS_AS)\n\ +$(NOP) C++FLAGS = $(C++FLAGS)\n\ +$(NOP) CFLAGS_PROJECT = $(CFLAGS_PROJECT)\n\ +$(NOP) CFLAGS_AS_PROJECT = $(CFLAGS_AS_PROJECT)\n\ +$(NOP) LDFLAGS = $(LDFLAGS)\n\ +$(NOP) LD_PARTIAL = $(LD_PARTIAL)\n\ +$(NOP) LD_PARTIAL_FLAGS = $(LD_PARTIAL_FLAGS)\n\ +$(NOP) EXTRA_CFLAGS = $(EXTRA_INCLUDE) $(EXTRA_DEFINE) $(OPT_DEFINE) $(ADDED_CFLAGS)\n\ +$(NOP) LIBS = $(LIB_EXTRA) $$(VX_OS_LIBS)\n\ +$(NOP) LD_LINK_PATH = $(LD_LINK_PATH)\n\ +$(NOP) LDDEPS = $(LDDEPS)\n\ +$(NOP) BOOT_EXTRA = $(BOOT_EXTRA)\n\ +$(NOP) MACH_DEP = $(MACH_DEP)\n\ +$(NOP) OPTION_DEPEND = $(OPTION_DEPEND)\n\ +$(NOP) OPTION_LANG_C = $(OPTION_LANG_C)\n\ +$(NOP) CC_ARCH_SPEC = $(CC_ARCH_SPEC)\n\ +$(NOP) TOOL_FAMILY = $(TOOL_FAMILY)\n\ +$(NOP) HEX_FLAGS = $(HEX_FLAGS)' +ifneq ($(DEPEND_GEN_UTIL),) + @ $(ECHO) "$(NOP) DEPEND_GEN_UTIL = $(DEPEND_GEN_UTIL)" +endif + +# Include BSP Test component rules if installed. +-include $(TGT_DIR)/h/make/rules.bsptest + +include $(TGT_DIR)/h/make/rules.$(WIND_HOST_TYPE) + +# Include rules that support packaging of a bsp +-include $(WIND_HOME)/setup/make/rules.resourcezip + +DOC_DIR = $(DOCS_ROOT)/com.windriver.ide.doc.bsp + diff --git a/h/make/rules.fs b/h/make/rules.fs new file mode 100644 index 0000000..b3e110c --- /dev/null +++ b/h/make/rules.fs @@ -0,0 +1,119 @@ +# rules.fs - makefile target rules for embedding a ROMFS file system image +# +# Copyright 2004-2005, Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01f,02feb05,lei print out a message for target ROMFS_CONTENT. +# 01e,06oct04,h_k added prefix "_" to romfsImage and romfsImageEnd for SH. +# (SPR #102341) +# 01d,24sep04,c_c Allow possible previous definition of ROMFS_CONTENT to take +# precedence over the default value. +# 01c,24sep04,c_c Fixed a problem when ROMFS_CONTENT is set to nothing. +# 01b,17sep04,c_c Fixed SPR 99797. +# 01a,22jun04,c_c written +# +# DESCRIPTION +# This file contains rules used for embedding a filesystem within vxWorks image. +# One can change default build by overriding either: +# ROMFS_CONTENT, which is a binary image of a ROMFS filesystem filled with +# files that are to be embedded on the target +# ROMFS_DIR, which represent a directory tree on the local filesystem that +# contains all the files that are to be embedded on the target. +# +# This file is included by rules.project and rules.bsp, and rely on all the +# rules that are defined by regular target builds (.o.s, $(CC), ...), and +# therefore may not work is included standalone. + +# We must provide different name for the generated assembly file (ROMFS_IMAGE), +# to avoid any problem if the generated file exists in the BSP directory, and, +# therefore could be fetched through the vpath directive. + +ifneq ($(PRJ_DIR),) + +ifeq ($(ROMFS_DIR),) +ROMFS_DIR = $(PRJ_DIR)/romfs +endif + +ifeq ($(ROMFS_CONTENT),) +ROMFS_CONTENT = $(PRJ_DIR)/content.romfs +endif + +ROMFS_IMAGE = romfs_image_prj.o +else + +ifeq ($(ROMFS_DIR),) +ROMFS_DIR = romfs +endif + +ifeq ($(ROMFS_CONTENT),) +ROMFS_CONTENT = content.romfs +endif + +ROMFS_IMAGE = romfs_image.o +endif + +ifneq ($(VX_CPU_FAMILY),sh) + ROMFSIMAGE_SYM_NAME = romfsImage +else +# sh require leading prefix "_" + + ROMFSIMAGE_SYM_NAME = _romfsImage +endif + +# Be sure that if some variable have been given as WIN32 path we handle them +# correctly + +override ROMFS_CONTENT := $(subst \,/,$(ROMFS_CONTENT)) +override ROMFS_DIR := $(subst \,/,$(ROMFS_DIR)) + +############################################################################### +# +# Rule for rebuilding ROMFS image +# +# mkromfs: -q quiet mode +# -n only create filesys if files changed in input +# -o $(ROMFS_CONTENT)output file name +# + +# Dummy target to force call to MKROMFS, which will take care of updating +# ROMFS content. +__always_build: + +# Create a filesystem binary image from a directory content. +# We do the binary image if ROMFS_DIR is really a dir. Otherwise, we create a +# zero-length file if no file was existing before. + +$(ROMFS_CONTENT) : __always_build + @if [ -d "$(ROMFS_DIR)" ]; then \ + $(MKROMFS) -q -n -o $@ $(ROMFS_DIR) ; \ + else \ + if [ ! -f "$@" ]; then touch $@; fi; \ + fi + @$(ECHO) "$(ROMFS_CONTENT) build done" + +# Create on object file from a filesystem image; +# - We use an assembly file that will include the binary image. +# - we create two symbols that will point to the beginning and the end of this +# binary image. +# +# The configlette and the BSP init code will guess if there is an embedded file +# system if the difference between the two symbols' address is > 0. + + +$(ROMFS_IMAGE:.o=.s) : $(ROMFS_CONTENT) + @if [ -s "$<" ]; then \ + $(ECHO) "\t.section \".rodata\"\n\ +\t.global $(ROMFSIMAGE_SYM_NAME)\n\ +\t.global $(ROMFSIMAGE_SYM_NAME)End\n\ +$(ROMFSIMAGE_SYM_NAME):\n\ +\t.incbin \"$<\"\n\ +$(ROMFSIMAGE_SYM_NAME)End:\n" > $@; \ + else \ + $(ECHO) "\t.section \".rodata\"\n\ +\t.global $(ROMFSIMAGE_SYM_NAME)\n\ +\t.global $(ROMFSIMAGE_SYM_NAME)End\n\ +$(ROMFSIMAGE_SYM_NAME):\n\ +$(ROMFSIMAGE_SYM_NAME)End:\n" > $@;\ + fi + diff --git a/h/make/rules.gpp b/h/make/rules.gpp new file mode 100644 index 0000000..96d1533 --- /dev/null +++ b/h/make/rules.gpp @@ -0,0 +1,60 @@ +# rules.gpp - makefile target rules for gpp +# +# Copyright (c) 2001-2005 Wind River Systems, Inc. +# +# The right to copy, distribute, modify or otherwise make use +# of this software may be licensed only pursuant to the terms +# of an applicable Wind River license agreement. +# +# +# modification history +# -------------------- +# 01c,18aug05,kch Redefined MSP networking features that are not supported +# in GPP products. +# 01b,15apr05,kch Modified to use $FEATURE_SET environment variable. +# 01a,06apr05,kch created. +# +# +# DESCRIPTION +# This file is included in defs.default for both the kernel and user builds +# to establish rules that pertains to the gpp product requirements. +# + +# For GPP build, the environment variable $FEATURE_SET is either set to "gpp" +# or simply not defined at all. Here it is assumed that the top-level Feature +# Set Makefile (if exist) has verified the setting of the $FEATURE_SET +# variable (if defined) + +ifeq ($(FEATURE_SET),) +_GPP_BUILD = TRUE +else +ifeq ($(FEATURE_SET),gpp) +_GPP_BUILD = TRUE +endif +endif + +# $(MSP_ONLY) defines features that are available for the MSP products +# only. +# +MSP_ONLY = -DVIRTUAL_STACK -DSCTP -DSUBNET_VLAN -DSOCKET_VLAN -DVLAN_TAG \ + -DMLDV2 -DMIP6 -DIGMPV3 + +ifneq ($(_GPP_BUILD),) + +# First check the $(ADDED_CFLAGS) +ifneq ($ADDED_CFLAGS),) +GPP_UNSUPPORTED = $(filter $(MSP_ONLY), $(ADDED_CFLAGS)) +ifneq ($(GPP_UNSUPPORTED),) +$(error Unsupported ADDED_CFLAGS="$(GPP_UNSUPPORTED)") +endif +endif + +# now look at the $(EXTRA_DEFINE) +ifneq ($(EXTRA_DEFINE),) +GPP_UNSUPPORTED = $(filter $(MSP_ONLY), $(EXTRA_DEFINE)) +ifneq ($(GPP_UNSUPPORTED),) +$(error Unsupported EXTRA_DEFINE="$(GPP_UNSUPPORTED)") +endif +endif + +endif # GPP build diff --git a/h/make/rules.library b/h/make/rules.library new file mode 100644 index 0000000..e359ac0 --- /dev/null +++ b/h/make/rules.library @@ -0,0 +1,516 @@ +# rules.library - Host independent rules for making libraries +# +# Copyright 1984-2005, Wind River Systems, Inc. +# +# modification history +# -------------------- +# 03v,22aug05,pee added target name to make depend rules +# 03x,05aug05,??? fix for too long expansion +# 03w,22jul05,pee cleaned precomp rules. They failed on large paths. +# 03v,07jul05,pee added opath target to help find object files. +# 02u,31may05,md,pee moved dependencies to object directory +# 02t,18apr05,pee added support for precomp objs. +# 02s,07apr05,h_a LIB_ROOT to replace $(TGT_DIR)/lib for building components +# 02r,04feb05,lei no need a dependency file for "make man" +# 02q,14may04,yvp Added LOCAL_RCLEAN rule. +# 02p,22mar04,yvp Changed rules for scgen-derived-files to match scgen ver02a. +# 02o,13mar04,dlk Support option builds. +# 02n,02mar04,yvp Added separate rule to make TGT_DIR/h/syscall.h. +# 02m,26feb04,yvp Added copy rules for syscall.h (SPR 93550). +# 02l,20feb04,c_c Added BUILD_EXT in ctdt file to allow parallel builds +# (SPR 79165). +# + merged fix for SPR #93014. +# 02k,22jan04,pch SPR 93014: unify build rules for CPUGEN_EXISTS +# and remove debug code introduced in 02e. +# 02j,16dec03,yvp Ignore error deleting scgen temp files. +# 02i,15dec03,yvp Cleanup scgen invocation rules. +# 02h,04dec03,yvp Changed options to scgen. +# 02g,03dec03,c_c Clean variant directories when invoking rclean. +# 02f,07nov03,c_c Unified build rules with WIN32 hosts. +# 02e,03nov03,pch don't try to run cpuGen if it does not exist +# 02d,10oct03,yvp Added -h (header file only) option to scgen. +# 02c,18sep03,yvp Added syscalldeps. +# 02b,14feb02,jab use LD_PARTIAL_LAST_FLAGS in last link for .out targets +# 02a,14dec01,tam made CPU variant builds automatic +# 01z,06dec01,tam added support for building CPU variant archive(s) +# 01y,04dec01,sn added BUILD_ALL_OBJS +# 01x,12nov01,tam added use of TOOL_COMMON_DIR +# 01w,09nov01,tam removed '//' in paths +# 01v,08nov01,tam fix x86-win32 build; added build of empty lib$CPU$TOOLvx.a +# 01u,01nov01,tam updated rclean rule for new archive directory hierarchy +# 01t,19oct01,pch Add rules and dependencies for generation of +# target/src/arch/Makefile and target/h/types/vxCpu.h +# 01s,01nov01,jab added LIBDIR directory creation +# 01r,24oct01,tam updated for repackaging +# 01q,23oct01,jab cleaned up +# 01p,11oct01,dbs add EXCLUDE_SUBDIRS variable as per AE +# 01o,20sep01,dat Moving make files to h/tool/ +# 01n,19sep01,mem Prefix $(VX_CPU_FAMILY) to LIBDIRBASE path. +# 01m,06aug01,mem Updated for new runtime arrangement. +# 01l,25jul01,sn Add per-file CFLAGS capability for C++ files +# 01k,24jul01,r_s changing the make 'ifeq' conditional to work with 'gnu', +# 'sfgnu', 'sfgnule' etc for TOOL +# 01j,24jul01,r_s diab specific rules added +# 01j,05jun01,mem Add per-file CFLAGS_AS capability. +# 01i,12jan00,dra add per-file CFLAGS capability +# 01h,19jan99,dra use LD_PARTIAL_FLAGS for partial links with ctdt.o +# 01g,23feb99,sn removed references to $(POST_MUNCH) +# -traditional -> -fdollars-in-identifiers +# 01f,02feb99,sn added rules to build standalone "munched" C++ modules +# (useful for building test programs) +# 01e,11dec98,j_w add clean rule to remove lib$(CPU)$(TOOL).a +# 01d,11nov98,sn undid 01d +# 01c,07nov96,yp made the RM commands in implicit rules windows friendly +# 01b,17may96,yp moved clean rule to host specific stubs so Windows will work +# 01a,07may96,yp created +# +# DESCRIPTION +# This file is included by every Makefile in the run-time (not BSPs). +# This file contains makefile rules that are host independent for creating +# vxWorks libraries. It also contains implicit rules for .c .s .cpp and .cxx +# files in either the current directory or in $(LIBDIR). +# +# In each source directory, the list of source files is obtained and matched +# against the objects specified to be built in the OBJS macro. In this way +# extraneous .c and .s files are ignored and make does not fail if it doesn't +# find the source file to an object in OBJS (This is the case with most source +# customers). +# +# The MAKETAIL and CLEANTAIL macros, designed by Sott H. although obsolete +# from here on, are still available and known to work only in Unix environments. +# +# If the macro SUBDIRS is defined with directories we build the subdirectories +# before we build the current dir. +# +# INCLUDES +# $(TGT_DIR)/h/make/defs.library +# $(TGT_DIR)/h/make/rules-lib.$(WIND_HOST_TYPE) +# depend.$(BUILD_EXT) + +# By default object files are installed in the toolchain independent object +# directory if LIB_BASE_NAME is set, that is when LIB_COMMON is not set. + +include $(TGT_DIR)/h/make/defs.library + +CPUGEN_EXISTS := $(shell [ -x $(BIN_DIR)/cpuGen ] && echo TRUE) + +## implicit rules + +.s.o : + @ $(RM) $@ + $(CC) $(CFLAGS_AS) $(CFLAGS_AS_$(<:.s=.o)) $(OPTION_OBJECT_ONLY) $(OPTION_OBJECT_NAME)$@ $< + +.c.o : + @ $(RM) $@ + $(CC) $(CFLAGS) $(CFLAGS_$(<:.c=.o)) $(OPTION_OBJECT_ONLY) $< + +# do not attempt to build dependency on their own. +%.d: + - @ : + +# rules to build objects in $(LIBDIR) +$(LIBDIR)/%.o : %.c + @ $(RM) $@ + $(CC) $(CFLAGS) $(OPTION_DEPEND_GEN_D) $(CFLAGS_$(<:.c=.o)) $(OPTION_OBJECT_ONLY) $(OPTION_OBJECT_NAME)$@ $< + +$(LIBDIR)/%.o : %.s + @ $(RM) $@ + $(CC) $(CFLAGS_AS) $(OPTION_DEPEND_GEN_D) $(CFLAGS_AS_$(<:.s=.o)) $(OPTION_OBJECT_ONLY) $(OPTION_OBJECT_NAME)$@ $< + +# rule for munchless C++ compiles +$(LIBDIR)/%.o : %.cpp + @ $(RM) $@ + $(CXX) $(C++FLAGS) $(OPTION_DEPEND_GEN_D) $(CFLAGS_$(<:.cpp=.o)) $(OPTION_OBJECT_ONLY) $(OPTION_OBJECT_NAME)$@ $< + +## Rule for standalone "munched" C++ modules. + +# In general the only library modules that should be munched are +# standalone test programs. Certainly nothing in the runtime should be +# munched until BSP or Project build time. If you want your +# module to be munched, specify a .out target in $(OBJS) instead +# of a .o. + +$(LIBDIR)/%.out : %.cpp + @ $(RM) $@ + $(CXX) $(C++FLAGS) $(OPTION_OBJECT_ONLY) $(OPTION_OBJECT_NAME) \ + $(basename $@).o $< + @ $(RM) ctdt_$(BUILD_EXT).c + $(NM) $(basename $@).o | $(MUNCH) > ctdt_$(BUILD_EXT).c + $(MAKE) CC_COMPILER=$(OPTION_DOLLAR_SYMBOLS) ctdt_$(BUILD_EXT).o + $(LD_PARTIAL) $(LD_PARTIAL_LAST_FLAGS) $(OPTION_OBJECT_NAME)$@ $(basename $@).o ctdt_$(BUILD_EXT).o + @ $(RM) $(basename $@).o ctdt_$(BUILD_EXT).c ctdt_$(BUILD_EXT).o + +# rule for munchless C++ compiles +.cpp.o : + @ $(RM) $@ + $(CXX) $(C++FLAGS) $(OPTION_OBJECT_ONLY) $< + +.cxx.o : + @ $(RM) $@ + $(CXX) $(C++FLAGS) $(OPTION_OBJECT_ONLY) $< + +# C++ compile and munch +.cpp.out : + @ $(RM) $@ + $(CXX) $(C++FLAGS) $(OPTION_OBJECT_ONLY) $< + @ $(RM) $@ ctdt_$(BUILD_EXT).c + $(NM) $*.o | $(MUNCH) > ctdt_$(BUILD_EXT).c + $(MAKE) CC_COMPILER=$(OPTION_DOLLAR_SYMBOLS) ctdt_$(BUILD_EXT).o + $(LD_PARTIAL) $(LD_PARTIAL_LAST_FLAGS) $(OPTION_OBJECT_NAME)$@ $*.o ctdt_$(BUILD_EXT).o + @ $(RM) ctdt_$(BUILD_EXT).c ctdt_$(BUILD_EXT).o + +.cxx.out : + @ $(RM) $@ + $(CXX) $(C++FLAGS) $(OPTION_OBJECT_ONLY) $< + @ $(RM) $@ ctdt_$(BUILD_EXT).c + $(NM) $*.o | $(MUNCH) > ctdt_$(BUILD_EXT).c + $(MAKE) CC_COMPILER=$(OPTION_DOLLAR_SYMBOLS) ctdt_$(BUILD_EXT).o + $(LD_PARTIAL) $(LD_PARTIAL_LAST_FLAGS) $(OPTION_OBJECT_NAME)$@ $*.o ctdt_$(BUILD_EXT).o + @ $(RM) ctdt_$(BUILD_EXT).c ctdt_$(BUILD_EXT).o + +## rules to build dependencies in $(LIBDIR) + +$(LIBDIR)/%.dummy_d : %.c + @ $(MKDIR) $(LIBDIR) + @ $(RM) $@ + $(CC) $(CFLAGS) $(OPTION_DEPEND) $(CFLAGS_$(<:.c=.o)) $(OPTION_OBJECT_ONLY) $(OPTION_DEPEND_TARGET)$(@:.dummy_d=.o) $< >$(@:.dummy_d=.d) + +$(LIBDIR)/%.dummy_d : %.s + @ $(MKDIR) $(LIBDIR) + @ $(RM) $@ + $(CC) $(CFLAGS_AS) $(OPTION_DEPEND) $(CFLAGS_AS_$(<:.s=.o)) $(OPTION_OBJECT_ONLY) $(OPTION_DEPEND_TARGET)$(@:.dummy_d=.o) $< >$(@:.dummy_d=.d) + +$(LIBDIR)/%.dummy_d : %.cpp + @ $(MKDIR) $(LIBDIR) + @ $(RM) $@ + $(CXX) $(C++FLAGS) $(OPTION_DEPEND) $(CFLAGS_$(<:.cpp=.o)) $(OPTION_OBJECT_ONLY) $(OPTION_DEPEND_TARGET)$(@:.dummy_d=.o) $< >$(@:.dummy_d=.d) + +## rules to construct object lists + +# vxWorks source distribution do not always have all of the +# sources to object files specified in macro OBJS macro. +# We use GNU make functions to find what we need to build + +# get the list of .c, .cpp and .s files +FILE_LIST = $(wildcard *.[cs]) $(wildcard *.cpp) $(INDIRECT_SOURCES) + +# Change .c to .o in FILE_LIST and store in TMP_LIST +TMP_LIST = $(FILE_LIST:.c=.o) + +# Change .cpp to .o in TMP_LIST and store in TMP1_LIST +TMP1_LIST = $(TMP_LIST:.cpp=.o) + +# We can also build .out files from .cpp files +TMP2_LIST = $(subst .cpp,.out,(filter %.cpp,$(FILE_LIST))) + +# Change .s to .o in TMP1_LIST, concat with TMP2_LIST, and store in +# OBJ_PRESENT. These are the objects we can build +OBJ_PRESENT = $(TMP1_LIST:.s=.o) $(TMP2_LIST) + +# Find the intersection of the objects we can build and the objects we'd +# like to build + +# Normally we just build objects that can be built from source +# files in this directory. However if BUILD_ALL_OBJS is non-empty +# then trust the definition of $(OBJS). + +ifeq ($(BUILD_ALL_OBJS),) +OBJS_TO_BUILD = $(filter $(OBJ_PRESENT),$(OBJS)) +else +OBJS_TO_BUILD = $(OBJS) +endif + +ifneq ($(strip $(OBJS_PRECOMP)),) +ifeq ($(OBJS_PRECOMP), $(filter $(OBJ_PRESENT), $(OBJS_PRECOMP))) +$(warning sources are available) +$(PRECOMPDIR)/%.o : %.c + @ $(RM) $@ + $(CC) $(CFLAGS) $(CFLAGS_$(<:.c=.o)) $(OPTION_OBJECT_ONLY) $(OPTION_OBJECT_NAME)$@ $< + +$(PRECOMPDIR)/%.o : %.s + @ $(RM) $@ + $(CC) $(CFLAGS_AS) $(CFLAGS_AS_$(<:.s=.o)) $(OPTION_OBJECT_ONLY) $(OPTION_OBJECT_NAME)$@ $< + +# rule for munchless C++ compiles +$(PRECOMPDIR)/%.o : %.cpp + @ $(RM) $@ + $(CXX) $(C++FLAGS) $(CFLAGS_$(<:.cpp=.o)) $(OPTION_OBJECT_ONLY) $(OPTION_OBJECT_NAME)$@ $< +endif +endif + + + +# Now we fix up where they will go once they are built +LIBOBJS_FROM_SRC = $(foreach file, $(OBJS_TO_BUILD), $(LIBDIR)/$(file)) + +LIBOBJS_PRECOMP = $(foreach file, $(OBJS_PRECOMP), $(LIBDIR)/$(file)) + +LIBOBJS = $(LIBOBJS_FROM_SRC) $(LIBOBJS_PRECOMP) + +# It is safe to assume that if a subdirectory exists with a Makefile in it +# that we want to build it. If this is not the case one needs to over ride +# this definition in the Makefile for the directory in concern. + +# NOTE: to over ride this definition one must define SUBDIRS before the +# include directive for this file (rules.library) in the Makefile +ifeq ($(SUBDIRS),) +ALL_SUBDIRS = $(patsubst %/,%,$(dir $(wildcard */Makefile))) +else +ALL_SUBDIRS = $(SUBDIRS) +endif +SUBDIRS_TMP = $(filter-out $(EXCLUDE_SUBDIRS), $(ALL_SUBDIRS)) +override SUBDIRS := $(filter-out $(UNSUPPORTED_SUBDIRS), $(SUBDIRS_TMP)) + +# architecturedb, and files which are generated from it +# see the files in $(WIND_BASE)/host/src/cpuGen, +# and the comments in architecturedb, for details +ARCH_DB = $(WIND_BASE)/host/resource/target/architecturedb +ARCH_FILES = $(TGT_DIR)/src/arch/Makefile $(TGT_DIR)/h/types/vxCpu.h + + +## Default rule: +# The default rule builds directories recursively starting from the top level +# directory. For every directory, the selected archive is also created and/or +# populated with object files. +# In addition CPU variant build(s) if enabled for the current CPU/TOOL +# combinaison are started at the end of the top level directory build +# (target/src/). +# An empty lib$(CPU)$(TOOL)vx.a is created by this rule if no +# lib$(CPU)$(TOOL)vx.a already exists. + +VX_LIB = $(wildcard $(LIB_ROOT)/lib$(CPU)$(TOOL)vx.a) + +ifeq ($(SKIP_LIB), true) +LIB_DEP = +else +LIB_DEP = lib +endif + +ifneq ($(SKIP_DIR), true) +Default: archdeps $(SCGEN_DERIVED_FILES) $(LIB_DEP) subdirs +ifneq ($(CPU_VARIANT_MAKE_CMD),) + +## Check if we are already in a CPU_VARIANT generated build command line, and +## avoid recursion. + +ifneq ($(NO_RECURSE), TRUE) + $(CPU_VARIANT_MAKE_CMD) +endif + +endif + +ifeq ($(VX_LIB),) + $(AR) cru $(LIB_ROOT)/lib$(CPU)$(TOOL)vx.a +endif +ifneq ($(MAKETAIL),) + ($(MAKE) -f Makefile CPU=$(CPU) TOOL=$(TOOL) \ + $(MAKETAIL) \ + MAKETAIL='') +endif + +else + +Default: subdirs + @echo skipping directory +endif + +####################################### +# +# target opath will output a list of object target objects with full path +# the rule is implemented so that there is one file per line +# and no other blank lines or blank characters. +# The output would normally be fed to a linker. The GNU link does not like blanks. +# + +%.opath: + @echo $(@:.opath=.o) + +opath: $(LIBOBJS:.o=.opath) + + +## recursive clean rule + +rclean: + $(RM) $(LOCAL_RCLEAN) +ifneq ($(SUBDIRS),) + $(MAKE) CPU=$(CPU) TOOL=$(TOOL) TGT_DIR=$(TGT_DIR) \ + TARGET=rclean $(SUBDIRS) +endif +ifeq ($(SKIP_CLEAN),) +ifneq ($(CPU_VARIANT_MAKE_CLEAN),) + +## Check if we are already in a CPU_VARIANT generated build command line, and +## avoid recursion. + +ifneq ($(NO_RECURSE), TRUE) + $(CPU_VARIANT_MAKE_CLEAN) +endif + +endif + + $(MAKE) CPU=$(CPU) TOOL=$(TOOL) TGT_DIR=$(TGT_DIR) clean +ifeq ($(CLEANLIBS),YES) + $(RM) $(wildcard $(LIB_ROOT)/lib$(CPU)$(TOOL)*.a) + $(RM) $(wildcard $(LIB_ROOT)/$(VX_CPU_FAMILY)/$(CPU)/$(TOOL)/lib*$(OPT).a) + $(RMDIR) $(wildcard $(LIB_ROOT)/$(VX_CPU_FAMILY)/$(CPU)/$(TOOL)/obj*$(OPT)) + $(RM) $(wildcard $(LIB_ROOT)/$(VX_CPU_FAMILY)/$(CPU)/$(TOOL_COMMON_DIR)/lib*$(OPT).a) + $(RMDIR) $(wildcard $(LIB_ROOT)/$(VX_CPU_FAMILY)/$(CPU)/$(TOOL_COMMON_DIR)/obj*$(OPT)) + $(RMDIR) $(wildcard $(LIB_ROOT)/obj$(CPU)$(TOOL)*) +endif +endif # ifneq ($(SKIP_CLEAN),) + + +## recursive depend rule + +rdepend: + +ifneq ($(SUBDIRS),) + $(MAKE) CPU=$(CPU) TOOL=$(TOOL) TGT_DIR=$(TGT_DIR) \ + TARGET=rdepend $(SUBDIRS) +endif +ifeq ($(SKIP_CLEAN),) +ifneq ($(CPU_VARIANT_MAKE_DEPEND),) + +## Check if we are already in a CPU_VARIANT generated build command line, and +## avoid recursion. + +ifneq ($(NO_RECURSE), TRUE) + $(CPU_VARIANT_MAKE_DEPEND) +endif + +endif + + $(MAKE) CPU=$(CPU) TOOL=$(TOOL) TGT_DIR=$(TGT_DIR) depend +endif # ifneq ($(SKIP_CLEAN),) + +# Make sure the object directory exists. +ifneq ($(LIBDIR),$(LIB_ROOT)/) +MAKE_LIBDIR = make_libdir +make_libdir: + -$(MKDIR) $(LIBDIR) +endif + +$(LIBDIR) : + $(MKDIR) $@ + +$(PRECOMPDIR) : + $(MKDIR) $@ + +# +# This section generates explicit rules to map the precomp objs. +# + +define precompdep + +$(LIBDIR)/$(1) : $(PRECOMPDIR)/$(1) + $(CP) $$? $$@ + +endef + +$(eval $(foreach file, $(OBJS_PRECOMP), $(call precompdep,$(file)))) + + +# recursive build of all objects. The hope is that this rule will help +# with parallel builds. Calling lib and subdirs with parallel builds +# has the adverse effect of trying to create libraries from multiple +# subdirectories that tends to destroy the library. +all-objs : archdeps $(SCGEN_DERIVED_FILES) objs +ifneq ($(SUBDIRS),) + $(MAKE) CPU=$(CPU) TOOL=$(TOOL) TGT_DIR=$(TGT_DIR) \ + TARGET=all-objs $(SUBDIRS) +endif + +# Just in case you want to build objects and not update the archives +objs: archdeps $(SCGEN_DERIVED_FILES) $(MAKE_LIBDIR) $(LIBOBJS) + +release: archdeps $(SCGEN_DERIVED_FILES) + $(MAKE) CPU=$(CPU) TOOL=$(TOOL) TGT_DIR=$(TGT_DIR) \ + TARGET=release + +# Files which are generated from the architecturedb +archdeps: $(ARCH_FILES) + +ifeq ($(CPUGEN_EXISTS),TRUE) +$(TGT_DIR)/h/types/vxCpu.h: $(TGT_DIR)/h/types/vxCpu.in $(ARCH_DB) + cpuGen -t -i $< -o $@ + +$(TGT_DIR)/src/arch/Makefile: $(TGT_DIR)/src/arch/Makefile.in $(ARCH_DB) + cpuGen -m -i $< -o $@ +endif + +# Files that are generated from syscallNum.def, syscallApi.def etc. + +# These rules are provided primarily for released products where syscallXP*.def +# and syscallUsr*.def may not be shipped by Wind River. These dummy rules will +# create a zero-length file so that make should not fail due to missing +# dependencies. The intent here is for scgen to parse syscallXPNum.def, +# syscallXPApi.def, syscallUsrNum.def and syscallUsrApi.def only if they exist. + +$(TGT_DIR)/share/h/syscallXPNum.def: + touch $@ + +$(TGT_DIR)/share/h/syscallXPApi.def: + touch $@ + +$(TGT_DIR)/share/h/syscallUsrNum.def: + touch $@ + +$(TGT_DIR)/share/h/syscallUsrApi.def: + touch $@ + +$(TGT_DIR)/h/syscall.h: $(TGT_DIR)/share/h/syscallNum.def \ + $(TGT_DIR)/share/h/syscallXPNum.def \ + $(TGT_DIR)/share/h/syscallUsrNum.def + scgen -h + +$(TGT_DIR)/h/arch/$(ARCH_DIR)/syscallArgs$(ABI_SPEC).h: \ + $(TGT_DIR)/share/h/syscallApi.def \ + $(TGT_DIR)/share/h/syscallXPApi.def \ + $(TGT_DIR)/share/h/syscallUsrApi.def + scgen -A $(ABI_SPEC) $(CPU) $(ARCH_DIR) + +$(TGT_DIR)/h/syscallTbl.h: $(TGT_DIR)/share/h/syscallNum.def \ + $(TGT_DIR)/share/h/syscallXPNum.def \ + $(TGT_DIR)/share/h/syscallUsrNum.def \ + $(TGT_DIR)/share/h/syscallApi.def \ + $(TGT_DIR)/share/h/syscallXPApi.def \ + $(TGT_DIR)/share/h/syscallUsrApi.def + scgen -t + + +include $(TGT_DIR)/h/make/rules-lib.$(WIND_HOST_TYPE) + +# we don't need a dependency list if are not building objects +# or for "make man" + +ifeq (, $(findstring clean, $(MAKECMDGOALS))) +ifeq (, $(findstring clean, $(TARGET))) +ifneq ($(MAKECMDGOALS), man) + +# We suppress the warning message about non existent file and setting of errno +# by prepending - . GNU make allows this. + +LIBOBJS_NODEP = $(foreach file, $(NODEPENDOBJS), $(LIBDIR)/$(file)) + +DEP_OBJS = $(filter-out $(LIBOBJS_NODEP), $(LIBOBJS)) + +EXISTING_OBJS = $(foreach obj, $(DEP_OBJS), $(wildcard $(obj))) + +DEP_FILES = $(filter %.d , $(EXISTING_OBJS:.o=.d)) + +EXISTING_DEP_FILES = $(foreach obj, $(DEP_FILES), $(wildcard $(obj))) + +MISSING_DEP = $(filter-out $(EXISTING_DEP_FILES), $(DEP_FILES)) + +ifneq ($(strip $(MISSING_DEP)),) +$(warning warning: missing dependency files $(MISSING_DEP)) +$(warning run make depend to regenerate) +endif + +ifneq ($(strip $(EXISTING_DEP_FILES)),) +include $(EXISTING_DEP_FILES) +endif + +endif +endif +endif diff --git a/h/make/rules.memory b/h/make/rules.memory new file mode 100644 index 0000000..29b2616 --- /dev/null +++ b/h/make/rules.memory @@ -0,0 +1,29 @@ +# rules.memory - memory oriented build rules +# +# Copyright 2004 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01a,02jul04,fle written + +# DESCRIPTION +# For now this files only contains the adrsMacros rule which prints the list +# of ADRS macros needed by the kernel files. +# +# This is used by the kernel configuration tool. +# +# SEE ALSO: vxprj +# + +ifndef TGT_DIR +TGT_DIR = $(WIND_BASE)/target +endif + +include $(TGT_DIR)/h/make/defs.memory + +ifneq ($(BSP2PRJ), TRUE) +CC_DEFINES += $(ADRS_DEFINE) +endif + +adrsMacros: + @ $(ECHO) $(ADRS_MACROS) diff --git a/h/make/rules.project b/h/make/rules.project new file mode 100644 index 0000000..522801b --- /dev/null +++ b/h/make/rules.project @@ -0,0 +1,357 @@ +# rules.project - makefile target rules for BSP +# +# modification history +# -------------------- +# 02h,16aug05,pee added .d and source build files to clean rule +# 02g,09sep04,fle better use PRJ_MAKEFILE +# 02f,09aug04,fle SPR#99177 : use C flags for C++ dependencies +# 02e,07jul04,c_c Removed usage of romfs_image.h. +# 02d,05apr04,fle SPR#95255 : Added build rule for .s files +# 02c,12mar04,fle Generate dependencies files in the project directory only +# 02b,11mar04,fle Made dependencies written to .d file to avoid make +# verbosity to mess it all up +# 02a,09mar04,fle Made dependencies rules silent +# 01z,27feb04,fle SPR#91836 : added per file dependencies rule +# 01y,30jan04,fle Made clean rule use wildcards +# 01x,07nov03,c_c Unified build rules with WIN32 hosts. +# 01w,24oct03,fle SPR#90904 : added POST_HEX_BUILD_RULE to all .hex rules +# 01v,09oct03,md make ROMFS location resident in project root +# 01u,02jul03,md Added ROMFS component rules +# 01t,13mar02,sn SPR 74080 - added large project support for Diab +# 01s,04feb02,rbl add dummy "force" target to help with sub-projects +# 01r,07dec01,tpw Remove HEX_HIGH_FLAGS and HEX_LOW_FLAGS, and fix proj %.hex +# 01q,08nov01,tpw Add general %.bin rule. +# 01p,06nov01,tpw Add %.old rule to facilitate conversions to old OMFs +# 01o,20oct01,dat Relocating tool specific macro +# 01n,17sep01,sn moved LARGE_PROJECT defs here +# 01m,24apr00,dat SPR 30819, fix project link of ROM images +# 01m,06jan00,dra updated for new .hex file generation. +# 01l,11mar99,sn To prevent make from sticking "informative" messages +# about what it's doing in prjObjs.lst, +# changed -s -> --no-print-directory. +# 01k,10mar99,ren Circumventing bug in gnu make, where if there is a \t in the +# pathname, it puts a tab char instead. +# 01j,04mar99,sn added machinery to handle large projects +# 01i,19feb99,ren clean did not remove correct files +# 01h,11nov98,sn partially link using LD_PARTIAL +# clean now removes .rpo files +# 01g,09jul98,ms changed libs.size to libs.siz +# 01f,01jul98,jmp replaced LIBS by the library name in libs.nm and libs.siz +# rules. +# 01e,29jun98,ms module xref support; nm->nm -ng. new rules for autoscale. +# 01e,02jun98,ms updated prjConfig.c rules and dependancies. +# 01d,02jun98,ms updated description, removed implicit rules, rom*.o rules +# 01c,02apr98,pcn Removed Objcopy changes from Tempest view +# 01b,15dec97,pcn Added Objcopy in BSP build. +# 01a,20oct97,ms created from rules.bsp +# +# DESCRIPTION +# This file contains rules used in building targets. +# It uses variable definitions from defs.bsp and the BSP +# Makefile, which can be overriden as needed. +# +# The following have no default values and must be defined in the project +# CPU cpu type +# TOOL compiler tool (e.g., gnu) +# PRJ_TYPE image to build (e.g., vxWorks, bootrom, wdb) +# BSP_DIR directory of the BSP on which this project is based +# ROM_SIZE number of bytes of ROM space as in config.h +# ROM_TEXT_ADRS ROM entry address +# ROM_LINK_ADRS ROM link address +# RAM_LOW_ADRS RAM address to which VxWorks is linked +# RAM_HIGH_ADRS RAM address to which the boot code is linked +# +# The following variables specify what to build +# +# DEFAULT_RULE what to build +# RELEASE images made as part of WRS release step +# +# OVERVIEW OF THE BUILD RULES +# +# The makefile stub is imported by BSP Makefiles to provide rules for +# building VxWorks and application code. This section provides an overview +# of how the system works. +# +# VxWorks is built in stages +# The object files are then partially linked against the archives, +# typically just target/lib/lib$(CPU)$(TOOL)vx.a, to produce a +# relocatable vxWorks object file. +# We then optially build some support modules (ctdt.o or symTbl.o) +# to link with the relocatable vxWorks object file. These support +# modules are called POSTLINK_MODULES because they are built after +# the main link stage for vxWorks. This is done because these modules +# are derived from the relocatable vxWorks object file. +# A fully linked executable is then formed according to one of four +# possible rules: +# %_downLoadable RAM resident (no relocation of the code) +# %_romResident ROM resident (data segment copied to RAM) +# %_rom ROM copy to RAM (entire image copied to RAM) +# %_romCompress ROM uncompress to RAM (entire image uncompressed to RAM) +# The first image is linked to RAM and must be loaded to RAM by some +# external program such as a VxWorks bootROM. +# The last three images start executing from ROM. See romStart.c for +# details on how these images work. +# Finally, there are also post-processing rules available: +# %.sym stripped image containing only the symbol table +# %.hex srecord +# %.old convert to old OMF (eg. ARM COFF, Pentium a.out) +# %.bin convert to binary image +# +# LINKING +# +# The four images are linked quite differently. +# The following is a summary of the default link addresses: +# %_downLoadable text and data are contiguous, starting at RAM_LOW_ADRS +# %_romResident text at ROM_LINK_ADRS, data at RAM_LOW_ADRS +# %_rom text at ROM_LINK_ADRS, data at HIGH_ADRS. This image contains +# a %_downLoadable subimage which is linked to +# RAM_LOW_ADRS. The %_rom_cpy just copies the subimage to +# RAM_LOW_ADRS and jumps to it (see romStart.c for details). +# %_romCompress just like %_rom, but the subimage is compressed. +# +# SUMMARY OF CHANGES +# +# * Many macros have changed, but the project creation wizards +# automcatically convert from the old to the new. +# * There are now only four main rules. +# * The post-processing rules (%.hex, %.sym, etc.) apply to any image. +# * ROM images are linked to ROM addresses so one no longer needs to +# write position independant ROM startup code. +# * Build with debugging on by default (CC_DEBUG = -g). +# * The macro DEFAULT_RULE can be changed to override the default build rule. +# * Link flags are passed to romStart.c, eliminating the need for CPU ifdef's. +# * By default, rebuild all BSP objects every time. Generate dependancies +# for user modules (not previously done). +# * ctdt.o and symTbl.o are only built if the appropriate macro is defined +# in config.h. +# * The vxWorks.sym file is built only if INCLUDE_NET_SYM_TBL is defined +# in config.h. +# * Intermediate Makefile images are no longer deleted. + +.SUFFIXES: .d + +# I960 IMI + +imi : $(IBR) + $(LD) -o $@ $(LD_IMI_ADRS) $(IBR) + +# Large projects require special treatment because of the small command +# line length limit on Windows 95/98. +# Instead of passing the list of project objects $(PRJ_OBJS) on +# the command line we pass the name of a file ($(PRJ_OBJS_FILE)) +# that contains this list using the "@file" syntax. This syntax is +# supported by the GNU tools ar,ld and nm. + +# These definitions are here rather than in defs.project because they +# rely on the value of $(LARGE_PROJECT) passed in from make.$(CPU)$(TOOL) + +ifneq ($(LARGE_PROJECT),) +PRJ_OBJS_FILE=$(PRJ_DIR)/prjObjs.lst +else +PRJ_OBJS_FILE= +endif + +ifneq ($(PRJ_OBJS_FILE),) +PRJ_OBJS_FOR_LD_PARTIAL=$(OPTION_PASS_TO_LD)$(OPTION_INDIRECT_FILE)$(PRJ_OBJS_FILE) +PRJ_OBJS_FOR_LD=$(OPTION_INDIRECT_FILE)$(PRJ_OBJS_FILE) +PRJ_OBJS_FOR_NM=$(OPTION_NM_INDIRECT_FILE)$(PRJ_OBJS_FILE) +PRJ_OBJS_FOR_AR=$(OPTION_INDIRECT_FILE)$(PRJ_OBJS_FILE) +else +PRJ_OBJS_FOR_LD_PARTIAL=$(PRJ_OBJS) +PRJ_OBJS_FOR_LD=$(PRJ_OBJS) +PRJ_OBJS_FOR_NM=$(PRJ_OBJS) +PRJ_OBJS_FOR_AR=$(PRJ_OBJS) +endif + +ifneq ($(PRJ_OBJS_FILE),) + +# This rule creates the project object list file by delegating +# the work to another target ($(PRJ_OBJS_FILE)_make) that in turn +# depends on one target per project object. + +$(PRJ_OBJS_FILE) : $(PRJ_MAKEFILE) + -$(RM) $@ + @echo Generating $(subst \,/, $@)... + @$(MAKE) --no-print-directory -f $(PRJ_MAKEFILE) $@_make > \ + $(PRJ_OBJS_FILE) + +$(PRJ_OBJS_FILE)_make : $(foreach obj,$(PRJ_OBJS),$(obj)_._write_._) + +# We have one "write" target per project object. Each one +# writes the name of the object to stdout. +# The point of using "_._write_._" is simply to ensure +# that the targets have odd enough names that they don't +# clash with any existing targets. + +$(foreach obj,$(PRJ_OBJS),$(obj)_._write_._) : + @echo $(subst _._write_._,,$@) + +endif + +################################################################################ +# +# meta build targets +# + +## make will default to "exe" + +exe : $(DEFAULT_RULE) + +release : $(RELEASE) + +__always_build__: + +ifeq ($(SRC_BUILD),TRUE) +clean : src_clean +else +clean : +endif + - $(RM) $(wildcard *.o) $(wildcard *.rpo) $(wildcard ctdt.c) \ + $(wildcard symTbl.c) $(wildcard $(PRJ_TYPE)*) \ + $(wildcard *.out) $(wildcard *.pl) $(wildcard *.d) + - $(RM) $(PRJ_DIR)/prjComps.h $(PRJ_DIR)/prjParams.h \ + $(PRJ_DIR)/prjConfig.c $(PRJ_DIR)/linkSyms.c + - $(RM) $(PRJ_DIR)/libs.nm $(PRJ_DIR)/libs.size +ifneq ($(findstring INCLUDE_ROMFS, $(COMPONENTS)),) + - $(RM) $(wildcard $(basename $(ROMFS_IMAGE)).* $(ROMFS_CONTENT)) +endif + +# SPR#95255 : Added rules for .s files + +.s.o : + @ $(RM) $@ + $(CC) $(CFLAGS_AS) $(OPTION_OBJECT_ONLY) -o $@ $< + +################################################################################ +# +# Rules for genereating dependencies to the standard output +# + +.c.d: + @ $(CC) $(CFLAGS) $(OPTION_DEPEND) $< + +.s.d: + @ $(CC) $(CFLAGS_AS) $(OPTION_DEPEND_AS) $< + +.cpp.d: + @ $(CXX) $(CFLAGS) $(OPTION_DEPEND) $< + +.cxx.d: + @ $(CXX) $(CFLAGS) $(OPTION_DEPEND) $< + +.cc.d: + @ $(CXX) $(CFLAGS) $(OPTION_DEPEND) $< + +############################################################################### +# +# Rule for generating the module xref and component library databases +# + +mxrDoc: $(PRJ_DIR)/libs.nm $(PRJ_DIR)/libs.siz + +$(PRJ_DIR)/libs.nm: + $(NM) $(NM_GLOB_FLAGS) $(MXR_LIBS) > $(PRJ_DIR)/libs.nm + +$(PRJ_DIR)/libs.siz: + $(SIZE) $(MXR_LIBS) > $(PRJ_DIR)/libs.siz + +$(PRJ_DIR)/prjConfig.c $(PRJ_DIR)/prjComps.h $(PRJ_DIR)/prjParams.h $(PRJ_DIR)/linkSyms.c: \ + $(PRJ_DIR)/$(PRJ_FILE) + - @ $(RM) $@ + $(CFG_GEN) $(PRJ_DIR)/$(PRJ_FILE) + +############################################################################### +# +# Rule for generating ROMFS filesystem. +# + +include $(TGT_DIR)/h/make/rules.fs + + +############################################################################### +# +# Rule in support of autoscaling +# + +mxrInfo: $(PRJ_DIR)/mxrInfo.nm $(PRJ_DIR)/mxrInfo.size + +$(PRJ_DIR)/mxrInfo.nm: $(MXR_USR_OBJS) + $(NM) $(NM_GLOB_FLAGS) $(MXR_USR_OBJS) > $@ + +$(PRJ_DIR)/mxrInfo.size: $(MXR_USR_OBJS) + $(SIZE) $(MXR_USR_OBJS) > $@ + +############################################################################### +# +# Rule in support of dynamic loading +# + +dynLoad.o: __always_build__ + $(AR) -x $(LIBS) $(LIB_OBJS) + $(LD_PARTIAL) $(USR_OBJS) $(LIB_OBJS) -o $@ + +################################################################################ +# +# 3 rules for objcopy flags: START_FLAGS & HEX_FLAGS, NO_VMA_FLAGS, VMA_FLAGS + +# 1st rule: if NO_VMA_FLAGS==VMA_FLAGS(==0), create final output file. +ifeq ($(strip $(NO_VMA_FLAGS)),$(strip $(VMA_FLAGS))) + BINHEX_OUTPUT_FILE = $@$(MAP_EXT) +else + BINHEX_OUTPUT_FILE = out.tmp1 +endif + +# 2nd rule: if NO_VMA_FLAGS!=0 && VMA_FLAGS==0, create final output file. +# Note: NO_VMA_FLAGS!=0 will be tested each time. +ifeq ($(strip $(VMA_FLAGS)),) + BINCONV_OUTPUT_FILE = $@$(MAP_EXT) +else + BINCONV_OUTPUT_FILE = out.tmp2 +endif + +# 3rd rule: if VMA_FLAGS!=0 && NO_VMA_FLAGS==0, use out.tmp1 else out.tmp2. +# Note: VMA_FLAGS!=0 will be tested each time. +ifeq ($(strip $(NO_VMA_FLAGS)),) + BINCONV_INPUT_FILE = out.tmp1 +else + BINCONV_INPUT_FILE = out.tmp2 +endif + +################################################################################ +# +# rules for building derived images +# + +%.hex: % + - @ $(RM) $@ + $(BINHEX) $(START_FLAGS) $(HEX_FLAGS) $(SECT_SPEC)$<$(TXT_OFFSET) \ + $(IMI_SPEC)$(IMI)$(IMI_OFFSET) $(BINHEX_OUTPUT_FILE) +ifneq ($(strip $(NO_VMA_FLAGS)),) + $(BINCONV) $(NO_VMA_FLAGS) out.tmp1 $(BINCONV_OUTPUT_FILE) +endif +ifneq ($(strip $(VMA_FLAGS)),) + $(BINCONV) $(VMA_FLAGS) $(BINCONV_INPUT_FILE) $@$(MAP_EXT) +endif + - @ $(RM) $(wildcard out.tmp*) + $(POST_HEX_BUILD_RULE) + +%.old: % + - @ $(RM) $@ + $(BINCONV) $(OBJCOPY_OLD_OMF) $< $@ + +%.bin: % + - @ $(RM) $@ + $(EXTRACT_BIN) $< $@ + +################################################################################ +# +# subproject support +# + +# wind_force_make has no dependency and no rule. Depending on wind_force_make is +# a way to ensure that a rule is always executed. + +wind_force_make: ; + +include $(TGT_DIR)/h/make/rules.$(PRJ_TYPE) + diff --git a/h/make/rules.sun4-solaris2 b/h/make/rules.sun4-solaris2 new file mode 100644 index 0000000..c3664d6 --- /dev/null +++ b/h/make/rules.sun4-solaris2 @@ -0,0 +1,11 @@ +# rules.sun4-solaris2 - host specific rules +# +# modification history +# -------------------- +# 01b,06jun96,dat SPR 6141, proper use of TGT_DIR +# 01a,01jun95,yp created +# +# DESCRIPTION +# This file contains rules that are host specific to sun4-solaris2 platform. + +include $(TGT_DIR)/h/make/rules.unix diff --git a/h/make/rules.unix b/h/make/rules.unix new file mode 100644 index 0000000..4b59f68 --- /dev/null +++ b/h/make/rules.unix @@ -0,0 +1,162 @@ +# rules.unix - host specific rules +# +# Copyright 1984-2004, Wind River Systems, Inc. +# +# modification history +# -------------------- +# 02v,17may05,lll Replaced malfunctioning "\n"'s with echo "" +# 02u,25apr05,kkz Updating for new doc path +# 02t,10jan05,lll Standalone apigen, SPR#105634 and SPR#104090 +# 02s,06oct04,tpw Switch BSP doc build forward to apigen. +# 02r,10aug04,dgp temporarily revert BSP doc build back to refgen +# 02q,07jul04,c_c Removed usage of romfs_image.h. +# 02p,27may04,dgp update BSP output and TOC directories +# 02o,25may04,tpw Switch on -missingok to reduce doc build error output. +# 02n,11feb04,c_c Added a NODEPENDOBJS list to filter files that should not +# be parsed when generating dependencies (SPR 93380). +# 02m,12jan04,bjl changed refgen to apigen. +# 02l,10dec03,c_c fixed builds for BSP templates. +# 02k,28nov03,c_c Reinstated variable replacement. +# 02j,26nov03,c_c Fixed Linux simulator build. +# 02i,07nov03,c_c Unified build rules with WIN32 hosts. +# 02h,02jul03,md Added command (mkromfs) for building ROMFS image +# 02g,12mar02,wsl change BSP_Reference to VxWorks_BSP_Reference +# 02f,27nov01,wsl allow target.ref files but keep target.nr backward +# compatibility +# 02e,29oct01,jab removed ld script rules +# 02d,25oct01,dat more gnu-diab changes +# 02c,18oct01,jab made dependency generation toolchain independent +# 02b,01oct01,dat consistent use of BSP_NAME macro +# 02a,27aug01,wsl add man pages +# 01z,24jul01,r_s diab specific rules added +# 01y,28jun00,jab force creation of LECFs. +# 01x,17feb00,jab added LECF generation rules. See notes at rules. +# 01w,02feb99,sjw use -M -MG in dependency generation so generated files +# can be included in BSP files. +# 01v,26oct98,ms made dependency generation overridable from make.CPUTOOL +# 01u,15oct98,fle doc : renamed book for BSP and put boards reference into +# board library +# 01t,05oct98,ms remove romInit.s dependeny generation for simulators +# 01s,23sep98,fle doc : adapted -preproc refgen new option +# 01r,23sep98,fle doc : changed bsp book name +# 01r,22sep98,fle doc : now use refgen instead of mangen +# 01q,02jan97,dat added DOC_FLAGS +# 01p,21nov96,p_m removed unwanted @ in bsp.1 rule +# 01o,21nov96,p_m changed bsp.1 mode prior to copy target.nr +# 01n,19nov96,dat mangen error output not dropped. target.txt made in +# bsp directory. SPRs 7507 and 7508. +# 01m,15oct96,yp made rule for include of dependency list silent SPR 4483 +# 01l,03oct96,dbt added backslashes in the sed expressions (HPUX10 port). +# 01k,30jul96,pad undo change 01j, introduced here by mistake. +# 01j,26jul96,pad backslashed the $ in the sed expressions (AIX port). +# 01i,10may96,dat added -DINCLUDE_SCSI for man pages (SPR3941) added copyright +# 01h,18mar96,dat fixed cpp command for building man pages +# 01g,06mar96,dat added sed command to insert $TGT_DIR into depend output +# 01f,08feb96,dat used CONFIG_ALL in making dependency list +# 01e,04nov95,p_m took care of missing files in docs rule +# 01d,06jul95,jcf made sed script global. +# 01c,21jun95,yp added sed script to prevent hardwiring depend. list. +# 01b,10jun95,yp changed TARGET_DIR to BSP_NAME +# 01a,01jun95,yp created +# +# DESCRIPTION +# This file contains rules that are host specific to the unix platform. + +## documentation build targets + +DOC_FILES := $(filter $(DOC_FILES),$(patsubst %.c,%,$(wildcard *.c))) + +.PHONY: $(DOC_FILES) htmllink + +man : target.html docs + +docs: $(DOC_FILES) htmllink + +$(DOC_FILES): + @echo ""; echo "Processing $@.c ... " + @-$(CPP) $(CASFLAGS) $(OPTION_PP_COMMENT) $(DOC_FLAGS) $@.c 1> $@.i + -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen -mg -nostrict \ + -book VxWorks_APIs -chapter BSP_APIs \ + -category $(BSP_NAME) -missingok \ + -out $(DOC_DIR)/$(BSP_NAME) $@.i + -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen -mg -nostrict \ + -book VxWorks_APIs -chapter BSP_APIs \ + -category $(BSP_NAME) -missingok -config Auto2txt \ + -out $(MAN_PAGE_DIR)/$(BSP_NAME) $@.i + @-$(RM) $@.i + +htmllink: + @echo ""; echo "HTML linking ... " + -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/htmlLink \ + $(DOC_DIR)/$(BSP_NAME) + @echo "Linking complete." + @date + + +# The following variable assignment selects target.ref over target.nr, and +# exists only to facilitate the transition from nroff markup to refgen +# markup. When target.nr joins its dinosaur brethren, this should be removed. + +TARGET_REF = target.ref +ifeq (,$(wildcard target.ref)) + TARGET_REF = target.nr +endif + +target.html: + @echo ""; echo "Processing $(TARGET_REF) ... " + -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen -mg -nostrict \ + -config bsp2html -book VxWorks_APIs -chapter BSP_APIs -missingok \ + -out $(DOC_DIR)/$(BSP_NAME) $(TARGET_REF) + -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen -mg -nostrict \ + -config bsp2txt -book VxWorks_APIs -chapter BSP_APIs -missingok \ + -out $(MAN_PAGE_DIR)/$(BSP_NAME) $(TARGET_REF) + + +# +# It is possible to generate dependency lists automatically by depending on +# a make include file: +# +# with: GNU make, SunOS 4.x/5.x make. +# but not with: clearmake, HPUX 9.x make, and probably plenty of others. +# +# If depend.$(BSP_NAME) has been removed and you are haplessly without +# a copy of GNU make: +# +# % # In the BSP in question... +# % touch depend.$(BSP_NAME) +# % make depend.$(BSP_NAME) +# % make +# +# Order in the Universe should be restored. +# + +depend.$(BSP_NAME) : + - $(CC) $(OPTION_DEPEND_C) $(CFLAGS) $(filter-out $(NODEPENDOBJS),$(wildcard *.[c] $(CONFIG_ALL)/*.[c])) > $@ +# The two files below may not be present for simulators. So ignore the error +# returned by the compiler if the file does not exist. + +ifneq ($(wildcard romInit.s),) + $(CPP) $(OPTION_DEPEND_AS) $(CASFLAGS) romInit.s >> $@ +endif +ifneq ($(wildcard sysALib.s),) + $(CPP) $(OPTION_DEPEND_AS) $(CASFLAGS) sysALib.s >> $@ +endif + +# Post process the dependencies to substitute WIND variables + + - @ $(BSP_PROCESS_DEP) + +# XXX generic rule for assembly files forthcoming + +ifneq ($(IS_PRJ),TRUE) + +BSP2PRJ=FALSE +ifeq ($(BSP2PRJ),FALSE) +ifneq ($(MAKECMDGOALS),clean) +-include depend.$(BSP_NAME) +endif +endif + +endif + + diff --git a/h/make/rules.vxApp b/h/make/rules.vxApp new file mode 100644 index 0000000..fcada56 --- /dev/null +++ b/h/make/rules.vxApp @@ -0,0 +1,45 @@ +# rules.vxApp - makefile target rules for vxWorks application projects +# +# modification history +# -------------------- +# 01k,18sep03,fle SPR#89965 : added POST_BUILD_RULE in .pl rule +# 01j,07nov01,rbl add .pl partial link target for sub-projects +# 01i,31mar99,tdl added $(LD_PARTIAL_LAST_FLAGS) +# 01h,10mar99,ren Changing linkedObjs.o to .out +# 01g,23feb99,sn removed references to $(POST_MUNCH) +# 01f,17nov98,sn reworked munch for windows95 +# 01e,11nov98,sn partially link using LD_PARTIAL +# 01d,11nov98,sn munch -> orderCtors +# 01c,08oct98,ms linkedObjs.o now depends on PRJ_FILE +# 01b,27aug98,ms added POST_BUILD_RULE, loadable_object renamed to +# linkedObjs.o. Removed MERGED_OBJS macro. +# 01a,11aug98,ms added modhist. changed merged_object to loadable_object, +# and added munching + +objects: $(LDDEPS) $(PRJ_OBJS) + $(POST_BUILD_RULE) + +$(ARCHIVE): $(LDDEPS) $(PRJ_OBJS) $(PRJ_OBJS_FILE) + $(AR) crus $@ $(PRJ_OBJS_FOR_AR) + $(POST_BUILD_RULE) + +archive: $(ARCHIVE) + +PROJECT_OUT = $(basename $(notdir $(PRJ_FILE))).out + +$(PROJECT_OUT): $(LDDEPS) $(PRJ_OBJS) \ + $(PRJ_DIR)/$(PRJ_FILE) $(PRJ_OBJS_FILE) $(PRJ_LIBS) + @ $(RM) $@ ctdt.c + $(LD_PARTIAL) $(PRJ_OBJS_FOR_LD_PARTIAL) $(PRJ_LIBS) -o partialImage.o + $(NM) partialImage.o $(PRJ_OBJS_FOR_NM) | $(MUNCH) > ctdt.c + $(COMPILE_TRADITIONAL) ctdt.c -o ctdt.o + $(LD_PARTIAL) $(LD_PARTIAL_LAST_FLAGS) partialImage.o ctdt.o -o $@ + @ $(RM) ctdt.c ctdt.o partialImage.o + $(POST_BUILD_RULE) + +PROJECT_PL = $(basename $(notdir $(PRJ_FILE))).pl + +$(PROJECT_PL): $(LDDEPS) $(PRJ_OBJS) $(PRJ_DIR)/$(PRJ_FILE) $(PRJ_OBJS_FILE) \ + $(PRJ_LIBS) + $(LD_PARTIAL) $(PRJ_OBJS_FOR_LD_PARTIAL) $(PRJ_LIBS) -o $@ + $(POST_BUILD_RULE) diff --git a/h/make/rules.vxWorks b/h/make/rules.vxWorks new file mode 100644 index 0000000..0f1d92c --- /dev/null +++ b/h/make/rules.vxWorks @@ -0,0 +1,398 @@ +# rules.vxWorks - makefile target rules for vxWorks projects +# +# modification history +# -------------------- +# 02p,060ct05,zhr Fixed SPR#113315 +# 02o,30sep05,zhr Fixed SPR#112192 +# 02n,28sep05,pee Modified source build rules 112947 & 112722 +# 02m,16aug05,pee Added make depend rule +# 02l,08Aug05,pee Added explicit dependency on generated file. +# 02l,18jul05,pee Added intrinsics library to source build prototype rule +# 02k,08jul05,pee Added prototype support for building from source +# Added option to generate map file +# 02j,20Jun05,pee Dependency generation and inclusion. +# 02i,22apr05,edc Added dependency on added COMP_LIBS. +# 02h,07apr05,edc Library paths for components +# 02g,07jul04,c_c Added romfs_image to the builds. +# 02g,06jul04,fle Added kernel VMA adjust +# 02f,04mar04,fle Do not assume ROM_FLAGS_EXTRA are only defined for rom +# rules +# 02e,28mar02,cym don't perform POST_BUILD_RULE twice in rom targets +# 02d,31jan02,fmk remove redirection operator to generate symTbl.c +# 02c,11dec01,rbl get e.g. vxWorks_romCompress.hex image working +# 02b,07dec01,tpw Remove HEX_HIGH_FLAGS and HEX_LOW_FLAGS, and fix proj %.hex +# 02a,12nov01,dat added prj_default, fixes for gnu and diab projects +# 01z,08nov01,tpw Add LD_SCRIPT_RAM, LD_SCRIPT_ROM macros as appropriate. +# 01y,06nov01,dat Fix to romCompress rule, added escaped newline +# 01x,30oct01,tam removed CC_LIB from cyclic linking +# 01w,09oct01,j_s present LD_LINK_LIBS through LIBS, add cyclic link options +# add support for build dependency on archives: vpath and +# expansion of '-l' to 'lib.a' +# 01v,25oct01,dat Relocating tool specific macros +# 01u,22oct01,cym replacing BOOT_OBJS with romInit.o and romStart.o for +# romResident builds. +# 01t,06aug01,mem Added LD_LINK_LIBS and LD_LINK_PATH +# 01s,06apr00,dra Added HEX_LOW_FLAGS and HEX_HIGH_FLAGS to support FRV +# (Venus) toolchain. +# 01r,31mar00,rsh final merge es.tor2_0.mcore to tor2_0_0.es.coretools +# 01q,02mar00,rsh add .hex$(MAP_EXT) suffix to BINHEX_OUTPUT_FILE rules. +# 01p,01mar00,rsh adding rule to clean .hex related temp files for each rom +# based image and remove POST_BUILD_RULE definition. +# 01o,29feb00,rsh adding definition of POST_BUILD_RULE to rm temporary +# out.tmp1 and out.tmp2 files. +# 01n,06jan00,dra updated for new .hex file generation. +# 01m,04mar99,sn added machinery to handle large projects +# 01l,23feb99,sn removed references to $(POST_MUNCH) +# 01k,17nov98,sn reworked munch for windows95 +# 01j,11nov98,sn partially link using LD_PARTIAL +# 01i,11nov98,sn munch -> orderCtors +# 01h,30oct98,yh added deadweight removal hook. +# 01g,26oct98,ms added EXTRA_MODULES. romInit.o etc now part of BOOT_OBJS. +# 01g,21apr99,bc Alter BINXSYM command line for objcopy interface. +# 01f,26aug98,ms added POST_BUILD_RULE. Link against COMPONENT_LIBS. +# 01e,07jul98,ms added MAKE_SYM_CVT macro, added LDOUT_CONV to vxWorks. +# 01d,29jun98,ms renamed vxWorks_downLoadable to just vxWorks. +# 01c,25jun98,ms build rom* files is subdirectories. LDDEPS now comes first. +# 01b,20may98,ms fixed call to EXTRACT_BIN for windows host +# 01a,18feb98,ms created + +# rules/defs include tree for a linux host, PPC604 vxWorks project for diab +# +# +-> defs.project +# | +-> defs.link +# | | +-> defs.option +# | +-> defs.x86-linux2 +# | | +-> defs.unix +# | +-> defs.vxWorks +# | +-> make.PPC604diab +# | +-> defs.ppc +# | +-> defs.diab +# | +-> defs.common +# +-> rules.project +# +-> rules.vxWorks +# +-> rules.memory +# +-> defs.memory + +include $(TGT_DIR)/h/make/rules.memory + +################################################################################ +# +# Search for dependency archives in LD_LINK_PATH +# + +ifneq ($(SRC_BUILD), TRUE) +vpath %.a $(subst -L,,$(LD_LINK_PATH)) +endif + +################################################################################ +# +# generate link map if MAP=TRUE +# + +ifeq ($(MAP), TRUE) +MAPCMD = $(OPTION_CC_GENMAP) +endif + + +################################################################################ +# +# rules for building a relocatable (i.e., partially linked) image +# +# The choice of relocatable image is controlled by the macro partialImage.o, +# which defaults to the main rule partialImage.o. + +version.o: $(VERSION_C) $(CFG_GEN_FILES) + $(CC) $(CFLAGS) $(OPTION_OBJECT_ONLY) $(VERSION_C) + +usrEntry.o: $(USR_ENTRY_C) + $(CC) $(CFLAGS) $(OPTION_OBJECT_ONLY) $(USR_ENTRY_C) + + +# for this prototype, we need to declare SRC_BUILD=TRUE to build from source. +# Automatic selection will be implemented when required information is available + +ifeq ($(SRC_BUILD), TRUE) +$(warning building vxWorks from source) + +COMP_OBJ_LIST = $(OPTION_PASS_TO_LD)$(OPTION_INDIRECT_FILE)$(PRJ_FULL_PATH)/compObjs.lst + +CC_LIB += $(CC_LIBINTRINSICS) + +partialImage.o: version.o usrEntry.o $(PRJ_FULL_PATH)/compObjs.lst src_build $(PRJ_OBJS_FILE) \ + $(PRJ_OBJS) + $(LD_PARTIAL) usrEntry.o $(PRJ_OBJS_FOR_LD_PARTIAL) $(COMP_OBJ_LIST) \ + $(EXTRA_MODULES) version.o $(LD_PARTIAL_START_GROUP) \ + $(COMPONENT_LIBS) $(LD_LINK_PATH) -L $(PRJ_FULL_PATH) $(COMP_LIBS) \ + $(LD_PARTIAL_END_GROUP) $(CC_LIB) -o $@ $(MAPCMD) + +else +partialImage.o: $(LDDEPS) $(PRJ_OBJS) $(EXTRA_MODULES) $(COMPONENT_LIBS) \ + $(patsubst -l%,lib%.a,$(COMP_LIBS)) \ + $(patsubst -l%,lib%.a,$(LIBS)) $(CC_LIB) $(PRJ_OBJS_FILE) version.o usrEntry.o + - @ $(RM) $@ +ifneq ($(findstring vxWorks_rom, $(DEFAULT_RULE)),) + $(LD_PARTIAL) usrEntry.o $(PRJ_OBJS_FOR_LD_PARTIAL) \ + $(EXTRA_MODULES) version.o $(LD_PARTIAL_START_GROUP) \ + $(COMPONENT_LIBS) $(LD_LINK_PATH) $(COMP_LIBS) $(LIBS) \ + $(LD_PARTIAL_END_GROUP) $(CC_LIB) -o $@ $(MAPCMD) +else + $(LD_PARTIAL) $(PRJ_OBJS_FOR_LD_PARTIAL) $(EXTRA_MODULES) \ + version.o $(LD_PARTIAL_START_GROUP) $(COMPONENT_LIBS) \ + $(LD_LINK_PATH) $(COMP_LIBS) $(LIBS) $(LD_PARTIAL_END_GROUP) $(CC_LIB) -o $@ $(MAPCMD) +endif +endif +ifeq ($(REMOVE_DEADWEIGHT),TRUE) + $(TRIM_TOOL) $@ $@_trim + $(MV) $@_trim $@ +endif + +################################################################################ +# +# rules for building modules to be linked with the relocatable VxWorks +# +# The choice of optional modules to link with the partialImage.o above +# is controlled by the macro POSTLINK_MODULES. +# Any .o's added here must not call any vxWorks libraries, as they are +# added *after* linking against the VxWorks libraries has been done. +# By default, POSTLINK_MODULES is computed by looking at config.h, +# If INCLUDE_CPLUS is defined, then ctdt.o is built. +# If INCLUDE_STANDALONE_SYM_TBL is defined, then symTbl.o is built. + +# ctdt.o - support module for INCLUDE_CPLUS + +ctdt.o: partialImage.o $(PRJ_OBJS_FILE) + - @ $(RM) $@ + $(NM) partialImage.o $(PRJ_OBJS_FOR_NM) | $(MUNCH) > ctdt.c + $(COMPILE_TRADITIONAL) ctdt.c -o $@ + +# symTbl.o - support module for INCLUDE_STANDALONE_SYM_TBL + +symTbl.o: partialImage.o + - @ $(RM) $@ + $(CP) partialImage.o tmp.o + $(LDOUT_SYMS) tmp.o + $(MKSYMTBL) tmp.o symTbl.c + - @ $(RM) tmp.o + $(COMPILE_SYMTBL) symTbl.c -o $@ + +############################################################################### +# +# rules for building rom startup code - slightly different for each image +# + +ROM_FLAGS_EXTRA = $(CC_ROM_FLAGS) +ifeq ($(basename $(DEFAULT_RULE)),vxWorks_romCompress) +ROM_FLAGS_EXTRA = $(CC_ROM_CMP_FLAGS) +endif +ifeq ($(basename $(DEFAULT_RULE)),vxWorks_romResident) +ROM_FLAGS_EXTRA = $(CC_ROM_RES_FLAGS) +endif +ifeq ($(basename $(DEFAULT_RULE)),vxWorks_rom) +ROM_FLAGS_EXTRA = $(CC_ROM_CPY_FLAGS) +endif + +############################################################################### +# +# dependency generation +# +CFLAGS += $(OPTION_DEPEND_GEN_D) +CFLAGS_AS += $(OPTION_DEPEND_GEN_D) + +################################################################################ +# +# rules for building VxWorks images +# + +# vxWorks RAM based VxWorks image, linked to RAM_LOW_ADRS + +vxWorks: partialImage.o $(ROMFS_IMAGE) $(POSTLINK_MODULES) + - @ $(RM) $@ + $(CC) $(CFLAGS) $(OPTION_OBJECT_ONLY) $(DATA_SEG_PAD_C) + $(LD) $(LDFLAGS) $(LD_ENTRY_OPT) $(SYS_ENTRY) $(LD_RAM_FLAGS) \ + dataSegPad.o $(ROMFS_IMAGE) partialImage.o $(POSTLINK_MODULES) \ + $(LD_DATA_SEG_ALIGN) $(LD_SCRIPT_RAM) -o $@ + $(LDOUT_CONV) $@ + $(VXSIZEPROG) -v $(RAM_HIGH_ADRS) $(RAM_LOW_ADRS) $@ +ifneq ($(ADJUST_VMA), $(DEFAULT_ADJUST_VMA)) + $(KERNEL_VMA_ADJUST) $@ +endif + $(MAKE_SYM) + $(MAKE_SYM_CVT) +ifeq (vxWorks, $(DEFAULT_RULE)) + $(POST_BUILD_RULE) +endif + + +# vxWorks_romResident ROM resident image + +vxWorks_romResident: partialImage.o $(ROMFS_IMAGE) $(POSTLINK_MODULES) \ + romInit.o romStart.o $(IMI) + - @ $(RM) $@ + $(CC) $(CFLAGS) $(OPTION_OBJECT_ONLY) $(DATA_SEG_PAD_C) + $(LD) $(LDFLAGS) $(RES_LDFLAGS) $(LD_ENTRY_OPT) $(SYS_ENTRY) \ + $(LD_ROM_RES_FLAGS) dataSegPad.o romInit.o romStart.o \ + partialImage.o $(ROMFS_IMAGE) $(POSTLINK_MODULES) \ + $(LD_SCRIPT_ROM) -o $@ + $(LDOUT_CONV) $@ + $(ROMSIZEPROG) -b $(ROM_SIZE) $@ + $(MAKE_SYM) + $(MAKE_SYM_CVT) + $(POST_BUILD_RULE) + +# vxWorks_rom RAM based image that starts in ROM. +# The relocation stub is linked to ROM_TEXT_ADRS and RAM_HIGH_ADRS. +# The main image is linked to RAM_LOW_ADRS. +# The relocation is done as a straight copy. + +ifeq ($(SRC_BUILD),TRUE) + +vxWorks_rom: vxWorks $(BOOT_OBJS) $(ROMFS_IMAGE) $(COMPONENT_LIBS) \ + $(PRJ_FULL_PATH)/compObjs.lst \ + $(IMI) version.o + - @ $(RM) $@ $<.o tmp.Z $<.Z.s $<.Z.o + $(CP) $< $<.o + $(LDOUT_HOST) $<.o + $(EXTRACT_BIN) $<.o tmp.Z + $(BINTOASM) tmp.Z > $<.Z.s + $(AR) cus $(PRJ_FULL_PATH)/libcomplist.a $(COMP_OBJ_LIST) + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS_AS) $<.Z.s -o $<.Z.o + $(LD) $(LDFLAGS) $(RES_LDFLAGS) $(LD_ENTRY_OPT) $(ROM_ENTRY) \ + $(LD_ROM_CPY_FLAGS) $(ROMFS_IMAGE) $(BOOT_OBJS) version.o \ + $(LD_START_GROUP) $(COMPONENT_LIBS) $(LD_LINK_PATH) -L$(PRJ_FULL_PATH) -lcomplist \ + $(LD_END_GROUP) $<.Z.o $(CC_LIB) \ + $(LD_SCRIPT_ROM) -o $@ + - @ $(RM) $<.o tmp.Z $<.Z.s $<.Z.o + $(ROMSIZEPROG) -b $(ROM_SIZE) $@ + $(LDOUT_CONV) $@ + $(POST_BUILD_RULE) +else +vxWorks_rom: vxWorks $(BOOT_OBJS) $(ROMFS_IMAGE) $(COMPONENT_LIBS) \ + $(patsubst -l%,lib%.a,$(COMP_LIBS)) \ + $(patsubst -l%,lib%.a,$(LIBS)) $(CC_LIB) $(IMI) version.o + - @ $(RM) $@ $<.o tmp.Z $<.Z.s $<.Z.o + $(CP) $< $<.o + $(LDOUT_HOST) $<.o + $(EXTRACT_BIN) $<.o tmp.Z + $(BINTOASM) tmp.Z > $<.Z.s + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS_AS) $<.Z.s -o $<.Z.o + $(LD) $(LDFLAGS) $(RES_LDFLAGS) $(LD_ENTRY_OPT) $(ROM_ENTRY) \ + $(LD_ROM_CPY_FLAGS) $(ROMFS_IMAGE) $(BOOT_OBJS) version.o \ + $(CC_LIB) $(LD_START_GROUP) $(COMPONENT_LIBS) $(LD_LINK_PATH) \ + $(COMP_LIBS) $(LIBS) $(LD_END_GROUP) $<.Z.o $(CC_LIB) \ + $(LD_SCRIPT_ROM) -o $@ + - @ $(RM) $<.o tmp.Z $<.Z.s $<.Z.o + $(ROMSIZEPROG) -b $(ROM_SIZE) $@ + $(LDOUT_CONV) $@ + $(POST_BUILD_RULE) +endif + +# vxWorks_romCompress RAM based image that starts in ROM. +# The relocation is done as a decompression. + +ifeq ($(SRC_BUILD),TRUE) + +vxWorks_romCompress: vxWorks $(BOOT_OBJS) $(ROMFS_IMAGE) $(COMPONENT_LIBS) \ + $(PRJ_FULL_PATH)/compObjs.lst \ + $(IMI) version.o + - @ $(RM) $@ $<.o tmp.Z $<.Z.s $<.Z.o + $(CP) $< $<.o + $(LDOUT_HOST) $<.o + $(EXTRACT_BIN) $<.o tmp.bin + $(COMPRESS) < tmp.bin > tmp.Z + $(BINTOASM) tmp.Z > $<.Z.s + $(AR) cus $(PRJ_FULL_PATH)/libcomplist.a $(COMP_OBJ_LIST) + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS_AS) $<.Z.s -o $<.Z.o + $(LD) $(LDFLAGS) $(RES_LDFLAGS) $(LD_ENTRY_OPT) $(ROM_ENTRY) \ + $(LD_ROM_CMP_FLAGS) $(BOOT_OBJS) $(ROMFS_IMAGE) version.o \ + $(LD_START_GROUP) $(COMPONENT_LIBS) $(LD_LINK_PATH) -L$(PRJ_FULL_PATH) -lcomplist \ + $(COMP_LIBS) $(LIBS) $(LD_END_GROUP) $(CC_LIB) $<.Z.o \ + $(LD_SCRIPT_ROM) -o $@ + $(LDOUT_CONV) $@ + - @ $(RM) $<.o tmp.bin tmp.Z $<.Z.s $<.Z.o + $(ROMSIZEPROG) -b $(ROM_SIZE) $@ + $(POST_BUILD_RULE) +else +vxWorks_romCompress: vxWorks $(BOOT_OBJS) $(ROMFS_IMAGE) $(COMPONENT_LIBS) \ + $(patsubst -l%,lib%.a,$(COMP_LIBS)) \ + $(patsubst -l%,lib%.a,$(LIBS)) $(CC_LIB) $(IMI) version.o + - @ $(RM) $@ $<.o tmp.Z $<.Z.s $<.Z.o + $(CP) $< $<.o + $(LDOUT_HOST) $<.o + $(EXTRACT_BIN) $<.o tmp.bin + $(COMPRESS) < tmp.bin > tmp.Z + $(BINTOASM) tmp.Z > $<.Z.s + $(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS_AS) $<.Z.s -o $<.Z.o + $(LD) $(LDFLAGS) $(RES_LDFLAGS) $(LD_ENTRY_OPT) $(ROM_ENTRY) \ + $(LD_ROM_CMP_FLAGS) $(BOOT_OBJS) $(ROMFS_IMAGE) version.o \ + $(LD_START_GROUP) $(COMPONENT_LIBS) $(LD_LINK_PATH) \ + $(COMP_LIBS) $(LIBS) $(LD_END_GROUP) $(CC_LIB) $<.Z.o \ + $(LD_SCRIPT_ROM) -o $@ + $(LDOUT_CONV) $@ + - @ $(RM) $<.o tmp.bin tmp.Z $<.Z.s $<.Z.o + $(ROMSIZEPROG) -b $(ROM_SIZE) $@ + $(POST_BUILD_RULE) +endif + +############################################################################### +# +# .sym - generate .sym file for INCLUDE_NET_SYM_TBL +# + +%.sym: % + $(BINXSYM) $< $@ + $(LDOUT_SYMS) $@ + +# do not attempt to regenerate .d dependency file. +%.d: + - @ : + +# make dependencies + +D_ALL_OBJS = version.o usrEntry.o $(PRJ_OBJS) $(EXTRA_OBJS) + +version.force_d : $(VERSION_C) + $(CC) $(CFLAGS) $(OPTION_DEPEND) $(CFLAGS_$(<:.c=.o)) $(OPTION_OBJECT_ONLY) $< >$(@:.force_d=.d) + +usrEntry.force_d: $(USR_ENTRY_C) + $(CC) $(CFLAGS) $(OPTION_DEPEND) $(CFLAGS_$(<:.c=.o)) $(OPTION_OBJECT_ONLY) $< >$(@:.force_d=.d) + +%.force_d : %.c + $(CC) $(CFLAGS) $(OPTION_DEPEND) $(CFLAGS_$(<:.c=.o)) $(OPTION_OBJECT_ONLY) $< >$(@:.force_d=.d) + +%.force_d : %.s + $(CC) $(CFLAGS_AS) $(OPTION_DEPEND) $(CFLAGS_AS_$(<:.s=.o)) $(OPTION_OBJECT_ONLY) $< >$(@:.force_d=.d) + +%.force_d : %.cpp + $(CXX) $(C++FLAGS) $(OPTION_DEPEND) $(CFLAGS_$(<:.cpp=.o)) $(OPTION_OBJECT_ONLY) $< >$(@:.force_d=.d) + +ifeq ($(SRC_BUILD),TRUE) +depend: $(CFG_GEN_FILES) src_depend $(filter %.force_d, $(D_ALL_OBJS:.o=.force_d)) +else +depend: $(CFG_GEN_FILES) $(filter %.force_d, $(D_ALL_OBJS:.o=.force_d)) +endif + - @ : + + + +############################################################################### +# +# Loading dependency files. +# + +EXISTING_OBJS = $(foreach obj, $(D_ALL_OBJS), $(wildcard $(obj))) + +DEP_FILES = $(filter %.d , $(EXISTING_OBJS:.o=.d)) + +EXISTING_DEP_FILES = $(foreach obj, $(DEP_FILES), $(wildcard $(obj))) + +MISSING_DEP = $(filter-out $(EXISTING_DEP_FILES), $(DEP_FILES)) + +ifneq ($(strip $(MISSING_DEP)),) +$(warning warning: missing dependency files $(MISSING_DEP)) +$(warning run make depend to regenerate) +endif + +ifneq ($(strip $(EXISTING_DEP_FILES)),) +include $(EXISTING_DEP_FILES) +endif + diff --git a/h/make/rules.x86-freebsd b/h/make/rules.x86-freebsd new file mode 100644 index 0000000..73b1a7b --- /dev/null +++ b/h/make/rules.x86-freebsd @@ -0,0 +1,10 @@ +# rules.x86-freebsd - host specific rules +# +# modification history +# -------------------- +# 01a,12dec99,dra created +# +# DESCRIPTION +# This file contains rules that are host specific to x86-freebsd platform. + +include $(TGT_DIR)/h/make/rules.unix diff --git a/h/make/rules.x86-linux2 b/h/make/rules.x86-linux2 new file mode 100644 index 0000000..4b59f68 --- /dev/null +++ b/h/make/rules.x86-linux2 @@ -0,0 +1,162 @@ +# rules.unix - host specific rules +# +# Copyright 1984-2004, Wind River Systems, Inc. +# +# modification history +# -------------------- +# 02v,17may05,lll Replaced malfunctioning "\n"'s with echo "" +# 02u,25apr05,kkz Updating for new doc path +# 02t,10jan05,lll Standalone apigen, SPR#105634 and SPR#104090 +# 02s,06oct04,tpw Switch BSP doc build forward to apigen. +# 02r,10aug04,dgp temporarily revert BSP doc build back to refgen +# 02q,07jul04,c_c Removed usage of romfs_image.h. +# 02p,27may04,dgp update BSP output and TOC directories +# 02o,25may04,tpw Switch on -missingok to reduce doc build error output. +# 02n,11feb04,c_c Added a NODEPENDOBJS list to filter files that should not +# be parsed when generating dependencies (SPR 93380). +# 02m,12jan04,bjl changed refgen to apigen. +# 02l,10dec03,c_c fixed builds for BSP templates. +# 02k,28nov03,c_c Reinstated variable replacement. +# 02j,26nov03,c_c Fixed Linux simulator build. +# 02i,07nov03,c_c Unified build rules with WIN32 hosts. +# 02h,02jul03,md Added command (mkromfs) for building ROMFS image +# 02g,12mar02,wsl change BSP_Reference to VxWorks_BSP_Reference +# 02f,27nov01,wsl allow target.ref files but keep target.nr backward +# compatibility +# 02e,29oct01,jab removed ld script rules +# 02d,25oct01,dat more gnu-diab changes +# 02c,18oct01,jab made dependency generation toolchain independent +# 02b,01oct01,dat consistent use of BSP_NAME macro +# 02a,27aug01,wsl add man pages +# 01z,24jul01,r_s diab specific rules added +# 01y,28jun00,jab force creation of LECFs. +# 01x,17feb00,jab added LECF generation rules. See notes at rules. +# 01w,02feb99,sjw use -M -MG in dependency generation so generated files +# can be included in BSP files. +# 01v,26oct98,ms made dependency generation overridable from make.CPUTOOL +# 01u,15oct98,fle doc : renamed book for BSP and put boards reference into +# board library +# 01t,05oct98,ms remove romInit.s dependeny generation for simulators +# 01s,23sep98,fle doc : adapted -preproc refgen new option +# 01r,23sep98,fle doc : changed bsp book name +# 01r,22sep98,fle doc : now use refgen instead of mangen +# 01q,02jan97,dat added DOC_FLAGS +# 01p,21nov96,p_m removed unwanted @ in bsp.1 rule +# 01o,21nov96,p_m changed bsp.1 mode prior to copy target.nr +# 01n,19nov96,dat mangen error output not dropped. target.txt made in +# bsp directory. SPRs 7507 and 7508. +# 01m,15oct96,yp made rule for include of dependency list silent SPR 4483 +# 01l,03oct96,dbt added backslashes in the sed expressions (HPUX10 port). +# 01k,30jul96,pad undo change 01j, introduced here by mistake. +# 01j,26jul96,pad backslashed the $ in the sed expressions (AIX port). +# 01i,10may96,dat added -DINCLUDE_SCSI for man pages (SPR3941) added copyright +# 01h,18mar96,dat fixed cpp command for building man pages +# 01g,06mar96,dat added sed command to insert $TGT_DIR into depend output +# 01f,08feb96,dat used CONFIG_ALL in making dependency list +# 01e,04nov95,p_m took care of missing files in docs rule +# 01d,06jul95,jcf made sed script global. +# 01c,21jun95,yp added sed script to prevent hardwiring depend. list. +# 01b,10jun95,yp changed TARGET_DIR to BSP_NAME +# 01a,01jun95,yp created +# +# DESCRIPTION +# This file contains rules that are host specific to the unix platform. + +## documentation build targets + +DOC_FILES := $(filter $(DOC_FILES),$(patsubst %.c,%,$(wildcard *.c))) + +.PHONY: $(DOC_FILES) htmllink + +man : target.html docs + +docs: $(DOC_FILES) htmllink + +$(DOC_FILES): + @echo ""; echo "Processing $@.c ... " + @-$(CPP) $(CASFLAGS) $(OPTION_PP_COMMENT) $(DOC_FLAGS) $@.c 1> $@.i + -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen -mg -nostrict \ + -book VxWorks_APIs -chapter BSP_APIs \ + -category $(BSP_NAME) -missingok \ + -out $(DOC_DIR)/$(BSP_NAME) $@.i + -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen -mg -nostrict \ + -book VxWorks_APIs -chapter BSP_APIs \ + -category $(BSP_NAME) -missingok -config Auto2txt \ + -out $(MAN_PAGE_DIR)/$(BSP_NAME) $@.i + @-$(RM) $@.i + +htmllink: + @echo ""; echo "HTML linking ... " + -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/htmlLink \ + $(DOC_DIR)/$(BSP_NAME) + @echo "Linking complete." + @date + + +# The following variable assignment selects target.ref over target.nr, and +# exists only to facilitate the transition from nroff markup to refgen +# markup. When target.nr joins its dinosaur brethren, this should be removed. + +TARGET_REF = target.ref +ifeq (,$(wildcard target.ref)) + TARGET_REF = target.nr +endif + +target.html: + @echo ""; echo "Processing $(TARGET_REF) ... " + -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen -mg -nostrict \ + -config bsp2html -book VxWorks_APIs -chapter BSP_APIs -missingok \ + -out $(DOC_DIR)/$(BSP_NAME) $(TARGET_REF) + -$(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin/apigen -mg -nostrict \ + -config bsp2txt -book VxWorks_APIs -chapter BSP_APIs -missingok \ + -out $(MAN_PAGE_DIR)/$(BSP_NAME) $(TARGET_REF) + + +# +# It is possible to generate dependency lists automatically by depending on +# a make include file: +# +# with: GNU make, SunOS 4.x/5.x make. +# but not with: clearmake, HPUX 9.x make, and probably plenty of others. +# +# If depend.$(BSP_NAME) has been removed and you are haplessly without +# a copy of GNU make: +# +# % # In the BSP in question... +# % touch depend.$(BSP_NAME) +# % make depend.$(BSP_NAME) +# % make +# +# Order in the Universe should be restored. +# + +depend.$(BSP_NAME) : + - $(CC) $(OPTION_DEPEND_C) $(CFLAGS) $(filter-out $(NODEPENDOBJS),$(wildcard *.[c] $(CONFIG_ALL)/*.[c])) > $@ +# The two files below may not be present for simulators. So ignore the error +# returned by the compiler if the file does not exist. + +ifneq ($(wildcard romInit.s),) + $(CPP) $(OPTION_DEPEND_AS) $(CASFLAGS) romInit.s >> $@ +endif +ifneq ($(wildcard sysALib.s),) + $(CPP) $(OPTION_DEPEND_AS) $(CASFLAGS) sysALib.s >> $@ +endif + +# Post process the dependencies to substitute WIND variables + + - @ $(BSP_PROCESS_DEP) + +# XXX generic rule for assembly files forthcoming + +ifneq ($(IS_PRJ),TRUE) + +BSP2PRJ=FALSE +ifeq ($(BSP2PRJ),FALSE) +ifneq ($(MAKECMDGOALS),clean) +-include depend.$(BSP_NAME) +endif +endif + +endif + + diff --git a/h/make/rules.x86-win32 b/h/make/rules.x86-win32 new file mode 100644 index 0000000..fcb243c --- /dev/null +++ b/h/make/rules.x86-win32 @@ -0,0 +1,12 @@ +# rules.x86-win32 - Host specific default definitions +# +# Copyright 1984-2003, Wind River Systems, Inc. +# +# modification history +# -------------------- +# 02a,24sep03,c_c now use unix defaults +# +# DESCRIPTION +# This file contains rules that are host specific to x86-in32 platform. + +include $(TGT_DIR)/h/make/rules.unix diff --git a/h/math.h b/h/math.h new file mode 100644 index 0000000..689b580 --- /dev/null +++ b/h/math.h @@ -0,0 +1,229 @@ +/* math.h - math routines */ + +/* Copyright 1989-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01o,08jul96,ms fixed prototype for fmodf (SPR 6856) +01n,29mar95,kdl added prototype for __fixunssfsi() (gcc callout routine). +01m,15oct92,rrr silenced warnings +01l,22sep92,rrr added support for c++ +01k,19sep92,kdl added prototypes for gccMathInit, gccUssInit, gccUss040Init. +01j,30jul92,kdl changed to ANSI single precision names (e.g. fsin -> sinf); + merged various architectures; fixed 01i mod history. +01i,08jul92,smb merged with ANSI math.h +01h,04jul92,jcf cleaned up. +01g,26may92,rrr the tree shuffle +01f,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01e,16jul91,ajm added MIPS specific externs, and made MIPS unsupported + functions 68k dependent +01d,28jan91,kdl added single-precision, cbrt(), hypot(); changed def's of + irint() and iround() to int; changed def of sincos() to void. +01c,19oct90,elr ANSI cleaned up +01b,05oct90,dnw deleted private routines. +01a,23aug90,elr written. +*/ + +#ifndef __INCmathh +#define __INCmathh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types/vxANSI.h" + +/* ANSI-compatible definitions */ + +#define HUGE_VAL _ARCH_HUGH_VAL + + +#if defined(__STDC__) || defined(__cplusplus) + +/* ANSI-compatible functions */ + +extern double acos (double x); +extern double asin (double x); +extern double atan (double x); +extern double atan2 (double y, double x); +extern double ceil (double x); +extern double cos (double x); +extern double cosh (double x); +extern double exp (double x); +extern double fabs (double x); +extern double floor (double x); +extern double fmod (double x, double y); +extern double frexp (double x, int *exponent); +extern double ldexp (double x, int __exp); +extern double log (double x); +extern double log10 (double x); +extern double modf (double x, double *pIntResult); +extern double pow (double x, double y); +extern double sin (double x); +extern double sinh (double x); +extern double sqrt (double x); +extern double tan (double x); +extern double tanh (double x); + + + +/* Single-precision versions of ANSI functions * + * Not available on all VxWorks architectures. */ + +extern float acosf (float x); +extern float asinf (float x); +extern float atanf (float x); +extern float atan2f (float x, float y); +extern float ceilf (float x); +extern float cosf (float x); +extern float coshf (float x); +extern float expf (float x); +extern float fabsf (float x); +extern float floorf (float x); +extern float fmodf (float x, float y); +extern float logf (float x); +extern float log10f (float x); +extern float powf (float x, float y); +extern float sinf (float x); +extern float sinhf (float x); +extern float sqrtf (float x); +extern float tanf (float x); +extern float tanhf (float x); + + +/* Miscellaneous math functions * + * Not available on all VxWorks architectures. */ + + +extern double cbrt (double x); +extern double hypot (double x, double y); +extern double infinity (void); +extern int irint (double x); +extern int iround (double x); +extern double log2 (double x); +extern double rint (double x); +extern double round (double x); +extern void sincos (double x, double *pSinResult, double *pCosResult); +extern double trunc (double x); + +extern float cbrtf (float x); +extern float hypotf (float x, float y); +extern float infinityf (void); +extern int irintf (float x); +extern int iroundf (float x); +extern float log2f (float x); +extern float roundf (float x); +extern void sincosf (float x, float *pSinResult, float *pCosResult); +extern float truncf (float x); + + +/* VxWorks math library calls */ + +extern void floatInit (void); +extern void mathHardInit (void); +extern void mathSoftInit (void); +extern void gccMathInit (void); +extern void gccUssInit (void); +extern void gccUss040Init (void); +extern unsigned __fixunssfsi (long a); + +#else /* !__STDC__ */ + +/* ANSI-compatible functions */ + +extern double acos (); +extern double asin (); +extern double atan (); +extern double atan2 (); +extern double ceil (); +extern double cos (); +extern double cosh (); +extern double exp (); +extern double fabs (); +extern double floor (); +extern double fmod (); +extern double frexp (); +extern double ldexp (); +extern double log (); +extern double log10 (); +extern double modf (); +extern double pow (); +extern double sin (); +extern double sinh (); +extern double sqrt (); +extern double tan (); +extern double tanh (); + + + +/* Single-precision versions of ANSI functions * + * Not available on all VxWorks architectures. */ + +extern float acosf (); +extern float asinf (); +extern float atanf (); +extern float atan2f (); +extern float ceilf (); +extern float cosf (); +extern float coshf (); +extern float expf (); +extern float fabsf (); +extern float floorf (); +extern float fmodf (); +extern float logf (); +extern float log10f (); +extern float powf (); +extern float sinf (); +extern float sinhf (); +extern float sqrtf (); +extern float tanf (); +extern float tanhf (); + + +/* Miscellaneous math functions * + * Not available on all VxWorks architectures. */ + + +extern double cbrt (); +extern double hypot (); +extern double infinity (); +extern int irint (); +extern int iround (); +extern double log2 (); +extern double rint (); +extern double round (); +extern void sincos (); +extern double trunc (); + +extern float cbrtf (); +extern float hypotf (); +extern float infinityf (); +extern int irintf (); +extern int iroundf (); +extern float log2f (); +extern float roundf (); +extern void sincosf (); +extern float truncf (); + + +/* VxWorks math library calls */ + +extern void floatInit (); +extern void mathHardInit (); +extern void mathSoftInit (); +extern void gccMathInit (); +extern void gccUssInit (); +extern void gccUss040Init (); +extern unsigned __fixunssfsi(); + + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmathh */ diff --git a/h/mbufLib.h b/h/mbufLib.h new file mode 100644 index 0000000..54d9227 --- /dev/null +++ b/h/mbufLib.h @@ -0,0 +1,173 @@ +/* mbufLib.h - mbuf interface library header */ + +/* Copyright 1984-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,13mar95,dzb added MBUF_VALID, and changed macros to use (SPR #4066). +01a,08nov94,dzb written. +*/ + +#ifndef __INCmbufLibh +#define __INCmbufLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vwModNum.h" +#include "intLib.h" +#include "limits.h" +#include "net/mbuf.h" + +/* typedefs */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* definition of mbuf ID */ + +typedef struct mbufId /* MBUF_ID */ + { + union + { + struct mbuf * head; /* head of mbuf chain */ + struct mbufId * idNext; /* next ID in free chain */ + } uId; + + u_char type; /* mbuf ID type */ + } *MBUF_ID; + +/* definition of mbuf desc */ + +typedef struct mbufDesc /* MBUF_DESC */ + { + caddr_t buf; /* user buffer address */ + union + { + u_char refCnt; /* share counter */ + struct mbufDesc * descNext; /* next desc in free chain */ + } uDesc; + } *MBUF_DESC; + +typedef struct mbuf * MBUF_SEG; + +extern struct mbufId * _mbufIdHead; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* defines */ + +#define mbufHead uId.head +#define mbufIdNext uId.idNext +#define mbufRefCnt uDesc.refCnt +#define mbufDescNext uDesc.descNext + +/* status codes */ + +#define S_mbufLib_ID_INVALID (M_mbufLib | 1) +#define S_mbufLib_ID_EMPTY (M_mbufLib | 2) +#define S_mbufLib_SEGMENT_NOT_FOUND (M_mbufLib | 3) +#define S_mbufLib_LENGTH_INVALID (M_mbufLib | 4) +#define S_mbufLib_OFFSET_INVALID (M_mbufLib | 5) + +#define MBUF_ID_INC 50 /* increment for ID alloc */ +#define MBUF_DESC_INC 50 /* increment for desc alloc */ +#define MBUF_BEGIN ZBUF_BEGIN /* start of chain */ +#define MBUF_END ZBUF_END /* end of chain */ +#define MBUF_NONE ((MBUF_SEG) NONE) /* cut past chain */ +#define MBUF_VALID 0x5e /* validate off magic number */ + +#define MBUF_ID_CREATE(mbufId) \ + { \ + int lockKey = intLock (); \ + if ((mbufId = _mbufIdHead) != NULL) \ + { \ + _mbufIdHead = mbufId->mbufIdNext; \ + intUnlock (lockKey); \ + mbufId->type = MBUF_VALID; \ + mbufId->mbufHead = NULL; \ + } \ + else \ + { \ + intUnlock (lockKey); \ + mbufId = _mbufCreate (); \ + } \ + } + +#define MBUF_ID_DELETE_EMPTY(mbufId) \ + { \ + int lockKey; \ + mbufId->type = MT_FREE; \ + lockKey = intLock (); \ + mbufId->mbufIdNext = _mbufIdHead; \ + _mbufIdHead = mbufId; \ + intUnlock (lockKey); \ + } + +#define MBUF_ID_DELETE(mbufId) \ + { \ + if (mbufId->mbufHead != NULL) \ + m_freem (mbufId->mbufHead); \ + MBUF_ID_DELETE_EMPTY(mbufId); \ + } + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void * _mbufLibInit (void); +extern MBUF_ID _mbufCreate (void); +extern STATUS _mbufDelete (MBUF_ID mbufId); +extern MBUF_SEG _mbufInsert (MBUF_ID mbufId1, MBUF_SEG mbufSeg, int offset, + MBUF_ID mbufId2); +extern MBUF_SEG _mbufInsertBuf (MBUF_ID mbufId, MBUF_SEG mbufSeg, int offset, + caddr_t buf, int len, VOIDFUNCPTR freeRtn, int freeArg); +extern MBUF_SEG _mbufInsertCopy (MBUF_ID mbufId, MBUF_SEG mbufSeg, + int offset, caddr_t buf, int len); +extern int _mbufExtractCopy (MBUF_ID mbufId, MBUF_SEG mbufSeg, + int offset, caddr_t buf, int len); +extern MBUF_SEG _mbufCut (MBUF_ID mbufId, MBUF_SEG mbufSeg, int offset, + int len); +extern MBUF_ID _mbufSplit (MBUF_ID mbufId, MBUF_SEG mbufSeg, int offset); +extern MBUF_ID _mbufDup (MBUF_ID mbufId, MBUF_SEG mbufSeg, int offset, + int len); +extern int _mbufLength (MBUF_ID mbufId); +extern MBUF_SEG _mbufSegFind (MBUF_ID mbufId, MBUF_SEG mbufSeg, int *pOffset); +extern MBUF_SEG _mbufSegNext (MBUF_ID mbufId, MBUF_SEG mbufSeg); +extern MBUF_SEG _mbufSegPrev (MBUF_ID mbufId, MBUF_SEG mbufSeg); +extern caddr_t _mbufSegData (MBUF_ID mbufId, MBUF_SEG mbufSeg); +extern int _mbufSegLength (MBUF_ID mbufId, MBUF_SEG mbufSeg); + +#else /* __STDC__ */ + +extern void * _mbufLibInit (); +extern MBUF_ID _mbufCreate (); +extern STATUS _mbufDelete (); +extern MBUF_SEG _mbufInsert (); +extern MBUF_SEG _mbufInsertBuf (); +extern MBUF_SEG _mbufInsertCopy (); +extern int _mbufExtractCopy (); +extern MBUF_SEG _mbufCut (); +extern MBUF_ID _mbufSplit (); +extern MBUF_ID _mbufDup (); +extern int _mbufLength (); +extern MBUF_SEG _mbufSegFind (); +extern MBUF_SEG _mbufSegNext (); +extern MBUF_SEG _mbufSegPrev (); +extern caddr_t _mbufSegData (); +extern int _mbufSegLength (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmbufLibh */ diff --git a/h/mbufSockLib.h b/h/mbufSockLib.h new file mode 100644 index 0000000..3c1992e --- /dev/null +++ b/h/mbufSockLib.h @@ -0,0 +1,55 @@ +/* mbufSockLib.h - mbuf socket interface library header */ + +/* Copyright 1984-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,08nov94,dzb written. +*/ + +#ifndef __INCmbufSockLibh +#define __INCmbufSockLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "mbufLib.h" + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void * _mbufSockLibInit (void); +extern int _mbufSockSend (int s, MBUF_ID mbufId, int mbufLen, int flags); +extern int _mbufSockSendto (int s, MBUF_ID mbufId, int mbufLen, int flags, + struct sockaddr *to, int tolen); +extern int _mbufSockBufSend (int s, char *buf, int bufLen, + VOIDFUNCPTR freeRtn, int freeArg, int flags); +extern int _mbufSockBufSendto (int s, char *buf, int bufLen, + VOIDFUNCPTR freeRtn, int freeArg, int flags, + struct sockaddr *to, int tolen); +extern MBUF_ID _mbufSockRecv (int s, int flags, int *pLen); +extern MBUF_ID _mbufSockRecvfrom (int s, int flags, int *pLen, + struct sockaddr *from, int *pFromLen); + +#else /* __STDC__ */ + +extern void * _mbufSockLibInit (); +extern int _mbufSockSend (); +extern int _mbufSockSendto (); +extern int _mbufSockBufSend (); +extern int _mbufSockBufSendto (); +extern MBUF_ID _mbufSockRecv (); +extern MBUF_ID _mbufSockRecvfrom (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmbufSockLibh */ diff --git a/h/memDrv.h b/h/memDrv.h new file mode 100644 index 0000000..ad311df --- /dev/null +++ b/h/memDrv.h @@ -0,0 +1,60 @@ +/* memDrv.h - header file for memDrv.c */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,13aug98,rlp added memDevDelete function. +01e,22sep92,rrr added support for c++ +01d,04jul92,jcf cleaned up. +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01a,05oct90,shl created. +*/ + +#ifndef __INCmemDrvh +#define __INCmemDrvh + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef struct mem_drv_direntry + { + char * name; /* Name of this entry: relative to + containing directory, or mount point */ + char * base; /* Start address, if a file */ + struct mem_drv_direntry *pDir; + /* files contained within, if a directory */ + int length; /* Length in bytes, if a file; + number of files, if a directory */ + } MEM_DRV_DIRENTRY; + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS memDrv (void); +extern STATUS memDevCreate (char *name, char *base, int length); +extern STATUS memDevCreateDir (char * name, MEM_DRV_DIRENTRY * files, int numFiles); +extern STATUS memDevDelete (char *name); + +#else + +extern STATUS memDrv (); +extern STATUS memDevCreate (); +extern STATUS memDevCreateDir (); +extern STATUS memDevDelete (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmemDrvh */ diff --git a/h/memLib.h b/h/memLib.h new file mode 100644 index 0000000..964b2cb --- /dev/null +++ b/h/memLib.h @@ -0,0 +1,189 @@ +/* memLib.h - memory management library header file */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01d,26sep05,zl added ED&R error handling flags (SPR#112822). +01c,05may04,zl changed memAddToPool(), memOptionsSet()/Get() to return status. +03u,27jun03,tam switch to VxWorks AE heap allocator: added a few errno, added + 'maxBytesAlloc' to MEM_PART_STATS struct, added + memPartOptionsGet(), memPartInit() returns STATUS instead of + void. +03t,14mar03,dcc moved PART_ID definition to types/vxWind.h +03s,19aug96,dbt added memPartAlignedAlloc prototype (fixed SPR #6898). +03r,30oct94,kdl merge cleanup - removed extra "#ifndef _ASMLANGUAGE". +03o,15oct93,cd added #ifndef _ASMLANGUAGE. +03q,27oct94,ism Fixed assembly problem from merge +03p,01dec93,jag added struct MEM_PART_STATS and function memPartInfoGet. +03o,02apr93,edm ifdef'd out non-ASMLANGUAGE portions +03n,05feb93,smb added include of vxWorks.h +03m,22sep92,rrr added support for c++ +03l,19jul92,pme added external declarations for sm partition functions. +03k,13jul92,rdc added prototype for valloc. +03j,04jul92,jcf cleaned up. +03i,22jun92,rdc added memalign and memPartAlignedAlloc. +03h,26may92,rrr the tree shuffle +03g,25mar92,jmm added new options for error handling +03f,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +03e,10jun91.del added pragma for gnu960 alignment. +03d,05oct90,dnw deleted private routines. +03c,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +03b,10aug90,dnw added declaration of memPartInit(). +03a,18jul90,jcf made partitions objects. + changed malloc(),realloc(),calloc() etc to return void *. +02c,17mar90,jcf added structure type definition. +02b,28jun89,llk added declaration for free(); +02a,11jun88,dnw changed for rev 03a of memLib. +01l,28mar88,gae added function decl. of calloc(). +01j,13nov87,gae removed FRAGMENT definition; made function decl.'s IMPORTs. +01h,23oct87,rdc added PARTITION defenitions. +01g,24dec86,gae changed stsLib.h to vwModNum.h. +01f,21may86,rdc added forward declarations for malloc and realloc. + added FRAGMENT structure. +01e,13aug84,ecs changed S_memLib_NO_MORE_MEMORY to S_memLib_NOT_ENOUGH_MEMORY. +01d,07aug84,ecs added include of stsLib.h, and status codes. +01c,15jun84,dnw removed declaration of memEnd (no longer exists). +01b,27jan84,ecs added inclusion test. +01a,24may83,dnw written +*/ + +#ifndef __INCmemLibh +#define __INCmemLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* status codes */ + +#define S_memLib_NOT_ENOUGH_MEMORY (M_memLib | 1) +#define S_memLib_INVALID_NBYTES (M_memLib | 2) +#define S_memLib_BLOCK_ERROR (M_memLib | 3) +#define S_memLib_NO_PARTITION_DESTROY (M_memLib | 4) +#define S_memLib_PAGE_SIZE_UNAVAILABLE (M_memLib | 5) +#define S_memLib_WRONG_PART_ID (M_memLib | 6) +#define S_memLib_INVALID_ADDRESS (M_memLib | 7) +#define S_memLib_INVALID_ALIGNMENT (M_memLib | 8) +#define S_memLib_FUNC_NOT_AVAILABLE (M_memLib | 9) + +/* types */ + +#ifndef _ASMLANGUAGE + +/* Partition statistics structure */ + +typedef struct + { + unsigned long numBytesFree, /* Number of Free Bytes in Partition */ + numBlocksFree, /* Number of Free Blocks in Partition */ + maxBlockSizeFree,/* Maximum block size that is free. */ + numBytesAlloc, /* Number of Allocated Bytes in Partition */ + numBlocksAlloc, /* Number of Allocated Blocks in Partition */ + maxBytesAlloc; /* Maximum number of Allocated Bytes at any*/ + /* time */ + + } MEM_PART_STATS; +#endif /* ~ _ASMLANGUAGE */ + +/* partition options */ + +/* optional check for bad blocks */ + +#define MEM_BLOCK_CHECK 0x10 + +/* response to errors when allocating memory */ + +#define MEM_ALLOC_ERROR_EDR_WARN_FLAG 0x200 +#define MEM_ALLOC_ERROR_EDR_FATAL_FLAG 0x400 +#define MEM_ALLOC_ERROR_LOG_FLAG 0x20 +#define MEM_ALLOC_ERROR_SUSPEND_FLAG 0x40 /* deprecated */ + +/* response to errors when freeing memory */ + +#define MEM_BLOCK_ERROR_EDR_WARN_FLAG 0x800 +#define MEM_BLOCK_ERROR_EDR_FATAL_FLAG 0x1000 +#define MEM_BLOCK_ERROR_LOG_FLAG 0x80 +#define MEM_BLOCK_ERROR_SUSPEND_FLAG 0x100 /* deprecated */ + +/* old style allocation errors - block too big, insufficient space */ + +#define MEM_ALLOC_ERROR_MASK 0x03 /* deprecated */ +#define MEM_ALLOC_ERROR_RETURN 0 /* deprecated */ +#define MEM_ALLOC_ERROR_LOG_MSG 0x01 /* deprecated */ +#define MEM_ALLOC_ERROR_LOG_AND_SUSPEND 0x02 /* deprecated */ + +/* old style bad block found */ + +#define MEM_BLOCK_ERROR_MASK 0x0c /* deprecated */ +#define MEM_BLOCK_ERROR_RETURN 0 /* deprecated */ +#define MEM_BLOCK_ERROR_LOG_MSG 0x04 /* deprecated */ +#define MEM_BLOCK_ERROR_LOG_AND_SUSPEND 0x08 /* deprecated */ + + +#ifndef _ASMLANGUAGE + +/* variable declarations */ + +/* system partition */ + +extern PART_ID memSysPartId; + +/* shared memory manager function pointers */ + +extern FUNCPTR smMemPartOptionsSetRtn; +extern FUNCPTR smMemPartFindMaxRtn; +extern FUNCPTR smMemPartReallocRtn; +extern FUNCPTR smMemPartShowRtn; + +/* function declarations */ + +extern STATUS memInit (char *pPool, unsigned poolSize); +extern STATUS memPartLibInit (char *pPool, unsigned poolSize); +extern PART_ID memPartCreate (char *pPool, unsigned poolSize); +extern STATUS memPartDelete (PART_ID partId); +extern STATUS memPartInit (PART_ID partId, char *pPool, unsigned poolSize); +extern STATUS memPartAddToPool (PART_ID partId, char *pPool, + unsigned poolSize); +extern STATUS memAddToPool (char *pPool, unsigned poolSize); +extern void * memPartAlloc (PART_ID partId, unsigned nBytes); +extern void * memPartAlignedAlloc (PART_ID partId, unsigned nBytes, + unsigned alignment); +extern void * memalign (unsigned alignment, unsigned size); +extern void * valloc (unsigned size); +extern STATUS memPartFree (PART_ID partId, char *pBlock); +extern STATUS memPartOptionsSet (PART_ID partId, unsigned options); +extern STATUS memPartOptionsGet (PART_ID partId, UINT * pOptions); +extern int memFindMax (void); +extern int memPartFindMax (PART_ID partId); +extern void * memPartRealloc (PART_ID partId, char *pBlock, unsigned nBytes); +extern STATUS memOptionsGet (UINT * pOptions); +extern STATUS memOptionsSet (unsigned options); +extern STATUS cfree (char *pBlock); +extern void memShowInit (void); +extern STATUS memShow (int type); +extern STATUS memPartShow (PART_ID partId, int type); +extern STATUS memPartInfoGet (PART_ID partId, MEM_PART_STATS * ppartStats); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmemLibh */ diff --git a/h/memLogLib.h b/h/memLogLib.h new file mode 100644 index 0000000..5dfd64c --- /dev/null +++ b/h/memLogLib.h @@ -0,0 +1,118 @@ +/* memLogLib - memLogLib header file */ + +/* Copyright (c) 2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01d,09sep03,aim added iterators; reworked memLogWalk +01c,29aug03,dbs update after review comments +01b,14aug03,aim code cleanup; documentation tweaks +01a,16jun03,aim created +*/ + +#ifndef __INCmemLogLib_h +#define __INCmemLogLib_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + +/* + * Traversal directions for memLogWalk(). + */ + +typedef enum mem_log_walk_type + { + MEM_LOG_WALK_OLDEST_YOUNGEST = 1, + MEM_LOG_WALK_YOUNGEST_OLDEST + } MEM_LOG_WALK_TYPE; + +typedef struct mem_log_node_marker + { + UINT32 id [2]; /* inter node marker */ + } MEM_LOG_NODE_MARKER; + +typedef struct mem_log_node_header + { + int offset; /* offset of this node */ + int size; /* total size of this node */ + int next; /* offset of next node */ + int prev; /* offset of prev node */ + } MEM_LOG_NODE_HEADER; + +typedef struct mem_log_node_payload + { + int length; /* length of data */ + char data [1]; /* data block */ + } MEM_LOG_NODE_PAYLOAD; + +typedef struct mem_log_node /* Node of a linked list. */ + { + MEM_LOG_NODE_MARKER marker; /* node marker */ + MEM_LOG_NODE_HEADER header; /* node header */ + UINT32 checksum; /* checksum for node header */ + MEM_LOG_NODE_PAYLOAD payload; /* payload; must be the last entry */ + } MEM_LOG_NODE; + +typedef struct mem_log_node_list /* Header for a linked list. */ + { + int count; /* node list count */ + MEM_LOG_NODE sentinel; /* sentinel node */ + } MEM_LOG_NODE_LIST; + +typedef struct mem_log_hdr /* Header for a memory log. */ + { + int endianness; /* endianness identifier */ + int magic; /* mem log identifier */ + int version; /* mem log version number */ + int size; /* mem log size (in bytes) */ + UINT32 reserved [4]; /* reserved for future use */ + } MEM_LOG_HEADER; + +typedef struct mem_log /* A memory log. */ + { + MEM_LOG_HEADER header; /* memory log meta-data */ + UINT32 checksum; /* header checksum */ + UINT32 reserved [4]; /* reserved for future use */ + MEM_LOG_NODE_LIST node_list; /* the list of nodes */ + MEM_LOG_NODE node_space [1]; /* node_list arena */ + } MEM_LOG; + +typedef struct mem_log_iter /* An iterator. */ + { + MEM_LOG * pLog; /* pointer to log to iterate */ + MEM_LOG_WALK_TYPE direction; /* direction to iterate */ + MEM_LOG_NODE * pNil; /* pointer to list head */ + MEM_LOG_NODE * pNode; /* pointer to current node */ + int nodeCount; /* total number of nodes in log */ + int nodeNumber; /* current node number; 1/nodeCount */ + } MEM_LOG_ITER; + + +/* function prototypes */ + +extern int memLogWalk (MEM_LOG * pLog, FUNCPTR callback, + MEM_LOG_WALK_TYPE direction, void * callback_arg); +extern STATUS memLogAdd (MEM_LOG * pLog, const void * pData, int len); +extern STATUS memLogDelete (MEM_LOG * pLog); +extern MEM_LOG * memLogAttach (void * pAddr, int size); +extern MEM_LOG * memLogCreate (void * pAddr, int size); +extern int memLogNodeCount (MEM_LOG * pLog); +extern int memLogSize (MEM_LOG * pLog); +extern int memLogMinimumSize (void); +extern STATUS memLogDeleteAll (MEM_LOG * pLog); +extern BOOL memLogValidate (MEM_LOG * pLog); +extern BOOL memLogIterNext (MEM_LOG_ITER * pIter, + MEM_LOG_NODE_PAYLOAD ** ppPayload); +extern BOOL memLogIterCreate (MEM_LOG * pLog, MEM_LOG_ITER * pIter, + MEM_LOG_WALK_TYPE direction); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCmemLogLib_h */ diff --git a/h/memPartLib.h b/h/memPartLib.h new file mode 100644 index 0000000..5d3db9f --- /dev/null +++ b/h/memPartLib.h @@ -0,0 +1,23 @@ +/* memPartLib.h - memory partition management library header file */ + +/* Copyright 2001 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01a,25sep01,tam created from AE 1.1 memPartLib.h. +*/ + +#ifndef __INCmemPartLibh +#define __INCmemPartLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "private/memPartLibP.h" + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmemPartLibh */ diff --git a/h/miiLib.h b/h/miiLib.h new file mode 100644 index 0000000..5f50ed9 --- /dev/null +++ b/h/miiLib.h @@ -0,0 +1,387 @@ +/* miiLib.h - Media Independent Interface library header */ + +/* Copyright 1990-2004 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01k,22apr04,kp added the macro MII_SR_SPEED_SEL_MASK +01j,06aug03,slk added phyFlags option MII_PHY_ISO_UNAVAIL SPR# 90115 +01i,13may02,rcs added pPhyOptRegsRtn field to PHY_INFO. SPR# 76711 +01h,14jun01,rcs moved new registers used by GMII to new struc MII_G_REGS + and placed it at end of PHY_INFO. (SPR# 68502) +01g,23feb01,jln add basic GMII support for 1000-T auto-negotiation (SPR# 68502) +01f,23nov99,cn added miiLibInit () to make miiLib a component (SPR #29542). +01e,08nov99,cn added fields phyLinkDownRtn, pMiiPhyNode, miiPhyPresent + to PHY_INFO structure. New flags MII_ALL_BUS_SCAN, + MII_PHY_MONITOR, and macro MII_MONITOR_DELAY. Also + added miiPhyUnInit (), miiLibUnInit (). +01d,27sep99,cn added definition of MII_CR_DEF_0_MASK. +01c,13sep99,cn added definition of MII_MAX_REG_NUM, moved global APIs + from miiLib.c (SPR# 28305). +01b,15jun99,cn changes after the code review. +01a,16mar99,cn written from motFccEnd.h, 01b. +*/ + +/* +DESCRIPTION + +This module implements a Media Independent Interface (MII) library. + +INCLUDE FILES: +*/ + +#ifndef __INCmiiLibh +#define __INCmiiLibh + +/* includes */ + +#ifdef __cplusplus +extern "C" { +#endif + +#define S_miiLib_PHY_LINK_DOWN (M_miiLib | 1) +#define S_miiLib_PHY_NULL (M_miiLib | 2) +#define S_miiLib_PHY_NO_ABLE (M_miiLib | 3) +#define S_miiLib_PHY_AN_FAIL (M_miiLib | 4) + +/* defines */ + +#define MII_SYS_DELAY(delay) \ +if (pPhyInfo->phyDelayRtn != NULL) \ + ((* (pPhyInfo->phyDelayRtn)) (delay)) + +#define MII_READ(addr, reg, val1, val2) \ + val2 = ((* (pPhyInfo->phyReadRtn)) ((pPhyInfo->pDrvCtrl), \ + (addr), (reg), (val1))); + +#define MII_WRITE(addr, reg, val1, val2) \ + val2 = ((* (pPhyInfo->phyWriteRtn)) ((pPhyInfo->pDrvCtrl), \ + (addr), (reg), (val1))); + +/* library flags */ + +#define MII_PHY_FLAGS_SET(setBits) \ + (pPhyInfo->phyFlags |= (setBits)) + +#define MII_PHY_FLAGS_ARE_SET(setBits) \ + (pPhyInfo->phyFlags & (setBits)) + +#define MII_PHY_FLAGS_GET(setBits) \ + (pPhyInfo->phyFlags) + +#define MII_PHY_FLAGS_CLEAR(clearBits) \ + (pPhyInfo->phyFlags &= ~(clearBits)) + +/* MII definitions */ + +#define MII_CRC_LEN 0x4 /* CRC length in bytes */ +#define MII_ETH_MAX_PCK_SZ (ETHERMTU + SIZEOF_ETHERHEADER \ + + MII_CRC_LEN) +#define MII_MAX_PHY_NUM 0x20 /* max number of attached PHYs */ +#define MII_MAX_REG_NUM 0x20 /* max number of registers */ + +#define MII_CTRL_REG 0x0 /* Control Register */ +#define MII_STAT_REG 0x1 /* Status Register */ +#define MII_PHY_ID1_REG 0x2 /* PHY identifier 1 Register */ +#define MII_PHY_ID2_REG 0x3 /* PHY identifier 2 Register */ +#define MII_AN_ADS_REG 0x4 /* Auto-Negotiation */ + /* Advertisement Register */ +#define MII_AN_PRTN_REG 0x5 /* Auto-Negotiation */ + /* partner ability Register */ +#define MII_AN_EXP_REG 0x6 /* Auto-Negotiation */ + /* Expansion Register */ +#define MII_AN_NEXT_REG 0x7 /* Auto-Negotiation */ + /* next-page transmit Register */ + +#define MII_AN_PRTN_NEXT_REG 0x8 /* Link partner received next page */ +#define MII_MASSLA_CTRL_REG 0x9 /* MATER-SLAVE control register */ +#define MII_MASSLA_STAT_REG 0xa /* MATER-SLAVE status register */ +#define MII_EXT_STAT_REG 0xf /* Extented status register */ + +/* MII control register bit */ + +#define MII_CR_COLL_TEST 0x0080 /* collision test */ +#define MII_CR_FDX 0x0100 /* FDX =1, half duplex =0 */ +#define MII_CR_RESTART 0x0200 /* restart auto negotiation */ +#define MII_CR_ISOLATE 0x0400 /* isolate PHY from MII */ +#define MII_CR_POWER_DOWN 0x0800 /* power down */ +#define MII_CR_AUTO_EN 0x1000 /* auto-negotiation enable */ +#define MII_CR_100 0x2000 /* 0 = 10mb, 1 = 100mb */ +#define MII_CR_LOOPBACK 0x4000 /* 0 = normal, 1 = loopback */ +#define MII_CR_RESET 0x8000 /* 0 = normal, 1 = PHY reset */ +#define MII_CR_NORM_EN 0x0000 /* just enable the PHY */ +#define MII_CR_DEF_0_MASK 0xca7f /* they must return zero */ +#define MII_CR_RES_MASK 0x003f /* reserved bits,return zero */ + +/* MII Status register bit definitions */ + +#define MII_SR_LINK_STATUS 0x0004 /* link Status -- 1 = link */ +#define MII_SR_AUTO_SEL 0x0008 /* auto speed select capable */ +#define MII_SR_REMOTE_FAULT 0x0010 /* Remote fault detect */ +#define MII_SR_AUTO_NEG 0x0020 /* auto negotiation complete */ +#define MII_SR_10T_HALF_DPX 0x0800 /* 10BaseT HD capable */ +#define MII_SR_10T_FULL_DPX 0x1000 /* 10BaseT FD capable */ +#define MII_SR_TX_HALF_DPX 0x2000 /* TX HD capable */ +#define MII_SR_TX_FULL_DPX 0x4000 /* TX FD capable */ +#define MII_SR_T4 0x8000 /* T4 capable */ +#define MII_SR_ABIL_MASK 0xff80 /* abilities mask */ +#define MII_SR_EXT_CAP 0x0001 /* extended capabilities */ +#define MII_SR_SPEED_SEL_MASK 0xf800 /* Mask to extract just speed + * capabilities from status + * register. + */ + +/* MII ID2 register bit mask */ + +#define MII_ID2_REVISON_MASK 0x000f +#define MII_ID2_MODE_MASK 0x03f0 + +/* MII AN advertisement Register bit definition */ + +#define MII_ANAR_10TX_HD 0x0020 +#define MII_ANAR_10TX_FD 0x0040 +#define MII_ANAR_100TX_HD 0x0080 +#define MII_ANAR_100TX_FD 0x0100 +#define MII_ANAR_100T_4 0x0200 +#define MII_ANAR_PAUSE 0x0400 +#define MII_ANAR_ASM_PAUSE 0x0800 +#define MII_ANAR_REMORT_FAULT 0x2000 +#define MII_ANAR_NEXT_PAGE 0x8000 +#define MII_ANAR_PAUSE_MASK 0x0c00 + +/* MII Link Code word bit definitions */ + +#define MII_BP_FAULT 0x2000 /* remote fault */ +#define MII_BP_ACK 0x4000 /* acknowledge */ +#define MII_BP_NP 0x8000 /* nexp page is supported */ + +/* MII Next Page bit definitions */ + +#define MII_NP_TOGGLE 0x0800 /* toggle bit */ +#define MII_NP_ACK2 0x1000 /* acknowledge two */ +#define MII_NP_MSG 0x2000 /* message page */ +#define MII_NP_ACK1 0x4000 /* acknowledge one */ +#define MII_NP_NP 0x8000 /* nexp page will follow */ + +/* MII Expansion Register bit definitions */ + +#define MII_EXP_FAULT 0x0010 /* parallel detection fault */ +#define MII_EXP_PRTN_NP 0x0008 /* link partner next-page able */ +#define MII_EXP_LOC_NP 0x0004 /* local PHY next-page able */ +#define MII_EXP_PR 0x0002 /* full page received */ +#define MII_EXP_PRT_AN 0x0001 /* link partner auto negotiation able */ + +/* MII Master-Slave Control register bit definition */ + +#define MII_MASSLA_CTRL_1000T_HD 0x100 +#define MII_MASSLA_CTRL_1000T_FD 0x200 +#define MII_MASSLA_CTRL_PORT_TYPE 0x400 +#define MII_MASSLA_CTRL_CONFIG_VAL 0x800 +#define MII_MASSLA_CTRL_CONFIG_EN 0x1000 + +/* MII Master-Slave Status register bit definition */ + +#define MII_MASSLA_STAT_LP1000T_HD 0x400 +#define MII_MASSLA_STAT_LP1000T_FD 0x800 +#define MII_MASSLA_STAT_REMOTE_RCV 0x1000 +#define MII_MASSLA_STAT_LOCAL_RCV 0x2000 +#define MII_MASSLA_STAT_CONF_RES 0x4000 +#define MII_MASSLA_STAT_CONF_FAULT 0x8000 + +/* MII Extented Status register bit definition */ + +#define MII_EXT_STAT_1000T_HD 0x1000 +#define MII_EXT_STAT_1000T_FD 0x2000 +#define MII_EXT_STAT_1000X_HD 0x4000 +#define MII_EXT_STAT_1000X_FD 0x8000 + +/* technology ability field bit definitions */ + +#define MII_TECH_10BASE_T 0x0020 /* 10Base-T */ +#define MII_TECH_10BASE_FD 0x0040 /* 10Base-T Full Duplex */ +#define MII_TECH_100BASE_TX 0x0080 /* 100Base-TX */ +#define MII_TECH_100BASE_TX_FD 0x0100 /* 100Base-TX Full Duplex */ +#define MII_TECH_100BASE_T4 0x0200 /* 100Base-T4 */ + +#define MII_TECH_PAUSE 0x0400 /* PAUSE */ +#define MII_TECH_ASM_PAUSE 0x0800 /* Asym pause */ +#define MII_TECH_PAUSE_MASK 0x0c00 + +#define MII_ADS_TECH_MASK 0x1fe0 /* technology abilities mask */ +#define MII_TECH_MASK MII_ADS_TECH_MASK +#define MII_ADS_SEL_MASK 0x001f /* selector field mask */ + +#define MII_AN_FAIL 0x10 /* auto-negotiation fail */ +#define MII_STAT_FAIL 0x20 /* errors in the status register */ +#define MII_PHY_NO_ABLE 0x40 /* the PHY lacks some abilities */ + +/* MII management frame structure */ + +#define MII_MF_PREAMBLE 0xffffffff /* preamble pattern */ +#define MII_MF_ST 0x1 /* start of frame pattern */ +#define MII_MF_OP_RD 0x2 /* read operation pattern */ +#define MII_MF_OP_WR 0x1 /* write operation pattern */ + +#define MII_MF_PREAMBLE_LEN 0x20 /* preamble lenght in bit */ +#define MII_MF_ST_LEN 0x2 /* start frame lenght in bit */ +#define MII_MF_OP_LEN 0x2 /* op code lenght in bit */ +#define MII_MF_ADDR_LEN 0x5 /* PHY addr lenght in bit */ +#define MII_MF_REG_LEN 0x5 /* PHY reg lenght in bit */ +#define MII_MF_TA_LEN 0x2 /* turnaround lenght in bit */ +#define MII_MF_DATA_LEN 0x10 /* data lenght in bit */ + +/* defines related to the PHY device */ + +#define MII_PHY_PRE_INIT 0x0001 /* PHY info pre-initialized */ +#define MII_PHY_AUTO 0x0010 /* auto-negotiation allowed */ +#define MII_PHY_TBL 0x0020 /* use negotiation table */ +#define MII_PHY_100 0x0040 /* PHY may use 100Mbit speed */ +#define MII_PHY_10 0x0080 /* PHY may use 10Mbit speed */ +#define MII_PHY_FD 0x0100 /* PHY may use full duplex */ +#define MII_PHY_HD 0x0200 /* PHY may use half duplex */ +#define MII_PHY_ISO 0x0400 /* isolate all PHYs */ +#define MII_PHY_PWR_DOWN 0x0800 /* power down mode */ +#define MII_PHY_DEF_SET 0x1000 /* set a default mode */ +#define MII_ALL_BUS_SCAN 0x2000 /* scan the all bus */ +#define MII_PHY_MONITOR 0x4000 /* monitor the PHY's status */ +#define MII_PHY_INIT 0x8000 /* PHY info initialized */ +#define MII_PHY_1000T_FD 0x10000 /* PHY may use 1000-T full duplex */ +#define MII_PHY_1000T_HD 0x20000 /* PHY mau use 1000-T half duplex */ +#define MII_PHY_TX_FLOW_CTRL 0x40000 /* Transmit flow control */ +#define MII_PHY_RX_FLOW_CTRL 0x80000 /* Receive flow control */ +#define MII_PHY_GMII_TYPE 0x100000 /* GMII = 1, MII = 0 */ +#define MII_PHY_ISO_UNAVAIL 0x200000 /* ctrl reg isolate func not available */ + +/* miscellaneous defines */ + +#define MII_PHY_DEF_DELAY 300 /* max delay before link up, etc. */ +#define MII_PHY_NO_DELAY 0x0 /* do not delay */ +#define MII_PHY_NULL 0xff /* PHY is not present */ +#define MII_PHY_DEF_ADDR 0x0 /* default PHY's logical address */ + +#ifndef MII_MONITOR_DELAY +# define MII_MONITOR_DELAY 0x5 /* in seconds */ +#endif + +#define MII_PHY_LINK_UNKNOWN 0x0 /* link method - Unknown */ +#define MII_PHY_LINK_AUTO 0x1 /* link method - Auto-Negotiation */ +#define MII_PHY_LINK_FORCE 0x2 /* link method - Force link */ + +/* + * these values may be used in the default phy mode field of the load + * string, since that is used to force the operating mode of the PHY + * in case any attempt to establish the link failed. + */ + +#define PHY_10BASE_T 0x00 /* 10 Base-T */ +#define PHY_10BASE_T_FDX 0x01 /* 10 Base Tx, full duplex */ +#define PHY_100BASE_TX 0x02 /* 100 Base Tx */ +#define PHY_100BASE_TX_FDX 0x03 /* 100 Base TX, full duplex */ +#define PHY_100BASE_T4 0x04 /* 100 Base T4 */ +#define PHY_AN_ENABLE 0x05 /* re-enable auto-negotiation */ + +#define MII_FDX_STR "full duplex" /* full duplex mode */ +#define MII_FDX_LEN sizeof (MII_FDX_STR) /* full duplex mode */ +#define MII_HDX_STR "half duplex" /* half duplex mode */ +#define MII_HDX_LEN sizeof (MII_HDX_STR) /* full duplex mode */ + +#define MII_AN_TBL_MAX 20 /* max number of entries in the table */ + +/* allowed PHY's speeds */ +#define MII_1000MBS 1000000000 /* bits per sec */ +#define MII_100MBS 100000000 /* bits per sec */ +#define MII_10MBS 10000000 /* bits per sec */ + +/* typedefs */ + +typedef INT16 MII_AN_ORDER_TBL [MII_AN_TBL_MAX]; + +typedef BOOL MII_PHY_BUS [MII_MAX_PHY_NUM]; + +typedef struct mii_phy_node + { + NODE node; + struct phy_info * pPhyInfo; + } MII_PHY_NODE; + +/* + * the structure below only represents the status of the PHY's registers + * when they were last read through the MII interface + */ + +typedef struct mii_regs + { + UINT16 phyStatus; /* PHY's status register */ + UINT16 phyCtrl; /* PHY's control register */ + UINT16 phyId1; /* PHY's identifier field 1 */ + UINT16 phyId2; /* PHY's identifier field 2 */ + UINT16 phyAds; /* PHY's advertisement register */ + UINT16 phyPrtn; /* PHY's partner register */ + UINT16 phyExp; /* PHY's expansion register */ + UINT16 phyNext; /* PHY's next page transmit register */ + } MII_REGS; + +typedef struct mii_g_regs + { + UINT16 phyRcvNext; /* PHY'S partner received next page */ + UINT16 phyMSCtrl; /* PHY'S MASTER-SLAVE Control register */ + UINT16 phyMSStatus; /* PHY'S MASTER-SLAVE Status register */ + UINT16 phyExtStatus; /* PHY'S extented Status register */ + } MII_G_REGS; + + +/* + * the structure below is to be allocated and filled in by the + * driver before it attempts to use the miiPhyInit () routine. Some + * of its field may be overwritten by miiPhyInit (), since their initial + * values may not be appropriate. In addition, some field do not have + * to be initialized by the calling task, since miiPhyInit () may use a + * default value, whereas some other are mandatory. To help understand this, + * the comment for each field includes flags stating whether the relevent + * field in the PHY_INFO structure is an input (I) parameter to miiPhyInit (), + * an output (O) parameter, or an input-output (I/O) parameter first, + * and then whether it is optional (O) or mandatory (M). For output + * parameters, the second flag is a "don't care" (X). + */ + +typedef struct phy_info + { + MII_REGS miiRegs; /* PHY registers - (O|X) */ + UINT8 phyAddr; /* address of a PHY - (I/O)|(O) */ + UINT32 phyFlags; /* some flags - (I/O)|(O) */ + UINT32 phySpeed; /* 10/100 Mbit/sec - (O|X) */ + char phyMode[20]; /* half/full duplex mode - (O|X) */ + UINT32 phyDefMode; /* default operating mode - (I|O) */ + MII_AN_ORDER_TBL * phyAnOrderTbl; /* auto-negotiation table - (I|O) */ + FUNCPTR phyReadRtn; /* phy read routine - (I|M) */ + FUNCPTR phyWriteRtn; /* phy write routine - (I|M) */ + FUNCPTR phyDelayRtn; /* phy delay routine - (I|O) */ + UINT32 phyDelayParm; /* parameter to delay routine - (I|O) */ + UINT32 phyMaxDelay; /* phy max delay - (I|O) */ + void * pDrvCtrl; /* driver control structure - (I|M) */ + FUNCPTR phyLinkDownRtn; /* phy status down routine - (I|O) */ + MII_PHY_NODE * pMiiPhyNode; /* phy node - O */ + MII_PHY_BUS * miiPhyPresent; /* which PHYs are there - O */ + UINT32 phyLinkMethod; /* phy link method (Auto/Force) - (O|X) */ + UINT32 phyAutoNegotiateFlags; /* flag for auto-negotiation - (O|X) */ + MII_G_REGS miiGRegs; /* Giga Bit PHY registers - (O|X) */ + FUNCPTR pPhyOptRegsRtn; /* device specific pPhyOptRegsRtn */ + } PHY_INFO; + +/* globals */ + +void miiPhyOptFuncSet (FUNCPTR optRegsFunc); +STATUS miiPhyInit (PHY_INFO * pPhyInfo); +STATUS miiLibUnInit (void); +STATUS miiLibInit (void); +STATUS miiPhyUnInit (PHY_INFO * pPhyInfo); +void miiShow (PHY_INFO * pPhyInfo); +STATUS miiRegsGet (PHY_INFO * pPhyInfo, UINT regNum, UCHAR * buff); +STATUS miiAnCheck (PHY_INFO * pPhyInfo, UINT8 phyAddr); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmiiLibh */ + diff --git a/h/mmuAttr.h b/h/mmuAttr.h new file mode 100644 index 0000000..97876d0 --- /dev/null +++ b/h/mmuAttr.h @@ -0,0 +1,71 @@ +/* mmuAttr.h - Memory Attribute Information */ + +/* Copyright 1998-2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01k,28jan04,gls added include of vmLibCommon.h +01j,19sep03,pcs Change enumeration value from 16 bit to 32 bit. +01i,24jul03,gls Ported to Base 6 +01h,17jan00,map removed RGN_TYPE and PHYS_REGION +01g,12nov99,tam define VIRT_ADDR if not already defined +01f,09nov99,tam renamed RGN_MAP_ONE_TO_ONE to RGN_MAP_LINEAR, + updated PHYS_REGION to include virtual address field. +01e,04aug99,gls restructured the page attributes +01d,06may99,gls renamed file from memAttr.h to mmuAttr.h +01c,27jan99,map added RGN_MAP entries. +01b,21jan99,map moved PHYS_REGION definition from memInfo.h +01a,16nov98,map written. +*/ + +#ifndef __INCmmuAttrh +#define __INCmmuAttrh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vmLibCommon.h" + +/* includes */ + +/* defines */ + +#define MMU_ATTR_PROT_GET(attr) ((attr) & MMU_ATTR_PROT_MSK) +#define MMU_ATTR_PROT_USR_GET(attr) ((attr) & MMU_ATTR_PROT_USR_MSK) +#define MMU_ATTR_PROT_SUP_GET(attr) ((attr) & MMU_ATTR_PROT_SUP_MSK) +#define MMU_ATTR_CACHE_GET(attr) ((attr) & MMU_ATTR_CACHE_MSK) +#define MMU_ATTR_VALID_GET(attr) ((attr) & MMU_ATTR_VALID_MSK) +#define MMU_ATTR_SPL_GET(attr) ((attr) & MMU_ATTR_SPL_MSK) +#define MMU_ATTR_MSK_ID_GET(mask) ((mask) & MMU_ATTR_MSK_ID_MSK) + +#define MMU_ATTR_PROT_USR_TO_SUP(attr) (((attr) & MMU_ATTR_PROT_USR_MSK) >> 3) +#define MMU_ATTR_PROT_SUP_TO_USR(attr) (((attr) & MMU_ATTR_PROT_SUP_MSK) << 3) + +/* + * The following macros do not necessarily belong in this file given their + * use, which should be limited strictly to vmlib.c. They have been + * placed here because they are dependent upon the values defined here. + * This will help to prevent inconsistancies. + */ + +#define MMU_ATTR_PROT_INDEX_SHIFT 1 /* used by vmLib */ +#define MMU_ATTR_CACHE_INDEX_SHIFT 7 /* used by vmLib */ +#define MMU_ATTR_VALID_INDEX_SHIFT 6 /* used by vmLib */ +#define MMU_ATTR_MSK_INDEX_SHIFT 5 /* used by vmLib */ + +#define MMU_ATTR_PROT_STATE_NUM 32 /* used by vmLib */ +#define MMU_ATTR_CACHE_STATE_NUM 16 /* used by vmLib */ +#define MMU_ATTR_VALID_STATE_NUM 2 /* used by vmLib */ + +/* typedefs */ + +/* function prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmmuAttrh */ diff --git a/h/mmuLib.h b/h/mmuLib.h new file mode 100644 index 0000000..a6285cc --- /dev/null +++ b/h/mmuLib.h @@ -0,0 +1,118 @@ +/* mmuLib.h - mmuLib header file */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01r,15nov04,h_k renamed mmuSh7750LibInit to mmuShLibInit. removed + mmuSh7700LibInit. +01q,22oct04,pch SPR 102912: add #ifndef _ASMLANGUAGE +01p,29sep04,pcs Update the prototype of mmuPpcLibInit to use 2 more + parameters. +01o,06aug04,sru Add S_mmulib_LOCK_REQUIRED errno. +01n,06jul04,dtr Add in errno values for aimMmu to fix SPR 98263. +01m,20jan03,jb Resolving SPR 79707 +01l,01mar00,frf Add SH4 support for T2. +01k,28aug98,st added prototype for mmuSh7750LibInit. +01j,15nov96,wt added prototype for mmuSh7700LibInit. +02b,20jan99,cdp removed support for old ARM libraries. +01l,12nov98,cdp removed prototype mmuLibInit() for new ARM architectures. +01k,09apr98,hdn added PentiumPro support. +01j,19sep95,tpr added prototype mmuPpcLibInit() for PowerPC. +01i,24nov93,hdn added prototype mmuLibInit() for I80X86. +01i,02dec93,pme added Am29K family support. +01h,01oct92,jcf rolled out 01g to remove warnings. +01g,27sep92,kdl deleted prototypes for mmu1eLibInit, mmu30LibInit, mmu40LibInit +01f,22sep92,rrr added support for c++ +01e,22sep92,rdc added support for sun1e. +01d,17sep92,rdc added prototypes and errors for sun1e. +01c,30jul92,rdc added prototypes for mmu30LibInit and mmu40LibInit. +01b,28jul92,rdc removed superfluous function prototypes. +01a,08jul92,rdc written. +*/ + +#ifndef __INCmmuLibh +#define __INCmmuLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#define S_mmuLib_INVALID_PAGE_SIZE (M_mmuLib | 1) +#define S_mmuLib_NO_DESCRIPTOR (M_mmuLib | 2) +#define S_mmuLib_INVALID_DESCRIPTOR (M_mmuLib | 3) + +/* sun4 specific codes */ + +#define S_mmuLib_OUT_OF_PMEGS (M_mmuLib | 5) + +/* virtual addresses must be in the first or last 1/2 Gibabyte of + * virtual address space + */ + +#define S_mmuLib_VIRT_ADDR_OUT_OF_BOUNDS (M_mmuLib | 6) + +/* additional errno required by aim */ +/* Trying to change state of locked page or lock again is illegal */ +#define S_mmuLib_TLB_LOCKED_PAGE (M_mmuLib | 7) +/* Trying to unlock a region which is not locked is an error */ +#define S_mmuLib_TLB_PAGE_NOT_LOCKED (M_mmuLib | 8) +#define S_mmuLib_LOCK_NO_MORE_TLB_RESOURCES (M_mmuLib | 9) + +/* Cannot optimize or lock a non contiguous phys addr or state*/ +#define S_mmuLib_NOT_CONTIGUOUS_ADDR (M_mmuLib | 10) +#define S_mmuLib_NOT_CONTIGUOUS_STATE (M_mmuLib | 11) + +/* Cannot optimize or lock a page marked as ISR callable */ +/* Cannot change state of page in ISR unless marked */ +#define S_mmuLib_ISR_CALL_BLOCKED (M_mmuLib | 12) +#define S_mmuLib_MARKED_ISR_CALLABLE (M_mmuLib | 13) + +/* Illegal to lock a non global page */ +#define S_mmuLib_NOT_GLOBAL_PAGE (M_mmuLib | 15) + +/* Illegal to unlock a region required by the vxWorks kernel */ +#define S_mmulib_LOCK_REQUIRED (M_mmuLib | 16) + +#ifndef _ASMLANGUAGE +typedef struct mmuTransTblStruct * MMU_TRANS_TBL_ID; + +#if defined(__STDC__) || defined(__cplusplus) + +STATUS mmu30LibInit (int pageSize); +STATUS mmu40LibInit (int pageSize); +STATUS mmu1eLibInit (int pageSize); +#if (CPU_FAMILY != ARM) +STATUS mmuLibInit (int pageSize); +#endif +STATUS mmuPro32LibInit (int pageSize); +STATUS mmuPro36LibInit (int pageSize); +STATUS mmuAm29kLibInit (int pageSize); +STATUS mmuPpcLibInit (int mmuType, int * pPhysMemDesc, int elementNb, int *, + void * hashTableStartAddr,u_int hashTableSize); +STATUS mmuShLibInit (int pageSize); + +#else /* __STDC__ */ + +STATUS mmu30LibInit (); +STATUS mmu40LibInit (); +STATUS mmu1eLibInit (); +#if (CPU_FAMILY != ARM) +STATUS mmuLibInit (); +#endif +STATUS mmuPro32LibInit (); +STATUS mmuPro36LibInit (); +STATUS mmuAm29kLibInit (); +STATUS mmuPpcLibInit (); +STATUS mmuShLibInit (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmmuLibh */ diff --git a/h/moduleLib.h b/h/moduleLib.h new file mode 100644 index 0000000..9dd891c --- /dev/null +++ b/h/moduleLib.h @@ -0,0 +1,233 @@ +/* moduleLib.h - object module list management header */ + +/* + * Copyright (c) 1992-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01n,14feb05,v_r Fixed SPR #98274 (loader errno review). + Moved private routines to moduleLibP.h + Added segment type for loadFileLibP.h + Cleanups. +01m,02feb05,v_r Fixed SPR #104657 (moduleShow() does not present display + options) by moving the now unsupported display options in + moduleShow.c and removing the unused ones. + Updated copyright notice to 2005. +01l,10jan05,v_r Fixed SPR #104659 (moduleShow now a separate component, need + to include moduleShow.h in moduleLib.h) +01k,21oct04,x_p Added moduleSectionDescFree() prototype. +01j,18sep04,jn Move towards shared code for host and target +01i,05apr04,jn Clean up - remove unused declarations and development-related + comments +01h,03apr03,jn merge from AE loader moduleLibh +01g,03apr03,to replaced OBJ_CORE with HANDLE in MODULE (de-classify). +01f,11sep96,pad added MODULE_GROUP_MAX definition (SPR #7133). +01e,30oct92,jmm added prototype for moduleCheck() - spr 1693 +01d,22sep92,rrr added support for c++ +01c,27aug92,jmm changed MODULE_SEG_INFO struct to always include TEXT/DATA/BSS + changed symFlags to flags + added prototypes for moduleNameGet(), moduleFlagsGet() + changed type for ctors and dtors to VOIDFUNCPTR +01b,01aug92,srh added lists for static constructors/destructors to + MODULE struct. +01a,09apr92,jmm written +*/ + +#ifndef __INCmoduleLibh +#define __INCmoduleLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#ifdef HOST +#include "host.h" +#include "tgtmem.h" +#include "pdLib.h" +#include "wtxtypes.h" +#include "dllLib.h" +#include "sllLib.h" +#else +#include "dllLib.h" +#include "sllLib.h" +#include "limits.h" +#include "private/handleLibP.h" +#include "memPartLib.h" +#include "moduleShow.h" +#endif /* HOST */ + +/* moduleLib Status Codes */ + +#define S_moduleLib_MODULE_NOT_FOUND (M_moduleLib | 1) +#define S_moduleLib_HOOK_NOT_FOUND (M_moduleLib | 2) +#define S_moduleLib_BAD_CHECKSUM (M_moduleLib | 3) +#define S_moduleLib_MAX_MODULES_LOADED (M_moduleLib | 4) +#define S_moduleLib_INVALID_SECTION_ID (M_moduleLib | 5) +#define S_moduleLib_INVALID_MODULE_ID (M_moduleLib | 6) + +/* max number of module groups */ + +#define MODULE_GROUP_MAX 65535 + +/* Types of object module formats - for backward compatibility */ + +#define MODULE_A_OUT 0 /* format is a.out */ +#define MODULE_B_OUT 1 /* format is b.out */ +#define MODULE_ECOFF 2 /* format is ECOFF */ +#define MODULE_ELF 3 /* format is ELF */ + +/* Types of segments */ + +#define SEGMENT_UNKNOWN 0 /* unknown segment */ +#define SEGMENT_TEXT 2 /* text segment */ +#define SEGMENT_DATA 4 /* data segment */ +#define SEGMENT_BSS 8 /* bss segment */ + +/* segment flag bits */ + +#define SEG_FREE_MEMORY 1 /* Free memory when deleting this segment */ +#define SEG_WRITE_PROTECTION 2 /* Segment's memory is write-protected, + * need to call memory managment routines + * to unprotect when deleting */ + +/* section flag bits */ + +#define SCN_FREE_MEMORY 1 /* Free memory when deleting this section */ +#define SCN_NO_CHECKSUM 2 /* do not perform checksum of this section */ + +/* moduleCheck() options */ + +#define MODCHECK_NOPRINT 0x1 /* Don't print module names during check */ + +#define MODCHECK_TEXT 0x2 /* check text sections */ +#define MODCHECK_DATA 0x4 /* check data sections */ +#define MODCHECK_BSS 0x8 /* check bss sections */ +#define MODCHECK_RODATA 0x10 /* check read-only sections */ + +#define MODCHECK_ALL (MODCHECK_TEXT | \ + MODCHECK_DATA | \ + MODCHECK_BSS | \ + MODCHECK_RODATA) /* check all sections */ + +/* module status information */ + +#define MODULE_REPLACED 0x00010000 /* set if the module is loaded twice */ + +/* Typedefs */ + +typedef struct + { + DL_NODE segmentNode; /* double-linked list node information*/ + void * address; /* segment address */ + int size; /* segment size */ + int type; /* segment type*/ + int flags; /* segment flags */ + } SEGMENT; + +typedef SEGMENT * SEGMENT_ID; /* segment ID */ + +typedef struct + { + void * textAddr; /* address of text segment */ + void * dataAddr; /* address of data segment */ + void * bssAddr; /* address of bss segment */ + int textSize; /* size of text segment */ + int dataSize; /* size of data segment */ + int bssSize; /* size of bss segment */ + int textFlags; /* flags for text segment */ + int dataFlags; /* flags for data segment */ + int bssFlags; /* flags for bss segment */ + } MODULE_SEG_INFO; + +typedef struct + { + char name [NAME_MAX];/* module name */ + int format; /* object module format */ + int group; /* group number */ + MODULE_SEG_INFO segInfo; /* segment info */ + } MODULE_INFO; + +typedef struct module + { +#ifdef HOST + OBJ_CORE handle; /* handle management */ +#else + HANDLE handle; /* handle management */ +#endif /* HOST */ + DL_NODE moduleNode; /* double-linked list node information */ + + /* + * nameWithPath is now the preferred field to use for name and + * path. The separate name and path fields are kept for backward + * compatibility, but they may not hold valid information, since + * they are of limited size. + */ + + char * nameWithPath; /* module name and path */ + char name [NAME_MAX]; /* module name */ + char path [PATH_MAX]; /* module path */ + int flags; /* symFlags as passed to the loader */ + DL_LIST sectionList; /* list of section */ + DL_LIST segmentList; /* list of segments */ + int format; /* object module format. Only ELF now */ + UINT16 group; /* group number */ + VOIDFUNCPTR * ctors; /* list of static constructor callsets */ + VOIDFUNCPTR * dtors; /* list of static destructor callsets */ + UINT commTotalSize; /* memory used by common symbols */ + BOOL swapNeeded; /* TRUE if the headers need byte swap */ + int undefSymCount; /* number of undefined symbols */ +#ifdef HOST + DL_LIST undefSymList; /* list of undefined symbol names */ +#endif + void * user1; /* reserved for use by end-user */ + void * reserved1; /* reserved for use by WRS */ + void * reserved2; /* reserved for use by WRS */ + void * reserved3; /* reserved for use by WRS */ + void * reserved4; /* reserved for use by WRS */ + } MODULE; + +typedef struct module * MODULE_ID; /* module ID */ + +/* function declarations */ + +extern STATUS moduleCheck (int options); +extern MODULE_ID moduleCreate (char * name, int format, int flags); +extern STATUS moduleCreateHookAdd (FUNCPTR moduleCreateHookRtn); +extern STATUS moduleCreateHookDelete (FUNCPTR moduleCreateHookRtn); +extern STATUS moduleDelete (MODULE_ID moduleId); +extern MODULE_ID moduleEach (FUNCPTR routine, int userArg); +extern MODULE_ID moduleFindByGroup (int groupNumber); +extern MODULE_ID moduleFindByName (char * moduleName); +extern MODULE_ID moduleFindByNameAndPath (char * moduleName, + char * pathName); +extern int moduleFlagsGet (MODULE_ID moduleId); +extern MODULE_ID moduleIdFigure (void * moduleNameOrId); +extern int moduleIdListGet(MODULE_ID * idList, int maxModules); +extern STATUS moduleInfoGet (MODULE_ID moduleId, + MODULE_INFO * pModuleInfo); +extern STATUS moduleInit (MODULE_ID moduleId, char * name, int format, + int flags); +extern STATUS moduleLibInit (void); +extern char * moduleNameGet (MODULE_ID moduleId); +extern STATUS moduleSegAdd (MODULE_ID moduleId, int type, void * location, + int length, int flags); +extern SEGMENT_ID moduleSegEach (MODULE_ID moduleId, FUNCPTR routine, + int userArg); +extern SEGMENT_ID moduleSegFirst (MODULE_ID moduleId); +extern SEGMENT_ID moduleSegGet (MODULE_ID moduleId); +extern SEGMENT_ID moduleSegNext (SEGMENT_ID segmentId); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmoduleLibh */ + diff --git a/h/moduleShow.h b/h/moduleShow.h new file mode 100644 index 0000000..4059cac --- /dev/null +++ b/h/moduleShow.h @@ -0,0 +1,42 @@ +/* moduleShow.h - object module list management show routine */ + +/* + * Copyright (c) 2004 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software may be + * licensed only pursuant to the terms of an applicable Wind River license + * agreement. + */ + +/* +modification history +-------------------- +01c,25jul05,v_r Updated copyright. +01b,05apr04,jn Clean up development-related comments +01a,27feb04,jn written. Put moduleShow in a separate component, + INCLUDE_MODULE_SHOW +*/ + +#ifndef __INCmoduleShowh +#define __INCmoduleShowh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +extern STATUS moduleShow + ( + char * moduleNameOrId, + int options + ); + +extern void moduleShowInit (void); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmoduleShowh */ diff --git a/h/mount.h b/h/mount.h new file mode 100644 index 0000000..be7e20d --- /dev/null +++ b/h/mount.h @@ -0,0 +1,193 @@ +/* mount.h - file system mount-point interface */ + +/* + * Copyright 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01l,14aug05,jlk add suspend flag to mountEject +01k,26jul05,act split commit op into start+end ops +01j,20jul05,act add mountEject and some internal flags +01i,06may05,jlk changed some fields in statvs to be 64 bit +01h,21apr05,jlk filled in statvs structure +01g,10mar05,act add pointer to mount point to mountCreate +01f,10mar05,act split buffer creation and deletion out of mountCreate +01e,10mar05,act add mnt_dev +01d,03mar05,act add MNT_RDONLY +01c,03mar05,act remove mount list and some unused mnt_* fields +01b,02mar05,act add bio fields, and DEV_HDR for coreIO +01a,23feb05,act add mnt_rootvnode, for lookup code +*/ + +#ifndef __INCmounth +#define __INCmounth + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct vfsops; + +/* xxx move this to vnode.h */ +LIST_HEAD(vnodelst, vnode); +LIST_HEAD(vhashhdr, vnode); + +struct statvfs { + UINT32 f_bsize; /* File system block size. */ + UINT32 f_frsize; /* Fundamental file system block size. */ + UINT64 f_blocks; /* Total number of blocks on file system in units of f_frsize. */ + UINT64 f_bfree; /* Total number of free blocks. */ + UINT64 f_bavail; /* Number of free blocks available to */ + /* non-privileged process. */ + UINT64 f_files; /* Total number of file serial numbers. */ + UINT64 f_ffree; /* Total number of free file serial numbers. */ + UINT64 f_favail; /* Number of file serial numbers available to */ + /* non-privileged process. */ + UINT32 f_fsid; /* File system ID. */ + UINT32 f_flag; /* Bit mask of f_flag values. */ + UINT32 f_namemax; /* Maximum filename length. */ +}; + +/* + * Open-file table, per mount point. In BSD this is in + * and logically core I/O should do this, but here we have to do it + * per mount point. + * + * At the moment, f_count is not needed... remove it? (dup() is handled + * inside core I/O, so that dup()ed fd's point to the same vfile data + * structure.) + */ +struct vfile { + u_short f_count; /* number of dup()s */ + u_short f_flags; /* _FREAD and/or _FWRITE */ + struct vnode *f_vnode; /* vnode for this file */ + voff_t f_offset; /* and current seek pos */ + SLIST_ENTRY(vfile) f_next; /* list of free files */ +}; + +struct mount { + DEV_HDR mnt_devhdr; /* CoreI/O, MUST BE FIRST */ + device_t mnt_dev; /* connected XBD */ + struct vfsops *mnt_op; /* operations on fs */ + struct vnode *mnt_syncer; /* syncer vnode */ + struct vnode *mnt_rootvnode; /* result of VFS_ROOT() */ + struct vnodelst mnt_vnodelist; /* active vnodes */ +#ifdef notyet + struct lock mnt_lock; /* mount structure lock */ +#else + SEM_ID mnt_lock; +#endif + int mnt_flag; /* flags */ + int mnt_iflag; /* internal flags */ + + /* per-mount file and vnode tables */ + SEM_ID mnt_filesem; /* ??? can use mnt_lock? */ + struct vfile *mnt_filetable; /* open file table */ + int mnt_nfiles; /* # files, for debug/show */ + SLIST_HEAD(, vfile) mnt_freefiles; /* list of free files */ + char *mnt_vnodespace; /* malloc() space for vnodes */ + int mnt_nvnodes; /* # vnodes, for debug/show */ + + void *mnt_data; /* private data */ + + /* + * These items are for buffer management. Note that there are + * three semaphores involved: a counting semaphore for "number of + * unowned buffers", a mutex for hash chain manipulation, and + * one semaphore per buffer. If you are taking a buffer semaphore + * and the hash chain mutex, you must take the buffer semaphore + * first (to avoid deadlocking). + * + * The hash chain mutex is also used to protect the free lists. + * + * The buffer getting routines (getblk, bread) return locked + * buffers (which are no longer on a free list) -- see buf.h. + */ + struct buf *mnt_bufspace; /* for free()ing */ + int mnt_nbufs; /* and show()ing */ + SEM_ID mnt_unowned_bufs; /* number of unowned buffers */ + SEM_ID mnt_bufhash_mutex; /* hash chain mutex */ + struct bhashhdr mnt_bufhash[BUF_BHSIZE]; /* hash chains */ + struct bfreehdr mnt_bufqueues[BUF_NQUEUES]; /* free lists */ + + /* + * These items are for vnode management, which is done in pretty + * much the same fashion as buffer management, except that vnodes + * do not have "priorities" to order the free list. Also, vnodes + * can have more than one active user, and can be "held" (by + * buffer cache references) even when no one is using them. + */ + SEM_ID mnt_unowned_vnodes; /* number of unowned vnodes */ + SEM_ID mnt_vhash_mutex; /* hash chain mutex */ + struct vhashhdr mnt_vhash[VN_VHSIZE]; /* hash chains */ + TAILQ_HEAD(, vnode) mnt_vhold_list; /* held vnodes */ + TAILQ_HEAD(, vnode) mnt_freevnodes; /* free vnodes */ + + /* + * These keep track of bio space allocated in mountCreate(), + * for mountDelete() to release. + */ + struct bio *mnt_bios; /* the bios */ + void *mnt_biomem; /* device-space RAM for I/O */ +}; + +struct vfsops { + const char *vfs_name; /* name of this fs type */ + size_t vfs_mount_data_size; /* size of private mount data */ + size_t vfs_vnode_data_size; /* size of private vnode data */ + + int (*vfs_start)(struct mount *, int); + int (*vfs_unmount)(struct mount *, int); + int (*vfs_root)(struct mount *, struct vnode **); + int (*vfs_statvfs)(struct mount *, struct statvfs *); + int (*vfs_vget)(struct mount *, ino_t, struct vnode **); + void (*vfs_init)(void); + void (*vfs_reinit)(void); + void (*vfs_done)(void); + int (*vfs_starttransaction)(struct mount *, BOOL); + int (*vfs_endtransaction)(struct mount *, int); +}; + +#define VFS_START(mp, flags) ((mp)->mnt_op->vfs_start(mp, flags)) +#define VFS_UNMOUNT(mp, force) ((mp)->mnt_op->vfs_unmount(mp, force)) +#define VFS_ROOT(mp, vpp) ((mp)->mnt_op->vfs_root(mp, vpp)) +#define VFS_STATVFS(mp, sbp) ((mp)->mnt_op->vfs_statvfs(mp, sbp)) +#define VFS_VGET(mp, ino, vpp) ((mp)->mnt_op->vfs_vget(mp, ino, vpp)) +#define VFS_STARTTRANSACTION(mp, willwrite) \ + ((mp)->mnt_op->vfs_starttransaction(mp, willwrite)) +#define VFS_ENDTRANSACTION(mp, error) \ + ((mp)->mnt_op->vfs_endtransaction(mp, error)) + +int mountCreate(struct vfsops *, device_t, int, char *, struct mount **); +void mountDelete(struct mount *, int); +void mountEject(struct mount *, BOOL); + +int mountBufAlloc(struct mount *, int, size_t); +void mountBufFree(struct mount *); + +/* + * Mount flags. + */ +#define MNT_RDONLY 0x00000001 /* read only filesystem */ + +/* + * Internal flags. + */ +#define MNTI_IN_COREIO 0x00000001 /* entry is in coreIO tables */ +#define MNTI_EJECTING 0x00000002 /* mount point is being ejected */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmounth */ diff --git a/h/mountLib.h b/h/mountLib.h new file mode 100644 index 0000000..c65ae07 --- /dev/null +++ b/h/mountLib.h @@ -0,0 +1,27 @@ +/* mountLib.h - Mount protocol library header */ + +/* Copyright 1994-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,01jul04,dlk Made this file include "mountd.h", and removed other contents. +01f,06nov01,vvv made max. path length configurable (SPR #63551) +01e,10oct01,rae update copyright +01d,21jun00,rsh upgrade to dosFs 2.0 +01d,21sep99,jkf changed nameToInode for nfsHash approach. +01c,25apr94,jmm added S_mountLib_ILLEGAL_MODE; changed mode to readOnly +01b,21apr94,jmm added MOUNTD_ARGUMENT; prototype cleanup +01a,31mar94,jmm written. +*/ + +#ifndef __INCmountLibh +#define __INCmountLibh + +#if 0 +#error mountLib.h is obsolete, use mountd.h instead +#endif + +#include + +#endif /* __INCmountLibh */ diff --git a/h/mqPxShow.h b/h/mqPxShow.h new file mode 100644 index 0000000..443b7d6 --- /dev/null +++ b/h/mqPxShow.h @@ -0,0 +1,36 @@ +/* mqPxShow.h - private POSIX message queue library header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,02dec93,dvs written +*/ + +#ifndef __INCmqPxShowh +#define __INCmqPxShowh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS mqPxShowInit (void); + +#else /* __STDC__ */ + +extern STATUS mqPxShowInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmqPxShowh */ diff --git a/h/mqueue.h b/h/mqueue.h new file mode 100644 index 0000000..e2d4d7a --- /dev/null +++ b/h/mqueue.h @@ -0,0 +1,52 @@ +/* mqueue.h - POSIX message queue library header */ + +/* + * Copyright (c) 1993-1994, 1999, 2003, 2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01j,22aug05,kk moved kernel specific prototypes from mqueueCommon.h +01i,07jul05,kk moved MQ_PRIO_MAX from mqueueCommon.h to here +01h,05dec03,m_s code-inspection changes +01g,31oct03,m_s make mq_des definition public for Base 6 +01f,14oct03,pcm added #include "fcntl.h" (SPR 4649) +01e,22mar99,elg Erroneous Fix for SPR 20532 (SPR 25989). +01d,12mar99,elg include private header to get mqPxLibInit() (SPR 20532). +01c,19aug96,dbt added define of MQ_PRIORITY_MAX (SPR #7039). + updated copyright. +01b,05jan94,kdl added modhist, added include of sigevent.h, general cleanup. +01a,01dec93,rrr written. +*/ + +#ifndef __INCmqueueh +#define __INCmqueueh + + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include + +/*defines */ + +#define MQ_PRIO_MAX 32 /* max priority levels */ + +/* forward declarations */ + +extern int mq_send (mqd_t, const void *, size_t, int); +extern int mq_receive (mqd_t, void *, size_t, int *); + +#ifdef __cplusplus +} +#endif + +#endif /* INCmqueueh */ diff --git a/h/mqueueCommon.h b/h/mqueueCommon.h new file mode 100644 index 0000000..7d7f7e4 --- /dev/null +++ b/h/mqueueCommon.h @@ -0,0 +1,70 @@ +/* mqueueCommon.h - POSIX usr/kernel shared message queue header file */ + +/* + * Copyright (c) 2003, 2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01c,22aug05,kk moved RTP or kernel specific prototypes to mqueue.h +01b,07jul05,kk move MQ_PRIO_MAX into kernel, user level has it in limits.h +01a,14nov03,m_s code-inspection changes +01a,31oct03,m_s Written +*/ + +#ifndef __INCmqueueCommonh +#define __INCmqueueCommonh + + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include +#include + +/* defines */ + +#define MQ_NUM_MSGS_DEFAULT 16 /* default messages per queue */ +#define MQ_MSG_SIZE_DEFAULT 16 /* default message size in bytes */ + +/* typedefs */ + +/* message queue attributes */ + +struct mq_attr + { + size_t mq_maxmsg; + size_t mq_msgsize; + unsigned mq_flags; + size_t mq_curmsgs; + }; + + +/* message queue descriptor for applications */ +struct mq_des; +typedef struct mq_des * mqd_t; + +/* function declarations */ + +/* mq_receive() and mq_send() are in mqueue.h */ + +extern mqd_t mq_open (const char *, int, ...); +extern int mq_close (mqd_t); +extern int mq_unlink (const char *); +extern int mq_notify (mqd_t, const struct sigevent *); +extern int mq_setattr (mqd_t, const struct mq_attr *, struct mq_attr *); +extern int mq_getattr (mqd_t, struct mq_attr *); + +#ifdef __cplusplus +} +#endif + +#endif /* INCmqueueCommonh */ diff --git a/h/msgQEvLib.h b/h/msgQEvLib.h new file mode 100644 index 0000000..3d1d3a0 --- /dev/null +++ b/h/msgQEvLib.h @@ -0,0 +1,43 @@ +/* msgQEvLib.h - message queue events library header file */ + +/* Copyright 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,20sep01,bwa Written. +*/ + +#ifndef __INCmsgQEvLibh +#define __INCmsgQEvLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "msgQLib.h" + +#ifndef _ASMLANGUAGE + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS msgQEvStart (MSG_Q_ID msgQId, UINT32 events, UINT8 options); +extern STATUS msgQEvStop (MSG_Q_ID msgQId); + +#else /* __STDC__ */ + +extern STATUS msgQEvStart (); +extern STATUS msgQEvStop (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmsgQEvLibh */ diff --git a/h/msgQLib.h b/h/msgQLib.h new file mode 100644 index 0000000..2f1a241 --- /dev/null +++ b/h/msgQLib.h @@ -0,0 +1,124 @@ +/* msgQLib.h - message queue library header file */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +02u,07oct05,yvp Used VX_OBJ_ALIGN_SIZE to align statically instantiated + objects (SPR 113405). +02t,30aug05,yvp Reworked VX_MSG_Q macro to undo struct workaround. +02s,08aug05,yvp Added VX_MSG_Q macro for static instantiation of MsgQ's. + Added prototype for msgQInitialize(). + Updated copyright. #include now with angle brackets. +02r,04aug05,yvp Added prototype for create/delete library init. +02q,26oct04,fr added msgQOpenInit() routine (SPR 101491) +02p,24oct03,aeg moved common definitions with user side to msgQLibCommon.h +02o,20jun03,ymz updated year of copyright. +02n,14mar03,dcc moved MSG_Q_ID definition to types/vxWind.h. +02m,19oct01,bwa Added MSG_Q_EVENTSEND_ERR_NOTIFY option. +02l,17apr98,rlp canceled MSG_Q_INFO modification for backward compatibility. +02k,04nov97,rlp modified MSG_Q_INFO structure for tracking messages sent. +02j,13jul93,wmd use MEM_ROUND_UP to determine MSG_NODE_SIZE. +02i,22sep92,rrr added support for c++ +02h,04jul92,jcf cleaned up. +01g,26may92,rrr the tree shuffle +01f,04oct91,rrr passed through the ansification filter + -changed copyright notice +01e,05oct90,dnw changed MSG_Q_INFO structure. +01d,05oct90,dnw changed function declarations for new interface. +01c,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01b,07aug90,shl moved function declarations to end of file. +01a,10may90,dnw written +*/ + +#ifndef __INCmsgQLibh +#define __INCmsgQLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + + +#ifndef _ASMLANGUAGE +/* macros */ + +/* + * The following macro determines the number of bytes needed to buffer + * a message of the specified length. The node size is rounded up for + * efficiency. The total buffer space required for a pool for + * messages each of up to bytes is: + * + * maxMsgs * MSG_NODE_SIZE (maxMsgLength) + */ + +#define MSG_NODE_SIZE(msgLength) \ + (MEM_ROUND_UP((sizeof (MSG_NODE) + msgLength))) + +/* macros used to statically declare message queues */ + + +/******************************************************************************* +* +* VX_MSG_Q - declare storage for a message queue +* +* This macro declares storage for a message queue with name , that +* will have messages, each of length . This macro +* only generates data declarations for the message queue. To fully instantiate +* the message queue and make it ready for use, function msgQInitialize() must +* be called after using this macro. This macro is useful for declaring message +* queues statically (i.e. at compile time, without using any dynamic memory +* allocation at runtime). +* +* Sample usage of this macro is as follows: +* \cs +* #include +* #include +* +* VX_MSG_Q(myMsgQ,100,16); /@ declare the msgQ @/ +* MSG_Q_ID myMsgQId; /@ MsgQ ID to send/receive messages @/ +* +* STATUS initializeFunction (void) +* { +* if ((myMsgQId = msgQInitialize (myMsgQ, 100, 16, options)) == NULL) +* return (ERROR); /@ initialization failed @/ +* else +* return (OK); +* } +* \ce +* +* SEE ALSO: msgQInitialize() +* \NOMANUAL +*/ + +#define VX_MSG_Q(name, max_msgs, max_msg_len) \ + _WRS_DATA_ALIGN_BYTES(VX_OBJ_ALIGN_SIZE) \ + char name [VX_MSG_Q_SIZE + ((max_msgs)*(MSG_NODE_SIZE(max_msg_len)))]; + +/* function declarations */ + +extern STATUS msgQLibInit (void); +extern void msgQCreateLibInit (void); +extern MSG_Q_ID msgQInitialize (char * pMsgQMem, int maxMsgs, int maxMsgLength, + int options); +extern void msgQShowInit (void); +extern void msgQOpenInit (void); +extern STATUS msgQShow (MSG_Q_ID msgQId, int level); +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmsgQLibh */ diff --git a/h/msgQLibCommon.h b/h/msgQLibCommon.h new file mode 100644 index 0000000..6945038 --- /dev/null +++ b/h/msgQLibCommon.h @@ -0,0 +1,100 @@ +/* msgQLibCommon.h - common message queue library header file */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,03sep04,bwa added S_msgQLib_INVALID_MSG_COUNT errno. +01f,22apr04,dcc added 'context' to msgQOpen() parameters. +01e,30mar04,ans added MSG_Q_INTERRUPTIBLE option. +01d,22mar04,dcc added msgQClose() and msgQUnlink() prototypes. +01c,25nov03,aeg removed fields from MSG_Q_INFO in user-space. +01b,31oct03,aeg added S_msgQLib_ILLEGAL_OPTIONS, S_msgQLib_ILLEGAL_PRIORITY + and S_msgQLib_UNSUPPORTED_OPERATION errnos. +01a,24oct03,aeg written (based on kernel version 02o). +*/ + +#ifndef __INCmsgQLibCommonh +#define __INCmsgQLibCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "vwModNum.h" +#include "objLib.h" + + +/* generic status codes */ + +#define S_msgQLib_INVALID_MSG_LENGTH (M_msgQLib | 1) +#define S_msgQLib_NON_ZERO_TIMEOUT_AT_INT_LEVEL (M_msgQLib | 2) +#define S_msgQLib_INVALID_QUEUE_TYPE (M_msgQLib | 3) +#define S_msgQLib_ILLEGAL_OPTIONS (M_msgQLib | 4) +#define S_msgQLib_ILLEGAL_PRIORITY (M_msgQLib | 5) +#define S_msgQLib_UNSUPPORTED_OPERATION (M_msgQLib | 6) +#define S_msgQLib_INVALID_MSG_COUNT (M_msgQLib | 7) + +/* message queue options */ + +#define MSG_Q_TYPE_MASK 0x01 /* mask for pend queue type in options */ +#define MSG_Q_FIFO 0x00 /* tasks wait in FIFO order */ +#define MSG_Q_PRIORITY 0x01 /* tasks wait in PRIORITY order */ +#define MSG_Q_EVENTSEND_ERR_NOTIFY 0x02 /* notify when eventRsrcSend fails */ +#define MSG_Q_INTERRUPTIBLE 0x04 /* interruptible on RTP signal */ + + +/* message send priorities */ + +#define MSG_PRI_NORMAL 0 /* normal priority message */ +#define MSG_PRI_URGENT 1 /* urgent priority message */ + +/* message queue typedefs */ + +typedef struct /* MSG_Q_INFO */ + { + int numMsgs; /* OUT: number of messages queued */ + int numTasks; /* OUT: number of tasks waiting on msg q */ + + int sendTimeouts; /* OUT: count of send timeouts */ + int recvTimeouts; /* OUT: count of receive timeouts */ + + int options; /* OUT: options with which msg q was created */ + int maxMsgs; /* OUT: max messages that can be queued */ + int maxMsgLength; /* OUT: max byte length of each message */ + +#ifdef _WRS_KERNEL + int taskIdListMax; /* IN: max tasks to fill in taskIdList */ + int * taskIdList; /* PTR: array of task ids waiting on msg q */ + + int msgListMax; /* IN: max msgs to fill in msg lists */ + char ** msgPtrList; /* PTR: array of msg ptrs queued to msg q */ + int * msgLenList; /* PTR: array of lengths of msgs */ +#endif /* _WRS_KERNEL */ + + } MSG_Q_INFO; + + +/* function declarations */ + +extern MSG_Q_ID msgQCreate (int maxMsgs, int maxMsgLength, int options); +extern STATUS msgQDelete (MSG_Q_ID msgQId); +extern STATUS msgQSend (MSG_Q_ID msgQId, char *buffer, UINT nBytes, + int timeout, int priority); +extern int msgQReceive (MSG_Q_ID msgQId, char *buffer, UINT maxNBytes, + int timeout); +extern STATUS msgQInfoGet (MSG_Q_ID msgQId, MSG_Q_INFO *pInfo); +extern int msgQNumMsgs (MSG_Q_ID msgQId); +extern MSG_Q_ID msgQOpen (const char * name, int maxMsgs, + int maxMsgLength, int options, int mode, + void * context); +extern STATUS msgQClose (MSG_Q_ID msgQId); +extern STATUS msgQUnlink (const char * name); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmsgQLibCommonh */ diff --git a/h/msgQSmLib.h b/h/msgQSmLib.h new file mode 100644 index 0000000..794e901 --- /dev/null +++ b/h/msgQSmLib.h @@ -0,0 +1,62 @@ +/* msgQSmLib.h - shared message queue library header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01d,29sep92,pme removed msgQSmNumMsgs(), msgQSmSend(), msgQSmReceived() + and msgQSmInfoGet() functions prototypes. +01b,22sep92,rrr added support for c++ +01a,19jul92,pme cleaned up according to code review. + written. +*/ + +#ifndef __INCmsgQSmLibh +#define __INCmsgQSmLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "vwModNum.h" +#include "msgQLib.h" + + +/* typedefs */ + +typedef struct sm_msg_q * SM_MSG_Q_ID; /* shared message queue ID */ + + +/* macros */ + +/* The following macro determines the number of bytes needed to buffer + * a message of the specified length. The node size is rounded up for + * efficiency an alignement. The total buffer space required for a pool for + * messages each of up to bytes is: + * + * maxMsgs * SM_MSG_NODE_SIZE (maxMsgLength) + */ + +#define SM_MSG_NODE_SIZE(msgLength) \ + (((sizeof (SM_MSG_NODE) + msgLength) + 3) & ~3) + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern MSG_Q_ID msgQSmCreate (int maxMsgs, int maxMsgLength, int options); +extern void msgQSmShowInit (); + +#else /* __STDC__ */ + +extern MSG_Q_ID msgQSmCreate (); +extern void msgQSmShowInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmsgQSmLibh */ diff --git a/h/muxLib.h b/h/muxLib.h new file mode 100644 index 0000000..67c2c87 --- /dev/null +++ b/h/muxLib.h @@ -0,0 +1,198 @@ +/* muxLib.h - definitions for the MUX library */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02b,10oct01,rae merge from truestack ver 02g, base 01z (SPRs 32626, 64406) +02a,16oct00,spm merged version 02b from tor3_0_x branch (adds support for + link-level broadcasts and fixes reboot mechanism) +01z,29apr99,pul Upgraded NPT phase3 code to tor2.0.0 +01y,02mar99,pul added muxShow() declaration, removed muxDevNameGet: SPR# 24242 +01x,13nov98.n_s add muxDevStopAll. spr #23229 +01w,19mar99,sj removed nptHook structure +01v,27oct98,pul changed nptHookRtn to return STATUS +01u,12oct98,sj added TK hooks and errors +01t,08dec97,gnn END code review fixes. +01s,17oct97,vin changed prototypes. +01r,09sep98,ham corrected the comment for MUX_MAX_IFTYPE. +01q,09sep98,ham associate MUX_MAX_TYPE with IFT_MAX_TYPE,SPR#22298. +01p,08sep98,ham moved MUX_MAX_TYPE from muxLib.c,SPR#22298. +01o,06oct97,gnn added include of end.h which we need for prototypes +01n,03oct97,gnn fixed SPR 8986, added function prototypes +01m,25sep97,gnn SENS beta feedback fixes +01l,22aug97,gnn update of polled mode. +01k,19aug97,gnn changes due to new buffering scheme. +01j,12aug97,gnn changes necessitated by MUX/END update. +01i,15may97,gnn added new protocol type MUX_PROTO_OUTPUT +01h,17apr97,gnn added muxDevNameGet + changed muxDevLoad to return void* to device +01g,07apr97,gnn added new error defines. + modified muxDevLoad to follow new paradigm. +01f,12mar97,gnn fixed a bug in muxReceive's calling API. +01e,03feb97,gnn Modified muxBuf code to be more generic and support other, + non-TMD systems. +01d,21jan97,gnn Changed interfaces for muxSend. + Removed TxBuf stuff. + Added buffer management stuff. +01c,23oct96,gnn name changes to follow coding standards. +01b,22oct96,gnn added MUX_PROTO_PROMISC define to hold definition + of a pomiscuous protocol + replaced netVectors with netBuffers +01a,05May96,gnn written. + +*/ + +/* +DESCRIPTION +This file includes function prototypes for the MUX. + +INCLUDE FILES: +*/ + +#ifndef __INCmuxLibh +#define __INCmuxLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include "net/if_types.h" +#include "end.h" +/* defints */ + +/* MUX_MAX_IFTYPE associates with IFT_MAX_TYPE as default. If the user wants + * to add a resource function, verify it's smaller than MUX_MAX_IFTYPE. + */ +#define MUX_MAX_IFTYPE IFT_MAX_TYPE + +/* Error defines. */ +#define S_muxLib_LOAD_FAILED (M_muxLib | 1) +#define S_muxLib_NO_DEVICE (M_muxLib | 2) +#define S_muxLib_INVALID_ARGS (M_muxLib | 3) +#define S_muxLib_ALLOC_FAILED (M_muxLib | 4) +#define S_muxLib_ALREADY_BOUND (M_muxLib | 5) +#define S_muxLib_UNLOAD_FAILED (M_muxLib | 6) +#define S_muxLib_NOT_A_TK_DEVICE (M_muxLib | 7) +#define S_muxLib_NO_TK_DEVICE (M_muxLib | 8) +#define S_muxLib_END_BIND_FAILED (M_muxLib | 9) + + +/* These are above all SAPs but still in the ethernet size range */ +/* so won't interfere with RFC 1700 */ +#define MUX_PROTO_PROMISC 0x100 +#define MUX_PROTO_SNARF 0x101 +#define MUX_PROTO_OUTPUT 0x102 + +/* The modes in which the MUX can operate. Part of WRS 1152. */ +enum MUX_MODE {MUX_MODE_NORM, MUX_MODE_POLL}; +#define MUX_POLL_TASK_PRIORITY 255 +#define MUX_POLL_TASK_DELAY 0 + +/* Defines for the MUX in polled mode. */ + +/* typedefs */ + +/* Module Object Definition */ + +typedef struct _muxLib + { + int debug; + SEM_ID lock; /* To lock on muxDevLoads. */ + int mode; + int priority; + int taskDelay; + int taskID; + } muxLib; + +/* + * These data structures define the 2D list of address resolution + * functions. This list is ordered by ifType and the protocol. + */ +typedef struct mux_addr_rec + { + NODE node; + long protocol; + FUNCPTR addrResFunc; + } MUX_ADDR_REC; + +/* globals */ + +/* locals */ + +/* forward declarations */ + +STATUS muxLibInit (); +IMPORT void * muxDevLoad(int unit, END_OBJ* (*endLoad) (char *, void*), + char *initString, + BOOL loaning, void*pBSP); +STATUS muxDevStart(void* pCookie); +STATUS muxDevStop(void* pCookie); +void muxShow(char* pDevName, int unit); +IMPORT STATUS muxDevStopAll (int timeout); +IMPORT STATUS muxDevUnload(char* pName, int unit); +void * muxBind (char * pName, int unit, + BOOL (*stackRcvRtn) (void*, long,M_BLK_ID, LL_HDR_INFO *, + void*), + STATUS (*stackShutdownRtn) (void*, void*), + STATUS (*stackTxRestartRtn) (void*, void*), + void (*stackErrorRtn) (END_OBJ*, END_ERR*, void*), + long type, char* pProtoName, void* pSpare); +IMPORT STATUS muxUnbind(void* pCookie, long type, FUNCPTR stackShutdownRtn); +IMPORT STATUS muxSend(void* pCookie, M_BLK_ID pNBuff); +IMPORT STATUS muxReceive(void* pCookie, M_BLK_ID pNBuff); +IMPORT STATUS muxPollSend(void* pCookie, M_BLK_ID pNBuff); +IMPORT STATUS muxPollReceive(void* pCookie, M_BLK_ID pNBuff); +IMPORT STATUS muxIoctl(void* pCookie, int cmd, caddr_t data); +IMPORT STATUS muxMCastAddrAdd(void* pCookie, char* pAddress); +IMPORT STATUS muxMCastAddrDel(void* pCookie, char* pAddress); +IMPORT STATUS muxMCastAddrGet(void* pCookie, MULTI_TABLE* pTable); +IMPORT char* muxLoanGet(void* pCookie); +IMPORT UINT8* muxRefCntGet(void* pCookie); +IMPORT void muxLoanRet(void* pCookie, char* pData, UINT8* pRef); +IMPORT M_BLK_ID muxLinkHeaderCreate(void* pCookie, M_BLK_ID pPacket, + M_BLK_ID pSrcAddr, M_BLK_ID pDstAddr, + BOOL bcastFlag); +IMPORT M_BLK_ID muxAddressForm(void* pCookie, M_BLK_ID pMblk, + M_BLK_ID pSrcAddr, M_BLK_ID pDstAddr); +IMPORT STATUS muxPacketDataGet(void* pCookie, M_BLK_ID pMblk, LL_HDR_INFO *); +IMPORT STATUS muxPacketAddrGet (void* pCookie, M_BLK_ID pMblk, + M_BLK_ID pSrc, + M_BLK_ID pDst, + M_BLK_ID pESrc, + M_BLK_ID pEDst); +IMPORT void muxTxRestart(void* pCookie); + +IMPORT void muxError ( void* pCookie, END_ERR* pError ); + + +IMPORT END_OBJ* endFindByName(char* pName, int unit); +IMPORT STATUS muxAddrResFuncDel ( long ifType, long protocol ); +IMPORT FUNCPTR muxAddrResFuncGet ( long ifType, long protocol ); +IMPORT STATUS muxAddrResFuncAdd ( long ifType, long protocol, + FUNCPTR addrResFunc); + +IMPORT BOOL muxDevExists (char* pName, int unit); + +IMPORT STATUS muxTaskDelaySet ( int delay ); +IMPORT STATUS muxTaskDelayGet ( int* pDelay ); +IMPORT STATUS muxTaskPrioritySet ( int priority ); +IMPORT STATUS muxTaskPriorityGet ( int* pPriority ); +#ifdef ROUTER_STACK +IMPORT void * muxProtoPrivDataGet (END_OBJ * pEnd, int proto); +#endif /* ROUTER_STACK */ + +IMPORT STATUS muxPollDevAdd (int, char *); +IMPORT STATUS muxPollDevDel (int, char *); +IMPORT BOOL muxPollDevStat (int, char *); +IMPORT void muxPollTask (void); +IMPORT STATUS muxPollStart (int, int, int); +IMPORT STATUS muxPollEnd (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmuxLibh */ diff --git a/h/muxTkLib.h b/h/muxTkLib.h new file mode 100644 index 0000000..fbf6d52 --- /dev/null +++ b/h/muxTkLib.h @@ -0,0 +1,74 @@ +/* muxTkLib.h - definitions for muxTkLib.c */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,10oct01,rae merge from truestack (add muxTkCookieGet) +01i,16oct00,niq Integrating T3 DHCP +01h,29apr99,pul Upgraded NPT phase3 code to tor2.0.0 +01g,30mar99,pul removed all muxMCastMap and muxSvcFunc function declarations +01f,24feb99,sj added muxTkPollReceive +01e,23feb99,sj added spare data last argument for muxTkSend and muxTkPollSend +01d,06nov98,sj removed prototypes for muxTkReceive and nptHookRtn +01c,27oct98,pul changed nptHookRtn declaration to return STATUS. +01b,09oct98,sj fixed bad prototype for muxMCastMapFuncGet +01a,07oct98,pul written. +*/ + +/* +DESCRIPTION +This file includes function prototypes for the MUX. + +INCLUDE FILES: muxLib.h +*/ + +#ifndef __INCmuxTkLibh +#define __INCmuxTkLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include "muxLib.h" +/* defines */ + +/* typedefs */ + +/* locals */ + +/* globals */ +IMPORT int muxMaxBinds; + +/* forward declarations */ + +/* Toolkit functions */ +IMPORT STATUS muxTkLibInit (void); +IMPORT int muxTkDrvCheck (char * pDevName); + +IMPORT void * muxTkBind (char * pName, int unit, + BOOL (*stackRcvRtn) (void *, long, M_BLK_ID, void *), + STATUS (*stackShutdownRtn) (void *), + STATUS (*stackTxRestartRtn) (void *), + void (*stackErrorRtn) (void *, END_ERR *), + long type, char * pProtoName, void * pNetSvcStruct, + void * pNetSvcInfo, void * pNetDrvInfo); + + +IMPORT STATUS muxTkSend (void * pCookie, M_BLK_ID pNBuff, char *, + USHORT, void *); +IMPORT STATUS muxTkPollSend (void * pCookie, M_BLK_ID pNBuff, char *, + USHORT, void *); +IMPORT STATUS muxTkPollReceive (void * pCookie, M_BLK_ID pNBuff, void *pSpare); + +IMPORT STATUS muxTkPollReceive2 (void *, M_BLK_ID pNBuff); + +IMPORT void * muxTkCookieGet (char *, int); +#ifdef __cplusplus +} +#endif + +#endif /* __INCmuxTkLibh */ + diff --git a/h/namei.h b/h/namei.h new file mode 100644 index 0000000..084baa0 --- /dev/null +++ b/h/namei.h @@ -0,0 +1,227 @@ +/* namei.h - vnode/AFF lookup interface */ + +/* Copyright 2005 Wind River Systems, Inc */ + +/* +modification history +-------------------- +01a,20jun05,act add vnCheckPath() and vnReLookup() prototypes +*/ + +/* $NetBSD: namei.h,v 1.37 2004/06/27 08:50:44 yamt Exp $ */ +/* BSDI $Id: namei.h,v 2.5 2001/11/13 22:43:19 fmayhar Exp $ */ + +/* + * Copyright (c) 1985, 1989, 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)namei.h 8.5 (Berkeley) 8/20/94 + */ + +#ifndef __INCnameih +#define __INCnameih + +#include "net/uio.h" +#include "sys/queue.h" +#include "vnode.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XXX should be in errno.h + */ +#define EJUSTRETURN (-2) + +/* + * Lookup parameters: this structure describes the subset of + * information from the nameidata structure that is passed + * through the VOP interface. + */ +struct componentname { + /* + * Arguments to lookup. + */ + int cn_nameiop; /* operation */ + ULONG cn_flags; /* and flags */ + struct ucred *cn_cred; /* credentials */ + /* + * Shared between lookup and commit routines. + */ + char *cn_pnbuf; /* pathname buffer */ + char *cn_nameptr; /* pointer to looked up name */ + long cn_namelen; /* length of looked up component */ + ULONG cn_hash; /* hash value of looked up name */ + long cn_consume; /* chars to consume in lookup() */ +}; + +/* + * Encapsulation of namei parameters. + */ +struct nameidata { + /* + * Arguments to namei/lookup. + */ + char *ni_dirp; /* pathname pointer */ + struct mount *ni_mp; /* mount point (from core I/O) */ + + /* + * Arguments to lookup. + * + * Note that unlike BSD, we always have "absolute" path names + * and the "rootdir" is based on the mount point. + */ + struct vnode *ni_startdir; /* starting directory */ + struct vnode *ni_rootdir; /* logical root directory */ + + /* + * Results: returned from/manipulated by lookup + */ + struct vnode *ni_vp; + struct vnode *ni_dvp; + + /* + * Shared between namei and lookup/commit routines. + */ + size_t ni_pathlen; /* remaining chars in path */ + char *ni_next; /* next location in path */ + + struct componentname ni_cnd; +}; + +/* + * namei operations + */ +#define LOOKUP 0 /* perform name lookup only */ +#define CREATE 1 /* setup for file creation */ +#define DELETE 2 /* setup for file deletion */ +#define RENAME 3 /* setup for file renaming */ +/* + * namei operational modifiers, stored in ni_cnd.cn_flags + */ +#define LOCKLEAF 0x0004 /* lock inode on return */ +#define LOCKPARENT 0x0008 /* want parent vnode returned locked */ +#define WANTPARENT 0x0010 /* want parent vnode returned unlocked */ +#define NOCACHE 0x0020 /* name must not be left in cache */ +#define FOLLOW 0x0040 /* follow symbolic links */ +#define NOSYMLINK 0x0080 /* symbolic links are an error */ +#define NOFOLLOW 0x0000 /* do not follow symbolic links (pseudo) */ +#define MODMASK 0x00fc /* mask of operational modifiers */ +/* + * Namei parameter descriptors. + * + * SAVENAME may be set by VOP_LOOKUP(). + * In vxWorks, we never copy the name to a malloc()ed buffer, so + * the flag has no real meaning -- when we are called from Core I/O we + * already have the name in a buffer, which we just use. + * + * SAVESTART is set only by the callers of namei. It implies SAVENAME + * plus the addition of saving the parent directory that contains the + * name in ni_startdir. This allows repeated calls to lookup for the + * name being sought. The caller is responsible for vrele'ing ni_startdir. + * + * NOCROSSMOUNT is for NFS and is not used in vxWorks anyway, as we + * never cross mount points in namei(). + */ +#define NOCROSSMOUNT 0x0000100 /* do not cross mount points */ +#define RDONLY 0x0000200 /* lookup with read-only semantics */ +/* HASBUF 0x0000400 -- we malloc'ed a pathname buffer */ +#define SAVENAME 0x0000800 /* save pathname buffer [N/A] */ +#define SAVESTART 0x0001000 /* save starting directory */ +#define ISDOTDOT 0x0002000 /* current component name is .. */ +#define MAKEENTRY 0x0004000 /* entry is to be added to name cache */ +#define ISLASTCN 0x0008000 /* this is last component of pathname */ +#define ISSYMLINK 0x0010000 /* symlink needs interpretation */ +/* ISWHITEOUT 0x0020000 -- found whiteout */ +/* DOWHITEOUT 0x0040000 -- do whiteouts */ +/* REQUIREDIR 0x0080000 -- must be a directory */ +#define PDIRUNLOCK 0x0100000 /* vop_lookup unlocked parent dir */ +/* CREATEDIR 0x0200000 -- creating entry is a directory */ + +/* + * Initializtion of a nameidata structure. + */ +#define NDINIT(ndp, op, flags, mp, namep, cred) do { \ + (ndp)->ni_cnd.cn_nameiop = op; \ + (ndp)->ni_cnd.cn_flags = flags; \ + (ndp)->ni_mp = mp; \ + (ndp)->ni_dirp = namep; \ + (ndp)->ni_cnd.cn_cred = cred; \ +} while (0) + +#ifdef notyet +/* + * This structure describes the elements in the cache of recent + * names looked up by namei. Names longer than NCHNAMLEN are not + * stored in the cache. + */ +#define NCHNAMLEN 31 /* maximum name segment length we bother with */ + +struct namecache { + LIST_ENTRY(namecache) nc_hash; /* hash chain */ + TAILQ_ENTRY(namecache) nc_lru; /* LRU chain */ + LIST_ENTRY(namecache) nc_vhash; /* directory hash chain */ + LIST_ENTRY(namecache) nc_dvlist; + struct vnode *nc_dvp; /* vnode of parent of name */ + LIST_ENTRY(namecache) nc_vlist; + struct vnode *nc_vp; /* vnode the name refers to */ + uchar nc_len; /* length of name */ + char nc_name[NCHNAMLEN]; /* segment name */ +}; + +/* + * Stats on usefulness of namei caches. + */ +struct nchstats { + ULONG ncs_goodhits; /* hits that we can really use */ + ULONG ncs_neghits; /* negative hits that we can use */ + ULONG ncs_badhits; /* hits we must drop */ + ULONG ncs_falsehits; /* hits with id mismatch */ + ULONG ncs_miss; /* misses */ + ULONG ncs_long; /* long names that ignore cache */ + ULONG ncs_pass2; /* names found with passes == 2 */ + ULONG ncs_2passes; /* number of times we attempt it */ +}; +#endif /* notyet */ + +/* + * Pathname-related functions. + * + * Currently, namei() is not exported at all (is local to vnodeAff.c); + * if we export it we should declare it here, but perhaps also change + * its name. + */ +/* int namei(struct nameidata *); */ +int vnCheckPath(struct vnode *, struct vnode *, struct componentname *); +int vnReLookup(struct vnode *, struct vnode **, struct componentname *, int); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnameih */ diff --git a/h/net/af.h b/h/net/af.h new file mode 100644 index 0000000..c639ae7 --- /dev/null +++ b/h/net/af.h @@ -0,0 +1,94 @@ +/* af.h - address family header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* + * Copyright (c) 1980, 1986 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * @(#)af.h 7.3 (Berkeley) 6/27/88 + */ + + +/* +modification history +-------------------- +01h,22sep92,rrr added support for c++ +01g,26may92,rrr the tree shuffle +01f,04oct91,rrr passed through the ansification filter + -changed copyright notice +01e,05oct90,shl added copyright notice. + made #endif ANSI style. +01d,16apr89,gae updated to new 4.3BSD. +01c,03apr87,ecs added header and copyright. +01b,22dec86,dnw added IMPORT to declaration of afswitch to satisfy + Intermetrics assembler. +*/ + +#ifndef __INCafh +#define __INCafh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Address family routines, + * used in handling generic sockaddr structures. + * + * Hash routine is called + * af_hash(addr, h); + * struct sockaddr *addr; struct afhash *h; + * producing an afhash structure for addr. + * + * Netmatch routine is called + * af_netmatch(addr1, addr2); + * where addr1 and addr2 are sockaddr *. Returns 1 if network + * values match, 0 otherwise. + */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +struct afswitch { + int (*af_hash)(); + int (*af_netmatch)(); + int (*af_output)(); /* interprets address for sending */ + int (*af_portmatch)(); /* packet from some other router? */ + int (*af_portcheck)(); /* packet from privileged peer? */ + int (*af_checkhost)(); /* tells if address is valid */ + int (*af_rtflags)(); /* get flags for route (host or net) */ + int (*af_sendroute)(); /* check bounds of subnet broadcast */ + int (*af_canon)(); /* canonicalize address for compares */ + char *(*af_format)(); /* convert address to string */ +}; + +struct afhash { + u_int afh_hosthash; + u_int afh_nethash; +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +IMPORT struct afswitch afswitch[]; +extern int af_max; /* number of entries in table */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCafh */ diff --git a/h/net/bpf.h b/h/net/bpf.h new file mode 100644 index 0000000..6f4fed8 --- /dev/null +++ b/h/net/bpf.h @@ -0,0 +1,275 @@ +/* bpf.h - Berkeley Packet Filter (BPF) definitions and structures */ + +/* Copyright 1999 - 2002 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/*- + * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)bpf.h 7.1 (Berkeley) 5/7/91 + * + * @(#) $Header: bpf.h,v 1.36 97/06/12 14:29:53 leres Exp $ (LBL) + */ + +/* +modification history +-------------------- +01c,28apr02,rae added extern C jazz (SPR #76303) +01b,05apr00,spm added interface to temporarily suspend filtering +01a,24nov99,spm created from BSD bpf.c,v 1.67 96/09/26 22:00:52 +*/ + +#ifndef BPF_MAJOR_VERSION + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "sys/times.h" +#include "net/if.h" + +/* BSD style release date */ +#define BPF_RELEASE 199606 + +typedef int bpf_int32; +typedef u_int bpf_u_int32; + +/* + * Alignment macros. BPF_WORDALIGN rounds up to the next + * even multiple of BPF_ALIGNMENT. + */ +#define BPF_ALIGNMENT sizeof(bpf_int32) +#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1)) + +#define BPF_MAXINSNS 512 +#define BPF_MAXBUFSIZE 0x8000 +#define BPF_MINBUFSIZE 32 + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Structure for BIOCSETF. + */ +struct bpf_program { + u_int bf_len; + struct bpf_insn *bf_insns; +}; + +/* + * Struct returned by BIOCGSTATS. + */ +struct bpf_stat { + u_int bs_recv; /* number of packets received */ + u_int bs_drop; /* number of packets dropped */ +}; + +/* + * Struct return by BIOCVERSION. This represents the version number of + * the filter language described by the instruction encodings below. + * bpf understands a program iff kernel_major == filter_major && + * kernel_minor >= filter_minor, that is, if the value returned by the + * running kernel has the same major number and a minor number equal + * equal to or less than the filter being downloaded. Otherwise, the + * results are undefined, meaning an error may be returned or packets + * may be accepted haphazardly. + * It has nothing to do with the source code version. + */ +struct bpf_version { + u_short bv_major; + u_short bv_minor; +}; + +/* Current version number of filter architecture. */ +#define BPF_MAJOR_VERSION 1 +#define BPF_MINOR_VERSION 1 + +/* + * BPF ioctls + */ + +#define BIOCGBLEN _IOR('B',102, u_int) +#define BIOCSBLEN _IOWR('B',102, u_int) +#define BIOCSETF _IOW('B',103, struct bpf_program) +#define BIOCFLUSH _IO('B',104) +#define BIOCPROMISC _IO('B',105) +#define BIOCGDLT _IOR('B',106, u_int) +#define BIOCGETIF _IOR('B',107, struct ifreq) +#define BIOCSETIF _IOW('B',108, struct ifreq) +#define BIOCSRTIMEOUT _IOW('B',109, struct timeval) +#define BIOCGRTIMEOUT _IOR('B',110, struct timeval) +#define BIOCGSTATS _IOR('B',111, struct bpf_stat) +#define BIOCIMMEDIATE _IOW('B',112, u_int) +#define BIOCVERSION _IOR('B',113, struct bpf_version) +#define BIOCSTCPF _IOW('B',114, struct bpf_program) +#define BIOCSUDPF _IOW('B',115, struct bpf_program) + +/* + * Re-use (unsupported) BIOCSTCPF and BIOCSUDPF macro values + * for custom operations allowing BPF devices to pause and + * resume the filtering process (without closing the device). + */ + +#define BIOCSTOP _IO('B',114) +#define BIOCSTART _IOW('B',115, struct ifreq) + +/* + * Structure prepended to each packet. + */ +struct bpf_hdr { + struct timeval bh_tstamp; /* time stamp */ + bpf_u_int32 bh_caplen; /* length of captured portion */ + bpf_u_int32 bh_datalen; /* original length of packet */ + u_short bh_hdrlen; /* length of bpf header (this struct + plus alignment padding) */ + bpf_u_int32 bh_linklen; /* length of link level header */ +}; + +/* + * Data-link level type codes. + */ +#define DLT_NULL 0 /* no link-layer encapsulation */ +#define DLT_EN10MB 1 /* Ethernet (10Mb) */ +#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */ +#define DLT_AX25 3 /* Amateur Radio AX.25 */ +#define DLT_PRONET 4 /* Proteon ProNET Token Ring */ +#define DLT_CHAOS 5 /* Chaos */ +#define DLT_IEEE802 6 /* IEEE 802 Networks */ +#define DLT_ARCNET 7 /* ARCNET */ +#define DLT_SLIP 8 /* Serial Line IP */ +#define DLT_PPP 9 /* Point-to-point Protocol */ +#define DLT_FDDI 10 /* FDDI */ +#define DLT_ATM_RFC1483 11 /* LLC/SNAP encapsulated atm */ +#define DLT_RAW 12 /* raw IP */ +#define DLT_SLIP_BSDOS 13 /* BSD/OS Serial Line IP */ +#define DLT_PPP_BSDOS 14 /* BSD/OS Point-to-point Protocol */ + +/* + * The instruction encondings. + */ +/* instruction classes */ +#define BPF_CLASS(code) ((code) & 0x07) +#define BPF_LD 0x00 +#define BPF_LDX 0x01 +#define BPF_ST 0x02 +#define BPF_STX 0x03 +#define BPF_ALU 0x04 +#define BPF_JMP 0x05 +#define BPF_RET 0x06 +#define BPF_MISC 0x07 + +/* ld/ldx fields */ +#define BPF_SIZE(code) ((code) & 0x18) +#define BPF_W 0x00 +#define BPF_H 0x08 +#define BPF_B 0x10 +#define BPF_MODE(code) ((code) & 0xe0) +#define BPF_IMM 0x00 +#define BPF_ABS 0x20 +#define BPF_IND 0x40 +#define BPF_MEM 0x60 +#define BPF_LEN 0x80 +#define BPF_MSH 0xa0 + +/* alu/jmp fields */ +#define BPF_OP(code) ((code) & 0xf0) +#define BPF_ADD 0x00 +#define BPF_SUB 0x10 +#define BPF_MUL 0x20 +#define BPF_DIV 0x30 +#define BPF_OR 0x40 +#define BPF_AND 0x50 +#define BPF_LSH 0x60 +#define BPF_RSH 0x70 +#define BPF_NEG 0x80 +#define BPF_JA 0x00 +#define BPF_JEQ 0x10 +#define BPF_JGT 0x20 +#define BPF_JGE 0x30 +#define BPF_JSET 0x40 +#define BPF_SRC(code) ((code) & 0x08) +#define BPF_K 0x00 +#define BPF_X 0x08 + +/* ret - BPF_K and BPF_X also apply */ +#define BPF_RVAL(code) ((code) & 0x18) +#define BPF_A 0x10 + +/* misc */ +#define BPF_MISCOP(code) ((code) & 0xf8) +#define BPF_TAX 0x00 +#define BPF_TXA 0x80 + +/* argument values for link-layer independence ((code) & 0x300) */ +#define BPF_TYPE 0x0100 /* MUX frame type value */ +#define BPF_HLEN 0x0200 /* Offset to start of frame data */ + +/* + * The instruction data structure. + */ +typedef struct bpf_insn { + u_short code; + u_char jt; + u_char jf; + bpf_int32 k; +} BPF_INSN; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Macros for insn array initializers. + */ +#define BPF_STMT(code, k) { (u_short)(code), 0, 0, k } +#define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k } + +extern u_int bpf_filter(); +extern int bpf_validate(); + +/* + * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST). + */ +#define BPF_MEMWORDS 16 + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/net/domain.h b/h/net/domain.h new file mode 100644 index 0000000..894d11e --- /dev/null +++ b/h/net/domain.h @@ -0,0 +1,94 @@ +/* domain.h - domain header file */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)domain.h 8.1 (Berkeley) 6/2/93 + */ + +/* + * Structure per communications domain. + */ + +/* +modification history +-------------------- +01b,07jul97,vin added declaration for addDomain() and domaininit(). +01a,03mar96,vin created from BSD4.4 stuff. +*/ + +#ifndef __INCdomainh +#define __INCdomainh + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Structure per communications domain. + */ + +struct domain + { + int dom_family; /* AF_xxx */ + char *dom_name; + int (*dom_init)(); /* initialize domain data structures */ + int (*dom_externalize)(); /* externalize access rights */ + int (*dom_dispose)(); /* dispose of internalized rights */ + struct protosw *dom_protosw; + struct protosw *dom_protoswNPROTOSW; + struct domain *dom_next; + int (*dom_rtattach)(); /* initialize routing table */ + int dom_rtoffset; /* an arg to rtattach, in bits */ + int dom_maxrtkey; /* for routing layer */ + }; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +extern struct domain *domains; + +extern void domaininit (void); +extern int addDomain (struct domain * pDomain); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdomainh */ diff --git a/h/net/if.h b/h/net/if.h new file mode 100644 index 0000000..a0790af --- /dev/null +++ b/h/net/if.h @@ -0,0 +1,469 @@ +/* if.h - network interface header file */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if.h 8.1 (Berkeley) 6/10/93 + */ + +/* +modification history +-------------------- +01m,10oct01,rae merge from truestack ver 01o, base 01j (SPR #69683) +01l,17oct00,spm merged from version 01k of tor2_0_x branch (base version 01j): + updated if_attach to report memory allocation failures +01k,29apr99,pul Upgraded NPT phase3 code to tor2.0.0 +01j,17mar99,spm added support for identical unit numbers (SPR #20913) +01i,12dec97,gnn removed a lingering reference to IFF_SCAT. +01h,11dec97,gnn removed IFF_SCAT and IFF_LOAN. +01g,05oct97,vin added field in ifnet for holding multicast addrs +01f,01jul97,vin removed some double declarations. +01e,24feb97,bjl moved struct ifqueue declaration outside of struct ifnet + to make struct ifqueue globally visible for c++ +01d,31jan97,vin added prototypes for functions in ifnet (). +01c,21jan97,gnn added IFF_SCAT for scatter/gather capable drivers. +01b,27aug96,gnn added IFF_LOAN for buffer loaning drivers, added ifmreq + structure to we can retrieve multicast tables +01a,03mar96,vin created from BSD4.4 stuff,integrated with 02q of if.h. +*/ + +#ifndef __INCifh +#define __INCifh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "sys/socket.h" +#include "net/if_arp.h" +#include "net/route.h" +#include "ifLib.h" + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Structures defining a network interface, providing a packet + * transport mechanism (ala level 0 of the PUP protocols). + * + * Each interface accepts output datagrams of a specified maximum + * length, and provides higher level routines with input datagrams + * received from its medium. + * + * Output occurs when the routine if_output is called, with three parameters: + * (*ifp->if_output)(ifp, m, dst) + * Here m is the mbuf chain to be sent and dst is the destination address. + * The output routine encapsulates the supplied datagram if necessary, + * and then transmits it on its medium. + * + * On input, each interface unwraps the data received by it, and either + * places it on the input queue of a internetwork datagram routine + * and posts the associated software interrupt, or passes the datagram to a raw + * packet input routine. + * + * Routines exist for locating interfaces by their addresses + * or for locating a interface on a certain network, as well as more general + * routing and gateway routines maintaining information used to locate + * interfaces. These routines live in the files if.c and route.c + */ + +struct ifqueue { + struct mbuf *ifq_head; + struct mbuf *ifq_tail; + int ifq_len; + int ifq_maxlen; + int ifq_drops; +}; + +struct mbuf; +struct proc; +struct rtentry; +struct socket; +struct ether_header; + +/* + * Structure defining statistics and other data kept regarding a network + * interface. + */ +struct if_data { + /* generic interface information */ + u_char ifi_type; /* ethernet, tokenring, etc. */ + u_char ifi_addrlen; /* media address length */ + u_char ifi_hdrlen; /* media header length */ + u_long ifi_mtu; /* maximum transmission unit */ + u_long ifi_metric; /* routing metric (external only) */ + u_long ifi_baudrate; /* linespeed */ + /* volatile statistics */ + u_long ifi_ipackets; /* packets received on interface */ + u_long ifi_ierrors; /* input errors on interface */ + u_long ifi_opackets; /* packets sent on interface */ + u_long ifi_oerrors; /* output errors on interface */ + u_long ifi_collisions; /* collisions on csma interfaces */ + u_long ifi_ibytes; /* total number of octets received */ + u_long ifi_obytes; /* total number of octets sent */ + u_long ifi_imcasts; /* packets received via multicast */ + u_long ifi_omcasts; /* packets sent via multicast */ + u_long ifi_iqdrops; /* dropped on input, this interface */ + u_long ifi_noproto; /* destined for unsupported protocol */ + u_long ifi_lastchange; /* last updated */ +}; + +/* + * Structure defining a queue for a network interface. + * + * (Would like to call this struct ``if'', but C isn't PL/1.) + */ + +struct ifnet { + char *if_name; /* name, e.g. ``en'' or ``lo'' */ + struct ifnet *if_next; /* all struct ifnets are chained */ + struct ifaddr *if_addrlist; /* linked list of addresses per if */ + int if_pcount; /* number of promiscuous listeners */ + caddr_t if_bpf; /* packet filter structure */ + u_short if_index; /* numeric abbreviation for this if */ + short if_unit; /* sub-unit for lower level driver */ + short if_timer; /* time 'til if_watchdog called */ + short if_flags; /* up/down, broadcast, etc. */ + struct if_data if_data; /* statistics and other data about if */ + struct mBlk * pInmMblk; /* chain of multicast addresses */ + int (*if_init) + (int unit); /* init routine */ + int (*if_output) /* output routine */ + (struct ifnet *, struct mbuf *, struct sockaddr *, + struct rtentry *); + int (*if_start) /* initiate output routine */ + (struct ifnet *); + int (*if_ioctl) /* ioctl routine */ + (struct ifnet *, int cmd, caddr_t data); + int (*if_reset) /* bus reset routine */ + (int unit); + int (*if_resolve)(); /* arp resolve at driver level */ + void (*if_watchdog) /* timer routine */ + (int unit); + struct ifqueue if_snd; /* output queue */ + void * pCookie; /* data for IP over MUX attachment */ +#ifdef VIRTUAL_STACK + int vsNum; /* virtual stack number */ +#endif +}; + +#define if_mtu if_data.ifi_mtu +#define if_type if_data.ifi_type +#define if_addrlen if_data.ifi_addrlen +#define if_hdrlen if_data.ifi_hdrlen +#define if_metric if_data.ifi_metric +#define if_baudrate if_data.ifi_baudrate +#define if_ipackets if_data.ifi_ipackets +#define if_ierrors if_data.ifi_ierrors +#define if_opackets if_data.ifi_opackets +#define if_oerrors if_data.ifi_oerrors +#define if_collisions if_data.ifi_collisions +#define if_ibytes if_data.ifi_ibytes +#define if_obytes if_data.ifi_obytes +#define if_imcasts if_data.ifi_imcasts +#define if_omcasts if_data.ifi_omcasts +#define if_iqdrops if_data.ifi_iqdrops +#define if_noproto if_data.ifi_noproto +#define if_lastchange if_data.ifi_lastchange + +#define IFF_UP 0x1 /* interface is up */ +#define IFF_BROADCAST 0x2 /* broadcast address valid */ +#define IFF_DEBUG 0x4 /* turn on debugging */ +#define IFF_LOOPBACK 0x8 /* is a loopback net */ +#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */ +#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */ +#define IFF_RUNNING 0x40 /* resources allocated */ +#define IFF_NOARP 0x80 /* no address resolution protocol */ +#define IFF_PROMISC 0x100 /* receive all packets */ +#define IFF_ALLMULTI 0x200 /* receive all multicast packets */ +#define IFF_OACTIVE 0x400 /* transmission in progress */ +#define IFF_SIMPLEX 0x800 /* can't hear own transmissions */ +#define IFF_LINK0 0x1000 /* fastPath enabled */ +#define IFF_LINK1 0x2000 /* per link layer defined bit */ +#define IFF_LINK2 0x4000 /* per link layer defined bit */ +#define IFF_MULTICAST 0x8000 /* supports multicast */ +#define IFF_RFC2233 0x10000 /* supports RFC 2223 MIB */ +#define IFF_UNNUMBERED IFF_POINTOPOINT /* supports unnumbered interafaces */ + +/* flags set internally only: */ +#define IFF_CANTCHANGE \ + (IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\ + IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI) + +#define IFF_FP_ENABLE IFF_LINK0 /* fastpath enabled */ +/* + * Output queues (ifp->if_snd) and internetwork datagram level (pup level 1) + * input routines have queues of messages stored on ifqueue structures + * (defined above). Entries are added to and deleted from these structures + * by these macros, which should be called with ipl raised to splimp(). + */ +#define IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen) +#define IF_DROP(ifq) ((ifq)->ifq_drops++) +#define IF_ENQUEUE(ifq, m) { \ + (m)->m_nextpkt = 0; \ + if ((ifq)->ifq_tail == 0) \ + (ifq)->ifq_head = m; \ + else \ + (ifq)->ifq_tail->m_nextpkt = m; \ + (ifq)->ifq_tail = m; \ + (ifq)->ifq_len++; \ +} +#define IF_PREPEND(ifq, m) { \ + (m)->m_nextpkt = (ifq)->ifq_head; \ + if ((ifq)->ifq_tail == 0) \ + (ifq)->ifq_tail = (m); \ + (ifq)->ifq_head = (m); \ + (ifq)->ifq_len++; \ +} + +/* + * Packets destined for level-1 protocol input routines + * have a pointer to the receiving interface prepended to the data. + * IF_DEQUEUEIF extracts and returns this pointer when dequeueing the packet. + * IF_ADJ should be used otherwise to adjust for its presence. + */ +#define IF_ADJ(m) { \ + (m)->m_off += sizeof(struct ifnet *); \ + (m)->m_len -= sizeof(struct ifnet *); \ + if ((m)->m_len == 0) { \ + struct mbuf *n; \ + MFREE((m), n); \ + (m) = n; \ + } \ +} +#if CPU_FAMILY==SH /* Changed at OCt-20-94 byS.Awai */ +#define IF_DEQUEUEIF(ifq, m, ifp) { \ + (m) = (ifq)->ifq_head; \ + if (m) { \ + if (((ifq)->ifq_head = (m)->m_act) == 0) \ + (ifq)->ifq_tail = 0; \ + (m)->m_act = 0; \ + (ifq)->ifq_len--; \ + (ifp) = (struct ifnet *)( \ + (*((u_short *)((int)(m)+(m)->m_off+0)) << 16) | \ + (*((u_short *)((int)(m)+(m)->m_off+2)) ) ); \ + IF_ADJ(m); \ + } \ +} +#else /* orig */ +#define IF_DEQUEUEIF(ifq, m, ifp) { \ + (m) = (ifq)->ifq_head; \ + if (m) { \ + if (((ifq)->ifq_head = (m)->m_act) == 0) \ + (ifq)->ifq_tail = 0; \ + (m)->m_act = 0; \ + (ifq)->ifq_len--; \ + (ifp) = *(mtod((m), struct ifnet **)); \ + IF_ADJ(m); \ + } \ +} +#endif +#define IF_DEQUEUE(ifq, m) { \ + (m) = (ifq)->ifq_head; \ + if (m) { \ + if (((ifq)->ifq_head = (m)->m_nextpkt) == 0) \ + (ifq)->ifq_tail = 0; \ + (m)->m_nextpkt = 0; \ + (ifq)->ifq_len--; \ + } \ +} + +#define IFQ_MAXLEN 50 +#define IFNET_SLOWHZ 1 /* granularity is 1 second */ + +/* + * The ifaddr structure contains information about one address + * of an interface. They are maintained by the different address families, + * are allocated and attached when an address is set, and are linked + * together so all addresses for an interface can be located. + */ +struct ifaddr { + struct sockaddr *ifa_addr; /* address of interface */ + struct sockaddr *ifa_dstaddr; /* other end of p-to-p link */ +#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ + struct sockaddr *ifa_netmask; /* used to determine subnet */ + struct ifnet *ifa_ifp; /* back-pointer to interface */ + struct ifaddr *ifa_next; /* next address for interface */ + void (*ifa_rtrequest)(); /* check or clean routes (+ or -)'d */ + u_short ifa_flags; /* mostly rt_flags for cloning */ + short ifa_refcnt; /* count of references */ + int ifa_metric; /* cost of going out this interface */ +}; +#define IFA_ROUTE RTF_UP /* route installed */ + +/* + * Message format for use in obtaining information about interfaces + * from sysctl and the routing socket. + */ +struct if_msghdr { + u_short ifm_msglen; /* to skip over non-understood messages */ + u_char ifm_version; /* future binary compatability */ + u_char ifm_type; /* message type */ + int ifm_addrs; /* like rtm_addrs */ + int ifm_flags; /* value of if_flags */ + u_short ifm_index; /* index for associated ifp */ + struct if_data ifm_data;/* statistics and other data about if */ +}; + +/* + * Message format for use in obtaining information about interface addresses + * from sysctl and the routing socket. + */ +struct ifa_msghdr { + u_short ifam_msglen; /* to skip over non-understood messages */ + u_char ifam_version; /* future binary compatability */ + u_char ifam_type; /* message type */ + int ifam_addrs; /* like rtm_addrs */ + int ifam_flags; /* value of ifa_flags */ + u_short ifam_index; /* index for associated ifp */ + int ifam_metric; /* value of ifa_metric */ +}; + +/* + * Interface request structure used for socket + * ioctl's. All interface ioctl's must have parameter + * definitions which begin with ifr_name. The + * remainder may be interface specific. + */ +struct ifreq { +#define IFNAMSIZ 16 + char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + union { + struct sockaddr ifru_addr; + struct sockaddr ifru_dstaddr; + struct sockaddr ifru_broadaddr; + short ifru_flags; + int ifru_metric; + caddr_t ifru_data; + } ifr_ifru; +#define ifr_addr ifr_ifru.ifru_addr /* address */ +#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ +#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ +#define ifr_flags ifr_ifru.ifru_flags /* flags */ +#define ifr_metric ifr_ifru.ifru_metric /* metric */ +#define ifr_data ifr_ifru.ifru_data /* for use by interface */ +}; + +struct ifaliasreq { + char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + struct sockaddr ifra_addr; + struct sockaddr ifra_broadaddr; + struct sockaddr ifra_mask; +}; + +/* + * Interface request structure used for getting + * the multicast table from a driver. + */ +struct ifmreq { +#define IFNAMSIZ 16 + char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + int ifr_tableLen; + char *ifr_table; +}; + +/* + * Structure used in SIOCGIFCONF request. + * Used to retrieve interface configuration + * for machine (useful for programs which + * must know all networks accessible). + */ +struct ifconf { + int ifc_len; /* size of associated buffer */ + union { + caddr_t ifcu_buf; + struct ifreq *ifcu_req; + } ifc_ifcu; +#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ +#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ +}; + +/* + * Structure used in SIOCGMTU request. + * Used to retrieve the MTU for point-to-multipoint devices. + */ + +typedef struct mtuQuery_t + { + UCHAR family; + UINT32 dstIpAddr; + UINT32 mtu; + } MTU_QUERY; + +#define IFAFREE(ifa) \ + if ((ifa)->ifa_refcnt <= 0) \ + ifafree(ifa); \ + else \ + (ifa)->ifa_refcnt--; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +extern struct ifnet * ifnet; /* declared in if.c */ +extern struct ifqueue rawintrq; /* raw packet input queue */ + +extern STATUS if_attach (struct ifnet *); +extern void if_down (struct ifnet *); +extern void if_qflush (struct ifqueue *); + +#ifndef VIRTUAL_STACK +extern void if_slowtimo (void); +#else +extern void if_slowtimo (int stackNum); +#endif /* VIRTUAL_STACK */ + +extern void if_up (struct ifnet *); +extern int ifconf (int, caddr_t); +extern void ifinit (void); +extern int ifioctl (struct socket *, u_long, caddr_t); +extern int ifpromisc (struct ifnet *, int); +extern struct ifaddr * ifa_ifwithaddr (struct sockaddr *); +extern struct ifaddr * ifa_ifwithaf (int); +extern struct ifaddr * ifa_ifwithdstaddr (struct sockaddr *); +extern struct ifaddr * ifa_ifwithnet (struct sockaddr *); +extern struct ifaddr * ifaof_ifpforaddr (struct sockaddr *, struct ifnet *); +extern struct ifaddr * ifa_ifwithroute(int, struct sockaddr *, + struct sockaddr*); +extern void ifafree (struct ifaddr *); +extern void link_rtrequest (int, struct rtentry *, + struct sockaddr *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCifh */ diff --git a/h/net/if_arp.h b/h/net/if_arp.h new file mode 100644 index 0000000..256f968 --- /dev/null +++ b/h/net/if_arp.h @@ -0,0 +1,120 @@ +/* if_arp.h - network interface address resolution protocol header file */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if_arp.h 8.1 (Berkeley) 6/10/93 + */ + +/* +modification history +-------------------- +01d,10oct01,rae merge from truestack (ATF_INCOMPLETE) +01c,07feb01,spm added merge record for 30jan01 update from version 01b of + tor2_0_x branch (base 01a) and fixed modification history +01b,30jan01,ijm merged SPR# 28602 fixes: proxy ARP services are obsolete +01a,03mar96,vin created from BSD4.4 stuff,integrated with 02h of if_arp.h +*/ + +#ifndef __INCif_arph +#define __INCif_arph + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ +/* + * Address Resolution Protocol. + * + * See RFC 826 for protocol description. ARP packets are variable + * in size; the arphdr structure defines the fixed-length portion. + * Protocol type values are the same as those for 10 Mb/s Ethernet. + * It is followed by the variable-sized fields ar_sha, arp_spa, + * arp_tha and arp_tpa in that order, according to the lengths + * specified. Field names used correspond to RFC 826. + */ +struct arphdr { + u_short ar_hrd; /* format of hardware address */ +#define ARPHRD_ETHER 1 /* ethernet hardware format */ +#define ARPHRD_FRELAY 15 /* frame relay hardware format */ + u_short ar_pro; /* format of protocol address */ + u_char ar_hln; /* length of hardware address */ + u_char ar_pln; /* length of protocol address */ + u_short ar_op; /* one of: */ +#define ARPOP_REQUEST 1 /* request to resolve address */ +#define ARPOP_REPLY 2 /* response to previous request */ +#define ARPOP_REVREQUEST 3 /* request protocol address given hardware */ +#define ARPOP_REVREPLY 4 /* response giving protocol address */ +#define ARPOP_INVREQUEST 8 /* request to identify peer */ +#define ARPOP_INVREPLY 9 /* response identifying peer */ +/* + * The remaining fields are variable in size, + * according to the sizes above. + */ +#ifdef COMMENT_ONLY + u_char ar_sha[]; /* sender hardware address */ + u_char ar_spa[]; /* sender protocol address */ + u_char ar_tha[]; /* target hardware address */ + u_char ar_tpa[]; /* target protocol address */ +#endif +}; + +/* + * ARP ioctl request + */ +struct arpreq { + struct sockaddr arp_pa; /* protocol address */ + struct sockaddr arp_ha; /* hardware address */ + int arp_flags; /* flags */ +}; +/* arp_flags and at_flags field values */ +#define ATF_INUSE 0x01 /* entry in use */ +#define ATF_COM 0x02 /* completed entry (enaddr valid) */ +#define ATF_PERM 0x04 /* permanent entry */ +#define ATF_PUBL 0x08 /* publish entry (respond for other host) */ +#define ATF_PROXY 0x10 /* proxy server entry (wildcard h/w address) */ +#define ATF_INCOMPLETE 0x20 /* Complete a host entry */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_arph */ diff --git a/h/net/if_dl.h b/h/net/if_dl.h new file mode 100644 index 0000000..2aac091 --- /dev/null +++ b/h/net/if_dl.h @@ -0,0 +1,99 @@ +/* if_dl.h - data link level structure header file */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if_dl.h 8.1 (Berkeley) 6/10/93 + */ + +/* +modification history +-------------------- +01a,03mar96,vin created from BSD4.4lite2. +*/ + +/* + * A Link-Level Sockaddr may specify the interface in one of two + * ways: either by means of a system-provided index number (computed + * anew and possibly differently on every reboot), or by a human-readable + * string such as "il0" (for managerial convenience). + * + * Census taking actions, such as something akin to SIOCGCONF would return + * both the index and the human name. + * + * High volume transactions (such as giving a link-level ``from'' address + * in a recvfrom or recvmsg call) may be likely only to provide the indexed + * form, (which requires fewer copy operations and less space). + * + * The form and interpretation of the link-level address is purely a matter + * of convention between the device driver and its consumers; however, it is + * expected that all drivers for an interface of a given if_type will agree. + */ +#ifndef __INCif_dlh +#define __INCif_dlh + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Structure of a Link-Level sockaddr: + */ +struct sockaddr_dl { + u_char sdl_len; /* Total length of sockaddr */ + u_char sdl_family; /* AF_DLI */ + u_short sdl_index; /* if != 0, system given index for interface */ + u_char sdl_type; /* interface type */ + u_char sdl_nlen; /* interface name length, no trailing 0 reqd. */ + u_char sdl_alen; /* link level address length */ + u_char sdl_slen; /* link layer selector length */ + char sdl_data[12]; /* minimum work area, can be larger; + contains both if name and ll address */ +}; + +#define LLADDR(s) ((caddr_t)((s)->sdl_data + (s)->sdl_nlen)) + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_dlh */ diff --git a/h/net/if_llc.h b/h/net/if_llc.h new file mode 100644 index 0000000..f3dc9da --- /dev/null +++ b/h/net/if_llc.h @@ -0,0 +1,176 @@ +/* if_llc.h - link level control header file */ + +/* Copyright 1984 - 1999 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if_llc.h 8.1 (Berkeley) 6/10/93 + */ + +/* +modification history +-------------------- +01f,17mar99,spm recovered orphaned code from tor2_0_x branch (SPR #25770) +01e,18nov98,n_s added LLC_SNAP_FRAMELEN +01d,29sep98,fle doc : made it refgen parsable +01c,22dec97,vin corrected the field name "class" clashing with c++ keyword. +01b,04oct96,gnn Fixed the ifndef for this file. +01a,03mar96,vin created from BSD4.4lite2. +*/ + +#ifndef __INCif_llch +#define __INCif_llch + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * IEEE 802.2 Link Level Control headers, for use in conjunction with + * 802.{3,4,5} media access control methods. + * + * Headers here do not use bit fields due to shortcommings in many + * compilers. + */ + +struct llc { + u_char llc_dsap; + u_char llc_ssap; + union { + struct { + u_char control; + u_char format_id; + u_char u_class; + u_char window_x2; + } type_u; + struct { + u_char num_snd_x2; + u_char num_rcv_x2; + } type_i; + struct { + u_char control; + u_char num_rcv_x2; + } type_s; + struct { + u_char control; + struct frmrinfo { + u_char rej_pdu_0; + u_char rej_pdu_1; + u_char frmr_control; + u_char frmr_control_ext; + u_char frmr_cause; + } frmrinfo; + } type_frmr; + struct { + u_char control; + u_char org_code[3]; + u_short ether_type; + } type_snap; + struct { + u_char control; + u_char control_ext; + } type_raw; + } llc_un; +}; +#define llc_control llc_un.type_u.control +#define llc_control_ext llc_un.type_raw.control_ext +#define llc_fid llc_un.type_u.format_id +#define llc_class llc_un.type_u.u_class +#define llc_window llc_un.type_u.window_x2 +#define llc_frmrinfo llc_un.type_frmr.frmrinfo +#define llc_frmr_pdu0 llc_un.type_frmr.frmrinfo.rej_pdu0 +#define llc_frmr_pdu1 llc_un.type_frmr.frmrinfo.rej_pdu1 +#define llc_frmr_control llc_un.type_frmr.frmrinfo.frmr_control +#define llc_frmr_control_ext llc_un.type_frmr.frmrinfo.frmr_control_ext +#define llc_frmr_cause llc_un.type_frmr.frmrinfo.frmr_control_ext + +/* + * Don't use sizeof(struct llc_un) for LLC header sizes + */ +#define LLC_ISFRAMELEN 4 +#define LLC_UFRAMELEN 3 +#define LLC_FRMRLEN 7 + +#define LLC_SNAP_FRAMELEN 8 /* struct llc length when using type_snap */ +/* + * Unnumbered LLC format commands + */ +#define LLC_UI 0x3 +#define LLC_UI_P 0x13 +#define LLC_DISC 0x43 +#define LLC_DISC_P 0x53 +#define LLC_UA 0x63 +#define LLC_UA_P 0x73 +#define LLC_TEST 0xe3 +#define LLC_TEST_P 0xf3 +#define LLC_FRMR 0x87 +#define LLC_FRMR_P 0x97 +#define LLC_DM 0x0f +#define LLC_DM_P 0x1f +#define LLC_XID 0xaf +#define LLC_XID_P 0xbf +#define LLC_SABME 0x6f +#define LLC_SABME_P 0x7f + +/* + * Supervisory LLC commands + */ +#define LLC_RR 0x01 +#define LLC_RNR 0x05 +#define LLC_REJ 0x09 + +/* + * Info format - dummy only + */ +#define LLC_INFO 0x00 + +/* + * ISO PDTR 10178 contains among others + */ +#define LLC_X25_LSAP 0x7e +#define LLC_SNAP_LSAP 0xaa +#define LLC_ISO_LSAP 0xfe + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_llch */ diff --git a/h/net/if_subr.h b/h/net/if_subr.h new file mode 100644 index 0000000..febb2fa --- /dev/null +++ b/h/net/if_subr.h @@ -0,0 +1,88 @@ +/* if_subr.h - header for common routines for network interface drivers */ + +/* Copyright 1984 - 2000 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01n,17oct00,spm updated ether_attach to report memory allocation failures +01m,15may97,vin added additional type declarations. +01l,06sep93,jcf added prototype for netTypeInit. +01k,22sep92,rrr added support for c++ +01j,23jun92,ajm added prototype for do_protocol_with_type +01i,06jun92,elh added includes. +01h,04jun92,ajm Fixed erroneous ansi prototype. +01g,26may92,rrr the tree shuffle +01f,01apr92,elh Added ansi prototypes. Added functions. +01e,04oct91,rrr passed through the ansification filter + -changed VOID to void + -changed copyright notice +01d,19jul91,hdn moved SIZEOF_ETHERHEADER to if_ether.h. +01c,29apr91,hdn added defines and macros for TRON architecture. +01b,05oct90,shl added copyright notice. + made #endif ANSI style. +01a,10aug90,dnw written +*/ + +#ifndef __INCif_subrh +#define __INCif_subrh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "net/if.h" +#include "netinet/if_ether.h" +#include "net/mbuf.h" + +/* this macro directly calls ether_input function. */ + +#define do_protocol(eh, m, pArpcom, len) \ + ether_input((struct ifnet *)pArpcom, eh, m) + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void do_protocol_with_type (u_short type, struct mbuf *m, + struct arpcom *pArpcom, int len); + +extern int set_if_addr (struct ifnet *ifp, char *data, u_char *enaddr); + +extern STATUS ether_attach (struct ifnet *ifp, int unit, char *name, + FUNCPTR initRtn, FUNCPTR ioctlRtn, FUNCPTR outputRtn, + FUNCPTR resetRtn); + +extern void ether_ifattach (struct ifnet *); +extern void ether_input (struct ifnet *, struct ether_header *, struct mbuf *); +extern int ether_output (struct ifnet *, struct mbuf *, struct sockaddr *, + struct rtentry *); +extern char *ether_sprintf (u_char *); + + +extern STATUS netTypeAdd (int etherType, FUNCPTR inputRtn); +extern STATUS netTypeDelete (int etherType); +extern void netTypeInit (); + +#else + +extern void do_protocol (); +extern void do_protocol_with_type (); +extern int ether_output (); +extern int set_if_addr (); +extern void ether_attach (); +extern STATUS netTypeAdd (); +extern STATUS netTypeDelete (); +extern void netTypeInit (); +extern void ether_ifattach (); +extern void ether_input (); +extern char * ether_sprintf (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_subrh */ diff --git a/h/net/if_types.h b/h/net/if_types.h new file mode 100644 index 0000000..3bbc2ea --- /dev/null +++ b/h/net/if_types.h @@ -0,0 +1,224 @@ +/* if_types.h - interface types header file */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1989, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if_types.h 8.2 (Berkeley) 4/20/94 + */ + +/* +modification history +-------------------- +01d,16may02,vvv updated interface types (SPR #76443) +01c,15aug01,vvv added entry for IFT_PMP; updated IFT_MAX_TYPE (SPR #69546) +01b,09sep98,ham added IFT_MAX_TYPE +01a,03mar96,vin created from BSD4.4lite2. +*/ + +#ifndef __INCif_typesh +#define __INCif_typesh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Interface types for benefit of parsing media address headers. + * This list is derived from the SNMP list of ifTypes, currently + * documented in RFC1573. + */ + +#define IFT_OTHER 0x1 /* none of the following */ +#define IFT_1822 0x2 /* old-style arpanet imp */ +#define IFT_HDH1822 0x3 /* HDH arpanet imp */ +#define IFT_X25DDN 0x4 /* x25 to imp */ +#define IFT_X25 0x5 /* PDN X25 interface (RFC877) */ +#define IFT_ETHER 0x6 /* Ethernet CSMACD */ +#define IFT_ISO88023 0x7 /* CMSA CD */ +#define IFT_ISO88024 0x8 /* Token Bus */ +#define IFT_ISO88025 0x9 /* Token Ring */ +#define IFT_ISO88026 0xa /* MAN */ +#define IFT_STARLAN 0xb +#define IFT_P10 0xc /* Proteon 10MBit ring */ +#define IFT_P80 0xd /* Proteon 10MBit ring */ +#define IFT_HY 0xe /* Hyperchannel */ +#define IFT_FDDI 0xf +#define IFT_LAPB 0x10 +#define IFT_SDLC 0x11 +#define IFT_T1 0x12 +#define IFT_CEPT 0x13 /* E1 - european T1 */ +#define IFT_ISDNBASIC 0x14 +#define IFT_ISDNPRIMARY 0x15 +#define IFT_PTPSERIAL 0x16 /* Proprietary PTP serial */ +#define IFT_PPP 0x17 /* RFC 1331 */ +#define IFT_LOOP 0x18 /* loopback */ +#define IFT_EON 0x19 /* ISO over IP */ +#define IFT_XETHER 0x1a /* obsolete 3MB experimental ethernet */ +#define IFT_NSIP 0x1b /* XNS over IP */ +#define IFT_SLIP 0x1c /* IP over generic TTY */ +#define IFT_ULTRA 0x1d /* Ultra Technologies */ +#define IFT_DS3 0x1e /* Generic T3 */ +#define IFT_SIP 0x1f /* SMDS */ +#define IFT_FRELAY 0x20 /* Frame Relay DTE only */ +#define IFT_RS232 0x21 +#define IFT_PARA 0x22 /* parallel-port */ +#define IFT_ARCNET 0x23 +#define IFT_ARCNETPLUS 0x24 +#define IFT_ATM 0x25 /* ATM cells */ +#define IFT_MIOX25 0x26 +#define IFT_SONET 0x27 /* SONET or SDH */ +#define IFT_X25PLE 0x28 +#define IFT_ISO88022LLC 0x29 +#define IFT_LOCALTALK 0x2a +#define IFT_SMDSDXI 0x2b +#define IFT_FRELAYDCE 0x2c /* Frame Relay DCE */ +#define IFT_V35 0x2d +#define IFT_HSSI 0x2e +#define IFT_HIPPI 0x2f +#define IFT_MODEM 0x30 /* Generic Modem */ +#define IFT_AAL5 0x31 /* AAL5 over ATM */ +#define IFT_SONETPATH 0x32 +#define IFT_SONETVT 0x33 +#define IFT_SMDSICIP 0x34 /* SMDS InterCarrier Interface */ +#define IFT_PROPVIRTUAL 0x35 /* Proprietary Virtual/internal */ +#define IFT_PROPMUX 0x36 /* Proprietary Multiplexing */ +#define IFT_IEEE80212 0x37 +#define IFT_FIBRE_CHANNEL 0x38 +#define IFT_HIPPI_INTERFACE 0x39 +#define IFT_FRAME_RELAY_INTERCONNECT 0x3a +#define IFT_AFLANE8023 0x3b +#define IFT_AFLANE8025 0x3c +#define IFT_CCT_EMUL 0x3d +#define IFT_FAST_ETHER 0x3e +#define IFT_ISDN 0x3f +#define IFT_V11 0x40 +#define IFT_V36 0x41 +#define IFT_G703AT64K 0x42 +#define IFT_G703AT2MB 0x43 +#define IFT_QLLC 0x44 +#define IFT_FAST_ETHER_FX 0x45 +#define IFT_CHANNEL 0x46 +#define IFT_IEEE80211 0x47 +#define IFT_IBM370PAR_CHAN 0x48 +#define IFT_ESCON 0x49 +#define IFT_DLSW 0x4a +#define IFT_ISDNS 0x4b +#define IFT_ISDNU 0x4c +#define IFT_LAPD 0x4d +#define IFT_IP_SWITCH 0x4e +#define IFT_RSRB 0x4f +#define IFT_ATM_LOGICAL 0x50 +#define IFT_DS0 0x51 +#define IFT_DS0_BUNDLE 0x52 +#define IFT_BSC 0x53 +#define IFT_ASYNC 0x54 +#define IFT_CNR 0x55 +#define IFT_ISO88025_DTR 0x56 +#define IFT_EPLRS 0x57 +#define IFT_ARAP 0x58 +#define IFT_PROP_CNLS 0x59 +#define IFT_HOST_PAD 0x5a +#define IFT_TERM_PAD 0x5b +#define IFT_FRAME_RELAY_MPI 0x5c +#define IFT_X213 0x5d +#define IFT_ADSL 0x5e +#define IFT_RADSL 0x5f +#define IFT_SDSL 0x60 +#define IFT_VDSL 0x61 +#define IFT_ISO88025_CRFP_INT 0x62 +#define IFT_MYRINET 0x63 +#define IFT_VOICE_EM 0x64 +#define IFT_VOICE_FXO 0x65 +#define IFT_VOICE_FXS 0x66 +#define IFT_VOICE_ENCAP 0x67 +#define IFT_VOICE_OVER_IP 0x68 +#define IFT_ATM_DXI 0x69 +#define IFT_ATM_FUNI 0x6a +#define IFT_ATM_IMA 0x6b +#define IFT_PPP_MULTILINK_BUNDLE 0x6c +#define IFT_IP_OVER_CDLC 0x6d +#define IFT_IP_OVER_CLAW 0x6e +#define IFT_STACK_TO_STACK 0x6f +#define IFT_VIRTUAL_IP_ADDRESS 0x70 +#define IFT_MPC 0x71 +#define IFT_IP_OVER_ATM 0x72 +#define IFT_ISO88025_FIBER 0x73 +#define IFT_TDLC 0x74 +#define IFT_GIGABIT_ETHERNET 0x75 +#define IFT_HDLC 0x76 +#define IFT_LAPF 0x77 +#define IFT_V37 0x78 +#define IFT_X25MLP 0x79 +#define IFT_X25HUNT_GROUP 0x7a +#define IFT_TRASNP_HDLC 0x7b +#define IFT_INTERLEAVE 0x7c +#define IFT_FAST 0x7d +#define IFT_IP 0x7e +#define IFT_DOCS_CABLE_MACLAYER 0x7f +#define IFT_DOCS_CABLE_DOWNSTREAM 0x80 +#define IFT_DOCS_CABLE_UPSTREAM 0x81 +#define IFT_A12_MPP_SWITCH 0x82 +#define IFT_TUNNEL 0x83 +#define IFT_COFFEE 0x84 +#define IFT_CES 0x85 +#define IFT_ATM_SUB_INTERFACE 0x86 +#define IFT_L2VLAN 0x87 +#define IFT_L3IPVLAN 0x88 +#define IFT_L3IPXVLAN 0x89 +#define IFT_DIGITAL_POWERLINE 0x8a +#define IFT_MEDIA_MAIL_OVER_IP 0x8b +#define IFT_DTM 0x8c +#define IFT_DCN 0x8d +#define IFT_IP_FORWARD 0x8e +#define IFT_MSDSL 0x8f +#define IFT_IEEE1394 0x90 +#define IFT_IF_GSN 0x91 +#define IFT_DVB_RCC_MAC_LAYER 0x92 +#define IFT_DVB_RCC_DOWNSTREAM 0x93 +#define IFT_DVB_RCC_UPSTREAM 0x94 +#define IFT_ATM_VIRTUAL 0x95 +#define IFT_MPLS_TUNNEL 0x96 +#define IFT_SRP 0x97 +#define IFT_VOICE_OVER_ATM 0x98 +#define IFT_VOICE_OVER_FRAME_RELAY 0x99 +#define IFT_IDSL 0x9a +#define IFT_COMPOSITE_LINK 0x9b +#define IFT_SS7_SIG_LINK 0x9c +#define IFT_PMP 0x9d /* Point to Multipoint */ +#define IFT_MAX_TYPE IFT_PMP /* the maximum ifType number */ +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_typesh */ diff --git a/h/net/inet.h b/h/net/inet.h new file mode 100644 index 0000000..c41b9fa --- /dev/null +++ b/h/net/inet.h @@ -0,0 +1,11 @@ +/* inet.h - obsolete vxWorks 5.0 header file */ + +/* Copyright 1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,09feb93,rrr written for compatibility with 5.0 +*/ + +#include "arpa/inet.h" diff --git a/h/net/mbuf.h b/h/net/mbuf.h new file mode 100644 index 0000000..3554ecd --- /dev/null +++ b/h/net/mbuf.h @@ -0,0 +1,337 @@ +/* mbuf.h - mbuf header file */ + +/* Copyright 1984 - 2002 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)mbuf.h 8.3 (Berkeley) 1/21/94 + */ + +/* +modification history +-------------------- +01n,21mar02,vvv updated doc for copy_from_mbufs (SPR #20787) +01m,10oct01,rae merge from truestack (VIRTUAL_STACK) +01l,30oct00,ijm changed M_TRAILINGSPACE from + to - (m)->m_len (SPR# 30996) +01k,11dec97,vin made m_free and m_freem as macros calling netMblkClFree + and netMblkClChainFree functions. +01j,08dec97,vin changed m_copym to netMblkChainDup macro SPR 9966. +01i,30nov97,vin added extern declarations _pNetSysPool & relevant stuff. +01h,19sep97,vin changes to fit in clBlk logic +01g,14aug97,vin changed MBUF_CONFIG to MBLK_CONFIG moved generic stuff to + netBufLib.h +01f,02jul97,vin moved clIncr in clPool to the end. optimized mbuf structure + for long word accesses. +01e,15may97,vin reworked macro copy_from_mbufs, and bcopy_from_mbufs, + cleanup. +01d,31jan96,vin added default cluster configurations. +01c,03dec96,vin changed declaration for m_getclr(). +01b,17nov96,vin removed mbufs, code works with (mbuf, cluster) pair. +01a,03mar96,vin created from BSD4.4 stuff,integrated with 02u of mbuf.h +*/ + +#ifndef __INCmbufh +#define __INCmbufh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "sys/types.h" +#include "net/unixLib.h" +#include "semLib.h" +#include "memLib.h" +#include "string.h" +#include "netBufLib.h" + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* Constants */ + +#define MCLBYTES 2048 /* default cluster size */ +#define USE_CLUSTER(size) ((size) >= 512 ? TRUE : FALSE) + +#define M_MAXCOMPRESS (CL_SIZE_128/2) /* max amount to copy for compression */ +#define mbuf mBlk +#define m_next mBlkHdr.mNext +#define m_len mBlkHdr.mLen +#define m_data mBlkHdr.mData +#define m_type mBlkHdr.mType +#define m_flags mBlkHdr.mFlags +#define m_nextpkt mBlkHdr.mNextPkt +#define m_act m_nextpkt +#define m_pkthdr mBlkPktHdr +#define m_ext pClBlk +#define m_extBuf m_ext->clNode.pClBuf +#define m_extFreeRtn m_ext->pClFreeRtn +#define m_extSize m_ext->clSize +#define m_extRefCnt m_ext->clRefCnt +#define m_extArg1 m_ext->clFreeArg1 +#define m_extArg2 m_ext->clFreeArg2 +#define m_extArg3 m_ext->clFreeArg3 + +/* flags copied when copying m_pkthdr */ +#define M_COPYFLAGS (M_PKTHDR|M_EOR|M_BCAST|M_MCAST) + + +/* flags to mBufClGet/mHdrClGet/mBlkGet */ + + +/* + * Macros for type conversion + * mtod(m,t) - convert mbuf pointer to data pointer of correct type + */ +#define mtod(m,t) ((t)((m)->m_data)) + +#define MC_NO_CLUSTER ((u_char) 0) +#define MC_CLUSTER ((u_char) 1) +#define MC_LANCE ((u_char) 2) /* 0x02 - 0x80 for netif */ +#define MC_BACKPLANE ((u_char) 3) +#define MC_EI ((u_char) 4) +#define MC_UCLUSTER ((u_char) 0x80) /* 0x80 - 0xff for network code */ + + +/* m_pullup will pull up additional length if convenient; + * should be enough to hold headers of second-level and higher protocols. + */ + +#define MPULL_EXTRA 32 + +/* + * Set the m_data pointer of a newly-allocated mbuf (m_get/MGET) to place + * an object of the specified size at the end of the mbuf, longword aligned. + */ +#define M_ALIGN(m, len) \ + { (m)->m_data += (m->m_extSize - (len)) &~ (sizeof(long) - 1); } +/* + * As above, for mbufs allocated with m_gethdr/MGETHDR + * or initialized by M_COPY_PKTHDR. + */ +#define MH_ALIGN(m, len) M_ALIGN((m),(len)) + +/* + * Compute the amount of space available + * before the current start of data in a cluster. + */ +#define M_LEADINGSPACE(m) ((m)->m_data - (m)->m_extBuf) + +/* + * Compute the amount of space available + * after the end of data in a cluster. + */ + +#define M_TRAILINGSPACE(m) ((m)->m_extBuf + (m)->m_extSize - \ + (m)->m_data - (m)->m_len) +/* + * Arrange to prepend space of size plen to mbuf m. + * If a new mbuf must be allocated, how specifies whether to wait. + * If how is M_DONTWAIT and allocation fails, the original mbuf chain + * is freed and m is set to NULL. + */ + +#ifndef STANDALONE_AGENT +#define M_PREPEND(m, plen, how) \ + { \ + if (M_LEADINGSPACE(m) >= (plen)) { \ + (m)->m_data -= (plen); \ + (m)->m_len += (plen); \ + } else \ + (m) = m_prepend((m), (plen), (how)); \ + if ((m) && (m)->m_flags & M_PKTHDR) \ + (m)->m_pkthdr.len += (plen); \ + } +#else /* STANDALONE_AGENT */ +/* + * for standalone agent, the M_PREPEND routine does no try to allocate + * a new buffer (there is no available). Anyway, this is not needed since + * all the WDB packets can be stored in one buffer. + */ + +#define M_PREPEND(m, plen, how) \ + { \ + if (M_LEADINGSPACE(m) >= (plen)) { \ + (m)->m_data -= (plen); \ + (m)->m_len += (plen); \ + } else \ + (m) = NULL; \ + if ((m) && (m)->m_flags & M_PKTHDR) \ + (m)->m_pkthdr.len += (plen); \ + } +#endif /* STANDALONE_AGENT */ + +/* change mbuf to new type */ +#define MCHTYPE(m, t) \ + { \ + int ms = splimp(); \ + mbstat.m_mtypes[(m)->m_type]--; \ + mbstat.m_mtypes[t]++; \ + (m)->m_type = t; \ + splx(ms); \ + } + + +/* + * We have to do this locally so that we don't have circular + * include dependencies. + */ + +#ifdef VIRTUAL_STACK +#define _pNetDpool vsTbl[myStackNum]->pNetDPool +#endif + +/* compatiblity with 4.3 */ +#define m_copy(m, o, l) m_copym((m), (o), (l), M_DONTWAIT) +#define m_copym(m, o, l, w) netMblkChainDup(_pNetDpool, (m), (o), (l), (w)) +#define m_freem(m) netMblkClChainFree(m) +#define m_free(m) netMblkClFree(m) + +#ifdef VIRTUAL_STACK +#undef _pNetDpool /* prevents conflicts with vsData.h definition */ +#endif + +#define m_mbufs mNum +#define m_drops mDrops +#define m_wait mWait +#define m_drain mDrain +#define m_mtypes mTypes + +/* SunOS compatible macros to be used in network interface drivers */ + +/* copy_from_mbufs copies data from mbuf chain to user supplied buffer area. + * + * N.B.: This macro takes an extra argument 'len' which is used to return + * the number of bytes actually transferred. SunOS routine copy_from_mbufs + * returns this value; VxWorks macro copy_from_mbufs "returns" the same + * value in 'len'. + * + * This macro should not be used since bcopy_from_mbufs is now obsolete. + */ + +#define copy_from_mbufs(buf0, m, len) \ + bcopy_from_mbufs (buf0, m, len, NONE) + +/* bcopy_from_mbufs copies dat from mbuf chain to user supplied buffer area + * by transferring bytes by unit 'width' indicated by the user. + * This macro is similiar to copy_from_mbufs; the only difference is the + * extra argument 'width' which is used to accommodate certain hardware + * restrictions that require copying of data to only occur at certain byte size + * boundaries. Calling this macro with 'width' value set to NONE is equivalent + * to calling copy_from_mbufs macro. + * + * This macro should not be used since it calls copyFromMbufs which may cause + * unaligned memory accesses resulting in target failure. The routine + * netMblkToBufCopy can be used instead. However, netMblkToBufCopy does not + * free the mbuf chain after copying. + * + * Instead of + * bcopy_from_mbufs (pBuf, pMblk, len, width); + * we can have + * len = netMblkToBufCopy (pMblk, pBuf, NULL); + * netMblkClChainFree (pMblk); + * + * There is no width argument but the last argument to netMblkToBufCopy + * specifies which routine will be used to copy the data. If NULL, bcopy is + * used. + */ + +#define bcopy_from_mbufs(buf0, m, len, width) \ + { \ + (len) = copyFromMbufs (buf0, m, width); \ + } + +/* copy_to_mbufs copies data into mbuf chain and returns the pointer to + * the first mbuf. + * + * N.B.: This macro calls a routine bcopy_to_mbufs with width value set + * to NONE. VxWorks routine bcopy_to_mbufs is provided to accommodate + * hardware restrictions that require copying of data to only + * occur at certain byte size boundaries. + */ + +#define copy_to_mbufs(buf, totlen, off, ifp) \ + bcopy_to_mbufs (buf, totlen, off, ifp, NONE) + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* imported stuff */ + +IMPORT struct mbstat mbstat; /* mBlk statistics */ +IMPORT M_CL_CONFIG mClBlkConfig; /* mBlk, clBlk configuration */ +IMPORT CL_DESC clDescTbl []; /* cluster configuration */ +IMPORT int clDescTblNumEnt; /* no. elements in the table */ +IMPORT M_CL_CONFIG sysMclBlkConfig; /* mBlk, clBlk configuration */ +IMPORT CL_DESC sysClDescTbl []; /* cluster configuration */ +IMPORT int sysClDescTblNumEnt; /* no. elements in the table */ + +#ifndef VIRTUAL_STACK +IMPORT NET_POOL_ID _pNetDpool; /* network data pool */ +IMPORT NET_POOL_ID _pNetSysPool; /* network data pool */ +#endif + +/* These variables are initialized when individual protocols are initialized */ + +extern int max_linkhdr; /* largest link-level header */ +extern int max_protohdr; /* largest protocol header */ +extern int max_hdr; /* largest link+protocol header */ +extern int max_datalen; /* CL_SIZE_128 - max_hdr */ + +extern struct mbuf *m_free (struct mbuf *); +extern struct mbuf *m_getclr (int, UCHAR, int, BOOL); +extern struct mbuf *m_prepend (struct mbuf *, int, int); +extern struct mbuf *m_pullup (struct mbuf *, int); +extern void m_adj (struct mbuf *, int); +extern void m_freem (struct mbuf *); +extern void m_cat (struct mbuf *, struct mbuf *); +extern struct mbuf *m_devget (char *, int, int, struct ifnet *, + void (*copy)()); +struct mbuf * mBufClGet (int, UCHAR, FAST int, BOOL); +struct mbuf * mHdrClGet (int, UCHAR, FAST int, BOOL); + +IMPORT struct mbuf * bcopy_to_mbufs (u_char * buf, int totlen, int off0, + struct ifnet * ifp, int width); +IMPORT struct mbuf * build_cluster (u_char * buf, int totlen, + struct ifnet * ifp, u_char ctype, + u_char * pRefcnt, FUNCPTR freeRtn, + int arg1, int arg2, int arg3); +IMPORT int copyFromMbufs (char * pIobuf, struct mbuf * pMbuf, int width); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmbufh */ diff --git a/h/net/protosw.h b/h/net/protosw.h new file mode 100644 index 0000000..1136d64 --- /dev/null +++ b/h/net/protosw.h @@ -0,0 +1,250 @@ +/* protosw.h - protocol switch table header file */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)protosw.h 8.1 (Berkeley) 6/2/93 + */ + +/* +modification history +-------------------- +01b,31jan97,vin corrected prototypes for functions in protosw. +01a,03mar96,vin created from BSD4.4 stuff. +*/ + +#ifndef __INCprotoswh +#define __INCprotoswh + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Protocol switch table. + * + * Each protocol has a handle initializing one of these structures, + * which is used for protocol-protocol and system-protocol communication. + * + * A protocol is called through the pr_init entry before any other. + * Thereafter it is called every 200ms through the pr_fasttimo entry and + * every 500ms through the pr_slowtimo for timer based actions. + * The system will call the pr_drain entry if it is low on space and + * this should throw away any non-critical data. + * + * Protocols pass data between themselves as chains of mbufs using + * the pr_input and pr_output hooks. Pr_input passes data up (towards + * UNIX) and pr_output passes it down (towards the imps); control + * information passes up and down on pr_ctlinput and pr_ctloutput. + * The protocol is responsible for the space occupied by any the + * arguments to these entries and must dispose it. + * + * The userreq routine interfaces protocols to the system and is + * described below. + */ +struct protosw + { + short pr_type; /* socket type used for */ + struct domain *pr_domain; /* domain protocol a member of */ + short pr_protocol; /* protocol number */ + short pr_flags; /* see below */ + + /* protocol-protocol hooks */ + + void (*pr_input) (); /* input to protocol (from below) */ + int (*pr_output) (); /* output to protocol (from above) */ + void (*pr_ctlinput) (); /* control input (from below) */ + int (*pr_ctloutput) (); /* control output (from above) */ + + /* user-protocol hook */ + + int (*pr_usrreq) (); /* user request: see list below */ + + /* utility hooks */ + + void (*pr_init) (); /* initialization hook */ + void (*pr_fasttimo) (); /* fast timeout (200ms) */ + void (*pr_slowtimo) (); /* slow timeout (500ms) */ + void (*pr_drain) (); /* flush any excess space possible */ + int (*pr_sysctl) (); /* sysctl for protocol */ + }; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#define PR_SLOWHZ 2 /* 2 slow timeouts per second */ +#define PR_FASTHZ 5 /* 5 fast timeouts per second */ + +/* + * Values for pr_flags. + * PR_ADDR requires PR_ATOMIC; + * PR_ADDR and PR_CONNREQUIRED are mutually exclusive. + */ +#define PR_ATOMIC 0x01 /* exchange atomic messages only */ +#define PR_ADDR 0x02 /* addresses given with messages */ +#define PR_CONNREQUIRED 0x04 /* connection required by protocol */ +#define PR_WANTRCVD 0x08 /* want PRU_RCVD calls */ +#define PR_RIGHTS 0x10 /* passes capabilities */ + +/* + * The arguments to usrreq are: + * (*protosw[].pr_usrreq)(up, req, m, nam, opt); + * where up is a (struct socket *), req is one of these requests, + * m is a optional mbuf chain containing a message, + * nam is an optional mbuf chain containing an address, + * and opt is a pointer to a socketopt structure or nil. + * The protocol is responsible for disposal of the mbuf chain m, + * the caller is responsible for any space held by nam and opt. + * A non-zero return from usrreq gives an + * UNIX error number which should be passed to higher level software. + */ +#define PRU_ATTACH 0 /* attach protocol to up */ +#define PRU_DETACH 1 /* detach protocol from up */ +#define PRU_BIND 2 /* bind socket to address */ +#define PRU_LISTEN 3 /* listen for connection */ +#define PRU_CONNECT 4 /* establish connection to peer */ +#define PRU_ACCEPT 5 /* accept connection from peer */ +#define PRU_DISCONNECT 6 /* disconnect from peer */ +#define PRU_SHUTDOWN 7 /* won't send any more data */ +#define PRU_RCVD 8 /* have taken data; more room now */ +#define PRU_SEND 9 /* send this data */ +#define PRU_ABORT 10 /* abort (fast DISCONNECT, DETATCH) */ +#define PRU_CONTROL 11 /* control operations on protocol */ +#define PRU_SENSE 12 /* return status into m */ +#define PRU_RCVOOB 13 /* retrieve out of band data */ +#define PRU_SENDOOB 14 /* send out of band data */ +#define PRU_SOCKADDR 15 /* fetch socket's address */ +#define PRU_PEERADDR 16 /* fetch peer's address */ +#define PRU_CONNECT2 17 /* connect two sockets */ +/* begin for protocols internal use */ +#define PRU_FASTTIMO 18 /* 200ms timeout */ +#define PRU_SLOWTIMO 19 /* 500ms timeout */ +#define PRU_PROTORCV 20 /* receive from below */ +#define PRU_PROTOSEND 21 /* send to below */ + +#define PRU_NREQ 21 + +#ifdef PRUREQUESTS +char *prurequests[] = + { + "ATTACH", "DETACH", "BIND", "LISTEN", + "CONNECT", "ACCEPT", "DISCONNECT", "SHUTDOWN", + "RCVD", "SEND", "ABORT", "CONTROL", + "SENSE", "RCVOOB", "SENDOOB", "SOCKADDR", + "PEERADDR", "CONNECT2", "FASTTIMO", "SLOWTIMO", + "PROTORCV", "PROTOSEND", + }; +#endif + +/* + * The arguments to the ctlinput routine are + * (*protosw[].pr_ctlinput)(cmd, sa, arg); + * where cmd is one of the commands below, sa is a pointer to a sockaddr, + * and arg is an optional caddr_t argument used within a protocol family. + */ +#define PRC_IFDOWN 0 /* interface transition */ +#define PRC_ROUTEDEAD 1 /* select new route if possible ??? */ +#define PRC_QUENCH2 3 /* DEC congestion bit says slow down */ +#define PRC_QUENCH 4 /* some one said to slow down */ +#define PRC_MSGSIZE 5 /* message size forced drop */ +#define PRC_HOSTDEAD 6 /* host appears to be down */ +#define PRC_HOSTUNREACH 7 /* deprecated (use PRC_UNREACH_HOST) */ +#define PRC_UNREACH_NET 8 /* no route to network */ +#define PRC_UNREACH_HOST 9 /* no route to host */ +#define PRC_UNREACH_PROTOCOL 10 /* dst says bad protocol */ +#define PRC_UNREACH_PORT 11 /* bad port # */ +/* was PRC_UNREACH_NEEDFRAG 12 (use PRC_MSGSIZE) */ +#define PRC_UNREACH_SRCFAIL 13 /* source route failed */ +#define PRC_REDIRECT_NET 14 /* net routing redirect */ +#define PRC_REDIRECT_HOST 15 /* host routing redirect */ +#define PRC_REDIRECT_TOSNET 16 /* redirect for type of service & net */ +#define PRC_REDIRECT_TOSHOST 17 /* redirect for tos & host */ +#define PRC_TIMXCEED_INTRANS 18 /* packet lifetime expired in transit */ +#define PRC_TIMXCEED_REASS 19 /* lifetime expired on reass q */ +#define PRC_PARAMPROB 20 /* header incorrect */ + +#define PRC_NCMDS 21 + +#define PRC_IS_REDIRECT(cmd) \ + ((cmd) >= PRC_REDIRECT_NET && (cmd) <= PRC_REDIRECT_TOSHOST) + +#ifdef PRCREQUESTS +char *prcrequests[] = { + "IFDOWN", "ROUTEDEAD", "#2", "DEC-BIT-QUENCH2", + "QUENCH", "MSGSIZE", "HOSTDEAD", "#7", + "NET-UNREACH", "HOST-UNREACH", "PROTO-UNREACH", "PORT-UNREACH", + "#12", "SRCFAIL-UNREACH", "NET-REDIRECT", "HOST-REDIRECT", + "TOSNET-REDIRECT", "TOSHOST-REDIRECT", "TX-INTRANS", "TX-REASS", + "PARAMPROB" +}; +#endif + +/* + * The arguments to ctloutput are: + * (*protosw[].pr_ctloutput)(req, so, level, optname, optval); + * req is one of the actions listed below, so is a (struct socket *), + * level is an indication of which protocol layer the option is intended. + * optname is a protocol dependent socket option request, + * optval is a pointer to a mbuf-chain pointer, for value-return results. + * The protocol is responsible for disposal of the mbuf chain *optval + * if supplied, + * the caller is responsible for any space held by *optval, when returned. + * A non-zero return from usrreq gives an + * UNIX error number which should be passed to higher level software. + */ +#define PRCO_GETOPT 0 +#define PRCO_SETOPT 1 + +#define PRCO_NCMDS 2 + +#ifdef PRCOREQUESTS +char *prcorequests[] = + { + "GETOPT", "SETOPT", + }; +#endif + +extern struct protosw *pffindproto(); +extern struct protosw *pffindtype(); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCprotoswh */ diff --git a/h/net/radix.h b/h/net/radix.h new file mode 100644 index 0000000..65b5a40 --- /dev/null +++ b/h/net/radix.h @@ -0,0 +1,193 @@ +/* radix.h - routing functions header file */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1988, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)radix.h 8.2 (Berkeley) 10/31/94 + */ + +/* +modification history +-------------------- +01d,10oct01,rae merge from truestack (SPR #28948, VIRTUAL_STACK) +01c,11may98,elp move I960 pragma after mbuf.h inclusion. +01b,03dec96,vin redefined R_Malloc to use m_getclr(..) to use network buffers. +01a,03mar96,vin created from BSD4.4lite2. +*/ + +#ifndef __INCradixh +#define __INCradixh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "net/mbuf.h" /* include network buffers header */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Radix search tree node layout. + */ + +struct radix_node { + struct radix_mask *rn_mklist; /* list of masks contained in subtree */ + struct radix_node *rn_p; /* parent */ + short rn_b; /* bit offset; -1-index(netmask) */ + char rn_bmask; /* node: mask for bit test*/ + u_char rn_flags; /* enumerated next */ +#define RNF_NORMAL 1 /* leaf contains normal route */ +#define RNF_ROOT 2 /* leaf is root leaf for tree */ +#define RNF_ACTIVE 4 /* This node is alive (for rtfree) */ + union { + struct { /* leaf only data: */ + caddr_t rn_Key; /* object of search */ + caddr_t rn_Mask; /* netmask, if present */ + struct radix_node *rn_Dupedkey; + } rn_leaf; + struct { /* node only data: */ + int rn_Off; /* where to start compare */ + struct radix_node *rn_L;/* progeny */ + struct radix_node *rn_R;/* progeny */ + }rn_node; + } rn_u; +#ifdef RN_DEBUG + int rn_info; + struct radix_node *rn_twin; + struct radix_node *rn_ybro; +#endif +}; + +#define rn_dupedkey rn_u.rn_leaf.rn_Dupedkey +#define rn_key rn_u.rn_leaf.rn_Key +#define rn_mask rn_u.rn_leaf.rn_Mask +#define rn_off rn_u.rn_node.rn_Off +#define rn_l rn_u.rn_node.rn_L +#define rn_r rn_u.rn_node.rn_R + +/* + * Annotations to tree concerning potential routes applying to subtrees. + */ + +extern struct radix_mask { + short rm_b; /* bit offset; -1-index(netmask) */ + char rm_unused; /* cf. rn_bmask */ + u_char rm_flags; /* cf. rn_flags */ + struct radix_mask *rm_mklist; /* more masks to try */ + union { + caddr_t rmu_mask; /* the mask */ + struct radix_node *rmu_leaf; /* for normal routes */ + } rm_rmu; + int rm_refs; /* # of references to this struct */ +} *rn_mkfreelist; + +#define rm_mask rm_rmu.rmu_mask +#define rm_leaf rm_rmu.rmu_leaf /* extra field would make 32 bytes */ + +#define MKGet(m) {\ + if (rn_mkfreelist) {\ + m = rn_mkfreelist; \ + rn_mkfreelist = (m)->rm_mklist; \ + } else \ + R_Malloc(m, struct radix_mask *, sizeof (*(m))); }\ + +#define MKFree(m) { (m)->rm_mklist = rn_mkfreelist; rn_mkfreelist = (m);} + +struct radix_node_head { + struct radix_node *rnh_treetop; + int rnh_addrsize; /* permit, but not require fixed keys */ + int rnh_pktsize; /* permit, but not require fixed keys */ + struct radix_node *(*rnh_addaddr) /* add based on sockaddr */ + (void *v, void *mask, + struct radix_node_head *head, struct radix_node nodes[]); + struct radix_node *(*rnh_addpkt) /* add based on packet hdr */ + (void *v, void *mask, + struct radix_node_head *head, struct radix_node nodes[]); + struct radix_node *(*rnh_deladdr) /* remove based on sockaddr */ + (void *v, void *mask, struct radix_node_head *head); + struct radix_node *(*rnh_delpkt) /* remove based on packet hdr */ + (void *v, void *mask, struct radix_node_head *head); + struct radix_node *(*rnh_matchaddr) /* locate based on sockaddr */ + (void *v, struct radix_node_head *head); + struct radix_node *(*rnh_lookup) /* locate based on sockaddr */ + (void *v, void *mask, struct radix_node_head *head); + struct radix_node *(*rnh_matchpkt) /* locate based on packet hdr */ + (void *v, struct radix_node_head *head); + int (*rnh_walktree) /* traverse tree */ + (struct radix_node_head *head, int (*f)(), void *w); + struct radix_node rnh_nodes[3]; /* empty tree for common case */ +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#define Bcmp(a, b, n) bcmp(((char *)(a)), ((char *)(b)), (n)) +#define Bcopy(a, b, n) bcopy(((char *)(a)), ((char *)(b)), (unsigned)(n)) +#define Bzero(p, n) bzero((char *)(p), (int)(n)) + +#define R_Malloc(p, t, n) (p = (t) _netMalloc((n), MT_RTABLE, M_DONTWAIT)) +#define Free(p) _netFree((char *)p) + +#ifdef VIRTUAL_STACK +STATUS radixInit (void); +#else +void rn_init (void); +#endif +int rn_inithead (struct radix_node_head **, int); +int rn_destroyhead (struct radix_node_head *); +int rn_refines (void *, void *); +int rn_walksubtree (struct radix_node_head *, void *, void *, + int (*)(), void *); +int rn_walktree (struct radix_node_head *, int (*)(), void *); +struct radix_node + *rn_addmask (void *, int, int), + *rn_addroute (void *, void *, struct radix_node_head *, + struct radix_node [2]), + *rn_delete (void *, void *, struct radix_node_head *), + *rn_insert (void *, struct radix_node_head *, int *, + struct radix_node [2]), + *rn_match (void *, struct radix_node_head *), + *rn_newpair (void *, int, struct radix_node[2]), + *rn_search (void *, struct radix_node *), + *rn_search_m (void *, struct radix_node *, void *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCradixh */ + diff --git a/h/net/raw_cb.h b/h/net/raw_cb.h new file mode 100644 index 0000000..17c34e1 --- /dev/null +++ b/h/net/raw_cb.h @@ -0,0 +1,114 @@ +/* raw_cb.h - raw protocol interface control block header file */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1980, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)raw_cb.h 8.1 (Berkeley) 6/10/93 + */ + +/* +modification history +-------------------- +03c,10oct01,rae merge from truestack (VIRTUAL_STACK) +03b,31jan97,vin changed declaration according to prototype decl in protosw.h +03a,03mar96,vin created from BSD4.4 stuff,integrated with 02i of raw_cb.h +02i,22sep92,rrr added support for c++ +02h,26may92,rrr the tree shuffle +02g,28feb92,wmd changed last pragma to turn off alignment 1. +02f,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +02e,10jun91.del added pragma for gnu960 alignment. +02d,05oct90,shl added copyright notice. + made #endif ANSI style. +02c,16apr89,gae updated to new 4.3BSD. +02b,04nov87,dnw moved rawcb definition to raw_cb.c. +02a,03apr87,ecs added header and copyright. +*/ + +#ifndef __INCraw_cbh +#define __INCraw_cbh + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Raw protocol interface control block. Used + * to tie a socket to the generic raw interface. + */ +struct rawcb { + struct rawcb *rcb_next; /* doubly linked list */ + struct rawcb *rcb_prev; + struct socket *rcb_socket; /* back pointer to socket */ + struct sockaddr *rcb_faddr; /* destination address */ + struct sockaddr *rcb_laddr; /* socket's address */ + struct sockproto rcb_proto; /* protocol family, protocol */ +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#define sotorawcb(so) ((struct rawcb *)(so)->so_pcb) + +/* + * Nominal space allocated to a raw socket. + */ +#define RAWSNDQ 8192 +#define RAWRCVQ 8192 + +#ifndef VIRTUAL_STACK +extern struct rawcb rawcb; /* head of list */ +#endif + +extern int raw_attach (struct socket *, int); +extern void raw_ctlinput (int, struct sockaddr *); +extern void raw_detach (struct rawcb *); +extern void raw_disconnect (struct rawcb *); +extern void raw_init (void); +extern void raw_input (struct mbuf *, struct sockproto *, + struct sockaddr *, struct sockaddr *); +extern int raw_usrreq (struct socket *, int, struct mbuf *, + struct mbuf *, struct mbuf *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCraw_cbh */ diff --git a/h/net/route.h b/h/net/route.h new file mode 100644 index 0000000..3bfe793 --- /dev/null +++ b/h/net/route.h @@ -0,0 +1,371 @@ +/* route.h - routing table header file */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1980, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)route.h 8.3 (Berkeley) 4/19/94 + */ + +/* +modification history +-------------------- +01g,10oct01,rae merge from truestack (ROUTER_STACK additions) +01f,07jul97,rjc revised rt_metrics structure to gain 6 bytes. +01e,02jul97,vin added declarations for rtxxMsgHooks removed unnessary global + declarations +01d,01jul97,rjc restored old rtentry structure +01c,12feb97,rjc ospf changes. +01b,05feb97,rjc tos routing changes. +01a,03mar96,vin created from BSD4.4 stuff,integrated with 02i. +*/ + +#ifndef __INCrouteh +#define __INCrouteh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "net/socketvar.h" +#include "net/radix.h" +#include "net/mbuf.h" + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Kernel resident routing tables. + * + * The routing tables are initialized when interface addresses + * are set by making entries for all directly connected interfaces. + */ + +/* + * A route consists of a destination address and a reference + * to a routing entry. These are often held by protocols + * in their control blocks, e.g. inpcb. + */ +struct route + { + struct rtentry *ro_rt; + struct sockaddr ro_dst; + }; + +/* + * These numbers are used by reliable protocols for determining + * retransmission behavior and are included in the routing structure. + */ +struct rt_metrics { + u_long rmx_locks; /* Kernel must leave these values alone */ + u_long rmx_mtu; /* MTU for this path */ + u_long rmx_expire; /* lifetime for route, e.g. redirect */ + u_long rmx_recvpipe; /* inbound delay-bandwith product */ + u_long rmx_sendpipe; /* outbound delay-bandwith product */ + u_long rmx_ssthresh; /* outbound gateway buffer limit */ + u_long rmx_rtt; /* estimated round trip time */ + u_long rmx_rttvar; /* estimated rtt variance */ + u_short rmx_hopcount; /* max hops expected */ + u_short rmx_mss; /* TCP maximum segment size from peer */ + + /* Additional WRN metrics for routing protocols */ + + long value1; + long value2; + long value3; + long value4; + long value5; + long routeTag; + u_char weight; +}; + +/* + * This expanded "gateway" structure contains the address of the next-hop + * router and all the new metrics for a route, as well as the protocol + * identifier which created it. The RTM_GETALL routing socket message + * contains a list of these structures. + */ + +struct sockaddr_gate + { + u_char gate_len; + u_char gate_family; + u_char routeProto; + u_char weight; + u_long gate_addr; + long value1; + long value2; + long value3; + long value4; + long value5; + long routeTag; + }; + +/* + * rmx_rtt and rmx_rttvar are stored as microseconds; + * RTTTOPRHZ(rtt) converts to a value suitable for use + * by a protocol slowtimo counter. + */ +#define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */ +#define RTTTOPRHZ(r) ((r) / (RTM_RTTUNIT / PR_SLOWHZ)) + +/* + * We distinguish between routes to hosts and routes to networks, + * preferring the former if available. For each route we infer + * the interface to use from the gateway address supplied when + * the route was entered. Routes that forward packets through + * gateways are marked so that the output routines know to address the + * gateway rather than the ultimate destination. + */ +#ifndef RNF_NORMAL +#include +#endif +struct rtentry { + struct radix_node rt_nodes[2]; /* tree glue, and other values */ +#define rt_key(r) ((struct sockaddr *)((r)->rt_nodes->rn_key)) +#define rt_mask(r) ((struct sockaddr *)((r)->rt_nodes->rn_mask)) + struct sockaddr *rt_gateway; /* value */ + short rt_flags; /* up/down?, host/net */ + short rt_refcnt; /* # held references */ + u_long rt_use; /* raw # packets forwarded */ + struct ifnet *rt_ifp; /* the answer: interface to use */ + struct ifaddr *rt_ifa; /* the answer: interface to use */ + struct sockaddr *rt_genmask; /* for generation of cloned routes */ + caddr_t rt_llinfo; /* pointer to link level info cache */ + struct rtentry *rt_gwroute; /* implied entry for gatewayed routes */ + int rt_mod; /* last modified XXX */ + struct rt_metrics rt_rmx; /* metrics used by rx'ing protocols */ + struct rtentry *rt_parent; /* parent of route (if cloned) */ +}; + +/* + * Following structure necessary for 4.3 compatibility; + * We should eventually move it to a compat file. + */ +struct ortentry { + u_long rt_hash; /* to speed lookups */ + struct sockaddr rt_dst; /* key */ + struct sockaddr rt_gateway; /* value */ + short rt_flags; /* up/down?, host/net */ + short rt_refcnt; /* # held references */ + u_long rt_use; /* raw # packets forwarded */ + struct ifnet *rt_ifp; /* the answer: interface to use */ + int rt_mod; /* last modified */ +}; + +#define RTF_UP 0x1 /* route usable */ +#define RTF_GATEWAY 0x2 /* destination is a gateway */ +#define RTF_HOST 0x4 /* host entry (net otherwise) */ +#define RTF_REJECT 0x8 /* host or net unreachable */ +#define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */ +#define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */ +#define RTF_DONE 0x40 /* message confirmed */ +#define RTF_MASK 0x80 /* subnet mask present */ +#define RTF_CLONING 0x100 /* generate new routes on use */ +#define RTF_XRESOLVE 0x200 /* external daemon resolves name */ +#define RTF_LLINFO 0x400 /* generated by ARP or ESIS */ +#define RTF_STATIC 0x800 /* manually added */ +#define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */ +#define RTF_PROTO2 0x4000 /* protocol specific routing flag */ +#define RTF_PROTO1 0x8000 /* protocol specific routing flag */ + +#define RTF_MGMT 0x2000 /* modfied by managment proto */ + +#define RTF_REP_NODE 0x4000 /* Representative Node in the Pat tree */ + +#define RTF_CLONED RTF_PROTO1 /* Child route holding path MTU results */ +#define RTF_DELETE RTF_PROTO2 /* Unused route scheduled for deletion */ + +/* Routing statistics. */ + +struct rtstat + { + short rts_badredirect; /* bogus redirect calls */ + short rts_dynamic; /* routes created by redirects */ + short rts_newgateway; /* routes modified by redirects */ + short rts_unreach; /* lookups which failed */ + short rts_wildcard; /* lookups satisfied by a wildcard */ + }; + +/* + * Structures for routing messages. + */ +struct rt_msghdr { + u_short rtm_msglen; /* to skip over non-understood messages */ + u_char rtm_version; /* future binary compatibility */ + u_char rtm_type; /* message type */ + u_short rtm_index; /* index for associated ifp */ + int rtm_flags; /* flags, incl. kern & message, e.g. DONE */ + int rtm_addrs; /* bitmask identifying sockaddrs in msg */ + pid_t rtm_pid; /* identify sender */ + int rtm_seq; /* for sender to identify action */ + int rtm_errno; /* why failed */ + int rtm_use; /* from rtentry */ + u_long rtm_inits; /* which metrics we are initializing */ + struct rt_metrics rtm_rmx; /* metrics themselves */ +}; + +#define RTM_VERSION 3 /* Up the ante and ignore older versions */ + +#define RTM_ADD 0x1 /* Add Route */ +#define RTM_DELETE 0x2 /* Delete Route */ +#define RTM_CHANGE 0x3 /* Change Metrics or flags */ +#define RTM_GET 0x4 /* Report Metrics */ +#define RTM_LOSING 0x5 /* Kernel Suspects Partitioning */ +#define RTM_REDIRECT 0x6 /* Told to use different route */ +#define RTM_MISS 0x7 /* Lookup failed on this address */ +#define RTM_LOCK 0x8 /* fix specified metrics */ +#define RTM_OLDADD 0x9 /* caused by SIOCADDRT */ +#define RTM_OLDDEL 0xa /* caused by SIOCDELRT */ +#define RTM_RESOLVE 0xb /* req to resolve dst to LL addr */ +#define RTM_NEWADDR 0xc /* address being added to iface */ +#define RTM_DELADDR 0xd /* address being removed from iface */ +#define RTM_IFINFO 0xe /* iface going up/down etc. */ + +#ifdef ROUTER_STACK + +/* New WRN messages */ + +#define RTM_ADDEXTRA 0xf /* Report creation of duplicate route */ +#define RTM_DELEXTRA 0x10 /* Report deletion of duplicate route */ + +#define RTM_NEWCHANGE 0x11 /* Change gateway of duplicate route */ +#define RTM_NEWGET 0x12 /* Find any route with gateway */ +#define RTM_GETALL 0x13 /* Get IP route to dst and any duplicates */ + +#define RTM_NEWIPROUTE 0x14 /* Replacement for deleted primary IP route */ +#define RTM_OLDIPROUTE 0x15 /* Demoted IP route replaced with new entry */ + +#endif /* ROUTER_STACK */ + +#define RTV_MTU 0x1 /* init or lock _mtu */ +#define RTV_HOPCOUNT 0x2 /* init or lock _hopcount */ +#define RTV_EXPIRE 0x4 /* init or lock _expire */ +#define RTV_RPIPE 0x8 /* init or lock _recvpipe */ +#define RTV_SPIPE 0x10 /* init or lock _sendpipe */ +#define RTV_SSTHRESH 0x20 /* init or lock _ssthresh */ +#define RTV_RTT 0x40 /* init or lock _rtt */ +#define RTV_RTTVAR 0x80 /* init or lock _rttvar */ + +#ifdef ROUTER_STACK + + /* New flag values for additional metrics */ + +#define RTV_VALUE1 0x100 /* assign or lock first additional metric */ +#define RTV_VALUE2 0x200 /* assign or lock second additional metric */ +#define RTV_VALUE3 0x400 /* assign or lock third additional metric */ +#define RTV_VALUE4 0x800 /* assign or lock fourth additional metric */ +#define RTV_VALUE5 0x1000 /* assign or lock fifth additional metric */ +#define RTV_ROUTETAG 0x2000 /* assign or lock route tag value */ +#define RTV_WEIGHT 0x4000 /* assign or lock administrative weight */ + +#endif /* ROUTER_STACK */ + +/* + * Bitmask values for rtm_addr. + */ +#define RTA_DST 0x1 /* destination sockaddr present */ +#define RTA_GATEWAY 0x2 /* gateway sockaddr present */ +#define RTA_NETMASK 0x4 /* netmask sockaddr present */ +#define RTA_GENMASK 0x8 /* cloning mask sockaddr present */ +#define RTA_IFP 0x10 /* interface name sockaddr present */ +#define RTA_IFA 0x20 /* interface addr sockaddr present */ +#define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */ +#define RTA_BRD 0x80 /* for NEWADDR, broadcast or p-p dest addr */ + +/* + * Index offsets for sockaddr array for alternate internal encoding. + */ +#define RTAX_DST 0 /* destination sockaddr present */ +#define RTAX_GATEWAY 1 /* gateway sockaddr present */ +#define RTAX_NETMASK 2 /* netmask sockaddr present */ +#define RTAX_GENMASK 3 /* cloning mask sockaddr present */ +#define RTAX_IFP 4 /* interface name sockaddr present */ +#define RTAX_IFA 5 /* interface addr sockaddr present */ +#define RTAX_AUTHOR 6 /* sockaddr for author of redirect */ +#define RTAX_BRD 7 /* for NEWADDR, broadcast or p-p dest addr */ +#define RTAX_MAX 8 /* size of array to allocate */ + +struct rt_addrinfo { + int rti_addrs; + struct sockaddr *rti_info[RTAX_MAX]; +}; + +struct route_cb { + int ip_count; + int ns_count; + int iso_count; + int any_count; +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#define RTFREE(rt) \ + if ((rt)->rt_refcnt <= 1) \ + rtfree(rt); \ + else \ + (rt)->rt_refcnt--; + +extern struct rtstat rtstat; +extern struct radix_node_head *rt_tables[]; +extern int rtmodified; + +#ifdef VIRTUAL_STACK +STATUS routeStorageCreate (void); +#else +int route_init (void); +#endif +void rt_maskedcopy (struct sockaddr *, + struct sockaddr *, struct sockaddr *); +int rt_setgate (struct rtentry *, + struct sockaddr *, struct sockaddr *); +void rtable_init (void **); +void rtalloc (struct route *); +struct rtentry * + rtalloc1 (struct sockaddr *, int); +void rtfree (struct rtentry *); +int rtinit (struct ifaddr *, int, int); +int rtioctl (int, caddr_t); +int rtredirect (struct sockaddr *, struct sockaddr *, + struct sockaddr *, int, struct sockaddr *, struct rtentry **); +int rtrequest (int, struct sockaddr *, + struct sockaddr *, struct sockaddr *, int, struct rtentry **); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrouteh */ diff --git a/h/net/smVxLib.h b/h/net/smVxLib.h new file mode 100644 index 0000000..0f944f4 --- /dev/null +++ b/h/net/smVxLib.h @@ -0,0 +1,108 @@ +/* smVxLib.h - VxWorks specific backplane driver header file */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01h,21mar02,vvv added doc for copyFromMbufs (SPR #20787) +01g,11jun00,ham removed reference to etherLib. +01f,23jul93,jmm changed #include "socket.h" to "sys/socket.h" (spr 2033) +01e,22sep92,rrr added support for c++ +01d,26may92,rrr the tree shuffle +01c,02may92,elh added mask to smVxInit +01b,10apr92,elh added startAddr for sequential addressing. +01a,17nov90,elh written. +*/ + +#ifndef __INCsmVxLibh +#define __INCsmVxLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" +#include "smLib.h" +#include "net/mbuf.h" +#include "net/if.h" +#include "netinet/if_ether.h" +#include "drv/netif/if_sm.h" +#include "errno.h" +#include "sys/ioctl.h" +#include "net/unixLib.h" +#include "net/if_subr.h" +#include "inetLib.h" + +/* defines */ + +#define SM_LOAN FALSE +#define SM_NUM_LOAN 10 +#define SM_MEM_SIZE 0x10000 +#define SM_INPUT_PKTS 200 +#define NSM 1 + +/* + * vxWorks convention is to malloc the driver softc structure, whereas + * UNIX wants this to be a static structure. We provide macros to map + * these differences. + */ + +IMPORT SM_SOFTC * sm_softc[]; +#define UNIT_TO_SOFTC(unit) (sm_softc [unit]) + /* is a struct in sunOS */ +#define etherAddrPtr(eaddr) (eaddr) + +/* different parameters from sunOs */ + +/* copyFromMbufs may cause unaligned memory accesses. It should not be used. */ + +#define copyFromMbufs(pData, pMbuf, len) \ + copy_from_mbufs ((pData), (pMbuf), (len)) + +#define copyToMbufs(pData, len, off, pIf) \ + copy_to_mbufs ((pData), (len), (off), (pIf)) + +#if 0 +#define do_protocol(eh, pMbuf, acp, len) \ + do_protocol_with_type ((eh)->ether_type, (pMbuf), (acp), (len)) +#endif + +#define deviceValid(unit) ((sm_softc [unit] != NULL) ? TRUE : FALSE) + +/* Function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS smVxInit (SM_ANCHOR * pAnchor, char * pMem, int memSize, + BOOL tasOK, +#ifndef USE_OFFSET + int busToLocalOffset, +#endif + int cpuMax, int maxPktBytes, u_long startAddr, u_long mask); + +extern STATUS smVxAttach (int unit, SM_ANCHOR * pAnchor, +#ifndef USE_OFFSET + int busToLocalOffset, +#endif + int maxInputPkts, int intType, int intArg1, int intArg2, + int intArg3); + +extern STATUS smVxInetGet (char * smName, struct in_addr * pSmInet, int cpuNum); +struct mbuf * smLoanBuild (SM_SOFTC * xs, SM_PKT * pPkt, u_char * pData, + int len); +#else + +extern STATUS smVxInit (); +extern STATUS smVxAttach (); +extern STATUS smVxInetGet (); +struct mbuf * smLoanBuild (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsmVxLibh */ diff --git a/h/net/socketvar.h b/h/net/socketvar.h new file mode 100644 index 0000000..2ba2628 --- /dev/null +++ b/h/net/socketvar.h @@ -0,0 +1,317 @@ +/* socketvar.h - socket header file */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + * + * @(#)socketvar.h 7.3 (Berkeley) 12/30/87 + */ + +/* +modification history +-------------------- +02r,10oct01,rae merge from truestack v02u base 02q (SPR #34005) +02q,19sep97,vin changed m_ext.ext_size to m_extSize +02p,28feb96,vin upgraded to bsd 4.4. +02o,18aug94,dzb added sb_want to struct sockbuf (SPR #3552). + added check of m_len for user clusters in sballoc and sbfree. + added so_userArg to struct socket for use w/ sowakeup callback. +02n,22sep92,rrr added support for c++ +02m,26may92,rrr the tree shuffle +02l,04oct91,rrr passed through the ansification filter + -changed copyright notice +02k,05oct90,shl added copyright notice. + made #endif ANSI style. +02j,26jun90,jcf changed SEM_BINARY to SEMAPHORE. +02i,19apr90,hjb removed sb_flagSem, changed MIN to min, deleted + sblock and sbunlock which are not needed anymore. +02h,20mar90,jcf changed semTake to include timeout of WAIT_FOREVER. +02g,16mar90,rdc added select support. +02f,16apr89,gae updated to new 4.3BSD. +02e,04may88,jcf changed SEMAPHOREs to SEM_IDs. +02d,14dec87,gae removed vxWorks.h include!!! +02c,04nov87,dnw removed unnecessary KERNEL conditional. +02b,03apr87,ecs added header and copyright. +02a,02feb87,jlf removed ifdef CLEAN +01a,19nov86,llk fixed include file references. +*/ + +#ifndef __INCsocketvarh +#define __INCsocketvarh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "semLib.h" +#include "selectLib.h" +#include "net/uio.h" +#include "net/mbuf.h" + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Kernel structure per socket. + * Contains send and receive buffer queues, + * handle on protocol and pointer to protocol + * private data and error information. + */ + +struct socket + { + short so_type; /* generic type, see socket.h */ + short so_options; /* from socket call, see socket.h */ + short so_linger; /* time to linger while closing */ + short so_state; /* internal state flags SS_*, below */ + caddr_t so_pcb; /* protocol control block */ + struct protosw *so_proto; /* protocol handle */ + + /* If user wants to use so_userArg, then public API is required. + * Because socket{} is located in kernel heap, and user can't access + * it directly. + */ + int so_userArg; /* WRS extension - user argument */ + SEM_ID so_timeoSem; /* WRS extension */ + int so_fd; /* WRS extension - file descriptor */ + + /* + * Variables for connection queueing. + * Socket where accepts occur is so_head in all subsidiary sockets. + * If so_head is 0, socket is not related to an accept. + * For head socket so_q0 queues partially completed connections, + * while so_q is a queue of connections ready to be accepted. + * If a connection is aborted and it has so_head set, then + * it has to be pulled out of either so_q0 or so_q. + * We allow connections to queue up based on current queue lengths + * and limit on number of queued connections for this socket. + */ + + struct socket *so_head; /* back pointer to accept socket */ + struct socket *so_q0; /* queue of partial connections */ + struct socket *so_q; /* queue of incoming connections */ + short so_q0len; /* partials on so_q0 */ + short so_qlen; /* number of connections on so_q */ + short so_qlimit; /* max number queued connections */ + short so_timeo; /* connection timeout */ + u_short so_error; /* error affecting connection */ + short so_pgrp; /* pgrp for signals */ + u_long so_oobmark; /* chars to oob mark */ + + /* Variables for socket buffering. */ + + struct sockbuf + { + u_long sb_cc; /* actual chars in buffer */ + u_long sb_hiwat; /* max actual char count */ + u_long sb_mbcnt; /* chars of mbufs used */ + u_long sb_mbmax; /* max chars of mbufs to use */ + u_long sb_lowat; /* low water mark (not used yet) */ + struct mbuf *sb_mb; /* the mbuf chain */ + struct proc *sb_sel; /* process selecting read/write */ + short sb_timeo; /* timeout (not used yet) */ + short sb_flags; /* flags, see below */ + + SEM_ID sb_Sem; /* WRS extension */ + int sb_want; /* WRS extension */ + } so_rcv, so_snd; + +#define SB_MAX (256*1024) /* default for max chars in sockbuf */ +#define SB_LOCK 0x01 /* lock on data queue */ +#define SB_WANT 0x02 /* someone is waiting to lock */ +#define SB_WAIT 0x04 /* someone is waiting for data/space */ +#define SB_SEL 0x08 /* someone is selecting */ +#define SB_ASYNC 0x10 /* ASYNC I/O, need signals */ +#define SB_NOTIFY (SB_WAIT|SB_SEL|SB_ASYNC) +#define SB_NOINTR 0x40 /* operations not interruptible */ + + void (*so_upcall) (struct socket *so, caddr_t arg, int waitf); + caddr_t so_upcallarg; /* Arg for above */ + BOOL selectFlag; /* Select list available? */ + SEL_WAKEUP_LIST so_selWakeupList; /* WRS extension */ + int vsid; /* WRS extension for virtual stack id */ + }; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + + +/* + * Socket state bits. + */ +#define SS_NOFDREF 0x001 /* no file table ref any more */ +#define SS_ISCONNECTED 0x002 /* socket connected to a peer */ +#define SS_ISCONNECTING 0x004 /* in process of connecting to peer */ +#define SS_ISDISCONNECTING 0x008 /* in process of disconnecting */ +#define SS_CANTSENDMORE 0x010 /* can't send more data to peer */ +#define SS_CANTRCVMORE 0x020 /* can't receive more data from peer */ +#define SS_RCVATMARK 0x040 /* at mark on input */ + +#define SS_PRIV 0x080 /* privileged for broadcast, raw... */ +#define SS_NBIO 0x100 /* non-blocking ops */ +#define SS_ASYNC 0x200 /* async i/o notify */ +#define SS_ISCONFIRMING 0x400 /* deciding to accept connection req */ + +/* + * Macros for sockets and socket buffering. + */ + +/* + * How much space is there in a socket buffer (so->so_snd or so->so_rcv)? + * This is problematical if the fields are unsigned, as the space might + * still be negative (cc > hiwat or mbcnt > mbmax). Should detect + * overflow and return 0. Should use "lmin" but it doesn't exist now. + */ +#define sbspace(sb) \ + ((long) min((int)((sb)->sb_hiwat - (sb)->sb_cc), \ + (int)((sb)->sb_mbmax - (sb)->sb_mbcnt))) + +/* do we have to send all at once on a socket? */ +#define sosendallatonce(so) \ + ((so)->so_proto->pr_flags & PR_ATOMIC) + +/* can we read something from so? */ +#define soreadable(so) \ + ((so)->so_rcv.sb_cc >= (so)->so_rcv.sb_lowat || \ + ((so)->so_state & SS_CANTRCVMORE) || \ + (so)->so_qlen || (so)->so_error) + +/* can we write something to so? */ +#define sowriteable(so) \ + ((sbspace(&(so)->so_snd) >= (so)->so_snd.sb_lowat) && \ + (((so)->so_state&SS_ISCONNECTED) || \ + (((so)->so_proto->pr_flags&PR_CONNREQUIRED)==0) || \ + ((so)->so_state & SS_CANTSENDMORE) || \ + (so)->so_error)) + +/* adjust counters in sb reflecting allocation of m */ +#define sballoc(sb, m) { \ + (sb)->sb_cc += (m)->m_len; \ + (sb)->sb_mbcnt += MSIZE; \ + if ((m)->m_flags & M_EXT) \ + (sb)->sb_mbcnt += (m)->m_extSize; \ +} + +/* adjust counters in sb reflecting freeing of m */ +#define sbfree(sb, m) { \ + (sb)->sb_cc -= (m)->m_len; \ + (sb)->sb_mbcnt -= MSIZE; \ + if ((m)->m_flags & M_EXT) \ + (sb)->sb_mbcnt -= (m)->m_extSize; \ +} + +/* + * Set lock on sockbuf sb; sleep if lock is already held. + * Unless SB_NOINTR is set on sockbuf, sleep is interruptible. + * Returns error without lock if sleep is interrupted. + */ +#define sblock(sb, wf) ((sb)->sb_flags & SB_LOCK ? \ + (((wf) == M_WAITOK) ? sb_lock(sb) : EWOULDBLOCK) : \ + ((sb)->sb_flags |= SB_LOCK), 0) + +/* release lock on sockbuf sb */ +#define sbunlock(sb) { \ + (sb)->sb_flags &= ~SB_LOCK; \ + if ((sb)->sb_flags & SB_WANT) { \ + (sb)->sb_flags &= ~SB_WANT; \ + wakeup((caddr_t)&(sb)->sb_flags); \ + } \ +} + +#define sorwakeup(so) { sowakeup((so), &(so)->so_rcv, SELREAD); \ + if ((so)->so_upcall) \ + (*((so)->so_upcall))((so), (so)->so_upcallarg, M_DONTWAIT); \ + } + +#define sowwakeup(so) sowakeup((so), &(so)->so_snd, SELWRITE) + +IMPORT VOIDFUNCPTR sowakeupHook; + +extern u_long sb_max; + +/* to catch callers missing new second argument to sonewconn: */ +#define sonewconn(head, connstatus) sonewconn1((head), (connstatus)) + +/* strings for sleep message: */ +extern char netio[], netcon[], netcls[]; + +/* + * File operations on sockets. + */ +extern int soo_ioctl (struct socket * so, int cmd, caddr_t data); +extern int soo_select (struct socket *so, SEL_WAKEUP_NODE *wakeupNode); +extern int soo_unselect (struct socket *so, SEL_WAKEUP_NODE *wakeupNode); + +struct mbuf; +struct sockaddr; + +extern void sbappend (struct sockbuf *sb, struct mbuf *m); +extern int sbappendaddr (struct sockbuf *sb, struct sockaddr *asa, + struct mbuf *m0, struct mbuf *control); +extern int sbappendcontrol (struct sockbuf *sb, struct mbuf *m0, + struct mbuf *control); +extern void sbappendrecord (struct sockbuf *sb, struct mbuf *m0); +extern void sbcheck (struct sockbuf *sb); +extern void sbcompress (struct sockbuf *sb, struct mbuf *m, struct mbuf *n); +extern void sbdrop (struct sockbuf *sb, int len); +extern void sbdroprecord (struct sockbuf *sb); +extern void sbflush (struct sockbuf *sb); +extern void sbinsertoob (struct sockbuf *sb, struct mbuf *m0); +extern void sbrelease (struct sockbuf *sb); +extern int sbreserve (struct sockbuf *sb, u_long cc); +extern void sbwait (struct sockbuf *sb); +extern void sbwakeup(struct socket *so, struct sockbuf *sb, + SELECT_TYPE wakeupType); +extern int sb_lock (struct sockbuf *sb); +extern int soabort (struct socket *so); +extern int soaccept (struct socket *so, struct mbuf *nam); +extern int sobind (struct socket *so, struct mbuf *nam); +extern void socantrcvmore (struct socket *so); +extern void socantsendmore (struct socket *so); +extern int soclose (struct socket *so); +extern int soconnect (struct socket *so, struct mbuf *nam); +extern int soconnect2 (struct socket *so1, struct socket *so2); +extern int socreate (int dom, struct socket **aso, int type, int proto); +extern int sodisconnect (struct socket *so); +extern void sofree (struct socket *so); +extern int sogetopt (struct socket *so, int level, int optname, + struct mbuf **mp); +extern void sohasoutofband (struct socket *so); +extern void soisconnected (struct socket *so); +extern void soisconnecting (struct socket *so); +extern void soisdisconnected (struct socket *so); +extern void soisdisconnecting (struct socket *so); +extern int solisten (struct socket *so, int backlog); +extern struct socket * + sonewconn1 (struct socket *head, int connstatus); +extern void soqinsque (struct socket *head, struct socket *so, int q); +extern int soqremque (struct socket *so, int q); +extern int soreceive (struct socket *so, struct mbuf **paddr, + struct uio *pUio, struct mbuf **mp0, struct mbuf ** + controlp, int *flagsp); +extern int soreserve (struct socket *so, u_long sndcc, u_long rcvcc); +extern void sorflush (struct socket *so); +extern int sosend (struct socket *so, struct mbuf *addr, struct uio *uio, + struct mbuf *top, struct mbuf *control, int flags); +extern int sosetopt (struct socket *so, int level, int optname, + struct mbuf *m0); +extern int soshutdown (struct socket *so, int how); +extern void sowakeup (struct socket *so, struct sockbuf *sb, + SELECT_TYPE wakeupType); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsocketvarh */ diff --git a/h/net/systm.h b/h/net/systm.h new file mode 100644 index 0000000..4d0d94c --- /dev/null +++ b/h/net/systm.h @@ -0,0 +1,103 @@ +/* systm.h - system header file */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * and the VxWorks Software License Agreement specify the terms and + * conditions for redistribution. + * + * @(#)systm.h 7.1 (Berkeley) 6/4/86 + */ + +/* +modification history +-------------------- +01n,10oct01,rae merge from truestack (VIRTUAL_STACK) +01m,28feb00,frf Add SH4 support for T2 +01m,04sep98,cdp make ARM CPUs with ARM_THUMB==TRUE use portable routines. +01l,20sep97,tpr added ARM to !PORTABLE list. +01k,22sep92,rrr added support for c++ + updated copyright +02k,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +02j,07mar91,ajm ifdef'd out _remque, and _insque for mips compiler +02i,05oct90,shl added copyright notice. +02h,20mar90,jcf changed semTake operations to include timeout of WAIT_FOREVER. +02g,22jun88,dnw name tweaks to spl macros. + added macros for ovbcopy(), copyin(), copyout(), and imin(). +02f,04mar88,jcf changed splSem to splSemId, and changed sem calls accordingly. +02e,27jan88,rdc included taskLib.h instead of vxLib.h +02d,23jan88,rdc changed names of processor level macros because of + size issues. +02c,08jan88,rdc added processor level macros. +02b,28aug87,dnw removed unnecessary stuff. +02a,03apr87,ecs added header and copyright. +*/ + +#ifndef __INCsystmh +#define __INCsystmh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "taskLib.h" +#include "semLib.h" + +#ifdef VIRTUAL_STACK +#include "netinet/vsLib.h" +#endif + +#if ( defined(PORTABLE) || \ + ( \ + (CPU!=MC68020) && (CPU!=MC68040) && (CPU!=MC68060) && \ + (CPU_FAMILY!=I80X86) && (CPU_FAMILY!=AM29XXX) && \ + (CPU_FAMILY!=SH) && (CPU_FAMILY!=ARM) \ + ) || \ + ((CPU_FAMILY == ARM) && ARM_THUMB)) +#define unixLib_PORTABLE +#define INCHKSUM_PORTABLE +#endif /* defined(PORTABLE) || (CPU_FAMILY != MC680X0) */ + +#ifndef VIRTUAL_STACK +IMPORT SEM_ID splSemId; +IMPORT int splTid; +#endif + + +/* casts to keep lint happy */ + +#define insque(q,p) _insque((caddr_t)q,(caddr_t)p) +#define remque(q) _remque((caddr_t)q) + +/* macros for Unix routines */ + +#define ovbcopy bcopy /* overlapped buffer copy */ +#define copyout(from, to, len) (bcopy (from, to, len), OK) +#define copyin(from, to, len) (bcopy (from, to, len), OK) +#define imin(a,b) (((a) < (b)) ? (a) : (b)) /* interger min */ +#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) + + +/* processor level macro - + * these are identical to the routines spl...() and can be used where + * speed is more important than code size. + */ + +#define SPLNET() (((ULONG)taskIdCurrent == splTid) ? \ + 1 : (semTake(splSemId, WAIT_FOREVER), \ + splTid = (ULONG)taskIdCurrent, 0)) + +#define SPLIMP() SPLNET() + +#define SPLX(x) if ((x) == 0) (splTid = 0, semGive (splSemId)) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsystmh */ diff --git a/h/net/uio.h b/h/net/uio.h new file mode 100644 index 0000000..b039275 --- /dev/null +++ b/h/net/uio.h @@ -0,0 +1,101 @@ +/* uio.h - uio header file */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)uio.h 8.5 (Berkeley) 2/22/94 + */ + +/* +modification history +-------------------- +01b,13dec99,jkf added #ifndef _ASMLANGUAGE +01a,13mar96,vin upgraded to 4.4, integrated with 02h of uio.h +*/ + +#ifndef __INCuioh +#define __INCuioh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "sys/types.h" + +#ifndef _ASMLANGUAGE + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +struct iovec { + caddr_t iov_base; + int iov_len; +}; + +enum uio_rw { UIO_READ, UIO_WRITE }; + +/* Segment flag values. */ +enum uio_seg { + UIO_USERSPACE, /* from user data space */ + UIO_SYSSPACE, /* from system space */ + UIO_USERISPACE /* from user I space */ +}; + +struct uio { + struct iovec *uio_iov; + int uio_iovcnt; + off_t uio_offset; + int uio_resid; + enum uio_seg uio_segflg; + enum uio_rw uio_rw; +#ifdef UNIXBSD44 /* does not apply to vxWorks */ + struct proc *uio_procp; +#endif +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#define UIO_MAXIOV 1024 /* max 1K of iov's */ +#define UIO_SMALLIOV 8 /* 8 on stack, else malloc */ + +#endif /* #ifndef _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCuioh */ diff --git a/h/net/unixLib.h b/h/net/unixLib.h new file mode 100644 index 0000000..84e9cc8 --- /dev/null +++ b/h/net/unixLib.h @@ -0,0 +1,113 @@ +/* unixLib.h - UNIX kernel compatability library header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01f,05oct97,vin added DATA_TO_MBLK macro +01e,31mar97,vin added LIST macros for protocol control blocks. +01d,05dec96,vin redefined MALLOC and FREE so that they use network buffers. + removed unnecessary macros M_WAITOK, M_NOWAIT, M_.... +01c,22sep92,rrr added support for c++ +01b,26may92,rrr the tree shuffle +01a,01apr92,elh written. +*/ + +#ifndef __INCunixLibh +#define __INCunixLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "semLib.h" + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* linked list macros */ + +#define LIST_HEAD(name, type) \ + struct name \ + { \ + struct type *lh_first; /* first element */ \ + } + +#define LIST_ENTRY(type) \ +struct { \ + struct type *le_next; /* next element */ \ + struct type **le_prev; /* address of previous next element */ \ +} + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* + * List functions. + */ +#define LIST_INIT(head) { \ + (head)->lh_first = NULL; \ +} + +#define LIST_INSERT_HEAD(head, elm, field) { \ + if (((elm)->field.le_next = (head)->lh_first) != NULL) \ + (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ + (head)->lh_first = (elm); \ + (elm)->field.le_prev = &(head)->lh_first; \ +} + +#define LIST_REMOVE(elm, field) { \ + if ((elm)->field.le_next != NULL) \ + (elm)->field.le_next->field.le_prev = \ + (elm)->field.le_prev; \ + *(elm)->field.le_prev = (elm)->field.le_next; \ +} + + +#define MALLOC(space, cast, size, type, flags) { \ + (space) = (cast)_netMalloc((size), (type), (flags)); \ +} + +#define FREE(addr, type) { \ + _netFree((caddr_t)(addr)); \ +} + +#define DATA_TO_MBLK(pBuf) \ + (*((struct mbuf **)((char *)(pBuf) - sizeof(struct mbuf **)))) + +/* Function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern int splnet (void); +extern int splimp (void); +extern void splx (int x); +extern void panic (char *msg); +extern void wakeup (SEM_ID semId); +extern void ksleep (SEM_ID semId); +extern char * _netMalloc (int bufSize, UCHAR type, int canWait); +extern void _netFree (char * pBuf); +extern void * hashinit (int elements, int type, u_long * hashmask); + +#else /* __STDC__ */ + +extern int splnet (); +extern int splimp (); +extern void splx (); +extern void panic (); +extern void wakeup (); +extern void ksleep(); +extern char * _netMalloc (); +extern void _netFree (); +extern void * hashinit (); + +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCunixLibh */ diff --git a/h/netBufLib.h b/h/netBufLib.h new file mode 100644 index 0000000..51452ec --- /dev/null +++ b/h/netBufLib.h @@ -0,0 +1,533 @@ +/* netBufLib.h - network buffers header header file */ + +/* Copyright 1984 - 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01o,05jun02,vvv added M_EOB flag (SPR #72213) +01n,26mar02,vvv added M_PROXY flag (SPR #74518) +01m,10oct01,rae merge from truestack ver 01q base 01l +01l,24mar99,ann protected some #defines by #ifndefs due to conflicts + in project facility (all the ones defined in 00network.cdf) +01k,16mar99,spm recovered orphaned code from tor1_0_1.sens1_1 (SPR #25770) +01j,08oct98,gnn updated system network buffer allocations +01i,11dec97,vin added prototype for netMblkOffsetToBufCopy part of SPR 9563. +01h,08dec97,vin added prototype for netMblkChainDup SPR 9966. +01g,03dec97,vin added prototype for netTupleGet(), added NUM_SYS_xxx defines +01f,13nov97,vin added error codes and cleanup. +01e,08oct97,vin corrected clBlkFree() +01d,30sep96,vin added M_BLK_SZ. +01c,26sep97,vin added NUM_XXX_MIN macros for bootroms. +01b,19sep97,vin added cluster Blk typedef, optimized mBlk structure. + moved mExt structure out of the mBlk structure. +01a,08aug97,vin written. +*/ + +#ifndef __INCnetBufLibh +#define __INCnetBufLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#if CPU_FAMILY==I960 +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* status codes */ + +#define S_netBufLib_MEMSIZE_INVALID (M_netBufLib | 1) +#define S_netBufLib_CLSIZE_INVALID (M_netBufLib | 2) +#define S_netBufLib_NO_SYSTEM_MEMORY (M_netBufLib | 3) +#define S_netBufLib_MEM_UNALIGNED (M_netBufLib | 4) +#define S_netBufLib_MEMSIZE_UNALIGNED (M_netBufLib | 5) +#define S_netBufLib_MEMAREA_INVALID (M_netBufLib | 6) +#define S_netBufLib_MBLK_INVALID (M_netBufLib | 7) +#define S_netBufLib_NETPOOL_INVALID (M_netBufLib | 8) +#define S_netBufLib_INVALID_ARGUMENT (M_netBufLib | 9) +#define S_netBufLib_NO_POOL_MEMORY (M_netBufLib | 10) + +#ifndef NUM_NET_MBLKS +#define NUM_NET_MBLKS 400 /* no. mBlks to initialize */ +#endif /* NUM_NET_MBLKS */ + +#define MAX_MBLK_TYPES 256 /* max number of mBlk types */ + +/* data clusters used by the network stack */ + +#ifndef NUM_64 +#define NUM_64 100 /* no. 64 byte clusters */ +#endif /* NUM_64 */ + +#ifndef NUM_128 +#define NUM_128 100 /* no. 128 byte clusters */ +#endif /* NUM_128 */ + +#ifndef NUM_256 +#define NUM_256 40 /* no. 256 byte clusters */ +#endif /* NUM_256 */ + +#ifndef NUM_512 +#define NUM_512 40 /* no. 512 byte clusters */ +#endif /* NUM_512 */ + +#ifndef NUM_1024 +#define NUM_1024 25 /* no. 1024 byte clusters */ +#endif /* NUM_1024 */ + +#ifndef NUM_2048 +#define NUM_2048 25 /* no. 2048 byte clusters */ +#endif /* NUM_2048 */ + +#ifndef NUM_CL_BLKS +#define NUM_CL_BLKS (NUM_64 + NUM_128 + NUM_256 + \ + NUM_512 + NUM_1024 + NUM_2048) +#endif /* NUM_CL_BLKS */ + +/* data clusters for a minimal configuration */ + +#define NUM_NET_MBLKS_MIN 200 /* no. mBlks to initialize */ + +#define NUM_64_MIN 50 /* no. 64 byte clusters */ +#define NUM_128_MIN 50 /* no. 128 byte clusters */ +#define NUM_256_MIN 10 /* no. 256 byte clusters */ +#define NUM_512_MIN 10 /* no. 512 byte clusters */ +#define NUM_1024_MIN 20 /* no. 1024 byte clusters */ + +#define NUM_CL_BLKS_MIN (NUM_64_MIN + NUM_128_MIN + \ + NUM_256_MIN + NUM_512_MIN + \ + NUM_1024_MIN) + +/* system clusters for routes, interface addresses, pcbs, sockets, etc. */ +/* This is 61440 bytes and should allow us to open the default number */ +/* of sockets which is 50 (NUM_FILES) */ + +#ifndef NUM_SYS_64 +#define NUM_SYS_64 64 /* 64 byte system clusters */ +#endif /* NUM_SYS_64 */ + +#ifndef NUM_SYS_128 +#define NUM_SYS_128 64 /* 128 byte system clusters */ +#endif /* NUM_SYS_128 */ + +#ifndef NUM_SYS_256 +#define NUM_SYS_256 64 /* 256 byte system clusters */ +#endif /* NUM_SYS_256 */ + +#ifndef NUM_SYS_512 +#define NUM_SYS_512 64 /* 512 byte system clusters */ +#endif /* NUM_SYS_512 */ + +#ifndef NUM_SYS_CL_BLKS +#define NUM_SYS_CL_BLKS (NUM_SYS_64 + NUM_SYS_128 + \ + NUM_SYS_256 + NUM_SYS_512) +#endif /* NUM_SYS_CL_BLKS */ + +#ifndef NUM_SYS_MBLKS +#define NUM_SYS_MBLKS (2 * NUM_SYS_CL_BLKS) +#endif /* NUM_SYS_MBLKS */ + +/* system clusters for a minimal configuration */ + +#define NUM_SYS_64_MIN 20 /* 64 byte system clusters */ +#define NUM_SYS_128_MIN 15 /* 128 byte system clusters */ +#define NUM_SYS_256_MIN 15 /* 256 byte system clusters */ +#define NUM_SYS_512_MIN 10 /* 512 byte system clusters */ + +#define NUM_SYS_CL_BLKS_MIN (NUM_SYS_64_MIN + NUM_SYS_128_MIN + \ + NUM_SYS_256_MIN + NUM_SYS_512_MIN) + +#define NUM_SYS_MBLKS_MIN NUM_SYS_CL_BLKS_MIN + +/* cluster defines */ + +#define CL_LOG2_64 6 +#define CL_LOG2_128 7 +#define CL_LOG2_256 8 +#define CL_LOG2_512 9 +#define CL_LOG2_1024 10 +#define CL_LOG2_2048 11 +#define CL_LOG2_4096 12 +#define CL_LOG2_8192 13 +#define CL_LOG2_16384 14 +#define CL_LOG2_32768 15 +#define CL_LOG2_65536 16 + +#define CL_SIZE_64 64 +#define CL_SIZE_128 128 +#define CL_SIZE_256 256 +#define CL_SIZE_512 512 +#define CL_SIZE_1024 1024 +#define CL_SIZE_2048 2048 +#define CL_SIZE_4096 4096 +#define CL_SIZE_8192 8192 +#define CL_SIZE_16384 16384 +#define CL_SIZE_32768 32768 +#define CL_SIZE_65536 65536 + +#define CL_LOG2_MIN CL_LOG2_64 +#define CL_LOG2_MAX CL_LOG2_65536 +#define CL_SIZE_MAX (1 << CL_LOG2_MAX) +#define CL_SIZE_MIN (1 << CL_LOG2_MIN) +#define CL_INDX_MIN 0 +#define CL_INDX_MAX (CL_LOG2_MAX - CL_LOG2_MIN) +#define CL_TBL_SIZE (CL_INDX_MAX + 1) + + +#define CL_LOG2_TO_CL_INDEX(x) ((x) - CL_LOG2_MIN) +#define CL_LOG2_TO_CL_SIZE(x) (1 << (x)) +#define SIZE_TO_LOG2(size) (ffsMsb((size)) - 1) +#define CL_SIZE_TO_CL_INDEX(clSize) (ffsMsb((clSize)) - (1 + CL_LOG2_MIN)) + +/* mBlk types */ +#define MT_FREE 0 /* should be on free list */ +#define MT_DATA 1 /* dynamic (data) allocation */ +#define MT_HEADER 2 /* packet header */ +#define MT_SOCKET 3 /* socket structure */ +#define MT_PCB 4 /* protocol control block */ +#define MT_RTABLE 5 /* routing tables */ +#define MT_HTABLE 6 /* IMP host tables */ +#define MT_ATABLE 7 /* address resolution tables */ +#define MT_SONAME 8 /* socket name */ +#define MT_ZOMBIE 9 /* zombie proc status */ +#define MT_SOOPTS 10 /* socket options */ +#define MT_FTABLE 11 /* fragment reassembly header */ +#define MT_RIGHTS 12 /* access rights */ +#define MT_IFADDR 13 /* interface address */ +#define MT_CONTROL 14 /* extra-data protocol message */ +#define MT_OOBDATA 15 /* expedited data */ +#define MT_IPMOPTS 16 /* internet multicast options */ +#define MT_IPMADDR 17 /* internet multicast address */ +#define MT_IFMADDR 18 /* link-level multicast address */ +#define MT_MRTABLE 19 /* multicast routing tables */ + +#define NUM_MBLK_TYPES 20 /* number of mBlk types defined */ + +/* mBlk flags */ + +#define M_EXT 0x01 /* has an associated cluster */ +#define M_PKTHDR 0x02 /* start of record */ +#define M_EOR 0x04 /* end of record */ +#define M_FORWARD 0x08 /* packet to be forwarded */ + +/* mBlk pkthdr flags, also in mFlags */ + +#define M_BCAST 0x10 /* send/received as link-level broadcast */ +#define M_MCAST 0x20 /* send/received as link-level multicast */ +#define M_PROXY 0x40 /* broadcast forwarded through proxy */ +#define M_SECURE_PKT 0x80 /* already gone through security check */ + +/* + * M_EOB is set when the mblk contains the last part of a large block of + * data sent by an application using TCP (a large block of data is one + * which causes sosend to issue multiple protocol send requests). + * M_EOB and M_PROXY can be used together since M_EOB is only used above + * IP and M_PROXY is only used at IP level. It is important to clear the + * M_EOB flag before the packet is sent to IP for transmission. + */ + +#define M_EOB M_PROXY + +/* flags to mClGet/mBlkGet */ + +#define M_DONTWAIT 1 /* dont wait if buffers not available */ +#define M_WAIT 0 /* wait if buffers not available */ + +/* length to copy to copy all data from the mBlk chain*/ + +#define M_COPYALL 1000000000 + +/* check to see if an mBlk is associated with a cluster */ + +#define M_HASCL(pMblk) ((pMblk)->mBlkHdr.mFlags & M_EXT) + +#define M_BLK_SZ sizeof(struct mBlk) /* size of an mBlk */ +#define MSIZE M_BLK_SZ /* size of an mBlk */ + +#define CL_BLK_SZ sizeof(struct clBlk) /* size of cluster block */ + +/* macro to get to the net pool ptr from the mBlk */ + +#define MBLK_TO_NET_POOL(pMblk) (*(NET_POOL_ID *)((int)pMblk - sizeof(int))) + +/* macro to get to the cluster pool ptr from the cluster buffer */ + +#define CL_BUF_TO_CL_POOL(pClBuf) (*(CL_POOL_ID *)((int)pClBuf - sizeof(int))) + +/* macro to get to the cluster reference count from the cluster buffer */ + +#define CL_BUF_TO_REFCNT(pClBuf) (UCHAR *)((int)pClBuf - (2 * sizeof(int))) + +/* macros for accessing the functions of net pool directly */ + +#define poolInit(poolId,pMclBlkConfig,pClDescTbl,tblNumEnt,fromKheap) \ + (*(((NET_POOL_ID)(poolId))->pFuncTbl->pInitRtn)) \ + ((poolId), (pMclBlkConfig), (pClDescTbl), (tblNumEnt), \ + (fromKheap)) + +#define mBlkFree(poolId,pMblk) \ + (*(((NET_POOL_ID)(poolId))->pFuncTbl->pMblkFreeRtn)) \ + ((poolId), (pMblk)) + +#define clFree(poolId,pClBuf) \ + (*(((NET_POOL_ID)(poolId))->pFuncTbl->pClFreeRtn)) \ + ((poolId), (pClBuf)) + +#define clBlkFree(poolId,pClBlk) \ + (*(((NET_POOL_ID)(poolId))->pFuncTbl->pClBlkFreeRtn)) \ + ((pClBlk)) + +#define mBlkClFree(poolId,pMblk) \ + (*(((NET_POOL_ID)(poolId))->pFuncTbl->pMblkClFreeRtn)) \ + ((poolId), (pMblk)) + +#define mBlkGet(poolId,canWait,type) \ + (*(((NET_POOL_ID)(poolId))->pFuncTbl->pMblkGetRtn)) \ + ((poolId), (canWait), (type)) + +#define clBlkGet(poolId,canWait) \ + (*(((NET_POOL_ID)(poolId))->pFuncTbl->pClBlkGetRtn)) \ + ((poolId), (canWait)) + +#define clusterGet(poolId,pClPool) \ + (*(((NET_POOL_ID)(poolId))->pFuncTbl->pClGetRtn)) \ + ((poolId), (pClPool)) + +#define mClGet(poolId,pMblk,bufSize,canWait,bestFit) \ + (*(((NET_POOL_ID)(poolId))->pFuncTbl->pMblkClGetRtn)) \ + ((poolId), (pMblk), (bufSize), (canWait), (bestFit)) + +#define clPoolIdGet(poolId,bufSize,bestFit) \ + (*(((NET_POOL_ID)(poolId))->pFuncTbl->pClPoolIdGetRtn)) \ + ((poolId), (bufSize), (bestFit)) + +/* + * This structure is used to configure the number of mBlks and cluster blocks + * that are allocated in a netpool. Each cluster has a corresponding cluster + * block which manages it. An mBlk manages a cluster block and the cluster. + * When a netpool is configured there should as many cluster blocks as the + * cumulative number of clusters. The defaults are defined above, but the + * structure is defined and fileed in usrConfig.c. For TCP applications it is + * good to have two mBlks for every cluster block. + */ + +typedef struct + { + int mBlkNum; /* number of mBlks */ + int clBlkNum; /* number of cluster Blocks */ + char * memArea; /* pre allocated memory area */ + int memSize; /* pre allocated memory size */ + } M_CL_CONFIG; + +/* + * This structure defines the way the networking code utilizes clusters. + * A table of type CL_DESC is filled in usrNetwork.c. + * Clusters are also used to hold network data structures other than the + * regular data. The network data structures are routing table entries, + * interface address structures, multicast address structures etc. + */ + +typedef struct clDesc + { + int clSize; /* cluster type */ + int clNum; /* number of clusters */ + char * memArea; /* pre allocated memory area */ + int memSize; /* pre allocated memory size */ + } CL_DESC; + +/* this structure defines the cluster */ + +typedef struct clBuff + { + struct clBuff * pClNext; /* pointer to the next clBuff */ + } CL_BUF; + +typedef CL_BUF * CL_BUF_ID; + +/* this structure defines the each cluster pool */ + +typedef struct clPool + { + int clSize; /* cluster size */ + int clLg2; /* cluster log 2 size */ + int clNum; /* number of clusters */ + int clNumFree; /* number of clusters free */ + int clUsage; /* number of times used */ + CL_BUF_ID pClHead; /* pointer to the cluster head */ + struct netPool * pNetPool; /* pointer to the netPool */ + } CL_POOL; + +typedef CL_POOL * CL_POOL_ID; + +/* header at beginning of each mBlk */ + +typedef struct mHdr + { + struct mBlk * mNext; /* next buffer in chain */ + struct mBlk * mNextPkt; /* next chain in queue/record */ + char * mData; /* location of data */ + int mLen; /* amount of data in this mBlk */ + UCHAR mType; /* type of data in this mBlk */ + UCHAR mFlags; /* flags; see below */ + USHORT reserved; + } M_BLK_HDR; + +/* record/packet header in first mBlk of chain; valid if M_PKTHDR set */ + +typedef struct pktHdr + { + struct ifnet * rcvif; /* rcv interface */ + int len; /* total packet length */ + } M_PKT_HDR; + +typedef union clBlkList + { + struct clBlk * pClBlkNext; /* pointer to the next clBlk */ + char * pClBuf; /* pointer to the buffer */ + } CL_BLK_LIST; + +/* description of external storage mapped into mBlk, valid if M_EXT set */ + +typedef struct clBlk + { + CL_BLK_LIST clNode; /* union of next clBlk, buffer ptr */ + UINT clSize; /* cluster size */ + int clRefCnt; /* reference count of the cluster */ + FUNCPTR pClFreeRtn; /* pointer to cluster free routine */ + int clFreeArg1; /* free routine arg 1 */ + int clFreeArg2; /* free routine arg 2 */ + int clFreeArg3; /* free routine arg 3 */ + struct netPool * pNetPool; /* pointer to the netPool */ + } CL_BLK; + +/* mBlk structure */ + +typedef struct mBlk + { + M_BLK_HDR mBlkHdr; /* header */ + M_PKT_HDR mBlkPktHdr; /* pkthdr */ + CL_BLK * pClBlk; /* pointer to cluster blk */ + } M_BLK; + +/* mBlk statistics used to show data pool by show routines */ + +typedef struct mbstat + { + ULONG mNum; /* mBlks obtained from page pool */ + ULONG mDrops; /* times failed to find space */ + ULONG mWait; /* times waited for space */ + ULONG mDrain; /* times drained protocols for space */ + ULONG mTypes[256]; /* type specific mBlk allocations */ + } M_STAT; + +typedef M_BLK * M_BLK_ID; +typedef CL_BLK * CL_BLK_ID; +typedef struct netPool NET_POOL; +typedef struct poolFunc POOL_FUNC; +typedef NET_POOL * NET_POOL_ID; + +struct poolFunc /* POOL_FUNC */ + { + /* pointer to the pool initialization routine */ + STATUS (*pInitRtn) (NET_POOL_ID pNetPool, M_CL_CONFIG * pMclBlkConfig, + CL_DESC * pClDescTbl, int clDescTblNumEnt, + BOOL fromKheap); + + /* pointer to mBlk free routine */ + void (*pMblkFreeRtn) (NET_POOL_ID pNetPool, M_BLK_ID pMblk); + + /* pointer to cluster Blk free routine */ + void (*pClBlkFreeRtn) (CL_BLK_ID pClBlk); + + /* pointer to cluster free routine */ + void (*pClFreeRtn) (NET_POOL_ID pNetPool, char * pClBuf); + + /* pointer to mBlk/cluster pair free routine */ + M_BLK_ID (*pMblkClFreeRtn) (NET_POOL_ID pNetPool, M_BLK_ID pMblk); + + /* pointer to mBlk get routine */ + M_BLK_ID (*pMblkGetRtn) (NET_POOL_ID pNetPool, int canWait, UCHAR type); + + /* pointer to cluster Blk get routine */ + CL_BLK_ID (*pClBlkGetRtn) (NET_POOL_ID pNetPool, int canWait); + + /* pointer to a cluster buffer get routine */ + char * (*pClGetRtn) (NET_POOL_ID pNetPool, CL_POOL_ID pClPool); + + /* pointer to mBlk/cluster pair get routine */ + STATUS (*pMblkClGetRtn) (NET_POOL_ID pNetPool, M_BLK_ID pMblk, + int bufSize, int canWait, BOOL bestFit); + + /* pointer to cluster pool Id get routine */ + CL_POOL_ID (*pClPoolIdGetRtn) (NET_POOL_ID pNetPool, int bufSize, + BOOL bestFit); + }; + +struct netPool /* NET_POOL */ + { + M_BLK_ID pmBlkHead; /* head of mBlks */ + CL_BLK_ID pClBlkHead; /* head of cluster Blocks */ + int mBlkCnt; /* number of mblks */ + int mBlkFree; /* number of free mblks */ + int clMask; /* cluster availability mask */ + int clLg2Max; /* cluster log2 maximum size */ + int clSizeMax; /* maximum cluster size */ + int clLg2Min; /* cluster log2 minimum size */ + int clSizeMin; /* minimum cluster size */ + CL_POOL * clTbl [CL_TBL_SIZE]; /* pool table */ + M_STAT * pPoolStat; /* pool statistics */ + POOL_FUNC * pFuncTbl; /* ptr to function ptr table */ + }; + +/* external declarations */ + +IMPORT STATUS netBufLibInit (void); +IMPORT STATUS netPoolInit (NET_POOL_ID pNetPool, + M_CL_CONFIG * pMclBlkConfig, + CL_DESC * pClDescTbl, int clDescTblNumEnt, + POOL_FUNC * pFuncTbl); +IMPORT STATUS netPoolDelete (NET_POOL_ID); +IMPORT void netMblkFree (NET_POOL_ID pNetPool, M_BLK_ID pMblk); +IMPORT void netClBlkFree (NET_POOL_ID pNetPool, CL_BLK_ID pClBlk); +IMPORT void netClFree (NET_POOL_ID pNetPool, UCHAR * pClBuf); +IMPORT M_BLK_ID netMblkClFree (M_BLK_ID pMblk); +IMPORT void netMblkClChainFree (M_BLK_ID pMblk); +IMPORT M_BLK_ID netMblkGet (NET_POOL_ID pNetPool, int canWait, + UCHAR type); +IMPORT CL_BLK_ID netClBlkGet (NET_POOL_ID pNetPool, int canWait); +IMPORT char * netClusterGet (NET_POOL_ID pNetPool, + CL_POOL_ID pClPool); +IMPORT STATUS netMblkClGet (NET_POOL_ID pNetPool, M_BLK_ID pMblk, + int bufSize, int canWait, BOOL bestFit); +IMPORT M_BLK_ID netTupleGet (NET_POOL_ID pNetPool, int bufSize, + int canWait, UCHAR type, BOOL bestFit); + +IMPORT M_BLK_ID netTupleGet2 (NET_POOL_ID, int, int); + +IMPORT CL_BLK_ID netClBlkJoin (CL_BLK_ID pClBlk, char * pClBuf, + int size, FUNCPTR pFreeRtn, int arg1, + int arg2, int arg3); +IMPORT M_BLK_ID netMblkClJoin (M_BLK_ID pMblk, CL_BLK_ID pClBlk); +IMPORT CL_POOL_ID netClPoolIdGet (NET_POOL_ID pNetPool, int bufSize, + BOOL bestFit); + +IMPORT int netMblkToBufCopy (M_BLK_ID pMblk, char * pBuf, + FUNCPTR pCopyRtn); +IMPORT int netMblkOffsetToBufCopy (M_BLK_ID pMblk, int offset, + char * pBuf, int len, + FUNCPTR pCopyRtn); +IMPORT M_BLK_ID netMblkDup (M_BLK_ID pSrcMblk, M_BLK_ID pDestMblk); +IMPORT M_BLK_ID netMblkChainDup (NET_POOL_ID pNetPool, M_BLK_ID pMblk, + int offset, int len, int canWait); + +#if CPU_FAMILY==I960 +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnetBufLibh */ + diff --git a/h/netDrv.h b/h/netDrv.h new file mode 100644 index 0000000..b3ec9b4 --- /dev/null +++ b/h/netDrv.h @@ -0,0 +1,85 @@ +/* netDrv.h - netDrv header */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01m,12mar02,elr added values for netDrvDebugLevelSet() +01l,13mar95,dzb added param to netLsByName() prototype (SPR #3662). +01k,22jul93,jmm added declaration for netLsByName() (spr 2305) +01j,22sep92,rrr added support for c++ +01i,04jul92,jcf cleaned up. +01h,26may92,rrr the tree shuffle +01g,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01f,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01e,08aut90,shl added INCnetDrvh to #endif. +01d,08jan87,jlf added ifndef's to keep from being included twice. +01c,24dec86,gae changed stsLib.h to vwModNum.h. +01b,27jul86,llk added S_netDrv_NO_SUCH_FILE_OR_DIR, S_netDrv_PERMISSION_DENIED, + S_netDrv_IS_A_DIRECTORY, S_netDrv_UNIX_FILE_ERROR +01a,30apr86,llk written. +*/ + +#ifndef __INCnetDrvh +#define __INCnetDrvh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" + +/* netDrv status codes */ + +#define S_netDrv_INVALID_NUMBER_OF_BYTES (M_netDrv | 1) +#define S_netDrv_SEND_ERROR (M_netDrv | 2) +#define S_netDrv_RECV_ERROR (M_netDrv | 3) +#define S_netDrv_UNKNOWN_REQUEST (M_netDrv | 4) +#define S_netDrv_BAD_SEEK (M_netDrv | 5) +#define S_netDrv_SEEK_PAST_EOF_ERROR (M_netDrv | 6) +#define S_netDrv_BAD_EOF_POSITION (M_netDrv | 7) +#define S_netDrv_SEEK_FATAL_ERROR (M_netDrv | 8) +#define S_netDrv_WRITE_ONLY_CANNOT_READ (M_netDrv | 9) +#define S_netDrv_READ_ONLY_CANNOT_WRITE (M_netDrv | 10) +#define S_netDrv_READ_ERROR (M_netDrv | 11) +#define S_netDrv_WRITE_ERROR (M_netDrv | 12) +#define S_netDrv_NO_SUCH_FILE_OR_DIR (M_netDrv | 13) +#define S_netDrv_PERMISSION_DENIED (M_netDrv | 14) +#define S_netDrv_IS_A_DIRECTORY (M_netDrv | 15) +#define S_netDrv_UNIX_FILE_ERROR (M_netDrv | 16) +#define S_netDrv_ILLEGAL_VALUE (M_netDrv | 17) + +/* flags for debuging */ + +#define NETLIB_DEBUG_OFF 0 +#define NETLIB_DEBUG_ERRORS 1 +#define NETLIB_DEBUG_ALL 2 + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS netDrvDebugLevelSet (UINT32 debugLevel); +extern STATUS netDevCreate (char *devName, char *host, int protocol); +extern STATUS netDrv (void); +extern STATUS netLsByName (char *dirName); + +#else /* __STDC__ */ + +extern STATUS netDrvDebugLevelSet (); +extern STATUS netDevCreate (); +extern STATUS netDrv (); +extern STATUS netLsByName (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnetDrvh */ diff --git a/h/netLib.h b/h/netLib.h new file mode 100644 index 0000000..9916fd8 --- /dev/null +++ b/h/netLib.h @@ -0,0 +1,262 @@ +/* netLib.h - header file for netLib.c */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01n,10oct01,rae merge from truestack ver 01q base 01m +01m,24mar99,ann protected some #defines within #ifndefs to avoid conflicts + in project tool. (only for those defined in 00network.cdf) +01l,01jul97,vin added routeSockLibInit(). +01k,17apr97,vin added ipFilterLibInit(). +01i,08apr97,vin added mCastRouteLibInit(). +01j,31jan97,vin added default configuration macros. +01h,20jan97,vin added declarations for protocol initialization functions, + added configuration parameters, added interrupt masks. +01g,26aug96,vin added new declaration for schednetisr(). +01f,22sep92,rrr added support for c++ +01e,04jul92,jcf cleaned up. +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01b,05oct90,dnw deleted private routine. +01a,05oct90,shl created. +*/ + +#ifndef __INCnetLibh +#define __INCnetLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* wrs specific network isr codes */ + +#define NETISR_IP 1 /* for IP packets */ +#define NETISR_ARP 2 /* for arp packets */ +#define NETISR_RARP 3 /* for rarp packets */ +#define NETISR_IMP 4 /* same as AF_IMPLINK */ +#define NETISR_NS 5 /* same as AF_NS */ +#define NETISR_ISO 6 /* same as AF_ISO */ +#define NETISR_CCITT 7 /* same as AF_CCITT */ + +/* wrs network isr masks */ + +#define IP_INTR_MASK (1 << NETISR_IP) +#define ARP_INTR_MASK (1 << NETISR_ARP) +#define RARP_INTR_MASK (1 << NETISR_RARP) +#define IMP_INTR_MASK (1 << NETISR_IMP) +#define NS_INTR_MASK (1 << NETISR_NS) +#define ISO_INTR_MASK (1 << NETISR_ISO) +#define CCITT_INTR_MASK (1 << NETISR_CCITT) + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* ip configuration parameters */ + +typedef struct ipcfgparams + { + int ipCfgFlags; /* ip configuration flags */ + int ipDefTtl; /* ip packet default time to live */ + int ipIntrQueueLen; /* ip interrupt queue length */ + int ipFragTtl; /* ip fragment time to live */ + } IP_CFG_PARAMS; + +/* icmp configuration parameters */ + +typedef struct icmpcfgparams + { + int icmpCfgFlags; /* icmp configuration flags */ + } ICMP_CFG_PARAMS; + +/* udp configuration parameters */ + +typedef struct udpcfgparams + { + int udpCfgFlags; /* udp configuration flags */ + int udpSndSpace; /* udp send space */ + int udpRcvSpace; /* udp receive space */ + } UDP_CFG_PARAMS; + +/* tcp configuration parameters */ + +typedef struct tcpcfgparams + { + int tcpCfgFlags; /* tcp configuration flags */ + int tcpSndSpace; /* tcp send space */ + int tcpRcvSpace; /* tcp receive space */ + int tcpConnectTime; /* tcp connect time out */ + int tcpReTxThresh; /* tcp no. dup ACK to trig fast reTx */ + int tcpMssDflt; /* tcp default maximum segment size */ + int tcpRttDflt; /* tcp default RTT if no data */ + int tcpKeepIdle; /* tcp idle time before first probe */ + int tcpKeepCnt; /* tcp max probes before dropping */ + FUNCPTR pTcpRandFunc; /* tcp random function for tcp_init */ + } TCP_CFG_PARAMS; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#define IP_PROTO_NUM_MAX 16 /* maximum size of protocol switch */ + +/* ip configuration defines */ +#define IP_NO_FORWARDING 0x000000000 /* no ip forwarding of pkts */ +#define IP_DO_FORWARDING 0x000000001 /* do ip forwarding of pkts */ +#define IP_DO_REDIRECT 0x000000002 /* do ip redirecting of pkts */ +#define IP_DO_LARGE_BCAST 0x000000004 /* do broadcasting pkt > MTU */ +#define IP_DO_CHECKSUM_SND 0x000000008 /* calculate ip checksum */ +#define IP_DO_CHECKSUM_RCV 0x000000010 + +/* default ip configurations */ +#ifndef IP_FLAGS_DFLT +#define IP_FLAGS_DFLT (IP_DO_FORWARDING | IP_DO_REDIRECT | \ + IP_DO_CHECKSUM_SND | IP_DO_CHECKSUM_RCV) +#endif /* IP_FLAGS_DFLT */ + +#ifndef IP_TTL_DFLT +#define IP_TTL_DFLT 64 /* default ip queue length */ +#endif /* IP_TTL_DFLT */ + +#ifndef IP_QLEN_DFLT +#define IP_QLEN_DFLT 50 +#endif /* IP_QLEN_DFLT */ + +#ifndef IP_FRAG_TTL_DFLT +#define IP_FRAG_TTL_DFLT 60 /* 60 slow time outs, 30secs */ +#endif /* IP_FRAG_TTL_DFLT */ + +/* udp configuration defines */ +#define UDP_DO_NO_CKSUM 0x00000000 +#define UDP_DO_CKSUM_SND 0x00000001 /* do check sum on sends */ +#define UDP_DO_CKSUM_RCV 0x00000002 /* do check sum on recvs */ + +/* default udp configurations */ + +#ifndef UDP_FLAGS_DFLT +#define UDP_FLAGS_DFLT (UDP_DO_CKSUM_SND | UDP_DO_CKSUM_RCV) +#endif /* UDP_FLAGS_DFLT */ + +#ifndef UDP_SND_SIZE_DFLT +#define UDP_SND_SIZE_DFLT 9216 /* default send buffer size */ +#endif /* UDP_SND_SIZE_DFLT */ + +#ifndef UDP_RCV_SIZE_DFLT +#define UDP_RCV_SIZE_DFLT 41600 /* default recv buffer size */ +#endif /* UDP_RCV_SIZE_DFLT */ + +/* tcp configuration defines */ + +#define TCP_NO_RFC1323 0x00000000 /* tcp no RFC 1323 support */ +#define TCP_DO_RFC1323 0x00000001 /* tcp RFC 1323 support*/ + +/* default tcp configurations */ + +#ifndef TCP_FLAGS_DFLT +#define TCP_FLAGS_DFLT (TCP_DO_RFC1323) +#endif /* TCP_FLAGS_DFLT */ + +#ifndef TCP_SND_SIZE_DFLT +#define TCP_SND_SIZE_DFLT 8192 /* default send buffer size */ +#endif /* TCP_SND_SIZE_DFLT */ + +#ifndef TCP_RCV_SIZE_DFLT +#define TCP_RCV_SIZE_DFLT 8192 /* default recv buffer size */ +#endif /* TCP_RCV_SIZE_DFLT */ + +#ifndef TCP_CON_TIMEO_DFLT +#define TCP_CON_TIMEO_DFLT 150 /* 75 secs */ +#endif /* TCP_CON_TIMEO_DFLT */ + +#ifndef TCP_REXMT_THLD_DFLT +#define TCP_REXMT_THLD_DFLT 3 /* 3 times */ +#endif /* TCP_REXMT_THLD_DFLT */ + +#ifndef TCP_MSS_DFLT +#define TCP_MSS_DFLT 512 /* default max segment size */ +#endif /* TCP_MSS_DFLT */ + +#ifndef TCP_RND_TRIP_DFLT +#define TCP_RND_TRIP_DFLT 3 /* 3 secs if no data avail */ +#endif /* TCP_RND_TRIP_DFLT */ + +#ifndef TCP_IDLE_TIMEO_DFLT +#define TCP_IDLE_TIMEO_DFLT 14400 /* idle timeouts, 2 hrs */ +#endif /* TCP_IDLE_TIMEO_DFLT */ + +#ifndef TCP_MAX_PROBE_DFLT +#define TCP_MAX_PROBE_DFLT 8 /* probes before dropping */ +#endif /* TCP_MAX_PROBE_DFLT */ + + +/* icmp configuration defines */ +#define ICMP_NO_MASK_REPLY 0x000000000 /* no mask reply support */ +#define ICMP_DO_MASK_REPLY 0x000000001 /* do icmp mask reply */ + +/* default icmp configurations */ + +#ifndef ICMP_FLAGS_DFLT +#define ICMP_FLAGS_DFLT (ICMP_NO_MASK_REPLY) +#endif /* ICMP_FLAGS_DFLT */ + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS netJobAdd (FUNCPTR routine, int param1, int param2, int param3, + int param4, int param5); +extern STATUS netLibInit (void); +extern void netErrnoSet (int status); +extern void netLibGeneralInit (void); +extern void netTask (void); +extern void schednetisr (int isrType); +extern STATUS ipLibInit (IP_CFG_PARAMS * ipCfg); +extern STATUS rawIpLibInit (void); +extern STATUS rawLibInit (void); +extern STATUS udpLibInit (UDP_CFG_PARAMS * udpCfg); +extern STATUS tcpLibInit (TCP_CFG_PARAMS * tcpCfg); +extern STATUS icmpLibInit (ICMP_CFG_PARAMS * icmpCfg); +extern STATUS igmpLibInit (void); +extern STATUS mCastRouteLibInit (void); +extern void ipFilterLibInit (void); +extern STATUS routeSockLibInit (void); +extern void splSemInit (void); +extern void mbinit (void); +extern void domaininit (void); + +#else /* __STDC__ */ + +extern STATUS netJobAdd (); +extern STATUS netLibInit (); +extern void netErrnoSet (); +extern void netLibGeneralInit (); +extern void netTask (); +extern void schednetisr (); +extern STATUS ipLibInit (); +extern STATUS rawIpLibInit (); +extern STATUS rawLibInit (); +extern STATUS udpLibInit (); +extern STATUS tcpLibInit (); +extern STATUS icmpLibInit (); +extern STATUS igmpLibInit (); +extern STATUS mCastRouteLibInit (); +extern void ipFilterLibInit (); +extern STATUS routeSockLibInit (); +extern void splSemInit (); +extern void mbinit (); +extern void domaininit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnetLibh */ + diff --git a/h/netShow.h b/h/netShow.h new file mode 100644 index 0000000..4612c34 --- /dev/null +++ b/h/netShow.h @@ -0,0 +1,85 @@ +/* netShow.h - header file for netShow.c */ + +/* Copyright 1984-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,16jan01,zhu SPR62489 add 4 functions declaration +01h,12sep94,dzb added tcpDebugShow() declaration (SPR #1552). +01g,22sep92,rrr added support for c++ +01f,27jul92,elh Moved hostShow and routeShow here. +01e,04jul92,jcf cleaned up. +01d,11jun92,elh moved arpShow here from arpLib. +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01a,05oct90,shl created. +*/ + +#ifndef __INCnetShowh +#define __INCnetShowh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void arptabShow (void); +extern void arpShow (void); +extern void icmpstatShow (void); +extern void ifShow (char *ifName); +extern void inetstatShow (void); +extern void ipstatShow (BOOL zero); +extern void mbufShow (void); +extern void netShowInit (void); +extern void igmpShowInit (void); +extern void icmpShowInit (void); +extern void tcpShowInit (void); +extern void tcpDebugShow (int numPrint, int verbose); +extern void tcpstatShow (void); +extern void udpShowInit (void); +extern void udpstatShow (void); +extern void routeShow (void); +extern void hostShow (void); +extern void netStackSysPoolShow (void); +extern void netStackDataPoolShow (void); +extern void routestatShow (void); + + + +#else /* __STDC__ */ + +extern void arptabShow (); +extern void arpShow (); +extern void icmpstatShow (); +extern void ifShow (); +extern void inetstatShow (); +extern void ipstatShow (); +extern void mbufShow (); +extern void netShowInit (); +extern void igmpShowInit (); +extern void icmpShowInit (); +extern void tcpShowInit (); +extern void tcpDebugShow (); +extern void tcpstatShow (); +extern void udpShowInit (); +extern void udpstatShow (); +extern void routeShow (); +extern void hostShow (); +extern void netStackSysPoolShow (); +extern void netStackDataPoolShow (); +extern void routestatShow (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnetShowh */ diff --git a/h/netdb.h b/h/netdb.h new file mode 100644 index 0000000..ed5d1ee --- /dev/null +++ b/h/netdb.h @@ -0,0 +1,137 @@ +/* netdb.h - server entries and the like for routed/rip */ + +/*- + * Copyright (c) 1980, 1983, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)netdb.h 8.1 (Berkeley) 6/2/93 + * $Id: netdb.h,v 4.9.1.2 1993/05/17 09:59:01 vixie Exp $ + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * --Copyright-- + */ + +/* +modification history +-------------------- +01d,19aug97,jag Added the field h_ttl to the structure hostent. +01c,29apr97,jag fixed include define and added C++ linkage. Changed field + names of struc netnet to avoid conflict with i960 macros. +01b,24feb97,jag changed comment. +01a,26nov96,gnn created from BSD4.4 routed +*/ + +#ifndef __INCnetdbh +#define __INCnetdbh + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Structures returned by network data base library. All addresses are + * supplied in host order, and returned in network order (suitable for + * use in system calls). + */ +struct hostent { + char *h_name; /* official name of host */ + char **h_aliases; /* alias list */ + int h_addrtype; /* host address type */ + int h_length; /* length of address */ + char **h_addr_list; /* list of addresses from name server */ +#define h_addr h_addr_list[0] /* address, for backward compatiblity */ + unsigned int h_ttl; /* Time to Live in Seconds for this entry */ +}; + +/* + * Assumption here is that a network number + * fits in an unsigned long -- probably a poor one. + */ +struct netent { + char * nName; /* official name of net */ + char ** nAliases; /* alias list */ + int nAddrtype; /* net address type */ + unsigned long nNet; /* network # */ +}; + +struct servent { + char *s_name; /* official service name */ + char **s_aliases; /* alias list */ + int s_port; /* port # */ + char *s_proto; /* protocol to use */ +}; + +struct protoent { + char *p_name; /* official protocol name */ + char **p_aliases; /* alias list */ + int p_proto; /* protocol # */ +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Error return codes from res_query.c + */ + +#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ +#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ +#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ +#define NO_DATA 4 /* Valid name, no data record of requested type */ +#define NO_ADDRESS NO_DATA /* no address, look for MX record */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnetdbh */ diff --git a/h/netinet/icmp_var.h b/h/netinet/icmp_var.h new file mode 100644 index 0000000..ec14766 --- /dev/null +++ b/h/netinet/icmp_var.h @@ -0,0 +1,100 @@ +/* icmp_var.h - internet control message protocol variable header file */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)icmp_var.h 8.1 (Berkeley) 6/10/93 + */ + +/* +modification history +-------------------- +01b,04jun01,spm removed reference to unused global from virtual stacks +01a,03mar96,vin created from BSD4.4lite2. +*/ + +#ifndef __INCicmp_varh +#define __INCicmp_varh + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Variables related to this implementation + * of the internet control message protocol. + */ +struct icmpstat { +/* statistics related to icmp packets generated */ + u_long icps_error; /* # of calls to icmp_error */ + u_long icps_oldshort; /* no error 'cuz old ip too short */ + u_long icps_oldicmp; /* no error 'cuz old was icmp */ + u_long icps_outhist[ICMP_MAXTYPE + 1]; +/* statistics related to input messages processed */ + u_long icps_badcode; /* icmp_code out of range */ + u_long icps_tooshort; /* packet < ICMP_MINLEN */ + u_long icps_checksum; /* bad checksum */ + u_long icps_badlen; /* calculated bound mismatch */ + u_long icps_reflect; /* number of responses */ + u_long icps_inhist[ICMP_MAXTYPE + 1]; +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Names for ICMP sysctl objects + */ +#define ICMPCTL_MASKREPL 1 /* allow replies to netmask requests */ +#define ICMPCTL_MAXID 2 + +#define ICMPCTL_NAMES { \ + { 0, 0 }, \ + { "maskrepl", CTLTYPE_INT }, \ +} + +#ifndef VIRTUAL_STACK +extern struct icmpstat icmpstat; +#endif /* VIRTUAL_STACK */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCicmp_varh */ diff --git a/h/netinet/if_ether.h b/h/netinet/if_ether.h new file mode 100644 index 0000000..28123b8 --- /dev/null +++ b/h/netinet/if_ether.h @@ -0,0 +1,333 @@ +/* if_ether.h - network interface Ethernet header file */ + +/* Copyright 1984 - 2002 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if_ether.h 8.1 (Berkeley) 6/10/93 + */ + +/* +modification history +-------------------- +01h,24may02,vvv replaced GNU_PACKED with _WRS_PACK_ALIGN +01g,23may02,vvv added SH to GNU_PACKED list +01f,10oct01,rae merge from truestack ver 01h base o1d + SPRs 63006, 69112 +01e,22jan01,scm dealt with ARM alignment issue +01d,27may99,pul added ether_tag_header and SIZEOF_TAG_ETHERHEADER +01c,29apr99,pul Upgraded NPT phase3 code to tor2.0.0 +01b,08Nov98,vin changed the ordering of arguments to ipEtherResolveRtn +01a,03mar96,vin created from BSD4.4 stuff,integrated with 03l of if_ether.h +*/ + +#ifndef __INCif_etherh +#define __INCif_etherh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "netinet/in.h" + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +#if ((defined __arm__) || (defined __sh__)) +#define ETHER_PACKED _WRS_PACK_ALIGN(1) +#else +#define ETHER_PACKED +#endif + +/* + * Ethernet address - 6 octets + * this is only used by the ethers(3) functions. + */ +struct ether_addr { + u_char ether_addr_octet[6]; +} ETHER_PACKED; + +/* + * Structure of a 10Mb/s Ethernet header. + */ +struct ether_header { + u_char ether_dhost[6]; + u_char ether_shost[6]; + u_short ether_type; +} ETHER_PACKED; + +/* Ether header for tagged frames */ +struct ether_tag_header { + u_char ether_dhost[6]; + u_char ether_shost[6]; + u_char etherTag[4]; + u_short ether_type; +}; + +#define ETHERTYPE_PUP 0x0200 /* PUP protocol */ +#define ETHERTYPE_IP 0x0800 /* IP protocol */ +#define ETHERTYPE_ARP 0x0806 /* address resolution protocol */ +#define ETHERTYPE_REVARP 0x8035 /* reverse addr resolution protocol */ + +/* + * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have + * (type-ETHERTYPE_TRAIL)*512 bytes of data followed + * by an ETHER type (as given above) and then the (variable-length) header. + */ +#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */ +#define ETHERTYPE_NTRAILER 16 + +#define ETHERMTU 1500 +#define ETHERMIN (60-14) + +/* + * for compilers that have 4-bytes structure alignment rule, + * it is understood that sizeof (ether_header) is 0x10 + */ +#define SIZEOF_ETHERHEADER 0xe + +/* For tagged Ethernet headers */ +#define SIZEOF_TAG_ETHERHEADER 0x12 + + +/* minimal size of an ethernet frame including the headers supported + * by most ethernet chips. + */ + +#define ETHERSMALL 60 + +/* + * Macro to map an IP multicast address to an Ethernet multicast address. + * The high-order 25 bits of the Ethernet address are statically assigned, + * and the low-order 23 bits are taken from the low end of the IP address. + */ +#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \ + /* struct in_addr *ipaddr; */ \ + /* u_char enaddr[6]; */ \ +{ \ + (enaddr)[0] = 0x01; \ + (enaddr)[1] = 0x00; \ + (enaddr)[2] = 0x5e; \ + (enaddr)[3] = ((u_char *)ipaddr)[1] & 0x7f; \ + (enaddr)[4] = ((u_char *)ipaddr)[2]; \ + (enaddr)[5] = ((u_char *)ipaddr)[3]; \ +} + + +/* + * Macro to test whether the given ethernet address is multicast + */ + + #define ETHER_MULTICAST(enaddr) \ + ((enaddr)[0] == 0x1) && ((enaddr)[1] == 0x0) && ((enaddr)[2] == 0x5e) + + +/* + * Ethernet Address Resolution Protocol. + * + * See RFC 826 for protocol description. Structure below is adapted + * to resolving internet addresses. Field names used correspond to + * RFC 826. + */ +struct ether_arp { + struct arphdr ea_hdr; /* fixed-size header */ + u_char arp_sha[6]; /* sender hardware address */ + u_char arp_spa[4]; /* sender protocol address */ + u_char arp_tha[6]; /* target hardware address */ + u_char arp_tpa[4]; /* target protocol address */ +} ETHER_PACKED; + +#define arp_hrd ea_hdr.ar_hrd +#define arp_pro ea_hdr.ar_pro +#define arp_hln ea_hdr.ar_hln +#define arp_pln ea_hdr.ar_pln +#define arp_op ea_hdr.ar_op + +/* + * Structure shared between the ethernet driver modules and + * the address resolution code. For example, each ec_softc or il_softc + * begins with this structure. + */ +struct arpcom { + struct ifnet ac_if; /* network-visible interface */ + u_char ac_enaddr[6]; /* ethernet hardware address */ + struct in_addr ac_ipaddr; /* copy of ip address- XXX */ + struct ether_multi *ac_multiaddrs; /* list of ether multicast addrs */ + int ac_multicnt; /* length of ac_multiaddrs list */ +} ETHER_PACKED; + +/* XXX should be removed */ +/* + * Internet to ethernet address resolution table. + */ +struct arptab { + struct in_addr at_iaddr; /* internet address */ + u_char at_enaddr[6]; /* ethernet address */ + u_char at_timer; /* minutes since last reference */ + u_char at_flags; /* flags */ + struct mbuf *at_hold; /* last packet until resolved/timeout */ +} ETHER_PACKED; + +struct llinfo_arp { + struct llinfo_arp *la_next; + struct llinfo_arp *la_prev; + struct rtentry *la_rt; + struct mbuf *la_hold; /* last packet until resolved/timeout */ + long la_asked; /* last time we QUERIED for this addr */ +#define la_timer la_rt->rt_rmx.rmx_expire /* deletion time in seconds */ +} ETHER_PACKED; + +struct sockaddr_inarp { + u_char sin_len; + u_char sin_family; + u_short sin_port; + struct in_addr sin_addr; + struct in_addr sin_srcaddr; + u_short sin_tos; + u_short sin_other; +#define SIN_PROXY 1 +} ETHER_PACKED; + +/* + * IP and ethernet specific routing flags + */ +#define RTF_USETRAILERS RTF_PROTO1 /* use trailers */ +#define RTF_ANNOUNCE RTF_PROTO2 /* announce new arp entry */ + +/* + * Ethernet multicast address structure. There is one of these for each + * multicast address or range of multicast addresses that we are supposed + * to listen to on a particular interface. They are kept in a linked list, + * rooted in the interface's arpcom structure. (This really has nothing to + * do with ARP, or with the Internet address family, but this appears to be + * the minimally-disrupting place to put it.) + */ +struct ether_multi { + u_char enm_addrlo[6]; /* low or only address of range */ + u_char enm_addrhi[6]; /* high or only address of range */ + struct arpcom *enm_ac; /* back pointer to arpcom */ + u_int enm_refcount; /* no. claims to this addr/range */ + struct ether_multi *enm_next; /* ptr to next ether_multi */ +} ETHER_PACKED; + +/* + * Structure used by macros below to remember position when stepping through + * all of the ether_multi records. + */ +struct ether_multistep { + struct ether_multi *e_enm; +} ETHER_PACKED; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Macro for looking up the ether_multi record for a given range of Ethernet + * multicast addresses connected to a given arpcom structure. If no matching + * record is found, "enm" returns NULL. + */ +#define ETHER_LOOKUP_MULTI(addrlo, addrhi, ac, enm) \ + /* u_char addrlo[6]; */ \ + /* u_char addrhi[6]; */ \ + /* struct arpcom *ac; */ \ + /* struct ether_multi *enm; */ \ +{ \ + for ((enm) = (ac)->ac_multiaddrs; \ + (enm) != NULL && \ + (bcmp((char *)(enm)->enm_addrlo, (char *)(addrlo), 6) != 0 || \ + bcmp((char *)(enm)->enm_addrhi, (char *)(addrhi), 6) != 0); \ + (enm) = (enm)->enm_next); \ +} + +/* + * Macro to step through all of the ether_multi records, one at a time. + * The current position is remembered in "step", which the caller must + * provide. ETHER_FIRST_MULTI(), below, must be called to initialize "step" + * and get the first record. Both macros return a NULL "enm" when there + * are no remaining records. + */ +#define ETHER_NEXT_MULTI(step, enm) \ + /* struct ether_multistep step; */ \ + /* struct ether_multi *enm; */ \ +{ \ + if (((enm) = (step).e_enm) != NULL) \ + (step).e_enm = (enm)->enm_next; \ +} + +#define ETHER_FIRST_MULTI(step, ac, enm) \ + /* struct ether_multistep step; */ \ + /* struct arpcom *ac; */ \ + /* struct ether_multi *enm; */ \ +{ \ + (step).e_enm = (ac)->ac_multiaddrs; \ + ETHER_NEXT_MULTI((step), (enm)); \ +} + +extern u_char etherbroadcastaddr[6]; +extern u_char ether_ipmulticast_min[6]; +extern u_char ether_ipmulticast_max[6]; +extern struct ifqueue arpintrq; +#ifndef VIRTUAL_STACK +extern struct llinfo_arp llinfo_arp; /* head of the llinfo queue */ +#endif /* VIRTUAL_STACK */ + + +extern struct llinfo_arp *arptnew (struct in_addr *); + +extern void arpwhohas (struct arpcom *, struct in_addr *); +#ifdef VIRTUAL_STACK +extern void arpintr (int); +#else +extern void arpintr (void); +#endif /* VIRTUAL_STACK */ +extern int arpresolve (struct arpcom *, struct rtentry *, struct mbuf *, + struct sockaddr *, u_char *); +extern void arp_rtrequest (int, struct rtentry *, struct sockaddr *); +extern void arpwhohas (struct arpcom *, struct in_addr *); +extern void revarpinput(struct mbuf *m); +extern void ipToEtherMCastMap (struct in_addr *, u_char * ); +extern int ipEtherResolvRtn (FUNCPTR, struct mbuf *, struct sockaddr *, + struct ifnet *, struct rtentry *, char *); + +extern int ether_addmulti (struct ifreq *, struct arpcom *); +extern int ether_delmulti (struct ifreq *, struct arpcom *); +extern char * ether_sprintf( u_char * ap); +extern void db_print_sa(struct sockaddr* sa); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_etherh */ diff --git a/h/netinet/igmp.h b/h/netinet/igmp.h new file mode 100644 index 0000000..44865e2 --- /dev/null +++ b/h/netinet/igmp.h @@ -0,0 +1,126 @@ +/* igmp.h - internet group management protocol header file */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1988 Stephen Deering. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Stephen Deering of Stanford University. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)igmp.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/igmp.h,v 1.10 1999/08/28 00:49:15 peter Exp $ + */ + + +/* + * Internet Group Management Protocol (IGMP) definitions. + * + * Written by Steve Deering, Stanford, May 1988. + * + * MULTICAST Revision: 3.5.1.2 + */ +/* +modification history +-------------------- +01b,10oct01,rae merged from truestack, upgrade to IGMPv2 +01a,03mar96,vin created from BSD4.4lite2. +*/ + +/* Internet Group Management Protocol (IGMP) definitions. */ + + +#ifndef __INCigmph +#define __INCigmph + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + + + +/* + * IGMP packet format. + */ +struct igmp { + u_char igmp_type; /* version & type of IGMP message */ + u_char igmp_code; /* subtype for routing msgs */ + u_short igmp_cksum; /* IP-style checksum */ + struct in_addr igmp_group; /* group address being reported */ +}; /* (zero for queries) */ + +#define IGMP_MINLEN 8 + +/* + * Message types, including version number. + */ +#define IGMP_MEMBERSHIP_QUERY 0x11 /* membership query */ +#define IGMP_V1_MEMBERSHIP_REPORT 0x12 /* Ver. 1 membership report */ +#define IGMP_V2_MEMBERSHIP_REPORT 0x16 /* Ver. 2 membership report */ +#define IGMP_V2_LEAVE_GROUP 0x17 /* Leave-group message */ + +#define IGMP_DVMRP 0x13 /* DVMRP routing message */ +#define IGMP_PIM 0x14 /* PIM routing message */ + +#define IGMP_MTRACE_RESP 0x1e /* traceroute resp.(to sender)*/ +#define IGMP_MTRACE 0x1f /* mcast traceroute messages */ + +#define IGMP_MAX_HOST_REPORT_DELAY 10 /* max delay for response to */ + /* query (in seconds) according */ + /* to RFC1112 */ + + +#define IGMP_TIMER_SCALE 10 /* denotes that the igmp code field */ + /* specifies time in 10th of seconds*/ + +/* + * The following four defininitions are for backwards compatibility. + * They should be removed as soon as all applications are updated to + * use the new constant names. + */ +#define IGMP_HOST_MEMBERSHIP_QUERY IGMP_MEMBERSHIP_QUERY +#define IGMP_HOST_MEMBERSHIP_REPORT IGMP_V1_MEMBERSHIP_REPORT +#define IGMP_HOST_NEW_MEMBERSHIP_REPORT IGMP_V2_MEMBERSHIP_REPORT +#define IGMP_HOST_LEAVE_MESSAGE IGMP_V2_LEAVE_GROUP + + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCigmph */ diff --git a/h/netinet/igmp_var.h b/h/netinet/igmp_var.h new file mode 100644 index 0000000..4773c89 --- /dev/null +++ b/h/netinet/igmp_var.h @@ -0,0 +1,134 @@ +/* igmp_var.h - internet group management protocol variable header file */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1988 Stephen Deering. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Stephen Deering of Stanford University. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)igmp_var.h 8.1 (Berkeley) 7/19/93 + * $FreeBSD: src/sys/netinet/igmp_var.h,v 1.15 1999/08/28 00:49:15 peter Exp $ + */ + + +/* + * Internet Group Management Protocol (IGMP), + * implementation-specific definitions. + * + * Written by Steve Deering, Stanford, May 1988. + * + * MULTICAST Revision: 3.5.1.3 + */ + +/* +modification history +-------------------- +01c,10oct01,rae merge from truestack, upgrade to V2, VIRTUAL_STACK +01b,31jan97,vin changed declaration according to prototype decl in protosw.h +01a,03mar96,vin created from BSD4.4lite2. +*/ + +#ifndef __INCigmp_varh +#define __INCigmp_varh + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef VIRTUAL_STACK +struct vs_igmpstat { + u_int igps_rcv_total; /* total IGMP messages received */ + u_int igps_rcv_tooshort; /* received with too few bytes */ + u_int igps_rcv_badsum; /* received with bad checksum */ + u_int igps_rcv_queries; /* received membership queries */ + u_int igps_rcv_badqueries; /* received invalid queries */ + u_int igps_rcv_reports; /* received membership reports */ + u_int igps_rcv_badreports; /* received invalid reports */ + u_int igps_rcv_ourreports; /* received reports for our groups */ + u_int igps_snd_reports; /* sent membership reports */ +}; +#else /* VIRTUAL_STACK */ + +struct igmpstat { + u_int igps_rcv_total; /* total IGMP messages received */ + u_int igps_rcv_tooshort; /* received with too few bytes */ + u_int igps_rcv_badsum; /* received with bad checksum */ + u_int igps_rcv_queries; /* received membership queries */ + u_int igps_rcv_badqueries; /* received invalid queries */ + u_int igps_rcv_reports; /* received membership reports */ + u_int igps_rcv_badreports; /* received invalid reports */ + u_int igps_rcv_ourreports; /* received reports for our groups */ + u_int igps_snd_reports; /* sent membership reports */ +}; +#endif /* VIRTUAL_STACK */ + + +#define IGMP_RANDOM_DELAY(X) (random() % (X) + 1) + + +/* + * States for IGMPv2's leave processing + */ +#define IGMP_OTHERMEMBER 0 +#define IGMP_IREPORTEDLAST 1 + +/* + * We must remember what version the subnet's querier is. + * We conveniently use the IGMP message type for the proper + * membership report to keep this state. + */ +#define IGMP_V1_ROUTER IGMP_V1_MEMBERSHIP_REPORT +#define IGMP_V2_ROUTER IGMP_V2_MEMBERSHIP_REPORT + +/* + * Revert to new router if we haven't heard from an old router in + * this amount of time. + */ +#define IGMP_AGE_THRESHOLD 540 + +extern void igmp_init (void); +extern void igmp_input (struct mbuf *, int); +extern void igmp_fasttimo (void); +extern void igmp_slowtimo (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCigmp_varh */ diff --git a/h/netinet/in.h b/h/netinet/in.h new file mode 100644 index 0000000..317457b --- /dev/null +++ b/h/netinet/in.h @@ -0,0 +1,357 @@ +/* in.h - internet header file */ + +/* + * Copyright (c) 1982, 1986, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)in.h 8.3 (Berkeley) 1/3/94 + */ + +/* +modification history +-------------------- +01g,31aug00,rae add INADDR_ALLRTRS_GROUP +01f,29oct99,spm renamed ip_opts field to comply with C++ standard (SPR #27782) +01e,07jul97,rjc modifications to sockaddr_rt structure +01d,30jun97,rjc modifications for reverting back to old rtentry struct. +01c,06feb97,rjc modified TOS_{GET, SET} macros. +01b,30dec96,rjc added IPPROTO_OSPF and tos routing changes. +01a,03mar96,vin created from BSD4.4 stuff,integrated with 01n of in.h +*/ + +#ifndef __INCinh +#define __INCinh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "sys/types.h" +#include "net/if.h" +#include "net/mbuf.h" + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Constants and structures defined by the internet system, + * Per RFC 790, September 1981, and numerous additions. + */ + +/* + * Protocols + */ +#define IPPROTO_IP 0 /* dummy for IP */ +#define IPPROTO_ICMP 1 /* control message protocol */ +#define IPPROTO_IGMP 2 /* group mgmt protocol */ +#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */ +#define IPPROTO_TCP 6 /* tcp */ +#define IPPROTO_EGP 8 /* exterior gateway protocol */ +#define IPPROTO_PUP 12 /* pup */ +#define IPPROTO_UDP 17 /* user datagram protocol */ +#define IPPROTO_IDP 22 /* xns idp */ +#define IPPROTO_TP 29 /* tp-4 w/ class negotiation */ +#define IPPROTO_EON 80 /* ISO cnlp */ +#define IPPROTO_OSPF 89 /* OSPF version 2 */ +#define IPPROTO_ENCAP 98 /* encapsulation header */ + +#define IPPROTO_RAW 255 /* raw IP packet */ +#define IPPROTO_MAX 256 + + +/* + * Local port number conventions: + * Ports < IPPORT_RESERVED are reserved for + * privileged processes (e.g. root). + * Ports > IPPORT_USERRESERVED are reserved + * for servers, not necessarily privileged. + */ +#define IPPORT_RESERVED 1024 +#define IPPORT_USERRESERVED 5000 + +/* + * Internet address (a structure for historical reasons) + */ +struct in_addr { + u_long s_addr; +}; + +/* + * Definitions of bits in internet address integers. + * On subnets, the decomposition of addresses to host and net parts + * is done according to subnet mask, not the masks here. + */ +#define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0) +#define IN_CLASSA_NET 0xff000000 +#define IN_CLASSA_NSHIFT 24 +#define IN_CLASSA_HOST 0x00ffffff +#define IN_CLASSA_MAX 128 + +#define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000) +#define IN_CLASSB_NET 0xffff0000 +#define IN_CLASSB_NSHIFT 16 +#define IN_CLASSB_HOST 0x0000ffff +#define IN_CLASSB_MAX 65536 + +#define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000) +#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST 0x000000ff + +#define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000) +#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */ +#define IN_CLASSD_NSHIFT 28 /* net and host fields, but */ +#define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */ +#define IN_MULTICAST(i) IN_CLASSD(i) + +#define IN_EXPERIMENTAL(i) (((long)(i) & 0xf0000000) == 0xf0000000) +#define IN_BADCLASS(i) (((long)(i) & 0xf0000000) == 0xf0000000) + +#define INADDR_ANY (u_long)0x00000000 +#define INADDR_LOOPBACK (u_long)0x7f000001 +#define INADDR_BROADCAST (u_long)0xffffffff /* must be masked */ +#define INADDR_NONE 0xffffffff /* -1 return */ + +#define INADDR_UNSPEC_GROUP (u_long)0xe0000000 /* 224.0.0.0 */ +#define INADDR_ALLHOSTS_GROUP (u_long)0xe0000001 /* 224.0.0.1 */ +#define INADDR_ALLRTRS_GROUP (u_long)0xe0000002 /* 224.0.0.2 */ +#define INADDR_MAX_LOCAL_GROUP (u_long)0xe00000ff /* 224.0.0.255 */ + +#define IN_LOOPBACKNET 127 /* official! */ + +/* + * Socket address, internet style. + */ +struct sockaddr_in { + u_char sin_len; + u_char sin_family; + u_short sin_port; + struct in_addr sin_addr; + char sin_zero[8]; +}; + +/* + * macros for getting and setting tos values in sockaddr_in + * structures. A new sockaddr structure is defined for this + * purpose as shown below. + */ + +struct sockaddr_rt { + u_char srt_len; + u_char srt_family; + u_char srt_proto; + u_char srt_tos; + struct in_addr srt_addr; + char sin_zero[8]; + }; + +#define TOS_GET(pSockaddr) (((struct sockaddr_rt *)(pSockaddr))->srt_tos) + + +#define TOS_SET(pSockaddr, tosVal) (((struct sockaddr_rt *)(pSockaddr))-> \ + srt_tos = tosVal) + +#define RT_PROTO_GET(pSockaddr) (((struct sockaddr_rt *)(pSockaddr))->srt_proto) + +#define RT_PROTO_SET(pSockaddr, proto) (((struct sockaddr_rt *)(pSockaddr))-> \ + srt_proto = proto) + +/* + * Structure used to describe IP options. + * Used to store options internally, to pass them to a process, + * or to restore options retrieved earlier. + * The ip_dst is used for the first-hop gateway when using a source route + * (this gets put into the header proper). + */ +struct ip_opts { + struct in_addr ip_dst; /* first hop, 0 w/o src rt */ + char opts[40]; /* actually variable in size */ +}; + +/* + * Options for use with [gs]etsockopt at the IP level. + * First word of comment is data type; bool is stored in int. + */ +#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */ +#define IP_HDRINCL 2 /* int; header is included with data */ +#define IP_TOS 3 /* int; IP type of service and preced. */ +#define IP_TTL 4 /* int; IP time to live */ +#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */ +#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */ +#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */ +#define IP_RETOPTS 8 /* ip_opts; set/get IP options */ +#define IP_MULTICAST_IF 9 /* u_char; set/get IP multicast i/f */ +#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */ +#define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */ +#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */ +#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */ + +/* + * Defaults and limits for options + */ +#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */ +#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */ +#define IP_MAX_MEMBERSHIPS 20 /* per socket; must fit in one mbuf */ + +/* + * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. + */ +struct ip_mreq { + struct in_addr imr_multiaddr; /* IP multicast address of group */ + struct in_addr imr_interface; /* local IP address of interface */ +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Definitions for inet sysctl operations. + * + * Third level is protocol number. + * Fourth level is desired variable within that protocol. + */ +#define IPPROTO_MAXID (IPPROTO_IDP + 1) /* don't list to IPPROTO_MAX */ + +#define CTL_IPPROTO_NAMES { \ + { "ip", CTLTYPE_NODE }, \ + { "icmp", CTLTYPE_NODE }, \ + { "igmp", CTLTYPE_NODE }, \ + { "ggp", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "tcp", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { "egp", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "pup", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "udp", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "idp", CTLTYPE_NODE }, \ +} + +/* + * Names for IP sysctl objects + */ +#define IPCTL_FORWARDING 1 /* act as router */ +#define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */ +#define IPCTL_DEFTTL 3 /* default TTL */ +#ifdef notyet +#define IPCTL_DEFMTU 4 /* default MTU */ +#endif +#define IPCTL_MAXID 5 + +#define IPCTL_NAMES { \ + { 0, 0 }, \ + { "forwarding", CTLTYPE_INT }, \ + { "redirect", CTLTYPE_INT }, \ + { "ttl", CTLTYPE_INT }, \ + { "mtu", CTLTYPE_INT }, \ +} + + +/* + * Macros for number representation conversion. + */ +#if _BYTE_ORDER==_BIG_ENDIAN +#define ntohl(x) (x) +#define ntohs(x) (x) +#define htonl(x) (x) +#define htons(x) (x) + +#define NTOHL(x) (x) = ntohl((u_long)(x)) +#define NTOHS(x) (x) = ntohs((u_short)(x)) +#define HTONL(x) (x) = htonl((u_long)(x)) +#define HTONS(x) (x) = htons((u_short)(x)) + + +#endif /* _BYTE_ORDER==_BIG_ENDIAN */ + +#if _BYTE_ORDER==_LITTLE_ENDIAN + +#if FALSE +UINT16 ntohs (); +UINT16 htons (); +UINT32 ntohl (); +UINT32 htonl (); +#endif /* FALSE */ + +#define ntohl(x) ((((x) & 0x000000ff) << 24) | \ + (((x) & 0x0000ff00) << 8) | \ + (((x) & 0x00ff0000) >> 8) | \ + (((x) & 0xff000000) >> 24)) + +#define htonl(x) ((((x) & 0x000000ff) << 24) | \ + (((x) & 0x0000ff00) << 8) | \ + (((x) & 0x00ff0000) >> 8) | \ + (((x) & 0xff000000) >> 24)) + +#define ntohs(x) ((((x) & 0x00ff) << 8) | \ + (((x) & 0xff00) >> 8)) + +#define htons(x) ((((x) & 0x00ff) << 8) | \ + (((x) & 0xff00) >> 8)) +#define NTOHL(x) (x) = ntohl((u_long)(x)) +#define NTOHS(x) (x) = ntohs((u_short)(x)) +#define HTONL(x) (x) = htonl((u_long)(x)) +#define HTONS(x) (x) = htons((u_short)(x)) + +#endif /* _BYTE_ORDER==_LITTLE_ENDIAN */ + +extern struct domain inetdomain; +extern BOOL inet_netmatch(struct sockaddr_in *sin1, struct sockaddr_in *sin2); +extern void in_makeaddr_b(u_long net, u_long host, struct in_addr * pAddr); +extern u_long in_lnaof(); +extern void in_ifaddr_remove(); +extern int in_broadcast (struct in_addr, struct ifnet *); +extern int in_canforward (struct in_addr); +extern int in_cksum (struct mbuf *, int); +extern int in_localaddr (struct in_addr); +extern u_long in_netof (struct in_addr); +extern void in_socktrim (struct sockaddr_in *); +extern struct in_ifaddr *in_iaonnetof(u_long net); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCinh */ diff --git a/h/netinet/in_pcb.h b/h/netinet/in_pcb.h new file mode 100644 index 0000000..3bc69c4 --- /dev/null +++ b/h/netinet/in_pcb.h @@ -0,0 +1,152 @@ +/* in_pcb.h - internet protocol control block header file */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)in_pcb.h 8.1 (Berkeley) 6/10/93 + */ + +/* +modification history +-------------------- +01d,10oct01,rae merge from truestack, add multicast vif to ip_moptions +01c,05oct97,vin moved ip_moptions field from ip_var.h +01b,31mar97,vin added pcb hashing functions. +01a,03mar96,vin created from BSD4.4 stuff,integrated with 02h of in_pcb.h +*/ + +#ifndef __INCin_pcbh +#define __INCin_pcbh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "netinet/ip.h" +#include "net/unixLib.h" + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Structure attached to inpcb.ip_moptions and + * passed to ip_output when IP multicast options are in use. + */ +struct ip_moptions { + struct ifnet *imo_multicast_ifp; /* ifp for outgoing multicasts */ + u_char imo_multicast_ttl; /* TTL for outgoing multicasts */ + u_char imo_multicast_loop; /* 1 => hear sends if a member */ + u_short imo_num_memberships;/* no. memberships this socket */ + struct mBlk * pInmMblk; /* chain of multicast addrs */ + u_long imo_multicast_vif; /* the multicast vif to send on */ +}; + +/* + * Common structure pcb for internet protocol implementation. + * Here are stored pointers to local and foreign host table + * entries, local and foreign socket numbers, and pointers + * up (to a socket structure) and down (to a protocol-specific) + * control block. + */ + +LIST_HEAD(inpcbhead, inpcb); + +struct inpcb { + LIST_ENTRY(inpcb) inp_list; /* list for all PCBs of this proto */ + LIST_ENTRY(inpcb) inp_hash; /* hash list */ + struct inpcbinfo *inp_pcbinfo; + struct in_addr inp_faddr; /* foreign host table entry */ + u_short inp_fport; /* foreign port */ + struct in_addr inp_laddr; /* local host table entry */ + u_short inp_lport; /* local port */ + struct socket *inp_socket; /* back pointer to socket */ + caddr_t inp_ppcb; /* pointer to per-protocol pcb */ + struct route inp_route; /* placeholder for routing entry */ + int inp_flags; /* generic IP/datagram flags */ + struct ip inp_ip; /* header prototype; should have more */ + struct mbuf *inp_options; /* IP options */ + struct ip_moptions *inp_moptions; /* IP multicast options */ +}; + +struct inpcbinfo { + struct inpcbhead *listhead; + struct inpcbhead *hashbase; + unsigned long hashmask; + unsigned short lastport; +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#define INP_PCBHASH(faddr, lport, fport, mask) \ + (((faddr) ^ ((faddr) >> 16) ^ (lport) ^ (fport)) & (mask)) + +/* flags in inp_flags: */ +#define INP_RECVOPTS 0x01 /* receive incoming IP options */ +#define INP_RECVRETOPTS 0x02 /* receive IP options for reply */ +#define INP_RECVDSTADDR 0x04 /* receive IP dst address */ +#define INP_CONTROLOPTS (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR) +#define INP_HDRINCL 0x08 /* user supplies entire IP header */ + +#define INPLOOKUP_WILDCARD 1 + +#define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb) + +extern void in_losing (struct inpcb *); +extern int in_pcballoc (struct socket *, struct inpcbinfo *); +extern int in_pcbbind (struct inpcb *, struct mbuf *); +extern int in_pcbconnect (struct inpcb *, struct mbuf *); +extern void in_pcbdetach (struct inpcb *); +extern void in_pcbdisconnect (struct inpcb *); +extern void in_pcbinshash (struct inpcb *); +extern int in_pcbladdr (struct inpcb *, struct mbuf *, struct sockaddr_in **); +extern struct inpcb * in_pcblookup (struct inpcbinfo *, struct in_addr, u_int, + struct in_addr, u_int, int); +extern struct inpcb * in_pcblookuphash (struct inpcbinfo *, struct in_addr, + u_int, struct in_addr, u_int, int); +extern void in_pcbnotify (struct inpcbhead *, struct sockaddr *, u_int, + struct in_addr, u_int, int, + void (*)(struct inpcb *, int)); +extern void in_pcbrehash (struct inpcb *); +extern void in_rtchange (struct inpcb *, int); +extern void in_setpeeraddr (struct inpcb *, struct mbuf *); +extern void in_setsockaddr (struct inpcb *, struct mbuf *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCin_pcbh */ diff --git a/h/netinet/in_systm.h b/h/netinet/in_systm.h new file mode 100644 index 0000000..e734321 --- /dev/null +++ b/h/netinet/in_systm.h @@ -0,0 +1,77 @@ +/* in_systm.h - internetwork header file */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)in_systm.h 8.1 (Berkeley) 6/10/93 + */ + +/* +modification history +-------------------- +01a,03mar96,vin created from BSD4.4lite2. integrated with 02g of in_systm.h +*/ + +#ifndef __INCin_systmh +#define __INCin_systmh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Miscellaneous internetwork + * definitions for kernel. + */ + +/* + * Network types. + * + * Internally the system keeps counters in the headers with the bytes + * swapped so that VAX instructions will work on them. It reverses + * the bytes before transmission at each protocol level. The n_ types + * represent the types with the bytes in ``high-ender'' order. + */ +typedef u_short n_short; /* short as received from the net */ +typedef u_long n_long; /* long as received from the net */ + +typedef u_long n_time; /* ms since 00:00 GMT, byte rev */ + +n_time iptime(); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCin_systmh */ diff --git a/h/netinet/in_var.h b/h/netinet/in_var.h new file mode 100644 index 0000000..5b1a937 --- /dev/null +++ b/h/netinet/in_var.h @@ -0,0 +1,257 @@ +/* in_var.h - internet interface variable header file */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1985, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)in_var.h 8.2 (Berkeley) 1/9/95 + */ + +/* +modification history +-------------------- +01d,04dec01,rae cleanup +01c,10oct01,rae merge from truestack (IGMPv2, VIRTUAL) +01b,05oct97,vin changed in_ifaddr for fast multicasting. +01a,03mar96,vin created from BSD4.4lite2. +*/ + +#ifndef __INCin_varh +#define __INCin_varh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "net/if.h" +#include "netinet/in_pcb.h" + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Interface address, Internet version. One of these structures + * is allocated for each interface with an Internet address. + * The ifaddr structure contains the protocol-independent part + * of the structure and is assumed to be first. + */ +struct in_ifaddr { + struct ifaddr ia_ifa; /* protocol-independent info */ +#define ia_ifp ia_ifa.ifa_ifp +#define ia_flags ia_ifa.ifa_flags + /* ia_{,sub}net{,mask} in host order */ + u_long ia_net; /* network number of interface */ + u_long ia_netmask; /* mask of net part */ + u_long ia_subnet; /* subnet number, including net */ + u_long ia_subnetmask; /* mask of subnet part */ + struct in_addr ia_netbroadcast; /* to recognize net broadcasts */ + struct in_ifaddr *ia_next; /* next in list of internet addresses */ + struct sockaddr_in ia_addr; /* reserve space for interface name */ + struct sockaddr_in ia_dstaddr; /* reserve space for broadcast addr */ +#define ia_broadaddr ia_dstaddr + struct sockaddr_in ia_sockmask; /* reserve space for general netmask */ +}; + +struct in_aliasreq { + char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + struct sockaddr_in ifra_addr; + struct sockaddr_in ifra_broadaddr; +#define ifra_dstaddr ifra_broadaddr + struct sockaddr_in ifra_mask; +}; +/* + * Given a pointer to an in_ifaddr (ifaddr), + * return a pointer to the addr as a sockaddr_in. + */ +#define IA_SIN(ia) (&(((struct in_ifaddr *)(ia))->ia_addr)) + +#define IN_LNAOF(in, ifa) \ + ((ntohl((in).s_addr) & ~((struct in_ifaddr *)(ifa)->ia_subnetmask)) + + +#ifndef VIRTUAL_STACK +extern struct in_ifaddr *in_ifaddr; +#endif /* VIRTUAL_STACK */ + +extern struct ifqueue ipintrq; /* ip packet input queue */ + +extern u_char inetctlerrmap[]; + +extern void in_socktrim (struct sockaddr_in *); + + +/* + * Macro for finding the interface (ifnet structure) corresponding to one + * of our IP addresses. + */ +#ifdef VIRTUAL_STACK + +#define INADDR_TO_IFP(addr, ifp) \ + /* struct in_addr addr; */ \ + /* struct ifnet *ifp; */ \ +{ \ + register struct in_ifaddr *ia; \ +\ + for (ia = _in_ifaddr; \ + ia != NULL && IA_SIN(ia)->sin_addr.s_addr != (addr).s_addr; \ + ia = ia->ia_next) \ + continue; \ + (ifp) = (ia == NULL) ? NULL : ia->ia_ifp; \ +} + +#else + +#define INADDR_TO_IFP(addr, ifp) \ + /* struct in_addr addr; */ \ + /* struct ifnet *ifp; */ \ +{ \ + register struct in_ifaddr *ia; \ +\ + for (ia = in_ifaddr; \ + ia != NULL && IA_SIN(ia)->sin_addr.s_addr != (addr).s_addr; \ + ia = ia->ia_next) \ + continue; \ + (ifp) = (ia == NULL) ? NULL : ia->ia_ifp; \ +} + +#endif /* VIRTUAL_STACK */ + +/* + * Macro for finding the internet address structure (in_ifaddr) corresponding + * to a given interface (ifnet structure). + */ +#ifdef VIRTUAL_STACK + +#define IFP_TO_IA(ifp, ia) \ + /* struct ifnet *ifp; */ \ + /* struct in_ifaddr *ia; */ \ +{ \ + for ((ia) = _in_ifaddr; \ + (ia) != NULL && (ia)->ia_ifp != (ifp); \ + (ia) = (ia)->ia_next) \ + continue; \ +} + +#else + +#define IFP_TO_IA(ifp, ia) \ + /* struct ifnet *ifp; */ \ + /* struct in_ifaddr *ia; */ \ +{ \ + for ((ia) = in_ifaddr; \ + (ia) != NULL && (ia)->ia_ifp != (ifp); \ + (ia) = (ia)->ia_next) \ + continue; \ +} + +#endif /* VIRTUAL_STACK */ + +LIST_HEAD(inMultiHead, in_multi); + + +/* + * This information should be part of the ifnet structure but we don't wish + * to change that - as it might break a number of things + */ + +struct router_info { + struct ifnet *rti_ifp; + int rti_type; /* type of router which is querier on this interface */ + int rti_time; /* # of slow timeouts since last old query */ + struct router_info *rti_next; +}; + +/* + * Internet multicast address structure. There is one of these for each IP + * multicast group to which this host belongs on a given network interface. + * They are kept in a linked list, rooted in the interface's in_ifaddr + * structure. (now it is a "hash list") + */ + + +struct in_multi { + LIST_ENTRY(in_multi) inm_hash; /* hash list */ + struct in_addr inm_addr; /* IP multicast address */ + struct ifnet *inm_ifp; /* back pointer to ifnet */ + u_int inm_refcount; /* no. membership claims by sockets */ + u_int inm_timer; /* IGMP membership report timer */ + u_int inm_state; /* state of the membership */ + struct router_info *inm_rti; /* router info*/ + struct mBlk * pInPcbMblk; /* chain of pcbs */ +}; + +struct mcastHashInfo + { + struct inMultiHead * hashBase; + ULONG hashMask; + }; + +typedef struct in_multi IN_MULTI; +typedef struct mcastHashInfo M_CAST_HASH_INFO; +typedef struct inMultiHead IN_MULTI_HEAD; +extern struct mcastHashInfo mCastHashInfo; + +/* necessary macros */ +#define MCAST_HASH(mCastAddr, ifp, mask) \ + (((mCastAddr) ^ ((mCastAddr) >> 16) ^ (int)(ifp)) & (mask)) + +/* + * Macro for looking up the in_multi record for a given IP multicast address + * on a given interface. If no matching record is found, "inm" returns NULL. + */ +#define IN_LOOKUP_MULTI(addr, ifp, inm) \ + { \ + (inm) = mcastHashTblLookup ((addr).s_addr, (ifp)); \ + } + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +extern int in_ifinit (struct ifnet *, + struct in_ifaddr *, struct sockaddr_in *, int); +extern struct mBlk * in_addmulti (struct in_addr *, struct ifnet *, + struct inpcb *); +extern int in_delmulti (struct mBlk *, struct inpcb *); +extern void in_ifscrub (struct ifnet *, struct in_ifaddr *); +extern int in_control (struct socket *, u_long, caddr_t, struct ifnet *); +IMPORT STATUS mcastHashTblInsert (struct in_multi * pInMulti); +IMPORT STATUS mcastHashTblDelete (struct in_multi * pInMulti); +IMPORT IN_MULTI * mcastHashTblLookup (int mcastAddr, struct ifnet * pIf); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCin_varh */ diff --git a/h/netinet/ip.h b/h/netinet/ip.h new file mode 100644 index 0000000..7a16b15 --- /dev/null +++ b/h/netinet/ip.h @@ -0,0 +1,234 @@ +/* ip.h - internet protocol header file */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip.h 8.2 (Berkeley) 6/1/94 + */ + +/* +modification history +-------------------- +02o,31aug00,rae added Router Alert Option (IPOPT_RA) +02n,15jul97,spm made IP checksum calculation configurable (SPR #7836) +02m,24feb97,bjl moved struct ipt_ta declatation outside of union + ipt_timestamp to make struct ipt_ta globally visible for c++ +01b,11apr97,rjc added min cost tos. +01a,03mar96,vin created from BSD4.4 stuff,integrated with 02l. + Corrected bitfields according to the ansi spec. +*/ + +#ifndef __INCiph +#define __INCiph + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + +/* Definitions for selecting IP checksum calculations (also see netLib.h). */ + +#define IP_CKSUM_SEND_MASK 0x1 +#define IP_CKSUM_RECV_MASK 0x2 + +#ifndef _BYTE_ORDER +/* + * Definitions for byte order, + * according to byte significance from low address to high. + */ +#define _LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */ +#define _BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */ +#define _PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */ +#ifdef vax +#define _BYTE_ORDER _LITTLE_ENDIAN +#else +#define _BYTE_ORDER _BIG_ENDIAN /* mc68000, tahoe, most others */ +#endif +#endif /* _BYTE_ORDER */ + +/* + * Definitions for internet protocol version 4. + * Per RFC 791, September 1981. + */ +#define IPVERSION 4 + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Structure of an internet header, naked of options. + * + * We declare ip_len and ip_off to be short, rather than u_short + * pragmatically since otherwise unsigned comparisons can result + * against negative integers quite easily, and fail in subtle ways. + */ +struct ip { +#if _BYTE_ORDER == _LITTLE_ENDIAN + u_int ip_hl:4, /* header length */ + ip_v:4, /* version */ +#endif +#if _BYTE_ORDER == _BIG_ENDIAN + u_int ip_v:4, /* version */ + ip_hl:4, /* header length */ +#endif + ip_tos:8, /* type of service */ + ip_len:16; /* total length */ + u_short ip_id; /* identification */ + short ip_off; /* fragment offset field */ +#define IP_DF 0x4000 /* dont fragment flag */ +#define IP_MF 0x2000 /* more fragments flag */ +#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ + u_char ip_ttl; /* time to live */ + u_char ip_p; /* protocol */ + u_short ip_sum; /* checksum */ + struct in_addr ip_src,ip_dst; /* source and dest address */ +}; + +#define IP_MAXPACKET 65535 /* maximum packet size */ + +/* + * Definitions for IP type of service (ip_tos) + */ +#define IPTOS_LOWDELAY 0x10 +#define IPTOS_THROUGHPUT 0x08 +#define IPTOS_RELIABILITY 0x04 +#define IPTOS_MINCOST 0x02 + +/* + * Definitions for IP precedence (also in ip_tos) (hopefully unused) + */ +#define IPTOS_PREC_NETCONTROL 0xe0 +#define IPTOS_PREC_INTERNETCONTROL 0xc0 +#define IPTOS_PREC_CRITIC_ECP 0xa0 +#define IPTOS_PREC_FLASHOVERRIDE 0x80 +#define IPTOS_PREC_FLASH 0x60 +#define IPTOS_PREC_IMMEDIATE 0x40 +#define IPTOS_PREC_PRIORITY 0x20 +#define IPTOS_PREC_ROUTINE 0x00 + +/* + * Definitions for options. + */ +#define IPOPT_COPIED(o) ((o)&0x80) +#define IPOPT_CLASS(o) ((o)&0x60) +#define IPOPT_NUMBER(o) ((o)&0x1f) + +#define IPOPT_CONTROL 0x00 +#define IPOPT_RESERVED1 0x20 +#define IPOPT_DEBMEAS 0x40 +#define IPOPT_RESERVED2 0x60 + +#define IPOPT_EOL 0 /* end of option list */ +#define IPOPT_NOP 1 /* no operation */ + +#define IPOPT_RR 7 /* record packet route */ +#define IPOPT_TS 68 /* timestamp */ +#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */ +#define IPOPT_LSRR 131 /* loose source route */ +#define IPOPT_SATID 136 /* satnet id */ +#define IPOPT_SSRR 137 /* strict source route */ +#define IPOPT_RA 148 /* router alert */ + +/* + * Offsets to fields in options other than EOL and NOP. + */ +#define IPOPT_OPTVAL 0 /* option ID */ +#define IPOPT_OLEN 1 /* option length */ +#define IPOPT_OFFSET 2 /* offset within option */ +#define IPOPT_MINOFF 4 /* min value of above */ + + +struct ipt_ta { + struct in_addr ipt_addr; + u_long ipt_time; +}; + +/* + * Time stamp option structure. + */ +struct ip_timestamp { + u_int ipt_code:8, /* IPOPT_TS */ + ipt_len:8, /* size of structure (variable) */ + ipt_ptr:8, /* index of current entry */ +#if _BYTE_ORDER == _LITTLE_ENDIAN + ipt_flg:4, /* flags, see below */ + ipt_oflw:4; /* overflow counter */ +#endif +#if _BYTE_ORDER == _BIG_ENDIAN + ipt_oflw:4, /* overflow counter */ + ipt_flg:4; /* flags, see below */ +#endif + union ipt_timestamp { + u_long ipt_time[1]; + struct ipt_ta ipt_ta[1]; + } ipt_timestamp; +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* flag bits for ipt_flg */ +#define IPOPT_TS_TSONLY 0 /* timestamps only */ +#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ +#define IPOPT_TS_PRESPEC 3 /* specified modules only */ + +/* bits for security (not byte swapped) */ +#define IPOPT_SECUR_UNCLASS 0x0000 +#define IPOPT_SECUR_CONFID 0xf135 +#define IPOPT_SECUR_EFTO 0x789a +#define IPOPT_SECUR_MMMM 0xbc4d +#define IPOPT_SECUR_RESTR 0xaf13 +#define IPOPT_SECUR_SECRET 0xd788 +#define IPOPT_SECUR_TOPSECRET 0x6bc5 + +/* + * Internet implementation parameters. + */ +#define MAXTTL 255 /* maximum time to live (seconds) */ +#define IPDEFTTL 64 /* default ttl, from RFC 1340 */ +#define IPFRAGTTL 60 /* time to live for frags, slowhz */ +#define IPTTLDEC 1 /* subtracted when forwarding */ + +#define IP_MSS 576 /* default maximum segment size */ + +#define IPFORWARDING 1 /* Set IP to always forward */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCiph */ diff --git a/h/netinet/ip_icmp.h b/h/netinet/ip_icmp.h new file mode 100644 index 0000000..4b2a333 --- /dev/null +++ b/h/netinet/ip_icmp.h @@ -0,0 +1,197 @@ +/* ip_icmp.h - interface control message protocol header file */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93 + */ + +/* +modification history +-------------------- +02i,24feb97,bjl moved struct ih_idseq, struct id_ts, and struct id_ip + outside of union declarations to make structs globally + visible in c++. +01c,31jan97,vin changed declaration according to prototype decl in protosw.h +01b,07jan96,vin removed declaration for icmp_error, for scalability. +01a,03mar96,vin created from BSD4.4lite2. +*/ + +#ifndef __INCip_icmph +#define __INCip_icmph + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Interface Control Message Protocol Definitions. + * Per RFC 792, September 1981. + */ + +struct ih_idseq { + n_short icd_id; + n_short icd_seq; +}; +struct id_ts { + n_time its_otime; + n_time its_rtime; + n_time its_ttime; +}; +struct id_ip { + struct ip idi_ip; + /* options and then 64 bits of data */ +}; + +/* + * Structure of an icmp header. + */ +struct icmp { + u_char icmp_type; /* type of message, see below */ + u_char icmp_code; /* type sub code */ + u_short icmp_cksum; /* ones complement cksum of struct */ + union { + u_char ih_pptr; /* ICMP_PARAMPROB */ + struct in_addr ih_gwaddr; /* ICMP_REDIRECT */ + struct ih_idseq ih_idseq; + int ih_void; + + /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */ + struct ih_pmtu { + n_short ipm_void; + n_short ipm_nextmtu; + } ih_pmtu; + } icmp_hun; +#define icmp_pptr icmp_hun.ih_pptr +#define icmp_gwaddr icmp_hun.ih_gwaddr +#define icmp_id icmp_hun.ih_idseq.icd_id +#define icmp_seq icmp_hun.ih_idseq.icd_seq +#define icmp_void icmp_hun.ih_void +#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void +#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu + union { + struct id_ts id_ts; + struct id_ip id_ip; + u_long id_mask; + char id_data[1]; + } icmp_dun; +#define icmp_otime icmp_dun.id_ts.its_otime +#define icmp_rtime icmp_dun.id_ts.its_rtime +#define icmp_ttime icmp_dun.id_ts.its_ttime +#define icmp_ip icmp_dun.id_ip.idi_ip +#define icmp_mask icmp_dun.id_mask +#define icmp_data icmp_dun.id_data +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Lower bounds on packet lengths for various types. + * For the error advice packets must first insure that the + * packet is large enought to contain the returned ip header. + * Only then can we do the check to see if 64 bits of packet + * data have been returned, since we need to check the returned + * ip header length. + */ +#define ICMP_MINLEN 8 /* abs minimum */ +#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */ +#define ICMP_MASKLEN 12 /* address mask */ +#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */ +#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8) + /* N.B.: must separately check that ip_hl >= 5 */ + +/* + * Definition of type and code field values. + */ +#define ICMP_ECHOREPLY 0 /* echo reply */ +#define ICMP_UNREACH 3 /* dest unreachable, codes: */ +#define ICMP_UNREACH_NET 0 /* bad net */ +#define ICMP_UNREACH_HOST 1 /* bad host */ +#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */ +#define ICMP_UNREACH_PORT 3 /* bad port */ +#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */ +#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */ +#define ICMP_UNREACH_NET_UNKNOWN 6 /* unknown net */ +#define ICMP_UNREACH_HOST_UNKNOWN 7 /* unknown host */ +#define ICMP_UNREACH_ISOLATED 8 /* src host isolated */ +#define ICMP_UNREACH_NET_PROHIB 9 /* prohibited access */ +#define ICMP_UNREACH_HOST_PROHIB 10 /* ditto */ +#define ICMP_UNREACH_TOSNET 11 /* bad tos for net */ +#define ICMP_UNREACH_TOSHOST 12 /* bad tos for host */ +#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */ +#define ICMP_REDIRECT 5 /* shorter route, codes: */ +#define ICMP_REDIRECT_NET 0 /* for network */ +#define ICMP_REDIRECT_HOST 1 /* for host */ +#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */ +#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */ +#define ICMP_ECHO 8 /* echo service */ +#define ICMP_ROUTERADVERT 9 /* router advertisement */ +#define ICMP_ROUTERSOLICIT 10 /* router solicitation */ +#define ICMP_TIMXCEED 11 /* time exceeded, code: */ +#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */ +#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */ +#define ICMP_PARAMPROB 12 /* ip header bad */ +#define ICMP_PARAMPROB_OPTABSENT 1 /* req. opt. absent */ +#define ICMP_TSTAMP 13 /* timestamp request */ +#define ICMP_TSTAMPREPLY 14 /* timestamp reply */ +#define ICMP_IREQ 15 /* information request */ +#define ICMP_IREQREPLY 16 /* information reply */ +#define ICMP_MASKREQ 17 /* address mask request */ +#define ICMP_MASKREPLY 18 /* address mask reply */ + +#define ICMP_MAXTYPE 18 + +#define ICMP_INFOTYPE(type) \ + ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \ + (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \ + (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \ + (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \ + (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY) + + +void icmp_input (struct mbuf *, int); +void icmp_init (void); +int icmp_sysctl (int *, u_int, void *, size_t *, void *, size_t); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCip_icmph */ diff --git a/h/netinet/ip_mroute.h b/h/netinet/ip_mroute.h new file mode 100644 index 0000000..022d360 --- /dev/null +++ b/h/netinet/ip_mroute.h @@ -0,0 +1,322 @@ +/* ip_mroute.h - internet multicast routing header file */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1989 Stephen Deering. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Stephen Deering of Stanford University. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip_mroute.h 8.1 (Berkeley) 6/10/93 + * $Id: ip_mroute.h,v 1.15 1999/01/18 02:06:59 fenner Exp $ + */ + +/* +modification history +-------------------- +01c,10oct01,rae merge from truestack ver 01k (v2 upgrade) +01b,08apr97,vin removed declarations for ip_mforward and ip_mrouter_done. + implemented ip_mforward as a hook for scalability. +01a,03mar96,vin created from BSD4.4lite2. +*/ + +#ifndef __INCip_mrouteh +#define __INCip_mrouteh + +#include "netinet/in_pcb.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Definitions for IP multicast forwarding. + * + * Written by David Waitzman, BBN Labs, August 1988. + * Modified by Steve Deering, Stanford, February 1989. + * Modified by Ajit Thyagarajan, PARC, August 1993. + * Modified by Ajit Thyagarajan, PARC, August 1994. + * + * MROUTING Revision: 3.3.1.3 + */ + +#define ENCAP_TTL 64 +#define ENCAP_PROTO IPPROTO_IPIP /* 4 */ + +/* should be in netinet\in.h in BSD */ +#define IPPROTO_IPIP 4 /* IP encapsulation in IP*//* added 8.22.00 chall */ +#define IPPROTO_RSVP 46 /* resource reservation */ + + +/* + * Multicast Routing set/getsockopt commands. + */ +#define MRT_INIT 100 /* initialize forwarder */ +#define MRT_DONE 101 /* shut down forwarder */ +#define MRT_ADD_VIF 102 /* create virtual interface */ +#define MRT_DEL_VIF 103 /* delete virtual interface */ +#define MRT_ADD_MFC 104 /* insert forwarding cache entry */ +#define MRT_DEL_MFC 105 /* delete forwarding cache entry */ +#define MRT_VERSION 106 /* get kernel version number */ +#define MRT_ASSERT 107 /* enable PIM assert processing */ +#define MRT_DEBUG 108 + + +#define EXPIRE_TIMEOUT 250000000/* nanoseconds */ /*(hz / 4) 4x / second */ +#define UPCALL_EXPIRE 6 /* number of timeouts */ +#define TBF_REPROCESS 10000000 /* nanoseconds */ /*(hz / 100) 100x / second */ + +#define DEBUG_MFC 0x02 +#define DEBUG_FORWARD 0x04 +#define DEBUG_EXPIRE 0x08 +#define DEBUG_XMIT 0x10 +#define DEBUG_TABLE 0x20 + +/* + * Rate limit for assert notification messages, in usec + */ +#define ASSERT_MSG_TIME 3000000 + +#ifndef __P +#define __P(x) x +#endif +/* + * Types for handling bitmaps with one bit per virtual interface. + */ +#define MAXVIFS 32 + +typedef u_long vifbitmap_t; +typedef u_short vifi_t; /* type of a vif index */ + +/* from BSD's sys/sockio.h */ +#define SIOCGETVIFCNT _IOWR('r', 15, struct sioc_vif_req)/* get vif pkt cnt */ +#define SIOCGETSGCNT _IOWR('r', 16, struct sioc_sg_req) /* get s,g pkt cnt */ + +/* BSD's sys/ioctl.h should be included in sys/sockio.h */ +#include "sys/ioctl.h" + + + + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Argument structure for MRT_ADD_VIF. + * (MRT_DEL_VIF takes a single vifi_t argument.) + */ + +struct vifctl { + vifi_t vifc_vifi; /* the index of the vif to be added */ + u_char vifc_flags; /* VIFF_ flags defined below */ + u_char vifc_threshold; /* min ttl required to forward on vif */ + u_int vifc_rate_limit; /* max rate */ + struct in_addr vifc_lcl_addr; /* local interface address */ + struct in_addr vifc_rmt_addr; /* remote address (tunnels only) */ +}; + +#define VIFF_TUNNEL 0x1 /* vif represents a tunnel end-point */ +#define VIFF_SRCRT 0x2 /* tunnel uses IP source routing */ + +/* + * Argument structure for MRT_ADD_MFC and MRT_DEL_MFC + * (mfcc_tos to be added at a future point) + */ +struct mfcctl { + struct in_addr mfcc_origin; /* ip origin of mcasts */ + struct in_addr mfcc_mcastgrp; /* multicast group associated*/ + vifi_t mfcc_parent; /* incoming vif */ + u_char mfcc_ttls[MAXVIFS]; /* forwarding ttls on vifs */ + BOOL mfcc_notify; +}; + + +/* + * The kernel's multicast routing statistics. + */ +struct mrtstat { + u_long mrts_mfc_lookups; /* # forw. cache hash table hits */ + u_long mrts_mfc_misses; /* # forw. cache hash table misses */ + u_long mrts_upcalls; /* # calls to mrouted */ + u_long mrts_no_route; /* no route for packet's origin */ + u_long mrts_bad_tunnel; /* malformed tunnel options */ + u_long mrts_cant_tunnel; /* no room for tunnel options */ + u_long mrts_wrong_if; /* arrived on wrong interface */ + u_long mrts_upq_ovflw; /* upcall Q overflow */ + u_long mrts_cache_cleanups; /* # entries with no upcalls */ + u_long mrts_drop_sel; /* pkts dropped selectively */ + u_long mrts_q_overflow; /* pkts dropped - Q overflow */ + u_long mrts_pkt2large; /* pkts dropped - size > BKT SIZE */ + u_long mrts_upq_sockfull; /* upcalls dropped - socket full */ +}; + +/* + * Argument structure used by mrouted to get src-grp pkt counts + */ +struct sioc_sg_req { + struct in_addr src; + struct in_addr grp; + u_long pktcnt; + u_long bytecnt; + u_long wrong_if; +}; + +/* + * Argument structure used by mrouted to get vif pkt counts + */ +struct sioc_vif_req { + vifi_t vifi; /* vif number */ + u_long icount; /* Input packet count on vif */ + u_long ocount; /* Output packet count on vif */ + u_long ibytes; /* Input byte count on vif */ + u_long obytes; /* Output byte count on vif */ +}; + + +/* + * The kernel's virtual-interface structure. + */ +struct vif { + u_char v_flags; /* VIFF_ flags defined above */ + u_char v_threshold; /* min ttl required to forward on vif*/ + u_int v_rate_limit; /* max rate */ + struct tbf *v_tbf; /* token bucket structure at intf. */ + struct in_addr v_lcl_addr; /* local interface address */ + struct in_addr v_rmt_addr; /* remote address (tunnels only) */ + struct ifnet *v_ifp; /* pointer to interface */ + u_long v_pkt_in; /* # pkts in on interface */ + u_long v_pkt_out; /* # pkts out on interface */ + u_long v_bytes_in; /* # bytes in on interface */ + u_long v_bytes_out; /* # bytes out on interface */ + struct route v_route; /* cached route if this is a tunnel */ +}; + +/* + * The kernel's multicast forwarding cache entry structure + * (A field for the type of service (mfc_tos) is to be added + * at a future point) + */ +struct mfc { + struct in_addr mfc_origin; /* IP origin of mcasts */ + struct in_addr mfc_mcastgrp; /* multicast group associated*/ + vifi_t mfc_parent; /* incoming vif */ + u_char mfc_ttls[MAXVIFS]; /* forwarding ttls on vifs */ + u_long mfc_pkt_cnt; /* pkt count for src-grp */ + u_long mfc_byte_cnt; /* byte count for src-grp */ + u_long mfc_wrong_if; /* wrong if for src-grp */ + int mfc_expire; /* time to clean entry up */ + UINT mfc_last_assert; /* last time I sent an assert*/ + struct rtdetq *mfc_stall; /* q of packets awaiting mfc */ + struct mfc *mfc_next; /* next mfc entry */ +/* below members were added in Net/3 port */ + struct mfc *mfc_next_g; /* next group in same chain */ + struct mfc *mfc_root_rt; /* 0,g entry in hash table*/ + BOOL mfc_notify; /* notify overlying routing daemon */ +}; + +/* + * Struct used to communicate from kernel to multicast router + * note the convenient similarity to an IP packet + */ +struct igmpmsg { + u_long unused1; + u_long unused2; + u_char im_msgtype; /* what type of message */ +#define IGMPMSG_NOCACHE 1 +#define IGMPMSG_WRONGVIF 2 + u_char im_mbz; /* must be zero */ + u_char im_vif; /* vif rec'd on */ + u_char unused3; + struct in_addr im_src, im_dst; +}; + +/* + * Argument structure used for pkt info. while upcall is made + */ +struct rtdetq +{ + struct mbuf *m; /* A copy of the packet */ + struct ifnet *ifp; /* Interface pkt came in on */ + vifi_t xmt_vif; /* Saved copy of imo_multicast_vif */ + struct rtdetq *next; /* Next in list of packets */ +}; + +#define MFCTBLSIZ 256 +#if (MFCTBLSIZ & (MFCTBLSIZ - 1)) == 0 /* from sys:route.h */ +#define MFCHASHMOD(h) ((h) & (MFCTBLSIZ - 1)) +#else +#define MFCHASHMOD(h) ((h) % MFCTBLSIZ) +#endif + +#define MAX_UPQ 4 /* max. no of pkts in upcall Q */ +/* + * Token Bucket filter code + */ +#define MAX_BKT_SIZE 10000 /* 10K bytes size */ +#define MAXQSIZE 10 /* max # of pkts in queue */ + +/* + * the token bucket filter at each vif + */ +struct tbf +{ + UINT tbf_last_pkt_t; /* arr. time of last pkt */ + + u_long tbf_n_tok; /* no of tokens in bucket */ + u_long tbf_q_len; /* length of queue at this vif */ + u_long tbf_max_q_len; /* max. queue length */ + struct mbuf *tbf_q; /* Packet queue */ + struct mbuf *tbf_t; /* tail-insertion pointer */ +}; + + +int ip_mrouter_cmd (int cmd, struct socket* so, struct mbuf* m) ; +int ip_mforward ( + struct mbuf *, + struct ifnet *, + struct ip *, + struct ip_moptions * + ); + + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCip_mrouteh */ diff --git a/h/netinet/ip_var.h b/h/netinet/ip_var.h new file mode 100644 index 0000000..c5b5b3b --- /dev/null +++ b/h/netinet/ip_var.h @@ -0,0 +1,216 @@ +/* ip_var.h - internet protocol protocol variable header file */ + +/* Copyright 1984 - 2002 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip_var.h 8.2 (Berkeley) 1/9/95 + */ + +/* +modification history +-------------------- +01h,15apr02,wap reinstate netJobAdd() removal changes +01g,29mar02,wap back out the previous change (needs more investigation) +01f,22mar02,rae ipintr mod helps remove extra netJobAdd (SPR #74604) +01e,10oct01,rae merge from truestack (ip_mroute update, VIRTUAL) +01d,05oct97,vin moved ip_moptions to in_pcb.h for multicast hashing changes. +01c,31jan97,vin changed declaration according to prototype decl in protosw.h +01b,22nov96,vin modified ipq for new ipReAssembly +01a,03mar96,vin created from BSD4.4lite2. corrected bit fields according to + ansi specfication +*/ + +#ifndef __INCip_varh +#define __INCip_varh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "net/if.h" +#include "netinet/in.h" +#include "netinet/in_pcb.h" + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Overlay for ip header used by other protocols (tcp, udp). + */ +struct ipovly { + caddr_t ih_next, ih_prev; /* for protocol sequence q's */ + u_char ih_x1; /* (unused) */ + u_char ih_pr; /* protocol */ + short ih_len; /* protocol length */ + struct in_addr ih_src; /* source internet address */ + struct in_addr ih_dst; /* destination internet address */ +}; + +/* + * Ip reassembly queue structure. Each fragment + * being reassembled is attached to one of these structures. + * They are timed out after ipq_ttl drops to 0, and may also + * be reclaimed if memory becomes tight. + */ +struct ipq { + struct ipq *next,*prev; /* to other reass headers */ + u_char ipq_ttl; /* time for reass q to live */ + u_char ipq_p; /* protocol of this fragment */ + u_short ipq_id; /* sequence id for reassembly */ + struct mbuf * pMbufHdr; /* back pointer to mbuf */ + struct mbuf * pMbufPkt; /* pointer to mbuf packet */ + /* to ip headers of fragments */ + struct in_addr ipq_src,ipq_dst; +}; + +/* + * Ip header, when holding a fragment. + * + * Note: ipf_next must be at same offset as ipq_next above + */ +struct ipasfrag { +#if _BYTE_ORDER == _LITTLE_ENDIAN + u_int ip_hl:4, + ip_v:4, +#endif +#if _BYTE_ORDER == _BIG_ENDIAN + u_int ip_v:4, + ip_hl:4, +#endif + ipf_mff:8, /* XXX overlays ip_tos: use low bit + * to avoid destroying tos; + * copied from (ip_off&IP_MF) */ + ip_len:16; + u_short ip_id; + short ip_off; + u_char ip_ttl; + u_char ip_p; + u_short ip_sum; + struct in_addr ip_src,ip_dst; /* source and dest address */ +}; + +/* + * Structure stored in mbuf in inpcb.ip_options + * and passed to ip_output when ip options are in use. + * The actual length of the options (including ipopt_dst) + * is in m_len. + */ +#define MAX_IPOPTLEN 40 + +struct ipoption { + struct in_addr ipopt_dst; /* first-hop dst if source routed */ + char ipopt_list[MAX_IPOPTLEN]; /* options proper */ +}; + +struct ipstat { + u_long ips_total; /* total packets received */ + u_long ips_badsum; /* checksum bad */ + u_long ips_tooshort; /* packet too short */ + u_long ips_toosmall; /* not enough data */ + u_long ips_badhlen; /* ip header length < data size */ + u_long ips_badlen; /* ip length < ip header length */ + u_long ips_fragments; /* fragments received */ + u_long ips_fragdropped; /* frags dropped (dups, out of space) */ + u_long ips_fragtimeout; /* fragments timed out */ + u_long ips_forward; /* packets forwarded */ + u_long ips_cantforward; /* packets rcvd for unreachable dest */ + u_long ips_redirectsent; /* packets forwarded on same net */ + u_long ips_noproto; /* unknown or unsupported protocol */ + u_long ips_delivered; /* datagrams delivered to upper level*/ + u_long ips_localout; /* total ip packets generated here */ + u_long ips_odropped; /* lost packets due to nobufs, etc. */ + u_long ips_reassembled; /* total packets reassembled ok */ + u_long ips_fragmented; /* datagrams sucessfully fragmented */ + u_long ips_ofragments; /* output fragments created */ + u_long ips_cantfrag; /* don't fragment flag was set, etc. */ + u_long ips_badoptions; /* error in option processing */ + u_long ips_noroute; /* packets discarded due to no route */ + u_long ips_badvers; /* ip version != 4 */ + u_long ips_rawout; /* total raw ip packets generated */ +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* flags passed to ip_output as last parameter */ +#define IP_FORWARDING 0x1 /* most of ip header exists */ +#define IP_RAWOUTPUT 0x2 /* raw ip header exists */ +#define IP_ROUTETOIF SO_DONTROUTE /* bypass routing tables */ +#define IP_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */ + +#define ipTimeToLive ip_defttl /* MIB-II Read Write Variable */ + +#ifndef VIRTUAL_STACK +extern struct ipstat ipstat; +extern struct ipq ipq; /* ip reass. queue */ +extern u_short ip_id; /* ip packet ctr, for ids */ +extern int ip_defttl; /* default IP ttl */ +#endif /* VIRTUAL_STACK */ + +extern int ip_ctloutput (int, struct socket *, int, int, struct mbuf **); +extern void ip_deq (struct ipasfrag *); +extern int ip_dooptions (struct mbuf *); +extern void ip_drain (void); +extern void ip_enq (struct ipasfrag *, struct ipasfrag *); +extern void ip_forward (struct mbuf *, int); +extern void ip_freef (struct ipq *); +extern void ip_freemoptions (struct ip_moptions *, struct inpcb *); +extern int ip_getmoptions (int, struct ip_moptions *, struct mbuf **); +extern void ip_init (void); +extern int ip_mforward (struct mbuf *, struct ifnet *, struct ip *, struct ip_moptions*); +extern int ip_optcopy (struct ip *, struct ip *); +extern int ip_output (struct mbuf *, struct mbuf *, struct route *, + int, struct ip_moptions *); +extern int ip_pcbopts (struct mbuf **, struct mbuf *); +extern struct in_ifaddr * ip_rtaddr (struct in_addr); +extern void ip_slowtimo (void); +extern struct mbuf * ip_srcroute (void); +extern void ip_stripoptions (struct mbuf *, struct mbuf *); +extern int ip_sysctl (int *, u_int, void *, size_t *, void *, size_t); +extern void ipintr (struct mbuf *m); +extern int rip_ctloutput (int, struct socket *, int, int, + struct mbuf **); +extern void rip_init (void); +extern void rip_input (struct mbuf *); +extern int rip_output (struct mbuf *, struct socket *, u_long); +extern int rip_usrreq (struct socket *, int, struct mbuf *, + struct mbuf *, struct mbuf *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCip_varh */ diff --git a/h/netinet/ppp/chap.h b/h/netinet/ppp/chap.h new file mode 100644 index 0000000..760b7c4 --- /dev/null +++ b/h/netinet/ppp/chap.h @@ -0,0 +1,123 @@ +/* chap.h - Cryptographic Handshake Authentication Protocol header */ + +/* Copyright 1995 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1991 Gregory M. Christy + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the author. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +/* +modification history +-------------------- +01a,13jan95,dzb WRS-ize. +*/ + +#ifndef __INCchaph +#define __INCchaph + +#ifdef __cplusplus +extern "C" { +#endif + +/* Code + ID + length */ + +#define CHAP_HEADERLEN 4 + +/* CHAP codes */ + +#define CHAP_DIGEST_MD5 5 /* use MD5 algorithm */ +#define MD5_SIGNATURE_SIZE 16 /* 16 bytes in a MD5 message digest */ + +#define CHAP_CHALLENGE 1 +#define CHAP_RESPONSE 2 +#define CHAP_SUCCESS 3 +#define CHAP_FAILURE 4 + +/* + * Challenge lengths (for challenges we send) and other limits. + */ +#define MIN_CHALLENGE_LENGTH 32 +#define MAX_CHALLENGE_LENGTH 64 +#define MAX_RESPONSE_LENGTH 16 /* sufficient for MD5 */ + +/* + * Each interface is described by a chap structure. + */ + +typedef struct chap_state { + int unit; /* Interface unit number */ + int clientstate; /* Client state */ + int serverstate; /* Server state */ + u_char challenge[MAX_CHALLENGE_LENGTH]; /* last challenge string sent */ + u_char chal_len; /* challenge length */ + u_char chal_id; /* ID of last challenge */ + u_char chal_type; /* hash algorithm for challenges */ + u_char id; /* Current id */ + char *chal_name; /* Our name to use with challenge */ + int chal_interval; /* Time until we challenge peer again */ + int timeouttime; /* Timeout time in seconds */ + int max_transmits; /* Maximum # of challenge transmissions */ + int chal_transmits; /* Number of transmissions of challenge */ + int resp_transmits; /* Number of transmissions of response */ + u_char response[MAX_RESPONSE_LENGTH]; /* Response to send */ + u_char resp_length; /* length of response */ + u_char resp_id; /* ID for response messages */ + u_char resp_type; /* hash algorithm for responses */ + char *resp_name; /* Our name to send with response */ +} chap_state; + + +/* + * Client (peer) states. + */ +#define CHAPCS_INITIAL 0 /* Lower layer down, not opened */ +#define CHAPCS_CLOSED 1 /* Lower layer up, not opened */ +#define CHAPCS_PENDING 2 /* Auth us to peer when lower up */ +#define CHAPCS_LISTEN 3 /* Listening for a challenge */ +#define CHAPCS_RESPONSE 4 /* Sent response, waiting for status */ +#define CHAPCS_OPEN 5 /* We've received Success */ + +/* + * Server (authenticator) states. + */ +#define CHAPSS_INITIAL 0 /* Lower layer down, not opened */ +#define CHAPSS_CLOSED 1 /* Lower layer up, not opened */ +#define CHAPSS_PENDING 2 /* Auth peer when lower up */ +#define CHAPSS_INITIAL_CHAL 3 /* We've sent the first challenge */ +#define CHAPSS_OPEN 4 /* We've sent a Success msg */ +#define CHAPSS_RECHALLENGE 5 /* We've sent another challenge */ +#define CHAPSS_BADAUTH 6 /* We've sent a Failure msg */ + +/* + * Timeouts. + */ +#define CHAP_DEFTIMEOUT 3 /* Timeout time in seconds */ +#define CHAP_DEFTRANSMITS 10 /* max # times to send challenge */ + +extern void ChapInit __ARGS((int)); +extern void ChapAuthWithPeer __ARGS((int, char *, int)); +extern void ChapAuthPeer __ARGS((int, char *, int)); +extern void ChapLowerUp __ARGS((int)); +extern void ChapLowerDown __ARGS((int)); +extern void ChapInput __ARGS((int, u_char *, int)); +extern void ChapProtocolReject __ARGS((int)); +extern int ChapPrintPkt __ARGS((u_char *, int, + void (*) __ARGS((void *, char *, ...)), void *)); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCchaph */ diff --git a/h/netinet/ppp/fsm.h b/h/netinet/ppp/fsm.h new file mode 100644 index 0000000..afbe4f6 --- /dev/null +++ b/h/netinet/ppp/fsm.h @@ -0,0 +1,140 @@ +/* fsm.h - {Link, IP} Control Protocol Finite State Machine header */ + +/* Copyright 1995 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +/* +modification history +-------------------- +01a,16jan95,dzb WRS-ize. +*/ + +#ifndef __INCfsmh +#define __INCfsmh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Packet header = Code, id, length. + */ +#define HEADERLEN (sizeof (u_char) + sizeof (u_char) + sizeof (u_short)) + + +/* + * CP (LCP, IPCP, etc.) codes. + */ +#define CONFREQ 1 /* Configuration Request */ +#define CONFACK 2 /* Configuration Ack */ +#define CONFNAK 3 /* Configuration Nak */ +#define CONFREJ 4 /* Configuration Reject */ +#define TERMREQ 5 /* Termination Request */ +#define TERMACK 6 /* Termination Ack */ +#define CODEREJ 7 /* Code Reject */ + + +/* + * Each FSM is described by a fsm_callbacks and a fsm structure. + */ +typedef struct fsm_callbacks { + void (*resetci)(); /* Reset our Configuration Information */ + int (*cilen)(); /* Length of our Configuration Information */ + void (*addci)(); /* Add our Configuration Information */ + int (*ackci)(); /* ACK our Configuration Information */ + int (*nakci)(); /* NAK our Configuration Information */ + int (*rejci)(); /* Reject our Configuration Information */ + int (*reqci)(); /* Request peer's Configuration Information */ + void (*up)(); /* Called when fsm reaches OPENED state */ + void (*down)(); /* Called when fsm leaves OPENED state */ + void (*starting)(); /* Called when we want the lower layer */ + void (*finished)(); /* Called when we don't want the lower layer */ + void (*protreject)(); /* Called when Protocol-Reject received */ + void (*retransmit)(); /* Retransmission is necessary */ + int (*extcode)(); /* Called when unknown code received */ + char *proto_name; /* String name for protocol (for messages) */ +} fsm_callbacks; + + +typedef struct fsm { + int unit; /* Interface unit number */ + int protocol; /* Data Link Layer Protocol field value */ + int state; /* State */ + int flags; /* Contains option bits */ + u_char id; /* Current id */ + u_char reqid; /* Current request id */ + int timeouttime; /* Timeout time in milliseconds */ + int maxconfreqtransmits; /* Maximum Configure-Request transmissions */ + int retransmits; /* Number of retransmissions left */ + int maxtermtransmits; /* Maximum Terminate-Request transmissions */ + int nakloops; /* Number of nak loops since last ack */ + int maxnakloops; /* Maximum number of nak loops tolerated */ + fsm_callbacks *callbacks; /* Callback routines */ +} fsm; + + +/* + * Link states. + */ +#define INITIAL 0 /* Down, hasn't been opened */ +#define STARTING 1 /* Down, been opened */ +#define CLOSED 2 /* Up, hasn't been opened */ +#define STOPPED 3 /* Open, waiting for down event */ +#define CLOSING 4 /* Terminating the connection, not open */ +#define STOPPING 5 /* Terminating, but open */ +#define REQSENT 6 /* We've sent a Config Request */ +#define ACKRCVD 7 /* We've received a Config Ack */ +#define ACKSENT 8 /* We've sent a Config Ack */ +#define OPENED 9 /* Connection available */ + + +/* + * Flags - indicate options controlling FSM operation + */ +#define OPT_PASSIVE 1 /* Don't die if we don't get a response */ +#define OPT_RESTART 2 /* Treat 2nd OPEN as DOWN, UP */ +#define OPT_SILENT 4 /* Wait for peer to speak first */ + + +/* + * Timeouts. + */ +#define DEFTIMEOUT 3 /* Timeout time in seconds */ +#define DEFMAXTERMREQS 2 /* Maximum Terminate-Request transmissions */ +#define DEFMAXCONFREQS 10 /* Maximum Configure-Request transmissions */ +#define DEFMAXNAKLOOPS 10 /* Maximum number of nak loops */ + + +/* + * Prototypes + */ +extern void fsm_init __ARGS((fsm *)); +extern void fsm_lowerup __ARGS((fsm *)); +extern void fsm_lowerdown __ARGS((fsm *)); +extern void fsm_open __ARGS((fsm *)); +extern void fsm_close __ARGS((fsm *)); +extern void fsm_input __ARGS((fsm *, u_char *, int)); +extern void fsm_protreject __ARGS((fsm *)); +extern void fsm_sdata __ARGS((fsm *, int, int, u_char *, int)); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfsmh */ diff --git a/h/netinet/ppp/if_ppp.h b/h/netinet/ppp/if_ppp.h new file mode 100644 index 0000000..a978ba2 --- /dev/null +++ b/h/netinet/ppp/if_ppp.h @@ -0,0 +1,194 @@ +/* if_ppp.h - Point-to-Point Protocol (PPP) Asynchronous driver header */ + +/* Copyright 1995 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +/* +modification history +-------------------- +01b,09mar95,dzb ppp_softc: added sc_iprcvd/sc_ipsent and removed bpf. +01a,16jan95,dab VxWorks port - first WRS version. + +dzb WRS-ize. moved in global prototypes from if_ppp.c. +*/ + +#ifndef __INCif_ppph +#define __INCif_ppph + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "private/semLibP.h" +#include "rngLib.h" +#include "netinet/sl_compress.h" + +/* + * Standard PPP header. + */ +struct ppp_header { + u_char ph_address; /* Address Field */ + u_char ph_control; /* Control Field */ + u_short ph_protocol; /* Protocol Field */ +}; + +#define PPP_HDRLEN 4 /* sizeof(struct ppp_header) must be 4 */ +#define PPP_FCSLEN 2 /* octets for FCS */ + +#define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */ +#define PPP_UI 0x03 /* Unnumbered Information */ +#define PPP_FLAG 0x7e /* Flag Sequence */ +#define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */ +#define PPP_TRANS 0x20 /* Asynchronous transparency modifier */ + +/* + * Protocol field values. + */ +#define PPP_IP 0x21 /* Internet Protocol */ +#define PPP_XNS 0x25 /* Xerox NS */ +#define PPP_VJC_COMP 0x2d /* VJ compressed TCP */ +#define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */ +#define PPP_COMP 0xfd /* compressed packet */ +#define PPP_LCP 0xc021 /* Link Control Protocol */ +#define PPP_CCP 0x80fd /* Compression Control Protocol */ + +/* + * Important FCS values. + */ +#define PPP_INITFCS 0xffff /* Initial FCS value */ +#define PPP_GOODFCS 0xf0b8 /* Good final FCS value */ +#define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff]) + +/* + * Packet sizes + */ +#define PPP_MTU 1500 /* Default MTU (size of Info field) */ +#define PPP_MRU 1500 /* Default MRU (max receive unit) */ +#define PPP_MAXMRU 65000 /* Largest MRU we allow */ + +/* Extended asyncmap - allows any character to be escaped. */ +typedef u_long ext_accm[8]; + +/* + * Structure describing each ppp unit. + */ +struct ppp_softc { + struct ifnet sc_if; /* network-visible interface */ + u_int sc_flags; /* see below */ + void *sc_devp; /* pointer to device-dependent structure */ + int (*sc_start)(); /* start routine */ + short sc_mru; /* max receive unit */ + int sc_xfer; /* used in xferring unit to another dev */ + struct ifqueue sc_inq; /* TTY side input queue */ + struct ifqueue sc_fastq; /* IP interactive output packet queue */ +#ifdef VJC + struct slcompress sc_comp; /* vjc control buffer */ +#endif + u_int sc_bytessent; /* count of octets sent */ + u_int sc_bytesrcvd; /* count of octets received */ + u_int sc_ipsent; /* count of ip packets sent */ + u_int sc_iprcvd; /* count of ip packets received */ + + /* Device-dependent part for async lines. */ + ext_accm sc_asyncmap; /* async control character map */ + u_long sc_rasyncmap; /* receive async control char map */ + struct mbuf *sc_outm; /* mbuf chain being output currently */ + struct mbuf *sc_m; /* pointer to input mbuf chain */ + struct mbuf *sc_mc; /* pointer to current input mbuf */ + char *sc_mp; /* pointer to next char in input mbuf */ + short sc_ilen; /* length of input-packet-so-far */ + u_short sc_fcs; /* FCS so far (input) */ + u_short sc_outfcs; /* FCS so far for output packet */ + u_char sc_rawin[16]; /* chars as received */ + int sc_rawin_count; /* # in sc_rawin */ + + /* VxWorks-dependent part */ + int sc_fd; /* file descriptor */ + short sc_qlen; /* length of tty input queue */ + SEMAPHORE sc_wrtsem; /* write semaphore */ + int sc_wrt_task_id; /* write task ID */ + int pkt_len; /* length of current packet */ + int sc_tid; /* tid of daemon task */ +}; + +/* flags */ +#define SC_COMP_PROT 0x00000001 /* protocol compression (output) */ +#define SC_COMP_AC 0x00000002 /* header compression (output) */ +#define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */ +#define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */ +#define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */ +#define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */ +#define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */ +#define SC_DEBUG 0x00010000 /* enable debug messages */ +#define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */ +#define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */ +#define SC_LOG_RAWIN 0x00080000 /* log all chars received */ +#define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */ +#define SC_MASK 0x0fffffff /* bits that user can change */ + +/* state bits */ +#define SC_ESCAPED 0x80000000 /* saw a PPP_ESCAPE */ +#define SC_FLUSH 0x40000000 /* flush input until next PPP_FLAG */ +#define SC_DISCARD_PKT 0x20000000 /* Discard packet at interrupt level */ +#define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */ +#define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 0 */ +#define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */ +#define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */ + +/* this stuff doesn't belong here... */ +#define PPPIOCGSEM _IOR('t', 92, int) /* get ppp read semaphore */ +#define PPPIOCGFD _IOR('t', 91, int) /* get ppp underlying fd */ +#define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */ +#define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */ +#define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */ +#define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */ +#define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */ +#define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */ +#define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */ +#define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */ +#define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */ +#define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */ +#define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */ +#define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */ +#define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */ + +#ifdef ultrix +#define ifr_mtu ifr_ifru.ifru_metric +#endif + +/* old copies of PPP may have defined this */ +#if !defined(ifr_mtu) +#define ifr_mtu ifr_metric +#endif + +/* function declarations */ + +extern int pppopen __ARGS((int, char *)); +extern int pppclose __ARGS((int)); +extern int pppread __ARGS((int , char *, int)); +extern int pppwrite __ARGS((int , char *, int)); +extern int ppptioctl __ARGS((int , int , caddr_t)); +extern void ppp_wrt_task __ARGS((struct ppp_softc *)); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_ppph */ diff --git a/h/netinet/ppp/ipcp.h b/h/netinet/ppp/ipcp.h new file mode 100644 index 0000000..c5b5a16 --- /dev/null +++ b/h/netinet/ppp/ipcp.h @@ -0,0 +1,82 @@ +/* ipcp.h - IP Control Protocol header */ + +/* Copyright 1995 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +/* +modification history +-------------------- +01a,16jan95,dzb WRS-ize. +*/ + +#ifndef __INCipcph +#define __INCipcph + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Options. + */ +#define CI_ADDRS 1 /* IP Addresses */ +#define CI_COMPRESSTYPE 2 /* Compression Type */ +#define CI_ADDR 3 + +#define MAX_STATES 16 /* from ppp_slcompress.h */ + +#define IPCP_VJMODE_OLD 1 /* "old" mode (option # = 0x0037) */ +#define IPCP_VJMODE_RFC1172 2 /* "old-rfc"mode (option # = 0x002d) */ +#define IPCP_VJMODE_RFC1332 3 /* "new-rfc"mode (option # = 0x002d, */ + /* maxslot and slot number compression) */ + +#define IPCP_VJ_COMP 0x002d /* current value for VJ compression option*/ +#define IPCP_VJ_COMP_OLD 0x0037 /* "old" (i.e, broken) value for VJ */ + /* compression option*/ + +typedef struct ipcp_options { + int neg_addr : 1; /* Negotiate IP Address? */ + int old_addrs : 1; /* Use old (IP-Addresses) option? */ + int req_addr : 1; /* Ask peer to send IP address? */ + int default_route : 1; /* Assign default route through interface? */ + int proxy_arp : 1; /* Make proxy ARP entry for peer? */ + int neg_vj : 1; /* Van Jacobson Compression? */ + int old_vj : 1; /* use old (short) form of VJ option? */ + int accept_local : 1; /* accept peer's value for ouraddr */ + int accept_remote : 1; /* accept peer's value for hisaddr */ + u_short vj_protocol; /* protocol value to use in VJ option */ + u_char maxslotindex, cflag; /* values for RFC1332 VJ compression neg. */ + u_long ouraddr, hisaddr; /* Addresses in NETWORK BYTE ORDER */ +} ipcp_options; + +extern void ipcp_init __ARGS((int)); +extern void ipcp_open __ARGS((int)); +extern void ipcp_close __ARGS((int)); +extern void ipcp_lowerup __ARGS((int)); +extern void ipcp_lowerdown __ARGS((int)); +extern void ipcp_input __ARGS((int, u_char *, int)); +extern void ipcp_protrej __ARGS((int)); +extern int ipcp_printpkt __ARGS((u_char *, int, void (*)(), void *)); +extern char *ip_ntoa __ARGS((u_long)); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCipcph */ diff --git a/h/netinet/ppp/lcp.h b/h/netinet/ppp/lcp.h new file mode 100644 index 0000000..d7157c3 --- /dev/null +++ b/h/netinet/ppp/lcp.h @@ -0,0 +1,99 @@ +/* lcp.h - Link Control Protocol header */ + +/* Copyright 1995 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +/* +modification history +-------------------- +01a,16jan95,dzb WRS-ize. +*/ + +#ifndef __INClcph +#define __INClcph + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Options. + */ +#define CI_MRU 1 /* Maximum Receive Unit */ +#define CI_ASYNCMAP 2 /* Async Control Character Map */ +#define CI_AUTHTYPE 3 /* Authentication Type */ +#define CI_QUALITY 4 /* Quality Protocol */ +#define CI_MAGICNUMBER 5 /* Magic Number */ +#define CI_PCOMPRESSION 7 /* Protocol Field Compression */ +#define CI_ACCOMPRESSION 8 /* Address/Control Field Compression */ + +/* + * LCP-specific packet types. + */ +#define PROTREJ 8 /* Protocol Reject */ +#define ECHOREQ 9 /* Echo Request */ +#define ECHOREP 10 /* Echo Reply */ +#define DISCREQ 11 /* Discard Request */ + +/* + * The state of options is described by an lcp_options structure. + */ +typedef struct lcp_options { + int passive : 1; /* Don't die if we don't get a response */ + int silent : 1; /* Wait for the other end to start first */ + int restart : 1; /* Restart vs. exit after close */ + int neg_mru : 1; /* Negotiate the MRU? */ + int neg_asyncmap : 1; /* Negotiate the async map? */ + int neg_upap : 1; /* Ask for UPAP authentication? */ + int neg_chap : 1; /* Ask for CHAP authentication? */ + int neg_magicnumber : 1; /* Ask for magic number? */ + int neg_pcompression : 1; /* HDLC Protocol Field Compression? */ + int neg_accompression : 1; /* HDLC Address/Control Field Compression? */ + int neg_lqr : 1; /* Negotiate use of Link Quality Reports */ + u_short mru; /* Value of MRU */ + u_char chap_mdtype; /* which MD type (hashing algorithm) */ + u_long asyncmap; /* Value of async map */ + u_long magicnumber; + int numloops; /* Number of loops during magic number neg. */ + u_long lqr_period; /* Reporting period for link quality */ +} lcp_options; + +#define DEFMRU 1500 /* Try for this */ +#define MINMRU 128 /* No MRUs below this */ +#define MAXMRU 16384 /* Normally limit MRU to this */ + +extern void lcp_init __ARGS((int)); +extern void lcp_open __ARGS((int)); +extern void lcp_close __ARGS((int)); +extern void lcp_lowerup __ARGS((int)); +extern void lcp_lowerdown __ARGS((int)); +extern void lcp_input __ARGS((int, u_char *, int)); +extern void lcp_protrej __ARGS((int)); +extern void lcp_sprotrej __ARGS((int, u_char *, int)); +extern int lcp_printpkt __ARGS((u_char *, int, + void (*) __ARGS((void *, char *, ...)), void *)); + +extern int lcp_warnloops; /* Warn about a loopback this often */ +#define DEFWARNLOOPS 10 /* Default value for above */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INClcph */ diff --git a/h/netinet/ppp/magic.h b/h/netinet/ppp/magic.h new file mode 100644 index 0000000..307f918 --- /dev/null +++ b/h/netinet/ppp/magic.h @@ -0,0 +1,53 @@ +/* magic.h - PPP Magic Number header */ + +/* Copyright 1995 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +/* +modification history +-------------------- +01a,16jan95,dzb WRS-ize. +*/ + +#ifndef __INCmagich +#define __INCmagich + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void magic_init (void); /* Init the magic number generator */ +extern u_long magic (void); /* Returns the next magic number */ + +#else /* __STDC__ */ + +extern void magic_init (); /* Init the magic number generator */ +extern u_long magic (); /* Returns the next magic number */ + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmagich */ diff --git a/h/netinet/ppp/md5.h b/h/netinet/ppp/md5.h new file mode 100644 index 0000000..8de7bec --- /dev/null +++ b/h/netinet/ppp/md5.h @@ -0,0 +1,89 @@ +/* ppp_md5.c - PPP MD5 security header */ + +/* Copyright 1995 Wind River Systems, Inc. */ + +/* + *********************************************************************** + ** md5.h -- header file for implementation of MD5 ** + ** RSA Data Security, Inc. MD5 Message-Digest Algorithm ** + ** Created: 2/17/90 RLR ** + ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version ** + ** Revised (for MD5): RLR 4/27/91 ** + ** -- G modified to have y&~z instead of y&z ** + ** -- FF, GG, HH modified to add in last register done ** + ** -- Access pattern: round 2 works mod 5, round 3 works mod 3 ** + ** -- distinct additive constant for each step ** + ** -- round 4 added, working mod 7 ** + *********************************************************************** + */ + +/* + *********************************************************************** + ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. ** + ** ** + ** License to copy and use this software is granted provided that ** + ** it is identified as the "RSA Data Security, Inc. MD5 Message- ** + ** Digest Algorithm" in all material mentioning or referencing this ** + ** software or this function. ** + ** ** + ** License is also granted to make and use derivative works ** + ** provided that such works are identified as "derived from the RSA ** + ** Data Security, Inc. MD5 Message-Digest Algorithm" in all ** + ** material mentioning or referencing the derived work. ** + ** ** + ** RSA Data Security, Inc. makes no representations concerning ** + ** either the merchantability of this software or the suitability ** + ** of this software for any particular purpose. It is provided "as ** + ** is" without express or implied warranty of any kind. ** + ** ** + ** These notices must be retained in any copies of any part of this ** + ** documentation and/or software. ** + *********************************************************************** + */ + +/* +modification history +-------------------- +01a,16jan95,dzb WRS-ize. +*/ + +#ifndef __INCmd5h +#define __INCmd5h + +#ifdef __cplusplus +extern "C" { +#endif + +/* typedef a 32-bit type */ +typedef unsigned long int UINT4; + +/* Data structure for MD5 (Message-Digest) computation */ +typedef struct { + UINT4 i[2]; /* number of _bits_ handled mod 2^64 */ + UINT4 buf[4]; /* scratch buffer */ + unsigned char in[64]; /* input buffer */ + unsigned char digest[16]; /* actual digest after MD5Final call */ +} MD5_CTX; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void ppp_MD5Init (MD5_CTX *mdContext); +extern void ppp_MD5Update (MD5_CTX *mdContext, unsigned char *inBuf, + unsigned int inLen); +extern void ppp_MD5Final (MD5_CTX *mdContext); + +#else /* __STDC__ */ + +extern void ppp_MD5Init (); +extern void ppp_MD5Update (); +extern void ppp_MD5Final (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmd5h */ diff --git a/h/netinet/ppp/options.h b/h/netinet/ppp/options.h new file mode 100644 index 0000000..2ebb443 --- /dev/null +++ b/h/netinet/ppp/options.h @@ -0,0 +1,136 @@ +/* options.h - PPP option processing header */ + +/* Copyright 1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,16jun95,dzb moved in options flags and PPP_OPTIONS from pppd.h. + made options flags into shift value macros and shifted macros. + removed usehostname option. +01a,19jan95,dzb written. +*/ + +#ifndef __INCoptionsh +#define __INCoptionsh + +#ifdef __cplusplus +extern "C" { +#endif + +/* options flags */ + +#define PPP_S_NO_ALL 0 /* Don't allow any options */ +#define PPP_S_PASSIVE_MODE 1 /* Set passive mode */ +#define PPP_S_SILENT_MODE 2 /* Set silent mode */ +#define PPP_S_DEFAULTROUTE 3 /* Add default route */ +#define PPP_S_PROXYARP 4 /* Add proxy ARP entry */ +#define PPP_S_IPCP_ACCEPT_LOCAL 5 /* Acpt peer's IP addr for us */ +#define PPP_S_IPCP_ACCEPT_REMOTE 6 /* Acpt peer's IP addr for it */ +#define PPP_S_NO_IP 7 /* Disable IP addr negot. */ +#define PPP_S_NO_ACC 8 /* Disable addr/control compr */ +#define PPP_S_NO_PC 9 /* Disable proto field compr */ +#define PPP_S_NO_VJ 10 /* Disable VJ compression */ +#define PPP_S_NO_VJCCOMP 11 /* Disable VJ conct-ID compr */ +#define PPP_S_NO_ASYNCMAP 12 /* Disable async map negot. */ +#define PPP_S_NO_MN 13 /* Disable magic num negot. */ +#define PPP_S_NO_MRU 14 /* Disable MRU negotiation */ +#define PPP_S_NO_PAP 15 /* Don't allow PAP auth */ +#define PPP_S_NO_CHAP 16 /* Don't allow CHAP auth */ +#define PPP_S_REQUIRE_PAP 17 /* Require PAP auth */ +#define PPP_S_REQUIRE_CHAP 18 /* Require CHAP auth */ +#define PPP_S_LOGIN 19 /* Use login dbase for PAP */ +#define PPP_S_DEBUG 20 /* Enable daemon debug mode */ +#define PPP_S_DRIVER_DEBUG 21 /* Enable driver debug mode */ + +/* PPP options flag bitfield values */ + +#define OPT_NO_ALL (1 << PPP_S_NO_ALL) +#define OPT_PASSIVE_MODE (1 << PPP_S_PASSIVE_MODE) +#define OPT_SILENT_MODE (1 << PPP_S_SILENT_MODE) +#define OPT_DEFAULTROUTE (1 << PPP_S_DEFAULTROUTE) +#define OPT_PROXYARP (1 << PPP_S_PROXYARP) +#define OPT_IPCP_ACCEPT_LOCAL (1 << PPP_S_IPCP_ACCEPT_LOCAL) +#define OPT_IPCP_ACCEPT_REMOTE (1 << PPP_S_IPCP_ACCEPT_REMOTE) +#define OPT_NO_IP (1 << PPP_S_NO_IP) +#define OPT_NO_ACC (1 << PPP_S_NO_ACC) +#define OPT_NO_PC (1 << PPP_S_NO_PC) +#define OPT_NO_VJ (1 << PPP_S_NO_VJ) +#define OPT_NO_VJCCOMP (1 << PPP_S_NO_VJCCOMP) +#define OPT_NO_ASYNCMAP (1 << PPP_S_NO_ASYNCMAP) +#define OPT_NO_MN (1 << PPP_S_NO_MN) +#define OPT_NO_MRU (1 << PPP_S_NO_MRU) +#define OPT_NO_PAP (1 << PPP_S_NO_PAP) +#define OPT_NO_CHAP (1 << PPP_S_NO_CHAP) +#define OPT_REQUIRE_PAP (1 << PPP_S_REQUIRE_PAP) +#define OPT_REQUIRE_CHAP (1 << PPP_S_REQUIRE_CHAP) +#define OPT_LOGIN (1 << PPP_S_LOGIN) +#define OPT_DEBUG (1 << PPP_S_DEBUG) +#define OPT_DRIVER_DEBUG (1 << PPP_S_DRIVER_DEBUG) + +/* PPP configuration options */ + +typedef struct ppp_options + { + int flags; /* Flag options */ + char *asyncmap; /* Set the desired async map */ + char *escape_chars; /* Set chars to escape on transmission */ + char *vj_max_slots; /* Set maximum VJ compression header slots */ + char *netmask; /* Set netmask value for negotiation */ + char *mru; /* Set MRU value for negotiation */ + char *mtu; /* Set MTU value for negotiation */ + char *lcp_echo_failure; /* Set max # consecutive LCP echo failures */ + char *lcp_echo_interval; /* Set time for LCP echo requests */ + char *lcp_restart; /* Set timeout for LCP */ + char *lcp_max_terminate; /* Set max # xmits for LCP term-reqs */ + char *lcp_max_configure; /* Set max # xmits for LCP conf-reqs */ + char *lcp_max_failure; /* Set max # conf-naks for LCP */ + char *ipcp_restart; /* Set timeout for IPCP */ + char *ipcp_max_terminate; /* Set max # xmits for IPCP term-reqs */ + char *ipcp_max_configure; /* Set max # xmits for IPCP conf-reqs */ + char *ipcp_max_failure; /* Set max # conf-naks for IPCP */ + char *local_auth_name; /* Set local name for authentication */ + char *remote_auth_name; /* Set remote name for authentication */ + char *pap_file; /* Set the PAP secrets file */ + char *pap_user_name; /* Set username for PAP auth with peer */ + char *pap_passwd; /* Set password for PAP auth with peer */ + char *pap_restart; /* Set timeout for PAP */ + char *pap_max_authreq; /* Set max # xmits for PAP auth-reqs */ + char *chap_file; /* Set the CHAP secrets file */ + char *chap_restart; /* Set timeout for CHAP */ + char *chap_interval; /* Set interval for CHAP rechallenge */ + char *chap_max_challenge; /* Set max # xmits for CHAP challenge */ + } PPP_OPTIONS; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern int parse_args (int unit, char *devname, char *local_addr, + char *remote_addr, int baud, PPP_OPTIONS *options, + char *fileName); +extern int options_from_file (char *fileName, int must_exist, + int check_prot); +extern int getword (FILE *f, char *word, int *newlinep, char *fileName); +extern int setdevname (char *cp); +extern int setipaddr (char *local_addr, char *remote_addr); +extern void setipdefault (void); +extern u_long GetMask (u_long addr); + +#else /* __STDC__ */ + +extern int parse_args (); +extern int options_from_file (); +extern int getword (); +extern int setdevname (); +extern int setipaddr (); +extern void setipdefault (); +extern u_long GetMask (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCoptionsh */ diff --git a/h/netinet/ppp/ppp.h b/h/netinet/ppp/ppp.h new file mode 100644 index 0000000..762423f --- /dev/null +++ b/h/netinet/ppp/ppp.h @@ -0,0 +1,56 @@ +/* ppp.h - PPP global definitions header */ + +/* Copyright 1995 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + */ + +/* +modification history +-------------------- +01a,16jan95,dzb WRS-ize. +*/ + +#ifndef __INCppph +#define __INCppph + +#ifdef __cplusplus +extern "C" { +#endif + +#define NPPP 16 /* One PPP interface supported (per process) */ + +/* + * Data Link Layer header = Address, Control, Protocol. + */ +#define ALLSTATIONS 0xff /* All-Stations Address */ +#define UI 0x03 /* Unnumbered Information */ +#define LCP 0xc021 /* Link Control Protocol */ +#define IPCP 0x8021 /* IP Control Protocol */ +#define UPAP 0xc023 /* User/Password Authentication Protocol */ +#define CHAP 0xc223 /* Crytpographic Handshake Protocol */ +#define LQR 0xc025 /* Link Quality Report protocol */ +#define IP_VJ_COMP 0x002d /* VJ TCP compressed IP packet */ +#define DLLHEADERLEN (sizeof (u_char) + sizeof (u_char) + sizeof (u_short)) +#define MTU 1500 /* Default MTU */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCppph */ diff --git a/h/netinet/ppp/pppHookLib.h b/h/netinet/ppp/pppHookLib.h new file mode 100644 index 0000000..e0c84f6 --- /dev/null +++ b/h/netinet/ppp/pppHookLib.h @@ -0,0 +1,67 @@ +/* pppHookLib.h - PPP authentication secrets library header */ + +/* Copyright 1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,29nov95,vin written. +*/ + +#ifndef __INCpppHookLibh +#define __INCpppHookLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vwModNum.h" +#include "netinet/ppp/pppd.h" + +/* typedefs */ + +typedef struct ppp_hooks /* PPP_HOOK_RTNS */ + { + FUNCPTR connectHook; /* hook called before set up of link */ + FUNCPTR disconnectHook; /* hook called after close of link */ + } PPP_HOOK_RTNS; + +/* defines */ + +#define S_pppHookLib_NOT_INITIALIZED (M_pppHookLib | 1) +#define S_pppHookLib_HOOK_DELETED (M_pppHookLib | 2) +#define S_pppHookLib_HOOK_ADDED (M_pppHookLib | 3) +#define S_pppHookLib_HOOK_UNKNOWN (M_pppHookLib | 4) +#define S_pppHookLib_INVALID_UNIT (M_pppHookLib | 5) + +#define PPP_HOOK_CONNECT 0 +#define PPP_HOOK_DISCONNECT 1 + + +/* globals */ + +extern PPP_HOOK_RTNS * pppHookRtns []; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS pppHookLibInit (void); +extern STATUS pppHookAdd (int unit, FUNCPTR hookRtn, int type); +extern STATUS pppHookDelete (int unit, int type); + +#else /* __STDC__ */ + +extern STATUS pppHookLibInit (); +extern STATUS pppHookAdd (); +extern STATUS pppHookDelete (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppHookLibh */ diff --git a/h/netinet/ppp/pppSecretLib.h b/h/netinet/ppp/pppSecretLib.h new file mode 100644 index 0000000..c3d3958 --- /dev/null +++ b/h/netinet/ppp/pppSecretLib.h @@ -0,0 +1,68 @@ +/* pppSecretLib.h - PPP authentication secrets library header */ + +/* Copyright 1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,09may95,dzb written. +*/ + +#ifndef __INCpppSecretLibh +#define __INCpppSecretLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vwModNum.h" +#include "netinet/ppp/pppd.h" + +/* typedefs */ + +typedef struct ppp_secret /* PPP_SECRET */ + { + struct ppp_secret * secretNext; + char client [MAXNAMELEN]; + char server [MAXNAMELEN]; + char secret [MAXSECRETLEN]; + char addrs [MAXNAMELEN]; + } PPP_SECRET; + +/* defines */ + +#define S_pppSecretLib_NOT_INITIALIZED (M_pppSecretLib | 1) +#define S_pppSecretLib_SECRET_DOES_NOT_EXIST (M_pppSecretLib | 2) +#define S_pppSecretLib_SECRET_EXISTS (M_pppSecretLib | 3) + +/* globals */ + +extern PPP_SECRET * pppSecretHead; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS pppSecretLibInit (void); +extern STATUS pppSecretAdd (char * client, char * server, char * secret, + char * addrs); +extern STATUS pppSecretDelete (char * client, char * server, char * secret); +extern int pppSecretFind (char * client, char * server, char * secret, + struct wordlist ** ppAddrs); + +#else /* __STDC__ */ + +extern STATUS pppSecretLibInit (); +extern STATUS pppSecretAdd (); +extern STATUS pppSecretDelete (); +extern int pppSecretFind (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppSecretLibh */ diff --git a/h/netinet/ppp/pppShow.h b/h/netinet/ppp/pppShow.h new file mode 100644 index 0000000..a26cc62 --- /dev/null +++ b/h/netinet/ppp/pppShow.h @@ -0,0 +1,102 @@ +/* pppShow.h - ppp show routine header */ + +/* Copyright 1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,16jun95,dzb header file consolidation. +01c,09may95,dzb added pppSecretShow() prototype. +01b,09feb95,dab removed lcp_echo_fails_reached variable. +01a,13jan95,dab written as pppInfo.h. + +dzb added: path for ppp header files, WRS copyright. WRSize. +*/ + +#ifndef __INCpppShowh +#define __INCpppShowh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "netinet/ppp/pppd.h" + +/* typedefs */ + +typedef struct ppp_info /* PPP_INFO */ + { + /* LCP variables */ + + lcp_options lcp_wantoptions; /* Options that we want to request */ + lcp_options lcp_gotoptions; /* Options that peer ack'd */ + lcp_options lcp_allowoptions; /* Options we allow peer to request */ + lcp_options lcp_hisoptions; /* Options that we ack'd */ + fsm lcp_fsm; /* LCP state structure */ + + u_long lcp_echos_pending; /* Number of outstanding echo msgs */ + u_long lcp_echo_number; /* ID number of next echo frame */ + u_long lcp_echo_timer_running; /* TRUE if a timer running */ + u_long lcp_echo_interval; /* Seconds between intervals */ + u_long lcp_echo_fails; /* Number of echo failures */ + + /* IPCP variables */ + + ipcp_options ipcp_wantoptions; /* Options that we want to request */ + ipcp_options ipcp_gotoptions; /* Options that peer ack'd */ + ipcp_options ipcp_allowoptions; /* Options we allow peer to request */ + ipcp_options ipcp_hisoptions; /* Options that we ack'd */ + fsm ipcp_fsm; /* IPCP state structure */ + + /* authentication variables */ + + chap_state chap; /* CHAP state and variable structure */ + upap_state upap; /* UPAP state and variable structure */ + } PPP_INFO; + +typedef struct ppp_stat /* PPP_STAT */ + { + /* RECEVIED: */ + int in_bytes; /* total number of bytes */ + int in_pkt; /* total number of packets */ + int in_ip_pkt; /* number of IP packets */ + int in_vj_compr_pkt; /* number of VJ compressed packets */ + int in_vj_uncompr_pkt; /* number of VJ uncompressed packets */ + int in_vj_compr_error; /* number of VJ compression errors */ + + /* SENT: */ + int out_bytes; /* total number of bytes */ + int out_pkt; /* total number of packets */ + int out_ip_pkt; /* number of IP packets */ + int out_vj_compr_pkt; /* number of VJ compressed packets */ + int out_vj_uncompr_pkt; /* number of VJ uncompressed packets */ + } PPP_STAT; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void pppShowInit (void); +extern void pppInfoShow (void); +extern STATUS pppInfoGet (int unit, PPP_INFO *pInfo); +extern void pppstatShow (void); +extern STATUS pppstatGet (int unit, PPP_STAT *pStat); +extern void pppSecretGet (void); + +#else /* __STDC__ */ + +extern void pppShowInit (); +extern void pppInfoShow (); +extern STATUS pppInfoGet (); +extern void pppstatShow (); +extern STATUS pppstatGet (); +extern void pppSecretGet (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppShowh */ diff --git a/h/netinet/ppp/ppp_auth.h b/h/netinet/ppp/ppp_auth.h new file mode 100644 index 0000000..60c769a --- /dev/null +++ b/h/netinet/ppp/ppp_auth.h @@ -0,0 +1,85 @@ +/* ppp_auth.h - PPP Authentication header */ + +/* Copyright 1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,21jun95,dzb added externs for unbundling of crypt(). +01c,16jun95,dzb renamed to ppp_auth.h. added header file inclusion. +01b,11may95,dzb moved in defines from auth.c. added NONWILD macro. +01a,19jan95,dzb written. +*/ + +#ifndef __INCppp_authh +#define __INCppp_authh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "stdio.h" + +/* defines */ + +/* Bits in scan_authfile return value */ + +#define NONWILD_SERVER 1 +#define NONWILD_CLIENT 2 +#define NONWILD (NONWILD_SERVER | NONWILD_CLIENT) + +#define ISWILD(word) (word[0] == '*' && word[1] == 0) + +extern FUNCPTR pppCryptRtn; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void link_required (int unit); +extern void link_terminated (int unit); +extern void link_down (int unit); +extern void link_established (int unit); +extern void auth_peer_fail (int unit, int protocol); +extern void auth_peer_success (int unit, int protocol); +extern void auth_withpeer_fail (int unit, int protocol); +extern void auth_withpeer_success (int unit, int protocol); +extern void check_auth_options (void); +extern int check_passwd (int unit, char *auser, int userlen, char *apasswd, + int passwdlen, char **msg, int *msglen); +extern int get_secret (int unit, char *client, char *server, char *secret, + int *secret_len, int save_addrs); +extern int auth_ip_addr (int unit, u_long addr); +extern int bad_ip_adrs (u_long addr); +extern void check_access (FILE *f, char *fileName); + +extern void cryptRtnInit (FUNCPTR *cryptRtnHook); + +#else /* __STDC__ */ + +extern void link_required (); +extern void link_terminated (); +extern void link_down (); +extern void link_established (); +extern void auth_peer_fail (); +extern void auth_peer_success (); +extern void auth_withpeer_fail (); +extern void auth_withpeer_success (); +extern void check_auth_options (); +extern int check_passwd (); +extern int get_secret (); +extern int auth_ip_addr (); +extern int bad_ip_adrs (); +extern void check_access (); + +extern void cryptRtnInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCppp_authh */ diff --git a/h/netinet/ppp/ppp_vxworks.h b/h/netinet/ppp/ppp_vxworks.h new file mode 100644 index 0000000..42203b7 --- /dev/null +++ b/h/netinet/ppp/ppp_vxworks.h @@ -0,0 +1,74 @@ +/* ppp_vxworks.h - VxWorks dependent PPP routine header */ + +/* Copyright 1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,16jun95,dzb header file consolidation. +01b,16jan95,dzb changed to ppp_vxworks.h. added function prototypes. +01a,22dec94,dzb written. +*/ + +#ifndef __INCppp_vxworksh +#define __INCppp_vxworksh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void establish_ppp (void); +extern void disestablish_ppp (void); +extern void output (int unit, u_char *p, int len); +extern int read_packet (u_char *buf); +extern void ppp_send_config (int unit, int mtu, u_long asyncmap, int pcomp, + int accomp); +extern void ppp_set_xaccm (int unit, ext_accm accm); +extern void ppp_recv_config (int unit, int mru, u_long asyncmap, int pcomp, + int accomp); +extern int sifvjcomp (int u, int vjcomp, int cidcomp, int maxcid); +extern int sifup (int u); +extern int sifdown (int u); +extern int sifaddr (int u, int o, int h, int m); +extern int cifaddr (int u, int o, int h); +extern int sifdefaultroute (int u, int g); +extern int cifdefaultroute (int u, int g); +extern int sifproxyarp (int unit, u_long hisaddr); +extern int cifproxyarp (int unit, u_long hisaddr); +extern int get_ether_addr (u_long ipaddr, struct sockaddr *hwaddr); +extern int ppp_available (void); +extern char *stringdup (char *in); + +#else /* __STDC__ */ + +extern void establish_ppp (); +extern void disestablish_ppp (); +extern void output (); +extern int read_packet (); +extern void ppp_send_config (); +extern void ppp_set_xaccm (); +extern void ppp_recv_config (); +extern int sifvjcomp (); +extern int sifup (); +extern int sifdown (); +extern int sifaddr (); +extern int cifaddr (); +extern int sifdefaultroute (); +extern int cifdefaultroute (); +extern int sifproxyarp (); +extern int cifproxyarp (); +extern int get_ether_addr (); +extern int ppp_available (); +extern char *stringdup (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCppp_vxworksh */ diff --git a/h/netinet/ppp/pppd.h b/h/netinet/ppp/pppd.h new file mode 100644 index 0000000..bdf775d --- /dev/null +++ b/h/netinet/ppp/pppd.h @@ -0,0 +1,437 @@ +/* pppd.h - PPP daemon header */ + +/* Copyright 1995 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +/* +modification history +-------------------- +01l,29oct01,gls removed definition of sleep() +01k,05aug96,vin included if_types.h. +01j,22jun95,dzb changed [un]timeout() to ppp_[un]timeout(). + removed usehostname option. +01i,12jun95,dzb added SNMP MIBII counters to ppp_task_vars. + header file consolidation. changed to ppp_auth.h. + moved PPP_OPTIONS and options flags to options.h. + removed device_script() prototype. + changed [dis[connect strings to global hook routines. + changed [UN]TIMEOUT macros to PPP_[UN]TIMEOUT. +01h,22may95,dzb Added OPT_REQUIRE_PAP and OPT_REQUIRE_CHAP. +01g,16may95,dzb Added uselogin and OPT_LOGIN for login option. + removed logged_in and attempts fields from PPP_TASK_VARS. +01f,05may95,dzb added pap_passwd field to ppp_options structure. +01e,07mar95,dzb moved pppInit() and pppDelete() prototypes to pppLib.h. +01d,09feb95,dab removed lcp_echo_fails_reached, uselogin, and OPT_LOGIN. +01c,24jan95,dzb renamed protoype params for pppInit() and ppp_task(). +01b,16jan95,dzb moved in ARGS macro from args.h. + moved in callout from callout.h. + moved in patch level macros from patchlevel.h. +01a,13jan95,dab VxWorks port - first WRS version. + +dzb added: path for ppp header files, WRS copyright. WRS-ize. +*/ + +#ifndef __INCpppdh +#define __INCpppdh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __ARGS +#ifdef __STDC__ +#define __ARGS(x) x +#else +#define __ARGS(x) () +#endif +#endif + +/* includes */ + +#include "wdLib.h" +#include "semLib.h" +#include "remLib.h" +#include "net/if.h" +#include "net/if_types.h" +#include "time.h" +#include "netinet/ppp/ppp.h" +#include "netinet/ppp/ppp_auth.h" +#include "netinet/ppp/chap.h" +#include "netinet/ppp/fsm.h" +#include "netinet/ppp/if_ppp.h" +#include "netinet/ppp/ipcp.h" +#include "netinet/ppp/lcp.h" +#include "netinet/ppp/magic.h" +#include "netinet/ppp/md5.h" +#include "netinet/ppp/options.h" +#include "netinet/ppp/ppp_vxworks.h" +#include "netinet/ppp/random.h" +#include "netinet/ppp/upap.h" + +/* defines */ + +/* + * Patch level + */ +#define PATCHLEVEL 2 +#define VERSION "2.1" +#define DATE "9 June 94" + +/* + * Limits. + */ +#define MAXWORDLEN 1024 /* max length of word in file (incl null) */ +#define MAXARGS 1 /* max # args to a command */ +#define MAXNAMELEN 256 /* max length of hostname or name for auth */ +#define MAXSECRETLEN 256 /* max length of password or secret */ +#define MAXPATHLEN 1024 /* max length of password or secret */ + +/* + * Values for phase. + */ +#define PHASE_DEAD 0 +#define PHASE_ESTABLISH 1 +#define PHASE_AUTHENTICATE 2 +#define PHASE_NETWORK 3 +#define PHASE_TERMINATE 4 + +#ifndef SIOCSIFMTU +#define SIOCSIFMTU _IOW('i', 140, int) +#endif /* SIOCSIFMTU */ +#ifndef SIOCGIFMTU +#define SIOCGIFMTU _IOR('i', 141, int) +#endif /* SIOCGIFMTU */ + +/* Used for storing a sequence of words. Usually malloced. */ +struct wordlist { + struct wordlist *next; + char word[1]; +}; + +/* + * This is a copy of /usr/include/sys/callout.h with the c_func + * member of struct callout changed from a pointer to a function of type int + * to a pointer to a function of type void (generic pointer) as per ANSI C + */ + +struct callout { + int c_time; /* incremental time */ + caddr_t c_arg; /* argument to routine */ + void (*c_func)(); /* routine (changed to void (*)() */ + struct callout *c_next; +}; + +/* PPP task variables structure */ +typedef struct ppp_task_vars +{ + PPP_OPTIONS *options; /* Configuration options */ + + int task_id; /* Task id of pppd task */ + + /* interface varibles */ + char ifname[IFNAMSIZ]; /* Interface name */ + int ifunit; /* Interface unit number */ + + /* descriptors */ + int fd; /* Device descriptor */ + int s; /* Socket descriptor */ + + /* timer variables */ + struct callout *callout; /* Callout list */ + timer_t timer_id; /* Id of alarm timer */ + time_t schedtime; /* Time last timeout was set */ + + /* configured variables */ + int debug; /* Debug flag */ + int inspeed; /* Input/Output speed requested */ + u_long netmask; /* Netmask to use on PPP interface */ + int auth_required; /* Require peer to authenticate */ + int defaultroute; /* Assign default rte through interf */ + int proxyarp; /* Set entry in arp table */ + int uselogin; /* Check PAP info against login table */ + int phase; /* Where the link is at */ + int baud_rate; /* Bits/sec currently used */ + char user[MAXNAMELEN]; /* User name */ + char passwd[MAXSECRETLEN]; /* Password for PAP */ + int disable_defaultip; /* Use hostname IP address */ + int kdebugflag; /* Enable driver debug */ + + char hostname[MAXNAMELEN]; /* Our host name */ + char our_name[MAXNAMELEN]; /* Authentication host name */ + char remote_name[MAXNAMELEN]; /* Remote host name */ + + char devname[MAXPATHLEN]; /* Device name */ + + int ttystate; /* Initial TTY state */ + + int restore_term; /* 1 => we've munged the terminal */ + + /* Buffer for outgoing packet */ + u_char outpacket_buf[MTU + DLLHEADERLEN]; + /* Buffer for incoming packet */ + u_char inpacket_buf[MTU + DLLHEADERLEN]; + + int hungup; /* Terminal has been hung up */ + + int peer_mru; /* Peer MRU */ + + /* Records which authentication operations haven't completed yet. */ + int auth_pending; /* Authentication state */ + struct wordlist *addresses; /* List of acceptable IP addresses */ + + /* lcp echo variables */ + u_long lcp_echos_pending; /* Number of outstanding echo msgs */ + u_long lcp_echo_number; /* ID number of next echo frame */ + u_long lcp_echo_timer_running; /* TRUE if a timer running */ + u_long lcp_echo_interval; /* Seconds between intervals */ + u_long lcp_echo_fails; /* Number of echo failures */ + + /* chap variables */ + chap_state chap; /* CHAP structure */ + + /* ipcp variables */ + ipcp_options ipcp_wantoptions; /* Options we want to request */ + ipcp_options ipcp_gotoptions; /* Options that peer ack'd */ + ipcp_options ipcp_allowoptions; /* Options we allow peer to request */ + ipcp_options ipcp_hisoptions; /* Options that we ack'd */ + fsm ipcp_fsm; /* IPCP fsm structure */ + int cis_received; /* # Conf-Reqs received */ + + /* lcp variables */ + lcp_options lcp_wantoptions; /* Options that we want to request */ + lcp_options lcp_gotoptions; /* Options that peer ack'd */ + lcp_options lcp_allowoptions; /* Options we allow peer to request */ + lcp_options lcp_hisoptions; /* Options that we ack'd */ + u_long xmit_accm[8]; /* extended transmit ACCM */ + fsm lcp_fsm; /* LCP fsm structure */ + + /* upap variables */ + upap_state upap; /* UPAP state; one for each unit */ + + /* SNMP MIBII counters */ + u_long unknownProto; /* MIBII: ifInUnknownProtos */ +} PPP_TASK_VARS; + +/* + * Externals + */ +extern int ppp_unit; +extern PPP_TASK_VARS *ppp_if[]; +extern void syslog(int, char *, ...); + +extern FUNCPTR pppConnectHook; /* user connect hook routine */ +extern FUNCPTR pppDisconnectHook; /* user disconnect hook routine */ + +/* + * Inline versions of get/put char/short/long. + * Pointer is advanced; we assume that both arguments + * are lvalues and will already be in registers. + * cp MUST be u_char *. + */ +#define GETCHAR(c, cp) { \ + (c) = *(cp)++; \ +} +#define PUTCHAR(c, cp) { \ + *(cp)++ = (u_char) (c); \ +} + + +#define GETSHORT(s, cp) { \ + (s) = *(cp)++ << 8; \ + (s) |= *(cp)++; \ +} +#define PUTSHORT(s, cp) { \ + *(cp)++ = (u_char) ((s) >> 8); \ + *(cp)++ = (u_char) (s); \ +} + +#define GETLONG(l, cp) { \ + (l) = *(cp)++ << 8; \ + (l) |= *(cp)++; (l) <<= 8; \ + (l) |= *(cp)++; (l) <<= 8; \ + (l) |= *(cp)++; \ +} +#define PUTLONG(l, cp) { \ + *(cp)++ = (u_char) ((l) >> 24); \ + *(cp)++ = (u_char) ((l) >> 16); \ + *(cp)++ = (u_char) ((l) >> 8); \ + *(cp)++ = (u_char) ((l)); \ +} + +#define INCPTR(n, cp) ((cp) += (n)) +#define DECPTR(n, cp) ((cp) -= (n)) + +/* + * System dependent definitions for user-level 4.3BSD UNIX implementation. + */ + +#define DEMUXPROTREJ(u, p) demuxprotrej(u, p) + +#define PPP_TIMEOUT(r, f, t) ppp_timeout((r), (f), (t)) +#define PPP_UNTIMEOUT(r, f) ppp_untimeout((r), (f)) + +#define BCOPY(s, d, l) bcopy((char *) s, (char *) d, (int) l) +#define BZERO(s, n) bzero(s, n) +#define EXIT(u) die(u, 0) + +#define PRINTMSG(m, l) { m[l] = '\0'; syslog(LOG_INFO, "Remote message: %s", m); } + +/* + * MAKEHEADER - Add Header fields to a packet. + */ +#define MAKEHEADER(p, t) { \ + PUTCHAR(ALLSTATIONS, p); \ + PUTCHAR(UI, p); \ + PUTSHORT(t, p); } + +#ifdef DEBUGALL +#define DEBUGMAIN 1 +#define DEBUGFSM 1 +#define DEBUGLCP 1 +#define DEBUGIPCP 1 +#define DEBUGUPAP 1 +#define DEBUGCHAP 1 +#endif + +#ifndef LOG_PPP /* we use LOG_LOCAL2 for syslog by default */ +#if defined(DEBUGMAIN) || defined(DEBUGFSM) || defined(DEBUG) \ + || defined(DEBUGLCP) || defined(DEBUGIPCP) || defined(DEBUGUPAP) \ + || defined(DEBUGCHAP) +#define LOG_PPP LOG_LOCAL2 +#else +#define LOG_PPP LOG_DAEMON +#endif +#endif /* LOG_PPP */ + +#ifdef DEBUGMAIN +#define MAINDEBUG(x) if (ppp_if[ppp_unit]->debug) syslog x; +#else +#define MAINDEBUG(x) +#endif + +#ifdef DEBUGFSM +#define FSMDEBUG(x) if (ppp_if[ppp_unit]->debug) syslog x; +#else +#define FSMDEBUG(x) +#endif + +#ifdef DEBUGLCP +#define LCPDEBUG(x) if (ppp_if[ppp_unit]->debug) syslog x; +#else +#define LCPDEBUG(x) +#endif + +#ifdef DEBUGIPCP +#define IPCPDEBUG(x) if (ppp_if[ppp_unit]->debug) syslog x; +#else +#define IPCPDEBUG(x) +#endif + +#ifdef DEBUGUPAP +#define UPAPDEBUG(x) if (ppp_if[ppp_unit]->debug) syslog x; +#else +#define UPAPDEBUG(x) +#endif + +#ifdef DEBUGCHAP +#define CHAPDEBUG(x) if (ppp_if[ppp_unit]->debug) syslog x; +#else +#define CHAPDEBUG(x) +#endif + +#ifndef SIGTYPE +#if defined(sun) || defined(SYSV) || defined(POSIX_SOURCE) +#define SIGTYPE void +#else +#define SIGTYPE int +#endif /* defined(sun) || defined(SYSV) || defined(POSIX_SOURCE) */ +#endif /* SIGTYPE */ + +#ifndef MIN +#define MIN(a, b) ((a) < (b)? (a): (b)) +#endif +#ifndef MAX +#define MAX(a, b) ((a) > (b)? (a): (b)) +#endif + +#undef LOG_WARNING +#undef LOG_ERR +#undef LOG_INFO +#undef LOG_NOTICE +#undef LOG_DEBUG +#undef LOG_UPTO + +#define LOG_WARNING 0 +#define LOG_ERR 1 +#define LOG_INFO 2 +#define LOG_NOTICE 3 +#define LOG_DEBUG 4 +#define LOG_UPTO 5 + +#ifndef DEBUGALL +#define _assert(ex) {if (!(ex)){(void)syslog(LOG_ERR,"Assertion failed: file \"%s\", line %d\n", __FILE__, __LINE__);die(ppp_unit, 1);}} +#define assert(ex) _assert(ex) +#else +#define _assert(ex) +#define assert(ex) +#endif + +void format_packet __ARGS((u_char *, int, + void (*) (void *, char *, ...), void *)); + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void ppp_task (int unit, char *devname, char *local_addr, + char *remote_addr, int baud, PPP_OPTIONS *pOptions, + char *fOptions); +extern void die (int unit, int status); +extern void ppp_timeout (void (*func) (), caddr_t arg, int seconds); +extern void ppp_untimeout (void (*func) (), caddr_t arg); +extern void adjtimeout (void); +extern void demuxprotrej (int unit, u_short protocol); +extern void log_packet (u_char *p, int len, char *prefix); +extern void print_string (char *p, int len, void (*printer) + (void *, char *, ...), void *arg); +extern void pr_log (void *arg, char *fmt, ...); +extern void format_packet (u_char *p, int len, + void (*printer) (void *, char *, ...), void *arg); +extern void novm (char *msg); + +#else /* __STDC__ */ + +extern int ppp_task (); +extern void die (); +extern void ppp_timeout (); +extern void ppp_untimeout (); +extern void adjtimeout (); +extern void demuxprotrej (); +extern void log_packet (); +extern void print_string (); +extern void pr_log (); +extern void format_packet (); +extern void novm (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppdh */ diff --git a/h/netinet/ppp/random.h b/h/netinet/ppp/random.h new file mode 100644 index 0000000..da22a31 --- /dev/null +++ b/h/netinet/ppp/random.h @@ -0,0 +1,36 @@ +/* random.h - PPP random number generator header */ + +/* Copyright 1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,17jun95,dzb written. +*/ + +#ifndef __INCrandomh +#define __INCrandomh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern long random (void); +extern void srandom (int); + +#else /* __STDC__ */ + +extern long random (); +extern void srandom (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrandomh */ diff --git a/h/netinet/ppp/upap.h b/h/netinet/ppp/upap.h new file mode 100644 index 0000000..7f111df --- /dev/null +++ b/h/netinet/ppp/upap.h @@ -0,0 +1,107 @@ +/* upap.h - User/Password Authentication Protocol header */ + +/* Copyright 1995 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +/* +modification history +-------------------- +01a,16jan95,dzb WRS-ize. +*/ + +#ifndef __INCupaph +#define __INCupaph + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Packet header = Code, id, length. + */ +#define UPAP_HEADERLEN (sizeof (u_char) + sizeof (u_char) + sizeof (u_short)) + + +/* + * UPAP codes. + */ +#define UPAP_AUTHREQ 1 /* Authenticate-Request */ +#define UPAP_AUTHACK 2 /* Authenticate-Ack */ +#define UPAP_AUTHNAK 3 /* Authenticate-Nak */ + + +/* + * Each interface is described by upap structure. + */ +typedef struct upap_state { + int us_unit; /* Interface unit number */ + char *us_user; /* User */ + int us_userlen; /* User length */ + char *us_passwd; /* Password */ + int us_passwdlen; /* Password length */ + int us_clientstate; /* Client state */ + int us_serverstate; /* Server state */ + u_char us_id; /* Current id */ + int us_timeouttime; /* Timeout time in milliseconds */ + int us_transmits; /* Number of auth-reqs sent */ + int us_maxtransmits; /* Maximum number of auth-reqs to send */ +} upap_state; + + +/* + * Client states. + */ +#define UPAPCS_INITIAL 0 /* Connection down */ +#define UPAPCS_CLOSED 1 /* Connection up, haven't requested auth */ +#define UPAPCS_PENDING 2 /* Connection down, have requested auth */ +#define UPAPCS_AUTHREQ 3 /* We've sent an Authenticate-Request */ +#define UPAPCS_OPEN 4 /* We've received an Ack */ +#define UPAPCS_BADAUTH 5 /* We've received a Nak */ + +/* + * Server states. + */ +#define UPAPSS_INITIAL 0 /* Connection down */ +#define UPAPSS_CLOSED 1 /* Connection up, haven't requested auth */ +#define UPAPSS_PENDING 2 /* Connection down, have requested auth */ +#define UPAPSS_LISTEN 3 /* Listening for an Authenticate */ +#define UPAPSS_OPEN 4 /* We've sent an Ack */ +#define UPAPSS_BADAUTH 5 /* We've sent a Nak */ + + +/* + * Timeouts. + */ +#define UPAP_DEFTIMEOUT 3 /* Timeout time in seconds */ + +extern void upap_init __ARGS((int)); +extern void upap_authwithpeer __ARGS((int, char *, char *)); +extern void upap_authpeer __ARGS((int)); +extern void upap_lowerup __ARGS((int)); +extern void upap_lowerdown __ARGS((int)); +extern void upap_input __ARGS((int, u_char *, int)); +extern void upap_protrej __ARGS((int)); +extern int upap_printpkt __ARGS((u_char *, int, + void (*) __ARGS((void *, char *, ...)), void *)); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCupaph */ diff --git a/h/netinet/sl_compress.h b/h/netinet/sl_compress.h new file mode 100644 index 0000000..9986a04 --- /dev/null +++ b/h/netinet/sl_compress.h @@ -0,0 +1,287 @@ +/* sl_compress.h - Definitions for tcp compression routines */ + +/* $NetBSD: slcompress.h,v 1.8 1994/06/29 06:36:51 cgd Exp $ */ + +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)slcompress.h 8.1 (Berkeley) 6/10/93 + */ + +/* + * Definitions for tcp compression routines. + * + * Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989: + * - Initial distribution. + */ + +/* +modification history +-------------------- +01d,17nov96,bin removed MLEN replaced with CL_SIZE_128 +01c,01aug96,vin integrated with BSD4.4, moved to netinet made universal + for CSLIP as well as PPP. +01b,16jun95,dzb added necessary header file inclusions. +01a,16jan95,dzb WRS-ize. added prototype of ppp_sl_uncompress_tcp_part(). + prepended "ppp_" due to conflict with CSLIP's slcompress. +*/ + +#ifndef __INCsl_compressh +#define __INCsl_compressh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "netinet/in_systm.h" +#include "net/mbuf.h" +#include "netinet/ip.h" + +#define SL_STATS /* define to include statistics counters */ + +#define MAX_STATES 16 /* must be > 2 and < 256 */ +#define MAX_HDR CL_SIZE_128 + +/* + * Compressed packet format: + * + * The first octet contains the packet type (top 3 bits), TCP + * 'push' bit, and flags that indicate which of the 4 TCP sequence + * numbers have changed (bottom 5 bits). The next octet is a + * conversation number that associates a saved IP/TCP header with + * the compressed packet. The next two octets are the TCP checksum + * from the original datagram. The next 0 to 15 octets are + * sequence number changes, one change per bit set in the header + * (there may be no changes and there are two special cases where + * the receiver implicitly knows what changed -- see below). + * + * There are 5 numbers which can change (they are always inserted + * in the following order): TCP urgent pointer, window, + * acknowlegement, sequence number and IP ID. (The urgent pointer + * is different from the others in that its value is sent, not the + * change in value.) Since typical use of SLIP links is biased + * toward small packets (see comments on MTU/MSS below), changes + * use a variable length coding with one octet for numbers in the + * range 1 - 255 and 3 octets (0, MSB, LSB) for numbers in the + * range 256 - 65535 or 0. (If the change in sequence number or + * ack is more than 65535, an uncompressed packet is sent.) + */ + +/* + * Packet types (must not conflict with IP protocol version) + * + * The top nibble of the first octet is the packet type. There are + * three possible types: IP (not proto TCP or tcp with one of the + * control flags set); uncompressed TCP (a normal IP/TCP packet but + * with the 8-bit protocol field replaced by an 8-bit connection id -- + * this type of packet syncs the sender & receiver); and compressed + * TCP (described above). + * + * LSB of 4-bit field is TCP "PUSH" bit (a worthless anachronism) and + * is logically part of the 4-bit "changes" field that follows. Top + * three bits are actual packet type. For backward compatibility + * and in the interest of conserving bits, numbers are chosen so the + * IP protocol version number (4) which normally appears in this nibble + * means "IP packet". + */ + +/* packet types */ +#define TYPE_IP 0x40 +#define TYPE_UNCOMPRESSED_TCP 0x70 +#define TYPE_COMPRESSED_TCP 0x80 +#define TYPE_ERROR 0x00 + +/* Bits in first octet of compressed packet */ +#define NEW_C 0x40 /* flag bits for what changed in a packet */ +#define NEW_I 0x20 +#define NEW_S 0x08 +#define NEW_A 0x04 +#define NEW_W 0x02 +#define NEW_U 0x01 + +/* reserved, special-case values of above */ +#define SPECIAL_I (NEW_S|NEW_W|NEW_U) /* echoed interactive traffic */ +#define SPECIAL_D (NEW_S|NEW_A|NEW_W|NEW_U) /* unidirectional data */ +#define SPECIALS_MASK (NEW_S|NEW_A|NEW_W|NEW_U) + +#define TCP_PUSH_BIT 0x10 + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * "state" data for each active tcp conversation on the wire. This is + * basically a copy of the entire IP/TCP header from the last packet + * we saw from the conversation together with a small identifier + * the transmit & receive ends of the line use to locate saved header. + */ +struct cstate { + struct cstate *cs_next; /* next most recently used cstate (xmit only) */ + u_short cs_hlen; /* size of hdr (receive only) */ + u_char cs_id; /* connection # associated with this state */ + u_char cs_filler; + union { + char csu_hdr[MAX_HDR]; + struct ip csu_ip; /* ip/tcp hdr from most recent packet */ + } slcs_u; +}; +#define cs_ip slcs_u.csu_ip +#define cs_hdr slcs_u.csu_hdr + +/* + * all the state data for one serial line (we need one of these + * per line). + */ +struct slcompress { + struct cstate *last_cs; /* most recently used tstate */ + u_char last_recv; /* last rcvd conn. id */ + u_char last_xmit; /* last sent conn. id */ + u_short flags; +#ifdef SL_STATS + u_int sls_packets; /* outbound packets */ + u_int sls_compressed; /* outbound compressed packets */ + u_int sls_searches; /* searches for connection state */ + u_int sls_misses; /* times couldn't find conn. state */ + u_int sls_uncompressedin; /* inbound uncompressed packets */ + u_int sls_compressedin; /* inbound compressed packets */ + u_int sls_errorin; /* inbound unknown type packets */ + u_int sls_tossed; /* inbound packets tossed because of error */ +#endif + struct cstate tstate[MAX_STATES]; /* xmit connection states */ + struct cstate rstate[MAX_STATES]; /* receive connection states */ +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* flag values */ +#define SLF_TOSS 1 /* tossing rcvd frames because of input err */ + +#ifdef SL_STATS +#define INCR(counter) ++comp->counter; +#else +#define INCR(counter) +#endif + +#define BCMP(p1, p2, n) bcmp((char *)(p1), (char *)(p2), (int)(n)) + +#ifdef BCOPY +#undef BCOPY +#endif /* BCOPY */ +#define BCOPY(s, d, l) bcopy((char *) s, (char *) d, (int) l) +#ifndef KERNEL +#define ovbcopy bcopy +#endif + +/* ENCODE encodes a number that is known to be non-zero. ENCODEZ + * checks for zero (since zero has to be encoded in the long, 3 byte + * form). + */ +#define ENCODE(n) { \ + if ((u_short)(n) >= 256) { \ + *cp++ = 0; \ + cp[1] = (n); \ + cp[0] = (n) >> 8; \ + cp += 2; \ + } else { \ + *cp++ = (n); \ + } \ +} +#define ENCODEZ(n) { \ + if ((u_short)(n) >= 256 || (u_short)(n) == 0) { \ + *cp++ = 0; \ + cp[1] = (n); \ + cp[0] = (n) >> 8; \ + cp += 2; \ + } else { \ + *cp++ = (n); \ + } \ +} + +#define DECODEL(f) { \ + if (*cp == 0) {\ + (f) = htonl(ntohl(f) + ((cp[1] << 8) | cp[2])); \ + cp += 3; \ + } else { \ + (f) = htonl(ntohl(f) + (u_long)*cp); \ + cp++; \ + } \ +} + +#define DECODES(f) { \ + if (*cp == 0) {\ + (f) = htons(ntohs(f) + ((cp[1] << 8) | cp[2])); \ + cp += 3; \ + } else { \ + (f) = htons(ntohs(f) + (u_long)*cp); \ + cp++; \ + } \ +} + +#define DECODEU(f) { \ + if (*cp == 0) {\ + (f) = htons((cp[1] << 8) | cp[2]); \ + cp += 3; \ + } else { \ + (f) = htons((u_long)*cp); \ + cp++; \ + } \ +} + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void sl_compress_init (struct slcompress *comp); +extern u_int sl_compress_tcp (struct mbuf *m, struct ip *ip, + struct slcompress *comp, int compress_cid); +extern int sl_uncompress_tcp (u_char** bufp, int len, u_int type, + struct slcompress *comp); +#else /* __STDC__ */ + +extern void ppp_sl_compress_init (); +extern void ppp_sl_compress_setup (); +extern u_char ppp_sl_compress_tcp (); +extern int ppp_sl_uncompress_tcp (); +extern int ppp_sl_uncompress_tcp_part (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsl_compressh */ diff --git a/h/netinet/tcp.h b/h/netinet/tcp.h new file mode 100644 index 0000000..ceefd01 --- /dev/null +++ b/h/netinet/tcp.h @@ -0,0 +1,146 @@ +/* tcp.h - tcp header file */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp.h 8.1 (Berkeley) 6/10/93 + */ + +/* +modification history +-------------------- +01a,03mar96,vin created from BSD4.4 stuff. integrated with 02k of tcp.h + Corrected bit fields according to ansi spec. +*/ + +#ifndef __INCtcph +#define __INCtcph + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _BYTE_ORDER +/* + * Definitions for byte order, + * according to byte significance from low address to high. + */ +#define _LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */ +#define _BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */ +#define _PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */ +#ifdef vax +#define _BYTE_ORDER _LITTLE_ENDIAN +#else +#define _BYTE_ORDER _BIG_ENDIAN /* mc68000, tahoe, most others */ +#endif +#endif /* _BYTE_ORDER */ + +typedef u_long tcp_seq; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * TCP header. + * Per RFC 793, September, 1981. + */ +struct tcphdr { + u_short th_sport; /* source port */ + u_short th_dport; /* destination port */ + tcp_seq th_seq; /* sequence number */ + tcp_seq th_ack; /* acknowledgement number */ +#if _BYTE_ORDER == _LITTLE_ENDIAN + u_int th_x2:4, /* (unused) */ + th_off:4, /* data offset */ +#endif +#if _BYTE_ORDER == _BIG_ENDIAN + u_int th_off:4, /* data offset */ + th_x2:4, /* (unused) */ +#endif + th_flags:8, +#define TH_FIN 0x01 +#define TH_SYN 0x02 +#define TH_RST 0x04 +#define TH_PUSH 0x08 +#define TH_ACK 0x10 +#define TH_URG 0x20 + th_win:16; /* window */ + u_short th_sum; /* checksum */ + u_short th_urp; /* urgent pointer */ +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#define TCPOPT_EOL 0 +#define TCPOPT_NOP 1 +#define TCPOPT_MAXSEG 2 +#define TCPOLEN_MAXSEG 4 +#define TCPOPT_WINDOW 3 +#define TCPOLEN_WINDOW 3 +#define TCPOPT_SACK_PERMITTED 4 /* Experimental */ +#define TCPOLEN_SACK_PERMITTED 2 +#define TCPOPT_SACK 5 /* Experimental */ +#define TCPOPT_TIMESTAMP 8 +#define TCPOLEN_TIMESTAMP 10 +#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */ + +#define TCPOPT_TSTAMP_HDR \ + (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP) + +/* + * Default maximum segment size for TCP. + * With an IP MSS of 576, this is 536, + * but 512 is probably more convenient. + * This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)). + */ +#define TCP_MSS 512 + +#define TCP_MAXWIN 65535 /* largest value for (unscaled) window */ + +#define TCP_MAX_WINSHIFT 14 /* maximum window shift */ + +/* + * User-settable options (used with setsockopt). + */ +#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */ +#define TCP_MAXSEG 0x02 /* set maximum segment size */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtcph */ diff --git a/h/netinet/tcp_debug.h b/h/netinet/tcp_debug.h new file mode 100644 index 0000000..8de0e3d --- /dev/null +++ b/h/netinet/tcp_debug.h @@ -0,0 +1,111 @@ +/* tcp_debug.h - tcp debug header file */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp_debug.h 8.1 (Berkeley) 6/10/93 + */ + +/* +modification history +-------------------- +01a,03mar96,vin created from BSD4.4 stuff, integrated with 02l of tcp_debug.h +*/ + + +#ifndef __INCtcp_debugh +#define __INCtcp_debugh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "tcp_var.h" +#include "tcpip.h" + +#define TCP_NDEBUG 100 /* length of debug info array */ +#define TCP_DEBUG_NUM_DEFAULT 20 /* default display number */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +struct tcp_debug { + n_time td_time; + short td_act; + short td_ostate; + caddr_t td_tcb; + caddr_t td_tiphdr; + struct tcpiphdr td_ti; + struct tcpcb td_cb; + short td_req; +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#define TA_INPUT 0 +#define TA_OUTPUT 1 +#define TA_USER 2 +#define TA_RESPOND 3 +#define TA_DROP 4 + +#ifdef TANAMES +char *tanames[] = + { "input", "output", "user", "respond", "drop" }; +#endif + +IMPORT VOIDFUNCPTR tcpTraceRtn; +IMPORT VOIDFUNCPTR tcpReportRtn; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void tcpTraceInit (void); + +#else /* __STDC__ */ + +extern void tcpTraceInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtcp_debugh */ diff --git a/h/netinet/tcp_fsm.h b/h/netinet/tcp_fsm.h new file mode 100644 index 0000000..19fbef4 --- /dev/null +++ b/h/netinet/tcp_fsm.h @@ -0,0 +1,106 @@ +/* tcp_fsm.h - tcp fsm state definition header file */ + +/* Copyright 1984 - 2000 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp_fsm.h 8.1 (Berkeley) 6/10/93 + */ + +/* +modification history +-------------------- +01c,07dec01,rae merge from synth ver 01c (SPR #70380) +01b,14nov00,ham removed messed tcpstates declaration(SPR 62272). +01a,03mar96,vin created from BSD4.4 stuff. +*/ + +#ifndef __INCtcp_fsmh +#define __INCtcp_fsmh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * TCP FSM state definitions. + * Per RFC793, September, 1981. + */ + +#define TCP_NSTATES 11 + +#define TCPS_CLOSED 0 /* closed */ +#define TCPS_LISTEN 1 /* listening for connection */ +#define TCPS_SYN_SENT 2 /* active, have sent syn */ +#define TCPS_SYN_RECEIVED 3 /* have send and received syn */ +/* states < TCPS_ESTABLISHED are those where connections not established */ +#define TCPS_ESTABLISHED 4 /* established */ +#define TCPS_CLOSE_WAIT 5 /* rcvd fin, waiting for close */ +/* states > TCPS_CLOSE_WAIT are those where user has closed */ +#define TCPS_FIN_WAIT_1 6 /* have closed, sent fin */ +#define TCPS_CLOSING 7 /* closed xchd FIN; await FIN ACK */ +#define TCPS_LAST_ACK 8 /* had fin and close; await FIN ACK */ +/* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */ +#define TCPS_FIN_WAIT_2 9 /* have closed, fin is acked */ +#define TCPS_TIME_WAIT 10 /* in 2*msl quiet wait after close */ + +#define TCPS_HAVERCVDSYN(s) ((s) >= TCPS_SYN_RECEIVED) +#define TCPS_HAVEESTABLISHED(s) ((s) >= TCPS_ESTABLISHED) +#define TCPS_HAVERCVDFIN(s) ((s) > TCPS_ESTABLISHED && \ + (s) != TCPS_FIN_WAIT_1 && \ + (s) != TCPS_FIN_WAIT_2) + +#ifdef TCPOUTFLAGS +/* + * Flags used when sending segments in tcp_output. + * Basic flags (TH_RST,TH_ACK,TH_SYN,TH_FIN) are totally + * determined by state, with the proviso that TH_FIN is sent only + * if all data queued for output is included in the segment. + */ +u_char tcp_outflags[TCP_NSTATES] = { + TH_RST|TH_ACK, 0, TH_SYN, TH_SYN|TH_ACK, + TH_ACK, TH_ACK, + TH_FIN|TH_ACK, TH_FIN|TH_ACK, TH_FIN|TH_ACK, TH_ACK, TH_ACK, +}; +#endif + +#ifdef KPROF +int tcp_acounts[TCP_NSTATES][PRU_NREQ]; +#endif + +extern char ** pTcpstates; +#ifdef __cplusplus +} +#endif + +#endif /* __INCtcp_fsmh */ diff --git a/h/netinet/tcp_seq.h b/h/netinet/tcp_seq.h new file mode 100644 index 0000000..7e06bde --- /dev/null +++ b/h/netinet/tcp_seq.h @@ -0,0 +1,88 @@ +/* tcp_seq.h - tcp sequence header file */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp_seq.h 8.3 (Berkeley) 6/21/95 + */ + +/* +modification history +-------------------- +01c,30mar01,spm merged changes from version 01c of tor2_0.open_stack + branch (wpwr VOB, base 01b) for unified code base +01b,08jul97,vin changed TCP_ISSINCR to a default value as in FreeBSD-2.2.1 +01a,03mar96,vin created from BSD4.4 stuff. +*/ + +#ifndef __INCtcp_seqh +#define __INCtcp_seqh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * TCP sequence numbers are 32 bit integers operated + * on with modular arithmetic. These macros can be + * used to compare such integers. + */ +#define SEQ_LT(a,b) ((int)((a)-(b)) < 0) +#define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0) +#define SEQ_GT(a,b) ((int)((a)-(b)) > 0) +#define SEQ_GEQ(a,b) ((int)((a)-(b)) >= 0) + +/* + * Macros to initialize tcp sequence numbers for + * send and receive from initial send and receive + * sequence numbers. + */ +#define tcp_rcvseqinit(tp) \ + (tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1 + +#define tcp_sendseqinit(tp) \ + (tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \ + (tp)->iss + +#define TCP_ISSINCR (250*1024) /* increment for tcp_iss each second */ + +#ifndef VIRTUAL_STACK +IMPORT tcp_seq tcp_iss; /* tcp initial send seq # */ +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtcp_seqh */ diff --git a/h/netinet/tcp_timer.h b/h/netinet/tcp_timer.h new file mode 100644 index 0000000..338f9a9 --- /dev/null +++ b/h/netinet/tcp_timer.h @@ -0,0 +1,155 @@ +/* tcp_timer.h - tcp timer header file */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp_timer.h 8.1 (Berkeley) 6/10/93 + */ + +/* +modification history +-------------------- +01b,30mar01,spm merged changes from version 01b of tor2_0.open_stack + branch (wpwr VOB, base 01a) for unified code base +01a,03mar96,vin created from BSD4.4 stuff. +*/ + +#ifndef __INCtcp_timerh +#define __INCtcp_timerh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Definitions of the TCP timers. These timers are counted + * down PR_SLOWHZ times a second. + */ +#define TCPT_NTIMERS 4 + +#define TCPT_REXMT 0 /* retransmit */ +#define TCPT_PERSIST 1 /* retransmit persistance */ +#define TCPT_KEEP 2 /* keep alive */ +#define TCPT_2MSL 3 /* 2*msl quiet time timer */ + +/* + * The TCPT_REXMT timer is used to force retransmissions. + * The TCP has the TCPT_REXMT timer set whenever segments + * have been sent for which ACKs are expected but not yet + * received. If an ACK is received which advances tp->snd_una, + * then the retransmit timer is cleared (if there are no more + * outstanding segments) or reset to the base value (if there + * are more ACKs expected). Whenever the retransmit timer goes off, + * we retransmit one unacknowledged segment, and do a backoff + * on the retransmit timer. + * + * The TCPT_PERSIST timer is used to keep window size information + * flowing even if the window goes shut. If all previous transmissions + * have been acknowledged (so that there are no retransmissions in progress), + * and the window is too small to bother sending anything, then we start + * the TCPT_PERSIST timer. When it expires, if the window is nonzero, + * we go to transmit state. Otherwise, at intervals send a single byte + * into the peer's window to force him to update our window information. + * We do this at most as often as TCPT_PERSMIN time intervals, + * but no more frequently than the current estimate of round-trip + * packet time. The TCPT_PERSIST timer is cleared whenever we receive + * a window update from the peer. + * + * The TCPT_KEEP timer is used to keep connections alive. If an + * connection is idle (no segments received) for TCPTV_KEEP_INIT amount of time, + * but not yet established, then we drop the connection. Once the connection + * is established, if the connection is idle for TCPTV_KEEP_IDLE time + * (and keepalives have been enabled on the socket), we begin to probe + * the connection. We force the peer to send us a segment by sending: + * + * This segment is (deliberately) outside the window, and should elicit + * an ack segment in response from the peer. If, despite the TCPT_KEEP + * initiated segments we cannot elicit a response from a peer in TCPT_MAXIDLE + * amount of time probing, then we drop the connection. + */ + +#define TCP_TTL 30 /* default time to live for TCP segs */ + +/* + * Time constants. + */ +#define TCPTV_MSL ( 30*PR_SLOWHZ) /* max seg lifetime (hah!) */ +#define TCPTV_SRTTBASE 0 /* base roundtrip time; + if 0, no idea yet */ +#define TCPTV_SRTTDFLT ( 3*PR_SLOWHZ) /* assumed RTT if no info */ + +#define TCPTV_PERSMIN ( 5*PR_SLOWHZ) /* retransmit persistance */ +#define TCPTV_PERSMAX ( 60*PR_SLOWHZ) /* maximum persist interval */ + +#define TCPTV_KEEP_INIT ( 75*PR_SLOWHZ) /* initial connect keep alive */ +#define TCPTV_KEEP_IDLE (120*60*PR_SLOWHZ) /* dflt time before probing */ +#define TCPTV_KEEPINTVL ( 75*PR_SLOWHZ) /* default probe interval */ +#define TCPTV_KEEPCNT 8 /* max probes before drop */ + +#define TCPTV_MIN ( 1*PR_SLOWHZ) /* minimum allowable value */ +#define TCPTV_REXMTMAX ( 64*PR_SLOWHZ) /* max allowable REXMT value */ + +#define TCP_LINGERTIME 120 /* linger at most 2 minutes */ + +#define TCP_MAXRXTSHIFT 12 /* maximum retransmits */ + +#ifdef TCPTIMERS +char *tcptimers[] = + { "REXMT", "PERSIST", "KEEP", "2MSL" }; +#endif + +/* + * Force a time value to be in a certain range. + */ +#define TCPT_RANGESET(tv, value, tvmin, tvmax) { \ + (tv) = (value); \ + if ((tv) < (tvmin)) \ + (tv) = (tvmin); \ + else if ((tv) > (tvmax)) \ + (tv) = (tvmax); \ +} + +#ifndef VIRTUAL_STACK +extern int tcp_keepidle; /* time before keepalive probes begin */ +extern int tcp_keepintvl; /* time between keepalive probes */ +extern int tcp_maxidle; /* time to drop after starting probes */ +#endif + +extern int tcp_backoff[]; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtcp_timerh */ diff --git a/h/netinet/tcp_var.h b/h/netinet/tcp_var.h new file mode 100644 index 0000000..485de65 --- /dev/null +++ b/h/netinet/tcp_var.h @@ -0,0 +1,319 @@ +/* tcp_var.h - tcp variables header file */ + +/* Copyright 1984 - 2002 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993, 1994, 1995 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp_var.h 8.4 (Berkeley) 5/24/95 + */ + +/* +modification history +-------------------- +01g,05jun02,vvv replaced TF_PREV_SMALL with TF_EOB (SPR #72213) +01f,06mar02,vvv added new flag TF_PREV_SMALL (SPR #72213) +01e,10oct01,rae merge from truestack ver 01f, base 01c +01d,10nov00,spm merged from version 01d of tor3_x branch (SPR #31996 fix) +01c,31mar97,vin added changes for pcb hashlookups. +01b,30oct96,vin changed tcp_template to mbuf from tcp_iphdr so that dtom + wont be necessary. +01a,03mar96,vin created from BSD4.4 stuff, integrated with 02p of tcp_var.h +*/ + +#ifndef __INCtcp_varh +#define __INCtcp_varh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "netinet/tcp_timer.h" +#include "netinet/ip.h" + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* Tcp control block, one per tcp; fields: */ + +struct tcpcb + { + struct tcpiphdr *seg_next; /* sequencing queue */ + struct tcpiphdr *seg_prev; + short t_state; /* state of this connection */ + short t_timer[TCPT_NTIMERS]; /* tcp timers */ + short t_rxtshift; /* log(2) of rexmt exp. backoff */ + short t_rxtcur; /* current retransmit value */ + short t_dupacks; /* consecutive dup acks recd */ + u_short t_maxseg; /* maximum segment size */ + char t_force; /* 1 if forcing out a byte */ + u_short t_flags; +#define TF_ACKNOW 0x0001 /* ack peer immediately */ +#define TF_DELACK 0x0002 /* ack, but try to delay it */ +#define TF_NODELAY 0x0004 /* don't delay packets to coalesce */ +#define TF_NOOPT 0x0008 /* don't use tcp options */ +#define TF_SENTFIN 0x0010 /* have sent FIN */ +#define TF_REQ_SCALE 0x0020 /* have/will request window scaling */ +#define TF_RCVD_SCALE 0x0040 /* other side has requested scaling */ +#define TF_REQ_TSTMP 0x0080 /* have/will request timestamps */ +#define TF_RCVD_TSTMP 0x0100 /* a timestamp was received in SYN */ +#define TF_SACK_PERMIT 0x0200 /* other side said I could SACK */ +#define TF_EOB 0x0400 /* for Nagle's - last chunk of */ + /* a large data block? */ + struct mbuf * t_template; /* skeletal packet for transmit */ + struct inpcb *t_inpcb; /* back pointer to internet pcb */ +/* + * The following fields are used as in the protocol specification. + * See RFC783, Dec. 1981, page 21. + */ +/* send sequence variables */ + tcp_seq snd_una; /* send unacknowledged */ + tcp_seq snd_nxt; /* send next */ + tcp_seq snd_up; /* send urgent pointer */ + tcp_seq snd_wl1; /* window update seg seq number */ + tcp_seq snd_wl2; /* window update seg ack number */ + tcp_seq iss; /* initial send sequence number */ + u_long snd_wnd; /* send window */ +/* receive sequence variables */ + u_long rcv_wnd; /* receive window */ + tcp_seq rcv_nxt; /* receive next */ + tcp_seq rcv_up; /* receive urgent pointer */ + tcp_seq irs; /* initial receive sequence number */ +/* + * Additional variables for this implementation. + */ +/* receive variables */ + tcp_seq rcv_adv; /* advertised window */ +/* retransmit variables */ + tcp_seq snd_max; /* highest sequence number sent; + * used to recognize retransmits + */ +/* congestion control (for slow start, source quench, retransmit after loss) */ + u_long snd_cwnd; /* congestion-controlled window */ + u_long snd_ssthresh; /* snd_cwnd size threshhold for + * for slow start exponential to + * linear switch + */ +/* + * transmit timing stuff. See below for scale of srtt and rttvar. + * "Variance" is actually smoothed difference. + */ + u_short t_idle; /* inactivity time */ + short t_rtt; /* round trip time */ + tcp_seq t_rtseq; /* sequence number being timed */ + short t_srtt; /* smoothed round-trip time */ + short t_rttvar; /* variance in round-trip time */ + u_short t_rttmin; /* minimum rtt allowed */ + u_long max_sndwnd; /* largest window peer has offered */ + +/* out-of-band data */ + char t_oobflags; /* have some */ + char t_iobc; /* input character */ +#define TCPOOB_HAVEDATA 0x01 +#define TCPOOB_HADDATA 0x02 + short t_softerror; /* possible error not yet reported */ + +/* RFC 1323 variables */ + u_char snd_scale; /* window scaling for send window */ + u_char rcv_scale; /* window scaling for recv window */ + u_char request_r_scale; /* pending window scaling */ + u_char requested_s_scale; + u_long ts_recent; /* timestamp echo data */ + u_long ts_recent_age; /* when last updated */ + tcp_seq last_ack_sent; + +/* Path MTU values */ + u_int t_maxsize; /* max segment, ignoring send buffer */ +}; + +#define intotcpcb(ip) ((struct tcpcb *)(ip)->inp_ppcb) +#define sototcpcb(so) (intotcpcb(sotoinpcb(so))) + +/* + * The smoothed round-trip time and estimated variance + * are stored as fixed point numbers scaled by the values below. + * For convenience, these scales are also used in smoothing the average + * (smoothed = (1/scale)sample + ((scale-1)/scale)smoothed). + * With these scales, srtt has 3 bits to the right of the binary point, + * and thus an "ALPHA" of 0.875. rttvar has 2 bits to the right of the + * binary point, and is smoothed with an ALPHA of 0.75. + */ +#define TCP_RTT_SCALE 8 /* multiplier for srtt; 3 bits frac. */ +#define TCP_RTT_SHIFT 3 /* shift for srtt; 3 bits frac. */ +#define TCP_RTTVAR_SCALE 4 /* multiplier for rttvar; 2 bits */ +#define TCP_RTTVAR_SHIFT 2 /* multiplier for rttvar; 2 bits */ + +/* + * The initial retransmission should happen at rtt + 4 * rttvar. + * Because of the way we do the smoothing, srtt and rttvar + * will each average +1/2 tick of bias. When we compute + * the retransmit timer, we want 1/2 tick of rounding and + * 1 extra tick because of +-1/2 tick uncertainty in the + * firing of the timer. The bias will give us exactly the + * 1.5 tick we need. But, because the bias is + * statistical, we have to test that we don't drop below + * the minimum feasible timer (which is 2 ticks). + * This macro assumes that the value of TCP_RTTVAR_SCALE + * is the same as the multiplier for rttvar. + */ +#define TCP_REXMTVAL(tp) \ + (((tp)->t_srtt >> TCP_RTT_SHIFT) + (tp)->t_rttvar) + +/* XXX + * We want to avoid doing m_pullup on incoming packets but that + * means avoiding dtom on the tcp reassembly code. That in turn means + * keeping an mbuf pointer in the reassembly queue (since we might + * have a cluster). As a quick hack, the source & destination + * port numbers (which are no longer needed once we've located the + * tcpcb) are overlayed with an mbuf pointer. + */ +#define REASS_MBUF(ti) (*(struct mbuf **)&((ti)->ti_t)) + +/* + * TCP statistics. + * Many of these should be kept per connection, + * but that's inconvenient at the moment. + */ +struct tcpstat { + u_long tcps_connattempt; /* connections initiated */ + u_long tcps_accepts; /* connections accepted */ + u_long tcps_connects; /* connections established */ + u_long tcps_drops; /* connections dropped */ + u_long tcps_conndrops; /* embryonic connections dropped */ + u_long tcps_closed; /* conn. closed (includes drops) */ + u_long tcps_segstimed; /* segs where we tried to get rtt */ + u_long tcps_rttupdated; /* times we succeeded */ + u_long tcps_delack; /* delayed acks sent */ + u_long tcps_timeoutdrop; /* conn. dropped in rxmt timeout */ + u_long tcps_rexmttimeo; /* retransmit timeouts */ + u_long tcps_persisttimeo; /* persist timeouts */ + u_long tcps_keeptimeo; /* keepalive timeouts */ + u_long tcps_keepprobe; /* keepalive probes sent */ + u_long tcps_keepdrops; /* connections dropped in keepalive */ + + u_long tcps_sndtotal; /* total packets sent */ + u_long tcps_sndpack; /* data packets sent */ + u_long tcps_sndbyte; /* data bytes sent */ + u_long tcps_sndrexmitpack; /* data packets retransmitted */ + u_long tcps_sndrexmitbyte; /* data bytes retransmitted */ + u_long tcps_sndacks; /* ack-only packets sent */ + u_long tcps_sndprobe; /* window probes sent */ + u_long tcps_sndurg; /* packets sent with URG only */ + u_long tcps_sndwinup; /* window update-only packets sent */ + u_long tcps_sndctrl; /* control (SYN|FIN|RST) packets sent */ + + u_long tcps_rcvtotal; /* total packets received */ + u_long tcps_rcvpack; /* packets received in sequence */ + u_long tcps_rcvbyte; /* bytes received in sequence */ + u_long tcps_rcvbadsum; /* packets received with ccksum errs */ + u_long tcps_rcvbadoff; /* packets received with bad offset */ + u_long tcps_rcvshort; /* packets received too short */ + u_long tcps_rcvduppack; /* duplicate-only packets received */ + u_long tcps_rcvdupbyte; /* duplicate-only bytes received */ + u_long tcps_rcvpartduppack; /* packets with some duplicate data */ + u_long tcps_rcvpartdupbyte; /* dup. bytes in part-dup. packets */ + u_long tcps_rcvoopack; /* out-of-order packets received */ + u_long tcps_rcvoobyte; /* out-of-order bytes received */ + u_long tcps_rcvpackafterwin; /* packets with data after window */ + u_long tcps_rcvbyteafterwin; /* bytes rcvd after window */ + u_long tcps_rcvafterclose; /* packets rcvd after "close" */ + u_long tcps_rcvwinprobe; /* rcvd window probe packets */ + u_long tcps_rcvdupack; /* rcvd duplicate acks */ + u_long tcps_rcvacktoomuch; /* rcvd acks for unsent data */ + u_long tcps_rcvackpack; /* rcvd ack packets */ + u_long tcps_rcvackbyte; /* bytes acked by rcvd acks */ + u_long tcps_rcvwinupd; /* rcvd window update packets */ + u_long tcps_pawsdrop; /* segments dropped due to PAWS */ + u_long tcps_predack; /* times hdr predict ok for acks */ + u_long tcps_preddat; /* times hdr predict ok for data pkts */ + u_long tcps_pcbcachemiss; + u_long tcps_persistdrop; /* timeout in persist state */ + u_long tcps_badsyn; /* bogus SYN, e.g. premature ACK */ +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifndef VIRTUAL_STACK +#define tcb tcpcb /* resolve the conflit tcb */ + +extern long tcpOutRsts; /* MIB-II Variable */ +extern struct inpcbhead tcb; /* head of queue of active tcpcb's */ +extern struct inpcbinfo tcbinfo; +IMPORT struct tcpstat tcpstat; /* tcp statistics */ +extern u_long tcp_now; /* for RFC 1323 timestamps */ +#endif + +extern int tcp_attach (struct socket *); +extern void tcp_canceltimers (struct tcpcb *); +extern struct tcpcb * tcp_close (struct tcpcb *); +extern void tcp_ctlinput (int, struct sockaddr *, struct ip *); +extern int tcp_ctloutput (int, struct socket *, int, int, struct mbuf **); +extern struct tcpcb * tcp_disconnect (struct tcpcb *); +extern struct tcpcb * tcp_drop (struct tcpcb *, int); +extern void tcp_dooptions (struct tcpcb *, u_char *, int, struct tcpiphdr *, + int *, u_long *, u_long *); +extern void tcp_drain (void); +extern void tcp_fasttimo (void); +extern void tcp_init (void); +extern void tcp_input (struct mbuf *, int); +extern int tcp_mss (struct tcpcb *, u_int); +extern struct tcpcb * tcp_newtcpcb (struct inpcb *); +extern void tcp_notify (struct inpcb *, int); +extern int tcp_output (struct tcpcb *); +extern void tcp_pulloutofband (struct socket *, struct tcpiphdr *, + struct mbuf *); +extern void tcp_quench (struct inpcb *, int); +extern void tcp_updatemtu (struct inpcb *, int); +extern int tcp_reass (struct tcpcb *, struct tcpiphdr *, struct mbuf *); +extern void tcp_respond (struct tcpcb *, struct tcpiphdr *, struct mbuf *, + u_long, u_long, int); +extern void tcp_setpersist (struct tcpcb *); +extern void tcp_slowtimo (void); +extern int tcpRandHookAdd(FUNCPTR pTcpRandFunc); +extern void tcpRandHookDelete(void); +extern struct mbuf * tcp_template (struct tcpcb *); +extern struct tcpcb * tcp_timers (struct tcpcb *, int); +extern struct tcpcb * tcp_usrclosed (struct tcpcb *); +extern int tcp_usrreq (struct socket *, int, struct mbuf *, struct mbuf *, + struct mbuf *); +extern void tcp_xmit_timer (struct tcpcb *, int); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtcp_varh */ diff --git a/h/netinet/tcpip.h b/h/netinet/tcpip.h new file mode 100644 index 0000000..7ee60e8 --- /dev/null +++ b/h/netinet/tcpip.h @@ -0,0 +1,91 @@ +/* tcpip.h - tcp+ip header file */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcpip.h 8.1 (Berkeley) 6/10/93 + */ + +/* +modification history +-------------------- +01a,03mar96,vin created from BSD4.4 stuff,integrated with 02g of tcpip.h. +*/ + +#ifndef __INCtcpiph +#define __INCtcpiph + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Tcp+ip header, after ip options removed. + */ +struct tcpiphdr { + struct ipovly ti_i; /* overlaid ip structure */ + struct tcphdr ti_t; /* tcp header */ +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#define ti_next ti_i.ih_next +#define ti_prev ti_i.ih_prev +#define ti_x1 ti_i.ih_x1 +#define ti_pr ti_i.ih_pr +#define ti_len ti_i.ih_len +#define ti_src ti_i.ih_src +#define ti_dst ti_i.ih_dst +#define ti_sport ti_t.th_sport +#define ti_dport ti_t.th_dport +#define ti_seq ti_t.th_seq +#define ti_ack ti_t.th_ack +#define ti_x2 ti_t.th_x2 +#define ti_off ti_t.th_off +#define ti_flags ti_t.th_flags +#define ti_win ti_t.th_win +#define ti_sum ti_t.th_sum +#define ti_urp ti_t.th_urp + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtcpiph */ diff --git a/h/netinet/udp.h b/h/netinet/udp.h new file mode 100644 index 0000000..0a4c33f --- /dev/null +++ b/h/netinet/udp.h @@ -0,0 +1,76 @@ +/* udp.h - udp protocol header file */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)udp.h 8.1 (Berkeley) 6/10/93 + */ + +/* +modification history +-------------------- +01a,03mar96,vin created from BSD4.4 stuff,integrated with 02g. +*/ + +#ifndef __INCudph +#define __INCudph + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Udp protocol header. + * Per RFC 768, September, 1981. + */ +struct udphdr { + u_short uh_sport; /* source port */ + u_short uh_dport; /* destination port */ + short uh_ulen; /* udp length */ + u_short uh_sum; /* udp checksum */ +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCudph */ diff --git a/h/netinet/udp_var.h b/h/netinet/udp_var.h new file mode 100644 index 0000000..5339ba4 --- /dev/null +++ b/h/netinet/udp_var.h @@ -0,0 +1,126 @@ +/* udp_var.h - UDP kernel structure and variable header file */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)udp_var.h 8.1 (Berkeley) 6/10/93 + */ + +/* +modification history +-------------------- +01a,03mar96,vin created from BSD4.4 stuff,integrated with 02j. +*/ + +#ifndef __INCudp_varh +#define __INCudp_varh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include "net/mbuf.h" +#include "netinet/in_pcb.h" + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* UDP kernel structures and variables. */ + +struct udpiphdr + { + struct ipovly ui_i; /* overlaid ip structure */ + struct udphdr ui_u; /* udp header */ + }; +#define ui_next ui_i.ih_next +#define ui_prev ui_i.ih_prev +#define ui_x1 ui_i.ih_x1 +#define ui_pr ui_i.ih_pr +#define ui_len ui_i.ih_len +#define ui_src ui_i.ih_src +#define ui_dst ui_i.ih_dst +#define ui_sport ui_u.uh_sport +#define ui_dport ui_u.uh_dport +#define ui_ulen ui_u.uh_ulen +#define ui_sum ui_u.uh_sum + +struct udpstat { + /* input statistics: */ + u_long udps_ipackets; /* total input packets */ + u_long udps_hdrops; /* packet shorter than header */ + u_long udps_badsum; /* checksum error */ + u_long udps_badlen; /* data length larger than packet */ + u_long udps_noport; /* no socket on port */ + u_long udps_noportbcast; /* of above, arrived as broadcast */ + u_long udps_fullsock; /* not delivered, input socket full */ + u_long udpps_pcbcachemiss; /* input packets missing pcb cache */ + u_long udpps_pcbhashmiss; /* input packets not for hashed pcb */ + /* output statistics: */ + u_long udps_opackets; /* total output packets */ +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +extern long udpNoPorts; /* MIB-II support. Counts # of packstes drop */ + +#define UDP_TTL 30 /* default time to live for UDP packets */ + +/* + * Names for UDP sysctl objects + */ +#define UDPCTL_CHECKSUM 1 /* checksum UDP packets */ +#define UDPCTL_MAXID 2 + +#define UDPCTL_NAMES { \ + { 0, 0 }, \ + { "checksum", CTLTYPE_INT }, \ + +void udp_ctlinput (int, struct sockaddr *, struct ip *); +void udp_init (void); +void udp_input (struct mbuf *, int); +int udp_output (struct inpcb *, + struct mbuf *, struct mbuf *, struct mbuf *); +int udp_sysctl (int *, u_int, void *, size_t *, void *, size_t); +int udp_usrreq (struct socket *, + int, struct mbuf *, struct mbuf *, struct mbuf *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCudp_varh */ diff --git a/h/nfsDrv.h b/h/nfsDrv.h new file mode 100644 index 0000000..3610536 --- /dev/null +++ b/h/nfsDrv.h @@ -0,0 +1,43 @@ +/* nfsDrv.h - nfsDrv header */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01r,29jun04,dlk Make this obsolete file include nfsDriver.h; remove + other contents +01q,05nov01,vvv made max. path length configurable (SPR #63551) +01p,10oct01,rae merge from truestack ver 01o base 01n (added xdr_nfs.h) +01o,07feb01,spm merged from version 01o of tor3_x branch (base version 01n): + added permission checks to nfsOpen() routine +01n,16dec98,cjtc added prototype for nfsDrvNumGet +01m,28mar95,kdl added includes of limits.h and hostLib.h (SPR 4157).. +01l,01dec93,jag added NFS_DEV_INFO, nfsDevListGet(), and nfsDevInfoGet(). +01k,22sep92,rrr added support for c++ +01j,04jul92,jcf cleaned up. +01i,26may92,rrr the tree shuffle +01h,04oct91,rrr passed through the ansification filter + -changed VOID to void + -changed copyright notice +01g,05oct90,dnw changed nfsMountAll() arg from verbose to quiet. +01f,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01e,07aug90,shl added IMPORT type to function declarations. +01d,01may90,llk added function declarations. +01c,30sep88,llk removed S_nfsDrv_UNKNOWN_HOST. +01b,30jun88,llk added S_nfsDrv_NO_HOST_NAME_SPECIFIED. +01a,19apr88,llk written. +*/ + +#ifndef __INCnfsDrvh +#define __INCnfsDrvh + +#if 0 +#error nfsDrv.h is obsolete. Use nfsDriver.h. +#endif + +#include + +#endif /* __INCnfsDrvh */ diff --git a/h/nfsLib.h b/h/nfsLib.h new file mode 100644 index 0000000..f6f80c6 --- /dev/null +++ b/h/nfsLib.h @@ -0,0 +1,44 @@ +/* nfsLib.h - Network File System library header */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01r,29jun04,dlk Make this obsolete file include nfs2Lib.h and nfs3Lib.h; + remove other contents. +01q,20nov97,gnn fix for spr#5436, need to support FIOFSTATFSGET +01p,28jul93,jmm moved AUTH_UNIX_FIELD_LEN and MAX_GRPS definitions to here +01o,22sep92,rrr added support for c++ +01n,18sep92,jcf removed ansi warnings. +01m,07sep92,smb added includes xdr_nfs.h and sys/stat.h to remove ANSI warnings +01l,04jul92,jcf cleaned up. +01k,26may92,rrr the tree shuffle +01j,16dec91,gae added missing prototypes for ANSI. +01i,04oct91,rrr passed through the ansification filter + -changed VOID to void + -changed copyright notice +01h,08mar91,elh added NFS_REXMIT_{SEC,USEC}. +01g,25oct90,dnw deleted private function. +01f,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01e,10aug90,dnw added declarations of nfsAuthUnix[GS]et(). +01d,09sep88,llk added NFS_TIMEOUT_SEC, NFS_TIMEOUT_USEC, NFS_SOCKOPTVAL. +01c,26aug88,gae removed unused imports. +01b,04jun88,llk moved FOLLOW_LINK, DEFAULT_FILE_PERM and DEFAULT_DIR_PERM + to ioLib.h. +01a,19apr88,llk written. +*/ + +#ifndef __INCnfsLibh +#define __INCnfsLibh + +#if 0 +#error nfsLib.h is obsolete. Use nfs2Lib.h and/or nfs3Lib.h. +#endif + +#include /* brings in nfsCommon.h */ +#include + +#endif /* __INCnfsLibh */ diff --git a/h/nfsdLib.h b/h/nfsdLib.h new file mode 100644 index 0000000..5c16f11 --- /dev/null +++ b/h/nfsdLib.h @@ -0,0 +1,25 @@ +/* nfsdLib.h - Network File System Server library header */ + +/* Copyright 1994-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,01jul04,dlk Make this header include nfsdCommon.h and nfsd.h; + remove other contents. +01c,21apr94,jmm more cleanup of prototypes; added NFSD_ARGUMENT +01b,20apr94,jmm added new prototypes +01a,31mar94,jmm written. +*/ + +#ifndef __INCnfsdLibh +#define __INCnfsdLibh + +#if 0 +#error nfsdLib.h is obsolete. Use nfsdCommon.h and/or nfsd.h. +#endif + +#include +#include + +#endif /* __INCnfsdLibh */ diff --git a/h/nmpipe.h b/h/nmpipe.h new file mode 100644 index 0000000..fa7ccad --- /dev/null +++ b/h/nmpipe.h @@ -0,0 +1,36 @@ +/* NmPipe.h - Named pipe routines */ + +/* Copyright 1984-1997 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,24oct97, pdn written +*/ + +#ifndef __INCNmPipeh +#define __INCNmPipeh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define DEF_PIPE_NAME "\\\\.\\pipe\\simnt" /* Default pipe name */ +#define OVERLAPPED_IO TRUE +#define PIPE_BUF_SIZE 1048576 /* 1 MByte */ + +/* function declarations */ + +HANDLE pipeCreate (void); +HANDLE pipeConnect (void); +int pipeWrite (HANDLE hPipe, char *pBuf, int nByte, int nTimeOut); +int pipeRead (HANDLE hPipe, char *pBuf, int nByte, int nTimeOut); +BOOL pipeCheck (HANDLE hPipe); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCNmPipeh */ diff --git a/h/ntPassFsLib.h b/h/ntPassFsLib.h new file mode 100644 index 0000000..e23c8eb --- /dev/null +++ b/h/ntPassFsLib.h @@ -0,0 +1,105 @@ +/* ntPassFsLib.h - pass-through file system library header */ + +/* Copyright 1984-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,07dec99,pai moved HOST_BINARY to ntPassFsLib.h. +01b,07dec99,pai fixed SPR 27918 by adding ARCHCVTFLAGS macro and + Win32 file control flag values to ntPassFsLib.h. +01a,03oct97,cym written from passFsLib.h. +*/ + + +#ifndef __INCntPassFsLibh +#define __INCntPassFsLibh + + +#ifdef __cplusplus +extern "C" { +#endif + + +#if CPU==SIMNT + +/* Win32 API file control options used by open() and creat() */ + +#define L_RDONLY 0 +#define L_WRONLY 1 +#define L_RDWR 2 +#define L_ACCMODE (L_RDONLY | L_WRONLY | L_RDWR) +#define L_APPEND 0x0008 +#define L_CREAT 0x0100 +#define L_TRUNC 0x0200 +#define L_EXCL 0x0400 + +/* + * L_BINARY should match the O_BINARY value in fcntl.h from the toolchain + * headers (in the host tree.) For cygwin b19, it should be 0x10000. For + * mingw32 the value should be 0x8000. + */ +#define L_BINARY 0x8000 +#define HOST_BINARY L_BINARY + + +/******************************************************************************* +* +* ARCHCVTFLAGS - map Win32 file flags to VxWorks file flags +* +* This macro tests the file mode flags passed in token and, if necessary, +* converts the VxWorks flag to the corresponding Win32 flag. +* +* CAVEATS +* This macro is intended for ntPassFsLib internal use only. +* +* INTERNAL +* If a particular bit position is not tested in the macro, then it is +* effectively filtered out of the resulting value. +* +* VxWorks and Win32 currently all use the same values for most of the file +* mode flags passed to open() and creat(). However, some Win32 file flags +* have different values than those used in the VxWorks API. Local versions +* of the Win32 modes are used to map VxWorks file mode flags to Win32 file +* mode flags. This macro and method is identical to what has been done with +* the HP and Sun simulators in simLib.h. The macro names are conditionally +* compiled by testing CPU==SIMNT just in case this code is combined with +* definitions in simLib.h. +* +* RETURNS: A flags value converted to something Win32 understands. +*/ +#define ARCHCVTFLAGS(x) \ + ( \ + ((x) & O_RDONLY ? L_RDONLY : 0) | \ + ((x) & O_WRONLY ? L_WRONLY : 0) | \ + ((x) & O_RDWR ? L_RDWR : 0) | \ + /* L_ACCMODE : already tested above */ \ + ((x) & O_APPEND ? L_APPEND : 0) | \ + ((x) & O_CREAT ? L_CREAT : 0) | \ + ((x) & O_TRUNC ? L_TRUNC : 0) | \ + ((x) & O_EXCL ? L_EXCL : 0) | \ + ((x) & HOST_BINARY ? L_BINARY : 0) \ + ) + +#endif /* CPU==SIMNT */ + + +/* Function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void *ntPassFsDevInit (char *devName); +extern STATUS ntPassFsInit (int nPassfs); + +#else /* __STDC__ */ + +extern void *ntPassFsDevInit (); +extern STATUS ntPassFsInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCntPassFsLibh */ diff --git a/h/objLib.h b/h/objLib.h new file mode 100644 index 0000000..d6b5c71 --- /dev/null +++ b/h/objLib.h @@ -0,0 +1,83 @@ +/* objLib.h - object management library header */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01z,26jan05,kk remove OBJ_DETECT_NAME_CLASH references (SPR# 105824) + added missing public APIs, removed objNameShow APIs. +01y,14sep04,lei moved back objOwnerGet() prototype from objLibP.h +01x,28apr04,dcc added objContextGet() and objContextSet() prototypes. +01w,26mar04,dcc updated objNameToId() API. moved objOwnerGet(), objOwnerSet(), + and objNameSet() protoypes to objLibP.h +01v,31oct03,dat adding const to objNameSet name argument. +01u,29oct03,dat objNameToId uses a const char * +01t,12sep03,aeg added include of objLibCommon.h +01s,21aug03,dcc updated objNameToId() signature. Added open flags. +01r,14mar03,dcc ported from AE1.1 +01q,20jun96,kkk undid 01p change. +01p,09feb96,mem test for NULL pointer in OBJ_VERIFY. +01o,31aug94,rdc beefed up OBJ_VERIFY. +01n,15oct93,cd added #ifndef _ASMLANGUAGE. +01m,10dec93,smb modified OBJ_VERIFY for windview level 1 instrumentation +01l,22sep92,rrr added support for c++ +01k,29jul92,jcf added errno.h include. +01j,04jul92,jcf cleaned up. +01i,26may92,rrr the tree shuffle +01h,04dec91,rrr some ansi cleanup. +01g,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01f,10jun91.del added pragma for gnu960 alignment. +01e,05apr91,gae added NOMANUAL to avoid fooling mangen. +01d,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01c,15jul90,dnw changed objAlloc() from (char*) to (void*) + added objAllocExtra() +01b,26jun90,jcf added objAlloc()/objFree(). + added standard object status codes. +01a,10dec89,jcf written. +*/ + +#ifndef __INCobjLibh +#define __INCobjLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "objLibCommon.h" /* errnos for objLib located here */ +#include "errno.h" + +#ifndef _ASMLANGUAGE + +/* Note that OBJ_ID is declared in types/vxWind.h */ + +/* function declarations */ + +extern enum windObjClassType objClassTypeGet (OBJ_ID objId); + +extern STATUS objContextGet (OBJ_ID objId, void ** pContext); +extern STATUS objContextSet (OBJ_ID objId, void * context); +extern STATUS objHandleShow (OBJ_HANDLE objHandle, RTP_ID rtpId); +extern void objHandleTblShow(RTP_ID rtpId, int disp); +extern STATUS objNameGet (OBJ_ID objId, char *nameBuf, int bufSize); +extern int objNameLenGet (OBJ_ID objId); +extern OBJ_ID objNameToId (enum windObjClassType classType, + const char * name); +extern OBJ_ID objOwnerGet (OBJ_ID objId); +extern STATUS objOwnerSet (OBJ_ID objId, OBJ_ID ownerId); +extern STATUS objShow (OBJ_ID objId, int showType); +extern STATUS objShowAll (OBJ_ID objId, int showType); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCobjLibh */ diff --git a/h/objLibCommon.h b/h/objLibCommon.h new file mode 100644 index 0000000..25861b5 --- /dev/null +++ b/h/objLibCommon.h @@ -0,0 +1,57 @@ +/* objLibCommon.h - common object management definitions */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,16aug04,dcc added S_objLib_OBJ_LIB_NOT_INITIALIZED errno. +01d,05mar04,dcc added OM_DELETE_ON_LAST_CLOSE mode option and removed the + OM_RECLAIM_DISABLE option. +01c,02mar04,aeg changed OBJ_OBJECT_NOT_FOUND errno to OBJ_NOT_FOUND. +01b,01dec03,dcc added more errno codes. +01a,26aug03,cjj written based on kernel version 01s of objLib.h +*/ + +#ifndef __INCobjLibCommonh +#define __INCobjLibCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "vwModNum.h" + +/* Object creation mode options */ + +#define OM_CREATE 0x10000000 +#define OM_EXCL 0x20000000 +#define OM_DELETE_ON_LAST_CLOSE 0x40000000 + +/* Error Status codes */ + +#define S_objLib_OBJ_ID_ERROR (M_objLib | 1) +#define S_objLib_OBJ_UNAVAILABLE (M_objLib | 2) +#define S_objLib_OBJ_DELETED (M_objLib | 3) +#define S_objLib_OBJ_TIMEOUT (M_objLib | 4) +#define S_objLib_OBJ_NO_METHOD (M_objLib | 5) +#define S_objLib_OBJ_NO_ACCESS_RIGHTS (M_objLib | 6) +#define S_objLib_OBJ_NAME_TRUNCATED (M_objLib | 7) +#define S_objLib_OBJ_NAME_CLASH (M_objLib | 8) +#define S_objLib_OBJ_NOT_NAMED (M_objLib | 9) +#define S_objLib_OBJ_ILLEGAL_CLASS_TYPE (M_objLib | 10) +#define S_objLib_OBJ_OPERATION_UNSUPPORTED (M_objLib | 11) +#define S_objLib_OBJ_INVALID_OWNER (M_objLib | 12) +#define S_objLib_OBJ_RENAME_NOT_ALLOWED (M_objLib | 13) +#define S_objLib_OBJ_DESTROY_ERROR (M_objLib | 14) +#define S_objLib_OBJ_HANDLE_TBL_FULL (M_objLib | 15) +#define S_objLib_OBJ_NOT_FOUND (M_objLib | 16) +#define S_objLib_OBJ_INVALID_ARGUMENT (M_objLib | 17) +#define S_objLib_OBJ_LIB_NOT_INITIALIZED (M_objLib | 18) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCobjLibCommonh */ diff --git a/h/oemtypes.h b/h/oemtypes.h new file mode 100644 index 0000000..88f0417 --- /dev/null +++ b/h/oemtypes.h @@ -0,0 +1,47 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/vxworks/oemtypes.h,v 1.1.1.1 2001/11/05 17:47:17 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: oemtypes.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:17 tneale + * Tornado shuffle + * + * Revision 1.1 2000/01/27 18:25:29 josh + * initial checkin of porting files for vxWorks + * + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#include +#include + +/* The sun compiler doesn't understand the `signed' keyword */ + +#define __TYPES_HAVE_sbits8_t_ 1 +typedef char sbits8_t; /* signed 8 bits */ +#define __TYPES_HAVE_sbits16_t_ 1 +typedef short sbits16_t; /* signed 16 bits */ +#define __TYPES_HAVE_sbits32_t_ 1 +typedef long sbits32_t; /* signed 32 bits */ + diff --git a/h/opc_ae.h b/h/opc_ae.h new file mode 100644 index 0000000..70726e9 --- /dev/null +++ b/h/opc_ae.h @@ -0,0 +1,461 @@ +/* opc_ae.h generated by WIDL Version 2.2.1 on 06-Dec-01 at 11:53:57 AM */ + +#include "comBase.h" + +#ifndef __INCopc_ae_h +#define __INCopc_ae_h + + +#include "vxidl.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int include_opc_ae (void); + +#ifndef __IOPCEventServer_FWD_DEFINED__ +#define __IOPCEventServer_FWD_DEFINED__ +typedef interface IOPCEventServer IOPCEventServer; +#endif /* __IOPCEventServer_FWD_DEFINED__ */ + +#ifndef __IOPCEventSubscriptionMgt_FWD_DEFINED__ +#define __IOPCEventSubscriptionMgt_FWD_DEFINED__ +typedef interface IOPCEventSubscriptionMgt IOPCEventSubscriptionMgt; +#endif /* __IOPCEventSubscriptionMgt_FWD_DEFINED__ */ + +#ifndef __IOPCEventAreaBrowser_FWD_DEFINED__ +#define __IOPCEventAreaBrowser_FWD_DEFINED__ +typedef interface IOPCEventAreaBrowser IOPCEventAreaBrowser; +#endif /* __IOPCEventAreaBrowser_FWD_DEFINED__ */ + +#ifndef __IOPCEventSink_FWD_DEFINED__ +#define __IOPCEventSink_FWD_DEFINED__ +typedef interface IOPCEventSink IOPCEventSink; +#endif /* __IOPCEventSink_FWD_DEFINED__ */ + +typedef DWORD OPCHANDLE; + +enum OPCAE_BROWSE_DOWN +{ +OPCAE_BROWSE_UP = 1, +OPCAE_BROWSE_TO = 2, +}; + +typedef enum OPCAE_BROWSE_DOWN OPCAEBROWSEDIRECTION; + +enum OPC_SOURCE +{ +OPC_AREA = 1, +}; + +typedef enum OPC_SOURCE OPCAEBROWSETYPE; + +enum OPCAE_STATUS_FAILED +{ +OPCAE_STATUS_RUNNING = 1, +OPCAE_STATUS_NOCONFIG = 2, +OPCAE_STATUS_SUSPENDED = 3, +OPCAE_STATUS_TEST = 4, +}; + +typedef enum OPCAE_STATUS_FAILED OPCEVENTSERVERSTATE; + +struct tagONEVENTSTRUCT +{ +WORD wChangeMask; +WORD wNewState; +LPWSTR szSource; +FILETIME ftTime; +LPWSTR szMessage; +DWORD dwEventType; +DWORD dwEventCategory; +DWORD dwSeverity; +LPWSTR szConditionName; +LPWSTR szSubconditionName; +WORD wQuality; +WORD wReserved; +BOOL bAckRequired; +FILETIME ftActiveTime; +DWORD dwCookie; +DWORD dwNumEventAttrs; +VARIANT* pEventAttributes; +LPWSTR szActorID; +}; + +typedef struct tagONEVENTSTRUCT ONEVENTSTRUCT; + +struct tagOPCEVENTSERVERSTATUS +{ +FILETIME ftStartTime; +FILETIME ftCurrentTime; +FILETIME ftLastUpdateTime; +OPCEVENTSERVERSTATE dwServerState; +WORD wMajorVersion; +WORD wMinorVersion; +WORD wBuildNumber; +WORD wReserved; +LPWSTR szVendorInfo; +}; + +typedef struct tagOPCEVENTSERVERSTATUS OPCEVENTSERVERSTATUS; + +struct tagOPCCONDITIONSTATE +{ +WORD wState; +WORD wReserved1; +LPWSTR szActiveSubCondition; +LPWSTR szASCDefinition; +DWORD dwASCSeverity; +LPWSTR szASCDescription; +WORD wQuality; +WORD wReserved2; +FILETIME ftLastAckTime; +FILETIME ftSubCondLastActive; +FILETIME ftCondLastActive; +FILETIME ftCondLastInactive; +LPWSTR szAcknowledgerID; +LPWSTR szComment; +DWORD dwNumSCs; +LPWSTR* pszSCNames; +LPWSTR* pszSCDefinitions; +DWORD* pdwSCSeverities; +LPWSTR* pszSCDescriptions; +DWORD dwNumEventAttrs; +VARIANT* pEventAttributes; +HRESULT* pErrors; +}; + +typedef struct tagOPCCONDITIONSTATE OPCCONDITIONSTATE; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, GetStatus, (IOPCEventServer* pThis, OPCEVENTSERVERSTATUS** ppEventServerStatus)); + +#define IOPCEventServer_GetStatus(pThis, ppEventServerStatus) pThis->lpVtbl->GetStatus(COM_ADJUST_THIS(pThis), ppEventServerStatus) + + COM_VTBL_ENTRY (HRESULT, CreateEventSubscription, (IOPCEventServer* pThis, BOOL bActive, DWORD dwBufferTime, DWORD dwMaxSize, OPCHANDLE hClientSubscription, REFIID riid, LPUNKNOWN* ppUnk, DWORD* pdwRevisedBufferTime, DWORD* pdwRevisedMaxSize)); + +#define IOPCEventServer_CreateEventSubscription(pThis, bActive, dwBufferTime, dwMaxSize, hClientSubscription, riid, ppUnk, pdwRevisedBufferTime, pdwRevisedMaxSize) pThis->lpVtbl->CreateEventSubscription(COM_ADJUST_THIS(pThis), bActive, dwBufferTime, dwMaxSize, hClientSubscription, riid, ppUnk, pdwRevisedBufferTime, pdwRevisedMaxSize) + + COM_VTBL_ENTRY (HRESULT, QueryAvailableFilters, (IOPCEventServer* pThis, DWORD* pdwFilterMask)); + +#define IOPCEventServer_QueryAvailableFilters(pThis, pdwFilterMask) pThis->lpVtbl->QueryAvailableFilters(COM_ADJUST_THIS(pThis), pdwFilterMask) + + COM_VTBL_ENTRY (HRESULT, QueryEventCategories, (IOPCEventServer* pThis, DWORD dwEventType, DWORD* pdwCount, DWORD** ppdwEventCategories, LPWSTR** ppszEventCategoryDescs)); + +#define IOPCEventServer_QueryEventCategories(pThis, dwEventType, pdwCount, ppdwEventCategories, ppszEventCategoryDescs) pThis->lpVtbl->QueryEventCategories(COM_ADJUST_THIS(pThis), dwEventType, pdwCount, ppdwEventCategories, ppszEventCategoryDescs) + + COM_VTBL_ENTRY (HRESULT, QueryConditionNames, (IOPCEventServer* pThis, DWORD dwEventCategory, DWORD* pdwCount, LPWSTR** ppszConditionNames)); + +#define IOPCEventServer_QueryConditionNames(pThis, dwEventCategory, pdwCount, ppszConditionNames) pThis->lpVtbl->QueryConditionNames(COM_ADJUST_THIS(pThis), dwEventCategory, pdwCount, ppszConditionNames) + + COM_VTBL_ENTRY (HRESULT, QuerySubConditionNames, (IOPCEventServer* pThis, LPWSTR szConditionName, DWORD* pdwCount, LPWSTR** ppszSubConditionNames)); + +#define IOPCEventServer_QuerySubConditionNames(pThis, szConditionName, pdwCount, ppszSubConditionNames) pThis->lpVtbl->QuerySubConditionNames(COM_ADJUST_THIS(pThis), szConditionName, pdwCount, ppszSubConditionNames) + + COM_VTBL_ENTRY (HRESULT, QuerySourceConditions, (IOPCEventServer* pThis, LPWSTR szSource, DWORD* pdwCount, LPWSTR** ppszConditionNames)); + +#define IOPCEventServer_QuerySourceConditions(pThis, szSource, pdwCount, ppszConditionNames) pThis->lpVtbl->QuerySourceConditions(COM_ADJUST_THIS(pThis), szSource, pdwCount, ppszConditionNames) + + COM_VTBL_ENTRY (HRESULT, QueryEventAttributes, (IOPCEventServer* pThis, DWORD dwEventCategory, DWORD* pdwCount, DWORD** ppdwAttrIDs, LPWSTR** ppszAttrDescs, VARTYPE** ppvtAttrTypes)); + +#define IOPCEventServer_QueryEventAttributes(pThis, dwEventCategory, pdwCount, ppdwAttrIDs, ppszAttrDescs, ppvtAttrTypes) pThis->lpVtbl->QueryEventAttributes(COM_ADJUST_THIS(pThis), dwEventCategory, pdwCount, ppdwAttrIDs, ppszAttrDescs, ppvtAttrTypes) + + COM_VTBL_ENTRY (HRESULT, TranslateToItemIDs, (IOPCEventServer* pThis, LPWSTR szSource, DWORD dwEventCategory, LPWSTR szConditionName, LPWSTR szSubconditionName, DWORD dwCount, DWORD* pdwAssocAttrIDs, LPWSTR** ppszAttrItemIDs, LPWSTR** ppszNodeNames, CLSID** ppCLSIDs)); + +#define IOPCEventServer_TranslateToItemIDs(pThis, szSource, dwEventCategory, szConditionName, szSubconditionName, dwCount, pdwAssocAttrIDs, ppszAttrItemIDs, ppszNodeNames, ppCLSIDs) pThis->lpVtbl->TranslateToItemIDs(COM_ADJUST_THIS(pThis), szSource, dwEventCategory, szConditionName, szSubconditionName, dwCount, pdwAssocAttrIDs, ppszAttrItemIDs, ppszNodeNames, ppCLSIDs) + + COM_VTBL_ENTRY (HRESULT, GetConditionState, (IOPCEventServer* pThis, LPWSTR szSource, LPWSTR szConditionName, DWORD dwNumEventAttrs, DWORD* pdwAttributeIDs, OPCCONDITIONSTATE** ppConditionState)); + +#define IOPCEventServer_GetConditionState(pThis, szSource, szConditionName, dwNumEventAttrs, pdwAttributeIDs, ppConditionState) pThis->lpVtbl->GetConditionState(COM_ADJUST_THIS(pThis), szSource, szConditionName, dwNumEventAttrs, pdwAttributeIDs, ppConditionState) + + COM_VTBL_ENTRY (HRESULT, EnableConditionByArea, (IOPCEventServer* pThis, DWORD dwNumAreas, LPWSTR* pszAreas)); + +#define IOPCEventServer_EnableConditionByArea(pThis, dwNumAreas, pszAreas) pThis->lpVtbl->EnableConditionByArea(COM_ADJUST_THIS(pThis), dwNumAreas, pszAreas) + + COM_VTBL_ENTRY (HRESULT, EnableConditionBySource, (IOPCEventServer* pThis, DWORD dwNumSources, LPWSTR* pszSources)); + +#define IOPCEventServer_EnableConditionBySource(pThis, dwNumSources, pszSources) pThis->lpVtbl->EnableConditionBySource(COM_ADJUST_THIS(pThis), dwNumSources, pszSources) + + COM_VTBL_ENTRY (HRESULT, DisableConditionByArea, (IOPCEventServer* pThis, DWORD dwNumAreas, LPWSTR* pszAreas)); + +#define IOPCEventServer_DisableConditionByArea(pThis, dwNumAreas, pszAreas) pThis->lpVtbl->DisableConditionByArea(COM_ADJUST_THIS(pThis), dwNumAreas, pszAreas) + + COM_VTBL_ENTRY (HRESULT, DisableConditionBySource, (IOPCEventServer* pThis, DWORD dwNumSources, LPWSTR* pszSources)); + +#define IOPCEventServer_DisableConditionBySource(pThis, dwNumSources, pszSources) pThis->lpVtbl->DisableConditionBySource(COM_ADJUST_THIS(pThis), dwNumSources, pszSources) + + COM_VTBL_ENTRY (HRESULT, AckCondition, (IOPCEventServer* pThis, DWORD dwCount, LPWSTR szAcknowledgerID, LPWSTR szComment, LPWSTR* pszSource, LPWSTR* pszConditionName, FILETIME* pftActiveTime, DWORD* pdwCookie, HRESULT** ppErrors)); + +#define IOPCEventServer_AckCondition(pThis, dwCount, szAcknowledgerID, szComment, pszSource, pszConditionName, pftActiveTime, pdwCookie, ppErrors) pThis->lpVtbl->AckCondition(COM_ADJUST_THIS(pThis), dwCount, szAcknowledgerID, szComment, pszSource, pszConditionName, pftActiveTime, pdwCookie, ppErrors) + + COM_VTBL_ENTRY (HRESULT, CreateAreaBrowser, (IOPCEventServer* pThis, REFIID riid, LPUNKNOWN* ppUnk)); + +#define IOPCEventServer_CreateAreaBrowser(pThis, riid, ppUnk) pThis->lpVtbl->CreateAreaBrowser(COM_ADJUST_THIS(pThis), riid, ppUnk) + + COM_VTBL_END + } IOPCEventServerVtbl; + +#ifdef __cplusplus + +interface IOPCEventServer : public IUnknown +{ +virtual HRESULT GetStatus (OPCEVENTSERVERSTATUS** ppEventServerStatus) =0; + +virtual HRESULT CreateEventSubscription (BOOL bActive, DWORD dwBufferTime, DWORD dwMaxSize, OPCHANDLE hClientSubscription, REFIID riid, LPUNKNOWN* ppUnk, DWORD* pdwRevisedBufferTime, DWORD* pdwRevisedMaxSize) =0; + +virtual HRESULT QueryAvailableFilters (DWORD* pdwFilterMask) =0; + +virtual HRESULT QueryEventCategories (DWORD dwEventType, DWORD* pdwCount, DWORD** ppdwEventCategories, LPWSTR** ppszEventCategoryDescs) =0; + +virtual HRESULT QueryConditionNames (DWORD dwEventCategory, DWORD* pdwCount, LPWSTR** ppszConditionNames) =0; + +virtual HRESULT QuerySubConditionNames (LPWSTR szConditionName, DWORD* pdwCount, LPWSTR** ppszSubConditionNames) =0; + +virtual HRESULT QuerySourceConditions (LPWSTR szSource, DWORD* pdwCount, LPWSTR** ppszConditionNames) =0; + +virtual HRESULT QueryEventAttributes (DWORD dwEventCategory, DWORD* pdwCount, DWORD** ppdwAttrIDs, LPWSTR** ppszAttrDescs, VARTYPE** ppvtAttrTypes) =0; + +virtual HRESULT TranslateToItemIDs (LPWSTR szSource, DWORD dwEventCategory, LPWSTR szConditionName, LPWSTR szSubconditionName, DWORD dwCount, DWORD* pdwAssocAttrIDs, LPWSTR** ppszAttrItemIDs, LPWSTR** ppszNodeNames, CLSID** ppCLSIDs) =0; + +virtual HRESULT GetConditionState (LPWSTR szSource, LPWSTR szConditionName, DWORD dwNumEventAttrs, DWORD* pdwAttributeIDs, OPCCONDITIONSTATE** ppConditionState) =0; + +virtual HRESULT EnableConditionByArea (DWORD dwNumAreas, LPWSTR* pszAreas) =0; + +virtual HRESULT EnableConditionBySource (DWORD dwNumSources, LPWSTR* pszSources) =0; + +virtual HRESULT DisableConditionByArea (DWORD dwNumAreas, LPWSTR* pszAreas) =0; + +virtual HRESULT DisableConditionBySource (DWORD dwNumSources, LPWSTR* pszSources) =0; + +virtual HRESULT AckCondition (DWORD dwCount, LPWSTR szAcknowledgerID, LPWSTR szComment, LPWSTR* pszSource, LPWSTR* pszConditionName, FILETIME* pftActiveTime, DWORD* pdwCookie, HRESULT** ppErrors) =0; + +virtual HRESULT CreateAreaBrowser (REFIID riid, LPUNKNOWN* ppUnk) =0; + +}; + +#else + +/* C interface definition for IOPCEventServer */ + +interface IOPCEventServer + { + const IOPCEventServerVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IOPCEventServer; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, SetFilter, (IOPCEventSubscriptionMgt* pThis, DWORD dwEventType, DWORD dwNumCategories, DWORD* pdwEventCategories, DWORD dwLowSeverity, DWORD dwHighSeverity, DWORD dwNumAreas, LPWSTR* pszAreaList, DWORD dwNumSources, LPWSTR* pszSourceList)); + +#define IOPCEventSubscriptionMgt_SetFilter(pThis, dwEventType, dwNumCategories, pdwEventCategories, dwLowSeverity, dwHighSeverity, dwNumAreas, pszAreaList, dwNumSources, pszSourceList) pThis->lpVtbl->SetFilter(COM_ADJUST_THIS(pThis), dwEventType, dwNumCategories, pdwEventCategories, dwLowSeverity, dwHighSeverity, dwNumAreas, pszAreaList, dwNumSources, pszSourceList) + + COM_VTBL_ENTRY (HRESULT, GetFilter, (IOPCEventSubscriptionMgt* pThis, DWORD* pdwEventType, DWORD* pdwNumCategories, DWORD** ppdwEventCategories, DWORD* pdwLowSeverity, DWORD* pdwHighSeverity, DWORD* pdwNumAreas, LPWSTR** ppszAreaList, DWORD* pdwNumSources, LPWSTR** ppszSourceList)); + +#define IOPCEventSubscriptionMgt_GetFilter(pThis, pdwEventType, pdwNumCategories, ppdwEventCategories, pdwLowSeverity, pdwHighSeverity, pdwNumAreas, ppszAreaList, pdwNumSources, ppszSourceList) pThis->lpVtbl->GetFilter(COM_ADJUST_THIS(pThis), pdwEventType, pdwNumCategories, ppdwEventCategories, pdwLowSeverity, pdwHighSeverity, pdwNumAreas, ppszAreaList, pdwNumSources, ppszSourceList) + + COM_VTBL_ENTRY (HRESULT, SelectReturnedAttributes, (IOPCEventSubscriptionMgt* pThis, DWORD dwEventCategory, DWORD dwCount, DWORD* dwAttributeIDs)); + +#define IOPCEventSubscriptionMgt_SelectReturnedAttributes(pThis, dwEventCategory, dwCount, dwAttributeIDs) pThis->lpVtbl->SelectReturnedAttributes(COM_ADJUST_THIS(pThis), dwEventCategory, dwCount, dwAttributeIDs) + + COM_VTBL_ENTRY (HRESULT, GetReturnedAttributes, (IOPCEventSubscriptionMgt* pThis, DWORD dwEventCategory, DWORD* pdwCount, DWORD** ppdwAttributeIDs)); + +#define IOPCEventSubscriptionMgt_GetReturnedAttributes(pThis, dwEventCategory, pdwCount, ppdwAttributeIDs) pThis->lpVtbl->GetReturnedAttributes(COM_ADJUST_THIS(pThis), dwEventCategory, pdwCount, ppdwAttributeIDs) + + COM_VTBL_ENTRY (HRESULT, Refresh, (IOPCEventSubscriptionMgt* pThis, DWORD dwConnection)); + +#define IOPCEventSubscriptionMgt_Refresh(pThis, dwConnection) pThis->lpVtbl->Refresh(COM_ADJUST_THIS(pThis), dwConnection) + + COM_VTBL_ENTRY (HRESULT, CancelRefresh, (IOPCEventSubscriptionMgt* pThis, DWORD dwConnection)); + +#define IOPCEventSubscriptionMgt_CancelRefresh(pThis, dwConnection) pThis->lpVtbl->CancelRefresh(COM_ADJUST_THIS(pThis), dwConnection) + + COM_VTBL_ENTRY (HRESULT, GetState, (IOPCEventSubscriptionMgt* pThis, BOOL* pbActive, DWORD* pdwBufferTime, DWORD* pdwMaxSize, OPCHANDLE* phClientSubscription)); + +#define IOPCEventSubscriptionMgt_GetState(pThis, pbActive, pdwBufferTime, pdwMaxSize, phClientSubscription) pThis->lpVtbl->GetState(COM_ADJUST_THIS(pThis), pbActive, pdwBufferTime, pdwMaxSize, phClientSubscription) + + COM_VTBL_ENTRY (HRESULT, SetState, (IOPCEventSubscriptionMgt* pThis, BOOL* pbActive, DWORD* pdwBufferTime, DWORD* pdwMaxSize, OPCHANDLE hClientSubscription, DWORD* pdwRevisedBufferTime, DWORD* pdwRevisedMaxSize)); + +#define IOPCEventSubscriptionMgt_SetState(pThis, pbActive, pdwBufferTime, pdwMaxSize, hClientSubscription, pdwRevisedBufferTime, pdwRevisedMaxSize) pThis->lpVtbl->SetState(COM_ADJUST_THIS(pThis), pbActive, pdwBufferTime, pdwMaxSize, hClientSubscription, pdwRevisedBufferTime, pdwRevisedMaxSize) + + COM_VTBL_END + } IOPCEventSubscriptionMgtVtbl; + +#ifdef __cplusplus + +interface IOPCEventSubscriptionMgt : public IUnknown +{ +virtual HRESULT SetFilter (DWORD dwEventType, DWORD dwNumCategories, DWORD* pdwEventCategories, DWORD dwLowSeverity, DWORD dwHighSeverity, DWORD dwNumAreas, LPWSTR* pszAreaList, DWORD dwNumSources, LPWSTR* pszSourceList) =0; + +virtual HRESULT GetFilter (DWORD* pdwEventType, DWORD* pdwNumCategories, DWORD** ppdwEventCategories, DWORD* pdwLowSeverity, DWORD* pdwHighSeverity, DWORD* pdwNumAreas, LPWSTR** ppszAreaList, DWORD* pdwNumSources, LPWSTR** ppszSourceList) =0; + +virtual HRESULT SelectReturnedAttributes (DWORD dwEventCategory, DWORD dwCount, DWORD* dwAttributeIDs) =0; + +virtual HRESULT GetReturnedAttributes (DWORD dwEventCategory, DWORD* pdwCount, DWORD** ppdwAttributeIDs) =0; + +virtual HRESULT Refresh (DWORD dwConnection) =0; + +virtual HRESULT CancelRefresh (DWORD dwConnection) =0; + +virtual HRESULT GetState (BOOL* pbActive, DWORD* pdwBufferTime, DWORD* pdwMaxSize, OPCHANDLE* phClientSubscription) =0; + +virtual HRESULT SetState (BOOL* pbActive, DWORD* pdwBufferTime, DWORD* pdwMaxSize, OPCHANDLE hClientSubscription, DWORD* pdwRevisedBufferTime, DWORD* pdwRevisedMaxSize) =0; + +}; + +#else + +/* C interface definition for IOPCEventSubscriptionMgt */ + +interface IOPCEventSubscriptionMgt + { + const IOPCEventSubscriptionMgtVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IOPCEventSubscriptionMgt; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, ChangeBrowsePosition, (IOPCEventAreaBrowser* pThis, OPCAEBROWSEDIRECTION dwBrowseDirection, LPCWSTR szString)); + +#define IOPCEventAreaBrowser_ChangeBrowsePosition(pThis, dwBrowseDirection, szString) pThis->lpVtbl->ChangeBrowsePosition(COM_ADJUST_THIS(pThis), dwBrowseDirection, szString) + + COM_VTBL_ENTRY (HRESULT, BrowseOPCAreas, (IOPCEventAreaBrowser* pThis, OPCAEBROWSETYPE dwBrowseFilterType, LPCWSTR szFilterCriteria, LPENUMSTRING* ppIEnumString)); + +#define IOPCEventAreaBrowser_BrowseOPCAreas(pThis, dwBrowseFilterType, szFilterCriteria, ppIEnumString) pThis->lpVtbl->BrowseOPCAreas(COM_ADJUST_THIS(pThis), dwBrowseFilterType, szFilterCriteria, ppIEnumString) + + COM_VTBL_ENTRY (HRESULT, GetQualifiedAreaName, (IOPCEventAreaBrowser* pThis, LPCWSTR szAreaName, LPWSTR* pszQualifiedAreaName)); + +#define IOPCEventAreaBrowser_GetQualifiedAreaName(pThis, szAreaName, pszQualifiedAreaName) pThis->lpVtbl->GetQualifiedAreaName(COM_ADJUST_THIS(pThis), szAreaName, pszQualifiedAreaName) + + COM_VTBL_ENTRY (HRESULT, GetQualifiedSourceName, (IOPCEventAreaBrowser* pThis, LPCWSTR szSourceName, LPWSTR* pszQualifiedSourceName)); + +#define IOPCEventAreaBrowser_GetQualifiedSourceName(pThis, szSourceName, pszQualifiedSourceName) pThis->lpVtbl->GetQualifiedSourceName(COM_ADJUST_THIS(pThis), szSourceName, pszQualifiedSourceName) + + COM_VTBL_END + } IOPCEventAreaBrowserVtbl; + +#ifdef __cplusplus + +interface IOPCEventAreaBrowser : public IUnknown +{ +virtual HRESULT ChangeBrowsePosition (OPCAEBROWSEDIRECTION dwBrowseDirection, LPCWSTR szString) =0; + +virtual HRESULT BrowseOPCAreas (OPCAEBROWSETYPE dwBrowseFilterType, LPCWSTR szFilterCriteria, LPENUMSTRING* ppIEnumString) =0; + +virtual HRESULT GetQualifiedAreaName (LPCWSTR szAreaName, LPWSTR* pszQualifiedAreaName) =0; + +virtual HRESULT GetQualifiedSourceName (LPCWSTR szSourceName, LPWSTR* pszQualifiedSourceName) =0; + +}; + +#else + +/* C interface definition for IOPCEventAreaBrowser */ + +interface IOPCEventAreaBrowser + { + const IOPCEventAreaBrowserVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IOPCEventAreaBrowser; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, OnEvent, (IOPCEventSink* pThis, OPCHANDLE hClientSubscription, BOOL bRefresh, BOOL bLastRefresh, DWORD dwCount, ONEVENTSTRUCT* pEvents)); + +#define IOPCEventSink_OnEvent(pThis, hClientSubscription, bRefresh, bLastRefresh, dwCount, pEvents) pThis->lpVtbl->OnEvent(COM_ADJUST_THIS(pThis), hClientSubscription, bRefresh, bLastRefresh, dwCount, pEvents) + + COM_VTBL_END + } IOPCEventSinkVtbl; + +#ifdef __cplusplus + +interface IOPCEventSink : public IUnknown +{ +virtual HRESULT OnEvent (OPCHANDLE hClientSubscription, BOOL bRefresh, BOOL bLastRefresh, DWORD dwCount, ONEVENTSTRUCT* pEvents) =0; + +}; + +#else + +/* C interface definition for IOPCEventSink */ + +interface IOPCEventSink + { + const IOPCEventSinkVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IOPCEventSink; + +#ifdef __cplusplus +} +#endif + + + +#endif /* __INCopc_ae_h */ + + diff --git a/h/opccomn.h b/h/opccomn.h new file mode 100644 index 0000000..ca16807 --- /dev/null +++ b/h/opccomn.h @@ -0,0 +1,205 @@ +/* opccomn.h generated by WIDL Version 2.2.1 on 06-Dec-01 at 11:53:54 AM */ + +#include "comBase.h" + +#ifndef __INCopccomn_h +#define __INCopccomn_h + + +#include "vxidl.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int include_opccomn (void); + +#ifndef __IOPCShutdown_FWD_DEFINED__ +#define __IOPCShutdown_FWD_DEFINED__ +typedef interface IOPCShutdown IOPCShutdown; +#endif /* __IOPCShutdown_FWD_DEFINED__ */ + +#ifndef __IOPCCommon_FWD_DEFINED__ +#define __IOPCCommon_FWD_DEFINED__ +typedef interface IOPCCommon IOPCCommon; +#endif /* __IOPCCommon_FWD_DEFINED__ */ + +#ifndef __IOPCServerList_FWD_DEFINED__ +#define __IOPCServerList_FWD_DEFINED__ +typedef interface IOPCServerList IOPCServerList; +#endif /* __IOPCServerList_FWD_DEFINED__ */ + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, ShutdownRequest, (IOPCShutdown* pThis, LPCWSTR szReason)); + +#define IOPCShutdown_ShutdownRequest(pThis, szReason) pThis->lpVtbl->ShutdownRequest(COM_ADJUST_THIS(pThis), szReason) + + COM_VTBL_END + } IOPCShutdownVtbl; + +#ifdef __cplusplus + +interface IOPCShutdown : public IUnknown +{ +virtual HRESULT ShutdownRequest (LPCWSTR szReason) =0; + +}; + +#else + +/* C interface definition for IOPCShutdown */ + +interface IOPCShutdown + { + const IOPCShutdownVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IOPCShutdown; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, SetLocaleID, (IOPCCommon* pThis, LCID dwLcid)); + +#define IOPCCommon_SetLocaleID(pThis, dwLcid) pThis->lpVtbl->SetLocaleID(COM_ADJUST_THIS(pThis), dwLcid) + + COM_VTBL_ENTRY (HRESULT, GetLocaleID, (IOPCCommon* pThis, LCID* pdwLcid)); + +#define IOPCCommon_GetLocaleID(pThis, pdwLcid) pThis->lpVtbl->GetLocaleID(COM_ADJUST_THIS(pThis), pdwLcid) + + COM_VTBL_ENTRY (HRESULT, QueryAvailableLocaleIDs, (IOPCCommon* pThis, DWORD* pdwCount, LCID** pdwLcid)); + +#define IOPCCommon_QueryAvailableLocaleIDs(pThis, pdwCount, pdwLcid) pThis->lpVtbl->QueryAvailableLocaleIDs(COM_ADJUST_THIS(pThis), pdwCount, pdwLcid) + + COM_VTBL_ENTRY (HRESULT, GetErrorString, (IOPCCommon* pThis, HRESULT dwError, LPWSTR* ppString)); + +#define IOPCCommon_GetErrorString(pThis, dwError, ppString) pThis->lpVtbl->GetErrorString(COM_ADJUST_THIS(pThis), dwError, ppString) + + COM_VTBL_ENTRY (HRESULT, SetClientName, (IOPCCommon* pThis, LPCWSTR szName)); + +#define IOPCCommon_SetClientName(pThis, szName) pThis->lpVtbl->SetClientName(COM_ADJUST_THIS(pThis), szName) + + COM_VTBL_END + } IOPCCommonVtbl; + +#ifdef __cplusplus + +interface IOPCCommon : public IUnknown +{ +virtual HRESULT SetLocaleID (LCID dwLcid) =0; + +virtual HRESULT GetLocaleID (LCID* pdwLcid) =0; + +virtual HRESULT QueryAvailableLocaleIDs (DWORD* pdwCount, LCID** pdwLcid) =0; + +virtual HRESULT GetErrorString (HRESULT dwError, LPWSTR* ppString) =0; + +virtual HRESULT SetClientName (LPCWSTR szName) =0; + +}; + +#else + +/* C interface definition for IOPCCommon */ + +interface IOPCCommon + { + const IOPCCommonVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IOPCCommon; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, EnumClassesOfCategories, (IOPCServerList* pThis, ULONG cImplemented, CATID* rgcatidImpl, ULONG cRequired, CATID* rgcatidReq, IEnumGUID** ppenumClsid)); + +#define IOPCServerList_EnumClassesOfCategories(pThis, cImplemented, rgcatidImpl, cRequired, rgcatidReq, ppenumClsid) pThis->lpVtbl->EnumClassesOfCategories(COM_ADJUST_THIS(pThis), cImplemented, rgcatidImpl, cRequired, rgcatidReq, ppenumClsid) + + COM_VTBL_ENTRY (HRESULT, GetClassDetails, (IOPCServerList* pThis, REFCLSID clsid, LPOLESTR* ppszProgID, LPOLESTR* ppszUserType)); + +#define IOPCServerList_GetClassDetails(pThis, clsid, ppszProgID, ppszUserType) pThis->lpVtbl->GetClassDetails(COM_ADJUST_THIS(pThis), clsid, ppszProgID, ppszUserType) + + COM_VTBL_ENTRY (HRESULT, CLSIDFromProgID, (IOPCServerList* pThis, LPCOLESTR szProgId, LPCLSID clsid)); + +#define IOPCServerList_CLSIDFromProgID(pThis, szProgId, clsid) pThis->lpVtbl->CLSIDFromProgID(COM_ADJUST_THIS(pThis), szProgId, clsid) + + COM_VTBL_END + } IOPCServerListVtbl; + +#ifdef __cplusplus + +interface IOPCServerList : public IUnknown +{ +virtual HRESULT EnumClassesOfCategories (ULONG cImplemented, CATID* rgcatidImpl, ULONG cRequired, CATID* rgcatidReq, IEnumGUID** ppenumClsid) =0; + +virtual HRESULT GetClassDetails (REFCLSID clsid, LPOLESTR* ppszProgID, LPOLESTR* ppszUserType) =0; + +virtual HRESULT CLSIDFromProgID (LPCOLESTR szProgId, LPCLSID clsid) =0; + +}; + +#else + +/* C interface definition for IOPCServerList */ + +interface IOPCServerList + { + const IOPCServerListVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IOPCServerList; + +#ifdef __cplusplus +} +#endif + + + +#endif /* __INCopccomn_h */ + + diff --git a/h/opcda.h b/h/opcda.h new file mode 100644 index 0000000..0f05aad --- /dev/null +++ b/h/opcda.h @@ -0,0 +1,1037 @@ +/* opcda.h generated by WIDL Version 2.2.1 on 06-Dec-01 at 11:53:51 AM */ + +#include "comBase.h" + +#ifndef __INCopcda_h +#define __INCopcda_h + + +#include "vxidl.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int include_opcda (void); + +#ifndef __IOPCServer_FWD_DEFINED__ +#define __IOPCServer_FWD_DEFINED__ +typedef interface IOPCServer IOPCServer; +#endif /* __IOPCServer_FWD_DEFINED__ */ + +#ifndef __IOPCServerPublicGroups_FWD_DEFINED__ +#define __IOPCServerPublicGroups_FWD_DEFINED__ +typedef interface IOPCServerPublicGroups IOPCServerPublicGroups; +#endif /* __IOPCServerPublicGroups_FWD_DEFINED__ */ + +#ifndef __IOPCBrowseServerAddressSpace_FWD_DEFINED__ +#define __IOPCBrowseServerAddressSpace_FWD_DEFINED__ +typedef interface IOPCBrowseServerAddressSpace IOPCBrowseServerAddressSpace; +#endif /* __IOPCBrowseServerAddressSpace_FWD_DEFINED__ */ + +#ifndef __IOPCGroupStateMgt_FWD_DEFINED__ +#define __IOPCGroupStateMgt_FWD_DEFINED__ +typedef interface IOPCGroupStateMgt IOPCGroupStateMgt; +#endif /* __IOPCGroupStateMgt_FWD_DEFINED__ */ + +#ifndef __IOPCPublicGroupStateMgt_FWD_DEFINED__ +#define __IOPCPublicGroupStateMgt_FWD_DEFINED__ +typedef interface IOPCPublicGroupStateMgt IOPCPublicGroupStateMgt; +#endif /* __IOPCPublicGroupStateMgt_FWD_DEFINED__ */ + +#ifndef __IOPCSyncIO_FWD_DEFINED__ +#define __IOPCSyncIO_FWD_DEFINED__ +typedef interface IOPCSyncIO IOPCSyncIO; +#endif /* __IOPCSyncIO_FWD_DEFINED__ */ + +#ifndef __IOPCAsyncIO_FWD_DEFINED__ +#define __IOPCAsyncIO_FWD_DEFINED__ +typedef interface IOPCAsyncIO IOPCAsyncIO; +#endif /* __IOPCAsyncIO_FWD_DEFINED__ */ + +#ifndef __IOPCItemMgt_FWD_DEFINED__ +#define __IOPCItemMgt_FWD_DEFINED__ +typedef interface IOPCItemMgt IOPCItemMgt; +#endif /* __IOPCItemMgt_FWD_DEFINED__ */ + +#ifndef __IEnumOPCItemAttributes_FWD_DEFINED__ +#define __IEnumOPCItemAttributes_FWD_DEFINED__ +typedef interface IEnumOPCItemAttributes IEnumOPCItemAttributes; +#endif /* __IEnumOPCItemAttributes_FWD_DEFINED__ */ + +#ifndef __IOPCDataCallback_FWD_DEFINED__ +#define __IOPCDataCallback_FWD_DEFINED__ +typedef interface IOPCDataCallback IOPCDataCallback; +#endif /* __IOPCDataCallback_FWD_DEFINED__ */ + +#ifndef __IOPCAsyncIO2_FWD_DEFINED__ +#define __IOPCAsyncIO2_FWD_DEFINED__ +typedef interface IOPCAsyncIO2 IOPCAsyncIO2; +#endif /* __IOPCAsyncIO2_FWD_DEFINED__ */ + +#ifndef __IOPCItemProperties_FWD_DEFINED__ +#define __IOPCItemProperties_FWD_DEFINED__ +typedef interface IOPCItemProperties IOPCItemProperties; +#endif /* __IOPCItemProperties_FWD_DEFINED__ */ + +enum tagOPCDATASOURCE +{ +OPC_DS_CACHE = 1, +OPC_DS_DEVICE = 2, +}; + +typedef enum tagOPCDATASOURCE OPCDATASOURCE; + +enum tagOPCBROWSETYPE +{ +OPC_BRANCH = 1, +OPC_LEAF = 2, +OPC_FLAT = 3, +}; + +typedef enum tagOPCBROWSETYPE OPCBROWSETYPE; + +enum tagOPCNAMESPACETYPE +{ +OPC_NS_HIERARCHIAL = 1, +OPC_NS_FLAT = 2, +}; + +typedef enum tagOPCNAMESPACETYPE OPCNAMESPACETYPE; + +enum tagOPCBROWSEDIRECTION +{ +OPC_BROWSE_UP = 1, +OPC_BROWSE_DOWN = 2, +OPC_BROWSE_TO = 3, +}; + +typedef enum tagOPCBROWSEDIRECTION OPCBROWSEDIRECTION; + +#define OPC_READABLE 1 +#define OPC_WRITEABLE 2 +enum tagOPCEUTYPE +{ +OPC_NOENUM = 0, +OPC_ANALOG = 1, +OPC_ENUMERATED = 2, +}; + +typedef enum tagOPCEUTYPE OPCEUTYPE; + +enum tagOPCSERVERSTATE +{ +OPC_STATUS_RUNNING = 1, +OPC_STATUS_FAILED = 2, +OPC_STATUS_NOCONFIG = 3, +OPC_STATUS_SUSPENDED = 4, +OPC_STATUS_TEST = 5, +}; + +typedef enum tagOPCSERVERSTATE OPCSERVERSTATE; + +enum tagOPCENUMSCOPE +{ +OPC_ENUM_PRIVATE_CONNECTIONS = 1, +OPC_ENUM_PUBLIC_CONNECTIONS = 2, +OPC_ENUM_ALL_CONNECTIONS = 3, +OPC_ENUM_PRIVATE = 4, +OPC_ENUM_PUBLIC = 5, +OPC_ENUM_ALL = 6, +}; + +typedef enum tagOPCENUMSCOPE OPCENUMSCOPE; + +typedef DWORD OPCHANDLE; + +struct tagOPCGROUPHEADER +{ +DWORD dwSize; +DWORD dwItemCount; +OPCHANDLE hClientGroup; +DWORD dwTransactionID; +HRESULT hrStatus; +}; + +typedef struct tagOPCGROUPHEADER OPCGROUPHEADER; + +struct tagOPCITEMHEADER1 +{ +OPCHANDLE hClient; +DWORD dwValueOffset; +WORD wQuality; +WORD wReserved; +FILETIME ftTimeStampItem; +}; + +typedef struct tagOPCITEMHEADER1 OPCITEMHEADER1; + +struct tagOPCITEMHEADER2 +{ +OPCHANDLE hClient; +DWORD dwValueOffset; +WORD wQuality; +WORD wReserved; +}; + +typedef struct tagOPCITEMHEADER2 OPCITEMHEADER2; + +struct tagOPCGROUPHEADERWRITE +{ +DWORD dwItemCount; +OPCHANDLE hClientGroup; +DWORD dwTransactionID; +HRESULT hrStatus; +}; + +typedef struct tagOPCGROUPHEADERWRITE OPCGROUPHEADERWRITE; + +struct tagOPCITEMHEADERWRITE +{ +OPCHANDLE hClient; +HRESULT dwError; +}; + +typedef struct tagOPCITEMHEADERWRITE OPCITEMHEADERWRITE; + +struct tagOPCITEMSTATE +{ +OPCHANDLE hClient; +FILETIME ftTimeStamp; +WORD wQuality; +WORD wReserved; +VARIANT vDataValue; +}; + +typedef struct tagOPCITEMSTATE OPCITEMSTATE; + +struct tagOPCSERVERSTATUS +{ +FILETIME ftStartTime; +FILETIME ftCurrentTime; +FILETIME ftLastUpdateTime; +OPCSERVERSTATE dwServerState; +DWORD dwGroupCount; +DWORD dwBandWidth; +WORD wMajorVersion; +WORD wMinorVersion; +WORD wBuildNumber; +WORD wReserved; +LPWSTR szVendorInfo; +}; + +typedef struct tagOPCSERVERSTATUS OPCSERVERSTATUS; + +struct tagOPCITEMDEF +{ +LPWSTR szAccessPath; +LPWSTR szItemID; +BOOL bActive; +OPCHANDLE hClient; +DWORD dwBlobSize; +BYTE* pBlob; +VARTYPE vtRequestedDataType; +WORD wReserved; +}; + +typedef struct tagOPCITEMDEF OPCITEMDEF; + +struct tagOPCITEMATTRIBUTES +{ +LPWSTR szAccessPath; +LPWSTR szItemID; +BOOL bActive; +OPCHANDLE hClient; +OPCHANDLE hServer; +DWORD dwAccessRights; +DWORD dwBlobSize; +BYTE* pBlob; +VARTYPE vtRequestedDataType; +VARTYPE vtCanonicalDataType; +OPCEUTYPE dwEUType; +VARIANT vEUInfo; +}; + +typedef struct tagOPCITEMATTRIBUTES OPCITEMATTRIBUTES; + +struct tagOPCITEMRESULT +{ +OPCHANDLE hServer; +VARTYPE vtCanonicalDataType; +WORD wReserved; +DWORD dwAccessRights; +DWORD dwBlobSize; +BYTE* pBlob; +}; + +typedef struct tagOPCITEMRESULT OPCITEMRESULT; + +#define OPC_QUALITY_MASK 0xC0 +#define OPC_STATUS_MASK 0xFC +#define OPC_LIMIT_MASK 0x03 +#define OPC_QUALITY_BAD 0x00 +#define OPC_QUALITY_UNCERTAIN 0x40 +#define OPC_QUALITY_GOOD 0xC0 +#define OPC_QUALITY_CONFIG_ERROR 0x04 +#define OPC_QUALITY_NOT_CONNECTED 0x08 +#define OPC_QUALITY_DEVICE_FAILURE 0x0c +#define OPC_QUALITY_SENSOR_FAILURE 0x10 +#define OPC_QUALITY_LAST_KNOWN 0x14 +#define OPC_QUALITY_COMM_FAILURE 0x18 +#define OPC_QUALITY_OUT_OF_SERVICE 0x1C +#define OPC_QUALITY_LAST_USABLE 0x44 +#define OPC_QUALITY_SENSOR_CAL 0x50 +#define OPC_QUALITY_EGU_EXCEEDED 0x54 +#define OPC_QUALITY_SUB_NORMAL 0x58 +#define OPC_QUALITY_LOCAL_OVERRIDE 0xD8 +#define OPC_LIMIT_OK 0x00 +#define OPC_LIMIT_LOW 0x01 +#define OPC_LIMIT_HIGH 0x02 +#define OPC_LIMIT_CONST 0x03 +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, AddGroup, (IOPCServer* pThis, LPCWSTR szName, BOOL bActive, DWORD dwRequestedUpdateRate, OPCHANDLE hClientGroup, LONG* pTimeBias, FLOAT* pPercentDeadband, DWORD dwLCID, OPCHANDLE* phServerGroup, DWORD* pRevisedUpdateRate, REFIID riid, LPUNKNOWN* ppUnk)); + +#define IOPCServer_AddGroup(pThis, szName, bActive, dwRequestedUpdateRate, hClientGroup, pTimeBias, pPercentDeadband, dwLCID, phServerGroup, pRevisedUpdateRate, riid, ppUnk) pThis->lpVtbl->AddGroup(COM_ADJUST_THIS(pThis), szName, bActive, dwRequestedUpdateRate, hClientGroup, pTimeBias, pPercentDeadband, dwLCID, phServerGroup, pRevisedUpdateRate, riid, ppUnk) + + COM_VTBL_ENTRY (HRESULT, GetErrorString, (IOPCServer* pThis, HRESULT dwError, LCID dwLocale, LPWSTR* ppString)); + +#define IOPCServer_GetErrorString(pThis, dwError, dwLocale, ppString) pThis->lpVtbl->GetErrorString(COM_ADJUST_THIS(pThis), dwError, dwLocale, ppString) + + COM_VTBL_ENTRY (HRESULT, GetGroupByName, (IOPCServer* pThis, LPCWSTR szName, REFIID riid, LPUNKNOWN* ppUnk)); + +#define IOPCServer_GetGroupByName(pThis, szName, riid, ppUnk) pThis->lpVtbl->GetGroupByName(COM_ADJUST_THIS(pThis), szName, riid, ppUnk) + + COM_VTBL_ENTRY (HRESULT, GetStatus, (IOPCServer* pThis, OPCSERVERSTATUS** ppServerStatus)); + +#define IOPCServer_GetStatus(pThis, ppServerStatus) pThis->lpVtbl->GetStatus(COM_ADJUST_THIS(pThis), ppServerStatus) + + COM_VTBL_ENTRY (HRESULT, RemoveGroup, (IOPCServer* pThis, OPCHANDLE hServerGroup, BOOL bForce)); + +#define IOPCServer_RemoveGroup(pThis, hServerGroup, bForce) pThis->lpVtbl->RemoveGroup(COM_ADJUST_THIS(pThis), hServerGroup, bForce) + + COM_VTBL_ENTRY (HRESULT, CreateGroupEnumerator, (IOPCServer* pThis, OPCENUMSCOPE dwScope, REFIID riid, LPUNKNOWN* ppUnk)); + +#define IOPCServer_CreateGroupEnumerator(pThis, dwScope, riid, ppUnk) pThis->lpVtbl->CreateGroupEnumerator(COM_ADJUST_THIS(pThis), dwScope, riid, ppUnk) + + COM_VTBL_END + } IOPCServerVtbl; + +#ifdef __cplusplus + +interface IOPCServer : public IUnknown +{ +virtual HRESULT AddGroup (LPCWSTR szName, BOOL bActive, DWORD dwRequestedUpdateRate, OPCHANDLE hClientGroup, LONG* pTimeBias, FLOAT* pPercentDeadband, DWORD dwLCID, OPCHANDLE* phServerGroup, DWORD* pRevisedUpdateRate, REFIID riid, LPUNKNOWN* ppUnk) =0; + +virtual HRESULT GetErrorString (HRESULT dwError, LCID dwLocale, LPWSTR* ppString) =0; + +virtual HRESULT GetGroupByName (LPCWSTR szName, REFIID riid, LPUNKNOWN* ppUnk) =0; + +virtual HRESULT GetStatus (OPCSERVERSTATUS** ppServerStatus) =0; + +virtual HRESULT RemoveGroup (OPCHANDLE hServerGroup, BOOL bForce) =0; + +virtual HRESULT CreateGroupEnumerator (OPCENUMSCOPE dwScope, REFIID riid, LPUNKNOWN* ppUnk) =0; + +}; + +#else + +/* C interface definition for IOPCServer */ + +interface IOPCServer + { + const IOPCServerVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IOPCServer; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, GetPublicGroupByName, (IOPCServerPublicGroups* pThis, LPCWSTR szName, REFIID riid, LPUNKNOWN* ppUnk)); + +#define IOPCServerPublicGroups_GetPublicGroupByName(pThis, szName, riid, ppUnk) pThis->lpVtbl->GetPublicGroupByName(COM_ADJUST_THIS(pThis), szName, riid, ppUnk) + + COM_VTBL_ENTRY (HRESULT, RemovePublicGroup, (IOPCServerPublicGroups* pThis, OPCHANDLE hServerGroup, BOOL bForce)); + +#define IOPCServerPublicGroups_RemovePublicGroup(pThis, hServerGroup, bForce) pThis->lpVtbl->RemovePublicGroup(COM_ADJUST_THIS(pThis), hServerGroup, bForce) + + COM_VTBL_END + } IOPCServerPublicGroupsVtbl; + +#ifdef __cplusplus + +interface IOPCServerPublicGroups : public IUnknown +{ +virtual HRESULT GetPublicGroupByName (LPCWSTR szName, REFIID riid, LPUNKNOWN* ppUnk) =0; + +virtual HRESULT RemovePublicGroup (OPCHANDLE hServerGroup, BOOL bForce) =0; + +}; + +#else + +/* C interface definition for IOPCServerPublicGroups */ + +interface IOPCServerPublicGroups + { + const IOPCServerPublicGroupsVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IOPCServerPublicGroups; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, QueryOrganization, (IOPCBrowseServerAddressSpace* pThis, OPCNAMESPACETYPE* pNameSpaceType)); + +#define IOPCBrowseServerAddressSpace_QueryOrganization(pThis, pNameSpaceType) pThis->lpVtbl->QueryOrganization(COM_ADJUST_THIS(pThis), pNameSpaceType) + + COM_VTBL_ENTRY (HRESULT, ChangeBrowsePosition, (IOPCBrowseServerAddressSpace* pThis, OPCBROWSEDIRECTION dwBrowseDirection, LPCWSTR szString)); + +#define IOPCBrowseServerAddressSpace_ChangeBrowsePosition(pThis, dwBrowseDirection, szString) pThis->lpVtbl->ChangeBrowsePosition(COM_ADJUST_THIS(pThis), dwBrowseDirection, szString) + + COM_VTBL_ENTRY (HRESULT, BrowseOPCItemIDs, (IOPCBrowseServerAddressSpace* pThis, OPCBROWSETYPE dwBrowseFilterType, LPCWSTR szFilterCriteria, VARTYPE vtDataTypeFilter, DWORD dwAccessRightsFilter, LPENUMSTRING* ppIEnumString)); + +#define IOPCBrowseServerAddressSpace_BrowseOPCItemIDs(pThis, dwBrowseFilterType, szFilterCriteria, vtDataTypeFilter, dwAccessRightsFilter, ppIEnumString) pThis->lpVtbl->BrowseOPCItemIDs(COM_ADJUST_THIS(pThis), dwBrowseFilterType, szFilterCriteria, vtDataTypeFilter, dwAccessRightsFilter, ppIEnumString) + + COM_VTBL_ENTRY (HRESULT, GetItemID, (IOPCBrowseServerAddressSpace* pThis, LPWSTR szItemDataID, LPWSTR* szItemID)); + +#define IOPCBrowseServerAddressSpace_GetItemID(pThis, szItemDataID, szItemID) pThis->lpVtbl->GetItemID(COM_ADJUST_THIS(pThis), szItemDataID, szItemID) + + COM_VTBL_ENTRY (HRESULT, BrowseAccessPaths, (IOPCBrowseServerAddressSpace* pThis, LPCWSTR szItemID, LPENUMSTRING* ppIEnumString)); + +#define IOPCBrowseServerAddressSpace_BrowseAccessPaths(pThis, szItemID, ppIEnumString) pThis->lpVtbl->BrowseAccessPaths(COM_ADJUST_THIS(pThis), szItemID, ppIEnumString) + + COM_VTBL_END + } IOPCBrowseServerAddressSpaceVtbl; + +#ifdef __cplusplus + +interface IOPCBrowseServerAddressSpace : public IUnknown +{ +virtual HRESULT QueryOrganization (OPCNAMESPACETYPE* pNameSpaceType) =0; + +virtual HRESULT ChangeBrowsePosition (OPCBROWSEDIRECTION dwBrowseDirection, LPCWSTR szString) =0; + +virtual HRESULT BrowseOPCItemIDs (OPCBROWSETYPE dwBrowseFilterType, LPCWSTR szFilterCriteria, VARTYPE vtDataTypeFilter, DWORD dwAccessRightsFilter, LPENUMSTRING* ppIEnumString) =0; + +virtual HRESULT GetItemID (LPWSTR szItemDataID, LPWSTR* szItemID) =0; + +virtual HRESULT BrowseAccessPaths (LPCWSTR szItemID, LPENUMSTRING* ppIEnumString) =0; + +}; + +#else + +/* C interface definition for IOPCBrowseServerAddressSpace */ + +interface IOPCBrowseServerAddressSpace + { + const IOPCBrowseServerAddressSpaceVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IOPCBrowseServerAddressSpace; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, GetState, (IOPCGroupStateMgt* pThis, DWORD* pUpdateRate, BOOL* pActive, LPWSTR* ppName, LONG* pTimeBias, FLOAT* pPercentDeadband, DWORD* pLCID, OPCHANDLE* phClientGroup, OPCHANDLE* phServerGroup)); + +#define IOPCGroupStateMgt_GetState(pThis, pUpdateRate, pActive, ppName, pTimeBias, pPercentDeadband, pLCID, phClientGroup, phServerGroup) pThis->lpVtbl->GetState(COM_ADJUST_THIS(pThis), pUpdateRate, pActive, ppName, pTimeBias, pPercentDeadband, pLCID, phClientGroup, phServerGroup) + + COM_VTBL_ENTRY (HRESULT, SetState, (IOPCGroupStateMgt* pThis, DWORD* pRequestedUpdateRate, DWORD* pRevisedUpdateRate, BOOL* pActive, LONG* pTimeBias, FLOAT* pPercentDeadband, DWORD* pLCID, OPCHANDLE* phClientGroup)); + +#define IOPCGroupStateMgt_SetState(pThis, pRequestedUpdateRate, pRevisedUpdateRate, pActive, pTimeBias, pPercentDeadband, pLCID, phClientGroup) pThis->lpVtbl->SetState(COM_ADJUST_THIS(pThis), pRequestedUpdateRate, pRevisedUpdateRate, pActive, pTimeBias, pPercentDeadband, pLCID, phClientGroup) + + COM_VTBL_ENTRY (HRESULT, SetName, (IOPCGroupStateMgt* pThis, LPCWSTR szName)); + +#define IOPCGroupStateMgt_SetName(pThis, szName) pThis->lpVtbl->SetName(COM_ADJUST_THIS(pThis), szName) + + COM_VTBL_ENTRY (HRESULT, CloneGroup, (IOPCGroupStateMgt* pThis, LPCWSTR szName, REFIID riid, LPUNKNOWN* ppUnk)); + +#define IOPCGroupStateMgt_CloneGroup(pThis, szName, riid, ppUnk) pThis->lpVtbl->CloneGroup(COM_ADJUST_THIS(pThis), szName, riid, ppUnk) + + COM_VTBL_END + } IOPCGroupStateMgtVtbl; + +#ifdef __cplusplus + +interface IOPCGroupStateMgt : public IUnknown +{ +virtual HRESULT GetState (DWORD* pUpdateRate, BOOL* pActive, LPWSTR* ppName, LONG* pTimeBias, FLOAT* pPercentDeadband, DWORD* pLCID, OPCHANDLE* phClientGroup, OPCHANDLE* phServerGroup) =0; + +virtual HRESULT SetState (DWORD* pRequestedUpdateRate, DWORD* pRevisedUpdateRate, BOOL* pActive, LONG* pTimeBias, FLOAT* pPercentDeadband, DWORD* pLCID, OPCHANDLE* phClientGroup) =0; + +virtual HRESULT SetName (LPCWSTR szName) =0; + +virtual HRESULT CloneGroup (LPCWSTR szName, REFIID riid, LPUNKNOWN* ppUnk) =0; + +}; + +#else + +/* C interface definition for IOPCGroupStateMgt */ + +interface IOPCGroupStateMgt + { + const IOPCGroupStateMgtVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IOPCGroupStateMgt; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, GetState, (IOPCPublicGroupStateMgt* pThis, BOOL* pPublic)); + +#define IOPCPublicGroupStateMgt_GetState(pThis, pPublic) pThis->lpVtbl->GetState(COM_ADJUST_THIS(pThis), pPublic) + + COM_VTBL_ENTRY (HRESULT, MoveToPublic, (IOPCPublicGroupStateMgt* pThis)); + +#define IOPCPublicGroupStateMgt_MoveToPublic(pThis) pThis->lpVtbl->MoveToPublic(COM_ADJUST_THIS(pThis)) + + COM_VTBL_END + } IOPCPublicGroupStateMgtVtbl; + +#ifdef __cplusplus + +interface IOPCPublicGroupStateMgt : public IUnknown +{ +virtual HRESULT GetState (BOOL* pPublic) =0; + +virtual HRESULT MoveToPublic () =0; + +}; + +#else + +/* C interface definition for IOPCPublicGroupStateMgt */ + +interface IOPCPublicGroupStateMgt + { + const IOPCPublicGroupStateMgtVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IOPCPublicGroupStateMgt; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, Read, (IOPCSyncIO* pThis, OPCDATASOURCE dwSource, DWORD dwCount, OPCHANDLE* phServer, OPCITEMSTATE** ppItemValues, HRESULT** ppErrors)); + +#define IOPCSyncIO_Read(pThis, dwSource, dwCount, phServer, ppItemValues, ppErrors) pThis->lpVtbl->Read(COM_ADJUST_THIS(pThis), dwSource, dwCount, phServer, ppItemValues, ppErrors) + + COM_VTBL_ENTRY (HRESULT, Write, (IOPCSyncIO* pThis, DWORD dwCount, OPCHANDLE* phServer, VARIANT* pItemValues, HRESULT** ppErrors)); + +#define IOPCSyncIO_Write(pThis, dwCount, phServer, pItemValues, ppErrors) pThis->lpVtbl->Write(COM_ADJUST_THIS(pThis), dwCount, phServer, pItemValues, ppErrors) + + COM_VTBL_END + } IOPCSyncIOVtbl; + +#ifdef __cplusplus + +interface IOPCSyncIO : public IUnknown +{ +virtual HRESULT Read (OPCDATASOURCE dwSource, DWORD dwCount, OPCHANDLE* phServer, OPCITEMSTATE** ppItemValues, HRESULT** ppErrors) =0; + +virtual HRESULT Write (DWORD dwCount, OPCHANDLE* phServer, VARIANT* pItemValues, HRESULT** ppErrors) =0; + +}; + +#else + +/* C interface definition for IOPCSyncIO */ + +interface IOPCSyncIO + { + const IOPCSyncIOVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IOPCSyncIO; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, Read, (IOPCAsyncIO* pThis, DWORD dwConnection, OPCDATASOURCE dwSource, DWORD dwCount, OPCHANDLE* phServer, DWORD* pTransactionID, HRESULT** ppErrors)); + +#define IOPCAsyncIO_Read(pThis, dwConnection, dwSource, dwCount, phServer, pTransactionID, ppErrors) pThis->lpVtbl->Read(COM_ADJUST_THIS(pThis), dwConnection, dwSource, dwCount, phServer, pTransactionID, ppErrors) + + COM_VTBL_ENTRY (HRESULT, Write, (IOPCAsyncIO* pThis, DWORD dwConnection, DWORD dwCount, OPCHANDLE* phServer, VARIANT* pItemValues, DWORD* pTransactionID, HRESULT** ppErrors)); + +#define IOPCAsyncIO_Write(pThis, dwConnection, dwCount, phServer, pItemValues, pTransactionID, ppErrors) pThis->lpVtbl->Write(COM_ADJUST_THIS(pThis), dwConnection, dwCount, phServer, pItemValues, pTransactionID, ppErrors) + + COM_VTBL_ENTRY (HRESULT, Refresh, (IOPCAsyncIO* pThis, DWORD dwConnection, OPCDATASOURCE dwSource, DWORD* pTransactionID)); + +#define IOPCAsyncIO_Refresh(pThis, dwConnection, dwSource, pTransactionID) pThis->lpVtbl->Refresh(COM_ADJUST_THIS(pThis), dwConnection, dwSource, pTransactionID) + + COM_VTBL_ENTRY (HRESULT, Cancel, (IOPCAsyncIO* pThis, DWORD dwTransactionID)); + +#define IOPCAsyncIO_Cancel(pThis, dwTransactionID) pThis->lpVtbl->Cancel(COM_ADJUST_THIS(pThis), dwTransactionID) + + COM_VTBL_END + } IOPCAsyncIOVtbl; + +#ifdef __cplusplus + +interface IOPCAsyncIO : public IUnknown +{ +virtual HRESULT Read (DWORD dwConnection, OPCDATASOURCE dwSource, DWORD dwCount, OPCHANDLE* phServer, DWORD* pTransactionID, HRESULT** ppErrors) =0; + +virtual HRESULT Write (DWORD dwConnection, DWORD dwCount, OPCHANDLE* phServer, VARIANT* pItemValues, DWORD* pTransactionID, HRESULT** ppErrors) =0; + +virtual HRESULT Refresh (DWORD dwConnection, OPCDATASOURCE dwSource, DWORD* pTransactionID) =0; + +virtual HRESULT Cancel (DWORD dwTransactionID) =0; + +}; + +#else + +/* C interface definition for IOPCAsyncIO */ + +interface IOPCAsyncIO + { + const IOPCAsyncIOVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IOPCAsyncIO; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, AddItems, (IOPCItemMgt* pThis, DWORD dwCount, OPCITEMDEF* pItemArray, OPCITEMRESULT** ppAddResults, HRESULT** ppErrors)); + +#define IOPCItemMgt_AddItems(pThis, dwCount, pItemArray, ppAddResults, ppErrors) pThis->lpVtbl->AddItems(COM_ADJUST_THIS(pThis), dwCount, pItemArray, ppAddResults, ppErrors) + + COM_VTBL_ENTRY (HRESULT, ValidateItems, (IOPCItemMgt* pThis, DWORD dwCount, OPCITEMDEF* pItemArray, BOOL bBlobUpdate, OPCITEMRESULT** ppValidationResults, HRESULT** ppErrors)); + +#define IOPCItemMgt_ValidateItems(pThis, dwCount, pItemArray, bBlobUpdate, ppValidationResults, ppErrors) pThis->lpVtbl->ValidateItems(COM_ADJUST_THIS(pThis), dwCount, pItemArray, bBlobUpdate, ppValidationResults, ppErrors) + + COM_VTBL_ENTRY (HRESULT, RemoveItems, (IOPCItemMgt* pThis, DWORD dwCount, OPCHANDLE* phServer, HRESULT** ppErrors)); + +#define IOPCItemMgt_RemoveItems(pThis, dwCount, phServer, ppErrors) pThis->lpVtbl->RemoveItems(COM_ADJUST_THIS(pThis), dwCount, phServer, ppErrors) + + COM_VTBL_ENTRY (HRESULT, SetActiveState, (IOPCItemMgt* pThis, DWORD dwCount, OPCHANDLE* phServer, BOOL bActive, HRESULT** ppErrors)); + +#define IOPCItemMgt_SetActiveState(pThis, dwCount, phServer, bActive, ppErrors) pThis->lpVtbl->SetActiveState(COM_ADJUST_THIS(pThis), dwCount, phServer, bActive, ppErrors) + + COM_VTBL_ENTRY (HRESULT, SetClientHandles, (IOPCItemMgt* pThis, DWORD dwCount, OPCHANDLE* phServer, OPCHANDLE* phClient, HRESULT** ppErrors)); + +#define IOPCItemMgt_SetClientHandles(pThis, dwCount, phServer, phClient, ppErrors) pThis->lpVtbl->SetClientHandles(COM_ADJUST_THIS(pThis), dwCount, phServer, phClient, ppErrors) + + COM_VTBL_ENTRY (HRESULT, SetDatatypes, (IOPCItemMgt* pThis, DWORD dwCount, OPCHANDLE* phServer, VARTYPE* pRequestedDatatypes, HRESULT** ppErrors)); + +#define IOPCItemMgt_SetDatatypes(pThis, dwCount, phServer, pRequestedDatatypes, ppErrors) pThis->lpVtbl->SetDatatypes(COM_ADJUST_THIS(pThis), dwCount, phServer, pRequestedDatatypes, ppErrors) + + COM_VTBL_ENTRY (HRESULT, CreateEnumerator, (IOPCItemMgt* pThis, REFIID riid, LPUNKNOWN* ppUnk)); + +#define IOPCItemMgt_CreateEnumerator(pThis, riid, ppUnk) pThis->lpVtbl->CreateEnumerator(COM_ADJUST_THIS(pThis), riid, ppUnk) + + COM_VTBL_END + } IOPCItemMgtVtbl; + +#ifdef __cplusplus + +interface IOPCItemMgt : public IUnknown +{ +virtual HRESULT AddItems (DWORD dwCount, OPCITEMDEF* pItemArray, OPCITEMRESULT** ppAddResults, HRESULT** ppErrors) =0; + +virtual HRESULT ValidateItems (DWORD dwCount, OPCITEMDEF* pItemArray, BOOL bBlobUpdate, OPCITEMRESULT** ppValidationResults, HRESULT** ppErrors) =0; + +virtual HRESULT RemoveItems (DWORD dwCount, OPCHANDLE* phServer, HRESULT** ppErrors) =0; + +virtual HRESULT SetActiveState (DWORD dwCount, OPCHANDLE* phServer, BOOL bActive, HRESULT** ppErrors) =0; + +virtual HRESULT SetClientHandles (DWORD dwCount, OPCHANDLE* phServer, OPCHANDLE* phClient, HRESULT** ppErrors) =0; + +virtual HRESULT SetDatatypes (DWORD dwCount, OPCHANDLE* phServer, VARTYPE* pRequestedDatatypes, HRESULT** ppErrors) =0; + +virtual HRESULT CreateEnumerator (REFIID riid, LPUNKNOWN* ppUnk) =0; + +}; + +#else + +/* C interface definition for IOPCItemMgt */ + +interface IOPCItemMgt + { + const IOPCItemMgtVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IOPCItemMgt; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, Next, (IEnumOPCItemAttributes* pThis, ULONG celt, OPCITEMATTRIBUTES** ppItemArray, ULONG* pceltFetched)); + +#define IEnumOPCItemAttributes_Next(pThis, celt, ppItemArray, pceltFetched) pThis->lpVtbl->Next(COM_ADJUST_THIS(pThis), celt, ppItemArray, pceltFetched) + + COM_VTBL_ENTRY (HRESULT, Skip, (IEnumOPCItemAttributes* pThis, ULONG celt)); + +#define IEnumOPCItemAttributes_Skip(pThis, celt) pThis->lpVtbl->Skip(COM_ADJUST_THIS(pThis), celt) + + COM_VTBL_ENTRY (HRESULT, Reset, (IEnumOPCItemAttributes* pThis)); + +#define IEnumOPCItemAttributes_Reset(pThis) pThis->lpVtbl->Reset(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, Clone, (IEnumOPCItemAttributes* pThis, IEnumOPCItemAttributes** ppEnumItemAttributes)); + +#define IEnumOPCItemAttributes_Clone(pThis, ppEnumItemAttributes) pThis->lpVtbl->Clone(COM_ADJUST_THIS(pThis), ppEnumItemAttributes) + + COM_VTBL_END + } IEnumOPCItemAttributesVtbl; + +#ifdef __cplusplus + +interface IEnumOPCItemAttributes : public IUnknown +{ +virtual HRESULT Next (ULONG celt, OPCITEMATTRIBUTES** ppItemArray, ULONG* pceltFetched) =0; + +virtual HRESULT Skip (ULONG celt) =0; + +virtual HRESULT Reset () =0; + +virtual HRESULT Clone (IEnumOPCItemAttributes** ppEnumItemAttributes) =0; + +}; + +#else + +/* C interface definition for IEnumOPCItemAttributes */ + +interface IEnumOPCItemAttributes + { + const IEnumOPCItemAttributesVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IEnumOPCItemAttributes; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, OnDataChange, (IOPCDataCallback* pThis, DWORD dwTransid, OPCHANDLE hGroup, HRESULT hrMasterquality, HRESULT hrMastererror, DWORD dwCount, OPCHANDLE* phClientItems, VARIANT* pvValues, WORD* pwQualities, FILETIME* pftTimeStamps, HRESULT* pErrors)); + +#define IOPCDataCallback_OnDataChange(pThis, dwTransid, hGroup, hrMasterquality, hrMastererror, dwCount, phClientItems, pvValues, pwQualities, pftTimeStamps, pErrors) pThis->lpVtbl->OnDataChange(COM_ADJUST_THIS(pThis), dwTransid, hGroup, hrMasterquality, hrMastererror, dwCount, phClientItems, pvValues, pwQualities, pftTimeStamps, pErrors) + + COM_VTBL_ENTRY (HRESULT, OnReadComplete, (IOPCDataCallback* pThis, DWORD dwTransid, OPCHANDLE hGroup, HRESULT hrMasterquality, HRESULT hrMastererror, DWORD dwCount, OPCHANDLE* phClientItems, VARIANT* pvValues, WORD* pwQualities, FILETIME* pftTimeStamps, HRESULT* pErrors)); + +#define IOPCDataCallback_OnReadComplete(pThis, dwTransid, hGroup, hrMasterquality, hrMastererror, dwCount, phClientItems, pvValues, pwQualities, pftTimeStamps, pErrors) pThis->lpVtbl->OnReadComplete(COM_ADJUST_THIS(pThis), dwTransid, hGroup, hrMasterquality, hrMastererror, dwCount, phClientItems, pvValues, pwQualities, pftTimeStamps, pErrors) + + COM_VTBL_ENTRY (HRESULT, OnWriteComplete, (IOPCDataCallback* pThis, DWORD dwTransid, OPCHANDLE hGroup, HRESULT hrMastererr, DWORD dwCount, OPCHANDLE* pClienthandles, HRESULT* pErrors)); + +#define IOPCDataCallback_OnWriteComplete(pThis, dwTransid, hGroup, hrMastererr, dwCount, pClienthandles, pErrors) pThis->lpVtbl->OnWriteComplete(COM_ADJUST_THIS(pThis), dwTransid, hGroup, hrMastererr, dwCount, pClienthandles, pErrors) + + COM_VTBL_ENTRY (HRESULT, OnCancelComplete, (IOPCDataCallback* pThis, DWORD dwTransid, OPCHANDLE hGroup)); + +#define IOPCDataCallback_OnCancelComplete(pThis, dwTransid, hGroup) pThis->lpVtbl->OnCancelComplete(COM_ADJUST_THIS(pThis), dwTransid, hGroup) + + COM_VTBL_END + } IOPCDataCallbackVtbl; + +#ifdef __cplusplus + +interface IOPCDataCallback : public IUnknown +{ +virtual HRESULT OnDataChange (DWORD dwTransid, OPCHANDLE hGroup, HRESULT hrMasterquality, HRESULT hrMastererror, DWORD dwCount, OPCHANDLE* phClientItems, VARIANT* pvValues, WORD* pwQualities, FILETIME* pftTimeStamps, HRESULT* pErrors) =0; + +virtual HRESULT OnReadComplete (DWORD dwTransid, OPCHANDLE hGroup, HRESULT hrMasterquality, HRESULT hrMastererror, DWORD dwCount, OPCHANDLE* phClientItems, VARIANT* pvValues, WORD* pwQualities, FILETIME* pftTimeStamps, HRESULT* pErrors) =0; + +virtual HRESULT OnWriteComplete (DWORD dwTransid, OPCHANDLE hGroup, HRESULT hrMastererr, DWORD dwCount, OPCHANDLE* pClienthandles, HRESULT* pErrors) =0; + +virtual HRESULT OnCancelComplete (DWORD dwTransid, OPCHANDLE hGroup) =0; + +}; + +#else + +/* C interface definition for IOPCDataCallback */ + +interface IOPCDataCallback + { + const IOPCDataCallbackVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IOPCDataCallback; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, Read, (IOPCAsyncIO2* pThis, DWORD dwCount, OPCHANDLE* phServer, DWORD dwTransactionID, DWORD* pdwCancelID, HRESULT** ppErrors)); + +#define IOPCAsyncIO2_Read(pThis, dwCount, phServer, dwTransactionID, pdwCancelID, ppErrors) pThis->lpVtbl->Read(COM_ADJUST_THIS(pThis), dwCount, phServer, dwTransactionID, pdwCancelID, ppErrors) + + COM_VTBL_ENTRY (HRESULT, Write, (IOPCAsyncIO2* pThis, DWORD dwCount, OPCHANDLE* phServer, VARIANT* pItemValues, DWORD dwTransactionID, DWORD* pdwCancelID, HRESULT** ppErrors)); + +#define IOPCAsyncIO2_Write(pThis, dwCount, phServer, pItemValues, dwTransactionID, pdwCancelID, ppErrors) pThis->lpVtbl->Write(COM_ADJUST_THIS(pThis), dwCount, phServer, pItemValues, dwTransactionID, pdwCancelID, ppErrors) + + COM_VTBL_ENTRY (HRESULT, Refresh2, (IOPCAsyncIO2* pThis, OPCDATASOURCE dwSource, DWORD dwTransactionID, DWORD* pdwCancelID)); + +#define IOPCAsyncIO2_Refresh2(pThis, dwSource, dwTransactionID, pdwCancelID) pThis->lpVtbl->Refresh2(COM_ADJUST_THIS(pThis), dwSource, dwTransactionID, pdwCancelID) + + COM_VTBL_ENTRY (HRESULT, Cancel2, (IOPCAsyncIO2* pThis, DWORD dwCancelID)); + +#define IOPCAsyncIO2_Cancel2(pThis, dwCancelID) pThis->lpVtbl->Cancel2(COM_ADJUST_THIS(pThis), dwCancelID) + + COM_VTBL_ENTRY (HRESULT, SetEnable, (IOPCAsyncIO2* pThis, BOOL bEnable)); + +#define IOPCAsyncIO2_SetEnable(pThis, bEnable) pThis->lpVtbl->SetEnable(COM_ADJUST_THIS(pThis), bEnable) + + COM_VTBL_ENTRY (HRESULT, GetEnable, (IOPCAsyncIO2* pThis, BOOL* pbEnable)); + +#define IOPCAsyncIO2_GetEnable(pThis, pbEnable) pThis->lpVtbl->GetEnable(COM_ADJUST_THIS(pThis), pbEnable) + + COM_VTBL_END + } IOPCAsyncIO2Vtbl; + +#ifdef __cplusplus + +interface IOPCAsyncIO2 : public IUnknown +{ +virtual HRESULT Read (DWORD dwCount, OPCHANDLE* phServer, DWORD dwTransactionID, DWORD* pdwCancelID, HRESULT** ppErrors) =0; + +virtual HRESULT Write (DWORD dwCount, OPCHANDLE* phServer, VARIANT* pItemValues, DWORD dwTransactionID, DWORD* pdwCancelID, HRESULT** ppErrors) =0; + +virtual HRESULT Refresh2 (OPCDATASOURCE dwSource, DWORD dwTransactionID, DWORD* pdwCancelID) =0; + +virtual HRESULT Cancel2 (DWORD dwCancelID) =0; + +virtual HRESULT SetEnable (BOOL bEnable) =0; + +virtual HRESULT GetEnable (BOOL* pbEnable) =0; + +}; + +#else + +/* C interface definition for IOPCAsyncIO2 */ + +interface IOPCAsyncIO2 + { + const IOPCAsyncIO2Vtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IOPCAsyncIO2; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, QueryAvailableProperties, (IOPCItemProperties* pThis, LPWSTR szItemID, DWORD* pdwCount, DWORD** ppPropertyIDs, LPWSTR** ppDescriptions, VARTYPE** ppvtDataTypes)); + +#define IOPCItemProperties_QueryAvailableProperties(pThis, szItemID, pdwCount, ppPropertyIDs, ppDescriptions, ppvtDataTypes) pThis->lpVtbl->QueryAvailableProperties(COM_ADJUST_THIS(pThis), szItemID, pdwCount, ppPropertyIDs, ppDescriptions, ppvtDataTypes) + + COM_VTBL_ENTRY (HRESULT, GetItemProperties, (IOPCItemProperties* pThis, LPWSTR szItemID, DWORD dwCount, DWORD* pdwPropertyIDs, VARIANT** ppvData, HRESULT** ppErrors)); + +#define IOPCItemProperties_GetItemProperties(pThis, szItemID, dwCount, pdwPropertyIDs, ppvData, ppErrors) pThis->lpVtbl->GetItemProperties(COM_ADJUST_THIS(pThis), szItemID, dwCount, pdwPropertyIDs, ppvData, ppErrors) + + COM_VTBL_ENTRY (HRESULT, LookupItemIDs, (IOPCItemProperties* pThis, LPWSTR szItemID, DWORD dwCount, DWORD* pdwPropertyIDs, LPWSTR** ppszNewItemIDs, HRESULT** ppErrors)); + +#define IOPCItemProperties_LookupItemIDs(pThis, szItemID, dwCount, pdwPropertyIDs, ppszNewItemIDs, ppErrors) pThis->lpVtbl->LookupItemIDs(COM_ADJUST_THIS(pThis), szItemID, dwCount, pdwPropertyIDs, ppszNewItemIDs, ppErrors) + + COM_VTBL_END + } IOPCItemPropertiesVtbl; + +#ifdef __cplusplus + +interface IOPCItemProperties : public IUnknown +{ +virtual HRESULT QueryAvailableProperties (LPWSTR szItemID, DWORD* pdwCount, DWORD** ppPropertyIDs, LPWSTR** ppDescriptions, VARTYPE** ppvtDataTypes) =0; + +virtual HRESULT GetItemProperties (LPWSTR szItemID, DWORD dwCount, DWORD* pdwPropertyIDs, VARIANT** ppvData, HRESULT** ppErrors) =0; + +virtual HRESULT LookupItemIDs (LPWSTR szItemID, DWORD dwCount, DWORD* pdwPropertyIDs, LPWSTR** ppszNewItemIDs, HRESULT** ppErrors) =0; + +}; + +#else + +/* C interface definition for IOPCItemProperties */ + +interface IOPCItemProperties + { + const IOPCItemPropertiesVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IOPCItemProperties; + +#ifdef __cplusplus +} +#endif + + + +#endif /* __INCopcda_h */ + + diff --git a/h/openssl/aes.h b/h/openssl/aes.h new file mode 100644 index 0000000..75d9bd5 --- /dev/null +++ b/h/openssl/aes.h @@ -0,0 +1,3 @@ +/* Empty file for backward compatibiliy only. + * To use cryptographic primatives, please use EVP API or CCI API. + */ diff --git a/h/openssl/asn1.h b/h/openssl/asn1.h new file mode 100644 index 0000000..dadcae8 --- /dev/null +++ b/h/openssl/asn1.h @@ -0,0 +1,1230 @@ +/* crypto/asn1/asn1.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_ASN1_H +#define HEADER_ASN1_H + +#include +#include +#ifndef OPENSSL_NO_BIO +#include +#endif +#include +#include + +#include + +#include +#ifndef OPENSSL_NO_DEPRECATED +#include +#endif + +#ifdef OPENSSL_BUILD_SHLIBCRYPTO +# undef OPENSSL_EXTERN +# define OPENSSL_EXTERN OPENSSL_EXPORT +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define V_ASN1_UNIVERSAL 0x00 +#define V_ASN1_APPLICATION 0x40 +#define V_ASN1_CONTEXT_SPECIFIC 0x80 +#define V_ASN1_PRIVATE 0xc0 + +#define V_ASN1_CONSTRUCTED 0x20 +#define V_ASN1_PRIMITIVE_TAG 0x1f +#define V_ASN1_PRIMATIVE_TAG 0x1f + +#define V_ASN1_APP_CHOOSE -2 /* let the recipient choose */ +#define V_ASN1_OTHER -3 /* used in ASN1_TYPE */ +#define V_ASN1_ANY -4 /* used in ASN1 template code */ + +#define V_ASN1_NEG 0x100 /* negative flag */ + +#define V_ASN1_UNDEF -1 +#define V_ASN1_EOC 0 +#define V_ASN1_BOOLEAN 1 /**/ +#define V_ASN1_INTEGER 2 +#define V_ASN1_NEG_INTEGER (2 | V_ASN1_NEG) +#define V_ASN1_BIT_STRING 3 +#define V_ASN1_OCTET_STRING 4 +#define V_ASN1_NULL 5 +#define V_ASN1_OBJECT 6 +#define V_ASN1_OBJECT_DESCRIPTOR 7 +#define V_ASN1_EXTERNAL 8 +#define V_ASN1_REAL 9 +#define V_ASN1_ENUMERATED 10 +#define V_ASN1_NEG_ENUMERATED (10 | V_ASN1_NEG) +#define V_ASN1_UTF8STRING 12 +#define V_ASN1_SEQUENCE 16 +#define V_ASN1_SET 17 +#define V_ASN1_NUMERICSTRING 18 /**/ +#define V_ASN1_PRINTABLESTRING 19 +#define V_ASN1_T61STRING 20 +#define V_ASN1_TELETEXSTRING 20 /* alias */ +#define V_ASN1_VIDEOTEXSTRING 21 /**/ +#define V_ASN1_IA5STRING 22 +#define V_ASN1_UTCTIME 23 +#define V_ASN1_GENERALIZEDTIME 24 /**/ +#define V_ASN1_GRAPHICSTRING 25 /**/ +#define V_ASN1_ISO64STRING 26 /**/ +#define V_ASN1_VISIBLESTRING 26 /* alias */ +#define V_ASN1_GENERALSTRING 27 /**/ +#define V_ASN1_UNIVERSALSTRING 28 /**/ +#define V_ASN1_BMPSTRING 30 + +/* For use with d2i_ASN1_type_bytes() */ +#define B_ASN1_NUMERICSTRING 0x0001 +#define B_ASN1_PRINTABLESTRING 0x0002 +#define B_ASN1_T61STRING 0x0004 +#define B_ASN1_TELETEXSTRING 0x0004 +#define B_ASN1_VIDEOTEXSTRING 0x0008 +#define B_ASN1_IA5STRING 0x0010 +#define B_ASN1_GRAPHICSTRING 0x0020 +#define B_ASN1_ISO64STRING 0x0040 +#define B_ASN1_VISIBLESTRING 0x0040 +#define B_ASN1_GENERALSTRING 0x0080 +#define B_ASN1_UNIVERSALSTRING 0x0100 +#define B_ASN1_OCTET_STRING 0x0200 +#define B_ASN1_BIT_STRING 0x0400 +#define B_ASN1_BMPSTRING 0x0800 +#define B_ASN1_UNKNOWN 0x1000 +#define B_ASN1_UTF8STRING 0x2000 +#define B_ASN1_UTCTIME 0x4000 +#define B_ASN1_GENERALIZEDTIME 0x8000 + +/* For use with ASN1_mbstring_copy() */ +#define MBSTRING_FLAG 0x1000 +#define MBSTRING_UTF8 (MBSTRING_FLAG) +#define MBSTRING_ASC (MBSTRING_FLAG|1) +#define MBSTRING_BMP (MBSTRING_FLAG|2) +#define MBSTRING_UNIV (MBSTRING_FLAG|4) + +struct X509_algor_st; + +#define DECLARE_ASN1_SET_OF(type) /* filled in by mkstack.pl */ +#define IMPLEMENT_ASN1_SET_OF(type) /* nothing, no longer needed */ + +/* We MUST make sure that, except for constness, asn1_ctx_st and + asn1_const_ctx are exactly the same. Fortunately, as soon as + the old ASN1 parsing macros are gone, we can throw this away + as well... */ +typedef struct asn1_ctx_st + { + unsigned char *p;/* work char pointer */ + int eos; /* end of sequence read for indefinite encoding */ + int error; /* error code to use when returning an error */ + int inf; /* constructed if 0x20, indefinite is 0x21 */ + int tag; /* tag from last 'get object' */ + int xclass; /* class from last 'get object' */ + long slen; /* length of last 'get object' */ + unsigned char *max; /* largest value of p allowed */ + unsigned char *q;/* temporary variable */ + unsigned char **pp;/* variable */ + int line; /* used in error processing */ + } ASN1_CTX; + +typedef struct asn1_const_ctx_st + { + const unsigned char *p;/* work char pointer */ + int eos; /* end of sequence read for indefinite encoding */ + int error; /* error code to use when returning an error */ + int inf; /* constructed if 0x20, indefinite is 0x21 */ + int tag; /* tag from last 'get object' */ + int xclass; /* class from last 'get object' */ + long slen; /* length of last 'get object' */ + const unsigned char *max; /* largest value of p allowed */ + const unsigned char *q;/* temporary variable */ + const unsigned char **pp;/* variable */ + int line; /* used in error processing */ + } ASN1_const_CTX; + +/* These are used internally in the ASN1_OBJECT to keep track of + * whether the names and data need to be free()ed */ +#define ASN1_OBJECT_FLAG_DYNAMIC 0x01 /* internal use */ +#define ASN1_OBJECT_FLAG_CRITICAL 0x02 /* critical x509v3 object id */ +#define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04 /* internal use */ +#define ASN1_OBJECT_FLAG_DYNAMIC_DATA 0x08 /* internal use */ +typedef struct asn1_object_st + { + const char *sn,*ln; + int nid; + int length; + unsigned char *data; + int flags; /* Should we free this one */ + } ASN1_OBJECT; + +#define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */ +/* This indicates that the ASN1_STRING is not a real value but just a place + * holder for the location where indefinite length constructed data should + * be inserted in the memory buffer + */ +#define ASN1_STRING_FLAG_NDEF 0x010 +/* This is the base type that holds just about everything :-) */ +typedef struct asn1_string_st + { + int length; + int type; + unsigned char *data; + /* The value of the following field depends on the type being + * held. It is mostly being used for BIT_STRING so if the + * input data has a non-zero 'unused bits' value, it will be + * handled correctly */ + long flags; + } ASN1_STRING; + +/* ASN1_ENCODING structure: this is used to save the received + * encoding of an ASN1 type. This is useful to get round + * problems with invalid encodings which can break signatures. + */ + +typedef struct ASN1_ENCODING_st + { + unsigned char *enc; /* DER encoding */ + long len; /* Length of encoding */ + int modified; /* set to 1 if 'enc' is invalid */ + } ASN1_ENCODING; + +/* Used with ASN1 LONG type: if a long is set to this it is omitted */ +#define ASN1_LONG_UNDEF 0x7fffffffL + +#define STABLE_FLAGS_MALLOC 0x01 +#define STABLE_NO_MASK 0x02 +#define DIRSTRING_TYPE \ + (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING) +#define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING) + +typedef struct asn1_string_table_st { + int nid; + long minsize; + long maxsize; + unsigned long mask; + unsigned long flags; +} ASN1_STRING_TABLE; + +DECLARE_STACK_OF(ASN1_STRING_TABLE) + +/* size limits: this stuff is taken straight from RFC2459 */ + +#define ub_name 32768 +#define ub_common_name 64 +#define ub_locality_name 128 +#define ub_state_name 128 +#define ub_organization_name 64 +#define ub_organization_unit_name 64 +#define ub_title 64 +#define ub_email_address 128 + +/* Declarations for template structures: for full definitions + * see asn1t.h + */ +typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE; +typedef struct ASN1_ITEM_st ASN1_ITEM; +typedef struct ASN1_TLC_st ASN1_TLC; +/* This is just an opaque pointer */ +typedef struct ASN1_VALUE_st ASN1_VALUE; + +/* Declare ASN1 functions: the implement macro in in asn1t.h */ + +#define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type) + +#define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type) + +#define DECLARE_ASN1_FUNCTIONS_name(type, name) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) + +#define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) + +#define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \ + type *d2i_##name(type **a, const unsigned char **in, long len); \ + int i2d_##name(type *a, unsigned char **out); \ + DECLARE_ASN1_ITEM(itname) + +#define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \ + type *d2i_##name(type **a, const unsigned char **in, long len); \ + int i2d_##name(const type *a, unsigned char **out); \ + DECLARE_ASN1_ITEM(name) + +#define DECLARE_ASN1_NDEF_FUNCTION(name) \ + int i2d_##name##_NDEF(name *a, unsigned char **out); + +#define DECLARE_ASN1_FUNCTIONS_const(name) \ + name *name##_new(void); \ + void name##_free(name *a); + +#define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ + type *name##_new(void); \ + void name##_free(type *a); + +#define D2I_OF(type) type *(*)(type **,const unsigned char **,long) +#define I2D_OF(type) int (*)(type *,unsigned char **) +#define I2D_OF_const(type) int (*)(const type *,unsigned char **) + +#define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long) +#define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **) +#define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type) + +TYPEDEF_D2I2D_OF(void); + +/* The following macros and typedefs allow an ASN1_ITEM + * to be embedded in a structure and referenced. Since + * the ASN1_ITEM pointers need to be globally accessible + * (possibly from shared libraries) they may exist in + * different forms. On platforms that support it the + * ASN1_ITEM structure itself will be globally exported. + * Other platforms will export a function that returns + * an ASN1_ITEM pointer. + * + * To handle both cases transparently the macros below + * should be used instead of hard coding an ASN1_ITEM + * pointer in a structure. + * + * The structure will look like this: + * + * typedef struct SOMETHING_st { + * ... + * ASN1_ITEM_EXP *iptr; + * ... + * } SOMETHING; + * + * It would be initialised as e.g.: + * + * SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...}; + * + * and the actual pointer extracted with: + * + * const ASN1_ITEM *it = ASN1_ITEM_ptr(somevar.iptr); + * + * Finally an ASN1_ITEM pointer can be extracted from an + * appropriate reference with: ASN1_ITEM_rptr(X509). This + * would be used when a function takes an ASN1_ITEM * argument. + * + */ + +#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION + +/* ASN1_ITEM pointer exported type */ +typedef const ASN1_ITEM ASN1_ITEM_EXP; + +/* Macro to obtain ASN1_ITEM pointer from exported type */ +#define ASN1_ITEM_ptr(iptr) (iptr) + +/* Macro to include ASN1_ITEM pointer from base type */ +#define ASN1_ITEM_ref(iptr) (&(iptr##_it)) + +#define ASN1_ITEM_rptr(ref) (&(ref##_it)) + +#define DECLARE_ASN1_ITEM(name) \ + OPENSSL_EXTERN const ASN1_ITEM name##_it; + +#else + +/* Platforms that can't easily handle shared global variables are declared + * as functions returning ASN1_ITEM pointers. + */ + +/* ASN1_ITEM pointer exported type */ +typedef const ASN1_ITEM * ASN1_ITEM_EXP(void); + +/* Macro to obtain ASN1_ITEM pointer from exported type */ +#define ASN1_ITEM_ptr(iptr) (iptr()) + +/* Macro to include ASN1_ITEM pointer from base type */ +#define ASN1_ITEM_ref(iptr) (iptr##_it) + +#define ASN1_ITEM_rptr(ref) (ref##_it()) + +#define DECLARE_ASN1_ITEM(name) \ + const ASN1_ITEM * name##_it(void); + +#endif + +/* Parameters used by ASN1_STRING_print_ex() */ + +/* These determine which characters to escape: + * RFC2253 special characters, control characters and + * MSB set characters + */ + +#define ASN1_STRFLGS_ESC_2253 1 +#define ASN1_STRFLGS_ESC_CTRL 2 +#define ASN1_STRFLGS_ESC_MSB 4 + + +/* This flag determines how we do escaping: normally + * RC2253 backslash only, set this to use backslash and + * quote. + */ + +#define ASN1_STRFLGS_ESC_QUOTE 8 + + +/* These three flags are internal use only. */ + +/* Character is a valid PrintableString character */ +#define CHARTYPE_PRINTABLESTRING 0x10 +/* Character needs escaping if it is the first character */ +#define CHARTYPE_FIRST_ESC_2253 0x20 +/* Character needs escaping if it is the last character */ +#define CHARTYPE_LAST_ESC_2253 0x40 + +/* NB the internal flags are safely reused below by flags + * handled at the top level. + */ + +/* If this is set we convert all character strings + * to UTF8 first + */ + +#define ASN1_STRFLGS_UTF8_CONVERT 0x10 + +/* If this is set we don't attempt to interpret content: + * just assume all strings are 1 byte per character. This + * will produce some pretty odd looking output! + */ + +#define ASN1_STRFLGS_IGNORE_TYPE 0x20 + +/* If this is set we include the string type in the output */ +#define ASN1_STRFLGS_SHOW_TYPE 0x40 + +/* This determines which strings to display and which to + * 'dump' (hex dump of content octets or DER encoding). We can + * only dump non character strings or everything. If we + * don't dump 'unknown' they are interpreted as character + * strings with 1 octet per character and are subject to + * the usual escaping options. + */ + +#define ASN1_STRFLGS_DUMP_ALL 0x80 +#define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 + +/* These determine what 'dumping' does, we can dump the + * content octets or the DER encoding: both use the + * RFC2253 #XXXXX notation. + */ + +#define ASN1_STRFLGS_DUMP_DER 0x200 + +/* All the string flags consistent with RFC2253, + * escaping control characters isn't essential in + * RFC2253 but it is advisable anyway. + */ + +#define ASN1_STRFLGS_RFC2253 (ASN1_STRFLGS_ESC_2253 | \ + ASN1_STRFLGS_ESC_CTRL | \ + ASN1_STRFLGS_ESC_MSB | \ + ASN1_STRFLGS_UTF8_CONVERT | \ + ASN1_STRFLGS_DUMP_UNKNOWN | \ + ASN1_STRFLGS_DUMP_DER) + +DECLARE_STACK_OF(ASN1_INTEGER) +DECLARE_ASN1_SET_OF(ASN1_INTEGER) + +DECLARE_STACK_OF(ASN1_GENERALSTRING) + +typedef struct asn1_type_st + { + int type; + union { + char *ptr; + ASN1_BOOLEAN boolean; + ASN1_STRING * asn1_string; + ASN1_OBJECT * object; + ASN1_INTEGER * integer; + ASN1_ENUMERATED * enumerated; + ASN1_BIT_STRING * bit_string; + ASN1_OCTET_STRING * octet_string; + ASN1_PRINTABLESTRING * printablestring; + ASN1_T61STRING * t61string; + ASN1_IA5STRING * ia5string; + ASN1_GENERALSTRING * generalstring; + ASN1_BMPSTRING * bmpstring; + ASN1_UNIVERSALSTRING * universalstring; + ASN1_UTCTIME * utctime; + ASN1_GENERALIZEDTIME * generalizedtime; + ASN1_VISIBLESTRING * visiblestring; + ASN1_UTF8STRING * utf8string; + /* set and sequence are left complete and still + * contain the set or sequence bytes */ + ASN1_STRING * set; + ASN1_STRING * sequence; + } value; + } ASN1_TYPE; + +DECLARE_STACK_OF(ASN1_TYPE) +DECLARE_ASN1_SET_OF(ASN1_TYPE) + +typedef struct asn1_method_st + { + i2d_of_void *i2d; + d2i_of_void *d2i; + void *(*create)(void); + void (*destroy)(void *); + } ASN1_METHOD; + +/* This is used when parsing some Netscape objects */ +typedef struct asn1_header_st + { + ASN1_OCTET_STRING *header; + void *data; + ASN1_METHOD *meth; + } ASN1_HEADER; + +/* This is used to contain a list of bit names */ +typedef struct BIT_STRING_BITNAME_st { + int bitnum; + const char *lname; + const char *sname; +} BIT_STRING_BITNAME; + + +#define M_ASN1_STRING_length(x) ((x)->length) +#define M_ASN1_STRING_length_set(x, n) ((x)->length = (n)) +#define M_ASN1_STRING_type(x) ((x)->type) +#define M_ASN1_STRING_data(x) ((x)->data) + +/* Macros for string operations */ +#define M_ASN1_BIT_STRING_new() (ASN1_BIT_STRING *)\ + ASN1_STRING_type_new(V_ASN1_BIT_STRING) +#define M_ASN1_BIT_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_ASN1_BIT_STRING_dup(a) (ASN1_BIT_STRING *)\ + ASN1_STRING_dup((ASN1_STRING *)a) +#define M_ASN1_BIT_STRING_cmp(a,b) ASN1_STRING_cmp(\ + (ASN1_STRING *)a,(ASN1_STRING *)b) +#define M_ASN1_BIT_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c) + +#define M_ASN1_INTEGER_new() (ASN1_INTEGER *)\ + ASN1_STRING_type_new(V_ASN1_INTEGER) +#define M_ASN1_INTEGER_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_ASN1_INTEGER_dup(a) (ASN1_INTEGER *)ASN1_STRING_dup((ASN1_STRING *)a) +#define M_ASN1_INTEGER_cmp(a,b) ASN1_STRING_cmp(\ + (ASN1_STRING *)a,(ASN1_STRING *)b) + +#define M_ASN1_ENUMERATED_new() (ASN1_ENUMERATED *)\ + ASN1_STRING_type_new(V_ASN1_ENUMERATED) +#define M_ASN1_ENUMERATED_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)ASN1_STRING_dup((ASN1_STRING *)a) +#define M_ASN1_ENUMERATED_cmp(a,b) ASN1_STRING_cmp(\ + (ASN1_STRING *)a,(ASN1_STRING *)b) + +#define M_ASN1_OCTET_STRING_new() (ASN1_OCTET_STRING *)\ + ASN1_STRING_type_new(V_ASN1_OCTET_STRING) +#define M_ASN1_OCTET_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_ASN1_OCTET_STRING_dup(a) (ASN1_OCTET_STRING *)\ + ASN1_STRING_dup((ASN1_STRING *)a) +#define M_ASN1_OCTET_STRING_cmp(a,b) ASN1_STRING_cmp(\ + (ASN1_STRING *)a,(ASN1_STRING *)b) +#define M_ASN1_OCTET_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c) +#define M_ASN1_OCTET_STRING_print(a,b) ASN1_STRING_print(a,(ASN1_STRING *)b) +#define M_i2d_ASN1_OCTET_STRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_OCTET_STRING,\ + V_ASN1_UNIVERSAL) + +#define B_ASN1_TIME \ + B_ASN1_UTCTIME | \ + B_ASN1_GENERALIZEDTIME + +#define B_ASN1_PRINTABLE \ + B_ASN1_PRINTABLESTRING| \ + B_ASN1_T61STRING| \ + B_ASN1_IA5STRING| \ + B_ASN1_BIT_STRING| \ + B_ASN1_UNIVERSALSTRING|\ + B_ASN1_BMPSTRING|\ + B_ASN1_UTF8STRING|\ + B_ASN1_UNKNOWN + +#define B_ASN1_DIRECTORYSTRING \ + B_ASN1_PRINTABLESTRING| \ + B_ASN1_TELETEXSTRING|\ + B_ASN1_BMPSTRING|\ + B_ASN1_UNIVERSALSTRING|\ + B_ASN1_UTF8STRING + +#define B_ASN1_DISPLAYTEXT \ + B_ASN1_IA5STRING| \ + B_ASN1_VISIBLESTRING| \ + B_ASN1_BMPSTRING|\ + B_ASN1_UTF8STRING + +#define M_ASN1_PRINTABLE_new() ASN1_STRING_type_new(V_ASN1_T61STRING) +#define M_ASN1_PRINTABLE_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_PRINTABLE(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\ + pp,a->type,V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_PRINTABLE(a,pp,l) \ + d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \ + B_ASN1_PRINTABLE) + +#define M_DIRECTORYSTRING_new() ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING) +#define M_DIRECTORYSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_DIRECTORYSTRING(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\ + pp,a->type,V_ASN1_UNIVERSAL) +#define M_d2i_DIRECTORYSTRING(a,pp,l) \ + d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \ + B_ASN1_DIRECTORYSTRING) + +#define M_DISPLAYTEXT_new() ASN1_STRING_type_new(V_ASN1_VISIBLESTRING) +#define M_DISPLAYTEXT_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_DISPLAYTEXT(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\ + pp,a->type,V_ASN1_UNIVERSAL) +#define M_d2i_DISPLAYTEXT(a,pp,l) \ + d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \ + B_ASN1_DISPLAYTEXT) + +#define M_ASN1_PRINTABLESTRING_new() (ASN1_PRINTABLESTRING *)\ + ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING) +#define M_ASN1_PRINTABLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_PRINTABLESTRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_PRINTABLESTRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_PRINTABLESTRING(a,pp,l) \ + (ASN1_PRINTABLESTRING *)d2i_ASN1_type_bytes\ + ((ASN1_STRING **)a,pp,l,B_ASN1_PRINTABLESTRING) + +#define M_ASN1_T61STRING_new() (ASN1_T61STRING *)\ + ASN1_STRING_type_new(V_ASN1_T61STRING) +#define M_ASN1_T61STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_T61STRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_T61STRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_T61STRING(a,pp,l) \ + (ASN1_T61STRING *)d2i_ASN1_type_bytes\ + ((ASN1_STRING **)a,pp,l,B_ASN1_T61STRING) + +#define M_ASN1_IA5STRING_new() (ASN1_IA5STRING *)\ + ASN1_STRING_type_new(V_ASN1_IA5STRING) +#define M_ASN1_IA5STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_ASN1_IA5STRING_dup(a) \ + (ASN1_IA5STRING *)ASN1_STRING_dup((ASN1_STRING *)a) +#define M_i2d_ASN1_IA5STRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_IA5STRING(a,pp,l) \ + (ASN1_IA5STRING *)d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l,\ + B_ASN1_IA5STRING) + +#define M_ASN1_UTCTIME_new() (ASN1_UTCTIME *)\ + ASN1_STRING_type_new(V_ASN1_UTCTIME) +#define M_ASN1_UTCTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_ASN1_UTCTIME_dup(a) (ASN1_UTCTIME *)ASN1_STRING_dup((ASN1_STRING *)a) + +#define M_ASN1_GENERALIZEDTIME_new() (ASN1_GENERALIZEDTIME *)\ + ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME) +#define M_ASN1_GENERALIZEDTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_ASN1_GENERALIZEDTIME_dup(a) (ASN1_GENERALIZEDTIME *)ASN1_STRING_dup(\ + (ASN1_STRING *)a) + +#define M_ASN1_TIME_new() (ASN1_TIME *)\ + ASN1_STRING_type_new(V_ASN1_UTCTIME) +#define M_ASN1_TIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_ASN1_TIME_dup(a) (ASN1_TIME *)ASN1_STRING_dup((ASN1_STRING *)a) + +#define M_ASN1_GENERALSTRING_new() (ASN1_GENERALSTRING *)\ + ASN1_STRING_type_new(V_ASN1_GENERALSTRING) +#define M_ASN1_GENERALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_GENERALSTRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_GENERALSTRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_GENERALSTRING(a,pp,l) \ + (ASN1_GENERALSTRING *)d2i_ASN1_type_bytes\ + ((ASN1_STRING **)a,pp,l,B_ASN1_GENERALSTRING) + +#define M_ASN1_UNIVERSALSTRING_new() (ASN1_UNIVERSALSTRING *)\ + ASN1_STRING_type_new(V_ASN1_UNIVERSALSTRING) +#define M_ASN1_UNIVERSALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_UNIVERSALSTRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UNIVERSALSTRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_UNIVERSALSTRING(a,pp,l) \ + (ASN1_UNIVERSALSTRING *)d2i_ASN1_type_bytes\ + ((ASN1_STRING **)a,pp,l,B_ASN1_UNIVERSALSTRING) + +#define M_ASN1_BMPSTRING_new() (ASN1_BMPSTRING *)\ + ASN1_STRING_type_new(V_ASN1_BMPSTRING) +#define M_ASN1_BMPSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_BMPSTRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_BMPSTRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_BMPSTRING(a,pp,l) \ + (ASN1_BMPSTRING *)d2i_ASN1_type_bytes\ + ((ASN1_STRING **)a,pp,l,B_ASN1_BMPSTRING) + +#define M_ASN1_VISIBLESTRING_new() (ASN1_VISIBLESTRING *)\ + ASN1_STRING_type_new(V_ASN1_VISIBLESTRING) +#define M_ASN1_VISIBLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_VISIBLESTRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_VISIBLESTRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_VISIBLESTRING(a,pp,l) \ + (ASN1_VISIBLESTRING *)d2i_ASN1_type_bytes\ + ((ASN1_STRING **)a,pp,l,B_ASN1_VISIBLESTRING) + +#define M_ASN1_UTF8STRING_new() (ASN1_UTF8STRING *)\ + ASN1_STRING_type_new(V_ASN1_UTF8STRING) +#define M_ASN1_UTF8STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_UTF8STRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UTF8STRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_UTF8STRING(a,pp,l) \ + (ASN1_UTF8STRING *)d2i_ASN1_type_bytes\ + ((ASN1_STRING **)a,pp,l,B_ASN1_UTF8STRING) + + /* for the is_set parameter to i2d_ASN1_SET */ +#define IS_SEQUENCE 0 +#define IS_SET 1 + +DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE) + +int ASN1_TYPE_get(ASN1_TYPE *a); +void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value); + +ASN1_OBJECT * ASN1_OBJECT_new(void ); +void ASN1_OBJECT_free(ASN1_OBJECT *a); +int i2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp); +ASN1_OBJECT * c2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp, + long length); +ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp, + long length); + +DECLARE_ASN1_ITEM(ASN1_OBJECT) + +DECLARE_STACK_OF(ASN1_OBJECT) +DECLARE_ASN1_SET_OF(ASN1_OBJECT) + +ASN1_STRING * ASN1_STRING_new(void); +void ASN1_STRING_free(ASN1_STRING *a); +ASN1_STRING * ASN1_STRING_dup(ASN1_STRING *a); +ASN1_STRING * ASN1_STRING_type_new(int type ); +int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b); + /* Since this is used to store all sorts of things, via macros, for now, make + its data void * */ +int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len); +int ASN1_STRING_length(ASN1_STRING *x); +void ASN1_STRING_length_set(ASN1_STRING *x, int n); +int ASN1_STRING_type(ASN1_STRING *x); +unsigned char * ASN1_STRING_data(ASN1_STRING *x); + +DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING) +int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp); +ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,const unsigned char **pp, + long length); +int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, + int length ); +int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); +int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n); + +#ifndef OPENSSL_NO_BIO +int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, + BIT_STRING_BITNAME *tbl, int indent); +#endif +int ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl); +int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value, + BIT_STRING_BITNAME *tbl); + +int i2d_ASN1_BOOLEAN(int a,unsigned char **pp); +int d2i_ASN1_BOOLEAN(int *a,const unsigned char **pp,long length); + +DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER) +int i2c_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp); +ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,const unsigned char **pp, + long length); +ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp, + long length); +ASN1_INTEGER * ASN1_INTEGER_dup(ASN1_INTEGER *x); +int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y); + +DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED) + +int ASN1_UTCTIME_check(ASN1_UTCTIME *a); +ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t); +int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str); +int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t); +#if 0 +time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s); +#endif + +int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a); +ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t); +int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str); + +DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING) +ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *a); +int ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b); +int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len); + +DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING) +DECLARE_ASN1_FUNCTIONS(ASN1_NULL) +DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING) + +int UTF8_getc(const unsigned char *str, int len, unsigned long *val); +int UTF8_putc(unsigned char *str, int len, unsigned long value); + +DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE) + +DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING) +DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT) +DECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_T61STRING) +DECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING) +DECLARE_ASN1_FUNCTIONS(ASN1_GENERALSTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME) +DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME) +DECLARE_ASN1_FUNCTIONS(ASN1_TIME) + +DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF) + +ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t); +int ASN1_TIME_check(ASN1_TIME *t); +ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out); + +int i2d_ASN1_SET(STACK *a, unsigned char **pp, + i2d_of_void *i2d, int ex_tag, int ex_class, int is_set); +STACK * d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length, + d2i_of_void *d2i, void (*free_func)(void *), + int ex_tag, int ex_class); + +#ifndef OPENSSL_NO_BIO +int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a); +int a2i_ASN1_INTEGER(BIO *bp,ASN1_INTEGER *bs,char *buf,int size); +int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a); +int a2i_ASN1_ENUMERATED(BIO *bp,ASN1_ENUMERATED *bs,char *buf,int size); +int i2a_ASN1_OBJECT(BIO *bp,ASN1_OBJECT *a); +int a2i_ASN1_STRING(BIO *bp,ASN1_STRING *bs,char *buf,int size); +int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type); +#endif +int i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a); + +int a2d_ASN1_OBJECT(unsigned char *out,int olen, const char *buf, int num); +ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len, + const char *sn, const char *ln); + +int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); +long ASN1_INTEGER_get(ASN1_INTEGER *a); +ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai); +BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai,BIGNUM *bn); + +int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v); +long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a); +ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai); +BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai,BIGNUM *bn); + +/* General */ +/* given a string, return the correct type, max is the maximum length */ +int ASN1_PRINTABLE_type(const unsigned char *s, int max); + +int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass); +ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp, + long length, int Ptag, int Pclass); +unsigned long ASN1_tag2bit(int tag); +/* type is one or more of the B_ASN1_ values. */ +ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a,const unsigned char **pp, + long length,int type); + +/* PARSING */ +int asn1_Finish(ASN1_CTX *c); +int asn1_const_Finish(ASN1_const_CTX *c); + +/* SPECIALS */ +int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, + int *pclass, long omax); +int ASN1_check_infinite_end(unsigned char **p,long len); +int ASN1_const_check_infinite_end(const unsigned char **p,long len); +void ASN1_put_object(unsigned char **pp, int constructed, int length, + int tag, int xclass); +int ASN1_put_eoc(unsigned char **pp); +int ASN1_object_size(int constructed, int length, int tag); + +/* Used to implement other functions */ +void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x); +#define ASN1_dup_of(type,i2d,d2i,x) \ + ((type *(*)(I2D_OF(type),D2I_OF(type),type *))openssl_fcast(ASN1_dup))(i2d,d2i,x) +#define ASN1_dup_of_const(type,i2d,d2i,x) \ + ((type *(*)(I2D_OF_const(type),D2I_OF(type),type *))openssl_fcast(ASN1_dup))(i2d,d2i,x) + +void *ASN1_item_dup(const ASN1_ITEM *it, void *x); + +#ifndef OPENSSL_NO_FP_API +void *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x); +#define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \ + ((type *(*)(type *(*)(void),D2I_OF(type),FILE *,type **))openssl_fcast(ASN1_d2i_fp))(xnew,d2i,in,x) +void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x); +int ASN1_i2d_fp(i2d_of_void *i2d,FILE *out,void *x); +#define ASN1_i2d_fp_of(type,i2d,out,x) \ + ((int (*)(I2D_OF(type),FILE *,type *))openssl_fcast(ASN1_i2d_fp))(i2d,out,x) +#define ASN1_i2d_fp_of_const(type,i2d,out,x) \ + ((int (*)(I2D_OF_const(type),FILE *,type *))openssl_fcast(ASN1_i2d_fp))(i2d,out,x) +int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x); +int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags); +#endif + +int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in); + +#ifndef OPENSSL_NO_BIO +void *ASN1_d2i_bio(void *(*xnew)(void), d2i_of_void *d2i, BIO *in, void **x); +#define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \ + ((type *(*)(type *(*)(void),D2I_OF(type),BIO *,type **))openssl_fcast(ASN1_d2i_bio))(xnew,d2i,in,x) +void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x); +int ASN1_i2d_bio(i2d_of_void *i2d,BIO *out, unsigned char *x); +#define ASN1_i2d_bio_of(type,i2d,out,x) \ + ((int (*)(I2D_OF(type),BIO *,type *))openssl_fcast(ASN1_i2d_bio))(i2d,out,x) +#define ASN1_i2d_bio_of_const(type,i2d,out,x) \ + ((int (*)(I2D_OF_const(type),BIO *,const type *))openssl_fcast(ASN1_i2d_bio))(i2d,out,x) +int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x); +int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a); +int ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a); +int ASN1_TIME_print(BIO *fp,ASN1_TIME *a); +int ASN1_STRING_print(BIO *bp,ASN1_STRING *v); +int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags); +int ASN1_parse(BIO *bp,const unsigned char *pp,long len,int indent); +int ASN1_parse_dump(BIO *bp,const unsigned char *pp,long len,int indent,int dump); +#endif +const char *ASN1_tag2str(int tag); + +/* Used to load and write netscape format cert/key */ +int i2d_ASN1_HEADER(ASN1_HEADER *a,unsigned char **pp); +ASN1_HEADER *d2i_ASN1_HEADER(ASN1_HEADER **a,const unsigned char **pp, long length); +ASN1_HEADER *ASN1_HEADER_new(void ); +void ASN1_HEADER_free(ASN1_HEADER *a); + +int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s); + +/* Not used that much at this point, except for the first two */ +ASN1_METHOD *X509_asn1_meth(void); +ASN1_METHOD *RSAPrivateKey_asn1_meth(void); +ASN1_METHOD *ASN1_IA5STRING_asn1_meth(void); +ASN1_METHOD *ASN1_BIT_STRING_asn1_meth(void); + +int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, + unsigned char *data, int len); +int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, + unsigned char *data, int max_len); +int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, + unsigned char *data, int len); +int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num, + unsigned char *data, int max_len); + +STACK *ASN1_seq_unpack(const unsigned char *buf, int len, + d2i_of_void *d2i, void (*free_func)(void *)); +unsigned char *ASN1_seq_pack(STACK *safes, i2d_of_void *i2d, + unsigned char **buf, int *len ); +void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i); +void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it); +ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d, + ASN1_OCTET_STRING **oct); +#define ASN1_pack_string_of(type,obj,i2d,oct) \ + ((ASN1_STRING *(*)(type *,I2D_OF(type),ASN1_OCTET_STRING **))openssl_fcast(ASN1_pack_string))(obj,i2d,oct) +ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct); + +void ASN1_STRING_set_default_mask(unsigned long mask); +int ASN1_STRING_set_default_mask_asc(char *p); +unsigned long ASN1_STRING_get_default_mask(void); +int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len, + int inform, unsigned long mask); +int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, + int inform, unsigned long mask, + long minsize, long maxsize); + +ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, + const unsigned char *in, int inlen, int inform, int nid); +ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid); +int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long); +void ASN1_STRING_TABLE_cleanup(void); + +/* ASN1 template functions */ + +/* Old API compatible functions */ +ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it); +void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it); +ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, long len, const ASN1_ITEM *it); +int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); +int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); + +void ASN1_add_oid_module(void); + +ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf); +ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_ASN1_strings(void); + +/* Error codes for the ASN1 functions. */ + +/* Function codes. */ +#define ASN1_F_A2D_ASN1_OBJECT 100 +#define ASN1_F_A2I_ASN1_ENUMERATED 101 +#define ASN1_F_A2I_ASN1_INTEGER 102 +#define ASN1_F_A2I_ASN1_STRING 103 +#define ASN1_F_APPEND_EXP 176 +#define ASN1_F_ASN1_BIT_STRING_SET_BIT 183 +#define ASN1_F_ASN1_CB 177 +#define ASN1_F_ASN1_CHECK_TLEN 104 +#define ASN1_F_ASN1_COLLATE_PRIMITIVE 105 +#define ASN1_F_ASN1_COLLECT 106 +#define ASN1_F_ASN1_D2I_EX_PRIMITIVE 108 +#define ASN1_F_ASN1_D2I_FP 109 +#define ASN1_F_ASN1_D2I_READ_BIO 107 +#define ASN1_F_ASN1_DIGEST 184 +#define ASN1_F_ASN1_DO_ADB 110 +#define ASN1_F_ASN1_DUP 111 +#define ASN1_F_ASN1_ENUMERATED_SET 112 +#define ASN1_F_ASN1_ENUMERATED_TO_BN 113 +#define ASN1_F_ASN1_EX_C2I 204 +#define ASN1_F_ASN1_FIND_END 190 +#define ASN1_F_ASN1_GENERALIZEDTIME_SET 185 +#define ASN1_F_ASN1_GENERATE_V3 178 +#define ASN1_F_ASN1_GET_OBJECT 114 +#define ASN1_F_ASN1_HEADER_NEW 115 +#define ASN1_F_ASN1_I2D_BIO 116 +#define ASN1_F_ASN1_I2D_FP 117 +#define ASN1_F_ASN1_INTEGER_SET 118 +#define ASN1_F_ASN1_INTEGER_TO_BN 119 +#define ASN1_F_ASN1_ITEM_D2I_FP 190 +#define ASN1_F_ASN1_ITEM_DUP 191 +#define ASN1_F_ASN1_ITEM_EX_COMBINE_NEW 121 +#define ASN1_F_ASN1_ITEM_EX_D2I 120 +#define ASN1_F_ASN1_ITEM_I2D_BIO 192 +#define ASN1_F_ASN1_ITEM_I2D_FP 193 +#define ASN1_F_ASN1_ITEM_PACK 198 +#define ASN1_F_ASN1_ITEM_SIGN 195 +#define ASN1_F_ASN1_ITEM_UNPACK 199 +#define ASN1_F_ASN1_ITEM_VERIFY 197 +#define ASN1_F_ASN1_MBSTRING_NCOPY 122 +#define ASN1_F_ASN1_OBJECT_NEW 123 +#define ASN1_F_ASN1_PACK_STRING 124 +#define ASN1_F_ASN1_PKCS5_PBE_SET 125 +#define ASN1_F_ASN1_SEQ_PACK 126 +#define ASN1_F_ASN1_SEQ_UNPACK 127 +#define ASN1_F_ASN1_SIGN 128 +#define ASN1_F_ASN1_STR2TYPE 179 +#define ASN1_F_ASN1_STRING_SET 186 +#define ASN1_F_ASN1_STRING_TABLE_ADD 129 +#define ASN1_F_ASN1_STRING_TYPE_NEW 130 +#define ASN1_F_ASN1_TEMPLATE_EX_D2I 132 +#define ASN1_F_ASN1_TEMPLATE_NEW 133 +#define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I 131 +#define ASN1_F_ASN1_TIME_SET 175 +#define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134 +#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135 +#define ASN1_F_ASN1_UNPACK_STRING 136 +#define ASN1_F_ASN1_UTCTIME_SET 187 +#define ASN1_F_ASN1_VERIFY 137 +#define ASN1_F_BITSTR_CB 180 +#define ASN1_F_BN_TO_ASN1_ENUMERATED 138 +#define ASN1_F_BN_TO_ASN1_INTEGER 139 +#define ASN1_F_C2I_ASN1_BIT_STRING 189 +#define ASN1_F_C2I_ASN1_INTEGER 194 +#define ASN1_F_C2I_ASN1_OBJECT 196 +#define ASN1_F_COLLECT_DATA 140 +#define ASN1_F_D2I_ASN1_BIT_STRING 141 +#define ASN1_F_D2I_ASN1_BOOLEAN 142 +#define ASN1_F_D2I_ASN1_BYTES 143 +#define ASN1_F_D2I_ASN1_GENERALIZEDTIME 144 +#define ASN1_F_D2I_ASN1_HEADER 145 +#define ASN1_F_D2I_ASN1_INTEGER 146 +#define ASN1_F_D2I_ASN1_OBJECT 147 +#define ASN1_F_D2I_ASN1_SET 148 +#define ASN1_F_D2I_ASN1_TYPE_BYTES 149 +#define ASN1_F_D2I_ASN1_UINTEGER 150 +#define ASN1_F_D2I_ASN1_UTCTIME 151 +#define ASN1_F_D2I_NETSCAPE_RSA 152 +#define ASN1_F_D2I_NETSCAPE_RSA_2 153 +#define ASN1_F_D2I_PRIVATEKEY 154 +#define ASN1_F_D2I_PUBLICKEY 155 +#define ASN1_F_D2I_RSA_NET 200 +#define ASN1_F_D2I_RSA_NET_2 201 +#define ASN1_F_D2I_X509 156 +#define ASN1_F_D2I_X509_CINF 157 +#define ASN1_F_D2I_X509_PKEY 159 +#define ASN1_F_I2D_ASN1_SET 188 +#define ASN1_F_I2D_ASN1_TIME 160 +#define ASN1_F_I2D_DSA_PUBKEY 161 +#define ASN1_F_I2D_EC_PUBKEY 181 +#define ASN1_F_I2D_PRIVATEKEY 163 +#define ASN1_F_I2D_PUBLICKEY 164 +#define ASN1_F_I2D_RSA_NET 162 +#define ASN1_F_I2D_RSA_PUBKEY 165 +#define ASN1_F_LONG_C2I 166 +#define ASN1_F_OID_MODULE_INIT 174 +#define ASN1_F_PARSE_TAGGING 182 +#define ASN1_F_PKCS5_PBE2_SET 167 +#define ASN1_F_PKCS5_PBE_SET 202 +#define ASN1_F_X509_CINF_NEW 168 +#define ASN1_F_X509_CRL_ADD0_REVOKED 169 +#define ASN1_F_X509_INFO_NEW 170 +#define ASN1_F_X509_NAME_ENCODE 203 +#define ASN1_F_X509_NAME_EX_D2I 158 +#define ASN1_F_X509_NAME_EX_NEW 171 +#define ASN1_F_X509_NEW 172 +#define ASN1_F_X509_PKEY_NEW 173 + +/* Reason codes. */ +#define ASN1_R_ADDING_OBJECT 171 +#define ASN1_R_AUX_ERROR 100 +#define ASN1_R_BAD_CLASS 101 +#define ASN1_R_BAD_OBJECT_HEADER 102 +#define ASN1_R_BAD_PASSWORD_READ 103 +#define ASN1_R_BAD_TAG 104 +#define ASN1_R_BN_LIB 105 +#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106 +#define ASN1_R_BUFFER_TOO_SMALL 107 +#define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 108 +#define ASN1_R_DATA_IS_WRONG 109 +#define ASN1_R_DECODE_ERROR 110 +#define ASN1_R_DECODING_ERROR 111 +#define ASN1_R_DEPTH_EXCEEDED 174 +#define ASN1_R_ENCODE_ERROR 112 +#define ASN1_R_ERROR_GETTING_TIME 173 +#define ASN1_R_ERROR_LOADING_SECTION 172 +#define ASN1_R_ERROR_PARSING_SET_ELEMENT 113 +#define ASN1_R_ERROR_SETTING_CIPHER_PARAMS 114 +#define ASN1_R_EXPECTING_AN_INTEGER 115 +#define ASN1_R_EXPECTING_AN_OBJECT 116 +#define ASN1_R_EXPECTING_A_BOOLEAN 117 +#define ASN1_R_EXPECTING_A_TIME 118 +#define ASN1_R_EXPLICIT_LENGTH_MISMATCH 119 +#define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED 120 +#define ASN1_R_FIELD_MISSING 121 +#define ASN1_R_FIRST_NUM_TOO_LARGE 122 +#define ASN1_R_HEADER_TOO_LONG 123 +#define ASN1_R_ILLEGAL_BITSTRING_FORMAT 175 +#define ASN1_R_ILLEGAL_BOOLEAN 176 +#define ASN1_R_ILLEGAL_CHARACTERS 124 +#define ASN1_R_ILLEGAL_FORMAT 177 +#define ASN1_R_ILLEGAL_HEX 178 +#define ASN1_R_ILLEGAL_IMPLICIT_TAG 179 +#define ASN1_R_ILLEGAL_INTEGER 180 +#define ASN1_R_ILLEGAL_NESTED_TAGGING 181 +#define ASN1_R_ILLEGAL_NULL 125 +#define ASN1_R_ILLEGAL_NULL_VALUE 182 +#define ASN1_R_ILLEGAL_OBJECT 183 +#define ASN1_R_ILLEGAL_OPTIONAL_ANY 126 +#define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 170 +#define ASN1_R_ILLEGAL_TAGGED_ANY 127 +#define ASN1_R_ILLEGAL_TIME_VALUE 184 +#define ASN1_R_INTEGER_NOT_ASCII_FORMAT 185 +#define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128 +#define ASN1_R_INVALID_BMPSTRING_LENGTH 129 +#define ASN1_R_INVALID_DIGIT 130 +#define ASN1_R_INVALID_MODIFIER 186 +#define ASN1_R_INVALID_NUMBER 187 +#define ASN1_R_INVALID_SEPARATOR 131 +#define ASN1_R_INVALID_TIME_FORMAT 132 +#define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133 +#define ASN1_R_INVALID_UTF8STRING 134 +#define ASN1_R_IV_TOO_LARGE 135 +#define ASN1_R_LENGTH_ERROR 136 +#define ASN1_R_LIST_ERROR 188 +#define ASN1_R_MISSING_EOC 137 +#define ASN1_R_MISSING_SECOND_NUMBER 138 +#define ASN1_R_MISSING_VALUE 189 +#define ASN1_R_MSTRING_NOT_UNIVERSAL 139 +#define ASN1_R_MSTRING_WRONG_TAG 140 +#define ASN1_R_NESTED_ASN1_STRING 197 +#define ASN1_R_NON_HEX_CHARACTERS 141 +#define ASN1_R_NOT_ASCII_FORMAT 190 +#define ASN1_R_NOT_ENOUGH_DATA 142 +#define ASN1_R_NO_MATCHING_CHOICE_TYPE 143 +#define ASN1_R_NULL_IS_WRONG_LENGTH 144 +#define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191 +#define ASN1_R_ODD_NUMBER_OF_CHARS 145 +#define ASN1_R_PRIVATE_KEY_HEADER_MISSING 146 +#define ASN1_R_SECOND_NUMBER_TOO_LARGE 147 +#define ASN1_R_SEQUENCE_LENGTH_MISMATCH 148 +#define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149 +#define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 192 +#define ASN1_R_SHORT_LINE 150 +#define ASN1_R_STRING_TOO_LONG 151 +#define ASN1_R_STRING_TOO_SHORT 152 +#define ASN1_R_TAG_VALUE_TOO_HIGH 153 +#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154 +#define ASN1_R_TIME_NOT_ASCII_FORMAT 193 +#define ASN1_R_TOO_LONG 155 +#define ASN1_R_TYPE_NOT_CONSTRUCTED 156 +#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 157 +#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 158 +#define ASN1_R_UNEXPECTED_EOC 159 +#define ASN1_R_UNKNOWN_FORMAT 160 +#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161 +#define ASN1_R_UNKNOWN_OBJECT_TYPE 162 +#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163 +#define ASN1_R_UNKNOWN_TAG 194 +#define ASN1_R_UNKOWN_FORMAT 195 +#define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164 +#define ASN1_R_UNSUPPORTED_CIPHER 165 +#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 166 +#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167 +#define ASN1_R_UNSUPPORTED_TYPE 196 +#define ASN1_R_WRONG_TAG 168 +#define ASN1_R_WRONG_TYPE 169 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/openssl/asn1_mac.h b/h/openssl/asn1_mac.h new file mode 100644 index 0000000..d958ca6 --- /dev/null +++ b/h/openssl/asn1_mac.h @@ -0,0 +1,571 @@ +/* crypto/asn1/asn1_mac.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_ASN1_MAC_H +#define HEADER_ASN1_MAC_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef ASN1_MAC_ERR_LIB +#define ASN1_MAC_ERR_LIB ERR_LIB_ASN1 +#endif + +#define ASN1_MAC_H_err(f,r,line) \ + ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),__FILE__,(line)) + +#define M_ASN1_D2I_vars(a,type,func) \ + ASN1_const_CTX c; \ + type ret=NULL; \ + \ + c.pp=(const unsigned char **)pp; \ + c.q= *(const unsigned char **)pp; \ + c.error=ERR_R_NESTED_ASN1_ERROR; \ + if ((a == NULL) || ((*a) == NULL)) \ + { if ((ret=(type)func()) == NULL) \ + { c.line=__LINE__; goto err; } } \ + else ret=(*a); + +#define M_ASN1_D2I_Init() \ + c.p= *(const unsigned char **)pp; \ + c.max=(length == 0)?0:(c.p+length); + +#define M_ASN1_D2I_Finish_2(a) \ + if (!asn1_const_Finish(&c)) \ + { c.line=__LINE__; goto err; } \ + *(const unsigned char **)pp=c.p; \ + if (a != NULL) (*a)=ret; \ + return(ret); + +#define M_ASN1_D2I_Finish(a,func,e) \ + M_ASN1_D2I_Finish_2(a); \ +err:\ + ASN1_MAC_H_err((e),c.error,c.line); \ + asn1_add_error(*(const unsigned char **)pp,(int)(c.q- *pp)); \ + if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \ + return(NULL) + +#define M_ASN1_D2I_start_sequence() \ + if (!asn1_GetSequence(&c,&length)) \ + { c.line=__LINE__; goto err; } +/* Begin reading ASN1 without a surrounding sequence */ +#define M_ASN1_D2I_begin() \ + c.slen = length; + +/* End reading ASN1 with no check on length */ +#define M_ASN1_D2I_Finish_nolen(a, func, e) \ + *pp=c.p; \ + if (a != NULL) (*a)=ret; \ + return(ret); \ +err:\ + ASN1_MAC_H_err((e),c.error,c.line); \ + asn1_add_error(*pp,(int)(c.q- *pp)); \ + if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \ + return(NULL) + +#define M_ASN1_D2I_end_sequence() \ + (((c.inf&1) == 0)?(c.slen <= 0): \ + (c.eos=ASN1_const_check_infinite_end(&c.p,c.slen))) + +/* Don't use this with d2i_ASN1_BOOLEAN() */ +#define M_ASN1_D2I_get(b, func) \ + c.q=c.p; \ + if (func(&(b),&c.p,c.slen) == NULL) \ + {c.line=__LINE__; goto err; } \ + c.slen-=(c.p-c.q); + +/* Don't use this with d2i_ASN1_BOOLEAN() */ +#define M_ASN1_D2I_get_x(type,b,func) \ + c.q=c.p; \ + if (((D2I_OF(type))func)(&(b),&c.p,c.slen) == NULL) \ + {c.line=__LINE__; goto err; } \ + c.slen-=(c.p-c.q); + +/* use this instead () */ +#define M_ASN1_D2I_get_int(b,func) \ + c.q=c.p; \ + if (func(&(b),&c.p,c.slen) < 0) \ + {c.line=__LINE__; goto err; } \ + c.slen-=(c.p-c.q); + +#define M_ASN1_D2I_get_opt(b,func,type) \ + if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) \ + == (V_ASN1_UNIVERSAL|(type)))) \ + { \ + M_ASN1_D2I_get(b,func); \ + } + +#define M_ASN1_D2I_get_imp(b,func, type) \ + M_ASN1_next=(_tmp& V_ASN1_CONSTRUCTED)|type; \ + c.q=c.p; \ + if (func(&(b),&c.p,c.slen) == NULL) \ + {c.line=__LINE__; M_ASN1_next_prev = _tmp; goto err; } \ + c.slen-=(c.p-c.q);\ + M_ASN1_next_prev=_tmp; + +#define M_ASN1_D2I_get_IMP_opt(b,func,tag,type) \ + if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) == \ + (V_ASN1_CONTEXT_SPECIFIC|(tag)))) \ + { \ + unsigned char _tmp = M_ASN1_next; \ + M_ASN1_D2I_get_imp(b,func, type);\ + } + +#define M_ASN1_D2I_get_set(r,func,free_func) \ + M_ASN1_D2I_get_imp_set(r,func,free_func, \ + V_ASN1_SET,V_ASN1_UNIVERSAL); + +#define M_ASN1_D2I_get_set_type(type,r,func,free_func) \ + M_ASN1_D2I_get_imp_set_type(type,r,func,free_func, \ + V_ASN1_SET,V_ASN1_UNIVERSAL); + +#define M_ASN1_D2I_get_set_opt(r,func,free_func) \ + if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \ + V_ASN1_CONSTRUCTED|V_ASN1_SET)))\ + { M_ASN1_D2I_get_set(r,func,free_func); } + +#define M_ASN1_D2I_get_set_opt_type(type,r,func,free_func) \ + if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \ + V_ASN1_CONSTRUCTED|V_ASN1_SET)))\ + { M_ASN1_D2I_get_set_type(type,r,func,free_func); } + +#define M_ASN1_I2D_len_SET_opt(a,f) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + M_ASN1_I2D_len_SET(a,f); + +#define M_ASN1_I2D_put_SET_opt(a,f) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + M_ASN1_I2D_put_SET(a,f); + +#define M_ASN1_I2D_put_SEQUENCE_opt(a,f) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + M_ASN1_I2D_put_SEQUENCE(a,f); + +#define M_ASN1_I2D_put_SEQUENCE_opt_type(type,a,f) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) \ + M_ASN1_I2D_put_SEQUENCE_type(type,a,f); + +#define M_ASN1_D2I_get_IMP_set_opt(b,func,free_func,tag) \ + if ((c.slen != 0) && \ + (M_ASN1_next == \ + (V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\ + { \ + M_ASN1_D2I_get_imp_set(b,func,free_func,\ + tag,V_ASN1_CONTEXT_SPECIFIC); \ + } + +#define M_ASN1_D2I_get_IMP_set_opt_type(type,b,func,free_func,tag) \ + if ((c.slen != 0) && \ + (M_ASN1_next == \ + (V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\ + { \ + M_ASN1_D2I_get_imp_set_type(type,b,func,free_func,\ + tag,V_ASN1_CONTEXT_SPECIFIC); \ + } + +#define M_ASN1_D2I_get_seq(r,func,free_func) \ + M_ASN1_D2I_get_imp_set(r,func,free_func,\ + V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); + +#define M_ASN1_D2I_get_seq_type(type,r,func,free_func) \ + M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\ + V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL) + +#define M_ASN1_D2I_get_seq_opt(r,func,free_func) \ + if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \ + V_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\ + { M_ASN1_D2I_get_seq(r,func,free_func); } + +#define M_ASN1_D2I_get_seq_opt_type(type,r,func,free_func) \ + if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \ + V_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\ + { M_ASN1_D2I_get_seq_type(type,r,func,free_func); } + +#define M_ASN1_D2I_get_IMP_set(r,func,free_func,x) \ + M_ASN1_D2I_get_imp_set(r,func,free_func,\ + x,V_ASN1_CONTEXT_SPECIFIC); + +#define M_ASN1_D2I_get_IMP_set_type(type,r,func,free_func,x) \ + M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\ + x,V_ASN1_CONTEXT_SPECIFIC); + +#define M_ASN1_D2I_get_imp_set(r,func,free_func,a,b) \ + c.q=c.p; \ + if (d2i_ASN1_SET(&(r),&c.p,c.slen,(char *(*)())func,\ + (void (*)())free_func,a,b) == NULL) \ + { c.line=__LINE__; goto err; } \ + c.slen-=(c.p-c.q); + +#define M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,a,b) \ + c.q=c.p; \ + if (d2i_ASN1_SET_OF_##type(&(r),&c.p,c.slen,func,\ + free_func,a,b) == NULL) \ + { c.line=__LINE__; goto err; } \ + c.slen-=(c.p-c.q); + +#define M_ASN1_D2I_get_set_strings(r,func,a,b) \ + c.q=c.p; \ + if (d2i_ASN1_STRING_SET(&(r),&c.p,c.slen,a,b) == NULL) \ + { c.line=__LINE__; goto err; } \ + c.slen-=(c.p-c.q); + +#define M_ASN1_D2I_get_EXP_opt(r,func,tag) \ + if ((c.slen != 0L) && (M_ASN1_next == \ + (V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \ + { \ + int Tinf,Ttag,Tclass; \ + long Tlen; \ + \ + c.q=c.p; \ + Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \ + if (Tinf & 0x80) \ + { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \ + c.line=__LINE__; goto err; } \ + if (Tinf == (V_ASN1_CONSTRUCTED+1)) \ + Tlen = c.slen - (c.p - c.q) - 2; \ + if (func(&(r),&c.p,Tlen) == NULL) \ + { c.line=__LINE__; goto err; } \ + if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \ + Tlen = c.slen - (c.p - c.q); \ + if(!ASN1_const_check_infinite_end(&c.p, Tlen)) \ + { c.error=ERR_R_MISSING_ASN1_EOS; \ + c.line=__LINE__; goto err; } \ + }\ + c.slen-=(c.p-c.q); \ + } + +#define M_ASN1_D2I_get_EXP_set_opt(r,func,free_func,tag,b) \ + if ((c.slen != 0) && (M_ASN1_next == \ + (V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \ + { \ + int Tinf,Ttag,Tclass; \ + long Tlen; \ + \ + c.q=c.p; \ + Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \ + if (Tinf & 0x80) \ + { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \ + c.line=__LINE__; goto err; } \ + if (Tinf == (V_ASN1_CONSTRUCTED+1)) \ + Tlen = c.slen - (c.p - c.q) - 2; \ + if (d2i_ASN1_SET(&(r),&c.p,Tlen,(char *(*)())func, \ + (void (*)())free_func, \ + b,V_ASN1_UNIVERSAL) == NULL) \ + { c.line=__LINE__; goto err; } \ + if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \ + Tlen = c.slen - (c.p - c.q); \ + if(!ASN1_check_infinite_end(&c.p, Tlen)) \ + { c.error=ERR_R_MISSING_ASN1_EOS; \ + c.line=__LINE__; goto err; } \ + }\ + c.slen-=(c.p-c.q); \ + } + +#define M_ASN1_D2I_get_EXP_set_opt_type(type,r,func,free_func,tag,b) \ + if ((c.slen != 0) && (M_ASN1_next == \ + (V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \ + { \ + int Tinf,Ttag,Tclass; \ + long Tlen; \ + \ + c.q=c.p; \ + Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \ + if (Tinf & 0x80) \ + { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \ + c.line=__LINE__; goto err; } \ + if (Tinf == (V_ASN1_CONSTRUCTED+1)) \ + Tlen = c.slen - (c.p - c.q) - 2; \ + if (d2i_ASN1_SET_OF_##type(&(r),&c.p,Tlen,func, \ + free_func,b,V_ASN1_UNIVERSAL) == NULL) \ + { c.line=__LINE__; goto err; } \ + if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \ + Tlen = c.slen - (c.p - c.q); \ + if(!ASN1_check_infinite_end(&c.p, Tlen)) \ + { c.error=ERR_R_MISSING_ASN1_EOS; \ + c.line=__LINE__; goto err; } \ + }\ + c.slen-=(c.p-c.q); \ + } + +/* New macros */ +#define M_ASN1_New_Malloc(ret,type) \ + if ((ret=(type *)OPENSSL_malloc(sizeof(type))) == NULL) \ + { c.line=__LINE__; goto err2; } + +#define M_ASN1_New(arg,func) \ + if (((arg)=func()) == NULL) return(NULL) + +#define M_ASN1_New_Error(a) \ +/* err: ASN1_MAC_H_err((a),ERR_R_NESTED_ASN1_ERROR,c.line); \ + return(NULL);*/ \ + err2: ASN1_MAC_H_err((a),ERR_R_MALLOC_FAILURE,c.line); \ + return(NULL) + + +/* BIG UGLY WARNING! This is so damn ugly I wanna puke. Unfortunately, + some macros that use ASN1_const_CTX still insist on writing in the input + stream. ARGH! ARGH! ARGH! Let's get rid of this macro package. + Please? -- Richard Levitte */ +#define M_ASN1_next (*((unsigned char *)(c.p))) +#define M_ASN1_next_prev (*((unsigned char *)(c.q))) + +/*************************************************/ + +#define M_ASN1_I2D_vars(a) int r=0,ret=0; \ + unsigned char *p; \ + if (a == NULL) return(0) + +/* Length Macros */ +#define M_ASN1_I2D_len(a,f) ret+=f(a,NULL) +#define M_ASN1_I2D_len_IMP_opt(a,f) if (a != NULL) M_ASN1_I2D_len(a,f) + +#define M_ASN1_I2D_len_SET(a,f) \ + ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET); + +#define M_ASN1_I2D_len_SET_type(type,a,f) \ + ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SET, \ + V_ASN1_UNIVERSAL,IS_SET); + +#define M_ASN1_I2D_len_SEQUENCE(a,f) \ + ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \ + IS_SEQUENCE); + +#define M_ASN1_I2D_len_SEQUENCE_type(type,a,f) \ + ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SEQUENCE, \ + V_ASN1_UNIVERSAL,IS_SEQUENCE) + +#define M_ASN1_I2D_len_SEQUENCE_opt(a,f) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + M_ASN1_I2D_len_SEQUENCE(a,f); + +#define M_ASN1_I2D_len_SEQUENCE_opt_type(type,a,f) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) \ + M_ASN1_I2D_len_SEQUENCE_type(type,a,f); + +#define M_ASN1_I2D_len_IMP_SET(a,f,x) \ + ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET); + +#define M_ASN1_I2D_len_IMP_SET_type(type,a,f,x) \ + ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \ + V_ASN1_CONTEXT_SPECIFIC,IS_SET); + +#define M_ASN1_I2D_len_IMP_SET_opt(a,f,x) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \ + IS_SET); + +#define M_ASN1_I2D_len_IMP_SET_opt_type(type,a,f,x) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) \ + ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \ + V_ASN1_CONTEXT_SPECIFIC,IS_SET); + +#define M_ASN1_I2D_len_IMP_SEQUENCE(a,f,x) \ + ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \ + IS_SEQUENCE); + +#define M_ASN1_I2D_len_IMP_SEQUENCE_opt(a,f,x) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \ + IS_SEQUENCE); + +#define M_ASN1_I2D_len_IMP_SEQUENCE_opt_type(type,a,f,x) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) \ + ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \ + V_ASN1_CONTEXT_SPECIFIC, \ + IS_SEQUENCE); + +#define M_ASN1_I2D_len_EXP_opt(a,f,mtag,v) \ + if (a != NULL)\ + { \ + v=f(a,NULL); \ + ret+=ASN1_object_size(1,v,mtag); \ + } + +#define M_ASN1_I2D_len_EXP_SET_opt(a,f,mtag,tag,v) \ + if ((a != NULL) && (sk_num(a) != 0))\ + { \ + v=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL,IS_SET); \ + ret+=ASN1_object_size(1,v,mtag); \ + } + +#define M_ASN1_I2D_len_EXP_SEQUENCE_opt(a,f,mtag,tag,v) \ + if ((a != NULL) && (sk_num(a) != 0))\ + { \ + v=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL, \ + IS_SEQUENCE); \ + ret+=ASN1_object_size(1,v,mtag); \ + } + +#define M_ASN1_I2D_len_EXP_SEQUENCE_opt_type(type,a,f,mtag,tag,v) \ + if ((a != NULL) && (sk_##type##_num(a) != 0))\ + { \ + v=i2d_ASN1_SET_OF_##type(a,NULL,f,tag, \ + V_ASN1_UNIVERSAL, \ + IS_SEQUENCE); \ + ret+=ASN1_object_size(1,v,mtag); \ + } + +/* Put Macros */ +#define M_ASN1_I2D_put(a,f) f(a,&p) + +#define M_ASN1_I2D_put_IMP_opt(a,f,t) \ + if (a != NULL) \ + { \ + unsigned char *q=p; \ + f(a,&p); \ + *q=(V_ASN1_CONTEXT_SPECIFIC|t|(*q&V_ASN1_CONSTRUCTED));\ + } + +#define M_ASN1_I2D_put_SET(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SET,\ + V_ASN1_UNIVERSAL,IS_SET) +#define M_ASN1_I2D_put_SET_type(type,a,f) \ + i2d_ASN1_SET_OF_##type(a,&p,f,V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET) +#define M_ASN1_I2D_put_IMP_SET(a,f,x) i2d_ASN1_SET(a,&p,f,x,\ + V_ASN1_CONTEXT_SPECIFIC,IS_SET) +#define M_ASN1_I2D_put_IMP_SET_type(type,a,f,x) \ + i2d_ASN1_SET_OF_##type(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET) +#define M_ASN1_I2D_put_IMP_SEQUENCE(a,f,x) i2d_ASN1_SET(a,&p,f,x,\ + V_ASN1_CONTEXT_SPECIFIC,IS_SEQUENCE) + +#define M_ASN1_I2D_put_SEQUENCE(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SEQUENCE,\ + V_ASN1_UNIVERSAL,IS_SEQUENCE) + +#define M_ASN1_I2D_put_SEQUENCE_type(type,a,f) \ + i2d_ASN1_SET_OF_##type(a,&p,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \ + IS_SEQUENCE) + +#define M_ASN1_I2D_put_SEQUENCE_opt(a,f) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + M_ASN1_I2D_put_SEQUENCE(a,f); + +#define M_ASN1_I2D_put_IMP_SET_opt(a,f,x) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + { i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \ + IS_SET); } + +#define M_ASN1_I2D_put_IMP_SET_opt_type(type,a,f,x) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) \ + { i2d_ASN1_SET_OF_##type(a,&p,f,x, \ + V_ASN1_CONTEXT_SPECIFIC, \ + IS_SET); } + +#define M_ASN1_I2D_put_IMP_SEQUENCE_opt(a,f,x) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + { i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \ + IS_SEQUENCE); } + +#define M_ASN1_I2D_put_IMP_SEQUENCE_opt_type(type,a,f,x) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) \ + { i2d_ASN1_SET_OF_##type(a,&p,f,x, \ + V_ASN1_CONTEXT_SPECIFIC, \ + IS_SEQUENCE); } + +#define M_ASN1_I2D_put_EXP_opt(a,f,tag,v) \ + if (a != NULL) \ + { \ + ASN1_put_object(&p,1,v,tag,V_ASN1_CONTEXT_SPECIFIC); \ + f(a,&p); \ + } + +#define M_ASN1_I2D_put_EXP_SET_opt(a,f,mtag,tag,v) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + { \ + ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \ + i2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SET); \ + } + +#define M_ASN1_I2D_put_EXP_SEQUENCE_opt(a,f,mtag,tag,v) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + { \ + ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \ + i2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SEQUENCE); \ + } + +#define M_ASN1_I2D_put_EXP_SEQUENCE_opt_type(type,a,f,mtag,tag,v) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) \ + { \ + ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \ + i2d_ASN1_SET_OF_##type(a,&p,f,tag,V_ASN1_UNIVERSAL, \ + IS_SEQUENCE); \ + } + +#define M_ASN1_I2D_seq_total() \ + r=ASN1_object_size(1,ret,V_ASN1_SEQUENCE); \ + if (pp == NULL) return(r); \ + p= *pp; \ + ASN1_put_object(&p,1,ret,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL) + +#define M_ASN1_I2D_INF_seq_start(tag,ctx) \ + *(p++)=(V_ASN1_CONSTRUCTED|(tag)|(ctx)); \ + *(p++)=0x80 + +#define M_ASN1_I2D_INF_seq_end() *(p++)=0x00; *(p++)=0x00 + +#define M_ASN1_I2D_finish() *pp=p; \ + return(r); + +int asn1_GetSequence(ASN1_const_CTX *c, long *length); +void asn1_add_error(const unsigned char *address,int offset); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/openssl/asn1t.h b/h/openssl/asn1t.h new file mode 100644 index 0000000..cc0cd1c --- /dev/null +++ b/h/openssl/asn1t.h @@ -0,0 +1,886 @@ +/* asn1t.h */ +/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL + * project 2000. + */ +/* ==================================================================== + * Copyright (c) 2000 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +#ifndef HEADER_ASN1T_H +#define HEADER_ASN1T_H + +#include +#include +#include + +#ifdef OPENSSL_BUILD_SHLIBCRYPTO +# undef OPENSSL_EXTERN +# define OPENSSL_EXTERN OPENSSL_EXPORT +#endif + +/* ASN1 template defines, structures and functions */ + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION + +/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ +#define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr)) + + +/* Macros for start and end of ASN1_ITEM definition */ + +#define ASN1_ITEM_start(itname) \ + OPENSSL_GLOBAL const ASN1_ITEM itname##_it = { + +#define ASN1_ITEM_end(itname) \ + }; + +#else + +/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ +#define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr())) + + +/* Macros for start and end of ASN1_ITEM definition */ + +#define ASN1_ITEM_start(itname) \ + const ASN1_ITEM * itname##_it(void) \ + { \ + static const ASN1_ITEM local_it = { \ + +#define ASN1_ITEM_end(itname) \ + }; \ + return &local_it; \ + } + +#endif + + +/* Macros to aid ASN1 template writing */ + +#define ASN1_ITEM_TEMPLATE(tname) \ + static const ASN1_TEMPLATE tname##_item_tt + +#define ASN1_ITEM_TEMPLATE_END(tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_PRIMITIVE,\ + -1,\ + &tname##_item_tt,\ + 0,\ + NULL,\ + 0,\ + #tname \ + ASN1_ITEM_end(tname) + + +/* This is a ASN1 type which just embeds a template */ + +/* This pair helps declare a SEQUENCE. We can do: + * + * ASN1_SEQUENCE(stname) = { + * ... SEQUENCE components ... + * } ASN1_SEQUENCE_END(stname) + * + * This will produce an ASN1_ITEM called stname_it + * for a structure called stname. + * + * If you want the same structure but a different + * name then use: + * + * ASN1_SEQUENCE(itname) = { + * ... SEQUENCE components ... + * } ASN1_SEQUENCE_END_name(stname, itname) + * + * This will create an item called itname_it using + * a structure called stname. + */ + +#define ASN1_SEQUENCE(tname) \ + static const ASN1_TEMPLATE tname##_seq_tt[] + +#define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname) + +#define ASN1_SEQUENCE_END_name(stname, tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +#define ASN1_NDEF_SEQUENCE(tname) \ + ASN1_SEQUENCE(tname) + +#define ASN1_SEQUENCE_cb(tname, cb) \ + static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ + ASN1_SEQUENCE(tname) + +#define ASN1_BROKEN_SEQUENCE(tname) \ + static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \ + ASN1_SEQUENCE(tname) + +#define ASN1_SEQUENCE_ref(tname, cb, lck) \ + static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), lck, cb, 0}; \ + ASN1_SEQUENCE(tname) + +#define ASN1_SEQUENCE_enc(tname, enc, cb) \ + static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \ + ASN1_SEQUENCE(tname) + +#define ASN1_NDEF_SEQUENCE_END(tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_NDEF_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(tname),\ + #tname \ + ASN1_ITEM_end(tname) + +#define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname) + +#define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) + +#define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) + +#define ASN1_SEQUENCE_END_ref(stname, tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + &tname##_aux,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + + +/* This pair helps declare a CHOICE type. We can do: + * + * ASN1_CHOICE(chname) = { + * ... CHOICE options ... + * ASN1_CHOICE_END(chname) + * + * This will produce an ASN1_ITEM called chname_it + * for a structure called chname. The structure + * definition must look like this: + * typedef struct { + * int type; + * union { + * ASN1_SOMETHING *opt1; + * ASN1_SOMEOTHER *opt2; + * } value; + * } chname; + * + * the name of the selector must be 'type'. + * to use an alternative selector name use the + * ASN1_CHOICE_END_selector() version. + */ + +#define ASN1_CHOICE(tname) \ + static const ASN1_TEMPLATE tname##_ch_tt[] + +#define ASN1_CHOICE_cb(tname, cb) \ + static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ + ASN1_CHOICE(tname) + +#define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname) + +#define ASN1_CHOICE_END_name(stname, tname) ASN1_CHOICE_END_selector(stname, tname, type) + +#define ASN1_CHOICE_END_selector(stname, tname, selname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_CHOICE,\ + offsetof(stname,selname) ,\ + tname##_ch_tt,\ + sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +#define ASN1_CHOICE_END_cb(stname, tname, selname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_CHOICE,\ + offsetof(stname,selname) ,\ + tname##_ch_tt,\ + sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ + &tname##_aux,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +/* This helps with the template wrapper form of ASN1_ITEM */ + +#define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, type) { \ + (flags), (tag), 0,\ + #name, ASN1_ITEM_ref(type) } + +/* These help with SEQUENCE or CHOICE components */ + +/* used to declare other types */ + +#define ASN1_EX_TYPE(flags, tag, stname, field, type) { \ + (flags), (tag), offsetof(stname, field),\ + #field, ASN1_ITEM_ref(type) } + +/* used when the structure is combined with the parent */ + +#define ASN1_EX_COMBINE(flags, tag, type) { \ + (flags)|ASN1_TFLG_COMBINE, (tag), 0, NULL, ASN1_ITEM_ref(type) } + +/* implicit and explicit helper macros */ + +#define ASN1_IMP_EX(stname, field, type, tag, ex) \ + ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | ex, tag, stname, field, type) + +#define ASN1_EXP_EX(stname, field, type, tag, ex) \ + ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | ex, tag, stname, field, type) + +/* Any defined by macros: the field used is in the table itself */ + +#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION +#define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } +#define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } +#else +#define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, tblname##_adb } +#define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, tblname##_adb } +#endif +/* Plain simple type */ +#define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type) + +/* OPTIONAL simple type */ +#define ASN1_OPT(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type) + +/* IMPLICIT tagged simple type */ +#define ASN1_IMP(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, 0) + +/* IMPLICIT tagged OPTIONAL simple type */ +#define ASN1_IMP_OPT(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) + +/* Same as above but EXPLICIT */ + +#define ASN1_EXP(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, 0) +#define ASN1_EXP_OPT(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) + +/* SEQUENCE OF type */ +#define ASN1_SEQUENCE_OF(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type) + +/* OPTIONAL SEQUENCE OF */ +#define ASN1_SEQUENCE_OF_OPT(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) + +/* Same as above but for SET OF */ + +#define ASN1_SET_OF(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type) + +#define ASN1_SET_OF_OPT(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) + +/* Finally compound types of SEQUENCE, SET, IMPLICIT, EXPLICIT and OPTIONAL */ + +#define ASN1_IMP_SET_OF(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) + +#define ASN1_EXP_SET_OF(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) + +#define ASN1_IMP_SET_OF_OPT(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) + +#define ASN1_EXP_SET_OF_OPT(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) + +#define ASN1_IMP_SEQUENCE_OF(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) + +#define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) + +#define ASN1_EXP_SEQUENCE_OF(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) + +#define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) + +/* EXPLICIT OPTIONAL using indefinite length constructed form */ +#define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF) + +/* Macros for the ASN1_ADB structure */ + +#define ASN1_ADB(name) \ + static const ASN1_ADB_TABLE name##_adbtbl[] + +#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION + +#define ASN1_ADB_END(name, flags, field, app_table, def, none) \ + ;\ + static const ASN1_ADB name##_adb = {\ + flags,\ + offsetof(name, field),\ + app_table,\ + name##_adbtbl,\ + sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ + def,\ + none\ + } + +#else + +#define ASN1_ADB_END(name, flags, field, app_table, def, none) \ + ;\ + static const ASN1_ITEM *name##_adb(void) \ + { \ + static const ASN1_ADB internal_adb = \ + {\ + flags,\ + offsetof(name, field),\ + app_table,\ + name##_adbtbl,\ + sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ + def,\ + none\ + }; \ + return (const ASN1_ITEM *) &internal_adb; \ + } \ + void dummy_function(void) + +#endif + +#define ADB_ENTRY(val, template) {val, template} + +#define ASN1_ADB_TEMPLATE(name) \ + static const ASN1_TEMPLATE name##_tt + +/* This is the ASN1 template structure that defines + * a wrapper round the actual type. It determines the + * actual position of the field in the value structure, + * various flags such as OPTIONAL and the field name. + */ + +struct ASN1_TEMPLATE_st { +unsigned long flags; /* Various flags */ +long tag; /* tag, not used if no tagging */ +unsigned long offset; /* Offset of this field in structure */ +#ifndef NO_ASN1_FIELD_NAMES +const char *field_name; /* Field name */ +#endif +ASN1_ITEM_EXP *item; /* Relevant ASN1_ITEM or ASN1_ADB */ +}; + +/* Macro to extract ASN1_ITEM and ASN1_ADB pointer from ASN1_TEMPLATE */ + +#define ASN1_TEMPLATE_item(t) (t->item_ptr) +#define ASN1_TEMPLATE_adb(t) (t->item_ptr) + +typedef struct ASN1_ADB_TABLE_st ASN1_ADB_TABLE; +typedef struct ASN1_ADB_st ASN1_ADB; + +struct ASN1_ADB_st { + unsigned long flags; /* Various flags */ + unsigned long offset; /* Offset of selector field */ + STACK_OF(ASN1_ADB_TABLE) **app_items; /* Application defined items */ + const ASN1_ADB_TABLE *tbl; /* Table of possible types */ + long tblcount; /* Number of entries in tbl */ + const ASN1_TEMPLATE *default_tt; /* Type to use if no match */ + const ASN1_TEMPLATE *null_tt; /* Type to use if selector is NULL */ +}; + +struct ASN1_ADB_TABLE_st { + long value; /* NID for an object or value for an int */ + const ASN1_TEMPLATE tt; /* item for this value */ +}; + +/* template flags */ + +/* Field is optional */ +#define ASN1_TFLG_OPTIONAL (0x1) + +/* Field is a SET OF */ +#define ASN1_TFLG_SET_OF (0x1 << 1) + +/* Field is a SEQUENCE OF */ +#define ASN1_TFLG_SEQUENCE_OF (0x2 << 1) + +/* Special case: this refers to a SET OF that + * will be sorted into DER order when encoded *and* + * the corresponding STACK will be modified to match + * the new order. + */ +#define ASN1_TFLG_SET_ORDER (0x3 << 1) + +/* Mask for SET OF or SEQUENCE OF */ +#define ASN1_TFLG_SK_MASK (0x3 << 1) + +/* These flags mean the tag should be taken from the + * tag field. If EXPLICIT then the underlying type + * is used for the inner tag. + */ + +/* IMPLICIT tagging */ +#define ASN1_TFLG_IMPTAG (0x1 << 3) + + +/* EXPLICIT tagging, inner tag from underlying type */ +#define ASN1_TFLG_EXPTAG (0x2 << 3) + +#define ASN1_TFLG_TAG_MASK (0x3 << 3) + +/* context specific IMPLICIT */ +#define ASN1_TFLG_IMPLICIT ASN1_TFLG_IMPTAG|ASN1_TFLG_CONTEXT + +/* context specific EXPLICIT */ +#define ASN1_TFLG_EXPLICIT ASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT + +/* If tagging is in force these determine the + * type of tag to use. Otherwise the tag is + * determined by the underlying type. These + * values reflect the actual octet format. + */ + +/* Universal tag */ +#define ASN1_TFLG_UNIVERSAL (0x0<<6) +/* Application tag */ +#define ASN1_TFLG_APPLICATION (0x1<<6) +/* Context specific tag */ +#define ASN1_TFLG_CONTEXT (0x2<<6) +/* Private tag */ +#define ASN1_TFLG_PRIVATE (0x3<<6) + +#define ASN1_TFLG_TAG_CLASS (0x3<<6) + +/* These are for ANY DEFINED BY type. In this case + * the 'item' field points to an ASN1_ADB structure + * which contains a table of values to decode the + * relevant type + */ + +#define ASN1_TFLG_ADB_MASK (0x3<<8) + +#define ASN1_TFLG_ADB_OID (0x1<<8) + +#define ASN1_TFLG_ADB_INT (0x1<<9) + +/* This flag means a parent structure is passed + * instead of the field: this is useful is a + * SEQUENCE is being combined with a CHOICE for + * example. Since this means the structure and + * item name will differ we need to use the + * ASN1_CHOICE_END_name() macro for example. + */ + +#define ASN1_TFLG_COMBINE (0x1<<10) + +/* This flag when present in a SEQUENCE OF, SET OF + * or EXPLICIT causes indefinite length constructed + * encoding to be used if required. + */ + +#define ASN1_TFLG_NDEF (0x1<<11) + +/* This is the actual ASN1 item itself */ + +struct ASN1_ITEM_st { +char itype; /* The item type, primitive, SEQUENCE, CHOICE or extern */ +long utype; /* underlying type */ +const ASN1_TEMPLATE *templates; /* If SEQUENCE or CHOICE this contains the contents */ +long tcount; /* Number of templates if SEQUENCE or CHOICE */ +const void *funcs; /* functions that handle this type */ +long size; /* Structure size (usually)*/ +#ifndef NO_ASN1_FIELD_NAMES +const char *sname; /* Structure name */ +#endif +}; + +/* These are values for the itype field and + * determine how the type is interpreted. + * + * For PRIMITIVE types the underlying type + * determines the behaviour if items is NULL. + * + * Otherwise templates must contain a single + * template and the type is treated in the + * same way as the type specified in the template. + * + * For SEQUENCE types the templates field points + * to the members, the size field is the + * structure size. + * + * For CHOICE types the templates field points + * to each possible member (typically a union) + * and the 'size' field is the offset of the + * selector. + * + * The 'funcs' field is used for application + * specific functions. + * + * For COMPAT types the funcs field gives a + * set of functions that handle this type, this + * supports the old d2i, i2d convention. + * + * The EXTERN type uses a new style d2i/i2d. + * The new style should be used where possible + * because it avoids things like the d2i IMPLICIT + * hack. + * + * MSTRING is a multiple string type, it is used + * for a CHOICE of character strings where the + * actual strings all occupy an ASN1_STRING + * structure. In this case the 'utype' field + * has a special meaning, it is used as a mask + * of acceptable types using the B_ASN1 constants. + * + * NDEF_SEQUENCE is the same as SEQUENCE except + * that it will use indefinite length constructed + * encoding if requested. + * + */ + +#define ASN1_ITYPE_PRIMITIVE 0x0 + +#define ASN1_ITYPE_SEQUENCE 0x1 + +#define ASN1_ITYPE_CHOICE 0x2 + +#define ASN1_ITYPE_COMPAT 0x3 + +#define ASN1_ITYPE_EXTERN 0x4 + +#define ASN1_ITYPE_MSTRING 0x5 + +#define ASN1_ITYPE_NDEF_SEQUENCE 0x6 + +/* Cache for ASN1 tag and length, so we + * don't keep re-reading it for things + * like CHOICE + */ + +struct ASN1_TLC_st{ + char valid; /* Values below are valid */ + int ret; /* return value */ + long plen; /* length */ + int ptag; /* class value */ + int pclass; /* class value */ + int hdrlen; /* header length */ +}; + +/* Typedefs for ASN1 function pointers */ + +typedef ASN1_VALUE * ASN1_new_func(void); +typedef void ASN1_free_func(ASN1_VALUE *a); +typedef ASN1_VALUE * ASN1_d2i_func(ASN1_VALUE **a, const unsigned char ** in, long length); +typedef int ASN1_i2d_func(ASN1_VALUE * a, unsigned char **in); + +typedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_ITEM *it, + int tag, int aclass, char opt, ASN1_TLC *ctx); + +typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass); +typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it); +typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it); + +typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it); +typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it); + +typedef struct ASN1_COMPAT_FUNCS_st { + ASN1_new_func *asn1_new; + ASN1_free_func *asn1_free; + ASN1_d2i_func *asn1_d2i; + ASN1_i2d_func *asn1_i2d; +} ASN1_COMPAT_FUNCS; + +typedef struct ASN1_EXTERN_FUNCS_st { + void *app_data; + ASN1_ex_new_func *asn1_ex_new; + ASN1_ex_free_func *asn1_ex_free; + ASN1_ex_free_func *asn1_ex_clear; + ASN1_ex_d2i *asn1_ex_d2i; + ASN1_ex_i2d *asn1_ex_i2d; +} ASN1_EXTERN_FUNCS; + +typedef struct ASN1_PRIMITIVE_FUNCS_st { + void *app_data; + unsigned long flags; + ASN1_ex_new_func *prim_new; + ASN1_ex_free_func *prim_free; + ASN1_ex_free_func *prim_clear; + ASN1_primitive_c2i *prim_c2i; + ASN1_primitive_i2c *prim_i2c; +} ASN1_PRIMITIVE_FUNCS; + +/* This is the ASN1_AUX structure: it handles various + * miscellaneous requirements. For example the use of + * reference counts and an informational callback. + * + * The "informational callback" is called at various + * points during the ASN1 encoding and decoding. It can + * be used to provide minor customisation of the structures + * used. This is most useful where the supplied routines + * *almost* do the right thing but need some extra help + * at a few points. If the callback returns zero then + * it is assumed a fatal error has occurred and the + * main operation should be abandoned. + * + * If major changes in the default behaviour are required + * then an external type is more appropriate. + */ + +typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it); + +typedef struct ASN1_AUX_st { + void *app_data; + int flags; + int ref_offset; /* Offset of reference value */ + int ref_lock; /* Lock type to use */ + ASN1_aux_cb *asn1_cb; + int enc_offset; /* Offset of ASN1_ENCODING structure */ +} ASN1_AUX; + +/* Flags in ASN1_AUX */ + +/* Use a reference count */ +#define ASN1_AFLG_REFCOUNT 1 +/* Save the encoding of structure (useful for signatures) */ +#define ASN1_AFLG_ENCODING 2 +/* The Sequence length is invalid */ +#define ASN1_AFLG_BROKEN 4 + +/* operation values for asn1_cb */ + +#define ASN1_OP_NEW_PRE 0 +#define ASN1_OP_NEW_POST 1 +#define ASN1_OP_FREE_PRE 2 +#define ASN1_OP_FREE_POST 3 +#define ASN1_OP_D2I_PRE 4 +#define ASN1_OP_D2I_POST 5 +#define ASN1_OP_I2D_PRE 6 +#define ASN1_OP_I2D_POST 7 + +/* Macro to implement a primitive type */ +#define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0) +#define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \ + ASN1_ITEM_start(itname) \ + ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \ + ASN1_ITEM_end(itname) + +/* Macro to implement a multi string type */ +#define IMPLEMENT_ASN1_MSTRING(itname, mask) \ + ASN1_ITEM_start(itname) \ + ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \ + ASN1_ITEM_end(itname) + +/* Macro to implement an ASN1_ITEM in terms of old style funcs */ + +#define IMPLEMENT_COMPAT_ASN1(sname) IMPLEMENT_COMPAT_ASN1_type(sname, V_ASN1_SEQUENCE) + +#define IMPLEMENT_COMPAT_ASN1_type(sname, tag) \ + static const ASN1_COMPAT_FUNCS sname##_ff = { \ + (ASN1_new_func *)sname##_new, \ + (ASN1_free_func *)sname##_free, \ + (ASN1_d2i_func *)d2i_##sname, \ + (ASN1_i2d_func *)i2d_##sname, \ + }; \ + ASN1_ITEM_start(sname) \ + ASN1_ITYPE_COMPAT, \ + tag, \ + NULL, \ + 0, \ + &sname##_ff, \ + 0, \ + #sname \ + ASN1_ITEM_end(sname) + +#define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \ + ASN1_ITEM_start(sname) \ + ASN1_ITYPE_EXTERN, \ + tag, \ + NULL, \ + 0, \ + &fptrs, \ + 0, \ + #sname \ + ASN1_ITEM_end(sname) + +/* Macro to implement standard functions in terms of ASN1_ITEM structures */ + +#define IMPLEMENT_ASN1_FUNCTIONS(stname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, stname, stname) + +#define IMPLEMENT_ASN1_FUNCTIONS_name(stname, itname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, itname) + +#define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \ + IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname) + +#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname) + +#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \ + stname *fname##_new(void) \ + { \ + return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ + } \ + void fname##_free(stname *a) \ + { \ + ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ + } + +#define IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) + +#define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ + stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ + { \ + return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ + } \ + int i2d_##fname(stname *a, unsigned char **out) \ + { \ + return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ + } + +#define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \ + int i2d_##stname##_NDEF(stname *a, unsigned char **out) \ + { \ + return ASN1_item_ndef_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\ + } + +/* This includes evil casts to remove const: they will go away when full + * ASN1 constification is done. + */ +#define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ + stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ + { \ + return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ + } \ + int i2d_##fname(const stname *a, unsigned char **out) \ + { \ + return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ + } + +#define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \ + stname * stname##_dup(stname *x) \ + { \ + return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \ + } + +#define IMPLEMENT_ASN1_FUNCTIONS_const(name) \ + IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name) + +#define IMPLEMENT_ASN1_FUNCTIONS_const_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) + +/* external definitions for primitive types */ + +DECLARE_ASN1_ITEM(ASN1_BOOLEAN) +DECLARE_ASN1_ITEM(ASN1_TBOOLEAN) +DECLARE_ASN1_ITEM(ASN1_FBOOLEAN) +DECLARE_ASN1_ITEM(ASN1_SEQUENCE) +DECLARE_ASN1_ITEM(CBIGNUM) +DECLARE_ASN1_ITEM(BIGNUM) +DECLARE_ASN1_ITEM(LONG) +DECLARE_ASN1_ITEM(ZLONG) + +DECLARE_STACK_OF(ASN1_VALUE) + +/* Functions used internally by the ASN1 code */ + +int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it); +void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it); +int ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); +int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it); + +void ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); +int ASN1_template_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_TEMPLATE *tt); +int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_ITEM *it, + int tag, int aclass, char opt, ASN1_TLC *ctx); + +int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass); +int ASN1_template_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_TEMPLATE *tt); +void ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it); + +int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it); +int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it); + +int asn1_get_choice_selector(ASN1_VALUE **pval, const ASN1_ITEM *it); +int asn1_set_choice_selector(ASN1_VALUE **pval, int value, const ASN1_ITEM *it); + +ASN1_VALUE ** asn1_get_field_ptr(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); + +const ASN1_TEMPLATE *asn1_do_adb(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt, int nullerr); + +int asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it); + +void asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it); +void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it); +int asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval, const ASN1_ITEM *it); +int asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen, const ASN1_ITEM *it); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/openssl/bio.h b/h/openssl/bio.h new file mode 100644 index 0000000..7f49ccb --- /dev/null +++ b/h/openssl/bio.h @@ -0,0 +1,767 @@ +/* crypto/bio/bio.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_BIO_H +#define HEADER_BIO_H + +#include + +#ifndef OPENSSL_NO_FP_API +# include +#endif +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* These are the 'types' of BIOs */ +#define BIO_TYPE_NONE 0 +#define BIO_TYPE_MEM (1|0x0400) +#define BIO_TYPE_FILE (2|0x0400) + +#define BIO_TYPE_FD (4|0x0400|0x0100) +#define BIO_TYPE_SOCKET (5|0x0400|0x0100) +#define BIO_TYPE_NULL (6|0x0400) +#define BIO_TYPE_SSL (7|0x0200) +#define BIO_TYPE_MD (8|0x0200) /* passive filter */ +#define BIO_TYPE_BUFFER (9|0x0200) /* filter */ +#define BIO_TYPE_CIPHER (10|0x0200) /* filter */ +#define BIO_TYPE_BASE64 (11|0x0200) /* filter */ +#define BIO_TYPE_CONNECT (12|0x0400|0x0100) /* socket - connect */ +#define BIO_TYPE_ACCEPT (13|0x0400|0x0100) /* socket for accept */ +#define BIO_TYPE_PROXY_CLIENT (14|0x0200) /* client proxy BIO */ +#define BIO_TYPE_PROXY_SERVER (15|0x0200) /* server proxy BIO */ +#define BIO_TYPE_NBIO_TEST (16|0x0200) /* server proxy BIO */ +#define BIO_TYPE_NULL_FILTER (17|0x0200) +#define BIO_TYPE_BER (18|0x0200) /* BER -> bin filter */ +#define BIO_TYPE_BIO (19|0x0400) /* (half a) BIO pair */ +#define BIO_TYPE_LINEBUFFER (20|0x0200) /* filter */ +#define BIO_TYPE_DGRAM (21|0x0400|0x0100) + +#define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ +#define BIO_TYPE_FILTER 0x0200 +#define BIO_TYPE_SOURCE_SINK 0x0400 + +/* BIO_FILENAME_READ|BIO_CLOSE to open or close on free. + * BIO_set_fp(in,stdin,BIO_NOCLOSE); */ +#define BIO_NOCLOSE 0x00 +#define BIO_CLOSE 0x01 + +/* These are used in the following macros and are passed to + * BIO_ctrl() */ +#define BIO_CTRL_RESET 1 /* opt - rewind/zero etc */ +#define BIO_CTRL_EOF 2 /* opt - are we at the eof */ +#define BIO_CTRL_INFO 3 /* opt - extra tit-bits */ +#define BIO_CTRL_SET 4 /* man - set the 'IO' type */ +#define BIO_CTRL_GET 5 /* man - get the 'IO' type */ +#define BIO_CTRL_PUSH 6 /* opt - internal, used to signify change */ +#define BIO_CTRL_POP 7 /* opt - internal, used to signify change */ +#define BIO_CTRL_GET_CLOSE 8 /* man - set the 'close' on free */ +#define BIO_CTRL_SET_CLOSE 9 /* man - set the 'close' on free */ +#define BIO_CTRL_PENDING 10 /* opt - is their more data buffered */ +#define BIO_CTRL_FLUSH 11 /* opt - 'flush' buffered output */ +#define BIO_CTRL_DUP 12 /* man - extra stuff for 'duped' BIO */ +#define BIO_CTRL_WPENDING 13 /* opt - number of bytes still to write */ +/* callback is int cb(BIO *bio,state,ret); */ +#define BIO_CTRL_SET_CALLBACK 14 /* opt - set callback function */ +#define BIO_CTRL_GET_CALLBACK 15 /* opt - set callback function */ + +#define BIO_CTRL_SET_FILENAME 30 /* BIO_s_file special */ + +/* dgram BIO stuff */ +#define BIO_CTRL_DGRAM_CONNECT 31 /* BIO dgram special */ +#define BIO_CTRL_DGRAM_SET_CONNECTED 32 /* allow for an externally + * connected socket to be + * passed in */ +#define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33 /* setsockopt, essentially */ +#define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34 /* getsockopt, essentially */ +#define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35 /* setsockopt, essentially */ +#define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36 /* getsockopt, essentially */ + +#define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37 /* flag whether the last */ +#define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38 /* I/O operation tiemd out */ + +/* #ifdef IP_MTU_DISCOVER */ +#define BIO_CTRL_DGRAM_MTU_DISCOVER 39 /* set DF bit on egress packets */ +/* #endif */ + +#define BIO_CTRL_DGRAM_QUERY_MTU 40 /* as kernel for current MTU */ +#define BIO_CTRL_DGRAM_GET_MTU 41 /* get cached value for MTU */ +#define BIO_CTRL_DGRAM_SET_MTU 42 /* set cached value for + * MTU. want to use this + * if asking the kernel + * fails */ + +#define BIO_CTRL_DGRAM_MTU_EXCEEDED 43 /* check whether the MTU + * was exceed in the + * previous write + * operation */ + +#define BIO_CTRL_DGRAM_SET_PEER 44 /* Destination for the data */ + + +/* modifiers */ +#define BIO_FP_READ 0x02 +#define BIO_FP_WRITE 0x04 +#define BIO_FP_APPEND 0x08 +#define BIO_FP_TEXT 0x10 + +#define BIO_FLAGS_READ 0x01 +#define BIO_FLAGS_WRITE 0x02 +#define BIO_FLAGS_IO_SPECIAL 0x04 +#define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL) +#define BIO_FLAGS_SHOULD_RETRY 0x08 +#ifndef BIO_FLAGS_UPLINK +/* "UPLINK" flag denotes file descriptors provided by application. + It defaults to 0, as most platforms don't require UPLINK interface. */ +#define BIO_FLAGS_UPLINK 0 +#endif + +/* Used in BIO_gethostbyname() */ +#define BIO_GHBN_CTRL_HITS 1 +#define BIO_GHBN_CTRL_MISSES 2 +#define BIO_GHBN_CTRL_CACHE_SIZE 3 +#define BIO_GHBN_CTRL_GET_ENTRY 4 +#define BIO_GHBN_CTRL_FLUSH 5 + +/* Mostly used in the SSL BIO */ +/* Not used anymore + * #define BIO_FLAGS_PROTOCOL_DELAYED_READ 0x10 + * #define BIO_FLAGS_PROTOCOL_DELAYED_WRITE 0x20 + * #define BIO_FLAGS_PROTOCOL_STARTUP 0x40 + */ + +#define BIO_FLAGS_BASE64_NO_NL 0x100 + +/* This is used with memory BIOs: it means we shouldn't free up or change the + * data in any way. + */ +#define BIO_FLAGS_MEM_RDONLY 0x200 + +#define BIO_set_flags(b,f) ((b)->flags|=(f)) +#define BIO_get_flags(b) ((b)->flags) +#define BIO_set_retry_special(b) \ + ((b)->flags|=(BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY)) +#define BIO_set_retry_read(b) \ + ((b)->flags|=(BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY)) +#define BIO_set_retry_write(b) \ + ((b)->flags|=(BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY)) + +/* These are normally used internally in BIOs */ +#define BIO_clear_flags(b,f) ((b)->flags&= ~(f)) +#define BIO_clear_retry_flags(b) \ + ((b)->flags&= ~(BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) +#define BIO_get_retry_flags(b) \ + ((b)->flags&(BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) + +/* These should be used by the application to tell why we should retry */ +#define BIO_should_read(a) ((a)->flags & BIO_FLAGS_READ) +#define BIO_should_write(a) ((a)->flags & BIO_FLAGS_WRITE) +#define BIO_should_io_special(a) ((a)->flags & BIO_FLAGS_IO_SPECIAL) +#define BIO_retry_type(a) ((a)->flags & BIO_FLAGS_RWS) +#define BIO_should_retry(a) ((a)->flags & BIO_FLAGS_SHOULD_RETRY) + +/* The next three are used in conjunction with the + * BIO_should_io_special() condition. After this returns true, + * BIO *BIO_get_retry_BIO(BIO *bio, int *reason); will walk the BIO + * stack and return the 'reason' for the special and the offending BIO. + * Given a BIO, BIO_get_retry_reason(bio) will return the code. */ +/* Returned from the SSL bio when the certificate retrieval code had an error */ +#define BIO_RR_SSL_X509_LOOKUP 0x01 +/* Returned from the connect BIO when a connect would have blocked */ +#define BIO_RR_CONNECT 0x02 +/* Returned from the accept BIO when an accept would have blocked */ +#define BIO_RR_ACCEPT 0x03 + +/* These are passed by the BIO callback */ +#define BIO_CB_FREE 0x01 +#define BIO_CB_READ 0x02 +#define BIO_CB_WRITE 0x03 +#define BIO_CB_PUTS 0x04 +#define BIO_CB_GETS 0x05 +#define BIO_CB_CTRL 0x06 + +/* The callback is called before and after the underling operation, + * The BIO_CB_RETURN flag indicates if it is after the call */ +#define BIO_CB_RETURN 0x80 +#define BIO_CB_return(a) ((a)|BIO_CB_RETURN)) +#define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN)) +#define BIO_cb_post(a) ((a)&BIO_CB_RETURN) + +#define BIO_set_callback(b,cb) ((b)->callback=(cb)) +#define BIO_set_callback_arg(b,arg) ((b)->cb_arg=(char *)(arg)) +#define BIO_get_callback_arg(b) ((b)->cb_arg) +#define BIO_get_callback(b) ((b)->callback) +#define BIO_method_name(b) ((b)->method->name) +#define BIO_method_type(b) ((b)->method->type) + +typedef struct bio_st BIO; + +typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long); + +#ifndef OPENSSL_SYS_WIN16 +typedef struct bio_method_st + { + int type; + const char *name; + int (*bwrite)(BIO *, const char *, int); + int (*bread)(BIO *, char *, int); + int (*bputs)(BIO *, const char *); + int (*bgets)(BIO *, char *, int); + long (*ctrl)(BIO *, int, long, void *); + int (*create)(BIO *); + int (*destroy)(BIO *); + long (*callback_ctrl)(BIO *, int, bio_info_cb *); + } BIO_METHOD; +#else +typedef struct bio_method_st + { + int type; + const char *name; + int (_far *bwrite)(); + int (_far *bread)(); + int (_far *bputs)(); + int (_far *bgets)(); + long (_far *ctrl)(); + int (_far *create)(); + int (_far *destroy)(); + long (_far *callback_ctrl)(); + } BIO_METHOD; +#endif + +struct bio_st + { + BIO_METHOD *method; + /* bio, mode, argp, argi, argl, ret */ + long (*callback)(struct bio_st *,int,const char *,int, long,long); + char *cb_arg; /* first argument for the callback */ + + int init; + int shutdown; + int flags; /* extra storage */ + int retry_reason; + int num; + void *ptr; + struct bio_st *next_bio; /* used by filter BIOs */ + struct bio_st *prev_bio; /* used by filter BIOs */ + int references; + unsigned long num_read; + unsigned long num_write; + + CRYPTO_EX_DATA ex_data; + }; + +DECLARE_STACK_OF(BIO) + +typedef struct bio_f_buffer_ctx_struct + { + /* BIO *bio; */ /* this is now in the BIO struct */ + int ibuf_size; /* how big is the input buffer */ + int obuf_size; /* how big is the output buffer */ + + char *ibuf; /* the char array */ + int ibuf_len; /* how many bytes are in it */ + int ibuf_off; /* write/read offset */ + + char *obuf; /* the char array */ + int obuf_len; /* how many bytes are in it */ + int obuf_off; /* write/read offset */ + } BIO_F_BUFFER_CTX; + +/* connect BIO stuff */ +#define BIO_CONN_S_BEFORE 1 +#define BIO_CONN_S_GET_IP 2 +#define BIO_CONN_S_GET_PORT 3 +#define BIO_CONN_S_CREATE_SOCKET 4 +#define BIO_CONN_S_CONNECT 5 +#define BIO_CONN_S_OK 6 +#define BIO_CONN_S_BLOCKED_CONNECT 7 +#define BIO_CONN_S_NBIO 8 +/*#define BIO_CONN_get_param_hostname BIO_ctrl */ + +#define BIO_C_SET_CONNECT 100 +#define BIO_C_DO_STATE_MACHINE 101 +#define BIO_C_SET_NBIO 102 +#define BIO_C_SET_PROXY_PARAM 103 +#define BIO_C_SET_FD 104 +#define BIO_C_GET_FD 105 +#define BIO_C_SET_FILE_PTR 106 +#define BIO_C_GET_FILE_PTR 107 +#define BIO_C_SET_FILENAME 108 +#define BIO_C_SET_SSL 109 +#define BIO_C_GET_SSL 110 +#define BIO_C_SET_MD 111 +#define BIO_C_GET_MD 112 +#define BIO_C_GET_CIPHER_STATUS 113 +#define BIO_C_SET_BUF_MEM 114 +#define BIO_C_GET_BUF_MEM_PTR 115 +#define BIO_C_GET_BUFF_NUM_LINES 116 +#define BIO_C_SET_BUFF_SIZE 117 +#define BIO_C_SET_ACCEPT 118 +#define BIO_C_SSL_MODE 119 +#define BIO_C_GET_MD_CTX 120 +#define BIO_C_GET_PROXY_PARAM 121 +#define BIO_C_SET_BUFF_READ_DATA 122 /* data to read first */ +#define BIO_C_GET_CONNECT 123 +#define BIO_C_GET_ACCEPT 124 +#define BIO_C_SET_SSL_RENEGOTIATE_BYTES 125 +#define BIO_C_GET_SSL_NUM_RENEGOTIATES 126 +#define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT 127 +#define BIO_C_FILE_SEEK 128 +#define BIO_C_GET_CIPHER_CTX 129 +#define BIO_C_SET_BUF_MEM_EOF_RETURN 130/*return end of input value*/ +#define BIO_C_SET_BIND_MODE 131 +#define BIO_C_GET_BIND_MODE 132 +#define BIO_C_FILE_TELL 133 +#define BIO_C_GET_SOCKS 134 +#define BIO_C_SET_SOCKS 135 + +#define BIO_C_SET_WRITE_BUF_SIZE 136/* for BIO_s_bio */ +#define BIO_C_GET_WRITE_BUF_SIZE 137 +#define BIO_C_MAKE_BIO_PAIR 138 +#define BIO_C_DESTROY_BIO_PAIR 139 +#define BIO_C_GET_WRITE_GUARANTEE 140 +#define BIO_C_GET_READ_REQUEST 141 +#define BIO_C_SHUTDOWN_WR 142 +#define BIO_C_NREAD0 143 +#define BIO_C_NREAD 144 +#define BIO_C_NWRITE0 145 +#define BIO_C_NWRITE 146 +#define BIO_C_RESET_READ_REQUEST 147 + + +#define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg) +#define BIO_get_app_data(s) BIO_get_ex_data(s,0) + +/* BIO_s_connect() and BIO_s_socks4a_connect() */ +#define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0,(char *)name) +#define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1,(char *)port) +#define BIO_set_conn_ip(b,ip) BIO_ctrl(b,BIO_C_SET_CONNECT,2,(char *)ip) +#define BIO_set_conn_int_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,3,(char *)port) +#define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0) +#define BIO_get_conn_port(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1) +#define BIO_get_conn_ip(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2) +#define BIO_get_conn_int_port(b) BIO_int_ctrl(b,BIO_C_GET_CONNECT,3) + + +#define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) + +/* BIO_s_accept_socket() */ +#define BIO_set_accept_port(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0,(char *)name) +#define BIO_get_accept_port(b) BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0) +/* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */ +#define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,1,(n)?"a":NULL) +#define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(char *)bio) + +#define BIO_BIND_NORMAL 0 +#define BIO_BIND_REUSEADDR_IF_UNUSED 1 +#define BIO_BIND_REUSEADDR 2 +#define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL) +#define BIO_get_bind_mode(b,mode) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL) + +#define BIO_do_connect(b) BIO_do_handshake(b) +#define BIO_do_accept(b) BIO_do_handshake(b) +#define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) + +/* BIO_s_proxy_client() */ +#define BIO_set_url(b,url) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,0,(char *)(url)) +#define BIO_set_proxies(b,p) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,1,(char *)(p)) +/* BIO_set_nbio(b,n) */ +#define BIO_set_filter_bio(b,s) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,2,(char *)(s)) +/* BIO *BIO_get_filter_bio(BIO *bio); */ +#define BIO_set_proxy_cb(b,cb) BIO_callback_ctrl(b,BIO_C_SET_PROXY_PARAM,3,(void *(*cb)())) +#define BIO_set_proxy_header(b,sk) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,4,(char *)sk) +#define BIO_set_no_connect_return(b,bool) BIO_int_ctrl(b,BIO_C_SET_PROXY_PARAM,5,bool) + +#define BIO_get_proxy_header(b,skp) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,0,(char *)skp) +#define BIO_get_proxies(b,pxy_p) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,1,(char *)(pxy_p)) +#define BIO_get_url(b,url) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,2,(char *)(url)) +#define BIO_get_no_connect_return(b) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,5,NULL) + +#define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd) +#define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)c) + +#define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)fp) +#define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)fpp) + +#define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL) +#define BIO_tell(b) (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL) + +/* name is cast to lose const, but might be better to route through a function + so we can do it safely */ +#ifdef CONST_STRICT +/* If you are wondering why this isn't defined, its because CONST_STRICT is + * purely a compile-time kludge to allow const to be checked. + */ +int BIO_read_filename(BIO *b,const char *name); +#else +#define BIO_read_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ + BIO_CLOSE|BIO_FP_READ,(char *)name) +#endif +#define BIO_write_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ + BIO_CLOSE|BIO_FP_WRITE,name) +#define BIO_append_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ + BIO_CLOSE|BIO_FP_APPEND,name) +#define BIO_rw_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ + BIO_CLOSE|BIO_FP_READ|BIO_FP_WRITE,name) + +/* WARNING WARNING, this ups the reference count on the read bio of the + * SSL structure. This is because the ssl read BIO is now pointed to by + * the next_bio field in the bio. So when you free the BIO, make sure + * you are doing a BIO_free_all() to catch the underlying BIO. */ +#define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)ssl) +#define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)sslp) +#define BIO_set_ssl_mode(b,client) BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL) +#define BIO_set_ssl_renegotiate_bytes(b,num) \ + BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL); +#define BIO_get_num_renegotiates(b) \ + BIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,NULL); +#define BIO_set_ssl_renegotiate_timeout(b,seconds) \ + BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL); + +/* defined in evp.h */ +/* #define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,1,(char *)md) */ + +#define BIO_get_mem_data(b,pp) BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)pp) +#define BIO_set_mem_buf(b,bm,c) BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)bm) +#define BIO_get_mem_ptr(b,pp) BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0,(char *)pp) +#define BIO_set_mem_eof_return(b,v) \ + BIO_ctrl(b,BIO_C_SET_BUF_MEM_EOF_RETURN,v,NULL) + +/* For the BIO_f_buffer() type */ +#define BIO_get_buffer_num_lines(b) BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL) +#define BIO_set_buffer_size(b,size) BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL) +#define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0) +#define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1) +#define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf) + +/* Don't use the next one unless you know what you are doing :-) */ +#define BIO_dup_state(b,ret) BIO_ctrl(b,BIO_CTRL_DUP,0,(char *)(ret)) + +#define BIO_reset(b) (int)BIO_ctrl(b,BIO_CTRL_RESET,0,NULL) +#define BIO_eof(b) (int)BIO_ctrl(b,BIO_CTRL_EOF,0,NULL) +#define BIO_set_close(b,c) (int)BIO_ctrl(b,BIO_CTRL_SET_CLOSE,(c),NULL) +#define BIO_get_close(b) (int)BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,NULL) +#define BIO_pending(b) (int)BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL) +#define BIO_wpending(b) (int)BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL) +/* ...pending macros have inappropriate return type */ +size_t BIO_ctrl_pending(BIO *b); +size_t BIO_ctrl_wpending(BIO *b); +#define BIO_flush(b) (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL) +#define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0, \ + cbp) +#define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,cb) + +/* For the BIO_f_buffer() type */ +#define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL) + +/* For BIO_s_bio() */ +#define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL) +#define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL) +#define BIO_make_bio_pair(b1,b2) (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2) +#define BIO_destroy_bio_pair(b) (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL) +#define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL) +/* macros with inappropriate type -- but ...pending macros use int too: */ +#define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL) +#define BIO_get_read_request(b) (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL) +size_t BIO_ctrl_get_write_guarantee(BIO *b); +size_t BIO_ctrl_get_read_request(BIO *b); +int BIO_ctrl_reset_read_request(BIO *b); + +/* ctrl macros for dgram */ +#define BIO_ctrl_dgram_connect(b,peer) \ + (int)BIO_ctrl(b,BIO_CTRL_DGRAM_CONNECT,0, (char *)peer) +#define BIO_ctrl_set_connected(b, state, peer) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, state, (char *)peer) +#define BIO_dgram_recv_timedout(b) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL) +#define BIO_dgram_send_timedout(b) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL) +#define BIO_dgram_set_peer(b,peer) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)peer) + +/* These two aren't currently implemented */ +/* int BIO_get_ex_num(BIO *bio); */ +/* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */ +int BIO_set_ex_data(BIO *bio,int idx,void *data); +void *BIO_get_ex_data(BIO *bio,int idx); +int BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); +unsigned long BIO_number_read(BIO *bio); +unsigned long BIO_number_written(BIO *bio); + +# ifndef OPENSSL_NO_FP_API +# if defined(OPENSSL_SYS_WIN16) && defined(_WINDLL) +BIO_METHOD *BIO_s_file_internal(void); +BIO *BIO_new_file_internal(char *filename, char *mode); +BIO *BIO_new_fp_internal(FILE *stream, int close_flag); +# define BIO_s_file BIO_s_file_internal +# define BIO_new_file BIO_new_file_internal +# define BIO_new_fp BIO_new_fp_internal +# else /* FP_API */ +BIO_METHOD *BIO_s_file(void ); +BIO *BIO_new_file(const char *filename, const char *mode); +BIO *BIO_new_fp(FILE *stream, int close_flag); +# define BIO_s_file_internal BIO_s_file +# define BIO_new_file_internal BIO_new_file +# define BIO_new_fp_internal BIO_s_file +# endif /* FP_API */ +# endif +BIO * BIO_new(BIO_METHOD *type); +int BIO_set(BIO *a,BIO_METHOD *type); +int BIO_free(BIO *a); +void BIO_vfree(BIO *a); +int BIO_read(BIO *b, void *data, int len); +int BIO_gets(BIO *bp,char *buf, int size); +int BIO_write(BIO *b, const void *data, int len); +int BIO_puts(BIO *bp,const char *buf); +int BIO_indent(BIO *b,int indent,int max); +long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg); +long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long)); +char * BIO_ptr_ctrl(BIO *bp,int cmd,long larg); +long BIO_int_ctrl(BIO *bp,int cmd,long larg,int iarg); +BIO * BIO_push(BIO *b,BIO *append); +BIO * BIO_pop(BIO *b); +void BIO_free_all(BIO *a); +BIO * BIO_find_type(BIO *b,int bio_type); +BIO * BIO_next(BIO *b); +BIO * BIO_get_retry_BIO(BIO *bio, int *reason); +int BIO_get_retry_reason(BIO *bio); +BIO * BIO_dup_chain(BIO *in); + +int BIO_nread0(BIO *bio, char **buf); +int BIO_nread(BIO *bio, char **buf, int num); +int BIO_nwrite0(BIO *bio, char **buf); +int BIO_nwrite(BIO *bio, char **buf, int num); + +#ifndef OPENSSL_SYS_WIN16 +long BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi, + long argl,long ret); +#else +long _far _loadds BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi, + long argl,long ret); +#endif + +BIO_METHOD *BIO_s_mem(void); +BIO *BIO_new_mem_buf(void *buf, int len); +BIO_METHOD *BIO_s_socket(void); +BIO_METHOD *BIO_s_connect(void); +BIO_METHOD *BIO_s_accept(void); +BIO_METHOD *BIO_s_fd(void); +#ifndef OPENSSL_SYS_OS2 +BIO_METHOD *BIO_s_log(void); +#endif +BIO_METHOD *BIO_s_bio(void); +BIO_METHOD *BIO_s_null(void); +BIO_METHOD *BIO_f_null(void); +BIO_METHOD *BIO_f_buffer(void); +#ifdef OPENSSL_SYS_VMS +BIO_METHOD *BIO_f_linebuffer(void); +#endif +BIO_METHOD *BIO_f_nbio_test(void); +#ifndef OPENSSL_NO_DGRAM +BIO_METHOD *BIO_s_datagram(void); +#endif + +/* BIO_METHOD *BIO_f_ber(void); */ + +int BIO_sock_should_retry(int i); +int BIO_sock_non_fatal_error(int error); +int BIO_dgram_non_fatal_error(int error); + +int BIO_fd_should_retry(int i); +int BIO_fd_non_fatal_error(int error); +int BIO_dump_cb(int (*cb)(const void *data, size_t len, void *u), + void *u, const char *s, int len); +int BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u), + void *u, const char *s, int len, int indent); +int BIO_dump(BIO *b,const char *bytes,int len); +int BIO_dump_indent(BIO *b,const char *bytes,int len,int indent); +#ifndef OPENSSL_NO_FP_API +int BIO_dump_fp(FILE *fp, const char *s, int len); +int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent); +#endif +struct hostent *BIO_gethostbyname(const char *name); +/* We might want a thread-safe interface too: + * struct hostent *BIO_gethostbyname_r(const char *name, + * struct hostent *result, void *buffer, size_t buflen); + * or something similar (caller allocates a struct hostent, + * pointed to by "result", and additional buffer space for the various + * substructures; if the buffer does not suffice, NULL is returned + * and an appropriate error code is set). + */ +int BIO_sock_error(int sock); +int BIO_socket_ioctl(int fd, long type, void *arg); +int BIO_socket_nbio(int fd,int mode); +int BIO_get_port(const char *str, unsigned short *port_ptr); +int BIO_get_host_ip(const char *str, unsigned char *ip); +int BIO_get_accept_socket(char *host_port,int mode); +int BIO_accept(int sock,char **ip_port); +int BIO_sock_init(void ); +void BIO_sock_cleanup(void); +int BIO_set_tcp_ndelay(int sock,int turn_on); + +BIO *BIO_new_socket(int sock, int close_flag); +BIO *BIO_new_dgram(int fd, int close_flag); +BIO *BIO_new_fd(int fd, int close_flag); +BIO *BIO_new_connect(char *host_port); +BIO *BIO_new_accept(char *host_port); + +int BIO_new_bio_pair(BIO **bio1, size_t writebuf1, + BIO **bio2, size_t writebuf2); +/* If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints. + * Otherwise returns 0 and sets *bio1 and *bio2 to NULL. + * Size 0 uses default value. + */ + +void BIO_copy_next_retry(BIO *b); + +/*long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);*/ + +#ifndef __GNUC__ +#define __attribute__(x) +#endif +int BIO_printf(BIO *bio, const char *format, ...) + __attribute__((__format__(__printf__,2,3))); +int BIO_vprintf(BIO *bio, const char *format, va_list args) + __attribute__((__format__(__printf__,2,0))); +int BIO_snprintf(char *buf, size_t n, const char *format, ...) + __attribute__((__format__(__printf__,3,4))); +int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) + __attribute__((__format__(__printf__,3,0))); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_BIO_strings(void); + +/* Error codes for the BIO functions. */ + +/* Function codes. */ +#define BIO_F_ACPT_STATE 100 +#define BIO_F_BIO_ACCEPT 101 +#define BIO_F_BIO_BER_GET_HEADER 102 +#define BIO_F_BIO_CALLBACK_CTRL 131 +#define BIO_F_BIO_CTRL 103 +#define BIO_F_BIO_GETHOSTBYNAME 120 +#define BIO_F_BIO_GETS 104 +#define BIO_F_BIO_GET_ACCEPT_SOCKET 105 +#define BIO_F_BIO_GET_HOST_IP 106 +#define BIO_F_BIO_GET_PORT 107 +#define BIO_F_BIO_MAKE_PAIR 121 +#define BIO_F_BIO_NEW 108 +#define BIO_F_BIO_NEW_FILE 109 +#define BIO_F_BIO_NEW_MEM_BUF 126 +#define BIO_F_BIO_NREAD 123 +#define BIO_F_BIO_NREAD0 124 +#define BIO_F_BIO_NWRITE 125 +#define BIO_F_BIO_NWRITE0 122 +#define BIO_F_BIO_PUTS 110 +#define BIO_F_BIO_READ 111 +#define BIO_F_BIO_SOCK_INIT 112 +#define BIO_F_BIO_WRITE 113 +#define BIO_F_BUFFER_CTRL 114 +#define BIO_F_CONN_CTRL 127 +#define BIO_F_CONN_STATE 115 +#define BIO_F_FILE_CTRL 116 +#define BIO_F_FILE_READ 130 +#define BIO_F_LINEBUFFER_CTRL 129 +#define BIO_F_MEM_READ 128 +#define BIO_F_MEM_WRITE 117 +#define BIO_F_SSL_NEW 118 +#define BIO_F_WSASTARTUP 119 + +/* Reason codes. */ +#define BIO_R_ACCEPT_ERROR 100 +#define BIO_R_BAD_FOPEN_MODE 101 +#define BIO_R_BAD_HOSTNAME_LOOKUP 102 +#define BIO_R_BROKEN_PIPE 124 +#define BIO_R_CONNECT_ERROR 103 +#define BIO_R_EOF_ON_MEMORY_BIO 127 +#define BIO_R_ERROR_SETTING_NBIO 104 +#define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET 105 +#define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET 106 +#define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107 +#define BIO_R_INVALID_ARGUMENT 125 +#define BIO_R_INVALID_IP_ADDRESS 108 +#define BIO_R_IN_USE 123 +#define BIO_R_KEEPALIVE 109 +#define BIO_R_NBIO_CONNECT_ERROR 110 +#define BIO_R_NO_ACCEPT_PORT_SPECIFIED 111 +#define BIO_R_NO_HOSTNAME_SPECIFIED 112 +#define BIO_R_NO_PORT_DEFINED 113 +#define BIO_R_NO_PORT_SPECIFIED 114 +#define BIO_R_NO_SUCH_FILE 128 +#define BIO_R_NULL_PARAMETER 115 +#define BIO_R_TAG_MISMATCH 116 +#define BIO_R_UNABLE_TO_BIND_SOCKET 117 +#define BIO_R_UNABLE_TO_CREATE_SOCKET 118 +#define BIO_R_UNABLE_TO_LISTEN_SOCKET 119 +#define BIO_R_UNINITIALIZED 120 +#define BIO_R_UNSUPPORTED_METHOD 121 +#define BIO_R_WRITE_TO_READ_ONLY_BIO 126 +#define BIO_R_WSASTARTUP 122 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/openssl/blowfish.h b/h/openssl/blowfish.h new file mode 100644 index 0000000..75d9bd5 --- /dev/null +++ b/h/openssl/blowfish.h @@ -0,0 +1,3 @@ +/* Empty file for backward compatibiliy only. + * To use cryptographic primatives, please use EVP API or CCI API. + */ diff --git a/h/openssl/bn.h b/h/openssl/bn.h new file mode 100644 index 0000000..222aceb --- /dev/null +++ b/h/openssl/bn.h @@ -0,0 +1,857 @@ +/* crypto/bn/bn.h */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * + * Portions of the attached software ("Contribution") are developed by + * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project. + * + * The Contribution is licensed pursuant to the Eric Young open source + * license provided above. + * + * The binary polynomial arithmetic software is originally written by + * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories. + * + */ + +#ifndef HEADER_BN_H +#define HEADER_BN_H + +#include +#ifndef OPENSSL_NO_FP_API +#include /* FILE */ +#endif +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/* These preprocessor symbols control various aspects of the bignum headers and + * library code. They're not defined by any "normal" configuration, as they are + * intended for development and testing purposes. NB: defining all three can be + * useful for debugging application code as well as openssl itself. + * + * BN_DEBUG - turn on various debugging alterations to the bignum code + * BN_DEBUG_RAND - uses random poisoning of unused words to trip up + * mismanagement of bignum internals. You must also define BN_DEBUG. + */ +/* #define BN_DEBUG */ +/* #define BN_DEBUG_RAND */ + +#define BN_MUL_COMBA +#define BN_SQR_COMBA +#define BN_RECURSION + +/* This next option uses the C libraries (2 word)/(1 word) function. + * If it is not defined, I use my C version (which is slower). + * The reason for this flag is that when the particular C compiler + * library routine is used, and the library is linked with a different + * compiler, the library is missing. This mostly happens when the + * library is built with gcc and then linked using normal cc. This would + * be a common occurrence because gcc normally produces code that is + * 2 times faster than system compilers for the big number stuff. + * For machines with only one compiler (or shared libraries), this should + * be on. Again this in only really a problem on machines + * using "long long's", are 32bit, and are not using my assembler code. */ +#if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS) || \ + defined(OPENSSL_SYS_WIN32) || defined(linux) +# ifndef BN_DIV2W +# define BN_DIV2W +# endif +#endif + +/* assuming long is 64bit - this is the DEC Alpha + * unsigned long long is only 64 bits :-(, don't define + * BN_LLONG for the DEC Alpha */ +#ifdef SIXTY_FOUR_BIT_LONG +#define BN_ULLONG unsigned long long +#define BN_ULONG unsigned long +#define BN_LONG long +#define BN_BITS 128 +#define BN_BYTES 8 +#define BN_BITS2 64 +#define BN_BITS4 32 +#define BN_MASK (0xffffffffffffffffffffffffffffffffLL) +#define BN_MASK2 (0xffffffffffffffffL) +#define BN_MASK2l (0xffffffffL) +#define BN_MASK2h (0xffffffff00000000L) +#define BN_MASK2h1 (0xffffffff80000000L) +#define BN_TBIT (0x8000000000000000L) +#define BN_DEC_CONV (10000000000000000000UL) +#define BN_DEC_FMT1 "%lu" +#define BN_DEC_FMT2 "%019lu" +#define BN_DEC_NUM 19 +#endif + +/* This is where the long long data type is 64 bits, but long is 32. + * For machines where there are 64bit registers, this is the mode to use. + * IRIX, on R4000 and above should use this mode, along with the relevant + * assembler code :-). Do NOT define BN_LLONG. + */ +#ifdef SIXTY_FOUR_BIT +#undef BN_LLONG +#undef BN_ULLONG +#define BN_ULONG unsigned long long +#define BN_LONG long long +#define BN_BITS 128 +#define BN_BYTES 8 +#define BN_BITS2 64 +#define BN_BITS4 32 +#define BN_MASK2 (0xffffffffffffffffLL) +#define BN_MASK2l (0xffffffffL) +#define BN_MASK2h (0xffffffff00000000LL) +#define BN_MASK2h1 (0xffffffff80000000LL) +#define BN_TBIT (0x8000000000000000LL) +#define BN_DEC_CONV (10000000000000000000ULL) +#define BN_DEC_FMT1 "%llu" +#define BN_DEC_FMT2 "%019llu" +#define BN_DEC_NUM 19 +#endif + +#ifdef THIRTY_TWO_BIT +#ifdef BN_LLONG +# if defined(OPENSSL_SYS_WIN32) && !defined(__GNUC__) +# define BN_ULLONG unsigned __int64 +# else +# define BN_ULLONG unsigned long long +# endif +#endif +#define BN_ULONG unsigned long +#define BN_LONG long +#define BN_BITS 64 +#define BN_BYTES 4 +#define BN_BITS2 32 +#define BN_BITS4 16 +#ifdef OPENSSL_SYS_WIN32 +/* VC++ doesn't like the LL suffix */ +#define BN_MASK (0xffffffffffffffffL) +#else +#define BN_MASK (0xffffffffffffffffLL) +#endif +#define BN_MASK2 (0xffffffffL) +#define BN_MASK2l (0xffff) +#define BN_MASK2h1 (0xffff8000L) +#define BN_MASK2h (0xffff0000L) +#define BN_TBIT (0x80000000L) +#define BN_DEC_CONV (1000000000L) +#define BN_DEC_FMT1 "%lu" +#define BN_DEC_FMT2 "%09lu" +#define BN_DEC_NUM 9 +#endif + +#ifdef SIXTEEN_BIT +#ifndef BN_DIV2W +#define BN_DIV2W +#endif +#define BN_ULLONG unsigned long +#define BN_ULONG unsigned short +#define BN_LONG short +#define BN_BITS 32 +#define BN_BYTES 2 +#define BN_BITS2 16 +#define BN_BITS4 8 +#define BN_MASK (0xffffffff) +#define BN_MASK2 (0xffff) +#define BN_MASK2l (0xff) +#define BN_MASK2h1 (0xff80) +#define BN_MASK2h (0xff00) +#define BN_TBIT (0x8000) +#define BN_DEC_CONV (100000) +#define BN_DEC_FMT1 "%u" +#define BN_DEC_FMT2 "%05u" +#define BN_DEC_NUM 5 +#endif + +#ifdef EIGHT_BIT +#ifndef BN_DIV2W +#define BN_DIV2W +#endif +#define BN_ULLONG unsigned short +#define BN_ULONG unsigned char +#define BN_LONG char +#define BN_BITS 16 +#define BN_BYTES 1 +#define BN_BITS2 8 +#define BN_BITS4 4 +#define BN_MASK (0xffff) +#define BN_MASK2 (0xff) +#define BN_MASK2l (0xf) +#define BN_MASK2h1 (0xf8) +#define BN_MASK2h (0xf0) +#define BN_TBIT (0x80) +#define BN_DEC_CONV (100) +#define BN_DEC_FMT1 "%u" +#define BN_DEC_FMT2 "%02u" +#define BN_DEC_NUM 2 +#endif + +#define BN_DEFAULT_BITS 1280 + +#define BN_FLG_MALLOCED 0x01 +#define BN_FLG_STATIC_DATA 0x02 +#define BN_FLG_EXP_CONSTTIME 0x04 /* avoid leaking exponent information through timings + * (BN_mod_exp_mont() will call BN_mod_exp_mont_consttime) */ +#ifndef OPENSSL_NO_DEPRECATED +#define BN_FLG_FREE 0x8000 /* used for debuging */ +#endif +#define BN_set_flags(b,n) ((b)->flags|=(n)) +#define BN_get_flags(b,n) ((b)->flags&(n)) + +/* get a clone of a BIGNUM with changed flags, for *temporary* use only + * (the two BIGNUMs cannot not be used in parallel!) */ +#define BN_with_flags(dest,b,n) ((dest)->d=(b)->d, \ + (dest)->top=(b)->top, \ + (dest)->dmax=(b)->dmax, \ + (dest)->neg=(b)->neg, \ + (dest)->flags=(((dest)->flags & BN_FLG_MALLOCED) \ + | ((b)->flags & ~BN_FLG_MALLOCED) \ + | BN_FLG_STATIC_DATA \ + | (n))) + +/* Already declared in ossl_typ.h */ +#if 0 +typedef struct bignum_st BIGNUM; +/* Used for temp variables (declaration hidden in bn_lcl.h) */ +typedef struct bignum_ctx BN_CTX; +typedef struct bn_blinding_st BN_BLINDING; +typedef struct bn_mont_ctx_st BN_MONT_CTX; +typedef struct bn_recp_ctx_st BN_RECP_CTX; +typedef struct bn_gencb_st BN_GENCB; +#endif + +struct bignum_st + { + BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks. */ + int top; /* Index of last used d +1. */ + /* The next are internal book keeping for bn_expand. */ + int dmax; /* Size of the d array. */ + int neg; /* one if the number is negative */ + int flags; + }; + +/* Used for montgomery multiplication */ +struct bn_mont_ctx_st + { + int ri; /* number of bits in R */ + BIGNUM RR; /* used to convert to montgomery form */ + BIGNUM N; /* The modulus */ + BIGNUM Ni; /* R*(1/R mod N) - N*Ni = 1 + * (Ni is only stored for bignum algorithm) */ + BN_ULONG n0; /* least significant word of Ni */ + int flags; + }; + +/* Used for reciprocal division/mod functions + * It cannot be shared between threads + */ +struct bn_recp_ctx_st + { + BIGNUM N; /* the divisor */ + BIGNUM Nr; /* the reciprocal */ + int num_bits; + int shift; + int flags; + }; + +/* Used for slow "generation" functions. */ +struct bn_gencb_st + { + unsigned int ver; /* To handle binary (in)compatibility */ + void *arg; /* callback-specific data */ + union + { + /* if(ver==1) - handles old style callbacks */ + void (*cb_1)(int, int, void *); + /* if(ver==2) - new callback style */ + int (*cb_2)(int, int, BN_GENCB *); + } cb; + }; +/* Wrapper function to make using BN_GENCB easier, */ +#define BN_GENCB_call ccip_BN_GENCB_call +int BN_GENCB_call(BN_GENCB *cb, int a, int b); +/* Macro to populate a BN_GENCB structure with an "old"-style callback */ +#define BN_GENCB_set_old(gencb, callback, cb_arg) { \ + BN_GENCB *tmp_gencb = (gencb); \ + tmp_gencb->ver = 1; \ + tmp_gencb->arg = (cb_arg); \ + tmp_gencb->cb.cb_1 = (callback); } + + + + +/* Macro to populate a BN_GENCB structure with a "new"-style callback */ +#define BN_GENCB_set(gencb, callback, cb_arg) { \ + BN_GENCB *tmp_gencb = (gencb); \ + tmp_gencb->ver = 2; \ + tmp_gencb->arg = (cb_arg); \ + tmp_gencb->cb.cb_2 = (callback); } + +#define BN_prime_checks 0 /* default: select number of iterations + based on the size of the number */ + +/* number of Miller-Rabin iterations for an error rate of less than 2^-80 + * for random 'b'-bit input, b >= 100 (taken from table 4.4 in the Handbook + * of Applied Cryptography [Menezes, van Oorschot, Vanstone; CRC Press 1996]; + * original paper: Damgaard, Landrock, Pomerance: Average case error estimates + * for the strong probable prime test. -- Math. Comp. 61 (1993) 177-194) */ +#define BN_prime_checks_for_size(b) ((b) >= 1300 ? 2 : \ + (b) >= 850 ? 3 : \ + (b) >= 650 ? 4 : \ + (b) >= 550 ? 5 : \ + (b) >= 450 ? 6 : \ + (b) >= 400 ? 7 : \ + (b) >= 350 ? 8 : \ + (b) >= 300 ? 9 : \ + (b) >= 250 ? 12 : \ + (b) >= 200 ? 15 : \ + (b) >= 150 ? 18 : \ + /* b >= 100 */ 27) + +#define BN_num_bytes(a) ((BN_num_bits(a)+7)/8) + +/* Note that BN_abs_is_word didn't work reliably for w == 0 until 0.9.8 */ +#define BN_abs_is_word(a,w) ((((a)->top == 1) && ((a)->d[0] == (BN_ULONG)(w))) || \ + (((w) == 0) && ((a)->top == 0))) +#define BN_is_zero(a) ((a)->top == 0) +#define BN_is_one(a) (BN_abs_is_word((a),1) && !(a)->neg) +#define BN_is_word(a,w) (BN_abs_is_word((a),(w)) && (!(w) || !(a)->neg)) +#define BN_is_odd(a) (((a)->top > 0) && ((a)->d[0] & 1)) + +#define BN_one(a) (BN_set_word((a),1)) +#define BN_zero_ex(a) \ + do { \ + BIGNUM *_tmp_bn = (a); \ + _tmp_bn->top = 0; \ + _tmp_bn->neg = 0; \ + } while(0) +#ifdef OPENSSL_NO_DEPRECATED +#define BN_zero(a) BN_zero_ex(a) +#else +#define BN_zero(a) (BN_set_word((a),0)) +#endif + +/* +** --- CCI prototypes +*/ +int ccip_BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +BN_ULONG ccip_bn_mul_add_wordCHEs(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w); +BN_ULONG ccip_bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w); +void ccip_bn_sqr_words(BN_ULONG *rp, const BN_ULONG *ap, int num); +BN_ULONG ccip_bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d); +BN_ULONG ccip_bn_add_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int num); +BN_ULONG ccip_bn_sub_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int num); + +void ccip_BN_CTX_init(BN_CTX *c); +void ccip_BN_CTX_free(BN_CTX *c); + +void BN_clear_free(BIGNUM *a); +BN_CTX *BN_CTX_new(void); +#ifndef OPENSSL_NO_DEPRECATED +void BN_CTX_init(BN_CTX *ctx); +#endif +void BN_CTX_free(BN_CTX *ctx); +void BN_CTX_start(BN_CTX *ctx); +BIGNUM *BN_CTX_get(BN_CTX *ctx); +void BN_CTX_end(BN_CTX *ctx); + +#define bn_mul_add_words ccip_bn_mul_add_words +#define bn_mul_words ccip_bn_mul_words +#define bn_sqr_words ccip_bn_sqr_words +#define bn_div_words ccip_bn_div_words +#define bn_add_words ccip_bn_add_words +#define bn_sub_words ccip_bn_sub_words +#define BN_uadd ccip_BN_uadd + +void BN_bn2cci( const BIGNUM *a, cci_m ret ); +void BN_cci2bn( cci_m op, BIGNUM *ret ); +int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); + +BN_CTX *BN_CTX_new(void); + + +const BIGNUM *BN_value_one(void); +char * BN_options(void); +int BN_rand(BIGNUM *rnd, int bits, int top,int bottom); +int BN_pseudo_rand(BIGNUM *rnd, int bits, int top,int bottom); +int BN_rand_range(BIGNUM *rnd, BIGNUM *range); +int BN_pseudo_rand_range(BIGNUM *rnd, BIGNUM *range); +int BN_num_bits(const BIGNUM *a); +int BN_num_bits_word(BN_ULONG); +BIGNUM *BN_new(void); +void BN_init(BIGNUM *); +BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b); +void BN_swap(BIGNUM *a, BIGNUM *b); +BIGNUM *BN_bin2bn(const unsigned char *s,int len,BIGNUM *ret); +int BN_bn2bin(const BIGNUM *a, unsigned char *to); +BIGNUM *BN_mpi2bn(const unsigned char *s,int len,BIGNUM *ret); +int BN_bn2mpi(const BIGNUM *a, unsigned char *to); +int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); +int BN_sqr(BIGNUM *r, const BIGNUM *a,BN_CTX *ctx); +/* BN_set_negative(): sets sign of a bignum */ +#define BN_set_negative ccip_BN_set_negative +void BN_set_negative(BIGNUM *b, int n); +/* BN_get_negative(): returns 1 if the bignum is < 0 and 0 otherwise */ +#define BN_is_negative(a) ((a)->neg != 0) + +int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, + BN_CTX *ctx); +#define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx)) +int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx); +int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx); +int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m); +int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx); +int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m); +int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *m, BN_CTX *ctx); +int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); +int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); +int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m); +int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, BN_CTX *ctx); +int BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m); + +BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w); +BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w); +int BN_mul_word(BIGNUM *a, BN_ULONG w); +int BN_add_word(BIGNUM *a, BN_ULONG w); +int BN_sub_word(BIGNUM *a, BN_ULONG w); +int BN_set_word(BIGNUM *a, BN_ULONG w); +BN_ULONG BN_get_word(const BIGNUM *a); + +int BN_cmp(const BIGNUM *a, const BIGNUM *b); +void BN_free(BIGNUM *a); +int BN_is_bit_set(const BIGNUM *a, int n); +int BN_lshift(BIGNUM *r, const BIGNUM *a, int n); +int BN_lshift1(BIGNUM *r, const BIGNUM *a); +int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,BN_CTX *ctx); + +int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m,BN_CTX *ctx); +int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); + + +#define BN_mod_exp_mont_consttime ccip_BN_mod_exp_mont_consttime +int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont); +int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); +int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1, + const BIGNUM *a2, const BIGNUM *p2,const BIGNUM *m, + BN_CTX *ctx,BN_MONT_CTX *m_ctx); +int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m,BN_CTX *ctx); + +int BN_mask_bits(BIGNUM *a,int n); +#ifndef OPENSSL_NO_FP_API +int BN_print_fp(FILE *fp, const BIGNUM *a); +#endif +#ifdef HEADER_BIO_H +int BN_print(BIO *fp, const BIGNUM *a); +#else +int BN_print(void *fp, const BIGNUM *a); +#endif +int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx); +int BN_rshift(BIGNUM *r, const BIGNUM *a, int n); +int BN_rshift1(BIGNUM *r, const BIGNUM *a); +void BN_clear(BIGNUM *a); +BIGNUM *BN_dup(const BIGNUM *a); +int BN_ucmp(const BIGNUM *a, const BIGNUM *b); +int BN_set_bit(BIGNUM *a, int n); +int BN_clear_bit(BIGNUM *a, int n); +char * BN_bn2hex(const BIGNUM *a); +char * BN_bn2dec(const BIGNUM *a); +int BN_hex2bn(BIGNUM **a, const char *str); +int BN_dec2bn(BIGNUM **a, const char *str); +int BN_gcd(BIGNUM *r,const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx); +int BN_kronecker(const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx); /* returns -2 for error */ +BIGNUM *BN_mod_inverse(BIGNUM *ret, + const BIGNUM *a, const BIGNUM *n,BN_CTX *ctx); +BIGNUM *BN_mod_sqrt(BIGNUM *ret, + const BIGNUM *a, const BIGNUM *n,BN_CTX *ctx); + +/* Deprecated versions */ +#ifndef OPENSSL_NO_DEPRECATED +BIGNUM *BN_generate_prime(BIGNUM *ret,int bits,int safe, + const BIGNUM *add, const BIGNUM *rem, + void (*callback)(int,int,void *),void *cb_arg); +int BN_is_prime(const BIGNUM *p,int nchecks, + void (*callback)(int,int,void *), + BN_CTX *ctx,void *cb_arg); +int BN_is_prime_fasttest(const BIGNUM *p,int nchecks, + void (*callback)(int,int,void *),BN_CTX *ctx,void *cb_arg, + int do_trial_division); +#endif /* !defined(OPENSSL_NO_DEPRECATED) */ + +/* Newer versions */ +#define BN_generate_prime_ex ccip_BN_generate_prime_ex +int BN_generate_prime_ex(BIGNUM *ret,int bits,int safe, const BIGNUM *add, + const BIGNUM *rem, BN_GENCB *cb); +#define BN_is_prime_ex ccip_BN_is_prime_ex +int BN_is_prime_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx, BN_GENCB *cb); +#define BN_is_prime_fasttest_ex ccip_BN_is_prime_fasttest_ex +int BN_is_prime_fasttest_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx, + int do_trial_division, BN_GENCB *cb); + +BN_MONT_CTX *BN_MONT_CTX_new(void ); +void BN_MONT_CTX_init(BN_MONT_CTX *ctx); +int BN_mod_mul_montgomery(BIGNUM *r,const BIGNUM *a,const BIGNUM *b, + BN_MONT_CTX *mont, BN_CTX *ctx); +#define BN_to_montgomery(r,a,mont,ctx) BN_mod_mul_montgomery(\ + (r),(a),&((mont)->RR),(mont),(ctx)) +int BN_from_montgomery(BIGNUM *r,const BIGNUM *a, + BN_MONT_CTX *mont, BN_CTX *ctx); +void BN_MONT_CTX_free(BN_MONT_CTX *mont); +int BN_MONT_CTX_set(BN_MONT_CTX *mont,const BIGNUM *mod,BN_CTX *ctx); +BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to,BN_MONT_CTX *from); + +#define BN_MONT_CTX_set_locked ccip_BN_MONT_CTX_set_locked +BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock, + const BIGNUM *mod, BN_CTX *ctx); + + + +/* BN_BLINDING flags */ +#define BN_BLINDING_NO_UPDATE 0x00000001 +#define BN_BLINDING_NO_RECREATE 0x00000002 + +BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod); +void BN_BLINDING_free(BN_BLINDING *b); +int BN_BLINDING_update(BN_BLINDING *b,BN_CTX *ctx); +int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); +int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); +int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *); +int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *); +unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *); + +#define BN_BLINDING_set_thread_id ccip_BN_BLINDING_set_thread_id +void BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long); + + +unsigned long BN_BLINDING_get_flags(const BN_BLINDING *); +void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long); + + +#define BN_BLINDING_create_param ccip_BN_BLINDING_create_param + +BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, + const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, + int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), + BN_MONT_CTX *m_ctx); + + + +#ifndef OPENSSL_NO_DEPRECATED +void BN_set_params(int mul,int high,int low,int mont); +int BN_get_params(int which); /* 0, mul, 1 high, 2 low, 3 mont */ +#endif + +void BN_RECP_CTX_init(BN_RECP_CTX *recp); +BN_RECP_CTX *BN_RECP_CTX_new(void); +void BN_RECP_CTX_free(BN_RECP_CTX *recp); +int BN_RECP_CTX_set(BN_RECP_CTX *recp,const BIGNUM *rdiv,BN_CTX *ctx); +int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y, + BN_RECP_CTX *recp,BN_CTX *ctx); +int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx); +int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, + BN_RECP_CTX *recp, BN_CTX *ctx); + +/* Functions for arithmetic over binary polynomials represented by BIGNUMs. + * + * The BIGNUM::neg property of BIGNUMs representing binary polynomials is + * ignored. + * + * Note that input arguments are not const so that their bit arrays can + * be expanded to the appropriate size if needed. + */ + +int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); /*r = a + b*/ +#define BN_GF2m_sub(r, a, b) BN_GF2m_add(r, a, b) +int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p); /*r=a mod p*/ +int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *p, BN_CTX *ctx); /* r = (a * b) mod p */ +int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + BN_CTX *ctx); /* r = (a * a) mod p */ +int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *b, const BIGNUM *p, + BN_CTX *ctx); /* r = (1 / b) mod p */ +int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *p, BN_CTX *ctx); /* r = (a / b) mod p */ +int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *p, BN_CTX *ctx); /* r = (a ^ b) mod p */ +int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + BN_CTX *ctx); /* r = sqrt(a) mod p */ +int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + BN_CTX *ctx); /* r^2 + r = a mod p */ +#define BN_GF2m_cmp(a, b) BN_ucmp((a), (b)) +/* Some functions allow for representation of the irreducible polynomials + * as an unsigned int[], say p. The irreducible f(t) is then of the form: + * t^p[0] + t^p[1] + ... + t^p[k] + * where m = p[0] > p[1] > ... > p[k] = 0. + */ +int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[]); + /* r = a mod p */ +int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const unsigned int p[], BN_CTX *ctx); /* r = (a * b) mod p */ +int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[], + BN_CTX *ctx); /* r = (a * a) mod p */ +int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const unsigned int p[], + BN_CTX *ctx); /* r = (1 / b) mod p */ +int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const unsigned int p[], BN_CTX *ctx); /* r = (a / b) mod p */ +int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const unsigned int p[], BN_CTX *ctx); /* r = (a ^ b) mod p */ +int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, + const unsigned int p[], BN_CTX *ctx); /* r = sqrt(a) mod p */ +int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a, + const unsigned int p[], BN_CTX *ctx); /* r^2 + r = a mod p */ +int BN_GF2m_poly2arr(const BIGNUM *a, unsigned int p[], int max); +int BN_GF2m_arr2poly(const unsigned int p[], BIGNUM *a); + +/* faster mod functions for the 'NIST primes' + * 0 <= a < p^2 */ +int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); + +const BIGNUM *BN_get0_nist_prime_192(void); +const BIGNUM *BN_get0_nist_prime_224(void); +const BIGNUM *BN_get0_nist_prime_256(void); +const BIGNUM *BN_get0_nist_prime_384(void); +const BIGNUM *BN_get0_nist_prime_521(void); + +/* library internal functions */ + +#define bn_expand(a,bits) ((((((bits+BN_BITS2-1))/BN_BITS2)) <= (a)->dmax)?\ + (a):bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2)) +#define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words))) +BIGNUM *bn_expand2(BIGNUM *a, int words); +#ifndef OPENSSL_NO_DEPRECATED +BIGNUM *bn_dup_expand(const BIGNUM *a, int words); /* unused */ +#endif + +/* Bignum consistency macros + * There is one "API" macro, bn_fix_top(), for stripping leading zeroes from + * bignum data after direct manipulations on the data. There is also an + * "internal" macro, bn_check_top(), for verifying that there are no leading + * zeroes. Unfortunately, some auditing is required due to the fact that + * bn_fix_top() has become an overabused duct-tape because bignum data is + * occasionally passed around in an inconsistent state. So the following + * changes have been made to sort this out; + * - bn_fix_top()s implementation has been moved to bn_correct_top() + * - if BN_DEBUG isn't defined, bn_fix_top() maps to bn_correct_top(), and + * bn_check_top() is as before. + * - if BN_DEBUG *is* defined; + * - bn_check_top() tries to pollute unused words even if the bignum 'top' is + * consistent. (ed: only if BN_DEBUG_RAND is defined) + * - bn_fix_top() maps to bn_check_top() rather than "fixing" anything. + * The idea is to have debug builds flag up inconsistent bignums when they + * occur. If that occurs in a bn_fix_top(), we examine the code in question; if + * the use of bn_fix_top() was appropriate (ie. it follows directly after code + * that manipulates the bignum) it is converted to bn_correct_top(), and if it + * was not appropriate, we convert it permanently to bn_check_top() and track + * down the cause of the bug. Eventually, no internal code should be using the + * bn_fix_top() macro. External applications and libraries should try this with + * their own code too, both in terms of building against the openssl headers + * with BN_DEBUG defined *and* linking with a version of OpenSSL built with it + * defined. This not only improves external code, it provides more test + * coverage for openssl's own code. + */ + +#ifdef BN_DEBUG + +/* We only need assert() when debugging */ +#include + +#ifdef BN_DEBUG_RAND +/* To avoid "make update" cvs wars due to BN_DEBUG, use some tricks */ +#ifndef RAND_pseudo_bytes +int RAND_pseudo_bytes(unsigned char *buf,int num); +#define BN_DEBUG_TRIX +#endif +#define bn_pollute(a) \ + do { \ + const BIGNUM *_bnum1 = (a); \ + if(_bnum1->top < _bnum1->dmax) { \ + unsigned char _tmp_char; \ + /* We cast away const without the compiler knowing, any \ + * *genuinely* constant variables that aren't mutable \ + * wouldn't be constructed with top!=dmax. */ \ + BN_ULONG *_not_const; \ + memcpy(&_not_const, &_bnum1->d, sizeof(BN_ULONG*)); \ + RAND_pseudo_bytes(&_tmp_char, 1); \ + memset((unsigned char *)(_not_const + _bnum1->top), _tmp_char, \ + (_bnum1->dmax - _bnum1->top) * sizeof(BN_ULONG)); \ + } \ + } while(0) +#ifdef BN_DEBUG_TRIX +#undef RAND_pseudo_bytes +#endif +#else +#define bn_pollute(a) +#endif +#define bn_check_top(a) \ + do { \ + const BIGNUM *_bnum2 = (a); \ + assert((_bnum2->top == 0) || \ + (_bnum2->d[_bnum2->top - 1] != 0)); \ + bn_pollute(_bnum2); \ + } while(0) + +#define bn_fix_top(a) bn_check_top(a) + +#else /* !BN_DEBUG */ + +#define bn_pollute(a) +#define bn_check_top(a) +#define bn_fix_top(a) bn_correct_top(a) + +#endif + +#define bn_correct_top(a) \ + { \ + BN_ULONG *ftl; \ + if ((a)->top > 0) \ + { \ + for (ftl= &((a)->d[(a)->top-1]); (a)->top > 0; (a)->top--) \ + if (*(ftl--)) break; \ + } \ + bn_pollute(a); \ + } + +int BN_bntest_rand(BIGNUM *rnd, int bits, int top,int bottom); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_BN_strings(void); + +/* Error codes for the BN functions. */ + +/* Function codes. */ +#define BN_F_BNRAND 127 +#define BN_F_BN_BLINDING_CONVERT_EX 100 +#define BN_F_BN_BLINDING_CREATE_PARAM 128 +#define BN_F_BN_BLINDING_INVERT_EX 101 +#define BN_F_BN_BLINDING_NEW 102 +#define BN_F_BN_BLINDING_UPDATE 103 +#define BN_F_BN_BN2DEC 104 +#define BN_F_BN_BN2HEX 105 +#define BN_F_BN_CTX_GET 116 +#define BN_F_BN_CTX_NEW 106 +#define BN_F_BN_CTX_START 129 +#define BN_F_BN_DIV 107 +#define BN_F_BN_DIV_RECP 130 +#define BN_F_BN_EXP 123 +#define BN_F_BN_EXPAND2 108 +#define BN_F_BN_EXPAND_INTERNAL 120 +#define BN_F_BN_GF2M_MOD 131 +#define BN_F_BN_GF2M_MOD_EXP 132 +#define BN_F_BN_GF2M_MOD_MUL 133 +#define BN_F_BN_GF2M_MOD_SOLVE_QUAD 134 +#define BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR 135 +#define BN_F_BN_GF2M_MOD_SQR 136 +#define BN_F_BN_GF2M_MOD_SQRT 137 +#define BN_F_BN_MOD_EXP2_MONT 118 +#define BN_F_BN_MOD_EXP_MONT 109 +#define BN_F_BN_MOD_EXP_MONT_CONSTTIME 124 +#define BN_F_BN_MOD_EXP_MONT_WORD 117 +#define BN_F_BN_MOD_EXP_RECP 125 +#define BN_F_BN_MOD_EXP_SIMPLE 126 +#define BN_F_BN_MOD_INVERSE 110 +#define BN_F_BN_MOD_LSHIFT_QUICK 119 +#define BN_F_BN_MOD_MUL_RECIPROCAL 111 +#define BN_F_BN_MOD_SQRT 121 +#define BN_F_BN_MPI2BN 112 +#define BN_F_BN_NEW 113 +#define BN_F_BN_RAND 114 +#define BN_F_BN_RAND_RANGE 122 +#define BN_F_BN_USUB 115 + +/* Reason codes. */ +#define BN_R_ARG2_LT_ARG3 100 +#define BN_R_BAD_RECIPROCAL 101 +#define BN_R_BIGNUM_TOO_LONG 114 +#define BN_R_CALLED_WITH_EVEN_MODULUS 102 +#define BN_R_DIV_BY_ZERO 103 +#define BN_R_ENCODING_ERROR 104 +#define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA 105 +#define BN_R_INPUT_NOT_REDUCED 110 +#define BN_R_INVALID_LENGTH 106 +#define BN_R_INVALID_RANGE 115 +#define BN_R_NOT_A_SQUARE 111 +#define BN_R_NOT_INITIALIZED 107 +#define BN_R_NO_INVERSE 108 +#define BN_R_NO_SOLUTION 116 +#define BN_R_P_IS_NOT_PRIME 112 +#define BN_R_TOO_MANY_ITERATIONS 113 +#define BN_R_TOO_MANY_TEMPORARY_VARIABLES 109 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/openssl/buffer.h b/h/openssl/buffer.h new file mode 100644 index 0000000..1db9607 --- /dev/null +++ b/h/openssl/buffer.h @@ -0,0 +1,118 @@ +/* crypto/buffer/buffer.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_BUFFER_H +#define HEADER_BUFFER_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#if !defined(NO_SYS_TYPES_H) +#include +#endif + +/* Already declared in ossl_typ.h */ +/* typedef struct buf_mem_st BUF_MEM; */ + +struct buf_mem_st + { + int length; /* current number of bytes */ + char *data; + int max; /* size of buffer */ + }; + +BUF_MEM *BUF_MEM_new(void); +void BUF_MEM_free(BUF_MEM *a); +int BUF_MEM_grow(BUF_MEM *str, int len); +int BUF_MEM_grow_clean(BUF_MEM *str, int len); +char * BUF_strdup(const char *str); +char * BUF_strndup(const char *str, size_t siz); +void * BUF_memdup(const void *data, size_t siz); + +/* safe string functions */ +size_t BUF_strlcpy(char *dst,const char *src,size_t siz); +size_t BUF_strlcat(char *dst,const char *src,size_t siz); + + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_BUF_strings(void); + +/* Error codes for the BUF functions. */ + +/* Function codes. */ +#define BUF_F_BUF_MEMDUP 103 +#define BUF_F_BUF_MEM_GROW 100 +#define BUF_F_BUF_MEM_GROW_CLEAN 105 +#define BUF_F_BUF_MEM_NEW 101 +#define BUF_F_BUF_STRDUP 102 +#define BUF_F_BUF_STRNDUP 104 + +/* Reason codes. */ + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/openssl/cast.h b/h/openssl/cast.h new file mode 100644 index 0000000..2845ab5 --- /dev/null +++ b/h/openssl/cast.h @@ -0,0 +1,4 @@ +/* Empty file for backward compatibiliy only. + * To use cryptographic primatives, please use EVP API or CCI API. + */ +#include diff --git a/h/openssl/comp.h b/h/openssl/comp.h new file mode 100644 index 0000000..5d59354 --- /dev/null +++ b/h/openssl/comp.h @@ -0,0 +1,66 @@ + +#ifndef HEADER_COMP_H +#define HEADER_COMP_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct comp_ctx_st COMP_CTX; + +typedef struct comp_method_st + { + int type; /* NID for compression library */ + const char *name; /* A text string to identify the library */ + int (*init)(COMP_CTX *ctx); + void (*finish)(COMP_CTX *ctx); + int (*compress)(COMP_CTX *ctx, + unsigned char *out, unsigned int olen, + unsigned char *in, unsigned int ilen); + int (*expand)(COMP_CTX *ctx, + unsigned char *out, unsigned int olen, + unsigned char *in, unsigned int ilen); + /* The following two do NOTHING, but are kept for backward compatibility */ + long (*ctrl)(void); + long (*callback_ctrl)(void); + } COMP_METHOD; + +struct comp_ctx_st + { + COMP_METHOD *meth; + unsigned long compress_in; + unsigned long compress_out; + unsigned long expand_in; + unsigned long expand_out; + + CRYPTO_EX_DATA ex_data; + }; + + +COMP_CTX *COMP_CTX_new(COMP_METHOD *meth); +void COMP_CTX_free(COMP_CTX *ctx); +int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, + unsigned char *in, int ilen); +int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, + unsigned char *in, int ilen); +COMP_METHOD *COMP_rle(void ); +COMP_METHOD *COMP_zlib(void ); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_COMP_strings(void); + +/* Error codes for the COMP functions. */ + +/* Function codes. */ + +/* Reason codes. */ + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/openssl/compatibility.h b/h/openssl/compatibility.h new file mode 100644 index 0000000..6457f92 --- /dev/null +++ b/h/openssl/compatibility.h @@ -0,0 +1,44 @@ +/* compatibility.h - Header file to convert OpenSSL constants to CCI constants */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,03feb05,cdw created +*/ + +/* +DESCRIPTION + +This header file is used to convert some OpenSSL crypto based +constants to their CCI equivalents. This is required for backwards +compatibility with source code that hasn't yet been converted to use +CCI. + +*/ + +#ifndef _COMPATIBILITY_H_ +#define _COMPATIBILITY_H_ + +#include + +#define MD2_BLOCK CCI_MD2_BLOCKSIZE +#define MD2_DIGEST_LENGTH CCI_MD2_DIGESTSIZE +#define MD2_INT unsigned int +#define MD4_CBLOCK CCI_MD4_BLOCKSIZE +#define MD4_DIGEST_LENGTH CCI_MD4_DIGESTSIZE +#define MD5_CBLOCK CCI_MD5_BLOCKSIZE +#define MD5_DIGEST_LENGTH CCI_MD5_DIGESTSIZE +#define RIPEMD160_CBLOCK CCI_RMD160_BLOCKSIZE +#define RIPEMD160_DIGEST_LENGTH CCI_RMD160_DIGESTSIZE +#define SHA_CBLOCK CCI_SHA1_BLOCKSIZE +#define SHA_DIGEST_LENGTH CCI_SHA1_DIGESTSIZE +#define SHA256_CBLOCK CCI_SHA256_BLOCKSIZE +#define SHA256_DIGEST_LENGTH CCI_SHA256_DIGESTSIZE +#define SHA384_CBLOCK CCI_SHA384_BLOCKSIZE +#define SHA384_DIGEST_LENGTH CCI_SHA384_DIGESTSIZE +#define SHA512_CBLOCK CCI_SHA512_BLOCKSIZE +#define SHA512_DIGEST_LENGTH CCI_SHA512_DIGESTSIZE + +#endif diff --git a/h/openssl/conf.h b/h/openssl/conf.h new file mode 100644 index 0000000..4c073dd --- /dev/null +++ b/h/openssl/conf.h @@ -0,0 +1,253 @@ +/* crypto/conf/conf.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_CONF_H +#define HEADER_CONF_H + +#include +#include +#include +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct + { + char *section; + char *name; + char *value; + } CONF_VALUE; + +DECLARE_STACK_OF(CONF_VALUE) +DECLARE_STACK_OF(CONF_MODULE) +DECLARE_STACK_OF(CONF_IMODULE) + +struct conf_st; +struct conf_method_st; +typedef struct conf_method_st CONF_METHOD; + +struct conf_method_st + { + const char *name; + CONF *(*create)(CONF_METHOD *meth); + int (*init)(CONF *conf); + int (*destroy)(CONF *conf); + int (*destroy_data)(CONF *conf); + int (*load_bio)(CONF *conf, BIO *bp, long *eline); + int (*dump)(const CONF *conf, BIO *bp); + int (*is_number)(const CONF *conf, char c); + int (*to_int)(const CONF *conf, char c); + int (*load)(CONF *conf, const char *name, long *eline); + }; + +/* Module definitions */ + +typedef struct conf_imodule_st CONF_IMODULE; +typedef struct conf_module_st CONF_MODULE; + +/* DSO module function typedefs */ +typedef int conf_init_func(CONF_IMODULE *md, const CONF *cnf); +typedef void conf_finish_func(CONF_IMODULE *md); + +#define CONF_MFLAGS_IGNORE_ERRORS 0x1 +#define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2 +#define CONF_MFLAGS_SILENT 0x4 +#define CONF_MFLAGS_NO_DSO 0x8 +#define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10 + +int CONF_set_default_method(CONF_METHOD *meth); +void CONF_set_nconf(CONF *conf,LHASH *hash); +LHASH *CONF_load(LHASH *conf,const char *file,long *eline); +#ifndef OPENSSL_NO_FP_API +LHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline); +#endif +LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline); +STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,const char *section); +char *CONF_get_string(LHASH *conf,const char *group,const char *name); +long CONF_get_number(LHASH *conf,const char *group,const char *name); +void CONF_free(LHASH *conf); +int CONF_dump_fp(LHASH *conf, FILE *out); +int CONF_dump_bio(LHASH *conf, BIO *out); + +void OPENSSL_config(const char *config_name); +void OPENSSL_no_config(void); + +/* New conf code. The semantics are different from the functions above. + If that wasn't the case, the above functions would have been replaced */ + +struct conf_st + { + CONF_METHOD *meth; + void *meth_data; + LHASH *data; + }; + +CONF *NCONF_new(CONF_METHOD *meth); +CONF_METHOD *NCONF_default(void); +CONF_METHOD *NCONF_WIN32(void); +#if 0 /* Just to give you an idea of what I have in mind */ +CONF_METHOD *NCONF_XML(void); +#endif +void NCONF_free(CONF *conf); +void NCONF_free_data(CONF *conf); + +int NCONF_load(CONF *conf,const char *file,long *eline); +#ifndef OPENSSL_NO_FP_API +int NCONF_load_fp(CONF *conf, FILE *fp,long *eline); +#endif +int NCONF_load_bio(CONF *conf, BIO *bp,long *eline); +STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,const char *section); +char *NCONF_get_string(const CONF *conf,const char *group,const char *name); +int NCONF_get_number_e(const CONF *conf,const char *group,const char *name, + long *result); +int NCONF_dump_fp(const CONF *conf, FILE *out); +int NCONF_dump_bio(const CONF *conf, BIO *out); + +#if 0 /* The following function has no error checking, + and should therefore be avoided */ +long NCONF_get_number(CONF *conf,char *group,char *name); +#else +#define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r) +#endif + +/* Module functions */ + +int CONF_modules_load(const CONF *cnf, const char *appname, + unsigned long flags); +int CONF_modules_load_file(const char *filename, const char *appname, + unsigned long flags); +void CONF_modules_unload(int all); +void CONF_modules_finish(void); +void CONF_modules_free(void); +int CONF_module_add(const char *name, conf_init_func *ifunc, + conf_finish_func *ffunc); + +const char *CONF_imodule_get_name(const CONF_IMODULE *md); +const char *CONF_imodule_get_value(const CONF_IMODULE *md); +void *CONF_imodule_get_usr_data(const CONF_IMODULE *md); +void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data); +CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md); +unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md); +void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags); +void *CONF_module_get_usr_data(CONF_MODULE *pmod); +void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data); + +char *CONF_get1_default_config_file(void); + +int CONF_parse_list(const char *list, int sep, int nospc, + int (*list_cb)(const char *elem, int len, void *usr), void *arg); + +void OPENSSL_load_builtin_modules(void); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_CONF_strings(void); + +/* Error codes for the CONF functions. */ + +/* Function codes. */ +#define CONF_F_CONF_DUMP_FP 104 +#define CONF_F_CONF_LOAD 100 +#define CONF_F_CONF_LOAD_BIO 102 +#define CONF_F_CONF_LOAD_FP 103 +#define CONF_F_CONF_MODULES_LOAD 116 +#define CONF_F_DEF_LOAD 120 +#define CONF_F_DEF_LOAD_BIO 121 +#define CONF_F_MODULE_INIT 115 +#define CONF_F_MODULE_LOAD_DSO 117 +#define CONF_F_MODULE_RUN 118 +#define CONF_F_NCONF_DUMP_BIO 105 +#define CONF_F_NCONF_DUMP_FP 106 +#define CONF_F_NCONF_GET_NUMBER 107 +#define CONF_F_NCONF_GET_NUMBER_E 112 +#define CONF_F_NCONF_GET_SECTION 108 +#define CONF_F_NCONF_GET_STRING 109 +#define CONF_F_NCONF_LOAD 113 +#define CONF_F_NCONF_LOAD_BIO 110 +#define CONF_F_NCONF_LOAD_FP 114 +#define CONF_F_NCONF_NEW 111 +#define CONF_F_STR_COPY 101 + +/* Reason codes. */ +#define CONF_R_ERROR_LOADING_DSO 110 +#define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100 +#define CONF_R_MISSING_EQUAL_SIGN 101 +#define CONF_R_MISSING_FINISH_FUNCTION 111 +#define CONF_R_MISSING_INIT_FUNCTION 112 +#define CONF_R_MODULE_INITIALIZATION_ERROR 109 +#define CONF_R_NO_CLOSE_BRACE 102 +#define CONF_R_NO_CONF 105 +#define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106 +#define CONF_R_NO_SECTION 107 +#define CONF_R_NO_SUCH_FILE 114 +#define CONF_R_NO_VALUE 108 +#define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103 +#define CONF_R_UNKNOWN_MODULE_NAME 113 +#define CONF_R_VARIABLE_HAS_NO_VALUE 104 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/openssl/conf_api.h b/h/openssl/conf_api.h new file mode 100644 index 0000000..87a954a --- /dev/null +++ b/h/openssl/conf_api.h @@ -0,0 +1,89 @@ +/* conf_api.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_CONF_API_H +#define HEADER_CONF_API_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Up until OpenSSL 0.9.5a, this was new_section */ +CONF_VALUE *_CONF_new_section(CONF *conf, const char *section); +/* Up until OpenSSL 0.9.5a, this was get_section */ +CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section); +/* Up until OpenSSL 0.9.5a, this was CONF_get_section */ +STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, + const char *section); + +int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); +char *_CONF_get_string(const CONF *conf, const char *section, + const char *name); +long _CONF_get_number(const CONF *conf, const char *section, const char *name); + +int _CONF_new_data(CONF *conf); +void _CONF_free_data(CONF *conf); + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/h/openssl/crypto.h b/h/openssl/crypto.h new file mode 100644 index 0000000..d2b5ffe --- /dev/null +++ b/h/openssl/crypto.h @@ -0,0 +1,550 @@ +/* crypto/crypto.h */ +/* ==================================================================== + * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * ECDH support in OpenSSL originally developed by + * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. + */ + +#ifndef HEADER_CRYPTO_H +#define HEADER_CRYPTO_H + +#include + +#include + +#ifndef OPENSSL_NO_FP_API +#include +#endif + +#include +#include +#include +#include + +#ifdef CHARSET_EBCDIC +#include +#endif + +/* Resolve problems on some operating systems with symbol names that clash + one way or another */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Backward compatibility to SSLeay */ +/* This is more to be used to check the correct DLL is being used + * in the MS world. */ +#define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER +#define SSLEAY_VERSION 0 +/* #define SSLEAY_OPTIONS 1 no longer supported */ +#define SSLEAY_CFLAGS 2 +#define SSLEAY_BUILT_ON 3 +#define SSLEAY_PLATFORM 4 +#define SSLEAY_DIR 5 + +/* Already declared in ossl_typ.h */ +#if 0 +typedef struct crypto_ex_data_st CRYPTO_EX_DATA; +/* Called when a new object is created */ +typedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad, + int idx, long argl, void *argp); +/* Called when an object is free()ed */ +typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad, + int idx, long argl, void *argp); +/* Called when we need to dup an object */ +typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, + int idx, long argl, void *argp); +#endif + +/* A generic structure to pass assorted data in a expandable way */ +typedef struct openssl_item_st + { + int code; + void *value; /* Not used for flag attributes */ + size_t value_size; /* Max size of value for output, length for input */ + size_t *value_length; /* Returned length of value for output */ + } OPENSSL_ITEM; + + +/* When changing the CRYPTO_LOCK_* list, be sure to maintin the text lock + * names in cryptlib.c + */ + +#define CRYPTO_LOCK_ERR 1 +#define CRYPTO_LOCK_EX_DATA 2 +#define CRYPTO_LOCK_X509 3 +#define CRYPTO_LOCK_X509_INFO 4 +#define CRYPTO_LOCK_X509_PKEY 5 +#define CRYPTO_LOCK_X509_CRL 6 +#define CRYPTO_LOCK_X509_REQ 7 +#define CRYPTO_LOCK_DSA 8 +#define CRYPTO_LOCK_RSA 9 +#define CRYPTO_LOCK_EVP_PKEY 10 +#define CRYPTO_LOCK_X509_STORE 11 +#define CRYPTO_LOCK_SSL_CTX 12 +#define CRYPTO_LOCK_SSL_CERT 13 +#define CRYPTO_LOCK_SSL_SESSION 14 +#define CRYPTO_LOCK_SSL_SESS_CERT 15 +#define CRYPTO_LOCK_SSL 16 +#define CRYPTO_LOCK_SSL_METHOD 17 +#define CRYPTO_LOCK_RAND 18 +#define CRYPTO_LOCK_RAND2 19 +#define CRYPTO_LOCK_MALLOC 20 +#define CRYPTO_LOCK_BIO 21 +#define CRYPTO_LOCK_GETHOSTBYNAME 22 +#define CRYPTO_LOCK_GETSERVBYNAME 23 +#define CRYPTO_LOCK_READDIR 24 +#define CRYPTO_LOCK_RSA_BLINDING 25 +#define CRYPTO_LOCK_DH 26 +#define CRYPTO_LOCK_MALLOC2 27 +#define CRYPTO_LOCK_DSO 28 +#define CRYPTO_LOCK_DYNLOCK 29 +#define CRYPTO_LOCK_ENGINE 30 +#define CRYPTO_LOCK_UI 31 +#define CRYPTO_LOCK_ECDSA 32 +#define CRYPTO_LOCK_EC 33 +#define CRYPTO_LOCK_ECDH 34 +#define CRYPTO_LOCK_BN 35 +#define CRYPTO_LOCK_EC_PRE_COMP 36 +#define CRYPTO_LOCK_STORE 37 +#define CRYPTO_LOCK_COMP 38 +#define CRYPTO_NUM_LOCKS 39 + +#define CRYPTO_LOCK 1 +#define CRYPTO_UNLOCK 2 +#define CRYPTO_READ 4 +#define CRYPTO_WRITE 8 + +#ifndef OPENSSL_NO_LOCKING +#ifndef CRYPTO_w_lock +#define CRYPTO_w_lock(type) \ + CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__) +#define CRYPTO_w_unlock(type) \ + CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__) +#define CRYPTO_r_lock(type) \ + CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__) +#define CRYPTO_r_unlock(type) \ + CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__) +#define CRYPTO_add(addr,amount,type) \ + CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__) +#endif +#else +#define CRYPTO_w_lock(a) +#define CRYPTO_w_unlock(a) +#define CRYPTO_r_lock(a) +#define CRYPTO_r_unlock(a) +#define CRYPTO_add(a,b,c) ((*(a))+=(b)) +#endif + +/* Some applications as well as some parts of OpenSSL need to allocate + and deallocate locks in a dynamic fashion. The following typedef + makes this possible in a type-safe manner. */ +/* struct CRYPTO_dynlock_value has to be defined by the application. */ +typedef struct + { + int references; + struct CRYPTO_dynlock_value *data; + } CRYPTO_dynlock; + + +/* The following can be used to detect memory leaks in the SSLeay library. + * It used, it turns on malloc checking */ + +#define CRYPTO_MEM_CHECK_OFF 0x0 /* an enume */ +#define CRYPTO_MEM_CHECK_ON 0x1 /* a bit */ +#define CRYPTO_MEM_CHECK_ENABLE 0x2 /* a bit */ +#define CRYPTO_MEM_CHECK_DISABLE 0x3 /* an enume */ + +/* The following are bit values to turn on or off options connected to the + * malloc checking functionality */ + +/* Adds time to the memory checking information */ +#define V_CRYPTO_MDEBUG_TIME 0x1 /* a bit */ +/* Adds thread number to the memory checking information */ +#define V_CRYPTO_MDEBUG_THREAD 0x2 /* a bit */ + +#define V_CRYPTO_MDEBUG_ALL (V_CRYPTO_MDEBUG_TIME | V_CRYPTO_MDEBUG_THREAD) + + +/* predec of the BIO type */ +typedef struct bio_st BIO_dummy; + +struct crypto_ex_data_st + { + STACK *sk; + int dummy; /* gcc is screwing up this data structure :-( */ + }; + +/* This stuff is basically class callback functions + * The current classes are SSL_CTX, SSL, SSL_SESSION, and a few more */ + +typedef struct crypto_ex_data_func_st + { + long argl; /* Arbitary long */ + void *argp; /* Arbitary void * */ + CRYPTO_EX_new *new_func; + CRYPTO_EX_free *free_func; + CRYPTO_EX_dup *dup_func; + } CRYPTO_EX_DATA_FUNCS; + +DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS) + +/* Per class, we have a STACK of CRYPTO_EX_DATA_FUNCS for each CRYPTO_EX_DATA + * entry. + */ + +#define CRYPTO_EX_INDEX_BIO 0 +#define CRYPTO_EX_INDEX_SSL 1 +#define CRYPTO_EX_INDEX_SSL_CTX 2 +#define CRYPTO_EX_INDEX_SSL_SESSION 3 +#define CRYPTO_EX_INDEX_X509_STORE 4 +#define CRYPTO_EX_INDEX_X509_STORE_CTX 5 +#define CRYPTO_EX_INDEX_RSA 6 +#define CRYPTO_EX_INDEX_DSA 7 +#define CRYPTO_EX_INDEX_DH 8 +#define CRYPTO_EX_INDEX_ENGINE 9 +#define CRYPTO_EX_INDEX_X509 10 +#define CRYPTO_EX_INDEX_UI 11 +#define CRYPTO_EX_INDEX_ECDSA 12 +#define CRYPTO_EX_INDEX_ECDH 13 +#define CRYPTO_EX_INDEX_COMP 14 +#define CRYPTO_EX_INDEX_STORE 15 + +/* Dynamically assigned indexes start from this value (don't use directly, use + * via CRYPTO_ex_data_new_class). */ +#define CRYPTO_EX_INDEX_USER 100 + + +/* This is the default callbacks, but we can have others as well: + * this is needed in Win32 where the application malloc and the + * library malloc may not be the same. + */ +#define CRYPTO_malloc_init() CRYPTO_set_mem_functions(\ + malloc, realloc, free) + +#if defined CRYPTO_MDEBUG_ALL || defined CRYPTO_MDEBUG_TIME || defined CRYPTO_MDEBUG_THREAD +# ifndef CRYPTO_MDEBUG /* avoid duplicate #define */ +# define CRYPTO_MDEBUG +# endif +#endif + +/* Set standard debugging functions (not done by default + * unless CRYPTO_MDEBUG is defined) */ +#define CRYPTO_malloc_debug_init() do {\ + CRYPTO_set_mem_debug_functions(\ + CRYPTO_dbg_malloc,\ + CRYPTO_dbg_realloc,\ + CRYPTO_dbg_free,\ + CRYPTO_dbg_set_options,\ + CRYPTO_dbg_get_options);\ + } while(0) + +int CRYPTO_mem_ctrl(int mode); +int CRYPTO_is_mem_check_on(void); + +/* for applications */ +#define MemCheck_start() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON) +#define MemCheck_stop() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_OFF) + +/* for library-internal use */ +#define MemCheck_on() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE) +#define MemCheck_off() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE) +#define is_MemCheck_on() CRYPTO_is_mem_check_on() + +#define OPENSSL_malloc(num) CRYPTO_malloc((int)num,__FILE__,__LINE__) +#define OPENSSL_realloc(addr,num) \ + CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__) +#define OPENSSL_realloc_clean(addr,old_num,num) \ + CRYPTO_realloc_clean(addr,old_num,num,__FILE__,__LINE__) +#define OPENSSL_remalloc(addr,num) \ + CRYPTO_remalloc((char **)addr,(int)num,__FILE__,__LINE__) +#define OPENSSL_freeFunc CRYPTO_free +#define OPENSSL_free(addr) CRYPTO_free(addr) + +#define OPENSSL_malloc_locked(num) \ + CRYPTO_malloc_locked((int)num,__FILE__,__LINE__) +#define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr) + + +const char *SSLeay_version(int type); +unsigned long SSLeay(void); + +int OPENSSL_issetugid(void); + +/* An opaque type representing an implementation of "ex_data" support */ +typedef struct st_CRYPTO_EX_DATA_IMPL CRYPTO_EX_DATA_IMPL; +/* Return an opaque pointer to the current "ex_data" implementation */ +const CRYPTO_EX_DATA_IMPL *CRYPTO_get_ex_data_implementation(void); +/* Sets the "ex_data" implementation to be used (if it's not too late) */ +int CRYPTO_set_ex_data_implementation(const CRYPTO_EX_DATA_IMPL *i); +/* Get a new "ex_data" class, and return the corresponding "class_index" */ +int CRYPTO_ex_data_new_class(void); +/* Within a given class, get/register a new index */ +int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, + CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, + CRYPTO_EX_free *free_func); +/* Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a given + * class (invokes whatever per-class callbacks are applicable) */ +int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); +int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, + CRYPTO_EX_DATA *from); +void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); +/* Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular index + * (relative to the class type involved) */ +int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val); +void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad,int idx); +/* This function cleans up all "ex_data" state. It mustn't be called under + * potential race-conditions. */ +void CRYPTO_cleanup_all_ex_data(void); + +int CRYPTO_get_new_lockid(char *name); + +int CRYPTO_num_locks(void); /* return CRYPTO_NUM_LOCKS (shared libs!) */ +void CRYPTO_lock(int mode, int type,const char *file,int line); +void CRYPTO_set_locking_callback(void (*func)(int mode,int type, + const char *file,int line)); +void (*CRYPTO_get_locking_callback(void))(int mode,int type,const char *file, + int line); +void CRYPTO_set_add_lock_callback(int (*func)(int *num,int mount,int type, + const char *file, int line)); +int (*CRYPTO_get_add_lock_callback(void))(int *num,int mount,int type, + const char *file,int line); +void CRYPTO_set_id_callback(unsigned long (*func)(void)); +unsigned long (*CRYPTO_get_id_callback(void))(void); +unsigned long CRYPTO_thread_id(void); +const char *CRYPTO_get_lock_name(int type); +int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file, + int line); + +int CRYPTO_get_new_dynlockid(void); +void CRYPTO_destroy_dynlockid(int i); +struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i); +void CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value *(*dyn_create_function)(const char *file, int line)); +void CRYPTO_set_dynlock_lock_callback(void (*dyn_lock_function)(int mode, struct CRYPTO_dynlock_value *l, const char *file, int line)); +void CRYPTO_set_dynlock_destroy_callback(void (*dyn_destroy_function)(struct CRYPTO_dynlock_value *l, const char *file, int line)); +struct CRYPTO_dynlock_value *(*CRYPTO_get_dynlock_create_callback(void))(const char *file,int line); +void (*CRYPTO_get_dynlock_lock_callback(void))(int mode, struct CRYPTO_dynlock_value *l, const char *file,int line); +void (*CRYPTO_get_dynlock_destroy_callback(void))(struct CRYPTO_dynlock_value *l, const char *file,int line); + +/* CRYPTO_set_mem_functions includes CRYPTO_set_locked_mem_functions -- + * call the latter last if you need different functions */ +int CRYPTO_set_mem_functions(void *(*m)(size_t),void *(*r)(void *,size_t), void (*f)(void *)); +int CRYPTO_set_locked_mem_functions(void *(*m)(size_t), void (*free_func)(void *)); +int CRYPTO_set_mem_ex_functions(void *(*m)(size_t,const char *,int), + void *(*r)(void *,size_t,const char *,int), + void (*f)(void *)); +int CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t,const char *,int), + void (*free_func)(void *)); +int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int), + void (*r)(void *,void *,int,const char *,int,int), + void (*f)(void *,int), + void (*so)(long), + long (*go)(void)); +void CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), void (**f)(void *)); +void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *)); +void CRYPTO_get_mem_ex_functions(void *(**m)(size_t,const char *,int), + void *(**r)(void *, size_t,const char *,int), + void (**f)(void *)); +void CRYPTO_get_locked_mem_ex_functions(void *(**m)(size_t,const char *,int), + void (**f)(void *)); +void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int), + void (**r)(void *,void *,int,const char *,int,int), + void (**f)(void *,int), + void (**so)(long), + long (**go)(void)); + +void *CRYPTO_malloc_locked(int num, const char *file, int line); +void CRYPTO_free_locked(void *); +void *CRYPTO_malloc(int num, const char *file, int line); +void CRYPTO_free(void *); +void *CRYPTO_realloc(void *addr,int num, const char *file, int line); +void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file, + int line); +void *CRYPTO_remalloc(void *addr,int num, const char *file, int line); + +void OPENSSL_cleanse(void *ptr, size_t len); + +void CRYPTO_set_mem_debug_options(long bits); +long CRYPTO_get_mem_debug_options(void); + +#define CRYPTO_push_info(info) \ + CRYPTO_push_info_(info, __FILE__, __LINE__); +int CRYPTO_push_info_(const char *info, const char *file, int line); +int CRYPTO_pop_info(void); +int CRYPTO_remove_all_info(void); + + +/* Default debugging functions (enabled by CRYPTO_malloc_debug_init() macro; + * used as default in CRYPTO_MDEBUG compilations): */ +/* The last argument has the following significance: + * + * 0: called before the actual memory allocation has taken place + * 1: called after the actual memory allocation has taken place + */ +void CRYPTO_dbg_malloc(void *addr,int num,const char *file,int line,int before_p); +void CRYPTO_dbg_realloc(void *addr1,void *addr2,int num,const char *file,int line,int before_p); +void CRYPTO_dbg_free(void *addr,int before_p); +/* Tell the debugging code about options. By default, the following values + * apply: + * + * 0: Clear all options. + * V_CRYPTO_MDEBUG_TIME (1): Set the "Show Time" option. + * V_CRYPTO_MDEBUG_THREAD (2): Set the "Show Thread Number" option. + * V_CRYPTO_MDEBUG_ALL (3): 1 + 2 + */ +void CRYPTO_dbg_set_options(long bits); +long CRYPTO_dbg_get_options(void); + + +#ifndef OPENSSL_NO_FP_API +void CRYPTO_mem_leaks_fp(FILE *); +#endif +void CRYPTO_mem_leaks(struct bio_st *bio); +/* unsigned long order, char *file, int line, int num_bytes, char *addr */ +typedef void *CRYPTO_MEM_LEAK_CB(unsigned long, const char *, int, int, void *); +void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb); + +/* die if we have to */ +void OpenSSLDie(const char *file,int line,const char *assertion); +#define OPENSSL_assert(e) (void)((e) ? 0 : (OpenSSLDie(__FILE__, __LINE__, #e),1)) + +unsigned long *OPENSSL_ia32cap_loc(void); +#define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc())) + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_CRYPTO_strings(void); + +/* Error codes for the CRYPTO functions. */ + +/* Function codes. */ +#define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 100 +#define CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID 103 +#define CRYPTO_F_CRYPTO_GET_NEW_LOCKID 101 +#define CRYPTO_F_CRYPTO_SET_EX_DATA 102 +#define CRYPTO_F_DEF_ADD_INDEX 104 +#define CRYPTO_F_DEF_GET_CLASS 105 +#define CRYPTO_F_INT_DUP_EX_DATA 106 +#define CRYPTO_F_INT_FREE_EX_DATA 107 +#define CRYPTO_F_INT_NEW_EX_DATA 108 + +/* Reason codes. */ +#define CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK 100 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/openssl/des.h b/h/openssl/des.h new file mode 100644 index 0000000..2845ab5 --- /dev/null +++ b/h/openssl/des.h @@ -0,0 +1,4 @@ +/* Empty file for backward compatibiliy only. + * To use cryptographic primatives, please use EVP API or CCI API. + */ +#include diff --git a/h/openssl/des_old.h b/h/openssl/des_old.h new file mode 100644 index 0000000..2845ab5 --- /dev/null +++ b/h/openssl/des_old.h @@ -0,0 +1,4 @@ +/* Empty file for backward compatibiliy only. + * To use cryptographic primatives, please use EVP API or CCI API. + */ +#include diff --git a/h/openssl/dh.h b/h/openssl/dh.h new file mode 100644 index 0000000..d1559fd --- /dev/null +++ b/h/openssl/dh.h @@ -0,0 +1,223 @@ +/* crypto/dh/dh.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_DH_H +#define HEADER_DH_H + +#include + +#ifdef OPENSSL_NO_DH +#error DH is disabled. +#endif + +#ifndef OPENSSL_NO_BIO +#include +#endif +#include +#ifndef OPENSSL_NO_DEPRECATED +#include +#endif + +#define DH_FLAG_CACHE_MONT_P 0x01 +#define DH_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DH + * implementation now uses constant time + * modular exponentiation for secret exponents + * by default. This flag causes the + * faster variable sliding window method to + * be used for all exponents. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Already defined in ossl_typ.h */ +/* typedef struct dh_st DH; */ +/* typedef struct dh_method DH_METHOD; */ + +struct dh_method + { + const char *name; + /* Methods here */ + int (*generate_key)(DH *dh); + int (*compute_key)(unsigned char *key,const BIGNUM *pub_key,DH *dh); + int (*bn_mod_exp)(const DH *dh, BIGNUM *r, const BIGNUM *a, + const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, + BN_MONT_CTX *m_ctx); /* Can be null */ + + int (*init)(DH *dh); + int (*finish)(DH *dh); + int flags; + char *app_data; + /* If this is non-NULL, it will be used to generate parameters */ + int (*generate_params)(DH *dh, int prime_len, int generator, BN_GENCB *cb); + }; + +struct dh_st + { + /* This first argument is used to pick up errors when + * a DH is passed instead of a EVP_PKEY */ + int pad; + int version; + BIGNUM *p; + BIGNUM *g; + long length; /* optional */ + BIGNUM *pub_key; /* g^x */ + BIGNUM *priv_key; /* x */ + + int flags; + BN_MONT_CTX *method_mont_p; + /* Place holders if we want to do X9.42 DH */ + BIGNUM *q; + BIGNUM *j; + unsigned char *seed; + int seedlen; + BIGNUM *counter; + + int references; + CRYPTO_EX_DATA ex_data; + const DH_METHOD *meth; + ENGINE *engine; + }; + +#define DH_GENERATOR_2 2 +/* #define DH_GENERATOR_3 3 */ +#define DH_GENERATOR_5 5 + +/* DH_check error codes */ +#define DH_CHECK_P_NOT_PRIME 0x01 +#define DH_CHECK_P_NOT_SAFE_PRIME 0x02 +#define DH_UNABLE_TO_CHECK_GENERATOR 0x04 +#define DH_NOT_SUITABLE_GENERATOR 0x08 + +/* primes p where (p-1)/2 is prime too are called "safe"; we define + this for backward compatibility: */ +#define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME + +#define DHparams_dup(x) ASN1_dup_of_const(DH,i2d_DHparams,d2i_DHparams,x) +#define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ + (char *(*)())d2i_DHparams,(fp),(unsigned char **)(x)) +#define i2d_DHparams_fp(fp,x) ASN1_i2d_fp(i2d_DHparams,(fp), \ + (unsigned char *)(x)) +#define d2i_DHparams_bio(bp,x) ASN1_d2i_bio_of(DH,DH_new,d2i_DHparams,bp,x) +#define i2d_DHparams_bio(bp,x) ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x) + +const DH_METHOD *DH_OpenSSL(void); + +void DH_set_default_method(const DH_METHOD *meth); +const DH_METHOD *DH_get_default_method(void); +int DH_set_method(DH *dh, const DH_METHOD *meth); +DH *DH_new_method(ENGINE *engine); + +DH * DH_new(void); +void DH_free(DH *dh); +int DH_up_ref(DH *dh); +int DH_size(const DH *dh); +int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); +int DH_set_ex_data(DH *d, int idx, void *arg); +void *DH_get_ex_data(DH *d, int idx); + +/* Deprecated version */ +#ifndef OPENSSL_NO_DEPRECATED +DH * DH_generate_parameters(int prime_len,int generator, + void (*callback)(int,int,void *),void *cb_arg); +#endif /* !defined(OPENSSL_NO_DEPRECATED) */ + +/* New version */ +int DH_generate_parameters_ex(DH *dh, int prime_len,int generator, BN_GENCB *cb); + +int DH_check(const DH *dh,int *codes); +int DH_generate_key(DH *dh); +int DH_compute_key(unsigned char *key,const BIGNUM *pub_key,DH *dh); +DH * d2i_DHparams(DH **a,const unsigned char **pp, long length); +int i2d_DHparams(const DH *a,unsigned char **pp); +#ifndef OPENSSL_NO_FP_API +int DHparams_print_fp(FILE *fp, const DH *x); +#endif +#ifndef OPENSSL_NO_BIO +int DHparams_print(BIO *bp, const DH *x); +#else +int DHparams_print(char *bp, const DH *x); +#endif + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_DH_strings(void); + +/* Error codes for the DH functions. */ + +/* Function codes. */ +#define DH_F_COMPUTE_KEY 102 +#define DH_F_DHPARAMS_PRINT 100 +#define DH_F_DHPARAMS_PRINT_FP 101 +#define DH_F_DH_BUILTIN_GENPARAMS 106 +#define DH_F_DH_NEW_METHOD 105 +#define DH_F_GENERATE_KEY 103 +#define DH_F_GENERATE_PARAMETERS 104 + +/* Reason codes. */ +#define DH_R_BAD_GENERATOR 101 +#define DH_R_NO_PRIVATE_VALUE 100 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/openssl/dsa.h b/h/openssl/dsa.h new file mode 100644 index 0000000..b12db98 --- /dev/null +++ b/h/openssl/dsa.h @@ -0,0 +1,279 @@ +/* crypto/dsa/dsa.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* + * The DSS routines are based on patches supplied by + * Steven Schoch . He basically did the + * work and I have just tweaked them a little to fit into my + * stylistic vision for SSLeay :-) */ + +#ifndef HEADER_DSA_H +#define HEADER_DSA_H + +#include + +#ifdef OPENSSL_NO_DSA +#error DSA is disabled. +#endif + +#ifndef OPENSSL_NO_BIO +#include +#endif +#include +#include + +#ifndef OPENSSL_NO_DEPRECATED +#include +#ifndef OPENSSL_NO_DH +# include +#endif +#endif + +#define DSA_FLAG_CACHE_MONT_P 0x01 +#define DSA_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DSA + * implementation now uses constant time + * modular exponentiation for secret exponents + * by default. This flag causes the + * faster variable sliding window method to + * be used for all exponents. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Already defined in ossl_typ.h */ +/* typedef struct dsa_st DSA; */ +/* typedef struct dsa_method DSA_METHOD; */ + +typedef struct DSA_SIG_st + { + BIGNUM *r; + BIGNUM *s; + } DSA_SIG; + +struct dsa_method + { + const char *name; + DSA_SIG * (*dsa_do_sign)(const unsigned char *dgst, int dlen, DSA *dsa); + int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, + BIGNUM **rp); + int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len, + DSA_SIG *sig, DSA *dsa); + int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1, + BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx, + BN_MONT_CTX *in_mont); + int (*bn_mod_exp)(DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, + BN_MONT_CTX *m_ctx); /* Can be null */ + int (*init)(DSA *dsa); + int (*finish)(DSA *dsa); + int flags; + char *app_data; + /* If this is non-NULL, it is used to generate DSA parameters */ + int (*dsa_paramgen)(DSA *dsa, int bits, + unsigned char *seed, int seed_len, + int *counter_ret, unsigned long *h_ret, + BN_GENCB *cb); + /* If this is non-NULL, it is used to generate DSA keys */ + int (*dsa_keygen)(DSA *dsa); + }; + +struct dsa_st + { + /* This first variable is used to pick up errors where + * a DSA is passed instead of of a EVP_PKEY */ + int pad; + long version; + int write_params; + BIGNUM *p; + BIGNUM *q; /* == 20 */ + BIGNUM *g; + + BIGNUM *pub_key; /* y public key */ + BIGNUM *priv_key; /* x private key */ + + BIGNUM *kinv; /* Signing pre-calc */ + BIGNUM *r; /* Signing pre-calc */ + + int flags; + /* Normally used to cache montgomery values */ + BN_MONT_CTX *method_mont_p; + int references; + CRYPTO_EX_DATA ex_data; + const DSA_METHOD *meth; + /* functional reference if 'meth' is ENGINE-provided */ + ENGINE *engine; + }; + +#define DSAparams_dup(x) ASN1_dup_of_const(DSA,i2d_DSAparams,d2i_DSAparams,x) +#define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \ + (char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x)) +#define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \ + (unsigned char *)(x)) +#define d2i_DSAparams_bio(bp,x) ASN1_d2i_bio_of(DSA,DSA_new,d2i_DSAparams,bp,x) +#define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x) + + +DSA_SIG * DSA_SIG_new(void); +void DSA_SIG_free(DSA_SIG *a); +int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp); +DSA_SIG * d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, long length); + +DSA_SIG * DSA_do_sign(const unsigned char *dgst,int dlen,DSA *dsa); +int DSA_do_verify(const unsigned char *dgst,int dgst_len, + DSA_SIG *sig,DSA *dsa); + +const DSA_METHOD *DSA_OpenSSL(void); + +void DSA_set_default_method(const DSA_METHOD *); +const DSA_METHOD *DSA_get_default_method(void); +int DSA_set_method(DSA *dsa, const DSA_METHOD *); + +DSA * DSA_new(void); +DSA * DSA_new_method(ENGINE *engine); +void DSA_free (DSA *r); +/* "up" the DSA object's reference count */ +int DSA_up_ref(DSA *r); +int DSA_size(const DSA *); + /* next 4 return -1 on error */ +int DSA_sign_setup( DSA *dsa,BN_CTX *ctx_in,BIGNUM **kinvp,BIGNUM **rp); +int DSA_sign(int type,const unsigned char *dgst,int dlen, + unsigned char *sig, unsigned int *siglen, DSA *dsa); +int DSA_verify(int type,const unsigned char *dgst,int dgst_len, + const unsigned char *sigbuf, int siglen, DSA *dsa); +int DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); +int DSA_set_ex_data(DSA *d, int idx, void *arg); +void *DSA_get_ex_data(DSA *d, int idx); + +DSA * d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length); +DSA * d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length); +DSA * d2i_DSAparams(DSA **a, const unsigned char **pp, long length); + +/* Deprecated version */ +#ifndef OPENSSL_NO_DEPRECATED +DSA * DSA_generate_parameters(int bits, + unsigned char *seed,int seed_len, + int *counter_ret, unsigned long *h_ret,void + (*callback)(int, int, void *),void *cb_arg); +#endif /* !defined(OPENSSL_NO_DEPRECATED) */ + +/* New version */ +int DSA_generate_parameters_ex(DSA *dsa, int bits, + unsigned char *seed,int seed_len, + int *counter_ret, unsigned long *h_ret, BN_GENCB *cb); + +int DSA_generate_key(DSA *a); +int i2d_DSAPublicKey(const DSA *a, unsigned char **pp); +int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp); +int i2d_DSAparams(const DSA *a,unsigned char **pp); + +#ifndef OPENSSL_NO_BIO +int DSAparams_print(BIO *bp, const DSA *x); +int DSA_print(BIO *bp, const DSA *x, int off); +#endif +#ifndef OPENSSL_NO_FP_API +int DSAparams_print_fp(FILE *fp, const DSA *x); +int DSA_print_fp(FILE *bp, const DSA *x, int off); +#endif + +#define DSS_prime_checks 50 +/* Primality test according to FIPS PUB 186[-1], Appendix 2.1: + * 50 rounds of Rabin-Miller */ +#define DSA_is_prime(n, callback, cb_arg) \ + BN_is_prime(n, DSS_prime_checks, callback, NULL, cb_arg) + +#ifndef OPENSSL_NO_DH +/* Convert DSA structure (key or just parameters) into DH structure + * (be careful to avoid small subgroup attacks when using this!) */ +DH *DSA_dup_DH(const DSA *r); +#endif + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_DSA_strings(void); + +/* Error codes for the DSA functions. */ + +/* Function codes. */ +#define DSA_F_D2I_DSA_SIG 110 +#define DSA_F_DSAPARAMS_PRINT 100 +#define DSA_F_DSAPARAMS_PRINT_FP 101 +#define DSA_F_DSA_DO_SIGN 112 +#define DSA_F_DSA_DO_VERIFY 113 +#define DSA_F_DSA_NEW_METHOD 103 +#define DSA_F_DSA_PRINT 104 +#define DSA_F_DSA_PRINT_FP 105 +#define DSA_F_DSA_SIGN 106 +#define DSA_F_DSA_SIGN_SETUP 107 +#define DSA_F_DSA_SIG_NEW 109 +#define DSA_F_DSA_VERIFY 108 +#define DSA_F_I2D_DSA_SIG 111 +#define DSA_F_SIG_CB 114 + +/* Reason codes. */ +#define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 100 +#define DSA_R_MISSING_PARAMETERS 101 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/openssl/dso.h b/h/openssl/dso.h new file mode 100644 index 0000000..3de99f5 --- /dev/null +++ b/h/openssl/dso.h @@ -0,0 +1,368 @@ +/* dso.h -*- mode:C; c-file-style: "eay" -*- */ +/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL + * project 2000. + */ +/* ==================================================================== + * Copyright (c) 2000 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_DSO_H +#define HEADER_DSO_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* These values are used as commands to DSO_ctrl() */ +#define DSO_CTRL_GET_FLAGS 1 +#define DSO_CTRL_SET_FLAGS 2 +#define DSO_CTRL_OR_FLAGS 3 + +/* By default, DSO_load() will translate the provided filename into a form + * typical for the platform (more specifically the DSO_METHOD) using the + * dso_name_converter function of the method. Eg. win32 will transform "blah" + * into "blah.dll", and dlfcn will transform it into "libblah.so". The + * behaviour can be overriden by setting the name_converter callback in the DSO + * object (using DSO_set_name_converter()). This callback could even utilise + * the DSO_METHOD's converter too if it only wants to override behaviour for + * one or two possible DSO methods. However, the following flag can be set in a + * DSO to prevent *any* native name-translation at all - eg. if the caller has + * prompted the user for a path to a driver library so the filename should be + * interpreted as-is. */ +#define DSO_FLAG_NO_NAME_TRANSLATION 0x01 +/* An extra flag to give if only the extension should be added as + * translation. This is obviously only of importance on Unix and + * other operating systems where the translation also may prefix + * the name with something, like 'lib', and ignored everywhere else. + * This flag is also ignored if DSO_FLAG_NO_NAME_TRANSLATION is used + * at the same time. */ +#define DSO_FLAG_NAME_TRANSLATION_EXT_ONLY 0x02 + +/* The following flag controls the translation of symbol names to upper + * case. This is currently only being implemented for OpenVMS. + */ +#define DSO_FLAG_UPCASE_SYMBOL 0x10 + +/* This flag loads the library with public symbols. + * Meaning: The exported symbols of this library are public + * to all libraries loaded after this library. + * At the moment only implemented in unix. + */ +#define DSO_FLAG_GLOBAL_SYMBOLS 0x20 + + +typedef void (*DSO_FUNC_TYPE)(void); + +typedef struct dso_st DSO; + +/* The function prototype used for method functions (or caller-provided + * callbacks) that transform filenames. They are passed a DSO structure pointer + * (or NULL if they are to be used independantly of a DSO object) and a + * filename to transform. They should either return NULL (if there is an error + * condition) or a newly allocated string containing the transformed form that + * the caller will need to free with OPENSSL_free() when done. */ +typedef char* (*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *); +/* The function prototype used for method functions (or caller-provided + * callbacks) that merge two file specifications. They are passed a + * DSO structure pointer (or NULL if they are to be used independantly of + * a DSO object) and two file specifications to merge. They should + * either return NULL (if there is an error condition) or a newly allocated + * string containing the result of merging that the caller will need + * to free with OPENSSL_free() when done. + * Here, merging means that bits and pieces are taken from each of the + * file specifications and added together in whatever fashion that is + * sensible for the DSO method in question. The only rule that really + * applies is that if the two specification contain pieces of the same + * type, the copy from the string string takes priority. One could see + * it as the first specification is the one given by the user and the + * second being a bunch of defaults to add on if they're missing in the + * first. */ +typedef char* (*DSO_MERGER_FUNC)(DSO *, const char *, const char *); + +typedef struct dso_meth_st + { + const char *name; + /* Loads a shared library, NB: new DSO_METHODs must ensure that a + * successful load populates the loaded_filename field, and likewise a + * successful unload OPENSSL_frees and NULLs it out. */ + int (*dso_load)(DSO *dso); + /* Unloads a shared library */ + int (*dso_unload)(DSO *dso); + /* Binds a variable */ + void *(*dso_bind_var)(DSO *dso, const char *symname); + /* Binds a function - assumes a return type of DSO_FUNC_TYPE. + * This should be cast to the real function prototype by the + * caller. Platforms that don't have compatible representations + * for different prototypes (this is possible within ANSI C) + * are highly unlikely to have shared libraries at all, let + * alone a DSO_METHOD implemented for them. */ + DSO_FUNC_TYPE (*dso_bind_func)(DSO *dso, const char *symname); + +/* I don't think this would actually be used in any circumstances. */ +#if 0 + /* Unbinds a variable */ + int (*dso_unbind_var)(DSO *dso, char *symname, void *symptr); + /* Unbinds a function */ + int (*dso_unbind_func)(DSO *dso, char *symname, DSO_FUNC_TYPE symptr); +#endif + /* The generic (yuck) "ctrl()" function. NB: Negative return + * values (rather than zero) indicate errors. */ + long (*dso_ctrl)(DSO *dso, int cmd, long larg, void *parg); + /* The default DSO_METHOD-specific function for converting filenames to + * a canonical native form. */ + DSO_NAME_CONVERTER_FUNC dso_name_converter; + /* The default DSO_METHOD-specific function for converting filenames to + * a canonical native form. */ + DSO_MERGER_FUNC dso_merger; + + /* [De]Initialisation handlers. */ + int (*init)(DSO *dso); + int (*finish)(DSO *dso); + } DSO_METHOD; + +/**********************************************************************/ +/* The low-level handle type used to refer to a loaded shared library */ + +struct dso_st + { + DSO_METHOD *meth; + /* Standard dlopen uses a (void *). Win32 uses a HANDLE. VMS + * doesn't use anything but will need to cache the filename + * for use in the dso_bind handler. All in all, let each + * method control its own destiny. "Handles" and such go in + * a STACK. */ + STACK *meth_data; + int references; + int flags; + /* For use by applications etc ... use this for your bits'n'pieces, + * don't touch meth_data! */ + CRYPTO_EX_DATA ex_data; + /* If this callback function pointer is set to non-NULL, then it will + * be used in DSO_load() in place of meth->dso_name_converter. NB: This + * should normally set using DSO_set_name_converter(). */ + DSO_NAME_CONVERTER_FUNC name_converter; + /* If this callback function pointer is set to non-NULL, then it will + * be used in DSO_load() in place of meth->dso_merger. NB: This + * should normally set using DSO_set_merger(). */ + DSO_MERGER_FUNC merger; + /* This is populated with (a copy of) the platform-independant + * filename used for this DSO. */ + char *filename; + /* This is populated with (a copy of) the translated filename by which + * the DSO was actually loaded. It is NULL iff the DSO is not currently + * loaded. NB: This is here because the filename translation process + * may involve a callback being invoked more than once not only to + * convert to a platform-specific form, but also to try different + * filenames in the process of trying to perform a load. As such, this + * variable can be used to indicate (a) whether this DSO structure + * corresponds to a loaded library or not, and (b) the filename with + * which it was actually loaded. */ + char *loaded_filename; + }; + + +DSO * DSO_new(void); +DSO * DSO_new_method(DSO_METHOD *method); +int DSO_free(DSO *dso); +int DSO_flags(DSO *dso); +int DSO_up_ref(DSO *dso); +long DSO_ctrl(DSO *dso, int cmd, long larg, void *parg); + +/* This function sets the DSO's name_converter callback. If it is non-NULL, + * then it will be used instead of the associated DSO_METHOD's function. If + * oldcb is non-NULL then it is set to the function pointer value being + * replaced. Return value is non-zero for success. */ +int DSO_set_name_converter(DSO *dso, DSO_NAME_CONVERTER_FUNC cb, + DSO_NAME_CONVERTER_FUNC *oldcb); +/* These functions can be used to get/set the platform-independant filename + * used for a DSO. NB: set will fail if the DSO is already loaded. */ +const char *DSO_get_filename(DSO *dso); +int DSO_set_filename(DSO *dso, const char *filename); +/* This function will invoke the DSO's name_converter callback to translate a + * filename, or if the callback isn't set it will instead use the DSO_METHOD's + * converter. If "filename" is NULL, the "filename" in the DSO itself will be + * used. If the DSO_FLAG_NO_NAME_TRANSLATION flag is set, then the filename is + * simply duplicated. NB: This function is usually called from within a + * DSO_METHOD during the processing of a DSO_load() call, and is exposed so that + * caller-created DSO_METHODs can do the same thing. A non-NULL return value + * will need to be OPENSSL_free()'d. */ +char *DSO_convert_filename(DSO *dso, const char *filename); +/* This function will invoke the DSO's merger callback to merge two file + * specifications, or if the callback isn't set it will instead use the + * DSO_METHOD's merger. A non-NULL return value will need to be + * OPENSSL_free()'d. */ +char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2); +/* If the DSO is currently loaded, this returns the filename that it was loaded + * under, otherwise it returns NULL. So it is also useful as a test as to + * whether the DSO is currently loaded. NB: This will not necessarily return + * the same value as DSO_convert_filename(dso, dso->filename), because the + * DSO_METHOD's load function may have tried a variety of filenames (with + * and/or without the aid of the converters) before settling on the one it + * actually loaded. */ +const char *DSO_get_loaded_filename(DSO *dso); + +void DSO_set_default_method(DSO_METHOD *meth); +DSO_METHOD *DSO_get_default_method(void); +DSO_METHOD *DSO_get_method(DSO *dso); +DSO_METHOD *DSO_set_method(DSO *dso, DSO_METHOD *meth); + +/* The all-singing all-dancing load function, you normally pass NULL + * for the first and third parameters. Use DSO_up and DSO_free for + * subsequent reference count handling. Any flags passed in will be set + * in the constructed DSO after its init() function but before the + * load operation. If 'dso' is non-NULL, 'flags' is ignored. */ +DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags); + +/* This function binds to a variable inside a shared library. */ +void *DSO_bind_var(DSO *dso, const char *symname); + +/* This function binds to a function inside a shared library. */ +DSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname); + +/* This method is the default, but will beg, borrow, or steal whatever + * method should be the default on any particular platform (including + * DSO_METH_null() if necessary). */ +DSO_METHOD *DSO_METHOD_openssl(void); + +/* This method is defined for all platforms - if a platform has no + * DSO support then this will be the only method! */ +DSO_METHOD *DSO_METHOD_null(void); + +/* If DSO_DLFCN is defined, the standard dlfcn.h-style functions + * (dlopen, dlclose, dlsym, etc) will be used and incorporated into + * this method. If not, this method will return NULL. */ +DSO_METHOD *DSO_METHOD_dlfcn(void); + +/* If DSO_DL is defined, the standard dl.h-style functions (shl_load, + * shl_unload, shl_findsym, etc) will be used and incorporated into + * this method. If not, this method will return NULL. */ +DSO_METHOD *DSO_METHOD_dl(void); + +/* If WIN32 is defined, use DLLs. If not, return NULL. */ +DSO_METHOD *DSO_METHOD_win32(void); + +/* If VMS is defined, use shared images. If not, return NULL. */ +DSO_METHOD *DSO_METHOD_vms(void); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_DSO_strings(void); + +/* Error codes for the DSO functions. */ + +/* Function codes. */ +#define DSO_F_DLFCN_BIND_FUNC 100 +#define DSO_F_DLFCN_BIND_VAR 101 +#define DSO_F_DLFCN_LOAD 102 +#define DSO_F_DLFCN_MERGER 130 +#define DSO_F_DLFCN_NAME_CONVERTER 123 +#define DSO_F_DLFCN_UNLOAD 103 +#define DSO_F_DL_BIND_FUNC 104 +#define DSO_F_DL_BIND_VAR 105 +#define DSO_F_DL_LOAD 106 +#define DSO_F_DL_MERGER 131 +#define DSO_F_DL_NAME_CONVERTER 124 +#define DSO_F_DL_UNLOAD 107 +#define DSO_F_DSO_BIND_FUNC 108 +#define DSO_F_DSO_BIND_VAR 109 +#define DSO_F_DSO_CONVERT_FILENAME 126 +#define DSO_F_DSO_CTRL 110 +#define DSO_F_DSO_FREE 111 +#define DSO_F_DSO_GET_FILENAME 127 +#define DSO_F_DSO_GET_LOADED_FILENAME 128 +#define DSO_F_DSO_LOAD 112 +#define DSO_F_DSO_MERGE 132 +#define DSO_F_DSO_NEW_METHOD 113 +#define DSO_F_DSO_SET_FILENAME 129 +#define DSO_F_DSO_SET_NAME_CONVERTER 122 +#define DSO_F_DSO_UP_REF 114 +#define DSO_F_VMS_BIND_SYM 115 +#define DSO_F_VMS_LOAD 116 +#define DSO_F_VMS_MERGER 133 +#define DSO_F_VMS_UNLOAD 117 +#define DSO_F_WIN32_BIND_FUNC 118 +#define DSO_F_WIN32_BIND_VAR 119 +#define DSO_F_WIN32_JOINER 135 +#define DSO_F_WIN32_LOAD 120 +#define DSO_F_WIN32_MERGER 134 +#define DSO_F_WIN32_NAME_CONVERTER 125 +#define DSO_F_WIN32_SPLITTER 136 +#define DSO_F_WIN32_UNLOAD 121 + +/* Reason codes. */ +#define DSO_R_CTRL_FAILED 100 +#define DSO_R_DSO_ALREADY_LOADED 110 +#define DSO_R_EMPTY_FILE_STRUCTURE 113 +#define DSO_R_FAILURE 114 +#define DSO_R_FILENAME_TOO_BIG 101 +#define DSO_R_FINISH_FAILED 102 +#define DSO_R_INCORRECT_FILE_SYNTAX 115 +#define DSO_R_LOAD_FAILED 103 +#define DSO_R_NAME_TRANSLATION_FAILED 109 +#define DSO_R_NO_FILENAME 111 +#define DSO_R_NO_FILE_SPECIFICATION 116 +#define DSO_R_NULL_HANDLE 104 +#define DSO_R_SET_FILENAME_FAILED 112 +#define DSO_R_STACK_ERROR 105 +#define DSO_R_SYM_FAILURE 106 +#define DSO_R_UNLOAD_FAILED 107 +#define DSO_R_UNSUPPORTED 108 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/openssl/dtls1.h b/h/openssl/dtls1.h new file mode 100644 index 0000000..b377cc5 --- /dev/null +++ b/h/openssl/dtls1.h @@ -0,0 +1,212 @@ +/* ssl/dtls1.h */ +/* + * DTLS implementation written by Nagendra Modadugu + * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. + */ +/* ==================================================================== + * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_DTLS1_H +#define HEADER_DTLS1_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define DTLS1_VERSION 0x0100 +#define DTLS1_VERSION_MAJOR 0x01 +#define DTLS1_VERSION_MINOR 0x00 + +#define DTLS1_AD_MISSING_HANDSHAKE_MESSAGE 110 + +/* lengths of messages */ +#define DTLS1_COOKIE_LENGTH 32 + +#define DTLS1_RT_HEADER_LENGTH 13 + +#define DTLS1_HM_HEADER_LENGTH 12 + +#define DTLS1_HM_BAD_FRAGMENT -2 +#define DTLS1_HM_FRAGMENT_RETRY -3 + +#define DTLS1_CCS_HEADER_LENGTH 3 + +#define DTLS1_AL_HEADER_LENGTH 7 + + +typedef struct dtls1_bitmap_st + { + PQ_64BIT map; + unsigned long length; /* sizeof the bitmap in bits */ + PQ_64BIT max_seq_num; /* max record number seen so far */ + } DTLS1_BITMAP; + +struct hm_header_st + { + unsigned char type; + unsigned long msg_len; + unsigned short seq; + unsigned long frag_off; + unsigned long frag_len; + unsigned int is_ccs; + }; + +struct ccs_header_st + { + unsigned char type; + unsigned short seq; + }; + +struct dtls1_timeout_st + { + /* Number of read timeouts so far */ + unsigned int read_timeouts; + + /* Number of write timeouts so far */ + unsigned int write_timeouts; + + /* Number of alerts received so far */ + unsigned int num_alerts; + }; + +typedef struct record_pqueue_st + { + unsigned short epoch; + pqueue q; + } record_pqueue; + +typedef struct hm_fragment_st + { + struct hm_header_st msg_header; + unsigned char *fragment; + } hm_fragment; + +typedef struct dtls1_state_st + { + unsigned int send_cookie; + unsigned char cookie[DTLS1_COOKIE_LENGTH]; + unsigned char rcvd_cookie[DTLS1_COOKIE_LENGTH]; + unsigned int cookie_len; + + /* + * The current data and handshake epoch. This is initially + * undefined, and starts at zero once the initial handshake is + * completed + */ + unsigned short r_epoch; + unsigned short w_epoch; + + /* records being received in the current epoch */ + DTLS1_BITMAP bitmap; + + /* renegotiation starts a new set of sequence numbers */ + DTLS1_BITMAP next_bitmap; + + /* handshake message numbers */ + unsigned short handshake_write_seq; + unsigned short next_handshake_write_seq; + + unsigned short handshake_read_seq; + + /* Received handshake records (processed and unprocessed) */ + record_pqueue unprocessed_rcds; + record_pqueue processed_rcds; + + /* Buffered handshake messages */ + pqueue buffered_messages; + + /* Buffered (sent) handshake records */ + pqueue sent_messages; + + unsigned int mtu; /* max wire packet size */ + + struct hm_header_st w_msg_hdr; + struct hm_header_st r_msg_hdr; + + struct dtls1_timeout_st timeout; + + /* storage for Alert/Handshake protocol data received but not + * yet processed by ssl3_read_bytes: */ + unsigned char alert_fragment[DTLS1_AL_HEADER_LENGTH]; + unsigned int alert_fragment_len; + unsigned char handshake_fragment[DTLS1_HM_HEADER_LENGTH]; + unsigned int handshake_fragment_len; + + unsigned int retransmitting; + + } DTLS1_STATE; + +typedef struct dtls1_record_data_st + { + unsigned char *packet; + unsigned int packet_length; + SSL3_BUFFER rbuf; + SSL3_RECORD rrec; + } DTLS1_RECORD_DATA; + + +/* Timeout multipliers (timeout slice is defined in apps/timeouts.h */ +#define DTLS1_TMO_READ_COUNT 2 +#define DTLS1_TMO_WRITE_COUNT 2 + +#define DTLS1_TMO_ALERT_COUNT 12 + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/h/openssl/e_os2.h b/h/openssl/e_os2.h new file mode 100644 index 0000000..5cceb85 --- /dev/null +++ b/h/openssl/e_os2.h @@ -0,0 +1,285 @@ +/* e_os2.h */ +/* ==================================================================== + * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#include + +#ifndef HEADER_E_OS2_H +#define HEADER_E_OS2_H + +#ifdef __cplusplus +extern "C" { +#endif + +/****************************************************************************** + * Detect operating systems. This probably needs completing. + * The result is that at least one OPENSSL_SYS_os macro should be defined. + * However, if none is defined, Unix is assumed. + **/ + +#define OPENSSL_SYS_UNIX + +/* ----------------------- Macintosh, before MacOS X ----------------------- */ +#if defined(__MWERKS__) && defined(macintosh) || defined(OPENSSL_SYSNAME_MAC) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_MACINTOSH_CLASSIC +#endif + +/* ----------------------- NetWare ----------------------------------------- */ +#if defined(NETWARE) || defined(OPENSSL_SYSNAME_NETWARE) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_NETWARE +#endif + +/* ---------------------- Microsoft operating systems ---------------------- */ + +/* The 16 bit environments are pretty straightforward */ +#if defined(OPENSSL_SYSNAME_WIN16) || defined(OPENSSL_SYSNAME_MSDOS) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_MSDOS +#endif +#if defined(OPENSSL_SYSNAME_WIN16) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_WIN16 +#endif + +/* For 32 bit environment, there seems to be the CygWin environment and then + all the others that try to do the same thing Microsoft does... */ +#if defined(OPENSSL_SYSNAME_UWIN) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_WIN32_UWIN +#else +# if defined(__CYGWIN32__) || defined(OPENSSL_SYSNAME_CYGWIN32) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_WIN32_CYGWIN +# else +# if defined(_WIN32) || defined(OPENSSL_SYSNAME_WIN32) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_WIN32 +# endif +# if defined(OPENSSL_SYSNAME_WINNT) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_WINNT +# endif +# if defined(OPENSSL_SYSNAME_WINCE) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_WINCE +# endif +# endif +#endif + +/* Anything that tries to look like Microsoft is "Windows" */ +#if defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_WINDOWS +# ifndef OPENSSL_SYS_MSDOS +# define OPENSSL_SYS_MSDOS +# endif +#endif + +/* DLL settings. This part is a bit tough, because it's up to the application + implementor how he or she will link the application, so it requires some + macro to be used. */ +#ifdef OPENSSL_SYS_WINDOWS +# ifndef OPENSSL_OPT_WINDLL +# if defined(_WINDLL) /* This is used when building OpenSSL to indicate that + DLL linkage should be used */ +# define OPENSSL_OPT_WINDLL +# endif +# endif +#endif + +/* -------------------------------- OpenVMS -------------------------------- */ +#if defined(__VMS) || defined(VMS) || defined(OPENSSL_SYSNAME_VMS) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_VMS +# if defined(__DECC) +# define OPENSSL_SYS_VMS_DECC +# elif defined(__DECCXX) +# define OPENSSL_SYS_VMS_DECC +# define OPENSSL_SYS_VMS_DECCXX +# else +# define OPENSSL_SYS_VMS_NODECC +# endif +#endif + +/* --------------------------------- OS/2 ---------------------------------- */ +#if defined(__EMX__) || defined(__OS2__) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_OS2 +#endif + +/* --------------------------------- Unix ---------------------------------- */ +#ifdef OPENSSL_SYS_UNIX +# if defined(linux) || defined(__linux__) || defined(OPENSSL_SYSNAME_LINUX) +# define OPENSSL_SYS_LINUX +# endif +# ifdef OPENSSL_SYSNAME_MPE +# define OPENSSL_SYS_MPE +# endif +# ifdef OPENSSL_SYSNAME_SNI +# define OPENSSL_SYS_SNI +# endif +# ifdef OPENSSL_SYSNAME_ULTRASPARC +# define OPENSSL_SYS_ULTRASPARC +# endif +# ifdef OPENSSL_SYSNAME_NEWS4 +# define OPENSSL_SYS_NEWS4 +# endif +# ifdef OPENSSL_SYSNAME_MACOSX +# define OPENSSL_SYS_MACOSX +# endif +# ifdef OPENSSL_SYSNAME_MACOSX_RHAPSODY +# define OPENSSL_SYS_MACOSX_RHAPSODY +# define OPENSSL_SYS_MACOSX +# endif +# ifdef OPENSSL_SYSNAME_SUNOS +# define OPENSSL_SYS_SUNOS +#endif +# if defined(_CRAY) || defined(OPENSSL_SYSNAME_CRAY) +# define OPENSSL_SYS_CRAY +# endif +# if defined(_AIX) || defined(OPENSSL_SYSNAME_AIX) +# define OPENSSL_SYS_AIX +# endif +#endif + +/* --------------------------------- VOS ----------------------------------- */ +#ifdef OPENSSL_SYSNAME_VOS +# define OPENSSL_SYS_VOS +#endif + +/* ------------------------------- VxWorks --------------------------------- */ +#ifdef OPENSSL_SYSNAME_VXWORKS +# define OPENSSL_SYS_VXWORKS +#endif + +/** + * That's it for OS-specific stuff + *****************************************************************************/ + + +/* Specials for I/O an exit */ +#ifdef OPENSSL_SYS_WIN16 +# define OPENSSL_NO_FP_API +#endif +#ifdef OPENSSL_SYS_MSDOS +# define OPENSSL_UNISTD_IO +# define OPENSSL_DECLARE_EXIT extern void exit(int); +#else +# define OPENSSL_UNISTD_IO OPENSSL_UNISTD +# define OPENSSL_DECLARE_EXIT /* declared in unistd.h */ +#endif + +/* Definitions of OPENSSL_GLOBAL and OPENSSL_EXTERN, to define and declare + certain global symbols that, with some compilers under VMS, have to be + defined and declared explicitely with globaldef and globalref. + Definitions of OPENSSL_EXPORT and OPENSSL_IMPORT, to define and declare + DLL exports and imports for compilers under Win32. These are a little + more complicated to use. Basically, for any library that exports some + global variables, the following code must be present in the header file + that declares them, before OPENSSL_EXTERN is used: + + #ifdef SOME_BUILD_FLAG_MACRO + # undef OPENSSL_EXTERN + # define OPENSSL_EXTERN OPENSSL_EXPORT + #endif + + The default is to have OPENSSL_EXPORT, OPENSSL_IMPORT and OPENSSL_GLOBAL + have some generally sensible values, and for OPENSSL_EXTERN to have the + value OPENSSL_IMPORT. +*/ + +#if defined(OPENSSL_SYS_VMS_NODECC) +# define OPENSSL_EXPORT globalref +# define OPENSSL_IMPORT globalref +# define OPENSSL_GLOBAL globaldef +#elif defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL) +# define OPENSSL_EXPORT extern __declspec(dllexport) +# define OPENSSL_IMPORT extern __declspec(dllimport) +# define OPENSSL_GLOBAL +#else +# define OPENSSL_EXPORT extern +# define OPENSSL_IMPORT extern +# define OPENSSL_GLOBAL +#endif +#define OPENSSL_EXTERN OPENSSL_IMPORT + +/* Macros to allow global variables to be reached through function calls when + required (if a shared library version requvres it, for example. + The way it's done allows definitions like this: + + // in foobar.c + OPENSSL_IMPLEMENT_GLOBAL(int,foobar) = 0; + // in foobar.h + OPENSSL_DECLARE_GLOBAL(int,foobar); + #define foobar OPENSSL_GLOBAL_REF(foobar) +*/ +#ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION +# define OPENSSL_IMPLEMENT_GLOBAL(type,name) \ + extern type _hide_##name; \ + type *_shadow_##name(void) { return &_hide_##name; } \ + static type _hide_##name +# define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void) +# define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name())) +#else +# define OPENSSL_IMPLEMENT_GLOBAL(type,name) OPENSSL_GLOBAL type _shadow_##name +# define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name +# define OPENSSL_GLOBAL_REF(name) _shadow_##name +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/openssl/ebcdic.h b/h/openssl/ebcdic.h new file mode 100644 index 0000000..6d65afc --- /dev/null +++ b/h/openssl/ebcdic.h @@ -0,0 +1,19 @@ +/* crypto/ebcdic.h */ + +#ifndef HEADER_EBCDIC_H +#define HEADER_EBCDIC_H + +#include + +/* Avoid name clashes with other applications */ +#define os_toascii _openssl_os_toascii +#define os_toebcdic _openssl_os_toebcdic +#define ebcdic2ascii _openssl_ebcdic2ascii +#define ascii2ebcdic _openssl_ascii2ebcdic + +extern const unsigned char os_toascii[256]; +extern const unsigned char os_toebcdic[256]; +void *ebcdic2ascii(void *dest, const void *srce, size_t count); +void *ascii2ebcdic(void *dest, const void *srce, size_t count); + +#endif diff --git a/h/openssl/ec.h b/h/openssl/ec.h new file mode 100644 index 0000000..2845ab5 --- /dev/null +++ b/h/openssl/ec.h @@ -0,0 +1,4 @@ +/* Empty file for backward compatibiliy only. + * To use cryptographic primatives, please use EVP API or CCI API. + */ +#include diff --git a/h/openssl/engine.h b/h/openssl/engine.h new file mode 100644 index 0000000..2845ab5 --- /dev/null +++ b/h/openssl/engine.h @@ -0,0 +1,4 @@ +/* Empty file for backward compatibiliy only. + * To use cryptographic primatives, please use EVP API or CCI API. + */ +#include diff --git a/h/openssl/err.h b/h/openssl/err.h new file mode 100644 index 0000000..06502a6 --- /dev/null +++ b/h/openssl/err.h @@ -0,0 +1,320 @@ +/* crypto/err/err.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_ERR_H +#define HEADER_ERR_H + +#include + +#ifndef OPENSSL_NO_FP_API +#include +#include +#endif + +#include +#ifndef OPENSSL_NO_BIO +#include +#endif +#ifndef OPENSSL_NO_LHASH +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef OPENSSL_NO_ERR +#define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,d,e) +#else +#define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,NULL,0) +#endif + +#include + +#define ERR_TXT_MALLOCED 0x01 +#define ERR_TXT_STRING 0x02 + +#define ERR_FLAG_MARK 0x01 + +#define ERR_NUM_ERRORS 16 +typedef struct err_state_st + { + unsigned long pid; + int err_flags[ERR_NUM_ERRORS]; + unsigned long err_buffer[ERR_NUM_ERRORS]; + char *err_data[ERR_NUM_ERRORS]; + int err_data_flags[ERR_NUM_ERRORS]; + const char *err_file[ERR_NUM_ERRORS]; + int err_line[ERR_NUM_ERRORS]; + int top,bottom; + } ERR_STATE; + +/* library */ +#define ERR_LIB_NONE 1 +#define ERR_LIB_SYS 2 +#define ERR_LIB_BN 3 +#define ERR_LIB_RSA 4 +#define ERR_LIB_DH 5 +#define ERR_LIB_EVP 6 +#define ERR_LIB_BUF 7 +#define ERR_LIB_OBJ 8 +#define ERR_LIB_PEM 9 +#define ERR_LIB_DSA 10 +#define ERR_LIB_X509 11 +/* #define ERR_LIB_METH 12 */ +#define ERR_LIB_ASN1 13 +#define ERR_LIB_CONF 14 +#define ERR_LIB_CRYPTO 15 +#define ERR_LIB_EC 16 +#define ERR_LIB_SSL 20 +/* #define ERR_LIB_SSL23 21 */ +/* #define ERR_LIB_SSL2 22 */ +/* #define ERR_LIB_SSL3 23 */ +/* #define ERR_LIB_RSAREF 30 */ +/* #define ERR_LIB_PROXY 31 */ +#define ERR_LIB_BIO 32 +#define ERR_LIB_PKCS7 33 +#define ERR_LIB_X509V3 34 +#define ERR_LIB_PKCS12 35 +#define ERR_LIB_RAND 36 +#define ERR_LIB_DSO 37 +#define ERR_LIB_ENGINE 38 +#define ERR_LIB_OCSP 39 +#define ERR_LIB_UI 40 +#define ERR_LIB_COMP 41 +#define ERR_LIB_ECDSA 42 +#define ERR_LIB_ECDH 43 +#define ERR_LIB_STORE 44 + +#define ERR_LIB_WRSECLIB 127 +#define ERR_LIB_USER 128 + + +#define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),__FILE__,__LINE__) +#define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),__FILE__,__LINE__) +#define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),__FILE__,__LINE__) +#define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),__FILE__,__LINE__) +#define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),__FILE__,__LINE__) +#define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),__FILE__,__LINE__) +#define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),__FILE__,__LINE__) +#define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),__FILE__,__LINE__) +#define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),__FILE__,__LINE__) +#define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),__FILE__,__LINE__) +#define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),__FILE__,__LINE__) +#define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),__FILE__,__LINE__) +#define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),__FILE__,__LINE__) +#define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),__FILE__,__LINE__) +#define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),__FILE__,__LINE__) +#define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),__FILE__,__LINE__) +#define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),__FILE__,__LINE__) +#define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),__FILE__,__LINE__) +#define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),__FILE__,__LINE__) +#define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),__FILE__,__LINE__) +#define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),__FILE__,__LINE__) +#define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),__FILE__,__LINE__) +#define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),__FILE__,__LINE__) +#define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),__FILE__,__LINE__) +#define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),__FILE__,__LINE__) +#define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),__FILE__,__LINE__) +#define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),__FILE__,__LINE__) +#define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),__FILE__,__LINE__) + +/* Borland C seems too stupid to be able to shift and do longs in + * the pre-processor :-( */ +#define ERR_PACK(l,f,r) (((((unsigned long)l)&0xffL)*0x1000000)| \ + ((((unsigned long)f)&0xfffL)*0x1000)| \ + ((((unsigned long)r)&0xfffL))) +#define ERR_GET_LIB(l) (int)((((unsigned long)l)>>24L)&0xffL) +#define ERR_GET_FUNC(l) (int)((((unsigned long)l)>>12L)&0xfffL) +#define ERR_GET_REASON(l) (int)((l)&0xfffL) +#define ERR_FATAL_ERROR(l) (int)((l)&ERR_R_FATAL) + + +/* OS functions */ +#define SYS_F_FOPEN 1 +#define SYS_F_CONNECT 2 +#define SYS_F_GETSERVBYNAME 3 +#define SYS_F_SOCKET 4 +#define SYS_F_IOCTLSOCKET 5 +#define SYS_F_BIND 6 +#define SYS_F_LISTEN 7 +#define SYS_F_ACCEPT 8 +#define SYS_F_WSASTARTUP 9 /* Winsock stuff */ +#define SYS_F_OPENDIR 10 +#define SYS_F_FREAD 11 + + +/* reasons */ +#define ERR_R_SYS_LIB ERR_LIB_SYS /* 2 */ +#define ERR_R_BN_LIB ERR_LIB_BN /* 3 */ +#define ERR_R_RSA_LIB ERR_LIB_RSA /* 4 */ +#define ERR_R_DH_LIB ERR_LIB_DH /* 5 */ +#define ERR_R_EVP_LIB ERR_LIB_EVP /* 6 */ +#define ERR_R_BUF_LIB ERR_LIB_BUF /* 7 */ +#define ERR_R_OBJ_LIB ERR_LIB_OBJ /* 8 */ +#define ERR_R_PEM_LIB ERR_LIB_PEM /* 9 */ +#define ERR_R_DSA_LIB ERR_LIB_DSA /* 10 */ +#define ERR_R_X509_LIB ERR_LIB_X509 /* 11 */ +#define ERR_R_ASN1_LIB ERR_LIB_ASN1 /* 13 */ +#define ERR_R_CONF_LIB ERR_LIB_CONF /* 14 */ +#define ERR_R_CRYPTO_LIB ERR_LIB_CRYPTO /* 15 */ +#define ERR_R_EC_LIB ERR_LIB_EC /* 16 */ +#define ERR_R_SSL_LIB ERR_LIB_SSL /* 20 */ +#define ERR_R_BIO_LIB ERR_LIB_BIO /* 32 */ +#define ERR_R_PKCS7_LIB ERR_LIB_PKCS7 /* 33 */ +#define ERR_R_X509V3_LIB ERR_LIB_X509V3 /* 34 */ +#define ERR_R_PKCS12_LIB ERR_LIB_PKCS12 /* 35 */ +#define ERR_R_RAND_LIB ERR_LIB_RAND /* 36 */ +#define ERR_R_DSO_LIB ERR_LIB_DSO /* 37 */ +#define ERR_R_ENGINE_LIB ERR_LIB_ENGINE /* 38 */ +#define ERR_R_OCSP_LIB ERR_LIB_OCSP /* 39 */ +#define ERR_R_UI_LIB ERR_LIB_UI /* 40 */ +#define ERR_R_COMP_LIB ERR_LIB_COMP /* 41 */ +#define ERR_R_ECDSA_LIB ERR_LIB_ECDSA /* 42 */ +#define ERR_R_ECDH_LIB ERR_LIB_ECDH /* 43 */ +#define ERR_R_STORE_LIB ERR_LIB_STORE /* 44 */ + +#define ERR_R_NESTED_ASN1_ERROR 58 +#define ERR_R_BAD_ASN1_OBJECT_HEADER 59 +#define ERR_R_BAD_GET_ASN1_OBJECT_CALL 60 +#define ERR_R_EXPECTING_AN_ASN1_SEQUENCE 61 +#define ERR_R_ASN1_LENGTH_MISMATCH 62 +#define ERR_R_MISSING_ASN1_EOS 63 + +/* fatal error */ +#define ERR_R_FATAL 64 +#define ERR_R_MALLOC_FAILURE (1|ERR_R_FATAL) +#define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (2|ERR_R_FATAL) +#define ERR_R_PASSED_NULL_PARAMETER (3|ERR_R_FATAL) +#define ERR_R_INTERNAL_ERROR (4|ERR_R_FATAL) +#define ERR_R_DISABLED (5|ERR_R_FATAL) + +/* 99 is the maximum possible ERR_R_... code, higher values + * are reserved for the individual libraries */ + + +typedef struct ERR_string_data_st + { + unsigned long error; + const char *string; + } ERR_STRING_DATA; + +void ERR_put_error(int lib, int func,int reason,const char *file,int line); +void ERR_set_error_data(char *data,int flags); + +unsigned long ERR_get_error(void); +unsigned long ERR_get_error_line(const char **file,int *line); +unsigned long ERR_get_error_line_data(const char **file,int *line, + const char **data, int *flags); +unsigned long ERR_peek_error(void); +unsigned long ERR_peek_error_line(const char **file,int *line); +unsigned long ERR_peek_error_line_data(const char **file,int *line, + const char **data,int *flags); +unsigned long ERR_peek_last_error(void); +unsigned long ERR_peek_last_error_line(const char **file,int *line); +unsigned long ERR_peek_last_error_line_data(const char **file,int *line, + const char **data,int *flags); +void ERR_clear_error(void ); +char *ERR_error_string(unsigned long e,char *buf); +void ERR_error_string_n(unsigned long e, char *buf, size_t len); +const char *ERR_lib_error_string(unsigned long e); +const char *ERR_func_error_string(unsigned long e); +const char *ERR_reason_error_string(unsigned long e); +void ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u), + void *u); +#ifndef OPENSSL_NO_FP_API +void ERR_print_errors_fp(FILE *fp); +#endif +#ifndef OPENSSL_NO_BIO +void ERR_print_errors(BIO *bp); +void ERR_add_error_data(int num, ...); +#endif +void ERR_load_strings(int lib,ERR_STRING_DATA str[]); +void ERR_unload_strings(int lib,ERR_STRING_DATA str[]); +void ERR_load_ERR_strings(void); +void ERR_load_crypto_strings(void); +void ERR_free_strings(void); + +void ERR_remove_state(unsigned long pid); /* if zero we look it up */ +ERR_STATE *ERR_get_state(void); + +#ifndef OPENSSL_NO_LHASH +LHASH *ERR_get_string_table(void); +LHASH *ERR_get_err_state_table(void); +void ERR_release_err_state_table(LHASH **hash); +#endif + +int ERR_get_next_error_library(void); + +int ERR_set_mark(void); +int ERR_pop_to_mark(void); + +/* Already defined in ossl_typ.h */ +/* typedef struct st_ERR_FNS ERR_FNS; */ +/* An application can use this function and provide the return value to loaded + * modules that should use the application's ERR state/functionality */ +const ERR_FNS *ERR_get_implementation(void); +/* A loaded module should call this function prior to any ERR operations using + * the application's "ERR_FNS". */ +int ERR_set_implementation(const ERR_FNS *fns); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/openssl/evp.h b/h/openssl/evp.h new file mode 100644 index 0000000..0647655 --- /dev/null +++ b/h/openssl/evp.h @@ -0,0 +1,948 @@ +/* crypto/evp/evp.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_ENVELOPE_H +#define HEADER_ENVELOPE_H + +#ifdef OPENSSL_ALGORITHM_DEFINES +# include +#else +# define OPENSSL_ALGORITHM_DEFINES +# include +# undef OPENSSL_ALGORITHM_DEFINES +#endif + +#include + +#include + +#ifndef OPENSSL_NO_BIO +#include +#endif + +/* +#define EVP_RC2_KEY_SIZE 16 +#define EVP_RC4_KEY_SIZE 16 +#define EVP_BLOWFISH_KEY_SIZE 16 +#define EVP_CAST5_KEY_SIZE 16 +#define EVP_RC5_32_12_16_KEY_SIZE 16 +*/ +#define EVP_MAX_MD_SIZE 64 /* longest known is SHA512 */ +#define EVP_MAX_KEY_LENGTH 32 +#define EVP_MAX_IV_LENGTH 16 +#define EVP_MAX_BLOCK_LENGTH 32 + +#define PKCS5_SALT_LEN 8 +/* Default PKCS#5 iteration count */ +#define PKCS5_DEFAULT_ITER 2048 + +#include + +#define EVP_PK_RSA 0x0001 +#define EVP_PK_DSA 0x0002 +#define EVP_PK_DH 0x0004 +#define EVP_PK_EC 0x0008 +#define EVP_PKT_SIGN 0x0010 +#define EVP_PKT_ENC 0x0020 +#define EVP_PKT_EXCH 0x0040 +#define EVP_PKS_RSA 0x0100 +#define EVP_PKS_DSA 0x0200 +#define EVP_PKS_EC 0x0400 +#define EVP_PKT_EXP 0x1000 /* <= 512 bit key */ + +#define EVP_PKEY_NONE NID_undef +#define EVP_PKEY_RSA NID_rsaEncryption +#define EVP_PKEY_RSA2 NID_rsa +#define EVP_PKEY_DSA NID_dsa +#define EVP_PKEY_DSA1 NID_dsa_2 +#define EVP_PKEY_DSA2 NID_dsaWithSHA +#define EVP_PKEY_DSA3 NID_dsaWithSHA1 +#define EVP_PKEY_DSA4 NID_dsaWithSHA1_2 +#define EVP_PKEY_DH NID_dhKeyAgreement +#define EVP_PKEY_EC NID_X9_62_id_ecPublicKey + +#ifdef __cplusplus +extern "C" { +#endif + +/* Type needs to be a bit field + * Sub-type needs to be for variations on the method, as in, can it do + * arbitrary encryption.... */ +struct evp_pkey_st + { + int type; + int save_type; + int references; + union { + char *ptr; +#ifndef OPENSSL_NO_RSA + struct rsa_st *rsa; /* RSA */ +#endif +#ifndef OPENSSL_NO_DSA + struct dsa_st *dsa; /* DSA */ +#endif +#ifndef OPENSSL_NO_DH + struct dh_st *dh; /* DH */ +#endif +#ifndef OPENSSL_NO_EC + struct ec_key_st *ec; /* ECC */ +#endif + } pkey; + int save_parameters; + STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */ + } /* EVP_PKEY */; + +#define EVP_PKEY_MO_SIGN 0x0001 +#define EVP_PKEY_MO_VERIFY 0x0002 +#define EVP_PKEY_MO_ENCRYPT 0x0004 +#define EVP_PKEY_MO_DECRYPT 0x0008 + +#if 0 +/* This structure is required to tie the message digest and signing together. + * The lookup can be done by md/pkey_method, oid, oid/pkey_method, or + * oid, md and pkey. + * This is required because for various smart-card perform the digest and + * signing/verification on-board. To handle this case, the specific + * EVP_MD and EVP_PKEY_METHODs need to be closely associated. + * When a PKEY is created, it will have a EVP_PKEY_METHOD associated with it. + * This can either be software or a token to provide the required low level + * routines. + */ +typedef struct evp_pkey_md_st + { + int oid; + EVP_MD *md; + EVP_PKEY_METHOD *pkey; + } EVP_PKEY_MD; + +#define EVP_rsa_md2() \ + EVP_PKEY_MD_add(NID_md2WithRSAEncryption,\ + EVP_rsa_pkcs1(),EVP_md2()) +#define EVP_rsa_md5() \ + EVP_PKEY_MD_add(NID_md5WithRSAEncryption,\ + EVP_rsa_pkcs1(),EVP_md5()) +#define EVP_rsa_sha0() \ + EVP_PKEY_MD_add(NID_shaWithRSAEncryption,\ + EVP_rsa_pkcs1(),EVP_sha()) +#define EVP_rsa_sha1() \ + EVP_PKEY_MD_add(NID_sha1WithRSAEncryption,\ + EVP_rsa_pkcs1(),EVP_sha1()) +#define EVP_rsa_ripemd160() \ + EVP_PKEY_MD_add(NID_ripemd160WithRSA,\ + EVP_rsa_pkcs1(),EVP_ripemd160()) +#define EVP_rsa_mdc2() \ + EVP_PKEY_MD_add(NID_mdc2WithRSA,\ + EVP_rsa_octet_string(),EVP_mdc2()) +#define EVP_dsa_sha() \ + EVP_PKEY_MD_add(NID_dsaWithSHA,\ + EVP_dsa(),EVP_sha()) +#define EVP_dsa_sha1() \ + EVP_PKEY_MD_add(NID_dsaWithSHA1,\ + EVP_dsa(),EVP_sha1()) + +typedef struct evp_pkey_method_st + { + char *name; + int flags; + int type; /* RSA, DSA, an SSLeay specific constant */ + int oid; /* For the pub-key type */ + int encrypt_oid; /* pub/priv key encryption */ + + int (*sign)(); + int (*verify)(); + struct { + int (*set)(); /* get and/or set the underlying type */ + int (*get)(); + int (*encrypt)(); + int (*decrypt)(); + int (*i2d)(); + int (*d2i)(); + int (*dup)(); + } pub,priv; + int (*set_asn1_parameters)(); + int (*get_asn1_parameters)(); + } EVP_PKEY_METHOD; +#endif + +#ifndef EVP_MD +struct env_md_st + { + int type; + int pkey_type; + int md_size; + unsigned long flags; + int (*init)(EVP_MD_CTX *ctx); + int (*update)(EVP_MD_CTX *ctx,const void *data,size_t count); + int (*final)(EVP_MD_CTX *ctx,unsigned char *md); + int (*copy)(EVP_MD_CTX *to,const EVP_MD_CTX *from); + int (*cleanup)(EVP_MD_CTX *ctx); + + /* FIXME: prototype these some day */ + int (*sign)(int type, const unsigned char *m, unsigned int m_length, + unsigned char *sigret, unsigned int *siglen, void *key); + int (*verify)(int type, const unsigned char *m, unsigned int m_length, + const unsigned char *sigbuf, unsigned int siglen, + void *key); + int required_pkey_type[5]; /*EVP_PKEY_xxx */ + int block_size; + int ctx_size; /* how big does the ctx->md_data need to be */ + } /* EVP_MD */; + +typedef int evp_sign_method(int type,const unsigned char *m, + unsigned int m_length,unsigned char *sigret, + unsigned int *siglen, void *key); +typedef int evp_verify_method(int type,const unsigned char *m, + unsigned int m_length,const unsigned char *sigbuf, + unsigned int siglen, void *key); + +#define EVP_MD_FLAG_ONESHOT 0x0001 /* digest can only handle a single + * block */ + +#define EVP_PKEY_NULL_method NULL,NULL,{0,0,0,0} + +#ifndef OPENSSL_NO_DSA +#define EVP_PKEY_DSA_method (evp_sign_method *)DSA_sign, \ + (evp_verify_method *)DSA_verify, \ + {EVP_PKEY_DSA,EVP_PKEY_DSA2,EVP_PKEY_DSA3, \ + EVP_PKEY_DSA4,0} +#else +#define EVP_PKEY_DSA_method EVP_PKEY_NULL_method +#endif + +#ifndef OPENSSL_NO_ECDSA +#define EVP_PKEY_ECDSA_method (evp_sign_method *)ECDSA_sign, \ + (evp_verify_method *)ECDSA_verify, \ + {EVP_PKEY_EC,0,0,0} +#else +#define EVP_PKEY_ECDSA_method EVP_PKEY_NULL_method +#endif + +#ifndef OPENSSL_NO_RSA +#define EVP_PKEY_RSA_method (evp_sign_method *)RSA_sign, \ + (evp_verify_method *)RSA_verify, \ + {EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0} +#define EVP_PKEY_RSA_ASN1_OCTET_STRING_method \ + (evp_sign_method *)RSA_sign_ASN1_OCTET_STRING, \ + (evp_verify_method *)RSA_verify_ASN1_OCTET_STRING, \ + {EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0} +#else +#define EVP_PKEY_RSA_method EVP_PKEY_NULL_method +#define EVP_PKEY_RSA_ASN1_OCTET_STRING_method EVP_PKEY_NULL_method +#endif + +#endif /* !EVP_MD */ + +struct env_md_ctx_st + { + const EVP_MD *digest; + ENGINE *engine; /* functional reference if 'digest' is ENGINE-provided */ + unsigned long flags; + void *md_data; + } /* EVP_MD_CTX */; + +/* values for EVP_MD_CTX flags */ + +#define EVP_MD_CTX_FLAG_ONESHOT 0x0001 /* digest update will be called + * once only */ +#define EVP_MD_CTX_FLAG_CLEANED 0x0002 /* context has already been + * cleaned */ +#define EVP_MD_CTX_FLAG_REUSE 0x0004 /* Don't free up ctx->md_data + * in EVP_MD_CTX_cleanup */ + +struct evp_cipher_st + { + int nid; + int block_size; + int key_len; /* Default value for variable length ciphers */ + int iv_len; + unsigned long flags; /* Various flags */ + int (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key, + const unsigned char *iv, int enc); /* init key */ + int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out, + const unsigned char *in, unsigned int inl);/* encrypt/decrypt data */ + int (*cleanup)(EVP_CIPHER_CTX *); /* cleanup ctx */ + int ctx_size; /* how big ctx->cipher_data needs to be */ + int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Populate a ASN1_TYPE with parameters */ + int (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Get parameters from a ASN1_TYPE */ + int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr); /* Miscellaneous operations */ + void *app_data; /* Application data */ + } /* EVP_CIPHER */; + +/* Values for cipher flags */ + +/* Modes for ciphers */ + +#define EVP_CIPH_STREAM_CIPHER 0x0 +#define EVP_CIPH_ECB_MODE 0x1 +#define EVP_CIPH_CBC_MODE 0x2 +#define EVP_CIPH_CFB_MODE 0x3 +#define EVP_CIPH_OFB_MODE 0x4 +#define EVP_CIPH_MODE 0x7 +/* Set if variable length cipher */ +#define EVP_CIPH_VARIABLE_LENGTH 0x8 +/* Set if the iv handling should be done by the cipher itself */ +#define EVP_CIPH_CUSTOM_IV 0x10 +/* Set if the cipher's init() function should be called if key is NULL */ +#define EVP_CIPH_ALWAYS_CALL_INIT 0x20 +/* Call ctrl() to init cipher parameters */ +#define EVP_CIPH_CTRL_INIT 0x40 +/* Don't use standard key length function */ +#define EVP_CIPH_CUSTOM_KEY_LENGTH 0x80 +/* Don't use standard block padding */ +#define EVP_CIPH_NO_PADDING 0x100 +/* cipher handles random key generation */ +#define EVP_CIPH_RAND_KEY 0x200 + +/* ctrl() values */ + +#define EVP_CTRL_INIT 0x0 +#define EVP_CTRL_SET_KEY_LENGTH 0x1 +#define EVP_CTRL_GET_RC2_KEY_BITS 0x2 +#define EVP_CTRL_SET_RC2_KEY_BITS 0x3 +#define EVP_CTRL_GET_RC5_ROUNDS 0x4 +#define EVP_CTRL_SET_RC5_ROUNDS 0x5 +#define EVP_CTRL_RAND_KEY 0x6 + +typedef struct evp_cipher_info_st + { + const EVP_CIPHER *cipher; + unsigned char iv[EVP_MAX_IV_LENGTH]; + } EVP_CIPHER_INFO; + +struct evp_cipher_ctx_st + { + const EVP_CIPHER *cipher; + ENGINE *engine; /* functional reference if 'cipher' is ENGINE-provided */ + int encrypt; /* encrypt or decrypt */ + int buf_len; /* number we have left */ + + unsigned char oiv[EVP_MAX_IV_LENGTH]; /* original iv */ + unsigned char iv[EVP_MAX_IV_LENGTH]; /* working iv */ + unsigned char buf[EVP_MAX_BLOCK_LENGTH];/* saved partial block */ + int num; /* used by cfb/ofb mode */ + + void *app_data; /* application stuff */ + int key_len; /* May change for variable length cipher */ + unsigned long flags; /* Various flags */ + void *cipher_data; /* per EVP data */ + int final_used; + int block_mask; + unsigned char final[EVP_MAX_BLOCK_LENGTH];/* possible final block */ + } /* EVP_CIPHER_CTX */; + +typedef struct evp_Encode_Ctx_st + { + int num; /* number saved in a partial encode/decode */ + int length; /* The length is either the output line length + * (in input bytes) or the shortest input line + * length that is ok. Once decoding begins, + * the length is adjusted up each time a longer + * line is decoded */ + unsigned char enc_data[80]; /* data to encode */ + int line_num; /* number read on current line */ + int expect_nl; + } EVP_ENCODE_CTX; + +/* Password based encryption function */ +typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, const EVP_CIPHER *cipher, + const EVP_MD *md, int en_de); + +#ifndef OPENSSL_NO_RSA +#define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\ + (char *)(rsa)) +#endif + +#ifndef OPENSSL_NO_DSA +#define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\ + (char *)(dsa)) +#endif + +#ifndef OPENSSL_NO_DH +#define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,\ + (char *)(dh)) +#endif + +#ifndef OPENSSL_NO_EC +#define EVP_PKEY_assign_EC_KEY(pkey,eckey) EVP_PKEY_assign((pkey),EVP_PKEY_EC,\ + (char *)(eckey)) +#endif + +/* Add some extra combinations */ +#define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a)) +#define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a)) +#define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) +#define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a)) + +#define EVP_MD_type(e) ((e)->type) +#define EVP_MD_nid(e) EVP_MD_type(e) +#define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_nid(e)) +#define EVP_MD_pkey_type(e) ((e)->pkey_type) +#define EVP_MD_size(e) ((e)->md_size) +#define EVP_MD_block_size(e) ((e)->block_size) + +#define EVP_MD_CTX_md(e) ((e)->digest) +#define EVP_MD_CTX_size(e) EVP_MD_size((e)->digest) +#define EVP_MD_CTX_block_size(e) EVP_MD_block_size((e)->digest) +#define EVP_MD_CTX_type(e) EVP_MD_type((e)->digest) + +#define EVP_CIPHER_nid(e) ((e)->nid) +#define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e)) +#define EVP_CIPHER_block_size(e) ((e)->block_size) +#define EVP_CIPHER_key_length(e) ((e)->key_len) +#define EVP_CIPHER_iv_length(e) ((e)->iv_len) +#define EVP_CIPHER_flags(e) ((e)->flags) +#define EVP_CIPHER_mode(e) (((e)->flags) & EVP_CIPH_MODE) + +#define EVP_CIPHER_CTX_cipher(e) ((e)->cipher) +#define EVP_CIPHER_CTX_nid(e) ((e)->cipher->nid) +#define EVP_CIPHER_CTX_block_size(e) ((e)->cipher->block_size) +#define EVP_CIPHER_CTX_key_length(e) ((e)->key_len) +#define EVP_CIPHER_CTX_iv_length(e) ((e)->cipher->iv_len) +#define EVP_CIPHER_CTX_get_app_data(e) ((e)->app_data) +#define EVP_CIPHER_CTX_set_app_data(e,d) ((e)->app_data=(char *)(d)) +#define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) +#define EVP_CIPHER_CTX_flags(e) ((e)->cipher->flags) +#define EVP_CIPHER_CTX_mode(e) ((e)->cipher->flags & EVP_CIPH_MODE) + +#define EVP_ENCODE_LENGTH(l) (((l+2)/3*4)+(l/48+1)*2+80) +#define EVP_DECODE_LENGTH(l) ((l+3)/4*3+80) + +#define EVP_SignInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) +#define EVP_SignInit(a,b) EVP_DigestInit(a,b) +#define EVP_SignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) +#define EVP_VerifyInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) +#define EVP_VerifyInit(a,b) EVP_DigestInit(a,b) +#define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) +#define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) +#define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e) + +#ifdef CONST_STRICT +void BIO_set_md(BIO *,const EVP_MD *md); +#else +# define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,0,(char *)md) +#endif +#define BIO_get_md(b,mdp) BIO_ctrl(b,BIO_C_GET_MD,0,(char *)mdp) +#define BIO_get_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_GET_MD_CTX,0,(char *)mdcp) +#define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) +#define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(char *)c_pp) + +#define EVP_Cipher(c,o,i,l) (c)->cipher->do_cipher((c),(o),(i),(l)) + +#define EVP_add_cipher_alias(n,alias) \ + OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n)) +#define EVP_add_digest_alias(n,alias) \ + OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n)) +#define EVP_delete_cipher_alias(alias) \ + OBJ_NAME_remove(alias,OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS); +#define EVP_delete_digest_alias(alias) \ + OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS); + +void EVP_MD_CTX_init(EVP_MD_CTX *ctx); +int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx); +EVP_MD_CTX *EVP_MD_CTX_create(void); +void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx); +int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out,const EVP_MD_CTX *in); +#define EVP_MD_CTX_set_flags(ctx,flgs) ((ctx)->flags|=(flgs)) +#define EVP_MD_CTX_clear_flags(ctx,flgs) ((ctx)->flags&=~(flgs)) +#define EVP_MD_CTX_test_flags(ctx,flgs) ((ctx)->flags&(flgs)) +int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl); +int EVP_DigestUpdate(EVP_MD_CTX *ctx,const void *d, + size_t cnt); +int EVP_DigestFinal_ex(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s); +int EVP_Digest(const void *data, size_t count, + unsigned char *md, unsigned int *size, const EVP_MD *type, ENGINE *impl); + +int EVP_MD_CTX_copy(EVP_MD_CTX *out,const EVP_MD_CTX *in); +int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); +int EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s); + +int EVP_read_pw_string(char *buf,int length,const char *prompt,int verify); +void EVP_set_pw_prompt(const char *prompt); +char * EVP_get_pw_prompt(void); + +int EVP_BytesToKey(const EVP_CIPHER *type,const EVP_MD *md, + const unsigned char *salt, const unsigned char *data, + int datal, int count, unsigned char *key,unsigned char *iv); + +int EVP_EncryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, + const unsigned char *key, const unsigned char *iv); +int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl, + const unsigned char *key, const unsigned char *iv); +int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl, const unsigned char *in, int inl); +int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); +int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); + +int EVP_DecryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, + const unsigned char *key, const unsigned char *iv); +int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl, + const unsigned char *key, const unsigned char *iv); +int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl, const unsigned char *in, int inl); +int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); +int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); + +int EVP_CipherInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, + const unsigned char *key,const unsigned char *iv, + int enc); +int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl, + const unsigned char *key,const unsigned char *iv, + int enc); +int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl, const unsigned char *in, int inl); +int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); +int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); + +int EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s, + EVP_PKEY *pkey); + +int EVP_VerifyFinal(EVP_MD_CTX *ctx,const unsigned char *sigbuf, + unsigned int siglen,EVP_PKEY *pkey); + +int EVP_OpenInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type, + const unsigned char *ek, int ekl, const unsigned char *iv, + EVP_PKEY *priv); +int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); + +int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, + unsigned char **ek, int *ekl, unsigned char *iv, + EVP_PKEY **pubk, int npubk); +int EVP_SealFinal(EVP_CIPHER_CTX *ctx,unsigned char *out,int *outl); + +void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); +void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl, + const unsigned char *in,int inl); +void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl); +int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n); + + +void EVP_DecodeInit(EVP_ENCODE_CTX *ctx); +int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl, + const unsigned char *in, int inl); +int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned + char *out, int *outl); +int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n); + +void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a); +int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); +int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); +int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad); +int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); +int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key); + +#ifndef OPENSSL_NO_BIO +BIO_METHOD *BIO_f_md(void); +BIO_METHOD *BIO_f_base64(void); +BIO_METHOD *BIO_f_cipher(void); +BIO_METHOD *BIO_f_reliable(void); +void BIO_set_cipher(BIO *b,const EVP_CIPHER *c,const unsigned char *k, + const unsigned char *i, int enc); +#endif + +const EVP_MD *EVP_md_null(void); +#ifndef OPENSSL_NO_MD2 +const EVP_MD *EVP_md2(void); +const EVP_MD *EVP_md2_copy_safe(void); +#endif +#ifndef OPENSSL_NO_MD4 +const EVP_MD *EVP_md4(void); +const EVP_MD *EVP_md4_copy_safe(void); +#endif +#ifndef OPENSSL_NO_MD5 +const EVP_MD *EVP_md5(void); +const EVP_MD *EVP_md5_copy_safe(void); +#endif +#ifndef OPENSSL_NO_SHA +const EVP_MD *EVP_sha(void); +const EVP_MD *EVP_sha_copy_safe(void); +const EVP_MD *EVP_sha1(void); +const EVP_MD *EVP_sha1_copy_safe(void); +const EVP_MD *EVP_dss(void); +const EVP_MD *EVP_dss_copy_safe(void); +const EVP_MD *EVP_dss1(void); +const EVP_MD *EVP_dss1_copy_safe(void); +const EVP_MD *EVP_ecdsa(void); +#endif +#ifndef OPENSSL_NO_SHA256 +const EVP_MD *EVP_sha224(void); +const EVP_MD *EVP_sha256(void); +#endif +#ifndef OPENSSL_NO_SHA512 +const EVP_MD *EVP_sha384(void); +const EVP_MD *EVP_sha512(void); +#endif +#ifndef OPENSSL_NO_MDC2 +const EVP_MD *EVP_mdc2(void); +#endif +#ifndef OPENSSL_NO_RIPEMD +const EVP_MD *EVP_ripemd160(void); +const EVP_MD *EVP_ripemd160_copy_safe(void); +#endif +const EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */ +#ifndef OPENSSL_NO_DES +const EVP_CIPHER *EVP_des_ecb(void); +const EVP_CIPHER *EVP_des_ede(void); +const EVP_CIPHER *EVP_des_ede3(void); +const EVP_CIPHER *EVP_des_ede_ecb(void); +const EVP_CIPHER *EVP_des_ede3_ecb(void); +const EVP_CIPHER *EVP_des_cfb64(void); +# define EVP_des_cfb EVP_des_cfb64 +const EVP_CIPHER *EVP_des_cfb1(void); +const EVP_CIPHER *EVP_des_cfb8(void); +const EVP_CIPHER *EVP_des_ede_cfb64(void); +# define EVP_des_ede_cfb EVP_des_ede_cfb64 +#if 0 +const EVP_CIPHER *EVP_des_ede_cfb1(void); +const EVP_CIPHER *EVP_des_ede_cfb8(void); +#endif +const EVP_CIPHER *EVP_des_ede3_cfb64(void); +# define EVP_des_ede3_cfb EVP_des_ede3_cfb64 +const EVP_CIPHER *EVP_des_ede3_cfb1(void); +const EVP_CIPHER *EVP_des_ede3_cfb8(void); +const EVP_CIPHER *EVP_des_ofb(void); +const EVP_CIPHER *EVP_des_ede_ofb(void); +const EVP_CIPHER *EVP_des_ede3_ofb(void); +const EVP_CIPHER *EVP_des_cbc(void); +const EVP_CIPHER *EVP_des_ede_cbc(void); +const EVP_CIPHER *EVP_des_ede3_cbc(void); +const EVP_CIPHER *EVP_desx_cbc(void); +/* This should now be supported through the dev_crypto ENGINE. But also, why are + * rc4 and md5 declarations made here inside a "NO_DES" precompiler branch? */ +#if 0 +# ifdef OPENSSL_OPENBSD_DEV_CRYPTO +const EVP_CIPHER *EVP_dev_crypto_des_ede3_cbc(void); +const EVP_CIPHER *EVP_dev_crypto_rc4(void); +const EVP_MD *EVP_dev_crypto_md5(void); +# endif +#endif +#endif +#ifndef OPENSSL_NO_RC4 +const EVP_CIPHER *EVP_rc4(void); +const EVP_CIPHER *EVP_rc4_40(void); +#endif +#ifndef OPENSSL_NO_IDEA +const EVP_CIPHER *EVP_idea_ecb(void); +const EVP_CIPHER *EVP_idea_cfb64(void); +# define EVP_idea_cfb EVP_idea_cfb64 +const EVP_CIPHER *EVP_idea_ofb(void); +const EVP_CIPHER *EVP_idea_cbc(void); +#endif +#ifndef OPENSSL_NO_RC2 +const EVP_CIPHER *EVP_rc2_ecb(void); +const EVP_CIPHER *EVP_rc2_cbc(void); +const EVP_CIPHER *EVP_rc2_40_cbc(void); +const EVP_CIPHER *EVP_rc2_64_cbc(void); +const EVP_CIPHER *EVP_rc2_cfb64(void); +# define EVP_rc2_cfb EVP_rc2_cfb64 +const EVP_CIPHER *EVP_rc2_ofb(void); +#endif +#ifndef OPENSSL_NO_BF +const EVP_CIPHER *EVP_bf_ecb(void); +const EVP_CIPHER *EVP_bf_cbc(void); +const EVP_CIPHER *EVP_bf_cfb64(void); +# define EVP_bf_cfb EVP_bf_cfb64 +const EVP_CIPHER *EVP_bf_ofb(void); +#endif +#ifndef OPENSSL_NO_CAST +const EVP_CIPHER *EVP_cast5_ecb(void); +const EVP_CIPHER *EVP_cast5_cbc(void); +const EVP_CIPHER *EVP_cast5_cfb64(void); +# define EVP_cast5_cfb EVP_cast5_cfb64 +const EVP_CIPHER *EVP_cast5_ofb(void); +#endif +#ifndef OPENSSL_NO_RC5 +const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void); +const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void); +const EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void); +# define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64 +const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void); +#endif +#ifndef OPENSSL_NO_AES +const EVP_CIPHER *EVP_aes_128_ecb(void); +const EVP_CIPHER *EVP_aes_128_cbc(void); +const EVP_CIPHER *EVP_aes_128_cfb1(void); +const EVP_CIPHER *EVP_aes_128_cfb8(void); +const EVP_CIPHER *EVP_aes_128_cfb128(void); +# define EVP_aes_128_cfb EVP_aes_128_cfb128 +const EVP_CIPHER *EVP_aes_128_ofb(void); +#if 0 +const EVP_CIPHER *EVP_aes_128_ctr(void); +#endif +const EVP_CIPHER *EVP_aes_192_ecb(void); +const EVP_CIPHER *EVP_aes_192_cbc(void); +const EVP_CIPHER *EVP_aes_192_cfb1(void); +const EVP_CIPHER *EVP_aes_192_cfb8(void); +const EVP_CIPHER *EVP_aes_192_cfb128(void); +# define EVP_aes_192_cfb EVP_aes_192_cfb128 +const EVP_CIPHER *EVP_aes_192_ofb(void); +#if 0 +const EVP_CIPHER *EVP_aes_192_ctr(void); +#endif +const EVP_CIPHER *EVP_aes_256_ecb(void); +const EVP_CIPHER *EVP_aes_256_cbc(void); +const EVP_CIPHER *EVP_aes_256_cfb1(void); +const EVP_CIPHER *EVP_aes_256_cfb8(void); +const EVP_CIPHER *EVP_aes_256_cfb128(void); +# define EVP_aes_256_cfb EVP_aes_256_cfb128 +const EVP_CIPHER *EVP_aes_256_ofb(void); +#if 0 +const EVP_CIPHER *EVP_aes_256_ctr(void); +#endif +#endif + +void OPENSSL_add_all_algorithms_noconf(void); +void OPENSSL_add_all_algorithms_conf(void); + +#ifdef OPENSSL_LOAD_CONF +#define OpenSSL_add_all_algorithms() \ + OPENSSL_add_all_algorithms_conf() +#else +#define OpenSSL_add_all_algorithms() \ + OPENSSL_add_all_algorithms_noconf() +#endif + +void OpenSSL_add_all_ciphers(void); +void OpenSSL_add_all_digests(void); +#define SSLeay_add_all_algorithms() OpenSSL_add_all_algorithms() +#define SSLeay_add_all_ciphers() OpenSSL_add_all_ciphers() +#define SSLeay_add_all_digests() OpenSSL_add_all_digests() + +int EVP_add_cipher(const EVP_CIPHER *cipher); +int EVP_add_digest(const EVP_MD *digest); + +const EVP_CIPHER *EVP_get_cipherbyname(const char *name); +const EVP_MD *EVP_get_digestbyname(const char *name); +void EVP_cleanup(void); + +int EVP_PKEY_decrypt(unsigned char *dec_key, + const unsigned char *enc_key,int enc_key_len, + EVP_PKEY *private_key); +int EVP_PKEY_encrypt(unsigned char *enc_key, + const unsigned char *key,int key_len, + EVP_PKEY *pub_key); +int EVP_PKEY_type(int type); +int EVP_PKEY_bits(EVP_PKEY *pkey); +int EVP_PKEY_size(EVP_PKEY *pkey); +int EVP_PKEY_assign(EVP_PKEY *pkey,int type,char *key); + +#ifndef OPENSSL_NO_RSA +struct rsa_st; +int EVP_PKEY_set1_RSA(EVP_PKEY *pkey,struct rsa_st *key); +struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey); +#endif +#ifndef OPENSSL_NO_DSA +struct dsa_st; +int EVP_PKEY_set1_DSA(EVP_PKEY *pkey,struct dsa_st *key); +struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey); +#endif +#ifndef OPENSSL_NO_DH +struct dh_st; +int EVP_PKEY_set1_DH(EVP_PKEY *pkey,struct dh_st *key); +struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey); +#endif +#ifndef OPENSSL_NO_EC +struct ec_key_st; +int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey,struct ec_key_st *key); +struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey); +#endif + +EVP_PKEY * EVP_PKEY_new(void); +void EVP_PKEY_free(EVP_PKEY *pkey); + +EVP_PKEY * d2i_PublicKey(int type,EVP_PKEY **a, const unsigned char **pp, + long length); +int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp); + +EVP_PKEY * d2i_PrivateKey(int type,EVP_PKEY **a, const unsigned char **pp, + long length); +EVP_PKEY * d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, + long length); +int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp); + +int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from); +int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey); +int EVP_PKEY_save_parameters(EVP_PKEY *pkey,int mode); +int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b); + +int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b); + +int EVP_CIPHER_type(const EVP_CIPHER *ctx); + +/* calls methods */ +int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); +int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); + +/* These are used by EVP_CIPHER methods */ +int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type); +int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type); + +/* PKCS5 password based encryption */ +int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, + int en_de); +int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, + const unsigned char *salt, int saltlen, int iter, + int keylen, unsigned char *out); +int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, + int en_de); + +void PKCS5_PBE_add(void); + +int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen, + ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de); +int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, + EVP_PBE_KEYGEN *keygen); +void EVP_PBE_cleanup(void); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_EVP_strings(void); + +/* Error codes for the EVP functions. */ + +/* Function codes. */ +#define EVP_F_AES_INIT_KEY 133 +#define EVP_F_D2I_PKEY 100 +#define EVP_F_DSAPKEY2PKCS8 134 +#define EVP_F_DSA_PKEY2PKCS8 135 +#define EVP_F_ECDSA_PKEY2PKCS8 129 +#define EVP_F_ECKEY_PKEY2PKCS8 132 +#define EVP_F_EVP_CIPHERINIT_EX 123 +#define EVP_F_EVP_CIPHER_CTX_CTRL 124 +#define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH 122 +#define EVP_F_EVP_DECRYPTFINAL_EX 101 +#define EVP_F_EVP_DIGESTINIT_EX 128 +#define EVP_F_EVP_ENCRYPTFINAL_EX 127 +#define EVP_F_EVP_MD_CTX_COPY_EX 110 +#define EVP_F_EVP_OPENINIT 102 +#define EVP_F_EVP_PBE_ALG_ADD 115 +#define EVP_F_EVP_PBE_CIPHERINIT 116 +#define EVP_F_EVP_PKCS82PKEY 111 +#define EVP_F_EVP_PKEY2PKCS8_BROKEN 113 +#define EVP_F_EVP_PKEY_COPY_PARAMETERS 103 +#define EVP_F_EVP_PKEY_DECRYPT 104 +#define EVP_F_EVP_PKEY_ENCRYPT 105 +#define EVP_F_EVP_PKEY_GET1_DH 119 +#define EVP_F_EVP_PKEY_GET1_DSA 120 +#define EVP_F_EVP_PKEY_GET1_ECDSA 130 +#define EVP_F_EVP_PKEY_GET1_EC_KEY 131 +#define EVP_F_EVP_PKEY_GET1_RSA 121 +#define EVP_F_EVP_PKEY_NEW 106 +#define EVP_F_EVP_RIJNDAEL 126 +#define EVP_F_EVP_SIGNFINAL 107 +#define EVP_F_EVP_VERIFYFINAL 108 +#define EVP_F_PKCS5_PBE_KEYIVGEN 117 +#define EVP_F_PKCS5_V2_PBE_KEYIVGEN 118 +#define EVP_F_PKCS8_SET_BROKEN 112 +#define EVP_F_RC2_MAGIC_TO_METH 109 +#define EVP_F_RC5_CTRL 125 + +/* Reason codes. */ +#define EVP_R_AES_KEY_SETUP_FAILED 143 +#define EVP_R_ASN1_LIB 140 +#define EVP_R_BAD_BLOCK_LENGTH 136 +#define EVP_R_BAD_DECRYPT 100 +#define EVP_R_BAD_KEY_LENGTH 137 +#define EVP_R_BN_DECODE_ERROR 112 +#define EVP_R_BN_PUBKEY_ERROR 113 +#define EVP_R_CIPHER_PARAMETER_ERROR 122 +#define EVP_R_CTRL_NOT_IMPLEMENTED 132 +#define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED 133 +#define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH 138 +#define EVP_R_DECODE_ERROR 114 +#define EVP_R_DIFFERENT_KEY_TYPES 101 +#define EVP_R_ENCODE_ERROR 115 +#define EVP_R_EVP_PBE_CIPHERINIT_ERROR 119 +#define EVP_R_EXPECTING_AN_RSA_KEY 127 +#define EVP_R_EXPECTING_A_DH_KEY 128 +#define EVP_R_EXPECTING_A_DSA_KEY 129 +#define EVP_R_EXPECTING_A_ECDSA_KEY 141 +#define EVP_R_EXPECTING_A_EC_KEY 142 +#define EVP_R_INITIALIZATION_ERROR 134 +#define EVP_R_INPUT_NOT_INITIALIZED 111 +#define EVP_R_INVALID_KEY_LENGTH 130 +#define EVP_R_IV_TOO_LARGE 102 +#define EVP_R_KEYGEN_FAILURE 120 +#define EVP_R_MISSING_PARAMETERS 103 +#define EVP_R_NO_CIPHER_SET 131 +#define EVP_R_NO_DIGEST_SET 139 +#define EVP_R_NO_DSA_PARAMETERS 116 +#define EVP_R_NO_SIGN_FUNCTION_CONFIGURED 104 +#define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED 105 +#define EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE 117 +#define EVP_R_PUBLIC_KEY_NOT_RSA 106 +#define EVP_R_UNKNOWN_PBE_ALGORITHM 121 +#define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS 135 +#define EVP_R_UNSUPPORTED_CIPHER 107 +#define EVP_R_UNSUPPORTED_KEYLENGTH 123 +#define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION 124 +#define EVP_R_UNSUPPORTED_KEY_SIZE 108 +#define EVP_R_UNSUPPORTED_PRF 125 +#define EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM 118 +#define EVP_R_UNSUPPORTED_SALT_TYPE 126 +#define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109 +#define EVP_R_WRONG_PUBLIC_KEY_TYPE 110 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/openssl/hmac.h b/h/openssl/hmac.h new file mode 100644 index 0000000..f74266b --- /dev/null +++ b/h/openssl/hmac.h @@ -0,0 +1,108 @@ +/* crypto/hmac/hmac.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +#ifndef HEADER_HMAC_H +#define HEADER_HMAC_H + +#ifdef OPENSSL_NO_HMAC +#error HMAC is disabled. +#endif + +#include +#include + +#define HMAC_MAX_MD_CBLOCK 64 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct hmac_ctx_st + { + const EVP_MD *md; + unsigned int key_length; + unsigned char key[HMAC_MAX_MD_CBLOCK]; + CCIContext cciCtx; + unsigned int ctxInit; /* if this 0, cciCtx has not been initialized + if it is set, we must call cciCtxClear before + reusing */ + } HMAC_CTX; + +#define HMAC_size(e) (EVP_MD_size((e)->md)) + + +void HMAC_CTX_init(HMAC_CTX *ctx); +void HMAC_CTX_cleanup(HMAC_CTX *ctx); + +#define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx) /* deprecated */ + +void HMAC_Init(HMAC_CTX *ctx, const void *key, int len, + const EVP_MD *md); /* deprecated */ +void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, + const EVP_MD *md, ENGINE *impl); +void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, int len); +void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); +unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, + const unsigned char *d, int n, unsigned char *md, + unsigned int *md_len); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/openssl/idea.h b/h/openssl/idea.h new file mode 100644 index 0000000..2845ab5 --- /dev/null +++ b/h/openssl/idea.h @@ -0,0 +1,4 @@ +/* Empty file for backward compatibiliy only. + * To use cryptographic primatives, please use EVP API or CCI API. + */ +#include diff --git a/h/openssl/krb5_asn.h b/h/openssl/krb5_asn.h new file mode 100644 index 0000000..41725d0 --- /dev/null +++ b/h/openssl/krb5_asn.h @@ -0,0 +1,256 @@ +/* krb5_asn.h */ +/* Written by Vern Staats for the OpenSSL project, +** using ocsp/{*.h,*asn*.c} as a starting point +*/ + +/* ==================================================================== + * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_KRB5_ASN_H +#define HEADER_KRB5_ASN_H + +/* +#include +*/ +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/* ASN.1 from Kerberos RFC 1510 +*/ + +/* EncryptedData ::= SEQUENCE { +** etype[0] INTEGER, -- EncryptionType +** kvno[1] INTEGER OPTIONAL, +** cipher[2] OCTET STRING -- ciphertext +** } +*/ +typedef struct krb5_encdata_st + { + ASN1_INTEGER *etype; + ASN1_INTEGER *kvno; + ASN1_OCTET_STRING *cipher; + } KRB5_ENCDATA; + +DECLARE_STACK_OF(KRB5_ENCDATA) + +/* PrincipalName ::= SEQUENCE { +** name-type[0] INTEGER, +** name-string[1] SEQUENCE OF GeneralString +** } +*/ +typedef struct krb5_princname_st + { + ASN1_INTEGER *nametype; + STACK_OF(ASN1_GENERALSTRING) *namestring; + } KRB5_PRINCNAME; + +DECLARE_STACK_OF(KRB5_PRINCNAME) + + +/* Ticket ::= [APPLICATION 1] SEQUENCE { +** tkt-vno[0] INTEGER, +** realm[1] Realm, +** sname[2] PrincipalName, +** enc-part[3] EncryptedData +** } +*/ +typedef struct krb5_tktbody_st + { + ASN1_INTEGER *tktvno; + ASN1_GENERALSTRING *realm; + KRB5_PRINCNAME *sname; + KRB5_ENCDATA *encdata; + } KRB5_TKTBODY; + +typedef STACK_OF(KRB5_TKTBODY) KRB5_TICKET; +DECLARE_STACK_OF(KRB5_TKTBODY) + + +/* AP-REQ ::= [APPLICATION 14] SEQUENCE { +** pvno[0] INTEGER, +** msg-type[1] INTEGER, +** ap-options[2] APOptions, +** ticket[3] Ticket, +** authenticator[4] EncryptedData +** } +** +** APOptions ::= BIT STRING { +** reserved(0), use-session-key(1), mutual-required(2) } +*/ +typedef struct krb5_ap_req_st + { + ASN1_INTEGER *pvno; + ASN1_INTEGER *msgtype; + ASN1_BIT_STRING *apoptions; + KRB5_TICKET *ticket; + KRB5_ENCDATA *authenticator; + } KRB5_APREQBODY; + +typedef STACK_OF(KRB5_APREQBODY) KRB5_APREQ; +DECLARE_STACK_OF(KRB5_APREQBODY) + + +/* Authenticator Stuff */ + + +/* Checksum ::= SEQUENCE { +** cksumtype[0] INTEGER, +** checksum[1] OCTET STRING +** } +*/ +typedef struct krb5_checksum_st + { + ASN1_INTEGER *ctype; + ASN1_OCTET_STRING *checksum; + } KRB5_CHECKSUM; + +DECLARE_STACK_OF(KRB5_CHECKSUM) + + +/* EncryptionKey ::= SEQUENCE { +** keytype[0] INTEGER, +** keyvalue[1] OCTET STRING +** } +*/ +typedef struct krb5_encryptionkey_st + { + ASN1_INTEGER *ktype; + ASN1_OCTET_STRING *keyvalue; + } KRB5_ENCKEY; + +DECLARE_STACK_OF(KRB5_ENCKEY) + + +/* AuthorizationData ::= SEQUENCE OF SEQUENCE { +** ad-type[0] INTEGER, +** ad-data[1] OCTET STRING +** } +*/ +typedef struct krb5_authorization_st + { + ASN1_INTEGER *adtype; + ASN1_OCTET_STRING *addata; + } KRB5_AUTHDATA; + +DECLARE_STACK_OF(KRB5_AUTHDATA) + + +/* -- Unencrypted authenticator +** Authenticator ::= [APPLICATION 2] SEQUENCE { +** authenticator-vno[0] INTEGER, +** crealm[1] Realm, +** cname[2] PrincipalName, +** cksum[3] Checksum OPTIONAL, +** cusec[4] INTEGER, +** ctime[5] KerberosTime, +** subkey[6] EncryptionKey OPTIONAL, +** seq-number[7] INTEGER OPTIONAL, +** authorization-data[8] AuthorizationData OPTIONAL +** } +*/ +typedef struct krb5_authenticator_st + { + ASN1_INTEGER *avno; + ASN1_GENERALSTRING *crealm; + KRB5_PRINCNAME *cname; + KRB5_CHECKSUM *cksum; + ASN1_INTEGER *cusec; + ASN1_GENERALIZEDTIME *ctime; + KRB5_ENCKEY *subkey; + ASN1_INTEGER *seqnum; + KRB5_AUTHDATA *authorization; + } KRB5_AUTHENTBODY; + +typedef STACK_OF(KRB5_AUTHENTBODY) KRB5_AUTHENT; +DECLARE_STACK_OF(KRB5_AUTHENTBODY) + + +/* DECLARE_ASN1_FUNCTIONS(type) = DECLARE_ASN1_FUNCTIONS_name(type, type) = +** type *name##_new(void); +** void name##_free(type *a); +** DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) = +** DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) = +** type *d2i_##name(type **a, const unsigned char **in, long len); +** int i2d_##name(type *a, unsigned char **out); +** DECLARE_ASN1_ITEM(itname) = OPENSSL_EXTERN const ASN1_ITEM itname##_it +*/ + +DECLARE_ASN1_FUNCTIONS(KRB5_ENCDATA) +DECLARE_ASN1_FUNCTIONS(KRB5_PRINCNAME) +DECLARE_ASN1_FUNCTIONS(KRB5_TKTBODY) +DECLARE_ASN1_FUNCTIONS(KRB5_APREQBODY) +DECLARE_ASN1_FUNCTIONS(KRB5_TICKET) +DECLARE_ASN1_FUNCTIONS(KRB5_APREQ) + +DECLARE_ASN1_FUNCTIONS(KRB5_CHECKSUM) +DECLARE_ASN1_FUNCTIONS(KRB5_ENCKEY) +DECLARE_ASN1_FUNCTIONS(KRB5_AUTHDATA) +DECLARE_ASN1_FUNCTIONS(KRB5_AUTHENTBODY) +DECLARE_ASN1_FUNCTIONS(KRB5_AUTHENT) + + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/h/openssl/kssl.h b/h/openssl/kssl.h new file mode 100644 index 0000000..a3d20e1 --- /dev/null +++ b/h/openssl/kssl.h @@ -0,0 +1,179 @@ +/* ssl/kssl.h -*- mode: C; c-file-style: "eay" -*- */ +/* Written by Vern Staats for the OpenSSL project 2000. + * project 2000. + */ +/* ==================================================================== + * Copyright (c) 2000 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +/* +** 19990701 VRS Started. +*/ + +#ifndef KSSL_H +#define KSSL_H + +#include + +#ifndef OPENSSL_NO_KRB5 + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Depending on which KRB5 implementation used, some types from +** the other may be missing. Resolve that here and now +*/ +#ifdef KRB5_HEIMDAL +typedef unsigned char krb5_octet; +#define FAR +#else + +#ifndef FAR +#define FAR +#endif + +#endif + +/* Uncomment this to debug kssl problems or +** to trace usage of the Kerberos session key +** +** #define KSSL_DEBUG +*/ + +#ifndef KRB5SVC +#define KRB5SVC "host" +#endif + +#ifndef KRB5KEYTAB +#define KRB5KEYTAB "/etc/krb5.keytab" +#endif + +#ifndef KRB5SENDAUTH +#define KRB5SENDAUTH 1 +#endif + +#ifndef KRB5CHECKAUTH +#define KRB5CHECKAUTH 1 +#endif + +#ifndef KSSL_CLOCKSKEW +#define KSSL_CLOCKSKEW 300; +#endif + +#define KSSL_ERR_MAX 255 +typedef struct kssl_err_st { + int reason; + char text[KSSL_ERR_MAX+1]; + } KSSL_ERR; + + +/* Context for passing +** (1) Kerberos session key to SSL, and +** (2) Config data between application and SSL lib +*/ +typedef struct kssl_ctx_st + { + /* used by: disposition: */ + char *service_name; /* C,S default ok (kssl) */ + char *service_host; /* C input, REQUIRED */ + char *client_princ; /* S output from krb5 ticket */ + char *keytab_file; /* S NULL (/etc/krb5.keytab) */ + char *cred_cache; /* C NULL (default) */ + krb5_enctype enctype; + int length; + krb5_octet FAR *key; + } KSSL_CTX; + +#define KSSL_CLIENT 1 +#define KSSL_SERVER 2 +#define KSSL_SERVICE 3 +#define KSSL_KEYTAB 4 + +#define KSSL_CTX_OK 0 +#define KSSL_CTX_ERR 1 +#define KSSL_NOMEM 2 + +/* Public (for use by applications that use OpenSSL with Kerberos 5 support */ +krb5_error_code kssl_ctx_setstring(KSSL_CTX *kssl_ctx, int which, char *text); +KSSL_CTX *kssl_ctx_new(void); +KSSL_CTX *kssl_ctx_free(KSSL_CTX *kssl_ctx); +void kssl_ctx_show(KSSL_CTX *kssl_ctx); +krb5_error_code kssl_ctx_setprinc(KSSL_CTX *kssl_ctx, int which, + krb5_data *realm, krb5_data *entity, int nentities); +krb5_error_code kssl_cget_tkt(KSSL_CTX *kssl_ctx, krb5_data **enc_tktp, + krb5_data *authenp, KSSL_ERR *kssl_err); +krb5_error_code kssl_sget_tkt(KSSL_CTX *kssl_ctx, krb5_data *indata, + krb5_ticket_times *ttimes, KSSL_ERR *kssl_err); +krb5_error_code kssl_ctx_setkey(KSSL_CTX *kssl_ctx, krb5_keyblock *session); +void kssl_err_set(KSSL_ERR *kssl_err, int reason, char *text); +void kssl_krb5_free_data_contents(krb5_context context, krb5_data *data); +krb5_error_code kssl_build_principal_2(krb5_context context, + krb5_principal *princ, int rlen, const char *realm, + int slen, const char *svc, int hlen, const char *host); +krb5_error_code kssl_validate_times(krb5_timestamp atime, + krb5_ticket_times *ttimes); +krb5_error_code kssl_check_authent(KSSL_CTX *kssl_ctx, krb5_data *authentp, + krb5_timestamp *atimep, KSSL_ERR *kssl_err); +unsigned char *kssl_skip_confound(krb5_enctype enctype, unsigned char *authn); + +#ifdef __cplusplus +} +#endif +#endif /* OPENSSL_NO_KRB5 */ +#endif /* KSSL_H */ diff --git a/h/openssl/lhash.h b/h/openssl/lhash.h new file mode 100644 index 0000000..d392d0c --- /dev/null +++ b/h/openssl/lhash.h @@ -0,0 +1,200 @@ +/* crypto/lhash/lhash.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* Header for dynamic hash table routines + * Author - Eric Young + */ + +#ifndef HEADER_LHASH_H +#define HEADER_LHASH_H + +#include +#ifndef OPENSSL_NO_FP_API +#include +#endif + +#ifndef OPENSSL_NO_BIO +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct lhash_node_st + { + void *data; + struct lhash_node_st *next; +#ifndef OPENSSL_NO_HASH_COMP + unsigned long hash; +#endif + } LHASH_NODE; + +typedef int (*LHASH_COMP_FN_TYPE)(const void *, const void *); +typedef unsigned long (*LHASH_HASH_FN_TYPE)(const void *); +typedef void (*LHASH_DOALL_FN_TYPE)(void *); +typedef void (*LHASH_DOALL_ARG_FN_TYPE)(void *, void *); + +/* Macros for declaring and implementing type-safe wrappers for LHASH callbacks. + * This way, callbacks can be provided to LHASH structures without function + * pointer casting and the macro-defined callbacks provide per-variable casting + * before deferring to the underlying type-specific callbacks. NB: It is + * possible to place a "static" in front of both the DECLARE and IMPLEMENT + * macros if the functions are strictly internal. */ + +/* First: "hash" functions */ +#define DECLARE_LHASH_HASH_FN(f_name,o_type) \ + unsigned long f_name##_LHASH_HASH(const void *); +#define IMPLEMENT_LHASH_HASH_FN(f_name,o_type) \ + unsigned long f_name##_LHASH_HASH(const void *arg) { \ + o_type a = (o_type)arg; \ + return f_name(a); } +#define LHASH_HASH_FN(f_name) f_name##_LHASH_HASH + +/* Second: "compare" functions */ +#define DECLARE_LHASH_COMP_FN(f_name,o_type) \ + int f_name##_LHASH_COMP(const void *, const void *); +#define IMPLEMENT_LHASH_COMP_FN(f_name,o_type) \ + int f_name##_LHASH_COMP(const void *arg1, const void *arg2) { \ + o_type a = (o_type)arg1; \ + o_type b = (o_type)arg2; \ + return f_name(a,b); } +#define LHASH_COMP_FN(f_name) f_name##_LHASH_COMP + +/* Third: "doall" functions */ +#define DECLARE_LHASH_DOALL_FN(f_name,o_type) \ + void f_name##_LHASH_DOALL(void *); +#define IMPLEMENT_LHASH_DOALL_FN(f_name,o_type) \ + void f_name##_LHASH_DOALL(void *arg) { \ + o_type a = (o_type)arg; \ + f_name(a); } +#define LHASH_DOALL_FN(f_name) f_name##_LHASH_DOALL + +/* Fourth: "doall_arg" functions */ +#define DECLARE_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \ + void f_name##_LHASH_DOALL_ARG(void *, void *); +#define IMPLEMENT_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \ + void f_name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \ + o_type a = (o_type)arg1; \ + a_type b = (a_type)arg2; \ + f_name(a,b); } +#define LHASH_DOALL_ARG_FN(f_name) f_name##_LHASH_DOALL_ARG + +typedef struct lhash_st + { + LHASH_NODE **b; + LHASH_COMP_FN_TYPE comp; + LHASH_HASH_FN_TYPE hash; + unsigned int num_nodes; + unsigned int num_alloc_nodes; + unsigned int p; + unsigned int pmax; + unsigned long up_load; /* load times 256 */ + unsigned long down_load; /* load times 256 */ + unsigned long num_items; + + unsigned long num_expands; + unsigned long num_expand_reallocs; + unsigned long num_contracts; + unsigned long num_contract_reallocs; + unsigned long num_hash_calls; + unsigned long num_comp_calls; + unsigned long num_insert; + unsigned long num_replace; + unsigned long num_delete; + unsigned long num_no_delete; + unsigned long num_retrieve; + unsigned long num_retrieve_miss; + unsigned long num_hash_comps; + + int error; + } LHASH; + +#define LH_LOAD_MULT 256 + +/* Indicates a malloc() error in the last call, this is only bad + * in lh_insert(). */ +#define lh_error(lh) ((lh)->error) + +LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c); +void lh_free(LHASH *lh); +void *lh_insert(LHASH *lh, void *data); +void *lh_delete(LHASH *lh, const void *data); +void *lh_retrieve(LHASH *lh, const void *data); +void lh_doall(LHASH *lh, LHASH_DOALL_FN_TYPE func); +void lh_doall_arg(LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg); +unsigned long lh_strhash(const char *c); +unsigned long lh_num_items(const LHASH *lh); + +#ifndef OPENSSL_NO_FP_API +void lh_stats(const LHASH *lh, FILE *out); +void lh_node_stats(const LHASH *lh, FILE *out); +void lh_node_usage_stats(const LHASH *lh, FILE *out); +#endif + +#ifndef OPENSSL_NO_BIO +void lh_stats_bio(const LHASH *lh, BIO *out); +void lh_node_stats_bio(const LHASH *lh, BIO *out); +void lh_node_usage_stats_bio(const LHASH *lh, BIO *out); +#endif +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/h/openssl/md2.h b/h/openssl/md2.h new file mode 100644 index 0000000..2845ab5 --- /dev/null +++ b/h/openssl/md2.h @@ -0,0 +1,4 @@ +/* Empty file for backward compatibiliy only. + * To use cryptographic primatives, please use EVP API or CCI API. + */ +#include diff --git a/h/openssl/md4.h b/h/openssl/md4.h new file mode 100644 index 0000000..2845ab5 --- /dev/null +++ b/h/openssl/md4.h @@ -0,0 +1,4 @@ +/* Empty file for backward compatibiliy only. + * To use cryptographic primatives, please use EVP API or CCI API. + */ +#include diff --git a/h/openssl/md5.h b/h/openssl/md5.h new file mode 100644 index 0000000..2845ab5 --- /dev/null +++ b/h/openssl/md5.h @@ -0,0 +1,4 @@ +/* Empty file for backward compatibiliy only. + * To use cryptographic primatives, please use EVP API or CCI API. + */ +#include diff --git a/h/openssl/obj_mac.h b/h/openssl/obj_mac.h new file mode 100644 index 0000000..7cdd694 --- /dev/null +++ b/h/openssl/obj_mac.h @@ -0,0 +1,3305 @@ +/* crypto/objects/obj_mac.h */ + +/* THIS FILE IS GENERATED FROM objects.txt by objects.pl via the + * following command: + * perl objects.pl objects.txt obj_mac.num obj_mac.h + */ + +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#define SN_undef "UNDEF" +#define LN_undef "undefined" +#define NID_undef 0 +#define OBJ_undef 0L + +#define SN_itu_t "ITU-T" +#define LN_itu_t "itu-t" +#define NID_itu_t 645 +#define OBJ_itu_t 0L + +#define NID_ccitt 404 +#define OBJ_ccitt OBJ_itu_t + +#define SN_iso "ISO" +#define LN_iso "iso" +#define NID_iso 181 +#define OBJ_iso 1L + +#define SN_joint_iso_itu_t "JOINT-ISO-ITU-T" +#define LN_joint_iso_itu_t "joint-iso-itu-t" +#define NID_joint_iso_itu_t 646 +#define OBJ_joint_iso_itu_t 2L + +#define NID_joint_iso_ccitt 393 +#define OBJ_joint_iso_ccitt OBJ_joint_iso_itu_t + +#define SN_member_body "member-body" +#define LN_member_body "ISO Member Body" +#define NID_member_body 182 +#define OBJ_member_body OBJ_iso,2L + +#define SN_identified_organization "identified-organization" +#define NID_identified_organization 676 +#define OBJ_identified_organization OBJ_iso,3L + +#define SN_certicom_arc "certicom-arc" +#define NID_certicom_arc 677 +#define OBJ_certicom_arc OBJ_identified_organization,132L + +#define SN_international_organizations "international-organizations" +#define LN_international_organizations "International Organizations" +#define NID_international_organizations 647 +#define OBJ_international_organizations OBJ_joint_iso_itu_t,23L + +#define SN_wap "wap" +#define NID_wap 678 +#define OBJ_wap OBJ_international_organizations,43L + +#define SN_wap_wsg "wap-wsg" +#define NID_wap_wsg 679 +#define OBJ_wap_wsg OBJ_wap,13L + +#define SN_selected_attribute_types "selected-attribute-types" +#define LN_selected_attribute_types "Selected Attribute Types" +#define NID_selected_attribute_types 394 +#define OBJ_selected_attribute_types OBJ_joint_iso_itu_t,5L,1L,5L + +#define SN_clearance "clearance" +#define NID_clearance 395 +#define OBJ_clearance OBJ_selected_attribute_types,55L + +#define SN_ISO_US "ISO-US" +#define LN_ISO_US "ISO US Member Body" +#define NID_ISO_US 183 +#define OBJ_ISO_US OBJ_member_body,840L + +#define SN_X9_57 "X9-57" +#define LN_X9_57 "X9.57" +#define NID_X9_57 184 +#define OBJ_X9_57 OBJ_ISO_US,10040L + +#define SN_X9cm "X9cm" +#define LN_X9cm "X9.57 CM ?" +#define NID_X9cm 185 +#define OBJ_X9cm OBJ_X9_57,4L + +#define SN_dsa "DSA" +#define LN_dsa "dsaEncryption" +#define NID_dsa 116 +#define OBJ_dsa OBJ_X9cm,1L + +#define SN_dsaWithSHA1 "DSA-SHA1" +#define LN_dsaWithSHA1 "dsaWithSHA1" +#define NID_dsaWithSHA1 113 +#define OBJ_dsaWithSHA1 OBJ_X9cm,3L + +#define SN_ansi_X9_62 "ansi-X9-62" +#define LN_ansi_X9_62 "ANSI X9.62" +#define NID_ansi_X9_62 405 +#define OBJ_ansi_X9_62 OBJ_ISO_US,10045L + +#define OBJ_X9_62_id_fieldType OBJ_ansi_X9_62,1L + +#define SN_X9_62_prime_field "prime-field" +#define NID_X9_62_prime_field 406 +#define OBJ_X9_62_prime_field OBJ_X9_62_id_fieldType,1L + +#define SN_X9_62_characteristic_two_field "characteristic-two-field" +#define NID_X9_62_characteristic_two_field 407 +#define OBJ_X9_62_characteristic_two_field OBJ_X9_62_id_fieldType,2L + +#define SN_X9_62_id_characteristic_two_basis "id-characteristic-two-basis" +#define NID_X9_62_id_characteristic_two_basis 680 +#define OBJ_X9_62_id_characteristic_two_basis OBJ_X9_62_characteristic_two_field,3L + +#define SN_X9_62_onBasis "onBasis" +#define NID_X9_62_onBasis 681 +#define OBJ_X9_62_onBasis OBJ_X9_62_id_characteristic_two_basis,1L + +#define SN_X9_62_tpBasis "tpBasis" +#define NID_X9_62_tpBasis 682 +#define OBJ_X9_62_tpBasis OBJ_X9_62_id_characteristic_two_basis,2L + +#define SN_X9_62_ppBasis "ppBasis" +#define NID_X9_62_ppBasis 683 +#define OBJ_X9_62_ppBasis OBJ_X9_62_id_characteristic_two_basis,3L + +#define OBJ_X9_62_id_publicKeyType OBJ_ansi_X9_62,2L + +#define SN_X9_62_id_ecPublicKey "id-ecPublicKey" +#define NID_X9_62_id_ecPublicKey 408 +#define OBJ_X9_62_id_ecPublicKey OBJ_X9_62_id_publicKeyType,1L + +#define OBJ_X9_62_ellipticCurve OBJ_ansi_X9_62,3L + +#define OBJ_X9_62_c_TwoCurve OBJ_X9_62_ellipticCurve,0L + +#define SN_X9_62_c2pnb163v1 "c2pnb163v1" +#define NID_X9_62_c2pnb163v1 684 +#define OBJ_X9_62_c2pnb163v1 OBJ_X9_62_c_TwoCurve,1L + +#define SN_X9_62_c2pnb163v2 "c2pnb163v2" +#define NID_X9_62_c2pnb163v2 685 +#define OBJ_X9_62_c2pnb163v2 OBJ_X9_62_c_TwoCurve,2L + +#define SN_X9_62_c2pnb163v3 "c2pnb163v3" +#define NID_X9_62_c2pnb163v3 686 +#define OBJ_X9_62_c2pnb163v3 OBJ_X9_62_c_TwoCurve,3L + +#define SN_X9_62_c2pnb176v1 "c2pnb176v1" +#define NID_X9_62_c2pnb176v1 687 +#define OBJ_X9_62_c2pnb176v1 OBJ_X9_62_c_TwoCurve,4L + +#define SN_X9_62_c2tnb191v1 "c2tnb191v1" +#define NID_X9_62_c2tnb191v1 688 +#define OBJ_X9_62_c2tnb191v1 OBJ_X9_62_c_TwoCurve,5L + +#define SN_X9_62_c2tnb191v2 "c2tnb191v2" +#define NID_X9_62_c2tnb191v2 689 +#define OBJ_X9_62_c2tnb191v2 OBJ_X9_62_c_TwoCurve,6L + +#define SN_X9_62_c2tnb191v3 "c2tnb191v3" +#define NID_X9_62_c2tnb191v3 690 +#define OBJ_X9_62_c2tnb191v3 OBJ_X9_62_c_TwoCurve,7L + +#define SN_X9_62_c2onb191v4 "c2onb191v4" +#define NID_X9_62_c2onb191v4 691 +#define OBJ_X9_62_c2onb191v4 OBJ_X9_62_c_TwoCurve,8L + +#define SN_X9_62_c2onb191v5 "c2onb191v5" +#define NID_X9_62_c2onb191v5 692 +#define OBJ_X9_62_c2onb191v5 OBJ_X9_62_c_TwoCurve,9L + +#define SN_X9_62_c2pnb208w1 "c2pnb208w1" +#define NID_X9_62_c2pnb208w1 693 +#define OBJ_X9_62_c2pnb208w1 OBJ_X9_62_c_TwoCurve,10L + +#define SN_X9_62_c2tnb239v1 "c2tnb239v1" +#define NID_X9_62_c2tnb239v1 694 +#define OBJ_X9_62_c2tnb239v1 OBJ_X9_62_c_TwoCurve,11L + +#define SN_X9_62_c2tnb239v2 "c2tnb239v2" +#define NID_X9_62_c2tnb239v2 695 +#define OBJ_X9_62_c2tnb239v2 OBJ_X9_62_c_TwoCurve,12L + +#define SN_X9_62_c2tnb239v3 "c2tnb239v3" +#define NID_X9_62_c2tnb239v3 696 +#define OBJ_X9_62_c2tnb239v3 OBJ_X9_62_c_TwoCurve,13L + +#define SN_X9_62_c2onb239v4 "c2onb239v4" +#define NID_X9_62_c2onb239v4 697 +#define OBJ_X9_62_c2onb239v4 OBJ_X9_62_c_TwoCurve,14L + +#define SN_X9_62_c2onb239v5 "c2onb239v5" +#define NID_X9_62_c2onb239v5 698 +#define OBJ_X9_62_c2onb239v5 OBJ_X9_62_c_TwoCurve,15L + +#define SN_X9_62_c2pnb272w1 "c2pnb272w1" +#define NID_X9_62_c2pnb272w1 699 +#define OBJ_X9_62_c2pnb272w1 OBJ_X9_62_c_TwoCurve,16L + +#define SN_X9_62_c2pnb304w1 "c2pnb304w1" +#define NID_X9_62_c2pnb304w1 700 +#define OBJ_X9_62_c2pnb304w1 OBJ_X9_62_c_TwoCurve,17L + +#define SN_X9_62_c2tnb359v1 "c2tnb359v1" +#define NID_X9_62_c2tnb359v1 701 +#define OBJ_X9_62_c2tnb359v1 OBJ_X9_62_c_TwoCurve,18L + +#define SN_X9_62_c2pnb368w1 "c2pnb368w1" +#define NID_X9_62_c2pnb368w1 702 +#define OBJ_X9_62_c2pnb368w1 OBJ_X9_62_c_TwoCurve,19L + +#define SN_X9_62_c2tnb431r1 "c2tnb431r1" +#define NID_X9_62_c2tnb431r1 703 +#define OBJ_X9_62_c2tnb431r1 OBJ_X9_62_c_TwoCurve,20L + +#define OBJ_X9_62_primeCurve OBJ_X9_62_ellipticCurve,1L + +#define SN_X9_62_prime192v1 "prime192v1" +#define NID_X9_62_prime192v1 409 +#define OBJ_X9_62_prime192v1 OBJ_X9_62_primeCurve,1L + +#define SN_X9_62_prime192v2 "prime192v2" +#define NID_X9_62_prime192v2 410 +#define OBJ_X9_62_prime192v2 OBJ_X9_62_primeCurve,2L + +#define SN_X9_62_prime192v3 "prime192v3" +#define NID_X9_62_prime192v3 411 +#define OBJ_X9_62_prime192v3 OBJ_X9_62_primeCurve,3L + +#define SN_X9_62_prime239v1 "prime239v1" +#define NID_X9_62_prime239v1 412 +#define OBJ_X9_62_prime239v1 OBJ_X9_62_primeCurve,4L + +#define SN_X9_62_prime239v2 "prime239v2" +#define NID_X9_62_prime239v2 413 +#define OBJ_X9_62_prime239v2 OBJ_X9_62_primeCurve,5L + +#define SN_X9_62_prime239v3 "prime239v3" +#define NID_X9_62_prime239v3 414 +#define OBJ_X9_62_prime239v3 OBJ_X9_62_primeCurve,6L + +#define SN_X9_62_prime256v1 "prime256v1" +#define NID_X9_62_prime256v1 415 +#define OBJ_X9_62_prime256v1 OBJ_X9_62_primeCurve,7L + +#define OBJ_X9_62_id_ecSigType OBJ_ansi_X9_62,4L + +#define SN_ecdsa_with_SHA1 "ecdsa-with-SHA1" +#define NID_ecdsa_with_SHA1 416 +#define OBJ_ecdsa_with_SHA1 OBJ_X9_62_id_ecSigType,1L + +#define OBJ_secg_ellipticCurve OBJ_certicom_arc,0L + +#define SN_secp112r1 "secp112r1" +#define NID_secp112r1 704 +#define OBJ_secp112r1 OBJ_secg_ellipticCurve,6L + +#define SN_secp112r2 "secp112r2" +#define NID_secp112r2 705 +#define OBJ_secp112r2 OBJ_secg_ellipticCurve,7L + +#define SN_secp128r1 "secp128r1" +#define NID_secp128r1 706 +#define OBJ_secp128r1 OBJ_secg_ellipticCurve,28L + +#define SN_secp128r2 "secp128r2" +#define NID_secp128r2 707 +#define OBJ_secp128r2 OBJ_secg_ellipticCurve,29L + +#define SN_secp160k1 "secp160k1" +#define NID_secp160k1 708 +#define OBJ_secp160k1 OBJ_secg_ellipticCurve,9L + +#define SN_secp160r1 "secp160r1" +#define NID_secp160r1 709 +#define OBJ_secp160r1 OBJ_secg_ellipticCurve,8L + +#define SN_secp160r2 "secp160r2" +#define NID_secp160r2 710 +#define OBJ_secp160r2 OBJ_secg_ellipticCurve,30L + +#define SN_secp192k1 "secp192k1" +#define NID_secp192k1 711 +#define OBJ_secp192k1 OBJ_secg_ellipticCurve,31L + +#define SN_secp224k1 "secp224k1" +#define NID_secp224k1 712 +#define OBJ_secp224k1 OBJ_secg_ellipticCurve,32L + +#define SN_secp224r1 "secp224r1" +#define NID_secp224r1 713 +#define OBJ_secp224r1 OBJ_secg_ellipticCurve,33L + +#define SN_secp256k1 "secp256k1" +#define NID_secp256k1 714 +#define OBJ_secp256k1 OBJ_secg_ellipticCurve,10L + +#define SN_secp384r1 "secp384r1" +#define NID_secp384r1 715 +#define OBJ_secp384r1 OBJ_secg_ellipticCurve,34L + +#define SN_secp521r1 "secp521r1" +#define NID_secp521r1 716 +#define OBJ_secp521r1 OBJ_secg_ellipticCurve,35L + +#define SN_sect113r1 "sect113r1" +#define NID_sect113r1 717 +#define OBJ_sect113r1 OBJ_secg_ellipticCurve,4L + +#define SN_sect113r2 "sect113r2" +#define NID_sect113r2 718 +#define OBJ_sect113r2 OBJ_secg_ellipticCurve,5L + +#define SN_sect131r1 "sect131r1" +#define NID_sect131r1 719 +#define OBJ_sect131r1 OBJ_secg_ellipticCurve,22L + +#define SN_sect131r2 "sect131r2" +#define NID_sect131r2 720 +#define OBJ_sect131r2 OBJ_secg_ellipticCurve,23L + +#define SN_sect163k1 "sect163k1" +#define NID_sect163k1 721 +#define OBJ_sect163k1 OBJ_secg_ellipticCurve,1L + +#define SN_sect163r1 "sect163r1" +#define NID_sect163r1 722 +#define OBJ_sect163r1 OBJ_secg_ellipticCurve,2L + +#define SN_sect163r2 "sect163r2" +#define NID_sect163r2 723 +#define OBJ_sect163r2 OBJ_secg_ellipticCurve,15L + +#define SN_sect193r1 "sect193r1" +#define NID_sect193r1 724 +#define OBJ_sect193r1 OBJ_secg_ellipticCurve,24L + +#define SN_sect193r2 "sect193r2" +#define NID_sect193r2 725 +#define OBJ_sect193r2 OBJ_secg_ellipticCurve,25L + +#define SN_sect233k1 "sect233k1" +#define NID_sect233k1 726 +#define OBJ_sect233k1 OBJ_secg_ellipticCurve,26L + +#define SN_sect233r1 "sect233r1" +#define NID_sect233r1 727 +#define OBJ_sect233r1 OBJ_secg_ellipticCurve,27L + +#define SN_sect239k1 "sect239k1" +#define NID_sect239k1 728 +#define OBJ_sect239k1 OBJ_secg_ellipticCurve,3L + +#define SN_sect283k1 "sect283k1" +#define NID_sect283k1 729 +#define OBJ_sect283k1 OBJ_secg_ellipticCurve,16L + +#define SN_sect283r1 "sect283r1" +#define NID_sect283r1 730 +#define OBJ_sect283r1 OBJ_secg_ellipticCurve,17L + +#define SN_sect409k1 "sect409k1" +#define NID_sect409k1 731 +#define OBJ_sect409k1 OBJ_secg_ellipticCurve,36L + +#define SN_sect409r1 "sect409r1" +#define NID_sect409r1 732 +#define OBJ_sect409r1 OBJ_secg_ellipticCurve,37L + +#define SN_sect571k1 "sect571k1" +#define NID_sect571k1 733 +#define OBJ_sect571k1 OBJ_secg_ellipticCurve,38L + +#define SN_sect571r1 "sect571r1" +#define NID_sect571r1 734 +#define OBJ_sect571r1 OBJ_secg_ellipticCurve,39L + +#define OBJ_wap_wsg_idm_ecid OBJ_wap_wsg,4L + +#define SN_wap_wsg_idm_ecid_wtls1 "wap-wsg-idm-ecid-wtls1" +#define NID_wap_wsg_idm_ecid_wtls1 735 +#define OBJ_wap_wsg_idm_ecid_wtls1 OBJ_wap_wsg_idm_ecid,1L + +#define SN_wap_wsg_idm_ecid_wtls3 "wap-wsg-idm-ecid-wtls3" +#define NID_wap_wsg_idm_ecid_wtls3 736 +#define OBJ_wap_wsg_idm_ecid_wtls3 OBJ_wap_wsg_idm_ecid,3L + +#define SN_wap_wsg_idm_ecid_wtls4 "wap-wsg-idm-ecid-wtls4" +#define NID_wap_wsg_idm_ecid_wtls4 737 +#define OBJ_wap_wsg_idm_ecid_wtls4 OBJ_wap_wsg_idm_ecid,4L + +#define SN_wap_wsg_idm_ecid_wtls5 "wap-wsg-idm-ecid-wtls5" +#define NID_wap_wsg_idm_ecid_wtls5 738 +#define OBJ_wap_wsg_idm_ecid_wtls5 OBJ_wap_wsg_idm_ecid,5L + +#define SN_wap_wsg_idm_ecid_wtls6 "wap-wsg-idm-ecid-wtls6" +#define NID_wap_wsg_idm_ecid_wtls6 739 +#define OBJ_wap_wsg_idm_ecid_wtls6 OBJ_wap_wsg_idm_ecid,6L + +#define SN_wap_wsg_idm_ecid_wtls7 "wap-wsg-idm-ecid-wtls7" +#define NID_wap_wsg_idm_ecid_wtls7 740 +#define OBJ_wap_wsg_idm_ecid_wtls7 OBJ_wap_wsg_idm_ecid,7L + +#define SN_wap_wsg_idm_ecid_wtls8 "wap-wsg-idm-ecid-wtls8" +#define NID_wap_wsg_idm_ecid_wtls8 741 +#define OBJ_wap_wsg_idm_ecid_wtls8 OBJ_wap_wsg_idm_ecid,8L + +#define SN_wap_wsg_idm_ecid_wtls9 "wap-wsg-idm-ecid-wtls9" +#define NID_wap_wsg_idm_ecid_wtls9 742 +#define OBJ_wap_wsg_idm_ecid_wtls9 OBJ_wap_wsg_idm_ecid,9L + +#define SN_wap_wsg_idm_ecid_wtls10 "wap-wsg-idm-ecid-wtls10" +#define NID_wap_wsg_idm_ecid_wtls10 743 +#define OBJ_wap_wsg_idm_ecid_wtls10 OBJ_wap_wsg_idm_ecid,10L + +#define SN_wap_wsg_idm_ecid_wtls11 "wap-wsg-idm-ecid-wtls11" +#define NID_wap_wsg_idm_ecid_wtls11 744 +#define OBJ_wap_wsg_idm_ecid_wtls11 OBJ_wap_wsg_idm_ecid,11L + +#define SN_wap_wsg_idm_ecid_wtls12 "wap-wsg-idm-ecid-wtls12" +#define NID_wap_wsg_idm_ecid_wtls12 745 +#define OBJ_wap_wsg_idm_ecid_wtls12 OBJ_wap_wsg_idm_ecid,12L + +#define SN_cast5_cbc "CAST5-CBC" +#define LN_cast5_cbc "cast5-cbc" +#define NID_cast5_cbc 108 +#define OBJ_cast5_cbc OBJ_ISO_US,113533L,7L,66L,10L + +#define SN_cast5_ecb "CAST5-ECB" +#define LN_cast5_ecb "cast5-ecb" +#define NID_cast5_ecb 109 + +#define SN_cast5_cfb64 "CAST5-CFB" +#define LN_cast5_cfb64 "cast5-cfb" +#define NID_cast5_cfb64 110 + +#define SN_cast5_ofb64 "CAST5-OFB" +#define LN_cast5_ofb64 "cast5-ofb" +#define NID_cast5_ofb64 111 + +#define LN_pbeWithMD5AndCast5_CBC "pbeWithMD5AndCast5CBC" +#define NID_pbeWithMD5AndCast5_CBC 112 +#define OBJ_pbeWithMD5AndCast5_CBC OBJ_ISO_US,113533L,7L,66L,12L + +#define SN_rsadsi "rsadsi" +#define LN_rsadsi "RSA Data Security, Inc." +#define NID_rsadsi 1 +#define OBJ_rsadsi OBJ_ISO_US,113549L + +#define SN_pkcs "pkcs" +#define LN_pkcs "RSA Data Security, Inc. PKCS" +#define NID_pkcs 2 +#define OBJ_pkcs OBJ_rsadsi,1L + +#define SN_pkcs1 "pkcs1" +#define NID_pkcs1 186 +#define OBJ_pkcs1 OBJ_pkcs,1L + +#define LN_rsaEncryption "rsaEncryption" +#define NID_rsaEncryption 6 +#define OBJ_rsaEncryption OBJ_pkcs1,1L + +#define SN_md2WithRSAEncryption "RSA-MD2" +#define LN_md2WithRSAEncryption "md2WithRSAEncryption" +#define NID_md2WithRSAEncryption 7 +#define OBJ_md2WithRSAEncryption OBJ_pkcs1,2L + +#define SN_md4WithRSAEncryption "RSA-MD4" +#define LN_md4WithRSAEncryption "md4WithRSAEncryption" +#define NID_md4WithRSAEncryption 396 +#define OBJ_md4WithRSAEncryption OBJ_pkcs1,3L + +#define SN_md5WithRSAEncryption "RSA-MD5" +#define LN_md5WithRSAEncryption "md5WithRSAEncryption" +#define NID_md5WithRSAEncryption 8 +#define OBJ_md5WithRSAEncryption OBJ_pkcs1,4L + +#define SN_sha1WithRSAEncryption "RSA-SHA1" +#define LN_sha1WithRSAEncryption "sha1WithRSAEncryption" +#define NID_sha1WithRSAEncryption 65 +#define OBJ_sha1WithRSAEncryption OBJ_pkcs1,5L + +#define SN_sha256WithRSAEncryption "RSA-SHA256" +#define LN_sha256WithRSAEncryption "sha256WithRSAEncryption" +#define NID_sha256WithRSAEncryption 668 +#define OBJ_sha256WithRSAEncryption OBJ_pkcs1,11L + +#define SN_sha384WithRSAEncryption "RSA-SHA384" +#define LN_sha384WithRSAEncryption "sha384WithRSAEncryption" +#define NID_sha384WithRSAEncryption 669 +#define OBJ_sha384WithRSAEncryption OBJ_pkcs1,12L + +#define SN_sha512WithRSAEncryption "RSA-SHA512" +#define LN_sha512WithRSAEncryption "sha512WithRSAEncryption" +#define NID_sha512WithRSAEncryption 670 +#define OBJ_sha512WithRSAEncryption OBJ_pkcs1,13L + +#define SN_sha224WithRSAEncryption "RSA-SHA224" +#define LN_sha224WithRSAEncryption "sha224WithRSAEncryption" +#define NID_sha224WithRSAEncryption 671 +#define OBJ_sha224WithRSAEncryption OBJ_pkcs1,14L + +#define SN_pkcs3 "pkcs3" +#define NID_pkcs3 27 +#define OBJ_pkcs3 OBJ_pkcs,3L + +#define LN_dhKeyAgreement "dhKeyAgreement" +#define NID_dhKeyAgreement 28 +#define OBJ_dhKeyAgreement OBJ_pkcs3,1L + +#define SN_pkcs5 "pkcs5" +#define NID_pkcs5 187 +#define OBJ_pkcs5 OBJ_pkcs,5L + +#define SN_pbeWithMD2AndDES_CBC "PBE-MD2-DES" +#define LN_pbeWithMD2AndDES_CBC "pbeWithMD2AndDES-CBC" +#define NID_pbeWithMD2AndDES_CBC 9 +#define OBJ_pbeWithMD2AndDES_CBC OBJ_pkcs5,1L + +#define SN_pbeWithMD5AndDES_CBC "PBE-MD5-DES" +#define LN_pbeWithMD5AndDES_CBC "pbeWithMD5AndDES-CBC" +#define NID_pbeWithMD5AndDES_CBC 10 +#define OBJ_pbeWithMD5AndDES_CBC OBJ_pkcs5,3L + +#define SN_pbeWithMD2AndRC2_CBC "PBE-MD2-RC2-64" +#define LN_pbeWithMD2AndRC2_CBC "pbeWithMD2AndRC2-CBC" +#define NID_pbeWithMD2AndRC2_CBC 168 +#define OBJ_pbeWithMD2AndRC2_CBC OBJ_pkcs5,4L + +#define SN_pbeWithMD5AndRC2_CBC "PBE-MD5-RC2-64" +#define LN_pbeWithMD5AndRC2_CBC "pbeWithMD5AndRC2-CBC" +#define NID_pbeWithMD5AndRC2_CBC 169 +#define OBJ_pbeWithMD5AndRC2_CBC OBJ_pkcs5,6L + +#define SN_pbeWithSHA1AndDES_CBC "PBE-SHA1-DES" +#define LN_pbeWithSHA1AndDES_CBC "pbeWithSHA1AndDES-CBC" +#define NID_pbeWithSHA1AndDES_CBC 170 +#define OBJ_pbeWithSHA1AndDES_CBC OBJ_pkcs5,10L + +#define SN_pbeWithSHA1AndRC2_CBC "PBE-SHA1-RC2-64" +#define LN_pbeWithSHA1AndRC2_CBC "pbeWithSHA1AndRC2-CBC" +#define NID_pbeWithSHA1AndRC2_CBC 68 +#define OBJ_pbeWithSHA1AndRC2_CBC OBJ_pkcs5,11L + +#define LN_id_pbkdf2 "PBKDF2" +#define NID_id_pbkdf2 69 +#define OBJ_id_pbkdf2 OBJ_pkcs5,12L + +#define LN_pbes2 "PBES2" +#define NID_pbes2 161 +#define OBJ_pbes2 OBJ_pkcs5,13L + +#define LN_pbmac1 "PBMAC1" +#define NID_pbmac1 162 +#define OBJ_pbmac1 OBJ_pkcs5,14L + +#define SN_pkcs7 "pkcs7" +#define NID_pkcs7 20 +#define OBJ_pkcs7 OBJ_pkcs,7L + +#define LN_pkcs7_data "pkcs7-data" +#define NID_pkcs7_data 21 +#define OBJ_pkcs7_data OBJ_pkcs7,1L + +#define LN_pkcs7_signed "pkcs7-signedData" +#define NID_pkcs7_signed 22 +#define OBJ_pkcs7_signed OBJ_pkcs7,2L + +#define LN_pkcs7_enveloped "pkcs7-envelopedData" +#define NID_pkcs7_enveloped 23 +#define OBJ_pkcs7_enveloped OBJ_pkcs7,3L + +#define LN_pkcs7_signedAndEnveloped "pkcs7-signedAndEnvelopedData" +#define NID_pkcs7_signedAndEnveloped 24 +#define OBJ_pkcs7_signedAndEnveloped OBJ_pkcs7,4L + +#define LN_pkcs7_digest "pkcs7-digestData" +#define NID_pkcs7_digest 25 +#define OBJ_pkcs7_digest OBJ_pkcs7,5L + +#define LN_pkcs7_encrypted "pkcs7-encryptedData" +#define NID_pkcs7_encrypted 26 +#define OBJ_pkcs7_encrypted OBJ_pkcs7,6L + +#define SN_pkcs9 "pkcs9" +#define NID_pkcs9 47 +#define OBJ_pkcs9 OBJ_pkcs,9L + +#define LN_pkcs9_emailAddress "emailAddress" +#define NID_pkcs9_emailAddress 48 +#define OBJ_pkcs9_emailAddress OBJ_pkcs9,1L + +#define LN_pkcs9_unstructuredName "unstructuredName" +#define NID_pkcs9_unstructuredName 49 +#define OBJ_pkcs9_unstructuredName OBJ_pkcs9,2L + +#define LN_pkcs9_contentType "contentType" +#define NID_pkcs9_contentType 50 +#define OBJ_pkcs9_contentType OBJ_pkcs9,3L + +#define LN_pkcs9_messageDigest "messageDigest" +#define NID_pkcs9_messageDigest 51 +#define OBJ_pkcs9_messageDigest OBJ_pkcs9,4L + +#define LN_pkcs9_signingTime "signingTime" +#define NID_pkcs9_signingTime 52 +#define OBJ_pkcs9_signingTime OBJ_pkcs9,5L + +#define LN_pkcs9_countersignature "countersignature" +#define NID_pkcs9_countersignature 53 +#define OBJ_pkcs9_countersignature OBJ_pkcs9,6L + +#define LN_pkcs9_challengePassword "challengePassword" +#define NID_pkcs9_challengePassword 54 +#define OBJ_pkcs9_challengePassword OBJ_pkcs9,7L + +#define LN_pkcs9_unstructuredAddress "unstructuredAddress" +#define NID_pkcs9_unstructuredAddress 55 +#define OBJ_pkcs9_unstructuredAddress OBJ_pkcs9,8L + +#define LN_pkcs9_extCertAttributes "extendedCertificateAttributes" +#define NID_pkcs9_extCertAttributes 56 +#define OBJ_pkcs9_extCertAttributes OBJ_pkcs9,9L + +#define SN_ext_req "extReq" +#define LN_ext_req "Extension Request" +#define NID_ext_req 172 +#define OBJ_ext_req OBJ_pkcs9,14L + +#define SN_SMIMECapabilities "SMIME-CAPS" +#define LN_SMIMECapabilities "S/MIME Capabilities" +#define NID_SMIMECapabilities 167 +#define OBJ_SMIMECapabilities OBJ_pkcs9,15L + +#define SN_SMIME "SMIME" +#define LN_SMIME "S/MIME" +#define NID_SMIME 188 +#define OBJ_SMIME OBJ_pkcs9,16L + +#define SN_id_smime_mod "id-smime-mod" +#define NID_id_smime_mod 189 +#define OBJ_id_smime_mod OBJ_SMIME,0L + +#define SN_id_smime_ct "id-smime-ct" +#define NID_id_smime_ct 190 +#define OBJ_id_smime_ct OBJ_SMIME,1L + +#define SN_id_smime_aa "id-smime-aa" +#define NID_id_smime_aa 191 +#define OBJ_id_smime_aa OBJ_SMIME,2L + +#define SN_id_smime_alg "id-smime-alg" +#define NID_id_smime_alg 192 +#define OBJ_id_smime_alg OBJ_SMIME,3L + +#define SN_id_smime_cd "id-smime-cd" +#define NID_id_smime_cd 193 +#define OBJ_id_smime_cd OBJ_SMIME,4L + +#define SN_id_smime_spq "id-smime-spq" +#define NID_id_smime_spq 194 +#define OBJ_id_smime_spq OBJ_SMIME,5L + +#define SN_id_smime_cti "id-smime-cti" +#define NID_id_smime_cti 195 +#define OBJ_id_smime_cti OBJ_SMIME,6L + +#define SN_id_smime_mod_cms "id-smime-mod-cms" +#define NID_id_smime_mod_cms 196 +#define OBJ_id_smime_mod_cms OBJ_id_smime_mod,1L + +#define SN_id_smime_mod_ess "id-smime-mod-ess" +#define NID_id_smime_mod_ess 197 +#define OBJ_id_smime_mod_ess OBJ_id_smime_mod,2L + +#define SN_id_smime_mod_oid "id-smime-mod-oid" +#define NID_id_smime_mod_oid 198 +#define OBJ_id_smime_mod_oid OBJ_id_smime_mod,3L + +#define SN_id_smime_mod_msg_v3 "id-smime-mod-msg-v3" +#define NID_id_smime_mod_msg_v3 199 +#define OBJ_id_smime_mod_msg_v3 OBJ_id_smime_mod,4L + +#define SN_id_smime_mod_ets_eSignature_88 "id-smime-mod-ets-eSignature-88" +#define NID_id_smime_mod_ets_eSignature_88 200 +#define OBJ_id_smime_mod_ets_eSignature_88 OBJ_id_smime_mod,5L + +#define SN_id_smime_mod_ets_eSignature_97 "id-smime-mod-ets-eSignature-97" +#define NID_id_smime_mod_ets_eSignature_97 201 +#define OBJ_id_smime_mod_ets_eSignature_97 OBJ_id_smime_mod,6L + +#define SN_id_smime_mod_ets_eSigPolicy_88 "id-smime-mod-ets-eSigPolicy-88" +#define NID_id_smime_mod_ets_eSigPolicy_88 202 +#define OBJ_id_smime_mod_ets_eSigPolicy_88 OBJ_id_smime_mod,7L + +#define SN_id_smime_mod_ets_eSigPolicy_97 "id-smime-mod-ets-eSigPolicy-97" +#define NID_id_smime_mod_ets_eSigPolicy_97 203 +#define OBJ_id_smime_mod_ets_eSigPolicy_97 OBJ_id_smime_mod,8L + +#define SN_id_smime_ct_receipt "id-smime-ct-receipt" +#define NID_id_smime_ct_receipt 204 +#define OBJ_id_smime_ct_receipt OBJ_id_smime_ct,1L + +#define SN_id_smime_ct_authData "id-smime-ct-authData" +#define NID_id_smime_ct_authData 205 +#define OBJ_id_smime_ct_authData OBJ_id_smime_ct,2L + +#define SN_id_smime_ct_publishCert "id-smime-ct-publishCert" +#define NID_id_smime_ct_publishCert 206 +#define OBJ_id_smime_ct_publishCert OBJ_id_smime_ct,3L + +#define SN_id_smime_ct_TSTInfo "id-smime-ct-TSTInfo" +#define NID_id_smime_ct_TSTInfo 207 +#define OBJ_id_smime_ct_TSTInfo OBJ_id_smime_ct,4L + +#define SN_id_smime_ct_TDTInfo "id-smime-ct-TDTInfo" +#define NID_id_smime_ct_TDTInfo 208 +#define OBJ_id_smime_ct_TDTInfo OBJ_id_smime_ct,5L + +#define SN_id_smime_ct_contentInfo "id-smime-ct-contentInfo" +#define NID_id_smime_ct_contentInfo 209 +#define OBJ_id_smime_ct_contentInfo OBJ_id_smime_ct,6L + +#define SN_id_smime_ct_DVCSRequestData "id-smime-ct-DVCSRequestData" +#define NID_id_smime_ct_DVCSRequestData 210 +#define OBJ_id_smime_ct_DVCSRequestData OBJ_id_smime_ct,7L + +#define SN_id_smime_ct_DVCSResponseData "id-smime-ct-DVCSResponseData" +#define NID_id_smime_ct_DVCSResponseData 211 +#define OBJ_id_smime_ct_DVCSResponseData OBJ_id_smime_ct,8L + +#define SN_id_smime_aa_receiptRequest "id-smime-aa-receiptRequest" +#define NID_id_smime_aa_receiptRequest 212 +#define OBJ_id_smime_aa_receiptRequest OBJ_id_smime_aa,1L + +#define SN_id_smime_aa_securityLabel "id-smime-aa-securityLabel" +#define NID_id_smime_aa_securityLabel 213 +#define OBJ_id_smime_aa_securityLabel OBJ_id_smime_aa,2L + +#define SN_id_smime_aa_mlExpandHistory "id-smime-aa-mlExpandHistory" +#define NID_id_smime_aa_mlExpandHistory 214 +#define OBJ_id_smime_aa_mlExpandHistory OBJ_id_smime_aa,3L + +#define SN_id_smime_aa_contentHint "id-smime-aa-contentHint" +#define NID_id_smime_aa_contentHint 215 +#define OBJ_id_smime_aa_contentHint OBJ_id_smime_aa,4L + +#define SN_id_smime_aa_msgSigDigest "id-smime-aa-msgSigDigest" +#define NID_id_smime_aa_msgSigDigest 216 +#define OBJ_id_smime_aa_msgSigDigest OBJ_id_smime_aa,5L + +#define SN_id_smime_aa_encapContentType "id-smime-aa-encapContentType" +#define NID_id_smime_aa_encapContentType 217 +#define OBJ_id_smime_aa_encapContentType OBJ_id_smime_aa,6L + +#define SN_id_smime_aa_contentIdentifier "id-smime-aa-contentIdentifier" +#define NID_id_smime_aa_contentIdentifier 218 +#define OBJ_id_smime_aa_contentIdentifier OBJ_id_smime_aa,7L + +#define SN_id_smime_aa_macValue "id-smime-aa-macValue" +#define NID_id_smime_aa_macValue 219 +#define OBJ_id_smime_aa_macValue OBJ_id_smime_aa,8L + +#define SN_id_smime_aa_equivalentLabels "id-smime-aa-equivalentLabels" +#define NID_id_smime_aa_equivalentLabels 220 +#define OBJ_id_smime_aa_equivalentLabels OBJ_id_smime_aa,9L + +#define SN_id_smime_aa_contentReference "id-smime-aa-contentReference" +#define NID_id_smime_aa_contentReference 221 +#define OBJ_id_smime_aa_contentReference OBJ_id_smime_aa,10L + +#define SN_id_smime_aa_encrypKeyPref "id-smime-aa-encrypKeyPref" +#define NID_id_smime_aa_encrypKeyPref 222 +#define OBJ_id_smime_aa_encrypKeyPref OBJ_id_smime_aa,11L + +#define SN_id_smime_aa_signingCertificate "id-smime-aa-signingCertificate" +#define NID_id_smime_aa_signingCertificate 223 +#define OBJ_id_smime_aa_signingCertificate OBJ_id_smime_aa,12L + +#define SN_id_smime_aa_smimeEncryptCerts "id-smime-aa-smimeEncryptCerts" +#define NID_id_smime_aa_smimeEncryptCerts 224 +#define OBJ_id_smime_aa_smimeEncryptCerts OBJ_id_smime_aa,13L + +#define SN_id_smime_aa_timeStampToken "id-smime-aa-timeStampToken" +#define NID_id_smime_aa_timeStampToken 225 +#define OBJ_id_smime_aa_timeStampToken OBJ_id_smime_aa,14L + +#define SN_id_smime_aa_ets_sigPolicyId "id-smime-aa-ets-sigPolicyId" +#define NID_id_smime_aa_ets_sigPolicyId 226 +#define OBJ_id_smime_aa_ets_sigPolicyId OBJ_id_smime_aa,15L + +#define SN_id_smime_aa_ets_commitmentType "id-smime-aa-ets-commitmentType" +#define NID_id_smime_aa_ets_commitmentType 227 +#define OBJ_id_smime_aa_ets_commitmentType OBJ_id_smime_aa,16L + +#define SN_id_smime_aa_ets_signerLocation "id-smime-aa-ets-signerLocation" +#define NID_id_smime_aa_ets_signerLocation 228 +#define OBJ_id_smime_aa_ets_signerLocation OBJ_id_smime_aa,17L + +#define SN_id_smime_aa_ets_signerAttr "id-smime-aa-ets-signerAttr" +#define NID_id_smime_aa_ets_signerAttr 229 +#define OBJ_id_smime_aa_ets_signerAttr OBJ_id_smime_aa,18L + +#define SN_id_smime_aa_ets_otherSigCert "id-smime-aa-ets-otherSigCert" +#define NID_id_smime_aa_ets_otherSigCert 230 +#define OBJ_id_smime_aa_ets_otherSigCert OBJ_id_smime_aa,19L + +#define SN_id_smime_aa_ets_contentTimestamp "id-smime-aa-ets-contentTimestamp" +#define NID_id_smime_aa_ets_contentTimestamp 231 +#define OBJ_id_smime_aa_ets_contentTimestamp OBJ_id_smime_aa,20L + +#define SN_id_smime_aa_ets_CertificateRefs "id-smime-aa-ets-CertificateRefs" +#define NID_id_smime_aa_ets_CertificateRefs 232 +#define OBJ_id_smime_aa_ets_CertificateRefs OBJ_id_smime_aa,21L + +#define SN_id_smime_aa_ets_RevocationRefs "id-smime-aa-ets-RevocationRefs" +#define NID_id_smime_aa_ets_RevocationRefs 233 +#define OBJ_id_smime_aa_ets_RevocationRefs OBJ_id_smime_aa,22L + +#define SN_id_smime_aa_ets_certValues "id-smime-aa-ets-certValues" +#define NID_id_smime_aa_ets_certValues 234 +#define OBJ_id_smime_aa_ets_certValues OBJ_id_smime_aa,23L + +#define SN_id_smime_aa_ets_revocationValues "id-smime-aa-ets-revocationValues" +#define NID_id_smime_aa_ets_revocationValues 235 +#define OBJ_id_smime_aa_ets_revocationValues OBJ_id_smime_aa,24L + +#define SN_id_smime_aa_ets_escTimeStamp "id-smime-aa-ets-escTimeStamp" +#define NID_id_smime_aa_ets_escTimeStamp 236 +#define OBJ_id_smime_aa_ets_escTimeStamp OBJ_id_smime_aa,25L + +#define SN_id_smime_aa_ets_certCRLTimestamp "id-smime-aa-ets-certCRLTimestamp" +#define NID_id_smime_aa_ets_certCRLTimestamp 237 +#define OBJ_id_smime_aa_ets_certCRLTimestamp OBJ_id_smime_aa,26L + +#define SN_id_smime_aa_ets_archiveTimeStamp "id-smime-aa-ets-archiveTimeStamp" +#define NID_id_smime_aa_ets_archiveTimeStamp 238 +#define OBJ_id_smime_aa_ets_archiveTimeStamp OBJ_id_smime_aa,27L + +#define SN_id_smime_aa_signatureType "id-smime-aa-signatureType" +#define NID_id_smime_aa_signatureType 239 +#define OBJ_id_smime_aa_signatureType OBJ_id_smime_aa,28L + +#define SN_id_smime_aa_dvcs_dvc "id-smime-aa-dvcs-dvc" +#define NID_id_smime_aa_dvcs_dvc 240 +#define OBJ_id_smime_aa_dvcs_dvc OBJ_id_smime_aa,29L + +#define SN_id_smime_alg_ESDHwith3DES "id-smime-alg-ESDHwith3DES" +#define NID_id_smime_alg_ESDHwith3DES 241 +#define OBJ_id_smime_alg_ESDHwith3DES OBJ_id_smime_alg,1L + +#define SN_id_smime_alg_ESDHwithRC2 "id-smime-alg-ESDHwithRC2" +#define NID_id_smime_alg_ESDHwithRC2 242 +#define OBJ_id_smime_alg_ESDHwithRC2 OBJ_id_smime_alg,2L + +#define SN_id_smime_alg_3DESwrap "id-smime-alg-3DESwrap" +#define NID_id_smime_alg_3DESwrap 243 +#define OBJ_id_smime_alg_3DESwrap OBJ_id_smime_alg,3L + +#define SN_id_smime_alg_RC2wrap "id-smime-alg-RC2wrap" +#define NID_id_smime_alg_RC2wrap 244 +#define OBJ_id_smime_alg_RC2wrap OBJ_id_smime_alg,4L + +#define SN_id_smime_alg_ESDH "id-smime-alg-ESDH" +#define NID_id_smime_alg_ESDH 245 +#define OBJ_id_smime_alg_ESDH OBJ_id_smime_alg,5L + +#define SN_id_smime_alg_CMS3DESwrap "id-smime-alg-CMS3DESwrap" +#define NID_id_smime_alg_CMS3DESwrap 246 +#define OBJ_id_smime_alg_CMS3DESwrap OBJ_id_smime_alg,6L + +#define SN_id_smime_alg_CMSRC2wrap "id-smime-alg-CMSRC2wrap" +#define NID_id_smime_alg_CMSRC2wrap 247 +#define OBJ_id_smime_alg_CMSRC2wrap OBJ_id_smime_alg,7L + +#define SN_id_smime_cd_ldap "id-smime-cd-ldap" +#define NID_id_smime_cd_ldap 248 +#define OBJ_id_smime_cd_ldap OBJ_id_smime_cd,1L + +#define SN_id_smime_spq_ets_sqt_uri "id-smime-spq-ets-sqt-uri" +#define NID_id_smime_spq_ets_sqt_uri 249 +#define OBJ_id_smime_spq_ets_sqt_uri OBJ_id_smime_spq,1L + +#define SN_id_smime_spq_ets_sqt_unotice "id-smime-spq-ets-sqt-unotice" +#define NID_id_smime_spq_ets_sqt_unotice 250 +#define OBJ_id_smime_spq_ets_sqt_unotice OBJ_id_smime_spq,2L + +#define SN_id_smime_cti_ets_proofOfOrigin "id-smime-cti-ets-proofOfOrigin" +#define NID_id_smime_cti_ets_proofOfOrigin 251 +#define OBJ_id_smime_cti_ets_proofOfOrigin OBJ_id_smime_cti,1L + +#define SN_id_smime_cti_ets_proofOfReceipt "id-smime-cti-ets-proofOfReceipt" +#define NID_id_smime_cti_ets_proofOfReceipt 252 +#define OBJ_id_smime_cti_ets_proofOfReceipt OBJ_id_smime_cti,2L + +#define SN_id_smime_cti_ets_proofOfDelivery "id-smime-cti-ets-proofOfDelivery" +#define NID_id_smime_cti_ets_proofOfDelivery 253 +#define OBJ_id_smime_cti_ets_proofOfDelivery OBJ_id_smime_cti,3L + +#define SN_id_smime_cti_ets_proofOfSender "id-smime-cti-ets-proofOfSender" +#define NID_id_smime_cti_ets_proofOfSender 254 +#define OBJ_id_smime_cti_ets_proofOfSender OBJ_id_smime_cti,4L + +#define SN_id_smime_cti_ets_proofOfApproval "id-smime-cti-ets-proofOfApproval" +#define NID_id_smime_cti_ets_proofOfApproval 255 +#define OBJ_id_smime_cti_ets_proofOfApproval OBJ_id_smime_cti,5L + +#define SN_id_smime_cti_ets_proofOfCreation "id-smime-cti-ets-proofOfCreation" +#define NID_id_smime_cti_ets_proofOfCreation 256 +#define OBJ_id_smime_cti_ets_proofOfCreation OBJ_id_smime_cti,6L + +#define LN_friendlyName "friendlyName" +#define NID_friendlyName 156 +#define OBJ_friendlyName OBJ_pkcs9,20L + +#define LN_localKeyID "localKeyID" +#define NID_localKeyID 157 +#define OBJ_localKeyID OBJ_pkcs9,21L + +#define SN_ms_csp_name "CSPName" +#define LN_ms_csp_name "Microsoft CSP Name" +#define NID_ms_csp_name 417 +#define OBJ_ms_csp_name 1L,3L,6L,1L,4L,1L,311L,17L,1L + +#define OBJ_certTypes OBJ_pkcs9,22L + +#define LN_x509Certificate "x509Certificate" +#define NID_x509Certificate 158 +#define OBJ_x509Certificate OBJ_certTypes,1L + +#define LN_sdsiCertificate "sdsiCertificate" +#define NID_sdsiCertificate 159 +#define OBJ_sdsiCertificate OBJ_certTypes,2L + +#define OBJ_crlTypes OBJ_pkcs9,23L + +#define LN_x509Crl "x509Crl" +#define NID_x509Crl 160 +#define OBJ_x509Crl OBJ_crlTypes,1L + +#define OBJ_pkcs12 OBJ_pkcs,12L + +#define OBJ_pkcs12_pbeids OBJ_pkcs12,1L + +#define SN_pbe_WithSHA1And128BitRC4 "PBE-SHA1-RC4-128" +#define LN_pbe_WithSHA1And128BitRC4 "pbeWithSHA1And128BitRC4" +#define NID_pbe_WithSHA1And128BitRC4 144 +#define OBJ_pbe_WithSHA1And128BitRC4 OBJ_pkcs12_pbeids,1L + +#define SN_pbe_WithSHA1And40BitRC4 "PBE-SHA1-RC4-40" +#define LN_pbe_WithSHA1And40BitRC4 "pbeWithSHA1And40BitRC4" +#define NID_pbe_WithSHA1And40BitRC4 145 +#define OBJ_pbe_WithSHA1And40BitRC4 OBJ_pkcs12_pbeids,2L + +#define SN_pbe_WithSHA1And3_Key_TripleDES_CBC "PBE-SHA1-3DES" +#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC "pbeWithSHA1And3-KeyTripleDES-CBC" +#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC 146 +#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC OBJ_pkcs12_pbeids,3L + +#define SN_pbe_WithSHA1And2_Key_TripleDES_CBC "PBE-SHA1-2DES" +#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC "pbeWithSHA1And2-KeyTripleDES-CBC" +#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC 147 +#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC OBJ_pkcs12_pbeids,4L + +#define SN_pbe_WithSHA1And128BitRC2_CBC "PBE-SHA1-RC2-128" +#define LN_pbe_WithSHA1And128BitRC2_CBC "pbeWithSHA1And128BitRC2-CBC" +#define NID_pbe_WithSHA1And128BitRC2_CBC 148 +#define OBJ_pbe_WithSHA1And128BitRC2_CBC OBJ_pkcs12_pbeids,5L + +#define SN_pbe_WithSHA1And40BitRC2_CBC "PBE-SHA1-RC2-40" +#define LN_pbe_WithSHA1And40BitRC2_CBC "pbeWithSHA1And40BitRC2-CBC" +#define NID_pbe_WithSHA1And40BitRC2_CBC 149 +#define OBJ_pbe_WithSHA1And40BitRC2_CBC OBJ_pkcs12_pbeids,6L + +#define OBJ_pkcs12_Version1 OBJ_pkcs12,10L + +#define OBJ_pkcs12_BagIds OBJ_pkcs12_Version1,1L + +#define LN_keyBag "keyBag" +#define NID_keyBag 150 +#define OBJ_keyBag OBJ_pkcs12_BagIds,1L + +#define LN_pkcs8ShroudedKeyBag "pkcs8ShroudedKeyBag" +#define NID_pkcs8ShroudedKeyBag 151 +#define OBJ_pkcs8ShroudedKeyBag OBJ_pkcs12_BagIds,2L + +#define LN_certBag "certBag" +#define NID_certBag 152 +#define OBJ_certBag OBJ_pkcs12_BagIds,3L + +#define LN_crlBag "crlBag" +#define NID_crlBag 153 +#define OBJ_crlBag OBJ_pkcs12_BagIds,4L + +#define LN_secretBag "secretBag" +#define NID_secretBag 154 +#define OBJ_secretBag OBJ_pkcs12_BagIds,5L + +#define LN_safeContentsBag "safeContentsBag" +#define NID_safeContentsBag 155 +#define OBJ_safeContentsBag OBJ_pkcs12_BagIds,6L + +#define SN_md2 "MD2" +#define LN_md2 "md2" +#define NID_md2 3 +#define OBJ_md2 OBJ_rsadsi,2L,2L + +#define SN_md4 "MD4" +#define LN_md4 "md4" +#define NID_md4 257 +#define OBJ_md4 OBJ_rsadsi,2L,4L + +#define SN_md5 "MD5" +#define LN_md5 "md5" +#define NID_md5 4 +#define OBJ_md5 OBJ_rsadsi,2L,5L + +#define SN_md5_sha1 "MD5-SHA1" +#define LN_md5_sha1 "md5-sha1" +#define NID_md5_sha1 114 + +#define LN_hmacWithSHA1 "hmacWithSHA1" +#define NID_hmacWithSHA1 163 +#define OBJ_hmacWithSHA1 OBJ_rsadsi,2L,7L + +#define SN_rc2_cbc "RC2-CBC" +#define LN_rc2_cbc "rc2-cbc" +#define NID_rc2_cbc 37 +#define OBJ_rc2_cbc OBJ_rsadsi,3L,2L + +#define SN_rc2_ecb "RC2-ECB" +#define LN_rc2_ecb "rc2-ecb" +#define NID_rc2_ecb 38 + +#define SN_rc2_cfb64 "RC2-CFB" +#define LN_rc2_cfb64 "rc2-cfb" +#define NID_rc2_cfb64 39 + +#define SN_rc2_ofb64 "RC2-OFB" +#define LN_rc2_ofb64 "rc2-ofb" +#define NID_rc2_ofb64 40 + +#define SN_rc2_40_cbc "RC2-40-CBC" +#define LN_rc2_40_cbc "rc2-40-cbc" +#define NID_rc2_40_cbc 98 + +#define SN_rc2_64_cbc "RC2-64-CBC" +#define LN_rc2_64_cbc "rc2-64-cbc" +#define NID_rc2_64_cbc 166 + +#define SN_rc4 "RC4" +#define LN_rc4 "rc4" +#define NID_rc4 5 +#define OBJ_rc4 OBJ_rsadsi,3L,4L + +#define SN_rc4_40 "RC4-40" +#define LN_rc4_40 "rc4-40" +#define NID_rc4_40 97 + +#define SN_des_ede3_cbc "DES-EDE3-CBC" +#define LN_des_ede3_cbc "des-ede3-cbc" +#define NID_des_ede3_cbc 44 +#define OBJ_des_ede3_cbc OBJ_rsadsi,3L,7L + +#define SN_rc5_cbc "RC5-CBC" +#define LN_rc5_cbc "rc5-cbc" +#define NID_rc5_cbc 120 +#define OBJ_rc5_cbc OBJ_rsadsi,3L,8L + +#define SN_rc5_ecb "RC5-ECB" +#define LN_rc5_ecb "rc5-ecb" +#define NID_rc5_ecb 121 + +#define SN_rc5_cfb64 "RC5-CFB" +#define LN_rc5_cfb64 "rc5-cfb" +#define NID_rc5_cfb64 122 + +#define SN_rc5_ofb64 "RC5-OFB" +#define LN_rc5_ofb64 "rc5-ofb" +#define NID_rc5_ofb64 123 + +#define SN_ms_ext_req "msExtReq" +#define LN_ms_ext_req "Microsoft Extension Request" +#define NID_ms_ext_req 171 +#define OBJ_ms_ext_req 1L,3L,6L,1L,4L,1L,311L,2L,1L,14L + +#define SN_ms_code_ind "msCodeInd" +#define LN_ms_code_ind "Microsoft Individual Code Signing" +#define NID_ms_code_ind 134 +#define OBJ_ms_code_ind 1L,3L,6L,1L,4L,1L,311L,2L,1L,21L + +#define SN_ms_code_com "msCodeCom" +#define LN_ms_code_com "Microsoft Commercial Code Signing" +#define NID_ms_code_com 135 +#define OBJ_ms_code_com 1L,3L,6L,1L,4L,1L,311L,2L,1L,22L + +#define SN_ms_ctl_sign "msCTLSign" +#define LN_ms_ctl_sign "Microsoft Trust List Signing" +#define NID_ms_ctl_sign 136 +#define OBJ_ms_ctl_sign 1L,3L,6L,1L,4L,1L,311L,10L,3L,1L + +#define SN_ms_sgc "msSGC" +#define LN_ms_sgc "Microsoft Server Gated Crypto" +#define NID_ms_sgc 137 +#define OBJ_ms_sgc 1L,3L,6L,1L,4L,1L,311L,10L,3L,3L + +#define SN_ms_efs "msEFS" +#define LN_ms_efs "Microsoft Encrypted File System" +#define NID_ms_efs 138 +#define OBJ_ms_efs 1L,3L,6L,1L,4L,1L,311L,10L,3L,4L + +#define SN_ms_smartcard_login "msSmartcardLogin" +#define LN_ms_smartcard_login "Microsoft Smartcardlogin" +#define NID_ms_smartcard_login 648 +#define OBJ_ms_smartcard_login 1L,3L,6L,1L,4L,1L,311L,20L,2L,2L + +#define SN_ms_upn "msUPN" +#define LN_ms_upn "Microsoft Universal Principal Name" +#define NID_ms_upn 649 +#define OBJ_ms_upn 1L,3L,6L,1L,4L,1L,311L,20L,2L,3L + +#define SN_idea_cbc "IDEA-CBC" +#define LN_idea_cbc "idea-cbc" +#define NID_idea_cbc 34 +#define OBJ_idea_cbc 1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L + +#define SN_idea_ecb "IDEA-ECB" +#define LN_idea_ecb "idea-ecb" +#define NID_idea_ecb 36 + +#define SN_idea_cfb64 "IDEA-CFB" +#define LN_idea_cfb64 "idea-cfb" +#define NID_idea_cfb64 35 + +#define SN_idea_ofb64 "IDEA-OFB" +#define LN_idea_ofb64 "idea-ofb" +#define NID_idea_ofb64 46 + +#define SN_bf_cbc "BF-CBC" +#define LN_bf_cbc "bf-cbc" +#define NID_bf_cbc 91 +#define OBJ_bf_cbc 1L,3L,6L,1L,4L,1L,3029L,1L,2L + +#define SN_bf_ecb "BF-ECB" +#define LN_bf_ecb "bf-ecb" +#define NID_bf_ecb 92 + +#define SN_bf_cfb64 "BF-CFB" +#define LN_bf_cfb64 "bf-cfb" +#define NID_bf_cfb64 93 + +#define SN_bf_ofb64 "BF-OFB" +#define LN_bf_ofb64 "bf-ofb" +#define NID_bf_ofb64 94 + +#define SN_id_pkix "PKIX" +#define NID_id_pkix 127 +#define OBJ_id_pkix 1L,3L,6L,1L,5L,5L,7L + +#define SN_id_pkix_mod "id-pkix-mod" +#define NID_id_pkix_mod 258 +#define OBJ_id_pkix_mod OBJ_id_pkix,0L + +#define SN_id_pe "id-pe" +#define NID_id_pe 175 +#define OBJ_id_pe OBJ_id_pkix,1L + +#define SN_id_qt "id-qt" +#define NID_id_qt 259 +#define OBJ_id_qt OBJ_id_pkix,2L + +#define SN_id_kp "id-kp" +#define NID_id_kp 128 +#define OBJ_id_kp OBJ_id_pkix,3L + +#define SN_id_it "id-it" +#define NID_id_it 260 +#define OBJ_id_it OBJ_id_pkix,4L + +#define SN_id_pkip "id-pkip" +#define NID_id_pkip 261 +#define OBJ_id_pkip OBJ_id_pkix,5L + +#define SN_id_alg "id-alg" +#define NID_id_alg 262 +#define OBJ_id_alg OBJ_id_pkix,6L + +#define SN_id_cmc "id-cmc" +#define NID_id_cmc 263 +#define OBJ_id_cmc OBJ_id_pkix,7L + +#define SN_id_on "id-on" +#define NID_id_on 264 +#define OBJ_id_on OBJ_id_pkix,8L + +#define SN_id_pda "id-pda" +#define NID_id_pda 265 +#define OBJ_id_pda OBJ_id_pkix,9L + +#define SN_id_aca "id-aca" +#define NID_id_aca 266 +#define OBJ_id_aca OBJ_id_pkix,10L + +#define SN_id_qcs "id-qcs" +#define NID_id_qcs 267 +#define OBJ_id_qcs OBJ_id_pkix,11L + +#define SN_id_cct "id-cct" +#define NID_id_cct 268 +#define OBJ_id_cct OBJ_id_pkix,12L + +#define SN_id_ppl "id-ppl" +#define NID_id_ppl 662 +#define OBJ_id_ppl OBJ_id_pkix,21L + +#define SN_id_ad "id-ad" +#define NID_id_ad 176 +#define OBJ_id_ad OBJ_id_pkix,48L + +#define SN_id_pkix1_explicit_88 "id-pkix1-explicit-88" +#define NID_id_pkix1_explicit_88 269 +#define OBJ_id_pkix1_explicit_88 OBJ_id_pkix_mod,1L + +#define SN_id_pkix1_implicit_88 "id-pkix1-implicit-88" +#define NID_id_pkix1_implicit_88 270 +#define OBJ_id_pkix1_implicit_88 OBJ_id_pkix_mod,2L + +#define SN_id_pkix1_explicit_93 "id-pkix1-explicit-93" +#define NID_id_pkix1_explicit_93 271 +#define OBJ_id_pkix1_explicit_93 OBJ_id_pkix_mod,3L + +#define SN_id_pkix1_implicit_93 "id-pkix1-implicit-93" +#define NID_id_pkix1_implicit_93 272 +#define OBJ_id_pkix1_implicit_93 OBJ_id_pkix_mod,4L + +#define SN_id_mod_crmf "id-mod-crmf" +#define NID_id_mod_crmf 273 +#define OBJ_id_mod_crmf OBJ_id_pkix_mod,5L + +#define SN_id_mod_cmc "id-mod-cmc" +#define NID_id_mod_cmc 274 +#define OBJ_id_mod_cmc OBJ_id_pkix_mod,6L + +#define SN_id_mod_kea_profile_88 "id-mod-kea-profile-88" +#define NID_id_mod_kea_profile_88 275 +#define OBJ_id_mod_kea_profile_88 OBJ_id_pkix_mod,7L + +#define SN_id_mod_kea_profile_93 "id-mod-kea-profile-93" +#define NID_id_mod_kea_profile_93 276 +#define OBJ_id_mod_kea_profile_93 OBJ_id_pkix_mod,8L + +#define SN_id_mod_cmp "id-mod-cmp" +#define NID_id_mod_cmp 277 +#define OBJ_id_mod_cmp OBJ_id_pkix_mod,9L + +#define SN_id_mod_qualified_cert_88 "id-mod-qualified-cert-88" +#define NID_id_mod_qualified_cert_88 278 +#define OBJ_id_mod_qualified_cert_88 OBJ_id_pkix_mod,10L + +#define SN_id_mod_qualified_cert_93 "id-mod-qualified-cert-93" +#define NID_id_mod_qualified_cert_93 279 +#define OBJ_id_mod_qualified_cert_93 OBJ_id_pkix_mod,11L + +#define SN_id_mod_attribute_cert "id-mod-attribute-cert" +#define NID_id_mod_attribute_cert 280 +#define OBJ_id_mod_attribute_cert OBJ_id_pkix_mod,12L + +#define SN_id_mod_timestamp_protocol "id-mod-timestamp-protocol" +#define NID_id_mod_timestamp_protocol 281 +#define OBJ_id_mod_timestamp_protocol OBJ_id_pkix_mod,13L + +#define SN_id_mod_ocsp "id-mod-ocsp" +#define NID_id_mod_ocsp 282 +#define OBJ_id_mod_ocsp OBJ_id_pkix_mod,14L + +#define SN_id_mod_dvcs "id-mod-dvcs" +#define NID_id_mod_dvcs 283 +#define OBJ_id_mod_dvcs OBJ_id_pkix_mod,15L + +#define SN_id_mod_cmp2000 "id-mod-cmp2000" +#define NID_id_mod_cmp2000 284 +#define OBJ_id_mod_cmp2000 OBJ_id_pkix_mod,16L + +#define SN_info_access "authorityInfoAccess" +#define LN_info_access "Authority Information Access" +#define NID_info_access 177 +#define OBJ_info_access OBJ_id_pe,1L + +#define SN_biometricInfo "biometricInfo" +#define LN_biometricInfo "Biometric Info" +#define NID_biometricInfo 285 +#define OBJ_biometricInfo OBJ_id_pe,2L + +#define SN_qcStatements "qcStatements" +#define NID_qcStatements 286 +#define OBJ_qcStatements OBJ_id_pe,3L + +#define SN_ac_auditEntity "ac-auditEntity" +#define NID_ac_auditEntity 287 +#define OBJ_ac_auditEntity OBJ_id_pe,4L + +#define SN_ac_targeting "ac-targeting" +#define NID_ac_targeting 288 +#define OBJ_ac_targeting OBJ_id_pe,5L + +#define SN_aaControls "aaControls" +#define NID_aaControls 289 +#define OBJ_aaControls OBJ_id_pe,6L + +#define SN_sbqp_ipAddrBlock "sbqp-ipAddrBlock" +#define NID_sbqp_ipAddrBlock 290 +#define OBJ_sbqp_ipAddrBlock OBJ_id_pe,7L + +#define SN_sbqp_autonomousSysNum "sbqp-autonomousSysNum" +#define NID_sbqp_autonomousSysNum 291 +#define OBJ_sbqp_autonomousSysNum OBJ_id_pe,8L + +#define SN_sbqp_routerIdentifier "sbqp-routerIdentifier" +#define NID_sbqp_routerIdentifier 292 +#define OBJ_sbqp_routerIdentifier OBJ_id_pe,9L + +#define SN_ac_proxying "ac-proxying" +#define NID_ac_proxying 397 +#define OBJ_ac_proxying OBJ_id_pe,10L + +#define SN_sinfo_access "subjectInfoAccess" +#define LN_sinfo_access "Subject Information Access" +#define NID_sinfo_access 398 +#define OBJ_sinfo_access OBJ_id_pe,11L + +#define SN_proxyCertInfo "proxyCertInfo" +#define LN_proxyCertInfo "Proxy Certificate Information" +#define NID_proxyCertInfo 663 +#define OBJ_proxyCertInfo OBJ_id_pe,14L + +#define SN_id_qt_cps "id-qt-cps" +#define LN_id_qt_cps "Policy Qualifier CPS" +#define NID_id_qt_cps 164 +#define OBJ_id_qt_cps OBJ_id_qt,1L + +#define SN_id_qt_unotice "id-qt-unotice" +#define LN_id_qt_unotice "Policy Qualifier User Notice" +#define NID_id_qt_unotice 165 +#define OBJ_id_qt_unotice OBJ_id_qt,2L + +#define SN_textNotice "textNotice" +#define NID_textNotice 293 +#define OBJ_textNotice OBJ_id_qt,3L + +#define SN_server_auth "serverAuth" +#define LN_server_auth "TLS Web Server Authentication" +#define NID_server_auth 129 +#define OBJ_server_auth OBJ_id_kp,1L + +#define SN_client_auth "clientAuth" +#define LN_client_auth "TLS Web Client Authentication" +#define NID_client_auth 130 +#define OBJ_client_auth OBJ_id_kp,2L + +#define SN_code_sign "codeSigning" +#define LN_code_sign "Code Signing" +#define NID_code_sign 131 +#define OBJ_code_sign OBJ_id_kp,3L + +#define SN_email_protect "emailProtection" +#define LN_email_protect "E-mail Protection" +#define NID_email_protect 132 +#define OBJ_email_protect OBJ_id_kp,4L + +#define SN_ipsecEndSystem "ipsecEndSystem" +#define LN_ipsecEndSystem "IPSec End System" +#define NID_ipsecEndSystem 294 +#define OBJ_ipsecEndSystem OBJ_id_kp,5L + +#define SN_ipsecTunnel "ipsecTunnel" +#define LN_ipsecTunnel "IPSec Tunnel" +#define NID_ipsecTunnel 295 +#define OBJ_ipsecTunnel OBJ_id_kp,6L + +#define SN_ipsecUser "ipsecUser" +#define LN_ipsecUser "IPSec User" +#define NID_ipsecUser 296 +#define OBJ_ipsecUser OBJ_id_kp,7L + +#define SN_time_stamp "timeStamping" +#define LN_time_stamp "Time Stamping" +#define NID_time_stamp 133 +#define OBJ_time_stamp OBJ_id_kp,8L + +#define SN_OCSP_sign "OCSPSigning" +#define LN_OCSP_sign "OCSP Signing" +#define NID_OCSP_sign 180 +#define OBJ_OCSP_sign OBJ_id_kp,9L + +#define SN_dvcs "DVCS" +#define LN_dvcs "dvcs" +#define NID_dvcs 297 +#define OBJ_dvcs OBJ_id_kp,10L + +#define SN_id_it_caProtEncCert "id-it-caProtEncCert" +#define NID_id_it_caProtEncCert 298 +#define OBJ_id_it_caProtEncCert OBJ_id_it,1L + +#define SN_id_it_signKeyPairTypes "id-it-signKeyPairTypes" +#define NID_id_it_signKeyPairTypes 299 +#define OBJ_id_it_signKeyPairTypes OBJ_id_it,2L + +#define SN_id_it_encKeyPairTypes "id-it-encKeyPairTypes" +#define NID_id_it_encKeyPairTypes 300 +#define OBJ_id_it_encKeyPairTypes OBJ_id_it,3L + +#define SN_id_it_preferredSymmAlg "id-it-preferredSymmAlg" +#define NID_id_it_preferredSymmAlg 301 +#define OBJ_id_it_preferredSymmAlg OBJ_id_it,4L + +#define SN_id_it_caKeyUpdateInfo "id-it-caKeyUpdateInfo" +#define NID_id_it_caKeyUpdateInfo 302 +#define OBJ_id_it_caKeyUpdateInfo OBJ_id_it,5L + +#define SN_id_it_currentCRL "id-it-currentCRL" +#define NID_id_it_currentCRL 303 +#define OBJ_id_it_currentCRL OBJ_id_it,6L + +#define SN_id_it_unsupportedOIDs "id-it-unsupportedOIDs" +#define NID_id_it_unsupportedOIDs 304 +#define OBJ_id_it_unsupportedOIDs OBJ_id_it,7L + +#define SN_id_it_subscriptionRequest "id-it-subscriptionRequest" +#define NID_id_it_subscriptionRequest 305 +#define OBJ_id_it_subscriptionRequest OBJ_id_it,8L + +#define SN_id_it_subscriptionResponse "id-it-subscriptionResponse" +#define NID_id_it_subscriptionResponse 306 +#define OBJ_id_it_subscriptionResponse OBJ_id_it,9L + +#define SN_id_it_keyPairParamReq "id-it-keyPairParamReq" +#define NID_id_it_keyPairParamReq 307 +#define OBJ_id_it_keyPairParamReq OBJ_id_it,10L + +#define SN_id_it_keyPairParamRep "id-it-keyPairParamRep" +#define NID_id_it_keyPairParamRep 308 +#define OBJ_id_it_keyPairParamRep OBJ_id_it,11L + +#define SN_id_it_revPassphrase "id-it-revPassphrase" +#define NID_id_it_revPassphrase 309 +#define OBJ_id_it_revPassphrase OBJ_id_it,12L + +#define SN_id_it_implicitConfirm "id-it-implicitConfirm" +#define NID_id_it_implicitConfirm 310 +#define OBJ_id_it_implicitConfirm OBJ_id_it,13L + +#define SN_id_it_confirmWaitTime "id-it-confirmWaitTime" +#define NID_id_it_confirmWaitTime 311 +#define OBJ_id_it_confirmWaitTime OBJ_id_it,14L + +#define SN_id_it_origPKIMessage "id-it-origPKIMessage" +#define NID_id_it_origPKIMessage 312 +#define OBJ_id_it_origPKIMessage OBJ_id_it,15L + +#define SN_id_regCtrl "id-regCtrl" +#define NID_id_regCtrl 313 +#define OBJ_id_regCtrl OBJ_id_pkip,1L + +#define SN_id_regInfo "id-regInfo" +#define NID_id_regInfo 314 +#define OBJ_id_regInfo OBJ_id_pkip,2L + +#define SN_id_regCtrl_regToken "id-regCtrl-regToken" +#define NID_id_regCtrl_regToken 315 +#define OBJ_id_regCtrl_regToken OBJ_id_regCtrl,1L + +#define SN_id_regCtrl_authenticator "id-regCtrl-authenticator" +#define NID_id_regCtrl_authenticator 316 +#define OBJ_id_regCtrl_authenticator OBJ_id_regCtrl,2L + +#define SN_id_regCtrl_pkiPublicationInfo "id-regCtrl-pkiPublicationInfo" +#define NID_id_regCtrl_pkiPublicationInfo 317 +#define OBJ_id_regCtrl_pkiPublicationInfo OBJ_id_regCtrl,3L + +#define SN_id_regCtrl_pkiArchiveOptions "id-regCtrl-pkiArchiveOptions" +#define NID_id_regCtrl_pkiArchiveOptions 318 +#define OBJ_id_regCtrl_pkiArchiveOptions OBJ_id_regCtrl,4L + +#define SN_id_regCtrl_oldCertID "id-regCtrl-oldCertID" +#define NID_id_regCtrl_oldCertID 319 +#define OBJ_id_regCtrl_oldCertID OBJ_id_regCtrl,5L + +#define SN_id_regCtrl_protocolEncrKey "id-regCtrl-protocolEncrKey" +#define NID_id_regCtrl_protocolEncrKey 320 +#define OBJ_id_regCtrl_protocolEncrKey OBJ_id_regCtrl,6L + +#define SN_id_regInfo_utf8Pairs "id-regInfo-utf8Pairs" +#define NID_id_regInfo_utf8Pairs 321 +#define OBJ_id_regInfo_utf8Pairs OBJ_id_regInfo,1L + +#define SN_id_regInfo_certReq "id-regInfo-certReq" +#define NID_id_regInfo_certReq 322 +#define OBJ_id_regInfo_certReq OBJ_id_regInfo,2L + +#define SN_id_alg_des40 "id-alg-des40" +#define NID_id_alg_des40 323 +#define OBJ_id_alg_des40 OBJ_id_alg,1L + +#define SN_id_alg_noSignature "id-alg-noSignature" +#define NID_id_alg_noSignature 324 +#define OBJ_id_alg_noSignature OBJ_id_alg,2L + +#define SN_id_alg_dh_sig_hmac_sha1 "id-alg-dh-sig-hmac-sha1" +#define NID_id_alg_dh_sig_hmac_sha1 325 +#define OBJ_id_alg_dh_sig_hmac_sha1 OBJ_id_alg,3L + +#define SN_id_alg_dh_pop "id-alg-dh-pop" +#define NID_id_alg_dh_pop 326 +#define OBJ_id_alg_dh_pop OBJ_id_alg,4L + +#define SN_id_cmc_statusInfo "id-cmc-statusInfo" +#define NID_id_cmc_statusInfo 327 +#define OBJ_id_cmc_statusInfo OBJ_id_cmc,1L + +#define SN_id_cmc_identification "id-cmc-identification" +#define NID_id_cmc_identification 328 +#define OBJ_id_cmc_identification OBJ_id_cmc,2L + +#define SN_id_cmc_identityProof "id-cmc-identityProof" +#define NID_id_cmc_identityProof 329 +#define OBJ_id_cmc_identityProof OBJ_id_cmc,3L + +#define SN_id_cmc_dataReturn "id-cmc-dataReturn" +#define NID_id_cmc_dataReturn 330 +#define OBJ_id_cmc_dataReturn OBJ_id_cmc,4L + +#define SN_id_cmc_transactionId "id-cmc-transactionId" +#define NID_id_cmc_transactionId 331 +#define OBJ_id_cmc_transactionId OBJ_id_cmc,5L + +#define SN_id_cmc_senderNonce "id-cmc-senderNonce" +#define NID_id_cmc_senderNonce 332 +#define OBJ_id_cmc_senderNonce OBJ_id_cmc,6L + +#define SN_id_cmc_recipientNonce "id-cmc-recipientNonce" +#define NID_id_cmc_recipientNonce 333 +#define OBJ_id_cmc_recipientNonce OBJ_id_cmc,7L + +#define SN_id_cmc_addExtensions "id-cmc-addExtensions" +#define NID_id_cmc_addExtensions 334 +#define OBJ_id_cmc_addExtensions OBJ_id_cmc,8L + +#define SN_id_cmc_encryptedPOP "id-cmc-encryptedPOP" +#define NID_id_cmc_encryptedPOP 335 +#define OBJ_id_cmc_encryptedPOP OBJ_id_cmc,9L + +#define SN_id_cmc_decryptedPOP "id-cmc-decryptedPOP" +#define NID_id_cmc_decryptedPOP 336 +#define OBJ_id_cmc_decryptedPOP OBJ_id_cmc,10L + +#define SN_id_cmc_lraPOPWitness "id-cmc-lraPOPWitness" +#define NID_id_cmc_lraPOPWitness 337 +#define OBJ_id_cmc_lraPOPWitness OBJ_id_cmc,11L + +#define SN_id_cmc_getCert "id-cmc-getCert" +#define NID_id_cmc_getCert 338 +#define OBJ_id_cmc_getCert OBJ_id_cmc,15L + +#define SN_id_cmc_getCRL "id-cmc-getCRL" +#define NID_id_cmc_getCRL 339 +#define OBJ_id_cmc_getCRL OBJ_id_cmc,16L + +#define SN_id_cmc_revokeRequest "id-cmc-revokeRequest" +#define NID_id_cmc_revokeRequest 340 +#define OBJ_id_cmc_revokeRequest OBJ_id_cmc,17L + +#define SN_id_cmc_regInfo "id-cmc-regInfo" +#define NID_id_cmc_regInfo 341 +#define OBJ_id_cmc_regInfo OBJ_id_cmc,18L + +#define SN_id_cmc_responseInfo "id-cmc-responseInfo" +#define NID_id_cmc_responseInfo 342 +#define OBJ_id_cmc_responseInfo OBJ_id_cmc,19L + +#define SN_id_cmc_queryPending "id-cmc-queryPending" +#define NID_id_cmc_queryPending 343 +#define OBJ_id_cmc_queryPending OBJ_id_cmc,21L + +#define SN_id_cmc_popLinkRandom "id-cmc-popLinkRandom" +#define NID_id_cmc_popLinkRandom 344 +#define OBJ_id_cmc_popLinkRandom OBJ_id_cmc,22L + +#define SN_id_cmc_popLinkWitness "id-cmc-popLinkWitness" +#define NID_id_cmc_popLinkWitness 345 +#define OBJ_id_cmc_popLinkWitness OBJ_id_cmc,23L + +#define SN_id_cmc_confirmCertAcceptance "id-cmc-confirmCertAcceptance" +#define NID_id_cmc_confirmCertAcceptance 346 +#define OBJ_id_cmc_confirmCertAcceptance OBJ_id_cmc,24L + +#define SN_id_on_personalData "id-on-personalData" +#define NID_id_on_personalData 347 +#define OBJ_id_on_personalData OBJ_id_on,1L + +#define SN_id_pda_dateOfBirth "id-pda-dateOfBirth" +#define NID_id_pda_dateOfBirth 348 +#define OBJ_id_pda_dateOfBirth OBJ_id_pda,1L + +#define SN_id_pda_placeOfBirth "id-pda-placeOfBirth" +#define NID_id_pda_placeOfBirth 349 +#define OBJ_id_pda_placeOfBirth OBJ_id_pda,2L + +#define SN_id_pda_gender "id-pda-gender" +#define NID_id_pda_gender 351 +#define OBJ_id_pda_gender OBJ_id_pda,3L + +#define SN_id_pda_countryOfCitizenship "id-pda-countryOfCitizenship" +#define NID_id_pda_countryOfCitizenship 352 +#define OBJ_id_pda_countryOfCitizenship OBJ_id_pda,4L + +#define SN_id_pda_countryOfResidence "id-pda-countryOfResidence" +#define NID_id_pda_countryOfResidence 353 +#define OBJ_id_pda_countryOfResidence OBJ_id_pda,5L + +#define SN_id_aca_authenticationInfo "id-aca-authenticationInfo" +#define NID_id_aca_authenticationInfo 354 +#define OBJ_id_aca_authenticationInfo OBJ_id_aca,1L + +#define SN_id_aca_accessIdentity "id-aca-accessIdentity" +#define NID_id_aca_accessIdentity 355 +#define OBJ_id_aca_accessIdentity OBJ_id_aca,2L + +#define SN_id_aca_chargingIdentity "id-aca-chargingIdentity" +#define NID_id_aca_chargingIdentity 356 +#define OBJ_id_aca_chargingIdentity OBJ_id_aca,3L + +#define SN_id_aca_group "id-aca-group" +#define NID_id_aca_group 357 +#define OBJ_id_aca_group OBJ_id_aca,4L + +#define SN_id_aca_role "id-aca-role" +#define NID_id_aca_role 358 +#define OBJ_id_aca_role OBJ_id_aca,5L + +#define SN_id_aca_encAttrs "id-aca-encAttrs" +#define NID_id_aca_encAttrs 399 +#define OBJ_id_aca_encAttrs OBJ_id_aca,6L + +#define SN_id_qcs_pkixQCSyntax_v1 "id-qcs-pkixQCSyntax-v1" +#define NID_id_qcs_pkixQCSyntax_v1 359 +#define OBJ_id_qcs_pkixQCSyntax_v1 OBJ_id_qcs,1L + +#define SN_id_cct_crs "id-cct-crs" +#define NID_id_cct_crs 360 +#define OBJ_id_cct_crs OBJ_id_cct,1L + +#define SN_id_cct_PKIData "id-cct-PKIData" +#define NID_id_cct_PKIData 361 +#define OBJ_id_cct_PKIData OBJ_id_cct,2L + +#define SN_id_cct_PKIResponse "id-cct-PKIResponse" +#define NID_id_cct_PKIResponse 362 +#define OBJ_id_cct_PKIResponse OBJ_id_cct,3L + +#define SN_id_ppl_anyLanguage "id-ppl-anyLanguage" +#define LN_id_ppl_anyLanguage "Any language" +#define NID_id_ppl_anyLanguage 664 +#define OBJ_id_ppl_anyLanguage OBJ_id_ppl,0L + +#define SN_id_ppl_inheritAll "id-ppl-inheritAll" +#define LN_id_ppl_inheritAll "Inherit all" +#define NID_id_ppl_inheritAll 665 +#define OBJ_id_ppl_inheritAll OBJ_id_ppl,1L + +#define SN_Independent "id-ppl-independent" +#define LN_Independent "Independent" +#define NID_Independent 667 +#define OBJ_Independent OBJ_id_ppl,2L + +#define SN_ad_OCSP "OCSP" +#define LN_ad_OCSP "OCSP" +#define NID_ad_OCSP 178 +#define OBJ_ad_OCSP OBJ_id_ad,1L + +#define SN_ad_ca_issuers "caIssuers" +#define LN_ad_ca_issuers "CA Issuers" +#define NID_ad_ca_issuers 179 +#define OBJ_ad_ca_issuers OBJ_id_ad,2L + +#define SN_ad_timeStamping "ad_timestamping" +#define LN_ad_timeStamping "AD Time Stamping" +#define NID_ad_timeStamping 363 +#define OBJ_ad_timeStamping OBJ_id_ad,3L + +#define SN_ad_dvcs "AD_DVCS" +#define LN_ad_dvcs "ad dvcs" +#define NID_ad_dvcs 364 +#define OBJ_ad_dvcs OBJ_id_ad,4L + +#define OBJ_id_pkix_OCSP OBJ_ad_OCSP + +#define SN_id_pkix_OCSP_basic "basicOCSPResponse" +#define LN_id_pkix_OCSP_basic "Basic OCSP Response" +#define NID_id_pkix_OCSP_basic 365 +#define OBJ_id_pkix_OCSP_basic OBJ_id_pkix_OCSP,1L + +#define SN_id_pkix_OCSP_Nonce "Nonce" +#define LN_id_pkix_OCSP_Nonce "OCSP Nonce" +#define NID_id_pkix_OCSP_Nonce 366 +#define OBJ_id_pkix_OCSP_Nonce OBJ_id_pkix_OCSP,2L + +#define SN_id_pkix_OCSP_CrlID "CrlID" +#define LN_id_pkix_OCSP_CrlID "OCSP CRL ID" +#define NID_id_pkix_OCSP_CrlID 367 +#define OBJ_id_pkix_OCSP_CrlID OBJ_id_pkix_OCSP,3L + +#define SN_id_pkix_OCSP_acceptableResponses "acceptableResponses" +#define LN_id_pkix_OCSP_acceptableResponses "Acceptable OCSP Responses" +#define NID_id_pkix_OCSP_acceptableResponses 368 +#define OBJ_id_pkix_OCSP_acceptableResponses OBJ_id_pkix_OCSP,4L + +#define SN_id_pkix_OCSP_noCheck "noCheck" +#define LN_id_pkix_OCSP_noCheck "OCSP No Check" +#define NID_id_pkix_OCSP_noCheck 369 +#define OBJ_id_pkix_OCSP_noCheck OBJ_id_pkix_OCSP,5L + +#define SN_id_pkix_OCSP_archiveCutoff "archiveCutoff" +#define LN_id_pkix_OCSP_archiveCutoff "OCSP Archive Cutoff" +#define NID_id_pkix_OCSP_archiveCutoff 370 +#define OBJ_id_pkix_OCSP_archiveCutoff OBJ_id_pkix_OCSP,6L + +#define SN_id_pkix_OCSP_serviceLocator "serviceLocator" +#define LN_id_pkix_OCSP_serviceLocator "OCSP Service Locator" +#define NID_id_pkix_OCSP_serviceLocator 371 +#define OBJ_id_pkix_OCSP_serviceLocator OBJ_id_pkix_OCSP,7L + +#define SN_id_pkix_OCSP_extendedStatus "extendedStatus" +#define LN_id_pkix_OCSP_extendedStatus "Extended OCSP Status" +#define NID_id_pkix_OCSP_extendedStatus 372 +#define OBJ_id_pkix_OCSP_extendedStatus OBJ_id_pkix_OCSP,8L + +#define SN_id_pkix_OCSP_valid "valid" +#define NID_id_pkix_OCSP_valid 373 +#define OBJ_id_pkix_OCSP_valid OBJ_id_pkix_OCSP,9L + +#define SN_id_pkix_OCSP_path "path" +#define NID_id_pkix_OCSP_path 374 +#define OBJ_id_pkix_OCSP_path OBJ_id_pkix_OCSP,10L + +#define SN_id_pkix_OCSP_trustRoot "trustRoot" +#define LN_id_pkix_OCSP_trustRoot "Trust Root" +#define NID_id_pkix_OCSP_trustRoot 375 +#define OBJ_id_pkix_OCSP_trustRoot OBJ_id_pkix_OCSP,11L + +#define SN_algorithm "algorithm" +#define LN_algorithm "algorithm" +#define NID_algorithm 376 +#define OBJ_algorithm 1L,3L,14L,3L,2L + +#define SN_md5WithRSA "RSA-NP-MD5" +#define LN_md5WithRSA "md5WithRSA" +#define NID_md5WithRSA 104 +#define OBJ_md5WithRSA OBJ_algorithm,3L + +#define SN_des_ecb "DES-ECB" +#define LN_des_ecb "des-ecb" +#define NID_des_ecb 29 +#define OBJ_des_ecb OBJ_algorithm,6L + +#define SN_des_cbc "DES-CBC" +#define LN_des_cbc "des-cbc" +#define NID_des_cbc 31 +#define OBJ_des_cbc OBJ_algorithm,7L + +#define SN_des_ofb64 "DES-OFB" +#define LN_des_ofb64 "des-ofb" +#define NID_des_ofb64 45 +#define OBJ_des_ofb64 OBJ_algorithm,8L + +#define SN_des_cfb64 "DES-CFB" +#define LN_des_cfb64 "des-cfb" +#define NID_des_cfb64 30 +#define OBJ_des_cfb64 OBJ_algorithm,9L + +#define SN_rsaSignature "rsaSignature" +#define NID_rsaSignature 377 +#define OBJ_rsaSignature OBJ_algorithm,11L + +#define SN_dsa_2 "DSA-old" +#define LN_dsa_2 "dsaEncryption-old" +#define NID_dsa_2 67 +#define OBJ_dsa_2 OBJ_algorithm,12L + +#define SN_dsaWithSHA "DSA-SHA" +#define LN_dsaWithSHA "dsaWithSHA" +#define NID_dsaWithSHA 66 +#define OBJ_dsaWithSHA OBJ_algorithm,13L + +#define SN_shaWithRSAEncryption "RSA-SHA" +#define LN_shaWithRSAEncryption "shaWithRSAEncryption" +#define NID_shaWithRSAEncryption 42 +#define OBJ_shaWithRSAEncryption OBJ_algorithm,15L + +#define SN_des_ede_ecb "DES-EDE" +#define LN_des_ede_ecb "des-ede" +#define NID_des_ede_ecb 32 +#define OBJ_des_ede_ecb OBJ_algorithm,17L + +#define SN_des_ede3_ecb "DES-EDE3" +#define LN_des_ede3_ecb "des-ede3" +#define NID_des_ede3_ecb 33 + +#define SN_des_ede_cbc "DES-EDE-CBC" +#define LN_des_ede_cbc "des-ede-cbc" +#define NID_des_ede_cbc 43 + +#define SN_des_ede_cfb64 "DES-EDE-CFB" +#define LN_des_ede_cfb64 "des-ede-cfb" +#define NID_des_ede_cfb64 60 + +#define SN_des_ede3_cfb64 "DES-EDE3-CFB" +#define LN_des_ede3_cfb64 "des-ede3-cfb" +#define NID_des_ede3_cfb64 61 + +#define SN_des_ede_ofb64 "DES-EDE-OFB" +#define LN_des_ede_ofb64 "des-ede-ofb" +#define NID_des_ede_ofb64 62 + +#define SN_des_ede3_ofb64 "DES-EDE3-OFB" +#define LN_des_ede3_ofb64 "des-ede3-ofb" +#define NID_des_ede3_ofb64 63 + +#define SN_desx_cbc "DESX-CBC" +#define LN_desx_cbc "desx-cbc" +#define NID_desx_cbc 80 + +#define SN_sha "SHA" +#define LN_sha "sha" +#define NID_sha 41 +#define OBJ_sha OBJ_algorithm,18L + +#define SN_sha1 "SHA1" +#define LN_sha1 "sha1" +#define NID_sha1 64 +#define OBJ_sha1 OBJ_algorithm,26L + +#define SN_dsaWithSHA1_2 "DSA-SHA1-old" +#define LN_dsaWithSHA1_2 "dsaWithSHA1-old" +#define NID_dsaWithSHA1_2 70 +#define OBJ_dsaWithSHA1_2 OBJ_algorithm,27L + +#define SN_sha1WithRSA "RSA-SHA1-2" +#define LN_sha1WithRSA "sha1WithRSA" +#define NID_sha1WithRSA 115 +#define OBJ_sha1WithRSA OBJ_algorithm,29L + +#define SN_ripemd160 "RIPEMD160" +#define LN_ripemd160 "ripemd160" +#define NID_ripemd160 117 +#define OBJ_ripemd160 1L,3L,36L,3L,2L,1L + +#define SN_ripemd160WithRSA "RSA-RIPEMD160" +#define LN_ripemd160WithRSA "ripemd160WithRSA" +#define NID_ripemd160WithRSA 119 +#define OBJ_ripemd160WithRSA 1L,3L,36L,3L,3L,1L,2L + +#define SN_sxnet "SXNetID" +#define LN_sxnet "Strong Extranet ID" +#define NID_sxnet 143 +#define OBJ_sxnet 1L,3L,101L,1L,4L,1L + +#define SN_X500 "X500" +#define LN_X500 "directory services (X.500)" +#define NID_X500 11 +#define OBJ_X500 2L,5L + +#define SN_X509 "X509" +#define NID_X509 12 +#define OBJ_X509 OBJ_X500,4L + +#define SN_commonName "CN" +#define LN_commonName "commonName" +#define NID_commonName 13 +#define OBJ_commonName OBJ_X509,3L + +#define SN_surname "SN" +#define LN_surname "surname" +#define NID_surname 100 +#define OBJ_surname OBJ_X509,4L + +#define LN_serialNumber "serialNumber" +#define NID_serialNumber 105 +#define OBJ_serialNumber OBJ_X509,5L + +#define SN_countryName "C" +#define LN_countryName "countryName" +#define NID_countryName 14 +#define OBJ_countryName OBJ_X509,6L + +#define SN_localityName "L" +#define LN_localityName "localityName" +#define NID_localityName 15 +#define OBJ_localityName OBJ_X509,7L + +#define SN_stateOrProvinceName "ST" +#define LN_stateOrProvinceName "stateOrProvinceName" +#define NID_stateOrProvinceName 16 +#define OBJ_stateOrProvinceName OBJ_X509,8L + +#define LN_streetAddress "streetAddress" +#define NID_streetAddress 660 +#define OBJ_streetAddress OBJ_X509,9L + +#define SN_organizationName "O" +#define LN_organizationName "organizationName" +#define NID_organizationName 17 +#define OBJ_organizationName OBJ_X509,10L + +#define SN_organizationalUnitName "OU" +#define LN_organizationalUnitName "organizationalUnitName" +#define NID_organizationalUnitName 18 +#define OBJ_organizationalUnitName OBJ_X509,11L + +#define LN_title "title" +#define NID_title 106 +#define OBJ_title OBJ_X509,12L + +#define LN_description "description" +#define NID_description 107 +#define OBJ_description OBJ_X509,13L + +#define LN_postalCode "postalCode" +#define NID_postalCode 661 +#define OBJ_postalCode OBJ_X509,17L + +#define SN_name "name" +#define LN_name "name" +#define NID_name 173 +#define OBJ_name OBJ_X509,41L + +#define SN_givenName "GN" +#define LN_givenName "givenName" +#define NID_givenName 99 +#define OBJ_givenName OBJ_X509,42L + +#define LN_initials "initials" +#define NID_initials 101 +#define OBJ_initials OBJ_X509,43L + +#define LN_generationQualifier "generationQualifier" +#define NID_generationQualifier 509 +#define OBJ_generationQualifier OBJ_X509,44L + +#define LN_x500UniqueIdentifier "x500UniqueIdentifier" +#define NID_x500UniqueIdentifier 503 +#define OBJ_x500UniqueIdentifier OBJ_X509,45L + +#define SN_dnQualifier "dnQualifier" +#define LN_dnQualifier "dnQualifier" +#define NID_dnQualifier 174 +#define OBJ_dnQualifier OBJ_X509,46L + +#define LN_pseudonym "pseudonym" +#define NID_pseudonym 510 +#define OBJ_pseudonym OBJ_X509,65L + +#define SN_role "role" +#define LN_role "role" +#define NID_role 400 +#define OBJ_role OBJ_X509,72L + +#define SN_X500algorithms "X500algorithms" +#define LN_X500algorithms "directory services - algorithms" +#define NID_X500algorithms 378 +#define OBJ_X500algorithms OBJ_X500,8L + +#define SN_rsa "RSA" +#define LN_rsa "rsa" +#define NID_rsa 19 +#define OBJ_rsa OBJ_X500algorithms,1L,1L + +#define SN_mdc2WithRSA "RSA-MDC2" +#define LN_mdc2WithRSA "mdc2WithRSA" +#define NID_mdc2WithRSA 96 +#define OBJ_mdc2WithRSA OBJ_X500algorithms,3L,100L + +#define SN_mdc2 "MDC2" +#define LN_mdc2 "mdc2" +#define NID_mdc2 95 +#define OBJ_mdc2 OBJ_X500algorithms,3L,101L + +#define SN_id_ce "id-ce" +#define NID_id_ce 81 +#define OBJ_id_ce OBJ_X500,29L + +#define SN_subject_key_identifier "subjectKeyIdentifier" +#define LN_subject_key_identifier "X509v3 Subject Key Identifier" +#define NID_subject_key_identifier 82 +#define OBJ_subject_key_identifier OBJ_id_ce,14L + +#define SN_key_usage "keyUsage" +#define LN_key_usage "X509v3 Key Usage" +#define NID_key_usage 83 +#define OBJ_key_usage OBJ_id_ce,15L + +#define SN_private_key_usage_period "privateKeyUsagePeriod" +#define LN_private_key_usage_period "X509v3 Private Key Usage Period" +#define NID_private_key_usage_period 84 +#define OBJ_private_key_usage_period OBJ_id_ce,16L + +#define SN_subject_alt_name "subjectAltName" +#define LN_subject_alt_name "X509v3 Subject Alternative Name" +#define NID_subject_alt_name 85 +#define OBJ_subject_alt_name OBJ_id_ce,17L + +#define SN_issuer_alt_name "issuerAltName" +#define LN_issuer_alt_name "X509v3 Issuer Alternative Name" +#define NID_issuer_alt_name 86 +#define OBJ_issuer_alt_name OBJ_id_ce,18L + +#define SN_basic_constraints "basicConstraints" +#define LN_basic_constraints "X509v3 Basic Constraints" +#define NID_basic_constraints 87 +#define OBJ_basic_constraints OBJ_id_ce,19L + +#define SN_crl_number "crlNumber" +#define LN_crl_number "X509v3 CRL Number" +#define NID_crl_number 88 +#define OBJ_crl_number OBJ_id_ce,20L + +#define SN_crl_reason "CRLReason" +#define LN_crl_reason "X509v3 CRL Reason Code" +#define NID_crl_reason 141 +#define OBJ_crl_reason OBJ_id_ce,21L + +#define SN_invalidity_date "invalidityDate" +#define LN_invalidity_date "Invalidity Date" +#define NID_invalidity_date 142 +#define OBJ_invalidity_date OBJ_id_ce,24L + +#define SN_delta_crl "deltaCRL" +#define LN_delta_crl "X509v3 Delta CRL Indicator" +#define NID_delta_crl 140 +#define OBJ_delta_crl OBJ_id_ce,27L + +#define SN_name_constraints "nameConstraints" +#define LN_name_constraints "X509v3 Name Constraints" +#define NID_name_constraints 666 +#define OBJ_name_constraints OBJ_id_ce,30L + +#define SN_crl_distribution_points "crlDistributionPoints" +#define LN_crl_distribution_points "X509v3 CRL Distribution Points" +#define NID_crl_distribution_points 103 +#define OBJ_crl_distribution_points OBJ_id_ce,31L + +#define SN_certificate_policies "certificatePolicies" +#define LN_certificate_policies "X509v3 Certificate Policies" +#define NID_certificate_policies 89 +#define OBJ_certificate_policies OBJ_id_ce,32L + +#define SN_any_policy "anyPolicy" +#define LN_any_policy "X509v3 Any Policy" +#define NID_any_policy 746 +#define OBJ_any_policy OBJ_certificate_policies,0L + +#define SN_policy_mappings "policyMappings" +#define LN_policy_mappings "X509v3 Policy Mappings" +#define NID_policy_mappings 747 +#define OBJ_policy_mappings OBJ_id_ce,33L + +#define SN_authority_key_identifier "authorityKeyIdentifier" +#define LN_authority_key_identifier "X509v3 Authority Key Identifier" +#define NID_authority_key_identifier 90 +#define OBJ_authority_key_identifier OBJ_id_ce,35L + +#define SN_policy_constraints "policyConstraints" +#define LN_policy_constraints "X509v3 Policy Constraints" +#define NID_policy_constraints 401 +#define OBJ_policy_constraints OBJ_id_ce,36L + +#define SN_ext_key_usage "extendedKeyUsage" +#define LN_ext_key_usage "X509v3 Extended Key Usage" +#define NID_ext_key_usage 126 +#define OBJ_ext_key_usage OBJ_id_ce,37L + +#define SN_inhibit_any_policy "inhibitAnyPolicy" +#define LN_inhibit_any_policy "X509v3 Inhibit Any Policy" +#define NID_inhibit_any_policy 748 +#define OBJ_inhibit_any_policy OBJ_id_ce,54L + +#define SN_target_information "targetInformation" +#define LN_target_information "X509v3 AC Targeting" +#define NID_target_information 402 +#define OBJ_target_information OBJ_id_ce,55L + +#define SN_no_rev_avail "noRevAvail" +#define LN_no_rev_avail "X509v3 No Revocation Available" +#define NID_no_rev_avail 403 +#define OBJ_no_rev_avail OBJ_id_ce,56L + +#define SN_netscape "Netscape" +#define LN_netscape "Netscape Communications Corp." +#define NID_netscape 57 +#define OBJ_netscape 2L,16L,840L,1L,113730L + +#define SN_netscape_cert_extension "nsCertExt" +#define LN_netscape_cert_extension "Netscape Certificate Extension" +#define NID_netscape_cert_extension 58 +#define OBJ_netscape_cert_extension OBJ_netscape,1L + +#define SN_netscape_data_type "nsDataType" +#define LN_netscape_data_type "Netscape Data Type" +#define NID_netscape_data_type 59 +#define OBJ_netscape_data_type OBJ_netscape,2L + +#define SN_netscape_cert_type "nsCertType" +#define LN_netscape_cert_type "Netscape Cert Type" +#define NID_netscape_cert_type 71 +#define OBJ_netscape_cert_type OBJ_netscape_cert_extension,1L + +#define SN_netscape_base_url "nsBaseUrl" +#define LN_netscape_base_url "Netscape Base Url" +#define NID_netscape_base_url 72 +#define OBJ_netscape_base_url OBJ_netscape_cert_extension,2L + +#define SN_netscape_revocation_url "nsRevocationUrl" +#define LN_netscape_revocation_url "Netscape Revocation Url" +#define NID_netscape_revocation_url 73 +#define OBJ_netscape_revocation_url OBJ_netscape_cert_extension,3L + +#define SN_netscape_ca_revocation_url "nsCaRevocationUrl" +#define LN_netscape_ca_revocation_url "Netscape CA Revocation Url" +#define NID_netscape_ca_revocation_url 74 +#define OBJ_netscape_ca_revocation_url OBJ_netscape_cert_extension,4L + +#define SN_netscape_renewal_url "nsRenewalUrl" +#define LN_netscape_renewal_url "Netscape Renewal Url" +#define NID_netscape_renewal_url 75 +#define OBJ_netscape_renewal_url OBJ_netscape_cert_extension,7L + +#define SN_netscape_ca_policy_url "nsCaPolicyUrl" +#define LN_netscape_ca_policy_url "Netscape CA Policy Url" +#define NID_netscape_ca_policy_url 76 +#define OBJ_netscape_ca_policy_url OBJ_netscape_cert_extension,8L + +#define SN_netscape_ssl_server_name "nsSslServerName" +#define LN_netscape_ssl_server_name "Netscape SSL Server Name" +#define NID_netscape_ssl_server_name 77 +#define OBJ_netscape_ssl_server_name OBJ_netscape_cert_extension,12L + +#define SN_netscape_comment "nsComment" +#define LN_netscape_comment "Netscape Comment" +#define NID_netscape_comment 78 +#define OBJ_netscape_comment OBJ_netscape_cert_extension,13L + +#define SN_netscape_cert_sequence "nsCertSequence" +#define LN_netscape_cert_sequence "Netscape Certificate Sequence" +#define NID_netscape_cert_sequence 79 +#define OBJ_netscape_cert_sequence OBJ_netscape_data_type,5L + +#define SN_ns_sgc "nsSGC" +#define LN_ns_sgc "Netscape Server Gated Crypto" +#define NID_ns_sgc 139 +#define OBJ_ns_sgc OBJ_netscape,4L,1L + +#define SN_org "ORG" +#define LN_org "org" +#define NID_org 379 +#define OBJ_org OBJ_iso,3L + +#define SN_dod "DOD" +#define LN_dod "dod" +#define NID_dod 380 +#define OBJ_dod OBJ_org,6L + +#define SN_iana "IANA" +#define LN_iana "iana" +#define NID_iana 381 +#define OBJ_iana OBJ_dod,1L + +#define OBJ_internet OBJ_iana + +#define SN_Directory "directory" +#define LN_Directory "Directory" +#define NID_Directory 382 +#define OBJ_Directory OBJ_internet,1L + +#define SN_Management "mgmt" +#define LN_Management "Management" +#define NID_Management 383 +#define OBJ_Management OBJ_internet,2L + +#define SN_Experimental "experimental" +#define LN_Experimental "Experimental" +#define NID_Experimental 384 +#define OBJ_Experimental OBJ_internet,3L + +#define SN_Private "private" +#define LN_Private "Private" +#define NID_Private 385 +#define OBJ_Private OBJ_internet,4L + +#define SN_Security "security" +#define LN_Security "Security" +#define NID_Security 386 +#define OBJ_Security OBJ_internet,5L + +#define SN_SNMPv2 "snmpv2" +#define LN_SNMPv2 "SNMPv2" +#define NID_SNMPv2 387 +#define OBJ_SNMPv2 OBJ_internet,6L + +#define LN_Mail "Mail" +#define NID_Mail 388 +#define OBJ_Mail OBJ_internet,7L + +#define SN_Enterprises "enterprises" +#define LN_Enterprises "Enterprises" +#define NID_Enterprises 389 +#define OBJ_Enterprises OBJ_Private,1L + +#define SN_dcObject "dcobject" +#define LN_dcObject "dcObject" +#define NID_dcObject 390 +#define OBJ_dcObject OBJ_Enterprises,1466L,344L + +#define SN_mime_mhs "mime-mhs" +#define LN_mime_mhs "MIME MHS" +#define NID_mime_mhs 504 +#define OBJ_mime_mhs OBJ_Mail,1L + +#define SN_mime_mhs_headings "mime-mhs-headings" +#define LN_mime_mhs_headings "mime-mhs-headings" +#define NID_mime_mhs_headings 505 +#define OBJ_mime_mhs_headings OBJ_mime_mhs,1L + +#define SN_mime_mhs_bodies "mime-mhs-bodies" +#define LN_mime_mhs_bodies "mime-mhs-bodies" +#define NID_mime_mhs_bodies 506 +#define OBJ_mime_mhs_bodies OBJ_mime_mhs,2L + +#define SN_id_hex_partial_message "id-hex-partial-message" +#define LN_id_hex_partial_message "id-hex-partial-message" +#define NID_id_hex_partial_message 507 +#define OBJ_id_hex_partial_message OBJ_mime_mhs_headings,1L + +#define SN_id_hex_multipart_message "id-hex-multipart-message" +#define LN_id_hex_multipart_message "id-hex-multipart-message" +#define NID_id_hex_multipart_message 508 +#define OBJ_id_hex_multipart_message OBJ_mime_mhs_headings,2L + +#define SN_rle_compression "RLE" +#define LN_rle_compression "run length compression" +#define NID_rle_compression 124 +#define OBJ_rle_compression 1L,1L,1L,1L,666L,1L + +#define SN_zlib_compression "ZLIB" +#define LN_zlib_compression "zlib compression" +#define NID_zlib_compression 125 +#define OBJ_zlib_compression 1L,1L,1L,1L,666L,2L + +#define OBJ_csor 2L,16L,840L,1L,101L,3L + +#define OBJ_nistAlgorithms OBJ_csor,4L + +#define OBJ_aes OBJ_nistAlgorithms,1L + +#define SN_aes_128_ecb "AES-128-ECB" +#define LN_aes_128_ecb "aes-128-ecb" +#define NID_aes_128_ecb 418 +#define OBJ_aes_128_ecb OBJ_aes,1L + +#define SN_aes_128_cbc "AES-128-CBC" +#define LN_aes_128_cbc "aes-128-cbc" +#define NID_aes_128_cbc 419 +#define OBJ_aes_128_cbc OBJ_aes,2L + +#define SN_aes_128_ofb128 "AES-128-OFB" +#define LN_aes_128_ofb128 "aes-128-ofb" +#define NID_aes_128_ofb128 420 +#define OBJ_aes_128_ofb128 OBJ_aes,3L + +#define SN_aes_128_cfb128 "AES-128-CFB" +#define LN_aes_128_cfb128 "aes-128-cfb" +#define NID_aes_128_cfb128 421 +#define OBJ_aes_128_cfb128 OBJ_aes,4L + +#define SN_aes_192_ecb "AES-192-ECB" +#define LN_aes_192_ecb "aes-192-ecb" +#define NID_aes_192_ecb 422 +#define OBJ_aes_192_ecb OBJ_aes,21L + +#define SN_aes_192_cbc "AES-192-CBC" +#define LN_aes_192_cbc "aes-192-cbc" +#define NID_aes_192_cbc 423 +#define OBJ_aes_192_cbc OBJ_aes,22L + +#define SN_aes_192_ofb128 "AES-192-OFB" +#define LN_aes_192_ofb128 "aes-192-ofb" +#define NID_aes_192_ofb128 424 +#define OBJ_aes_192_ofb128 OBJ_aes,23L + +#define SN_aes_192_cfb128 "AES-192-CFB" +#define LN_aes_192_cfb128 "aes-192-cfb" +#define NID_aes_192_cfb128 425 +#define OBJ_aes_192_cfb128 OBJ_aes,24L + +#define SN_aes_256_ecb "AES-256-ECB" +#define LN_aes_256_ecb "aes-256-ecb" +#define NID_aes_256_ecb 426 +#define OBJ_aes_256_ecb OBJ_aes,41L + +#define SN_aes_256_cbc "AES-256-CBC" +#define LN_aes_256_cbc "aes-256-cbc" +#define NID_aes_256_cbc 427 +#define OBJ_aes_256_cbc OBJ_aes,42L + +#define SN_aes_256_ofb128 "AES-256-OFB" +#define LN_aes_256_ofb128 "aes-256-ofb" +#define NID_aes_256_ofb128 428 +#define OBJ_aes_256_ofb128 OBJ_aes,43L + +#define SN_aes_256_cfb128 "AES-256-CFB" +#define LN_aes_256_cfb128 "aes-256-cfb" +#define NID_aes_256_cfb128 429 +#define OBJ_aes_256_cfb128 OBJ_aes,44L + +#define SN_aes_128_cfb1 "AES-128-CFB1" +#define LN_aes_128_cfb1 "aes-128-cfb1" +#define NID_aes_128_cfb1 650 + +#define SN_aes_192_cfb1 "AES-192-CFB1" +#define LN_aes_192_cfb1 "aes-192-cfb1" +#define NID_aes_192_cfb1 651 + +#define SN_aes_256_cfb1 "AES-256-CFB1" +#define LN_aes_256_cfb1 "aes-256-cfb1" +#define NID_aes_256_cfb1 652 + +#define SN_aes_128_cfb8 "AES-128-CFB8" +#define LN_aes_128_cfb8 "aes-128-cfb8" +#define NID_aes_128_cfb8 653 + +#define SN_aes_192_cfb8 "AES-192-CFB8" +#define LN_aes_192_cfb8 "aes-192-cfb8" +#define NID_aes_192_cfb8 654 + +#define SN_aes_256_cfb8 "AES-256-CFB8" +#define LN_aes_256_cfb8 "aes-256-cfb8" +#define NID_aes_256_cfb8 655 + +#define SN_des_cfb1 "DES-CFB1" +#define LN_des_cfb1 "des-cfb1" +#define NID_des_cfb1 656 + +#define SN_des_cfb8 "DES-CFB8" +#define LN_des_cfb8 "des-cfb8" +#define NID_des_cfb8 657 + +#define SN_des_ede3_cfb1 "DES-EDE3-CFB1" +#define LN_des_ede3_cfb1 "des-ede3-cfb1" +#define NID_des_ede3_cfb1 658 + +#define SN_des_ede3_cfb8 "DES-EDE3-CFB8" +#define LN_des_ede3_cfb8 "des-ede3-cfb8" +#define NID_des_ede3_cfb8 659 + +#define OBJ_nist_hashalgs OBJ_nistAlgorithms,2L + +#define SN_sha256 "SHA256" +#define LN_sha256 "sha256" +#define NID_sha256 672 +#define OBJ_sha256 OBJ_nist_hashalgs,1L + +#define SN_sha384 "SHA384" +#define LN_sha384 "sha384" +#define NID_sha384 673 +#define OBJ_sha384 OBJ_nist_hashalgs,2L + +#define SN_sha512 "SHA512" +#define LN_sha512 "sha512" +#define NID_sha512 674 +#define OBJ_sha512 OBJ_nist_hashalgs,3L + +#define SN_sha224 "SHA224" +#define LN_sha224 "sha224" +#define NID_sha224 675 +#define OBJ_sha224 OBJ_nist_hashalgs,4L + +#define SN_hold_instruction_code "holdInstructionCode" +#define LN_hold_instruction_code "Hold Instruction Code" +#define NID_hold_instruction_code 430 +#define OBJ_hold_instruction_code OBJ_id_ce,23L + +#define OBJ_holdInstruction OBJ_X9_57,2L + +#define SN_hold_instruction_none "holdInstructionNone" +#define LN_hold_instruction_none "Hold Instruction None" +#define NID_hold_instruction_none 431 +#define OBJ_hold_instruction_none OBJ_holdInstruction,1L + +#define SN_hold_instruction_call_issuer "holdInstructionCallIssuer" +#define LN_hold_instruction_call_issuer "Hold Instruction Call Issuer" +#define NID_hold_instruction_call_issuer 432 +#define OBJ_hold_instruction_call_issuer OBJ_holdInstruction,2L + +#define SN_hold_instruction_reject "holdInstructionReject" +#define LN_hold_instruction_reject "Hold Instruction Reject" +#define NID_hold_instruction_reject 433 +#define OBJ_hold_instruction_reject OBJ_holdInstruction,3L + +#define SN_data "data" +#define NID_data 434 +#define OBJ_data OBJ_itu_t,9L + +#define SN_pss "pss" +#define NID_pss 435 +#define OBJ_pss OBJ_data,2342L + +#define SN_ucl "ucl" +#define NID_ucl 436 +#define OBJ_ucl OBJ_pss,19200300L + +#define SN_pilot "pilot" +#define NID_pilot 437 +#define OBJ_pilot OBJ_ucl,100L + +#define LN_pilotAttributeType "pilotAttributeType" +#define NID_pilotAttributeType 438 +#define OBJ_pilotAttributeType OBJ_pilot,1L + +#define LN_pilotAttributeSyntax "pilotAttributeSyntax" +#define NID_pilotAttributeSyntax 439 +#define OBJ_pilotAttributeSyntax OBJ_pilot,3L + +#define LN_pilotObjectClass "pilotObjectClass" +#define NID_pilotObjectClass 440 +#define OBJ_pilotObjectClass OBJ_pilot,4L + +#define LN_pilotGroups "pilotGroups" +#define NID_pilotGroups 441 +#define OBJ_pilotGroups OBJ_pilot,10L + +#define LN_iA5StringSyntax "iA5StringSyntax" +#define NID_iA5StringSyntax 442 +#define OBJ_iA5StringSyntax OBJ_pilotAttributeSyntax,4L + +#define LN_caseIgnoreIA5StringSyntax "caseIgnoreIA5StringSyntax" +#define NID_caseIgnoreIA5StringSyntax 443 +#define OBJ_caseIgnoreIA5StringSyntax OBJ_pilotAttributeSyntax,5L + +#define LN_pilotObject "pilotObject" +#define NID_pilotObject 444 +#define OBJ_pilotObject OBJ_pilotObjectClass,3L + +#define LN_pilotPerson "pilotPerson" +#define NID_pilotPerson 445 +#define OBJ_pilotPerson OBJ_pilotObjectClass,4L + +#define SN_account "account" +#define NID_account 446 +#define OBJ_account OBJ_pilotObjectClass,5L + +#define SN_document "document" +#define NID_document 447 +#define OBJ_document OBJ_pilotObjectClass,6L + +#define SN_room "room" +#define NID_room 448 +#define OBJ_room OBJ_pilotObjectClass,7L + +#define LN_documentSeries "documentSeries" +#define NID_documentSeries 449 +#define OBJ_documentSeries OBJ_pilotObjectClass,9L + +#define SN_Domain "domain" +#define LN_Domain "Domain" +#define NID_Domain 392 +#define OBJ_Domain OBJ_pilotObjectClass,13L + +#define LN_rFC822localPart "rFC822localPart" +#define NID_rFC822localPart 450 +#define OBJ_rFC822localPart OBJ_pilotObjectClass,14L + +#define LN_dNSDomain "dNSDomain" +#define NID_dNSDomain 451 +#define OBJ_dNSDomain OBJ_pilotObjectClass,15L + +#define LN_domainRelatedObject "domainRelatedObject" +#define NID_domainRelatedObject 452 +#define OBJ_domainRelatedObject OBJ_pilotObjectClass,17L + +#define LN_friendlyCountry "friendlyCountry" +#define NID_friendlyCountry 453 +#define OBJ_friendlyCountry OBJ_pilotObjectClass,18L + +#define LN_simpleSecurityObject "simpleSecurityObject" +#define NID_simpleSecurityObject 454 +#define OBJ_simpleSecurityObject OBJ_pilotObjectClass,19L + +#define LN_pilotOrganization "pilotOrganization" +#define NID_pilotOrganization 455 +#define OBJ_pilotOrganization OBJ_pilotObjectClass,20L + +#define LN_pilotDSA "pilotDSA" +#define NID_pilotDSA 456 +#define OBJ_pilotDSA OBJ_pilotObjectClass,21L + +#define LN_qualityLabelledData "qualityLabelledData" +#define NID_qualityLabelledData 457 +#define OBJ_qualityLabelledData OBJ_pilotObjectClass,22L + +#define SN_userId "UID" +#define LN_userId "userId" +#define NID_userId 458 +#define OBJ_userId OBJ_pilotAttributeType,1L + +#define LN_textEncodedORAddress "textEncodedORAddress" +#define NID_textEncodedORAddress 459 +#define OBJ_textEncodedORAddress OBJ_pilotAttributeType,2L + +#define SN_rfc822Mailbox "mail" +#define LN_rfc822Mailbox "rfc822Mailbox" +#define NID_rfc822Mailbox 460 +#define OBJ_rfc822Mailbox OBJ_pilotAttributeType,3L + +#define SN_info "info" +#define NID_info 461 +#define OBJ_info OBJ_pilotAttributeType,4L + +#define LN_favouriteDrink "favouriteDrink" +#define NID_favouriteDrink 462 +#define OBJ_favouriteDrink OBJ_pilotAttributeType,5L + +#define LN_roomNumber "roomNumber" +#define NID_roomNumber 463 +#define OBJ_roomNumber OBJ_pilotAttributeType,6L + +#define SN_photo "photo" +#define NID_photo 464 +#define OBJ_photo OBJ_pilotAttributeType,7L + +#define LN_userClass "userClass" +#define NID_userClass 465 +#define OBJ_userClass OBJ_pilotAttributeType,8L + +#define SN_host "host" +#define NID_host 466 +#define OBJ_host OBJ_pilotAttributeType,9L + +#define SN_manager "manager" +#define NID_manager 467 +#define OBJ_manager OBJ_pilotAttributeType,10L + +#define LN_documentIdentifier "documentIdentifier" +#define NID_documentIdentifier 468 +#define OBJ_documentIdentifier OBJ_pilotAttributeType,11L + +#define LN_documentTitle "documentTitle" +#define NID_documentTitle 469 +#define OBJ_documentTitle OBJ_pilotAttributeType,12L + +#define LN_documentVersion "documentVersion" +#define NID_documentVersion 470 +#define OBJ_documentVersion OBJ_pilotAttributeType,13L + +#define LN_documentAuthor "documentAuthor" +#define NID_documentAuthor 471 +#define OBJ_documentAuthor OBJ_pilotAttributeType,14L + +#define LN_documentLocation "documentLocation" +#define NID_documentLocation 472 +#define OBJ_documentLocation OBJ_pilotAttributeType,15L + +#define LN_homeTelephoneNumber "homeTelephoneNumber" +#define NID_homeTelephoneNumber 473 +#define OBJ_homeTelephoneNumber OBJ_pilotAttributeType,20L + +#define SN_secretary "secretary" +#define NID_secretary 474 +#define OBJ_secretary OBJ_pilotAttributeType,21L + +#define LN_otherMailbox "otherMailbox" +#define NID_otherMailbox 475 +#define OBJ_otherMailbox OBJ_pilotAttributeType,22L + +#define LN_lastModifiedTime "lastModifiedTime" +#define NID_lastModifiedTime 476 +#define OBJ_lastModifiedTime OBJ_pilotAttributeType,23L + +#define LN_lastModifiedBy "lastModifiedBy" +#define NID_lastModifiedBy 477 +#define OBJ_lastModifiedBy OBJ_pilotAttributeType,24L + +#define SN_domainComponent "DC" +#define LN_domainComponent "domainComponent" +#define NID_domainComponent 391 +#define OBJ_domainComponent OBJ_pilotAttributeType,25L + +#define LN_aRecord "aRecord" +#define NID_aRecord 478 +#define OBJ_aRecord OBJ_pilotAttributeType,26L + +#define LN_pilotAttributeType27 "pilotAttributeType27" +#define NID_pilotAttributeType27 479 +#define OBJ_pilotAttributeType27 OBJ_pilotAttributeType,27L + +#define LN_mXRecord "mXRecord" +#define NID_mXRecord 480 +#define OBJ_mXRecord OBJ_pilotAttributeType,28L + +#define LN_nSRecord "nSRecord" +#define NID_nSRecord 481 +#define OBJ_nSRecord OBJ_pilotAttributeType,29L + +#define LN_sOARecord "sOARecord" +#define NID_sOARecord 482 +#define OBJ_sOARecord OBJ_pilotAttributeType,30L + +#define LN_cNAMERecord "cNAMERecord" +#define NID_cNAMERecord 483 +#define OBJ_cNAMERecord OBJ_pilotAttributeType,31L + +#define LN_associatedDomain "associatedDomain" +#define NID_associatedDomain 484 +#define OBJ_associatedDomain OBJ_pilotAttributeType,37L + +#define LN_associatedName "associatedName" +#define NID_associatedName 485 +#define OBJ_associatedName OBJ_pilotAttributeType,38L + +#define LN_homePostalAddress "homePostalAddress" +#define NID_homePostalAddress 486 +#define OBJ_homePostalAddress OBJ_pilotAttributeType,39L + +#define LN_personalTitle "personalTitle" +#define NID_personalTitle 487 +#define OBJ_personalTitle OBJ_pilotAttributeType,40L + +#define LN_mobileTelephoneNumber "mobileTelephoneNumber" +#define NID_mobileTelephoneNumber 488 +#define OBJ_mobileTelephoneNumber OBJ_pilotAttributeType,41L + +#define LN_pagerTelephoneNumber "pagerTelephoneNumber" +#define NID_pagerTelephoneNumber 489 +#define OBJ_pagerTelephoneNumber OBJ_pilotAttributeType,42L + +#define LN_friendlyCountryName "friendlyCountryName" +#define NID_friendlyCountryName 490 +#define OBJ_friendlyCountryName OBJ_pilotAttributeType,43L + +#define LN_organizationalStatus "organizationalStatus" +#define NID_organizationalStatus 491 +#define OBJ_organizationalStatus OBJ_pilotAttributeType,45L + +#define LN_janetMailbox "janetMailbox" +#define NID_janetMailbox 492 +#define OBJ_janetMailbox OBJ_pilotAttributeType,46L + +#define LN_mailPreferenceOption "mailPreferenceOption" +#define NID_mailPreferenceOption 493 +#define OBJ_mailPreferenceOption OBJ_pilotAttributeType,47L + +#define LN_buildingName "buildingName" +#define NID_buildingName 494 +#define OBJ_buildingName OBJ_pilotAttributeType,48L + +#define LN_dSAQuality "dSAQuality" +#define NID_dSAQuality 495 +#define OBJ_dSAQuality OBJ_pilotAttributeType,49L + +#define LN_singleLevelQuality "singleLevelQuality" +#define NID_singleLevelQuality 496 +#define OBJ_singleLevelQuality OBJ_pilotAttributeType,50L + +#define LN_subtreeMinimumQuality "subtreeMinimumQuality" +#define NID_subtreeMinimumQuality 497 +#define OBJ_subtreeMinimumQuality OBJ_pilotAttributeType,51L + +#define LN_subtreeMaximumQuality "subtreeMaximumQuality" +#define NID_subtreeMaximumQuality 498 +#define OBJ_subtreeMaximumQuality OBJ_pilotAttributeType,52L + +#define LN_personalSignature "personalSignature" +#define NID_personalSignature 499 +#define OBJ_personalSignature OBJ_pilotAttributeType,53L + +#define LN_dITRedirect "dITRedirect" +#define NID_dITRedirect 500 +#define OBJ_dITRedirect OBJ_pilotAttributeType,54L + +#define SN_audio "audio" +#define NID_audio 501 +#define OBJ_audio OBJ_pilotAttributeType,55L + +#define LN_documentPublisher "documentPublisher" +#define NID_documentPublisher 502 +#define OBJ_documentPublisher OBJ_pilotAttributeType,56L + +#define SN_id_set "id-set" +#define LN_id_set "Secure Electronic Transactions" +#define NID_id_set 512 +#define OBJ_id_set OBJ_international_organizations,42L + +#define SN_set_ctype "set-ctype" +#define LN_set_ctype "content types" +#define NID_set_ctype 513 +#define OBJ_set_ctype OBJ_id_set,0L + +#define SN_set_msgExt "set-msgExt" +#define LN_set_msgExt "message extensions" +#define NID_set_msgExt 514 +#define OBJ_set_msgExt OBJ_id_set,1L + +#define SN_set_attr "set-attr" +#define NID_set_attr 515 +#define OBJ_set_attr OBJ_id_set,3L + +#define SN_set_policy "set-policy" +#define NID_set_policy 516 +#define OBJ_set_policy OBJ_id_set,5L + +#define SN_set_certExt "set-certExt" +#define LN_set_certExt "certificate extensions" +#define NID_set_certExt 517 +#define OBJ_set_certExt OBJ_id_set,7L + +#define SN_set_brand "set-brand" +#define NID_set_brand 518 +#define OBJ_set_brand OBJ_id_set,8L + +#define SN_setct_PANData "setct-PANData" +#define NID_setct_PANData 519 +#define OBJ_setct_PANData OBJ_set_ctype,0L + +#define SN_setct_PANToken "setct-PANToken" +#define NID_setct_PANToken 520 +#define OBJ_setct_PANToken OBJ_set_ctype,1L + +#define SN_setct_PANOnly "setct-PANOnly" +#define NID_setct_PANOnly 521 +#define OBJ_setct_PANOnly OBJ_set_ctype,2L + +#define SN_setct_OIData "setct-OIData" +#define NID_setct_OIData 522 +#define OBJ_setct_OIData OBJ_set_ctype,3L + +#define SN_setct_PI "setct-PI" +#define NID_setct_PI 523 +#define OBJ_setct_PI OBJ_set_ctype,4L + +#define SN_setct_PIData "setct-PIData" +#define NID_setct_PIData 524 +#define OBJ_setct_PIData OBJ_set_ctype,5L + +#define SN_setct_PIDataUnsigned "setct-PIDataUnsigned" +#define NID_setct_PIDataUnsigned 525 +#define OBJ_setct_PIDataUnsigned OBJ_set_ctype,6L + +#define SN_setct_HODInput "setct-HODInput" +#define NID_setct_HODInput 526 +#define OBJ_setct_HODInput OBJ_set_ctype,7L + +#define SN_setct_AuthResBaggage "setct-AuthResBaggage" +#define NID_setct_AuthResBaggage 527 +#define OBJ_setct_AuthResBaggage OBJ_set_ctype,8L + +#define SN_setct_AuthRevReqBaggage "setct-AuthRevReqBaggage" +#define NID_setct_AuthRevReqBaggage 528 +#define OBJ_setct_AuthRevReqBaggage OBJ_set_ctype,9L + +#define SN_setct_AuthRevResBaggage "setct-AuthRevResBaggage" +#define NID_setct_AuthRevResBaggage 529 +#define OBJ_setct_AuthRevResBaggage OBJ_set_ctype,10L + +#define SN_setct_CapTokenSeq "setct-CapTokenSeq" +#define NID_setct_CapTokenSeq 530 +#define OBJ_setct_CapTokenSeq OBJ_set_ctype,11L + +#define SN_setct_PInitResData "setct-PInitResData" +#define NID_setct_PInitResData 531 +#define OBJ_setct_PInitResData OBJ_set_ctype,12L + +#define SN_setct_PI_TBS "setct-PI-TBS" +#define NID_setct_PI_TBS 532 +#define OBJ_setct_PI_TBS OBJ_set_ctype,13L + +#define SN_setct_PResData "setct-PResData" +#define NID_setct_PResData 533 +#define OBJ_setct_PResData OBJ_set_ctype,14L + +#define SN_setct_AuthReqTBS "setct-AuthReqTBS" +#define NID_setct_AuthReqTBS 534 +#define OBJ_setct_AuthReqTBS OBJ_set_ctype,16L + +#define SN_setct_AuthResTBS "setct-AuthResTBS" +#define NID_setct_AuthResTBS 535 +#define OBJ_setct_AuthResTBS OBJ_set_ctype,17L + +#define SN_setct_AuthResTBSX "setct-AuthResTBSX" +#define NID_setct_AuthResTBSX 536 +#define OBJ_setct_AuthResTBSX OBJ_set_ctype,18L + +#define SN_setct_AuthTokenTBS "setct-AuthTokenTBS" +#define NID_setct_AuthTokenTBS 537 +#define OBJ_setct_AuthTokenTBS OBJ_set_ctype,19L + +#define SN_setct_CapTokenData "setct-CapTokenData" +#define NID_setct_CapTokenData 538 +#define OBJ_setct_CapTokenData OBJ_set_ctype,20L + +#define SN_setct_CapTokenTBS "setct-CapTokenTBS" +#define NID_setct_CapTokenTBS 539 +#define OBJ_setct_CapTokenTBS OBJ_set_ctype,21L + +#define SN_setct_AcqCardCodeMsg "setct-AcqCardCodeMsg" +#define NID_setct_AcqCardCodeMsg 540 +#define OBJ_setct_AcqCardCodeMsg OBJ_set_ctype,22L + +#define SN_setct_AuthRevReqTBS "setct-AuthRevReqTBS" +#define NID_setct_AuthRevReqTBS 541 +#define OBJ_setct_AuthRevReqTBS OBJ_set_ctype,23L + +#define SN_setct_AuthRevResData "setct-AuthRevResData" +#define NID_setct_AuthRevResData 542 +#define OBJ_setct_AuthRevResData OBJ_set_ctype,24L + +#define SN_setct_AuthRevResTBS "setct-AuthRevResTBS" +#define NID_setct_AuthRevResTBS 543 +#define OBJ_setct_AuthRevResTBS OBJ_set_ctype,25L + +#define SN_setct_CapReqTBS "setct-CapReqTBS" +#define NID_setct_CapReqTBS 544 +#define OBJ_setct_CapReqTBS OBJ_set_ctype,26L + +#define SN_setct_CapReqTBSX "setct-CapReqTBSX" +#define NID_setct_CapReqTBSX 545 +#define OBJ_setct_CapReqTBSX OBJ_set_ctype,27L + +#define SN_setct_CapResData "setct-CapResData" +#define NID_setct_CapResData 546 +#define OBJ_setct_CapResData OBJ_set_ctype,28L + +#define SN_setct_CapRevReqTBS "setct-CapRevReqTBS" +#define NID_setct_CapRevReqTBS 547 +#define OBJ_setct_CapRevReqTBS OBJ_set_ctype,29L + +#define SN_setct_CapRevReqTBSX "setct-CapRevReqTBSX" +#define NID_setct_CapRevReqTBSX 548 +#define OBJ_setct_CapRevReqTBSX OBJ_set_ctype,30L + +#define SN_setct_CapRevResData "setct-CapRevResData" +#define NID_setct_CapRevResData 549 +#define OBJ_setct_CapRevResData OBJ_set_ctype,31L + +#define SN_setct_CredReqTBS "setct-CredReqTBS" +#define NID_setct_CredReqTBS 550 +#define OBJ_setct_CredReqTBS OBJ_set_ctype,32L + +#define SN_setct_CredReqTBSX "setct-CredReqTBSX" +#define NID_setct_CredReqTBSX 551 +#define OBJ_setct_CredReqTBSX OBJ_set_ctype,33L + +#define SN_setct_CredResData "setct-CredResData" +#define NID_setct_CredResData 552 +#define OBJ_setct_CredResData OBJ_set_ctype,34L + +#define SN_setct_CredRevReqTBS "setct-CredRevReqTBS" +#define NID_setct_CredRevReqTBS 553 +#define OBJ_setct_CredRevReqTBS OBJ_set_ctype,35L + +#define SN_setct_CredRevReqTBSX "setct-CredRevReqTBSX" +#define NID_setct_CredRevReqTBSX 554 +#define OBJ_setct_CredRevReqTBSX OBJ_set_ctype,36L + +#define SN_setct_CredRevResData "setct-CredRevResData" +#define NID_setct_CredRevResData 555 +#define OBJ_setct_CredRevResData OBJ_set_ctype,37L + +#define SN_setct_PCertReqData "setct-PCertReqData" +#define NID_setct_PCertReqData 556 +#define OBJ_setct_PCertReqData OBJ_set_ctype,38L + +#define SN_setct_PCertResTBS "setct-PCertResTBS" +#define NID_setct_PCertResTBS 557 +#define OBJ_setct_PCertResTBS OBJ_set_ctype,39L + +#define SN_setct_BatchAdminReqData "setct-BatchAdminReqData" +#define NID_setct_BatchAdminReqData 558 +#define OBJ_setct_BatchAdminReqData OBJ_set_ctype,40L + +#define SN_setct_BatchAdminResData "setct-BatchAdminResData" +#define NID_setct_BatchAdminResData 559 +#define OBJ_setct_BatchAdminResData OBJ_set_ctype,41L + +#define SN_setct_CardCInitResTBS "setct-CardCInitResTBS" +#define NID_setct_CardCInitResTBS 560 +#define OBJ_setct_CardCInitResTBS OBJ_set_ctype,42L + +#define SN_setct_MeAqCInitResTBS "setct-MeAqCInitResTBS" +#define NID_setct_MeAqCInitResTBS 561 +#define OBJ_setct_MeAqCInitResTBS OBJ_set_ctype,43L + +#define SN_setct_RegFormResTBS "setct-RegFormResTBS" +#define NID_setct_RegFormResTBS 562 +#define OBJ_setct_RegFormResTBS OBJ_set_ctype,44L + +#define SN_setct_CertReqData "setct-CertReqData" +#define NID_setct_CertReqData 563 +#define OBJ_setct_CertReqData OBJ_set_ctype,45L + +#define SN_setct_CertReqTBS "setct-CertReqTBS" +#define NID_setct_CertReqTBS 564 +#define OBJ_setct_CertReqTBS OBJ_set_ctype,46L + +#define SN_setct_CertResData "setct-CertResData" +#define NID_setct_CertResData 565 +#define OBJ_setct_CertResData OBJ_set_ctype,47L + +#define SN_setct_CertInqReqTBS "setct-CertInqReqTBS" +#define NID_setct_CertInqReqTBS 566 +#define OBJ_setct_CertInqReqTBS OBJ_set_ctype,48L + +#define SN_setct_ErrorTBS "setct-ErrorTBS" +#define NID_setct_ErrorTBS 567 +#define OBJ_setct_ErrorTBS OBJ_set_ctype,49L + +#define SN_setct_PIDualSignedTBE "setct-PIDualSignedTBE" +#define NID_setct_PIDualSignedTBE 568 +#define OBJ_setct_PIDualSignedTBE OBJ_set_ctype,50L + +#define SN_setct_PIUnsignedTBE "setct-PIUnsignedTBE" +#define NID_setct_PIUnsignedTBE 569 +#define OBJ_setct_PIUnsignedTBE OBJ_set_ctype,51L + +#define SN_setct_AuthReqTBE "setct-AuthReqTBE" +#define NID_setct_AuthReqTBE 570 +#define OBJ_setct_AuthReqTBE OBJ_set_ctype,52L + +#define SN_setct_AuthResTBE "setct-AuthResTBE" +#define NID_setct_AuthResTBE 571 +#define OBJ_setct_AuthResTBE OBJ_set_ctype,53L + +#define SN_setct_AuthResTBEX "setct-AuthResTBEX" +#define NID_setct_AuthResTBEX 572 +#define OBJ_setct_AuthResTBEX OBJ_set_ctype,54L + +#define SN_setct_AuthTokenTBE "setct-AuthTokenTBE" +#define NID_setct_AuthTokenTBE 573 +#define OBJ_setct_AuthTokenTBE OBJ_set_ctype,55L + +#define SN_setct_CapTokenTBE "setct-CapTokenTBE" +#define NID_setct_CapTokenTBE 574 +#define OBJ_setct_CapTokenTBE OBJ_set_ctype,56L + +#define SN_setct_CapTokenTBEX "setct-CapTokenTBEX" +#define NID_setct_CapTokenTBEX 575 +#define OBJ_setct_CapTokenTBEX OBJ_set_ctype,57L + +#define SN_setct_AcqCardCodeMsgTBE "setct-AcqCardCodeMsgTBE" +#define NID_setct_AcqCardCodeMsgTBE 576 +#define OBJ_setct_AcqCardCodeMsgTBE OBJ_set_ctype,58L + +#define SN_setct_AuthRevReqTBE "setct-AuthRevReqTBE" +#define NID_setct_AuthRevReqTBE 577 +#define OBJ_setct_AuthRevReqTBE OBJ_set_ctype,59L + +#define SN_setct_AuthRevResTBE "setct-AuthRevResTBE" +#define NID_setct_AuthRevResTBE 578 +#define OBJ_setct_AuthRevResTBE OBJ_set_ctype,60L + +#define SN_setct_AuthRevResTBEB "setct-AuthRevResTBEB" +#define NID_setct_AuthRevResTBEB 579 +#define OBJ_setct_AuthRevResTBEB OBJ_set_ctype,61L + +#define SN_setct_CapReqTBE "setct-CapReqTBE" +#define NID_setct_CapReqTBE 580 +#define OBJ_setct_CapReqTBE OBJ_set_ctype,62L + +#define SN_setct_CapReqTBEX "setct-CapReqTBEX" +#define NID_setct_CapReqTBEX 581 +#define OBJ_setct_CapReqTBEX OBJ_set_ctype,63L + +#define SN_setct_CapResTBE "setct-CapResTBE" +#define NID_setct_CapResTBE 582 +#define OBJ_setct_CapResTBE OBJ_set_ctype,64L + +#define SN_setct_CapRevReqTBE "setct-CapRevReqTBE" +#define NID_setct_CapRevReqTBE 583 +#define OBJ_setct_CapRevReqTBE OBJ_set_ctype,65L + +#define SN_setct_CapRevReqTBEX "setct-CapRevReqTBEX" +#define NID_setct_CapRevReqTBEX 584 +#define OBJ_setct_CapRevReqTBEX OBJ_set_ctype,66L + +#define SN_setct_CapRevResTBE "setct-CapRevResTBE" +#define NID_setct_CapRevResTBE 585 +#define OBJ_setct_CapRevResTBE OBJ_set_ctype,67L + +#define SN_setct_CredReqTBE "setct-CredReqTBE" +#define NID_setct_CredReqTBE 586 +#define OBJ_setct_CredReqTBE OBJ_set_ctype,68L + +#define SN_setct_CredReqTBEX "setct-CredReqTBEX" +#define NID_setct_CredReqTBEX 587 +#define OBJ_setct_CredReqTBEX OBJ_set_ctype,69L + +#define SN_setct_CredResTBE "setct-CredResTBE" +#define NID_setct_CredResTBE 588 +#define OBJ_setct_CredResTBE OBJ_set_ctype,70L + +#define SN_setct_CredRevReqTBE "setct-CredRevReqTBE" +#define NID_setct_CredRevReqTBE 589 +#define OBJ_setct_CredRevReqTBE OBJ_set_ctype,71L + +#define SN_setct_CredRevReqTBEX "setct-CredRevReqTBEX" +#define NID_setct_CredRevReqTBEX 590 +#define OBJ_setct_CredRevReqTBEX OBJ_set_ctype,72L + +#define SN_setct_CredRevResTBE "setct-CredRevResTBE" +#define NID_setct_CredRevResTBE 591 +#define OBJ_setct_CredRevResTBE OBJ_set_ctype,73L + +#define SN_setct_BatchAdminReqTBE "setct-BatchAdminReqTBE" +#define NID_setct_BatchAdminReqTBE 592 +#define OBJ_setct_BatchAdminReqTBE OBJ_set_ctype,74L + +#define SN_setct_BatchAdminResTBE "setct-BatchAdminResTBE" +#define NID_setct_BatchAdminResTBE 593 +#define OBJ_setct_BatchAdminResTBE OBJ_set_ctype,75L + +#define SN_setct_RegFormReqTBE "setct-RegFormReqTBE" +#define NID_setct_RegFormReqTBE 594 +#define OBJ_setct_RegFormReqTBE OBJ_set_ctype,76L + +#define SN_setct_CertReqTBE "setct-CertReqTBE" +#define NID_setct_CertReqTBE 595 +#define OBJ_setct_CertReqTBE OBJ_set_ctype,77L + +#define SN_setct_CertReqTBEX "setct-CertReqTBEX" +#define NID_setct_CertReqTBEX 596 +#define OBJ_setct_CertReqTBEX OBJ_set_ctype,78L + +#define SN_setct_CertResTBE "setct-CertResTBE" +#define NID_setct_CertResTBE 597 +#define OBJ_setct_CertResTBE OBJ_set_ctype,79L + +#define SN_setct_CRLNotificationTBS "setct-CRLNotificationTBS" +#define NID_setct_CRLNotificationTBS 598 +#define OBJ_setct_CRLNotificationTBS OBJ_set_ctype,80L + +#define SN_setct_CRLNotificationResTBS "setct-CRLNotificationResTBS" +#define NID_setct_CRLNotificationResTBS 599 +#define OBJ_setct_CRLNotificationResTBS OBJ_set_ctype,81L + +#define SN_setct_BCIDistributionTBS "setct-BCIDistributionTBS" +#define NID_setct_BCIDistributionTBS 600 +#define OBJ_setct_BCIDistributionTBS OBJ_set_ctype,82L + +#define SN_setext_genCrypt "setext-genCrypt" +#define LN_setext_genCrypt "generic cryptogram" +#define NID_setext_genCrypt 601 +#define OBJ_setext_genCrypt OBJ_set_msgExt,1L + +#define SN_setext_miAuth "setext-miAuth" +#define LN_setext_miAuth "merchant initiated auth" +#define NID_setext_miAuth 602 +#define OBJ_setext_miAuth OBJ_set_msgExt,3L + +#define SN_setext_pinSecure "setext-pinSecure" +#define NID_setext_pinSecure 603 +#define OBJ_setext_pinSecure OBJ_set_msgExt,4L + +#define SN_setext_pinAny "setext-pinAny" +#define NID_setext_pinAny 604 +#define OBJ_setext_pinAny OBJ_set_msgExt,5L + +#define SN_setext_track2 "setext-track2" +#define NID_setext_track2 605 +#define OBJ_setext_track2 OBJ_set_msgExt,7L + +#define SN_setext_cv "setext-cv" +#define LN_setext_cv "additional verification" +#define NID_setext_cv 606 +#define OBJ_setext_cv OBJ_set_msgExt,8L + +#define SN_set_policy_root "set-policy-root" +#define NID_set_policy_root 607 +#define OBJ_set_policy_root OBJ_set_policy,0L + +#define SN_setCext_hashedRoot "setCext-hashedRoot" +#define NID_setCext_hashedRoot 608 +#define OBJ_setCext_hashedRoot OBJ_set_certExt,0L + +#define SN_setCext_certType "setCext-certType" +#define NID_setCext_certType 609 +#define OBJ_setCext_certType OBJ_set_certExt,1L + +#define SN_setCext_merchData "setCext-merchData" +#define NID_setCext_merchData 610 +#define OBJ_setCext_merchData OBJ_set_certExt,2L + +#define SN_setCext_cCertRequired "setCext-cCertRequired" +#define NID_setCext_cCertRequired 611 +#define OBJ_setCext_cCertRequired OBJ_set_certExt,3L + +#define SN_setCext_tunneling "setCext-tunneling" +#define NID_setCext_tunneling 612 +#define OBJ_setCext_tunneling OBJ_set_certExt,4L + +#define SN_setCext_setExt "setCext-setExt" +#define NID_setCext_setExt 613 +#define OBJ_setCext_setExt OBJ_set_certExt,5L + +#define SN_setCext_setQualf "setCext-setQualf" +#define NID_setCext_setQualf 614 +#define OBJ_setCext_setQualf OBJ_set_certExt,6L + +#define SN_setCext_PGWYcapabilities "setCext-PGWYcapabilities" +#define NID_setCext_PGWYcapabilities 615 +#define OBJ_setCext_PGWYcapabilities OBJ_set_certExt,7L + +#define SN_setCext_TokenIdentifier "setCext-TokenIdentifier" +#define NID_setCext_TokenIdentifier 616 +#define OBJ_setCext_TokenIdentifier OBJ_set_certExt,8L + +#define SN_setCext_Track2Data "setCext-Track2Data" +#define NID_setCext_Track2Data 617 +#define OBJ_setCext_Track2Data OBJ_set_certExt,9L + +#define SN_setCext_TokenType "setCext-TokenType" +#define NID_setCext_TokenType 618 +#define OBJ_setCext_TokenType OBJ_set_certExt,10L + +#define SN_setCext_IssuerCapabilities "setCext-IssuerCapabilities" +#define NID_setCext_IssuerCapabilities 619 +#define OBJ_setCext_IssuerCapabilities OBJ_set_certExt,11L + +#define SN_setAttr_Cert "setAttr-Cert" +#define NID_setAttr_Cert 620 +#define OBJ_setAttr_Cert OBJ_set_attr,0L + +#define SN_setAttr_PGWYcap "setAttr-PGWYcap" +#define LN_setAttr_PGWYcap "payment gateway capabilities" +#define NID_setAttr_PGWYcap 621 +#define OBJ_setAttr_PGWYcap OBJ_set_attr,1L + +#define SN_setAttr_TokenType "setAttr-TokenType" +#define NID_setAttr_TokenType 622 +#define OBJ_setAttr_TokenType OBJ_set_attr,2L + +#define SN_setAttr_IssCap "setAttr-IssCap" +#define LN_setAttr_IssCap "issuer capabilities" +#define NID_setAttr_IssCap 623 +#define OBJ_setAttr_IssCap OBJ_set_attr,3L + +#define SN_set_rootKeyThumb "set-rootKeyThumb" +#define NID_set_rootKeyThumb 624 +#define OBJ_set_rootKeyThumb OBJ_setAttr_Cert,0L + +#define SN_set_addPolicy "set-addPolicy" +#define NID_set_addPolicy 625 +#define OBJ_set_addPolicy OBJ_setAttr_Cert,1L + +#define SN_setAttr_Token_EMV "setAttr-Token-EMV" +#define NID_setAttr_Token_EMV 626 +#define OBJ_setAttr_Token_EMV OBJ_setAttr_TokenType,1L + +#define SN_setAttr_Token_B0Prime "setAttr-Token-B0Prime" +#define NID_setAttr_Token_B0Prime 627 +#define OBJ_setAttr_Token_B0Prime OBJ_setAttr_TokenType,2L + +#define SN_setAttr_IssCap_CVM "setAttr-IssCap-CVM" +#define NID_setAttr_IssCap_CVM 628 +#define OBJ_setAttr_IssCap_CVM OBJ_setAttr_IssCap,3L + +#define SN_setAttr_IssCap_T2 "setAttr-IssCap-T2" +#define NID_setAttr_IssCap_T2 629 +#define OBJ_setAttr_IssCap_T2 OBJ_setAttr_IssCap,4L + +#define SN_setAttr_IssCap_Sig "setAttr-IssCap-Sig" +#define NID_setAttr_IssCap_Sig 630 +#define OBJ_setAttr_IssCap_Sig OBJ_setAttr_IssCap,5L + +#define SN_setAttr_GenCryptgrm "setAttr-GenCryptgrm" +#define LN_setAttr_GenCryptgrm "generate cryptogram" +#define NID_setAttr_GenCryptgrm 631 +#define OBJ_setAttr_GenCryptgrm OBJ_setAttr_IssCap_CVM,1L + +#define SN_setAttr_T2Enc "setAttr-T2Enc" +#define LN_setAttr_T2Enc "encrypted track 2" +#define NID_setAttr_T2Enc 632 +#define OBJ_setAttr_T2Enc OBJ_setAttr_IssCap_T2,1L + +#define SN_setAttr_T2cleartxt "setAttr-T2cleartxt" +#define LN_setAttr_T2cleartxt "cleartext track 2" +#define NID_setAttr_T2cleartxt 633 +#define OBJ_setAttr_T2cleartxt OBJ_setAttr_IssCap_T2,2L + +#define SN_setAttr_TokICCsig "setAttr-TokICCsig" +#define LN_setAttr_TokICCsig "ICC or token signature" +#define NID_setAttr_TokICCsig 634 +#define OBJ_setAttr_TokICCsig OBJ_setAttr_IssCap_Sig,1L + +#define SN_setAttr_SecDevSig "setAttr-SecDevSig" +#define LN_setAttr_SecDevSig "secure device signature" +#define NID_setAttr_SecDevSig 635 +#define OBJ_setAttr_SecDevSig OBJ_setAttr_IssCap_Sig,2L + +#define SN_set_brand_IATA_ATA "set-brand-IATA-ATA" +#define NID_set_brand_IATA_ATA 636 +#define OBJ_set_brand_IATA_ATA OBJ_set_brand,1L + +#define SN_set_brand_Diners "set-brand-Diners" +#define NID_set_brand_Diners 637 +#define OBJ_set_brand_Diners OBJ_set_brand,30L + +#define SN_set_brand_AmericanExpress "set-brand-AmericanExpress" +#define NID_set_brand_AmericanExpress 638 +#define OBJ_set_brand_AmericanExpress OBJ_set_brand,34L + +#define SN_set_brand_JCB "set-brand-JCB" +#define NID_set_brand_JCB 639 +#define OBJ_set_brand_JCB OBJ_set_brand,35L + +#define SN_set_brand_Visa "set-brand-Visa" +#define NID_set_brand_Visa 640 +#define OBJ_set_brand_Visa OBJ_set_brand,4L + +#define SN_set_brand_MasterCard "set-brand-MasterCard" +#define NID_set_brand_MasterCard 641 +#define OBJ_set_brand_MasterCard OBJ_set_brand,5L + +#define SN_set_brand_Novus "set-brand-Novus" +#define NID_set_brand_Novus 642 +#define OBJ_set_brand_Novus OBJ_set_brand,6011L + +#define SN_des_cdmf "DES-CDMF" +#define LN_des_cdmf "des-cdmf" +#define NID_des_cdmf 643 +#define OBJ_des_cdmf OBJ_rsadsi,3L,10L + +#define SN_rsaOAEPEncryptionSET "rsaOAEPEncryptionSET" +#define NID_rsaOAEPEncryptionSET 644 +#define OBJ_rsaOAEPEncryptionSET OBJ_rsadsi,1L,1L,6L + +#define SN_ipsec3 "Oakley-EC2N-3" +#define LN_ipsec3 "ipsec3" +#define NID_ipsec3 749 + +#define SN_ipsec4 "Oakley-EC2N-4" +#define LN_ipsec4 "ipsec4" +#define NID_ipsec4 750 + diff --git a/h/openssl/objects.h b/h/openssl/objects.h new file mode 100644 index 0000000..7242f76 --- /dev/null +++ b/h/openssl/objects.h @@ -0,0 +1,1049 @@ +/* crypto/objects/objects.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_OBJECTS_H +#define HEADER_OBJECTS_H + +#define USE_OBJ_MAC + +#ifdef USE_OBJ_MAC +#include +#else +#define SN_undef "UNDEF" +#define LN_undef "undefined" +#define NID_undef 0 +#define OBJ_undef 0L + +#define SN_Algorithm "Algorithm" +#define LN_algorithm "algorithm" +#define NID_algorithm 38 +#define OBJ_algorithm 1L,3L,14L,3L,2L + +#define LN_rsadsi "rsadsi" +#define NID_rsadsi 1 +#define OBJ_rsadsi 1L,2L,840L,113549L + +#define LN_pkcs "pkcs" +#define NID_pkcs 2 +#define OBJ_pkcs OBJ_rsadsi,1L + +#define SN_md2 "MD2" +#define LN_md2 "md2" +#define NID_md2 3 +#define OBJ_md2 OBJ_rsadsi,2L,2L + +#define SN_md5 "MD5" +#define LN_md5 "md5" +#define NID_md5 4 +#define OBJ_md5 OBJ_rsadsi,2L,5L + +#define SN_rc4 "RC4" +#define LN_rc4 "rc4" +#define NID_rc4 5 +#define OBJ_rc4 OBJ_rsadsi,3L,4L + +#define LN_rsaEncryption "rsaEncryption" +#define NID_rsaEncryption 6 +#define OBJ_rsaEncryption OBJ_pkcs,1L,1L + +#define SN_md2WithRSAEncryption "RSA-MD2" +#define LN_md2WithRSAEncryption "md2WithRSAEncryption" +#define NID_md2WithRSAEncryption 7 +#define OBJ_md2WithRSAEncryption OBJ_pkcs,1L,2L + +#define SN_md5WithRSAEncryption "RSA-MD5" +#define LN_md5WithRSAEncryption "md5WithRSAEncryption" +#define NID_md5WithRSAEncryption 8 +#define OBJ_md5WithRSAEncryption OBJ_pkcs,1L,4L + +#define SN_pbeWithMD2AndDES_CBC "PBE-MD2-DES" +#define LN_pbeWithMD2AndDES_CBC "pbeWithMD2AndDES-CBC" +#define NID_pbeWithMD2AndDES_CBC 9 +#define OBJ_pbeWithMD2AndDES_CBC OBJ_pkcs,5L,1L + +#define SN_pbeWithMD5AndDES_CBC "PBE-MD5-DES" +#define LN_pbeWithMD5AndDES_CBC "pbeWithMD5AndDES-CBC" +#define NID_pbeWithMD5AndDES_CBC 10 +#define OBJ_pbeWithMD5AndDES_CBC OBJ_pkcs,5L,3L + +#define LN_X500 "X500" +#define NID_X500 11 +#define OBJ_X500 2L,5L + +#define LN_X509 "X509" +#define NID_X509 12 +#define OBJ_X509 OBJ_X500,4L + +#define SN_commonName "CN" +#define LN_commonName "commonName" +#define NID_commonName 13 +#define OBJ_commonName OBJ_X509,3L + +#define SN_countryName "C" +#define LN_countryName "countryName" +#define NID_countryName 14 +#define OBJ_countryName OBJ_X509,6L + +#define SN_localityName "L" +#define LN_localityName "localityName" +#define NID_localityName 15 +#define OBJ_localityName OBJ_X509,7L + +/* Postal Address? PA */ + +/* should be "ST" (rfc1327) but MS uses 'S' */ +#define SN_stateOrProvinceName "ST" +#define LN_stateOrProvinceName "stateOrProvinceName" +#define NID_stateOrProvinceName 16 +#define OBJ_stateOrProvinceName OBJ_X509,8L + +#define SN_organizationName "O" +#define LN_organizationName "organizationName" +#define NID_organizationName 17 +#define OBJ_organizationName OBJ_X509,10L + +#define SN_organizationalUnitName "OU" +#define LN_organizationalUnitName "organizationalUnitName" +#define NID_organizationalUnitName 18 +#define OBJ_organizationalUnitName OBJ_X509,11L + +#define SN_rsa "RSA" +#define LN_rsa "rsa" +#define NID_rsa 19 +#define OBJ_rsa OBJ_X500,8L,1L,1L + +#define LN_pkcs7 "pkcs7" +#define NID_pkcs7 20 +#define OBJ_pkcs7 OBJ_pkcs,7L + +#define LN_pkcs7_data "pkcs7-data" +#define NID_pkcs7_data 21 +#define OBJ_pkcs7_data OBJ_pkcs7,1L + +#define LN_pkcs7_signed "pkcs7-signedData" +#define NID_pkcs7_signed 22 +#define OBJ_pkcs7_signed OBJ_pkcs7,2L + +#define LN_pkcs7_enveloped "pkcs7-envelopedData" +#define NID_pkcs7_enveloped 23 +#define OBJ_pkcs7_enveloped OBJ_pkcs7,3L + +#define LN_pkcs7_signedAndEnveloped "pkcs7-signedAndEnvelopedData" +#define NID_pkcs7_signedAndEnveloped 24 +#define OBJ_pkcs7_signedAndEnveloped OBJ_pkcs7,4L + +#define LN_pkcs7_digest "pkcs7-digestData" +#define NID_pkcs7_digest 25 +#define OBJ_pkcs7_digest OBJ_pkcs7,5L + +#define LN_pkcs7_encrypted "pkcs7-encryptedData" +#define NID_pkcs7_encrypted 26 +#define OBJ_pkcs7_encrypted OBJ_pkcs7,6L + +#define LN_pkcs3 "pkcs3" +#define NID_pkcs3 27 +#define OBJ_pkcs3 OBJ_pkcs,3L + +#define LN_dhKeyAgreement "dhKeyAgreement" +#define NID_dhKeyAgreement 28 +#define OBJ_dhKeyAgreement OBJ_pkcs3,1L + +#define SN_des_ecb "DES-ECB" +#define LN_des_ecb "des-ecb" +#define NID_des_ecb 29 +#define OBJ_des_ecb OBJ_algorithm,6L + +#define SN_des_cfb64 "DES-CFB" +#define LN_des_cfb64 "des-cfb" +#define NID_des_cfb64 30 +/* IV + num */ +#define OBJ_des_cfb64 OBJ_algorithm,9L + +#define SN_des_cbc "DES-CBC" +#define LN_des_cbc "des-cbc" +#define NID_des_cbc 31 +/* IV */ +#define OBJ_des_cbc OBJ_algorithm,7L + +#define SN_des_ede "DES-EDE" +#define LN_des_ede "des-ede" +#define NID_des_ede 32 +/* ?? */ +#define OBJ_des_ede OBJ_algorithm,17L + +#define SN_des_ede3 "DES-EDE3" +#define LN_des_ede3 "des-ede3" +#define NID_des_ede3 33 + +#define SN_idea_cbc "IDEA-CBC" +#define LN_idea_cbc "idea-cbc" +#define NID_idea_cbc 34 +#define OBJ_idea_cbc 1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L + +#define SN_idea_cfb64 "IDEA-CFB" +#define LN_idea_cfb64 "idea-cfb" +#define NID_idea_cfb64 35 + +#define SN_idea_ecb "IDEA-ECB" +#define LN_idea_ecb "idea-ecb" +#define NID_idea_ecb 36 + +#define SN_rc2_cbc "RC2-CBC" +#define LN_rc2_cbc "rc2-cbc" +#define NID_rc2_cbc 37 +#define OBJ_rc2_cbc OBJ_rsadsi,3L,2L + +#define SN_rc2_ecb "RC2-ECB" +#define LN_rc2_ecb "rc2-ecb" +#define NID_rc2_ecb 38 + +#define SN_rc2_cfb64 "RC2-CFB" +#define LN_rc2_cfb64 "rc2-cfb" +#define NID_rc2_cfb64 39 + +#define SN_rc2_ofb64 "RC2-OFB" +#define LN_rc2_ofb64 "rc2-ofb" +#define NID_rc2_ofb64 40 + +#define SN_sha "SHA" +#define LN_sha "sha" +#define NID_sha 41 +#define OBJ_sha OBJ_algorithm,18L + +#define SN_shaWithRSAEncryption "RSA-SHA" +#define LN_shaWithRSAEncryption "shaWithRSAEncryption" +#define NID_shaWithRSAEncryption 42 +#define OBJ_shaWithRSAEncryption OBJ_algorithm,15L + +#define SN_des_ede_cbc "DES-EDE-CBC" +#define LN_des_ede_cbc "des-ede-cbc" +#define NID_des_ede_cbc 43 + +#define SN_des_ede3_cbc "DES-EDE3-CBC" +#define LN_des_ede3_cbc "des-ede3-cbc" +#define NID_des_ede3_cbc 44 +#define OBJ_des_ede3_cbc OBJ_rsadsi,3L,7L + +#define SN_des_ofb64 "DES-OFB" +#define LN_des_ofb64 "des-ofb" +#define NID_des_ofb64 45 +#define OBJ_des_ofb64 OBJ_algorithm,8L + +#define SN_idea_ofb64 "IDEA-OFB" +#define LN_idea_ofb64 "idea-ofb" +#define NID_idea_ofb64 46 + +#define LN_pkcs9 "pkcs9" +#define NID_pkcs9 47 +#define OBJ_pkcs9 OBJ_pkcs,9L + +#define SN_pkcs9_emailAddress "Email" +#define LN_pkcs9_emailAddress "emailAddress" +#define NID_pkcs9_emailAddress 48 +#define OBJ_pkcs9_emailAddress OBJ_pkcs9,1L + +#define LN_pkcs9_unstructuredName "unstructuredName" +#define NID_pkcs9_unstructuredName 49 +#define OBJ_pkcs9_unstructuredName OBJ_pkcs9,2L + +#define LN_pkcs9_contentType "contentType" +#define NID_pkcs9_contentType 50 +#define OBJ_pkcs9_contentType OBJ_pkcs9,3L + +#define LN_pkcs9_messageDigest "messageDigest" +#define NID_pkcs9_messageDigest 51 +#define OBJ_pkcs9_messageDigest OBJ_pkcs9,4L + +#define LN_pkcs9_signingTime "signingTime" +#define NID_pkcs9_signingTime 52 +#define OBJ_pkcs9_signingTime OBJ_pkcs9,5L + +#define LN_pkcs9_countersignature "countersignature" +#define NID_pkcs9_countersignature 53 +#define OBJ_pkcs9_countersignature OBJ_pkcs9,6L + +#define LN_pkcs9_challengePassword "challengePassword" +#define NID_pkcs9_challengePassword 54 +#define OBJ_pkcs9_challengePassword OBJ_pkcs9,7L + +#define LN_pkcs9_unstructuredAddress "unstructuredAddress" +#define NID_pkcs9_unstructuredAddress 55 +#define OBJ_pkcs9_unstructuredAddress OBJ_pkcs9,8L + +#define LN_pkcs9_extCertAttributes "extendedCertificateAttributes" +#define NID_pkcs9_extCertAttributes 56 +#define OBJ_pkcs9_extCertAttributes OBJ_pkcs9,9L + +#define SN_netscape "Netscape" +#define LN_netscape "Netscape Communications Corp." +#define NID_netscape 57 +#define OBJ_netscape 2L,16L,840L,1L,113730L + +#define SN_netscape_cert_extension "nsCertExt" +#define LN_netscape_cert_extension "Netscape Certificate Extension" +#define NID_netscape_cert_extension 58 +#define OBJ_netscape_cert_extension OBJ_netscape,1L + +#define SN_netscape_data_type "nsDataType" +#define LN_netscape_data_type "Netscape Data Type" +#define NID_netscape_data_type 59 +#define OBJ_netscape_data_type OBJ_netscape,2L + +#define SN_des_ede_cfb64 "DES-EDE-CFB" +#define LN_des_ede_cfb64 "des-ede-cfb" +#define NID_des_ede_cfb64 60 + +#define SN_des_ede3_cfb64 "DES-EDE3-CFB" +#define LN_des_ede3_cfb64 "des-ede3-cfb" +#define NID_des_ede3_cfb64 61 + +#define SN_des_ede_ofb64 "DES-EDE-OFB" +#define LN_des_ede_ofb64 "des-ede-ofb" +#define NID_des_ede_ofb64 62 + +#define SN_des_ede3_ofb64 "DES-EDE3-OFB" +#define LN_des_ede3_ofb64 "des-ede3-ofb" +#define NID_des_ede3_ofb64 63 + +/* I'm not sure about the object ID */ +#define SN_sha1 "SHA1" +#define LN_sha1 "sha1" +#define NID_sha1 64 +#define OBJ_sha1 OBJ_algorithm,26L +/* 28 Jun 1996 - eay */ +/* #define OBJ_sha1 1L,3L,14L,2L,26L,05L <- wrong */ + +#define SN_sha1WithRSAEncryption "RSA-SHA1" +#define LN_sha1WithRSAEncryption "sha1WithRSAEncryption" +#define NID_sha1WithRSAEncryption 65 +#define OBJ_sha1WithRSAEncryption OBJ_pkcs,1L,5L + +#define SN_dsaWithSHA "DSA-SHA" +#define LN_dsaWithSHA "dsaWithSHA" +#define NID_dsaWithSHA 66 +#define OBJ_dsaWithSHA OBJ_algorithm,13L + +#define SN_dsa_2 "DSA-old" +#define LN_dsa_2 "dsaEncryption-old" +#define NID_dsa_2 67 +#define OBJ_dsa_2 OBJ_algorithm,12L + +/* proposed by microsoft to RSA */ +#define SN_pbeWithSHA1AndRC2_CBC "PBE-SHA1-RC2-64" +#define LN_pbeWithSHA1AndRC2_CBC "pbeWithSHA1AndRC2-CBC" +#define NID_pbeWithSHA1AndRC2_CBC 68 +#define OBJ_pbeWithSHA1AndRC2_CBC OBJ_pkcs,5L,11L + +/* proposed by microsoft to RSA as pbeWithSHA1AndRC4: it is now + * defined explicitly in PKCS#5 v2.0 as id-PBKDF2 which is something + * completely different. + */ +#define LN_id_pbkdf2 "PBKDF2" +#define NID_id_pbkdf2 69 +#define OBJ_id_pbkdf2 OBJ_pkcs,5L,12L + +#define SN_dsaWithSHA1_2 "DSA-SHA1-old" +#define LN_dsaWithSHA1_2 "dsaWithSHA1-old" +#define NID_dsaWithSHA1_2 70 +/* Got this one from 'sdn706r20.pdf' which is actually an NSA document :-) */ +#define OBJ_dsaWithSHA1_2 OBJ_algorithm,27L + +#define SN_netscape_cert_type "nsCertType" +#define LN_netscape_cert_type "Netscape Cert Type" +#define NID_netscape_cert_type 71 +#define OBJ_netscape_cert_type OBJ_netscape_cert_extension,1L + +#define SN_netscape_base_url "nsBaseUrl" +#define LN_netscape_base_url "Netscape Base Url" +#define NID_netscape_base_url 72 +#define OBJ_netscape_base_url OBJ_netscape_cert_extension,2L + +#define SN_netscape_revocation_url "nsRevocationUrl" +#define LN_netscape_revocation_url "Netscape Revocation Url" +#define NID_netscape_revocation_url 73 +#define OBJ_netscape_revocation_url OBJ_netscape_cert_extension,3L + +#define SN_netscape_ca_revocation_url "nsCaRevocationUrl" +#define LN_netscape_ca_revocation_url "Netscape CA Revocation Url" +#define NID_netscape_ca_revocation_url 74 +#define OBJ_netscape_ca_revocation_url OBJ_netscape_cert_extension,4L + +#define SN_netscape_renewal_url "nsRenewalUrl" +#define LN_netscape_renewal_url "Netscape Renewal Url" +#define NID_netscape_renewal_url 75 +#define OBJ_netscape_renewal_url OBJ_netscape_cert_extension,7L + +#define SN_netscape_ca_policy_url "nsCaPolicyUrl" +#define LN_netscape_ca_policy_url "Netscape CA Policy Url" +#define NID_netscape_ca_policy_url 76 +#define OBJ_netscape_ca_policy_url OBJ_netscape_cert_extension,8L + +#define SN_netscape_ssl_server_name "nsSslServerName" +#define LN_netscape_ssl_server_name "Netscape SSL Server Name" +#define NID_netscape_ssl_server_name 77 +#define OBJ_netscape_ssl_server_name OBJ_netscape_cert_extension,12L + +#define SN_netscape_comment "nsComment" +#define LN_netscape_comment "Netscape Comment" +#define NID_netscape_comment 78 +#define OBJ_netscape_comment OBJ_netscape_cert_extension,13L + +#define SN_netscape_cert_sequence "nsCertSequence" +#define LN_netscape_cert_sequence "Netscape Certificate Sequence" +#define NID_netscape_cert_sequence 79 +#define OBJ_netscape_cert_sequence OBJ_netscape_data_type,5L + +#define SN_desx_cbc "DESX-CBC" +#define LN_desx_cbc "desx-cbc" +#define NID_desx_cbc 80 + +#define SN_id_ce "id-ce" +#define NID_id_ce 81 +#define OBJ_id_ce 2L,5L,29L + +#define SN_subject_key_identifier "subjectKeyIdentifier" +#define LN_subject_key_identifier "X509v3 Subject Key Identifier" +#define NID_subject_key_identifier 82 +#define OBJ_subject_key_identifier OBJ_id_ce,14L + +#define SN_key_usage "keyUsage" +#define LN_key_usage "X509v3 Key Usage" +#define NID_key_usage 83 +#define OBJ_key_usage OBJ_id_ce,15L + +#define SN_private_key_usage_period "privateKeyUsagePeriod" +#define LN_private_key_usage_period "X509v3 Private Key Usage Period" +#define NID_private_key_usage_period 84 +#define OBJ_private_key_usage_period OBJ_id_ce,16L + +#define SN_subject_alt_name "subjectAltName" +#define LN_subject_alt_name "X509v3 Subject Alternative Name" +#define NID_subject_alt_name 85 +#define OBJ_subject_alt_name OBJ_id_ce,17L + +#define SN_issuer_alt_name "issuerAltName" +#define LN_issuer_alt_name "X509v3 Issuer Alternative Name" +#define NID_issuer_alt_name 86 +#define OBJ_issuer_alt_name OBJ_id_ce,18L + +#define SN_basic_constraints "basicConstraints" +#define LN_basic_constraints "X509v3 Basic Constraints" +#define NID_basic_constraints 87 +#define OBJ_basic_constraints OBJ_id_ce,19L + +#define SN_crl_number "crlNumber" +#define LN_crl_number "X509v3 CRL Number" +#define NID_crl_number 88 +#define OBJ_crl_number OBJ_id_ce,20L + +#define SN_certificate_policies "certificatePolicies" +#define LN_certificate_policies "X509v3 Certificate Policies" +#define NID_certificate_policies 89 +#define OBJ_certificate_policies OBJ_id_ce,32L + +#define SN_authority_key_identifier "authorityKeyIdentifier" +#define LN_authority_key_identifier "X509v3 Authority Key Identifier" +#define NID_authority_key_identifier 90 +#define OBJ_authority_key_identifier OBJ_id_ce,35L + +#define SN_bf_cbc "BF-CBC" +#define LN_bf_cbc "bf-cbc" +#define NID_bf_cbc 91 +#define OBJ_bf_cbc 1L,3L,6L,1L,4L,1L,3029L,1L,2L + +#define SN_bf_ecb "BF-ECB" +#define LN_bf_ecb "bf-ecb" +#define NID_bf_ecb 92 + +#define SN_bf_cfb64 "BF-CFB" +#define LN_bf_cfb64 "bf-cfb" +#define NID_bf_cfb64 93 + +#define SN_bf_ofb64 "BF-OFB" +#define LN_bf_ofb64 "bf-ofb" +#define NID_bf_ofb64 94 + +#define SN_mdc2 "MDC2" +#define LN_mdc2 "mdc2" +#define NID_mdc2 95 +#define OBJ_mdc2 2L,5L,8L,3L,101L +/* An alternative? 1L,3L,14L,3L,2L,19L */ + +#define SN_mdc2WithRSA "RSA-MDC2" +#define LN_mdc2WithRSA "mdc2withRSA" +#define NID_mdc2WithRSA 96 +#define OBJ_mdc2WithRSA 2L,5L,8L,3L,100L + +#define SN_rc4_40 "RC4-40" +#define LN_rc4_40 "rc4-40" +#define NID_rc4_40 97 + +#define SN_rc2_40_cbc "RC2-40-CBC" +#define LN_rc2_40_cbc "rc2-40-cbc" +#define NID_rc2_40_cbc 98 + +#define SN_givenName "G" +#define LN_givenName "givenName" +#define NID_givenName 99 +#define OBJ_givenName OBJ_X509,42L + +#define SN_surname "S" +#define LN_surname "surname" +#define NID_surname 100 +#define OBJ_surname OBJ_X509,4L + +#define SN_initials "I" +#define LN_initials "initials" +#define NID_initials 101 +#define OBJ_initials OBJ_X509,43L + +#define SN_uniqueIdentifier "UID" +#define LN_uniqueIdentifier "uniqueIdentifier" +#define NID_uniqueIdentifier 102 +#define OBJ_uniqueIdentifier OBJ_X509,45L + +#define SN_crl_distribution_points "crlDistributionPoints" +#define LN_crl_distribution_points "X509v3 CRL Distribution Points" +#define NID_crl_distribution_points 103 +#define OBJ_crl_distribution_points OBJ_id_ce,31L + +#define SN_md5WithRSA "RSA-NP-MD5" +#define LN_md5WithRSA "md5WithRSA" +#define NID_md5WithRSA 104 +#define OBJ_md5WithRSA OBJ_algorithm,3L + +#define SN_serialNumber "SN" +#define LN_serialNumber "serialNumber" +#define NID_serialNumber 105 +#define OBJ_serialNumber OBJ_X509,5L + +#define SN_title "T" +#define LN_title "title" +#define NID_title 106 +#define OBJ_title OBJ_X509,12L + +#define SN_description "D" +#define LN_description "description" +#define NID_description 107 +#define OBJ_description OBJ_X509,13L + +/* CAST5 is CAST-128, I'm just sticking with the documentation */ +#define SN_cast5_cbc "CAST5-CBC" +#define LN_cast5_cbc "cast5-cbc" +#define NID_cast5_cbc 108 +#define OBJ_cast5_cbc 1L,2L,840L,113533L,7L,66L,10L + +#define SN_cast5_ecb "CAST5-ECB" +#define LN_cast5_ecb "cast5-ecb" +#define NID_cast5_ecb 109 + +#define SN_cast5_cfb64 "CAST5-CFB" +#define LN_cast5_cfb64 "cast5-cfb" +#define NID_cast5_cfb64 110 + +#define SN_cast5_ofb64 "CAST5-OFB" +#define LN_cast5_ofb64 "cast5-ofb" +#define NID_cast5_ofb64 111 + +#define LN_pbeWithMD5AndCast5_CBC "pbeWithMD5AndCast5CBC" +#define NID_pbeWithMD5AndCast5_CBC 112 +#define OBJ_pbeWithMD5AndCast5_CBC 1L,2L,840L,113533L,7L,66L,12L + +/* This is one sun will soon be using :-( + * id-dsa-with-sha1 ID ::= { + * iso(1) member-body(2) us(840) x9-57 (10040) x9cm(4) 3 } + */ +#define SN_dsaWithSHA1 "DSA-SHA1" +#define LN_dsaWithSHA1 "dsaWithSHA1" +#define NID_dsaWithSHA1 113 +#define OBJ_dsaWithSHA1 1L,2L,840L,10040L,4L,3L + +#define NID_md5_sha1 114 +#define SN_md5_sha1 "MD5-SHA1" +#define LN_md5_sha1 "md5-sha1" + +#define SN_sha1WithRSA "RSA-SHA1-2" +#define LN_sha1WithRSA "sha1WithRSA" +#define NID_sha1WithRSA 115 +#define OBJ_sha1WithRSA OBJ_algorithm,29L + +#define SN_dsa "DSA" +#define LN_dsa "dsaEncryption" +#define NID_dsa 116 +#define OBJ_dsa 1L,2L,840L,10040L,4L,1L + +#define SN_ripemd160 "RIPEMD160" +#define LN_ripemd160 "ripemd160" +#define NID_ripemd160 117 +#define OBJ_ripemd160 1L,3L,36L,3L,2L,1L + +/* The name should actually be rsaSignatureWithripemd160, but I'm going + * to continue using the convention I'm using with the other ciphers */ +#define SN_ripemd160WithRSA "RSA-RIPEMD160" +#define LN_ripemd160WithRSA "ripemd160WithRSA" +#define NID_ripemd160WithRSA 119 +#define OBJ_ripemd160WithRSA 1L,3L,36L,3L,3L,1L,2L + +/* Taken from rfc2040 + * RC5_CBC_Parameters ::= SEQUENCE { + * version INTEGER (v1_0(16)), + * rounds INTEGER (8..127), + * blockSizeInBits INTEGER (64, 128), + * iv OCTET STRING OPTIONAL + * } + */ +#define SN_rc5_cbc "RC5-CBC" +#define LN_rc5_cbc "rc5-cbc" +#define NID_rc5_cbc 120 +#define OBJ_rc5_cbc OBJ_rsadsi,3L,8L + +#define SN_rc5_ecb "RC5-ECB" +#define LN_rc5_ecb "rc5-ecb" +#define NID_rc5_ecb 121 + +#define SN_rc5_cfb64 "RC5-CFB" +#define LN_rc5_cfb64 "rc5-cfb" +#define NID_rc5_cfb64 122 + +#define SN_rc5_ofb64 "RC5-OFB" +#define LN_rc5_ofb64 "rc5-ofb" +#define NID_rc5_ofb64 123 + +#define SN_rle_compression "RLE" +#define LN_rle_compression "run length compression" +#define NID_rle_compression 124 +#define OBJ_rle_compression 1L,1L,1L,1L,666L,1L + +#define SN_zlib_compression "ZLIB" +#define LN_zlib_compression "zlib compression" +#define NID_zlib_compression 125 +#define OBJ_zlib_compression 1L,1L,1L,1L,666L,2L + +#define SN_ext_key_usage "extendedKeyUsage" +#define LN_ext_key_usage "X509v3 Extended Key Usage" +#define NID_ext_key_usage 126 +#define OBJ_ext_key_usage OBJ_id_ce,37 + +#define SN_id_pkix "PKIX" +#define NID_id_pkix 127 +#define OBJ_id_pkix 1L,3L,6L,1L,5L,5L,7L + +#define SN_id_kp "id-kp" +#define NID_id_kp 128 +#define OBJ_id_kp OBJ_id_pkix,3L + +/* PKIX extended key usage OIDs */ + +#define SN_server_auth "serverAuth" +#define LN_server_auth "TLS Web Server Authentication" +#define NID_server_auth 129 +#define OBJ_server_auth OBJ_id_kp,1L + +#define SN_client_auth "clientAuth" +#define LN_client_auth "TLS Web Client Authentication" +#define NID_client_auth 130 +#define OBJ_client_auth OBJ_id_kp,2L + +#define SN_code_sign "codeSigning" +#define LN_code_sign "Code Signing" +#define NID_code_sign 131 +#define OBJ_code_sign OBJ_id_kp,3L + +#define SN_email_protect "emailProtection" +#define LN_email_protect "E-mail Protection" +#define NID_email_protect 132 +#define OBJ_email_protect OBJ_id_kp,4L + +#define SN_time_stamp "timeStamping" +#define LN_time_stamp "Time Stamping" +#define NID_time_stamp 133 +#define OBJ_time_stamp OBJ_id_kp,8L + +/* Additional extended key usage OIDs: Microsoft */ + +#define SN_ms_code_ind "msCodeInd" +#define LN_ms_code_ind "Microsoft Individual Code Signing" +#define NID_ms_code_ind 134 +#define OBJ_ms_code_ind 1L,3L,6L,1L,4L,1L,311L,2L,1L,21L + +#define SN_ms_code_com "msCodeCom" +#define LN_ms_code_com "Microsoft Commercial Code Signing" +#define NID_ms_code_com 135 +#define OBJ_ms_code_com 1L,3L,6L,1L,4L,1L,311L,2L,1L,22L + +#define SN_ms_ctl_sign "msCTLSign" +#define LN_ms_ctl_sign "Microsoft Trust List Signing" +#define NID_ms_ctl_sign 136 +#define OBJ_ms_ctl_sign 1L,3L,6L,1L,4L,1L,311L,10L,3L,1L + +#define SN_ms_sgc "msSGC" +#define LN_ms_sgc "Microsoft Server Gated Crypto" +#define NID_ms_sgc 137 +#define OBJ_ms_sgc 1L,3L,6L,1L,4L,1L,311L,10L,3L,3L + +#define SN_ms_efs "msEFS" +#define LN_ms_efs "Microsoft Encrypted File System" +#define NID_ms_efs 138 +#define OBJ_ms_efs 1L,3L,6L,1L,4L,1L,311L,10L,3L,4L + +/* Additional usage: Netscape */ + +#define SN_ns_sgc "nsSGC" +#define LN_ns_sgc "Netscape Server Gated Crypto" +#define NID_ns_sgc 139 +#define OBJ_ns_sgc OBJ_netscape,4L,1L + +#define SN_delta_crl "deltaCRL" +#define LN_delta_crl "X509v3 Delta CRL Indicator" +#define NID_delta_crl 140 +#define OBJ_delta_crl OBJ_id_ce,27L + +#define SN_crl_reason "CRLReason" +#define LN_crl_reason "CRL Reason Code" +#define NID_crl_reason 141 +#define OBJ_crl_reason OBJ_id_ce,21L + +#define SN_invalidity_date "invalidityDate" +#define LN_invalidity_date "Invalidity Date" +#define NID_invalidity_date 142 +#define OBJ_invalidity_date OBJ_id_ce,24L + +#define SN_sxnet "SXNetID" +#define LN_sxnet "Strong Extranet ID" +#define NID_sxnet 143 +#define OBJ_sxnet 1L,3L,101L,1L,4L,1L + +/* PKCS12 and related OBJECT IDENTIFIERS */ + +#define OBJ_pkcs12 OBJ_pkcs,12L +#define OBJ_pkcs12_pbeids OBJ_pkcs12, 1 + +#define SN_pbe_WithSHA1And128BitRC4 "PBE-SHA1-RC4-128" +#define LN_pbe_WithSHA1And128BitRC4 "pbeWithSHA1And128BitRC4" +#define NID_pbe_WithSHA1And128BitRC4 144 +#define OBJ_pbe_WithSHA1And128BitRC4 OBJ_pkcs12_pbeids, 1L + +#define SN_pbe_WithSHA1And40BitRC4 "PBE-SHA1-RC4-40" +#define LN_pbe_WithSHA1And40BitRC4 "pbeWithSHA1And40BitRC4" +#define NID_pbe_WithSHA1And40BitRC4 145 +#define OBJ_pbe_WithSHA1And40BitRC4 OBJ_pkcs12_pbeids, 2L + +#define SN_pbe_WithSHA1And3_Key_TripleDES_CBC "PBE-SHA1-3DES" +#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC "pbeWithSHA1And3-KeyTripleDES-CBC" +#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC 146 +#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC OBJ_pkcs12_pbeids, 3L + +#define SN_pbe_WithSHA1And2_Key_TripleDES_CBC "PBE-SHA1-2DES" +#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC "pbeWithSHA1And2-KeyTripleDES-CBC" +#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC 147 +#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC OBJ_pkcs12_pbeids, 4L + +#define SN_pbe_WithSHA1And128BitRC2_CBC "PBE-SHA1-RC2-128" +#define LN_pbe_WithSHA1And128BitRC2_CBC "pbeWithSHA1And128BitRC2-CBC" +#define NID_pbe_WithSHA1And128BitRC2_CBC 148 +#define OBJ_pbe_WithSHA1And128BitRC2_CBC OBJ_pkcs12_pbeids, 5L + +#define SN_pbe_WithSHA1And40BitRC2_CBC "PBE-SHA1-RC2-40" +#define LN_pbe_WithSHA1And40BitRC2_CBC "pbeWithSHA1And40BitRC2-CBC" +#define NID_pbe_WithSHA1And40BitRC2_CBC 149 +#define OBJ_pbe_WithSHA1And40BitRC2_CBC OBJ_pkcs12_pbeids, 6L + +#define OBJ_pkcs12_Version1 OBJ_pkcs12, 10L + +#define OBJ_pkcs12_BagIds OBJ_pkcs12_Version1, 1L + +#define LN_keyBag "keyBag" +#define NID_keyBag 150 +#define OBJ_keyBag OBJ_pkcs12_BagIds, 1L + +#define LN_pkcs8ShroudedKeyBag "pkcs8ShroudedKeyBag" +#define NID_pkcs8ShroudedKeyBag 151 +#define OBJ_pkcs8ShroudedKeyBag OBJ_pkcs12_BagIds, 2L + +#define LN_certBag "certBag" +#define NID_certBag 152 +#define OBJ_certBag OBJ_pkcs12_BagIds, 3L + +#define LN_crlBag "crlBag" +#define NID_crlBag 153 +#define OBJ_crlBag OBJ_pkcs12_BagIds, 4L + +#define LN_secretBag "secretBag" +#define NID_secretBag 154 +#define OBJ_secretBag OBJ_pkcs12_BagIds, 5L + +#define LN_safeContentsBag "safeContentsBag" +#define NID_safeContentsBag 155 +#define OBJ_safeContentsBag OBJ_pkcs12_BagIds, 6L + +#define LN_friendlyName "friendlyName" +#define NID_friendlyName 156 +#define OBJ_friendlyName OBJ_pkcs9, 20L + +#define LN_localKeyID "localKeyID" +#define NID_localKeyID 157 +#define OBJ_localKeyID OBJ_pkcs9, 21L + +#define OBJ_certTypes OBJ_pkcs9, 22L + +#define LN_x509Certificate "x509Certificate" +#define NID_x509Certificate 158 +#define OBJ_x509Certificate OBJ_certTypes, 1L + +#define LN_sdsiCertificate "sdsiCertificate" +#define NID_sdsiCertificate 159 +#define OBJ_sdsiCertificate OBJ_certTypes, 2L + +#define OBJ_crlTypes OBJ_pkcs9, 23L + +#define LN_x509Crl "x509Crl" +#define NID_x509Crl 160 +#define OBJ_x509Crl OBJ_crlTypes, 1L + +/* PKCS#5 v2 OIDs */ + +#define LN_pbes2 "PBES2" +#define NID_pbes2 161 +#define OBJ_pbes2 OBJ_pkcs,5L,13L + +#define LN_pbmac1 "PBMAC1" +#define NID_pbmac1 162 +#define OBJ_pbmac1 OBJ_pkcs,5L,14L + +#define LN_hmacWithSHA1 "hmacWithSHA1" +#define NID_hmacWithSHA1 163 +#define OBJ_hmacWithSHA1 OBJ_rsadsi,2L,7L + +/* Policy Qualifier Ids */ + +#define LN_id_qt_cps "Policy Qualifier CPS" +#define SN_id_qt_cps "id-qt-cps" +#define NID_id_qt_cps 164 +#define OBJ_id_qt_cps OBJ_id_pkix,2L,1L + +#define LN_id_qt_unotice "Policy Qualifier User Notice" +#define SN_id_qt_unotice "id-qt-unotice" +#define NID_id_qt_unotice 165 +#define OBJ_id_qt_unotice OBJ_id_pkix,2L,2L + +#define SN_rc2_64_cbc "RC2-64-CBC" +#define LN_rc2_64_cbc "rc2-64-cbc" +#define NID_rc2_64_cbc 166 + +#define SN_SMIMECapabilities "SMIME-CAPS" +#define LN_SMIMECapabilities "S/MIME Capabilities" +#define NID_SMIMECapabilities 167 +#define OBJ_SMIMECapabilities OBJ_pkcs9,15L + +#define SN_pbeWithMD2AndRC2_CBC "PBE-MD2-RC2-64" +#define LN_pbeWithMD2AndRC2_CBC "pbeWithMD2AndRC2-CBC" +#define NID_pbeWithMD2AndRC2_CBC 168 +#define OBJ_pbeWithMD2AndRC2_CBC OBJ_pkcs,5L,4L + +#define SN_pbeWithMD5AndRC2_CBC "PBE-MD5-RC2-64" +#define LN_pbeWithMD5AndRC2_CBC "pbeWithMD5AndRC2-CBC" +#define NID_pbeWithMD5AndRC2_CBC 169 +#define OBJ_pbeWithMD5AndRC2_CBC OBJ_pkcs,5L,6L + +#define SN_pbeWithSHA1AndDES_CBC "PBE-SHA1-DES" +#define LN_pbeWithSHA1AndDES_CBC "pbeWithSHA1AndDES-CBC" +#define NID_pbeWithSHA1AndDES_CBC 170 +#define OBJ_pbeWithSHA1AndDES_CBC OBJ_pkcs,5L,10L + +/* Extension request OIDs */ + +#define LN_ms_ext_req "Microsoft Extension Request" +#define SN_ms_ext_req "msExtReq" +#define NID_ms_ext_req 171 +#define OBJ_ms_ext_req 1L,3L,6L,1L,4L,1L,311L,2L,1L,14L + +#define LN_ext_req "Extension Request" +#define SN_ext_req "extReq" +#define NID_ext_req 172 +#define OBJ_ext_req OBJ_pkcs9,14L + +#define SN_name "name" +#define LN_name "name" +#define NID_name 173 +#define OBJ_name OBJ_X509,41L + +#define SN_dnQualifier "dnQualifier" +#define LN_dnQualifier "dnQualifier" +#define NID_dnQualifier 174 +#define OBJ_dnQualifier OBJ_X509,46L + +#define SN_id_pe "id-pe" +#define NID_id_pe 175 +#define OBJ_id_pe OBJ_id_pkix,1L + +#define SN_id_ad "id-ad" +#define NID_id_ad 176 +#define OBJ_id_ad OBJ_id_pkix,48L + +#define SN_info_access "authorityInfoAccess" +#define LN_info_access "Authority Information Access" +#define NID_info_access 177 +#define OBJ_info_access OBJ_id_pe,1L + +#define SN_ad_OCSP "OCSP" +#define LN_ad_OCSP "OCSP" +#define NID_ad_OCSP 178 +#define OBJ_ad_OCSP OBJ_id_ad,1L + +#define SN_ad_ca_issuers "caIssuers" +#define LN_ad_ca_issuers "CA Issuers" +#define NID_ad_ca_issuers 179 +#define OBJ_ad_ca_issuers OBJ_id_ad,2L + +#define SN_OCSP_sign "OCSPSigning" +#define LN_OCSP_sign "OCSP Signing" +#define NID_OCSP_sign 180 +#define OBJ_OCSP_sign OBJ_id_kp,9L +#endif /* USE_OBJ_MAC */ + +#include +#include + +#define OBJ_NAME_TYPE_UNDEF 0x00 +#define OBJ_NAME_TYPE_MD_METH 0x01 +#define OBJ_NAME_TYPE_CIPHER_METH 0x02 +#define OBJ_NAME_TYPE_PKEY_METH 0x03 +#define OBJ_NAME_TYPE_COMP_METH 0x04 +#define OBJ_NAME_TYPE_NUM 0x05 + +#define OBJ_NAME_ALIAS 0x8000 + +#define OBJ_BSEARCH_VALUE_ON_NOMATCH 0x01 +#define OBJ_BSEARCH_FIRST_VALUE_ON_MATCH 0x02 + + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct obj_name_st + { + int type; + int alias; + const char *name; + const char *data; + } OBJ_NAME; + +#define OBJ_create_and_add_object(a,b,c) OBJ_create(a,b,c) + + +int OBJ_NAME_init(void); +int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *), + int (*cmp_func)(const char *, const char *), + void (*free_func)(const char *, int, const char *)); +const char *OBJ_NAME_get(const char *name,int type); +int OBJ_NAME_add(const char *name,int type,const char *data); +int OBJ_NAME_remove(const char *name,int type); +void OBJ_NAME_cleanup(int type); /* -1 for everything */ +void OBJ_NAME_do_all(int type,void (*fn)(const OBJ_NAME *,void *arg), + void *arg); +void OBJ_NAME_do_all_sorted(int type,void (*fn)(const OBJ_NAME *,void *arg), + void *arg); + +ASN1_OBJECT * OBJ_dup(const ASN1_OBJECT *o); +ASN1_OBJECT * OBJ_nid2obj(int n); +const char * OBJ_nid2ln(int n); +const char * OBJ_nid2sn(int n); +int OBJ_obj2nid(const ASN1_OBJECT *o); +ASN1_OBJECT * OBJ_txt2obj(const char *s, int no_name); +int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name); +int OBJ_txt2nid(const char *s); +int OBJ_ln2nid(const char *s); +int OBJ_sn2nid(const char *s); +int OBJ_cmp(const ASN1_OBJECT *a,const ASN1_OBJECT *b); +const char * OBJ_bsearch(const char *key,const char *base,int num,int size, + int (*cmp)(const void *, const void *)); +const char * OBJ_bsearch_ex(const char *key,const char *base,int num, + int size, int (*cmp)(const void *, const void *), int flags); + +int OBJ_new_nid(int num); +int OBJ_add_object(const ASN1_OBJECT *obj); +int OBJ_create(const char *oid,const char *sn,const char *ln); +void OBJ_cleanup(void ); +int OBJ_create_objects(BIO *in); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_OBJ_strings(void); + +/* Error codes for the OBJ functions. */ + +/* Function codes. */ +#define OBJ_F_OBJ_ADD_OBJECT 105 +#define OBJ_F_OBJ_CREATE 100 +#define OBJ_F_OBJ_DUP 101 +#define OBJ_F_OBJ_NAME_NEW_INDEX 106 +#define OBJ_F_OBJ_NID2LN 102 +#define OBJ_F_OBJ_NID2OBJ 103 +#define OBJ_F_OBJ_NID2SN 104 + +/* Reason codes. */ +#define OBJ_R_MALLOC_FAILURE 100 +#define OBJ_R_UNKNOWN_NID 101 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/openssl/ocsp.h b/h/openssl/ocsp.h new file mode 100644 index 0000000..53f3364 --- /dev/null +++ b/h/openssl/ocsp.h @@ -0,0 +1,614 @@ +/* ocsp.h */ +/* Written by Tom Titchener for the OpenSSL + * project. */ + +/* History: + This file was transfered to Richard Levitte from CertCo by Kathy + Weinhold in mid-spring 2000 to be included in OpenSSL or released + as a patch kit. */ + +/* ==================================================================== + * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_OCSP_H +#define HEADER_OCSP_H + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Various flags and values */ + +#define OCSP_DEFAULT_NONCE_LENGTH 16 + +#define OCSP_NOCERTS 0x1 +#define OCSP_NOINTERN 0x2 +#define OCSP_NOSIGS 0x4 +#define OCSP_NOCHAIN 0x8 +#define OCSP_NOVERIFY 0x10 +#define OCSP_NOEXPLICIT 0x20 +#define OCSP_NOCASIGN 0x40 +#define OCSP_NODELEGATED 0x80 +#define OCSP_NOCHECKS 0x100 +#define OCSP_TRUSTOTHER 0x200 +#define OCSP_RESPID_KEY 0x400 +#define OCSP_NOTIME 0x800 + +/* CertID ::= SEQUENCE { + * hashAlgorithm AlgorithmIdentifier, + * issuerNameHash OCTET STRING, -- Hash of Issuer's DN + * issuerKeyHash OCTET STRING, -- Hash of Issuers public key (excluding the tag & length fields) + * serialNumber CertificateSerialNumber } + */ +typedef struct ocsp_cert_id_st + { + X509_ALGOR *hashAlgorithm; + ASN1_OCTET_STRING *issuerNameHash; + ASN1_OCTET_STRING *issuerKeyHash; + ASN1_INTEGER *serialNumber; + } OCSP_CERTID; + +DECLARE_STACK_OF(OCSP_CERTID) + +/* Request ::= SEQUENCE { + * reqCert CertID, + * singleRequestExtensions [0] EXPLICIT Extensions OPTIONAL } + */ +typedef struct ocsp_one_request_st + { + OCSP_CERTID *reqCert; + STACK_OF(X509_EXTENSION) *singleRequestExtensions; + } OCSP_ONEREQ; + +DECLARE_STACK_OF(OCSP_ONEREQ) +DECLARE_ASN1_SET_OF(OCSP_ONEREQ) + + +/* TBSRequest ::= SEQUENCE { + * version [0] EXPLICIT Version DEFAULT v1, + * requestorName [1] EXPLICIT GeneralName OPTIONAL, + * requestList SEQUENCE OF Request, + * requestExtensions [2] EXPLICIT Extensions OPTIONAL } + */ +typedef struct ocsp_req_info_st + { + ASN1_INTEGER *version; + GENERAL_NAME *requestorName; + STACK_OF(OCSP_ONEREQ) *requestList; + STACK_OF(X509_EXTENSION) *requestExtensions; + } OCSP_REQINFO; + +/* Signature ::= SEQUENCE { + * signatureAlgorithm AlgorithmIdentifier, + * signature BIT STRING, + * certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL } + */ +typedef struct ocsp_signature_st + { + X509_ALGOR *signatureAlgorithm; + ASN1_BIT_STRING *signature; + STACK_OF(X509) *certs; + } OCSP_SIGNATURE; + +/* OCSPRequest ::= SEQUENCE { + * tbsRequest TBSRequest, + * optionalSignature [0] EXPLICIT Signature OPTIONAL } + */ +typedef struct ocsp_request_st + { + OCSP_REQINFO *tbsRequest; + OCSP_SIGNATURE *optionalSignature; /* OPTIONAL */ + } OCSP_REQUEST; + +/* OCSPResponseStatus ::= ENUMERATED { + * successful (0), --Response has valid confirmations + * malformedRequest (1), --Illegal confirmation request + * internalError (2), --Internal error in issuer + * tryLater (3), --Try again later + * --(4) is not used + * sigRequired (5), --Must sign the request + * unauthorized (6) --Request unauthorized + * } + */ +#define OCSP_RESPONSE_STATUS_SUCCESSFUL 0 +#define OCSP_RESPONSE_STATUS_MALFORMEDREQUEST 1 +#define OCSP_RESPONSE_STATUS_INTERNALERROR 2 +#define OCSP_RESPONSE_STATUS_TRYLATER 3 +#define OCSP_RESPONSE_STATUS_SIGREQUIRED 5 +#define OCSP_RESPONSE_STATUS_UNAUTHORIZED 6 + +/* ResponseBytes ::= SEQUENCE { + * responseType OBJECT IDENTIFIER, + * response OCTET STRING } + */ +typedef struct ocsp_resp_bytes_st + { + ASN1_OBJECT *responseType; + ASN1_OCTET_STRING *response; + } OCSP_RESPBYTES; + +/* OCSPResponse ::= SEQUENCE { + * responseStatus OCSPResponseStatus, + * responseBytes [0] EXPLICIT ResponseBytes OPTIONAL } + */ +typedef struct ocsp_response_st + { + ASN1_ENUMERATED *responseStatus; + OCSP_RESPBYTES *responseBytes; + } OCSP_RESPONSE; + +/* ResponderID ::= CHOICE { + * byName [1] Name, + * byKey [2] KeyHash } + */ +#define V_OCSP_RESPID_NAME 0 +#define V_OCSP_RESPID_KEY 1 +typedef struct ocsp_responder_id_st + { + int type; + union { + X509_NAME* byName; + ASN1_OCTET_STRING *byKey; + } value; + } OCSP_RESPID; +/* KeyHash ::= OCTET STRING --SHA-1 hash of responder's public key + * --(excluding the tag and length fields) + */ + +/* RevokedInfo ::= SEQUENCE { + * revocationTime GeneralizedTime, + * revocationReason [0] EXPLICIT CRLReason OPTIONAL } + */ +typedef struct ocsp_revoked_info_st + { + ASN1_GENERALIZEDTIME *revocationTime; + ASN1_ENUMERATED *revocationReason; + } OCSP_REVOKEDINFO; + +/* CertStatus ::= CHOICE { + * good [0] IMPLICIT NULL, + * revoked [1] IMPLICIT RevokedInfo, + * unknown [2] IMPLICIT UnknownInfo } + */ +#define V_OCSP_CERTSTATUS_GOOD 0 +#define V_OCSP_CERTSTATUS_REVOKED 1 +#define V_OCSP_CERTSTATUS_UNKNOWN 2 +typedef struct ocsp_cert_status_st + { + int type; + union { + ASN1_NULL *good; + OCSP_REVOKEDINFO *revoked; + ASN1_NULL *unknown; + } value; + } OCSP_CERTSTATUS; + +/* SingleResponse ::= SEQUENCE { + * certID CertID, + * certStatus CertStatus, + * thisUpdate GeneralizedTime, + * nextUpdate [0] EXPLICIT GeneralizedTime OPTIONAL, + * singleExtensions [1] EXPLICIT Extensions OPTIONAL } + */ +typedef struct ocsp_single_response_st + { + OCSP_CERTID *certId; + OCSP_CERTSTATUS *certStatus; + ASN1_GENERALIZEDTIME *thisUpdate; + ASN1_GENERALIZEDTIME *nextUpdate; + STACK_OF(X509_EXTENSION) *singleExtensions; + } OCSP_SINGLERESP; + +DECLARE_STACK_OF(OCSP_SINGLERESP) +DECLARE_ASN1_SET_OF(OCSP_SINGLERESP) + +/* ResponseData ::= SEQUENCE { + * version [0] EXPLICIT Version DEFAULT v1, + * responderID ResponderID, + * producedAt GeneralizedTime, + * responses SEQUENCE OF SingleResponse, + * responseExtensions [1] EXPLICIT Extensions OPTIONAL } + */ +typedef struct ocsp_response_data_st + { + ASN1_INTEGER *version; + OCSP_RESPID *responderId; + ASN1_GENERALIZEDTIME *producedAt; + STACK_OF(OCSP_SINGLERESP) *responses; + STACK_OF(X509_EXTENSION) *responseExtensions; + } OCSP_RESPDATA; + +/* BasicOCSPResponse ::= SEQUENCE { + * tbsResponseData ResponseData, + * signatureAlgorithm AlgorithmIdentifier, + * signature BIT STRING, + * certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL } + */ + /* Note 1: + The value for "signature" is specified in the OCSP rfc2560 as follows: + "The value for the signature SHALL be computed on the hash of the DER + encoding ResponseData." This means that you must hash the DER-encoded + tbsResponseData, and then run it through a crypto-signing function, which + will (at least w/RSA) do a hash-'n'-private-encrypt operation. This seems + a bit odd, but that's the spec. Also note that the data structures do not + leave anywhere to independently specify the algorithm used for the initial + hash. So, we look at the signature-specification algorithm, and try to do + something intelligent. -- Kathy Weinhold, CertCo */ + /* Note 2: + It seems that the mentioned passage from RFC 2560 (section 4.2.1) is open + for interpretation. I've done tests against another responder, and found + that it doesn't do the double hashing that the RFC seems to say one + should. Therefore, all relevant functions take a flag saying which + variant should be used. -- Richard Levitte, OpenSSL team and CeloCom */ +typedef struct ocsp_basic_response_st + { + OCSP_RESPDATA *tbsResponseData; + X509_ALGOR *signatureAlgorithm; + ASN1_BIT_STRING *signature; + STACK_OF(X509) *certs; + } OCSP_BASICRESP; + +/* + * CRLReason ::= ENUMERATED { + * unspecified (0), + * keyCompromise (1), + * cACompromise (2), + * affiliationChanged (3), + * superseded (4), + * cessationOfOperation (5), + * certificateHold (6), + * removeFromCRL (8) } + */ +#define OCSP_REVOKED_STATUS_NOSTATUS -1 +#define OCSP_REVOKED_STATUS_UNSPECIFIED 0 +#define OCSP_REVOKED_STATUS_KEYCOMPROMISE 1 +#define OCSP_REVOKED_STATUS_CACOMPROMISE 2 +#define OCSP_REVOKED_STATUS_AFFILIATIONCHANGED 3 +#define OCSP_REVOKED_STATUS_SUPERSEDED 4 +#define OCSP_REVOKED_STATUS_CESSATIONOFOPERATION 5 +#define OCSP_REVOKED_STATUS_CERTIFICATEHOLD 6 +#define OCSP_REVOKED_STATUS_REMOVEFROMCRL 8 + +/* CrlID ::= SEQUENCE { + * crlUrl [0] EXPLICIT IA5String OPTIONAL, + * crlNum [1] EXPLICIT INTEGER OPTIONAL, + * crlTime [2] EXPLICIT GeneralizedTime OPTIONAL } + */ +typedef struct ocsp_crl_id_st + { + ASN1_IA5STRING *crlUrl; + ASN1_INTEGER *crlNum; + ASN1_GENERALIZEDTIME *crlTime; + } OCSP_CRLID; + +/* ServiceLocator ::= SEQUENCE { + * issuer Name, + * locator AuthorityInfoAccessSyntax OPTIONAL } + */ +typedef struct ocsp_service_locator_st + { + X509_NAME* issuer; + STACK_OF(ACCESS_DESCRIPTION) *locator; + } OCSP_SERVICELOC; + +#define PEM_STRING_OCSP_REQUEST "OCSP REQUEST" +#define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE" + +#define d2i_OCSP_REQUEST_bio(bp,p) ASN1_d2i_bio_of(OCSP_REQUEST,OCSP_REQUEST_new,d2i_OCSP_REQUEST,bp,p) + +#define d2i_OCSP_RESPONSE_bio(bp,p) ASN1_d2i_bio_of(OCSP_RESPONSE,OCSP_RESPONSE_new,d2i_OCSP_RESPONSE,bp,p) + +#define PEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,bp,(char **)x,cb,NULL) + +#define PEM_read_bio_OCSP_RESPONSE(bp,x,cb)(OCSP_RESPONSE *)PEM_ASN1_read_bio(\ + (char *(*)())d2i_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,bp,(char **)x,cb,NULL) + +#define PEM_write_bio_OCSP_REQUEST(bp,o) \ + PEM_ASN1_write_bio((int (*)())i2d_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,\ + bp,(char *)o, NULL,NULL,0,NULL,NULL) + +#define PEM_write_bio_OCSP_RESPONSE(bp,o) \ + PEM_ASN1_write_bio((int (*)())i2d_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,\ + bp,(char *)o, NULL,NULL,0,NULL,NULL) + +#define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio_of(OCSP_RESPONSE,i2d_OCSP_RESPONSE,bp,o) + +#define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio_of(OCSP_REQUEST,i2d_OCSP_REQUEST,bp,o) + +#define OCSP_REQUEST_sign(o,pkey,md) \ + ASN1_item_sign(ASN1_ITEM_rptr(OCSP_REQINFO),\ + o->optionalSignature->signatureAlgorithm,NULL,\ + o->optionalSignature->signature,o->tbsRequest,pkey,md) + +#define OCSP_BASICRESP_sign(o,pkey,md,d) \ + ASN1_item_sign(ASN1_ITEM_rptr(OCSP_RESPDATA),o->signatureAlgorithm,NULL,\ + o->signature,o->tbsResponseData,pkey,md) + +#define OCSP_REQUEST_verify(a,r) ASN1_item_verify(ASN1_ITEM_rptr(OCSP_REQINFO),\ + a->optionalSignature->signatureAlgorithm,\ + a->optionalSignature->signature,a->tbsRequest,r) + +#define OCSP_BASICRESP_verify(a,r,d) ASN1_item_verify(ASN1_ITEM_rptr(OCSP_RESPDATA),\ + a->signatureAlgorithm,a->signature,a->tbsResponseData,r) + +#define ASN1_BIT_STRING_digest(data,type,md,len) \ + ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len) + +#define OCSP_CERTID_dup(cid) ASN1_dup_of(OCSP_CERTID,i2d_OCSP_CERTID,d2i_OCSP_CERTID,cid) + +#define OCSP_CERTSTATUS_dup(cs)\ + (OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\ + (char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs)) + +OCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, char *path, OCSP_REQUEST *req); + +OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, X509 *subject, X509 *issuer); + +OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst, + X509_NAME *issuerName, + ASN1_BIT_STRING* issuerKey, + ASN1_INTEGER *serialNumber); + +OCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid); + +int OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len); +int OCSP_basic_add1_nonce(OCSP_BASICRESP *resp, unsigned char *val, int len); +int OCSP_check_nonce(OCSP_REQUEST *req, OCSP_BASICRESP *bs); +int OCSP_copy_nonce(OCSP_BASICRESP *resp, OCSP_REQUEST *req); + +int OCSP_request_set1_name(OCSP_REQUEST *req, X509_NAME *nm); +int OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert); + +int OCSP_request_sign(OCSP_REQUEST *req, + X509 *signer, + EVP_PKEY *key, + const EVP_MD *dgst, + STACK_OF(X509) *certs, + unsigned long flags); + +int OCSP_response_status(OCSP_RESPONSE *resp); +OCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp); + +int OCSP_resp_count(OCSP_BASICRESP *bs); +OCSP_SINGLERESP *OCSP_resp_get0(OCSP_BASICRESP *bs, int idx); +int OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last); +int OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason, + ASN1_GENERALIZEDTIME **revtime, + ASN1_GENERALIZEDTIME **thisupd, + ASN1_GENERALIZEDTIME **nextupd); +int OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status, + int *reason, + ASN1_GENERALIZEDTIME **revtime, + ASN1_GENERALIZEDTIME **thisupd, + ASN1_GENERALIZEDTIME **nextupd); +int OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd, + ASN1_GENERALIZEDTIME *nextupd, + long sec, long maxsec); + +int OCSP_request_verify(OCSP_REQUEST *req, STACK_OF(X509) *certs, X509_STORE *store, unsigned long flags); + +int OCSP_parse_url(char *url, char **phost, char **pport, char **ppath, int *pssl); + +int OCSP_id_issuer_cmp(OCSP_CERTID *a, OCSP_CERTID *b); +int OCSP_id_cmp(OCSP_CERTID *a, OCSP_CERTID *b); + +int OCSP_request_onereq_count(OCSP_REQUEST *req); +OCSP_ONEREQ *OCSP_request_onereq_get0(OCSP_REQUEST *req, int i); +OCSP_CERTID *OCSP_onereq_get0_id(OCSP_ONEREQ *one); +int OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd, + ASN1_OCTET_STRING **pikeyHash, + ASN1_INTEGER **pserial, OCSP_CERTID *cid); +int OCSP_request_is_signed(OCSP_REQUEST *req); +OCSP_RESPONSE *OCSP_response_create(int status, OCSP_BASICRESP *bs); +OCSP_SINGLERESP *OCSP_basic_add1_status(OCSP_BASICRESP *rsp, + OCSP_CERTID *cid, + int status, int reason, + ASN1_TIME *revtime, + ASN1_TIME *thisupd, ASN1_TIME *nextupd); +int OCSP_basic_add1_cert(OCSP_BASICRESP *resp, X509 *cert); +int OCSP_basic_sign(OCSP_BASICRESP *brsp, + X509 *signer, EVP_PKEY *key, const EVP_MD *dgst, + STACK_OF(X509) *certs, unsigned long flags); + +ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d, + void *data, STACK_OF(ASN1_OBJECT) *sk); +#define ASN1_STRING_encode_of(type,s,i2d,data,sk) \ +((ASN1_STRING *(*)(ASN1_STRING *,I2D_OF(type),type *,STACK_OF(ASN1_OBJECT) *))openssl_fcast(ASN1_STRING_encode))(s,i2d,data,sk) + +X509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim); + +X509_EXTENSION *OCSP_accept_responses_new(char **oids); + +X509_EXTENSION *OCSP_archive_cutoff_new(char* tim); + +X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME* issuer, char **urls); + +int OCSP_REQUEST_get_ext_count(OCSP_REQUEST *x); +int OCSP_REQUEST_get_ext_by_NID(OCSP_REQUEST *x, int nid, int lastpos); +int OCSP_REQUEST_get_ext_by_OBJ(OCSP_REQUEST *x, ASN1_OBJECT *obj, int lastpos); +int OCSP_REQUEST_get_ext_by_critical(OCSP_REQUEST *x, int crit, int lastpos); +X509_EXTENSION *OCSP_REQUEST_get_ext(OCSP_REQUEST *x, int loc); +X509_EXTENSION *OCSP_REQUEST_delete_ext(OCSP_REQUEST *x, int loc); +void *OCSP_REQUEST_get1_ext_d2i(OCSP_REQUEST *x, int nid, int *crit, int *idx); +int OCSP_REQUEST_add1_ext_i2d(OCSP_REQUEST *x, int nid, void *value, int crit, + unsigned long flags); +int OCSP_REQUEST_add_ext(OCSP_REQUEST *x, X509_EXTENSION *ex, int loc); + +int OCSP_ONEREQ_get_ext_count(OCSP_ONEREQ *x); +int OCSP_ONEREQ_get_ext_by_NID(OCSP_ONEREQ *x, int nid, int lastpos); +int OCSP_ONEREQ_get_ext_by_OBJ(OCSP_ONEREQ *x, ASN1_OBJECT *obj, int lastpos); +int OCSP_ONEREQ_get_ext_by_critical(OCSP_ONEREQ *x, int crit, int lastpos); +X509_EXTENSION *OCSP_ONEREQ_get_ext(OCSP_ONEREQ *x, int loc); +X509_EXTENSION *OCSP_ONEREQ_delete_ext(OCSP_ONEREQ *x, int loc); +void *OCSP_ONEREQ_get1_ext_d2i(OCSP_ONEREQ *x, int nid, int *crit, int *idx); +int OCSP_ONEREQ_add1_ext_i2d(OCSP_ONEREQ *x, int nid, void *value, int crit, + unsigned long flags); +int OCSP_ONEREQ_add_ext(OCSP_ONEREQ *x, X509_EXTENSION *ex, int loc); + +int OCSP_BASICRESP_get_ext_count(OCSP_BASICRESP *x); +int OCSP_BASICRESP_get_ext_by_NID(OCSP_BASICRESP *x, int nid, int lastpos); +int OCSP_BASICRESP_get_ext_by_OBJ(OCSP_BASICRESP *x, ASN1_OBJECT *obj, int lastpos); +int OCSP_BASICRESP_get_ext_by_critical(OCSP_BASICRESP *x, int crit, int lastpos); +X509_EXTENSION *OCSP_BASICRESP_get_ext(OCSP_BASICRESP *x, int loc); +X509_EXTENSION *OCSP_BASICRESP_delete_ext(OCSP_BASICRESP *x, int loc); +void *OCSP_BASICRESP_get1_ext_d2i(OCSP_BASICRESP *x, int nid, int *crit, int *idx); +int OCSP_BASICRESP_add1_ext_i2d(OCSP_BASICRESP *x, int nid, void *value, int crit, + unsigned long flags); +int OCSP_BASICRESP_add_ext(OCSP_BASICRESP *x, X509_EXTENSION *ex, int loc); + +int OCSP_SINGLERESP_get_ext_count(OCSP_SINGLERESP *x); +int OCSP_SINGLERESP_get_ext_by_NID(OCSP_SINGLERESP *x, int nid, int lastpos); +int OCSP_SINGLERESP_get_ext_by_OBJ(OCSP_SINGLERESP *x, ASN1_OBJECT *obj, int lastpos); +int OCSP_SINGLERESP_get_ext_by_critical(OCSP_SINGLERESP *x, int crit, int lastpos); +X509_EXTENSION *OCSP_SINGLERESP_get_ext(OCSP_SINGLERESP *x, int loc); +X509_EXTENSION *OCSP_SINGLERESP_delete_ext(OCSP_SINGLERESP *x, int loc); +void *OCSP_SINGLERESP_get1_ext_d2i(OCSP_SINGLERESP *x, int nid, int *crit, int *idx); +int OCSP_SINGLERESP_add1_ext_i2d(OCSP_SINGLERESP *x, int nid, void *value, int crit, + unsigned long flags); +int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc); + +DECLARE_ASN1_FUNCTIONS(OCSP_SINGLERESP) +DECLARE_ASN1_FUNCTIONS(OCSP_CERTSTATUS) +DECLARE_ASN1_FUNCTIONS(OCSP_REVOKEDINFO) +DECLARE_ASN1_FUNCTIONS(OCSP_BASICRESP) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPDATA) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPID) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPONSE) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPBYTES) +DECLARE_ASN1_FUNCTIONS(OCSP_ONEREQ) +DECLARE_ASN1_FUNCTIONS(OCSP_CERTID) +DECLARE_ASN1_FUNCTIONS(OCSP_REQUEST) +DECLARE_ASN1_FUNCTIONS(OCSP_SIGNATURE) +DECLARE_ASN1_FUNCTIONS(OCSP_REQINFO) +DECLARE_ASN1_FUNCTIONS(OCSP_CRLID) +DECLARE_ASN1_FUNCTIONS(OCSP_SERVICELOC) + +char *OCSP_response_status_str(long s); +char *OCSP_cert_status_str(long s); +char *OCSP_crl_reason_str(long s); + +int OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST* a, unsigned long flags); +int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE* o, unsigned long flags); + +int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs, + X509_STORE *st, unsigned long flags); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_OCSP_strings(void); + +/* Error codes for the OCSP functions. */ + +/* Function codes. */ +#define OCSP_F_ASN1_STRING_ENCODE 100 +#define OCSP_F_D2I_OCSP_NONCE 102 +#define OCSP_F_OCSP_BASIC_ADD1_STATUS 103 +#define OCSP_F_OCSP_BASIC_SIGN 104 +#define OCSP_F_OCSP_BASIC_VERIFY 105 +#define OCSP_F_OCSP_CERT_ID_NEW 101 +#define OCSP_F_OCSP_CHECK_DELEGATED 106 +#define OCSP_F_OCSP_CHECK_IDS 107 +#define OCSP_F_OCSP_CHECK_ISSUER 108 +#define OCSP_F_OCSP_CHECK_VALIDITY 115 +#define OCSP_F_OCSP_MATCH_ISSUERID 109 +#define OCSP_F_OCSP_PARSE_URL 114 +#define OCSP_F_OCSP_REQUEST_SIGN 110 +#define OCSP_F_OCSP_REQUEST_VERIFY 116 +#define OCSP_F_OCSP_RESPONSE_GET1_BASIC 111 +#define OCSP_F_OCSP_SENDREQ_BIO 112 +#define OCSP_F_REQUEST_VERIFY 113 + +/* Reason codes. */ +#define OCSP_R_BAD_DATA 100 +#define OCSP_R_CERTIFICATE_VERIFY_ERROR 101 +#define OCSP_R_DIGEST_ERR 102 +#define OCSP_R_ERROR_IN_NEXTUPDATE_FIELD 122 +#define OCSP_R_ERROR_IN_THISUPDATE_FIELD 123 +#define OCSP_R_ERROR_PARSING_URL 121 +#define OCSP_R_MISSING_OCSPSIGNING_USAGE 103 +#define OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE 124 +#define OCSP_R_NOT_BASIC_RESPONSE 104 +#define OCSP_R_NO_CERTIFICATES_IN_CHAIN 105 +#define OCSP_R_NO_CONTENT 106 +#define OCSP_R_NO_PUBLIC_KEY 107 +#define OCSP_R_NO_RESPONSE_DATA 108 +#define OCSP_R_NO_REVOKED_TIME 109 +#define OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 110 +#define OCSP_R_REQUEST_NOT_SIGNED 128 +#define OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA 111 +#define OCSP_R_ROOT_CA_NOT_TRUSTED 112 +#define OCSP_R_SERVER_READ_ERROR 113 +#define OCSP_R_SERVER_RESPONSE_ERROR 114 +#define OCSP_R_SERVER_RESPONSE_PARSE_ERROR 115 +#define OCSP_R_SERVER_WRITE_ERROR 116 +#define OCSP_R_SIGNATURE_FAILURE 117 +#define OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND 118 +#define OCSP_R_STATUS_EXPIRED 125 +#define OCSP_R_STATUS_NOT_YET_VALID 126 +#define OCSP_R_STATUS_TOO_OLD 127 +#define OCSP_R_UNKNOWN_MESSAGE_DIGEST 119 +#define OCSP_R_UNKNOWN_NID 120 +#define OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE 129 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/openssl/opensslconf.h b/h/openssl/opensslconf.h new file mode 100644 index 0000000..6521985 --- /dev/null +++ b/h/openssl/opensslconf.h @@ -0,0 +1,241 @@ +/* opensslconf.h */ +/* WARNING: Generated automatically from opensslconf.h.in by Configure. */ + +/* OpenSSL was configured with the following options: */ +#ifndef OPENSSL_SYSNAME_VXWORKS +# define OPENSSL_SYSNAME_VXWORKS +#endif +#ifndef OPENSSL_DOING_MAKEDEPEND + +#ifndef OPENSSL_NO_GMP +# define OPENSSL_NO_GMP +#endif +#ifndef OPENSSL_NO_MDC5 +# define OPENSSL_NO_MDC5 +#endif +#ifndef OPENSSL_NO_IDEA +# define OPENSSL_NO_IDEA +#endif +#ifndef OPENSSL_NO_RC5 +# define OPENSSL_NO_RC5 +#endif +#ifndef OPENSSL_NO_KRB5 +# define OPENSSL_NO_KRB5 +#endif +#ifndef OPENSSL_NO_MDC2 +# define OPENSSL_NO_MDC2 +#endif +#ifndef OPENSSL_NO_CAST +# define OPENSSL_NO_CAST +#endif +#ifndef OPENSSL_NO_EC +# define OPENSSL_NO_EC +#endif +#ifndef OPENSSL_NO_ECDSA +# define OPENSSL_NO_ECDSA +#endif +#ifndef OPENSSL_NO_ECDH +# define OPENSSL_NO_ECDH +#endif + +#endif /* OPENSSL_DOING_MAKEDEPEND */ +#ifndef OPENSSL_NO_HW +# define OPENSSL_NO_HW +#endif +#ifndef OPENSSL_NO_ASM +# define OPENSSL_NO_ASM +#endif +#ifndef OPENSSL_NO_ENGINE +# define OPENSSL_NO_ENGINE +#endif +#ifndef OPENSSL_NO_DYNAMIC_ENGINE +# define OPENSSL_NO_DYNAMIC_ENGINE +#endif + +/* The OPENSSL_NO_* macros are also defined as NO_* if the application + asks for it. This is a transient feature that is provided for those + who haven't had the time to do the appropriate changes in their + applications. */ +#ifdef OPENSSL_ALGORITHM_DEFINES +# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP) +# define NO_GMP +# endif +# if defined(OPENSSL_NO_MDC5) && !defined(NO_MDC5) +# define NO_MDC5 +# endif +# if defined(OPENSSL_NO_IDEA) && !defined(NO_IDEA) +# define NO_IDEA +# endif +# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5) +# define NO_RC5 +# endif +# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5) +# define NO_KRB5 +# endif +# if defined(OPENSSL_NO_MDC2) && !defined(NO_MDC2) +# define NO_MDC2 +# endif +# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5) +# define NO_RC5 +# endif +#endif + +/* crypto/opensslconf.h.in */ + +/* Generate 80386 code? */ +#undef I386_ONLY + +#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ +#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) +#define ENGINESDIR "./" +#define OPENSSLDIR "./" +#endif +#endif + +#undef OPENSSL_UNISTD +#define OPENSSL_UNISTD + +#undef OPENSSL_EXPORT_VAR_AS_FUNCTION + +#if defined(HEADER_IDEA_H) && !defined(IDEA_INT) +#define IDEA_INT unsigned int +#endif + +#if defined(HEADER_MD2_H) && !defined(MD2_INT) +#define MD2_INT unsigned int +#endif + +#if defined(HEADER_RC2_H) && !defined(RC2_INT) +/* I need to put in a mod for the alpha - eay */ +#define RC2_INT unsigned int +#endif + +#if defined(HEADER_RC4_H) +#if !defined(RC4_INT) +/* using int types make the structure larger but make the code faster + * on most boxes I have tested - up to %20 faster. */ +/* + * I don't know what does "most" mean, but declaring "int" is a must on: + * - Intel P6 because partial register stalls are very expensive; + * - elder Alpha because it lacks byte load/store instructions; + */ +#define RC4_INT unsigned int +#endif +#if !defined(RC4_CHUNK) +/* + * This enables code handling data aligned at natural CPU word + * boundary. See crypto/rc4/rc4_enc.c for further details. + */ +#undef RC4_CHUNK +#endif +#endif + +#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) +/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a + * %20 speed up (longs are 8 bytes, int's are 4). */ +#ifndef DES_LONG +#define DES_LONG unsigned long +#endif +#endif + +#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) +#define CONFIG_HEADER_BN_H +#undef BN_LLONG + +/* Should we define BN_DIV2W here? */ + +/* Only one for the following should be defined */ +/* The prime number generation stuff may not work when + * EIGHT_BIT but I don't care since I've only used this mode + * for debuging the bignum libraries */ +#undef SIXTY_FOUR_BIT_LONG +#undef SIXTY_FOUR_BIT +#define THIRTY_TWO_BIT +#undef SIXTEEN_BIT +#undef EIGHT_BIT +#endif + +#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) +#define CONFIG_HEADER_RC4_LOCL_H +/* if this is defined data[i] is used instead of *data, this is a %20 + * speedup on x86 */ +#undef RC4_INDEX +#endif + +#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) +#define CONFIG_HEADER_BF_LOCL_H +#undef BF_PTR +#endif /* HEADER_BF_LOCL_H */ + +#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) +#define CONFIG_HEADER_DES_LOCL_H +#ifndef DES_DEFAULT_OPTIONS +/* the following is tweaked from a config script, that is why it is a + * protected undef/define */ +#ifndef DES_PTR +#undef DES_PTR +#endif + +/* This helps C compiler generate the correct code for multiple functional + * units. It reduces register dependancies at the expense of 2 more + * registers */ +#ifndef DES_RISC1 +#undef DES_RISC1 +#endif + +#ifndef DES_RISC2 +#undef DES_RISC2 +#endif + +#if defined(DES_RISC1) && defined(DES_RISC2) +YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! +#endif + +/* Unroll the inner loop, this sometimes helps, sometimes hinders. + * Very mucy CPU dependant */ +#ifndef DES_UNROLL +#undef DES_UNROLL +#endif + +/* These default values were supplied by + * Peter Gutman + * They are only used if nothing else has been defined */ +#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) +/* Special defines which change the way the code is built depending on the + CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find + even newer MIPS CPU's, but at the moment one size fits all for + optimization options. Older Sparc's work better with only UNROLL, but + there's no way to tell at compile time what it is you're running on */ + +#if defined( sun ) /* Newer Sparc's */ +# define DES_PTR +# define DES_RISC1 +# define DES_UNROLL +#elif defined( __ultrix ) /* Older MIPS */ +# define DES_PTR +# define DES_RISC2 +# define DES_UNROLL +#elif defined( __osf1__ ) /* Alpha */ +# define DES_PTR +# define DES_RISC2 +#elif defined ( _AIX ) /* RS6000 */ + /* Unknown */ +#elif defined( __hpux ) /* HP-PA */ + /* Unknown */ +#elif defined( __aux ) /* 68K */ + /* Unknown */ +#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ +# define DES_UNROLL +#elif defined( __sgi ) /* Newer MIPS */ +# define DES_PTR +# define DES_RISC2 +# define DES_UNROLL +#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ +# define DES_PTR +# define DES_RISC1 +# define DES_UNROLL +#endif /* Systems-specific speed defines */ +#endif + +#endif /* DES_DEFAULT_OPTIONS */ +#endif /* HEADER_DES_LOCL_H */ diff --git a/h/openssl/opensslv.h b/h/openssl/opensslv.h new file mode 100644 index 0000000..fed5edb --- /dev/null +++ b/h/openssl/opensslv.h @@ -0,0 +1,89 @@ +#ifndef HEADER_OPENSSLV_H +#define HEADER_OPENSSLV_H + +/* Numeric release version identifier: + * MNNFFPPS: major minor fix patch status + * The status nibble has one of the values 0 for development, 1 to e for betas + * 1 to 14, and f for release. The patch level is exactly that. + * For example: + * 0.9.3-dev 0x00903000 + * 0.9.3-beta1 0x00903001 + * 0.9.3-beta2-dev 0x00903002 + * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) + * 0.9.3 0x0090300f + * 0.9.3a 0x0090301f + * 0.9.4 0x0090400f + * 1.2.3z 0x102031af + * + * For continuity reasons (because 0.9.5 is already out, and is coded + * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level + * part is slightly different, by setting the highest bit. This means + * that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start + * with 0x0090600S... + * + * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.) + * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for + * major minor fix final patch/beta) + */ +#define OPENSSL_VERSION_NUMBER 0x0090800fL +#ifdef OPENSSL_FIPS +#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.8-fips 05 Jul 2005" +#else +#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.8 05 Jul 2005" +#endif +#define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT + + +/* The macros below are to be used for shared library (.so, .dll, ...) + * versioning. That kind of versioning works a bit differently between + * operating systems. The most usual scheme is to set a major and a minor + * number, and have the runtime loader check that the major number is equal + * to what it was at application link time, while the minor number has to + * be greater or equal to what it was at application link time. With this + * scheme, the version number is usually part of the file name, like this: + * + * libcrypto.so.0.9 + * + * Some unixen also make a softlink with the major verson number only: + * + * libcrypto.so.0 + * + * On Tru64 and IRIX 6.x it works a little bit differently. There, the + * shared library version is stored in the file, and is actually a series + * of versions, separated by colons. The rightmost version present in the + * library when linking an application is stored in the application to be + * matched at run time. When the application is run, a check is done to + * see if the library version stored in the application matches any of the + * versions in the version string of the library itself. + * This version string can be constructed in any way, depending on what + * kind of matching is desired. However, to implement the same scheme as + * the one used in the other unixen, all compatible versions, from lowest + * to highest, should be part of the string. Consecutive builds would + * give the following versions strings: + * + * 3.0 + * 3.0:3.1 + * 3.0:3.1:3.2 + * 4.0 + * 4.0:4.1 + * + * Notice how version 4 is completely incompatible with version, and + * therefore give the breach you can see. + * + * There may be other schemes as well that I haven't yet discovered. + * + * So, here's the way it works here: first of all, the library version + * number doesn't need at all to match the overall OpenSSL version. + * However, it's nice and more understandable if it actually does. + * The current library version is stored in the macro SHLIB_VERSION_NUMBER, + * which is just a piece of text in the format "M.m.e" (Major, minor, edit). + * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways, + * we need to keep a history of version numbers, which is done in the + * macro SHLIB_VERSION_HISTORY. The numbers are separated by colons and + * should only keep the versions that are binary compatible with the current. + */ +#define SHLIB_VERSION_HISTORY "" +#define SHLIB_VERSION_NUMBER "0.9.8" + + +#endif /* HEADER_OPENSSLV_H */ diff --git a/h/openssl/ossl_typ.h b/h/openssl/ossl_typ.h new file mode 100644 index 0000000..9c335a1 --- /dev/null +++ b/h/openssl/ossl_typ.h @@ -0,0 +1,174 @@ +/* ==================================================================== + * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_OPENSSL_TYPES_H +#define HEADER_OPENSSL_TYPES_H + +#include + +#ifdef NO_ASN1_TYPEDEFS +#define ASN1_INTEGER ASN1_STRING +#define ASN1_ENUMERATED ASN1_STRING +#define ASN1_BIT_STRING ASN1_STRING +#define ASN1_OCTET_STRING ASN1_STRING +#define ASN1_PRINTABLESTRING ASN1_STRING +#define ASN1_T61STRING ASN1_STRING +#define ASN1_IA5STRING ASN1_STRING +#define ASN1_UTCTIME ASN1_STRING +#define ASN1_GENERALIZEDTIME ASN1_STRING +#define ASN1_TIME ASN1_STRING +#define ASN1_GENERALSTRING ASN1_STRING +#define ASN1_UNIVERSALSTRING ASN1_STRING +#define ASN1_BMPSTRING ASN1_STRING +#define ASN1_VISIBLESTRING ASN1_STRING +#define ASN1_UTF8STRING ASN1_STRING +#define ASN1_BOOLEAN int +#define ASN1_NULL int +#else +typedef struct asn1_string_st ASN1_INTEGER; +typedef struct asn1_string_st ASN1_ENUMERATED; +typedef struct asn1_string_st ASN1_BIT_STRING; +typedef struct asn1_string_st ASN1_OCTET_STRING; +typedef struct asn1_string_st ASN1_PRINTABLESTRING; +typedef struct asn1_string_st ASN1_T61STRING; +typedef struct asn1_string_st ASN1_IA5STRING; +typedef struct asn1_string_st ASN1_GENERALSTRING; +typedef struct asn1_string_st ASN1_UNIVERSALSTRING; +typedef struct asn1_string_st ASN1_BMPSTRING; +typedef struct asn1_string_st ASN1_UTCTIME; +typedef struct asn1_string_st ASN1_TIME; +typedef struct asn1_string_st ASN1_GENERALIZEDTIME; +typedef struct asn1_string_st ASN1_VISIBLESTRING; +typedef struct asn1_string_st ASN1_UTF8STRING; +typedef int ASN1_BOOLEAN; +typedef int ASN1_NULL; +#endif + +#ifdef OPENSSL_SYS_WIN32 +#undef X509_NAME +#undef X509_CERT_PAIR +#undef PKCS7_ISSUER_AND_SERIAL +#endif + +#ifdef BIGNUM +#undef BIGNUM +#endif +typedef struct bignum_st BIGNUM; +typedef struct bignum_ctx BN_CTX; +typedef struct bn_blinding_st BN_BLINDING; +typedef struct bn_mont_ctx_st BN_MONT_CTX; +typedef struct bn_recp_ctx_st BN_RECP_CTX; +typedef struct bn_gencb_st BN_GENCB; + +typedef struct buf_mem_st BUF_MEM; + +typedef struct evp_cipher_st EVP_CIPHER; +typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX; +typedef struct env_md_st EVP_MD; +typedef struct env_md_ctx_st EVP_MD_CTX; +typedef struct evp_pkey_st EVP_PKEY; + +typedef struct dh_st DH; +typedef struct dh_method DH_METHOD; + +typedef struct dsa_st DSA; +typedef struct dsa_method DSA_METHOD; + +typedef struct rsa_st RSA; +typedef struct rsa_meth_st RSA_METHOD; + +typedef struct rand_meth_st RAND_METHOD; + +typedef struct ecdh_method ECDH_METHOD; +typedef struct ecdsa_method ECDSA_METHOD; + +typedef struct x509_st X509; +typedef struct X509_algor_st X509_ALGOR; +typedef struct X509_crl_st X509_CRL; +typedef struct X509_name_st X509_NAME; +typedef struct x509_store_st X509_STORE; +typedef struct x509_store_ctx_st X509_STORE_CTX; + +typedef struct v3_ext_ctx X509V3_CTX; +typedef struct conf_st CONF; + +typedef struct store_st STORE; +typedef struct store_method_st STORE_METHOD; + +typedef struct ui_st UI; +typedef struct ui_method_st UI_METHOD; + +typedef struct st_ERR_FNS ERR_FNS; + +typedef struct engine_st ENGINE; + +typedef struct X509_POLICY_NODE_st X509_POLICY_NODE; +typedef struct X509_POLICY_LEVEL_st X509_POLICY_LEVEL; +typedef struct X509_POLICY_TREE_st X509_POLICY_TREE; +typedef struct X509_POLICY_CACHE_st X509_POLICY_CACHE; + + /* If placed in pkcs12.h, we end up with a circular depency with pkcs7.h */ +#define DECLARE_PKCS12_STACK_OF(type) /* Nothing */ +#define IMPLEMENT_PKCS12_STACK_OF(type) /* Nothing */ + +typedef struct crypto_ex_data_st CRYPTO_EX_DATA; +/* Callback types for crypto.h */ +typedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad, + int idx, long argl, void *argp); +typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad, + int idx, long argl, void *argp); +typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, + int idx, long argl, void *argp); + +#endif /* def HEADER_OPENSSL_TYPES_H */ diff --git a/h/openssl/pem.h b/h/openssl/pem.h new file mode 100644 index 0000000..7db6b42 --- /dev/null +++ b/h/openssl/pem.h @@ -0,0 +1,737 @@ +/* crypto/pem/pem.h */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_PEM_H +#define HEADER_PEM_H + +#include +#ifndef OPENSSL_NO_BIO +#include +#endif +#ifndef OPENSSL_NO_STACK +#include +#endif +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define PEM_BUFSIZE 1024 + +#define PEM_OBJ_UNDEF 0 +#define PEM_OBJ_X509 1 +#define PEM_OBJ_X509_REQ 2 +#define PEM_OBJ_CRL 3 +#define PEM_OBJ_SSL_SESSION 4 +#define PEM_OBJ_PRIV_KEY 10 +#define PEM_OBJ_PRIV_RSA 11 +#define PEM_OBJ_PRIV_DSA 12 +#define PEM_OBJ_PRIV_DH 13 +#define PEM_OBJ_PUB_RSA 14 +#define PEM_OBJ_PUB_DSA 15 +#define PEM_OBJ_PUB_DH 16 +#define PEM_OBJ_DHPARAMS 17 +#define PEM_OBJ_DSAPARAMS 18 +#define PEM_OBJ_PRIV_RSA_PUBLIC 19 +#define PEM_OBJ_PRIV_ECDSA 20 +#define PEM_OBJ_PUB_ECDSA 21 +#define PEM_OBJ_ECPARAMETERS 22 + +#define PEM_ERROR 30 +#define PEM_DEK_DES_CBC 40 +#define PEM_DEK_IDEA_CBC 45 +#define PEM_DEK_DES_EDE 50 +#define PEM_DEK_DES_ECB 60 +#define PEM_DEK_RSA 70 +#define PEM_DEK_RSA_MD2 80 +#define PEM_DEK_RSA_MD5 90 + +#define PEM_MD_MD2 NID_md2 +#define PEM_MD_MD5 NID_md5 +#define PEM_MD_SHA NID_sha +#define PEM_MD_MD2_RSA NID_md2WithRSAEncryption +#define PEM_MD_MD5_RSA NID_md5WithRSAEncryption +#define PEM_MD_SHA_RSA NID_sha1WithRSAEncryption + +#define PEM_STRING_X509_OLD "X509 CERTIFICATE" +#define PEM_STRING_X509 "CERTIFICATE" +#define PEM_STRING_X509_PAIR "CERTIFICATE PAIR" +#define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE" +#define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST" +#define PEM_STRING_X509_REQ "CERTIFICATE REQUEST" +#define PEM_STRING_X509_CRL "X509 CRL" +#define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY" +#define PEM_STRING_PUBLIC "PUBLIC KEY" +#define PEM_STRING_RSA "RSA PRIVATE KEY" +#define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY" +#define PEM_STRING_DSA "DSA PRIVATE KEY" +#define PEM_STRING_DSA_PUBLIC "DSA PUBLIC KEY" +#define PEM_STRING_PKCS7 "PKCS7" +#define PEM_STRING_PKCS8 "ENCRYPTED PRIVATE KEY" +#define PEM_STRING_PKCS8INF "PRIVATE KEY" +#define PEM_STRING_DHPARAMS "DH PARAMETERS" +#define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS" +#define PEM_STRING_DSAPARAMS "DSA PARAMETERS" +#define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY" +#define PEM_STRING_ECPARAMETERS "EC PARAMETERS" +#define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY" + + /* Note that this structure is initialised by PEM_SealInit and cleaned up + by PEM_SealFinal (at least for now) */ +typedef struct PEM_Encode_Seal_st + { + EVP_ENCODE_CTX encode; + EVP_MD_CTX md; + EVP_CIPHER_CTX cipher; + } PEM_ENCODE_SEAL_CTX; + +/* enc_type is one off */ +#define PEM_TYPE_ENCRYPTED 10 +#define PEM_TYPE_MIC_ONLY 20 +#define PEM_TYPE_MIC_CLEAR 30 +#define PEM_TYPE_CLEAR 40 + +typedef struct pem_recip_st + { + char *name; + X509_NAME *dn; + + int cipher; + int key_enc; + /* char iv[8]; unused and wrong size */ + } PEM_USER; + +typedef struct pem_ctx_st + { + int type; /* what type of object */ + + struct { + int version; + int mode; + } proc_type; + + char *domain; + + struct { + int cipher; + /* unused, and wrong size + unsigned char iv[8]; */ + } DEK_info; + + PEM_USER *originator; + + int num_recipient; + PEM_USER **recipient; + +#ifndef OPENSSL_NO_STACK + STACK *x509_chain; /* certificate chain */ +#else + char *x509_chain; /* certificate chain */ +#endif + EVP_MD *md; /* signature type */ + + int md_enc; /* is the md encrypted or not? */ + int md_len; /* length of md_data */ + char *md_data; /* message digest, could be pkey encrypted */ + + EVP_CIPHER *dec; /* date encryption cipher */ + int key_len; /* key length */ + unsigned char *key; /* key */ + /* unused, and wrong size + unsigned char iv[8]; */ + + + int data_enc; /* is the data encrypted */ + int data_len; + unsigned char *data; + } PEM_CTX; + +/* These macros make the PEM_read/PEM_write functions easier to maintain and + * write. Now they are all implemented with either: + * IMPLEMENT_PEM_rw(...) or IMPLEMENT_PEM_rw_cb(...) + */ + +#ifdef OPENSSL_NO_FP_API + +#define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/ +#define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/ +#define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/ + +#else + +#define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \ +type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\ +{ \ +return(((type *(*)(D2I_OF(type),char *,FILE *,type **,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_read))(d2i_##asn1, str,fp,x,cb,u)); \ +} \ + +#define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \ +int PEM_write_##name(FILE *fp, type *x) \ +{ \ +return(((int (*)(I2D_OF(type),const char *,FILE *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write))(i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL)); \ +} + +#define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \ +int PEM_write_##name(FILE *fp, const type *x) \ +{ \ +return(((int (*)(I2D_OF_const(type),const char *,FILE *, const type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write))(i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL)); \ +} + +#define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \ +int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, \ + void *u) \ + { \ + return(((int (*)(I2D_OF(type),const char *,FILE *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write))(i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u)); \ + } + +#define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \ +int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, \ + void *u) \ + { \ + return(((int (*)(I2D_OF_const(type),const char *,FILE *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write))(i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u)); \ + } + +#endif + +#define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ +type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\ +{ \ +return(((type *(*)(D2I_OF(type),const char *,BIO *,type **,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_read_bio))(d2i_##asn1, str,bp,x,cb,u)); \ +} + +#define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ +int PEM_write_bio_##name(BIO *bp, type *x) \ +{ \ +return(((int (*)(I2D_OF(type),const char *,BIO *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL)); \ +} + +#define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ +int PEM_write_bio_##name(BIO *bp, const type *x) \ +{ \ +return(((int (*)(I2D_OF_const(type),const char *,BIO *,const type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL)); \ +} + +#define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ +int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ + { \ + return(((int (*)(I2D_OF(type),const char *,BIO *,type *,const EVP_CIPHER *,unsigned char *,int,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u)); \ + } + +#define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ +int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ + { \ + return(((int (*)(I2D_OF_const(type),const char *,BIO *,type *,const EVP_CIPHER *,unsigned char *,int,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u)); \ + } + +#define IMPLEMENT_PEM_write(name, type, str, asn1) \ + IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ + IMPLEMENT_PEM_write_fp(name, type, str, asn1) + +#define IMPLEMENT_PEM_write_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) + +#define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) + +#define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) + +#define IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ + IMPLEMENT_PEM_read_fp(name, type, str, asn1) + +#define IMPLEMENT_PEM_rw(name, type, str, asn1) \ + IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_write(name, type, str, asn1) + +#define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \ + IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_write_const(name, type, str, asn1) + +#define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \ + IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb(name, type, str, asn1) + +/* These are the same except they are for the declarations */ + +#if defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_NO_FP_API) + +#define DECLARE_PEM_read_fp(name, type) /**/ +#define DECLARE_PEM_write_fp(name, type) /**/ +#define DECLARE_PEM_write_cb_fp(name, type) /**/ + +#else + +#define DECLARE_PEM_read_fp(name, type) \ + type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u); + +#define DECLARE_PEM_write_fp(name, type) \ + int PEM_write_##name(FILE *fp, type *x); + +#define DECLARE_PEM_write_fp_const(name, type) \ + int PEM_write_##name(FILE *fp, const type *x); + +#define DECLARE_PEM_write_cb_fp(name, type) \ + int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, void *u); + +#endif + +#ifndef OPENSSL_NO_BIO +#define DECLARE_PEM_read_bio(name, type) \ + type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u); + +#define DECLARE_PEM_write_bio(name, type) \ + int PEM_write_bio_##name(BIO *bp, type *x); + +#define DECLARE_PEM_write_bio_const(name, type) \ + int PEM_write_bio_##name(BIO *bp, const type *x); + +#define DECLARE_PEM_write_cb_bio(name, type) \ + int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, void *u); + +#else + +#define DECLARE_PEM_read_bio(name, type) /**/ +#define DECLARE_PEM_write_bio(name, type) /**/ +#define DECLARE_PEM_write_cb_bio(name, type) /**/ + +#endif + +#define DECLARE_PEM_write(name, type) \ + DECLARE_PEM_write_bio(name, type) \ + DECLARE_PEM_write_fp(name, type) + +#define DECLARE_PEM_write_const(name, type) \ + DECLARE_PEM_write_bio_const(name, type) \ + DECLARE_PEM_write_fp_const(name, type) + +#define DECLARE_PEM_write_cb(name, type) \ + DECLARE_PEM_write_cb_bio(name, type) \ + DECLARE_PEM_write_cb_fp(name, type) + +#define DECLARE_PEM_read(name, type) \ + DECLARE_PEM_read_bio(name, type) \ + DECLARE_PEM_read_fp(name, type) + +#define DECLARE_PEM_rw(name, type) \ + DECLARE_PEM_read(name, type) \ + DECLARE_PEM_write(name, type) + +#define DECLARE_PEM_rw_const(name, type) \ + DECLARE_PEM_read(name, type) \ + DECLARE_PEM_write_const(name, type) + +#define DECLARE_PEM_rw_cb(name, type) \ + DECLARE_PEM_read(name, type) \ + DECLARE_PEM_write_cb(name, type) + +#ifdef SSLEAY_MACROS + +#define PEM_write_SSL_SESSION(fp,x) \ + PEM_ASN1_write((int (*)())i2d_SSL_SESSION, \ + PEM_STRING_SSL_SESSION,fp, (char *)x, NULL,NULL,0,NULL,NULL) +#define PEM_write_X509(fp,x) \ + PEM_ASN1_write((int (*)())i2d_X509,PEM_STRING_X509,fp, \ + (char *)x, NULL,NULL,0,NULL,NULL) +#define PEM_write_X509_REQ(fp,x) PEM_ASN1_write( \ + (int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,fp,(char *)x, \ + NULL,NULL,0,NULL,NULL) +#define PEM_write_X509_CRL(fp,x) \ + PEM_ASN1_write((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL, \ + fp,(char *)x, NULL,NULL,0,NULL,NULL) +#define PEM_write_RSAPrivateKey(fp,x,enc,kstr,klen,cb,u) \ + PEM_ASN1_write((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,fp,\ + (char *)x,enc,kstr,klen,cb,u) +#define PEM_write_RSAPublicKey(fp,x) \ + PEM_ASN1_write((int (*)())i2d_RSAPublicKey,\ + PEM_STRING_RSA_PUBLIC,fp,(char *)x,NULL,NULL,0,NULL,NULL) +#define PEM_write_DSAPrivateKey(fp,x,enc,kstr,klen,cb,u) \ + PEM_ASN1_write((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,fp,\ + (char *)x,enc,kstr,klen,cb,u) +#define PEM_write_PrivateKey(bp,x,enc,kstr,klen,cb,u) \ + PEM_ASN1_write((int (*)())i2d_PrivateKey,\ + (((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\ + bp,(char *)x,enc,kstr,klen,cb,u) +#define PEM_write_PKCS7(fp,x) \ + PEM_ASN1_write((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,fp, \ + (char *)x, NULL,NULL,0,NULL,NULL) +#define PEM_write_DHparams(fp,x) \ + PEM_ASN1_write((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,fp,\ + (char *)x,NULL,NULL,0,NULL,NULL) + +#define PEM_write_NETSCAPE_CERT_SEQUENCE(fp,x) \ + PEM_ASN1_write((int (*)())i2d_NETSCAPE_CERT_SEQUENCE, \ + PEM_STRING_X509,fp, \ + (char *)x, NULL,NULL,0,NULL,NULL) + +#define PEM_read_SSL_SESSION(fp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read( \ + (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,fp,(char **)x,cb,u) +#define PEM_read_X509(fp,x,cb,u) (X509 *)PEM_ASN1_read( \ + (char *(*)())d2i_X509,PEM_STRING_X509,fp,(char **)x,cb,u) +#define PEM_read_X509_REQ(fp,x,cb,u) (X509_REQ *)PEM_ASN1_read( \ + (char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,fp,(char **)x,cb,u) +#define PEM_read_X509_CRL(fp,x,cb,u) (X509_CRL *)PEM_ASN1_read( \ + (char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,fp,(char **)x,cb,u) +#define PEM_read_RSAPrivateKey(fp,x,cb,u) (RSA *)PEM_ASN1_read( \ + (char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,fp,(char **)x,cb,u) +#define PEM_read_RSAPublicKey(fp,x,cb,u) (RSA *)PEM_ASN1_read( \ + (char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,fp,(char **)x,cb,u) +#define PEM_read_DSAPrivateKey(fp,x,cb,u) (DSA *)PEM_ASN1_read( \ + (char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,fp,(char **)x,cb,u) +#define PEM_read_PrivateKey(fp,x,cb,u) (EVP_PKEY *)PEM_ASN1_read( \ + (char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,fp,(char **)x,cb,u) +#define PEM_read_PKCS7(fp,x,cb,u) (PKCS7 *)PEM_ASN1_read( \ + (char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,fp,(char **)x,cb,u) +#define PEM_read_DHparams(fp,x,cb,u) (DH *)PEM_ASN1_read( \ + (char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,fp,(char **)x,cb,u) + +#define PEM_read_NETSCAPE_CERT_SEQUENCE(fp,x,cb,u) \ + (NETSCAPE_CERT_SEQUENCE *)PEM_ASN1_read( \ + (char *(*)())d2i_NETSCAPE_CERT_SEQUENCE,PEM_STRING_X509,fp,\ + (char **)x,cb,u) + +#define PEM_write_bio_X509(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_X509,PEM_STRING_X509,bp, \ + (char *)x, NULL,NULL,0,NULL,NULL) +#define PEM_write_bio_X509_REQ(bp,x) PEM_ASN1_write_bio( \ + (int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,bp,(char *)x, \ + NULL,NULL,0,NULL,NULL) +#define PEM_write_bio_X509_CRL(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL,\ + bp,(char *)x, NULL,NULL,0,NULL,NULL) +#define PEM_write_bio_RSAPrivateKey(bp,x,enc,kstr,klen,cb,u) \ + PEM_ASN1_write_bio((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,\ + bp,(char *)x,enc,kstr,klen,cb,u) +#define PEM_write_bio_RSAPublicKey(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_RSAPublicKey, \ + PEM_STRING_RSA_PUBLIC,\ + bp,(char *)x,NULL,NULL,0,NULL,NULL) +#define PEM_write_bio_DSAPrivateKey(bp,x,enc,kstr,klen,cb,u) \ + PEM_ASN1_write_bio((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,\ + bp,(char *)x,enc,kstr,klen,cb,u) +#define PEM_write_bio_PrivateKey(bp,x,enc,kstr,klen,cb,u) \ + PEM_ASN1_write_bio((int (*)())i2d_PrivateKey,\ + (((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\ + bp,(char *)x,enc,kstr,klen,cb,u) +#define PEM_write_bio_PKCS7(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,bp, \ + (char *)x, NULL,NULL,0,NULL,NULL) +#define PEM_write_bio_DHparams(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,\ + bp,(char *)x,NULL,NULL,0,NULL,NULL) +#define PEM_write_bio_DSAparams(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_DSAparams, \ + PEM_STRING_DSAPARAMS,bp,(char *)x,NULL,NULL,0,NULL,NULL) + +#define PEM_write_bio_NETSCAPE_CERT_SEQUENCE(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_NETSCAPE_CERT_SEQUENCE, \ + PEM_STRING_X509,bp, \ + (char *)x, NULL,NULL,0,NULL,NULL) + +#define PEM_read_bio_X509(bp,x,cb,u) (X509 *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_X509,PEM_STRING_X509,bp,(char **)x,cb,u) +#define PEM_read_bio_X509_REQ(bp,x,cb,u) (X509_REQ *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,bp,(char **)x,cb,u) +#define PEM_read_bio_X509_CRL(bp,x,cb,u) (X509_CRL *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,bp,(char **)x,cb,u) +#define PEM_read_bio_RSAPrivateKey(bp,x,cb,u) (RSA *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,bp,(char **)x,cb,u) +#define PEM_read_bio_RSAPublicKey(bp,x,cb,u) (RSA *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,bp,(char **)x,cb,u) +#define PEM_read_bio_DSAPrivateKey(bp,x,cb,u) (DSA *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,bp,(char **)x,cb,u) +#define PEM_read_bio_PrivateKey(bp,x,cb,u) (EVP_PKEY *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,bp,(char **)x,cb,u) + +#define PEM_read_bio_PKCS7(bp,x,cb,u) (PKCS7 *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,bp,(char **)x,cb,u) +#define PEM_read_bio_DHparams(bp,x,cb,u) (DH *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,bp,(char **)x,cb,u) +#define PEM_read_bio_DSAparams(bp,x,cb,u) (DSA *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_DSAparams,PEM_STRING_DSAPARAMS,bp,(char **)x,cb,u) + +#define PEM_read_bio_NETSCAPE_CERT_SEQUENCE(bp,x,cb,u) \ + (NETSCAPE_CERT_SEQUENCE *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_NETSCAPE_CERT_SEQUENCE,PEM_STRING_X509,bp,\ + (char **)x,cb,u) + +#endif + +#if 1 +/* "userdata": new with OpenSSL 0.9.4 */ +typedef int pem_password_cb(char *buf, int size, int rwflag, void *userdata); +#else +/* OpenSSL 0.9.3, 0.9.3a */ +typedef int pem_password_cb(char *buf, int size, int rwflag); +#endif + +int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher); +int PEM_do_header (EVP_CIPHER_INFO *cipher, unsigned char *data,long *len, + pem_password_cb *callback,void *u); + +#ifndef OPENSSL_NO_BIO +int PEM_read_bio(BIO *bp, char **name, char **header, + unsigned char **data,long *len); +int PEM_write_bio(BIO *bp,const char *name,char *hdr,unsigned char *data, + long len); +int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, const char *name, BIO *bp, + pem_password_cb *cb, void *u); +void * PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, + void **x, pem_password_cb *cb, void *u); +#define PEM_ASN1_read_bio_of(type,d2i,name,bp,x,cb,u) \ +((type *(*)(D2I_OF(type),const char *,BIO *,type **,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_read_bio))(d2i,name,bp,x,cb,u) +int PEM_ASN1_write_bio(i2d_of_void *i2d,const char *name,BIO *bp,char *x, + const EVP_CIPHER *enc,unsigned char *kstr,int klen, + pem_password_cb *cb, void *u); +#define PEM_ASN1_write_bio_of(type,i2d,name,bp,x,enc,kstr,klen,cb,u) \ + ((int (*)(I2D_OF(type),const char *,BIO *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d,name,bp,x,enc,kstr,klen,cb,u) + +STACK_OF(X509_INFO) * PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u); +int PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc, + unsigned char *kstr, int klen, pem_password_cb *cd, void *u); +#endif + +#ifndef OPENSSL_SYS_WIN16 +int PEM_read(FILE *fp, char **name, char **header, + unsigned char **data,long *len); +int PEM_write(FILE *fp,char *name,char *hdr,unsigned char *data,long len); +void * PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x, + pem_password_cb *cb, void *u); +int PEM_ASN1_write(i2d_of_void *i2d,const char *name,FILE *fp, + char *x,const EVP_CIPHER *enc,unsigned char *kstr, + int klen,pem_password_cb *callback, void *u); +STACK_OF(X509_INFO) * PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, + pem_password_cb *cb, void *u); +#endif + +int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, + EVP_MD *md_type, unsigned char **ek, int *ekl, + unsigned char *iv, EVP_PKEY **pubk, int npubk); +void PEM_SealUpdate(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *out, int *outl, + unsigned char *in, int inl); +int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig,int *sigl, + unsigned char *out, int *outl, EVP_PKEY *priv); + +void PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type); +void PEM_SignUpdate(EVP_MD_CTX *ctx,unsigned char *d,unsigned int cnt); +int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, + unsigned int *siglen, EVP_PKEY *pkey); + +int PEM_def_callback(char *buf, int num, int w, void *key); +void PEM_proc_type(char *buf, int type); +void PEM_dek_info(char *buf, const char *type, int len, char *str); + +#ifndef SSLEAY_MACROS + +#include + +DECLARE_PEM_rw(X509, X509) + +DECLARE_PEM_rw(X509_AUX, X509) + +DECLARE_PEM_rw(X509_CERT_PAIR, X509_CERT_PAIR) + +DECLARE_PEM_rw(X509_REQ, X509_REQ) +DECLARE_PEM_write(X509_REQ_NEW, X509_REQ) + +DECLARE_PEM_rw(X509_CRL, X509_CRL) + +DECLARE_PEM_rw(PKCS7, PKCS7) + +DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE, NETSCAPE_CERT_SEQUENCE) + +DECLARE_PEM_rw(PKCS8, X509_SIG) + +DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) + +#ifndef OPENSSL_NO_RSA + +DECLARE_PEM_rw_cb(RSAPrivateKey, RSA) + +DECLARE_PEM_rw_const(RSAPublicKey, RSA) +DECLARE_PEM_rw(RSA_PUBKEY, RSA) + +#endif + +#ifndef OPENSSL_NO_DSA + +DECLARE_PEM_rw_cb(DSAPrivateKey, DSA) + +DECLARE_PEM_rw(DSA_PUBKEY, DSA) + +DECLARE_PEM_rw_const(DSAparams, DSA) + +#endif + +#ifndef OPENSSL_NO_EC +DECLARE_PEM_rw_const(ECPKParameters, EC_GROUP) +DECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY) +DECLARE_PEM_rw(EC_PUBKEY, EC_KEY) +#endif + +#ifndef OPENSSL_NO_DH + +DECLARE_PEM_rw_const(DHparams, DH) + +#endif + +DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY) + +DECLARE_PEM_rw(PUBKEY, EVP_PKEY) + +int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid, + char *kstr, int klen, + pem_password_cb *cb, void *u); +int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *, + char *, int, pem_password_cb *, void *); +int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, + char *kstr, int klen, + pem_password_cb *cb, void *u); +int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid, + char *kstr, int klen, + pem_password_cb *cb, void *u); +EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u); + +int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, + char *kstr, int klen, + pem_password_cb *cb, void *u); +int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid, + char *kstr, int klen, + pem_password_cb *cb, void *u); +int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid, + char *kstr, int klen, + pem_password_cb *cb, void *u); + +EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u); + +int PEM_write_PKCS8PrivateKey(FILE *fp,EVP_PKEY *x,const EVP_CIPHER *enc, + char *kstr,int klen, pem_password_cb *cd, void *u); + +#endif /* SSLEAY_MACROS */ + + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_PEM_strings(void); + +/* Error codes for the PEM functions. */ + +/* Function codes. */ +#define PEM_F_D2I_PKCS8PRIVATEKEY_BIO 120 +#define PEM_F_D2I_PKCS8PRIVATEKEY_FP 121 +#define PEM_F_DO_PK8PKEY 126 +#define PEM_F_DO_PK8PKEY_FP 125 +#define PEM_F_LOAD_IV 101 +#define PEM_F_PEM_ASN1_READ 102 +#define PEM_F_PEM_ASN1_READ_BIO 103 +#define PEM_F_PEM_ASN1_WRITE 104 +#define PEM_F_PEM_ASN1_WRITE_BIO 105 +#define PEM_F_PEM_DEF_CALLBACK 100 +#define PEM_F_PEM_DO_HEADER 106 +#define PEM_F_PEM_F_PEM_WRITE_PKCS8PRIVATEKEY 118 +#define PEM_F_PEM_GET_EVP_CIPHER_INFO 107 +#define PEM_F_PEM_PK8PKEY 119 +#define PEM_F_PEM_READ 108 +#define PEM_F_PEM_READ_BIO 109 +#define PEM_F_PEM_READ_BIO_PRIVATEKEY 123 +#define PEM_F_PEM_READ_PRIVATEKEY 124 +#define PEM_F_PEM_SEALFINAL 110 +#define PEM_F_PEM_SEALINIT 111 +#define PEM_F_PEM_SIGNFINAL 112 +#define PEM_F_PEM_WRITE 113 +#define PEM_F_PEM_WRITE_BIO 114 +#define PEM_F_PEM_X509_INFO_READ 115 +#define PEM_F_PEM_X509_INFO_READ_BIO 116 +#define PEM_F_PEM_X509_INFO_WRITE_BIO 117 + +/* Reason codes. */ +#define PEM_R_BAD_BASE64_DECODE 100 +#define PEM_R_BAD_DECRYPT 101 +#define PEM_R_BAD_END_LINE 102 +#define PEM_R_BAD_IV_CHARS 103 +#define PEM_R_BAD_PASSWORD_READ 104 +#define PEM_R_ERROR_CONVERTING_PRIVATE_KEY 115 +#define PEM_R_NOT_DEK_INFO 105 +#define PEM_R_NOT_ENCRYPTED 106 +#define PEM_R_NOT_PROC_TYPE 107 +#define PEM_R_NO_START_LINE 108 +#define PEM_R_PROBLEMS_GETTING_PASSWORD 109 +#define PEM_R_PUBLIC_KEY_NO_RSA 110 +#define PEM_R_READ_KEY 111 +#define PEM_R_SHORT_HEADER 112 +#define PEM_R_UNSUPPORTED_CIPHER 113 +#define PEM_R_UNSUPPORTED_ENCRYPTION 114 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/openssl/pem2.h b/h/openssl/pem2.h new file mode 100644 index 0000000..f31790d --- /dev/null +++ b/h/openssl/pem2.h @@ -0,0 +1,70 @@ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +/* + * This header only exists to break a circular dependency between pem and err + * Ben 30 Jan 1999. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef HEADER_PEM_H +void ERR_load_PEM_strings(void); +#endif + +#ifdef __cplusplus +} +#endif diff --git a/h/openssl/pkcs12.h b/h/openssl/pkcs12.h new file mode 100644 index 0000000..a2d7e35 --- /dev/null +++ b/h/openssl/pkcs12.h @@ -0,0 +1,333 @@ +/* pkcs12.h */ +/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL + * project 1999. + */ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_PKCS12_H +#define HEADER_PKCS12_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define PKCS12_KEY_ID 1 +#define PKCS12_IV_ID 2 +#define PKCS12_MAC_ID 3 + +/* Default iteration count */ +#ifndef PKCS12_DEFAULT_ITER +#define PKCS12_DEFAULT_ITER PKCS5_DEFAULT_ITER +#endif + +#define PKCS12_MAC_KEY_LENGTH 20 + +#define PKCS12_SALT_LEN 8 + +/* Uncomment out next line for unicode password and names, otherwise ASCII */ + +/*#define PBE_UNICODE*/ + +#ifdef PBE_UNICODE +#define PKCS12_key_gen PKCS12_key_gen_uni +#define PKCS12_add_friendlyname PKCS12_add_friendlyname_uni +#else +#define PKCS12_key_gen PKCS12_key_gen_asc +#define PKCS12_add_friendlyname PKCS12_add_friendlyname_asc +#endif + +/* MS key usage constants */ + +#define KEY_EX 0x10 +#define KEY_SIG 0x80 + +typedef struct { +X509_SIG *dinfo; +ASN1_OCTET_STRING *salt; +ASN1_INTEGER *iter; /* defaults to 1 */ +} PKCS12_MAC_DATA; + +typedef struct { +ASN1_INTEGER *version; +PKCS12_MAC_DATA *mac; +PKCS7 *authsafes; +} PKCS12; + +PREDECLARE_STACK_OF(PKCS12_SAFEBAG) + +typedef struct { +ASN1_OBJECT *type; +union { + struct pkcs12_bag_st *bag; /* secret, crl and certbag */ + struct pkcs8_priv_key_info_st *keybag; /* keybag */ + X509_SIG *shkeybag; /* shrouded key bag */ + STACK_OF(PKCS12_SAFEBAG) *safes; + ASN1_TYPE *other; +}value; +STACK_OF(X509_ATTRIBUTE) *attrib; +} PKCS12_SAFEBAG; + +DECLARE_STACK_OF(PKCS12_SAFEBAG) +DECLARE_ASN1_SET_OF(PKCS12_SAFEBAG) +DECLARE_PKCS12_STACK_OF(PKCS12_SAFEBAG) + +typedef struct pkcs12_bag_st { +ASN1_OBJECT *type; +union { + ASN1_OCTET_STRING *x509cert; + ASN1_OCTET_STRING *x509crl; + ASN1_OCTET_STRING *octet; + ASN1_IA5STRING *sdsicert; + ASN1_TYPE *other; /* Secret or other bag */ +}value; +} PKCS12_BAGS; + +#define PKCS12_ERROR 0 +#define PKCS12_OK 1 + +/* Compatibility macros */ + +#define M_PKCS12_x5092certbag PKCS12_x5092certbag +#define M_PKCS12_x509crl2certbag PKCS12_x509crl2certbag + +#define M_PKCS12_certbag2x509 PKCS12_certbag2x509 +#define M_PKCS12_certbag2x509crl PKCS12_certbag2x509crl + +#define M_PKCS12_unpack_p7data PKCS12_unpack_p7data +#define M_PKCS12_pack_authsafes PKCS12_pack_authsafes +#define M_PKCS12_unpack_authsafes PKCS12_unpack_authsafes +#define M_PKCS12_unpack_p7encdata PKCS12_unpack_p7encdata + +#define M_PKCS12_decrypt_skey PKCS12_decrypt_skey +#define M_PKCS8_decrypt PKCS8_decrypt + +#define M_PKCS12_bag_type(bg) OBJ_obj2nid((bg)->type) +#define M_PKCS12_cert_bag_type(bg) OBJ_obj2nid((bg)->value.bag->type) +#define M_PKCS12_crl_bag_type M_PKCS12_cert_bag_type + +#define PKCS12_get_attr(bag, attr_nid) \ + PKCS12_get_attr_gen(bag->attrib, attr_nid) + +#define PKCS8_get_attr(p8, attr_nid) \ + PKCS12_get_attr_gen(p8->attributes, attr_nid) + +#define PKCS12_mac_present(p12) ((p12)->mac ? 1 : 0) + + +PKCS12_SAFEBAG *PKCS12_x5092certbag(X509 *x509); +PKCS12_SAFEBAG *PKCS12_x509crl2certbag(X509_CRL *crl); +X509 *PKCS12_certbag2x509(PKCS12_SAFEBAG *bag); +X509_CRL *PKCS12_certbag2x509crl(PKCS12_SAFEBAG *bag); + +PKCS12_SAFEBAG *PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it, int nid1, + int nid2); +PKCS12_SAFEBAG *PKCS12_MAKE_KEYBAG(PKCS8_PRIV_KEY_INFO *p8); +PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(X509_SIG *p8, const char *pass, int passlen); +PKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey(PKCS12_SAFEBAG *bag, const char *pass, + int passlen); +X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher, + const char *pass, int passlen, + unsigned char *salt, int saltlen, int iter, + PKCS8_PRIV_KEY_INFO *p8); +PKCS12_SAFEBAG *PKCS12_MAKE_SHKEYBAG(int pbe_nid, const char *pass, + int passlen, unsigned char *salt, + int saltlen, int iter, + PKCS8_PRIV_KEY_INFO *p8); +PKCS7 *PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) *sk); +STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7); +PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen, + unsigned char *salt, int saltlen, int iter, + STACK_OF(PKCS12_SAFEBAG) *bags); +STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass, int passlen); + +int PKCS12_pack_authsafes(PKCS12 *p12, STACK_OF(PKCS7) *safes); +STACK_OF(PKCS7) *PKCS12_unpack_authsafes(PKCS12 *p12); + +int PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, unsigned char *name, int namelen); +int PKCS12_add_friendlyname_asc(PKCS12_SAFEBAG *bag, const char *name, + int namelen); +int PKCS12_add_CSPName_asc(PKCS12_SAFEBAG *bag, const char *name, + int namelen); +int PKCS12_add_friendlyname_uni(PKCS12_SAFEBAG *bag, const unsigned char *name, + int namelen); +int PKCS8_add_keyusage(PKCS8_PRIV_KEY_INFO *p8, int usage); +ASN1_TYPE *PKCS12_get_attr_gen(STACK_OF(X509_ATTRIBUTE) *attrs, int attr_nid); +char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag); +unsigned char *PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass, + int passlen, unsigned char *in, int inlen, + unsigned char **data, int *datalen, int en_de); +void * PKCS12_item_decrypt_d2i(X509_ALGOR *algor, const ASN1_ITEM *it, + const char *pass, int passlen, ASN1_OCTET_STRING *oct, int zbuf); +ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, const ASN1_ITEM *it, + const char *pass, int passlen, + void *obj, int zbuf); +PKCS12 *PKCS12_init(int mode); +int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt, + int saltlen, int id, int iter, int n, + unsigned char *out, const EVP_MD *md_type); +int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, int saltlen, int id, int iter, int n, unsigned char *out, const EVP_MD *md_type); +int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md_type, + int en_de); +int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen, + unsigned char *mac, unsigned int *maclen); +int PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen); +int PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen, + unsigned char *salt, int saltlen, int iter, + const EVP_MD *md_type); +int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, + int saltlen, const EVP_MD *md_type); +unsigned char *asc2uni(const char *asc, int asclen, unsigned char **uni, int *unilen); +char *uni2asc(unsigned char *uni, int unilen); + +DECLARE_ASN1_FUNCTIONS(PKCS12) +DECLARE_ASN1_FUNCTIONS(PKCS12_MAC_DATA) +DECLARE_ASN1_FUNCTIONS(PKCS12_SAFEBAG) +DECLARE_ASN1_FUNCTIONS(PKCS12_BAGS) + +DECLARE_ASN1_ITEM(PKCS12_SAFEBAGS) +DECLARE_ASN1_ITEM(PKCS12_AUTHSAFES) + +void PKCS12_PBE_add(void); +int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, + STACK_OF(X509) **ca); +PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert, + STACK_OF(X509) *ca, int nid_key, int nid_cert, int iter, + int mac_iter, int keytype); + +PKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert); +PKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags, EVP_PKEY *key, + int key_usage, int iter, + int key_nid, char *pass); +int PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags, + int safe_nid, int iter, char *pass); +PKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid); + +int i2d_PKCS12_bio(BIO *bp, PKCS12 *p12); +int i2d_PKCS12_fp(FILE *fp, PKCS12 *p12); +PKCS12 *d2i_PKCS12_bio(BIO *bp, PKCS12 **p12); +PKCS12 *d2i_PKCS12_fp(FILE *fp, PKCS12 **p12); +int PKCS12_newpass(PKCS12 *p12, char *oldpass, char *newpass); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_PKCS12_strings(void); + +/* Error codes for the PKCS12 functions. */ + +/* Function codes. */ +#define PKCS12_F_PARSE_BAG 129 +#define PKCS12_F_PARSE_BAGS 103 +#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME 100 +#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_ASC 127 +#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI 102 +#define PKCS12_F_PKCS12_ADD_LOCALKEYID 104 +#define PKCS12_F_PKCS12_CREATE 105 +#define PKCS12_F_PKCS12_GEN_MAC 107 +#define PKCS12_F_PKCS12_INIT 109 +#define PKCS12_F_PKCS12_ITEM_DECRYPT_D2I 106 +#define PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT 108 +#define PKCS12_F_PKCS12_ITEM_PACK_SAFEBAG 117 +#define PKCS12_F_PKCS12_KEY_GEN_ASC 110 +#define PKCS12_F_PKCS12_KEY_GEN_UNI 111 +#define PKCS12_F_PKCS12_MAKE_KEYBAG 112 +#define PKCS12_F_PKCS12_MAKE_SHKEYBAG 113 +#define PKCS12_F_PKCS12_NEWPASS 128 +#define PKCS12_F_PKCS12_PACK_P7DATA 114 +#define PKCS12_F_PKCS12_PACK_P7ENCDATA 115 +#define PKCS12_F_PKCS12_PARSE 118 +#define PKCS12_F_PKCS12_PBE_CRYPT 119 +#define PKCS12_F_PKCS12_PBE_KEYIVGEN 120 +#define PKCS12_F_PKCS12_SETUP_MAC 122 +#define PKCS12_F_PKCS12_SET_MAC 123 +#define PKCS12_F_PKCS12_UNPACK_AUTHSAFES 130 +#define PKCS12_F_PKCS12_UNPACK_P7DATA 131 +#define PKCS12_F_PKCS12_VERIFY_MAC 126 +#define PKCS12_F_PKCS8_ADD_KEYUSAGE 124 +#define PKCS12_F_PKCS8_ENCRYPT 125 + +/* Reason codes. */ +#define PKCS12_R_CANT_PACK_STRUCTURE 100 +#define PKCS12_R_CONTENT_TYPE_NOT_DATA 121 +#define PKCS12_R_DECODE_ERROR 101 +#define PKCS12_R_ENCODE_ERROR 102 +#define PKCS12_R_ENCRYPT_ERROR 103 +#define PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE 120 +#define PKCS12_R_INVALID_NULL_ARGUMENT 104 +#define PKCS12_R_INVALID_NULL_PKCS12_POINTER 105 +#define PKCS12_R_IV_GEN_ERROR 106 +#define PKCS12_R_KEY_GEN_ERROR 107 +#define PKCS12_R_MAC_ABSENT 108 +#define PKCS12_R_MAC_GENERATION_ERROR 109 +#define PKCS12_R_MAC_SETUP_ERROR 110 +#define PKCS12_R_MAC_STRING_SET_ERROR 111 +#define PKCS12_R_MAC_VERIFY_ERROR 112 +#define PKCS12_R_MAC_VERIFY_FAILURE 113 +#define PKCS12_R_PARSE_ERROR 114 +#define PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR 115 +#define PKCS12_R_PKCS12_CIPHERFINAL_ERROR 116 +#define PKCS12_R_PKCS12_PBE_CRYPT_ERROR 117 +#define PKCS12_R_UNKNOWN_DIGEST_ALGORITHM 118 +#define PKCS12_R_UNSUPPORTED_PKCS12_MODE 119 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/openssl/pkcs7.h b/h/openssl/pkcs7.h new file mode 100644 index 0000000..952f379 --- /dev/null +++ b/h/openssl/pkcs7.h @@ -0,0 +1,463 @@ +/* crypto/pkcs7/pkcs7.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_PKCS7_H +#define HEADER_PKCS7_H + +#include +#include +#include + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OPENSSL_SYS_WIN32 +/* Under Win32 thes are defined in wincrypt.h */ +#undef PKCS7_ISSUER_AND_SERIAL +#undef PKCS7_SIGNER_INFO +#endif + +/* +Encryption_ID DES-CBC +Digest_ID MD5 +Digest_Encryption_ID rsaEncryption +Key_Encryption_ID rsaEncryption +*/ + +typedef struct pkcs7_issuer_and_serial_st + { + X509_NAME *issuer; + ASN1_INTEGER *serial; + } PKCS7_ISSUER_AND_SERIAL; + +typedef struct pkcs7_signer_info_st + { + ASN1_INTEGER *version; /* version 1 */ + PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; + X509_ALGOR *digest_alg; + STACK_OF(X509_ATTRIBUTE) *auth_attr; /* [ 0 ] */ + X509_ALGOR *digest_enc_alg; + ASN1_OCTET_STRING *enc_digest; + STACK_OF(X509_ATTRIBUTE) *unauth_attr; /* [ 1 ] */ + + /* The private key to sign with */ + EVP_PKEY *pkey; + } PKCS7_SIGNER_INFO; + +DECLARE_STACK_OF(PKCS7_SIGNER_INFO) +DECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO) + +typedef struct pkcs7_recip_info_st + { + ASN1_INTEGER *version; /* version 0 */ + PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; + X509_ALGOR *key_enc_algor; + ASN1_OCTET_STRING *enc_key; + X509 *cert; /* get the pub-key from this */ + } PKCS7_RECIP_INFO; + +DECLARE_STACK_OF(PKCS7_RECIP_INFO) +DECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO) + +typedef struct pkcs7_signed_st + { + ASN1_INTEGER *version; /* version 1 */ + STACK_OF(X509_ALGOR) *md_algs; /* md used */ + STACK_OF(X509) *cert; /* [ 0 ] */ + STACK_OF(X509_CRL) *crl; /* [ 1 ] */ + STACK_OF(PKCS7_SIGNER_INFO) *signer_info; + + struct pkcs7_st *contents; + } PKCS7_SIGNED; +/* The above structure is very very similar to PKCS7_SIGN_ENVELOPE. + * How about merging the two */ + +typedef struct pkcs7_enc_content_st + { + ASN1_OBJECT *content_type; + X509_ALGOR *algorithm; + ASN1_OCTET_STRING *enc_data; /* [ 0 ] */ + const EVP_CIPHER *cipher; + } PKCS7_ENC_CONTENT; + +typedef struct pkcs7_enveloped_st + { + ASN1_INTEGER *version; /* version 0 */ + STACK_OF(PKCS7_RECIP_INFO) *recipientinfo; + PKCS7_ENC_CONTENT *enc_data; + } PKCS7_ENVELOPE; + +typedef struct pkcs7_signedandenveloped_st + { + ASN1_INTEGER *version; /* version 1 */ + STACK_OF(X509_ALGOR) *md_algs; /* md used */ + STACK_OF(X509) *cert; /* [ 0 ] */ + STACK_OF(X509_CRL) *crl; /* [ 1 ] */ + STACK_OF(PKCS7_SIGNER_INFO) *signer_info; + + PKCS7_ENC_CONTENT *enc_data; + STACK_OF(PKCS7_RECIP_INFO) *recipientinfo; + } PKCS7_SIGN_ENVELOPE; + +typedef struct pkcs7_digest_st + { + ASN1_INTEGER *version; /* version 0 */ + X509_ALGOR *md; /* md used */ + struct pkcs7_st *contents; + ASN1_OCTET_STRING *digest; + } PKCS7_DIGEST; + +typedef struct pkcs7_encrypted_st + { + ASN1_INTEGER *version; /* version 0 */ + PKCS7_ENC_CONTENT *enc_data; + } PKCS7_ENCRYPT; + +typedef struct pkcs7_st + { + /* The following is non NULL if it contains ASN1 encoding of + * this structure */ + unsigned char *asn1; + long length; + +#define PKCS7_S_HEADER 0 +#define PKCS7_S_BODY 1 +#define PKCS7_S_TAIL 2 + int state; /* used during processing */ + + int detached; + + ASN1_OBJECT *type; + /* content as defined by the type */ + /* all encryption/message digests are applied to the 'contents', + * leaving out the 'type' field. */ + union { + char *ptr; + + /* NID_pkcs7_data */ + ASN1_OCTET_STRING *data; + + /* NID_pkcs7_signed */ + PKCS7_SIGNED *sign; + + /* NID_pkcs7_enveloped */ + PKCS7_ENVELOPE *enveloped; + + /* NID_pkcs7_signedAndEnveloped */ + PKCS7_SIGN_ENVELOPE *signed_and_enveloped; + + /* NID_pkcs7_digest */ + PKCS7_DIGEST *digest; + + /* NID_pkcs7_encrypted */ + PKCS7_ENCRYPT *encrypted; + + /* Anything else */ + ASN1_TYPE *other; + } d; + } PKCS7; + +DECLARE_STACK_OF(PKCS7) +DECLARE_ASN1_SET_OF(PKCS7) +DECLARE_PKCS12_STACK_OF(PKCS7) + +#define PKCS7_OP_SET_DETACHED_SIGNATURE 1 +#define PKCS7_OP_GET_DETACHED_SIGNATURE 2 + +#define PKCS7_get_signed_attributes(si) ((si)->auth_attr) +#define PKCS7_get_attributes(si) ((si)->unauth_attr) + +#define PKCS7_type_is_signed(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_signed) +#define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted) +#define PKCS7_type_is_enveloped(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_enveloped) +#define PKCS7_type_is_signedAndEnveloped(a) \ + (OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped) +#define PKCS7_type_is_data(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_data) + +#define PKCS7_type_is_digest(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_digest) + +#define PKCS7_set_detached(p,v) \ + PKCS7_ctrl(p,PKCS7_OP_SET_DETACHED_SIGNATURE,v,NULL) +#define PKCS7_get_detached(p) \ + PKCS7_ctrl(p,PKCS7_OP_GET_DETACHED_SIGNATURE,0,NULL) + +#define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7)) + +#ifdef SSLEAY_MACROS +#ifndef PKCS7_ISSUER_AND_SERIAL_digest +#define PKCS7_ISSUER_AND_SERIAL_digest(data,type,md,len) \ + ASN1_digest((int (*)())i2d_PKCS7_ISSUER_AND_SERIAL,type,\ + (char *)data,md,len) +#endif +#endif + +/* S/MIME related flags */ + +#define PKCS7_TEXT 0x1 +#define PKCS7_NOCERTS 0x2 +#define PKCS7_NOSIGS 0x4 +#define PKCS7_NOCHAIN 0x8 +#define PKCS7_NOINTERN 0x10 +#define PKCS7_NOVERIFY 0x20 +#define PKCS7_DETACHED 0x40 +#define PKCS7_BINARY 0x80 +#define PKCS7_NOATTR 0x100 +#define PKCS7_NOSMIMECAP 0x200 +#define PKCS7_NOOLDMIMETYPE 0x400 +#define PKCS7_CRLFEOL 0x800 +#define PKCS7_STREAM 0x1000 +#define PKCS7_NOCRL 0x2000 + +/* Flags: for compatibility with older code */ + +#define SMIME_TEXT PKCS7_TEXT +#define SMIME_NOCERTS PKCS7_NOCERTS +#define SMIME_NOSIGS PKCS7_NOSIGS +#define SMIME_NOCHAIN PKCS7_NOCHAIN +#define SMIME_NOINTERN PKCS7_NOINTERN +#define SMIME_NOVERIFY PKCS7_NOVERIFY +#define SMIME_DETACHED PKCS7_DETACHED +#define SMIME_BINARY PKCS7_BINARY +#define SMIME_NOATTR PKCS7_NOATTR + +DECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL) + +#ifndef SSLEAY_MACROS +int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data,const EVP_MD *type, + unsigned char *md,unsigned int *len); +#ifndef OPENSSL_NO_FP_API +PKCS7 *d2i_PKCS7_fp(FILE *fp,PKCS7 **p7); +int i2d_PKCS7_fp(FILE *fp,PKCS7 *p7); +#endif +PKCS7 *PKCS7_dup(PKCS7 *p7); +PKCS7 *d2i_PKCS7_bio(BIO *bp,PKCS7 **p7); +int i2d_PKCS7_bio(BIO *bp,PKCS7 *p7); +#endif + +DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNER_INFO) +DECLARE_ASN1_FUNCTIONS(PKCS7_RECIP_INFO) +DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNED) +DECLARE_ASN1_FUNCTIONS(PKCS7_ENC_CONTENT) +DECLARE_ASN1_FUNCTIONS(PKCS7_ENVELOPE) +DECLARE_ASN1_FUNCTIONS(PKCS7_SIGN_ENVELOPE) +DECLARE_ASN1_FUNCTIONS(PKCS7_DIGEST) +DECLARE_ASN1_FUNCTIONS(PKCS7_ENCRYPT) +DECLARE_ASN1_FUNCTIONS(PKCS7) + +DECLARE_ASN1_ITEM(PKCS7_ATTR_SIGN) +DECLARE_ASN1_ITEM(PKCS7_ATTR_VERIFY) + +DECLARE_ASN1_NDEF_FUNCTION(PKCS7) + +long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg); + +int PKCS7_set_type(PKCS7 *p7, int type); +int PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other); +int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data); +int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, + const EVP_MD *dgst); +int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i); +int PKCS7_add_certificate(PKCS7 *p7, X509 *x509); +int PKCS7_add_crl(PKCS7 *p7, X509_CRL *x509); +int PKCS7_content_new(PKCS7 *p7, int nid); +int PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx, + BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si); +int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si, + X509 *x509); + +BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio); +int PKCS7_dataFinal(PKCS7 *p7, BIO *bio); +BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert); + + +PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509, + EVP_PKEY *pkey, const EVP_MD *dgst); +X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si); +int PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md); +STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7); + +PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509); +int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri); +int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509); +int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher); + +PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx); +ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk); +int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si,int nid,int type, + void *data); +int PKCS7_add_attribute (PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, + void *value); +ASN1_TYPE *PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid); +ASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid); +int PKCS7_set_signed_attributes(PKCS7_SIGNER_INFO *p7si, + STACK_OF(X509_ATTRIBUTE) *sk); +int PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si,STACK_OF(X509_ATTRIBUTE) *sk); + + +PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, + BIO *data, int flags); +int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, + BIO *indata, BIO *out, int flags); +STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags); +PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher, + int flags); +int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags); + +int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, + STACK_OF(X509_ALGOR) *cap); +STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si); +int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg); + +int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags); +PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont); +int SMIME_crlf_copy(BIO *in, BIO *out, int flags); +int SMIME_text(BIO *in, BIO *out); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_PKCS7_strings(void); + +/* Error codes for the PKCS7 functions. */ + +/* Function codes. */ +#define PKCS7_F_B64_READ_PKCS7 120 +#define PKCS7_F_B64_WRITE_PKCS7 121 +#define PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP 118 +#define PKCS7_F_PKCS7_ADD_CERTIFICATE 100 +#define PKCS7_F_PKCS7_ADD_CRL 101 +#define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO 102 +#define PKCS7_F_PKCS7_ADD_SIGNER 103 +#define PKCS7_F_PKCS7_BIO_ADD_DIGEST 125 +#define PKCS7_F_PKCS7_CTRL 104 +#define PKCS7_F_PKCS7_DATADECODE 112 +#define PKCS7_F_PKCS7_DATAFINAL 128 +#define PKCS7_F_PKCS7_DATAINIT 105 +#define PKCS7_F_PKCS7_DATASIGN 106 +#define PKCS7_F_PKCS7_DATAVERIFY 107 +#define PKCS7_F_PKCS7_DECRYPT 114 +#define PKCS7_F_PKCS7_ENCRYPT 115 +#define PKCS7_F_PKCS7_FIND_DIGEST 127 +#define PKCS7_F_PKCS7_GET0_SIGNERS 124 +#define PKCS7_F_PKCS7_SET_CIPHER 108 +#define PKCS7_F_PKCS7_SET_CONTENT 109 +#define PKCS7_F_PKCS7_SET_DIGEST 126 +#define PKCS7_F_PKCS7_SET_TYPE 110 +#define PKCS7_F_PKCS7_SIGN 116 +#define PKCS7_F_PKCS7_SIGNATUREVERIFY 113 +#define PKCS7_F_PKCS7_SIMPLE_SMIMECAP 119 +#define PKCS7_F_PKCS7_VERIFY 117 +#define PKCS7_F_SMIME_READ_PKCS7 122 +#define PKCS7_F_SMIME_TEXT 123 + +/* Reason codes. */ +#define PKCS7_R_CERTIFICATE_VERIFY_ERROR 117 +#define PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 144 +#define PKCS7_R_CIPHER_NOT_INITIALIZED 116 +#define PKCS7_R_CONTENT_AND_DATA_PRESENT 118 +#define PKCS7_R_DECODE_ERROR 130 +#define PKCS7_R_DECRYPTED_KEY_IS_WRONG_LENGTH 100 +#define PKCS7_R_DECRYPT_ERROR 119 +#define PKCS7_R_DIGEST_FAILURE 101 +#define PKCS7_R_ERROR_ADDING_RECIPIENT 120 +#define PKCS7_R_ERROR_SETTING_CIPHER 121 +#define PKCS7_R_INVALID_MIME_TYPE 131 +#define PKCS7_R_INVALID_NULL_POINTER 143 +#define PKCS7_R_MIME_NO_CONTENT_TYPE 132 +#define PKCS7_R_MIME_PARSE_ERROR 133 +#define PKCS7_R_MIME_SIG_PARSE_ERROR 134 +#define PKCS7_R_MISSING_CERIPEND_INFO 103 +#define PKCS7_R_NO_CONTENT 122 +#define PKCS7_R_NO_CONTENT_TYPE 135 +#define PKCS7_R_NO_MULTIPART_BODY_FAILURE 136 +#define PKCS7_R_NO_MULTIPART_BOUNDARY 137 +#define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE 115 +#define PKCS7_R_NO_SIGNATURES_ON_DATA 123 +#define PKCS7_R_NO_SIGNERS 142 +#define PKCS7_R_NO_SIG_CONTENT_TYPE 138 +#define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE 104 +#define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR 124 +#define PKCS7_R_PKCS7_DATAFINAL 126 +#define PKCS7_R_PKCS7_DATAFINAL_ERROR 125 +#define PKCS7_R_PKCS7_DATASIGN 145 +#define PKCS7_R_PKCS7_PARSE_ERROR 139 +#define PKCS7_R_PKCS7_SIG_PARSE_ERROR 140 +#define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 127 +#define PKCS7_R_SIGNATURE_FAILURE 105 +#define PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND 128 +#define PKCS7_R_SIG_INVALID_MIME_TYPE 141 +#define PKCS7_R_SMIME_TEXT_ERROR 129 +#define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE 106 +#define PKCS7_R_UNABLE_TO_FIND_MEM_BIO 107 +#define PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST 108 +#define PKCS7_R_UNKNOWN_DIGEST_TYPE 109 +#define PKCS7_R_UNKNOWN_OPERATION 110 +#define PKCS7_R_UNSUPPORTED_CIPHER_TYPE 111 +#define PKCS7_R_UNSUPPORTED_CONTENT_TYPE 112 +#define PKCS7_R_WRONG_CONTENT_TYPE 113 +#define PKCS7_R_WRONG_PKCS7_TYPE 114 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/openssl/pq_compat.h b/h/openssl/pq_compat.h new file mode 100644 index 0000000..28c58a0 --- /dev/null +++ b/h/openssl/pq_compat.h @@ -0,0 +1,147 @@ +/* crypto/pqueue/pqueue_compat.h */ +/* + * DTLS implementation written by Nagendra Modadugu + * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. + */ +/* ==================================================================== + * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#include "opensslconf.h" +#include + +/* + * The purpose of this header file is for supporting 64-bit integer + * manipulation on 32-bit (and lower) machines. Currently the only + * such environment is VMS, Utrix and those with smaller default integer + * sizes than 32 bits. For all such environment, we fall back to using + * BIGNUM. We may need to fine tune the conditions for systems that + * are incorrectly configured. + * + * The only clients of this code are (1) pqueue for priority, and + * (2) DTLS, for sequence number manipulation. + */ + +#if (defined(THIRTY_TWO_BIT) && !defined(BN_LLONG)) || defined(SIXTEEN_BIT) || defined(EIGHT_BIT) + +#define PQ_64BIT_IS_INTEGER 0 +#define PQ_64BIT_IS_BIGNUM 1 + +#define PQ_64BIT BIGNUM +#define PQ_64BIT_CTX BN_CTX + +#define pq_64bit_init(x) BN_init(x) +#define pq_64bit_free(x) BN_free(x) + +#define pq_64bit_ctx_new(ctx) BN_CTX_new() +#define pq_64bit_ctx_free(x) BN_CTX_free(x) + +#define pq_64bit_assign(x, y) BN_copy(x, y) +#define pq_64bit_assign_word(x, y) BN_set_word(x, y) +#define pq_64bit_gt(x, y) BN_ucmp(x, y) >= 1 ? 1 : 0 +#define pq_64bit_eq(x, y) BN_ucmp(x, y) == 0 ? 1 : 0 +#define pq_64bit_add_word(x, w) BN_add_word(x, w) +#define pq_64bit_sub(r, x, y) BN_sub(r, x, y) +#define pq_64bit_sub_word(x, w) BN_sub_word(x, w) +#define pq_64bit_mod(r, x, n, ctx) BN_mod(r, x, n, ctx) + +#define pq_64bit_bin2num(bn, bytes, len) BN_bin2bn(bytes, len, bn) +#define pq_64bit_num2bin(bn, bytes) BN_bn2bin(bn, bytes) +#define pq_64bit_get_word(x) BN_get_word(x) +#define pq_64bit_is_bit_set(x, offset) BN_is_bit_set(x, offset) +#define pq_64bit_lshift(r, x, shift) BN_lshift(r, x, shift) +#define pq_64bit_set_bit(x, num) BN_set_bit(x, num) +#define pq_64bit_get_length(x) BN_num_bits((x)) + +#else + +#define PQ_64BIT_IS_INTEGER 1 +#define PQ_64BIT_IS_BIGNUM 0 + +#if defined(SIXTY_FOUR_BIT) +#define PQ_64BIT BN_ULONG +#define PQ_64BIT_PRINT "%lld" +#elif defined(SIXTY_FOUR_BIT_LONG) +#define PQ_64BIT BN_ULONG +#define PQ_64BIT_PRINT "%ld" +#elif defined(THIRTY_TWO_BIT) +#define PQ_64BIT BN_ULLONG +#define PQ_64BIT_PRINT "%lld" +#endif + +#define PQ_64BIT_CTX void + +#define pq_64bit_init(x) +#define pq_64bit_free(x) +#define pq_64bit_ctx_new(ctx) (ctx) +#define pq_64bit_ctx_free(x) + +#define pq_64bit_assign(x, y) (*(x) = *(y)) +#define pq_64bit_assign_word(x, y) (*(x) = y) +#define pq_64bit_gt(x, y) (*(x) > *(y)) +#define pq_64bit_eq(x, y) (*(x) == *(y)) +#define pq_64bit_add_word(x, w) (*(x) = (*(x) + (w))) +#define pq_64bit_sub(r, x, y) (*(r) = (*(x) - *(y))) +#define pq_64bit_sub_word(x, w) (*(x) = (*(x) - (w))) +#define pq_64bit_mod(r, x, n, ctx) + +#define pq_64bit_bin2num(num, bytes, len) bytes_to_long_long(bytes, num) +#define pq_64bit_num2bin(num, bytes) long_long_to_bytes(num, bytes) +#define pq_64bit_get_word(x) *(x) +#define pq_64bit_lshift(r, x, shift) (*(r) = (*(x) << (shift))) +#define pq_64bit_set_bit(x, num) do { \ + PQ_64BIT mask = 1; \ + mask = mask << (num); \ + *(x) |= mask; \ + } while(0) +#endif /* OPENSSL_SYS_VMS */ diff --git a/h/openssl/pqueue.h b/h/openssl/pqueue.h new file mode 100644 index 0000000..02386d1 --- /dev/null +++ b/h/openssl/pqueue.h @@ -0,0 +1,95 @@ +/* crypto/pqueue/pqueue.h */ +/* + * DTLS implementation written by Nagendra Modadugu + * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. + */ +/* ==================================================================== + * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_PQUEUE_H +#define HEADER_PQUEUE_H + +#include +#include +#include + +#include + +typedef struct _pqueue *pqueue; + +typedef struct _pitem + { + PQ_64BIT priority; + void *data; + struct _pitem *next; + } pitem; + +typedef struct _pitem *piterator; + +pitem *pitem_new(PQ_64BIT priority, void *data); +void pitem_free(pitem *item); + +pqueue pqueue_new(void); +void pqueue_free(pqueue pq); + +pitem *pqueue_insert(pqueue pq, pitem *item); +pitem *pqueue_peek(pqueue pq); +pitem *pqueue_pop(pqueue pq); +pitem *pqueue_find(pqueue pq, PQ_64BIT priority); +pitem *pqueue_iterator(pqueue pq); +pitem *pqueue_next(piterator *iter); + +void pqueue_print(pqueue pq); + +#endif /* ! HEADER_PQUEUE_H */ diff --git a/h/openssl/private/e_os.h b/h/openssl/private/e_os.h new file mode 100644 index 0000000..64eb681 --- /dev/null +++ b/h/openssl/private/e_os.h @@ -0,0 +1,663 @@ +/* e_os.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_E_OS_H +#define HEADER_E_OS_H + +#include + +#include +/* contains what we can justify to make visible + * to the outside; this file e_os.h is not part of the exported + * interface. */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Used to checking reference counts, most while doing perl5 stuff :-) */ +#ifdef REF_PRINT +#undef REF_PRINT +#define REF_PRINT(a,b) fprintf(stderr,"%08X:%4d:%s\n",(int)b,b->references,a) +#endif + +#ifndef DEVRANDOM +/* set this to a comma-separated list of 'random' device files to try out. + * My default, we will try to read at least one of these files */ +#define DEVRANDOM "/dev/urandom","/dev/random","/dev/srandom" +#endif +#ifndef DEVRANDOM_EGD +/* set this to a comma-seperated list of 'egd' sockets to try out. These + * sockets will be tried in the order listed in case accessing the device files + * listed in DEVRANDOM did not return enough entropy. */ +#define DEVRANDOM_EGD "/var/run/egd-pool","/dev/egd-pool","/etc/egd-pool","/etc/entropy" +#endif + +#if defined(OPENSSL_SYS_VXWORKS) +# define NO_SYS_PARAM_H +# define NO_CHMOD +# define NO_SYSLOG +#endif + +#if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) +# if macintosh==1 +# ifndef MAC_OS_GUSI_SOURCE +# define MAC_OS_pre_X +# define NO_SYS_TYPES_H + typedef long ssize_t; +# endif +# define NO_SYS_PARAM_H +# define NO_CHMOD +# define NO_SYSLOG +# undef DEVRANDOM +# define GETPID_IS_MEANINGLESS +# endif +#endif + +/******************************************************************** + The Microsoft section + ********************************************************************/ +/* The following is used becaue of the small stack in some + * Microsoft operating systems */ +#if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYSNAME_WIN32) +# define MS_STATIC static +#else +# define MS_STATIC +#endif + +#if defined(OPENSSL_SYS_WIN32) && !defined(WIN32) +# define WIN32 +#endif +#if defined(OPENSSL_SYS_WIN16) && !defined(WIN16) +# define WIN16 +#endif +#if defined(OPENSSL_SYS_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(OPENSSL_SYS_MSDOS) && !defined(MSDOS) +# define MSDOS +#endif + +#if defined(MSDOS) && !defined(GETPID_IS_MEANINGLESS) +# define GETPID_IS_MEANINGLESS +#endif + +#ifdef WIN32 +#define get_last_sys_error() GetLastError() +#define clear_sys_error() SetLastError(0) +#if !defined(WINNT) +#define WIN_CONSOLE_BUG +#endif +#else +#define get_last_sys_error() errno +#define clear_sys_error() errno=0 +#endif + +#if defined(WINDOWS) +#define get_last_socket_error() WSAGetLastError() +#define clear_socket_error() WSASetLastError(0) +#define readsocket(s,b,n) recv((s),(b),(n),0) +#define writesocket(s,b,n) send((s),(b),(n),0) +#define EADDRINUSE WSAEADDRINUSE +#elif defined(__DJGPP__) +#define WATT32 +#define get_last_socket_error() errno +#define clear_socket_error() errno=0 +#define closesocket(s) close_s(s) +#define readsocket(s,b,n) read_s(s,b,n) +#define writesocket(s,b,n) send(s,b,n,0) +#elif defined(MAC_OS_pre_X) +#define get_last_socket_error() errno +#define clear_socket_error() errno=0 +#define closesocket(s) MacSocket_close(s) +#define readsocket(s,b,n) MacSocket_recv((s),(b),(n),true) +#define writesocket(s,b,n) MacSocket_send((s),(b),(n)) +#elif defined(OPENSSL_SYS_VMS) +#define get_last_socket_error() errno +#define clear_socket_error() errno=0 +#define ioctlsocket(a,b,c) ioctl(a,b,c) +#define closesocket(s) close(s) +#define readsocket(s,b,n) recv((s),(b),(n),0) +#define writesocket(s,b,n) send((s),(b),(n),0) +#elif defined(OPENSSL_SYS_VXWORKS) +#define get_last_socket_error() errno +#define clear_socket_error() errno=0 +#define ioctlsocket(a,b,c) ioctl((a),(b),(int)(c)) +#define closesocket(s) close(s) +#define readsocket(s,b,n) read((s),(b),(n)) +#define writesocket(s,b,n) write((s),(char *)(b),(n)) +#elif defined(OPENSSL_SYS_NETWARE) +#if defined(NETWARE_BSDSOCK) +#define get_last_socket_error() errno +#define clear_socket_error() errno=0 +#define closesocket(s) close(s) +#define readsocket(s,b,n) recv((s),(b),(n),0) +#define writesocket(s,b,n) send((s),(b),(n),0) +#else +#define get_last_socket_error() WSAGetLastError() +#define clear_socket_error() WSASetLastError(0) +#define readsocket(s,b,n) recv((s),(b),(n),0) +#define writesocket(s,b,n) send((s),(b),(n),0) +#endif +#else +#define get_last_socket_error() errno +#define clear_socket_error() errno=0 +#define ioctlsocket(a,b,c) ioctl(a,b,c) +#define closesocket(s) close(s) +#define readsocket(s,b,n) read((s),(b),(n)) +#define writesocket(s,b,n) write((s),(b),(n)) +#endif + +#ifdef WIN16 +# define MS_CALLBACK _far _loadds +# define MS_FAR _far +#else +# define MS_CALLBACK +# define MS_FAR +#endif + +#ifdef OPENSSL_NO_STDIO +# undef OPENSSL_NO_FP_API +# define OPENSSL_NO_FP_API +#endif + +#if (defined(WINDOWS) || defined(MSDOS)) + +# ifdef __DJGPP__ +# include +# include +# include +# include +# include +# define _setmode setmode +# define _O_TEXT O_TEXT +# define _O_BINARY O_BINARY +# undef DEVRANDOM +# define DEVRANDOM "/dev/urandom\x24" +# endif /* __DJGPP__ */ + +# ifndef S_IFDIR +# define S_IFDIR _S_IFDIR +# endif + +# ifndef S_IFMT +# define S_IFMT _S_IFMT +# endif + +# if !defined(WINNT) && !defined(__DJGPP__) +# define NO_SYSLOG +# endif +# define NO_DIRENT + +# ifdef WINDOWS +# ifndef _WIN32_WINNT + /* + * Defining _WIN32_WINNT here in e_os.h implies certain "discipline." + * Most notably we ought to check for availability of each specific + * routine with GetProcAddress() and/or quard NT-specific calls with + * GetVersion() < 0x80000000. One can argue that in latter "or" case + * we ought to /DELAYLOAD some .DLLs in order to protect ourselves + * against run-time link errors. This doesn't seem to be necessary, + * because it turned out that already Windows 95, first non-NT Win32 + * implementation, is equipped with at least NT 3.51 stubs, dummy + * routines with same name, but which do nothing. Meaning that it's + * apparently appropriate to guard generic NT calls with GetVersion + * alone, while NT 4.0 and above calls ought to be additionally + * checked upon with GetProcAddress. + */ +# define _WIN32_WINNT 0x0400 +# endif +# include +# include +# include +# include +# ifdef _WIN64 +# define strlen(s) _strlen31(s) +/* cut strings to 2GB */ +static unsigned int _strlen31(const char *str) + { + unsigned int len=0; + while (*str && len<0x80000000U) str++, len++; + return len&0x7FFFFFFF; + } +# endif +# include +# endif +# include +# include + +# ifdef OPENSSL_SYS_WINCE +# include +# endif + +# define ssize_t long + +# if defined (__BORLANDC__) +# define _setmode setmode +# define _O_TEXT O_TEXT +# define _O_BINARY O_BINARY +# define _int64 __int64 +# define _kbhit kbhit +# endif + +# if defined(WIN16) && defined(SSLEAY) && defined(_WINEXITNOPERSIST) +# define EXIT(n) _wsetexit(_WINEXITNOPERSIST) +# define OPENSSL_EXIT(n) do { if (n == 0) EXIT(n); return(n); } while(0) +# else +# define EXIT(n) exit(n) +# endif +# define LIST_SEPARATOR_CHAR ';' +# ifndef X_OK +# define X_OK 0 +# endif +# ifndef W_OK +# define W_OK 2 +# endif +# ifndef R_OK +# define R_OK 4 +# endif +# define OPENSSL_CONF "openssl.cnf" +# define SSLEAY_CONF OPENSSL_CONF +# define NUL_DEV "nul" +# define RFILE ".rnd" +# ifdef OPENSSL_SYS_WINCE +# define DEFAULT_HOME "" +# else +# define DEFAULT_HOME "C:" +# endif + +#else /* The non-microsoft world world */ + +# ifdef OPENSSL_SYS_VMS +# define VMS 1 + /* some programs don't include stdlib, so exit() and others give implicit + function warnings */ +# include +# if defined(__DECC) +# include +# else +# include +# endif +# define OPENSSL_CONF "openssl.cnf" +# define SSLEAY_CONF OPENSSL_CONF +# define RFILE ".rnd" +# define LIST_SEPARATOR_CHAR ',' +# define NUL_DEV "NLA0:" + /* We don't have any well-defined random devices on VMS, yet... */ +# undef DEVRANDOM + /* We need to do this since VMS has the following coding on status codes: + + Bits 0-2: status type: 0 = warning, 1 = success, 2 = error, 3 = info ... + The important thing to know is that odd numbers are considered + good, while even ones are considered errors. + Bits 3-15: actual status number + Bits 16-27: facility number. 0 is considered "unknown" + Bits 28-31: control bits. If bit 28 is set, the shell won't try to + output the message (which, for random codes, just looks ugly) + + So, what we do here is to change 0 to 1 to get the default success status, + and everything else is shifted up to fit into the status number field, and + the status is tagged as an error, which I believe is what is wanted here. + -- Richard Levitte + */ +# define EXIT(n) do { int __VMS_EXIT = n; \ + if (__VMS_EXIT == 0) \ + __VMS_EXIT = 1; \ + else \ + __VMS_EXIT = (n << 3) | 2; \ + __VMS_EXIT |= 0x10000000; \ + exit(__VMS_EXIT); } while(0) +# define NO_SYS_PARAM_H + +# elif defined(OPENSSL_SYS_NETWARE) +# include +# include +# define NO_SYS_TYPES_H +# undef DEVRANDOM +# ifdef NETWARE_CLIB +# define getpid GetThreadID +# endif +# define NO_SYSLOG +# define _setmode setmode +# define _kbhit kbhit +# define _O_TEXT O_TEXT +# define _O_BINARY O_BINARY +# define OPENSSL_CONF "openssl.cnf" +# define SSLEAY_CONF OPENSSL_CONF +# define RFILE ".rnd" +# define LIST_SEPARATOR_CHAR ';' +# define EXIT(n) { if (n) printf("ERROR: %d\n", (int)n); exit(n); } + +# else + /* !defined VMS */ +# ifdef OPENSSL_SYS_MPE +# define NO_SYS_PARAM_H +# endif +# ifdef OPENSSL_UNISTD +# include OPENSSL_UNISTD +# else +# include +# endif +# ifndef NO_SYS_TYPES_H +# include +# endif +# if defined(NeXT) || defined(OPENSSL_SYS_NEWS4) +# define pid_t int /* pid_t is missing on NEXTSTEP/OPENSTEP + * (unless when compiling with -D_POSIX_SOURCE, + * which doesn't work for us) */ +# endif +# if defined(NeXT) || defined(OPENSSL_SYS_NEWS4) || defined(OPENSSL_SYS_SUNOS) +# define ssize_t int /* ditto */ +# endif +# ifdef OPENSSL_SYS_NEWS4 /* setvbuf is missing on mips-sony-bsd */ +# define setvbuf(a, b, c, d) setbuffer((a), (b), (d)) + typedef unsigned long clock_t; +# endif + +# define OPENSSL_CONF "openssl.cnf" +# define SSLEAY_CONF OPENSSL_CONF +# define RFILE ".rnd" +# define LIST_SEPARATOR_CHAR ':' +# define NUL_DEV "/dev/null" +# define EXIT(n) taskDelete(0) + +# endif + +# define SSLeay_getpid() getpid() + +#endif + + +/*************/ + +#ifdef USE_SOCKETS +# if defined(WINDOWS) || defined(MSDOS) + /* windows world */ + +# ifdef OPENSSL_NO_SOCK +# define SSLeay_Write(a,b,c) (-1) +# define SSLeay_Read(a,b,c) (-1) +# define SHUTDOWN(fd) close(fd) +# define SHUTDOWN2(fd) close(fd) +# elif !defined(__DJGPP__) +# include +extern HINSTANCE _hInstance; +# ifdef _WIN64 +/* + * Even though sizeof(SOCKET) is 8, it's safe to cast it to int, because + * the value constitutes an index in per-process table of limited size + * and not a real pointer. + */ +# define socket(d,t,p) ((int)socket(d,t,p)) +# define accept(s,f,l) ((int)accept(s,f,l)) +# endif +# define SSLeay_Write(a,b,c) send((a),(b),(c),0) +# define SSLeay_Read(a,b,c) recv((a),(b),(c),0) +# define SHUTDOWN(fd) { shutdown((fd),0); closesocket(fd); } +# define SHUTDOWN2(fd) { shutdown((fd),2); closesocket(fd); } +# else +# define SSLeay_Write(a,b,c) write_s(a,b,c,0) +# define SSLeay_Read(a,b,c) read_s(a,b,c) +# define SHUTDOWN(fd) close_s(fd) +# define SHUTDOWN2(fd) close_s(fd) +# endif + +# elif defined(MAC_OS_pre_X) + +# include "MacSocket.h" +# define SSLeay_Write(a,b,c) MacSocket_send((a),(b),(c)) +# define SSLeay_Read(a,b,c) MacSocket_recv((a),(b),(c),true) +# define SHUTDOWN(fd) MacSocket_close(fd) +# define SHUTDOWN2(fd) MacSocket_close(fd) + +# elif defined(OPENSSL_SYS_NETWARE) + /* NetWare uses the WinSock2 interfaces by default, but can be configured for BSD + */ +# if defined(NETWARE_BSDSOCK) +# include +# include +# include +# include +# define INVALID_SOCKET (int)(~0) +# else +# include +# endif +# define SSLeay_Write(a,b,c) send((a),(b),(c),0) +# define SSLeay_Read(a,b,c) recv((a),(b),(c),0) +# define SHUTDOWN(fd) { shutdown((fd),0); closesocket(fd); } +# define SHUTDOWN2(fd) { shutdown((fd),2); closesocket(fd); } + +# else + +# ifndef NO_SYS_PARAM_H +# include +# endif +# ifdef OPENSSL_SYS_VXWORKS +# include +# elif !defined(OPENSSL_SYS_MPE) +# include /* Needed under linux for FD_XXX */ +# endif + +# include +# if defined(OPENSSL_SYS_VMS_NODECC) +# include +# include +# include +# else +# include +# ifdef FILIO_H +# include /* Added for FIONBIO under unixware */ +# endif +# include +# include +# endif + +# if defined(NeXT) || defined(_NEXT_SOURCE) +# include +# include +# endif + +# ifdef OPENSSL_SYS_AIX +# include +# endif + +# ifdef __QNX__ +# include +# endif + +# if defined(sun) +# include +# else +# ifndef VMS +# include +# else + /* ioctl is only in VMS > 7.0 and when socketshr is not used */ +# if !defined(TCPIP_TYPE_SOCKETSHR) && defined(__VMS_VER) && (__VMS_VER > 70000000) +# include +# endif +# endif +# endif + +# ifdef VMS +# include +# if defined(TCPIP_TYPE_SOCKETSHR) +# include +# endif +# endif + +# define SSLeay_Read(a,b,c) read((a),(b),(c)) +# define SSLeay_Write(a,b,c) write((a),(b),(c)) +# define SHUTDOWN(fd) { shutdown((fd),0); closesocket((fd)); } +# define SHUTDOWN2(fd) { shutdown((fd),2); closesocket((fd)); } +# ifndef INVALID_SOCKET +# define INVALID_SOCKET (-1) +# endif /* INVALID_SOCKET */ +# endif +#endif + +#if defined(__ultrix) +# ifndef ssize_t +# define ssize_t int +# endif +#endif + +#if defined(sun) && !defined(__svr4__) && !defined(__SVR4) + /* include headers first, so our defines don't break it */ +#include +#include + /* bcopy can handle overlapping moves according to SunOS 4.1.4 manpage */ +# define memmove(s1,s2,n) bcopy((s2),(s1),(n)) +# define strtoul(s,e,b) ((unsigned long int)strtol((s),(e),(b))) +extern char *sys_errlist[]; extern int sys_nerr; +# define strerror(errnum) \ + (((errnum)<0 || (errnum)>=sys_nerr) ? NULL : sys_errlist[errnum]) +#endif + +#ifndef OPENSSL_EXIT +# if defined(MONOLITH) && !defined(OPENSSL_C) +# define OPENSSL_EXIT(n) return(n) +# else +# define OPENSSL_EXIT(n) do { EXIT(n); return(n); } while(0) +# endif +#endif + +/***********************************************/ + +/* do we need to do this for getenv. + * Just define getenv for use under windows */ + +#ifdef WIN16 +/* How to do this needs to be thought out a bit more.... */ +/*char *GETENV(char *); +#define Getenv GETENV*/ +#define Getenv getenv +#else +#define Getenv getenv +#endif + +#define DG_GCC_BUG /* gcc < 2.6.3 on DGUX */ + +#ifdef sgi +#define IRIX_CC_BUG /* all version of IRIX I've tested (4.* 5.*) */ +#endif +#ifdef OPENSSL_SYS_SNI +#define IRIX_CC_BUG /* CDS++ up to V2.0Bsomething suffered from the same bug.*/ +#endif + +#if defined(OPENSSL_SYS_WINDOWS) +# define strcasecmp _stricmp +# define strncasecmp _strnicmp +#elif defined(OPENSSL_SYS_VMS) +/* VMS below version 7.0 doesn't have strcasecmp() */ +# include "o_str.h" +# define strcasecmp OPENSSL_strcasecmp +# define strncasecmp OPENSSL_strncasecmp +# define OPENSSL_IMPLEMENTS_strncasecmp +#elif defined(OPENSSL_SYS_OS2) && defined(__EMX__) +# define strcasecmp stricmp +# define strncasecmp strnicmp +#elif defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB) +# define strcasecmp stricmp +# define strncasecmp strnicmp +#else +# ifdef NO_STRINGS_H + int strcasecmp(); + int strncasecmp(); +# else +# include +# endif /* NO_STRINGS_H */ +#endif + +#if defined(OPENSSL_SYS_OS2) && defined(__EMX__) +# include +# include +# define NO_SYSLOG +#endif + +/* vxworks */ +#if defined(OPENSSL_SYS_VXWORKS) +#include +#include +#include + +#define TTY_STRUCT int + +#define sleep(a) taskDelay((a) * sysClkRateGet()) + +#include +#include +#include + +#define getpid taskIdSelf + +/* NOTE: these are implemented by helpers in database app! + * if the database is not linked, we need to implement them + * elswhere */ +struct hostent *gethostbyname(const char *name); +struct hostent *gethostbyaddr(const char *addr, int length, int type); +struct servent *getservbyname(const char *name, const char *proto); + +#endif +/* end vxworks */ + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/h/openssl/rand.h b/h/openssl/rand.h new file mode 100644 index 0000000..cc86639 --- /dev/null +++ b/h/openssl/rand.h @@ -0,0 +1,141 @@ +/* crypto/rand/rand.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_RAND_H +#define HEADER_RAND_H + +#include +#include +#include + +#if defined(OPENSSL_SYS_WINDOWS) +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(OPENSSL_FIPS) +#define FIPS_RAND_SIZE_T size_t +#endif + +/* Already defined in ossl_typ.h */ +/* typedef struct rand_meth_st RAND_METHOD; */ + +struct rand_meth_st + { + void (*seed)(const void *buf, int num); + int (*bytes)(unsigned char *buf, int num); + void (*cleanup)(void); + void (*add)(const void *buf, int num, double entropy); + int (*pseudorand)(unsigned char *buf, int num); + int (*status)(void); + }; + +#ifdef BN_DEBUG +extern int rand_predictable; +#endif + +int RAND_set_rand_method(const RAND_METHOD *meth); +const RAND_METHOD *RAND_get_rand_method(void); +#ifndef OPENSSL_NO_ENGINE +int RAND_set_rand_engine(ENGINE *engine); +#endif +RAND_METHOD *RAND_SSLeay(void); +RAND_METHOD *RAND_CCI(void); +void RAND_cleanup(void ); +int RAND_bytes(unsigned char *buf,int num); +int RAND_pseudo_bytes(unsigned char *buf,int num); +void RAND_seed(const void *buf,int num); +void RAND_add(const void *buf,int num,double entropy); +int RAND_load_file(const char *file,long max_bytes); +int RAND_write_file(const char *file); +const char *RAND_file_name(char *file,size_t num); +int RAND_status(void); +int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes); +int RAND_egd(const char *path); +int RAND_egd_bytes(const char *path,int bytes); +int RAND_poll(void); + +#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) + +void RAND_screen(void); +int RAND_event(UINT, WPARAM, LPARAM); + +#endif + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_RAND_strings(void); + +/* Error codes for the RAND functions. */ + +/* Function codes. */ +#define RAND_F_RAND_GET_RAND_METHOD 101 +#define RAND_F_SSLEAY_RAND_BYTES 100 + +/* Reason codes. */ +#define RAND_R_PRNG_NOT_SEEDED 100 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/openssl/rc2.h b/h/openssl/rc2.h new file mode 100644 index 0000000..2845ab5 --- /dev/null +++ b/h/openssl/rc2.h @@ -0,0 +1,4 @@ +/* Empty file for backward compatibiliy only. + * To use cryptographic primatives, please use EVP API or CCI API. + */ +#include diff --git a/h/openssl/rc4.h b/h/openssl/rc4.h new file mode 100644 index 0000000..2845ab5 --- /dev/null +++ b/h/openssl/rc4.h @@ -0,0 +1,4 @@ +/* Empty file for backward compatibiliy only. + * To use cryptographic primatives, please use EVP API or CCI API. + */ +#include diff --git a/h/openssl/ripemd.h b/h/openssl/ripemd.h new file mode 100644 index 0000000..2845ab5 --- /dev/null +++ b/h/openssl/ripemd.h @@ -0,0 +1,4 @@ +/* Empty file for backward compatibiliy only. + * To use cryptographic primatives, please use EVP API or CCI API. + */ +#include diff --git a/h/openssl/rsa.h b/h/openssl/rsa.h new file mode 100644 index 0000000..a1ca347 --- /dev/null +++ b/h/openssl/rsa.h @@ -0,0 +1,429 @@ +/* crypto/rsa/rsa.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_RSA_H +#define HEADER_RSA_H + +#include + +#ifndef OPENSSL_NO_BIO +#include +#endif +#include +#include +#ifndef OPENSSL_NO_DEPRECATED +#include +#endif + +#ifdef OPENSSL_NO_RSA +#error RSA is disabled. +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Declared already in ossl_typ.h */ +/* typedef struct rsa_st RSA; */ +/* typedef struct rsa_meth_st RSA_METHOD; */ + +struct rsa_meth_st + { + const char *name; + int (*rsa_pub_enc)(int flen,const unsigned char *from, + unsigned char *to, + RSA *rsa,int padding); + int (*rsa_pub_dec)(int flen,const unsigned char *from, + unsigned char *to, + RSA *rsa,int padding); + int (*rsa_priv_enc)(int flen,const unsigned char *from, + unsigned char *to, + RSA *rsa,int padding); + int (*rsa_priv_dec)(int flen,const unsigned char *from, + unsigned char *to, + RSA *rsa,int padding); + int (*rsa_mod_exp)(BIGNUM *r0,const BIGNUM *I,RSA *rsa,BN_CTX *ctx); /* Can be null */ + int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, + BN_MONT_CTX *m_ctx); /* Can be null */ + int (*init)(RSA *rsa); /* called at new */ + int (*finish)(RSA *rsa); /* called at free */ + int flags; /* RSA_METHOD_FLAG_* things */ + char *app_data; /* may be needed! */ +/* New sign and verify functions: some libraries don't allow arbitrary data + * to be signed/verified: this allows them to be used. Note: for this to work + * the RSA_public_decrypt() and RSA_private_encrypt() should *NOT* be used + * RSA_sign(), RSA_verify() should be used instead. Note: for backwards + * compatibility this functionality is only enabled if the RSA_FLAG_SIGN_VER + * option is set in 'flags'. + */ + int (*rsa_sign)(int type, + const unsigned char *m, unsigned int m_length, + unsigned char *sigret, unsigned int *siglen, const RSA *rsa); + int (*rsa_verify)(int dtype, + const unsigned char *m, unsigned int m_length, + unsigned char *sigbuf, unsigned int siglen, const RSA *rsa); +/* If this callback is NULL, the builtin software RSA key-gen will be used. This + * is for behavioural compatibility whilst the code gets rewired, but one day + * it would be nice to assume there are no such things as "builtin software" + * implementations. */ + int (*rsa_keygen)(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); + }; + +struct rsa_st + { + /* The first parameter is used to pickup errors where + * this is passed instead of aEVP_PKEY, it is set to 0 */ + int pad; + long version; + const RSA_METHOD *meth; + /* functional reference if 'meth' is ENGINE-provided */ + ENGINE *engine; + BIGNUM *n; + BIGNUM *e; + BIGNUM *d; + BIGNUM *p; + BIGNUM *q; + BIGNUM *dmp1; + BIGNUM *dmq1; + BIGNUM *iqmp; + /* be careful using this if the RSA structure is shared */ + CRYPTO_EX_DATA ex_data; + int references; + int flags; + + /* Used to cache montgomery values */ + BN_MONT_CTX *_method_mod_n; + BN_MONT_CTX *_method_mod_p; + BN_MONT_CTX *_method_mod_q; + + /* all BIGNUM values are actually in the following data, if it is not + * NULL */ + char *bignum_data; + BN_BLINDING *blinding; + BN_BLINDING *mt_blinding; + }; + +#define RSA_3 0x3L +#define RSA_F4 0x10001L + +#define RSA_METHOD_FLAG_NO_CHECK 0x0001 /* don't check pub/private match */ + +#define RSA_FLAG_CACHE_PUBLIC 0x0002 +#define RSA_FLAG_CACHE_PRIVATE 0x0004 +#define RSA_FLAG_BLINDING 0x0008 +#define RSA_FLAG_THREAD_SAFE 0x0010 +/* This flag means the private key operations will be handled by rsa_mod_exp + * and that they do not depend on the private key components being present: + * for example a key stored in external hardware. Without this flag bn_mod_exp + * gets called when private key components are absent. + */ +#define RSA_FLAG_EXT_PKEY 0x0020 + +/* This flag in the RSA_METHOD enables the new rsa_sign, rsa_verify functions. + */ +#define RSA_FLAG_SIGN_VER 0x0040 + +#define RSA_FLAG_NO_BLINDING 0x0080 /* new with 0.9.6j and 0.9.7b; the built-in + * RSA implementation now uses blinding by + * default (ignoring RSA_FLAG_BLINDING), + * but other engines might not need it + */ +#define RSA_FLAG_NO_EXP_CONSTTIME 0x0100 /* new with 0.9.7h; the built-in RSA + * implementation now uses constant time + * modular exponentiation for secret exponents + * by default. This flag causes the + * faster variable sliding window method to + * be used for all exponents. + */ + +#define RSA_PKCS1_PADDING 1 +#define RSA_SSLV23_PADDING 2 +#define RSA_NO_PADDING 3 +#define RSA_PKCS1_OAEP_PADDING 4 +#define RSA_X931_PADDING 5 + +#define RSA_PKCS1_PADDING_SIZE 11 + +#define RSA_set_app_data(s,arg) RSA_set_ex_data(s,0,arg) +#define RSA_get_app_data(s) RSA_get_ex_data(s,0) + +RSA * RSA_new(void); +RSA * RSA_new_method(ENGINE *engine); +int RSA_size(const RSA *); + +/* Deprecated version */ +#ifndef OPENSSL_NO_DEPRECATED +RSA * RSA_generate_key(int bits, unsigned long e,void + (*callback)(int,int,void *),void *cb_arg); +#endif /* !defined(OPENSSL_NO_DEPRECATED) */ + +/* New version */ +int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); + +int RSA_check_key(const RSA *); + /* next 4 return -1 on error */ +int RSA_public_encrypt(int flen, const unsigned char *from, + unsigned char *to, RSA *rsa,int padding); +int RSA_private_encrypt(int flen, const unsigned char *from, + unsigned char *to, RSA *rsa,int padding); +int RSA_public_decrypt(int flen, const unsigned char *from, + unsigned char *to, RSA *rsa,int padding); +int RSA_private_decrypt(int flen, const unsigned char *from, + unsigned char *to, RSA *rsa,int padding); +void RSA_free (RSA *r); +/* "up" the RSA object's reference count */ +int RSA_up_ref(RSA *r); + +int RSA_flags(const RSA *r); + +void RSA_set_default_method(const RSA_METHOD *meth); +const RSA_METHOD *RSA_get_default_method(void); +const RSA_METHOD *RSA_get_method(const RSA *rsa); +int RSA_set_method(RSA *rsa, const RSA_METHOD *meth); + +/* This function needs the memory locking malloc callbacks to be installed */ +int RSA_memory_lock(RSA *r); + +/* these are the actual SSLeay RSA functions */ +const RSA_METHOD *RSA_PKCS1_SSLeay(void); + +const RSA_METHOD *RSA_null_method(void); + +DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPublicKey) +DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPrivateKey) + +#ifndef OPENSSL_NO_FP_API +int RSA_print_fp(FILE *fp, const RSA *r,int offset); +#endif + +#ifndef OPENSSL_NO_BIO +int RSA_print(BIO *bp, const RSA *r,int offset); +#endif + +int i2d_RSA_NET(const RSA *a, unsigned char **pp, + int (*cb)(char *buf, int len, const char *prompt, int verify), + int sgckey); +RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length, + int (*cb)(char *buf, int len, const char *prompt, int verify), + int sgckey); + +int i2d_Netscape_RSA(const RSA *a, unsigned char **pp, + int (*cb)(char *buf, int len, const char *prompt, + int verify)); +RSA *d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length, + int (*cb)(char *buf, int len, const char *prompt, + int verify)); + +/* The following 2 functions sign and verify a X509_SIG ASN1 object + * inside PKCS#1 padded RSA encryption */ +int RSA_sign(int type, const unsigned char *m, unsigned int m_length, + unsigned char *sigret, unsigned int *siglen, RSA *rsa); +int RSA_verify(int type, const unsigned char *m, unsigned int m_length, + unsigned char *sigbuf, unsigned int siglen, RSA *rsa); + +/* The following 2 function sign and verify a ASN1_OCTET_STRING + * object inside PKCS#1 padded RSA encryption */ +int RSA_sign_ASN1_OCTET_STRING(int type, + const unsigned char *m, unsigned int m_length, + unsigned char *sigret, unsigned int *siglen, RSA *rsa); +int RSA_verify_ASN1_OCTET_STRING(int type, + const unsigned char *m, unsigned int m_length, + unsigned char *sigbuf, unsigned int siglen, RSA *rsa); + +int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); +void RSA_blinding_off(RSA *rsa); +BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx); + +int RSA_padding_add_PKCS1_type_1(unsigned char *to,int tlen, + const unsigned char *f,int fl); +int RSA_padding_check_PKCS1_type_1(unsigned char *to,int tlen, + const unsigned char *f,int fl,int rsa_len); +int RSA_padding_add_PKCS1_type_2(unsigned char *to,int tlen, + const unsigned char *f,int fl); +int RSA_padding_check_PKCS1_type_2(unsigned char *to,int tlen, + const unsigned char *f,int fl,int rsa_len); +int PKCS1_MGF1(unsigned char *mask, long len, + const unsigned char *seed, long seedlen, const EVP_MD *dgst); +int RSA_padding_add_PKCS1_OAEP(unsigned char *to,int tlen, + const unsigned char *f,int fl, + const unsigned char *p,int pl); +int RSA_padding_check_PKCS1_OAEP(unsigned char *to,int tlen, + const unsigned char *f,int fl,int rsa_len, + const unsigned char *p,int pl); +int RSA_padding_add_SSLv23(unsigned char *to,int tlen, + const unsigned char *f,int fl); +int RSA_padding_check_SSLv23(unsigned char *to,int tlen, + const unsigned char *f,int fl,int rsa_len); +int RSA_padding_add_none(unsigned char *to,int tlen, + const unsigned char *f,int fl); +int RSA_padding_check_none(unsigned char *to,int tlen, + const unsigned char *f,int fl,int rsa_len); +int RSA_padding_add_X931(unsigned char *to,int tlen, + const unsigned char *f,int fl); +int RSA_padding_check_X931(unsigned char *to,int tlen, + const unsigned char *f,int fl,int rsa_len); +int RSA_X931_hash_id(int nid); + +int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash, + const EVP_MD *Hash, const unsigned char *EM, int sLen); +int RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM, + const unsigned char *mHash, + const EVP_MD *Hash, int sLen); + +int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); +int RSA_set_ex_data(RSA *r,int idx,void *arg); +void *RSA_get_ex_data(const RSA *r, int idx); + +RSA *RSAPublicKey_dup(RSA *rsa); +RSA *RSAPrivateKey_dup(RSA *rsa); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_RSA_strings(void); + +/* Error codes for the RSA functions. */ + +/* Function codes. */ +#define RSA_F_MEMORY_LOCK 100 +#define RSA_F_RSA_BUILTIN_KEYGEN 129 +#define RSA_F_RSA_CHECK_KEY 123 +#define RSA_F_RSA_EAY_PRIVATE_DECRYPT 101 +#define RSA_F_RSA_EAY_PRIVATE_ENCRYPT 102 +#define RSA_F_RSA_EAY_PUBLIC_DECRYPT 103 +#define RSA_F_RSA_EAY_PUBLIC_ENCRYPT 104 +#define RSA_F_RSA_GENERATE_KEY 105 +#define RSA_F_RSA_MEMORY_LOCK 130 +#define RSA_F_RSA_NEW_METHOD 106 +#define RSA_F_RSA_NULL 124 +#define RSA_F_RSA_NULL_MOD_EXP 131 +#define RSA_F_RSA_NULL_PRIVATE_DECRYPT 132 +#define RSA_F_RSA_NULL_PRIVATE_ENCRYPT 133 +#define RSA_F_RSA_NULL_PUBLIC_DECRYPT 134 +#define RSA_F_RSA_NULL_PUBLIC_ENCRYPT 135 +#define RSA_F_RSA_PADDING_ADD_NONE 107 +#define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP 121 +#define RSA_F_RSA_PADDING_ADD_PKCS1_PSS 125 +#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1 108 +#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2 109 +#define RSA_F_RSA_PADDING_ADD_SSLV23 110 +#define RSA_F_RSA_PADDING_ADD_X931 127 +#define RSA_F_RSA_PADDING_CHECK_NONE 111 +#define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP 122 +#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1 112 +#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2 113 +#define RSA_F_RSA_PADDING_CHECK_SSLV23 114 +#define RSA_F_RSA_PADDING_CHECK_X931 128 +#define RSA_F_RSA_PRINT 115 +#define RSA_F_RSA_PRINT_FP 116 +#define RSA_F_RSA_SETUP_BLINDING 136 +#define RSA_F_RSA_SIGN 117 +#define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 118 +#define RSA_F_RSA_VERIFY 119 +#define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING 120 +#define RSA_F_RSA_VERIFY_PKCS1_PSS 126 + +/* Reason codes. */ +#define RSA_R_ALGORITHM_MISMATCH 100 +#define RSA_R_BAD_E_VALUE 101 +#define RSA_R_BAD_FIXED_HEADER_DECRYPT 102 +#define RSA_R_BAD_PAD_BYTE_COUNT 103 +#define RSA_R_BAD_SIGNATURE 104 +#define RSA_R_BLOCK_TYPE_IS_NOT_01 106 +#define RSA_R_BLOCK_TYPE_IS_NOT_02 107 +#define RSA_R_DATA_GREATER_THAN_MOD_LEN 108 +#define RSA_R_DATA_TOO_LARGE 109 +#define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 110 +#define RSA_R_DATA_TOO_LARGE_FOR_MODULUS 132 +#define RSA_R_DATA_TOO_SMALL 111 +#define RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE 122 +#define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY 112 +#define RSA_R_DMP1_NOT_CONGRUENT_TO_D 124 +#define RSA_R_DMQ1_NOT_CONGRUENT_TO_D 125 +#define RSA_R_D_E_NOT_CONGRUENT_TO_1 123 +#define RSA_R_FIRST_OCTET_INVALID 133 +#define RSA_R_INVALID_HEADER 137 +#define RSA_R_INVALID_MESSAGE_LENGTH 131 +#define RSA_R_INVALID_PADDING 138 +#define RSA_R_INVALID_TRAILER 139 +#define RSA_R_IQMP_NOT_INVERSE_OF_Q 126 +#define RSA_R_KEY_SIZE_TOO_SMALL 120 +#define RSA_R_LAST_OCTET_INVALID 134 +#define RSA_R_NO_PUBLIC_EXPONENT 140 +#define RSA_R_NULL_BEFORE_BLOCK_MISSING 113 +#define RSA_R_N_DOES_NOT_EQUAL_P_Q 127 +#define RSA_R_OAEP_DECODING_ERROR 121 +#define RSA_R_SLEN_RECOVERY_FAILED 135 +#define RSA_R_PADDING_CHECK_FAILED 114 +#define RSA_R_P_NOT_PRIME 128 +#define RSA_R_Q_NOT_PRIME 129 +#define RSA_R_RSA_OPERATIONS_NOT_SUPPORTED 130 +#define RSA_R_SSLV3_ROLLBACK_ATTACK 115 +#define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116 +#define RSA_R_UNKNOWN_ALGORITHM_TYPE 117 +#define RSA_R_UNKNOWN_PADDING_TYPE 118 +#define RSA_R_WRONG_SIGNATURE_LENGTH 119 +#define RSA_R_SLEN_CHECK_FAILED 136 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/openssl/safestack.h b/h/openssl/safestack.h new file mode 100644 index 0000000..e5f5be9 --- /dev/null +++ b/h/openssl/safestack.h @@ -0,0 +1,1784 @@ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_SAFESTACK_H +#define HEADER_SAFESTACK_H + +#include + +typedef void (*openssl_fptr)(void); +#define openssl_fcast(f) ((openssl_fptr)f) + +#ifdef DEBUG_SAFESTACK + +#define STACK_OF(type) struct stack_st_##type +#define PREDECLARE_STACK_OF(type) STACK_OF(type); + +#define DECLARE_STACK_OF(type) \ +STACK_OF(type) \ + { \ + STACK stack; \ + }; + +#define IMPLEMENT_STACK_OF(type) /* nada (obsolete in new safestack approach)*/ + +/* SKM_sk_... stack macros are internal to safestack.h: + * never use them directly, use sk__... instead */ +#define SKM_sk_new(type, cmp) \ + ((STACK_OF(type) * (*)(int (*)(const type * const *, const type * const *)))openssl_fcast(sk_new))(cmp) +#define SKM_sk_new_null(type) \ + ((STACK_OF(type) * (*)(void))openssl_fcast(sk_new_null))() +#define SKM_sk_free(type, st) \ + ((void (*)(STACK_OF(type) *))openssl_fcast(sk_free))(st) +#define SKM_sk_num(type, st) \ + ((int (*)(const STACK_OF(type) *))openssl_fcast(sk_num))(st) +#define SKM_sk_value(type, st,i) \ + ((type * (*)(const STACK_OF(type) *, int))openssl_fcast(sk_value))(st, i) +#define SKM_sk_set(type, st,i,val) \ + ((type * (*)(STACK_OF(type) *, int, type *))openssl_fcast(sk_set))(st, i, val) +#define SKM_sk_zero(type, st) \ + ((void (*)(STACK_OF(type) *))openssl_fcast(sk_zero))(st) +#define SKM_sk_push(type, st,val) \ + ((int (*)(STACK_OF(type) *, type *))openssl_fcast(sk_push))(st, val) +#define SKM_sk_unshift(type, st,val) \ + ((int (*)(STACK_OF(type) *, type *))openssl_fcast(sk_unshift))(st, val) +#define SKM_sk_find(type, st,val) \ + ((int (*)(STACK_OF(type) *, type *))openssl_fcast(sk_find))(st, val) +#define SKM_sk_delete(type, st,i) \ + ((type * (*)(STACK_OF(type) *, int))openssl_fcast(sk_delete))(st, i) +#define SKM_sk_delete_ptr(type, st,ptr) \ + ((type * (*)(STACK_OF(type) *, type *))openssl_fcast(sk_delete_ptr))(st, ptr) +#define SKM_sk_insert(type, st,val,i) \ + ((int (*)(STACK_OF(type) *, type *, int))openssl_fcast(sk_insert))(st, val, i) +#define SKM_sk_set_cmp_func(type, st,cmp) \ + ((int (*(*)(STACK_OF(type) *, int (*)(const type * const *, const type * const *))) \ + (const type * const *, const type * const *))openssl_fcast(sk_set_cmp_func))\ + (st, cmp) +#define SKM_sk_dup(type, st) \ + ((STACK_OF(type) *(*)(STACK_OF(type) *))openssl_fcast(sk_dup))(st) +#define SKM_sk_pop_free(type, st,free_func) \ + ((void (*)(STACK_OF(type) *, void (*)(type *)))openssl_fcast(sk_pop_free))\ + (st, free_func) +#define SKM_sk_shift(type, st) \ + ((type * (*)(STACK_OF(type) *))openssl_fcast(sk_shift))(st) +#define SKM_sk_pop(type, st) \ + ((type * (*)(STACK_OF(type) *))openssl_fcast(sk_pop))(st) +#define SKM_sk_sort(type, st) \ + ((void (*)(STACK_OF(type) *))openssl_fcast(sk_sort))(st) +#define SKM_sk_is_sorted(type, st) \ + ((int (*)(const STACK_OF(type) *))openssl_fcast(sk_is_sorted))(st) + +#define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ +((STACK_OF(type) * (*) (STACK_OF(type) **,const unsigned char **, long , \ + type *(*)(type **, const unsigned char **,long), \ + void (*)(type *), int ,int )) openssl_fcast(d2i_ASN1_SET)) \ + (st,pp,length, d2i_func, free_func, ex_tag,ex_class) +#define SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \ + ((int (*)(STACK_OF(type) *,unsigned char **, \ + int (*)(type *,unsigned char **), int , int , int)) openssl_fcast(i2d_ASN1_SET)) \ + (st,pp,i2d_func,ex_tag,ex_class,is_set) + +#define SKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \ + ((unsigned char *(*)(STACK_OF(type) *, \ + int (*)(type *,unsigned char **), unsigned char **,int *)) openssl_fcast(ASN1_seq_pack)) \ + (st, i2d_func, buf, len) +#define SKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \ + ((STACK_OF(type) * (*)(const unsigned char *,int, \ + type *(*)(type **,const unsigned char **, long), \ + void (*)(type *)))openssl_fcast(ASN1_seq_unpack)) \ + (buf,len,d2i_func, free_func) + +#define SKM_PKCS12_decrypt_d2i(type, algor, d2i_func, free_func, pass, passlen, oct, seq) \ + ((STACK_OF(type) * (*)(X509_ALGOR *, \ + type *(*)(type **, const unsigned char **, long), \ + void (*)(type *), \ + const char *, int, \ + ASN1_STRING *, int))PKCS12_decrypt_d2i) \ + (algor,d2i_func,free_func,pass,passlen,oct,seq) + +#else + +#define STACK_OF(type) STACK +#define PREDECLARE_STACK_OF(type) /* nada */ +#define DECLARE_STACK_OF(type) /* nada */ +#define IMPLEMENT_STACK_OF(type) /* nada */ + +#define SKM_sk_new(type, cmp) \ + sk_new((int (*)(const char * const *, const char * const *))(cmp)) +#define SKM_sk_new_null(type) \ + sk_new_null() +#define SKM_sk_free(type, st) \ + sk_free(st) +#define SKM_sk_num(type, st) \ + sk_num(st) +#define SKM_sk_value(type, st,i) \ + ((type *)sk_value(st, i)) +#define SKM_sk_set(type, st,i,val) \ + ((type *)sk_set(st, i,(char *)val)) +#define SKM_sk_zero(type, st) \ + sk_zero(st) +#define SKM_sk_push(type, st,val) \ + sk_push(st, (char *)val) +#define SKM_sk_unshift(type, st,val) \ + sk_unshift(st, val) +#define SKM_sk_find(type, st,val) \ + sk_find(st, (char *)val) +#define SKM_sk_delete(type, st,i) \ + ((type *)sk_delete(st, i)) +#define SKM_sk_delete_ptr(type, st,ptr) \ + ((type *)sk_delete_ptr(st,(char *)ptr)) +#define SKM_sk_insert(type, st,val,i) \ + sk_insert(st, (char *)val, i) +#define SKM_sk_set_cmp_func(type, st,cmp) \ + ((int (*)(const type * const *,const type * const *)) \ + sk_set_cmp_func(st, (int (*)(const char * const *, const char * const *))(cmp))) +#define SKM_sk_dup(type, st) \ + sk_dup(st) +#define SKM_sk_pop_free(type, st,free_func) \ + sk_pop_free(st, (void (*)(void *))free_func) +#define SKM_sk_shift(type, st) \ + ((type *)sk_shift(st)) +#define SKM_sk_pop(type, st) \ + ((type *)sk_pop(st)) +#define SKM_sk_sort(type, st) \ + sk_sort(st) +#define SKM_sk_is_sorted(type, st) \ + sk_is_sorted(st) + +#define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + d2i_ASN1_SET(st,pp,length, (void *(*)(void ** ,const unsigned char ** ,long))d2i_func, (void (*)(void *))free_func, ex_tag,ex_class) +#define SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \ + i2d_ASN1_SET(st,pp,(int (*)(void *, unsigned char **))i2d_func,ex_tag,ex_class,is_set) + +#define SKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \ + ASN1_seq_pack(st, (int (*)(void *, unsigned char **))i2d_func, buf, len) +#define SKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \ + ASN1_seq_unpack(buf,len,(void *(*)(void **,const unsigned char **,long))d2i_func, (void(*)(void *))free_func) + +#define SKM_PKCS12_decrypt_d2i(type, algor, d2i_func, free_func, pass, passlen, oct, seq) \ + ((STACK *)PKCS12_decrypt_d2i(algor,(char *(*)())d2i_func, (void(*)(void *))free_func,pass,passlen,oct,seq)) + +#endif + +/* This block of defines is updated by util/mkstack.pl, please do not touch! */ +#define sk_ACCESS_DESCRIPTION_new(st) SKM_sk_new(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_new_null() SKM_sk_new_null(ACCESS_DESCRIPTION) +#define sk_ACCESS_DESCRIPTION_free(st) SKM_sk_free(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_num(st) SKM_sk_num(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_value(st, i) SKM_sk_value(ACCESS_DESCRIPTION, (st), (i)) +#define sk_ACCESS_DESCRIPTION_set(st, i, val) SKM_sk_set(ACCESS_DESCRIPTION, (st), (i), (val)) +#define sk_ACCESS_DESCRIPTION_zero(st) SKM_sk_zero(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_push(st, val) SKM_sk_push(ACCESS_DESCRIPTION, (st), (val)) +#define sk_ACCESS_DESCRIPTION_unshift(st, val) SKM_sk_unshift(ACCESS_DESCRIPTION, (st), (val)) +#define sk_ACCESS_DESCRIPTION_find(st, val) SKM_sk_find(ACCESS_DESCRIPTION, (st), (val)) +#define sk_ACCESS_DESCRIPTION_find_ex(st, val) SKM_sk_find_ex(ACCESS_DESCRIPTION, (st), (val)) +#define sk_ACCESS_DESCRIPTION_delete(st, i) SKM_sk_delete(ACCESS_DESCRIPTION, (st), (i)) +#define sk_ACCESS_DESCRIPTION_delete_ptr(st, ptr) SKM_sk_delete_ptr(ACCESS_DESCRIPTION, (st), (ptr)) +#define sk_ACCESS_DESCRIPTION_insert(st, val, i) SKM_sk_insert(ACCESS_DESCRIPTION, (st), (val), (i)) +#define sk_ACCESS_DESCRIPTION_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ACCESS_DESCRIPTION, (st), (cmp)) +#define sk_ACCESS_DESCRIPTION_dup(st) SKM_sk_dup(ACCESS_DESCRIPTION, st) +#define sk_ACCESS_DESCRIPTION_pop_free(st, free_func) SKM_sk_pop_free(ACCESS_DESCRIPTION, (st), (free_func)) +#define sk_ACCESS_DESCRIPTION_shift(st) SKM_sk_shift(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_pop(st) SKM_sk_pop(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_sort(st) SKM_sk_sort(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_is_sorted(st) SKM_sk_is_sorted(ACCESS_DESCRIPTION, (st)) + +#define sk_ASN1_GENERALSTRING_new(st) SKM_sk_new(ASN1_GENERALSTRING, (st)) +#define sk_ASN1_GENERALSTRING_new_null() SKM_sk_new_null(ASN1_GENERALSTRING) +#define sk_ASN1_GENERALSTRING_free(st) SKM_sk_free(ASN1_GENERALSTRING, (st)) +#define sk_ASN1_GENERALSTRING_num(st) SKM_sk_num(ASN1_GENERALSTRING, (st)) +#define sk_ASN1_GENERALSTRING_value(st, i) SKM_sk_value(ASN1_GENERALSTRING, (st), (i)) +#define sk_ASN1_GENERALSTRING_set(st, i, val) SKM_sk_set(ASN1_GENERALSTRING, (st), (i), (val)) +#define sk_ASN1_GENERALSTRING_zero(st) SKM_sk_zero(ASN1_GENERALSTRING, (st)) +#define sk_ASN1_GENERALSTRING_push(st, val) SKM_sk_push(ASN1_GENERALSTRING, (st), (val)) +#define sk_ASN1_GENERALSTRING_unshift(st, val) SKM_sk_unshift(ASN1_GENERALSTRING, (st), (val)) +#define sk_ASN1_GENERALSTRING_find(st, val) SKM_sk_find(ASN1_GENERALSTRING, (st), (val)) +#define sk_ASN1_GENERALSTRING_find_ex(st, val) SKM_sk_find_ex(ASN1_GENERALSTRING, (st), (val)) +#define sk_ASN1_GENERALSTRING_delete(st, i) SKM_sk_delete(ASN1_GENERALSTRING, (st), (i)) +#define sk_ASN1_GENERALSTRING_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_GENERALSTRING, (st), (ptr)) +#define sk_ASN1_GENERALSTRING_insert(st, val, i) SKM_sk_insert(ASN1_GENERALSTRING, (st), (val), (i)) +#define sk_ASN1_GENERALSTRING_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_GENERALSTRING, (st), (cmp)) +#define sk_ASN1_GENERALSTRING_dup(st) SKM_sk_dup(ASN1_GENERALSTRING, st) +#define sk_ASN1_GENERALSTRING_pop_free(st, free_func) SKM_sk_pop_free(ASN1_GENERALSTRING, (st), (free_func)) +#define sk_ASN1_GENERALSTRING_shift(st) SKM_sk_shift(ASN1_GENERALSTRING, (st)) +#define sk_ASN1_GENERALSTRING_pop(st) SKM_sk_pop(ASN1_GENERALSTRING, (st)) +#define sk_ASN1_GENERALSTRING_sort(st) SKM_sk_sort(ASN1_GENERALSTRING, (st)) +#define sk_ASN1_GENERALSTRING_is_sorted(st) SKM_sk_is_sorted(ASN1_GENERALSTRING, (st)) + +#define sk_ASN1_INTEGER_new(st) SKM_sk_new(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_new_null() SKM_sk_new_null(ASN1_INTEGER) +#define sk_ASN1_INTEGER_free(st) SKM_sk_free(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_num(st) SKM_sk_num(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_value(st, i) SKM_sk_value(ASN1_INTEGER, (st), (i)) +#define sk_ASN1_INTEGER_set(st, i, val) SKM_sk_set(ASN1_INTEGER, (st), (i), (val)) +#define sk_ASN1_INTEGER_zero(st) SKM_sk_zero(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_push(st, val) SKM_sk_push(ASN1_INTEGER, (st), (val)) +#define sk_ASN1_INTEGER_unshift(st, val) SKM_sk_unshift(ASN1_INTEGER, (st), (val)) +#define sk_ASN1_INTEGER_find(st, val) SKM_sk_find(ASN1_INTEGER, (st), (val)) +#define sk_ASN1_INTEGER_find_ex(st, val) SKM_sk_find_ex(ASN1_INTEGER, (st), (val)) +#define sk_ASN1_INTEGER_delete(st, i) SKM_sk_delete(ASN1_INTEGER, (st), (i)) +#define sk_ASN1_INTEGER_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_INTEGER, (st), (ptr)) +#define sk_ASN1_INTEGER_insert(st, val, i) SKM_sk_insert(ASN1_INTEGER, (st), (val), (i)) +#define sk_ASN1_INTEGER_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_INTEGER, (st), (cmp)) +#define sk_ASN1_INTEGER_dup(st) SKM_sk_dup(ASN1_INTEGER, st) +#define sk_ASN1_INTEGER_pop_free(st, free_func) SKM_sk_pop_free(ASN1_INTEGER, (st), (free_func)) +#define sk_ASN1_INTEGER_shift(st) SKM_sk_shift(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_pop(st) SKM_sk_pop(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_sort(st) SKM_sk_sort(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_is_sorted(st) SKM_sk_is_sorted(ASN1_INTEGER, (st)) + +#define sk_ASN1_OBJECT_new(st) SKM_sk_new(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_new_null() SKM_sk_new_null(ASN1_OBJECT) +#define sk_ASN1_OBJECT_free(st) SKM_sk_free(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_num(st) SKM_sk_num(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_value(st, i) SKM_sk_value(ASN1_OBJECT, (st), (i)) +#define sk_ASN1_OBJECT_set(st, i, val) SKM_sk_set(ASN1_OBJECT, (st), (i), (val)) +#define sk_ASN1_OBJECT_zero(st) SKM_sk_zero(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_push(st, val) SKM_sk_push(ASN1_OBJECT, (st), (val)) +#define sk_ASN1_OBJECT_unshift(st, val) SKM_sk_unshift(ASN1_OBJECT, (st), (val)) +#define sk_ASN1_OBJECT_find(st, val) SKM_sk_find(ASN1_OBJECT, (st), (val)) +#define sk_ASN1_OBJECT_find_ex(st, val) SKM_sk_find_ex(ASN1_OBJECT, (st), (val)) +#define sk_ASN1_OBJECT_delete(st, i) SKM_sk_delete(ASN1_OBJECT, (st), (i)) +#define sk_ASN1_OBJECT_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_OBJECT, (st), (ptr)) +#define sk_ASN1_OBJECT_insert(st, val, i) SKM_sk_insert(ASN1_OBJECT, (st), (val), (i)) +#define sk_ASN1_OBJECT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_OBJECT, (st), (cmp)) +#define sk_ASN1_OBJECT_dup(st) SKM_sk_dup(ASN1_OBJECT, st) +#define sk_ASN1_OBJECT_pop_free(st, free_func) SKM_sk_pop_free(ASN1_OBJECT, (st), (free_func)) +#define sk_ASN1_OBJECT_shift(st) SKM_sk_shift(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_pop(st) SKM_sk_pop(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_sort(st) SKM_sk_sort(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_is_sorted(st) SKM_sk_is_sorted(ASN1_OBJECT, (st)) + +#define sk_ASN1_STRING_TABLE_new(st) SKM_sk_new(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_new_null() SKM_sk_new_null(ASN1_STRING_TABLE) +#define sk_ASN1_STRING_TABLE_free(st) SKM_sk_free(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_num(st) SKM_sk_num(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_value(st, i) SKM_sk_value(ASN1_STRING_TABLE, (st), (i)) +#define sk_ASN1_STRING_TABLE_set(st, i, val) SKM_sk_set(ASN1_STRING_TABLE, (st), (i), (val)) +#define sk_ASN1_STRING_TABLE_zero(st) SKM_sk_zero(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_push(st, val) SKM_sk_push(ASN1_STRING_TABLE, (st), (val)) +#define sk_ASN1_STRING_TABLE_unshift(st, val) SKM_sk_unshift(ASN1_STRING_TABLE, (st), (val)) +#define sk_ASN1_STRING_TABLE_find(st, val) SKM_sk_find(ASN1_STRING_TABLE, (st), (val)) +#define sk_ASN1_STRING_TABLE_find_ex(st, val) SKM_sk_find_ex(ASN1_STRING_TABLE, (st), (val)) +#define sk_ASN1_STRING_TABLE_delete(st, i) SKM_sk_delete(ASN1_STRING_TABLE, (st), (i)) +#define sk_ASN1_STRING_TABLE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_STRING_TABLE, (st), (ptr)) +#define sk_ASN1_STRING_TABLE_insert(st, val, i) SKM_sk_insert(ASN1_STRING_TABLE, (st), (val), (i)) +#define sk_ASN1_STRING_TABLE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_STRING_TABLE, (st), (cmp)) +#define sk_ASN1_STRING_TABLE_dup(st) SKM_sk_dup(ASN1_STRING_TABLE, st) +#define sk_ASN1_STRING_TABLE_pop_free(st, free_func) SKM_sk_pop_free(ASN1_STRING_TABLE, (st), (free_func)) +#define sk_ASN1_STRING_TABLE_shift(st) SKM_sk_shift(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_pop(st) SKM_sk_pop(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_sort(st) SKM_sk_sort(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_is_sorted(st) SKM_sk_is_sorted(ASN1_STRING_TABLE, (st)) + +#define sk_ASN1_TYPE_new(st) SKM_sk_new(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_new_null() SKM_sk_new_null(ASN1_TYPE) +#define sk_ASN1_TYPE_free(st) SKM_sk_free(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_num(st) SKM_sk_num(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_value(st, i) SKM_sk_value(ASN1_TYPE, (st), (i)) +#define sk_ASN1_TYPE_set(st, i, val) SKM_sk_set(ASN1_TYPE, (st), (i), (val)) +#define sk_ASN1_TYPE_zero(st) SKM_sk_zero(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_push(st, val) SKM_sk_push(ASN1_TYPE, (st), (val)) +#define sk_ASN1_TYPE_unshift(st, val) SKM_sk_unshift(ASN1_TYPE, (st), (val)) +#define sk_ASN1_TYPE_find(st, val) SKM_sk_find(ASN1_TYPE, (st), (val)) +#define sk_ASN1_TYPE_find_ex(st, val) SKM_sk_find_ex(ASN1_TYPE, (st), (val)) +#define sk_ASN1_TYPE_delete(st, i) SKM_sk_delete(ASN1_TYPE, (st), (i)) +#define sk_ASN1_TYPE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_TYPE, (st), (ptr)) +#define sk_ASN1_TYPE_insert(st, val, i) SKM_sk_insert(ASN1_TYPE, (st), (val), (i)) +#define sk_ASN1_TYPE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_TYPE, (st), (cmp)) +#define sk_ASN1_TYPE_dup(st) SKM_sk_dup(ASN1_TYPE, st) +#define sk_ASN1_TYPE_pop_free(st, free_func) SKM_sk_pop_free(ASN1_TYPE, (st), (free_func)) +#define sk_ASN1_TYPE_shift(st) SKM_sk_shift(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_pop(st) SKM_sk_pop(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_sort(st) SKM_sk_sort(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_is_sorted(st) SKM_sk_is_sorted(ASN1_TYPE, (st)) + +#define sk_ASN1_VALUE_new(st) SKM_sk_new(ASN1_VALUE, (st)) +#define sk_ASN1_VALUE_new_null() SKM_sk_new_null(ASN1_VALUE) +#define sk_ASN1_VALUE_free(st) SKM_sk_free(ASN1_VALUE, (st)) +#define sk_ASN1_VALUE_num(st) SKM_sk_num(ASN1_VALUE, (st)) +#define sk_ASN1_VALUE_value(st, i) SKM_sk_value(ASN1_VALUE, (st), (i)) +#define sk_ASN1_VALUE_set(st, i, val) SKM_sk_set(ASN1_VALUE, (st), (i), (val)) +#define sk_ASN1_VALUE_zero(st) SKM_sk_zero(ASN1_VALUE, (st)) +#define sk_ASN1_VALUE_push(st, val) SKM_sk_push(ASN1_VALUE, (st), (val)) +#define sk_ASN1_VALUE_unshift(st, val) SKM_sk_unshift(ASN1_VALUE, (st), (val)) +#define sk_ASN1_VALUE_find(st, val) SKM_sk_find(ASN1_VALUE, (st), (val)) +#define sk_ASN1_VALUE_find_ex(st, val) SKM_sk_find_ex(ASN1_VALUE, (st), (val)) +#define sk_ASN1_VALUE_delete(st, i) SKM_sk_delete(ASN1_VALUE, (st), (i)) +#define sk_ASN1_VALUE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_VALUE, (st), (ptr)) +#define sk_ASN1_VALUE_insert(st, val, i) SKM_sk_insert(ASN1_VALUE, (st), (val), (i)) +#define sk_ASN1_VALUE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_VALUE, (st), (cmp)) +#define sk_ASN1_VALUE_dup(st) SKM_sk_dup(ASN1_VALUE, st) +#define sk_ASN1_VALUE_pop_free(st, free_func) SKM_sk_pop_free(ASN1_VALUE, (st), (free_func)) +#define sk_ASN1_VALUE_shift(st) SKM_sk_shift(ASN1_VALUE, (st)) +#define sk_ASN1_VALUE_pop(st) SKM_sk_pop(ASN1_VALUE, (st)) +#define sk_ASN1_VALUE_sort(st) SKM_sk_sort(ASN1_VALUE, (st)) +#define sk_ASN1_VALUE_is_sorted(st) SKM_sk_is_sorted(ASN1_VALUE, (st)) + +#define sk_BIO_new(st) SKM_sk_new(BIO, (st)) +#define sk_BIO_new_null() SKM_sk_new_null(BIO) +#define sk_BIO_free(st) SKM_sk_free(BIO, (st)) +#define sk_BIO_num(st) SKM_sk_num(BIO, (st)) +#define sk_BIO_value(st, i) SKM_sk_value(BIO, (st), (i)) +#define sk_BIO_set(st, i, val) SKM_sk_set(BIO, (st), (i), (val)) +#define sk_BIO_zero(st) SKM_sk_zero(BIO, (st)) +#define sk_BIO_push(st, val) SKM_sk_push(BIO, (st), (val)) +#define sk_BIO_unshift(st, val) SKM_sk_unshift(BIO, (st), (val)) +#define sk_BIO_find(st, val) SKM_sk_find(BIO, (st), (val)) +#define sk_BIO_find_ex(st, val) SKM_sk_find_ex(BIO, (st), (val)) +#define sk_BIO_delete(st, i) SKM_sk_delete(BIO, (st), (i)) +#define sk_BIO_delete_ptr(st, ptr) SKM_sk_delete_ptr(BIO, (st), (ptr)) +#define sk_BIO_insert(st, val, i) SKM_sk_insert(BIO, (st), (val), (i)) +#define sk_BIO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(BIO, (st), (cmp)) +#define sk_BIO_dup(st) SKM_sk_dup(BIO, st) +#define sk_BIO_pop_free(st, free_func) SKM_sk_pop_free(BIO, (st), (free_func)) +#define sk_BIO_shift(st) SKM_sk_shift(BIO, (st)) +#define sk_BIO_pop(st) SKM_sk_pop(BIO, (st)) +#define sk_BIO_sort(st) SKM_sk_sort(BIO, (st)) +#define sk_BIO_is_sorted(st) SKM_sk_is_sorted(BIO, (st)) + +#define sk_CONF_IMODULE_new(st) SKM_sk_new(CONF_IMODULE, (st)) +#define sk_CONF_IMODULE_new_null() SKM_sk_new_null(CONF_IMODULE) +#define sk_CONF_IMODULE_free(st) SKM_sk_free(CONF_IMODULE, (st)) +#define sk_CONF_IMODULE_num(st) SKM_sk_num(CONF_IMODULE, (st)) +#define sk_CONF_IMODULE_value(st, i) SKM_sk_value(CONF_IMODULE, (st), (i)) +#define sk_CONF_IMODULE_set(st, i, val) SKM_sk_set(CONF_IMODULE, (st), (i), (val)) +#define sk_CONF_IMODULE_zero(st) SKM_sk_zero(CONF_IMODULE, (st)) +#define sk_CONF_IMODULE_push(st, val) SKM_sk_push(CONF_IMODULE, (st), (val)) +#define sk_CONF_IMODULE_unshift(st, val) SKM_sk_unshift(CONF_IMODULE, (st), (val)) +#define sk_CONF_IMODULE_find(st, val) SKM_sk_find(CONF_IMODULE, (st), (val)) +#define sk_CONF_IMODULE_find_ex(st, val) SKM_sk_find_ex(CONF_IMODULE, (st), (val)) +#define sk_CONF_IMODULE_delete(st, i) SKM_sk_delete(CONF_IMODULE, (st), (i)) +#define sk_CONF_IMODULE_delete_ptr(st, ptr) SKM_sk_delete_ptr(CONF_IMODULE, (st), (ptr)) +#define sk_CONF_IMODULE_insert(st, val, i) SKM_sk_insert(CONF_IMODULE, (st), (val), (i)) +#define sk_CONF_IMODULE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CONF_IMODULE, (st), (cmp)) +#define sk_CONF_IMODULE_dup(st) SKM_sk_dup(CONF_IMODULE, st) +#define sk_CONF_IMODULE_pop_free(st, free_func) SKM_sk_pop_free(CONF_IMODULE, (st), (free_func)) +#define sk_CONF_IMODULE_shift(st) SKM_sk_shift(CONF_IMODULE, (st)) +#define sk_CONF_IMODULE_pop(st) SKM_sk_pop(CONF_IMODULE, (st)) +#define sk_CONF_IMODULE_sort(st) SKM_sk_sort(CONF_IMODULE, (st)) +#define sk_CONF_IMODULE_is_sorted(st) SKM_sk_is_sorted(CONF_IMODULE, (st)) + +#define sk_CONF_MODULE_new(st) SKM_sk_new(CONF_MODULE, (st)) +#define sk_CONF_MODULE_new_null() SKM_sk_new_null(CONF_MODULE) +#define sk_CONF_MODULE_free(st) SKM_sk_free(CONF_MODULE, (st)) +#define sk_CONF_MODULE_num(st) SKM_sk_num(CONF_MODULE, (st)) +#define sk_CONF_MODULE_value(st, i) SKM_sk_value(CONF_MODULE, (st), (i)) +#define sk_CONF_MODULE_set(st, i, val) SKM_sk_set(CONF_MODULE, (st), (i), (val)) +#define sk_CONF_MODULE_zero(st) SKM_sk_zero(CONF_MODULE, (st)) +#define sk_CONF_MODULE_push(st, val) SKM_sk_push(CONF_MODULE, (st), (val)) +#define sk_CONF_MODULE_unshift(st, val) SKM_sk_unshift(CONF_MODULE, (st), (val)) +#define sk_CONF_MODULE_find(st, val) SKM_sk_find(CONF_MODULE, (st), (val)) +#define sk_CONF_MODULE_find_ex(st, val) SKM_sk_find_ex(CONF_MODULE, (st), (val)) +#define sk_CONF_MODULE_delete(st, i) SKM_sk_delete(CONF_MODULE, (st), (i)) +#define sk_CONF_MODULE_delete_ptr(st, ptr) SKM_sk_delete_ptr(CONF_MODULE, (st), (ptr)) +#define sk_CONF_MODULE_insert(st, val, i) SKM_sk_insert(CONF_MODULE, (st), (val), (i)) +#define sk_CONF_MODULE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CONF_MODULE, (st), (cmp)) +#define sk_CONF_MODULE_dup(st) SKM_sk_dup(CONF_MODULE, st) +#define sk_CONF_MODULE_pop_free(st, free_func) SKM_sk_pop_free(CONF_MODULE, (st), (free_func)) +#define sk_CONF_MODULE_shift(st) SKM_sk_shift(CONF_MODULE, (st)) +#define sk_CONF_MODULE_pop(st) SKM_sk_pop(CONF_MODULE, (st)) +#define sk_CONF_MODULE_sort(st) SKM_sk_sort(CONF_MODULE, (st)) +#define sk_CONF_MODULE_is_sorted(st) SKM_sk_is_sorted(CONF_MODULE, (st)) + +#define sk_CONF_VALUE_new(st) SKM_sk_new(CONF_VALUE, (st)) +#define sk_CONF_VALUE_new_null() SKM_sk_new_null(CONF_VALUE) +#define sk_CONF_VALUE_free(st) SKM_sk_free(CONF_VALUE, (st)) +#define sk_CONF_VALUE_num(st) SKM_sk_num(CONF_VALUE, (st)) +#define sk_CONF_VALUE_value(st, i) SKM_sk_value(CONF_VALUE, (st), (i)) +#define sk_CONF_VALUE_set(st, i, val) SKM_sk_set(CONF_VALUE, (st), (i), (val)) +#define sk_CONF_VALUE_zero(st) SKM_sk_zero(CONF_VALUE, (st)) +#define sk_CONF_VALUE_push(st, val) SKM_sk_push(CONF_VALUE, (st), (val)) +#define sk_CONF_VALUE_unshift(st, val) SKM_sk_unshift(CONF_VALUE, (st), (val)) +#define sk_CONF_VALUE_find(st, val) SKM_sk_find(CONF_VALUE, (st), (val)) +#define sk_CONF_VALUE_find_ex(st, val) SKM_sk_find_ex(CONF_VALUE, (st), (val)) +#define sk_CONF_VALUE_delete(st, i) SKM_sk_delete(CONF_VALUE, (st), (i)) +#define sk_CONF_VALUE_delete_ptr(st, ptr) SKM_sk_delete_ptr(CONF_VALUE, (st), (ptr)) +#define sk_CONF_VALUE_insert(st, val, i) SKM_sk_insert(CONF_VALUE, (st), (val), (i)) +#define sk_CONF_VALUE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CONF_VALUE, (st), (cmp)) +#define sk_CONF_VALUE_dup(st) SKM_sk_dup(CONF_VALUE, st) +#define sk_CONF_VALUE_pop_free(st, free_func) SKM_sk_pop_free(CONF_VALUE, (st), (free_func)) +#define sk_CONF_VALUE_shift(st) SKM_sk_shift(CONF_VALUE, (st)) +#define sk_CONF_VALUE_pop(st) SKM_sk_pop(CONF_VALUE, (st)) +#define sk_CONF_VALUE_sort(st) SKM_sk_sort(CONF_VALUE, (st)) +#define sk_CONF_VALUE_is_sorted(st) SKM_sk_is_sorted(CONF_VALUE, (st)) + +#define sk_CRYPTO_EX_DATA_FUNCS_new(st) SKM_sk_new(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_new_null() SKM_sk_new_null(CRYPTO_EX_DATA_FUNCS) +#define sk_CRYPTO_EX_DATA_FUNCS_free(st) SKM_sk_free(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_num(st) SKM_sk_num(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_value(st, i) SKM_sk_value(CRYPTO_EX_DATA_FUNCS, (st), (i)) +#define sk_CRYPTO_EX_DATA_FUNCS_set(st, i, val) SKM_sk_set(CRYPTO_EX_DATA_FUNCS, (st), (i), (val)) +#define sk_CRYPTO_EX_DATA_FUNCS_zero(st) SKM_sk_zero(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_push(st, val) SKM_sk_push(CRYPTO_EX_DATA_FUNCS, (st), (val)) +#define sk_CRYPTO_EX_DATA_FUNCS_unshift(st, val) SKM_sk_unshift(CRYPTO_EX_DATA_FUNCS, (st), (val)) +#define sk_CRYPTO_EX_DATA_FUNCS_find(st, val) SKM_sk_find(CRYPTO_EX_DATA_FUNCS, (st), (val)) +#define sk_CRYPTO_EX_DATA_FUNCS_find_ex(st, val) SKM_sk_find_ex(CRYPTO_EX_DATA_FUNCS, (st), (val)) +#define sk_CRYPTO_EX_DATA_FUNCS_delete(st, i) SKM_sk_delete(CRYPTO_EX_DATA_FUNCS, (st), (i)) +#define sk_CRYPTO_EX_DATA_FUNCS_delete_ptr(st, ptr) SKM_sk_delete_ptr(CRYPTO_EX_DATA_FUNCS, (st), (ptr)) +#define sk_CRYPTO_EX_DATA_FUNCS_insert(st, val, i) SKM_sk_insert(CRYPTO_EX_DATA_FUNCS, (st), (val), (i)) +#define sk_CRYPTO_EX_DATA_FUNCS_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CRYPTO_EX_DATA_FUNCS, (st), (cmp)) +#define sk_CRYPTO_EX_DATA_FUNCS_dup(st) SKM_sk_dup(CRYPTO_EX_DATA_FUNCS, st) +#define sk_CRYPTO_EX_DATA_FUNCS_pop_free(st, free_func) SKM_sk_pop_free(CRYPTO_EX_DATA_FUNCS, (st), (free_func)) +#define sk_CRYPTO_EX_DATA_FUNCS_shift(st) SKM_sk_shift(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_pop(st) SKM_sk_pop(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_sort(st) SKM_sk_sort(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_is_sorted(st) SKM_sk_is_sorted(CRYPTO_EX_DATA_FUNCS, (st)) + +#define sk_CRYPTO_dynlock_new(st) SKM_sk_new(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_new_null() SKM_sk_new_null(CRYPTO_dynlock) +#define sk_CRYPTO_dynlock_free(st) SKM_sk_free(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_num(st) SKM_sk_num(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_value(st, i) SKM_sk_value(CRYPTO_dynlock, (st), (i)) +#define sk_CRYPTO_dynlock_set(st, i, val) SKM_sk_set(CRYPTO_dynlock, (st), (i), (val)) +#define sk_CRYPTO_dynlock_zero(st) SKM_sk_zero(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_push(st, val) SKM_sk_push(CRYPTO_dynlock, (st), (val)) +#define sk_CRYPTO_dynlock_unshift(st, val) SKM_sk_unshift(CRYPTO_dynlock, (st), (val)) +#define sk_CRYPTO_dynlock_find(st, val) SKM_sk_find(CRYPTO_dynlock, (st), (val)) +#define sk_CRYPTO_dynlock_find_ex(st, val) SKM_sk_find_ex(CRYPTO_dynlock, (st), (val)) +#define sk_CRYPTO_dynlock_delete(st, i) SKM_sk_delete(CRYPTO_dynlock, (st), (i)) +#define sk_CRYPTO_dynlock_delete_ptr(st, ptr) SKM_sk_delete_ptr(CRYPTO_dynlock, (st), (ptr)) +#define sk_CRYPTO_dynlock_insert(st, val, i) SKM_sk_insert(CRYPTO_dynlock, (st), (val), (i)) +#define sk_CRYPTO_dynlock_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CRYPTO_dynlock, (st), (cmp)) +#define sk_CRYPTO_dynlock_dup(st) SKM_sk_dup(CRYPTO_dynlock, st) +#define sk_CRYPTO_dynlock_pop_free(st, free_func) SKM_sk_pop_free(CRYPTO_dynlock, (st), (free_func)) +#define sk_CRYPTO_dynlock_shift(st) SKM_sk_shift(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_pop(st) SKM_sk_pop(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_sort(st) SKM_sk_sort(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_is_sorted(st) SKM_sk_is_sorted(CRYPTO_dynlock, (st)) + +#define sk_DIST_POINT_new(st) SKM_sk_new(DIST_POINT, (st)) +#define sk_DIST_POINT_new_null() SKM_sk_new_null(DIST_POINT) +#define sk_DIST_POINT_free(st) SKM_sk_free(DIST_POINT, (st)) +#define sk_DIST_POINT_num(st) SKM_sk_num(DIST_POINT, (st)) +#define sk_DIST_POINT_value(st, i) SKM_sk_value(DIST_POINT, (st), (i)) +#define sk_DIST_POINT_set(st, i, val) SKM_sk_set(DIST_POINT, (st), (i), (val)) +#define sk_DIST_POINT_zero(st) SKM_sk_zero(DIST_POINT, (st)) +#define sk_DIST_POINT_push(st, val) SKM_sk_push(DIST_POINT, (st), (val)) +#define sk_DIST_POINT_unshift(st, val) SKM_sk_unshift(DIST_POINT, (st), (val)) +#define sk_DIST_POINT_find(st, val) SKM_sk_find(DIST_POINT, (st), (val)) +#define sk_DIST_POINT_find_ex(st, val) SKM_sk_find_ex(DIST_POINT, (st), (val)) +#define sk_DIST_POINT_delete(st, i) SKM_sk_delete(DIST_POINT, (st), (i)) +#define sk_DIST_POINT_delete_ptr(st, ptr) SKM_sk_delete_ptr(DIST_POINT, (st), (ptr)) +#define sk_DIST_POINT_insert(st, val, i) SKM_sk_insert(DIST_POINT, (st), (val), (i)) +#define sk_DIST_POINT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(DIST_POINT, (st), (cmp)) +#define sk_DIST_POINT_dup(st) SKM_sk_dup(DIST_POINT, st) +#define sk_DIST_POINT_pop_free(st, free_func) SKM_sk_pop_free(DIST_POINT, (st), (free_func)) +#define sk_DIST_POINT_shift(st) SKM_sk_shift(DIST_POINT, (st)) +#define sk_DIST_POINT_pop(st) SKM_sk_pop(DIST_POINT, (st)) +#define sk_DIST_POINT_sort(st) SKM_sk_sort(DIST_POINT, (st)) +#define sk_DIST_POINT_is_sorted(st) SKM_sk_is_sorted(DIST_POINT, (st)) + +#define sk_ENGINE_new(st) SKM_sk_new(ENGINE, (st)) +#define sk_ENGINE_new_null() SKM_sk_new_null(ENGINE) +#define sk_ENGINE_free(st) SKM_sk_free(ENGINE, (st)) +#define sk_ENGINE_num(st) SKM_sk_num(ENGINE, (st)) +#define sk_ENGINE_value(st, i) SKM_sk_value(ENGINE, (st), (i)) +#define sk_ENGINE_set(st, i, val) SKM_sk_set(ENGINE, (st), (i), (val)) +#define sk_ENGINE_zero(st) SKM_sk_zero(ENGINE, (st)) +#define sk_ENGINE_push(st, val) SKM_sk_push(ENGINE, (st), (val)) +#define sk_ENGINE_unshift(st, val) SKM_sk_unshift(ENGINE, (st), (val)) +#define sk_ENGINE_find(st, val) SKM_sk_find(ENGINE, (st), (val)) +#define sk_ENGINE_find_ex(st, val) SKM_sk_find_ex(ENGINE, (st), (val)) +#define sk_ENGINE_delete(st, i) SKM_sk_delete(ENGINE, (st), (i)) +#define sk_ENGINE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ENGINE, (st), (ptr)) +#define sk_ENGINE_insert(st, val, i) SKM_sk_insert(ENGINE, (st), (val), (i)) +#define sk_ENGINE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ENGINE, (st), (cmp)) +#define sk_ENGINE_dup(st) SKM_sk_dup(ENGINE, st) +#define sk_ENGINE_pop_free(st, free_func) SKM_sk_pop_free(ENGINE, (st), (free_func)) +#define sk_ENGINE_shift(st) SKM_sk_shift(ENGINE, (st)) +#define sk_ENGINE_pop(st) SKM_sk_pop(ENGINE, (st)) +#define sk_ENGINE_sort(st) SKM_sk_sort(ENGINE, (st)) +#define sk_ENGINE_is_sorted(st) SKM_sk_is_sorted(ENGINE, (st)) + +#define sk_ENGINE_CLEANUP_ITEM_new(st) SKM_sk_new(ENGINE_CLEANUP_ITEM, (st)) +#define sk_ENGINE_CLEANUP_ITEM_new_null() SKM_sk_new_null(ENGINE_CLEANUP_ITEM) +#define sk_ENGINE_CLEANUP_ITEM_free(st) SKM_sk_free(ENGINE_CLEANUP_ITEM, (st)) +#define sk_ENGINE_CLEANUP_ITEM_num(st) SKM_sk_num(ENGINE_CLEANUP_ITEM, (st)) +#define sk_ENGINE_CLEANUP_ITEM_value(st, i) SKM_sk_value(ENGINE_CLEANUP_ITEM, (st), (i)) +#define sk_ENGINE_CLEANUP_ITEM_set(st, i, val) SKM_sk_set(ENGINE_CLEANUP_ITEM, (st), (i), (val)) +#define sk_ENGINE_CLEANUP_ITEM_zero(st) SKM_sk_zero(ENGINE_CLEANUP_ITEM, (st)) +#define sk_ENGINE_CLEANUP_ITEM_push(st, val) SKM_sk_push(ENGINE_CLEANUP_ITEM, (st), (val)) +#define sk_ENGINE_CLEANUP_ITEM_unshift(st, val) SKM_sk_unshift(ENGINE_CLEANUP_ITEM, (st), (val)) +#define sk_ENGINE_CLEANUP_ITEM_find(st, val) SKM_sk_find(ENGINE_CLEANUP_ITEM, (st), (val)) +#define sk_ENGINE_CLEANUP_ITEM_find_ex(st, val) SKM_sk_find_ex(ENGINE_CLEANUP_ITEM, (st), (val)) +#define sk_ENGINE_CLEANUP_ITEM_delete(st, i) SKM_sk_delete(ENGINE_CLEANUP_ITEM, (st), (i)) +#define sk_ENGINE_CLEANUP_ITEM_delete_ptr(st, ptr) SKM_sk_delete_ptr(ENGINE_CLEANUP_ITEM, (st), (ptr)) +#define sk_ENGINE_CLEANUP_ITEM_insert(st, val, i) SKM_sk_insert(ENGINE_CLEANUP_ITEM, (st), (val), (i)) +#define sk_ENGINE_CLEANUP_ITEM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ENGINE_CLEANUP_ITEM, (st), (cmp)) +#define sk_ENGINE_CLEANUP_ITEM_dup(st) SKM_sk_dup(ENGINE_CLEANUP_ITEM, st) +#define sk_ENGINE_CLEANUP_ITEM_pop_free(st, free_func) SKM_sk_pop_free(ENGINE_CLEANUP_ITEM, (st), (free_func)) +#define sk_ENGINE_CLEANUP_ITEM_shift(st) SKM_sk_shift(ENGINE_CLEANUP_ITEM, (st)) +#define sk_ENGINE_CLEANUP_ITEM_pop(st) SKM_sk_pop(ENGINE_CLEANUP_ITEM, (st)) +#define sk_ENGINE_CLEANUP_ITEM_sort(st) SKM_sk_sort(ENGINE_CLEANUP_ITEM, (st)) +#define sk_ENGINE_CLEANUP_ITEM_is_sorted(st) SKM_sk_is_sorted(ENGINE_CLEANUP_ITEM, (st)) + +#define sk_GENERAL_NAME_new(st) SKM_sk_new(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_new_null() SKM_sk_new_null(GENERAL_NAME) +#define sk_GENERAL_NAME_free(st) SKM_sk_free(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_num(st) SKM_sk_num(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_value(st, i) SKM_sk_value(GENERAL_NAME, (st), (i)) +#define sk_GENERAL_NAME_set(st, i, val) SKM_sk_set(GENERAL_NAME, (st), (i), (val)) +#define sk_GENERAL_NAME_zero(st) SKM_sk_zero(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_push(st, val) SKM_sk_push(GENERAL_NAME, (st), (val)) +#define sk_GENERAL_NAME_unshift(st, val) SKM_sk_unshift(GENERAL_NAME, (st), (val)) +#define sk_GENERAL_NAME_find(st, val) SKM_sk_find(GENERAL_NAME, (st), (val)) +#define sk_GENERAL_NAME_find_ex(st, val) SKM_sk_find_ex(GENERAL_NAME, (st), (val)) +#define sk_GENERAL_NAME_delete(st, i) SKM_sk_delete(GENERAL_NAME, (st), (i)) +#define sk_GENERAL_NAME_delete_ptr(st, ptr) SKM_sk_delete_ptr(GENERAL_NAME, (st), (ptr)) +#define sk_GENERAL_NAME_insert(st, val, i) SKM_sk_insert(GENERAL_NAME, (st), (val), (i)) +#define sk_GENERAL_NAME_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(GENERAL_NAME, (st), (cmp)) +#define sk_GENERAL_NAME_dup(st) SKM_sk_dup(GENERAL_NAME, st) +#define sk_GENERAL_NAME_pop_free(st, free_func) SKM_sk_pop_free(GENERAL_NAME, (st), (free_func)) +#define sk_GENERAL_NAME_shift(st) SKM_sk_shift(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_pop(st) SKM_sk_pop(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_sort(st) SKM_sk_sort(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_is_sorted(st) SKM_sk_is_sorted(GENERAL_NAME, (st)) + +#define sk_GENERAL_SUBTREE_new(st) SKM_sk_new(GENERAL_SUBTREE, (st)) +#define sk_GENERAL_SUBTREE_new_null() SKM_sk_new_null(GENERAL_SUBTREE) +#define sk_GENERAL_SUBTREE_free(st) SKM_sk_free(GENERAL_SUBTREE, (st)) +#define sk_GENERAL_SUBTREE_num(st) SKM_sk_num(GENERAL_SUBTREE, (st)) +#define sk_GENERAL_SUBTREE_value(st, i) SKM_sk_value(GENERAL_SUBTREE, (st), (i)) +#define sk_GENERAL_SUBTREE_set(st, i, val) SKM_sk_set(GENERAL_SUBTREE, (st), (i), (val)) +#define sk_GENERAL_SUBTREE_zero(st) SKM_sk_zero(GENERAL_SUBTREE, (st)) +#define sk_GENERAL_SUBTREE_push(st, val) SKM_sk_push(GENERAL_SUBTREE, (st), (val)) +#define sk_GENERAL_SUBTREE_unshift(st, val) SKM_sk_unshift(GENERAL_SUBTREE, (st), (val)) +#define sk_GENERAL_SUBTREE_find(st, val) SKM_sk_find(GENERAL_SUBTREE, (st), (val)) +#define sk_GENERAL_SUBTREE_find_ex(st, val) SKM_sk_find_ex(GENERAL_SUBTREE, (st), (val)) +#define sk_GENERAL_SUBTREE_delete(st, i) SKM_sk_delete(GENERAL_SUBTREE, (st), (i)) +#define sk_GENERAL_SUBTREE_delete_ptr(st, ptr) SKM_sk_delete_ptr(GENERAL_SUBTREE, (st), (ptr)) +#define sk_GENERAL_SUBTREE_insert(st, val, i) SKM_sk_insert(GENERAL_SUBTREE, (st), (val), (i)) +#define sk_GENERAL_SUBTREE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(GENERAL_SUBTREE, (st), (cmp)) +#define sk_GENERAL_SUBTREE_dup(st) SKM_sk_dup(GENERAL_SUBTREE, st) +#define sk_GENERAL_SUBTREE_pop_free(st, free_func) SKM_sk_pop_free(GENERAL_SUBTREE, (st), (free_func)) +#define sk_GENERAL_SUBTREE_shift(st) SKM_sk_shift(GENERAL_SUBTREE, (st)) +#define sk_GENERAL_SUBTREE_pop(st) SKM_sk_pop(GENERAL_SUBTREE, (st)) +#define sk_GENERAL_SUBTREE_sort(st) SKM_sk_sort(GENERAL_SUBTREE, (st)) +#define sk_GENERAL_SUBTREE_is_sorted(st) SKM_sk_is_sorted(GENERAL_SUBTREE, (st)) + +#define sk_KRB5_APREQBODY_new(st) SKM_sk_new(KRB5_APREQBODY, (st)) +#define sk_KRB5_APREQBODY_new_null() SKM_sk_new_null(KRB5_APREQBODY) +#define sk_KRB5_APREQBODY_free(st) SKM_sk_free(KRB5_APREQBODY, (st)) +#define sk_KRB5_APREQBODY_num(st) SKM_sk_num(KRB5_APREQBODY, (st)) +#define sk_KRB5_APREQBODY_value(st, i) SKM_sk_value(KRB5_APREQBODY, (st), (i)) +#define sk_KRB5_APREQBODY_set(st, i, val) SKM_sk_set(KRB5_APREQBODY, (st), (i), (val)) +#define sk_KRB5_APREQBODY_zero(st) SKM_sk_zero(KRB5_APREQBODY, (st)) +#define sk_KRB5_APREQBODY_push(st, val) SKM_sk_push(KRB5_APREQBODY, (st), (val)) +#define sk_KRB5_APREQBODY_unshift(st, val) SKM_sk_unshift(KRB5_APREQBODY, (st), (val)) +#define sk_KRB5_APREQBODY_find(st, val) SKM_sk_find(KRB5_APREQBODY, (st), (val)) +#define sk_KRB5_APREQBODY_find_ex(st, val) SKM_sk_find_ex(KRB5_APREQBODY, (st), (val)) +#define sk_KRB5_APREQBODY_delete(st, i) SKM_sk_delete(KRB5_APREQBODY, (st), (i)) +#define sk_KRB5_APREQBODY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_APREQBODY, (st), (ptr)) +#define sk_KRB5_APREQBODY_insert(st, val, i) SKM_sk_insert(KRB5_APREQBODY, (st), (val), (i)) +#define sk_KRB5_APREQBODY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_APREQBODY, (st), (cmp)) +#define sk_KRB5_APREQBODY_dup(st) SKM_sk_dup(KRB5_APREQBODY, st) +#define sk_KRB5_APREQBODY_pop_free(st, free_func) SKM_sk_pop_free(KRB5_APREQBODY, (st), (free_func)) +#define sk_KRB5_APREQBODY_shift(st) SKM_sk_shift(KRB5_APREQBODY, (st)) +#define sk_KRB5_APREQBODY_pop(st) SKM_sk_pop(KRB5_APREQBODY, (st)) +#define sk_KRB5_APREQBODY_sort(st) SKM_sk_sort(KRB5_APREQBODY, (st)) +#define sk_KRB5_APREQBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_APREQBODY, (st)) + +#define sk_KRB5_AUTHDATA_new(st) SKM_sk_new(KRB5_AUTHDATA, (st)) +#define sk_KRB5_AUTHDATA_new_null() SKM_sk_new_null(KRB5_AUTHDATA) +#define sk_KRB5_AUTHDATA_free(st) SKM_sk_free(KRB5_AUTHDATA, (st)) +#define sk_KRB5_AUTHDATA_num(st) SKM_sk_num(KRB5_AUTHDATA, (st)) +#define sk_KRB5_AUTHDATA_value(st, i) SKM_sk_value(KRB5_AUTHDATA, (st), (i)) +#define sk_KRB5_AUTHDATA_set(st, i, val) SKM_sk_set(KRB5_AUTHDATA, (st), (i), (val)) +#define sk_KRB5_AUTHDATA_zero(st) SKM_sk_zero(KRB5_AUTHDATA, (st)) +#define sk_KRB5_AUTHDATA_push(st, val) SKM_sk_push(KRB5_AUTHDATA, (st), (val)) +#define sk_KRB5_AUTHDATA_unshift(st, val) SKM_sk_unshift(KRB5_AUTHDATA, (st), (val)) +#define sk_KRB5_AUTHDATA_find(st, val) SKM_sk_find(KRB5_AUTHDATA, (st), (val)) +#define sk_KRB5_AUTHDATA_find_ex(st, val) SKM_sk_find_ex(KRB5_AUTHDATA, (st), (val)) +#define sk_KRB5_AUTHDATA_delete(st, i) SKM_sk_delete(KRB5_AUTHDATA, (st), (i)) +#define sk_KRB5_AUTHDATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_AUTHDATA, (st), (ptr)) +#define sk_KRB5_AUTHDATA_insert(st, val, i) SKM_sk_insert(KRB5_AUTHDATA, (st), (val), (i)) +#define sk_KRB5_AUTHDATA_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_AUTHDATA, (st), (cmp)) +#define sk_KRB5_AUTHDATA_dup(st) SKM_sk_dup(KRB5_AUTHDATA, st) +#define sk_KRB5_AUTHDATA_pop_free(st, free_func) SKM_sk_pop_free(KRB5_AUTHDATA, (st), (free_func)) +#define sk_KRB5_AUTHDATA_shift(st) SKM_sk_shift(KRB5_AUTHDATA, (st)) +#define sk_KRB5_AUTHDATA_pop(st) SKM_sk_pop(KRB5_AUTHDATA, (st)) +#define sk_KRB5_AUTHDATA_sort(st) SKM_sk_sort(KRB5_AUTHDATA, (st)) +#define sk_KRB5_AUTHDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_AUTHDATA, (st)) + +#define sk_KRB5_AUTHENTBODY_new(st) SKM_sk_new(KRB5_AUTHENTBODY, (st)) +#define sk_KRB5_AUTHENTBODY_new_null() SKM_sk_new_null(KRB5_AUTHENTBODY) +#define sk_KRB5_AUTHENTBODY_free(st) SKM_sk_free(KRB5_AUTHENTBODY, (st)) +#define sk_KRB5_AUTHENTBODY_num(st) SKM_sk_num(KRB5_AUTHENTBODY, (st)) +#define sk_KRB5_AUTHENTBODY_value(st, i) SKM_sk_value(KRB5_AUTHENTBODY, (st), (i)) +#define sk_KRB5_AUTHENTBODY_set(st, i, val) SKM_sk_set(KRB5_AUTHENTBODY, (st), (i), (val)) +#define sk_KRB5_AUTHENTBODY_zero(st) SKM_sk_zero(KRB5_AUTHENTBODY, (st)) +#define sk_KRB5_AUTHENTBODY_push(st, val) SKM_sk_push(KRB5_AUTHENTBODY, (st), (val)) +#define sk_KRB5_AUTHENTBODY_unshift(st, val) SKM_sk_unshift(KRB5_AUTHENTBODY, (st), (val)) +#define sk_KRB5_AUTHENTBODY_find(st, val) SKM_sk_find(KRB5_AUTHENTBODY, (st), (val)) +#define sk_KRB5_AUTHENTBODY_find_ex(st, val) SKM_sk_find_ex(KRB5_AUTHENTBODY, (st), (val)) +#define sk_KRB5_AUTHENTBODY_delete(st, i) SKM_sk_delete(KRB5_AUTHENTBODY, (st), (i)) +#define sk_KRB5_AUTHENTBODY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_AUTHENTBODY, (st), (ptr)) +#define sk_KRB5_AUTHENTBODY_insert(st, val, i) SKM_sk_insert(KRB5_AUTHENTBODY, (st), (val), (i)) +#define sk_KRB5_AUTHENTBODY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_AUTHENTBODY, (st), (cmp)) +#define sk_KRB5_AUTHENTBODY_dup(st) SKM_sk_dup(KRB5_AUTHENTBODY, st) +#define sk_KRB5_AUTHENTBODY_pop_free(st, free_func) SKM_sk_pop_free(KRB5_AUTHENTBODY, (st), (free_func)) +#define sk_KRB5_AUTHENTBODY_shift(st) SKM_sk_shift(KRB5_AUTHENTBODY, (st)) +#define sk_KRB5_AUTHENTBODY_pop(st) SKM_sk_pop(KRB5_AUTHENTBODY, (st)) +#define sk_KRB5_AUTHENTBODY_sort(st) SKM_sk_sort(KRB5_AUTHENTBODY, (st)) +#define sk_KRB5_AUTHENTBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_AUTHENTBODY, (st)) + +#define sk_KRB5_CHECKSUM_new(st) SKM_sk_new(KRB5_CHECKSUM, (st)) +#define sk_KRB5_CHECKSUM_new_null() SKM_sk_new_null(KRB5_CHECKSUM) +#define sk_KRB5_CHECKSUM_free(st) SKM_sk_free(KRB5_CHECKSUM, (st)) +#define sk_KRB5_CHECKSUM_num(st) SKM_sk_num(KRB5_CHECKSUM, (st)) +#define sk_KRB5_CHECKSUM_value(st, i) SKM_sk_value(KRB5_CHECKSUM, (st), (i)) +#define sk_KRB5_CHECKSUM_set(st, i, val) SKM_sk_set(KRB5_CHECKSUM, (st), (i), (val)) +#define sk_KRB5_CHECKSUM_zero(st) SKM_sk_zero(KRB5_CHECKSUM, (st)) +#define sk_KRB5_CHECKSUM_push(st, val) SKM_sk_push(KRB5_CHECKSUM, (st), (val)) +#define sk_KRB5_CHECKSUM_unshift(st, val) SKM_sk_unshift(KRB5_CHECKSUM, (st), (val)) +#define sk_KRB5_CHECKSUM_find(st, val) SKM_sk_find(KRB5_CHECKSUM, (st), (val)) +#define sk_KRB5_CHECKSUM_find_ex(st, val) SKM_sk_find_ex(KRB5_CHECKSUM, (st), (val)) +#define sk_KRB5_CHECKSUM_delete(st, i) SKM_sk_delete(KRB5_CHECKSUM, (st), (i)) +#define sk_KRB5_CHECKSUM_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_CHECKSUM, (st), (ptr)) +#define sk_KRB5_CHECKSUM_insert(st, val, i) SKM_sk_insert(KRB5_CHECKSUM, (st), (val), (i)) +#define sk_KRB5_CHECKSUM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_CHECKSUM, (st), (cmp)) +#define sk_KRB5_CHECKSUM_dup(st) SKM_sk_dup(KRB5_CHECKSUM, st) +#define sk_KRB5_CHECKSUM_pop_free(st, free_func) SKM_sk_pop_free(KRB5_CHECKSUM, (st), (free_func)) +#define sk_KRB5_CHECKSUM_shift(st) SKM_sk_shift(KRB5_CHECKSUM, (st)) +#define sk_KRB5_CHECKSUM_pop(st) SKM_sk_pop(KRB5_CHECKSUM, (st)) +#define sk_KRB5_CHECKSUM_sort(st) SKM_sk_sort(KRB5_CHECKSUM, (st)) +#define sk_KRB5_CHECKSUM_is_sorted(st) SKM_sk_is_sorted(KRB5_CHECKSUM, (st)) + +#define sk_KRB5_ENCDATA_new(st) SKM_sk_new(KRB5_ENCDATA, (st)) +#define sk_KRB5_ENCDATA_new_null() SKM_sk_new_null(KRB5_ENCDATA) +#define sk_KRB5_ENCDATA_free(st) SKM_sk_free(KRB5_ENCDATA, (st)) +#define sk_KRB5_ENCDATA_num(st) SKM_sk_num(KRB5_ENCDATA, (st)) +#define sk_KRB5_ENCDATA_value(st, i) SKM_sk_value(KRB5_ENCDATA, (st), (i)) +#define sk_KRB5_ENCDATA_set(st, i, val) SKM_sk_set(KRB5_ENCDATA, (st), (i), (val)) +#define sk_KRB5_ENCDATA_zero(st) SKM_sk_zero(KRB5_ENCDATA, (st)) +#define sk_KRB5_ENCDATA_push(st, val) SKM_sk_push(KRB5_ENCDATA, (st), (val)) +#define sk_KRB5_ENCDATA_unshift(st, val) SKM_sk_unshift(KRB5_ENCDATA, (st), (val)) +#define sk_KRB5_ENCDATA_find(st, val) SKM_sk_find(KRB5_ENCDATA, (st), (val)) +#define sk_KRB5_ENCDATA_find_ex(st, val) SKM_sk_find_ex(KRB5_ENCDATA, (st), (val)) +#define sk_KRB5_ENCDATA_delete(st, i) SKM_sk_delete(KRB5_ENCDATA, (st), (i)) +#define sk_KRB5_ENCDATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_ENCDATA, (st), (ptr)) +#define sk_KRB5_ENCDATA_insert(st, val, i) SKM_sk_insert(KRB5_ENCDATA, (st), (val), (i)) +#define sk_KRB5_ENCDATA_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_ENCDATA, (st), (cmp)) +#define sk_KRB5_ENCDATA_dup(st) SKM_sk_dup(KRB5_ENCDATA, st) +#define sk_KRB5_ENCDATA_pop_free(st, free_func) SKM_sk_pop_free(KRB5_ENCDATA, (st), (free_func)) +#define sk_KRB5_ENCDATA_shift(st) SKM_sk_shift(KRB5_ENCDATA, (st)) +#define sk_KRB5_ENCDATA_pop(st) SKM_sk_pop(KRB5_ENCDATA, (st)) +#define sk_KRB5_ENCDATA_sort(st) SKM_sk_sort(KRB5_ENCDATA, (st)) +#define sk_KRB5_ENCDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCDATA, (st)) + +#define sk_KRB5_ENCKEY_new(st) SKM_sk_new(KRB5_ENCKEY, (st)) +#define sk_KRB5_ENCKEY_new_null() SKM_sk_new_null(KRB5_ENCKEY) +#define sk_KRB5_ENCKEY_free(st) SKM_sk_free(KRB5_ENCKEY, (st)) +#define sk_KRB5_ENCKEY_num(st) SKM_sk_num(KRB5_ENCKEY, (st)) +#define sk_KRB5_ENCKEY_value(st, i) SKM_sk_value(KRB5_ENCKEY, (st), (i)) +#define sk_KRB5_ENCKEY_set(st, i, val) SKM_sk_set(KRB5_ENCKEY, (st), (i), (val)) +#define sk_KRB5_ENCKEY_zero(st) SKM_sk_zero(KRB5_ENCKEY, (st)) +#define sk_KRB5_ENCKEY_push(st, val) SKM_sk_push(KRB5_ENCKEY, (st), (val)) +#define sk_KRB5_ENCKEY_unshift(st, val) SKM_sk_unshift(KRB5_ENCKEY, (st), (val)) +#define sk_KRB5_ENCKEY_find(st, val) SKM_sk_find(KRB5_ENCKEY, (st), (val)) +#define sk_KRB5_ENCKEY_find_ex(st, val) SKM_sk_find_ex(KRB5_ENCKEY, (st), (val)) +#define sk_KRB5_ENCKEY_delete(st, i) SKM_sk_delete(KRB5_ENCKEY, (st), (i)) +#define sk_KRB5_ENCKEY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_ENCKEY, (st), (ptr)) +#define sk_KRB5_ENCKEY_insert(st, val, i) SKM_sk_insert(KRB5_ENCKEY, (st), (val), (i)) +#define sk_KRB5_ENCKEY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_ENCKEY, (st), (cmp)) +#define sk_KRB5_ENCKEY_dup(st) SKM_sk_dup(KRB5_ENCKEY, st) +#define sk_KRB5_ENCKEY_pop_free(st, free_func) SKM_sk_pop_free(KRB5_ENCKEY, (st), (free_func)) +#define sk_KRB5_ENCKEY_shift(st) SKM_sk_shift(KRB5_ENCKEY, (st)) +#define sk_KRB5_ENCKEY_pop(st) SKM_sk_pop(KRB5_ENCKEY, (st)) +#define sk_KRB5_ENCKEY_sort(st) SKM_sk_sort(KRB5_ENCKEY, (st)) +#define sk_KRB5_ENCKEY_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCKEY, (st)) + +#define sk_KRB5_PRINCNAME_new(st) SKM_sk_new(KRB5_PRINCNAME, (st)) +#define sk_KRB5_PRINCNAME_new_null() SKM_sk_new_null(KRB5_PRINCNAME) +#define sk_KRB5_PRINCNAME_free(st) SKM_sk_free(KRB5_PRINCNAME, (st)) +#define sk_KRB5_PRINCNAME_num(st) SKM_sk_num(KRB5_PRINCNAME, (st)) +#define sk_KRB5_PRINCNAME_value(st, i) SKM_sk_value(KRB5_PRINCNAME, (st), (i)) +#define sk_KRB5_PRINCNAME_set(st, i, val) SKM_sk_set(KRB5_PRINCNAME, (st), (i), (val)) +#define sk_KRB5_PRINCNAME_zero(st) SKM_sk_zero(KRB5_PRINCNAME, (st)) +#define sk_KRB5_PRINCNAME_push(st, val) SKM_sk_push(KRB5_PRINCNAME, (st), (val)) +#define sk_KRB5_PRINCNAME_unshift(st, val) SKM_sk_unshift(KRB5_PRINCNAME, (st), (val)) +#define sk_KRB5_PRINCNAME_find(st, val) SKM_sk_find(KRB5_PRINCNAME, (st), (val)) +#define sk_KRB5_PRINCNAME_find_ex(st, val) SKM_sk_find_ex(KRB5_PRINCNAME, (st), (val)) +#define sk_KRB5_PRINCNAME_delete(st, i) SKM_sk_delete(KRB5_PRINCNAME, (st), (i)) +#define sk_KRB5_PRINCNAME_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_PRINCNAME, (st), (ptr)) +#define sk_KRB5_PRINCNAME_insert(st, val, i) SKM_sk_insert(KRB5_PRINCNAME, (st), (val), (i)) +#define sk_KRB5_PRINCNAME_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_PRINCNAME, (st), (cmp)) +#define sk_KRB5_PRINCNAME_dup(st) SKM_sk_dup(KRB5_PRINCNAME, st) +#define sk_KRB5_PRINCNAME_pop_free(st, free_func) SKM_sk_pop_free(KRB5_PRINCNAME, (st), (free_func)) +#define sk_KRB5_PRINCNAME_shift(st) SKM_sk_shift(KRB5_PRINCNAME, (st)) +#define sk_KRB5_PRINCNAME_pop(st) SKM_sk_pop(KRB5_PRINCNAME, (st)) +#define sk_KRB5_PRINCNAME_sort(st) SKM_sk_sort(KRB5_PRINCNAME, (st)) +#define sk_KRB5_PRINCNAME_is_sorted(st) SKM_sk_is_sorted(KRB5_PRINCNAME, (st)) + +#define sk_KRB5_TKTBODY_new(st) SKM_sk_new(KRB5_TKTBODY, (st)) +#define sk_KRB5_TKTBODY_new_null() SKM_sk_new_null(KRB5_TKTBODY) +#define sk_KRB5_TKTBODY_free(st) SKM_sk_free(KRB5_TKTBODY, (st)) +#define sk_KRB5_TKTBODY_num(st) SKM_sk_num(KRB5_TKTBODY, (st)) +#define sk_KRB5_TKTBODY_value(st, i) SKM_sk_value(KRB5_TKTBODY, (st), (i)) +#define sk_KRB5_TKTBODY_set(st, i, val) SKM_sk_set(KRB5_TKTBODY, (st), (i), (val)) +#define sk_KRB5_TKTBODY_zero(st) SKM_sk_zero(KRB5_TKTBODY, (st)) +#define sk_KRB5_TKTBODY_push(st, val) SKM_sk_push(KRB5_TKTBODY, (st), (val)) +#define sk_KRB5_TKTBODY_unshift(st, val) SKM_sk_unshift(KRB5_TKTBODY, (st), (val)) +#define sk_KRB5_TKTBODY_find(st, val) SKM_sk_find(KRB5_TKTBODY, (st), (val)) +#define sk_KRB5_TKTBODY_find_ex(st, val) SKM_sk_find_ex(KRB5_TKTBODY, (st), (val)) +#define sk_KRB5_TKTBODY_delete(st, i) SKM_sk_delete(KRB5_TKTBODY, (st), (i)) +#define sk_KRB5_TKTBODY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_TKTBODY, (st), (ptr)) +#define sk_KRB5_TKTBODY_insert(st, val, i) SKM_sk_insert(KRB5_TKTBODY, (st), (val), (i)) +#define sk_KRB5_TKTBODY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_TKTBODY, (st), (cmp)) +#define sk_KRB5_TKTBODY_dup(st) SKM_sk_dup(KRB5_TKTBODY, st) +#define sk_KRB5_TKTBODY_pop_free(st, free_func) SKM_sk_pop_free(KRB5_TKTBODY, (st), (free_func)) +#define sk_KRB5_TKTBODY_shift(st) SKM_sk_shift(KRB5_TKTBODY, (st)) +#define sk_KRB5_TKTBODY_pop(st) SKM_sk_pop(KRB5_TKTBODY, (st)) +#define sk_KRB5_TKTBODY_sort(st) SKM_sk_sort(KRB5_TKTBODY, (st)) +#define sk_KRB5_TKTBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_TKTBODY, (st)) + +#define sk_MIME_HEADER_new(st) SKM_sk_new(MIME_HEADER, (st)) +#define sk_MIME_HEADER_new_null() SKM_sk_new_null(MIME_HEADER) +#define sk_MIME_HEADER_free(st) SKM_sk_free(MIME_HEADER, (st)) +#define sk_MIME_HEADER_num(st) SKM_sk_num(MIME_HEADER, (st)) +#define sk_MIME_HEADER_value(st, i) SKM_sk_value(MIME_HEADER, (st), (i)) +#define sk_MIME_HEADER_set(st, i, val) SKM_sk_set(MIME_HEADER, (st), (i), (val)) +#define sk_MIME_HEADER_zero(st) SKM_sk_zero(MIME_HEADER, (st)) +#define sk_MIME_HEADER_push(st, val) SKM_sk_push(MIME_HEADER, (st), (val)) +#define sk_MIME_HEADER_unshift(st, val) SKM_sk_unshift(MIME_HEADER, (st), (val)) +#define sk_MIME_HEADER_find(st, val) SKM_sk_find(MIME_HEADER, (st), (val)) +#define sk_MIME_HEADER_find_ex(st, val) SKM_sk_find_ex(MIME_HEADER, (st), (val)) +#define sk_MIME_HEADER_delete(st, i) SKM_sk_delete(MIME_HEADER, (st), (i)) +#define sk_MIME_HEADER_delete_ptr(st, ptr) SKM_sk_delete_ptr(MIME_HEADER, (st), (ptr)) +#define sk_MIME_HEADER_insert(st, val, i) SKM_sk_insert(MIME_HEADER, (st), (val), (i)) +#define sk_MIME_HEADER_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(MIME_HEADER, (st), (cmp)) +#define sk_MIME_HEADER_dup(st) SKM_sk_dup(MIME_HEADER, st) +#define sk_MIME_HEADER_pop_free(st, free_func) SKM_sk_pop_free(MIME_HEADER, (st), (free_func)) +#define sk_MIME_HEADER_shift(st) SKM_sk_shift(MIME_HEADER, (st)) +#define sk_MIME_HEADER_pop(st) SKM_sk_pop(MIME_HEADER, (st)) +#define sk_MIME_HEADER_sort(st) SKM_sk_sort(MIME_HEADER, (st)) +#define sk_MIME_HEADER_is_sorted(st) SKM_sk_is_sorted(MIME_HEADER, (st)) + +#define sk_MIME_PARAM_new(st) SKM_sk_new(MIME_PARAM, (st)) +#define sk_MIME_PARAM_new_null() SKM_sk_new_null(MIME_PARAM) +#define sk_MIME_PARAM_free(st) SKM_sk_free(MIME_PARAM, (st)) +#define sk_MIME_PARAM_num(st) SKM_sk_num(MIME_PARAM, (st)) +#define sk_MIME_PARAM_value(st, i) SKM_sk_value(MIME_PARAM, (st), (i)) +#define sk_MIME_PARAM_set(st, i, val) SKM_sk_set(MIME_PARAM, (st), (i), (val)) +#define sk_MIME_PARAM_zero(st) SKM_sk_zero(MIME_PARAM, (st)) +#define sk_MIME_PARAM_push(st, val) SKM_sk_push(MIME_PARAM, (st), (val)) +#define sk_MIME_PARAM_unshift(st, val) SKM_sk_unshift(MIME_PARAM, (st), (val)) +#define sk_MIME_PARAM_find(st, val) SKM_sk_find(MIME_PARAM, (st), (val)) +#define sk_MIME_PARAM_find_ex(st, val) SKM_sk_find_ex(MIME_PARAM, (st), (val)) +#define sk_MIME_PARAM_delete(st, i) SKM_sk_delete(MIME_PARAM, (st), (i)) +#define sk_MIME_PARAM_delete_ptr(st, ptr) SKM_sk_delete_ptr(MIME_PARAM, (st), (ptr)) +#define sk_MIME_PARAM_insert(st, val, i) SKM_sk_insert(MIME_PARAM, (st), (val), (i)) +#define sk_MIME_PARAM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(MIME_PARAM, (st), (cmp)) +#define sk_MIME_PARAM_dup(st) SKM_sk_dup(MIME_PARAM, st) +#define sk_MIME_PARAM_pop_free(st, free_func) SKM_sk_pop_free(MIME_PARAM, (st), (free_func)) +#define sk_MIME_PARAM_shift(st) SKM_sk_shift(MIME_PARAM, (st)) +#define sk_MIME_PARAM_pop(st) SKM_sk_pop(MIME_PARAM, (st)) +#define sk_MIME_PARAM_sort(st) SKM_sk_sort(MIME_PARAM, (st)) +#define sk_MIME_PARAM_is_sorted(st) SKM_sk_is_sorted(MIME_PARAM, (st)) + +#define sk_NAME_FUNCS_new(st) SKM_sk_new(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_new_null() SKM_sk_new_null(NAME_FUNCS) +#define sk_NAME_FUNCS_free(st) SKM_sk_free(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_num(st) SKM_sk_num(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_value(st, i) SKM_sk_value(NAME_FUNCS, (st), (i)) +#define sk_NAME_FUNCS_set(st, i, val) SKM_sk_set(NAME_FUNCS, (st), (i), (val)) +#define sk_NAME_FUNCS_zero(st) SKM_sk_zero(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_push(st, val) SKM_sk_push(NAME_FUNCS, (st), (val)) +#define sk_NAME_FUNCS_unshift(st, val) SKM_sk_unshift(NAME_FUNCS, (st), (val)) +#define sk_NAME_FUNCS_find(st, val) SKM_sk_find(NAME_FUNCS, (st), (val)) +#define sk_NAME_FUNCS_find_ex(st, val) SKM_sk_find_ex(NAME_FUNCS, (st), (val)) +#define sk_NAME_FUNCS_delete(st, i) SKM_sk_delete(NAME_FUNCS, (st), (i)) +#define sk_NAME_FUNCS_delete_ptr(st, ptr) SKM_sk_delete_ptr(NAME_FUNCS, (st), (ptr)) +#define sk_NAME_FUNCS_insert(st, val, i) SKM_sk_insert(NAME_FUNCS, (st), (val), (i)) +#define sk_NAME_FUNCS_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(NAME_FUNCS, (st), (cmp)) +#define sk_NAME_FUNCS_dup(st) SKM_sk_dup(NAME_FUNCS, st) +#define sk_NAME_FUNCS_pop_free(st, free_func) SKM_sk_pop_free(NAME_FUNCS, (st), (free_func)) +#define sk_NAME_FUNCS_shift(st) SKM_sk_shift(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_pop(st) SKM_sk_pop(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_sort(st) SKM_sk_sort(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_is_sorted(st) SKM_sk_is_sorted(NAME_FUNCS, (st)) + +#define sk_OCSP_CERTID_new(st) SKM_sk_new(OCSP_CERTID, (st)) +#define sk_OCSP_CERTID_new_null() SKM_sk_new_null(OCSP_CERTID) +#define sk_OCSP_CERTID_free(st) SKM_sk_free(OCSP_CERTID, (st)) +#define sk_OCSP_CERTID_num(st) SKM_sk_num(OCSP_CERTID, (st)) +#define sk_OCSP_CERTID_value(st, i) SKM_sk_value(OCSP_CERTID, (st), (i)) +#define sk_OCSP_CERTID_set(st, i, val) SKM_sk_set(OCSP_CERTID, (st), (i), (val)) +#define sk_OCSP_CERTID_zero(st) SKM_sk_zero(OCSP_CERTID, (st)) +#define sk_OCSP_CERTID_push(st, val) SKM_sk_push(OCSP_CERTID, (st), (val)) +#define sk_OCSP_CERTID_unshift(st, val) SKM_sk_unshift(OCSP_CERTID, (st), (val)) +#define sk_OCSP_CERTID_find(st, val) SKM_sk_find(OCSP_CERTID, (st), (val)) +#define sk_OCSP_CERTID_find_ex(st, val) SKM_sk_find_ex(OCSP_CERTID, (st), (val)) +#define sk_OCSP_CERTID_delete(st, i) SKM_sk_delete(OCSP_CERTID, (st), (i)) +#define sk_OCSP_CERTID_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_CERTID, (st), (ptr)) +#define sk_OCSP_CERTID_insert(st, val, i) SKM_sk_insert(OCSP_CERTID, (st), (val), (i)) +#define sk_OCSP_CERTID_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(OCSP_CERTID, (st), (cmp)) +#define sk_OCSP_CERTID_dup(st) SKM_sk_dup(OCSP_CERTID, st) +#define sk_OCSP_CERTID_pop_free(st, free_func) SKM_sk_pop_free(OCSP_CERTID, (st), (free_func)) +#define sk_OCSP_CERTID_shift(st) SKM_sk_shift(OCSP_CERTID, (st)) +#define sk_OCSP_CERTID_pop(st) SKM_sk_pop(OCSP_CERTID, (st)) +#define sk_OCSP_CERTID_sort(st) SKM_sk_sort(OCSP_CERTID, (st)) +#define sk_OCSP_CERTID_is_sorted(st) SKM_sk_is_sorted(OCSP_CERTID, (st)) + +#define sk_OCSP_ONEREQ_new(st) SKM_sk_new(OCSP_ONEREQ, (st)) +#define sk_OCSP_ONEREQ_new_null() SKM_sk_new_null(OCSP_ONEREQ) +#define sk_OCSP_ONEREQ_free(st) SKM_sk_free(OCSP_ONEREQ, (st)) +#define sk_OCSP_ONEREQ_num(st) SKM_sk_num(OCSP_ONEREQ, (st)) +#define sk_OCSP_ONEREQ_value(st, i) SKM_sk_value(OCSP_ONEREQ, (st), (i)) +#define sk_OCSP_ONEREQ_set(st, i, val) SKM_sk_set(OCSP_ONEREQ, (st), (i), (val)) +#define sk_OCSP_ONEREQ_zero(st) SKM_sk_zero(OCSP_ONEREQ, (st)) +#define sk_OCSP_ONEREQ_push(st, val) SKM_sk_push(OCSP_ONEREQ, (st), (val)) +#define sk_OCSP_ONEREQ_unshift(st, val) SKM_sk_unshift(OCSP_ONEREQ, (st), (val)) +#define sk_OCSP_ONEREQ_find(st, val) SKM_sk_find(OCSP_ONEREQ, (st), (val)) +#define sk_OCSP_ONEREQ_find_ex(st, val) SKM_sk_find_ex(OCSP_ONEREQ, (st), (val)) +#define sk_OCSP_ONEREQ_delete(st, i) SKM_sk_delete(OCSP_ONEREQ, (st), (i)) +#define sk_OCSP_ONEREQ_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_ONEREQ, (st), (ptr)) +#define sk_OCSP_ONEREQ_insert(st, val, i) SKM_sk_insert(OCSP_ONEREQ, (st), (val), (i)) +#define sk_OCSP_ONEREQ_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(OCSP_ONEREQ, (st), (cmp)) +#define sk_OCSP_ONEREQ_dup(st) SKM_sk_dup(OCSP_ONEREQ, st) +#define sk_OCSP_ONEREQ_pop_free(st, free_func) SKM_sk_pop_free(OCSP_ONEREQ, (st), (free_func)) +#define sk_OCSP_ONEREQ_shift(st) SKM_sk_shift(OCSP_ONEREQ, (st)) +#define sk_OCSP_ONEREQ_pop(st) SKM_sk_pop(OCSP_ONEREQ, (st)) +#define sk_OCSP_ONEREQ_sort(st) SKM_sk_sort(OCSP_ONEREQ, (st)) +#define sk_OCSP_ONEREQ_is_sorted(st) SKM_sk_is_sorted(OCSP_ONEREQ, (st)) + +#define sk_OCSP_SINGLERESP_new(st) SKM_sk_new(OCSP_SINGLERESP, (st)) +#define sk_OCSP_SINGLERESP_new_null() SKM_sk_new_null(OCSP_SINGLERESP) +#define sk_OCSP_SINGLERESP_free(st) SKM_sk_free(OCSP_SINGLERESP, (st)) +#define sk_OCSP_SINGLERESP_num(st) SKM_sk_num(OCSP_SINGLERESP, (st)) +#define sk_OCSP_SINGLERESP_value(st, i) SKM_sk_value(OCSP_SINGLERESP, (st), (i)) +#define sk_OCSP_SINGLERESP_set(st, i, val) SKM_sk_set(OCSP_SINGLERESP, (st), (i), (val)) +#define sk_OCSP_SINGLERESP_zero(st) SKM_sk_zero(OCSP_SINGLERESP, (st)) +#define sk_OCSP_SINGLERESP_push(st, val) SKM_sk_push(OCSP_SINGLERESP, (st), (val)) +#define sk_OCSP_SINGLERESP_unshift(st, val) SKM_sk_unshift(OCSP_SINGLERESP, (st), (val)) +#define sk_OCSP_SINGLERESP_find(st, val) SKM_sk_find(OCSP_SINGLERESP, (st), (val)) +#define sk_OCSP_SINGLERESP_find_ex(st, val) SKM_sk_find_ex(OCSP_SINGLERESP, (st), (val)) +#define sk_OCSP_SINGLERESP_delete(st, i) SKM_sk_delete(OCSP_SINGLERESP, (st), (i)) +#define sk_OCSP_SINGLERESP_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_SINGLERESP, (st), (ptr)) +#define sk_OCSP_SINGLERESP_insert(st, val, i) SKM_sk_insert(OCSP_SINGLERESP, (st), (val), (i)) +#define sk_OCSP_SINGLERESP_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(OCSP_SINGLERESP, (st), (cmp)) +#define sk_OCSP_SINGLERESP_dup(st) SKM_sk_dup(OCSP_SINGLERESP, st) +#define sk_OCSP_SINGLERESP_pop_free(st, free_func) SKM_sk_pop_free(OCSP_SINGLERESP, (st), (free_func)) +#define sk_OCSP_SINGLERESP_shift(st) SKM_sk_shift(OCSP_SINGLERESP, (st)) +#define sk_OCSP_SINGLERESP_pop(st) SKM_sk_pop(OCSP_SINGLERESP, (st)) +#define sk_OCSP_SINGLERESP_sort(st) SKM_sk_sort(OCSP_SINGLERESP, (st)) +#define sk_OCSP_SINGLERESP_is_sorted(st) SKM_sk_is_sorted(OCSP_SINGLERESP, (st)) + +#define sk_PKCS12_SAFEBAG_new(st) SKM_sk_new(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_new_null() SKM_sk_new_null(PKCS12_SAFEBAG) +#define sk_PKCS12_SAFEBAG_free(st) SKM_sk_free(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_num(st) SKM_sk_num(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_value(st, i) SKM_sk_value(PKCS12_SAFEBAG, (st), (i)) +#define sk_PKCS12_SAFEBAG_set(st, i, val) SKM_sk_set(PKCS12_SAFEBAG, (st), (i), (val)) +#define sk_PKCS12_SAFEBAG_zero(st) SKM_sk_zero(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_push(st, val) SKM_sk_push(PKCS12_SAFEBAG, (st), (val)) +#define sk_PKCS12_SAFEBAG_unshift(st, val) SKM_sk_unshift(PKCS12_SAFEBAG, (st), (val)) +#define sk_PKCS12_SAFEBAG_find(st, val) SKM_sk_find(PKCS12_SAFEBAG, (st), (val)) +#define sk_PKCS12_SAFEBAG_find_ex(st, val) SKM_sk_find_ex(PKCS12_SAFEBAG, (st), (val)) +#define sk_PKCS12_SAFEBAG_delete(st, i) SKM_sk_delete(PKCS12_SAFEBAG, (st), (i)) +#define sk_PKCS12_SAFEBAG_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS12_SAFEBAG, (st), (ptr)) +#define sk_PKCS12_SAFEBAG_insert(st, val, i) SKM_sk_insert(PKCS12_SAFEBAG, (st), (val), (i)) +#define sk_PKCS12_SAFEBAG_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS12_SAFEBAG, (st), (cmp)) +#define sk_PKCS12_SAFEBAG_dup(st) SKM_sk_dup(PKCS12_SAFEBAG, st) +#define sk_PKCS12_SAFEBAG_pop_free(st, free_func) SKM_sk_pop_free(PKCS12_SAFEBAG, (st), (free_func)) +#define sk_PKCS12_SAFEBAG_shift(st) SKM_sk_shift(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_pop(st) SKM_sk_pop(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_sort(st) SKM_sk_sort(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_is_sorted(st) SKM_sk_is_sorted(PKCS12_SAFEBAG, (st)) + +#define sk_PKCS7_new(st) SKM_sk_new(PKCS7, (st)) +#define sk_PKCS7_new_null() SKM_sk_new_null(PKCS7) +#define sk_PKCS7_free(st) SKM_sk_free(PKCS7, (st)) +#define sk_PKCS7_num(st) SKM_sk_num(PKCS7, (st)) +#define sk_PKCS7_value(st, i) SKM_sk_value(PKCS7, (st), (i)) +#define sk_PKCS7_set(st, i, val) SKM_sk_set(PKCS7, (st), (i), (val)) +#define sk_PKCS7_zero(st) SKM_sk_zero(PKCS7, (st)) +#define sk_PKCS7_push(st, val) SKM_sk_push(PKCS7, (st), (val)) +#define sk_PKCS7_unshift(st, val) SKM_sk_unshift(PKCS7, (st), (val)) +#define sk_PKCS7_find(st, val) SKM_sk_find(PKCS7, (st), (val)) +#define sk_PKCS7_find_ex(st, val) SKM_sk_find_ex(PKCS7, (st), (val)) +#define sk_PKCS7_delete(st, i) SKM_sk_delete(PKCS7, (st), (i)) +#define sk_PKCS7_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS7, (st), (ptr)) +#define sk_PKCS7_insert(st, val, i) SKM_sk_insert(PKCS7, (st), (val), (i)) +#define sk_PKCS7_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS7, (st), (cmp)) +#define sk_PKCS7_dup(st) SKM_sk_dup(PKCS7, st) +#define sk_PKCS7_pop_free(st, free_func) SKM_sk_pop_free(PKCS7, (st), (free_func)) +#define sk_PKCS7_shift(st) SKM_sk_shift(PKCS7, (st)) +#define sk_PKCS7_pop(st) SKM_sk_pop(PKCS7, (st)) +#define sk_PKCS7_sort(st) SKM_sk_sort(PKCS7, (st)) +#define sk_PKCS7_is_sorted(st) SKM_sk_is_sorted(PKCS7, (st)) + +#define sk_PKCS7_RECIP_INFO_new(st) SKM_sk_new(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_new_null() SKM_sk_new_null(PKCS7_RECIP_INFO) +#define sk_PKCS7_RECIP_INFO_free(st) SKM_sk_free(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_num(st) SKM_sk_num(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_value(st, i) SKM_sk_value(PKCS7_RECIP_INFO, (st), (i)) +#define sk_PKCS7_RECIP_INFO_set(st, i, val) SKM_sk_set(PKCS7_RECIP_INFO, (st), (i), (val)) +#define sk_PKCS7_RECIP_INFO_zero(st) SKM_sk_zero(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_push(st, val) SKM_sk_push(PKCS7_RECIP_INFO, (st), (val)) +#define sk_PKCS7_RECIP_INFO_unshift(st, val) SKM_sk_unshift(PKCS7_RECIP_INFO, (st), (val)) +#define sk_PKCS7_RECIP_INFO_find(st, val) SKM_sk_find(PKCS7_RECIP_INFO, (st), (val)) +#define sk_PKCS7_RECIP_INFO_find_ex(st, val) SKM_sk_find_ex(PKCS7_RECIP_INFO, (st), (val)) +#define sk_PKCS7_RECIP_INFO_delete(st, i) SKM_sk_delete(PKCS7_RECIP_INFO, (st), (i)) +#define sk_PKCS7_RECIP_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS7_RECIP_INFO, (st), (ptr)) +#define sk_PKCS7_RECIP_INFO_insert(st, val, i) SKM_sk_insert(PKCS7_RECIP_INFO, (st), (val), (i)) +#define sk_PKCS7_RECIP_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS7_RECIP_INFO, (st), (cmp)) +#define sk_PKCS7_RECIP_INFO_dup(st) SKM_sk_dup(PKCS7_RECIP_INFO, st) +#define sk_PKCS7_RECIP_INFO_pop_free(st, free_func) SKM_sk_pop_free(PKCS7_RECIP_INFO, (st), (free_func)) +#define sk_PKCS7_RECIP_INFO_shift(st) SKM_sk_shift(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_pop(st) SKM_sk_pop(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_sort(st) SKM_sk_sort(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_is_sorted(st) SKM_sk_is_sorted(PKCS7_RECIP_INFO, (st)) + +#define sk_PKCS7_SIGNER_INFO_new(st) SKM_sk_new(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_new_null() SKM_sk_new_null(PKCS7_SIGNER_INFO) +#define sk_PKCS7_SIGNER_INFO_free(st) SKM_sk_free(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_num(st) SKM_sk_num(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_value(st, i) SKM_sk_value(PKCS7_SIGNER_INFO, (st), (i)) +#define sk_PKCS7_SIGNER_INFO_set(st, i, val) SKM_sk_set(PKCS7_SIGNER_INFO, (st), (i), (val)) +#define sk_PKCS7_SIGNER_INFO_zero(st) SKM_sk_zero(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_push(st, val) SKM_sk_push(PKCS7_SIGNER_INFO, (st), (val)) +#define sk_PKCS7_SIGNER_INFO_unshift(st, val) SKM_sk_unshift(PKCS7_SIGNER_INFO, (st), (val)) +#define sk_PKCS7_SIGNER_INFO_find(st, val) SKM_sk_find(PKCS7_SIGNER_INFO, (st), (val)) +#define sk_PKCS7_SIGNER_INFO_find_ex(st, val) SKM_sk_find_ex(PKCS7_SIGNER_INFO, (st), (val)) +#define sk_PKCS7_SIGNER_INFO_delete(st, i) SKM_sk_delete(PKCS7_SIGNER_INFO, (st), (i)) +#define sk_PKCS7_SIGNER_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS7_SIGNER_INFO, (st), (ptr)) +#define sk_PKCS7_SIGNER_INFO_insert(st, val, i) SKM_sk_insert(PKCS7_SIGNER_INFO, (st), (val), (i)) +#define sk_PKCS7_SIGNER_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS7_SIGNER_INFO, (st), (cmp)) +#define sk_PKCS7_SIGNER_INFO_dup(st) SKM_sk_dup(PKCS7_SIGNER_INFO, st) +#define sk_PKCS7_SIGNER_INFO_pop_free(st, free_func) SKM_sk_pop_free(PKCS7_SIGNER_INFO, (st), (free_func)) +#define sk_PKCS7_SIGNER_INFO_shift(st) SKM_sk_shift(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_pop(st) SKM_sk_pop(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_sort(st) SKM_sk_sort(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_is_sorted(st) SKM_sk_is_sorted(PKCS7_SIGNER_INFO, (st)) + +#define sk_POLICYINFO_new(st) SKM_sk_new(POLICYINFO, (st)) +#define sk_POLICYINFO_new_null() SKM_sk_new_null(POLICYINFO) +#define sk_POLICYINFO_free(st) SKM_sk_free(POLICYINFO, (st)) +#define sk_POLICYINFO_num(st) SKM_sk_num(POLICYINFO, (st)) +#define sk_POLICYINFO_value(st, i) SKM_sk_value(POLICYINFO, (st), (i)) +#define sk_POLICYINFO_set(st, i, val) SKM_sk_set(POLICYINFO, (st), (i), (val)) +#define sk_POLICYINFO_zero(st) SKM_sk_zero(POLICYINFO, (st)) +#define sk_POLICYINFO_push(st, val) SKM_sk_push(POLICYINFO, (st), (val)) +#define sk_POLICYINFO_unshift(st, val) SKM_sk_unshift(POLICYINFO, (st), (val)) +#define sk_POLICYINFO_find(st, val) SKM_sk_find(POLICYINFO, (st), (val)) +#define sk_POLICYINFO_find_ex(st, val) SKM_sk_find_ex(POLICYINFO, (st), (val)) +#define sk_POLICYINFO_delete(st, i) SKM_sk_delete(POLICYINFO, (st), (i)) +#define sk_POLICYINFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(POLICYINFO, (st), (ptr)) +#define sk_POLICYINFO_insert(st, val, i) SKM_sk_insert(POLICYINFO, (st), (val), (i)) +#define sk_POLICYINFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(POLICYINFO, (st), (cmp)) +#define sk_POLICYINFO_dup(st) SKM_sk_dup(POLICYINFO, st) +#define sk_POLICYINFO_pop_free(st, free_func) SKM_sk_pop_free(POLICYINFO, (st), (free_func)) +#define sk_POLICYINFO_shift(st) SKM_sk_shift(POLICYINFO, (st)) +#define sk_POLICYINFO_pop(st) SKM_sk_pop(POLICYINFO, (st)) +#define sk_POLICYINFO_sort(st) SKM_sk_sort(POLICYINFO, (st)) +#define sk_POLICYINFO_is_sorted(st) SKM_sk_is_sorted(POLICYINFO, (st)) + +#define sk_POLICYQUALINFO_new(st) SKM_sk_new(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_new_null() SKM_sk_new_null(POLICYQUALINFO) +#define sk_POLICYQUALINFO_free(st) SKM_sk_free(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_num(st) SKM_sk_num(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_value(st, i) SKM_sk_value(POLICYQUALINFO, (st), (i)) +#define sk_POLICYQUALINFO_set(st, i, val) SKM_sk_set(POLICYQUALINFO, (st), (i), (val)) +#define sk_POLICYQUALINFO_zero(st) SKM_sk_zero(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_push(st, val) SKM_sk_push(POLICYQUALINFO, (st), (val)) +#define sk_POLICYQUALINFO_unshift(st, val) SKM_sk_unshift(POLICYQUALINFO, (st), (val)) +#define sk_POLICYQUALINFO_find(st, val) SKM_sk_find(POLICYQUALINFO, (st), (val)) +#define sk_POLICYQUALINFO_find_ex(st, val) SKM_sk_find_ex(POLICYQUALINFO, (st), (val)) +#define sk_POLICYQUALINFO_delete(st, i) SKM_sk_delete(POLICYQUALINFO, (st), (i)) +#define sk_POLICYQUALINFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(POLICYQUALINFO, (st), (ptr)) +#define sk_POLICYQUALINFO_insert(st, val, i) SKM_sk_insert(POLICYQUALINFO, (st), (val), (i)) +#define sk_POLICYQUALINFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(POLICYQUALINFO, (st), (cmp)) +#define sk_POLICYQUALINFO_dup(st) SKM_sk_dup(POLICYQUALINFO, st) +#define sk_POLICYQUALINFO_pop_free(st, free_func) SKM_sk_pop_free(POLICYQUALINFO, (st), (free_func)) +#define sk_POLICYQUALINFO_shift(st) SKM_sk_shift(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_pop(st) SKM_sk_pop(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_sort(st) SKM_sk_sort(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_is_sorted(st) SKM_sk_is_sorted(POLICYQUALINFO, (st)) + +#define sk_POLICY_MAPPING_new(st) SKM_sk_new(POLICY_MAPPING, (st)) +#define sk_POLICY_MAPPING_new_null() SKM_sk_new_null(POLICY_MAPPING) +#define sk_POLICY_MAPPING_free(st) SKM_sk_free(POLICY_MAPPING, (st)) +#define sk_POLICY_MAPPING_num(st) SKM_sk_num(POLICY_MAPPING, (st)) +#define sk_POLICY_MAPPING_value(st, i) SKM_sk_value(POLICY_MAPPING, (st), (i)) +#define sk_POLICY_MAPPING_set(st, i, val) SKM_sk_set(POLICY_MAPPING, (st), (i), (val)) +#define sk_POLICY_MAPPING_zero(st) SKM_sk_zero(POLICY_MAPPING, (st)) +#define sk_POLICY_MAPPING_push(st, val) SKM_sk_push(POLICY_MAPPING, (st), (val)) +#define sk_POLICY_MAPPING_unshift(st, val) SKM_sk_unshift(POLICY_MAPPING, (st), (val)) +#define sk_POLICY_MAPPING_find(st, val) SKM_sk_find(POLICY_MAPPING, (st), (val)) +#define sk_POLICY_MAPPING_find_ex(st, val) SKM_sk_find_ex(POLICY_MAPPING, (st), (val)) +#define sk_POLICY_MAPPING_delete(st, i) SKM_sk_delete(POLICY_MAPPING, (st), (i)) +#define sk_POLICY_MAPPING_delete_ptr(st, ptr) SKM_sk_delete_ptr(POLICY_MAPPING, (st), (ptr)) +#define sk_POLICY_MAPPING_insert(st, val, i) SKM_sk_insert(POLICY_MAPPING, (st), (val), (i)) +#define sk_POLICY_MAPPING_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(POLICY_MAPPING, (st), (cmp)) +#define sk_POLICY_MAPPING_dup(st) SKM_sk_dup(POLICY_MAPPING, st) +#define sk_POLICY_MAPPING_pop_free(st, free_func) SKM_sk_pop_free(POLICY_MAPPING, (st), (free_func)) +#define sk_POLICY_MAPPING_shift(st) SKM_sk_shift(POLICY_MAPPING, (st)) +#define sk_POLICY_MAPPING_pop(st) SKM_sk_pop(POLICY_MAPPING, (st)) +#define sk_POLICY_MAPPING_sort(st) SKM_sk_sort(POLICY_MAPPING, (st)) +#define sk_POLICY_MAPPING_is_sorted(st) SKM_sk_is_sorted(POLICY_MAPPING, (st)) + +#define sk_SSL_CIPHER_new(st) SKM_sk_new(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_new_null() SKM_sk_new_null(SSL_CIPHER) +#define sk_SSL_CIPHER_free(st) SKM_sk_free(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_num(st) SKM_sk_num(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_value(st, i) SKM_sk_value(SSL_CIPHER, (st), (i)) +#define sk_SSL_CIPHER_set(st, i, val) SKM_sk_set(SSL_CIPHER, (st), (i), (val)) +#define sk_SSL_CIPHER_zero(st) SKM_sk_zero(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_push(st, val) SKM_sk_push(SSL_CIPHER, (st), (val)) +#define sk_SSL_CIPHER_unshift(st, val) SKM_sk_unshift(SSL_CIPHER, (st), (val)) +#define sk_SSL_CIPHER_find(st, val) SKM_sk_find(SSL_CIPHER, (st), (val)) +#define sk_SSL_CIPHER_find_ex(st, val) SKM_sk_find_ex(SSL_CIPHER, (st), (val)) +#define sk_SSL_CIPHER_delete(st, i) SKM_sk_delete(SSL_CIPHER, (st), (i)) +#define sk_SSL_CIPHER_delete_ptr(st, ptr) SKM_sk_delete_ptr(SSL_CIPHER, (st), (ptr)) +#define sk_SSL_CIPHER_insert(st, val, i) SKM_sk_insert(SSL_CIPHER, (st), (val), (i)) +#define sk_SSL_CIPHER_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SSL_CIPHER, (st), (cmp)) +#define sk_SSL_CIPHER_dup(st) SKM_sk_dup(SSL_CIPHER, st) +#define sk_SSL_CIPHER_pop_free(st, free_func) SKM_sk_pop_free(SSL_CIPHER, (st), (free_func)) +#define sk_SSL_CIPHER_shift(st) SKM_sk_shift(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_pop(st) SKM_sk_pop(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_sort(st) SKM_sk_sort(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_is_sorted(st) SKM_sk_is_sorted(SSL_CIPHER, (st)) + +#define sk_SSL_COMP_new(st) SKM_sk_new(SSL_COMP, (st)) +#define sk_SSL_COMP_new_null() SKM_sk_new_null(SSL_COMP) +#define sk_SSL_COMP_free(st) SKM_sk_free(SSL_COMP, (st)) +#define sk_SSL_COMP_num(st) SKM_sk_num(SSL_COMP, (st)) +#define sk_SSL_COMP_value(st, i) SKM_sk_value(SSL_COMP, (st), (i)) +#define sk_SSL_COMP_set(st, i, val) SKM_sk_set(SSL_COMP, (st), (i), (val)) +#define sk_SSL_COMP_zero(st) SKM_sk_zero(SSL_COMP, (st)) +#define sk_SSL_COMP_push(st, val) SKM_sk_push(SSL_COMP, (st), (val)) +#define sk_SSL_COMP_unshift(st, val) SKM_sk_unshift(SSL_COMP, (st), (val)) +#define sk_SSL_COMP_find(st, val) SKM_sk_find(SSL_COMP, (st), (val)) +#define sk_SSL_COMP_find_ex(st, val) SKM_sk_find_ex(SSL_COMP, (st), (val)) +#define sk_SSL_COMP_delete(st, i) SKM_sk_delete(SSL_COMP, (st), (i)) +#define sk_SSL_COMP_delete_ptr(st, ptr) SKM_sk_delete_ptr(SSL_COMP, (st), (ptr)) +#define sk_SSL_COMP_insert(st, val, i) SKM_sk_insert(SSL_COMP, (st), (val), (i)) +#define sk_SSL_COMP_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SSL_COMP, (st), (cmp)) +#define sk_SSL_COMP_dup(st) SKM_sk_dup(SSL_COMP, st) +#define sk_SSL_COMP_pop_free(st, free_func) SKM_sk_pop_free(SSL_COMP, (st), (free_func)) +#define sk_SSL_COMP_shift(st) SKM_sk_shift(SSL_COMP, (st)) +#define sk_SSL_COMP_pop(st) SKM_sk_pop(SSL_COMP, (st)) +#define sk_SSL_COMP_sort(st) SKM_sk_sort(SSL_COMP, (st)) +#define sk_SSL_COMP_is_sorted(st) SKM_sk_is_sorted(SSL_COMP, (st)) + +#define sk_STORE_OBJECT_new(st) SKM_sk_new(STORE_OBJECT, (st)) +#define sk_STORE_OBJECT_new_null() SKM_sk_new_null(STORE_OBJECT) +#define sk_STORE_OBJECT_free(st) SKM_sk_free(STORE_OBJECT, (st)) +#define sk_STORE_OBJECT_num(st) SKM_sk_num(STORE_OBJECT, (st)) +#define sk_STORE_OBJECT_value(st, i) SKM_sk_value(STORE_OBJECT, (st), (i)) +#define sk_STORE_OBJECT_set(st, i, val) SKM_sk_set(STORE_OBJECT, (st), (i), (val)) +#define sk_STORE_OBJECT_zero(st) SKM_sk_zero(STORE_OBJECT, (st)) +#define sk_STORE_OBJECT_push(st, val) SKM_sk_push(STORE_OBJECT, (st), (val)) +#define sk_STORE_OBJECT_unshift(st, val) SKM_sk_unshift(STORE_OBJECT, (st), (val)) +#define sk_STORE_OBJECT_find(st, val) SKM_sk_find(STORE_OBJECT, (st), (val)) +#define sk_STORE_OBJECT_find_ex(st, val) SKM_sk_find_ex(STORE_OBJECT, (st), (val)) +#define sk_STORE_OBJECT_delete(st, i) SKM_sk_delete(STORE_OBJECT, (st), (i)) +#define sk_STORE_OBJECT_delete_ptr(st, ptr) SKM_sk_delete_ptr(STORE_OBJECT, (st), (ptr)) +#define sk_STORE_OBJECT_insert(st, val, i) SKM_sk_insert(STORE_OBJECT, (st), (val), (i)) +#define sk_STORE_OBJECT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(STORE_OBJECT, (st), (cmp)) +#define sk_STORE_OBJECT_dup(st) SKM_sk_dup(STORE_OBJECT, st) +#define sk_STORE_OBJECT_pop_free(st, free_func) SKM_sk_pop_free(STORE_OBJECT, (st), (free_func)) +#define sk_STORE_OBJECT_shift(st) SKM_sk_shift(STORE_OBJECT, (st)) +#define sk_STORE_OBJECT_pop(st) SKM_sk_pop(STORE_OBJECT, (st)) +#define sk_STORE_OBJECT_sort(st) SKM_sk_sort(STORE_OBJECT, (st)) +#define sk_STORE_OBJECT_is_sorted(st) SKM_sk_is_sorted(STORE_OBJECT, (st)) + +#define sk_SXNETID_new(st) SKM_sk_new(SXNETID, (st)) +#define sk_SXNETID_new_null() SKM_sk_new_null(SXNETID) +#define sk_SXNETID_free(st) SKM_sk_free(SXNETID, (st)) +#define sk_SXNETID_num(st) SKM_sk_num(SXNETID, (st)) +#define sk_SXNETID_value(st, i) SKM_sk_value(SXNETID, (st), (i)) +#define sk_SXNETID_set(st, i, val) SKM_sk_set(SXNETID, (st), (i), (val)) +#define sk_SXNETID_zero(st) SKM_sk_zero(SXNETID, (st)) +#define sk_SXNETID_push(st, val) SKM_sk_push(SXNETID, (st), (val)) +#define sk_SXNETID_unshift(st, val) SKM_sk_unshift(SXNETID, (st), (val)) +#define sk_SXNETID_find(st, val) SKM_sk_find(SXNETID, (st), (val)) +#define sk_SXNETID_find_ex(st, val) SKM_sk_find_ex(SXNETID, (st), (val)) +#define sk_SXNETID_delete(st, i) SKM_sk_delete(SXNETID, (st), (i)) +#define sk_SXNETID_delete_ptr(st, ptr) SKM_sk_delete_ptr(SXNETID, (st), (ptr)) +#define sk_SXNETID_insert(st, val, i) SKM_sk_insert(SXNETID, (st), (val), (i)) +#define sk_SXNETID_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SXNETID, (st), (cmp)) +#define sk_SXNETID_dup(st) SKM_sk_dup(SXNETID, st) +#define sk_SXNETID_pop_free(st, free_func) SKM_sk_pop_free(SXNETID, (st), (free_func)) +#define sk_SXNETID_shift(st) SKM_sk_shift(SXNETID, (st)) +#define sk_SXNETID_pop(st) SKM_sk_pop(SXNETID, (st)) +#define sk_SXNETID_sort(st) SKM_sk_sort(SXNETID, (st)) +#define sk_SXNETID_is_sorted(st) SKM_sk_is_sorted(SXNETID, (st)) + +#define sk_UI_STRING_new(st) SKM_sk_new(UI_STRING, (st)) +#define sk_UI_STRING_new_null() SKM_sk_new_null(UI_STRING) +#define sk_UI_STRING_free(st) SKM_sk_free(UI_STRING, (st)) +#define sk_UI_STRING_num(st) SKM_sk_num(UI_STRING, (st)) +#define sk_UI_STRING_value(st, i) SKM_sk_value(UI_STRING, (st), (i)) +#define sk_UI_STRING_set(st, i, val) SKM_sk_set(UI_STRING, (st), (i), (val)) +#define sk_UI_STRING_zero(st) SKM_sk_zero(UI_STRING, (st)) +#define sk_UI_STRING_push(st, val) SKM_sk_push(UI_STRING, (st), (val)) +#define sk_UI_STRING_unshift(st, val) SKM_sk_unshift(UI_STRING, (st), (val)) +#define sk_UI_STRING_find(st, val) SKM_sk_find(UI_STRING, (st), (val)) +#define sk_UI_STRING_find_ex(st, val) SKM_sk_find_ex(UI_STRING, (st), (val)) +#define sk_UI_STRING_delete(st, i) SKM_sk_delete(UI_STRING, (st), (i)) +#define sk_UI_STRING_delete_ptr(st, ptr) SKM_sk_delete_ptr(UI_STRING, (st), (ptr)) +#define sk_UI_STRING_insert(st, val, i) SKM_sk_insert(UI_STRING, (st), (val), (i)) +#define sk_UI_STRING_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(UI_STRING, (st), (cmp)) +#define sk_UI_STRING_dup(st) SKM_sk_dup(UI_STRING, st) +#define sk_UI_STRING_pop_free(st, free_func) SKM_sk_pop_free(UI_STRING, (st), (free_func)) +#define sk_UI_STRING_shift(st) SKM_sk_shift(UI_STRING, (st)) +#define sk_UI_STRING_pop(st) SKM_sk_pop(UI_STRING, (st)) +#define sk_UI_STRING_sort(st) SKM_sk_sort(UI_STRING, (st)) +#define sk_UI_STRING_is_sorted(st) SKM_sk_is_sorted(UI_STRING, (st)) + +#define sk_X509_new(st) SKM_sk_new(X509, (st)) +#define sk_X509_new_null() SKM_sk_new_null(X509) +#define sk_X509_free(st) SKM_sk_free(X509, (st)) +#define sk_X509_num(st) SKM_sk_num(X509, (st)) +#define sk_X509_value(st, i) SKM_sk_value(X509, (st), (i)) +#define sk_X509_set(st, i, val) SKM_sk_set(X509, (st), (i), (val)) +#define sk_X509_zero(st) SKM_sk_zero(X509, (st)) +#define sk_X509_push(st, val) SKM_sk_push(X509, (st), (val)) +#define sk_X509_unshift(st, val) SKM_sk_unshift(X509, (st), (val)) +#define sk_X509_find(st, val) SKM_sk_find(X509, (st), (val)) +#define sk_X509_find_ex(st, val) SKM_sk_find_ex(X509, (st), (val)) +#define sk_X509_delete(st, i) SKM_sk_delete(X509, (st), (i)) +#define sk_X509_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509, (st), (ptr)) +#define sk_X509_insert(st, val, i) SKM_sk_insert(X509, (st), (val), (i)) +#define sk_X509_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509, (st), (cmp)) +#define sk_X509_dup(st) SKM_sk_dup(X509, st) +#define sk_X509_pop_free(st, free_func) SKM_sk_pop_free(X509, (st), (free_func)) +#define sk_X509_shift(st) SKM_sk_shift(X509, (st)) +#define sk_X509_pop(st) SKM_sk_pop(X509, (st)) +#define sk_X509_sort(st) SKM_sk_sort(X509, (st)) +#define sk_X509_is_sorted(st) SKM_sk_is_sorted(X509, (st)) + +#define sk_X509V3_EXT_METHOD_new(st) SKM_sk_new(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_new_null() SKM_sk_new_null(X509V3_EXT_METHOD) +#define sk_X509V3_EXT_METHOD_free(st) SKM_sk_free(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_num(st) SKM_sk_num(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_value(st, i) SKM_sk_value(X509V3_EXT_METHOD, (st), (i)) +#define sk_X509V3_EXT_METHOD_set(st, i, val) SKM_sk_set(X509V3_EXT_METHOD, (st), (i), (val)) +#define sk_X509V3_EXT_METHOD_zero(st) SKM_sk_zero(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_push(st, val) SKM_sk_push(X509V3_EXT_METHOD, (st), (val)) +#define sk_X509V3_EXT_METHOD_unshift(st, val) SKM_sk_unshift(X509V3_EXT_METHOD, (st), (val)) +#define sk_X509V3_EXT_METHOD_find(st, val) SKM_sk_find(X509V3_EXT_METHOD, (st), (val)) +#define sk_X509V3_EXT_METHOD_find_ex(st, val) SKM_sk_find_ex(X509V3_EXT_METHOD, (st), (val)) +#define sk_X509V3_EXT_METHOD_delete(st, i) SKM_sk_delete(X509V3_EXT_METHOD, (st), (i)) +#define sk_X509V3_EXT_METHOD_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509V3_EXT_METHOD, (st), (ptr)) +#define sk_X509V3_EXT_METHOD_insert(st, val, i) SKM_sk_insert(X509V3_EXT_METHOD, (st), (val), (i)) +#define sk_X509V3_EXT_METHOD_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509V3_EXT_METHOD, (st), (cmp)) +#define sk_X509V3_EXT_METHOD_dup(st) SKM_sk_dup(X509V3_EXT_METHOD, st) +#define sk_X509V3_EXT_METHOD_pop_free(st, free_func) SKM_sk_pop_free(X509V3_EXT_METHOD, (st), (free_func)) +#define sk_X509V3_EXT_METHOD_shift(st) SKM_sk_shift(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_pop(st) SKM_sk_pop(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_sort(st) SKM_sk_sort(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_is_sorted(st) SKM_sk_is_sorted(X509V3_EXT_METHOD, (st)) + +#define sk_X509_ALGOR_new(st) SKM_sk_new(X509_ALGOR, (st)) +#define sk_X509_ALGOR_new_null() SKM_sk_new_null(X509_ALGOR) +#define sk_X509_ALGOR_free(st) SKM_sk_free(X509_ALGOR, (st)) +#define sk_X509_ALGOR_num(st) SKM_sk_num(X509_ALGOR, (st)) +#define sk_X509_ALGOR_value(st, i) SKM_sk_value(X509_ALGOR, (st), (i)) +#define sk_X509_ALGOR_set(st, i, val) SKM_sk_set(X509_ALGOR, (st), (i), (val)) +#define sk_X509_ALGOR_zero(st) SKM_sk_zero(X509_ALGOR, (st)) +#define sk_X509_ALGOR_push(st, val) SKM_sk_push(X509_ALGOR, (st), (val)) +#define sk_X509_ALGOR_unshift(st, val) SKM_sk_unshift(X509_ALGOR, (st), (val)) +#define sk_X509_ALGOR_find(st, val) SKM_sk_find(X509_ALGOR, (st), (val)) +#define sk_X509_ALGOR_find_ex(st, val) SKM_sk_find_ex(X509_ALGOR, (st), (val)) +#define sk_X509_ALGOR_delete(st, i) SKM_sk_delete(X509_ALGOR, (st), (i)) +#define sk_X509_ALGOR_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_ALGOR, (st), (ptr)) +#define sk_X509_ALGOR_insert(st, val, i) SKM_sk_insert(X509_ALGOR, (st), (val), (i)) +#define sk_X509_ALGOR_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_ALGOR, (st), (cmp)) +#define sk_X509_ALGOR_dup(st) SKM_sk_dup(X509_ALGOR, st) +#define sk_X509_ALGOR_pop_free(st, free_func) SKM_sk_pop_free(X509_ALGOR, (st), (free_func)) +#define sk_X509_ALGOR_shift(st) SKM_sk_shift(X509_ALGOR, (st)) +#define sk_X509_ALGOR_pop(st) SKM_sk_pop(X509_ALGOR, (st)) +#define sk_X509_ALGOR_sort(st) SKM_sk_sort(X509_ALGOR, (st)) +#define sk_X509_ALGOR_is_sorted(st) SKM_sk_is_sorted(X509_ALGOR, (st)) + +#define sk_X509_ATTRIBUTE_new(st) SKM_sk_new(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_new_null() SKM_sk_new_null(X509_ATTRIBUTE) +#define sk_X509_ATTRIBUTE_free(st) SKM_sk_free(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_num(st) SKM_sk_num(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_value(st, i) SKM_sk_value(X509_ATTRIBUTE, (st), (i)) +#define sk_X509_ATTRIBUTE_set(st, i, val) SKM_sk_set(X509_ATTRIBUTE, (st), (i), (val)) +#define sk_X509_ATTRIBUTE_zero(st) SKM_sk_zero(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_push(st, val) SKM_sk_push(X509_ATTRIBUTE, (st), (val)) +#define sk_X509_ATTRIBUTE_unshift(st, val) SKM_sk_unshift(X509_ATTRIBUTE, (st), (val)) +#define sk_X509_ATTRIBUTE_find(st, val) SKM_sk_find(X509_ATTRIBUTE, (st), (val)) +#define sk_X509_ATTRIBUTE_find_ex(st, val) SKM_sk_find_ex(X509_ATTRIBUTE, (st), (val)) +#define sk_X509_ATTRIBUTE_delete(st, i) SKM_sk_delete(X509_ATTRIBUTE, (st), (i)) +#define sk_X509_ATTRIBUTE_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_ATTRIBUTE, (st), (ptr)) +#define sk_X509_ATTRIBUTE_insert(st, val, i) SKM_sk_insert(X509_ATTRIBUTE, (st), (val), (i)) +#define sk_X509_ATTRIBUTE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_ATTRIBUTE, (st), (cmp)) +#define sk_X509_ATTRIBUTE_dup(st) SKM_sk_dup(X509_ATTRIBUTE, st) +#define sk_X509_ATTRIBUTE_pop_free(st, free_func) SKM_sk_pop_free(X509_ATTRIBUTE, (st), (free_func)) +#define sk_X509_ATTRIBUTE_shift(st) SKM_sk_shift(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_pop(st) SKM_sk_pop(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_sort(st) SKM_sk_sort(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_is_sorted(st) SKM_sk_is_sorted(X509_ATTRIBUTE, (st)) + +#define sk_X509_CRL_new(st) SKM_sk_new(X509_CRL, (st)) +#define sk_X509_CRL_new_null() SKM_sk_new_null(X509_CRL) +#define sk_X509_CRL_free(st) SKM_sk_free(X509_CRL, (st)) +#define sk_X509_CRL_num(st) SKM_sk_num(X509_CRL, (st)) +#define sk_X509_CRL_value(st, i) SKM_sk_value(X509_CRL, (st), (i)) +#define sk_X509_CRL_set(st, i, val) SKM_sk_set(X509_CRL, (st), (i), (val)) +#define sk_X509_CRL_zero(st) SKM_sk_zero(X509_CRL, (st)) +#define sk_X509_CRL_push(st, val) SKM_sk_push(X509_CRL, (st), (val)) +#define sk_X509_CRL_unshift(st, val) SKM_sk_unshift(X509_CRL, (st), (val)) +#define sk_X509_CRL_find(st, val) SKM_sk_find(X509_CRL, (st), (val)) +#define sk_X509_CRL_find_ex(st, val) SKM_sk_find_ex(X509_CRL, (st), (val)) +#define sk_X509_CRL_delete(st, i) SKM_sk_delete(X509_CRL, (st), (i)) +#define sk_X509_CRL_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_CRL, (st), (ptr)) +#define sk_X509_CRL_insert(st, val, i) SKM_sk_insert(X509_CRL, (st), (val), (i)) +#define sk_X509_CRL_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_CRL, (st), (cmp)) +#define sk_X509_CRL_dup(st) SKM_sk_dup(X509_CRL, st) +#define sk_X509_CRL_pop_free(st, free_func) SKM_sk_pop_free(X509_CRL, (st), (free_func)) +#define sk_X509_CRL_shift(st) SKM_sk_shift(X509_CRL, (st)) +#define sk_X509_CRL_pop(st) SKM_sk_pop(X509_CRL, (st)) +#define sk_X509_CRL_sort(st) SKM_sk_sort(X509_CRL, (st)) +#define sk_X509_CRL_is_sorted(st) SKM_sk_is_sorted(X509_CRL, (st)) + +#define sk_X509_EXTENSION_new(st) SKM_sk_new(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_new_null() SKM_sk_new_null(X509_EXTENSION) +#define sk_X509_EXTENSION_free(st) SKM_sk_free(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_num(st) SKM_sk_num(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_value(st, i) SKM_sk_value(X509_EXTENSION, (st), (i)) +#define sk_X509_EXTENSION_set(st, i, val) SKM_sk_set(X509_EXTENSION, (st), (i), (val)) +#define sk_X509_EXTENSION_zero(st) SKM_sk_zero(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_push(st, val) SKM_sk_push(X509_EXTENSION, (st), (val)) +#define sk_X509_EXTENSION_unshift(st, val) SKM_sk_unshift(X509_EXTENSION, (st), (val)) +#define sk_X509_EXTENSION_find(st, val) SKM_sk_find(X509_EXTENSION, (st), (val)) +#define sk_X509_EXTENSION_find_ex(st, val) SKM_sk_find_ex(X509_EXTENSION, (st), (val)) +#define sk_X509_EXTENSION_delete(st, i) SKM_sk_delete(X509_EXTENSION, (st), (i)) +#define sk_X509_EXTENSION_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_EXTENSION, (st), (ptr)) +#define sk_X509_EXTENSION_insert(st, val, i) SKM_sk_insert(X509_EXTENSION, (st), (val), (i)) +#define sk_X509_EXTENSION_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_EXTENSION, (st), (cmp)) +#define sk_X509_EXTENSION_dup(st) SKM_sk_dup(X509_EXTENSION, st) +#define sk_X509_EXTENSION_pop_free(st, free_func) SKM_sk_pop_free(X509_EXTENSION, (st), (free_func)) +#define sk_X509_EXTENSION_shift(st) SKM_sk_shift(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_pop(st) SKM_sk_pop(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_sort(st) SKM_sk_sort(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_is_sorted(st) SKM_sk_is_sorted(X509_EXTENSION, (st)) + +#define sk_X509_INFO_new(st) SKM_sk_new(X509_INFO, (st)) +#define sk_X509_INFO_new_null() SKM_sk_new_null(X509_INFO) +#define sk_X509_INFO_free(st) SKM_sk_free(X509_INFO, (st)) +#define sk_X509_INFO_num(st) SKM_sk_num(X509_INFO, (st)) +#define sk_X509_INFO_value(st, i) SKM_sk_value(X509_INFO, (st), (i)) +#define sk_X509_INFO_set(st, i, val) SKM_sk_set(X509_INFO, (st), (i), (val)) +#define sk_X509_INFO_zero(st) SKM_sk_zero(X509_INFO, (st)) +#define sk_X509_INFO_push(st, val) SKM_sk_push(X509_INFO, (st), (val)) +#define sk_X509_INFO_unshift(st, val) SKM_sk_unshift(X509_INFO, (st), (val)) +#define sk_X509_INFO_find(st, val) SKM_sk_find(X509_INFO, (st), (val)) +#define sk_X509_INFO_find_ex(st, val) SKM_sk_find_ex(X509_INFO, (st), (val)) +#define sk_X509_INFO_delete(st, i) SKM_sk_delete(X509_INFO, (st), (i)) +#define sk_X509_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_INFO, (st), (ptr)) +#define sk_X509_INFO_insert(st, val, i) SKM_sk_insert(X509_INFO, (st), (val), (i)) +#define sk_X509_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_INFO, (st), (cmp)) +#define sk_X509_INFO_dup(st) SKM_sk_dup(X509_INFO, st) +#define sk_X509_INFO_pop_free(st, free_func) SKM_sk_pop_free(X509_INFO, (st), (free_func)) +#define sk_X509_INFO_shift(st) SKM_sk_shift(X509_INFO, (st)) +#define sk_X509_INFO_pop(st) SKM_sk_pop(X509_INFO, (st)) +#define sk_X509_INFO_sort(st) SKM_sk_sort(X509_INFO, (st)) +#define sk_X509_INFO_is_sorted(st) SKM_sk_is_sorted(X509_INFO, (st)) + +#define sk_X509_LOOKUP_new(st) SKM_sk_new(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_new_null() SKM_sk_new_null(X509_LOOKUP) +#define sk_X509_LOOKUP_free(st) SKM_sk_free(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_num(st) SKM_sk_num(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_value(st, i) SKM_sk_value(X509_LOOKUP, (st), (i)) +#define sk_X509_LOOKUP_set(st, i, val) SKM_sk_set(X509_LOOKUP, (st), (i), (val)) +#define sk_X509_LOOKUP_zero(st) SKM_sk_zero(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_push(st, val) SKM_sk_push(X509_LOOKUP, (st), (val)) +#define sk_X509_LOOKUP_unshift(st, val) SKM_sk_unshift(X509_LOOKUP, (st), (val)) +#define sk_X509_LOOKUP_find(st, val) SKM_sk_find(X509_LOOKUP, (st), (val)) +#define sk_X509_LOOKUP_find_ex(st, val) SKM_sk_find_ex(X509_LOOKUP, (st), (val)) +#define sk_X509_LOOKUP_delete(st, i) SKM_sk_delete(X509_LOOKUP, (st), (i)) +#define sk_X509_LOOKUP_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_LOOKUP, (st), (ptr)) +#define sk_X509_LOOKUP_insert(st, val, i) SKM_sk_insert(X509_LOOKUP, (st), (val), (i)) +#define sk_X509_LOOKUP_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_LOOKUP, (st), (cmp)) +#define sk_X509_LOOKUP_dup(st) SKM_sk_dup(X509_LOOKUP, st) +#define sk_X509_LOOKUP_pop_free(st, free_func) SKM_sk_pop_free(X509_LOOKUP, (st), (free_func)) +#define sk_X509_LOOKUP_shift(st) SKM_sk_shift(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_pop(st) SKM_sk_pop(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_sort(st) SKM_sk_sort(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_is_sorted(st) SKM_sk_is_sorted(X509_LOOKUP, (st)) + +#define sk_X509_NAME_new(st) SKM_sk_new(X509_NAME, (st)) +#define sk_X509_NAME_new_null() SKM_sk_new_null(X509_NAME) +#define sk_X509_NAME_free(st) SKM_sk_free(X509_NAME, (st)) +#define sk_X509_NAME_num(st) SKM_sk_num(X509_NAME, (st)) +#define sk_X509_NAME_value(st, i) SKM_sk_value(X509_NAME, (st), (i)) +#define sk_X509_NAME_set(st, i, val) SKM_sk_set(X509_NAME, (st), (i), (val)) +#define sk_X509_NAME_zero(st) SKM_sk_zero(X509_NAME, (st)) +#define sk_X509_NAME_push(st, val) SKM_sk_push(X509_NAME, (st), (val)) +#define sk_X509_NAME_unshift(st, val) SKM_sk_unshift(X509_NAME, (st), (val)) +#define sk_X509_NAME_find(st, val) SKM_sk_find(X509_NAME, (st), (val)) +#define sk_X509_NAME_find_ex(st, val) SKM_sk_find_ex(X509_NAME, (st), (val)) +#define sk_X509_NAME_delete(st, i) SKM_sk_delete(X509_NAME, (st), (i)) +#define sk_X509_NAME_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_NAME, (st), (ptr)) +#define sk_X509_NAME_insert(st, val, i) SKM_sk_insert(X509_NAME, (st), (val), (i)) +#define sk_X509_NAME_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_NAME, (st), (cmp)) +#define sk_X509_NAME_dup(st) SKM_sk_dup(X509_NAME, st) +#define sk_X509_NAME_pop_free(st, free_func) SKM_sk_pop_free(X509_NAME, (st), (free_func)) +#define sk_X509_NAME_shift(st) SKM_sk_shift(X509_NAME, (st)) +#define sk_X509_NAME_pop(st) SKM_sk_pop(X509_NAME, (st)) +#define sk_X509_NAME_sort(st) SKM_sk_sort(X509_NAME, (st)) +#define sk_X509_NAME_is_sorted(st) SKM_sk_is_sorted(X509_NAME, (st)) + +#define sk_X509_NAME_ENTRY_new(st) SKM_sk_new(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_new_null() SKM_sk_new_null(X509_NAME_ENTRY) +#define sk_X509_NAME_ENTRY_free(st) SKM_sk_free(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_num(st) SKM_sk_num(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_value(st, i) SKM_sk_value(X509_NAME_ENTRY, (st), (i)) +#define sk_X509_NAME_ENTRY_set(st, i, val) SKM_sk_set(X509_NAME_ENTRY, (st), (i), (val)) +#define sk_X509_NAME_ENTRY_zero(st) SKM_sk_zero(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_push(st, val) SKM_sk_push(X509_NAME_ENTRY, (st), (val)) +#define sk_X509_NAME_ENTRY_unshift(st, val) SKM_sk_unshift(X509_NAME_ENTRY, (st), (val)) +#define sk_X509_NAME_ENTRY_find(st, val) SKM_sk_find(X509_NAME_ENTRY, (st), (val)) +#define sk_X509_NAME_ENTRY_find_ex(st, val) SKM_sk_find_ex(X509_NAME_ENTRY, (st), (val)) +#define sk_X509_NAME_ENTRY_delete(st, i) SKM_sk_delete(X509_NAME_ENTRY, (st), (i)) +#define sk_X509_NAME_ENTRY_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_NAME_ENTRY, (st), (ptr)) +#define sk_X509_NAME_ENTRY_insert(st, val, i) SKM_sk_insert(X509_NAME_ENTRY, (st), (val), (i)) +#define sk_X509_NAME_ENTRY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_NAME_ENTRY, (st), (cmp)) +#define sk_X509_NAME_ENTRY_dup(st) SKM_sk_dup(X509_NAME_ENTRY, st) +#define sk_X509_NAME_ENTRY_pop_free(st, free_func) SKM_sk_pop_free(X509_NAME_ENTRY, (st), (free_func)) +#define sk_X509_NAME_ENTRY_shift(st) SKM_sk_shift(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_pop(st) SKM_sk_pop(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_sort(st) SKM_sk_sort(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_is_sorted(st) SKM_sk_is_sorted(X509_NAME_ENTRY, (st)) + +#define sk_X509_OBJECT_new(st) SKM_sk_new(X509_OBJECT, (st)) +#define sk_X509_OBJECT_new_null() SKM_sk_new_null(X509_OBJECT) +#define sk_X509_OBJECT_free(st) SKM_sk_free(X509_OBJECT, (st)) +#define sk_X509_OBJECT_num(st) SKM_sk_num(X509_OBJECT, (st)) +#define sk_X509_OBJECT_value(st, i) SKM_sk_value(X509_OBJECT, (st), (i)) +#define sk_X509_OBJECT_set(st, i, val) SKM_sk_set(X509_OBJECT, (st), (i), (val)) +#define sk_X509_OBJECT_zero(st) SKM_sk_zero(X509_OBJECT, (st)) +#define sk_X509_OBJECT_push(st, val) SKM_sk_push(X509_OBJECT, (st), (val)) +#define sk_X509_OBJECT_unshift(st, val) SKM_sk_unshift(X509_OBJECT, (st), (val)) +#define sk_X509_OBJECT_find(st, val) SKM_sk_find(X509_OBJECT, (st), (val)) +#define sk_X509_OBJECT_find_ex(st, val) SKM_sk_find_ex(X509_OBJECT, (st), (val)) +#define sk_X509_OBJECT_delete(st, i) SKM_sk_delete(X509_OBJECT, (st), (i)) +#define sk_X509_OBJECT_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_OBJECT, (st), (ptr)) +#define sk_X509_OBJECT_insert(st, val, i) SKM_sk_insert(X509_OBJECT, (st), (val), (i)) +#define sk_X509_OBJECT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_OBJECT, (st), (cmp)) +#define sk_X509_OBJECT_dup(st) SKM_sk_dup(X509_OBJECT, st) +#define sk_X509_OBJECT_pop_free(st, free_func) SKM_sk_pop_free(X509_OBJECT, (st), (free_func)) +#define sk_X509_OBJECT_shift(st) SKM_sk_shift(X509_OBJECT, (st)) +#define sk_X509_OBJECT_pop(st) SKM_sk_pop(X509_OBJECT, (st)) +#define sk_X509_OBJECT_sort(st) SKM_sk_sort(X509_OBJECT, (st)) +#define sk_X509_OBJECT_is_sorted(st) SKM_sk_is_sorted(X509_OBJECT, (st)) + +#define sk_X509_POLICY_DATA_new(st) SKM_sk_new(X509_POLICY_DATA, (st)) +#define sk_X509_POLICY_DATA_new_null() SKM_sk_new_null(X509_POLICY_DATA) +#define sk_X509_POLICY_DATA_free(st) SKM_sk_free(X509_POLICY_DATA, (st)) +#define sk_X509_POLICY_DATA_num(st) SKM_sk_num(X509_POLICY_DATA, (st)) +#define sk_X509_POLICY_DATA_value(st, i) SKM_sk_value(X509_POLICY_DATA, (st), (i)) +#define sk_X509_POLICY_DATA_set(st, i, val) SKM_sk_set(X509_POLICY_DATA, (st), (i), (val)) +#define sk_X509_POLICY_DATA_zero(st) SKM_sk_zero(X509_POLICY_DATA, (st)) +#define sk_X509_POLICY_DATA_push(st, val) SKM_sk_push(X509_POLICY_DATA, (st), (val)) +#define sk_X509_POLICY_DATA_unshift(st, val) SKM_sk_unshift(X509_POLICY_DATA, (st), (val)) +#define sk_X509_POLICY_DATA_find(st, val) SKM_sk_find(X509_POLICY_DATA, (st), (val)) +#define sk_X509_POLICY_DATA_find_ex(st, val) SKM_sk_find_ex(X509_POLICY_DATA, (st), (val)) +#define sk_X509_POLICY_DATA_delete(st, i) SKM_sk_delete(X509_POLICY_DATA, (st), (i)) +#define sk_X509_POLICY_DATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_POLICY_DATA, (st), (ptr)) +#define sk_X509_POLICY_DATA_insert(st, val, i) SKM_sk_insert(X509_POLICY_DATA, (st), (val), (i)) +#define sk_X509_POLICY_DATA_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_POLICY_DATA, (st), (cmp)) +#define sk_X509_POLICY_DATA_dup(st) SKM_sk_dup(X509_POLICY_DATA, st) +#define sk_X509_POLICY_DATA_pop_free(st, free_func) SKM_sk_pop_free(X509_POLICY_DATA, (st), (free_func)) +#define sk_X509_POLICY_DATA_shift(st) SKM_sk_shift(X509_POLICY_DATA, (st)) +#define sk_X509_POLICY_DATA_pop(st) SKM_sk_pop(X509_POLICY_DATA, (st)) +#define sk_X509_POLICY_DATA_sort(st) SKM_sk_sort(X509_POLICY_DATA, (st)) +#define sk_X509_POLICY_DATA_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_DATA, (st)) + +#define sk_X509_POLICY_NODE_new(st) SKM_sk_new(X509_POLICY_NODE, (st)) +#define sk_X509_POLICY_NODE_new_null() SKM_sk_new_null(X509_POLICY_NODE) +#define sk_X509_POLICY_NODE_free(st) SKM_sk_free(X509_POLICY_NODE, (st)) +#define sk_X509_POLICY_NODE_num(st) SKM_sk_num(X509_POLICY_NODE, (st)) +#define sk_X509_POLICY_NODE_value(st, i) SKM_sk_value(X509_POLICY_NODE, (st), (i)) +#define sk_X509_POLICY_NODE_set(st, i, val) SKM_sk_set(X509_POLICY_NODE, (st), (i), (val)) +#define sk_X509_POLICY_NODE_zero(st) SKM_sk_zero(X509_POLICY_NODE, (st)) +#define sk_X509_POLICY_NODE_push(st, val) SKM_sk_push(X509_POLICY_NODE, (st), (val)) +#define sk_X509_POLICY_NODE_unshift(st, val) SKM_sk_unshift(X509_POLICY_NODE, (st), (val)) +#define sk_X509_POLICY_NODE_find(st, val) SKM_sk_find(X509_POLICY_NODE, (st), (val)) +#define sk_X509_POLICY_NODE_find_ex(st, val) SKM_sk_find_ex(X509_POLICY_NODE, (st), (val)) +#define sk_X509_POLICY_NODE_delete(st, i) SKM_sk_delete(X509_POLICY_NODE, (st), (i)) +#define sk_X509_POLICY_NODE_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_POLICY_NODE, (st), (ptr)) +#define sk_X509_POLICY_NODE_insert(st, val, i) SKM_sk_insert(X509_POLICY_NODE, (st), (val), (i)) +#define sk_X509_POLICY_NODE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_POLICY_NODE, (st), (cmp)) +#define sk_X509_POLICY_NODE_dup(st) SKM_sk_dup(X509_POLICY_NODE, st) +#define sk_X509_POLICY_NODE_pop_free(st, free_func) SKM_sk_pop_free(X509_POLICY_NODE, (st), (free_func)) +#define sk_X509_POLICY_NODE_shift(st) SKM_sk_shift(X509_POLICY_NODE, (st)) +#define sk_X509_POLICY_NODE_pop(st) SKM_sk_pop(X509_POLICY_NODE, (st)) +#define sk_X509_POLICY_NODE_sort(st) SKM_sk_sort(X509_POLICY_NODE, (st)) +#define sk_X509_POLICY_NODE_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_NODE, (st)) + +#define sk_X509_POLICY_REF_new(st) SKM_sk_new(X509_POLICY_REF, (st)) +#define sk_X509_POLICY_REF_new_null() SKM_sk_new_null(X509_POLICY_REF) +#define sk_X509_POLICY_REF_free(st) SKM_sk_free(X509_POLICY_REF, (st)) +#define sk_X509_POLICY_REF_num(st) SKM_sk_num(X509_POLICY_REF, (st)) +#define sk_X509_POLICY_REF_value(st, i) SKM_sk_value(X509_POLICY_REF, (st), (i)) +#define sk_X509_POLICY_REF_set(st, i, val) SKM_sk_set(X509_POLICY_REF, (st), (i), (val)) +#define sk_X509_POLICY_REF_zero(st) SKM_sk_zero(X509_POLICY_REF, (st)) +#define sk_X509_POLICY_REF_push(st, val) SKM_sk_push(X509_POLICY_REF, (st), (val)) +#define sk_X509_POLICY_REF_unshift(st, val) SKM_sk_unshift(X509_POLICY_REF, (st), (val)) +#define sk_X509_POLICY_REF_find(st, val) SKM_sk_find(X509_POLICY_REF, (st), (val)) +#define sk_X509_POLICY_REF_find_ex(st, val) SKM_sk_find_ex(X509_POLICY_REF, (st), (val)) +#define sk_X509_POLICY_REF_delete(st, i) SKM_sk_delete(X509_POLICY_REF, (st), (i)) +#define sk_X509_POLICY_REF_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_POLICY_REF, (st), (ptr)) +#define sk_X509_POLICY_REF_insert(st, val, i) SKM_sk_insert(X509_POLICY_REF, (st), (val), (i)) +#define sk_X509_POLICY_REF_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_POLICY_REF, (st), (cmp)) +#define sk_X509_POLICY_REF_dup(st) SKM_sk_dup(X509_POLICY_REF, st) +#define sk_X509_POLICY_REF_pop_free(st, free_func) SKM_sk_pop_free(X509_POLICY_REF, (st), (free_func)) +#define sk_X509_POLICY_REF_shift(st) SKM_sk_shift(X509_POLICY_REF, (st)) +#define sk_X509_POLICY_REF_pop(st) SKM_sk_pop(X509_POLICY_REF, (st)) +#define sk_X509_POLICY_REF_sort(st) SKM_sk_sort(X509_POLICY_REF, (st)) +#define sk_X509_POLICY_REF_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_REF, (st)) + +#define sk_X509_PURPOSE_new(st) SKM_sk_new(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_new_null() SKM_sk_new_null(X509_PURPOSE) +#define sk_X509_PURPOSE_free(st) SKM_sk_free(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_num(st) SKM_sk_num(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_value(st, i) SKM_sk_value(X509_PURPOSE, (st), (i)) +#define sk_X509_PURPOSE_set(st, i, val) SKM_sk_set(X509_PURPOSE, (st), (i), (val)) +#define sk_X509_PURPOSE_zero(st) SKM_sk_zero(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_push(st, val) SKM_sk_push(X509_PURPOSE, (st), (val)) +#define sk_X509_PURPOSE_unshift(st, val) SKM_sk_unshift(X509_PURPOSE, (st), (val)) +#define sk_X509_PURPOSE_find(st, val) SKM_sk_find(X509_PURPOSE, (st), (val)) +#define sk_X509_PURPOSE_find_ex(st, val) SKM_sk_find_ex(X509_PURPOSE, (st), (val)) +#define sk_X509_PURPOSE_delete(st, i) SKM_sk_delete(X509_PURPOSE, (st), (i)) +#define sk_X509_PURPOSE_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_PURPOSE, (st), (ptr)) +#define sk_X509_PURPOSE_insert(st, val, i) SKM_sk_insert(X509_PURPOSE, (st), (val), (i)) +#define sk_X509_PURPOSE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_PURPOSE, (st), (cmp)) +#define sk_X509_PURPOSE_dup(st) SKM_sk_dup(X509_PURPOSE, st) +#define sk_X509_PURPOSE_pop_free(st, free_func) SKM_sk_pop_free(X509_PURPOSE, (st), (free_func)) +#define sk_X509_PURPOSE_shift(st) SKM_sk_shift(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_pop(st) SKM_sk_pop(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_sort(st) SKM_sk_sort(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_is_sorted(st) SKM_sk_is_sorted(X509_PURPOSE, (st)) + +#define sk_X509_REVOKED_new(st) SKM_sk_new(X509_REVOKED, (st)) +#define sk_X509_REVOKED_new_null() SKM_sk_new_null(X509_REVOKED) +#define sk_X509_REVOKED_free(st) SKM_sk_free(X509_REVOKED, (st)) +#define sk_X509_REVOKED_num(st) SKM_sk_num(X509_REVOKED, (st)) +#define sk_X509_REVOKED_value(st, i) SKM_sk_value(X509_REVOKED, (st), (i)) +#define sk_X509_REVOKED_set(st, i, val) SKM_sk_set(X509_REVOKED, (st), (i), (val)) +#define sk_X509_REVOKED_zero(st) SKM_sk_zero(X509_REVOKED, (st)) +#define sk_X509_REVOKED_push(st, val) SKM_sk_push(X509_REVOKED, (st), (val)) +#define sk_X509_REVOKED_unshift(st, val) SKM_sk_unshift(X509_REVOKED, (st), (val)) +#define sk_X509_REVOKED_find(st, val) SKM_sk_find(X509_REVOKED, (st), (val)) +#define sk_X509_REVOKED_find_ex(st, val) SKM_sk_find_ex(X509_REVOKED, (st), (val)) +#define sk_X509_REVOKED_delete(st, i) SKM_sk_delete(X509_REVOKED, (st), (i)) +#define sk_X509_REVOKED_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_REVOKED, (st), (ptr)) +#define sk_X509_REVOKED_insert(st, val, i) SKM_sk_insert(X509_REVOKED, (st), (val), (i)) +#define sk_X509_REVOKED_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_REVOKED, (st), (cmp)) +#define sk_X509_REVOKED_dup(st) SKM_sk_dup(X509_REVOKED, st) +#define sk_X509_REVOKED_pop_free(st, free_func) SKM_sk_pop_free(X509_REVOKED, (st), (free_func)) +#define sk_X509_REVOKED_shift(st) SKM_sk_shift(X509_REVOKED, (st)) +#define sk_X509_REVOKED_pop(st) SKM_sk_pop(X509_REVOKED, (st)) +#define sk_X509_REVOKED_sort(st) SKM_sk_sort(X509_REVOKED, (st)) +#define sk_X509_REVOKED_is_sorted(st) SKM_sk_is_sorted(X509_REVOKED, (st)) + +#define sk_X509_TRUST_new(st) SKM_sk_new(X509_TRUST, (st)) +#define sk_X509_TRUST_new_null() SKM_sk_new_null(X509_TRUST) +#define sk_X509_TRUST_free(st) SKM_sk_free(X509_TRUST, (st)) +#define sk_X509_TRUST_num(st) SKM_sk_num(X509_TRUST, (st)) +#define sk_X509_TRUST_value(st, i) SKM_sk_value(X509_TRUST, (st), (i)) +#define sk_X509_TRUST_set(st, i, val) SKM_sk_set(X509_TRUST, (st), (i), (val)) +#define sk_X509_TRUST_zero(st) SKM_sk_zero(X509_TRUST, (st)) +#define sk_X509_TRUST_push(st, val) SKM_sk_push(X509_TRUST, (st), (val)) +#define sk_X509_TRUST_unshift(st, val) SKM_sk_unshift(X509_TRUST, (st), (val)) +#define sk_X509_TRUST_find(st, val) SKM_sk_find(X509_TRUST, (st), (val)) +#define sk_X509_TRUST_find_ex(st, val) SKM_sk_find_ex(X509_TRUST, (st), (val)) +#define sk_X509_TRUST_delete(st, i) SKM_sk_delete(X509_TRUST, (st), (i)) +#define sk_X509_TRUST_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_TRUST, (st), (ptr)) +#define sk_X509_TRUST_insert(st, val, i) SKM_sk_insert(X509_TRUST, (st), (val), (i)) +#define sk_X509_TRUST_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_TRUST, (st), (cmp)) +#define sk_X509_TRUST_dup(st) SKM_sk_dup(X509_TRUST, st) +#define sk_X509_TRUST_pop_free(st, free_func) SKM_sk_pop_free(X509_TRUST, (st), (free_func)) +#define sk_X509_TRUST_shift(st) SKM_sk_shift(X509_TRUST, (st)) +#define sk_X509_TRUST_pop(st) SKM_sk_pop(X509_TRUST, (st)) +#define sk_X509_TRUST_sort(st) SKM_sk_sort(X509_TRUST, (st)) +#define sk_X509_TRUST_is_sorted(st) SKM_sk_is_sorted(X509_TRUST, (st)) + +#define sk_X509_VERIFY_PARAM_new(st) SKM_sk_new(X509_VERIFY_PARAM, (st)) +#define sk_X509_VERIFY_PARAM_new_null() SKM_sk_new_null(X509_VERIFY_PARAM) +#define sk_X509_VERIFY_PARAM_free(st) SKM_sk_free(X509_VERIFY_PARAM, (st)) +#define sk_X509_VERIFY_PARAM_num(st) SKM_sk_num(X509_VERIFY_PARAM, (st)) +#define sk_X509_VERIFY_PARAM_value(st, i) SKM_sk_value(X509_VERIFY_PARAM, (st), (i)) +#define sk_X509_VERIFY_PARAM_set(st, i, val) SKM_sk_set(X509_VERIFY_PARAM, (st), (i), (val)) +#define sk_X509_VERIFY_PARAM_zero(st) SKM_sk_zero(X509_VERIFY_PARAM, (st)) +#define sk_X509_VERIFY_PARAM_push(st, val) SKM_sk_push(X509_VERIFY_PARAM, (st), (val)) +#define sk_X509_VERIFY_PARAM_unshift(st, val) SKM_sk_unshift(X509_VERIFY_PARAM, (st), (val)) +#define sk_X509_VERIFY_PARAM_find(st, val) SKM_sk_find(X509_VERIFY_PARAM, (st), (val)) +#define sk_X509_VERIFY_PARAM_find_ex(st, val) SKM_sk_find_ex(X509_VERIFY_PARAM, (st), (val)) +#define sk_X509_VERIFY_PARAM_delete(st, i) SKM_sk_delete(X509_VERIFY_PARAM, (st), (i)) +#define sk_X509_VERIFY_PARAM_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_VERIFY_PARAM, (st), (ptr)) +#define sk_X509_VERIFY_PARAM_insert(st, val, i) SKM_sk_insert(X509_VERIFY_PARAM, (st), (val), (i)) +#define sk_X509_VERIFY_PARAM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_VERIFY_PARAM, (st), (cmp)) +#define sk_X509_VERIFY_PARAM_dup(st) SKM_sk_dup(X509_VERIFY_PARAM, st) +#define sk_X509_VERIFY_PARAM_pop_free(st, free_func) SKM_sk_pop_free(X509_VERIFY_PARAM, (st), (free_func)) +#define sk_X509_VERIFY_PARAM_shift(st) SKM_sk_shift(X509_VERIFY_PARAM, (st)) +#define sk_X509_VERIFY_PARAM_pop(st) SKM_sk_pop(X509_VERIFY_PARAM, (st)) +#define sk_X509_VERIFY_PARAM_sort(st) SKM_sk_sort(X509_VERIFY_PARAM, (st)) +#define sk_X509_VERIFY_PARAM_is_sorted(st) SKM_sk_is_sorted(X509_VERIFY_PARAM, (st)) + +#define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(ACCESS_DESCRIPTION, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(ACCESS_DESCRIPTION, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_ACCESS_DESCRIPTION(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(ACCESS_DESCRIPTION, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_ACCESS_DESCRIPTION(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(ACCESS_DESCRIPTION, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_ASN1_INTEGER(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(ASN1_INTEGER, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_ASN1_INTEGER(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(ASN1_INTEGER, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_ASN1_INTEGER(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(ASN1_INTEGER, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_ASN1_INTEGER(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(ASN1_INTEGER, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_ASN1_OBJECT(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(ASN1_OBJECT, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_ASN1_OBJECT(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(ASN1_OBJECT, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_ASN1_OBJECT(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(ASN1_OBJECT, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_ASN1_OBJECT(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(ASN1_OBJECT, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_ASN1_TYPE(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(ASN1_TYPE, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_ASN1_TYPE(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(ASN1_TYPE, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_ASN1_TYPE(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(ASN1_TYPE, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_ASN1_TYPE(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(ASN1_TYPE, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_DIST_POINT(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(DIST_POINT, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_DIST_POINT(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(DIST_POINT, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_DIST_POINT(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(DIST_POINT, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_DIST_POINT(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(DIST_POINT, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_GENERAL_NAME(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(GENERAL_NAME, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_GENERAL_NAME(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(GENERAL_NAME, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_GENERAL_NAME(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(GENERAL_NAME, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_GENERAL_NAME(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(GENERAL_NAME, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_OCSP_ONEREQ(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(OCSP_ONEREQ, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_OCSP_ONEREQ(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(OCSP_ONEREQ, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_OCSP_ONEREQ(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(OCSP_ONEREQ, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_OCSP_ONEREQ(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(OCSP_ONEREQ, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_OCSP_SINGLERESP(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(OCSP_SINGLERESP, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_OCSP_SINGLERESP(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(OCSP_SINGLERESP, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_OCSP_SINGLERESP(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(OCSP_SINGLERESP, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_OCSP_SINGLERESP(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(OCSP_SINGLERESP, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_PKCS12_SAFEBAG(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(PKCS12_SAFEBAG, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_PKCS12_SAFEBAG(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(PKCS12_SAFEBAG, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_PKCS12_SAFEBAG(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(PKCS12_SAFEBAG, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_PKCS12_SAFEBAG(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(PKCS12_SAFEBAG, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_PKCS7(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(PKCS7, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_PKCS7(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(PKCS7, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_PKCS7(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(PKCS7, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_PKCS7(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(PKCS7, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_PKCS7_RECIP_INFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(PKCS7_RECIP_INFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_PKCS7_RECIP_INFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(PKCS7_RECIP_INFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_PKCS7_RECIP_INFO(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(PKCS7_RECIP_INFO, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_PKCS7_RECIP_INFO(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(PKCS7_RECIP_INFO, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(PKCS7_SIGNER_INFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(PKCS7_SIGNER_INFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_PKCS7_SIGNER_INFO(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(PKCS7_SIGNER_INFO, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_PKCS7_SIGNER_INFO(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(PKCS7_SIGNER_INFO, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_POLICYINFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(POLICYINFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_POLICYINFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(POLICYINFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_POLICYINFO(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(POLICYINFO, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_POLICYINFO(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(POLICYINFO, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_POLICYQUALINFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(POLICYQUALINFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_POLICYQUALINFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(POLICYQUALINFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_POLICYQUALINFO(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(POLICYQUALINFO, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_POLICYQUALINFO(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(POLICYQUALINFO, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_SXNETID(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(SXNETID, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_SXNETID(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(SXNETID, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_SXNETID(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(SXNETID, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_SXNETID(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(SXNETID, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_X509(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(X509, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_X509(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(X509, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_X509(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(X509, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_X509(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(X509, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_X509_ALGOR(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(X509_ALGOR, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_X509_ALGOR(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(X509_ALGOR, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_X509_ALGOR(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(X509_ALGOR, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_X509_ALGOR(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(X509_ALGOR, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_X509_ATTRIBUTE(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(X509_ATTRIBUTE, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_X509_ATTRIBUTE(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(X509_ATTRIBUTE, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_X509_ATTRIBUTE(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(X509_ATTRIBUTE, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_X509_ATTRIBUTE(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(X509_ATTRIBUTE, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_X509_CRL(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(X509_CRL, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_X509_CRL(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(X509_CRL, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_X509_CRL(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(X509_CRL, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_X509_CRL(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(X509_CRL, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_X509_EXTENSION(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(X509_EXTENSION, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_X509_EXTENSION(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(X509_EXTENSION, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_X509_EXTENSION(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(X509_EXTENSION, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_X509_EXTENSION(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(X509_EXTENSION, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_X509_NAME_ENTRY(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(X509_NAME_ENTRY, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_X509_NAME_ENTRY(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(X509_NAME_ENTRY, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_X509_NAME_ENTRY(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(X509_NAME_ENTRY, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_X509_NAME_ENTRY(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(X509_NAME_ENTRY, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_X509_REVOKED(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(X509_REVOKED, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_X509_REVOKED(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(X509_REVOKED, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_X509_REVOKED(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(X509_REVOKED, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_X509_REVOKED(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(X509_REVOKED, (buf), (len), (d2i_func), (free_func)) + +#define PKCS12_decrypt_d2i_PKCS12_SAFEBAG(algor, d2i_func, free_func, pass, passlen, oct, seq) \ + SKM_PKCS12_decrypt_d2i(PKCS12_SAFEBAG, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq)) + +#define PKCS12_decrypt_d2i_PKCS7(algor, d2i_func, free_func, pass, passlen, oct, seq) \ + SKM_PKCS12_decrypt_d2i(PKCS7, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq)) +/* End of util/mkstack.pl block, you may now edit :-) */ + +#endif /* !defined HEADER_SAFESTACK_H */ diff --git a/h/openssl/sha.h b/h/openssl/sha.h new file mode 100644 index 0000000..2845ab5 --- /dev/null +++ b/h/openssl/sha.h @@ -0,0 +1,4 @@ +/* Empty file for backward compatibiliy only. + * To use cryptographic primatives, please use EVP API or CCI API. + */ +#include diff --git a/h/openssl/ssl.h b/h/openssl/ssl.h new file mode 100644 index 0000000..ab4626b --- /dev/null +++ b/h/openssl/ssl.h @@ -0,0 +1,1961 @@ +/* ssl/ssl.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +/* ==================================================================== + * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * ECC cipher suite support in OpenSSL originally developed by + * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. + */ + +#ifndef HEADER_SSL_H +#define HEADER_SSL_H + +#include + +#ifndef OPENSSL_NO_COMP +#include +#endif +#ifndef OPENSSL_NO_BIO +#include +#endif +#ifndef OPENSSL_NO_DEPRECATED +#ifndef OPENSSL_NO_X509 +#include +#endif +#include +#include +#include +#endif +#include + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* SSLeay version number for ASN.1 encoding of the session information */ +/* Version 0 - initial version + * Version 1 - added the optional peer certificate + */ +#define SSL_SESSION_ASN1_VERSION 0x0001 + +/* text strings for the ciphers */ +#define SSL_TXT_NULL_WITH_MD5 SSL2_TXT_NULL_WITH_MD5 +#define SSL_TXT_RC4_128_WITH_MD5 SSL2_TXT_RC4_128_WITH_MD5 +#define SSL_TXT_RC4_128_EXPORT40_WITH_MD5 SSL2_TXT_RC4_128_EXPORT40_WITH_MD5 +#define SSL_TXT_RC2_128_CBC_WITH_MD5 SSL2_TXT_RC2_128_CBC_WITH_MD5 +#define SSL_TXT_RC2_128_CBC_EXPORT40_WITH_MD5 SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5 +#define SSL_TXT_IDEA_128_CBC_WITH_MD5 SSL2_TXT_IDEA_128_CBC_WITH_MD5 +#define SSL_TXT_DES_64_CBC_WITH_MD5 SSL2_TXT_DES_64_CBC_WITH_MD5 +#define SSL_TXT_DES_64_CBC_WITH_SHA SSL2_TXT_DES_64_CBC_WITH_SHA +#define SSL_TXT_DES_192_EDE3_CBC_WITH_MD5 SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5 +#define SSL_TXT_DES_192_EDE3_CBC_WITH_SHA SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA + +/* VRS Additional Kerberos5 entries + */ +#define SSL_TXT_KRB5_DES_64_CBC_SHA SSL3_TXT_KRB5_DES_64_CBC_SHA +#define SSL_TXT_KRB5_DES_192_CBC3_SHA SSL3_TXT_KRB5_DES_192_CBC3_SHA +#define SSL_TXT_KRB5_RC4_128_SHA SSL3_TXT_KRB5_RC4_128_SHA +#define SSL_TXT_KRB5_IDEA_128_CBC_SHA SSL3_TXT_KRB5_IDEA_128_CBC_SHA +#define SSL_TXT_KRB5_DES_64_CBC_MD5 SSL3_TXT_KRB5_DES_64_CBC_MD5 +#define SSL_TXT_KRB5_DES_192_CBC3_MD5 SSL3_TXT_KRB5_DES_192_CBC3_MD5 +#define SSL_TXT_KRB5_RC4_128_MD5 SSL3_TXT_KRB5_RC4_128_MD5 +#define SSL_TXT_KRB5_IDEA_128_CBC_MD5 SSL3_TXT_KRB5_IDEA_128_CBC_MD5 + +#define SSL_TXT_KRB5_DES_40_CBC_SHA SSL3_TXT_KRB5_DES_40_CBC_SHA +#define SSL_TXT_KRB5_RC2_40_CBC_SHA SSL3_TXT_KRB5_RC2_40_CBC_SHA +#define SSL_TXT_KRB5_RC4_40_SHA SSL3_TXT_KRB5_RC4_40_SHA +#define SSL_TXT_KRB5_DES_40_CBC_MD5 SSL3_TXT_KRB5_DES_40_CBC_MD5 +#define SSL_TXT_KRB5_RC2_40_CBC_MD5 SSL3_TXT_KRB5_RC2_40_CBC_MD5 +#define SSL_TXT_KRB5_RC4_40_MD5 SSL3_TXT_KRB5_RC4_40_MD5 + +#define SSL_TXT_KRB5_DES_40_CBC_SHA SSL3_TXT_KRB5_DES_40_CBC_SHA +#define SSL_TXT_KRB5_DES_40_CBC_MD5 SSL3_TXT_KRB5_DES_40_CBC_MD5 +#define SSL_TXT_KRB5_DES_64_CBC_SHA SSL3_TXT_KRB5_DES_64_CBC_SHA +#define SSL_TXT_KRB5_DES_64_CBC_MD5 SSL3_TXT_KRB5_DES_64_CBC_MD5 +#define SSL_TXT_KRB5_DES_192_CBC3_SHA SSL3_TXT_KRB5_DES_192_CBC3_SHA +#define SSL_TXT_KRB5_DES_192_CBC3_MD5 SSL3_TXT_KRB5_DES_192_CBC3_MD5 +#define SSL_MAX_KRB5_PRINCIPAL_LENGTH 256 + +#define SSL_MAX_SSL_SESSION_ID_LENGTH 32 +#define SSL_MAX_SID_CTX_LENGTH 32 + +#define SSL_MIN_RSA_MODULUS_LENGTH_IN_BYTES (512/8) +#define SSL_MAX_KEY_ARG_LENGTH 8 +#define SSL_MAX_MASTER_KEY_LENGTH 48 + +/* These are used to specify which ciphers to use and not to use */ +#define SSL_TXT_LOW "LOW" +#define SSL_TXT_MEDIUM "MEDIUM" +#define SSL_TXT_HIGH "HIGH" +#define SSL_TXT_kFZA "kFZA" +#define SSL_TXT_aFZA "aFZA" +#define SSL_TXT_eFZA "eFZA" +#define SSL_TXT_FZA "FZA" + +#define SSL_TXT_aNULL "aNULL" +#define SSL_TXT_eNULL "eNULL" +#define SSL_TXT_NULL "NULL" + +#define SSL_TXT_kKRB5 "kKRB5" +#define SSL_TXT_aKRB5 "aKRB5" +#define SSL_TXT_KRB5 "KRB5" + +#define SSL_TXT_kRSA "kRSA" +#define SSL_TXT_kDHr "kDHr" +#define SSL_TXT_kDHd "kDHd" +#define SSL_TXT_kEDH "kEDH" +#define SSL_TXT_aRSA "aRSA" +#define SSL_TXT_aDSS "aDSS" +#define SSL_TXT_aDH "aDH" +#define SSL_TXT_DSS "DSS" +#define SSL_TXT_DH "DH" +#define SSL_TXT_EDH "EDH" +#define SSL_TXT_ADH "ADH" +#define SSL_TXT_RSA "RSA" +#define SSL_TXT_DES "DES" +#define SSL_TXT_3DES "3DES" +#define SSL_TXT_RC4 "RC4" +#define SSL_TXT_RC2 "RC2" +#define SSL_TXT_IDEA "IDEA" +#define SSL_TXT_AES "AES" +#define SSL_TXT_MD5 "MD5" +#define SSL_TXT_SHA1 "SHA1" +#define SSL_TXT_SHA "SHA" +#define SSL_TXT_EXP "EXP" +#define SSL_TXT_EXPORT "EXPORT" +#define SSL_TXT_EXP40 "EXPORT40" +#define SSL_TXT_EXP56 "EXPORT56" +#define SSL_TXT_SSLV2 "SSLv2" +#define SSL_TXT_SSLV3 "SSLv3" +#define SSL_TXT_TLSV1 "TLSv1" +#define SSL_TXT_ALL "ALL" +#define SSL_TXT_ECC "ECCdraft" /* ECC ciphersuites are not yet official */ + +/* + * COMPLEMENTOF* definitions. These identifiers are used to (de-select) + * ciphers normally not being used. + * Example: "RC4" will activate all ciphers using RC4 including ciphers + * without authentication, which would normally disabled by DEFAULT (due + * the "!ADH" being part of default). Therefore "RC4:!COMPLEMENTOFDEFAULT" + * will make sure that it is also disabled in the specific selection. + * COMPLEMENTOF* identifiers are portable between version, as adjustments + * to the default cipher setup will also be included here. + * + * COMPLEMENTOFDEFAULT does not experience the same special treatment that + * DEFAULT gets, as only selection is being done and no sorting as needed + * for DEFAULT. + */ +#define SSL_TXT_CMPALL "COMPLEMENTOFALL" +#define SSL_TXT_CMPDEF "COMPLEMENTOFDEFAULT" + +/* The following cipher list is used by default. + * It also is substituted when an application-defined cipher list string + * starts with 'DEFAULT'. */ +#define SSL_DEFAULT_CIPHER_LIST "ALL:!ADH:+RC4:@STRENGTH" /* low priority for RC4 */ + +/* Used in SSL_set_shutdown()/SSL_get_shutdown(); */ +#define SSL_SENT_SHUTDOWN 1 +#define SSL_RECEIVED_SHUTDOWN 2 + +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if (defined(OPENSSL_NO_RSA) || defined(OPENSSL_NO_MD5)) && !defined(OPENSSL_NO_SSL2) +#define OPENSSL_NO_SSL2 +#endif + +#define SSL_FILETYPE_ASN1 X509_FILETYPE_ASN1 +#define SSL_FILETYPE_PEM X509_FILETYPE_PEM + +/* This is needed to stop compilers complaining about the + * 'struct ssl_st *' function parameters used to prototype callbacks + * in SSL_CTX. */ +typedef struct ssl_st *ssl_crock_st; + +/* used to hold info on the particular ciphers used */ +typedef struct ssl_cipher_st + { + int valid; + const char *name; /* text name */ + unsigned long id; /* id, 4 bytes, first is version */ + unsigned long algorithms; /* what ciphers are used */ + unsigned long algo_strength; /* strength and export flags */ + unsigned long algorithm2; /* Extra flags */ + int strength_bits; /* Number of bits really used */ + int alg_bits; /* Number of bits for algorithm */ + unsigned long mask; /* used for matching */ + unsigned long mask_strength; /* also used for matching */ + } SSL_CIPHER; + +DECLARE_STACK_OF(SSL_CIPHER) + +typedef struct ssl_st SSL; +typedef struct ssl_ctx_st SSL_CTX; + +/* Used to hold functions for SSLv2 or SSLv3/TLSv1 functions */ +typedef struct ssl_method_st + { + int version; + int (*ssl_new)(SSL *s); + void (*ssl_clear)(SSL *s); + void (*ssl_free)(SSL *s); + int (*ssl_accept)(SSL *s); + int (*ssl_connect)(SSL *s); + int (*ssl_read)(SSL *s,void *buf,int len); + int (*ssl_peek)(SSL *s,void *buf,int len); + int (*ssl_write)(SSL *s,const void *buf,int len); + int (*ssl_shutdown)(SSL *s); + int (*ssl_renegotiate)(SSL *s); + int (*ssl_renegotiate_check)(SSL *s); + long (*ssl_get_message)(SSL *s, int st1, int stn, int mt, long + max, int *ok); + int (*ssl_read_bytes)(SSL *s, int type, unsigned char *buf, int len, + int peek); + int (*ssl_write_bytes)(SSL *s, int type, const void *buf_, int len); + int (*ssl_dispatch_alert)(SSL *s); + long (*ssl_ctrl)(SSL *s,int cmd,long larg,void *parg); + long (*ssl_ctx_ctrl)(SSL_CTX *ctx,int cmd,long larg,void *parg); + SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr); + int (*put_cipher_by_char)(const SSL_CIPHER *cipher,unsigned char *ptr); + int (*ssl_pending)(const SSL *s); + int (*num_ciphers)(void); + SSL_CIPHER *(*get_cipher)(unsigned ncipher); + struct ssl_method_st *(*get_ssl_method)(int version); + long (*get_timeout)(void); + struct ssl3_enc_method *ssl3_enc; /* Extra SSLv3/TLS stuff */ + int (*ssl_version)(void); + long (*ssl_callback_ctrl)(SSL *s, int cb_id, void (*fp)(void)); + long (*ssl_ctx_callback_ctrl)(SSL_CTX *s, int cb_id, void (*fp)(void)); + } SSL_METHOD; + +/* Lets make this into an ASN.1 type structure as follows + * SSL_SESSION_ID ::= SEQUENCE { + * version INTEGER, -- structure version number + * SSLversion INTEGER, -- SSL version number + * Cipher OCTET_STRING, -- the 3 byte cipher ID + * Session_ID OCTET_STRING, -- the Session ID + * Master_key OCTET_STRING, -- the master key + * KRB5_principal OCTET_STRING -- optional Kerberos principal + * Key_Arg [ 0 ] IMPLICIT OCTET_STRING, -- the optional Key argument + * Time [ 1 ] EXPLICIT INTEGER, -- optional Start Time + * Timeout [ 2 ] EXPLICIT INTEGER, -- optional Timeout ins seconds + * Peer [ 3 ] EXPLICIT X509, -- optional Peer Certificate + * Session_ID_context [ 4 ] EXPLICIT OCTET_STRING, -- the Session ID context + * Verify_result [ 5 ] EXPLICIT INTEGER -- X509_V_... code for `Peer' + * Compression [6] IMPLICIT ASN1_OBJECT -- compression OID XXXXX + * } + * Look in ssl/ssl_asn1.c for more details + * I'm using EXPLICIT tags so I can read the damn things using asn1parse :-). + */ +typedef struct ssl_session_st + { + int ssl_version; /* what ssl version session info is + * being kept in here? */ + + /* only really used in SSLv2 */ + unsigned int key_arg_length; + unsigned char key_arg[SSL_MAX_KEY_ARG_LENGTH]; + int master_key_length; + unsigned char master_key[SSL_MAX_MASTER_KEY_LENGTH]; + /* session_id - valid? */ + unsigned int session_id_length; + unsigned char session_id[SSL_MAX_SSL_SESSION_ID_LENGTH]; + /* this is used to determine whether the session is being reused in + * the appropriate context. It is up to the application to set this, + * via SSL_new */ + unsigned int sid_ctx_length; + unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH]; + +#ifndef OPENSSL_NO_KRB5 + unsigned int krb5_client_princ_len; + unsigned char krb5_client_princ[SSL_MAX_KRB5_PRINCIPAL_LENGTH]; +#endif /* OPENSSL_NO_KRB5 */ + + int not_resumable; + + /* The cert is the certificate used to establish this connection */ + struct sess_cert_st /* SESS_CERT */ *sess_cert; + + /* This is the cert for the other end. + * On clients, it will be the same as sess_cert->peer_key->x509 + * (the latter is not enough as sess_cert is not retained + * in the external representation of sessions, see ssl_asn1.c). */ + X509 *peer; + /* when app_verify_callback accepts a session where the peer's certificate + * is not ok, we must remember the error for session reuse: */ + long verify_result; /* only for servers */ + + int references; + long timeout; + long time; + + int compress_meth; /* Need to lookup the method */ + + SSL_CIPHER *cipher; + unsigned long cipher_id; /* when ASN.1 loaded, this + * needs to be used to load + * the 'cipher' structure */ + + STACK_OF(SSL_CIPHER) *ciphers; /* shared ciphers? */ + + CRYPTO_EX_DATA ex_data; /* application specific data */ + + /* These are used to make removal of session-ids more + * efficient and to implement a maximum cache size. */ + struct ssl_session_st *prev,*next; + } SSL_SESSION; + + +#define SSL_OP_MICROSOFT_SESS_ID_BUG 0x00000001L +#define SSL_OP_NETSCAPE_CHALLENGE_BUG 0x00000002L +#define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG 0x00000008L +#define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 0x00000010L +#define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER 0x00000020L +#define SSL_OP_MSIE_SSLV2_RSA_PADDING 0x00000040L +#define SSL_OP_SSLEAY_080_CLIENT_DH_BUG 0x00000080L +#define SSL_OP_TLS_D5_BUG 0x00000100L +#define SSL_OP_TLS_BLOCK_PADDING_BUG 0x00000200L + +/* Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added + * in OpenSSL 0.9.6d. Usually (depending on the application protocol) + * the workaround is not needed. Unfortunately some broken SSL/TLS + * implementations cannot handle it at all, which is why we include + * it in SSL_OP_ALL. */ +#define SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS 0x00000800L /* added in 0.9.6e */ + +/* SSL_OP_ALL: various bug workarounds that should be rather harmless. + * This used to be 0x000FFFFFL before 0.9.7. */ +#define SSL_OP_ALL 0x00000FFFL + +/* DTLS options */ +#define SSL_OP_NO_QUERY_MTU 0x00001000L +/* Turn on Cookie Exchange (on relevant for servers) */ +#define SSL_OP_COOKIE_EXCHANGE 0x00002000L + +/* As server, disallow session resumption on renegotiation */ +#define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION 0x00010000L +/* If set, always create a new key when using tmp_ecdh parameters */ +#define SSL_OP_SINGLE_ECDH_USE 0x00080000L +/* If set, always create a new key when using tmp_dh parameters */ +#define SSL_OP_SINGLE_DH_USE 0x00100000L +/* Set to always use the tmp_rsa key when doing RSA operations, + * even when this violates protocol specs */ +#define SSL_OP_EPHEMERAL_RSA 0x00200000L +/* Set on servers to choose the cipher according to the server's + * preferences */ +#define SSL_OP_CIPHER_SERVER_PREFERENCE 0x00400000L +/* If set, a server will allow a client to issue a SSLv3.0 version number + * as latest version supported in the premaster secret, even when TLSv1.0 + * (version 3.1) was announced in the client hello. Normally this is + * forbidden to prevent version rollback attacks. */ +#define SSL_OP_TLS_ROLLBACK_BUG 0x00800000L + +#define SSL_OP_NO_SSLv2 0x01000000L +#define SSL_OP_NO_SSLv3 0x02000000L +#define SSL_OP_NO_TLSv1 0x04000000L + +/* The next flag deliberately changes the ciphertest, this is a check + * for the PKCS#1 attack */ +#define SSL_OP_PKCS1_CHECK_1 0x08000000L +#define SSL_OP_PKCS1_CHECK_2 0x10000000L +#define SSL_OP_NETSCAPE_CA_DN_BUG 0x20000000L +#define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG 0x40000000L + + +/* Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success + * when just a single record has been written): */ +#define SSL_MODE_ENABLE_PARTIAL_WRITE 0x00000001L +/* Make it possible to retry SSL_write() with changed buffer location + * (buffer contents must stay the same!); this is not the default to avoid + * the misconception that non-blocking SSL_write() behaves like + * non-blocking write(): */ +#define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER 0x00000002L +/* Never bother the application with retries if the transport + * is blocking: */ +#define SSL_MODE_AUTO_RETRY 0x00000004L +/* Don't attempt to automatically build certificate chain */ +#define SSL_MODE_NO_AUTO_CHAIN 0x00000008L + + +/* Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value, + * they cannot be used to clear bits. */ + +#define SSL_CTX_set_options(ctx,op) \ + SSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,(op),NULL) +#define SSL_CTX_get_options(ctx) \ + SSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,0,NULL) +#define SSL_set_options(ssl,op) \ + SSL_ctrl((ssl),SSL_CTRL_OPTIONS,(op),NULL) +#define SSL_get_options(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_OPTIONS,0,NULL) + +#define SSL_CTX_set_mode(ctx,op) \ + SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL) +#define SSL_CTX_get_mode(ctx) \ + SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,0,NULL) +#define SSL_set_mode(ssl,op) \ + SSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL) +#define SSL_get_mode(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_MODE,0,NULL) +#define SSL_set_mtu(ssl, mtu) \ + SSL_ctrl((ssl),SSL_CTRL_SET_MTU,(mtu),NULL) + + +void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); +void SSL_set_msg_callback(SSL *ssl, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); +#define SSL_CTX_set_msg_callback_arg(ctx, arg) SSL_CTX_ctrl((ctx), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) +#define SSL_set_msg_callback_arg(ssl, arg) SSL_ctrl((ssl), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) + + + +#if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32) +#define SSL_MAX_CERT_LIST_DEFAULT 1024*30 /* 30k max cert list :-) */ +#else +#define SSL_MAX_CERT_LIST_DEFAULT 1024*100 /* 100k max cert list :-) */ +#endif + +#define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT (1024*20) + +/* This callback type is used inside SSL_CTX, SSL, and in the functions that set + * them. It is used to override the generation of SSL/TLS session IDs in a + * server. Return value should be zero on an error, non-zero to proceed. Also, + * callbacks should themselves check if the id they generate is unique otherwise + * the SSL handshake will fail with an error - callbacks can do this using the + * 'ssl' value they're passed by; + * SSL_has_matching_session_id(ssl, id, *id_len) + * The length value passed in is set at the maximum size the session ID can be. + * In SSLv2 this is 16 bytes, whereas SSLv3/TLSv1 it is 32 bytes. The callback + * can alter this length to be less if desired, but under SSLv2 session IDs are + * supposed to be fixed at 16 bytes so the id will be padded after the callback + * returns in this case. It is also an error for the callback to set the size to + * zero. */ +typedef int (*GEN_SESSION_CB)(const SSL *ssl, unsigned char *id, + unsigned int *id_len); + +typedef struct ssl_comp_st + { + int id; + const char *name; +#ifndef OPENSSL_NO_COMP + COMP_METHOD *method; +#else + char *method; +#endif + } SSL_COMP; + +DECLARE_STACK_OF(SSL_COMP) + +struct ssl_ctx_st + { + SSL_METHOD *method; + + STACK_OF(SSL_CIPHER) *cipher_list; + /* same as above but sorted for lookup */ + STACK_OF(SSL_CIPHER) *cipher_list_by_id; + + struct x509_store_st /* X509_STORE */ *cert_store; + struct lhash_st /* LHASH */ *sessions; /* a set of SSL_SESSIONs */ + /* Most session-ids that will be cached, default is + * SSL_SESSION_CACHE_MAX_SIZE_DEFAULT. 0 is unlimited. */ + unsigned long session_cache_size; + struct ssl_session_st *session_cache_head; + struct ssl_session_st *session_cache_tail; + + /* This can have one of 2 values, ored together, + * SSL_SESS_CACHE_CLIENT, + * SSL_SESS_CACHE_SERVER, + * Default is SSL_SESSION_CACHE_SERVER, which means only + * SSL_accept which cache SSL_SESSIONS. */ + int session_cache_mode; + + /* If timeout is not 0, it is the default timeout value set + * when SSL_new() is called. This has been put in to make + * life easier to set things up */ + long session_timeout; + + /* If this callback is not null, it will be called each + * time a session id is added to the cache. If this function + * returns 1, it means that the callback will do a + * SSL_SESSION_free() when it has finished using it. Otherwise, + * on 0, it means the callback has finished with it. + * If remove_session_cb is not null, it will be called when + * a session-id is removed from the cache. After the call, + * OpenSSL will SSL_SESSION_free() it. */ + int (*new_session_cb)(struct ssl_st *ssl,SSL_SESSION *sess); + void (*remove_session_cb)(struct ssl_ctx_st *ctx,SSL_SESSION *sess); + SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl, + unsigned char *data,int len,int *copy); + + struct + { + int sess_connect; /* SSL new conn - started */ + int sess_connect_renegotiate;/* SSL reneg - requested */ + int sess_connect_good; /* SSL new conne/reneg - finished */ + int sess_accept; /* SSL new accept - started */ + int sess_accept_renegotiate;/* SSL reneg - requested */ + int sess_accept_good; /* SSL accept/reneg - finished */ + int sess_miss; /* session lookup misses */ + int sess_timeout; /* reuse attempt on timeouted session */ + int sess_cache_full; /* session removed due to full cache */ + int sess_hit; /* session reuse actually done */ + int sess_cb_hit; /* session-id that was not + * in the cache was + * passed back via the callback. This + * indicates that the application is + * supplying session-id's from other + * processes - spooky :-) */ + } stats; + + int references; + + /* if defined, these override the X509_verify_cert() calls */ + int (*app_verify_callback)(X509_STORE_CTX *, void *); + void *app_verify_arg; + /* before OpenSSL 0.9.7, 'app_verify_arg' was ignored + * ('app_verify_callback' was called with just one argument) */ + + /* Default password callback. */ + pem_password_cb *default_passwd_callback; + + /* Default password callback user data. */ + void *default_passwd_callback_userdata; + + /* get client cert callback */ + int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey); + + /* cookie generate callback */ + int (*app_gen_cookie_cb)(SSL *ssl, unsigned char *cookie, + unsigned int *cookie_len); + + /* verify cookie callback */ + int (*app_verify_cookie_cb)(SSL *ssl, unsigned char *cookie, + unsigned int cookie_len); + + CRYPTO_EX_DATA ex_data; + + const EVP_MD *rsa_md5;/* For SSLv2 - name is 'ssl2-md5' */ + const EVP_MD *md5; /* For SSLv3/TLSv1 'ssl3-md5' */ + const EVP_MD *sha1; /* For SSLv3/TLSv1 'ssl3->sha1' */ + + STACK_OF(X509) *extra_certs; + STACK_OF(SSL_COMP) *comp_methods; /* stack of SSL_COMP, SSLv3/TLSv1 */ + + + /* Default values used when no per-SSL value is defined follow */ + + void (*info_callback)(const SSL *ssl,int type,int val); /* used if SSL's info_callback is NULL */ + + /* what we put in client cert requests */ + STACK_OF(X509_NAME) *client_CA; + + + /* Default values to use in SSL structures follow (these are copied by SSL_new) */ + + unsigned long options; + unsigned long mode; + long max_cert_list; + + struct cert_st /* CERT */ *cert; + int read_ahead; + + /* callback that allows applications to peek at protocol messages */ + void (*msg_callback)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg); + void *msg_callback_arg; + + int verify_mode; + unsigned int sid_ctx_length; + unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH]; + int (*default_verify_callback)(int ok,X509_STORE_CTX *ctx); /* called 'verify_callback' in the SSL */ + + /* Default generate session ID callback. */ + GEN_SESSION_CB generate_session_id; + + X509_VERIFY_PARAM *param; + +#if 0 + int purpose; /* Purpose setting */ + int trust; /* Trust setting */ +#endif + + int quiet_shutdown; + }; + +#define SSL_SESS_CACHE_OFF 0x0000 +#define SSL_SESS_CACHE_CLIENT 0x0001 +#define SSL_SESS_CACHE_SERVER 0x0002 +#define SSL_SESS_CACHE_BOTH (SSL_SESS_CACHE_CLIENT|SSL_SESS_CACHE_SERVER) +#define SSL_SESS_CACHE_NO_AUTO_CLEAR 0x0080 +/* enough comments already ... see SSL_CTX_set_session_cache_mode(3) */ +#define SSL_SESS_CACHE_NO_INTERNAL_LOOKUP 0x0100 +#define SSL_SESS_CACHE_NO_INTERNAL_STORE 0x0200 +#define SSL_SESS_CACHE_NO_INTERNAL \ + (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP|SSL_SESS_CACHE_NO_INTERNAL_STORE) + + struct lhash_st *SSL_CTX_sessions(SSL_CTX *ctx); +#define SSL_CTX_sess_number(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_NUMBER,0,NULL) +#define SSL_CTX_sess_connect(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT,0,NULL) +#define SSL_CTX_sess_connect_good(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_GOOD,0,NULL) +#define SSL_CTX_sess_connect_renegotiate(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_RENEGOTIATE,0,NULL) +#define SSL_CTX_sess_accept(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT,0,NULL) +#define SSL_CTX_sess_accept_renegotiate(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_RENEGOTIATE,0,NULL) +#define SSL_CTX_sess_accept_good(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_GOOD,0,NULL) +#define SSL_CTX_sess_hits(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_HIT,0,NULL) +#define SSL_CTX_sess_cb_hits(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CB_HIT,0,NULL) +#define SSL_CTX_sess_misses(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_MISSES,0,NULL) +#define SSL_CTX_sess_timeouts(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_TIMEOUTS,0,NULL) +#define SSL_CTX_sess_cache_full(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CACHE_FULL,0,NULL) + +#define SSL_CTX_sess_set_new_cb(ctx,cb) ((ctx)->new_session_cb=(cb)) +#define SSL_CTX_sess_get_new_cb(ctx) ((ctx)->new_session_cb) +#define SSL_CTX_sess_set_remove_cb(ctx,cb) ((ctx)->remove_session_cb=(cb)) +#define SSL_CTX_sess_get_remove_cb(ctx) ((ctx)->remove_session_cb) +#define SSL_CTX_sess_set_get_cb(ctx,cb) ((ctx)->get_session_cb=(cb)) +#define SSL_CTX_sess_get_get_cb(ctx) ((ctx)->get_session_cb) +#define SSL_CTX_set_info_callback(ctx,cb) ((ctx)->info_callback=(cb)) +#define SSL_CTX_get_info_callback(ctx) ((ctx)->info_callback) +#define SSL_CTX_set_client_cert_cb(ctx,cb) ((ctx)->client_cert_cb=(cb)) +#define SSL_CTX_get_client_cert_cb(ctx) ((ctx)->client_cert_cb) +#define SSL_CTX_set_cookie_generate_cb(ctx,cb) ((ctx)->app_gen_cookie_cb=(cb)) +#define SSL_CTX_set_cookie_verify_cb(ctx,cb) ((ctx)->app_verify_cookie_cb=(cb)) + +#define SSL_NOTHING 1 +#define SSL_WRITING 2 +#define SSL_READING 3 +#define SSL_X509_LOOKUP 4 + +/* These will only be used when doing non-blocking IO */ +#define SSL_want_nothing(s) (SSL_want(s) == SSL_NOTHING) +#define SSL_want_read(s) (SSL_want(s) == SSL_READING) +#define SSL_want_write(s) (SSL_want(s) == SSL_WRITING) +#define SSL_want_x509_lookup(s) (SSL_want(s) == SSL_X509_LOOKUP) + +struct ssl_st + { + /* protocol version + * (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION, DTLS1_VERSION) + */ + int version; + int type; /* SSL_ST_CONNECT or SSL_ST_ACCEPT */ + + SSL_METHOD *method; /* SSLv3 */ + + /* There are 2 BIO's even though they are normally both the + * same. This is so data can be read and written to different + * handlers */ + +#ifndef OPENSSL_NO_BIO + BIO *rbio; /* used by SSL_read */ + BIO *wbio; /* used by SSL_write */ + BIO *bbio; /* used during session-id reuse to concatenate + * messages */ +#else + char *rbio; /* used by SSL_read */ + char *wbio; /* used by SSL_write */ + char *bbio; +#endif + /* This holds a variable that indicates what we were doing + * when a 0 or -1 is returned. This is needed for + * non-blocking IO so we know what request needs re-doing when + * in SSL_accept or SSL_connect */ + int rwstate; + + /* true when we are actually in SSL_accept() or SSL_connect() */ + int in_handshake; + int (*handshake_func)(SSL *); + + /* Imagine that here's a boolean member "init" that is + * switched as soon as SSL_set_{accept/connect}_state + * is called for the first time, so that "state" and + * "handshake_func" are properly initialized. But as + * handshake_func is == 0 until then, we use this + * test instead of an "init" member. + */ + + int server; /* are we the server side? - mostly used by SSL_clear*/ + + int new_session;/* 1 if we are to use a new session. + * 2 if we are a server and are inside a handshake + * (i.e. not just sending a HelloRequest) + * NB: For servers, the 'new' session may actually be a previously + * cached session or even the previous session unless + * SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION is set */ + int quiet_shutdown;/* don't send shutdown packets */ + int shutdown; /* we have shut things down, 0x01 sent, 0x02 + * for received */ + int state; /* where we are */ + int rstate; /* where we are when reading */ + + BUF_MEM *init_buf; /* buffer used during init */ + void *init_msg; /* pointer to handshake message body, set by ssl3_get_message() */ + int init_num; /* amount read/written */ + int init_off; /* amount read/written */ + + /* used internally to point at a raw packet */ + unsigned char *packet; + unsigned int packet_length; + + struct ssl2_state_st *s2; /* SSLv2 variables */ + struct ssl3_state_st *s3; /* SSLv3 variables */ + struct dtls1_state_st *d1; /* DTLSv1 variables */ + + int read_ahead; /* Read as many input bytes as possible + * (for non-blocking reads) */ + + /* callback that allows applications to peek at protocol messages */ + void (*msg_callback)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg); + void *msg_callback_arg; + + int hit; /* reusing a previous session */ + + X509_VERIFY_PARAM *param; + +#if 0 + int purpose; /* Purpose setting */ + int trust; /* Trust setting */ +#endif + + /* crypto */ + STACK_OF(SSL_CIPHER) *cipher_list; + STACK_OF(SSL_CIPHER) *cipher_list_by_id; + + /* These are the ones being used, the ones in SSL_SESSION are + * the ones to be 'copied' into these ones */ + + EVP_CIPHER_CTX *enc_read_ctx; /* cryptographic state */ + const EVP_MD *read_hash; /* used for mac generation */ +#ifndef OPENSSL_NO_COMP + COMP_CTX *expand; /* uncompress */ +#else + char *expand; +#endif + + EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */ + const EVP_MD *write_hash; /* used for mac generation */ +#ifndef OPENSSL_NO_COMP + COMP_CTX *compress; /* compression */ +#else + char *compress; +#endif + + /* session info */ + + /* client cert? */ + /* This is used to hold the server certificate used */ + struct cert_st /* CERT */ *cert; + + /* the session_id_context is used to ensure sessions are only reused + * in the appropriate context */ + unsigned int sid_ctx_length; + unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH]; + + /* This can also be in the session once a session is established */ + SSL_SESSION *session; + + /* Default generate session ID callback. */ + GEN_SESSION_CB generate_session_id; + + /* Used in SSL2 and SSL3 */ + int verify_mode; /* 0 don't care about verify failure. + * 1 fail if verify fails */ + int (*verify_callback)(int ok,X509_STORE_CTX *ctx); /* fail if callback returns 0 */ + + void (*info_callback)(const SSL *ssl,int type,int val); /* optional informational callback */ + + int error; /* error bytes to be written */ + int error_code; /* actual code */ + +#ifndef OPENSSL_NO_KRB5 + KSSL_CTX *kssl_ctx; /* Kerberos 5 context */ +#endif /* OPENSSL_NO_KRB5 */ + + SSL_CTX *ctx; + /* set this flag to 1 and a sleep(1) is put into all SSL_read() + * and SSL_write() calls, good for nbio debuging :-) */ + int debug; + + /* extra application data */ + long verify_result; + CRYPTO_EX_DATA ex_data; + + /* for server side, keep the list of CA_dn we can use */ + STACK_OF(X509_NAME) *client_CA; + + int references; + unsigned long options; /* protocol behaviour */ + unsigned long mode; /* API behaviour */ + long max_cert_list; + int first_packet; + int client_version; /* what was passed, used for + * SSLv3/TLS rollback check */ + }; + +#ifdef __cplusplus +} +#endif + +#include +#include +#include /* This is mostly sslv3 with a few tweaks */ +#include /* Datagram TLS */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* compatibility */ +#define SSL_set_app_data(s,arg) (SSL_set_ex_data(s,0,(char *)arg)) +#define SSL_get_app_data(s) (SSL_get_ex_data(s,0)) +#define SSL_SESSION_set_app_data(s,a) (SSL_SESSION_set_ex_data(s,0,(char *)a)) +#define SSL_SESSION_get_app_data(s) (SSL_SESSION_get_ex_data(s,0)) +#define SSL_CTX_get_app_data(ctx) (SSL_CTX_get_ex_data(ctx,0)) +#define SSL_CTX_set_app_data(ctx,arg) (SSL_CTX_set_ex_data(ctx,0,(char *)arg)) + +/* The following are the possible values for ssl->state are are + * used to indicate where we are up to in the SSL connection establishment. + * The macros that follow are about the only things you should need to use + * and even then, only when using non-blocking IO. + * It can also be useful to work out where you were when the connection + * failed */ + +#define SSL_ST_CONNECT 0x1000 +#define SSL_ST_ACCEPT 0x2000 +#define SSL_ST_MASK 0x0FFF +#define SSL_ST_INIT (SSL_ST_CONNECT|SSL_ST_ACCEPT) +#define SSL_ST_BEFORE 0x4000 +#define SSL_ST_OK 0x03 +#define SSL_ST_RENEGOTIATE (0x04|SSL_ST_INIT) + +#define SSL_CB_LOOP 0x01 +#define SSL_CB_EXIT 0x02 +#define SSL_CB_READ 0x04 +#define SSL_CB_WRITE 0x08 +#define SSL_CB_ALERT 0x4000 /* used in callback */ +#define SSL_CB_READ_ALERT (SSL_CB_ALERT|SSL_CB_READ) +#define SSL_CB_WRITE_ALERT (SSL_CB_ALERT|SSL_CB_WRITE) +#define SSL_CB_ACCEPT_LOOP (SSL_ST_ACCEPT|SSL_CB_LOOP) +#define SSL_CB_ACCEPT_EXIT (SSL_ST_ACCEPT|SSL_CB_EXIT) +#define SSL_CB_CONNECT_LOOP (SSL_ST_CONNECT|SSL_CB_LOOP) +#define SSL_CB_CONNECT_EXIT (SSL_ST_CONNECT|SSL_CB_EXIT) +#define SSL_CB_HANDSHAKE_START 0x10 +#define SSL_CB_HANDSHAKE_DONE 0x20 + +/* Is the SSL_connection established? */ +#define SSL_get_state(a) SSL_state(a) +#define SSL_is_init_finished(a) (SSL_state(a) == SSL_ST_OK) +#define SSL_in_init(a) (SSL_state(a)&SSL_ST_INIT) +#define SSL_in_before(a) (SSL_state(a)&SSL_ST_BEFORE) +#define SSL_in_connect_init(a) (SSL_state(a)&SSL_ST_CONNECT) +#define SSL_in_accept_init(a) (SSL_state(a)&SSL_ST_ACCEPT) + +/* The following 2 states are kept in ssl->rstate when reads fail, + * you should not need these */ +#define SSL_ST_READ_HEADER 0xF0 +#define SSL_ST_READ_BODY 0xF1 +#define SSL_ST_READ_DONE 0xF2 + +/* Obtain latest Finished message + * -- that we sent (SSL_get_finished) + * -- that we expected from peer (SSL_get_peer_finished). + * Returns length (0 == no Finished so far), copies up to 'count' bytes. */ +size_t SSL_get_finished(const SSL *s, void *buf, size_t count); +size_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count); + +/* use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 2 options + * are 'ored' with SSL_VERIFY_PEER if they are desired */ +#define SSL_VERIFY_NONE 0x00 +#define SSL_VERIFY_PEER 0x01 +#define SSL_VERIFY_FAIL_IF_NO_PEER_CERT 0x02 +#define SSL_VERIFY_CLIENT_ONCE 0x04 + +#define OpenSSL_add_ssl_algorithms() SSL_library_init() +#define SSLeay_add_ssl_algorithms() SSL_library_init() + +/* this is for backward compatibility */ +#if 0 /* NEW_SSLEAY */ +#define SSL_CTX_set_default_verify(a,b,c) SSL_CTX_set_verify(a,b,c) +#define SSL_set_pref_cipher(c,n) SSL_set_cipher_list(c,n) +#define SSL_add_session(a,b) SSL_CTX_add_session((a),(b)) +#define SSL_remove_session(a,b) SSL_CTX_remove_session((a),(b)) +#define SSL_flush_sessions(a,b) SSL_CTX_flush_sessions((a),(b)) +#endif +/* More backward compatibility */ +#define SSL_get_cipher(s) \ + SSL_CIPHER_get_name(SSL_get_current_cipher(s)) +#define SSL_get_cipher_bits(s,np) \ + SSL_CIPHER_get_bits(SSL_get_current_cipher(s),np) +#define SSL_get_cipher_version(s) \ + SSL_CIPHER_get_version(SSL_get_current_cipher(s)) +#define SSL_get_cipher_name(s) \ + SSL_CIPHER_get_name(SSL_get_current_cipher(s)) +#define SSL_get_time(a) SSL_SESSION_get_time(a) +#define SSL_set_time(a,b) SSL_SESSION_set_time((a),(b)) +#define SSL_get_timeout(a) SSL_SESSION_get_timeout(a) +#define SSL_set_timeout(a,b) SSL_SESSION_set_timeout((a),(b)) + +#if 1 /*SSLEAY_MACROS*/ +#define d2i_SSL_SESSION_bio(bp,s_id) ASN1_d2i_bio_of(SSL_SESSION,SSL_SESSION_new,d2i_SSL_SESSION,bp,s_id) +#define i2d_SSL_SESSION_bio(bp,s_id) ASN1_i2d_bio_of(SSL_SESSION,i2d_SSL_SESSION,bp,s_id) +#define PEM_read_SSL_SESSION(fp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read( \ + (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,fp,(char **)x,cb,u) +#define PEM_read_bio_SSL_SESSION(bp,x,cb,u) PEM_ASN1_read_bio_of(SSL_SESSION,d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,x,cb,u) +#define PEM_write_SSL_SESSION(fp,x) \ + PEM_ASN1_write((int (*)())i2d_SSL_SESSION, \ + PEM_STRING_SSL_SESSION,fp, (char *)x, NULL,NULL,0,NULL,NULL) +#define PEM_write_bio_SSL_SESSION(bp,x) \ + PEM_ASN1_write_bio_of(SSL_SESSION,i2d_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,x,NULL,NULL,0,NULL,NULL) +#endif + +#define SSL_AD_REASON_OFFSET 1000 +/* These alert types are for SSLv3 and TLSv1 */ +#define SSL_AD_CLOSE_NOTIFY SSL3_AD_CLOSE_NOTIFY +#define SSL_AD_UNEXPECTED_MESSAGE SSL3_AD_UNEXPECTED_MESSAGE /* fatal */ +#define SSL_AD_BAD_RECORD_MAC SSL3_AD_BAD_RECORD_MAC /* fatal */ +#define SSL_AD_DECRYPTION_FAILED TLS1_AD_DECRYPTION_FAILED +#define SSL_AD_RECORD_OVERFLOW TLS1_AD_RECORD_OVERFLOW +#define SSL_AD_DECOMPRESSION_FAILURE SSL3_AD_DECOMPRESSION_FAILURE/* fatal */ +#define SSL_AD_HANDSHAKE_FAILURE SSL3_AD_HANDSHAKE_FAILURE/* fatal */ +#define SSL_AD_NO_CERTIFICATE SSL3_AD_NO_CERTIFICATE /* Not for TLS */ +#define SSL_AD_BAD_CERTIFICATE SSL3_AD_BAD_CERTIFICATE +#define SSL_AD_UNSUPPORTED_CERTIFICATE SSL3_AD_UNSUPPORTED_CERTIFICATE +#define SSL_AD_CERTIFICATE_REVOKED SSL3_AD_CERTIFICATE_REVOKED +#define SSL_AD_CERTIFICATE_EXPIRED SSL3_AD_CERTIFICATE_EXPIRED +#define SSL_AD_CERTIFICATE_UNKNOWN SSL3_AD_CERTIFICATE_UNKNOWN +#define SSL_AD_ILLEGAL_PARAMETER SSL3_AD_ILLEGAL_PARAMETER /* fatal */ +#define SSL_AD_UNKNOWN_CA TLS1_AD_UNKNOWN_CA /* fatal */ +#define SSL_AD_ACCESS_DENIED TLS1_AD_ACCESS_DENIED /* fatal */ +#define SSL_AD_DECODE_ERROR TLS1_AD_DECODE_ERROR /* fatal */ +#define SSL_AD_DECRYPT_ERROR TLS1_AD_DECRYPT_ERROR +#define SSL_AD_EXPORT_RESTRICTION TLS1_AD_EXPORT_RESTRICTION/* fatal */ +#define SSL_AD_PROTOCOL_VERSION TLS1_AD_PROTOCOL_VERSION /* fatal */ +#define SSL_AD_INSUFFICIENT_SECURITY TLS1_AD_INSUFFICIENT_SECURITY/* fatal */ +#define SSL_AD_INTERNAL_ERROR TLS1_AD_INTERNAL_ERROR /* fatal */ +#define SSL_AD_USER_CANCELLED TLS1_AD_USER_CANCELLED +#define SSL_AD_NO_RENEGOTIATION TLS1_AD_NO_RENEGOTIATION + +#define SSL_ERROR_NONE 0 +#define SSL_ERROR_SSL 1 +#define SSL_ERROR_WANT_READ 2 +#define SSL_ERROR_WANT_WRITE 3 +#define SSL_ERROR_WANT_X509_LOOKUP 4 +#define SSL_ERROR_SYSCALL 5 /* look at error stack/return value/errno */ +#define SSL_ERROR_ZERO_RETURN 6 +#define SSL_ERROR_WANT_CONNECT 7 +#define SSL_ERROR_WANT_ACCEPT 8 + +#define SSL_CTRL_NEED_TMP_RSA 1 +#define SSL_CTRL_SET_TMP_RSA 2 +#define SSL_CTRL_SET_TMP_DH 3 +#define SSL_CTRL_SET_TMP_ECDH 4 +#define SSL_CTRL_SET_TMP_RSA_CB 5 +#define SSL_CTRL_SET_TMP_DH_CB 6 +#define SSL_CTRL_SET_TMP_ECDH_CB 7 + +#define SSL_CTRL_GET_SESSION_REUSED 8 +#define SSL_CTRL_GET_CLIENT_CERT_REQUEST 9 +#define SSL_CTRL_GET_NUM_RENEGOTIATIONS 10 +#define SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS 11 +#define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS 12 +#define SSL_CTRL_GET_FLAGS 13 +#define SSL_CTRL_EXTRA_CHAIN_CERT 14 + +#define SSL_CTRL_SET_MSG_CALLBACK 15 +#define SSL_CTRL_SET_MSG_CALLBACK_ARG 16 + +/* only applies to datagram connections */ +#define SSL_CTRL_SET_MTU 17 +/* Stats */ +#define SSL_CTRL_SESS_NUMBER 20 +#define SSL_CTRL_SESS_CONNECT 21 +#define SSL_CTRL_SESS_CONNECT_GOOD 22 +#define SSL_CTRL_SESS_CONNECT_RENEGOTIATE 23 +#define SSL_CTRL_SESS_ACCEPT 24 +#define SSL_CTRL_SESS_ACCEPT_GOOD 25 +#define SSL_CTRL_SESS_ACCEPT_RENEGOTIATE 26 +#define SSL_CTRL_SESS_HIT 27 +#define SSL_CTRL_SESS_CB_HIT 28 +#define SSL_CTRL_SESS_MISSES 29 +#define SSL_CTRL_SESS_TIMEOUTS 30 +#define SSL_CTRL_SESS_CACHE_FULL 31 +#define SSL_CTRL_OPTIONS 32 +#define SSL_CTRL_MODE 33 + +#define SSL_CTRL_GET_READ_AHEAD 40 +#define SSL_CTRL_SET_READ_AHEAD 41 +#define SSL_CTRL_SET_SESS_CACHE_SIZE 42 +#define SSL_CTRL_GET_SESS_CACHE_SIZE 43 +#define SSL_CTRL_SET_SESS_CACHE_MODE 44 +#define SSL_CTRL_GET_SESS_CACHE_MODE 45 + +#define SSL_CTRL_GET_MAX_CERT_LIST 50 +#define SSL_CTRL_SET_MAX_CERT_LIST 51 + +#define SSL_session_reused(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_GET_SESSION_REUSED,0,NULL) +#define SSL_num_renegotiations(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_GET_NUM_RENEGOTIATIONS,0,NULL) +#define SSL_clear_num_renegotiations(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS,0,NULL) +#define SSL_total_renegotiations(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_GET_TOTAL_RENEGOTIATIONS,0,NULL) + +#define SSL_CTX_need_tmp_RSA(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_NEED_TMP_RSA,0,NULL) +#define SSL_CTX_set_tmp_rsa(ctx,rsa) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_RSA,0,(char *)rsa) +#define SSL_CTX_set_tmp_dh(ctx,dh) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_DH,0,(char *)dh) +#define SSL_CTX_set_tmp_ecdh(ctx,ecdh) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_ECDH,0,(char *)ecdh) + +#define SSL_need_tmp_RSA(ssl) \ + SSL_ctrl(ssl,SSL_CTRL_NEED_TMP_RSA,0,NULL) +#define SSL_set_tmp_rsa(ssl,rsa) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TMP_RSA,0,(char *)rsa) +#define SSL_set_tmp_dh(ssl,dh) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TMP_DH,0,(char *)dh) +#define SSL_set_tmp_ecdh(ssl,ecdh) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TMP_ECDH,0,(char *)ecdh) + +#define SSL_CTX_add_extra_chain_cert(ctx,x509) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)x509) + +#ifndef OPENSSL_NO_BIO +BIO_METHOD *BIO_f_ssl(void); +BIO *BIO_new_ssl(SSL_CTX *ctx,int client); +BIO *BIO_new_ssl_connect(SSL_CTX *ctx); +BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx); +int BIO_ssl_copy_session_id(BIO *to,BIO *from); +void BIO_ssl_shutdown(BIO *ssl_bio); + +#endif + +int SSL_CTX_set_cipher_list(SSL_CTX *,const char *str); +SSL_CTX *SSL_CTX_new(SSL_METHOD *meth); +void SSL_CTX_free(SSL_CTX *); +long SSL_CTX_set_timeout(SSL_CTX *ctx,long t); +long SSL_CTX_get_timeout(const SSL_CTX *ctx); +X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *); +void SSL_CTX_set_cert_store(SSL_CTX *,X509_STORE *); +int SSL_want(const SSL *s); +int SSL_clear(SSL *s); + +void SSL_CTX_flush_sessions(SSL_CTX *ctx,long tm); + +SSL_CIPHER *SSL_get_current_cipher(const SSL *s); +int SSL_CIPHER_get_bits(const SSL_CIPHER *c,int *alg_bits); +char * SSL_CIPHER_get_version(const SSL_CIPHER *c); +const char * SSL_CIPHER_get_name(const SSL_CIPHER *c); + +int SSL_get_fd(const SSL *s); +int SSL_get_rfd(const SSL *s); +int SSL_get_wfd(const SSL *s); +const char * SSL_get_cipher_list(const SSL *s,int n); +char * SSL_get_shared_ciphers(const SSL *s, char *buf, int len); +int SSL_get_read_ahead(const SSL * s); +int SSL_pending(const SSL *s); +#ifndef OPENSSL_NO_SOCK +int SSL_set_fd(SSL *s, int fd); +int SSL_set_rfd(SSL *s, int fd); +int SSL_set_wfd(SSL *s, int fd); +#endif +#ifndef OPENSSL_NO_BIO +void SSL_set_bio(SSL *s, BIO *rbio,BIO *wbio); +BIO * SSL_get_rbio(const SSL *s); +BIO * SSL_get_wbio(const SSL *s); +#endif +int SSL_set_cipher_list(SSL *s, const char *str); +void SSL_set_read_ahead(SSL *s, int yes); +int SSL_get_verify_mode(const SSL *s); +int SSL_get_verify_depth(const SSL *s); +int (*SSL_get_verify_callback(const SSL *s))(int,X509_STORE_CTX *); +void SSL_set_verify(SSL *s, int mode, + int (*callback)(int ok,X509_STORE_CTX *ctx)); +void SSL_set_verify_depth(SSL *s, int depth); +#ifndef OPENSSL_NO_RSA +int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa); +#endif +int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len); +int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey); +int SSL_use_PrivateKey_ASN1(int pk,SSL *ssl, const unsigned char *d, long len); +int SSL_use_certificate(SSL *ssl, X509 *x); +int SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len); + +#ifndef OPENSSL_NO_STDIO +int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type); +int SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type); +int SSL_use_certificate_file(SSL *ssl, const char *file, int type); +int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, int type); +int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type); +int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type); +int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); /* PEM type */ +STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file); +int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, + const char *file); +#ifndef OPENSSL_SYS_VMS +#ifndef OPENSSL_SYS_MACINTOSH_CLASSIC /* XXXXX: Better scheme needed! [was: #ifndef MAC_OS_pre_X] */ +int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, + const char *dir); +#endif +#endif + +#endif + +void SSL_load_error_strings(void ); +const char *SSL_state_string(const SSL *s); +const char *SSL_rstate_string(const SSL *s); +const char *SSL_state_string_long(const SSL *s); +const char *SSL_rstate_string_long(const SSL *s); +long SSL_SESSION_get_time(const SSL_SESSION *s); +long SSL_SESSION_set_time(SSL_SESSION *s, long t); +long SSL_SESSION_get_timeout(const SSL_SESSION *s); +long SSL_SESSION_set_timeout(SSL_SESSION *s, long t); +void SSL_copy_session_id(SSL *to,const SSL *from); + +SSL_SESSION *SSL_SESSION_new(void); +unsigned long SSL_SESSION_hash(const SSL_SESSION *a); +int SSL_SESSION_cmp(const SSL_SESSION *a,const SSL_SESSION *b); +const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s, unsigned int *len); +#ifndef OPENSSL_NO_FP_API +int SSL_SESSION_print_fp(FILE *fp,const SSL_SESSION *ses); +#endif +#ifndef OPENSSL_NO_BIO +int SSL_SESSION_print(BIO *fp,const SSL_SESSION *ses); +#endif +void SSL_SESSION_free(SSL_SESSION *ses); +int i2d_SSL_SESSION(SSL_SESSION *in,unsigned char **pp); +int SSL_set_session(SSL *to, SSL_SESSION *session); +int SSL_CTX_add_session(SSL_CTX *s, SSL_SESSION *c); +int SSL_CTX_remove_session(SSL_CTX *,SSL_SESSION *c); +int SSL_CTX_set_generate_session_id(SSL_CTX *, GEN_SESSION_CB); +int SSL_set_generate_session_id(SSL *, GEN_SESSION_CB); +int SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id, + unsigned int id_len); +SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a,const unsigned char **pp, + long length); + +#ifdef HEADER_X509_H +X509 * SSL_get_peer_certificate(const SSL *s); +#endif + +STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s); + +int SSL_CTX_get_verify_mode(const SSL_CTX *ctx); +int SSL_CTX_get_verify_depth(const SSL_CTX *ctx); +int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int,X509_STORE_CTX *); +void SSL_CTX_set_verify(SSL_CTX *ctx,int mode, + int (*callback)(int, X509_STORE_CTX *)); +void SSL_CTX_set_verify_depth(SSL_CTX *ctx,int depth); +void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, int (*cb)(X509_STORE_CTX *,void *), void *arg); +#ifndef OPENSSL_NO_RSA +int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa); +#endif +int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, long len); +int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey); +int SSL_CTX_use_PrivateKey_ASN1(int pk,SSL_CTX *ctx, + const unsigned char *d, long len); +int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x); +int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, const unsigned char *d); + +void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb); +void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u); + +int SSL_CTX_check_private_key(const SSL_CTX *ctx); +int SSL_check_private_key(const SSL *ctx); + +int SSL_CTX_set_session_id_context(SSL_CTX *ctx,const unsigned char *sid_ctx, + unsigned int sid_ctx_len); + +SSL * SSL_new(SSL_CTX *ctx); +int SSL_set_session_id_context(SSL *ssl,const unsigned char *sid_ctx, + unsigned int sid_ctx_len); + +int SSL_CTX_set_purpose(SSL_CTX *s, int purpose); +int SSL_set_purpose(SSL *s, int purpose); +int SSL_CTX_set_trust(SSL_CTX *s, int trust); +int SSL_set_trust(SSL *s, int trust); + +void SSL_free(SSL *ssl); +int SSL_accept(SSL *ssl); +int SSL_connect(SSL *ssl); +int SSL_read(SSL *ssl,void *buf,int num); +int SSL_peek(SSL *ssl,void *buf,int num); +int SSL_write(SSL *ssl,const void *buf,int num); +long SSL_ctrl(SSL *ssl,int cmd, long larg, void *parg); +long SSL_callback_ctrl(SSL *, int, void (*)(void)); +long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd, long larg, void *parg); +long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)(void)); + +int SSL_get_error(const SSL *s,int ret_code); +const char *SSL_get_version(const SSL *s); + +/* This sets the 'default' SSL version that SSL_new() will create */ +int SSL_CTX_set_ssl_version(SSL_CTX *ctx,SSL_METHOD *meth); + +SSL_METHOD *SSLv2_method(void); /* SSLv2 */ +SSL_METHOD *SSLv2_server_method(void); /* SSLv2 */ +SSL_METHOD *SSLv2_client_method(void); /* SSLv2 */ + +SSL_METHOD *SSLv3_method(void); /* SSLv3 */ +SSL_METHOD *SSLv3_server_method(void); /* SSLv3 */ +SSL_METHOD *SSLv3_client_method(void); /* SSLv3 */ + +SSL_METHOD *SSLv23_method(void); /* SSLv3 but can rollback to v2 */ +SSL_METHOD *SSLv23_server_method(void); /* SSLv3 but can rollback to v2 */ +SSL_METHOD *SSLv23_client_method(void); /* SSLv3 but can rollback to v2 */ + +SSL_METHOD *TLSv1_method(void); /* TLSv1.0 */ +SSL_METHOD *TLSv1_server_method(void); /* TLSv1.0 */ +SSL_METHOD *TLSv1_client_method(void); /* TLSv1.0 */ + +SSL_METHOD *DTLSv1_method(void); /* DTLSv1.0 */ +SSL_METHOD *DTLSv1_server_method(void); /* DTLSv1.0 */ +SSL_METHOD *DTLSv1_client_method(void); /* DTLSv1.0 */ + +STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s); + +int SSL_do_handshake(SSL *s); +int SSL_renegotiate(SSL *s); +int SSL_renegotiate_pending(SSL *s); +int SSL_shutdown(SSL *s); + +SSL_METHOD *SSL_get_ssl_method(SSL *s); +int SSL_set_ssl_method(SSL *s,SSL_METHOD *method); +const char *SSL_alert_type_string_long(int value); +const char *SSL_alert_type_string(int value); +const char *SSL_alert_desc_string_long(int value); +const char *SSL_alert_desc_string(int value); + +void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list); +void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); +STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s); +STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *s); +int SSL_add_client_CA(SSL *ssl,X509 *x); +int SSL_CTX_add_client_CA(SSL_CTX *ctx,X509 *x); + +void SSL_set_connect_state(SSL *s); +void SSL_set_accept_state(SSL *s); + +long SSL_get_default_timeout(const SSL *s); + +int SSL_library_init(void ); + +char *SSL_CIPHER_description(SSL_CIPHER *,char *buf,int size); +STACK_OF(X509_NAME) *SSL_dup_CA_list(STACK_OF(X509_NAME) *sk); + +SSL *SSL_dup(SSL *ssl); + +X509 *SSL_get_certificate(const SSL *ssl); +/* EVP_PKEY */ struct evp_pkey_st *SSL_get_privatekey(SSL *ssl); + +void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx,int mode); +int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx); +void SSL_set_quiet_shutdown(SSL *ssl,int mode); +int SSL_get_quiet_shutdown(const SSL *ssl); +void SSL_set_shutdown(SSL *ssl,int mode); +int SSL_get_shutdown(const SSL *ssl); +int SSL_version(const SSL *ssl); +int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx); +int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, + const char *CApath); +#define SSL_get0_session SSL_get_session /* just peek at pointer */ +SSL_SESSION *SSL_get_session(const SSL *ssl); +SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */ +SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl); +void SSL_set_info_callback(SSL *ssl, + void (*cb)(const SSL *ssl,int type,int val)); +void (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl,int type,int val); +int SSL_state(const SSL *ssl); + +void SSL_set_verify_result(SSL *ssl,long v); +long SSL_get_verify_result(const SSL *ssl); + +int SSL_set_ex_data(SSL *ssl,int idx,void *data); +void *SSL_get_ex_data(const SSL *ssl,int idx); +int SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); + +int SSL_SESSION_set_ex_data(SSL_SESSION *ss,int idx,void *data); +void *SSL_SESSION_get_ex_data(const SSL_SESSION *ss,int idx); +int SSL_SESSION_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); + +int SSL_CTX_set_ex_data(SSL_CTX *ssl,int idx,void *data); +void *SSL_CTX_get_ex_data(const SSL_CTX *ssl,int idx); +int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); + +int SSL_get_ex_data_X509_STORE_CTX_idx(void ); + +#define SSL_CTX_sess_set_cache_size(ctx,t) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_SIZE,t,NULL) +#define SSL_CTX_sess_get_cache_size(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_SIZE,0,NULL) +#define SSL_CTX_set_session_cache_mode(ctx,m) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,NULL) +#define SSL_CTX_get_session_cache_mode(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_MODE,0,NULL) + +#define SSL_CTX_get_default_read_ahead(ctx) SSL_CTX_get_read_ahead(ctx) +#define SSL_CTX_set_default_read_ahead(ctx,m) SSL_CTX_set_read_ahead(ctx,m) +#define SSL_CTX_get_read_ahead(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_READ_AHEAD,0,NULL) +#define SSL_CTX_set_read_ahead(ctx,m) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_READ_AHEAD,m,NULL) +#define SSL_CTX_get_max_cert_list(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL) +#define SSL_CTX_set_max_cert_list(ctx,m) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL) +#define SSL_get_max_cert_list(ssl) \ + SSL_ctrl(ssl,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL) +#define SSL_set_max_cert_list(ssl,m) \ + SSL_ctrl(ssl,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL) + + /* NB: the keylength is only applicable when is_export is true */ +#ifndef OPENSSL_NO_RSA +void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx, + RSA *(*cb)(SSL *ssl,int is_export, + int keylength)); + +void SSL_set_tmp_rsa_callback(SSL *ssl, + RSA *(*cb)(SSL *ssl,int is_export, + int keylength)); +#endif +#ifndef OPENSSL_NO_DH +void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, + DH *(*dh)(SSL *ssl,int is_export, + int keylength)); +void SSL_set_tmp_dh_callback(SSL *ssl, + DH *(*dh)(SSL *ssl,int is_export, + int keylength)); +#endif +#ifndef OPENSSL_NO_ECDH +void SSL_CTX_set_tmp_ecdh_callback(SSL_CTX *ctx, + EC_KEY *(*ecdh)(SSL *ssl,int is_export, + int keylength)); +void SSL_set_tmp_ecdh_callback(SSL *ssl, + EC_KEY *(*ecdh)(SSL *ssl,int is_export, + int keylength)); +#endif + +#ifndef OPENSSL_NO_COMP +const COMP_METHOD *SSL_get_current_compression(SSL *s); +const COMP_METHOD *SSL_get_current_expansion(SSL *s); +const char *SSL_COMP_get_name(const COMP_METHOD *comp); +STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void); +int SSL_COMP_add_compression_method(int id,COMP_METHOD *cm); +#else +const void *SSL_get_current_compression(SSL *s); +const void *SSL_get_current_expansion(SSL *s); +const char *SSL_COMP_get_name(const void *comp); +void *SSL_COMP_get_compression_methods(void); +int SSL_COMP_add_compression_method(int id,void *cm); +#endif + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_SSL_strings(void); + +/* Error codes for the SSL functions. */ + +/* Function codes. */ +#define SSL_F_CLIENT_CERTIFICATE 100 +#define SSL_F_CLIENT_FINISHED 238 +#define SSL_F_CLIENT_HELLO 101 +#define SSL_F_CLIENT_MASTER_KEY 102 +#define SSL_F_D2I_SSL_SESSION 103 +#define SSL_F_DO_DTLS1_WRITE 1003 +#define SSL_F_DO_SSL3_WRITE 104 +#define SSL_F_DTLS1_ACCEPT 1004 +#define SSL_F_DTLS1_BUFFER_RECORD 1005 +#define SSL_F_DTLS1_CLIENT_HELLO 1006 +#define SSL_F_DTLS1_CONNECT 1007 +#define SSL_F_DTLS1_ENC 1008 +#define SSL_F_DTLS1_GET_HELLO_VERIFY 1009 +#define SSL_F_DTLS1_GET_MESSAGE 1010 +#define SSL_F_DTLS1_GET_MESSAGE_FRAGMENT 1011 +#define SSL_F_DTLS1_GET_RECORD 1012 +#define SSL_F_DTLS1_OUTPUT_CERT_CHAIN 1013 +#define SSL_F_DTLS1_PROCESS_OUT_OF_SEQ_MESSAGE 1014 +#define SSL_F_DTLS1_PROCESS_RECORD 1015 +#define SSL_F_DTLS1_READ_BYTES 1016 +#define SSL_F_DTLS1_READ_FAILED 1001 +#define SSL_F_DTLS1_SEND_CERTIFICATE_REQUEST 1017 +#define SSL_F_DTLS1_SEND_CLIENT_CERTIFICATE 1018 +#define SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE 1019 +#define SSL_F_DTLS1_SEND_CLIENT_VERIFY 1020 +#define SSL_F_DTLS1_SEND_HELLO_VERIFY_REQUEST 1002 +#define SSL_F_DTLS1_SEND_SERVER_CERTIFICATE 1021 +#define SSL_F_DTLS1_SEND_SERVER_HELLO 1022 +#define SSL_F_DTLS1_SEND_SERVER_KEY_EXCHANGE 1023 +#define SSL_F_DTLS1_WRITE_APP_DATA_BYTES 1024 +#define SSL_F_GET_CLIENT_FINISHED 105 +#define SSL_F_GET_CLIENT_HELLO 106 +#define SSL_F_GET_CLIENT_MASTER_KEY 107 +#define SSL_F_GET_SERVER_FINISHED 108 +#define SSL_F_GET_SERVER_HELLO 109 +#define SSL_F_GET_SERVER_VERIFY 110 +#define SSL_F_I2D_SSL_SESSION 111 +#define SSL_F_READ_N 112 +#define SSL_F_REQUEST_CERTIFICATE 113 +#define SSL_F_SERVER_FINISH 239 +#define SSL_F_SERVER_HELLO 114 +#define SSL_F_SERVER_VERIFY 240 +#define SSL_F_SSL23_ACCEPT 115 +#define SSL_F_SSL23_CLIENT_HELLO 116 +#define SSL_F_SSL23_CONNECT 117 +#define SSL_F_SSL23_GET_CLIENT_HELLO 118 +#define SSL_F_SSL23_GET_SERVER_HELLO 119 +#define SSL_F_SSL23_PEEK 237 +#define SSL_F_SSL23_READ 120 +#define SSL_F_SSL23_WRITE 121 +#define SSL_F_SSL2_ACCEPT 122 +#define SSL_F_SSL2_CONNECT 123 +#define SSL_F_SSL2_ENC_INIT 124 +#define SSL_F_SSL2_GENERATE_KEY_MATERIAL 241 +#define SSL_F_SSL2_PEEK 234 +#define SSL_F_SSL2_READ 125 +#define SSL_F_SSL2_READ_INTERNAL 236 +#define SSL_F_SSL2_SET_CERTIFICATE 126 +#define SSL_F_SSL2_WRITE 127 +#define SSL_F_SSL3_ACCEPT 128 +#define SSL_F_SSL3_CALLBACK_CTRL 233 +#define SSL_F_SSL3_CHANGE_CIPHER_STATE 129 +#define SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM 130 +#define SSL_F_SSL3_CLIENT_HELLO 131 +#define SSL_F_SSL3_CONNECT 132 +#define SSL_F_SSL3_CTRL 213 +#define SSL_F_SSL3_CTX_CTRL 133 +#define SSL_F_SSL3_ENC 134 +#define SSL_F_SSL3_GENERATE_KEY_BLOCK 238 +#define SSL_F_SSL3_GET_CERTIFICATE_REQUEST 135 +#define SSL_F_SSL3_GET_CERT_VERIFY 136 +#define SSL_F_SSL3_GET_CLIENT_CERTIFICATE 137 +#define SSL_F_SSL3_GET_CLIENT_HELLO 138 +#define SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE 139 +#define SSL_F_SSL3_GET_FINISHED 140 +#define SSL_F_SSL3_GET_KEY_EXCHANGE 141 +#define SSL_F_SSL3_GET_MESSAGE 142 +#define SSL_F_SSL3_GET_RECORD 143 +#define SSL_F_SSL3_GET_SERVER_CERTIFICATE 144 +#define SSL_F_SSL3_GET_SERVER_DONE 145 +#define SSL_F_SSL3_GET_SERVER_HELLO 146 +#define SSL_F_SSL3_OUTPUT_CERT_CHAIN 147 +#define SSL_F_SSL3_PEEK 235 +#define SSL_F_SSL3_READ_BYTES 148 +#define SSL_F_SSL3_READ_N 149 +#define SSL_F_SSL3_SEND_CERTIFICATE_REQUEST 150 +#define SSL_F_SSL3_SEND_CLIENT_CERTIFICATE 151 +#define SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE 152 +#define SSL_F_SSL3_SEND_CLIENT_VERIFY 153 +#define SSL_F_SSL3_SEND_SERVER_CERTIFICATE 154 +#define SSL_F_SSL3_SEND_SERVER_HELLO 242 +#define SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE 155 +#define SSL_F_SSL3_SETUP_BUFFERS 156 +#define SSL_F_SSL3_SETUP_KEY_BLOCK 157 +#define SSL_F_SSL3_WRITE_BYTES 158 +#define SSL_F_SSL3_WRITE_PENDING 159 +#define SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK 215 +#define SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK 216 +#define SSL_F_SSL_BAD_METHOD 160 +#define SSL_F_SSL_BYTES_TO_CIPHER_LIST 161 +#define SSL_F_SSL_CERT_DUP 221 +#define SSL_F_SSL_CERT_INST 222 +#define SSL_F_SSL_CERT_INSTANTIATE 214 +#define SSL_F_SSL_CERT_NEW 162 +#define SSL_F_SSL_CHECK_PRIVATE_KEY 163 +#define SSL_F_SSL_CIPHER_PROCESS_RULESTR 230 +#define SSL_F_SSL_CIPHER_STRENGTH_SORT 231 +#define SSL_F_SSL_CLEAR 164 +#define SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD 165 +#define SSL_F_SSL_CREATE_CIPHER_LIST 166 +#define SSL_F_SSL_CTRL 232 +#define SSL_F_SSL_CTX_CHECK_PRIVATE_KEY 168 +#define SSL_F_SSL_CTX_NEW 169 +#define SSL_F_SSL_CTX_SET_CIPHER_LIST 1026 +#define SSL_F_SSL_CTX_SET_PURPOSE 226 +#define SSL_F_SSL_CTX_SET_SESSION_ID_CONTEXT 219 +#define SSL_F_SSL_CTX_SET_SSL_VERSION 170 +#define SSL_F_SSL_CTX_SET_TRUST 229 +#define SSL_F_SSL_CTX_USE_CERTIFICATE 171 +#define SSL_F_SSL_CTX_USE_CERTIFICATE_ASN1 172 +#define SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE 220 +#define SSL_F_SSL_CTX_USE_CERTIFICATE_FILE 173 +#define SSL_F_SSL_CTX_USE_PRIVATEKEY 174 +#define SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1 175 +#define SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE 176 +#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY 177 +#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_ASN1 178 +#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE 179 +#define SSL_F_SSL_DO_HANDSHAKE 180 +#define SSL_F_SSL_GET_NEW_SESSION 181 +#define SSL_F_SSL_GET_PREV_SESSION 217 +#define SSL_F_SSL_GET_SERVER_SEND_CERT 182 +#define SSL_F_SSL_GET_SIGN_PKEY 183 +#define SSL_F_SSL_INIT_WBIO_BUFFER 184 +#define SSL_F_SSL_LOAD_CLIENT_CA_FILE 185 +#define SSL_F_SSL_NEW 186 +#define SSL_F_SSL_PEEK 1025 +#define SSL_F_SSL_READ 223 +#define SSL_F_SSL_RSA_PRIVATE_DECRYPT 187 +#define SSL_F_SSL_RSA_PUBLIC_ENCRYPT 188 +#define SSL_F_SSL_SESSION_NEW 189 +#define SSL_F_SSL_SESSION_PRINT_FP 190 +#define SSL_F_SSL_SESS_CERT_NEW 225 +#define SSL_F_SSL_SET_CERT 191 +#define SSL_F_SSL_SET_CIPHER_LIST 1027 +#define SSL_F_SSL_SET_FD 192 +#define SSL_F_SSL_SET_PKEY 193 +#define SSL_F_SSL_SET_PURPOSE 227 +#define SSL_F_SSL_SET_RFD 194 +#define SSL_F_SSL_SET_SESSION 195 +#define SSL_F_SSL_SET_SESSION_ID_CONTEXT 218 +#define SSL_F_SSL_SET_TRUST 228 +#define SSL_F_SSL_SET_WFD 196 +#define SSL_F_SSL_SHUTDOWN 224 +#define SSL_F_SSL_UNDEFINED_CONST_FUNCTION 243 +#define SSL_F_SSL_UNDEFINED_FUNCTION 197 +#define SSL_F_SSL_UNDEFINED_VOID_FUNCTION 244 +#define SSL_F_SSL_USE_CERTIFICATE 198 +#define SSL_F_SSL_USE_CERTIFICATE_ASN1 199 +#define SSL_F_SSL_USE_CERTIFICATE_FILE 200 +#define SSL_F_SSL_USE_PRIVATEKEY 201 +#define SSL_F_SSL_USE_PRIVATEKEY_ASN1 202 +#define SSL_F_SSL_USE_PRIVATEKEY_FILE 203 +#define SSL_F_SSL_USE_RSAPRIVATEKEY 204 +#define SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1 205 +#define SSL_F_SSL_USE_RSAPRIVATEKEY_FILE 206 +#define SSL_F_SSL_VERIFY_CERT_CHAIN 207 +#define SSL_F_SSL_WRITE 208 +#define SSL_F_TLS1_CHANGE_CIPHER_STATE 209 +#define SSL_F_TLS1_ENC 210 +#define SSL_F_TLS1_SETUP_KEY_BLOCK 211 +#define SSL_F_WRITE_PENDING 212 + +/* Reason codes. */ +#define SSL_R_APP_DATA_IN_HANDSHAKE 100 +#define SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT 272 +#define SSL_R_BAD_ALERT_RECORD 101 +#define SSL_R_BAD_AUTHENTICATION_TYPE 102 +#define SSL_R_BAD_CHANGE_CIPHER_SPEC 103 +#define SSL_R_BAD_CHECKSUM 104 +#define SSL_R_BAD_DATA_RETURNED_BY_CALLBACK 106 +#define SSL_R_BAD_DECOMPRESSION 107 +#define SSL_R_BAD_DH_G_LENGTH 108 +#define SSL_R_BAD_DH_PUB_KEY_LENGTH 109 +#define SSL_R_BAD_DH_P_LENGTH 110 +#define SSL_R_BAD_DIGEST_LENGTH 111 +#define SSL_R_BAD_DSA_SIGNATURE 112 +#define SSL_R_BAD_ECC_CERT 1117 +#define SSL_R_BAD_ECDSA_SIGNATURE 1112 +#define SSL_R_BAD_ECPOINT 1113 +#define SSL_R_BAD_HELLO_REQUEST 105 +#define SSL_R_BAD_LENGTH 271 +#define SSL_R_BAD_MAC_DECODE 113 +#define SSL_R_BAD_MESSAGE_TYPE 114 +#define SSL_R_BAD_PACKET_LENGTH 115 +#define SSL_R_BAD_PROTOCOL_VERSION_NUMBER 116 +#define SSL_R_BAD_RESPONSE_ARGUMENT 117 +#define SSL_R_BAD_RSA_DECRYPT 118 +#define SSL_R_BAD_RSA_ENCRYPT 119 +#define SSL_R_BAD_RSA_E_LENGTH 120 +#define SSL_R_BAD_RSA_MODULUS_LENGTH 121 +#define SSL_R_BAD_RSA_SIGNATURE 122 +#define SSL_R_BAD_SIGNATURE 123 +#define SSL_R_BAD_SSL_FILETYPE 124 +#define SSL_R_BAD_SSL_SESSION_ID_LENGTH 125 +#define SSL_R_BAD_STATE 126 +#define SSL_R_BAD_WRITE_RETRY 127 +#define SSL_R_BIO_NOT_SET 128 +#define SSL_R_BLOCK_CIPHER_PAD_IS_WRONG 129 +#define SSL_R_BN_LIB 130 +#define SSL_R_CA_DN_LENGTH_MISMATCH 131 +#define SSL_R_CA_DN_TOO_LONG 132 +#define SSL_R_CCS_RECEIVED_EARLY 133 +#define SSL_R_CERTIFICATE_VERIFY_FAILED 134 +#define SSL_R_CERT_LENGTH_MISMATCH 135 +#define SSL_R_CHALLENGE_IS_DIFFERENT 136 +#define SSL_R_CIPHER_CODE_WRONG_LENGTH 137 +#define SSL_R_CIPHER_OR_HASH_UNAVAILABLE 138 +#define SSL_R_CIPHER_TABLE_SRC_ERROR 139 +#define SSL_R_COMPRESSED_LENGTH_TOO_LONG 140 +#define SSL_R_COMPRESSION_FAILURE 141 +#define SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE 1120 +#define SSL_R_COMPRESSION_LIBRARY_ERROR 142 +#define SSL_R_CONNECTION_ID_IS_DIFFERENT 143 +#define SSL_R_CONNECTION_TYPE_NOT_SET 144 +#define SSL_R_COOKIE_MISMATCH 2002 +#define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED 145 +#define SSL_R_DATA_LENGTH_TOO_LONG 146 +#define SSL_R_DECRYPTION_FAILED 147 +#define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC 1109 +#define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG 148 +#define SSL_R_DIGEST_CHECK_FAILED 149 +#define SSL_R_DUPLICATE_COMPRESSION_ID 1121 +#define SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER 1119 +#define SSL_R_ENCRYPTED_LENGTH_TOO_LONG 150 +#define SSL_R_ERROR_GENERATING_TMP_RSA_KEY 1092 +#define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST 151 +#define SSL_R_EXCESSIVE_MESSAGE_SIZE 152 +#define SSL_R_EXTRA_DATA_IN_MESSAGE 153 +#define SSL_R_GOT_A_FIN_BEFORE_A_CCS 154 +#define SSL_R_HTTPS_PROXY_REQUEST 155 +#define SSL_R_HTTP_REQUEST 156 +#define SSL_R_ILLEGAL_PADDING 1110 +#define SSL_R_INVALID_CHALLENGE_LENGTH 158 +#define SSL_R_INVALID_COMMAND 280 +#define SSL_R_INVALID_PURPOSE 278 +#define SSL_R_INVALID_TRUST 279 +#define SSL_R_KEY_ARG_TOO_LONG 1112 +#define SSL_R_KRB5 1104 +#define SSL_R_KRB5_C_CC_PRINC 1094 +#define SSL_R_KRB5_C_GET_CRED 1095 +#define SSL_R_KRB5_C_INIT 1096 +#define SSL_R_KRB5_C_MK_REQ 1097 +#define SSL_R_KRB5_S_BAD_TICKET 1098 +#define SSL_R_KRB5_S_INIT 1099 +#define SSL_R_KRB5_S_RD_REQ 1108 +#define SSL_R_KRB5_S_TKT_EXPIRED 1105 +#define SSL_R_KRB5_S_TKT_NYV 1106 +#define SSL_R_KRB5_S_TKT_SKEW 1107 +#define SSL_R_LENGTH_MISMATCH 159 +#define SSL_R_LENGTH_TOO_SHORT 160 +#define SSL_R_LIBRARY_BUG 274 +#define SSL_R_LIBRARY_HAS_NO_CIPHERS 161 +#define SSL_R_MASTER_KEY_TOO_LONG 1112 +#define SSL_R_MESSAGE_TOO_LONG 1111 +#define SSL_R_MISSING_DH_DSA_CERT 162 +#define SSL_R_MISSING_DH_KEY 163 +#define SSL_R_MISSING_DH_RSA_CERT 164 +#define SSL_R_MISSING_DSA_SIGNING_CERT 165 +#define SSL_R_MISSING_EXPORT_TMP_DH_KEY 166 +#define SSL_R_MISSING_EXPORT_TMP_RSA_KEY 167 +#define SSL_R_MISSING_RSA_CERTIFICATE 168 +#define SSL_R_MISSING_RSA_ENCRYPTING_CERT 169 +#define SSL_R_MISSING_RSA_SIGNING_CERT 170 +#define SSL_R_MISSING_TMP_DH_KEY 171 +#define SSL_R_MISSING_TMP_ECDH_KEY 1114 +#define SSL_R_MISSING_TMP_RSA_KEY 172 +#define SSL_R_MISSING_TMP_RSA_PKEY 173 +#define SSL_R_MISSING_VERIFY_MESSAGE 174 +#define SSL_R_NON_SSLV2_INITIAL_PACKET 175 +#define SSL_R_NO_CERTIFICATES_RETURNED 176 +#define SSL_R_NO_CERTIFICATE_ASSIGNED 177 +#define SSL_R_NO_CERTIFICATE_RETURNED 178 +#define SSL_R_NO_CERTIFICATE_SET 179 +#define SSL_R_NO_CERTIFICATE_SPECIFIED 180 +#define SSL_R_NO_CIPHERS_AVAILABLE 181 +#define SSL_R_NO_CIPHERS_PASSED 182 +#define SSL_R_NO_CIPHERS_SPECIFIED 183 +#define SSL_R_NO_CIPHER_LIST 184 +#define SSL_R_NO_CIPHER_MATCH 185 +#define SSL_R_NO_CLIENT_CERT_RECEIVED 186 +#define SSL_R_NO_COMPRESSION_SPECIFIED 187 +#define SSL_R_NO_METHOD_SPECIFIED 188 +#define SSL_R_NO_PRIVATEKEY 189 +#define SSL_R_NO_PRIVATE_KEY_ASSIGNED 190 +#define SSL_R_NO_PROTOCOLS_AVAILABLE 191 +#define SSL_R_NO_PUBLICKEY 192 +#define SSL_R_NO_SHARED_CIPHER 193 +#define SSL_R_NO_VERIFY_CALLBACK 194 +#define SSL_R_NULL_SSL_CTX 195 +#define SSL_R_NULL_SSL_METHOD_PASSED 196 +#define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED 197 +#define SSL_R_PACKET_LENGTH_TOO_LONG 198 +#define SSL_R_PATH_TOO_LONG 270 +#define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE 199 +#define SSL_R_PEER_ERROR 200 +#define SSL_R_PEER_ERROR_CERTIFICATE 201 +#define SSL_R_PEER_ERROR_NO_CERTIFICATE 202 +#define SSL_R_PEER_ERROR_NO_CIPHER 203 +#define SSL_R_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE 204 +#define SSL_R_PRE_MAC_LENGTH_TOO_LONG 205 +#define SSL_R_PROBLEMS_MAPPING_CIPHER_FUNCTIONS 206 +#define SSL_R_PROTOCOL_IS_SHUTDOWN 207 +#define SSL_R_PUBLIC_KEY_ENCRYPT_ERROR 208 +#define SSL_R_PUBLIC_KEY_IS_NOT_RSA 209 +#define SSL_R_PUBLIC_KEY_NOT_RSA 210 +#define SSL_R_READ_BIO_NOT_SET 211 +#define SSL_R_READ_TIMEOUT_EXPIRED 2001 +#define SSL_R_READ_WRONG_PACKET_TYPE 212 +#define SSL_R_RECORD_LENGTH_MISMATCH 213 +#define SSL_R_RECORD_TOO_LARGE 214 +#define SSL_R_RECORD_TOO_SMALL 1093 +#define SSL_R_REQUIRED_CIPHER_MISSING 215 +#define SSL_R_REUSE_CERT_LENGTH_NOT_ZERO 216 +#define SSL_R_REUSE_CERT_TYPE_NOT_ZERO 217 +#define SSL_R_REUSE_CIPHER_LIST_NOT_ZERO 218 +#define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED 277 +#define SSL_R_SHORT_READ 219 +#define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE 220 +#define SSL_R_SSL23_DOING_SESSION_ID_REUSE 221 +#define SSL_R_SSL2_CONNECTION_ID_TOO_LONG 1114 +#define SSL_R_SSL3_SESSION_ID_TOO_LONG 1113 +#define SSL_R_SSL3_SESSION_ID_TOO_SHORT 222 +#define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042 +#define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020 +#define SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED 1045 +#define SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED 1044 +#define SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN 1046 +#define SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE 1030 +#define SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE 1040 +#define SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER 1047 +#define SSL_R_SSLV3_ALERT_NO_CERTIFICATE 1041 +#define SSL_R_SSLV3_ALERT_PEER_ERROR_CERTIFICATE 223 +#define SSL_R_SSLV3_ALERT_PEER_ERROR_NO_CERTIFICATE 224 +#define SSL_R_SSLV3_ALERT_PEER_ERROR_NO_CIPHER 225 +#define SSL_R_SSLV3_ALERT_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE 226 +#define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010 +#define SSL_R_SSLV3_ALERT_UNKNOWN_REMOTE_ERROR_TYPE 227 +#define SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE 1043 +#define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION 228 +#define SSL_R_SSL_HANDSHAKE_FAILURE 229 +#define SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS 230 +#define SSL_R_SSL_SESSION_ID_CALLBACK_FAILED 1102 +#define SSL_R_SSL_SESSION_ID_CONFLICT 1103 +#define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG 273 +#define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH 1101 +#define SSL_R_SSL_SESSION_ID_IS_DIFFERENT 231 +#define SSL_R_TLSV1_ALERT_ACCESS_DENIED 1049 +#define SSL_R_TLSV1_ALERT_DECODE_ERROR 1050 +#define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED 1021 +#define SSL_R_TLSV1_ALERT_DECRYPT_ERROR 1051 +#define SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION 1060 +#define SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY 1071 +#define SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080 +#define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100 +#define SSL_R_TLSV1_ALERT_PROTOCOL_VERSION 1070 +#define SSL_R_TLSV1_ALERT_RECORD_OVERFLOW 1022 +#define SSL_R_TLSV1_ALERT_UNKNOWN_CA 1048 +#define SSL_R_TLSV1_ALERT_USER_CANCELLED 1090 +#define SSL_R_TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER 232 +#define SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST 233 +#define SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG 234 +#define SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER 235 +#define SSL_R_UNABLE_TO_DECODE_DH_CERTS 236 +#define SSL_R_UNABLE_TO_DECODE_ECDH_CERTS 1115 +#define SSL_R_UNABLE_TO_EXTRACT_PUBLIC_KEY 237 +#define SSL_R_UNABLE_TO_FIND_DH_PARAMETERS 238 +#define SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS 1116 +#define SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS 239 +#define SSL_R_UNABLE_TO_FIND_SSL_METHOD 240 +#define SSL_R_UNABLE_TO_LOAD_SSL2_MD5_ROUTINES 241 +#define SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES 242 +#define SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES 243 +#define SSL_R_UNEXPECTED_MESSAGE 244 +#define SSL_R_UNEXPECTED_RECORD 245 +#define SSL_R_UNINITIALIZED 276 +#define SSL_R_UNKNOWN_ALERT_TYPE 246 +#define SSL_R_UNKNOWN_CERTIFICATE_TYPE 247 +#define SSL_R_UNKNOWN_CIPHER_RETURNED 248 +#define SSL_R_UNKNOWN_CIPHER_TYPE 249 +#define SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE 250 +#define SSL_R_UNKNOWN_PKEY_TYPE 251 +#define SSL_R_UNKNOWN_PROTOCOL 252 +#define SSL_R_UNKNOWN_REMOTE_ERROR_TYPE 253 +#define SSL_R_UNKNOWN_SSL_VERSION 254 +#define SSL_R_UNKNOWN_STATE 255 +#define SSL_R_UNSUPPORTED_CIPHER 256 +#define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM 257 +#define SSL_R_UNSUPPORTED_ELLIPTIC_CURVE 1118 +#define SSL_R_UNSUPPORTED_OPTION 1091 +#define SSL_R_UNSUPPORTED_PROTOCOL 258 +#define SSL_R_UNSUPPORTED_SSL_VERSION 259 +#define SSL_R_WRITE_BIO_NOT_SET 260 +#define SSL_R_WRONG_CIPHER_RETURNED 261 +#define SSL_R_WRONG_MESSAGE_TYPE 262 +#define SSL_R_WRONG_NUMBER_OF_KEY_BITS 263 +#define SSL_R_WRONG_SIGNATURE_LENGTH 264 +#define SSL_R_WRONG_SIGNATURE_SIZE 265 +#define SSL_R_WRONG_SSL_VERSION 266 +#define SSL_R_WRONG_VERSION_NUMBER 267 +#define SSL_R_X509_LIB 268 +#define SSL_R_X509_VERIFICATION_SETUP_PROBLEMS 269 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/openssl/ssl2.h b/h/openssl/ssl2.h new file mode 100644 index 0000000..99a52ea --- /dev/null +++ b/h/openssl/ssl2.h @@ -0,0 +1,268 @@ +/* ssl/ssl2.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_SSL2_H +#define HEADER_SSL2_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Protocol Version Codes */ +#define SSL2_VERSION 0x0002 +#define SSL2_VERSION_MAJOR 0x00 +#define SSL2_VERSION_MINOR 0x02 +/* #define SSL2_CLIENT_VERSION 0x0002 */ +/* #define SSL2_SERVER_VERSION 0x0002 */ + +/* Protocol Message Codes */ +#define SSL2_MT_ERROR 0 +#define SSL2_MT_CLIENT_HELLO 1 +#define SSL2_MT_CLIENT_MASTER_KEY 2 +#define SSL2_MT_CLIENT_FINISHED 3 +#define SSL2_MT_SERVER_HELLO 4 +#define SSL2_MT_SERVER_VERIFY 5 +#define SSL2_MT_SERVER_FINISHED 6 +#define SSL2_MT_REQUEST_CERTIFICATE 7 +#define SSL2_MT_CLIENT_CERTIFICATE 8 + +/* Error Message Codes */ +#define SSL2_PE_UNDEFINED_ERROR 0x0000 +#define SSL2_PE_NO_CIPHER 0x0001 +#define SSL2_PE_NO_CERTIFICATE 0x0002 +#define SSL2_PE_BAD_CERTIFICATE 0x0004 +#define SSL2_PE_UNSUPPORTED_CERTIFICATE_TYPE 0x0006 + +/* Cipher Kind Values */ +#define SSL2_CK_NULL_WITH_MD5 0x02000000 /* v3 */ +#define SSL2_CK_RC4_128_WITH_MD5 0x02010080 +#define SSL2_CK_RC4_128_EXPORT40_WITH_MD5 0x02020080 +#define SSL2_CK_RC2_128_CBC_WITH_MD5 0x02030080 +#define SSL2_CK_RC2_128_CBC_EXPORT40_WITH_MD5 0x02040080 +#define SSL2_CK_IDEA_128_CBC_WITH_MD5 0x02050080 +#define SSL2_CK_DES_64_CBC_WITH_MD5 0x02060040 +#define SSL2_CK_DES_64_CBC_WITH_SHA 0x02060140 /* v3 */ +#define SSL2_CK_DES_192_EDE3_CBC_WITH_MD5 0x020700c0 +#define SSL2_CK_DES_192_EDE3_CBC_WITH_SHA 0x020701c0 /* v3 */ +#define SSL2_CK_RC4_64_WITH_MD5 0x02080080 /* MS hack */ + +#define SSL2_CK_DES_64_CFB64_WITH_MD5_1 0x02ff0800 /* SSLeay */ +#define SSL2_CK_NULL 0x02ff0810 /* SSLeay */ + +#define SSL2_TXT_DES_64_CFB64_WITH_MD5_1 "DES-CFB-M1" +#define SSL2_TXT_NULL_WITH_MD5 "NULL-MD5" +#define SSL2_TXT_RC4_128_WITH_MD5 "RC4-MD5" +#define SSL2_TXT_RC4_128_EXPORT40_WITH_MD5 "EXP-RC4-MD5" +#define SSL2_TXT_RC2_128_CBC_WITH_MD5 "RC2-CBC-MD5" +#define SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5 "EXP-RC2-CBC-MD5" +#define SSL2_TXT_IDEA_128_CBC_WITH_MD5 "IDEA-CBC-MD5" +#define SSL2_TXT_DES_64_CBC_WITH_MD5 "DES-CBC-MD5" +#define SSL2_TXT_DES_64_CBC_WITH_SHA "DES-CBC-SHA" +#define SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5 "DES-CBC3-MD5" +#define SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA "DES-CBC3-SHA" +#define SSL2_TXT_RC4_64_WITH_MD5 "RC4-64-MD5" + +#define SSL2_TXT_NULL "NULL" + +/* Flags for the SSL_CIPHER.algorithm2 field */ +#define SSL2_CF_5_BYTE_ENC 0x01 +#define SSL2_CF_8_BYTE_ENC 0x02 + +/* Certificate Type Codes */ +#define SSL2_CT_X509_CERTIFICATE 0x01 + +/* Authentication Type Code */ +#define SSL2_AT_MD5_WITH_RSA_ENCRYPTION 0x01 + +#define SSL2_MAX_SSL_SESSION_ID_LENGTH 32 + +/* Upper/Lower Bounds */ +#define SSL2_MAX_MASTER_KEY_LENGTH_IN_BITS 256 +#ifdef OPENSSL_SYS_MPE +#define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER 29998u +#else +#define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER 32767u /* 2^15-1 */ +#endif +#define SSL2_MAX_RECORD_LENGTH_3_BYTE_HEADER 16383 /* 2^14-1 */ + +#define SSL2_CHALLENGE_LENGTH 16 +/*#define SSL2_CHALLENGE_LENGTH 32 */ +#define SSL2_MIN_CHALLENGE_LENGTH 16 +#define SSL2_MAX_CHALLENGE_LENGTH 32 +#define SSL2_CONNECTION_ID_LENGTH 16 +#define SSL2_MAX_CONNECTION_ID_LENGTH 16 +#define SSL2_SSL_SESSION_ID_LENGTH 16 +#define SSL2_MAX_CERT_CHALLENGE_LENGTH 32 +#define SSL2_MIN_CERT_CHALLENGE_LENGTH 16 +#define SSL2_MAX_KEY_MATERIAL_LENGTH 24 + +#ifndef HEADER_SSL_LOCL_H +#define CERT char +#endif + +typedef struct ssl2_state_st + { + int three_byte_header; + int clear_text; /* clear text */ + int escape; /* not used in SSLv2 */ + int ssl2_rollback; /* used if SSLv23 rolled back to SSLv2 */ + + /* non-blocking io info, used to make sure the same + * args were passwd */ + unsigned int wnum; /* number of bytes sent so far */ + int wpend_tot; + const unsigned char *wpend_buf; + + int wpend_off; /* offset to data to write */ + int wpend_len; /* number of bytes passwd to write */ + int wpend_ret; /* number of bytes to return to caller */ + + /* buffer raw data */ + int rbuf_left; + int rbuf_offs; + unsigned char *rbuf; + unsigned char *wbuf; + + unsigned char *write_ptr;/* used to point to the start due to + * 2/3 byte header. */ + + unsigned int padding; + unsigned int rlength; /* passed to ssl2_enc */ + int ract_data_length; /* Set when things are encrypted. */ + unsigned int wlength; /* passed to ssl2_enc */ + int wact_data_length; /* Set when things are decrypted. */ + unsigned char *ract_data; + unsigned char *wact_data; + unsigned char *mac_data; + + unsigned char *read_key; + unsigned char *write_key; + + /* Stuff specifically to do with this SSL session */ + unsigned int challenge_length; + unsigned char challenge[SSL2_MAX_CHALLENGE_LENGTH]; + unsigned int conn_id_length; + unsigned char conn_id[SSL2_MAX_CONNECTION_ID_LENGTH]; + unsigned int key_material_length; + unsigned char key_material[SSL2_MAX_KEY_MATERIAL_LENGTH*2]; + + unsigned long read_sequence; + unsigned long write_sequence; + + struct { + unsigned int conn_id_length; + unsigned int cert_type; + unsigned int cert_length; + unsigned int csl; + unsigned int clear; + unsigned int enc; + unsigned char ccl[SSL2_MAX_CERT_CHALLENGE_LENGTH]; + unsigned int cipher_spec_length; + unsigned int session_id_length; + unsigned int clen; + unsigned int rlen; + } tmp; + } SSL2_STATE; + +/* SSLv2 */ +/* client */ +#define SSL2_ST_SEND_CLIENT_HELLO_A (0x10|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_HELLO_B (0x11|SSL_ST_CONNECT) +#define SSL2_ST_GET_SERVER_HELLO_A (0x20|SSL_ST_CONNECT) +#define SSL2_ST_GET_SERVER_HELLO_B (0x21|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_MASTER_KEY_A (0x30|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_MASTER_KEY_B (0x31|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_FINISHED_A (0x40|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_FINISHED_B (0x41|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_CERTIFICATE_A (0x50|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_CERTIFICATE_B (0x51|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_CERTIFICATE_C (0x52|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_CERTIFICATE_D (0x53|SSL_ST_CONNECT) +#define SSL2_ST_GET_SERVER_VERIFY_A (0x60|SSL_ST_CONNECT) +#define SSL2_ST_GET_SERVER_VERIFY_B (0x61|SSL_ST_CONNECT) +#define SSL2_ST_GET_SERVER_FINISHED_A (0x70|SSL_ST_CONNECT) +#define SSL2_ST_GET_SERVER_FINISHED_B (0x71|SSL_ST_CONNECT) +#define SSL2_ST_CLIENT_START_ENCRYPTION (0x80|SSL_ST_CONNECT) +#define SSL2_ST_X509_GET_CLIENT_CERTIFICATE (0x90|SSL_ST_CONNECT) +/* server */ +#define SSL2_ST_GET_CLIENT_HELLO_A (0x10|SSL_ST_ACCEPT) +#define SSL2_ST_GET_CLIENT_HELLO_B (0x11|SSL_ST_ACCEPT) +#define SSL2_ST_GET_CLIENT_HELLO_C (0x12|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_HELLO_A (0x20|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_HELLO_B (0x21|SSL_ST_ACCEPT) +#define SSL2_ST_GET_CLIENT_MASTER_KEY_A (0x30|SSL_ST_ACCEPT) +#define SSL2_ST_GET_CLIENT_MASTER_KEY_B (0x31|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_VERIFY_A (0x40|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_VERIFY_B (0x41|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_VERIFY_C (0x42|SSL_ST_ACCEPT) +#define SSL2_ST_GET_CLIENT_FINISHED_A (0x50|SSL_ST_ACCEPT) +#define SSL2_ST_GET_CLIENT_FINISHED_B (0x51|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_FINISHED_A (0x60|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_FINISHED_B (0x61|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_REQUEST_CERTIFICATE_A (0x70|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_REQUEST_CERTIFICATE_B (0x71|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_REQUEST_CERTIFICATE_C (0x72|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_REQUEST_CERTIFICATE_D (0x73|SSL_ST_ACCEPT) +#define SSL2_ST_SERVER_START_ENCRYPTION (0x80|SSL_ST_ACCEPT) +#define SSL2_ST_X509_GET_SERVER_CERTIFICATE (0x90|SSL_ST_ACCEPT) + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/h/openssl/ssl23.h b/h/openssl/ssl23.h new file mode 100644 index 0000000..d322898 --- /dev/null +++ b/h/openssl/ssl23.h @@ -0,0 +1,83 @@ +/* ssl/ssl23.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_SSL23_H +#define HEADER_SSL23_H + +#ifdef __cplusplus +extern "C" { +#endif + +/*client */ +/* write to server */ +#define SSL23_ST_CW_CLNT_HELLO_A (0x210|SSL_ST_CONNECT) +#define SSL23_ST_CW_CLNT_HELLO_B (0x211|SSL_ST_CONNECT) +/* read from server */ +#define SSL23_ST_CR_SRVR_HELLO_A (0x220|SSL_ST_CONNECT) +#define SSL23_ST_CR_SRVR_HELLO_B (0x221|SSL_ST_CONNECT) + +/* server */ +/* read from client */ +#define SSL23_ST_SR_CLNT_HELLO_A (0x210|SSL_ST_ACCEPT) +#define SSL23_ST_SR_CLNT_HELLO_B (0x211|SSL_ST_ACCEPT) + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/h/openssl/ssl3.h b/h/openssl/ssl3.h new file mode 100644 index 0000000..1e762f2 --- /dev/null +++ b/h/openssl/ssl3.h @@ -0,0 +1,551 @@ +/* ssl/ssl3.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * ECC cipher suite support in OpenSSL originally developed by + * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. + */ + +#ifndef HEADER_SSL3_H +#define HEADER_SSL3_H + +#ifndef OPENSSL_NO_COMP +#include +#endif +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define SSL3_CK_RSA_NULL_MD5 0x03000001 +#define SSL3_CK_RSA_NULL_SHA 0x03000002 +#define SSL3_CK_RSA_RC4_40_MD5 0x03000003 +#define SSL3_CK_RSA_RC4_128_MD5 0x03000004 +#define SSL3_CK_RSA_RC4_128_SHA 0x03000005 +#define SSL3_CK_RSA_RC2_40_MD5 0x03000006 +#define SSL3_CK_RSA_IDEA_128_SHA 0x03000007 +#define SSL3_CK_RSA_DES_40_CBC_SHA 0x03000008 +#define SSL3_CK_RSA_DES_64_CBC_SHA 0x03000009 +#define SSL3_CK_RSA_DES_192_CBC3_SHA 0x0300000A + +#define SSL3_CK_DH_DSS_DES_40_CBC_SHA 0x0300000B +#define SSL3_CK_DH_DSS_DES_64_CBC_SHA 0x0300000C +#define SSL3_CK_DH_DSS_DES_192_CBC3_SHA 0x0300000D +#define SSL3_CK_DH_RSA_DES_40_CBC_SHA 0x0300000E +#define SSL3_CK_DH_RSA_DES_64_CBC_SHA 0x0300000F +#define SSL3_CK_DH_RSA_DES_192_CBC3_SHA 0x03000010 + +#define SSL3_CK_EDH_DSS_DES_40_CBC_SHA 0x03000011 +#define SSL3_CK_EDH_DSS_DES_64_CBC_SHA 0x03000012 +#define SSL3_CK_EDH_DSS_DES_192_CBC3_SHA 0x03000013 +#define SSL3_CK_EDH_RSA_DES_40_CBC_SHA 0x03000014 +#define SSL3_CK_EDH_RSA_DES_64_CBC_SHA 0x03000015 +#define SSL3_CK_EDH_RSA_DES_192_CBC3_SHA 0x03000016 + +#define SSL3_CK_ADH_RC4_40_MD5 0x03000017 +#define SSL3_CK_ADH_RC4_128_MD5 0x03000018 +#define SSL3_CK_ADH_DES_40_CBC_SHA 0x03000019 +#define SSL3_CK_ADH_DES_64_CBC_SHA 0x0300001A +#define SSL3_CK_ADH_DES_192_CBC_SHA 0x0300001B + +#define SSL3_CK_FZA_DMS_NULL_SHA 0x0300001C +#define SSL3_CK_FZA_DMS_FZA_SHA 0x0300001D +#if 0 /* Because it clashes with KRB5, is never used any more, and is safe + to remove according to David Hopwood + of the ietf-tls list */ +#define SSL3_CK_FZA_DMS_RC4_SHA 0x0300001E +#endif + +/* VRS Additional Kerberos5 entries + */ +#define SSL3_CK_KRB5_DES_64_CBC_SHA 0x0300001E +#define SSL3_CK_KRB5_DES_192_CBC3_SHA 0x0300001F +#define SSL3_CK_KRB5_RC4_128_SHA 0x03000020 +#define SSL3_CK_KRB5_IDEA_128_CBC_SHA 0x03000021 +#define SSL3_CK_KRB5_DES_64_CBC_MD5 0x03000022 +#define SSL3_CK_KRB5_DES_192_CBC3_MD5 0x03000023 +#define SSL3_CK_KRB5_RC4_128_MD5 0x03000024 +#define SSL3_CK_KRB5_IDEA_128_CBC_MD5 0x03000025 + +#define SSL3_CK_KRB5_DES_40_CBC_SHA 0x03000026 +#define SSL3_CK_KRB5_RC2_40_CBC_SHA 0x03000027 +#define SSL3_CK_KRB5_RC4_40_SHA 0x03000028 +#define SSL3_CK_KRB5_DES_40_CBC_MD5 0x03000029 +#define SSL3_CK_KRB5_RC2_40_CBC_MD5 0x0300002A +#define SSL3_CK_KRB5_RC4_40_MD5 0x0300002B + +#define SSL3_TXT_RSA_NULL_MD5 "NULL-MD5" +#define SSL3_TXT_RSA_NULL_SHA "NULL-SHA" +#define SSL3_TXT_RSA_RC4_40_MD5 "EXP-RC4-MD5" +#define SSL3_TXT_RSA_RC4_128_MD5 "RC4-MD5" +#define SSL3_TXT_RSA_RC4_128_SHA "RC4-SHA" +#define SSL3_TXT_RSA_RC2_40_MD5 "EXP-RC2-CBC-MD5" +#define SSL3_TXT_RSA_IDEA_128_SHA "IDEA-CBC-SHA" +#define SSL3_TXT_RSA_DES_40_CBC_SHA "EXP-DES-CBC-SHA" +#define SSL3_TXT_RSA_DES_64_CBC_SHA "DES-CBC-SHA" +#define SSL3_TXT_RSA_DES_192_CBC3_SHA "DES-CBC3-SHA" + +#define SSL3_TXT_DH_DSS_DES_40_CBC_SHA "EXP-DH-DSS-DES-CBC-SHA" +#define SSL3_TXT_DH_DSS_DES_64_CBC_SHA "DH-DSS-DES-CBC-SHA" +#define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA "DH-DSS-DES-CBC3-SHA" +#define SSL3_TXT_DH_RSA_DES_40_CBC_SHA "EXP-DH-RSA-DES-CBC-SHA" +#define SSL3_TXT_DH_RSA_DES_64_CBC_SHA "DH-RSA-DES-CBC-SHA" +#define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA "DH-RSA-DES-CBC3-SHA" + +#define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA "EXP-EDH-DSS-DES-CBC-SHA" +#define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA "EDH-DSS-DES-CBC-SHA" +#define SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA "EDH-DSS-DES-CBC3-SHA" +#define SSL3_TXT_EDH_RSA_DES_40_CBC_SHA "EXP-EDH-RSA-DES-CBC-SHA" +#define SSL3_TXT_EDH_RSA_DES_64_CBC_SHA "EDH-RSA-DES-CBC-SHA" +#define SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA "EDH-RSA-DES-CBC3-SHA" + +#define SSL3_TXT_ADH_RC4_40_MD5 "EXP-ADH-RC4-MD5" +#define SSL3_TXT_ADH_RC4_128_MD5 "ADH-RC4-MD5" +#define SSL3_TXT_ADH_DES_40_CBC_SHA "EXP-ADH-DES-CBC-SHA" +#define SSL3_TXT_ADH_DES_64_CBC_SHA "ADH-DES-CBC-SHA" +#define SSL3_TXT_ADH_DES_192_CBC_SHA "ADH-DES-CBC3-SHA" + +#define SSL3_TXT_FZA_DMS_NULL_SHA "FZA-NULL-SHA" +#define SSL3_TXT_FZA_DMS_FZA_SHA "FZA-FZA-CBC-SHA" +#define SSL3_TXT_FZA_DMS_RC4_SHA "FZA-RC4-SHA" + +#define SSL3_TXT_KRB5_DES_64_CBC_SHA "KRB5-DES-CBC-SHA" +#define SSL3_TXT_KRB5_DES_192_CBC3_SHA "KRB5-DES-CBC3-SHA" +#define SSL3_TXT_KRB5_RC4_128_SHA "KRB5-RC4-SHA" +#define SSL3_TXT_KRB5_IDEA_128_CBC_SHA "KRB5-IDEA-CBC-SHA" +#define SSL3_TXT_KRB5_DES_64_CBC_MD5 "KRB5-DES-CBC-MD5" +#define SSL3_TXT_KRB5_DES_192_CBC3_MD5 "KRB5-DES-CBC3-MD5" +#define SSL3_TXT_KRB5_RC4_128_MD5 "KRB5-RC4-MD5" +#define SSL3_TXT_KRB5_IDEA_128_CBC_MD5 "KRB5-IDEA-CBC-MD5" + +#define SSL3_TXT_KRB5_DES_40_CBC_SHA "EXP-KRB5-DES-CBC-SHA" +#define SSL3_TXT_KRB5_RC2_40_CBC_SHA "EXP-KRB5-RC2-CBC-SHA" +#define SSL3_TXT_KRB5_RC4_40_SHA "EXP-KRB5-RC4-SHA" +#define SSL3_TXT_KRB5_DES_40_CBC_MD5 "EXP-KRB5-DES-CBC-MD5" +#define SSL3_TXT_KRB5_RC2_40_CBC_MD5 "EXP-KRB5-RC2-CBC-MD5" +#define SSL3_TXT_KRB5_RC4_40_MD5 "EXP-KRB5-RC4-MD5" + +#define SSL3_SSL_SESSION_ID_LENGTH 32 +#define SSL3_MAX_SSL_SESSION_ID_LENGTH 32 + +#define SSL3_MASTER_SECRET_SIZE 48 +#define SSL3_RANDOM_SIZE 32 +#define SSL3_SESSION_ID_SIZE 32 +#define SSL3_RT_HEADER_LENGTH 5 + +/* Due to MS stuffing up, this can change.... */ +#if defined(OPENSSL_SYS_WIN16) || \ + (defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32)) +#define SSL3_RT_MAX_EXTRA (14000) +#else +#define SSL3_RT_MAX_EXTRA (16384) +#endif + +#define SSL3_RT_MAX_PLAIN_LENGTH 16384 +#define SSL3_RT_MAX_COMPRESSED_LENGTH (1024+SSL3_RT_MAX_PLAIN_LENGTH) +#define SSL3_RT_MAX_ENCRYPTED_LENGTH (1024+SSL3_RT_MAX_COMPRESSED_LENGTH) +#define SSL3_RT_MAX_PACKET_SIZE (SSL3_RT_MAX_ENCRYPTED_LENGTH+SSL3_RT_HEADER_LENGTH) +#define SSL3_RT_MAX_DATA_SIZE (1024*1024) + +#define SSL3_MD_CLIENT_FINISHED_CONST "\x43\x4C\x4E\x54" +#define SSL3_MD_SERVER_FINISHED_CONST "\x53\x52\x56\x52" + +#define SSL3_VERSION 0x0300 +#define SSL3_VERSION_MAJOR 0x03 +#define SSL3_VERSION_MINOR 0x00 + +#define SSL3_RT_CHANGE_CIPHER_SPEC 20 +#define SSL3_RT_ALERT 21 +#define SSL3_RT_HANDSHAKE 22 +#define SSL3_RT_APPLICATION_DATA 23 + +#define SSL3_AL_WARNING 1 +#define SSL3_AL_FATAL 2 + +#define SSL3_AD_CLOSE_NOTIFY 0 +#define SSL3_AD_UNEXPECTED_MESSAGE 10 /* fatal */ +#define SSL3_AD_BAD_RECORD_MAC 20 /* fatal */ +#define SSL3_AD_DECOMPRESSION_FAILURE 30 /* fatal */ +#define SSL3_AD_HANDSHAKE_FAILURE 40 /* fatal */ +#define SSL3_AD_NO_CERTIFICATE 41 +#define SSL3_AD_BAD_CERTIFICATE 42 +#define SSL3_AD_UNSUPPORTED_CERTIFICATE 43 +#define SSL3_AD_CERTIFICATE_REVOKED 44 +#define SSL3_AD_CERTIFICATE_EXPIRED 45 +#define SSL3_AD_CERTIFICATE_UNKNOWN 46 +#define SSL3_AD_ILLEGAL_PARAMETER 47 /* fatal */ + +typedef struct ssl3_record_st + { +/*r */ int type; /* type of record */ +/*rw*/ unsigned int length; /* How many bytes available */ +/*r */ unsigned int off; /* read/write offset into 'buf' */ +/*rw*/ unsigned char *data; /* pointer to the record data */ +/*rw*/ unsigned char *input; /* where the decode bytes are */ +/*r */ unsigned char *comp; /* only used with decompression - malloc()ed */ +/*r */ unsigned long epoch; /* epoch number, needed by DTLS1 */ +/*r */ PQ_64BIT seq_num; /* sequence number, needed by DTLS1 */ + } SSL3_RECORD; + +typedef struct ssl3_buffer_st + { + unsigned char *buf; /* at least SSL3_RT_MAX_PACKET_SIZE bytes, + * see ssl3_setup_buffers() */ + size_t len; /* buffer size */ + int offset; /* where to 'copy from' */ + int left; /* how many bytes left */ + } SSL3_BUFFER; + +#define SSL3_CT_RSA_SIGN 1 +#define SSL3_CT_DSS_SIGN 2 +#define SSL3_CT_RSA_FIXED_DH 3 +#define SSL3_CT_DSS_FIXED_DH 4 +#define SSL3_CT_RSA_EPHEMERAL_DH 5 +#define SSL3_CT_DSS_EPHEMERAL_DH 6 +#define SSL3_CT_FORTEZZA_DMS 20 +/* SSL3_CT_NUMBER is used to size arrays and it must be large + * enough to contain all of the cert types defined either for + * SSLv3 and TLSv1. + */ +#define SSL3_CT_NUMBER 7 + + +#define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS 0x0001 +#define SSL3_FLAGS_DELAY_CLIENT_FINISHED 0x0002 +#define SSL3_FLAGS_POP_BUFFER 0x0004 +#define TLS1_FLAGS_TLS_PADDING_BUG 0x0008 + +typedef struct ssl3_state_st + { + long flags; + int delay_buf_pop_ret; + + unsigned char read_sequence[8]; + unsigned char read_mac_secret[EVP_MAX_MD_SIZE]; + unsigned char write_sequence[8]; + unsigned char write_mac_secret[EVP_MAX_MD_SIZE]; + + unsigned char server_random[SSL3_RANDOM_SIZE]; + unsigned char client_random[SSL3_RANDOM_SIZE]; + + /* flags for countermeasure against known-IV weakness */ + int need_empty_fragments; + int empty_fragment_done; + + SSL3_BUFFER rbuf; /* read IO goes into here */ + SSL3_BUFFER wbuf; /* write IO goes into here */ + + SSL3_RECORD rrec; /* each decoded record goes in here */ + SSL3_RECORD wrec; /* goes out from here */ + + /* storage for Alert/Handshake protocol data received but not + * yet processed by ssl3_read_bytes: */ + unsigned char alert_fragment[2]; + unsigned int alert_fragment_len; + unsigned char handshake_fragment[4]; + unsigned int handshake_fragment_len; + + /* partial write - check the numbers match */ + unsigned int wnum; /* number of bytes sent so far */ + int wpend_tot; /* number bytes written */ + int wpend_type; + int wpend_ret; /* number of bytes submitted */ + const unsigned char *wpend_buf; + + /* used during startup, digest all incoming/outgoing packets */ + EVP_MD_CTX finish_dgst1; + EVP_MD_CTX finish_dgst2; + + /* this is set whenerver we see a change_cipher_spec message + * come in when we are not looking for one */ + int change_cipher_spec; + + int warn_alert; + int fatal_alert; + /* we allow one fatal and one warning alert to be outstanding, + * send close alert via the warning alert */ + int alert_dispatch; + unsigned char send_alert[2]; + + /* This flag is set when we should renegotiate ASAP, basically when + * there is no more data in the read or write buffers */ + int renegotiate; + int total_renegotiations; + int num_renegotiations; + + int in_read_app_data; + + struct { + /* actually only needs to be 16+20 */ + unsigned char cert_verify_md[EVP_MAX_MD_SIZE*2]; + + /* actually only need to be 16+20 for SSLv3 and 12 for TLS */ + unsigned char finish_md[EVP_MAX_MD_SIZE*2]; + int finish_md_len; + unsigned char peer_finish_md[EVP_MAX_MD_SIZE*2]; + int peer_finish_md_len; + + unsigned long message_size; + int message_type; + + /* used to hold the new cipher we are going to use */ + SSL_CIPHER *new_cipher; +#ifndef OPENSSL_NO_DH + DH *dh; +#endif + +#ifndef OPENSSL_NO_ECDH + EC_KEY *ecdh; /* holds short lived ECDH key */ +#endif + + /* used when SSL_ST_FLUSH_DATA is entered */ + int next_state; + + int reuse_message; + + /* used for certificate requests */ + int cert_req; + int ctype_num; + char ctype[SSL3_CT_NUMBER]; + STACK_OF(X509_NAME) *ca_names; + + int use_rsa_tmp; + + int key_block_length; + unsigned char *key_block; + + const EVP_CIPHER *new_sym_enc; + const EVP_MD *new_hash; +#ifndef OPENSSL_NO_COMP + const SSL_COMP *new_compression; +#else + char *new_compression; +#endif + int cert_request; + } tmp; + + } SSL3_STATE; + + +/* SSLv3 */ +/*client */ +/* extra state */ +#define SSL3_ST_CW_FLUSH (0x100|SSL_ST_CONNECT) +/* write to server */ +#define SSL3_ST_CW_CLNT_HELLO_A (0x110|SSL_ST_CONNECT) +#define SSL3_ST_CW_CLNT_HELLO_B (0x111|SSL_ST_CONNECT) +/* read from server */ +#define SSL3_ST_CR_SRVR_HELLO_A (0x120|SSL_ST_CONNECT) +#define SSL3_ST_CR_SRVR_HELLO_B (0x121|SSL_ST_CONNECT) +#define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A (0x126|SSL_ST_CONNECT) +#define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B (0x127|SSL_ST_CONNECT) +#define SSL3_ST_CR_CERT_A (0x130|SSL_ST_CONNECT) +#define SSL3_ST_CR_CERT_B (0x131|SSL_ST_CONNECT) +#define SSL3_ST_CR_KEY_EXCH_A (0x140|SSL_ST_CONNECT) +#define SSL3_ST_CR_KEY_EXCH_B (0x141|SSL_ST_CONNECT) +#define SSL3_ST_CR_CERT_REQ_A (0x150|SSL_ST_CONNECT) +#define SSL3_ST_CR_CERT_REQ_B (0x151|SSL_ST_CONNECT) +#define SSL3_ST_CR_SRVR_DONE_A (0x160|SSL_ST_CONNECT) +#define SSL3_ST_CR_SRVR_DONE_B (0x161|SSL_ST_CONNECT) +/* write to server */ +#define SSL3_ST_CW_CERT_A (0x170|SSL_ST_CONNECT) +#define SSL3_ST_CW_CERT_B (0x171|SSL_ST_CONNECT) +#define SSL3_ST_CW_CERT_C (0x172|SSL_ST_CONNECT) +#define SSL3_ST_CW_CERT_D (0x173|SSL_ST_CONNECT) +#define SSL3_ST_CW_KEY_EXCH_A (0x180|SSL_ST_CONNECT) +#define SSL3_ST_CW_KEY_EXCH_B (0x181|SSL_ST_CONNECT) +#define SSL3_ST_CW_CERT_VRFY_A (0x190|SSL_ST_CONNECT) +#define SSL3_ST_CW_CERT_VRFY_B (0x191|SSL_ST_CONNECT) +#define SSL3_ST_CW_CHANGE_A (0x1A0|SSL_ST_CONNECT) +#define SSL3_ST_CW_CHANGE_B (0x1A1|SSL_ST_CONNECT) +#define SSL3_ST_CW_FINISHED_A (0x1B0|SSL_ST_CONNECT) +#define SSL3_ST_CW_FINISHED_B (0x1B1|SSL_ST_CONNECT) +/* read from server */ +#define SSL3_ST_CR_CHANGE_A (0x1C0|SSL_ST_CONNECT) +#define SSL3_ST_CR_CHANGE_B (0x1C1|SSL_ST_CONNECT) +#define SSL3_ST_CR_FINISHED_A (0x1D0|SSL_ST_CONNECT) +#define SSL3_ST_CR_FINISHED_B (0x1D1|SSL_ST_CONNECT) + +/* server */ +/* extra state */ +#define SSL3_ST_SW_FLUSH (0x100|SSL_ST_ACCEPT) +/* read from client */ +/* Do not change the number values, they do matter */ +#define SSL3_ST_SR_CLNT_HELLO_A (0x110|SSL_ST_ACCEPT) +#define SSL3_ST_SR_CLNT_HELLO_B (0x111|SSL_ST_ACCEPT) +#define SSL3_ST_SR_CLNT_HELLO_C (0x112|SSL_ST_ACCEPT) +/* write to client */ +#define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_A (0x113|SSL_ST_ACCEPT) +#define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_B (0x114|SSL_ST_ACCEPT) +#define SSL3_ST_SW_HELLO_REQ_A (0x120|SSL_ST_ACCEPT) +#define SSL3_ST_SW_HELLO_REQ_B (0x121|SSL_ST_ACCEPT) +#define SSL3_ST_SW_HELLO_REQ_C (0x122|SSL_ST_ACCEPT) +#define SSL3_ST_SW_SRVR_HELLO_A (0x130|SSL_ST_ACCEPT) +#define SSL3_ST_SW_SRVR_HELLO_B (0x131|SSL_ST_ACCEPT) +#define SSL3_ST_SW_CERT_A (0x140|SSL_ST_ACCEPT) +#define SSL3_ST_SW_CERT_B (0x141|SSL_ST_ACCEPT) +#define SSL3_ST_SW_KEY_EXCH_A (0x150|SSL_ST_ACCEPT) +#define SSL3_ST_SW_KEY_EXCH_B (0x151|SSL_ST_ACCEPT) +#define SSL3_ST_SW_CERT_REQ_A (0x160|SSL_ST_ACCEPT) +#define SSL3_ST_SW_CERT_REQ_B (0x161|SSL_ST_ACCEPT) +#define SSL3_ST_SW_SRVR_DONE_A (0x170|SSL_ST_ACCEPT) +#define SSL3_ST_SW_SRVR_DONE_B (0x171|SSL_ST_ACCEPT) +/* read from client */ +#define SSL3_ST_SR_CERT_A (0x180|SSL_ST_ACCEPT) +#define SSL3_ST_SR_CERT_B (0x181|SSL_ST_ACCEPT) +#define SSL3_ST_SR_KEY_EXCH_A (0x190|SSL_ST_ACCEPT) +#define SSL3_ST_SR_KEY_EXCH_B (0x191|SSL_ST_ACCEPT) +#define SSL3_ST_SR_CERT_VRFY_A (0x1A0|SSL_ST_ACCEPT) +#define SSL3_ST_SR_CERT_VRFY_B (0x1A1|SSL_ST_ACCEPT) +#define SSL3_ST_SR_CHANGE_A (0x1B0|SSL_ST_ACCEPT) +#define SSL3_ST_SR_CHANGE_B (0x1B1|SSL_ST_ACCEPT) +#define SSL3_ST_SR_FINISHED_A (0x1C0|SSL_ST_ACCEPT) +#define SSL3_ST_SR_FINISHED_B (0x1C1|SSL_ST_ACCEPT) +/* write to client */ +#define SSL3_ST_SW_CHANGE_A (0x1D0|SSL_ST_ACCEPT) +#define SSL3_ST_SW_CHANGE_B (0x1D1|SSL_ST_ACCEPT) +#define SSL3_ST_SW_FINISHED_A (0x1E0|SSL_ST_ACCEPT) +#define SSL3_ST_SW_FINISHED_B (0x1E1|SSL_ST_ACCEPT) + +#define SSL3_MT_HELLO_REQUEST 0 +#define SSL3_MT_CLIENT_HELLO 1 +#define SSL3_MT_SERVER_HELLO 2 +#define SSL3_MT_CERTIFICATE 11 +#define SSL3_MT_SERVER_KEY_EXCHANGE 12 +#define SSL3_MT_CERTIFICATE_REQUEST 13 +#define SSL3_MT_SERVER_DONE 14 +#define SSL3_MT_CERTIFICATE_VERIFY 15 +#define SSL3_MT_CLIENT_KEY_EXCHANGE 16 +#define SSL3_MT_FINISHED 20 +#define DTLS1_MT_HELLO_VERIFY_REQUEST 3 + + +#define SSL3_MT_CCS 1 + +/* These are used when changing over to a new cipher */ +#define SSL3_CC_READ 0x01 +#define SSL3_CC_WRITE 0x02 +#define SSL3_CC_CLIENT 0x10 +#define SSL3_CC_SERVER 0x20 +#define SSL3_CHANGE_CIPHER_CLIENT_WRITE (SSL3_CC_CLIENT|SSL3_CC_WRITE) +#define SSL3_CHANGE_CIPHER_SERVER_READ (SSL3_CC_SERVER|SSL3_CC_READ) +#define SSL3_CHANGE_CIPHER_CLIENT_READ (SSL3_CC_CLIENT|SSL3_CC_READ) +#define SSL3_CHANGE_CIPHER_SERVER_WRITE (SSL3_CC_SERVER|SSL3_CC_WRITE) + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/h/openssl/stack.h b/h/openssl/stack.h new file mode 100644 index 0000000..5cbb116 --- /dev/null +++ b/h/openssl/stack.h @@ -0,0 +1,109 @@ +/* crypto/stack/stack.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_STACK_H +#define HEADER_STACK_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct stack_st + { + int num; + char **data; + int sorted; + + int num_alloc; + int (*comp)(const char * const *, const char * const *); + } STACK; + +#define M_sk_num(sk) ((sk) ? (sk)->num:-1) +#define M_sk_value(sk,n) ((sk) ? (sk)->data[n] : NULL) + +int sk_num(const STACK *); +char *sk_value(const STACK *, int); + +char *sk_set(STACK *, int, char *); + +STACK *sk_new(int (*cmp)(const char * const *, const char * const *)); +STACK *sk_new_null(void); +void sk_free(STACK *); +void sk_pop_free(STACK *st, void (*func)(void *)); +int sk_insert(STACK *sk,char *data,int where); +char *sk_delete(STACK *st,int loc); +char *sk_delete_ptr(STACK *st, char *p); +int sk_find(STACK *st,char *data); +int sk_find_ex(STACK *st,char *data); +int sk_push(STACK *st,char *data); +int sk_unshift(STACK *st,char *data); +char *sk_shift(STACK *st); +char *sk_pop(STACK *st); +void sk_zero(STACK *st); +int (*sk_set_cmp_func(STACK *sk, int (*c)(const char * const *, + const char * const *))) + (const char * const *, const char * const *); +STACK *sk_dup(STACK *st); +void sk_sort(STACK *st); +int sk_is_sorted(const STACK *st); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/openssl/store.h b/h/openssl/store.h new file mode 100644 index 0000000..6458337 --- /dev/null +++ b/h/openssl/store.h @@ -0,0 +1,554 @@ +/* crypto/store/store.h -*- mode:C; c-file-style: "eay" -*- */ +/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL + * project 2003. + */ +/* ==================================================================== + * Copyright (c) 2003 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_STORE_H +#define HEADER_STORE_H + +#include +#ifndef OPENSSL_NO_DEPRECATED +#include +#include +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Already defined in ossl_typ.h */ +/* typedef struct store_st STORE; */ +/* typedef struct store_method_st STORE_METHOD; */ + + +/* All the following functions return 0, a negative number or NULL on error. + When everything is fine, they return a positive value or a non-NULL + pointer, all depending on their purpose. */ + +/* Creators and destructor. */ +STORE *STORE_new_method(const STORE_METHOD *method); +STORE *STORE_new_engine(ENGINE *engine); +void STORE_free(STORE *ui); + + +/* Give a user interface parametrised control commands. This can be used to + send down an integer, a data pointer or a function pointer, as well as + be used to get information from a STORE. */ +int STORE_ctrl(STORE *store, int cmd, long i, void *p, void (*f)(void)); + +/* A control to set the directory with keys and certificates. Used by the + built-in directory level method. */ +#define STORE_CTRL_SET_DIRECTORY 0x0001 +/* A control to set a file to load. Used by the built-in file level method. */ +#define STORE_CTRL_SET_FILE 0x0002 +/* A control to set a configuration file to load. Can be used by any method + that wishes to load a configuration file. */ +#define STORE_CTRL_SET_CONF_FILE 0x0003 +/* A control to set a the section of the loaded configuration file. Can be + used by any method that wishes to load a configuration file. */ +#define STORE_CTRL_SET_CONF_SECTION 0x0004 + + +/* Some methods may use extra data */ +#define STORE_set_app_data(s,arg) STORE_set_ex_data(s,0,arg) +#define STORE_get_app_data(s) STORE_get_ex_data(s,0) +int STORE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); +int STORE_set_ex_data(STORE *r,int idx,void *arg); +void *STORE_get_ex_data(STORE *r, int idx); + +/* Use specific methods instead of the built-in one */ +const STORE_METHOD *STORE_get_method(STORE *store); +const STORE_METHOD *STORE_set_method(STORE *store, const STORE_METHOD *meth); + +/* The standard OpenSSL methods. */ +/* This is the in-memory method. It does everything except revoking and updating, + and is of course volatile. It's used by other methods that have an in-memory + cache. */ +const STORE_METHOD *STORE_Memory(void); +#if 0 /* Not yet implemented */ +/* This is the directory store. It does everything except revoking and updating, + and uses STORE_Memory() to cache things in memory. */ +const STORE_METHOD *STORE_Directory(void); +/* This is the file store. It does everything except revoking and updating, + and uses STORE_Memory() to cache things in memory. Certificates are added + to it with the store operation, and it will only get cached certificates. */ +const STORE_METHOD *STORE_File(void); +#endif + +/* Store functions take a type code for the type of data they should store + or fetch */ +typedef enum STORE_object_types + { + STORE_OBJECT_TYPE_X509_CERTIFICATE= 0x01, /* X509 * */ + STORE_OBJECT_TYPE_X509_CRL= 0x02, /* X509_CRL * */ + STORE_OBJECT_TYPE_PRIVATE_KEY= 0x03, /* EVP_PKEY * */ + STORE_OBJECT_TYPE_PUBLIC_KEY= 0x04, /* EVP_PKEY * */ + STORE_OBJECT_TYPE_NUMBER= 0x05, /* BIGNUM * */ + STORE_OBJECT_TYPE_ARBITRARY= 0x06, /* BUF_MEM * */ + STORE_OBJECT_TYPE_NUM= 0x06 /* The amount of known + object types */ + } STORE_OBJECT_TYPES; +/* List of text strings corresponding to the object types. */ +extern const char * const STORE_object_type_string[STORE_OBJECT_TYPE_NUM+1]; + +/* Some store functions take a parameter list. Those parameters come with + one of the following codes. The comments following the codes below indicate + what type the value should be a pointer to. */ +typedef enum STORE_params + { + STORE_PARAM_EVP_TYPE= 0x01, /* int */ + STORE_PARAM_BITS= 0x02, /* size_t */ + STORE_PARAM_KEY_PARAMETERS= 0x03, /* ??? */ + STORE_PARAM_KEY_NO_PARAMETERS= 0x04, /* N/A */ + STORE_PARAM_AUTH_PASSPHRASE= 0x05, /* char * */ + STORE_PARAM_AUTH_KRB5_TICKET= 0x06, /* void * */ + STORE_PARAM_TYPE_NUM= 0x06 /* The amount of known + parameter types */ + } STORE_PARAM_TYPES; +/* Parameter value sizes. -1 means unknown, anything else is the required size. */ +extern const int STORE_param_sizes[STORE_PARAM_TYPE_NUM+1]; + +/* Store functions take attribute lists. Those attributes come with codes. + The comments following the codes below indicate what type the value should + be a pointer to. */ +typedef enum STORE_attribs + { + STORE_ATTR_END= 0x00, + STORE_ATTR_FRIENDLYNAME= 0x01, /* C string */ + STORE_ATTR_KEYID= 0x02, /* 160 bit string (SHA1) */ + STORE_ATTR_ISSUERKEYID= 0x03, /* 160 bit string (SHA1) */ + STORE_ATTR_SUBJECTKEYID= 0x04, /* 160 bit string (SHA1) */ + STORE_ATTR_ISSUERSERIALHASH= 0x05, /* 160 bit string (SHA1) */ + STORE_ATTR_ISSUER= 0x06, /* X509_NAME * */ + STORE_ATTR_SERIAL= 0x07, /* BIGNUM * */ + STORE_ATTR_SUBJECT= 0x08, /* X509_NAME * */ + STORE_ATTR_CERTHASH= 0x09, /* 160 bit string (SHA1) */ + STORE_ATTR_EMAIL= 0x0a, /* C string */ + STORE_ATTR_FILENAME= 0x0b, /* C string */ + STORE_ATTR_TYPE_NUM= 0x0b, /* The amount of known + attribute types */ + STORE_ATTR_OR= 0xff /* This is a special + separator, which + expresses the OR + operation. */ + } STORE_ATTR_TYPES; +/* Attribute value sizes. -1 means unknown, anything else is the required size. */ +extern const int STORE_attr_sizes[STORE_ATTR_TYPE_NUM+1]; + +typedef enum STORE_certificate_status + { + STORE_X509_VALID= 0x00, + STORE_X509_EXPIRED= 0x01, + STORE_X509_SUSPENDED= 0x02, + STORE_X509_REVOKED= 0x03 + } STORE_CERTIFICATE_STATUS; + +/* Engine store functions will return a structure that contains all the necessary + * information, including revokation status for certificates. This is really not + * needed for application authors, as the ENGINE framework functions will extract + * the OpenSSL-specific information when at all possible. However, for engine + * authors, it's crucial to know this structure. */ +typedef struct STORE_OBJECT_st + { + STORE_OBJECT_TYPES type; + union + { + struct + { + STORE_CERTIFICATE_STATUS status; + X509 *certificate; + } x509; + X509_CRL *crl; + EVP_PKEY *key; + BIGNUM *number; + BUF_MEM *arbitrary; + } data; + } STORE_OBJECT; +DECLARE_STACK_OF(STORE_OBJECT) +STORE_OBJECT *STORE_OBJECT_new(void); +void STORE_OBJECT_free(STORE_OBJECT *data); + + + +/* The following functions handle the storage. They return 0, a negative number + or NULL on error, anything else on success. */ +X509 *STORE_get_certificate(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_store_certificate(STORE *e, X509 *data, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_modify_certificate(STORE *e, OPENSSL_ITEM search_attributes[], + OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[], + OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]); +int STORE_revoke_certificate(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_delete_certificate(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +void *STORE_list_certificate_start(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +X509 *STORE_list_certificate_next(STORE *e, void *handle); +int STORE_list_certificate_end(STORE *e, void *handle); +int STORE_list_certificate_endp(STORE *e, void *handle); +EVP_PKEY *STORE_generate_key(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +EVP_PKEY *STORE_get_private_key(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_store_private_key(STORE *e, EVP_PKEY *data, + OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]); +int STORE_modify_private_key(STORE *e, OPENSSL_ITEM search_attributes[], + OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[], + OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]); +int STORE_revoke_private_key(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_delete_private_key(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +void *STORE_list_private_key_start(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +EVP_PKEY *STORE_list_private_key_next(STORE *e, void *handle); +int STORE_list_private_key_end(STORE *e, void *handle); +int STORE_list_private_key_endp(STORE *e, void *handle); +EVP_PKEY *STORE_get_public_key(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_store_public_key(STORE *e, EVP_PKEY *data, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_modify_public_key(STORE *e, OPENSSL_ITEM search_attributes[], + OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[], + OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]); +int STORE_revoke_public_key(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_delete_public_key(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +void *STORE_list_public_key_start(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +EVP_PKEY *STORE_list_public_key_next(STORE *e, void *handle); +int STORE_list_public_key_end(STORE *e, void *handle); +int STORE_list_public_key_endp(STORE *e, void *handle); +X509_CRL *STORE_generate_crl(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +X509_CRL *STORE_get_crl(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_store_crl(STORE *e, X509_CRL *data, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_modify_crl(STORE *e, OPENSSL_ITEM search_attributes[], + OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[], + OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]); +int STORE_delete_crl(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +void *STORE_list_crl_start(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +X509_CRL *STORE_list_crl_next(STORE *e, void *handle); +int STORE_list_crl_end(STORE *e, void *handle); +int STORE_list_crl_endp(STORE *e, void *handle); +int STORE_store_number(STORE *e, BIGNUM *data, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_modify_number(STORE *e, OPENSSL_ITEM search_attributes[], + OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[], + OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]); +BIGNUM *STORE_get_number(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_delete_number(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_store_arbitrary(STORE *e, BUF_MEM *data, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_modify_arbitrary(STORE *e, OPENSSL_ITEM search_attributes[], + OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[], + OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]); +BUF_MEM *STORE_get_arbitrary(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_delete_arbitrary(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); + + +/* Create and manipulate methods */ +STORE_METHOD *STORE_create_method(char *name); +void STORE_destroy_method(STORE_METHOD *store_method); + +/* These callback types are use for store handlers */ +typedef int (*STORE_INITIALISE_FUNC_PTR)(STORE *); +typedef void (*STORE_CLEANUP_FUNC_PTR)(STORE *); +typedef STORE_OBJECT *(*STORE_GENERATE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]); +typedef STORE_OBJECT *(*STORE_GET_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]); +typedef void *(*STORE_START_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]); +typedef STORE_OBJECT *(*STORE_NEXT_OBJECT_FUNC_PTR)(STORE *, void *handle); +typedef int (*STORE_END_OBJECT_FUNC_PTR)(STORE *, void *handle); +typedef int (*STORE_HANDLE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]); +typedef int (*STORE_STORE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, STORE_OBJECT *data, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]); +typedef int (*STORE_MODIFY_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM search_attributes[], OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[], OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]); +typedef int (*STORE_GENERIC_FUNC_PTR)(STORE *, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]); +typedef int (*STORE_CTRL_FUNC_PTR)(STORE *, int cmd, long l, void *p, void (*f)(void)); + +int STORE_method_set_initialise_function(STORE_METHOD *sm, STORE_INITIALISE_FUNC_PTR init_f); +int STORE_method_set_cleanup_function(STORE_METHOD *sm, STORE_CLEANUP_FUNC_PTR clean_f); +int STORE_method_set_generate_function(STORE_METHOD *sm, STORE_GENERATE_OBJECT_FUNC_PTR generate_f); +int STORE_method_set_get_function(STORE_METHOD *sm, STORE_GET_OBJECT_FUNC_PTR get_f); +int STORE_method_set_store_function(STORE_METHOD *sm, STORE_STORE_OBJECT_FUNC_PTR store_f); +int STORE_method_set_modify_function(STORE_METHOD *sm, STORE_MODIFY_OBJECT_FUNC_PTR store_f); +int STORE_method_set_revoke_function(STORE_METHOD *sm, STORE_HANDLE_OBJECT_FUNC_PTR revoke_f); +int STORE_method_set_delete_function(STORE_METHOD *sm, STORE_HANDLE_OBJECT_FUNC_PTR delete_f); +int STORE_method_set_list_start_function(STORE_METHOD *sm, STORE_START_OBJECT_FUNC_PTR list_start_f); +int STORE_method_set_list_next_function(STORE_METHOD *sm, STORE_NEXT_OBJECT_FUNC_PTR list_next_f); +int STORE_method_set_list_end_function(STORE_METHOD *sm, STORE_END_OBJECT_FUNC_PTR list_end_f); +int STORE_method_set_update_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR); +int STORE_method_set_lock_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR); +int STORE_method_set_unlock_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR); +int STORE_method_set_ctrl_function(STORE_METHOD *sm, STORE_CTRL_FUNC_PTR ctrl_f); + +STORE_INITIALISE_FUNC_PTR STORE_method_get_initialise_function(STORE_METHOD *sm); +STORE_CLEANUP_FUNC_PTR STORE_method_get_cleanup_function(STORE_METHOD *sm); +STORE_GENERATE_OBJECT_FUNC_PTR STORE_method_get_generate_function(STORE_METHOD *sm); +STORE_GET_OBJECT_FUNC_PTR STORE_method_get_get_function(STORE_METHOD *sm); +STORE_STORE_OBJECT_FUNC_PTR STORE_method_get_store_function(STORE_METHOD *sm); +STORE_MODIFY_OBJECT_FUNC_PTR STORE_method_get_modify_function(STORE_METHOD *sm); +STORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_revoke_function(STORE_METHOD *sm); +STORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_delete_function(STORE_METHOD *sm); +STORE_START_OBJECT_FUNC_PTR STORE_method_get_list_start_function(STORE_METHOD *sm); +STORE_NEXT_OBJECT_FUNC_PTR STORE_method_get_list_next_function(STORE_METHOD *sm); +STORE_END_OBJECT_FUNC_PTR STORE_method_get_list_end_function(STORE_METHOD *sm); +STORE_GENERIC_FUNC_PTR STORE_method_get_update_store_function(STORE_METHOD *sm); +STORE_GENERIC_FUNC_PTR STORE_method_get_lock_store_function(STORE_METHOD *sm); +STORE_GENERIC_FUNC_PTR STORE_method_get_unlock_store_function(STORE_METHOD *sm); +STORE_CTRL_FUNC_PTR STORE_method_get_ctrl_function(STORE_METHOD *sm); + +/* Method helper structures and functions. */ + +/* This structure is the result of parsing through the information in a list + of OPENSSL_ITEMs. It stores all the necessary information in a structured + way.*/ +typedef struct STORE_attr_info_st STORE_ATTR_INFO; + +/* Parse a list of OPENSSL_ITEMs and return a pointer to a STORE_ATTR_INFO. + Note that we do this in the list form, since the list of OPENSSL_ITEMs can + come in blocks separated with STORE_ATTR_OR. Note that the value returned + by STORE_parse_attrs_next() must be freed with STORE_ATTR_INFO_free(). */ +void *STORE_parse_attrs_start(OPENSSL_ITEM *attributes); +STORE_ATTR_INFO *STORE_parse_attrs_next(void *handle); +int STORE_parse_attrs_end(void *handle); +int STORE_parse_attrs_endp(void *handle); + +/* Creator and destructor */ +STORE_ATTR_INFO *STORE_ATTR_INFO_new(void); +int STORE_ATTR_INFO_free(STORE_ATTR_INFO *attrs); + +/* Manipulators */ +char *STORE_ATTR_INFO_get0_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code); +unsigned char *STORE_ATTR_INFO_get0_sha1str(STORE_ATTR_INFO *attrs, + STORE_ATTR_TYPES code); +X509_NAME *STORE_ATTR_INFO_get0_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code); +BIGNUM *STORE_ATTR_INFO_get0_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code); +int STORE_ATTR_INFO_set_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, + char *cstr, size_t cstr_size); +int STORE_ATTR_INFO_set_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, + unsigned char *sha1str, size_t sha1str_size); +int STORE_ATTR_INFO_set_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, + X509_NAME *dn); +int STORE_ATTR_INFO_set_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, + BIGNUM *number); +int STORE_ATTR_INFO_modify_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, + char *cstr, size_t cstr_size); +int STORE_ATTR_INFO_modify_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, + unsigned char *sha1str, size_t sha1str_size); +int STORE_ATTR_INFO_modify_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, + X509_NAME *dn); +int STORE_ATTR_INFO_modify_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, + BIGNUM *number); + +/* Compare on basis of a bit pattern formed by the STORE_ATTR_TYPES values + in each contained attribute. */ +int STORE_ATTR_INFO_compare(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b); +/* Check if the set of attributes in a is within the range of attributes + set in b. */ +int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b); +/* Check if the set of attributes in a are also set in b. */ +int STORE_ATTR_INFO_in(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b); +/* Same as STORE_ATTR_INFO_in(), but also checks the attribute values. */ +int STORE_ATTR_INFO_in_ex(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b); + + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_STORE_strings(void); + +/* Error codes for the STORE functions. */ + +/* Function codes. */ +#define STORE_F_MEM_DELETE 134 +#define STORE_F_MEM_GENERATE 135 +#define STORE_F_MEM_LIST_END 168 +#define STORE_F_MEM_LIST_NEXT 136 +#define STORE_F_MEM_LIST_START 137 +#define STORE_F_MEM_MODIFY 169 +#define STORE_F_MEM_STORE 138 +#define STORE_F_STORE_ATTR_INFO_GET0_CSTR 139 +#define STORE_F_STORE_ATTR_INFO_GET0_DN 140 +#define STORE_F_STORE_ATTR_INFO_GET0_NUMBER 141 +#define STORE_F_STORE_ATTR_INFO_GET0_SHA1STR 142 +#define STORE_F_STORE_ATTR_INFO_MODIFY_CSTR 143 +#define STORE_F_STORE_ATTR_INFO_MODIFY_DN 144 +#define STORE_F_STORE_ATTR_INFO_MODIFY_NUMBER 145 +#define STORE_F_STORE_ATTR_INFO_MODIFY_SHA1STR 146 +#define STORE_F_STORE_ATTR_INFO_SET_CSTR 147 +#define STORE_F_STORE_ATTR_INFO_SET_DN 148 +#define STORE_F_STORE_ATTR_INFO_SET_NUMBER 149 +#define STORE_F_STORE_ATTR_INFO_SET_SHA1STR 150 +#define STORE_F_STORE_CERTIFICATE 170 +#define STORE_F_STORE_CTRL 161 +#define STORE_F_STORE_DELETE_ARBITRARY 158 +#define STORE_F_STORE_DELETE_CERTIFICATE 102 +#define STORE_F_STORE_DELETE_CRL 103 +#define STORE_F_STORE_DELETE_NUMBER 104 +#define STORE_F_STORE_DELETE_PRIVATE_KEY 105 +#define STORE_F_STORE_DELETE_PUBLIC_KEY 106 +#define STORE_F_STORE_GENERATE_CRL 107 +#define STORE_F_STORE_GENERATE_KEY 108 +#define STORE_F_STORE_GET_ARBITRARY 159 +#define STORE_F_STORE_GET_CERTIFICATE 109 +#define STORE_F_STORE_GET_CRL 110 +#define STORE_F_STORE_GET_NUMBER 111 +#define STORE_F_STORE_GET_PRIVATE_KEY 112 +#define STORE_F_STORE_GET_PUBLIC_KEY 113 +#define STORE_F_STORE_LIST_CERTIFICATE_END 114 +#define STORE_F_STORE_LIST_CERTIFICATE_ENDP 153 +#define STORE_F_STORE_LIST_CERTIFICATE_NEXT 115 +#define STORE_F_STORE_LIST_CERTIFICATE_START 116 +#define STORE_F_STORE_LIST_CRL_END 117 +#define STORE_F_STORE_LIST_CRL_ENDP 154 +#define STORE_F_STORE_LIST_CRL_NEXT 118 +#define STORE_F_STORE_LIST_CRL_START 119 +#define STORE_F_STORE_LIST_PRIVATE_KEY_END 120 +#define STORE_F_STORE_LIST_PRIVATE_KEY_ENDP 155 +#define STORE_F_STORE_LIST_PRIVATE_KEY_NEXT 121 +#define STORE_F_STORE_LIST_PRIVATE_KEY_START 122 +#define STORE_F_STORE_LIST_PUBLIC_KEY_END 123 +#define STORE_F_STORE_LIST_PUBLIC_KEY_ENDP 156 +#define STORE_F_STORE_LIST_PUBLIC_KEY_NEXT 124 +#define STORE_F_STORE_LIST_PUBLIC_KEY_START 125 +#define STORE_F_STORE_MODIFY_ARBITRARY 162 +#define STORE_F_STORE_MODIFY_CERTIFICATE 163 +#define STORE_F_STORE_MODIFY_CRL 164 +#define STORE_F_STORE_MODIFY_NUMBER 165 +#define STORE_F_STORE_MODIFY_PRIVATE_KEY 166 +#define STORE_F_STORE_MODIFY_PUBLIC_KEY 167 +#define STORE_F_STORE_NEW_ENGINE 133 +#define STORE_F_STORE_NEW_METHOD 132 +#define STORE_F_STORE_PARSE_ATTRS_END 151 +#define STORE_F_STORE_PARSE_ATTRS_ENDP 172 +#define STORE_F_STORE_PARSE_ATTRS_NEXT 152 +#define STORE_F_STORE_PARSE_ATTRS_START 171 +#define STORE_F_STORE_REVOKE_CERTIFICATE 129 +#define STORE_F_STORE_REVOKE_PRIVATE_KEY 130 +#define STORE_F_STORE_REVOKE_PUBLIC_KEY 131 +#define STORE_F_STORE_STORE_ARBITRARY 157 +#define STORE_F_STORE_STORE_CERTIFICATE 100 +#define STORE_F_STORE_STORE_CRL 101 +#define STORE_F_STORE_STORE_NUMBER 126 +#define STORE_F_STORE_STORE_PRIVATE_KEY 127 +#define STORE_F_STORE_STORE_PUBLIC_KEY 128 + +/* Reason codes. */ +#define STORE_R_ALREADY_HAS_A_VALUE 127 +#define STORE_R_FAILED_DELETING_ARBITRARY 132 +#define STORE_R_FAILED_DELETING_CERTIFICATE 100 +#define STORE_R_FAILED_DELETING_KEY 101 +#define STORE_R_FAILED_DELETING_NUMBER 102 +#define STORE_R_FAILED_GENERATING_CRL 103 +#define STORE_R_FAILED_GENERATING_KEY 104 +#define STORE_R_FAILED_GETTING_ARBITRARY 133 +#define STORE_R_FAILED_GETTING_CERTIFICATE 105 +#define STORE_R_FAILED_GETTING_KEY 106 +#define STORE_R_FAILED_GETTING_NUMBER 107 +#define STORE_R_FAILED_LISTING_CERTIFICATES 108 +#define STORE_R_FAILED_LISTING_KEYS 109 +#define STORE_R_FAILED_MODIFYING_ARBITRARY 138 +#define STORE_R_FAILED_MODIFYING_CERTIFICATE 139 +#define STORE_R_FAILED_MODIFYING_CRL 140 +#define STORE_R_FAILED_MODIFYING_NUMBER 141 +#define STORE_R_FAILED_MODIFYING_PRIVATE_KEY 142 +#define STORE_R_FAILED_MODIFYING_PUBLIC_KEY 143 +#define STORE_R_FAILED_REVOKING_CERTIFICATE 110 +#define STORE_R_FAILED_REVOKING_KEY 111 +#define STORE_R_FAILED_STORING_ARBITRARY 134 +#define STORE_R_FAILED_STORING_CERTIFICATE 112 +#define STORE_R_FAILED_STORING_KEY 113 +#define STORE_R_FAILED_STORING_NUMBER 114 +#define STORE_R_NOT_IMPLEMENTED 128 +#define STORE_R_NO_CONTROL_FUNCTION 144 +#define STORE_R_NO_DELETE_ARBITRARY_FUNCTION 135 +#define STORE_R_NO_DELETE_NUMBER_FUNCTION 115 +#define STORE_R_NO_DELETE_OBJECT_FUNCTION 116 +#define STORE_R_NO_GENERATE_CRL_FUNCTION 117 +#define STORE_R_NO_GENERATE_OBJECT_FUNCTION 118 +#define STORE_R_NO_GET_OBJECT_ARBITRARY_FUNCTION 136 +#define STORE_R_NO_GET_OBJECT_FUNCTION 119 +#define STORE_R_NO_GET_OBJECT_NUMBER_FUNCTION 120 +#define STORE_R_NO_LIST_OBJECT_ENDP_FUNCTION 131 +#define STORE_R_NO_LIST_OBJECT_END_FUNCTION 121 +#define STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION 122 +#define STORE_R_NO_LIST_OBJECT_START_FUNCTION 123 +#define STORE_R_NO_MODIFY_OBJECT_FUNCTION 145 +#define STORE_R_NO_REVOKE_OBJECT_FUNCTION 124 +#define STORE_R_NO_STORE 129 +#define STORE_R_NO_STORE_OBJECT_ARBITRARY_FUNCTION 137 +#define STORE_R_NO_STORE_OBJECT_FUNCTION 125 +#define STORE_R_NO_STORE_OBJECT_NUMBER_FUNCTION 126 +#define STORE_R_NO_VALUE 130 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/openssl/symhacks.h b/h/openssl/symhacks.h new file mode 100644 index 0000000..7e3602d --- /dev/null +++ b/h/openssl/symhacks.h @@ -0,0 +1,383 @@ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_SYMHACKS_H +#define HEADER_SYMHACKS_H + +#include + +/* Hacks to solve the problem with linkers incapable of handling very long + symbol names. In the case of VMS, the limit is 31 characters on VMS for + VAX. */ +#ifdef OPENSSL_SYS_VMS + +/* Hack a long name in crypto/ex_data.c */ +#undef CRYPTO_get_ex_data_implementation +#define CRYPTO_get_ex_data_implementation CRYPTO_get_ex_data_impl +#undef CRYPTO_set_ex_data_implementation +#define CRYPTO_set_ex_data_implementation CRYPTO_set_ex_data_impl + +/* Hack a long name in crypto/asn1/a_mbstr.c */ +#undef ASN1_STRING_set_default_mask_asc +#define ASN1_STRING_set_default_mask_asc ASN1_STRING_set_def_mask_asc + +#if 0 /* No longer needed, since safestack macro magic does the job */ +/* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO) */ +#undef i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO +#define i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO i2d_ASN1_SET_OF_PKCS7_SIGINF +#undef d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO +#define d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO d2i_ASN1_SET_OF_PKCS7_SIGINF +#endif + +#if 0 /* No longer needed, since safestack macro magic does the job */ +/* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO) */ +#undef i2d_ASN1_SET_OF_PKCS7_RECIP_INFO +#define i2d_ASN1_SET_OF_PKCS7_RECIP_INFO i2d_ASN1_SET_OF_PKCS7_RECINF +#undef d2i_ASN1_SET_OF_PKCS7_RECIP_INFO +#define d2i_ASN1_SET_OF_PKCS7_RECIP_INFO d2i_ASN1_SET_OF_PKCS7_RECINF +#endif + +#if 0 /* No longer needed, since safestack macro magic does the job */ +/* Hack the names created with DECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION) */ +#undef i2d_ASN1_SET_OF_ACCESS_DESCRIPTION +#define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION i2d_ASN1_SET_OF_ACC_DESC +#undef d2i_ASN1_SET_OF_ACCESS_DESCRIPTION +#define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION d2i_ASN1_SET_OF_ACC_DESC +#endif + +/* Hack the names created with DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE) */ +#undef PEM_read_NETSCAPE_CERT_SEQUENCE +#define PEM_read_NETSCAPE_CERT_SEQUENCE PEM_read_NS_CERT_SEQ +#undef PEM_write_NETSCAPE_CERT_SEQUENCE +#define PEM_write_NETSCAPE_CERT_SEQUENCE PEM_write_NS_CERT_SEQ +#undef PEM_read_bio_NETSCAPE_CERT_SEQUENCE +#define PEM_read_bio_NETSCAPE_CERT_SEQUENCE PEM_read_bio_NS_CERT_SEQ +#undef PEM_write_bio_NETSCAPE_CERT_SEQUENCE +#define PEM_write_bio_NETSCAPE_CERT_SEQUENCE PEM_write_bio_NS_CERT_SEQ +#undef PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE +#define PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE PEM_write_cb_bio_NS_CERT_SEQ + +/* Hack the names created with DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO) */ +#undef PEM_read_PKCS8_PRIV_KEY_INFO +#define PEM_read_PKCS8_PRIV_KEY_INFO PEM_read_P8_PRIV_KEY_INFO +#undef PEM_write_PKCS8_PRIV_KEY_INFO +#define PEM_write_PKCS8_PRIV_KEY_INFO PEM_write_P8_PRIV_KEY_INFO +#undef PEM_read_bio_PKCS8_PRIV_KEY_INFO +#define PEM_read_bio_PKCS8_PRIV_KEY_INFO PEM_read_bio_P8_PRIV_KEY_INFO +#undef PEM_write_bio_PKCS8_PRIV_KEY_INFO +#define PEM_write_bio_PKCS8_PRIV_KEY_INFO PEM_write_bio_P8_PRIV_KEY_INFO +#undef PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO +#define PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO PEM_wrt_cb_bio_P8_PRIV_KEY_INFO + +/* Hack other PEM names */ +#undef PEM_write_bio_PKCS8PrivateKey_nid +#define PEM_write_bio_PKCS8PrivateKey_nid PEM_write_bio_PKCS8PrivKey_nid + +/* Hack some long X509 names */ +#undef X509_REVOKED_get_ext_by_critical +#define X509_REVOKED_get_ext_by_critical X509_REVOKED_get_ext_by_critic +#undef X509_policy_tree_get0_user_policies +#define X509_policy_tree_get0_user_policies X509_pcy_tree_get0_usr_policies +#undef X509_policy_node_get0_qualifiers +#define X509_policy_node_get0_qualifiers X509_pcy_node_get0_qualifiers +#undef X509_STORE_CTX_get_explicit_policy +#define X509_STORE_CTX_get_explicit_policy X509_STORE_CTX_get_expl_policy + +/* Hack some long CRYPTO names */ +#undef CRYPTO_set_dynlock_destroy_callback +#define CRYPTO_set_dynlock_destroy_callback CRYPTO_set_dynlock_destroy_cb +#undef CRYPTO_set_dynlock_create_callback +#define CRYPTO_set_dynlock_create_callback CRYPTO_set_dynlock_create_cb +#undef CRYPTO_set_dynlock_lock_callback +#define CRYPTO_set_dynlock_lock_callback CRYPTO_set_dynlock_lock_cb +#undef CRYPTO_get_dynlock_lock_callback +#define CRYPTO_get_dynlock_lock_callback CRYPTO_get_dynlock_lock_cb +#undef CRYPTO_get_dynlock_destroy_callback +#define CRYPTO_get_dynlock_destroy_callback CRYPTO_get_dynlock_destroy_cb +#undef CRYPTO_get_dynlock_create_callback +#define CRYPTO_get_dynlock_create_callback CRYPTO_get_dynlock_create_cb +#undef CRYPTO_set_locked_mem_ex_functions +#define CRYPTO_set_locked_mem_ex_functions CRYPTO_set_locked_mem_ex_funcs +#undef CRYPTO_get_locked_mem_ex_functions +#define CRYPTO_get_locked_mem_ex_functions CRYPTO_get_locked_mem_ex_funcs + +/* Hack some long SSL names */ +#undef SSL_CTX_set_default_verify_paths +#define SSL_CTX_set_default_verify_paths SSL_CTX_set_def_verify_paths +#undef SSL_get_ex_data_X509_STORE_CTX_idx +#define SSL_get_ex_data_X509_STORE_CTX_idx SSL_get_ex_d_X509_STORE_CTX_idx +#undef SSL_add_file_cert_subjects_to_stack +#define SSL_add_file_cert_subjects_to_stack SSL_add_file_cert_subjs_to_stk +#undef SSL_add_dir_cert_subjects_to_stack +#define SSL_add_dir_cert_subjects_to_stack SSL_add_dir_cert_subjs_to_stk +#undef SSL_CTX_use_certificate_chain_file +#define SSL_CTX_use_certificate_chain_file SSL_CTX_use_cert_chain_file +#undef SSL_CTX_set_cert_verify_callback +#define SSL_CTX_set_cert_verify_callback SSL_CTX_set_cert_verify_cb +#undef SSL_CTX_set_default_passwd_cb_userdata +#define SSL_CTX_set_default_passwd_cb_userdata SSL_CTX_set_def_passwd_cb_ud +#undef SSL_COMP_get_compression_methods +#define SSL_COMP_get_compression_methods SSL_COMP_get_compress_methods + +/* Hack some long ENGINE names */ +#undef ENGINE_get_default_BN_mod_exp_crt +#define ENGINE_get_default_BN_mod_exp_crt ENGINE_get_def_BN_mod_exp_crt +#undef ENGINE_set_default_BN_mod_exp_crt +#define ENGINE_set_default_BN_mod_exp_crt ENGINE_set_def_BN_mod_exp_crt +#undef ENGINE_set_load_privkey_function +#define ENGINE_set_load_privkey_function ENGINE_set_load_privkey_fn +#undef ENGINE_get_load_privkey_function +#define ENGINE_get_load_privkey_function ENGINE_get_load_privkey_fn + +/* Hack some long OCSP names */ +#undef OCSP_REQUEST_get_ext_by_critical +#define OCSP_REQUEST_get_ext_by_critical OCSP_REQUEST_get_ext_by_crit +#undef OCSP_BASICRESP_get_ext_by_critical +#define OCSP_BASICRESP_get_ext_by_critical OCSP_BASICRESP_get_ext_by_crit +#undef OCSP_SINGLERESP_get_ext_by_critical +#define OCSP_SINGLERESP_get_ext_by_critical OCSP_SINGLERESP_get_ext_by_crit + +/* Hack some long DES names */ +#undef _ossl_old_des_ede3_cfb64_encrypt +#define _ossl_old_des_ede3_cfb64_encrypt _ossl_odes_ede3_cfb64_encrypt +#undef _ossl_old_des_ede3_ofb64_encrypt +#define _ossl_old_des_ede3_ofb64_encrypt _ossl_odes_ede3_ofb64_encrypt + +/* Hack some long EVP names */ +#undef OPENSSL_add_all_algorithms_noconf +#define OPENSSL_add_all_algorithms_noconf OPENSSL_add_all_algo_noconf +#undef OPENSSL_add_all_algorithms_conf +#define OPENSSL_add_all_algorithms_conf OPENSSL_add_all_algo_conf + +/* Hack some long EC names */ +#undef EC_GROUP_set_point_conversion_form +#define EC_GROUP_set_point_conversion_form EC_GROUP_set_point_conv_form +#undef EC_GROUP_get_point_conversion_form +#define EC_GROUP_get_point_conversion_form EC_GROUP_get_point_conv_form +#undef EC_GROUP_clear_free_all_extra_data +#define EC_GROUP_clear_free_all_extra_data EC_GROUP_clr_free_all_xtra_data +#undef EC_POINT_set_Jprojective_coordinates_GFp +#define EC_POINT_set_Jprojective_coordinates_GFp \ + EC_POINT_set_Jproj_coords_GFp +#undef EC_POINT_get_Jprojective_coordinates_GFp +#define EC_POINT_get_Jprojective_coordinates_GFp \ + EC_POINT_get_Jproj_coords_GFp +#undef EC_POINT_set_affine_coordinates_GFp +#define EC_POINT_set_affine_coordinates_GFp EC_POINT_set_affine_coords_GFp +#undef EC_POINT_get_affine_coordinates_GFp +#define EC_POINT_get_affine_coordinates_GFp EC_POINT_get_affine_coords_GFp +#undef EC_POINT_set_compressed_coordinates_GFp +#define EC_POINT_set_compressed_coordinates_GFp EC_POINT_set_compr_coords_GFp +#undef EC_POINT_set_affine_coordinates_GF2m +#define EC_POINT_set_affine_coordinates_GF2m EC_POINT_set_affine_coords_GF2m +#undef EC_POINT_get_affine_coordinates_GF2m +#define EC_POINT_get_affine_coordinates_GF2m EC_POINT_get_affine_coords_GF2m +#undef EC_POINT_set_compressed_coordinates_GF2m +#define EC_POINT_set_compressed_coordinates_GF2m \ + EC_POINT_set_compr_coords_GF2m +#undef ec_GF2m_simple_group_clear_finish +#define ec_GF2m_simple_group_clear_finish ec_GF2m_simple_grp_clr_finish +#undef ec_GF2m_simple_group_check_discriminant +#define ec_GF2m_simple_group_check_discriminant ec_GF2m_simple_grp_chk_discrim +#undef ec_GF2m_simple_point_clear_finish +#define ec_GF2m_simple_point_clear_finish ec_GF2m_simple_pt_clr_finish +#undef ec_GF2m_simple_point_set_to_infinity +#define ec_GF2m_simple_point_set_to_infinity ec_GF2m_simple_pt_set_to_inf +#undef ec_GF2m_simple_points_make_affine +#define ec_GF2m_simple_points_make_affine ec_GF2m_simple_pts_make_affine +#undef ec_GF2m_simple_point_set_affine_coordinates +#define ec_GF2m_simple_point_set_affine_coordinates \ + ec_GF2m_smp_pt_set_af_coords +#undef ec_GF2m_simple_point_get_affine_coordinates +#define ec_GF2m_simple_point_get_affine_coordinates \ + ec_GF2m_smp_pt_get_af_coords +#undef ec_GF2m_simple_set_compressed_coordinates +#define ec_GF2m_simple_set_compressed_coordinates \ + ec_GF2m_smp_set_compr_coords +#undef ec_GFp_simple_group_set_curve_GFp +#define ec_GFp_simple_group_set_curve_GFp ec_GFp_simple_grp_set_curve_GFp +#undef ec_GFp_simple_group_get_curve_GFp +#define ec_GFp_simple_group_get_curve_GFp ec_GFp_simple_grp_get_curve_GFp +#undef ec_GFp_simple_group_clear_finish +#define ec_GFp_simple_group_clear_finish ec_GFp_simple_grp_clear_finish +#undef ec_GFp_simple_group_set_generator +#define ec_GFp_simple_group_set_generator ec_GFp_simple_grp_set_generator +#undef ec_GFp_simple_group_get0_generator +#define ec_GFp_simple_group_get0_generator ec_GFp_simple_grp_gt0_generator +#undef ec_GFp_simple_group_get_cofactor +#define ec_GFp_simple_group_get_cofactor ec_GFp_simple_grp_get_cofactor +#undef ec_GFp_simple_point_clear_finish +#define ec_GFp_simple_point_clear_finish ec_GFp_simple_pt_clear_finish +#undef ec_GFp_simple_point_set_to_infinity +#define ec_GFp_simple_point_set_to_infinity ec_GFp_simple_pt_set_to_inf +#undef ec_GFp_simple_points_make_affine +#define ec_GFp_simple_points_make_affine ec_GFp_simple_pts_make_affine +#undef ec_GFp_simple_group_get_curve_GFp +#define ec_GFp_simple_group_get_curve_GFp ec_GFp_simple_grp_get_curve_GFp +#undef ec_GFp_simple_set_Jprojective_coordinates_GFp +#define ec_GFp_simple_set_Jprojective_coordinates_GFp \ + ec_GFp_smp_set_Jproj_coords_GFp +#undef ec_GFp_simple_get_Jprojective_coordinates_GFp +#define ec_GFp_simple_get_Jprojective_coordinates_GFp \ + ec_GFp_smp_get_Jproj_coords_GFp +#undef ec_GFp_simple_point_set_affine_coordinates_GFp +#define ec_GFp_simple_point_set_affine_coordinates_GFp \ + ec_GFp_smp_pt_set_af_coords_GFp +#undef ec_GFp_simple_point_get_affine_coordinates_GFp +#define ec_GFp_simple_point_get_affine_coordinates_GFp \ + ec_GFp_smp_pt_get_af_coords_GFp +#undef ec_GFp_simple_set_compressed_coordinates_GFp +#define ec_GFp_simple_set_compressed_coordinates_GFp \ + ec_GFp_smp_set_compr_coords_GFp +#undef ec_GFp_simple_point_set_affine_coordinates +#define ec_GFp_simple_point_set_affine_coordinates \ + ec_GFp_smp_pt_set_af_coords +#undef ec_GFp_simple_point_get_affine_coordinates +#define ec_GFp_simple_point_get_affine_coordinates \ + ec_GFp_smp_pt_get_af_coords +#undef ec_GFp_simple_set_compressed_coordinates +#define ec_GFp_simple_set_compressed_coordinates \ + ec_GFp_smp_set_compr_coords +#undef ec_GFp_simple_group_check_discriminant +#define ec_GFp_simple_group_check_discriminant ec_GFp_simple_grp_chk_discrim + +/* Hack som long STORE names */ +#undef STORE_method_set_initialise_function +#define STORE_method_set_initialise_function STORE_meth_set_initialise_fn +#undef STORE_method_set_cleanup_function +#define STORE_method_set_cleanup_function STORE_meth_set_cleanup_fn +#undef STORE_method_set_generate_function +#define STORE_method_set_generate_function STORE_meth_set_generate_fn +#undef STORE_method_set_modify_function +#define STORE_method_set_modify_function STORE_meth_set_modify_fn +#undef STORE_method_set_revoke_function +#define STORE_method_set_revoke_function STORE_meth_set_revoke_fn +#undef STORE_method_set_delete_function +#define STORE_method_set_delete_function STORE_meth_set_delete_fn +#undef STORE_method_set_list_start_function +#define STORE_method_set_list_start_function STORE_meth_set_list_start_fn +#undef STORE_method_set_list_next_function +#define STORE_method_set_list_next_function STORE_meth_set_list_next_fn +#undef STORE_method_set_list_end_function +#define STORE_method_set_list_end_function STORE_meth_set_list_end_fn +#undef STORE_method_set_update_store_function +#define STORE_method_set_update_store_function STORE_meth_set_update_store_fn +#undef STORE_method_set_lock_store_function +#define STORE_method_set_lock_store_function STORE_meth_set_lock_store_fn +#undef STORE_method_set_unlock_store_function +#define STORE_method_set_unlock_store_function STORE_meth_set_unlock_store_fn +#undef STORE_method_get_initialise_function +#define STORE_method_get_initialise_function STORE_meth_get_initialise_fn +#undef STORE_method_get_cleanup_function +#define STORE_method_get_cleanup_function STORE_meth_get_cleanup_fn +#undef STORE_method_get_generate_function +#define STORE_method_get_generate_function STORE_meth_get_generate_fn +#undef STORE_method_get_modify_function +#define STORE_method_get_modify_function STORE_meth_get_modify_fn +#undef STORE_method_get_revoke_function +#define STORE_method_get_revoke_function STORE_meth_get_revoke_fn +#undef STORE_method_get_delete_function +#define STORE_method_get_delete_function STORE_meth_get_delete_fn +#undef STORE_method_get_list_start_function +#define STORE_method_get_list_start_function STORE_meth_get_list_start_fn +#undef STORE_method_get_list_next_function +#define STORE_method_get_list_next_function STORE_meth_get_list_next_fn +#undef STORE_method_get_list_end_function +#define STORE_method_get_list_end_function STORE_meth_get_list_end_fn +#undef STORE_method_get_update_store_function +#define STORE_method_get_update_store_function STORE_meth_get_update_store_fn +#undef STORE_method_get_lock_store_function +#define STORE_method_get_lock_store_function STORE_meth_get_lock_store_fn +#undef STORE_method_get_unlock_store_function +#define STORE_method_get_unlock_store_function STORE_meth_get_unlock_store_fn + +#endif /* defined OPENSSL_SYS_VMS */ + + +/* Case insensiteve linking causes problems.... */ +#if defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2) +#undef ERR_load_CRYPTO_strings +#define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings +#undef OCSP_crlID_new +#define OCSP_crlID_new OCSP_crlID2_new + +#undef d2i_ECPARAMETERS +#define d2i_ECPARAMETERS d2i_UC_ECPARAMETERS +#undef i2d_ECPARAMETERS +#define i2d_ECPARAMETERS i2d_UC_ECPARAMETERS +#undef d2i_ECPKPARAMETERS +#define d2i_ECPKPARAMETERS d2i_UC_ECPKPARAMETERS +#undef i2d_ECPKPARAMETERS +#define i2d_ECPKPARAMETERS i2d_UC_ECPKPARAMETERS + +/* These functions do not seem to exist! However, I'm paranoid... + Original command in x509v3.h: + These functions are being redefined in another directory, + and clash when the linker is case-insensitive, so let's + hide them a little, by giving them an extra 'o' at the + beginning of the name... */ +#undef X509v3_cleanup_extensions +#define X509v3_cleanup_extensions oX509v3_cleanup_extensions +#undef X509v3_add_extension +#define X509v3_add_extension oX509v3_add_extension +#undef X509v3_add_netscape_extensions +#define X509v3_add_netscape_extensions oX509v3_add_netscape_extensions +#undef X509v3_add_standard_extensions +#define X509v3_add_standard_extensions oX509v3_add_standard_extensions + + +#endif + + +#endif /* ! defined HEADER_VMS_IDHACKS_H */ diff --git a/h/openssl/tls1.h b/h/openssl/tls1.h new file mode 100644 index 0000000..be15445 --- /dev/null +++ b/h/openssl/tls1.h @@ -0,0 +1,291 @@ +/* ssl/tls1.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * + * Portions of the attached software ("Contribution") are developed by + * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project. + * + * The Contribution is licensed pursuant to the OpenSSL open source + * license provided above. + * + * ECC cipher suite support in OpenSSL originally written by + * Vipul Gupta and Sumit Gupta of Sun Microsystems Laboratories. + * + */ + +#ifndef HEADER_TLS1_H +#define HEADER_TLS1_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES 1 + +#define TLS1_VERSION 0x0301 +#define TLS1_VERSION_MAJOR 0x03 +#define TLS1_VERSION_MINOR 0x01 + +#define TLS1_AD_DECRYPTION_FAILED 21 +#define TLS1_AD_RECORD_OVERFLOW 22 +#define TLS1_AD_UNKNOWN_CA 48 /* fatal */ +#define TLS1_AD_ACCESS_DENIED 49 /* fatal */ +#define TLS1_AD_DECODE_ERROR 50 /* fatal */ +#define TLS1_AD_DECRYPT_ERROR 51 +#define TLS1_AD_EXPORT_RESTRICTION 60 /* fatal */ +#define TLS1_AD_PROTOCOL_VERSION 70 /* fatal */ +#define TLS1_AD_INSUFFICIENT_SECURITY 71 /* fatal */ +#define TLS1_AD_INTERNAL_ERROR 80 /* fatal */ +#define TLS1_AD_USER_CANCELLED 90 +#define TLS1_AD_NO_RENEGOTIATION 100 + +/* Additional TLS ciphersuites from draft-ietf-tls-56-bit-ciphersuites-00.txt + * (available if TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES is defined, see + * s3_lib.c). We actually treat them like SSL 3.0 ciphers, which we probably + * shouldn't. */ +#define TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_MD5 0x03000060 +#define TLS1_CK_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5 0x03000061 +#define TLS1_CK_RSA_EXPORT1024_WITH_DES_CBC_SHA 0x03000062 +#define TLS1_CK_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA 0x03000063 +#define TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_SHA 0x03000064 +#define TLS1_CK_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA 0x03000065 +#define TLS1_CK_DHE_DSS_WITH_RC4_128_SHA 0x03000066 + +/* AES ciphersuites from RFC3268 */ + +#define TLS1_CK_RSA_WITH_AES_128_SHA 0x0300002F +#define TLS1_CK_DH_DSS_WITH_AES_128_SHA 0x03000030 +#define TLS1_CK_DH_RSA_WITH_AES_128_SHA 0x03000031 +#define TLS1_CK_DHE_DSS_WITH_AES_128_SHA 0x03000032 +#define TLS1_CK_DHE_RSA_WITH_AES_128_SHA 0x03000033 +#define TLS1_CK_ADH_WITH_AES_128_SHA 0x03000034 + +#define TLS1_CK_RSA_WITH_AES_256_SHA 0x03000035 +#define TLS1_CK_DH_DSS_WITH_AES_256_SHA 0x03000036 +#define TLS1_CK_DH_RSA_WITH_AES_256_SHA 0x03000037 +#define TLS1_CK_DHE_DSS_WITH_AES_256_SHA 0x03000038 +#define TLS1_CK_DHE_RSA_WITH_AES_256_SHA 0x03000039 +#define TLS1_CK_ADH_WITH_AES_256_SHA 0x0300003A + +/* ECC ciphersuites from draft-ietf-tls-ecc-01.txt (Mar 15, 2001). + * XXX NOTE: There is a bug in the draft, cipher numbers 4B, and 4C + * are defined twice so we define ECDH_ECDSA_EXPORT cipher + * suites to use 5B and 5C instead (this may change with future + * updates to the IETF draft). + */ +/* draft-ietf-tls-ecc-03.txt (June 2003) gives a changed list of + * ciphersuites, but does not define numbers for all of them + * because of possible conflicts with other Internet Drafts; + * most numbers are still subject to change. */ +#define TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA 0x03000047 +#define TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA 0x03000048 +#define TLS1_CK_ECDH_ECDSA_WITH_DES_CBC_SHA 0x03000049 +#define TLS1_CK_ECDH_ECDSA_WITH_DES_192_CBC3_SHA 0x0300004A +#define TLS1_CK_ECDH_ECDSA_WITH_AES_128_CBC_SHA 0x0300004B +#define TLS1_CK_ECDH_ECDSA_WITH_AES_256_CBC_SHA 0x0300004C +#define TLS1_CK_ECDH_ECDSA_EXPORT_WITH_RC4_40_SHA 0x0300005B +#define TLS1_CK_ECDH_ECDSA_EXPORT_WITH_RC4_56_SHA 0x0300005C + +#define TLS1_CK_ECDH_RSA_WITH_NULL_SHA 0x0300004D +#define TLS1_CK_ECDH_RSA_WITH_RC4_128_SHA 0x0300004E +#define TLS1_CK_ECDH_RSA_WITH_DES_CBC_SHA 0x0300004F +#define TLS1_CK_ECDH_RSA_WITH_DES_192_CBC3_SHA 0x03000050 +#define TLS1_CK_ECDH_RSA_WITH_AES_128_CBC_SHA 0x03000051 +#define TLS1_CK_ECDH_RSA_WITH_AES_256_CBC_SHA 0x03000052 +#define TLS1_CK_ECDH_RSA_EXPORT_WITH_RC4_40_SHA 0x03000053 +#define TLS1_CK_ECDH_RSA_EXPORT_WITH_RC4_56_SHA 0x03000054 + +#define TLS1_CK_ECDH_anon_WITH_NULL_SHA 0x03000055 +#define TLS1_CK_ECDH_anon_WITH_RC4_128_SHA 0x03000056 +#define TLS1_CK_ECDH_anon_WITH_DES_CBC_SHA 0x03000057 +#define TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA 0x03000058 +#define TLS1_CK_ECDH_anon_EXPORT_WITH_DES_40_CBC_SHA 0x03000059 +#define TLS1_CK_ECDH_anon_EXPORT_WITH_RC4_40_SHA 0x0300005A + +/* XXX: ECC ciphersuites offering forward secrecy are not yet specified + * in the ECC/TLS draft but our code allows them to be implemented + * very easily. To add such a cipher suite, one needs to add two constant + * definitions to this file and a new structure in s3_lib.c. We illustrate + * the process for the made-up ciphers ECDHE-ECDSA-AES128-SHA and + * ECDHE-RSA-AES128-SHA. + */ +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 0x03000077 +#define TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA 0x03000078 + + +/* XXX + * Inconsistency alert: + * The OpenSSL names of ciphers with ephemeral DH here include the string + * "DHE", while elsewhere it has always been "EDH". + * (The alias for the list of all such ciphers also is "EDH".) + * The specifications speak of "EDH"; maybe we should allow both forms + * for everything. */ +#define TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_MD5 "EXP1024-RC4-MD5" +#define TLS1_TXT_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5 "EXP1024-RC2-CBC-MD5" +#define TLS1_TXT_RSA_EXPORT1024_WITH_DES_CBC_SHA "EXP1024-DES-CBC-SHA" +#define TLS1_TXT_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA "EXP1024-DHE-DSS-DES-CBC-SHA" +#define TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_SHA "EXP1024-RC4-SHA" +#define TLS1_TXT_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA "EXP1024-DHE-DSS-RC4-SHA" +#define TLS1_TXT_DHE_DSS_WITH_RC4_128_SHA "DHE-DSS-RC4-SHA" + +/* AES ciphersuites from RFC3268 */ +#define TLS1_TXT_RSA_WITH_AES_128_SHA "AES128-SHA" +#define TLS1_TXT_DH_DSS_WITH_AES_128_SHA "DH-DSS-AES128-SHA" +#define TLS1_TXT_DH_RSA_WITH_AES_128_SHA "DH-RSA-AES128-SHA" +#define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA "DHE-DSS-AES128-SHA" +#define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA "DHE-RSA-AES128-SHA" +#define TLS1_TXT_ADH_WITH_AES_128_SHA "ADH-AES128-SHA" + +#define TLS1_TXT_RSA_WITH_AES_256_SHA "AES256-SHA" +#define TLS1_TXT_DH_DSS_WITH_AES_256_SHA "DH-DSS-AES256-SHA" +#define TLS1_TXT_DH_RSA_WITH_AES_256_SHA "DH-RSA-AES256-SHA" +#define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA "DHE-DSS-AES256-SHA" +#define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA "DHE-RSA-AES256-SHA" +#define TLS1_TXT_ADH_WITH_AES_256_SHA "ADH-AES256-SHA" + +/* ECC ciphersuites from draft-ietf-tls-ecc-01.txt (Mar 15, 2001) */ +#define TLS1_TXT_ECDH_ECDSA_WITH_NULL_SHA "ECDH-ECDSA-NULL-SHA" +#define TLS1_TXT_ECDH_ECDSA_WITH_RC4_128_SHA "ECDH-ECDSA-RC4-SHA" +#define TLS1_TXT_ECDH_ECDSA_WITH_DES_CBC_SHA "ECDH-ECDSA-DES-CBC-SHA" +#define TLS1_TXT_ECDH_ECDSA_WITH_DES_192_CBC3_SHA "ECDH-ECDSA-DES-CBC3-SHA" +#define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_CBC_SHA "ECDH-ECDSA-AES128-SHA" +#define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_CBC_SHA "ECDH-ECDSA-AES256-SHA" +#define TLS1_TXT_ECDH_ECDSA_EXPORT_WITH_RC4_40_SHA "EXP-ECDH-ECDSA-RC4-40-SHA" +#define TLS1_TXT_ECDH_ECDSA_EXPORT_WITH_RC4_56_SHA "EXP-ECDH-ECDSA-RC4-56-SHA" + +#define TLS1_TXT_ECDH_RSA_WITH_NULL_SHA "ECDH-RSA-NULL-SHA" +#define TLS1_TXT_ECDH_RSA_WITH_RC4_128_SHA "ECDH-RSA-RC4-SHA" +#define TLS1_TXT_ECDH_RSA_WITH_DES_CBC_SHA "ECDH-RSA-DES-CBC-SHA" +#define TLS1_TXT_ECDH_RSA_WITH_DES_192_CBC3_SHA "ECDH-RSA-DES-CBC3-SHA" +#define TLS1_TXT_ECDH_RSA_WITH_AES_128_CBC_SHA "ECDH-RSA-AES128-SHA" +#define TLS1_TXT_ECDH_RSA_WITH_AES_256_CBC_SHA "ECDH-RSA-AES256-SHA" +#define TLS1_TXT_ECDH_RSA_EXPORT_WITH_RC4_40_SHA "EXP-ECDH-RSA-RC4-40-SHA" +#define TLS1_TXT_ECDH_RSA_EXPORT_WITH_RC4_56_SHA "EXP-ECDH-RSA-RC4-56-SHA" + +#define TLS1_TXT_ECDH_anon_WITH_NULL_SHA "AECDH-NULL-SHA" +#define TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA "AECDH-RC4-SHA" +#define TLS1_TXT_ECDH_anon_WITH_DES_CBC_SHA "AECDH-DES-CBC-SHA" +#define TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA "AECDH-DES-CBC3-SHA" +#define TLS1_TXT_ECDH_anon_EXPORT_WITH_DES_40_CBC_SHA "EXP-AECDH-DES-40-CBC-SHA" +#define TLS1_TXT_ECDH_anon_EXPORT_WITH_RC4_40_SHA "EXP-AECDH-RC4-40-SHA" + +/* XXX: Made-up ECC cipher suites offering forward secrecy. This is for + * illustration only. + */ +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA "ECDHE-ECDSA-AES128-SHA" +#define TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA "ECDHE-RSA-AES128-SHA" + + +#define TLS_CT_RSA_SIGN 1 +#define TLS_CT_DSS_SIGN 2 +#define TLS_CT_RSA_FIXED_DH 3 +#define TLS_CT_DSS_FIXED_DH 4 +#define TLS_CT_ECDSA_SIGN 5 +#define TLS_CT_RSA_FIXED_ECDH 6 +#define TLS_CT_ECDSA_FIXED_ECDH 7 +#define TLS_CT_NUMBER 7 + +#define TLS1_FINISH_MAC_LENGTH 12 + +#define TLS_MD_MAX_CONST_SIZE 20 +#define TLS_MD_CLIENT_FINISH_CONST "client finished" +#define TLS_MD_CLIENT_FINISH_CONST_SIZE 15 +#define TLS_MD_SERVER_FINISH_CONST "server finished" +#define TLS_MD_SERVER_FINISH_CONST_SIZE 15 +#define TLS_MD_SERVER_WRITE_KEY_CONST "server write key" +#define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE 16 +#define TLS_MD_KEY_EXPANSION_CONST "key expansion" +#define TLS_MD_KEY_EXPANSION_CONST_SIZE 13 +#define TLS_MD_CLIENT_WRITE_KEY_CONST "client write key" +#define TLS_MD_CLIENT_WRITE_KEY_CONST_SIZE 16 +#define TLS_MD_SERVER_WRITE_KEY_CONST "server write key" +#define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE 16 +#define TLS_MD_IV_BLOCK_CONST "IV block" +#define TLS_MD_IV_BLOCK_CONST_SIZE 8 +#define TLS_MD_MASTER_SECRET_CONST "master secret" +#define TLS_MD_MASTER_SECRET_CONST_SIZE 13 + +#ifdef CHARSET_EBCDIC +#undef TLS_MD_CLIENT_FINISH_CONST +#define TLS_MD_CLIENT_FINISH_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x66\x69\x6e\x69\x73\x68\x65\x64" /*client finished*/ +#undef TLS_MD_SERVER_FINISH_CONST +#define TLS_MD_SERVER_FINISH_CONST "\x73\x65\x72\x76\x65\x72\x20\x66\x69\x6e\x69\x73\x68\x65\x64" /*server finished*/ +#undef TLS_MD_SERVER_WRITE_KEY_CONST +#define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" /*server write key*/ +#undef TLS_MD_KEY_EXPANSION_CONST +#define TLS_MD_KEY_EXPANSION_CONST "\x6b\x65\x79\x20\x65\x78\x70\x61\x6e\x73\x69\x6f\x6e" /*key expansion*/ +#undef TLS_MD_CLIENT_WRITE_KEY_CONST +#define TLS_MD_CLIENT_WRITE_KEY_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" /*client write key*/ +#undef TLS_MD_SERVER_WRITE_KEY_CONST +#define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" /*server write key*/ +#undef TLS_MD_IV_BLOCK_CONST +#define TLS_MD_IV_BLOCK_CONST "\x49\x56\x20\x62\x6c\x6f\x63\x6b" /*IV block*/ +#undef TLS_MD_MASTER_SECRET_CONST +#define TLS_MD_MASTER_SECRET_CONST "\x6d\x61\x73\x74\x65\x72\x20\x73\x65\x63\x72\x65\x74" /*master secret*/ +#endif + +#ifdef __cplusplus +} +#endif +#endif + + + diff --git a/h/openssl/tmdiff.h b/h/openssl/tmdiff.h new file mode 100644 index 0000000..af5c41c --- /dev/null +++ b/h/openssl/tmdiff.h @@ -0,0 +1,93 @@ +/* crypto/tmdiff.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* Header for dynamic hash table routines + * Author - Eric Young + */ +/* ... erm yeah, "dynamic hash tables" you say? + * + * And what would dynamic hash tables have to do with any of this code *now*? + * AFAICS, this code is only referenced by crypto/bn/exp.c which is an unused + * file that I doubt compiles any more. speed.c is the only thing that could + * use this (and it has nothing to do with hash tables), yet it instead has its + * own duplication of all this stuff and looks, if anything, more complete. See + * the corresponding note in apps/speed.c. + * The Bemused - Geoff + */ + +#ifndef HEADER_TMDIFF_H +#define HEADER_TMDIFF_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ms_tm MS_TM; + +MS_TM *ms_time_new(void ); +void ms_time_free(MS_TM *a); +void ms_time_get(MS_TM *a); +double ms_time_diff(MS_TM *start, MS_TM *end); +int ms_time_cmp(const MS_TM *ap, const MS_TM *bp); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/h/openssl/txt_db.h b/h/openssl/txt_db.h new file mode 100644 index 0000000..307e1ba --- /dev/null +++ b/h/openssl/txt_db.h @@ -0,0 +1,109 @@ +/* crypto/txt_db/txt_db.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_TXT_DB_H +#define HEADER_TXT_DB_H + +#include +#ifndef OPENSSL_NO_BIO +#include +#endif +#include +#include + +#define DB_ERROR_OK 0 +#define DB_ERROR_MALLOC 1 +#define DB_ERROR_INDEX_CLASH 2 +#define DB_ERROR_INDEX_OUT_OF_RANGE 3 +#define DB_ERROR_NO_INDEX 4 +#define DB_ERROR_INSERT_INDEX_CLASH 5 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct txt_db_st + { + int num_fields; + STACK /* char ** */ *data; + LHASH **index; + int (**qual)(char **); + long error; + long arg1; + long arg2; + char **arg_row; + } TXT_DB; + +#ifndef OPENSSL_NO_BIO +TXT_DB *TXT_DB_read(BIO *in, int num); +long TXT_DB_write(BIO *out, TXT_DB *db); +#else +TXT_DB *TXT_DB_read(char *in, int num); +long TXT_DB_write(char *out, TXT_DB *db); +#endif +int TXT_DB_create_index(TXT_DB *db,int field,int (*qual)(char **), + LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp); +void TXT_DB_free(TXT_DB *db); +char **TXT_DB_get_by_index(TXT_DB *db, int idx, char **value); +int TXT_DB_insert(TXT_DB *db,char **value); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/openssl/ui.h b/h/openssl/ui.h new file mode 100644 index 0000000..0182964 --- /dev/null +++ b/h/openssl/ui.h @@ -0,0 +1,381 @@ +/* crypto/ui/ui.h -*- mode:C; c-file-style: "eay" -*- */ +/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL + * project 2001. + */ +/* ==================================================================== + * Copyright (c) 2001 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_UI_H +#define HEADER_UI_H + +#ifndef OPENSSL_NO_DEPRECATED +#include +#endif +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Declared already in ossl_typ.h */ +/* typedef struct ui_st UI; */ +/* typedef struct ui_method_st UI_METHOD; */ + + +/* All the following functions return -1 or NULL on error and in some cases + (UI_process()) -2 if interrupted or in some other way cancelled. + When everything is fine, they return 0, a positive value or a non-NULL + pointer, all depending on their purpose. */ + +/* Creators and destructor. */ +UI *UI_new(void); +UI *UI_new_method(const UI_METHOD *method); +void UI_free(UI *ui); + +/* The following functions are used to add strings to be printed and prompt + strings to prompt for data. The names are UI_{add,dup}__string + and UI_{add,dup}_input_boolean. + + UI_{add,dup}__string have the following meanings: + add add a text or prompt string. The pointers given to these + functions are used verbatim, no copying is done. + dup make a copy of the text or prompt string, then add the copy + to the collection of strings in the user interface. + + The function is a name for the functionality that the given + string shall be used for. It can be one of: + input use the string as data prompt. + verify use the string as verification prompt. This + is used to verify a previous input. + info use the string for informational output. + error use the string for error output. + Honestly, there's currently no difference between info and error for the + moment. + + UI_{add,dup}_input_boolean have the same semantics for "add" and "dup", + and are typically used when one wants to prompt for a yes/no response. + + + All of the functions in this group take a UI and a prompt string. + The string input and verify addition functions also take a flag argument, + a buffer for the result to end up with, a minimum input size and a maximum + input size (the result buffer MUST be large enough to be able to contain + the maximum number of characters). Additionally, the verify addition + functions takes another buffer to compare the result against. + The boolean input functions take an action description string (which should + be safe to ignore if the expected user action is obvious, for example with + a dialog box with an OK button and a Cancel button), a string of acceptable + characters to mean OK and to mean Cancel. The two last strings are checked + to make sure they don't have common characters. Additionally, the same + flag argument as for the string input is taken, as well as a result buffer. + The result buffer is required to be at least one byte long. Depending on + the answer, the first character from the OK or the Cancel character strings + will be stored in the first byte of the result buffer. No NUL will be + added, so the result is *not* a string. + + On success, the all return an index of the added information. That index + is usefull when retrieving results with UI_get0_result(). */ +int UI_add_input_string(UI *ui, const char *prompt, int flags, + char *result_buf, int minsize, int maxsize); +int UI_dup_input_string(UI *ui, const char *prompt, int flags, + char *result_buf, int minsize, int maxsize); +int UI_add_verify_string(UI *ui, const char *prompt, int flags, + char *result_buf, int minsize, int maxsize, const char *test_buf); +int UI_dup_verify_string(UI *ui, const char *prompt, int flags, + char *result_buf, int minsize, int maxsize, const char *test_buf); +int UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc, + const char *ok_chars, const char *cancel_chars, + int flags, char *result_buf); +int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc, + const char *ok_chars, const char *cancel_chars, + int flags, char *result_buf); +int UI_add_info_string(UI *ui, const char *text); +int UI_dup_info_string(UI *ui, const char *text); +int UI_add_error_string(UI *ui, const char *text); +int UI_dup_error_string(UI *ui, const char *text); + +/* These are the possible flags. They can be or'ed together. */ +/* Use to have echoing of input */ +#define UI_INPUT_FLAG_ECHO 0x01 +/* Use a default password. Where that password is found is completely + up to the application, it might for example be in the user data set + with UI_add_user_data(). It is not recommended to have more than + one input in each UI being marked with this flag, or the application + might get confused. */ +#define UI_INPUT_FLAG_DEFAULT_PWD 0x02 + +/* The user of these routines may want to define flags of their own. The core + UI won't look at those, but will pass them on to the method routines. They + must use higher bits so they don't get confused with the UI bits above. + UI_INPUT_FLAG_USER_BASE tells which is the lowest bit to use. A good + example of use is this: + + #define MY_UI_FLAG1 (0x01 << UI_INPUT_FLAG_USER_BASE) + +*/ +#define UI_INPUT_FLAG_USER_BASE 16 + + +/* The following function helps construct a prompt. object_desc is a + textual short description of the object, for example "pass phrase", + and object_name is the name of the object (might be a card name or + a file name. + The returned string shall always be allocated on the heap with + OPENSSL_malloc(), and need to be free'd with OPENSSL_free(). + + If the ui_method doesn't contain a pointer to a user-defined prompt + constructor, a default string is built, looking like this: + + "Enter {object_desc} for {object_name}:" + + So, if object_desc has the value "pass phrase" and object_name has + the value "foo.key", the resulting string is: + + "Enter pass phrase for foo.key:" +*/ +char *UI_construct_prompt(UI *ui_method, + const char *object_desc, const char *object_name); + + +/* The following function is used to store a pointer to user-specific data. + Any previous such pointer will be returned and replaced. + + For callback purposes, this function makes a lot more sense than using + ex_data, since the latter requires that different parts of OpenSSL or + applications share the same ex_data index. + + Note that the UI_OpenSSL() method completely ignores the user data. + Other methods may not, however. */ +void *UI_add_user_data(UI *ui, void *user_data); +/* We need a user data retrieving function as well. */ +void *UI_get0_user_data(UI *ui); + +/* Return the result associated with a prompt given with the index i. */ +const char *UI_get0_result(UI *ui, int i); + +/* When all strings have been added, process the whole thing. */ +int UI_process(UI *ui); + +/* Give a user interface parametrised control commands. This can be used to + send down an integer, a data pointer or a function pointer, as well as + be used to get information from a UI. */ +int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)(void)); + +/* The commands */ +/* Use UI_CONTROL_PRINT_ERRORS with the value 1 to have UI_process print the + OpenSSL error stack before printing any info or added error messages and + before any prompting. */ +#define UI_CTRL_PRINT_ERRORS 1 +/* Check if a UI_process() is possible to do again with the same instance of + a user interface. This makes UI_ctrl() return 1 if it is redoable, and 0 + if not. */ +#define UI_CTRL_IS_REDOABLE 2 + + +/* Some methods may use extra data */ +#define UI_set_app_data(s,arg) UI_set_ex_data(s,0,arg) +#define UI_get_app_data(s) UI_get_ex_data(s,0) +int UI_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); +int UI_set_ex_data(UI *r,int idx,void *arg); +void *UI_get_ex_data(UI *r, int idx); + +/* Use specific methods instead of the built-in one */ +void UI_set_default_method(const UI_METHOD *meth); +const UI_METHOD *UI_get_default_method(void); +const UI_METHOD *UI_get_method(UI *ui); +const UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth); + +/* The method with all the built-in thingies */ +UI_METHOD *UI_OpenSSL(void); + + +/* ---------- For method writers ---------- */ +/* A method contains a number of functions that implement the low level + of the User Interface. The functions are: + + an opener This function starts a session, maybe by opening + a channel to a tty, or by opening a window. + a writer This function is called to write a given string, + maybe to the tty, maybe as a field label in a + window. + a flusher This function is called to flush everything that + has been output so far. It can be used to actually + display a dialog box after it has been built. + a reader This function is called to read a given prompt, + maybe from the tty, maybe from a field in a + window. Note that it's called wth all string + structures, not only the prompt ones, so it must + check such things itself. + a closer This function closes the session, maybe by closing + the channel to the tty, or closing the window. + + All these functions are expected to return: + + 0 on error. + 1 on success. + -1 on out-of-band events, for example if some prompting has + been canceled (by pressing Ctrl-C, for example). This is + only checked when returned by the flusher or the reader. + + The way this is used, the opener is first called, then the writer for all + strings, then the flusher, then the reader for all strings and finally the + closer. Note that if you want to prompt from a terminal or other command + line interface, the best is to have the reader also write the prompts + instead of having the writer do it. If you want to prompt from a dialog + box, the writer can be used to build up the contents of the box, and the + flusher to actually display the box and run the event loop until all data + has been given, after which the reader only grabs the given data and puts + them back into the UI strings. + + All method functions take a UI as argument. Additionally, the writer and + the reader take a UI_STRING. +*/ + +/* The UI_STRING type is the data structure that contains all the needed info + about a string or a prompt, including test data for a verification prompt. +*/ +DECLARE_STACK_OF(UI_STRING) +typedef struct ui_string_st UI_STRING; + +/* The different types of strings that are currently supported. + This is only needed by method authors. */ +enum UI_string_types + { + UIT_NONE=0, + UIT_PROMPT, /* Prompt for a string */ + UIT_VERIFY, /* Prompt for a string and verify */ + UIT_BOOLEAN, /* Prompt for a yes/no response */ + UIT_INFO, /* Send info to the user */ + UIT_ERROR /* Send an error message to the user */ + }; + +/* Create and manipulate methods */ +UI_METHOD *UI_create_method(char *name); +void UI_destroy_method(UI_METHOD *ui_method); +int UI_method_set_opener(UI_METHOD *method, int (*opener)(UI *ui)); +int UI_method_set_writer(UI_METHOD *method, int (*writer)(UI *ui, UI_STRING *uis)); +int UI_method_set_flusher(UI_METHOD *method, int (*flusher)(UI *ui)); +int UI_method_set_reader(UI_METHOD *method, int (*reader)(UI *ui, UI_STRING *uis)); +int UI_method_set_closer(UI_METHOD *method, int (*closer)(UI *ui)); +int (*UI_method_get_opener(UI_METHOD *method))(UI*); +int (*UI_method_get_writer(UI_METHOD *method))(UI*,UI_STRING*); +int (*UI_method_get_flusher(UI_METHOD *method))(UI*); +int (*UI_method_get_reader(UI_METHOD *method))(UI*,UI_STRING*); +int (*UI_method_get_closer(UI_METHOD *method))(UI*); + +/* The following functions are helpers for method writers to access relevant + data from a UI_STRING. */ + +/* Return type of the UI_STRING */ +enum UI_string_types UI_get_string_type(UI_STRING *uis); +/* Return input flags of the UI_STRING */ +int UI_get_input_flags(UI_STRING *uis); +/* Return the actual string to output (the prompt, info or error) */ +const char *UI_get0_output_string(UI_STRING *uis); +/* Return the optional action string to output (the boolean promtp instruction) */ +const char *UI_get0_action_string(UI_STRING *uis); +/* Return the result of a prompt */ +const char *UI_get0_result_string(UI_STRING *uis); +/* Return the string to test the result against. Only useful with verifies. */ +const char *UI_get0_test_string(UI_STRING *uis); +/* Return the required minimum size of the result */ +int UI_get_result_minsize(UI_STRING *uis); +/* Return the required maximum size of the result */ +int UI_get_result_maxsize(UI_STRING *uis); +/* Set the result of a UI_STRING. */ +int UI_set_result(UI *ui, UI_STRING *uis, const char *result); + + +/* A couple of popular utility functions */ +int UI_UTIL_read_pw_string(char *buf,int length,const char *prompt,int verify); +int UI_UTIL_read_pw(char *buf,char *buff,int size,const char *prompt,int verify); + + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_UI_strings(void); + +/* Error codes for the UI functions. */ + +/* Function codes. */ +#define UI_F_GENERAL_ALLOCATE_BOOLEAN 108 +#define UI_F_GENERAL_ALLOCATE_PROMPT 109 +#define UI_F_GENERAL_ALLOCATE_STRING 100 +#define UI_F_UI_CTRL 111 +#define UI_F_UI_DUP_ERROR_STRING 101 +#define UI_F_UI_DUP_INFO_STRING 102 +#define UI_F_UI_DUP_INPUT_BOOLEAN 110 +#define UI_F_UI_DUP_INPUT_STRING 103 +#define UI_F_UI_DUP_VERIFY_STRING 106 +#define UI_F_UI_GET0_RESULT 107 +#define UI_F_UI_NEW_METHOD 104 +#define UI_F_UI_SET_RESULT 105 + +/* Reason codes. */ +#define UI_R_COMMON_OK_AND_CANCEL_CHARACTERS 104 +#define UI_R_INDEX_TOO_LARGE 102 +#define UI_R_INDEX_TOO_SMALL 103 +#define UI_R_NO_RESULT_BUFFER 105 +#define UI_R_RESULT_TOO_LARGE 100 +#define UI_R_RESULT_TOO_SMALL 101 +#define UI_R_UNKNOWN_CONTROL_COMMAND 106 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/openssl/ui_compat.h b/h/openssl/ui_compat.h new file mode 100644 index 0000000..b35c9bb --- /dev/null +++ b/h/openssl/ui_compat.h @@ -0,0 +1,83 @@ +/* crypto/ui/ui.h -*- mode:C; c-file-style: "eay" -*- */ +/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL + * project 2001. + */ +/* ==================================================================== + * Copyright (c) 2001 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_UI_COMPAT_H +#define HEADER_UI_COMPAT_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* The following functions were previously part of the DES section, + and are provided here for backward compatibility reasons. */ + +#define des_read_pw_string(b,l,p,v) \ + _ossl_old_des_read_pw_string((b),(l),(p),(v)) +#define des_read_pw(b,bf,s,p,v) \ + _ossl_old_des_read_pw((b),(bf),(s),(p),(v)) + +int _ossl_old_des_read_pw_string(char *buf,int length,const char *prompt,int verify); +int _ossl_old_des_read_pw(char *buf,char *buff,int size,const char *prompt,int verify); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/openssl/wr_err.h b/h/openssl/wr_err.h new file mode 100644 index 0000000..e0da401 --- /dev/null +++ b/h/openssl/wr_err.h @@ -0,0 +1,52 @@ +/* wr_err.h Wind River error logging */ +/* Copyright 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,18apr05,tat created +*/ + +/* + + This file declares the functions and reason codes that are used by Wind River + software to report errors to the Openssl ERR module. + + The actual error strings are declared in target/src/security/compatibility/vxworks/wr_err.c. + + Refer to the ERR module documentation for details on how to use the ERR module. + +*/ + + +#include + +void ERR_load_WRSECLIB_strings(void); + +#define SECLIBerr(f,r) ERR_PUT_error(ERR_LIB_WRSECLIB,(f),(r),__FILE__,__LINE__) + +enum wrseclib_funcs { + WRSECLIB_F_cciEVPDigestInit_ex=100, + WRSECLIB_F_cciEVPDigestUpdate, + WRSECLIB_F_cciEVPDigestFinal, + WRSECLIB_F_cciEVPDigestCleanup, + WRSECLIB_F_cciEVPDigestCopy, + WRSECLIB_F_cciEVPCipherInit, + WRSECLIB_F_cciEVPCipher, + WRSECLIB_F_cciEVPCipherCleanup, + WRSECLIB_F_RSA_cci_cipher, + WRSECLIB_F_RSA_cci_sign_verify, + WRSECLIB_F_HMAC_Init_ex, + WRSECLIB_F_HMAC_Update, + WRSECLIB_F_HMAC_Final + }; + +enum wrseclib_reasons { + WRSECLIB_R_CCI_FAILED=100, + WRSECLIB_R_NON_COPY_SAFE_CONTEXT, + WRSECLIB_R_UNKNOWN_ALGORITHM_TYPE, + WRSECLIB_R_OAEP_NOT_SUPPORTED, + WRSECLIB_R_UNKNOWN_PADDING_TYPE, + WRSECLIB_R_TASK_SUSPEND + }; + diff --git a/h/openssl/x509.h b/h/openssl/x509.h new file mode 100644 index 0000000..66990ae --- /dev/null +++ b/h/openssl/x509.h @@ -0,0 +1,1340 @@ +/* crypto/x509/x509.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * ECDH support in OpenSSL originally developed by + * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. + */ + +#ifndef HEADER_X509_H +#define HEADER_X509_H + +#include +#include +#ifndef OPENSSL_NO_BUFFER +#include +#endif +#ifndef OPENSSL_NO_EVP +#include +#endif +#ifndef OPENSSL_NO_BIO +#include +#endif +#include +#include +#include + +#ifndef OPENSSL_NO_EC +#include +#endif + +#ifndef OPENSSL_NO_ECDSA +#include +#endif + +#ifndef OPENSSL_NO_ECDH +#include +#endif + +#ifndef OPENSSL_NO_DEPRECATED +#ifndef OPENSSL_NO_RSA +#include +#endif +#ifndef OPENSSL_NO_DSA +#include +#endif +#ifndef OPENSSL_NO_DH +#include +#endif +#endif + +#ifndef OPENSSL_NO_SHA +#include +#endif +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OPENSSL_SYS_WIN32 +/* Under Win32 these are defined in wincrypt.h */ +#undef X509_NAME +#undef X509_CERT_PAIR +#endif + +#define X509_FILETYPE_PEM 1 +#define X509_FILETYPE_ASN1 2 +#define X509_FILETYPE_DEFAULT 3 + +#define X509v3_KU_DIGITAL_SIGNATURE 0x0080 +#define X509v3_KU_NON_REPUDIATION 0x0040 +#define X509v3_KU_KEY_ENCIPHERMENT 0x0020 +#define X509v3_KU_DATA_ENCIPHERMENT 0x0010 +#define X509v3_KU_KEY_AGREEMENT 0x0008 +#define X509v3_KU_KEY_CERT_SIGN 0x0004 +#define X509v3_KU_CRL_SIGN 0x0002 +#define X509v3_KU_ENCIPHER_ONLY 0x0001 +#define X509v3_KU_DECIPHER_ONLY 0x8000 +#define X509v3_KU_UNDEF 0xffff + +typedef struct X509_objects_st + { + int nid; + int (*a2i)(void); + int (*i2a)(void); + } X509_OBJECTS; + +struct X509_algor_st + { + ASN1_OBJECT *algorithm; + ASN1_TYPE *parameter; + } /* X509_ALGOR */; + +DECLARE_STACK_OF(X509_ALGOR) +DECLARE_ASN1_SET_OF(X509_ALGOR) + +typedef struct X509_val_st + { + ASN1_TIME *notBefore; + ASN1_TIME *notAfter; + } X509_VAL; + +typedef struct X509_pubkey_st + { + X509_ALGOR *algor; + ASN1_BIT_STRING *public_key; + EVP_PKEY *pkey; + } X509_PUBKEY; + +typedef struct X509_sig_st + { + X509_ALGOR *algor; + ASN1_OCTET_STRING *digest; + } X509_SIG; + +typedef struct X509_name_entry_st + { + ASN1_OBJECT *object; + ASN1_STRING *value; + int set; + int size; /* temp variable */ + } X509_NAME_ENTRY; + +DECLARE_STACK_OF(X509_NAME_ENTRY) +DECLARE_ASN1_SET_OF(X509_NAME_ENTRY) + +/* we always keep X509_NAMEs in 2 forms. */ +struct X509_name_st + { + STACK_OF(X509_NAME_ENTRY) *entries; + int modified; /* true if 'bytes' needs to be built */ +#ifndef OPENSSL_NO_BUFFER + BUF_MEM *bytes; +#else + char *bytes; +#endif + unsigned long hash; /* Keep the hash around for lookups */ + } /* X509_NAME */; + +DECLARE_STACK_OF(X509_NAME) + +#define X509_EX_V_NETSCAPE_HACK 0x8000 +#define X509_EX_V_INIT 0x0001 +typedef struct X509_extension_st + { + ASN1_OBJECT *object; + ASN1_BOOLEAN critical; + ASN1_OCTET_STRING *value; + } X509_EXTENSION; + +DECLARE_STACK_OF(X509_EXTENSION) +DECLARE_ASN1_SET_OF(X509_EXTENSION) + +/* a sequence of these are used */ +typedef struct x509_attributes_st + { + ASN1_OBJECT *object; + int single; /* 0 for a set, 1 for a single item (which is wrong) */ + union { + char *ptr; +/* 0 */ STACK_OF(ASN1_TYPE) *set; +/* 1 */ ASN1_TYPE *single; + } value; + } X509_ATTRIBUTE; + +DECLARE_STACK_OF(X509_ATTRIBUTE) +DECLARE_ASN1_SET_OF(X509_ATTRIBUTE) + + +typedef struct X509_req_info_st + { + ASN1_ENCODING enc; + ASN1_INTEGER *version; + X509_NAME *subject; + X509_PUBKEY *pubkey; + /* d=2 hl=2 l= 0 cons: cont: 00 */ + STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */ + } X509_REQ_INFO; + +typedef struct X509_req_st + { + X509_REQ_INFO *req_info; + X509_ALGOR *sig_alg; + ASN1_BIT_STRING *signature; + int references; + } X509_REQ; + +typedef struct x509_cinf_st + { + ASN1_INTEGER *version; /* [ 0 ] default of v1 */ + ASN1_INTEGER *serialNumber; + X509_ALGOR *signature; + X509_NAME *issuer; + X509_VAL *validity; + X509_NAME *subject; + X509_PUBKEY *key; + ASN1_BIT_STRING *issuerUID; /* [ 1 ] optional in v2 */ + ASN1_BIT_STRING *subjectUID; /* [ 2 ] optional in v2 */ + STACK_OF(X509_EXTENSION) *extensions; /* [ 3 ] optional in v3 */ + } X509_CINF; + +/* This stuff is certificate "auxiliary info" + * it contains details which are useful in certificate + * stores and databases. When used this is tagged onto + * the end of the certificate itself + */ + +typedef struct x509_cert_aux_st + { + STACK_OF(ASN1_OBJECT) *trust; /* trusted uses */ + STACK_OF(ASN1_OBJECT) *reject; /* rejected uses */ + ASN1_UTF8STRING *alias; /* "friendly name" */ + ASN1_OCTET_STRING *keyid; /* key id of private key */ + STACK_OF(X509_ALGOR) *other; /* other unspecified info */ + } X509_CERT_AUX; + +struct x509_st + { + X509_CINF *cert_info; + X509_ALGOR *sig_alg; + ASN1_BIT_STRING *signature; + int valid; + int references; + char *name; + CRYPTO_EX_DATA ex_data; + /* These contain copies of various extension values */ + long ex_pathlen; + long ex_pcpathlen; + unsigned long ex_flags; + unsigned long ex_kusage; + unsigned long ex_xkusage; + unsigned long ex_nscert; + ASN1_OCTET_STRING *skid; + struct AUTHORITY_KEYID_st *akid; + X509_POLICY_CACHE *policy_cache; +#ifndef OPENSSL_NO_SHA + unsigned char sha1_hash[SHA_DIGEST_LENGTH]; +#endif + X509_CERT_AUX *aux; + } /* X509 */; + +DECLARE_STACK_OF(X509) +DECLARE_ASN1_SET_OF(X509) + +/* This is used for a table of trust checking functions */ + +typedef struct x509_trust_st { + int trust; + int flags; + int (*check_trust)(struct x509_trust_st *, X509 *, int); + char *name; + int arg1; + void *arg2; +} X509_TRUST; + +DECLARE_STACK_OF(X509_TRUST) + +typedef struct x509_cert_pair_st { + X509 *forward; + X509 *reverse; +} X509_CERT_PAIR; + +/* standard trust ids */ + +#define X509_TRUST_DEFAULT -1 /* Only valid in purpose settings */ + +#define X509_TRUST_COMPAT 1 +#define X509_TRUST_SSL_CLIENT 2 +#define X509_TRUST_SSL_SERVER 3 +#define X509_TRUST_EMAIL 4 +#define X509_TRUST_OBJECT_SIGN 5 +#define X509_TRUST_OCSP_SIGN 6 +#define X509_TRUST_OCSP_REQUEST 7 + +/* Keep these up to date! */ +#define X509_TRUST_MIN 1 +#define X509_TRUST_MAX 7 + + +/* trust_flags values */ +#define X509_TRUST_DYNAMIC 1 +#define X509_TRUST_DYNAMIC_NAME 2 + +/* check_trust return codes */ + +#define X509_TRUST_TRUSTED 1 +#define X509_TRUST_REJECTED 2 +#define X509_TRUST_UNTRUSTED 3 + +/* Flags for X509_print_ex() */ + +#define X509_FLAG_COMPAT 0 +#define X509_FLAG_NO_HEADER 1L +#define X509_FLAG_NO_VERSION (1L << 1) +#define X509_FLAG_NO_SERIAL (1L << 2) +#define X509_FLAG_NO_SIGNAME (1L << 3) +#define X509_FLAG_NO_ISSUER (1L << 4) +#define X509_FLAG_NO_VALIDITY (1L << 5) +#define X509_FLAG_NO_SUBJECT (1L << 6) +#define X509_FLAG_NO_PUBKEY (1L << 7) +#define X509_FLAG_NO_EXTENSIONS (1L << 8) +#define X509_FLAG_NO_SIGDUMP (1L << 9) +#define X509_FLAG_NO_AUX (1L << 10) +#define X509_FLAG_NO_ATTRIBUTES (1L << 11) + +/* Flags specific to X509_NAME_print_ex() */ + +/* The field separator information */ + +#define XN_FLAG_SEP_MASK (0xf << 16) + +#define XN_FLAG_COMPAT 0 /* Traditional SSLeay: use old X509_NAME_print */ +#define XN_FLAG_SEP_COMMA_PLUS (1 << 16) /* RFC2253 ,+ */ +#define XN_FLAG_SEP_CPLUS_SPC (2 << 16) /* ,+ spaced: more readable */ +#define XN_FLAG_SEP_SPLUS_SPC (3 << 16) /* ;+ spaced */ +#define XN_FLAG_SEP_MULTILINE (4 << 16) /* One line per field */ + +#define XN_FLAG_DN_REV (1 << 20) /* Reverse DN order */ + +/* How the field name is shown */ + +#define XN_FLAG_FN_MASK (0x3 << 21) + +#define XN_FLAG_FN_SN 0 /* Object short name */ +#define XN_FLAG_FN_LN (1 << 21) /* Object long name */ +#define XN_FLAG_FN_OID (2 << 21) /* Always use OIDs */ +#define XN_FLAG_FN_NONE (3 << 21) /* No field names */ + +#define XN_FLAG_SPC_EQ (1 << 23) /* Put spaces round '=' */ + +/* This determines if we dump fields we don't recognise: + * RFC2253 requires this. + */ + +#define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24) + +#define XN_FLAG_FN_ALIGN (1 << 25) /* Align field names to 20 characters */ + +/* Complete set of RFC2253 flags */ + +#define XN_FLAG_RFC2253 (ASN1_STRFLGS_RFC2253 | \ + XN_FLAG_SEP_COMMA_PLUS | \ + XN_FLAG_DN_REV | \ + XN_FLAG_FN_SN | \ + XN_FLAG_DUMP_UNKNOWN_FIELDS) + +/* readable oneline form */ + +#define XN_FLAG_ONELINE (ASN1_STRFLGS_RFC2253 | \ + ASN1_STRFLGS_ESC_QUOTE | \ + XN_FLAG_SEP_CPLUS_SPC | \ + XN_FLAG_SPC_EQ | \ + XN_FLAG_FN_SN) + +/* readable multiline form */ + +#define XN_FLAG_MULTILINE (ASN1_STRFLGS_ESC_CTRL | \ + ASN1_STRFLGS_ESC_MSB | \ + XN_FLAG_SEP_MULTILINE | \ + XN_FLAG_SPC_EQ | \ + XN_FLAG_FN_LN | \ + XN_FLAG_FN_ALIGN) + +typedef struct X509_revoked_st + { + ASN1_INTEGER *serialNumber; + ASN1_TIME *revocationDate; + STACK_OF(X509_EXTENSION) /* optional */ *extensions; + int sequence; /* load sequence */ + } X509_REVOKED; + +DECLARE_STACK_OF(X509_REVOKED) +DECLARE_ASN1_SET_OF(X509_REVOKED) + +typedef struct X509_crl_info_st + { + ASN1_INTEGER *version; + X509_ALGOR *sig_alg; + X509_NAME *issuer; + ASN1_TIME *lastUpdate; + ASN1_TIME *nextUpdate; + STACK_OF(X509_REVOKED) *revoked; + STACK_OF(X509_EXTENSION) /* [0] */ *extensions; + ASN1_ENCODING enc; + } X509_CRL_INFO; + +struct X509_crl_st + { + /* actual signature */ + X509_CRL_INFO *crl; + X509_ALGOR *sig_alg; + ASN1_BIT_STRING *signature; + int references; + } /* X509_CRL */; + +DECLARE_STACK_OF(X509_CRL) +DECLARE_ASN1_SET_OF(X509_CRL) + +typedef struct private_key_st + { + int version; + /* The PKCS#8 data types */ + X509_ALGOR *enc_algor; + ASN1_OCTET_STRING *enc_pkey; /* encrypted pub key */ + + /* When decrypted, the following will not be NULL */ + EVP_PKEY *dec_pkey; + + /* used to encrypt and decrypt */ + int key_length; + char *key_data; + int key_free; /* true if we should auto free key_data */ + + /* expanded version of 'enc_algor' */ + EVP_CIPHER_INFO cipher; + + int references; + } X509_PKEY; + +#ifndef OPENSSL_NO_EVP +typedef struct X509_info_st + { + X509 *x509; + X509_CRL *crl; + X509_PKEY *x_pkey; + + EVP_CIPHER_INFO enc_cipher; + int enc_len; + char *enc_data; + + int references; + } X509_INFO; + +DECLARE_STACK_OF(X509_INFO) +#endif + +/* The next 2 structures and their 8 routines were sent to me by + * Pat Richard and are used to manipulate + * Netscapes spki structures - useful if you are writing a CA web page + */ +typedef struct Netscape_spkac_st + { + X509_PUBKEY *pubkey; + ASN1_IA5STRING *challenge; /* challenge sent in atlas >= PR2 */ + } NETSCAPE_SPKAC; + +typedef struct Netscape_spki_st + { + NETSCAPE_SPKAC *spkac; /* signed public key and challenge */ + X509_ALGOR *sig_algor; + ASN1_BIT_STRING *signature; + } NETSCAPE_SPKI; + +/* Netscape certificate sequence structure */ +typedef struct Netscape_certificate_sequence + { + ASN1_OBJECT *type; + STACK_OF(X509) *certs; + } NETSCAPE_CERT_SEQUENCE; + +/* Unused (and iv length is wrong) +typedef struct CBCParameter_st + { + unsigned char iv[8]; + } CBC_PARAM; +*/ + +/* Password based encryption structure */ + +typedef struct PBEPARAM_st { +ASN1_OCTET_STRING *salt; +ASN1_INTEGER *iter; +} PBEPARAM; + +/* Password based encryption V2 structures */ + +typedef struct PBE2PARAM_st { +X509_ALGOR *keyfunc; +X509_ALGOR *encryption; +} PBE2PARAM; + +typedef struct PBKDF2PARAM_st { +ASN1_TYPE *salt; /* Usually OCTET STRING but could be anything */ +ASN1_INTEGER *iter; +ASN1_INTEGER *keylength; +X509_ALGOR *prf; +} PBKDF2PARAM; + + +/* PKCS#8 private key info structure */ + +typedef struct pkcs8_priv_key_info_st + { + int broken; /* Flag for various broken formats */ +#define PKCS8_OK 0 +#define PKCS8_NO_OCTET 1 +#define PKCS8_EMBEDDED_PARAM 2 +#define PKCS8_NS_DB 3 + ASN1_INTEGER *version; + X509_ALGOR *pkeyalg; + ASN1_TYPE *pkey; /* Should be OCTET STRING but some are broken */ + STACK_OF(X509_ATTRIBUTE) *attributes; + } PKCS8_PRIV_KEY_INFO; + +#ifdef __cplusplus +} +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef SSLEAY_MACROS +#define X509_verify(a,r) ASN1_verify((int (*)())i2d_X509_CINF,a->sig_alg,\ + a->signature,(char *)a->cert_info,r) +#define X509_REQ_verify(a,r) ASN1_verify((int (*)())i2d_X509_REQ_INFO, \ + a->sig_alg,a->signature,(char *)a->req_info,r) +#define X509_CRL_verify(a,r) ASN1_verify((int (*)())i2d_X509_CRL_INFO, \ + a->sig_alg, a->signature,(char *)a->crl,r) + +#define X509_sign(x,pkey,md) \ + ASN1_sign((int (*)())i2d_X509_CINF, x->cert_info->signature, \ + x->sig_alg, x->signature, (char *)x->cert_info,pkey,md) +#define X509_REQ_sign(x,pkey,md) \ + ASN1_sign((int (*)())i2d_X509_REQ_INFO,x->sig_alg, NULL, \ + x->signature, (char *)x->req_info,pkey,md) +#define X509_CRL_sign(x,pkey,md) \ + ASN1_sign((int (*)())i2d_X509_CRL_INFO,x->crl->sig_alg,x->sig_alg, \ + x->signature, (char *)x->crl,pkey,md) +#define NETSCAPE_SPKI_sign(x,pkey,md) \ + ASN1_sign((int (*)())i2d_NETSCAPE_SPKAC, x->sig_algor,NULL, \ + x->signature, (char *)x->spkac,pkey,md) + +#define X509_dup(x509) (X509 *)ASN1_dup((int (*)())i2d_X509, \ + (char *(*)())d2i_X509,(char *)x509) +#define X509_ATTRIBUTE_dup(xa) (X509_ATTRIBUTE *)ASN1_dup(\ + (int (*)())i2d_X509_ATTRIBUTE, \ + (char *(*)())d2i_X509_ATTRIBUTE,(char *)xa) +#define X509_EXTENSION_dup(ex) (X509_EXTENSION *)ASN1_dup( \ + (int (*)())i2d_X509_EXTENSION, \ + (char *(*)())d2i_X509_EXTENSION,(char *)ex) +#define d2i_X509_fp(fp,x509) (X509 *)ASN1_d2i_fp((char *(*)())X509_new, \ + (char *(*)())d2i_X509, (fp),(unsigned char **)(x509)) +#define i2d_X509_fp(fp,x509) ASN1_i2d_fp(i2d_X509,fp,(unsigned char *)x509) +#define d2i_X509_bio(bp,x509) (X509 *)ASN1_d2i_bio((char *(*)())X509_new, \ + (char *(*)())d2i_X509, (bp),(unsigned char **)(x509)) +#define i2d_X509_bio(bp,x509) ASN1_i2d_bio(i2d_X509,bp,(unsigned char *)x509) + +#define X509_CRL_dup(crl) (X509_CRL *)ASN1_dup((int (*)())i2d_X509_CRL, \ + (char *(*)())d2i_X509_CRL,(char *)crl) +#define d2i_X509_CRL_fp(fp,crl) (X509_CRL *)ASN1_d2i_fp((char *(*)()) \ + X509_CRL_new,(char *(*)())d2i_X509_CRL, (fp),\ + (unsigned char **)(crl)) +#define i2d_X509_CRL_fp(fp,crl) ASN1_i2d_fp(i2d_X509_CRL,fp,\ + (unsigned char *)crl) +#define d2i_X509_CRL_bio(bp,crl) (X509_CRL *)ASN1_d2i_bio((char *(*)()) \ + X509_CRL_new,(char *(*)())d2i_X509_CRL, (bp),\ + (unsigned char **)(crl)) +#define i2d_X509_CRL_bio(bp,crl) ASN1_i2d_bio(i2d_X509_CRL,bp,\ + (unsigned char *)crl) + +#define PKCS7_dup(p7) (PKCS7 *)ASN1_dup((int (*)())i2d_PKCS7, \ + (char *(*)())d2i_PKCS7,(char *)p7) +#define d2i_PKCS7_fp(fp,p7) (PKCS7 *)ASN1_d2i_fp((char *(*)()) \ + PKCS7_new,(char *(*)())d2i_PKCS7, (fp),\ + (unsigned char **)(p7)) +#define i2d_PKCS7_fp(fp,p7) ASN1_i2d_fp(i2d_PKCS7,fp,\ + (unsigned char *)p7) +#define d2i_PKCS7_bio(bp,p7) (PKCS7 *)ASN1_d2i_bio((char *(*)()) \ + PKCS7_new,(char *(*)())d2i_PKCS7, (bp),\ + (unsigned char **)(p7)) +#define i2d_PKCS7_bio(bp,p7) ASN1_i2d_bio(i2d_PKCS7,bp,\ + (unsigned char *)p7) + +#define X509_REQ_dup(req) (X509_REQ *)ASN1_dup((int (*)())i2d_X509_REQ, \ + (char *(*)())d2i_X509_REQ,(char *)req) +#define d2i_X509_REQ_fp(fp,req) (X509_REQ *)ASN1_d2i_fp((char *(*)())\ + X509_REQ_new, (char *(*)())d2i_X509_REQ, (fp),\ + (unsigned char **)(req)) +#define i2d_X509_REQ_fp(fp,req) ASN1_i2d_fp(i2d_X509_REQ,fp,\ + (unsigned char *)req) +#define d2i_X509_REQ_bio(bp,req) (X509_REQ *)ASN1_d2i_bio((char *(*)())\ + X509_REQ_new, (char *(*)())d2i_X509_REQ, (bp),\ + (unsigned char **)(req)) +#define i2d_X509_REQ_bio(bp,req) ASN1_i2d_bio(i2d_X509_REQ,bp,\ + (unsigned char *)req) + +#define RSAPublicKey_dup(rsa) (RSA *)ASN1_dup((int (*)())i2d_RSAPublicKey, \ + (char *(*)())d2i_RSAPublicKey,(char *)rsa) +#define RSAPrivateKey_dup(rsa) (RSA *)ASN1_dup((int (*)())i2d_RSAPrivateKey, \ + (char *(*)())d2i_RSAPrivateKey,(char *)rsa) + +#define d2i_RSAPrivateKey_fp(fp,rsa) (RSA *)ASN1_d2i_fp((char *(*)())\ + RSA_new,(char *(*)())d2i_RSAPrivateKey, (fp), \ + (unsigned char **)(rsa)) +#define i2d_RSAPrivateKey_fp(fp,rsa) ASN1_i2d_fp(i2d_RSAPrivateKey,fp, \ + (unsigned char *)rsa) +#define d2i_RSAPrivateKey_bio(bp,rsa) (RSA *)ASN1_d2i_bio((char *(*)())\ + RSA_new,(char *(*)())d2i_RSAPrivateKey, (bp), \ + (unsigned char **)(rsa)) +#define i2d_RSAPrivateKey_bio(bp,rsa) ASN1_i2d_bio(i2d_RSAPrivateKey,bp, \ + (unsigned char *)rsa) + +#define d2i_RSAPublicKey_fp(fp,rsa) (RSA *)ASN1_d2i_fp((char *(*)())\ + RSA_new,(char *(*)())d2i_RSAPublicKey, (fp), \ + (unsigned char **)(rsa)) +#define i2d_RSAPublicKey_fp(fp,rsa) ASN1_i2d_fp(i2d_RSAPublicKey,fp, \ + (unsigned char *)rsa) +#define d2i_RSAPublicKey_bio(bp,rsa) (RSA *)ASN1_d2i_bio((char *(*)())\ + RSA_new,(char *(*)())d2i_RSAPublicKey, (bp), \ + (unsigned char **)(rsa)) +#define i2d_RSAPublicKey_bio(bp,rsa) ASN1_i2d_bio(i2d_RSAPublicKey,bp, \ + (unsigned char *)rsa) + +#define d2i_DSAPrivateKey_fp(fp,dsa) (DSA *)ASN1_d2i_fp((char *(*)())\ + DSA_new,(char *(*)())d2i_DSAPrivateKey, (fp), \ + (unsigned char **)(dsa)) +#define i2d_DSAPrivateKey_fp(fp,dsa) ASN1_i2d_fp(i2d_DSAPrivateKey,fp, \ + (unsigned char *)dsa) +#define d2i_DSAPrivateKey_bio(bp,dsa) (DSA *)ASN1_d2i_bio((char *(*)())\ + DSA_new,(char *(*)())d2i_DSAPrivateKey, (bp), \ + (unsigned char **)(dsa)) +#define i2d_DSAPrivateKey_bio(bp,dsa) ASN1_i2d_bio(i2d_DSAPrivateKey,bp, \ + (unsigned char *)dsa) + +#define d2i_ECPrivateKey_fp(fp,ecdsa) (EC_KEY *)ASN1_d2i_fp((char *(*)())\ + EC_KEY_new,(char *(*)())d2i_ECPrivateKey, (fp), \ + (unsigned char **)(ecdsa)) +#define i2d_ECPrivateKey_fp(fp,ecdsa) ASN1_i2d_fp(i2d_ECPrivateKey,fp, \ + (unsigned char *)ecdsa) +#define d2i_ECPrivateKey_bio(bp,ecdsa) (EC_KEY *)ASN1_d2i_bio((char *(*)())\ + EC_KEY_new,(char *(*)())d2i_ECPrivateKey, (bp), \ + (unsigned char **)(ecdsa)) +#define i2d_ECPrivateKey_bio(bp,ecdsa) ASN1_i2d_bio(i2d_ECPrivateKey,bp, \ + (unsigned char *)ecdsa) + +#define X509_ALGOR_dup(xn) (X509_ALGOR *)ASN1_dup((int (*)())i2d_X509_ALGOR,\ + (char *(*)())d2i_X509_ALGOR,(char *)xn) + +#define X509_NAME_dup(xn) (X509_NAME *)ASN1_dup((int (*)())i2d_X509_NAME, \ + (char *(*)())d2i_X509_NAME,(char *)xn) +#define X509_NAME_ENTRY_dup(ne) (X509_NAME_ENTRY *)ASN1_dup( \ + (int (*)())i2d_X509_NAME_ENTRY, \ + (char *(*)())d2i_X509_NAME_ENTRY,\ + (char *)ne) + +#define X509_digest(data,type,md,len) \ + ASN1_digest((int (*)())i2d_X509,type,(char *)data,md,len) +#define X509_NAME_digest(data,type,md,len) \ + ASN1_digest((int (*)())i2d_X509_NAME,type,(char *)data,md,len) +#ifndef PKCS7_ISSUER_AND_SERIAL_digest +#define PKCS7_ISSUER_AND_SERIAL_digest(data,type,md,len) \ + ASN1_digest((int (*)())i2d_PKCS7_ISSUER_AND_SERIAL,type,\ + (char *)data,md,len) +#endif +#endif + +#define X509_EXT_PACK_UNKNOWN 1 +#define X509_EXT_PACK_STRING 2 + +#define X509_get_version(x) ASN1_INTEGER_get((x)->cert_info->version) +/* #define X509_get_serialNumber(x) ((x)->cert_info->serialNumber) */ +#define X509_get_notBefore(x) ((x)->cert_info->validity->notBefore) +#define X509_get_notAfter(x) ((x)->cert_info->validity->notAfter) +#define X509_extract_key(x) X509_get_pubkey(x) /*****/ +#define X509_REQ_get_version(x) ASN1_INTEGER_get((x)->req_info->version) +#define X509_REQ_get_subject_name(x) ((x)->req_info->subject) +#define X509_REQ_extract_key(a) X509_REQ_get_pubkey(a) +#define X509_name_cmp(a,b) X509_NAME_cmp((a),(b)) +#define X509_get_signature_type(x) EVP_PKEY_type(OBJ_obj2nid((x)->sig_alg->algorithm)) + +#define X509_CRL_get_version(x) ASN1_INTEGER_get((x)->crl->version) +#define X509_CRL_get_lastUpdate(x) ((x)->crl->lastUpdate) +#define X509_CRL_get_nextUpdate(x) ((x)->crl->nextUpdate) +#define X509_CRL_get_issuer(x) ((x)->crl->issuer) +#define X509_CRL_get_REVOKED(x) ((x)->crl->revoked) + +/* This one is only used so that a binary form can output, as in + * i2d_X509_NAME(X509_get_X509_PUBKEY(x),&buf) */ +#define X509_get_X509_PUBKEY(x) ((x)->cert_info->key) + + +const char *X509_verify_cert_error_string(long n); + +#ifndef SSLEAY_MACROS +#ifndef OPENSSL_NO_EVP +int X509_verify(X509 *a, EVP_PKEY *r); + +int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r); +int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r); +int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r); + +NETSCAPE_SPKI * NETSCAPE_SPKI_b64_decode(const char *str, int len); +char * NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *x); +EVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *x); +int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey); + +int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki); + +int X509_signature_print(BIO *bp,X509_ALGOR *alg, ASN1_STRING *sig); + +int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); +int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md); +int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md); +int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md); + +int X509_pubkey_digest(const X509 *data,const EVP_MD *type, + unsigned char *md, unsigned int *len); +int X509_digest(const X509 *data,const EVP_MD *type, + unsigned char *md, unsigned int *len); +int X509_CRL_digest(const X509_CRL *data,const EVP_MD *type, + unsigned char *md, unsigned int *len); +int X509_REQ_digest(const X509_REQ *data,const EVP_MD *type, + unsigned char *md, unsigned int *len); +int X509_NAME_digest(const X509_NAME *data,const EVP_MD *type, + unsigned char *md, unsigned int *len); +#endif + +#ifndef OPENSSL_NO_FP_API +X509 *d2i_X509_fp(FILE *fp, X509 **x509); +int i2d_X509_fp(FILE *fp,X509 *x509); +X509_CRL *d2i_X509_CRL_fp(FILE *fp,X509_CRL **crl); +int i2d_X509_CRL_fp(FILE *fp,X509_CRL *crl); +X509_REQ *d2i_X509_REQ_fp(FILE *fp,X509_REQ **req); +int i2d_X509_REQ_fp(FILE *fp,X509_REQ *req); +#ifndef OPENSSL_NO_RSA +RSA *d2i_RSAPrivateKey_fp(FILE *fp,RSA **rsa); +int i2d_RSAPrivateKey_fp(FILE *fp,RSA *rsa); +RSA *d2i_RSAPublicKey_fp(FILE *fp,RSA **rsa); +int i2d_RSAPublicKey_fp(FILE *fp,RSA *rsa); +RSA *d2i_RSA_PUBKEY_fp(FILE *fp,RSA **rsa); +int i2d_RSA_PUBKEY_fp(FILE *fp,RSA *rsa); +#endif +#ifndef OPENSSL_NO_DSA +DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa); +int i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa); +DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa); +int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa); +#endif +#ifndef OPENSSL_NO_EC +EC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey); +int i2d_EC_PUBKEY_fp(FILE *fp, EC_KEY *eckey); +EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey); +int i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey); +#endif +X509_SIG *d2i_PKCS8_fp(FILE *fp,X509_SIG **p8); +int i2d_PKCS8_fp(FILE *fp,X509_SIG *p8); +PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, + PKCS8_PRIV_KEY_INFO **p8inf); +int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,PKCS8_PRIV_KEY_INFO *p8inf); +int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key); +int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey); +EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a); +int i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey); +EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a); +#endif + +#ifndef OPENSSL_NO_BIO +X509 *d2i_X509_bio(BIO *bp,X509 **x509); +int i2d_X509_bio(BIO *bp,X509 *x509); +X509_CRL *d2i_X509_CRL_bio(BIO *bp,X509_CRL **crl); +int i2d_X509_CRL_bio(BIO *bp,X509_CRL *crl); +X509_REQ *d2i_X509_REQ_bio(BIO *bp,X509_REQ **req); +int i2d_X509_REQ_bio(BIO *bp,X509_REQ *req); +#ifndef OPENSSL_NO_RSA +RSA *d2i_RSAPrivateKey_bio(BIO *bp,RSA **rsa); +int i2d_RSAPrivateKey_bio(BIO *bp,RSA *rsa); +RSA *d2i_RSAPublicKey_bio(BIO *bp,RSA **rsa); +int i2d_RSAPublicKey_bio(BIO *bp,RSA *rsa); +RSA *d2i_RSA_PUBKEY_bio(BIO *bp,RSA **rsa); +int i2d_RSA_PUBKEY_bio(BIO *bp,RSA *rsa); +#endif +#ifndef OPENSSL_NO_DSA +DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa); +int i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa); +DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa); +int i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa); +#endif +#ifndef OPENSSL_NO_EC +EC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey); +int i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *eckey); +EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey); +int i2d_ECPrivateKey_bio(BIO *bp, EC_KEY *eckey); +#endif +X509_SIG *d2i_PKCS8_bio(BIO *bp,X509_SIG **p8); +int i2d_PKCS8_bio(BIO *bp,X509_SIG *p8); +PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, + PKCS8_PRIV_KEY_INFO **p8inf); +int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,PKCS8_PRIV_KEY_INFO *p8inf); +int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key); +int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey); +EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a); +int i2d_PUBKEY_bio(BIO *bp, EVP_PKEY *pkey); +EVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a); +#endif + +X509 *X509_dup(X509 *x509); +X509_ATTRIBUTE *X509_ATTRIBUTE_dup(X509_ATTRIBUTE *xa); +X509_EXTENSION *X509_EXTENSION_dup(X509_EXTENSION *ex); +X509_CRL *X509_CRL_dup(X509_CRL *crl); +X509_REQ *X509_REQ_dup(X509_REQ *req); +X509_ALGOR *X509_ALGOR_dup(X509_ALGOR *xn); +X509_NAME *X509_NAME_dup(X509_NAME *xn); +X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne); + +#endif /* !SSLEAY_MACROS */ + +int X509_cmp_time(ASN1_TIME *s, time_t *t); +int X509_cmp_current_time(ASN1_TIME *s); +ASN1_TIME * X509_time_adj(ASN1_TIME *s, long adj, time_t *t); +ASN1_TIME * X509_gmtime_adj(ASN1_TIME *s, long adj); + +const char * X509_get_default_cert_area(void ); +const char * X509_get_default_cert_dir(void ); +const char * X509_get_default_cert_file(void ); +const char * X509_get_default_cert_dir_env(void ); +const char * X509_get_default_cert_file_env(void ); +const char * X509_get_default_private_dir(void ); + +X509_REQ * X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); +X509 * X509_REQ_to_X509(X509_REQ *r, int days,EVP_PKEY *pkey); + +DECLARE_ASN1_FUNCTIONS(X509_ALGOR) +DECLARE_ASN1_FUNCTIONS(X509_VAL) + +DECLARE_ASN1_FUNCTIONS(X509_PUBKEY) + +int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey); +EVP_PKEY * X509_PUBKEY_get(X509_PUBKEY *key); +int X509_get_pubkey_parameters(EVP_PKEY *pkey, + STACK_OF(X509) *chain); +int i2d_PUBKEY(EVP_PKEY *a,unsigned char **pp); +EVP_PKEY * d2i_PUBKEY(EVP_PKEY **a,const unsigned char **pp, + long length); +#ifndef OPENSSL_NO_RSA +int i2d_RSA_PUBKEY(RSA *a,unsigned char **pp); +RSA * d2i_RSA_PUBKEY(RSA **a,const unsigned char **pp, + long length); +#endif +#ifndef OPENSSL_NO_DSA +int i2d_DSA_PUBKEY(DSA *a,unsigned char **pp); +DSA * d2i_DSA_PUBKEY(DSA **a,const unsigned char **pp, + long length); +#endif +#ifndef OPENSSL_NO_EC +int i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp); +EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, + long length); +#endif + +DECLARE_ASN1_FUNCTIONS(X509_SIG) +DECLARE_ASN1_FUNCTIONS(X509_REQ_INFO) +DECLARE_ASN1_FUNCTIONS(X509_REQ) + +DECLARE_ASN1_FUNCTIONS(X509_ATTRIBUTE) +X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value); + +DECLARE_ASN1_FUNCTIONS(X509_EXTENSION) + +DECLARE_ASN1_FUNCTIONS(X509_NAME_ENTRY) + +DECLARE_ASN1_FUNCTIONS(X509_NAME) + +int X509_NAME_set(X509_NAME **xn, X509_NAME *name); + +DECLARE_ASN1_FUNCTIONS(X509_CINF) + +DECLARE_ASN1_FUNCTIONS(X509) +DECLARE_ASN1_FUNCTIONS(X509_CERT_AUX) + +DECLARE_ASN1_FUNCTIONS(X509_CERT_PAIR) + +int X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); +int X509_set_ex_data(X509 *r, int idx, void *arg); +void *X509_get_ex_data(X509 *r, int idx); +int i2d_X509_AUX(X509 *a,unsigned char **pp); +X509 * d2i_X509_AUX(X509 **a,const unsigned char **pp,long length); + +int X509_alias_set1(X509 *x, unsigned char *name, int len); +int X509_keyid_set1(X509 *x, unsigned char *id, int len); +unsigned char * X509_alias_get0(X509 *x, int *len); +unsigned char * X509_keyid_get0(X509 *x, int *len); +int (*X509_TRUST_set_default(int (*trust)(int , X509 *, int)))(int, X509 *, int); +int X509_TRUST_set(int *t, int trust); +int X509_add1_trust_object(X509 *x, ASN1_OBJECT *obj); +int X509_add1_reject_object(X509 *x, ASN1_OBJECT *obj); +void X509_trust_clear(X509 *x); +void X509_reject_clear(X509 *x); + +DECLARE_ASN1_FUNCTIONS(X509_REVOKED) +DECLARE_ASN1_FUNCTIONS(X509_CRL_INFO) +DECLARE_ASN1_FUNCTIONS(X509_CRL) + +int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev); + +X509_PKEY * X509_PKEY_new(void ); +void X509_PKEY_free(X509_PKEY *a); +int i2d_X509_PKEY(X509_PKEY *a,unsigned char **pp); +X509_PKEY * d2i_X509_PKEY(X509_PKEY **a,const unsigned char **pp,long length); + +DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI) +DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC) +DECLARE_ASN1_FUNCTIONS(NETSCAPE_CERT_SEQUENCE) + +#ifndef OPENSSL_NO_EVP +X509_INFO * X509_INFO_new(void); +void X509_INFO_free(X509_INFO *a); +char * X509_NAME_oneline(X509_NAME *a,char *buf,int size); + +int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *algor1, + ASN1_BIT_STRING *signature,char *data,EVP_PKEY *pkey); + +int ASN1_digest(i2d_of_void *i2d,const EVP_MD *type,char *data, + unsigned char *md,unsigned int *len); + +int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1, + X509_ALGOR *algor2, ASN1_BIT_STRING *signature, + char *data,EVP_PKEY *pkey, const EVP_MD *type); + +int ASN1_item_digest(const ASN1_ITEM *it,const EVP_MD *type,void *data, + unsigned char *md,unsigned int *len); + +int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *algor1, + ASN1_BIT_STRING *signature,void *data,EVP_PKEY *pkey); + +int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2, + ASN1_BIT_STRING *signature, + void *data, EVP_PKEY *pkey, const EVP_MD *type); +#endif + +int X509_set_version(X509 *x,long version); +int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial); +ASN1_INTEGER * X509_get_serialNumber(X509 *x); +int X509_set_issuer_name(X509 *x, X509_NAME *name); +X509_NAME * X509_get_issuer_name(X509 *a); +int X509_set_subject_name(X509 *x, X509_NAME *name); +X509_NAME * X509_get_subject_name(X509 *a); +int X509_set_notBefore(X509 *x, ASN1_TIME *tm); +int X509_set_notAfter(X509 *x, ASN1_TIME *tm); +int X509_set_pubkey(X509 *x, EVP_PKEY *pkey); +EVP_PKEY * X509_get_pubkey(X509 *x); +ASN1_BIT_STRING * X509_get0_pubkey_bitstr(const X509 *x); +int X509_certificate_type(X509 *x,EVP_PKEY *pubkey /* optional */); + +int X509_REQ_set_version(X509_REQ *x,long version); +int X509_REQ_set_subject_name(X509_REQ *req,X509_NAME *name); +int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey); +EVP_PKEY * X509_REQ_get_pubkey(X509_REQ *req); +int X509_REQ_extension_nid(int nid); +int * X509_REQ_get_extension_nids(void); +void X509_REQ_set_extension_nids(int *nids); +STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req); +int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts, + int nid); +int X509_REQ_add_extensions(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts); +int X509_REQ_get_attr_count(const X509_REQ *req); +int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, + int lastpos); +int X509_REQ_get_attr_by_OBJ(const X509_REQ *req, ASN1_OBJECT *obj, + int lastpos); +X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc); +X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc); +int X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr); +int X509_REQ_add1_attr_by_OBJ(X509_REQ *req, + const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, int len); +int X509_REQ_add1_attr_by_NID(X509_REQ *req, + int nid, int type, + const unsigned char *bytes, int len); +int X509_REQ_add1_attr_by_txt(X509_REQ *req, + const char *attrname, int type, + const unsigned char *bytes, int len); + +int X509_CRL_set_version(X509_CRL *x, long version); +int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name); +int X509_CRL_set_lastUpdate(X509_CRL *x, ASN1_TIME *tm); +int X509_CRL_set_nextUpdate(X509_CRL *x, ASN1_TIME *tm); +int X509_CRL_sort(X509_CRL *crl); + +int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial); +int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm); + +int X509_REQ_check_private_key(X509_REQ *x509,EVP_PKEY *pkey); + +int X509_check_private_key(X509 *x509,EVP_PKEY *pkey); + +int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b); +unsigned long X509_issuer_and_serial_hash(X509 *a); + +int X509_issuer_name_cmp(const X509 *a, const X509 *b); +unsigned long X509_issuer_name_hash(X509 *a); + +int X509_subject_name_cmp(const X509 *a, const X509 *b); +unsigned long X509_subject_name_hash(X509 *x); + +int X509_cmp(const X509 *a, const X509 *b); +int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b); +unsigned long X509_NAME_hash(X509_NAME *x); + +int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b); +#ifndef OPENSSL_NO_FP_API +int X509_print_ex_fp(FILE *bp,X509 *x, unsigned long nmflag, unsigned long cflag); +int X509_print_fp(FILE *bp,X509 *x); +int X509_CRL_print_fp(FILE *bp,X509_CRL *x); +int X509_REQ_print_fp(FILE *bp,X509_REQ *req); +int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent, unsigned long flags); +#endif + +#ifndef OPENSSL_NO_BIO +int X509_NAME_print(BIO *bp, X509_NAME *name, int obase); +int X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent, unsigned long flags); +int X509_print_ex(BIO *bp,X509 *x, unsigned long nmflag, unsigned long cflag); +int X509_print(BIO *bp,X509 *x); +int X509_ocspid_print(BIO *bp,X509 *x); +int X509_CERT_AUX_print(BIO *bp,X509_CERT_AUX *x, int indent); +int X509_CRL_print(BIO *bp,X509_CRL *x); +int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag, unsigned long cflag); +int X509_REQ_print(BIO *bp,X509_REQ *req); +#endif + +int X509_NAME_entry_count(X509_NAME *name); +int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, + char *buf,int len); +int X509_NAME_get_text_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, + char *buf,int len); + +/* NOTE: you should be passsing -1, not 0 as lastpos. The functions that use + * lastpos, search after that position on. */ +int X509_NAME_get_index_by_NID(X509_NAME *name,int nid,int lastpos); +int X509_NAME_get_index_by_OBJ(X509_NAME *name,ASN1_OBJECT *obj, + int lastpos); +X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc); +X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc); +int X509_NAME_add_entry(X509_NAME *name,X509_NAME_ENTRY *ne, + int loc, int set); +int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type, + unsigned char *bytes, int len, int loc, int set); +int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, + unsigned char *bytes, int len, int loc, int set); +X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, + const char *field, int type, const unsigned char *bytes, int len); +X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, + int type,unsigned char *bytes, int len); +int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type, + const unsigned char *bytes, int len, int loc, int set); +X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, + ASN1_OBJECT *obj, int type,const unsigned char *bytes, + int len); +int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, + ASN1_OBJECT *obj); +int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, + const unsigned char *bytes, int len); +ASN1_OBJECT * X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne); +ASN1_STRING * X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne); + +int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x); +int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x, + int nid, int lastpos); +int X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x, + ASN1_OBJECT *obj,int lastpos); +int X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x, + int crit, int lastpos); +X509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc); +X509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc); +STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x, + X509_EXTENSION *ex, int loc); + +int X509_get_ext_count(X509 *x); +int X509_get_ext_by_NID(X509 *x, int nid, int lastpos); +int X509_get_ext_by_OBJ(X509 *x,ASN1_OBJECT *obj,int lastpos); +int X509_get_ext_by_critical(X509 *x, int crit, int lastpos); +X509_EXTENSION *X509_get_ext(X509 *x, int loc); +X509_EXTENSION *X509_delete_ext(X509 *x, int loc); +int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc); +void * X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx); +int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit, + unsigned long flags); + +int X509_CRL_get_ext_count(X509_CRL *x); +int X509_CRL_get_ext_by_NID(X509_CRL *x, int nid, int lastpos); +int X509_CRL_get_ext_by_OBJ(X509_CRL *x,ASN1_OBJECT *obj,int lastpos); +int X509_CRL_get_ext_by_critical(X509_CRL *x, int crit, int lastpos); +X509_EXTENSION *X509_CRL_get_ext(X509_CRL *x, int loc); +X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc); +int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc); +void * X509_CRL_get_ext_d2i(X509_CRL *x, int nid, int *crit, int *idx); +int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit, + unsigned long flags); + +int X509_REVOKED_get_ext_count(X509_REVOKED *x); +int X509_REVOKED_get_ext_by_NID(X509_REVOKED *x, int nid, int lastpos); +int X509_REVOKED_get_ext_by_OBJ(X509_REVOKED *x,ASN1_OBJECT *obj,int lastpos); +int X509_REVOKED_get_ext_by_critical(X509_REVOKED *x, int crit, int lastpos); +X509_EXTENSION *X509_REVOKED_get_ext(X509_REVOKED *x, int loc); +X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc); +int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc); +void * X509_REVOKED_get_ext_d2i(X509_REVOKED *x, int nid, int *crit, int *idx); +int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit, + unsigned long flags); + +X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex, + int nid, int crit, ASN1_OCTET_STRING *data); +X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex, + ASN1_OBJECT *obj,int crit,ASN1_OCTET_STRING *data); +int X509_EXTENSION_set_object(X509_EXTENSION *ex,ASN1_OBJECT *obj); +int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit); +int X509_EXTENSION_set_data(X509_EXTENSION *ex, + ASN1_OCTET_STRING *data); +ASN1_OBJECT * X509_EXTENSION_get_object(X509_EXTENSION *ex); +ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne); +int X509_EXTENSION_get_critical(X509_EXTENSION *ex); + +int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x); +int X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid, + int lastpos); +int X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk, ASN1_OBJECT *obj, + int lastpos); +X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc); +X509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc); +STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x, + X509_ATTRIBUTE *attr); +STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE) **x, + const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, int len); +STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE) **x, + int nid, int type, + const unsigned char *bytes, int len); +STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE) **x, + const char *attrname, int type, + const unsigned char *bytes, int len); +X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid, + int atrtype, const void *data, int len); +X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr, + const ASN1_OBJECT *obj, int atrtype, const void *data, int len); +X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr, + const char *atrname, int type, const unsigned char *bytes, int len); +int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj); +int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *data, int len); +void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx, + int atrtype, void *data); +int X509_ATTRIBUTE_count(X509_ATTRIBUTE *attr); +ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr); +ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx); + +int EVP_PKEY_get_attr_count(const EVP_PKEY *key); +int EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, + int lastpos); +int EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, ASN1_OBJECT *obj, + int lastpos); +X509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc); +X509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc); +int EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr); +int EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key, + const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, int len); +int EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key, + int nid, int type, + const unsigned char *bytes, int len); +int EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key, + const char *attrname, int type, + const unsigned char *bytes, int len); + +int X509_verify_cert(X509_STORE_CTX *ctx); + +/* lookup a cert from a X509 STACK */ +X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk,X509_NAME *name, + ASN1_INTEGER *serial); +X509 *X509_find_by_subject(STACK_OF(X509) *sk,X509_NAME *name); + +DECLARE_ASN1_FUNCTIONS(PBEPARAM) +DECLARE_ASN1_FUNCTIONS(PBE2PARAM) +DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM) + +X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt, int saltlen); +X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, + unsigned char *salt, int saltlen); + +/* PKCS#8 utilities */ + +DECLARE_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO) + +EVP_PKEY *EVP_PKCS82PKEY(PKCS8_PRIV_KEY_INFO *p8); +PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey); +PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8_broken(EVP_PKEY *pkey, int broken); +PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken); + +int X509_check_trust(X509 *x, int id, int flags); +int X509_TRUST_get_count(void); +X509_TRUST * X509_TRUST_get0(int idx); +int X509_TRUST_get_by_id(int id); +int X509_TRUST_add(int id, int flags, int (*ck)(X509_TRUST *, X509 *, int), + char *name, int arg1, void *arg2); +void X509_TRUST_cleanup(void); +int X509_TRUST_get_flags(X509_TRUST *xp); +char *X509_TRUST_get0_name(X509_TRUST *xp); +int X509_TRUST_get_trust(X509_TRUST *xp); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_X509_strings(void); + +/* Error codes for the X509 functions. */ + +/* Function codes. */ +#define X509_F_ADD_CERT_DIR 100 +#define X509_F_BY_FILE_CTRL 101 +#define X509_F_CHECK_POLICY 145 +#define X509_F_DIR_CTRL 102 +#define X509_F_GET_CERT_BY_SUBJECT 103 +#define X509_F_NETSCAPE_SPKI_B64_DECODE 129 +#define X509_F_NETSCAPE_SPKI_B64_ENCODE 130 +#define X509_F_X509AT_ADD1_ATTR 135 +#define X509_F_X509V3_ADD_EXT 104 +#define X509_F_X509_ATTRIBUTE_CREATE_BY_NID 136 +#define X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ 137 +#define X509_F_X509_ATTRIBUTE_CREATE_BY_TXT 140 +#define X509_F_X509_ATTRIBUTE_GET0_DATA 139 +#define X509_F_X509_ATTRIBUTE_SET1_DATA 138 +#define X509_F_X509_CHECK_PRIVATE_KEY 128 +#define X509_F_X509_CRL_PRINT_FP 147 +#define X509_F_X509_EXTENSION_CREATE_BY_NID 108 +#define X509_F_X509_EXTENSION_CREATE_BY_OBJ 109 +#define X509_F_X509_GET_PUBKEY_PARAMETERS 110 +#define X509_F_X509_LOAD_CERT_CRL_FILE 132 +#define X509_F_X509_LOAD_CERT_FILE 111 +#define X509_F_X509_LOAD_CRL_FILE 112 +#define X509_F_X509_NAME_ADD_ENTRY 113 +#define X509_F_X509_NAME_ENTRY_CREATE_BY_NID 114 +#define X509_F_X509_NAME_ENTRY_CREATE_BY_TXT 131 +#define X509_F_X509_NAME_ENTRY_SET_OBJECT 115 +#define X509_F_X509_NAME_ONELINE 116 +#define X509_F_X509_NAME_PRINT 117 +#define X509_F_X509_PRINT_EX_FP 118 +#define X509_F_X509_PUBKEY_GET 119 +#define X509_F_X509_PUBKEY_SET 120 +#define X509_F_X509_REQ_CHECK_PRIVATE_KEY 144 +#define X509_F_X509_REQ_PRINT_EX 121 +#define X509_F_X509_REQ_PRINT_FP 122 +#define X509_F_X509_REQ_TO_X509 123 +#define X509_F_X509_STORE_ADD_CERT 124 +#define X509_F_X509_STORE_ADD_CRL 125 +#define X509_F_X509_STORE_CTX_GET1_ISSUER 146 +#define X509_F_X509_STORE_CTX_INIT 143 +#define X509_F_X509_STORE_CTX_NEW 142 +#define X509_F_X509_STORE_CTX_PURPOSE_INHERIT 134 +#define X509_F_X509_TO_X509_REQ 126 +#define X509_F_X509_TRUST_ADD 133 +#define X509_F_X509_TRUST_SET 141 +#define X509_F_X509_VERIFY_CERT 127 + +/* Reason codes. */ +#define X509_R_BAD_X509_FILETYPE 100 +#define X509_R_BASE64_DECODE_ERROR 118 +#define X509_R_CANT_CHECK_DH_KEY 114 +#define X509_R_CERT_ALREADY_IN_HASH_TABLE 101 +#define X509_R_ERR_ASN1_LIB 102 +#define X509_R_INVALID_DIRECTORY 113 +#define X509_R_INVALID_FIELD_NAME 119 +#define X509_R_INVALID_TRUST 123 +#define X509_R_KEY_TYPE_MISMATCH 115 +#define X509_R_KEY_VALUES_MISMATCH 116 +#define X509_R_LOADING_CERT_DIR 103 +#define X509_R_LOADING_DEFAULTS 104 +#define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 105 +#define X509_R_SHOULD_RETRY 106 +#define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN 107 +#define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY 108 +#define X509_R_UNKNOWN_KEY_TYPE 117 +#define X509_R_UNKNOWN_NID 109 +#define X509_R_UNKNOWN_PURPOSE_ID 121 +#define X509_R_UNKNOWN_TRUST_ID 120 +#define X509_R_UNSUPPORTED_ALGORITHM 111 +#define X509_R_WRONG_LOOKUP_TYPE 112 +#define X509_R_WRONG_TYPE 122 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/openssl/x509_vfy.h b/h/openssl/x509_vfy.h new file mode 100644 index 0000000..85bd640 --- /dev/null +++ b/h/openssl/x509_vfy.h @@ -0,0 +1,527 @@ +/* crypto/x509/x509_vfy.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_X509_H +#include +/* openssl/x509.h ends up #include-ing this file at about the only + * appropriate moment. */ +#endif + +#ifndef HEADER_X509_VFY_H +#define HEADER_X509_VFY_H + +#include +#ifndef OPENSSL_NO_LHASH +#include +#endif +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Outer object */ +typedef struct x509_hash_dir_st + { + int num_dirs; + char **dirs; + int *dirs_type; + int num_dirs_alloced; + } X509_HASH_DIR_CTX; + +typedef struct x509_file_st + { + int num_paths; /* number of paths to files or directories */ + int num_alloced; + char **paths; /* the list of paths or directories */ + int *path_type; + } X509_CERT_FILE_CTX; + +/*******************************/ +/* +SSL_CTX -> X509_STORE + -> X509_LOOKUP + ->X509_LOOKUP_METHOD + -> X509_LOOKUP + ->X509_LOOKUP_METHOD + +SSL -> X509_STORE_CTX + ->X509_STORE + +The X509_STORE holds the tables etc for verification stuff. +A X509_STORE_CTX is used while validating a single certificate. +The X509_STORE has X509_LOOKUPs for looking up certs. +The X509_STORE then calls a function to actually verify the +certificate chain. +*/ + +#define X509_LU_RETRY -1 +#define X509_LU_FAIL 0 +#define X509_LU_X509 1 +#define X509_LU_CRL 2 +#define X509_LU_PKEY 3 + +typedef struct x509_object_st + { + /* one of the above types */ + int type; + union { + char *ptr; + X509 *x509; + X509_CRL *crl; + EVP_PKEY *pkey; + } data; + } X509_OBJECT; + +typedef struct x509_lookup_st X509_LOOKUP; + +DECLARE_STACK_OF(X509_LOOKUP) +DECLARE_STACK_OF(X509_OBJECT) + +/* This is a static that defines the function interface */ +typedef struct x509_lookup_method_st + { + const char *name; + int (*new_item)(X509_LOOKUP *ctx); + void (*free)(X509_LOOKUP *ctx); + int (*init)(X509_LOOKUP *ctx); + int (*shutdown)(X509_LOOKUP *ctx); + int (*ctrl)(X509_LOOKUP *ctx,int cmd,const char *argc,long argl, + char **ret); + int (*get_by_subject)(X509_LOOKUP *ctx,int type,X509_NAME *name, + X509_OBJECT *ret); + int (*get_by_issuer_serial)(X509_LOOKUP *ctx,int type,X509_NAME *name, + ASN1_INTEGER *serial,X509_OBJECT *ret); + int (*get_by_fingerprint)(X509_LOOKUP *ctx,int type, + unsigned char *bytes,int len, + X509_OBJECT *ret); + int (*get_by_alias)(X509_LOOKUP *ctx,int type,char *str,int len, + X509_OBJECT *ret); + } X509_LOOKUP_METHOD; + +/* This structure hold all parameters associated with a verify operation + * by including an X509_VERIFY_PARAM structure in related structures the + * parameters used can be customized + */ + +typedef struct X509_VERIFY_PARAM_st + { + char *name; + time_t check_time; /* Time to use */ + unsigned long inh_flags; /* Inheritance flags */ + unsigned long flags; /* Various verify flags */ + int purpose; /* purpose to check untrusted certificates */ + int trust; /* trust setting to check */ + int depth; /* Verify depth */ + STACK_OF(ASN1_OBJECT) *policies; /* Permissible policies */ + } X509_VERIFY_PARAM; + +DECLARE_STACK_OF(X509_VERIFY_PARAM) + +/* This is used to hold everything. It is used for all certificate + * validation. Once we have a certificate chain, the 'verify' + * function is then called to actually check the cert chain. */ +struct x509_store_st + { + /* The following is a cache of trusted certs */ + int cache; /* if true, stash any hits */ + STACK_OF(X509_OBJECT) *objs; /* Cache of all objects */ + + /* These are external lookup methods */ + STACK_OF(X509_LOOKUP) *get_cert_methods; + + X509_VERIFY_PARAM *param; + + /* Callbacks for various operations */ + int (*verify)(X509_STORE_CTX *ctx); /* called to verify a certificate */ + int (*verify_cb)(int ok,X509_STORE_CTX *ctx); /* error callback */ + int (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); /* get issuers cert from ctx */ + int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */ + int (*check_revocation)(X509_STORE_CTX *ctx); /* Check revocation status of chain */ + int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */ + int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */ + int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */ + int (*cleanup)(X509_STORE_CTX *ctx); + + CRYPTO_EX_DATA ex_data; + int references; + } /* X509_STORE */; + +int X509_STORE_set_depth(X509_STORE *store, int depth); + +#define X509_STORE_set_verify_cb_func(ctx,func) ((ctx)->verify_cb=(func)) +#define X509_STORE_set_verify_func(ctx,func) ((ctx)->verify=(func)) + +/* This is the functions plus an instance of the local variables. */ +struct x509_lookup_st + { + int init; /* have we been started */ + int skip; /* don't use us. */ + X509_LOOKUP_METHOD *method; /* the functions */ + char *method_data; /* method data */ + + X509_STORE *store_ctx; /* who owns us */ + } /* X509_LOOKUP */; + +/* This is a used when verifying cert chains. Since the + * gathering of the cert chain can take some time (and have to be + * 'retried', this needs to be kept and passed around. */ +struct x509_store_ctx_st /* X509_STORE_CTX */ + { + X509_STORE *ctx; + int current_method; /* used when looking up certs */ + + /* The following are set by the caller */ + X509 *cert; /* The cert to check */ + STACK_OF(X509) *untrusted; /* chain of X509s - untrusted - passed in */ + STACK_OF(X509_CRL) *crls; /* set of CRLs passed in */ + + X509_VERIFY_PARAM *param; + void *other_ctx; /* Other info for use with get_issuer() */ + + /* Callbacks for various operations */ + int (*verify)(X509_STORE_CTX *ctx); /* called to verify a certificate */ + int (*verify_cb)(int ok,X509_STORE_CTX *ctx); /* error callback */ + int (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); /* get issuers cert from ctx */ + int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */ + int (*check_revocation)(X509_STORE_CTX *ctx); /* Check revocation status of chain */ + int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */ + int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */ + int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */ + int (*check_policy)(X509_STORE_CTX *ctx); + int (*cleanup)(X509_STORE_CTX *ctx); + + /* The following is built up */ + int valid; /* if 0, rebuild chain */ + int last_untrusted; /* index of last untrusted cert */ + STACK_OF(X509) *chain; /* chain of X509s - built up and trusted */ + X509_POLICY_TREE *tree; /* Valid policy tree */ + + int explicit_policy; /* Require explicit policy value */ + + /* When something goes wrong, this is why */ + int error_depth; + int error; + X509 *current_cert; + X509 *current_issuer; /* cert currently being tested as valid issuer */ + X509_CRL *current_crl; /* current CRL */ + + CRYPTO_EX_DATA ex_data; + } /* X509_STORE_CTX */; + +void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); + +#define X509_STORE_CTX_set_app_data(ctx,data) \ + X509_STORE_CTX_set_ex_data(ctx,0,data) +#define X509_STORE_CTX_get_app_data(ctx) \ + X509_STORE_CTX_get_ex_data(ctx,0) + +#define X509_L_FILE_LOAD 1 +#define X509_L_ADD_DIR 2 + +#define X509_LOOKUP_load_file(x,name,type) \ + X509_LOOKUP_ctrl((x),X509_L_FILE_LOAD,(name),(long)(type),NULL) + +#define X509_LOOKUP_add_dir(x,name,type) \ + X509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL) + +#define X509_V_OK 0 +/* illegal error (for uninitialized values, to avoid X509_V_OK): 1 */ + +#define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT 2 +#define X509_V_ERR_UNABLE_TO_GET_CRL 3 +#define X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE 4 +#define X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE 5 +#define X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY 6 +#define X509_V_ERR_CERT_SIGNATURE_FAILURE 7 +#define X509_V_ERR_CRL_SIGNATURE_FAILURE 8 +#define X509_V_ERR_CERT_NOT_YET_VALID 9 +#define X509_V_ERR_CERT_HAS_EXPIRED 10 +#define X509_V_ERR_CRL_NOT_YET_VALID 11 +#define X509_V_ERR_CRL_HAS_EXPIRED 12 +#define X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD 13 +#define X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD 14 +#define X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD 15 +#define X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD 16 +#define X509_V_ERR_OUT_OF_MEM 17 +#define X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT 18 +#define X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN 19 +#define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY 20 +#define X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE 21 +#define X509_V_ERR_CERT_CHAIN_TOO_LONG 22 +#define X509_V_ERR_CERT_REVOKED 23 +#define X509_V_ERR_INVALID_CA 24 +#define X509_V_ERR_PATH_LENGTH_EXCEEDED 25 +#define X509_V_ERR_INVALID_PURPOSE 26 +#define X509_V_ERR_CERT_UNTRUSTED 27 +#define X509_V_ERR_CERT_REJECTED 28 +/* These are 'informational' when looking for issuer cert */ +#define X509_V_ERR_SUBJECT_ISSUER_MISMATCH 29 +#define X509_V_ERR_AKID_SKID_MISMATCH 30 +#define X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH 31 +#define X509_V_ERR_KEYUSAGE_NO_CERTSIGN 32 + +#define X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER 33 +#define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION 34 +#define X509_V_ERR_KEYUSAGE_NO_CRL_SIGN 35 +#define X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION 36 +#define X509_V_ERR_INVALID_NON_CA 37 +#define X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED 38 +#define X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE 39 +#define X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED 40 + +#define X509_V_ERR_INVALID_EXTENSION 41 +#define X509_V_ERR_INVALID_POLICY_EXTENSION 42 +#define X509_V_ERR_NO_EXPLICIT_POLICY 43 + + +/* The application is not happy */ +#define X509_V_ERR_APPLICATION_VERIFICATION 50 + +/* Certificate verify flags */ + +/* Send issuer+subject checks to verify_cb */ +#define X509_V_FLAG_CB_ISSUER_CHECK 0x1 +/* Use check time instead of current time */ +#define X509_V_FLAG_USE_CHECK_TIME 0x2 +/* Lookup CRLs */ +#define X509_V_FLAG_CRL_CHECK 0x4 +/* Lookup CRLs for whole chain */ +#define X509_V_FLAG_CRL_CHECK_ALL 0x8 +/* Ignore unhandled critical extensions */ +#define X509_V_FLAG_IGNORE_CRITICAL 0x10 +/* Disable workarounds for broken certificates */ +#define X509_V_FLAG_X509_STRICT 0x20 +/* Enable proxy certificate validation */ +#define X509_V_FLAG_ALLOW_PROXY_CERTS 0x40 +/* Enable policy checking */ +#define X509_V_FLAG_POLICY_CHECK 0x80 +/* Policy variable require-explicit-policy */ +#define X509_V_FLAG_EXPLICIT_POLICY 0x100 +/* Policy variable inhibit-any-policy */ +#define X509_V_FLAG_INHIBIT_ANY 0x200 +/* Policy variable inhibit-policy-mapping */ +#define X509_V_FLAG_INHIBIT_MAP 0x400 +/* Notify callback that policy is OK */ +#define X509_V_FLAG_NOTIFY_POLICY 0x800 + +#define X509_VP_FLAG_DEFAULT 0x1 +#define X509_VP_FLAG_OVERWRITE 0x2 +#define X509_VP_FLAG_RESET_FLAGS 0x4 +#define X509_VP_FLAG_LOCKED 0x8 +#define X509_VP_FLAG_ONCE 0x10 + +/* Internal use: mask of policy related options */ +#define X509_V_FLAG_POLICY_MASK (X509_V_FLAG_POLICY_CHECK \ + | X509_V_FLAG_EXPLICIT_POLICY \ + | X509_V_FLAG_INHIBIT_ANY \ + | X509_V_FLAG_INHIBIT_MAP) + +int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type, + X509_NAME *name); +X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h,int type,X509_NAME *name); +X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x); +void X509_OBJECT_up_ref_count(X509_OBJECT *a); +void X509_OBJECT_free_contents(X509_OBJECT *a); +X509_STORE *X509_STORE_new(void ); +void X509_STORE_free(X509_STORE *v); + +int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags); +int X509_STORE_set_purpose(X509_STORE *ctx, int purpose); +int X509_STORE_set_trust(X509_STORE *ctx, int trust); +int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm); + +X509_STORE_CTX *X509_STORE_CTX_new(void); + +int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); + +void X509_STORE_CTX_free(X509_STORE_CTX *ctx); +int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, + X509 *x509, STACK_OF(X509) *chain); +void X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); +void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx); + +X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m); + +X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void); +X509_LOOKUP_METHOD *X509_LOOKUP_file(void); + +int X509_STORE_add_cert(X509_STORE *ctx, X509 *x); +int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x); + +int X509_STORE_get_by_subject(X509_STORE_CTX *vs,int type,X509_NAME *name, + X509_OBJECT *ret); + +int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, + long argl, char **ret); + +#ifndef OPENSSL_NO_STDIO +int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type); +int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type); +int X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type); +#endif + + +X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method); +void X509_LOOKUP_free(X509_LOOKUP *ctx); +int X509_LOOKUP_init(X509_LOOKUP *ctx); +int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name, + X509_OBJECT *ret); +int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, int type, X509_NAME *name, + ASN1_INTEGER *serial, X509_OBJECT *ret); +int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, int type, + unsigned char *bytes, int len, X509_OBJECT *ret); +int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, int type, char *str, + int len, X509_OBJECT *ret); +int X509_LOOKUP_shutdown(X509_LOOKUP *ctx); + +#ifndef OPENSSL_NO_STDIO +int X509_STORE_load_locations (X509_STORE *ctx, + const char *file, const char *dir); +int X509_STORE_set_default_paths(X509_STORE *ctx); +#endif + +int X509_STORE_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); +int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx,int idx,void *data); +void * X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx,int idx); +int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx); +void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s); +int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx); +X509 * X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx); +STACK_OF(X509) *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx); +STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx); +void X509_STORE_CTX_set_cert(X509_STORE_CTX *c,X509 *x); +void X509_STORE_CTX_set_chain(X509_STORE_CTX *c,STACK_OF(X509) *sk); +void X509_STORE_CTX_set0_crls(X509_STORE_CTX *c,STACK_OF(X509_CRL) *sk); +int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose); +int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust); +int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose, + int purpose, int trust); +void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags); +void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags, + time_t t); +void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, + int (*verify_cb)(int, X509_STORE_CTX *)); + +X509_POLICY_TREE *X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX *ctx); +int X509_STORE_CTX_get_explicit_policy(X509_STORE_CTX *ctx); + +X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx); +void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param); +int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name); + +/* X509_VERIFY_PARAM functions */ + +X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void); +void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param); +int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *to, + const X509_VERIFY_PARAM *from); +int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to, + const X509_VERIFY_PARAM *from); +int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name); +int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags); +int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose); +int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust); +void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth); +void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t); +int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param, + ASN1_OBJECT *policy); +int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, + STACK_OF(ASN1_OBJECT) *policies); +int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param); + +int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param); +const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name); +void X509_VERIFY_PARAM_table_cleanup(void); + +int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy, + STACK_OF(X509) *certs, + STACK_OF(ASN1_OBJECT) *policy_oids, + unsigned int flags); + +void X509_policy_tree_free(X509_POLICY_TREE *tree); + +int X509_policy_tree_level_count(const X509_POLICY_TREE *tree); +X509_POLICY_LEVEL * + X509_policy_tree_get0_level(const X509_POLICY_TREE *tree, int i); + +STACK_OF(X509_POLICY_NODE) * + X509_policy_tree_get0_policies(const X509_POLICY_TREE *tree); + +STACK_OF(X509_POLICY_NODE) * + X509_policy_tree_get0_user_policies(const X509_POLICY_TREE *tree); + +int X509_policy_level_node_count(X509_POLICY_LEVEL *level); + +X509_POLICY_NODE *X509_policy_level_get0_node(X509_POLICY_LEVEL *level, int i); + +const ASN1_OBJECT *X509_policy_node_get0_policy(const X509_POLICY_NODE *node); + +STACK_OF(POLICYQUALINFO) * + X509_policy_node_get0_qualifiers(const X509_POLICY_NODE *node); +const X509_POLICY_NODE * + X509_policy_node_get0_parent(const X509_POLICY_NODE *node); + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/h/openssl/x509v3.h b/h/openssl/x509v3.h new file mode 100644 index 0000000..555820f --- /dev/null +++ b/h/openssl/x509v3.h @@ -0,0 +1,759 @@ +/* x509v3.h */ +/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL + * project 1999. + */ +/* ==================================================================== + * Copyright (c) 1999-2004 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +#ifndef HEADER_X509V3_H +#define HEADER_X509V3_H + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward reference */ +struct v3_ext_method; +struct v3_ext_ctx; + +/* Useful typedefs */ + +typedef void * (*X509V3_EXT_NEW)(void); +typedef void (*X509V3_EXT_FREE)(void *); +typedef void * (*X509V3_EXT_D2I)(void *, const unsigned char ** , long); +typedef int (*X509V3_EXT_I2D)(void *, unsigned char **); +typedef STACK_OF(CONF_VALUE) * (*X509V3_EXT_I2V)(struct v3_ext_method *method, void *ext, STACK_OF(CONF_VALUE) *extlist); +typedef void * (*X509V3_EXT_V2I)(struct v3_ext_method *method, struct v3_ext_ctx *ctx, STACK_OF(CONF_VALUE) *values); +typedef char * (*X509V3_EXT_I2S)(struct v3_ext_method *method, void *ext); +typedef void * (*X509V3_EXT_S2I)(struct v3_ext_method *method, struct v3_ext_ctx *ctx, const char *str); +typedef int (*X509V3_EXT_I2R)(struct v3_ext_method *method, void *ext, BIO *out, int indent); +typedef void * (*X509V3_EXT_R2I)(struct v3_ext_method *method, struct v3_ext_ctx *ctx, const char *str); + +/* V3 extension structure */ + +struct v3_ext_method { +int ext_nid; +int ext_flags; +/* If this is set the following four fields are ignored */ +ASN1_ITEM_EXP *it; +/* Old style ASN1 calls */ +X509V3_EXT_NEW ext_new; +X509V3_EXT_FREE ext_free; +X509V3_EXT_D2I d2i; +X509V3_EXT_I2D i2d; + +/* The following pair is used for string extensions */ +X509V3_EXT_I2S i2s; +X509V3_EXT_S2I s2i; + +/* The following pair is used for multi-valued extensions */ +X509V3_EXT_I2V i2v; +X509V3_EXT_V2I v2i; + +/* The following are used for raw extensions */ +X509V3_EXT_I2R i2r; +X509V3_EXT_R2I r2i; + +void *usr_data; /* Any extension specific data */ +}; + +typedef struct X509V3_CONF_METHOD_st { +char * (*get_string)(void *db, char *section, char *value); +STACK_OF(CONF_VALUE) * (*get_section)(void *db, char *section); +void (*free_string)(void *db, char * string); +void (*free_section)(void *db, STACK_OF(CONF_VALUE) *section); +} X509V3_CONF_METHOD; + +/* Context specific info */ +struct v3_ext_ctx { +#define CTX_TEST 0x1 +int flags; +X509 *issuer_cert; +X509 *subject_cert; +X509_REQ *subject_req; +X509_CRL *crl; +X509V3_CONF_METHOD *db_meth; +void *db; +/* Maybe more here */ +}; + +typedef struct v3_ext_method X509V3_EXT_METHOD; + +DECLARE_STACK_OF(X509V3_EXT_METHOD) + +/* ext_flags values */ +#define X509V3_EXT_DYNAMIC 0x1 +#define X509V3_EXT_CTX_DEP 0x2 +#define X509V3_EXT_MULTILINE 0x4 + +typedef BIT_STRING_BITNAME ENUMERATED_NAMES; + +typedef struct BASIC_CONSTRAINTS_st { +int ca; +ASN1_INTEGER *pathlen; +} BASIC_CONSTRAINTS; + + +typedef struct PKEY_USAGE_PERIOD_st { +ASN1_GENERALIZEDTIME *notBefore; +ASN1_GENERALIZEDTIME *notAfter; +} PKEY_USAGE_PERIOD; + +typedef struct otherName_st { +ASN1_OBJECT *type_id; +ASN1_TYPE *value; +} OTHERNAME; + +typedef struct EDIPartyName_st { + ASN1_STRING *nameAssigner; + ASN1_STRING *partyName; +} EDIPARTYNAME; + +typedef struct GENERAL_NAME_st { + +#define GEN_OTHERNAME 0 +#define GEN_EMAIL 1 +#define GEN_DNS 2 +#define GEN_X400 3 +#define GEN_DIRNAME 4 +#define GEN_EDIPARTY 5 +#define GEN_URI 6 +#define GEN_IPADD 7 +#define GEN_RID 8 + +int type; +union { + char *ptr; + OTHERNAME *otherName; /* otherName */ + ASN1_IA5STRING *rfc822Name; + ASN1_IA5STRING *dNSName; + ASN1_TYPE *x400Address; + X509_NAME *directoryName; + EDIPARTYNAME *ediPartyName; + ASN1_IA5STRING *uniformResourceIdentifier; + ASN1_OCTET_STRING *iPAddress; + ASN1_OBJECT *registeredID; + + /* Old names */ + ASN1_OCTET_STRING *ip; /* iPAddress */ + X509_NAME *dirn; /* dirn */ + ASN1_IA5STRING *ia5;/* rfc822Name, dNSName, uniformResourceIdentifier */ + ASN1_OBJECT *rid; /* registeredID */ + ASN1_TYPE *other; /* x400Address */ +} d; +} GENERAL_NAME; + +typedef STACK_OF(GENERAL_NAME) GENERAL_NAMES; + +typedef struct ACCESS_DESCRIPTION_st { + ASN1_OBJECT *method; + GENERAL_NAME *location; +} ACCESS_DESCRIPTION; + +typedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS; + +typedef STACK_OF(ASN1_OBJECT) EXTENDED_KEY_USAGE; + +DECLARE_STACK_OF(GENERAL_NAME) +DECLARE_ASN1_SET_OF(GENERAL_NAME) + +DECLARE_STACK_OF(ACCESS_DESCRIPTION) +DECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION) + +typedef struct DIST_POINT_NAME_st { +int type; +union { + GENERAL_NAMES *fullname; + STACK_OF(X509_NAME_ENTRY) *relativename; +} name; +} DIST_POINT_NAME; + +typedef struct DIST_POINT_st { +DIST_POINT_NAME *distpoint; +ASN1_BIT_STRING *reasons; +GENERAL_NAMES *CRLissuer; +} DIST_POINT; + +typedef STACK_OF(DIST_POINT) CRL_DIST_POINTS; + +DECLARE_STACK_OF(DIST_POINT) +DECLARE_ASN1_SET_OF(DIST_POINT) + +typedef struct AUTHORITY_KEYID_st { +ASN1_OCTET_STRING *keyid; +GENERAL_NAMES *issuer; +ASN1_INTEGER *serial; +} AUTHORITY_KEYID; + +/* Strong extranet structures */ + +typedef struct SXNET_ID_st { + ASN1_INTEGER *zone; + ASN1_OCTET_STRING *user; +} SXNETID; + +DECLARE_STACK_OF(SXNETID) +DECLARE_ASN1_SET_OF(SXNETID) + +typedef struct SXNET_st { + ASN1_INTEGER *version; + STACK_OF(SXNETID) *ids; +} SXNET; + +typedef struct NOTICEREF_st { + ASN1_STRING *organization; + STACK_OF(ASN1_INTEGER) *noticenos; +} NOTICEREF; + +typedef struct USERNOTICE_st { + NOTICEREF *noticeref; + ASN1_STRING *exptext; +} USERNOTICE; + +typedef struct POLICYQUALINFO_st { + ASN1_OBJECT *pqualid; + union { + ASN1_IA5STRING *cpsuri; + USERNOTICE *usernotice; + ASN1_TYPE *other; + } d; +} POLICYQUALINFO; + +DECLARE_STACK_OF(POLICYQUALINFO) +DECLARE_ASN1_SET_OF(POLICYQUALINFO) + +typedef struct POLICYINFO_st { + ASN1_OBJECT *policyid; + STACK_OF(POLICYQUALINFO) *qualifiers; +} POLICYINFO; + +typedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES; + +DECLARE_STACK_OF(POLICYINFO) +DECLARE_ASN1_SET_OF(POLICYINFO) + +typedef struct POLICY_MAPPING_st { + ASN1_OBJECT *issuerDomainPolicy; + ASN1_OBJECT *subjectDomainPolicy; +} POLICY_MAPPING; + +DECLARE_STACK_OF(POLICY_MAPPING) + +typedef STACK_OF(POLICY_MAPPING) POLICY_MAPPINGS; + +typedef struct GENERAL_SUBTREE_st { + GENERAL_NAME *base; + ASN1_INTEGER *minimum; + ASN1_INTEGER *maximum; +} GENERAL_SUBTREE; + +DECLARE_STACK_OF(GENERAL_SUBTREE) + +typedef struct NAME_CONSTRAINTS_st { + STACK_OF(GENERAL_SUBTREE) *permittedSubtrees; + STACK_OF(GENERAL_SUBTREE) *excludedSubtrees; +} NAME_CONSTRAINTS; + +typedef struct POLICY_CONSTRAINTS_st { + ASN1_INTEGER *requireExplicitPolicy; + ASN1_INTEGER *inhibitPolicyMapping; +} POLICY_CONSTRAINTS; + +/* Proxy certificate structures, see RFC 3820 */ +typedef struct PROXY_POLICY_st + { + ASN1_OBJECT *policyLanguage; + ASN1_OCTET_STRING *policy; + } PROXY_POLICY; + +typedef struct PROXY_CERT_INFO_EXTENSION_st + { + ASN1_INTEGER *pcPathLengthConstraint; + PROXY_POLICY *proxyPolicy; + } PROXY_CERT_INFO_EXTENSION; + +DECLARE_ASN1_FUNCTIONS(PROXY_POLICY) +DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION) + + +#define X509V3_conf_err(val) ERR_add_error_data(6, "section:", val->section, \ +",name:", val->name, ",value:", val->value); + +#define X509V3_set_ctx_test(ctx) \ + X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST) +#define X509V3_set_ctx_nodb(ctx) (ctx)->db = NULL; + +#define EXT_BITSTRING(nid, table) { nid, 0, ASN1_ITEM_ref(ASN1_BIT_STRING), \ + 0,0,0,0, \ + 0,0, \ + (X509V3_EXT_I2V)i2v_ASN1_BIT_STRING, \ + (X509V3_EXT_V2I)v2i_ASN1_BIT_STRING, \ + NULL, NULL, \ + table} + +#define EXT_IA5STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_IA5STRING), \ + 0,0,0,0, \ + (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, \ + (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, \ + 0,0,0,0, \ + NULL} + +#define EXT_END { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + + +/* X509_PURPOSE stuff */ + +#define EXFLAG_BCONS 0x1 +#define EXFLAG_KUSAGE 0x2 +#define EXFLAG_XKUSAGE 0x4 +#define EXFLAG_NSCERT 0x8 + +#define EXFLAG_CA 0x10 +#define EXFLAG_SS 0x20 +#define EXFLAG_V1 0x40 +#define EXFLAG_INVALID 0x80 +#define EXFLAG_SET 0x100 +#define EXFLAG_CRITICAL 0x200 +#define EXFLAG_PROXY 0x400 + +#define EXFLAG_INVALID_POLICY 0x400 + +#define KU_DIGITAL_SIGNATURE 0x0080 +#define KU_NON_REPUDIATION 0x0040 +#define KU_KEY_ENCIPHERMENT 0x0020 +#define KU_DATA_ENCIPHERMENT 0x0010 +#define KU_KEY_AGREEMENT 0x0008 +#define KU_KEY_CERT_SIGN 0x0004 +#define KU_CRL_SIGN 0x0002 +#define KU_ENCIPHER_ONLY 0x0001 +#define KU_DECIPHER_ONLY 0x8000 + +#define NS_SSL_CLIENT 0x80 +#define NS_SSL_SERVER 0x40 +#define NS_SMIME 0x20 +#define NS_OBJSIGN 0x10 +#define NS_SSL_CA 0x04 +#define NS_SMIME_CA 0x02 +#define NS_OBJSIGN_CA 0x01 +#define NS_ANY_CA (NS_SSL_CA|NS_SMIME_CA|NS_OBJSIGN_CA) + +#define XKU_SSL_SERVER 0x1 +#define XKU_SSL_CLIENT 0x2 +#define XKU_SMIME 0x4 +#define XKU_CODE_SIGN 0x8 +#define XKU_SGC 0x10 +#define XKU_OCSP_SIGN 0x20 +#define XKU_TIMESTAMP 0x40 +#define XKU_DVCS 0x80 + +#define X509_PURPOSE_DYNAMIC 0x1 +#define X509_PURPOSE_DYNAMIC_NAME 0x2 + +typedef struct x509_purpose_st { + int purpose; + int trust; /* Default trust ID */ + int flags; + int (*check_purpose)(const struct x509_purpose_st *, + const X509 *, int); + char *name; + char *sname; + void *usr_data; +} X509_PURPOSE; + +#define X509_PURPOSE_SSL_CLIENT 1 +#define X509_PURPOSE_SSL_SERVER 2 +#define X509_PURPOSE_NS_SSL_SERVER 3 +#define X509_PURPOSE_SMIME_SIGN 4 +#define X509_PURPOSE_SMIME_ENCRYPT 5 +#define X509_PURPOSE_CRL_SIGN 6 +#define X509_PURPOSE_ANY 7 +#define X509_PURPOSE_OCSP_HELPER 8 + +#define X509_PURPOSE_MIN 1 +#define X509_PURPOSE_MAX 8 + +/* Flags for X509V3_EXT_print() */ + +#define X509V3_EXT_UNKNOWN_MASK (0xfL << 16) +/* Return error for unknown extensions */ +#define X509V3_EXT_DEFAULT 0 +/* Print error for unknown extensions */ +#define X509V3_EXT_ERROR_UNKNOWN (1L << 16) +/* ASN1 parse unknown extensions */ +#define X509V3_EXT_PARSE_UNKNOWN (2L << 16) +/* BIO_dump unknown extensions */ +#define X509V3_EXT_DUMP_UNKNOWN (3L << 16) + +/* Flags for X509V3_add1_i2d */ + +#define X509V3_ADD_OP_MASK 0xfL +#define X509V3_ADD_DEFAULT 0L +#define X509V3_ADD_APPEND 1L +#define X509V3_ADD_REPLACE 2L +#define X509V3_ADD_REPLACE_EXISTING 3L +#define X509V3_ADD_KEEP_EXISTING 4L +#define X509V3_ADD_DELETE 5L +#define X509V3_ADD_SILENT 0x10 + +DECLARE_STACK_OF(X509_PURPOSE) + +DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS) + +DECLARE_ASN1_FUNCTIONS(SXNET) +DECLARE_ASN1_FUNCTIONS(SXNETID) + +int SXNET_add_id_asc(SXNET **psx, char *zone, char *user, int userlen); +int SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, char *user, int userlen); +int SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *izone, char *user, int userlen); + +ASN1_OCTET_STRING *SXNET_get_id_asc(SXNET *sx, char *zone); +ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone); +ASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone); + +DECLARE_ASN1_FUNCTIONS(AUTHORITY_KEYID) + +DECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD) + +DECLARE_ASN1_FUNCTIONS(GENERAL_NAME) + + +ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); +STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, + ASN1_BIT_STRING *bits, + STACK_OF(CONF_VALUE) *extlist); + +STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, GENERAL_NAME *gen, STACK_OF(CONF_VALUE) *ret); +int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen); + +DECLARE_ASN1_FUNCTIONS(GENERAL_NAMES) + +STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method, + GENERAL_NAMES *gen, STACK_OF(CONF_VALUE) *extlist); +GENERAL_NAMES *v2i_GENERAL_NAMES(X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); + +DECLARE_ASN1_FUNCTIONS(OTHERNAME) +DECLARE_ASN1_FUNCTIONS(EDIPARTYNAME) + +char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *ia5); +ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, char *str); + +DECLARE_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE) +int i2a_ACCESS_DESCRIPTION(BIO *bp, ACCESS_DESCRIPTION* a); + +DECLARE_ASN1_FUNCTIONS(CERTIFICATEPOLICIES) +DECLARE_ASN1_FUNCTIONS(POLICYINFO) +DECLARE_ASN1_FUNCTIONS(POLICYQUALINFO) +DECLARE_ASN1_FUNCTIONS(USERNOTICE) +DECLARE_ASN1_FUNCTIONS(NOTICEREF) + +DECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS) +DECLARE_ASN1_FUNCTIONS(DIST_POINT) +DECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME) + +DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION) +DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS) + +DECLARE_ASN1_ITEM(POLICY_MAPPING) +DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING) +DECLARE_ASN1_ITEM(POLICY_MAPPINGS) + +DECLARE_ASN1_ITEM(GENERAL_SUBTREE) +DECLARE_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE) + +DECLARE_ASN1_ITEM(NAME_CONSTRAINTS) +DECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS) + +DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS) +DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS) + +#ifdef HEADER_CONF_H +GENERAL_NAME *v2i_GENERAL_NAME(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, + CONF_VALUE *cnf); +GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, CONF_VALUE *cnf, int is_nc); +void X509V3_conf_free(CONF_VALUE *val); + +X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, char *value); +X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, char *name, char *value); +int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, char *section, STACK_OF(X509_EXTENSION) **sk); +int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509 *cert); +int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509_REQ *req); +int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509_CRL *crl); + +X509_EXTENSION *X509V3_EXT_conf_nid(LHASH *conf, X509V3_CTX *ctx, int ext_nid, char *value); +X509_EXTENSION *X509V3_EXT_conf(LHASH *conf, X509V3_CTX *ctx, char *name, char *value); +int X509V3_EXT_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, X509 *cert); +int X509V3_EXT_REQ_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, X509_REQ *req); +int X509V3_EXT_CRL_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, X509_CRL *crl); + +int X509V3_add_value_bool_nf(char *name, int asn1_bool, + STACK_OF(CONF_VALUE) **extlist); +int X509V3_get_value_bool(CONF_VALUE *value, int *asn1_bool); +int X509V3_get_value_int(CONF_VALUE *value, ASN1_INTEGER **aint); +void X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf); +void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH *lhash); +#endif + +char * X509V3_get_string(X509V3_CTX *ctx, char *name, char *section); +STACK_OF(CONF_VALUE) * X509V3_get_section(X509V3_CTX *ctx, char *section); +void X509V3_string_free(X509V3_CTX *ctx, char *str); +void X509V3_section_free( X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *section); +void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject, + X509_REQ *req, X509_CRL *crl, int flags); + +int X509V3_add_value(const char *name, const char *value, + STACK_OF(CONF_VALUE) **extlist); +int X509V3_add_value_uchar(const char *name, const unsigned char *value, + STACK_OF(CONF_VALUE) **extlist); +int X509V3_add_value_bool(const char *name, int asn1_bool, + STACK_OF(CONF_VALUE) **extlist); +int X509V3_add_value_int(const char *name, ASN1_INTEGER *aint, + STACK_OF(CONF_VALUE) **extlist); +char * i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, ASN1_INTEGER *aint); +ASN1_INTEGER * s2i_ASN1_INTEGER(X509V3_EXT_METHOD *meth, char *value); +char * i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *meth, ASN1_ENUMERATED *aint); +char * i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *meth, ASN1_ENUMERATED *aint); +int X509V3_EXT_add(X509V3_EXT_METHOD *ext); +int X509V3_EXT_add_list(X509V3_EXT_METHOD *extlist); +int X509V3_EXT_add_alias(int nid_to, int nid_from); +void X509V3_EXT_cleanup(void); + +X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext); +X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid); +int X509V3_add_standard_extensions(void); +STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line); +void *X509V3_EXT_d2i(X509_EXTENSION *ext); +void *X509V3_get_d2i(STACK_OF(X509_EXTENSION) *x, int nid, int *crit, int *idx); + + +X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc); +int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value, int crit, unsigned long flags); + +char *hex_to_string(unsigned char *buffer, long len); +unsigned char *string_to_hex(char *str, long *len); +int name_cmp(const char *name, const char *cmp); + +void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, + int ml); +int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, int indent); +int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent); + +int X509V3_extensions_print(BIO *out, char *title, STACK_OF(X509_EXTENSION) *exts, unsigned long flag, int indent); + +int X509_check_ca(X509 *x); +int X509_check_purpose(X509 *x, int id, int ca); +int X509_supported_extension(X509_EXTENSION *ex); +int X509_PURPOSE_set(int *p, int purpose); +int X509_check_issued(X509 *issuer, X509 *subject); +int X509_PURPOSE_get_count(void); +X509_PURPOSE * X509_PURPOSE_get0(int idx); +int X509_PURPOSE_get_by_sname(char *sname); +int X509_PURPOSE_get_by_id(int id); +int X509_PURPOSE_add(int id, int trust, int flags, + int (*ck)(const X509_PURPOSE *, const X509 *, int), + char *name, char *sname, void *arg); +char *X509_PURPOSE_get0_name(X509_PURPOSE *xp); +char *X509_PURPOSE_get0_sname(X509_PURPOSE *xp); +int X509_PURPOSE_get_trust(X509_PURPOSE *xp); +void X509_PURPOSE_cleanup(void); +int X509_PURPOSE_get_id(X509_PURPOSE *); + +STACK *X509_get1_email(X509 *x); +STACK *X509_REQ_get1_email(X509_REQ *x); +void X509_email_free(STACK *sk); + +ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc); +ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc); +int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE)*dn_sk, + unsigned long chtype); + +void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_X509V3_strings(void); + +/* Error codes for the X509V3 functions. */ + +/* Function codes. */ +#define X509V3_F_COPY_EMAIL 122 +#define X509V3_F_COPY_ISSUER 123 +#define X509V3_F_DO_DIRNAME 144 +#define X509V3_F_DO_EXT_CONF 124 +#define X509V3_F_DO_EXT_I2D 135 +#define X509V3_F_DO_EXT_NCONF 151 +#define X509V3_F_DO_I2V_NAME_CONSTRAINTS 148 +#define X509V3_F_HEX_TO_STRING 111 +#define X509V3_F_I2S_ASN1_ENUMERATED 121 +#define X509V3_F_I2S_ASN1_IA5STRING 149 +#define X509V3_F_I2S_ASN1_INTEGER 120 +#define X509V3_F_I2V_AUTHORITY_INFO_ACCESS 138 +#define X509V3_F_NOTICE_SECTION 132 +#define X509V3_F_NREF_NOS 133 +#define X509V3_F_POLICY_SECTION 131 +#define X509V3_F_PROCESS_PCI_VALUE 150 +#define X509V3_F_R2I_CERTPOL 130 +#define X509V3_F_R2I_PCI 149 +#define X509V3_F_S2I_ASN1_IA5STRING 100 +#define X509V3_F_S2I_ASN1_INTEGER 108 +#define X509V3_F_S2I_ASN1_OCTET_STRING 112 +#define X509V3_F_S2I_ASN1_SKEY_ID 114 +#define X509V3_F_S2I_SKEY_ID 115 +#define X509V3_F_STRING_TO_HEX 113 +#define X509V3_F_SXNET_ADD_ID_ASC 125 +#define X509V3_F_SXNET_ADD_ID_INTEGER 126 +#define X509V3_F_SXNET_ADD_ID_ULONG 127 +#define X509V3_F_SXNET_GET_ID_ASC 128 +#define X509V3_F_SXNET_GET_ID_ULONG 129 +#define X509V3_F_V2I_ASN1_BIT_STRING 101 +#define X509V3_F_V2I_AUTHORITY_INFO_ACCESS 139 +#define X509V3_F_V2I_AUTHORITY_KEYID 119 +#define X509V3_F_V2I_BASIC_CONSTRAINTS 102 +#define X509V3_F_V2I_CRLD 134 +#define X509V3_F_V2I_EXTENDED_KEY_USAGE 103 +#define X509V3_F_V2I_GENERAL_NAMES 118 +#define X509V3_F_V2I_GENERAL_NAME_EX 117 +#define X509V3_F_V2I_ISSUER_ALT 153 +#define X509V3_F_V2I_NAME_CONSTRAINTS 147 +#define X509V3_F_V2I_POLICY_CONSTRAINTS 146 +#define X509V3_F_V2I_POLICY_MAPPINGS 145 +#define X509V3_F_V2I_SUBJECT_ALT 154 +#define X509V3_F_V3_GENERIC_EXTENSION 116 +#define X509V3_F_X509V3_ADD1_I2D 140 +#define X509V3_F_X509V3_ADD_VALUE 105 +#define X509V3_F_X509V3_EXT_ADD 104 +#define X509V3_F_X509V3_EXT_ADD_ALIAS 106 +#define X509V3_F_X509V3_EXT_CONF 107 +#define X509V3_F_X509V3_EXT_I2D 136 +#define X509V3_F_X509V3_EXT_NCONF 152 +#define X509V3_F_X509V3_GET_SECTION 142 +#define X509V3_F_X509V3_GET_STRING 143 +#define X509V3_F_X509V3_GET_VALUE_BOOL 110 +#define X509V3_F_X509V3_PARSE_LIST 109 +#define X509V3_F_X509_PURPOSE_ADD 137 +#define X509V3_F_X509_PURPOSE_SET 141 + +/* Reason codes. */ +#define X509V3_R_BAD_IP_ADDRESS 118 +#define X509V3_R_BAD_OBJECT 119 +#define X509V3_R_BN_DEC2BN_ERROR 100 +#define X509V3_R_BN_TO_ASN1_INTEGER_ERROR 101 +#define X509V3_R_DIRNAME_ERROR 149 +#define X509V3_R_DUPLICATE_ZONE_ID 133 +#define X509V3_R_ERROR_CONVERTING_ZONE 131 +#define X509V3_R_ERROR_CREATING_EXTENSION 144 +#define X509V3_R_ERROR_IN_EXTENSION 128 +#define X509V3_R_EXPECTED_A_SECTION_NAME 137 +#define X509V3_R_EXTENSION_EXISTS 145 +#define X509V3_R_EXTENSION_NAME_ERROR 115 +#define X509V3_R_EXTENSION_NOT_FOUND 102 +#define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED 103 +#define X509V3_R_EXTENSION_VALUE_ERROR 116 +#define X509V3_R_ILLEGAL_EMPTY_EXTENSION 151 +#define X509V3_R_ILLEGAL_HEX_DIGIT 113 +#define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG 152 +#define X509V3_R_INVALID_BOOLEAN_STRING 104 +#define X509V3_R_INVALID_EXTENSION_STRING 105 +#define X509V3_R_INVALID_NAME 106 +#define X509V3_R_INVALID_NULL_ARGUMENT 107 +#define X509V3_R_INVALID_NULL_NAME 108 +#define X509V3_R_INVALID_NULL_VALUE 109 +#define X509V3_R_INVALID_NUMBER 140 +#define X509V3_R_INVALID_NUMBERS 141 +#define X509V3_R_INVALID_OBJECT_IDENTIFIER 110 +#define X509V3_R_INVALID_OPTION 138 +#define X509V3_R_INVALID_POLICY_IDENTIFIER 134 +#define X509V3_R_INVALID_PROXY_POLICY_SETTING 153 +#define X509V3_R_INVALID_PURPOSE 146 +#define X509V3_R_INVALID_SECTION 135 +#define X509V3_R_INVALID_SYNTAX 143 +#define X509V3_R_ISSUER_DECODE_ERROR 126 +#define X509V3_R_MISSING_VALUE 124 +#define X509V3_R_NEED_ORGANIZATION_AND_NUMBERS 142 +#define X509V3_R_NO_CONFIG_DATABASE 136 +#define X509V3_R_NO_ISSUER_CERTIFICATE 121 +#define X509V3_R_NO_ISSUER_DETAILS 127 +#define X509V3_R_NO_POLICY_IDENTIFIER 139 +#define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED 154 +#define X509V3_R_NO_PUBLIC_KEY 114 +#define X509V3_R_NO_SUBJECT_DETAILS 125 +#define X509V3_R_ODD_NUMBER_OF_DIGITS 112 +#define X509V3_R_OPERATION_NOT_DEFINED 148 +#define X509V3_R_OTHERNAME_ERROR 147 +#define X509V3_R_POLICY_LANGUAGE_ALREADTY_DEFINED 155 +#define X509V3_R_POLICY_PATH_LENGTH 156 +#define X509V3_R_POLICY_PATH_LENGTH_ALREADTY_DEFINED 157 +#define X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED 158 +#define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 159 +#define X509V3_R_SECTION_NOT_FOUND 150 +#define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS 122 +#define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID 123 +#define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT 111 +#define X509V3_R_UNKNOWN_EXTENSION 129 +#define X509V3_R_UNKNOWN_EXTENSION_NAME 130 +#define X509V3_R_UNKNOWN_OPTION 120 +#define X509V3_R_UNSUPPORTED_OPTION 117 +#define X509V3_R_USER_TOO_LONG 132 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/passFsLib.h b/h/passFsLib.h new file mode 100644 index 0000000..17866f1 --- /dev/null +++ b/h/passFsLib.h @@ -0,0 +1,71 @@ +/* passFsLib.h - pass-through file system library header */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,11feb05,dbt Fixed cache support (SPR #106354). +01f,13sep04,jmp made passFs cache configurable. +01e,09sep04,jmp added flags and mode to PASS_FILE_DESC (SPR #97903). +01d,02apr04,jeg Updated PASS_FILE_DESC fd field name. +01c,18mar03,jeg removed passFs flags and conversion macro. +01b,05mar03,jeg add several Unix file specific definitions +01a,05jun93,gae written. +*/ + + +#ifndef __INCpassFsLibh +#define __INCpassFsLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "ioLib.h" +#include "iosLib.h" + +/* typedefs */ + +typedef struct /* Volume descriptor */ + { + DEV_HDR passDevHdr; /* tracks the device: only one passFs device */ + char passDevName [MAX_FILENAME_LENGTH]; + } VOL_DESC; + +typedef struct /* pass-through file system file descriptor */ + { + VOL_DESC * passVdptr; /* VOL_DESC (unused on host) */ + char path[MAX_FILENAME_LENGTH]; /* file or directory path */ + int fileFd; /* -1 for directory */ + void * dirFd; /* directory descriptor */ + int flags; /* open flags */ + int mode; /* open permissions (mode) */ + char * readCache; /* pointer to cache content */ + int cacheOffset; /* offset into cache */ + int cacheBytes; /* cache content size */ + int cacheFileOffset; /* cache file offset */ + } PASS_FILE_DESC; + + +/* Function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void *passFsDevInit (char *devName); +extern STATUS passFsInit (int passfs, BOOL cacheEnable); + +#else /* __STDC__ */ + +extern void *passFsDevInit (); +extern STATUS passFsInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpassFsLibh */ diff --git a/h/pathLib.h b/h/pathLib.h new file mode 100644 index 0000000..a5b95ab --- /dev/null +++ b/h/pathLib.h @@ -0,0 +1,54 @@ +/* pathLib.h - path library header file */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01k,28jul03,dat strict const char * prototypes, removed non-ANSI prototypes +01j,22sep92,rrr added support for c++ +01i,04jul92,jcf cleaned up. +01h,26may92,rrr the tree shuffle +01g,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01f,05oct90,dnw removed private functions. +01e,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01d,30jul90,dnw added pathLastNamePtr() and changed pathLastName() to void. +01c,01may90,llk changed pathBuild() and pathCat() to return STATUS. +01b,01apr90,llk deleted pathArrayFree(). +01a,06jul89,llk written. +*/ + +#ifndef __INCpathLibh +#define __INCpathLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" + + +/* function declarations */ + +extern STATUS pathBuild (const char ** nameArray, char ** nameArrayEnd, + char *destString); +extern STATUS pathCat (const char *dirName, const char *fileName, + char *result); +extern char * pathLastNamePtr (const char *pathName); +extern void pathCondense (char *pathName); +extern void pathLastName (char *pathName, char ** pLastName); +extern void pathParse (const char *longName, char ** nameArray, + char *nameBuf); +extern void pathSplit (const char *fullFileName, char *dirName, + char *fileName); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpathLibh */ diff --git a/h/pci.h b/h/pci.h new file mode 100644 index 0000000..17051d8 --- /dev/null +++ b/h/pci.h @@ -0,0 +1,56 @@ +/* pci.h - PCI bus constants header file */ + +/* Copyright 1984-1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,02feb99,tm written +*/ + +/* +DESCRIPTION + +This file contains address space descriptor defines analogous to the +definitions for the VME bus contained in vme.h. There are two sets of +defines corresponding to a primary (PRI) PCI interface and a secondary +(SEC) interface. + +The primary interface is defined as the interface that is closest to +the system processor. The secondary interface is defined as the interface +that is farther downstream from the processor than the primary bus, such +as a CompactPCI bus that is accessed through a PCI-to-PCI bridge. +*/ + +#ifndef __INCpcih +#define __INCpcih + +#ifdef __cplusplus +extern "C" { +#endif + +#define PCI_SPACE_IO_PRI 0x40 +#define PCI_SPACE_MEMIO_PRI 0x41 +#define PCI_SPACE_MEM_PRI 0x42 +#define PCI_SPACE_IO16_PRI 0x43 +#define PCI_SPACE_CFG_PRI 0x44 +#define PCI_SPACE_IACK_PRI 0x45 + +#define PCI_SPACE_IO_SEC 0x50 +#define PCI_SPACE_MEMIO_SEC 0x51 +#define PCI_SPACE_MEM_SEC 0x52 +#define PCI_SPACE_IO16_SEC 0x53 +#define PCI_SPACE_CFG_SEC 0x54 +#define PCI_SPACE_IACK_SEC 0x55 + +#define PCI_SPACE_IS_PRI(s) (((s) & 0xf0) == 0x40) +#define PCI_SPACE_IS_SEC(s) (((s) & 0xf0) == 0x50) + +#define PCI_SPACE_IS_LOCAL PCI_SPACE_IS_PRI +#define PCI_SPACE_IS_CPCI PCI_SPACE_IS_SEC + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpcih */ diff --git a/h/pciClass.h b/h/pciClass.h new file mode 100644 index 0000000..5c1a898 --- /dev/null +++ b/h/pciClass.h @@ -0,0 +1,290 @@ +/* pciClass.h - PCI Standard Classifications definition header */ + +/* +Copyright (c) 1984-2005 Wind River Systems, Inc. +The right to copy, distribute, modify, or otherwise make use +of this software may be licensed only pursuant to the terms of +an applicable Wind River license agreement. +*/ + +/* +modification history +-------------------- +01b,23jun05,mdo Updating per latest spec. +01a,18aug99,mas created from merge of PCI class info from dmsLib.h/01b and + pciConfigLib.h/02b. +*/ + +#ifndef __INCpciClassh +#define __INCpciClassh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * PCI classifications are composed from the concatenation of four byte-size + * components: primary (base) class, sub-class, register interface, and + * revision ID. The following comprise the standard PCI classification + * definitions. + */ + +/* + * PCI Primary (Base) Class definitions for find by class function + * Classes 0x12 - 0xFE are reserved for future enhancements + */ + +#define PCI_CLASS_PRE_PCI20 0x00 +#define PCI_CLASS_MASS_STORAGE 0x01 +#define PCI_CLASS_NETWORK_CTLR 0x02 +#define PCI_CLASS_DISPLAY_CTLR 0x03 +#define PCI_CLASS_MMEDIA_DEVICE 0x04 +#define PCI_CLASS_MEM_CTLR 0x05 +#define PCI_CLASS_BRIDGE_CTLR 0x06 +#define PCI_CLASS_COMM_CTLR 0x07 +#define PCI_CLASS_BASE_PERIPH 0x08 +#define PCI_CLASS_INPUT_DEVICE 0x09 +#define PCI_CLASS_DOCK_DEVICE 0x0A +#define PCI_CLASS_PROCESSOR 0x0B +#define PCI_CLASS_SERIAL_BUS 0x0C +#define PCI_CLASS_WIRELESS 0x0D +#define PCI_CLASS_INTLGNT_IO 0x0E +#define PCI_CLASS_SAT_COMM 0x0F +#define PCI_CLASS_EN_DECRYPTION 0x10 +#define PCI_CLASS_DAQ_DSP 0x11 +#define PCI_CLASS_UNDEFINED 0xFF + + +/* PCI Subclass definitions */ + +#define PCI_SUBCLASS_00 0x00 +#define PCI_SUBCLASS_01 0x01 +#define PCI_SUBCLASS_02 0x02 +#define PCI_SUBCLASS_03 0x03 +#define PCI_SUBCLASS_04 0x04 +#define PCI_SUBCLASS_05 0x05 +#define PCI_SUBCLASS_06 0x06 +#define PCI_SUBCLASS_07 0x07 +#define PCI_SUBCLASS_08 0x08 +#define PCI_SUBCLASS_09 0x09 +#define PCI_SUBCLASS_0A 0x0A +#define PCI_SUBCLASS_10 0x10 +#define PCI_SUBCLASS_11 0x11 +#define PCI_SUBCLASS_12 0x12 +#define PCI_SUBCLASS_20 0x20 +#define PCI_SUBCLASS_40 0x40 +#define PCI_SUBCLASS_80 0x80 + +/* Base Class 00 are Rev 1.0 and are not defined here. */ + +/* Mass Storage subclasses - Base Class 01h */ + +#define PCI_SUBCLASS_MASS_SCSI (PCI_SUBCLASS_00) +#define PCI_SUBCLASS_MASS_IDE (PCI_SUBCLASS_01) +#define PCI_SUBCLASS_MASS_FLOPPY (PCI_SUBCLASS_02) +#define PCI_SUBCLASS_MASS_IPI (PCI_SUBCLASS_03) +#define PCI_SUBCLASS_MASS_RAID (PCI_SUBCLASS_04) +#define PCI_SUBCLASS_MASS_ATA (PCI_SUBCLASS_05) +# define PCI_REG_IF_ATA_SNGL 0x20 +# define PCI_REG_IF_ATA_CHND 0x30 +#define PCI_SUBCLASS_MASS_OTHER (PCI_SUBCLASS_80) + +/* Network subclasses - Base Class 02h */ + +#define PCI_SUBCLASS_NET_ETHERNET (PCI_SUBCLASS_00) +#define PCI_SUBCLASS_NET_TOKEN_RING (PCI_SUBCLASS_01) +#define PCI_SUBCLASS_NET_FDDI (PCI_SUBCLASS_02) +#define PCI_SUBCLASS_NET_ATM (PCI_SUBCLASS_03) +#define PCI_SUBCLASS_NET_ISDN (PCI_SUBCLASS_04) +#define PCI_SUBCLASS_NET_WFIP (PCI_SUBCLASS_05) +#define PCI_SUBCLASS_NET_PCMIG214 (PCI_SUBCLASS_06) +#define PCI_SUBCLASS_NET_OTHER (PCI_SUBCLASS_80) + +/* Display subclasses - Base Class 03h */ + +#define PCI_SUBCLASS_DISPLAY_VGA (PCI_SUBCLASS_00) +# define PCI_REG_IF_VGA_STD 0x00 +# define PCI_REG_IF_VGA_8514 0x01 +#define PCI_SUBCLASS_DISPLAY_XGA (PCI_SUBCLASS_01) +#define PCI_SUBCLASS_DISPLAY_3D (PCI_SUBCLASS_02) +#define PCI_SUBCLASS_DISPLAY_OTHER (PCI_SUBCLASS_80) + +/* Multimedia subclasses - Base Class 04h */ + +#define PCI_SUBCLASS_MMEDIA_VIDEO (PCI_SUBCLASS_00) +#define PCI_SUBCLASS_MMEDIA_AUDIO (PCI_SUBCLASS_01) +#define PCI_SUBCLASS_MMEDIA_PHONY (PCI_SUBCLASS_02) +#define PCI_SUBCLASS_MMEDIA_OTHER (PCI_SUBCLASS_80) + +/* Memory subclasses - Base Class 05h */ + +#define PCI_SUBCLASS_MEM_RAM (PCI_SUBCLASS_00) +#define PCI_SUBCLASS_MEM_FLASH (PCI_SUBCLASS_01) +#define PCI_SUBCLASS_MEM_OTHER (PCI_SUBCLASS_80) + +/* Bus Bridge Device subclasses - Base Class 06h */ + +#define PCI_SUBCLASS_HOST_PCI_BRIDGE (PCI_SUBCLASS_00) +#define PCI_SUBCLASS_ISA_BRIDGE (PCI_SUBCLASS_01) +#define PCI_SUBCLASS_EISA_BRIDGE (PCI_SUBCLASS_02) +#define PCI_SUBCLASS_MCA_BRIDGE (PCI_SUBCLASS_03) +#define PCI_SUBCLASS_P2P_BRIDGE (PCI_SUBCLASS_04) +# define PCI_REG_IF_P2P_STD 0x00 +# define PCI_REG_IF_P2P_SUB_DECODE 0x01 +#define PCI_SUBCLASS_PCMCIA_BRIDGE (PCI_SUBCLASS_05) +#define PCI_SUBCLASS_NUBUS_BRIDGE (PCI_SUBCLASS_06) +#define PCI_SUBCLASS_CARDBUS_BRIDGE (PCI_SUBCLASS_07) +#define PCI_SUBCLASS_RACEWAY_BRIDGE (PCI_SUBCLASS_08) +# define PCI_REG_IF_RACEWAY_XPARENT 0x00 +# define PCI_REG_IF_RACEWAY_END_PNT 0x01 +#define PCI_SUBCLASS_SEMI_XPARENT (PCI_SUBCLASS_09) +# define PCI_REG_IF_SEMI_XPARENT_PRI 0x40 +# define PCI_REG_IF_SEMI_XPARENT_SEC 0x80 +#define PCI_SUBCLASS_INFINI2PCI (PCI_SUBCLASS_0A) +#define PCI_SUBCLASS_OTHER_BRIDGE (PCI_SUBCLASS_80) + +/* Simple Communications Controller subclasses - Base Class 07h */ + +#define PCI_SUBCLASS_SCC_SERIAL (PCI_SUBCLASS_00) +# define PCI_REG_IF_SERIAL_XT 0x00 +# define PCI_REG_IF_SERIAL_16450 0x01 +# define PCI_REG_IF_SERIAL_16550 0x02 +# define PCI_REG_IF_SERIAL_16650 0x03 +# define PCI_REG_IF_SERIAL_16750 0x04 +# define PCI_REG_IF_SERIAL_16850 0x05 +# define PCI_REG_IF_SERIAL_16950 0x06 +#define PCI_SUBCLASS_SCC_PARLEL (PCI_SUBCLASS_01) +# define PCI_REG_IF_PARLEL_XT 0x00 +# define PCI_REG_IF_PARLEL_BIDIR 0x01 +# define PCI_REG_IF_PARLEL_ECP 0x02 +# define PCI_REG_IF_PARLEL_1284CTLR 0x03 +# define PCI_REG_IF_PARLEL_1284TGT 0xFE +#define PCI_SUBCLASS_SCC_MULTI (PCI_SUBCLASS_02) +#define PCI_SUBCLASS_SCC_MODEM (PCI_SUBCLASS_03) +# define PCI_REG_IF_MODEM_GENERIC 0x00 +# define PCI_REG_IF_MODEM_16450 0x01 +# define PCI_REG_IF_MODEM_16550 0x02 +# define PCI_REG_IF_MODEM_16650 0x03 +# define PCI_REG_IF_MODEM_16750 0x04 +#define PCI_SUBCLASS_SCC_GPIB (PCI_SUBCLASS_04) +#define PCI_SUBCLASS_SCC_SMRTCRD (PCI_SUBCLASS_05) +#define PCI_SUBCLASS_SCC_OTHER (PCI_SUBCLASS_80) + + +/* Base System subclasses - Base Class 08h */ + +#define PCI_SUBCLASS_BASESYS_PIC (PCI_SUBCLASS_00) +# define PCI_REG_IF_PIC_GEN8259 0x00 +# define PCI_REG_IF_PIC_ISA 0x01 +# define PCI_REG_IF_PIC_EISA 0x02 +# define PCI_REG_IF_PIC_APIC 0x10 +# define PCI_REG_IF_PIC_xAPIC 0x20 +#define PCI_SUBCLASS_BASESYS_DMA (PCI_SUBCLASS_01) +# define PCI_REG_IF_DMA_GEN8237 0x00 +# define PCI_REG_IF_DMA_ISA 0x01 +# define PCI_REG_IF_DMA_EISA 0x02 +#define PCI_SUBCLASS_BASESYS_TIMER (PCI_SUBCLASS_02) +# define PCI_REG_IF_TIMER_GEN8254 0x00 +# define PCI_REG_IF_TIMER_ISA 0x01 +# define PCI_REG_IF_TIMER_EISA 0x02 +#define PCI_SUBCLASS_BASESYS_RTC (PCI_SUBCLASS_03) +# define PCI_REG_IF_RTC_GENERIC 0x00 +# define PCI_REG_IF_RTC_ISA 0x01 +#define PCI_SUBCLASS_BASESYS_HOTPLUG (PCI_SUBCLASS_04) +#define PCI_SUBCLASS_BASESYS_OTHER (PCI_SUBCLASS_80) + +/* Input Device subclasses - Base Class 09h */ + +#define PCI_SUBCLASS_INPUT_KEYBD (PCI_SUBCLASS_00) +#define PCI_SUBCLASS_INPUT_PEN (PCI_SUBCLASS_01) +#define PCI_SUBCLASS_INPUT_MOUSE (PCI_SUBCLASS_02) +#define PCI_SUBCLASS_INPUT_SCANR (PCI_SUBCLASS_03) +#define PCI_SUBCLASS_INPUT_GAMEPORT (PCI_SUBCLASS_04) +# define PCI_REG_IF_GAMEPORT_GENERIC 0x00 +# define PCI_REG_IF_GAMEPORT_LEGACY 0x10 +#define PCI_SUBCLASS_INPUT_OTHER (PCI_SUBCLASS_80) + +/* Docking Station subclasses - Base Class 0Ah */ + +#define PCI_SUBCLASS_DOCSTATN_GENERIC (PCI_SUBCLASS_00) +#define PCI_SUBCLASS_DOCSTATN_OTHER (PCI_SUBCLASS_80) + +/* Processor subclasses - Base Class 0Bh */ + +#define PCI_SUBCLASS_PROCESSOR_386 (PCI_SUBCLASS_00) +#define PCI_SUBCLASS_PROCESSOR_486 (PCI_SUBCLASS_01) +#define PCI_SUBCLASS_PROCESSOR_PENTIUM (PCI_SUBCLASS_02) +#define PCI_SUBCLASS_PROCESSOR_ALPHA (PCI_SUBCLASS_10) +#define PCI_SUBCLASS_PROCESSOR_POWERPC (PCI_SUBCLASS_20) +#define PCI_SUBCLASS_PROCESSOR_MIPS (PCI_SUBCLASS_30) +#define PCI_SUBCLASS_PROCESSOR_COPROC (PCI_SUBCLASS_40) + +/* Serial bus subclasses - Base Class 0Ch */ + +#define PCI_SUBCLASS_SERBUS_FIREWIRE (PCI_SUBCLASS_00) +# define PCI_REG_IF_FIREWIRE_1394 0x00 +# define PCI_REG_IF_FIREWIRE_HCI1394 0x10 +#define PCI_SUBCLASS_SERBUS_ACCESS (PCI_SUBCLASS_01) +#define PCI_SUBCLASS_SERBUS_SSA (PCI_SUBCLASS_02) +#define PCI_SUBCLASS_SERBUS_USB (PCI_SUBCLASS_03) +# define PCI_REG_IF_USB_UHCI 0x00 +# define PCI_REG_IF_USB_OHCI 0x10 +# define PCI_REG_IF_USB_ANY 0x80 +# define PCI_REG_IF_USB_NONHOST 0xFE +#define PCI_SUBCLASS_SERBUS_FIBRE_CHAN (PCI_SUBCLASS_04) +#define PCI_SUBCLASS_SERBUS_SMBUS (PCI_SUBCLASS_05) +#define PCI_SUBCLASS_SERBUS_INFINI (PCI_SUBCLASS_06) +#define PCI_SUBCLASS_SERBUS_IPMI (PCI_SUBCLASS_07) +# define PCI_REG_IF_IPMI_SMIC 0x00 +# define PCI_REG_IF_IPMI_KYBD 0x01 +# define PCI_REG_IF_IPMI_BLCK 0x02 +#define PCI_SUBCLASS_SERBUS_SERCOS (PCI_SUBCLASS_08) +#define PCI_SUBCLASS_SERBUS_CAN (PCI_SUBCLASS_09) +#define PCI_SUBCLASS_SERBUS_OTHER (PCI_SUBCLASS_80) + +/* Wireless subclasses - Base Class 0Dh */ + +#define PCI_SUBCLASS_WIRELESS_IRDA (PCI_SUBCLASS_00) +#define PCI_SUBCLASS_WIRELESS_OTHER_IR (PCI_SUBCLASS_01) +#define PCI_SUBCLASS_WIRELESS_RF (PCI_SUBCLASS_10) +#define PCI_SUBCLASS_WIRELESS_BTOOTH (PCI_SUBCLASS_11) +#define PCI_SUBCLASS_WIRELESS_BBAND (PCI_SUBCLASS_12) +#define PCI_SUBCLASS_WIRELESS_OTHER (PCI_SUBCLASS_80) + +/* + * Intelligent I/O subclasses - Base Class 0Eh + * REG_IF values greater than 0x00 are reserved for I2O + */ + +#define PCI_SUBCLASS_INTELIO (PCI_SUBCLASS_00) +# define PCI_REG_IF_INTELIO_MSG_FIFO 0x00 +#define PCI_8UBCLASS_INTELIO_OTHER (PCI_SUBCLASS_00) + +/* Satellite Device Communication subclasses - Base Class 0Fh */ + +#define PCI_SUBCLASS_SATCOM_TV (PCI_SUBCLASS_00) +#define PCI_SUBCLASS_SATCOM_AUDIO (PCI_SUBCLASS_01) +#define PCI_SUBCLASS_SATCOM_VOICE (PCI_SUBCLASS_03) +#define PCI_SUBCLASS_SATCOM_DATA (PCI_SUBCLASS_04) +#define PCI_SUBCLASS_SATCOM_OTHER (PCI_SUBCLASS_80) + +/* Encryption/Decryption subclasses - Base Class 10h */ + +#define PCI_SUBCLASS_EN_DECRYP_NETWORK (PCI_SUBCLASS_00) +#define PCI_SUBCLASS_EN_DECRYP_ENTRTMNT (PCI_SUBCLASS_10) +#define PCI_SUBCLASS_EN_DECRYP_OTHER (PCI_SUBCLASS_80) + +/* Data Acquisition and Signal Processing subclasses - Base Class 11h */ + +#define PCI_SUBCLASS_DAQ_DSP_DPIO (PCI_SUBCLASS_00) +#define PCI_SUBCLASS_DAQ_DSP_PCTRS (PCI_SUBCLASS_01) +#define PCI_SUBCLASS_DAQ_DSP_COMM (PCI_SUBCLASS_10) +#define PCI_SUBCLASS_DAQ_DSP_MGMT (PCI_SUBCLASS_20) +#define PCI_SUBCLASS_DAQ_DSP_OTHER (PCI_SUBCLASS_80) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpciClassh */ + diff --git a/h/pciVendor.h b/h/pciVendor.h new file mode 100644 index 0000000..a2f5715 --- /dev/null +++ b/h/pciVendor.h @@ -0,0 +1,28 @@ +/* pciVendor.h - PCI Vendor ID definition header */ + +/* Copyright 1984-1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,18aug99,mas created +*/ + +#ifndef __INCpciVendorh +#define __INCpciVendorh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* XXXmas WRS PCI Vendor ID (must have one assigned) */ + +#define PCI_VEND_WRS -2 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpciVendorh */ + diff --git a/h/pfw/pfw.h b/h/pfw/pfw.h new file mode 100644 index 0000000..de2e519 --- /dev/null +++ b/h/pfw/pfw.h @@ -0,0 +1,204 @@ +/* pfw.h - protocol framework header file */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01p,15may03,ijm removed adv_net.h +01n,26aug02,ijm include adv_net.h for IPv6 +01m,29jul02,ijm moved dual stack declarations to kppp.h +01l,26jun02,ijm added include files required to support dual stack +01k,23feb00,sj removed extra comma after last PLANE_TYPE enum +01j,24nov99,koz Added pfwIdGet and pfwObjGet routines +01i,22nov99,koz Added defines for job data size and job queue size +01h,11oct99,koz Made callback fuction expilicit in asynchronous function + signitures +01g,21sep99,koz Removed callback interfaces from plugin object +01f,16sep99,sj removed definition of PFW_PARAMETER_HANDLER +01e,08sep99,koz Added framework private data pointer to plugin object +01d,26jul99,koz Added pppJobAdd +01c,19jul99,koz Added connectionShow, connectionDeleteReq and + connectionDeleteDone fields to GENERIC_PLUGIN_OBJ +01b,14jul99,koz changed send and receive interfaces and added + _pppConnectionAdd () +01a,09jul99,koz written +*/ + +#ifndef __INCpfwh +#define __INCpfwh + + +#ifdef __cplusplus +extern "C" { +#endif + +#include "memLib.h" +#include "netBufLib.h" + +/* defines */ + +#define PFW_MAX_NAME_LENGTH 32 +#define PFW_LAYERED_PLANE_NUMBER 3 +#define PFW_MAX_JOB_DATA_SIZE 64 +#define PFW_MIN_JOB_QUEUE_SIZE 64 + +/* typedefs */ + +/* + * The protocol framework is broken into planes: user, comtrol, framing and + * management. The user, control and framing planes are broken into layers. + * The layers are broken into components. + */ + +typedef void (*PFW_FUNC) (void *); + +typedef enum pfwPlaneType + { + FRAMING_PLANE, + CONTROL_PLANE, + DATA_PLANE, + MANAGEMENT_PLANE + } PFW_PLANE_TYPE; + +typedef enum pfwPluginObjectType + { + PFW_LAYER_OBJ_TYPE, + PFW_COMPONENT_OBJ_TYPE + } PFW_PLUGIN_OBJ_TYPE; + + +typedef enum pfwParameterOperationType + { + PFW_PARAMETER_SET, + PFW_PARAMETER_GET + } PFW_PARAMETER_OPERATION_TYPE; + +typedef unsigned int PFW_ID; +typedef struct pfwObj PFW_OBJ; +typedef struct pfwPluginObj PFW_PLUGIN_OBJ; +typedef struct pfwProfileObj PFW_PROFILE_OBJ; +typedef struct pfwStackObj PFW_STACK_OBJ; +typedef struct pfwPrivateData PFW_PRIVATE_DATA; +typedef struct pfwPluginObjCallbacks PFW_PLUGIN_OBJ_CALLBACKS; + +/* Protocol framework plugin object state structure */ + +typedef struct pfwPluginObjState + { + PFW_PLUGIN_OBJ *pluginObj; /* pointer to the plugin object */ + PFW_STACK_OBJ *stackObj; /* pointer to the stack object */ + void *profileData; /* pointer to the profile data of the object */ + void *stackData; /* pointer to the stack data of the object */ + } PFW_PLUGIN_OBJ_STATE; + +/* + * When pfwStackAdd (or pfwStackDelete) is called, the framework creates a + * stack object and calls the asynchronous function stackAdd (or stackDelete) + * of plugin objects. If the plugin object is a layer, it calls its own + * components stackAdd (or stackDelete) function. Eventually the components + * call back their layers and the layers call back the framework to indicate + * that the add (or delete) operation is completed. The callback function + * structure for plugin objects is defined as follows. + */ + +struct pfwPluginObjCallbacks + { + void (*stackAddComplete) /* called by a plugin obj to inform */ + (PFW_PLUGIN_OBJ_CALLBACKS *, /* stack add processing is completed */ + PFW_PLUGIN_OBJ_STATE *); + void (*stackDeleteComplete) /* called by a plugin obj to inform */ + (PFW_PLUGIN_OBJ_CALLBACKS *, /* stack delete is completed */ + PFW_PLUGIN_OBJ_STATE *); + void (*stackAddError) /* called by a plugin obj to inform */ + (PFW_PLUGIN_OBJ_CALLBACKS *, /* an error happened during stack add */ + PFW_PLUGIN_OBJ_STATE *); + void (*stackDeleteError) /* called by a plugin obj to inform */ + (PFW_PLUGIN_OBJ_CALLBACKS *, /* an error happened during delete */ + PFW_PLUGIN_OBJ_STATE *); + }; + +struct pfwPluginObj + { + PFW_PRIVATE_DATA *privateData; /* pointer to the framework private data */ + /* only used by the framework */ + char name[PFW_MAX_NAME_LENGTH]; /* name */ + PFW_OBJ *pfwObj; /* pointer to the framework object */ + unsigned int profileDataSize; /* size of the configuration data */ + unsigned int stackDataSize; /* size of the stack data */ + STATUS (*profileDataConstruct) /* called to initialize the profile data */ + (PFW_OBJ *, /* which is allocated by the framework */ + void *profileData); + STATUS (*profileDataCopy) /* called to copy profile data, arguments*/ + (PFW_OBJ *, void *src, /* are framework object, and source and */ + void *dst); /* destination profile pointers */ + STATUS (*profileDataDestruct) /* called before the profile data is */ + (PFW_OBJ *, /* freed by the framework */ + void *profileData); + STATUS (*stackDataConstruct) /* called to initialize the stack data */ + (PFW_OBJ *, /* which is allocated by the framework. */ + void *stackData, /* Stack and profile data pointers are */ + void *profileData); /* are passed to the routine */ + STATUS (*stackDataDestruct) /* called before stack data is freed by */ + (PFW_OBJ *, /* the framework. Arguments are pointers */ + void *stackData, /* to framework object, stack and profile*/ + void *profileData); /* data */ + STATUS (*interfaceBind) /* plugin objects bind to their */ + (PFW_PLUGIN_OBJ *); /* interfaces within this routine which */ + /* is called by the framework only */ + STATUS (*stackAdd) /* called when a stack is added to the */ + (PFW_PLUGIN_OBJ_STATE *, /* framework. Layer plugin objects are */ + PFW_PLUGIN_OBJ_CALLBACKS *); /* responsible for calling stackAdd */ + /* routines of their components within */ + /* this routine */ + STATUS (*stackDelete) /* called while a stack is deleted. */ + (PFW_PLUGIN_OBJ_STATE *); /* Layer plugin objects are responsible */ + /* for calling stackDelete routine of */ + /* their components within this routine */ + STATUS (*receive) /* entry point for packets received from */ + (PFW_PLUGIN_OBJ_STATE *, /* the network */ + M_BLK_ID *); + STATUS (*send) /* entry point for packets to be sent to */ + (PFW_PLUGIN_OBJ_STATE *, /* the network */ + M_BLK_ID *); + STATUS (*stackDataShow) /* called to print the stack data of the */ + (PFW_PLUGIN_OBJ_STATE *); /* object for debuging purpose */ + }; + +/* function declarations */ + +extern PFW_OBJ *pfwCreate(char *name, + unsigned int controlJobQueueSize, + unsigned int dataJobQueueSize, + unsigned int controlTaskPriority, + unsigned int dataTaskPriority, + NET_POOL_ID netPoolId, + PART_ID partId); +extern STATUS pfwDelete(PFW_OBJ *pfwObj); +extern STATUS pfwSend (PFW_PLUGIN_OBJ_STATE *state, + M_BLK_ID packet); +extern STATUS pfwReceive (PFW_PLUGIN_OBJ_STATE + *state, M_BLK_ID packet); +extern STATUS pfwControlJobAdd (PFW_OBJ *pfwObj, + PFW_FUNC pfwFunc, void *data, + int size); +extern STATUS pfwDataJobAdd (PFW_OBJ *pfwObj, PFW_FUNC pfwFunc, + void *data, int size); +extern PFW_OBJ *pfwObjGet (char *name); +extern PFW_ID pfwIdGet (PFW_OBJ *pfwObj); +extern PFW_PLUGIN_OBJ *pfwPluginObjGet (PFW_OBJ *pfwObj, char *name); +extern NET_POOL_ID pfwNetPoolIdGet (PFW_OBJ *pfwObj); +extern void pfwPrintError (char *file, char *function, + int line, PFW_OBJ *pfwObj, + PFW_STACK_OBJ *stackObj, + char *diagnose); +extern STATUS pfwListShow (void); +extern STATUS pfwShow (PFW_OBJ *pfwObj); +extern void pfwInit(); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpfwh */ + diff --git a/h/pfw/pfwComponent.h b/h/pfw/pfwComponent.h new file mode 100644 index 0000000..625dac9 --- /dev/null +++ b/h/pfw/pfwComponent.h @@ -0,0 +1,56 @@ +/* pwfComponent.h - protocol framework component header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,30oct99,koz Added component object get by protocol routine +01b,15sep99,koz Added component delete interface +01a,16aug99,koz Converted to a framework file +*/ + +#ifndef __INCpwfComponenth +#define __INCpwfComponenth + +#ifdef __cplusplus +extern "C" { +#endif + +#include "pfw/pfw.h" + +/* typedefs */ + +/* + * The protocol framework is based on independent plugin objects. A component + * object is a type of plugin object. The data structure for a component + * object is defined below. + */ + +typedef struct pfwComponentObj + { + PFW_PLUGIN_OBJ pluginObj; /* generic plugin object */ + struct pfwLayerObj *layerObj;/* pointer to the layer obj of the component */ + unsigned int protocol; /* RFC 1700 defined protocol id */ + unsigned int sequence; /* set and used by the layer to indicate */ + /* in which order the component is to be */ + /* traversed within the layer */ + } PFW_COMPONENT_OBJ; + +/* function declarations */ + +extern STATUS pfwComponentAdd (PFW_COMPONENT_OBJ *componentObj); +extern STATUS pfwComponentDelete (PFW_COMPONENT_OBJ *componentObj); +extern PFW_COMPONENT_OBJ *pfwComponentObjGetByName (PFW_OBJ *pfwObj, + char *name); +extern PFW_COMPONENT_OBJ *pfwComponentObjGetByProtocol (PFW_OBJ *pfwObj, + unsigned int protocol); +extern STATUS pfwComponentListShow (PFW_OBJ *pfwObj); +extern STATUS pfwComponentShow (PFW_COMPONENT_OBJ *componentObj); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpwfComponenth */ + diff --git a/h/pfw/pfwEvent.h b/h/pfw/pfwEvent.h new file mode 100644 index 0000000..b19b7e4 --- /dev/null +++ b/h/pfw/pfwEvent.h @@ -0,0 +1,49 @@ +/* pfwEvent.h - Protocol framework event manager header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,31oct99,koz Added show routine +01c,19sep99,koz Added the pfwEventStackSubscribe routine +01b,08sep99,koz Changed interfaces +01a,16aug99,koz written +*/ + +#ifndef __INCpfwEventh +#define __INCpfwEventh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "pfw/pfw.h" + +/* typedefs */ + +typedef struct pfwEventObj PFW_EVENT_OBJ; +typedef STATUS (*PFW_EVENT_HANDLER) (PFW_PLUGIN_OBJ_STATE *, void *eventData); + +/* function declarations */ + +extern PFW_EVENT_OBJ *pfwEventPublish (PFW_OBJ *pfwObj, char *name); +extern STATUS pfwEventSubscribe (PFW_PLUGIN_OBJ *pluginObj, + char * eventName, + PFW_EVENT_HANDLER eventHandler); +extern STATUS pfwEventUnsubscribe (PFW_PLUGIN_OBJ *pluginObj, + PFW_EVENT_OBJ *eventObj); +extern STATUS pfwEventStackSubscribe (PFW_PLUGIN_OBJ_STATE *state, + PFW_EVENT_OBJ *eventObj, + PFW_EVENT_HANDLER eventHandler); +extern PFW_EVENT_OBJ *pfwEventObjGet (PFW_OBJ *pfwObj, char *name); +extern STATUS pfwEventRaise (PFW_STACK_OBJ *stackObj, + PFW_EVENT_OBJ *eventObj, void *eventData); +extern STATUS pfwEventListShow (PFW_OBJ *pfwObj); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpfwEventh */ + diff --git a/h/pfw/pfwInterface.h b/h/pfw/pfwInterface.h new file mode 100644 index 0000000..d3ce519 --- /dev/null +++ b/h/pfw/pfwInterface.h @@ -0,0 +1,72 @@ +/* pfwInterface.h - Protocol framework interface manager header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,04nov99,koz Changed pfwInterfaceObjGetNext function parameter +*/ + +#ifndef __INCpfwInterfaceh +#define __INCpfwInterfaceh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "dllLib.h" +#include "pfw/pfw.h" + +/* defines */ + +#define PFW_MAX_INTERFACE_NAME_LENGTH 64 + +/* typedefs */ + +/* + * All user defined interface objects must embedd the following structure as + * the first member. + */ +typedef struct pfwInterfaceObj + { + DL_NODE node; /* how framework keeps this in a list */ + unsigned int id; /* interface id */ + PFW_PLUGIN_OBJ* pluginObj; /* pointer to the owner plugin object */ + } PFW_INTERFACE_OBJ; + + +typedef struct pfwInterfaceStatePair + { + PFW_INTERFACE_OBJ *interfaceObj; + PFW_PLUGIN_OBJ_STATE *state; + } PFW_INTERFACE_STATE_PAIR; + +/* function declarations */ + +extern unsigned int pfwInterfaceRegister (PFW_OBJ *pfwObj, char *name); +extern unsigned int pfwInterfaceIdGet (PFW_OBJ *pfwObj, char *name); +extern STATUS pfwInterfaceBind (PFW_INTERFACE_OBJ *interfaceObj); +extern PFW_INTERFACE_OBJ *pfwInterfaceObjGetViaPluginObj + (PFW_PLUGIN_OBJ *pluginObj, + unsigned int interfaceId); +extern STATUS pfwInterfaceObjAndStateGetViaStackObj + (PFW_STACK_OBJ *stackObj, + unsigned int interfaceId, + PFW_INTERFACE_STATE_PAIR *result); +extern PFW_INTERFACE_OBJ *pfwInterfaceObjGetViaPfwObj + (PFW_OBJ *pfwObj, unsigned int interfaceId); +extern PFW_INTERFACE_OBJ *pfwInterfaceObjGetNext (PFW_INTERFACE_OBJ *); +extern STATUS pfwInterfaceReferenceAdd + (PFW_INTERFACE_OBJ *interfaceObj); +extern STATUS pfwInterfaceReferenceDelete + (PFW_INTERFACE_OBJ *interfaceObj); +extern STATUS pfwInterfaceListShow (PFW_OBJ *pfwObj); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpfwInterfaceh */ + diff --git a/h/pfw/pfwLayer.h b/h/pfw/pfwLayer.h new file mode 100644 index 0000000..62184d0 --- /dev/null +++ b/h/pfw/pfwLayer.h @@ -0,0 +1,89 @@ +/* pfwLayer.h - Protocol framework layer header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,13oct99,koz Changed the routines related to adding/removing components to + stack +01e,21sep99,koz Added new interfaces (componentStackAddDone, + componentStackDeleteDone and componentDelete) +01d,15sep99,koz Added layer delete interface +01c,24aug99,sj changed prototypes for nextComponentStateGet and + firstComponentStateGet +01b,16aug99,koz Converted to a framework file +01a,23jul99,koz written +*/ + +#ifndef __INCpfwLayerh +#define __INCpfwLayerh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "pfw/pfw.h" +#include "pfw/pfwComponent.h" + +typedef enum pfwLayerType + { + NON_OPERATIONAL_LAYER, + OPERATIONAL_LAYER + } PFW_LAYER_TYPE; + +typedef enum pfwPacketType + { + DATA_PACKET, + CONTROL_PACKET + } PFW_PACKET_TYPE; + +/* + * Each layer is represented by a layer object. The data structure for a + * layer object is defined below. + */ + +typedef struct pfwLayerObj + { + PFW_PLUGIN_OBJ pluginObj; + unsigned int planeId; /* plane id in which the layer is */ + unsigned int position; /* layer position in the plane (nth layer) */ + PFW_LAYER_TYPE type; /* operational or non-operational */ + PFW_PACKET_TYPE (*packetType) /* if layer perform demuxing packets */ + (void *); /* to control and user planes then this */ + /* function returns the packet type */ + STATUS (*componentAdd) /* called when a component is added to */ + (PFW_COMPONENT_OBJ *); /* the framework */ + STATUS (*componentDelete) /* called when a component is deleted from */ + (PFW_COMPONENT_OBJ *); /* the framework */ + STATUS (*addDynamicComponentToStack) /* called to dynamically add a */ + (PFW_PLUGIN_OBJ_STATE *, /* componet to a stack instance if the */ + PFW_PLUGIN_OBJ_STATE *);/* layer has been already added to the */ + /* stack instance. Arguments are states */ + /* of the layer and component */ + STATUS (*deleteDynamicComponentFromStack) /* called to dynamically delete*/ + (PFW_PLUGIN_OBJ_STATE *, /* a component from a stack instance */ + PFW_PLUGIN_OBJ_STATE *);/* before the layer is deleted from the */ + /* stack instance. Arguments are states */ + /* of the layer and component */ + } PFW_LAYER_OBJ; + + +/* function declarations */ + +extern STATUS pfwLayerAdd (PFW_LAYER_OBJ *layerObj); +extern STATUS pfwLayerDelete (PFW_LAYER_OBJ *layerObj); +extern PFW_LAYER_OBJ *pfwLayerObjGet (PFW_OBJ * pfwObj, char *name); +extern PFW_PLUGIN_OBJ_STATE *pfwFirstComponentStateGet ( PFW_PLUGIN_OBJ_STATE + *layerState); +extern PFW_PLUGIN_OBJ_STATE *pfwNextComponentStateGet ( PFW_PLUGIN_OBJ_STATE + *layerState); +extern STATUS pfwLayerListShow (PFW_OBJ *pfwObj); +extern STATUS pfwLayerShow (PFW_LAYER_OBJ *layerObj); +#ifdef __cplusplus +} +#endif + +#endif /* __INCpfwLayerh */ + + diff --git a/h/pfw/pfwMemory.h b/h/pfw/pfwMemory.h new file mode 100644 index 0000000..d6798af --- /dev/null +++ b/h/pfw/pfwMemory.h @@ -0,0 +1,29 @@ +/* pwfMemory.h - Protocol framework memory manager header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,30oct99,koz Included pfw.h +01a,20sep99,koz written +*/ + +#ifndef __INCpwfMemoryh +#define __INCpwfMemoryh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "pfw/pfw.h" + +extern void *pfwMalloc (PFW_OBJ *pfwObj, unsigned int size); +extern STATUS pfwFree (void *p); +extern STATUS pfwMemoryShow (PFW_OBJ *pfwObj); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpwfMemoryh */ diff --git a/h/pfw/pfwProfile.h b/h/pfw/pfwProfile.h new file mode 100644 index 0000000..885192d --- /dev/null +++ b/h/pfw/pfwProfile.h @@ -0,0 +1,67 @@ +/* pfwProfile.h - Protocol framework profile header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,29sep00,sj merging with TOR2_0-WINDNET_PPP-CUM_PATCH_2 +01e,03aug00,sj merge with openstack to bring in prototypes +01d,08jul00,bsn merged from the PPP radius-ras branch +01c,19may00,qli added utility functions for set/get stack specific parameters +01b,27oct99,koz Added MAX_VALUE_STRING_LENGTH +01a,15sep99,sj brought in pfwParameterAdd and associated definitions from pfw.h +*/ + +#ifndef __INCpfwProfileh +#define __INCpfwProfileh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "pfw/pfw.h" + +/* defines */ + +#define MAX_VALUE_STRING_LENGTH 512 + +/* typedefs */ + +typedef STATUS (*PFW_PARAMETER_HANDLER) (PFW_OBJ *pfwObj, + PFW_PARAMETER_OPERATION_TYPE, + void *, char *); + +/* function declarations */ + +extern PFW_PROFILE_OBJ *pfwBaseProfileCreate (PFW_OBJ *pfwObj, + char *profileName, char *fileName); +extern PFW_PROFILE_OBJ *pfwProfileCreate (char *profileName, + PFW_PROFILE_OBJ *baseProfileObj, + char *fileName); +extern STATUS pfwProfileDelete (PFW_PROFILE_OBJ *profileObj); +extern PFW_PROFILE_OBJ *pfwProfileObjGet (PFW_OBJ *pfwObj, char *name); +extern STATUS pfwProfileSet (PFW_PROFILE_OBJ *profileObj, + unsigned int parameterId, char *value); +extern STATUS pfwParameterAdd (PFW_PLUGIN_OBJ *owner, + char *parameterName, + PFW_PARAMETER_HANDLER); +extern unsigned int pfwParameterIdGet (PFW_OBJ *pfwObj, char *name); +extern PFW_OBJ *pfwProfilePfwObjGet (PFW_PROFILE_OBJ *profileObj); +extern STATUS pfwProfileListShow (PFW_OBJ *pfwObj); +extern STATUS pfwParameterListShow (PFW_OBJ *pfwObj); +extern STATUS pfwProfileShow (PFW_PROFILE_OBJ *profileObj); + +extern STATUS pfwStackParamSet(PFW_STACK_OBJ *stackObj, + unsigned int parameterId, + char *value); +extern STATUS pfwStackParamGet(PFW_STACK_OBJ *stackObj, + unsigned int parameterId, + char *value); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpfwProfileh */ + diff --git a/h/pfw/pfwStack.h b/h/pfw/pfwStack.h new file mode 100644 index 0000000..e506e3e --- /dev/null +++ b/h/pfw/pfwStack.h @@ -0,0 +1,100 @@ +/* pfwStack.h - Protocol framework stack header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,15feb00,sj added pfwPluginObjStateLock() +01f,17nov99,koz Changed the return type of the pfwPluginObjStateRelease + routine to STATUS +01e,06nov99,sj changed pfwPluginObjectStateRelease to pfwPluginObjStateRelease +01d,11oct99,koz Made callback fuction expilicit in asynchronous function + signitures +01c,16sep99,sj brought in pfwStackAdd(Delete)Done from private file +01b,26aug99,sj added pfwStackObjPfwGet() pfwLayerStateGet and pfwStackShow +01a,xxxxxxx,koz created +*/ + +#ifndef __INCpfwStackh +#define __INCpfwStackh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "pfw/pfw.h" +#include "pfw/pfwProfile.h" + +/* typedefs */ + +typedef unsigned int PFW_STACK_ID; +typedef enum pfwStackStatus + { + PFW_STACK_ADD_IN_PROGRESS, + PFW_STACK_READY, + PFW_STACK_DELETE_IN_PROGRESS + } PFW_STACK_STATUS; + +/* + * The framework provides asynchronous functions for adding and deleting + * stack instances. The following defines the callback functions for these + * operations. The stack object accepts callback functions in the signiture of + * pfwStackAdd function. + */ + +typedef struct pfwStackObjCallbacks PFW_STACK_OBJ_CALLBACKS; + +struct pfwStackObjCallbacks + { + void (*stackAddComplete) /* called by a stack object to inform */ + (void *userHandle, /* stack add processing is completed */ + PFW_STACK_OBJ *); + void (*stackDeleteComplete) /* called by a stack object to inform */ + (void *userHandle, /* stack delete processing is completed*/ + PFW_STACK_OBJ *); + void (*stackAddError) /* called by a stack object to inform */ + (void *userHandle, /* an error occurred during stack add */ + PFW_STACK_OBJ *); + void (*stackDeleteError) /* called by a stack object to inform */ + (void *userHandle, /* an error occurred during stack delete */ + PFW_STACK_OBJ *); + }; + + +/* function declarations */ + +extern PFW_STACK_OBJ* pfwStackAdd (PFW_PROFILE_OBJ *profileObj, + PFW_STACK_OBJ_CALLBACKS *callbacks, + void *userHandle); +extern STATUS pfwStackDelete (PFW_STACK_OBJ *stackObj); +extern void pfwStackDestroy (PFW_STACK_OBJ *stackObj); +extern PFW_STACK_ID pfwStackIdGet (PFW_STACK_OBJ *stackObj); +extern PFW_STACK_OBJ* pfwStackObjGet (PFW_OBJ *pfw, PFW_STACK_ID stackId); +extern STATUS pfwStackPluginObjAdd (PFW_STACK_OBJ *stackObj, + PFW_PLUGIN_OBJ *pluginObj); +extern STATUS pfwStackPluginObjDelete (PFW_STACK_OBJ *stackObj, + PFW_PLUGIN_OBJ *pluginObj); +extern PFW_PLUGIN_OBJ_STATE + *pfwPluginObjStateGet (PFW_STACK_OBJ *stackObj, + PFW_PLUGIN_OBJ *pluginObj); +extern PFW_PLUGIN_OBJ_STATE + *pfwPluginObjStateExclusiveGet (PFW_STACK_OBJ *stackObj, + PFW_PLUGIN_OBJ *pluginObj); +extern STATUS pfwPluginObjStateLock (PFW_PLUGIN_OBJ_STATE *state); +extern STATUS pfwPluginObjStateRelease (PFW_PLUGIN_OBJ_STATE *state); + +extern PFW_PLUGIN_OBJ_STATE + *pfwLayerStateGet(PFW_PLUGIN_OBJ_STATE *compState); +extern PFW_OBJ *pfwStackObjPfwGet (PFW_STACK_OBJ *pfwStackObj); +extern STATUS pfwStackStatusGet (PFW_STACK_OBJ *stackObj, + PFW_STACK_STATUS *status); +extern STATUS pfwStackListShow (PFW_OBJ *pfwObj); +extern STATUS pfwStackShow (PFW_STACK_OBJ *pfwStackObj); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpfwStackh */ + diff --git a/h/pfw/pfwTable.h b/h/pfw/pfwTable.h new file mode 100644 index 0000000..fe8e456 --- /dev/null +++ b/h/pfw/pfwTable.h @@ -0,0 +1,52 @@ +/* pwfTable.h - Table header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,17oct99,koz Remove table object structure declaration +01c,31aug99,koz Removed table macros +01b,16aug99,koz Converted to a framework file +01a,02aug99,koz Added add and delete interfaces. +*/ + +#ifndef __INCpwfTableh +#define __INCpwfTableh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "pfw/pfw.h" + + +/* typedefs */ + +typedef BOOL (*PFW_TABLE_FUNC) (unsigned int key, void *tableItem, void *arg); + +typedef struct pfwTableObj PFW_TABLE_OBJ; + +extern PFW_TABLE_OBJ *pfwTableCreate (PFW_OBJ *pfwObj, unsigned int initialSize, + int maxSize); +extern STATUS pfwTableDelete (PFW_TABLE_OBJ *tableObj); +extern unsigned int pfwTableItemAdd (PFW_TABLE_OBJ *tableObj, void *item); +extern void *pfwTableItemDelete (PFW_TABLE_OBJ *tableObj, + unsigned int key); +extern void *pfwTableItemGet (PFW_TABLE_OBJ *tableObj, + unsigned int key); +extern unsigned int pfwTableTraverse (PFW_TABLE_OBJ *tableObj, + PFW_TABLE_FUNC tableFunc, void *arg); +extern unsigned int pfwTableItemInsertAfter (PFW_TABLE_OBJ *tableObj, + void *item, unsigned int key); +extern unsigned int pfwTableItemInsertBefore (PFW_TABLE_OBJ *tableObj, + void *item, unsigned int key); +extern unsigned int pfwTableItemCountGet (PFW_TABLE_OBJ *tableObj); + +extern STATUS pfwTableShow (PFW_TABLE_OBJ *pfwTableObj); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpwfTableh */ diff --git a/h/pfw/pfwTimer.h b/h/pfw/pfwTimer.h new file mode 100644 index 0000000..dc9199a --- /dev/null +++ b/h/pfw/pfwTimer.h @@ -0,0 +1,67 @@ +/* pfwTimer.h - pfwTimer header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,16nov99,koz Corrected some spelling mistakes +01c,15oct99,koz Added duration field to PFW_TIME_STAMP +01b,16sep99,koz Added time stamp interface +01a,16aug99,koz written +*/ + +#ifndef __INCpfwTimerh +#define __INCpfwTimerh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "pfw/pfw.h" + +/* define */ + +#define PFW_TIME_UNIT_NUM 3 + +/* typedefs */ + +typedef struct + { + ULONG start; /* the system clock tick value when a time stamp starts */ + ULONG duration; /* duration of time stamp in system clock ticks */ + } PFW_TIME_STAMP; + +typedef enum pfwTimeUnit + { + PFW_100_MILLISECOND, + PFW_SECOND, + PFW_MINUTE + } PFW_TIME_UNIT; + +typedef STATUS (*PFW_TIMER_HANDLER) (PFW_PLUGIN_OBJ_STATE *, int); + +typedef struct pfwTimerObj PFW_TIMER_OBJ; + +/* function declarations */ + +extern PFW_TIMER_OBJ *pfwTimerCreate (PFW_PLUGIN_OBJ_STATE *state); +extern STATUS pfwTimerDelete (PFW_TIMER_OBJ *timerObj); +extern STATUS pfwTimerStart (PFW_TIMER_OBJ *timerObj, + PFW_TIME_UNIT timeUnit, + unsigned int timeoutValue, + PFW_TIMER_HANDLER timerHandler, int arg); +extern STATUS pfwTimerCancel (PFW_TIMER_OBJ* timerObj); +extern STATUS pfwTimeStampStart (PFW_OBJ *pfwObj, + PFW_TIME_STAMP *timeStamp, + PFW_TIME_UNIT timeUnit, + unsigned int duration); +extern BOOL pfwTimeStampExpired (PFW_TIME_STAMP *timeStamp); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpfwTimerh */ + + diff --git a/h/pingLib.h b/h/pingLib.h new file mode 100644 index 0000000..2919ec8 --- /dev/null +++ b/h/pingLib.h @@ -0,0 +1,102 @@ +/* pingLib.h - Packet InterNet Groper (PING) library header */ + +/* Copyright 1994 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,12mar02,rae Print stats when task killed (SPR #73570) +01c,10oct01,rae merge from truestack ver 01e, base 01a (SPR 67440) +01b,30oct00,gnn Added PING_OPT_NOHOST flag to deal with SPR 22766 +01a,25oct94,dzb written. +*/ + +#ifndef __INCpingLibh +#define __INCpingLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vwModNum.h" +#include "hostLib.h" +#include "inetLib.h" +#include "semLib.h" +#include "wdLib.h" + +/* defines */ + +#define PING_MAXPACKET 4096 /* max packet size */ +#define PING_MINPACKET 12 /* min packet size */ +#define PING_INTERVAL 1 /* default packet interval in seconds */ +#define PING_TMO 5 /* default packet timeout in seconds */ +#define ICMP_PROTO 1 /* icmp socket proto id */ +#define ICMP_TYPENUM 20 /* icmp proto type identifier */ +#define PING_TASK_NAME_LEN 20 /* max ping Tx task name length */ + +/* status codes */ + +#define S_pingLib_NOT_INITIALIZED (M_pingLib | 1) +#define S_pingLib_TIMEOUT (M_pingLib | 2) + +/* flags */ + +#define PING_OPT_SILENT 0x1 /* work silently */ +#define PING_OPT_DONTROUTE 0x2 /* dont route option */ +#define PING_OPT_DEBUG 0x4 /* print debugging messages */ +#define PING_OPT_NOHOST 0x8 /* dont do host lookup */ + +/* typedefs */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct pingStat /* PING_STAT */ + { + struct pingStat * statNext; /* next struct in list */ + int pingFd; /* socket file descriptor */ + char toHostName [MAXHOSTNAMELEN + 2];/* name to ping - PAD */ + char toInetName [INET_ADDR_LEN];/* IP addr to ping */ + u_char bufTx [PING_MAXPACKET]; /* transmit buffer */ + u_char bufRx [PING_MAXPACKET]; /* receive buffer */ + struct icmp * pBufIcmp; /* ptr to icmp */ + ulong_t * pBufTime; /* ptr to time */ + int dataLen; /* size of data portion */ + int numPacket; /* total # of packets to send */ + int numTx; /* number of packets sent */ + int numRx; /* number of packets received */ + int idRx; /* id of Rx task */ + int clkTick; /* sys clock ticks per second */ + int tMin; /* min RT time (ms) */ + int tMax; /* max RT time (ms) */ + int tSum; /* sum of all times */ + int flags; /* option flags */ + int vsid; /* virtual stack being used */ + } PING_STAT; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* forward declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS pingLibInit (void); +extern STATUS ping (char *host, int numPackets, ulong_t options); + +#else /* __STDC__ */ + +extern STATUS pingLibInit (); +extern STATUS ping (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpingLibh */ diff --git a/h/pipeDrv.h b/h/pipeDrv.h new file mode 100644 index 0000000..747be27 --- /dev/null +++ b/h/pipeDrv.h @@ -0,0 +1,37 @@ +/* pipeDrv.h - header file for pipeDrv.c */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,03nov03,dat adding const to char arguments, remove old decl's +01f,05oct01,dcb Fix SPR 9434. Add pipeDevDelete() call. Code merged back + from the AE tree (created for AE under SPR 26204). +01e,22sep92,rrr added support for c++ +01d,04jul92,jcf cleaned up. +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01a,05oct90,shl created. +*/ + +#ifndef __INCpipeDrvh +#define __INCpipeDrvh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +extern STATUS pipeDevCreate (const char *name, int nMessages, int nBytes); +extern STATUS pipeDevDelete (const char *name, BOOL force); +extern STATUS pipeDrv (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpipeDrvh */ diff --git a/h/pmLib.h b/h/pmLib.h new file mode 100644 index 0000000..66f7fba --- /dev/null +++ b/h/pmLib.h @@ -0,0 +1,106 @@ +/* pmLib.h - persistent heap */ + +/* Copyright 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,14may04,md track size of arena in header +01h,05aug03,dbs allow more than one PM arena +01g,04aug03,dbs ensure pmLib has no globals +01f,29jul03,dbs re-introduce idea of 'closing' a region +01e,29jul03,dbs remove pmRegionDelete API, add pmInvalidate +01d,18jul03,dbs remove hard-coded limit on number of regions +01c,15jul03,dbs increase size of key string +01b,14jul03,dbs rename phpLib to pmLib +01a,11jul03,dbs add phpFreeSpace API +000,28oct02, md written, initial version +*/ + +#ifndef __INCpmLib_h +#define __INCpmLib_h + +#ifdef __cplusplus +extern "C" { +#endif + +/* general settings */ + +/* maximum number of regions available */ +#define PM_MAX_REGIONS 64 + +/* magic number of persistent heap */ +#define PM_MAGIC ((int) 0xBEEFBABE) + +/* max length of key string */ +#define PM_KEY_LEN 20 + +/* open region with 'read' enabled */ +#define PM_PROT_RDONLY 0 + +/* open region with 'read' and 'write' enabled */ +#define PM_PROT_RDWR 1 + +/* types */ + +typedef void* (*PM_ARENA_DEF) (UINT32*); + +/* PM region header. + * + * Each distinct region in the PM has a header at it start, with a + * short human-readable 'key' and some housekeeping data. It is 16 + * bytes long, including the checksum field. + */ +typedef struct pm_region + { + int magic; /* magic number */ + int offset; /* offset of data block */ + int size; /* size of data block */ + char key [PM_KEY_LEN]; /* textual key */ + } PM_REGION; + +/* Persistent memory block header + * + * One of these exists at the start of the memory region which is + * owned and managed by pmLib. + */ +typedef struct pm_arena + { + int checksum; /* header checksum */ + struct + { + int magic; /* magic number */ + void *raddr; /* real address of memory */ + void *vaddr; /* aliased virtual address */ + int arena_size; /* total size of arena in bytes */ + int data_size; /* total size of block in bytes */ + int next_free_offset; /* next free offset */ + int max_region; /* max number of allocated regions */ + PM_REGION region [1]; /* extensible array of regions */ + } field; + } PM_ARENA; + +/* function declarations */ + +extern STATUS pmLibInit (void); + +extern void* pmDefaultArena (UINT32*); + +extern STATUS pmInit (PM_ARENA_DEF arena); +extern int pmFreeSpace (PM_ARENA_DEF arena); +extern int pmRegionCreate (PM_ARENA_DEF arena, const char *key, unsigned int size, int mode); +extern int pmRegionOpen (PM_ARENA_DEF arena, const char *key); +extern void * pmRegionAddr (PM_ARENA_DEF arena, int region); +extern int pmRegionSize (PM_ARENA_DEF arena, int region); +extern STATUS pmRegionProtect (PM_ARENA_DEF arena, int region, int mode); +extern STATUS pmRegionClose (PM_ARENA_DEF arena, int region); +extern STATUS pmInvalidate (PM_ARENA_DEF arena); +extern STATUS pmValidate (PM_ARENA_DEF arena); +extern STATUS pmInvalidate (PM_ARENA_DEF arena); +extern STATUS pmShow (PM_ARENA_DEF arena); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpmLib_h */ diff --git a/h/poolLib.h b/h/poolLib.h new file mode 100644 index 0000000..f3e6d73 --- /dev/null +++ b/h/poolLib.h @@ -0,0 +1,82 @@ +/* poolLib.h - header file for Wind Memory Pools */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,18feb04,dat moved POOL struct to private header +01c,19aug03,zl added alignment support, create options to poolLib. +01b,03nov98,mas added use of "#ifndef _ASMLANGUAGE". +01a,22feb98,dat, original version. TOR 1.0.1/VXW 5.3 compatible. + mas,tm +*/ + +/* +DESCRIPTION +This file contains the public configuration parameters for the Wind Memory Pool +library. +*/ + +#ifndef __INCpoolLibh +#define __INCpoolLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes */ + +#include "vwModNum.h" +#include "memPartLib.h" + + +/* Defines/Macros */ + +/* status codes */ + +#define S_poolLib_ARG_NOT_VALID (M_poolLib | 1) /* invalid input arg */ +#define S_poolLib_INVALID_POOL_ID (M_poolLib | 2) /* invalid pool ID */ +#define S_poolLib_NOT_POOL_ITEM (M_poolLib | 3) /* unrecognized item */ +#define S_poolLib_UNUSED_ITEM (M_poolLib | 4) /* unused item */ +#define S_poolLib_POOL_IN_USE (M_poolLib | 5) /* can't delete pool */ +#define S_poolLib_STATIC_POOL_EMPTY (M_poolLib | 6) /* empty static pool */ +#define S_poolLib_INVALID_BLK_ADDR (M_poolLib | 7) /* invalid block addr */ +#define S_poolLib_BLOCK_TOO_SMALL (M_poolLib | 8) /* block too small */ +#define S_poolLib_INT_CTX_POOL_EMPTY (M_poolLib | 9) /* pool empty in ISR */ + +/* Pool option bits */ + +#define POOL_THREAD_SAFE 1 /* enable multi-task protection */ +#define POOL_CHECK_ITEM 2 /* enable item check on return */ + + +#ifndef _ASMLANGUAGE + +/* Typedefs */ + +typedef struct pool * POOL_ID; + +/* Public function prototypes */ + +POOL_ID poolCreate (const char * pName, ULONG itmSize, ULONG alignemnt, + ULONG initCnt, ULONG incrCnt, PART_ID partId, + ULONG options); +STATUS poolDelete (POOL_ID poolId, BOOL force); +void * poolItemGet (POOL_ID poolID); +STATUS poolItemReturn (POOL_ID poolID, void *pItem); +STATUS poolUnusedBlocksFree (POOL_ID poolId); +ULONG poolTotalCount (POOL_ID poolId); +ULONG poolFreeCount (POOL_ID poolId); +STATUS poolIncrementSet (POOL_ID poolId, ULONG incrCnt); +ULONG poolIncrementGet (POOL_ID poolId); +ULONG poolBlockAdd (POOL_ID poolId, void * pBlock, ULONG size); +int poolIdListGet (POOL_ID * poolIdList, int listSize); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpoolLibh */ diff --git a/h/posixName.h b/h/posixName.h new file mode 100644 index 0000000..2723bd8 --- /dev/null +++ b/h/posixName.h @@ -0,0 +1,41 @@ +/* posixName.h - posix table synchronisation */ + +/* Copyright 1984-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,13dec93,dvs changed prototype to match that in posixNameLib.c +01a,06apr93,smb written +*/ + +#ifndef __INCposixNameh +#define __INCposixNameh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "symLib.h" + +/* Defines */ + +#define POSIX_TBL_HASH_SIZE_LOG2 6 /* 64 entry hash table for status */ + +/* Function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +SYMTAB_ID posixNameTblInit (int PosixTblHashSize); + +#else /* __STDC__ */ + +SYMTAB_ID posixNameTblInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCposixNameh*/ diff --git a/h/posixShow.h b/h/posixShow.h new file mode 100644 index 0000000..c559987 --- /dev/null +++ b/h/posixShow.h @@ -0,0 +1,41 @@ +/* posixShow.h - posix show routines */ + +/* Copyright 1984-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,06apr93,smb written +*/ + +#ifndef __INCposixshowh +#define __INCposixshowh + +#include "semaphore.h" +#include "mqueue.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern CLASS_ID mqClassId; + +/* Function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +STATUS semaphoreShow (sem_t * semDesc, int level); +STATUS mqShow (mqd_t mqDesc, int level); + +#else /* __STDC__ */ + +STATUS semaphoreShow (); +STATUS mqShow (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCposixshowh*/ diff --git a/h/ppp/bacpInterfaces.h b/h/ppp/bacpInterfaces.h new file mode 100644 index 0000000..d7fb90a --- /dev/null +++ b/h/ppp/bacpInterfaces.h @@ -0,0 +1,101 @@ +/* bacpInterfaces.h - BACP user interfaces for BAP Calls */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +02a,05nov01,as extra parameter memberStackObj has been added to bacp up call + funtion pointer (*PPP_BACP_UPCALL) +01a,05feb01,as created +*/ + +/* +#include "ppp/kstart.h" +#include "ppp/kppp.h" +#include "pfw/pfw.h" +*/ +#ifndef __INCbacpInterfacesh +#define __INCbacpInterfacesh + +#ifdef __cplusplus +extern "C" { +#endif + +/* typedefs */ + +typedef BYTE (*PPP_BACP_UPCALL) + ( + PFW_STACK_OBJ *managerStackObj, + USHORT event, + USHORT port, + PFW_STACK_OBJ *memberStackObj, + BYTE responseCode, + char ** reason + ); + +enum BACP_EVENT_UPCALL +{ + BACP_EVENT_THIS_LAYER_START, + BACP_EVENT_THIS_LAYER_UP, + BACP_EVENT_THIS_LAYER_DOWN, + BACP_EVENT_THIS_LAYER_FINISHED, + BAP_EVENT_CALL_REQUEST_STATUS, + BAP_EVENT_CALL_REQUEST_RECEIVED, + BAP_EVENT_DROP_QUERY_REQUEST, + BAP_EVENT_REQUEST_TIMEOUT, + BAP_EVENT_PORT_UP, + BAP_EVENT_PORT_DOWN, + BAP_EVENT_BODA_REQUEST_NOT_PROCESSED, + BAP_EVENT_REQUEST_FULL_NAK, + BAP_EVENT_BODA_PROCESS_REQUEST, + BACP_EVENT_OPTIONS_EXHAUSTED +}; + +typedef struct bacpUpcallFunctions + { + + PPP_BACP_UPCALL bacpUpCallFunction; + + }BACP_UPCALL_FUNCTIONS; + +extern STATUS bacpUpCallInit + ( + PFW_STACK_OBJ *managerStackObj, /* manager stack object */ + BACP_UPCALL_FUNCTIONS *upcallFuncPtr /* Function pointer of the */ + ); + +extern ULONG bapBundleCurrentBandwidthGet + ( + PFW_STACK_OBJ *managerStackObj /* manager stack object */ + ); + +extern STATUS bapBundleBandwidthAdd + ( + PFW_STACK_OBJ *managerStackObj, /* manager stack object */ + ULONG bandwidth, /* bandwidth to be added */ + char * ptr_reason_str, /* reason string */ + BYTE_ENUM(BAP_PACKET_TYPE) call_or_callback /* call or callback request */ + ); + +extern STATUS bapBundleBandwidthDelete + ( + PFW_STACK_OBJ *managerStackObj, /* manager stack object */ + ULONG bandwidth, /* bandwidth to be deleted */ + char * ptr_reason_str /* reason string */ + ); + +extern STATUS bapBundleBandwidthDrop + ( + PFW_STACK_OBJ *managerStackObj, /* manager stack object */ + ULONG bandwidth, /* bandwidth to be dropped */ + char * ptr_reason_str /* reason string */ + ); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCbacpInterfacesh */ diff --git a/h/ppp/interfaces/adapterComponentInterfaces.h b/h/ppp/interfaces/adapterComponentInterfaces.h new file mode 100644 index 0000000..f9e9e01 --- /dev/null +++ b/h/ppp/interfaces/adapterComponentInterfaces.h @@ -0,0 +1,116 @@ +/* adapterComponentInterfaces.h - generic interfaces for a adapter component */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01d,15jul02,emr This code was developed on the windnet_ppp2_0-ipv6 branch and + should have been developed on the windnet_ppp2_0 branch, so + this brings it into line. +01c,29sep00,sj merging with TOR2_0-WINDNET_PPP-CUM_PATCH_2 +01b,27jun00,bsn added STATISTICS and PORT interface +01a,01nov99,sj created +*/ + +#include "pfw/pfw.h" +#include "pfw/pfwInterface.h" + +#ifndef __INCadapterComponentInterfacesh +#define __INCadapterComponentInterfacesh + +#ifdef __cplusplus +extern "C" { +#endif + +/******************************************************************************* +* ADAPTER_DESTINATION_AND_PROTOCOL_SET_INTERFACE - +* +* Interface Name: "ADAPTER_DESTINATION_AND_PROTOCOL_SET_INTERFACE" +* +* This interface may be used by framing components to set the destination +* address and protocol type the adapter component must use when transmitting +* the frame +* +*/ +typedef struct ADAPTER_DESTINATION_AND_PROTOCOL_SET_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + STATUS (*destAddrAndProtocolSet) + ( + PFW_PLUGIN_OBJ_STATE *adapterState, + char * destAddr, + UINT32 addrLength, + char * protocol, + UINT32 protocolLength + ); + + } ADAPTER_DESTINATION_AND_PROTOCOL_SET_INTERFACE; + +/******************************************************************************* +* ADAPTER_COMPONENT_STATISTICS_INTERFACE - +* +* Interface Name: "ADAPTER_COMPONENT_STATISTICS_INTERFACE" +* +* This interface may be used by other components to get the adapter +* component statistics. +*/ +typedef struct ADAPTER_COMPONENT_STATISTICS_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + void (*statisticsGet) + ( + PFW_PLUGIN_OBJ_STATE *adapterState, + UINT * inputOctets, + UINT * outputOctets, + UINT * inputPackets, + UINT * outputPackets); + } ADAPTER_COMPONENT_STATISTICS_INTERFACE; + + +/******************************************************************************* +* PHY_PORT_INTERFACE - +* +* Interface Name: "PHY_PORT_INTERFACE" +* +* This interface may be used by other components to get the adapter +* component physical port properties. +*/ +typedef struct PHY_PORT_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + UINT (*portNumberGet) (PFW_PLUGIN_OBJ_STATE *adapterState); + UINT (*portTypeGet) (PFW_PLUGIN_OBJ_STATE *adapterState); + } PHY_PORT_INTERFACE; + +#define PORT_TYPE_ASYNC 0 +#define PORT_TYPE_SYNC 1 +#define PORT_TYPE_VIRTUAL 5 + +/******************************************************************************* +* ADAPTER_INFO_GET_INTERFACE - +* +* Interface Name: "ADAPTER_INFO_GET_INTERFACE" +* +* This interface will be used by PPPoE component to get the port identifier for +* a given stack. +* +*/ +typedef struct ADAPTER_INFO_GET_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + STATUS (*adapterPortIdGet) + ( + PFW_PLUGIN_OBJ_STATE * pAdapterState, + ULONG * pPortId + ); + + } ADAPTER_INFO_GET_INTERFACE; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCadapterComponentInterfacesh */ diff --git a/h/ppp/interfaces/authInfoInterface.h b/h/ppp/interfaces/authInfoInterface.h new file mode 100644 index 0000000..8b4cb3d --- /dev/null +++ b/h/ppp/interfaces/authInfoInterface.h @@ -0,0 +1,53 @@ +/* authInfoInterface.h - Authentication Information Interface */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,23feb01,ak created +*/ + +#ifndef __INCauthInfoInterfaceh +#define __INCauthInfoInterfaceh + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct AUTH_INFO_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + void (*localUserNameGet) + ( + PFW_PLUGIN_OBJ_STATE *pState, + char *pLocalUserName + ); + void (*remoteUserNameGet) + ( + PFW_PLUGIN_OBJ_STATE *pState, + char *pRemoteUserName + ); + void (*localUserNameSet) + ( + PFW_PLUGIN_OBJ_STATE *pState, + char *pLocalUserName + ); + void (*remoteUserNameSet) + ( + PFW_PLUGIN_OBJ_STATE *pState, + char *pRemoteUserName + ); + + }AUTH_INFO_INTERFACE; + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCauthInfoInterfaceh */ + + diff --git a/h/ppp/interfaces/componentAcceptableProtocolsInterface.h b/h/ppp/interfaces/componentAcceptableProtocolsInterface.h new file mode 100644 index 0000000..e3b72ee --- /dev/null +++ b/h/ppp/interfaces/componentAcceptableProtocolsInterface.h @@ -0,0 +1,56 @@ +/* componentAcceptableProtocolsInterface.h - PPP Component Acceptable */ +/* Protocols Interface */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,22nov99,sjv Changed the signature of set and get functions +01a,06nov99,sgv created +*/ + +#ifndef __INCcomponentAcceptableProtocolsInterfaceh +#define __INCcomponentAcceptableProtocolsInterfaceh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "pfw/pfw.h" +#include "pfw/pfwInterface.h" + +typedef struct acceptableProtocolsArray + { + int numberOfProtocols; + UINT *protocols; + } ACCEPTABLE_PROTOCOLS_ARRAY; + + +/******************************************************************************* +* COMPONENT_ACCEPTABLE_PROTOCOLS_INTERFACE - +* +* Interface Name: "COMPONENT_ACCEPTABLE_PROTOCOLS_INTERFACE" +* +* This interface is implemented by components to inform their layers about the +* accepted protocol types for receive and send paths +*/ + +typedef struct COMPONENT_ACCEPTABLE_PROTOCOLS_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + STATUS (*receivePathAcceptableProtocolsGet) (PFW_PLUGIN_OBJ_STATE *state, + ACCEPTABLE_PROTOCOLS_ARRAY **recvProtocols + ); + STATUS (*sendPathAcceptableProtocolsGet) (PFW_PLUGIN_OBJ_STATE *state, + ACCEPTABLE_PROTOCOLS_ARRAY **sendProtocols + ); + } COMPONENT_ACCEPTABLE_PROTOCOLS_INTERFACE; + +#ifdef __cplusplus +} +#endif +#endif /* componentAcceptableProtocolsInterfaceh */ diff --git a/h/ppp/interfaces/framingComponentInterfaces.h b/h/ppp/interfaces/framingComponentInterfaces.h new file mode 100644 index 0000000..f693c45 --- /dev/null +++ b/h/ppp/interfaces/framingComponentInterfaces.h @@ -0,0 +1,46 @@ +/* framingComponentInterfaces.h - generic interfaces for framing component */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,22aug02,ijm added portId to stackResolve prototype +01a,01nov99,sj created +*/ + +#include "pfw/pfw.h" +#include "pfw/pfwInterface.h" + +#ifndef __INCframingComponentInterfacesh +#define __INCframingComponentInterfacesh + +#ifdef __cplusplus +extern "C" { +#endif + +/******************************************************************************* +* FRAMING_COMPONENT_STACK_RESOLVE_INTERFACE - +* +* Interface Name: "FRAMING_COMPONENT_STACK_RESOLVE_INTERFACE" +* +* This interface may be used by adapter components to resolve the stackObj +* to which a received frame must be forwarded +* +* The "owner" parameter refers to the owner of the interface and "frame" is +* the received frame for which the connection needs to be resolved +*/ +typedef struct FRAMING_COMPONENT_STACK_RESOLVE_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + PFW_STACK_OBJ * (*stackResolve)(PFW_PLUGIN_OBJ *owner, M_BLK_ID frame, + ULONG portId); + } FRAMING_COMPONENT_STACK_RESOLVE_INTERFACE; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCframingComponentInterfacesh */ diff --git a/h/ppp/interfaces/ipcpInterfaces.h b/h/ppp/interfaces/ipcpInterfaces.h new file mode 100644 index 0000000..515302e --- /dev/null +++ b/h/ppp/interfaces/ipcpInterfaces.h @@ -0,0 +1,53 @@ +/* ipcpInterfaces.h - IPCP published interfaces */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,15jan2000,sgv created +*/ + +#include "pfw/pfw.h" +#include "pfw/pfwInterface.h" + +#ifndef __INCipcpInterfacesh +#define __INCipcpInterfacesh + +#ifdef __cplusplus +extern "C" { +#endif + +/******************************************************************************* +* PPP_IPCP_MIB_INTERFACE - PPP MIB status interface +* +* Interface Name: "PPP_IPCP_MIB_INTERFACE" +* +* This interface is published and made available by IPCP. +*/ +typedef struct PPP_IPCP_MIB_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + ULONG (*ipcpOperStatusGet)(PFW_PLUGIN_OBJ_STATE * state); + ULONG (*ipcpLocalToRemoteCompressionProtocolGet)( + PFW_PLUGIN_OBJ_STATE * state); + ULONG (*ipcpRemoteToLocalCompressionProtocolGet)( + PFW_PLUGIN_OBJ_STATE * state); + ULONG (*ipcpRemoteMaxSlotIdGet)( PFW_PLUGIN_OBJ_STATE * state); + ULONG (*ipcpLocalMaxSlotIdGet)( PFW_PLUGIN_OBJ_STATE * state); + ULONG (*ipcpConfigAdminStatusGet) (PFW_PLUGIN_OBJ_STATE * state); + ULONG (*ipcpConfigCompressionGet) (PFW_PLUGIN_OBJ_STATE * state); + STATUS (*ipcpConfigAdminStatusSet) (PFW_PLUGIN_OBJ_STATE * state, + ULONG value); + STATUS (*ipcpConfigCompressionSet) (PFW_PLUGIN_OBJ_STATE * state, + ULONG value); + } PPP_IPCP_MIB_INTERFACE; + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCipcpInterfacesh */ diff --git a/h/ppp/interfaces/lcpInterfaces.h b/h/ppp/interfaces/lcpInterfaces.h new file mode 100644 index 0000000..db65ff8 --- /dev/null +++ b/h/ppp/interfaces/lcpInterfaces.h @@ -0,0 +1,307 @@ +/* lcpInterfaces.h - LCP published interfaces */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01d,29sep00,sj merging with TOR2_0-WINDNET_PPP-CUM_PATCH_2 +01e,01aug00,adb Merging with openstack view +01d,11jul00,md added LCP_CONFIG_REQS_INTERFACE +01c,01mar00,sj added LCP_PACKET_SEND_INTERFACE +01b,05jan00,sj adding lcpExtensions and pppLinkConfigEntry and + pppSecurityConfigEntry +01a,15oct99,sj created +*/ + +#include "pfw/pfw.h" +#include "pfw/pfwInterface.h" +#include "ppp/mp.h" /* WindNet Multilink */ + +#ifndef __INClcpInterfacesh +#define __INClcpInterfacesh + +#ifdef __cplusplus +extern "C" { +#endif + +/******************************************************************************* +* PPP_LINK_STATUS_ENTRY_INTERFACE - PPP link status interface +* +* Interface Name: "PPP_LINK_STATUS_ENTRY_INTERFACE" +* +* This interface is published and made available by LCP. +* Other components in the system such as IPCP and ASYNC framing use this +* interface to retrieve link related negotiated LCP options +*/ +typedef struct PPP_LINK_STATUS_ENTRY_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + UINT32 (*pppLinkStatusPhysicalIndexGet)(PFW_PLUGIN_OBJ_STATE * lcpState); + UINT32 (*pppLinkStatusBadAddressesGet)(PFW_PLUGIN_OBJ_STATE * lcpState); + UINT32 (*pppLinkStatusBadControlsGet)(PFW_PLUGIN_OBJ_STATE * lcpState); + UINT32 (*pppLinkStatusPacketTooLongsGet)(PFW_PLUGIN_OBJ_STATE * lcpState); + UINT32 (*pppLinkStatusBadFCSsGet)(PFW_PLUGIN_OBJ_STATE * lcpState); + USHORT (*pppLinkStatusLocalMRUGet) ( PFW_PLUGIN_OBJ_STATE * lcpState); + USHORT (*pppLinkStatusRemoteMRUGet) ( PFW_PLUGIN_OBJ_STATE * lcpState); + + UINT32 (*pppLinkStatusLocalToPeerACCMapGet) + (PFW_PLUGIN_OBJ_STATE * lcpState); + UINT32 (*pppLinkStatusPeerToLocalACCMapGet) + ( PFW_PLUGIN_OBJ_STATE * lcpState); + UINT32 (*pppLinkStatusLocalToRemoteProtocolCompressionGet) + ( PFW_PLUGIN_OBJ_STATE * lcpState); + UINT32 (*pppLinkStatusRemoteToLocalProtocolCompressionGet) + ( PFW_PLUGIN_OBJ_STATE * lcpState); + UINT32 (*pppLinkStatusLocalToRemoteACCompressionGet) + (PFW_PLUGIN_OBJ_STATE * lcpState); + UINT32 (*pppLinkStatusRemoteToLocalACCompressionGet) + (PFW_PLUGIN_OBJ_STATE * lcpState); + + UINT32 (*pppLinkStatusTransmitFcsSizeGet) (PFW_PLUGIN_OBJ_STATE * lcpState); + UINT32 (*pppLinkStatusReceiveFcsSizeGet) (PFW_PLUGIN_OBJ_STATE * lcpState); + } PPP_LINK_STATUS_ENTRY_INTERFACE; + +/******************************************************************************* +* PPP_LINK_CONFIG_ENTRY_INTERFACE - PPP link config interface +* +* Interface Name: "PPP_LINK_CONFIG_ENTRY_INTERFACE" +* +* This interface is published and made available by LCP. +* This interface is intended for any external agent such as SNMP to configure +* values for LCP +*/ +typedef struct PPP_LINK_CONFIG_ENTRY_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + ULONG (*pppLinkConfigInitialMRUGet) (PFW_PLUGIN_OBJ_STATE * lcpState); + STATUS (*pppLinkConfigInitialMRUSet) (PFW_PLUGIN_OBJ_STATE * lcpState, + ULONG value); + ULONG (*pppLinkConfigReceiveACCMapGet) (PFW_PLUGIN_OBJ_STATE * lcpState); + STATUS (*pppLinkConfigReceiveACCMapSet) (PFW_PLUGIN_OBJ_STATE * lcpState, + ULONG value); + ULONG (*pppLinkConfigTransmitACCMapGet) (PFW_PLUGIN_OBJ_STATE * lcpState); + STATUS (*pppLinkConfigTransmitACCMapSet) (PFW_PLUGIN_OBJ_STATE * lcpState, + ULONG value); + ULONG (*pppLinkConfigMagicNumberGet) (PFW_PLUGIN_OBJ_STATE * lcpState); + STATUS (*pppLinkConfigMagicNumberSet) (PFW_PLUGIN_OBJ_STATE * lcpState, + ULONG value); + ULONG (*pppLinkConfigFcsSizeGet) (PFW_PLUGIN_OBJ_STATE * lcpState); + STATUS (*pppLinkConfigFcsSizeSet) (PFW_PLUGIN_OBJ_STATE * lcpState, + ULONG value); + }PPP_LINK_CONFIG_ENTRY_INTERFACE; + +/******************************************************************************* +* LCP_NEGOTIATED_AUTH_PROTOCOL_INTERFACE - auth protocol interface +* +* Interface Name: "LCP_NEGOTIATED_AUTH_PROTOCOL_INTERFACE" +* +* This interface is published and made available by LCP. This interface +* is intended for the Control Layer and the Authentication Protocol components +* in the system. It is used to determine the negotiated Authentication protocols +*/ +typedef struct LCP_NEGOTIATED_AUTH_PROTOCOL_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + UINT32 (*pppLocalAuthenticationProtocolGet) + (PFW_PLUGIN_OBJ_STATE * lcpState); + UINT32 (*pppRemoteAuthenticationProtocolGet) + (PFW_PLUGIN_OBJ_STATE * lcpState); + } LCP_NEGOTIATED_AUTH_PROTOCOL_INTERFACE; + +/******************************************************************************* +* PPP_LINK_STATUS_COUNTER_INCREMENT_INTERFACE - link statistics interface +* +* Interface Name: "PPP_LINK_STATUS_COUNTER_INCREMENT_INTERFACE" +* +* This interface is published and made available by LCP. This interface is +* intended for the framing and adapter components in the system. It is used +* to increment the link statistics counters. +*/ +typedef struct PPP_LINK_STATUS_COUNTER_INCREMENT_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + void (*pppLinkStatusBadAddressesIncrement)(PFW_PLUGIN_OBJ_STATE * lcpState); + void (*pppLinkStatusBadControlsIncrement)(PFW_PLUGIN_OBJ_STATE * lcpState); + void (*pppLinkStatusPacketTooLongsIncrement) + (PFW_PLUGIN_OBJ_STATE * lcpState); + void (*pppLinkStatusBadFCSsIncrement)(PFW_PLUGIN_OBJ_STATE * lcpState); + + }PPP_LINK_STATUS_COUNTER_INCREMENT_INTERFACE; + +/******************************************************************************* +* LCP_EXTENDED_OPTIONS_INTERFACE - interface for extended LCP options (RFC 1570) +* +* Interface Name: "LCP_EXTENDED_OPTIONS_INTERFACE" +* +* This interface is published and made available by LCP. +* The Control layer uses this to determine if callback has been negotiated. +* Also other protocols such as the Encryption protocols may use this to +* determine if Self Describing Padding is in use +* +* Compound frames option described in RFC 1570 is not supported +*/ +typedef struct LCP_EXTENDED_OPTIONS_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + UINT8 (*pppLocalToPeerMaxSelfDescribingPad) /* Returns the length(# bytes)*/ + ( /* of padding the LOCAL system*/ + PFW_PLUGIN_OBJ_STATE * lcpState /* has negotiated for use when*/ + ); /* sending packets to PEER */ + + UINT8 (*pppPeerToLocalMaxSelfDescribingPad) /* Returns the length (#bytes)*/ + ( /* of padding the PEER system */ + PFW_PLUGIN_OBJ_STATE * lcpState /* has negotiated for use when*/ + ); /* sending packets to LOCAL */ + /* system */ + + BOOL (*pppLocalToPeerCallbackOperation) /* Returns TRUE if the LOCAL */ + ( /* system has successfully */ + PFW_PLUGIN_OBJ_STATE * lcpState, /* negotiated for a CALLBACK */ + UINT8 * operation /* by the PEER */ + ); + + BOOL (*pppPeerToLocalCallbackOperation) /* Returns TRUE if the PEER */ + ( /* system has successfully */ + PFW_PLUGIN_OBJ_STATE * lcpState, /* negotiated for the LOCAL */ + UINT8 * operation, /* LOCAL system to callback */ + char * msg /* the PEER. "operation" and */ + ); /* "msg" contains the callback*/ + /* instructions */ + } LCP_EXTENDED_OPTIONS_INTERFACE; + +/******************************************************************************* +* LCP_CONFIG_REQS_INTERFACE - interface to ask LCP for Configure Request packets +* Interface Name: "LCP_CONFIG_REQS_INTERFACE" +* +* This interface is published and made available by LCP. This interface may +* be used by any component in the PPP stack to retrieve the initialReceived, +* lastSent, and lastReceived packet. +* +*/ +typedef struct LCP_CONFIG_REQS_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + STATUS (*lcpConfigReqsGet) + (PFW_PLUGIN_OBJ_STATE *lcpState, M_BLK_ID *initialReceived, + M_BLK_ID *lastSent, M_BLK_ID *lastReceived); + + } LCP_CONFIG_REQS_INTERFACE; + +/******************************************************************************* +* LCP_PACKET_SEND_INTERFACE - interface to ask LCP to send a particular packet +* +* Interface Name: "LCP_PACKET_SEND_INTERFACE" +* +* This interface is published and made available by LCP. This interface may +* be used by any component in the PPP stack to send an LCP packet whose type +* is one of the types supported by this interface. +* +* However it is mainly intended for use as an interface to send Protocol Reject +* packets when unrecognized protocols are received. +* +* Also L2TP extensions to the PPP stack may need to use this interface +* to send other LCP packets +*/ +typedef struct LCP_PACKET_SEND_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + + void (*lcpConfigurationRequestSend)(PFW_PLUGIN_OBJ_STATE * lcpState); + void (*lcpConfigurationAckSend)(PFW_PLUGIN_OBJ_STATE * lcpState, + M_BLK_ID requestPacket); + + void (*lcpTerminationRequestSend)(PFW_PLUGIN_OBJ_STATE * lcpState); + void (*lcpTerminationAckSend)(PFW_PLUGIN_OBJ_STATE * lcpState, + M_BLK_ID terminationRequest); + + void (*lcpEchoRequestSend)(PFW_PLUGIN_OBJ_STATE * lcpState); + void (*lcpEchoReplySend)(PFW_PLUGIN_OBJ_STATE * lcpState, + M_BLK_ID echoPacket); + + void (*lcpProtocolRejectSend)(PFW_PLUGIN_OBJ_STATE * lcpState, + M_BLK_ID badPacket); + } LCP_PACKET_SEND_INTERFACE; +/******************************************************************************* +* PPP_SECURITY_CONFIG_ENTRY_INTERFACE - interface for security protocol config +* +* Interface Name: "PPP_SECURITY_CONFIG_ENTRY_INTERFACE" +* +* This interface is published and made available by LCP and is mainly intended +* for the SNMP agent to configure security protocols for a said PPP link +* identified by the "lcpState" argument. +*/ +typedef struct PPP_SECURITY_CONFIG_ENTRY_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + + int (*pppSecurityConfigProtocolGet) /* retrieve the auth protocol */ + ( /* with the specified preference.*/ + PFW_PLUGIN_OBJ_STATE * lcpState, /* If the specified preference */ + ULONG preference, /* is not available the protocol */ + UINT8 *protocol, /* with the next preference is */ + UINT8 *protocolLen /* retrived. Always the retrieved*/ + ); /* preference is the return value*/ + /* Return value of -1 implies */ + /* that nothing is available */ + + STATUS (*pppSecurityConfigProtocolSet) /* add/change the specified */ + ( /* protocol at the given */ + PFW_PLUGIN_OBJ_STATE * lcpState, /* preference level */ + ULONG preference, + UINT8 * protocol, + UINT8 protocolLen + ); + + STATUS (*pppSecurityConfigStatusSet) /* Only used to invalidata/delete*/ + ( /* the protocol at the said */ + PFW_PLUGIN_OBJ_STATE * lcpState, /* preference level */ + ULONG preference, + UINT32 configStatus + ); + } PPP_SECURITY_CONFIG_ENTRY_INTERFACE; + +/* MP related LCP interface functions - WindNet Multilink */ + +typedef struct LCP_BUNDLE_OPTIONS_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + STATUS (*lcpMpOptionsGet) + ( + PFW_PLUGIN_OBJ_STATE *pLcpState, + LCP_BUNDLE_OPTIONS *pLcpBundleOptions + ); + }LCP_BUNDLE_OPTIONS_INTERFACE; + +typedef struct LCP_PROXYLCP_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + + STATUS (*lcpProxyLcpDo) + ( + PFW_PLUGIN_OBJ_STATE *pManagerLcpState, + PFW_PLUGIN_OBJ_STATE *pMemberLcpState + ); + + }LCP_PROXYLCP_INTERFACE; + +#if 0 /* Not supported in this MP Release */ +typedef struct LCP_MP_TIME_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + void (*lcpMPLinkTime) + ( + PFW_PLUGIN_OBJ_STATE *pLcpState + ); + }LCP_MP_TIME_INTERFACE; +#endif /* Not supported in this MP Release */ + +/* MP related LCP interface functions - WindNet Multilink */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INClcpInterfacesh */ diff --git a/h/ppp/interfaces/mpFramingLayerInterfaces.h b/h/ppp/interfaces/mpFramingLayerInterfaces.h new file mode 100644 index 0000000..c123b6f --- /dev/null +++ b/h/ppp/interfaces/mpFramingLayerInterfaces.h @@ -0,0 +1,76 @@ +/* mpFramingLayerInterfaces.h - mpFraming layer interface header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,18dec01,ak support for dynamic assignment of MP Member Stack to Manager + Stack + +01a,23feb01,ak created +*/ + +#include "pfw/pfw.h" +#include "pfw/pfwInterface.h" +#include "ppp/pppInterfaces.h" + +#ifndef __INCmpFramingLayerInterfacesh +#define __INCmpFramingLayerInterfacesh + +#ifdef __cplusplus +extern "C" { +#endif + +/* MP Framing layer interface structures */ + +/* MP_BUNDLE_MANAGEMENT_INTERFACE */ + +typedef struct MP_BUNDLE_MANAGEMENT_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + + PFW_STACK_OBJ * (*mpOpenBundleOrAddToTheExistingBundle) + ( + PFW_PLUGIN_OBJ_STATE *pMemberLcpState, + MP_UPCALL_FUNCTIONS *pMpUpCalls, + void *userHandle + ); + + STATUS (*mpRemoveAPortFromBundle) + ( + PFW_PLUGIN_OBJ_STATE *pMpFraminglayerState, + PFW_STACK_OBJ *pMemberStackObj + ); + + STATUS (*mpLinkAssign) + ( + PFW_STACK_OBJ *pMemberStackObj, + PFW_STACK_OBJ *pManagerStackObj + ); + + SL_LIST * (* mpBAPLinkInfoListGet) + (PFW_PLUGIN_OBJ_STATE * pMpFramingLayerState); + + + }MP_BUNDLE_MANAGEMENT_INTERFACE; + +/* MP framing layer packet received interface */ + +typedef struct MP_PACKET_RECEIVE_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + + STATUS (*mpFramingLayerReceive ) + (PFW_PLUGIN_OBJ_STATE *pMpFramingLayerState, + PFW_STACK_OBJ *pMemberStackObj, M_BLK_ID packet); + + }MP_PACKET_RECEIVE_INTERFACE; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmpFramingLayerInterfacesh */ diff --git a/h/ppp/interfaces/pppControlLayerInterface.h b/h/ppp/interfaces/pppControlLayerInterface.h new file mode 100644 index 0000000..fb12b48 --- /dev/null +++ b/h/ppp/interfaces/pppControlLayerInterface.h @@ -0,0 +1,138 @@ +/* pppControlLayerInterface.h - PPP control layer interface definitions */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01d,22feb02,ak support for dynamic assignment of MP Member Stack to Manager + Stack +01c,30jun01,nts moved pppMpMemberSet function to the + new MP_CONTROL_LAYER_INTERFACE +01b,30jun01,nts added pppMpMemberSet function to the PPP_CONTROL_LAYER_INTERFACE +01a,15oct99,sj created +*/ + +#include "ppp/kstart.h" +#include "ppp/kppp.h" +#include "pfw/pfwInterface.h" +#include "ppp/pppInterfaces.h" + +#ifndef __INCpppControlLayerInterfaceh +#define __INCpppControlLayerInterfaceh + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*PAP_CALLBACK)(PFW_PLUGIN_OBJ_STATE *, BYTE id, TEST passOrFail); + +typedef void (*CHAP_CALLBACK)(PFW_PLUGIN_OBJ_STATE *, BYTE id, TEST passOrFail); +/******************************************************************************* +* LCP_UP_EVENT - LCP is up event +* +* Event Name: "LCP_UP_EVENT" +* +* This Event is published by the Control Layer and is raised as soon as +* LCP is UP. All components in the system that need to communicate with LCP +* via LCP's published interfaces(lcpInterfaces.h) must subscribe to this event +* to obtain a pointer to LCP's PFW_PLUGIN_OBJ_STATE which is a needed parameter +* for all LCP interfaces +*/ + +/******************************************************************************* +* PPP_CONTROL_LAYER_INTERFACE - control layer interface for control protocols +* +* Interface Name: "PPP_CONTROL_LAYER_INTERFACE" +* +* This Interface is published and made available by the PPP Control Layer in the +* system. It is intended for all control layer protocols, such as LCP, IPCP,CHAP +* etc., in the system and is used by them to communicate status and control +* information to the Control Layer. In each of the functions defined below +* "pluginState" refers to the state of the caller. Also not all the functions +* are applicable to all protocols; e.g. protocolRejected is called by LCP only +*/ +typedef struct PPP_CONTROL_LAYER_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + void (*protocolUp) (PFW_PLUGIN_OBJ_STATE * pluginState); + void (*protocolDown) ( + PFW_PLUGIN_OBJ_STATE * pluginState, + PPP_STATE endState + ); + void (*protocolFinished)(PFW_PLUGIN_OBJ_STATE * pluginState); + void (*protocolRejected)( + PFW_PLUGIN_OBJ_STATE * pluginState, + PPP_PROTOCOL_TYPE rejectedProtocol + ); + + void (*pppLcpTerminationRequest) (PFW_PLUGIN_OBJ_STATE * pluginState); + void (*pppLcpIdRequest) (PFW_PLUGIN_OBJ_STATE * pluginState, + char * message); + void (*pppLcpIdRequestReceived) (PFW_PLUGIN_OBJ_STATE * pluginState, + char * message); + void (*pppLcpTimeRemainingRequest) (PFW_PLUGIN_OBJ_STATE * pluginState, + ULONG * secondsRemaining, + char * message); + void (*pppLcpTimeRemainingReceived)(PFW_PLUGIN_OBJ_STATE * pluginState, + ULONG secondsRemaining, + char * message); + + void (*pppAuthRequest) (PFW_PLUGIN_OBJ_STATE *pluginState, + char * userName, char *userPassword); + void (*pppChallengeAuthVerify)(PFW_PLUGIN_OBJ_STATE *pluginState, + char * localName, char * peerName, + char * response,unsigned int responseLen, + char * challenge, unsigned int challengeLen, + BYTE id,CHAP_CALLBACK); + + void (*pppPasswordAuthVerify) (PFW_PLUGIN_OBJ_STATE *pluginState, + char * localName,char * peerName, + char *password, BYTE id,PAP_CALLBACK); + void (*pppAuthAckTransmitted) (PFW_PLUGIN_OBJ_STATE *pluginState); + void (*pppAuthAckReceived) (PFW_PLUGIN_OBJ_STATE *pluginState); + void (*pppAuthFailed) (PFW_PLUGIN_OBJ_STATE *pluginState); + void (*pppAuthRefused) (PFW_PLUGIN_OBJ_STATE *pluginState); + }PPP_CONTROL_LAYER_INTERFACE ; + +/* WindNet Multilink */ + +/******************************************************************************* +* MP_CONTROL_LAYER_INTERFACE - control layer interface for MP +* +* Interface Name: "MP_CONTROL_LAYER_INTERFACE" +* +* This Interface is published and made available by the PPP Control Layer in the +* system. It is used to make the CONTROL LAYER MP aware. This function is +* called by the mpInterfaceLayer in the MEMBER stack on LCP_UP event. +* It sets the isMember variable to TRUE and sets the MANAGER stack's stack object. +* In the function defined below "pluginState" refers to the state of the caller. +*/ +typedef struct MP_CONTROL_LAYER_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + + void (*pppMpMemberSet) /* to make the control layer */ + ( /* MP-AWARE */ + PFW_PLUGIN_OBJ_STATE *pluginState, + BOOLEAN isMember, + PFW_STACK_OBJ *mpStackObj + ); + + void (*mpUpCallsGet) /* to return reference to */ + ( /* MP_UPCALLS */ + PFW_PLUGIN_OBJ_STATE *pluginState, + MP_UPCALL_FUNCTIONS **mpUpCalls, + void **pUserHandler + ); + }MP_CONTROL_LAYER_INTERFACE ; + +/* WindNet Multilink */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppControlLayerInterfaceh */ diff --git a/h/ppp/interfaces/pppControlProtocolInterface.h b/h/ppp/interfaces/pppControlProtocolInterface.h new file mode 100644 index 0000000..f33718e --- /dev/null +++ b/h/ppp/interfaces/pppControlProtocolInterface.h @@ -0,0 +1,95 @@ +/* pppControlProtocolInterface.h - PPP Protocol interface definitions */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01d,29sep00,sj merging with TOR2_0-WINDNET_PPP-CUM_PATCH_2 +01c,01aug00,adb Merging with openstack view +01b,11jul00,md added AUTHEN_ATTRIBUTES_INTERFACE +01a,22oct99,sj created +*/ + +#include "ppp/kstart.h" +#include "ppp/kppp.h" +#include "pfw/pfw.h" +#include "pfw/pfwInterface.h" +#include "netBufLib.h" + +#ifndef __INCpppControlProtocolInterfaceh +#define __INCpppControlProtocolInterfaceh + +#ifdef __cplusplus +extern "C" { +#endif + +/* PPP Control Layer phases for Link Establishment and Teardown */ + +typedef enum + { + DEAD_PHASE, + ESTABLISH_PHASE, + AUTHENTICATE_PHASE, + NETWORK_PHASE, + TERMINATE_PHASE, + + TOTAL_PPP_CONTROL_PHASES + }PPP_CONTROL_PHASE; + +/******************************************************************************* +* CONTROL_PROTOCOL_INTERFACE - +* +* Interface Name: "CONTROL_PROTOCOL_INTERFACE" +* +* This interface is published by the PPP Control Layer in the system and is +* bound to and made available by all the control protocols managed by the +* Control Layer. +* +* This interface is intended for the Control Layer to control the state of +* the Control Layer protocols during link establishment and teardown. +* +* Protocols in this layer are divided into phases depending on the Control +* Layer phase in which the protocol is active +*/ +typedef struct CONTROL_PROTOCOL_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + PPP_CONTROL_PHASE (*pppPhaseGet)(); + PPP_STATE (*pppStateGet)(PFW_PLUGIN_OBJ_STATE *); + void (*executeStateMachine) + ( + PFW_PLUGIN_OBJ_STATE *pluginState, + PPP_EVENT pppEvent, + M_BLK_ID packet + ); + } CONTROL_PROTOCOL_INTERFACE; + + +/******************************************************************************* +* AUTHEN_ATTRIBUTES_INTERFACE - interface to authentication attributes +* +* Interface Name: "AUTHEN_ATTRIBUTES_INTERFACE" +* +* This interface is published and made available by the control layer. +* This interface may be used by any component in the PPP stack to +* retrieve the authentication attributes +* +*/ +typedef struct AUTHEN_ATTRIBUTES_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + STATUS (*authenAttributesGet) + (PFW_PLUGIN_OBJ_STATE * controlLayerState, + UINT16 *authenType, char *authenName, + char *authenChallange, UINT8 *authenID, char *authenResponse); + } AUTHEN_ATTRIBUTES_INTERFACE; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppControlProtocolInterfaceh */ + diff --git a/h/ppp/interfaces/pppHcInterfaces.h b/h/ppp/interfaces/pppHcInterfaces.h new file mode 100644 index 0000000..e77cb03 --- /dev/null +++ b/h/ppp/interfaces/pppHcInterfaces.h @@ -0,0 +1,63 @@ +/* pppHcInterfaces.h - PPP Header Compression Component Interfaces */ + +/* Copyright 2002 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,14jan03,adb branching to tor2_2.windnet_ppp2_0 +01a,23apr02,adb created +*/ + +#ifndef __INCpppHcInterfacesh +#define __INCpppHcInterfacesh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "pfw/pfw.h" +#include "pfw/pfwInterface.h" + +#include "ppp/pppHeaderCompression.h" + +/******************************************************************************* +* PPP_HC_INTERFACE - +* +* Interface Name: "PPP_HC_INTERFACE" +* +* This interface is implemented by the PPP_HEADER_COMPRESSION component +* of the PPP stack. The PPP_IPCP_COMPONENT and the PPP_IPV6CP_COMPONENT +* will access it to activate to initialize and shutdown header compression +* for IPv4 and IPv6 and protocols carried over IPv4 and IPv6 over PPP. +* Header compression for a particular protocol can be invoked only once. +* If the caller wishes to modify header compression parameters then +* it should call hcShutdown () first before calling hcInitialize () again. +*/ + +typedef struct PPP_HC_INTERFACE + { + PFW_INTERFACE_OBJ pfwInterfaceObj; + + STATUS (*hcInitialize) + ( + PFW_PLUGIN_OBJ_STATE * pPfwPluginObjState, + HC_PPP_CONFIGURATION_OPTION * pHcPppConfigurationOption + ); + + STATUS (*hcShutdown) + ( + PFW_PLUGIN_OBJ_STATE * pPfwPluginObjState, + USHORT protocol + ); + + } PPP_HC_INTERFACE; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppHcInterfacesh */ diff --git a/h/ppp/interfaces/pppInterfacesGroupInterfaces.h b/h/ppp/interfaces/pppInterfacesGroupInterfaces.h new file mode 100644 index 0000000..8fc8688 --- /dev/null +++ b/h/ppp/interfaces/pppInterfacesGroupInterfaces.h @@ -0,0 +1,232 @@ +/* pppInterfacesGroupInterfaces.h - PPP IP up/down interface */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01c,23may00,adb Implementation of RFC 2233 counters +01b,20may00,adb Add counter update macro +01a,15may00,abd created +*/ + +#ifndef __INCpppInterfacesGroupInterfacesh +#define __INCpppInterfacesGroupInterfacesh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "pfw/pfw.h" +#include "pfw/pfwInterface.h" + +/* m2Lib.h is always shipped */ +#include "m2Lib.h" + +/* These defines (M2_ctrId_*) below may not exist in m2Lib.h so we define + * them here if they are not defined + */ +/* interface counter IDs */ + +#ifndef M2_ctrId_ifInOctets + #define M2_ctrId_ifInOctets 1 +#endif + +#ifndef M2_ctrId_ifInUcastPkts + #define M2_ctrId_ifInUcastPkts 2 +#endif + +#ifndef M2_ctrId_ifInNUcastPkts + #define M2_ctrId_ifInNUcastPkts 3 +#endif + +#ifndef M2_ctrId_ifInDiscards + #define M2_ctrId_ifInDiscards 4 +#endif + +#ifndef M2_ctrId_ifInErrors + #define M2_ctrId_ifInErrors 5 +#endif + +#ifndef M2_ctrId_ifInUnknownProtos + #define M2_ctrId_ifInUnknownProtos 6 +#endif + +#ifndef M2_ctrId_ifOutOctets + #define M2_ctrId_ifOutOctets 7 +#endif + +#ifndef M2_ctrId_ifOutUcastPkts + #define M2_ctrId_ifOutUcastPkts 8 +#endif + +#ifndef M2_ctrId_ifOutNUcastPkt + #define M2_ctrId_ifOutNUcastPkt 9 +#endif + +#ifndef M2_ctrId_ifOutDiscards + #define M2_ctrId_ifOutDiscards 10 +#endif + +#ifndef M2_ctrId_ifOutErrors + #define M2_ctrId_ifOutErrors 11 +#endif + +#ifndef M2_ctrId_ifInMulticastPkts + #define M2_ctrId_ifInMulticastPkts 12 +#endif + +#ifndef M2_ctrId_ifInBroadcastPkts + #define M2_ctrId_ifInBroadcastPkts 13 +#endif + +#ifndef M2_ctrId_ifOutMulticastPkts + #define M2_ctrId_ifOutMulticastPkts 14 +#endif + +#ifndef M2_ctrId_ifOutBroadcastPkts + #define M2_ctrId_ifOutBroadcastPkts 15 +#endif + +#ifndef M2_ctrId_ifHCInOctets + #define M2_ctrId_ifHCInOctets 16 +#endif + +#ifndef M2_ctrId_ifHCInUcastPkts + #define M2_ctrId_ifHCInUcastPkts 17 +#endif + +#ifndef M2_ctrId_ifHCInMulticastPkts + #define M2_ctrId_ifHCInMulticastPkts 18 +#endif + +#ifndef M2_ctrId_ifHCInBroadcastPkts + #define M2_ctrId_ifHCInBroadcastPkts 19 +#endif + +#ifndef M2_ctrId_ifHCOutOctets + #define M2_ctrId_ifHCOutOctets 20 +#endif + +#ifndef M2_ctrId_ifHCOutUcastPkts + #define M2_ctrId_ifHCOutUcastPkts 21 +#endif + +#ifndef M2_ctrId_ifHCOutMulticastPkts + #define M2_ctrId_ifHCOutMulticastPkts 22 +#endif + +#ifndef M2_ctrId_ifHCOutBroadcastPkts + #define M2_ctrId_ifHCOutBroadcastPkts 23 +#endif + +/* END OF (POSSIBLY) REDUNDANT DEFINITIONS */ + +/* In order to call the following macro it is assumed that locally we + * have defined: PFW_PLUGIN_OBJ_STATE * pState; + * int pfwAuxIfId; + * PFW_INTERFACE_STATE_PAIR pfwRFC2233CountPair; + * BOOL pfwRFC2233CountTest; + * and the is valid. + */ +#define RFC2233_COUNT_PAIR_GET(pState, \ + pfwAuxIfId, \ + pfwRFC2233CountPair, pfwRFC2233CountTest) \ + do { \ + pfwRFC2233CountTest = \ + (((pfwAuxIfId = pfwInterfaceIdGet(pState->pluginObj->pfwObj, \ + "PPP_IF_IFX_TABLE_INTERFACE")) > 0) && \ + (pfwInterfaceObjAndStateGetViaStackObj(pState->stackObj, \ + pfwAuxIfId, \ + &pfwRFC2233CountPair) == OK)); \ + } while(0) + +/* In order to call the following macro it is assumed that locally we + * have defined and populated PFW_INTERFACE_STATE_PAIR pfwRFC2233CountPair; + * and we have defined and set BOOL RFC2233Test; + * and ctrId is one of the 23 defined in m2Lib.h + * and incrAmount is nonnegative. + * + * In most cases we would populate pfwRFC2233CountPair by calling the + * macro RFC2233_COUNT_PAIR_GET defined above. In some cases -as in the + * case of the SIO adapter component which is called in interrupt context + * and subsequently it cannot call pfwInterfaceIdGet because then + * a semaphore take would be required (in a pfwTableTraverse)- the + * population of pfwRFC2233CountPair would be carried out otherwise. + */ +#define RFC2233_COUNTER_UPDATE(pfwRFC2233CountTest, pfwRFC2233CountPair, \ + ctrId, incrAmount) \ + do { \ + if (pfwRFC2233CountTest) \ + { \ + (((PPP_IF_IFX_TABLE_INTERFACE *) \ + (pfwRFC2233CountPair.interfaceObj))-> \ + ifIfXCounterUpdate) \ + (pfwRFC2233CountPair.state, ctrId, incrAmount); \ + }; \ + } while(0) + +/******************************************************************************* +* PPP_IF_IFX_TABLE_INTERFACE +* +* Interface Name: "PPP_IF_IFX_TABLE_INTERFACE" +* +* This interface is implemented by the END Object component. +* It enables all components of the PPP stack to update the counters and +* variables that are included in the ifTable and ifXTable +* of the Interfaces Group MIB as it is mandated by RFC 2233. +* +* This interface MUST be published by the pppEnd component. +*/ + +typedef struct pppIfIfXTableInterface + { + PFW_INTERFACE_OBJ interfaceObj; + STATUS (*ifIfXCounterUpdate)(PFW_PLUGIN_OBJ_STATE * state, + UINT ctrId, + /* 1 <= ctrId <= 23 + * 23 M2_ctrId_'s are defined + * in m2Lib.h + */ + ULONG incrAmount); + STATUS (*ifIfXVariableUpdate)(PFW_PLUGIN_OBJ_STATE * state, + UINT varId, + /* 1 <= ctrId <= 16 + * 16 M2_varId_'s are defined + * in m2Lib.h + */ + caddr_t pData); + } PPP_IF_IFX_TABLE_INTERFACE; + +/******************************************************************************* +* PPP_IF_STACK_TABLE_INTERFACE +* +* Interface Name: "PPP_IF_STACK_TABLE_INTERFACE" +* +* This interface is implemented by the END Object component. +* It enables all components of the PPP stack to conform to +* the ifStackTable part of RFC 2233. +* +* This interface MUST be published by the pppEnd component. +*/ + +typedef struct pppIfStackTableInterface + { + PFW_INTERFACE_OBJ interfaceObj; + STATUS (*ifStackStatusSet)(PFW_PLUGIN_OBJ_STATE * state, + int rowStatus); + /* 1 <= rowStatus <= 6 + * 6 ROW_(status) values + * are defined in m2Lib.h + * as RFC 2233 dictates. + */ + } PPP_IF_STACK_TABLE_INTERFACE; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppInterfacesGroupInterfacesh */ diff --git a/h/ppp/interfaces/pppIpInterfaces.h b/h/ppp/interfaces/pppIpInterfaces.h new file mode 100644 index 0000000..cb572dd --- /dev/null +++ b/h/ppp/interfaces/pppIpInterfaces.h @@ -0,0 +1,135 @@ +/* pppIpInterface.h - PPP IP up/down interface */ + +/* Copyright 2002 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01f,26jun02,ijm added PPP_IPV6_INTERFACE +01f,15jul02,emr This code was developed on the windnet_ppp2_0-ipv6 branch and + should have been developed on the windnet_ppp2_0 branch, so + this brings it into line. +01e,11oct00,sj added PPP_IP_DNS_INTERFACE +01d,29sep00,sj merging with TOR2_0-WINDNET_PPP-CUM_PATCH_2 +01c,27jul00,sj moved "01b,27jun00,bsn" changes to new PPP_IP_ROUTES_INTERFACE +01b,27jun00,bsn added ipRouteAdd, Delete, SetIfMask member functions +01a,04nov99,sgv created +*/ + +#ifndef __INCpppIpInterfaceh +#define __INCpppIppInterfaceh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "pfw/pfw.h" +#include "pfw/pfwInterface.h" + +/******************************************************************************* +* PPP_IP_INTERFACE - +* +* Interface Name: "PPP_IP_INTERFACE" +* +* This interface is implemented by components of the interface layer of the PPP +* stack. This interface is used to mark an IPv4 interface UP or DOWN. +*/ + +typedef struct PPP_IP_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + STATUS (*ipInterfaceUp) (PFW_PLUGIN_OBJ_STATE *state, + char *source, + char *destination + ); + STATUS (*ipInterfaceDown) (PFW_PLUGIN_OBJ_STATE *state, + char *source, + char *destination + ); + } PPP_IP_INTERFACE; + + +/******************************************************************************* +* PPP_IPV6_INTERFACE - +* +* Interface Name: "PPP_IPV6_INTERFACE" +* +* This interface is implemented by components of the interface layer of the PPP +* stack. This interface is used to mark an IPv6 interface UP or DOWN. +*/ + +typedef struct PPP_IPV6_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + STATUS (*ipv6InterfaceUp) (PFW_PLUGIN_OBJ_STATE *state, + char *source, + char *destination + ); + STATUS (*ipv6InterfaceDown) (PFW_PLUGIN_OBJ_STATE *state, + char *source, + char *destination + ); + } PPP_IPV6_INTERFACE; + + +/******************************************************************************* +* PPP_IP_ROUTES_INTERFACE - +* +* Interface Name: "PPP_IP_ROUTES_INTERFACE" +* +* This interface is implemented by components of the interface layer of the PPP +* stack. This interface is used to ADD or DELETE a route and set interface mask. +*/ + +typedef struct PPP_IP_ROUTES_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + STATUS (*ipRouteAdd) (PFW_PLUGIN_OBJ_STATE *state, + char *destination, + char *gateway, + unsigned long mask, + int tos, + int flags + ); + STATUS (*ipRouteDelete) (PFW_PLUGIN_OBJ_STATE *state, + char *destination, + unsigned long mask, + int tos, + int flags + ); + STATUS (*ipSetIfMask) (PFW_PLUGIN_OBJ_STATE *state, + unsigned long mask + ); + } PPP_IP_ROUTES_INTERFACE; + +/******************************************************************************* +* PPP_IP_DNS_INTERFACE - +* +* Interface Name: "PPP_IP_DNS_INTERFACE" +* +* This interface is implemented by components of the interface layer of the PPP +* stack. This interface is used to SET or GET the Primary and Secondary DNS +* addresses. +*/ + +typedef struct PPP_IP_DNS_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + void (*ipDnsAddressGet) (PFW_PLUGIN_OBJ_STATE *state, + char *primaryDnsAddr, + char *secondaryDnsAddr + ); + void (*ipDnsAddressSet) (PFW_PLUGIN_OBJ_STATE *state, + char *primaryDnsAddr, + char *secondaryDnsAddr + ); + } PPP_IP_DNS_INTERFACE; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppIpInterfaceh */ diff --git a/h/ppp/interfaces/pppLinkIdInterface.h b/h/ppp/interfaces/pppLinkIdInterface.h new file mode 100644 index 0000000..2d040df --- /dev/null +++ b/h/ppp/interfaces/pppLinkIdInterface.h @@ -0,0 +1,48 @@ +/* pppLinkIdInterface.h - PPP IP up/down interface */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,04nov99,sgv created +*/ + +#ifndef __INCpppLinkIdInterfaceh +#define __INCpppLinkIdInterfaceh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "pfw/pfw.h" +#include "pfw/pfwInterface.h" + +/******************************************************************************* +* PPP_LINK_ID_INTERFACE +* +* Interface Name: "PPP_LINK_ID_INTERFACE" +* +* This interface is implemented by components of the interface layer of the PPP +* stack. This interface is used to get a link Id for the PPP link. This Id +* is typically unique for each interface in the system and is used by the +* protocols at layer 3 and above. +* +* This interface MUST be published by the INTERFACE_LAYER component in the +* stack. +*/ + +typedef struct PPP_LINK_ID_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + UINT32 (*pppLinkIdGet)(PFW_PLUGIN_OBJ_STATE * state); + } PPP_LINK_ID_INTERFACE; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppLinkIdInterfaceh */ diff --git a/h/ppp/interfaces/pppModemInterface.h b/h/ppp/interfaces/pppModemInterface.h new file mode 100644 index 0000000..794e1fb --- /dev/null +++ b/h/ppp/interfaces/pppModemInterface.h @@ -0,0 +1,90 @@ +/* pppModemInterface.h - PPP framework modem interface header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,19apr00,cn created. +*/ + + +#ifndef __INCpppModemInterfaceh +#define __INCpppModemInterfaceh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "pfw/pfw.h" +#include "pfw/pfwInterface.h" + +/* commands */ + +#define MODEM_FLUSH 0x1 /* flush internal buffers */ +#define MODEM_SET_FLAGS 0x2 /* set modem flags */ +#define MODEM_GET_FLAGS 0x4 /* get modem flags */ + +/* flags */ + +#define MODEM_UP 0x1 /* modem is up: connection is usable */ +#define MODEM_OPEN 0x2 /* modem is open */ + +/******************************************************************************* +* PPP_MODEM_INTERFACE - PPP modem interface +* +* Interface Name: "PPP_MODEM_INTERFACE" +* +* This interface is published and made available by the SIO adapter component. +* Other components in the system use this interface to establish a dial-up +* connection to an external modem, to initialize the modem, or hang it up. +* +* The modemOpen routine is expected to perform any function required to access +* the modem and communicate with it, i.e. characters are not escaped or +* interpreted in any way. The modemClose routine is expected to reverse the +* actions performed by the modemOpen routine. +* +* The modemWrite routine should be used to send an arbitrary sequence +* of bytes to the modem. Likewise, the modemRead routine +* should return exactly of bytes read from the device in the +* buffer pointed to by . The parameter may be +* exploited to specify a timeout in seconds that the calling task may +* afford to wait before a complete answer from the modem is successfully +* received. If the timeout expires, ERROR should be returned by the modemRead +* routine. +* +* Finally, the modemIoctl routine should implement a device control routine. +* The following commands should be supported: +* MODEM_FLUSH: this command should be used to cancel any data previously +* sent to or received from the modem. +* MODEM_SET_FLAGS: this command should be used to set any device flag +* as specified in the parameter . +* MODEM_GET_FLAGS: this command should be used to get the current device's +* flags. +* +*/ +typedef struct pppModemInterface + { + PFW_INTERFACE_OBJ interfaceObj; + STATUS (* modemOpen)(PFW_PLUGIN_OBJ_STATE * pObjState); + STATUS (* modemClose)(PFW_PLUGIN_OBJ_STATE * pObjState); + STATUS (* modemRead)(PFW_PLUGIN_OBJ_STATE * pObjState, + char * rsp, + UINT rspBufLen, + UINT modemReadTimeout); + STATUS (* modemWrite)(PFW_PLUGIN_OBJ_STATE * pObjState, + char * buffer, + UINT bufLen); + STATUS (* modemIoctl)(PFW_PLUGIN_OBJ_STATE * pObjState, + int cmd, + int arg); + } PPP_MODEM_INTERFACE; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppModemInterfaceh */ diff --git a/h/ppp/interfaces/pppRadiusInterface.h b/h/ppp/interfaces/pppRadiusInterface.h new file mode 100644 index 0000000..01f7149 --- /dev/null +++ b/h/ppp/interfaces/pppRadiusInterface.h @@ -0,0 +1,85 @@ +/* pppRadiusInterfaces.h - RADIUS published interfaces */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,27jun00,bsn created +*/ + +#include "pfw/pfw.h" +#include "pfw/pfwInterface.h" + +#ifndef __INCpppRadiusInterfacesh +#define __INCpppRadiusInterfacesh + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct REMOTE_AUTHENTICATION_CALLBACKS + { + void (*authRequestAccepted) + (PFW_PLUGIN_OBJ_STATE *state, BYTE id); + void (*authRequestRejected) + (PFW_PLUGIN_OBJ_STATE *state, BYTE id, char * message); + void (*authErrorCallback) + (PFW_PLUGIN_OBJ_STATE *state, BYTE id); + } REMOTE_AUTHENTICATION_CALLBACKS; + +typedef enum + { + STANDARD_CHAP = 0x05, + MICROSOFT_CHAP = 0x80 + } CHALLENGE_AUTH_METHOD; + +/******************************************************************************* +* REMOTE_AUTHENTICATION_INTERFACE - remote authentication interface +* +* Interface Name: "REMOTE_AUTHENTICATION_INTERFACE" +* +* This interface is published and made available by RADIUS component. +* The PPP control layer uses this interface to verify the +* user identity +*/ +typedef struct REMOTE_AUTHENTICATION_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + void (*challengeAuthVerify) + (PFW_PLUGIN_OBJ_STATE * state, char * userName, + char * response, unsigned int responseLen, + char * challenge, unsigned int challengeLen, + BYTE id, CHALLENGE_AUTH_METHOD method, + REMOTE_AUTHENTICATION_CALLBACKS * radiusCallbacks); + void (*passwordAuthVerify) + (PFW_PLUGIN_OBJ_STATE * state, char * userName, + char * password, BYTE id, + REMOTE_AUTHENTICATION_CALLBACKS * radiusCallbacks); + } REMOTE_AUTHENTICATION_INTERFACE; + +/******************************************************************************* +* REMOTE_ACCOUNTING_INTERFACE - remote accounting interface +* +* Interface Name: "REMOTE_ACCOUNTING_INTERFACE" +* +* This interface is published and made available by RADIUS component. +* The PPP control layer uses this interface to start and +* stop accounting +*/ +typedef struct REMOTE_ACCOUNTING_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + void (*accountingStart) + (PFW_PLUGIN_OBJ_STATE * state); + void (*accountingStop) + (PFW_PLUGIN_OBJ_STATE * state); + } REMOTE_ACCOUNTING_INTERFACE; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppRadiusInterfacesh */ diff --git a/h/ppp/interfaces/pppVjcInterfaces.h b/h/ppp/interfaces/pppVjcInterfaces.h new file mode 100644 index 0000000..1c917b8 --- /dev/null +++ b/h/ppp/interfaces/pppVjcInterfaces.h @@ -0,0 +1,51 @@ +/* pppVjcInterface.h - PPP VJC up/down interface */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,17mar00,cn replaced setSlotNumbers with setConnIdCompress in + PPP_VJC_INTERFACE. +01a,06nov99,sgv created +*/ + + +#ifndef __INCpppVjcInterfaceh +#define __INCpppVjcpInterfaceh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "pfw/pfw.h" +#include "pfw/pfwInterface.h" + +/******************************************************************************* +* PPP_VJC_INTERFACE - +* +* Interface Name: "PPP_VJC_INTERFACE" +* +* This interface is implemented by vjc component of the PPP +* stack. IPCP component will set it to acceptable values +*/ + +typedef struct PPP_VJC_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + STATUS (*setSlotNumbers) (PFW_PLUGIN_OBJ_STATE * state, + int slotNumbers + ); + STATUS (*setConnIdCompress) (PFW_PLUGIN_OBJ_STATE * state, + BOOL connIdCompress + ); + } PPP_VJC_INTERFACE; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppVjcInterfaceh */ diff --git a/h/ppp/interfaces/pppVsidInterface.h b/h/ppp/interfaces/pppVsidInterface.h new file mode 100644 index 0000000..85eecca --- /dev/null +++ b/h/ppp/interfaces/pppVsidInterface.h @@ -0,0 +1,52 @@ +/* pppVsidInterface.h - PPP IP up/down interface */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,19may00,cn created +*/ + +#ifndef __INCpppVsidInterfaceh +#define __INCpppVsidInterfaceh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef VIRTUAL_STACK + +#include "vxWorks.h" +#include "pfw/pfw.h" +#include "pfw/pfwInterface.h" +#include "netinet/vsLib.h" + +/******************************************************************************* +* PPP_VSID_INTERFACE +* +* Interface Name: "PPP_VSID_INTERFACE" +* +* This interface is used to get and set the virtual stack identifier (VSID) +* for a particular PPP framework stack object. +* +* This interface MUST be published by the PPP_END component in the +* stack, only if VIRTUAL_STACK is defined. +*/ + +typedef struct PPP_VSID_INTERFACE + { + PFW_INTERFACE_OBJ interfaceObj; + STATUS (*pppVsidGet)(PFW_PLUGIN_OBJ_STATE * state, VSID * pVsid); + STATUS (*pppVsidSet)(PFW_PLUGIN_OBJ_STATE * state, VSID vsid); + } PPP_VSID_INTERFACE; + +#endif /* VIRTUAL_STACK */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppVsidInterfaceh */ diff --git a/h/ppp/kbacpif.h b/h/ppp/kbacpif.h new file mode 100644 index 0000000..bef03e7 --- /dev/null +++ b/h/ppp/kbacpif.h @@ -0,0 +1,145 @@ +/* kbacpif.h - BAP Port Information structure header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,01feb01,sd created from routerware source code +*/ + + +/* +*$Log:: $ + * + * 4 4/ + * Bacp + * v4.2.0 + * check in + * + * 1 4 + * code + * cleanup + * , code + * style + * changes + * , + * linted, + * system + * level + * test + * BACP + * v4.2.0 +*/ + +#ifndef __INCkbacpifh +#define __INCkbacpifh + +#ifdef __cplusplus +extern "C" { +#endif + +#define DEFAULT_MAXIMUM_MRRU 1500 + +typedef enum BAP_LINK_TYPES + { + BAP_ISDN_TYPE = (BYTE) 0x01, + BAP_X25_TYPE = (BYTE) 0x02, + BAP_ANALOG_TYPE = (BYTE) 0x04, + BAP_SWITCHED_DIGITAL_TYPE = (BYTE) 0x08, + BAP_ISDN_DOV_TYPE = (BYTE) 0x10, + BAP_RESERVED_1_TYPE = (BYTE) 0x05, + BAP_RESERVED_2_TYPE = (BYTE) 0x06, + BAP_RESERVED_3_TYPE = (BYTE) 0x07, + BAP_DEDICATED_PORT = (BYTE) 0xff + } BAP_LINK_TYPES; + + +enum CALL_STATUS + { + CALL_STATUS_OK = (BYTE) 0x00, + CALL_STATUS_UNASSIGNED_NUMBER = (BYTE) 0x01, + CALL_STATUS_USER_BUSY = (BYTE) 0x11, + CALL_STATUS_SECURITY_VIOLATION = (BYTE) 0xfe, /* routerware added */ + CALL_STATUS_NON_SPECIFIC_FAILURE = (BYTE) 0xFF + } CALL_STATUS; + +enum CALL_ACTION + { + CALL_ACTION_NO_RETRY = (BYTE) 0x00, + CALL_ACTION_RETRY = (BYTE) 0x01 + } CALL_ACTION; + + + +enum PORT_DIALUP_TYPE + { + PORT_DEDICATED, + PORT_DIAL_IN, + PORT_DIAL_OUT, + PORT_DIAL_IN_AND_OUT + } PORT_DIALUP_TYPE; + +enum PORT_DIAL_STATUS + { + PORT_DIAL_DISCONNECTED, + PORT_DIAL_WAITING_CONNECT_CMD, + PORT_DIAL_CONNECTING, + PORT_DIAL_CONNECTED, + PORT_DIAL_DISCONNECTING + } PORT_DIAL_STATUS; + + +#define MAX_LENGTH_OF_PHONE_NUMBER 24 + +typedef struct PORT_CONNECTION_INFO + { + struct PORT_CONNECTION_INFO * next; + PFW_PROFILE_OBJ * linkProfileObj; + PFW_STACK_OBJ * linkStackObj; + BYTE_ENUM(BAP_LINK_TYPES) port_type; + BOOL is_port_type_specified; + USHORT port_number; + enum PORT_DIAL_STATUS port_dial_status; + BYTE_ENUM(CALL_ACTION) port_action; + BYTE_ENUM(CALL_STATUS) port_status; + USHORT port_speed; + enum PORT_DIALUP_TYPE port_dial_type; + USHORT port_lcp_local_link_discriminator; + USHORT port_lcp_remote_link_discriminator; + char port_local_phone_number[MAX_LENGTH_OF_PHONE_NUMBER]; + char port_remote_phone_number[MAX_LENGTH_OF_PHONE_NUMBER]; + char port_subaddress_phone_number[MAX_LENGTH_OF_PHONE_NUMBER]; + char port_unique_digits_phone_number_length; + char port_unique_digits_phone_number[MAX_LENGTH_OF_PHONE_NUMBER]; + + } PORT_CONNECTION_INFO; + +/* typedefs */ + +typedef struct linkInfo + { + struct LINK_INFO *pNext; + PFW_PROFILE_OBJ *pLinkProfileObj; + BOOL isPortUsed; + BYTE_ENUM (BAP_LINK_TYPES) port_type; + enum PORT_DIALUP_TYPE port_dial_type; + USHORT port_number; + enum PORT_DIAL_STATUS port_dial_status; + USHORT bandwidth; + char port_local_phone_number [MAX_LENGTH_OF_PHONE_NUMBER]; + char port_remote_phone_number [MAX_LENGTH_OF_PHONE_NUMBER]; + char port_subaddress_phone_number [MAX_LENGTH_OF_PHONE_NUMBER]; + char port_unique_digits_phone_number_length; + char port_unique_digits_phone_number [MAX_LENGTH_OF_PHONE_NUMBER]; + } LINK_INFO; + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCkbacpifh */ + diff --git a/h/ppp/kppp.h b/h/ppp/kppp.h new file mode 100644 index 0000000..77268e0 --- /dev/null +++ b/h/ppp/kppp.h @@ -0,0 +1,493 @@ +/* kppp.h - ppp core header file */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +*$Log:: /Rtrware/devdrvrs/ppp/kppp.h $ + * + * 9 11/13/98 7:55a Nishit + * MAXIMUM_NUMBER_OF_PPP_PORTS now + * defined only if not previously + * defined; IP_PROTOCOL renamed to + * PPP_IP_PROTOCOL to remove a conflict + * + * 8 10/01/98 11:43a Alex + * Updated the PPP source code to conform + * to a single build. + * + * 7 6/08/98 4:04p Nishit + * Added more values in enum + * LCP_OPTION_TYPE + * + * 6 4/30/98 3:03p Alex + * Ppp v4.2.0 check in + * + * 1 4/24/98 12:10a Release Engineer + * code cleanup, code style changes, + * linted, system level test + * PPP v4.2.0 +*/ + +/* +modification history +-------------------- +01x,13may02,ijm removed adv_net.h +01w,29jul02,ijm added dual stack declarations +01v,08jul02,ijm updated NUMBER_OF_IPCP_OPTIONS +01u,26jun02,ijm added PPP_IPV6_PROTOCOL +01t,17may02,mk add ___sh__ for hitachi to the WRS_PACK_ALIGN macro +01s,22may02,vk added IPV6 specific protocol id +01r,21may02,adb added header compression definitions +01q,07feb02,ak added PPP_FLAGS +01p,29jan02,ijm added mips to _WRS_PACK_ALIGN macro +01o,13jan02,ijm changed _8210D_SPANNING_TREE_BPDU to SPANNING_TREE_BPDU_8021D + due to C++ compiler warning +01n,07dec01,mk added macros _WRS_PACK_ALIGN(x),to fix alignment + problems for PPP for arm +01m,29sep00,sj merging with TOR2_0-WINDNET_PPP-CUM_PATCH_2 +01l,02aug00,adb Merging in LAC modifications +01k,02aug00,md moved PPP_ATTRIBUTES structure to pppLacStructures.h +01j,01aug00,adb Merging with openstack view +01i,28jul00,md changes char* field within PPP_ATTRIBUTES +01h,08jul00,bsn merged from the PPP radius-ras branch +01g,29jun00,md added PPP_ATTRIBUTES structure +01f,14mar00,sj changed CHALLENGE_VALUE_SIZE to 16 +01e,23feb00,cn added PPP_IPCP_CONTROL_CODES_NUM, suppressed warnings. +01d,17feb00,cn corrected IPCP_OPTION_TYPE. +01c,08feb00,sj added PRIMARY_DNS_ADDRESS and SECONDARY_DNS_ADDRESS for IPCP +01b,17nov99,sj changing defaults to match RFC 1661 +01a,28sep99,sj derived from routerware source base +*/ + +#ifndef __INCkppph +#define __INCkppph + +#include "netinet/in.h" /* for htons() */ +#include "net/mbuf.h" +#include "string.h" + +#ifndef _WRS_PACK_ALIGN +#if (((defined __arm__) || (defined __thumb__) || (defined __mips__)||(defined __sh__)) && (defined __GNUC__)) +#define _WRS_PACK_ALIGN(x) __attribute__((packed,aligned(x))) + +#else +#define _WRS_PACK_ALIGN(x) +#endif +#endif + +#if !defined (PROTOCOL_MASKS) + + #define PROTOCOL_MASK 0x00ff + #define PROTOCOL_MASKS + #define GET_PROTOCOL_TYPE_MASK 0xff00 + #define OFFSET_OF_STACK_ID 0x08 + +#endif + +#define NUMBER_OF_IPCP_OPTIONS 0x6 +#define NUMBER_OF_IPV6CP_OPTIONS 0x2 + + +#define MIB_ENABLED 1 +#define MIB_DISABLED 2 + +#define SIZE_OF_WAN_CRC 2 +#define NUMBER_OF_ERROR_BYTES 50 +#define HDLC_FLAG_SEQUENCE 0x7e +#define HDLC_ADDRESS 0xff + +#define DEFAULT_MAXIMUM_MRU 1500 +#define MAXIMUM_CONFIGURATION_REQUESTS 10 +#define MAXIMUM_CONFIGURATION_FAILURES 5 +#define MAXIMUM_TERMINATION_REQUESTS 2 +#define MAXIMUM_CONFIGURATION_REQUEST_SEND_INTERVAL 3 +#define MAXIMUM_CONFIGURATION_REQUEST_BACKOFF_INTERVAL 30 +#define MAXIMUM_TERMINATION_REQUEST_SEND_INTERVAL 3 +#define MAXIMUM_ECHO_REQUEST_SEND_INTERVAL 3 +#define MAXIMUM_ECHO_REQUESTS_NOT_ACKNOWLEDGED 20 +#define MAXIMUM_STRING_LENGTH 80 +#define MAXIMUM_PACKET_LENGTH 2048 +#define DEFAULT_ASYNC_CONTROL_CHARACTER_MAP 0xffffffffL +#define ASYNC_CONTROL_ESCAPE_SEQUENCE 0x7d +#define ASYNC_FLAG_SEQUENCE 0x7e +#define ASYNC_SIXTH_BIT_COMPLEMENT 0x20 +#define INIT_FRAME_CHECK_SEQUENCE 0xffff +#define PPP_DATA_DUMP_WIDTH 16 + +#if ! defined (VARIABLE_NUMBER_OF_BYTES) + #define VARIABLE_NUMBER_OF_BYTES 0x01 +#endif + +#define VARIABLE_NUMBER 0x01 +#define ASYNC_MAXIMUM_TX_ENCODED_PACKET_MULTIPLIER 2 +#define MAXIMUM_APPLETALK_PACKET_LENGTH 599 +#define APPLETALK_STACK_ID 3 +#define MAXIMUM_NUMBER_OF_PROTOCOL_REJECTS_RECEIVED 10 +#define DEFAULT_FCS_TABLE_SIZE 256 +#define DEFAULT_MAGIC_NUMBER 0x00000000L +#define MAXIMUM_NUMBER_OF_NCP_OPTIONS 8 +#define MAXIMUM_SIZE_OF_OPTION 16 +#define PPP_IPX_NAME_SIZE 48 +#define CHALLENGE_VALUE_SIZE 16 +#define RESPONSE_VALUE_SIZE 16 +#define NAME_SIZE 128 +#define FINAL_GOOD_FRAME_CHECK_SEQUENCE 0xf0b8 +#define MAXIMUM_NUMBER_OF_USERS 50 +#define NCP_MASK htons (0x8000) + +#define MAXIMUM_NUMBER_OF_OPTION_TYPES 25 +#define MAXIMUM_NUMBER_OF_CONCATENATED_OPTION_VALUES 3 +#define MAXIMUM_LENGTH_OF_OPTION_TYPE 16 +#define MAXIMUM_LENGTH_OF_OPTION_NAME 80 +#define MAXIMUM_LENGTH_OF_OPTION_NUMBER 3 +#define MAXIMUM_LENGTH_OF_OPTION_STRING 256 +#define MAXIMUM_DISCRIMINATOR_ADDRESS_LENGTH 20 + +typedef enum + { + PPP_IP_NCP_STACK_INDEX, + PPP_IPX_NCP_STACK_INDEX, + PPP_APPLETALK_NCP_STACK_INDEX, + PPP_NETBIOS_NCP_STACK_INDEX, + PPP_BRIDGING_NCP_STACK_INDEX, + + NUMBER_OF_NCP_STACKS + }NCP_STACK_INDEX; + +typedef enum + { + PPP_INITIAL_STATE = 0x00, + PPP_STARTING_STATE = 0x01, + PPP_CLOSED_STATE = 0x02, + PPP_STOPPED_STATE = 0x03, + PPP_CLOSING_STATE = 0x04, + PPP_STOPPING_STATE = 0x05, + PPP_REQUEST_SENT_STATE = 0x06, + PPP_ACK_RECEIVED_STATE = 0x07, + PPP_ACK_SENT_STATE = 0x08, + PPP_OPENED_STATE = 0x09, + + NUMBER_OF_PPP_STATES, + NO_CHANGE_TO_PPP_STATE, + ILLEGAL_PPP_STATE + }PPP_STATE; + +typedef enum + { + PPP_LINK_DEAD, + PPP_LINK_UP, + PPP_LINK_ESTABLISHING, + PPP_LINK_ESTABLISHED_FAILURE, + PPP_LINK_OPENED, + PPP_LINK_AUTHENTICATING, + PPP_LINK_AUTHENTICATED, + PPP_LINK_AUTHENTICATION_FAILED, + PPP_NETWORK_LAYER_PROTOCOL_PHASE, + PPP_NETWORK_LAYER_CLOSING, + PPP_TERMINATE_LINK_PHASE, + PPP_TERMINATED_LINK_GOING_DOWN + }PPP_PHASE; + +typedef enum + { + PPP_UP_EVENT = 0x0000, + PPP_DOWN_EVENT = 0x0001, + PPP_OPEN_EVENT = 0x0002, + PPP_CLOSE_EVENT = 0x0003, + PPP_TIMEOUT_WITH_COUNTER_GREATER_THAN_ZERO_EVENT = 0x0004, + PPP_TIMEOUT_WITH_COUNTER_EXPIRED_EVENT = 0x0005, + PPP_RECEIVE_CONFIGURE_REQUEST_GOOD_EVENT = 0x0006, + PPP_RECEIVE_CONFIGURE_REQUEST_BAD_EVENT = 0x0007, + PPP_RECEIVE_CONFIG_REQUEST_BAD_OPTION_EVENT = 0x0008, + PPP_RECEIVE_CONFIGURE_ACK_EVENT = 0x0009, + PPP_RECEIVE_CONFIGURE_NAK_EVENT = 0x000a, + PPP_RECEIVE_CONFIGURE_REJECT_EVENT = 0x000b, + PPP_RECEIVE_TERMINATE_REQUEST_EVENT = 0x000c, + PPP_RECEIVE_TERMINATE_ACK_EVENT = 0x000d, + PPP_RECEIVE_UNKNOWN_CODE_EVENT = 0x000e, + PPP_RECEIVE_CODE_REJECT_PERMITTED_EVENT = 0x000f, + PPP_RECEIVE_PROTOCOL_REJECT_EVENT = 0x0010, + PPP_RECEIVE_CODE_REJECT_CATASTROPHIC_EVENT = 0x0011, + PPP_RECEIVE_ECHO_REQUEST_EVENT = 0x0012, + PPP_RECEIVE_ECHO_REPLY_EVENT = 0x0013, + PPP_RECEIVE_DISCARD_REQUEST_EVENT = 0x0014, + PPP_ECHO_RESPONSE_TIMEOUT = 0x0015, + PPP_ECHO_RESPONSE_TIMEOUT_FAILURE = 0x0016, + + NUMBER_OF_PPP_EVENTS + }PPP_EVENT; + +typedef enum + { + OPTIONS_RECEIVED_ARE_OK, + SOME_OPTIONS_ARE_NACKED, + SOME_OPTIONS_ARE_REJECTED, + OPTION_PARSING_ERROR + }OPTION_PARSE_RESULT; + +typedef enum + { + OPTION_DEFAULT_STATE, + OPTION_PARSED_STATE, + OPTION_ACKED_STATE, + OPTION_NACKED_STATE, + OPTION_REJECTED_STATE + }OPTION_STATE; + + +typedef enum + { + CONFIGURE_REQUEST = 0x01, + CONFIGURE_ACK = 0x02, + CONFIGURE_NAK = 0x03, + CONFIGURE_REJECT = 0x04, + TERMINATION_REQUEST = 0x05, + TERMINATION_ACK = 0x06, + CODE_REJECT = 0x07, + PROTOCOL_REJECT = 0x08, + PPP_ECHO_REQUEST = 0x09, + PPP_ECHO_REPLY = 0x0a, + DISCARD_REQUEST = 0x0b, + IDENTIFICATION = 0x0c, + TIME_REMAINING = 0x0d, + +#if ( defined (PPP_CCP) || defined (PPP_ECP) ) + RESET_REQUEST = 0x0e, + RESET_ACK = 0x0f, +#endif + NUMBER_OF_PPP_CONTROL_CODES, + PPP_IPCP_CONTROL_CODES_NUM = CODE_REJECT, + + AUTHENTICATION_REQUEST = 0x01, + AUTHENTICATION_ACK = 0x02, + AUTHENTICATION_NAK = 0x03, + CHAP_AUTHENTICATION_ACK = 0x03, + CHAP_AUTHENTICATION_NAK = 0x04, + + CHAP_CHALLENGE = 0x01, + CHAP_RESPONSE = 0x02 + }PPP_CONTROL_CODE; + +#ifdef _PROTOCOL_NUMBERS_ARE_DEFINED_IN_NETWORK_BYTE_ORDER +typedef enum + { + PPP_IP_PROTOCOL = htons (0x0021), + PPP_IPV6_PROTOCOL = htons (0x0057), + IPX_PROTOCOL = htons (0x002b), + APPLETALK_PROTOCOL = htons (0x0029), + VAN_JACOBSON_COMPRESSED_PROTOCOL = htons (0x002d), + VAN_JACOBSON_UNCOMPRESSED_PROTOCOL = htons (0x002f), + IP_COMPRESSION_PROTOCOL = htons (0x0061), + BRIDGING_PROTOCOL = htons (0x0031), + NETBIOS_PROTOCOL = htons (0x003f), + + SPANNING_TREE_BPDU_8021D = htons (0x0201), + SOURCE_ROUTING_BPDU = htons (0x0203), + DEC_LAN_BRIDGE_100 = htons (0x0205), + + IPCP_PROTOCOL = htons (0x8021), + IPV6CP_PROTOCOL = htons (0x8057), + IPXCP_PROTOCOL = htons (0x802b), + ATCP_PROTOCOL = htons (0x8029), + BCP_PROTOCOL = htons (0x8031), + NBFCP_PROTOCOL = htons (0x803f), + + LCP_PROTOCOL = htons (0xc021), + PAP_PROTOCOL = htons (0xc023), + CHAP_PROTOCOL = htons (0xc223), + LINK_QUALITY_PROTOCOL = htons (0xc025) + +#if defined (PPP_CCP) + , /* terminate the previous entry */ + CCP_PROTOCOL = htons (0x80fd), + FIRST_CHOICE_COMPRESSION_PROTOCOL = htons (0x00fd) +#endif + +#if defined (PPP_ECP) + , /* terminate the previous entry */ + ECP_PROTOCOL = htons (0x8053), + FIRST_CHOICE_ENCRYPTION_PROTOCOL = htons (0x0053) +#endif + + , /* terminate the previous entry */ + MULTILINK_PROTOCOL = htons (0x003d) + + , /* terminate the previous entry */ + BAP_PROTOCOL = htons (0xC02D), + BACP_PROTOCOL = htons (0xC02B), + + HC_IPV6 = htons (0x0057), + + HC_FULL_HEADER = htons (0x0061), + HC_COMPRESSED_TCP = htons (0x0063), + HC_COMPRESSED_TCP_NODELTA = htons (0x2063), + HC_COMPRESSED_NON_TCP = htons (0x0065), + + HC_CONTEXT_STATE = htons (0x2065), + + HC_COMPRESSED_RTP_8 = htons (0x0069), + HC_COMPRESSED_RTP_16 = htons (0x2069), + HC_COMPRESSED_UDP_8 = htons (0x0067), + HC_COMPRESSED_UDP_16 = htons (0x2067), + + HC_CONTEXT_STATE_TCP_HEADER_REQUEST= htons (0x3) +}PPP_PROTOCOL_TYPE; + +#else /* THEY ARE DEFINED IN HOST BYTE ORDER */ + +typedef enum + { + PPP_IP_PROTOCOL = 0x0021, + PPP_IPV6_PROTOCOL = 0x0057, + IPX_PROTOCOL = 0x002b, + APPLETALK_PROTOCOL = 0x0029, + VAN_JACOBSON_COMPRESSED_PROTOCOL = 0x002d, + VAN_JACOBSON_UNCOMPRESSED_PROTOCOL = 0x002f, + IP_COMPRESSION_PROTOCOL = 0x0061, + BRIDGING_PROTOCOL = 0x0031, + NETBIOS_PROTOCOL = 0x003f, + + SPANNING_TREE_BPDU_8021D = 0x0201, + SOURCE_ROUTING_BPDU = 0x0203, + DEC_LAN_BRIDGE_100 = 0x0205, + + IPCP_PROTOCOL = 0x8021, + IPV6CP_PROTOCOL = 0x8057, + IPXCP_PROTOCOL = 0x802b, + ATCP_PROTOCOL = 0x8029, + BCP_PROTOCOL = 0x8031, + NBFCP_PROTOCOL = 0x803f, + + LCP_PROTOCOL = 0xc021, + PAP_PROTOCOL = 0xc023, + CHAP_PROTOCOL = 0xc223, + LINK_QUALITY_PROTOCOL = 0xc025 + +#if defined (PPP_CCP) + , /* terminate the previous entry */ + CCP_PROTOCOL = 0x80fd, + FIRST_CHOICE_COMPRESSION_PROTOCOL = 0x00fd +#endif + +#if defined (PPP_ECP) + , /* terminate the previous entry */ + ECP_PROTOCOL = 0x8053, + FIRST_CHOICE_ENCRYPTION_PROTOCOL = 0x0053 +#endif + + , /* terminate the previous entry */ + MULTILINK_PROTOCOL = 0x003d + + , /* terminate the previous entry */ + BAP_PROTOCOL = 0xC02D, + BACP_PROTOCOL = 0xC02B, + + HC_IPV6 = 0x0057, + + HC_FULL_HEADER = 0x0061, + HC_COMPRESSED_TCP = 0x0063, + HC_COMPRESSED_TCP_NODELTA = 0x2063, + HC_COMPRESSED_NON_TCP = 0x0065, + + HC_CONTEXT_STATE = 0x2065, + + HC_COMPRESSED_RTP_8 = 0x0069, + HC_COMPRESSED_RTP_16 = 0x2069, + HC_COMPRESSED_UDP_8 = 0x0067, + HC_COMPRESSED_UDP_16 = 0x2067, + HC_CONTEXT_STATE_TCP_HEADER_REQUEST= 0x3 + }PPP_PROTOCOL_TYPE; +#endif /* _PROTOCOL_NUMBERS_ARE_DEFINED_IN_NETWORK_BYTE_ORDER */ + +typedef enum + { + IP_ADDRESSES_OPTION_TYPE = 0x01, + IP_COMPRESSION_OPTION_TYPE = 0x02, + IP_ADDRESS_OPTION_TYPE = 0x03, + + PRIMARY_DNS_ADDRESS = 0x81, + SECONDARY_DNS_ADDRESS = 0x83 + + }IPCP_OPTION_TYPE; + +typedef enum + { + IPV6_INTERFACE_IDENTIFIER_OPTION_TYPE = 0x01, + IPV6_COMPRESSION_PROTOCOL_OPTION_TYPE = 0x02 + }IPV6CP_OPTION_TYPE; + + +typedef enum + { + SUCCESSFUL = 0x01, + UNSUCCESSFUL = 0x02 + }AUTHENTICATION_STATUS; + +typedef enum + { + PPP_RX_PACKET_TOO_SHORT, + PPP_RX_PACKET_TOO_LONG + }PPP_ALARM_TYPE; + +typedef enum + { + PPP_FLAG_OFF, + PPP_FLAG_ON + } PPP_FLAGS; + +typedef enum + { + PPP_MEMORY_PRINTF, + PPP_ALARM_PRINTF, + PPP_DATA_PRINTF, + PPP_LCP_PRINTF, + PPP_NCP_PRINTF + , /* terminate the previous entry */ + PPP_MP_PRINTF + }PPP_PRINTF_GROUPS; + +typedef enum + { + MD4_ALGORITHM = 0x04, + MD5_ALGORITHM = 0x05 + }AUTHENTICATION_ALGORITHM; + +typedef enum + { + LOCATION_DETERMINED_BY_AUTHENTICATION, + DIALING_STRING, + LOCATION_ID, + _E164_NUMBER, + DISTINGUISHED_NAME + }CALLBACK_OPERATION; + +typedef enum + { + PPP_EVENT_LCP_THIS_LAYER_UP, + PPP_EVENT_LCP_THIS_LAYER_DOWN, + PPP_EVENT_LCP_THIS_LAYER_FINISHED, + PPP_EVENT_LCP_TERMINATION_REQUEST, + PPP_EVENT_LCP_ID_REQUEST, + PPP_EVENT_LCP_ID_REQUEST_RECEIVED, + PPP_EVENT_LCP_TIME_REMAINING_REQUEST, + PPP_EVENT_LCP_TIME_REMAINING_RECEIVED, + + PPP_EVENT_NCP_THIS_LAYER_UP, + PPP_EVENT_NCP_THIS_LAYER_DOWN, + PPP_EVENT_NCP_THIS_LAYER_FINISHED, + + PPP_EVENT_AUTHENTICATE_REQUEST, + PPP_EVENT_AUTHENTICATE_LOOKUP, + PPP_EVENT_AUTHENTICATE_VERIFY, + PPP_EVENT_AUTHENTICATE_ACK_TRANSMITTED, + PPP_EVENT_AUTHENTICATE_ACK_RECEIVED, + PPP_EVENT_AUTHENTICATION_FAILED, + PPP_EVENT_AUTHENTICATION_REFUSED, + + PPP_EVENT_OPTIONS_EXHAUSTED + }PPP_EVENT_UPCALL; + +#endif /* __INCkppph */ + diff --git a/h/ppp/kstart.h b/h/ppp/kstart.h new file mode 100644 index 0000000..2cd046b --- /dev/null +++ b/h/ppp/kstart.h @@ -0,0 +1,156 @@ +/* kstart.h - basic definitions and enums */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01f,11dec02,ijm changed DWORD to PPPWORD to resolve name conflict with vxSim +01e,25aug01,ijm changed WORD to PPPWORD to resolve name conflict with DHCP +01d,29sep00,sj merging with TOR2_0-WINDNET_PPP-CUM_PATCH_2 +01c,01aug00,adb Merging with openstack view +01b,10jul00,md fixed type redefinition +01a,30sep99,sj derived from routerware source base +*/ + +/* + * $Log:: /Rtrware/include/kstart.h $ + * + * 6 1/06/99 2:06p Nishit + * Definition of PARAMETER_NOT_USED in parenthesis to keep lint happy + * + * 5 12/04/98 2:19p Rajive + * Removed pragma warning. + * + * 4 4/30/98 1:16p Rajive + * Overwrote with INCLUDE v4.2.1 + * + * 3 4/27/98 11:42a Release Engineer + * Additions into include for L2TP and RTM modules. + * INCLUDE v4.2.1 + * + * 1 2/13/98 12:18a Release Engineer + * code cleanup, code style changes, linted, system level test + * INCLUDE v4.2.0 + * + * 3 9/09/96 5:10p Ross + * Changes for spanning tree and token ring + * + * 2 3/27/96 7:08p Ross + * Initial check-in with source safe. +*/ +/* $Modname: kstart.h$ $version: 1.4$ $date: 11/12/92$ */ +/* +* $lgb$ +1.0 03/06/92 ross +1.1 03/20/92 ross Delete some useless #defines and enums +1.2 03/20/92 ross added version control header +1.3 06/11/92 ross added GNU to #define interrupt to nada +1.4 11/12/92 ross added USHORT and ULONG support. +* $lge$ +*/ + +#include "vxWorks.h" + +#ifndef __INCkstarth +#define __INCkstarth + +#define IN +#define OUT +#define BOOLEAN BOOL +#define PARAMETER_NOT_USED(parameter_one) (parameter_one = parameter_one) + +#if !defined __RW_UTIL_H__ +typedef unsigned char BYTE; +#endif /* __RW_UTIL_H__ */ + +typedef unsigned char U08; + +typedef unsigned short PPPWORD; +typedef unsigned short U16; + +typedef unsigned long PPPDWORD; +typedef unsigned long U32; + + +#define ULONG_ENUM(enum_name) ULONG +#define USHORT_ENUM(enum_name) USHORT +#define BYTE_ENUM(enum_name) BYTE + +#if !defined __RW_UTIL_H__ +typedef enum { PASS = 1, FAIL = 0} TEST; + +typedef enum + { + LESS_THAN = -1, + EQUAL_TO = 0, + GREATER_THAN = 1 + }SORT_RETURN; + +#define STRINGS_MATCH ((int) 0) +#endif /* __RW_UTIL_H__ */ + +#if defined (GLOBAL_FILE) + #define GLOBAL +#else + #define GLOBAL extern +#endif + +/* nibble - dword macros */ + +#define high_byte_of_ulong(double_word) (((double_word) >> 24) & 0x000000ff) + +#define high_low_byte_of_ulong(double_word) (((double_word) >> 16) & 0x000000ff) + +#define low_high_of_ulong(double_word) (((double_word) >> 8) & 0x000000ff) + +#define low_byte_of_ulong(double_word) ((double_word) & 0x000000ff) + +#define high_byte_of_ushort(ushort) (((ushort)>>8)&0x00ff) + +#define low_byte_of_ushort(ushort) ((ushort)&0x00ff) + +#define low_ushort_of_ulong(double_ushort) (PPPWORD)(((double_ushort) >> 16) & 0x0000ffff) + +#define high_ushort_of_ulong(double_ushort) (PPPWORD)((double_ushort) & 0x0000ffff) + +/* Combine high byte and low byte */ +#if !defined __RW_UTIL_H__ +#define two_bytes_to_ushort(high_byte,low_byte) ((((high_byte)&0x00ff)<<8) |\ + ((low_byte)&0x00ff)) +#endif /* __RW_UTIL_H__ */ + +#define high_byte_of_dword(double_word) (((double_word) >> 24) & 0x000000ff) + +#define high_low_byte_of_dword(double_word) (((double_word) >> 16) & 0x000000ff) + +#define low_high_of_dword(double_word) (((double_word) >> 8) & 0x000000ff) + +#define low_byte_of_dword(double_word) ((double_word) & 0x000000ff) + +#define low_word_of_dword(double_word) (PPPWORD)((double_word) & 0x0000ffff) + +#define high_word_of_dword(double_word) (PPPWORD)(((double_word) >> 16) &\ + 0x0000ffff) + +#define high_byte_of_word(word) (((word)>>8)&0x00ff) +#define low_byte_of_word(word) ((word)&0x00ff) + + /* Combine high byte and low byte */ + +#define two_bytes_to_word(high_byte,low_byte) ((((high_byte) & 0x00ff)<<8)|\ + ((low_byte)&0x00ff)) + +#define high_nibble_of_byte(byte) (((byte)>>4)&0x000f) + +#define low_nibble_of_byte(byte) ((byte)&0x000f) + +#define two_nibbles_to_byte(a,b) ((((a)&0x000f)<<4)|((b)&0x000f)) + +#if !defined (VARIABLE_NUMBER_OF_BYTES) + #define VARIABLE_NUMBER_OF_BYTES 1 +#endif + +#endif /* __INCkstarth */ diff --git a/h/ppp/m2pppIpcpGroup.h b/h/ppp/m2pppIpcpGroup.h new file mode 100644 index 0000000..98e513f --- /dev/null +++ b/h/ppp/m2pppIpcpGroup.h @@ -0,0 +1,73 @@ +/* m2pppIpcpGroup.h - PPP SNMP agent interface library header */ + +/* Copyright 1999 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,06jan00,sj created. +*/ + +#include "pfw/pfw.h" +#include "pfw/pfwTable.h" +#include "pfw/pfwMemory.h" +#include "ppp/m2pppLib.h" +#include "ppp/interfaces/ipcpInterfaces.h" + +#ifndef __INCm2pppIpcpGrouph +#define __INCm2pppIpcpGrouph + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +/* defines for enumerated types as specified by RFC 1473 */ + +/* possible values for pppIpOperStatus */ + +#define M2_pppIpOperStatus_opened 1 +#define M2_pppIpOperStatus_not_opened 2 + +/* possible values for pppIpLocalToRemoteCompressionProtocol */ + +#define M2_pppIpLocalToRemoteCompressionProtocol_none 1 +#define M2_pppIpLocalToRemoteCompressionProtocol_vj_tcp 2 + +/* possible values for pppIpRemoteToLocalCompressionProtocol */ + +#define M2_pppIpRemoteToLocalCompressionProtocol_none 1 +#define M2_pppIpRemoteToLocalCompressionProtocol_vj_tcp 2 + +/* possible values for pppIpLocalToRemoteCompressionProtocol */ + +#define M2_pppIpConfigAdminStatus_open 1 +#define M2_pppIpConfigAdminStatus_close 2 + +/* possible values for pppIpConfigCompression */ + +#define M2_pppIpConfigCompression_none 1 +#define M2_pppIpConfigCompression_vj_tcp 2 + + +/* typedefs */ + +typedef struct PPP_IPCP_ENTRY_DATA + { + PFW_STACK_OBJ * stackObj; + PFW_PLUGIN_OBJ_STATE * state; + PPP_IPCP_MIB_INTERFACE * interface; + }PPP_IPCP_ENTRY_DATA; + +extern STATUS m2pppIpcpGroupRegister (PFW_OBJ * pfwObj); +extern STATUS m2pppIpcpGroupUnregister (PFW_OBJ * pfwObj); +extern STATUS m2pppIpcpEntryLookup (UINT32 oidLen, UINT32 * oid, + PPP_IPCP_ENTRY_DATA * data, + M2_PPP_ENTRY_MATCH_TYPE match); +#ifdef __cplusplus +} +#endif + +#endif /* __INCm2pppIpcpGrouph */ diff --git a/h/ppp/m2pppLib.h b/h/ppp/m2pppLib.h new file mode 100644 index 0000000..d11e891 --- /dev/null +++ b/h/ppp/m2pppLib.h @@ -0,0 +1,55 @@ +/* m2pppLib.h - PPP SNMP agent interface library header */ + +/* Copyright 1999 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01c,14feb00,adb WRS conventions +01b,09feb00,adb Few changes are expected + +01a,06jan00,sj created. +*/ + +#ifndef __INCm2pppLibh +#define __INCm2pppLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define MAX_IF_INDEX 0x7fffffff /* following MIB RFCs specification */ + +#define INVALID_IF_INDEX ~0 + +/* typedefs */ + +typedef enum + { + M2_PPP_ENTRY_EXACT_MATCH, + M2_PPP_ENTRY_NEXT_MATCH + } M2_PPP_ENTRY_MATCH_TYPE; + +/* function declarations */ + +extern STATUS m2pppLibInit(void); +extern STATUS m2pppInterfaceRegister(UINT32 ifIndex, PFW_STACK_OBJ * stackObj); +extern STATUS m2pppInterfaceUnregister(UINT32 ifIndex); +extern STATUS m2pppInterfaceStackObjGet(UINT32 ifIndex, + PFW_STACK_OBJ ** pStackObj); +extern STATUS m2pppNextInterfaceStackObjGet(UINT32 ifIndex, + UINT32 * nextIfIndex, + PFW_STACK_OBJ ** pStackObj); +extern STATUS m2pppPreviousInterfaceStackObjGet(UINT32 ifIndex, + UINT32 * previousIfIndex, + PFW_STACK_OBJ ** pStackObj); +extern STATUS m2pppLibClear (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm2pppLibh */ diff --git a/h/ppp/m2pppLinkGroup.h b/h/ppp/m2pppLinkGroup.h new file mode 100644 index 0000000..a3608e7 --- /dev/null +++ b/h/ppp/m2pppLinkGroup.h @@ -0,0 +1,92 @@ +/* m2pppLinkGroup.h - PPP SNMP agent interface library header */ + +/* Copyright 1999 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01c,24feb00,sj adding MagicNumber Enabled/Disabled Macros +01b,23feb00,sj added a few Enabled/Disable macros +01a,06jan00,sj created. +*/ + +#include "vxWorks.h" +#include "pfw/pfw.h" +#include "pfw/pfwTable.h" +#include "pfw/pfwMemory.h" +#include "ppp/m2pppLib.h" +#include "ppp/interfaces/lcpInterfaces.h" + +#ifndef __INCm2pppLinkGrouph +#define __INCm2pppLinkGrouph + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines for enumerated types as specified by RFC 1471 */ + +#define M2_PPP_OPTION_DISABLED 2 + +/* possible values for pppLinkStatusLocalToRemoteProtocolCompression */ + +#define M2_pppLinkStatusLocalToRemoteProtocolCompression_enabled TRUE +#define M2_pppLinkStatusLocalToRemoteProtocolCompression_disabled \ + M2_PPP_OPTION_DISABLED + + +/* possible values for pppLinkStatusRemoteToLocalProtocolCompression */ + +#define M2_pppLinkStatusRemoteToLocalProtocolCompression_enabled TRUE +#define M2_pppLinkStatusRemoteToLocalProtocolCompression_disabled \ + M2_PPP_OPTION_DISABLED + +/* possible values for pppLinkStatusLocalToRemoteACCompression */ + +#define M2_pppLinkStatusLocalToRemoteACCompression_enabled TRUE +#define M2_pppLinkStatusLocalToRemoteACCompression_disabled \ + M2_PPP_OPTION_DISABLED + +/* possible values for pppLinkStatusRemoteToLocalACCompression */ + +#define M2_pppLinkStatusRemoteToLocalACCompression_enabled TRUE +#define M2_pppLinkStatusRemoteToLocalACCompression_disabled \ + M2_PPP_OPTION_DISABLED + +/* possible values for pppLinkConfigMagicNumber */ + +#define M2_pppLinkConfigMagicNumber_enabled 2 +#define M2_pppLinkConfigMagicNumber_disabled 1 + +/* typedefs */ + +typedef struct PPP_LINK_CONFIG_ENTRY_DATA + { + PFW_STACK_OBJ * stackObj; + PFW_PLUGIN_OBJ_STATE * state; + PPP_LINK_CONFIG_ENTRY_INTERFACE * interface; + }PPP_LINK_CONFIG_ENTRY_DATA; + +typedef struct PPP_LINK_STATUS_ENTRY_DATA + { + PFW_STACK_OBJ * stackObj; + PFW_PLUGIN_OBJ_STATE * state; + PPP_LINK_STATUS_ENTRY_INTERFACE * interface; + }PPP_LINK_STATUS_ENTRY_DATA; + +extern STATUS m2pppLinkGroupRegister (PFW_OBJ * pfwObj); +extern STATUS m2pppLinkGroupUnregister (PFW_OBJ * pfwObj); +extern STATUS m2pppLinkStatusEntryLookup (UINT32 oidLen, UINT32 * oid, + PPP_LINK_STATUS_ENTRY_DATA * data, + M2_PPP_ENTRY_MATCH_TYPE match); + +extern STATUS m2pppLinkConfigEntryLookup (UINT32 oidLen, UINT32 * oid, + PPP_LINK_CONFIG_ENTRY_DATA * data, + M2_PPP_ENTRY_MATCH_TYPE match); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm2pppLinkGrouph */ diff --git a/h/ppp/m2pppSecurityConfig.h b/h/ppp/m2pppSecurityConfig.h new file mode 100644 index 0000000..6e2170c --- /dev/null +++ b/h/ppp/m2pppSecurityConfig.h @@ -0,0 +1,49 @@ +/* m2pppSecurityConfig.h - PPP SNMP agent interface library header */ + +/* Copyright 1999 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,06jan00,sj created. +*/ + +#include "pfw/pfw.h" +#include "pfw/pfwTable.h" +#include "pfw/pfwMemory.h" +#include "ppp/m2pppLib.h" +#include "ppp/m2pppSecuritySecretsLib.h" +#include "ppp/interfaces/lcpInterfaces.h" + +#ifndef __INCm2pppSecurityConfigh +#define __INCm2pppSecurityConfigh + +#ifdef __cplusplus +extern "C" { +#endif + +/* typedefs */ + +typedef struct PPP_SECURITY_CONFIG_ENTRY_DATA + { + PFW_PLUGIN_OBJ_STATE * state; + PFW_INTERFACE_OBJ * interface; + UINT32 link; + UINT32 preference; + PPP_SECURITY_PROTOCOL protocol; + PPP_SECURITY_SECRETS_STATUS status; + }PPP_SECURITY_CONFIG_ENTRY_DATA; + +extern STATUS m2pppSecurityConfigRegister (PFW_OBJ * pfwObj); +extern STATUS m2pppSecurityConfigUnregister (PFW_OBJ * pfwObj); +extern STATUS m2pppSecurityConfigEntryLookup (UINT32 oidLen, UINT32 * oid, + PPP_SECURITY_CONFIG_ENTRY_DATA * data, + M2_PPP_ENTRY_MATCH_TYPE match); +extern STATUS m2pppSecurityConfigEntrySet(PPP_SECURITY_CONFIG_ENTRY_DATA *data); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm2pppSecurityConfigh */ diff --git a/h/ppp/m2pppSecuritySecretsLib.h b/h/ppp/m2pppSecuritySecretsLib.h new file mode 100644 index 0000000..1a89abe --- /dev/null +++ b/h/ppp/m2pppSecuritySecretsLib.h @@ -0,0 +1,199 @@ +/* m2pppSecuritySecretsLib.h - SNMP pppSecuritySecretsTable library header */ + +/* Copyright 2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01f,01jun04,ijm add prototypes for m2pppSecretsEntryDelete and + m2pppSecretsEntryAgentDelete, SPR#90565 +01e,28may02,rvr fixed build warnings (teamf1) +01d,14feb00,adb WRS coding conventions +01c,11feb00,adb added MAX_LINK and MAX_ID_INDEX +01b,11feb00,adb minor naming changes. +01a,30jan00,abd created. +*/ + +#ifndef __INCm2pppSecuritySecretsLibh +#define __INCm2pppSecuritySecretsLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "avlLib.h" + +/* defines */ + +#define MAX_LINK 0x7fffffff /* following MIB RFCs specification */ +#define INVALID_LINK ~0 + +#define MAX_ID_INDEX 0x7fffffff /* following MIB RFCs specification */ +#define INVALID_ID_INDEX ~0 + +/* enums */ + +typedef enum pppSecurityDirection + { + PPP_SECURITY_SECRETS_DIRECTION_UNDEFINED = 0, + PPP_SECURITY_SECRETS_DIRECTION_LOCAL_TO_REMOTE = 1, + PPP_SECURITY_SECRETS_DIRECTION_REMOTE_TO_LOCAL = 2 + } PPP_SECURITY_SECRETS_DIRECTION; + +typedef enum pppSecurityProtocol + { + PPP_SECURITY_UNDEFINED_PROTOCOL = 0, + PPP_SECURITY_PAP_PROTOCOL = 1, + PPP_SECURITY_CHAP_MD5_PROTOCOL = 2 + } PPP_SECURITY_PROTOCOL; + +typedef enum pppSecurityStatus + { + PPP_SECURITY_SECRETS_STATUS_UNDEFINED = 0, + PPP_SECURITY_SECRETS_STATUS_INVALID = 1, + PPP_SECURITY_SECRETS_STATUS_VALID = 2 + } PPP_SECURITY_SECRETS_STATUS; + +/* typedefs */ + +typedef struct pppSecuritySecretsDataEntry + /* + * This would be the node of the auxiliary tree on which the actual + * data of a pppSecuritySecretsEntry are stored. The index for this + * tree will be the ordered quadraple (Link, Direction, Protocol, Identity). + * Notice that the implementation of node addition and deletion + * is responsible for deleting a node from both trees atomically + * and for adding a node to both trees atomically. Hence, implicitly + * we enforce uniqueness with respect to both main and auxiliary keys. + */ + { + AVL_NODE avlBase; + UINT32 pppSecuritySecretsLink; + /* + * (0..2^(31)-1) + * 0 is reserved for default choices + */ + UINT32 pppSecuritySecretsIdIndex; + /* + * (0..2^(31)-1) + * (Link, IdIndex) indexes the table + */ + PPP_SECURITY_SECRETS_DIRECTION pppSecuritySecretsDirection; + PPP_SECURITY_PROTOCOL pppSecuritySecretsProtocol; + char * pppSecuritySecretsIdentity; + char * pppSecuritySecretsSecret; + PPP_SECURITY_SECRETS_STATUS pppSecuritySecretsStatus; + } PPP_SECURITY_SECRETS_DATA_ENTRY; + +typedef struct pppSecuritySecretsEntry + { + AVL_NODE avlBase; + PPP_SECURITY_SECRETS_DATA_ENTRY * pSecretsDataEntry; + /* + * it points to the auxiliary tree + * node on which the actual data of a + * pppSecuritySecretsEntry are stored. + */ + } PPP_SECURITY_SECRETS_ENTRY; + +/* function declarations */ + +extern STATUS m2pppSecuritySecretsLibInit(void); +extern STATUS m2pppSecuritySecretsLibClear(void); + +/* pppSecuritySecretsData manipulation functions */ + +extern STATUS m2pppSecretsEntrySet + ( + UINT32 link, + PPP_SECURITY_SECRETS_DIRECTION direction, + PPP_SECURITY_PROTOCOL protocol, + char * identity, + char * secret, + PPP_SECURITY_SECRETS_STATUS status + ); + +extern STATUS m2pppSecretsSecretGet + /* + * this routine receives as input the data composing the auxiliary key + * (link, direction, protocol, identity) and a buffer in which, if an entry + * with the given key exists, the corresponding secret will be written. + */ + ( + UINT32 link, + PPP_SECURITY_SECRETS_DIRECTION direction, + PPP_SECURITY_PROTOCOL protocol, + char * identity, + char * secret + ); + +/* pppSecuritySecrets manipulation functions */ + +extern STATUS m2pppSecretsEntryAgentSet + ( + UINT32 link, + UINT32 idIndex, + PPP_SECURITY_SECRETS_DIRECTION * pDirection, + PPP_SECURITY_PROTOCOL * pProtocol, + char * identity, + char * secret, + PPP_SECURITY_SECRETS_STATUS status + ); + +extern STATUS m2pppSecretsEntryAgentLookup + ( + /* + * This and the next Get routines receive as input the SNMP indexing key + * (link, idIndex) and if successful they write the appropriate data in the + * places pointed by pDirection, pProtocol, identity, secret, and pStatus. + */ + UINT32 link, + UINT32 idIndex, + PPP_SECURITY_SECRETS_DIRECTION * pDirection, + PPP_SECURITY_PROTOCOL * pProtocol, + char * identity, + char * secret, + PPP_SECURITY_SECRETS_STATUS * pStatus + ); + +extern STATUS m2pppNextSecretsEntryAgentLookup + ( + UINT32 SNMPcompc, + UINT32 * pLink, + UINT32 * pIdIndex, + /* after a successful call the Link and IdIndex of the + * lexicographically successor entry will be placed in + * the positions pointed by pLink and pIdIndex + */ + PPP_SECURITY_SECRETS_DIRECTION * pDirection, + PPP_SECURITY_PROTOCOL * pProtocol, + char * identity, + char * secret, + PPP_SECURITY_SECRETS_STATUS * pStatus + ); + +extern STATUS m2pppSecretsEntryDelete + ( + UINT32 link, /* pppSecuritySecretsLink */ + PPP_SECURITY_SECRETS_DIRECTION direction, /* pppSecuritySecretsDirection */ + PPP_SECURITY_PROTOCOL protocol, /* pppSecuritySecretsProtocol */ + char * identity /* pppSecuritySecretsIdentity */ + ); + +extern STATUS m2pppSecretsEntryAgentDelete + ( + UINT32 link, /* pppSecuritySecretsLink part of input key */ + UINT32 idIndex /* pppSecuritySecretsIdIndex part of input key */ + ); + +STATUS m2pppSecurityLocalSecretsShow(void); +STATUS m2pppSecurityPeerSecretsShow(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm2pppSecurityLibh */ diff --git a/h/ppp/magic.h b/h/ppp/magic.h new file mode 100644 index 0000000..307f918 --- /dev/null +++ b/h/ppp/magic.h @@ -0,0 +1,53 @@ +/* magic.h - PPP Magic Number header */ + +/* Copyright 1995 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +/* +modification history +-------------------- +01a,16jan95,dzb WRS-ize. +*/ + +#ifndef __INCmagich +#define __INCmagich + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void magic_init (void); /* Init the magic number generator */ +extern u_long magic (void); /* Returns the next magic number */ + +#else /* __STDC__ */ + +extern void magic_init (); /* Init the magic number generator */ +extern u_long magic (); /* Returns the next magic number */ + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmagich */ diff --git a/h/ppp/mp.h b/h/ppp/mp.h new file mode 100644 index 0000000..b5a4538 --- /dev/null +++ b/h/ppp/mp.h @@ -0,0 +1,107 @@ +/* mp.h - MP header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01k,22oct02,sj splitting mp.h into mp.h and mpP.h +01j,25jun02,rp adding missed multilink patch 2 changes +01i,28may02,rvr fixed build warnings (teamf1) +01h,19apr02,jr packed the structures for ARM fixes. +01g,20mar02,rp adding newline at end of file +01f,08oct01,ak Added PPP_WITH_MAC_HEADER_LENGTH +01e,19sep01,ak added MAX_CLUSTER_SIZE +01d,06sep01,ijm adding remoteMRU. Corrected size of local and remote_user + name arrays. +01c,30aug01,ak Added MP_PROFILE_STRING_SIZE +01b,27aug01,ak Added one variable in the MP_BUNDLE_SENDING_END_CLASS for + supporting rotating the member links for non-fragmented + packets +01a,19feb01,ak derived from routerware source base +*/ + +#ifndef __INCmph +#define __INCmph + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" +#include "ppp/kppp.h" +#include "ppp/kstart.h" +#include "sllLib.h" +#include "pfw/pfw.h" +#include "pfw/pfwStack.h" +#include "pfw/pfwComponent.h" +#include "pfw/pfwLayer.h" +#include "pfw/pfwTable.h" +#include "pfw/pfwEvent.h" +#include "pfw/pfwMemory.h" +#include "pfw/pfwInterface.h" +#include "rngLib.h" + + +/* defines */ + +#ifndef MAXIMUM_DISCRIMINATOR_ADDRESS_LENGTH +#define MAXIMUM_DISCRIMINATOR_ADDRESS_LENGTH 200 +#endif + +/* Bundle Identifier structures */ + +typedef struct MP_DISCRIMINATOR_CLASS + { + BYTE discriminatorClass; + BYTE length; + BYTE address[MAXIMUM_DISCRIMINATOR_ADDRESS_LENGTH]; + } MP_DISCRIMINATOR_CLASS; + +typedef struct MP_BUNDLE_IDENTIFIER + { + BOOL link_failed_to_be_authenticated; + MP_DISCRIMINATOR_CLASS local_station_discriminator; + MP_DISCRIMINATOR_CLASS remote_station_discriminator; + char local_user_name[NAME_SIZE]; + char remote_user_name[NAME_SIZE]; + } MP_BUNDLE_IDENTIFIER; + +/* LCP Bundle options related structures */ + +typedef struct LCP_BUNDLE_OPTIONS + { + ULONG localMRRU; + ULONG remoteMRRU; + ULONG localMRU; + ULONG remoteMRU; + BOOL use_short_sequence_number_in_tx_end; + BOOL use_short_sequence_number_in_rx_end; + MP_BUNDLE_IDENTIFIER bundle_identifier; + USHORT localAuthProtocol; + USHORT remoteAuthProtocol; + BOOL is_link_in_sending_end; + BOOL is_link_in_receiving_end; + USHORT local_link_discriminator; + USHORT remote_link_discriminator; + } LCP_BUNDLE_OPTIONS; + + +typedef enum + { + MP_BUNDLE_CLOSED_STATE = 0x00, + MP_BUNDLE_OPENED_STATE = 0x01, + MP_BUNDLE_INVALID_STATE = 0xff + }MP_BUNDLE_STATE; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmph */ + + diff --git a/h/ppp/mpAPI.h b/h/ppp/mpAPI.h new file mode 100644 index 0000000..a5d1fa7 --- /dev/null +++ b/h/ppp/mpAPI.h @@ -0,0 +1,146 @@ +/* mpAPI.h - MP user interfaces functions include file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,18dec01,ak support for dynamic assignment of MP Member Stack to Manager + Stack + +01a,21feb01,as created +*/ + +#ifndef __INCmpAPIh +#define __INCmpAPIh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "pfw/pfw.h" +#include "pfw/pfwStack.h" +#include "ppp/mp.h" +#include "pfw/pfwProfile.h" + +/* externs */ + +extern PFW_STACK_OBJ * mpBundleCreate + ( + PFW_PROFILE_OBJ *pProfileObj, /* profile object */ + PFW_STACK_OBJ_CALLBACKS * callbacks, /* Callback function for pfwStackAdd ()*/ + void *userHandle + ); + +extern STATUS mpBundleClose + ( + PFW_STACK_OBJ *pManagerStackObj /* manger stack object */ + ); + +extern STATUS mpBundleDelete + ( + PFW_STACK_OBJ *pManagerStackObj /* manger stack object */ + ); + +extern STATUS apiMpLinkAssign + ( + PFW_STACK_OBJ *pMemberStackObj, /* member stack object */ + PFW_STACK_OBJ *pManagerStackObj /* manger stack object */ + ); + +extern PFW_STACK_OBJ * mpLinkAdd + ( + PFW_PROFILE_OBJ *pProfileObj, /* profile for member stack */ + PFW_STACK_OBJ_CALLBACKS * callbacks, /* Callback function for + pfwStackAdd ()*/ + void *userHandle + + ); + +extern STATUS mpBundleListShow + ( + PFW_OBJ * pfwObj /* framework object */ + ); + +extern STATUS mpMemberList + ( + PFW_STACK_OBJ *managerStackObj /* manager stack object */ + ); + +extern TEST mpFindAPortToBundleMapping + ( + PFW_STACK_OBJ *pMemberStackObj, /* member stack object */ + PFW_STACK_OBJ **pManagerStackObj /* manager stack object */ + ); + +extern TEST mpSetPortToBundleMapping + ( + PFW_STACK_OBJ *pMemberStackObj, /* member stack object */ + PFW_STACK_OBJ *pManagerStackObj /* manager stack object */ + ); + +extern MP_BUNDLE_STATE mpGetBundleState + ( + PFW_STACK_OBJ *pManagerStackObj /* manager stack object */ + ); + +extern int mpGetNoOfLinksInTheBundle + ( + PFW_STACK_OBJ *pManagerStackObj /* manager stack object */ + ); + +extern int mpGetNoOfLinksInTheSendingEndOfTheBundle + ( + PFW_STACK_OBJ *pManagerStackObj /* manager stack object */ + ); + +extern int mpGetNoOfLinksInTheReceivingEndOfTheBundle + ( + PFW_STACK_OBJ *pManagerStackObj /* manager stack object */ + ); + +extern USHORT mpGetNoOfBundles + ( + PFW_OBJ *pfwObj /* framework object */ + ); + +extern STATUS mpIsLinkInSendingEnd + ( + PFW_STACK_OBJ *pMemberStackObj, /* member stack object */ + PFW_STACK_OBJ **pManagerStackObj /* manager stack object */ + ); + +extern STATUS mpIsLinkInReceivingEnd + ( + PFW_STACK_OBJ *pMemberStackObj, /* member stack object */ + PFW_STACK_OBJ **pManagerStackObj /* manager stack object */ + ); + +extern PFW_STACK_OBJ *mpManagerStackObjForBundleIdGet + ( + PFW_OBJ *pfwObj, /* framework obj pointer */ + MP_BUNDLE_IDENTIFIER *id /* bundle identifier */ + ); + +extern BOOL isNoEidNoAuthCase + ( + MP_BUNDLE_IDENTIFIER *id /* bundle identifier */ + ); + +extern STATUS mpRemovePortToBundleMapping (PFW_STACK_OBJ *); + +extern STATUS mpIsLinkInReceivingEnd (PFW_STACK_OBJ *, PFW_STACK_OBJ **); + +extern STATUS mpIsLinkInSendingEnd (PFW_STACK_OBJ *, PFW_STACK_OBJ **); + +extern PFW_STACK_OBJ * mpGetManagerStackObj (UINT, PFW_OBJ *); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmpAPIh */ diff --git a/h/ppp/portmanager.h b/h/ppp/portmanager.h new file mode 100644 index 0000000..ab0f120 --- /dev/null +++ b/h/ppp/portmanager.h @@ -0,0 +1,72 @@ +/* portmanager.h - port manger function definitions */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,19sep01,as created +*/ + +/* +*$Log:: /Rtrware/devdrvrs/ppp/vlcpstr $ + * + * 7 10/01/98 11:43a Alex + * Updated the PPP source code to conform + * to a single build. + * + * 6 4/30/98 3:03p Alex + * Ppp v4.2.0 check in + * + * 1 4/24/98 12:10a Release Engineer + * code cleanup, code style changes, + * linted, system level test + * PPP v4.2.0 +*/ + +#ifndef __INCportmanagerh +#define __INCportmanagerh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "ppp/kstart.h" +#include "ppp/kppp.h" +#include "private/ppp/vpppstr.h" +#include "ppp/kbacpif.h" +#include "sllLib.h" + +/* portmanager.c */ + +STATUS pmPortFindAndReserve (PORT_CONNECTION_INFO *pPortToReserve); + +STATUS pmFindAndReserveMultiplePort (PFW_OBJ *pfwObj, SL_LIST * pPortToReserve); + +PFW_STACK_OBJ * pmPortActivate + (SL_LIST * portListToCall, PFW_STACK_OBJ * pBundleId); + +PFW_STACK_OBJ * pmPortActivateAndWait + (SL_LIST * portListToCall, PFW_STACK_OBJ * pBundleId); + +STATUS pmPortUnreserve (PORT_CONNECTION_INFO * pPortUnreserve); + +STATUS pmPortUnreserveByPort (USHORT portNumber, PFW_STACK_OBJ * pfwStackObj); + + +/* Port Manager utility function defination */ + +STATUS pmPortToListAdd (LINK_INFO * pLinkInfo); + +STATUS pmPortListDelete (USHORT portNumberToDelete); + +void pmPortListPrint (); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCportmanagerh */ diff --git a/h/ppp/pppAdapterLayer.h b/h/ppp/pppAdapterLayer.h new file mode 100644 index 0000000..567bf5a --- /dev/null +++ b/h/ppp/pppAdapterLayer.h @@ -0,0 +1,31 @@ +/* pppAdapterLayer.h - Adapter Layer header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,13jan02,ijm added extern "C" for C++ +01a,08nov99,sj Written +*/ + +#ifndef __INCpppAdapterLayerh +#define __INCpppAdapterLayerh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "pfw/pfw.h" + +STATUS pppAdapterLayerCreate (PFW_OBJ * pfw); +STATUS pppAdapterLayerDelete (PFW_OBJ * pfw); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppAdapterLayerh */ diff --git a/h/ppp/pppAsyncFramingComponent.h b/h/ppp/pppAsyncFramingComponent.h new file mode 100644 index 0000000..fc0d437 --- /dev/null +++ b/h/ppp/pppAsyncFramingComponent.h @@ -0,0 +1,31 @@ +/* pppAsyncFramingComponent.h - Async Framing component header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,13jan02,ijm added extern "C" for C++ +01a,07nov99,sgv Written +*/ + +#ifndef __INCpppAsyncFramingComponenth +#define __INCpppAsyncFramingComponenth + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "pfw/pfw.h" + +STATUS pppAsyncFramingComponentCreate (PFW_OBJ * pfw); +STATUS pppAsyncFramingComponentDelete (PFW_OBJ * pfw); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppAsyncFramingComponenth */ diff --git a/h/ppp/pppBacpComponent.h b/h/ppp/pppBacpComponent.h new file mode 100644 index 0000000..5e463f3 --- /dev/null +++ b/h/ppp/pppBacpComponent.h @@ -0,0 +1,86 @@ +/* pppBacpComponent.h - BACP component header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,01feb01,sd created +*/ + +#ifndef __INCpppBacpComponenth +#define __INCpppBacpComponenth + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "vxWorks.h" +#include "pfw/pfw.h" + +/* Profile Parameters + * -------------------- + * NAME VALUES/EXPLANATION + * ------ -------------------- + * The following are RFC 2125 defined BACP negotiation options + * + * bacp_FP Favored peer + * + * The following are implementation specific BACP configuration parameters; + * + * NOTE:All time intervals and timeout paramters are measured in SECONDS. Also + * all of the parameters must be set using quoted integer values; e.g. "20" + * + * bacp_maxConfigRequests Maximum number of Configuration requests + * to send in one attempt + * bacp_configReqSendInterval Interval between Configuration requests in + * an attempt + * + * bacp_configReqBackoffInterval Backoff interval between attempts. when + * this interval expires BACP cycles through + * a DOWN followed by an UP event triggering + * another set, "bacp_maxConfigRequests", + * of configuration requests + * + * bacp_maxConfigFailures Maximum number of configuration failures + * in an attempt. + + * bacp_maxTerminationRequests Maximum number of unacknowledged + * Termination requests to send. + * + * bacp_TerminationReqInterval Interval between Termination Requests + * + * bap_maxCallRequests Maximum number of call requests to send + * in one attempt. + * bap_callRequestSendInterval Interval between two call requests + * + * bap_maxCallbackRequests Maximum number of call back requests to + * send in one attempt. + * bap_callRequestSendInterval Interval between two call back requests + * + * bap_maxLinkdropRequests Maximum number of link drop requests to send + * in one attempt. + * bap_linkdropRequestSendInterval Interval between two link drop requests + * + * bap_maxIndications Maximum number of indications to send + * in one attempt. + * bap_indicationSendInterval Interval between two indications + */ + +/* + * BACP SUPPORTED INTERFACES: see ./interfaces/bacpInterfaces.h + */ + +/* User interfaces */ + +STATUS bacpComponentCreate (PFW_OBJ * pfw); +STATUS bacpComponentDelete (PFW_OBJ * pfw); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppBacpComponenth */ diff --git a/h/ppp/pppBitSyncFramingComponent.h b/h/ppp/pppBitSyncFramingComponent.h new file mode 100644 index 0000000..8f91bc2 --- /dev/null +++ b/h/ppp/pppBitSyncFramingComponent.h @@ -0,0 +1,31 @@ +/* pppBitSyncFramingComponent.h - Bit Synchronous Framing component header */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,13jan02,ijm added extern "C" for C++ +01a,07nov99,sgv Written +*/ + +#ifndef __INCpppBitSyncFramingComponenth +#define __INCpppBitSyncFramingComponenth + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "pfw/pfw.h" + +STATUS pppBitSyncFramingComponentCreate (PFW_OBJ * pfw); +STATUS pppBitSyncFramingComponentDelete (PFW_OBJ * pfw); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppBitSyncFramingComponenth */ diff --git a/h/ppp/pppChapComponent.h b/h/ppp/pppChapComponent.h new file mode 100644 index 0000000..89be850 --- /dev/null +++ b/h/ppp/pppChapComponent.h @@ -0,0 +1,47 @@ +/* pppChapComponent.h - PPP Authentication header */ + +/* Copyright 1999 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,13jan02,ijm added extern "C" for C++ +01a,23oct99,sgv created from routerware source +*/ + +#ifndef __INCpppChapComponenth +#define __INCpppChapComponenth + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "pfw/pfw.h" + +/* Profile Parameters + * -------------------- + * NAME VALUES/EXPLANATION + * ------ -------------------- + * chap_localUserName Name of the local user name + * chap_maxRetries Maximum number of unacknowledged chap + * challange or responese messages to send + * + * chap_retryInterval Interval (in seconds) between two + * unacknowledged chap challenge messages or + * two unacknowledged chap response messages + * + * chap_challengeInterval Interval (in seconds) between periodic + * challenge messages + */ + +extern STATUS pppChapComponentCreate (PFW_OBJ *pfw); +extern STATUS pppChapComponentDelete (PFW_OBJ *pfw); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppChapComponenth */ + diff --git a/h/ppp/pppChecksum.h b/h/ppp/pppChecksum.h new file mode 100644 index 0000000..5421590 --- /dev/null +++ b/h/ppp/pppChecksum.h @@ -0,0 +1,43 @@ +/* pppChecksum.h - ppp checksum library header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,16feb00,sj changing definition of PPP_*BIT_FCS +01a,29dec99,sj created +*/ + +#ifndef __INCpppChecksumh +#define __INCpppChecksumh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "netBufLib.h" + +#define PPPINITFCS32 0xffffffff /* Initial 32 bit FCS value */ +#define PPPGOODFCS32 0xdebb20e3 /* Good final 32 bit FCS value */ + +#define PPPINITFCS16 0xffff /* Initial 16 bit FCS value */ +#define PPPGOODFCS16 0xf0b8 /* Good final 16 bit FCS value */ + +#define PPP_NULL_FCS 0 +#define PPP_16BIT_FCS 16 +#define PPP_32BIT_FCS 32 +#define PPP_DEFAULT_FCS_SIZE PPP_16BIT_FCS + +extern UINT16 calculate16BitFcs ( UINT16 fcs, M_BLK_ID frame); +extern UINT32 calculate32BitFcs ( UINT32 fcs, M_BLK_ID frame); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppChecksumh */ + + diff --git a/h/ppp/pppControlLayer.h b/h/ppp/pppControlLayer.h new file mode 100644 index 0000000..74856ea --- /dev/null +++ b/h/ppp/pppControlLayer.h @@ -0,0 +1,36 @@ +/* pppControlLayer.h - PPP muxAdapter interface */ + +/* Copyright 1984-1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,08nov99,sj created +*/ + +#ifndef __INCpppControlLayerh +#define __INCpppControlLayerh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Profile Parameters + * -------------------- + * NAME VALUES/EXPLANATION + * ------ -------------------- + * "ppp_secretsDatabase" Specifies the use of a "LOCAL" or "EXTERNAL" + * secrets database for retrieving the password + * or secret to authenticate a peer or + * authenticate with a peer + */ + +/* User interfaces */ + +extern STATUS pppControlLayerCreate (PFW_OBJ * pfw); +extern STATUS pppControlLayerDelete (PFW_OBJ * pfw); +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppControlLayerh */ diff --git a/h/ppp/pppFramingLayer.h b/h/ppp/pppFramingLayer.h new file mode 100644 index 0000000..d90ead2 --- /dev/null +++ b/h/ppp/pppFramingLayer.h @@ -0,0 +1,31 @@ +/* pppFramingLayer.h - Framing Layer header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,13jan02,ijm added extern "C" for C++ +01a,08nov99,sj Written +*/ + +#ifndef __INCpppFramingLayerh +#define __INCpppFramingLayerh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "pfw/pfw.h" + +STATUS pppFramingLayerCreate (PFW_OBJ * pfw); +STATUS pppFramingLayerDelete (PFW_OBJ * pfw); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppFramingLayerh */ diff --git a/h/ppp/pppHeaderCompression.h b/h/ppp/pppHeaderCompression.h new file mode 100644 index 0000000..ac4be85 --- /dev/null +++ b/h/ppp/pppHeaderCompression.h @@ -0,0 +1,112 @@ +/* pppHeaderCompression.h - PPP Header Compression header file */ + +/* Copyright 2002 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01d,14jan03,adb branching to tor2_2.windnet_ppp2_0 +01c,23aug02,adb testing do not check in +01b,26jun02,adb restricting nonTcpSpace +01a,23apr02,adb created +*/ + +#ifndef __INCpppHeaderCompressionh +#define __INCpppHeaderCompressionh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + +/* defines */ + +/* defined in RFC 2509 */ + +#define HC_MIN_WRAP 3 /* in secs */ + +#define HC_EXPECT_REORDERING 0 + +#define HC_MAX_TCP_SPACE 255 + +#if 0 +#define HC_MAX_NON_TCP_SPACE 65535 /* RFC 2507 but we allow only 255 */ +#endif +#define HC_MAX_NON_TCP_SPACE 255 + +#define HC_MAX_NON_TCP_GENERATION 63 + +/* PPP negotiated */ + +#define MIN_HC_TCP_SPACE 3 +#define DFT_HC_TCP_SPACE 15 +#define MAX_HC_TCP_SPACE HC_MAX_TCP_SPACE + +#define MIN_HC_NON_TCP_SPACE 3 +#define DFT_HC_NON_TCP_SPACE 15 +#define MAX_HC_NON_TCP_SPACE HC_MAX_NON_TCP_SPACE + +#define MIN_HC_F_MAX_PERIOD 32 +#define DFT_HC_F_MAX_PERIOD 256 +#define MAX_HC_F_MAX_PERIOD 1024 + +#define MIN_HC_F_MAX_TIME 1 /* in secs */ +#define DFT_HC_F_MAX_TIME 5 /* in secs */ +#define MAX_HC_F_MAX_TIME 20 /* in secs */ + +#define MIN_HC_MAX_HEADER 40 +#define DFT_HC_MAX_HEADER 168 +#define MAX_HC_MAX_HEADER 512 + +#define HC_RTP_COMPRESSION_ENABLED 0 + +/* Protocol over PPP Header Compression Configuration Parameters */ + +#define DFT_HC_TCP_CONTENT_INSPECT 1 + +#define DFT_HC_TWICE_ALGORITHM_ENABLED 0 +#define DFT_HC_USE_DEFAULT_TCP_CHECKSUM_FCTPTR 0 +#define DFT_HC_DEFAULT_TCP_CHECKSUM_FCTPTR 0 + +#define MIN_HC_CONTEXT_STATE_SEND_PERIOD 1 +#define DFT_HC_CONTEXT_STATE_SEND_PERIOD 5 +#define MAX_HC_CONTEXT_STATE_SEND_PERIOD 25 + +#define MIN_HC_CONTEXT_STATE_SEND_TIME 100 /* in msecs */ +#define DFT_HC_CONTEXT_STATE_SEND_TIME 300 /* in msecs */ +#define MAX_HC_CONTEXT_STATE_SEND_TIME 10000 /* in msecs */ + +#define MIN_HC_STORED_PACKETS_QUEUE_SIZE 0 /* defunct */ +#define DFT_HC_STORED_PACKETS_QUEUE_SIZE 0 +#define MAX_HC_STORED_PACKETS_QUEUE_SIZE 25 + +#define MIN_HC_HYSTERESIS_TIME 47 /* in msecs; the minimum value + * equals 3000/64, which is the + * quotient of HC_MIN_WRAP over + * (HC_MAX_NON_TCP_GENERATION+1) + */ +#define DFT_HC_HYSTERESIS_TIME 60000000 /* in msecs */ +#define MAX_HC_HYSTERESIS_TIME 60000000 /* in msecs */ + +typedef struct hcPppConfigurationOption + { + BOOL isActive; + + USHORT protocol; + + USHORT tcpSpace; + USHORT nonTcpSpace; + USHORT fMaxPeriod; + USHORT fMaxTime; + USHORT maxHeader; + BOOL rtpCompressionEnabled; + } HC_PPP_CONFIGURATION_OPTION; + +#ifdef __cplusplus + +#endif + +#endif /* __INCpppHeaderCompressionh */ diff --git a/h/ppp/pppInterfaceLayer.h b/h/ppp/pppInterfaceLayer.h new file mode 100644 index 0000000..8da8a07 --- /dev/null +++ b/h/ppp/pppInterfaceLayer.h @@ -0,0 +1,31 @@ +/* pppInterfaceLayer.h - Interface Layer header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,13jan02,ijm added extern "C" for C++ +01a,07nov99,sgv Written +*/ + +#ifndef __INCpppInterfaceLayerh +#define __INCpppInterfaceLayerh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "pfw/pfw.h" + +STATUS pppInterfaceLayerCreate (PFW_OBJ * pfw); +STATUS pppInterfaceLayerDelete (PFW_OBJ * pfw); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppInterfaceLayerh */ diff --git a/h/ppp/pppInterfaces.h b/h/ppp/pppInterfaces.h new file mode 100644 index 0000000..2aa6a74 --- /dev/null +++ b/h/ppp/pppInterfaces.h @@ -0,0 +1,312 @@ +/* pppInterface.h - PPP user interfaces */ + +/* Copyright 1999 - 2005 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01f,23feb05,ijm added LCP stopped callback with echos failed notification, + SPR#70584 +01e,17feb02,ak added MP upcalls +01d,09feb00,sj added pppLinkIdGet() + deleted old secrets interfaces +01c,05jan00,sj adding callbackOperation upcalls +01b,18nov99,sj updating documentation +01a,30oct99,sj created +*/ + +#include "ppp/kstart.h" +#include "ppp/kppp.h" +/*#include "ppp/vpppstr.h"*/ +#include "ppp/mp.h" +#include "pfw/pfw.h" + +#ifndef __INCpppInterfaceh +#define __INCpppInterfaceh + +#ifdef __cplusplus +extern "C" { +#endif + +/* typedefs */ + +typedef void (*PASSWORD_AUTH_CALLBACK) + ( + PFW_STACK_OBJ *stackObj, + BYTE id, + TEST passOrFail + ); + +typedef void (*CHALLENGE_AUTH_CALLBACK) + ( + PFW_STACK_OBJ *stackObj, + BYTE id, + TEST passOrFail + ); +/* + * For each of the callback function pointers defined within the + * structures "lcpUpcallFunctions", "ncpUpcallFunctions", "authUpcallFunctions" + * and "pppUpcallFunctions" the 'userHandle' parameter is the cookie installed + * by the user/application at the time of 'pppConnectionOpen.' + * The 'stackObj' parameter refers to the stack (created using pfwStackAdd()) + * for which the callback is being made + * + * The application may provide some,all or none of these callbacks + */ + +/* + * sub upcall interface for communication between Link Control protocol and the + * application. + */ +typedef struct lcpUpcallFunctions + { + void (*pppLcpUp) /* This callback occurs when LCP is UP */ + ( /* implying that the link establishment */ + void * userHandle, /* phase is complete */ + PFW_STACK_OBJ *stackObj + ); + void (*pppLcpDown) /* This callback occurs when LCP is going*/ + ( /* down */ + void * userHandle, + PFW_STACK_OBJ * stackObj + ); + void (*pppLcpFinished) /* This callback occurs when LCP is */ + ( /* finished and is going to the CLOSED */ + void * userHandle, /* state */ + PFW_STACK_OBJ * stackObj + ); + void (*pppLcpTerminationRequest) /* This callback occurs when the LOCAL */ + ( /* system is about to send a Termination */ + void * userHandle, /* request to the PEER */ + PFW_STACK_OBJ * stackObj + ); + void (*pppLcpIdRequest) /* This callback occurs when the LOCAL */ + ( /* system is about to send a LCP */ + void * userHandle, /* identification message to the PEER. */ + PFW_STACK_OBJ * stackObj, /* The application may fill in/modify the*/ + char * message /* 'message' buffer upto a size equal to */ + ); /* length of the string value set for LCP*/ + /* profile parameter: */ + /* "lcp_txIdentificationMessage" */ + + void (*pppLcpIdRequestReceived) /* This callback is a notification to */ + ( /* the application that the LOCAL system */ + void * userHandle, /* received a LCP identification packet */ + PFW_STACK_OBJ * stackObj, /* from the peer. The 'message' parameter*/ + char * message /* points to the data field of received */ + ); /* packet */ + + void (*pppLcpTimeRemainingRequest) + ( /* This callback occurs when the LOCAL */ + void * userHandle, /* system is about to send a LCP */ + PFW_STACK_OBJ * stackObj, /* Time Remaining packet to the peer. */ + ULONG * secondsRemaining, /* The application may fill in the */ + char * message /* 'secondsRemaining' and 'message' */ + ); /* fields of the packet. The message */ + /* cannot be longer than the length of */ + /* the string value set for the LCP */ + /* profile parameter: */ + /* "lcp_timeRemainingMessage" */ + + void (*pppLcpTimeRemainingReceived) + ( /* This callback is a notification to the*/ + void * userHandle, /* application that the LOCAL system */ + PFW_STACK_OBJ * stackObj, /* received a TimeRemaining packet from */ + ULONG secondsRemaining, /* the PEER. The 'secondsRemaining' and */ + char * message /* the 'message' parameters contain the */ + ); /* information sent by the PEER */ + + void (*pppLcpCallbackOperation) + ( /* This callback is a notification to the*/ + void * userHandle, /* application that the LOCAL system */ + PFW_STACK_OBJ * stackObj, /* has negotiated to call back and */ + BYTE callbackOperation, /* re-establish the link with the PEER */ + char * message /* The 'callbackOperation' and 'message'*/ + ); /* parameters have the relevant */ + /* information necessary for callback */ + + void (*pppLcpStopped) /* This callback occurs when LCP is */ + ( /* going to the STOPPED STATE. */ + void * userHandle, /* If LCP echoes failed, lcpEchoesFailed */ + PFW_STACK_OBJ * stackObj, /* is set to TRUE */ + BOOL lcpEchoesFailed + ); + }LCP_UPCALL_FUNCTIONS; +/* + * sub upcall interface for communication between Network Control protocols and + * the application + */ +typedef struct ncpUpcallFunctions + { + void (*pppNcpUp) /* This callback notifies the application*/ + ( /* that the Network Control Protocol */ + void * userHandle, /* whose number is specified by the */ + PFW_STACK_OBJ * stackObj, /* 'protocol' parameter has completed the*/ + PPP_PROTOCOL_TYPE protocol /* negotiation phase and is UP */ + ); + void (*pppNcpDown) /* This callback notifies the application*/ + ( /* that the Network Control Protocol */ + void * userHandle, /* whose number is specified by the */ + PFW_STACK_OBJ * stackObj, /* 'protocol' parameter is going DOWN */ + PPP_PROTOCOL_TYPE protocol + ); + void (*pppNcpFinished) /* This callback notifies the application*/ + ( /* that the Network Control Protocol */ + void * userHandle, /* whose number is specified by the */ + PFW_STACK_OBJ * stackObj, /* 'protocol' parameter is finished and */ + PPP_PROTOCOL_TYPE protocol /* is going to the CLOSED state */ + ); + void (*pppNcpRejected) /* This callback notifies the application*/ + ( /* that the Network Control Protocol */ + void * userHandle, /* whose number is specified by the */ + PFW_STACK_OBJ * stackObj, /* 'protocol' parameter was rejected by */ + PPP_PROTOCOL_TYPE /* the PEER */ + ); + } NCP_UPCALL_FUNCTIONS; + +/* + * sub upcall interface for communication between authentication protocols and + * the application. + * + * Of the callback functions defined in the "authUpcallFunctions" structure + * The first three; viz.,pppAuthRequest() pppChallengeAuthVerify() and + * pppPasswordAuthVerify() are received by the application only when the + * CONTROL_LAYER profile parameter: "ppp_secretsDatabase" is set to the value + * EXTERNAL_SECRETS_DATABASE. + */ +typedef struct authUpcallFunctions + { + void (*pppAuthRequest) /* This callback occurs when the LOCAL */ + ( /* system is about to send a */ + void * userHandle, /* authentication request(PAP) OR a */ + PFW_STACK_OBJ * stackObj , /* response to a challenge. */ + char * userName, /* The application MUST fill in the */ + char *userPassword /* 'userPassword' for the specified */ + ); /* 'userName'. */ + + void (*pppChallengeAuthVerify) /* This callback occurs when the LOCAL */ + ( /* system is a CHAP authenticator(server)*/ + void * userHandle, /* and it received a respose to its */ + PFW_STACK_OBJ * stackObj, /* challenge from the PEER. */ + char * localName, /* The application MUST use the */ + char * peerName, /* information in these parameters to */ + char * response, /* verify the response using MD5 */ + unsigned int responseLen, /* algorithm and send a PASS or FAIL */ + char * challenge, /* via the chapCallback. The 'id' */ + unsigned int challengeLen, /* parameter to the chapCallback MUST */ + BYTE id, /* match the 'id' parameter here. */ + CHALLENGE_AUTH_CALLBACK chapCallback + ); + + void (*pppPasswordAuthVerify) /* This callback occurs when the LOCAL */ + ( /* system is a PAP authenticator(server) */ + void * userHandle, /* and it received a authentication */ + PFW_STACK_OBJ *stackObj, /* request from the PEER */ + char * localName, /* The application must use the */ + char * peerName, /* information provided in these */ + char *userPassword, /* parameters to verify the */ + BYTE id, /* authentication request and send a */ + /* PASS or FAIL message via the */ + /* papCallback */ + PASSWORD_AUTH_CALLBACK papCallback + ); + + void (*pppAuthAckTransmitted) /* This callback occurs when the LOCAL */ + ( /* being the authenticator sends a */ + void * userHandle, /* authentication ACK(Success) message to*/ + PFW_STACK_OBJ * stackObj, /* the PEER */ + PPP_PROTOCOL_TYPE authProtocol + ); + void (*pppAuthAckReceived) /* This callback occurs when the LOCAL */ + ( /* is successfully authenticated by the */ + void * userHandle, /* PEER */ + PFW_STACK_OBJ * stackObj, + PPP_PROTOCOL_TYPE authProtocol + ); + void (*pppAuthFailed) /* This callback occurs when the LOCAL */ + ( /* system failed to authenticate itself */ + void * userHandle, /* with the PEER */ + PFW_STACK_OBJ * stackObj, + PPP_PROTOCOL_TYPE authProtocol + ); + void (*pppAuthRefused) /* This callback occurs when the LOCAL */ + ( /* system being the authenticator refuses*/ + void * userHandle, /* authentication for the peer */ + PFW_STACK_OBJ * stackObj, + PPP_PROTOCOL_TYPE authProtocol + ); + }AUTH_UPCALL_FUNCTIONS; + +/* + * sub upcall interface for communication between MLPPP components and + * the application. + */ +typedef struct mpUpcallFunctions + { + void (*linkNegotiatedMP) /* This callback occurs when */ + ( /* the link negotiates MRRU */ + void *userHandle, /* option */ + PFW_STACK_OBJ *pStackObj, + MP_BUNDLE_IDENTIFIER *bundleId + ); + void (*linkAddedToBundle) + ( + void *userHandler, /* This callback occurs when */ + PFW_STACK_OBJ *pStackObj, /* the link is added to a */ + PFW_STACK_OBJ *pManagerStackObj /* bundle */ + ); + void (*linkRemovedFromBundle) + ( + void *userHandler, /* This callback occurs when */ + PFW_STACK_OBJ *pStackObj, /* the link is removed to a */ + PFW_STACK_OBJ *pManagerStackObj /* bundle */ + ); + }MP_UPCALL_FUNCTIONS; + +/* + * Aggregate Upcall interface between PPP and the Application + */ +typedef struct pppUpcallFunctions + { + void (*pppOpened) /* The application receives this callback*/ + ( /* when the connection is fully UP with */ + void * userHandle, /* all the configured control protocols */ + PFW_STACK_OBJ * stackObj /* up and running */ + ); + void (*pppClosed) /* The application receives this callback*/ + ( /* when all protocols that were part of */ + void * userHandle, /* the open connection have been quiesced*/ + PFW_STACK_OBJ * stackObj + ); + + LCP_UPCALL_FUNCTIONS * lcpUpcalls; + NCP_UPCALL_FUNCTIONS * ncpUpcalls; + AUTH_UPCALL_FUNCTIONS * authUpcalls; + MP_UPCALL_FUNCTIONS * mpUpcalls; + } PPP_UPCALL_FUNCTIONS; + +extern STATUS pppConnectionOpen /* Open a PPP connection based on the */ + ( /* stack referenced by stackObj. The */ + PFW_STACK_OBJ *stackObj, /* application may provide a reference */ + PPP_UPCALL_FUNCTIONS *upCalls, /* to callback functions and a */ + void *userHandle /* userHandle that will be returned */ + ); /* during each callback */ + + +extern STATUS pppConnectionClose /* Close a previously opened connection */ + ( + PFW_STACK_OBJ *stackObj + ); + +extern int pppLinkIdGet /* get the PPP link Id for this stack */ + ( + PFW_STACK_OBJ *stackObj + ); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppInterfaceh */ diff --git a/h/ppp/pppIpcpComponent.h b/h/ppp/pppIpcpComponent.h new file mode 100644 index 0000000..ae332da --- /dev/null +++ b/h/ppp/pppIpcpComponent.h @@ -0,0 +1,58 @@ +/* pppIpcpComponent.h - IPCP component header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,12oct99,sgv derived from routerware source base +*/ + +#ifndef __INCpppIpcpComponenth +#define __INCpppIpcpComponenth + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "vxWorks.h" +#include "pfw/pfw.h" + +/* Profile Parameters + * -------------------- + * NAME VALUES/EXPLANATION + * ------ -------------------- + * The following are RFC 1332 defined IPCP negotiation options + * + * ipcp_ipAddr Set the IP address of the local/peer + * system + * ipcp_vjcParams Van Jacobson IP Header compression + * + * The following are implementation specific IPCP configuration parameters; + * + * NOTE:All time intervals and timeout paramters are measured in SECONDS. Also + * all of the parameters must be set using quoted integer values; e.g. "20" + * ipcp_maxConfigRequests Maximum number of unacknoledged + * Configuration requests to send in one + * attempt + * ipcp_configReqSendInterval Interval between Configuration requests + * in an attempt + * + * ipcp_maxTerminationRequests Maximum number of unacknowledged + * Termination requests to send + * + * ipcp_terminationReqInterval Interval between Termination Requests + * + */ + +STATUS pppIpcpComponentCreate (PFW_OBJ * pfw); +STATUS pppIpcpComponentDelete (PFW_OBJ * pfw); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppipcpComponenth */ diff --git a/h/ppp/pppIpv6cpComponent.h b/h/ppp/pppIpv6cpComponent.h new file mode 100644 index 0000000..d977568 --- /dev/null +++ b/h/ppp/pppIpv6cpComponent.h @@ -0,0 +1,66 @@ +/* pppIpv6cpComponent.h - IPV6CP component header file */ + +/* Copyright 2002 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,30jul02,ijm created +*/ + +#ifndef __INCpppIpv6cpComponenth +#define __INCpppIpv6cpComponenth + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "vxWorks.h" +#include "pfw/pfw.h" + +/* Profile Parameters + * -------------------- + * NAME VALUES/EXPLANATION + * ------ -------------------- + * + * The following are RFC 2472 defined IPV6CP negotiation options + * + * ipv6cp_ipv6InterfaceIdentifier Set the interface identifier of the + * the local/peer system + * + * ipv6cp_hcParams RFC 2507 Ip Header Compression + * + * + * The following are implementation specific IPV6CP configuration parameters; + * + * NOTE:All time intervals and timeout paramters are measured in SECONDS. Also + * all of the parameters must be set using quoted integer values; e.g. "20" + * + * ipv6cp_maxConfigRequests Maximum number of unacknowledged + * Configuration requests to send in one + * attempt + * + * ipv6cp_configReqSendInterval Interval between Configuration requests + * in an attempt + * + * ipv6cp_maxTerminationRequests Maximum number of unacknowledged + * Termination requests to send + * + * ipv6cp_terminationReqInterval Interval between Termination Requests + * + * ipv6cp_maxConfigFailure Maximum number of Configuration naks + * sent in one attempt + * + */ + +STATUS pppIpv6cpComponentCreate (PFW_OBJ * pfw); +STATUS pppIpv6cpComponentDelete (PFW_OBJ * pfw); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppIpv6cpComponenth */ diff --git a/h/ppp/pppLacStructures.h b/h/ppp/pppLacStructures.h new file mode 100644 index 0000000..b96d2e3 --- /dev/null +++ b/h/ppp/pppLacStructures.h @@ -0,0 +1,49 @@ +/* pppLacStructures.h - header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,02aug00,md created +*/ + +#ifndef __INCpppLacStructuresh +#define __INCpppLacStructuresh + +#ifdef __cplusplus +extern "C" { +#endif + +#define PPP_MAX_PHONE_NUMBER_LENGTH 64 +#define PPP_MAX_SUB_ADDRESS_LENGTH 64 + +typedef enum + { + PPP_ASYNC_FRAMING = 1, + PPP_SYNC_FRAMING + } PPP_FRAMING_TYPE; + +typedef struct PPP_ATTRIBUTES + { + UINT32 framingType; + char calledNumber[PPP_MAX_PHONE_NUMBER_LENGTH]; + UINT32 calledNumberLength; + char callingNumber[PPP_MAX_PHONE_NUMBER_LENGTH]; + UINT32 callingNumberLength; + char subAddress[PPP_MAX_SUB_ADDRESS_LENGTH]; + UINT32 subAddressLength; + UINT32 txConnectSpeed; + UINT32 rxConnectSpeed; + UINT32 physicalChannelID; + UINT32 nasIpAddress; + UINT32 nasPort; + } PPP_ATTRIBUTES; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppLacStructuresh */ diff --git a/h/ppp/pppLcpComponent.h b/h/ppp/pppLcpComponent.h new file mode 100644 index 0000000..4874be1 --- /dev/null +++ b/h/ppp/pppLcpComponent.h @@ -0,0 +1,91 @@ +/* pppLcpComponent.h - LCP component header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01e,29sep00,sj merging with TOR2_0-WINDNET_PPP-CUM_PATCH_2 +01d,09aug00,adb adding description for lcp_passiveMode +01c,07feb00,sj added lcp_selfDescribingPadding and lcp_callback features +01b,08nov99,sj change Init to Create +01a,28sep99,sj derived from routerware source base +*/ + +#ifndef __INCpppLcpComponenth +#define __INCpppLcpComponenth + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "vxWorks.h" +#include "pfw/pfw.h" + +/* Profile Parameters + * -------------------- + * NAME VALUES/EXPLANATION + * ------ -------------------- + * The following are RFC 1661 & 1662 defined LCP negotiation options + * + * lcp_MRU Maximum Receive Unit + * lcp_ACCM Asynchronous Character Control Map + * lcp_authProtocol Authentication Protocol + * lcp_qualityProtocol Link Quality Protocol @* NOT Supported *@ + * lcp_magicNumber Magic Number Option + * lcp_PFCompression Protocol Field Compression + * lcp_ACFCompression Address and Control Field Compression* + * lcp_fcsAlternatives Alternative FCS; NULL and 16 Bit ONLY! + * lcp_selfDescribingPadding Self Describing Padding for PPP packets + * lcp_callbackOperation LCP callback operation option + * + * The following are implementation specific LCP configuration parameters; + * + * NOTE:All time intervals and timeout paramters are measured in SECONDS. Also + * all of the parameters must be set using quoted integer values; e.g. "20" + * + * lcp_callbackMessage Human readable message with callback option + * lcp_timeRemainingInterval Interval between Time Remaining Messages + * lcp_timeRemainingMessage ASCII string Time Remaining message + * lcp_txIdentMessage ASCII string Identification message; + * Setting this parameter with an Non Zero + * lcp_maxConfigRequests Maximum number of Configuration requests + * to send in one attempt + * lcp_configReqSendInterval Interval between Configuration requests in + * an attempt + * + * lcp_configReqBackoffInterval Backoff interval between attempts. when + * this interval expires LCP cycles through + * a DOWN followed by an UP event triggering + * another set, "lcp_maxConfigRequests", + * of configuration requests + * + * lcp_maxTerminationRequests Maximum number of unacknowledged + * Termination requests to send. + * + * lcp_TerminationReqInterval Interval between Termination Requests + * lcp_echoRequestSendInterval Interval between echo requests + * lcp_maxUnAckedEchoRequests Maximum number or unacknowledged echo + * requests allowed before link is dropped + * lcp_passiveMode Default is FALSE. If set to TRUE then + * on opening a connection LCP will not + * actively initiate negotiation. + */ + +/* + * LCP SUPPORTED INTERFACES: see ./interfaces/lcpInterfaces.h + */ + +/* User interfaces */ + +STATUS lcpComponentCreate (PFW_OBJ * pfw); +STATUS lcpComponentDelete (PFW_OBJ * pfw); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppLcpComponenth */ diff --git a/h/ppp/pppMPFramingLayer.h b/h/ppp/pppMPFramingLayer.h new file mode 100644 index 0000000..77d5e3d --- /dev/null +++ b/h/ppp/pppMPFramingLayer.h @@ -0,0 +1,32 @@ +/* pppMPFramingLayer.h - MP Framing Layer header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,01feb01,ak created +*/ + +#ifndef __INCpppMpFramingLayerh +#define __INCpppMpFramingLayerh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "pfw/pfw.h" + +STATUS mpFramingLayerCreate (PFW_OBJ * pfw, UINT mpSendQueueDepth, + UINT mpReceiveQueueDepth, UINT mpSendTaskPriority, UINT mpReceiveTaskPriority); + +STATUS mpFramingLayerDelete (PFW_OBJ *pfw); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppMpFramingLayerh */ diff --git a/h/ppp/pppMPInterfaceLayer.h b/h/ppp/pppMPInterfaceLayer.h new file mode 100644 index 0000000..c55222b --- /dev/null +++ b/h/ppp/pppMPInterfaceLayer.h @@ -0,0 +1,30 @@ +/* pppMPInterfaceLayer.h - MP Interface Layer header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,13feb01,sd Written +*/ + +#ifndef __INCpppMPInterfaceLayerh +#define __INCpppMPInterfaceLayerh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "pfw/pfw.h" + +STATUS mpInterfaceLayerCreate (PFW_OBJ * pfw); +STATUS mpInterfaceLayerDelete (PFW_OBJ * pfw); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppMPInterfaceLayerh */ diff --git a/h/ppp/pppMuxAdapter.h b/h/ppp/pppMuxAdapter.h new file mode 100644 index 0000000..bc5291c --- /dev/null +++ b/h/ppp/pppMuxAdapter.h @@ -0,0 +1,78 @@ +/* pppMuxAdapter.h - PPP muxAdapter interface */ + +/* Copyright 1984-1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,29oct02,ijm added PPP_MUX_ADAPTER_MAX_BINDS definition +01b,18apr01,sj added description for new profile parameter: muxL2SvcType +01a,05jul99,sj created +*/ + +#ifndef __INCpppMuxAdapterh +#define __INCpppMuxAdapterh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Profile Parameters + * -------------------- + * NAME VALUES/EXPLANATION + * ------ -------------------- + * "muxDevName" Name of device to bind to: "cpm", "fei", "ln" etc. + * "muxDevUnit" Unit number of device: "0", "1" etc. + * + * "muxSvcType" ':' delimited list of Protocol Numbers that + * must be bound to the specified device. For e.g.: + * "0x8863:0x8864" for PPPoE + * + * "muxL2SvcType" By default this has a value of 0x0 and is unused. + * This may be set to a non-zero value ONLY when + * used with an END style driver. + * + * Any non-zero value is used as a protocol number + * and is bound to the END in addition to the + * protocols specified via the muxSvcType parameter. + * When this parameter is used the MUX_ADAPTER + * pluginObj ALWAYS forwards packets/frames received + * on its send() interface unaltered to the END + * using muxSend(). + * + * The 'reserved' field in the M_BLK_HDR of the + * leading M_BLK of the packet/frame is set to + * muxL2SvcType, in Network Byte Order, before it + * is sent to the END to allow the END to use it + * in any manner that it chooses. + * + * It is recommended that values for this parameter + * be chosen from among the interface types (ifType) + * defined in RFC 1213 (IANA-MIB) + */ + +#define PPP_MUX_ADAPTER_MAX_BINDS 16 /* + * Maximum number of protocol + * bindings for all PPPoE devices + * allowed for the MUX Adapter component. + * + * Should be large enough to accomodate + * muxSvcType and muxL2SvcType, if any, + * for all PPPoE devices. This definition is + * used only when PPP is installed on + * the IPv4/Ipv6 dual stack. For all other + * stacks, T2.x or T3.x, the global variable + * muxMaxBinds is used as the upper bound + * value for this parameter + */ + +/* User interfaces */ + +extern STATUS muxAdapterCreate (PFW_OBJ * pfw); +extern STATUS muxAdapterDelete (PFW_OBJ * pfw); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppMuxAdapterh */ diff --git a/h/ppp/pppNetworkLayer.h b/h/ppp/pppNetworkLayer.h new file mode 100644 index 0000000..25affa5 --- /dev/null +++ b/h/ppp/pppNetworkLayer.h @@ -0,0 +1,31 @@ +/* pppNetworkLayer.h - Network Layer header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,13jan02,ijm added extern "C" for C++ +01a,07nov99,sgv Written +*/ + +#ifndef __INCpppNetworkLayerh +#define __INCpppNetworkLayerh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "pfw/pfw.h" + +STATUS pppNetworkLayerCreate (PFW_OBJ * pfw); +STATUS pppNetworkLayerDelete (PFW_OBJ * pfw); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppNetworkLayerh */ diff --git a/h/ppp/pppOEthernet.h b/h/ppp/pppOEthernet.h new file mode 100644 index 0000000..848a246 --- /dev/null +++ b/h/ppp/pppOEthernet.h @@ -0,0 +1,117 @@ +/* pppOEthernet.h - PPP over Ethernet interface */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,28jan05,ijm Added pppoePeerMacAdrsGet function, SPR#73541 +01d,16jan05,ijm As part of PPPoE Fix TCP MSS enhancement,SPR#105644, + added pppOE_fixTcpAdvMss parameter +01c,18apr01,ijm correct name is pppOEServiceNameDelete (not ..NameDel) +01b,08nov99,sj Init to Create +01a,07jul99,sj created +*/ + +#ifndef __INCpppOEtherneth +#define __INCpppOEtherneth + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +/* typedefs */ + +/* defines */ + +#define PPPOE_AC_MODE 0x1 /* specifies Access Concentrator mode */ +#define PPPOE_HOST_MODE 0x2 /* specifies PPPOE Host/Client mode */ + +/* Profile Parameters + * -------------------- + * NAME VALUES/EXPLANATION + * ------ -------------------- + * "pppOE_connectionMode" "0x1" OR "0x2": for AC OR HOST mode respectively + * + * "pppOE_discRetries" Minimum number of retries during DISCOVERY phase; + * Default is FOUR retries + * + * "pppOE_minDiscTimeout" Minimum/Initial timeout value in seconds for + * retries during the discovery phase; Default is + * ONE second + * + * "pppOE_svcName" Name of service: This is service requested in the + * case of a HOST/CLIENT and is the offered service + * in the case of an AC + * + * "pppOE_acName" Access Concentrator name to use when making offers + * + * "pppOE_vendorInfo" Vendor specific information used during Discovery + * + * "pppOE_fixTcpAdvMss" Enable monitoring outgoing PPPoE packets to reduce + * advertised MSS TCP option for TCP SYN packets + * only, if MSS is larger than 1452 bytes. Maximum + * PPPoE MSS: ETHERMTU - TCPIP header - PPPoE header + * = 1500 - 40 - 8 = 1452 bytes. + * + * Monitoring may be necessary to correct a + * potential problem for hosts using PPPoE target + * as a gateway to the Internet. PPPoE target does + * not have a problem because TCP for PPPoE target + * gets the correct MTU for the PPPoE interface + * (1492) and advertises an MSS of 1452 bytes. + * However, TCP for hosts on the LAN will use + * ETHERMTU (1500) and advertise an MSS of 1460 + * bytes. Packets sent by remote hosts to clients + * behind the PPPoE gateway may be dropped since + * TCP packets always have the "Do not fragment + * bit set", and some routers may not generate + * the appropriate ICMP "Fragmentation needed" + * message to alert the remote host to reduce MSS. + * + * Enabling this parameter to make up for a + * mis-configured router in the Internet, + * reduces performance on the target. This + * parameter is provided to satisfy customer + * requests, but its use is strongly discouraged. + * + * Since the use of PATH MTU discovery is + * strongly recommended for IPv6 nodes it is less + * likely that this problem will affect TCP/IPv6 + * packets, and since processing IPv6 headers + * would impact performance even more, enabling + * this parameter will process TCP/IPv4 packets only. + * + * + * NOTE: + * The PPP_O_ETHERNET pluginObj within a framework instance can be initialized + * to either PPPOE_HOST_MODE OR PPPOE_AC_MODE but NOT both. This is done by + * specifying the appropriate value for the 'operatingMode' parameter for + * pppOEthernetCreate. + * + * The value for "pppOE_connectionMode" profile parameter must always match + * the 'operatingMode' for all stacks in the Framework. + */ + +/* User Interfaces */ + +extern STATUS pppOEthernetCreate (PFW_OBJ * , UINT32 maxServices, + UINT32 operatingMode); +extern STATUS pppOEthernetDelete (PFW_OBJ * ); + +extern STATUS pppOEServiceNameAdd (PFW_PROFILE_OBJ *, char * pSvcName, + PFW_STACK_OBJ_CALLBACKS * callbacks, + void * userHandle); + +extern STATUS pppOEServiceNameDelete ( PFW_OBJ *,char * pSvcName); +extern void pppOESessionsShow ( PFW_OBJ * pfw); +extern STATUS pppoePeerMacAdrsGet (PFW_STACK_OBJ * pStackObj, + unsigned char * etherAddr); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppOEtherneth */ diff --git a/h/ppp/pppPapComponent.h b/h/ppp/pppPapComponent.h new file mode 100644 index 0000000..f492b7d --- /dev/null +++ b/h/ppp/pppPapComponent.h @@ -0,0 +1,42 @@ +/* pppPapComponent.h - PPP Authentication header */ + +/* Copyright 1999 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,13jan02,ijm added extern "C" for C++ +01a,23oct99,sgv created from routerware source +*/ + +#ifndef __INCpppPapComponenth +#define __INCpppPapComponenth + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "pfw/pfw.h" + +/* Profile Parameters + * -------------------- + * NAME VALUES/EXPLANATION + * ------ -------------------- + * pap_localUserName Name of the local user name + * pap_authRequestInterval Interval (in seconds) between pap + * authentication request messages + * pap_maxAuthRequestRetries Maximum number of unacknowledged pap + * authentication requests to send + */ + +extern STATUS pppPapComponentCreate (PFW_OBJ *pfw); +extern STATUS pppPapComponentDelete (PFW_OBJ *pfw); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppPapComponenth */ + diff --git a/h/ppp/pppSioAdapter.h b/h/ppp/pppSioAdapter.h new file mode 100644 index 0000000..ad27d44 --- /dev/null +++ b/h/ppp/pppSioAdapter.h @@ -0,0 +1,53 @@ +/* pppSioAdapter.h - PPP Serial I/O Adapter */ + +/* Copyright 1984-1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,29oct02,ijm updated sio peer types +01b,13jan02,ijm added prototypes for sioAdapterCreate and sioAdapterDelete +01b,17dec00,sj added sio_maxSendQSize parameter +01a,08nov99,sj created +*/ + +#ifndef __INCpppSioAdapterh +#define __INCpppSioAdapterh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Profile Parameters + * -------------------- + * NAME VALUES/EXPLANATION + * ------ -------------------- + * "sio_channelNum" Serial port/channel number as would be used + * with sysSerialChanGet(); e.g: "1", "2" + * "sio_baudRate" Baud Rate for the specified channel: e.g. "19200" + * + * "sio_maxSendQSize" Specifies the maximum number of frames that may + * be queued for transmission. Default value is "15" + * Set a value of "0" to disable queueing. + * + * "sio_peerType" This parameter identifies that the peer is: + * Windows RAS: "WIN_SERVER" + * Windows DUN: "WIN_CLIENT" + * Modem: MODEM + * All others (LINUX, Solaris, vxWorks...): "REGULAR" + * + * In the case of Windows the adapter does + * not come up until the exchange of strings "CLIENT" + * and "CLIENTSERVER" is complete + */ + +/* User interfaces */ + +extern STATUS sioAdapterCreate (PFW_OBJ * pfw, UINT32 totalNumberOfChannels); +extern STATUS sioAdapterDelete (PFW_OBJ * pfw); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppSioAdapterh */ diff --git a/h/ppp/pppVjcComponent.h b/h/ppp/pppVjcComponent.h new file mode 100644 index 0000000..aad084f --- /dev/null +++ b/h/ppp/pppVjcComponent.h @@ -0,0 +1,31 @@ +/* pppVjcComponent.h - VJC component header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,13jan02,ijm added extern "C" for C++ +01a,07nov99,sgv Written +*/ + +#ifndef __INCpppVjcComponenth +#define __INCpppVjcComponenth + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "pfw/pfw.h" + +STATUS pppVjcComponentCreate (PFW_OBJ * pfw); +STATUS pppVjcComponentDelete (PFW_OBJ * pfw); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppVjcComponenth */ diff --git a/h/ppp/pppVsEndComponent.h b/h/ppp/pppVsEndComponent.h new file mode 100644 index 0000000..e198580 --- /dev/null +++ b/h/ppp/pppVsEndComponent.h @@ -0,0 +1,58 @@ +/* pppVsEndComponent.h - VS END component header file */ + +/* Copyright 2002 - 2004 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,30jul04,ijm added pppIpv4InfoGet, pppIpv6InfoGet, and pppUnitGet +01a,26may02,ijm created +*/ + +#ifndef __INCpppVsEndComponenth +#define __INCpppVsEndComponenth + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "pfw/pfw.h" +#include "inetLib.h" + +typedef struct pppEndIpv4InfoGet + { + int unit; + char localAddress [INET_ADDR_LEN]; + char remoteAddress [INET_ADDR_LEN]; + char primaryDnsAddress[INET_ADDR_LEN]; + char secondaryDnsAddress [INET_ADDR_LEN]; + BOOL connected; + } PPP_END_IPV4_INFO; + + +typedef struct pppEndIpv6InfoGet + { + int unit; + char localAddress [INET6_ADDR_LEN]; + char remoteAddress [INET6_ADDR_LEN]; + BOOL connected; + } PPP_END_IPV6_INFO; + +STATUS pppVsEndComponentCreate (PFW_OBJ * pfw); +STATUS pppVsEndComponentDelete (PFW_OBJ * pfw); + +int pppUnitGet (PFW_STACK_OBJ * pStackObj); + +STATUS pppIpv4InfoGet (PFW_STACK_OBJ * pStackObj, + PPP_END_IPV4_INFO * pIpv4Info); +STATUS pppIpv6InfoGet (PFW_STACK_OBJ * pStackObj, + PPP_END_IPV6_INFO * pIpv6Info); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppVsEndComponenth */ diff --git a/h/ppp/rasamm.h b/h/ppp/rasamm.h new file mode 100644 index 0000000..cbeae16 --- /dev/null +++ b/h/ppp/rasamm.h @@ -0,0 +1,75 @@ +/* rasamm.h - Remote Access address manager header file */ + +/* Copyright 2000 - 2001 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,16aug01,rp removing rasAMMpresent flag +01a,30mar01,spm file creation: copied from version 01b of tor2_0.open_stack + branch (wpwr VOB) for unified code base; fixed header entries +*/ + +#ifndef __INCrasammh +#define __INCrasammh + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +extern STATUS RAS_AMM_Init(); + +extern UINT32 RAS_InsAddrPool(UINT32 routerId, + UINT32 ipAddr, + UINT prefixLen, + UINT32 poolSz, + UINT mMethod, + UINT supportPMP, + UINT pmpLkupTblSz); + +extern STATUS RAS_DelAddrPool(UINT32 poolId); + +extern STATUS RAS_GetIpAddr(UINT32 poolId, UINT32 *routerId, UINT32 *ipAddr); + +extern STATUS RAS_RelIpAddr(UINT32 poolId, UINT32 ipAddr); + +extern UINT32 RAS_getNumOfPools(int doprintf); + +extern UINT32 RAS_getMaxPoolId(int doprintf); + +extern UINT32 RAS_getAddrPoolSize(UINT32 poolId, int doprintf); + +extern UINT32 RAS_getAddrPoolPrefix(UINT32 poolId, int doprintf); + +extern UINT32 RAS_getAddrPoolRouterId(UINT32 poolId, int doprintf); + +extern UINT32 RAS_getAddrPoolFirstIp(UINT32 poolId, int doprintf); + +extern UINT32 RAS_getAddrPoolNumFreeAddrs(UINT32 poolId, int doprintf); + +extern UINT32 RAS_getAddrPoolPMPmode(UINT32 poolId, int doprintf); + +extern void * RAS_getAddrPoolexptDrv(UINT32 poolId, int doprintf); + +extern void *RAS_getAddrPool1stDrv(UINT32 poolId, UINT32 *srcipAddr, UINT32 *dstipAddr, int doprintf); + +extern STATUS RAS_setAddrPoolexptDrv(UINT32 poolId, void *drv, int doprintf); + +extern UINT32 RAS_getAddrPoolNumDrvs(UINT32 poolId, int doprintf); + +extern STATUS RAS_pmpInsertDriver(UINT32 poolId, UINT32 srcipAddr, UINT32 dstipAddr, void *drv); + +extern STATUS RAS_pmpRemoveDriver(UINT32 poolId, UINT32 dstipAddr); + +extern void *RAS_pmpGetDriver(UINT32 poolId, UINT32 dstipAddr); + +extern STATUS RAS_pmpAddrPoolDrvsInit(UINT32 poolId, void (*)(void *, void *)); + +extern STATUS RAS_printAddrPoolInfo(UINT32 poolId); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrasammh */ diff --git a/h/ppp/snmpAgent/leaf1471.h b/h/ppp/snmpAgent/leaf1471.h new file mode 100644 index 0000000..1b61179 --- /dev/null +++ b/h/ppp/snmpAgent/leaf1471.h @@ -0,0 +1,90 @@ +/****************************************************************************** + ****************************************************************************** + **** This file was automatically generated by Wind River's + **** WindManage MIB Compiler, version 9.3. + **** This file was generated using the -leaf switch. + **** + **** This file #defines C preprocessor macros providing a variety of + **** information for the leaf objects in the MIB. + **** + **** The file includes a LEAF_xxx macro for each leaf object in the + **** MIB (xxx is replaced by the object's name). The value of the + **** LEAF_xxx macro is the final component of the object's object + **** identifier. + **** + **** If the object's SYNTAX clause included named INTEGER values, + **** then there is a VAL_xxx_yyy macro for each named value (xxx is + **** replaced by the object's name and yyy by the value's name). The + **** value of the VAL_xxx_yyy macro is the value associated with the + **** named value. + **** + **** If the object's SYNTAX clause specified a set of range limitations + **** for the value of the object, then there are one or more sets of + **** MIN_xxx and MAX_xxx macros specifying the lower and upper bound of + **** each range limitation. + **** + **** If the object's SYNTAX clause specified a set of size constraints + **** for the value of the object, then there are one or more sets of + **** MINSIZE_xxx and MAXSIZE_xxx macros specifying the lower and upper + **** bound of each size constraint. (If the size constraint is a single + **** value rather than a range then the MINSIZE_xxx and MAXSIZE_xxx + **** macros are replaced by a single SIZE_xxx macro.) + **** + **** DO NOT MODIFY THIS FILE BY HAND. + **** + **** Last build date: Mon Aug 5 23:32:47 2002 + **** from files: + **** rfc1213.mib, rfc1471.mib + **** starting from node: pppLcp + ****************************************************************************** + ****************************************************************************** + */ + +#define LEAF_pppLinkStatusPhysicalIndex 1 +#define MIN_pppLinkStatusPhysicalIndex 0L +#define MAX_pppLinkStatusPhysicalIndex 2147483647L +#define LEAF_pppLinkStatusBadAddresses 2 +#define LEAF_pppLinkStatusBadControls 3 +#define LEAF_pppLinkStatusPacketTooLongs 4 +#define LEAF_pppLinkStatusBadFCSs 5 +#define LEAF_pppLinkStatusLocalMRU 6 +#define MIN_pppLinkStatusLocalMRU 1L +#define MAX_pppLinkStatusLocalMRU 2147483647L +#define LEAF_pppLinkStatusRemoteMRU 7 +#define MIN_pppLinkStatusRemoteMRU 1L +#define MAX_pppLinkStatusRemoteMRU 2147483647L +#define LEAF_pppLinkStatusLocalToPeerACCMap 8 +#define SIZE_pppLinkStatusLocalToPeerACCMap 4L +#define LEAF_pppLinkStatusPeerToLocalACCMap 9 +#define SIZE_pppLinkStatusPeerToLocalACCMap 4L +#define LEAF_pppLinkStatusLocalToRemoteProtocolCompression 10 +#define VAL_pppLinkStatusLocalToRemoteProtocolCompression_enabled 1L +#define VAL_pppLinkStatusLocalToRemoteProtocolCompression_disabled 2L +#define LEAF_pppLinkStatusRemoteToLocalProtocolCompression 11 +#define VAL_pppLinkStatusRemoteToLocalProtocolCompression_enabled 1L +#define VAL_pppLinkStatusRemoteToLocalProtocolCompression_disabled 2L +#define LEAF_pppLinkStatusLocalToRemoteACCompression 12 +#define VAL_pppLinkStatusLocalToRemoteACCompression_enabled 1L +#define VAL_pppLinkStatusLocalToRemoteACCompression_disabled 2L +#define LEAF_pppLinkStatusRemoteToLocalACCompression 13 +#define VAL_pppLinkStatusRemoteToLocalACCompression_enabled 1L +#define VAL_pppLinkStatusRemoteToLocalACCompression_disabled 2L +#define LEAF_pppLinkStatusTransmitFcsSize 14 +#define MIN_pppLinkStatusTransmitFcsSize 0L +#define MAX_pppLinkStatusTransmitFcsSize 128L +#define LEAF_pppLinkStatusReceiveFcsSize 15 +#define MIN_pppLinkStatusReceiveFcsSize 0L +#define MAX_pppLinkStatusReceiveFcsSize 128L +#define LEAF_pppLinkConfigInitialMRU 1 +#define MIN_pppLinkConfigInitialMRU 0L +#define MAX_pppLinkConfigInitialMRU 2147483647L +#define LEAF_pppLinkConfigReceiveACCMap 2 +#define SIZE_pppLinkConfigReceiveACCMap 4L +#define LEAF_pppLinkConfigTransmitACCMap 3 +#define SIZE_pppLinkConfigTransmitACCMap 4L +#define LEAF_pppLinkConfigMagicNumber 4 +#define VAL_pppLinkConfigMagicNumber_false 1L +#define VAL_pppLinkConfigMagicNumber_true 2L +#define LEAF_pppLinkConfigFcsSize 5 +#define MIN_pppLinkConfigFcsSize 0L +#define MAX_pppLinkConfigFcsSize 128L diff --git a/h/ppp/snmpAgent/leaf1472.h b/h/ppp/snmpAgent/leaf1472.h new file mode 100644 index 0000000..34f0aa7 --- /dev/null +++ b/h/ppp/snmpAgent/leaf1472.h @@ -0,0 +1,71 @@ +/****************************************************************************** + ****************************************************************************** + **** This file was automatically generated by Wind River's + **** WindManage MIB Compiler, version 9.3. + **** This file was generated using the -leaf switch. + **** + **** This file #defines C preprocessor macros providing a variety of + **** information for the leaf objects in the MIB. + **** + **** The file includes a LEAF_xxx macro for each leaf object in the + **** MIB (xxx is replaced by the object's name). The value of the + **** LEAF_xxx macro is the final component of the object's object + **** identifier. + **** + **** If the object's SYNTAX clause included named INTEGER values, + **** then there is a VAL_xxx_yyy macro for each named value (xxx is + **** replaced by the object's name and yyy by the value's name). The + **** value of the VAL_xxx_yyy macro is the value associated with the + **** named value. + **** + **** If the object's SYNTAX clause specified a set of range limitations + **** for the value of the object, then there are one or more sets of + **** MIN_xxx and MAX_xxx macros specifying the lower and upper bound of + **** each range limitation. + **** + **** If the object's SYNTAX clause specified a set of size constraints + **** for the value of the object, then there are one or more sets of + **** MINSIZE_xxx and MAXSIZE_xxx macros specifying the lower and upper + **** bound of each size constraint. (If the size constraint is a single + **** value rather than a range then the MINSIZE_xxx and MAXSIZE_xxx + **** macros are replaced by a single SIZE_xxx macro.) + **** + **** DO NOT MODIFY THIS FILE BY HAND. + **** + **** Last build date: Mon Aug 5 23:32:47 2002 + **** from files: + **** rfc1213.mib, rfc1471.mib, rfc1472.mib + **** starting from node: pppSecurity + ****************************************************************************** + ****************************************************************************** + */ + +#define LEAF_pppSecurityConfigLink 1 +#define MIN_pppSecurityConfigLink 0L +#define MAX_pppSecurityConfigLink 2147483647L +#define LEAF_pppSecurityConfigPreference 2 +#define MIN_pppSecurityConfigPreference 0L +#define MAX_pppSecurityConfigPreference 2147483647L +#define LEAF_pppSecurityConfigProtocol 3 +#define LEAF_pppSecurityConfigStatus 4 +#define VAL_pppSecurityConfigStatus_invalid 1L +#define VAL_pppSecurityConfigStatus_valid 2L +#define LEAF_pppSecuritySecretsLink 1 +#define MIN_pppSecuritySecretsLink 0L +#define MAX_pppSecuritySecretsLink 2147483647L +#define LEAF_pppSecuritySecretsIdIndex 2 +#define MIN_pppSecuritySecretsIdIndex 0L +#define MAX_pppSecuritySecretsIdIndex 2147483647L +#define LEAF_pppSecuritySecretsDirection 3 +#define VAL_pppSecuritySecretsDirection_local_to_remote 1L +#define VAL_pppSecuritySecretsDirection_remote_to_local 2L +#define LEAF_pppSecuritySecretsProtocol 4 +#define LEAF_pppSecuritySecretsIdentity 5 +#define MINSIZE_pppSecuritySecretsIdentity 0L +#define MAXSIZE_pppSecuritySecretsIdentity 255L +#define LEAF_pppSecuritySecretsSecret 6 +#define MINSIZE_pppSecuritySecretsSecret 0L +#define MAXSIZE_pppSecuritySecretsSecret 255L +#define LEAF_pppSecuritySecretsStatus 7 +#define VAL_pppSecuritySecretsStatus_invalid 1L +#define VAL_pppSecuritySecretsStatus_valid 2L diff --git a/h/ppp/snmpAgent/leaf1473.h b/h/ppp/snmpAgent/leaf1473.h new file mode 100644 index 0000000..d3715bf --- /dev/null +++ b/h/ppp/snmpAgent/leaf1473.h @@ -0,0 +1,63 @@ +/****************************************************************************** + ****************************************************************************** + **** This file was automatically generated by Wind River's + **** WindManage MIB Compiler, version 9.3. + **** This file was generated using the -leaf switch. + **** + **** This file #defines C preprocessor macros providing a variety of + **** information for the leaf objects in the MIB. + **** + **** The file includes a LEAF_xxx macro for each leaf object in the + **** MIB (xxx is replaced by the object's name). The value of the + **** LEAF_xxx macro is the final component of the object's object + **** identifier. + **** + **** If the object's SYNTAX clause included named INTEGER values, + **** then there is a VAL_xxx_yyy macro for each named value (xxx is + **** replaced by the object's name and yyy by the value's name). The + **** value of the VAL_xxx_yyy macro is the value associated with the + **** named value. + **** + **** If the object's SYNTAX clause specified a set of range limitations + **** for the value of the object, then there are one or more sets of + **** MIN_xxx and MAX_xxx macros specifying the lower and upper bound of + **** each range limitation. + **** + **** If the object's SYNTAX clause specified a set of size constraints + **** for the value of the object, then there are one or more sets of + **** MINSIZE_xxx and MAXSIZE_xxx macros specifying the lower and upper + **** bound of each size constraint. (If the size constraint is a single + **** value rather than a range then the MINSIZE_xxx and MAXSIZE_xxx + **** macros are replaced by a single SIZE_xxx macro.) + **** + **** DO NOT MODIFY THIS FILE BY HAND. + **** + **** Last build date: Mon Aug 5 23:32:47 2002 + **** from files: + **** rfc1213.mib, rfc1471.mib, rfc1472.mib, rfc1473.mib + **** starting from node: pppIp + ****************************************************************************** + ****************************************************************************** + */ + +#define LEAF_pppIpOperStatus 1 +#define VAL_pppIpOperStatus_opened 1L +#define VAL_pppIpOperStatus_not_opened 2L +#define LEAF_pppIpLocalToRemoteCompressionProtocol 2 +#define VAL_pppIpLocalToRemoteCompressionProtocol_none 1L +#define VAL_pppIpLocalToRemoteCompressionProtocol_vj_tcp 2L +#define LEAF_pppIpRemoteToLocalCompressionProtocol 3 +#define VAL_pppIpRemoteToLocalCompressionProtocol_none 1L +#define VAL_pppIpRemoteToLocalCompressionProtocol_vj_tcp 2L +#define LEAF_pppIpRemoteMaxSlotId 4 +#define MIN_pppIpRemoteMaxSlotId 0L +#define MAX_pppIpRemoteMaxSlotId 255L +#define LEAF_pppIpLocalMaxSlotId 5 +#define MIN_pppIpLocalMaxSlotId 0L +#define MAX_pppIpLocalMaxSlotId 255L +#define LEAF_pppIpConfigAdminStatus 1 +#define VAL_pppIpConfigAdminStatus_open 1L +#define VAL_pppIpConfigAdminStatus_close 2L +#define LEAF_pppIpConfigCompression 2 +#define VAL_pppIpConfigCompression_none 1L +#define VAL_pppIpConfigCompression_vj_tcp 2L diff --git a/h/ppp/snmpAgent/snmp1471.h b/h/ppp/snmpAgent/snmp1471.h new file mode 100644 index 0000000..0659e26 --- /dev/null +++ b/h/ppp/snmpAgent/snmp1471.h @@ -0,0 +1,31 @@ +/****************************************************************************** + ****************************************************************************** + **** This file was automatically generated by Wind River's + **** WindManage MIB Compiler, version 9.3. + **** This file was generated using the -skel.h switch. + **** + **** This file contains declarations of stub functions to aid in building + **** the agent MIB interface. It declares all the MIB get, set, test and + **** next method routines that you will need to supply. You'll probably + **** want to FORCE-INCLUDE this file when using the -mib.c output mode. + **** + **** To generate the skeletal stub functions themselves, run the MIB compiler + **** with the -skel switch. + **** + **** YOU MAY MODIFY THIS FILE BUT BEWARE ACCIDENTALLY OVERWRITING IT + **** BY REGENERATING IT WITH THE MIB COMPILER. + **** + **** Last build date: Mon Aug 5 23:32:47 2002 + **** from files: + **** rfc1213.mib, rfc1471.mib, ppp_output/rfc1471.ctl + **** starting from node: pppLcp + ****************************************************************************** + ****************************************************************************** + */ + +void pppLinkStatusEntryGet(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void pppLinkStatusEntryNext(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void pppLinkConfigEntryGet(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void pppLinkConfigEntrySet(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void pppLinkConfigEntryTest(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void pppLinkConfigEntryNext(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); diff --git a/h/ppp/snmpAgent/snmp1472.h b/h/ppp/snmpAgent/snmp1472.h new file mode 100644 index 0000000..eebe86a --- /dev/null +++ b/h/ppp/snmpAgent/snmp1472.h @@ -0,0 +1,33 @@ +/****************************************************************************** + ****************************************************************************** + **** This file was automatically generated by Wind River's + **** WindManage MIB Compiler, version 9.3. + **** This file was generated using the -skel.h switch. + **** + **** This file contains declarations of stub functions to aid in building + **** the agent MIB interface. It declares all the MIB get, set, test and + **** next method routines that you will need to supply. You'll probably + **** want to FORCE-INCLUDE this file when using the -mib.c output mode. + **** + **** To generate the skeletal stub functions themselves, run the MIB compiler + **** with the -skel switch. + **** + **** YOU MAY MODIFY THIS FILE BUT BEWARE ACCIDENTALLY OVERWRITING IT + **** BY REGENERATING IT WITH THE MIB COMPILER. + **** + **** Last build date: Mon Aug 5 23:32:47 2002 + **** from files: + **** rfc1213.mib, rfc1471.mib, rfc1472.mib, ppp_output/rfc1472.ctl + **** starting from node: pppSecurity + ****************************************************************************** + ****************************************************************************** + */ + +void pppSecurityConfigEntryGet(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void pppSecurityConfigEntrySet(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void pppSecurityConfigEntryTest(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void pppSecurityConfigEntryNext(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void pppSecuritySecretsEntryGet(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void pppSecuritySecretsEntryNext(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void pppSecuritySecretsEntrySet(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void pppSecuritySecretsEntryTest(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); diff --git a/h/ppp/snmpAgent/snmp1473.h b/h/ppp/snmpAgent/snmp1473.h new file mode 100644 index 0000000..217288a --- /dev/null +++ b/h/ppp/snmpAgent/snmp1473.h @@ -0,0 +1,32 @@ +/****************************************************************************** + ****************************************************************************** + **** This file was automatically generated by Wind River's + **** WindManage MIB Compiler, version 9.3. + **** This file was generated using the -skel.h switch. + **** + **** This file contains declarations of stub functions to aid in building + **** the agent MIB interface. It declares all the MIB get, set, test and + **** next method routines that you will need to supply. You'll probably + **** want to FORCE-INCLUDE this file when using the -mib.c output mode. + **** + **** To generate the skeletal stub functions themselves, run the MIB compiler + **** with the -skel switch. + **** + **** YOU MAY MODIFY THIS FILE BUT BEWARE ACCIDENTALLY OVERWRITING IT + **** BY REGENERATING IT WITH THE MIB COMPILER. + **** + **** Last build date: Mon Aug 5 23:32:47 2002 + **** from files: + **** rfc1213.mib, rfc1471.mib, rfc1472.mib, rfc1473.mib, + **** ppp_output/rfc1473.ctl + **** starting from node: pppIp + ****************************************************************************** + ****************************************************************************** + */ + +void pppIpEntryGet(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void pppIpEntryNext(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void pppIpConfigEntryGet(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void pppIpConfigEntrySet(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void pppIpConfigEntryTest(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void pppIpConfigEntryNext(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); diff --git a/h/ppp/usrPPPConfig.h b/h/ppp/usrPPPConfig.h new file mode 100644 index 0000000..cb93833 --- /dev/null +++ b/h/ppp/usrPPPConfig.h @@ -0,0 +1,271 @@ +/* usrPPPConfig.h - user PPP configuration */ + +/* Copyright 1999 - 2004 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01d,30sep04,ijm added ppp5xSecretsShow, and ppp5xStackGet +01c,27aug04,ijm vxWorks 5.x equivalent PPP changes +01b,25oct02,ijm added pppAddressSet +01a,06jul03,mk created +*/ + + +#ifndef __INCusrPPPConfigh +#define __INCusrPPPConfigh + + +#ifdef __cplusplus +extern "C" { +#endif + +#include "pfw/pfw.h" +#include "ppp/pppVsEndComponent.h" +#include "ppp/kppp.h" +#include "netinet/sl_compress.h" +#include "pppInterfaces.h" +#include "memLib.h" + + +/* serial ports */ + +#define COM1 "0" +#define COM2 "1" + +/* Serial peer types */ + +#define REGULAR 0x0 /* other end is a regular(NON-WINDOWS) machine */ +#define WIN_SERVER 0x1 /* other end is a WINDOWS server */ +#define WIN_CLIENT 0x2 /* other end is a WINDOWS client */ +#define MODEM 0x3 /* other end is a modem */ + +/* PPPoE connection modes */ + +#define PPPOE_HOST_CONNECTION_MODE "0x2" /* client mode */ +#define PPPOE_AC_CONNECTION_MODE "0x1" /* server mode */ + +#define PPP_BOOT_DEV_STR_SIZE 64 /* e.g. "ppp=1,19200,REGULAR" */ +#define PEER_TYPE_STR_SIZE 12 +#define ACCM_STR_SIZE 12 +#define MAGIC_RANGE_STR_SIZE 20 +#define PHONE_STR_SIZE 20 +#define MODEM_INIT_STR_SIZE 100 + +/* usrWindNetPPP connection status flags */ + +#define PPP_CONN_OPENED 0x1 /* if set, connected with peer OK */ +#define PPP_STACK_DELETED 0x2 /* if set, stack has been deleted */ +#define PPP_AUTH_REFUSED 0x4 /* if set, server refused auth */ +#define PPP_AUTH_FAILED 0x8 /* if set, client auth failed */ +#define PPP_STACK_DEL_IN_PROGRESS 0x10 /* if set, stack is being deleted */ +#define PPP_DISCONNECT_IN_PROGRESS 0x20 /* disconnection is in progress */ +#define PPP_LCP_OPENED 0x40 /* LCP reached OPENED state */ +#define PPP_IPCP_OPENED 0x80 /* IPCP reached OPENED state */ +#define PPP_PAP_OPENED 0x100 /* PAP reached OPENED satte */ +#define PPP_CHAP_OPENED 0x200 /* CHAP reached OPENED satte */ + + + +/* externs */ + +extern void pppAddressSet (PFW_PROFILE_OBJ * profile, char * paramName, + char * localValue, char * remoteValue, + BOOL negotiationRequired); + +typedef struct pppFrameworkParameters + { + char pfwName [PFW_MAX_NAME_LENGTH]; /* framework name */ + unsigned int dataTaskPriority; /* handles data packets: */ + /* IPv4, IPv6 */ + unsigned int controlTaskPriority; /* handles control packets */ + /* LCP, PAP, CHAP, IPCP... */ + unsigned int dataTaskJobQueueSize; /* in bytes */ + unsigned int controlTaskJobQueueSize; /* in bytes */ + PART_ID memPartition; /* memory partition */ + NET_POOL_ID netPool; /* network mbuf pool */ + int numTty; /* number of serial ports */ + } PPP_FRAMEWORK_PARAMETERS; + + +typedef struct pppSerialParameters + { + /* serial port parameters */ + + int port; /* e.g., 0 is COM1 */ + /* "1" is COM2 */ + int baudRate; /* e.g.19200, 38400 */ + char peerType [PEER_TYPE_STR_SIZE]; /* "REGULAR" */ + /* "WIN_CLIENT */ + /* "WIN_SERVER" */ + /* "MODEM" */ + char accm [ACCM_STR_SIZE]; /* Asynchronous control */ + /* character map, e.g. */ + /* "00000000L", if NULL */ + /* map = "ffffffffL" */ + } PPP_SERIAL_PARAMETERS; + + + +typedef struct pppServerParameters + { + BOOL acceptRemote; /* allow peer to set its */ + /* local IP address */ + BOOL useRasPool; /* Assign IPv4 addresses */ + /* to clients using */ + /* RAS pool */ + char rasPoolStartAddress [INET_ADDR_LEN]; /* Pool start address */ + /* e.g., "90.0.0.10" */ + int rasPoolSize; /* Number of addresses */ + /* in pool, default is 20 */ + char primaryDnsAddress [INET_ADDR_LEN]; /* offer clients this */ + /* address */ + char secondaryDnsAddress [INET_ADDR_LEN]; /* to offer clients */ + BOOL useChap; /* authenticate clients */ + int chapInterval; /* In seconds */ + BOOL usePap; /* authenticate clients */ + } PPP_SERVER_PARAMETERS; + + +typedef struct pppClientParameters + { + /* client IPv4 parameters */ + + BOOL acceptLocal; /* peer provides it */ + BOOL acceptRemote; /* peer provides it */ + BOOL setDefaultRoute; /* set peer address as */ + /* default route */ + BOOL useChap; /* authenticate to server */ + BOOL usePap; /* authenticate to server */ + BOOL getDns; /* get DNS adddresses */ + char userName [NAME_SIZE]; /* client user name */ + char password [NAME_SIZE]; /* client password */ + + } PPP_CLIENT_PARAMETERS; + + +typedef struct pppConnectionMode + { + PPP_CLIENT_PARAMETERS client; + PPP_SERVER_PARAMETERS server; + } PPP_MODE_PARAMETERS; + +/* + * selected connection parameters. This is just a subset of available + * options that can be configured using WindNet PPP API + */ + +typedef struct pppBasicLinkParameters + { + BOOL sendEchoes; + int echoInterval; /* in seconds */ + int maxEchoRetries; /* if peer does not respond, */ + /* maximum retries before */ + /* terminating connection */ + char localMagicRange [MAGIC_RANGE_STR_SIZE]; + /* start,end,step: e.g., */ + /* "1,2147483647,0" */ + /* start should always be > 0 */ + /* step of 0 means any number */ + /* within the range is OK. */ + char remoteMagicRange [MAGIC_RANGE_STR_SIZE]; + BOOL acfc; /* Adress and Control Field */ + /* Compression */ + BOOL pfc; /* Protocol Field Compression */ + BOOL localVjc; /* Van Jacobson TCP header */ + BOOL remoteVjc; + int localVjcMaxSlots; /* maximum local slots */ + int remoteVjcMaxSlots; /* maximum remote slots */ + BOOL silentMode; /* if TRUE, responds to configure */ + /* requests, but does not */ + /* initiate them.*/ + } PPP_BASIC_LINK_PARAMETERS; + +/* requested configuration options */ + +typedef struct pppConfigurationOptions + { + PPP_SERIAL_PARAMETERS serial; /* serial port parameters */ + BOOL isServer; /* client/server mode */ + PPP_MODE_PARAMETERS mode; /* server/client parameters */ + PPP_BASIC_LINK_PARAMETERS link; /* basic link parameters */ + char localIpv4Address [INET_ADDR_LEN]; /* request this address */ + /* for client, "0.0.0.0", */ + /* means get from server */ + char remoteIpv4Address [INET_ADDR_LEN]; /* request this address */ + /* for client, "0.0.0.0", */ + /* means get from server */ + /* for server, "0.0.0.0", */ + /* means assign addresses */ + /* to clients using RAS pool */ + } PPP_CONFIGURATION_OPTIONS; + +/* cookie returned by windNetPPPInit */ + +typedef struct pppHandle + { + PFW_STACK_OBJ * pStackObj; /* returned PPP stack */ + int status; /* returned ppp connection status */ + PPP_END_IPV4_INFO ipv4Info; /* returned negotiated DNS/IP */ + /* addresses;ppp interface unit # */ + SEM_ID syncSem; /* passed client sync semaphore */ + BOOL isModemPeer; /* peer is modem (client mode) */ + BOOL isServer; /* server mode */ + BOOL setDefaultRoute; /* client mode */ + BOOL verbose; /* TRUE: print usrWindNetPPPInit */ + /* status messages. */ + int silentRestartInterval; /* seconds to wait before */ + /* re-starting */ + char phoneString [PHONE_STR_SIZE]; /* number to dial */ + char modemInitString [MODEM_INIT_STR_SIZE]; /* external modem */ + /* initialization string */ + } PPP_HANDLE; + + +/* externs */ + +extern PPP_HANDLE * usrWindNetPPPInit (char *pBootDev, char *localAddr, + char *peerAddr); + +extern PFW_STACK_OBJ * windnetPPPInit (PFW_OBJ * pFramework, + PFW_PROFILE_OBJ * pProfile, + PPP_HANDLE * pUserHandle); + +extern STATUS ppp5xConnect (PPP_HANDLE * pppUserHandle); +extern STATUS ppp5xDisconnect (PPP_HANDLE * pppUserHandle); +extern void ppp5xDelete (PPP_HANDLE * pppUserHandle); +void ppp5xShow (PPP_HANDLE * pUserHandle, BOOL showStackProfile); + + +extern STATUS pppLocalSecretAdd (char * userName, char * password); +extern STATUS pppLocalSecretDelete (char * userName); + +extern STATUS pppPeerSecretAdd (char * userName, char * password); +extern STATUS pppPeerSecretDelete (char * userName); + +extern void ppp5xSecretsShow (void); + +extern PFW_STACK_OBJ * ppp5xStackGet (PPP_HANDLE * pUserHandle); + +extern STATUS pppLocalUserProfileSet (PFW_OBJ * pFramework, + PFW_PROFILE_OBJ * pProfile, + char * userName, char * password); + +extern STATUS modemConnectTest (char * initString, char * modemNumber, + char * modemDialResponse, + PFW_STACK_OBJ * pModemStack, + PPP_UPCALL_FUNCTIONS * pUpcalls, + void * handle); + +extern STATUS modemDisconnectTest (PFW_STACK_OBJ * pModemStack, + BOOL closeConnection); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusrPPPConfigh */ + diff --git a/h/pppLib.h b/h/pppLib.h new file mode 100644 index 0000000..da8d77c --- /dev/null +++ b/h/pppLib.h @@ -0,0 +1,46 @@ +/* pppLib.h - Point-to-Point Protocol library header */ + +/* Copyright 1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,30nov95,vin included pppHookLib.h. +01c,16jun95,dzb defined VJC for overall compile-time VJ compression control. +01b,09may95,dzb added inclusion of pppSecretLib.h. +01a,07mar95,dzb written. +*/ + +#ifndef __INCpppLibh +#define __INCpppLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#define VJC /* define for VJ compression support */ + +#include "netinet/ppp/pppd.h" +#include "netinet/ppp/pppSecretLib.h" +#include "netinet/ppp/pppShow.h" +#include "netinet/ppp/pppHookLib.h" + +#if defined(__STDC__) || defined(__cplusplus) + +extern int pppInit (int unit, char *devname, char *local_addr, + char *remote_addr, int baud, PPP_OPTIONS *pOptions, + char *fOptions); +extern void pppDelete (int unit); + +#else /* __STDC__ */ + +extern int pppInit (); +extern void pppDelete (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppLibh */ diff --git a/h/private/adrSpaceLibP.h b/h/private/adrSpaceLibP.h new file mode 100644 index 0000000..07d3ba4 --- /dev/null +++ b/h/private/adrSpaceLibP.h @@ -0,0 +1,92 @@ +/* adrSpaceLibP.h - Address Space Library header */ + +/* Copyright 1998-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,22sep04,zl post-inspection fixes. +01a,31aug04,zl created. +*/ + +#ifndef __INCadrSpaceLibPh +#define __INCadrSpaceLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" +#include "private/pgPoolLibP.h" +#include "private/vmLibP.h" + + +/* address space options */ + +#define ADR_SPACE_OPT_KERNEL 0x00000001 +#define ADR_SPACE_OPT_RTP 0x00000002 +#define ADR_SPACE_OPT_SD 0x00000004 + +/* typedefs */ + +typedef struct adr_space_private_info + { + PAGE_POOL_ID userPgPoolId; /* user region free pool */ + PAGE_POOL_ID userMstrPgPoolId; /* user region master pool */ + PAGE_POOL_ID kernelPgPoolId; /* kernel region free pool */ + PAGE_POOL_ID kernelMstrPgPoolId; /* kernel region master pool */ + PAGE_POOL_ID kernelVirtPgPoolId; /* kernel virtual page pool */ + VIRT_ADDR kernelMemTop; /* top of kernel memory */ + VIRT_ADDR localMemLocalAdrs; /* LOCAL_MEM_LOCAL_ADRS */ + PHYS_MEM_DESC *pPhysMemDesc; /* mem.desc table */ + int physMemDescNumEnt; /* number of entries */ + + } ADR_SPACE_PRIVATE_INFO; + +typedef struct adrSpaceRgnCtl + { + UINT allocUnit; /* allocation unit size */ + PAGE_POOL_ID freePgPoolId; /* free page pool */ + PAGE_POOL_ID masterPgPoolId; /* master page pool */ + } ADR_SPACE_RGN_CTL; + +typedef struct adrSpaceInitParams + { + PHYS_MEM_DESC * pPhysMemDesc; /* physMemDesc pointer */ + int physMemDescNumEnt; /* number of elements */ + VIRT_ADDR localMemLocalAdrs; /* where memory begins */ + VIRT_ADDR kernelMemTop; /* top of kernel mem (heap) */ + VIRT_ADDR overlapBaseAdr; /* overlapped rgn base adrs */ + UINT overlapMaxSize; /* overlapped rgn max size */ + } ADR_SPACE_INIT_PARAMS; + +/* globals */ + +extern PAGE_POOL_ID globalRAMPgPoolId; + +/* function prototypes */ + +extern STATUS adrSpaceLibInit (VIRT_ADDR localMemLocalAdrs, + VIRT_ADDR kernelMemTop, + PHYS_MEM_DESC *pPhysMemDesc, + int physMemDescNumEnt, + VIRT_ADDR overlapBaseAdr, + UINT overlapMaxSize); +extern PAGE_POOL_ID adrSpaceCreate (UINT options); +extern PAGE_POOL_ID adrSpaceCreateAt (VIRT_ADDR virtAdr, UINT minBytes, + UINT options); +extern STATUS adrSpaceDelete (PAGE_POOL_ID pgPoolId); +extern STATUS adrSpaceAlloc (PAGE_POOL_ID poolId, UINT minBytes); +extern STATUS adrSpaceAllocAt (PAGE_POOL_ID poolId, VIRT_ADDR virtAdrs, + UINT minBytes); +extern void adrSpacePrivateInfoGet (ADR_SPACE_PRIVATE_INFO * pInfo); +extern STATUS adrSpaceShowInit (); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCadrSpaceLibPh */ diff --git a/h/private/aioPxLibP.h b/h/private/aioPxLibP.h new file mode 100644 index 0000000..0bada77 --- /dev/null +++ b/h/private/aioPxLibP.h @@ -0,0 +1,170 @@ +/* aioPxLibP.h - asynchronous I/O header file */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,30jan04,dat Rework for RTP compatibility +01g,18jul96,dbt moved aioPxLibInit() and aioShow() prototypes to aio.h + (SPR #3227). + Updated copyright. +01f,15apr94,kdl changed FD_NODE_TO_SYS macro to use offsetof(). +01e,08apr94,kdl changed aio_show() to aioShow(). +01d,26jan94,kdl changed include of ioQPxLib.h to ioQLib.h. +01c,12jan94,kdl changed aioInit() to aioPxLibInit(); general cleanup. +01b,06dec93,dvs changed M_aioLib to M_aioPxLib + changed S_aioLib* to S_aioPxLib* +01a,04apr93,elh written. +*/ + + +#ifndef __INCaioPxLibh +#define __INCaioPxLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#ifdef _WRS_KERNEL +#include "sigLib.h" /* need generic signal send rtn in RTP space!*/ +#endif + +#include "semLib.h" +#include "pthread.h" +#include "selectLib.h" +#include "lstLib.h" +#include "semLib.h" +#include "ioQLib.h" +#include "dllLib.h" +#include "stddef.h" + +/* defines */ + +/* aio driver ioctl functions */ + +#define FAIO_PUSH 1 /* push request to head */ +#define FAIO_CANCEL 2 /* cancel a request */ + +/* aio control block states */ + +#define AIO_FREE 0 /* not submitted */ +#define AIO_COMPLETED 1 /* completed */ +#define AIO_READY 2 /* ready to be submitted */ +#define AIO_QUEUED 3 /* queued */ +#define AIO_WAIT 4 /* waiting */ +#define AIO_RUNNING 5 /* running */ + +#define AIO_CLUST_MAX 100 /* default max clusters */ + +/* easy access to aio_sys */ + +#define aio_state aio_sys.state +#define aio_retVal aio_sys.ioNode.retVal +#define aio_errorVal aio_sys.ioNode.errorVal + +/* mark request done */ + +#define AIO_DONE_SET(pAiocb, _ret, _err) \ + { \ + (pAiocb)->aio_sys.state = AIO_COMPLETED; \ + (pAiocb)->aio_sys.ioNode.retVal = (_ret); \ + (pAiocb)->aio_sys.ioNode.errorVal = (_err); \ + } + +#define FD_NODE_TO_SYS(pNode) \ + ((AIO_SYS *)(void *)((char *)(pNode) - offsetof(AIO_SYS, fdNode))) + + + +/* typedefs */ + +typedef struct aio_clust /* aio cluster */ + { + BOOL inuse; /* cluster in use */ + int refCnt; /* reference count */ + +#ifdef _WRS_KERNEL + struct sigpend sigpend; /* signal */ +#else + int sigNo; /* signal # */ + union sigval sigVal; /* signal value */ +#endif + pthread_mutex_t lock; + pthread_cond_t wake; /* cluster cond var */ + + } AIO_CLUST; + +typedef struct aio_sys /* aio system info */ + { + IO_NODE ioNode; /* I/O queue node */ + int state; /* state */ + AIO_CLUST * pClust; /* lio cluster */ + struct aiocb * pAiocb; /* A-I/O control block */ + +#ifdef _WRS_KERNEL + struct sigpend sigpend; /* signal */ +#else + int sigNo; + union sigval sigVal; +#endif + pthread_mutex_t lock; /* aiocb lock */ + /* protects the wait list*/ + pthread_cond_t wake; /* aiocb cond var */ + + LIST wait; /* wait list */ + DL_NODE fdNode; /* node for fd list */ + } AIO_SYS; + + +typedef struct aio_wait_id /* wait structure */ + { + NODE node; /* wait list node */ + BOOL done; /* completed */ + pthread_mutex_t lock; /* wait id lock */ + pthread_cond_t wake; /* wait id cond var */ + } AIO_WAIT_ID; + +typedef struct aio_fd_entry /* A-I/O fd table entry */ + { + DL_LIST ioQ; /* I/O queue */ + SEM_ID ioQSem; /* semaphore for I/O queue */ + } AIO_FD_ENTRY; + +typedef struct aio_dev /* driver A-I/O struct */ + { + IO_Q ioQ; /* I/O queues */ + int maxFiles; /* max files */ + SEM_ID lockSem; /* system lock semaphore */ + AIO_FD_ENTRY * fdTable; /* table array */ + AIO_CLUST * clustTable; /* cluster array */ + int clustMax; /* cluster array size */ + FUNCPTR printRtn; /* print rtn */ + SEM_ID ioSem; /* mutex ?? */ + SEM_ID qSem; /* work and done ? */ + SEM_ID workSem; /* work semaphore */ + int waitFd; /* wait pipe fd */ + fd_set ioWait[2]; /* Yuch ! */ + fd_set io[2]; /* more yuch ! */ + } AIO_DEV; + +extern AIO_DEV aioDev; /* single global struct */ + +/* forward declarations These are PRIVATE */ + +extern STATUS aioCancel (AIO_DEV * pDev, struct aiocb * pAiocb); +extern STATUS aioPush (AIO_DEV * pDev, struct aiocb * pAiocb); +extern STATUS aioSync (AIO_DEV * pDev, struct aiocb * pAiocb, + FUNCPTR syncReqRtn, int op); +extern void aioDone (AIO_SYS * pReq); + +extern AIO_SYS* aioNext (AIO_DEV * pDev); +extern AIO_FD_ENTRY* aioEntryFind (int fd); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCaioPxLibh */ diff --git a/h/private/assertAltern.h b/h/private/assertAltern.h new file mode 100644 index 0000000..ab9a108 --- /dev/null +++ b/h/private/assertAltern.h @@ -0,0 +1,32 @@ +/* assAltern.h - alternative assert code */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history: +-------------------- +01a,31jul99,jkf T2 merge, tidiness & spelling. +*/ + + +#ifdef ASSERT_SUSP +#include +#include +#include + +#ifdef assert +#undef assert +#endif + +#define assert(a) if(!(a))\ + {\ + int tId=taskIdSelf();\ + fdprintf(2, "Assertion failed: %s ; task ID: 0x%x\n\ + file: "__FILE__", line: %d. Task suspended\a\n",\ + #a, tId, __LINE__);\ + taskSuspend(tId);\ + } +#else +#include +#endif /* ASSERT_SUSP */ + diff --git a/h/private/bpfLibP.h b/h/private/bpfLibP.h new file mode 100644 index 0000000..ffa72b9 --- /dev/null +++ b/h/private/bpfLibP.h @@ -0,0 +1,184 @@ +/* bpfLibP.h - Berkeley Packet Filter (BPF) private include file */ + +/* Copyright 1999 - 2000 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/*- + * Copyright (c) 1990, 1991, 1992, 1994, 1995, 1996 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)bpfdesc.h 7.1 (Berkeley) 5/7/91 + * + * @(#) $Header: bpfdesc.h,v 1.14 96/06/16 22:28:07 leres Exp $ (LBL) + */ + +/* +modification history +-------------------- +01b,17nov00,spm added support for BSD network devices +01a,24nov99,spm created from BSD bpfdesc.h,v 1.14 96/06/16 22:28:07 +*/ + +#ifndef __INCbpfLibPh +#define __INCbpfLibPh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include "vxWorks.h" +#include "lstLib.h" +#include "iosLib.h" +#include "selectLib.h" +#include "endLib.h" + +#include "net/bpf.h" + +/* typedefs */ + +/* Descriptor associated with each attached network interface. */ + +typedef struct bpf_proto_ctrl { /* BPF_PROTO_CTRL */ + NODE bpfProtoLstNode; /* list of interface attachments */ + BOOL bsdFlag; /* BSD or END network device? */ + void * pCookie; /* identifies net device attachment */ + LIST bpfUnitList; /* list of attached BPF units */ + u_int numShared; /* number of shared BPF devices */ + LIST bpfDevList; /* shared BPF device attachments */ + u_int numPromisc; /* number of promiscuous listeners */ + BOOL bpfPromiscEnabled; /* TRUE if BPF turned on promisc */ + u_int dataLinkType; /* data link layer type */ + int mtuSize; /* Max device frame size */ + char devName [END_NAME_MAX + 1]; /* name of network interface */ + int devUnit; /* unit number of network interface */ +} BPF_PROTO_CTRL; + +/* Descriptor associated with each open bpf file. */ + +typedef struct bpf_dev_ctrl { /* BPF_DEV_CTRL */ + NODE bpfDevLstNode; /* node in list of devices attached to an interface */ + UINT32 bpfDevId; /* unique identifier for all units of BPF device */ + BOOL selectFlag; /* tasks pending on select for device? */ + + BPF_PROTO_CTRL * pNetIfCtrl; /* used for first attachment of BPF device */ + BPF_PROTO_CTRL * pNetDev; /* attachment for this unit, if any */ + + SEM_ID lockSem; /* provides mutual exclusion */ + /* + * Buffer slots: two character buffers buffer the incoming packets. + * The model has three slots. recvStoreBuf is always occupied. + * recvStoreBuf (store) - Receive interrupt puts packets here. + * readHoldBuf (hold) - When recvStoreBuf is full, put cluster here + * and wakeup read (replace recvStoreBuf with freeBuf). + * freeBuf (free) - When read is done, put cluster here. + * On receiving, if recvStoreBuf is full and freeBuf is NULL, + * packet is dropped. + */ + + caddr_t recvStoreBuf; /* store slot */ + caddr_t readHoldBuf; /* hold slot */ + caddr_t freeBuf; /* free slot */ + int recvStoreLen; /* current length of store buffer */ + int readHoldLen; /* current length of hold buffer */ + u_int bufSize; /* absolute length of buffers */ + + u_long readTimeout; /* Read timeout in 'ticks' */ + BPF_INSN * pBpfInsnFilter; /* filter code */ + int filterLen; /* number of instructions in filter */ + u_long pktRecvCount; /* number of packets received */ + u_long pktDropCount; /* number of packets dropped */ + BOOL promiscMode; /* true if listening promiscuously */ + BOOL immediateMode; /* true to return on packet arrival */ + BOOL nonBlockMode; /* true if read is non-blocking */ + SEM_ID readWkupSem; /* pended read sem. */ + int usrFlags; /* file open flags */ + BOOL inUse; /* TRUE if being used by a file desc */ + SEL_WAKEUP_LIST selWkupList;/* select wakeup list */ +} BPF_DEV_CTRL; + +typedef struct { /* BPF_DEV_HDR */ + DEV_HDR devHdr; /* BPF device hdr */ + BPF_DEV_CTRL * pBpfDevTbl; /* Table of BPF device entries */ + BPF_PROTO_CTRL * pBpfNetIfTbl; /* Attachments to network interfaces */ + int numDevs; /* number of BPF devices */ + int bufSize; /* default BPF device buffer size */ + SEM_ID lockSem; /* provides mutual exclusion */ + } BPF_DEV_HDR; + +/* defines */ + +#define BPF_LOCK_KEY 1 /* Key to release BPF lock */ +#define BPF_DUMMY_KEY 0 /* dummy key will not release lock */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT int _bpfLock (); +IMPORT BOOL _bpfUnlock (int lockKey); +IMPORT void _bpfPacketTap (LIST * pListBpfDev, long type, M_BLK_ID pMBlk, + int netDataOffset); +IMPORT STATUS _bpfDevDetach (BPF_DEV_CTRL * pBpfDev); +IMPORT void _bpfProtoInit (void); +IMPORT STATUS _bpfProtoAttach (BPF_DEV_CTRL *, char *, int, struct ifnet *); +IMPORT STATUS _bpfProtoDetach (BPF_DEV_CTRL * pBpfDev); +IMPORT STATUS _bpfProtoPromisc (BPF_PROTO_CTRL * pBpfProto, BOOL on); +IMPORT void _bpfTimeStamp (struct timeval * pTimeval); +IMPORT STATUS _bpfProtoSend (BPF_PROTO_CTRL * pBpfProto, char * pBuf, + int nBytes, BOOL nbIo); +#else /* __STDC__ */ + +IMPORT int _bpfLock (); +IMPORT BOOL _bpfUnlock (); +IMPORT STATUS _bpfDevDetach (); +IMPORT void _bpfProtoInit (); +IMPORT BPF_PROTO_CTRL * _bpfProtoAttach (); +IMPORT BPF_PROTO_CTRL * _bpfProtoDetach (); +IMPORT STATUS _bpfProtoPromisc (); +IMPORT void _bpfTimeStamp (); +IMPORT STATUS _bpfProtoSend (); +IMPORT void _bpfPacketTap (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCbpfLibPh */ diff --git a/h/private/cbioLibP.h b/h/private/cbioLibP.h new file mode 100644 index 0000000..e84b556 --- /dev/null +++ b/h/private/cbioLibP.h @@ -0,0 +1,147 @@ +/* cbioLibP.h - cached block I/O device (CBIO) private header file */ + +/* Copyright 1999-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,21dec03,jkf moving define of _WRS_DOSFS2_VXWORKS_AE to dosFsVerP.h +01f,11jul03,rec merge in + .@@/main/tor2/base6_itn1_kernel-int/base6_itn1_kernel-dev.al/3 +01e,30jul01,jkf SPR#69031, common code for both AE & 5.x. +01d,13jun01,jyo SPR#67729: Added three members to the CBIO_DEV structure also + included blkIo.h +01c,29feb00,jkf T3 changes +01b,07dec99,jkf changed OBJ_CORE to HANDLE, SEMAPHORE to SEM_ID. +01a,31aug99,jkf written - CBIO API changes. +*/ + + + +#ifndef __INCcbioLibPh +#define __INCcbioLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This module is for CBIO modules internal use only. + * File system level code (ie users of CBIO device modules) + * should not include this module but rather should use + * the public CBIO API, cbioLib.h. + * + * This WRS private header file is subject to change by WRS + * without notice. + */ + + +/* include's */ +#include "vxWorks.h" +#include "private/dosFsVerP.h" /* determine DOSFS2 OS version */ +#include "cbioLib.h" /* pull in public CBIO API */ +#include "semLib.h" /* for SEM_ID type */ +#include "blkIo.h" /* for BLK_DEV type */ + +/* macro's */ + +#define CBIO_READYCHANGED(x) ((x)->readyChanged) +#define CBIO_REMOVABLE(x) ((x)->cbioParams.cbioRemovable) +#define CBIO_MODE(x) ((x)->cbioMode) + +#ifndef CBIO_DEV_EXTRA +#define CBIO_DEV_EXTRA void /* module specific field */ +#endif + + +/* typedef's */ + +typedef struct cbioFuncs /* CBIO modules method functions */ + { + STATUS (* cbioDevBlkRW) /* Read/Write blocks */ + (CBIO_DEV_ID dev, + block_t startBlock, + block_t numBlocks, + addr_t buffer, + CBIO_RW rw, + cookie_t * pCookie); + STATUS (* cbioDevBytesRW) /* Read/Write bytes */ + (CBIO_DEV_ID dev, + block_t startBlock, + off_t offset, + addr_t buffer, + size_t nBytes, + CBIO_RW rw, + cookie_t * pCookie); + STATUS (* cbioDevBlkCopy) /* Copy sectors */ + (CBIO_DEV_ID dev, + block_t srcBlock, + block_t dstBlock, + block_t numBlocks); + STATUS (* cbioDevIoctl) /* control operations */ + (CBIO_DEV_ID dev, + int command, + addr_t arg); + } CBIO_FUNCS; + +typedef struct cbioDev /* CBIO_DEV */ + { +#ifdef _WRS_DOSFS2_VXWORKS_AE + HANDLE cbioHandle; /* VxWorks AE handle management */ +#else + OBJ_CORE objCore; /* VxWorks 5.x objCore */ +#endif /* _WRS_DOSFS2_VXWORKS_AE */ + + /* Embedded objects */ + + SEM_ID cbioMutex; /* mutex semaphore */ + + /* Functions (methods) */ + + struct cbioFuncs * pFuncs; /* cbioFuncs functions */ + + /* Public attributes */ + + char * cbioDesc; /* printable descriptive string */ + short cbioMode; /* O_RDONLY |O_WRONLY| O_RDWR */ + BOOL readyChanged; /* Device READY status indicator */ + /* ** Physical device attributes */ + + CBIO_PARAMS cbioParams; /* Physical parameters, cbioLib.h */ + + /* *** Implementation defined attributes */ + + caddr_t cbioMemBase; /* base addr of memory pool */ + size_t cbioMemSize; /* size of memory pool used */ + u_long cbioPriv0; /* Implementation defined */ + u_long cbioPriv1; /* Implementation defined */ + u_long cbioPriv2; /* Implementation defined */ + u_long cbioPriv3; /* Implementation defined */ + u_long cbioPriv4; /* Implementation defined */ + u_long cbioPriv5; /* Implementation defined */ + u_long cbioPriv6; /* Implementation defined */ + u_long cbioPriv7; /* Implementation defined */ + CBIO_DEV_EXTRA * pDc ; /* Implementation defined structure */ + CBIO_DEV_ID cbioSubDev; /* Stores the pointer to lower CBIO. */ + BLK_DEV * blkSubDev; /* Stores the pointer to lower BLKDEV. */ + BOOL isDriver; /* This variable is used to verify */ + /* the nature of current layer. */ + } CBIO_DEV; + +/* externals */ + +IMPORT CLASS_ID cbioClassId ; + +/* private functions */ + +CBIO_DEV_ID cbioDevCreate /* used by CBIO modules only */ + ( + caddr_t ramAddr, /* where it is in memory (0 = malloc) */ + size_t ramSize /* pool size */ + ); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcbioLibPh */ diff --git a/h/private/cdromFsLibP.h b/h/private/cdromFsLibP.h new file mode 100644 index 0000000..afe02e8 --- /dev/null +++ b/h/private/cdromFsLibP.h @@ -0,0 +1,675 @@ +/* cdromFsLibP.h - ISO 9660 File System private definitions */ + +/* + * Copyright (c) 2002, 2004-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + + +/* +modification history +-------------------- +01j,11aug05,aeg moved cdromFsDevDelete() prototype to h/cdromFsLib.h +01i,05aug05,aeg added cdromFsDevDelete()+ function prototypes. +01h,31may05,aeg added cdromFsMonitorDevCreate() and cdromFsDiskProbe(). +01g,31mar05,aeg changes to convert to XBD device model. +01e,14sep04,smz Added mFdListSem mutex for fdList operations +01d,16aug04,smz Added mDevSem to T_CDROM_FILE to support mutex protection in + close operation. +01c,05dec02,tkj cdromFs joliet code review changes. +01b,23oct02,tkj Move FIOREADTOCINFO to ioLib.h. +01a,10oct02,tkj Code cleanup: Split into cdromFsLib.h and cdromFsLibP.h. +*/ + +/* + * currently only ISO 9660 is supported. All data dependent on this + * standard has prefix "ISO", or "iso" or "Iso" + */ + +#ifndef cdromFsLibP_h +#define cdromFsLibP_h + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include +#include +#include /* LIST, NODE */ +#include /* SEMPAHORE, semBInit */ +#include +#include + +/* defines */ + +#define LEN32 4 /* for fields reading in CD data descriptors */ +#define LEN16 2 + +/* Magic numbers to verify validity of structs */ + +#define VD_SET_MAG (0x06200556) /* CDROM_VOL_DESC.magic */ +#define VD_LIST_MAG (0x03110364) /* T_CDROMFS_VD_LST.magic */ +#define FD_MAG (0x08211061) /* T_CDROM_FILE.magic */ +#define SEC_BUF_MAG (0x05071163) /* SEC_BUF.magic */ + +/*---------------------------------------------------------------------------*/ + +/* + * Macros to include/exclude certain features + * + * Wind River does not expect customers to modify this file. These + * defines are here instead of inside cdromFsLib.c since they are used in + * this file to delete optional structure members, thus saving memory. + */ + +/* + * CDROMFS_MODE_AUTO_COMBINE_VOLUME_DESCRIPTORS + * + * Define the below to in MODE_AUTO combine together in readdir() output + * of one directory all the files of all volume descriptors from their + * corresponding directory. Without this readdir() will show results for + * only one volume descriptor. + * + * Even without this any file of any volume descriptor can be opened in + * MODE_AUTO. + * + * WARNING: This code only partially works. It does not handle either + * directories larger than one logical block, or the combined directory + * entries larget than one logical block. + * + * This code should normally be ommitted since it only partially works. + */ + +#undef CDROMFS_MODE_AUTO_COMBINE_VOLUME_DESCRIPTORS /* Normally undef */ + +/* + * CDROMFS_MULTI_SESSION_ATAPI_IOCTL + * + * Define the below to ask the ATAPI driver for the CD table of contents + * before trying to determine it ourself. This is not indluded since we + * need one ioctl() command code that works for both ATAPI and SCSI. As + * currently defined, the ATAPI ioctl() command is different from the + * corresponding Mt. Fuji SCSI ioctl(). They need to be unified with the + * same ioctl() command code to the ATAPI definition, the SCSI definition, + * or a new joint definition. The existing different ATAPI and SCSI + * ioctl() commands can then be either kept or deleted. + * + * The value of this macro does not matter if + * CDROMFS_MULTI_SESSION_SUPPORT is omitted. + * + * This code should normally be ommitted since it considers only ATAPI + * drivers, not SCSI drivers. + */ + +#undef CDROMFS_MULTI_SESSION_ATAPI_IOCTL /* Normally undef */ + +/* + * CDROMFS_MULTI_SESSION_SUPPORT + * + * Define the below to include multi-session support. If this is defined + * but CDROMFS_MULTI_SESSION_ATAPI_IOCTL is not, cdromFs always reads the + * CD itself to get the CD table of contents. + * + * This code should normally be ommitted since some CD drives hang if + * cdromFs gets the table of contents itself and references a session that + * does not exist. This is common since cdromFs does not know the number + * of sessions on the disc, so it does not know when to stop when scanning + * the table of contents.. + * + * IMPORTANT: Edit the description of cdromFsLib.c to match the value + * chosen for this macro. See the internal section for instructions. + */ + +#undef CDROMFS_MULTI_SESSION_SUPPORT /* Normally undef */ + +/*---------------------------------------------------------------------------*/ + +/* Disk offset adjustments for big/little endian */ + +#if (_BYTE_ORDER == _LITTLE_ENDIAN) +#define BYTE_ORDER_LITTLE_ENDIAN +#define ENDIAN_OFF_SHORT 0 /* ISO-9660: Section 7.2.3, Page 10 */ +#define ENDIAN_OFF_LONG 0 /* ISO-9660: Section 7.3.3, Page 10 */ +#elif (_BYTE_ORDER == _BIG_ENDIAN) +#define BYTE_ORDER_BIG_ENDIAN +#define ENDIAN_OFF_SHORT 2 /* ISO-9660: Section 7.2.3, Page 10 */ +#define ENDIAN_OFF_LONG 4 /* ISO-9660: Section 7.3.3, Page 10 */ +#else +#error "_BYTE_ORDER must be defined, check compilation flags" +#endif /* (_BYTE_ORDER == _LITTLE_ENDIAN) */ + +/*---------------------------------------------------------------------------*/ + +/* + * Volume descrioptr date disk offsets/sizes + * ISO-9660: Section 8.4.26.1, Table 5, Page 15 + * In memory: T_FILE_DATE_TIME + */ + +#define ISO_V_DATE_TIME_YEAR 0 +#define ISO_V_DATE_TIME_MONTH 4 +#define ISO_V_DATE_TIME_DAY 6 +#define ISO_V_DATE_TIME_HOUR 8 +#define ISO_V_DATE_TIME_MINUTE 10 +#define ISO_V_DATE_TIME_SEC 12 +#define ISO_V_DATE_TIME_100_OF_SEC 14 +#define ISO_V_DATE_TIME_FROM_GREENW_OFF 16 +#define ISO_V_DATE_TIME_FROM_GREENW_NIMUTE 15 + +/*---------------------------------------------------------------------------*/ + +/* + * Primary volume descriptor and seondary volume descriptor disk offsets/sizes + * ISO-9660: Section 8.4, Tables 4, Page 13; section 8.5, Table 6, Page 16 + * In memory: T_CDROMFS_VD_LST + */ + +#define ISO_VD_SYSTEM_ID 8 +#define ISO_VD_VOLUME_ID 40 +#define ISO_VD_VOL_SPACE_SIZE (80+ENDIAN_OFF_LONG) +#define ISO_VD_ESCAPE_SEC 88 +#define ISO_VD_VOL_SET_SIZE (120+ENDIAN_OFF_SHORT) +#define ISO_VD_VOL_SEQUENCE_N (124+ENDIAN_OFF_SHORT) +#define ISO_VD_LB_SIZE (128+ENDIAN_OFF_SHORT) +#define ISO_VD_PT_SIZE (132+ENDIAN_OFF_LONG) + +/* + * ISO 9660 structures contan some data in both Big and Little endian order + * Hopefully all mastering software implementations fill them all in + */ + +#ifdef BYTE_ORDER_BIG_ENDIAN +#define ISO_VD_PT_OCCUR 148 /* u_long */ +#define ISO_VD_PT_OPT_OCCUR 152 /* u_long */ + +#else /* BYTE_ORDER_LITTLE_ENDIAN */ + +#define ISO_VD_PT_OCCUR 140 /* u_long */ +#define ISO_VD_PT_OPT_OCCUR 144 /* u_long */ +#endif /* BYTE_ORDER_BIG_ENDIAN */ + +#define ISO_VD_ROOT_DIR_REC 156 +#define ISO_VD_ROOT_DIR_REC_SIZE (190-156) + +#define ISO_VD_VOL_SET_ID 190 +#define ISO_VD_PUBLISH_ID 318 +#define ISO_VD_DATA_PREP_ID 446 +#define ISO_VD_APPLIC_ID 574 + +#define ISO_VD_COPYR_F_ID 702 +#define ISO_VD_ABSTR_F_ID 739 +#define ISO_VD_BIBLIOGR_F_ID 776 + +#define ISO_VD_VOL_DATE_TIME_STD_SIZE 17 +#define ISO_VD_VOL_CR_DATE_TIME 813 +#define ISO_VD_VOL_MODIF_DATE_TIME 830 +#define ISO_VD_VOL_EXPIR_DATE_TIME 847 +#define ISO_VD_VOL_EFFECT_DATE_TIME 864 + +#define ISO_VD_FILE_STRUCT_VER 881 + +/* Values for ISO_VD_ESCAPE_SEC - From Joliet standard */ + +#define UCS_2_LEVEL1_ID "%/@" /* must be in each VD LEVEL 1 */ +#define UCS_2_LEVEL2_ID "%/C" /* must be in each VD LEVEL 2 */ +#define UCS_2_LEVEL3_ID "%/E" /* must be in each VD LEVEL 3 */ + +/*---------------------------------------------------------------------------*/ + +/* + * ISO Path Table record disk offsets/sizes + * ISO-9660: Section 9.4, Table 11, Page 22 + */ + +#define ISO_PT_REC_LEN_DI 0 +#define ISO_PT_REC_EAR_LEN 1 +#define ISO_PT_REC_EXTENT_LOCATION 2 +#define ISO_PT_REC_PARENT_DIR_N 6 /* short in format due to PT type */ +#define ISO_PT_REC_DI 8 +#define ISO_PT_REC_DI_LEN 8 + +/*---------------------------------------------------------------------------*/ + +/* + * ISO Directory Record disk offsets/sizes + * ISO-9660: Section 9.1, Table 8, Page 19 + */ + +#define ISO_DIR_REC_REC_LEN 0 +#define ISO_DIR_REC_EAR_LEN 1 +#define ISO_DIR_REC_EXTENT_LOCATION (2+ENDIAN_OFF_LONG) +#define ISO_DIR_REC_DATA_LEN (10+ENDIAN_OFF_LONG) +#define ISO_DIR_REC_DATA_TIME 18 +#define ISO_DIR_REC_FLAGS 25 +#define ISO_DIR_REC_FU_SIZE 26 +#define ISO_DIR_REC_IGAP_SIZE 27 +#define ISO_DIR_REC_VOL_SEQU_N (28+ENDIAN_OFF_SHORT) +#define ISO_DIR_REC_LEN_FI 32 +#define ISO_DIR_REC_FI 33 +#define ISO_DIR_REC_LEN 33 + +/* + * flags masks + * ISO-9660: Section 9.1.6, Table 10, Page 20 + */ + +#define DRF_DIRECTORY 0x02 +#define DRF_IS_REC_DESCRIPT 0x04 /* file records are described in EAR */ +#define DRF_PROTECT 0x10 /* location of user's permissions */ +#define DRF_LAST_REC 0x80 /* last file-record */ + + +/*---------------------------------------------------------------------------*/ + +/* + * ISO Extended Attribute Record fields offsets and sizes + * ISO-9660: 9.5, Table 12, Page 23 + */ + +#define ISO_EAR_ONER (0+ENDIAN_OFF_SHORT) +#define ISO_EAR_GROUPE (4+ENDIAN_OFF_SHORT) +#define ISO_EAR_PERMIT 8 + +#define ISO_EAR_F_CR_DATE_TIME_SIZE ISO_VD_VOL_DATE_TIME_STD_SIZE +#define ISO_EAR_F_CR_DATE_TIME 10 +#define ISO_EAR_F_MODIF_DATE_TIME 27 +#define ISO_EAR_F_EXPIR_DATE_TIME 44 +#define ISO_EAR_F_EFFECT_DATE_TIME 81 + +#define ISO_EAR_REC_FORMAT 78 +#define ISO_EAR_REC_ATTR 79 +#define ISO_EAR_REC_LEN (80+ENDIAN_OFF_SHORT) + +#define ISO_EAR_SYS_ID 84 +#define ISO_EAR_SYS_ID_SIZE (116-84) +#define ISO_EAR_SYS_USE 116 +#define ISO_EAR_SYS_USE_SIZE (180-116) +#define ISO_EAR_VERSION 180 /* currently have to be 1 (ISO) */ + +#define ISO_EAR_LEN_ESC 181 +#define ISO_EAR_RESERVED 182 +#define ISO_EAR_RESERVED_SIZE (246-182) +#define ISO_EAR_LEN_AU 246 +#define ISO_EAR_APP_USE 250 + +/* + * EAR-Record Format values + * ISO-9660: Section 9.5.8, Page 24 + */ + +#define EAR_REC_FORM_IGNORE ((u_char)0) +#define EAR_REC_FORM_FIX_LEN CDROM_MDU_TYPE_FIX +#define EAR_REC_FORM_VAR_LEN_LE CDROM_MDU_TYPE_VAR_LE /* RCW in 7.2.1 */ +#define EAR_REC_FORM_FIX_LEN_BE CDROM_MDU_TYPE_VAR_BE /* RCW in 7.2.2 */ + +#define CDROM_MDU_TYPE_FIX ((u_char)1) +#define CDROM_MDU_TYPE_VAR_LE ((u_char)2) /* RCW in 7.2.1 */ +#define CDROM_MDU_TYPE_VAR_BE ((u_char)3) /* RCW in 7.2.2 */ + +/* + * EAR-Record Attribute values + * ISO-9660: Section 9.5.9, Page 25 + */ + +#define EAR_REC_ATTR_LF_CR ((u_char)0) /* cr-record-lf */ +#define EAR_REC_ATTR_VERT_SP ((u_char)1) +#define EAR_REC_ATTR_CONTROL ((u_char)2) + +/*---------------------------------------------------------------------------*/ + +/* Related to reading table of contents (Start/End of each session) */ + +#define CDROM_LEAD_IN 4500 +#define CDROM_LEAD_OUT_FIRST 6750 +#define CDROM_LEAD_OUT 2250 +#define CDROM_SESSION_OFFSET 318 + +/*---------------------------------------------------------------------------*/ +/* + * XXX Move to ioLib.h later + */ + +#ifdef CDROMFS_MULTI_SESSION_ATAPI_IOCTL /* Ask ATAPI driver for TOC */ +#define FIOREADTOCINFO 0xf8 /* get CD-ROM TOC from ATAPI driver */ +#endif /* CDROMFS_MULTI_SESSION_ATAPI_IOCTL */ + +/* Table of contents (TOC) of a CD: Maximum tracks on a CD */ + +#define CDROM_MAX_TRACKS 99 + +/*---------------------------------------------------------------------------*/ + +/* Values for T_CDROM_FILE.FCSInterleaved */ + +#define CDROM_NOT_INTERLEAVED 0 +#define CDROM_INTERLEAVED 1 + +/*---------------------------------------------------------------------------*/ + +/* typedefs */ + +/*---------------------------------------------------------------------------*/ + +/* + * XXX Move to ioLib.h later + */ + +/* + * FIOREADTOCINFO + */ + +/* Table of contents (TOC) of a CD: Header */ + +typedef struct readTocHeader + { + UINT8 tocDataLength[2]; + UINT8 firstSessionNumber; + UINT8 lastSessionNumber; + } readTocHeaderType; + +/* Table of contents (TOC) of a CD: Session descriptor */ + +typedef struct readTocSessionDescriptor + { + UINT8 reserved1; +#ifdef BYTE_ORDER_LITTLE_ENDIAN + UINT8 control:4; + UINT8 adr:4; +#else /* BYTE_ORDER_BIG_ENDIAN */ + UINT8 adr:4; + UINT8 control:4; +#endif + UINT8 sessionNumber; + UINT8 reserved2; + UINT8 sessionStartAddress[4]; /* big-endian. use ntohl() */ + } readTocSessionDescriptorType; + +/* + * FIOREADTOCINFO: Type of arg parameter is CDROM_TRACK_RECORD_ID + * + * The size of *statBuffer should be sizeof (readTocHeaderType) + + * (CDROM_MAX_TRACKS * sizeof (readTocSessionDescriptorType)) + * + * statBuffer actually points at one recTocHeaderType immediately followed + * by up to CDROM_MAX_TRACKS readTocSessionDescriptorType records. + */ + +typedef struct cdRomTrackStat /* Table of contents for multi-session CD */ + { + int bufferLength; /* length of the Buffer */ + u_char * statBuffer; /* File's track records buffer */ + /* (only for command dir) */ + } CDROM_TRACK_RECORD; + +typedef CDROM_TRACK_RECORD * CDROM_TRACK_RECORD_ID; + +/*---------------------------------------------------------------------------*/ + +/* + * Volume Descriptor header, may be used as mask, since byte order is stored + */ + +typedef struct isoVdHead + { + u_char type; /* any of VD types */ + u_char stdID[ ISO_STD_ID_SIZE ]; /* have to be ISO_STD_ID */ + u_char version; /* have to be ISO_VD_VERSION */ + /* 0=ISI9660 1=Joliet(Unicode) 2=Auto */ + } T_ISO_VD_HEAD; + +typedef T_ISO_VD_HEAD * T_ISO_VD_HEAD_ID; + +/*---------------------------------------------------------------------------*/ + +/* + * Disk cache: structure to hold data while files are opened. + */ + +typedef struct secBuf /* buffer for reading sectors */ + { + u_long startSecNum; /* logical sector number */ + u_long numSects; /* Number of logical sectors contained */ + u_long maxSects; /* max # of logical sectors it can contain */ + int magic; /* SEC_BUF_MAG after sectData allocation */ + struct bio bio; /* XBD bio structure */ + SEMAPHORE bioDoneSyncSem; /* binary sempahore used for bio_done */ + } SEC_BUF; + +typedef SEC_BUF * SEC_BUF_ID; + +/*---------------------------------------------------------------------------*/ + +/* + * CDROM_VOL_DESC - Mounted volume + * + * Since in future it will cover, we'll hope, Rock Ridge extensions, a name + * has no preffix 'ISO'. + * Many fields, pertaining to T_ISO_PVD_SVD, are excluded from + * CDROMFS_VOL_DESCR for memory saving and code simplicity, + * since they aren't realy use for device control (such as publisherId ...). + * + * 1 per mounted volume + */ + +typedef struct cdromVolDescr /* CDROM_VOL_DESC */ + { + DEV_HDR devHdr; /* for adding to device table */ + int magic; /* VD_SET_MAG */ + device_t device; /* underlying block device handle */ + SEM_ID mDevSem; /* device mutual-exclusion semaphore */ + SEC_BUF sectBuf; /* Sector reading buffer. must be inited */ + /* over cdromFsDevCreate() */ + u_int sectSize; /* logical sector size. Divide by */ + /* LSToPhSSizeMult to get physical sect size */ + LIST VDList; /* VD list header. All device VD (at least */ + /* one primary and each supplementary, if */ + /* any exist) are connected to linked list */ + SEM_ID mFdListSem; /* FdList mutual-exclusion semaphore */ + LIST FDList; /* FD list header. All file descriptors are */ + /* connected to linked list for to arrive */ + /* each of them in case vol unmount */ + u_char LSToPhSSizeMult; /* LSSize/PhSSize (needed when XBD physical */ + /* block size < 2048 bytes). */ + u_char unmounted; /* != 0 => VDList must be bult newrly */ + u_char DIRMode; /* Mode of the directory */ +#ifdef CDROMFS_MULTI_SESSION_SUPPORT + u_short SesiOnCD; /* Count of sessions on mounted device */ + u_short SesiToRead; /* Which session to read, or DEFAULT_SESSION */ + u_long SesiPseudoLBNum; /* Start of session in pseudo LB */ +#endif /* CDROMFS_MULTI_SESSION_SUPPORT */ + BOOL StripSemicolon; /* Remove semicolon when reading directories */ + sector_t numSectors; /* number of physical sectors on media */ + } CDROM_VOL_DESC; + +/* Note, the pointer type CDROM_VOL_DESC_ID is defined in cdromFsLib.h */ + +/*---------------------------------------------------------------------------*/ + +/* + * T_CDROMFS_VD_LST; - Colume descriptor of a mouned volume + * ISO-9660: Section 8.4, Tables 4, Page 13; section 8.5, Table 6, Page 16 + * Disk offset/size: ISO_VD_xxx + * + * device VDs-list element - On CDROM_VOL_DESC.VDList. + * + * 1 per primary or supplementary volume descriptor + */ + +typedef struct cdromVDLst + { + NODE list; /* Member of CDROM_VOL_DESC.VDList */ + int magic; /* VD_LIST_MAG */ + CDROM_VOL_DESC_ID pVolDesc; /* ptr to list header's CDROM_VOL_DESC, */ + u_long VDPseudoLBNum; /* Pseudo LB, VD is in */ + u_long volSize; /* LS per volume */ + u_long PTSize; /* bytes per Path Table ( in Memory )*/ + u_long PTSizeOnCD; /* bytes per Path Table ( on Disk/CD )*/ + u_long PTStartLB; + u_long rootDirSize; /* bytes per Root Directory */ + u_long rootDirStartLB; + u_short volSetSize; /* number of phis devices in set */ + u_short volSeqNum; /* device number in set */ + u_short LBSize; /* bytes per Logical Block */ + + /* In accordance with ISO9660 all directory records in + * PT are sorted by hierarchy levels and are numbered from 1 + * ( only root has number 1 and is always placed on level 1 ). + * Number of levels is restricted by 8. + * dirLevBordersOff[ n ] contains offset of first PT record on level + * (n+2) (root is excluded and array is encountered from 0) from PT start. + * dirLevLastRecNum[ n ] contains number of last PT record on level + * (n+2). + */ + + u_short dirLevBordersOff[ CDROM_MAX_DIR_LEV ]; /* first PT-record */ + /* offset in each */ + /* level */ + u_short dirLevLastRecNum[ CDROM_MAX_DIR_LEV ]; /* last PT-record */ + /* number in each */ + /* level */ + u_short numDirLevs; /* number of PT dir hierarchy levels, */ + /* exclude root */ + u_short numPTRecs; /* last PT record number (number of records) */ + u_char LBToLSShift; /* to get LS number, containes given LS */ + /* number of last may be just shifted */ + u_short type; /* volume descriptor type, have to be one */ + /* of ISO_VD_PRIMARY or ISO_VD_SUPPLEM */ + u_short uniCodeLev; /* Unicode level */ + /* of ISO_VD_PRIMARY or ISO_VD_SUPPLEM */ + /* 0=ISO9660 */ + /* 1=UC-level1 2=UC-level2 3=UC-level3 */ + + u_short fileStructVersion; /* currently 1 only (ISO) */ + SEC_BUF PTBuf; /* buffer for permanent storage PT during */ + /* volume is mounted */ + } T_CDROMFS_VD_LST; + +typedef T_CDROMFS_VD_LST * T_CDROMFS_VD_LST_ID; + +/*---------------------------------------------------------------------------*/ + +/* + * Directory record date time + * ISO-9660: Section 9.1.5, Table 9, Page 20 + */ + +typedef struct cdromFileDateTime + { /* copied directly to this structure */ + u_char year; /* from 1900 */ + u_char month; + u_char day; + u_char hour; + u_char minuts; + u_char seconds; + u_char fromGreenwOf; + } T_FILE_DATE_TIME; + +typedef T_FILE_DATE_TIME * T_FILE_DATE_TIME_ID; + +/*---------------------------------------------------------------------------*/ + +/* + * Open file - Used for file descriptor + */ + +typedef struct cdromFile + { + NODE list; /* Member of CDROM_VOL_DESC.FDList */ + int magic; /* FD_MAG */ + u_char inList; /* != 0 <=> FD added to volume FD list */ + T_CDROMFS_VD_LST_ID pVDList; /* not need to comment */ + + /* File (F) static data */ + + u_char name[ CDROM_MAX_FILE_NAME_LEN + 1 ]; + u_short parentDirNum; /* parent dir PT number */ + u_char * FRecords; /* File's Directory Records buffer */ + + u_long FStartLB; /* file first LB ( include EAR ) */ + u_long FSize; /* total file data size (netto) */ + u_short FType; /* Proper constants are contained in */ + /* ioLib.h */ +#if 0 /* NOT USED until record format files supported */ + u_char FMDUType; /* EAR_REC_FORM_IGNORE/ */ + /* CDROM_MDU_TYPE_FIX/ */ + /* CDROM_MDU_TYPE_VAR_LE/ */ + /* CDROM_MDU_TYPE_VAR_BE */ + u_short FMDUSize; /* byte per MDU (=0, in case MDU varLen) */ +#endif /* NOT USED until record format files supported */ + + /* time-date */ + + time_t FDateTimeLong; /* 32-bit seconds */ + + SEC_BUF sectBuf; /* Sector reading buffer. must be inited */ + /* over openDir() (and may be, over open */ + /* too ) */ + + /* + * File Current (FC) Dir Record and File Current Section descriptions + * this fields are together used in case directory was opened (not file) + */ + + u_char * FCDirRecPtr; /* ptr on current dir rec in dir rec buffer */ + u_int FCDirRecAbsOff; /* current dir rec offset in directory */ + u_long FCDirFirstRecLB; /* LB containing first directory record */ + + u_long FCSStartLB; /* File Section first LB ( after EAR ) */ + + u_long FCSSize; /* FS bytes (exclude EAR) */ + u_long FCSAbsOff; /* total data size in all previous sections */ + u_short FDType; /* Proper constants are contained in */ + + u_char FCSInterleaved; /* CDROM_INTERLEAVED/CDROM_NOT_INTERLEAVED */ + /* just may be checked as bolean */ + u_char FCSFUSizeLB; /* LB per FileUnit */ + u_char FCSGapSizeLB; /* LB per Gap */ + + /* File Current Data (FCD) positions description */ + + u_long FCDAbsPos; /* absolute position in file (bytes) */ + int FCEOF; /* !=0 <=> EOF encounted */ + + /* some fields for using this structure for directories */ + + u_short DNumInPT; /* Directory record number in PT */ + +#if 0 /* NOT USED until record format files supported */ + u_long DRecLBPT; /* absolute LB number, that contain */ + /* PT directory record */ + u_int DRecOffLBPT; /* PT Directory record offset within LB */ +#endif /* NOT USED until record format files supported */ + +#ifdef CDROMFS_MODE_AUTO_COMBINE_VOLUME_DESCRIPTORS + u_long * pMultDir; /* pointer for multi VD'S struct */ + u_int nrMultDir; /* number of multi VD's for search */ +#endif /* CDROMFS_MODE_AUTO_COMBINE_VOLUME_DESCRIPTORS */ + + SEM_ID mFdListSem; /* FdList mutual-exclusion semaphore */ + SEM_ID mDevSem; + + } T_CDROM_FILE; + +typedef T_CDROM_FILE * T_CDROM_FILE_ID; /* not to mix with ISO */ + /* file ID, that equevalents */ + /* to file name in fact */ + +/* private function declarations */ + +extern STATUS cdromFsFsmInit (void); +extern void cdromFsBioDone (struct bio * pBio); + +extern CDROM_VOL_DESC_ID _cdromFsDevCreate (char * devName, + device_t device, + BOOL fsmCreate); + +#ifdef __cplusplus +} +#endif + +#endif /* cdromFsLibP_h */ diff --git a/h/private/cdromFsVersionP.h b/h/private/cdromFsVersionP.h new file mode 100644 index 0000000..fd41c21 --- /dev/null +++ b/h/private/cdromFsVersionP.h @@ -0,0 +1,40 @@ +/* cdromFsVersionP.h - CD ISO 9660 file system (cdromFs) version header file */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05dec02,tkj cdromFs joliet code review changes. +01b,30oct02,tkj Move cdromFsVersion.h to target/h/private. +01a,05nov01,tkj written. +*/ + +#ifndef __INCcdromFsVersionPh +#define __INCcdromFsVersionPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +/* defines */ + +#define CDROMFS_VERSION 0x01050001 + +/* typedefs */ + +/* globals */ + +#ifndef _ASMLANGUAGE + +/* function declarations */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcdromFsVersionPh */ diff --git a/h/private/classLibP.h b/h/private/classLibP.h new file mode 100644 index 0000000..9c84e96 --- /dev/null +++ b/h/private/classLibP.h @@ -0,0 +1,129 @@ +/* classLibP.h - private object class management library header file */ + +/* + * Copyright (c) 2004-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01p,29aug05,kk added classCreateConnect() (SPR# 106196) +01o,26oct04,fr added classOpenConnect() routine (SPR 101491) +01n,28sep04,fr added createRtn & openRtn and removed nameSetRtn & nameGetRtn + from wind_class and classInit() (SPR 101349) +01m,14may04,dcc added CLASSID_INVALIDATE() and CLASSID_RESTORE() macros. +01l,12apr04,dcc enabled use of the per-class mutex. +01k,11sep03,tcr add WindView class instrumentation. +01j,26aug03,tcr remove WindView functions no longer needed +01i,22oct03,dcc added offsets in the OBJ_CLASS comments. +01h,21aug03,dcc added support for public objects +01g,02jul03,to added offset for objClassType. +01f,23jun03,dcc removed classCreate() and classDestroy() prototypes. +01e,14mar03,dcc ported from AE1.1 +01d,19may97,jpd added _ASMLANGUAGE for offsets into OBJ_CLASS. +01c,10dec93,smb added windview documentation + changed helpRtn to instRtn +01b,22sep92,rrr added support for c++ +01a,04jul92,jcf created. +*/ + +#ifndef __INCclassLibPh +#define __INCclassLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* offsets in the OBJ_CLASS structure */ + +#define WIND_CLASS_INST_RTN 0x1c /* offset to instRtn */ +#define WIND_CLASS_TYPE 0x38 /* offset to objClassType */ + +#ifndef _ASMLANGUAGE +#include +#include +#include +#include +#include +#include + +/* class options */ + +#define WIND_CLASS_ALLOW_DUPLICATE_NAMES 0x01 +#define WIND_CLASS_RENAME_NOT_ALLOWED 0x02 + +#define WIND_CLASS_INSTRUMENTED 0x04 + +/* + * These macros take a CLASS_ID and test/get/set the instrumentation state for + * the class. Then any subsequent object creations will inherit the + * instrumented state from the class. + */ + +#define WV_OBJ_CLASS_IS_INSTRUMENTED(classId) \ + (classId->handle.attributes & WIND_CLASS_INSTRUMENTED) + +#define WV_OBJ_CLASS_INSTRUMENTATION_ENABLE(classId) \ + (classId->handle.attributes |= WIND_CLASS_INSTRUMENTED) + +#define WV_OBJ_CLASS_INSTRUMENTATION_DISABLE(classId) \ + (classId->handle.attributes &= ~WIND_CLASS_INSTRUMENTED) + +/* macros to invalidate and restore the classId field */ + +#define CLASSID_INVALIDATE(classId) ((CLASS_ID) ((int)classId | 1)) +#define CLASSID_RESTORE(classId) ((CLASS_ID) ((int)classId & ~1)) + + +typedef struct wind_class /* OBJ_CLASS */ + { + HANDLE handle; /* 0x00: handle management */ + unsigned objSize; /* 0x0c: size of object */ + CLASS_ID altClassId; /* 0x10: alternate class ID */ + FUNCPTR destroyRtn; /* 0x14: object destroy routine */ + FUNCPTR showRtn; /* 0x18: object show routine */ + VOIDFUNCPTR instRtn; /* 0x1c: object inst routine */ + FUNCPTR createRtn; /* 0x20: object create routine */ + FUNCPTR openRtn; /* 0x24: object open routine */ + FUNCPTR objMemAllocRtn; /* 0x28: object memory alloc routine */ + FUNCPTR objMemFreeRtn; /* 0x2c: object memory free routine */ + FUNCPTR initRtn; /* 0x30: for backwards compatibility + with windView instrumentation. */ + struct mem_part* objPartId; /* 0x34: object memory pool ID */ + enum windObjClassType objClassType; /* 0x38: enum value for class type */ + int options; /* 0x3c: options */ + DL_LIST objPrivList; /* 0x40: list of private objects */ + DL_LIST objPubList; /* 0x48: list of public objects */ + SEM_ID pClassSem; /* 0x50: lists' mutual exclusion */ + } OBJ_CLASS; + + +/* variable declarations */ + +extern CLASS_ID classIdTable []; /* array of class IDs */ +extern FUNCPTR _func_classListLock; +extern FUNCPTR _func_classListUnlock; + +/* function declarations */ + +extern STATUS classInit (OBJ_CLASS *pObjClass, unsigned objectSize, + FUNCPTR destroyRtn, FUNCPTR createRtn, + FUNCPTR openRtn, FUNCPTR objMemAllocRtn, + FUNCPTR objMemFreeRtn, void *objMemPoolId, + enum windObjClassType objClassType, + int options); +extern STATUS classCreateConnect(CLASS_ID classId, FUNCPTR createRtn); +extern STATUS classOpenConnect(CLASS_ID classId, FUNCPTR openRtn); +extern STATUS classShowConnect(CLASS_ID classId, FUNCPTR showRtn); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCclassLibPh */ diff --git a/h/private/connLibP.h b/h/private/connLibP.h new file mode 100644 index 0000000..d744729 --- /dev/null +++ b/h/private/connLibP.h @@ -0,0 +1,39 @@ +/* connLibP.h - event buffer library header */ + +/* Copyright 1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,10dec93,smb written. +*/ + +#ifndef __INCconnlibph +#define __INCconnlibph + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) || defined(__cplusplus) + +STATUS connectionInit (void); +void connectionClose (void); +void connectionError (void); +void dataTransfer (char * buffer, size_t bufSize); + +#else /* __STDC__ */ + +STATUS connectionInit (); +void connectionClose (); +void connectionError (); +void dataTransfer (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCconnlibph*/ + diff --git a/h/private/coprocLibP.h b/h/private/coprocLibP.h new file mode 100644 index 0000000..134e47f --- /dev/null +++ b/h/private/coprocLibP.h @@ -0,0 +1,66 @@ +/* coprocLibP.h - coprocessor management library private header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,02oct04,yvp Added new members to COPROC_DESC for mRegs support. +01a,21mar03,yvp written. +*/ + +#ifndef __INCcoprocLibPh +#define __INCcoprocLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include "vxWorks.h" + +/* Coprocessor Descriptor structure */ + +typedef struct coprocDesc + { + struct coprocDesc *next; /* next descriptor in list */ + UINT32 mask; /* bit mask position in task option */ + int ctxSize; /* context size in bytes */ + int ctxAlign; /* memory alignment for context */ + FUNCPTR pCtxCreateRtn; /* allocate & init a coprocessor ctx */ + FUNCPTR pCtxDeleteRtn; /* delete the coprocessor ctx */ + FUNCPTR pEnableRtn; /* enable the coprocessor */ + FUNCPTR pDisableRtn; /* disable the coprocessor */ + FUNCPTR pCtxSaveRtn; /* context save routine */ + FUNCPTR pCtxRestoreRtn; /* context restore routine */ + FUNCPTR pCtxGetRtn; /* get the coprocessor context */ + FUNCPTR pCtxSetRtn; /* set the coprocessor context */ + FUNCPTR pDsmRtn; /* disassembly routine */ + FUNCPTR pExcHandlerRegisterRtn; /* register exc. handlers */ + FUNCPTR pShowRtn; /* show the coprocessor context */ + FUNCPTR pAboutRtn; /* displays a short description */ + FUNCPTR pMRegsRtn; /* interactively modify reg. values */ + FUNCPTR pRegListShowRtn; /* show list of available registers */ + void * pLastTask; /* last task to use this coproc. */ + BOOL showOnDebug; /* show registers on debug events */ + UINT32 spare1; + UINT32 spare2; + } COPROC_DESC; + +/* Coprocessor Table Entry structure */ + +typedef struct coprocTblEntry + { + void * pCtx; /* points to coprocessor REG_SET */ + COPROC_DESC * pDescriptor; /* points to associated descriptor */ + } COPROC_TBL_ENTRY; + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcoprocLibPh */ diff --git a/h/private/coreDumpLibP.h b/h/private/coreDumpLibP.h new file mode 100644 index 0000000..e0b41fe --- /dev/null +++ b/h/private/coreDumpLibP.h @@ -0,0 +1,295 @@ +/* coreDumpLibP.h - core dump private interface header */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01m,13sep05,dbt Fixed pMemWriteFilter() prototype. +01l,07sep05,jmp Performed some updates required for the coreDumpLib.c split. + Added support for core dump alternate stack switch. + Provide the ability to install core dump filters before + usrCoreDumpInit() call. +01k,01sep05,dbt Updated TGT_INFO structure. + Added coreDumpMemCksum() prototype. +01j,16aug05,dbt Added device storage size in CORE_DUMP_DEV_INFO structure. +01i,11aug05,dbt Added coreDumpGenerate() prototype. +01h,10aug05,dbt Removed unused coreDumpMemWriteFilter() prototype. +01g,08aug05,dbt Moved some definitions from coreDumpLib.h +01f,04aug05,jmp updated coreDumpWrite(). +01e,03aug05,dbt Added coreDumpHookInit() & coreDumpCreateHooksRun() + prototypes. +01d,28jul05,jmp moved CORE_DUMP_DEV_INFO from coreDumpLib.c. + added core dump memory region filtering. +01c,27jul05,jmp added compression level to coreDumpCompressLibInit(). +01b,18jul05,jmp added compression support. +01a,01jul05,jmp written. +*/ + +#ifndef __INCcoreDumpLibPh +#define __INCcoreDumpLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#ifndef HOST +#include +#include +#endif +#include + +/* defines */ + +#define CORE_DUMP_MAGIC_NUMBER 0x45524f43 /* core dump magic number */ +#define CORE_DUMP_VERSION 1 /* core dump version number */ + +#ifndef HOST +/* Core dump compression macros */ + +#define CORE_DUMP_COMPRESS_ENABLED (coreDumpLibInfo.compressEnabled) + +#define CORE_DUMP_COMPRESS_INIT() \ + ((coreDumpLibInfo.pCompressInitRtn == NULL) ? \ + (OK) : \ + ((*coreDumpLibInfo.pCompressInitRtn) ())) + +#define CORE_DUMP_COMPRESS_WRITE(data, size) \ + ((coreDumpLibInfo.pCompressWriteRtn == NULL) ? \ + (OK) : \ + ((*coreDumpLibInfo.pCompressWriteRtn) (data, size))) + +#define CORE_DUMP_COMPRESS_TERMINATE() \ + ((coreDumpLibInfo.pCompressTermRtn == NULL) ? \ + (OK) : \ + ((*coreDumpLibInfo.pCompressTermRtn) ())) + +#define CORE_DUMP_COMPRESS_FLUSH(data, size) \ + ((coreDumpLibInfo.pCacheWriteRtn == NULL) ? \ + (coreDumpStorageWrite (data, size)) : \ + ((*coreDumpLibInfo.pCacheWriteRtn) (data, size))) + +/* Core dump cache macros */ + +#define CORE_DUMP_CACHE_ENABLED (coreDumpLibInfo.cacheEnabled) + +#define CORE_DUMP_CACHE_INIT() \ + ((coreDumpLibInfo.pCacheInitRtn == NULL) ? \ + (OK) : \ + ((*coreDumpLibInfo.pCacheInitRtn) ())) + +#define CORE_DUMP_CACHE_WRITE(data, size) \ + ((coreDumpLibInfo.pCacheWriteRtn == NULL) ? \ + (OK) : \ + ((*coreDumpLibInfo.pCacheWriteRtn) (data, size))) + +#define CORE_DUMP_CACHE_FLUSH() \ + ((coreDumpLibInfo.pCacheFlushRtn == NULL) ? \ + (OK) : \ + ((*coreDumpLibInfo.pCacheFlushRtn) ())) + +#define DEVICE_DESC coreDumpDevInfo.pCoreDumpDevDesc + +#define CORE_DUMP_BLOCK_ALIGN \ + ((DEVICE_DESC->devWrtBlkSize != 0) ? \ + DEVICE_DESC->devWrtBlkSize : 1) + +#define BLOCK_ROUND_UP(x) \ + ROUND_UP (x, CORE_DUMP_BLOCK_ALIGN) + +#define BLOCK_ROUND_DOWN(x) \ + ROUND_DOWN (x, CORE_DUMP_BLOCK_ALIGN) + +#define CORE_DUMP_HDR_ALIGNED_SIZE \ + BLOCK_ROUND_UP (sizeof (CORE_DUMP_HDR)) + +#define CORE_DUMP_STORAGE_HDR_ALIGNED_SIZE \ + BLOCK_ROUND_UP (sizeof (CORE_DUMP_STORAGE_HDR)) +#endif + +/* Runtime information fields length */ + +#define CORE_DUMP_RT_NAME_LEN 50 +#define CORE_DUMP_RT_VER_LEN 50 +#define CORE_DUMP_CPU_VARIANT_LEN 20 +#define CORE_DUMP_TOOL_NAME_LEN 20 +#define CORE_DUMP_BSP_SHORT_NAME_LEN 100 +#define CORE_DUMP_BSP_NAME_LEN 100 +#define CORE_DUMP_TYPE_LEN 30 + +/* typedefs */ + +typedef struct tgt_info_note /* TGT_INFO_NOTE - target information note */ + { + /* runtime information */ + + char rtName[CORE_DUMP_RT_NAME_LEN]; + char rtVersion[CORE_DUMP_RT_VER_LEN]; + UINT32 cpuFamily; + UINT32 cpuType; + char cpuVariant[CORE_DUMP_CPU_VARIANT_LEN]; + char toolName[CORE_DUMP_TOOL_NAME_LEN]; + char bspShortName[CORE_DUMP_BSP_SHORT_NAME_LEN]; + UINT32 hasCoprocessor; + BOOL hasWriteProtect; + UINT32 pageSize; + UINT32 endian; + char bspName [CORE_DUMP_BSP_NAME_LEN]; + UINT32 memBase; + UINT32 memSize; + UINT32 textScnCksum; + + /* exception information */ + + UINT32 excValid; + UINT32 excVecNum; + UINT32 excCtxId; + + /* core dump information */ + + char coreDumpType [CORE_DUMP_TYPE_LEN]; + + /* registers information */ + + REG_SET regs; + } TGT_INFO_NOTE; + +#ifndef HOST +typedef struct core_dump_dev_desc /* coredump device descriptor */ + { + UINT32 devWrtBlkSize; /* device write block size */ + char * pDevWrtBlkCache; /* device cache buffer */ + FUNCPTR pDevEraseRtn; /* device erase() routine */ + FUNCPTR pDevOpenRtn; /* device open() routine */ + FUNCPTR pDevWriteRtn; /* device write() routine */ + FUNCPTR pDevReadRtn; /* device read() routine */ + FUNCPTR pDevFlushRtn; /* device flush() routine */ + FUNCPTR pDevCloseRtn; /* device close() routine */ + } CORE_DUMP_DEV_DESC; + +typedef struct core_dump_lib_info + { + /* general core dump information */ + + BOOL initialized; /* core dump support initialized */ + + FUNCPTR pRtInfoGet; /* Runtime information retrieval */ + UINT32 coreDumpMax; /* maximun core dump on storage */ + char * sysMemBaseAdrs; /* LOCAL_MEM_LOCAL_ADRS */ + + /* compression support information */ + + BOOL compressEnabled; /* compression enabled ? */ + + FUNCPTR pCompressInitRtn; /* compression init routine */ + FUNCPTR pCompressTermRtn; /* compression terminate routine */ + FUNCPTR pCompressWriteRtn; /* compression write routine */ + + /* cache support information */ + + BOOL cacheEnabled; /* cache enabled ? */ + + FUNCPTR pCacheInitRtn; /* cache init routine */ + FUNCPTR pCacheWriteRtn; /* cache write routine */ + FUNCPTR pCacheFlushRtn; /* cache flush routine */ + + /* core dump filtering information */ + + STATUS (*pMemWriteFilter) ( + VIRT_ADDR buffer, + UINT32 size, + VIRT_ADDR vaddr, + PHYS_ADDR paddr, + UINT32 state, + UINT32 alignment + ); /* memory region filter */ + } CORE_DUMP_LIB_INFO; + +typedef struct core_dump_dev_info /* information on core dump device */ + { + BOOL devInitialized; /* Is core dump device initialized ? */ + UINT32 deviceId; /* identifier of the core dump device */ + + /* device routines */ + + CORE_DUMP_DEV_DESC * pCoreDumpDevDesc; /* coredump device descriptor */ + + /* information on the device */ + + BOOL formated; /* Is device formated ? */ + size_t size; /* device size */ + UINT32 coreArrayOffset; /* core dump array offset */ + UINT32 coreStartOffset; /* core dump start offset */ + UINT32 coreWriteOffset; /* core dump write offset */ + } CORE_DUMP_DEV_INFO; + +typedef struct core_dump_storage_hdr /* core dump storage header */ + { + UINT32 coreDumpMagic; /* core dump magic number */ + UINT32 version; /* core dump version number */ + UINT32 coreDumpMax; /* maximun core dump on storage */ + } CORE_DUMP_STORAGE_HDR; + +typedef struct core_dump_hdr /* coredump hdr for core dump storage */ + { + UINT32 coreDumpMagic; /* core dump magic number */ + UINT32 offset; /* offset for this coredump */ + UINT32 nextOffset; /* offset for next coredump */ + CORE_DUMP_INFO coreDumpInfo; /* information on the core dump */ + } CORE_DUMP_HDR; + +typedef struct core_dump_mem_filter + { + void * addr; /* address of memory region to filter */ + size_t size; /* size of memory region to filter */ + } CORE_DUMP_MEM_FILTER; + +/* externals */ + +extern CORE_DUMP_LIB_INFO coreDumpLibInfo; /* core dump facility information */ +extern CORE_DUMP_DEV_INFO coreDumpDevInfo; /* core dump device information */ + +extern char * coreDumpMemPtr; /* memory core dump base address */ +extern UINT32 coreDumpMemSize; /* memory core dump size */ +extern UINT32 coreDumpCount; /* core dump count on device */ +extern CORE_DUMP_MEM_FILTER coreDumpMemFilter[];/* core dump mem filter array */ +extern UINT32 coreDumpMemFilterMaxCount; /* Max # of core dump mem filter */ + +/* function declarations */ + +extern STATUS coreDumpInit (char * pStack, + UINT32 stackSize); +extern STATUS coreDumpRawDevInit (CORE_DUMP_RAW_DEV_DESC * pDesc); +extern STATUS coreDumpWrite (char * data, size_t size); +extern STATUS coreDumpMemInit (void); +extern UINT32 coreDumpMemRead (UINT32 deviceId, size_t offset, + void * buffer, UINT32 maxbytes); +extern UINT32 coreDumpMemWrite (UINT32 deviceId, size_t offset, + void * buffer, UINT32 nbytes); +extern STATUS coreDumpCacheLibInit (char * pCacheBuffer, UINT32 cacheSize); +extern STATUS coreDumpCompressLibInit (int level); +extern STATUS coreDumpStorageWrite (char * buffer, size_t size); +extern STATUS coreDumpCreateHooksRun (void); +extern void coreDumpHookInit (FUNCPTR * createTable, + UINT32 tableSize); +extern STATUS coreDumpGenerate (int vector, char * pEsf, + REG_SET * pRegs, EXC_INFO * pExcInfo, + CORE_DUMP_TYPE coreDumpType); +extern UINT32 coreDumpMemCksum (char * addr, int len); +extern char * coreDumpTypeStrGet (char * typeStr, + CORE_DUMP_TYPE coreDumpType); +#endif /* !HOST */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcoreDumpLibPh */ diff --git a/h/private/cplusLibP.h b/h/private/cplusLibP.h new file mode 100644 index 0000000..2d68f48 --- /dev/null +++ b/h/private/cplusLibP.h @@ -0,0 +1,298 @@ +/* private/cplusLibP.h - VxWorks C++ support */ + +/* + * Copyright (c) 1992-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify, or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +02i,05sep05,v_r Moved loader-specific includes to + share/include/private/cplusLoadP.h and shared C++ strategy + and Xtors routines definitions in + share/include/private/cplusXtorsP.h +02h,18sep04,jn Move toward shared code on host and target +02g,01sep04,bpn Added cplusMangledSymGet() prototype. +02f,18aug04,bpn Added new definitions. +02e,04mar04,bpn Added cplusUserAsk() prototype. +02d,09apr03,sn define CPLUS_DEMANGLER_MODE(S) in terms of DEMANGLER_MODE +02c,30oct01,sn fixed syntax error +02b,24jul01,r_s changed code to be ANSI compatible so that it compiles with + diab. made asm macro changes for diab +02a,10apr98,sn added decls for cplusDemanglerInit & cplusDemangleFunc +01j,31oct93,srh added cplusNewHdlMutex +01i,25apr93,srh added non-ANSI declaration for cplusUnloadFixup... +01h,25apr93,srh added declaration for cplusUnloadFixup. +01g,25apr93,srh fixed a typo which was introduced during 01f +01f,24apr93,srh removed extraneous comma from CPLUS_XTOR_STRATEGIES to + please certain compilers. +01e,23apr93,srh added declarations for cplusLibMinInit +01d,31jan93,srh renamed from cplusLib.h, coalesced other cplusLib hdrs +01c,22sep92,rrr added support for c++ +01b,03aug92,ajm corrected non __STDC__ define of cplusDemangle +01a,30jul92,srh written +*/ + +#ifndef __INCcplusLibPh +#define __INCcplusLibPh + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* type declarations */ + +typedef enum + { + OFF = DMGL_MODE_OFF, + TERSE = DMGL_MODE_TERSE, + COMPLETE = DMGL_MODE_COMPLETE + } CPLUS_DEMANGLER_MODES; + +typedef char * (*CPLUS_DEM_FUNC_PTR) (char *, char *, int); +typedef char * (*CPLUS_DEM_FUNC2_PTR) (const char *, DEMANGLER_STYLE, + DEMANGLER_MODE); +typedef DEMANGLER_RESULT (*CPLUS_DEM_BUFF_FUNC_PTR) (char *, char *, + size_t *, + DEMANGLER_MODE, char **); + +/* C++-only declarations */ + +#ifdef __cplusplus + +/* type declarations */ + +class RBString_T + { +public: + RBString_T (); // create an empty s + RBString_T (RBString_T &); // create a copy of another + // RBString_T + RBString_T (const char *); // create an RBString_T from + // a C string + void clear (); // reinitialize this RBString_T + char * extractCString (char *, int); // extract C string + + RBString_T & operator = (RBString_T &); + + BOOL operator == (RBString_T &) const; + BOOL operator != (RBString_T &) const; + + int length () const // return number of characters, + { return nChars; } // not counting NUL. + + RBString_T & append (RBString_T &); // append RBString_T contents + RBString_T & append (const char *, // append C string contents + int len = INT_MAX); + RBString_T & append (char); // append character + + RBString_T & prepend (RBString_T &); // prepend RBString_T contents + RBString_T & prepend (const char *, // prepend C string contents + int len = INT_MAX); + RBString_T & prepend (char); // prepend character + +protected: + char appendChar (char); // append a character + char prependChar (char); // prepend a character + +protected: + char data [ MAX_SYS_SYM_LEN ]; // data + char * head; // pointer to first character + // in string + char * tail; // pointer to delimiting + // NUL character + int nChars; // number of characters currently + // in string, not counting NUL + +private: + friend class RBStringIterator_T; + }; + +class RBStringIterator_T + { +public: + RBStringIterator_T (const RBString_T &); // initialize a + // new iterator + char nextChar (); // fetch next char. + +protected: + const RBString_T * theRBString; + const char * nc; + }; + +struct ArrayDesc_T + { + // functions + ArrayDesc_T (void *pObject, int nElems); + + // data + HASH_NODE hashNode; + void * pObject; + int nElems; + }; + +class ArrayStore_T + { + public: + ArrayStore_T (); + ~ArrayStore_T (); + void insert (void * pObject, int nElems); + int fetch (void *pObject); + private: + HASH_ID hashId; + SEM_ID mutexSem; + }; + +class Demangle_T + { + public: + Demangle_T (const char *); + + char * extractDemangled (char * buf, int length = MAX_SYS_SYM_LEN); + BOOL isDemangled (); + + private: + BOOL scanArg (RBString_T * shadow = 0, RBString_T * retType = 0); + BOOL scanArgs (RBString_T * shadow = 0, RBString_T * retType = 0); + BOOL scanCastOperator (); + BOOL scanClassName (RBString_T * shadow = 0); + BOOL scanCtorDtor (); + BOOL scanFunctionName (); + BOOL scanNName (RBString_T * shadow = 0); + BOOL scanSimpleFunctionName (); + BOOL scanSpecialFunctionName (); + BOOL scanSimpleOperator (); + BOOL demangle (const char *mangledName); + + Demangle_T () {} + Demangle_T (const Demangle_T &) {} + void operator = (const Demangle_T &) {} + + const char * theMangledName; + const char * currentPosition; + RBString_T workingString; + BOOL demanglingSucceeded; + + enum DeclMod_T + { + dm_unsigned = 0x0001, + dm_const = 0x0002, + dm_volatile = 0x0004, + dm_signed = 0x0008, + dm_pointer = 0x0010, + dm_reference = 0x0020, + dm_array = 0x0040, + dm_function = 0x0080, + dm_ptrToMember = 0x0100 + }; + + class Declaration_T + { + public: + Declaration_T (); + Declaration_T (const Declaration_T &); + Declaration_T & operator = (const Declaration_T &); + Declaration_T & operator += (const DeclMod_T); + Declaration_T & operator -= (const DeclMod_T); + + BOOL is (const DeclMod_T) const; + + private: + long contents; + }; + }; + +/* inline definitions */ + +#ifdef __cplusplus +extern "C" { +#endif + +// cplusLogMsg +// +typedef int (* FUNCPTR_ARGS) (...); +extern FUNCPTR_ARGS _func_logMsg; + +#ifdef __cplusplus +} +#endif + +inline void cplusLogMsg (char *fmt, int arg1, int arg2, int arg3, + int arg4, int arg5, int arg6) + { + if (_func_logMsg != 0) + { + (* _func_logMsg) (fmt, arg1, arg2, arg3, arg4, arg5, arg6); + } + } + +// ArrayDesc_T :: ArrayDesc_T +// +inline ArrayDesc_T :: ArrayDesc_T (void *pObject, int nElems) + { + this->pObject = pObject; + this->nElems = nElems; + } + +#endif /* __cplusplus (C++-only declarations) */ + +/* data declarations */ + +extern CPLUS_XTOR_STRATEGIES cplusXtorStrategy; +extern SEM_ID cplusNewHdlMutex; + +/* function declarations, C linkage */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern CPLUS_DEM_FUNC_PTR cplusDemangleFunc; +extern CPLUS_DEM_FUNC2_PTR cplusDemangle2Func; +extern CPLUS_DEM_BUFF_FUNC_PTR cplusDemangleToBufferFunc; + +extern DEMANGLER_STYLE cplusDemanglerStyle; +extern CPLUS_DEMANGLER_MODES cplusDemanglerMode; + +extern void cplusArraysInit (void); +extern void cplusDemanglerInit (void); +extern int cplusUserAsk (LIST * pSymList); +extern UINT cplusMatchMangledListGet (SYMTAB_ID symTab, const char * string, + LIST * pSymList); +extern BOOL cplusMatchMangled (SYMTAB_ID symTab, char *string, + SYM_TYPE *pType, int *pValue); +extern STATUS cplusMangledSymGet (SYMTAB_ID symTab, char * string, + SYM_TYPE * pType, int * pValue, + BOOL * pSymbolList); +extern char * cplusDemangle (char *source, char *dest, int n); +extern char * cplusDemangle2 (const char * mangledSymbol, + DEMANGLER_STYLE style, + DEMANGLER_MODE mode); +extern DEMANGLER_RESULT cplusDemangleToBuffer (char * source, + char * buffer, + size_t * pBufferSize, + DEMANGLER_MODE mode, + char ** pResult); +extern BOOL cplusMangledSymCheck (const char * symbol); +extern STATUS cplusLibInit (void); +extern STATUS cplusLibMinInit (void); + +extern void cplusDemanglerStyleInit (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcplusLibPh */ diff --git a/h/private/cplusLoadP.h b/h/private/cplusLoadP.h new file mode 100644 index 0000000..247f5a9 --- /dev/null +++ b/h/private/cplusLoadP.h @@ -0,0 +1,54 @@ +/* private/cplusLoadP.h - VxWorks loader shared C++ support */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify, or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01a,05sep05,v_r Written. Moved loader-specific includes from cplusLibP.h +*/ + +#ifndef __INCcplusLoadPh +#define __INCcplusLoadPh + +#ifdef HOST +#include +#else +#include +#endif + +#include +#include + +/* Type declarations */ + +typedef enum + { + XTOR_CALL = 0, + NO_XTOR_CALL = 1, + NO_OVERRIDE = 2 + } CPLUS_XTOR_OVERRIDE; + +/* Function declarations, C linkage */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern STATUS cplusLoadFixup (MODULE_ID module, SYMTAB_ID symTab, + CPLUS_XTOR_OVERRIDE callCtors); + +extern STATUS cplusUnloadFixup (MODULE_ID module, + CPLUS_XTOR_OVERRIDE callDtors); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcplusLoadPh */ diff --git a/h/private/cplusXtorsP.h b/h/private/cplusXtorsP.h new file mode 100644 index 0000000..aba4af9 --- /dev/null +++ b/h/private/cplusXtorsP.h @@ -0,0 +1,49 @@ +/* private/cplusXtorsP.h - VxWorks loader shared C++ Xtors definitions */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify, or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01b,13sep05,bpn Remove cplusXtorGet() prototype. +01a,05sep05,v_r Written. Moved C++ strategies and Xtors routines definitions + from cplusLibP.h +*/ + +#ifndef __INCcplusXtorsPh +#define __INCcplusXtorsPh + +#ifdef HOST +#include +#else +#include +#endif + +/* Type declarations */ + +typedef enum + { + MANUAL = 0, + AUTOMATIC = 1 + } CPLUS_XTOR_STRATEGIES; + +/* Function declarations, C linkage */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern void cplusCallCtors (VOIDFUNCPTR * ctors); +extern void cplusCallDtors (VOIDFUNCPTR * dtors); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcplusXtorsPh */ diff --git a/h/private/cpuPwrLibP.h b/h/private/cpuPwrLibP.h new file mode 100644 index 0000000..8fec0a1 --- /dev/null +++ b/h/private/cpuPwrLibP.h @@ -0,0 +1,115 @@ +/* cpuPwrLibP.h - CPU power management framework library private header file */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- + +01c,09sep05,mmi mods for coding standard compliance +01b,27aug05,mmi adapt the file for all flavours of IA32 cpu's +01a,27Jul05,mmi created +*/ + +#ifndef __INCcpuPwrLibPh +#define __INCcpuPwrLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include + +/* defines */ + +/* typedef's */ + +/* CPU power framework scheduler hook type */ + +typedef void (*CPU_PWR_SCHED_HOOK) (void); + +/* C-States Hook */ + +typedef STATUS (*CPU_PWR_C_STATE_HOOK) (CPU_PWR_C_STATE); + +typedef UINT32 (* UTIL_GET_RTN) (void); +/* Strucure populated by BSP's */ + +typedef struct cpuPwrBspInit + { + int themVectNum; /* Thermal interrupt vector */ + FUNCPTR acPwrSrcCheck; /* Pwr source AC/DC ? */ + CPU_PWR_C_STATE_HOOK CStateHook; /* get CPU_PWR_P_STATE */ + } CPU_PWR_BSP_INIT; + +/* Denifitions for the interface between the generic and the architecture + * specific layers of the power management framework. + */ + +typedef struct cpuPwrPrimitives + { + FUNCPTR CStateSet; /* Set CPU_PWR_C_STATE */ + FUNCPTR PStateSet; /* Set CPU_PWR_P_STATE */ + FUNCPTR PStateGet; /* get CPU_PWR_P_STATE */ + FUNCPTR pwrMgmtEnable; /* Enable H/W pwr. mgmt. */ + FUNCPTR tempThreshSet; /* Set temp. trip point */ + FUNCPTR tempThreshGet; /* Get temp. trip point */ + FUNCPTR checkHot; /* Check if CPU hot */ + CPU_PWR_C_STATE CStateMax; /* max possible Cstates */ + CPU_PWR_P_STATE PStateMax; /* max possible Pstates */ + UTIL_GET_RTN utilGet; /* Fcn to get utilization */ + FUNCPTR thermIntEnable;/* Enable thermal int */ + FUNCPTR tempGet; /* Get CPU temperature */ + FUNCPTR idleExitStamp; /* Idle exit time stamp */ + FUNCPTR idleEntStamp; /* Idle ent time stamp */ + } CPU_PWR_PRIMITIVES, * CPU_PWR_PRIMITIVES_PTR; + +typedef struct cpuPwrFrameWork /* holds Power management framework elements */ + { + CPU_PWR_PRIMITIVES_PTR pPrimitives; /* pointer for low-level info */ + UINT lowThreshold; /* min temp threshold */ + UINT highThreshold; /* max temp threshold */ + UINT utilPeriod1; /* time interval to + read utilization to decide if + power boots is necessary */ + UINT utilPeriod2;/* time interval to read + utilization to decide if + power reduction is necessary */ + CPU_PWR_P_STATE taskPState; /* Record the default task P-State */ + CPU_PWR_P_STATE isrPState; /* Record the default ISR P-State */ + FUNCPTR pwrIntHandler; /* Thermal interrupt handler */ + CPU_PWR_P_STATE currentPState; /* Current task P State */ + + } CPU_PWR_FRAME_WORK, * CPU_PWR_FRAME_WORK_PTR; + +/* function declarations */ + +extern STATUS cpuPwrArchLibInit (CPU_PWR_FRAME_WORK_PTR); +extern void cpuPwrThermIntConnect (VOIDFUNCPTR * pVectNum); +extern STATUS cpuPwrFrameWorkInit ( UINT32, UINT32, UINT32, UINT32, UINT32, + UINT32); +void cpuPwrIdleEnter (void); +void cpuPwrIntExit (void); +void cpuPwrIntEnter (void); +void cpuPwrWdUpRtn (void); +void cpuPwrWdDownRtn (void); +void cpuPwrTaskCreateRtn (WIND_TCB *); +void cpuPwrTaskSwapRtn (WIND_TCB *, WIND_TCB *); +void cpuPwrThermIntHandler (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcpuPwrLibP */ diff --git a/h/private/dbgLibP.h b/h/private/dbgLibP.h new file mode 100644 index 0000000..0941883 --- /dev/null +++ b/h/private/dbgLibP.h @@ -0,0 +1,65 @@ +/* dbgLibP.h - private debugging facility header */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01n,17mar04,bpn Exported several functions for command line interpreter. +01m,09feb04,elg Add definition of _dbgInstSizeGet(). +01l,25nov03,bpn Added several prototypes. +01k,21oct03,bpn Moved several definitions to dbgTaskLibP.h. +01j,05mar03,bpn Removed some definitions and external declatations. +01i,28feb03,bpn Moved in definitions from dbgLib.h. Added declaration of + dbgBpAdd(), dbgBpRemove() and dbgHwBpSet(). Clean up. +01h,18jan99,elg Authorize breakpoints in branch delay slot (SPR 24356). +01g,13jan98,dbt modified for new breakpoint scheme +01f,20aug93,dvs removed declaration of dsmNbytes(), added include dsmLib.h + (SPR #2266). +01e,01oct92,yao added to pass pEsf, pRegSet to _dbgStepAdd(). +01d,22sep92,rrr added support for c++ +01c,21jul92,yao added declaration of trcDefaultArgs. changed IMPORT + to extern. +01b,06jul92,yao made user uncallable globals started with '_'. +01a,16jun92,yao written based on mc68k dbgLib.c ver08f. +*/ + +#ifndef __INCdbgLibPh +#define __INCdbgLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include /* for BREAK_ESF struct use in dbgLib.c */ + +/* Defines */ + +#undef INST_CMP +#define INST_CMP(addr,inst,mask) ((*(addr) & (mask)) == (inst)) /* XXX bpn - should be in dbgArchLibP.h */ + +/* Function declarations */ + +extern STATUS dbgBpListPrint (void * ctxId, UINT ctx, BOOL compat); +extern void dbgCallPrint (INSTR * callAdrs, int funcAdrs, int nargs, + int * args, int taskId, BOOL isKernelAdrs); +extern STATUS dbgStackTrace (int taskId, const char * errorStr); +extern STATUS dbgDisassemble (INSTR * addr, int count, SYMTAB_ID symTabId, + const char * errorStr); +extern int _dbgInstSizeGet (INSTR * pBrkInst); + +extern STATUS dbgBpEpCoreRtn (INSTR * addr, int ctxId, UINT ctxType, + UINT bpAction, int count, BOOL hard, + VOIDFUNCPTR callRtn, int callArg, + const char * errorStr); +extern STATUS dbgTaskTraceCoreRtn (int taskId, const char * errorStr); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdbgLibPh */ diff --git a/h/private/dbgRtpLibP.h b/h/private/dbgRtpLibP.h new file mode 100644 index 0000000..61c2541 --- /dev/null +++ b/h/private/dbgRtpLibP.h @@ -0,0 +1,30 @@ +/* dbgRtpLibP.h - private RTP debugging facility header */ + +/* Copyright 2004-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,10jan05,bpn Added dbgRtpInit() prototype. Removed dbgRtpBpAllRemove(). +01a,05apr04,bpn Written. +*/ + +#ifndef __INCdbgRtpLibPh +#define __INCdbgRtpLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Defines */ + +/* Function declarations */ + +extern STATUS dbgRtpInit (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdbgRtpLibPh */ + diff --git a/h/private/dbgTaskLibP.h b/h/private/dbgTaskLibP.h new file mode 100644 index 0000000..5c425de --- /dev/null +++ b/h/private/dbgTaskLibP.h @@ -0,0 +1,91 @@ +/* dbgTaskLibP.h - private header file for dbgTaskLib.c */ + +/* Copyright 2003-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,10jan05,bpn Removed dbgRtpInit() prototype. +01h,09jan04,elg Add notification function pointer for breakpoint + synchronization. +01g,25nov03,elg Add RTP support. +01f,14nov03,elg Change dbgTaskBpEpSet() and dbgTaskHwBpSet() prototype. +01e,21oct03,bpn Added definitions from dbgLibP.h. Added BP_LOCATION enum. +01d,17oct03,elg Add dbgLibP.h to define EVT_CALL_ARGS. +01c,08jul03,bpn Updated. +01b,27jun03,bpn Changed enum value DBG_CRET to DBG_CONT_RET. +01a,26feb03,bpn Created. +*/ + +#ifndef __INCdbgTaskLibPh +#define __INCdbgTaskLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include + +/* Defines */ + +#define ALL 0 /* breakpoint applies to all tasks */ + +#define DBG_INFO(p) (&(((WIND_TCB *)(p))->wdbInfo)) + +#define ANY_TASK_BP(pBp) (((pBp)->bp_flags & BP_ANY_TASK) == BP_ANY_TASK) +#define ONE_TASK_BP(pBp, tid) ((((pBp)->bp_flags & BP_TASK) == BP_TASK) \ + && ((pBp)->bp_ctxId == (UINT32) (tid))) +#define ONE_RTP_BP(pBp, rtpid) ((((pBp)->bp_flags & BP_RTP) == BP_RTP) \ + && ((pBp)->bp_ctxId == (UINT32) (rtpid))) + +/* typedefs */ + +typedef enum + { + BP_NUMBER_LOCATION = 1, + BP_ADDRESS_LOCATION, + BP_ALL_LOCATION + } BP_LOCATION; + +typedef struct /* EVT_CALL_ARGS */ + { + FUNCPTR evtRtn; /* event routine */ + int evtRtnArg; /* event routine argument */ + event_t eventId; /* event ID */ + } EVT_CALL_ARGS; + +/* externals */ + +extern FUNCPTR _func_dbgRtpStop; +extern FUNCPTR _func_dbgRtpCont; +extern VOIDFUNCPTR _func_bpSyncNotify; + +/* function declarations */ + +extern STATUS dbgTaskInit (); +extern STATUS dbgTaskTmpBpRemove (int taskId, INSTR * pc); +extern BOOL dbgTaskBpRemove (void * ctxId, INSTR * addrNum, + UINT ctx, BP_LOCATION location); +extern STATUS dbgTaskBpEpSet (INSTR * addr, void * ctxId, UINT flags, + UINT count, UINT action, + VOIDFUNCPTR callRtn, int callArg, + UINT * pBpId); +#if DBG_HARDWARE_BP +extern STATUS dbgTaskHwBpSet (INSTR * addr, void * ctxId, UINT flags, + UINT count, UINT action, + VOIDFUNCPTR callRtn, int callArg, + UINT * pBpId); +#endif /* DBG_HARDWARE_BP */ +extern STATUS dbgTaskCont (UINT32 contextId); +extern STATUS dbgTaskStop (UINT32 contextId); +extern STATUS dbgTaskStep (UINT32 contextId, UINT32 startAddr, + UINT32 endAddr); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdbgTaskLibPh */ diff --git a/h/private/distObjTypeP.h b/h/private/distObjTypeP.h new file mode 100644 index 0000000..e8647f3 --- /dev/null +++ b/h/private/distObjTypeP.h @@ -0,0 +1,43 @@ +/* distObjTypeP.h - distributed objects type header file */ + +/* Copyright 1998 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,21may98,drm written. +*/ + +#ifndef __INCdistObjTypePh +#define __INCdistObjTypePh + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* defines */ + +/* types of objects within VxWorks: standard, shared memory and distributed */ +#define VX_TYPE_STD_OBJ 0x0L /* local, non shared objects */ +#define VX_TYPE_SM_OBJ 0x1L /* shared memory objects */ +#define VX_TYPE_DIST_OBJ 0x3L /* distributed objects */ + +#define VX_TYPE_OBJ_MASK 0x3L /* two bits to distinguish type */ + +#define ID_IS_DISTRIBUTED(msgQId) \ + ((((uint32_t) (msgQId)) & VX_TYPE_OBJ_MASK) == VX_TYPE_DIST_OBJ) + /* determine if obj is distributed */ + +/* status codes */ +#define S_distLib_NOT_INITIALIZED (M_distLib | 1) /* error code */ +#define S_distLib_NO_OBJECT_DESTROY (M_distLib | 2) /* error code */ +#define S_distLib_UNREACHABLE (M_distLib | 3) /* error code */ +#define S_distLib_UNKNOWN_REQUEST (M_distLib | 4) /* error code */ +#define S_distLib_OBJ_ID_ERROR (M_distLib | 5) /* error code */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCdistObjTypePh */ + diff --git a/h/private/dosDirLibP.h b/h/private/dosDirLibP.h new file mode 100644 index 0000000..e8b03c0 --- /dev/null +++ b/h/private/dosDirLibP.h @@ -0,0 +1,204 @@ +/* dosDirLibP.h - private header of directory handler */ + +/* Copyright 1999-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,18apr04,act add DOS_DEL_SUBST (0xe5 <=> 0x05 in file names); + get rid of DIRENT_PTR (different in old vs VFAT dirs); + change VFAT-specific data and identify them by name +01f,20sep01,jkf SPR#69031, common code for both AE & 5.x. +01e,29feb00,jkf T3 changes +01d,31jul99,jkf T2 merge, tidiness & spelling. +01c,22nov98,vld fields and moved from + DOS_DIR_PDESCR structure to structure DOS_DIR_DESC + in dosFsLibP.h header +01b,02jul98,lrn doc review +01a,18jan98,vld written, +*/ + +#ifndef __INCdosDirLibP +#define __INCdosDirLibP + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "semLib.h" +#include "dosFsLib.h" + +#define DOS_VX_LONG_NAME_LEN 40 /* length of vxWorks proprietary */ + /* long filename */ +#define DOS_VFAT_NAME_LEN 255 /* max W-95 style name length */ + + +/* standard directory entry */ + +#define DOS_DIRENT_STD_LEN 32 /* standard directory entry size */ + +#define DOS_RESERVED_LEN 10 /* reserved bytes in regular dir ent */ + /* fully used by VFAT aliases */ + +#define DOS_STDNAME_LEN 8 /* length of filename */ + /* (no extension) */ +#define DOS_STDEXT_LEN 3 /* length of filename extension */ +#define DOS_ATTRIB_OFF (DOS_STDNAME_LEN+DOS_STDEXT_LEN) +#define DOS_NAME_CASE_OFF (DOS_ATTRIB_OFF+1) +#define DOS_CREAT_MS_OFF (DOS_NAME_CASE_OFF+1) +#define DOS_CREAT_TIME_OFF (DOS_CREAT_MS_OFF+1) +#define DOS_CREAT_DATE_OFF (DOS_CREAT_TIME_OFF+2) +#define DOS_LAST_ACCESS_TIME_OFF ((u_char) NONE) +#define DOS_LAST_ACCESS_DATE_OFF (DOS_CREAT_DATE_OFF+2) +#define DOS_EXT_START_CLUST_OFF (DOS_LAST_ACCESS_DATE_OFF+2) +#define DOS_MODIF_TIME_OFF (DOS_EXT_START_CLUST_OFF+2) +#define DOS_MODIF_DATE_OFF (DOS_MODIF_TIME_OFF+2) +#define DOS_START_CLUST_OFF (DOS_MODIF_DATE_OFF+2) +#define DOS_FILE_SIZE_OFF (DOS_START_CLUST_OFF+2) +#define DOS_EXT_FILE_SIZE_OFF ((u_char) NONE) +#define DOS_EXT_FILE_SIZE_LEN ((u_char) NONE) + +/* vxWorks proprietary long names' directory entry */ + +#define DOS_VX_DIRENT_LEN 64 + +#define DOS_VX_NAME_LEN DOS_VX_LONG_NAME_LEN +#define DOS_VX_EXT_LEN 0 /* (no extension) */ +#define DOS_VX_CREAT_TIME_OFF (DOS_VX_NAME_LEN+DOS_VX_EXT_LEN) +#define DOS_VX_CREAT_DATE_OFF (DOS_VX_CREAT_TIME_OFF+2) +#define DOS_VX_LAST_ACCESS_TIME_OFF (DOS_VX_CREAT_DATE_OFF+2) +#define DOS_VX_LAST_ACCESS_DATE_OFF (DOS_VX_LAST_ACCESS_TIME_OFF+2) +#define DOS_VX_EXT_START_CLUST_OFF (DOS_VX_LAST_ACCESS_DATE_OFF+2) +#define DOS_VX_EXT_FILE_SIZE_OFF (DOS_VX_EXT_START_CLUST_OFF+2) +#define DOS_VX_EXT_FILE_SIZE_LEN 2 +#define DOS_VX_RESERVED_LEN 1 /* 13 -4 cr t/d -4 acc t/d -2 st cl - */ + /* DOS_VX_EXT_FILE_SIZE_LEN */ +#define DOS_VX_ATTRIB_OFF (DOS_VX_EXT_FILE_SIZE_OFF+ \ + DOS_VX_EXT_FILE_SIZE_LEN+ \ + DOS_VX_RESERVED_LEN) +#define DOS_VX_MODIF_TIME_OFF (DOS_VX_ATTRIB_OFF+1) +#define DOS_VX_MODIF_DATE_OFF (DOS_VX_MODIF_TIME_OFF+2) +#define DOS_VX_START_CLUST_OFF (DOS_VX_MODIF_DATE_OFF+2) +#define DOS_VX_FILE_SIZE_OFF (DOS_VX_START_CLUST_OFF+2) + +/* special values */ + +#define ROOT_DIRENT NULL /* root directory does not */ + /* have its own entry */ +/* special characters */ + +#define LAST_DIRENT EOS +#define INVALID_CHAR '|' +#define ZERO_C '0' +#define TILDA '~' +#define DOS_DEL_MARK 0xe5 /* dir entry deleted marker */ +#define DOS_DEL_SUBST 0x05 /* value substituted for DEL_MARK */ + +/* special function argument value */ + +#define DH_VOL_LAB (-1) + +/* macros */ + +#define START_CLUST_DECODE( pVolDesc, pDeDesc, pDirEnt ) \ + ( DISK_TO_VX_16( (char *)(pDirEnt) + \ + (pDeDesc)->startClustOff ) + \ + (((pVolDesc)->fatType == FAT32)? \ + (DISK_TO_VX_16( (char *)(pDirEnt) + \ + (pDeDesc)->extStartClustOff ) << 16) : 0) ) + +#define START_CLUST_ENCODE( pDeDesc, clust, pDirEnt ) \ + { \ + VX_TO_DISK_16( (clust), \ + (char *)(pDirEnt) + (pDeDesc)->startClustOff ); \ + VX_TO_DISK_16( ((clust) >> 16), \ + (char *)(pDirEnt) + \ + (pDeDesc)->extStartClustOff ); \ + } + +#ifdef SIZE64 /* 64-bit file sizes, defined in dosFsLibP.h */ +#define EXT_SIZE_DECODE( pDeDesc, pDirEnt ) \ + ( (fsize_t)( DISK_TO_VX_32( (char *)(pDirEnt) + \ + (pDeDesc)->extSizeOff ) & \ + ( ~((UINT32)(-1)<< \ + ((pDeDesc)->extSizeLen * 8)) ) ) << 32 ) + +#define EXT_SIZE_ENCODE( pDeDesc, pDirEnt, size ) \ + { \ + UINT32 sa, sb = ((UINT32)(size>>32)); \ + VX_TO_DISK_32( sb, &sa ); \ + bcopy( (char *)&sa, \ + (char *)(pDirEnt) + (pDeDesc)->extSizeOff, \ + (pDeDesc)->extSizeLen ); \ + } +#else /* ! SIZE64 */ +#define EXT_SIZE_DECODE( pDeDesc, pDirEnt ) 0 +#define EXT_SIZE_ENCODE( pDeDesc, pDirEnt, size ) \ + bzero( (char *)(pDirEnt) + (pDeDesc)->extSizeOff, \ + (pDeDesc)->extSizeLen ); +#endif /* SIZE64 */ + +/* typedefs */ + +typedef struct PATH_ARRAY /* split path */ + { + u_char * pName; + u_short nameLen; + } PATH_ARRAY; + +typedef PATH_ARRAY * PATH_ARRAY_ID; + +typedef struct DIRENT_DESCR /* details of directory entry */ + { + u_char dirEntSize, + nameLen, + extLen, + atrribOff, + creatTimeOff, + creatDateOff, + modifTimeOff, + modifDateOff, + accessTimeOff, + accessDateOff, + startClustOff, + extStartClustOff, /* 2 most signif. bytes of */ + /* 32-bit FAT entry */ + sizeOff, + extSizeOff, /* n most signif. bytes of */ + /* 64-bit file size */ + extSizeLen; /* number of most signif. bytes of */ + /* 64-bit file size */ + } DIRENT_DESCR; + +typedef DIRENT_DESCR * DIRENT_DESCR_ID; + +typedef struct DOS_DIR_PDESCR /* directory handler's part of */ + /* volume descriptor */ + { + DOS_DIR_DESC dirDesc; /* API functions */ + void * vfatSpace; /* extra space for VFAT code */ + SEM_ID vfatSem; /* semaphore for VFAT code */ + enum { STDDOS=0, VXLONG=1, VFAT=2 } + nameStyle; /* name style */ + DIRENT_DESCR deDesc; /* volume directory entry structure */ + + /* root directory descriptor */ + + UINT32 rootStartClust; /* root directory start cluster number: */ + /* 0 for FAT12/FAT16; */ + /* some value for FAT32 */ + u_int rootMaxEntries; /* max number of entries in root */ + /* value from boot sector for */ + /* FAT12/FAT16; 0xffffffff for FAT32 */ + time_t rootModifTime; /* root directory last modification time */ + /* ( last entry creation time ) */ + } DOS_DIR_PDESCR; +typedef DOS_DIR_PDESCR * DOS_DIR_PDESCR_ID; + +#ifdef __cplusplus + } +#endif + +#endif /* __INCdosDirLibP */ + diff --git a/h/private/dosFsFatP.h b/h/private/dosFsFatP.h new file mode 100644 index 0000000..263573a --- /dev/null +++ b/h/private/dosFsFatP.h @@ -0,0 +1,79 @@ +/* dosFsFatP.h - DOS file system FAT module header file*/ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,21mar04,act changes to support clean bit +01f,20sep01,jkf SPR#69031, common code for both AE & 5.x. +01e,29feb00,jkf T3 changes +01d,31jul99,jkf T2 merge, tidiness & spelling. +01c,23sep98,vld field added to structure MS_FAT_DESC +01b,20sep98,mjc descriptor structure name changed from DOS_FAT16_DESC + to MS_FAT_DESC +01a,23feb98,mjc written, preliminary +*/ + +#ifndef __INCdosFath +#define __INCdosFath + +#ifdef __cplusplus +extern "C" { +#endif + +#include "private/dosFsLibP.h" + + +/* defines */ + +/* conversions of sector <-> cluster numbers */ + +#define CLUST_TO_SEC( pVolDesc, clustNum ) \ + ( ((clustNum) - DOS_MIN_CLUST) * (pVolDesc)->secPerClust + \ + (pVolDesc)->dataStartSec ) + +#define SEC_TO_CLUST( pVolDesc, secNum ) \ + ( ((secNum) - (pVolDesc)->dataStartSec) / \ + (pVolDesc)->secPerClust + DOS_MIN_CLUST ) + + +/* typedefs */ + +typedef enum fat_rw {FAT_READ, FAT_WRITE_GROUP, FAT_WRITE_CLUST} FAT_RW; + +/* + * Should change dosFatDesc to a pointer, and move its activeCopyNum + * member here, then we could point at a single statically-allocated + * FatDesc for each kind of FAT (12, 16, 32). Then should probably + * move the bad/eof values, too. + */ +typedef struct + { + DOS_FAT_DESC dosFatDesc; /* generic DOS FAT descriptor */ + + uint32_t fatStartSec; /* FAT starting sector number */ + uint32_t nFatEnts; /* number of entries in FAT */ + uint32_t fatEntFreeCnt; /* count of free clusters */ + uint32_t dos_fat_avail; /* cluster is available: 0x0000 */ + uint32_t dos_fat_reserv; /* reserved cluster marker: 0xff(f)0 */ + uint32_t dos_fat_bad; /* bad cluster marker: 0xff(f)7 */ + uint32_t dos_fat_eof; /* end-of-file marker: 0xff(f)f */ + uint32_t fatGroupSize; /* size clusters */ + uint32_t groupAllocStart;/* initialize to DOS_MIN_CLUST */ + uint32_t clustAllocStart;/* initialize to DOS_MIN_CLUST */ + BOOL syncEnabled; /* FAT copies mirroring enabling */ + SEM_ID allocSem; /* semaphore to guard allocations */ + } MS_FAT_DESC; + +typedef MS_FAT_DESC * MS_FAT_DESC_ID; + + +/* defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdosFath */ diff --git a/h/private/dosFsLibP.h b/h/private/dosFsLibP.h new file mode 100644 index 0000000..d0ad76d --- /dev/null +++ b/h/private/dosFsLibP.h @@ -0,0 +1,888 @@ +/* dosFsLibP.h - DOS file system private header file */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ + +/* modification history +-------------------- +02g,12oct05,dcc implemented non DMA-safe option for dosFs cache. +02f,29sep05,dcc implemented write cache. +02e,04aug05,dcc added more cache statistics data. +02d,04aug05,jlk moved formatter function pointer, dosFsFmtRtn, to dosFsLib.h +02c,18jul05,jlk Added formatter function pointer, dosFsFmtRtn +02b,07apr05,dcc added cache support to dosFs. +02a,18apr05,dcc updated dosFs formatter. +01z,30mar05,dcc updated to use several bios per volume. +01y,31jan05,dcc modified to use XBD interface. +01x,07oct04,act split flags and mode in pathLkup function +01w,26aug04,feg Coverity code coverage bug #261 of 2004-06-22 +01v,18apr04,act add Unicode; change (and document) chkdsk semi-secret info +01u,04apr04,jkf SPR#95752: changing openMode from u_char to u_int +01t,21mar04,act changes to support clean bit +01s,04mar04,act fix spelling in comments, type of parDirStartCluster +01r,02sep03,jkf add volWriteOpt to DOS_VOLUME_DESC for write-through support. +01q,03mar02,jkf SPR#29751, added volIsCaseSens to DOS_VOLUME_DESC, orig by chn +01p,30nov01,jkf SPR#68203, add updateLastAccessDate boolean to DOS_VOLUME_DESC +01o,17nov01,jkf fixing dosFsVolIsFat12 divide error. +01n,10nov01,jkf SPR#32178, made dosFsVolDescGet public, moved + DOS_VOLUME_DESC_ID typedef to public dosFsLib.h +01m,30jul01,jkf SPR#69031, common code for both AE & 5.x. +01l,13mar01,jkf SPR#34704, adding dosFsVolIsFat12 +01k,29feb00,jkf removed semLibP.h usage for t3. +01j,31aug99,jkf CBIO API overhaul changes. +01i,31jul99,jkf added DOS_BOOT_FSTYPE_ID, and DOS_BOOT_FSTYPE_LEN, + SPR#28272, 28273, 28274, 28275. +01h,31jul99,jkf T2 merge, tidiness & spelling. +01g,21dec98,mjc changed name of field in structure + to +01f,22nov98,vld field changed to in + DOS_FILE_DESC structure; + added macros POS_TO_DD_COOKIE() and DD_COOKIE_TO_POS(); + fields and added to + DOS_DIR_DESC structure +01e,23sep98,vld field added to CHK_DSK_DESC; +01d,17sep98,vld field added to DOS_FAT_DESC; + changed prototypes of some func ptr fields of DOS_FAT_DESC; + func ptr field added to DOS_FAT_DESC; + added constant DOS_FAT_RAW; + added constant DOS_FAT_SET_ALL; + changed prototypes of some function ptrs + in DOS_FAT_DESC; +01c,16sep98,vld definition of DOS_VOL_LABEL_LEN moved to dosFsLib.h +01b,02jul98,lrn ready for prerelease +01a,22jan98,vld written, +*/ + +#ifndef __INCdoFsLibP +#define __INCdoFsLibP + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "private/dosFsVerP.h" +#include "semLib.h" +#include "iosLib.h" +#include "cbioLib.h" +#include "dirent.h" +#include "stat.h" + +#include "dosFsLib.h" +#include "drv/xbd/bio.h" + +/* defines */ + +/* use 64-bit arithmetic */ + +#define SIZE64 + +#define DOS_FS_MAGIC 0xdfac9723 /* used for verification of vol desc */ +#define DOS_VX_LONG_NAMES_SYS_ID "VXEXT" + +#define SLASH '/' +#define BACK_SLASH '\\' +#define DOT '.' +#define SPACE ' ' +/* + * handlers ID. + * Each handler (FAT, Directory and so on) must have its own + * identification number in order to be able to distinguish + * different handler types when selecting handlers + */ + /* directory handlers */ + +#define DOS_DIR_HDLR_MASK (1 << 8) /* dir handlers mask */ +#define DOS_DIROLD_ID (DOS_DIR_HDLR_MASK +1) /* 8.3 and vxLong names */ + + /* FAT handlers */ + +#define DOS_FAT_HDLR_MASK (1 << 9) /* fat handlers mask */ + +/* function arguments */ + +/* for directory handler API */ + +#define DH_TIME_CREAT 1 +#define DH_TIME_MODIFY (1<<1) +#define DH_TIME_ACCESS (1<<2) +#define DH_DELETE (1<<8) + +/* FAT handler API */ + +#define FAT_NOT_ALLOC 0 +#define FAT_ALLOC (1<<31) +#define FAT_ALLOC_ONE (FAT_ALLOC|1) +#define FH_INCLUDE 0 +#define FH_EXCLUDE 1 +#define FH_FILE_START ((u_int)(-1)) + +/* dosFs file system constants */ + +#define DOS_BOOT_SEC_NUM 0 /* sector number of boot sector */ +#define DOS_MIN_CLUST 2 /* lowest cluster number used */ +#define DOS_SYS_ID_LEN 8 /* length of system ID string */ +#define DOS_FAT_12BIT_MAX 4085 /* max clusters for 12-bit FAT entries*/ +#define DOS_NFILES_DEFAULT 20 /* default max number of files */ + +/* Boot sector offsets */ + +/* Because the MS-DOS boot sector format has word data items + * on odd-byte boundaries, it cannot be represented as a standard C + * structure. Instead, the following symbolic offsets are used to + * isolate data items. Non-string data values longer than 1 byte are + * in "Intel 8086" order. + * + * These definitions include fields used by MS-DOS Version 4.0. + */ +#define DOS_BOOT_JMP 0x00 /* 8086 jump instruction (3 bytes)*/ +#define DOS_BOOT_SYS_ID 0x03 /* system ID string (8 bytes)*/ +#define DOS_BOOT_BYTES_PER_SEC 0x0b /* bytes per sector (2 bytes)*/ +#define DOS_BOOT_SEC_PER_CLUST 0x0d /* sectors per cluster (1 byte) */ +#define DOS_BOOT_NRESRVD_SECS 0x0e /* # of reserved sectors (2 bytes)*/ +#define DOS_BOOT_NFATS 0x10 /* # of FAT copies (1 byte) */ +#define DOS_BOOT_MAX_ROOT_ENTS 0x11 /* max # of root dir entries (2 bytes)*/ +#define DOS_BOOT_NSECTORS 0x13 /* total # of sectors on vol (2 bytes)*/ +#define DOS_BOOT_MEDIA_BYTE 0x15 /* media format ID byte (1 byte) */ +#define DOS_BOOT_SEC_PER_FAT 0x16 /* # of sectors per FAT copy (2 bytes)*/ +#define DOS_BOOT_SEC_PER_TRACK 0x18 /* # of sectors per track (2 bytes)*/ +#define DOS_BOOT_NHEADS 0x1a /* # of heads (surfaces) (2 bytes)*/ +#define DOS_BOOT_NHIDDEN_SECS 0x1c /* # of hidden sectors (4 bytes)*/ +#define DOS_BOOT_LONG_NSECTORS 0x20 /* total # of sectors on vol (4 bytes)*/ +#define DOS_BOOT_DRIVE_NUM 0x24 /* physical drive number (1 byte) */ +#define DOS_BOOT_SIG_REC 0x26 /* boot signature record (1 byte) */ +#define DOS_BOOT_VOL_ID 0x27 /* binary volume ID number (4 bytes)*/ +#define DOS_BOOT_VOL_LABEL 0x2b /* volume label string (11 bytes)*/ +#define DOS_BOOT_FSTYPE_ID 0x36 /* new MS ID, FAT12 or FAT16 */ +#define DOS_BOOT_FSTYPE_LEN 0x08 /* length in bytes of FSTYPE */ +#define DOS_BOOT_FSTYPE_FAT16 "FAT16 " /* FSTYPE_ID FAT16 */ +#define DOS_BOOT_FSTYPE_FAT12 "FAT12 " /* FSTYPE_ID FAT12 */ +#define DOS_BOOT_SYSID_FAT32 "FAT32 " /* FAT32 SYS_ID, */ +#define DOS_BOOT_PART_TBL 0x1be /* first disk partition tbl (16 bytes)*/ +#define DOS_EXT_BOOT_SIG 0x29 /* value written to boot signature */ + /* record to indicate extended */ + /* (DOS v4) boot record in use */ +/* extended FAT32 fields offsets */ + +#define DOS32_BOOT_SEC_PER_FAT 0x24 /* sectors per FAT (4 bytes)*/ +#define DOS32_BOOT_EXT_FLAGS 0x28 /* FAT miscellaneous flags (2 bytes)*/ +#define DOS32_BOOT_FS_VERSION 0x2a /* file system version (2 bytes)*/ +#define DOS32_BOOT_ROOT_START_CLUST 0x2c /* root start cluster (4 bytes)*/ +#define DOS32_BOOT_FS_INFO_SEC 0x30 /* file system info sector (2 bytes)*/ +#define DOS32_BOOT_BOOT_BKUP 0x32 /* bkup of boot sector (2 bytes)*/ +#define DOS32_BOOT_RESERVED 0x3a /* reserved area (6 bytes)*/ +#define DOS32_BOOT_BIOS_DRV_NUM 0x40 /* 0x80 for hard disk (1 byte)*/ +#define DOS32_BOOT_SIGNATURE 0x42 /* ')' (0x29) (1 byte)*/ +#define DOS32_BOOT_VOL_ID 0x43 /* binary volume Id (4 bytes*/ +#define DOS32_BOOT_VOL_LABEL 0x47 /* volume label string (11 bytes)*/ +#define DOS32_BOOT_FS_TYPE 0x52 /* string FAT32 */ + +#define DOS_BOOT_BUF_SIZE 0x80 /* size of buffer large enough to */ + /* get boot sector data to */ + /* ( without partition table ) */ + +#define CHK_MAX_PATH 1024 /* max path in check disk's message */ + +/* macros */ + +/* endian data conversion macros, disk always L.E. */ + +#define DISK_TO_VX_16( pSrc ) (UINT16)( \ + ( *((u_char *)(pSrc)+1) << 8 ) | \ + ( *(u_char *)(pSrc) ) ) + +#define DISK_TO_VX_32( pSrc ) (UINT32)( \ + ( *((u_char *)(pSrc)+3)<<24 ) | \ + ( *((u_char *)(pSrc)+2)<<16 ) | \ + ( *((u_char *)(pSrc)+1)<< 8 ) | \ + ( *(u_char *)(pSrc) ) ) +#define VX_TO_DISK_16( src, pDst ) \ + ( * (u_char *)(pDst) = (src) & 0xff, \ + *((u_char *)(pDst) + 1) = ((src)>> 8) & 0xff ) + +#define VX_TO_DISK_32( src, pDst ) \ + ( * (u_char *)(pDst) = (src) & 0xff, \ + *((u_char *)(pDst) + 1) = ((src)>> 8) & 0xff, \ + *((u_char *)(pDst) + 2) = ((src)>> 16) & 0xff, \ + *((u_char *)(pDst) + 3) = ((src)>> 24) & 0xff ) \ + +/* sector macros */ + +#define NSECTORS( pVolDesc, off ) ( (off) >> (pVolDesc)->secSizeShift ) +#define OFFSET_IN_SEC( pVolDesc, off ) \ + ( (off) & ((pVolDesc)->bytesPerSec - 1) ) + +/* conversions of sector <-> cluster numbers */ + +/* check, if directory is root */ + +#define IS_ROOT( pFd ) \ + ((pFd)->pFileHdl->dirHdl.parDirStartCluster == (uint32_t) NONE) + +#define ROOT_SET( pFd ) \ + ((pFd)->pFileHdl->dirHdl.parDirStartCluster = (uint32_t) NONE) + +/* FAT entry types, returned by clustValueSet() and clustValueGet() */ + +#define DOS_FAT_AVAIL 0x00000001 /* available cluster */ +#define DOS_FAT_EOF 0x00000002 /* end of file's cluster chain */ +#define DOS_FAT_BAD 0x00000004 /* bad cluster (damaged media) */ +#define DOS_FAT_ALLOC 0x00000008 /* allocated cluster */ +#define DOS_FAT_INVAL 0x00000010 /* invalid cluster (illegal value) */ +#define DOS_FAT_RESERV 0x00000020 /* reserved cluster */ +#define DOS_FAT_RAW 0x00000040 /* write raw data, when fat copy */ + /* is used as temporary buffer */ +#define DOS_FAT_SET_ALL 0x00000080 /* fill all bytes of FAT copy with */ + /* a specified value. */ +#define DOS_FAT_ERROR 0x11111111 /* CBIO ERROR */ + +/* + * handlers Id-s. All installed handlers are sorted by + * Id-s, and are tried on every volume in accordance with that order + */ +#define DOS_MAX_HDLRS 4 /* max handlers of one type */ +#define DOS_FATALL_HDLR_ID 255 /* dosFsFat16 - supports FAT 12/16/32 */ + /* in a simple manner */ + /* ( without any buffering ) */ +#define DOS_VDIR_HDLR_ID 1 /* dosVDirLib - supports VDIR */ + /* directory structure for all FAT types */ +#define DOS_DIROLD_HDLR_ID 2 /* dosDirOldLib - supports DOS4.0 */ + /* "8.3" names and vxLong names for */ + /* all FAT types */ + +/* definition of 64-bit type and macro to check for 32-bit overflowing */ + +#ifdef SIZE64 + +typedef long long fsize_t; +#define DOS_IS_VAL_HUGE( val ) ( ( (fsize_t)(val) >> 32 ) != 0 ) + /* test for 32 bit overflowing */ +#define DOS_MAX_FSIZE ( ~((fsize_t)1<<(sizeof(fsize_t)*8-1)) ) + /* max disk/file size */ + +#else /* ! SIZE64 */ + +typedef u_long fsize_t; +#define DOS_IS_VAL_HUGE( val ) FALSE +#define DOS_MAX_FSIZE ( (fsize_t)(-1) ) /* max disk/file size */ + +#endif /* SIZE64 */ + +/* + * processing for dd_cookie field in DIR structure(). (see dirent.h) + * Current position in directory supposed to be always power of 2 + */ +#define POS_TO_DD_COOKIE( pos ) ( ((u_long)(pos)) | 1 ) +#define DD_COOKIE_TO_POS( pDir ) ( ((DIR *)(pDir))->dd_cookie & (~1) ) + +#define DOS_VOLUME_BIO_SIZE 3 /* 3 bios per volume for the moment. This + * value specify the limit of concurrent + * media accesses + */ + +#define DOS_VOL_NO_DMA_SET(pVolDesc) \ + (pVolDesc->volCacheOptions |= DOS_CACHE_VOL_NO_DMA) + +#define DOS_VOL_IS_NO_DMA(pVolDesc) \ + ((pVolDesc->volCacheOptions & DOS_CACHE_VOL_NO_DMA) != 0) + +/* size in blocks of a bio data buffer */ + +#define DOS_VOLUME_BIO_BUFFER_SIZE 32 + +/* typedefs */ + +/* + * Directory entry descriptor. + * This structure is part of file handle and + * is intended to directory handlers usage. + */ +typedef struct DOS_DIR_HDL + { + uint32_t parDirStartCluster; /* cluster containing parent */ + /* directory entry */ + block_t sector; /* sector containing alias (short name) */ + /* directory entry */ + off_t offset; /* alias (short name) directory entry offset */ + /* in sector */ + block_t lnSector; /* sector containing long name start */ + off_t lnOffset; /* long name offset in sector */ + cookie_t cookie; /* for cache quick access */ + + /* implementation private usage */ + + u_long dh_Priv1; + u_long dh_Priv2; + u_long dh_Priv3; + u_long dh_Priv4; + + u_char crc; /* crcon directory entry (not used) */ + } DOS_DIR_HDL; +typedef DOS_DIR_HDL * DOS_DIR_HDL_ID; + +/* + * File FAT descriptor. + * This structure is part of file descriptor and + * is intended to FAT handlers usage. + */ +typedef struct DOS_FAT_HDL + { + uint32_t lastClust; /* number of last passed cluster in chain */ + uint32_t nextClust; /* contents of entry */ + cookie_t cbioCookie; /* CBIO dev. cookie for last accessed sector */ + uint32_t errCode; /* */ + } DOS_FAT_HDL; +typedef DOS_FAT_HDL * DOS_FAT_HDL_ID; + +/* + * File handle. + * This structure is shared by all file descriptors (see below). + * that are opened for the same file. + * Field is filled and used by directory handler. + */ +typedef struct DOS_FILE_HDL + { + fsize_t size; /* recent file size */ + u_int deleted : 1, /* file deleted */ + obsolet : 1, /* file was changed, but not closed yet */ + changed : 1, /* file was changed, but not closed yet */ + res : 29; + + /* FAT fields */ + + uint32_t startClust; /* file start cluster */ + /* ( 0 - not allocated yet ) */ + uint32_t contigEndPlus1; /* end clust. of contiguous area in file + 1 */ + uint32_t fatSector; /* last modified FAT sector */ + + DOS_DIR_HDL dirHdl; /* directory entry descriptor */ + + u_short nRef; /* reference count - the number of times */ + /* file is simultaneously opened */ + u_char attrib; /* file attributes */ + } DOS_FILE_HDL; + +typedef DOS_FILE_HDL * DOS_FILE_HDL_ID; + +/* + * File descriptor. + * This structure is allocated every time new file is opened. + * Fields , , are filled by fat handler + * via get next cluster operation and then are corrected by other + * modules in accordance with operation being executed. + */ +typedef struct DOS_FILE_DESC + { + DOS_VOLUME_DESC_ID pVolDesc; /* volume descriptor ptr */ + DOS_FILE_HDL_ID pFileHdl; /* file handle, that is shared */ + /* between file descriptors */ + /* of the same file */ + fsize_t pos; /* current absolute position in file */ + /* for directory: absolute offset from */ + /* from directory start */ + fsize_t seekOutPos; /* save position in case seek passes EOF */ + /* contains 0, if no such seek occurred */ + block_t curSec; /* current data sector */ + u_int nSec; /* number of contiguous sectors */ + cookie_t cbioCookie; /* last accessed sector ptr */ + /* ( is filled by cbio ) */ + u_char accessed; /* file was accessed */ + u_char changed; /* file was changed */ + + DOS_FAT_HDL fatHdl; + + u_int openMode; /* open mode ( RDONLY/WRONLY/RDWR ) */ + + BOOL busy; + } DOS_FILE_DESC; + +typedef DOS_FILE_DESC * DOS_FILE_DESC_ID; + +/* + * FAT handler descriptor. + * This structure defines generic FAT handler API. + * It must be start field in every FAT handler + * descriptor structure. + */ +typedef struct DOS_FAT_DESC + { + /* interface functions */ + + STATUS (*getNext)( DOS_FILE_DESC_ID pFd, u_int allocatePolicy ); + /* get/allocate next cluster for file */ + /* : FAT_NOT_ALLOC/FAT_ALLOC/ */ + /* FAT_ALLOC_ONE */ + STATUS (*contigChk)( DOS_FILE_DESC_ID pFd ); + /* check file chain for contiguity */ + STATUS (*truncate)( DOS_FILE_DESC_ID pFd, uint32_t sector, + uint32_t flag ); + /* truncate chain starting from , */ + /* = FH_FILE_START - from file start; */ + /* : FH_INCLUDE/FH_EXCLUDE */ + STATUS (*seek)( DOS_FILE_DESC_ID pFd, uint32_t startSec, uint32_t nSec ); + /* seek sectors starting from */ + /* , */ + /* = FH_FILE_START - from file start */ + fsize_t (*nFree)( DOS_FILE_DESC_ID pFd ); + /* free bytes on disk */ + STATUS (*contigAlloc)( DOS_FILE_DESC_ID pFd, uint32_t nSec ); + /* allocate contiguous first feet chain */ + size_t (*maxContig)( DOS_FILE_DESC_ID pFd ); + /* max free contiguous chain length in sectors */ + void (*volUnmount)( DOS_VOLUME_DESC_ID pVolDesc ); + /* free all resources, that were allocated */ + /* for the volume */ + void (*show)( DOS_VOLUME_DESC_ID pVolDesc ); + /* display handler specific data */ + STATUS (*flush)( DOS_FILE_DESC_ID pFd ); + /* flush all internal FAT handler data that */ + /* belongs to the file */ + void (*syncToggle)( DOS_VOLUME_DESC_ID pVolDesc, BOOL syncEnable ); + /* toggle FAT copies mirroring; synchronize */ + /* FAT copies, when mirror is being enabled */ + STATUS (*clustValueSet) + ( + DOS_FILE_DESC_ID pFd, + uint32_t fatCopyNum, /* FAT copy to use */ + uint32_t clustNum, /* cluster number to set */ + uint32_t value, /* DOS_FAT_AVAIL, DOS_FAT_EOF, */ + /* DOS_FAT_BAD, DOS_FAT_ALLOC, */ + /* DOS_FAT_INVAL, DOS_FAT_RESERV, */ + /* DOS_FAT_RAW */ + uint32_t nextClust /* next cluster number */ + ); + uint32_t (*clustValueGet) + ( + DOS_FILE_DESC_ID pFd, + uint32_t fatCopyNum, /* FAT copy to use */ + uint32_t clustNum, /* cluster number to check */ + uint32_t * pNextClust /* return cluster value */ + ); + + /* + * These are like clustValueSet and clustValueGet but at a much more + * "raw" level, dealing directly with the raw values and operating + * on any FAT entry, including FAT[0] and FAT[1]. Most users should + * use the fully-cooked clustValue functions. The "half baked" + * fatEntryRead/fatEntryWrite functions still verify cluster number + * while the fatRawRead and fatRawWrite functions do not -- and, + * important internally, do not take a DOS_FILE_DESC_ID. + */ + + uint32_t (*fatEntryRead) + ( + DOS_FILE_DESC_ID pFd, /* open file on volume */ + uint32_t copyNum, /* FAT copy to read */ + uint32_t entry /* FAT entry to read */ + ); + STATUS (*fatEntryWrite) + ( + DOS_FILE_DESC_ID pFd, /* open file on volume */ + uint32_t copyNum, /* FAT copy to write */ + uint32_t entry, /* FAT entry to write */ + uint32_t value /* value to write there */ + ); + + /* + * These are lower level, with NO CHECKING AND MASKING AT ALL. + * Use with great caution. Note that they need a DOS_VOLUME_DESC + * pointer, not a file descriptor, as they are used when there + * are no open files. In order to let the "slightly-more-cooked" + * routines use them, though, they also take a cookie pointer + * for cbio. + */ + STATUS (*rawEntryRead) + ( + DOS_VOLUME_DESC_ID pVolDesc, /* volume */ + cookie_t *pCookie, /* cbio cookie */ + uint32_t copyNum, /* copy to read */ + uint32_t entry, /* which FAT entry to read */ + uint32_t *result /* output from FAT[entry] stored here */ + ); + + STATUS (*rawEntryWrite) + ( + DOS_VOLUME_DESC_ID pVolDesc, /* volume */ + cookie_t *pCookie, /* cbio cookie */ + uint32_t copyNum, /* FAT copy to write */ + uint32_t entry, /* FAT entry to write */ + uint32_t value, /* value to write there */ + BOOL writeThrough /* set to force write-through */ + ); + + /* + * routines to access the underlying XBD. It may be a direct access, or + * through the dosFs disk cache. + */ + STATUS (*rawBytesRW) + ( + DOS_VOLUME_DESC_ID pVolDesc, /* volume descriptor */ + sector_t startBlock, /* starting block of the transfer */ + off_t offset, /* offset into block in bytes */ + addr_t buffer, /* address of data buffer */ + size_t nBytes, /* number of bytes to transfer */ + u_int operation /* DOS_READ/DOS_WRITE/WRITE_THROUGH */ + ); + + STATUS (*rawBlkCopy) + ( + DOS_VOLUME_DESC_ID pVolDesc, /* volume descriptor */ + sector_t srcBlock, + sector_t dstBlock, + sector_t numBlocks + ); + + STATUS (*rawIoctl) + ( + DOS_VOLUME_DESC_ID pVolDesc, /* volume descriptor */ + UINT32 command, + addr_t arg + ); + + /* read-only (unchanging) data */ + + uint32_t cleanBitMask; /* clean shutdown bit, 0 for FAT12 */ + + /* varying data -- should not be in this data structure (!) */ + + uint8_t activeCopyNum; /* number of active FAT copy */ + } DOS_FAT_DESC; + +typedef DOS_FAT_DESC * DOS_FAT_DESC_ID; + +/* + * "Secret" third argument passed from chkdsk into internal readDir + * operations. The chkdsk code tells us whether to repair bad file + * names, and we tell it how many bad names were encountered (and + * repaired if "repair" is TRUE). We also fill in a file descriptor + * with info about the file, since it is right there in the dir. + * + * (Thus, repair is an input, badNames is an output, and *pFd is an + * output.) + */ +typedef struct CHK_DSK_READDIR_EXTRA + { + BOOL repair; /* flag: fix/remove bad names */ + int badNames; /* count of bad-names encountered */ + DOS_FILE_DESC_ID pFd; /* file descriptor for just-read file */ + } CHK_DSK_READDIR_EXTRA; + +/* + * Directory handler descriptor. + * This structure defines generic directory handler API. + * It must be start field in every directory handler + * descriptor structure. + */ +typedef struct DOS_DIR_DESC + { + STATUS (*pathLkup)( DOS_FILE_DESC_ID pFd, void * pPath, + u_int fflags, u_int fmode ); + /* lkup path file in directory hierarchy tree */ + STATUS (*readDir)( DOS_FILE_DESC_ID pFd, DIR * pDir, + CHK_DSK_READDIR_EXTRA * pExtra ); + /* regular readdir; if not NULL, is */ + /* extra information for chkdsk. */ + /* on return dd_cookie> should contain */ + /* POS_TO_DD_COOKIE( pFd->pos ) */ + STATUS (*updateEntry)( DOS_FILE_DESC_ID pFd, u_int flags, + time_t curTime ); + /* set directory entry values; */ + /* size, start cluster, attributes and so on */ + /* are delivered from file descriptor */ + /* can be or-ed of */ + /* DH_TIME_CREAT, DH_TIME_MODIFY, DH_TIME_ACCESS */ + /* to encode value into correspondence */ + /* field or DH_DELETE for to delete the entry */ + STATUS (*dateGet)( DOS_FILE_DESC_ID pFd, struct stat * pStat ); + /* fill in date-time fields in stat structure */ + STATUS (*volLabel)( DOS_VOLUME_DESC_ID pVolDesc, u_char * label, + u_int operation ); + /* get/set volume label */ + /* is one of FIOLABELGET/FIOLABELSET */ + STATUS (*nameChk)( DOS_VOLUME_DESC_ID pVolDesc, u_char * name ); + /* validate name (intended to check disk) */ + void (*volUnmount)( DOS_VOLUME_DESC_ID pVolDesc ); + /* free all resources, that were allocated */ + /* for the volume */ + void (*show)( DOS_VOLUME_DESC_ID pVolDesc ); + /* display handler specific data */ + + /* + * routines to access the underlying XBD. It may be a direct access, or + * through the dosFs disk cache. + */ + STATUS (*rawBytesRW) + ( + DOS_VOLUME_DESC_ID pVolDesc, /* volume descriptor */ + sector_t startBlock, /* starting block of the transfer */ + off_t offset, /* offset into block in bytes */ + addr_t buffer, /* address of data buffer */ + size_t nBytes, /* number of bytes to transfer */ + u_int operation /* DOS_READ/DOS_WRITE/WRITE_THROUGH */ + ); + + STATUS (*rawIoctl) + ( + DOS_VOLUME_DESC_ID pVolDesc, /* volume descriptor */ + UINT32 command, + addr_t arg + ); + + u_int rootStartSec; /* root directory start sector: */ + /* some value for FAT12/FAT16; */ + /* 0 for FAT32; is filled by dir handler */ + u_int rootNSec; /* sectors per root directory */ + /* some value for FAT12/FAT16; */ + /* 0 for FAT32; is filled by dir handler */ + } DOS_DIR_DESC; + +typedef DOS_DIR_DESC * DOS_DIR_DESC_ID; + +/* check disk work structure */ + +typedef struct CHK_DSK_DESC + { + UINT32 * chkFatMap; /* clusters usage map */ + DIR chkDir; /* readdir buffer */ + fsize_t chkTotalFSize; /* total bytes in all files */ + fsize_t chkTotalBytesInLostChains; + u_int nErrors; /* total number of errors detected */ + UINT32 chkNDirs; /* total directories */ + UINT32 chkNFiles; /* total files */ + UINT32 chkNLostChains; /* total lost chains */ + UINT32 chkNFreeClusts; /* total # of free clusters */ + UINT32 chkNBadClusts; /* total # of bad clusters */ + time_t chkMaxCreatTime; + time_t chkMaxModifTime; + time_t chkMaxAccTime; + BOOL bufToDisk; /* FAT copy used as tmp buffer */ + struct stat stat; /* buffer to accept file statistics */ + u_char chkPath[ CHK_MAX_PATH ]; /* buffer for path strings */ + u_char curPathLev; /* dynamic counter of path levels */ + char chkCurPath[ CHK_MAX_PATH + 256 ]; + } CHK_DSK_DESC; + +typedef CHK_DSK_DESC * CHK_DSK_DESC_ID; + +typedef enum dos_rw /* DOS_RW direction enum */ + { + DOS_READ = 0, /* read */ + DOS_WRITE = 1, /* copy back write */ + DOS_WRITE_THROUGH = 2 /* write through write */ + } DOS_RW; + +typedef struct dosCacheDesc + { + DL_NODE lruNode; + sector_t block; + caddr_t data; + struct dosCacheDesc * pHashNext; + BOOL isDirty; + } DOS_CACHE_DESC; + +typedef struct DOS_BIO + { + struct bio bio; + SEM_ID syncSemId; /* semId to pend for RW completion */ + UINT16 bioIndex; /* Index of this DOS_BIO in the volume's + * dosBio array */ + UINT16 nextFreeBioIndex; /* index of the next available DOS_BIO + * in the volume's dosBio array */ + } DOS_BIO; + +/* Volume descriptor */ + +typedef struct DOS_VOLUME_DESC + { + DEV_HDR devHdr; /* i/o system device header */ + u_int magic; /* control magic number */ + /* DOS_FS_MAGIC */ + BOOL mounted; /* volume mounted */ + device_t device; /* underlying device handle */ + DOS_DIR_DESC_ID pDirDesc; /* directory handler descriptor ptr */ + DOS_FAT_DESC_ID pFatDesc; /* FAT handler descriptor ptr */ + SEM_ID devSem; /* device mutual semaphore, */ + SEM_ID shortSem; /* protect very short operations, */ + /* such as allocation of file */ + /* descriptor */ + DOS_FILE_DESC_ID pFdList; /* file descriptors array */ + DOS_FILE_HDL_ID pFhdlList; /* file handles array */ + SEM_ID * pFsemList; /* file semaphores array */ + + /* -- boot sector data -- */ + + u_int bootSecNum; /* number of sector containing boot */ + /* information */ + UINT32 volId; /* volume Id */ + UINT32 secPerFat; /* sectors per FAT copy */ + UINT32 nHiddenSecs; /* hiden sectors (unused tail) */ + UINT32 totalSec; /* total number of sectors */ + UINT16 bytesPerSec; + UINT16 secPerClust; + UINT16 nReservedSecs; /* reserved sectors (ahead first fat copy) */ + UINT8 nFats; /* number of FAT copies */ + UINT32 nFatEnts; /* number of entries in FAT */ + char bootVolLab[ DOS_VOL_LABEL_LEN + 1 ]; /* volume label */ + /* -- -- */ + + enum { FAT12, FAT16, FAT32 } fatType; + + u_int dataStartSec; /* sector number of the start */ + /* cluster (DOS_MIN_CLUCT) */ + u_short maxFiles; /* maximum open files in a time */ + u_short nBusyFd; /* number of fd-s in use */ + u_short volIdOff; /* offset of volume Id field */ + /* in boot sector */ + u_short volLabOff; /* offset of volume label field */ + /* in boot sector */ + u_char secSizeShift; /* log2( bytesPerSect ) */ + + /* check disk fields */ + + CHK_DSK_DESC_ID pChkDesc; + u_char autoChk; /* autocheck on mount level */ + u_char autoChkVerb; /* autocheck verbosity */ + u_char chkFlags; /* check disk flags */ + u_char chkVerbLevel; /* check disk verbosity level */ + + FUNCPTR fatVolMount; /* XXX not used?? */ + + /* these fields should probably be combined into generic "flags" word */ + + BOOL updateLastAccessDate; /* SPR#68203 */ + BOOL volIsCaseSens; /* Make SPR#29751 fix switchable */ + UINT32 volWriteOpt; /* 0 = copyback + * DOS_WRITE_THROUGH_FAT + * DOS_WRITE_THROUGH_DIR + * DOS_WRITE_THROUGH_USR + * DOS_WRITE_THROUGH_ALL + */ + + BOOL volUnicode; /* use Unicode (UTF-16) file names */ + BOOL volWarned16; /* flag once about UTF-16 high bytes */ + + void (*mountActivate) /* final callback to "activate" mount */ + ( + struct DOS_VOLUME_DESC * + ); + + STATUS (*dataBytesRW) + ( + DOS_VOLUME_DESC_ID pVolDesc, /* volume descriptor */ + sector_t startBlock, /* starting block of the transfer */ + off_t offset, /* offset into block in bytes */ + addr_t buffer, /* address of data buffer */ + size_t nBytes, /* number of bytes to transfer */ + u_int operation /* DOS_READ/DOS_WRITE/WRITE_THROUGH */ + ); + + STATUS (*dataBlkWrite) + ( + DOS_VOLUME_DESC_ID pVolDesc, /* volume descriptor */ + sector_t startBlock, /* starting block of write */ + sector_t numBlocks, /* number of blocks to write */ + addr_t buffer, /* address of the memory buffer */ + DOS_RW operation /* DOS_WRITE/DOS_WRITE_THROUGH */ + ); + + STATUS (*dataBlkRead) + ( + DOS_VOLUME_DESC_ID pVolDesc, /* volume descriptor */ + sector_t startBlock, /* starting block to read */ + sector_t numBlocks, /* number of blocks to read */ + addr_t buffer /* address of the memory buffer */ + ); + + STATUS (*dataIoctl) + ( + DOS_VOLUME_DESC_ID pVolDesc, + UINT32 command, + addr_t arg + ); + + /* cache management */ + + size_t volCacheSize; + caddr_t volCacheBase; + DL_LIST lruList; + DL_LIST dirtyList; + DOS_CACHE_DESC ** pDosHashTable; + u_int volHashTblSize; + u_int volCacheBypass; /* bypass limit */ + BOOL volCacheAlloc; /* was cache allocated dinamically? */ + DOS_BIO volCacheBio; /* used for large transfers */ + u_int volCacheBioSize; /* size of burst bio in blocks */ + u_int volCacheOptions; /* Is media DMA capable? */ + u_int volCacheReadAhead; + + /* cache statistics */ + + u_int volNumCacheBlocks; + u_long volCacheHits; + u_long volCacheMisses; + + /* fields for managing the tiny cache used during byte RW */ + + SEM_ID volMemSemId; + caddr_t volMemBase; + size_t volMemSize; + sector_t volMemBlkNo; + BOOL volMemDirty; + + /* Bio management */ + + sector_t nBlocks; /* underlying XBD device num of blocks */ + unsigned blockSize; /* underlying XBD device block size */ + SEM_ID volBioCount; /* counting semaphore for getting bios */ + SEM_ID volBioLock; /* for mutual exclusion accessing this + * volume bio array */ + UINT16 nextFreeBio; + DOS_BIO dosBioArray [DOS_VOLUME_BIO_SIZE]; /* may be of variable size + * in the near future XXX */ + } DOS_VOLUME_DESC; + +typedef struct DOS_HDLR_DESC + { + u_int id; /* unique handler Id */ + /* 0 - 256 reserved by implementation */ + STATUS (*mountRtn)( DOS_VOLUME_DESC_ID pVolDesc, void * arg ); + void * arg; /* handler dependent argument */ + } DOS_HDLR_DESC; + +typedef DOS_HDLR_DESC * DOS_HDLR_DESC_ID; + + + +/* function pointer to chk handler */ +/* check disk routine */ +IMPORT STATUS (*dosFsChkRtn)( DOS_FILE_DESC_ID pFd ); + +/* handler lists for fat and dir handlers */ +IMPORT DOS_HDLR_DESC dosFatHdlrsList[]; +IMPORT DOS_HDLR_DESC dosDirHdlrsList[]; + +/* forward declarations */ + +IMPORT STATUS dosFsHdlrInstall( DOS_HDLR_DESC_ID hdlrsList, + DOS_HDLR_DESC_ID hdlr ); + +IMPORT int dosFsVolIsFat12 (u_char * pBootBuf); /* pick fat12 or fat16 */ + +IMPORT STATUS dosFsXbdBlkWrite (DOS_VOLUME_DESC * pVolDesc, sector_t startBlock, + sector_t numBlocks, addr_t buffer, + DOS_RW operation); +IMPORT STATUS dosFsXbdBlkRead (DOS_VOLUME_DESC * pVolDesc, sector_t startBlock, + sector_t numBlocks, addr_t buffer); +IMPORT STATUS dosFsXbdBlkCopy (DOS_VOLUME_DESC * pVolDesc, sector_t srcBlock, + sector_t dstBlock, sector_t numBlocks); +IMPORT STATUS dosFsXbdBytesRW (DOS_VOLUME_DESC * pVolDesc, sector_t startBlock, + off_t offset, addr_t buffer, size_t nBytes, + u_int operation); +IMPORT STATUS dosFsXbdIoctl (DOS_VOLUME_DESC * pVolDesc, UINT32 command, + addr_t arg); + +#ifdef __cplusplus + } +#endif + +#endif /* __INCdoFsLibP */ + diff --git a/h/private/dosFsVerP.h b/h/private/dosFsVerP.h new file mode 100644 index 0000000..77a681c --- /dev/null +++ b/h/private/dosFsVerP.h @@ -0,0 +1,60 @@ +/* dosFsVerP.h - dosFs2 vxWorks version header file */ + +/* Copyright 2001-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,21dec03,jkf moving define of _WRS_DOSFS2_VXWORKS_AE to dosFsVerP.h +01a,20sep01,jkf written - SPR#69031, common code for both AE & 5.x. +*/ + +#ifndef __INCdosFsVerPh +#define __INCdosFsVerPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* This WRS private header file is subject to change by WRS without notice. */ + +/* include's */ + +#include "vxWorks.h" + +/* XXX temporary workaround for Base6 */ +#define _WRS_DOSFS2_VXWORKS_AE + +#ifndef _WRS_VXWORKS_5_X +# define _WRS_DOSFS2_VXWORKS_AE /* define to build for VxWorks AE */ +#endif /* !_WRS_VXWORKS_5_X */ + + +#ifdef _WRS_DOSFS2_VXWORKS_AE + +# include "memPartLib.h" + +/* XXX temporary workaround for Base6 */ +/* # include "pdLib.h" */ + +# include "private/handleLibP.h" /* for VxWorks AE, use HANDLE */ + +# ifndef KHEAP_REALLOC +# define KHEAP_REALLOC(pBuf,newsize) \ + memPartRealloc(memPartIdKernel,pBuf,newsize) +# endif /* KHEAP_REALLOC */ + +#else /* _WRS_DOSFS2_VXWORKS_AE */ + +# include "memPartLib.h" +# include "classLib.h" /* for VxWorks 5.x, use OBJ_CORE */ +# include "objLib.h" +# include "private/objLibP.h" + +#endif /* DOSFS2_VXWORKS_AE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdosFsVerPh */ diff --git a/h/private/edrLibP.h b/h/private/edrLibP.h new file mode 100644 index 0000000..1a86ed1 --- /dev/null +++ b/h/private/edrLibP.h @@ -0,0 +1,77 @@ +/* edrLibP.h - private ED&R library header file */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,17sep04,md added DSM hook +01c,20apr04,md moved private info from edrLib.h +01b,12mar04,zl renamed EDR_TASK_INFO to EDR_TCB_INFO. +01a,10feb04,zl created +*/ + +#ifndef __INCedrLibPh +#define __INCedrLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "edrLib.h" +#include "avlUintLib.h" + +/* definitions */ + +/* number of bytes to save for a code snapshot */ + +#define EDR_CODE_FRAG_SIZE 16 + +/* typedefs */ + +#ifndef _ASMLANGUAGE + +/* hook-function type for private DSM error injection hook. */ + +typedef void (*EDR_ERRINJ_DSM_HOOK_FUNCPTR) ( + EDR_ERROR_RECORD *pER, /* pointer to error record */ + int kind, /* severity | facility */ + const char *fileName, /* name of source file */ + int lineNumber, /* line number of source code */ + void *address, /* faulting address */ + const char *msg /* additional text string */ + ); + +/* structure for task-local data, accessed with the pEdrInfo field of the TCB */ + +typedef struct edr_tcb_info + { + AVLU_TREE memEdrLocals; /* local variables */ + UINT memEdrCtrl; /* control of memEdrLib features */ + } EDR_TCB_INFO; + + +/* buffer structure used by printToEDRbuf() for oprintf output */ + +typedef struct { + char *buf; /* pointer to buffer */ + int size; /* size of buffer */ +} EDR_PRINTF_BUFFER; + + +/* buffered output routines */ + +extern STATUS printToEDRbuf (char *, int , EDR_PRINTF_BUFFER *); + +/* DSM Hook */ + +extern EDR_ERRINJ_DSM_HOOK_FUNCPTR edrErrorInjectDsmHook; + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCedrLibPh */ diff --git a/h/private/eventLibP.h b/h/private/eventLibP.h new file mode 100644 index 0000000..534d7e8 --- /dev/null +++ b/h/private/eventLibP.h @@ -0,0 +1,131 @@ +/* eventLibP.h - private VxWorks events library header file */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,10jan05,job Added EVENT_RTP_DELETE_STATE event definition (SPR#105375) +01i,02sep04,ans Added JOB_TASK_DONE_EVENT event definition +01h,27may04,job Added EVENT_RTP_NORMAL_STATE event definition. +01g,15jul03,kam merging from TOR2_2-CP1-F label +01f,04jun03,bwa Added '#include "eventLib.h'. +01e,20jan03,bwa Added EVENTS_SYSFLAGS_DEL_RSRC definition. +01d,15jan02,bwa Created list of events reserved for system use. +01c,06nov01,aeg added eventRsrcShow() and eventTaskShow() prototypes. +01b,17oct01,bwa Added eventRsrcSend() prototype. +01a,20sep01,bwa Created +*/ + +#ifndef __INCeventLibPh +#define __INCeventLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE +#include "vxWorks.h" +#include "eventLib.h" + +#if CPU_FAMILY==I960 +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +extern VOIDFUNCPTR eventEvtRtn; /* windview - level 1 event logging */ + +/* event structure needed in TCB */ + +typedef struct eventsCb + { + UINT32 wanted; /* 0x00: events wanted */ + volatile UINT32 received; /* 0x04: all events received */ + UINT8 options; /* 0x08: user options */ + UINT8 sysflags; /* 0x09: flags used by internal code only */ + UINT8 pad[2]; /* 0x0a: alignment on 32bit, possible extension */ + } EVENTS; /* 0x0c: total size */ + +/* EVENTS.options masks */ + +#define EVENTS_WAIT_MASK 0x01 + +/* EVENTS system flags */ + +#define EVENTS_SYSFLAGS_WAITING 0x01 /* task is waiting for events */ +#define EVENTS_SYSFLAGS_DEL_RSRC 0x02 /* task is deleting rsrc on */ + /* which it is registered */ +#define EVENTS_SYSFLAGS_UNUSED 0xfc /* unused, for future extension */ + +/* event structure needed in resource (semaphores, msg queues) structures */ + +typedef struct eventsResourceCb + { + UINT32 registered; /* 0x00: events registered for that resource */ + int taskId; /* 0x04: task registered for that resource */ + UINT8 options; /* 0x08: user options */ + UINT8 pad[3]; /* 0x09: alignment on 32bit, possible extension */ + } EVENTS_RSRC; /* 0x0c: total size */ + +#if CPU_FAMILY==I960 +#pragma align 0 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* These events are for system use only. */ + +#define VXEV25 0x01000000 +#define VXEV26 0x02000000 +#define VXEV27 0x04000000 +#define VXEV28 0x08000000 +#define VXEV29 0x10000000 +#define VXEV30 0x20000000 +#define VXEV31 0x40000000 +#define VXEV32 0x80000000 + +#define EVENT_RTP_NORMAL_STATE VXEV25 /* RTP -> NORMAL state event */ +#define EVENT_RTP_DELETE_STATE VXEV26 /* RTP -> DELETE state event */ +#define JOB_TASK_DONE_EVENT VXEV27 /* client <-> tJobTask */ + +#define VXEV_RESERVED 0xff000000 + +#if defined(__STDC__) || defined(__cplusplus) + +extern void eventLibInit (void); +extern void eventInit (EVENTS_RSRC * pEvRsrc); +extern void eventTerminate (const EVENTS_RSRC * pEvRsrc); +extern void semEvLibInit (void); +extern void msgQEvLibInit (void); +extern STATUS eventStart (OBJ_ID objId, EVENTS_RSRC * pEvRsrc, + FUNCPTR isRsrcFree, UINT32 events, + UINT8 options); +extern STATUS eventRsrcSend (int taskId, UINT32 events); +extern STATUS eventRsrcShow (EVENTS_RSRC * pEvRsrc); +extern STATUS eventTaskShow (EVENTS * pEvents); + +#else /* __STDC__ */ + +extern void eventLibInit (); +extern void eventInit (); +extern void eventTerminate (); +extern void semEvLibInit (); +extern void msgQEvLibInit (); +extern STATUS eventStart (); +extern STATUS eventRsrcSend (); +extern STATUS eventRsrcShow (); +extern STATUS eventTaskShow (); + +#endif /* __STDC */ + +#else /* _ASMLANGUAGE */ + +#define EVENTS_RSRC_REGISTERED 0x0 +#define EVENTS_RSRC_TASKID 0x4 +#define EVENTS_RSRC_OPTIONS 0x8 + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCeventLibPh */ + diff --git a/h/private/eventP.h b/h/private/eventP.h new file mode 100644 index 0000000..835ef9e --- /dev/null +++ b/h/private/eventP.h @@ -0,0 +1,2621 @@ +/* eventP.h - event log header */ + +/* + * Copyright (c) 1994-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +03p,14jun05,tcr add events for ioLib +03o,23feb05,tcr update comments for apigen +03n,17sep04,tcr add sdLib events +03m,03aug04,pch Add PPC_WD_INT_ID for ppc4xx/ppc85xx hardware watchdog timer +03w,06oct04,pch renumbered history +03v,17sep04,tcr add sdLib events +03u,03aug04,pch Add PPC_WD_INT_ID for ppc4xx/ppc85xx hardware watchdog timer +03t,04may04,ymz modified SAL event ID to resolve clashes. +03r,28apr04,ymz added SAL event ID and macro. +03r,26apr04,tcr include code review comments for rtpSigLib.c +03q,15apr04,tcr add macros and events for rtpLib +03p,18mar04,tcr add RTP signal events +03o,25mar04,cpd Re-add a State Change event +03n,04mar04,aim renumbered EVENT_EDR_ERROR_INJECT to CLASS3(80) +03m,18feb04,tcr add events for rtpLib +03l,24nov03,tcr update EVENT_MEMREALLOC +03k,17nov03,tcr add OBJ_VERIFY fail handling +03j,03nov03,tcr add syscall events; add rtp to EVENT_TASKNAME; + validate objects in macros +03i,25sep03,tcr always preserve tasknames +03h,16sep03,tcr add events for isrLib +03g,09sep03,tcr changes to event formats, change class instrumentation +03f,08sep03,tcr change event formats +03e,05sep03,tcr fix merge error +03d,05sep03,tcr fix merge error +03c,02sep03,tcr Base6 changes for obj instrumentation +03b,04dec03,aim updated EVT_EDR +03a,04aug03,elg Add support for new task status: define events related to new + status for instrumentation. +02z,19sep03,aim added ED&R events +02y,13may03,pes PAL conditional compilation cleanup. Phase 2. +02x,04jun03,bwa Added macros for message channels and services. +02w,09may03,to changed OBJ_ID to OBJ_CORE * in OBJ_EVT_RTN and TASK_EVT_RTN, + deleted condition code for OBJ_INST_RTN. +02v,09may02,tcr Fix for SPR 74987 (add #ifdef __cplusplus) +02u,31oct01,tcr add event range for RTI +02t,18oct01,tcr add support for VxWorks Events, move to VxWorks 5.5 +02s,27sep01,tcr Fix SPR 24971 - instrument PPC interrupts +02r,13sep01,tcr Fix SPR 29673 - macro for msgQSmLib events +02q,09sep98,cjtc reverting to byte ordering based on _BYTE_ORDER macro +02p,04sep98,cjtc porting for ARM architechture +02o,02sep98,nps corrected WV2.0 -> T2 merge. +02n,24aug98,cjtc intEnt logging for PPC is now performed in a single step + instead of the two-stage approach which gave problems with + out-of-order timestamps in the event log (SPR 21868) +02m,17aug98,pr replaced OBJ_VERIFY check with check on NULL pointer +02l,08may98,pr added number of params for EVT_OBJ_SIG macro +02k,08may98,pr added argument for wv logging in SIG and SM_MSGQ macros +02j,15apr98,cth added event class WV_CLASS_TASKNAMES_PRESERVE/ON, and call to + _func_evtLogReserveTaskName +02i,08apr98,pr reordered the definition of EVENT_SEMFLUSH and EVENT_SEMDELETE +02h,07apr98,cjtc added () to EVENT_INT_ENT to prevent problem with macro + expansion. +02g,22mar98,pr modified EVT_CTX_BUF to accept TRG_USER_INDEX events. + modified definition of EVENT_SEMFLUSH and EVENT_SEMDELETE. +02f,04mar98,nps modified xxx_CLASS_n_ON macros so they can be used by + inadequate assmblers. +02e,17feb98,pr added number of params to EVT_OBJ macros. +02d,17feb98,dvs added events for memory instrumentation. (pr) +02c,27jan98,cth removed EVENT_BUFFER, CONFIG, BEGIN, END _SIZE definitions, + updated copyright +02b,22jan98,pr made some macros readable also by the assembly. + added extra bit to evtAction. + added EVT_CTX_IDLE, EVT_CTX_NODISP macros. +02a,12jan98,dbs added EVENT_NIL and EVENT_VALUE to pseudo-events. +01z,13dec97,pr reduced the number of args passed to _func_trgCheck + moved some extern declaration in funcBindP.h +01y,20nov97,pr added some event triggering defines and modified event + logging macros +01x,17nov97,cth added EVENT_CONFIG_SIZE, _BEGIN_SIZE, _END_SIZE, _BUFFER_SIZE +01w,27oct97,pr redefined levels as classes. + redesigned all the macros for managing classes. +01v,28aug97,pr modified WV_OFF to reflect new levels. +01u,26aug97,pr replaced WV_IS_ON with proper LEVEL +01t,18aug97,pr added trigger calls. +01s,24jun97,pr Added declarations for WindView 2.0 variables + modified macros to include new variable and triggers +01r,11Apr96,pr changed if statement in EVT_OBJ_SM_MSGQ, SPR #6048, #6271 +01q,22feb95,rdc added EVENT_TASK_STATECHANGE. +01p,01feb95,rdc added EVENT_TIMER_SYNC. +01o,27jan95,rdc added processor number to EVENT_CONFIG. +01n,28nov94,rdc changed 32 bit store macros for x86. +01m,02nov94,rdc added protocol revision to EVENT_CONFIG. + added lockCnt param to EVT_CTX_TASKINFO. +01l,02nov94,rdc added 960 macros. +01k,27may94,pad added alignment macros. Corrected some parameter comments. +01j,14apr94,smb optimised EVT_OBJ_ macros. +01i,04mar94,smb added EVENT_INT_EXIT_K + changed parameters for EVENT_WIND_EXIT_NODISPATCH + removed EVENT_WIND_EXIT_IDLENOT + level 1 event optimisations + added macro for shared memory objects +01h,22feb94,smb changed typedef EVENT_TYPE to event_t (SPR #3064) +01g,16feb94,smb introduced new OBJ_ macros, SPR #2982 +01f,26jan94,smb redid pseudo events - generated host side +01e,24jan94,smb added EVENT_WIND_EXIT_DISPATCH_PI and + EVENT_WIND_EXIT_NODISPATCH_PI + added event logging macros +01d,17dec93,smb changed typedef of EVENT_TYPE +01c,10dec93,smb modified MAX_LEVEL3_ID to include interrupt events + renamed EVENT_CLOCK_CONFIG to EVENT_CONFIG +01b,08dec93,kdl added include of classLibP.h; made def of OBJ_INST_FUNC + +smb conditional on OBJ_INST_RTN; reformatted macro comments; + made includes and obj macros depend on CPU (i.e. not host). +01a,07dec93,smb written. +*/ + +#ifndef __INCeventph +#define __INCeventph + +#ifdef __cplusplus +extern "C" { +#endif + +/* This file contains all windview event identifiers */ + +/* Triggering and Windview events definitions and macros. + * They correspond to the old levels and are the only classes we + * identify for the moment. They are also used by the architecture + * dependent files, therefore are defined also for assembly languages. + */ + +#ifdef CPU /* only for target, not host */ + +/* this is used by both WV and TRG */ + +#define CLASS_NONE 0x00000000 + +#define WV_CLASS_1 0x00000001 /* Context Switch */ +#define WV_CLASS_2 0x00000003 /* Task State Transition */ +#define WV_CLASS_3 0x00000007 /* Object and System Libraries */ +#define WV_CLASS_TASKNAMES_PRESERVE 0x00001000 +#define WV_ON 0x10000000 +#define WV_CLASS_1_ON 0x10000001 +#define WV_CLASS_2_ON 0x10000003 +#define WV_CLASS_3_ON 0x10000007 +#define WV_CLASS_TASKNAMES_PRESERVE_ON 0x10001000 + +#define TRG_CLASS_1 0x00000001 +#define TRG_CLASS_2 0x00000010 +#define TRG_CLASS_3 0x00000100 +#define TRG_CLASS_4 0x00001000 +#define TRG_CLASS_5 0x00010000 +#define TRG_CLASS_6 0x01111111 +#define TRG_ON 0x10000000 +#define TRG_CLASS_1_ON 0x10000001 +#define TRG_CLASS_2_ON 0x10000010 +#define TRG_CLASS_3_ON 0x10000100 +#define TRG_CLASS_4_ON 0x10001000 +#define TRG_CLASS_5_ON 0x10010000 +#define TRG_CLASS_6_ON 0x11111111 + +#define TRG_CLASS1_INDEX 0 +#define TRG_CLASS2_INDEX 1 +#define TRG_CLASS3_INDEX 2 +#define TRG_USER_INDEX 3 +#define TRG_INT_ENT_INDEX 4 +#define TRG_ANY_EVENT_INDEX 5 +#define TRG_CONTROL_INDEX 6 + +#endif /* CPU */ + +/* types */ + +#ifndef _ASMLANGUAGE + +typedef unsigned short event_t; + +#ifdef CPU /* only for target, not host */ + +#include "private/funcBindP.h" +#include "private/classLibP.h" +#include "private/objLibP.h" + + +/* + * All logging macros use this test to minimize overhead when logging is + * disabled + */ + +#define ACTION_IS_SET (evtAction != 0) + +#define TRG_ACTION_SET \ + { \ + evtAction |= 0x0001; \ + TRG_EVTCLASS_SET(TRG_ON); \ + } + +#define TRG_ACTION_UNSET \ + { \ + TRG_EVTCLASS_UNSET(TRG_ON); \ + evtAction &= ~(0x0001); \ + } + +#define TRG_ACTION_IS_SET ( (evtAction&0x00ff) == 0x0001) + +#define WV_ACTION_SET \ + { \ + evtAction |= 0x0100; \ + WV_EVTCLASS_SET(WV_ON); \ + } + +#define WV_ACTION_UNSET \ + { \ + WV_EVTCLASS_UNSET(WV_ON); \ + evtAction &= ~(0x0100); \ + } + +#define WV_ACTION_IS_SET ( (evtAction&0xff00) == 0x0100) + +#define WV_EVTCLASS_IS_SET(class) ( (wvEvtClass&(class)) == (class)) +#define WV_EVTCLASS_SET(class) (wvEvtClass |= (class)) +#define WV_EVTCLASS_UNSET(class) (wvEvtClass &= ~(class)) +#define WV_EVTCLASS_EMPTY (wvEvtClass = CLASS_NONE) + +#define TRG_EVTCLASS_IS_SET(class) ((trgEvtClass&(class)) == (class)) + +#define TRG_EVTCLASS_SET(class) (trgEvtClass |= (class)) +#define TRG_EVTCLASS_UNSET(class) (trgEvtClass &= ~(class)) +#define TRG_EVTCLASS_EMPTY (trgEvtClass = CLASS_NONE) +#define TRG_EVTCLASS_IS_EMPTY (trgEvtClass == CLASS_NONE) + +/* +* +* OBJ_EVT_RTN - get instrumentation routine for an object +* +* RETURNS: instrumentation routine pointer from object class +*/ + +#define OBJ_EVT_RTN(objId) \ + (((OBJ_CORE *)(objId))->pObjClass)->instRtn + +#define TASK_EVT_RTN(tId) \ + ((WIND_TCB *)(tId))->objCore.pObjClass->instRtn + +#define OBJ_INSTRUMENTED(objId) \ + ((((OBJ_CORE *)(objId))->handle.attributes) & WIND_OBJ_INSTRUMENTED) + +/* event logging macros */ + +/* +* +* OBJ_INST_FUNC - check if object is instrumented +* +* RETURNS: true if object is valid, and instrumented +*/ + +#define OBJ_INST_FUNC(objId, objClass) \ + ((OBJ_VERIFY(objId,objClass) == OK) && (OBJ_INSTRUMENTED(objId))) + +/* +* +* OBJ_VALID_WV_ASSERT - check if object is valid, and emit windview event if not +* +* This macro tests whether an object is instrumented. If it is, an OBJ_VERIFY() +* test is done, and a windview event emitted if it fails the test +* +* Action is like this: +* +* if (OBJ_INSTRUMENTED (objId)) +* { +* if (OBJ_VERIFY (objId, classId) == OK) +* return (1); (instrumented and verified) +* else +* { +* eventLog (EVENT_OBJ_VERIFY_FAIL); +* return (0); (instrumented, not verified) +* } +* } +* else +* return (0); (not instrumented) +* +* RETURNS: true (non-zero) if obj is valid and instrumented, zero otherwise +* +*/ + +#define OBJ_VALID_WV_ASSERT(objId, objClass) \ + (OBJ_INSTRUMENTED (objId) ? \ + ((OBJ_VERIFY(objId,objClass) == OK) ? \ + 1 : \ + ((* _func_evtLogOIntLock)(EVENT_OBJ_VERIFY_FAIL, \ + 2, objId, objClass), \ + 0)) \ + : 0) + +/* +* +* TASK_INST_FUNC - check if task is instrumented +* +* RETURNS: instrumentation routine if instrumented, otherwise NULL +*/ + +#define TASK_INST_FUNC(tid) OBJ_INST_FUNC(objId, taskClassId) + + +/* +* +* EVT_CTX_0 - context switch event logging with event id +* +*/ + +#define EVT_CTX_0(evtId) \ + if (ACTION_IS_SET) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_1|WV_ON) ) \ + ( * _func_evtLogT0) (evtId); \ + if (TRG_EVTCLASS_IS_SET(TRG_CLASS_1|TRG_ON)) \ + ( * _func_trgCheck) (evtId, TRG_CLASS1_INDEX, NULL, NULL, \ + NULL, NULL, NULL, NULL); \ + } + + +/* +* +* EVT_CTX_1 - context switch event logging with one parameter +* +*/ + +#define EVT_CTX_1(evtId, arg) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_1|WV_ON) ) \ + ( * _func_evtLogT1) (evtId, arg); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_1|TRG_ON) ) \ + ( * _func_trgCheck) (evtId, TRG_CLASS1_INDEX, NULL, arg, \ + NULL, NULL, NULL, NULL); \ + } + + + +/* +* +* EVT_CTX_IDLE - log EVENT_WIND_EXIT_IDLE event +* +* This macro stores information into the event buffer if the system is idle. +* +*/ + +#define EVT_CTX_IDLE(evtId, arg1) \ + if ( ACTION_IS_SET && (Q_FIRST (arg1) == NULL)) \ + { \ + if (WV_EVTCLASS_IS_SET(WV_CLASS_1|WV_ON)) \ + (* _func_evtLogT0) (evtId); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_1|TRG_ON) ) \ + ( * _func_trgCheck) (evtId, TRG_CLASS1_INDEX, NULL, NULL, \ + NULL, NULL, NULL, NULL); \ + } + + +/* +* +* EVT_CTX_DISP - context switch event logging for reschedule +* +* This macro stores information into the event buffer about rescheduling tasks +* in the system. In order to determine the right event type, it first checks the +* two last args. It is used to log the DISPATCH event. Therefore the two last args +* are the current priority and the normal priority. +* +*/ + +#define EVT_CTX_DISP(evtId, arg1, arg2, arg3) \ + if ( ACTION_IS_SET ) \ + { \ + if (arg3 > arg2) \ + { \ + if (WV_EVTCLASS_IS_SET(WV_CLASS_1|WV_ON)) \ + (* _func_evtLogTSched) (EVENT_WIND_EXIT_DISPATCH_PI, arg1, \ + arg2); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_1|TRG_ON) ) \ + ( * _func_trgCheck) (EVENT_WIND_EXIT_DISPATCH_PI, \ + TRG_CLASS1_INDEX, NULL, arg1, arg2, \ + NULL, NULL, NULL); \ + } \ + else \ + { \ + if (WV_EVTCLASS_IS_SET(WV_CLASS_1|WV_ON)) \ + (* _func_evtLogTSched) (EVENT_WIND_EXIT_DISPATCH, arg1, \ + arg2); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_1|TRG_ON) ) \ + ( * _func_trgCheck) (EVENT_WIND_EXIT_DISPATCH, \ + TRG_CLASS1_INDEX, NULL, arg1, arg2, \ + NULL, NULL, NULL); \ + } \ + } + +/* +* +* EVT_CTX_NODISP - context switch event logging for reschedule +* +* This macro stores information into the event buffer about rescheduling tasks +* in the system. In order to determine the right event type, it first checks the +* two last args. It is used to log the NODISPATCH event. Therefore the two last +* args are the current priority and the normal priority. +* +*/ + +#define EVT_CTX_NODISP(arg1, arg2, arg3) \ + if (ACTION_IS_SET) \ + { \ + if (arg3 > arg2) \ + { \ + if (WV_EVTCLASS_IS_SET(WV_CLASS_1|WV_ON)) \ + (* _func_evtLogTSched) (EVENT_WIND_EXIT_NODISPATCH_PI, \ + arg1, arg2); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_1|TRG_ON) ) \ + ( * _func_trgCheck) (EVENT_WIND_EXIT_NODISPATCH_PI, \ + TRG_CLASS1_INDEX, NULL, arg1, arg2, \ + NULL, NULL, NULL); \ + } \ + else \ + { \ + if (WV_EVTCLASS_IS_SET(WV_CLASS_1|WV_ON)) \ + (* _func_evtLogTSched) (EVENT_WIND_EXIT_NODISPATCH, arg1, \ + arg2); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_1|TRG_ON) ) \ + ( * _func_trgCheck) (EVENT_WIND_EXIT_NODISPATCH, \ + TRG_CLASS1_INDEX, NULL, arg1, arg2, \ + NULL, NULL, NULL); \ + } \ + } + +/* +* +* EVT_CTX_TASKINFO - context switch event logging with task information +* +* This macro stores information into the event buffer about a task +* in the system. +* +*/ + +#define EVT_CTX_TASKINFO(evtId, state, pri, lockCnt, tid, entryPt, rtp, name) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_1|WV_ON) ) \ + { \ + ( * _func_evtLogString) (evtId, 6, state, pri, lockCnt, tid, \ + entryPt, rtp, name); \ + \ + if (_func_evtLogReserveTaskName != NULL) \ + (* _func_evtLogReserveTaskName) (tid, evtId, 6, \ + state, pri, lockCnt, tid, \ + entryPt, rtp, name); \ + } \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_1|TRG_ON) ) \ + ( * _func_trgCheck) (evtId, TRG_CLASS1_INDEX, NULL, state, \ + pri, lockCnt, tid, name); \ + } + + + +/* +* +* EVT_CTX_RTPINFO - context switch event logging with RTPinformation +* +* This macro stores information into the event buffer about an RTP +* in the system. +* +*/ + +#define EVT_CTX_RTPINFO(evtId, options, ownerId, rtpId, name) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_1|WV_ON) ) \ + { \ + ( * _func_evtLogString) (evtId, 3, options, ownerId, \ + rtpId, 0, 0, 0, name); \ + \ + if (_func_evtLogReserveTaskName != NULL) \ + (* _func_evtLogReserveTaskName) (rtpId, evtId, 3, \ + options, ownerId, \ + rtpId, 0, 0, 0, name); \ + } \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_1|TRG_ON) ) \ + ( * _func_trgCheck) (evtId, TRG_CLASS1_INDEX, NULL, \ + 0, 0, 0, 0); \ + } + +/* +* +* EVT_CTX_BUF - context switch event logging which logs a buffer, +* +* This macro stores eventpoint and user events into the event buffer. +* +*/ + +#define EVT_CTX_BUF(evtId, addr, bufSize, BufferAddr) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_1|WV_ON) ) \ + ( * _func_evtLogPoint) (evtId, addr, bufSize, BufferAddr); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_4|TRG_ON) ) \ + ( * _func_trgCheck) (evtId, TRG_USER_INDEX, NULL, addr, \ + bufSize, BufferAddr, NULL, NULL); \ + } + +/* +* +* EVT_TASK_0 - task state transition event logging with event id. +* +*/ + +#define EVT_TASK_0(evtId) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_2|WV_ON) ) \ + (* _func_evtLogM0) (evtId); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_2|TRG_ON) ) \ + ( * _func_trgCheck) (evtId, TRG_CLASS2_INDEX, NULL, NULL, \ + NULL, NULL, NULL, NULL); \ + } + +/* +* +* EVT_TASK_1 - task state transition event logging with one argument. +* +*/ + +#define EVT_TASK_1(evtId, arg) \ + do \ + { \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_2|WV_ON) ) \ + (* _func_evtLogM1) (evtId, arg); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_2|TRG_ON) ) \ + ( * _func_trgCheck) (evtId, TRG_CLASS2_INDEX, NULL, arg, \ + NULL, NULL, NULL, NULL); \ + } \ + } while (0) + + +/* +* +* EVT_TASK_2 - task state transition event logging with two arguments. +* +*/ + +#define EVT_TASK_2(evtId, arg1, arg2) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_2|WV_ON) ) \ + (* _func_evtLogM2) (evtId, arg1, arg2); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_2|TRG_ON) ) \ + ( * _func_trgCheck) (evtId, TRG_CLASS2_INDEX, NULL, arg1, \ + arg2, NULL, NULL, NULL); \ + } + +/* +* +* EVT_TASK_3 - task state transition event logging with three arguments. +* +*/ + +#define EVT_TASK_3(evtId, arg1, arg2, arg3) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_2|WV_ON) ) \ + (* _func_evtLogM3) (evtId, arg1, arg2, arg3); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_2|TRG_ON) ) \ + ( * _func_trgCheck) (evtId, TRG_CLASS2_INDEX, NULL, arg1, \ + arg2, arg3, NULL, NULL); \ + } + +/* +* +* EVT_SYSCALL_ENTRY - record syscall event with params +* +*/ + +#define EVT_SYSCALL_ENTRY(rtpId, nParams, pState) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + { \ + if (OBJ_INST_FUNC(rtpId, rtpClassId)) \ + (* _func_evtLogSyscall) \ + (nParams, pState); \ + } \ + /* TODO: Implement trigger test */ \ + } + +/* +* +* EVT_OBJ_6 - object status event logging with six arguments. +* +*/ + +#define EVT_OBJ_6(objId, classId, evtId, arg1, arg2, arg3, \ + arg4, arg5, arg6) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + { \ + if (OBJ_VALID_WV_ASSERT(objId, classId)) \ + if (OBJ_INST_FUNC(objId, classId)) \ + (* (OBJ_EVT_RTN(objId))) \ + (evtId, 6, arg1, arg2, arg3, arg4, arg5, arg6); \ + } \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) \ + (evtId, TRG_CLASS3_INDEX, objId, arg1, arg2, arg3, arg4, arg5); \ + } + +/* +* +* EVT_OBJ_5 - object status event logging with five arguments. +* +*/ + +#define EVT_OBJ_5(objId, classId, evtId, arg1, arg2, arg3, \ + arg4, arg5) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + { \ + if (OBJ_VALID_WV_ASSERT(objId, classId)) \ + if (OBJ_INST_FUNC(objId, classId)) \ + (* (OBJ_EVT_RTN(objId))) \ + (evtId, 5, arg1, arg2, arg3, arg4, arg5); \ + } \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) \ + (evtId, TRG_CLASS3_INDEX, objId, arg1, arg2, arg3, arg4, arg5); \ + } + +/* +* +* EVT_OBJ_4 - object status event logging with four arguments. +* +*/ + +#define EVT_OBJ_4(objId, classId, evtId, arg1, arg2, arg3, arg4) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + { \ + if (OBJ_VALID_WV_ASSERT(objId, classId)) \ + if (OBJ_INST_FUNC(objId, classId)) \ + (* (OBJ_EVT_RTN(objId))) \ + (evtId, 4, arg1, arg2, arg3, arg4); \ + } \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) \ + (evtId, TRG_CLASS3_INDEX, objId, arg1, arg2, arg3, arg4, NULL); \ + } + +/* +* +* EVT_OBJ_3 - object status event logging with three arguments. +* +*/ + +#define EVT_OBJ_3(objId, classId, evtId, arg1, arg2, arg3) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + { \ + if (OBJ_VALID_WV_ASSERT(objId, classId)) \ + if (OBJ_INST_FUNC(objId, classId)) \ + (* (OBJ_EVT_RTN(objId))) \ + (evtId, 3, arg1, arg2, arg3); \ + } \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) \ + (evtId, TRG_CLASS3_INDEX, objId, arg1, arg2, arg3, NULL, NULL); \ + } +/* +* +* EVT_OBJ_2 - object status event logging with two arguments. +* +*/ + +#define EVT_OBJ_2(objId, classId, evtId, arg1, arg2) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + { \ + if (OBJ_VALID_WV_ASSERT(objId, classId)) \ + if (OBJ_INST_FUNC(objId, classId)) \ + (* (OBJ_EVT_RTN(objId))) (evtId, 2, arg1, arg2); \ + } \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) \ + (evtId, TRG_CLASS3_INDEX, objId, arg1, arg2, NULL, NULL, NULL); \ + } + +/* +* +* EVT_OBJ_1 - object status event logging with an argument. +* +*/ + +#define EVT_OBJ_1(objId, classId, evtId, arg1) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + { \ + if (OBJ_VALID_WV_ASSERT(objId, classId)) \ + if (OBJ_INST_FUNC(objId, classId)) \ + (* (OBJ_EVT_RTN(objId)))(evtId, 1, arg1); \ + } \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) \ + (evtId, TRG_CLASS3_INDEX, objId, arg1, NULL, NULL, NULL, NULL); \ + } + + +/* +* +* EVT_OBJ_STR_CLASS_N - object status event logging with an argument. +* +*/ + +#define EVT_STR_CLASS_N(classId, evtId, nArgs, \ + arg1, arg2, arg3, arg4, arg5, arg6, \ + length, data) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + { \ + if (WV_OBJ_CLASS_IS_INSTRUMENTED(classId)) \ + ( * _func_evtLogOBinary) (evtId, nArgs, \ + arg1, arg2, arg3, \ + arg4, arg5, arg6, \ + length, data); \ + } \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) \ + (evtId, TRG_CLASS3_INDEX, NULL, NULL, NULL, NULL, NULL, NULL); \ + } + +/* +* +* EVT_OBJ_STR_2 - object event logging with 2 params and a binary argument. +* +*/ + +#define EVT_OBJ_STR_2(objId, classId, evtId, \ + arg1, arg2, length, string) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + { \ + if (OBJ_VALID_WV_ASSERT(objId, classId)) \ + if (OBJ_INST_FUNC(objId, classId)) \ + ( * _func_evtLogOBinary) (evtId, 2, arg1, arg2, 0, \ + 0, 0, 0, \ + length, string); \ + } \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) \ + (evtId, TRG_CLASS3_INDEX, objId, arg1, NULL, NULL, NULL, NULL); \ + } + +/* +* +* EVT_OBJ_STR_3 - object event logging with 3 params and a binary argument. +* +*/ + +#define EVT_OBJ_STR_3(objId, classId, evtId, \ + arg1, arg2, arg3,length, string) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + { \ + if (OBJ_VALID_WV_ASSERT(objId, classId)) \ + if (OBJ_INST_FUNC(objId, classId)) \ + ( * _func_evtLogOBinary) (evtId, 3, arg1, arg2, arg3, \ + 0, 0, 0, \ + length, string); \ + } \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) \ + (evtId, TRG_CLASS3_INDEX, objId, arg1, NULL, NULL, NULL, NULL); \ + } + +/* +* +* EVT_OBJ_STR_5 - object event logging with 5 params and a binary argument. +* +*/ + +#define EVT_OBJ_STR_5(objId, classId, evtId, \ + arg1, arg2, arg3, arg4, arg5, length, string) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + { \ + if (OBJ_VALID_WV_ASSERT(objId, classId)) \ + if (OBJ_INST_FUNC(objId, classId)) \ + ( * _func_evtLogOBinary) (evtId, 5, arg1, arg2, arg3, \ + arg4, arg5, 0, \ + length, string); \ + } \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) \ + (evtId, TRG_CLASS3_INDEX, objId, arg1, NULL, NULL, NULL, NULL); \ + } + +/* +* +* EVT_OBJ_TASKSPAWN - object status event logging for a spawned task. +* +*/ + +#define EVT_OBJ_TASKSPAWN(evtId, arg1, arg2, arg3, arg4, arg5) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + ( * _func_evtLogOIntLock) (evtId, 5, arg1, arg2, arg3, \ + arg4, arg5); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) (evtId, TRG_CLASS3_INDEX, NULL, arg1, \ + arg2, arg3, arg4, arg5); \ + } + +/* +* +* EVT_OBJ_SIG_0 - signal event logging with no parameter +* +*/ + +#define EVT_OBJ_SIG_0(evtId) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + if (sigEvtRtn != NULL) \ + (* sigEvtRtn) (evtId, 0); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) (evtId, TRG_CLASS3_INDEX, NULL, NULL, \ + NULL, NULL, NULL, NULL); \ + } +/* +* +* EVT_OBJ_SIG_1 - signal event logging with 1 parameter +* +*/ + +#define EVT_OBJ_SIG_1(evtId, arg1) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + if (sigEvtRtn != NULL) \ + (* sigEvtRtn) (evtId, 1, arg1); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) (evtId, TRG_CLASS3_INDEX, NULL, arg1, \ + NULL, NULL, NULL, NULL); \ + } + +/* +* +* EVT_OBJ_SIG - signal event logging +* +*/ + +#define EVT_OBJ_SIG(evtId, nParam, arg1, arg2) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + if (sigEvtRtn != NULL) \ + (* sigEvtRtn) (evtId, nParam, arg1, arg2); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) (evtId, TRG_CLASS3_INDEX, NULL, arg1, \ + arg2, NULL, NULL, NULL); \ + } + +/* +* +* EVT_OBJ_SIG_2 - signal event logging +* +*/ + +#define EVT_OBJ_SIG_2(evtId, arg1, arg2) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + if (sigEvtRtn != NULL) \ + (* sigEvtRtn) (evtId, 2, arg1, arg2); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) (evtId, TRG_CLASS3_INDEX, NULL, arg1, \ + arg2, NULL, NULL, NULL); \ + } + +/* +* +* EVT_OBJ_SIG_3 - signal event logging with 3 parameters +* +*/ + +#define EVT_OBJ_SIG_3(evtId, arg1, arg2, arg3) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + if (sigEvtRtn != NULL) \ + (* sigEvtRtn) (evtId, 3, arg1, arg2, arg3); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) (evtId, TRG_CLASS3_INDEX, NULL, arg1, \ + arg2, arg3, NULL, NULL); \ + } + +/* +* +* EVT_OBJ_SIG_4 - signal event logging with 4 parameters +* +*/ + +#define EVT_OBJ_SIG_4(evtId, arg1, arg2, arg3, arg4) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + if (sigEvtRtn != NULL) \ + (* sigEvtRtn) (evtId, 4, arg1, arg2, arg3, arg4); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) (evtId, TRG_CLASS3_INDEX, NULL, arg1, \ + arg2, arg3, arg4, NULL); \ + } + +/* +* +* EVT_OBJ_SAL_1 - SAL event logging with 1 parameter +* +*/ + +#define EVT_OBJ_SAL_1(evtId, arg1) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + if (salEvtRtn != NULL) \ + (* salEvtRtn) (evtId, 1, arg1); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) (evtId, TRG_CLASS3_INDEX, NULL, arg1, \ + NULL, NULL, NULL, NULL); \ + } + +/* +* +* EVT_OBJ_SAL_2 - SAL event logging with 2 parameters +* +*/ + +#define EVT_OBJ_SAL_2(evtId, arg1, arg2) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + if (salEvtRtn != NULL) \ + (* salEvtRtn) (evtId, 2, arg1, arg2); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) (evtId, TRG_CLASS3_INDEX, NULL, arg1, \ + arg2, NULL, NULL, NULL); \ + } + +/* +* +* EVT_OBJ_SAL_STR_2 - SAL event logging with 2 parameters +* +*/ + +#define EVT_OBJ_SAL_STR_2(evtId, name, fd) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + if (salEvtRtn != NULL) \ + ( * _func_evtLogOBinary) (evtId, 1, fd, 0, 0, 0, 0, 0, \ + strlen (name), name); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) (evtId, TRG_CLASS3_INDEX, NULL, name, \ + fd, NULL, NULL, NULL); \ + } + +/* +* +* EVT_OBJ_SAL_3 - SAL event logging with 3 parameters +* +*/ + +#define EVT_OBJ_SAL_3(evtId, arg1, arg2, arg3) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + if (salEvtRtn != NULL) \ + (* salEvtRtn) (evtId, 3, arg1, arg2, arg3); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) (evtId, TRG_CLASS3_INDEX, NULL, arg1, \ + arg2, arg3, NULL, NULL); \ + } + +/* +* +* EVT_OBJ_EVENT - events (from eventLib) event logging +* +*/ + +#define EVT_OBJ_EVENT(evtId, nParam, arg1, arg2, arg3) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + if (eventEvtRtn != NULL) \ + (* eventEvtRtn) (evtId, nParam, arg1, arg2, arg3); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) (evtId, TRG_CLASS3_INDEX, NULL, \ + arg1, arg2, arg3, NULL, NULL); \ + } + +/* +* +* EVT_EDR_ERR_INJECT - events (from edrLib) event logging +* +*/ + +#define EVT_EDR_ERR_INJECT(evtId, arg1, arg2, arg3, arg4, arg5) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + if (_func_edrEvt != NULL) \ + (* _func_edrEvt) (evtId, arg1, arg2, arg3, arg4, arg5); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) (evtId, TRG_CLASS3_INDEX, NULL, \ + arg1, arg2, arg3, arg4, arg5); \ + } + +/* +* +* INST_SIG_INSTALL - install event logging routine for signals +* +*/ + +#define INST_SIG_INSTALL \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + { \ + sigEvtRtn = _func_evtLogOIntLock; \ + else \ + sigEvtRtn = NULL; \ + } \ + } + +/* +* +* EVT_OBJ_SM_MSGQ - object status event logging for SMO message queues. +* +*/ + +#define EVT_OBJ_SM_MSGQ(evtId, arg1, arg2, arg3, arg4, arg5, arg6) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + (* _func_evtLogOIntLock) (evtId, arg6, arg1, arg2, arg3, \ + arg4, arg5); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) (evtId, TRG_CLASS3_INDEX, arg1, arg2, \ + arg3, arg4, arg5); \ + } + + +/* +* +* EVT_STR_N - record an event with a timestamps, N-params and a string +* +*/ + +#define EVT_STR_N(evtId, nParams, arg1, arg2, arg3, arg4, arg5, arg6, \ + length, string) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + if (_func_evtLogOBinary != NULL) \ + ( * _func_evtLogOBinary) (evtId, nParams, arg1, arg2, arg3, \ + arg4, arg5, arg6, length, string);\ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) (evtId, TRG_CLASS3_INDEX, NULL, NULL, \ + NULL, NULL, NULL, NULL); \ + } + +/****************************************************************************** +* +* EVT_NOOBJ_STR_0 - event logging with strings +* +* This macro stores object level string information for places where the objId +* is not available. The string must be arg1. +* +* NOMANUAL +*/ + +#define EVT_NOOBJ_STR_0(evtId,length,string) \ + if ( ACTION_IS_SET ) \ + { \ + if ( WV_EVTCLASS_IS_SET(WV_CLASS_3|WV_ON) ) \ + ( * _func_evtLogOBinary) (evtId, 0, 0, 0, 0, 0, 0, 0, \ + length, string); \ + if ( TRG_EVTCLASS_IS_SET(TRG_CLASS_3|TRG_ON) ) \ + ( * _func_trgCheck) \ + (evtId, TRG_CLASS3_INDEX, NULL, NULL, NULL, NULL, NULL, NULL); \ + } + + + +#endif /* CPU */ /* end target-only section */ +#endif /* _ASMLANGUAGE */ + +#define WV_REV_ID_T2 0xb0b00000 +#define WV_REV_ID_T3 0xcdcd0000 +#define WV_REV_ID_BASE6 0xb1b10000 /* based on VxWorks 5 */ + +#define WV_EVT_PROTO_REV_1_0_FCS 1 + +#define WV_EVT_PROTO_REV_2_0_FCS 2 +#define WV_EVT_PROTO_REV_3_0_FCS 3 +#define WV_EVT_PROTO_REV_3_1_FCS 4 +#define WV_EVT_PROTO_REV_2_2_FCS 5 + +/* Base6 parser revisions */ + +#define WV_EVT_PROTO_REV_1_EAR 1 + + +#define WV_REV_ID_CURRENT WV_REV_ID_BASE6 +#define WV_EVT_PROTO_REV_CURRENT WV_EVT_PROTO_REV_1_EAR + +/* ranges for the different classes of events */ + +#define MIN_CONTROL_ID 0 +#define MAX_CONTROL_ID 49 +#define MIN_CLASS1_ID 50 +#define MAX_CLASS1_ID 599 +#define MIN_INT_ID 102 +#define PPC_WD_INT_ID 598 +#define PPC_DECR_INT_ID 599 +#define MAX_INT_ID 599 +#define MIN_CLASS2_ID 600 +#define MAX_CLASS2_ID 9999 +#define MIN_CLASS3_ID 10000 +#define MAX_CLASS3_ID 19999 +#define MIN_RESERVE_ID 20000 + +/* + * Network event IDs can go from 20000 - 20292 + * These are present in 5.x and AE + */ + +/* + * Dual-stack network event IDs go from 20400 - 20475 + * though they go in steps of 15 + */ + +/* range for synthetic syscall event Ids */ + +#define MIN_SYSCALL_ID 21000 +#define MAX_SYSCALL_ID 21999 + +#define MIN_RTI_RESERVE_ID 39000 +#define MAX_RTI_RESERVE_ID 39999 +#define MAX_RESERVE_ID 39999 +#define MIN_USER_ID 40000 +#define MAX_USER_ID 65535 + +#define INT_LEVEL(eventNum) ((eventNum)-MIN_INT_ID) + +#define IS_CLASS1_EVENT(event) \ + ((event >= MIN_CLASS1_ID) && (event <= MAX_CLASS1_ID)) + +#define IS_CLASS2_EVENT(event) \ + ((event >= MIN_CLASS2_ID) && (event <= MAX_CLASS2_ID)) + +#define IS_CLASS3_EVENT(event) \ + ((event >= MIN_CLASS3_ID) && (event <= MAX_CLASS3_ID)) + +#define IS_INT_ENT_EVENT(event) \ + ((event >= MIN_INT_ID) && (event <= MAX_INT_ID)) + +#define IS_CONTROL_EVENT(event) \ + ((event >= MIN_CONTROL_ID) && (event <= MAX_CONTROL_ID)) + +#define IS_USER_EVENT(event) \ + ((event >= MIN_USER_ID) && (event <= MAX_USER_ID)) + +/* + * This test determines whether the parser should translate + * the event into the correct syscall + */ + +#define IS_SYSCALL_EVENT(event) \ + ((event >= EVENT_SYSCALL_0) && (event <= EVENT_SYSCALL_8)) + +#define CONTROL_EVENT(id) (MIN_CONTROL_ID + id) +#define CLASS1_EVENT(id) (MIN_CLASS1_ID + id) +#define CLASS2_EVENT(id) (MIN_CLASS2_ID + id) +#define CLASS3_EVENT(id) (MIN_CLASS3_ID + id) +#define INT_EVENT(id) (MIN_INT_ID + id) + + +/* EVENT Id's */ + +/* Interrupt events */ + +#define EVENT_INT_ENT(k) ((k) + MIN_INT_ID) + /* Param: + * short EVENT_INT_ENT(k), + * int timeStamp + */ + +#define EVENT_INT_EXIT (MIN_INT_ID - 1) + /* Param: + * short EVENT_INT_EXIT, + * int timeStamp + */ + +#define EVENT_INT_EXIT_K (MIN_INT_ID - 2) + /* Param: + * short EVENT_INT_EXIT_K, + * int timeStamp + */ + +/* Control events */ + +/* + * The length includes a string buffer. The buffer should be padded to the next + * half-word boundary + */ + +#define EVENT_BEGIN_SIZE(stringBuffLen) \ + (sizeof(short) + (4 * sizeof(int)) + stringBuffLen) + +#define EVENT_BEGIN CONTROL_EVENT(0) + /* Param: + * short EVENT_BEGIN, + * int CPU, + * int bspSize, + * char * bspName, + * int taskIdCurrent, + * int collectionMode + */ + + +#define EVENT_TIMER_ROLLOVER CONTROL_EVENT(2) + /* Param: + * short EVENT_TIMER_ROLLOVER + * int timeStamp, + */ + + /* + * The size of this event includes the string buffer, which must be padded to + * the next half-word boundary + */ + +#define EVENT_TASKNAME_SIZE(stringBuffLen) \ + (sizeof(short) + 7 * sizeof(int) + stringBuffLen) + +#define EVENT_TASKNAME CONTROL_EVENT(3) + /* Param: + * short EVENT_TASKNAME, + * int status, + * int priority, + * int taskLockCount + * int tid, + * int entryPoint + * int rtp + * int namesize + * char * name + */ + +#define EVENT_CONFIG_SIZE (sizeof (short) + (1 * sizeof(int))) + +#define EVENT_CONFIG CONTROL_EVENT(4) + /* Param: + * int revision WV_REV_ID | WV_EVT_PROTO_REV + */ + + +/* + * The size of this event includes the string buffer, which must be padded to + * half-word boundary + */ + +#define EVENT_COMMENT_SIZE(stringBuffLength) \ + (sizeof(short) + sizeof(int) + stringBuffLength) + + +#define EVENT_LOGCOMMENT CONTROL_EVENT(7) + /* Param: + * int length + * string comment + */ + + +#define EVENT_TIMESTAMP_CONFIG_SIZE \ + (sizeof(short) + 4 * sizeof(int)) + +#define EVENT_TIMESTAMP_CONFIG CONTROL_EVENT(8) + + /* + * short eventId + * int timestampFreq, + * int timestampPeriod, + * int autoRollover, + * int clkRate, + */ + +#define EVENT_ISR_INFO_SIZE(stringBuffLength) \ + (sizeof(short) + 3 * sizeof(int) + stringBuffLength) + +#define EVENT_ISR_INFO CONTROL_EVENT(9) + /* Param: + * short EVENT_ISR_INFO, + * int objId + * int handler + * int nameLen + * char * name, + */ + +#define EVENT_RTPNAME CONTROL_EVENT(16) + /* Param: + * short EVENT_RTPNAME, + * UINT32 options + * UINT32 owner + * UINT32 rtpId + * UINT32 nameLength + * UINT32 name + */ + + +#define EVENT_ANY_EVENT CONTROL_EVENT(48) + /* This is added for triggering, when no particular event is required */ + +/* CLASS3 events */ + +#define EVENT_TASKSPAWN CLASS3_EVENT(0) + /* Param: + * short EVENT_TASKSPAWN, + * int timeStamp, + * int options, + * int entryPt, + * intstackSize, + * int priority, + * int pTcb + */ + +#define EVENT_TASKDESTROY CLASS3_EVENT(1) + /* Param: + * short EVENT_TASKDESTROY, + * int timeStamp, + * int safeCnt, + * int pTcb + */ + +#define EVENT_TASKDELAY CLASS3_EVENT(2) + /* Param: + * short EVENT_TASKDELAY, + * int timeStamp, + * int ticks + */ + +#define EVENT_TASKPRIORITYSET CLASS3_EVENT(3) + /* Param: + * short EVENT_TASKPRIORITYSET, + * int timeStamp, + * int oldPri, + * int newPri, + * int pTcb + */ + +#define EVENT_TASKSUSPEND CLASS3_EVENT(4) + /* Param: + * short EVENT_TASKSUSPEND, + * int timeStamp, + * int pTcb + */ + +#define EVENT_TASKRESUME CLASS3_EVENT(5) + /* Param: + * short EVENT_TASKRESUME, + * int timeStamp, + * int priority, + * int pTcb + */ + +#define EVENT_TASKSAFE CLASS3_EVENT(6) + /* Param: + * short EVENT_TASKSAFE, + * int timeStamp, + * int safeCnt, + * int tid + */ + +#define EVENT_TASKUNSAFE CLASS3_EVENT(7) + /* Param: + * short EVENT_TASKUNSAFE, + * int timeStamp, + * int safeCnt, + * int tid + */ + +#define EVENT_SEMBCREATE CLASS3_EVENT(8) + /* Param: + * short EVENT_SEMBCREATE, + * int timeStamp, + * int semOwner, + * int options, + * int semId + */ + +#define EVENT_SEMCCREATE CLASS3_EVENT(9) + /* Param: + * short EVENT_SEMCCREATE, + * int timeStamp, + * int initialCount, + * int options, + * int semId + */ + +#define EVENT_SEMDELETE CLASS3_EVENT(10) + /* Param: + * short EVENT_SEMDELETE, + * int timeStamp, + * int qHead + * int recurse + * int state + * int semId + */ + +#define EVENT_SEMFLUSH CLASS3_EVENT(11) + /* Param: + * short EVENT_SEMFLUSH, + * int timeStamp, + * int qHead + * int recurse + * int state + * int semId + */ + +#define EVENT_SEMGIVE CLASS3_EVENT(12) + /* Param: + * short EVENT_SEMGIVE, + * int timeStamp, + * int recurse, + * int semOwner, + * int semId + */ + +#define EVENT_SEMMCREATE CLASS3_EVENT(13) + /* Param: + * short EVENT_SEMMCREATE, + * int timeStamp, + * int semOwner, + * int options, + * int semId + */ + +#define EVENT_SEMMGIVEFORCE CLASS3_EVENT(14) + /* Param: + * short EVENT_SEMMGIVEFORCE, + * int timeStamp, + * int semOwner, + * int options, + * int semId + */ + +#define EVENT_SEMTAKE CLASS3_EVENT(15) + /* Param: + * short EVENT_SEMTAKE, + * int timeStamp, + * int recurse, + * int semOwner, + * int semId + */ + +#define EVENT_WDCREATE CLASS3_EVENT(16) + /* Param: + * short EVENT_WDCREATE, + * int timeStamp, + * int wdId + */ + +#define EVENT_WDDELETE CLASS3_EVENT(17) + /* Param: + * short EVENT_WDDELETE, + * int timeStamp, + * int wdId + */ + +#define EVENT_WDSTART CLASS3_EVENT(18) + /* Param: + * short EVENT_WDSTART, + * int timeStamp, + * int delay, + * int wdId + */ + +#define EVENT_WDCANCEL CLASS3_EVENT(19) + /* Param: + * short EVENT_WDCANCEL, + * int timeStamp, + * int wdId + */ + +#define EVENT_MSGQCREATE CLASS3_EVENT(20) + /* Param: + * short EVENT_MSGQCREATE, + * int timeStamp, + * int options, + * int maxMsgLen, + * int maxMsg, + * int msgId + */ + +#define EVENT_MSGQDELETE CLASS3_EVENT(21) + /* Param: + * short EVENT_MSGQDELETE, + * int timeStamp, + * int msgId + */ + +#define EVENT_MSGQRECEIVE CLASS3_EVENT(22) + /* Param: + * short EVENT_MSGQRECEIVE, + * int timeStamp, + * int timeout, + * int bufSize, + * int buffer, + * int msgId + */ + +#define EVENT_MSGQSEND CLASS3_EVENT(23) + /* Param: + * short EVENT_MSGQSEND, + * int timeStamp, + * int priority, + * int timeout, + * int bufSize, + * int buffer, + * int msgId + */ + +#define EVENT_SIGNAL CLASS3_EVENT(24) + /* Param: + * short EVENT_SIGNAL, + * int timeStamp, + * int handler, + * int signo + */ + +#define EVENT_SIGSUSPEND CLASS3_EVENT(25) + /* Param: + * short EVENT_SIGSUSPEND, + * int timeStamp, + * int pSet + */ + +#define EVENT_PAUSE CLASS3_EVENT(26) + /* Param: + * short EVENT_PAUSE, + * int timeStamp, + * int tid + */ + +#define EVENT_KILL CLASS3_EVENT(27) + /* Param: + * short EVENT_KILL, + * int timeStamp, + * int tid, + * int signo + */ + +#define EVENT_SAFE_PEND CLASS3_EVENT(28) + /* Param: + * short EVENT_SAFE_PEND, + * int tid + */ + +#define EVENT_SIGWRAPPER CLASS3_EVENT(29) + /* Param: + * short EVENT_SIGWRAPPER, + * int signo, + * int tid + */ + + +#define EVENT_MEMALLOC CLASS3_EVENT(30) + /* Param: + * int timeStamp, + * unsigned nBytes, + * unsigned nBytesPlusHeaderAlign, + * int pBlock, + * int partId + */ + +#define EVENT_MEMFREE CLASS3_EVENT(31) + /* Param: + * int timeStamp, + * unsigned nBytesPlusHeaderAlign, + * int pBlock, + * int partId + */ + +#define EVENT_MEMPARTCREATE CLASS3_EVENT(32) + /* Param: + * int timeStamp, + * unsigned poolSize, + * int partId + */ + +#define EVENT_MEMREALLOC CLASS3_EVENT(33) + /* Param: + * int timeStamp, + * unsigned nBytes, + * int pBlock + * unsigned nBytesPlusHeaderAlign, + * int pNewBlock, + * int partId + */ + +#define EVENT_MEMADDTOPOOL CLASS3_EVENT(34) + /* Param: + * int timeStamp, + * unsigned poolSize, + * int partId + */ + +#define EVENT_MSGCCREATE CLASS3_EVENT(35) + /* Param: + */ + +#define EVENT_MSGCSEND CLASS3_EVENT(36) + /* Param: + */ + +#define EVENT_MSGCREPLYGET CLASS3_EVENT(37) + /* Param: + */ + +#define EVENT_MSGCDELETE CLASS3_EVENT(38) + /* Param: + */ + +#define EVENT_MSGSCREATE CLASS3_EVENT(39) + /* Param: + */ + +#define EVENT_MSGSREPLY CLASS3_EVENT(40) + /* Param: + */ + +#define EVENT_MSGSRECEIVE CLASS3_EVENT(41) + /* Param: + */ + +#define EVENT_MSGSDELETE CLASS3_EVENT(42) + /* Param: + */ + +#define EVENT_TASKSTOP CLASS3_EVENT(43) + /* Param: + * short EVENT_TASKSTOP, + * int timeStamp, + * int pTcb + */ + +#define EVENT_TASKCONT CLASS3_EVENT(44) + /* Param: + * short EVENT_TASKCONT, + * int timeStamp, + * int priority, + * int pTcb + */ + +#define EVENT_IOOPEN CLASS3_EVENT(48) + /* Param: + * short EVENT_IOOPEN, + * int timeStamp, + * int flags, + * int owner, + * int fd, + * int strSize, + * char * name + */ + +#define EVENT_IOREAD CLASS3_EVENT(49) + /* Param: + * short EVENT_IOREAD, + * int timeStamp, + * int buffer, + * int bytesRead, + * int fd, + */ + +#define EVENT_IOWRITE CLASS3_EVENT(50) + /* Param: + * short EVENT_IOWRITE, + * int timeStamp, + * int buffer, + * int bytesWritten, + * int fd, + */ + +#define EVENT_IOIOCTL CLASS3_EVENT(51) + /* Param: + * short EVENT_IOIOCTL, + * int timeStamp, + * int function, + * int arg, + * int fd, + */ + +#define EVENT_IOCLOSE CLASS3_EVENT(52) + /* Param: + * short EVENT_IOCLOSE, + * int timeStamp, + * int fd + */ + +#define EVENT_IOCREAT CLASS3_EVENT(53) + /* Param: + * short EVENT_IOCREAT, + * int timeStamp, + * int flag, + * int owner, + * int fd, + * int strSize, + * char * name + */ + +#define EVENT_IODELETE CLASS3_EVENT(54) + /* Param: + * short EVENT_IODELETE, + * int timeStamp, + * int strSize + * char * name + */ + +#define EVENT_EVENTSEND CLASS3_EVENT(57) + /* Param: + * int taskId, + * UINT32 events + */ + +#define EVENT_EVENTRECEIVE CLASS3_EVENT(58) + /* Param: + * UINT32 events, + * int timeout, + * UINT8 flags + */ + +#define EVENT_OWNERSET CLASS3_EVENT(59) + /* Param: + * short EVENT_OWNERSET, + * int timeStamp, + * int ownerId, + * int objId + */ + +#define EVENT_ISR_DISPATCHER_INVOKE CLASS3_EVENT(60) + /* Param: + * short EVENT_ISR_DISPATCHER_INVOKE, + * int timeStamp, + * int objId + */ + +#define EVENT_ISR_DISPATCHER_DONE CLASS3_EVENT(61) + /* Param: + * short EVENT_ISR_DISPATCHER_DONE, + * int timeStamp, + * int objId + */ + +#define EVENT_ISR_CREATE CLASS3_EVENT(62) + /* Param: + * short EVENT_ISR_CREATE, + * int timestamp + * int objId + * tag, + * rtn, + * param, + * options + */ + + +#define EVENT_ISR_DESTROY CLASS3_EVENT(64) + /* Param: + * short EVENT_ISR_DESTROY, + * int timeStamp, + * int objId + */ + +#define EVENT_SYSCALL_0 CLASS3_EVENT(65) + /* Params: + * short EVENT_SYSCALL_0 + * int timestamp + * short syscallNumber + */ + +#define EVENT_SYSCALL_1 CLASS3_EVENT(66) + /* Params: + * short EVENT_SYSCALL_1 + * int timestamp + * short syscallNumber + * int param + */ + +#define EVENT_SYSCALL_2 CLASS3_EVENT(67) + /* Params: + * short EVENT_SYSCALL_2 + * int timestamp + * short syscallNumber + * int param + * int param + */ + +#define EVENT_SYSCALL_3 CLASS3_EVENT(68) + /* Params: + * short EVENT_SYSCALL_3 + * int timestamp + * short syscallNumber + * int param + * int param + * int param + */ + +#define EVENT_SYSCALL_4 CLASS3_EVENT(69) + /* Params: + * short EVENT_SYSCALL_4 + * int timestamp + * short syscallNumber + * int param + * int param + * int param + * int param + */ + +#define EVENT_SYSCALL_5 CLASS3_EVENT(70) + /* Params: + * short EVENT_SYSCALL_5 + * int timestamp + * short syscallNumber + * int param + * int param + * int param + * int param + * int param + */ + +#define EVENT_SYSCALL_6 CLASS3_EVENT(71) + /* Params: + * short EVENT_SYSCALL_6 + * int timestamp + * short syscallNumber + * int param + * int param + * int param + * int param + * int param + * int param + */ + +#define EVENT_SYSCALL_7 CLASS3_EVENT(72) + /* Params: + * short EVENT_SYSCALL_7 + * int timestamp + * short syscallNumber + * int param + * int param + * int param + * int param + * int param + * int param + * int param + */ + +#define EVENT_SYSCALL_8 CLASS3_EVENT(73) + /* Params: + * short EVENT_SYSCALL_8 + * int timestamp + * short syscallNumber + * int param + * int param + * int param + * int param + * int param + * int param + * int param + * int param + */ + +#define EVENT_SYSCALL_RETURN_OK CLASS3_EVENT(74) + /* Params: + * short EVENT_SYSCALL_OK + * int timestamp + * int returnValue + */ + +#define EVENT_SYSCALL_RETURN_ERR CLASS3_EVENT(75) + /* Params: + * short EVENT_SYSCALL_ERR + * int timestamp + * int errno + */ + +#define EVENT_SYSCALL_BAD_ID CLASS3_EVENT(76) + /* Params: + * short EVENT_SYSCALL_BAD_ID + * int timestamp + * int syscallGroup + * int syscallRoutine + */ + +#define EVENT_OBJ_VERIFY_FAIL CLASS3_EVENT(77) + /* Params: + * short EVENT_OBJ_VERIFY_FAIL + * int timestamp + * int objId + * int classId + */ + + +#define EVENT_RTP_SPAWN CLASS3_EVENT(78) + /* Params: + * short EVENT_RTP_SPAWN + * int timestamp + * int rtpId + * int priority + * int stacksize + * int options + */ + +#define EVENT_RTP_DELETE CLASS3_EVENT(79) + /* Params: + * short EVENT_RTP_DELETE + * int timestamp + * int rtpId + */ + +#define EVENT_RTP_INIT_TASK CLASS3_EVENT(80) + /* Params: + * short EVENT_RTP_SPAWN + * int timestamp + */ + +#define EVENT_RTP_LOAD CLASS3_EVENT(81) + /* Params: + * short EVENT_RTP_SPAWN + * int timestamp + */ + +#define EVENT_EDR_ERROR_INJECT CLASS3_EVENT(82) + /* Param: + * UINT32 kind, + * int len (fileName) + * char * fileName, + * UINT32 lineNumber, + * UINT32 address, + * int len (textPayload) + * char * textPayload, + */ + +#define EVENT_RTPKILL CLASS3_EVENT(83) + /* Param: + * short eventId + * int timestamp + * int rtpId + * int signal + */ + +#define EVENT_RTPSIGNAL CLASS3_EVENT(84) + /* Param: + * short eventId + * int timestamp + * int rtpId + * int signal + * int handler + */ + +#define EVENT_RTPSUSPEND CLASS3_EVENT(85) + /* Param: + * short eventId + * int timestamp + * int signalSet + */ + +#define EVENT_RTPPAUSE CLASS3_EVENT(86) + /* Param: + * short eventId + * int timestamp + */ + +#define EVENT_RTPTASKKILL CLASS3_EVENT(87) + /* Param: + * short eventId + * int timestamp + * int taskId + * int signal + */ + +#define EVENT_RTPSIGQUEUE CLASS3_EVENT(88) + /* Param: + * short eventId + * int timestamp + * int rtpId + * int signal + * int pValue + */ + +#define EVENT_RTPTASKSIGQUEUE CLASS3_EVENT(89) + /* Param: + * short eventId + * int timestamp + * int taskId + * int signal + * int pValue + */ + +#define EVENT_RTPCHILDWAIT CLASS3_EVENT(90) + /* Param: + * short eventId + * int timestamp + * int rtpI + * int options + */ + + +#define EVENT_RTPSIGTIMEDWAIT CLASS3_EVENT(91) + /* Param: + * short eventId + * int timestamp + * int rtpId + * int pSet + * int pInfo + * int wait + */ + +#define EVENT_RTPSIGWRAPPER CLASS3_EVENT(92) + /* Param: + * short eventId + * int timestamp + * int rtpId + * int type (SIG_DELIVERED_IN_SYSCALL + * SIG_DELIVERED_IN_WINDCTX + * SIG_DELIVERED_IN_EXCEPTION) + */ + +#define EVENT_RTPSIGWRAPPER_DONE CLASS3_EVENT(93) + /* Param: + * short eventId + * int timestamp + */ + +#define EVENT_RTPSIGPROCMASK CLASS3_EVENT(94) + /* Params: + * short EVENT_RTP_SPAWN + * int timestamp + * int how + * int pSet + * int pOSet + */ + +#define EVENT_RTPSIGPENDING CLASS3_EVENT(95) + /* Params: + * short EVENT_RTP_SPAWN + * int timestamp + * int pSet + */ + +#define EVENT_SALOPEN CLASS3_EVENT(96) + /* Param: + * short EVENT_SALOPEN + * char * name + * int timestamp + * int sockfd + */ + +#define EVENT_SALCALL_SENDREQ CLASS3_EVENT(97) + /* Param: + * short EVENT_SENDREQ + * int timestamp + * int sockfd + * int sendBuf + * int len + */ + +#define EVENT_SALCALL_REPLY CLASS3_EVENT(98) + /* Param: + * short EVENT_REPLY + * int timestamp + * int sockfd + * int recvBuf + * int len + */ + +#define EVENT_SALCREATE CLASS3_EVENT(99) + /* Param: + * short EVENT_SALCREATE + * int timestamp + * char * name + * int serverId + */ + +#define EVENT_SALDELETE CLASS3_EVENT(100) + /* Param: + * short EVENT_SALDELETE + * int timestamp + * int serverId + */ + +#define EVENT_SALRUN_WAIT CLASS3_EVENT(101) + /* Param: + * short EVENT_SALRUN_WAIT + * int timestamp + * int serverId + */ + +#define EVENT_SALRUN_READREQ CLASS3_EVENT(102) + /* Param: + * short EVENT_SALRUN_READREQ + * int timestamp + * int serverId + * int sockfd + */ + +#define EVENT_SALRUN_SOCKCLOSE CLASS3_EVENT(103) + /* Param: + * short EVENT_SALRUN_SOCKCLOSE + * int timestamp + * int serverId + * int sockfd + */ + +#define EVENT_SALRUN_SOCKIGNORE CLASS3_EVENT(104) + /* Param: + * short EVENT_SALRUN_SOCKIGNORE + * int timestamp + * int serverId + * int sockfd + */ + +#define EVENT_SALRUN_ACCEPT CLASS3_EVENT(105) + /* Param: + * short EVENT_SALRUN_ACCEPT + * int timestamp + * int serverId + * int sockfd + */ + +#define EVENT_SALRUN_CONNECT CLASS3_EVENT(106) + /* Param: + * short EVENT_SALRUN_CONNECT + * int serverId + * int sockfd + */ + +#define EVENT_SALRUN_TERMINATE CLASS3_EVENT(107) + /* Param: + * short EVENT_SALRUN_TERMINATE + * int timestamp + * int serverId + */ + +/* + * USB Event Ids + * These are CLASS3 events, from 120 - 149 for peripheral, + * and 150 - 199 for host + */ + +#define EVENT_SD_CREATE CLASS3_EVENT(200) + /* + * short EVENT_SD_CREATE + * int timestamp + * int sdId + * int options + * int size + * int physical address, + * int attr + * int virtual address. + * string name + */ + +#define EVENT_SD_DELETE CLASS3_EVENT(201) + /* + * short EVENT_SD_DELETE + * int timestamp + * int sdId + * int options + */ + +#define EVENT_SD_MAP CLASS3_EVENT(202) + /* + * short EVENT_SD_MAP + * int timestamp + * int sdId, + * int attr + * int options + */ + +#define EVENT_SD_UNMAP CLASS3_EVENT(203) + /* + * short EVENT_SD_UNMAP + * int timestamp + * int sdId, + * int options + */ + +/* CLASS2 events */ + +#define EVENT_WINDSPAWN CLASS2_EVENT(0) + /* Param: + * short EVENT_WINDSPAWN, + * int pTcb, + * int priority + */ + +#define EVENT_WINDDELETE CLASS2_EVENT(1) + /* Param: + * short EVENT_WINDDELETE, + * int pTcb + */ + +#define EVENT_WINDSUSPEND CLASS2_EVENT(2) + /* Param: + * short EVENT_WINDSUSPEND, + * int pTcb + */ + +#define EVENT_WINDRESUME CLASS2_EVENT(3) + /* Param: + * short EVENT_WINDRESUME, + * int pTcb + */ + +#define EVENT_WINDPRIORITYSETRAISE CLASS2_EVENT(4) + /* Param: + * short EVENT_WINDPRIORITYSETRAISE, + * int pTcb, + * int oldPriority, + * int priority + */ + + +#define EVENT_WINDPRIORITYSETLOWER CLASS2_EVENT(5) + /* Param: + * short EVENT_WINDPRIORITYSETLOWER, + * int pTcb, + * int oldPriority, + * int priority + */ + +#define EVENT_WINDSEMDELETE CLASS2_EVENT(6) + /* Param: + * short EVENT_WINDSEMDELETE, + * int semId + */ + + +#define EVENT_WINDTICKANNOUNCETMRSLC CLASS2_EVENT(7) + /* Param: + * short EVENT_WINDTICKANNOUNCETMRSLC + */ + +#define EVENT_WINDTICKANNOUNCETMRWD CLASS2_EVENT(8) + /* Param: + * short EVENT_WINDTICKANNOUNCETMRWD, + * int wdId + */ + +#define EVENT_WINDDELAY CLASS2_EVENT(9) + /* Param: + * short EVENT_WINDDELAY + * int ticks + */ + +#define EVENT_WINDUNDELAY CLASS2_EVENT(10) + /* Param: + * short EVENT_WINDUNDELAY, + * int pTcb + */ + +#define EVENT_WINDWDSTART CLASS2_EVENT(11) + /* Param: + * short EVENT_WINDWDSTART, + * int wdId + */ + +#define EVENT_WINDWDCANCEL CLASS2_EVENT(12) + /* Param: + * short EVENT_WINDWDCANCEL, + * int wdId + */ + +#define EVENT_WINDPENDQGET CLASS2_EVENT(13) + /* Param: + * short EVENT_WINDPENDQGET, + * int pTcb + */ + +#define EVENT_WINDPENDQFLUSH CLASS2_EVENT(14) + /* Param: + * short EVENT_WINDPENDQFLUSH, + * int pTcb + */ + +#define EVENT_WINDPENDQPUT CLASS2_EVENT(15) + /* Param: + * short EVENT_WINDPENDQPUT + */ + +#define EVENT_WINDPENDQTERMINATE CLASS2_EVENT(17) + /* Param: + * short EVENT_WINDPENDQTERMINATE, + * int pTcb + */ + +#define EVENT_WINDTICKUNDELAY CLASS2_EVENT(18) + /* Param: + * short EVENT_WINDTICKUNDELAY, + * int pTcb + */ + +#define EVENT_OBJ_TASK CLASS2_EVENT(19) + /* Param: + * short EVENT_OBJ_TASK, + * int pTcb + */ + +#define EVENT_OBJ_SEMGIVE CLASS2_EVENT(20) + /* Param: + * short EVENT_OBJ_SEMGIVE, + * int semId + */ + +#define EVENT_OBJ_SEMTAKE CLASS2_EVENT(21) + /* Param: + * short EVENT_OBJ_SEMTAKE, + * int semId + */ + +#define EVENT_OBJ_SEMFLUSH CLASS2_EVENT(22) + /* Param: + * short EVENT_OBJ_SEMFLUSH, + * int semId + */ + +#define EVENT_OBJ_MSGSEND CLASS2_EVENT(23) + /* Param: + * short EVENT_OBJ_MSGSEND, + * int msgQId + */ + +#define EVENT_OBJ_MSGRECEIVE CLASS2_EVENT(24) + /* Param: + * short EVENT_OBJ_MSGRECEIVE, + * int msgQId + */ + +#define EVENT_OBJ_MSGDELETE CLASS2_EVENT(25) + /* Param: + * short EVENT_OBJ_MSGDELETE, + * int msgQId + */ + +#define EVENT_OBJ_SIGPAUSE CLASS2_EVENT(26) + /* Param: + * short EVENT_OBJ_SIGPAUSE, + * int qHead + */ + +#define EVENT_OBJ_SIGSUSPEND CLASS2_EVENT(27) + /* Param: + * short EVENT_OBJ_SIGSUSPEND, + * int sigset + */ + +#define EVENT_OBJ_SIGKILL CLASS2_EVENT(28) + /* Param: + * short EVENT_OBJ_SIGKILL, + * int tid + */ + +#define EVENT_WINDSTOP CLASS2_EVENT(29) + /* Param: + * short EVENT_WINDSTOP, + * int pTcb + */ + +#define EVENT_WINDCONT CLASS2_EVENT(30) + /* Param: + * short EVENT_WINDCONT, + * int pTcb + */ + +#define EVENT_WINDTICKTIMEOUT CLASS2_EVENT(31) + /* Param: + * short EVENT_WINDTICKTIMEOUT, + * int tId + */ + +#define EVENT_OBJ_SIGWAIT CLASS2_EVENT(32) + /* Param: + * short EVENT_OBJ_SIGWAIT, + * int tid + */ + +#define EVENT_OBJ_EVENTSEND CLASS2_EVENT(35) + /* Param: + * short EVENT_OBJ_EVENTSEND + */ + +#define EVENT_OBJ_EVENTRECEIVE CLASS2_EVENT(36) + /* Param: + * short EVENT_OBJ_EVENTRECEIVE + */ + +#define EVENT_OBJ_MSGCDELETE CLASS2_EVENT(37) + /* Param: + * short EVENT_OBJ_MSGCDELETE + */ + +#define EVENT_OBJ_MSGCSEND CLASS2_EVENT(38) + /* Param: + * short EVENT_OBJ_MSGCSEND + */ + +#define EVENT_OBJ_MSGCREPLYGET CLASS2_EVENT(39) + /* Param: + * short EVENT_OBJ_MSGCREPLYGET + */ + +#define EVENT_OBJ_MSGCACKSEND CLASS2_EVENT(40) + /* Param: + * short EVENT_OBJ_MSGCACKSEND + */ + +#define EVENT_OBJ_MSGCREPLYSEND CLASS2_EVENT(41) + /* Param: + * short EVENT_OBJ_MSGCREPLYSEND + */ + +#define EVENT_OBJ_MSGSDELETE CLASS2_EVENT(42) + /* Param: + * short EVENT_OBJ_MSGSDELETE + */ + +#define EVENT_OBJ_MSGSRECEIVE CLASS2_EVENT(43) + /* Param: + * short EVENT_OBJ_MSGSRECEIVE + */ + +#define EVENT_OBJ_MSGSREPLY CLASS2_EVENT(44) + /* Param: + * short EVENT_OBJ_MSGSREPLY + */ + +#define EVENT_OBJ_MSGSSEND CLASS2_EVENT(45) + /* Param: + * short EVENT_OBJ_MSGSSEND + */ + + +/* CLASS1 events */ + +#define EVENT_WIND_EXIT_DISPATCH CLASS1_EVENT(2) + /* Param: + * short EVENT_WIND_EXIT_DISPATCH, + * int timestamp, + * int tId, + * int priority + */ + +#define EVENT_WIND_EXIT_NODISPATCH CLASS1_EVENT(3) + /* Param: + * short EVENT_WIND_EXIT_NODISPATCH, + * int timestamp, + * int priority + */ + +#define EVENT_WIND_EXIT_DISPATCH_PI CLASS1_EVENT(4) + /* Param: + * short EVENT_WIND_EXIT_DISPATCH_PI, + * int timestamp, + * int tId, + * int priority + */ + +#define EVENT_WIND_EXIT_NODISPATCH_PI CLASS1_EVENT(5) + /* Param: + * short EVENT_WIND_EXIT_NODISPATCH_PI, + * int timestamp, + * int priority + */ + + /* + #define EVENT_DISPATCH_OFFSET 0xe + #define EVENT_NODISPATCH_OFFSET 0xa + */ + + /* + * This definition is needed for the logging of the above _PI events + */ + +#define EVENT_WIND_EXIT_IDLE CLASS1_EVENT(6) + /* Param: + * short EVENT_WIND_EXIT_IDLE, + * int timestamp + */ + +#define EVENT_TASKLOCK CLASS1_EVENT(7) + /* Param: + * short EVENT_TASKLOCK, + * int timeStamp + */ + +#define EVENT_TASKUNLOCK CLASS1_EVENT(8) + /* Param: + * short EVENT_TASKUNLOCK, + * int timeStamp + */ + +#define EVENT_TICKANNOUNCE CLASS1_EVENT(9) + /* Param: + * short EVENT_TICKANNOUNCE, + * int timeStamp + */ + +#define EVENT_EXCEPTION CLASS1_EVENT(10) + /* Param: + * short EVENT_EXCEPTION, + * int timeStamp, + * int exception + */ + +#define EVENT_TASK_STATECHANGE CLASS1_EVENT(11) + /* Param: + * short EVENT_STATECHANGE + * int timeStamp, + * int taskId, + * int oldState + * int newState + */ + +/* pseudo events - generated host side */ + + + +#ifdef CPU /* This is for target side build only */ + +#ifndef _BYTE_ORDER +#error _BYTE_ORDER must be defined +#endif /* _BYTE_ORDER */ + +#ifndef _BIG_ENDIAN +#error _BIG_ENDIAN must be defined +#endif /* _BIG_ENDIAN */ + +/* + * Alignment macros used to store unaligned short (16 bits) and unaligned + * int (32 bits). + */ + +/* + * If _WRS_BLIB_ALIGNMENT is defined as 1, arch can do non-aligned word writes, + * otherwise we need to handle it ourselves. + */ + +#if defined (_WRS_BLIB_ALIGNMENT) + #if (_WRS_BLIB_ALIGNMENT == 1 || _WRS_BLIB_ALIGNMENT == 0) + #define WV_UNALIGNED_SUPPORT + #endif +#endif /* defined (_WRS_BLIB_ALIGNMENT) */ + +#define EVT_STORE_UINT16(pBuf, event_id) \ + *pBuf++ = (event_id) + +#if (_BYTE_ORDER==_BIG_ENDIAN) + +# if defined WV_UNALIGNED_SUPPORT + /* unaligned access supported */ +# define EVT_STORE_UINT32(pBuf, value) \ + *pBuf++ = (value) +# else + /* unaligned access not supported */ +# define EVT_STORE_UINT32(pBuf, value) \ + do { *((short *) pBuf) = (value) >> 16; \ + *(((short *) pBuf) + 1) = (value); \ + pBuf++; } while (0) +# endif /* WV_UNALIGNED_SUPPORT */ + +#else /* (_BYTE_ORDER==_BIG_ENDIAN) */ + +# if defined WV_UNALIGNED_SUPPORT + /* unaligned access supported */ +# define EVT_STORE_UINT32(pBuf, value) \ + *pBuf++ = (value) +# else + /* unaligned access not supported */ +# define EVT_STORE_UINT32(pBuf, value) \ + do { *((short *) pBuf) = (value); \ + *(((short *) pBuf) + 1) = (value) >> 16; \ + pBuf++; } while (0) +# endif /* WV_UNALIGNED_SUPPORT */ + +#endif /* (_BYTE_ORDER==_BIG_ENDIAN) */ + +#endif /* CPU */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCeventph*/ + + + diff --git a/h/private/eventSysCall.h b/h/private/eventSysCall.h new file mode 100644 index 0000000..51fe851 --- /dev/null +++ b/h/private/eventSysCall.h @@ -0,0 +1,57 @@ +/* eventSysCall.h - VxWorks user event system call definitions */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,09mar04,hya created +*/ +#ifndef __INCeventSysCallh +#define __INCeventSysCallh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + +/* command codes for the eventCtl system call */ +typedef enum + { + VX_EVT_CTL_SEM_START, + VX_EVT_CTL_SEM_STOP, + VX_EVT_CTL_MQ_START, + VX_EVT_CTL_MQ_STOP, + VX_EVT_CTL_EVENT_CLEAR + } VX_EVT_CTL_CMD; + +/* argument structure for the eventCtl() system call */ + +typedef struct vx_rsc_event_start_args + { + UINT32 registered; /* 0x00: events registered for that resource */ + UINT32 options; /* 0x04: user options */ + } VX_SRC_EVENT_START_ARGS; + +/* system call function prototypes */ +extern STATUS eventSend (int taskId, UINT32 events); +extern STATUS eventReceive ( + UINT32 events, + UINT8 options, + int timeout, + UINT32 *eventsReceived + ); +extern STATUS eventCtl ( + OBJ_HANDLE handle, + VX_EVT_CTL_CMD command, + void * pArg, + UINT * pArgSize + ); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCeventSysCallh */ diff --git a/h/private/evtLogLibP.h b/h/private/evtLogLibP.h new file mode 100644 index 0000000..ce812d5 --- /dev/null +++ b/h/private/evtLogLibP.h @@ -0,0 +1,81 @@ +/* evtLogLibP.h - event log header */ + +/* Copyright 1994-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01p,21apr04,tcr add parameter to logging function +01o,05mar04,tcr add evtEdrErrorInject() +01n,11sep03,tcr tidy up function prototypes +01m,18jul03,tcr updates for Base6 +01l,29apr03,pes PAL conditional compilation cleanup. +01k,09may02,pcm added preceding underscore to ASMLANGUAGE +01j,18oct01,tcr update for VxWorks 5.5 +01i,17feb98,pr changed prototype for evtLogO and evtLogOInt. +01h,02feb98,nps Allow inclusion in (68k) assembler source. +01g,27jan98 cth added BEGIN, CONFIG, BUFFER, END sizes, added function + declarations, updated copyright +01f,31jul97 nps WindView 2.0 - + EVTLOG_STR_SIZE was incorrectly defined as 18, should be 22. +01e,14dec94 rdc mods for am29k. +01d,28nov94 rdc mods for x86. +01c,05may94,smb corrected macro name EVTLOG_T1_SIZE +01b,12jan94,c_s made EVTLOG_*_SIZE constants architecture-specific; commented + +maf them, and added definition of MAX_KERNEL_EVENT_SIZE. + SPR #2840. +01a,10dec93,smb written. +*/ + +#ifndef __INCevtloglibph +#define __INCevtloglibph + +#ifndef _ASMLANGUAGE +#ifdef __cplusplus +extern "C" { +#endif + +#include "private/wvBufferP.h" + +#endif /* !_ASMLANGUAGE */ + +/* defines */ + +#define MAX_WV_TASKS 500 /* should be the same MAX_DSP_TASKS */ + + +/* sizes of events with timestamps */ + +#define EVTLOG_TN_SIZE(nParam) (sizeof (short) + \ + sizeof (int) + nParam * sizeof (int)) + + +/* sizes of events without timestamps */ + +#define EVTLOG_MN_SIZE(nParam) (sizeof (short) + \ + nParam * sizeof (int)) + +#ifndef _ASMLANGUAGE + +/* function declarations */ + +extern void evtObjLogFuncBind (void); +extern void evtLogFuncBind (void); +extern void evtBufferBind (BUFFER_ID bufId); +extern void evtLogOInt (event_t action, int nParam, int arg1, int arg2, + int arg3, int arg4, int arg5, int arg6); +extern void evtLogO (event_t action, int nParam, int arg1, int arg2, + int arg3, int arg4, int arg5, int arg6); +extern int evtLogPoint (event_t action, void *addr, size_t nbytes, char *buf); + +extern void evtEdrErrorInject (event_t action, int kind, const char * fileName, + int lineNumber, const void * address, + const char * textPayload); + +#ifdef __cplusplus +} +#endif +#endif /* !_ASMLANGUAGE */ + +#endif /* __INCevtloglibph*/ + diff --git a/h/private/excLibP.h b/h/private/excLibP.h new file mode 100644 index 0000000..a8fd575 --- /dev/null +++ b/h/private/excLibP.h @@ -0,0 +1,63 @@ +/* excLibP.h - private exception handling subsystem header file */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01e,07jun05,yvp Added prototype for jobAdd(). Updated copyright. +01d,09mar05,yvp Added ISR_JOB definition. +01c,20jan05,yvp Reverted prototype for excInit(). +01b,25aug04,ans updated declaration of excInit() +01a,13nov01,yvp created. +*/ + +#ifndef __INCexcLibPh +#define __INCexcLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* defines */ + +#define ISR_JOB_MAX_ARGS 6 + +/* typedefs */ + +/* Structure describing ISR-level job deferral */ + +typedef struct + { + VOIDFUNCPTR func; /* pointer to function to invoke */ + int arg [ISR_JOB_MAX_ARGS]; /* args for function */ + } ISR_JOB; + +/* Select extended (32-bit) calls from the vector table to handlers */ + +extern BOOL excExtendedVectors; + +/* function declarations */ + +extern STATUS excVecInit (void); +extern STATUS excInit (int maxIsrJobs); +extern STATUS jobAdd (FUNCPTR func, int arg1, int arg2, int arg3, + int arg4, int arg5, int arg6, int * pResult); +extern STATUS jobExcAdd (VOIDFUNCPTR func, int arg1, int arg2, int arg3, + int arg4, int arg5, int arg6); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCexcLibPh */ diff --git a/h/private/fioLibP.h b/h/private/fioLibP.h new file mode 100644 index 0000000..75e9eba --- /dev/null +++ b/h/private/fioLibP.h @@ -0,0 +1,75 @@ +/* fioLibP.h - header for formatted i/o library */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01a,27Jul05,rhe written +*/ + +#ifndef __INCfioLibPh +#define __INCfioLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include + + +/* defines */ +#define FIO_HEX_X_SUPPORT /* fioFormatv support for %X */ +#define FIO_OCT_SUPPORT /* fioFormatv support for %o */ + + +#define NSIZE 16 + + +#define FIO_HEX 16 +#define FIO_OCT 8 +#define FIO_DEC 10 + +/* + * Choose PADSIZE to trade efficiency vs size. If larger printf fields occur + * frequently, increase PADSIZE (and make the initialisers below longer). + */ + +#define PADSIZE 16 /* pad chunk size */ + +#ifndef _ASMLANGUAGE + +/* typedefs */ + +typedef struct snputbuf_arg /* used by snprintf(), snputbuf() snprintf() */ + { + char *pBuf; /* running pointer to the next char */ + char *pBufEnd; /* pointer to buffer end */ + } SNPUTBUF_ARG; + +/* function declarations */ + +typedef enum fio_state + { + FIO_STATE_COLLECT = 0, /* Collect text rfrom the format string */ + FIO_STATE_TYPE_BASIC /* c d i o p s u X x % support */ + } FIO_STATE; + +extern STATUS fioBufPut (char *inbuf, int length, char ** outptr); +extern STATUS fioBufPrint (char *buf, int nbytes, int fd); +extern STATUS fioSnBufPut (char *pInBuf, int length, SNPUTBUF_ARG *pArg); +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfioLibh */ + diff --git a/h/private/floatioP.h b/h/private/floatioP.h new file mode 100644 index 0000000..c9d9518 --- /dev/null +++ b/h/private/floatioP.h @@ -0,0 +1,76 @@ +/* floatio.h - definitions for ANSI standard stdio module */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,22sep92,rrr added support for c++ +01a,29jul92,smb taken from UCB stdio library. +*/ + +#ifndef __INCfloatioPh +#define __INCfloatioPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)floatio.h 5.1 (Berkeley) 1/20/91 + * + * Floating point scanf/printf (input/output) definitions. + +INCLUDE FILE: + +SEE ALSO: American National Standard X3.159-1989 +*/ + +/* 11-bit exponent (VAX G floating point) is 308 decimal digits */ + +#define MAXEXP 308 + +/* 128 bit fraction takes up 39 decimal digits; max reasonable precision */ + +#define MAXFRACT 39 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfloatioPh */ diff --git a/h/private/ftpLibP.h b/h/private/ftpLibP.h new file mode 100644 index 0000000..107d368 --- /dev/null +++ b/h/private/ftpLibP.h @@ -0,0 +1,36 @@ +/* ftpLibP.h - private header for ftpLib */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,22sep92,rrr added support for c++ +01a,20sep92,kdl written. +*/ + +#ifndef __INCftpLibPh +#define __INCftpLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "ftpLib.h" + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS ftpLs (char *dirName); + +#else + +extern STATUS ftpLs (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCftpLibPh */ diff --git a/h/private/funcBindP.h b/h/private/funcBindP.h new file mode 100644 index 0000000..7bea8ef --- /dev/null +++ b/h/private/funcBindP.h @@ -0,0 +1,377 @@ +/* funcBindP.h - private function binding header */ + +/* + * Copyright (c) 1992-1998, 2000-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +04w,29sep05,kk removed deprecated message for excJobAdd (SPR# 111818) +04v,27sep05,kk added _func_fioFltFormatRtn and _func_fioFltScanRtn for + fioLib +04u,16aug05,gls added objOwnerLibfunction pointers +04t,12aug05,pes Add _func_dspProbe (conditional if _WRS_DSP_SUPPORT defined) +04s,08jul05,jln added _func_windTickAnnounceHook +04r,25jun05,jln Added _func_taskPxAttrSet/Get +04q,08jun05,yvp Reverted excExcepHook. +04p,07jun05,yvp Updated copyright. #include now with angle-brackets. +04o,07jun05,yvp Renamed _func_jobExcAdd to _func_jobTaskWorkAdd. +04n,27apr05,yvp Added _func_classListUnlock and _func_classListLock. +04m,26apr05,yvp Removed _func_eventInit and _func_eventRsrcShow. +04l,06apr05,yvp Added _func_event_* - decouple eventLib from sem's & msgQ's. +04k,18mar05,yvp Added _func_excExcepHook and _func_exit. +04j,05feb05,dlk Added _func_scMemValidate. +04i,10jan05,bpn Added _func_dbgRtpStop, _func_dbgRtpCont entries. +04h,16dec04,yvp Added _func_ioGlobalStdGet, _func_consoleOut & _func_event_*. + Added _func_isrCreate, _func_isrDelete. + Moved _func_isrDispatcher here from isrLib. +04g,23nov04,gls added _func_rtpSig entries +04f,03nov04,hya added _func_sigfillset +04e,06oct04,aeg added _func_jobExcAdd +04d,30sep04,lei added jobLibTaskInstalled +04c,29sep04,kk added _func_symTblShutdown & _func_symRegister +04b,27sep04,gls added _func_sdUnmapAll +04a,21sep04,zl added __rta_longjmp +03z,18sep04,jn Move toward shared code on host and target +03y,04sep04,dbt Fixed _func_excJobAdd declaration. +03x,02sep04,ans Added _func_jobAdd and deprecated _func_excJobAdd +03w,30aug04,dcc Added declaration of _func_objHandleToObjId. +03v,26aug04,ymz Added declaration of _func_rtpHandleIdGet. +03v,30aug04,jn Add function bindings for unldLib +03w,23sep04,ann Merge networking: Removed fastUdpInitialized var. +03v,23aug04,bpn Added _func_symEach, _func_symFindByName (SPR#100715). +03u,04aug04,sru Added declaration of _func_aimMmuLockRegionsImport. +03t,11jun04,pad Added declaration of _func_rtpPthreadSetCancelType. +03s,08jun04,md added loader function bindings +03r,17may04,pad Added declaration of _func_loadRtpSymsPolicyOverride. +03q,14may04,mil Added _func_mmuCacheFlushLoadAdrsGet. +03p,07may04,pad Added declarations of func_rtpShlSymbolsRegister and + _func_rtpShlSymbolsUnregister. +03p,30apr04,pad Added declaration of _func_shlRtpInfoGet. +03o,21apr04,cjj Added _func_workQDbgTextDump and cleaned up file. +03n,16apr04,kk added _func_shlRtpDeleteAll +03m,16apr04,yvp Added FUNCPTRS for rtpHookLib functions. +03l,09apr04,ans added _func_rtpTaskSigCheck +03k,07apr04,bpn Addded _func_shellExcPrint. +03j,29mar04,jn Add func pointer to allow use of kernel .o loader + without rtp loader +03i,17mar04,pad Added external declaration for _func_envGet. +03h,19feb04,yp adding _func_virtExtraMapInfoGet +03g,16dec03,syy Added func ptr _func_evtLogOBinary +03f,26nov03,jn Add _func_rtpIdVerify +03e,19nov03,kk remove rtpOrEdrInstalled +03d,13nov03,yp added declaration for _func_virtSegInfoGet +03c,10nov03,tam added _func_pgMgrPageAlloc _func_pgMgrPageMap + _func_pgMgrPageFree +03b,19sep03,aim added _func_edrEvt +03a,10sep03,dbs remove edrErrorInject funcptr +02z,06nov03,nrj added signal block func for RTP +02y,21oct03,nrj added RTP task exception signal functions +02x,16oct03,nrj added missing RTP signal funcs +02w,16oct03,nrj added support for RTP signal functions +02k,03nov03,tcr add WindView syscall logging rtn +02j,12sep03,tcr remove wvObjIsEnabled +02i,02sep03,tcr add funcptr for WindView +02h,22aug03,dbs ED&R merge to baseline +02g,18aug03,dbs add _func_edrErrorInject +02f,29jul03,dbs add _func_regsShow +02v,19sep03,pad Added declaration for _func_rtpSpawn +02u,19sep03,kk update comment on rtpOrEdrInstalled +02t,12sep03,kk added variable rtpOrEdrInstalled for scalability +02s,22aug03,dbs ED&R merge to baseline +02r,18aug03,dbs add _func_edrErrorInject +02q,29jul03,dbs add _func_regsShow +02p,01aug03,pch support coprocessor on PPC604/AltiVec for PPC32 +02o,10apr03,pes PAL Coprocessor Abstraction +02n,22jul03,pad Added external declaration for _func_rtpDelete. +02m,20mar03,wap added m2If64BitCounters (SPR #86776) +02l,28feb03,bpn Changed _func_bdall to _func_dbgTaskBpRemove. +02k,13jan03,rae Merged from velocecp branch +02j,21nov02,pch SPR 84107: add _func_altivecTaskRegsGet and _func_altivecProbe +02g,09jun03,dtr CP1 Merge. +02f,03sep02,dtr ADDED _func_speTaskRegsShow. +02i,26mar02,pai added _func_sseTaskRegsShow (SPR 74103). +02h,09nov01,jn added internal API for symLib +02g,29oct01,gls added pthread support +02f,26oct01,brk added _func_selPtyAdd & _func_selPtyDelete (SPR 65498) +02e,21sep01,aeg added _func_selWakeupListTerm. +02d,16mar01,pcs ADDED _func_altivecTaskRegsShow +02c,28feb00,frf Add SH support for T2 +02b,08aug98,kab added _func_dspRegsListHook, _func_dspMregsHook. +02a,23jul98,mem added _func_dspTaskRegsShow +01z,10aug98,pr added WindView function pointers for i960 +01y,15apr98,cth added definition of _func_evtLogReserveTaskName +01x,08apr98,pr added _func_evtLogT0_noInt. Set evtAction as UINT32 +01w,13dec97,pr moved some variables from eventP.h + removed some windview 1.0 variables +01v,13nov97,cth removed evtBuf and scrPad references for WV2.0 +01u,24jun97,pr added evtInstMode +01t,09oct97,ms added _func_ioTaskStdSet +01s,21feb97,tam added _dbgDsmInstRtn +01r,08jul96,pr added _func_evtLogT1_noTS +01q,12may95,p_m added _func_printErr, _func_symFindByValue, _func_spy* + _func_taskCreateHookAdd and _func_taskDeleteHookAdd. +01p,24jan94,smb added function pointers for windview portable kernel. +01o,10dec93,smb added function pointers for windview. +01n,05sep93,jcf added _remCurId[SG]et. +01m,20aug93,jmm added _bdall +01l,22jul93,jmm added _netLsByName +01k,13feb93,kdl added _procNumWasSet. +01j,13nov92,jcf added _func_logMsg. +01i,22sep92,rrr added support for c++ +01h,20sep92,kdl added _func_ftpLs, ftpErrorSuppress. +01g,31aug92,rrr added _func_sigprocmask +01f,23aug92,jcf added _func_sel*, _func_excJobAdd,_func_memalign,_func_valloc +01e,02aug92,jcf added/changed _exc*. +01d,29jul92,jcf added _func_fclose +01c,29jul92,rrr added _func_sigExcKill, _func_sigTimeoutRecalc, + _func_excEsfCrack and _func_excSuspend. +01b,19jul92,pme added _func_smObjObjShow. +01a,04jul92,jcf written +*/ + +#ifndef __INCfuncBindPh +#define __INCfuncBindPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* variable declarations */ + + +extern FUNCPTR _func_aimMmuLockRegionsImport; +extern FUNCPTR _func_classListUnlock; +extern FUNCPTR _func_classListLock; +extern FUNCPTR _func_consoleOut; +extern VOIDFUNCPTR _func_edrEvt; +extern FUNCPTR _func_eventReceive; +extern FUNCPTR _func_eventRsrcSend; +extern FUNCPTR _func_eventSend; +extern VOIDFUNCPTR _func_eventStart; +extern VOIDFUNCPTR _func_eventTerminate; +extern VOIDFUNCPTR _func_evtLogM0; +extern VOIDFUNCPTR _func_evtLogM1; +extern VOIDFUNCPTR _func_evtLogM2; +extern VOIDFUNCPTR _func_evtLogM3; +extern VOIDFUNCPTR _func_evtLogO; +extern VOIDFUNCPTR _func_evtLogOBinary; +extern VOIDFUNCPTR _func_evtLogOIntLock; +extern FUNCPTR _func_evtLogPoint; +extern FUNCPTR _func_evtLogReserveTaskName; +extern VOIDFUNCPTR _func_evtLogString; +extern VOIDFUNCPTR _func_evtLogSyscall; +extern VOIDFUNCPTR _func_evtLogT0; +extern VOIDFUNCPTR _func_evtLogT0_noInt; +extern VOIDFUNCPTR _func_evtLogT1; +extern VOIDFUNCPTR _func_evtLogT1_noTS; +extern VOIDFUNCPTR _func_evtLogTSched; +extern FUNCPTR _func_excBaseHook; +extern FUNCPTR _func_excInfoShow; +extern FUNCPTR _func_excIntHook; +extern FUNCPTR _func_excJobAdd; +extern FUNCPTR _func_jobExcAdd; +extern FUNCPTR _func_excPanicHook; +extern VOIDFUNCPTR _func_exit; +extern FUNCPTR _func_fastUdpErrorNotify; +extern FUNCPTR _func_fastUdpInput; +extern FUNCPTR _func_fastUdpPortTest; +extern FUNCPTR _func_fioFltFormatRtn; +extern FUNCPTR _func_fioFltScanRtn; +extern FUNCPTR _func_fclose; +extern FUNCPTR _func_ftpLs; +extern FUNCPTR _func_ioGlobalStdGet; +extern FUNCPTR _func_ioTaskStdSet; +extern FUNCPTR _func_isrCreate; +extern FUNCPTR _func_isrDelete; +extern FUNCPTR _func_isrDispatcher; +extern FUNCPTR _func_jobAdd; +extern FUNCPTR _func_jobTaskWorkAdd; +extern FUNCPTR _func_logMsg; +extern FUNCPTR _func_memalign; +extern FUNCPTR _func_netLsByName; +extern FUNCPTR _func_objHandleToObjId; +extern FUNCPTR _func_objOwnerListAdd; +extern FUNCPTR _func_objOwnerListRemove; +extern FUNCPTR _func_objOwnerReclaim; +extern FUNCPTR _func_objOwnerSetBaseInternal; +extern FUNCPTR _func_objOwnerSetInternal; +extern FUNCPTR _func_pgMgrPageAlloc; +extern FUNCPTR _func_pgMgrPageMap; +extern FUNCPTR _func_pgMgrPageFree; +extern FUNCPTR _func_printErr; +extern FUNCPTR _func_loadRtpDeltaBaseAddrApply; +extern FUNCPTR _func_loadRtpSymsPolicyOverride; +extern FUNCPTR _func_pthread_setcanceltype; +extern FUNCPTR _func_regsShow; +extern FUNCPTR _func_remCurIdGet; +extern FUNCPTR _func_remCurIdSet; +extern FUNCPTR _func_rtpDelete; +extern FUNCPTR _func_rtpIdVerify; +extern FUNCPTR _func_rtpPause; /* RTP pause function pointer */ +extern FUNCPTR _func_rtpSigaction; /* RTP sigaction function pointer */ +extern VOIDFUNCPTR _func_rtpSigExcKill; /* RTP task signal exception processing */ +extern FUNCPTR _func_rtpSigPendDestroy; /* RTP Signal pend dest function pointer */ +extern FUNCPTR _func_rtpSigpending; /* RTP sigpending function pointer */ +extern FUNCPTR _func_rtpSigPendInit; /* RTP Signal pend init function pointer */ +extern FUNCPTR _func_rtpSigPendKill; /* RTP Signal RTP Kill function pointer */ +extern FUNCPTR _func_rtpSigprocmask; /* RTP sigprocmask function pointer */ +extern FUNCPTR _func_rtpSigqueue; /* RTP sigqueue function pointer */ +extern FUNCPTR _func_rtpSigsuspend; /* RTP sigsuspend function pointer */ +extern FUNCPTR _func_rtpSigtimedwait; /* RTP sigtimedwait function pointer */ +extern FUNCPTR _func_rtpSpawn; +extern FUNCPTR _func_rtpTaskKill; +extern FUNCPTR _func_rtpTaskSigPendKill; /* RTP Signal RTP Task Kill function pointer */ +extern FUNCPTR _func_rtpTaskSigqueue; /* RTP Signal RTP Task queue function pointer */ +extern VOIDFUNCPTR _func_rtpTaskSigBlock; +extern FUNCPTR _func_rtpPreCreateHookAdd; +extern FUNCPTR _func_rtpPreCreateHookDelete; +extern FUNCPTR _func_rtpPostCreateHookAdd; +extern FUNCPTR _func_rtpPostCreateHookDelete; +extern FUNCPTR _func_rtpInitCompleteHookAdd; +extern FUNCPTR _func_rtpInitCompleteHookDelete; +extern FUNCPTR _func_rtpDeleteHookAdd; +extern FUNCPTR _func_rtpDeleteHookDelete; +extern FUNCPTR _func_rtpHandleIdGet; +extern FUNCPTR _func_rtpShow; +extern FUNCPTR _func_rtpShlSymbolsRegister; +extern FUNCPTR _func_rtpShlSymbolsUnregister; +extern FUNCPTR _func_rtpPthreadSetCancelType; +extern FUNCPTR _func_scMemValidate; +extern FUNCPTR _func_sdUnmapAll; +extern FUNCPTR _func_selPtyAdd; +extern FUNCPTR _func_selPtyDelete; +extern FUNCPTR _func_selTyAdd; +extern FUNCPTR _func_selTyDelete; +extern FUNCPTR _func_selWakeupAll; +extern FUNCPTR _func_selWakeupListInit; +extern FUNCPTR _func_selWakeupListTerm; +extern VOIDFUNCPTR _func_shlRtpDeleteAll; +extern FUNCPTR _func_shlRtpInfoGet; +extern VOIDFUNCPTR _func_sigExcKill; +extern FUNCPTR _func_sigprocmask; +extern FUNCPTR _func_sigfillset; +extern FUNCPTR _func_sigTimeoutRecalc; +extern FUNCPTR _func_smObjObjShow; +extern FUNCPTR _func_spy; +extern FUNCPTR _func_spyStop; +extern FUNCPTR _func_spyClkStart; +extern FUNCPTR _func_spyClkStop; +extern FUNCPTR _func_spyReport; +extern FUNCPTR _func_spyTask; +extern FUNCPTR _func_symEach; +extern FUNCPTR _func_symFindByName; +extern FUNCPTR _func_symFindByValueAndType; /* obsolete - do not use. */ +extern FUNCPTR _func_symFindByValue; /* obsolete - do not use. */ +extern FUNCPTR _func_symFindSymbol; +extern FUNCPTR _func_symNameGet; +extern FUNCPTR _func_symRegister; +extern FUNCPTR _func_symTblShutdown; +extern FUNCPTR _func_symValueGet; +extern FUNCPTR _func_symTypeGet; +extern FUNCPTR _func_taskCreateHookAdd; +extern FUNCPTR _func_taskDeleteHookAdd; +extern FUNCPTR _func_taskMemCtxSwitch; /* switch task memory context */ +extern FUNCPTR _func_taskStackAlloc; +extern FUNCPTR _func_taskStackFree; +extern FUNCPTR _func_tmrStamp; +extern FUNCPTR _func_tmrStampLock; +extern FUNCPTR _func_tmrFreq; +extern FUNCPTR _func_tmrPeriod; +extern FUNCPTR _func_tmrConnect; +extern FUNCPTR _func_tmrEnable; +extern FUNCPTR _func_tmrDisable; +extern VOIDFUNCPTR _func_trgCheck; +extern FUNCPTR _func_valloc; +extern FUNCPTR _func_virtSegInfoGet; +extern FUNCPTR _func_virtExtraMapInfoGet; +extern FUNCPTR _func_workQDbgTextDump; +extern FUNCPTR _func_moduleSegInfoGet; +extern FUNCPTR _func_kernelModuleListIdGet; +extern FUNCPTR _func_moduleIdFigure; +extern FUNCPTR _func_unldByModuleId; +extern FUNCPTR _func_taskPxAttrSet; +extern FUNCPTR _func_taskPxAttrGet; +extern FUNCPTR _func_windTickAnnounceHook; + +/* cache/MMU communication */ +extern FUNCPTR _func_mmuCacheFlushLoadAdrsGet; + +#if defined (_WRS_PAL_COPROC_LIB) +extern FUNCPTR _func_coprocShow; +extern FUNCPTR _func_coprocTaskRegsShow; +#if defined (_WRS_DSP_SUPPORT) +extern FUNCPTR _func_dspProbe; +#endif /* _WRS_DSP_SUPPORT */ +#else /* !_WRS_PAL_COPROC_LIB */ +IMPORT FUNCPTR _func_dspMregsHook; /* arch dependent mRegs() hook */ +IMPORT VOIDFUNCPTR _func_dspRegsListHook; /* arch dependent DSP regs list */ +extern FUNCPTR _func_dspTaskRegsShow; +extern FUNCPTR _func_fppTaskRegsShow; +extern FUNCPTR _func_sseTaskRegsShow; +#ifdef _WRS_ALTIVEC_SUPPORT +extern FUNCPTR _func_altivecTaskRegsGet; +extern FUNCPTR _func_altivecTaskRegsShow; +#endif /* _WRS_ALTIVEC_SUPPORT */ +#ifdef _WRS_SPE_SUPPORT +extern FUNCPTR _func_speTaskRegsShow; +#endif /* _WRS_SPE_SUPPORT */ +#endif /* _WRS_PAL_COPROC_LIB */ + +#ifdef _WRS_ALTIVEC_SUPPORT +extern FUNCPTR _func_altivecProbe; +#endif /* _WRS_ALTIVEC_SUPPORT */ + +extern FUNCPTR excExcepHook; + +extern FUNCPTR _dbgDsmInstRtn; + +/* Memory partition/class Id's */ + +extern CLASS_ID memPartClassId; /* partition class id */ +extern PART_ID memSysPartId; /* sys partition id */ + +extern BOOL ftpErrorSuppress; +extern BOOL _procNumWasSet; +extern int m2If64BitCounters; + +extern UINT32 evtAction; +extern UINT32 wvEvtClass; +extern UINT32 trgEvtClass; +extern FUNCPTR _func_rtpTaskSigCheck; /* RTP task signal check */ + +/* envLib */ + +extern FUNCPTR _func_envGet; + +/* Shell routines */ + +extern VOIDFUNCPTR _func_shellExcPrint; + +/* hook for RTC support */ + +extern VOIDFUNCPTR __rta_longjmp; + +/* check whether job task exists */ + +extern BOOL jobLibTaskInstalled; + +/* Debug routines */ + +extern FUNCPTR _func_dbgRtpStop; /* stop an RTP */ +extern FUNCPTR _func_dbgRtpCont; /* continue an RTP */ +extern FUNCPTR _func_dbgTaskBpRemove; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfuncBindPh */ diff --git a/h/private/fvwriteP.h b/h/private/fvwriteP.h new file mode 100644 index 0000000..93c31aa --- /dev/null +++ b/h/private/fvwriteP.h @@ -0,0 +1,85 @@ +/* fvwriteP.h - definitions for the ANSI stdio library */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,22sep92,rrr added support for c++ +01a,29jul92,smb taken from UCB stdio library +*/ + +#ifndef __INCfvwritePh +#define __INCfvwritePh + +#ifdef __cplusplus +extern "C" { +#endif + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)fvwrite.h 5.1 (Berkeley) 1/20/91 + +SEE ALSO: American National Standard X3.159-1989 +*/ + +/* I/O descriptors for __sfvwrite(). */ + +struct __siov + { + void * iov_base; + size_t iov_len; + }; + +struct __suio + { + struct __siov *uio_iov; + int uio_iovcnt; + int uio_resid; + }; + +#if defined(__STDC__) || defined(__cplusplus) +extern int __sfvwrite(FILE *, struct __suio *); +#else +extern int __sfvwrite(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfvwritePh */ diff --git a/h/private/handleLibP.h b/h/private/handleLibP.h new file mode 100644 index 0000000..9248b0f --- /dev/null +++ b/h/private/handleLibP.h @@ -0,0 +1,90 @@ +/* handleLibP.h - handle management library header */ + +/* Copyright 1998-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,02mar04,dcc modified attributes to be 16 bits wide. +01c,02nov03,dcc modified HANDLE to comply with ANSI standards. +01b,02jul03,to added offsets into HANDLE. +01a,23jun03,dcc ported from AE1.1 +*/ + +#ifndef __INChandleLibPh +#define __INChandleLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + +#ifndef _ASMLANGUAGE + +/* typedefs */ + +enum handleContextType + { + handleContextTypeNone = 0, + handleContextTypeUser, + handleContextTypeOms, + handleContextTypeCOM, + handleContextTypeI2O + }; + +typedef struct + { + void * context; /* 0x00: WRS defined context */ + UINT32 magic; /* 0x04: magic. Used in HANDLE_VERIFY() */ + UINT16 attributes; /* 0x08: attribute bit set */ + INT8 type; /* 0x0a: enum windObjClassType */ + UINT8 contextType; /* 0x0b: enum handleContextType */ + } HANDLE; + +typedef HANDLE * HANDLE_ID; /* handle id */ + +/* function declarations */ + +extern STATUS handleContextGet (HANDLE_ID handleId, void **pContext, + enum handleContextType *pContextType); +extern void handleContextGetBase (HANDLE_ID handleId, void **pContext, + enum handleContextType *pContextType); +extern STATUS handleContextSet (HANDLE_ID handleId, void *context, + enum handleContextType contextType); +extern STATUS handleInit (HANDLE_ID handleId, enum handleType); +extern STATUS handleVerify (HANDLE_ID handleId, enum handleType); +extern STATUS handleTerminate (HANDLE_ID handleId); +extern STATUS handleShow (HANDLE_ID handleId, int showType); +extern STATUS handleShowConnect (enum handleType, FUNCPTR showRtn); +extern enum handleType handleTypeGet (HANDLE_ID handleId); + +/* macro declarations */ + +#define HANDLE_VERIFY(handle,handleType) \ + ( \ + ( \ + (((HANDLE_ID) (handle))->magic == (unsigned)(handle)) \ + && \ + (((HANDLE_ID) (handle))->type == (handleType)) \ + ) \ + ? \ + OK \ + : \ + ERROR \ + ) + +#else /* _ASMLANGUAGE */ + +/* offsets into HANDLE */ + +#define HANDLE_MAGIC 0x4 +#define HANDLE_TYPE 0xa + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INChandleLibPh */ diff --git a/h/private/hashLibP.h b/h/private/hashLibP.h new file mode 100644 index 0000000..97549ee --- /dev/null +++ b/h/private/hashLibP.h @@ -0,0 +1,42 @@ +/* hashLibP.h - private hash table library header */ + +/* Copyright 1998-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,26jun03,to ported form AE1.1. +*/ + +#ifndef __INChashLibPh +#define __INChashLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "sllLib.h" +#include "private/handleLibP.h" + +/* size of hash table given number of elements in hash table log 2 */ + +#define HASH_TBL_SIZE(sizeLog2) \ + (((1 << (sizeLog2)) * sizeof (SL_LIST)) + sizeof (HASH_TBL)) + +/* type definitions */ + +typedef struct hashtbl /* HASH_TBL */ + { + HANDLE handle; /* handle management */ + int elements; /* number of elements in table */ + FUNCPTR keyCmpRtn; /* comparator function */ + FUNCPTR keyRtn; /* hash function */ + int keyArg; /* hash function argument */ + SL_LIST * pHashTbl; /* pointer to hash table array */ + } HASH_TBL; + +#ifdef __cplusplus +} +#endif + +#endif /* __INChashLibPh */ diff --git a/h/private/hrFsLibP.h b/h/private/hrFsLibP.h new file mode 100644 index 0000000..11bd519 --- /dev/null +++ b/h/private/hrFsLibP.h @@ -0,0 +1,379 @@ +/* hrfsLibP.h - Highly reliabe file system private header file */ + +/* + * Copyright 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* modification history +-------------------- +02n,04aug05,jlk Moved formatter function pointer, hrfsFmtRtn, to hrFsLib.h +02m,22jul05,jlk code review changes +02l,18jul05,jlk Added formatter function pointer, hrfsFmtRtn +02k,28jun05,jlk clean-up and added diskModified flag to volume descriptor +02j,17jun05,jlk removed prototype for hrfsXbdSyncDone() +02i,17may05,pcm added hrfsTransactionRollback() +02h,29apr05,jlk moved in CRC #defines from hrFsSuperBlk.c. Added inode state + defines. Fixed bug where the generation field in the inode was + defined to be 8 bytes instead of 4. Added field to + inode. Added some prototypes. +02g,25apr05,jlk moved version #defines and id string to hrFsLib.h and fixed + endian check +02f,21apr05,jlk added freeInodes and freeDataBlks fields to TMR. Re-arranged + volume descriptor for alignment purposes and removed unused + fields. Added prototypes for hrfsMount() and hrfsStat() +02e,15apr05,pcm added field to HRFS_TMR +02d,15apr05,act add a dirSlot to HRFS_INODE (incore inode) +02c,14apr05,pcm changed INODE_JOURNAL_ENTRIES from 4 to 7 +02b,14apr05,pcm removed HRFS_MODE_BIT_xxx; the S_IFxxx definitions to be used +02a,11apr05,pcm changed DIRENT's field fileName string size to + HRFS_DIRENT HRFS_MAX_FILENAME_LEN + 1 +01z,24mar05,jlk added prototype for hrfsCommit() +01y,23mar05,jlk debug stuff and moved nBlocks field in inode structure +01x,21mar05,jlk moved nBlocks field in inode structure for alignment reasons +01v,21mar05,jlk fixed bug in big endian versions of htodll and dtohll macros + and added padding to super block structure to make the size + a multiple of 8. +01u,16mar05,pcm changed parameters to hrfsInodeGet() +01t,15mar05,pcm made htodll() a function call to htodll_le() for little endian +01s,15mar05,pcm reworked htodll() and dtohll() macros +01r,10mar05,act remove unwanted data from HRFS_DEV +01q,08mar05,jlk fixed up for new mount code +01p,08mar05,jlk changed prototype for hrfsInodeAlloc() +01o,07mar05,pcm added VTOI macro and various function prototypes +01n,07mar05,jlk added mode bits for inode +01m,01mar05,jlk removed pointer to the inode journal to + HRFS_VOLUME_DESC. Added some more prototypes. +01l,28feb05,pcm added HRFS_INODE_ROOT_DIR +01k,25feb05,pcm changed iNodeNunber to iNodeNumber in INODE_JOURNAL +01j,24feb05,pcm added mount.h to includes, and new fields to HRFS_VOLUME_DESC +01i 24feb05,jlk added nBlocks and reserved fields to inode structure +01h 23feb05,jlk added a pointer to the inode journal to HRFS_VOLUME_DESC. + added transaction numbers to HRFS_VOLUME_DESC +01g 11feb05,pcm added HRFS_TMR structure, and fields to HRFS_VOLUME_DESC +01f,09feb05,jlk added sectorsPerBlk & sectorsPerBlk2 fields to the + HRFS_VOLUME_DESC structure +01e,03feb05,pcm changed HRFS_SUPER_BLOCK field in HRFS_VOLUME_DESC to a ptr +01c,03feb05,jlk updated inode struct to include an on-disk and an in-memory + version +01b,26jan05,pcm added HRFS_DEV structure +01a,21jan05,jlk written +*/ + +#ifndef __INChrfsLibP +#define __INChrfsLibP + +#include +#include +#include +#include +#include +#include + +/* defines */ +/*#define HRFS_DEBUG*/ + +#ifdef HRFS_DEBUG +#define HRFS_DEBUGM(x) x +#else +#define HRFS_DEBUGM(x) +#define hrfsInodePrint(x,y) +#define hrfsPrintSuperBlk(x) +#define hrfsPrintSuperBlkRaw(x) +#define hrfsPrintBmp(x,y) +#endif + +/* The number of inodes in the journal */ +#define INODE_JOURNAL_ENTRIES 7 + +/* The number that represents an invalid block */ +#define INVALID_BLK_NUM ((UINT32)(-1)) + +#define HRFS_VOLUME_MAGIC (0x00a87cb7) + +/* CRC */ +#define HRFS_INTIAL_CRC32 0xffffffff /* Initial 32 bit FCS value */ +#define HRFS_GOOD_CRC32 0xdebb20e3 /* Good final 32 bit FCS value */ + +/* Inode states */ +#define HRFS_INODE_STATE_FREE 0xFF +#define HRFS_INODE_STATE_ALLOC 0xFE +#define HRFS_INODE_STATE_TO_BE_DEL 0xFC + +/* Reserved inode numbers */ +#define INODE_START_NUMBER 2 +#define HRFS_INODE_ROOT_DIR INODE_START_NUMBER + + +/* Macro to get inode from vnode */ +#define HRFS_VTOI(ip,vnp) \ + ip = (VTODATA(HRFS_INODE, vnp)); \ + ip->iNodeNumber = vnp->v_inode; + + +/* + * Byte swap macros for converting in memory representations to disk + * representations for various types. + */ + +/* Use network macros for shorts and longs */ +#define dtohs ntohs +#define dtohl ntohl +#define htods htons +#define htodl htonl +/* For long, longs or 64 bit quantities we need our own macros */ +#if (_BYTE_ORDER == _BIG_ENDIAN) +/* + * Nothing to do for big endian targets since HRFS on-disk format is big endian + */ +#define dtohll(x) (x) +#define htodll(x) (x) + +#else /* Handle little endian case */ + +extern UINT64 htodll_le (UINT64); + +#define htodll(x) htodll_le(x) +#define dtohll(x) htodll(x) + +#endif /* _BYTE_ORDER==BIG_ENDIAN */ + +/* + * Macro to determine the numnber of inodes per block based on a 64 byte sized + * inode + */ +#define INODES_PER_BLK(bsize) ((bsize) >> 6) + +/* Macro to round up the number of inodes based on inodes per block */ +#define NUM_INODES_UP(iperblk, ni) ((iperblk) + (((ni) - 1) & (-(iperblk)))) + +/* + * Macro to convert bytes to blocks based on a block size specified as a power + * of 2 + */ +#define BYTES_TO_BLKS(bytes, blkSize2) ((bytes) >> (blkSize2)) + +/* + * enums + */ + +enum HRFS_VOL_STATE + { + HRFS_VOLUME_DEAD, + HRFS_VOLUME_CREATED, + HRFS_VOLUME_MOUNTED, + HRFS_VOLUME_DYING + }; + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * typedefs + */ + +/* The type used to represent a file's size. 64 bits, unsigned */ +typedef INT64 fsize_t; + +/* The type used to represent the generation number of an inode */ +typedef UINT32 fgen_t; + +/* Types used to represent the file owners' UID and GID values */ +typedef UINT32 fid_t; + +/* Type used to represent the number of hard links to a file */ +typedef UINT16 linkCount_t; + +/* Type used to represent the mode bits of a file */ +typedef UINT16 fmode_t; + +/* HRFS Volume State type */ +typedef enum HRFS_VOL_STATE HRFS_VOL_STATE; + +/* The on-disk representation of an HRFS inode */ +typedef struct hrfs_inode_disk_struct + { + hrfsTime_t ctime; /* The last time the file attributes */ + /* (inode) were changed. */ + hrfsTime_t mtime; /* The last time the file data was changed */ + fsize_t size; /* The size of the file */ + fgen_t generation; /* # of times inode has been allocated */ + fid_t uid; /* UID of value of the owner of the file */ + fid_t gid; /* GID of value of the owner of the file */ + UINT32 nBlocks; /* The number of blocks associated with inode */ + UINT32 direct; /* Direct block references */ + UINT32 indirect; /* Indirect block references */ + UINT32 indirect2; /* Doubly indirect block references */ + UINT32 indirect3; /* Triply indirect block references */ + linkCount_t linkCount; /* Number of hard links to file */ + fmode_t mode; /* Mode bits for file */ + u_char state; /* State: free, allocated, to be deleted */ + char reserved[3]; /* Pad out size to 64 bytes */ + } _WRS_PACK_ALIGN(1) HRFS_DISK_INODE, * HRFS_DISK_INODE_PTR; + +/* The in-memory representation of an HRFS inode */ +typedef struct hrfs_inode_struct + { + HRFS_DISK_INODE iNodeData; + UINT32 iNodeNumber; + UINT32 dirSlot; /* directory slot from lookup op */ + } HRFS_INODE, * HRFS_INODE_PTR; + +/* The representation of the HRFS inode journal */ +typedef struct hrfs_inode_journal_struct + { + UINT64 transNumber; /* Transaction #. */ + UINT32 iNodeNumber[INODE_JOURNAL_ENTRIES]; /* I-Node #s. */ + char reserved[28]; /* For alignment. */ + HRFS_DISK_INODE iNodeData[INODE_JOURNAL_ENTRIES]; /* Inode data */ + } _WRS_PACK_ALIGN(1) HRFS_INODE_JOURNAL, * HRFS_INODE_JOURNAL_PTR; + + +typedef struct hrfs_tmr /* HRFS Transaction Master Record */ + { + UINT64 transNumber; /* HRFS transaction number */ + UINT64 timeStamp; /* HRFS timestamp */ + UINT32 numInodesToDelete; + UINT32 numFreeInodes; + UINT32 numFreeDataBlocks; + UINT32 spare; + } _WRS_PACK_ALIGN(1) HRFS_TMR; + +/* + * The representation of the HRFS Super Block. The size of this structure must + * be a multiple of 8 + */ +typedef struct hrfs_super_block_struct + { + char idString[8]; /* Identification or eyecatcher string */ + INT64 ctime; /* time at which superblock was created. */ + UINT8 majorVers; /* Major version number */ + UINT8 minorVers; /* Minor version number */ + UINT16 blkSize2; /* Block size as a power of 2. */ + UINT32 totalBlks; /* Total # of blocks in fs (including offset). */ + + UINT32 reservedBlks; /* Size of the reserved space at */ + /* the start of the media. */ + + UINT32 iNodeCount; /* The number of iNodes this file */ + /* system instantiation has. */ + + UINT32 bgSize; /* Block group size (=dsSize + 1 for 1st iter) */ + UINT32 dsSize; /* Data space size (=bgSize - 1 for 1st iter) */ + UINT32 nBlkGroups; /* Number of block groups. (1 for 1st iteration) */ + + UINT32 fsbOff[2]; /* 1st & 2nd free space bitmap offsets */ + UINT32 fibOff[2]; /* 1st & 2nd free inode bitmap offsets */ + + UINT32 itOff; /* inode table offset */ + UINT32 ijOff; /* inode journal offset */ + + UINT32 tmOff[2]; /* 1st & 2nd transaction map offsets */ + UINT32 tmrOff[2]; /* 1st & 2nd transaction master record offsets */ + + UINT32 dsOff; /* data space offset */ + UINT32 pad; /* pad out structure */ + UINT32 crc; /* superblock CRC */ + } _WRS_PACK_ALIGN(1) HRFS_SUPER_BLOCK, * HRFS_SUPER_BLOCK_PTR; + +/* HRFS directory entry */ +typedef struct hrfs_dirent + { + UINT32 iNodeNumber; /* iNode corresponding to file */ + unsigned char fileName[HRFS_MAX_FILENAME_LEN + 1]; /* File Name */ + } _WRS_PACK_ALIGN(1) HRFS_DIRENT, * HRFS_DIRENT_PTR; + +/* + * Fields that describe the physical layout of the backing media, + * try to go in the volume descriptor. + */ + +typedef struct hrfs_volume_desc /* HRFS volume descriptor structure */ + { + u_int magic; /* value: HRFS_VOLUME_MAGIC */ + HRFS_VOL_STATE state; /* Created/Mounted/Dying/Dead */ + BOOL diskModified; /* Set to TRUE when HRFS modifies */ + /* the disk */ + HRFS_SUPER_BLOCK * pSuperBlk; /* HRFS Super Block */ + device_t device; /* device associated with volume */ + sector_t nSectors; /* # of sectors on backing media */ + UINT32 sectorSize; /* sector size of backing media */ + UINT32 sectorsPerBlk; /* The number of sectors in a block */ + UINT32 sectorsPerBlk2; /* The number of sectors in a block */ + /* as a power of 2 */ + UINT32 blkSize; /* block size in bytes */ + UINT32 blkCount; /* # of blocks */ + int validTransSet; /* valid transaction set: 0 or 1 */ + UINT64 validTransNo; /* The transaction number of the */ + /* last set transaction point */ + UINT64 workingTransNo; /* The transaction number of the */ + /* current transaction. */ + UINT32 numInodesToDelete; + UINT32 freeInodes; + UINT32 freeDataBlks; + struct mount * pMount; + UINT32 tmRead[2]; /* [0]: FSB, [1]: FIB */ + UINT32 tmWrite[2]; /* [0]: FSB, [1]: FIB */ + } HRFS_VOLUME_DESC; + +typedef struct hrfs_dev /* HRFS device structure */ + { + HRFS_VOLUME_DESC hrfsVolDesc; /* HRFS Volume Descriptor */ + + u_char * pSectorData; /* sector scratch-pad */ + SEM_ID bioSem; /* Binary semaphore for BIO/XBD calls */ + } HRFS_DEV; + +/* externs */ +extern STATUS hrfsSuperBlockRd (HRFS_DEV * devPtr); +extern UINT32 hrfsCksum (char * data, UINT32 crcIn, UINT32 size); +extern int hrfsInodePut(struct vnode *, HRFS_DEV *, HRFS_INODE_PTR); +extern int hrfsInodeJournalUpdate(struct vnode *, HRFS_DEV *, HRFS_INODE_PTR); + +extern int hrfsInodeGet (struct vnode *); +extern int hrfsInodeAlloc (HRFS_DEV *, HRFS_INODE *, struct vattr *); +extern int hrfsDataBlockAlloc (HRFS_DEV *, UINT32 *); +extern int hrfsDataBlockFree (HRFS_DEV *, UINT32); +extern int hrfsInodeFree (HRFS_DEV *, UINT32); + +extern int hrfsCommit (struct mount *); +extern int hrfsMount (struct mount *); +extern int hrfsStat (struct mount *, struct statvfs *); + +extern int hrfsInodeGetInternal (struct vnode *, HRFS_VOLUME_DESC *, + HRFS_INODE *); +extern void hrfsInodeDiskHostConvert (HRFS_DISK_INODE *, HRFS_DISK_INODE *); +extern int hrfsTransactionRollback (struct mount *); + +extern void hrfsFreeBufs (struct buf * pTrieBuf[], int start, int end); +extern int hrfsTrieFindPhys (struct vnode * syncer_vp, UINT32 lbn, + HRFS_INODE_PTR iNodePtr, + HRFS_VOLUME_DESC * pVolDesc, UINT32 * pPbn, + struct buf * pTrieBuf[3]); +extern void hrfsVopInternalReadStrategy (struct vnode * pSyncer, + struct buf * pBuf, + struct buf * pTrieBuf[], + UINT32 pbn); +extern int hrfsDirEntFromSlot (struct vnode * pDirVnode, + struct buf ** pOutBuf, + HRFS_DIRENT ** pOutDirEnt); + +extern UINT32 hrfsBitGet(unsigned char *, UINT32); + +#ifdef HRFS_DEBUG +extern void hrfsInodePrint (HRFS_INODE_PTR, char *); +extern void hrfsPrintSuperBlk (HRFS_SUPER_BLOCK_PTR); +extern void hrfsPrintSuperBlkRaw (HRFS_SUPER_BLOCK_PTR); +extern void hrfsPrintBmp (unsigned char *, UINT32); +#endif + +#ifdef __cplusplus + } +#endif + +#endif /* __INChrfsLibP */ + diff --git a/h/private/iosLibP.h b/h/private/iosLibP.h new file mode 100644 index 0000000..5175bac --- /dev/null +++ b/h/private/iosLibP.h @@ -0,0 +1,304 @@ +/* iosLibP.h - private I/O system header file */ + +/* + * Copyright (c) 1992-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + + +/* +modification history +-------------------- +01r,21jul05,tcr add System Viewer instrumentation +01q,13jul05,hya made removability change. +01p,13apr05,hya removed iosFdEntryXXX call from iosXXXInLine. +01o,01mar05,hya change for user memory validation in ioctl +01n,24jan05,aeg added prototypes for iosRtpFdReserve, etc. (SPR #106381). +01m,28apr04,dat remove iosCloseInLine(), 96826 +01l,27feb04,dat merging iosLib with rtpIoLib +01k,17feb04,dat separating public/private APIs +01j,05jan04,dat 92873, improved test for valid FD_ENTRY +01i,21nov03,dat adding new refCnt macros, removing obsolete, auxValue, + and reserved fields from FD_ENTRY. +01h,11nov03,dat refactored routines +01g,27oct03,dat Adding RTP ios support, new fields +01f,20jun03,ymz added iosObjIdFdGet and iosFdObjIdGet prototype. +01e,02apr03,ymz objectized FDs. +01d,22dec98,lrn add more fields to FD_ENTRY, added obsolete state +01c,09nov93,rrr added aio support +01b,22sep92,rrr added support for c++ +01a,23aug92,jcf written. +*/ + +#ifndef __INCiosLibPh +#define __INCiosLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "private/classLibP.h" +#include "private/objLibP.h" +#include "private/kernelBaseLibP.h" +#include "iosLib.h" +#include "dllLib.h" +#include "errnoLib.h" +#include "poolLib.h" +#include "taskLib.h" /* for taskIdCurrent */ + +/* typedefs */ + +typedef struct drvEntry /* DRV_ENTRY - entries in driver jump table */ + { + FUNCPTR de_create; + FUNCPTR de_delete; + FUNCPTR de_open; + FUNCPTR de_close; + FUNCPTR de_read; + FUNCPTR de_write; + FUNCPTR de_ioctl; + FUNCPTR de_ioctlMemValidate; + BOOL de_inuse; + } DRV_ENTRY; + +/* DEV_HDR structure is in ioLib.h */ + +typedef struct fdObjEntry /* FD_ENTRY - entries in file table */ + { + OBJ_CORE objCore; /* FDs are objects */ + DEV_HDR * pDevHdr; /* device header for this file */ + void * value; /* driver open file cookie, maybe reloaded */ + void * driverCookie; /* driver open file cookie */ + volatile int refCnt; /* reference count */ + DRV_ENTRY * pDrvEntry; /* dev driver, remove support, invalidated fd drv */ + DRV_ENTRY * pDevDrvEntry; /* device driver entry slot pointer */ + } FD_ENTRY; + +/* macros */ + +#define fdClassId (&fdClass) +#define fdInstClassId (&fdInstClass) + +#define FD_RESERVED ((FD_ENTRY *)-1) +#define FD_ENTRY_VALID(pFd) \ + ((pFd) != NULL && (pFd) != FD_RESERVED) + +/* + * FD_ENTRY_LINK cannot be used to initialize the refCnt to 1, + * once the count reaches zero, it stays at zero. + */ + +#define FD_ENTRY_LINK(pFd) \ + do { \ + if ((pFd)->refCnt > 0) \ + (pFd)->refCnt += 1; \ + } while ((0)) + +#define FD_ENTRY_UNLINK(pFd) \ + do { \ + if ((pFd)->refCnt > 0) \ + (pFd)->refCnt -= 1; \ + } while ((0)) + +/* variable declarations */ + + +IMPORT OBJ_CLASS fdClass; +IMPORT char ioDefPath[]; +IMPORT DL_LIST iosDvList; +IMPORT int iosMaxDrivers; +IMPORT DRV_ENTRY * drvTable; +IMPORT int iosMaxFiles; +IMPORT FD_ENTRY ** iosFdTable; +IMPORT POOL_ID iosFdEntryPool; + +/* functions that are available but not public */ + +IMPORT int iosObjIdFdGet (OBJ_ID objId); +IMPORT OBJ_ID iosFdObjIdGet (int fd); + +/* Refactored routines to be more obj oriented these are PRIVATE */ + +IMPORT int iosKernelFdFind (void); +IMPORT int iosFdEntryIoctl (FD_ENTRY *, int cmd, int arg, BOOL sc); + +IMPORT STATUS iosFdEntrySet (FD_ENTRY *, DEV_HDR * pDevHdr, + const char* name, int value); +IMPORT FD_ENTRY *iosFdEntryGet (void); +IMPORT STATUS iosFdEntryReturn (FD_ENTRY *); + +IMPORT void iosLock (void); +IMPORT void iosUnlock (void); + +IMPORT int iosRtpFdReserve (RTP_ID pRtp); +IMPORT STATUS iosRtpFdUnmap (RTP_ID pRtp, int fd); +IMPORT STATUS iosRtpFdSetup (RTP_ID pRtp, FD_ENTRY * pFdEntry, int fd, + DEV_HDR * pDevHdr, const char * name, int value); +IMPORT STATUS iosRtpDefPathSet (RTP_ID pRtp, const char * pBuff); +IMPORT int iosRtpFdReserve (RTP_ID pRtp); +IMPORT STATUS iosRtpDefPathGet (RTP_ID pRtp, char * pBuff, size_t length); +IMPORT STATUS iosRtpFdEntryMap (RTP_ID pRtp, int fd, FD_ENTRY * pFdEntry); +IMPORT size_t iosRtpFdTableSizeGet (RTP_ID pRtp); + +/* Routines that used to be in iosLib.h, now 'private' */ + +IMPORT int iosOpen (DEV_HDR *pDevHdr, const char *fileName, + int flags, int mode); +IMPORT int iosCreate (DEV_HDR *pDevHdr, const char *fileName, int mode); +IMPORT int iosDelete (DEV_HDR *pDevHdr, const char *fileName); +IMPORT int iosIoctl (int fd, int function, int arg); +IMPORT int iosRead (int fd, char *buffer, int maxbytes); +IMPORT int iosWrite (int fd, char *buffer, int nbytes); +IMPORT STATUS iosClose (int fd); + +IMPORT STATUS iosFdSet (int fd, DEV_HDR *pDevHdr, const char *name, + int value); +IMPORT FD_ENTRY* iosFdMap (int fd); +extern STATUS iosFdInvalid (DEV_HDR *pDevHdr); +extern STATUS iosDrvIoctlMemValSet (int drvnum, FUNCPTR pIoctlMemVal); +extern STATUS iosDrvIoctl (int drvNum, int function, int arg); + +/* inline functions for speed (in ioLib.c) */ + +_WRS_INLINE +STATUS iosCreateInLine + ( + DEV_HDR * pDevHdr, + const char * fileName, + int flags + ) + { + FUNCPTR drvCreate = ((DRV_ENTRY *)pDevHdr->pDrvEntry)->de_create; + + return (*drvCreate)(pDevHdr, fileName, flags); + + } + +_WRS_INLINE +STATUS iosOpenInLine + ( + DEV_HDR * pDevHdr, + const char *fileName, + int mode, + int flags + ) + { + FUNCPTR drvOpen = ((DRV_ENTRY *)pDevHdr->pDrvEntry)->de_open; + + return (*drvOpen)(pDevHdr, fileName, mode, flags); + + } + +_WRS_INLINE +int iosDeleteInLine + ( + DEV_HDR * pDevHdr, + const char *fileName + ) + { + FUNCPTR drvDelete = ((DRV_ENTRY *)pDevHdr->pDrvEntry)->de_delete; + + return ((*drvDelete)(pDevHdr, fileName)); + + } + + +_WRS_INLINE +int iosReadInLine + ( + int fd, + char *buffer, + int maxbytes + ) + { + FD_ENTRY *pFdEntry; +#ifdef WV_INSTRUMENTATION + int result; +#endif /* WV_INSTRUMENTATION */ + + if ((pFdEntry = iosFdMap(fd)) == NULL) + return (ERROR); + +#ifdef WV_INSTRUMENTATION + result = (* pFdEntry->pDrvEntry->de_read) + (pFdEntry->value, buffer, maxbytes); + EVT_OBJ_STR_3 (pFdEntry, fdClassId, EVENT_IOREAD, fd, result, buffer, + min (result, 16), buffer); + return result; +#else /* WV_INSTRUMENTATION */ + return ((* pFdEntry->pDrvEntry->de_read) + (pFdEntry->value, buffer, maxbytes)); + +#endif /* WV_INSTRUMENTATION */ + } + +_WRS_INLINE +int iosWriteInLine + ( + int fd, + char *buffer, + int nbytes + ) + { + FD_ENTRY *pFdEntry; + + if ((pFdEntry = iosFdMap (fd)) == NULL) + return (ERROR); + +#ifdef WV_INSTRUMENTATION + EVT_OBJ_STR_3 (pFdEntry, fdClassId, EVENT_IOWRITE, fd, nbytes, buffer, + min (nbytes,16), buffer); +#endif + return ((* pFdEntry->pDrvEntry->de_write) + (pFdEntry->value, buffer, nbytes)); + } + +_WRS_INLINE +int iosIoctlInLine + ( + int fd, + int cmd, + int arg, + BOOL syscall + ) + { + FD_ENTRY *pFdEntry; + + if ((pFdEntry = iosFdMap (fd)) == NULL) + return (ERROR); + +#ifdef WV_INSTRUMENTATION + EVT_OBJ_3 (pFdEntry, fdClassId, EVENT_IOIOCTL, + arg, cmd, fd); +#endif + + return iosFdEntryIoctl (pFdEntry, cmd, arg, syscall); + } + +_WRS_INLINE +int iosCloseInLine + ( + int fd + ) + { + if (taskIdCurrent->rtpId == kernelId + && fd >= 0 && fd <= 2) + { + fd = ioTaskStdGet (0, fd); + } + return iosRtpFdUnmap (taskIdCurrent->rtpId, fd); + } + +/* APIs that no longer exist */ + +IMPORT VOIDFUNCPTR iosFdNewHookRtn _WRS_DEPRECATED("no longer exists"); +IMPORT VOIDFUNCPTR iosFdFreeHookRtn _WRS_DEPRECATED("no longer exists"); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCiosLibPh */ diff --git a/h/private/isrLibP.h b/h/private/isrLibP.h new file mode 100644 index 0000000..69f3ae6 --- /dev/null +++ b/h/private/isrLibP.h @@ -0,0 +1,69 @@ +/* isrLibP.h - ISR objects private header */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,02jun04,lei added 4 UINT32 variables to WIND_ISR(SPR 97866) +01d,29apr04,cjj added isrShowInit() prototype +01c,29oct03,kam ISR Object code inspection mods +01b,04jun03,kam updated structure name from windISR to wind_isr +01a,03jun03,kam written. +*/ + +#ifndef __INCisrLibPh +#define __INCisrLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "private/objLibP.h" + +/* typedefs */ + +typedef struct wind_isr + { + OBJ_CORE objCore; /* wind object management struct */ + + UINT isrTag; /* interrupt tag */ + UINT count; /* # of times this ISR has been invoked */ + UINT serviceCount; /* # of times this ISR has returned OK */ + UINT64 cpuTime; /* cpu time spent in ISR */ + int options; /* ISR object options */ + + FUNCPTR handlerRtn; /* pointer to handler routine */ + int arg; /* parameter to be passed to routine */ + + UINT32 reserved1; /* reserved 1 */ + UINT32 reserved2; /* reserved 2 */ + UINT32 spare1; /* possible user extension */ + UINT32 spare2; /* possible user extension */ + UINT32 spare3; /* possible user extension */ + UINT32 spare4; /* possible user extension */ + } WIND_ISR; + +/* externs */ + +extern CLASS_ID isrClassId; + +extern STATUS isrLibInit (void); +extern STATUS isrShowInit (void); +extern STATUS isrInit (ISR_ID isrId, char * name, UINT isrTag, + FUNCPTR handlerRtn, int parameter, UINT options); +extern STATUS isrTerminate (ISR_ID isrId); +extern STATUS isrDestroy (WIND_ISR * isrId, BOOL dealloc); + +extern STATUS isrHandlerSet (ISR_ID isrId, FUNCPTR routine, + int parameter); +extern STATUS isrCpuTimeGet (ISR_ID isrId, UINT64 * cpuTime); +extern STATUS isrCpuTimeSet (ISR_ID isrId, UINT64 cpuTime); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCisrLibPh */ diff --git a/h/private/jobLibP.h b/h/private/jobLibP.h new file mode 100644 index 0000000..174c153 --- /dev/null +++ b/h/private/jobLibP.h @@ -0,0 +1,40 @@ +/* jobLibP.h - private job facility library header */ + +/* + * Copyright (c) 2004-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01d,07jun05,yvp Deleted jobTaskLibInit, jobExcAdd. jobAdd moved to excLibP.h. + Updated copyright. +01c,06sep04,aeg added jobExcAdd () prototype. +01b,07sep04,bpn Added isrJobMsgQId definition. +01a,27aug04,ans written +*/ + +#ifndef __INCjobLibPh +#define __INCjobLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* XXX bpn - the ISR job queue is defined in that file for dbgLib.c */ + +extern MSG_Q_ID isrJobMsgQId; /* message queue ID used by excTask */ + +/* function declarations */ + +extern STATUS jobLibInit (int jobTaskStackSz); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCjobLibPh */ diff --git a/h/private/kernelBaseLibP.h b/h/private/kernelBaseLibP.h new file mode 100644 index 0000000..a23b2ca --- /dev/null +++ b/h/private/kernelBaseLibP.h @@ -0,0 +1,72 @@ +/* kernelBaseLibP.h - Kernel base library header file */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01o,07jun05,yvp Updated copyright. #include now with angle-brackets. +01n,26apr05,yvp Added externs for kernelObjClassId & kernelMemInfo. +01m,01feb05,kk make IS_KERNEL_TASK() public (SPR# 104271) +01l,21oct04,kk comments cleanup +01k,12oct04,kk added kernelIdGet() prototype, removed getpid() prototype +01j,23sep04,kk enable MY_CTX_ID macro +01i,09sep04,kk renamed rtpKernelInit() and rtpIdKernel. +01h,05may04,cjj Added RTP_ID_OF_TASK and RTP_ID_TO_PID. +01g,22may04,job MY_CTX_ID macro not working correctly, so replaced by a + function. +01f,18may04,kk change CURRENT_TASK_RTP_ID to be MY_CTX_ID +01e,21oct03,dat Adding rtpKernelInit +01d,21oct03,nrj introduced macros and extern for RTP lib dependency +01c,09sep03,dcc added prototype for rtpIdSelf() +01b,29aug03,nrj added kernel rtp ID +01a,09may03,to created from pdBaseLib.h in AE. +*/ + +#ifndef __INCkernelBaseLibPh +#define __INCkernelBaseLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#ifndef _ASMLANGUAGE + +/* macros */ + +#define RTP_ID_OF_TASK(tid) ((RTP_ID)(((WIND_TCB *)tid)->rtpId)) +#define RTP_ID_TO_PID(rtpId) (((RTP_ID)rtpId)->rtpHandleId) + +/* check for 0 is still needed for the rootTask in taskLib */ + +#define MY_CTX_ID() (taskIdCurrent == 0 ? \ + kernelId : (RTP_ID)(taskIdCurrent->rtpId)) + +/* externs */ + +extern RTP_ID kernelId; +extern CLASS_ID kernelObjClassId; +extern MEM_INFO kernelMemInfo; + +/* prototypes */ + +extern RTP_ID kernelIdGet (void); +extern STATUS kernelBaseInit (void); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCkernelBaseLibPh */ diff --git a/h/private/kernelLibP.h b/h/private/kernelLibP.h new file mode 100644 index 0000000..60d4bb3 --- /dev/null +++ b/h/private/kernelLibP.h @@ -0,0 +1,61 @@ +/* kernelLibP.h - private header file for kernelLib.c */ + +/* + * Copyright (c) 1992-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +01e,11aug05,dbt Added KERNEL_CONTEXT(), KERNEL_ENTER(), KERNEL_EXIT() macros. +01d,04feb05,pch SPR 102772: add usrKernelIntStkSizeAdj() +01c,07apr03,to removed activeQHead. +01b,22sep92,rrr added support for c++ +01a,04jul92,jcf created. +*/ + +#ifndef __INCkernelLibPh +#define __INCkernelLibPh + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include + +/* defines */ + +#define KERNEL_CONTEXT() (kernelState == TRUE) /* are we in kernel */ + /* context? */ +#define KERNEL_ENTER() (kernelState = TRUE) /* enter kernel context */ +#define KERNEL_EXIT() (windExit()) /* exit kernel context */ + +/* variable declarations */ + +extern BOOL kernelState; /* mutex to enter kernel state */ +extern BOOL kernelIsIdle; /* boolean reflecting idle state */ +extern BOOL roundRobinOn; /* state of round robin scheduling */ +extern ULONG roundRobinSlice; /* round robin task slice in ticks */ +extern int rootTaskId; /* root task id */ +extern char * pRootMemStart; /* bottom of root task's memory */ +extern unsigned rootMemNBytes; /* actual root task memory size */ +extern Q_HEAD tickQHead; /* queue for timeouts/delays/wdogs */ +extern Q_HEAD readyQHead; /* queue for task ready queue */ + +/* prototypes */ + +extern void usrKernelIntStkSizeAdj(unsigned *, unsigned *, unsigned *, + unsigned *); + /* stack calculation configlette */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCkernelLibPh */ diff --git a/h/private/ledLibP.h b/h/private/ledLibP.h new file mode 100644 index 0000000..b808310 --- /dev/null +++ b/h/private/ledLibP.h @@ -0,0 +1,139 @@ +/* ledLibP.h - private header file for ledLib.c */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01n,06jul04,bpn Added ledHistCurrentNumGet() prototype (SPR#98947). +01m,26apr04,bpn Added inactivity timeout feature. +01l,21jan04,bpn Added lineBuf field to LED structure to avoid memory leaks. +01k,14nov03,bpn Changed CTX_HIST structure. +01j,24oct03,bpn Added ledDfltComplete() prototype. Added completionRtn + field to LED structure. +01i,23sep03,bpn Moved LED_MODE_FUNCS structure to ledLib.h. +01h,29aug03,bpn Cleaned up. Added necessary fields to HIST and CTX_HIST + structures to implement historical line pre-allocation. +01g,05aug03,bpn Updated function prototypes. +01f,08jul03,bpn Updated ledNameComplete() API. +01e,25jun03,bpn Changes structures in order to have on command history list + by interpreter. +01d,28mar03,lcs Reworked some APIs. +01c,18mar03,lcs Add led mode registry. +01b,14mar03,bpn Changed LED structure. +01a,17feb03,bpn Written from version "01c,26apr00,jmp" of ledLib.h of the + tor3_1 branch. +*/ + +#ifndef __INCledLibPh +#define __INCledLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes */ + +#ifdef HOST +#include +#include +#else +#include +#endif /* HOST */ + +#include + +/* Defines */ + +#define LED_BACKWARD (-1) +#define LED_FORWARD 1 + +/* Typedefs */ + +typedef struct /* HIST */ + { + NODE node; + UINT lineSize; + char * line; + } HIST; + +typedef struct ctx_hist + { + HIST * pCurrentHist; /* current history node */ + LIST histList; /* command history list */ + int histNum; /* current history number */ + UINT histSize; /* command history size */ + int nodeNumber; /* current historical line node number */ + } CTX_HIST; + +typedef struct led /* LED */ + { + int inFd; /* fd to get characters from */ + int outFd; /* fd to put characters to */ + CTX_HIST * pHistory; + CTX_HIST * pInitialHistory; + + /* + * XXX the following are not needed between ledRead's + * but are used in support routines. + */ + + char * lineBuf; /* line buffer pointer */ + char * deleteBuf; /* hold deletions from curLn */ + UINT deleteBufSize; + BOOL cmdMode; /* insert or command mode */ + + LED_MODE_FUNCS * pLedModeFuncs; /* indicates led mode of this ledId */ + FUNCPTR completionRtn; /* completion routine or NULL for default */ + struct timeval timeout; /* inactivity timeout or polling period */ + +#ifdef HOST + int idle; /* whether we're sitting in read () */ + /* the following is needed for select loop support */ + VOIDFUNCPTR callback; + fd_set readfds; +#endif + } LED; + +/* Function declarations */ + +#ifdef HOST +extern LED_ID ledHostOpen (int inFd, int outFd, int histSize, + struct timeval * pTimeout, VOIDFUNCPTR callback); +extern int ledIdle (LED * ledId); +extern void ledModeAllUnregister (); +#endif + +extern int ledNWrite (int fd, char ch, int nbytes); +extern void ledPreemptSet (FUNCPTR * catchFunc, FUNCPTR func); +extern int ledPreempt (FUNCPTR * catchFunc, char ch, char * curLn, + UINT * curPs, int * number, LED * ledId); +extern void ledRedraw (int outFd, char * oldLn, UINT lastPs, char * curLn, + UINT * curPs); +extern void ledBeep (int outFd); +extern int ledHistCurrentNumGet (LED_ID ledId); +extern BOOL ledHistNumGet (LED * ledId, int n, char * line, int lineSize); +extern BOOL ledHistFind (LED * ledId, char * match, char * line, int lineSize); +extern STATUS ledHistPrevGet (LED * ledId, char * line, int lineSize); +extern STATUS ledHistNextGet (LED * ledId, char * line, int lineSize); +extern void ledSearch (BOOL ignorePunct, BOOL endOfWord, char * curLn, + UINT * curPs, int dir); +extern STATUS ledFwdFind (char ch, char * curLn, UINT * curPs, int * number); +extern STATUS ledBwdFind (char ch, char * curLn, UINT * curPs, int * number); +extern STATUS ledReplace (char ch, char * curLn, UINT * curPs, int * number); +extern STATUS ledChange (char ch, char * curLn, UINT * curPs, int * number, + LED * ledId); +extern STATUS ledCDelete (char ch, char * curLn, UINT * curPs, int * number, + LED * ledId); + +#ifndef HOST +extern void ledInactivityDelaySet (LED_ID ledId, UINT delay); +extern STATUS ledDfltComplete (LED_ID ledId, char * line, UINT lineSize, + UINT * pCursorPos, char completionChar); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCledLibPh */ diff --git a/h/private/loadElfLibP.h b/h/private/loadElfLibP.h new file mode 100644 index 0000000..7dc8fb4 --- /dev/null +++ b/h/private/loadElfLibP.h @@ -0,0 +1,236 @@ +/* loadElfLibP.h - private ELF loader library header */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01r,01mar05,v_r No longer use segment_type. +01q,21feb05,dbt Cleanup. +01p,06oct04,jn Clean up comments +01o,18sep04,jn Move towards shared files between host and target loaders +01n,07apr04,jn Fix loading problems on SH +01m,04apr04,jn Clean up - remove unused declarations and + development-related comments +01l,04nov03,jn Make sparc relocation routines available to RTP loader +01k,22oct03,jn Make some internal elf functions public for use of rtp loader +01j,07may03,pes PAL conditional compilation cleanup. Phase 2. +01i,17apr03,dbt Added SIMLINUX support. +01h,04mar03,jmp added SIMNT support. +01g,16may02,fmk move the definition of SYM_ADRS to loadLibP.h +01f,08feb02,jn Add comments about CHECK_FITS and SIGN_EXTEND for ARM. +01e,09jan02,jn Reinstate previous definition of CHECK_FITS for ARM. Keep new + definition for MIPS. +01d,03jan02,jn put back LO_VALUE macro for PPC +01c,27nov01,pad Added macro definitions (SIGN_EXTEND, etc.) +01b,05sep01,jn created from loadElfLib.h@@/main/3 - moved utility macros + and private type and structure definitions here +*/ + +#ifndef __INCloadElfLibPh +#define __INCloadElfLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XXX The inclusion of elf.h is needed only so that internal ELF load + * functions prototypes can be included here, for use by the RTP + * loader. It should be removed when those function declarations are + * removed from this header file. + */ + +#include "elf.h" +#include "symLib.h" +#include "private/loadLibP.h" +#include "private/loadFileLibP.h" + +/* Defines */ + +#define CHECK_LOW14(val) (((val & 0xffff8000) == 0) || \ + ((val & 0xffff8000) == 0xffff8000)) + +#define CHECK_LOW16(val) (((val & 0xffff8000) == 0) || \ + ((val & 0xffff8000) == 0xffff8000)) + +#define CHECK_LOW16_STRICT(val) (((val & 0xffff0000) == 0) || \ + ((val & 0xffff0000) == 0xffff0000)) + +#define CHECK_LOW24(val) (((val & 0xfe000000) == 0) || \ + ((val & 0xfe000000) == 0xfe000000)) + +#define INSERT(buf,value,mask) \ + ((buf) = (((buf) & ~(mask)) | ((value) & (mask)))) + +#define LOW14_INSERT(buf,value) INSERT ((buf), (value), 0x0000fffc) + +#define LOW16_VALUE(val) ((val) & 0x0000ffff) +#define LOW16_INSERT(buf,value) INSERT ((buf), (value), 0x0000ffff) + +#define LOW26_VALUE(val) ((val) & 0x03ffffff) +#define LOW26_INSERT(buf,value) INSERT ((buf), (value), 0x03ffffff) + +#define LO_VALUE(val) ((val) & 0x0000ffff) + +#define HI_VALUE(val) (((val) >> 16) & 0x0000ffff) + +#define HA_VALUE(val) ((((val) >> 16)+(((val) >> 15) & 0x1)) & 0xffff) + +#define STORE_MASKED_VALUE(address, mask, value) \ + *(address) = ((*(address)) & ~(mask)) | ((value) & (mask)) + +/* macro to check if the alignment is a power of 2 */ + +#define CHECK_2_ALIGN(x) (((x) & ((x) - 1)) == 0) + +/* the binary number that is "n" 1's */ + +#define MASK(n) ((1 << (n)) - 1) + +/* mask to get the most significant bit of a value on n bit */ + +#define SIGN_BIT_MASK(n) (1 << ((n) - 1)) + +/* + * Sign extension macro. Sign extension replaces all higher bits in + * with copies of the most significant bit on . + * is the value we want to sign extend. + * is the number of significant bits in . + * + * Note: the assumption is that the storage is greater than . + */ + +#define SIGN_EXTEND(val, nBits) \ + (((MASK(nBits) & (val)) ^ SIGN_BIT_MASK(nBits)) - SIGN_BIT_MASK(nBits)) + +/* + * Overflow verification macro. It checks that the signed value does + * not overflow the number of bits specified by . The overflow for + * signed binary numbers is defined as occuring if and only if at least one + * of the bits beyond is not equal to the sign bit of the value + * truncated on . + * + * The expression evaluation gives 1 when the value overflows, 0 otherwise. + * + * Note: the assumption is that the maximum storage is on 32 bits. + */ + +#define CHECK_SIGNED_OVERFLOW(val,nBits) \ + (!(SIGN_EXTEND((val),(nBits)) == (val))) + +/* Some masks */ + +#define RA_MSK 0x001f0000 +#define GPR13_MSK 0x000d0000 +#define GPR2_MSK 0x00020000 + +/* type definitions */ + +/* data structures */ + +typedef struct segment_info_desc /* Info about a loadable segment */ + { + SL_NODE segInfoNode; /* Point to next node in list */ + SL_LIST scnInfoList; /* List of info nodes about sections in seg */ + UINT type; /* segment's type */ + void * address; /* segment's address */ + UINT size; /* segment's size */ + UINT offset; /* segment's offset in file */ + UINT offsetInMem; /* seg's offset from start of mem alloc'd */ + UINT alignment; /* segment alignment */ + BOOL memAllocatedByCaller; /* True iff the caller allocated mem. */ + BOOL segHasMemFootprint; /* segment size */ + } SEGMENT_INFO_DESC; + +typedef struct + { + UINT32 * pLoadScnHdrIdxs; /* loadable sections header index tbl */ + UINT32 * pSymTabScnHdrIdxs; /* sym table sections header idx tbl */ + UINT32 * pRelScnHdrIdxs; /* reloc info sections header idx tbl */ + UINT32 * pStrTabScnHdrIdxs; /* str table sections header idx tbl */ + } IDX_TBLS; + +typedef Elf32_Sym ** SYMTBL_REFS; /* table of pointers to symbol tables */ +typedef void *** SYMADDR_REFS; /* table of ptrs to sym adrs tables */ + +/* function declarations */ + +extern +#ifdef HOST +DLL_EXPORT +#endif +STATUS loadElfRelEntryRead + ( + LOAD_MODULE_INFO * pLoadModuleInfo,/* transient load info */ + Elf32_Rel * pReloc, /* Ptr on relocation structure to fill */ + BOOL swapIsRequired /* Byte order must be swapped */ + ); + +extern +#ifdef HOST +DLL_EXPORT +#endif +STATUS loadElfRelaEntryRead + ( + LOAD_MODULE_INFO * pLoadModuleInfo,/* transient load info */ + Elf32_Rela * pReloc, /* Ptr on relocation structure to fill */ + BOOL swapIsRequired /* Byte order must be swapped */ + ); + +extern STATUS loadElfSectionHeaderCheck + ( + Elf32_Shdr * pScnHdr, /* Pointer to a section header */ + int scnHdrNum /* Number of the section header */ + ); + +extern STATUS loadElfProgramHeaderTableReadAndCheck + ( + LOAD_MODULE_INFO * pLoadModuleInfo,/* transient load info */ + Elf32_Phdr * pProgHdrTbl, /* Pointer to program header table */ + int offset, /* Offset in file to prog header tbl*/ + int progHdrNumber, /* Number of header in table */ + BOOL swapIsRequired /* TRUE if bytes must be swapped */ + ); + +extern STATUS loadElfFileHeaderReadAndCheck + ( + LOAD_MODULE_INFO * pLoadModuleInfo,/* transient load info */ + Elf32_Ehdr * pHdr, /* ELF module header */ + BOOL * swapIsRequired /* TRUE if bytes must be swapped */ + ); + +extern +#ifdef HOST +DLL_EXPORT +#endif +STATUS elfArchReloc + ( + BOOL swapNeeded, /* host only - whether to swap endianness */ + LOAD_MODULE_INFO * pLoadModuleInfo,/* transient load info */ + Elf32_Shdr * pRelHdr, /* Pointer to relocation section header */ + SCN_ADRS scnAddr, /* for relocatable files only */ + INT64 deltaBaseAddr, /* RTP base address(= file addr - real addr) */ + SYM_INFO_TBL symInfoTbl /* Array of symbol IDs, values and types */ + ); + +extern +#ifdef HOST +DLL_EXPORT +#endif +BOOL elfArchVerify + ( + UINT32 machType /* Module's target arch */ + ); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCloadElfLibPh */ diff --git a/h/private/loadFileLibP.h b/h/private/loadFileLibP.h new file mode 100644 index 0000000..880df51 --- /dev/null +++ b/h/private/loadFileLibP.h @@ -0,0 +1,212 @@ +/* loadFileLibP.h - header for utility func. lib. shared by loader libraries */ + +/* + * Copyright (c) 2004-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01g,07mar05,v_r Included symbol.h +01f,01mar05,v_r Moved segment type enum to moduleLib.h. +01e,06oct04,jn Clean up comments +01d,17sep04,jn Move towards shared files +01c,08apr04,jn Adjustment needed in segment descriptor structure to handle + and track alignments correctly +01b,05apr04,jn Clean up development-related comments +01a,19feb04,jn Derived from AE's malLib.h +*/ + +#ifndef __INCloadFileLibPh +#define __INCloadFileLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes */ + +#ifdef HOST +#include "host.h" +#include "objLib.h" +#else +#include "vxWorks.h" +#include "errno.h" +#include "vwModNum.h" +#include "private/handleLibP.h" +#endif /* HOST */ + +#include "symbol.h" +#include "private/symbolP.h" +#include "dllLib.h" + +/* Status codes */ + +/* Defines */ + +/* + * For internal use only, within load directives. Section names will + * be truncated to this number of characters when used in load + * directives. + */ + +#define SEC_NAME_MAX 256 + +/* indexes into the array of segment descriptors */ + +#define TEXT_SEG_DESC_INDEX 0 +#define DATA_SEG_DESC_INDEX 1 +#define BSS_SEG_DESC_INDEX 2 + +#define NUM_KERNEL_MODULE_SEGS 3 + +/* Type definitions */ + +typedef unsigned int LOAD_FLAG_T; /* load flag type */ + +/* information associated with module while loading is in progress */ + +typedef enum module_source /* method file was specified by */ + { + FROM_FD = 0, /* opened from file descriptor */ + FROM_FILENAME = 1 /* opened from file name */ + } MODULE_SOURCE; + +typedef enum mseek_mode /* Module position mode flags */ + { + MSEEK_SET = 0, /* Set pos. from the beginnning */ + MSEEK_CUR = 1 /* Set pos. from the current loc. */ + } MSEEK_MODE; + + +/* Types used throughout various loader header files */ + +typedef void * SYM_ADRS; /* symbol's address */ +typedef void ** SYM_ADRS_TBL; /* table of symbol's addr */ + +typedef void * SCN_ADRS; /* section's address */ +typedef void ** SCN_ADRS_TBL; /* table of section's addr */ + +typedef enum load_type /* type of load being performed */ + { + LOAD_UNKNOWN = 0, + LOAD_SYS_SYM_TBL = 1, /* Load the system symbol table */ + LOAD_VXWORKS_IMG = 2, /* Load vxWorks image (copy on host for tgtsvr) */ + LOAD_STAT_EXE = 3, /* Load statically linked executable */ + LOAD_DYN_EXE = 4, /* Load dynamically linked executable */ + LOAD_KERNEL_MODULE = 5, /* Load relocatable module into kernel */ + LOAD_SYMS_ONLY = 6 /* Load symbols only */ + } LOAD_TYPE; + +typedef struct load_module_info /* information about file to load */ + { + int fd; /* file descriptor */ + int options; + char * fileName; + MODULE_SOURCE moduleOpened; /* FROM_FD or FROM_FILENAME */ + LOAD_TYPE loadType; /* relocatable, executable, ... */ + } LOAD_MODULE_INFO; + +typedef struct + { + SYM_ADRS pAddr; /* symbol's address */ + SYM_TYPE type; /* symbol's type */ + SYMBOL_ID symId; /* ID of the symbol */ + } SYM_INFO; + +typedef SYM_INFO * SYM_INFO_TBL; /* table of symbol address/type info */ +typedef SYM_INFO_TBL * SYMINFO_REFS; /* table of ptr to symbol info tables */ +/* section types */ + +typedef enum section_type /* Section types */ + { + SECTION_UNKNOWN = 0, + SECTION_RODATA = 1, /* read-only data section */ + SECTION_TEXT = 2, /* text section */ + SECTION_DATA = 3, /* data section */ + SECTION_BSS = 4 /* bss section */ + } SECTION_TYPE; + +typedef struct modListDesc * MODLIST_ID; /* module list ID */ +typedef struct sectionDesc * SECTION_ID; /* section ID */ + +typedef enum section_type SECTION_T; + +typedef struct sectionDesc /* module section descriptor */ + { +#ifdef HOST + OBJ_CORE handle; /* handle management */ +#else + HANDLE handle; /* handle management */ +#endif /* HOST */ + DL_NODE sectionNode; /* double-linked list node information*/ char * name; /* section name */ + void * address; /* section address */ + int size; /* section size */ + enum section_type type; /* section type */ + int flags; /* section flags */ + u_short checksum; /* section cksum; u_short is returned by * checksum() */ + } SECTION_DESC; + +typedef struct section_info_desc /* Info about a loadable section */ + { + SL_NODE scnInfoNode; /* Point to next node in list */ + char * name; /* Section's name */ + enum section_type type; /* Section's type */ + UINT offset; /* Offset of section in object module*/ + UINT size; /* Section's size */ + UINT alignment; /* Section's alignment */ + UINT flags; /* Section's flags */ + void * address; /* Section's address */ + UINT offsetInSeg; /* Section's offset in segment */ + UINT directiveIdx; /* Index of the related load directive*/ +#ifdef HOST + BOOL scnIsCached; +#endif + SECTION_ID sectionId; + } SECTION_INFO_DESC; + +typedef struct + { + char * addrText; /* text segment address */ + char * addrData; /* data segment address */ + char * addrBss; /* bss segment address */ + UINT sizeText; /* text segment size */ + UINT sizeProtectedText; /* protected text segment size */ + UINT sizeData; /* data segment size */ + UINT sizeBss; /* bss segment size */ + int flagsText; /* text flags for module */ + int flagsData; /* data flags for module */ + int flagsBss; /* bss flags for module */ + } SEG_INFO; + +typedef struct load_segment_directive + { + UINT32 type; /* type of the segment */ + void * address; /* address of the segment */ + BOOL memAllocatedByCaller; /* True iff the caller allocated mem. */ + } LOAD_SEGMENT_DIRECTIVE; + +/* declarations */ + +extern void loadFileLibInit (void); +extern STATUS loadModuleInfoFromFd (int fd, + LOAD_MODULE_INFO * pLoadModuleInfo); +extern STATUS loadModuleInfoFromFilenameOpen (char * fileName, + LOAD_MODULE_INFO * pLoadModuleInfo); +extern STATUS loadModuleInfoRelease (LOAD_MODULE_INFO loadModuleInfo); +extern STATUS loadModuleSeek (LOAD_MODULE_INFO * pLoadModuleInfo, + int offset, MSEEK_MODE mode); +extern STATUS loadModuleStringRead (LOAD_MODULE_INFO * pLoadModuleInfo, + char * buffer, UINT32 nBytes); +extern STATUS loadModuleValueRead (LOAD_MODULE_INFO * pLoadModuleInfo, + void * buffer, UINT32 nBytes); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCloadFileLibPh */ diff --git a/h/private/loadLibP.h b/h/private/loadLibP.h new file mode 100644 index 0000000..800ec45 --- /dev/null +++ b/h/private/loadLibP.h @@ -0,0 +1,242 @@ +/* loadLibP.h - private object module loader library header */ + +/* + * Copyright (c) 2002-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01j,26jul05,v_r Complete loader's XXX review. +01i,18mar05,v_r Include cleanups + code conventions compliancy work. + Removed loadModuleByFilename() and loadModuleAtByFilename() + APIs. +01h,01mar05,v_r Added pLoadRoutine() prototype. +01g,22feb05,dbt Cleanup. +01f,06oct04,jn Clean up comments +01e,21sep04,jn Move shared macros for relocations out of relocation units + (elf.c) +01d,18sep04,jn Move towards shared code for host and target loaders +01c,16apr04,jn Remove section directives - not useful right now +01b,02apr04,jn Fix warning in bsp builds. Clean up - remove unused + declarations and development-related comments +01a,16may02,fmk written +*/ + +#ifndef __INCloadLibPh +#define __INCloadLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Include */ + +#ifdef HOST +#include "sllLib.h" +#include "symbol.h" +#include "symLib.h" +#include "moduleLibP.h" +#include "pdLib.h" +#include "memAttrLib.h" +#include "private/moduleLibP.h" +#include "private/loadElfLibP.h" +#include "private/loadFileLibP.h" +#include "moduleLib.h" +#include "loadLib.h" +#else +#include "loadFileLibP.h" +#include "private/moduleLibP.h" +#include "private/loadElfLibP.h" +#include "loadLib.h" +#endif /* HOST */ + +/* defines */ + +#define TEXT_SEG_INFO(pList) ((SEGMENT_INFO_DESC *)pList->head) +#define DATA_SEG_INFO(pList) ((SEGMENT_INFO_DESC *)pList->head->next) +#define BSS_SEG_INFO(pList) ((SEGMENT_INFO_DESC *)pList->head->next->next) + +/* ALIGN_NEXT is defined in memPartLibP.h on the target. */ + +#ifdef HOST +#define ALIGN_NEXT(size,align) ((((UINT)(size)) + align - 1) & (~(align - 1))) +#endif /* HOST */ + + +/* Swap of two bytes : AB becomes BA */ + +#define SWAB_16(x) (((UINT16)((x) & 0x00ff) << 8) | \ + ((UINT16)((x) & 0xff00) >> 8)) + +/* Swap of four bytes : ABCD becomes DCBA */ + +#define SWAB_32(x) (((UINT32)((x) & 0x000000ff) << 24) | \ + ((UINT32)((x) & 0x0000ff00) << 8) | \ + ((UINT32)((x) & 0x00ff0000) >> 8) | \ + ((UINT32)((x) & 0xff000000) >> 24)) + +/* Swap only if the boolean (b) is true */ + +#define SWAB_16_IF(b,v) ((v) = ((b) ? SWAB_16 (v) : (v))) +#define SWAB_32_IF(b,v) ((v) = ((b) ? SWAB_32 (v) : (v))) + +#ifdef HOST +#define MEM_READ_32(pRelocAdrs, offset) \ + do \ + { \ + if (tgtMemRead (NULL, (pRelocAdrs), &(offset), \ + sizeof(UINT32), 0, 0) != OK) \ + return ERROR; \ + SWAB_32_IF (swapIsRequired, offset); /* Host format */ \ + } \ + while (0); + +#define MEM_READ_16(pRelocAdrs, offset) \ + do \ + { \ + if (tgtMemRead (NULL, (pRelocAdrs), &(offset), \ + sizeof(UINT16), 0, 0) != OK) \ + return ERROR; \ + SWAB_16_IF (swapIsRequired, offset); /* Host format */ \ + } while (0); + +#define MEM_READ_8(pRelocAdrs, offset) \ + do \ + { \ + if (tgtMemRead (NULL, (pRelocAdrs), &(offset), \ + sizeof(UINT8), 0, 0) != OK) \ + return ERROR; \ + } while (0); + +#define MEM_WRITE_32(pRelocAdrs, value32) \ + do \ + { \ + SWAB_32_IF (swapIsRequired, value32); /* Target format */ \ + if (tgtMemManyWrite (NULL, &(value32), (pRelocAdrs), \ + sizeof (UINT32)) != OK) \ + return ERROR; \ + } while (0); + +#define MEM_WRITE_16(pRelocAdrs, value16) \ + do \ + { \ + SWAB_16_IF (swapIsRequired, value16); /* Target format */ \ + if (tgtMemManyWrite (NULL, &(value16), (pRelocAdrs), \ + sizeof(UINT16)) != OK) \ + return ERROR; \ + } while (0); + +#define MEM_WRITE_8(pRelocAdrs, value) \ + do \ + { \ + if (tgtMemManyWrite (NULL, &value, pRelocAdrs, sizeof (UINT8)) != OK) \ + return ERROR; \ + } while (0); + + + +#else + +#define MEM_READ_32(pRelocAdrs, offset) ((offset) = *((UINT32 *)(pRelocAdrs))); +#define MEM_READ_16(pRelocAdrs, offset) ((offset) = *((UINT16 *)(pRelocAdrs))); +#define MEM_READ_8(pRelocAdrs, offset) ((offset) = *((UINT8 *)(pRelocAdrs))); + +#define MEM_WRITE_32(pRelocAdrs, value32) \ + (*((UINT32 *)(pRelocAdrs)) = (value32)); +#define MEM_WRITE_16(pRelocAdrs, value16) \ + (*((UINT16 *)(pRelocAdrs)) = (value16)); +#define MEM_WRITE_8(pRelocAdrs, value8) \ + (*((UINT8 *)(pRelocAdrs)) = (value8)); + +#endif /* HOST/!HOST */ + +/* misc definitions */ + +/* Macro to check if the alignment is a power of 2 */ + +#define CHECK_2_ALIGN(x) (((x) & ((x) - 1)) == 0) + +/* Macros used for performing relocations */ + +#define LOAD_LOW24_INSERT(buf,value) INSERT ((buf), (value), 0x00ffffff) + +/* type definitions */ + +typedef struct + { + char * symName; /* common symbol's name */ + BOOL vxWorksSymMatched; /* TRUE if core syms are included */ + void * pSymAddrComm; /* Matching comm sym's addr, if any */ + SYM_TYPE commSymType; /* Exact type of matching comm symbol */ + void * pSymAddrBss; /* matching bss sym's addr, if any */ + SYM_TYPE bssSymType; /* exact type of matching bss symbol */ + void * pSymAddrData; /* matching data sym's addr, if any */ + SYM_TYPE dataSymType; /* exact type of matching data symbol */ + void * pSymAddrText; /* Matching text sym's addr, if any */ + SYM_TYPE textSymType; /* Exact type of matching text symbol */ + UINT32 commStrategy; /* Strategy used for comm management */ + } COMMON_INFO; + +/* externals */ + +extern FUNCPTR syncLoadRtn; + +/* function declarations */ + +/* + * The following function was written to be called from usrLoadSym.c. + * It requires the arguments used in usrLoadSym for the network system symbol + * table and its various users (such as the shell) to behave as documented. + */ + +extern STATUS loadSysSymTblLoad (int symfd, int flags); +extern STATUS loadCommonManage (int comAreaSize, int comAlignment, + char * symName, SYMTAB_ID symTbl, + SYM_ADRS * pSymAddr, SYM_TYPE * pSymType, + int loadFlag, SEG_INFO * pSeg, int group); +extern STATUS loadCommonMatch (COMMON_INFO * pCommInfo, SYMTAB_ID symTblId); +extern STATUS loadUndefinedSymbolProcess (char * name, SYM_INFO * pSymInfo, + MODULE_ID moduleId); +extern STATUS loadCommonSymbolProcess (char * name, UINT symSize, + UINT symAlign, SYM_INFO * pSymInfo, + MODULE_ID moduleId, int loadFlag); +extern STATUS loadDefinedSymbolProcess (char * name, SYM_ADRS symAddr, + SYM_EXT_TYPE symExtType, + SYM_INFO * pSymInfo, + MODULE_ID moduleId, + int loadFlag); +extern void loadBuffersFree (void * pBuf); +extern STATUS loadSectionDirectiveMatch (UINT nbSegDirectives, + LOAD_SEGMENT_DIRECTIVE * pSegDirective, + SL_LIST * pSegInfoList, + SECTION_INFO_DESC * pScnInfo, + BOOL * pScnMatches); +extern STATUS loadSegmentsAllocate (MODULE_ID moduleId, + LOAD_FLAG_T loadFlags, + SL_LIST * pMemInfoList); +extern STATUS loadSectionsInstall (LOAD_MODULE_INFO * pLoadModuleInfo, + LOAD_FLAG_T loadFlags, + SL_LIST * pSegInfoList); +extern STATUS loadSegInfoDescAllocate (SL_LIST * pSegInfoDescList, + LOAD_FLAG_T loadFlags, + LOAD_SEGMENT_DIRECTIVE * pSegDirective, + UINT nbSegDirectives); +extern STATUS loadSegInfoDescFree (SL_LIST * pSegInfoDescList); +extern STATUS (* pLoadRoutine) (LOAD_MODULE_INFO *, LOAD_FLAG_T, + LOAD_SEGMENT_DIRECTIVE *, UINT, + MODULE_ID, BOOL *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCloadLibPh */ + + + + diff --git a/h/private/loadRtpLibP.h b/h/private/loadRtpLibP.h new file mode 100644 index 0000000..7ab47f3 --- /dev/null +++ b/h/private/loadRtpLibP.h @@ -0,0 +1,197 @@ +/* loadRtpLibP.h - private header file for Real Time Process module loader */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01i,29mar04,jn Rename rtpLoadLib -> loadRtpLib +01h,26mar04,jn Move arch-independent calculations into rtpLoadLib.c +01g,24mar04,pad Added a RTP_LOAD_LOCAL_SYMBOLS flag. +01f,16mar04,pad Changed some parameter names for loadRtpFileSymbolsRegister(). +01e,05mar04,pad Adaptation for making the application loader act as a symbol + recorder: added prototype for loadRtpFileSymbolsRegister() and + added a symOwnerId field to the RTP_IMAGE_INFO structure. +01d,18feb04,pad Added flag RTP_LOAD_SYMBOLS_ONLY (required for the shared + libraries). +01c,11nov03,jn Fix bit mapping for load flags +01b,21oct03,jn Integrate rtp loader which handles executables +01a,18aug03,jn Written. +*/ + +/* +DESCRIPTION +The loadRtpLib library provides the API's that are used to load Real Time +Process (RTP) object modules. This header provides the interfaces that are +available to other vxWorks system code that uses this library. + +These API's are designed to be called only by the RTP library or other +vxWorks system code, not by user code or from the shell. There are +several operations that must be done to create an RTP; relocating the +code and loading it into memory is just one small part of creating the +RTP. Therefore attempting to use these routines in isolation, apart +from the rest of the RTP library, will not result in a viable RTP. + +For now, the only object module format which is supported for RTP's is +ELF. +*/ + +#ifndef __INCloadRtpLibPh +#define __INCloadRtpLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "symLib.h" +#include "elf.h" +#include "vwModNum.h" + +/* defines */ + +/* + * Don't use 0x0 for an option flag - if the option argument is 0x0, + * the loader performs its default behavior. + */ + +#define RTP_LOAD_NO_SYMBOLS 0x1 /* do not load any symbols for RTP */ +#define RTP_LOAD_GLOBAL_SYMBOLS 0x2 /* load only global RTP symbols */ +#define RTP_LOAD_ALL_SYMBOLS 0x4 /* load all RTP symbols */ +#define RTP_LOAD_LOCAL_SYMBOLS 0x8 /* load local RTP symbols */ + +#if FALSE /* These options aren't supported yet. */ +#define RTP_LOAD_ABSOLUTE_OPTIM 0x8 /* load at file's virtual addresses, + if possible */ +#define RTP_LOAD_ABSOLUTE_FORCE 0x10 /* don't load if memory at file's + virtual addresses isn't + available */ +#endif /* FALSE */ + +#define RTP_LOAD_SYMBOLS_ONLY 0x100 /* prevents loading of text and data */ + +/* Error Status codes */ + +#define S_loadRtpLib_INVALID_ARGUMENT (M_loadRtpLib | 101) +#define S_loadRtpLib_INVALID_OPTION (M_loadRtpLib | 102) +#define S_loadRtpLib_SYMTBL_DESTROY_INCOMPLETE (M_loadRtpLib | 103) +#define S_loadRtpLib_TOO_MANY_SEGMENTS (M_loadRtpLib | 104) +#define S_loadRtpLib_NO_LOADABLE_SEGMENT (M_loadRtpLib | 105) +#define S_loadRtpLib_ADDRESS_OVERFLOW (M_loadRtpLib | 106) +#define S_loadRtpLib_SEGMENT_READ (M_loadRtpLib | 107) +#define S_loadRtpLib_COMMON_SYMBOL (M_loadRtpLib | 108) +#define S_loadRtpLib_UNDEFINED_SYMBOL (M_loadRtpLib | 109) +#define S_loadRtpLib_UNSUPPORTED_RELOC (M_loadRtpLib | 110) +#define S_loadRtpLib_NOT_EXECUTABLE (M_loadRtpLib | 111) +#define S_loadRtpLib_NO_ENTRY_POINT (M_loadRtpLib | 112) +#define S_loadRtpLib_NO_PROG_HDR (M_loadRtpLib | 113) +#define S_loadRtpLib_FIRST_LOAD_SEG_NOT_EXECUTABLE (M_loadRtpLib | 114) +#define S_loadRtpLib_SECOND_LOAD_SEG_NOT_WRITEABLE (M_loadRtpLib | 115) +#define S_loadRtpLib_DATA_SEG_BEFORE_TEXT_SEG (M_loadRtpLib | 116) + +/* typedefs */ + +typedef struct rtpImageInfo + { + void * textStart; /* address where installed text begins */ + UINT32 textSize; /* size of installed text segment */ + void * dataStart; /* address where installed data begins */ + UINT32 dataSize; /* size of data segment, not including bss */ + void * bssStart; /* address where bss begins */ + UINT32 bssSize; /* size of bss region */ + void * entryPt; /* ELF entry point */ + SYMTAB_ID symTbl; /* RTP's symbol table id */ + void * symOwnerId; /* owner of the symbols registered in sym tab */ + void * rtpAllocAddr; /* Address of memory allocated for RTP - may + not match text start - needed for testing, maybe + not needed for final version of loadRtpLib. */ + + } RTP_IMAGE_INFO; + +/* + * The RTP_FILE_INFO structure is intended for use only within + * loadRtpLib itself. However, it's convenient to have the definition + * available when performing some automated tests (see loaderRtpTest). + */ + +typedef struct rtpFileInfo + { + Elf32_Ehdr ehdr; /* ELF header */ + } RTP_FILE_INFO; + + +/* Globals */ + +/* + * This variable enables users to change the default options for RTP loading. + * It can be any combination of the bit flags declared above, RTP_LOAD_*. + */ + +extern int loadRtpDefaultOptions; + +extern int loadRtpDefaultSymTblSize; + + +/* Function declarations */ + +extern struct rtpFileInfo * loadRtpFileInfoCreate (void); + +extern STATUS loadRtpLibInit (void); + +extern STATUS loadRtpFileVerify + ( + int fd, /* file descriptor */ + struct rtpFileInfo * pRtpFileInfo, /* loader internal information */ + UINT32 options /* bit field for option flags */ + ); + +extern STATUS loadRtpFileLoad + ( + int fd, /* file descriptor */ + struct rtpFileInfo * pRtpFileInfo, /* loader internal information */ + RTP_IMAGE_INFO * pRtpImageInfo, /* for returning information */ + UINT32 options /* bit field for option flags */ + ); + +STATUS loadRtpFileSymbolsRegister + ( + int fd, /* exec or shared object file descriptor */ + void * symOwnerId, /* ID associated with symbols to register */ + SYMTAB_ID symTblId, /* symbol table where to register the symbols */ + void * textBase, /* base address of text segment in memory */ + void * dataBase, /* base address of data segment in memory */ + UINT32 options /* bit field for option flags */ + ); + +extern void loadRtpFileInfoDestroy + ( + struct rtpFileInfo * pRtpFileInfo /* loader internal information */ + ); + +extern STATUS loadRtpSymTblDestroy + ( + SYMTAB_ID symTbl, /* symbol table to destroy */ + UINT32 options /* bit field for option flags */ + ); + +/* for use by the arch relocation units: */ + +extern STATUS loadRtpRelocAdrsCompute + ( + Elf32_Addr r_offset, /* "offset" from relocation structure */ + void ** ppRelocAdrs, /* relocation address */ + INT64 baseAddr /* RTP base address(= file addr - real addr)*/ + ); + +extern STATUS loadRtpImageMemFree + ( + RTP_IMAGE_INFO * pRtpImageInfo, /* holds information about RTP image */ + UINT32 options /* bit field for option flags */ + ); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCloadRtpLibPh */ + diff --git a/h/private/loadShareLibP.h b/h/private/loadShareLibP.h new file mode 100644 index 0000000..a592e87 --- /dev/null +++ b/h/private/loadShareLibP.h @@ -0,0 +1,40 @@ +/* loadShareLib.c - support for sharing loader code between host and target */ + +/* + * Copyright (c) 2004 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software may be + * licensed only pursuant to the terms of an applicable Wind River license + * agreement. + */ + +/* +modification history +-------------------- +01e,08sep05,v_r Refined loadShareTgtMemFree() prototype + cleanups. +01d,25jul05,v_r Updated copyright. +01c,02jun04,jmp fixed win32 build. +01b,16may04,jn Finish implementation of loadShareCacheRefresh +01a,14may04,jn Create +*/ + +extern void * loadShareTgtMemAlloc (); + +#ifdef HOST +DLL_EXPORT +#endif /* HOST */ +extern void * loadShareTgtMemAlign (UINT alignment, UINT size); +void loadShareTgtMemFree (void * addr); +STATUS loadShareTgtMemRead (); + +#ifdef HOST +DLL_EXPORT +#endif /* HOST */ +void loadShareTgtMemSet (void * addr, int value, UINT size); +STATUS loadShareTgtMemWrite (); +void loadShareCacheFlush (); + +#ifdef HOST +DLL_EXPORT +#endif /* HOST */ +STATUS loadShareCacheRefresh (); diff --git a/h/private/localeP.h b/h/private/localeP.h new file mode 100644 index 0000000..c06d4ee --- /dev/null +++ b/h/private/localeP.h @@ -0,0 +1,56 @@ +/* localeP.h - private locale header file */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,22sep92,rrr added support for c++ +01a,11jul92,smb written. +*/ + +/* +DESCRIPTION +This header file tries to group all the pieces related to the locale +library together. VxWorks does not implement the locale functionality. +Implementation requires a linked list of tables of the __linfo structure +defined below. The is not feasiable in a real-time environment. + +INCLUDE FILE: locale.h + +SEE ALSO: Plauger's ANSI C library, 1992. +*/ + +#include "locale.h" +#include "private/timeP.h" + +#ifndef __INClocalePh +#define __INClocalePh + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct __linfo + { + const char * __localeName; + struct __linfo * __next; /* list */ + const unsigned * __ctype; /* FOR LC_CTYPE */ + unsigned char __mbcurmax; + struct lconv __lc; /* LC_MONETARY, LC_NUMERIC */ + TIMELOCALE __times; /* for LC_TIME */ + } __linfo; + +#if FALSE /* NOT IMPLEMENTED */ + const short * __toUpper; /* FOR LC_CTYPE */ + const short * __toLower; /* FOR LC_CTYPE */ + __statab __mbstate; + __statab __wcstate; + __statab __costate; /* for LC_COLLATE */ +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INClocalePh */ diff --git a/h/private/logLibP.h b/h/private/logLibP.h new file mode 100644 index 0000000..fb18c45 --- /dev/null +++ b/h/private/logLibP.h @@ -0,0 +1,44 @@ +/* logLibP.h - private header for logLib logging facility */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* modification history +-------------------- +01a,17sep04,dlk written, +*/ + +#ifndef __INClogLibPh +#define __INClogLibPh + +#include "vxWorks.h" +#include "semLibP.h" + +/* + * These two should arguably be in a public header, as + * they refer to the public API. + */ + +#define MAX_LOGARGS 6 /* max args to log message */ +#define MAX_LOGFDS 5 /* max log fds */ + + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The FD array and the semaphore which guards it are made + * external since they are shared by nbioLogLib. + */ + +extern SEMAPHORE logFdSem; + +extern int logFd [MAX_LOGFDS]; +extern int numLogFds; + +#ifdef __cplusplus + } +#endif + +#endif /* __INClogLibPh */ + diff --git a/h/private/m2LibP.h b/h/private/m2LibP.h new file mode 100644 index 0000000..020f876 --- /dev/null +++ b/h/private/m2LibP.h @@ -0,0 +1,129 @@ +/* m2LibP.h - VxWorks MIB-II interface to SNMP Agent */ + +/* Copyright 1984 - 2002 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01d,25apr02,vvv removed unused ifAttachChange (SPR #74391) +01c,10oct01,rae merge from truestack (VIRTUAL) +01b,25oct00,niq Merge RFC2233 changes from open_stack-p1-r1 branch +01a,08dec93,jag written +*/ + +#ifndef __INCm2LibPh +#define __INCm2LibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "socket.h" +#include "net/if_arp.h" +#include "net/if.h" +#include "netinet/if_ether.h" +#include "avlLib.h" + +#ifdef VIRTUAL_STACK +#include "netinet/vsLib.h" +#endif /* VIRTUAL_STACK */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* This structure is used to keep track of the Network Interfaces */ + +typedef struct + { + int netIfIndex; /* I/F index returned to SNMP */ + long netIfType; /* I/F type from MIB-II specifications */ + unsigned long netIfSpeed; /* I/F Speed from MIB-II specifications */ + unsigned long netIfAdminStatus; /* I/F old status used for traps */ + unsigned long netIfLastChange; /* I/F Time of Interface last change */ + M2_OBJECTID netIfOid; /* I/F Object ID */ + struct arpcom * pNetIfDrv; /* Pointer to BSD Network Driver I/F */ + + } NET_IF_TBL; + +/* + * These IOCTL commands are used exclusively by the mib2Lib.c module to retrive + * MIB-II parameters from network drivers. + */ + +#define SIOCGMIB2CNFG _IOR('m', 0, int) /* Get Configuration */ +#define SIOCGMIB2CNTRS _IOR('m', 1, int) /* Get driver counters */ +#define SIOCGMIB2233 _IOR('m', 2, M2_ID **) /* Get rfc2233 data */ +#define SIOCSMIB2233 _IOW('m', 3, IF_SETENTRY) /* Set rfc2233 data */ +#define SIOCGMCASTLIST _IOR('m', 4, LIST **) /* Get mcast list */ + +/* + * This structure is used to obtain the configuration information from the + * network drivers. This information is static and does not change through the + * life time of the driver. + */ + +typedef struct + { + long ifType; + M2_OBJECTID ifSpecific; + + } M2_NETDRVCNFG; + +/* + * This structure is used to retrive counters from the network driver. The + * variable ifSpeed is included here to support devices that can compute the + * nominal bandwidth. + */ + +typedef struct + { + unsigned long ifSpeed; + unsigned long ifInOctets; + unsigned long ifInNUcastPkts; + unsigned long ifInDiscards; + unsigned long ifInUnknownProtos; + unsigned long ifOutOctets; + unsigned long ifOutNUcastPkts; + unsigned long ifOutDiscards; + + } M2_NETDRVCNTRS; + + + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* extern NET_IF_TBL * pm2IfTable; Network I/F table (Allocated Dynamically) */ + +#ifndef VIRTUAL_STACK + +extern int m2IfCount; +extern AVL_TREE pM2IfRoot; /* The root node of the if tree */ +extern M2_IFINDEX * pm2IfTable; /* Network I/F table (Allocated Dynamically) */ +extern int m2IfCount; + +#endif /* VIRTUAL_STACK */ + +extern M2_OBJECTID zeroObjectId; + +#if defined(__STDC__) || defined(__cplusplus) + +extern int m2NetIfTableRead (void); +extern int nextIndex (void *, GENERIC_ARGUMENT); +extern void ifWalk (int); +extern void testTree (void); + +#else /* __STDC__ */ + +extern int m2NetIfTableRead (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm2LibPh */ diff --git a/h/private/mathP.h b/h/private/mathP.h new file mode 100644 index 0000000..17d73a0 --- /dev/null +++ b/h/private/mathP.h @@ -0,0 +1,84 @@ +/* mathP.h - private definitions for math functions */ + +/* Copyright 1992-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,03oct01,to use IEEE little endian for ARM +01h,23jan97,cdp reverse words in double for ARM. +01g,22sep92,rrr added support for c++ +01f,04sep92,wmd modified definition of DOUBLE for BIG/LITTLE ENDIAN architectures. +01e,30jul92,kdl added fp type test macros; deleted declarations of unused + routines (isnan(), etc.); changed _d_type() to fpTypeGet(); + deleted prototypes for _dNormalize, _finite, _upscale. +01d,30jul92,kdl added DOUBLE union definition, from floatLib.c. +01c,08jul92,smb added to clib library. +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01a,14sep90,mcl adapted from Berkeley. +*/ + +#ifndef __INCmathPh +#define __INCmathPh + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZERO 0 +#define REAL 1 +#define INTEGER 2 +#define INF 3 +#define NAN 4 + +#define isNan(num) ((fpTypeGet (num, 0)) == NAN) +#define isZero(num) ((fpTypeGet (num, 0)) == ZERO) +#define isInf(num) ((fpTypeGet (num, 0)) == INF) + +typedef union + { + unsigned p_mant[2]; + double p_double; + } __cv_type; + +#define p_mantlow p_mant[0] +#define p_manthigh p_mant[1] + + +typedef union /* DOUBLE */ + { + double ddat; +#if (_BYTE_ORDER == _BIG_ENDIAN) + struct + { + long l1; + long l2; + } ldat; +#else + struct + { + long l2; + long l1; + } ldat; +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ + } DOUBLE; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern int fpTypeGet (double v, double *r); + +#else /* __STDC__ */ + +extern int fpTypeGet(); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmathPh */ diff --git a/h/private/memEdrLibP.h b/h/private/memEdrLibP.h new file mode 100644 index 0000000..7b9680e --- /dev/null +++ b/h/private/memEdrLibP.h @@ -0,0 +1,325 @@ +/* memEdrLibP.h - private memory ED&R library header file */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,14dec04,aeg added memEdrBlockMark() function prototype (SPR #105335). +01f,13sep04,zl exception stack support. +01e,12may04,zl use new name format for global msgQ +01d,27apr04,zl reworking show support. +01c,12mar04,zl ED&R error injection integration +01b,02feb04,zl implemented guard zone support. Fixes from code inspection. +01a,02dec03,zl created +*/ + +#ifndef __INCmemEdrLibPh +#define __INCmemEdrLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "avlUintLib.h" +#include "dllLib.h" +#include "poolLib.h" +#include "semLib.h" +#include "private/taskLibP.h" +#include "private/memPartLibP.h" +#ifndef _WRS_KERNEL +#include "tlsLib.h" +#else +#include "private/edrLibP.h" +#endif + +/* definitions */ + +#define MD_ANY 0 /* any type */ +#define MD_VAR 1 /* global variable */ +#define MD_ALLOC 2 /* allocated block */ +#define MD_FREE 3 /* free queued */ +#define MD_STACK 4 /* stack (local) variable */ +#define MD_REALLOC 5 /* interim realloc status */ +#define MD_MASK 0x07 + +#define MF_MARKED 0x10 /* marked by user */ +#define MF_REFERENCED 0x20 /* reference found (not leaked) */ +#define MF_REPORTED 0x40 /* memory leak was reported */ + +#define FREE_PATTERN 0xdd +#define MEM_TRACE_LEN (sizeof (MEM_EDR_BLK) / sizeof (void *)) + /* trc. buff size same as MEM_EDR_BLK */ + +/* partition info status field */ + +#define PART_INST_ENABLED 0x0001 /* instrumentation enabled */ +#define PART_INST_FAILED 0x0002 /* hook install failed */ +#define PART_DELETED 0x0003 /* deleted */ + +/* + * severity levels; these are similar to edrLib, but we use different + * definitions for portability. + */ + +#define MEM_EDR_FATAL 0x01 +#define MEM_EDR_ERROR 0x02 +#define MEM_EDR_WARNING 0x03 +#define MEM_EDR_INFO 0x04 + +#ifndef _ASMLANGUAGE + +/* block mode set/get macros */ + +#define MODE_GET(m) ((m)->blkFlags & MD_MASK) +#define MODE_SET(m,v) ((m)->blkFlags = ((m)->blkFlags & ~MD_MASK) | \ + ((v) & MD_MASK)) + +/* macros for mutex */ + +#define MEM_EDR_MUTEX_OPT SEM_Q_PRIORITY | \ + SEM_DELETE_SAFE | \ + SEM_INVERSION_SAFE + + +#define MEM_EDR_LOCK() semTake(&memEdrDb.sem, WAIT_FOREVER) +#define MEM_EDR_UNLOCK() semGive(&memEdrDb.sem) +#define MEM_EDR_LOCK_INIT() semMInit(&memEdrDb.sem, MEM_EDR_MUTEX_OPT) + + +#define ADDR_ADD(x,y) ((void *)((char *)(x) + (UINT)(y))) + +#ifdef _WRS_KERNEL + +#define TINFO_GET() ((EDR_TCB_INFO *) taskIdCurrent->pEdrInfo) +#define LOCALS_GET() (TINFO_GET() == NULL ? NULL : \ + TINFO_GET()->memEdrLocals) +#define LOCALS_PGET() (TINFO_GET() == NULL ? NULL : \ + &TINFO_GET()->memEdrLocals) +#define STACK_BASE_GET() (taskIdCurrent == NULL ? NULL : \ + (taskIdCurrent->excCnt == 0 ? \ + taskIdCurrent->pStackBase :\ + taskIdCurrent->pExcStackBase)) +#define STACK_END_GET() (taskIdCurrent == NULL ? NULL : \ + (taskIdCurrent->excCnt == 0 ? \ + taskIdCurrent->pStackEnd :\ + taskIdCurrent->pExcStackEnd)) + +#else /* _WRS_KERNEL */ + +extern TLS_KEY memEdrTlsKey; + +#define TINFO_GET() ((MEM_EDR_TASK *) TLS_VALUE_GET(memEdrTlsKey)) +#define TINFO_CAST() ((MEM_EDR_TASK *) rtpTlsCurrent[memEdrTlsKey]) +#define LOCALS_GET() (TINFO_GET() == NULL ? NULL : TINFO_CAST()->locals) +#define LOCALS_PGET() (TINFO_GET() == NULL ? NULL : &TINFO_CAST()->locals) +#define STACK_BASE_GET() (TINFO_GET() == NULL ? NULL : TINFO_CAST()->pStackBase) +#define STACK_END_GET() (TINFO_GET() == NULL ? NULL : TINFO_CAST()->pStackEnd) + +#endif /* _WRS_KERNEL */ + + +#define IS_PTR_IN_CURRENT_STACK(p) \ + (((p) >= STACK_END_GET()) && ((p) < STACK_BASE_GET())) + +#define EXTD_BUF_GET(m) \ + ((MEM_EDR_EXTD *) ((char *) (m) + sizeof (MEM_EDR_BLK))) + + +#define MEDR_PART_INFO_CMD 1 +#define MEDR_BLOCK_INFO_CMD 2 +#define MEDR_BLOCK_MARK_CMD 3 + +#define MEM_EDR_SHOW_PRINT_CNT 20 + +#define MEDR_CMD_Q_FMT "/qMedrCmd%x" +#define MEDR_INF_Q_FMT "/qMedrInf%x" + +/* typedefs */ + + +/* structure defining the member blocks of the database tree */ + +typedef struct mem_edr_blk + { + AVLU_NODE adrNode; /* AVL node (16 bytes) */ + UINT blkFlags; /* flags (4 bytes) */ + UINT blkSize; /* size of block (4 bytes) */ + union + { + struct + { + PART_ID partId; /* memory partition (4 bytes) */ + int taskId; /* task id (4 bytes) */ + } gbl; + struct + { + struct mem_edr_blk * next; /* next in list (4 bytes) */ + int level; /* call stack level (4 bytes) */ + } loc; + } inf; + } MEM_EDR_BLK; /* obtained from pool; */ + /* must be exactly 32 bytes */ + +/* trace information */ + +typedef struct mem_edr_extd + { + void * trace[MEM_TRACE_LEN]; /* trace buffer */ + } MEM_EDR_EXTD; /* obtained from pool, */ + /* must be <= 32 bytes */ + +/* task info */ + +typedef struct mem_edr_task + { + AVLU_TREE locals; /* AVL tree for locals */ + UINT ctrl; /* enable features per task */ +#ifndef _WRS_KERNEL + char * pStackBase; /* stack base (user lib only) */ + char * pStackEnd; /* stack end (user lib only) */ +#endif + } MEM_EDR_TASK; /* obtained from pool, */ + /* must be <= 32 bytes */ + +/* partition info */ + +typedef struct mem_edr_part + { + DL_NODE node; /* DLL node */ + PART_ID partId; /* partition ID */ + FUNC_ALLOC allocFunc; /* allocation function */ + FUNC_FREE freeFunc; /* free function */ + FUNC_REALLOC reallocFunc; /* reallocation function */ + unsigned defAlign; /* default alloc alignment */ + UINT32 status; /* partition ctrl and status */ + } MEM_EDR_PART; /* obtained from pool, */ + /* must be <= 32 bytes */ +/* free queue node */ + +typedef struct mem_edr_free + { + DL_NODE node; /* list node */ + MEM_EDR_BLK * pBlk; /* pointer to block info */ + FUNC_FREE freeFunc; /* function for freeing block */ + } MEM_EDR_FREE; /* obtained from pool, */ + /* must be <= 32 bytes */ + +/* database info */ + +typedef struct mem_edr_db + { + BOOL isKernel; /* TRUE if kernel database */ + BOOL memEdrInitialized; /* library init complete */ + BOOL extendedEnabled; /* trace collection enabled */ + BOOL freePatternEnabled; /* pattern-fill freed blocks */ + BOOL guardEnabled; /* block guard zone */ + POOL_ID memEdrPoolId; /* pool ID used for DB */ + AVLU_TREE avlRoot; /* block database root */ + DL_LIST freeQueue; /* free block queue */ + unsigned freeQueueMax; /* maximum for free queue */ + unsigned freeQLen; /* lenght of free queue */ + DL_LIST partList; /* partition list */ + SEMAPHORE sem; /* mutex semaphore */ + /* IMPORTANT: keep sem last */ + /* in structure: user and */ + /* kernel sizes differ! */ + } MEM_EDR_DB; + +/* show support structures */ + +typedef struct mem_edr_filter + { + int level; /* detail level */ + int partId; /* partition ID selector */ + void * addr; /* address */ + int taskId; /* task ID selector */ + UINT type; /* block type selector */ + int count; /* block show counter */ + int first; /* first to get */ + int last; /* last to get */ + } MEM_EDR_FILTER; + +typedef struct mem_edr_part_info + { + int partId; /* partition ID */ + UINT status; /* partition status */ + UINT allocBlocks; /* allocated blocks */ + UINT allocBytes; /* allocated bytes */ + UINT fqBlocks; /* blocks in free queue */ + MEM_EDR_PART * next; /* next in partition list */ + } MEM_EDR_PART_INFO; + +typedef struct mem_edr_blk_info + { + MEM_EDR_BLK blk; /* memory block info */ + MEM_EDR_EXTD xtd; /* extended memory block info */ + } MEM_EDR_BLK_INFO; + +typedef struct mem_edr_show_cmd + { + int cmd; /* command */ + MEM_EDR_PART * pPart; /* partition info pointer */ + int partId; /* parittion ID */ + MEM_EDR_FILTER filt; /* block filter */ + } MEM_EDR_SHOW_CMD; + +typedef struct mem_edr_part_msg + { + STATUS status; /* info get status */ + MEM_EDR_PART_INFO partInfo; /* partition info */ + } MEM_EDR_PART_MSG; + +typedef struct mem_edr_blk_msg + { + STATUS status; /* info get status */ + int count; /* block count */ + MEM_EDR_BLK_INFO blkInfo[MEM_EDR_SHOW_PRINT_CNT]; + } MEM_EDR_BLK_MSG; + +typedef union + { + MEM_EDR_PART_MSG part; /* partition info message */ + MEM_EDR_BLK_MSG blk; /* block info message */ + } MEM_EDR_SHOW_MSG; + + +/* private globals */ + +extern MEM_EDR_DB memEdrDb; + +/* private functions */ + +extern void memEdrConfigInit (BOOL extendedEnable, BOOL freePatternEnable, + int freeQueueMax, BOOL guardEnable); +extern void memEdrConfigClear (void); +extern STATUS memEdrMemInit (void * pPool, int poolSize); +extern void memEdrErrorLog (int severity, char * file, int line, void * ptr, + int offs, size_t sz, MEM_EDR_BLK * pBlk, + PART_ID partId, char * msg); +extern MEM_EDR_BLK * memEdrBlockFind (AVLU_TREE avlRoot, void * pStart, + void * pEnd); +extern MEM_EDR_BLK * memEdrLocalFind (void * pStart, void * pEnd); +extern void * memEdrItemGet (POOL_ID poolId); +extern STATUS memEdrPartInfoGet (MEM_EDR_PART * pEdrPart, PART_ID partId, + MEM_EDR_PART_INFO * pInfo); +extern STATUS memEdrBlockInfoGet (MEM_EDR_FILTER * pFilt, + MEM_EDR_BLK_INFO * pBlocks); +extern STATUS memEdrShowUtilInit (); +extern void memEdrPartInfoPrint (MEM_EDR_PART_INFO * pInfo); +extern void memEdrBlockInfoPrint (MEM_EDR_BLK_INFO * pInfo, int level, + RTP_ID rtpId); +extern void memEdrPartHdrPrint (); +extern void memEdrBlockHdrPrint (); +extern BOOL memEdrUserStopGet (BOOL first); +extern int memEdrTaskUidGet (int taskId); +extern int memEdrBlockMark (int partId, int taskId, BOOL unmark); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmemEdrLibPh */ diff --git a/h/private/memInfoP.h b/h/private/memInfoP.h new file mode 100644 index 0000000..12c1b89 --- /dev/null +++ b/h/private/memInfoP.h @@ -0,0 +1,52 @@ +/* memInfoP.h - Memory management information */ + +/* Copyright 1998-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01d,03jun05,yvp Added #ifndef _ASMLANGUAGE. + Updated copyright. #include now with angle-brackets. +01c,17may04,tam removed unused fields heapId, rtpId & virtPgSize +01b,04nov03,tam removed unecessary definitions +01a,22oct03,gls ported from AE version 01n +*/ + +#ifndef __INCmemInfoPh +#define __INCmemInfoPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vmLib.h" +#include "private/pgPoolLibP.h" +#include "private/pgMgrLibP.h" + +/* defines */ + + +#ifndef _ASMLANGUAGE + +/* typedefs */ + +typedef struct mem_info + { + VM_CONTEXT_ID vmContextId; /* virtual memory context */ + PAGE_POOL_ID virtPgPoolId; /* virtual page pool */ + PAGE_POOL_ID physPgPoolId; /* physical page pool list */ + PAGE_MGR_ID pgMgrId; /* primary page manager */ + UINT adrsSpaceId; /* address space ID */ + DL_LIST mmapList; /* list of mmap blocks */ + } MEM_INFO; + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmemInfoPh */ diff --git a/h/private/memPartLibP.h b/h/private/memPartLibP.h new file mode 100644 index 0000000..f4df34b --- /dev/null +++ b/h/private/memPartLibP.h @@ -0,0 +1,464 @@ +/* memPartLibP.h - private memory management library header file */ + +/* + * Copyright (c) 1992-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + + +/* +modification history +-------------------- +01u,27sep05,zl added ED&R option bits to MEM_OPTIONS_MASK. +01t,09aug05,zl use semMTake() and semMGive() in the lock/unlock macros. +01s,26jul05,mil Added prototype for memAllotLibInit. +01r,12jul05,mil Added memAllot support to minimal kernel. +01q,14apr05,zl changed CHUNK_MIN_SIZE to larger minimum block +01p,16feb05,aeg added memBlockSizeGet() function prototype (SPR #106381). +01o,03may04,zl made cumWordsAllocated 64-bit, removed minBlockWords. +01n,03feb04,zl added allocated block guard signature support. +01m,03nov03,zl added create, delete, alloc, free, realloc hooks. +01l,20oct03,zl updated for new avlLib API. +01k,27jun03,tam merge with latest VxWorks AE version +01i,14mar03,pch runtime sizing of BLOCK_HDR for PPC32 +01h,23oct01,tam re-organized FREE_BLOCK +01g,19oct01,tam added definition for KMEM_XXX macros +01f,25sep01,tam added definition of the KHEAP_XXX macros +01e,19aug96,dbt removed memPartAlignedAlloc prototype (fixed SPR #6898). +01e,05aug96,kkk made padding in BLOCK_HDR generic to all arch with alignment + at 16. +01d,22sep92,rrr added support for c++ +01c,28jul92,jcf added external declaration for memPartOptionsDefault. +01b,19jul92,pme added external declarations for sm partition functions. +01a,01jul92,jcf extracted from memLib v3r. +*/ + +#ifndef __INCmemPartLibPh +#define __INCmemPartLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + + +/* + * Kernel memory allocation macros (KHEAP and KMEM macros) + * + * NOTE: They should not be used by any application code. + * It is also needed by code being back-ported from VxWorks AE 1.x. to VxWorks + * 5.5.x. + */ + +/* + * KHEAP macros: + * These macros are defined simply for cosmetic reasons, to make it more + * obvious that buffers are allocated or freed from the kernel heap, also + * called the system memory partition. + * No guaranty is given that the buffer allocated from the Kernel + * Heap via KHEAP_ALLOC has a known and constant virtual to physical mapping + * (1 to 1 mapping for instance) if virtual memory support is included (i.e. + * INCLUDE_MMU_BASIC or INCLUDE_MMU_FULL components). + * + * NOTE: with the exception of KHEAP_REALLOC(), the definitions are based + * on API from memPartLib.c, to prevent any requirements on + * INCLUDE_MEM_MGR_FULL (memLib.c). + */ + +#define KHEAP_ALLOC(nBytes) \ + memPartAlloc(memSysPartId, (nBytes)) +#define KHEAP_FREE(pChar) \ + memPartFree(memSysPartId, (char *)(pChar)) +#define KHEAP_ALIGNED_ALLOC(nBytes, alignment) \ + memPartAlignedAlloc(memSysPartId, (nBytes), (alignment)) +#define KHEAP_REALLOC(pChar, newSize) \ + memPartRealloc(memSysPartId, (pChar), (newSize)) + + +/* + * KMEM macros: + * If a known and constant virtual to physical mapping is required for buffer + * allocated, KMEM macros should be used instead of KHEAP macros. + * For instance memory block dynamically allocated that may be accessed when + * the processor MMU is turn off or on should always be allocated using + * KMEM_ALLOC() or KMEM_ALIGNED_ALLOC(). Good examples are memory blocks used + * to store MMU translation information on some processor, or memory blocks + * accessed by DMA devices. + * Good care should be taken before using KMEM macros. If no constant virtual + * to physical mapping is required, then KHEAP macros should always be used + * instead. + * + * NOTE: With VxWorks 5.5.x, there's no differences between KHEAP_XXX and + * KMEM_XXX macros. However this will change in future releases. + */ + +#ifdef INCLUDE_MEM_ALLOT + +/* minimal kernel definitions, KMEM_FREE is not available */ + +#define KMEM_ALLOC(nBytes) \ + memAllot((nBytes), 0) +#define KMEM_ALIGNED_ALLOC(nBytes, alignment) \ + memAllot((nBytes), (alignment)) + +extern void * memAllot (unsigned size, unsigned alignment); +extern STATUS memAllotLibInit (char * pPool, unsigned poolSize); + +#else /* INCLUDE_MEM_ALLOT */ + +#define KMEM_ALLOC(nBytes) \ + memPartAlloc(memSysPartId, (nBytes)) +#define KMEM_FREE(pChar) \ + memPartFree(memSysPartId, (pChar)) +#define KMEM_ALIGNED_ALLOC(nBytes, alignment) \ + memPartAlignedAlloc(memSysPartId, (nBytes), (alignment)) + +#endif /* INCLUDE_MEM_ALLOT */ + + +/* + * For PowerPC, _ALLOC_ALIGN_SIZE is a variable whose runtime value is not + * known when compiling generic code (i.e. with CPU=PPC32), so the conditional + * padding in the ALLOC_CHUNK_HDR and MEM_SECTION_HDR definitions does not work. + * The folowing definitions are based on the size of ALLOC_CHUNK_HDR being 16, + * and the size of MEM_SECTION_HDR being 8. + * NOTE: The assembly code will be slightly longer for PowerPC CPUs than + * for architectures for which _ALLOC_ALIGN_SIZE value can be resolved by the + * processor. + */ + +#define ALLOC_CHUNK_HDR_SIZE sizeof(ALLOC_CHUNK_HDR) +#define MEM_SECTION_HDR_SIZE max(_ALLOC_ALIGN_SIZE, sizeof(MEM_SECTION_HDR)) + + +#define PREV_CHUNK_IS_FREE 1 +#define CHUNK_SIZE_MASK (~(PREV_CHUNK_IS_FREE)) + +/* macros for getting to next and previous blocks */ + +#define NEXT_CHUNK_HDR(pHdr) ((FREE_CHUNK_HDR *) (((UINT32) (pHdr)) + \ + ((pHdr)->size & CHUNK_SIZE_MASK))) +#define PREV_CHUNK_HDR(pHdr) ((FREE_CHUNK_HDR *) (((UINT32) (pHdr)) - \ + ((pHdr)->prevSize))) + + +/* + * macros for converting between the "block" that caller knows + * (actual available data area) and the chunk header in front of it + * The memory chunck is the header plus the data block. + */ + +#define BLOCK_TO_CHUNK_HDR(pBlock) ((ALLOC_CHUNK_HDR *) (((UINT32) (pBlock)) - \ + ALLOC_CHUNK_HDR_SIZE)) +#define CHUNK_HDR_TO_BLOCK(pHdr) ((char *) (((UINT32) (pHdr)) + \ + ALLOC_CHUNK_HDR_SIZE)) + + +/* macro to get to end guard */ + +#define BLOCK_END_GUARD(pHdr) ((UINT *) (((UINT32) (pHdr)) + \ + ((pHdr)->size & CHUNK_SIZE_MASK) - \ + allocChunkEndGuardSize)) + +/* + * optimized version of NEXT_CHUNK_HDR for cases where we know that + * the current block is free (so the previous one can not be free !) + */ + +#define NEXT_CHUNK_HDR_FREE(pHdr) ((CHUNK_HDR *) (((UINT32) (pHdr)) + \ + ((pHdr)->size))) + + +/* overhead of allocated, free chunks and region */ + +#define CHUNK_ALLOC_OVERHEAD (ALLOC_CHUNK_HDR_SIZE + allocChunkEndGuardSize) +#define CHUNK_FREE_OVERHEAD (sizeof(FREE_CHUNK_HDR)) +#define MEM_SECTION_OVERHEAD (MEM_SECTION_HDR_SIZE) +#define MIN_BLOCK_WORDS ((CHUNK_FREE_OVERHEAD) >> 1) + +/* + * minimum meaningfull size for a chunk. This is due to the fact that: + * - any allocted chunk must be convertible into a free chunk eventually. + * - a free chunk should accomodate allocation of at least 16 bytes to + * avoid creation of very small free blocks that could cause + * fragmentation. + */ + +#define CHUNK_MIN_SIZE (max (CHUNK_FREE_OVERHEAD, \ + CHUNK_ALLOC_OVERHEAD + MEM_ROUND_UP(16))) + +/* + * minimum size of a memory region added via memPartAddToPool. This is due to + * the fact that any region has to host at least 3 allocated blocks of size 0 + * plus a free block of size 0 plus a region header. Assume worst case with, + * end guards enabled. + */ + +#define REGION_START_OVERHEAD (MEM_SECTION_OVERHEAD + ALLOC_CHUNK_HDR_SIZE + \ + END_GUARD_WORDS * sizeof (UINT) + \ + CHUNK_FREE_OVERHEAD) +#define REGION_END_OVERHEAD (2 * (ALLOC_CHUNK_HDR_SIZE + \ + END_GUARD_WORDS * sizeof (UINT))) + +#define REGION_MIN_SIZE (REGION_START_OVERHEAD + REGION_END_OVERHEAD) + +/* + * actual size of the data block within an allocated chunck, retrieved from + * the chunk header address (BLOCK_SIZE) or the buffer address (MEM_BLOCK_SIZE) + */ + +#define BLOCK_SIZE(pHdr) (((pHdr)->size & CHUNK_SIZE_MASK) - \ + CHUNK_ALLOC_OVERHEAD) +#define MEM_BLOCK_SIZE(pBlock) memBlockSizeGet((void *)(pBlock)) + + +#define ALIGN_NEXT(size,align) ((((UINT)(size)) + align - 1) & (~(align - 1))) + + + +#define MEM_PART_SHOW_LOG_LVL_1 1 /* memPartShow: display numbers of free */ + /* blocks of a given size */ +#define MEM_PART_SHOW_LOG_LVL_2 2 /* memPartShow: display numbers of free */ + /* blocks of a given size plus the address */ + /* of each free block */ + +#define SIZE_NODE_MIN_NB 4 /* minimum number of available bin */ + /* size nodes at any time */ +#define SIZE_NODE_INIT_NB 8 /* number of available bin at the */ + /* creation of the partition should */ + /* NOT be LESS than */ + /* SIZE_NODE_MIN_NB */ +#define SIZE_NODE_DEFAULT_NB 8 /* number of bin size nodes */ + /* allocated at a time by default */ + +/* partition option mask */ + +#define MEM_OPTIONS_MASK (MEM_BLOCK_CHECK | \ + MEM_ALLOC_ERROR_EDR_FATAL_FLAG | \ + MEM_ALLOC_ERROR_EDR_WARN_FLAG | \ + MEM_ALLOC_ERROR_LOG_FLAG | \ + MEM_ALLOC_ERROR_SUSPEND_FLAG | \ + MEM_BLOCK_ERROR_EDR_FATAL_FLAG | \ + MEM_BLOCK_ERROR_EDR_WARN_FLAG | \ + MEM_BLOCK_ERROR_LOG_FLAG | \ + MEM_BLOCK_ERROR_SUSPEND_FLAG | \ + MEM_ALLOC_ERROR_MASK | \ + MEM_BLOCK_ERROR_MASK) + + +/* pattern to fill guard zones */ + +#define GUARD_PATTERN 0xa110cb1c +#define END_GUARD_WORDS 4 + + +#ifndef _ASMLANGUAGE + +#define MEM_PART_ID_VERIFY(partId) \ + (((partId) == NULL) ? ERROR : \ + OBJ_VERIFY ((partId), memPartClassId)) +#define MEM_PART_INVALIDATE(partId) \ + objCoreInvalidate (&(partId)->objCore) + +#define MEM_PART_LOCK(partId) \ + semMTake (&(partId)->sem, WAIT_FOREVER) +#define MEM_PART_VERIFIED_LOCK(partId) \ + memPartVerifiedLock(partId) +#define MEM_PART_UNLOCK(partId) \ + semMGive (&(partId)->sem) + +/* typedefs */ + +typedef void * (*FUNC_ALLOC) (PART_ID partId, unsigned nBytes, + unsigned alignment); +typedef STATUS (*FUNC_FREE) (PART_ID partId, char * pBlk); +typedef void * (*FUNC_REALLOC) (PART_ID partId, char * pBlk, unsigned nBytes); +typedef STATUS (*FUNC_CREATE_HOOK) (PART_ID partId, FUNC_ALLOC allocFunc, + FUNC_FREE freeFunc, + FUNC_REALLOC reallocFunc, + unsigned defAlign); +typedef void * (*FUNC_ALLOC_HOOK) (PART_ID partId, void * arg, unsigned nBytes, + unsigned alignment); +typedef STATUS (*FUNC_FREE_HOOK) (PART_ID partId, void * arg, char * ptr); +typedef void * (*FUNC_REALLOC_HOOK) (PART_ID partId, void * arg, char * ptr, + unsigned nBytes); +typedef STATUS (*FUNC_DELETE_HOOK) (PART_ID partId, void * arg); + +/* + * Data structure for a memory section (i.e. piece of memory added to a + * a partition via memPartAddToPool + */ + +typedef struct mem_section_hdr + { + /* pointer to the next section part of the memory partition */ + + SL_NODE sectionNode; + + /* size of this section */ + + UINT size; + + /* padding is done through MEM_SECTION_HDR_SIZE */ + + } MEM_SECTION_HDR; + +/* data structure for a free chunk */ + +typedef struct free_chunk_hdr + { + /* size of previous chunk */ + + UINT prevSize; + + /* size of current chunk + flag indicating if previous chunk is free */ + + UINT size; + + /* + * pointers to previous and next free chunks of the same size + */ + + struct free_chunk_hdr * next; + struct free_chunk_hdr * prev; + + } FREE_CHUNK_HDR; + +/* the order of the fields in MEM_PART_SIZE_NODE is important */ + +typedef struct + { + AVLU_NODE avlSize; /* AVL tree sorted by the size key */ + FREE_CHUNK_HDR * next; /* pointer to the first free chunck */ + FREE_CHUNK_HDR * prev; /* pointer to the last free chunck */ + + } MEM_PART_SIZE_NODE; + +/* memory partition data structure */ + +typedef struct mem_part + { + OBJ_CORE objCore; /* object management */ + + AVLU_TREE avlSize; /* root of the size node AVL tree */ + UINT sizeNodeNb; /* number of used avl size node */ + + MEM_PART_SIZE_NODE * freeSizeNode; /* pointer to first free size node */ + UINT freeSizeNodeNb; /* number of remaining free size node */ + + SEMAPHORE sem; /* partition semaphore */ + unsigned totalWords; /* total number of words in partition */ + unsigned options; /* options */ + SL_LIST sectionHdrLst; /* list of sections in partition */ + + /* alloc hooks */ + + FUNC_ALLOC_HOOK allocHook; /* hook for memPartAlignedAlloc */ + FUNC_FREE_HOOK freeHook; /* hook for memPartFree */ + FUNC_REALLOC_HOOK reallocHook; /* hook for memPartRealloc */ + FUNC_DELETE_HOOK deleteHook; /* hook for memPartDelete */ + void * hookArg; /* argument for hooks */ + + /* allocation statistics */ + + UINT32 curBlocksFreed; /* current # of blocks freed */ + UINT32 curWordsFreed; /* current # of words freed */ + UINT32 curBlocksAllocated; /* current # of blocks allocated */ + UINT32 curWordsAllocated; /* current # of words allocated */ + UINT64 cumBlocksAllocated; /* cumulative # of blocks allocated */ + UINT64 cumWordsAllocated; /* cumulative # of words allocated */ + UINT32 maxWordsAllocated; /* peak # of words allocated */ + UINT32 curBlocksAllocatedInternal; /* current # of blocks allocated */ + /* for internal use */ + UINT32 curWordsAllocatedInternal; /* current # of words allocated */ + /* for internal use */ + +#ifdef ENABLE_LOCALITY_PRESERVATION + /* locality preservation support */ + + FREE_CHUNK_HDR * lastSplittedChunkHdr; + UINT lastSplittedChunkSize; +#endif + } PARTITION; + + +/* data structure for an allocated chunk */ + +typedef struct alloc_chunk_hdr + { + /* size of previous chunk */ + + UINT prevSize; + + /* size of current chunk + flag indicating if previous chunk is free */ + + UINT size; + + /* partition ID */ + + PART_ID memPartId; + + /* head guard */ + + UINT headGuard; + + } ALLOC_CHUNK_HDR; + + +/* definitions for backward compatibility */ + +#define BLOCK_HDR ALLOC_CHUNK_HDR +#define FREE_BLOCK FREE_CHUNK_HDR +#define BLOCK_TO_HDR(pBuf) BLOCK_TO_CHUNK_HDR(pBuf) + + +/* variable declarations */ + +extern CLASS_ID memPartClassId; /* memory partition class id */ +extern FUNCPTR memPartBlockErrorRtn; /* block error method */ +extern FUNCPTR memPartAllocErrorRtn; /* alloc error method */ +extern FUNCPTR memPartSemInitRtn; /* partition semaphore init method */ +extern unsigned memPartOptionsDefault; /* default partition options */ +extern UINT memDefaultAlignment; /* default alignment */ +extern int mutexOptionsMemLib; /* mutex options */ + +/* shared memory manager function pointers */ + +extern FUNCPTR smMemPartAddToPoolRtn; +extern FUNCPTR smMemPartFreeRtn; +extern FUNCPTR smMemPartAllocRtn; + + +/* function declarations */ + +extern BOOL memPartBlockIsValid (PART_ID partId, FREE_CHUNK_HDR *pHdr, + BOOL isFree); +extern STATUS memPartBlockValidate (PART_ID partId, char * pBlock); +extern STATUS memPartCreateHookSet (FUNC_CREATE_HOOK createHook, + BOOL guardEnable); +extern STATUS memPartHooksInstall (PART_ID partId, void * hookArg, + FUNC_ALLOC_HOOK allocHook, + FUNC_FREE_HOOK freeHook, + FUNC_REALLOC_HOOK reallocHook, + FUNC_DELETE_HOOK deleteHook); +extern STATUS memPartVerifiedLock (PART_ID partId); +extern UINT memBlockSizeGet (void * pBlock); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmemPartLibPh */ diff --git a/h/private/mmanP.h b/h/private/mmanP.h new file mode 100644 index 0000000..0c7bf19 --- /dev/null +++ b/h/private/mmanP.h @@ -0,0 +1,42 @@ +/* mmanP.h - memory management library private header file */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,09apr04,tam written +*/ + +#ifndef __INCmmanPh +#define __INCmmanPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" +#include "dllLib.h" + +/* typedefs */ + +#ifndef _ASMLANGUAGE +typedef struct mm_node + { + DL_NODE node; + void * addr; /* start address of the mmap'ed memory area */ + size_t len; /* size in bytes of the mmap'ed memory area */ + int access; /* access attributes of the whole memory area */ + int minAccess; /* minimal access to any page within the */ + /* mmap'ed memory area */ + } MM_NODE; + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmmanPh */ diff --git a/h/private/mmuSoftLibP.h b/h/private/mmuSoftLibP.h new file mode 100644 index 0000000..07c15dc --- /dev/null +++ b/h/private/mmuSoftLibP.h @@ -0,0 +1,26 @@ +/* mmuSoftLibP.h - private header for software MMU simulation library */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,08apr04,zl written. +*/ + +#ifndef __INCmmuSoftLibPh +#define __INCmmuSoftLibPh + +#ifdef __cplusplus +extern "C" { +#endif + + +STATUS mmuSoftLibInit (int mmuPageSize, VIRT_ADDR startAddr, + VIRT_ADDR kernelTop); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvmLibPh */ diff --git a/h/private/moduleLibP.h b/h/private/moduleLibP.h new file mode 100644 index 0000000..4ffec8c --- /dev/null +++ b/h/private/moduleLibP.h @@ -0,0 +1,115 @@ +/* moduleLibP.h - private module descriptor structure header */ + +/* + * Copyright (c) 2004-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01i,18mar05,v_r Added moduleSectionChecksumSet() as needed by host side. +01h,15feb05,v_r Fixed SPR #98274 (loader errno review). Added moduleIdVerify() + as it's also used by host side now. +01g,21oct04,x_p Added moduleDescDestroy prototype +01f,21sep04,jn Final minor changes to allow code-sharing +01e,18sep04,jn Move towards shared code between host and target +01d,08jun04,x_p Added flags in MODULE_SEG_INFO +01c,31may04,jn Make section related API's available +01b,05apr04,jn Clean up - remove unused declarations and development-related + comments +01a,28oct98,pad Created based on AE version. +*/ + +#ifndef __INCmoduleLibPh +#define __INCmoduleLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#ifdef HOST +#include "host.h" +#include "vmutex.h" +#include "pdLib.h" +#include "tgtmem.h" +#include "objLib.h" +#include "dllLib.h" +#include "private/loadFileLibP.h" +#else +#include "vxWorks.h" +#include "limits.h" +#include "dllLib.h" +#include "semLib.h" +#include "memPartLib.h" +#include "private/handleLibP.h" +#include "private/loadFileLibP.h" +#endif /* HOST */ + +#include "moduleLib.h" + +/* typedefs */ +typedef struct modListDesc /* module list descriptor */ + { +#ifdef HOST + OBJ_CORE handle; /* handle management */ +#else + HANDLE handle; /* handle management */ +#endif /* HOST */ + DL_LIST moduleList; /* list of loaded modules */ + SEM_ID moduleListSem; /* semaphore to protect moduleList */ + SEM_ID moduleSectionSem; /* semaphore to protect all scn lists */ + SEM_ID moduleSegmentSem; /* semaphore to protect all segment lists */ + DL_LIST moduleCreateHookList; /* list of associated create hooks */ + SEM_ID moduleCreateHookSem; /* semaphore to protect create hooks */ + BOOL moduleCreateHookInitialized; /* should be initialized to FALSE */ + PART_ID memPartId; /* dedicated memory partition ID */ + } MODLIST_DESC; + +typedef struct + { + DL_NODE node; + FUNCPTR func; + } MODCREATE_HOOK; + +/* defines */ + +#define MDLNODE_TO_ID(pNode) (pNode != NULL ? (MODULE_ID) ((char *) pNode - \ + offsetof (MODULE, moduleNode)) \ + : NULL) + +#define SCNNODE_TO_ID(pNode) (pNode != NULL ? (SECTION_ID) ((char *) pNode - \ + offsetof(SECTION_DESC, sectionNode))\ + : NULL) + +/* global var declarations */ + +extern MODLIST_ID kernelModuleListId; + +/* Function declarations */ + +extern STATUS moduleDescDestroy(MODULE_ID moduleId, BOOL dealloc); +extern STATUS moduleIdVerify(MODULE_ID moduleId); +extern SECTION_ID moduleFirstSectionGet(MODULE_ID moduleId); +extern SECTION_ID moduleNextSectionGet(SECTION_ID sectionId); +extern int moduleSectionChecksumGet(SECTION_ID sectionId); +extern STATUS moduleSectionChecksumSet(SECTION_ID sectionId); +extern STATUS moduleSectionDescFree(SECTION_ID sectionId); +extern SECTION_ID moduleSectionDescGet(MODULE_ID moduleId); +extern SECTION_ID moduleSectionRegister (MODULE_ID moduleId, char *name, + SECTION_T type, void * location, + int length, int flags); +extern STATUS moduleSegInfoGet(MODULE_ID moduleId, + MODULE_SEG_INFO * pModSegInfo); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmoduleLibPh */ + diff --git a/h/private/mqPxLibP.h b/h/private/mqPxLibP.h new file mode 100644 index 0000000..20d48fc --- /dev/null +++ b/h/private/mqPxLibP.h @@ -0,0 +1,92 @@ +/* mqPxLibP.h - private POSIX message queue library header */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,28sep04,fr removed mqPxCreateRtn prototype (SPR 101349) +01h,30mar04,dcc updated to use posixated objLib. +01g,05dec03,m_s code-inspection changes +01f,31oct03,m_s removed symLib and added extern for class id + moved mq_des definition to public header file for Base 6 +01e,20jun03,ymz moved OBJ_CORE from mq_des to msg_que. +01d,24mar99,elg mqLibInit() must be in mqueue.h (SPR 20532). +01c,03feb94,kdl moved structure definitions from mqPxLib.c. +01b,12jan94,kdl changed mqLibInit() to mqPxLibInit(); added defines for + default queue and message size. +01a,02dec93,dvs written +*/ + +#ifndef __INCmqPxLibPh +#define __INCmqPxLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "stdarg.h" +#include "mqueue.h" +#include "qLib.h" +#include "private/sigLibP.h" +#include "private/objLibP.h" + +extern CLASS_ID mqClassId; /* POSIX message queue class ID */ + +/* defines */ + +/* message queue object */ + +struct msg_que + { + OBJ_CORE objCore; + Q_HEAD msgq_cond_read; + Q_HEAD msgq_cond_data; + int msgq_sigTask; + struct sigpend msgq_sigPend; + unsigned long msgq_bmap; + struct sll_node *msgq_data_list[MQ_PRIO_MAX]; + struct sll_node *msgq_free_list; + struct mq_attr msgq_attr; + }; + +/* message queue descriptor for kernel applications */ + +struct mq_des + { + int f_flag; + struct msg_que * f_data; + }; + +/* a node to manage message buffer lists */ + +struct sll_node + { + struct sll_node *sll_next; + size_t sll_size; + }; + + +/* function declarations */ + +extern int mqPxLibInit (int); + +extern int _mq_close (struct msg_que * pMq); +extern ssize_t _mq_receive (struct msg_que * pMq, + void * pMsg, + size_t msgLen, + unsigned int * pMsgPrio, + BOOL nonBlock); +extern int _mq_send (struct msg_que * pMq, + const void * pMsg, + size_t msgLen, + unsigned int msgPrio, + BOOL nonBlock); +extern int _mq_notify (struct msg_que * pMq, + const struct sigevent * pNotification); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmqPxLibPh */ diff --git a/h/private/mqPxSysCall.h b/h/private/mqPxSysCall.h new file mode 100644 index 0000000..6a1e0ab --- /dev/null +++ b/h/private/mqPxSysCall.h @@ -0,0 +1,52 @@ +/* mqPxSysCall.h - POSIX message queue system calls */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,24mar04,mcm Including time.h instead of sys/time.h in user space. +01a,17nov03,m_s written +*/ + +#ifndef __INCmqPxSysCallh +#define __INCmqPxSysCallh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "objLib.h" +#include "pxObjSysCall.h" + +#include "time.h" + +/* typedefs */ + +/* structures for pxCtl system call */ + +struct mqNotifyArgs /* PX_MQ_NOTIFY */ + { + const struct sigevent * pNotification; + }; + +struct mqAttrGetArgs /* PX_MQ_ATTR_GET */ + { + struct mq_attr * pOldMqStat; + }; + + +/* system call function prototypes */ + +extern ssize_t pxMqReceive (OBJ_HANDLE handle, char * pMsg, size_t msgLen, + unsigned int * pMsgPrio, PX_WAIT_OPTION waitOption, + struct timespec * time_out); +extern int pxMqSend (OBJ_HANDLE handle, const char * pMsg, size_t msgLen, + unsigned int msgPrio, PX_WAIT_OPTION waitOption, + struct timespec * time_out); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmqPxSysCallh */ diff --git a/h/private/mqueueP.h b/h/private/mqueueP.h new file mode 100644 index 0000000..00fc3a7 --- /dev/null +++ b/h/private/mqueueP.h @@ -0,0 +1,42 @@ +/* mqueueP.h - private header for POSIX 1003.4 message passing */ + +/* Copyright 1984-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,06apr93,smb written +*/ + +#ifndef __INCmqueuePh +#define __INCmqueuePh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "mqueue.h" +#include "time.h" +#include "signal.h" +#include "msgQLib.h" +#include "sigLib.h" + +typedef struct mq_info /* message queue description */ + { + MSG_Q_ID msgQId; /* message queue identifier */ + int close; /* number of attachments */ + int taskId; /* task to notify */ + struct sigpend signalInfo; /* notification information */ + long attrMaxmsg; /* maximum number of messages */ + long attrMsgsize; /* maximum message size */ + long attrCurmsgs; /* number of messages queued */ + char * mq_name; /* message queue name */ + } MQ_INFO; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmqueuePh */ diff --git a/h/private/msgQLibP.h b/h/private/msgQLibP.h new file mode 100644 index 0000000..13691f6 --- /dev/null +++ b/h/private/msgQLibP.h @@ -0,0 +1,123 @@ +/* msgQLibP.h - private message queue library header file */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01m,04oct04,aeg added #ifndef _ASMLANGUAGE. +01l,31aug04,pcm integrated qJobLib.h +01k,28sep04,fr removed vMsgQCreate prototype (SPR 101349) +01j,22mar04,dcc added vMsgQCreate prototype. +01i,26aug03,tcr remove WindView InstClassId +01h,06sep01,bwa Added VxWorks events support. +01g,19may98,drm merged 3rd party code which added external declarations + of distributed msgQ routines. + - merged code was originally based on version 01d +01f,17apr98,rlp canceled MSG_Q modification for backward compatibility. +01e,04nov97,rlp modified MSG_Q structure for tracking messages sent. +01d,16jan94,c_s added extern declaration for msgQInstClassId. +01c,22sep92,rrr added support for c++ +01b,19jul92,pme added external declaration of shared msgQ show routine. +01a,04jul92,jcf created. +*/ + +#ifndef __INCmsgQLibPh +#define __INCmsgQLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE +#include "vxWorks.h" +#include "vwModNum.h" +#include "qLib.h" +#include "sllLib.h" +#include "msgQLib.h" +#include "classLib.h" + +#include "private/objLibP.h" +#include "private/eventLibP.h" + +typedef struct + { + SL_LIST list; + int count; + Q_HEAD pendQ; + } MSG_Q_HEAD; + +typedef struct msg_q /* MSG_Q */ + { + OBJ_CORE objCore; /* object management */ + MSG_Q_HEAD msgQ; /* message queue head */ + MSG_Q_HEAD freeQ; /* free message queue head */ + UINT32 options; /* message queue options */ + int maxMsgs; /* max number of messages in queue */ + int maxMsgLength; /* max length of message */ + int sendTimeouts; /* number of send timeouts */ + int recvTimeouts; /* number of receive timeouts */ + EVENTS_RSRC events; /* VxWorks events */ + } MSG_Q; + +typedef struct /* MSG_NODE */ + { + SL_NODE node; /* queue node */ + int msgLength; /* number of bytes of data */ + MSG_Q * pMsgQ; /* node's message queue */ + } MSG_NODE; + +typedef struct /* This structure is embedded */ + { /* into the WIND_TCB structure. */ + union /* Beware of TCB offset changes */ + { /* should its size change. */ + char * buffer; + MSG_NODE * node; + } msg; + UINT size; + } MSGQ_TCB; + +/* message priority hidden to public */ + +#define MSG_PRI_DONT_CARE MSG_PRI_URGENT /* head is faster */ + +#define MSG_Q_RESTRICT_UNPEND 0x80000000 +#define MSG_Q_OPTIONS_MASK (MSG_Q_TYPE_MASK | \ + MSG_Q_EVENTSEND_ERR_NOTIFY | \ + MSG_Q_INTERRUPTIBLE) + +/* macros */ + +#define MSG_NODE_DATA(pNode) (((char *) pNode) + sizeof (MSG_NODE)) + +/* variable definitions */ + +extern CLASS_ID msgQClassId; /* message queue class id */ + +/* shared memory objects function pointers */ + +extern FUNCPTR msgQSmSendRtn; +extern FUNCPTR msgQSmReceiveRtn; +extern FUNCPTR msgQSmNumMsgsRtn; +extern FUNCPTR msgQSmShowRtn; + +/* distributed objects function pointers */ + +extern FUNCPTR msgQDistSendRtn; +extern FUNCPTR msgQDistReceiveRtn; +extern FUNCPTR msgQDistNumMsgsRtn; +extern FUNCPTR msgQDistShowRtn; + +/* function declarations */ + +extern STATUS msgQTerminate (MSG_Q_ID msgQId); +extern STATUS msgQInit (MSG_Q *pMsgQ, int maxMsgs, int maxMsgLength, + int options, void *pMsgPool); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmsgQLibPh */ diff --git a/h/private/msgQSmLibP.h b/h/private/msgQSmLibP.h new file mode 100644 index 0000000..554e966 --- /dev/null +++ b/h/private/msgQSmLibP.h @@ -0,0 +1,111 @@ +/* msgQSmLibP.h - private shared message queue library header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,17apr98,rlp canceled SM_MSG_Q modification for backward compatibility. +01f,04nov97,rlp modified SM_MSG_Q structure for tracking messages sent. +01e,29jan93,pme added little endian support +01d,29sep92,pme added msgQSmNumMsgs(), msgQSmSend(), msgQSmReceived() + and msgQSmInfoGet() functions prototypes. +01c,22sep92,rrr added support for c++ +01b,17sep92,pme added shared message queue info get support. +01a,19jul92,pme written. +*/ + +#ifndef __INCmsgQSmLibPh +#define __INCmsgQSmLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "vwModNum.h" +#include "msgQSmLib.h" +#include "smDllLib.h" +#include "private/semSmLibP.h" + +/* defines */ + +#define MSG_Q_TYPE_SM 10 /* shared message queue */ + +#if (defined (CPU_FAMILY) && (CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* typedefs */ + +typedef struct sm_msg_q /* SM_MSG_Q */ + { + UINT32 verify; /* msgQ verification */ + UINT32 objType; /* msgQ type */ + + SM_SEMAPHORE msgQSem; /* msgQ shared counting semaphore */ + UINT32 msgQLock; /* spinlock for msgQ */ + SM_DL_LIST msgQ; /* message queue head */ + + SM_SEMAPHORE freeQSem; /* freeQ shared counting semaphore */ + UINT32 freeQLock; /* spinlock for freeQ */ + SM_DL_LIST freeQ; /* free message queue head */ + + UINT32 options; /* message queue options */ + UINT32 maxMsgs; /* max number of messages in queue */ + UINT32 maxMsgLength; /* max length of message */ + UINT32 sendTimeouts; /* number of send timeouts */ + UINT32 recvTimeouts; /* number of receive timeouts */ + } SM_MSG_Q; + +typedef struct sm_msg_node /* SM_MSG_NODE */ + { + SM_DL_NODE node; /* queue node */ + int msgLength; /* number of bytes of data */ + } SM_MSG_NODE; + +#if (defined (CPU_FAMILY) && (CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#define SM_MSG_NODE_DATA(pNode) (((char *) pNode) + sizeof (SM_MSG_NODE)) + + +/* variable declarations */ + +extern FUNCPTR msgQSmShowRtn; /* shared msgQ show routine ptr */ +extern FUNCPTR msgQSmInfoGetRtn; /* shared msgQ info get routine ptr */ + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void msgQSmLibInit (void); +extern STATUS msgQSmInit (SM_MSG_Q * pMsgQ, int maxMsgs, int maxMsgLength, + int options, void * pMsgPool); +extern STATUS msgQSmShow (SM_MSG_Q_ID msgQId, int level); +extern STATUS msgQSmInfoGet (SM_MSG_Q_ID smMsgQId, MSG_Q_INFO * pInfo); +extern int msgQSmNumMsgs (SM_MSG_Q_ID msgQId); +extern int msgQSmReceive (SM_MSG_Q_ID msgQId, char *buffer, + UINT maxNBytes, int timeout); +extern STATUS msgQSmSend (SM_MSG_Q_ID msgQId, char *buffer, UINT nBytes, + int timeout, int priority); + +#else /* __STDC__ */ + +extern void msgQSmLibInit (); +extern STATUS msgQSmInit (); +extern STATUS msgQSmShow (); +extern STATUS msgQSmInfoGet (); +extern int msgQSmNumMsgs (); +extern int msgQSmReceive (); +extern STATUS msgQSmSend (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmsgQSmLibPh */ diff --git a/h/private/msgQSysCall.h b/h/private/msgQSysCall.h new file mode 100644 index 0000000..a26eb65 --- /dev/null +++ b/h/private/msgQSysCall.h @@ -0,0 +1,30 @@ +/* msgQSysCall.h - Wind message queue system call definitions */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,22apr04,dcc added 'context' parameter to _msgQOpen(). +01a,27nov03,aeg written +*/ + +#ifndef __INCmsgQSysCallh +#define __INCmsgQSysCallh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + +/* system call function prototypes */ + +extern MSG_Q_ID _msgQOpen (const char * name, UINT maxMsgs, UINT maxMsgLength, + int options, int mode, void * context); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmsgQSysCallh */ diff --git a/h/private/mutexPxLibP.h b/h/private/mutexPxLibP.h new file mode 100644 index 0000000..1954198 --- /dev/null +++ b/h/private/mutexPxLibP.h @@ -0,0 +1,43 @@ +/* mutexPxLibP.h - kernel mutex and condition header file */ + +/* Copyright 1993-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,24sep01,gls removed definition and use of __P() macro (SPR #28330) +01a,18feb93,rrr written. +*/ + +#ifndef __INCmutexPxLibPh +#define __INCmutexPxLibPh + +#include "qLib.h" + +typedef struct + { + int m_owner; + Q_HEAD m_queue; + } mutex_t; + +typedef struct + { + mutex_t *c_mutex; + Q_HEAD c_queue; + } cond_t; + +struct timespec; + +extern void mutex_init (mutex_t *, void *); +extern void mutex_destroy (mutex_t *); + +extern void cond_init (cond_t *, void *); +extern void cond_destroy (cond_t *); + +extern void mutex_lock (mutex_t *); +extern void mutex_unlock (mutex_t *); + +extern void cond_signal (cond_t *); +extern int cond_timedwait (cond_t *, mutex_t *, const struct timespec *); + +#endif /* __INCmutexPxLibPh */ diff --git a/h/private/muxLibP.h b/h/private/muxLibP.h new file mode 100644 index 0000000..77e5468 --- /dev/null +++ b/h/private/muxLibP.h @@ -0,0 +1,136 @@ +/* muxLibP.h - private definitions for the MUX library */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01r,10oct01,rae merge from truestack (update copyright) +01q,25oct00,niq Merge RFC2233 changes from open_stack-p1-r1 branch + 01q,18oct00,ann insterting Siemens bug #25 for 0 mac addresses +01p,05oct99,pul removing rtRequest and mCastMap +01o,29apr99,pul Upgraded NPT phase3 code to tor2.0.0 +01n,24mar99,sj changed tkFlag field in muxBindEntry to flags; added defines +01m,24mar99,sj added defines for flags field of NET_PROTOCOL structure +01l,18mar99,sj cleaned up: completed the cleanup postponed in 01j,05mar99,sj +01k,08mar99,sj added place holder for stackrcv routine in BIB entry +01j,05mar99,sj eliminated hooks; not cleanly though. next version will do that +01i,24feb99,sj added netSvcType and netDrvType fields to the BIB entry +01h,26jan99,sj moved BIB entry definition from muxTkLib.c to here +01g,05nov98,sj PCOOKIE_TO_ENDOBJ must check if pCookie is NULL +01f,03nov98,pul modified IPPROTO_MCAST_MAP_GET +01e,03nov98,sj doc update +01d,20oct98,pul don't return ERROR if hook is not valid +01c,15oct98,pul added ipProto Hooks +01b,12oct98,sj changed MUX_TK_ADDR_RES_FUNC_UPDATE, added WRS_*_MODULE +01a,06oct98,sj written. + +*/ + +/* +DESCRIPTION +This file includes macros used by muxLib to avail features of the NPT +architecture if it is installed. + + +INCLUDE FILES: +*/ + +#ifndef __INCmuxLibPh +#define __INCmuxLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "muxLib.h" + +/* we steal these defines from a END driver */ + +#define END_HADDR(pEnd) \ + ((pEnd)->mib2Tbl.ifPhysAddress.phyAddress) + +#define END_HADDR_LEN(pEnd) \ + ((pEnd)->mib2Tbl.ifPhysAddress.addrLength) + +/* Alternate defines for the above till all drivers have been changed + * to follow rfc2233 implementation + */ +#define END_ALT_HADDR(pEnd) \ + ((pEnd)->pMib2Tbl->m2Data.mibIfTbl.ifPhysAddress.phyAddress) +#define END_ALT_HADDR_LEN(pEnd) \ + ((pEnd)->pMib2Tbl->m2Data.mibIfTbl.ifPhysAddress.addrLength) + + + +#define END_MIB2_TYPE(pEnd) \ + ((pEnd)->mib2Tbl.ifType) + +#define END_IOCTL(pEnd) \ + (pEnd->pFuncTable->ioctl) + +/* + * we define these flag bits for the flags field in the NET_PROTOCOL structure + * that is allocated for each protocol bound to an END + */ + +#define MUX_TK_DEV 0x1 /* protocol is bound to a toolkit device */ +#define MUX_BIND 0x2 /* END is bound to using muxBind() */ +#define MUX_TK_BIND 0x4 /* END is bound to using muxTkBind() */ + +/* + * we define these flag bits for the flags field in the muxBindEntry defined + * below + */ +#define BIB_DRV_ENTRY 0x1 /* driver loaded at this entry */ +#define BIB_TK_DRV 0x2 /* driver is a toolkit(NPT) driver */ +#define BIB_PROTO_ENTRY 0x4 /* a protocol has this BIB entry */ + +/* + * This defines the structure of the entry in the MUX information base(BIB). + * There is one such entry for every protocol/network device binding instance + */ + +typedef struct muxBindEntry + { + int unitNo; /* unit number of the device */ + char devName[END_NAME_MAX]; /* device name */ + long netSvcType; /* network service type */ + long netDrvType; /* network Driver type */ + UINT32 flags; /* BIB entry flags */ + END_OBJ* pEnd; /* reference to the END object */ + void* pNetCallbackId; /* network service callback Id given at bind */ + FUNCPTR addrResFunc; /* reference to Address resolution function */ + FUNCPTR netStackRcvRtn; /* reference to network service stackRcvRtn */ + }MUX_BIND_ENTRY, *MUX_ID; + +/* convert from a void * cookie(which is a MUX_ID) to a END_OBJ pointer */ + +#define PCOOKIE_TO_ENDOBJ(pCookie) ((pCookie) ? ((MUX_ID)pCookie)->pEnd : NULL) + +/* + * These macros are used by muxAddrRecFuncXXX functions + */ + #define TK_ADDR_RES_GET 1 + #define TK_ADDR_RES_ADD 2 + #define TK_ADDR_RES_DEL 3 + +/* prototypes */ + +/* + * these functions are used by the SENS MUX API implementations to avail + * NPT features + */ +extern STATUS muxTkBibInit (void); +extern void * muxTkDevLoadUpdate (END_OBJ * pEnd); +extern void * muxTkBindUpdate (END_OBJ * pEnd, NET_PROTOCOL * pProto); +extern void muxTkUnbindUpdate (void * pCookie); +extern STATUS muxTkUnloadUpdate (END_OBJ * pEnd); +extern void * muxTkAddrFuncUpdate (long netDrvType, long netProtoType, + FUNCPTR pAddrResFunc, int update); +#ifdef __cplusplus +} +#endif + +#endif /* __INCmuxLibPh */ diff --git a/h/private/nbioLogLibP.h b/h/private/nbioLogLibP.h new file mode 100644 index 0000000..1590720 --- /dev/null +++ b/h/private/nbioLogLibP.h @@ -0,0 +1,240 @@ +/* nbioLogLib.h - header for non-blocking logging facility */ + +/* + * Copyright (c) 2004-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01b,15mar05,dlk Enable NBIO_QUEUE_FDS support (SPR #102646). +01a,19jul04,dlk Written. +*/ + +#ifndef __INCnbioLogLibh +#define __INCnbioLogLibh + +#include +#include + +/****************************** WARNING ********************************\ + + THIS MODULE IS EXPERIMENTAL. Wind River makes no guarantee that the APIs + described by this header will be supported, unchanged or at all, in future + releases. Use at your own risk. + +\****************************** WARNING ********************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Turn off various features to keep the size smaller */ + +#undef NBIO_OWN_FDS /* (don't) maintain own array of fd's */ +#undef NBIO_BLOCKING_ALLOCATION /* (don't) support blocking buffer alloc. */ +#undef NBIO_GRACEFUL_TERMINATE /* (don't) wait for all buffers to be returned + when terminating. */ + +#define NBIO_QUEUE_FDS /* (do) pass file descriptor with message */ + +/* + * Even if NBIO_QUEUE_FDS is not supported, nbioSync() may be of use + * to wait for previously posted output to complete. + */ +#define NBIO_SYNC /* support nbioSync() */ + +/* + * The size of individual message blocks. More than one block + * may be stringed together to form a message. This must be + * a power of two. If it is changed, MSG_FD_NONE, MSG_FD_SYNC, MSG_FD, + * and MSG_LEN may also need to be adjusted. + */ + +#define MSG_BLOCK_SIZE 128 + +#define MSG_FD_NONE ((UINT32)0xffffff) +#define MSG_FD_SYNC ((UINT32)0xfffffe) + +#define MSG_FD(x) ((int)(((UINT32)(x)) >> 8)) +#define MSG_LEN(x) ((x) & 0xff) + + +/* Initial number of file descriptors in file descriptor table */ + +#define INIT_FDS 16 + +/* A LOG_MSG should be aligned on an MSG_SIZE boundary. */ + +union _MSG_BLOCK; + +typedef struct _BLK_BLOCK + { + union _MSG_BLOCK * pNext; + int numBlocks; + } BLK_BLOCK; + +typedef struct _MSG_BLOCK_HDR + { + union _MSG_BLOCK * pNext; /* next message in list */ + UINT32 fdAndLen; /* upper 24 bits: file desc; lower 8: len */ + } MSG_BLOCK_HDR; + +typedef union _MSG_BLOCK + { + MSG_BLOCK_HDR hdr; + BLK_BLOCK blk; + char data [MSG_BLOCK_SIZE]; + } MSG_BLOCK; + + +#define MSG_DATA_SIZE (MSG_BLOCK_SIZE - sizeof (MSG_BLOCK_HDR)) + +typedef struct _NBIO_INFO NBIO_INFO; /* semi-private */ + +typedef struct _MSG_INFO + { + int offset; /* Current position in last block */ + NBIO_INFO * pInfo; /* NBIO_INFO to use for allocation */ + MSG_BLOCK * pHead; /* First block of message */ + MSG_BLOCK * pTail; /* Last block of message */ + int timeout; /* timeout in ticks, or WAIT_FOREVER */ + UINT32 fd; /* Shifted FD value */ + } MSG_INFO; + +typedef STATUS (*NBIO_BEGIN_FUNC) (MSG_INFO * pMsgInfo, int fd, int timeout); +typedef STATUS (*NBIO_END_FUNC) (MSG_INFO * pMsgInfo); +typedef int (*NBIO_APPEND_FUNC) (MSG_INFO * pMsgInfo, + const char * fmt, ...); +typedef STATUS (*NBIO_DROP_FUNC) (MSG_INFO * pMsgInfo); +typedef STATUS (*NBIO_FLUSH_FUNC) (MSG_INFO * pMsgInfo); + +typedef int (*NBIO_FORMATV_FUNC) (MSG_INFO * pMsgInfo, const char * fmt, + va_list vaList); +typedef int (*NBIO_OUTPUT_FUNC) (char * pInBuf, int inLen, + MSG_INFO * pMsgInfo); + +typedef int (*NBIO_LOG_FUNC) (const char * fmt, ...); +typedef int (*NBIO_FDPRINT_FUNC) (int fd, int timeout, + const char * fmt, ...); +typedef STATUS (*NBIO_SYNC_FUNC) (void); +typedef STATUS (*NBIO_LOGFDSET_FUNC) (int fd); +typedef STATUS (*NBIO_LOGFDADD_FUNC) (int fd); +typedef STATUS (*NBIO_LOGFDDEL_FUNC) (int fd); + +typedef struct _NBIO_FUNCS + { + NBIO_BEGIN_FUNC begin; + NBIO_END_FUNC end; + NBIO_APPEND_FUNC append; + NBIO_DROP_FUNC drop; + NBIO_FLUSH_FUNC flush; + NBIO_FORMATV_FUNC formatV; + NBIO_OUTPUT_FUNC output; + NBIO_LOG_FUNC log; + +#if defined (NBIO_QUEUE_FDS) || defined (NBIO_BLOCKING_ALLOCATION_SUPPORT) + NBIO_FDPRINT_FUNC fdPrint; +#endif + +#ifdef NBIO_SYNC + NBIO_SYNC_FUNC sync; +#endif + +#ifdef NBIO_OWN_FDS + NBIO_LOGFDSET_FUNC fdSet; + NBIO_LOGFDADD_FUNC fdAdd; + NBIO_LOGFDDEL_FUNC fdDel; +#endif + } NBIO_FUNCS; + +extern NBIO_FUNCS _api_nbio; + +/* function prototypes */ + +extern STATUS nbioLogInit (int fd, int initMsgs); + +#if defined (NBIO_QUEUE_FDS) || defined (NBIO_BLOCKING_ALLOCATION_SUPPORT) +extern int nbioFdPrint (int fd, int timeout, const char * fmt, ...); +#endif + +extern int nbioLog (const char * fmt, ...); + +extern STATUS nbioBegin (MSG_INFO * pMsgInfo, int fd, int timeout); +extern STATUS nbioEnd (MSG_INFO * pMsgInfo); +extern int nbioAppend (MSG_INFO * pMsgInfo, const char * fmt, ...); +extern STATUS nbioDrop (MSG_INFO * pMsgInfo); +extern STATUS nbioFlush (MSG_INFO * pMsgInfo); + +extern int nbioFormatV (MSG_INFO * pMsgInfo, const char * fmt, + va_list vaList); + +extern int nbioOutput (char * pInBuf, int inLen, MSG_INFO * pMsgInfo); + +#ifdef NBIO_SYNC +extern STATUS nbioSync (void); +#endif + +#ifdef NBIO_OWN_FDS +extern STATUS nbioLogFdSet (int fd); +extern STATUS nbioLogFdDel (int fd); +extern STATUS nbioLogFdAdd (int fd); +#endif + +/* semi-private interfaces */ + +typedef struct _LOG_BUF_POOL + { + MSG_BLOCK * pHead; /* list of available buffers */ +#ifdef NBIO_BLOCKING_ALLOCATION_SUPPORT + ULONG want; /* number of tasks waiting for buffers */ + SEM_ID countSem; /* used to wait for buffers or timeout */ + ULONG reserved; /* number of reserved buffers */ + MSG_BLOCK * pReserved; /* buffers reserved for current waiters */ +#endif + ULONG allocFails; /* number of allocation failures (timeouts) */ + } LOG_BUF_POOL; + +struct _NBIO_INFO + { + MSG_BLOCK * pFirst; /* First queued message */ + MSG_BLOCK ** ppLast; /* Pointer to pointer to last queued message */ + SEM_ID sync; /* Synchronization semaphore */ + LOG_BUF_POOL pool; /* pool of free buffers */ +#ifdef NBIO_OWN_FDS + int * pFds; /* Pointer to array of file descriptors */ + int numFds; /* Current number of file descriptors */ + int maxFds; /* Size of file descriptor array */ + int theFd; /* Distinguished logging file descriptor */ +#endif + int taskId; /* Task ID of server task */ + MSG_BLOCK * pBlocks; /* List of allocated blocks of messages */ + }; + +extern NBIO_INFO logInfo; + +extern STATUS nbioLogInfoInit (NBIO_INFO * pInfo, int initMsgs); +extern STATUS nbioLogInfoMsgsAdd (NBIO_INFO * pInfo, int numBlocks); +extern STATUS nbioLogServerInit (NBIO_INFO * pInfo, int initialFds, + int priority, int options, + int stack, const char * name); +extern void nbioLogInfoTerminate (NBIO_INFO * pInfo); +#ifdef NBIO_SYNC +extern STATUS nbioLogInfoSync (NBIO_INFO * pInfo); +#endif + +#ifdef NBIO_OWN_FDS +extern STATUS nbioLogInfoFdSet (NBIO_INFO * pInfo, int fd); +extern STATUS nbioLogInfoFdDel (NBIO_INFO * pInfo, int fd); +extern STATUS nbioLogInfoFdAdd (NBIO_INFO * pInfo, int fd); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnbioLogLibh */ diff --git a/h/private/nfsHashP.h b/h/private/nfsHashP.h new file mode 100644 index 0000000..8aaf365 --- /dev/null +++ b/h/private/nfsHashP.h @@ -0,0 +1,38 @@ +/* nfsHashP.h - private nfs hash header file */ + +/* Copyright 1992-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,15nov98,rjc created. +*/ + +#ifndef __INCnfsHashPh +#define __INCnfsHashPh + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) || defined(__cplusplus) + +extern void nfsHashTblSet (char *, int, u_long ); +extern void nfsHashTblUnset (char *, int); +extern STATUS nfsFhLkup (NFS_FILE_HANDLE * , char *); +extern int nfsNmLkupIns (int, char *); + +#else /* __STDC__ */ + +extern void nfsHashTblSet (); +extern void nfsHashTblUnset (); +extern STATUS nfsFhLkup (); +extern int nfsNmLkupIns (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnfsHashPh */ diff --git a/h/private/objLibP.h b/h/private/objLibP.h new file mode 100644 index 0000000..58972db --- /dev/null +++ b/h/private/objLibP.h @@ -0,0 +1,539 @@ +/* objLibP.h - private object management library header */ + +/* + * Copyright (c) 1992-1993, 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +02c,16aug05,gls added objOwnerLibInstalled +02b,25jul05,yvp Reworked OBJ_VERIFY conditional definition. +02a,07jun05,yvp Updated copyright. #include now with angle-brackets. +01z,02jun05,yvp Reworked OBJ_VERIFY conditional for MKL. +01y,25mar05,job OBJ_VERIFY only defined in checked build +01x,05may05,gls added objShowInit() +01w,07apr05,gls added objOwnershipInit() (SPR #106150) +01v,24jan05,aeg added objRtpLibInit() function prototype (SPR #106381). +01u,01feb05,kk moved objOwnerGet(), objHandleShow(), objHandleTblShow() + to objLib.h +01t,07sep04,dcc added accessCnt to OBJ_CORE. +01s,14sep04,lei moved objOwnerSet() prototype to objLib.h +01r,28sep04,fr removed objCreateRtn from objOpen (SPR 101349) +01q,16aug04,dcc added _objClose() prototype. +01p,16jul04,aeg added objArchLibInit() function prototype, and changed + OBJ_VERIFY() to invoke arch specific objVerify() (SPR# 98168). +01o,05jul04,dcc added handle table growing support. +01n,05may04,cjj added objIdToObjHandle() definition. Removed I960 + preprocessor directives. +01m,29apr04,dcc added objRtpIdToObjHandle() definition. +01l,09mar04,dcc added WIND_OBJ_NAMED and WIND_OBJ_DELETE_ON_LAST_CLOSE + attributes. Moved objNameSet(), objOwnerGet(), and + objOwnerSet() prototypes from objLib.h +01k,04feb04,dcc added reference counter to OBJ_CORE. +01j,06jan04,dcc added OBJ_IS_REFERENCED macro +01i,26nov03,dcc updated definition of OBJ_HANDLE +01h,31oct03,dcc implemented modifications from code review. +01g,11sep03,dcc added objHandleList member to the OBJ_CORE structure, and + added handle table management support. +01f,21aug03,dcc removed WIND_OBJ_DISTRIBUTED and WIND_OBJ_SHARED flags. Added + objOpen() prototype. +01e,05apr03,to replace PD with RTP +01d,14mar03,dcc ported from AE1.1 +01c,15oct93,cd added #ifndef _ASMLANGUAGE. +01c,10dec93,smb removed objHelp +01b,22sep92,rrr added support for c++ +01a,04jul92,jcf extracted from v1j objLib.h. +*/ + +#ifndef __INCobjLibPh +#define __INCobjLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +/* + * number of slots that an individual handle table is made of. This is + * the size by which an RTP's handle table grows each time that the + * table is full, and a request for a new handle is made. This number must + * be a power of two. + * NOTE: Whenever this value is changed, the macro OBJ_TABLE_INDEX_GET() + * must be also updated with the number of bits that OBJ_HANDLE_ENTRY_MASK is + * wide. + */ + +#define OBJ_HANDLE_TBL_SIZE 256 + +/* number of individual handle tables that a master table references */ + +#define OBJ_MASTER_TBL_SIZE (0x10000 / OBJ_HANDLE_TBL_SIZE) /* 256 */ + +/* a handle index is made of the 16 LSB of an OBJECT_HANDLE */ + +#define OBJ_HANDLE_INDEX_MASK 0xffff + +/* mask to get the index of an entry in an individual handle table */ + +#define OBJ_HANDLE_ENTRY_MASK (OBJ_HANDLE_TBL_SIZE - 1) /* currently 0xff */ + +/* mask used to get the index of an individual handle table in a master table */ + +#define OBJ_HANDLE_TABLE_MASK (OBJ_HANDLE_INDEX_MASK - OBJ_HANDLE_ENTRY_MASK) + +/* get the full index from an object handle */ + +#define OBJ_INDEX_GET(objHdl) ((objHdl) & OBJ_HANDLE_INDEX_MASK) + +/* get the entry index from an object handle */ + +#define OBJ_ENTRY_INDEX_GET(objHdl) ((objHdl) & OBJ_HANDLE_ENTRY_MASK) + +/* get the table index from an object handle */ + +#define OBJ_TABLE_INDEX_GET(objHdl) (((objHdl) & OBJ_HANDLE_TABLE_MASK) >> 8) + + +/* convert a specific object type's struct ptr to an OBJ_CORE ptr */ + +#define OBJ_RESOLVE(pObj) ((OBJ_CORE *)(pObj)) + +/* convert an OBJ_CORE ptr to a specific object type's struct ptr */ + +#define OBJ_UNRESOLVE(pObj) ((OBJ_ID)(pObj)) + +/* size of OBJ_CORE in bytes for architecture dependent routines */ + +#define WIND_OBJ_CORE_SIZE 0x40 + +/* assembler offsets */ + +#define WIND_OBJ_CORE_HANDLE_ATTRIBUTES 0x8 +#define WIND_OBJ_CORE_CLASS_ID 0x30 + +/* object attributes */ + +#define WIND_OBJ_NAME_DYNAMIC 0x01 /* object name dynamically allocated */ +#define WIND_OBJ_DEALLOC_MEM 0x02 /* free object memory on destroy */ +#define WIND_OBJ_INSTRUMENTED 0x04 /* WindView instrumented object */ +#define WIND_OBJ_DELETE_ON_LAST_CLOSE 0x08 /* object will be deleted on the + * last close even if it is not + * previously unlinked */ +#define WIND_OBJ_ORPHANED 0x10 /* unable to reclaim object */ +#define WIND_OBJ_NO_RECLAIM 0x20 /* automatic reclamation disabled */ +#define WIND_OBJ_PUBLIC 0x40 /* object is public */ +#define WIND_OBJ_NAMED 0x80 /* object is named */ +#define WIND_OBJ_DELETED 0x100 /* object is deleted */ + +#ifndef _ASMLANGUAGE +#include +#include +#include +#include +#include + + +/* variable declarations */ + +extern BOOL objOwnerLibInstalled; + +extern FUNCPTR _func_ownerListLock; +extern FUNCPTR _func_ownerListUnlock; +extern VOIDFUNCPTR _func_handleFreeAll; +extern FUNCPTR _func_handleAlloc; +extern FUNCPTR _func_objCoreRelease; + +typedef struct wind_obj /* OBJ_CORE */ + { + HANDLE handle; /* 0x00: handle */ + DL_LIST ownerList; /* 0x0c: list of owned objects */ + DL_NODE ownerNode; /* 0x14: owner list node */ + DL_NODE classNode; /* 0x1c: class list node */ + struct wind_obj * ownerId; /* 0x24: pointer to object's owner */ + RTP_ID ownerRtpId; /* 0x28: object owner's RTP */ + char * name; /* 0x2c: object name */ + struct wind_class * pObjClass; /* 0x30: pointer to object's class */ + DL_LIST objHandleList; /* 0x34: list of handles */ + UINT16 refCnt; /* 0x3c: reference counter */ + UINT16 accessCnt; /* 0x3e: access counter */ + } OBJ_CORE; + +typedef struct handle_table_entry + { + DL_NODE handleNode; + OBJ_ID entryObjId; + OBJ_HANDLE objHandle; + } HANDLE_TABLE_ENTRY; + +/* + * the order of the members in HANDLE_TABLE is important. Some routines such + * as objHandleFreeAll() rely on the fact that handleTable is the first + * member. + */ + +typedef struct handle_table + { + HANDLE_TABLE_ENTRY handleTable [OBJ_HANDLE_TBL_SIZE]; + struct master_handle_table * pMasterTbl; + } HANDLE_TABLE; + +typedef struct master_handle_table + { + struct handle_table * pHandleTable [OBJ_MASTER_TBL_SIZE]; + int firstFree; /* index of most recent free slot */ + int size; /* size of all handle tables combined */ + UINT32 initIndex; + UINT32 genNumber; + SEM_ID hdlTblSemId; + } MASTER_HANDLE_TABLE; + + +/******************************************************************************* +* +* OBJ_SET_DEALLOC_MEM - object memory to be freed when destroyed +* +* This macro sets the appropriate object attribute bit such that the +* object memory is deallocated when the object destroy routine is called +* through the automatic resource reclamation mechanism. +* +* This macro is only useful for object classes that register a destroy +* routine that requires a 'dealloc' parameter. +* +* RETURNS: N/A +* +* NOMANUAL +*/ + +#define OBJ_SET_DEALLOC_MEM(objId) \ + ( \ + ((OBJ_CORE *)(objId))->handle.attributes |= WIND_OBJ_DEALLOC_MEM \ + ) + +/******************************************************************************* +* +* OBJ_RECLAIM_DISABLE - disable automatic resource reclamation +* +* This macro sets the appropriate object attribute bit such that the +* object will not be destroyed by the automatic resource reclamation +* mechanism. +* +* RETURNS: N/A +* +* NOMANUAL +*/ + +#define OBJ_RECLAIM_DISABLE(objId) \ + ( \ + ((OBJ_CORE *)(objId))->handle.attributes |= WIND_OBJ_NO_RECLAIM \ + ) + +/******************************************************************************* +* +* OBJ_IS_RECLAIM_DISABLE - is object disabled from automatic RR? +* +* This macro checks whether the specified object is disabled from automatic +* resource reclamation. +* +* RETURNS: TRUE if object is disabled from RR, otherwise FALSE. +* +* NOMANUAL +*/ + +#define OBJ_IS_RECLAIM_DISABLE(objId) \ + ( \ + (((OBJ_CORE *)(objId))->handle.attributes & WIND_OBJ_NO_RECLAIM) != 0 \ + ) + + +/******************************************************************************* +* +* OBJ_INSTRUMENTATION_ENABLE - enable WindView instrumentation +* +* This macro sets the appropriate object attribute bit such that the +* WindView instrumentation is enabled for the specified object. +* +* RETURNS: N/A +* +* NOMANUAL +*/ + +#define OBJ_INSTRUMENTATION_ENABLE(objId) \ + ( \ + ((OBJ_CORE *)(objId))->handle.attributes |= WIND_OBJ_INSTRUMENTED \ + ) + +/******************************************************************************* +* +* OBJ_INSTRUMENTATION_DISABLE - disable WindView instrumentation +* +* This macro clears the appropriate object attribute bit such that the +* WindView instrumentation is disabled for the specified object. +* +* RETURNS: N/A +* +* NOMANUAL +*/ + +#define OBJ_INSTRUMENTATION_DISABLE(objId) \ + ( \ + ((OBJ_CORE *)(objId))->handle.attributes &= ~WIND_OBJ_INSTRUMENTED \ + ) + +/******************************************************************************* +* +* OBJ_VERIFY - check the validity of an object pointer +* +* This macro verifies the existence of the specified object by comparing the +* object's classId with the expected class id. If the object does not check +* out, errno is set with the invalid id status. +* +* RETURNS: OK or ERROR if invalid object id +* +* NOMANUAL +*/ + +#ifdef INCLUDE_OBJ_LIB +#define OBJ_VERIFY(objId,classId) \ + ( \ + objVerify (objId, classId) \ + ) +#else +#define OBJ_VERIFY(objId, classId) \ + ( \ + OK \ + ) +#endif /* INCLUDE_OBJ_LIB */ + +/******************************************************************************* +* +* OBJ_IS_OWNER - does the object own any other objects? +* +* This macro checks whether the specified object is the owner of +* any other object. +* +* RETURNS: TRUE if object owns at least one other object, otherwise FALSE. +* +* NOMANUAL +*/ + +#define OBJ_IS_OWNER(objId) \ + ( \ + DLL_FIRST (&((OBJ_CORE *)(objId))->ownerList) != NULL \ + ) + +/******************************************************************************* +* +* OBJ_IS_REFERENCED - is this object referenced by an object handle? +* +* This macro checks whether there is any object handle referencing this object. +* +* RETURNS: TRUE if object has at least one object handle, otherwise FALSE. +* +* NOMANUAL +*/ + +#define OBJ_IS_REFERENCED(objId) \ + ( \ + DLL_FIRST (&((OBJ_CORE *)(objId))->objHandleList) != NULL \ + ) + +/******************************************************************************* +* +* OBJ_IS_PUBLIC - is the object public ? +* +* This macro checks if the object is public or not +* +* RETURNS: TRUE if object is public, otherwise FALSE. +* +* NOMANUAL +*/ + +#define OBJ_IS_PUBLIC(objId) \ + ( \ + (((OBJ_CORE *)(objId))->handle.attributes & WIND_OBJ_PUBLIC) != 0 \ + ) + +/******************************************************************************* +* +* OBJ_SET_PUBLIC - set an object as public +* +* This macro sets the bit WIND_OBJ_PUBLIC in OBJ_CORE.handle.attributes +* +* NOMANUAL +*/ + +#define OBJ_SET_PUBLIC(objId) \ + ( \ + ((OBJ_CORE *)(objId))->handle.attributes |= WIND_OBJ_PUBLIC \ + ) + +/******************************************************************************* +* +* OBJ_IS_NAMED - is the object named ? +* +* This macro checks if the object is named or not. This macro is used to +* determine if an object must follow the POSIX model for deletion +* (i.e. unlink + close). +* +* RETURNS: TRUE if object is public, otherwise FALSE. +* +* NOMANUAL +*/ + +#define OBJ_IS_NAMED(objId) \ + ( \ + (((OBJ_CORE *)(objId))->handle.attributes & WIND_OBJ_NAMED) != 0 \ + ) + +/******************************************************************************* +* +* OBJ_SET_NAMED - set an object as named +* +* This macro sets the bit WIND_OBJ_NAMED in OBJ_CORE.handle.attributes. The +* setting of this bit indicates that an object must follow the POSIX model +* for deletion, i.e. must be unlinked and closed. +* +* NOMANUAL +*/ + +#define OBJ_SET_NAMED(objId) \ + ( \ + ((OBJ_CORE *)(objId))->handle.attributes |= WIND_OBJ_NAMED \ + ) + + +/******************************************************************************* +* +* OBJ_IS_DELETE_ON_LAST_CLOSE - is the object to be deleted on the last close? +* +* This macro checks if the object is set to be deleted on the last close, i.e. +* no need to be unlinked first. +* +* RETURNS: TRUE if object is public, otherwise FALSE. +* +* NOMANUAL +*/ + +#define OBJ_IS_DELETE_ON_LAST_CLOSE(objId) \ + ( \ + (((OBJ_CORE *)(objId))->handle.attributes & \ + WIND_OBJ_DELETE_ON_LAST_CLOSE) != 0 \ + ) + +/******************************************************************************* +* +* OBJ_SET_DELETE_ON_LAST_CLOSE - set an object to be deleted on the last close +* +* This macro sets the bit WIND_OBJ_DELETE_ON_LAST_CLOSE in +* OBJ_CORE.handle.attributes. The setting of this bit indicates that a named +* object does not need to be unlinked before being deleted. +* +* NOMANUAL +*/ + +#define OBJ_SET_DELETE_ON_LAST_CLOSE(objId) \ + ( \ + ((OBJ_CORE *)(objId))->handle.attributes |= \ + WIND_OBJ_DELETE_ON_LAST_CLOSE \ + ) + +/******************************************************************************* +* +* OBJ_IS_DELETED - is the object deleted? +* +* This macro checks if the object has been already deleted or not. This macro +* is used to determine if an object's memory should be freed when it access +* counter is zero. +* +* RETURNS: TRUE if object is being deleted, otherwise FALSE. +* +* NOMANUAL +*/ + +#define OBJ_IS_DELETED(objId) \ + ( \ + (((OBJ_CORE *)(objId))->handle.attributes & WIND_OBJ_DELETED) != 0 \ + ) + +/******************************************************************************* +* +* OBJ_SET_DELETED - set an object as deleted +* +* This macro sets the bit WIND_OBJ_DELETED in OBJ_CORE.handle.attributes +* The setting of this bit indicates that a the object has been deleted and its +* memory is ready to be freed when its access counter is zero. +* +* NOMANUAL +*/ + +#define OBJ_SET_DELETED(objId) \ + ( \ + ((OBJ_CORE *)(objId))->handle.attributes |= WIND_OBJ_DELETED \ + ) + +/* function declarations */ + +extern void * objAlloc (CLASS_ID classId); +extern void * objAllocExtra (CLASS_ID classId, unsigned nExtraBytes, + void ** ppExtra); +extern CLASS_ID objClassIdGet (enum windObjClassType classType); +extern void objCoreInit (OBJ_CORE * pObjCore, CLASS_ID pObjClass); +extern STATUS objCoreTerminate(OBJ_CORE * pObjCore); +extern void objCoreUnlink (OBJ_CORE * pObjCore, CLASS_ID classId); +extern OBJ_ID objEach (enum windObjClassType classType, + FUNCPTR routine, int arg, BOOL objPublic); +extern STATUS objFree (CLASS_ID classId, OBJ_ID objectId); +extern int objInfo (enum windObjClassType classType, + OBJ_ID objIdArray[], + int maxIds); +extern char * objNamePtrGet (OBJ_ID objId); +extern STATUS objNamePtrSet (OBJ_ID objId, char * name); +extern STATUS objNameSet (OBJ_ID objId, const char *name); +extern STATUS objVerify (OBJ_ID objId, CLASS_ID classId); +extern STATUS objGenericVerify(OBJ_ID objId); +extern STATUS objRtpTaskDelete(RTP_ID rtpId); +extern STATUS objOwnerSetBase (OBJ_CORE * pObj, OBJ_CORE * pOwnerObj); +extern STATUS objLibInit (FUNCPTR objMemAllocRtn, FUNCPTR objMemFreeRtn, + void * objMemPoolId, int options); +extern void objOwnershipInit (void); +extern BOOL objOwnerListInstalled (void); +extern STATUS objArchLibInit (void); +extern void objShowInit (void); + +extern STATUS objCoreReclaim (OBJ_CORE * pObjCore); +extern void objCoreInvalidate (OBJ_CORE * pObjCore); +extern OBJ_HANDLE objHandleAlloc (OBJ_ID objId, RTP_ID rtpId); +extern OBJ_ID objHandleToObjId (OBJ_HANDLE handle, RTP_ID rtpId, + BOOL access); +extern STATUS objHandleDelete (OBJ_HANDLE handle, int options); + +extern OBJ_ID objOpen (const char * name, int flags, CLASS_ID classId, + ...); +extern STATUS objHandleClose (OBJ_HANDLE handle, RTP_ID rtpId); +extern STATUS objClose (OBJ_ID objId, CLASS_ID classId); +extern STATUS objUnlink (const char * name, CLASS_ID classId); + +extern void objHandleTblTerminate (RTP_ID rtpId); +extern STATUS objHandleTblCreate (RTP_ID rtpId); +extern OBJ_HANDLE objIdToObjHandle (OBJ_ID objId, RTP_ID rtpId); +extern OBJ_HANDLE objRtpIdToObjHandle (RTP_ID rtpId); +extern STATUS _objClose (OBJ_CORE * pObjCore, int level, + BOOL dealloc); +extern void * objMemAlloc (unsigned nBytes); +extern STATUS objMemFree (char * pBuffer); +extern STATUS objCoreRelease (OBJ_ID objId); +extern STATUS objRtpLibInit (void); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCobjLibPh */ diff --git a/h/private/objSysCall.h b/h/private/objSysCall.h new file mode 100644 index 0000000..a44e553 --- /dev/null +++ b/h/private/objSysCall.h @@ -0,0 +1,52 @@ +/* objSysCall.h - VxWorks object system call definitions */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,26nov03,dcc added VX_OBJ_DELETE_CLOSE. +01e,25nov03,aeg added VX_OBJ_INFO_GET_SEM_DESC. +01d,30oct03,aeg added VX_OBJ_INFO_GET_MSGQ_DESC +01c,30oct03,dcc moved objInfoGet and objDelete prototypes to objLib.h, user + version. +01b,01oct03,aeg changed value of VX_OBJ_DELETE_TASK_FORCE. +01a,03sep03,aeg written +*/ + +#ifndef __INCobjSysCallh +#define __INCobjSysCallh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + +/* 'level' definitions for the objInfoGet() system call on tasks */ + +#define VX_OBJ_INFO_GET_TASK_NAME 0 +#define VX_OBJ_INFO_GET_TASK_DESC 1 +#define VX_OBJ_INFO_GET_TASK_SUSPENDED 2 +#define VX_OBJ_INFO_GET_TASK_READY 3 +#define VX_OBJ_INFO_GET_TASK_PENDED 4 + +/* 'level' definitions for the objInfoGet() system call on message queues */ + +#define VX_OBJ_INFO_GET_MSGQ_DESC 10 + +/* 'level' definitions for the objInfoGet() system call on semaphores */ + +#define VX_OBJ_INFO_GET_SEM_DESC 20 + + +/* options for the objDelete() system call */ + +#define VX_OBJ_DELETE_TASK_FORCE 1 +#define VX_OBJ_DELETE_CLOSE 2 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCobjSysCallh */ diff --git a/h/private/offsetsP.h b/h/private/offsetsP.h new file mode 100644 index 0000000..b6690ad --- /dev/null +++ b/h/private/offsetsP.h @@ -0,0 +1,50 @@ +/* offsetsP.h - absolute symbols support */ + +/* Copyright 2004, Wind River Systems, Inc. Alameda, CA */ + +/* +modification history +-------------------- +01c,15oct04,kk added a structure offset +01b,17mar04,dat remove leading underscore from _absSymbols_xxx (95052) +01a,05mar04,dat written +*/ + +#ifndef __INCoffsetsPh +#define __INCoffsetsPh + +/* + * standard prefix that the host tools will grep for. + * Hardcoded into host/src/loader/makeSymTbl.tcl. + * (Two occurrences below) + */ + +#define _WRS_ABS_PREFIX _vx_offset_ + +/* Define an absolute symbol, adding the prefix to the name */ + +#define _WRS_ABS_VALUE(name,value) _WRS_ABSOLUTE(_vx_offset_##name, value) + +/* Define a structure offset as an absolute symbol */ + +#define _WRS_GEN_OFFSET(S,M) _WRS_ABS_VALUE(S##_##M, offsetof(S,M)) + +/* Define a structure size as an absolute symbol */ + +#define _WRS_GEN_SIZEOF(T) _WRS_ABS_VALUE(sizeof_##T, sizeof(T)) + +/* + * For linkSyms.c in projects, and usrExtra.c for old BSP builds, + * we need a fake declaration as a FUNCPTR. Note in 00vxWorks.cdf + * we use 'absSymbols_' directly because linkSyms.c does not include + * this header. This special symbol is always generated. + */ + +#define _WRS_ABS_SYMBOL(x) absSymbols_##x + +/* Define a structure offset as an absolute symbol, renaming the member */ + +#define _WRS_GEN_OFFSET_RENAMED(S,M,R) _WRS_ABS_VALUE(S##_##R, offsetof(S,M)) + + +#endif /* __INCoffsetsP.h */ diff --git a/h/private/pciIntLibP.h b/h/private/pciIntLibP.h new file mode 100644 index 0000000..9e35e8b --- /dev/null +++ b/h/private/pciIntLibP.h @@ -0,0 +1,33 @@ +/* pciIntLibP.h - PCI Interrupt support private constants header file */ + +/* Copyright 1984-1998 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,04mar98, tm derived from pciIntLib.h v01a +*/ + +#ifndef __INCpciIntLibPh +#define __INCpciIntLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +typedef struct pciIntRtn + { + DL_NODE node; /* double link list */ + VOIDFUNCPTR routine; /* interrupt handler */ + int parameter; /* parameter of the handler */ + } PCI_INT_RTN; + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpciIntLibPh */ diff --git a/h/private/pfw/pfwEventP.h b/h/private/pfw/pfwEventP.h new file mode 100644 index 0000000..0ca22db --- /dev/null +++ b/h/private/pfw/pfwEventP.h @@ -0,0 +1,79 @@ +/* pfwEventP.h - private protocol framework event manager header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,17oct99,koz Added event manager create and delete routines +01c,19sep99,koz Changed the pfwEventItemAdd interface +01b,08sep99,koz Modified event structures to associate events with stack + objects +01a,17aug99,koz witten. +*/ + +#ifndef __INCpfwEventPh +#define __INCpfwEventPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "pfw/pfw.h" +#include "pfw/pfwEvent.h" + +/* typedefs */ + +typedef struct pfwEventHandlerItem PFW_EVENT_HANDLER_ITEM; + +struct pfwEventHandlerItem + { + PFW_EVENT_HANDLER_ITEM *next; /* pointer to the next event handler */ + /* item in the list */ + PFW_PLUGIN_OBJ_STATE *state; /* pointer to a pfw plugin object */ + /* registered for this event */ + PFW_EVENT_HANDLER eventHandler; /* function pointer to an event handler */ + }; + +typedef struct pfwEventSubscriberItem PFW_EVENT_SUBSCRIBER_ITEM; + +struct pfwEventSubscriberItem + { + PFW_EVENT_SUBSCRIBER_ITEM *next; /* pointer to the next event handler */ + /* item in the list */ + PFW_EVENT_OBJ *eventObj; /* pointer to the event object */ + PFW_EVENT_HANDLER eventHandler; /* function pointer to an event handler */ + }; + +typedef struct pfwEventItem PFW_EVENT_ITEM; + +struct pfwEventItem + { + PFW_EVENT_ITEM *next; /* pointer to the next event handler */ + /* item in the list */ + PFW_EVENT_OBJ *eventObj; /* pointer to the event object */ + PFW_EVENT_HANDLER_ITEM /* head of the event handler item list */ + *eventHandlerItemHead; + }; + +struct pfwEventObj + { + char name[PFW_MAX_NAME_LENGTH]; /* pfw event name */ + unsigned int id; /* pfw event id */ + PFW_OBJ* pfwObj; /* pointer to the framework object */ + }; + +extern STATUS pfwEventManagerCreate (PFW_OBJ *pfwObj); +extern STATUS pfwEventManagerDelete (PFW_OBJ *pfwObj); +extern STATUS pfwEventPluginObjUnsubscribe (PFW_PLUGIN_OBJ *pluginObj); +extern STATUS pfwEventItemAdd (PFW_PLUGIN_OBJ_STATE *state); +extern STATUS pfwEventItemDelete (PFW_PLUGIN_OBJ_STATE *state); +extern STATUS pfwEventItemListDelete (PFW_STACK_OBJ *state); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpfwEventPh */ + + diff --git a/h/private/pfw/pfwInterfaceP.h b/h/private/pfw/pfwInterfaceP.h new file mode 100644 index 0000000..f0e92a9 --- /dev/null +++ b/h/private/pfw/pfwInterfaceP.h @@ -0,0 +1,46 @@ +/* pfwInterfaceP.h - private protocol framework interface manager header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +*/ + +#ifndef __INCpfwInterfacePh +#define __INCpfwInterfacePh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "pfw/pfw.h" +#include "private/pfw/pfwP.h" +#include "private/pfw/pfwUtilP.h" +#include "pfw/pfwInterface.h" + +/* typedefs */ + +typedef struct pfwPluginObjInterfaceItem + { + SL_NODE node; + PFW_INTERFACE_OBJ *interfaceObj; + } PFW_PLUGIN_OBJ_INTERFACE_ITEM; + +typedef struct pfwInterfaceHead + { + DL_LIST interfaceObjList; + char name[PFW_MAX_INTERFACE_NAME_LENGTH]; /* interface name */ + } PFW_INTERFACE_HEAD; + +extern STATUS pfwInterfaceManagerCreate (PFW_OBJ *pfwObj); +extern STATUS pfwInterfaceManagerDelete (PFW_OBJ *pfwObj); +extern STATUS pfwInterfaceUnbind (PFW_PLUGIN_OBJ *pluginObj); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpfwInterfacePh */ + + diff --git a/h/private/pfw/pfwMemoryP.h b/h/private/pfw/pfwMemoryP.h new file mode 100644 index 0000000..5e8a1c3 --- /dev/null +++ b/h/private/pfw/pfwMemoryP.h @@ -0,0 +1,91 @@ +/* memoryP.h - private memory header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,03oct99,koz Changed for memory partition based memory allocations +01a,xxxxxxx,koz written +*/ + +#ifndef __INCpfwMemoryPh +#define __INCpfwMemoryPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "semLib.h" + +#define FIRST_INTERVAL_UNIT_SIZE_GRANULARITY 4 +#define LOG2_FIRST_INTERVAL_UNIT_SIZE_GRANULARITY 2 +#define FIRST_INTERVAL_UNIT_POOL_NUM 32 +#define NON_FIRST_INTERVAL_UNIT_POOL_NUM 16 +#define LOG2_FIRST_INTERVAL_MAX_UNIT_SIZE 7 +#define LOG2_FIRST_CHUNK_SIZE 10 + +typedef struct pfwMemoryUnit + { + void *chunkOrNext; + } PFW_MEMORY_UNIT; + +typedef struct pfwLargeMemoryUnit + { + PFW_MEMORY_UNIT memoryUnit; + PART_ID partId; + } PFW_LARGE_MEMORY_UNIT; + +typedef struct pfwMemoryUnitPool PFW_MEMORY_UNIT_POOL; +typedef struct pfwMemoryChunkPool PFW_MEMORY_CHUNK_POOL; +typedef struct pfwMemoryManager PFW_MEMORY_MANAGER; +typedef struct pfwMemoryChunk PFW_MEMORY_CHUNK; + +struct pfwMemoryChunk + { + DL_NODE node; /* node in a double link list chunks */ + PFW_MEMORY_UNIT_POOL *unitPool; /* pointer to the unit pool using it */ + unsigned int id; /* id of the chunk */ + unsigned int freeUnitNum; + PFW_MEMORY_UNIT *freeUnitHead; /* head of free memory units in the chunk */ + char *memory; /* pointer to the memory area of the chunk*/ + }; + + +struct pfwMemoryUnitPool + { + unsigned int unitSize; + unsigned int unitNumPerChunk; + DL_LIST chunkList; + unsigned int chunkPoolIndex; + PFW_MEMORY_MANAGER *manager; + }; + +struct pfwMemoryChunkPool + { + unsigned int chunkSize; + DL_LIST chunkList; + }; + +struct pfwMemoryManager + { + PART_ID partId; /* memory partion id */ + unsigned int maxUnitSize; /* max memory unit size */ + unsigned int unitPoolNum; /* number of unit pools */ + PFW_MEMORY_UNIT_POOL *unitPool; /* array unit pools */ + unsigned int chunkPoolNum; /* number of chunk pools */ + PFW_MEMORY_CHUNK_POOL *chunkPool; /* array of chunk pools */ + SEM_ID mutex; /* mutex for exclusive access */ + }; + +extern STATUS pfwMemoryManagerCreate (PFW_OBJ *pfwObj, unsigned int maxUnitSize, + PART_ID partId); +extern STATUS pfwMemoryManagerDelete (PFW_OBJ *pfwObj); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpfwMemoryPh */ + + diff --git a/h/private/pfw/pfwP.h b/h/private/pfw/pfwP.h new file mode 100644 index 0000000..1a8399d --- /dev/null +++ b/h/private/pfw/pfwP.h @@ -0,0 +1,74 @@ +/* pfwP.h - Protocol framework private header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,17oct99,koz Added interface table to pfwObj +01c,20sep99,koz Changed for allowing to add control jobs in interrupt context +01b,30aug99,koz Added memory manager. +01a,02aug99,koz written +*/ + +#ifndef __INCpfwPh +#define __INCpfwPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "pfw/pfw.h" +#include "private/pfw/pfwTimerP.h" +#include "rngLib.h" +#include "pfw/pfwTable.h" +#include "private/pfw/pfwUtilP.h" +#include "private/pfw/pfwMemoryP.h" +#include "private/pfw/pfwEventP.h" + +struct pfwObj + { + char name[PFW_MAX_NAME_LENGTH]; /* framework name */ + unsigned int id; /* framework id */ + int controlTaskId; /* framework control task id */ + int controlTaskPriority; /* framework control task priority */ + SEM_ID controlSem; /* semaphore to signal the control task*/ + unsigned int controlJobQueueSize; /* size of controlJobRing */ + RING_ID controlJobRing; /* ring of submitted control path jobs */ + int dataTaskId; /* framework control task id */ + int dataTaskPriority; /* framework data task priority */ + SEM_ID dataSem; /* semaphore to signal the data task */ + unsigned int dataJobQueueSize; /* size of dataJobRing */ + RING_ID dataJobRing; /* ring of submitted data path jobs */ + NET_POOL_ID netPoolId; /* net pool id used by framework objs */ + PFW_TIMER_MANAGER *timerManager; /* pointer to framework timer manager */ + PFW_MEMORY_MANAGER *memoryManager; /* pointer to framework memory manager*/ + PFW_TABLE_OBJ *interfaceTable; /* table of interfaces */ + PFW_TABLE_OBJ *eventTable; /* table of events */ + PFW_TABLE_OBJ /* one table for each layered plane */ + *planeTable[PFW_LAYERED_PLANE_NUMBER]; + PFW_TABLE_OBJ *layerTable; /* table of layers */ + PFW_TABLE_OBJ *componentTable; /* table of components */ + PFW_TABLE_OBJ *stackTable; /* table of stacks */ + PFW_TABLE_OBJ *profileTable; /* table of profiles */ + PFW_TABLE_OBJ *parameterTable; /* table of parameters */ + }; + +struct pfwPrivateData + { + unsigned int id; /* id */ + PFW_PLUGIN_OBJ_TYPE objType; /* type, component or layer */ + PFW_EVENT_SUBSCRIBER_ITEM /* head of the event subscriber item list */ + *eventSubscriberItemHead; + SEM_ID eventMutex; /* mutex for accessing the event list */ + SL_LIST interfaceItemList; /* list of interface items */ + unsigned int referenceCount; /* reference count */ + }; + +STATUS pfwPluginObjShow (PFW_PLUGIN_OBJ *pluginObj); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpfwPh */ diff --git a/h/private/pfw/pfwProfileP.h b/h/private/pfw/pfwProfileP.h new file mode 100644 index 0000000..32da32d --- /dev/null +++ b/h/private/pfw/pfwProfileP.h @@ -0,0 +1,142 @@ +/* pfwProfile.h - private Protocol FrameWork profile header */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,23feb00,sj remove extra comma after last enum in PFW_PARAMETER_TYPE +01e,22nov99,koz Added pfwProfileTableCreate and pfwParameterTableCreate + rotines +01d,12oct99,koz Added static and dynamic plugin object profile parameters +01c,15sep99,sj changing field name "key" to "id" in profile object +01b,18Aug99,sj modified for generic framework +01a,xxXXXxx,koz created +*/ + +#ifndef __INCpfwProfilePh +#define __INCpfwProfilePh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "pfw/pfwComponent.h" +#include "pfw/pfwLayer.h" +#include "pfw/pfwProfile.h" +#include "private/pfw/pfwP.h" +#include "semLib.h" + +/* typedefs */ + +typedef enum pfwParameterType + { + _REGULAR_PARAMETER, /* a parameter created by a plugin object */ + _REMOVE_FROM_PROFILE, /* a parameter created by the framework to remove */ + /* from a connection profile */ + _STATIC_PROFILE_ITEM, /* a parameter created by the framework to add a */ + /* plugin object to stack statically */ + _DYNAMIC_PROFILE_ITEM /* a parameter created by the framework to add a */ + /* plugin object to stack dynamically */ + } PFW_PARAMETER_TYPE; + +typedef enum pfwProfileDataStatus + { + PFW_DATA_INHERITED, + PFW_DATA_OWNED + } PFW_PROFILE_DATA_STATUS; + +typedef enum pfwProfileItemStatus + { + PFW_STATIC_PROFILE_ITEM, + PFW_DYNAMIC_PROFILE_ITEM + } PFW_PROFILE_ITEM_STATUS; + +/* + * Plugin objects (components and layers) can be configured differently from + * one stack instance to another. Components and layers are configured using + * configuration parameters. Each configuration parameter is represented by a + * parameter object in the framework. The following data structure is defined + * for a parameter object. + */ + +typedef struct pfwParameterObj + { + char name[PFW_MAX_NAME_LENGTH]; /* parameter name */ + PFW_PARAMETER_TYPE type; /* partameter type */ + PFW_PLUGIN_OBJ *owner; /* pointer to the owner of the parameter */ + PFW_PARAMETER_HANDLER handlerFunc; /* function to process the parameter */ + } PFW_PARAMETER_OBJ; + + +/* + * Each stack instance is configured from a stack profile. A stack + * profile is implemented by a stack profile object. A stack profile + * object is a list of lists. The elements of the outer list are for layer + * object configuration information and the elements of the inner list are + * for component object information. + */ + + +typedef struct pfwComponentProfileItem PFW_COMPONENT_PROFILE_ITEM; +struct pfwComponentProfileItem + { + PFW_COMPONENT_OBJ *obj; /* pointer to the component object */ + void *profileData; /* pointer to the component profile data */ + unsigned int ownedOrInherited : 1;/* if profile data is inherited or owned*/ + unsigned int staticOrDynamic : 1; /* if profile item is static or dynamic */ + PFW_COMPONENT_PROFILE_ITEM *next; /* pointer to the next component profile*/ + }; + +typedef struct pfwLayerProfileItem PFW_LAYER_PROFILE_ITEM; + +struct pfwLayerProfileItem + { + PFW_LAYER_OBJ *obj; /* pointer to the component object */ + void *profileData; /* pointer to the layer profile data */ + unsigned int ownedOrInherited : 1;/* if profile data is inherited or owned*/ + unsigned int staticOrDynamic : 1; /* if profile item is static or dynamic */ + PFW_LAYER_PROFILE_ITEM * next;/* pointer to the next layer profile */ + PFW_COMPONENT_PROFILE_ITEM *firstComponent;/* pointer to the profile item */ + /* for the first component of the */ + /* layer */ + }; + +struct pfwProfileObj + { + unsigned int id; /* position in the profile table */ + SEM_ID profileMutex; /* profile object protection */ + char name[PFW_MAX_NAME_LENGTH]; + PFW_OBJ *pfwObj; /* framework this profile belongs to */ + PFW_LAYER_PROFILE_ITEM *firstLayer[PFW_LAYERED_PLANE_NUMBER]; + }; + +extern STATUS _pfwParameterAdd (PFW_PARAMETER_OBJ * parameterObj); +extern STATUS _pfwProfileDelete (PFW_OBJ *, + PFW_LAYER_PROFILE_ITEM *firstLayer[]); +extern STATUS _pfwObjProfileDataShow (PFW_PLUGIN_OBJ * , void *profileData); +extern PFW_LAYER_PROFILE_ITEM + *pfwNewLayerProfileItemAdd (PFW_LAYER_OBJ *layerObj, + unsigned int planeId, + PFW_LAYER_PROFILE_ITEM **firstLayer); +extern PFW_COMPONENT_PROFILE_ITEM + *pfwNewComponentProfileItemAdd (PFW_COMPONENT_OBJ *componentObj, + PFW_LAYER_PROFILE_ITEM *layer); + +extern STATUS pfwProfileTreeCopy (PFW_LAYER_PROFILE_ITEM **baseFirstLayer, + PFW_LAYER_PROFILE_ITEM **newFirstLayer, + PFW_PROFILE_DATA_STATUS dataStatus, + BOOL check); +extern void pfwProfileTableCreate (PFW_OBJ *pfwObj, unsigned int initialSize, + int maxSize); +extern void pfwProfileTableDelete (PFW_OBJ *pfwObj); +extern void pfwParameterTableCreate (PFW_OBJ *pfwObj, + unsigned int initialSize, int maxSize); +extern void pfwParameterTableDelete (PFW_OBJ *pfwObj); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpfwProfilePh */ + diff --git a/h/private/pfw/pfwStackP.h b/h/private/pfw/pfwStackP.h new file mode 100644 index 0000000..e4953a6 --- /dev/null +++ b/h/private/pfw/pfwStackP.h @@ -0,0 +1,102 @@ +/* pfwStackP.h - private Protocol FrameWork stack header */ + +/* + * Copyright (c) 1999,2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01g,15mar05,ijm added pfwPluginObjStateLockNoWait +01f,22nov99,koz Added pfwStackTableCreate routine +01e,11oct99,koz Added callbacks and delete cause id attributes +01d,22sep99,sj moved pfwStackAddDone and pfwStackDeleteDone to pfwStack.h +01c,08sep99,koz Added event information to the stack object +01b,18Aug99,sj modified for generic framework +01a,09jul99,koz created +*/ + +#ifndef __INCpfwStackPh +#define __INCpfwStackPh + +#include "pfw/pfw.h" +#include "pfw/pfwStack.h" +#include "semLib.h" +#include "private/pfw/pfwProfileP.h" +#include "private/pfw/pfwEventP.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef struct pfwStackItem PFW_STACK_ITEM; + +typedef enum pfwStackItemStatus + { + PFW_ADDED_STACK_ITEM, + PFW_ATTACHED_STACK_ITEM + } PFW_STACK_ITEM_STATUS; + +/* + * Each stack object has a list of stack item as described below. Each + * component and layer in a stack is represented by a stack item. + */ + +struct pfwStackItem + { + PFW_PLUGIN_OBJ_STATE state; /* state of a layer or component */ + PFW_STACK_ITEM *nextRcv; /* pointer to the next receiving item */ + PFW_STACK_ITEM *nextSend; /* pointer to the next sending item */ + PFW_STACK_ITEM *relative; /* pointer to the parent layer (for a */ + /* component) or a child component (for a */ + /* layer) */ + PFW_STACK_ITEM *lastVisited; /* the last visited component of a layer */ + unsigned int addedOrAttached : 1; /* if stackAdd is called for the stack */ + /* item */ + }; + +/* + * For each stack instance, a stack object is created. This object holds + * all the information for that stack. + */ + +struct pfwStackObj + { + unsigned int id; /* position in the stack table */ + SEM_ID stackMutex; /* single thread access to stackObj */ + PFW_OBJ * pfwObj; /* framework this belongs to */ + PFW_STACK_STATUS status; /* current status of stack */ + PFW_STACK_ITEM * + firstItem[PFW_LAYERED_PLANE_NUMBER];/*array of pointers to first receiving*/ + /* items in each layered plane */ + /* traversed in this stack */ + PFW_EVENT_ITEM *eventItemHead; /* head of the event item list */ + PFW_STACK_OBJ_CALLBACKS *callbacks; /* callback functions for stack add */ + /* delete processing */ + void *userHandle; /* user provided handle */ + PFW_LAYER_PROFILE_ITEM /* profile data */ + *firstLayer[PFW_LAYERED_PLANE_NUMBER]; + PFW_STACK_ITEM *lastAddedItem; /* the last added item in the add */ + /* processes initiated by pfwStackAdd */ + + PFW_STACK_ITEM *lastDeletedItem; /* the last deleted item in the delete*/ + /* processes initiated by pfwStackAdd */ + }; + +extern void pfwStackTableCreate (PFW_OBJ *pfwObj, unsigned int initialSize, + int maxSize); +extern void pfwStackTableDelete (PFW_OBJ *pfwObj); + +extern STATUS pfwPluginObjStateLockNoWait (PFW_PLUGIN_OBJ_STATE * pluginState); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpfwStackPh */ + diff --git a/h/private/pfw/pfwTimerP.h b/h/private/pfw/pfwTimerP.h new file mode 100644 index 0000000..bc98708 --- /dev/null +++ b/h/private/pfw/pfwTimerP.h @@ -0,0 +1,90 @@ +/* timerP.h - private timer header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,15oct99,koz Added sysClkTicStart attribute to PFW_TIMER_UNIT_MANAGER +01d,19sep99,koz Changed timer type to timer unit +01c,01aug99,koz Added multiple timer manager functionality +01b,31jul99,koz Cleaned up. +01a,23jul99,koz written. +*/ + +#ifndef __INCpfwTimerPh +#define __INCpfwTimerPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "dllLib.h" +#include "semLib.h" +#include "wdLib.h" +#include "pfw/pfwTimer.h" + +/* typedefs */ +typedef struct pfwTimerManager PFW_TIMER_MANAGER; +typedef struct pfwTimeUnitManger PFW_TIME_UNIT_MANAGER; +typedef struct pfwTimerGroup PFW_TIMER_GROUP; + +struct pfwTimerObj + { + DL_NODE node; /* node of a double link list */ + PFW_TIMER_HANDLER handler; /* timer handler */ + PFW_PLUGIN_OBJ_STATE *state; /* owner state, an arg to the timer handler */ + unsigned int arg; /* second arg to the timer handler function */ + unsigned int unit; /* timer unit (e.g., second and minute) */ + PFW_TIMER_GROUP *group; /* pointer to the group of timers with the */ + /* same deadline*/ + }; + +struct pfwTimerGroup + { + DL_NODE node; /* node of a double link list */ + DL_LIST timerObjList; /* list of timer objects */ + unsigned int relativeTime; /* timeout value relative to the previous */ + /* timer group */ + BOOL expired; /* if this group has been expired */ + PFW_TIME_UNIT_MANAGER /* pointer to the timer manager */ + *manager; + }; + +/* Unit specific timer manager */ +struct pfwTimeUnitManger + { + DL_LIST timerGroupList; /* list of timer groups */ + unsigned int ticks; /* number of elapsed ticks of the watch */ + /* dog timer */ + ULONG sysClkTickStart; /* system clock tick value when watchdog is */ + /* started */ + unsigned int deadline; /* deadline for the first timer group in */ + /* the timer group list */ + unsigned int sysClkTicks; /* number of system clock ticks at which */ + /* the watch dog timer expires */ + WDOG_ID watchDogId; /* watchDog timer id */ + SEM_ID timerMutex; /* Mutex to protect timer resources */ + SEM_ID semId; /* semaphore to be given when a timer group */ + /* is expired */ + }; + +struct pfwTimerManager + { + PFW_TIME_UNIT_MANAGER *timeUnitManager[PFW_TIME_UNIT_NUM]; + }; + +extern STATUS pfwTimerManagerCreate (PFW_OBJ *pfwObj, + unsigned int sysClkTickCounts[], + SEM_ID semId); +extern STATUS pfwTimerManagerDelete (PFW_OBJ *pfwObj); +extern PFW_TIMER_OBJ *pfwTimerExpire (PFW_OBJ *pfwObj); +extern STATUS pfwTimerShow (PFW_OBJ *pfwObj); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpfwTimerPh */ + + diff --git a/h/private/pfw/pfwUtilP.h b/h/private/pfw/pfwUtilP.h new file mode 100644 index 0000000..acc670f --- /dev/null +++ b/h/private/pfw/pfwUtilP.h @@ -0,0 +1,283 @@ +/* pfwUtilP.h - Private protocol framework util header file */ + +/* Copyright 1999 - 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,21jan05,vvv SLL_xxx, DLL_xxx macros are now available in sllLib.h and + dllLib.h +01a,23feb00,sj do not cast lvalue in DLL_GET and SLL_GET +*/ + +#ifndef __INCpfwUtilPh +#define __INCpfwUtilPh + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "sllLib.h" +#include "dllLib.h" + +#if (!defined (_WRS_VXWORKS_MAJOR) || (_WRS_VXWORKS_MAJOR < 6)) +/******************************************************************************* +* +* SLL_INIT - initialize singly linked list head +* +* Initialize the specified list to an empty list. +*/ + +#define SLL_INIT(list) \ + { \ + ((SL_LIST *)(list))->head = NULL; \ + ((SL_LIST *)(list))->tail = NULL; \ + } + +/******************************************************************************* +* +* SLL_PUT_AT_HEAD - add node to beginning of list +* +* This macro adds the specified node to the end of the specified list. +* +*/ + +#define SLL_PUT_AT_HEAD(list, node) \ + { \ + if ((((SL_NODE *)(node))->next = ((SL_LIST *)(list))->head) == NULL) \ + { \ + ((SL_LIST *)(list))->head = ((SL_NODE *)(node); \ + ((SL_LIST *)(list))->tail = ((SL_NODE *)(node); \ + else \ + ((SL_LIST *)(list))->head = (node); \ + } + +/******************************************************************************* +* +* SLL_PUT_AT_TAIL - add node to end of list +* +* This macro adds the specified node to the end of the specified singly +* linked list. +* +*/ + +#define SLL_PUT_AT_TAIL(list, node) \ + { \ + ((SL_NODE *)(node))->next = NULL; \ + if (((SL_LIST *)(list))->head == NULL) \ + { \ + ((SL_LIST *)(list))->head = (SL_NODE *)(node); \ + ((SL_LIST *)(list))->tail = (SL_NODE *)(node); \ + } \ + else \ + ((SL_LIST *)(list))->tail->next = (SL_NODE *)(node); \ + ((SL_LIST *)(list))->tail = (SL_NODE *)(node); \ + } + +/******************************************************************************* +* +* SLL_GET - get (delete and return) first node from list +* +* This macro gets the first node from the specified singly linked list, +* deletes the node from the list, and returns a pointer to the node gotten. +* +*/ + +#define SLL_GET(list, node) \ + { \ + if (((node) = (void *)((SL_LIST *)(list))->head) != NULL) \ + ((SL_LIST *)(list))->head = ((SL_NODE *)(node))->next; \ + } + +/******************************************************************************* +* +* SLL_REMOVE - remove specified node in list +* +* Remove the specified node in a singly linked list. +*/ + +#define SLL_REMOVE(list, deleteNode, previousNode) \ + { \ + if (((SL_NODE *)(previousNode)) == NULL) \ + { \ + ((SL_LIST *)(list))->head = ((SL_NODE *)(deleteNode))->next; \ + if (((SL_LIST *)(list))->tail == ((SL_NODE *)(deleteNode))) \ + ((SL_LIST *)(list))->tail = NULL; \ + } \ + else \ + { \ + ((SL_NODE *)(previousNode))->next = ((SL_NODE *)(deleteNode))->next; \ + if (((SL_LIST *)(list))->tail == ((SL_NODE *)(deleteNode))) \ + ((SL_LIST *)(list))->tail = ((SL_NODE *)(previousNode)); \ + } \ + } + +/******************************************************************************* +* +* SLL_PREVIOUS - find and return previous node in list +* +* Find and return the previous node in a singly linked list. +*/ + +#define SLL_PREVIOUS(list, node, previousNode) \ + { \ + SL_NODE *temp; \ + (SL_NODE *)(previousNode) = NULL; \ + temp = ((SL_LIST *)(list))->head; \ + if (temp != NULL) && (temp != (node)) \ + while (temp->next != NULL) \ + { \ + if (temp->next == (node)) \ + { \ + (SL_NODE *)(previousNode) = temp; \ + break; \ + } \ + temp = temp->next; \ + } \ + } +#endif /* !_WRS_VXWORKS_MAJOR */ + + +/* typedefs */ + +typedef struct pfwQueueItem + { + SL_NODE node; + } PFW_QUEUE_ITEM; + +typedef struct pfwQueue + { + SL_LIST itemList; + unsigned int count; + unsigned int drops; + } PFW_QUEUE; + +#define PFW_QUEUE_INIT(queue) \ + { \ + SLL_INIT ((queue)); \ + ((PFW_QUEUE *)(queue))->count = 0; \ + ((PFW_QUEUE *)(queue))->drops = 0; \ + } + +#define PFW_ENQUEUE(queue, item) \ + { \ + SLL_PUT_AT_TAIL ((queue), (item)); \ + ((PFW_QUEUE *)(queue))->count++; \ + } + +#define PFW_DEQUEUE(queue, item) \ + { \ + SLL_GET ((queue), (item)); \ + if (((PFW_QUEUE *)(queue))->count > 0) \ + ((PFW_QUEUE *)(queue))->count--; \ + } + + +#if (!defined (_WRS_VXWORKS_MAJOR) || (_WRS_VXWORKS_MAJOR < 6)) +/********************************************************************* +* +* DLL_INIT - initialize doubly linked list descriptor +* +* Initialize the specified list to an empty list. +*/ + +#define DLL_INIT(list) \ + { \ + ((DL_LIST *)(list))->head = NULL; \ + ((DL_LIST *)(list))->tail = NULL; \ + } + +/************************************************************************ +* +* DLL_INSERT - insert node in list after specified node +* +* This macro inserts the specified node in the specified list. +* The new node is placed following the specified 'previous' node in the list. +* If the specified previous node is NULL, the node is inserted at the head +* of the list. +*/ + +#define DLL_INSERT(list, previousNode, node) \ + { \ + DL_NODE *temp; \ + if ((previousNode) == NULL) \ + { \ + temp = ((DL_LIST *)(list))->head; \ + ((DL_LIST *)(list))->head = (DL_NODE *)(node); \ + } \ + else \ + { \ + temp = ((DL_NODE *)(previousNode))->next; \ + ((DL_NODE *)(previousNode))->next = (DL_NODE *)(node); \ + } \ + if (temp == NULL) \ + ((DL_LIST *)(list))->tail = (DL_NODE *)(node); \ + else \ + temp->previous = (DL_NODE *)(node); \ + ((DL_NODE *)(node))->next = temp; \ + ((DL_NODE *)(node))->previous = (DL_NODE *)(previousNode); \ + } + +/************************************************************************ +* +* DLL_ADD - add node to end of list +* +* This macro adds the specified node to the end of the specified list. +*/ + +#define DLL_ADD(list, node) \ + { \ + DL_NODE *listTail = (list)->tail; \ + DLL_INSERT ((list), listTail, (node)); \ + } + +/************************************************************************ +* +* DLL_REMOVE - remove specified node in list +* +* Remove the specified node in the doubly linked list. +*/ + +#define DLL_REMOVE(list, node) \ + { \ + if (((DL_NODE *)(node))->previous == NULL) \ + ((DL_LIST *)(list))->head = ((DL_NODE *)(node))->next; \ + else \ + ((DL_NODE *)(node))->previous->next = ((DL_NODE *)(node))->next; \ + if (((DL_NODE *)(node))->next == NULL) \ + ((DL_LIST *)(list))->tail = ((DL_NODE *)(node))->previous; \ + else \ + ((DL_NODE *)(node))->next->previous = ((DL_NODE *)(node))->previous; \ + } + +/************************************************************************ +* +* DLL_GET - get (delete and return) first node from list +* +* This macro gets the first node from the specified list, deletes the node +* from the list, and returns a pointer to the node gotten. +* +*/ + +#define DLL_GET(list, node) \ + { \ + (node) = (void *)((DL_LIST *)(list))->head; \ + if ((node) != NULL) \ + { \ + ((DL_LIST *)(list))->head = ((DL_NODE *)(node))->next; \ + if (((DL_NODE *)(node))->next == NULL) \ + ((DL_LIST *)(list))->tail = NULL; \ + else \ + ((DL_NODE *)(node))->next->previous = NULL; \ + } \ + } +#endif /* !_WRS_VXWORKS_MAJOR */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpfwUtilPh */ + + diff --git a/h/private/pgMgrLibP.h b/h/private/pgMgrLibP.h new file mode 100644 index 0000000..31b9d68 --- /dev/null +++ b/h/private/pgMgrLibP.h @@ -0,0 +1,188 @@ +/* pgMgrLibP.h - page manager library private header */ + +/* + * Copyright (c) 1999-2005 Wind River Systems, Inc. + * + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01g,03jun05,yvp Added #ifndef _ASMLANGUAGE. + Updated copyright. #include now with angle-brackets. +01f,24jan05,aeg added pgMgrPrivateUnmap() function prototype (SPR #106381). +01e,13sep04,zl cleaned up MM private API +01d,10sep04,gls cleanup +01c,08jul04,tam changed PAGE_MGR_ATTR_ALLOC_CONTIG_DEFAULT to be + PAGE_MGR_ATTR_ALLOC_CONTIG +01b,19may04,tam moved definition from pgMgrLib.h +01a,22oct03,gls proted from AE version 01b +*/ + +#ifndef __INCpgMgrLibPh +#define __INCpgMgrLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include +#include +#include + + +/* status codes */ +/* XXX temporary */ + +#include + + +#define S_pgMgrLib_NOT_IMPLEMENTED (M_pgMgrLib | 1) +#define S_pgMgrLib_MMU_ATTR_NOT_SPECIFIED (M_pgMgrLib | 2) +#define S_pgMgrLib_VIRT_ADDR_OUT_OF_RANGE (M_pgMgrLib | 3) +#define S_pgMgrLib_VIRT_PAGES_NOT_AVAILABLE (M_pgMgrLib | 4) +#define S_pgMgrLib_CONTIG_PHYS_PAGES_NOT_AVAILABLE (M_pgMgrLib | 5) +#define S_pgMgrLib_PHYS_PAGES_NOT_AVAILABLE (M_pgMgrLib | 6) +#define S_pgMgrLib_VIRT_PAGE_COUNT_IS_NULL (M_pgMgrLib | 7) +#define S_pgMgrLib_PHYS_PAGE_POOL_NO_MATCH (M_pgMgrLib | 8) +#define S_pgMgrLib_VIRT_PAGES_NOT_ALLOCATED (M_pgMgrLib | 9) +#define S_pgMgrLib_PHYS_PAGE_POOL_NOT_AVAILABLE (M_pgMgrLib | 10) +#define S_pgMgrLib_ADDR_NOT_ALIGNED (M_pgMgrLib | 11) +#define S_pgMgrLib_INVALID_PAGE_POOL (M_pgMgrLib | 12) +#define S_pgMgrLib_INVALID_MMU_ATTR (M_pgMgrLib | 13) +#define S_pgMgrLib_INVALID_ALLOC_ATTR (M_pgMgrLib | 14) +#define S_pgMgrLib_NON_1_1_MAPPINGS_NOT_AVAILABLE (M_pgMgrLib | 15) + +/* defines */ + +#define PAGE_MGR_OPTS_USR_TEXT (PAGE_MGR_ATTR_ALLOC_NONCONTIG | \ + PAGE_MGR_ATTR_ALLOC_MAPPED | \ + MMU_ATTR_USR_TEXT | \ + MMU_ATTR_SUP_RW) + +#define PAGE_MGR_OPTS_USR_DATA (PAGE_MGR_ATTR_ALLOC_CONTIG | \ + PAGE_MGR_ATTR_ALLOC_MAPPED | \ + MMU_ATTR_USR_DATA | \ + MMU_ATTR_SUP_RW) + +#define PAGE_MGR_OPTS_USR_DATA_RO \ + (PAGE_MGR_ATTR_ALLOC_CONTIG | \ + PAGE_MGR_ATTR_ALLOC_MAPPED | \ + MMU_ATTR_USR_DATA_RO | \ + MMU_ATTR_SUP_RW) + +#define PAGE_MGR_OPTS_SUP_TEXT (PAGE_MGR_ATTR_ALLOC_CONTIG | \ + PAGE_MGR_ATTR_ALLOC_MAPPED | \ + MMU_ATTR_SUP_TEXT) + +#define PAGE_MGR_OPTS_SUP_DATA (PAGE_MGR_ATTR_ALLOC_CONTIG | \ + PAGE_MGR_ATTR_ALLOC_MAPPED | \ + MMU_ATTR_SUP_DATA) + +#define PAGE_MGR_OPTS_SUP_DATA_RO \ + (PAGE_MGR_ATTR_ALLOC_CONTIG | \ + PAGE_MGR_ATTR_ALLOC_MAPPED | \ + MMU_ATTR_SUP_DATA_RO) + +#define PAGE_MGR_BITMAP_SET(dst, src, msk) \ + (dst) = (((dst) & ~(msk)) | ((src) & (msk))) + +#define PAGE_MGR_ATTR_ALLOC_GET(psAttr) ((psAttr) & PAGE_MGR_ATTR_ALLOC_MSK) +#define PAGE_MGR_ATTR_ALLOC_SET(psAttr, allocAttr) \ + PAGE_MGR_BITMAP_SET(psAttr, allocAttr, PAGE_MGR_ATTR_ALLOC_MSK) + +#define PAGE_MGR_ATTR_MMU_GET(psAttr) ((psAttr) & PAGE_MGR_ATTR_MMU_MSK) +#define PAGE_MGR_ATTR_MMU_SET(psAttr, mmuAttr) \ + PAGE_MGR_BITMAP_SET(psAttr, mmuAttr, PAGE_MGR_ATTR_MMU_MSK) + +#ifndef _ASMLANGUAGE + +/* Access macros */ + +#define PS_VM_CONTEXT_ID(pgMgrId) (((PAGE_MGR_OBJ *)(pgMgrId))->vmContextId) +#define PS_VIRT_PAGESIZE(pgMgrId) (((PAGE_MGR_OBJ *)(pgMgrId))->virtPageSize) +#define PS_VM_PAGESIZE(pgMgrId) (((PAGE_MGR_OBJ *)(pgMgrId))->vmPageSize) +#define PS_OBJCORE(pgMgrId) (((PAGE_MGR_OBJ *)(pgMgrId))->objCore) +#define PS_VIRT_PGPOOL_ID(pgMgrId) (((PAGE_MGR_OBJ *)(pgMgrId))->virtPgPoolId) +#define PAGE_MGR_OPTIONS(pgMgrId) (((PAGE_MGR_OBJ *)(pgMgrId))->options) + +#define PAGE_MGR_OPTIONS_ALLOWED \ + (PAGE_MGR_ATTR_MMU_MSK | \ + PAGE_MGR_ATTR_ALLOC_MSK) + +/* typedef */ + +typedef enum pgMgrAttr { + PAGE_MGR_ATTR_MMU_MSK = 0x000FFFFF, /* Mask for MMU attributes */ + + PAGE_MGR_ATTR_ALLOC_MSK = 0x00F00000, /* Mask for allocation attr */ + PAGE_MGR_ATTR_ALLOC_CONTIG_MSK = 0x00300000, + PAGE_MGR_ATTR_ALLOC_NONCONTIG = 0x00100000, + PAGE_MGR_ATTR_ALLOC_CONTIG = 0x00200000, /* Alloc contig phys pages */ + PAGE_MGR_ATTR_ALLOC_MAP_MSK = 0x00C00000, + PAGE_MGR_ATTR_ALLOC_MAPPED = 0x00400000, + PAGE_MGR_ATTR_ALLOC_UNMAPPED = 0x00800000, /* Alloc unmapped pages */ + PAGE_MGR_ATTR_ALLOC_CONTIG_DEFAULT = PAGE_MGR_ATTR_ALLOC_CONTIG, + PAGE_MGR_ATTR_ALLOC_MAP_DEFAULT = PAGE_MGR_ATTR_ALLOC_MAPPED, + PAGE_MGR_OPTS_MSK = 0xF0000000, /* Mask for other options */ + PAGE_MGR_OPTS_NONE = 0x00000000, + + PAGE_MGR_ATTR_DEFAULT = 0x00000000 + } PAGE_MGR_ATTR; + +typedef PAGE_MGR_ATTR PAGE_MGR_OPTS; + +typedef struct pgMgrObj { + OBJ_CORE objCore; + PAGE_POOL_ID virtPgPoolId; + PAGE_POOL_ID physPgPoolId; + VM_CONTEXT_ID vmContextId; + UINT vmPageSize; + UINT virtPageSize; + PAGE_MGR_OPTS options; + void * pExt; + } PAGE_MGR_OBJ; + + +/* function prototypes */ + +STATUS pgMgrLibInit (void); +PAGE_MGR_ID pgMgrCreate (RTP_ID rtpId, PAGE_MGR_OPTS options); +STATUS pgMgrDelete (PAGE_MGR_ID pgMgrId); +VIRT_ADDR pgMgrPageAlloc (PAGE_MGR_ID pgMgrId, UINT numPages, + PAGE_MGR_ATTR attr); +VIRT_ADDR pgMgrPageAllocAt (PAGE_MGR_ID pgMgrId, VIRT_ADDR virtAdr, + PHYS_ADDR physAdr, UINT numPages, + PAGE_MGR_ATTR attr); +STATUS pgMgrPageFree (PAGE_MGR_ID pgMgrId, VIRT_ADDR virtAdr, + UINT numPages); +STATUS pgMgrPageMap (PAGE_MGR_ID pgMgrId, VIRT_ADDR virtAdr, + PHYS_ADDR physAdr, UINT numPages, PAGE_MGR_ATTR attr); +STATUS pgMgrPageUnmap (PAGE_MGR_ID, VIRT_ADDR, UINT); +STATUS pgMgrPageAttrSet (PAGE_MGR_ID pgMgrId, VIRT_ADDR virtAdr, + UINT numPages, MMU_ATTR mmuAttr); +STATUS pgMgrPageAttrGet (PAGE_MGR_ID pgMgrId, VIRT_ADDR virtAdr, + MMU_ATTR * pMmuAttr); +STATUS pgMgrVirtToPhys (PAGE_MGR_ID pgMgrId, VIRT_ADDR virtAdr, + PHYS_ADDR * pPhysAdr); +STATUS pgMgrPhysToVirt (PAGE_MGR_ID pgMgrId, PHYS_ADDR physAdr, + VIRT_ADDR * pVirtAdr); +PAGE_MGR_OPTS pgMgrOptsGet (PAGE_MGR_ID pgMgrId); +PAGE_MGR_ID pgMgrInit (PAGE_MGR_OBJ*, RTP_ID, PAGE_MGR_OPTS); +STATUS pgMgrOptsSet (PAGE_MGR_ID, PAGE_MGR_OPTS); +void pgMgrShowInit (void); +STATUS pgMgrPrivateUnmap (PAGE_MGR_ID pgMgrId, BOOL takePgPoolMutex); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpgMgrLibPh */ diff --git a/h/private/pgPoolLibP.h b/h/private/pgPoolLibP.h new file mode 100644 index 0000000..b17ec30 --- /dev/null +++ b/h/private/pgPoolLibP.h @@ -0,0 +1,290 @@ +/* pgPoolLibP.h - page set object library private header file */ + +/* + * Copyright (c) 1995-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01i,03jun05,yvp Added #ifndef _ASMLANGUAGE. + Updated copyright. #include now with angle-brackets. +01h,28sep04,tam changed ADDR type to unsigned int +01g,13sep04,zl error status code cleanup +01f,14may04,pcs Rearrange values of PG_POOL_OPT_PHYS_XXX due to rearranging + of PAGE_MGR_ATTR_POOL_XXX values. +01e,03dec03,yp adding NO_ACTION ERROR flag +01d,26nov03,zl renamed avlLib to avlUintLib +01d,29nov03,yp moving ADDR from vxTypesOld.h to here +01c,18nov03,yp adding error code VM_NOT_INITIALIZED +01b,20oct03,zl updated for new avlLib API +01a,08jul03,yp merged from AE pgPoolLib.h and pgPoolLibP.h +*/ + +#ifndef __INCpgPoolLibPh +#define __INCpgPoolLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include + + + + +/* defines */ + +#define PG_POOL_SIZE_NODE_NB 16 +#define PG_POOL_ADDR_NODE_NB 16 + + +/* status codes */ + +#define S_pgPoolLib_WRONG_PAGE_SIZE (M_pgPoolLib | 1) +#define S_pgPoolLib_START_ADR_NOT_ALIGNED (M_pgPoolLib | 2) +#define S_pgPoolLib_NOT_ENOUGH_FREE_PAGES (M_pgPoolLib | 3) +#define S_pgPoolLib_WRONG_ALIGNMENT (M_pgPoolLib | 4) +#define S_pgPoolLib_PAGE_RANGE_OUT_OF_POOL (M_pgPoolLib | 5) +#define S_pgPoolLib_CANNOT_ADD_TO_POOL (M_pgPoolLib | 6) +#define S_pgPoolLib_OPTION_UNCHANGEABLE (M_pgPoolLib | 7) +#define S_pgPoolLib_PAGE_OVERLAP (M_pgPoolLib | 8) +#define S_pgPoolLib_VM_NOT_INITIALIZED (M_pgPoolLib | 9) +#define S_pgPoolLib_INVALID_POOL_TYPE (M_pgPoolLib | 10) + +#ifndef _ASMLANGUAGE + +/* typedefs */ + +typedef unsigned int ADDR; + +/* + * the order of the fields in PAGE_POOL_ADDR_NODE and PAGE_POOL_SIZE_NODE + * is important... + */ + +typedef enum pg_pool_opt + { + PG_POOL_OPT_TYPE_MSK = 0x0000000F, + PG_POOL_OPT_TYPE_PHYS = 0x00000001, /* physical address space */ + PG_POOL_OPT_TYPE_VIRT = 0x00000002, /* virtual address space */ + PG_POOL_OPT_TYPE_OTHER = 0x00000004, /* undefined address space type */ + + PG_POOL_OPT_ERROR_MSK = 0x0000F000, + PG_POOL_OPT_ERROR_SPD_FLAG = 0x00001000, /* suspend task on alloc error */ + PG_POOL_OPT_ERROR_LOG_FLAG = 0x00002000, /* log error msg on alloc error */ + PG_POOL_OPT_ERROR_NONE_FLAG = 0x00004000, /* do nothing on alloc error */ + + PG_POOL_OPT_PHYS_MSK = 0x0F000000, /* type of physical page pool */ + PG_POOL_OPT_PHYS_RAM = 0x01000000, /* Real memory */ + PG_POOL_OPT_PHYS_IO = 0x02000000, /* IO space */ + PG_POOL_OPT_PHYS_ANY = 0x0F000000, + + PG_POOL_OPT_RESERVED_MSK = 0xF0000000, /* reserved options fields */ + PG_POOL_OPT_RESERVED_1 = 0x10000000, /* reserved options field 1 */ + PG_POOL_OPT_RESERVED_2 = 0x20000000, /* reserved options field 2 */ + PG_POOL_OPT_RESERVED_3 = 0x40000000, /* reserved options field 3 */ + PG_POOL_OPT_RESERVED_4 = 0x80000000, /* reserved options field 4 */ + + PG_POOL_OPT_NONE = 0x0 + } PG_POOL_OPT; + +typedef struct + { + AVLU_NODE avlAddr; /* AVL tree sorted by the start addr key */ + void * next; /* next with same size */ + void * prev; /* prev with same size */ + ADDR stopAddr; + } PAGE_POOL_ADDR_NODE; + +typedef struct + { + AVLU_NODE avlSize; /* AVL tree sorted by the size key */ + void * next; + void * prev; + } PAGE_POOL_SIZE_NODE; + +typedef struct + { + void * next; + PAGE_POOL_ADDR_NODE node[16]; + } PAGE_POOL_ADDR_BLOCK; + +typedef struct + { + void * next; + PAGE_POOL_SIZE_NODE node[16]; + } PAGE_POOL_SIZE_BLOCK; + + +/* + * Data structure for a pool section (i.e. piece of memory added to a + * a page pool via pgPoolAddToPool) header. + */ + +typedef struct page_pool_section_hdr + { + DL_NODE sectionNode; /* pointer to the next section */ + ADDR startAddr; /* start address of this section */ + ADDR endAddr; /* last address of this section */ + } PAGE_POOL_SECTION_HDR; + + +struct page_pool_obj /* PAGE_POOL_OBJ */ + { + OBJ_CORE objCore; + ADDR baseAddr; /* start of pool */ + ADDR endAddr; /* last address of pool */ + UINT pageSize; + SEMAPHORE sem; /* page pool semaphore */ + UINT numPages; /* size of pool in pages XXXXXXXXX */ + UINT numFreePages; /* number of free pages in pool */ + UINT minFreePages; /* minimum number of free pages seen */ + PG_POOL_OPT options; + + AVLU_TREE avlAddr; + AVLU_TREE avlSize; + + PAGE_POOL_ADDR_NODE * freeAddrNode; + PAGE_POOL_SIZE_NODE * freeSizeNode; + PAGE_POOL_ADDR_BLOCK * freeAddrBlock; + PAGE_POOL_SIZE_BLOCK * freeSizeBlock; + + DL_LIST sectionHdrLst; /* head of the link list of all */ + /* memory sections added to the page */ + /* pool via pgPoolAddToPool() */ + }; +typedef enum pg_pool_page_state + { + PG_POOL_PG_STATE_MSK = 0x0000000F, + PG_POOL_PG_STATE_IN_RANGE = 0x00000001, /* page is in pool adrs range */ + PG_POOL_PG_STATE_OUT_RANGE = 0x00000002, /* page is out of adrs range */ + PG_POOL_PG_STATE_RESERVED = 0x00000004, /* page is reserved */ + PG_POOL_PG_STATE_AVAILABLE = 0x00000008, /* page is available */ + + PG_POOL_PG_NONE = 0x0 + } PG_POOL_PG_STATE; + +/* page pool information/statistics structure */ + +typedef struct + { + UINT numPages, /* number of pages in the page pool */ + numFreePages, /* current number of free pages in the page pool */ + maxFreeBlockSize, /* number of page of the largest block of */ + /* contiguous free pages in the page pool */ + minFreePages; /* minimum number of free page at any given time */ + UINT pageSize; /* size of a page in bytes */ + + PG_POOL_OPT options; /* options of the page pool */ + + } PAGE_POOL_INFO; + + +typedef struct page_pool_obj PAGE_POOL_OBJ; + +/* function declarations */ + +extern PAGE_POOL_ID pgPoolCreate (ADDR, UINT, UINT, PG_POOL_OPT); +extern STATUS pgPoolAddToPool (PAGE_POOL_ID , ADDR, UINT); +extern STATUS pgPoolDelete (PAGE_POOL_ID); +extern BOOL pgPoolPageIsFree (PAGE_POOL_ID, ADDR, UINT); +extern BOOL pgPoolPageIsAllocated (PAGE_POOL_ID, ADDR, UINT); +extern ADDR pgPoolPageGet (PAGE_POOL_ID, UINT); +extern ADDR pgPoolAlignedPageGet (PAGE_POOL_ID, UINT, UINT); +extern ADDR pgPoolPageGetAt (PAGE_POOL_ID, ADDR, UINT); +extern STATUS pgPoolPageRelease (PAGE_POOL_ID, ADDR, UINT); +extern BOOL pgPoolPageRangeVerify (PAGE_POOL_ID , ADDR , UINT); +extern UINT pgPoolPageSize (PAGE_POOL_ID); +extern STATUS pgPoolOptionsSet (PAGE_POOL_ID, PG_POOL_OPT, + PG_POOL_OPT); +extern STATUS pgPoolOptionsGet (PAGE_POOL_ID, PG_POOL_OPT *); +extern STATUS pgPoolInfoGet (PAGE_POOL_ID, PAGE_POOL_INFO *); + +/* temporary place holder for these obj generic macros */ + +typedef unsigned int OBJ_NEW_ID; + +#define OBJ_INIT(pObj) objInit((OBJ_CORE *) pObj) +#define OBJ_CREATE(OBJ_TYPE) objCreate (sizeof(OBJ_TYPE)) +#define OBJ_DELETE(pObj) objDelete((OBJ_CORE *) pObj) +#define OBJPTR_TO_ID(pObj) (OBJ_NEW_ID) (pObj) +#define ID_TO_OBJPTR(objId) (OBJ_CORE *) (objId) + + +/* object/id conversion definitions */ + +#define PP_OBJ_CREATE() (PAGE_POOL_OBJ *) OBJ_CREATE (PAGE_POOL_OBJ) +#define PP_OBJ_DELETE(pObj) OBJ_DELETE (pObj) +#define PP_OBJ_ID(pObj) (PAGE_POOL_ID) OBJPTR_TO_ID (pObj) +#define PP_OBJ_PTR(objId) (PAGE_POOL_OBJ *) ID_TO_OBJPTR (objId) +#define PP_OBJ_INIT(pObj) OBJ_INIT(pObj) + + +/* function macros */ + +#define PG_POOL_OPT_CHECK_TYPE(opt, val) \ + (((opt) & (PG_POOL_OPT_TYPE_MSK)) == (val) ? TRUE : FALSE) +#define PG_POOL_OPT_CHECK_ERROR(opt, val) \ + (((opt) & (PG_POOL_OPT_ERROR_MSK)) == (val) ? TRUE : FALSE) +#define PG_POOL_OPT_CHECK_PHYS(opt,val) \ + (((opt) & (PG_POOL_OPT_PHYS_MSK)) == (val) ? TRUE : FALSE) +#define PG_POOL_OPT_TYPE_GET(opt) ((opt) & PG_POOL_OPT_TYPE_MSK) +#define PG_POOL_OPT_SET(opt, val) ((opt) |= (opt) | (val)) + +#define PG_POOL_PG_CHECK_STATE(state, val) \ + (((state) & (PG_POOL_PG_STATE_MSK)) == (val) ? TRUE : FALSE) +#define PG_POOL_PG_STATE_GET(state) ((state) & PG_POOL_PG_STATE_MSK) +#define PG_POOL_PG_STATE_SET(state, val) ((state) = (state) | (val)) + +#define PAGE_POOL_VERIFY_ADDR_RANGE(poolId, pageAdr, numPages) \ + pgPoolPageRangeVerify(poolId, pageAdr, numPages) +#define PAGE_POOL_VERIFY_ADDR(poolId, pageAdr) \ + pgPoolPageRangeVerify(poolId, pageAdr, 1) +#define PAGE_POOL_VERIFY_ALLOC(poolId, pageAdr, numPages, action) \ + pgPoolPageStateVerify(poolId, pageAdr, numPages, \ + PG_POOL_PG_STATE_RESERVED, action) +#define PAGE_POOL_VERIFY_FREE(poolId, pageAdr, numPages, action) \ + pgPoolPageStateVerify(poolId, pageAdr, numPages, \ + PG_POOL_PG_STATE_AVAILABLE, action) +#define PAGE_POOL_VERIFY_PHYS_TYPE(poolId, attr) \ + ((PP_OBJ_PTR(poolId))->options & (attr & PG_POOL_OPT_PHYS_MSK)) + +/* defines for pgPoolPageStateVerify() */ + +#define PG_STATE_ACTION_NONE 0x0 +#define PG_STATE_ACTION_CHANGE 0x1 + +#define PG_POOL_OPT_PUBLIC_MSK (PG_POOL_OPT_TYPE_MSK | \ + PG_POOL_OPT_ERROR_MSK | \ + PG_POOL_OPT_PHYS_MSK) + + +/* variable declarations */ + +extern CLASS_ID pgPoolClassId; /* memory partition class id */ + +/* non-published functions: can be used only by kernel components */ + +extern STATUS pgPoolLibInit (); +extern PAGE_POOL_ID pgPoolInit (PAGE_POOL_OBJ *, ADDR, UINT, UINT, + PG_POOL_OPT); +extern BOOL pgPoolPageStateVerify (PAGE_POOL_ID , ADDR, UINT, + PG_POOL_PG_STATE, UINT); +extern STATUS pgPoolShowInit(); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpgPoolLibPh */ diff --git a/h/private/pgPoolPhysLibP.h b/h/private/pgPoolPhysLibP.h new file mode 100644 index 0000000..497bbf7 --- /dev/null +++ b/h/private/pgPoolPhysLibP.h @@ -0,0 +1,52 @@ +/* pgPoolPhysLibP.h - physical page pool object library header file */ + +/* Copyright 1998-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,13sep04,zl converted to private header file +01b,30nov03,yp adding error code for address out of range +01a,08jul03,yp written. +*/ + +#ifndef __INCpgPoolPhysLibPh +#define __INCpgPoolPhysLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include "private/pgPoolLibP.h" + +/* defines */ + +/* typedefs */ + +/* function declarations */ + +extern STATUS pgPoolPhysLibInit (void); +extern PAGE_POOL_ID pgPoolPhysCreate (PHYS_ADDR, UINT, UINT, PG_POOL_OPT); +extern STATUS pgPoolPhysAddToPool (PAGE_POOL_ID , PHYS_ADDR, UINT); +extern STATUS pgPoolPhysDelete (PAGE_POOL_ID); +extern BOOL pgPoolPhysPageIsFree (PAGE_POOL_ID, PHYS_ADDR, UINT); +extern BOOL pgPoolPhysPageIsAllocated (PAGE_POOL_ID, PHYS_ADDR, + UINT); +extern PHYS_ADDR pgPoolPhysPageGet (PAGE_POOL_ID, UINT); +extern PHYS_ADDR pgPoolPhysAlignedPageGet (PAGE_POOL_ID, UINT, UINT); +extern PHYS_ADDR pgPoolPhysPageGetAt (PAGE_POOL_ID, PHYS_ADDR, UINT); +extern STATUS pgPoolPhysPageRelease (PAGE_POOL_ID, PHYS_ADDR, UINT); +extern BOOL pgPoolPhysPageRangeVerify (PAGE_POOL_ID , PHYS_ADDR , + UINT); +extern UINT pgPoolPhysPageSize (PAGE_POOL_ID); +extern STATUS pgPoolPhysOptionsSet (PAGE_POOL_ID, PG_POOL_OPT, + PG_POOL_OPT); +extern STATUS pgPoolPhysOptionsGet (PAGE_POOL_ID, PG_POOL_OPT *); +extern STATUS pgPoolPhysInfoGet (PAGE_POOL_ID, PAGE_POOL_INFO *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpgPoolPhysLibPh */ diff --git a/h/private/pgPoolVirtLibP.h b/h/private/pgPoolVirtLibP.h new file mode 100644 index 0000000..9e4cf4e --- /dev/null +++ b/h/private/pgPoolVirtLibP.h @@ -0,0 +1,51 @@ +/* pgPoolVirtLibP.h - virtual page pool object library header file */ + +/* Copyright 1998-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,13sep04,zl converted to private header file. +01a,08jul03,yp written. +*/ + +#ifndef __INCpgPoolVirtLibPh +#define __INCpgPoolVirtLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include "private/pgPoolLibP.h" + +/* defines */ + +/* typedefs */ + +/* function declarations */ + +extern STATUS pgPoolVirtLibInit (void); +extern PAGE_POOL_ID pgPoolVirtCreate (VIRT_ADDR, UINT, UINT, PG_POOL_OPT); +extern STATUS pgPoolVirtAddToPool (PAGE_POOL_ID , VIRT_ADDR, UINT); +extern STATUS pgPoolVirtDelete (PAGE_POOL_ID); +extern BOOL pgPoolVirtPageIsFree (PAGE_POOL_ID, VIRT_ADDR, UINT); +extern BOOL pgPoolVirtPageIsAllocated (PAGE_POOL_ID, VIRT_ADDR, + UINT); +extern VIRT_ADDR pgPoolVirtPageGet (PAGE_POOL_ID, UINT); +extern VIRT_ADDR pgPoolVirtAlignedPageGet (PAGE_POOL_ID, UINT, UINT); +extern VIRT_ADDR pgPoolVirtPageGetAt (PAGE_POOL_ID, VIRT_ADDR, UINT); +extern STATUS pgPoolVirtPageRelease (PAGE_POOL_ID, VIRT_ADDR, UINT); +extern BOOL pgPoolVirtPageRangeVerify (PAGE_POOL_ID , VIRT_ADDR , + UINT); +extern UINT pgPoolVirtPageSize (PAGE_POOL_ID); +extern STATUS pgPoolVirtOptionsSet (PAGE_POOL_ID, PG_POOL_OPT, + PG_POOL_OPT); +extern STATUS pgPoolVirtOptionsGet (PAGE_POOL_ID, PG_POOL_OPT *); +extern STATUS pgPoolVirtInfoGet (PAGE_POOL_ID, PAGE_POOL_INFO *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpgPoolVirtLibPh */ diff --git a/h/private/poolLibP.h b/h/private/poolLibP.h new file mode 100644 index 0000000..754b55b --- /dev/null +++ b/h/private/poolLibP.h @@ -0,0 +1,134 @@ +/* poolLibP.h - private header file for Wind Memory Pools */ + +/* + * Copyright (c) 1998-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01f,12aug05,zl exclude building in unsupported layers. +01e,08aug05,zl added POOL_CREATE and POOL_ITEM_GET macros. Embedded semaphore + in pool structure. +01d,27jul05,mil Added support for minimal kernel. +01c,18feb04,dat POOL structure is private, not public +01b,20aug03,zl added item alignment support. +01a,22feb98,dat, original version. TOR 1.0.1/VXW 5.3 compatible. + mas,tm +*/ + +#ifndef INCpoolLibPh +#define INCpoolLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes */ + +#include +#include +#include +#include + + +/* Private macros */ + +#define POOL_SEM_CREATE_ATTRIB \ + (SEM_Q_PRIORITY | SEM_INVERSION_SAFE | SEM_DELETE_SAFE) + +#define POOL_SEM_TAKE_ATTRIB WAIT_FOREVER + +/* indicator of a block that is provided by user */ + +#define BLOCK_DO_NOT_FREE 0x00000001 + +#ifndef _ASMLANGUAGE + + +#ifdef _WRS_KERNEL +#define POOL_LIST_LOCK() semMTake (&poolListMutex, POOL_SEM_TAKE_ATTRIB) +#define POOL_LIST_UNLOCK() semMGive (&poolListMutex) +#define POOL_LOCK(poolId) semMTake (&(poolId)->mutex, POOL_SEM_TAKE_ATTRIB) +#define POOL_UNLOCK(poolId) semMGive (&(poolId)->mutex) +#else +#define POOL_LIST_LOCK() semTake (&poolListMutex, POOL_SEM_TAKE_ATTRIB) +#define POOL_LIST_UNLOCK() semGive (&poolListMutex) +#define POOL_LOCK(poolId) semTake (&(poolId)->mutex, POOL_SEM_TAKE_ATTRIB) +#define POOL_UNLOCK(poolId) semGive (&(poolId)->mutex) +#endif + + +#ifdef INCLUDE_MEM_ALLOT + +/* + * for layers that don't support poolLib (MKL), simulate the API via + * memAllotLib. There is no POOL_ITEM_RETURN() in this case. + */ + +#define POOL_CREATE(name, itmSize, align, initCnt, incrCnt, partId, options) \ + memAllotPoolCreate(itmSize, align) +#define POOL_ITEM_GET(poolId) \ + memAllot(poolId->sizItem, poolId->alignment) + +typedef struct pool /* Pool structure */ + { + ULONG sizItem; /* individual item size in bytes */ + ULONG alignment; /* individual item alignment in bytes */ + } POOL; + +extern void * memAllot (unsigned size, unsigned alignment); +extern POOL_ID memAllotPoolCreate (unsigned itmSize, unsigned alignment); + +#else /* INCLUDE_MEM_ALLOT */ + +#define POOL_CREATE(name, itmSize, align, initCnt, incrCnt, partId, options) \ + poolCreate(name, itmSize, align, initCnt, incrCnt, partId, options) +#define POOL_ITEM_GET(poolId) \ + poolItemGet(poolId) +#define POOL_ITEM_RETURN(poolId,pItem) \ + poolItemReturn(poolId, pItem) + +/* build poolLib.c and poolShow.c only in this case */ + +#define _BUILD_POOL_LIB + +/* Pool Block records */ + +typedef struct pool /* Pool structure */ + { + NODE poolNode; /* pool list for pond */ + const char * poolName; /* pool name */ + SEMAPHORE mutex; /* Mutex to use for thread-safe pools */ + ULONG sizItem; /* individual item size in bytes */ + ULONG sizItmReal; /* actual item size, due to alignment */ + ULONG alignment; /* individual item alignment in bytes */ + ULONG numIncr; /* nr. of incrementally allocated itm */ + ULONG numTotl; /* total number of items created */ + PART_ID partId; /* memory partition ID */ + ULONG options; /* pool options word */ + LIST blockList; /* allocated block list */ + LIST freeItems; /* free item list */ + } POOL; + +typedef struct pool_block + { + NODE blockNode; /* block node for pool */ + void * pItmBlk; /* ptr to start of item pool block */ + ULONG itemCnt; /* count of items in this block */ + } POOL_BLOCK; + +#endif /* INCLUDE_MEM_ALLOT */ + + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* INCpoolLibPh */ diff --git a/h/private/ppp/bacpstate.h b/h/private/ppp/bacpstate.h new file mode 100644 index 0000000..cabf296 --- /dev/null +++ b/h/private/ppp/bacpstate.h @@ -0,0 +1,154 @@ +/* bacpstate.h - state machine table of BACP */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,02feb01,sd created from routerware source base +*/ + +#ifndef __INCbacpstateh +#define __INCbacpstateh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "ppp/kstart.h" +#include "ppp/kppp.h" +#include "private/ppp/vpppstr.h" +#include "pfw/pfw.h" +#include "netBufLib.h" + +/* +*$Log:: /Rtrware/devdrvrs/ppp/vpppsta $ + * + * 7 10/01/98 11:43a Alex + * Updated the PPP source code to conform + * to a single build. + * + * 6 4/30/98 3:03p Alex + * Ppp v4.2.0 check in + * + * 1 4/24/98 12:10a Release Engineer + * code cleanup, code style changes, + * linted, system level test + * PPP v4.2.0 +*/ + +/*************************************************************************************************************** +IRC = initialize_counterss + +SCA = send_configuration_ack +SCJ = send_configuration_reject ?? +SCN = send_configuration_nak +SCR = send_configuration_request +SER = +STA = send_termination_ack +STR = send_termination_request + +TLS = this_layer_start +TLF = this_layer_finished +TLD = this_layer_down +TLU = this_layer_up + +RCR+ = received_configuration_request good +RCR- = received_configuration_request bad +TO+ = Time interval to send next request +TO- = Timeout has expired, prior to getting a response + +Up = layer below (MP) is up, start bringing up BACP protocol +Down = layer below (MP) is down, cleanup, and turn the timers off, wait for Up event +Open = initialize BACP +Close= release all resources and turn off timers, wait until next open + + + | State State + | 0 1 2 3 4 5 6 7 8 9 +Events| Initial Starting Closed Stopped Closing Stopping Req-Sent Ack-Rcvd Ack-Sent Opened +------+---------------------------------------------------------------------------------------------------- + Up | - - - - - - - - - - + Down | - - 0 tls/1 0 1 1 1 1 tld/1 + Open | - - irc,scr/6 3r 5r 5r 6 7 8 9r + Close| - - 2 2 4 4 irc,str/4 irc,str/4 irc,str/4 tld,irc,str/4 + | + TO+ | - - - - str/4 str/5 scr/6 scr/6 scr/8 - + TO- | - - - - tlf/2 tlf/3 tlf/3p tlf/3p tlf/3p - + | + RCR+ | - - sta/2 irc,scr,sca/8 4 5 sca/8 sca,tlu/9 sca/8 tld,scr,sca/8 + RCR- | - - sta/2 irc,scr,scn/6 4 5 scn/6 scn/7 scn/6 tld,scr,scn/6 + RCA | - - sta/2 sta/3 4 5 irc/7 scr/6x irc,tlu/9 tld,scr/6x + RCN | - - sta/2 sta/3 4 5 irc,scr/6 scr/6x irc,scr/8 tld,scr/6x + | + RTR | - - sta/2 sta/3 sta/4 sta/5 sta/6 sta/6 sta/6 tld,zrc,sta/5 + RTA | - - 2 3 tlf/2 tlf/3 6 6 8 tld,scr/6 + | + RUC | - - scj/2 scj/3 scj/4 scj/5 scj/6 scj/7 scj/8 scj/9 + RXJ+ | - - 2 3 4 5 6 6 8 9 + RXJ- | - - tlf/2 tlf/3 tlf/2 tlf/3 tlf/3 tlf/3 tlf/3 tld,irc,str/5 + | + RXR | - - 2 3 4 5 6 7 8 ser/9 + +***************************************************************************************************************/ + + +typedef void (*STATE_ACTION_FUNCTION)(PFW_PLUGIN_OBJ_STATE * pluginObjState, + M_BLK_ID pMblk, PPP_STATE end_state); + +typedef struct STATE_MACHINE_ACTION_TABLE + { + STATE_ACTION_FUNCTION set_ppp_state; + STATE_ACTION_FUNCTION null_state; + STATE_ACTION_FUNCTION this_layer_start; + STATE_ACTION_FUNCTION this_layer_finished; + STATE_ACTION_FUNCTION this_layer_up; + STATE_ACTION_FUNCTION this_layer_down; + STATE_ACTION_FUNCTION initialize_restart_counter; + STATE_ACTION_FUNCTION zero_restart_counter; + STATE_ACTION_FUNCTION send_configuration_request; + STATE_ACTION_FUNCTION send_configuration_ack; + STATE_ACTION_FUNCTION send_configuration_nak; + STATE_ACTION_FUNCTION send_configuration_reject; + STATE_ACTION_FUNCTION send_termination_request; + STATE_ACTION_FUNCTION send_termination_ack; + STATE_ACTION_FUNCTION send_code_reject; + }STATE_MACHINE_ACTION_TABLE; + +typedef struct BACP_CONTROL_PROTOCOL_STATE_DATA + { + BYTE_ENUM (PPP_STATE) state; + BYTE_ENUM (PPP_STATE) old_state; + + STATE_MACHINE_ACTION_TABLE * action_table; + } BACP_CONTROL_PROTOCOL_STATE_DATA; + +typedef struct BACP_STATE_MACHINE_TABLE + { + STATE_ACTION_FUNCTION fptr_state_function; + BYTE_ENUM (PPP_STATE) end_state; + + STATE_ACTION_FUNCTION fptr_state_function_1; + BYTE_ENUM (PPP_STATE) end_state_1; + + STATE_ACTION_FUNCTION fptr_state_function_2; + BYTE_ENUM (PPP_STATE) end_state_2; + } BACP_STATE_MACHINE_TABLE; + +extern void bacpSetState (PFW_PLUGIN_OBJ_STATE * pluginObjState, + M_BLK_ID pMblk, PPP_STATE end_state); +extern void bacpNullState (PFW_PLUGIN_OBJ_STATE * pluginObjState, + M_BLK_ID pMblk, PPP_STATE end_state); +extern void execute_bacp_state_machine (PFW_PLUGIN_OBJ_STATE * pluginState, + PPP_EVENT ppp_event, M_BLK_ID pMblk); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCbacpstateh */ diff --git a/h/private/ppp/bapsend.h b/h/private/ppp/bapsend.h new file mode 100644 index 0000000..6da1ff6 --- /dev/null +++ b/h/private/ppp/bapsend.h @@ -0,0 +1,65 @@ +/* bapsend.h - BAP protocol send header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02b,08oct01,as updated function prototypes for bap_send_call_response and + bap_create_callback_request to support + multiple phone delta option. +01a,01feb01,as created from routerware source +*/ + +#ifndef __INCbapsendh +#define __INCbapsendh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "pfw/pfw.h" + +/* function declarations */ + +/* Functions for sending BAP protocol packets */ + +extern TEST bap_send_call_response (PFW_PLUGIN_OBJ_STATE * pluginState, + BYTE id, char * reason_string, BYTE response_code, + BAP_LINK_TYPES link_type, USHORT link_speed, + SL_LIST * portList); + +extern TEST bap_send_callback_response (PFW_PLUGIN_OBJ_STATE * pluginState, + BYTE id, char * reason_string, BYTE response_code, + BAP_LINK_TYPES link_type, USHORT link_speed); + +extern TEST bap_send_link_drop_query_response + (PFW_PLUGIN_OBJ_STATE * pluginState, BYTE id, + char * reason_string, BYTE response_code); + +extern TEST bap_send_call_status_response + (PFW_PLUGIN_OBJ_STATE * pluginState, BYTE id, char * reason_string); + +extern TEST bap_send_call_status_indication (PFW_PLUGIN_OBJ_STATE * pluginState, + BYTE id, char * reason_string, PORT_CONNECTION_INFO * port_info); + + +/* Functions for creating BAP protocol packets */ + +extern BAP_BUFFER * bap_create_call_request (PFW_PLUGIN_OBJ_STATE * pluginState, + BYTE id, PORT_CONNECTION_INFO * port_info, char * reason_string); + +extern BAP_BUFFER * bap_create_callback_request + (PFW_PLUGIN_OBJ_STATE * pluginState, BYTE id, + SL_LIST * portList, char * reason_string, + BOOL callBackRequest); + +extern BAP_BUFFER * bap_create_link_drop_request + (PFW_PLUGIN_OBJ_STATE * pluginState, BYTE id, + PORT_CONNECTION_INFO * port_info, char * reason_string); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCbapsendh */ diff --git a/h/private/ppp/listutls.h b/h/private/ppp/listutls.h new file mode 100644 index 0000000..9fa35f4 --- /dev/null +++ b/h/private/ppp/listutls.h @@ -0,0 +1,43 @@ +/* listutls.h - option list manager */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,04oct99,sj derived from Routerware source base +*/ + +#ifndef __INClistutlsh +#define __INClistutlsh + +#ifdef __cplusplus +extern "C" { +#endif + +extern void add_entry_to_list ( LINK *sptr_link, LINK *sptr_link_to_add); +extern void *get_entry_from_list ( LINK *sptr_link); +extern void delete_entry_from_list ( LINK *sptr_list_link, + LINK *sptr_link_to_delete); + +extern void add_entry_to_front_of_list (LINK *sptr_link,LINK *sptr_link_to_add); +extern void insert_entry_in_list ( LINK *sptr_link, LINK *sptr_link_to_add, + LINK *sptr_link_after_which_to_add); + +extern void *get_pointer_to_first_entry_in_list ( LINK *sptr_link); +extern void *get_pointer_to_next_entry_in_list ( LINK *sptr_current_entry); +extern void *get_pointer_to_previous_entry_in_list ( LINK *sptr_current_entry); + +extern void free_list ( LINK *sptr_list, + void (*fptr_free) (void *vptr_data_to_free)); + +extern void *get_entry_from_list_using_index (LINK *sptr_list, + USHORT element_index_to_find); + +#ifdef __cplusplus +} +#endif + +#endif /* __INClistutlsh */ diff --git a/h/private/ppp/mpFramingLayerP.h b/h/private/ppp/mpFramingLayerP.h new file mode 100644 index 0000000..8b24d57 --- /dev/null +++ b/h/private/ppp/mpFramingLayerP.h @@ -0,0 +1,99 @@ +/* mpFramingLayerP.h - mpFraming layer component private header file */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01d,15may03,ijm include semLib.h +01c,30jan03,ijm fix for SPR# 86001, cannot re-establish bundle if peer reboots +01b,22oct02,ijm include mpP.h +01a,19feb01,ak created +*/ + +#ifndef __INCmpFramingLayerPh +#define __INCmpFramingLayerPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "ppp/mp.h" +#include "private/ppp/mpP.h" +#include "ppp/interfaces/lcpInterfaces.h" +#include "ppp/interfaces/mpFramingLayerInterfaces.h" +#include "semLib.h" + +/* MP_FRAMING_LAYER_COMPONENT structure */ + +typedef struct MP_FRAMING_LAYER + { + PFW_LAYER_OBJ layer; + USHORT no_of_bundles; + USHORT no_of_active_bundles; + USHORT no_of_ports; + RING_ID mpSendRing; + SEM_ID sendSem; + int mpSendQTaskId; + RING_ID mpReceiveRing; + SEM_ID receiveSem; + int mpReceiveQTaskId; + MP_BUNDLE_COUNT_TO_MANAGER_STACK_LOOKUP_CLASS + bundle_count_to_manager_stackObj_lookup [MAX_NO_OF_PPP_PORTS]; + + PFW_PLUGIN_OBJ_STATE *pMpFramingLayerState[MAX_NO_OF_PPP_PORTS]; + MP_BUNDLE_ASSIGNMENT_CLASS port_to_bundle_assignment[MAX_NO_OF_PPP_PORTS]; + MP_BUNDLE_MANAGEMENT_INTERFACE mpBundleManagementInterface; + MP_PACKET_RECEIVE_INTERFACE mpPacketReceiveInterface; + SEM_ID componentSem; + }MP_FRAMING_LAYER; + + +/* MP_FRAMING_LAYER_STACK_DATA structure */ + +typedef struct MP_FRAMING_LAYER_STACK_DATA + { + NET_POOL_ID netPoolId; + MP_BUNDLE_CLASS bundle; + UINT authMpInterfaceId; + BOOL bundle_state; + LCP_BUNDLE_PROFILE lcpBundleProfile; + PFW_EVENT_OBJ *pMpBundleOpenedEventObj; + PFW_EVENT_OBJ *pMpBundleClosedEventObj; + PFW_EVENT_OBJ *pMpMemberAddedEventObj; + PFW_EVENT_OBJ *pMpMemberDroppedEventObj; + PFW_EVENT_OBJ *pMpSubLayerDeadEventObj; + LCP_BUNDLE_OPTIONS_INTERFACE *pLcpBundleOptionsInterfaceObj; + PFW_INTERFACE_STATE_PAIR proxyLcpInterfaceStatePair; + + PFW_INTERFACE_STATE_PAIR + pppLinkStatusCounterIncrementInterfaceStatePair; + +#if 0 /* NOT SUPPORTED IN THIS RELEASE */ + LCP_MP_TIME_INTERFACE *pLcpMpLinkTimeInterfaceObj; +#endif + + LCP_PACKET_SEND_INTERFACE *pLcpPacketSendInterfaceObj; + PFW_PLUGIN_OBJ_CALLBACKS *callbacks; + } MP_FRAMING_LAYER_STACK_DATA; + + +/* MP_FRAMING_LAYER profile data structure */ + +typedef struct mpFramingLayerProfileData + { + ULONG mpFraming_smallPacketLength; + char mpFraming_localUserName[MAX_PROFILE_PARAM_LENGTH]; +/* ANVL */ + BOOL mpFraming_disableAuthOnBundle; +/* ANVL */ + + } MP_FRAMING_LAYER_PROFILE_DATA; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmpFramingLayerPh */ diff --git a/h/private/ppp/mpInterfaceLayerP.h b/h/private/ppp/mpInterfaceLayerP.h new file mode 100644 index 0000000..80daabe --- /dev/null +++ b/h/private/ppp/mpInterfaceLayerP.h @@ -0,0 +1,61 @@ +/* mpInterfaceLayerP.h - mpInterface layer component private header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,18dec01,ak support for dynamic assignment of MP Member Stack to Manager + Stack + +01a,19feb01,ak created +*/ + +#ifndef __INCmpInterfaceLayerPh +#define __INCmpInterfaceLayerPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "ppp/pppInterfaces.h" + +/* MP_INTERFACE_LAYER component data structure */ + +typedef struct MP_INTERFACE_LAYER_COMPONENT + { + PFW_LAYER_OBJ layer; + } MP_INTERFACE_LAYER_COMPONENT; + +/* MP_INTERFACE_LAYER stack data structure */ + +typedef struct mpInterfaceLayerStackData + { + PFW_PLUGIN_OBJ_CALLBACKS *callbacks; + PFW_STACK_OBJ *pManagerStackObj; + PFW_INTERFACE_STATE_PAIR lcpPacketSendInterfaceStatePair; + PFW_INTERFACE_STATE_PAIR mpControlLayerInterfaceStatePair; + PFW_INTERFACE_STATE_PAIR lcpNegotiatedAuthProtocolInterfaceStatePair; + PFW_INTERFACE_STATE_PAIR mpBundleManagementInterfaceStatePair; + PFW_INTERFACE_STATE_PAIR mpPacketRcvInterfaceStatePair; + UINT authMpInterfaceId; + MP_UPCALL_FUNCTIONS *mpUpCalls; + void *userHandler; + } MP_INTERFACE_LAYER_STACK_DATA; + +/* MP_INTERFACE_LAYER profile data structure */ + +typedef struct mpInterfaceLayerProfileData + { + PFW_STACK_OBJ *mpInterface_managerStackId; + ULONG mpInterface_memberLinkSpeed; + } MP_INTERFACE_LAYER_PROFILE_DATA; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmpInterfaceLayerPh */ + diff --git a/h/private/ppp/mpP.h b/h/private/ppp/mpP.h new file mode 100644 index 0000000..471bdea8 --- /dev/null +++ b/h/private/ppp/mpP.h @@ -0,0 +1,337 @@ +/* mpP.h - MP header file */ + +/* Copyright 2002 - 2004 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01c,12aug04,ijm updated bitfields for new diab compiler, SPR#95672 +01b,22oct02,ijm removed redundant MP_PROFILE_STRING_SIZE. + Use MAX_VALUE_STRING_LENGTH defined in pfwProfile.h instead. +01a,22oct02,ijm created by breaking up target/h/ppp/mp.h into two. +*/ + +#ifndef __INCmpPh +#define __INCmpPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" +#include "sllLib.h" +#include "pfw/pfw.h" +#include "pfw/pfwStack.h" +#include "pfw/pfwComponent.h" +#include "pfw/pfwLayer.h" +#include "pfw/pfwTable.h" +#include "pfw/pfwEvent.h" +#include "pfw/pfwMemory.h" +#include "pfw/pfwInterface.h" +#include "rngLib.h" +#include "private/ppp/vpppstr.h" +#include "ppp/kppp.h" + + +/* defines */ + +#define NULL_STRING "" +#define MAX_PROFILE_PARAM_LENGTH 512 +#define NOT_A_MP_LINK 1 +#define MAX_CLUSTER_SIZE 2048 + +#ifndef MAX_NO_OF_PPP_PORTS +#define MAX_NO_OF_PPP_PORTS 30 +#define PPP_WITH_MAC_HEADER_LENGTH 14 +#endif + + +#define MAXIMUM_NUMBER_OF_PENDING_FRAGMENTS 10000 + +#ifndef VARIABLE_NUMBER_OF_BYTES +#define VARIABLE_NUMBER_OF_BYTES 1 +#endif + +#define MAX_MRRU_LENGTH 4 +#define MP_SMALL_PACKET_LENGTH 200 +#define NUMBER_OF_BITS_IN_A_BYTE 8 + + +/* Bundle Identifier structures */ + + +typedef struct LCP_BUNDLE_PROFILE + { + ULONG localMRRU; + ULONG remoteMRRU; + BOOL use_short_sequence_number_in_local_end; + BOOL use_short_sequence_number_in_remote_end; + BYTE local_station_discriminator [MAX_PROFILE_PARAM_LENGTH]; + BYTE remote_station_discriminator [MAX_PROFILE_PARAM_LENGTH]; + USHORT localAuthProtocol; + USHORT remoteAuthProtocol; + char localUserName[NAME_SIZE]; + }LCP_BUNDLE_PROFILE; + +typedef struct MP_BUNDLE_ASSIGNMENT_CLASS + { + BOOL is_port_assigned_to_a_bundle; + PFW_STACK_OBJ *pManagerStackObj; + PFW_STACK_OBJ *pMemberStackObj; + BOOL port_used_in_sending_end; + BOOL port_used_in_receiving_end; + } MP_BUNDLE_ASSIGNMENT_CLASS; + +typedef struct MP_BUNDLE_COUNT_TO_MANAGER_STACK_LOOKUP_CLASS + { + PFW_STACK_OBJ *pManagerStackObj; + } MP_BUNDLE_COUNT_TO_MANAGER_STACK_LOOKUP_CLASS; + +typedef struct MP_PORT_CLASS + { + ULONG speed; + PFW_STACK_OBJ *pMemberStackObj; + LCP_BUNDLE_OPTIONS *pLcpBundleOptions; + } MP_PORT_CLASS; + +enum FRAGMENT_FLAG + { + FIRST_FRAGMENT, + LAST_FRAGMENT, + NOT_END_FRAGMENT, + ONLY_FRAGMENT /* it is both the first and last fragment */ + }; + +enum FLAG_TYPE + { + MP_OFF, + MP_ON + }; + +/* Receiving end structures */ + +typedef struct MP_FRAGMENT_CLASS + { + struct MP_FRAGMENT_CLASS *next; + ULONG sequence_number; + enum FRAGMENT_FLAG fragment_flag; + M_BLK_ID mblk_fragment; + USHORT length; + ULONG indexInList; + } MP_FRAGMENT_CLASS; + +typedef struct MP_BUNDLE_RECEIVING_END_LINK_CLASS + { + PFW_STACK_OBJ *pMemberStackObj; + ULONG most_recently_received_sequence_number; + BOOL link_has_been_timed; + BOOL mp_is_timing_the_link; + ULONG clock_ticks_when_timer_starts; + double delay; + USHORT localMRU; + } MP_BUNDLE_RECEIVING_END_LINK_CLASS; + +typedef struct MP_BUNDLE_RECEIVING_END_BUFFER_CLASS + { + SL_LIST ppp_fragments; + USHORT number_of_ppp_fragments_buffered; + USHORT number_of_beginning_fragments_buffered; + USHORT number_of_ending_fragments_buffered; + BOOL receiver_is_resynchronizing; + ULONG M; + BOOL size_estimated; + ULONG estimated_size; + } MP_BUNDLE_RECEIVING_END_BUFFER_CLASS; + +typedef struct MP_BUNDLE_RECEIVING_END_CLASS + { + USHORT no_of_links; + BOOL use_short_sequence_number; + ULONG localMRRU; + MP_BUNDLE_RECEIVING_END_LINK_CLASS links[MAX_NO_OF_PPP_PORTS]; + MP_BUNDLE_RECEIVING_END_BUFFER_CLASS buffer; + M_BLK_ID pMblkId; + } MP_BUNDLE_RECEIVING_END_CLASS; + +/* Sending end structures */ + +typedef struct MP_BUNDLE_SENDING_END_LINK_CLASS + { + PFW_STACK_OBJ *pMemberStackObj; + PFW_PLUGIN_OBJ_STATE *pMpInterfaceLayerState; + PFW_PLUGIN_OBJ_STATE *pMpControlLayerState; + ULONG remoteMru; + } MP_BUNDLE_SENDING_END_LINK_CLASS; + +typedef struct MP_BUNDLE_SENDING_END_CLASS + { + USHORT no_of_links; + BOOL use_short_sequence_number; + ULONG remoteMRRU; + MP_BUNDLE_SENDING_END_LINK_CLASS links [MAX_NO_OF_PPP_PORTS]; + ULONG total_bandwidth; + + double bandwidth_share + [MAX_NO_OF_PPP_PORTS]; + double mru_share + [MAX_NO_OF_PPP_PORTS]; + + USHORT small_packet_length; + unsigned int master_short_sequence_number : 12; + unsigned int master_long_sequence_number : 24; + USHORT linkForNonFragmentedPacket; + UINT aggregateMru; +} MP_BUNDLE_SENDING_END_CLASS; + +/* Bundle Class Structures */ + +typedef struct MP_BUNDLE_CLASS + { + USHORT no_of_links; + MP_PORT_CLASS memberLinks [MAX_NO_OF_PPP_PORTS]; + MP_BUNDLE_RECEIVING_END_CLASS receiving_end; + MP_BUNDLE_SENDING_END_CLASS sending_end; + MP_BUNDLE_IDENTIFIER id; + } MP_BUNDLE_CLASS; + + +typedef struct MP_LINK_INFO + { + PFW_STACK_OBJ *pLinkStackObj; + USHORT local_link_discriminator; + USHORT remote_link_discriminator; + USHORT port_speed; + } MP_LINK_INFO; + +typedef struct MP_LINK_INFO_ITEM + { + struct MP_LINK_INFO_ITEM *pNext; + MP_LINK_INFO mpLinkInfo; + } MP_LINK_INFO_ITEM; + +/* MP components related event data structures */ + +typedef struct MP_MEMBER_ADDED_EVENT_DATA + { + MP_LINK_INFO *pMpLinkInfo; + } MP_MEMBER_ADDED_EVENT_DATA; + +typedef struct MP_BUNDLE_OPENED_EVENT_DATA + { + ULONG localMRRU; + ULONG remoteMRRU; + } MP_BUNDLE_OPENED_EVENT_DATA; + + +/* MULTILINK_PACKET related structures */ + +typedef struct LONG_SEQUENCE_NUMBER_MP_HEADER + { + +/*#if defined (BIG_ENDIAN)*/ +#if (_BYTE_ORDER == _BIG_ENDIAN) /* TESTING */ + + + unsigned int first_fragment_flag : 1; + unsigned int last_fragment_flag : 1; + unsigned int reserved_field : 6; + unsigned int sequence_number : 24; + +#else + + unsigned int sequence_number : 24; + unsigned int reserved_field : 6; + unsigned int last_fragment_flag : 1; + unsigned int first_fragment_flag : 1; + +#endif + }_WRS_PACK_ALIGN(1) LONG_SEQUENCE_NUMBER_MP_HEADER; + +typedef struct SHORT_SEQUENCE_NUMBER_MP_HEADER + { +/*#if defined (BIG_ENDIAN)*/ +#if (_BYTE_ORDER == _BIG_ENDIAN) /* TESTING */ + + unsigned int first_fragment_flag : 1; + unsigned int last_fragment_flag : 1; + unsigned int reserved_field : 2; + unsigned int sequence_number : 12; + +#else + unsigned int sequence_number : 12; + unsigned int reserved_field : 2; + unsigned int last_fragment_flag : 1; + unsigned int first_fragment_flag : 1; + +#endif + }_WRS_PACK_ALIGN(1) SHORT_SEQUENCE_NUMBER_MP_HEADER; + +typedef struct MP_PACKET_WITH_LONG_SEQUENCE_NUMBER + { + LONG_SEQUENCE_NUMBER_MP_HEADER header; + BYTE data [VARIABLE_NUMBER_OF_BYTES]; + } __attribute__((__packed__)) + MP_PACKET_WITH_LONG_SEQUENCE_NUMBER; + +typedef struct MP_PACKET_WITH_SHORT_SEQUENCE_NUMBER + { + SHORT_SEQUENCE_NUMBER_MP_HEADER header; + BYTE data [VARIABLE_NUMBER_OF_BYTES]; + }__attribute__((__packed__)) + MP_PACKET_WITH_SHORT_SEQUENCE_NUMBER; + +typedef union UNION_MP_PACKET + { + MP_PACKET_WITH_LONG_SEQUENCE_NUMBER mp_packet_with_long_sequence_number; + MP_PACKET_WITH_SHORT_SEQUENCE_NUMBER mp_packet_with_short_sequence_number; + } UNION_MP_PACKET; + +typedef struct PPP_MP_PACKET + { + PPP_HEADER header; + char protocol_data[VARIABLE_NUMBER_OF_BYTES]; + }__attribute__((__packed__)) + PPP_MP_PACKET; + + +/* Miscellaneous structures */ + +typedef struct mpJobRingItem + { + UINT size; + FUNCPTR jobHandlerFunc; + } MP_JOB_RING_ITEM; + +/* MP Send Queue interface structure */ + +typedef struct mpSendInterface + { + PFW_PLUGIN_OBJ_STATE *state; + M_BLK_ID packet; + }MP_SEND_INTERFACE; + + +typedef struct + { + PFW_PLUGIN_OBJ_STATE * pMemberState; + M_BLK_ID pPacket; + }MP_RECEIVE_DATA; + +typedef enum + { + LOCAL_END_AUTH_PHASE = 0x00, + REMOTE_END_AUTH_PHASE = 0x01 + }AUTH_PHASE; + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmpPh */ + + diff --git a/h/private/ppp/pppBacpComponentP.h b/h/private/ppp/pppBacpComponentP.h new file mode 100644 index 0000000..23637f3 --- /dev/null +++ b/h/private/ppp/pppBacpComponentP.h @@ -0,0 +1,221 @@ +/* pppBacpComponentP.h - BACP component private header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,11feb02,ak code changes as part of memory reduction process +01a,01feb01,sd created +*/ + +#ifndef __INCpppBacpComponentPh +#define __INCpppBacpComponentPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "tickLib.h" +#include "logLib.h" +#include "errnoLib.h" +#include "stdio.h" +#include "stdlib.h" +#include "string.h" +#include "ctype.h" +#include "memLib.h" +#include "netBufLib.h" +#include "pfw/pfw.h" +#include "pfw/pfwStack.h" +#include "pfw/pfwProfile.h" +#include "pfw/pfwComponent.h" +#include "pfw/pfwLayer.h" +#include "pfw/pfwEvent.h" +#include "pfw/pfwTimer.h" +#include "pfw/pfwMemory.h" +#include "pfw/pfwInterface.h" +#include "private/ppp/vpppstr.h" +#include "private/ppp/vbacpstr.h" +#include "private/ppp/vbapstr.h" +#include "private/ppp/bacpstate.h" +#include "ppp/interfaces/pppControlProtocolInterface.h" +#include "ppp/interfaces/pppControlLayerInterface.h" +#include "ppp/interfaces/lcpInterfaces.h" +#include "ppp/interfaces/componentAcceptableProtocolsInterface.h" +#include "ppp/interfaces/mpFramingLayerInterfaces.h" +#include "ppp/bacpInterfaces.h" +#include "private/ppp/vbacputil.h" + +typedef struct bacpOption + { + char name[PFW_MAX_NAME_LENGTH]; + BYTE_ENUM(BACP_OPTION_TYPE) optionType; + char optionTypeString[16]; + } BACP_CONFIG_OPTION; + +/* Component data per instance; one per pfw */ + +typedef struct pppBacpComponent + { + PFW_COMPONENT_OBJ component; + FPTR_BACP_PACKET_RECEIVED * fptr_bacp_packet_received; + CONTROL_PROTOCOL_INTERFACE bacpControlInterface; + COMPONENT_ACCEPTABLE_PROTOCOLS_INTERFACE + bacpComponentAcceptableProtocolsInterface; + FPTR_BAP_PACKET_RECEIVED * fptr_bap_packet_received; + BACP_CONFIG_OPTION option[NUMBER_OF_BACP_OPTIONS + 1]; + } PPP_BACP_COMPONENT; + +/* BACP Component configuration option */ + +typedef struct LINK_QUALITY_COUNTERS + { + ULONG OutLQRs; + ULONG InLQRs; + ULONG InGoodOctets; + ULONG ifInOctets; + ULONG ifInErrors; + ULONG ifInDiscards; + ULONG ifOutOctets; + ULONG ifOutUniPackets; + ULONG ifInUniPackets; + } LINK_QUALITY_COUNTERS; + +typedef struct alternateStrings + { + struct alternateStrings * next; + UINT32 preference; /* key for this ordered list */ + char configString[1]; + }ALTERNATE_OPTION_STRING; + +typedef struct bacpConfigStrings + { + char *configString; + ALTERNATE_OPTION_STRING *localAlternateConfigString; + ALTERNATE_OPTION_STRING *remoteAlternateConfigString; + char *remoteConfigString; + } BACP_CONFIG_STRINGS; + + +/* component profile data structure */ + +typedef struct bacpProfileData + { + BACP_CONFIG_STRINGS * bacpConfigStrings; + ULONG maximum_number_of_bacp_configuration_requests; + ULONG maximum_number_of_bacp_termination_requests; + ULONG maximum_number_of_configuration_failures; + ULONG maximum_bacp_configuration_request_send_interval; + ULONG maximum_bacp_termination_request_send_interval; + ULONG maximum_bacp_configuration_request_backoff_interval; + ULONG maximum_number_of_bap_call_requests; + ULONG maximum_bap_call_request_send_interval; + ULONG maximum_number_of_bap_callback_requests; + ULONG maximum_bap_callback_request_send_interval; + ULONG maximum_number_of_bap_linkdrop_requests; + ULONG maximum_bap_linkdrop_request_send_interval; + ULONG maximum_number_of_bap_status_indications; + ULONG maximum_bap_status_indication_send_interval; + struct bacpStackData * stackData; + }BACP_PROFILE_DATA; + + +/* component stack data structure */ + +typedef struct bacpStackData + { + BACP_CONTROL_PROTOCOL_STATE_DATA stateData; + NET_POOL_ID netPoolId; + PPP_CONTROL_LAYER_INTERFACE * controlLayerInterface; + LCP_PACKET_SEND_INTERFACE *lcpPacketSendInterface; + PFW_INTERFACE_STATE_PAIR mpBundleManagementInterface; + PFW_EVENT_OBJ * bacpUpEventObj; + PFW_EVENT_OBJ * bacpDownEventObj; + PFW_EVENT_OBJ * mpLinkUpEventObj; + PFW_EVENT_OBJ * mpLinkDownEventObj; + PFW_EVENT_OBJ * mpBundleCloseEventObj; + PFW_EVENT_OBJ * mpBundleOpenEventObj; + PFW_TIMER_OBJ * retryTimer; + PFW_TIMER_OBJ * callRequestRetryTimer; + PFW_TIMER_OBJ * callbackRequestRetryTimer; + PFW_TIMER_OBJ * indicationRetryTimer; + PFW_TIMER_OBJ * dropRequestRetryTimer; + BYTE_ENUM (BOOLEAN) favored_peer_is_me; + ULONG local_favored_peer_id; + ULONG remote_favored_peer_id; + ULONG bundleLocalMRRU; + ULONG bundleRemoteMRRU; + OPTION_LISTS option_lists; + LINK_QUALITY_COUNTERS link_quality_counters; + BYTE id_sequence_number; + /* BACP sequence number */ + BYTE last_id_of_bacp_packet_sent; + BYTE last_bap_id; + /* BAP sequence number */ + BYTE last_remote_bap_id; + USHORT number_of_configuration_requests; + USHORT number_of_termination_requests; + USHORT number_of_configuration_naks; + M_BLK_ID last_txed_bacp_configuration_request_packet; + USHORT length_of_last_txed_bacp_packet; + M_BLK_ID last_rxed_bacp_configuration_request_packet; + M_BLK_ID last_rxed_bacp_termination_request_packet; + USHORT number_of_bap_call_requests; + USHORT number_of_bap_callback_requests; + USHORT number_of_bap_linkdrop_requests; + USHORT number_of_bap_status_indications; + PFW_PLUGIN_OBJ_CALLBACKS * callbacks; + BACP_UPCALL_FUNCTIONS * bacpUpcall; + BAP_ACTIVE_PORT_LINK active_port_queue; + BAP_BUFFER_LINK call_request_send_queue; + BAP_BUFFER_LINK callback_request_send_queue; + BAP_BUFFER_LINK call_indication_send_queue; + BAP_BUFFER_LINK link_drop_request_send_queue; + BOOLEAN configuration_request_backoff_period_started; + PPP_BACP_STATISTICS bacp_statistics; + PPP_BAP_STATISTICS bap_statistics; + } BACP_STACK_DATA; + + +typedef struct MEMBER_LINK_INFO + { + PFW_STACK_OBJ *pLinkStackObj; + USHORT local_link_discriminator; + USHORT remote_link_discriminator; + USHORT port_speed; + } MEMBER_LINK_INFO; + +typedef struct MEMBER_LINK_INFO_ITEM + { + struct MEMBER_LINK_INFO_ITEM *pNext; + MEMBER_LINK_INFO mpLinkInfo; + } MEMBER_LINK_INFO_ITEM; + +typedef struct MP_BUNDLE_INFO + { + ULONG localMRRU; + ULONG remoteMRRU; + } MP_BUNDLE_INFO; + +/* pppbacprx.c */ + +void bacpSetReceiveFunctions ( PPP_BACP_COMPONENT * bacpComponent); + +/* pppbaprx.c */ + +void bapSetReceiveFunctions ( PPP_BACP_COMPONENT * bacpComponent); + +/* pppbacptx.c */ + +void bacpSetSendActionFunctions ( STATE_MACHINE_ACTION_TABLE * actionTable); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppBacpComponentPh */ + diff --git a/h/private/ppp/pppIpState.h b/h/private/ppp/pppIpState.h new file mode 100644 index 0000000..612739f --- /dev/null +++ b/h/private/ppp/pppIpState.h @@ -0,0 +1,145 @@ +/* pppIpState.h - header file for state machine functions for PPP + Network control protocol(IPCP and IPV6CP) */ + +/* Copyright 2002 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,12jun02,vk derived from pppIpcpComponent.c and pppIpv6cpComponent.c files +*/ + +/* +DESCRIPTION + +This file contains the function declarations for the pppIpStateMachineFunction.c file + +*/ + +#ifndef __INCpppIpStateh +#define __INCpppIpStateh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "logLib.h" +#include "errnoLib.h" +#include "stdio.h" +#include "stdlib.h" +#include "string.h" +#include "ctype.h" +#include "memLib.h" +#include "inetLib.h" +#include "netBufLib.h" +#include "pfw/pfw.h" +#include "pfw/pfwStack.h" +#include "pfw/pfwProfile.h" +#include "pfw/pfwComponent.h" +#include "pfw/pfwLayer.h" +#include "pfw/pfwEvent.h" +#include "pfw/pfwTimer.h" +#include "ppp/kstart.h" +#include "ppp/kppp.h" +#include "private/ppp/pppstate.h" +#include "private/ppp/vnipstr.h" +#include "private/ppp/vpppstr.h" +#include "private/ppp/vlcpstr.h" +#include "private/ppp/vncpstr.h" +#include "ppp/interfaces/pppControlLayerInterface.h" +#include "ppp/interfaces/pppControlProtocolInterface.h" + + + +/* IPCP state machine table function definition */ + +void ipcp_set_ppp_state + ( + PFW_PLUGIN_OBJ_STATE * pPfwPlugingObjState, + M_BLK_ID pMblk, + PPP_STATE pppEndState + ); + +void ipcp_this_layer_up + ( + PFW_PLUGIN_OBJ_STATE * pPfwPlugingObjState, + M_BLK_ID pMblk, + PPP_STATE pppEndState + ); + +void ipcp_this_layer_down + ( + PFW_PLUGIN_OBJ_STATE * pPfwPlugingObjState, + M_BLK_ID pMblk, + PPP_STATE pppEndState + ); + + + +/* IPV6CP state machine table function definition */ + +void ipv6cp_set_ppp_state + ( + PFW_PLUGIN_OBJ_STATE * pPfwPlugingObjState, + M_BLK_ID pMblk, + PPP_STATE pppEndState + ); + +void ipv6cp_this_layer_up + ( + PFW_PLUGIN_OBJ_STATE * pPfwPlugingObjState, + M_BLK_ID pMblk, + PPP_STATE pppEndState + ); + +void ipv6cp_this_layer_down + ( + PFW_PLUGIN_OBJ_STATE * pPfwPlugingObjState, + M_BLK_ID pMblk, + PPP_STATE pppEndState + ); + + +/* Common state machine functions for both IPCP and IPV6CP */ + +void ipcp_this_layer_start + ( + PFW_PLUGIN_OBJ_STATE * pPfwPlugingObjState, + M_BLK_ID pMblk, + PPP_STATE pppEndState + ); + +void ipcp_this_layer_finished + ( + PFW_PLUGIN_OBJ_STATE * pPfwPlugingObjState, + M_BLK_ID pMblk, + PPP_STATE pppEndState + ); + +void ipcp_initialize_restart_counter + ( + PFW_PLUGIN_OBJ_STATE * pPfwPlugingObjState, + M_BLK_ID pMblk, + PPP_STATE pppEndState + ); + +void ipcp_zero_restart_counter + ( + PFW_PLUGIN_OBJ_STATE * pPfwPlugingObjState, + M_BLK_ID pMblk, + PPP_STATE pppEndState + ); + +void ipcp_null_state + ( + PFW_PLUGIN_OBJ_STATE * pPfwPlugingObjState, + M_BLK_ID pMblk, + PPP_STATE pppEndState + ); + + +#endif /* __INCpppIpStateh */ + diff --git a/h/private/ppp/pppIpcpComponentP.h b/h/private/ppp/pppIpcpComponentP.h new file mode 100644 index 0000000..b618b6d --- /dev/null +++ b/h/private/ppp/pppIpcpComponentP.h @@ -0,0 +1,171 @@ +/* pppIpcpComponentP.h - Private IPCP component header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01h,22may02,vk modified component, stack and profile strcuture for code + code reusability with IPCP and IPV6CP +01g,30jan02,ak modified option list structures as per the memory reduction + recommendations +01f,03nov01,ijm added maximum_number_of_configuration_failures + to IPCP_PROFILE_DATA +01e,29sep00,sj merging with TOR2_0-WINDNET_PPP-CUM_PATCH_2 +01d,19may00,qli add a new field in ipcpProfileData, + a reference to stack data +01c,10feb00,sj options array should be +1 number of IPCP options +01b,09feb00sj added PPP_IPCP_MIB_INTERFACE + clean up +01a,07nov99,sgv derived from target/h/ppp/pppIpcpComponent.h +*/ + +#ifndef __INCpppIpcpComponentPh +#define __INCpppIpcpComponentPh + +#include "vxWorks.h" +#include "logLib.h" +#include "errnoLib.h" +#include "stdio.h" +#include "stdlib.h" +#include "string.h" +#include "ctype.h" +#include "memLib.h" +#include "netBufLib.h" +#include "sockLib.h" +#include "netinet/in.h" +#include "arpa/inet.h" +#include "pfw/pfw.h" +#include "pfw/pfwStack.h" +#include "pfw/pfwProfile.h" +#include "pfw/pfwComponent.h" +#include "pfw/pfwLayer.h" +#include "pfw/pfwEvent.h" +#include "pfw/pfwTimer.h" +#include "pfw/pfwMemory.h" +#include "pfw/pfwInterface.h" +#include "ppp/kstart.h" +#include "ppp/kppp.h" +#include "private/ppp/vpppstr.h" +#include "private/ppp/vnipstr.h" +#include "private/ppp/vlcpstr.h" +#include "private/ppp/vncpstr.h" +#include "private/ppp/pppstate.h" +#include "private/ppp/pppoptn.h" +#include "ppp/interfaces/pppControlLayerInterface.h" +#include "ppp/interfaces/pppControlProtocolInterface.h" +#include "ppp/interfaces/pppIpInterfaces.h" +#include "ppp/interfaces/ipcpInterfaces.h" +#include "ppp/interfaces/pppVjcInterfaces.h" +#include "private/ppp/pppNcpLibP.h" +#include "private/ppp/pppNcpComponentP.h" + + +/* defines */ +/* + * Inline versions of get/put char/short/long. + * Pointer is advanced; we assume that both arguments + * are lvalues and will already be in registers. + * cp MUST be u_char *. + */ +#define GETCHAR(c, cp) { \ + (c) = *(cp)++; \ +} +#define PUTCHAR(c, cp) { \ + *(cp)++ = (u_char) (c); \ +} + +#define GETSHORT(s, cp) { \ + register u_char *t_cp = (u_char *)(cp); \ + (s) = ((uint16_t)t_cp[0] << 8) \ + | ((uint16_t)t_cp[1]) ;\ + (cp) += sizeof(uint16_t); \ +} + +#if 0 +#define GETSHORT(s, cp) { \ + (s) = *(cp)++ << 8; \ + (s) |= *(cp)++; \ +} +#define PUTSHORT(s, cp) { \ + *(cp)++ = (u_char) ((s) >> 8); \ + *(cp)++ = (u_char) (s); \ +} + +#define GETLONG(l, cp) { \ + (l) = *(cp)++ << 8; \ + (l) |= *(cp)++; (l) <<= 8; \ + (l) |= *(cp)++; (l) <<= 8; \ + (l) |= *(cp)++; \ +} +#define PUTLONG(l, cp) { \ + *(cp)++ = (u_char) ((l) >> 24); \ + *(cp)++ = (u_char) ((l) >> 16); \ + *(cp)++ = (u_char) ((l) >> 8); \ + *(cp)++ = (u_char) ((l)); \ +} +#endif + +#define IPCP_PACKET_HEADER_SIZE sizeof(NCP_HEADER) + +#define REMOTE_STRING + +typedef struct ipcpOption + { + char name[PFW_MAX_NAME_LENGTH]; + BYTE_ENUM(IPCP_OPTION_TYPE) optionType; + char optionTypeString[16]; + } IPCP_CONFIG_OPTION; + +/* Component data per instance; one per pfw */ + +typedef struct pppIpcpComponent + { + PPP_NCP_COMPONENT pppNcpComponent; + CONTROL_PROTOCOL_INTERFACE ipcpControlInterface; + PPP_IPCP_MIB_INTERFACE ipcpMibStatusEntry; + IPCP_CONFIG_OPTION option[NUMBER_OF_IPCP_OPTIONS+1]; + } PPP_IPCP_COMPONENT; + +typedef struct alternateStrings + { + struct alternateStrings * next; + char configString[1]; + }ALTERNATE_OPTION_STRING; + +typedef struct ipcpConfigStrings + { + char * configString; + ALTERNATE_OPTION_STRING * alternateConfigString; + char * remoteConfigString; + } IPCP_CONFIG_STRINGS; + +/* IPCP configuration option types */ + +typedef struct ipcpStackData + { + NCP_STACK_DATA stackData; + PFW_INTERFACE_STATE_PAIR pppIpInterface; + PFW_INTERFACE_STATE_PAIR pppHCInterface; + BOOL hcConfigured; + PPP_IPCP_MIBS ipcp_mibs; + char localAddr[INET_ADDR_LEN]; + char remoteAddr[INET_ADDR_LEN]; + char primaryDnsAddr[INET_ADDR_LEN]; + char secondaryDnsAddr[INET_ADDR_LEN]; + BOOLEAN useRasAddress; + BOOLEAN validRasAddress; + USHORT compressionProtocolId; + } IPCP_STACK_DATA; + + +typedef struct ipcpProfileData + { + NCP_PROFILE_DATA ncpProfileData; + IPCP_CONFIG_STRINGS * pIpcpConfigStrings; + IPCP_STACK_DATA * pIpcpStackData; + } IPCP_PROFILE_DATA; + +#endif /* __INCpppipcpComponentPh */ + diff --git a/h/private/ppp/pppIpv6cpComponentP.h b/h/private/ppp/pppIpv6cpComponentP.h new file mode 100644 index 0000000..b652ad8 --- /dev/null +++ b/h/private/ppp/pppIpv6cpComponentP.h @@ -0,0 +1,112 @@ +/* pppIpv6cpComponentP.h - Private IPV6CP component header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01c,17jul02,ijm added INTERFACE_ADDRESS_LENGTH +01b,08jul02,as Added two new variables in IPV6CP_STACK_DATA +01a,22may02,vk derived from target/h/ppp/pppIpcpComponentP.h +*/ + +#ifndef __INCpppIpv6cpComponentPh +#define __INCpppIpv6cpComponentPh + +#include "vxWorks.h" +#include "logLib.h" +#include "errnoLib.h" +#include "stdio.h" +#include "stdlib.h" +#include "string.h" +#include "ctype.h" +#include "memLib.h" +#include "netBufLib.h" +#include "sockLib.h" +#include "netinet/in.h" +#include "arpa/inet.h" +#include "pfw/pfw.h" +#include "pfw/pfwStack.h" +#include "pfw/pfwProfile.h" +#include "pfw/pfwComponent.h" +#include "pfw/pfwLayer.h" +#include "pfw/pfwEvent.h" +#include "pfw/pfwTimer.h" +#include "pfw/pfwMemory.h" +#include "pfw/pfwInterface.h" +#include "ppp/kstart.h" +#include "ppp/kppp.h" +#include "private/ppp/vpppstr.h" +#include "private/ppp/vnipstr.h" +#include "private/ppp/vlcpstr.h" +#include "private/ppp/vncpstr.h" +#include "private/ppp/pppstate.h" +#include "private/ppp/pppoptn.h" +#include "ppp/interfaces/pppControlLayerInterface.h" +#include "ppp/interfaces/pppControlProtocolInterface.h" +#include "private/ppp/pppNcpLibP.h" +#include "private/ppp/pppIpcpComponentP.h" + +#define IPV6CP_PACKET_HEADER_SIZE sizeof(NCP_HEADER) +#define INTERFACE_IDENTIFIER_LENGTH 8 +#define INTERFACE_ADDRESS_LENGTH 46 /* + * same as INET6_ADDR_LEN which + * is defined only in ipv6 stack. + * This definition is added + * to allow compilation in non-ipv6 + * stacks. + */ + +#define REMOTE_STRING + +typedef struct ipv6cpOption + { + char name[PFW_MAX_NAME_LENGTH]; + BYTE_ENUM(IPV6CP_OPTION_TYPE) optionType; + char optionTypeString[16]; + } IPV6CP_CONFIG_OPTION; + +typedef struct ipv6cpConfigStrings + { + char * configString; + ALTERNATE_OPTION_STRING * alternateConfigString; + char * remoteConfigString; + } IPV6CP_CONFIG_STRINGS; + +/* Component data per instance; one per pfw */ + +typedef struct ipv6cpStackData + { + NCP_STACK_DATA stackData; + PFW_INTERFACE_STATE_PAIR pppIpv6Interface; + PFW_INTERFACE_STATE_PAIR pppHCInterface; + USHORT hcProtocolId; + BOOL headerCompressionNegotiated; + char localAddr [INTERFACE_ADDRESS_LENGTH]; + char remoteAddr [INTERFACE_ADDRESS_LENGTH]; + char lastSentNakIdentifier [INTERFACE_IDENTIFIER_LENGTH]; + BOOL previousNakSent; + } IPV6CP_STACK_DATA; + + +typedef struct pppIpv6cpComponent + { + PPP_NCP_COMPONENT pppNcpComponent; + CONTROL_PROTOCOL_INTERFACE ipv6cpControlInterface; + IPV6CP_CONFIG_OPTION option[NUMBER_OF_IPV6CP_OPTIONS+1]; + } PPP_IPV6CP_COMPONENT; + + +typedef struct ipv6cpProfileData + { + NCP_PROFILE_DATA ncpProfileData; + IPV6CP_CONFIG_STRINGS * pIpv6cpConfigStrings; + IPV6CP_STACK_DATA * pIpv6cpStackData; + } IPV6CP_PROFILE_DATA; + + + +#endif /* __INCpppipv6cpComponentPh */ + diff --git a/h/private/ppp/pppLcpComponentP.h b/h/private/ppp/pppLcpComponentP.h new file mode 100644 index 0000000..f31885e --- /dev/null +++ b/h/private/ppp/pppLcpComponentP.h @@ -0,0 +1,227 @@ +/* pppLcpComponentP.h - LCP component private header file */ + +/* Copyright 1999 - 2005 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01r,28feb05,ijm added lcpEchoesFailed, SPR#70584 +01q,21nov03,rp updated path for random.h +01p,07aug03,rp updating include path for random.h +01o,17feb02,ak support for dynamic assignment of MP Member Stack to Manager + stack +01n,04feb01,ak redefined config option structures as per the memory reduction + recommendations +01m,30jun01,nts removed conditional compilation PPP_MP +01l,30jun01,ak merging with the ML-PPP code +01k,29sep00,sj merging with TOR2_0-WINDNET_PPP-CUM_PATCH_2 +01j,09aug00,adb support opening connections in passive mode +01i,01aug00,adb Merging with openstack view +01h,13jul00,sj merged from the PPP radius-ras branch +01g,26jun00,sj adding stackData pointer to profileData +01f,11jul00,md added initialReceived, lastReceived and lastSent to + lcpStackData structure +01e,01mar00,sj split alternateString List into LocalAlternate and + RemoteAlternate +01d,09feb00,sj add LCP_EXTENSIONS and PPP_SECURITY_CONFIG interfaces +01c,16dec99,sj optionArray needs to be of size NUMBER_OF_LCP_OPTIONS + 1 +01b,11nov99,sj using remoteString +01a,04nov99,sj cut out from target/h/ppp/pppLcpComponent.h +*/ + +#ifndef __INCpppLcpComponentPh +#define __INCpppLcpComponentPh + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "vxWorks.h" +#include "tickLib.h" +#include "logLib.h" +#include "errnoLib.h" +#include "stdio.h" +#include "stdlib.h" +#include "string.h" +#include "ctype.h" +#include "memLib.h" +#include "netBufLib.h" +#include "pfw/pfw.h" +#include "pfw/pfwStack.h" +#include "pfw/pfwProfile.h" +#include "pfw/pfwComponent.h" +#include "pfw/pfwLayer.h" +#include "pfw/pfwEvent.h" +#include "pfw/pfwTimer.h" +#include "pfw/pfwMemory.h" +#include "ppp/kstart.h" +#include "ppp/kppp.h" +#include "private/ppp/vpppstr.h" +#include "private/ppp/vlcpstr.h" +#include "private/ppp/pppoptn.h" +#include "private/ppp/pppstate.h" +#include "ppp/magic.h" +#include "ppp/interfaces/pppControlLayerInterface.h" +#include "ppp/interfaces/pppControlProtocolInterface.h" +#include "ppp/interfaces/lcpInterfaces.h" +#ifdef _WRS_KERNEL +#include "random.h" +#else +#include "wrn/util/random.h" +#endif + +#define REMOTE_STRING + +typedef struct lcpOption + { + char name[PFW_MAX_NAME_LENGTH]; + BYTE_ENUM(LCP_OPTION_TYPE) optionType; + char optionTypeString[16]; + }LCP_CONFIG_OPTION; + +/* Component data per instance; one per pfw */ + +typedef struct pppLcpComponent + { + PFW_COMPONENT_OBJ component; + FPTR_LCP_PACKET_RECEIVED * fptr_lcp_packet_received; + CONTROL_PROTOCOL_INTERFACE lcpControlInterface; + PPP_LINK_STATUS_ENTRY_INTERFACE lcpLinkStatusEntry; + PPP_LINK_CONFIG_ENTRY_INTERFACE lcpLinkConfigEntry; + PPP_LINK_STATUS_COUNTER_INCREMENT_INTERFACE lcpLinkCounters; + LCP_NEGOTIATED_AUTH_PROTOCOL_INTERFACE lcpNegotiatedAuthProtocols; + LCP_EXTENDED_OPTIONS_INTERFACE lcpExtendedOptions; + LCP_CONFIG_REQS_INTERFACE lcpConfReqGet; + LCP_PACKET_SEND_INTERFACE lcpPacketSend; + PPP_SECURITY_CONFIG_ENTRY_INTERFACE pppSecurityConfigEntry; + LCP_CONFIG_OPTION option[NUMBER_OF_LCP_OPTIONS+1]; + +/* WindNet Multilink - Start */ + + LCP_PROXYLCP_INTERFACE lcpProxyLcp; + LCP_BUNDLE_OPTIONS_INTERFACE lcpBundleOptions; +#if 0 + LCP_MP_TIME_INTERFACE lcpMpTimeInterface; /* NOT SUPPORTED IN THIS MP RELEASE */ +#endif + +/* WindNet Multilnik - End */ + + } PPP_LCP_COMPONENT; + +/* LCP configuration option types */ + +typedef struct alternateStrings + { + struct alternateStrings * next; + UINT32 preference; /* key for this ordered list */ + char configString[1]; + }ALTERNATE_OPTION_STRING; + +typedef struct lcpConfigStrings + { + char *configString; + ALTERNATE_OPTION_STRING *localAlternateConfigString; + ALTERNATE_OPTION_STRING *remoteAlternateConfigString; + char *remoteConfigString; + } LCP_CONFIG_STRINGS; + +typedef struct LCP_EXTENSIONS + { + BOOL pppLocalToPeerCompoundFrames; + BOOL pppPeerToLocalCompoundFrames; + BYTE pppLocalToPeerMaxSelfDescribingPad; + BYTE pppPeerToLocalMaxSelfDescribingPad; + BOOL pppLocalToPeerCallbackOperation; + BOOL pppPeerToLocalCallbackOperation; + char * pppPeerToLocalCallbackMsg; + } LCP_EXTENSIONS; + +typedef struct lcpProfileData + { + LCP_CONFIG_STRINGS * lcpConfigStrings; + BYTE_ENUM (BOOLEAN) send_id_enabled; + char * time_remaining_message; + ULONG time_remaining_timeout; + char * tx_identification_message; + ULONG maximum_number_of_configuration_requests; + ULONG maximum_number_of_configuration_failures; + ULONG maximum_number_of_termination_requests; + ULONG maximum_number_of_unacknowledged_echo_requests; + ULONG maximum_configuration_request_send_interval; + ULONG maximum_termination_request_send_interval; + ULONG maximum_echo_request_send_interval; + ULONG maximum_configuration_request_backoff_interval; + BYTE size_of_time_remaining_message; + BYTE_ENUM (CALLBACK_OPERATION) callback_operation; + char *callback_message; +#if 0 /* NOT SUPPORTED IN THIS RELEASE */ + ULONG link_quality_reporting_interval; +#endif /* NOT SUPPORTED IN THIS RELEASE */ + BOOL passiveMode; + struct lcpStackData * stackData; + } LCP_PROFILE_DATA; + +typedef struct lcpStackData + { + PPP_CONTROL_PROTOCOL_STATE_DATA stateData; + NET_POOL_ID netPoolId; + OPTION_LISTS option_lists; + PFW_TIMER_OBJ * lcp_timer; + PFW_TIMER_OBJ * time_remaining_timer; + PFW_EVENT_OBJ * lcpUpEventObj; + PPP_CONTROL_LAYER_INTERFACE * controlLayerInterface; + LINK_QUALITY_REPORT most_recently_received_LQR; + LINK_QUALITY_COUNTERS link_quality_counters; +#if 0 + BYTE_ENUM (BOOLEAN) link_quality_reporting_interval; + USHORT time_to_send_LQR; +#endif + BYTE last_id_of_lcp_packet_sent; + USHORT number_of_configuration_requests; + USHORT number_of_configuration_naks; + USHORT number_of_echo_requests; + USHORT number_of_lcp_termination_requests; + PPP_LCP_STATISTICS lcp_statistics; + PPP_LCP_MIBS lcp_mibs; + LCP_EXTENSIONS lcpExtensions; + M_BLK_ID last_txed_echo_request_packet; + M_BLK_ID last_txed_lcp_configuration_request_packet; + M_BLK_ID last_rxed_lcp_configuration_request_packet; + M_BLK_ID last_rxed_lcp_termination_request_packet; + M_BLK_ID last_rxed_lcp_echo_request_packet; + USHORT number_of_bytes_rejected; + ULONG time_remaining_in_seconds; + ULONG client_time_remaining; + BYTE id_sequence_number; + char rx_identification_message[NAME_SIZE]; + BOOLEAN configuration_request_backoff_period_started; + BOOLEAN lcpEchoesFailed; + PFW_PLUGIN_OBJ_CALLBACKS * callbacks; + M_BLK_ID copy_of_initial_rxed_lcp_configuration_request_packet; + M_BLK_ID copy_of_last_rxed_lcp_configuration_request_packet; + M_BLK_ID copy_of_last_txed_lcp_configuration_request_packet; +/* WindNet Multilink */ + BOOL isMpManagerStack; +#if 0 /* NOT SUPPORTED IN THIS RELEASE OF MP */ + BOOL is_mp_timing_the_link; + PFW_EVENT_OBJ * pEchoReplyReceivedEventObj; +#endif +/* WindNet Multilnik */ + } LCP_STACK_DATA; + +/* ppplcprx.c */ + +void lcpSetReceiveFunctions ( PPP_LCP_COMPONENT * lcpComponent); + +/* ppplcptx.c */ + +void lcpSetSendActionFunctions ( STATE_MACHINE_ACTION_TABLE * actionTable); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppLcpComponentPh */ diff --git a/h/private/ppp/pppNcpComponentP.h b/h/private/ppp/pppNcpComponentP.h new file mode 100644 index 0000000..5807fbb --- /dev/null +++ b/h/private/ppp/pppNcpComponentP.h @@ -0,0 +1,99 @@ +/* pppNcpComponent.h - NCP component header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01i,22may02,vk moved the ncpStackData to pppNcpLibP.h +01h,08nov01,ijm added ras parameters and ncp_configuration_naks +01g,29sep00,sj merging with TOR2_0-WINDNET_PPP-CUM_PATCH_2 +01f,20jul00,cn removed unnecessary sockFd. +01e,08jul00,bsn merged from the PPP radius-ras branch +01d,27jun00,bsn added NCP up and down event objects +01c,09feb00,sj changed NPC_MIBS to IPCP_MIBS +01b,19nov99,sgv Modified stack data src and dst address lengths +01a,12oct99,sgv derived from routerware source base +*/ + +#ifndef __INCpppNcpComponentPh +#define __INCpppNcpComponentPh + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "vxWorks.h" +#include "logLib.h" +#include "errnoLib.h" +#include "stdio.h" +#include "stdlib.h" +#include "string.h" +#include "ctype.h" +#include "memLib.h" +#include "inetLib.h" +#include "netBufLib.h" +#include "pfw/pfw.h" +#include "pfw/pfwStack.h" +#include "pfw/pfwProfile.h" +#include "pfw/pfwComponent.h" +#include "pfw/pfwLayer.h" +#include "pfw/pfwEvent.h" +#include "pfw/pfwTimer.h" +#include "ppp/kstart.h" +#include "ppp/kppp.h" +#include "private/ppp/vnipstr.h" +#include "private/ppp/vpppstr.h" +#include "private/ppp/vlcpstr.h" +#include "private/ppp/vncpstr.h" +/* +typedef struct ncpStackData + { + PPP_CONTROL_PROTOCOL_STATE_DATA stateData; + OPTION_LISTS option_lists; + PPP_CONTROL_LAYER_INTERFACE *controlLayerInterface; + PFW_INTERFACE_STATE_PAIR pppIpInterface; + PFW_INTERFACE_STATE_PAIR pppVjcInterface; + BOOL vjcConfigured; + PFW_TIMER_OBJ * ncp_timer; + PFW_EVENT_OBJ * ncpUpEventObj; + PFW_EVENT_OBJ * ncpDownEventObj; + BYTE last_id_of_ncp_packet_sent; + BYTE last_request_id; + BYTE id_sequence_number; + BYTE state; + BYTE old_state; + USHORT ncp_protocol; + int length_of_last_txed_request; + USHORT number_of_ncp_configuration_requests; + USHORT number_of_ncp_termination_requests; + USHORT number_of_ncp_configuration_naks; + USHORT configuration_request_backoff_interval; + USHORT configuration_request_send_interval; + USHORT termination_request_send_interval; + PPP_IPCP_MIBS ipcp_mibs; + M_BLK_ID retry_ncp_configuration_request_packet; + M_BLK_ID last_txed_ncp_configuration_request_packet; + M_BLK_ID last_rxed_ncp_configuration_request_packet; + BYTE last_rxed_ncp_id_sequence_number; + char localAddr[INET_ADDR_LEN]; + char remoteAddr[INET_ADDR_LEN]; + char primaryDnsAddr[INET_ADDR_LEN]; + char secondaryDnsAddr[INET_ADDR_LEN]; + PPP_NCP_STATISTICS statistics; + PFW_PLUGIN_OBJ_CALLBACKS * callbacks; + BOOLEAN configuration_request_backoff_period_started; + BOOLEAN useRasAddress; + BOOLEAN validRasAddress; + } NCP_STACK_DATA; +*/ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppNcpComponentPh */ + diff --git a/h/private/ppp/pppNcpLibP.h b/h/private/ppp/pppNcpLibP.h new file mode 100644 index 0000000..45d0b9b --- /dev/null +++ b/h/private/ppp/pppNcpLibP.h @@ -0,0 +1,211 @@ +/* pppNcpLibP.h - header file for common functions for PPP + Network control protocol(IPCP and IPV6CP) */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,22may02,vk declared the files used in pppNcpComponent.c +01a,17may02,as derived from WRS header base of NCP component header file +*/ + +#ifndef __INCpppNcpLibPh +#define __INCpppNcpLibPh + +#include "vxWorks.h" +#include "logLib.h" +#include "errnoLib.h" +#include "stdio.h" +#include "stdlib.h" +#include "string.h" +#include "ctype.h" +#include "memLib.h" +#include "inetLib.h" +#include "netBufLib.h" +#include "pfw/pfw.h" +#include "pfw/pfwStack.h" +#include "pfw/pfwProfile.h" +#include "pfw/pfwComponent.h" +#include "pfw/pfwLayer.h" +#include "pfw/pfwEvent.h" +#include "pfw/pfwTimer.h" +#include "ppp/kstart.h" +#include "ppp/kppp.h" +#include "private/ppp/pppstate.h" +#include "private/ppp/vnipstr.h" +#include "private/ppp/vpppstr.h" +#include "private/ppp/vlcpstr.h" +#include "private/ppp/vncpstr.h" +#include "ppp/interfaces/pppControlLayerInterface.h" +#include "ppp/interfaces/pppControlProtocolInterface.h" + + +typedef void (*FPTR_NCP_PACKET_RECEIVED) + ( + PFW_PLUGIN_OBJ_STATE * pPluginState, + M_BLK_ID pMblk + ); + +typedef struct pppNcpComponent + { + PFW_COMPONENT_OBJ pfwComponentObj; + FPTR_NCP_PACKET_RECEIVED + fptr_ncp_packet_received[NUMBER_OF_PPP_CONTROL_CODES]; + + } PPP_NCP_COMPONENT; + +typedef struct ncpStackData + { + PPP_CONTROL_PROTOCOL_STATE_DATA stateData; + OPTION_LISTS option_lists; + PPP_CONTROL_LAYER_INTERFACE * pControlLayerInterface; + PFW_PLUGIN_OBJ_CALLBACKS * callbacks; + + PFW_TIMER_OBJ * ncp_timer; + PFW_EVENT_OBJ * pNcpUpEventObj; + PFW_EVENT_OBJ * pNcpDownEventObj; + + BYTE state; + BYTE old_state; + + BYTE last_id_of_ncp_packet_sent; + BYTE last_request_id; + BYTE id_sequence_number; + + USHORT ncp_protocol; + + int length_of_last_txed_request; + BYTE last_rxed_ncp_id_sequence_number; + PPP_NCP_STATISTICS statistics; + + M_BLK_ID retry_ncp_configuration_request_packet; + M_BLK_ID last_txed_ncp_configuration_request_packet; + M_BLK_ID last_rxed_ncp_configuration_request_packet; + + BOOL configuration_request_backoff_period_started; + USHORT number_of_ncp_configuration_requests; + USHORT number_of_ncp_termination_requests; + USHORT number_of_ncp_configuration_naks; + USHORT configuration_request_backoff_interval; + USHORT configuration_request_send_interval; + USHORT termination_request_send_interval; + } NCP_STACK_DATA; + + +typedef struct ncpProfileData + { + ULONG maximum_number_of_configuration_requests; + ULONG maximum_number_of_termination_requests; + ULONG maximum_configuration_request_send_interval; + ULONG maximum_termination_request_send_interval; + ULONG maximum_configuration_request_backoff_interval; + ULONG maximum_number_of_configuration_failures; + } NCP_PROFILE_DATA; + + +typedef struct hcConfirurationOption + { + USHORT ipCompressionProtocol; + USHORT tcpSpace; + USHORT nonTcpSpace; + USHORT fMaxPeriod; + USHORT fMaxTime; + USHORT maxHeader; + BYTE rtCompressionType; + BYTE rtCompressionLength; + }_WRS_PACK_ALIGN(1) HC_CONFIGURATION_OPTION; + + + +STATUS ipcp_maxTerminationRequests + ( + PFW_OBJ * pPfw, + PFW_PARAMETER_OPERATION_TYPE type, + void * pProfileData, + char * pValue + ); + +STATUS ipcp_maxConfigRequests + ( + PFW_OBJ * pPfw, + PFW_PARAMETER_OPERATION_TYPE type, + void * pProfileData, + char * pValue + ); + +int ipcp_configReqSendInterval + ( + PFW_OBJ * pPfw, + PFW_PARAMETER_OPERATION_TYPE type, + void * pProfileData, + char * pValue + ); + +int ipcp_TerminationReqInterval + ( + PFW_OBJ * pPfw, + PFW_PARAMETER_OPERATION_TYPE type, + void * pProfileData, + char * pValue + ); + + +/* IPCP state functions */ +void ipcp_initialize_restart_counter + ( + PFW_PLUGIN_OBJ_STATE * pPluginObjState, + M_BLK_ID pMblk, + PPP_STATE end_state + ); + +void ipcp_zero_restart_counter + ( + PFW_PLUGIN_OBJ_STATE * pPluginObjState, + M_BLK_ID pMblk, + PPP_STATE end_state + ); + +PPP_CONTROL_PHASE ipcp_pppPhaseGet (); + +PPP_STATE ipcp_pppStateGet + ( + PFW_PLUGIN_OBJ_STATE * pState + ); + +/* IPCP timer handlers */ + +STATUS ipcp_periodic_timer + ( + PFW_PLUGIN_OBJ_STATE * pPluginState, + int arg + ); + +void periodic_ipcp_configure_or_termination_request + ( + PFW_PLUGIN_OBJ_STATE * pPluginState, + UINT32 arg + ); + +STATUS retry_ipcp_configure_request + ( + PFW_PLUGIN_OBJ_STATE * pPluginState, + int backoffStarted + ); + +STATUS retry_ipcp_termination_request + ( + PFW_PLUGIN_OBJ_STATE * pPluginState, + int arg + ); +TEST ncp_packet_received + ( + PFW_PLUGIN_OBJ_STATE * pPluginState, + M_BLK_ID packet + ); + + +#endif /* __INCpppNcpLibPh */ + diff --git a/h/private/ppp/pppoptn.h b/h/private/ppp/pppoptn.h new file mode 100644 index 0000000..6da0432 --- /dev/null +++ b/h/private/ppp/pppoptn.h @@ -0,0 +1,216 @@ +/* pppoptn.h - option processor header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01g,15jul02,emr This code was developed on the windnet_ppp2_0-ipv6 branch and + should have been developed on the windnet_ppp2_0 branch, so + this brings it into line. +01h,08jul02,as added option_name parameter to add_new_ppp_option_to_list +01g,22may02,as added definition for generateNewInterfaceIdentifier for IPV6 support +01f,04feb02,vk modified function prototypes to remove VALUE_TYPE structures +01e,04feb02,jr modified function prototypes to remove VALUE_TYPE structures +01d,23feb00,sj removed extra ';' in declaratio of store_ppp_options_in_packet +01c,26jan00,sj added changeOptionValueInConfiguredList and + free_ppp_option_list_entry +01b,10nov99,sj added generate_option_list_entry +01a,01oct99,sj created +*/ + +#include "ppp/kstart.h" +#include "ppp/kppp.h" +#include "private/ppp/vpppstr.h" +#include "private/ppp/listutls.h" +#include "pfw/pfw.h" + +#ifndef __INCpppoptnh +#define __INCpppoptnh + +#ifdef __cplusplus +extern "C" { +#endif + +/* pppoptn.c */ + +extern void add_configuration_option (PFW_OBJ *,OPTION_LIST *sptr_option_list, + OPTION_STATE state, BYTE option_type,BYTE length, + void *vptr_option_data,char *cptr_option_name, + char *cptr_ncp_name, BOOLEAN swap_value, + BOOLEAN negotiation_required, + BOOLEAN negotiable, + BOOLEAN automatic_nak_processing); + +extern void remove_configuration_option (OPTION_LIST *sptr_option_list, + BYTE option_type); +extern void replace_configuration_option (OPTION_LIST *sptr_option_list, + OPTION_LIST_ENTRY *sptr_option_to_replace, OPTION_STATE state); + +extern void free_ppp_option_lists (OPTION_LISTS *sptr_option_lists); + +extern void add_alternate_to_configuration_option ( PFW_OBJ * pfw, + OPTION_LIST *sptr_option_list,BYTE option_type, + BYTE length,void *vptr_option_data, + char *cptr_option_name,char *cptr_ncp_name, + BOOLEAN swap_value); + +extern void add_configuration_option_range (PFW_OBJ *, + OPTION_LIST *sptr_option_list, + BYTE option_type,BYTE length,void *vptr_option_data, + char *cptr_option_name,char *cptr_ncp_name,BOOLEAN swap_value + ); + +extern TEST add_new_ppp_option_to_list (PFW_OBJ *,OPTION_LIST *sptr_option_list, + OPTION_STATE state,BYTE option_type,char * option_name,BYTE length, /* Updated */ + void *vptr_option_data,BOOLEAN negotiation_required, + BOOLEAN negotiable,BOOLEAN automatic_nak_processing); + +extern STATUS changeOptionValueInConfiguredList ( PFW_OBJ *, OPTION_LIST *, + BYTE optionType, int newDataLength, void * newData); + +extern OPTION_LIST_ENTRY *duplicate_option (PFW_OBJ *, + OPTION_LIST_ENTRY *sptr_to_option_to_copy); + +extern TEST copy_option_from_entry (OPTION_LIST_ENTRY *sptr_matching_option, + void *vptr_destination,USHORT maximum_size); + +extern TEST copy_data_to_option (OPTION_LIST_ENTRY *sptr_matching_option, + void *vptr_source,USHORT size); + +extern void delete_entry_from_option_list (OPTION_LIST *sptr_option_list, + OPTION_LIST_ENTRY *sptr_option_to_delete); + +extern void free_ppp_option_list (OPTION_LIST *sptr_option_list); +extern void free_ppp_option_list_entry ( OPTION_LIST_ENTRY *sptr_source_option); +extern void free_ppp_tx_accepted_option_list (OPTION_LIST *sptr_option_list); +extern BOOLEAN is_option_present (OPTION_LIST *sptr_option_list, + BYTE option_type); + +extern void replace_data_field_in_option (PFW_OBJ *, + OPTION_LIST_ENTRY *sptr_option, + UNION_OPTION_DATA_TYPES *uptr_new_data,BYTE new_length); + +extern OPTION_LIST_ENTRY *find_matching_option (OPTION_LIST *sptr_option_list, + BYTE type); + +extern USHORT get_size_of_ppp_options (OPTION_LIST *sptr_option_list); + +extern void store_ppp_options_in_packet (OPTION_LIST *sptr_option_list, + PPP_OPTION *sptr_tx_option); + +extern TEST copy_option (OPTION_LIST *sptr_option_list,BYTE option_type, + void *vptr_destination,USHORT maximum_size); + +extern OPTION_PARSE_RESULT parse_ppp_options_from_configure_request ( + PFW_OBJ *, + OPTION_LISTS *sptr_option_lists, M_BLK_ID packet, + PFW_PLUGIN_OBJ_STATE *pluginState); + +extern OPTION_PARSE_RESULT parse_ppp_options_from_nak_configure ( + PFW_OBJ *, + OPTION_LISTS *sptr_option_lists, M_BLK_ID packet, + PFW_PLUGIN_OBJ_STATE *pluginState); + +extern OPTION_PARSE_RESULT parse_ppp_options_from_reject_configure ( + PFW_OBJ *, + OPTION_LISTS *sptr_option_lists,M_BLK_ID packet); + +/* pppoptna.c */ + +extern void copy_configuration_options_list (PFW_OBJ *, + OPTION_LIST * from_list,OPTION_LIST * to_list); + +extern void copy_configuration_options_to_tx_accepted_options (PFW_OBJ *, + OPTION_LISTS *sptr_option_lists); + +extern TEST insertAlternateOptionToList ( PFW_OBJ *, OPTION_LIST_ENTRY *, + BYTE length, void *vptr_option_data, + ALTERNATE_OPTION *previousOption); + +extern TEST add_option_to_alternate_list (PFW_OBJ *, + OPTION_LIST *sptr_option_list, + BYTE option_type,BYTE length, + void *vptr_option_data + ); +extern char * getIpcpOptionName (PFW_OBJ * pfw, char * optionName); +extern char * getLcpOptionName (PFW_OBJ * pfw, char * optionName); +/* Updated */ + + +/* pppoptnp.c */ + +extern TEST ppp_configure_request_option_processor ( + OPTION_LIST_ENTRY *sptr_remote_option, + OPTION_LISTS *sptr_option_lists, + PFW_PLUGIN_OBJ_STATE * pluginState); + +extern TEST ppp_configure_nak_option_processor ( + OPTION_LIST_ENTRY *sptr_remote_option, + OPTION_LISTS *sptr_option_lists, + PFW_PLUGIN_OBJ_STATE * pluginState); + +extern OPTION_LIST_ENTRY *option_value_match ( + OPTION_LIST_ENTRY *sptr_local_option, + OPTION_LIST_ENTRY *sptr_remote_option); + +extern ALTERNATE_OPTION *alternate_option_value_match ( + OPTION_LIST_ENTRY *sptr_local_option, + OPTION_LIST_ENTRY *sptr_remote_option); + +extern BOOLEAN range_option_value_match (OPTION_LIST_ENTRY *sptr_local_option, + OPTION_LIST_ENTRY *sptr_remote_option); + +/* IPV6 Support */ +extern void generateNewInterfaceIdentifier (OPTION_LIST_ENTRY * sptr_remote_option); +/* IPV6 Support */ + +/* pppconfg.c */ + +extern STATUS generate_option_list_entry (PFW_OBJ * pfw, + OPTION_LISTS *sptr_option_lists, + char *value_type_string, + char *value_string, + BYTE option_number, + char * protocol_name, + char * type_string); + +extern void get_option_value (char *value_type_string,char *value_string, + BYTE *bptr_return_data, BYTE *bptr_return_length, + BOOLEAN *eptr_return_value_swapped); + +extern char *copy_parameter (char *cptr_parameter,char *cptr_option, + char **pHolder, BYTE *bptr_number_of_parameters_processed); + +extern ULONG get_ppp_configuration_table_address (void); + +extern void add_ppp_option (PFW_OBJ * pfw,char *option_string, + OPTION_LISTS *sptr_option_lists); +extern void add_remote_ppp_option(PFW_OBJ *,char *option_string, + OPTION_LISTS *sptr_option_lists); + +/* pppcfgar.c */ + +extern TEST get_alternate_option_values (char *cptr_option_string, + char *cptr_return_ncp_name,char *cptr_return_option_name, + BYTE *bptr_return_option_number,BYTE *bptr_return_data, + BYTE *bptr_return_length,BOOLEAN *eptr_return_value_swapped); + +extern TEST get_range_option_values (char *cptr_option_string, + char *cptr_return_ncp_name,char *cptr_return_option_name, + BYTE *bptr_return_option_number,BYTE *bptr_return_data, + BYTE *bptr_return_length,BOOLEAN *eptr_return_value_swapped); + +extern void parse_option_value (PFW_OBJ *,char *cptr_value, + BYTE *bptr_option_data, + BYTE *bptr_length_of_all_options, + BOOLEAN *eptr_return_value_swapped); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpppoptnh */ + diff --git a/h/private/ppp/pppstate.h b/h/private/ppp/pppstate.h new file mode 100644 index 0000000..4b919f2 --- /dev/null +++ b/h/private/ppp/pppstate.h @@ -0,0 +1,116 @@ +/* pppstate.h - state machine table */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,04oct99,sj created +*/ + +#include "ppp/kstart.h" +#include "ppp/kppp.h" +#include "private/ppp/vpppstr.h" +#include "pfw/pfw.h" +#include "netBufLib.h" + +/* +*$Log:: /Rtrware/devdrvrs/ppp/vpppsta $ + * + * 7 10/01/98 11:43a Alex + * Updated the PPP source code to conform + * to a single build. + * + * 6 4/30/98 3:03p Alex + * Ppp v4.2.0 check in + * + * 1 4/24/98 12:10a Release Engineer + * code cleanup, code style changes, + * linted, system level test + * PPP v4.2.0 +*/ +/* + | State State + | 0 1 2 3 4 5 6 7 8 9 +Events| Initial Starting Closed Stopped Closing Stopping Req-Sent Ack-Rcvd Ack-Sent Opened +------+---------------------------------------------------------------------------------------------------- + Up | 2 irc,scr/6 - - - - - - - - + Down | - - 0 tls/1 0 1 1 1 1 tld/1 + Open | tls/1 1 irc,scr/6 3r 5r 5r 6 7 8 9r + Close| 0 0 2 2 4 4 irc,str/4 irc,str/4 irc,str/4 tld,irc,str/4 + | + TO+ | - - - - str/4 str/5 scr/6 scr/6 scr/8 - + TO- | - - - - tlf/2 tlf/3 tlf/3p tlf/3p tlf/3p - + | + RCR+ | - - sta/2 irc,scr,sca/8 4 5 sca/8 sca,tlu/9 sca/8 tld,scr,sca/8 + RCR- | - - sta/2 irc,scr,scn/6 4 5 scn/6 scn/7 scn/6 tld,scr,scn/6 + RCA | - - sta/2 sta/3 4 5 irc/7 scr/6x irc,tlu/9 tld,scr/6x + RCN | - - sta/2 sta/3 4 5 irc,scr/6 scr/6x irc,scr/8 tld,scr/6x + | + RTR | - - sta/2 sta/3 sta/4 sta/5 sta/6 sta/6 sta/6 tld,zrc,sta/5 + RTA | - - 2 3 tlf/2 tlf/3 6 6 8 tld,scr/6 + | + RUC | - - scj/2 scj/3 scj/4 scj/5 scj/6 scj/7 scj/8 scj/9 + RXJ+ | - - 2 3 4 5 6 6 8 9 + RXJ- | - - tlf/2 tlf/3 tlf/2 tlf/3 tlf/3 tlf/3 tlf/3 tld,irc,str/5 + | + RXR | - - 2 3 4 5 6 7 8 ser/9 + +*/ + +#ifndef __INCpppstateh +#define __INCpppstateh + +typedef void (*STATE_ACTION_FUNCTION)(PFW_PLUGIN_OBJ_STATE * pluginObjState, + M_BLK_ID pMblk, PPP_STATE end_state); +typedef struct STATE_MACHINE_ACTION_TABLE + { + STATE_ACTION_FUNCTION set_ppp_state; + STATE_ACTION_FUNCTION null_state; + STATE_ACTION_FUNCTION this_layer_start; + STATE_ACTION_FUNCTION this_layer_finished; + STATE_ACTION_FUNCTION this_layer_up; + STATE_ACTION_FUNCTION this_layer_down; + STATE_ACTION_FUNCTION initialize_restart_counter; + STATE_ACTION_FUNCTION zero_restart_counter; + STATE_ACTION_FUNCTION send_configuration_request; + STATE_ACTION_FUNCTION send_configuration_ack; + STATE_ACTION_FUNCTION send_configuration_nak; + STATE_ACTION_FUNCTION send_configuration_reject; + STATE_ACTION_FUNCTION send_termination_request; + STATE_ACTION_FUNCTION send_termination_ack; + STATE_ACTION_FUNCTION send_code_reject; + STATE_ACTION_FUNCTION send_echo_request; + STATE_ACTION_FUNCTION send_echo_reply; + }STATE_MACHINE_ACTION_TABLE; + +typedef struct PPP_CONTROL_PROTOCOL_STATE_DATA + { + BYTE_ENUM (PPP_STATE) state; + BYTE_ENUM (PPP_STATE) old_state; + + STATE_MACHINE_ACTION_TABLE * action_table; + } PPP_CONTROL_PROTOCOL_STATE_DATA; + +typedef struct PPP_STATE_MACHINE_TABLE + { + STATE_ACTION_FUNCTION fptr_state_function; + BYTE_ENUM (PPP_STATE) end_state; + + STATE_ACTION_FUNCTION fptr_state_function_1; + BYTE_ENUM (PPP_STATE) end_state_1; + + STATE_ACTION_FUNCTION fptr_state_function_2; + BYTE_ENUM (PPP_STATE) end_state_2; + } PPP_STATE_MACHINE_TABLE; + + +extern void set_ppp_state(PFW_PLUGIN_OBJ_STATE * pluginObjState, + M_BLK_ID pMblk, PPP_STATE end_state); +extern void null_state(PFW_PLUGIN_OBJ_STATE * pluginObjState, + M_BLK_ID pMblk, PPP_STATE end_state); +extern void execute_ppp_state_machine (PFW_PLUGIN_OBJ_STATE * pluginState, + PPP_EVENT ppp_event, M_BLK_ID pMblk); +#endif /* __INCpppstateh */ diff --git a/h/private/ppp/rasammP.h b/h/private/ppp/rasammP.h new file mode 100644 index 0000000..52e26c9 --- /dev/null +++ b/h/private/ppp/rasammP.h @@ -0,0 +1,154 @@ +/* + * rasammP.h - Private Remote Access address manager header file + */ + +/* + * Copyright 2003 Wind River Systems, Inc. + */ + +/* +modification history +-------------------- +01a,15may03,ijm removed adv_net.h +*/ + + +#ifndef _RAS_AMM_H +#define _RAS_AMM_H + +#ifdef _cplusplus +extern "C" { +#endif + +#include "string.h" + +#ifdef _DEBUG_STANDALONE +#include +#include +#include + +typedef unsigned char UINT8; +typedef unsigned int UINT; +typedef unsigned long UINT32; +typedef char INT8; +typedef int INT; +typedef long INT32; +typedef int STATUS; + +#define ERROR -1 +#define OK 0 + +#define SEM_ID UINT32 +#define SEM_Q_PRIORITY +#define SEM_FULL +#define WAIT_FOREVER + +#define FAST register +#define LOCAL static + +#define intLock() 1 +#define intUnlock(x) + +#define semBCreate(x,y) 1 +#define semTake(x,y) +#define semGive(x) +#define errnoSet(x) +#define errnoGet() -1 + +#else /* end of _DEBUG */ +#include "stdio.h" +#include "stdlib.h" +#include "semLib.h" +#include "errnoLib.h" +#include "inetLib.h" +#endif + +#define RAS_ADDRM_FASTS_POOL 1 /* very fast lookup */ +#define RAS_ADDRM_SMALS_POOL 2 /* very small in storage */ + +#define IPV4_ADDR_BITS 0xFFFFFFFF +#define IPV4_ADDR_LEN 4 + +#define ADDRPOOL_DEL_INPGRES 1 + +#define RASAMM_MODULE_ID (130 << 16) +#define ERASAMMDELINPGRES (RASAMM_MODULE_ID | 1) +#define ERASAMMINVALIDPARM (RASAMM_MODULE_ID | 2) +#define ERASAMMNOMEMORY (RASAMM_MODULE_ID | 3) +#define ERASAMMINVLDCOMMAND (RASAMM_MODULE_ID | 4) +#define ERASAMMNOPMPLKUPTBL (RASAMM_MODULE_ID | 5) + + +typedef struct ras_pmp_mux_entry +{ + struct ras_pmp_mux_entry *next; + void *drv; + UINT32 srcipAddr; + UINT32 dstipAddr; +} RAS_PMP_MUX_ENTRY; + +typedef struct addrpool_entry { + struct addrpool_entry *next; + UINT32 routerId; + UINT32 firstIpAddr; + UINT prefixLen; + UINT32 poolSz; + UINT32 poolId; + UINT poolType; + UINT32 poolState; + UINT32 allocated; + UINT32 firstFree; + union { + UINT32 *faddrPool; + UINT8 *saddrPool; + } addrPool; +#define faddrPool addrPool.faddrPool +#define saddrPool addrPool.saddrPool + void *exportedDrv; + UINT numDrvs; + UINT supportPMP; + UINT lkupTblSz; + RAS_PMP_MUX_ENTRY **lkupTbl; +} ADDR_POOL_ENTRY; + + +/* + * IOCTL commands + */ +#define RASIOCTLCOMMANDBASE 0 /* might need to change for conformity */ +#define RASIOCGETMAXPOOLID (RASIOCTLCOMMANDBASE + 1) +#define RASIOCGETTOTALNUMPOOLS (RASIOCTLCOMMANDBASE + 2) +#define RASIOCGETADDRPOOLSZ (RASIOCTLCOMMANDBASE + 3) +#define RASIOCGETIPADDRPREFIX (RASIOCTLCOMMANDBASE + 4) +#define RASIOCGETROUTERID (RASIOCTLCOMMANDBASE + 5) +#define RASIOCGETFIRSTIPADDR (RASIOCTLCOMMANDBASE + 6) +#define RASIOCGETNUMFREEADDRS (RASIOCTLCOMMANDBASE + 7) +#define RASIOCGETGETFREEADDRS (RASIOCTLCOMMANDBASE + 8) +#define RASIOCGETPMPSUPPORT (RASIOCTLCOMMANDBASE + 9) +#define RASIOCGETEXPTDDRIVER (RASIOCTLCOMMANDBASE + 10) +#define RASIOCGETNUMDRIVERS (RASIOCTLCOMMANDBASE + 11) +#define RASIOCSETEXPTDDRIVER (RASIOCTLCOMMANDBASE + 12) + +typedef struct _rasioctlarg +{ + UINT32 poolId; + union { + UINT32 poolSz; + UINT32 routerId; + UINT32 firstIp; + UINT32 maxPoolId; + UINT32 numPools; + UINT32 prefxLen; + UINT32 numFreeAddr; + UINT32 *freeAddrs; + UINT supportPMP; + void *exportedDrv; + UINT numDrvs; + } info; +} RASAMM_IOCTL_ARG; + +#ifdef _cplusplus +} +#endif + +#endif diff --git a/h/private/ppp/vbacpstr.h b/h/private/ppp/vbacpstr.h new file mode 100644 index 0000000..d1f992e --- /dev/null +++ b/h/private/ppp/vbacpstr.h @@ -0,0 +1,193 @@ +/* vbacpstr.h - BACP structure definitions */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +02c,19apr02,jr packed the structures for ARM fixes. +02b,13feb02,as removed the member BACP_NO_FAVORED_PEER_NEGOTIATED + from the structure BACP_OPTION_TYPE +01a,01feb01,sd derived from routerware source base +*/ + +/* +*$Log:: $ + * + * 4 4/ + * Bacp + * v4.2.0 + * check in + * + * 1 4 + * code + * cleanup + * , code + * style + * changes + * , + * linted, + * system + * level + * test + * BACP + * v4.2.0 +*/ + +#ifndef __INCvbacpstrh +#define __INCvbacpstrh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "ppp/kstart.h" +#include "ppp/kppp.h" +#include "private/ppp/vpppstr.h" +#include "pfw/pfw.h" +#include "ppp/kbacpif.h" + +typedef enum + { + BACP_FAVORED_PEER = 0x01, + NUMBER_OF_BACP_OPTIONS + }BACP_OPTION_TYPE; + +typedef struct BACP_HEADER + { + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + } BACP_HEADER; + +typedef struct FAVORED_PEER_OPTION + { + BYTE_ENUM (BACP_OPTION_TYPE) type; + BYTE length; + ULONG magic_number; + }_WRS_PACK_ALIGN(1) FAVORED_PEER_OPTION; + +typedef union UNION_BACP_OPTIONS + { + FAVORED_PEER_OPTION favored_peer_option; + }_WRS_PACK_ALIGN(1) UNION_BACP_OPTIONS; + +typedef struct BACP_GENERIC_OPTION + { + BYTE type; + BYTE length; + BYTE data[VARIABLE_NUMBER_OF_BYTES]; + }_WRS_PACK_ALIGN(1) BACP_GENERIC_OPTION; + +typedef struct BACP_PACKET + { + PPP_HEADER ppp_header; + BACP_HEADER bacp_header; + BACP_GENERIC_OPTION options; + }_WRS_PACK_ALIGN(1) BACP_PACKET; + +typedef struct BACP_CONFIGURE_REQUEST + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + BACP_GENERIC_OPTION options; + } BACP_CONFIGURE_REQUEST; + +typedef struct BACP_CONFIGURE_REQUEST_PACKET + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + UNION_BACP_OPTIONS options; + } BACP_CONFIGURE_REQUEST_PACKET; + +typedef struct BACP_CONFIGURE_ACK_PACKET + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + UNION_BACP_OPTIONS options; + } BACP_CONFIGURE_ACK_PACKET; + +typedef struct BACP_CONFIGURE_NAK_PACKET + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + BACP_GENERIC_OPTION options; + }_WRS_PACK_ALIGN(1) BACP_CONFIGURE_NAK_PACKET; + +typedef struct BACP_CONFIGURE_REJECT_PACKET + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + BACP_GENERIC_OPTION options; + }_WRS_PACK_ALIGN(1) BACP_CONFIGURE_REJECT_PACKET; + +typedef struct BACP_TERMINATE_REQUEST + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + }_WRS_PACK_ALIGN(1) BACP_TERMINATE_REQUEST; + +typedef struct BACP_TERMINATE_ACK + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + }_WRS_PACK_ALIGN(1) BACP_TERMINATE_ACK; + +typedef struct BACP_CODE_REJECT_PACKET + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + BACP_PACKET rejected_packet; + }_WRS_PACK_ALIGN(1) BACP_CODE_REJECT_PACKET; + +#define BACP_PACKET_HEADER_SIZE (sizeof(PPP_HEADER) + sizeof(BACP_HEADER)) + + +/******************************************************************************/ + +typedef struct PPP_BACP_STATISTICS + { + ULONG number_of_tx_packets; + ULONG number_of_tx_bytes; + ULONG number_of_rx_packets; + ULONG number_of_rx_bytes; + ULONG number_of_packets_rxed_greater_than_maximum_size; + ULONG number_of_packets_rxed_less_than_minimum_size; + ULONG number_of_control_tx_packets[NUMBER_OF_PPP_CONTROL_CODES]; + ULONG number_of_control_rx_packets[NUMBER_OF_PPP_CONTROL_CODES]; + } PPP_BACP_STATISTICS; + +typedef void (*FPTR_BACP_PACKET_RECEIVED) (PFW_PLUGIN_OBJ_STATE * pluginState, + M_BLK_ID packet); + +/* bacptimer.c */ + +extern STATUS retry_bacp_termination_request + (PFW_PLUGIN_OBJ_STATE * pluginState, int arg); + +extern STATUS retry_bacp_configure_request (PFW_PLUGIN_OBJ_STATE *pluginState, + int backoffStarted); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvbacpstrh */ diff --git a/h/private/ppp/vbacputil.h b/h/private/ppp/vbacputil.h new file mode 100644 index 0000000..0809a14 --- /dev/null +++ b/h/private/ppp/vbacputil.h @@ -0,0 +1,74 @@ +/* bacputil.h - BACP utility function header file */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +02b,08oct01,as added copyPortInfoToBapBuffer for multiple phone delta option support +01a,01feb01,as created +*/ + +#ifndef __INCbacputilh +#define __INCbacputilh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "private/ppp/vbapstr.h" + +/* baputil.c */ + + +extern M_BLK_ID bacpDupPkt (M_BLK_ID pPacket); + +extern BAP_BUFFER * bap_match_received_response_to_outstanding_request + (LINK * ptr_linked_list, BYTE bap_id); + +extern BAP_BUFFER * bap_find_unacknowledged_outstanding_request + (LINK * ptr_linked_list); + +extern BAP_ACTIVE_PORT * bap_find_active_port_with_this_bandwidth + (LINK * ptr_linked_list, USHORT bandwidth); + +extern PFW_STACK_OBJ * bap_find_stackobj_with_this_discriminators +(LINK * ptr_linked_list, USHORT localDiscriminator, USHORT remoteDiscriminator); + +extern BAP_BUFFER * bap_find_acknowledged_linkdrop_request_with_discriminator + (LINK * ptr_linked_list, USHORT localDiscriminator); + +extern PFW_STACK_OBJ * bap_find_stackobj_for_the_remote_discriminator + (LINK * ptr_linked_list, USHORT remoteDiscriminator); + +extern BAP_ACTIVE_PORT * bap_find_active_port_with_this_stackobj + (LINK * ptr_linked_list, PFW_STACK_OBJ * stackObj); + +extern BAP_ACTIVE_PORT * bap_find_active_port_with_this_portnumber + (LINK * ptr_linked_list, USHORT portnumber); + +extern USHORT bap_number_of_active_port_entries + (LINK * ptr_linked_list); + +extern BAP_BUFFER * bap_find_acknowledged_linkdrop_request + (LINK * ptr_linked_list); + +extern BAP_BUFFER* bap_find_outstanding_request_for_port + (LINK * ptr_linked_list, USHORT port_number); + +extern BAP_ACTIVE_PORT * bap_match_discriminator_and_active_port + (LINK * ptr_linked_list, USHORT localDiscriminator); + +extern STATUS copyPortInfoToBapBuffer (PFW_OBJ * pfwObj, + SL_LIST * destinationPortList, SL_LIST * sourcePortList); + +extern void bapPrintOptionsInPacket (M_BLK_ID packet); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCbacputilh */ diff --git a/h/private/ppp/vbapstr.h b/h/private/ppp/vbapstr.h new file mode 100644 index 0000000..3f7f06b --- /dev/null +++ b/h/private/ppp/vbapstr.h @@ -0,0 +1,470 @@ +/* vbapstr.h - BAP structure definitions */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,08oct01,as remove port manager related function definitions +01a,30jan01,as derived from routerware source base +*/ + +/* +*$Log:: /Rtrware/devdrvrs/ppp/vlcpstr $ + * + * 7 10/01/98 11:43a Alex + * Updated the PPP source code to conform + * to a single build. + * + * 6 4/30/98 3:03p Alex + * Ppp v4.2.0 check in + * + * 1 4/24/98 12:10a Release Engineer + * code cleanup, code style changes, + * linted, system level test + * PPP v4.2.0 +*/ + +#ifndef __INCvbapstrh +#define __INCvbapstrh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "ppp/kstart.h" +#include "ppp/kppp.h" +#include "private/ppp/vpppstr.h" +#include "ppp/kbacpif.h" +#include "sllLib.h" + +enum BAP_PACKET_TYPE + { + BAP_CALL_REQUEST = (BYTE) 0x01, + BAP_CALL_RESPONSE = (BYTE) 0x02, + BAP_CALLBACK_REQUEST = (BYTE) 0x03, + BAP_CALLBACK_RESPONSE = (BYTE) 0x04, + BAP_LINK_DROP_QUERY_REQUEST = (BYTE) 0x05, + BAP_LINK_DROP_QUERY_RESPONSE = (BYTE) 0x06, + BAP_CALL_STATUS_INDICATION = (BYTE) 0x07, + BAP_CALL_STATUS_RESPONSE = (BYTE) 0x08, + NUMBER_OF_BAP_PACKET_TYPES + }; + + +enum BAP_RESPONSE_CODE + { + BAP_RESPONSE_ACK = (BYTE) 0x00, + BAP_RESPONSE_NAK = (BYTE) 0x01, + BAP_RESPONSE_REJ = (BYTE) 0x02, + BAP_RESPONSE_FULL_NAK = (BYTE) 0x03, + + BAP_SECURITY_VIOLATION = (BYTE) 0xfd, /* routerware added */ + BAP_FAVORED_PEER_PRIORITY_DROP = (BYTE) 0xfe, /* routerware added */ + BAP_RESPONSE_TIMEOUT = (BYTE) 0xff /* routerware added */ + }; + + +/**************************************/ +/* Option #1 = Link Type Option */ +/**************************************/ +typedef struct BAP_LINK_TYPE_OPTION + { + BYTE type; /* = 0x01 */ + BYTE length; /* = 0x05 */ + USHORT link_speed; /* in Kb/s */ + BYTE_ENUM(BAP_LINK_TYPES) link_type; + }__attribute__((__packed__)) + BAP_LINK_TYPE_OPTION; + + +/**************************************/ +/* Option #2= Phone Delta Option */ +/**************************************/ +enum BAP_PHONE_DELTA_TYPES + { + UNIQUE_DIGITS_TYPE = (BYTE) 0x01, + SUBSCRIBER_NUMBER_TYPE = (BYTE) 0x02, + PHONE_NUMBER_SUBADDRESS_TYPE = (BYTE) 0x03, + SUBOPTION_TYPE_NONE = (BYTE) 0xff + + } BAP_PHONE_DELTA_TYPES; + +typedef struct BAP_PHONE_DELTA_UNIQUE_DIGITS + { + BYTE_ENUM(BAP_PHONE_DELTA_TYPES) type; + BYTE length; + BYTE number_of_digits; + BYTE digits[VARIABLE_NUMBER_OF_BYTES]; + + } __attribute__((__packed__)) + BAP_PHONE_DELTA_UNIQUE_DIGITS; + +typedef struct BAP_PHONE_DELTA_SUBSCRIBER_NUMBER + { + BYTE_ENUM(BAP_PHONE_DELTA_TYPES) type; + BYTE length; + BYTE digits[VARIABLE_NUMBER_OF_BYTES]; + + } __attribute__((__packed__)) + BAP_PHONE_DELTA_SUBSCRIBER_NUMBER; + +typedef struct BAP_PHONE_DELTA_PHONE_NUMBER_SUB_ADDRESS + { + BYTE_ENUM(BAP_PHONE_DELTA_TYPES) type; + BYTE length; + BYTE digits[VARIABLE_NUMBER_OF_BYTES]; + + }__attribute__((__packed__)) + BAP_PHONE_DELTA_PHONE_NUMBER_SUB_ADDRESS; + +typedef union BAP_PHONE_DELTA_SUBOPTION + { + BAP_PHONE_DELTA_UNIQUE_DIGITS unique_digits; + BAP_PHONE_DELTA_SUBSCRIBER_NUMBER subscriber_number; + BAP_PHONE_DELTA_PHONE_NUMBER_SUB_ADDRESS phone_number_sub_address; + + }__attribute__((__packed__)) + BAP_PHONE_DELTA_SUBOPTION; + +typedef struct BAP_PHONE_DELTA_OPTION + { + BYTE type; /* = 0x02 */ + BYTE length; + BYTE data[VARIABLE_NUMBER_OF_BYTES]; +/* Note that there may be more than one suboption within + the phone delta option */ + }__attribute__((__packed__)) + BAP_PHONE_DELTA_OPTION; + + +/**************************************/ +/* Option #3 = No Phone Number Option */ +/**************************************/ +typedef struct BAP_NO_PHONE_NUMBER_NEEDED_OPTION + { + BYTE type; /* = 0x03 */ + BYTE length; /* = 0x02 */ + + }__attribute__((__packed__)) + BAP_NO_PHONE_NUMBER_NEEDED_OPTION; + +/**************************************/ +/* Option #4 = Reason Option */ +/**************************************/ +typedef struct BAP_REASON_OPTION + { + BYTE type; /* = 0x04 */ + BYTE length; + BYTE reason[VARIABLE_NUMBER_OF_BYTES]; + + }__attribute__((__packed__)) + BAP_REASON_OPTION; + +/*****************************************/ +/* Option #5 = Link Discriminator Option */ +/*****************************************/ +typedef struct BAP_LINK_DISCRIMINATOR_OPTION + { + BYTE type; /* = 0x05 */ + BYTE length; /* = 0x04 */ + USHORT link_discriminator; + + }__attribute__((__packed__)) + BAP_LINK_DISCRIMINATOR_OPTION; + +/**************************************/ +/* Option #6 = Link Status Option */ +/**************************************/ +typedef struct BAP_CALL_STATUS_OPTION + { + BYTE type; /* = 0x06 */ + BYTE length; /* = 0x04 */ + BYTE_ENUM(CALL_STATUS) status; + BYTE_ENUM(CALL_ACTION) action; + + }__attribute__((__packed__)) + BAP_CALL_STATUS_OPTION; + + +typedef struct BAP_TLV_OPTION + { + BYTE type; + BYTE length; + BYTE value[VARIABLE_NUMBER_OF_BYTES]; + + }__attribute__((__packed__)) + BAP_TLV_OPTION; + + +enum BAP_OPTION_TYPE + { + BAP_LINK_TYPE = (BYTE) 0x01, + BAP_PHONE_DELTA = (BYTE) 0x02, + BAP_NO_PHONE_NUMBER_NEEDED = (BYTE) 0x03, + BAP_REASON = (BYTE) 0x04, + BAP_LINK_DISCRIMINATOR = (BYTE) 0x05, + BAP_CALL_STATUS = (BYTE) 0x06 + }; + +typedef TEST (*FPTR_BAP_PACKET_RECEIVED) + ( + PFW_PLUGIN_OBJ_STATE * pluginState, + M_BLK_ID packet + ); + +/**************************************/ +/* BAP Packet Types */ +/**************************************/ +typedef struct BAP_REQUEST_HEADER + { + BYTE_ENUM (BAP_PACKET_TYPE) bap_type; + BYTE bap_id; + USHORT bap_length; + }__attribute__((__packed__)) + BAP_REQUEST_HEADER; + + +typedef struct BAP_REQUEST_PACKET + { + PPP_HEADER ppp_header; + BYTE_ENUM (BAP_PACKET_TYPE) bap_type; + BYTE bap_id; + USHORT bap_length; + BYTE bap_data[VARIABLE_NUMBER_OF_BYTES]; + }__attribute__((__packed__)) + BAP_REQUEST_PACKET; + +typedef struct BAP_INDICATION_PACKET + { + PPP_HEADER ppp_header; + BYTE_ENUM (BAP_PACKET_TYPE) bap_type; + BYTE bap_id; + USHORT bap_length; + BYTE bap_data[VARIABLE_NUMBER_OF_BYTES]; + }__attribute__((__packed__)) + BAP_INDICATION_PACKET; + +typedef struct BAP_RESPONSE_HEADER + { + BYTE_ENUM (BAP_PACKET_TYPE) bap_type; + BYTE bap_id; + USHORT bap_length; + BYTE_ENUM(BAP_RESPONSE_CODE) bap_response_code; + }__attribute__((__packed__)) + BAP_RESPONSE_HEADER; + + +typedef struct BAP_RESPONSE_PACKET + { + PPP_HEADER ppp_header; + BYTE_ENUM (BAP_PACKET_TYPE) bap_type; + BYTE bap_id; + USHORT bap_length; + BYTE_ENUM(BAP_RESPONSE_CODE) bap_response_code; + BYTE bap_data[VARIABLE_NUMBER_OF_BYTES]; + }__attribute__((__packed__)) + BAP_RESPONSE_PACKET; + +typedef struct BAP_CALL_REQUEST_PACKET + { + PPP_HEADER ppp_header; + BYTE_ENUM (BAP_PACKET_TYPE) bap_type; + BYTE bap_id; + USHORT bap_length; + BAP_LINK_TYPE_OPTION link_type_option; + /* OPTION: No Phone Number Option */ + }__attribute__((__packed__)) + BAP_CALL_REQUEST_PACKET; + +typedef struct BAP_CALL_RESPONSE_PACKET + { + PPP_HEADER ppp_header; + BYTE_ENUM (BAP_PACKET_TYPE) bap_type; + BYTE bap_id; + USHORT bap_length; + BYTE_ENUM(BAP_RESPONSE_CODE) bap_response_code; + /* OPTION: Phone Delta Options */ + /* OPTION: Link Type Options */ + }__attribute__((__packed__)) + BAP_CALL_RESPONSE_PACKET; + +typedef struct BAP_CALLBACK_REQUEST_PACKET + { + PPP_HEADER ppp_header; + BYTE_ENUM (BAP_PACKET_TYPE) bap_type; + BYTE bap_id; + USHORT bap_length; + BAP_LINK_TYPE_OPTION link_type_option; + /* BAP_PHONE_DELTA_SUBOPTION bap_phone_delta_option; */ + /* Note that above option has multiple suboptions and variable length */ + }__attribute__((__packed__)) + BAP_CALLBACK_REQUEST_PACKET; + +typedef struct BAP_CALLBACK_RESPONSE_PACKET + { + PPP_HEADER ppp_header; + BYTE_ENUM (BAP_PACKET_TYPE) bap_type; + BYTE bap_id; + USHORT bap_length; + BYTE_ENUM(BAP_RESPONSE_CODE) bap_response_code; + }__attribute__((__packed__)) + BAP_CALLBACK_RESPONSE_PACKET; + +typedef struct BAP_LINK_DROP_QUERY_REQUEST_PACKET + { + PPP_HEADER ppp_header; + BYTE_ENUM (BAP_PACKET_TYPE) bap_type; + BYTE bap_id; + USHORT bap_length; + BAP_LINK_DISCRIMINATOR_OPTION link_discriminator_option; + } __attribute__((__packed__)) + BAP_LINK_DROP_QUERY_REQUEST_PACKET; + +typedef struct BAP_LINK_DROP_QUERY_RESPONSE_PACKET + { + PPP_HEADER ppp_header; + BYTE_ENUM (BAP_PACKET_TYPE) bap_type; + BYTE bap_id; + USHORT bap_length; + BYTE_ENUM(BAP_RESPONSE_CODE) bap_response_code; + }__attribute__((__packed__)) + BAP_LINK_DROP_QUERY_RESPONSE_PACKET; + +typedef struct BAP_CALL_STATUS_INDICATION_PACKET + { + PPP_HEADER ppp_header; + BYTE_ENUM (BAP_PACKET_TYPE) bap_type; + BYTE bap_id; + USHORT bap_length; + BAP_CALL_STATUS_OPTION bap_call_status_option; + /* OPTION: Phone Delta Options */ + }__attribute__((__packed__)) + BAP_CALL_STATUS_INDICATION_PACKET; + +typedef struct BAP_CALL_STATUS_RESPONSE_PACKET + { + PPP_HEADER ppp_header; + BYTE_ENUM (BAP_PACKET_TYPE) bap_type; + BYTE bap_id; + USHORT bap_length; + BYTE_ENUM(BAP_RESPONSE_CODE) bap_response_code; + }__attribute__((__packed__)) + BAP_CALL_STATUS_RESPONSE_PACKET; + + +typedef struct BAP_HEADER + { + BYTE_ENUM (BAP_PACKET_TYPE) code; + BYTE id; + USHORT length; + }__attribute__((__packed__)) + BAP_HEADER; + +typedef struct BAP_PACKET + { + PPP_HEADER ppp_header; + BAP_HEADER bap_header; + BAP_TLV_OPTION option; + }__attribute__((__packed__)) + BAP_PACKET; + + +typedef struct PPP_BAP_STATISTICS + { + ULONG number_of_tx_packets; + ULONG number_of_tx_bytes; + ULONG number_of_rx_packets; + ULONG number_of_rx_bytes; + ULONG number_of_packets_rxed_greater_than_maximum_size; + ULONG number_of_packets_rxed_less_than_minimum_size; + ULONG number_of_control_tx_packets[NUMBER_OF_BAP_PACKET_TYPES]; + ULONG number_of_control_rx_packets[NUMBER_OF_BAP_PACKET_TYPES]; + } PPP_BAP_STATISTICS; + + + +/****************************************************************/ +/* BAP and PORT MANAGER RELATED DEFINES AND STRUCTURES ***/ +/****************************************************************/ + +enum BAP_TEST + { + BAP_PASS = 0x00, + BAP_FAIL = 0x01, + BAP_NO_LINK_AVAILABLE = 0x02, + BAP_CALL_REQUEST_ALREADY_IN_PROGRESS = 0x03, + BAP_CALLBACK_REQUEST_ALREADY_IN_PROGRESS = 0x04, + BAP_CALL_STATUS_INDICATION_ALREADY_IN_PROGRESS = 0x05, + BAP_LINK_DROP_ALREADY_IN_PROGRESS = 0x06, + BAP_INVALID_REQUEST = 0x07, + BAP_NO_MEMORY = 0x08, + BAP_PROTOCOL_NOT_UP = 0x09, + BAP_CALL_REQUEST_ACCEPTED = 0x0a, + BAP_CALL_REQUEST_IN_PROGRESS = 0x0b, + BAP_FAIL2 = 0x0f, + BAP_LINK_DROP_ACCEPTED = 0x10 + } BAP_TEST; + + +typedef struct BAP_BUFFER_LINK + { + struct BAP_BUFFER *sptr_forward_link; + struct BAP_BUFFER *sptr_backward_link; + } BAP_BUFFER_LINK; + +typedef struct BAP_ACTIVE_PORT_LINK + { + struct BAP_ACTIVE_PORT *sptr_forward_link; + struct BAP_ACTIVE_PORT *sptr_backward_link; + } BAP_ACTIVE_PORT_LINK; + + +typedef struct BAP_BUFFER + { + BAP_BUFFER_LINK links; + enum BAP_TEST status; + SL_LIST port_list; + USHORT packet_length; + M_BLK_ID bap; + } BAP_BUFFER; + + +typedef struct BAP_ACTIVE_PORT + { + BAP_ACTIVE_PORT_LINK links; + USHORT port_number; + BYTE_ENUM(BAP_LINK_TYPES) port_bap_type; + ULONG port_speed; + USHORT port_bacp_local_discr; + USHORT port_bacp_remote_discr; + BOOLEAN bacpAdded; + PFW_STACK_OBJ * linkStackObj; + } BAP_ACTIVE_PORT; + + +/* baptimer.c */ + +extern STATUS retry_bap_call_request (PFW_PLUGIN_OBJ_STATE *, int id); +extern STATUS retry_bap_callback_request (PFW_PLUGIN_OBJ_STATE *, int id); +extern STATUS retry_bap_link_drop_request (PFW_PLUGIN_OBJ_STATE *, int id); +extern STATUS retry_bap_status_indication (PFW_PLUGIN_OBJ_STATE *, int id); + +extern void free_active_port (LINK * ptr_linked_list, + BAP_ACTIVE_PORT *active_port); + +extern void free_bap_buffer (LINK * ptr_linked_list, BAP_BUFFER * bap_buffer); + + + +/* pppbaprx.c */ + +extern TEST bap_packet_received (PFW_PLUGIN_OBJ_STATE * pluginState, + M_BLK_ID packet); +#ifdef __cplusplus +} +#endif + +#endif /* __INCvbapstrh */ diff --git a/h/private/ppp/vlcpstr.h b/h/private/ppp/vlcpstr.h new file mode 100644 index 0000000..bcb4e8a --- /dev/null +++ b/h/private/ppp/vlcpstr.h @@ -0,0 +1,485 @@ +/* vlcpstr.h - LCP structure definitions */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01e,28may02,rvr fixed the structure MAGIC_NUMBER_OPTION to remove extra + _WRS_PACK_ALIGN(x) +01d,16dec01,mk added macro _WRS_PACK_ALIGN(x) +01c,07dec01,mk added macros _WRS_PACK_ALIGN(x),to fix alignment + problems for PPP for arm +01f,29sep00,sj merging with TOR2_0-WINDNET_PPP-CUM_PATCH_2 +01e,01aug00,adb Merging with openstack view +01d,11jul00,md added AUTHENTICATION_ATTRIBUTES structure +01c,10jan00,sj changed magic in echo packets to a byte array(CSCO VPN WS find) +01b,10nov99,sj include vpppstr.h +01a,28sep99,sj derived from routerware source base +*/ +/* +*$Log:: /Rtrware/devdrvrs/ppp/vlcpstr $ + * + * 7 10/01/98 11:43a Alex + * Updated the PPP source code to conform + * to a single build. + * + * 6 4/30/98 3:03p Alex + * Ppp v4.2.0 check in + * + * 1 4/24/98 12:10a Release Engineer + * code cleanup, code style changes, + * linted, system level test + * PPP v4.2.0 +*/ + +#ifndef __INCvlcpstrh +#define __INCvlcpstrh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "ppp/kstart.h" +#include "ppp/kppp.h" +#include "private/ppp/vpppstr.h" +#include "pfw/pfw.h" + +typedef enum + { + RESERVED, + USER_NAME_PASSWORD_EXCHANGE, + PPP_CHAP, + PPP_PAP, + NO_AUTHENTICATION, + MS_CHAP_VER_1, + NUMBER_OF_PROXY_AUTHEN + } PROXY_AUTHEN_TYPE; + +typedef struct AUTHENTICATION_ATTRIBUTES + { + UINT8 proxyAuthenID; + BYTE_ENUM(PROXY_AUTHEN_TYPE) proxyAuthenType; + UINT8 proxyAuthenNameLen; + char proxyAuthenName[NAME_SIZE]; + UINT8 proxyAuthenChallengeLen; + char proxyAuthenChallenge[CHALLENGE_VALUE_SIZE]; + UINT8 proxyAuthenResponseLen; + char proxyAuthenResponse[RESPONSE_VALUE_SIZE]; + UINT8 proxyAuthenPasswordLen; + char proxyAuthenPassword[NAME_SIZE]; + } AUTHENTICATION_ATTRIBUTES; + +typedef enum + { + LCP_MAXIMUM_RECEIVE_UNIT = 0x01, + LCP_ASYNC_CONTROL_CHARACTER_MAP = 0x02, + LCP_AUTHENTICATION_PROTOCOL = 0x03, + LCP_QUALITY_PROTOCOL = 0x04, + LCP_MAGIC_NUMBER = 0x05, + LCP_PROTOCOL_FIELD_COMPRESSION = 0x07, + LCP_ADDRESS_AND_CONTROL_FIELD_COMPRESSION = 0x08, + LCP_FCS_ALTERNATIVES = 0x09, + LCP_SELF_DESCRIBING_PADDING = 0x0a, + LCP_NUMBERED_MODE = 0x0b, + LCP_MULTILINK_PROCEDURE = 0x0c, + LCP_CALLBACK = 0x0d, + LCP_CONNECT_TIME = 0x0e, + LCP_COMPOUND_FRAMES = 0x0f, + LCP_NOMINAL_DATA_ENCAPSULATION = 0x10, + LCP_MULTILINK_MAXIMUM_RECEIVED_RECONSTRUCTED_UNIT = 0x11, + LCP_MULTILINK_SHORT_SEQUENCE_NUMBER_HEADER_FORMAT = 0x12, + LCP_ENDPOINT_DISCRIMINATOR = 0x13, +#define BACP_LCP_LINK_DISCRIMINATOR_LENGTH 2 /* length of discriminator only */ + LCP_LINK_DISCRIMINATOR = 0x17, + NUMBER_OF_LCP_OPTIONS + }LCP_OPTION_TYPE; + +typedef struct PROTOCOL_FIELD_COMPRESSION + { + BYTE_ENUM (LCP_OPTION_TYPE) type; + USHORT length; + } PROTOCOL_FIELD_COMPRESSION; + +typedef struct ADDRESS_AND_CONTROL_FIELD_COMPRESSION + { + BYTE_ENUM (LCP_OPTION_TYPE) type; + USHORT length; + } ADDRESS_AND_CONTROL_FIELD_COMPRESSION; + +typedef struct PPP_LCP_STATISTICS + { + ULONG number_of_tx_packets; + ULONG number_of_tx_bytes; + ULONG number_of_rx_packets; + ULONG number_of_rx_bytes; + ULONG number_of_packets_rxed_greater_than_maximum_size; + ULONG number_of_packets_rxed_less_than_minimum_size; + ULONG number_of_control_tx_packets[NUMBER_OF_PPP_CONTROL_CODES]; + ULONG number_of_control_rx_packets[NUMBER_OF_PPP_CONTROL_CODES]; + } PPP_LCP_STATISTICS; + +typedef struct LINK_QUALITY_REPORT + { + PPP_HEADER header; + ULONG magic_number; + ULONG LastOutLQRs; + ULONG LastOutPackets; + ULONG LastOutOctets; + ULONG PeerInLQRs; + ULONG PeerInPackets; + ULONG PeerInDiscards; + ULONG PeerInErrors; + ULONG PeerInOctets; + ULONG PeerOutLQRs; + ULONG PeerOutPackets; + ULONG PeerOutOctets; + ULONG SaveInLQRs; + ULONG SaveInPackets; + ULONG SaveInDiscards; + ULONG SaveInErrors; + ULONG SaveInOctets; + } _WRS_PACK_ALIGN(1) LINK_QUALITY_REPORT; + +typedef struct PPP_LCP_MIBS + { + ULONG pppLinkStatusPhysicalIndex; + ULONG pppLinkStatusBadAddresses; + ULONG pppLinkStatusBadControls; + ULONG pppLinkStatusPacketTooLongs; + ULONG pppLinkStatusBadFCSs; + ULONG pppLinkStatusLocalMRU; + ULONG pppLinkStatusRemoteMRU; + ULONG pppLinkStatusLocalToPeerACCMap; + ULONG pppLinkStatusPeerToLocalACCMap; + ULONG pppLinkStatusLocalToRemoteProtocolCompression; + ULONG pppLinkStatusRemoteToLocalProtocolCompression; + ULONG pppLinkStatusLocalToRemoteACCompression; + ULONG pppLinkStatusRemoteToLocalACCompression; + ULONG pppLinkStatusTransmitFcsSize; + ULONG pppLinkStatusReceiveFcsSize; + ULONG pppRemoteAuthenticationProtocol; + ULONG pppLocalAuthenticationProtocol; + ULONG pppLinkConfigInitialMRU; + ULONG pppLinkConfigReceiveACCMap; + ULONG pppLinkConfigTransmitACCMap; + ULONG pppLinkConfigMagicNumber; + ULONG pppLinkConfigFcsSize; + ULONG pppLqrQuality; + ULONG pppLqrInGoodOctets; + ULONG pppLqrLocalPeriod; + ULONG pppLqrRemotePeriod; + ULONG pppLqrOutLQRs; + ULONG pppLqrInLQRs; + ULONG pppLqrConfigPeriod; + ULONG pppLqrConfigStatus; + + LINK_QUALITY_REPORT pppLqrExtnsLastReceivedLqrPacket; + } PPP_LCP_MIBS; + +typedef struct PROTOCOL_REJECT_HEADER + { + USHORT_ENUM (PPP_PROTOCOL_TYPE) protocol; + BYTE information[MAXIMUM_PACKET_LENGTH]; + } _WRS_PACK_ALIGN(1) PROTOCOL_REJECT_HEADER; + +typedef struct MRU_OPTION + { + BYTE_ENUM (LCP_OPTION_TYPE) type; + BYTE length; + USHORT maximum_receive_unit; + } _WRS_PACK_ALIGN(1) MRU_OPTION; + +typedef struct ASYNC_CONTROL_CHARACTER_MAP_OPTION + { + BYTE_ENUM (LCP_OPTION_TYPE) type; + BYTE length; + ULONG async_control_character_map; + } _WRS_PACK_ALIGN(1) ASYNC_CONTROL_CHARACTER_MAP_OPTION; + +typedef struct AUTHENTICATION_OPTION + { + BYTE_ENUM (LCP_OPTION_TYPE) type; + BYTE length; + USHORT_ENUM (PPP_PROTOCOL_TYPE) authentication_protocol; + BYTE_ENUM (AUTHENTICATION_ALGORITHM) algorithm; + } _WRS_PACK_ALIGN(1) AUTHENTICATION_OPTION; + +typedef struct ENCRYPTION_OPTION + { + BYTE_ENUM (LCP_OPTION_TYPE) type; + BYTE length; + USHORT_ENUM (PPP_PROTOCOL_TYPE) encryption_protocol; + } _WRS_PACK_ALIGN(1) ENCRYPTION_OPTION; + +typedef struct MAGIC_NUMBER_OPTION + { + BYTE_ENUM (LCP_OPTION_TYPE) type; + BYTE length; + ULONG magic_number; + } _WRS_PACK_ALIGN(1) MAGIC_NUMBER_OPTION; + +typedef struct LINK_QUALITY_OPTION + { + BYTE_ENUM (LCP_OPTION_TYPE) type; + BYTE length; + USHORT_ENUM (PPP_PROTOCOL_TYPE) quality_protocol; + ULONG reporting_time; + } _WRS_PACK_ALIGN(1) LINK_QUALITY_OPTION; + +typedef struct PROTOCOL_FIELD_COMPRESSION_OPTION + { + BYTE_ENUM (LCP_OPTION_TYPE) type; + BYTE length; + } _WRS_PACK_ALIGN(1) PROTOCOL_FIELD_COMPRESSION_OPTION; + +typedef struct AC_FIELD_COMPRESSION_OPTION + { + BYTE_ENUM (LCP_OPTION_TYPE) type; + BYTE length; + } _WRS_PACK_ALIGN(1) AC_FIELD_COMPRESSION_OPTION; + +typedef struct LCP_OPTIONS_RECEIVED + { + MRU_OPTION MRU_option; + ASYNC_CONTROL_CHARACTER_MAP_OPTION async_control_character_map_option; + AUTHENTICATION_OPTION authentication_option; + ENCRYPTION_OPTION encryption_option; + MAGIC_NUMBER_OPTION magic_number_option; + LINK_QUALITY_OPTION link_quality_option; + PROTOCOL_FIELD_COMPRESSION_OPTION protocol_field_compression_option; + AC_FIELD_COMPRESSION_OPTION address_and_control_field_compression_option; + + } LCP_OPTIONS_RECEIVED; + +typedef struct GENERIC_OPTION + { + BYTE type; + BYTE length; + + BYTE data[VARIABLE_NUMBER_OF_BYTES]; + } _WRS_PACK_ALIGN(1) GENERIC_OPTION; + +typedef union UNION_LCP_OPTIONS + { + MRU_OPTION MRU_option; + ASYNC_CONTROL_CHARACTER_MAP_OPTION async_control_character_map_option; + AUTHENTICATION_OPTION authentication_option; + ENCRYPTION_OPTION encryption_option; + MAGIC_NUMBER_OPTION magic_number_option; + LINK_QUALITY_OPTION link_quality_option; + PROTOCOL_FIELD_COMPRESSION_OPTION protocol_field_compression_option; + AC_FIELD_COMPRESSION_OPTION address_and_control_field_compression_option; + + }_WRS_PACK_ALIGN(1) UNION_LCP_OPTIONS; + +typedef struct LCP_HEADER + { + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + } _WRS_PACK_ALIGN(1) LCP_HEADER; + +typedef struct LCP_PACKET + { + PPP_HEADER ppp_header; + LCP_HEADER lcp_header; + /* UNION_LCP_OPTIONS options;*/ + GENERIC_OPTION options; + } _WRS_PACK_ALIGN(1) LCP_PACKET; + +typedef void (*FPTR_LCP_PACKET_RECEIVED) + ( + PFW_PLUGIN_OBJ_STATE * pluginState, + M_BLK_ID packet + ); + +typedef struct LCP_CONFIGURE_REQUEST + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + MRU_OPTION MRU_option; + ASYNC_CONTROL_CHARACTER_MAP_OPTION async_control_character_map_option; + AUTHENTICATION_OPTION authentication_option; + ENCRYPTION_OPTION encryption_option; + MAGIC_NUMBER_OPTION magic_number_option; + LINK_QUALITY_OPTION link_quality_option; + PROTOCOL_FIELD_COMPRESSION_OPTION protocol_field_compression_option; + AC_FIELD_COMPRESSION_OPTION address_and_control_field_compression_option; + + } _WRS_PACK_ALIGN(1) LCP_CONFIGURE_REQUEST; + +typedef struct LCP_CONFIGURE_REQUEST_PACKET + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + /* UNION_LCP_OPTIONS options;*/ + GENERIC_OPTION options; + } _WRS_PACK_ALIGN(1) LCP_CONFIGURE_REQUEST_PACKET; + +typedef struct CONFIGURE_ACK_PACKET + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + /* UNION_LCP_OPTIONS union_lcp_options[VARIABLE_NUMBER_OF_BYTES];*/ + GENERIC_OPTION options; + } _WRS_PACK_ALIGN(1) CONFIGURE_ACK_PACKET; + +typedef struct CONFIGURE_NAK_PACKET + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + /* UNION_LCP_OPTIONS options;*/ + GENERIC_OPTION options; + } _WRS_PACK_ALIGN(1) CONFIGURE_NAK_PACKET; + +typedef struct CONFIGURE_REJECT_PACKET + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + /* UNION_LCP_OPTIONS options;*/ + GENERIC_OPTION options; + } _WRS_PACK_ALIGN(1) CONFIGURE_REJECT_PACKET; + +typedef struct TERMINATE_REQUEST + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + } _WRS_PACK_ALIGN(1) TERMINATE_REQUEST; + +typedef struct TERMINATE_ACK + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + } _WRS_PACK_ALIGN(1) TERMINATE_ACK; + +typedef struct CODE_REJECT_PACKET + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + LCP_PACKET rejected_packet; + } _WRS_PACK_ALIGN(1) CODE_REJECT_PACKET; + +typedef struct PROTOCOL_REJECT_PACKET + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + PROTOCOL_REJECT_HEADER rejected_protocol_and_information; + } _WRS_PACK_ALIGN(1) PROTOCOL_REJECT_PACKET; + +typedef struct ECHO_REQUEST_PACKET + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + /*ULONG magic_number;*/ + BYTE magic_number[4]; + } _WRS_PACK_ALIGN(1) ECHO_REQUEST_PACKET; + +typedef struct ECHO_REPLY_PACKET + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + /*ULONG magic_number;*/ + BYTE magic_number[4]; + } _WRS_PACK_ALIGN(1) ECHO_REPLY_PACKET; + +typedef struct DISCARD_REQUEST_PACKET + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + ULONG magic_number; + } _WRS_PACK_ALIGN(1) DISCARD_REQUEST_PACKET; + +typedef struct LINK_QUALITY_COUNTERS + { + ULONG OutLQRs; + ULONG InLQRs; + ULONG InGoodOctets; + ULONG ifInOctets; + ULONG ifInErrors; + ULONG ifInDiscards; + ULONG ifOutOctets; + ULONG ifOutUniPackets; + ULONG ifInUniPackets; + } LINK_QUALITY_COUNTERS; + +typedef struct IDENTIFICATION_PACKET + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + ULONG magic_number; + char message[VARIABLE_NUMBER_OF_BYTES]; + } _WRS_PACK_ALIGN(1) IDENTIFICATION_PACKET; + +typedef struct TIME_REMAINING_PACKET + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + ULONG magic_number; + ULONG seconds_remaining; + char message[VARIABLE_NUMBER_OF_BYTES]; + } _WRS_PACK_ALIGN(1) TIME_REMAINING_PACKET; + +typedef struct CALLBACK_PACKET + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + BYTE_ENUM (CALLBACK_OPERATION) operation; + char message[VARIABLE_NUMBER_OF_BYTES]; + } _WRS_PACK_ALIGN(1) CALLBACK_PACKET; + +#define LCP_PACKET_HEADER_SIZE (sizeof(PPP_HEADER) + sizeof(LCP_HEADER)) + +/* lcptimer.c */ + +extern STATUS retry_lcp_configure_request (PFW_PLUGIN_OBJ_STATE * ,int backOff); +extern STATUS retry_lcp_termination_request (PFW_PLUGIN_OBJ_STATE *,int arg); +extern STATUS periodic_lcp_echo_request (PFW_PLUGIN_OBJ_STATE * , int arg); + +extern void send_lcp_time_remaining_packet (PFW_PLUGIN_OBJ_STATE * pluginState); + +extern void send_lcp_link_quality_report (PFW_PLUGIN_OBJ_STATE * pluginState); +extern void send_lcp_id_packet (PFW_PLUGIN_OBJ_STATE * pluginState); + +/* ppplcprx.c */ + +extern TEST lcp_packet_received (PFW_PLUGIN_OBJ_STATE * pluginState, + M_BLK_ID packet); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvlcpstrh */ diff --git a/h/private/ppp/vncpstr.h b/h/private/ppp/vncpstr.h new file mode 100644 index 0000000..fc72f64 --- /dev/null +++ b/h/private/ppp/vncpstr.h @@ -0,0 +1,199 @@ +/* vncpstr.h - NCP structure definitions */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01d,07jun02,vk moved FPTR_NCP_PACKET_RECEIVED function declaration + to pppNcpLibP.h +01c,20dec01,mk added macros _WRS_PACK_ALIGN(x) +01b,07dec01,mk added macros _WRS_PACK_ALIGN(x),to fix alignment + problems for PPP for arm, +01a,130ct99,sgv derived from routerware source base +*/ + +/* +*$Log:: /Rtrware/devdrvrs/ppp/vncpstr $ + * + * 7 10/01/98 11:43a Alex + * Updated the PPP source code to conform + * to a single build. + * + * 6 4/30/98 3:03p Alex + * Ppp v4.2.0 check in + * + * 1 4/24/98 12:10a Release Engineer + * code cleanup, code style changes, + * linted, system level test + * PPP v4.2.0 +*/ + +#ifndef __INCvncpstrh +#define __INCvncpstrh + +#include "ppp/kstart.h" +#include "ppp/kppp.h" + + +typedef struct NCP_HEADER + { + BYTE_ENUM (PPP_CONTROL_CODE) code; + + BYTE id; + USHORT length; +} _WRS_PACK_ALIGN(1) NCP_HEADER; + +/* This is declared in vlcpstr.h */ +#if 0 +typedef struct GENERIC_OPTION +{ + BYTE type; + BYTE length; + + BYTE data[VARIABLE_NUMBER_OF_BYTES]; +} GENERIC_OPTION; +#endif + +typedef struct NCP_PACKET +{ + PPP_HEADER ppp_header; + NCP_HEADER ncp_header; +} _WRS_PACK_ALIGN(1) NCP_PACKET; + +#define NCP_PACKET_HEADER_SIZE (sizeof(PPP_HEADER) + sizeof(NCP_HEADER)) + +typedef struct NCP_CONFIGURE_REQUEST +{ + PPP_HEADER ppp_header; + + NCP_HEADER ncp_header; + + GENERIC_OPTION options; +} _WRS_PACK_ALIGN(1) NCP_CONFIGURE_REQUEST; + +typedef struct NCP_CONFIGURE_ACK +{ + PPP_HEADER ppp_header; + + NCP_HEADER ncp_header; +} _WRS_PACK_ALIGN(1) NCP_CONFIGURE_ACK; + +typedef struct NCP_CONFIGURE_NAK +{ + PPP_HEADER ppp_header; + + NCP_HEADER ncp_header; + GENERIC_OPTION options; +} _WRS_PACK_ALIGN(1) NCP_CONFIGURE_NAK; + +typedef struct NCP_CONFIGURE_REJECT +{ + PPP_HEADER ppp_header; + + NCP_HEADER ncp_header; + GENERIC_OPTION options; +} _WRS_PACK_ALIGN(1) NCP_CONFIGURE_REJECT; + +typedef struct NCP_TERMINATE_REQUEST +{ + PPP_HEADER ppp_header; + + NCP_HEADER ncp_header; +} _WRS_PACK_ALIGN(1) NCP_TERMINATE_REQUEST; + +typedef struct NCP_TERMINATE_ACK +{ + PPP_HEADER ppp_header; + + NCP_HEADER ncp_header; +} _WRS_PACK_ALIGN(1) NCP_TERMINATE_ACK; + +typedef struct NCP_CODE_REJECT_PACKET +{ + PPP_HEADER ppp_header; + + NCP_HEADER ncp_header; + NCP_PACKET rejected_packet; +} _WRS_PACK_ALIGN(1) NCP_CODE_REJECT_PACKET; + +typedef struct NCP_PACKET_WITH_OPTIONS +{ + PPP_HEADER ppp_header; + + NCP_HEADER ncp_header; + + GENERIC_OPTION options; +} _WRS_PACK_ALIGN(1) NCP_PACKET_WITH_OPTIONS; + +typedef union UNION_NCP_GENERIC_PACKET +{ + NCP_CONFIGURE_REQUEST configure_request; + NCP_CONFIGURE_ACK configure_ack; + NCP_CONFIGURE_NAK configure_nak; + NCP_CONFIGURE_REJECT configure_reject; + NCP_TERMINATE_REQUEST terminate_request; + NCP_TERMINATE_ACK terminate_ack; + NCP_CODE_REJECT_PACKET reject; + NCP_PACKET_WITH_OPTIONS packet_with_options; +} _WRS_PACK_ALIGN(1) UNION_NCP_GENERIC_PACKET; + +typedef struct PPP_NCP_STATISTICS +{ + ULONG number_of_tx_packets; + ULONG number_of_tx_bytes; + + ULONG number_of_rx_packets; + ULONG number_of_rx_bytes; + + ULONG number_of_packets_rxed_greater_than_maximum_size; + ULONG number_of_packets_rxed_less_than_minimum_size; + ULONG number_of_packets_rxed_in_down_port; + + ULONG number_of_tx_control_packets[NUMBER_OF_PPP_CONTROL_CODES]; + ULONG number_of_rx_control_packets[NUMBER_OF_PPP_CONTROL_CODES]; + +} PPP_NCP_STATISTICS; + +typedef union UNION_NCP_OPTIONS +{ + IPCP_OPTIONS ip; +#if 0 + IPXCP_OPTIONS ipx; + ATCP_OPTIONS appletalk; +#endif +} UNION_NCP_OPTIONS; + +typedef union UNION_NCP_OPTION_TYPES +{ + BYTE_ENUM (IPCP_OPTION_TYPE) ipcp; +#if 0 + BYTE_ENUM (ATCP_OPTION_TYPE) atcp; + BYTE_ENUM (IPXCP_OPTION_TYPE) ipxcp; +#endif + BYTE generic; +} UNION_NCP_OPTION_TYPES; + +typedef union UNION_NCP_PACKET +{ + UNION_IPCP_PACKET ip; +#if 0 + UNION_IPXCP_PACKET ipx; + UNION_ATCP_PACKET appletalk; +#endif + UNION_NCP_GENERIC_PACKET generic; +} UNION_NCP_PACKET; + +typedef struct VJC_OPTION +{ + USHORT vjc_code; + BYTE maximum_slot_id; + BYTE compression_slot_id; +} _WRS_PACK_ALIGN(1) VJC_OPTION; + + + +#endif /* __INCvncpstrh */ + diff --git a/h/private/ppp/vnipstr.h b/h/private/ppp/vnipstr.h new file mode 100644 index 0000000..7e17659 --- /dev/null +++ b/h/private/ppp/vnipstr.h @@ -0,0 +1,222 @@ +/* vnipstr.h - IPCP definitions file */ + +/* Copyright (C) 1999-2003 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01d,22jul03,rp adding/updating copyright notice +01c,20dec01,mk added macros _WRS_PACK_ALIGN(x) +01b,07dec01,mk added macros _WRS_PACK_ALIGN(x),to fix alignment + problems for PPP for arm +01a,12oct99,sgv derived from routerware source base +*/ + +#ifndef __INCvnipstrh +#define __INCvnipstrh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* +*$Log:: /Rtrware/devdrvrs/ppp/vnipstr $ + * + * 7 10/01/98 11:43a Alex + * Updated the PPP source code to conform + * to a single build. + * + * 6 4/30/98 3:03p Alex + * Ppp v4.2.0 check in + * + * 1 4/24/98 12:10a Release Engineer + * code cleanup, code style changes, + * linted, system level test + * PPP v4.2.0 +*/ + +typedef struct IP_OPTIONS_BOOLEAN +{ + BYTE_ENUM (BOOLEAN) compression; + BYTE_ENUM (BOOLEAN) address; +} IP_OPTIONS_BOOLEAN; + +typedef struct PPP_IP_CONFIGURATION +{ + IP_OPTIONS_BOOLEAN enabled; + + IP_OPTIONS_BOOLEAN remote_enabled; + + USHORT_ENUM (PPP_PROTOCOL_TYPE) compression_protocol; + + BYTE maximum_slot_id; + BYTE compression_slot_id; + + USHORT_ENUM (PPP_PROTOCOL_TYPE) remote_compression_protocol; + + ULONG my_ip_address; + ULONG remote_ip_address; +} PPP_IP_CONFIGURATION; + +typedef struct VAN_JACOBSON_HEADER_COMPRESSION_OPTION +{ + BYTE_ENUM (IPCP_OPTION_TYPE) type; + USHORT length; + + USHORT_ENUM (PPP_PROTOCOL_TYPE) ip_compression_protocol; + BYTE maximum_slot_id; + BYTE compressed_slot_id; +} _WRS_PACK_ALIGN(1) VAN_JACOBSON_HEADER_COMPRESSION_OPTION; + +typedef struct PPP_IPCP_MIBS +{ + ULONG pppIpOperStatus; + ULONG pppIpLocalToRemoteCompressionProtocol; + ULONG pppIpRemoteToLocalCompressionProtocol; + ULONG pppIpRemoteMaxSlotId; + ULONG pppIpLocalMaxSlotId; + + ULONG pppIpConfigAdminStatus; + ULONG pppIpConfigCompression; +} PPP_IPCP_MIBS; + +typedef struct IP_COMPRESSION_OPTION +{ + BYTE_ENUM (IPCP_OPTION_TYPE) type; + BYTE length; + USHORT_ENUM (PPP_PROTOCOL_TYPE) ip_compression_protocol; +} _WRS_PACK_ALIGN(1) IP_COMPRESSION_OPTION; + +typedef struct IP_ADDRESS_OPTION +{ + BYTE_ENUM (IPCP_OPTION_TYPE) type; + BYTE length; + ULONG ip_address; +} _WRS_PACK_ALIGN(1) IP_ADDRESS_OPTION; + +typedef struct GENERIC_IPCP_OPTION +{ + BYTE_ENUM (IPCP_OPTION_TYPE) type; + BYTE length; +} _WRS_PACK_ALIGN(1) GENERIC_IPCP_OPTION; + +typedef union UNION_IPCP_OPTIONS +{ + GENERIC_IPCP_OPTION generic; + IP_COMPRESSION_OPTION ip_compression_option; + IP_ADDRESS_OPTION ip_address_option; + VAN_JACOBSON_HEADER_COMPRESSION_OPTION vj_compression_option; +}_WRS_PACK_ALIGN(1) UNION_IPCP_OPTIONS; + +typedef struct IPCP_OPTIONS +{ + IP_COMPRESSION_OPTION compression; + IP_ADDRESS_OPTION address; +} _WRS_PACK_ALIGN(1) IPCP_OPTIONS; + +typedef struct IPCP_CONFIGURE_REQUEST +{ + PPP_HEADER header; + + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + + UNION_IPCP_OPTIONS union_ipcp_options[VARIABLE_NUMBER]; +} _WRS_PACK_ALIGN(1) IPCP_CONFIGURE_REQUEST; + +typedef struct IPCP_CONFIGURE_ACK +{ + PPP_HEADER header; + + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + + UNION_IPCP_OPTIONS union_ipcp_options[VARIABLE_NUMBER]; +} _WRS_PACK_ALIGN(1) IPCP_CONFIGURE_ACK; + +typedef struct IPCP_CONFIGURE_NAK +{ + PPP_HEADER header; + + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + + UNION_IPCP_OPTIONS union_ipcp_options[VARIABLE_NUMBER]; +} _WRS_PACK_ALIGN(1) IPCP_CONFIGURE_NAK; + +typedef struct IPCP_CONFIGURATION_REJECT +{ + PPP_HEADER header; + + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + + UNION_IPCP_OPTIONS union_ipcp_options[VARIABLE_NUMBER]; +} _WRS_PACK_ALIGN(1) IPCP_CONFIGURATION_REJECT; + +typedef struct IPCP_TERMINATE_REQUEST +{ + PPP_HEADER header; + + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; +} _WRS_PACK_ALIGN(1) IPCP_TERMINATE_REQUEST; + +typedef struct IPCP_TERMINATE_ACK +{ + PPP_HEADER header; + + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; +} _WRS_PACK_ALIGN(1) IPCP_TERMINATE_ACK; + +typedef struct IPCP_CODE_REJECT_PACKET +{ + PPP_HEADER header; + + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + BYTE rejected_packet[VARIABLE_NUMBER_OF_BYTES]; + +} _WRS_PACK_ALIGN(1) IPCP_CODE_REJECT_PACKET; + +typedef struct IPCP_PACKET +{ + PPP_HEADER header; + + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + + UNION_IPCP_OPTIONS options; +} _WRS_PACK_ALIGN(1) IPCP_PACKET; + +typedef union UNION_IPCP_PACKET +{ + IPCP_PACKET generic; + IPCP_CONFIGURE_REQUEST configure_request; + IPCP_CONFIGURE_ACK configuration_ack; + IPCP_CONFIGURE_NAK configuration_nak; + IPCP_CONFIGURATION_REJECT configuration_reject; + IPCP_TERMINATE_REQUEST terminate_request; + IPCP_TERMINATE_ACK terminate_ack; + IPCP_CODE_REJECT_PACKET reject; +}_WRS_PACK_ALIGN(1) UNION_IPCP_PACKET; + +void initialize_ip_ncp (PFW_PLUGIN_OBJ_STATE * pluginState); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvnipstrh */ diff --git a/h/private/ppp/vpppastr.h b/h/private/ppp/vpppastr.h new file mode 100644 index 0000000..d203263 --- /dev/null +++ b/h/private/ppp/vpppastr.h @@ -0,0 +1,131 @@ +/* vpppastr.h - PPP Auth protocol structure definitions */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01c,07dec01,mk added macros _WRS_PACK_ALIGN(x),to fix alignment + problems for PPP for arm +01b,08mar00,sj added "padding" byte to CHAP ACK and NAK messages for allignment +01a,05nov99,sj derived from routerware source base +*/ + +#ifndef __INCvpppastrh +#define __INCvpppastrh + +#include "ppp/kstart.h" +#include "ppp/kppp.h" +#include "private/ppp/vpppstr.h" +#include "private/ppp/vlcpstr.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* +*$Log:: /Rtrware/devdrvrs/ppp/vpppast $ + * + * 8 10/01/98 11:43a Alex + * Updated the PPP source code to conform + * to a single build. + * + * 7 4/30/98 3:03p Alex + * Ppp v4.2.0 check in + * + * 1 4/24/98 12:10a Release Engineer + * code cleanup, code style changes, + * linted, system level test + * PPP v4.2.0 +*/ +typedef struct AUTHENTICATION_REQUEST_PACKET + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + BYTE peer_id_length; + char peer_id[MAXIMUM_STRING_LENGTH]; + BYTE peer_password_length; + char peer_password[MAXIMUM_STRING_LENGTH]; + } _WRS_PACK_ALIGN(1) AUTHENTICATION_REQUEST_PACKET; + +typedef struct AUTHENTICATION_ACK_PACKET + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + BYTE message_length; + BYTE padding; + char message[MAXIMUM_STRING_LENGTH]; + } _WRS_PACK_ALIGN(1) AUTHENTICATION_ACK_PACKET; + +typedef struct AUTHENTICATION_NAK_PACKET + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + BYTE message_length; + BYTE padding; + char message[MAXIMUM_STRING_LENGTH]; + } _WRS_PACK_ALIGN(1) AUTHENTICATION_NAK_PACKET; + +typedef struct PAP_PACKET + { + PPP_HEADER ppp_header; + LCP_HEADER lcp_header; + } _WRS_PACK_ALIGN(1) PAP_PACKET; + +typedef union UNION_CHAP_VALUE + { + BYTE challenge[CHALLENGE_VALUE_SIZE]; + BYTE response[RESPONSE_VALUE_SIZE]; + } UNION_CHAP_VALUE; + +typedef struct CHAP_PACKET + { + PPP_HEADER ppp_header; + LCP_HEADER lcp_header; + BYTE value_size; + BYTE value[CHALLENGE_VALUE_SIZE]; + char name[VARIABLE_NUMBER_OF_BYTES]; + } _WRS_PACK_ALIGN(1) CHAP_PACKET; + +typedef struct PPP_AUTHENTICATION_STATISTICS + { + ULONG number_of_tx_packets; + ULONG number_of_tx_bytes; + ULONG number_of_rx_packets; + ULONG number_of_rx_bytes; + } PPP_AUTHENTICATION_STATISTICS; + +typedef struct PPP_SECURITY_MIBS + { + ULONG pppSecurityConfigLink; + ULONG pppSecurityConfigPreference; + BYTE pppSecurityConfigProtocol[20]; + USHORT pppSecurtiyConfigStatus; + ULONG pppSecuritySecretsLink; + ULONG pppSecuritySecretsIdIndex; + USHORT pppSecuritySecretsDirection; + BYTE pppSecuritySecretsProtocol[20]; + USHORT pppSecuritySecretsIdentity; + BYTE pppSecuritySecretsSecret[20]; + USHORT pppSecuritySecretsStatus; + } PPP_SECURITY_MIBS; + +typedef void (*FPTR_AUTH_PACKET_RECEIVED) + ( + PFW_PLUGIN_OBJ_STATE * pluginState, + M_BLK_ID packet + ); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvpppastrh */ diff --git a/h/private/ppp/vpppstr.h b/h/private/ppp/vpppstr.h new file mode 100644 index 0000000..d432d0c --- /dev/null +++ b/h/private/ppp/vpppstr.h @@ -0,0 +1,248 @@ +/* vpppstr.h - PPP structure definitions */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01f,04Feb02,ak redefined option list structures as per the memory reduction + recomendations +01e,07dec01,mk added macros _WRS_PACK_ALIGN(x),to fix alignment + problems for PPP for arm +01d,29sep00,sj merging with TOR2_0-WINDNET_PPP-CUM_PATCH_2 +01c,01aug00,adb Merging with openstack view +01b,11jul00,md fixed type redefinition +01a,28sep99,sj derived from routerware source base +*/ + +/* + *$Log:: /Rtrware/devdrvrs/ppp/vpppstr.h $ + * + * 11 11/20/98 11:36a Nishit + * close_ppp moved to pppinit.c from ppp_winrouter.c; made non-static + * + * 10 11/18/98 7:49a Nishit + * Configurable Booleans are now configed by set_enum_enable + * + * 9 11/17/98 8:41a Nishit + * Added a mapping to lsl_port_number in PPP_PORT_CLASS + * + * 8 10/01/98 11:43a Alex + * Updated the PPP source code to conform to a single build. + * + * 7 9/23/98 5:52p Nishit + * Added support for RADIUS and TACACS + * + * 6 4/30/98 3:03p Alex + * Ppp v4.2.0 check in + * + * 1 4/24/98 12:10a Release Engineer + * code cleanup, code style changes, + * linted, system level test + * PPP v4.2.0 + */ + +#ifndef __INCvpppstrh +#define __INCvpppstrh + +#include "ppp/kstart.h" +#include "ppp/kppp.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define UNNUMBERED_INFORMATION 3 + +typedef union UNION_OPTION_TYPES + { + BYTE_ENUM (LCP_OPTION_TYPE) lcp; + BYTE_ENUM (IPCP_OPTION_TYPE) ipcp; +#if 0 + BYTE_ENUM (ATCP_OPTION_TYPE) atcp; + BYTE_ENUM (IPXCP_OPTION_TYPE) ipxcp; +#endif /* 0 */ + BYTE generic; + } UNION_OPTION_TYPES; + +typedef union UNION_OPTION_DATA_TYPES + { + BYTE_ENUM (BOOLEAN) boolean; + BYTE byte_array[VARIABLE_NUMBER_OF_BYTES]; + ULONG _ulong; + USHORT _ushort; + BYTE _byte; + } UNION_OPTION_DATA_TYPES; + +typedef struct PPP_OPTION + { + UNION_OPTION_TYPES type; + BYTE length; + /*UNION_OPTION_DATA_TYPES data;*/ + BYTE data[1]; + } PPP_OPTION; + +#if !defined _LSLPROTO_H_ +typedef struct LINK + { + struct LINK *sptr_forward_link; + struct LINK *sptr_backward_link; + } LINK; +#endif /* _LSLPROTO_H_ */ + +typedef struct VALUE_TYPE + { + char *cptr_value_type_string; + BYTE_ENUM (BOOLEAN) value_swapped; + BYTE length; + BYTE offset; + } VALUE_TYPE; + +typedef struct ALTERNATE_OPTION_LINK + { + struct ALTERNATE_OPTION *sptr_forward_link; + struct ALTERNATE_OPTION *sptr_backward_link; + } ALTERNATE_OPTION_LINK; + +typedef struct ALTERNATE_OPTION + { + ALTERNATE_OPTION_LINK links; + UNION_OPTION_DATA_TYPES *uptr_data; + int preference; + BYTE length; + } ALTERNATE_OPTION; + +typedef struct rangeOptionHolder + { + UNION_OPTION_DATA_TYPES *uptr_lowest_value; + UNION_OPTION_DATA_TYPES *uptr_highest_value; + UNION_OPTION_DATA_TYPES *uptr_step; + } RANGE_OPTION_HOLDER; + +typedef struct optionFlags + { + BYTE automatic_nak_processing:1; + BYTE negotiation_required:1; + BYTE negotiable:1; + BYTE value_swapped:1; + BYTE alternate_checking_enabled:1; + BYTE range_checking_enabled:1; + } OPTION_FLAGS; + +typedef struct OPTION_LIST_ENTRY + { + struct OPTION_LIST_ENTRY *sptr_forward_link; + struct OPTION_LIST_ENTRY *sptr_backward_link; + char *cptr_option_name; + UNION_OPTION_DATA_TYPES *uptr_data; + ALTERNATE_OPTION_LINK alternate_option_list; + RANGE_OPTION_HOLDER *range_option; + BYTE nak_option_selected; + BYTE_ENUM (OPTION_STATE) state; + UNION_OPTION_TYPES type; + BYTE length; + OPTION_FLAGS option_flags; + } OPTION_LIST_ENTRY; + +typedef struct OPTION_LIST + { + struct OPTION_LIST_ENTRY *sptr_forward_link; + struct OPTION_LIST_ENTRY *sptr_backward_link; + } OPTION_LIST; + +typedef struct OPTION_LISTS + { + OPTION_LIST configured; + OPTION_LIST remote_configured; + OPTION_LIST received; + OPTION_LIST tx_nak; + OPTION_LIST rx_nak; + OPTION_LIST tx_reject; + OPTION_LIST rx_reject; + OPTION_LIST tx_accepted; + OPTION_LIST rx_accepted; + } OPTION_LISTS; + +typedef void (*FPTR_LCP_STATE_FUNCTION) + ( + USHORT real_port_number, + void *vptr_packet, + USHORT number_of_bytes, + PPP_STATE end_state + ); + +typedef TEST (*FPTR_PROCESS_RECEIVE_OPTIONS) + ( + OPTION_LIST_ENTRY *sptr_option, + void *vptr_class + ); + +typedef FPTR_PROCESS_RECEIVE_OPTIONS * RECEIVE_OPTION_FUNCTIONS; + +typedef struct PROTOCOL_STACK_ID_CLASS + { + ULONG id; + } PROTOCOL_STACK_ID_CLASS; + +#if !defined (WAN_CRC_DEFINE) + +#define WAN_CRC_DEFINE + +typedef struct WAN_CRC + { + USHORT crc; + } WAN_CRC; +#endif + +typedef struct PPP_HEADER + { +#if 0 + BYTE hdlc_address; + BYTE_ENUM (LLC_FRAME_TYPE) hdlc_control; +#endif + USHORT_ENUM (PPP_PROTOCOL_TYPE) protocol_type; + } _WRS_PACK_ALIGN(1) PPP_HEADER; + +typedef struct PPP_PACKET_WITH_MAC_HEADER + { + BYTE filler[10]; + PPP_HEADER header; + BYTE protocol_data[1]; + } _WRS_PACK_ALIGN(1) PPP_PACKET_WITH_MAC_HEADER; + +typedef struct PPP_PACKET + { + PPP_HEADER header; + BYTE_ENUM (PPP_CONTROL_CODE) code; + BYTE id; + USHORT length; + BYTE data[VARIABLE_NUMBER_OF_BYTES]; + } _WRS_PACK_ALIGN(1) PPP_PACKET; + +typedef struct PPP_PACKET_WITH_COMPRESSED_ADDRESS_AND_CONTROL + { + USHORT_ENUM (PPP_PROTOCOL_TYPE) protocol_type; + BYTE data[VARIABLE_NUMBER_OF_BYTES]; + } _WRS_PACK_ALIGN(1) PPP_PACKET_WITH_COMPRESSED_ADDRESS_AND_CONTROL; + +typedef struct PPP_PACKET_WITH_COMPRESSED_PROTOCOL_FIELD + { + BYTE hdlc_address; + BYTE_ENUM (LLC_FRAME_TYPE) hdlc_control; + BYTE protocol_type; + BYTE data[VARIABLE_NUMBER_OF_BYTES]; + } _WRS_PACK_ALIGN(1) PPP_PACKET_WITH_COMPRESSED_PROTOCOL_FIELD; + +typedef struct HEADER_COMPRESSED_PPP_PACKET + { + BYTE protocol_type; + BYTE data[VARIABLE_NUMBER_OF_BYTES]; + } _WRS_PACK_ALIGN(1) HEADER_COMPRESSED_PPP_PACKET; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvpppstrh */ diff --git a/h/private/print64Lib.h b/h/private/print64Lib.h new file mode 100644 index 0000000..c25604a --- /dev/null +++ b/h/private/print64Lib.h @@ -0,0 +1,39 @@ +/* print64Lib.h - pretty print 64-bit integers library */ + +/* Copyright 1999-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,20sep01,jkf SPR#69031, common code for both AE & 5.x. +01c,29feb00,jkf T3 merge, cleanup. +01b,31jul99,jkf T2 merge, tidiness & spelling. +01a,29jun98,vld written. +*/ + +#ifndef __INTprint64Libh +#define __INTprint64Libh + +#include "private/dosFsLibP.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* function prototypes */ + +IMPORT void print64Fine ( char * pHeader, fsize_t val, char * pFooter, + u_int radix ); +IMPORT void print64Row ( char * pHeader, fsize_t val, char * pFooter, + u_int radix ); +IMPORT void print64Mult ( char * pHeader, fsize_t val, char * pFooter, + u_int radix ); +IMPORT void print64 ( char * pHeader, fsize_t val, char * pFooter, + u_int radix, u_int groupeSize ); + +#ifdef __cplusplus + } +#endif + +#endif /* __INTprint64Libh */ + diff --git a/h/private/pxObjSysCall.h b/h/private/pxObjSysCall.h new file mode 100644 index 0000000..a242956 --- /dev/null +++ b/h/private/pxObjSysCall.h @@ -0,0 +1,69 @@ +/* pxObjSysCall.h - POSIX system calls */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,17nov03,m_s written +*/ + +#ifndef __INCpxObjSysCallh +#define __INCpxObjSysCallh + +#ifdef __cplusplus +extern "C" { +#endif + +/* typedefs */ + +/* + * Object types for pxOpen and pxUnlink system call. + * Start the enum from 1 since 0 is prone to error. + */ +typedef enum + { + PX_MQ = 1, + PX_SEM + + } PX_OBJ_TYPE; + +/* + * Waiting options. + * Start the enum from 1 since 0 is prone to error. + */ +typedef enum + { + PX_NO_WAIT = 1, + PX_WAIT_FOREVER, + PX_TIMEDWAIT + + } PX_WAIT_OPTION; + +/* + * Command codes for pxCtl system call. + * Start the enum from 1 since 0 is prone to error. + */ +typedef enum + { + PX_MQ_NOTIFY = 1, + PX_MQ_ATTR_GET, + PX_SEM_GETVALUE + + } PX_CTL_CMD_CODE; + + +/* system call function prototypes */ + +extern OBJ_HANDLE pxOpen (PX_OBJ_TYPE objType, const char * name, + int objOpenMode, void * attr); +extern int pxClose (OBJ_HANDLE handle); +extern int pxUnlink (PX_OBJ_TYPE objType, const char * name); +extern STATUS pxCtl (OBJ_HANDLE handle, PX_CTL_CMD_CODE cmdCode, + void * pArgs, UINT * pArgSize); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpxObjSysCallh */ diff --git a/h/private/rtpIoLibP.h b/h/private/rtpIoLibP.h new file mode 100644 index 0000000..3c38214 --- /dev/null +++ b/h/private/rtpIoLibP.h @@ -0,0 +1,52 @@ +/* rtpIoLibP.h - real time process I/O library private header file */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,11may05,hya changed rtpIoSysConstruct prototype, SPR 109163 +01d,04mar04,dat merge rtpIo with iosLib, new rtpIoFdSetup() +01c,12nov03,pmr rtpIoDefPathSet/Get. +01b,10nov03,pmr fix rtpIoFdEntryGet(). +01a,31oct03,pmr written. +*/ + +#ifndef __INCrtpIoLibPh +#define __INCrtpIoLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "rtpLibCommon.h" +#include "private/iosLibP.h" +#include "rtpIoLib.h" + +#ifndef _ASMLANGUAGE + +/* PRIVATE function prototypes */ + +IMPORT STATUS rtpIoSysConstruct (RTP_ID,int numFds, + const char* path, int vxefd); +IMPORT STATUS rtpIoSysDestruct (RTP_ID); +IMPORT void * rtpIoFdTableGet (RTP_ID); +IMPORT FD_ENTRY * rtpIoFdEntryGet (RTP_ID, int fd); +IMPORT STATUS rtpIoFdEntryMap (RTP_ID, int fd, FD_ENTRY *); +IMPORT STATUS rtpIoFdUnmap (RTP_ID, int fd); +IMPORT STATUS rtpIoFdTableShow (RTP_ID); +IMPORT STATUS rtpIoDevCheck (DEV_HDR *); +IMPORT STATUS rtpIoDevClose (DEV_HDR *); +IMPORT int rtpIoFdReserve (RTP_ID pRtp); +IMPORT int rtpIoFdSetup (RTP_ID pRtp, FD_ENTRY* pFdEntry, int fd, + DEV_HDR * pDevHdr, const char * name, int value); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrtpIoLibPh */ diff --git a/h/private/rtpLibP.h b/h/private/rtpLibP.h new file mode 100644 index 0000000..c270949 --- /dev/null +++ b/h/private/rtpLibP.h @@ -0,0 +1,320 @@ +/* rtpLibP.h - private real time process library header */ + +/* + * Copyright (c) 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +02i,11may05,gls added zombieHandleId to ZOMBIE_RTP (SPR #109170) +02h,08mar05,kk added cpuTimeInfo[2] and pSchedInfo to WIND_RTP +02g,25feb05,pcs Updated the prototype of fn. rtpLibInit to handle different + overflow and underflow sizes for the execution and exception + stacks. +02f,18oct04,kk clean up comments +02e,06oct04,dcc added objMgtSemId to WIND_RTP +02d,27sep04,ans Added reserved, spare fields to WIND_RTP. +02c,22sep04,ans added rtpLibInit() rtpShowInit() rtpShellCmdInit() +02b,10sep04,kk renamed rtpBaseLib to kernelBaseLib +02a,18aug04,pad Added pUsrPthreadInfo field in wind_rtp structure. +01z,02sep04,yvp rtpHookLibInit() prototype change. +01y,17aug04,yvp Added exitCode parameter to RTP delete hooks. +01x,05jul04,dcc added handle table growing support. +01w,05may04,yvp Added extra parameter to RTP Pre-create hooks +01v,26apr04,ans added macros to get state definition +01u,15apr04,kk added rtpHandleId +01t,14apr04,kk added initTaskHandle for initTaskId +01s,08apr04,yvp Added RTP Init-Complete hooks. +01r,31mar04,jn Rename rtpLoadLib -> loadRtpLib +01q,11mar04,job Moved ACCESS_DENIED error value to public header file. +01s,30mar04,dms Add rtpShlNodeList and rtpShlNodeListMutex fields to the + wind_rtp structure. +01q,02mar04,kk added rtpVar to RTP data structure +01p,19feb04,dat chg tableSize from int to size_t +01o,05nov03,md added lockTaskId for tracking task which has rtp locked +01n,02dec03,dcc added pHandleTable member to the WIND_RTP structure. +01m,26nov03,jn Add declaration for rtpIdVerify +01l,01dec03,nrj struct names changed as per coding std +01k,12nov03,pmr added default path to RTP struct. +01j,25nov03,nrj code review mods +01i,23oct03,gls added MEM_INFO to KERNEL_RTP_CMN + removed adrsSpaceId from KERNEL_RTP_CMN + removed mmList from WIND_RTP +01h,13nov03,yvp Added RTP hook typedefs. +01g,24oct03,nrj added support for parent-child RTP +01f,21oct03,nrj moved kernel specific macros to rtpBaseLib.h +01e,15oct03,nrj sig lib includes the RTP and not the other way +01d,12oct03,nrj added signal feature +01c,25aug03,x_p Took from base6_itn2_rtp-dev.al +01g,11sep03,zl added mmList to WIND_RTP. +01f,07sep03,kk update NODE_TO_RTP to reflect KERNEL_RTP_CMN addition +01e,04sep03,nrj rationalized kernel RTP +01d,29aug03,pad Updated binaryInfo field RTP_IMAGE_INFO type. +01c,14aug03,job Added some useful macros +01b,15jul03,pad Added fields for segment info in WIND_RTP structure. +01a,26jun03,nrj created. +*/ + +#ifndef __INCrtpLibPh +#define __INCrtpLibPh + +#ifdef _ASMLANGUAGE +#else /* _ASMLANGUAGE */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" +#include "rtpLib.h" +#include "classLib.h" +#include "dllLib.h" +#include "lstLib.h" +#include "envLib.h" +#include "semLib.h" +#include "private/objLibP.h" +#include "private/loadRtpLibP.h" +#include "private/rtpSigLibP.h" +#include "private/memInfoP.h" +#include "private/rtpPthreadLibP.h" + +/* externs */ + +extern CLASS_ID rtpClassId; +extern DL_LIST rtpList; + +/* macros */ + +#define NUM_RTP_HOOK_TBLS 4 + +/* + * Macros to update the RTP state and status field. + * Using the XX_PUT_XX macros, one can write multiple state/status value(s). + * Using the XX_SET_XX / XX_UNSET_XX macros, one can set or unset a specific + * state/status value. + * The XX_GET_XX macros are defined in rtpLibCommon.h, so that user code + * can inspect the state/status of an RTP after the rtpInfoGet() system call. + */ + +#define RTP_STATE_PUT(pValue, value) (*((UINT32 *)pValue) = \ + (((value) & RTP_STATE_MASK) | (*((UINT32 *)pValue) & RTP_STATUS_MASK))) +#define RTP_STATE_SET(pValue, value) (*((UINT32 *)pValue) |= \ + ((value) & RTP_STATE_MASK)) +#define RTP_STATE_UNSET(pValue, value) (*((UINT32 *)pValue) = \ + (*((UINT32 *)pValue) & ((~(value)) & RTP_STATE_MASK)) | \ + (*((UINT32 *)pValue) & RTP_STATUS_MASK)) + +#define RTP_STATUS_PUT(pValue, value) (*((UINT32 *)pValue) = \ + (((value) & RTP_STATUS_MASK) | (*((UINT32 *)pValue) & RTP_STATE_MASK))) +#define RTP_STATUS_SET(pValue, value) (*((UINT32 *)pValue) |= \ + ((value) & RTP_STATUS_MASK)) +#define RTP_STATUS_UNSET(pValue, value) (*((UINT32 *)pValue) = \ + (*((UINT32 *)pValue) & ((~(value)) & RTP_STATUS_MASK)) | \ + (*((UINT32 *)pValue) & RTP_STATE_MASK)) + + +/* Macro to get to the RTP_ID using the rtpNode pointer */ + +#define NODE_TO_RTP(pNode) ((RTP_ID)((int) pNode - sizeof(OBJ_CORE) - \ + sizeof (KERNEL_RTP_CMN))) + +/* RTP_LOCK locks the RTP semaphore without verifiying its object and state */ + +#define RTP_LOCK(rtpId) (semTake ((rtpId)->semId, WAIT_FOREVER)) + +/* RTP_UNLOCK releases the semaphore of an RTP */ + +#define RTP_UNLOCK(rtpId) (semGive ((rtpId)->semId)) + +/* RTP_SIG_RCB_GET obtains the signal data pointer for an RTP */ + +#define RTP_SIG_RCB_GET( rtpId ) (&((rtpId)->signalInfo)) + +/* RTP_VERIFIED_LOCK locks the RTP sem after verifiying the object and state */ + +#define RTP_VERIFIED_LOCK(rtpId) rtpVerifyAndLock ((rtpId)) + +/* + * RTP_VERIFIED_LOCK_TASKID locks the owner RTP semaphore of the given task + * after verifiying the task object, the RTP object and the RTP state. + */ + +#define RTP_VERIFIED_LOCK_TASKID(tid) rtpVerifyTaskIdAndLock ((tid)) + +#define RTP_ID_VERIFY(rtpId) (OBJ_VERIFY ((rtpId), (rtpClassId))) + +/* typedefs */ + +/* + * KERNEL_RTP_CMN: structure containing a collection of common elements + * between the kernelId and user RTPs. + * ctxCnt: number of tasks using the vm context of RTP/kernel, can't + * delete if non zero. + * memInfo: RTP/Kernel virtual memory info. + * sharedDataList: list of shared data regions mapped. + * pWdbInfo: pointer to WDB info. + */ + +typedef struct kernelRtpCommon + { + INT32 ctxCnt; /* number of tasks in this context */ + MEM_INFO * memInfo; /* pointer to memory structure */ + DL_LIST sharedDataList; /* List of the attached SD rgns */ + void * pWdbInfo; /* pointer to debugger specific info */ + } KERNEL_RTP_CMN; + +/* + * objCore: includes RTP name, ID + * kernelRtpCmn: common between RTP and Kernel object + * rtpNode: the rtp is linked to its parent when it becomes zombie via this node + * semId: semaphore to protect the RTP structure. + * rtpStat (status): placeholder to represent the state and status of the RTP. + * pPathName: Pointer to the executable file pathname string. + * pArgv:Pointer to argv[] as supplied during creation. + * pEnv: Pointer to envp[] as supplied during creation. + * options: the options that are supplied during creation. + * initTaskId: the task ID of the intial task + * initTaskHandle: the initial task user handle ID, for user space. + * memInfo: The memory information structure pointer, + * e.g. page pool lists or heap partition ID. + * symTabId: RTP's symbol table. + * binaryInfo: information about RTP code. + * taskCnt: Number of tasks in the RTP. + * fdTable: Pointer to shared FD table. + * fdTableSize: number of entries in the FD table. + * taskExitRtn: pointer to taskExit() in the RTP address space. + * sigReturnRtn: Pointer to signal return routine in the RTP address space. + * waitQHead: q of tasks waiting for RTP to die - to support waitpid(). + * signalInfo: RTP global Signal control block. + * pSigQFreeHead: pointer to free pool of sigpend nodes (sigqueue). + * sigwaitQ: list of tasks waiting for signals. + * rtpChildList: list of RTP child and zombie RTPs attached to this RTP. + * parentRtpId: ID of the RTP which created this RTP. + * objMgtSemId: object management semaphore lock. + * mstrHandleTbl: per RTP master handle table. + * lockTaskId: ID of the task which locked the RTP. + * rtpHandleId: handle ID of this RTP, for abstraction in user space. + * pRtpVar: RTP specific variables, for SL support. + * rtpShlNodeList: list of shared library references. + * rtpShlNodeListMutex: mutex semaphore protecting the rtpShlNodeList list. + * pUsrPthreadInfo: pointer to user-side pthreadLib information. + */ + +typedef struct wind_rtp + { + OBJ_CORE objCore; /* object management */ + KERNEL_RTP_CMN kernelRtpCmn; /* common between RTP and Kernel obj */ + DL_NODE rtpNode; /* link of this zombie to its parent */ + SEM_ID semId; /* semaphore to protect this struct */ + UINT32 status; /* state and status of the RTP */ + char * pPathName; /* pointer to pathname of RTP */ + char ** pArgv; /* pointer to arguments */ + char ** pEnv; /* pointer to environment */ + UINT32 options; /* option bits, e.g. debug, symtable */ + void * entrAddr; /* entry point of ELF file */ + int initTaskId; /* the initial task ID */ + OBJ_HANDLE initTaskHandle; /* the initial task user handle ID */ + int symTabId; /* symbol table */ + RTP_IMAGE_INFO binaryInfo; /* information about RTP code */ + UINT taskCnt; /* number of tasks in the RTP */ + Q_HEAD deleteQHead; /* q of tasks waiting the RTP delete */ + void * fdTable; /* fd table */ + size_t fdTableSize; /* number of entries in fd table */ + char * defPath; /* default path for I/O */ + size_t defPathLen; /* length of default path buffer */ + VOIDFUNCPTR taskExitRtn; /* Pointer to task exit routine */ + VOIDFUNCPTR sigReturnRtn; /* Pointer to signal return routine */ + RTP_SIG_CB signalInfo; /* Signal control block */ + struct sigpend * pSigQFreeHead; /* ptr to free pool of sigpends */ + DL_LIST sigwaitQ; /* tasks waiting for signals */ + DL_LIST rtpChildList; /* list of Child RTP zombies */ + struct wind_rtp * parentRtpId; /* RTP ID of this RTP's parent */ + SEM_ID objMgtSemId; /* object management lock */ + MASTER_HANDLE_TABLE mstrHandleTbl; /* per RTP master handle table */ + int lockTaskId; /* the task which has the RTP locked */ + OBJ_HANDLE rtpHandleId; /* handle ID of this RTP */ + struct rtp_var * pRtpVar; /* RTP specific variables */ + DL_LIST rtpShlNodeList; /* list of SHL references */ + SEM_ID rtpShlNodeListMutex; /* lock for rtpShlNodeList */ + PTHREAD_INFO * pUsrPthreadInfo;/* user pthreadLib info */ + + /* extensions for plug-in schedulers */ + + UINT64 cpuTimeInfo[2]; /* sched extension - CPU time info */ + void * pSchedInfo; /* ptr to scheduler info */ + + int reserved1; /* possible WRS extension */ + int reserved2; /* possible WRS extension */ + int spare1; /* possible user extension */ + int spare2; /* possible user extension */ + int spare3; /* possible user extension */ + int spare4; /* possible user extension */ + } WIND_RTP; + +/* small footprint zombie data struct for dead child RTP, chained to parent */ + +typedef struct zombieRtp + { + DL_NODE rtpNode; /* link of this zombie to its parent */ + WIND_RTP * zombieId; /* RTP ID of this RTP's parent */ + OBJ_HANDLE zombieHandleId; /* handle ID of this RTP's parent */ + int exitStatus; /* exit/termination status */ + } ZOMBIE_RTP; + +/* typedef's for RTP create/delete hook functions */ + +typedef STATUS (* RTP_PRE_CREATE_HOOK) (const char *, const char *[], + const char *[], int, int, int, int); + +typedef STATUS (* RTP_POST_CREATE_HOOK) (const RTP_ID); + +typedef void (* RTP_INIT_COMPLETE_HOOK) (const RTP_ID); + +typedef void (* RTP_DELETE_HOOK) (const RTP_ID, const int exitCode); + +/* externals */ + +extern int rtpHookTblSize; +extern RTP_PRE_CREATE_HOOK * pRtpPreCreateHookTbl; +extern RTP_POST_CREATE_HOOK * pRtpPostCreateHookTbl; +extern RTP_INIT_COMPLETE_HOOK * pRtpInitCompleteHookTbl; +extern RTP_DELETE_HOOK * pRtpDeleteHookTbl; + +/* function declarations */ + +extern STATUS rtpVerifyAndLock (WIND_RTP *pRtpId); +extern STATUS rtpVerifyTaskIdAndLock (WIND_TCB *tid); +extern STATUS rtpIdVerify (RTP_ID rtpId); +extern STATUS rtpHookLibInit (int tblSize); +extern STATUS rtpPreCreateHookAdd (RTP_PRE_CREATE_HOOK, BOOL); +extern STATUS rtpPreCreateHookDelete (RTP_PRE_CREATE_HOOK); +extern STATUS rtpPostCreateHookAdd (RTP_POST_CREATE_HOOK, BOOL); +extern STATUS rtpPostCreateHookDelete (RTP_POST_CREATE_HOOK); +extern STATUS rtpInitCompleteHookAdd (RTP_INIT_COMPLETE_HOOK, BOOL); +extern STATUS rtpInitCompleteHookDelete (RTP_INIT_COMPLETE_HOOK); +extern STATUS rtpDeleteHookAdd (RTP_DELETE_HOOK, BOOL); +extern STATUS rtpDeleteHookDelete (RTP_DELETE_HOOK); +extern OBJ_HANDLE rtpHandleIdGet (RTP_ID rtpId); +extern STATUS rtpLibInit (int rtpHookTblSize, + int syscallHookTblSize, + int rtpSignalQueueSize, + int defExcStkOverflowSize, + int defExecStkOverflowSize, + int defExecStkUnderflowSize); +extern void rtpShowInit (void); +extern STATUS rtpShellCmdInit (void); + +#ifdef __cplusplus +} +#endif + +#endif /* _ASMLANGUAGE */ + +#endif /* __INCrtpLibPh */ diff --git a/h/private/rtpPthreadLibP.h b/h/private/rtpPthreadLibP.h new file mode 100644 index 0000000..7a385cf --- /dev/null +++ b/h/private/rtpPthreadLibP.h @@ -0,0 +1,89 @@ +/* rtpPthreadLibP.h - private header for user-side POSIX threads (pthreads) */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,07sep04,pad Created to share common type and macro definitions. +*/ + +/* +DESCRIPTION +This header file holds information that must be known to both the user-side +library for POSIX threads and the support code for this library located in the +kernel. These information, type definitions and macro definitions, represents +a convention between the two sides. +*/ + +#ifndef __INCrtpPthreadLibPh +#define __INCrtpPthreadLibPh + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus */ + +/* defines */ + +/* + * POSIX defines zero as the return value on success for many routines. This + * macro makes the code more readable. + */ + +#define _RETURN_PTHREAD_SUCCESS 0 + +/* typedefs */ + +/* + * The PTHREAD_INFO structure is used internally by the user-side pthread + * library to pass information to the kernel code handling the cancellability + * feature of pthreads for those cancellation points which code actually is + * in the kernel. In the version 1 of this implementation, this allows the + * kernel code to get to the canceltype field of the user-side thread's + * internal data structure via the caller's RTP's rtpTlsCurrent variable: + * + * RTP Space + * --------- + * + * rtpTlsCurrent + * +-----------+ TLS (per task) + * | &TLS -|--->+---------------+ + * +-----------+ (0)| | + * +---------------+ + * : : + * +---------------+ pthread data struct + * (x)|&pthread data -|--->+-------------------+ + * +---------------+ (0)| | + * : : +-------------------+ + * : : + * +-------------------+ + * (y)| cancel type | + * +-------------------+ + * : : + * + * The address of the rtpTlsCurrent variable, the slot number (x) of the + * current pthread data structure in the Task Local Storage area pointed to by + * the rtpTlsCurrent variable, as well as the offset (y) to the user pthread + * data structure's cancel type are the information required for the version + * 1 of this implementation. + * + * The order of the fields in the PTHREAD_INFO structure is crucial for the + * good functioning of the pthread cancellability mechanism. By convention + * the version field is always the first in the structure since it drives the + * interpretation of the rest of the structure by the kernel-side code. + */ + + +typedef struct + { + int version; /* version of this structure (currently 1) */ + void * rtpTlsCurrentAddr; /* address of the RTP's rtpTlsCurrent var */ + int tlsKey; /* key of the pthread data in the TLS */ + int cancelTypeOffset; /* offset (in bytes) to canceltype field */ + } PTHREAD_INFO; + +#if defined(__cplusplus) +} +#endif /* __cplusplus */ + +#endif /* __INCrtpPthreadLibPh */ diff --git a/h/private/rtpSigLibP.h b/h/private/rtpSigLibP.h new file mode 100644 index 0000000..474d2de --- /dev/null +++ b/h/private/rtpSigLibP.h @@ -0,0 +1,258 @@ +/* rtpSigLibP.h - private RTP signal library header */ + +/* + * Copyright (c) 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01m,11may05,gls added OBJ_HANDLE to rtpChildWait() (SPR #109170) + added rtpChildIdGet() (SPR #106428) + added rtpChildHandleGet() (SPR #109349) + updated copyright notice +01l,29sep04,ans added _rtpSigqueue () +01k,24sep04,ans Added RTP_TASK_MINI_SIG_CB to RTP_SIG_CB +01j,18may04,ans alternate signal stack support. +01i,17may04,ans added parent signal mask inheritance support. +01h,11feb04,ans added support for sigwait() related calls. +01g,01dec03,nrj coding std changes +01f,25nov03,nrj code review mods +01e,27oct03,nrj added support for waitpid +01d,22oct03,nrj added extern defs for API +01c,16oct03,nrj added syscall state save in sigctx +01b,15oct03,nrj added extern decl and fixed sigsuspend mask issue +01a,11oct03,nrj created. +*/ + +#ifndef __INCrtpSigLibPh +#define __INCrtpSigLibPh + +#ifdef _ASMLANGUAGE +#else /* _ASMLANGUAGE */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" +#include "sigLib.h" +#include "dllLib.h" +#include "private/sigLibP.h" + +/* macros */ + +/* + * Following macros are used by Signal delivery mechanism. + * When signal is delivered (carving user handler ctx) these + * macros values are stored with saved ctx. When the Sig handler + * returns, One of these is set and return takes action further on. + */ + +#define SIG_DELIVERED_IN_WINDCTX 0x0000 +#define SIG_DELIVERED_IN_EXCEPTION 0x0010 +#define SIG_DELIVERED_IN_SYSCALL 0x0100 +#define SIG_DELIVERED_SYSCALL_RESTART 0x0001 +#define SIG_DELIVERED_WITH_SYSCALL_RESTART \ + (SIG_DELIVERED_IN_SYSCALL | \ + SIG_DELIVERED_SYSCALL_RESTART) + +/* + * Following macros are used when task wishes to wait for + * a child RTP to die or wait for some signal. + * When task initiates wait for signal/child it is added to the + * wait List with RTP control block. + * When a signal arrives, the task is woken + * up and based on these macro value, it is unqueued from RTP + */ + +#define SIG_TASK_NOT_QUEUED 0 +#define SIG_TASK_QUEUED_SIGWAIT 1 +#define SIG_TASK_QUEUED_CHILDWAIT 2 +#define SIG_TASK_QUEUED_SYNCSIG 3 + +/* typedefs */ + +/* To deliver a RTP signal we do following + * a) Save the current context + * b) create new context to run user-mode signal handler + * c) Resume to new context and run sig handler + * d) After signal handler finishes Resume to saved context + * + * Following sigctx is used in step (a) and (d). The mem for + * this is allocated from tasks's User-mode stack. + */ + +typedef struct rtpSigCtx + { + int type; /* one of above macros */ + REG_SET regs; /* Processor context for a task */ + sigset_t savedMask; /* mask prior to sig-handler */ + siginfo_t info; /* signal info, passed to handlr */ + int args[8]; /* args of intrptd syscall */ + int scn; /* intrptd syscall number */ + } RTP_SIG_CTX; + +/* + * The signal can be generated for RTP and task . So both have + * signal control blocks in addition to their own control + * block. + * The Signal control block (SIG_CB) for both share some + * common properties and differ in some other. + * For signal-internal users like timer/IO/child-die, it is desired + * to provide uniform interface. (see sigpend struct in sigLibP.h) + * Sigpend data struct and TCB only provides one "pointer" to for + * Signal-Control-block. Signal lib internally cast these pointer as + * per its own allocated data struct (SIG_CB). + */ + +typedef enum rtpTcbCmnType + { + SIG_CB_TCB, + SIG_CB_RTP + } RTP_TCB_CMN_TYPE; + + +typedef struct rtpTaskMiniSigCb + { + BOOL isSigCbInitialized; + sigset_t parentSigMask; + } RTP_TASK_MINI_SIG_CB; + +/* + * Common data struct for RTP and Task SIGnal control block + */ + +typedef struct rtpSigTcbRtpCmn + { + /* sigMini should be the first item of this structure */ + + RTP_TASK_MINI_SIG_CB sigMini; /* minimal signal CB */ + DL_NODE cmnRtpSigWaitNode; /* node for tasks */ + struct sigq cmnSigQHead[_NSIGS + 1]; /* qed signals */ + sigset_t cmnKillSigs; /* which kill sigs */ + sigset_t cmnQueuedSigs; /* if qed, which */ + RTP_TCB_CMN_TYPE cmnRtpOrTcb; /* is it RTP or TCB */ + union + { + struct wind_rtp * pRtpId; + WIND_TCB * pTid; + } cmnOwnerId; + +#define sigCmnRtpId cmnOwnerId.pRtpId +#define sigCmnTid cmnOwnerId.pTid + + } RTP_SIG_TCB_RTP_CMN; + +/* + * RTP signal control block. + * static part of WIND_RTP & not allocated dynamically + */ + +typedef struct rtpSigCB + { + /* sigCmnControlBlock should be the first item of this structure */ + + RTP_SIG_TCB_RTP_CMN sigCmnControlBlock; + struct sigaction sigVector[_NSIGS + 1]; /* Sigaction user handlers */ + struct sigpend * pSigQ; /* pool for Sigqueue */ + } RTP_SIG_CB; + +typedef struct sigwait_ + { + sigset_t waitsigs; /* wait signal mask */ + siginfo_t waitinfo; /* wait signal info */ + } SIG_WAIT; + +/* + * TASK signal control block. + * "pTcb->pSignalInfo " + * + * IMPORTANT - do not confuse it with **Kernel task's** sigtcb + * + * NOTE that for kernel task pSignalInfo--> points to sigtcb + * and for RTP task pSignalInfo--> points to rtpsigtcb + * It is allocated dynamically only when required. + */ + +typedef struct rtpTaskSigCB + { + /* sigCmnControlBlock should be the first item of this structure */ + + RTP_SIG_TCB_RTP_CMN sigCmnControlBlock; /* common part of SIG_CB */ + sigset_t blockedSigs; /* Mask of Task */ + sigset_t savedBlockedSigs; /* temp storage for mask */ + INT32 qState; /* qued for sig/child */ + int nestedCount; /* sanity check sigreturn */ + SIG_WAIT * pSigwait; /* task signal wait info */ + struct wind_rtp * childRtpId; /* child rtpId to wait for */ + stack_t signalStack; /* alternate signal stack */ + } RTP_TASK_SIG_CB; + +/* + * struct sigpend is defined in sigLibP.h, it is used by many services + * including timer, posix message, aio drivers ... + * We use the same struct for easy porting of those services + * to RTP universe. + */ + +typedef struct sigpend RTP_SIG_PEND; + +/* + * For ease of source code reading + */ + +#define sigQHead sigCmnControlBlock.cmnSigQHead +#define killSigs sigCmnControlBlock.cmnKillSigs +#define queuedSigs sigCmnControlBlock.cmnQueuedSigs +#define rtpOrTcb sigCmnControlBlock.cmnRtpOrTcb +#define sigCBRtpId sigCmnControlBlock.cmnOwnerId.pRtpId +#define sigCBTid sigCmnControlBlock.cmnOwnerId.pTid +#define rtpSigwaitNode sigCmnControlBlock.cmnRtpSigWaitNode + + +/* externs */ + +/* exported functionality - not all are system call */ + +extern int rtpSigaction (int, const struct sigaction *, + struct sigaction *, void *); +extern int rtpSigprocmask (int, const sigset_t *, sigset_t *); +extern int rtpSigaltstack (const stack_t * , stack_t *); +extern int rtpSigpending (sigset_t *); +extern int rtpSigsuspend (const sigset_t *); +extern int rtpPause (); +extern int rtpTaskKill (WIND_TCB *, int); +extern int rtpTaskSigqueue (WIND_TCB *, int, const union sigval); +extern int _rtpTaskSigqueue (WIND_TCB *, int, const union sigval, int sigCode); +extern int rtpTaskSigPendKill (WIND_TCB *, struct sigpend *); +extern int rtpKill (RTP_ID, int); +extern int rtpSigqueue (RTP_ID, int, const union sigval); +extern int _rtpSigqueue (RTP_ID, int, const union sigval, int sigCode); +extern int rtpSigPendKill (RTP_ID, struct sigpend *); +extern STATUS rtpSigPendInit (struct sigpend *); +extern STATUS rtpSigPendDestroy (struct sigpend *); +extern void rtpSigReturn (void); +extern OBJ_HANDLE rtpChildHandleGet (RTP_ID); +extern RTP_ID rtpChildIdGet (OBJ_HANDLE); +extern RTP_ID rtpChildWait (RTP_ID, OBJ_HANDLE *, int *, int); +extern int rtpSigtimedwait (const sigset_t *pSet, struct siginfo *pInfo, + const struct timespec *pTimeout); +extern int rtpSigwaitinfo (const sigset_t *pSet, struct siginfo *pInfo); +extern int rtpSigwait (const sigset_t *pSet, int *pSig); + + + +#ifdef __cplusplus +} +#endif + +#endif /* _ASMLANGUAGE */ + +#endif /* __INCrtpSigLibPh */ diff --git a/h/private/rtpUtilLibP.h b/h/private/rtpUtilLibP.h new file mode 100644 index 0000000..67fd9f7 --- /dev/null +++ b/h/private/rtpUtilLibP.h @@ -0,0 +1,95 @@ +/* rtpUtilLibP.h - real time process utility library header */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01k,12oct04,kk removed kernelBaseLib.h include +01j,27sep04,ans code inspection comments. +01i,10aug04,kk renamed rtpBaseLib to kernelBaseLib +01h,14jul04,job Added prototype for rtpNameTruncate() (SPR#99331) +01g,11may04,dms Use the new small-integer SHL_IDs. +01f,22mar04,pad Some more fiddling with rtpShlSymbolsRegister() and + rtpShlSymbolsUnregister()'s APIs. +01e,16mar04,pad Changed some parameter names for rtpShlSymbolsRegister. +01d,12mar04,pad Added prototypes of rtpShlSymbolsRegister() and + rtpShlSymbolsUnregister() API. +01c,25nov03,nrj code review mods +01b,10nov03,nrj removed typedef in front of func decl. +01a,23oct03,nrj created. +*/ + +#ifndef __INCrtpUtilLibPh +#define __INCrtpUtilLibPh + +#ifdef _ASMLANGUAGE +#else /* _ASMLANGUAGE */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" +#include "rtpLib.h" +#include "classLib.h" +#include "dllLib.h" +#include "lstLib.h" +#include "shlLib.h" +#include "private/objLibP.h" +#include "private/rtpSigLibP.h" + +/* macros */ + +/* + * Macros for traversing tasks of the RTP + * Note that RTP should be locked to use FOR/END_FOR macros + * + *The FOR and END_FOR should always be coupled. + */ + +#define FOR_EACH_TASK_OF_RTP(rtpId, tid) \ + { \ + int oldErrno; \ + DL_NODE * pNode ; \ + pNode = DLL_FIRST (&((OBJ_CORE *)rtpId)->ownerList); \ + while (pNode != NULL) \ + { \ + tid = (WIND_TCB *) ((int)pNode - OFFSET (OBJ_CORE, ownerNode)); \ + oldErrno = errno; \ + pNode = DLL_NEXT (pNode); \ + if (TASK_ID_VERIFY (tid) != OK) \ + { \ + errno = oldErrno; \ + continue; \ + } + +#define END_FOR_EACH_TASK_OF_RTP } } + +/* defines */ + +#define RTP_TRUNC_NAME_LENGTH 20 /* max RTP name len display in summary */ + +/* typedefs */ + +/* externs */ + +extern void rtpNameTruncate (RTP_ID rtpId, char *rtpName); +extern STATUS rtpTaskAllStop (WIND_RTP *); +extern STATUS rtpTaskAllCont (WIND_RTP *); + +extern STATUS rtpShlSymbolsRegister (char * filePath, RTP_ID rtpId, + SHL_ID shlId, void * textBase, void * database, UINT32 options); + +extern STATUS rtpShlSymbolsUnregister (RTP_ID rtpId, SHL_ID shlId, + UINT32 scope); + +#ifdef __cplusplus +} +#endif + +#endif /* _ASMLANGUAGE */ + +#endif /* __INCrtpUtilLibPh */ diff --git a/h/private/scMemValP.h b/h/private/scMemValP.h new file mode 100644 index 0000000..d9f46a3 --- /dev/null +++ b/h/private/scMemValP.h @@ -0,0 +1,28 @@ +/* scMemValP.h - private header file for system call validation routines */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01c,05nov04,zl moved function prototype to public header. +01b,19apr04,tam updated prototype +01a,23oct03,tam written. +*/ + +#ifndef __INCscMemValPh +#define __INCscMemValPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "scMemVal.h" + +#define SC_PROT_MSK 0x3 /* protection mask */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCscMemValPh */ diff --git a/h/private/schedP.h b/h/private/schedP.h new file mode 100644 index 0000000..127bd96 --- /dev/null +++ b/h/private/schedP.h @@ -0,0 +1,42 @@ +/* schedP.h - sched private header file */ + +/* Copyright 1984-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,11sep00,jgn add extern for posixPriorityNumbering +01b,05jan94,kdl added include of sched.h. +01a,09nov93,dvs written +*/ + +#ifndef __INCschedPh +#define __INCschedPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "sched.h" + +#define VXWORKS_LOW_PRI 255 /* low priority VxWorks numbering */ +#define VXWORKS_HIGH_PRI 0 /* high priority VxWorks numbering */ +#define POSIX_LOW_PRI 0 /* low priority POSIX numbering */ +#define POSIX_HIGH_PRI 255 /* high priority POSIX numbering */ + +/* conversion macro */ +#define PX_VX_PRIORITY_CONVERT(prior) (posixPriorityNumbering ? \ + POSIX_HIGH_PRI - prior : prior) +#define PX_NUMBER_CONVERT(prior) (posixPriorityNumbering ? \ + prior : POSIX_HIGH_PRI - prior ) + +extern BOOL posixPriorityNumbering; + +extern BOOL _schedPxKernelIsTimeSlicing (ULONG * pPeriod); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCschedPh */ + diff --git a/h/private/sdLibP.h b/h/private/sdLibP.h new file mode 100644 index 0000000..90a11c0 --- /dev/null +++ b/h/private/sdLibP.h @@ -0,0 +1,90 @@ +/* sdLibP.h - private shared data library header file */ + +/* + * Copyright (c) 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01k,28mar05,zl added sdRtpUnmap() prototype. +01j,08feb05,zl added sdRtpMap() prototype. +01i,02oct04,gls added sdLibInit() and sdShowInit() declarations +01h,24sep04,gls removed MMU_ATTR_CACHE_MSK from SD_ATTR_MASK +01g,19jul04,gls added hook routines (SPR #98361) +01f,04may04,gls added currentAttr to SD_NODE +01e,29mar04,gls added include of objLibP.h (SPR #95051) +01d,04mar04,gls removed sdListNode from WIND_SD struct +01c,17feb04,gls cleaned up +01b,11dec03,gls added functionality +01a,04nov03,kk written +*/ + +#ifndef __INCsdLibPh +#define __INCsdLibPh + +#include "vxWorks.h" +#include "sdLib.h" +#include "private/objLibP.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern STATUS sdLibInit (const int hookTblSize); +extern void sdShowInit (void); + +/* defines */ + +#define SD_DEFAULT_ATTR (MMU_ATTR_SUP_RW | MMU_ATTR_USR_RW | \ + MMU_ATTR_VALID | MMU_ATTR_CACHE_DEFAULT) + +#define SD_ATTR_MASK (MMU_ATTR_PROT_MSK | MMU_ATTR_VALID_MSK | \ + MMU_ATTR_SPL_MSK) + +/* private options */ + +#define SD_LIB_TEXT 0x00000003 /* SD is used for SL */ +#define SD_HOOK_IGNORE 0x00000004 /* internal call, skip hook routines */ + +/* typedef */ + +typedef struct sdNode /* Node of a linked list. */ + { + struct dlnode *next; /* Points at the next node in the list */ + struct dlnode *previous; /* Points at the previous node in the list */ + + SD_ID sdId; + MMU_ATTR currentAttr; /* Current MMU attributes of SD in the RTP */ + } SD_NODE; + +typedef struct wind_sd + { + OBJ_CORE objCore; /* object management */ + SEM_ID semId; /* SD semaphore */ + int options; /* SD options */ + MMU_ATTR attr; /* MMU attributes allowed on this SD */ + UINT size; /* size of the SD */ + UINT clientCount; /* current number of client RTPs */ + PAGE_POOL_ID virtPgPoolId; /* shared data virtual page pool */ + PHYS_ADDR physAdrs; /* start physical address of mapping */ + VIRT_ADDR virtAdrs; /* start virtual address of mapping */ + } WIND_SD; + + +/* private function declarations */ + +extern VIRT_ADDR sdRtpMap (SD_ID sdId, MMU_ATTR attr, int options, + RTP_ID rtpId); +extern STATUS sdRtpUnmap (SD_ID sdId, RTP_ID rtpId, int options); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCsdLibPh */ diff --git a/h/private/selectLibP.h b/h/private/selectLibP.h new file mode 100644 index 0000000..6de4343 --- /dev/null +++ b/h/private/selectLibP.h @@ -0,0 +1,90 @@ +/* selectLibP.h - private select library header */ + +/* Copyright 2001-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,03jun04,dat Track maxFd for saved fd_set's, 97881 +01c,18dec03,dat replace memCtx with ready and returnSet. +01b,09dec03,dat chg taskId to be a real WIND_TCB ptr, added ctx sw flag, + added exception fd_set. +01a,18sep01,aeg extracted from version 02c of selectLib.h; added selContext. +*/ + +#ifndef __INCselectLibP +#define __INCselectLibP + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE +#include "taskLib.h" +#include "lstLib.h" +#include "private/semLibP.h" + +/* HELP: the public selectLib.h includes private/selectLibP.h */ + +typedef struct selWkNode + { + NODE linkedListHooks;/* hooks for wakeup list */ + BOOL dontFree; /* first in free list isn't malloc'ed */ + WIND_TCB * taskId; /* taskId of select'ed task */ + USHORT fd; /* fd to set in fd_set on activity */ + USHORT ready; /* device is ready flag */ + SELECT_TYPE type; /* activity task is interested in */ + fd_set * returnSet; /* return fd set */ + } SEL_WAKEUP_NODE; + +typedef struct + { + SEMAPHORE listMutex; /* mutex semaphore for list */ + SEL_WAKEUP_NODE firstNode; /* usually one deep, stash first one */ + LIST wakeupList; /* list of SEL_WAKEUP_NODE's */ + } SEL_WAKEUP_LIST; + +typedef struct selContext + { + SEMAPHORE wakeupSem; /* wakeup semaphore */ + BOOL pendedOnSelect; /* task pended on select? */ + + fd_set *pReadFds; /* select'ed task's read fd_set */ + fd_set *pWriteFds; /* select'ed task's write fd_set */ + fd_set *pExcFds; /* select'ed task's exc fd_set */ + + /* the following are needed for safe task deletion */ + + fd_set *pOrigReadFds; /* task's original read fd_set */ + fd_set *pOrigWriteFds; /* task's original write fd_set */ + fd_set *pOrigExcFds; /* task's original exc fd_set */ + int maxFd; /* maxFd for saved sets above */ + int width; /* width parm passed to select() */ + + /* + * The remaining memory in the SEL_CONTEXT dynamically allocated by + * the select task create hook is used to store the various fd_set's + * referenced in the above fd_set pointers. Note that these structures + * are not really fd_set's since their size is based on maxFiles (iosLib) + * instead of FD_SETSIZE. + * + * fd_set origReadFds; /@ memory for task's original read fd_set @/ + * fd_set origWriteFds; /@ memory for task's original write fd_set @/ + * fd_set origExcFds; /@ memory for task's original write fd_set @/ + */ + + } SEL_CONTEXT; + + +/* function declarations */ + +IMPORT void selectInit (int numFiles); +IMPORT void selTaskDeleteHookAdd (void); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCselectLibP */ diff --git a/h/private/semLibP.h b/h/private/semLibP.h new file mode 100644 index 0000000..ea710de --- /dev/null +++ b/h/private/semLibP.h @@ -0,0 +1,306 @@ +/* semLibP.h - private semaphore library header file */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +02b,13oct05,yvp Changes text of deprecated messages - use semXInitialize. +02a,26aug05,gls fixed pSemExt index comment (SPR #111547) +01z,04aug05,gls added read/write semaphore support +01y,04aug05,yvp Added prototype for create/delete library init. +01x,07jun05,yvp Updated copyright. #include now with angle-brackets. +01w,12apr05,kk start deprecation of semXCoreInit() and semQInit(). +01v,28sep04,fr removed vSemCreate prototype (SPR 101349) +01u,10sep04,fr declared semCreateTbl (SPR 101247) +01t,22mar04,dcc added vSemCreate prototype. +01s,09mar04,dcc updated SEMAPHORE offsets. +01r,08mar04,aeg removed Diab _WRS_DEPRECATED C++ workaround. +01q,02mar04,aeg deprecated semOLib APIs. +01p,31oct03,md Added semMTakeByProxy +01p,26aug03,tcr remove WindView InstClassId +01o,31oct03,dcc updated semaphore offset comments, as a result of OBJ_CORE + expansion. +01n,29oct03,pcm implemented changes from code review +01m,20oct03,pcm added new SEMAPHORE field +01l,05sep03,dcc moved SEM_TYPE definitions to semLibCommon.h +01k,30may03,to added offset SEM_CLASS_ID for optimized semaphore routine. + deleted K&R style prototypes. +01j,09apr03,ymz update semaphore offset due to OBJ_CORE change +01i,17oct01,bwa Corrected ASM offsets for events. Added SEM_M_SEND_EVENTS + definition. +01h,06sep01,bwa Added VxWorks events support. +01g,19may97,jpd made SEM_TYPE_MASK available from assembler files. +01f,10jul96,dbt moved declaration of semMGiveForce to semLib.h (SPR #4352). + Updated copyright. +01e,10dec93,smb added instrument class +01d,22sep92,rrr added support for c++ +01c,27jul92,jcf changed semMTakeKern to semMPendQPut. +01b,19jul92,pme added external declaration of shared sem show routine. +01a,04jul92,jcf created. +*/ + +#ifndef __INCsemLibPh +#define __INCsemLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE +#include +#include +#include +#include +#include +#include +#include +#include + +/* semaphore types */ + +#define MAX_SEM_TYPE 8 /* maximum # of sem classes */ + +#endif /* !_ASMLANGUAGE */ +#define SEM_TYPE_MASK 0x7 /* semaphore class mask */ +#ifndef _ASMLANGUAGE + +typedef struct semaphore /* SEMAPHORE */ + { + OBJ_CORE objCore; /* 0x00: object management */ + UINT8 semType; /* 0x40: semaphore type */ + UINT8 options; /* 0x41: semaphore options */ + UINT16 recurse; /* 0x42: semaphore recursive take count */ + Q_HEAD qHead; /* 0x44: blocked task queue head */ + union + { + UINT count; /* 0x54: current state */ + struct windTcb * owner; /* 0x54: current state */ + } state; + EVENTS_RSRC events; /* 0x58: VxWorks events */ + BOOL priInheritFlag; /* 0x64: TRUE if sem involved in inheritance */ + void * pSemExt; /* 0x68: semaphore extension pointer */ + } SEMAPHORE; + +typedef struct semRWExtention /* SEM_RW_EXT */ + { + UINT readCount; /* 0x00: current reader count */ + Q_HEAD readQHead; /* 0x04: blocked task queue head */ + Q_HEAD upgradeQHead; /* 0x14: blocked task queue head */ + } SEM_RW_EXT; + +#define semCount state.count +#define semOwner state.owner + +#define SEM_RW_OPTIONS_MASK (SEM_BIN_OPTIONS_MASK | \ + SEM_DELETE_SAFE) + +typedef enum /* SEM_RW_MODE */ + { + SEM_RW_READ, /* 0: read mode */ + SEM_RW_WRITE, /* 1: write mode */ + SEM_RW_UPGRADE /* 2: upgrade mode */ + } SEM_RW_MODE; + +/******************************************************************************* +* +* SEMRW_EXT_PTR_GET - return the read/write semaphore extension pointer +* +* RETURNS: A pointer to the read/write semaphore extension +* +* SEM_RW_EXT * SEMRW_EXT_PTR_GET (SEM_ID semId) +* +* \NOMANUAL +*/ + +#define SEMRW_EXT_PTR_GET(semId) ((SEM_RW_EXT *) semId->pSemExt) + +/******************************************************************************* +* +* SEMRW_READ_CNT - return the read/write semaphore read count +* +* RETURNS: The read/write semaphore read count +* +* UINT SEMRW_READ_CNT (SEM_ID semId) +* +* \NOMANUAL +*/ + +#define SEMRW_READ_CNT(semId) (((SEM_RW_EXT *) semId->pSemExt)->readCount) + +/******************************************************************************* +* +* SEMRW_UQHEAD - return the read/write semaphore upgrade queue head +* +* RETURNS: The read/write semaphore upgrade queue head +* +* Q_HEAD SEMRW_UQHEAD (SEM_ID semId) +* +* \NOMANUAL +*/ + +#define SEMRW_UQHEAD(semId) (((SEM_RW_EXT *) semId->pSemExt)->upgradeQHead) + +/******************************************************************************* +* +* SEMRW_RQHEAD - return the read/write semaphore read queue head +* +* RETURNS: The read/write semaphore read queue head +* +* Q_HEAD SEMRW_RQHEAD (SEM_ID semId) +* +* \NOMANUAL +*/ + +#define SEMRW_RQHEAD(semId) (((SEM_RW_EXT *) semId->pSemExt)->readQHead) + +/******************************************************************************* +* +* SEMRW_IS_FREE - check if a read/write semaphore is free +* +* RETURNS: TRUE if the semaphore is free, FALSE if not. +* +* BOOL SEMC_IS_FREE (SEM_ID semId) +* +* \NOMANUAL +*/ + +#define SEMRW_IS_FREE(semId) \ + ( \ + (((semId)->semOwner == NULL) && \ + (((SEM_RW_EXT *) (semId)->pSemExt)->readCount == 0)) \ + ) + +/******************************************************************************* +* +* SEMC_IS_FREE - check if a counting semaphore is free +* +* RETURNS: TRUE if the semaphore is free, FALSE if not. +* +* BOOL SEMC_IS_FREE (SEM_ID semId) +* +* \NOMANUAL +*/ + +#define SEMC_IS_FREE(semId) (semId->semCount > 0) + +/******************************************************************************* +* +* SEMBM_IS_FREE - check if a binary or mutex semaphore is free +* +* RETURNS: TRUE if the semaphore is free, FALSE if not. +* +* BOOL SEMBM_IS_FREE (SEM_ID semId) +* +* \NOMANUAL +*/ + +#define SEMBM_IS_FREE(semId) (semId->semOwner == NULL) + +/* variable declarations */ + +extern OBJ_CLASS semClass; /* semaphore object class */ +extern CLASS_ID semClassId; /* semaphore class id */ +extern FUNCPTR semCreateTbl []; /* semCreate() methods */ +extern FUNCPTR semGiveTbl []; /* semGive() methods */ +extern FUNCPTR semTakeTbl []; /* semTake() methods */ +extern FUNCPTR semFlushTbl []; /* semFlush() methods */ +extern FUNCPTR semGiveDeferTbl []; /* semGiveDefer() methods */ +extern FUNCPTR semFlushDeferTbl []; /* semFlushDefer() methods */ +extern int semMGiveKernWork; /* semMGiveKern() parameter */ + +extern FUNCPTR semSmShowRtn; /* shared semaphore show routine pointer */ +extern FUNCPTR semSmInfoRtn; /* shared semaphore info routine pointer */ + +/* function declarations */ + +extern STATUS semLibInit (void); +extern void semDeleteLibInit (void); +extern void semBCreateLibInit (void); +extern void semCCreateLibInit (void); +extern void semMCreateLibInit (void); +extern void semRWCreateLibInit (void); +extern STATUS semTerminate (SEM_ID semId); +extern STATUS semDestroy (SEM_ID semId, BOOL dealloc); +extern STATUS semGiveDefer (SEM_ID semId); +extern STATUS semFlushDefer (SEM_ID semId); +extern STATUS semInvalid (SEM_ID semId); +extern STATUS semIntRestrict (SEM_ID semId); +extern STATUS semQFlush (SEM_ID semId); +extern void semQFlushDefer (SEM_ID semId); +extern STATUS semBInit (SEMAPHORE *pSem,int options,SEM_B_STATE initialState); +extern STATUS semBGive (SEM_ID semId); +extern STATUS semBTake (SEM_ID semId, int timeout); +extern void semBGiveDefer (SEM_ID semId); +extern STATUS semMInit (SEMAPHORE *pSem, int options); +extern STATUS semMGive (SEM_ID semId); +extern STATUS semMTake (SEM_ID semId, int timeout); +extern STATUS semMTakeByProxy (SEM_ID semId, int tid); +extern STATUS semMGiveKern (SEM_ID semId); +extern STATUS semMPendQPut (SEM_ID semId, int timeout); +extern STATUS semCInit (SEMAPHORE *pSem,int options,int initialCount); +extern STATUS semCGive (SEM_ID semId); +extern STATUS semCTake (SEM_ID semId, int timeout); +extern void semCGiveDefer (SEM_ID semId); +extern STATUS semRWLibInit (void); +extern SEM_ID semRWCreate (int options); +extern STATUS semRWInit (SEMAPHORE * pSemaphore, int options); +extern STATUS semRWGive (SEM_ID semId); +extern STATUS semRWTake (SEM_ID semId, int timeout, int type); +extern STATUS semRTake (SEM_ID semId, int timeout); +extern STATUS semWTake (SEM_ID semId, int timeout); +extern STATUS semRUTake (SEM_ID semId, int timeout); + +/* workaround Diab handling of deprecated attribute in C++ */ + +extern STATUS semOTake (SEM_ID semId) _WRS_DEPRECATED ("please use semBLib instead"); +extern STATUS semBCoreInit (SEMAPHORE *pSemaphore, + int options, + SEM_B_STATE initialState) _WRS_DEPRECATED ("please use semBInitialize() instead"); + +extern STATUS semCCoreInit (SEMAPHORE *pSemaphore, + int options, + int initialCount) _WRS_DEPRECATED ("please use semCInitialize() instead"); + +extern STATUS semMCoreInit (SEMAPHORE *pSemaphore, + int options) _WRS_DEPRECATED ("please use semMInitialize() instead"); + +extern STATUS semQInit (SEMAPHORE *pSemaphore, + int options) _WRS_DEPRECATED ("please use semXInitialize() for the specific semaphore type instead"); + +#else /* _ASMLANGUAGE */ + +/* offsets into SEMAPHORE */ + +#define SEM_CLASS_ID WIND_OBJ_CORE_CLASS_ID /* 0x30 */ +#define SEM_TYPE WIND_OBJ_CORE_SIZE /* 0x40 */ +#define SEM_OPTIONS (WIND_OBJ_CORE_SIZE + 0x01) /* 0x41 */ +#define SEM_RECURSE (WIND_OBJ_CORE_SIZE + 0x02) /* 0x42 */ +#define SEM_Q_HEAD (WIND_OBJ_CORE_SIZE + 0x04) /* 0x44 */ +#define SEM_STATE (WIND_OBJ_CORE_SIZE + 0x14) /* 0x54 */ +#define SEM_EVENTS (WIND_OBJ_CORE_SIZE + 0x18) /* 0x58 */ +#define SEM_EVENTS_REGISTERED (WIND_OBJ_CORE_SIZE + 0x18) /* 0x58 */ +#define SEM_EVENTS_TASKID (WIND_OBJ_CORE_SIZE + 0x1c) /* 0x5c */ +#define SEM_EVENTS_OPTIONS (WIND_OBJ_CORE_SIZE + 0x20) /* 0x60 */ +#define SEM_PRI_INHERIT_FLAG (WIND_OBJ_CORE_SIZE + 0x24) /* 0x64 */ + +#define SEM_INST_RTN (WIND_CLASS_INST_RTN) /* 0x1c */ + +#endif /* _ASMLANGUAGE */ + +#define SEM_M_Q_GET 0x1 /* semMGiveKernWork() defines */ +#define SEM_M_SAFE_Q_FLUSH 0x2 +#define SEM_M_PRI_RESORT 0x4 +#define SEM_M_SEND_EVENTS 0x8 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsemLibPh */ diff --git a/h/private/semPxLibP.h b/h/private/semPxLibP.h new file mode 100644 index 0000000..d6eee60 --- /dev/null +++ b/h/private/semPxLibP.h @@ -0,0 +1,57 @@ +/* semPxLibP.h - private POSIX semaphore library header */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,29sep04,dcc updated _sem_destroy API to accept a dealloc parameter. +01g,28sep04,fr removed semPxCreateRtn prototype (SPR 101349) +01f,30mar04,dcc updated to use posixated object management. +01e,05dec03,m_s code-inspection changes +01d,31oct03,m_s moved the semaphore descriptor definition from semaphore.h + and ported to Base 6 +01c,12jan94,kdl changed semaphoreInit() to semPxLibInit(). +01b,17dec93,dvs added semPxClassId +01a,29nov93,dvs written +*/ + +#ifndef __INCsemPxLibPh +#define __INCsemPxLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "stdarg.h" +#include "private/objLibP.h" +#include "private/classLibP.h" + +extern CLASS_ID semPxClassId; /* POSIX sem class ID */ + +/* posix semaphore descriptor */ + +typedef struct sem_des /* sem_t */ + { + OBJ_CORE objCore; /* object core */ + SEM_ID wSemId; /* Wind semaphore identifier */ + struct sem_des * pSelf; /* pointer to self */ + } PSEMAPHORE; + + +/* function declarations */ + +extern STATUS semPxLibInit (void); +extern int _sem_destroy (PSEMAPHORE * pxSemId, BOOL dealloc); +extern int _sem_close (PSEMAPHORE * pxSemId); +extern int _sem_wait (PSEMAPHORE * pxSemId); +extern int _sem_trywait (PSEMAPHORE * pxSemId); +extern int _sem_post (PSEMAPHORE * pxSemId); +extern int _sem_getvalue (PSEMAPHORE * pxSemId, int * sval); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsemPxLibPh */ diff --git a/h/private/semPxSysCall.h b/h/private/semPxSysCall.h new file mode 100644 index 0000000..7bd5606 --- /dev/null +++ b/h/private/semPxSysCall.h @@ -0,0 +1,43 @@ +/* semPxSysCall.h - POSIX semaphore system calls */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,24mar04,mcm Including time.h instead of sys/time.h in user-space +01a,17nov03,m_s written +*/ + +#ifndef __INCsemPxSysCallh +#define __INCsemPxSysCallh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "objLib.h" +#include "pxObjSysCall.h" + +#include "time.h" + +/* typedefs */ + +/* structure for pxCtl system call */ + +struct semGetvalueArgs /* PX_SEM_GETVALUE */ + { + int * sval; + }; + +/* system call function prototypes */ + +extern int pxSemWait (OBJ_HANDLE handle, PX_WAIT_OPTION waitOption, + struct timespec * timeout); +extern int pxSemPost (OBJ_HANDLE handle); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsemPxSysCallh */ diff --git a/h/private/semSmLibP.h b/h/private/semSmLibP.h new file mode 100644 index 0000000..1a89a39 --- /dev/null +++ b/h/private/semSmLibP.h @@ -0,0 +1,89 @@ +/* semSmLibP.h - private shared semaphore library header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,29jan93,pme added little endian support +01b,22sep92,rrr added support for c++ +01a,19jul92,pme extracted from semSmLib v1c. +*/ + +#ifndef __INCsemSmLibPh +#define __INCsemSmLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "vwModNum.h" +#include "semSmLib.h" +#include "smDllLib.h" + +/* typedefs */ + +#define SEM_TYPE_SM_BINARY 0x4 /* shared binary semaphore */ +#define SEM_TYPE_SM_COUNTING 0x5 /* shared counting semaphore */ + +#if (defined (CPU_FAMILY) && (CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct sm_semaphore /* SHARED MEMORY SEMAPHORE */ + { + UINT32 verify; /* 0x00: semaphore verification */ + UINT32 objType; /* 0x04: semaphore type */ + UINT32 lock; /* 0x08: semaphore spin lock */ + SM_DL_LIST smPendQ; /* 0x0c: semaphore pend Queue */ + union + { + UINT32 flag; /* 0x14: current state */ + UINT32 count; /* 0x14: semaphore counter */ + } state; + + } SM_SEMAPHORE; + +#if (defined (CPU_FAMILY) && (CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* variable declarations */ + +extern FUNCPTR semSmShowRtn; /* shared semaphore show routine ptr */ +extern FUNCPTR semSmInfoRtn; /* shared semaphore info routine ptr */ + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void semSmLibInit (void); +extern STATUS semSmBInit (SM_SEMAPHORE * pSem, int options, + SEM_B_STATE initialState); +extern STATUS semSmCInit (SM_SEMAPHORE * pSem, int options, int initialCount); +extern STATUS semSmGive (SM_SEM_ID smSemId); +extern STATUS semSmTake (SM_SEM_ID smSemId, int timeout); +extern STATUS semSmFlush (SM_SEM_ID smSemId); +extern int semSmInfo (SM_SEM_ID smSemId, int idList[], int maxTasks); +extern int semSmShow (SM_SEM_ID smSemId, int level); + +#else /* __STDC__ */ + +extern void semSmLibInit (); +extern STATUS semSmBInit (); +extern STATUS semSmCInit (); +extern STATUS semSmGive (); +extern STATUS semSmTake (); +extern STATUS semSmFlush (); +extern int semSmInfo (); +extern int semSmShow (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsemSmLibPh */ diff --git a/h/private/semSysCall.h b/h/private/semSysCall.h new file mode 100644 index 0000000..af2373e --- /dev/null +++ b/h/private/semSysCall.h @@ -0,0 +1,60 @@ +/* semSysCall.h - VxWorks semaphore system call definitions */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,22apr04,dcc added "context" to _semOpen() parameters. +01a,31oct03,md written +*/ + +#ifndef __INCsemSysCallh +#define __INCsemSysCallh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + + +/* command codes for the semCtl() system call */ + +typedef enum + { + VX_SEM_CTL_MTAKE_PROXY, + VX_SEM_CTL_SEM_OWNER, + VX_SEM_CTL_FLUSH + } VX_SEM_CTL_CMD; + + +/* command struct for VX_SEM_CTL_VAR_* commands */ + +typedef struct vx_sem_ctl_var_cmd + { + int *pVariable; + int value; + } VX_SEM_CTL_VAR_CMD; + + +/* system call function prototypes */ + +#if !defined(_WRS_KERNEL) + +extern STATUS semCtl (SEM_ID_KERNEL semId, VX_SEM_CTL_CMD command, + void * pArg, UINT * pArgSize); +extern SEM_ID_KERNEL _semOpen (const char * name, SEM_TYPE type, + int initState, int options, int mode, + void * context); +extern STATUS _semTake (OBJ_HANDLE semId, int timeout); +extern STATUS _semGive (OBJ_HANDLE semId); +extern STATUS _semFlush (OBJ_HANDLE semId); + +#endif /* !_WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsemSysCallh */ diff --git a/h/private/seqDrvP.h b/h/private/seqDrvP.h new file mode 100644 index 0000000..792aad4 --- /dev/null +++ b/h/private/seqDrvP.h @@ -0,0 +1,46 @@ +/* seqDrvP.h - event buffer library header */ + +/* Copyright 1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,10dec93,smb written. +*/ + +#ifndef __INCseqdrvph +#define __INCseqdrvph + + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) || defined(__cplusplus) + +extern UINT32 seqStamp (void); +extern UINT32 seqStampLock (void); +extern STATUS seqEnable (void); +extern STATUS seqDisable (void); +extern STATUS seqConnect ( FUNCPTR dummy, int dummyArg ); +extern UINT32 seqPeriod (void); +extern UINT32 seqFreq (void); + +#else /* __STDC__ */ + +extern UINT32 seqStamp (); +extern UINT32 seqStampLock (); +extern STATUS seqEnable (); +extern STATUS seqDisable (); +extern STATUS seqConnect (); +extern UINT32 seqPeriod (); +extern UINT32 seqFreq (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCseqdrvph */ + diff --git a/h/private/setLibP.h b/h/private/setLibP.h new file mode 100644 index 0000000..b067513 --- /dev/null +++ b/h/private/setLibP.h @@ -0,0 +1,82 @@ +/* setLibP.h - Private header file for Wind Object Sets */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,14oct02,dat 5.X compatibility +01c,18apr01,cjj mods after FHA 1.0 code inspection +01b,27nov00,cjj added OBJ_SET definition which was in setLib.h +01a,16feb98,mas, original version. TOR 1.0.1/VXW 5.3 compliant. + dat +*/ + +/* +DESCRIPTION +This file contains the Private configuration parameters for the Wind Object +Set library. + +A set is an object containing a collection of objects with no implied order +although application-specific ordering may be enforced through other libraries. +A set may have any number of objects. A set may contain other sets. A set +with no objects is a null set. Sets have no size restrictions other than +available memory. + +Objects are referenced by a set, never included directly. This allows objects +to be independent of set implementation and target architecture variations. +*/ + +#ifndef INCsetLibPh +#define INCsetLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes */ + +#include "vxWorks.h" +#include "private/objLibP.h" +#include "private/classLibP.h" +#include "setLib.h" +#include "lstLib.h" +#include "semLib.h" + +/* defines */ + +#define SET_CLASS_OPTIONS WIND_CLASS_ALLOW_DUPLICATE_NAMES + +/* Set mutex semaphore attributes */ + +#define SET_SEM_CREATE_ATTRIB \ + (SEM_Q_PRIORITY | SEM_INVERSION_SAFE | SEM_DELETE_SAFE) + +/* Typedefs */ + +typedef struct setNode + { + NODE node; /* doubly-linked list pointers */ + SET_ITEM itemId; /* object ID */ + } SET_NODE; +typedef struct setNode * NODE_ID; + +/* Object Set structure */ + +typedef struct setObj + { + OBJ_CORE objCore; + LIST setList; /* Header of doubly-linked list (set) of objects */ + NODE_ID curNode; /* current node ID in set traversal */ + SEM_ID mutex; /* Mutex to use when servicing set */ + } SET_OBJ; + +/* Global exports */ + +extern CLASS_ID setClassId; + +#ifdef __cplusplus +} +#endif + +#endif /* INCsetLibPh */ diff --git a/h/private/shellDataLibP.h b/h/private/shellDataLibP.h new file mode 100644 index 0000000..d39737a --- /dev/null +++ b/h/private/shellDataLibP.h @@ -0,0 +1,39 @@ +/* shellDataLibP.h - private header for the shell data management module */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,28oct03,bpn Written. +*/ + +#ifndef __INCshellDataLibPh +#define __INCshellDataLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes */ +#ifndef HOST +#include +#else +#include +#endif + +#include + +/* Defines */ + +/* Structures */ + +/* Function declarations */ + +void shellDataAllRemove (SHELL_ID shellId, BOOL finalize); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCshellDataLibPh */ diff --git a/h/private/shellInOutLibP.h b/h/private/shellInOutLibP.h new file mode 100644 index 0000000..2346d48 --- /dev/null +++ b/h/private/shellInOutLibP.h @@ -0,0 +1,100 @@ +/* shellInOutLibP.h - private header file for the shell IO management module */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,22sep04,bpn Added some definitions from shellInOutLib.h. +01d,30jun04,bpn Fixed SPR#97937: removed shellInOutCompatible...() functions. +01c,15apr04,bpn Added background structure definition. +01b,26mar04,bpn Added structure definitions for shellInOutBlockingXxx() + functions. +01a,17feb04,bpn Written. +*/ + +#ifndef __INCshellInOutLibPh +#define __INCshellInOutLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +enum ioType + { + SHELL_IO_REDIR = 1, + SHELL_IO_BLOCKING, + SHELL_IO_BACKGROUND + }; + +struct redirection + { + BOOL isRedirected; /* TRUE if redirected */ + int curInFd; /* input before redirection */ + int curOutFd; /* output before redirection */ + int curErrFd; /* error before redirection */ + int inFd; /* input for redirection */ + int outFd; /* output for redirection */ + int errFd; /* error for redirection */ +#ifdef HOST + int haveTerminal; /* for host shell */ +#endif + }; + +struct blocking + { + char * name; + int masterFd; + int slaveFd; + BOOL isBlocked; + SEM_ID stateMutexId; + SEM_ID structMutexId; + UINT32 data; + }; + +struct background + { + char * name; +#ifdef HOST + char * masterFilename; + char * slaveFilename; +#endif + int masterFd; + int slaveFd; + }; + +union ioData + { + struct blocking blocking; + struct redirection redirection; + struct background background; + }; + +typedef struct shell_io_fd_node + { + NODE node; + enum ioType type; + union ioData data; + } SHELL_IO_FD_NODE; + +extern BOOL shellInOutInputUniqueCheck (int shellInputFd); +extern STATUS shellInOutInputHookSet (SHELL_ID shellId); +extern STATUS shellInOutInputHookUnset (SHELL_ID shellId); + +/* XXX bpn - define this function here because they are used by edrStub.c */ + +extern int shellPrint (SHELL_ID shellId, const char * fmt, ...); +extern int shellPrintErr (SHELL_ID shellId, const char * fmt, ...); + +/* XXX bpn - define this function here because they are used by external files */ + +extern void shellInOutUse (SHELL_ID shellId); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCshellInOutLibPh */ diff --git a/h/private/shellInternalLibP.h b/h/private/shellInternalLibP.h new file mode 100644 index 0000000..698cdba --- /dev/null +++ b/h/private/shellInternalLibP.h @@ -0,0 +1,261 @@ +/* shellInternalLibP.h - private header for the internal shell library */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02a,22sep04,bpn Renamed shellInternalLibP.h. Updated shellInternalStrToInt() + prototype. +01z,09sep04,bpn Added shellInternalStrToInt32() prototype. +01y,01sep04,bpn Removed shellInternalDemangleSymbolGet() prototype. +01x,18aug04,bpn Updated prototypes. +01w,21jun04,p_b modified shellInternalOptGet to take / or - as option token +01v,11may04,bpn Modified shellInternalTaskNameMatch() API. +01u,15apr04,bpn Added shellInternalDecValueDisplay() and + shellInternalHexValueDisplay() prototypes. +01t,11mar04,bpn Added shellInternalHostFunctionCall() and + shellInternalFuncStringArgAdd() prototypes. +01s,04mar04,bpn Modified the symbol function API to support a namespace string. +01r,26feb04,bpn Moved prototypes to shellMemLib.h. +01q,02feb04,bpn Modified shellInternalRegFree() prototype. Added + shellInternalMemRegister(), shellInternalMemUnregister() + shellInternalMemAllFree() prototypes. +01p,21jan04,bpn Modified shellInternalRegAllFree() prototype. +01o,03dec03,bpn Added shellInternalSymTblFromTaskGet() and + shellInternalSymTblFromRtpGet() prototypes. +01n,25nov03,lcs Add prototype for routine to decode command arguments + commencing with & or $ characters. +01m,06oct03,bpn Added shellInternalStrSpaceTokenize() prototype. +01l,21oct03,bpn Updated symbol related function API. +01k,03oct03,bpn Added shellInternalStrToFloat() prototype. +01j,23sep03,bpn Fixed build warning. Moved structures from shellLib.h. +01i,22aug03,bpn Added shellInternalOptGet() and shellInternalOptFree() + prototypes. +01h,19aug03,bpn Added several functions in order the shell uses its own + memory partition (partial fix of SPR #90221). +01g,22jul03,bpn Added shellInternalStrToChar(), shellInternalStrUnquote(), + shellInternalStrTokenize() and shellInternalStrToInt() + prototypes. +01f,08jul03,bpn Changed file shellInternalFuncArgAdd() to + shellInternalFuncIntArgAdd(). +01e,10jun03,bpn Changed file name to shellInternalLib.h +01d,13mar03,lcs Add support for hostsh host function calls. +01c,10mar03,lcs Add support for host shell. +01b,04mar03,bpn Some definitions are only target specific. +01a,17feb03,bpn Written. +*/ + +#ifndef __INCshellInternalLibPh +#define __INCshellInternalLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes */ + +#ifdef HOST +#include +#endif + +#include + +#ifndef HOST +#include /* needed by symLibP.h */ +#include /* needed by symLibP.h */ +#include /* needed for SYMTAB_ID */ +#include /* needed for RTP_ID */ +#else +#define SYMTAB_ID int /* XXX bpn - to change */ +#define RTP_ID int /* XXX bpn - to change */ +#define INSTR void /* XXX bpn - to change */ +#endif + +/* Defines */ + +#define MAX_FUNC_ARGS 12 /* max number of args to any one function */ + /* + * NOTE: The array indices in shellInternalFunctionCall() + * must agree with MAX_FUNC_ARGS!! + */ + +/* Structures */ + +typedef enum shell_value_type + { + /* + * The order of the types is important. Don't change it! It is ordered + * according to the size of the data type, and according to the number + * digit that can be coded. + */ + SHELL_CHAR = 1, + SHELL_SHORT, + SHELL_FLOAT, + SHELL_INT, + SHELL_LONG, + SHELL_POINTER, + SHELL_DOUBLE, + SHELL_LLONG, + SHELL_HOST + } SHELL_VALUE_TYPE; + +typedef union shell_type_val /* different value type formats */ + { + void * pointer; /* for SHELL_POINTER */ + char charVal; /* for SHELL_CHAR */ + short shortVal; /* for SHELL_SHORT */ + int intVal; /* for SHELL_INT */ + long longVal; /* for SHELL_LONG */ + INT64 lLongVal; /* for SHELL_LLONG */ + float floatVal; /* for SHELL_FLOAT */ + double doubleVal; /* for SHELL_DOUBLE */ + } SHELL_TYPE_VAL; + +typedef struct shell_eval_value /* value for argument evaluation */ + { + SHELL_TYPE_VAL * pSymbolVal; + SHELL_VALUE_TYPE type; + SHELL_TYPE_VAL value; + BOOL isUnsigned; + } SHELL_EVAL_VALUE; + +typedef enum shell_symbol_type + { + SHELL_SYM_ANY = 1, + SHELL_SYM_TEXT, + SHELL_SYM_DATA, + SHELL_SYM_HOST, + SHELL_SYM_NONE + } SHELL_SYMBOL_TYPE; + +typedef struct shell_func_arg_stack + { + UINT numArgs; + int argsArray[MAX_FUNC_ARGS]; +#ifdef HOST + BOOL isString[MAX_FUNC_ARGS]; +#endif + } SHELL_FUNC_ARG_STACK; + +typedef struct shell_option /* an option structure */ + { + char * string; /* additional argument */ + BOOL isSet; /* TRUE if the option is defined */ + BOOL isLast; /* TRUE if it is the last array element */ + } SHELL_OPTION; + +typedef enum shell_option_type /* type of an option array */ + { + SHELL_OPTION_ERROR = ERROR, + SHELL_OPTION_GETOPT, + SHELL_OPTION_ARGC_ARGV + } SHELL_OPTION_TYPE; + +/* Function definition */ + +extern SYMTAB_ID shellInternalSymTblFromTaskGet (int taskId, + INSTR * address); +extern SYMTAB_ID shellInternalSymTblFromRtpGet (RTP_ID rtpId, + INSTR * address); + +extern STATUS shellInternalTextSymbolGet (SYMTAB_ID symTblId, + const char * symbolName, + SHELL_TYPE_VAL ** ppSymbolValue); + +extern STATUS shellInternalDataSymbolGet (SYMTAB_ID symTblId, + const char * symbolName, + SHELL_TYPE_VAL ** ppSymbolValue); + +extern STATUS shellInternalSymbolGet (SYMTAB_ID symTblId, + const char * symbolName, + SHELL_TYPE_VAL ** ppSymbolValue, + SHELL_SYMBOL_TYPE * pSymTypeOut); + +extern STATUS shellInternalSymbolDisplay (SYMTAB_ID symTblId, + SHELL_TYPE_VAL * pSymbolVal, + const char * prefix, + const char * suffix); + +extern STATUS shellInternalDecValueDisplay (SHELL_TYPE_VAL * pValue, + BOOL unsignedVal, + SHELL_VALUE_TYPE type); + +extern STATUS shellInternalHexValueDisplay (SHELL_TYPE_VAL * pValue, + SHELL_VALUE_TYPE type); + +extern STATUS shellInternalValueDisplay (SYMTAB_ID symTblId, + SHELL_TYPE_VAL * pValue, + BOOL unsignedVal, + SHELL_VALUE_TYPE type); + +extern STATUS shellInternalKernelSymbolCreate (const char * symbolName, + SHELL_VALUE_TYPE type); + +extern SHELL_FUNC_ARG_STACK * shellInternalArgStackAllocate (); + +extern STATUS shellInternalFuncIntArgAdd (SHELL_FUNC_ARG_STACK * pArgStack, + int value); + +extern STATUS shellInternalFuncLLongArgAdd (SHELL_FUNC_ARG_STACK * pArgStack, + INT64 value); + +extern STATUS shellInternalFuncFloatArgAdd (SHELL_FUNC_ARG_STACK * pArgStack, + float value); + +extern STATUS shellInternalFuncDoubleArgAdd (SHELL_FUNC_ARG_STACK * pArgStack, + double value); + +extern STATUS shellInternalFunctionCall (SHELL_TYPE_VAL * pReturnValue, + SHELL_VALUE_TYPE funcType, + void * funcAddr, + SHELL_FUNC_ARG_STACK * pArgStack); + +extern STATUS shellInternalArgumentEval (const char * arg, + const char * interpreterName, + SHELL_EVAL_VALUE * pValue); + +extern int shellInternalTaskNameMatch (const char * substr, int * pTaskId); + +extern char * shellInternalStrUnquote (char * string); +extern char * shellInternalStrSpaceTokenize (char * string, char ** ppString); +extern char * shellInternalStrTokenize (char * string, + const char * tokenSep, + char ** ppString); +extern int shellInternalStrToChar (const char * string, char * pChar); +extern int shellInternalStrToInt (const char * valueStr, + SHELL_TYPE_VAL * pVal, + SHELL_VALUE_TYPE * pType, + BOOL * pIsUnsigned, BOOL autoType); +extern int shellInternalStrToInt2 (const char * valueStr, + SHELL_TYPE_VAL * pVal, + SHELL_VALUE_TYPE * pType, + BOOL * pIsUnsigned); +extern int shellInternalStrToFloat (const char * valueStr, + SHELL_TYPE_VAL * pVal, + SHELL_VALUE_TYPE * pType); +extern STATUS shellInternalStrToInt32 (const char * valueStr, + INT32 * pInt, const char * errorStr); + +extern SHELL_OPTION_TYPE shellInternalOptGet (const char * options, + const char * argumentsStr, + const char optionToken, + SHELL_OPTION ** ppOptArray); +extern void shellInternalOptFree (SHELL_OPTION * pOptArray); +extern STATUS shellInternalSymbolsResolve (SHELL_OPTION * pOptArray, + SYMTAB_ID symTabId); +#ifdef HOST +extern STATUS shellInternalFuncStringArgAdd (SHELL_FUNC_ARG_STACK * pArgStack, + char * value); +extern STATUS shellInternalHostFunctionCall (SHELL_TYPE_VAL * pReturnValue, + SHELL_VALUE_TYPE funcType, + void * funcAddr, + SHELL_FUNC_ARG_STACK * pArgStack, + BOOL isCmdForHost); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCshellInternalLibPh */ diff --git a/h/private/shellInterpLibP.h b/h/private/shellInterpLibP.h new file mode 100644 index 0000000..5894d70 --- /dev/null +++ b/h/private/shellInterpLibP.h @@ -0,0 +1,57 @@ +/* shellInterpLibP.h - private header file for the interpreters management */ + +/* Copyright 2003-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,08feb05,bpn Added shellInterpPromptDftSet() prototype, changed + shellInterpPromptSet() (SPR#106114). +01e,28jul04,bpn Removed shellInterpNameFromCtxGet() and shellInterpCtxCreate() + prototypes. +01d,26feb04,bpn Added shellInterpRestart() and shellInterpEventDispatch() + prototypes. +01c,21jan04,bpn Added shellInterpDelete() prototype. +01b,25jun03,bpn Added shellInterpHistorySave() prototype. +01a,17feb03,bpn Written. +*/ + +#ifndef __INCshellInterpLibPh +#define __INCshellInterpLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes */ + +#include +#include +#include + +/* Function declarations */ + +extern STATUS shellInterpSet (SHELL_CTX * pShellCtx, + const char * interpreterName); +extern const char * shellInterpPromptGet (SHELL_INTERP_CTX * pInterpCtx); +extern STATUS shellInterpPromptSet (SHELL_ID shellId, + const char * interp, + const char * promptFmt); +extern STATUS shellInterpPromptDftSet (const char * interp, + const char * promptFmt); + +extern STATUS shellInterpSwitch (SHELL_CTX * pShellCtx); + +extern void shellInterpDelete (SHELL_CTX * pShellCtx); +extern void shellInterpRestart (SHELL_CTX * pShellCtx); + +#ifdef HOST +extern void shellInterpHistorySave (SHELL_CTX * pShellCtx); +extern STATUS shellInterpEventDispatch (const char * evt); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCshellInterpLibPh */ diff --git a/h/private/shellLibP.h b/h/private/shellLibP.h new file mode 100644 index 0000000..bb4212c --- /dev/null +++ b/h/private/shellLibP.h @@ -0,0 +1,165 @@ +/* shellLibP.h - private header file for the kernel shell module */ + +/* Copyright 2003-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01v,14feb05,bpn Moved shellPromptFormatSet() prototype to shellPromptLib.h +01u,01feb05,bpn Added shellPromptFormatSet() prototype. +01t,10jan05,bpn Removed dependencies with dbgLib.o. +01s,23sep04,bpn Updated include files. +01r,28jul04,bpn Added APIs from shellLib.h. +01q,25may04,bpn Added SHELL_LKUP_PG_KEY string. +01p,11may04,bpn Added fgndShellId field to SHELL_CTX structure. +01o,15apr04,bpn Added isBackground field to SHELL_CTX structure. +01n,07apr04,bpn Export shellConsoleTaskId value. +01m,26mar04,bpn Added errnoValue field to SHELL_CTX structure. +01l,28jan04,bpn Added several fields to SHELL_CTX structure to fix I/O + redirection bugs. +01k,14jan04,bpn Added inputLine field to SHELL_CTX structure to fix memory + leaks. +01j,28oct03,bpn Moved SHELL_USER_DATA structure to shellDataLibP.h. Removed + shellLedCompletion() prototype (local function now). +01i,24oct03,bpn Added shellLedCompletion() prototype. +01h,22sep03,bpn Added shellInterpEvaluate() prototype. +01g,25jun03,bpn Removed shellHistSize field from SHELL_CTX structure. +01f,19may03,bpn Add the user data structure definition. +01e,17apr03,lcs Add routines to configure shell environment. +01d,08apr03,bpn Added fields to the shell_ctx structure to detect a shell task + restart and to avoid saving user/passwd several times. +01c,12mar03,lcs Added support for host shell. +01b,10mar03,bpn Added interpreter switch mechanism. Changed SHELL_CONTEXT + structure name to SHELL_CTX. +01a,20feb03,bpn Written. +*/ + +#ifndef __INCshellLibPh +#define __INCshellLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes */ + +#ifndef HOST +#include +#include +#else +#include +#include +#endif + +#include +#include + +#include +#include +#include + +/* Defines */ + +#define SHELL_LKUP_PG_KEY "_WRS_lkupPgSz" + +/* Typedefs */ + +typedef struct shell_inline_node + { + NODE node; + char * inputLine; /* buffer for the input line */ + } SHELL_INLINE_NODE; + +typedef struct shell_ctx_login + { + FUNCPTR loginFunc; /* shell login function */ + FUNCPTR logoutFunc; /* shell logout function */ + int loginParam; /* param. passed to login function */ + int logoutParam; /* param. passed to logout function */ + char user[MAX_IDENTITY_LEN]; /* login name*/ + char passwd[MAX_IDENTITY_LEN]; /* password */ + BOOL isIdentitySaved; /* was login saved ? */ + } SHELL_CTX_LOGIN; + +typedef struct shell_ctx_io + { + int shellStdin; /* standard stdin */ + int shellStdout; /* standard stdout */ + int shellStderr; /* standard stdout */ + } SHELL_CTX_IO; + +typedef struct shell_ctx_values + { + BOOL isInteractive; /* interactive or script? */ + const char * config; /* configuration string */ + SHELL_CTX_LOGIN login; /* login stucture */ + SHELL_CTX_IO io; /* io structure */ + } SHELL_CTX_VALUES; + +typedef struct shell_ctx_compat + { + SHELL_CTX_VALUES initial; /* initial values */ + SHELL_CTX_VALUES current; /* initial values */ + BOOL loginAccess; /* connection with a login? */ + } SHELL_CTX_COMPAT; + +/* The shell context structure */ + +typedef struct shell_ctx + { + NODE node; + const char * taskName; /* shell task name */ + SHELL_INTERP_CTX * pInterpCtx; /* interpreter parameters */ + SHELL_INTERP * pInterpSwitch; /* next interpreter to use */ + SHELL_ID bgndShellId; /* background session Id */ + SHELL_ID fgndShellId; /* foreground session Id */ + LIST userData; /* list of the user data */ + LIST interpCtxLst; /* list of interp context */ + LIST ioFileDescLst; /* list of IO file descriptors */ + LIST inputLineLst; /* list input line buffers */ + SHELL_CTX_VALUES initial; /* initial values */ + SHELL_CTX_VALUES current; /* initial values */ + SHELL_CTX_COMPAT compatible; /* for compatibility */ + BOOL loginAccess; /* connection with a login? */ + int errnoValue; /* errno value */ + int taskStackSize; /* shell task stack size */ + LED_ID ledId; /* line editor ID */ + int taskId; /* shell task ID */ + BOOL isAbortReq; /* abort requested? */ + BOOL isRestarted; /* task restarted? */ + BOOL isBackground; /* background session? */ + char path[MAX_FILENAME_LENGTH]; /* default pathname */ + } SHELL_CTX; + +extern int shellConsoleTaskId; +extern FUNCPTR _func_shellDbgStackTrace; +extern FUNCPTR _func_shellDbgCallPrint; + +/* Function Declarations */ + +extern STATUS shellLogout2 (SHELL_ID shellId, const char * errorStr); +extern STATUS shellScriptNoAbort (void); +extern void shellPromptPrint (SHELL_ID shellId); +extern SHELL_ID shellBackgroundInit (const char * interpName, + const char * evalString); +extern char * shellBackgroundRead (LIST * pMemList, INT32 memFlags); + +extern UINT32 shellLineLenGet (void); + +extern STATUS shellExec (SHELL_CTX * pShellCtx); + +extern STATUS shellInterpEvaluate (char * arg, + const char * interpreterName, + SHELL_EVAL_VALUE * pValue); +#ifdef HOST +extern STATUS shellHostInitialize (SHELL_CTX * pShellCtx, + struct timeval * pStdinPollTimeout, + VOIDFUNCPTR eventPoll); +extern void shellContextHostFinalize (SHELL_CTX * pShellCtx); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCshellLibPh */ diff --git a/h/private/shellMemLibP.h b/h/private/shellMemLibP.h new file mode 100644 index 0000000..99291dc --- /dev/null +++ b/h/private/shellMemLibP.h @@ -0,0 +1,56 @@ +/* shellMemLibP.h - private header for the shell memory library */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,23sep04,bpn Added definitions from shellMemLib.h. +01c,25aug04,bpn Added shellMemStringIsAllocated() prototype. +01b,06apr04,bpn Fixed scalability issue with memShow.o +01a,23feb04,bpn Written. +*/ + +#ifndef __INCshellMemLibPh +#define __INCshellMemLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes */ + +#include + +/* Structures */ + +typedef struct shell_alloc + { + NODE node; + void * pMem; /* memory area address allocated */ + INT32 flags; /* flags associated to that memory */ + } SHELL_ALLOC; + +/* Function definition */ + +#if !defined(HOST) && defined(DEBUG) +extern void shellMemShow (int type); +#endif + +extern void shellMemRegAllFree (INT32 flags, INT32 mask, LIST * pList); +extern void shellMemAllRegFree (INT32 flags, INT32 mask, + VOIDFUNCPTR freeRtn, LIST * pList); +extern BOOL shellMemStringIsAllocated (SHELL_ID shellId, + const char * string); +/* XXX bpn - needed by usrLib.c */ + +extern char * shellMemStringAdd (SHELL_ID shellId, const char * string); +extern STATUS shellMemStringFree (SHELL_ID shellId, const char * string); +extern void shellMemStringShow (SHELL_ID shellId); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCshellMemLibPh */ diff --git a/h/private/shlLibP.h b/h/private/shlLibP.h new file mode 100644 index 0000000..695b002 --- /dev/null +++ b/h/private/shlLibP.h @@ -0,0 +1,75 @@ +/* shlLibP.h - private shared library support library header file */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,05nov04,kk updated prototype of shlRtpDeleteAll() +01c,21sep04,bpn Added functions prototypes shlNodeTake(), shlIdGive() and + shlNodeToShlId(). +01b,16apr04,pad Added structure type RTP_SHL_INFO to return information about + a SL bound to a RTP. Added declaration of shlRtpInfoGet(). + Declarations of shlLibInit() and shlRtpDeleteAll() moved here. +01a,26mar04,dms created based on sdLib.h +*/ + +#ifndef __INCshlLibPh +#define __INCshlLibPh + +#include "vxWorks.h" +#include "shlLibCommon.h" +#include "dllLib.h" + +#define RTPSHL_MUTEX_TAKEN 0x00000001 /* set if RTP owns shlNode mutex */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct + { + DL_NODE next; /* chain of all SHL_NODEs */ + char * name; /* unique string identifier */ + UINT GOTTIndex; + UINT32 flags; + UINT32 count; /* number of references */ + SEM_ID mutex; /* lock for text segment initialization */ + VIRT_ADDR textBase; /* address of shared library text segment */ + size_t textSize; /* size of shared library text segment */ + size_t dataSize; /* size of shared library data segment */ + } SHL_NODE; + +typedef struct + { + DL_NODE next; /* per-RTP chain of RTP_SHL_NODEs */ + SHL_NODE *pShlNode; + UINT32 flags; + VIRT_ADDR dataBase; /* address of shared library data in the RTP */ + } RTP_SHL_NODE; + +typedef struct rtpShlInfo /* information about a SL bound to a RTP */ + { + char * fileName; /* .so file name and path */ + VIRT_ADDR textBase; /* base address of SL text segment */ + size_t textSize; + VIRT_ADDR dataBase; /* base address of RTP's copy of SL data seg */ + size_t dataSize; + } RTP_SHL_INFO; + +/* function declarations */ + +extern STATUS shlLibInit (void); +extern void shlRtpDeleteAll (RTP_ID rtpId); +extern STATUS shlRtpInfoGet (SHL_ID shlId, RTP_ID rtpId, + RTP_SHL_INFO * pRtpShlInfo); + +extern SHL_NODE * shlNodeTake (SHL_ID shlId); +extern void shlIdGive (SHL_NODE * pShlNode); +extern SHL_ID shlNodeToShlId (SHL_NODE * pShlNode); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCshlLibPh */ diff --git a/h/private/sigLibP.h b/h/private/sigLibP.h new file mode 100644 index 0000000..be1724e --- /dev/null +++ b/h/private/sigLibP.h @@ -0,0 +1,140 @@ +/* sigLibP.h - private signal facility library header */ + +/* Copyright 1984-1997 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02m,19may97,jpd made RESTART available from ASMLANGUAGE. +02l,06jul94,rrr added sc_resumption for I960KB. +02k,28jan94,kdl marked sigEvtRtn pointer declaration extern. +02j,12jan94,kdl added sigqueueInit() prototype. +02i,09jan94,c_s applied rrr's patch for SPR #955. +02h,10dec93,smb added event logging routine. +02g,22sep92,rrr added support for c++ +02f,22aug92,rrr added some prototypes. +02e,30jul92,rrr backed out 02d (we are now back to 02c) +02d,30jul92,kdl backed out 02c changes pending rest of exc handling. +02c,29jul92,rrr added fault table for exceptions +02b,08jul92,rrr added all the _sigCtx* function prototypes. +02a,04jul92,jcf cleaned up. +01b,26may92,rrr the tree shuffle +01a,27apr92,rrr written. +*/ + +#ifndef __INCsigLibPh +#define __INCsigLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE +#include "signal.h" +#include "excLib.h" +#include "private/funcBindP.h" +#include "regs.h" +#endif /* !_ASMLANGUAGE */ + +#define RESTART 1 /* must be different from OK and ERROR */ + +#ifndef _ASMLANGUAGE + +#define SIG_TIMEOUT_RECALC(t) (*_func_sigTimeoutRecalc)(t) + +struct sigq /* (Not posix) */ + { + struct sigq *sigq_next; + struct sigq *sigq_prev; + }; + +struct sigstack /* (Not posix) */ + { + int ss_onstack; + void *ss_sp; + }; + +struct sigtcb /* (Not posix) */ + { + struct sigaction sigt_vec[_NSIGS + 1]; + struct sigq sigt_qhead[_NSIGS + 1]; + struct sigstack sigt_stack; + struct sigwait *sigt_wait; + sigset_t sigt_kilsigs; + sigset_t sigt_blocked; + sigset_t sigt_pending; + sigset_t sigt_ignored; + }; + +struct sigpend /* (Not posix) */ + { + struct sigq sigp_q; + struct siginfo sigp_info; + long sigp_overruns; + long sigp_active_overruns; + REG_SET *sigp_pregs; + struct sigtcb *sigp_tcb; + }; + +struct sigfaulttable + { + int sigf_fault; + int sigf_signo; + }; + +struct sigcontext /* (Not posix) */ + { + int sc_onstack; + int sc_restart; + sigset_t sc_mask; + struct siginfo sc_info; + REG_SET sc_regs; +#if CPU_FAMILY==MC680X0 + unsigned short sc_fformat; /* only for 68k */ + unsigned short sc_pad; /* only for 68k */ +#endif +#if CPU == I960KB + struct { + char sc_data[16]; /* only for i960kb */ + } sc_resumption[1]; +#endif + REG_SET *sc_pregs; + }; + +extern VOIDFUNCPTR sigEvtRtn; /* windview - level 1 event logging */ + + +#if defined(__STDC__) || defined(__cplusplus) +extern void _sigCtxRtnValSet (REG_SET *regs, int val); +extern void *_sigCtxStackEnd (const REG_SET *regs); +extern int _sigCtxSave (REG_SET *regs); +extern void _sigCtxLoad (const REG_SET *regs); +extern void _sigCtxSetup (REG_SET *regs, void *pStackBase, void (*taskEntry)(), + int *args); + +extern int sigInit (void); +extern void sigPendInit (struct sigpend *__pSigPend); +extern int sigPendDestroy (struct sigpend *__pSigPend); +extern int sigPendKill (int __tid, struct sigpend *__pSigPend); +extern int sigqueueInit (int nQueues); +#else +extern void _sigCtxRtnValSet (); +extern void *_sigCtxStackEnd (); +extern int _sigCtxSave (); +extern void _sigCtxLoad (); +extern void _sigCtxSetup (); + +extern int sigInit (); +extern void sigPendInit (); +extern int sigPendDestroy (); +extern int sigPendKill (); +extern int sigqueueInit (); +#endif + +#endif /* ! _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsigLibPh */ diff --git a/h/private/sigeventP.h b/h/private/sigeventP.h new file mode 100644 index 0000000..bce3286 --- /dev/null +++ b/h/private/sigeventP.h @@ -0,0 +1,36 @@ +/* sigeventP.h - sigeventLib header files */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,25sep03,ans written +*/ + +#ifndef __INCsigeventph +#define __INCsigeventph + +#ifdef __cplusplus +extern "C" { +#endif + +struct sigevent_t + { + int notifierId; /* task or RTP Id to notify */ + struct sigevent sigEvent; /* sigevent descibing the notification */ + union + { + struct sigpend _timerSigPend; + } notifier; +#define timerSigPend notifier._timerSigPend + + }; + + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsigeventph */ diff --git a/h/private/smFixBlkLibP.h b/h/private/smFixBlkLibP.h new file mode 100644 index 0000000..6e516f2 --- /dev/null +++ b/h/private/smFixBlkLibP.h @@ -0,0 +1,83 @@ +/* smFixBlkLibP.h - private fixed block shared mem mgr library header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,01aug94,dvs backed out pme's changes for reserved fields in main data structures. +01c,20mar94,pme added reserved fields in main data structures to allow + compatibility between future versions. +01b,22sep92,rrr added support for c++ +01a,19jul92,pme extracted from smFixBlkLib v1a. +*/ + +#ifndef __INCsmFixBlkLibPh +#define __INCsmFixBlkLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "smDllLib.h" + +/* defines */ + +#define MEM_PART_TYPE_SM_FIX 21 /* fixed block shared mem partition */ + +/* typedefs */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct sm_fix_blk_part /* Fixed block partition header */ + { + UINT32 verify; /* partition is initialized */ + UINT32 objType; /* fixed block partition */ + + SM_DL_LIST freeList; /* list of free blocks */ + int lock; /* partition spinlock */ + unsigned totalBlocks; /* total number of blocks in pool */ + int blockSize; /* block size in bytes */ + + /* allocation statistics */ + + unsigned curBlocksAllocated; /* current # of blocks allocated */ + unsigned cumBlocksAllocated; /* cumulative # of blocks allocated */ + + } SM_FIX_BLK_PART; + +typedef struct sm_fix_blk_part * SM_FIX_BLK_PART_ID; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void smFixBlkPartInit (SM_FIX_BLK_PART_ID gPartId, + char * pPool, unsigned poolSize, + unsigned blockSize); +extern STATUS smFixBlkPartFree (SM_FIX_BLK_PART_ID gPartId, + char * pBlock); +extern STATUS smFixBlkPartShow (SM_FIX_BLK_PART_ID gPartId); +extern void * smFixBlkPartAlloc (SM_FIX_BLK_PART_ID gPartId); + +#else /* __STDC__ */ + +extern void smFixBlkPartInit (); +extern STATUS smFixBlkPartFree (); +extern STATUS smFixBlkPartShow (); +extern void * smFixBlkPartAlloc (); + +#endif /* __STDC__ */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsmFixBlkLibPh */ diff --git a/h/private/smMemLibP.h b/h/private/smMemLibP.h new file mode 100644 index 0000000..c4f6a3e --- /dev/null +++ b/h/private/smMemLibP.h @@ -0,0 +1,148 @@ +/* smMemLibP.h - private shared memory management library header file */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,05may02,mas added volatile pointers (SPR 68334) +01g,29jan93,pme added little endian support + changed SM_BLOCK_HDR structure to avoid bit field use. +01f,29sep92,pme added smMemPartShow prototype +01e,22sep92,rrr added support for c++ +01d,14sep92,smb removed the prototype for smMemPartShow() +01c,28jul92,pme added align pragma for I960. +01b,21jul92,pme removed MEM_ROUND_UP and MEM_IS_ROUND. +01a,19jul92,pme extracted from smMemLib v1b. +*/ + +#ifndef __INCsmMemLibPh +#define __INCsmMemLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "smMemLib.h" +#include "smDllLib.h" +#include "private/semSmLibP.h" + +/* defines */ + +#define MEM_PART_TYPE_SM_STD 20 /* standard shared memory partition */ + +#if (defined (CPU_FAMILY) && (CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* typedefs */ + +typedef struct sm_obj_partition + { + UINT32 verify; /* partition is initialized */ + UINT32 objType; /* partition type */ + + SM_DL_LIST freeList; /* list of free blocks */ + SM_SEMAPHORE sem; /* partition semaphore */ + unsigned totalWords; /* total number of words in pool */ + unsigned minBlockWords; /* min blk size in words includes hdr */ + unsigned options; /* options */ + + /* allocation statistics */ + + unsigned curBlocksAllocated; /* current # of blocks allocated */ + unsigned curWordsAllocated; /* current # of words allocated */ + unsigned cumBlocksAllocated; /* cumulative # of blocks allocated */ + unsigned cumWordsAllocated; /* cumulative # of words allocated */ + + } SM_PARTITION; + +typedef struct sm_block_hdr /* SM_BLOCK_HDR */ + { + struct sm_block_hdr * pPrevHdr; /* pointer to previous block hdr */ + unsigned nWords; /* size in words of this block */ + unsigned free; /* TRUE = this block is free */ + UINT32 pad; /* 4 byte pad for round up */ + } SM_BLOCK_HDR; + +/* SM_FREE_BLOCK is the structure for a free block. It includes the freelist + * node in addition to the usual header. */ + +typedef struct sm_free_block /* SM_FREE_BLOCK */ + { + SM_BLOCK_HDR hdr; /* normal block header */ + SM_DL_NODE node; /* freelist links */ + UINT32 pad; /* 4 byte pad for round up */ + } SM_FREE_BLOCK; + +/* defines */ + +/* macros for getting to next and previous blocks */ + +#define SM_NEXT_HDR(pHdr) \ + ((SM_BLOCK_HDR *) ((char *) (pHdr) + (2 * ntohl ((int) ((pHdr)->nWords))))) +#define SM_PREV_HDR(pHdr) \ + ((SM_BLOCK_HDR *) (GLOB_TO_LOC_ADRS (ntohl ((int) ((pHdr)->pPrevHdr))))) + + +/* macros for converting between the "block" that caller knows + * (actual available data area) and the block header in front of it */ + +#define SM_HDR_TO_BLOCK(pHdr) ((char *) ((int) pHdr + sizeof (SM_BLOCK_HDR))) +#define SM_BLOCK_TO_HDR(pBlock) ((SM_BLOCK_HDR *) ((int) pBlock - \ + sizeof(SM_BLOCK_HDR))) + + +/* macros for converting between the "node" that is strung on the freelist + * and the block header in front of it */ + +#define SM_HDR_TO_NODE(pHdr) (& ((SM_FREE_BLOCK *) pHdr)->node) +#define SM_NODE_TO_HDR(pNode) ((SM_BLOCK_HDR *) ((int) pNode - \ + OFFSET (SM_FREE_BLOCK, node))) + +#if defined(__STDC__) || defined(__cplusplus) + +extern void smMemPartLibInit (void); +extern void smMemPartInit (SM_PART_ID partId, char * pPool, + unsigned poolSize); +extern STATUS smMemPartAddToPool (SM_PART_ID partId, char * pPool, + unsigned poolSize); +extern STATUS smMemPartFree (SM_PART_ID partId, char * pBlock); +extern STATUS smMemPartOptionsSet (SM_PART_ID partId, unsigned options); +extern int smMemPartFindMax (SM_PART_ID partId); +extern void * smMemPartAlloc (SM_PART_ID partId, unsigned nBytes); +extern void * smMemPartRealloc (SM_PART_ID partId, char * pBlock, + unsigned nBytes); +extern STATUS smMemPartAccessGet (SM_PART_ID partId); +extern STATUS smMemPartAccessRelease (SM_PART_ID partId); +extern BOOL smMemPartBlockIsValid (SM_PART_ID volatile partId, + SM_BLOCK_HDR volatile * pHdr, + BOOL isFree); +extern STATUS smMemPartShow (SM_PART_ID gPartId, int type); + +#else /* __STDC__ */ + +extern void smMemPartLibInit (); +extern STATUS smMemPartAddToPool (); +extern STATUS smMemPartFree (); +extern STATUS smMemPartOptionsSet (); +extern int smMemPartFindMax (); +extern void * smMemPartAlloc (); +extern void * smMemPartRealloc (); +extern STATUS smMemPartAccessGet (); +extern STATUS smMemPartAccessRelease (); +extern BOOL smMemPartBlockIsValid (); +extern STATUS smMemPartShow (); + +#endif /* __STDC__ */ + +#if (defined (CPU_FAMILY) && (CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsmMemLibPh */ diff --git a/h/private/smNameLibP.h b/h/private/smNameLibP.h new file mode 100644 index 0000000..3d5ccf6 --- /dev/null +++ b/h/private/smNameLibP.h @@ -0,0 +1,88 @@ +/* smNameLibP.h - private shared name database library header file */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,05may02,mas added volatile pointers (SPR 68334) +01f,01aug94,dvs backed out pme's changes for reserved fields in main data structures. +01e,20mar94,pme added reserved fields in main data structures to allow + compatibility between future versions. +01d,29jan93,pme added little endian support +01c,29sep92,pme changed objId field to value in SM_OBJ_NAME + and SM_OBJ_NAME_INFO +01b,22sep92,rrr added support for c++ +01a,19jul92,pme extracted from smNameLib v1c. +*/ + +#ifndef __INCsmNameLibPh +#define __INCsmNameLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "smNameLib.h" +#include "smDllLib.h" +#include "private/semSmLibP.h" + +#if (defined (CPU_FAMILY) && (CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* typedefs */ + +typedef struct sm_obj_name_db /* database header */ + { + UINT32 initDone; /* TRUE if name database is initialized */ + SM_DL_LIST nameList; /* list of entered name */ + SM_SEMAPHORE sem; /* shared binary semaphore for access */ + UINT32 maxName; /* maximum number of name in database */ + UINT32 curNumName; /* current number of name in database */ + } SM_OBJ_NAME_DB; + + +typedef struct sm_obj_name /* name database element */ + { + SM_DL_NODE node; /* node for name list */ + void * value; /* associated value */ + UINT32 type; /* associated type */ + char name [MAX_NAME_LENGTH + 1]; /* associated name string */ + } SM_OBJ_NAME; + +typedef struct sm_obj_name_info /* database element info */ + { + void * value; /* element value */ + UINT32 type; /* associated type */ + char name [MAX_NAME_LENGTH + 1]; /* associated name string */ + } SM_OBJ_NAME_INFO; + +#if (defined (CPU_FAMILY) && (CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* globals */ + +extern SM_OBJ_NAME_DB volatile * pSmNameDb; /* ptr to name database header */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void smNameLibInit (void); +extern STATUS smNameInit (int maxNames); + +#else /* __STDC__ */ + +extern void smNameLibInit (); +extern STATUS smNameInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsmNameLibPh */ diff --git a/h/private/smObjLibP.h b/h/private/smObjLibP.h new file mode 100644 index 0000000..fad0993 --- /dev/null +++ b/h/private/smObjLibP.h @@ -0,0 +1,89 @@ +/* smObjLibP.h - private shared memory objects library header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,01aug94,dvs backed out pme's changes for reserved fields in main data structures. +01f,20mar94,pme added reserved fields in main data structures to allow + compatibility between future versions. +01e,29jan93,pme added little endian support +01d,22sep92,rrr added support for c++ +01c,23aug92,jcf fixed struct reference. +01b,30jul92,pme added smObjTaskDeleteFailRtn declaration. +01a,19jul92,pme extracted from smObjLib v1d. +*/ + +#ifndef __INCsmObjLibPh +#define __INCsmObjLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "smObjLib.h" +#include "smDllLib.h" +#include "smLib.h" +#include "private/smNameLibP.h" +#include "private/smFixBlkLibP.h" +#include "private/smMemLibP.h" +#include "private/semSmLibP.h" + +#if (defined (CPU_FAMILY) && (CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* typedefs */ + +typedef struct sm_obj_tcb /* SM_OBJ_TCB - shared memory object tcb */ + { + SM_DL_NODE qNode; /* 0x00: multiway q node for pend q */ + struct windTcb * localTcb; /* 0x10: address of local TCB */ + UINT32 ownerCpu; /* 0x14: cpu number on which task runs */ + UINT32 action; /* 0x18: action when put on CPU event queue */ + UINT32 removedByGive;/* TRUE: if removed from pend Q by give */ + } SM_OBJ_TCB; + +#if (defined (CPU_FAMILY) && (CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* globals */ + +extern SM_FIX_BLK_PART_ID smTcbPartId; /* shared TCB partition */ + +extern FUNCPTR smObjTcbFreeRtn; /* shared TCB free routine */ +extern FUNCPTR smObjTcbFreeFailRtn; /* shared TCB free fail routine */ +extern FUNCPTR smObjTaskDeleteFailRtn; /* taskDelete fail routine */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS smObjTcbInit (); +extern STATUS smObjTcbFree (SM_OBJ_TCB * pSmObjTcb); +extern void smObjTimeoutLogMsg (char * routineName, char * lockLocalAdrs); +extern void smObjTcbFreeLogMsg (); +extern STATUS smObjEventSend (SM_DL_LIST * pEventList, UINT32 destCpu); +extern void smObjEventProcess (SM_DL_LIST * pEventList); +extern void smObjObjShow (int smObjId, int level); + +#else /* __STDC__ */ + +extern STATUS smObjTcbInit (); +extern STATUS smObjTcbFree (); +extern void smObjTimeoutLogMsg (); +extern void smObjTcbFreeLogMsg (); +extern STATUS smObjEventSend (); +extern void smObjEventProcess (); +extern void smObjObjShow (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsmObjLibPh */ diff --git a/h/private/stdioP.h b/h/private/stdioP.h new file mode 100644 index 0000000..dc7e674 --- /dev/null +++ b/h/private/stdioP.h @@ -0,0 +1,164 @@ +/* stdioP.h - header file for ANSI stdio library */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,14nov92,jcf removed redundant prototypes. +01c,22sep92,rrr added support for c++ +01b,02aug92,jcf moved srget/swbuf prototypes to stdio.h. +01a,29jul92,jcf added stdio internal routines to manage memory. + smb taken from UCB stdio library. +*/ + +#ifndef __INCstdioPh +#define __INCstdioPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)local.h 5.2 (Berkeley) 2/5/91 + * + * Information local to this implementation of stdio, + * in particular, macros and private variables. + * +SEE ALSO: American National Standard X3.159-1989 +*/ + +#include "stdio.h" + + +/* + * This is a #define because the function is used internally and + * (unlike vfscanf) the name __svfscanf is guaranteed not to collide + * with a user function when _ANSI_SOURCE or _POSIX_SOURCE is defined. + */ + +#define vfscanf __svfscanf + +/* Routines that are purely local to the implementation */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS stdioFpDestroy (FILE *fp); +extern FILE * stdioFpCreate (void); +extern char * fgetline (FILE *, size_t *); +extern int fpurge (FILE *); +extern int pclose (FILE *); +extern FILE * popen (const char *, const char *); +extern char * tempnam (const char *, const char *); +extern int snprintf (char *, size_t, const char *, ...); +extern int vsnprintf (char *, size_t, const char *, va_list); +extern int vscanf (const char *, va_list); +extern int vsscanf (const char *, const char *, va_list); +extern int __svfscanf (FILE *, const char *, va_list); +extern int __sflush (FILE *); +extern FILE * __sfp (void); +extern int __srefill (FILE *); +extern int __sread (FILE *, char *, int); +extern int __swrite (FILE *, char const *, int); +extern fpos_t __sseek (FILE *, fpos_t, int); +extern int __sclose (FILE *); +extern void __sinit (void); +extern void __smakebuf (FILE *); +extern int __swsetup (FILE *); +extern int __sflags (const char *, int *); + +#else /* __STDC__ */ + +extern STATUS stdioFpDestroy (); +extern FILE * stdioFpCreate (); +extern char * fgetline (); +extern int fpurge (); +extern int pclose (); +extern FILE * popen (); +extern char * tempnam (); +extern int snprintf (); +extern int vsnprintf (); +extern int vscanf (); +extern int vsscanf (); +extern int __svfscanf (); +extern int __sflush (); +extern FILE * __sfp (); +extern int __srefill (); +extern int __sread (); +extern int __swrite (); +extern fpos_t __sseek (); +extern int __sclose (); +extern void __sinit (); +extern void __smakebuf (); +extern int __swsetup (); +extern int __sflags (); + +#endif /* __STDC__ */ + +/* Return true iff the given FILE cannot be written now. */ + +#define cantwrite(fp) \ + ((((fp)->_flags & __SWR) == 0 || (fp)->_bf._base == NULL) && \ + __swsetup(fp)) + +/* Test whether the given stdio file has an active ungetc buffer; + * release such a buffer, without restoring ordinary unread data. + */ + +#define HASUB(fp) ((fp)->_ub._base != NULL) +#define FREEUB(fp) \ + { \ + if ((fp)->_ub._base != (fp)->_ubuf) \ + free ((char *)(fp)->_ub._base); \ + (fp)->_ub._base = NULL; \ + } + +/* test for an fgetline() buffer. */ + +#define HASLB(fp) ((fp)->_lb._base != NULL) +#define FREELB(fp) \ + { \ + free ((char *)(fp)->_lb._base); \ + (fp)->_lb._base = NULL; \ + } + +#ifdef __cplusplus +} +#endif + +#endif /* __INCstdioPh */ diff --git a/h/private/strStateP.h b/h/private/strStateP.h new file mode 100644 index 0000000..532cd76 --- /dev/null +++ b/h/private/strStateP.h @@ -0,0 +1,50 @@ +/* stateP.h - header file for string */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,22sep92,rrr added support for c++ +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +SEE ALSO: American National Standard X3.159-1989 +*/ + +#ifndef __INCstrStatePh +#define __INCstrStatePh + +#ifdef __cplusplus +extern "C" { +#endif + +#define ST_CH 0x00ff +#define ST_STATE 0x0f00 +#define ST_STOFF 8 +#define ST_FOLD 0x8000 +#define ST_INPUT 0x4000 +#define ST_OUTPUT 0x2000 +#define ST_ROTATE 0x1000 +#define _NSTATE 16 + +typedef struct + { + const unsigned short *__table[_NSTATE]; + } __statetable; + +extern __statetable __costate; /* string collate character table */ + +#if FALSE /* NOT IMPLEMENTED */ +extern __statetable __mbstate; /* multibyte character table */ +extern __statetable __wcstate; /* wide character table */ +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCstrStatePh */ diff --git a/h/private/strxfrmP.h b/h/private/strxfrmP.h new file mode 100644 index 0000000..b36dfd9 --- /dev/null +++ b/h/private/strxfrmP.h @@ -0,0 +1,56 @@ +/* strxfrmP.h - header file for string */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,22sep92,rrr added support for c++ +01b,11jul92,smb fixed __STDC__ ifdef. +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +SEE ALSO: American National Standard X3.159-1989 +*/ + +#include "string.h" +#include "private/strStateP.h" + + +#ifndef __INCstrxfrmPh +#define __INCstrxfrmPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* A data object of type __cosave saves the state information between + * calls to __strxfrm. + */ +typedef struct + { + uchar_t __state; + ushort_t __wchar; + } __cosave; + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern size_t __strxfrm (char *sout, const uchar_t **ppsin, size_t size, + __cosave *ps); +#else /* __STDC__ */ + +extern size_t __strxfrm (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCstrxfrmPh */ diff --git a/h/private/symLibP.h b/h/private/symLibP.h new file mode 100644 index 0000000..ec31f2a --- /dev/null +++ b/h/private/symLibP.h @@ -0,0 +1,93 @@ +/* symLibP.h - private symbol library header file */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01f,07mar05,v_r Fixed SPR #98274 (loader backward compatibility errno review). + Cleanups + code conventions compliancy work. +01e,24jan05,aeg added symTblSymSetRemove prototype (SPR #106381). +01d,06oct04,jn Clean up comments +01c,05apr04,jn Clean up - remove unused declarations and development-related + comments +01b,03apr03,to replaced OBJ_CORE with HANDLE in SYMTAB (de-classify). +01a,15oct01,jn created. +*/ + +#ifndef __INCsymLibPh +#define __INCsymLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "hashLib.h" +#include "symLib.h" + +#ifdef HOST +#include "vmutex.h" +#else +#include "private/semLibP.h" +#include "private/handleLibP.h" +#endif + +/* defines */ + +#ifdef HOST +/* size of hash table given number of elements in hash table log 2 */ +#ifndef HASH_TBL_SIZE +#define HASH_TBL_SIZE(sizeLog2) \ + (((1 << sizeLog2) * sizeof (SL_LIST)) + sizeof (HASH_TBL)) +#endif /* ndef HASH_TBL_SIZE */ +#endif /* HOST */ + + +/* structure definitions */ + +typedef struct symtab /* SYMTAB - symbol table */ + { +#ifdef HOST + OBJ_CORE handle; /* handle management */ +#else + HANDLE handle; /* object maintanance */ +#endif /* HOST */ + HASH_ID nameHashId; /* hash table for names */ + SEMAPHORE symMutex; /* symbol table mutual exclusion sem */ + PART_ID symPartId; /* memory partition id for symbols */ + BOOL sameNameOk; /* symbol table name clash policy */ + int nsymbols; /* current number of symbols in table */ + } SYMTAB; + +/* function declarations */ + +extern STATUS symByCNameFind(SYMTAB_ID symTblId, char * name, char ** pValue, + SYM_TYPE *pType ); +#ifdef HOST +extern SYMBOL * symEachSym (SYMTAB_ID symTblId, FUNCPTR routine, int routineArg); +#endif +extern STATUS symFindSymbol(SYMTAB_ID symTblId, char * name, void * value, + SYM_TYPE type, SYM_TYPE mask, + SYMBOL_ID * pSymbolId ); +extern STATUS symNameGet(SYMBOL_ID symbolId, char ** pName); +extern SYMBOL_ID symRegister(SYMTAB_ID symTblId, char * name, void * value, + SYM_TYPE type, UINT16 group, UINT32 symRef, + BOOL callSyncRtn); +extern STATUS symTblShutdown(SYMTAB_ID symTblId ); +extern STATUS symTblSymSetRemove(SYMTAB_ID symTblId, UINT32 reference, + SYM_TYPE type, SYM_TYPE typeMask); +extern STATUS symTypeGet(SYMBOL_ID symbolId, SYM_TYPE * pType); +extern STATUS symValueGet(SYMBOL_ID symbolId, void ** pValue); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsymLibPh */ + diff --git a/h/private/symbolP.h b/h/private/symbolP.h new file mode 100644 index 0000000..1153b5c --- /dev/null +++ b/h/private/symbolP.h @@ -0,0 +1,77 @@ +/* symbolP.h - private symbol structure header */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01d,07mar05,v_r Cleanups + code conventions compliancy work. + Moved SYMBOL structure back into public header as needed by + published APIs. +01c,18sep04,jn Move toward shared code on host and target +01b,01apr04,jn Fix display of symbol types +01b,17feb04,pad Extended symbol's group field from 16 bits to 32 bits (to + support shared libraries). +01a,29oct01,jn created from HIDDEN part of symbol.h +*/ + +#ifndef __INCsymbolPh +#define __INCsymbolPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "symbol.h" + +#ifdef HOST +#include "dllLib.h" +#endif /* HOST */ + +typedef UINT32 SYM_EXT_TYPE; /* internal symbol type (SYM_TYPE is still + * an unsigned char) */ + +#define SYM_EXT_NO_TYPE 0x0 /* no internal type information */ +#define SYM_EXT_WEAK 0x10000 /* weak symbol */ +#define SYM_EXT_SEC 0x20000 /* section descriptor */ +#define SYM_EXT_UPDATE 0x100000 /* symbol to update (symtbl sync.) */ + +/* + * pre-defined symbol references: + * The symRef field will usually hold a MODULE_ID, to identify the module that + * the symbol belongs to. Therefore we can use any addresses between (sizeof + * (MODULE) - 1) and zero to indicate the source of symbols that are not + * associated with any module. + */ + +#define SYMREF_NONE NULL /* no reference */ +#define SYMREF_SHELL (void *) 0xffffffff /* symbols created by the shell */ +#define SYMREF_KERNEL (void *) 0xfffffffe /* kernel symbols */ +#define SYMREF_WTX (void *) 0xfffffffd /* symbols created by WTX symAdd */ + +#ifdef HOST + +/* Undefined symbols structure */ + +typedef struct + { + DL_NODE undefSymNode; /* double-linked list node information */ + char * name; /* name of the undefined symbol */ + } UNDEF_SYM; + +typedef UNDEF_SYM * UNDEF_SYM_ID; + +#endif /* HOST */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsymbolPh */ + diff --git a/h/private/syscallLibP.h b/h/private/syscallLibP.h new file mode 100644 index 0000000..154b206 --- /dev/null +++ b/h/private/syscallLibP.h @@ -0,0 +1,179 @@ +/* syscallLibP.h - System Call Infrastructure library private header */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01n,07apr05,scm correct syscall macros for ARM/XScale... +01m,11jun04,dcc modified SYSCALL_USER_* macros to use + sizeof(SYSCALL_ENTRY_STATE). +01l,15apr04,yvp Added SYSCALL_USER_XXX_GET macros. +01k,29dec03,jeg added simsolaris support +01j,03dec03,jb Adding syscall and RTP support for i86 +01i,18nov03,yvp Added typedefs for syscall hook functions. +01h,05nov03,jmp Added include for SIMNT & SIMLINUX. +01g,15oct03,scm add ARM link... +01f,26sep03,h_k Added include for SH specific header. +01e,24sep03,pes Correct conditional test for MIPS +01d,22sep03,yvp Uncommented #include for syscall.h. +01d,19sep03,pes Add #include for syscallMips.h +01c,15sep03,yvp Added includes for arch-specific headers. + Added prototype for syscallDispatch(). +01b,03sep03,yvp Added extern for syscallGroupTbl. +01a,26aug03,yvp written. +*/ + +#ifndef __INCsyscallLibPh +#define __INCsyscallLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" +#include "syscallLib.h" +#include "syscall.h" + +/* defines */ + +#define MAX_VALUE(N) (1 << (N)) /* Highest number represented by a + bit-field N bits wide */ + +#define RA_MASK(N) (MAX_VALUE(N)-1) /* Mask for a right-aligned + bit-field N bits wide */ + +#define SYSCALL_GROUPS_MAX MAX_VALUE(SYSCALL_GROUP_NUM_BITS) +#define SYSCALL_ROUTINES_MAX MAX_VALUE(SYSCALL_ROUTINE_NUM_BITS) + + /* derived bit-field constants and shift counts */ + +#define SYSCALL_ROUTINE_NO_BIT_END (SYSCALL_ROUTINE_NUM_BITS - 1) + +#define SYSCALL_GROUP_NO_BIT_END (SYSCALL_GROUP_NO_BIT_START + \ + SYSCALL_GROUP_NUM_BITS - 1) + +#define SYSCALL_ROUTINE_FIELD_MASK RA_MASK(SYSCALL_ROUTINE_NUM_BITS) + +#define SYSCALL_GROUP_FIELD_MASK (RA_MASK(SYSCALL_GROUP_NUM_BITS) << \ + SYSCALL_GROUP_NO_BIT_START) + +#ifndef _ASMLANGUAGE + +/* typedefs */ + +/* a group table entry */ + +typedef struct syscall_group_entry + { + SYSCALL_RTN_TBL_ENTRY * pRoutineTbl; + int numRoutines; + } SYSCALL_GROUP_ENTRY; + +/* externals */ + +extern SYSCALL_GROUP_ENTRY syscallGroupTbl []; + +#endif /* _ASMLANGUAGE */ + +/* Include the architecture-specific definition for SYSCALL_ENTRY_STATE */ + +#if (CPU_FAMILY==PPC) +#include "arch/ppc/syscallPpc.h" +#elif (CPU_FAMILY==ARM) +#include "arch/arm/syscallArm.h" +#elif (CPU_FAMILY==MIPS) +#include "arch/mips/syscallMips.h" +#elif (CPU_FAMILY==SH) +#include "arch/sh/syscallSh.h" +#elif (CPU_FAMILY==SIMNT) +#include "arch/simnt/syscallSimnt.h" +#elif (CPU_FAMILY==SIMLINUX) +#include "arch/simlinux/syscallSimlinux.h" +#elif (CPU_FAMILY==SIMSPARCSOLARIS) +#include "arch/simsolaris/syscallSimsolaris.h" +#elif (CPU_FAMILY==I80X86) +#include "arch/i86/syscallI86.h" +#else + /* + * - TEMPORARY - + * A temporary definition for the SYSCALL_ENTRY_STATE structure is + * provided here purely as a means of avoiding compiler errors for + * other architectures. Whenever other architectures are implemented + * they must define a SYSCALL_ENTRY_STATE structure for themselves + * similar to the PPC version above. + */ + +typedef struct syscall_entry_state + { + int args[8]; /* argument list */ + int scn; /* System Call Number (SCN) */ + int * pUStack; /* user-mode stack pointer */ + void * pc; /* Trap return address */ + } SYSCALL_ENTRY_STATE; +#endif /* PPC */ + +#ifndef _ASMLANGUAGE + +#if (CPU_FAMILY==ARM) +#define ARM_RTP_STACK_OFFSET 12 /* ARM pushes r2, SCn, and lr onto */ + /* stack prior to signal handling */ +#define SYSCALL_USER_SP_GET(tid) (char *) \ + (((SYSCALL_ENTRY_STATE *) ((((WIND_TCB *)(tid))->pExcStackBase) - \ + (sizeof(SYSCALL_ENTRY_STATE)+ARM_RTP_STACK_OFFSET)))->pUStack) + +#define SYSCALL_USER_PC_GET(tid) (void *) \ + (((SYSCALL_ENTRY_STATE *) ((((WIND_TCB *)(tid))->pExcStackBase) - \ + (sizeof(SYSCALL_ENTRY_STATE)+ARM_RTP_STACK_OFFSET)))->pc) + +#define SYSCALL_USER_SCN_GET(tid) (int) \ + (((SYSCALL_ENTRY_STATE *) ((((WIND_TCB *)(tid))->pExcStackBase) - \ + (sizeof(SYSCALL_ENTRY_STATE)+ARM_RTP_STACK_OFFSET)))->scn) +#else +#define SYSCALL_USER_SP_GET(tid) (char *) \ + (((SYSCALL_ENTRY_STATE *) ((((WIND_TCB *)(tid))->pExcStackBase) - \ + sizeof(SYSCALL_ENTRY_STATE)))->pUStack) + +#define SYSCALL_USER_PC_GET(tid) (void *) \ + (((SYSCALL_ENTRY_STATE *) ((((WIND_TCB *)(tid))->pExcStackBase) - \ + sizeof(SYSCALL_ENTRY_STATE)))->pc) + +#define SYSCALL_USER_SCN_GET(tid) (int) \ + (((SYSCALL_ENTRY_STATE *) ((((WIND_TCB *)(tid))->pExcStackBase) - \ + sizeof(SYSCALL_ENTRY_STATE)))->scn) +#endif + +/* typedefs */ + +typedef STATUS (* SYSCALL_ENTRY_HOOK) (const SYSCALL_ENTRY_STATE *); + +typedef void (* SYSCALL_EXIT_HOOK) (int); + +typedef STATUS (* SYSCALL_REGISTER_HOOK) (int, char *, int, + SYSCALL_RTN_TBL_ENTRY **); + +extern int syscallHookTblSize; +extern SYSCALL_ENTRY_HOOK * pSyscallEntryHookTbl; +extern SYSCALL_EXIT_HOOK * pSyscallExitHookTbl; +extern SYSCALL_REGISTER_HOOK * pSyscallRegisterHookTbl; + +/* function declarations */ + +STATUS syscallDispatch (SYSCALL_ENTRY_STATE *); +void syscallHookLibInit (void); +STATUS syscallRegisterHookAdd (SYSCALL_REGISTER_HOOK, BOOL); +STATUS syscallRegisterHookDelete (SYSCALL_REGISTER_HOOK); +STATUS syscallEntryHookAdd (SYSCALL_ENTRY_HOOK, BOOL); +STATUS syscallEntryHookDelete (SYSCALL_ENTRY_HOOK); +STATUS syscallExitHookAdd (SYSCALL_EXIT_HOOK, BOOL); +STATUS syscallExitHookDelete (SYSCALL_EXIT_HOOK); +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsyscallLibPh */ diff --git a/h/private/taskLibP.h b/h/private/taskLibP.h new file mode 100644 index 0000000..60e5361 --- /dev/null +++ b/h/private/taskLibP.h @@ -0,0 +1,300 @@ +/* taskLibP.h - private task library interface header */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +03g,30jul05,pad Removed _exit() prototype (SPR 110038). +03g,15aug05,yvp Moved KERNEL_TASK_EXC_STACK_SIZE to sys/taskdefs.h +03f,09aug05,mmi Update WIND_TCB_REGS offset +03e,15jul05,yvp Added KERNEL_TASK_EXC_STACK_SIZE. +03d,07jun05,yvp Updated copyright. #include now with angle-brackets. +03c,23mar05,yvp Added extern declarations for task(Ker/Usr)ExcStackSize. +03b,18mar05,yvp Added prototype for taskPriInheritDataInit. +03a,14mar05,yvp Added task(Under/Over)flowSize +02z,09mar05,kk updated the offsets due to addition in WIND_TCB +02y,25sep04,dcc updated TCB offsets. +02x,28sep04,fr removed vTaskOpen prototype (SPR 101349) +02w,13sep04,md added taskStopForce() +02v,16sep04,dbt Added taskDbgUnlock() prototype (SPR #101075). +02u,30apr04,dcc added WIND_TCB_UTCB offset. +02t,30apr04,yvp Added WIND_TCB_P_K_STK_END. +02s,20apr04,hya added taskReset prototype. +02r,22mar04,dcc added vTaskOpen() prototype. +02q,23feb04,dcc adjusted WIND_TCB offsets. +02p,18feb04,aeg deprecated taskCreat(). +02o,27nov03,aeg added vTaskOpen() function prototype. +02n,19nov03,kk added taskInitialize +02m,31oct03,dcc adjusted WIND_TCB offsets as a result of OBJ_CORE expansion. +02l,30pcm03,pcm implemented changes from code review +02k,20oct03,pcm cleaned up WIND_TCB_xxx macros +02j,17sep03,kk renamed WIND_TCB_P_K_STK_PTR to WIND_TCB_P_EXC_STK_BASE +02i,10sep03,dcc moved taskCreate() prototype to taskLibCommon.h +02h,04aug03,elg Add support for new task status: define WIND_STOP. +02g,24jul03,kam updated WIND_TCB_REGS for SIMLINUX and SIMNT +02f,23jul03,kam updated WIND_TCB_REGS for SIMSPARCSOLARIS +02e,07may03,pes PAL conditional compilation cleanup, phase 2. Moved + ARM-specific #defines to arch/arm/regsArm.h. +02d,22jul03,pad Moved _exit declaration here to solve coupling issues. +02c,18jul03,kk change WIND_TCB_P_K_STK_PTR macro to point pKStackBase & + pKStackPtr +02b,10jul03,kk added WIND_TCB_P_K_STK_PTR & WIND_TCB_RTP_ID macro +02a,17apr03,dbt Added WIND_TCB_REGS definition for Linux & Windows VxSim. +01z,25mar03,dbt Added WIND_TCB_REGS definition for Solaris VxSim. +01y,10jul03,ymz fixed WIND_TCB_ERRNO comment. +01x,01jul03,ymz updated MIPS register offset for 8-byte alignement. +01w,01jul03,rec code review comments. +01v,02jun03,rec Power Management - added ARM WIND_TCB_R5 WIND_TCB_SP. +01u,28mar03,ymz does not assume qNode is the first element in WIND_TCB, + added WIND_TCB_QNODE. +01t,16jan02,to added WIND_TCB_FPSTATUS for ARM. +01s,09nov01,dee added coldfire portions from T2.1.0 +01r,04oct01,yvp fixed SPR69306: changed WIND_TCB_REGS to 0x130 for PPC. +01q,19sep01,aeg updated WIND_TCB* macros to match taskLib.h v04j changes; + deleted Am29K family support. +01p,04sep01,hdn moved I80X86 macros to regsI86.h. +01o,28feb00,frf added SH support for T2. +01n,23jul98,mem added pTaskLastDspTcb. +01m,23apr97,hk added SH support. +01l,28nov96,cdp added ARM support. + added WIND_TCB_PSTACKBASE. +01k,19mar95,dvs removed tron references. +01j,26may94,yao added PPC support. +01i,28jul94,dvs added extern of pTaskLastFpTcb. (SPR #3033). +01h,12nov93,hdn added support for I80X86. +01g,02dec93,pme added Am29K family support. +01f,03aug93,jwt abstracted common WIND_TCB_XXX definitions; copyright. +01e,22sep92,rrr added support for c++. +01d,23aug92,jcf added extern of taskBpHook. +01c,28jul92,jcf changed offsets to match WIND_TCB. +01b,07jul92,ajm removed external defines of taskSwapMaskClear/taskSwapMaskSet +01a,04jul92,jcf written by extracting from taskLib.h v02x. +*/ + +#ifndef __INCtaskLibPh +#define __INCtaskLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* task status values */ + +#define WIND_READY 0x00 /* ready to run */ +#define WIND_SUSPEND 0x01 /* explicitly suspended */ +#define WIND_PEND 0x02 /* pending on semaphore */ +#define WIND_DELAY 0x04 /* task delay (or timeout) */ +#define WIND_DEAD 0x08 /* dead task */ +#define WIND_STOP 0x10 /* stopped by the debugger */ + +#ifndef _ASMLANGUAGE +#include +#include +#include +#include +#include + +/* variable declarations */ + +extern REG_INDEX taskRegName []; +extern FUNCPTR taskBpHook; +extern FUNCPTR taskCreateTable []; +extern FUNCPTR taskSwitchTable []; +extern FUNCPTR taskDeleteTable []; +extern FUNCPTR taskSwapTable []; +extern int taskSwapReference []; +extern WIND_TCB * pTaskLastFpTcb; +extern WIND_TCB * pTaskLastDspTcb; +extern int taskOverflowSize; /* overflow protection size */ +extern int taskUnderflowSize; /* underflow protection size */ +extern int taskUsrExcStackSize; /* default exception stack size */ +extern int taskKerExcStackSize; /* kernel task exc stack size */ + +/* function declarations */ + +extern STATUS taskInitialize (WIND_TCB * pTcb, char * name, int priority, + int options, char * pStackBase, int stackSize, + char * pExcStackBase, int excStackSize, + FUNCPTR entry, int arg1, int arg2, int arg3, + int arg4, int arg5, int arg6, int arg7, + int arg8, int arg9, int arg10); + +extern int taskCreat (char *name, int priority, int options, int stackSize, + FUNCPTR entryPt, int arg1, int arg2, int arg3, + int arg4, int arg5, int arg6, int arg7, + int arg8, int arg9, int arg10) +_WRS_DEPRECATED ("please use taskCreate instead"); + +extern STATUS taskTerminate (int tid); +extern STATUS taskDestroy (int tid, BOOL dealloc, int timeout, + BOOL forceDestroy); +extern STATUS taskUndelay (int tid); +extern void taskBpHookSet (FUNCPTR bpHook); +extern void taskIdListSort (int idList[], int nTasks); +extern STATUS taskStop (int tid); +extern STATUS taskStopForce (int tid); +extern STATUS taskCont (int tid); +extern BOOL taskIsStopped (int tid); +/*extern STATUS _exit (int status);*/ +extern STATUS taskReset (int tid); +extern STATUS taskDbgUnlock (void); +extern STATUS taskPriInheritDataInit (int tid); + +#else /* _ASMLANGUAGE */ + +/* PRI_INHERIT_DATA offsets */ + +#define PRI_INHERIT_PRI_MUTEX_CNT (0x00) +#define PRI_INHERIT_PRI_INHERIT_CNT (0x04) +#define PRI_INHERIT_PRI_NORMAL (0x08) +#define PRI_INHERIT_PRI_DROP (0x0c) + +/* architecture-independent WIND_TCB defines */ + +#include "objLibP.h" + +#define WIND_TCB_QNODE (WIND_OBJ_CORE_SIZE) /* 0x40 */ +#define WIND_TCB_P_K_STK_BASE (0x20+WIND_OBJ_CORE_SIZE) /* 0x60 */ +#define WIND_TCB_P_K_STK_END (0x24+WIND_OBJ_CORE_SIZE) /* 0x64 */ +#define WIND_TCB_PEXC_STK_START (0x28+WIND_OBJ_CORE_SIZE) /* 0x68 */ +#define WIND_TCB_EXC_CNT (0x2c+WIND_OBJ_CORE_SIZE) /* 0x6c */ +#define WIND_TCB_STATUS (0x30+WIND_OBJ_CORE_SIZE) /* 0x70 */ +#define WIND_TCB_PRIORITY (0x34+WIND_OBJ_CORE_SIZE) /* 0x74 */ +#define WIND_TCB_PRI_INHERIT (0x38+WIND_OBJ_CORE_SIZE) /* 0x78 */ +#define WIND_TCB_LOCK_CNT (0x3c+WIND_OBJ_CORE_SIZE) /* 0x7c */ +#define WIND_TCB_RTP_ID (0x44+WIND_OBJ_CORE_SIZE) /* 0x84 */ +#define WIND_TCB_OPTIONS (0x48+WIND_OBJ_CORE_SIZE) /* 0x88 */ +#define WIND_TCB_UTCB (0x4c+WIND_OBJ_CORE_SIZE) /* 0x8c */ +#define WIND_TCB_SWAP_IN (0x54+WIND_OBJ_CORE_SIZE) /* 0x94 */ +#define WIND_TCB_SWAP_OUT (0x56+WIND_OBJ_CORE_SIZE) /* 0x96 */ +#define WIND_TCB_SAFE_CNT (0x5c+WIND_OBJ_CORE_SIZE) /* 0x9c */ +#define WIND_TCB_SAFETY_Q_HEAD (0x60+WIND_OBJ_CORE_SIZE) /* 0xa0 */ +#define WIND_TCB_ENTRY (0x70+WIND_OBJ_CORE_SIZE) /* 0xb0 */ +#define WIND_TCB_PSTACKBASE (0x74+WIND_OBJ_CORE_SIZE) /* 0xb4 */ +#define WIND_TCB_PSTACKEND (0x78+WIND_OBJ_CORE_SIZE) /* 0xb8 */ +#define WIND_TCB_ERRNO (0x80+WIND_OBJ_CORE_SIZE) /* 0xc0 */ +#define WIND_TCB_PFPCONTEXT (0xa0+WIND_OBJ_CORE_SIZE) /* 0xe0 */ + + +/* architecture-dependent WIND_TCB defines */ + +#if CPU_FAMILY==MC680X0 +#define WIND_TCB_REGS 0x188 +#define WIND_TCB_DREGS WIND_TCB_REGS 0x188 +#define WIND_TCB_DREGS4 WIND_TCB_REGS + 0x00 +#define WIND_TCB_DREGS8 WIND_TCB_REGS + 0x04 +#define WIND_TCB_AREGS WIND_TCB_REGS + 0x08 +#define WIND_TCB_AREGS4 WIND_TCB_REGS + 0x20 +#define WIND_TCB_AREGS8 WIND_TCB_REGS + 0x24 +#define WIND_TCB_SSP WIND_TCB_REGS + 0x28 +#define WIND_TCB_FRAME1 WIND_TCB_REGS + 0x42 +#define WIND_TCB_SR WIND_TCB_REGS + 0x42 +#define WIND_TCB_PC WIND_TCB_REGS + 0x44 +#define WIND_TCB_FRAME2 WIND_TCB_REGS + 0x46 +#define WIND_TCB_FOROFF WIND_TCB_REGS + 0x48 +#endif /* CPU_FAMILY==MC680X0 */ + +#if CPU_FAMILY==I960 +#define WIND_TCB_REGS 0x1a0 + +#define TCB_REG_SET_BASE 0x1a0 +#define TCB_REG_SET_SIZE 0x8c +#define WIND_TCB_R0 TCB_REG_SET_BASE + 0x00 +#define WIND_TCB_PFP TCB_REG_SET_BASE + 0x00 +#define WIND_TCB_SP TCB_REG_SET_BASE + 0x04 +#define WIND_TCB_RIP TCB_REG_SET_BASE + 0x08 +#define WIND_TCB_R3 TCB_REG_SET_BASE + 0x0c +#define WIND_TCB_R4 TCB_REG_SET_BASE + 0x10 +#define WIND_TCB_R8 TCB_REG_SET_BASE + 0x20 +#define WIND_TCB_R12 TCB_REG_SET_BASE + 0x30 +#define WIND_TCB_G0 TCB_REG_SET_BASE + 0x40 +#define WIND_TCB_G4 TCB_REG_SET_BASE + 0x50 +#define WIND_TCB_G8 TCB_REG_SET_BASE + 0x60 +#define WIND_TCB_G12 TCB_REG_SET_BASE + 0x70 +#define WIND_TCB_FP TCB_REG_SET_BASE + 0x7c +#define WIND_TCB_PCW TCB_REG_SET_BASE + 0x80 +#define WIND_TCB_ACW TCB_REG_SET_BASE + 0x84 +#define WIND_TCB_TCW TCB_REG_SET_BASE + 0x88 + +#define WIND_TCB_DBG_STATE_PTR TCB_REG_SET_BASE + 0x8c +#define WIND_TCB_RESUMPTION_RECORD TCB_REG_SET_BASE + 0x90 +#endif /* CPU_FAMILY==I960 */ + +#if CPU_FAMILY==MIPS +#define WIND_TCB_REGS 0x198 +#include "arch/mips/taskMipsLib.h" +#endif /* MIPS */ + +#if (CPU_FAMILY == PPC) +#define WIND_TCB_REGS 0x1a0 +#include "arch/ppc/regsPpc.h" +#endif /* (CPU_FAMILY == PPC) */ + +#if (CPU_FAMILY == SPARC) +#define WIND_TCB_REGS 0x188 +#include "arch/sparc/regsSparc.h" +#endif /* (CPU_FAMILY == SPARC) */ + +#if CPU_FAMILY==I80X86 +#define WIND_TCB_REGS 0x1d0 +#include "arch/i86/regsI86.h" +#endif /* CPU_FAMILY==I80X86 */ + +#if (CPU_FAMILY == SH) +#define WIND_TCB_REGS 0x188 +#include "arch/sh/regsSh.h" +#endif /* (CPU_FAMILY == SH) */ + +#if CPU_FAMILY==ARM +#define WIND_TCB_FPSTATUS 0x184 +#define WIND_TCB_REGS 0x190 +#include "arch/arm/regsArm.h" +#endif /* CPU_FAMILY==ARM */ + +#if CPU_FAMILY==COLDFIRE +#include "regs.h" +#define WIND_TCB_REGS 0x188 +#define WIND_TCB_DREGS (WIND_TCB_REGS+OFF_REG_D0) +#define WIND_TCB_DREGS4 (WIND_TCB_REGS+OFF_REG_D1) +#define WIND_TCB_DREGS8 (WIND_TCB_REGS+OFF_REG_D2) +#define WIND_TCB_AREGS (WIND_TCB_REGS+OFF_REG_A0) +#define WIND_TCB_AREGS4 (WIND_TCB_REGS+OFF_REG_A1) +#define WIND_TCB_AREGS8 (WIND_TCB_REGS+OFF_REG_A2) +#define WIND_TCB_SSP (WIND_TCB_REGS+OFF_REG_SP) +#define WIND_TCB_MAC (WIND_TCB_REGS+OFF_REG_MAC) +#define WIND_TCB_MACSR (WIND_TCB_REGS+OFF_REG_MACSR) +#define WIND_TCB_MASK (WIND_TCB_REGS+OFF_REG_MASK) +#define WIND_TCB_HASMAC (WIND_TCB_REGS+OFF_REG_HASMAC) +#define WIND_TCB_SR (WIND_TCB_REGS+OFF_REG_SR) +#define WIND_TCB_PC (WIND_TCB_REGS+OFF_REG_PC) +#endif /* CPU_FAMILY==COLDFIRE */ + +#if CPU_FAMILY==SIMLINUX +#define WIND_TCB_REGS 0x188 +#include "arch/simlinux/regsSimlinux.h" +#endif /* CPU_FAMILY==SIMLINUX */ + +#if CPU_FAMILY==SIMNT +#define WIND_TCB_REGS 0x188 +#include "arch/simnt/regsSimnt.h" +#endif /* CPU_FAMILY==SIMLINUX */ + +#if CPU_FAMILY==SIMSPARCSOLARIS +#define WIND_TCB_REGS 0x198 +#include "arch/simsolaris/regsSimsolaris.h" +#endif /* CPU_FAMILY==SIMSPARCSOLARIS */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtaskLibPh */ diff --git a/h/private/taskMemLibP.h b/h/private/taskMemLibP.h new file mode 100644 index 0000000..fe18c4f --- /dev/null +++ b/h/private/taskMemLibP.h @@ -0,0 +1,68 @@ +/* taskMemLibP.h - private task stack library interface header */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,28sep04,tam added RTP_ID parameter to taskStackAlloc(); added + taskStackGuardPageEnable and taskStackNoExecEnable def. +01d,27sep04,ans Renamed IGNORE_RTP_STATE_DELETE to RTP_NOT_CHECK_CTX +01c,01jul04,pcs Add macro IGNORE_RTP_STATE_DELETE to be used as option + parameter to taskMemCtxSwitch. +01b,12nov03,kk added taskMemCtxSwitch prototype +01a,10nov03,tam written +*/ + +#ifndef __INCtaskMemLibPh +#define __INCtaskMemLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* task stack allocation/deallocation options */ + +#define STACK_DOWN 0x1 /* stack grows down */ +#define STACK_UP 0x2 /* stack grows up */ +#define EXECUTION_STACK 0x4 /* alloc/free an execution stack */ +#define EXCEPTION_STACK 0x8 /* alloc/free an exception stack */ + +/* + * option to taskMemCtxSwitch fn. to force context switch even though the + * the RTP is in the RTP_DELETE_STATE. + * This is required so that and unmapping of the RTP pages are done within + * the context of the RTP. + */ + +#define RTP_NOT_CHECK_CTX 0x01 + +/* function declarations */ + +extern STATUS taskStackAlloc (RTP_ID rtpId, + int stackSize, + int taskOverflowSize, + int taskUnderflowSize, + int options, + int * pStackSize, + char ** pStackBase); + +extern STATUS taskStackFree (WIND_TCB *pTcb, + char * stackBase, + int stackSize, + int taskOverflowSize, + int taskUnderflowSize, + int options); + +extern RTP_ID taskMemCtxSwitch (RTP_ID newCtx, + int options); + +extern STATUS taskStackGuardPageEnable (void); + +extern STATUS taskStackNoExecEnable (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtaskMemLibPh */ diff --git a/h/private/taskPxLibCommonP.h b/h/private/taskPxLibCommonP.h new file mode 100644 index 0000000..b566e45 --- /dev/null +++ b/h/private/taskPxLibCommonP.h @@ -0,0 +1,68 @@ +/* taskPxLibCommonP.h - common header for POSIX support in VxWorks task */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01b,09jul05,jln removed VX_POSIX_INSERT_HEAD_CHECK +01a,26jun05,jln created. +*/ + +#ifndef __INCtaskPxLibCommonPh +#define __INCtaskPxLibCommonPh + +/* includes */ + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus */ + +#include + +/* general status code */ + +#define S_taskPxLib_ILLEGAL_PRIORITY (M_taskPxLib | 101) +#define S_taskPxLib_ILLEGAL_POLICY (M_taskPxLib | 102) + +/* POSIX "schedInfo" definition for VxWorks task */ + +#define VX_POSIX_SCHED_FIFO 0x0001 +#define VX_POSIX_SCHED_RR 0x0002 +#define VX_POSIX_SCHED_OTHER 0x0004 + +#define VX_POSIX_INSERT_HEAD 0x80000000 + +#define VX_POSIX_SCHED_MASK (VX_POSIX_SCHED_FIFO | \ + VX_POSIX_SCHED_RR | \ + VX_POSIX_SCHED_OTHER) + +/* flag: bit def for "flag" in TASK_PX_ATTR passed to VxWorks kernel */ + +#define VX_POSIX_FLAG_SETSCHEDPRIO 0x0001 /* pthread_setschedprio() */ +#define VX_POSIX_FLAG_PRIORITY 0x0002 /* set/get priority */ +#define VX_POSIX_FLAG_POLICY 0x0004 /* set/get policy */ + +/* typedef */ + +/* Don't change the order of this struct; only append new members if needed */ + +typedef struct task_px_attr + { + UINT flag; /* bits to specify which attr to set/get */ + int priority; /* priority attribute */ + int policy; /* policy attribute */ + } TASK_PX_ATTR; + +#if defined(__cplusplus) +} +#endif /* __cplusplus */ + +#endif /* __INCtaskPxLibCommonPh */ + diff --git a/h/private/taskPxLibP.h b/h/private/taskPxLibP.h new file mode 100644 index 0000000..835c20f --- /dev/null +++ b/h/private/taskPxLibP.h @@ -0,0 +1,38 @@ +/* taskPxLibP.h - header for POSIX thread support in VxWorks task */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01b,05aug05,jln added taskPxWindTickAnnounceHook +01a,25jun05,jln Created +*/ + +#ifndef __INCtaskPxLibPh +#define __INCtaskPxLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* Function declarations */ + +extern void taskPxLibInit (void); +extern STATUS taskPxAttrSet (int tid, void * pAttr); +extern STATUS taskPxAttrGet (int tid, void * pAttr); +extern void taskPxWindTickAnnounceHook (WIND_TCB *); +#ifdef __cplusplus +} +#endif + +#endif /* __INCtaskPxLibPh */ diff --git a/h/private/taskSysCall.h b/h/private/taskSysCall.h new file mode 100644 index 0000000..b7e0912 --- /dev/null +++ b/h/private/taskSysCall.h @@ -0,0 +1,102 @@ +/* taskSysCall.h - VxWorks tasking system call definitions */ + +/* + * Copyright (c) 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01h,28jun05,jln Add VX_TASK_CTL_PX_ATTR_XXX cases +01g,18apr04,hya added VX_TASK_CTL_RESET. +01g,18feb04,aeg changed _taskOpen() system call API. +01f,03dec03,kk added VX_TASK_CTL_EXIT_REGISTER enum to taskCtl() +01e,27oct03,md added VX_TASK_CTL_UTCB_SET enum value. +01d,27nov03,aeg added _taskOpen() function declaration. +01c,22sep03,aeg added VX_TASK_CTL_TASK_EXIT enum value. +01b,05sep03,dcc moved taskOpen() and taskDelay() prototypes to taskLibCommon.h +01a,19aug03,aeg written +*/ + +#ifndef __INCtaskSysCallh +#define __INCtaskSysCallh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + + +/* command codes for the taskCtl() system call */ + +typedef enum + { + VX_TASK_CTL_ACTIVATE, + VX_TASK_CTL_SUSPEND, + VX_TASK_CTL_RESUME, + VX_TASK_CTL_RESTART, + VX_TASK_CTL_RESET, + VX_TASK_CTL_PRIORITY_GET, + VX_TASK_CTL_PRIORITY_SET, + VX_TASK_CTL_VERIFY, + VX_TASK_CTL_VAR_ADD, + VX_TASK_CTL_VAR_DELETE, + VX_TASK_CTL_VAR_GET, + VX_TASK_CTL_VAR_SET, + VX_TASK_CTL_TASK_EXIT, + VX_TASK_CTL_UTCB_SET, + VX_TASK_CTL_EXIT_REGISTER, + VX_TASK_CTL_PX_ATTR_SET, + VX_TASK_CTL_PX_ATTR_GET + } VX_TASK_CTL_CMD; + +/* command struct for VX_TASK_CTL_PX_ATTR_* commands */ + +typedef struct vx_task_ctl_px_attr + { + void * pAttr; + int attrSz; + } VX_TASK_CTL_PX_ATTR; + +/* command struct for VX_TASK_CTL_VAR_* commands */ + +typedef struct vx_task_ctl_var_cmd + { + int *pVariable; + int value; + } VX_TASK_CTL_VAR_CMD; + + +/* argument structure for the _taskOpen() system call */ + +typedef struct vx_task_open_sc_args + { + const char * name; /* task name - default name will be chosen */ + int priority; /* task priority */ + int options; /* VX_ task option bits */ + int mode; /* object management mode bits */ + char * pStackBase; /* location of execution stack */ + int stackSize; /* execution stack size */ + BOOL * pTaskCreated; /* new kernel task created? */ + void * context; /* context value */ + FUNCPTR entryPt; /* application entry point */ + int argc; /* number of arguments to entry point */ + char ** argv; /* arguments to application entry point */ + } VX_TASK_OPEN_SC_ARGS; + +/* system call function prototypes */ + +extern STATUS taskCtl (int tid, VX_TASK_CTL_CMD command, void * pArg, + UINT * pArgSize); +extern int _taskOpen (VX_TASK_OPEN_SC_ARGS *pArgs); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtaskSysCallh */ diff --git a/h/private/taskULibP.h b/h/private/taskULibP.h new file mode 100644 index 0000000..47af14d --- /dev/null +++ b/h/private/taskULibP.h @@ -0,0 +1,229 @@ +/* taskLibP.h - VxWorks user tasking library private interface header */ + +/* + * Copyright (c) 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01h,03jun05,kk fix syntax error (SPR# 109861) +01g,22sep04,md CI changes +01f,05may04,cjj moved errorStatus from WIND_TCB to WIND_UTCB. +01e,29apr04,dcc added WIND_UTCB_LOCK_CNT and WIND_UTCB_REL_CPU offsets. +01d,29mar04,aeg added argv pointer to WIND_TCB. +01c,27oct03,md added kernel/user tcb separation +01b,08oct03,aeg added definitions for task create/delete hooks; + moved TASK_UXXX() macros from taskLib.h +01a,24sep03,aeg written +*/ + +#ifndef __INCtaskLibPh_u +#define __INCtaskLibPh_u + +#include "vxWorks.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define WIND_UTCB_VERSION 1 + +#if !defined(_WRS_KERNEL) + +#include "semLib.h" +#include "tlsLib.h" /* TLS_KEY */ + +/* defines */ + +#define VX_MAX_TASK_CREATE_RTNS 16 +#define VX_MAX_TASK_DELETE_RTNS 16 + +#endif /* _WRS_KERNEL */ + +/* offsets */ + +#define WIND_UTCB_LOCK_CNT 0x08 /* (WIND_UTCB *)->kernel.lockCnt */ +#define WIND_UTCB_REL_CPU 0x0c /* (WIND_UTCB *)->kernel.relinquishCpu */ + +#ifndef _ASMLANGUAGE + +/* typedefs */ + +/* + * The user level TCB is available in both the kernel and the RTP environments. + * It is however divided into two sections, a kernel section and a user section. + * In the kernel environment *only* the kernel section of the TCB is visible, + * whereas in the RTP environment both sections are visible. + * + * The user level TCB is also known by two different names. In the RTP + * environment it goes by the name "struct windTcb" or WIND_TCB, whereas in + * the kernel it is known as "struct windUTcb" or WIND_UTCB. This is done + * so that the RTP environment remains similar to the kernel environment. + * + * WARNING, any changes to the kernel portion of the TCB structure must be + * backwards compatible with previous versions otherwise binary backwards + * compatibility will be broken. In essence this basically means that fields + * may only ever be added to the kernel portion and never removed. The user + * level portion of the TCB may change at any time. + * + * A TCB version identifier is present as the first member of the TCB + * structure. The version identifier is initialized by the task init code + * to the value of the WIND_UTCB_VERSION define. The version member must be + * checked by the kernel to verify the TCB member they are interested in is + * available in the TCB version being used. + * + */ + +#if defined(_WRS_KERNEL) + +typedef struct windUTcb /* user-level version of task control block */ + +#else /*_WRS_KERNEL */ + +typedef struct windTcb /* user-level version of task control block */ + +#endif /* _WRS_KERNEL */ + { + int version; /* 0x00: TCB structure version identifier */ + struct + { + int tid; /* 0x04: handle returned by _taskOpen */ + volatile + UINT lockCnt; /* 0x08: preemption lock count */ + volatile + BOOL relinquishCpu; /* 0x0c: higher pri task waiting for cpu? */ + int errorStatus; /* 0x10: task's most recent 'errno' */ + } kernel; +#if defined(_WRS_KERNEL) + } WIND_UTCB; +#else /* _WRS_KERNEL */ + + /* + * The following portion of the WIND_TCB structure is only visible in + * the RTP environment and is not accessible by the kernel. + */ + struct + { + volatile + UINT safeCnt; /* 0x14: safe-from-delete count */ + SEM_ID safeQFlushSemId; /* 0x18: semaphore to flush deleters */ + BOOL safeDeleteFlag; /* 0x1c: task delete requested? */ + int exitCode; /* 0x20: exit code from entry function */ + FUNCPTR entryPoint; /* 0x24: application task entry function */ + char * pName; /* 0x28: ptr to task's name */ + char * pTls; /* 0x2c: ptr to TLS area */ + char ** argv; /* 0x30: ptr to argument buffer */ + } user; + } WIND_TCB; +#endif /* _WRS_KERNEL */ + +/* variable declarations */ + +#if !defined(_WRS_KERNEL) + +extern TLS_KEY windTcbKey; +extern FUNCPTR taskCreateTable[]; +extern FUNCPTR taskDeleteTable[]; + + +/******************************************************************************* +* +* TASK_RTPLOCK - lock preemption for calling task +* +* Utilization of this macro invokes prevents other tasks in the same RTP from +* preempting the current task. In other words, a task residing in +* another RTP can still preempt the current task. +* +* This macro should only be used if it has already been determined that the +* current task has a valid WIND_TCB structure. Otherwise the taskRtpLock() +* function should be used. +* +* RETURNS: N/A +* +* NOMANUAL +*/ + +#define TASK_RTPLOCK() \ + do \ + { \ + _WRS_ASM (""); /* avoid re-ordering */ \ + \ + ((WIND_TCB *) TLS_VALUE_GET (windTcbKey))->lockCnt++; \ + \ + _WRS_ASM (""); \ + } while (0) + +/******************************************************************************* +* +* TASK_RTPUNLOCK - unlock preemption for calling task +* +* This macro invokes the taskRtpUnlock (2) routine. +* +* NOMANUAL +*/ + +#define TASK_RTPUNLOCK() \ + ( \ + taskRtpUnlock () \ + ) + +/******************************************************************************* +* +* TASK_RTPSAFE - guard self from deletion +* +* Utilization of this macro protects the calling task from deletion by other +* tasks in the same RTP. In other words, a task residing in another RTP can +* still delete the current task. +* +* This macro should only be used if it has already been determined that the +* current task has a valid WIND_TCB structure. Otherwise the taskUSafe() +* function should be used. +* +* RETURNS: N/A +* +* NOMANUAL +*/ + +#define TASK_RTPSAFE() \ + do \ + { \ + _WRS_ASM (""); \ + \ + ((WIND_TCB *) TLS_VALUE_GET (windTcbKey))->safeCnt++; \ + \ + _WRS_ASM (""); \ + } while (0) + +/******************************************************************************* +* +* TASK_RTPUNSAFE - unguard self from deletion +* +* This macro invokes the taskUnsafe (2) routine. +* +* NOMANUAL +*/ + +#define TASK_RTPUNSAFE() \ + ( \ + taskUnsafe () \ + ) + + +/* function declarations */ + +extern STATUS taskTlsOfInitTaskCreate (void); + +#endif /* !_WRS_KERNEL */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtaskLibPh_u */ diff --git a/h/private/taskUtilLibP.h b/h/private/taskUtilLibP.h new file mode 100644 index 0000000..4dc98e3 --- /dev/null +++ b/h/private/taskUtilLibP.h @@ -0,0 +1,285 @@ +/* taskUtilLibP.h - private kernel interface header */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01b,31aug05,gls updated for checkin +01a,04mar05,kk written +*/ + +#ifndef __INCtaskUtilLibPh +#define __INCtaskUtilLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include + +/* typedefs */ + +typedef UINT32 RESERVED_NUM; /* SPARE_NUM in h/taskUtilLib.h */ + +/* defines */ + +#define SPARE_MASK 0x000F +#define RESERVED_MASK 0x0003 + +/* update this if more fields are added to the TCB */ + +#define NUM_SPARE_FIELDS 4 +#define NUM_RESERVED_FIELDS 2 + +/* + * bitmaps for the reserved and spare fields. + * Using two variables instead of one to allow these to grow up to 15 fields. + * Currently: Reserved has first 2 bits. Spare has first 4 bits. + */ + +extern UINT16 tcbReserveBitmap; /* initialize in taskUtilLib.c */ +extern UINT16 tcbSpareBitmap; /* initialize in taskUtilLib.c */ + +/* +****************************************************************************** +* +* TASK_RESERVED_NUM_ALLOT - get the first available reserved field in the TCB +* +* This macro returns the first available reserved field in the TCB. If +* a reserved field is not available, ERROR or -1 is returned. If an available +* reserved field exist, that RESERVED_NUM will be returned in numAllotted. +* numAllotted starts from 1. +* +* Currently there are only 2 reserved fields. If more reserved fields +* are added to the TCB, then the macro NUM_RESERVED_FIELDS in this file +* must be updated. +* +* This macro will be used by the taskReserveNumAllot() routine. +* +* PROTOTYPE: void TASK_RESERVED_NUM_ALLOT (int tid, RESERVED_NUM * numAllotted) +* +* RETURNS: RESERVED_NUM, or ERROR if no available field +* +* \NOMANUAL +*/ + +#define TASK_RESERVED_NUM_ALLOT(tid, numAllotted) \ + { \ + UINT16 num = 0; \ + int key = intLock(); \ + while ((num < NUM_RESERVED_FIELDS) && \ + ((tcbReserveBitmap & (1 << (num % NUM_RESERVED_FIELDS))) != 0)) \ + num++; \ + if (num >= NUM_RESERVED_FIELDS) \ + *numAllotted = ERROR; \ + else \ + { \ + *numAllotted = ++num; \ + tcbReserveBitmap |= (1 << (num-1) % NUM_RESERVED_FIELDS); \ + } \ + intUnlock(key); \ + } \ + +/* +****************************************************************************** +* +* TASK_RESERVED_FIELD_GET - get the value of a reserved field +* +* This macro retrieves the value of a reserved field. The num parameter, +* allotted from using the TASK_RESERVED_NUM_ALLOT() macro, indicates which +* reserved field to get the value from. +* +* PROTOTYPE: int TASK_RESERVED_FIELD_GET (int tid, RESERVED_NUM num) +* +* RETURNS: value in the reserved field +* +* \NOMANUAL +*/ + +#define TASK_RESERVED_FIELD_GET(tid, num) \ + ( \ + *(int *)(&(((WIND_TCB *)(tid))->reserved1) + (num-1)) \ + ) + +/* +****************************************************************************** +* +* TASK_RESERVED_FIELD_SET - set the value of a reserved field +* +* This macro sets the value of a reserved field. The num parameter, +* gotten from TASK_RESERVED_NUM_ALLOT() macro, indicates +* which reserved field to set. +* +* PROTOTYPE: void TASK_RESERVED_FIELD_SET(int tid, RESERVED_NUM num, int value) +* +* RETURNS: N/A +* +* \NOMANUAL +*/ + +#define TASK_RESERVED_FIELD_SET(tid, num, value) \ + ( \ + *(int *)(&(((WIND_TCB *)(tid))->reserved1) + (num-1)) = value \ + ) + +/* +****************************************************************************** +* +* TASK_SPARE_NUM_ALLOT - get the first available spare field in the TCB +* +* This macro returns the first available spare field in the TCB. If +* a spare field is not available, ERROR or -1 is returned. If an available +* spare field exist, that SPARE_NUM will be returned in numAllotted. +* numAllotted starts from 1. +* +* Currently there are only 4 spare fields. If more spare fields +* are added to the TCB, then the macro NUM_SPARE_FIELDS in this file +* must be updated. +* +* This macro will be used by the taskSpareNumAllot() routine. +* This macro returns the first available spare field in the TCB. If +* a spare field is not available, ERROR or -1 is returned. +* +* Currently there are only 4 spare fields. SPARE_NUM starts from 1, +* +* This macro is used by the routine to get the available spare field +* in the TCB. This macro will be used by the taskSpareNumAllot() routine. +* +* PROTOTYPE: void TASK_SPARE_NUM_ALLOT (int tid, SPARE_NUM * numAllotted); +* +* RETURNS: SPARE_NUM, or ERROR if no available field +* +* \NOMANUAL +*/ + +#define TASK_SPARE_NUM_ALLOT(tid, numAllotted) \ + { \ + UINT16 num = 0; \ + int key = intLock(); \ + while ((num < NUM_SPARE_FIELDS) && \ + ((tcbSpareBitmap & (1 << (num % NUM_SPARE_FIELDS))) != 0)) \ + num++; \ + if (num >= NUM_SPARE_FIELDS) \ + *numAllotted = ERROR; \ + else \ + { \ + *numAllotted = ++num; \ + tcbSpareBitmap |= (1 << (num-1) % NUM_SPARE_FIELDS); \ + } \ + intUnlock(key); \ + } + +/* +****************************************************************************** +* +* TASK_SPARE_FIELD_GET - get the value of a spare field +* +* This macro retrieves the value of a spare field. The num parameter, +* gotten from TASK_SPARE_NUM_ALLOT() macro, indicates which spare +* field to obtain the value from. +* +* PROTOTYPE: int TASK_SPARE_FIELD_GET(int tid, SPARE_NUM num) +* +* RETURNS: value in the spare field +* +* \NOMANUAL +*/ + +#define TASK_SPARE_FIELD_GET(tid, num) \ + ( \ + *(int *)(&(((WIND_TCB *)(tid))->spare1) + (num-1)) \ + ) + +/* +****************************************************************************** +* +* TASK_SPARE_FIELD_SET - set the value of a spare field +* +* This macro sets the value of a spare field. The num parameter, +* gotten from TASK_SPARE_NUM_ALLOT() macro, specifies the spare field +* to set the value. +* +* PROTOTYPE: void TASK_SPARE_FIELD_SET(int tid, SPARE_NUM num, int value) +* +* RETURNS: N/A +* +* \NOMANUAL +*/ + +#define TASK_SPARE_FIELD_SET(tid, num, value) \ + ( \ + *(int *)(&(((WIND_TCB *)(tid))->spare1) + (num-1)) = value \ + ) + +/* +****************************************************************************** +* +* TASK_CPUTIME_INFO_GET - get the cpuTimeInfo field in the TCB +* +* This macro gets the value of a cpuTimeInfo field, referred to by +* 'index'. Index takes the value of 0 or 1, which indicates the first +* or secode element of the cpuTimeInfo[] array. +* +* INTERNAL: This does not use the allot scheme as in the spare and reserved +* fields because these routines will be used in performance critical code and +* thus the less calculation done, the better. +* +* PROTOTYPE: UINT64 TASK_CPUTIME_INFO_GET(int tid, int index) +* +* RETURNS: value in cpuTimeInfo field +* +* \NOMANUAL +*/ + +#define TASK_CPUTIME_INFO_GET(tid, index) \ + ( \ + ((WIND_TCB *)(tid))->cpuTimeInfo[index] \ + ) + +/* +****************************************************************************** +* +* TASK_CPUTIME_INFO_SET - set the cpuTimeInfo field in the TCB +* +* This macro sets the value of a the cpuTimeInfo field, specified by 'index'. +* Index takes the value of 0 or 1, which is index into the cpuTimeInfo array. +* +* INTERNAL: This does not use the allot scheme as in the spare and reserved +* fields because these routines will be used in performance critical code and +* thus less calculation the better. +* +* PROTOTYPE: void TASK_CPUTIME_INFO_SET(int tid, int index, UINT64 value) +* +* RETURNS: N/A +* +* \NOMANUAL +*/ + +#define TASK_CPUTIME_INFO_SET(tid, index, value) \ + ( \ + ((WIND_TCB *)(tid))->cpuTimeInfo[index] = value \ + ) + +/* prototypes */ + +extern void taskReservedNumAllot(int tid, RESERVED_NUM * numAllotted); +extern STATUS taskReservedFieldSet(int tid, RESERVED_NUM num, int value); +extern int taskReservedFieldGet(int tid, RESERVED_NUM num); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtaskUtilLibPh */ diff --git a/h/private/taskWaitShowP.h b/h/private/taskWaitShowP.h new file mode 100644 index 0000000..09e9a02 --- /dev/null +++ b/h/private/taskWaitShowP.h @@ -0,0 +1,25 @@ +/* taskWaitShowP.h - private header file for taskWaitShow routines */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,07sep04,bpn Written. +*/ + +#ifndef __INCtaskWaitShowPh +#define __INCtaskWaitShowPh + +#ifdef __cplusplus +extern "C" { +#endif + +extern STATUS taskWaitShowCoreRtn (BOOL allTasks, BOOL detail, int taskId, + const char * errorStr); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtaskWaitShowPh */ diff --git a/h/private/timeP.h b/h/private/timeP.h new file mode 100644 index 0000000..1536c02 --- /dev/null +++ b/h/private/timeP.h @@ -0,0 +1,109 @@ +/* timeP.h - private time header file */ + +/* Copyright 1992-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,06sep96,dbt modified comment concerning TM_YEAR_BASE, removed + TM_YEAR_FINAL define (SPR #5865). +01d,17aug93,dvs changed TIME to TIMEO to fix conficting defines (SPR #2249) +01c,22sep92,rrr added support for c++ +01b,25jul92,smb modification for the time library +01a,08jul92,smb created. +*/ + +#include "time.h" + +#ifndef __INCtimePh +#define __INCtimePh + +#ifdef __cplusplus +extern "C" { +#endif + +#define SECSPERMIN 60 /* Seconds per minute */ +#define MINSPERHOUR 60 /* minutes per hour */ +#define HOURSPERDAY 24 /* hours per day */ +#define DAYSPERWEEK 7 /* days per week */ +#define MONSPERYEAR 12 /* months per year */ +#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR) +#define SECSPERDAY ((long) SECSPERHOUR * HOURSPERDAY) + +#define DAYSPERYEAR 365 /* days per non-leap year */ + +#define CENTURY 100 /* years per century */ + +#define TM_THURSDAY 4 /* Thursday is the fourth day of the week */ +#define TM_SUNDAY 0 /* Sunday is the zeroth day of the week */ +#define TM_MONDAY 1 /* Monday is the first day of the week */ + +#define EPOCH_WDAY TM_THURSDAY +#define EPOCH_YEAR 1970 +#define TM_YEAR_BASE 1900 /* There is NO NEED to change this define */ + /* after the year 2000! */ + +#define ABBR 1 /* Abbrivations only */ +#define FULL 0 /* Full names */ + +/* Buffer used for asctime */ + +#define ASCBUF "Day Mon dd hh:mm:ss yyyy\n\0" +#define MaxBufferSize 25 + +/* ZONE and Day light saving definitions */ + +#define ZONEBUFFER "UTC:UTC:000:ddmmhh:ddmmhh\0" + +#define NAME 0 /* zone name offset */ +#define NAME2 1 /* zone name offset */ +#define TIMEOFFSET 2 /* time difference offset */ + +#define DSTON 0 /* Day light saving on */ +#define DSTOFF 1 /* Day light saving off */ + +/* LOCALE definitions */ + +#define DATETIME 0 /* used with time locale, don't change! */ +#define DATE 1 /* Date offset in locale structure */ +#define TIMEO 2 /* Time offset in locale structure */ +#define AMPM 3 /* AM/PM offset in locale structure */ +#define ZONE 4 /* Zone offset in locale structure */ +#define DST 5 /* DST offset in locale structure */ + +typedef struct __timeLocale + { + char *_Days[14]; + char *_Months[24]; + char *_Format[3]; + char *_Ampm[2]; + char *_Zone[3]; + char *_Isdst[2]; + } TIMELOCALE; + +#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0) +#define EOS '\0' + +#if defined(__STDC__) || defined(__cplusplus) + +extern int __daysSinceEpoch (int, int); +extern int __julday (int, int, int); +extern int __getTime (const time_t , struct tm *); +extern int __getDstInfo (struct tm *, TIMELOCALE *); +extern void __getZoneInfo (char *, int, TIMELOCALE *); + +#else /* __STDC__ */ + +extern int __daysSinceEpoch (); +extern int __julday (); +extern int __getTime (); +extern int __getDstInfo (); +extern void __getZoneInfo (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtimePh */ diff --git a/h/private/timerLibP.h b/h/private/timerLibP.h new file mode 100644 index 0000000..549b6f0 --- /dev/null +++ b/h/private/timerLibP.h @@ -0,0 +1,140 @@ +/* timerLibP.h - private POSIX 1003.4 Clocks & Timers header */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +03n,26oct04,fr added timerOpenInit() routine (SPR 101491) +03m,28sep04,fr removed vTimerCreate prototype (SPR 101349) +03l,23aug04,lei added timer_destroy() prototype. +03k,31mar04,dcc added vTimerCreate() prototype. Added timerClassId declaration. +03j,02dec03,ans code inspection changes +03i,22oct03,ans added extern declaration for timerLibInit. +03h,30sep03,ans User-level timer support. +03g,12nov01,gls Account for system clock rate (SPR #70255) +03f,27jun96,dbt modified TV_CONVERT_TO_TICK to round up the value to + return (SPR #5647). + Updated copyright. +03e,29nov93,dvs updated for POSIX draft 14 +03d,23sep92,kdl changed name to timerLibP.h +03c,22sep92,rrr added support for c++ +03b,31jul92,gae added sigevent.h, time.h and timers.h includes. +03a,22jul92,gae Draft 12 revision; removed object stuff; moved + some prototype definitions to timers.h. +02a,04jul92,jcf cleaned up. +01d,26may92,rrr the tree shuffle +01c,30apr92,rrr some preparation for posix signals. +01a,16oct91,gae written. +*/ + +/* +DESCRIPTION +This file provides header information for the +POSIX 1003.4 Clocks & Timers interface per Draft 12. +*/ + +#ifndef __INCtimerLibPh +#define __INCtimerLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "sys/types.h" +#include "time.h" +#include "signal.h" +#include "sigevent.h" +#include "timers.h" +#include "private/sigLibP.h" +#include "private/objLibP.h" +#include "wdLib.h" +#include "stdarg.h" + + +typedef struct __timer + { + OBJ_CORE objCore; /* object core */ + WDOG_ID wdog; /* expiry mechanism */ + int active; /* wdog is set */ + int taskId; /* "owner" of timer */ + clock_t clock_id; /* always CLOCK_REALTIME */ + SIGEVENT_ID sigevId; /* sigevent ID for async notification */ + struct sigevent sevent; /* user's signal event */ + struct itimerspec exp; /* time to go off plus interval */ + VOIDFUNCPTR routine; /* user's routine */ + int arg; /* argument to user's routine */ + struct timespec timeStamp; /* timestamp when timer is armed */ + } TIMER; + +typedef struct clock + { + UINT64 tickBase; /* vxTicks when time set */ + struct timespec timeBase; /* time set */ + } CLOCK; + +extern struct clock _clockRealtime; +extern CLASS_ID timerClassId; /* timer class id */ + +/* macros for "time value" manipulation */ + +#define BILLION 1000000000 /* 1000 million nanoseconds / second */ + +#define TV_EQ(a,b) \ + ((a).tv_sec == (b).tv_sec && (a).tv_nsec == (b).tv_nsec) +#define TV_GT(a,b) \ + ((a).tv_sec > (b).tv_sec || \ + ((a).tv_sec == (b).tv_sec && (a).tv_nsec > (b).tv_nsec)) +#define TV_LT(a,b) \ + ((a).tv_sec < (b).tv_sec || \ + ((a).tv_sec == (b).tv_sec && (a).tv_nsec < (b).tv_nsec)) +#define TV_ISZERO(a) \ + ((a).tv_sec == 0 && (a).tv_nsec == 0) +#define TV_SET(a,b) \ + (a).tv_sec = (b).tv_sec; (a).tv_nsec = (b).tv_nsec +#define TV_ADD(a,b) \ + (a).tv_sec += (b).tv_sec; (a).tv_nsec += (b).tv_nsec; TV_NORMALIZE(a) +#define TV_SUB(a,b) \ + (a).tv_sec -= (b).tv_sec; (a).tv_nsec -= (b).tv_nsec; TV_NORMALIZE(a) +#define TV_NORMALIZE(a) \ + if ((a).tv_nsec >= BILLION) \ + { (a).tv_sec++; (a).tv_nsec -= BILLION; } \ + else if ((a).tv_nsec < 0) \ + { (a).tv_sec--; (a).tv_nsec += BILLION; } +#define TV_VALID(a) \ + ((a).tv_nsec >= 0 && (a).tv_nsec < BILLION) +#define TV_ZERO(a) \ + (a).tv_sec = 0; (a).tv_nsec = 0 + +#define TV_CONVERT_TO_SEC(a,b) \ + do { \ + register UINT32 hz = sysClkRateGet(); \ + (a).tv_sec = (time_t)((b) / hz); \ + (a).tv_nsec = (long)(((b) % hz) * (BILLION / hz)); \ + } while (0) + +#define TV_CONVERT_TO_TICK(a,b) \ + do { \ + register UINT32 hz = sysClkRateGet(); \ + register UINT32 res = (BILLION / hz); \ + (a) = (UINT64) ((b).tv_sec) * hz + \ + (UINT64) ((b).tv_nsec) / res + \ + (((UINT64)((b).tv_nsec) % res) ? 1 : 0); \ + } while (0) + +/* non-standard function declarations */ + +extern int clock_setres (clockid_t clock_id, struct timespec *res); + +extern int timer_cancel (timer_t timerid); +extern int timer_connect (timer_t timerid, VOIDFUNCPTR routine, int arg); +extern int timer_show (timer_t timerid); +extern STATUS timerLibInit (void); +extern void timerOpenInit (void); +extern int timer_destroy (timer_t timerid, BOOL dealloc); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtimerLibPh */ diff --git a/h/private/timerSysCall.h b/h/private/timerSysCall.h new file mode 100644 index 0000000..b737302 --- /dev/null +++ b/h/private/timerSysCall.h @@ -0,0 +1,46 @@ +/* timerSysCall.h - POSIX timer system call definitions */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,22apr04,dcc added 'context' parameter to _timer_open(). +01b,02dec03,ans code inspection comments. +01a,02oct03,ans written +*/ + +#ifndef __INCtimerSysCallh +#define __INCtimerSysCallh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + + +/* command codes for the timerCtl() system call */ + +typedef enum + { + TIMER_CTL_GETTIME, + TIMER_CTL_SETTIME, + TIMER_CTL_GETOVERRUN, + TIMER_CTL_MODIFY + } TIMER_CTL_CMD; + + +/* system call function prototypes */ + +extern STATUS timerCtl (TIMER_CTL_CMD cmdCode, int timerId, + void * pArgs, int argSize); +extern OBJ_HANDLE _timer_open (const char * name, int mode, clockid_t clockId, + struct sigevent * evp, void * context); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtimerSysCallh */ diff --git a/h/private/trcLibP.h b/h/private/trcLibP.h new file mode 100644 index 0000000..e375760 --- /dev/null +++ b/h/private/trcLibP.h @@ -0,0 +1,104 @@ +/* trcLibP.h - private trace library header file */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,14may04,zl reordered TRC_LIB_FUNCS fields. +01c,02apr04,jmp added pc argument to TRC_LVL_ARGS_GET(). +01b,19mar04,zl updated for user build. +01a,18feb04,zl created +*/ + +#ifndef __INCtrcLibPh +#define __INCtrcLibPh + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "vxWorks.h" +#ifdef _WRS_KERNEL +#include "regs.h" +#include "private/syscallLibP.h" +#endif + +#ifndef _ASMLANGUAGE + +/* structure passed to the arch primitives */ + +typedef struct trc_os_ctx + { + char * stackBase; /* stack base */ + char * stackEnd; /* stack end */ + FUNCPTR pcValidateRtn; /* routine to validate PC */ +#ifdef _WRS_KERNEL + REG_SET * pRegs; /* register set */ + BOOL isSyscall; /* TRU if tracing a system call */ +#endif + } TRC_OS_CTX; + +/* structure passed to OS trace routine */ + +typedef struct trc_ctx + { + FUNCPTR usrRtn; + int taskId; + BOOL isKernelAdrs; + TRC_OS_CTX * pOsCtx; + void * usrCtx; + int nArgs; + int * pArgs; + BOOL verbose; + } TRC_CTX; + + +/* primitives provided by architecture specific trace libraries */ + +typedef STATUS (* TRC_LVL_INFO_GET) (char * fp, INSTR * pc, TRC_OS_CTX * pCtx, + char ** pPrevFp, INSTR ** pPrevPc, + INSTR ** pFuncAddr); +typedef int (* TRC_LVL_ARGS_GET) (INSTR * pc, INSTR * funcAddr, char * fp, + int pArgBuf[], int argMax, + int ** ppArgs); + +#ifdef _WRS_KERNEL +typedef STATUS (* TRC_TOP_INFO_GET) (TRC_OS_CTX * pCtx, char ** pFp, + char ** pPrevFp, INSTR ** pPrevPc, + INSTR ** pFuncAddr); + +typedef void (* TRC_SYSCALL_CHECK) (SYSCALL_ENTRY_STATE * pScState, + TRC_OS_CTX * pCtx); +#endif + +/* structure for trace library primitives */ + +typedef struct trc_lib_funcs + { + TRC_LVL_INFO_GET lvlInfoGet; /* routine to get frame info */ + TRC_LVL_ARGS_GET lvlArgsGet; /* routine to get arguments */ +#ifdef _WRS_KERNEL + TRC_TOP_INFO_GET topInfoGet; /* routine to get top frame info */ + TRC_SYSCALL_CHECK syscallCheck; /* routine check if syscall */ +#endif + } TRC_LIB_FUNCS; + +/* private global variable declarations */ + +extern TRC_LIB_FUNCS trcLibFuncs; + +/* private function declarations */ + +#ifdef _WRS_KERNEL +extern STATUS trcStackTrace (REG_SET * pRegs, TRC_CTX * pCtx); +#endif + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtrcLibPh */ diff --git a/h/private/trgLibP.h b/h/private/trgLibP.h new file mode 100644 index 0000000..090773b --- /dev/null +++ b/h/private/trgLibP.h @@ -0,0 +1,94 @@ + +/* trgLibP.h - event triggers header */ + +/* Copyright 1997-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,10nov03,cpd Add initialState to trigger structure +01h,23sep03,tcr move TRIGGER_ID def'n +01g,15sep03,tcr tidy up +01f,07sep98,pr Replaced LIST_MAX_LENGTH with TRG_MAX_REQUESTS +01e,12feb98,pr Added hitCnt field in struct trigger. + Moved some definitions in ../trgLib.h. Cleanup. +01d,15dec97,nps Added 'library' conditional type. +01c,20nov97,pr added several triggering macros, reworked triggering + structure, added trgActionDefPerform +01b,27oct97,pr modified the struct trigger into an object. cleanup +01a,18jul97,pr written + +*/ + +#ifndef __INCtrglibph +#define __INCtrglibph + +#ifdef __cplusplus +extern "C" { +#endif + + +/* This file contains event triggering information. See also eventP.h */ + +#define TRIGGER_MASK 0x0000ffff + +#define TRG_MSGQ_MAX_MSGS 50 +#define TRG_MSGQ_OPTIONS (MSG_Q_FIFO) +#define TRG_MSG_LEN 4 +#define TRG_ACT_PRIORITY 100 +#define TRG_ACT_OPTIONS VX_UNBREAKABLE +#define TRG_ACT_SIZE 2048 + +#ifndef _ASMLANGUAGE + +#include "private/eventP.h" +#include "msgQLib.h" +#include "trgLib.h" + +#define TRG_MAX_REQUESTS 50 + +typedef struct trigger + { + OBJ_CORE objCore; /* trigger object core */ + event_t eventId; /* event type */ + UINT16 status; /* status of the trigger, */ + /* i.e. enabled, disabled, etc */ + BOOL disable; /* check if trigger needs to be */ + /* disabled after use */ + int contextType; /* type of the context where the event occurs */ + UINT32 contextId; /* id of the context where the event occurs */ + OBJ_ID objId; /* object type */ + struct trigger *chain; /* pointer to chained trigger */ + struct trigger *next; /* ptr to next trigger in the list */ + int conditional; /* check if a condition is set */ + int condType; /* check the expression type (var/fn) */ + void * condEx1; /* pointer to conditional expression */ + int condOp; /* conditional operator (==, !=, ...) */ + int condEx2; /* second operand (constant) */ + int actionType; /* type of action (none, fn, lib) */ + FUNCPTR actionFunc; /* pointer to the action */ + int actionArg; /* argument passed to the action */ + BOOL actionDef; /* defer the action */ + int hitCnt; + int initialState; /* initial state of the trigger*/ + } TRIGGER; + + +extern STATUS trgInit (void); +extern STATUS trgActionDefPerform (void); +extern STATUS trgActionDefStart (void); +extern int trgEvtToIndex (event_t event); +extern BOOL trgContextMatch (TRIGGER_ID pTrg); +extern BOOL trgCondTest (TRIGGER_ID pTrg, int objId); +extern TRIGGER_ID trgAddTcl (char * buff); +extern void trgActionPerform (TRIGGER_ID pTrg); +extern void trgCheck (event_t event, int index, int obj, int arg1, int arg2, + int arg3, int arg4, int arg5); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCtrglibph*/ diff --git a/h/private/trigP.h b/h/private/trigP.h new file mode 100644 index 0000000..58a99da --- /dev/null +++ b/h/private/trigP.h @@ -0,0 +1,270 @@ +/* trigP.h - trigonometric definitions for Berkeley math package */ + +/* Copyright 1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,14oct94,ism fixed syntax error per SPR#3718 +01d,22sep92,rrr added support for c++ +01c,01jul92,smb added to clib library. +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01a,14sep90,mcl adapted from Berkeley. +*/ + +#ifndef __INCtrigPh +#define __INCtrigPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Copyright (c) 1987 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * All recipients should regard themselves as participants in an ongoing + * research project and hence should feel obligated to report their + * experiences (good or bad) with these elementary function codes, using + * the sendbug(8) program, to the authors. + * + * @(#)trig.h 5.3 (Berkeley) 6/30/88 + */ + +#if defined(vax)||defined(tahoe) +#ifdef vax +#define _0x(A,B) 0x/**/A/**/B +#else /* vax */ +#define _0x(A,B) 0x/**/B/**/A +#endif /* vax */ +/*thresh = 2.6117239648121182150E-1 , Hex 2^ -1 * .85B8636B026EA0 */ +/*PIo4 = 7.8539816339744830676E-1 , Hex 2^ 0 * .C90FDAA22168C2 */ +/*PIo2 = 1.5707963267948966135E0 , Hex 2^ 1 * .C90FDAA22168C2 */ +/*PI3o4 = 2.3561944901923449203E0 , Hex 2^ 2 * .96CBE3F9990E92 */ +/*PI = 3.1415926535897932270E0 , Hex 2^ 2 * .C90FDAA22168C2 */ +/*PI2 = 6.2831853071795864540E0 ; Hex 2^ 3 * .C90FDAA22168C2 */ +static long threshx[] = { _0x(b863,3f85), _0x(6ea0,6b02)}; +static long PIo4x[] = { _0x(0fda,4049), _0x(68c2,a221)}; +static long PIo2x[] = { _0x(0fda,40c9), _0x(68c2,a221)}; +static long PI3o4x[] = { _0x(cbe3,4116), _0x(0e92,f999)}; +static long PIx[] = { _0x(0fda,4149), _0x(68c2,a221)}; +static long PI2x[] = { _0x(0fda,41c9), _0x(68c2,a221)}; +#define thresh (*(double*)threshx) +#define PIo4 (*(double*)PIo4x) +#define PIo2 (*(double*)PIo2x) +#define PI3o4 (*(double*)PI3o4x) +#define PI (*(double*)PIx) +#define PI2 (*(double*)PI2x) +#else /* defined(vax)||defined(tahoe) */ +static double +thresh = 2.6117239648121182150E-1 , /*Hex 2^ -2 * 1.0B70C6D604DD4 */ +PIo4 = 7.8539816339744827900E-1 , /*Hex 2^ -1 * 1.921FB54442D18 */ +PIo2 = 1.5707963267948965580E0 , /*Hex 2^ 0 * 1.921FB54442D18 */ +PI3o4 = 2.3561944901923448370E0 , /*Hex 2^ 1 * 1.2D97C7F3321D2 */ +PI = 3.1415926535897931160E0 , /*Hex 2^ 1 * 1.921FB54442D18 */ +PI2 = 6.2831853071795862320E0 ; /*Hex 2^ 2 * 1.921FB54442D18 */ +#ifdef national +static long fmaxx[] = { 0xffffffff, 0x7fefffff}; +#define fmax (*(double*)fmaxx) +#endif /* national */ +#endif /* defined(vax)||defined(tahoe) */ +static double + zero = 0, + one = 1, + negone = -1, + half = 1.0/2.0, + small = 1E-10, /* 1+small**2 == 1; better values for small: + * small = 1.5E-9 for VAX D + * = 1.2E-8 for IEEE Double + * = 2.8E-10 for IEEE Extended + */ + big = 1E20; /* big := 1/(small**2) */ + +/* sin__S(x*x) ... re-implemented as a macro + * DOUBLE PRECISION (VAX D format 56 bits, IEEE DOUBLE 53 BITS) + * STATIC KERNEL FUNCTION OF SIN(X), COS(X), AND TAN(X) + * CODED IN C BY K.C. NG, 1/21/85; + * REVISED BY K.C. NG on 8/13/85. + * + * sin(x*k) - x + * RETURN --------------- on [-PI/4,PI/4] , where k=pi/PI, PI is the rounded + * x + * value of pi in machine precision: + * + * Decimal: + * pi = 3.141592653589793 23846264338327 ..... + * 53 bits PI = 3.141592653589793 115997963 ..... , + * 56 bits PI = 3.141592653589793 227020265 ..... , + * + * Hexadecimal: + * pi = 3.243F6A8885A308D313198A2E.... + * 53 bits PI = 3.243F6A8885A30 = 2 * 1.921FB54442D18 + * 56 bits PI = 3.243F6A8885A308 = 4 * .C90FDAA22168C2 + * + * Method: + * 1. Let z=x*x. Create a polynomial approximation to + * (sin(k*x)-x)/x = z*(S0 + S1*z^1 + ... + S5*z^5). + * Then + * sin__S(x*x) = z*(S0 + S1*z^1 + ... + S5*z^5) + * + * The coefficient S's are obtained by a special Remez algorithm. + * + * Accuracy: + * In the absence of rounding error, the approximation has absolute error + * less than 2**(-61.11) for VAX D FORMAT, 2**(-57.45) for IEEE DOUBLE. + * + * Constants: + * The hexadecimal values are the intended ones for the following constants. + * The decimal values may be used, provided that the compiler will convert + * from decimal to binary accurately enough to produce the hexadecimal values + * shown. + * + */ + +#if defined(vax)||defined(tahoe) +/*S0 = -1.6666666666666646660E-1 , Hex 2^ -2 * -.AAAAAAAAAAAA71 */ +/*S1 = 8.3333333333297230413E-3 , Hex 2^ -6 * .8888888888477F */ +/*S2 = -1.9841269838362403710E-4 , Hex 2^-12 * -.D00D00CF8A1057 */ +/*S3 = 2.7557318019967078930E-6 , Hex 2^-18 * .B8EF1CA326BEDC */ +/*S4 = -2.5051841873876551398E-8 , Hex 2^-25 * -.D73195374CE1D3 */ +/*S5 = 1.6028995389845827653E-10 , Hex 2^-32 * .B03D9C6D26CCCC */ +/*S6 = -6.2723499671769283121E-13 ; Hex 2^-40 * -.B08D0B7561EA82 */ +static long S0x[] = { _0x(aaaa,bf2a), _0x(aa71,aaaa)}; +static long S1x[] = { _0x(8888,3d08), _0x(477f,8888)}; +static long S2x[] = { _0x(0d00,ba50), _0x(1057,cf8a)}; +static long S3x[] = { _0x(ef1c,3738), _0x(bedc,a326)}; +static long S4x[] = { _0x(3195,b3d7), _0x(e1d3,374c)}; +static long S5x[] = { _0x(3d9c,3030), _0x(cccc,6d26)}; +static long S6x[] = { _0x(8d0b,ac30), _0x(ea82,7561)}; +#define S0 (*(double*)S0x) +#define S1 (*(double*)S1x) +#define S2 (*(double*)S2x) +#define S3 (*(double*)S3x) +#define S4 (*(double*)S4x) +#define S5 (*(double*)S5x) +#define S6 (*(double*)S6x) +#else /* IEEE double */ +static double +S0 = -1.6666666666666463126E-1 , /*Hex 2^ -3 * -1.555555555550C */ +S1 = 8.3333333332992771264E-3 , /*Hex 2^ -7 * 1.111111110C461 */ +S2 = -1.9841269816180999116E-4 , /*Hex 2^-13 * -1.A01A019746345 */ +S3 = 2.7557309793219876880E-6 , /*Hex 2^-19 * 1.71DE3209CDCD9 */ +S4 = -2.5050225177523807003E-8 , /*Hex 2^-26 * -1.AE5C0E319A4EF */ +S5 = 1.5868926979889205164E-10 ; /*Hex 2^-33 * 1.5CF61DF672B13 */ +#endif + +#if defined(vax)||defined(tahoe) +#define sin__S(z) (z*(S0+z*(S1+z*(S2+z*(S3+z*(S4+z*(S5+z*S6))))))) +#else /* defined(vax)||defined(tahoe) */ +#define sin__S(z) (z*(S0+z*(S1+z*(S2+z*(S3+z*(S4+z*S5)))))) +#endif /* defined(vax)||defined(tahoe) */ + +/* cos__C(x*x) ... re-implemented as a macro + * DOUBLE PRECISION (VAX D FORMAT 56 BITS, IEEE DOUBLE 53 BITS) + * STATIC KERNEL FUNCTION OF SIN(X), COS(X), AND TAN(X) + * CODED IN C BY K.C. NG, 1/21/85; + * REVISED BY K.C. NG on 8/13/85. + * + * x*x + * RETURN cos(k*x) - 1 + ----- on [-PI/4,PI/4], where k = pi/PI, + * 2 + * PI is the rounded value of pi in machine precision : + * + * Decimal: + * pi = 3.141592653589793 23846264338327 ..... + * 53 bits PI = 3.141592653589793 115997963 ..... , + * 56 bits PI = 3.141592653589793 227020265 ..... , + * + * Hexadecimal: + * pi = 3.243F6A8885A308D313198A2E.... + * 53 bits PI = 3.243F6A8885A30 = 2 * 1.921FB54442D18 + * 56 bits PI = 3.243F6A8885A308 = 4 * .C90FDAA22168C2 + * + * + * Method: + * 1. Let z=x*x. Create a polynomial approximation to + * cos(k*x)-1+z/2 = z*z*(C0 + C1*z^1 + ... + C5*z^5) + * then + * cos__C(z) = z*z*(C0 + C1*z^1 + ... + C5*z^5) + * + * The coefficient C's are obtained by a special Remez algorithm. + * + * Accuracy: + * In the absence of rounding error, the approximation has absolute error + * less than 2**(-64) for VAX D FORMAT, 2**(-58.3) for IEEE DOUBLE. + * + * + * Constants: + * The hexadecimal values are the intended ones for the following constants. + * The decimal values may be used, provided that the compiler will convert + * from decimal to binary accurately enough to produce the hexadecimal values + * shown. + * + */ + +#if defined(vax)||defined(tahoe) +/*C0 = 4.1666666666666504759E-2 , Hex 2^ -4 * .AAAAAAAAAAA9F0 */ +/*C1 = -1.3888888888865302059E-3 , Hex 2^ -9 * -.B60B60B60A0CCA */ +/*C2 = 2.4801587285601038265E-5 , Hex 2^-15 * .D00D00CDCD098F */ +/*C3 = -2.7557313470902390219E-7 , Hex 2^-21 * -.93F27BB593E805 */ +/*C4 = 2.0875623401082232009E-9 , Hex 2^-28 * .8F74C8FA1E3FF0 */ +/*C5 = -1.1355178117642986178E-11 ; Hex 2^-36 * -.C7C32D0A5C5A63 */ +static long C0x[] = { _0x(aaaa,3e2a), _0x(a9f0,aaaa)}; +static long C1x[] = { _0x(0b60,bbb6), _0x(0cca,b60a)}; +static long C2x[] = { _0x(0d00,38d0), _0x(098f,cdcd)}; +static long C3x[] = { _0x(f27b,b593), _0x(e805,b593)}; +static long C4x[] = { _0x(74c8,320f), _0x(3ff0,fa1e)}; +static long C5x[] = { _0x(c32d,ae47), _0x(5a63,0a5c)}; +#define C0 (*(double*)C0x) +#define C1 (*(double*)C1x) +#define C2 (*(double*)C2x) +#define C3 (*(double*)C3x) +#define C4 (*(double*)C4x) +#define C5 (*(double*)C5x) +#else /* defined(vax)||defined(tahoe) */ +static double +C0 = 4.1666666666666504759E-2 , /*Hex 2^ -5 * 1.555555555553E */ +C1 = -1.3888888888865301516E-3 , /*Hex 2^-10 * -1.6C16C16C14199 */ +C2 = 2.4801587269650015769E-5 , /*Hex 2^-16 * 1.A01A01971CAEB */ +C3 = -2.7557304623183959811E-7 , /*Hex 2^-22 * -1.27E4F1314AD1A */ +C4 = 2.0873958177697780076E-9 , /*Hex 2^-29 * 1.1EE3B60DDDC8C */ +C5 = -1.1250289076471311557E-11 ; /*Hex 2^-37 * -1.8BD5986B2A52E */ +#endif /* defined(vax)||defined(tahoe) */ + +#define cos__C(z) (z*z*(C0+z*(C1+z*(C2+z*(C3+z*(C4+z*C5)))))) + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern int finite(double x); +extern double copysign(double x, double y); +extern double drem(double x, double p); + +#else /* __STDC__ */ + +extern int finite(); +extern double copysign(); +extern double drem(); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtrigPh */ diff --git a/h/private/usrLibP.h b/h/private/usrLibP.h new file mode 100644 index 0000000..5923602 --- /dev/null +++ b/h/private/usrLibP.h @@ -0,0 +1,50 @@ +/* usrLibP.h - private header file for user interface library */ + +/* Copyright 2003-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,25jan05,bpn Added changeFpReg(), changeReg(), substrcmp() prototypes. +01d,08nov04,bpn Added taskRegsModify() prototype (SPR#103922). +01c,02jun04,bpn Added usrModuleLoad() prototype. +01b,18may04,bpn Added function prototypes. +01a,12nov03,jn written +*/ + +#ifndef __INCusrLibPh +#define __INCusrLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +/* function declarations */ + +extern STATUS lkAddrInternal (void * addr, SYMTAB_ID symTabId); +extern STATUS objectShow (OBJ_ID objId, int level, const char * errorStr); +extern STATUS memoryDump (void * adrs, int nunits, int width, + const char * errorStr); +extern STATUS memoryModify (void * adrs, int width, const char * errorStr); +extern MODULE_ID usrModuleLoad (int fd, int loadFlags, + BOOL noAbort, const char * errorStr); +extern STATUS taskRegsModify (char * regName, int taskId, + const char * errorStr); + +extern STATUS changeFpReg (char * pPrompt, double value, double * pValue); +extern STATUS changeReg (char * pPrompt, void * pValue, int width); +extern BOOL substrcmp (char * s, char * s1); + +/* usrFsShellCmd.c functions below this comment */ + +extern STATUS usrFsShellCmdInit (); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusrLibPh */ diff --git a/h/private/usrRtpLibP.h b/h/private/usrRtpLibP.h new file mode 100644 index 0000000..abb54e8 --- /dev/null +++ b/h/private/usrRtpLibP.h @@ -0,0 +1,41 @@ +/* usrRtpLibP.h - private header file for rtp user interface library */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,03aug04,bpn Written. +*/ + +#ifndef __INCusrRtpLibPh +#define __INCusrRtpLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +extern int rtpSpPriority; +extern int rtpSpOptions; +extern int rtpSpStackSize; +extern int rtpSpDelay; +extern int rtpSpTaskOptions; + +/* function declarations */ + +extern STATUS rtpSymsAdd (RTP_ID rtpId, UINT32 regPolicy, char * filePath); +extern STATUS rtpTaskShow (RTP_ID rtpId); +extern STATUS shlSymsAdd (void * shlId, RTP_ID rtpId, UINT32 regPolicy, + char * filePath); +extern STATUS shlSymsRemove (void * shlId, RTP_ID rtpId, UINT32 remPolicy); +extern STATUS rtpSymsRemove (RTP_ID rtpId, UINT32 remPolicy); +extern STATUS rtpSymsOverride (int overridePolicy); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusrRtpLibPh */ + diff --git a/h/private/virtualDiskLibP.h b/h/private/virtualDiskLibP.h new file mode 100644 index 0000000..074f196 --- /dev/null +++ b/h/private/virtualDiskLibP.h @@ -0,0 +1,28 @@ +/* virtualDiskLibP.h - private VxSim virtual disk header file */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,30jul03,jeg written. +*/ + +#ifndef __INCvirtualDiskLibPh +#define __INCvirtualDiskLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* forwared declarations */ + +BLK_DEV * virtualDiskOldCreate (char * hostFile, int bytesPerBlk, + int blksPerTrack, int nBlocks); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvirtualDiskLibPh */ + diff --git a/h/private/vmInvTblLibP.h b/h/private/vmInvTblLibP.h new file mode 100644 index 0000000..3fb07e3 --- /dev/null +++ b/h/private/vmInvTblLibP.h @@ -0,0 +1,30 @@ +/* vmInvTblLibP.h - private header for vmInvTblLib.c */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,15apr04,gls written. +*/ + +#ifndef __INCvmInvTblLibPh +#define __INCvmInvTblLibPh + +#ifndef _ASMLANGUAGE + +#ifdef __cplusplus +extern "C" { +#endif + +IMPORT STATUS vmInvTblLibInit (void); +IMPORT STATUS vmInvPageMap (PHYS_ADDR physicalAddr, UINT len, BOOL noAlias); +IMPORT STATUS vmInvUnMap (PHYS_ADDR physicalAddr, UINT len); + +#ifdef __cplusplus +} +#endif + +#endif + +#endif /* __INCvmInvTblLibPh */ diff --git a/h/private/vmLibP.h b/h/private/vmLibP.h new file mode 100644 index 0000000..86bf9ba --- /dev/null +++ b/h/private/vmLibP.h @@ -0,0 +1,486 @@ +/* vmLibP.h - private header for architecture independent mmu interface */ + +/* + * Copyright (c) 1995-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01x,11aug05,zl moved common VM macros from the source files +01w,10jun05,jmp updated VM_LIB_INFO to support vmContigBlockEach(), added + VM_CONTIG_BLOCK_EACH() macro. +01v,03jun05,yvp Added #ifndef _ASMLANGUAGE. + Updated copyright. #include now with angle-brackets. +01u,07feb05,zl moved VM_CONTEXT from vmLib.h +01t,12oct04,pcs Remove struct entries pVmCtxLockRtn & pVmPageProtectRtn since + they are really not being used. +01s,30sep04,pcs Moved VM_CTX_MASK_XXX macros from vmLib.h to here. +01r,20sep04,tam added vmInfoGet() and VM_INFO +01q,07jul04,aeg removed VM_CONTEXT_CLASS related definitions. +01p,03may04,pcs Add support for optimize/lock/unlock feature's. +01o,29apr04,pcs Add a macro to get max physical address bit's supported by + the CPU. +01n,01apr04,zl added mmuSoftCfgEnabled to VM_LIB_INFO. +01m,19feb04,yp adding data struct for tracking extra mappings +01l,10nov03,yp adding addrSpaceSegInfo structure +01k,30oct03,sru remove MMU_TRANS_TBL typedef +01j,15oct03,sru fix prototypes for PHYS_ADDR +01i,19sep03,pcs Implement code review changes. +01h,11jul03,pcs Port to Base 6. +01h,22may03,dcc added prototypes of vmContextTerminate () and + vmContextDestroy (). +01g,13feb93,kdl fixed test in VM_TEXT_PAGE_PROTECT macro. +01f,10feb93,rdc added support for text page protection routine. +01e,08oct92,rdc fixed VM_TRANSLATE macro. +01d,22sep92,rrr added support for c++ +01c,30jul92,rdc added pointer to vmTranslate routine to VM_LIB_INFO. +01b,27jul92,rdc modified VM_LIB_INFO. +01a,10jul92,rdc written. +*/ + +#ifndef __INCvmLibPh +#define __INCvmLibPh + +#ifdef __cplusplus +extern "C" { +#endif + + +#include +#include +#include +#include +#include +#include +#include +#include + + +#ifndef _ASMLANGUAGE + +/* compute if page is aligned without using "%" (SPR 6833) */ + +#define NOT_PAGE_ALIGNED(addr) (((UINT)(addr)) & ((UINT)vmPageSize - 1)) + +/* Convert from state to index into architecture dependent state array */ + +#define STATE_TO_PROT_INDEX(state) ((MMU_ATTR_PROT_GET(state)) >> \ + MMU_ATTR_PROT_INDEX_SHIFT) + +#define STATE_TO_CACHE_INDEX(state) ((MMU_ATTR_CACHE_GET(state)) >> \ + MMU_ATTR_CACHE_INDEX_SHIFT) + +#define STATE_TO_VALID_INDEX(state) ((MMU_ATTR_VALID_GET(state)) >> \ + MMU_ATTR_VALID_INDEX_SHIFT) + +/* Convert from architecture dependent state array index to state */ + +#define PROT_INDEX_TO_STATE(index) (((UINT)(index) << \ + MMU_ATTR_PROT_INDEX_SHIFT) | \ + MMU_ATTR_PROT_SUP_READ) + +#define CACHE_INDEX_TO_STATE(index) ((UINT)index << MMU_ATTR_CACHE_INDEX_SHIFT) + +#define VALID_INDEX_TO_STATE(index) ((UINT)index << MMU_ATTR_VALID_INDEX_SHIFT) + +/* Convert from mask to index into architecture dependent mask array */ + +#define STATEMASK_TO_INDEX(statemask) ((MMU_ATTR_MSK_ID_GET(statemask)) >> \ + MMU_ATTR_MSK_INDEX_SHIFT) + + +/* macros to reference mmuLib routines indirectly through mmuLibFunc table */ + +#define MMU_PAGE_SIZE_GET (*(mmuLibFuncs.mmuPageSizeGet)) +#define MMU_ENABLE (*(mmuLibFuncs.mmuEnable)) +#define MMU_TRANS_TBL_CREATE (*(mmuLibFuncs.mmuTransTblCreate)) +#define MMU_STATE_SET (*(mmuLibFuncs.mmuStateSet)) +#define MMU_CURRENT_SET (*(mmuLibFuncs.mmuCurrentSet)) +#define MMU_GLOBAL_PAGE_MAP (*(mmuLibFuncs.mmuGlobalPageMap)) +#define MMU_ATTR_TRANSLATE (*(mmuLibFuncs.mmuAttrTranslate)) + +#define MMU_PAGE_SIZE_GET (*(mmuLibFuncs.mmuPageSizeGet)) +#define MMU_ENABLE (*(mmuLibFuncs.mmuEnable)) +#define MMU_STATE_SET (*(mmuLibFuncs.mmuStateSet)) +#define MMU_STATE_GET (*(mmuLibFuncs.mmuStateGet)) +#define MMU_PAGE_MAP (*(mmuLibFuncs.mmuPageMap)) +#define MMU_PAGE_UNMAP (*(mmuLibFuncs.mmuPageUnMap)) +#define MMU_TRANSLATE (*(mmuLibFuncs.mmuTranslate)) +#define MMU_PHYS_TRANSLATE (*(mmuLibFuncs.mmuPhysTranslate)) +#define MMU_ATTR_TRANSLATE (*(mmuLibFuncs.mmuAttrTranslate)) +#define MMU_PAGE_OPTIMIZE (*(mmuLibFuncs.mmuPageOptimize)) +#define MMU_BUFFER_WRITE (*(mmuLibFuncs.mmuBufferWrite)) +#define MMU_PAGE_LOCK (*(mmuLibFuncs.mmuPageLock)) +#define MMU_PAGE_UNLOCK (*(mmuLibFuncs.mmuPageUnlock)) +#define MMU_MAX_PHYS_BITS_GET (*(mmuLibFuncs.mmuMaxPhysBitsGet)) + +#define MMU_TRANS_TBL_DELETE (*(mmuLibFuncs.mmuTransTblDelete)) +#define MMU_TRANS_TBL_UNION (*(mmuLibFuncs.mmuTransTblUnion)) +#define MMU_TRANS_TBL_MASK (*(mmuLibFuncs.mmuTransTblMask)) +#define MMU_TRANS_TBL_GET (*(mmuLibFuncs.mmuTransTblGet)) +#define MMU_ATTACH_INIT (*(mmuLibFuncs.mmuTransTblUnionInit)) +#define MMU_PAGE_BLOCK_SIZE_GET (*(mmuLibFuncs.mmuBlockSizeGet)) + +/* + * An instance of VM_LIB_INFO is defined in usrConfig.c and is initialized + * if vmLib has been installed. If the bundled version of vmLib.c is installed, + * only a subset of the routines will be available - if the pointers are null, + * then the routines are not available. + */ + +typedef struct + { + BOOL vmLibInstalled; /* full mmu support available */ + BOOL vmBaseLibInstalled; /* base mmu support available */ + BOOL vmMpuLibInstalled; /* MPU support available */ + BOOL protectTextSegs; /* TRUE == protext text segments */ + BOOL mmuSoftCfgEnabled; /* TRUE: software MMU simulation configuration */ + + FUNCPTR pVmStateSetRtn; /* pointer to vmStateSet if vmLib included */ + FUNCPTR pVmStateGetRtn; /* pointer to vmStateGet if vmLib included */ + FUNCPTR pVmEnableRtn; /* pointer to vmEnable if vmLib included */ + FUNCPTR pVmPageSizeGetRtn; /* ptr to vmPageSizeGet if vmLib included */ + FUNCPTR pVmTranslateRtn; /* ptr vmTranslate if vmLib included */ + FUNCPTR pVmTextProtectRtn; /* ptr to vmTextLock routine if vmLib included */ + + /**************************************************************************/ + + FUNCPTR pVmPageMapRtn; /* pointer to vmPageMap if vmLib included */ + FUNCPTR pVmPhysTranslateRtn;/* ptr vmPhysTranslate if vmLib included */ + FUNCPTR pVmCtxCreateRtn; /* pointer to vmCtxCreate if vmLib included */ + FUNCPTR pVmCtxDeleteRtn; /* pointer to vmCtxDelete if vmLib included */ + FUNCPTR pVmBufferWriteRtn; /* ptr to vmBufferWrite routine if vmLib incl */ + + FUNCPTR pVmPageOptimizeRtn; /* ptr to vmPageOptimize rtn if vmBaseLib incl*/ + FUNCPTR pVmPageLockRtn; /* ptr to vmPageLock rtn if vmBaseLib incl */ + FUNCPTR pVmPageUnlockRtn; /* ptr to vmPageUnlock rtn if vmBaseLib incl */ + FUNCPTR pVmMaxPhysBitsGetRtn; /* ptr to vmMaxPhysBitsGet rtn if vmBaseLib + incl */ + + FUNCPTR pVmPageUnMapRtn; /* pointer to vmUnMap if vmLib included */ + FUNCPTR pVmBlockSizeGetRtn; /* ptr to vmPageSizeGet if vmLib included */ + FUNCPTR pVmTransTblGetRtn; /* ptr vmTranslate if vmLib included */ + FUNCPTR pVmCtxUnionRtn; /* pointer to vmCtxUnion if vmLib included */ + FUNCPTR pVmCtxUnionInitRtn; /* pointer to vmUnionInit if vmLib included */ + FUNCPTR pVmCtxMaskRtn; /* pointer to vmCtxMask if vmLib included */ + FUNCPTR pVmCtxSwitchRtn; /* pointer to vmCtxSwitch if vmLib included */ + + FUNCPTR pVmContigBlockEachRtn; /* pointer to vmContigBlockEach if */ + /* vmBaseLib included */ + } VM_LIB_INFO; + + +/* Macros used internally by the OS components. */ + +#define VM_CTX_MASK_OUT 0x0 +#define VM_CTX_MASK_IN 0x1 +#define VM_CTX_MASK_DELETE 0x2 +#define VM_CTX_MASK_L2_FREE 0x4 + +/* + * The following macros should always be used by optional kernel components + * that needs to call vmLib routines, instead of calling directly the vmLib + * routines. + * This in order to route properly the call to either the full implementation + * of virtual memory management support (INCLUDE_MMU_FULL, that is vmLib.c) or + * the basic implementation of virtual memory management support + * (INCLUDE_MMU_BASIC, that is vmBaseLib.c). + * Additionaly, a default behavior is provided if no virtual memory management + * support is included. + * Failure to do so for optional kernel components will break the scalability + * of the system in regards to virtual memory management support. + */ + +#define VM_INSTALLED (vmLibInfo.vmLibInstalled) + +#define VM_BASE_INSTALLED (vmLibInfo.vmBaseLibInstalled) + +#define VM_MMUSOFT_ENABLED (vmLibInfo.mmuSoftCfgEnabled) + +#define VM_STATE_SET(context, pVirtual, len, stateMask, state) \ + ((vmLibInfo.pVmStateSetRtn == NULL) ? \ + (ERROR) : \ + ((*vmLibInfo.pVmStateSetRtn) (context, pVirtual, len, stateMask, state))) + +#define VM_STATE_GET(context, pageAddr, pState) \ + ((vmLibInfo.pVmStateGetRtn == NULL) ? \ + (ERROR) : \ + ((*vmLibInfo.pVmStateGetRtn) (context, pageAddr, pState))) + +#define VM_ENABLE(enable) \ + ((vmLibInfo.pVmEnableRtn == NULL) ? \ + (ERROR) : \ + ((*vmLibInfo.pVmEnableRtn) (enable))) + +#define VM_PAGE_SIZE_GET() \ + ((vmLibInfo.pVmPageSizeGetRtn == NULL) ? \ + (ERROR) : \ + ((*vmLibInfo.pVmPageSizeGetRtn) ())) + +#define VM_TRANSLATE(context, virtualAddr, physicalAddr) \ + ((vmLibInfo.pVmTranslateRtn == NULL) ? \ + (ERROR) : \ + ((*vmLibInfo.pVmTranslateRtn) (context, virtualAddr, physicalAddr))) + +#define VM_TEXT_PROTECT(addr, protect) \ + ((vmLibInfo.pVmTextProtectRtn == NULL) ? \ + (ERROR) : \ + ((*vmLibInfo.pVmTextProtectRtn) (addr, protect))) + +#define VM_TEXT_PAGE_PROTECT(addr, protect) \ + VM_TEXT_PROTECT(addr, protect) + +#define VM_PAGE_MAP(context, virtAddr, physAddr, len) \ + ((vmLibInfo.pVmPageMapRtn == NULL) ? \ + (ERROR) : \ + ((*vmLibInfo.pVmPageMapRtn) (context, virtAddr, physAddr, len))) + +#define VM_PHYS_TRANSLATE(context, virtualAddr, physicalAddr) \ + ((vmLibInfo.pVmPhysTranslateRtn == NULL) ? \ + (ERROR) : \ + ((*vmLibInfo.pVmPhysTranslateRtn) (context, physicalAddr, virtualAddr))) + +/* + * VM_CONTEXT_BUFFER_WRITE() should be used only in very specific cases where + * the current context cannot be defined using VM_CURRENT_GET() and therefore + * the context to use must be passed to vmBufferWrite(). Nevertheless the + * context ID passed to VM_CONTEXT_BUFFER_WRITE() must correspond to the + * context in place. + */ + +#define VM_CONTEXT_BUFFER_WRITE(context, fromAddr, toAddr, nbBytes) \ + ((vmLibInfo.pVmBufferWriteRtn == NULL) ? \ + (memcpy(toAddr, fromAddr, nbBytes), OK) : \ + ((*vmLibInfo.pVmBufferWriteRtn) (context, fromAddr, toAddr, nbBytes))) + +#define VM_CONTEXT_CREATE() \ + ((vmLibInfo.pVmCtxCreateRtn == NULL) ? \ + (ERROR) : \ + ((*vmLibInfo.pVmCtxCreateRtn) ())) + +#define VM_CONTEXT_DELETE(context) \ + ((vmLibInfo.pVmCtxDeleteRtn == NULL) ? \ + (ERROR) : \ + ((*vmLibInfo.pVmCtxDeleteRtn) (context))) + +#define VM_PAGE_UNMAP(context, virtAddr, len) \ + ((vmLibInfo.pVmPageUnMapRtn == NULL) ? \ + (ERROR) : \ + ((*vmLibInfo.pVmPageUnMapRtn) (context, virtAddr, len))) + +#define VM_PAGE_BLOCK_SIZE_GET() \ + ((vmLibInfo.pVmBlockSizeGetRtn == NULL) ? \ + (ERROR) : \ + ((*vmLibInfo.pVmBlockSizeGetRtn) ())) + +#define VM_TRANS_TBL_GET(context) \ + ((vmLibInfo.pVmTransTblGetRtn == NULL) ? \ + (ERROR) : \ + ((*vmLibInfo.pVmTransTblGetRtn) (context))) + +#define VM_CONTEXT_UNION(context1, context2) \ + ((vmLibInfo.pVmCtxUnionRtn == NULL) ? \ + (ERROR) : \ + ((*vmLibInfo.pVmCtxUnionRtn) (context1, context2))) + +#define VM_CONTEXT_UNION_INIT(context, startAddr, len) \ + ((vmLibInfo.pVmCtxUnionInitRtn == NULL) ? \ + (ERROR) : \ + ((*vmLibInfo.pVmCtxUnionInitRtn) (context, startAddr, len))) + +#define VM_CONTEXT_MASK(context, startAddr, endAddr, options) \ + ((vmLibInfo.pVmCtxMaskRtn == NULL) ? \ + (ERROR) : \ + ((*vmLibInfo.pVmCtxMaskRtn) (context, startAddr, endAddr, options))) + +#define VM_CONTEXT_SWITCH(context, adrSpaceId) \ + ((vmLibInfo.pVmCtxSwitchRtn == NULL) ? \ + (OK) : \ + ((*vmLibInfo.pVmCtxSwitchRtn) (context, adrSpaceId))) + + +#define VM_PAGE_OPTIMIZE(context, virtAddr, len, option) \ + ((vmLibInfo.pVmPageOptimizeRtn == NULL) ? \ + (ERROR) : \ + ((*vmLibInfo.pVmPageOptimizeRtn) (context, virtAddr, len, option))) + +#define VM_PAGE_LOCK(context, virtAddr, len, option) \ + ((vmLibInfo.pVmPageLockRtn == NULL) ? \ + (ERROR) : \ + ((*vmLibInfo.pVmPageLockRtn) (context, virtAddr, len, option))) + +#define VM_PAGE_UNLOCK(context, virtAddr) \ + ((vmLibInfo.pVmPageUnlockRtn == NULL) ? \ + (ERROR) : \ + ((*vmLibInfo.pVmPageUnlockRtn) (context, virtAddr))) + +#define VM_MAX_PHYS_BITS_GET() \ + ((vmLibInfo.pVmMaxPhysBitsGetRtn == NULL) ? \ + (ERROR) : \ + ((*vmLibInfo.pVmMaxPhysBitsGetRtn) ())) + +#define VM_CONTIG_BLOCK_EACH(context, startAddr, numPages, \ + stateMask, eachRtn, eachArg) \ + ((vmLibInfo.pVmContigBlockEachRtn == NULL) ? \ + (ERROR) : \ + ((*vmLibInfo.pVmContigBlockEachRtn) (context, startAddr, numPages,\ + stateMask, eachRtn, eachArg))) + +IMPORT VM_LIB_INFO vmLibInfo; + +IMPORT CLASS_ID vmContextClassId; + +typedef struct vm_context + { + OBJ_CORE objCore; + MMU_TRANS_TBL_ID mmuTransTbl; + SEMAPHORE sem; + NODE links; + } VM_CONTEXT; + + +/* the following data structure in used internally in mmuLib to define + * the values for the architecture dependent states + */ + +typedef struct + { + UINT archIndepMask; + UINT archDepMask; + UINT archIndepState; + UINT archDepState; + } STATE_TRANS_TUPLE; + +/* + * Create prototypes for functions that accept PHYS_ADDR. This is required + * because PHYS_ADDR can be larger than "int". Some of these functions + * also accept an "MMU_TRANS_TBL *", but we don't have a complete type + * definition for that data type when this file is processed. So, we create + * an incomplete struct mmuTransTblStruct datatype, and use it for the + * typedef. Because of this, creators of the MMU_TRANS_TBL typedef now + * must ensure that that it has type 'struct mmuTransTblStruct'. + */ + +struct mmuTransTblStruct; + +typedef STATUS (*MMUPAGEMAPFUNCPTR)(struct mmuTransTblStruct *, + VIRT_ADDR, PHYS_ADDR, UINT, BOOL); +typedef STATUS (*MMUGLOBALPAGEMAPFUNCPTR)(VIRT_ADDR, PHYS_ADDR, UINT, BOOL); +typedef STATUS (*MMUTRANSLATEFUNCPTR)(struct mmuTransTblStruct *, + VIRT_ADDR, PHYS_ADDR *); +typedef STATUS (*MMUPHYSTRANSLATEFUNCPTR)(struct mmuTransTblStruct *, + PHYS_ADDR, VIRT_ADDR *); + +typedef struct + { + FUNCPTR mmuLibInit; + MMU_TRANS_TBL_ID (*mmuTransTblCreate) (); + FUNCPTR mmuTransTblDelete; + FUNCPTR mmuEnable; + FUNCPTR mmuStateSet; + FUNCPTR mmuStateGet; + MMUPAGEMAPFUNCPTR mmuPageMap; + MMUGLOBALPAGEMAPFUNCPTR mmuGlobalPageMap; + MMUTRANSLATEFUNCPTR mmuTranslate; + VOIDFUNCPTR mmuCurrentSet; + + UINT (*mmuPageSizeGet)(); + MMUPHYSTRANSLATEFUNCPTR mmuPhysTranslate; + FUNCPTR mmuAttrTranslate; + FUNCPTR mmuPageOptimize; + FUNCPTR mmuBufferWrite; + FUNCPTR mmuPageLock; + FUNCPTR mmuPageUnlock; + FUNCPTR mmuMaxPhysBitsGet; + + FUNCPTR mmuPageUnProtect; + FUNCPTR mmuPageUnMap; + UINT (*mmuBlockSizeGet)(); + UINT * (*mmuTransTblGet)(); + FUNCPTR mmuTransTblUnion; + FUNCPTR mmuTransTblUnionInit; + FUNCPTR mmuTransTblMask; + } MMU_LIB_FUNCS; + +/* + * On architectures that either will not allow page based mmu support on the + * entire virtual memory range, as in MIPS and SH, or where the virtual + * address range must be shared with the host, as in the case of the + * simulators, the address space allocator must know what ranges are + * allocatable and in what privilege mode. + */ + +typedef enum virt_seg_type + { + VIRT_SEG_TYPE_NO_MAP = 0x00000000, /* mapping not possible */ + VIRT_SEG_TYPE_K_MAP = 0x00000001, /* kernel mode only */ + VIRT_SEG_TYPE_U_MAP = 0x00000002, /* user mode only */ + VIRT_SEG_TYPE_KU_MAP = 0x00000004 /* kernel or user mode */ + } VIRT_SEG_TYPE; + +typedef struct virt_seg_info + { + VIRT_ADDR start; + UINT length; + VIRT_SEG_TYPE type; + } VIRT_SEG_INFO; + +typedef struct virt_extra_map_info + { + VIRT_ADDR virtAdr; + UINT len; + PHYS_ADDR physAdr; + } VIRT_EXTRA_MAP_INFO; + +typedef struct vm_info + { + BOOL noExecSupported; + BOOL optimSupported; + UINT mmuPageSize; + UINT ramDefaultAttr; + UINT cacheDefault; + UINT reserved1; + } VM_INFO; + +/* function declarations */ + +extern STATUS vmLibInit (); +extern STATUS vmCtxInit (VM_CONTEXT_ID pContext); +extern STATUS vmCtxTerminate (VM_CONTEXT_ID context); +extern STATUS vmCtxDestroy (VM_CONTEXT_ID context, BOOL dealloc); +extern STATUS vmInfoGet (VM_INFO * pVmInfo); +extern STATUS vmContigBlockEach (VM_CONTEXT_ID context, + VIRT_ADDR startAddr, UINT numPages, + UINT stateMask, FUNCPTR eachRtn, + UINT32 eachArg); +extern int vmPageBlockSizeGet (); +extern VM_CONTEXT_ID vmCurrentGet (); +extern STATUS vmCurrentSet (VM_CONTEXT_ID context); +extern void vmShowInit (void); +extern int vmMaxPhysBitsGet (void); +extern VM_CONTEXT_ID vmCtxCreate (); +extern STATUS vmCtxDelete (VM_CONTEXT_ID context); +extern STATUS vmCtxInit (VM_CONTEXT_ID context); +extern STATUS vmCtxUnion (VM_CONTEXT_ID vmCtx1, VM_CONTEXT_ID vmCtx2); +extern STATUS vmCtxUnionInit (VM_CONTEXT_ID vmCtx, \ + VIRT_ADDR startAddr, UINT length); +extern STATUS vmCtxMask (VM_CONTEXT_ID vmCtx, VIRT_ADDR virtStartAdr, + VIRT_ADDR virtEndAdr, UINT options); +extern VIRT_ADDR vmTransTblGet (VM_CONTEXT_ID context); +extern STATUS vmContextSwitch (VM_CONTEXT_ID context, + int adrsSpaceId); +extern STATUS vmPgUnMap (VM_CONTEXT_ID vmCtx, VIRT_ADDR virtAdr, + UINT numBytes); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvmLibPh */ diff --git a/h/private/vnodeAffLibP.h b/h/private/vnodeAffLibP.h new file mode 100644 index 0000000..fb5f5ce --- /dev/null +++ b/h/private/vnodeAffLibP.h @@ -0,0 +1,34 @@ +/* vnodeAffLibP.h - vnode/AFF interface private header */ + +/* + * Copyright 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* modification history +-------------------- +*/ + +#ifndef __INCvnodeAffLibP +#define __INCvnodeAffLibP + +#include "vxWorks.h" +#include "mount.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern int vnodeAffDriverNumber; +int vn_makefiletable(struct mount *, int); +void vn_deletefiletable(struct mount *); +STATUS vnodeAffLibInit(int); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvnodeAffLibP */ diff --git a/h/private/vxmIfLibP.h b/h/private/vxmIfLibP.h new file mode 100644 index 0000000..b8ab6e1 --- /dev/null +++ b/h/private/vxmIfLibP.h @@ -0,0 +1,145 @@ +/* vxmIfLibP.h - VxM interface library header file */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +--------------------- +01d,27feb93,jcf added new monitor features. +01c,22sep92,rrr added support for c++ +01b,23aug92,jcf added VXM_IF_OPS typedef and macros for vector functions. +01a,30mar92,del written. +*/ + +#ifndef __INCvxmIfLibPh +#define __INCvxmIfLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +typedef struct /* VXM_IF_OPS */ + { + FUNCPTR vxmTblGet; /* function to access all other funcs */ + FUNCPTR vxmIntVecSet; /* set an interrupt vector via VXM */ + FUNCPTR vxmIntVecGet; /* get an interrupt vector via VXM */ + FUNCPTR vxmBufRead; /* read a buffer from the host */ + FUNCPTR vxmBufWrite; /* write a buffer to the host */ + FUNCPTR vxmWrtBufFlush; /* flush any pending data to the host */ + FUNCPTR vxmHostQuery; /* query the host for data */ + FUNCPTR vxmClbkAdd; /* add a calback to the callback table */ + FUNCPTR vxmClbkState; /* set the state of a callback */ + FUNCPTR vxmClbkQuery; /* query the host for callbacks events */ + } VXM_IF_OPS; + +typedef struct /* VXM_IF_ANCHOR */ + { + UINT32 ifMagic; /* magic number */ + FUNCPTR ifGetFunc; /* func to access shared functions */ + } VXM_IF_ANCHOR; + + +enum VXM_IF_FUNCTIONS /* reserved interface function numbers */ + { + VXM_IF_BUF_WRT_FUNC = 0x01, /* data transfer functions */ + VXM_IF_WRTBUF_FLUSH_FUNC, + VXM_IF_BUF_RD_FUNC, + VXM_IF_QUERY_FUNC, + VXM_IF_INT_VEC_GET_FUNC, /* get interrupt vector function */ + VXM_IF_INT_VEC_SET_FUNC, /* set interrupt vector function */ + VXM_IF_FLT_VEC_SET_FUNC, /* set/get fault vector (i960 only) */ + VXM_IF_CALLBACK_ADD_FUNC, /* callback interface functions */ + VXM_IF_CALLBACK_STATE_FUNC, + VXM_IF_CALLBACK_QUERY_FUNC, + VXM_IF_ENTER_HOOK_SET_FUNC, /* mon. enter/exit hook set funcs */ + VXM_IF_EXIT_HOOK_SET_FUNC + }; + +enum VXM_IF_CALLBACKS /* callback function numbers */ + { + VXM_IF_CALLBACK_DBG, /* reserved: vxMon/uWorks dbg */ + VXM_IF_CALLBACK_1, + VXM_IF_CALLBACK_2, + VXM_IF_CALLBACK_3, + VXM_IF_CALLBACK_4, + VXM_IF_CALLBACK_5, + VXM_IF_CALLBACK_6, + VXM_IF_CALLBACK_7, + VXM_IF_CALLBACK_8, + VXM_IF_CALLBACK_9, + VXM_IF_CALLBACK_10 + }; + + +/* misc. interface defines */ + +#define VXM_IF_MAGIC 0xfeedface +#define VXM_IF_TBL_MAX_FUNCS 0x10 +#define VXM_IF_MAX_CALLBACKS 0x10 +#define VXM_IF_CALLBACK 0x7f000000 +#define VXM_IF_CALLBACK_ALL -1 +#define VXM_IF_CALLBACK_READY 0x01 +#define VXM_IF_QUERY 0x01 + + +/* monitor interface macros */ + +#define VXM_IF_VEC_SET(vec,func) \ + ((vxmIfOps.vxmIntVecSet == NULL) ? (ERROR) : \ + (* vxmIfOps.vxmIntVecSet) ((vec), (func))) + +#define VXM_IF_VEC_GET(vec) \ + ((vxmIfOps.vxmIntVecGet == NULL) ? ((FUNCPTR) NULL) : \ + ((FUNCPTR) (* vxmIfOps.vxmIntVecGet) (vec))) + +/* variable declarations */ + +extern VXM_IF_OPS vxmIfOps; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS vxmIfInit (VXM_IF_ANCHOR *pAnchor); +extern BOOL vxmIfInstalled (void); +extern STATUS vxmIfVecSet (FUNCPTR *vec, FUNCPTR func); +extern FUNCPTR vxmIfVecGet (FUNCPTR *vec); +extern int vxmIfHostRead (char * pDest); +extern void vxmIfHostWrite (char *pSrc, int len); +extern BOOL vxmIfHostQuery (void); +extern void vxmIfWrtBufFlush (void); +extern int vxmIfBufRead (char *pBuf, int nBytes); +extern int vxmIfBufWrite (char * pBuf, int nBytes); +extern STATUS vxmIfCallbackAdd (int funcNo, FUNCPTR func, UINT32 arg, + UINT32 maxargs, UINT32 state); +extern STATUS vxmIfCallbackExecute (int funcNo, int nArgs, ... ); +extern STATUS vxmIfCallbackReady (int funcNo); +extern STATUS vxmIfCallbackQuery (int funcNo); + +#else /* __STDC__ */ + +extern STATUS vxmIfInit (); +extern BOOL vxmIfInstalled (); +extern STATUS vxmIfVecSet (); +extern FUNCPTR vxmIfVecGet (); +extern int vxmIfHostRead (); +extern void vxmIfHostWrite (); +extern BOOL vxmIfHostQuery (); +extern void vxmIfWrtBufFlush (); +extern int vxmIfBufRead (); +extern int vxmIfBufWrite (); +extern STATUS vxmIfCallbackAdd (); +extern STATUS vxmIfCallbackExecute (); +extern STATUS vxmIfCallbackReady (); +extern STATUS vxmIfCallbackQuery (); +#endif /* __STDC__ */ + +#endif /*_ASMLANGUAGE*/ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvxmIfLibPh */ diff --git a/h/private/vxmIfLibP2.h b/h/private/vxmIfLibP2.h new file mode 100644 index 0000000..620ed7d --- /dev/null +++ b/h/private/vxmIfLibP2.h @@ -0,0 +1,172 @@ +/* vxmIfLib.h - VxM interface library header file */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +--------------------- +01g,27jul93,jcf added vxmTtyNum, vxmIntAckSet, and vxmIfBreakQuery. +01f,01apr93,del added support for abnormal exit. +01e,23mar93,del created from vxmIfLibP.h v01d. +*/ + +#ifndef __INCvxmIfLibPh +#define __INCvxmIfLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +typedef struct /* VXM_IF_OPS */ + { + FUNCPTR vxmTblGet; /* function to access all other funcs */ + FUNCPTR vxmIntVecSet; /* set an interrupt vector via VXM */ + FUNCPTR vxmIntVecGet; /* get an interrupt vector via VXM */ + FUNCPTR vxmBufRead; /* read a buffer from the host */ + FUNCPTR vxmBufWrite; /* write a buffer to the host */ + FUNCPTR vxmWrtBufFlush; /* flush any pending data to the host */ + FUNCPTR vxmHostQuery; /* query the host for data */ + FUNCPTR vxmClbkAdd; /* add a calback to the callback table */ + FUNCPTR vxmClbkReady; /* set the state of a callback */ + FUNCPTR vxmClbkQuery; /* query the host for callbacks events */ + FUNCPTR vxmEntHookSet; /* set a monitor enter hook */ + FUNCPTR vxmExitHookSet; /* set a monitor exit hook */ + FUNCPTR vxmIntLvlSet; /* set interrupt level when in monitor */ +#if CPU_FAMILY==I960 + FUNCPTR vxmFaultVecSet; /* set an i960 fault vector via VXM */ +#endif /* CPU_FAMILY==I960 */ + FUNCPTR vxmExitFunc; /* exit via the monitor */ + FUNCPTR vxmIntAckSet; /* update interrupt acknowledge table */ + FUNCPTR vxmTtyNum; /* get tty channel used by VxMon */ + FUNCPTR vxmBreakQuery; /* query host for ctrl-c interrupt support */ + } VXM_IF_OPS; + +typedef struct /* VXM_IF_ANCHOR */ + { + UINT32 ifMagic; /* magic number */ + FUNCPTR ifGetFunc; /* func to access shared functions */ + } VXM_IF_ANCHOR; + + + +enum VXM_IF_FUNCTIONS /* reserved interface function numbers */ + { + VXM_IF_BUF_WRT_FUNC = 0x01, /* data transfer functions */ + VXM_IF_WRTBUF_FLUSH_FUNC, + VXM_IF_BUF_RD_FUNC, + VXM_IF_QUERY_FUNC, + VXM_IF_INT_VEC_GET_FUNC, /* get interrupt vector function */ + VXM_IF_INT_VEC_SET_FUNC, /* set interrupt vector function */ + VXM_IF_FLT_VEC_SET_FUNC, /* set/get fault vector (i960 only) */ + VXM_IF_CALLBACK_ADD_FUNC, /* callback interface functions */ + VXM_IF_CALLBACK_STATE_FUNC, + VXM_IF_CALLBACK_QUERY_FUNC, + VXM_IF_ENTER_HOOK_SET_FUNC, /* mon. enter/exit hook set funcs */ + VXM_IF_EXIT_HOOK_SET_FUNC, + VXM_IF_INT_LVL_SET_FUNC, /* mon. int level set func. */ + VXM_IF_EXIT_FUNC, /* exit function */ + VXM_IF_INT_ACK_SET_FUNC, /* update interrupt acknowledge table */ + VXM_IF_TTY_NUM_FUNC, /* get tty channel used by VxMon */ + VXM_IF_BREAK_QUERY_FUNC /* query host for ctrl-c func */ + }; + +enum VXM_IF_CALLBACKS /* callback function numbers */ + { + VXM_IF_CALLBACK_DBG, /* reserved: vxMon/uWorks dbg */ + VXM_IF_CALLBACK_1, /* used if INCLUDE_VXM_TTY */ + VXM_IF_CALLBACK_2, + VXM_IF_CALLBACK_3, + VXM_IF_CALLBACK_4, + VXM_IF_CALLBACK_5, + VXM_IF_CALLBACK_6, + VXM_IF_CALLBACK_7, + VXM_IF_CALLBACK_8, + VXM_IF_CALLBACK_9, + VXM_IF_CALLBACK_10 + }; + + +/* misc. interface defines */ + +#define VXM_IF_MAGIC 0xfeedface +#define VXM_IF_TBL_MAX_FUNCS 0x18 +#define VXM_IF_MAX_CALLBACKS 0x10 +#define VXM_IF_CALLBACK 0x7f000000 +#define VXM_IF_CALLBACK_ALL -1 +#define VXM_IF_CALLBACK_READY 0x01 +#define VXM_IF_QUERY 0x01 + + +/* monitor interface macros */ + +#define VXM_IF_VEC_SET(vec,func) \ + ((vxmIfOps.vxmIntVecSet == NULL) ? (ERROR) : \ + (* vxmIfOps.vxmIntVecSet) ((vec), (func))) + +#define VXM_IF_VEC_GET(vec) \ + ((vxmIfOps.vxmIntVecGet == NULL) ? ((FUNCPTR) NULL) : \ + ((FUNCPTR) (* vxmIfOps.vxmIntVecGet) (vec))) + +/* variable declarations */ + +extern VXM_IF_OPS vxmIfOps; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS vxmIfInit (VXM_IF_ANCHOR *pAnchor); +extern BOOL vxmIfInstalled (void); +extern STATUS vxmIfVecSet (FUNCPTR *vec, FUNCPTR func); +extern FUNCPTR vxmIfVecGet (FUNCPTR *vec); +extern int vxmIfHostRead (char * pDest); +extern void vxmIfHostWrite (char *pSrc, int len); +extern BOOL vxmIfHostQuery (void); +extern void vxmIfWrtBufFlush (void); +extern int vxmIfBufRead (char *pBuf, int nBytes); +extern int vxmIfBufWrite (char * pBuf, int nBytes); +extern STATUS vxmIfCallbackAdd (int funcNo, FUNCPTR func, UINT32 arg, + UINT32 maxargs, UINT32 state); +extern STATUS vxmIfCallbackExecute (int funcNo, int nArgs, ... ); +extern STATUS vxmIfCallbackReady (int funcNo); +extern STATUS vxmIfCallbackQuery (int funcNo); +extern FUNCPTR vxmIfEnterHookSet (FUNCPTR hookFunc, UINT32 hookArg); +extern FUNCPTR vxmIfExitHookSet (FUNCPTR hookFunc, UINT32 hookArg); +extern FUNCPTR vxmIfExit (UINT32 code); +extern STATUS vxmIfIntAckSet (UINT *ackTable); +extern int vxmIfTtyNum (); +extern STATUS vxmIfBreakQuery (FUNCPTR breakFunc); + +#else /* __STDC__ */ + +extern STATUS vxmIfInit (); +extern BOOL vxmIfInstalled (); +extern STATUS vxmIfVecSet (); +extern FUNCPTR vxmIfVecGet (); +extern int vxmIfHostRead (); +extern void vxmIfHostWrite (); +extern BOOL vxmIfHostQuery (); +extern void vxmIfWrtBufFlush (); +extern int vxmIfBufRead (); +extern int vxmIfBufWrite (); +extern STATUS vxmIfCallbackAdd (); +extern STATUS vxmIfCallbackExecute (); +extern STATUS vxmIfCallbackReady (); +extern STATUS vxmIfCallbackQuery (); +extern FUNCPTR vxmIfEnterHookSet (); +extern FUNCPTR vxmIfExitHookSet (); +extern FUNCPTR vxmIfExit (); +extern STATUS vxmIfIntAckSet (); +extern int vxmIfTtyNum (); +extern STATUS vxmIfBreakQuery (); +#endif /* __STDC__ */ + +#endif /*_ASMLANGUAGE*/ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvxmIfLibPh */ diff --git a/h/private/vxsimHostLibP.h b/h/private/vxsimHostLibP.h new file mode 100644 index 0000000..3d0103a --- /dev/null +++ b/h/private/vxsimHostLibP.h @@ -0,0 +1,122 @@ +/* vxsimHostLibP.h - private Host/VxSim interface header */ + +/* + * Copyright (c) 2004-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +01e,29jun05,jmp reworked vxsimHostModel() to no longer return a host side + address. +01d,29sep04,jmp added vxsimBootStrategyGet(). +01c,09sep04,jmp updated vxsimHostRename() prototype (SPR #97903). +01b,03may04,dbt Added vxsimHostIntLock() API. +01a,29may04,jeg written. +*/ + +#ifndef __INCvxsimHostLibPh +#define __INCvxsimHostLibPh + +extern STATUS vxsimHostClose (int fd); +extern STATUS vxsimHostPassfsDirRead (PASS_FILE_DESC * pPassFd, + char * pEntryName); +extern STATUS vxsimHostPassfsDelete (char * name); +extern int vxsimHostErrnoGet (void); +extern void vxsimHostExit (void); +extern STATUS vxsimHostPassfsClose (PASS_FILE_DESC * pPassFd); +extern STATUS vxsimHostPassfsStatGet (PASS_FILE_DESC * pPassFd, + void * pVolumeDesc, + struct statfs * pStatfs); +extern STATUS vxsimHostFtruncate (int fd, int length); +extern void vxsimHostIfInit (void * pHostInfo); +extern int vxsimHostIntLock (void); +extern void vxsimHostIntUnlock (void); +extern STATUS vxsimHostLseek (int fd, int offset, int whence); +extern STATUS vxsimHostPassfsMkdir (char *path); +extern STATUS vxsimHostPassfsOpen (char *name, int flags, int mode); +extern STATUS vxsimHostOpen (char *name, int flags, int mode); +extern void * vxsimHostOpendir (char *dirname); +extern void vxsimHostPowerDown (void); +extern void vxsimHostPrintf (const char * fmt, ...); +extern void vxsimHostProcNumSet (int simLinuxDef, int smMemSize); +extern STATUS vxsimHostRead (int fd, char *buf, int len); +extern STATUS vxsimHostRename (PASS_FILE_DESC * pPassFd, + char *newPath); +extern STATUS vxsimHostReboot (int startType); +extern STATUS vxsimHostPassfsRmdir (char *path); +extern STATUS vxsimHostPassfsFileStatGet (PASS_FILE_DESC * pPassFd, + void * pVolumeDesc, + struct stat * pStat); +extern STATUS vxsimHostTimerInit (int sysVirtualTimeDef, + int auxVirtualTimeDef); +extern void vxsimHostTimerDisable (int clk); +extern STATUS vxsimHostTimerTimestampEnable (int tsRollOverIntNum); +extern STATUS vxsimHostTimerTimestampDisable (void); +extern UINT32 vxsimHostTimerTimestampFreqGet (void); +extern UINT32 vxsimHostTimerTimestampGet (void); +extern STATUS vxsimHostPassfsUnlink (char *path); +extern int vxsimHostPassfsCreate (char * name, int flags); +extern STATUS vxsimHostPassfsTimeSet (PASS_FILE_DESC * pPassFd, + struct utimbuf * pTime); +extern STATUS vxsimHostWrite (int fd, char *buf, int len); +extern void vxsimHostDbg (char * format, ...); +extern STATUS vxsimHostCurrentPathGet (char * buf, int size); +extern char * vxsimHostModel (char * sysModelStr, + int sysModelStrMaxLen); +extern STATUS vxsimHostStat (char * path, struct stat * pStat); +extern UINT32 vxsimHostTimeGet (void); +extern STATUS vxsimHostBufInit (void * pBufPool, int numBufs, + int bufSize); +extern STATUS vxsimHostBufDelete (void * pBufPool); +extern STATUS vxsimHostSysNvRamGet (char * string, int strLen, int offset, + int nvRamSize); +extern STATUS vxsimHostSysNvRamSet (char * string, int strLen, int offset, + int nvRamSize); +extern void * vxsimHostShMemInit (void * smMemAddr, int smMemSize, + int * smLevel); +extern STATUS vxsimHostBusIntGen (int smLevel, int smBusInt); +extern STATUS vxsimMmuEnable (BOOL enable, + MMU_TRANS_TBL * pKernelTransTbl); +extern STATUS vxsimMmuL1DescUpdate (BOOL mapIt, UINT32 l1Index, + MMU_LEVEL_1_DESC * pL1Desc); +extern STATUS vxsimMmuL2DescUpdate (void * effectiveAddr, PTE * pPte, + PTE pteVal); +extern STATUS vxsimHostSimnetAttach (char * subnetName, char * ipAddr, + int netType, void ** ppNetCfg, + int * pIntId); +extern void vxsimHostSimnetDetach (void ** ppNetCfg); +extern void vxsimHostSimnetIntClear (int fd); +extern void vxsimHostSimnetIntEnable (void * pNetCfg, int intId, + BOOL enable); +extern int vxsimHostSimnetPhysAddrLenGet (void * ppNetCfg); +extern void vxsimHostSimnetPhysAddrGet (void * ppNetCfg, UINT8 * enetAddr, + int len); +extern STATUS vxsimHostSimnetPhysAddrSet (void * ppNetCfg, UINT8 * enetAddr, + int len); +extern void vxsimHostSimnetBrdAddrGet (void * ppNetCfg, UINT8 * enetAddr, + int len); +extern int vxsimHostSimnetPktReceive (void * ppNetCfg, SIMNET_PKT * pPkt); +extern SIMNET_PKT * vxsimHostSimnetPktGet (void * ppNetCfg, int len); +extern STATUS vxsimHostSimnetPktSend (void * ppNetCfg, SIMNET_PKT * pPkt); +extern STATUS vxsimHostSimnetPromiscModeSet (void * pNetCfg, BOOL promisc); +extern STATUS vxsimHostSimnetMCastModeSet (void * pNetCfg, BOOL mcast); +extern STATUS vxsimHostSimnetParamGet (void * pNetCfg, int param, + UCHAR * buf, int len); +extern STATUS vxsimHostSimnetParamSet (void * pNetCfg, int param, + UCHAR * buf, int len); + +extern STATUS vxsimHostNetAddIfGet (int index, char ** ppDevice, int * pUnit, + char ** ppDevStr, char ** ppIpAddr, + char ** ppIpMask); +extern void vxsimHostVirtualMemInfoGet (void ** pVxsimVirtMemBaseAddr, + UINT32 * pVxsimVirtMemSize); + +extern UINT32 vxsimBootStrategyGet (void); +#endif /* __INCvxsimHostLibPh */ diff --git a/h/private/wdLibP.h b/h/private/wdLibP.h new file mode 100644 index 0000000..7592475 --- /dev/null +++ b/h/private/wdLibP.h @@ -0,0 +1,69 @@ +/* wdLibP.h - private watchdog timer library header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,26aug03,tcr remove WindView InstClassId +01c,16jan94,c_s added extern declaration for wdInstClassId. +01b,22sep92,rrr added support for c++ +01a,04jul92,jcf created from v01h wdLib.h. +*/ + +#ifndef __INCwdLibPh +#define __INCwdLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "wdLib.h" +#include "classLib.h" +#include "qLib.h" +#include "private/objLibP.h" + +/* watchdog status values */ + +#define WDOG_OUT_OF_Q 0x0 /* valid watchdog not in tick queue */ +#define WDOG_IN_Q 0x1 /* valid watchdog in tick queue */ +#define WDOG_DEAD 0x2 /* terminated watchdog */ + +typedef struct wdog /* WDOG */ + { + OBJ_CORE objCore; /* object management */ + Q_NODE tickNode; /* multi-way queue node for tick queue */ + USHORT status; /* status of watchdog */ + USHORT deferStartCnt; /* number of wdStarts still in work queue */ + FUNCPTR wdRoutine; /* routine to call upon expiration */ + int wdParameter; /* arbitrary parameter to routine */ + } WDOG; + +/* variable definitions */ + +extern CLASS_ID wdClassId; /* watchdog class id */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS wdInit (WDOG *pWdog); +extern STATUS wdTerminate (WDOG_ID wdId); +extern STATUS wdDestroy (WDOG_ID wdId, BOOL dealloc); +extern void wdTick (void); + +#else /* __STDC__ */ + +extern STATUS wdInit (); +extern STATUS wdTerminate (); +extern STATUS wdDestroy (); +extern void wdTick (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdLibPh */ diff --git a/h/private/windLibP.h b/h/private/windLibP.h new file mode 100644 index 0000000..91c1bb8 --- /dev/null +++ b/h/private/windLibP.h @@ -0,0 +1,81 @@ +/* windLibP.h - VxWorks kernel header file */ + +/* + * Copyright (c) 1984-2003, 2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. +*/ + +/* +modification history +-------------------- +01g,14apr05,kk removed prototypes for tick64[SG]et, moved to tickLib.h +01f,04aug03,elg Add support for new task status: define + windStop()/windCont(). +01e,28may03,rec Power management, add windTickAnnounceN and windTickWaitGet +01d,22may02,jgn move vxTicks & vxAbsTicks here - SPR #70255 +01c,22sep92,rrr added support for c++ +01b,19jul92,pme added windReadyQPut() and windReadyQRemove(). + windPendQPut(), windDelete(), windPendQRemove() return STATUS. +01a,04jul92,jcf extracted from wind.h. +*/ + +#ifndef __INCwindLibPh +#define __INCwindLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "vwModNum.h" +#include "qLib.h" +#include "taskLib.h" +#include "semLib.h" +#include "private/wdLibP.h" + +/* variable declarations */ + +extern BOOL kernelState; /* mutex to enter kernel state */ +extern BOOL kernelIsIdle; /* boolean reflecting idle state */ + +extern ULONG vxTicks; /* relative time counter */ +extern UINT64 vxAbsTicks; /* absolute time counter */ + +/* function declarations */ + +extern void windSpawn (WIND_TCB *pTcb); +extern STATUS windDelete (WIND_TCB *pTcb); +extern void windSuspend (WIND_TCB *pTcb); +extern void windResume (WIND_TCB *pTcb); +extern void windStop (WIND_TCB * pTcb); +extern void windCont (WIND_TCB * pTcb); +extern void windPriNormalSet (WIND_TCB *pTcb, UINT priNormal); +extern void windPrioritySet (WIND_TCB *pTcb, UINT priority); +extern void windSemDelete (SEM_ID semId); +extern void windTickAnnounce (void); +extern void windTickAnnounceN (ULONG nTicks); +extern ULONG windTickWaitGet (void); +extern STATUS windDelay (int timeout); +extern STATUS windUndelay (WIND_TCB *pTcb); +extern STATUS windWdStart (WDOG *wdId, int timeout); +extern void windWdCancel (WDOG *wdId); +extern void windPendQGet (Q_HEAD *pQHead); +extern void windReadyQPut (WIND_TCB * pTcb); +extern void windReadyQRemove (Q_HEAD *pQHead, int timeout); +extern void windPendQFlush (Q_HEAD *pQHead); +extern STATUS windPendQPut (Q_HEAD *pQHead, int timeout); +extern STATUS windPendQRemove (WIND_TCB *pTcb); +extern void windPendQTerminate (Q_HEAD *pQHead); +extern STATUS windExit (); +extern void windIntStackSet (char *pBotStack); +extern void vxTaskEntry (); +extern void intEnt (); +extern void intExit (); +#ifdef __cplusplus +} +#endif + +#endif /* __INCwindLibPh */ diff --git a/h/private/windPwrLibP.h b/h/private/windPwrLibP.h new file mode 100644 index 0000000..829b078 --- /dev/null +++ b/h/private/windPwrLibP.h @@ -0,0 +1,48 @@ +/* windPwrLibP.h - VxWorks power library private header file */ + +/* Copyright 2002 - 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,01jul03,rec code review comments +01a,29apr02,rec Created +*/ + +#ifndef __INCwindPwrLibPh +#define __INCwindPwrLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "vwModNum.h" +#include "qLib.h" +#include "taskLib.h" +#include "semLib.h" +#include "private/wdLibP.h" + +/* variable declarations */ + +extern BOOL windPwrOffState; + +#if defined(__STDC__) || defined(__cplusplus) + +/* function declarations */ + +extern void windPwrDown (void); +extern void windPwrUp (void); + +#else + +extern void windPwrDown (); +extern void windPwrUp (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwindPwrLibPh */ diff --git a/h/private/workQLibP.h b/h/private/workQLibP.h new file mode 100644 index 0000000..20b5780 --- /dev/null +++ b/h/private/workQLibP.h @@ -0,0 +1,86 @@ +/* workQLibP.h - private kernel work queue header file */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03may04,cjj Mods for code inspection of version 01d. + Removed useless WORK_JOB_BASE. +01d,21apr04,cjj Mods for configurable workQ size +01c,18dec00,pes Correct compiler warnings +01b,22sep92,rrr added support for c++ +01a,04jul92,jcf extracted from v2i of wind.h. +*/ + +#ifndef __INCworkQLibPh +#define __INCworkQLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE +#include "vxWorks.h" +#include "vwModNum.h" + +/* typedefs */ + +typedef struct /* JOB */ + { + FUNCPTR function; /* 00: function to invoke */ + int arg1; /* 04: argument 1 */ + int arg2; /* 08: argument 2 */ + UINT isrTag; /* 12: tag of ISR that queued up work */ + } JOB; + +/* + * Having the workQ indices in a struct increases the chances of them + * being all in the same cache line hence improving kernel performance + * at a critical time. The bitmask member is always used whenever one + * or the other index is used so it is located between them to ensure + * it will at least be in the same cache line as one of them. + */ +typedef struct + { + volatile UINT16 read; /* workQ read index */ + UINT16 bitmask; /* workQ index bitmask */ + volatile UINT16 write; /* workQ write index */ + UINT16 unused; /* padding */ + } WORK_Q_IX; + +/* variable declarations */ + +extern WORK_Q_IX workQIx; /* workQ indices struct */ +extern JOB pJobPool[]; /* pool of memory for jobs */ +extern volatile BOOL workQIsEmpty; /* TRUE if work queue is empty */ +extern FUNCPTR workQPanicHook; /* undocumented hook for */ + /* testing/debugging */ + +/* function declarations */ + +extern void workQInit (UINT queueSize); +extern void workQDoWork (void); +extern void workQPanic (void); +extern void workQAdd0 (FUNCPTR func); +extern void workQAdd1 (FUNCPTR func, int arg1); +extern void workQAdd2 (FUNCPTR func, int arg1, int arg2); + +#else /* _ASMLANGUAGE */ + +#define JOB_FUNCPTR 0x0 /* routine to invoke */ +#define JOB_ARG1 0x4 /* argument 1 */ +#define JOB_ARG2 0x8 /* argument 2 */ +#define JOB_ISR_TAG 0xc /* tag of ISR that queued up work */ + +#define WORK_READ_IX 0x0 /* work queue read index */ +#define WORK_BITMASK 0x2 /* work queue index bitmask */ +#define WORK_WRITE_IX 0x4 /* work queue write index */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCworkQLibPh */ diff --git a/h/private/wtxexchp.h b/h/private/wtxexchp.h new file mode 100644 index 0000000..8a37d60 --- /dev/null +++ b/h/private/wtxexchp.h @@ -0,0 +1,52 @@ +/* wtxexchp.h - wtx message exchange private header file */ + +/* Copyright 1984-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,26feb97,bjl renamed 'private' field in struct _wtx_exchange to + 'private_data' for c++ compatibility +01a,15may95s_w written. +*/ + +#ifndef __INCwtxexchph +#define __INCwtxexchph 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#include "wtxexch.h" + +/* defines */ + +#define WTX_EXCHANGE_RETURN(handle, errCode, retVal) \ +do \ + { \ + handle->error = errCode; \ + return retVal; \ + } while (0) + +/* typedefs */ + +/* This type is private to the exchange protocol implementation */ +typedef struct _wtx_exchange + { + WTX_XID self; /* pointer to self for validation */ + void * transport; /* transport connection data */ + void * private_data; /* data private to implementation */ + UINT32 timeout; /* timeout for exchange service requests */ + WTX_ERROR_T error; /* last error code recorded */ + FUNCPTR xCreate; /* create connection function */ + FUNCPTR xDelete; /* delete connection function */ + FUNCPTR xExchange; /* exchange function */ + FUNCPTR xFree; /* free result function */ + FUNCPTR xControl; /* misc. control function */ + } _WTX_EXCHANGE; /* WTX exchange handle */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwtxexchph */ diff --git a/h/private/wtxp.h b/h/private/wtxp.h new file mode 100644 index 0000000..030bb8a --- /dev/null +++ b/h/private/wtxp.h @@ -0,0 +1,123 @@ +/* wtxp.h - wtx protocol private header file */ + +/* +modification history +-------------------- +01s,02oct01,c_c Added license check. +01r,07jun01,pch moved host-only part to end of _WTX struct +01q,22jun99,fle made wtx compile on target side +01p,27may99,fle added async notification on wtx handle basis SPR 67367 +01o,07jul98,pcn Added wtxObjModuleUndefSymAdd prototype. +01n,17may95,s_w update for use of exchange api. +01m,15may95,c_s added endian field to handle. +01l,04may95,s_w put in private parts of wtx.h and remove message/rpc code + which is now in wtxmsg.h and wtxrpc.h +01k,24mar95,p_m added WTX_MEM_ALIGN, WTX_MEM_REALLOC and WTX_MEM_ADD_TO_POOL. +01j,16mar95,p_m added WTX_VIO_FILE_LIST. +01i,10mar95,p_m added WTX_AGENT_MODE_SET. changed WTX_MEM_INFO_GET to 38. +01h,02mar95,p_m changed WTX_TS_MEM_MOVE rpc number to 35. +01g,27feb95,p_m added WTX_TS_MEM_MOVE. +01f,26feb95,jcf added WTX_TS_[UN]LOCK. removed WTX_OBJ_[UN]LOCK. +01e,23feb95,pad changed WTX_FIRST_ADDL_PROC_NUM to 301. +01d,21feb95,pad instated WTX_FIRST_ADDL_PROC_NUM. +01c,07feb95,p_m get rid of WTX_MEM_ZERO. +01b,26jan95,p_m added WTX_OBJ_LOCK, WTX_OBJ_UNLOCK and WTX_MEM_SET, + changed WTX_TS_KILL to WTX_OBJ_KILL. +01a,15jan95,p_m written. +*/ + +#ifndef __INCwtxph +#define __INCwtxph 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#include "wtx.h" +#include "wtxexch.h" +#ifdef HOST + #include "wtxAsync.h" +#endif + +#include "sllLib.h" /* singly linked lists library */ + +/* defines */ + +/* This macro registers an error and does a return with the supplied value */ +#define WTX_ERROR_RETURN(handle, errCode, retVal) \ +do \ + { \ + wtxErrDispatch (handle, errCode); \ + return retVal; \ + } while (0) + +/* + * This macro checks that a WTX API handle is valid and registers a + * WTX_ERR_API_INVALID_HANDLE error if it is not. + */ +#define WTX_CHECK_HANDLE(handle, retVal) \ +do \ + { \ + if (handle == 0 || (handle)->self != handle) \ + WTX_ERROR_RETURN (handle, WTX_ERR_API_INVALID_HANDLE, retVal); \ + } while (0) + +/* + * This macro checks that a WTX API handle is both valid and + * connected to a server. WTX_ERR_API_INVALID_HANDLE and + * WTX_ERR_API_NOT_CONNECTED errors can be raised + */ +#define WTX_CHECK_CONNECTED(handle, retVal) \ +do \ + { \ + WTX_CHECK_HANDLE (handle, retVal); \ + if ((handle)->server == NULL) \ + WTX_ERROR_RETURN (handle, WTX_ERR_API_NOT_CONNECTED, retVal); \ + } while (0) + + +/* typedefs */ + +typedef struct _wtx + { + HWTX self; /* pointer to self for validation */ + WTX_XID server; /* exchange for WTX server calls */ + WTX_XID registry; /* exchange for WTX registry calls */ + WTX_ERROR_T errCode; /* last error code */ + const char * errMsg; /* last error message (if available) */ + WTX_HANDLER_T errHandler; /* handler for errors */ + WTX_MSG_TOOL_ID msgToolId; /* tool id message for convenience */ + WTX_TOOL_DESC * pToolDesc; /* tool descriptor for this tool */ + WTX_TS_INFO * pTsInfo; /* most recent target server info */ + WTX_DESC * pServerDesc; /* message descriptor for server */ + WTX_DESC * pSelfDesc; /* message descriptor for us */ + void * pClientData; /* pointer to client data */ + SL_LIST * pWtxFreeList; /* list of WTX pointers allocated */ +#ifdef HOST + WTX_ASYNC_HANDLE asyncHandle; /* async. context handle */ + BOOL isLicensed; /* did this tool got a license ? */ +#endif + char * targetToolName; /* tool used to build target runtime */ + } _WTX; + +typedef struct _wtx_handler_t + { + WTX_HANDLER_FUNC pFunc; + void * pClientData; + WTX_HANDLER_T prev; + } _WTX_HANDLER_T; + +/* Functions declarations */ + +extern STATUS wtxObjModuleUndefSymAdd /* add undef sym to undef sym list */ + ( + HWTX hWtx, /* WTX API handle */ + char * symName, /* undefined symbol name */ + UINT32 symGroup /* undefined symbol group */ + ); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwtxph */ diff --git a/h/private/wvBufferP.h b/h/private/wvBufferP.h new file mode 100644 index 0000000..90433ca --- /dev/null +++ b/h/private/wvBufferP.h @@ -0,0 +1,60 @@ +/* wvBufferP.h - generic buffer definition for buffers used with windview */ + +/* Copyright 1997-2003 Wind River Systems, Inc. */ + + +/* +modification history +-------------------- +01f,13jul99,aeg changed OBJ_CORE to HANDLE in BUFFER_DESC. +01e,06may98,cth added nBytesRtn to BUFFER_DESC +01d,02feb98,nps Allow inclusion in (68k) assembler source. +01c,18dec97,cth renamed from buffer.h to wvBufferP.h, added flushRtn, comments +01b,21nov97,nps added objCore to the start of BUFFER_DESC. +01a,16nov97,cth written. +*/ + +/* +This file contains the definition of a structure that should make up the +core of any buffer id that can be passed to wvLib. Windview uses a +pointer to this type of structure as a buffer id and as a way of +accessing the buffer's routines. See wvLib for a detailed description +of how the BUFFER_DESC is used. +*/ + +#ifndef __INCwvbufferph +#define __INCwvbufferph + + +#ifdef __cplusplus +extern "C" { +#endif + +#include "private/semLibP.h" + + +/* typedefs */ + +#ifndef _ASMLANGUAGE + +typedef struct bufferDesc /* BUFFER_DESC */ + { + HANDLE handle; /* handle */ + INT32 (*readReserveRtn)();/* request zero-copy read of buffer */ + STATUS (*readCommitRtn)(); /* commit after zero-copy read of buffer */ + UINT8 * (*writeRtn)(); /* write (with reserve) to buffer */ + INT32 (*flushRtn)(); /* flush routine of buffer */ + INT32 (*nBytesRtn)(); /* number readable bytes in buffer */ + SEMAPHORE threshXSem; /* sem given by buf when thresh crossed */ + INT32 threshold; /* arbitrary size in bytes set by buffer */ + } BUFFER_DESC; + +typedef BUFFER_DESC *BUFFER_ID; + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwvbufferph*/ diff --git a/h/private/wvFileUploadPathLibP.h b/h/private/wvFileUploadPathLibP.h new file mode 100644 index 0000000..2216a32 --- /dev/null +++ b/h/private/wvFileUploadPathLibP.h @@ -0,0 +1,44 @@ +/* wvFileUploadPathLibP.h - file upload path header */ + +/* Copyright 1997 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,04sep03,tcr rename init function +01c,27jan98,cth added openFlags arg to create call, fileUpPathDefaultPerm +01b,18dec97,cth renamed to wvFileUploadPathLibP.h from wvFileUploadPathP.h, + added fileUploadPathLibInit prototype, updated include +01a,16nov97,cth written, taken from evtSockLibP.h +*/ + + +#ifndef __INCwvfileuploadpathlibph +#define __INCwvfileuploadpathlibph + +#ifdef __cplusplus +extern "C" { +#endif + +#include "private/wvUploadPathP.h" + + +/* variable declarations */ + +extern int fileUpPathDefaultPerm; + + +/* function declarations */ + +extern STATUS wvFileUploadPathLibInit (void); +extern UPLOAD_ID wvFileUploadPathCreate (char *fname, int openFlags); +extern void wvFileUploadPathClose (UPLOAD_ID upId); +extern int wvFileUploadPathWrite (UPLOAD_ID upId, char * pData, + size_t size); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwvfileuploadpathlibph*/ + diff --git a/h/private/wvHostLibP.h b/h/private/wvHostLibP.h new file mode 100644 index 0000000..8e5ffab --- /dev/null +++ b/h/private/wvHostLibP.h @@ -0,0 +1,46 @@ +/* wvHostLibP.h - host info library header */ + +/* Copyright 1997 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,29aug97,cth should have changed the initials on 01c +01c,21aug97,smb added include of bootLib.h +01b,04mar94,smb changed prototype for wvHostInfoInit (SPR #3089) +01a,10dec93,smb written. +*/ + +#ifndef __INCwvhostlibph +#define __INCwvhostlibph + +/* include bootLib.h just for BOOT_ADDR_LEN */ + +#include "bootLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define DEFAULT_PORT 6164 + +typedef struct hostInfo /* maintains host and port information */ + { + char ipAddress [BOOT_ADDR_LEN]; + ushort_t port; + } HOSTINFO; + +extern HOSTINFO * pHostInfo; + +#if defined(__STDC__) || defined(__cplusplus) + +#else /* __STDC__ */ + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwvhostlibph*/ + diff --git a/h/private/wvLibP.h b/h/private/wvLibP.h new file mode 100644 index 0000000..224f12e --- /dev/null +++ b/h/private/wvLibP.h @@ -0,0 +1,125 @@ +/* wvLibP.h - WindView lib private header */ + +/* Copyright 1997-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,12mar04,tcr postMortem features +01g,09oct03,tcr tidy up +01f,17jul03,tcr make hash table more generic +01e,20apr98,cth changed WV_LOG_HEADER def, reverted uploadTaskPriority to 01b +01d,17apr98,cth added type WV_LOG_HEADER, removed prototype of wvUpload +01c,15apr98,cth removed wvUploadTaskPriority, added wvUploadTaskPriorityCont + and wvUploadPathPriorityOnce +01b,18dec97,cth updated includes +01a,16nov97,cth created, derived from wvLib.h +*/ + +#ifndef __INCwvlibph +#define __INCwvlibph + +#include "wvLib.h" +#include "sllLib.h" + +#include "private/wvUploadPathP.h" +#include "private/wvBufferP.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/* globals */ + +extern int wvUploadTaskPriority; /* upload task priority */ +extern int wvUploadTaskStackSize; /* upload task stack size (bytes) */ +extern int wvUploadTaskOptions; /* upload task options */ + +/* defines */ + +#define WV_LOG_LIST_MAGIC 0x57764f6b + +/* types */ + +typedef struct wvHashNode + { + char * pEvent; /* event data */ + int eventSize; /* size of event data */ + int key; /* hash key */ + struct wvHashNode * next; /* next node */ + } WV_HASH_NODE; + + + + +typedef struct tnHashTable + { + int size; + WV_HASH_NODE ** tbl; /* *tbl[] */ + } WV_HASH_TBL; + +typedef struct wvIterKey + { + int index; + WV_HASH_NODE * pCur; + } WV_ITER_KEY; + + + +/* + * This struct is the root of the WindView logs on the target + */ + +typedef struct wvLogList + { + struct + { + SL_LIST wvLogListHead; /* List of wind View logs */ + PART_ID memPart; /* Partition logs are created in */ + int numLogs; /* Maximum number of logs in the list */ + UINT32 magic; /* Should be WV_LOG_LIST_MAGIC */ + } hdr; + UINT32 checksum; + } WV_LOG_LIST; + + +/* + * This struct describes a single WindView log. + */ + +typedef struct wvLog + { + SL_NODE node; /* list node */ + PART_ID memPart; /* mem partition log created in */ + BUFFER_ID pEvtBuffer; /* associated event buffer */ + char * pConfigEvent; /* config event, with log revision */ + int configEventSize; + WV_HASH_TBL * pHashTbl; /* hast table tasknames, rtp etc. */ + } WV_LOG; + + +typedef struct wvUploadTaskDescriptor + { + int uploadTaskId; /* task id of this upload task */ + SEMAPHORE uploadCompleteSem; /* given iff buffers are emptied */ + BOOL exitWhenEmpty; /* if true task exits when buf empty */ + UPLOAD_ID uploadPathId; /* id of the upload path to host */ + WV_LOG * pWvLog; /* id of the log to upload from */ + int status; /* indicate errors in up task */ + } WV_UPLOADTASK_DESC; + + +/* function declarations */ + +extern STATUS wvLogListValidate (WV_LOG_LIST * pLogList); + +extern STATUS wvObjNameBuffAdd (int key, short eventId, int nArgs, int arg1, + int arg2, int arg3, int arg4, int arg5, + int arg6, char * name ); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwvlibph*/ diff --git a/h/private/wvNetEventP.h b/h/private/wvNetEventP.h new file mode 100644 index 0000000..f2801dd --- /dev/null +++ b/h/private/wvNetEventP.h @@ -0,0 +1,564 @@ +/* wvNetEventP.h - header file for WindView networking event identifiers */ + +/* Copyright 1984 - 2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,15nov01,tcr fix WV_NET_DSTADDRIN_EVENT_3 macro +01a,12jan00,spm written +*/ + +#ifndef __INCwvNetEventPh +#define __INCwvNetEventPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Routines for selecting events based on IP addresses or port numbers. */ + +IMPORT FUNCPTR _func_wvNetAddressFilterTest; +IMPORT FUNCPTR _func_wvNetPortFilterTest; + +#define MIN_WVNET_EVENTID 20000 +#define MAX_WVNET_EVENTID 24999 + +#define WVNET_EVENT(id) (MIN_WVNET_EVENTID + id) + +#define WVNET_MASKSIZE 8 /* Allows 57 to 64 events per level. */ + +/* + * The WV_BLOCK_START macro prevents wasted cycles by determining if + * WindView is running and if the given class has been selected. It + * provides initial screening for reporting network events to WindView. + * The classId is either NET_CORE_EVENT or NET_AUX_EVENT. + */ + +#define WV_BLOCK_START(classId) \ + if (ACTION_IS_SET) \ + { \ + if (WV_EVTCLASS_IS_SET (classId | WV_ON)) \ + { +/* + * The WV_NET_EVENT_TEST macro evaluates to TRUE if the event is selected + * for inclusion in the WindView updates sent to the host. The event + * selection status is stored in a bitmap accessed by priority level. + * This macro is only valid within a test conditional after the + * WV_BLOCK_START macro verifies that the class is active. The eventLevel + * parameter has values determined by the constants defined below, and + * the offset indicates the ordinal number of the event for the given + * level (ranging from 0 upward). + */ + +#define WV_NET_EVENT_TEST(eventLevel, offset) \ + pWvNetEventMap [eventLevel - 1].bitmap [WVNET_MASKSIZE - 1 - (offset / 8)] & \ + (1 << (offset % 8)) + +/* + * The WV_BLOCK_END provides a footer for all code which reports network + * events to WindView. It closes the open scopes caused by WV_BLOCK_START. + * The classId parameter is not used, but is included for symmetry. + */ + +#define WV_BLOCK_END(classId) \ + } \ + } + +/* + * The WindView for networking marker events handles cases which do not + * involve data transfer. The transmission direction (i.e. - status) field + * in the event identifier is always 0. Up to four additional parameters + * may be sent to the host. + */ + +#define WV_NET_MARKER_0(classId, eventLevel, eventOffset, eventTag, eventValue) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 1, wvNetEventId, 0, 0, 0, 0); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_MARKER_1(classId, eventLevel, eventOffset, eventTag, eventValue, arg1) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 2, wvNetEventId, arg1, 0, 0, 0); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_MARKER_2(classId, eventLevel, eventOffset, eventTag, eventValue, arg1, arg2) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 3, wvNetEventId, arg1, arg2, 0, 0); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_MARKER_3(classId, eventLevel, eventOffset, eventTag, eventValue, arg1, arg2, arg3) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (wvNetLocalFilter << 8) | eventTag; \ +(* _func_evtLogOIntLock) (eventValue, 4, wvNetEventId, arg1, arg2, arg3, 0); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_MARKER_4(classId, eventLevel, eventOffset, eventTag, eventValue, arg1, arg2, arg3, arg4) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 5, wvNetEventId, arg1, arg2, arg3, arg4); \ + } \ + WV_BLOCK_END (classId) + + /* + * These marker events use the filter which tests for a particular + * source and destination port for outgoing packets. If the filter is + * enabled, the event is not reported to the host unless the ports match + * the registered values. + */ + +#define WV_NET_PORTOUT_MARKER_1(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventValue, arg1) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetPortFilterTest) (1, srcPort, dstPort)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 2, wvNetEventId, arg1, 0, 0, 0); \ + } \ + WV_BLOCK_END (classId) + + /* + * This marker event uses the filter which tests for a particular + * destination address for outgoing packets. If the filter is + * enabled, the event is not reported to the host unless the address + * matches the registered value. + */ + +#define WV_NET_DSTADDROUT_MARKER_1(classId, eventLevel, eventOffset, eventTag, dstAddr, eventValue, arg1) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (1, 1, 0, dstAddr)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 2, wvNetEventId, arg1, 0, 0, 0); \ + } \ + WV_BLOCK_END (classId) + + /* + * This marker event uses the filter which tests for a particular source + * and destination address for incoming packets. If the filter is enabled, + * the event is not reported to the host unless the addresses match both + * registered values. + */ + + +#define WV_NET_ADDROUT_MARKER_4(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventValue, arg1, arg2, arg3, arg4) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (0, 3, srcAddr, dstAddr)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 5, wvNetEventId, arg1, arg2, arg3, arg4); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_ADDRIN_MARKER_2(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventValue, arg1, arg2) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (0, 3, srcAddr, dstAddr)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 3, wvNetEventId, arg1, arg2, 0, 0); \ + } \ + WV_BLOCK_END (classId) + +/* + * The WindView for networking data transfer events store a transmission + * direction in the status field of the event identifier. Valid values are + * WV_NET_SEND and WV_NET_RECV. Up to four additional parameters may be sent + * to the host. + */ + +#define WV_NET_EVENT_0(classId, eventLevel, eventOffset, eventTag, eventValue, status) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (status << 10) \ + | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 1, wvNetEventId, 0, 0, 0, 0); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_EVENT_1(classId, eventLevel, eventOffset, eventTag, eventValue, status, arg1) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (status << 10) \ + | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 2, wvNetEventId, arg1, 0, 0, 0); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_EVENT_2(classId, eventLevel, eventOffset, eventTag, eventValue, status, arg1, arg2) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (status << 10) \ + | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 3, wvNetEventId, arg1, arg2, 0, 0); \ + } \ + WV_BLOCK_END (classId) + + /* + * These data transfer events use the filter which tests for a particular + * source and destination port for outgoing packets. If the filter is + * enabled, the event is not reported to the host unless the ports match + * the registered values. + */ + +#define WV_NET_PORTOUT_EVENT_1(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventValue, status, arg1) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetPortFilterTest) (1, srcPort, dstPort)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (status << 10) \ + | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 2, wvNetEventId, arg1, 0, 0, 0); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_PORTOUT_EVENT_2(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventValue, status, arg1, arg2) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetPortFilterTest) (1, srcPort, dstPort)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (status << 10) \ + | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 3, wvNetEventId, arg1, arg2, 0, 0); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_PORTOUT_EVENT_4(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventValue, status, arg1, arg2, arg3, arg4) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetPortFilterTest) (1, srcPort, dstPort)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (status << 10) \ + | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 5, wvNetEventId, arg1, arg2, arg3, arg4); \ + } \ + WV_BLOCK_END (classId) + + /* + * These data transfer events use the filter which tests for a particular + * source and destination port for incoming packets. If the filter is + * enabled, the event is not reported to the host unless the ports match + * the registered values. + */ + +#define WV_NET_PORTIN_EVENT_0(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventValue, status) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetPortFilterTest) (0, srcPort, dstPort)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (status << 10) \ + | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 1, wvNetEventId, 0, 0, 0, 0); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_PORTIN_EVENT_1(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventValue, status, arg1) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetPortFilterTest) (0, srcPort, dstPort)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (status << 10) \ + | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 2, wvNetEventId, arg1, 0, 0, 0); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_PORTIN_EVENT_2(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventValue, status, arg1, arg2) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetPortFilterTest) (0, srcPort, dstPort)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (status << 10) \ + | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 3, wvNetEventId, arg1, arg2, 0, 0); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_PORTIN_EVENT_3(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventValue, status, arg1, arg2, arg3) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetPortFilterTest) (0, srcPort, dstPort)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (status << 10) \ + | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 4, wvNetEventId, arg1, arg2, arg3, 0); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_PORTIN_EVENT_4(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventValue, status, arg1, arg2, arg3, arg4) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetPortFilterTest) (0, srcPort, dstPort)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (status << 10) \ + | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 5, wvNetEventId, arg1, arg2, arg3, arg4); \ + } \ + WV_BLOCK_END (classId) + + /* + * This data transfer event uses the filter which tests for a particular + * destination address for outgoing packets. If the filter is enabled, + * the event is not reported to the host unless the address matches the + * registered value. + */ + +#define WV_NET_DSTADDROUT_EVENT_1(classId, eventLevel, eventOffset, eventTag, dstAddr, eventValue, status, arg1) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (1, 1, 0, dstAddr)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (status << 10) \ + | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 2, wvNetEventId, arg1, 0, 0, 0); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_DSTADDROUT_EVENT_2(classId, eventLevel, eventOffset, eventTag, dstAddr, eventValue, status, arg1, arg2) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (1, 1, 0, dstAddr)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (status << 10) \ + | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 3, wvNetEventId, arg1, arg2, 0, 0); \ + } \ + WV_BLOCK_END (classId) + + /* + * This data transfer event uses the filter which tests for a particular + * destination address for incoming packets. If the filter is enabled, + * the event is not reported to the host unless the address matches the + * registered value. + */ + +#define WV_NET_DSTADDRIN_EVENT_1(classId, eventLevel, eventOffset, eventTag, dstAddr, eventValue, status, arg1) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (0, 1, 0, dstAddr)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (status << 10) \ + | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 2, wvNetEventId, arg1, 0, 0, 0); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_DSTADDRIN_EVENT_3(classId, eventLevel, eventOffset, eventTag, dstAddr, eventValue, status, arg1, arg2, arg3) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (0, 1, 0, dstAddr)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (status << 10) \ + | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 4, wvNetEventId, arg1, arg2, arg3, 0); \ + } \ + WV_BLOCK_END (classId) + + /* + * This data transfer event uses the filter which tests for a particular + * source and destination address for outgoing packets. If the filter is + * enabled, the event is not reported to the host unless the addresses + * match both registered values. + */ + +#define WV_NET_ADDROUT_EVENT_1(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventValue, status, arg1) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (1, 3, srcAddr, dstAddr)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (status << 10) \ + | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 2, wvNetEventId, arg1, 0, 0, 0); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_ADDROUT_EVENT_2(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventValue, status, arg1, arg2) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (1, 3, srcAddr, dstAddr)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (status << 10) \ + | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 3, wvNetEventId, arg1, arg2, 0, 0); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_ADDROUT_EVENT_3(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventValue, status, arg1, arg2, arg3) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (1, 3, srcAddr, dstAddr)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (status << 10) \ + | (wvNetLocalFilter << 8) | eventTag; \ + ( *_func_evtLogOIntLock) (eventValue, 4, wvNetEventId, arg1, arg2, arg3, 0); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_ADDROUT_EVENT_4(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventValue, status, arg1, arg2, arg3, arg4) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (1, 3, srcAddr, dstAddr)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (status << 10) \ + | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 5, wvNetEventId, arg1, arg2, arg3, arg4); \ + } \ + WV_BLOCK_END (classId) + + /* + * This data transfer event uses the filter which tests for a particular + * source and destination address for incoming packets. If the filter is + * enabled, the event is not reported to the host unless the addresses + * match both registered values. + */ + +#define WV_NET_ADDRIN_EVENT_0(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventValue, status) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (0, 3, srcAddr, dstAddr)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (status << 10) \ + | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 1, wvNetEventId, 0, 0, 0, 0); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_ADDRIN_EVENT_1(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventValue, status, arg1) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (0, 3, srcAddr, dstAddr)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (status << 10) \ + | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 2, wvNetEventId, arg1, 0, 0, 0); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_ADDRIN_EVENT_2(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventValue, status, arg1, arg2) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (0, 3, srcAddr, dstAddr)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (status << 10) \ + | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 3, wvNetEventId, arg1, arg2, 0, 0); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_ADDRIN_EVENT_3(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventValue, status, arg1, arg2, arg3) \ + WV_BLOCK_START (classId) \ + if (WV_NET_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (0, 3, srcAddr, dstAddr)) \ + { \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (status << 10) \ + | (wvNetLocalFilter << 8) | eventTag; \ + (* _func_evtLogOIntLock) (eventValue, 4, wvNetEventId, arg1, arg2, arg3, 0); \ + } \ + WV_BLOCK_END (classId) + +/* WindView events in if.c */ + +/* #define WV_NETEVENT_IFINIT_START WVNET_EVENT(0) +#define WV_NETEVENT_IFRESET_START WVNET_EVENT(1) +#define WV_NETEVENT_IFATTACH_START WVNET_EVENT(2) +#define WV_NETEVENT_IFDETTACH_START WVNET_EVENT(3) +#define WV_NETEVENT_IFDOWN_START WVNET_EVENT(4) +#define WV_NETEVENT_IFUP_START WVNET_EVENT(5) +#define WV_NETEVENT_IFPROMISC_START WVNET_EVENT(6) + +#define WV_NETEVENT_IFWATCHDOG WVNET_EVENT(7) +#define WV_NETEVENT_IFIOCTL_START WVNET_EVENT(8) +#define WV_NETEVENT_LINKRTREQ_FAIL WVNET_EVENT(9) +#define WV_NETEVENT_IFIOCTL_FAIL1 WVNET_EVENT(10) +#define WV_NETEVENT_IFIOCTL_FAIL2 WVNET_EVENT(11) +#define WV_NETEVENT_IFPROMISC_FAIL WVNET_EVENT(12) +#define WV_NETEVENT_IFAFREE_PANIC WVNET_EVENT(13) + +/@ WindView events in if_ether.c @/ + +#define WV_NETEVENT_ARPRTREQ_FAIL WVNET_EVENT(14) +#define WV_NETEVENT_ARPREQ_FAIL WVNET_EVENT(15) +#define WV_NETEVENT_ARPLOOK_FAIL WVNET_EVENT(16) +#define WV_NETEVENT_ARPINTR_FAIL WVNET_EVENT(17) +#define WV_NETEVENT_ARPFREE_FAIL WVNET_EVENT(18) + +#define WV_NETEVENT_ARPIOCTL_UNREACH WVNET_EVENT(19) + +#define WV_NETEVENT_ARPIOCTL_NOTSUPP WVNET_EVENT(20) + +#define WV_NETEVENT_ARPRTREQ_BADGATE WVNET_EVENT(21) +#define WV_NETEVENT_ARPIN_BADADDR WVNET_EVENT(22) +#define WV_NETEVENT_ARPIN_BADADDR2 WVNET_EVENT(23) +#define WV_NETEVENT_ARPIN_BADADDR3 WVNET_EVENT(24) +#define WV_NETEVENT_ARPIOCTL_NOADDR WVNET_EVENT(25) + +#define WV_NETEVENT_ARPIN_RECV WVNET_EVENT(26) +#define WV_NETEVENT_ARPIN_SEND WVNET_EVENT(27) + +#define WV_NETEVENT_ARPTIMER_FREE WVNET_EVENT(28) +#define WV_NETEVENT_ARPIOCTL_START WVNET_EVENT(29) + +#define WV_NETEVENT_ARPRTREQ_START WVNET_EVENT(30) +#define WV_NETEVENT_ARPREQ_START WVNET_EVENT(31) +#define WV_NETEVENT_ARPRESOLV_START WVNET_EVENT(32) +#define WV_NETEVENT_ARPINTR_START WVNET_EVENT(33) */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwvNetEventPh */ diff --git a/h/private/wvSockUploadPathLibP.h b/h/private/wvSockUploadPathLibP.h new file mode 100644 index 0000000..70dbd70 --- /dev/null +++ b/h/private/wvSockUploadPathLibP.h @@ -0,0 +1,49 @@ +/* wvSockUploadPathLibP.h - socket upload path library header */ + +/* Copyright 1997 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,04sep03,tcr rename init function +01e,27jan98,cth removed sockUploadPathError prototypes, SOSENDBUFSIZE, added + sockUpPathSendBufSize +01d,18dec97,cth renamed again to wvSockUploadPathLibP.h from, updated include, + wvSockUploadPathP.h, added sockUploadPathLibInit prototype +01c,16nov97,cth renamed again from sockUploadPathP.h to wvSockUploadPathP.h +01b,16nov97,cth changed prototypes to match WV2.0 upload-path model + renamed from evtSockLibP.h to sockUploadPathP.h +01a,10dec93,smb written. +*/ + + +#ifndef __INCwvsockuploadpathlibph +#define __INCwvsockuploadpathlibph + +#ifdef __cplusplus +extern "C" { +#endif + +#include "private/wvUploadPathP.h" + + +/* variable declarations */ + +extern int sockUpPathSendBufSize; + + +/* function declarations */ + +extern STATUS wvSockUploadPathLibInit (void); +extern UPLOAD_ID wvSockUploadPathCreate (char *ipAddress, short port); +extern void wvSockUploadPathClose (UPLOAD_ID upId); +extern int wvSockUploadPathWrite (UPLOAD_ID upId, char * pData, + size_t size); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwvsockuploadpathlibph*/ + diff --git a/h/private/wvTsfsUploadPathLibP.h b/h/private/wvTsfsUploadPathLibP.h new file mode 100644 index 0000000..e07ef9c --- /dev/null +++ b/h/private/wvTsfsUploadPathLibP.h @@ -0,0 +1,42 @@ +/* wvTsfsUploadPathLibP.h - tsfs event-upload mechanism library header */ + +/* Copyright 1997 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,04sep03,tcr rename init function +01e,27jan98,cth removed tsfsUploadPathError prototypes, SOSENDBUFSIZE +01d,18dec97,cth renamed again to wvTsfsUploadPathLibP.h from, updated include, + wvTsfsUploadPathP.h, added tsfsUploadPathLibInit prototype +01c,16nov97,cth renamed again to wvTsfsUploadPathP.h from tsfsUploadPathP.h +01b,16nov97,cth changed prototypes to match new WV2.0 upload-path model + renamed to tsfsUploadPathP.h from evtTsfsSockLibP.h +01a,21aug97,cth created, modified from evtSockLibP.h +*/ + + +#ifndef __INCwvtsfsuploadpathlibph +#define __INCwvtsfsuploadpathlibph + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "private/wvUploadPathP.h" + + +extern STATUS wvTsfsUploadPathLibInit (void); +extern UPLOAD_ID wvTsfsUploadPathCreate (char *ipAddress, short port); +extern void wvTsfsUploadPathClose (UPLOAD_ID upId); +extern int wvTsfsUploadPathWrite (UPLOAD_ID upId, char * buffer, + size_t bufSize); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwvtsfsuploadpathlibph*/ + diff --git a/h/private/wvUploadPathP.h b/h/private/wvUploadPathP.h new file mode 100644 index 0000000..b6092d5 --- /dev/null +++ b/h/private/wvUploadPathP.h @@ -0,0 +1,42 @@ +/* wvUploadPathP.h - generic upload-path definition for windview */ + +/* Copyright 1997 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,18dec97,cth moved to private, renamed to wvUploadPathP.h, added comments +01a,16nov97,cth written. +*/ + +/* +This file contains the definition of a structure that should make up the +core of any upload-path id that can be passed to wvLib. Windview uses a +pointer to this type of structure to access the path's routines. +*/ + +#ifndef __INCwvuploadpathph +#define __INCwvuploadpathph + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* typedefs */ + +typedef struct uploadPathDesc /* UPLOAD_DESC */ + { + int (* writeRtn) (); /* write to the upload path */ + int (* errorRtn) (); /* signal upload path that an error occurred */ + } UPLOAD_DESC; + +typedef UPLOAD_DESC *UPLOAD_ID; + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwvuploadpathph*/ diff --git a/h/proxyArpLib.h b/h/proxyArpLib.h new file mode 100644 index 0000000..85d9b08 --- /dev/null +++ b/h/proxyArpLib.h @@ -0,0 +1,125 @@ +/* proxyArpLib.h - proxy ARP server include file */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,10oct01,rae merge from truestack +01f,07feb01,spm added merge record for 30jan01 update from version 01e of + tor2_0_x branch (base 01d) and fixed modification history +01e,30jan01,ijm merged SPR# 28602 fixes: proxy ARP services are obsolete +01d,22sep92,rrr added support for c++ +01c,04jul92,jcf cleaned up. +01b,26may92,rrr the tree shuffle + -changed includes to have absolute path from h/ +01a,20sep91,elh written. +*/ + +#ifndef __INCproxyArpLibh +#define __INCproxyArpLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vwModNum.h" +#include "lstLib.h" +#include "semLib.h" +#include "net/if.h" +#include "netinet/if_ether.h" +#include "netinet/in.h" +#include "hashLib.h" + +/* defines */ + +/* errors */ + +#define S_proxyArpLib_INVALID_PARAMETER (M_proxyArpLib | 1) +#define S_proxyArpLib_INVALID_INTERFACE (M_proxyArpLib | 2) +#define S_proxyArpLib_INVALID_PROXY_NET (M_proxyArpLib | 3) +#define S_proxyArpLib_INVALID_CLIENT (M_proxyArpLib | 4) +#define S_proxyArpLib_INVALID_ADDRESS (M_proxyArpLib | 5) +#define S_proxyArpLib_TIMEOUT (M_proxyArpLib | 6) + + /* proxy message types */ + +#define PROXY_PROBE 0 /* probe */ +#define PROXY_REG 1 /* register */ +#define PROXY_UNREG 2 /* unregister */ +#define PROXY_ACK 50 /* ack */ +#define PROXY_TYPE 0x3000 /* doesn't leave backplane */ + +#define XMIT_MAX 5 +#define XMIT_DELAY 5 + +/* typedefs */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct proxy_net /* proxy network structure */ + { + NODE netNode; /* node for net list */ + struct in_addr proxyAddr; /* proxy interface address */ + struct in_addr mainAddr; /* main interface address */ + LIST clientList; /* list of clients */ + } PROXY_NET; + +typedef struct proxy_clnt /* proxy client structure */ + { + HASH_NODE hashNode; /* hash node */ + struct in_addr ipaddr; /* client ip address (key) */ + u_char hwaddr [6]; /* client hw address */ + PROXY_NET * pNet; /* proxy network information */ + NODE clientNode; /* client node on network list */ + } PROXY_CLNT; + +typedef struct port_node + { + HASH_NODE hashNode; /* hash node */ + int port; /* port number enabled */ + } PORT_NODE; + +typedef struct proxy_msg /* proxy message */ + { + int op; /* operation */ + struct in_addr clientAddr; /* client address */ + struct in_addr serverAddr; /* server ip address */ + u_char clientHwAddr [6]; /* client hw address */ + u_char serverHwAddr [6]; /* server hw address */ + } PROXY_MSG; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS proxyArpLibInit (int clientSizeLog2, int portSizeLog2); +extern void proxyPortShow (void); +extern STATUS proxyPortFwdOn (int port); +extern STATUS proxyPortFwdOff (int port); +extern STATUS proxyNetCreate (char * proxyAddr, char * mainAddr); +extern STATUS proxyNetDelete (char * proxyAddr); + +#else /* __STDC__ */ + +extern STATUS proxyArpLibInit (); +extern void proxyPortShow (); +extern STATUS proxyPortFwdOn (); +extern STATUS proxyPortFwdOff (); +extern STATUS proxyNetCreate (); +extern STATUS proxyNetDelete (); + +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCproxyArpLibh */ diff --git a/h/proxyLib.h b/h/proxyLib.h new file mode 100644 index 0000000..622a89c --- /dev/null +++ b/h/proxyLib.h @@ -0,0 +1,38 @@ +/* proxyLib.h - include file for VxWorks Proxy Arp Client library */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,22sep92,rrr added support for c++ +01d,04jul92,jcf cleaned up. +01c,23jun92,elh renamed to proxyLib, changed parameters. +01b,26may92,rrr the tree shuffle +01a,20sep91,elh written. +*/ + +#ifndef __INCproxyLibh +#define __INCproxyLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS proxyReg (char *ifName, char *proxyAddr); +extern STATUS proxyUnreg (char *ifName, char *proxyAddr); + +#else /* __STDC__ */ + +extern STATUS proxyReg (); +extern STATUS proxyUnreg (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCproxyLibh */ diff --git a/h/pthread.h b/h/pthread.h new file mode 100644 index 0000000..2b7818b --- /dev/null +++ b/h/pthread.h @@ -0,0 +1,375 @@ +/* pthread.h - header for POSIX threads (pthreads) */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,27sep04,pad Added onceDone and onceMyTid fields to the pthread_once_t + type (SPR #98589). +01g,18jun04,pad Changed value of PTHREAD_CANCELED constant so as to avoid + confusion with VxWorks ERROR. +01f,04jun04,pad Added a threadAttrOptions field to the pthread_attr_t + structure so that task options can be set for threads (SPR + 92417). +01e,07may04,pad Re-instated the _POSIX_THREAD_PRIO_INHERIT and + _POSIX_THREAD_PRIO_PROTECT macros since they are part of the + POSIX standard. +01d,19mar04,pad Provided macro definitions to make all supported routine + prototypes visible (SPR 94829). Fixed PTHREAD_COND_INITIALIZER + macro (SPR 96603). +01c,22oct01,jgn add definition of PTHREAD_STACK_MIN (SPR #71110) +01b,11sep00,jgn split into kernel & user level parts (SPR #33375) +01a,17jul00,jgn created from DOT-4 version +*/ + +#ifndef __INCpthreadh +#define __INCpthreadh + +/* includes */ + +#include "vxWorks.h" +#include "semLib.h" +#include "signal.h" +#include "timers.h" +#include "sched.h" + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus */ + +/* + * The following set of macros ("Compile-Time Symbolic Constants") corresponds + * to the supported set of POSIX set features supported for kernel code. + * What's not listed below is not supported (namely + * _POSIX_THREAD_PROCESS_SHARED and _POSIX_THREAD_SAFE_FUNCTIONS). + */ + +#define _POSIX_THREADS 1 +#define _POSIX_THREAD_PRIORITY_SCHEDULING 1 +#define _POSIX_THREAD_PRIO_INHERIT 1 +#define _POSIX_THREAD_PRIO_PROTECT 1 +#define _POSIX_THREAD_ATTR_STACKSIZE 1 +#define _POSIX_THREAD_ATTR_STACKADDR 1 + +/* Other defines */ + +#ifdef _POSIX_THREAD_PROCESS_SHARED +#define PTHREAD_PROCESS_PRIVATE 0 +#define PTHREAD_PROCESS_SHARED 1 +#endif /* _POSIX_THREAD_PROCESS_SHARED */ + +#define PTHREAD_STACK_MIN 4096 /* suggested minimum */ + +#define PTHREAD_INHERIT_SCHED 0 /* implementation default */ +#define PTHREAD_EXPLICIT_SCHED 1 +#define PTHREAD_SCOPE_PROCESS 2 +#define PTHREAD_SCOPE_SYSTEM 3 /* implementation default */ + + +#define PTHREAD_ONCE_INIT {FALSE, FALSE, 0, NULL} + +#define PTHREAD_INITIALIZED 1 /* object can be used */ +#define PTHREAD_DESTROYED -1 /* object status */ +#define PTHREAD_MUTEX_INITIALIZER {NULL, TRUE, 0, 0, 0, 0, \ + {PTHREAD_INITIALIZED, PTHREAD_PRIO_INHERIT, 0}} +#define PTHREAD_COND_INITIALIZER {NULL, TRUE, 0, 0, 0, NULL} + +#define PTHREAD_CREATE_DETACHED 0 +#define PTHREAD_CREATE_JOINABLE 1 /*.4a and implementation default */ + +#define PTHREAD_CANCEL_ENABLE 0 +#define PTHREAD_CANCEL_DISABLE 1 + +#define PTHREAD_CANCEL_ASYNCHRONOUS 0 +#define PTHREAD_CANCEL_DEFERRED 1 + +#define PTHREAD_CANCELED ((void *)-2) + +#define _POSIX_THREAD_THREAD_MAX 0 /* unlimited, not checked */ +#define _POSIX_THREAD_KEYS_MAX 256 +#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 + +/* to make some function returns more readable + */ +#define _RETURN_PTHREAD_SUCCESS 0 + +#define SIGCANCEL SIGCNCL + +/* Internal definitions */ + +#define VALID 0x01 +#define STACK_PASSED_IN 0x02 +#define JOINABLE 0x04 +#define JOINER_WAITING 0x08 +#define TASK_EXITED 0x10 + +/* typedefs */ + +typedef unsigned long pthread_t; + +typedef struct { + int threadAttrStatus; /* status flag */ + size_t threadAttrStacksize; /* stack size */ + void * threadAttrStackaddr; /* stack address */ + int threadAttrDetachstate; /* detach state */ + int threadAttrContentionscope; /* contention scope */ + int threadAttrInheritsched; /* inherit scheduler */ + int threadAttrSchedpolicy; /* scheduling policy */ + char * threadAttrName; /* task name - VxWorks extension */ + int threadAttrOptions; /* task options - VxWorks extension */ + struct sched_param threadAttrSchedparam; + /* sched param struct */ + } pthread_attr_t; + + +typedef struct { + int condAttrStatus; /* status flag */ +#ifdef _POSIX_THREAD_PROCESS_SHARED + int condAttrPshared; /* process-shared attr */ +#endif /* _POSIX_THREAD_PROCESS_SHARED */ + } pthread_condattr_t; + + +typedef struct { + int mutexAttrStatus; /* status flag */ +#ifdef _POSIX_THREAD_PROCESS_SHARED + int mutexAttrPshared; /* process-shared attr */ +#endif /* _POSIX_THREAD_PROCESS_SHARED */ + int mutexAttrProtocol; /* inherit or protect */ + int mutexAttrPrioceiling; /* priority ceiling */ + /* (protect only) */ + } pthread_mutexattr_t; + + +/* values for mutexAttrProtocol */ + +#define PTHREAD_PRIO_NONE 0 +#define PTHREAD_PRIO_INHERIT 1 +#define PTHREAD_PRIO_PROTECT 2 + +typedef struct { + SEM_ID mutexSemId; + int mutexValid; + int mutexInitted; + int mutexIniting; + int mutexCondRefCount; + int mutexSavPriority; + pthread_mutexattr_t mutexAttr; + } pthread_mutex_t; + +typedef struct { + SEM_ID condSemId; + int condValid; + int condInitted; + int condIniting; + int condRefCount; + pthread_mutex_t *condMutex; +#ifdef _POSIX_THREAD_PROCESS_SHARED + pthread_condattr_t condAttr; +#endif /* _POSIX_THREAD_PROCESS_SHARED */ + } pthread_cond_t; + +typedef unsigned long pthread_key_t; + +typedef struct { + BOOL onceInitialized; /* TRUE if initialized once */ + BOOL onceDone; /* TRUE if init func returned */ + int onceMyTid; /* ID of task calling the init func */ + SEM_ID onceMutex; /* Vx sem associated with once ctrl */ + } pthread_once_t; + + +/* internal typedefs */ + +typedef struct cleanup + { + + struct cleanup *next; + void(*routine)(void *); + void *arg; + + } cleanupHandler; + +typedef struct + { + const void ** privateData; + int privateDataCount; + int taskId; + unsigned long flags; + SEM_ID exitJoinSemId; + SEM_ID mutexSemId; + SEM_ID cancelSemId; + int priority; + int cancelstate; + int canceltype; + int cancelrequest; + void * exitStatus; + cleanupHandler * handlerBase; + pthread_cond_t * cvcond; + } internalPthread; + +/* + * Section 3 Process Primitives + */ + +int pthread_sigmask(int how, const sigset_t *set, sigset_t *oset); +int pthread_kill(pthread_t thread, int sig); + +/* + * Section 11.3 Mutexes + */ + +int pthread_mutexattr_init(pthread_mutexattr_t *attr); +int pthread_mutexattr_destroy(pthread_mutexattr_t *attr); + +#ifdef _POSIX_THREAD_PROCESS_SHARED +int pthread_mutexattr_getpshared(const pthread_mutexattr_t *attr, int *pshared); +int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared); +#endif /* _POSIX_THREAD_PROCESS_SHARED */ + +int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr); +int pthread_mutex_destroy(pthread_mutex_t *mutex); + +int pthread_mutex_lock(pthread_mutex_t *mutex); +int pthread_mutex_trylock(pthread_mutex_t *mutex); +int pthread_mutex_unlock(pthread_mutex_t *mutex); + +/* + * Section 11.4 Condition variables + */ + +int pthread_condattr_init(pthread_condattr_t *attr); +int pthread_condattr_destroy(pthread_condattr_t *attr); + +#ifdef _POSIX_THREAD_PROCESS_SHARED +int pthread_condattr_getpshared(const pthread_condattr_t *attr, int *pshared); +int pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared); +#endif /* _POSIX_THREAD_PROCESS_SHARED */ + +int pthread_cond_init(pthread_cond_t *cond, pthread_condattr_t *attr); +int pthread_cond_destroy(pthread_cond_t *cond); + +int pthread_cond_signal(pthread_cond_t *cond); +int pthread_cond_broadcast(pthread_cond_t *cond); + +int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex); +int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, + const struct timespec *abstime); + +/* + * Section 13.5 Thread scheduling + */ + +int pthread_attr_setscope(pthread_attr_t *attr, int contentionscope); +int pthread_attr_getscope(const pthread_attr_t *attr, int *contentionscope); + +int pthread_attr_setinheritsched(pthread_attr_t *attr, int inheritsched); +int pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inheritsched); + +int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy); +int pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy); + +int pthread_attr_setschedparam(pthread_attr_t *attr, + const struct sched_param *param); +int pthread_attr_getschedparam(const pthread_attr_t *attr, + struct sched_param *param); + +int pthread_getschedparam(pthread_t thread, int *policy, + struct sched_param *param); +int pthread_setschedparam(pthread_t thread, int policy, + const struct sched_param *param); + +int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr, int protocol); +int pthread_mutexattr_getprotocol(pthread_mutexattr_t *attr, int *protocol); + +int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *attr, + int prioceiling); +int pthread_mutexattr_getprioceiling(pthread_mutexattr_t *attr, + int *prioceiling); + +int pthread_mutex_setprioceiling(pthread_mutex_t *attr, int prioceiling, + int *old_ceiling); +int pthread_mutex_getprioceiling(pthread_mutex_t *attr, int *prioceiling); + +/* + * Section 16 Thread management + */ + +int pthread_attr_init(pthread_attr_t *attr); +int pthread_attr_destroy(pthread_attr_t *attr); +int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize); +int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize); +int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr); +int pthread_attr_getstackaddr(const pthread_attr_t *attr, void **stackaddr); +int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate); +int pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate); + +int pthread_attr_setopt (pthread_attr_t * pAttr, int options); +int pthread_attr_getopt (pthread_attr_t * pAttr, int * pOptions); +int pthread_attr_setname (pthread_attr_t * pAttr, char * name); +int pthread_attr_getname (pthread_attr_t * pAttr, char ** name); + +void pthread_exit(void *value_ptr); + +int pthread_create (pthread_t *pThread, + const pthread_attr_t *pAttr, + void * (*start_routine)(void *), + void *arg); + +int pthread_join(pthread_t thread, void **status); + +int pthread_detach(pthread_t thread); + +pthread_t pthread_self(void); + +int pthread_equal(pthread_t t1, pthread_t t2); + +int pthread_once(pthread_once_t *once_control, void (*init_routine)(void)); + +/* + * Section 17 Thread-specific data + */ + +int pthread_key_create(pthread_key_t *key, void (*destructor)(void *)); + +int pthread_setspecific(pthread_key_t key, const void *value); +void *pthread_getspecific(pthread_key_t key); + +int pthread_key_delete(pthread_key_t key); + +/* + * Section 18 Thread cancellation + */ + +int pthread_cancel(pthread_t thread); +int pthread_setcancelstate(int state, int *oldstate); +int pthread_setcanceltype(int type, int *oldtype); +void pthread_testcancel(void); +void pthread_cleanup_push(void (*routine)(void *), void *arg); +void pthread_cleanup_pop(int execute); + +/* VxWorks support routines */ + +extern void pthreadLibInit(); + +/* Kernel support routine prototypes */ + +extern STATUS _pthreadLibInit(FUNCPTR deleteUserTaskEntry); + +extern int _pthreadCreate (pthread_t *pThread, + const pthread_attr_t *pAttr, + void * (*wrapperFunc)(void *), + void * (*start_routine)(void *), + void *arg, + int priNumMode); + +extern int _pthreadSetCancelType (int type, int * oldtype); + +extern int _pthreadSemOwnerGet (SEM_ID semId); + +#if defined(__cplusplus) +} +#endif /* __cplusplus */ + +#endif /* __INCpthreadh */ diff --git a/h/pthreadCommon.h b/h/pthreadCommon.h new file mode 100644 index 0000000..e5252e7 --- /dev/null +++ b/h/pthreadCommon.h @@ -0,0 +1,33 @@ +/* pthreadCommon.h - common header for user-side POSIX threads (pthreads) */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,09sep04,pad created. +*/ + +#ifndef __INCpthreadCommonh +#define __INCpthreadCommonh + +/* includes */ + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus */ + +/* + * The following set of macros ("Compile-Time Symbolic Constants") corresponds + * to the supported set of POSIX set features supported for applications that + * the kernel needs to know about. + */ + +#define PTHREAD_CANCEL_ASYNCHRONOUS 0 +#define PTHREAD_CANCEL_DEFERRED 1 + +#if defined(__cplusplus) +} +#endif /* __cplusplus */ + +#endif /* __INCpthreadCommonh */ diff --git a/h/ptrace.h b/h/ptrace.h new file mode 100644 index 0000000..5061746 --- /dev/null +++ b/h/ptrace.h @@ -0,0 +1,61 @@ +/* @(#)ptrace.h 1.1 86/07/07 SMI */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1985 by Sun Microsystems, Inc. + */ + +/* +modification history +-------------------- +01f,27jun96,dbt removed the coma after PTRACE_SETFPAREGS (spr 4357) + Updated copyright. +01e,22sep92,rrr added support for c++ +01d,04jul92,jcf cleaned up. +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -changed copyright notice +01a,05oct90,shl added copyright notice. +*/ + +#ifndef __INCptraceh +#define __INCptraceh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Request values for the ptrace system call + */ +enum ptracereq { + PTRACE_TRACEME = 0, /* 0, by tracee to begin tracing */ + PTRACE_CHILDDONE = 0, /* 0, tracee is done with his half */ + PTRACE_PEEKTEXT, /* 1, read word from text segment */ + PTRACE_PEEKDATA, /* 2, read word from data segment */ + PTRACE_PEEKUSER, /* 3, read word from user struct */ + PTRACE_POKETEXT, /* 4, write word into text segment */ + PTRACE_POKEDATA, /* 5, write word into data segment */ + PTRACE_POKEUSER, /* 6, write word into user struct */ + PTRACE_CONT, /* 7, continue process */ + PTRACE_KILL, /* 8, terminate process */ + PTRACE_SINGLESTEP, /* 9, single step process */ + PTRACE_ATTACH, /* 10, attach to an existing process */ + PTRACE_DETACH, /* 11, detach from a process */ + PTRACE_GETREGS, /* 12, get all registers */ + PTRACE_SETREGS, /* 13, set all registers */ + PTRACE_GETFPREGS, /* 14, get all floating point regs */ + PTRACE_SETFPREGS, /* 15, set all floating point regs */ + PTRACE_READDATA, /* 16, read data segment */ + PTRACE_WRITEDATA, /* 17, write data segment */ + PTRACE_READTEXT, /* 18, read text segment */ + PTRACE_WRITETEXT, /* 19, write text segment */ + PTRACE_GETFPAREGS, /* 20, get all fpa regs */ + PTRACE_SETFPAREGS /* 21, set all fpa regs */ +}; +#ifdef __cplusplus +} +#endif + +#endif /* __INCptraceh */ diff --git a/h/ptyDrv.h b/h/ptyDrv.h new file mode 100644 index 0000000..392ce08 --- /dev/null +++ b/h/ptyDrv.h @@ -0,0 +1,65 @@ +/* ptyDrv.h - header file for ptyDrv.c */ + +/* Copyright 1984 - 2001, 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01h,19apr05,hya added multi open support. +01g,02nov01,brk SPR65498 add SELECT functionality to master +01f,14feb01,spm merged from version 01f of tor2_0_x branch (base 01e): + added removal of pty device (SPR #28675) +01e,22sep92,rrr added support for c++ +01d,04jul92,jcf cleaned up. +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01a,05oct90,shl created. +*/ + +#ifndef __INCptyDrvh +#define __INCptyDrvh + +#include "tyLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS ptyDevCreate (char *name, int rdBufSize, int wrtBufSize); +extern STATUS ptyDevRemove (char *pName); +extern STATUS ptyDrv (void); + +#else /* __STDC__ */ + +extern STATUS ptyDevCreate (); +extern STATUS ptyDevRemove (); +extern STATUS ptyDrv (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +typedef struct /* PSEUDO_DEV */ + { + TY_DEV tyDev; + DEV_HDR slaveDev; + int slaveNumOpen; /* number of open paths to slave */ + SEMAPHORE masterReadSyncSem; + BOOL ateof; + SEL_WAKEUP_LIST masterSelWakeupList; + } PSEUDO_DEV; + +#endif /* __INCptyDrvh */ diff --git a/h/ptyLib.h b/h/ptyLib.h new file mode 100644 index 0000000..3d1b2df --- /dev/null +++ b/h/ptyLib.h @@ -0,0 +1,98 @@ +/* ptyLib.h - UNIX library for allocating pseudo-terminal devices */ + +/* Copyright 1992-2002 Wind River Systems, Inc. */ + +/* modification history +----------------------- +02b,08may02,dat cplusplus protection SPR 74987 +02a,14dec93,gae tweaked for the simulator. +01h,19aug93,c_s Added ptySetNonBlocking (); mod history corrected. +01g,18aug93,c_s Adjusted Ultrix port. +01f,17aug93,c_s Added ptySetCanonical (). +01e,02aug93,c_s Added #include of in the svr4 streams case. +01d,18sep92,c_s Ported to Ultrix. +01c,16sep92,c_s Ported to IRIX. Adjusted port to HP-UX. +01b,10sep92,maf conditionally include or based + on presence of HP-UX predefined macro "hpux." +01a,09jul92,c_s Adapted from PtyConnection.h (in C++). +*/ + +#ifndef INCptyLibh +#define INCptyLibh + +#if defined(hpux) || defined(__hpux) +#define _INCLUDE_XOPEN_SOURCE +#define _INCLUDE_HPUX_SOURCE +#define _INCLUDE_POSIX_SOURCE +#define _INCLUDE_AES_SOURCE +#endif + +#include +#include +#include +#include +#include +#include + +#if defined(hpux) || defined(__hpux) +#define hpux +#include +#include +#define TCSETS TCSETATTR +#define TCGETS TCGETATTR +#else +#if defined(ultrix) +#include +#include +#define TCSETS TCSETA +#define TCGETS TCGETA +#else +#if defined(sgi) +#include +#include +#define termios termio +#define TCSETS TCSETA +#define TCGETS TCGETA +#else +#if defined(_AIX) +#include +#include +#include +#else +#if defined(HAVE_STREAMS_TERMIO) +#include +#include +#include +#endif +#include +#include +#include +#endif +#endif +#endif +#endif + +#define PTY_MASTER 0 +#define PTY_SLAVE 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __STDC__ + +int ptyOpen (int fd[2], char name[2]); +int ptyBind (int fd[2], char *pgm); +int ptyBindToXterm (int fd[2], char name[2], char *title, int detachPgm); +#else +int ptyOpen (/* int fd[2], char name[2] */); +int ptyBind (/* int fd[2], char *pgm */); +int ptyBindToXterm (/* int fd[2], char name[2], char *title, int detachPgm */); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* INCptyLibh */ diff --git a/h/qClass.h b/h/qClass.h new file mode 100644 index 0000000..55e951a --- /dev/null +++ b/h/qClass.h @@ -0,0 +1,88 @@ +/* qClass.h - queue object class header */ + +/* + * Copyright (c) 1989-1993, 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +02d,29sep05,jln remove HIDDEN comment of Q_CLASS +02c,15oct93,cd added #ifndef _ASMLANGUAGE. +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01g,26may92,rrr the tree shuffle +01f,04oct91,rrr passed through the ansification filter + -changed copyright notice +01e,06apr91,gae added NOMANUAL to avoid fooling mangen. +01d,05oct90,shl added copyright notice. + made #endif ANSI style. +01c,05jul90,jcf added calibrate routine. +01b,26jun90,jcf remove qClass/qType definitions of multi-way queues + added Q_CLASS_ID. +01a,21oct89,jcf written. +*/ + +#ifndef __INCqClassh +#define __INCqClassh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifndef _ASMLANGUAGE + +typedef struct q_class /* Q_CLASS */ + { + FUNCPTR createRtn; /* create and initialize a queue */ + FUNCPTR initRtn; /* initialize a queue */ + FUNCPTR deleteRtn; /* delete and terminate a queue */ + FUNCPTR terminateRtn; /* terminate a queue */ + FUNCPTR putRtn; /* insert a node into q with insertion key */ + FUNCPTR getRtn; /* return and remove lead node routine */ + FUNCPTR removeRtn; /* remove routine */ + FUNCPTR resortRtn; /* resort node to new priority */ + FUNCPTR advanceRtn; /* advance queue by one tick routine */ + FUNCPTR getExpiredRtn; /* return and remove an expired Q_NODE */ + FUNCPTR keyRtn; /* return insertion key of node */ + FUNCPTR calibrateRtn; /* calibrate every node in queue by an offset */ + FUNCPTR infoRtn; /* return array of nodes in queue */ + FUNCPTR eachRtn; /* call a user routine for each node in queue */ + struct q_class *valid; /* valid == pointer to queue class */ + } Q_CLASS; + +typedef Q_CLASS *Q_CLASS_ID; /* Q_CLASS_ID */ + +/******************************************************************************* +* +* Q_CLASS_VERIFY - check the validity of an queue class pointer +* +* This macro verifies the existence of the specified queue class by comparing +* the queue classes valid field to the pointer to the queue class. +* +* RETURNS: OK or ERROR if invalid class pointer +* +* \NOMANUAL +*/ + +#define Q_CLASS_VERIFY(pQClass) \ + ( \ + (((Q_CLASS *)(pQClass))->valid == (Q_CLASS *) pQClass) ? \ + OK \ + : \ + ERROR \ + ) + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCqClassh */ diff --git a/h/qFifoGLib.h b/h/qFifoGLib.h new file mode 100644 index 0000000..7d4923d --- /dev/null +++ b/h/qFifoGLib.h @@ -0,0 +1,83 @@ +/* qFifoGLib.h - global fifo queue header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01c,22sep92,rrr added support for c++ +01b,30jul92,pme cleanup. +01a,19jul92,pme written. +*/ + +#ifndef __INCqFifoGLibh +#define __INCqFifoGLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "qClass.h" +#include "smDllLib.h" +#include "taskLib.h" + +/* fifo key defines */ + +#define FIFO_KEY_HEAD -1 /* put at head of queue */ +#define FIFO_KEY_TAIL 0 /* put at tail of q (any != -1) */ + +/* + * qFifoGRemove returns a particular status called ALREADY_REMOVED + * when the shared TCB has been removed on give side. + */ + +#define ALREADY_REMOVED 1 + +/* HIDDEN */ + +typedef SM_DL_NODE Q_FIFO_G_NODE; + +typedef struct q_fifo_g_head /* Q_FIFO_G_HEAD */ + { + UINT32 first; /* NOT USED! */ + UINT32 * pLock; /* NULL if already acquired */ + SM_DL_LIST * pFifoQ; /* shared memory pending queue */ + Q_CLASS * pQClass; /* pointer to class */ + } Q_FIFO_G_HEAD; + +extern Q_CLASS_ID qFifoGClassId; + +/* END HIDDEN */ + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern SM_DL_NODE * qFifoGEach (Q_FIFO_G_HEAD * pQFifoGHead, + FUNCPTR routine, int routineArg); +extern SM_DL_NODE * qFifoGGet (Q_FIFO_G_HEAD * pQFifoGHead); +extern STATUS qFifoGInit (Q_FIFO_G_HEAD * pQFifoGHead); +extern int qFifoGInfo (Q_FIFO_G_HEAD * pQFifoGHead, + int nodeArray[], int maxNodes); +extern void qFifoGPut (Q_FIFO_G_HEAD * pQFifoGHead, + SM_DL_NODE * pQFifoGNode, ULONG key); +extern STATUS qFifoGRemove (Q_FIFO_G_HEAD * pQFifoGHead, + SM_DL_NODE * pQFifoGNode); + +#else /* __STDC__ */ + +extern SM_DL_NODE * qFifoGEach (); +extern SM_DL_NODE * qFifoGGet (); +extern STATUS qFifoGInit (); +extern int qFifoGInfo (); +extern void qFifoGPut (); +extern STATUS qFifoGRemove (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCqFifoGLibh */ diff --git a/h/qFifoLib.h b/h/qFifoLib.h new file mode 100644 index 0000000..5d7591c --- /dev/null +++ b/h/qFifoLib.h @@ -0,0 +1,83 @@ +/* qFifoLib.h - fifo queue header file */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02d,30mar04,ans added attribute parameter to qFifoInit(). +02c,22sep92,rrr added support for c++ +02b,19jul92,pme made qFifoRemove return STATUS. +02a,04jul92,jcf cleaned up. +01e,26may92,rrr the tree shuffle +01d,04oct91,rrr passed through the ansification filter + -changed VOID to void + -changed copyright notice +01c,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01b,26jun90,jcf fixed FIFO_KEY definitions so priority 0 doesn't add at head. + removed definition of Q_CLASS. +01a,22oct89,jcf written. +*/ + +#ifndef __INCqFifoLibh +#define __INCqFifoLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "qClass.h" +#include "dllLib.h" + +/* fifo key defines */ + +#define FIFO_KEY_HEAD -1 /* put at head of queue */ +#define FIFO_KEY_TAIL 0 /* put at tail of q (any != -1) */ + + +/* HIDDEN */ + +typedef DL_LIST Q_FIFO_HEAD; /* Q_FIFO_HEAD */ + +typedef DL_NODE Q_FIFO_NODE; /* Q_FIFO_NODE */ + +/* END HIDDEN */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern Q_FIFO_HEAD * qFifoCreate (UINT attribute); +extern Q_FIFO_NODE * qFifoGet (Q_FIFO_HEAD *pQFifoHead); +extern STATUS qFifoDelete (Q_FIFO_HEAD *pQFifoHead); +extern STATUS qFifoInit (Q_FIFO_HEAD *pQFifoHead, UINT attribute); +extern int qFifoInfo (Q_FIFO_HEAD *pQFifoHead, int nodeArray [], + int maxNodes); +extern void qFifoPut (Q_FIFO_HEAD *pQFifoHead, + Q_FIFO_NODE *pQFifoNode, ULONG key); +extern STATUS qFifoRemove (Q_FIFO_HEAD *pQFifoHead, + Q_FIFO_NODE *pQFifoNode); +extern Q_FIFO_NODE * qFifoEach (Q_FIFO_HEAD *pQHead, FUNCPTR routine, int + routineArg); + +#else /* __STDC__ */ + +extern Q_FIFO_HEAD * qFifoCreate (); +extern Q_FIFO_NODE * qFifoEach (); +extern Q_FIFO_NODE * qFifoGet (); +extern STATUS qFifoDelete (); +extern STATUS qFifoInit (); +extern int qFifoInfo (); +extern void qFifoPut (); +extern STATUS qFifoRemove (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCqFifoLibh */ diff --git a/h/qJobLib.h b/h/qJobLib.h new file mode 100644 index 0000000..a573c8f --- /dev/null +++ b/h/qJobLib.h @@ -0,0 +1,111 @@ +/* qJobLib.h - job queue header file */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02d,02oct01,bwa added MSG_Q_ID msgQId to list of arguments of + qJobGet()(SPR #20195) +02c,10sep01,bwa Modified qJobPut() parameters +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01e,26may92,rrr the tree shuffle +01d,04oct91,rrr passed through the ansification filter + -changed VOID to void + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01c,16oct90,shl made #else ANSI style. +01b,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01a,01may90,dnw written. +*/ + +#ifndef __INCqJobLibh +#define __INCqJobLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "vxWorks.h" + +#ifndef _ASMLANGUAGE + +#include "qLib.h" +#include "msgQLib.h" + +/* qJobPut "priorities" */ + +#define Q_JOB_PRI_TAIL 0 /* add node to tail of queue */ +#define Q_JOB_PRI_HEAD 1 /* add node to head of queue */ +#define Q_JOB_PRI_DONT_CARE 1 /* head is a bit faster */ + + +/* HIDDEN */ + +typedef struct qJobNode /* Node of a job queue */ + { + struct qJobNode *next; + } Q_JOB_NODE; + +typedef struct /* Head of job queue */ + { + Q_JOB_NODE *first; /* first node in queue */ + Q_JOB_NODE *last; /* last node in queue */ + int count; /* number of nodes in queue */ + Q_CLASS *pQClass; /* must be 4th long word */ + Q_HEAD pendQ; /* queue of blocked tasks */ + } Q_JOB_HEAD; + +/* END HIDDEN */ + + +IMPORT Q_CLASS_ID qJobClassId; /* job queue class */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern Q_JOB_HEAD * qJobCreate (Q_CLASS_ID pendQType); +extern Q_JOB_NODE * qJobGet (MSG_Q_ID msgQId, Q_JOB_HEAD *pQHead, + int timeout); +extern STATUS qJobDelete (Q_JOB_HEAD *pQHead); +extern STATUS qJobInit (Q_JOB_HEAD *pQHead, Q_CLASS_ID pendQType); +extern STATUS qJobTerminate (Q_JOB_HEAD *pQHead); +extern int qJobInfo (Q_JOB_HEAD *pQHead, int nodeArray [], + int maxNodes); +extern STATUS qJobPut (MSG_Q_ID msgQId, Q_JOB_HEAD *pQHead, + Q_JOB_NODE *pNode, int key); +extern Q_JOB_NODE * qJobEach (Q_JOB_HEAD *pQHead, FUNCPTR routine, + int routineArg); + +#else /* __STDC__ */ + +extern Q_JOB_HEAD * qJobCreate (); +extern Q_JOB_NODE * qJobEach (); +extern Q_JOB_NODE * qJobGet (); +extern STATUS qJobDelete (); +extern STATUS qJobInit (); +extern STATUS qJobTerminate (); +extern int qJobInfo (); +extern STATUS qJobPut (); + +#endif /* __STDC__ */ + +#else /* _ASMLANGUAGE */ + +#define _QHEAD +#define _QTAIL (4) +#define _QCOUNT (8) +#define _QPENDQ (16) + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCqJobLibh */ diff --git a/h/qLib.h b/h/qLib.h new file mode 100644 index 0000000..76c585f --- /dev/null +++ b/h/qLib.h @@ -0,0 +1,391 @@ +/* qLib.h - multi-way queue library header */ + +/* + * Copyright (c) 1989-1993, 2004-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +02j,29sep05,jln remove HIDDEN comments of Q_NODE and Q_HEAD +02i,30may05,jln Added qPxPriBMapClassId +02h,10mar05,yvp Moved MAX_ARGS defn from qLib.c. Added qNullRtn prototype. +02g,25may04,dbt Fixed Q_ADVANCEN to make sure key will never be less than 0 +02f,30mar04,ans added 'attribute' semantics to Q_HEAD +02e,25mar04,hya added Q_ADVANCEN definition. +02d,15oct93,cd added #ifndef _ASMLANGUAGE. +02c,22sep92,rrr added support for c++ +02b,19jul92,pme made qRemove return STATUS. +02a,04jul92,jcf cleaned up. +01i,26may92,rrr the tree shuffle +01h,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01g,10jun91.del added pragma for gnu960 alignment. +01f,05apr91,gae added NOMANUAL to avoid fooling mangen. +01e,05oct90,shl added copyright notice. + made #endif ANSI style. +01d,02oct90,jcf removed nested comments. +01c,05jul90,jcf added Q_CALIBRATE. +01b,26jun90,jcf added definition of all queue class ids/types. + remove includes of all queue classes. + defined Q_NODE/Q_HEAD as independent structure. + added Q_RESORT(). +01a,21oct89,jcf written. +*/ + +#ifndef __INCqLibh +#define __INCqLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#define MAX_ARGS 10 /* number of variable arguments */ + +/* status codes */ + +#define S_qLib_Q_CLASS_ID_ERROR (M_qLib | 1) + +#ifndef _ASMLANGUAGE + +/* queue classes */ + +IMPORT Q_CLASS_ID qFifoClassId; +IMPORT Q_CLASS_ID qPriListClassId; +IMPORT Q_CLASS_ID qPriListFromTailClassId; +IMPORT Q_CLASS_ID qPriDeltaClassId; +IMPORT Q_CLASS_ID qPriHeapClassId; +IMPORT Q_CLASS_ID qPriBMapClassId; +IMPORT Q_CLASS_ID qPxPriBMapClassId; + +/* queue types */ + +#define Q_FIFO qFifoClassId +#define Q_PRI_LIST qPriListClassId +#define Q_PRI_LIST_FROM_TAIL qPriListFromTailClassId +#define Q_PRI_DELTA qPriDeltaClassId +#define Q_PRI_HEAP qPriHeapClassId +#define Q_PRI_BMAP qPriBMapClassId +#define Q_PX_PRI_BMAP qPxPriBMapClassId + +/* All queue class nodes must not exceed the sizeof (Q_NODE). If larger data + * structures must be used, use one of the private fields as pointer to provide + * a level on indirection so the size of Q_NODE is not exceeded. + */ + +typedef struct /* Q_NODE */ + { + UINT qPriv1; /* use is queue type dependent */ + UINT qPriv2; /* use is queue type dependent */ + UINT qPriv3; /* use is queue type dependent */ + UINT qPriv4; /* use is queue type dependent */ + } Q_NODE; + + +/* All queue classes must not exceed the sizeof (Q_HEAD). If larger data + * structures must be used, use one of the private fields as pointer to provide + * a level on indirection so the size of Q_HEAD is not exceeded. + * + * The first field in the Q_HEAD must contain the highest priority Q_NODE. + * The routine qFirst () makes this assumption. The scheduler does a qFirst + * on the ready queue as part of its scheduling. + */ + +typedef struct /* Q_HEAD */ + { + Q_NODE *pFirstNode; /* first node in queue based on key */ + UINT qPriv1; /* use is queue type dependent */ + UINT qPriv2; /* use is queue type dependent */ + Q_CLASS *pQClass; /* pointer to queue class */ + } Q_HEAD; + + +/* + * Queue can have attributes. The qPriv2 member of Q_HEAD represents the + * queue attribute. This imposes the restriction that only queue classes + * whose queue head are two words long can have attributes. + * The attributes supported are + * 1) Queue interruptibiliy + * QUEUE_INTERRUPTIBLE implies that the task pended on this queue can + * be made ready by a signal. QUEUE_NONINTERRUPTIBLE is the negate of + * QUEUE_INTERRUPTIBLE. By default, queue interrupt-ability attribute for + * a queue is QUEUE_NONINTERRUPTIBLE. + * + * Currently only Q_PRI_LIST , Q_FIFO_HEAD, Q_PRI_LIST_FROM_TAIL have + * the queue attribute support. + */ + +#define QUEUE_INTERRUPTIBLE 1 +#define QUEUE_NONINTERRUPTIBLE 0 +#define QUEUE_ATTRIBUTE_MASK 0x1 + +#define Q_ATTRIBUTE_GET(qHead) (((Q_HEAD *)(qHead))->qPriv2) +#define Q_ATTRIBUTE_SET(qHead, value) (((Q_HEAD *)(qHead))->qPriv2 = \ + (UINT)(value)) +#define IS_Q_ATTRIBUTE_OK(value) ((value) == QUEUE_INTERRUPTIBLE || \ + (value) == QUEUE_NONINTERRUPTIBLE) + + +/******************************************************************************* +* +* Q_FIRST - return first node in multi-way queue +* +* This routine returns a pointer to the first node in the specified multi-way +* queue head. If the queue is empty, NULL is returned. +* +* RETURNS +* Pointer to first queue node in queue head, or +* NULL if queue is empty. +* +* \NOMANUAL +*/ + +#define Q_FIRST(pQHead) \ + ((Q_NODE *)(((Q_HEAD *)(pQHead))->pFirstNode)) + +/******************************************************************************* +* +* Q_PUT - insert a node into a multi-way queue +* +* This routine inserts a node into a multi-way queue. The insertion is based +* on the key and the underlying queue class. +* +* \NOMANUAL +*/ + +#define Q_PUT(pQHead,pQNode,key) \ + (*(((Q_HEAD *)(pQHead))->pQClass->putRtn)) \ + (((Q_HEAD *)(pQHead)), ((Q_NODE *)(pQNode)), (key)) + +/******************************************************************************* +* +* Q_GET - remove and return first node in multi-way queue +* +* This routine removes and returns the first node in a multi-way queue. If +* the queue is empty, NULL is returned. +* +* RETURNS +* Pointer to first queue node in queue head, or +* NULL if queue is empty. +* +* \NOMANUAL +*/ + +#define Q_GET(pQHead) \ + ((Q_NODE *)((*(((Q_HEAD *)(pQHead))->pQClass->getRtn)) \ + ((Q_HEAD *)(pQHead)))) + +/******************************************************************************* +* +* Q_REMOVE - remove a node from a multi-way queue +* +* This routine removes a node from the specified multi-way queue. +* +* \NOMANUAL +*/ + +#define Q_REMOVE(pQHead,pQNode) \ + (*(((Q_HEAD *)(pQHead))->pQClass->removeRtn)) \ + (((Q_HEAD *)(pQHead)), ((Q_NODE *)(pQNode))) + +/******************************************************************************* +* +* Q_RESORT - resort a node to a new position based on a new key +* +* This routine resorts a node to a new position based on a new key. It can +* be used to change the priority of a queued element, for instance. +* +* \NOMANUAL +*/ + +#define Q_RESORT(pQHead,pQNode,newKey) \ + (*(((Q_HEAD *)(pQHead))->pQClass->resortRtn)) \ + (((Q_HEAD *)(pQHead)), ((Q_NODE *)(pQNode)), ((ULONG)(newKey))) + +/******************************************************************************* +* +* Q_ADVANCE - advance a queues concept of time (timer queues only) +* +* Multi-way queues that keep nodes prioritized by time-to-fire utilize this +* routine to advance time. It is usually called from within a clock-tick +* interrupt service routine. +* +* \NOMANUAL +*/ + +#define Q_ADVANCE(pQHead) \ + (*(((Q_HEAD *)(pQHead))->pQClass->advanceRtn)) \ + (((Q_HEAD *)(pQHead))) + +/******************************************************************************* +* +* Q_ADVANCEN - advance a queues concept of time by N tick (timer queues only) +* +* Time queues that keep nodes prioritized by time-to-fire utilize this +* routine to advance time by N tick after e.g., a power save sleep. +* +* \NOMANUAL +*/ + +#define Q_ADVANCEN(pQHead, n) \ + if (((Q_HEAD *)pQHead)->pQClass->valid == qPriDeltaClassId && \ + ((Q_HEAD *)pQHead)->pFirstNode != NULL) \ + { \ + if (n > ((Q_PRI_NODE *)((Q_HEAD *)pQHead)->pFirstNode)->key) \ + ((Q_PRI_NODE *)((Q_HEAD *)pQHead)->pFirstNode)->key = 0; \ + else \ + ((Q_PRI_NODE *)((Q_HEAD *)pQHead)->pFirstNode)->key -= n; \ + } + +/******************************************************************************* +* +* Q_GET_EXPIRED - return a time-to-fire expired node +* +* This routine returns a time-to-fire expired node in a multi-way timer queue. +* Expired nodes result from a qAdvance(2) advancing a node beyond its delay. +* As many nodes may expire on a single qAdvance(2), this routine should be +* called inside a while loop until NULL is returned. NULL is returned when +* there are no expired nodes. +* +* RETURNS +* Pointer to first queue node in queue head, or +* NULL if queue is empty. +* +* \NOMANUAL +*/ + +#define Q_GET_EXPIRED(pQHead) \ + ((Q_NODE *)((*(((Q_HEAD *)(pQHead))->pQClass->getExpiredRtn)) \ + ((Q_HEAD *)(pQHead)))) + +/******************************************************************************* +* +* Q_KEY - return the key of a node +* +* This routine returns the key of a node currently in a multi-way queue. The +* keyType determines key style on certain queue classes. +* +* RETURNS +* Node's key. +* +* \NOMANUAL +*/ + +#define Q_KEY(pQHead,pQNode,keyType) \ + (*(((Q_HEAD *)(pQHead))->pQClass->keyRtn)) \ + (((Q_NODE *)(pQNode)), ((int)(keyType))) + +/******************************************************************************* +* +* Q_CALIBRATE - offset every node in a queue by some delta +* +* This routine offsets every node in a multi-way queue by some delta. The +* offset may either by positive or negative. +* +* \NOMANUAL +*/ + +#define Q_CALIBRATE(pQHead,keyDelta) \ + (*(((Q_HEAD *)(pQHead))->pQClass->calibrateRtn)) \ + (((Q_HEAD *)(pQHead)), ((int)(keyDelta))) + +/******************************************************************************* +* +* Q_INFO - gather information on a multi-way queue +* +* This routine fills up to maxNodes elements of a nodeArray with nodes +* currently in a multi-way queue. The actual number of nodes copied to the +* array is returned. If the nodeArray is NULL, then the number of nodes in +* the multi-way queue is returned. +* +* RETURNS +* Number of node pointers copied into the nodeArray, or +* Number of nodes in multi-way queue if nodeArray is NULL +* +* \NOMANUAL +*/ + +#define Q_INFO(pQHead,nodeArray,maxNodes) \ + (*(((Q_HEAD *)(pQHead))->pQClass->infoRtn)) \ + (((Q_HEAD *)(pQHead)),((int *)(nodeArray)),((int)(maxNodes))) + +/******************************************************************************* +* +* Q_EACH - call a routine for each node in a queue +* +* This routine calls a user-supplied routine once for each node in the +* queue. The routine should be declared as follows: +* \cs +* BOOL routine (pQNode, arg) +* Q_NODE *pQNode; * pointer to a queue node * +* int arg; * arbitrary user-supplied argument * +* \ce +* The user-supplied routine should return TRUE if qEach (2) is to continue +* calling it for each entry, or FALSE if it is done and qEach can exit. +* +* RETURNS: NULL if traversed whole queue, or pointer to Q_NODE that +* qEach ended with. +* +* \NOMANUAL +*/ + +#define Q_EACH(pQHead,routine,routineArg) \ + ((Q_NODE *)((*(((Q_HEAD *)(pQHead))->pQClass->eachRtn)) \ + (((Q_HEAD *)(pQHead)),((FUNCPTR)(routine)),((int)(routineArg))))) + +#if defined(__STDC__) || defined(__cplusplus) + +extern Q_HEAD * qCreate (Q_CLASS *pQClass, ...); +extern Q_NODE * qEach (Q_HEAD *pQHead, FUNCPTR routine, int routineArg); +extern Q_NODE * qFirst (Q_HEAD *pQHead); +extern Q_NODE * qGet (Q_HEAD *pQHead); +extern Q_NODE * qGetExpired (Q_HEAD *pQHead); +extern STATUS qDelete (Q_HEAD *pQHead); +extern STATUS qInit (Q_HEAD *pQHead, Q_CLASS *pQClass, ...); +extern STATUS qTerminate (Q_HEAD *pQHead); +extern ULONG qKey (Q_HEAD *pQHead, Q_NODE *pQNode, int keyType); +extern int qInfo (Q_HEAD *pQHead, Q_NODE *nodeArray [ ], int maxNodes); +extern void qAdvance (Q_HEAD *pQHead); +extern void qCalibrate (Q_HEAD *pQHead, ULONG keyDelta); +extern void qPut (Q_HEAD *pQHead, Q_NODE *pQNode, ULONG key); +extern STATUS qRemove (Q_HEAD *pQHead, Q_NODE *pQNode); +extern void qResort (Q_HEAD *pQHead, Q_NODE *pQNode, ULONG newKey); +extern STATUS qNullRtn (void); + +#else /* __STDC__ */ + +extern Q_HEAD * qCreate (); +extern Q_NODE * qEach (); +extern Q_NODE * qFirst (); +extern Q_NODE * qGet (); +extern Q_NODE * qGetExpired (); +extern STATUS qDelete (); +extern STATUS qInit (); +extern STATUS qTerminate (); +extern ULONG qKey (); +extern int qInfo (); +extern void qAdvance (); +extern void qCalibrate (); +extern void qPut (); +extern STATUS qRemove (); +extern void qResort (); +extern STATUS qNullRtn (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCqLibh */ diff --git a/h/qPriBMapLib.h b/h/qPriBMapLib.h new file mode 100644 index 0000000..7275a20 --- /dev/null +++ b/h/qPriBMapLib.h @@ -0,0 +1,122 @@ +/* qPriBMapLib.h - bit mapped linked list library header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02m,22sep92,rrr added support for c++ +02l,28jul92,jcf removed arch dependence. added nPriorities. changed prototypes. +02k,19jul92,pme made qPriBMapRemove return STATUS. +02j,04jul92,jcf cleaned up. +02i,26may92,rrr the tree shuffle +02h,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed TINY and UTINY to INT8 and UINT8 + -changed VOID to void + -changed copyright notice +02g,20sep91,hdn changed a structure of BMAP_LIST of TRON. +02f,10sep91,wmd added CPU==MIPS to conditional for BMAP_LIST struct. +02e,27aug91,shl added CPU=MC68040 to conditional for BMAP_LIST struct. +02d,19jul91,hdn changed CPU==G200 to CPU_FAMILY==TRON +02c,10jun91,del added pragma for gnu960 alignment. +02b,10may91,wmd added CPU=G200 to conditional for BMAP_LIST struct. +02a,22jan91,jcf changed BMAP_LIST for portability to other architectures. +01e,05oct90,shl added copyright notice. + made #endif ANSI style. +01d,05oct90,shl added ANSI function prototypes. +01c,10jul90,jcf made priority key unsigned. +01b,26jun90,jcf remove queue class definition. +01a,22oct89,jcf written. +*/ + +#ifndef __INCqPriBMapLibh +#define __INCqPriBMapLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "qClass.h" +#include "vwModNum.h" +#include "qPriNode.h" +#include "dllLib.h" + + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* status codes */ + +#define S_qPriBMapLib_NULL_BMAP_LIST (M_qPriBMapLib | 1) + + +/* HIDDEN */ + +typedef struct /* BMAP_LIST */ + { + UINT32 metaBMap; /* lookup table for map */ + UINT8 bMap [32]; /* lookup table for listArray */ + DL_LIST listArray [256]; /* doubly linked list head */ + } BMAP_LIST; + +typedef struct /* Q_PRI_BMAP_HEAD */ + { + Q_PRI_NODE *highNode; /* highest priority node */ + BMAP_LIST *pBMapList; /* pointer to mapped list */ + UINT nPriority; /* priorities in queue (1,256) */ + } Q_PRI_BMAP_HEAD; + +/* END_HIDDEN */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern BMAP_LIST * qPriBMapListCreate (UINT maxPriority); +extern Q_PRI_BMAP_HEAD *qPriBMapCreate (BMAP_LIST *pBMapList, UINT maxPriority); +extern STATUS qPriBMapInit (Q_PRI_BMAP_HEAD *pQPriBMapHead, + BMAP_LIST *pBMapList, UINT maxPriority); +extern STATUS qPriBMapDelete (Q_PRI_BMAP_HEAD *pQPriBMapHead); +extern Q_PRI_NODE * qPriBMapEach (Q_PRI_BMAP_HEAD *pQHead, FUNCPTR routine, + int routineArg); +extern Q_PRI_NODE * qPriBMapGet (Q_PRI_BMAP_HEAD *pQPriBMapHead); +extern STATUS qPriBMapListDelete (BMAP_LIST *pBMapList); +extern ULONG qPriBMapKey (Q_PRI_NODE *pQPriNode); +extern int qPriBMapInfo (Q_PRI_BMAP_HEAD *pQPriBMapHead, + int nodeArray [], int maxNodes); +extern void qPriBMapPut (Q_PRI_BMAP_HEAD *pQPriBMapHead, + Q_PRI_NODE *pQPriNode, ULONG key); +extern STATUS qPriBMapRemove (Q_PRI_BMAP_HEAD *pQPriBMapHead, + Q_PRI_NODE *pQPriNode); +extern void qPriBMapResort (Q_PRI_BMAP_HEAD *pQPriBMapHead, + Q_PRI_NODE *pQPriNode, ULONG newKey); + +#else /* __STDC__ */ + +extern BMAP_LIST * qPriBMapListCreate (); +extern Q_PRI_BMAP_HEAD *qPriBMapCreate (); +extern Q_PRI_NODE * qPriBMapEach (); +extern Q_PRI_NODE * qPriBMapGet (); +extern STATUS qPriBMapDelete (); +extern STATUS qPriBMapInit (); +extern STATUS qPriBMapListDelete (); +extern ULONG qPriBMapKey (); +extern int qPriBMapInfo (); +extern void qPriBMapPut (); +extern STATUS qPriBMapRemove (); +extern void qPriBMapResort (); + +#endif /* __STDC__ */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCqPriBMapLibh */ diff --git a/h/qPriDeltaLib.h b/h/qPriDeltaLib.h new file mode 100644 index 0000000..e595255 --- /dev/null +++ b/h/qPriDeltaLib.h @@ -0,0 +1,81 @@ +/* qPriDeltaLib.h - priority linked list header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02c,22sep92,rrr added support for c++ +02b,19jul92,pme made qPriDeltaRemove return STATUS. +02a,04jul92,jcf cleaned up. +01f,26may92,rrr the tree shuffle +01e,04oct91,rrr passed through the ansification filter + -changed VOID to void + -changed copyright notice +01d,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01c,10jul90,jcf made priority key unsigned. +01b,26jun90,jcf removed queue class definition. +01a,22oct89,jcf written. +*/ + +#ifndef __INCqPriDeltaLibh +#define __INCqPriDeltaLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "qClass.h" +#include "qPriNode.h" +#include "dllLib.h" + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern Q_PRI_HEAD * qPriDeltaCreate (void); +extern Q_PRI_NODE * qPriDeltaEach (Q_PRI_HEAD *pQHead, FUNCPTR routine, + int routineArg); +extern Q_PRI_NODE * qPriDeltaGet (Q_PRI_HEAD *pQPriHead); +extern Q_PRI_NODE * qPriDeltaGetExpired (Q_PRI_HEAD *pQPriHead); +extern STATUS qPriDeltaDelete (Q_PRI_HEAD *pQPriHead); +extern STATUS qPriDeltaInit (Q_PRI_HEAD *pQPriHead); +extern STATUS qPriDeltaTerminate (Q_PRI_HEAD *pQPriHead); +extern ULONG qPriDeltaKey (Q_PRI_NODE *pQPriNode); +extern int qPriDeltaInfo (Q_PRI_HEAD *pQPriHead, int nodeArray [], + int maxNodes); +extern void qPriDeltaAdvance (Q_PRI_HEAD *pQPriHead); +extern void qPriDeltaPut (Q_PRI_HEAD *pQPriHead, + Q_PRI_NODE *pQPriNode, ULONG key); +extern STATUS qPriDeltaRemove (Q_PRI_HEAD *pQPriHead, + Q_PRI_NODE *pQPriNode); +extern void qPriDeltaResort (Q_PRI_HEAD *pQPriHead, + Q_PRI_NODE *pQPriNode, ULONG newKey); + +#else /* __STDC__ */ + +extern Q_PRI_HEAD * qPriDeltaCreate (); +extern Q_PRI_NODE * qPriDeltaEach (); +extern Q_PRI_NODE * qPriDeltaGet (); +extern Q_PRI_NODE * qPriDeltaGetExpired (); +extern STATUS qPriDeltaDelete (); +extern STATUS qPriDeltaInit (); +extern STATUS qPriDeltaTerminate (); +extern ULONG qPriDeltaKey (); +extern int qPriDeltaInfo (); +extern void qPriDeltaAdvance (); +extern void qPriDeltaPut (); +extern STATUS qPriDeltaRemove (); +extern void qPriDeltaResort (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCqPriDeltaLibh */ diff --git a/h/qPriHeapLib.h b/h/qPriHeapLib.h new file mode 100644 index 0000000..ec6be0a --- /dev/null +++ b/h/qPriHeapLib.h @@ -0,0 +1,117 @@ +/* qPriHeapLib.h - heap library header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02c,22sep92,rrr added support for c++ +02b,19jul92,pme made qPriHeapRemove return STATUS. +02a,04jul92,jcf cleaned up. +01f,26may92,rrr the tree shuffle +01e,04oct91,rrr passed through the ansification filter + -changed VOID to void + -changed copyright notice +01d,05oct90,shl added ANSI function prototypes. + added copyright notice. +01c,05jul90,jcf added qPriHeapCalibrate(). + make priority key unsigned. +01b,26jun90,jcf remove queue class definition. +01a,19oct89,jcf created. +*/ + +#ifndef __INCqPriHeapLibh +#define __INCqPriHeapLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "vwModNum.h" +#include "qClass.h" + +/* status codes */ + +#define S_qPriHeapLib_NULL_HEAP_ARRAY (M_qPriHeapLib | 1) + + +/* type definitions */ + +/* HIDDEN */ + +typedef struct /* Q_PRI_HEAP_NODE */ + { + ULONG key; /* heap key (0 is highest priority) */ + int index; /* current index into heap array */ + } Q_PRI_HEAP_NODE; + +typedef Q_PRI_HEAP_NODE *HEAP_ARRAY[]; + +typedef struct /* Q_PRI_HEAP_HEAD */ + { + Q_PRI_HEAP_NODE *pHighNode; /* highest priority node in heap */ + HEAP_ARRAY *pHeapArray; /* start of heap table */ + int heapIndex; /* index of next available heap slot */ + } Q_PRI_HEAP_HEAD; + +/* END_HIDDEN */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern HEAP_ARRAY * qPriHeapArrayCreate (int heapSize); +extern Q_PRI_HEAP_HEAD *qPriHeapCreate (HEAP_ARRAY *pHeapArray); +extern Q_PRI_HEAP_NODE *qPriHeapEach (Q_PRI_HEAP_HEAD *pQHead, FUNCPTR routine, + int routineArg); +extern Q_PRI_HEAP_NODE *qPriHeapGet (Q_PRI_HEAP_HEAD *pQPriHeapHead); +extern Q_PRI_HEAP_NODE *qPriHeapGetExpired (Q_PRI_HEAP_HEAD *pQPriHeapHead); +extern STATUS qPriHeapArrayDelete (HEAP_ARRAY *pHeapArray); +extern STATUS qPriHeapDelete (Q_PRI_HEAP_HEAD *pQPriHeapHead); +extern STATUS qPriHeapInit (Q_PRI_HEAP_HEAD *pQPriHeapHead, + HEAP_ARRAY *pHeapArray); +extern STATUS qPriHeapTerminate (Q_PRI_HEAP_HEAD *pQPriHeapHead); +extern ULONG qPriHeapKey (Q_PRI_HEAP_NODE *pQPriHeapNode, + int keyType); +extern int qPriHeapInfo (Q_PRI_HEAP_HEAD *pQPriHeapHead, + int nodeArray [], int maxNodes); +extern void qPriHeapAdvance (Q_PRI_HEAP_HEAD *pQPriHeapHead); +extern void qPriHeapCalibrate (Q_PRI_HEAP_HEAD *pQPriHeapHead, + ULONG keyDelta); +extern void qPriHeapPut (Q_PRI_HEAP_HEAD *pQPriHeapHead, + Q_PRI_HEAP_NODE *pQPriHeapNode, ULONG key); +extern STATUS qPriHeapRemove (Q_PRI_HEAP_HEAD *pQPriHeapHead, + Q_PRI_HEAP_NODE *pQPriHeapNode); +extern void qPriHeapResort (Q_PRI_HEAP_HEAD *pQPriHeapHead, + Q_PRI_HEAP_NODE *pQPriHeapNode, + ULONG newKey); +extern void qPriHeapShow (Q_PRI_HEAP_HEAD *pHeap, int format); + +#else /* __STDC__ */ + +extern HEAP_ARRAY * qPriHeapArrayCreate (); +extern Q_PRI_HEAP_HEAD *qPriHeapCreate (); +extern Q_PRI_HEAP_NODE *qPriHeapEach (); +extern Q_PRI_HEAP_NODE *qPriHeapGet (); +extern Q_PRI_HEAP_NODE *qPriHeapGetExpired (); +extern STATUS qPriHeapArrayDelete (); +extern STATUS qPriHeapDelete (); +extern STATUS qPriHeapInit (); +extern STATUS qPriHeapTerminate (); +extern ULONG qPriHeapKey (); +extern int qPriHeapInfo (); +extern void qPriHeapAdvance (); +extern void qPriHeapCalibrate (); +extern void qPriHeapPut (); +extern STATUS qPriHeapRemove (); +extern void qPriHeapResort (); +extern void qPriHeapShow (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCqPriHeapLibh */ diff --git a/h/qPriLTreeLib.h b/h/qPriLTreeLib.h new file mode 100644 index 0000000..0981a9a --- /dev/null +++ b/h/qPriLTreeLib.h @@ -0,0 +1,77 @@ +/* qPriLTreeLib.h - priority leftist tree queue library header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02c,22sep92,rrr added support for c++ +02b,19jul92,pme made qPriTreeRemove return STATUS. +02a,04jul92,jcf cleaned up. +01f,26may92,rrr the tree shuffle +01e,04oct91,rrr passed through the ansification filter + -changed VOID to void + -changed copyright notice +01d,05oct90,shl added ANSI function prototypes. + added copyright notice. +01c,10jul90,jcf made priority key unsigned. +01b,26jun90,jcf removed queue class definition. +01a,19oct89,jcf created. +*/ + +#ifndef __INCqPriLTreeLibh +#define __INCqPriLTreeLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "qClass.h" + +/* type definitions */ + +/* HIDDEN */ + +typedef struct qPriLTreeNode /* Q_PRI_L_TREE_NODE */ + { + struct qPriLTreeNode *left; /* pointer to left node in the tree */ + struct qPriLTreeNode *right; /* pointer to right node in the tree */ + int distance; /* shortest distance to leaf */ + ULONG key; /* insertion key */ + } Q_PRI_L_TREE_NODE; + +typedef struct /* Q_PRI_L_TREE_HEAD */ + { + Q_PRI_L_TREE_NODE *pRoot; /* points to root of leftist tree */ + int count; /* number of nodes in tree */ + } Q_PRI_L_TREE_HEAD; + +/* END_HIDDEN */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +#else + +extern Q_PRI_L_TREE_HEAD * qPriLTreeCreate (); +extern STATUS * qPriLTreeInit (); +extern STATUS qPriLTreeDelete (); +extern void qPriLTreePut (); +extern Q_PRI_L_TREE_NODE * qPriLTreeGet (); +extern STATUS qPriLTreeRemove (); +extern void qPriLTreeResort (); +extern void qPriLTreeAdvance (); +extern Q_PRI_L_TREE_NODE * qPriLTreeGetExpired (); +extern ULONG qPriLTreeKey (); +extern int qPriLTreeInfo (); +extern Q_PRI_L_TREE_NODE * qPriLTreeEach (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCqPriLTreeLibh */ diff --git a/h/qPriListLib.h b/h/qPriListLib.h new file mode 100644 index 0000000..0bd0394 --- /dev/null +++ b/h/qPriListLib.h @@ -0,0 +1,117 @@ +/* qPriListLib.h - priority linked list header file */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02d,30mar04,ans added attribute field to qPriListInit(). +02c,22sep92,rrr added support for c++ +02b,19jul92,pme made qPriListRemove return STATUS. +02a,04jul92,jcf cleaned up. +01f,26may92,rrr the tree shuffle +01e,04oct91,rrr passed through the ansification filter + -changed VOID to void + -changed copyright notice +01d,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01c,05jul90,jcf added qPriListCalibrate(). + made priority key unsigned. +01b,26jun90,jcf removed queue class definition. +01a,22oct89,jcf written. +*/ + +#ifndef __INCqPriListLibh +#define __INCqPriListLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "qClass.h" +#include "qPriNode.h" +#include "dllLib.h" + + +/******************************************************************************* +* +* qPriListFirst - find first node in list +* +* DESCRIPTION +* +* RETURNS +* Pointer to the first node in a list, or +* NULL if the list is empty. +*/ + +#define Q_PRI_LIST_FIRST(pList) \ + ( \ + (DLL_FIRST((Q_PRI_HEAD *)(pList))) \ + ) + +/******************************************************************************* +* +* qPriListEmpty - boolean function to check for empty list +* +* RETURNS: +* TRUE if list is empty +* FALSE otherwise +*/ + +#define Q_PRI_LIST_EMPTY(pList) \ + ( \ + (DLL_EMPTY((Q_PRI_HEAD *)(pList))) \ + ) + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern Q_PRI_HEAD *qPriListCreate (UINT attribute); +extern Q_PRI_NODE *qPriListEach (Q_PRI_HEAD *pQHead, FUNCPTR routine, + int routineArg); +extern Q_PRI_NODE *qPriListGet (Q_PRI_HEAD *pQPriHead); +extern Q_PRI_NODE *qPriListGetExpired (Q_PRI_HEAD *pQPriHead); +extern STATUS qPriListDelete (Q_PRI_HEAD *pQPriHead); +extern STATUS qPriListInit (Q_PRI_HEAD *pQPriHead, UINT attribute); +extern STATUS qPriListTerminate (Q_PRI_HEAD *pQPriHead); +extern ULONG qPriListKey (Q_PRI_NODE *pQPriNode, int keyType); +extern int qPriListInfo (Q_PRI_HEAD *pQPriHead, int nodeArray [], + int maxNodes); +extern void qPriListAdvance (Q_PRI_HEAD *pQPriHead); +extern void qPriListCalibrate (Q_PRI_HEAD *pQHead, ULONG keyDelta); +extern void qPriListPut (Q_PRI_HEAD *pQPriHead, Q_PRI_NODE *pQPriNode, + ULONG key); +extern void qPriListPutFromTail (Q_PRI_HEAD *pQPriHead, + Q_PRI_NODE *pQPriNode, ULONG key); +extern STATUS qPriListRemove (Q_PRI_HEAD *pQPriHead, Q_PRI_NODE *pQPriNode); +extern void qPriListResort (Q_PRI_HEAD *pQPriHead, Q_PRI_NODE *pQPriNode, + ULONG newKey); + +#else /* __STDC__ */ + +extern Q_PRI_HEAD *qPriListCreate (); +extern Q_PRI_NODE *qPriListEach (); +extern Q_PRI_NODE *qPriListGet (); +extern Q_PRI_NODE *qPriListGetExpired (); +extern STATUS qPriListDelete (); +extern STATUS qPriListInit (); +extern STATUS qPriListTerminate (); +extern ULONG qPriListKey (); +extern int qPriListInfo (); +extern void qPriListAdvance (); +extern void qPriListCalibrate (); +extern void qPriListPut (); +extern void qPriListPutFromTail (); +extern STATUS qPriListRemove (); +extern void qPriListResort (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCqPriListLibh */ diff --git a/h/qPriNode.h b/h/qPriNode.h new file mode 100644 index 0000000..8acb42a --- /dev/null +++ b/h/qPriNode.h @@ -0,0 +1,64 @@ +/* qPriNode.h - priority node header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01g,26may92,rrr the tree shuffle +01f,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01e,10jun91.del added pragma for gnu960 alignment. +01d,16oct90,shl made #else ANSI style. +01c,05oct90,shl added copyright notice. + made #endif ANSI style. +01b,10jul90,jcf made priority key unsigned. +01a,22oct89,jcf written. +*/ + +#ifndef __INCqPriNodeh +#define __INCqPriNodeh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE +#include "vxWorks.h" +#include "dllLib.h" + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ +/* HIDDEN */ + /* Q_PRI_HEAD */ + +typedef DL_LIST Q_PRI_HEAD; + +typedef struct /* Q_PRI_NODE */ + { + DL_NODE node; /* 0: priority doubly linked node */ + ULONG key; /* 8: insertion key (ie. priority) */ + } Q_PRI_NODE; + +/* END_HIDDEN */ + + +#else /* _ASMLANGUAGE */ + +#define Q_PRI_NODE_KEY 8 /* queue insertion key */ + +#endif /* _ASMLANGUAGE */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ +#ifdef __cplusplus +} +#endif + +#endif /* __INCqPriNodeh */ diff --git a/h/qPxPriBMapLib.h b/h/qPxPriBMapLib.h new file mode 100644 index 0000000..c306349 --- /dev/null +++ b/h/qPxPriBMapLib.h @@ -0,0 +1,36 @@ +/* qPxPriBMapLib.h - POSIX bit mapped linked list library header file */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01a, 07jul05,jln create +*/ + +#ifndef __INCqPxPriBMapLibh +#define __INCqPxPriBMapLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include + +#include + +#ifdef __cplusplus +} +#endif + +#endif /* __INCqPxPriBMapLibh */ diff --git a/h/rBuffLib.h b/h/rBuffLib.h new file mode 100644 index 0000000..cd98c08 --- /dev/null +++ b/h/rBuffLib.h @@ -0,0 +1,360 @@ +/* rBuffLib.h - ring of buffers library header file */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01o,13jan05,tcr Fix SPR 101137: rBuff mgr priority should be configurable + Fix SPR 105850: missing prototype for wvRBuffMgrPrioritySet +01n,15apr04,tcr add error codes +01m,17sep03,tcr remove surplus semaphore +01l,14oct98,pr added rBuffShowInit +01k,23jul98,cjtc defined new structure for windview ring buffer manager + structure (SPR 21752) +01j,04may98,nps rework msg passing for rBuff maintenance. +01i,19mar98,nps added new rBuff option which indicates whether to give + threshold sempahore. +01h,18dec97,cth changed include buffer.h to private/wvBufferP.h +01g,02dec97,nps Added field to store peak utilisation. +01f,20nov97,nps put the OBJ_CORE in BUFFER_DESC (the work described in + the previous coment). +01e,16nov97,cth changed interface to include BUFFER_DESC as hdr of struct rBuff + OBJ_CORE vs BUFFER_DESC still needs work +01d,21oct97,nps include semLibP.h. +01c,16sep97,nps modified interface to support generic upload path. + split off those fields returned by rBuffInfoGet into + separate structure. + added RBUFF_MAX_AVAILABLE. +01b,28jul97,nps further implementation/testing. + rBuffReset returns STATUS type. +01a,14jul97,nps written +*/ + +#ifndef __INCrBuffLibh +#define __INCrBuffLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "memLib.h" +#include "msgQLib.h" +#include "objLib.h" +#include "semLib.h" +#include "private/wvBufferP.h" +#include "private/semLibP.h" +#include "private/objLibP.h" + +/* defines */ + +/* rBuffMgr Msg Queue Configuration */ + +#define RBUFF_MSGQ_MAX_MSGS 50 +#define RBUFF_MSGQ_OPTIONS (MSG_Q_FIFO) + +#define RBUFF_MGR_OPTIONS VX_UNBREAKABLE + + +/* WindView rBuffMgr Configuration */ + +#define WV_RBUFF_MGR_OPTIONS VX_UNBREAKABLE +#define WV_RBUFF_MGR_MSGQ_MAX 50 +#define WV_RBUFF_MGR_MSGQ_OPTIONS (MSG_Q_FIFO) + +#define RBUFF_MAX_AVAILABLE -1 + +#define RBUFF_ERR_UPLOAD 0 +#define RBUFF_ERR_FULL 1 + +#if USE_RBUFF_SEM + +#define RBUFF_LOCK(RBUFF) \ +if (!INT_CONTEXT()) \ + { \ + semTake(RBUFF->access,WAIT_FOREVER); \ + } + +#define RBUFF_UNLOCK(RBUFF) \ +if (!INT_CONTEXT()) \ + { \ + semGive(RBUFF->access); \ + } + +#else + +#define RBUFF_LOCK(RBUFF) +#define RBUFF_UNLOCK(RBUFF) + +#endif /* USE_RBUFF */ + +#define RBUFF_UPLOAD_SEM(RBUFF) (&(RBUFF->buffDesc.hasDataSem)) + +#define RBUFF_EMPTY_KEEP 1 + +/* rBuff Manager Msg Defines */ + +#define RBUFF_MAX_MSGS 10 + +#define RBUFF_MSG_LEN 12 + +#define RBUFF_MSG_ADD 1 +#define RBUFF_MSG_FREE 2 +#define RBUFF_MSG_FULL -1 + +/* types */ + +/* Individual buffer control structure */ + +typedef struct rbuff_buff { + struct rbuff_buff *next; /* ptr to the next buffer in the ring */ + UINT32 spaceAvail; /* num of bytes of free space in buff */ + unsigned char *dataStart; /* ptr to the actual buffer region */ + unsigned char *dataEnd; /* ptr to the last actual byte of buff area */ + UINT32 dataLen; /* length of valid data in bytes */ +} RBUFF_BUFF_TYPE; + +typedef RBUFF_BUFF_TYPE *RBUFF_PTR; + +typedef struct rbuff_stats { + PART_ID srcPart; /* source partition specified on creation */ + UINT32 options; /* options selected */ + UINT32 buffSize; /* size of each buffer in bytes */ + UINT32 currBuffs; /* current num of buffs in the ring */ + UINT32 threshold; /* threshold at which upload will begin */ + UINT32 minBuffs; /* min num of buffs specified */ + INT32 maxBuffs; /* max num of buffs specified */ + UINT32 maxBuffsActual; /* max num of buffs actually used */ + UINT32 emptyBuffs; /* num of buffs to hold empty */ + UINT32 dataContent; /* num of bytes of data currently in the buff */ + UINT32 writesSinceReset; /* num of write accesses since the last reset */ + UINT32 readsSinceReset; /* num of read accesses since the last reset */ + UINT32 timesExtended; /* num of times the buffer had to be extended */ + UINT32 timesXThreshold; /* num of times the threshold was crossed */ + UINT32 bytesWritten; /* bytes written since reset */ + UINT32 bytesRead; /* bytes read since reset */ + UINT32 bytesPeak; /* Peak buffer content */ +} RBUFF_INFO_TYPE; + +/* + * In the new ring buffer scheme, the message list is held in the ring buffer + * manager's control structure, not in the ring buffer itself. For WV 2.0, it + * is being left here so that the structure offsets will not change, so as not + * to require a chage to the host side. For WV 2.2, the message queue here may + * be removed - i.e. the following fields will no longer be required: + * msgSem + * msg + * msgWriteIndex + * msgReadIndex + * When removed, the host side tcl offsets will need to be changed to reflect + * the new structure. + * + * msgOutstanding is still required in this structure, since it is buffer- + * specific, but in reality its name + * should be changed to more closely reflect its function...to + * rBuffAddMsgOutstanding, for example + */ + + +/* Ring control structure */ +typedef struct rbuff { + BUFFER_DESC buffDesc; /* generic buffer descriptor */ + RBUFF_PTR buffRead; /* buff from which next data read */ + RBUFF_PTR buffWrite; /* buff to hold next data read */ + UINT8 *dataRead; /* abs ptr from where data next read */ + UINT8 *dataWrite; /* abs ptr to where data next written */ + int fd; /* the fd of the upload device */ + FUNCPTR errorHandler; /* fn to call is fd write returns error */ + SEMAPHORE readBlk; /* sem on which to pend if no data */ + SEMAPHORE bufferFull; /* sem on which to pend if buffer is full */ + UINT32 nestLevel; /* the level to which rBuff calls are nested */ + RBUFF_INFO_TYPE info; /* Info that is returned by rBuffInfo */ + int rBuffMgrId; + unsigned int msg[RBUFF_MAX_MSGS][2]; + unsigned int msgOutstanding; + unsigned int msgWriteIndex; + unsigned int msgReadIndex; +} RBUFF_TYPE; + + +typedef struct rBuffCreateParams { + PART_ID sourcePartition; + UINT32 minimum; + INT32 maximum; + UINT32 buffSize; + UINT32 threshold; + FUNCPTR errorHandler; + UINT32 options; +} rBuffCreateParamsType; + + + + +#ifndef GENERIC_RBUFF + +/* ring buffer manager types - for windview */ + +/* + * these types have been defined especially for windview. For truly generic + * ring buffers, a vxWorks message queue may be used rather than the home- + * grown one which is needed for windview (to prevent the messages for the + * windview ring buffer manager themselves generating events) + */ + +typedef struct wv_rbuff_mgr_msg_type { + RBUFF_TYPE * ringId; /* id of ring for message */ + unsigned int msgType; /* message type */ + unsigned int arg; /* argument */ +} WV_RBUFF_MGR_MSG_TYPE; + +typedef struct wv_rbuff_mgr_type { + int tid; /* tid of tWvRBuffMgr task */ + int priorityDefault; /* default priority of task */ + SEMAPHORE msgSem; /* semaphore to run it */ + unsigned int msgWriteIndex; /* message q write index */ + unsigned int msgReadIndex; /* message q read index */ + WV_RBUFF_MGR_MSG_TYPE msg [WV_RBUFF_MGR_MSGQ_MAX]; /* msg queue */ +} WV_RBUFF_MGR_TYPE; + +typedef WV_RBUFF_MGR_TYPE * WV_RBUFF_MGR_ID; + +#endif /* GENERIC_RBUFF */ + + + + +#ifndef _ASMLANGUAGE + +typedef RBUFF_TYPE *RBUFF_ID; + +#endif /* ~ _ASMLANGUAGE */ + +/* ring of buffer options */ + +#define RBUFF_WRAPAROUND 0x1 +#define RBUFF_WRITE_BLOCK 0x2 +#define RBUFF_READ_BLOCK 0x4 +#define RBUFF_UP_DEFERRED 0x8 + +#ifndef _ASMLANGUAGE + +/* variable declarations */ + +extern CLASS_ID rBuffClassId; +extern MSG_Q_ID rBuffMgrMsgQId; + +extern int wvRBuffMgrPriorityDefault; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS rBuffLibInit(void); + +extern BUFFER_ID rBuffCreate + ( + void *rBuffParams + ); + +extern UINT8 *rBuffWrite + ( + BUFFER_ID buffId, + UINT8 *dataSrc, + UINT32 numOfBytes + ); + +extern INT32 rBuffRead + ( + BUFFER_ID buffId, + UINT8 *dataDest, + UINT32 numOfBytes + ); + +extern UINT32 rBuffReadReserve + ( + BUFFER_ID buffId, + UINT8 **src + ); + +extern STATUS rBuffReadCommit + ( + BUFFER_ID buffId, + UINT32 numOfBytes + ); + +extern INT32 rBuffFlush + ( + BUFFER_ID buffId + ); + +extern STATUS rBuffReset + ( + BUFFER_ID buffId + ); + +extern INT32 rBuffNBytes + ( + BUFFER_ID buffId + ); + +extern int rBuffUpload + ( + BUFFER_ID buffId, + int fd + ); + +extern STATUS rBuffSetFd + ( + BUFFER_ID buffId, + int fd + ); + +extern void rBuffShowInit + ( + void + ); + +extern STATUS rBuffShow + ( + BUFFER_ID buffId, + UINT32 type + ); + +extern STATUS rBuffDestroy + ( + BUFFER_ID buffId + ); + +extern STATUS wvRBuffMgrPrioritySet + ( + int priority + ); + +#else /* __STDC__ */ + +extern STATUS rBuffLibInit(); +extern BUFFER_ID rBuffCreate(); +extern UINT8 *rBuffWrite(); +extern INT32 rBuffRead(); +extern INT32 rBuffNBytesContig(); +extern STATUS rBuffMoveAhead(); +extern INT32 rBuffFlush(); +extern STATUS rBuffReset(); +extern INT32 rBuffNBytes(); +extern STATUS rBuffUpload(); +extern STATUS rBuffSetFd(); +extern STATUS rBuffShow(); +extern void rBuffShowInit (); +extern STATUS rBuffDestroy(); +extern STATUS wvRBuffMgrPrioritySet(); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrBuffLibh */ diff --git a/h/ramDiskCbio.h b/h/ramDiskCbio.h new file mode 100644 index 0000000..802202d --- /dev/null +++ b/h/ramDiskCbio.h @@ -0,0 +1,43 @@ +/* ramDiskCbio.h - header file for ramDiskCbio.c */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,29feb00,jkf T3 changes +01a,31aug99,jkf written +*/ + +#ifndef __INCramDiskCbioh +#define __INCramDiskCbioh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT CBIO_DEV_ID ramDiskDevCreate + ( + char * pRamAddr, /* where it is in memory (0 = malloc) */ + int bytesPerBlk, /* number of bytes per block */ + int blksPerTrack, /* number of blocks per track */ + int nBlocks, /* number of blocks on this device */ + int blkOffset /* no. of blks to skip at start of device */ + ); + + +#else + +IMPORT CBIO_DEV_ID ramDiskDevCreate(); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCramDiskCbioh */ diff --git a/h/ramDrv.h b/h/ramDrv.h new file mode 100644 index 0000000..436926e --- /dev/null +++ b/h/ramDrv.h @@ -0,0 +1,46 @@ +/* ramDrv.h - header file for ramDrv.c */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,22sep92,rrr added support for c++ +01e,18sep92,jcf added include of blkIo.h. +01d,04jul92,jcf cleaned up. +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01a,05oct90,shl created. +*/ + +#ifndef __INCramDrvh +#define __INCramDrvh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "blkIo.h" + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS ramDrv (void); +extern BLK_DEV *ramDevCreate (char *ramAddr, int bytesPerSec, int secPerTrack, + int nSectors, int secOffset); + +#else + +extern STATUS ramDrv (); +extern BLK_DEV *ramDevCreate (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCramDrvh */ diff --git a/h/rawFsLib.h b/h/rawFsLib.h new file mode 100644 index 0000000..b1dd989 --- /dev/null +++ b/h/rawFsLib.h @@ -0,0 +1,111 @@ +/* rawFsLib.h - header for raw block device file system library */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +03l,25aug05,jlk Added S_rawFsLib_WRITE_ONLY errno. +03k,09feb05,rfr Modified to use the XBD interface. +03j,30apr02,jkf SPR#75255, corrected unneeded API change. +03i,20sep01,jkf SPR#69031, common code for both AE & 5.x. +03h,29feb00,jkf T3 cleanup +03g,30dec99,jkf rawFsDevInit() changed from void* to CBIO_DEV_ID +03f,31jul99,jkf changes for CBIO API. +03e,31jul99,jkf T2 merge, tidiness & spelling. +03d,15oct98,lrn moved 64-bit extended ioctl codes to ioLib.h +03c,08oct98,vld added definition of RAWFS_DEF_MAX_FILES +03b,08oct98,vld driver interface changed to CBIO_DEV. + replaced rawvd_pBlkDev with CBIO_DEV * rawVdCbio + changed prototype of rawFsDevInit(). +03a,23jul98,vld added ioctl codes for 64-bit ioctl requests; new error codes. +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -changed VOID to void + -changed copyright notice +01b,05oct90,shl added ANSI function prototypes. + added copyright notice. +01a,02oct90,kdl written +*/ + +#ifndef __INCrawFsLibh +#define __INCrawFsLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "iosLib.h" +#include "lstLib.h" +#include "semLib.h" +#include "vwModNum.h" +#include "drv/xbd/xbd.h" +#include "drv/xbd/bio.h" + +/* rawFsLib Status Codes */ + +#define S_rawFsLib_VOLUME_NOT_AVAILABLE (M_rawFsLib | 1) +#define S_rawFsLib_END_OF_DEVICE (M_rawFsLib | 2) +#define S_rawFsLib_NO_FREE_FILE_DESCRIPTORS (M_rawFsLib | 3) +#define S_rawFsLib_INVALID_NUMBER_OF_BYTES (M_rawFsLib | 4) +#define S_rawFsLib_ILLEGAL_NAME (M_rawFsLib | 5) +#define S_rawFsLib_NOT_FILE (M_rawFsLib | 6) +#define S_rawFsLib_READ_ONLY (M_rawFsLib | 7) +#define S_rawFsLib_FD_OBSOLETE (M_rawFsLib | 8) +#define S_rawFsLib_NO_BLOCK_DEVICE (M_rawFsLib | 9) +#define S_rawFsLib_BAD_SEEK (M_rawFsLib | 10) +#define S_rawFsLib_INVALID_PARAMETER (M_rawFsLib | 11) +#define S_rawFsLib_32BIT_OVERFLOW (M_rawFsLib | 12) +#define S_rawFsLib_WRITE_ONLY (M_rawFsLib | 13) + +#define RAWFS_DEF_MAX_FILES 10 /* default max number of open files */ + +/* Volume descriptor */ + +typedef struct /* RAW_VOL_DESC */ + { + DEV_HDR rawVdDevHdr; /* std. I/O system device header */ + int rawVdStatus; /* (OK | ERROR) */ + SEM_ID rawVdSemId; /* volume descriptor semaphore id */ + device_t rawVdXbd; /* Backing block device */ + int rawVdRetry; /* current retry count for I/O errors */ + struct bio rawVdBio; /* The Block I/O transaction */ + unsigned rawVdBlkSize; + sector_t rawVdNBlocks; + SEM_ID rawVdBioSem; /* The Bio Counting Semaphore */ +} RAW_VOL_DESC; + + +/* Volume states */ + +#define RAW_VD_READY_CHANGED 0 /* vol not accessed since rdy change */ +#define RAW_VD_RESET 1 /* volume reset but not mounted */ +#define RAW_VD_MOUNTED 2 /* volume mounted */ +#define RAW_VD_CANT_RESET 3 /* volume reset failed */ +#define RAW_VD_CANT_MOUNT 4 /* volume mount failed */ + + +/* Function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern RAW_VOL_DESC *rawFsDevInit (char *pVolName, device_t xbd); +extern STATUS rawFsInit (int maxFiles); +extern STATUS rawFsVolUnmount (RAW_VOL_DESC *pVd); + +#else /* __STDC__ */ + +extern RAW_VOL_DESC * rawFsDevInit (); +extern STATUS rawFsInit (); +extern STATUS rawFsVolUnmount (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrawFsLibh */ + diff --git a/h/rdiscLib.h b/h/rdiscLib.h new file mode 100644 index 0000000..0743056 --- /dev/null +++ b/h/rdiscLib.h @@ -0,0 +1,51 @@ +/* rdiscLib.h - support for router discovery RFC 1256 */ + +/* Copyright 2000 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,29mar01,spm file creation: copied from version 01b of tor2_0.open_stack + branch (wpwr VOB) for unified code base +*/ + +#ifndef __INCrdiscLibh +#define __INCrdiscLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* cmd-types for the rdCtl-function */ + +#define SET_ADVERT_LIFETIME 0 +#define SET_MIN_ADVERT_INT 1 +#define SET_MAX_ADVERT_INT 2 +#define SET_MODE 3 +#define SET_FLAG 4 +#define SET_ADVERT_PREF 5 +#define SET_ADVERT_ADDRESS 6 + +#define GET_FLAG 7 +#define GET_ADVERT_LIFETIME 8 +#define GET_ADVERT_PREF 9 +#define GET_ADVERT_ADDRESS 10 +#define GET_MIN_ADVERT_INT 11 +#define GET_MAX_ADVERT_INT 12 + +/* Modes for the rdCtl routine, valid if cmd=SET_MODE. */ +#define MODE_DEBUG_OFF 0 /* Turn debugging off. */ +#define MODE_DEBUG_ON 1 /* Turn debugging on. */ +#define MODE_STOP 2 /* Stop rdisc */ + +extern void rdiscLibInit (int priority, int options, int stackSize); +extern void rdisc (); +extern STATUS rdiscIfReset (); +/* value may be an int (set-cmds) or an int* (get-cmds) */ +extern STATUS rdCtl (char *ifName, int cmd, void* value); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrdiscLibh */ diff --git a/h/rebootLib.h b/h/rebootLib.h new file mode 100644 index 0000000..43b4c9a --- /dev/null +++ b/h/rebootLib.h @@ -0,0 +1,50 @@ +/* rebootLib.h - header file for rebootLib.c */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02c,21mar05,yvp Declared reboot hook table globals here. +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01a,05oct90,shl created. +*/ + +#ifndef __INCrebootLibh +#define __INCrebootLibh + +#ifdef __cplusplus +extern "C" { +#endif + + /* externals */ + +IMPORT VOIDFUNCPTR * pRebootHookTbl; +IMPORT int rebootHookTblSize; + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS rebootHookAdd (FUNCPTR rebootHook); +extern void reboot (int startType); + +#else /* __STDC__ */ + +extern STATUS rebootHookAdd (); +extern void reboot (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrebootLibh */ diff --git a/h/reg.h b/h/reg.h new file mode 100644 index 0000000..af58cba --- /dev/null +++ b/h/reg.h @@ -0,0 +1,193 @@ +/* @(#)reg.h 1.1 86/07/07 SMI */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1986 by Sun Microsystems, Inc. + */ + +/* +modification history +-------------------- +02d,15mar00,dra Added ColdFire support +02d,19oct01,dee Merge from T2.1.0 release +02c,30jul93,jwt added architecture-specific conditional for 68K register set. +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -changed copyright notice +01a,05oct90,shl added copyright notice. +*/ + +#ifndef __INCregh +#define __INCregh + +#ifdef __cplusplus +extern "C" { +#endif + +#if (CPU_FAMILY == MC680X0) || (CPU_FAMILY == COLDFIRE) + +/* + * Location of the users' stored + * registers relative to R0. + * Usage is u.u_ar0[XX]. + */ +#define R0 (0) +#define R1 (1) +#define R2 (2) +#define R3 (3) +#define R4 (4) +#define R5 (5) +#define R6 (6) +#define R7 (7) +#define AR0 (8) +#define AR1 (9) +#define AR2 (10) +#define AR3 (11) +#define AR4 (12) +#define AR5 (13) +#define AR6 (14) +#define AR7 (15) +#define SP (15) +#define PS (16) +#define PC (17) + +/* + * And now for something completely the same... + */ +#ifndef LOCORE +struct regs { + int r_dreg[8]; /* data registers */ +#define r_r0 r_dreg[0] /* r0 for portability */ + int r_areg[8]; /* address registers */ +#define r_sp r_areg[7] /* user stack pointer */ + int r_sr; /* status register (actually a short) */ +#define r_ps r_sr + int r_pc; /* program counter */ +}; + +struct stkfmt { + int f_stkfmt : 4; /* stack format */ + int : 2; + int f_vector : 10; /* vector offset */ + short f_beibase; /* start of bus error info (if any) */ +}; + + +/* + * Struct for floating point registers and general state + * for the MC68881 (the sky fpp has no user visible state). + * If fps_flags == FPS_UNUSED, the other 68881 fields have no meaning. + * fps_code and fps_flags are software implemented fields. + * fps_flags is not used when set by user level programs, + * but changing fps_code has the side effect of changing u.u_code. + */ + +typedef struct ext_fp { + int fp[3]; +} ext_fp; /* extended 96-bit 68881 fp registers */ + +struct fp_status { + ext_fp fps_regs[8]; /* 68881 floating point regs */ + int fps_control; /* 68881 control reg */ + int fps_status; /* 68881 status reg */ + int fps_iaddr; /* 68881 instruction address reg */ + int fps_code; /* additional word for signals */ + int fps_flags; /* r/o - unused, idle or busy */ +}; +#endif /* !LOCORE */ + +/* + * Values defined for `fps_flags'. + */ +#define FPS_UNUSED 0 /* 68881 never used yet */ +#define FPS_IDLE 1 /* 68881 instruction completed */ +#define FPS_BUSY 2 /* 68881 instruction interrupted */ + +/* + * The EXT_FPS_FLAGS() macro is used to convert a pointer to an + * fp_istate into a value to be used for the user visible state + * found in fps_flags. As a speed optimization, this convertion + * is only done is required (e.g. the PTRACE_GETFPREGS ptrace + * call or when dumping core) instead of on each context switch. + * The tests that we base the state on are that a fpis_vers of + * FPIS_VERSNULL means NULL state, else a fpis_bufsiz of FPIS_IDLESZ + * means IDLE state, else we assume BUSY state. + */ +#define FPIS_VERSNULL 0x0 +#define FPIS_IDLESIZE 0x18 + +#define EXT_FPS_FLAGS(istatep) \ + ((istatep)->fpis_vers == FPIS_VERSNULL ? FPS_UNUSED : \ + (istatep)->fpis_bufsiz == FPIS_IDLESIZE ? FPS_IDLE : FPS_BUSY) + +#ifndef LOCORE +/* + * Struct for the internal state of the MC68881 + * Although the MC68881 can have a smaller maximum for + * internal state, we allow for more to allow for expansion. + */ +#define FPIS_BUFSIZ 0xc0 + +struct fp_istate { + unsigned char fpis_vers; /* version number */ + unsigned char fpis_bufsiz; /* size of info in fpis_buf */ + unsigned short fpis_reserved; /* reserved word */ + unsigned char fpis_buf[FPIS_BUFSIZ]; /* fpp internal state buffer */ +}; + +/* + * Structures for the status and data registers are defined here. + * Struct fpa_status are included in the u area. + * Struct fpa_regs is included in struct core. + */ + +/* struct fpa_status is saved/restored during context switch */ +struct fpa_status { + unsigned int fpas_state; /* STATE, supervisor privileged reg */ + unsigned int fpas_imask; /* IMASK */ + unsigned int fpas_load_ptr; /* LOAD_PTR */ + unsigned int fpas_ierr; /* IERR */ + unsigned int fpas_act_instr; /* pipe active instruction halves */ + unsigned int fpas_nxt_instr; /* pipe next instruction halves */ + unsigned int fpas_act_d1half;/* pipe active data first half */ + unsigned int fpas_act_d2half;/* pipe active data second half */ + unsigned int fpas_nxt_d1half;/* pipe next data first half */ + unsigned int fpas_nxt_d2half;/* pipe next data second half */ + unsigned int fpas_mode3_0; /* FPA MODE3_0 register */ + unsigned int fpas_wstatus; /* FPA WSTATUS register */ +}; + +/* + * Since there are 32 contexts supported by the FPA hardware, + * when we do context switch on the FPA, we don't save/restore + * the data registers between the FPA and the u area. + * If there are already 32 processes using the fpa concurrently, + * we give an error message to the 33rd process trying to use the fpa. + * (Hopefully there will not be this many processes using FPA concurrently.) + */ + +#define FPA_NCONTEXTS 32 +#define FPA_NDATA_REGS 32 + +typedef struct fpa_long { + int fpl_data[2]; +} fpa_long; /* 64 bit double precision registers */ + +/* Struct fpa_regs is included in struct core. */ +struct fpa_regs { + unsigned int fpar_flags; /* if zero, other fields are meaningless */ + struct fpa_status fpar_status; + fpa_long fpar_data[FPA_NDATA_REGS]; +}; + +#endif /* CPU_FAMILY == MC680X0 || CPU_FAMILY == COLDFIRE */ + +#endif /* !LOCORE */ +#ifdef __cplusplus +} +#endif + +#endif /* __INCregh */ diff --git a/h/regex.h b/h/regex.h new file mode 100644 index 0000000..6e05f65 --- /dev/null +++ b/h/regex.h @@ -0,0 +1,139 @@ +/* regcomp.c - regular expression handling */ + +/* +modification history +-------------------- +01c,13apr98,wmd rename host versions of regXXX functions. +01b,30sep96,elp put in share/ (SPR# 6775). +01a,10jan95,jcf created. +*/ + +/* +DESCRIPTION + +This library is *not* the original BSD distribution. Though the changes +were completely cosmetic (file naming, and such), the user of this library +is forewarned. + +AUTHOR: Henry Spencer +*/ + +/*- + * Copyright (c) 1992 Henry Spencer. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Henry Spencer of the University of Toronto. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)regex.h 8.2 (Berkeley) 1/3/94 + */ + +#ifndef _REGEX_H_ +#define _REGEX_H_ + +#ifdef HOST +#include /* XXX was sys/cdef.h from POSIX.2 */ +#endif + +/* types */ +typedef off_t regoff_t; + +typedef struct { + int re_magic; + size_t re_nsub; /* number of parenthesized subexpressions */ + const char *re_endp; /* end pointer for REG_PEND */ + struct re_guts *re_g; /* none of your business :-) */ +} regex_t; + +typedef struct { + regoff_t rm_so; /* start of match */ + regoff_t rm_eo; /* end of match */ +} regmatch_t; + +/* regcomp() flags */ +#define REG_BASIC 0000 +#define REG_EXTENDED 0001 +#define REG_ICASE 0002 +#define REG_NOSUB 0004 +#define REG_NEWLINE 0010 +#define REG_NOSPEC 0020 +#define REG_PEND 0040 +#define REG_DUMP 0200 + +/* regerror() flags */ +#define REG_NOMATCH 1 +#define REG_BADPAT 2 +#define REG_ECOLLATE 3 +#define REG_ECTYPE 4 +#define REG_EESCAPE 5 +#define REG_ESUBREG 6 +#define REG_EBRACK 7 +#define REG_EPAREN 8 +#define REG_EBRACE 9 +#define REG_BADBR 10 +#define REG_ERANGE 11 +#define REG_ESPACE 12 +#define REG_BADRPT 13 +#define REG_EMPTY 14 +#define REG_ASSERT 15 +#define REG_INVARG 16 +#define REG_ATOI 255 /* convert name to number (!) */ +#define REG_ITOA 0400 /* convert number to name (!) */ + +/* regexec() flags */ +#define REG_NOTBOL 00001 +#define REG_NOTEOL 00002 +#define REG_STARTEND 00004 +#define REG_TRACE 00400 /* tracing of execution */ +#define REG_LARGE 01000 /* force large representation */ +#define REG_BACKR 02000 /* force use of backref code */ + +/* function declarations */ + +#ifdef HOST +#define regcomp wtxRegComp +#define regerror wtxRegError +#define regexec wtxRegExec +#define regfree wtxRegFree + +extern int wtxRegComp (regex_t *, const char *, int); +extern size_t wtxRegError (int, const regex_t *, char *, size_t); +extern int wtxRegExec (const regex_t *,const char *,size_t,regmatch_t[],int); +extern void wtxRegFree (regex_t *); +#else +extern int regcomp (regex_t *, const char *, int); +extern size_t regerror (int, const regex_t *, char *, size_t); +extern int regexec (const regex_t *,const char *,size_t,regmatch_t[],int); +extern void regfree (regex_t *); +#endif /* HOST */ + +#endif /* !_REGEX_H_ */ diff --git a/h/regex2.h b/h/regex2.h new file mode 100644 index 0000000..fafbc05 --- /dev/null +++ b/h/regex2.h @@ -0,0 +1,231 @@ +/* regcomp.c - regular expression handling */ + +/* Copyright 1984-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,18feb03,p_b merge from T22-latest : gls : made definition of __P() macro + conditional (SPR #28330) +01d,01feb00,fle Linux port +01c,31mar98,fle warnings eradication +01b,30sep96,elp put in share/ (SPR# 6775). +01a,10jan95,jcf created. +*/ + +/* +DESCRIPTION + +This library is *not* the original BSD distribution. Though the changes +were completely cosmetic (file naming, and such), the user of this library +is forewarned. + +AUTHOR: Henry Spencer +*/ + +/*- + * Copyright (c) 1992, 1993, 1994 Henry Spencer. + * Copyright (c) 1992, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Henry Spencer. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)regex2.h 8.4 (Berkeley) 3/20/94 + */ + +#ifndef __P +#ifdef __STDC__ +#define __P(p) p +#else +#define __P(p) () +#endif +#endif /* __P */ + +#define POSIX_MISTAKE /* XXX was defined in BSD as extra CFLAG */ + +/* utility definitions */ + +#define DUPMAX _POSIX_MAX_INPUT /* XXX WAS _POSIX2_RE_DUP_MAX */ +#define INFINITY (DUPMAX + 1) +#define NC (CHAR_MAX - CHAR_MIN + 1) +typedef unsigned char uch; + +/* switch off assertions (if not already off) if no REDEBUG */ +#ifndef REDEBUG +#ifndef NDEBUG +#define NDEBUG /* no assertions please */ +#endif +#endif +#include + +/* for old systems with bcopy() but no memmove() */ +#ifdef USEBCOPY +#define memmove(d, s, c) bcopy(s, d, c) +#endif + +/* + * First, the stuff that ends up in the outside-world include file + = typedef off_t regoff_t; + = typedef struct { + = int re_magic; + = size_t re_nsub; // number of parenthesized subexpressions + = const char *re_endp; // end pointer for REG_PEND + = struct re_guts *re_g; // none of your business :-) + = } regex_t; + = typedef struct { + = regoff_t rm_so; // start of match + = regoff_t rm_eo; // end of match + = } regmatch_t; + */ +/* + * internals of regex_t + */ +#define MAGIC1 ((('r'^0200)<<8) | 'e') + +/* + * The internal representation is a *strip*, a sequence of + * operators ending with an endmarker. (Some terminology etc. is a + * historical relic of earlier versions which used multiple strips.) + * Certain oddities in the representation are there to permit running + * the machinery backwards; in particular, any deviation from sequential + * flow must be marked at both its source and its destination. Some + * fine points: + * + * - OPLUS_ and O_PLUS are *inside* the loop they create. + * - OQUEST_ and O_QUEST are *outside* the bypass they create. + * - OCH_ and O_CH are *outside* the multi-way branch they create, while + * OOR1 and OOR2 are respectively the end and the beginning of one of + * the branches. Note that there is an implicit OOR2 following OCH_ + * and an implicit OOR1 preceding O_CH. + * + * In state representations, an operator's bit is on to signify a state + * immediately *preceding* "execution" of that operator. + */ +typedef unsigned long sop; /* strip operator */ +typedef long sopno; +#define OPRMASK 0xf8000000 +#define OPDMASK 0x07ffffff +#define OPSHIFT ((unsigned)27) +#define OP(n) ((n)&OPRMASK) +#define OPND(n) ((n)&OPDMASK) +#define SOP(op, opnd) ((op)|(opnd)) +/* operators meaning operand */ +/* (back, fwd are offsets) */ +#define OEND (1< uch [csetsize] */ + uch mask; /* bit within array */ + uch hash; /* hash code */ + size_t smultis; + char *multis; /* -> char[smulti] ab\0cd\0ef\0\0 */ +} cset; +/* note that CHadd and CHsub are unsafe, and CHIN doesn't yield 0/1 */ +#define CHadd(cs, c) ((cs)->ptr[(uch)(c)] |= (cs)->mask, (cs)->hash += (c)) +#define CHsub(cs, c) ((cs)->ptr[(uch)(c)] &= ~(cs)->mask, (cs)->hash -= (c)) +#define CHIN(cs, c) ((cs)->ptr[(uch)(c)] & (cs)->mask) +#define MCadd(p, cs, cp) mcadd(p, cs, cp) /* regcomp() internal fns */ +#define MCsub(p, cs, cp) mcsub(p, cs, cp) +#define MCin(p, cs, cp) mcin(p, cs, cp) + +/* stuff for character categories */ +typedef unsigned char cat_t; + +/* + * main compiled-expression structure + */ +struct re_guts { + int magic; +# define MAGIC2 ((('R'^0200)<<8)|'E') + sop *strip; /* malloced area for strip */ + int csetsize; /* number of bits in a cset vector */ + int ncsets; /* number of csets in use */ + cset *sets; /* -> cset [ncsets] */ + uch *setbits; /* -> uch[csetsize][ncsets/CHAR_BIT] */ + int cflags; /* copy of regcomp() cflags argument */ + sopno nstates; /* = number of sops */ + sopno firststate; /* the initial OEND (normally 0) */ + sopno laststate; /* the final OEND */ + int iflags; /* internal flags */ +# define USEBOL 01 /* used ^ */ +# define USEEOL 02 /* used $ */ +# define BAD 04 /* something wrong */ + int nbol; /* number of ^ used */ + int neol; /* number of $ used */ + int ncategories; /* how many character categories */ + cat_t *categories; /* ->catspace[-CHAR_MIN] */ + char *must; /* match must contain this string */ + int mlen; /* length of must */ + size_t nsub; /* copy of re_nsub */ + int backrefs; /* does it use back references? */ + sopno nplus; /* how deep does it nest +s? */ + /* catspace must be last */ + cat_t catspace[1]; /* actually [NC] */ +}; + +/* misc utilities */ +#ifdef OUT +#undef OUT +#endif /* OUT */ +#define OUT (CHAR_MAX+1) /* a non-character value */ +#define ISWORD(c) (isalnum(c) || (c) == '_') diff --git a/h/regs.h b/h/regs.h new file mode 100644 index 0000000..612dc2d --- /dev/null +++ b/h/regs.h @@ -0,0 +1,122 @@ +/* regs.h - CPU registers */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +03f,07may03,pes PAL conditional compilation cleanup. Phase 2. +03e,17apr03,dbt Added SIMLINUX support. +03d,22oct01,dee Merge from T2.1.0 ColdFire +03c,01mar00,frf Add SH4 support for T2. +03b,23apr97,hk added SH support. +03b,15aug97,cym added SIMNT support. +03b,28nov96,cdp added ARM support. +03a,26may94,yao added PPC support. +02i,12jul95,ism added simsolaris support +02h,19mar95,dvs removed #ifdef TRON - tron no longer supported. +02g,04feb94,cd added extra field to REG_INDEX for MIPS (probably safe + for all architectures really) +02f,09jun93,hdn added support for I80X86 +02e,02dec93,pme added Am29K support. +02d,11aug93,gae vxsim hppa. +02c,20jun93,gae vxsim. +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01k,26may92,rrr the tree shuffle + -changed includes to have absolute path from h/ +01j,20feb92,yao added REG_INDEX. +01i,09jan92,jwt converted CPU==SPARC to CPU_FAMILY==SPARC. +01h,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01g,02aug91,ajm added MIPS support +01f,19jul91,gae renamed architecture specific include file to be xx.h. +01e,29apr91,hdn added defines and macros for TRON architecture. +01d,25oct90,shl fixed CPU_FAMILY logic so 68k and sparc won't clash when + compiling for sparc. +01c,05oct90,shl added copyright notice. + made #endif ANSI style. +01b,28sep90,del added include i960/regs.h for I960 CPU_FAMILY. +01a,07aug89,gae written. +*/ + +#ifndef __INCregsh +#define __INCregsh + +#ifdef __cplusplus +extern "C" { +#endif + +#if CPU_FAMILY==I960 +#include "arch/i960/regsI960.h" +#endif /* CPU_FAMILY==I960 */ + +#if CPU_FAMILY==MC680X0 +#include "arch/mc68k/regsMc68k.h" +#endif /* CPU_FAMILY==MC680X0 */ + +#if CPU_FAMILY==COLDFIRE +#include "arch/coldfire/regsColdfire.h" +#endif /* CPU_FAMILY==COLDFIRE */ + +#if CPU_FAMILY==MIPS +#include "arch/mips/regsMips.h" +#endif /* CPU_FAMILY==MIPS */ + +#if CPU_FAMILY==PPC +#include "arch/ppc/regsPpc.h" +#endif /* CPU_FAMILY==PPC */ + +#if CPU_FAMILY==SPARC +#include "arch/sparc/regsSparc.h" +#endif /* CPU_FAMILY==SPARC */ + +#if CPU_FAMILY==SIMSPARCSOLARIS +#include "arch/simsolaris/regsSimsolaris.h" +#endif /* CPU_FAMILY==SIMSPARCSOLARIS */ + +#if CPU_FAMILY==SIMLINUX +#include "arch/simlinux/regsSimlinux.h" +#endif /* CPU_FAMILY==SIMLINUX */ + +#if CPU_FAMILY==SIMNT +#include "arch/simnt/regsSimnt.h" +#endif /* CPU_FAMILY==SIMNT */ + +#if CPU_FAMILY==I80X86 +#include "arch/i86/regsI86.h" +#endif /* CPU_FAMILY==I80X86 */ + +#if CPU_FAMILY==AM29XXX +#include "arch/am29k/regsAm29k.h" +#endif /* CPU_FAMILY==AM29XXX */ + +#if CPU_FAMILY==SH +#include "arch/sh/regsSh.h" +#endif /* CPU_FAMILY==SH */ + +#if CPU_FAMILY==ARM +#include "arch/arm/regsArm.h" +#endif /* CPU_FAMILY==ARM */ + +#ifndef _ASMLANGUAGE +typedef struct regindex + { + char *regName; /* pointer to register name */ + int regOff; /* offset to entry in REG_SET */ +#if defined (_WRS_REG_INDEX_REGWIDTH) + int regWidth; /* register width */ +#endif +#if (CPU_FAMILY==COLDFIRE) + int regWidth; /* register width */ + int regStandard; /* register is a "standard" register */ +#endif + } REG_INDEX; +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCregsh */ diff --git a/h/remLib.h b/h/remLib.h new file mode 100644 index 0000000..55d3fa6 --- /dev/null +++ b/h/remLib.h @@ -0,0 +1,84 @@ +/* remLib.h - structures for remLib.c */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02d,20feb01,ham fixed infinite suspending by rcmd() (SPR 62484). +02c,22sep92,rrr added support for c++ +02b,15sep92,jcf added variable declaration. +02a,04jul92,jcf cleaned up. +01i,26may92,rrr the tree shuffle + -changed includes to have absolute path from h/ +01h,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01g,11jan91,shl inlcuded "in.h" for sockaddr_in. +01f,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01e,28may88,dnw removed some status values to hostLib.h. +01d,01nov87,llk added S_remLib_HOST_ALREADY_ENTERED. +01c,10oct86,gae deleted S_remLib_DIRECTORY_NAME_TOO_BIG, not used anymore; + spelled S_remLib_ILLEAGAL_INTERNET_ADDRESS correctly. + moved HOST and HOSTNAME structs to remLib.c for better hiding. + added conditional INCremLibh. Defined MAX_IDENTITY_LEN. +01b,21may86,llk deleted S_remLib_WRITE_ERROR, not used anymore. +01a,19sep85,rdc written. +*/ + +#ifndef __INCremLibh +#define __INCremLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "netinet/in.h" + +#define MAX_IDENTITY_LEN 100 + +/* status messages */ + +#define S_remLib_ALL_PORTS_IN_USE (M_remLib | 1) +#define S_remLib_RSH_ERROR (M_remLib | 2) +#define S_remLib_IDENTITY_TOO_BIG (M_remLib | 3) +#define S_remLib_RSH_STDERR_SETUP_FAILED (M_remLib | 4) + +/* variable declarations */ + +extern int remLastResvPort; /* last port num used (from bootroms) */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) +extern void remLibInit (long timeout); +extern STATUS bindresvport (int sd, struct sockaddr_in *sin); +extern STATUS iam (char *newUser, char *newPasswd); +extern STATUS remCurIdSet (char *newUser, char *newPasswd); +extern int rcmd (char *host, int remotePort, char *localUser, + char *remoteUser, char *cmd, int *fd2p); +extern int rresvport (int *alport); +extern void remCurIdGet (char *user, char *passwd); +extern void whoami (void); + +#else /* __STDC__ */ + +extern void remLibInit (); +extern STATUS bindresvport (); +extern STATUS iam (); +extern STATUS remCurIdSet (); +extern int rcmd (); +extern int rresvport (); +extern void remCurIdGet (); +extern void whoami (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCremLibh */ diff --git a/h/resolv/nameser.h b/h/resolv/nameser.h new file mode 100644 index 0000000..48bdeaa --- /dev/null +++ b/h/resolv/nameser.h @@ -0,0 +1,284 @@ +/* nameser.h - Domain Name Server protocol header file */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + + +/* $NetBSD: nameser.h,v 1.7 1994/10/26 00:56:45 cgd Exp $ */ + +/* + * Copyright (c) 1983, 1989 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)nameser.h 5.25 (Berkeley) 4/3/91 + */ + +/* +modification history +-------------------- +01b,29apr97,jag Changed T_NULL to T_NULL_RR to fix conflict with loadCoffLib.h +01b,02apr97,jag Change types from u_int*_t to uint*_t. +01a,11dec96,jag created from BSD4.4. Corrected bitfields to meet ANSI spec. + changed STATUS to DNS_STATUS. +*/ + +#ifndef __INCnameserh +#define __INCnameserh + +#ifdef __cplusplus +extern "C" { +#endif + +#define BYTE_ORDER _BYTE_ORDER +#define LITTLE_ENDIAN _LITTLE_ENDIAN +#define BIG_ENDIAN _BIG_ENDIAN + + +/* + * Define constants based on rfc883 + */ +#define PACKETSZ 512 /* maximum packet size */ +#define MAXDNAME 256 /* maximum domain name */ +#define MAXCDNAME 255 /* maximum compressed domain name */ +#define MAXLABEL 63 /* maximum length of domain label */ + /* Number of bytes of fixed size data in query structure */ +#define QFIXEDSZ 4 + /* number of bytes of fixed size data in resource record */ +#define RRFIXEDSZ 10 + +/* + * Internet nameserver port number + */ +#define NAMESERVER_PORT 53 + +/* + * Currently defined opcodes + */ +#define QUERY 0x0 /* standard query */ +#define IQUERY 0x1 /* inverse query */ +#define DNS_STATUS 0x2 /* nameserver status query*/ +/* #define xxx 0x3 0x3 reserved */ + + /* non standard */ +#define UPDATEA 0x9 /* add resource record */ +#define UPDATED 0xa /* delete a specific resource record */ +#define UPDATEDA 0xb /* delete all named resource record */ +#define UPDATEM 0xc /* modify a specific resource record */ +#define UPDATEMA 0xd /* modify all named resource record */ + +#define ZONEINIT 0xe /* initial zone transfer */ +#define ZONEREF 0xf /* incremental zone referesh */ + +/* + * Currently defined response codes + */ +#define NOERROR 0 /* no error */ +#define FORMERR 1 /* format error */ +#define SERVFAIL 2 /* server failure */ +#define NXDOMAIN 3 /* non existent domain */ +#define NOTIMP 4 /* not implemented */ +#define REFUSED 5 /* query refused */ + /* non standard */ +#define NOCHANGE 0xf /* update failed to change db */ + +/* + * Type values for resources and queries + */ +#define T_A 1 /* host address */ +#define T_NS 2 /* authoritative server */ +#define T_MD 3 /* mail destination */ +#define T_MF 4 /* mail forwarder */ +#define T_CNAME 5 /* connonical name */ +#define T_SOA 6 /* start of authority zone */ +#define T_MB 7 /* mailbox domain name */ +#define T_MG 8 /* mail group member */ +#define T_MR 9 /* mail rename name */ +#define T_NULL_RR 10 /* null resource record */ +#define T_WKS 11 /* well known service */ +#define T_PTR 12 /* domain name pointer */ +#define T_HINFO 13 /* host information */ +#define T_MINFO 14 /* mailbox information */ +#define T_MX 15 /* mail routing information */ +#define T_TXT 16 /* text strings */ +#define T_RP 17 /* responsible person */ +#define T_AFSDB 18 /* AFS cell database */ +#define T_NSAP 22 /* NSAP address */ +#define T_NSAP_PTR 23 /* reverse lookup for NSAP */ + /* non standard */ +#define T_UINFO 100 /* user (finger) information */ +#define T_UID 101 /* user ID */ +#define T_GID 102 /* group ID */ +#define T_UNSPEC 103 /* Unspecified format (binary data) */ +#define T_SA 200 /* shuffle address */ + /* Query type values which do not appear in resource records */ +#define T_AXFR 252 /* transfer zone of authority */ +#define T_MAILB 253 /* transfer mailbox records */ +#define T_MAILA 254 /* transfer mail agent records */ +#define T_ANY 255 /* wildcard match */ + +/* + * Values for class field + */ +#define C_IN 1 /* the arpa internet */ +#define C_CHAOS 3 /* for chaos net at MIT */ +#define C_HS 4 /* for Hesiod name server at MIT */ + /* Query class values which do not appear in resource records */ +#define C_ANY 255 /* wildcard match */ + +/* + * Status return codes for T_UNSPEC conversion routines + */ +#define CONV_SUCCESS 0 +#define CONV_OVERFLOW -1 +#define CONV_BADFMT -2 +#define CONV_BADCKSUM -3 +#define CONV_BADBUFLEN -4 + +/* + * Structure for query header, the order of the fields is machine and + * compiler dependent, in our case, the bits within a byte are assignd + * least significant first, while the order of transmition is most + * significant first. This requires a somewhat confusing rearrangement. + */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct + { + u_int id:16, /* fields (Bytes 1-2) query identification number */ +#if BYTE_ORDER == BIG_ENDIAN + /* fields in third byte */ + qr:1, /* response flag */ + opcode:4, /* purpose of message */ + aa:1, /* authoritive answer */ + tc:1, /* truncated message */ + rd:1, /* recursion desired */ + /* fields in fourth byte */ + ra:1, /* recursion available */ + pr:1, /* primary server required (non standard) */ + unused:2, /* unused bits */ + rcode:4; /* response code */ +#endif +#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN + /* fields in third byte */ + rd:1, /* recursion desired */ + tc:1, /* truncated message */ + aa:1, /* authoritive answer */ + opcode:4, /* purpose of message */ + qr:1, /* response flag */ + /* fields in fourth byte */ + rcode:4, /* response code */ + unused:2, /* unused bits */ + pr:1, /* primary server required (non standard) */ + ra:1; /* recursion available */ +#endif + /* remaining bytes */ + u_short qdcount; /* number of question entries */ + u_short ancount; /* number of answer entries */ + u_short nscount; /* number of authority entries */ + u_short arcount; /* number of resource entries */ + + } HEADER; + +/* + * Defines for handling compressed domain names + */ +#define INDIR_MASK 0xc0 + +/* + * Structure for passing resource records around. + */ +struct rrec { + int16_t r_zone; /* zone number */ + int16_t r_class; /* class number */ + int16_t r_type; /* type number */ + uint32_t r_ttl; /* time to live */ + int r_size; /* size of data area */ + char *r_data; /* pointer to data */ +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +extern uint16_t _getshort(); +extern uint32_t _getlong(); + +/* + * Inline versions of get/put short/long. + * Pointer is advanced; we assume that both arguments + * are lvalues and will already be in registers. + * cp MUST be u_char *. + */ +#define GETSHORT(s, cp) { \ + register u_char *t_cp = (u_char *)(cp); \ + (s) = ((uint16_t)t_cp[0] << 8) \ + | ((uint16_t)t_cp[1]) ;\ + (cp) += sizeof(uint16_t); \ +} + +#define GETLONG(l, cp) { \ + register u_char *t_cp = (u_char *)(cp); \ + (l) = ((uint32_t)t_cp[0] << 24) \ + | ((uint32_t)t_cp[1] << 16) \ + | ((uint32_t)t_cp[2] << 8) \ + | ((uint32_t)t_cp[3]) ;\ + (cp) += sizeof(uint32_t); \ +} + +#define PUTSHORT(s, cp) { \ + register uint16_t t_s = (uint16_t)(s); \ + register u_char *t_cp = (u_char *)(cp); \ + *t_cp++ = t_s >> 8; \ + *t_cp = t_s; \ + (cp) += sizeof(uint16_t); \ +} + +/* + * Warning: PUTLONG --no-longer-- destroys its first argument. if you + * were depending on this "feature", you will lose. + */ +#define PUTLONG(l, cp) { \ + register uint32_t t_l = (uint32_t)(l); \ + register u_char *t_cp = (u_char *)(cp); \ + *t_cp++ = t_l >> 24; \ + *t_cp++ = t_l >> 16; \ + *t_cp++ = t_l >> 8; \ + *t_cp = t_l; \ + (cp) += sizeof(uint32_t); \ +} + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnameserh */ diff --git a/h/resolv/resolv.h b/h/resolv/resolv.h new file mode 100644 index 0000000..b12e333 --- /dev/null +++ b/h/resolv/resolv.h @@ -0,0 +1,184 @@ +/* resolv.h - resolver internal data structures header file */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + + +/* $NetBSD: resolv.h,v 1.8 1994/10/26 00:56:16 cgd Exp $ */ + +/* + * Copyright (c) 1983, 1987, 1989 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)resolv.h 5.15 (Berkeley) 4/3/91 + */ + +/* +modification history +-------------------- +01c,24sep01,gls removed definition of __P() macro (SPR #28330) +01b,02apr97,jag Change types from u_int*_t to uint*_t. Added C++ and function + prototypes. +01a,11dec96,jag created from BSD4.4 release. Deleted constants that are not + used by vxWorks. Changed bit fields to meet ANSI specs. +*/ + + +#ifndef __INCresolvh +#define __INCresolvh + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * revision information. this is the release date in YYYYMMDD format. + * it can change every day so the right thing to do with it is use it + * in preprocessor commands such as "#if (__RES > 19931104)". do not + * compare for equality; rather, use it to determine whether your resolver + * is new enough to contain a certain feature. + */ + +#define __RES 19931104 + + +/* + * Global defines and variables for resolver stub. + */ +#define MAXNS 3 /* max # name servers we'll track */ +#define MAXDFLSRCH 3 /* # default domain levels to try */ +#define MAXDNSRCH 6 /* max # domains in search path */ +#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */ +#define MAXDNSLUS 4 /* max # of host lookup types */ + +#define RES_TIMEOUT 5 /* min. seconds between retries */ +#define MAXRESOLVSORT 10 /* number of net to sort on */ +#define RES_MAXNDOTS 15 /* should reflect bit field size */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +struct __res_state { + int retrans; /* retransmition time interval */ + int retry; /* number of times to retransmit */ + long options; /* option flags - see below. */ + int nscount; /* number of name servers */ + struct sockaddr_in nsaddr_list[MAXNS]; /* address of name server */ +#define nsaddr nsaddr_list[0] /* for backward compatibility */ + u_short id; /* current packet id */ + char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ + char defdname[MAXDNAME]; /* default domain */ + long pfcode; /* RES_PRF_ flags - see below. */ + u_int ndots:4, /* threshold for initial abs. query */ + nsort:4, /* number of elements in sort_list[] */ + :0; /* ANSI padding field */ + struct { + struct in_addr addr; + uint32_t mask; + } sort_list[MAXRESOLVSORT]; + char lookups[MAXDNSLUS]; +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Resolver options + */ +#define RES_INIT 0x0001 /* address initialized */ +#define RES_DEBUG 0x0002 /* print debug messages */ +#define RES_AAONLY 0x0004 /* authoritative answers only */ +#define RES_USEVC 0x0008 /* use virtual circuit */ +#define RES_PRIMARY 0x0010 /* query primary server only */ +#define RES_IGNTC 0x0020 /* ignore trucation errors */ +#define RES_RECURSE 0x0040 /* recursion desired */ +#define RES_DEFNAMES 0x0080 /* use default domain name */ +#define RES_STAYOPEN 0x0100 /* Keep TCP socket open */ +#define RES_DNSRCH 0x0200 /* search up local domain tree */ + +#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH) + +/* + * Resolver "pfcode" values. Used by dig. + */ +#define RES_PRF_STATS 0x0001 +/* 0x0002 */ +#define RES_PRF_CLASS 0x0004 +#define RES_PRF_CMD 0x0008 +#define RES_PRF_QUES 0x0010 +#define RES_PRF_ANS 0x0020 +#define RES_PRF_AUTH 0x0040 +#define RES_PRF_ADD 0x0080 +#define RES_PRF_HEAD1 0x0100 +#define RES_PRF_HEAD2 0x0200 +#define RES_PRF_TTLID 0x0400 +#define RES_PRF_HEADX 0x0800 +#define RES_PRF_QUERY 0x1000 +#define RES_PRF_REPLY 0x2000 +#define RES_PRF_INIT 0x4000 +/* 0x8000 */ + +extern struct __res_state _res; + + +/* Private routines shared between libc/net, named, nslookup and others. */ +#define dn_skipname __dn_skipname +#define fp_query __fp_query +#define hostalias __hostalias +#define putlong __putlong +#define putshort __putshort +#define p_class __p_class +#define p_time __p_time +#define p_type __p_type + +int __dn_skipname __P((const u_char *, const u_char *)); +void __fp_query __P((char *, FILE *)); +char *__hostalias __P((const char *)); +void __putlong __P((uint32_t, u_char *)); +void __putshort __P((uint16_t, u_char *)); +char *__p_class __P((int)); +char *__p_time __P((uint32_t)); +char *__p_type __P((int)); + +int resQuery __P((char *, int, int, u_char *, int)); +int resSearch __P((const char *, int, int, u_char *, int)); +int resMkQuery __P((int, const char *, int, int, const char *, int, + const char *, char *, int)); +int resSend __P((const char *, int, char *, int)); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCresolvh */ diff --git a/h/resolvLib.h b/h/resolvLib.h new file mode 100644 index 0000000..11ed71d --- /dev/null +++ b/h/resolvLib.h @@ -0,0 +1,115 @@ +/* resolvLib.h - VxWorks DNS resolver facilities */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01e,12oct01,rae merge from truestack (S_resolvLib_INVALID_ADDRESS) +01d,24sep01,gls removed definition of __P() macro (SPR #28330) +01c,19may97,spm added S_resolvLib_INVALID_PARAMETER error value (SPR #8603), + corrected format of modification history +01b,02apr97,jag removed reference to header file resolv/param.h. +01a,29jul96,rjc written. +*/ + +#ifndef __INCresolvLibh +#define __INCresolvLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include "vxWorks.h" +#include "vwModNum.h" +#include "sockLib.h" +#include "netinet/in.h" +#include "arpa/inet.h" +#include "netdb.h" +#include "resolv/nameser.h" +#include "netinet/in.h" +#include "resolv/resolv.h" + + +#define MAXIPADDRLEN 20 /* assuming decimal dot notation */ +#define MAXALIASES 20 +#define MAXADDRS 20 + +#define QUERY_LOCAL_FIRST 1 /* Query static host table first */ +#define QUERY_DNS_FIRST 2 /* Query DNS first */ +#define QUERY_DNS_ONLY 3 /* Query DNS only */ + +#define S_resolvLib_NO_RECOVERY (M_resolvLib | 1) +#define S_resolvLib_TRY_AGAIN (M_resolvLib | 2) +#define S_resolvLib_HOST_NOT_FOUND (M_resolvLib | 3) +#define S_resolvLib_NO_DATA (M_resolvLib | 4) +#define S_resolvLib_BUFFER_2_SMALL (M_resolvLib | 5) +#define S_resolvLib_INVALID_PARAMETER (M_resolvLib | 6) +#define S_resolvLib_INVALID_ADDRESS (M_resolvLib | 7) + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* Resolver parameter configuration structures */ + +typedef struct + { + /* order in which to query hostLib database and DNS */ + char queryOrder; + /* maximum domain name based on rfc883 */ + char domainName [MAXDNAME]; + /* IP address of name servers */ + char nameServersAddr [MAXNS][MAXIPADDRLEN]; + + } RESOLV_PARAMS_S; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +STATUS resolvInit (char *, char *, FUNCPTR); +struct hostent * resolvGetHostByName (char *, char *, int); +struct hostent * resolvGetHostByAddr (const char *, char *, int); +int resolvDNExpand (const u_char *, const u_char *, + const u_char *, u_char *, int); +int resolvDNComp (const u_char *, u_char *, int, u_char **, + u_char **); +int resolvQuery (char *, int, int, u_char *, int); + +int resolvMkQuery (int, const char *, int, int, const char *, + int, const char *, char *, int); +int resolvSend (const char *, int, char *, int) ; +STATUS resolvParamsSet (RESOLV_PARAMS_S *); +void resolvParamsGet (RESOLV_PARAMS_S *); + +#else /* __STDC__ */ + +STATUS resolvInit (); +struct hostent * resolvGetHostByName (); +struct hostent * resolvGetHostByAddr (); +int resolvDNExpand (); +int resolvDNComp (); +int resolvQuery (); +int resolvMkQuery (); +int resolvSend (); +void resolvParamsSet (); +void resolvParamsGet (); + +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif + + +#endif /* __INCresolvLibh */ diff --git a/h/rip/defs.h b/h/rip/defs.h new file mode 100644 index 0000000..41172d8 --- /dev/null +++ b/h/rip/defs.h @@ -0,0 +1,234 @@ +/* defs.h - common definitions for routed/rip */ + +/* Copyright 1984 - 2002 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1983, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)defs.h 8.2 (Berkeley) 4/28/95 + */ + +/* +modification history +-------------------- +01n,28apr02,rae added extern C jazz (SPR #76303) +01m,22mar02,niq Merged from Synth view, tor3_x.synth branch, ver 01o +01l,24jan02,niq SPR 72415 - Added support for Route tags +01k,12oct01,rae merge from truestack ver 01l, base 01j +01j,16mar99,spm recovered orphaned code from tor1_0_1.sens1_1 (SPR #25770) +01i,05oct98,spm made task parameters adjustable (SPR #22422) +01h,11sep98,spm added support for expanded ripShutdown routine and provided + broader access to mutual exclusion semaphore to prevent + collisions between RIP tasks (SPR #22352); removed references + to bloated trace commands (SPR #22350); corrected value + of MIN_WAITTIME (SPR #22360) +01g,26jun98,spm changed prototypes to remove compiler warnings; added + prototype for ripClearInterfaces; changed RIP_MCAST_ADDR + constant from string to value +01f,06oct97,gnn added function prototypes and removed ripState +01e,17apr97,gnn changed the MIB-II variables to follow coding conventions. +01d,07apr97,gnn cleared up some of the more egregious warnings. + added MIB-II interfaces and options. +01c,12mar97,gnn added multicast support + added timer variables +01b,24feb97,gnn changed some variable names, added some fields to global + structure + changed location of netdb.h +01a,26nov96,gnn created from BSD4.4 routed +*/ + +#ifndef __INCdefsh +#define __INCdefsh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Internal data structure definitions for + * user routing process. Based on Xerox NS + * protocol specs with mods relevant to more + * general addressing scheme. + */ +#include "sys/socket.h" +#include "time.h" + +#include "net/route.h" +#include "net/af.h" +#include "netinet/in.h" +#include "rip/ripLib.h" + +#include "stdio.h" + +#include "rip/interface.h" +#include "rip/table.h" +#include "rip/rip2.h" +#include "rip/m2RipLib.h" + +#include "wdLib.h" +#include "semLib.h" +#include "netdb.h" + +#define equal(a1, a2) \ + (memcmp((a1), (a2), sizeof (struct sockaddr)) == 0) + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +#define S_ADDR(x) (((struct sockaddr_in *)(x))->sin_addr.s_addr) +#define INFO_DST(I) ((I)->rti_info[RTAX_DST]) +#define INFO_GATE(I) ((I)->rti_info[RTAX_GATEWAY]) +#define INFO_MASK(I) ((I)->rti_info[RTAX_NETMASK]) +#define INFO_IFA(I) ((I)->rti_info[RTAX_IFA]) +#define INFO_IFP(I) ((I)->rti_info[RTAX_IFP]) +#define INFO_AUTHOR(I) ((I)->rti_info[RTAX_AUTHOR]) +#define INFO_BRD(I) ((I)->rti_info[RTAX_BRD]) + +/* Needed for compatability */ +/* XXX */ +struct osockaddr { + u_short sa_family; /* address family */ + char sa_data[14]; /* up to 14 bytes of direct address */ +}; + +/* + * This global structure holds what used to be all the global + * variables in the rip program. + */ + +typedef struct rip_globals + { + int version; /* What RIP version are we running? */ + struct sockaddr_in addr; /* address of daemon's socket */ + + int s; /* source and sink of all data */ + int routeSocket; /* source for routing messages */ + + int ripTaskId; /* Identifier for primary RIP task. */ + int ripTimerTaskId; /* Identifier for RIP timer task. */ + + int supplier; /* process should supply updates */ + BOOL lookforinterfaces; /* if 1 probe kernel for new up interfaces */ + int externalinterfaces; /* # of remote and local interfaces */ + int gateway; /* Are we a gateway? */ + BOOL multicast; /* Are we using multicast? */ + struct timeval now; /* current idea of time */ + struct timeval then; /* previous idea of time */ + struct timeval lastbcast; /* last time all/changes broadcast */ + struct timeval lastfullupdate;/* last time full table broadcast */ + struct timeval nextbcast; /* time to wait before changes */ + /* broadcast */ + int needupdate; /* true if we need update at nextbcast */ + + int timerRate; /* How often does the timer go off */ + int supplyInterval; /* How often do we supply routes? */ + int expire; /* HOw long until we expire a route? */ + int garbage; /* When is a route really thrown out? */ + + char packet[MAXPACKETSIZE+1]; + struct rip_pkt *msg; + + int port; + int faketime; /* Used by the timer routine to keep track. */ + WDOG_ID timerDog; /* Watch dog for firing off the timer. */ + SEM_ID timerSem; /* Semaphore that our user level routine */ + /* waits on to do timer processing. */ + FUNCPTR pRouteHook; /* Route propagation hook */ + + /* + * Variables to store MIB-II data. + */ + + M2_RIP2_GLOBAL_GROUP ripGlobal; + + /* + * The ripConf element contains configuration settings + * copied for all available interfaces during initialization. + * Because the configuration may be changed on an interface-specific + * basis, this structure should not be consulted for the + * actual values after routedIfInit() has been called. + */ + + M2_RIP2_IFCONF_ENTRY ripConf; + } RIP; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +IMPORT SEM_ID ripLockSem; + +/* This is the global structure used by the routing daemon. */ + +struct in_addr inet_makeaddr(); +int inet_maskof(); +int sndmsg(); +STATUS supply(); +int cleanup(); + +int rtioctl(); +struct rt_entry * rtadd(struct sockaddr *dst, struct sockaddr *gate, int metric, + int state, struct sockaddr *netmask, int proto, int tag, + int from, struct interface *ifp); +STATUS rtchange(struct rt_entry *rt, struct sockaddr *gate, short metric, + struct sockaddr *netmask, int tag, int from, + struct interface *ifp); +STATUS rtdelete(struct rt_entry *rt); + +void toall (int (*)(), int, struct interface *); + +void ripRouteToAddrs (struct rt_entry* pRoute, + struct sockaddr_in** ppDsin, + struct sockaddr_in** ppGsin, + struct sockaddr_in** ppNsin); +void ifRouteAdd (struct sockaddr * pAddr, int refCnt, int subnetsCnt, + BOOL internalFlag, u_long subnetMask); +void ripBuildPacket (RIP2PKT *, struct rt_entry*, struct interface *, int); +void ripSetInterfaces(INT32 sock, UINT32 mcastAddr); +void ripClearInterfaces(INT32 sock, UINT32 mcastAddr); + +/* Defines created in the port to VxWorks. */ + +#define RIP_PORT 520 +#define NSEC_MAX 1000000000 +#define RIP_TASK "tRipTask" +#define RIP_TIMER "tRipTimerTask" +#define RIP_MAX_PACKET 512 /* The maximum packet size. */ +#define RIP_MIN_PACKET 24 /* A packet with 1 entry. */ + +#define RIP_MCAST_ADDR 0xe0000009 /* RIP group address is 224.0.0.9 */ + +#ifdef __cplusplus +} +#endif +#endif /* __INCdefsh */ diff --git a/h/rip/interface.h b/h/rip/interface.h new file mode 100644 index 0000000..69fdfb2 --- /dev/null +++ b/h/rip/interface.h @@ -0,0 +1,163 @@ +/* interface.h - common definitions for RIP interface routines */ + +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)interface.h 8.1 (Berkeley) 6/5/93 + */ + +/* +modification history +-------------------- +01k,28apr02,rae added extern C jazz (SPR #76303) +01j,22mar02,niq Merged from Synth view, tor3_x.synth branch, ver 01l +01i,12oct01,rae merge from truestack ver 01j base 01h +01h,11sep98,spm removed references to bloated trace commands (SPR #22350) +01g,06oct97,gnn added sendHook function pointer. +01f,16may97,gnn added leakHook function pointer. +01e,17apr97,gnn changed MIB-II names to follow conventions. +01d,14apr97,gnn added the pointer for the authentication hook. +01c,07apr97,gnn cleared up some of the more egregious warnings. + added MIB-II interfaces and options. +01b,24feb97,gnn removed multicast stuff + changed the routine names. +01a,26nov96,gnn created from BSD4.4 routed +*/ + +#ifndef __INCinterfaceh +#define __INCinterfaceh + +#ifdef __cplusplus +extern "C" { +#endif +#include "m2RipLib.h" + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* defines */ + +#define AUTH_KEY_LEN 16 /* must be 20 if SHA-1 will be used */ +#define RIP_AUTH_PROTO_MD5 1 +#define RIP_AUTH_PROTO_SHA1 2 + + +/* + * Routing table management daemon. + */ + +struct interface; +typedef struct ripAuthKey RIP_AUTH_KEY; + +struct ripAuthKey + { + UINT16 keyId; /* the key id */ + UINT authProto; /* the authentication protocol */ + UCHAR pKey [AUTH_KEY_LEN]; /* the secret authentication key */ + ULONG timeStart; /* time key was entered */ + ULONG timeEnd; /* time when key expires */ + ULONG lastRcvSequence; /* last sequence number received */ + ULONG lastSntSequence; /* last sequence number sent */ + struct interface * ifp; /* interface where key is valid */ + RIP_AUTH_KEY * pNext; /* next auth key in the list */ + }; + +/* + * An ``interface'' is similar to an ifnet structure, + * except it doesn't contain q'ing info, and it also + * handles ``logical'' interfaces (remote gateways + * that we want to keep polling even if they go down). + * The list of interfaces which we maintain is used + * in supplying the gratuitous routing table updates. + */ +struct interface { + struct interface *int_next; + struct sockaddr int_addr; /* address on this host */ + union { + struct sockaddr intu_broadaddr; + struct sockaddr intu_dstaddr; + } int_intu; +#define int_broadaddr int_intu.intu_broadaddr /* broadcast address */ +#define int_dstaddr int_intu.intu_dstaddr /* other end of p-to-p link */ + int int_metric; /* init's routing entry */ + int int_flags; /* see below */ + /* START INTERNET SPECIFIC */ + u_long int_net; /* network # */ + u_long int_netmask; /* net mask for addr */ + u_long int_subnet; /* subnet # */ + u_long int_subnetmask; /* subnet mask for addr */ + /* END INTERNET SPECIFIC */ + char *int_name; /* from kernel if structure */ + u_short int_index; /* from kernel if structure */ + u_short int_transitions; /* times gone up-down */ + + M2_RIP2_IFSTAT_ENTRY ifStat; /* MIB-II statistics. */ + M2_RIP2_IFCONF_ENTRY ifConf; /* MIB-II configuration. */ + + FUNCPTR authHook; /* per interface authentication */ + FUNCPTR leakHook; /* per interface leak hook. */ + BOOL (*sendHook) (); /* per interface validation hook */ + RIP_AUTH_KEY * pAuthKeys; /* list of valid authe keys */ +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* + * 0x1 to 0x10 are reused from the kernel's ifnet definitions, + * the others agree with the RTS_ flags defined elsewhere. + */ +#define IFF_UP 0x1 /* interface is up */ +#define IFF_BROADCAST 0x2 /* broadcast address valid */ +#define IFF_DEBUG 0x4 /* turn on debugging */ +#define IFF_LOOPBACK 0x8 /* software loopback net */ +#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */ + +#define IFF_SUBNET 0x100000 /* interface on subnetted network */ +#define IFF_PASSIVE 0x200000 /* can't tell if up/down */ +#define IFF_INTERFACE 0x400000 /* hardware interface */ +#define IFF_REMOTE 0x800000 /* interface isn't on this machine */ +#define IFF_ROUTES_DELETED 0x1000000 /* interface routes have been deleted*/ + +struct interface *ripIfWithAddr(); +struct interface *ripIfWithAddrAndIndex(); +struct interface *ripIfWithDstAddr(); +struct interface *ripIfWithDstAddrAndIndex(); +struct interface *ripIfWithNet(); +struct interface *ripIfLookup(); + +#ifdef __cplusplus +} +#endif +#endif /* __INCinterfaceh */ diff --git a/h/rip/m2RipLib.h b/h/rip/m2RipLib.h new file mode 100644 index 0000000..45f66a1 --- /dev/null +++ b/h/rip/m2RipLib.h @@ -0,0 +1,146 @@ +/* m2RipLib.h - VxWorks MIB-II interface for RIP to SNMP Agent */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,28apr02,rae added extern C jazz (SPR #76303) +01d,12oct01,rae merge from truestack (M2_rip2IfConfAuthType_md5) +01c,30jun98,spm corrected size of storage for authentication key +01b,17apr97,gnn changed variables to follow coding convention. + added varToSet defines. +01a,01apr97,gnn written. + +*/ + +#ifndef __INCm2RipLibh +#define __INCm2RipLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* defines for local structures */ +#define AUTHKEYLEN 16 + +/* defines for errors */ +#define S_m2RipLib_IFACE_NOT_FOUND (M_m2RipLib | 1) + +/* defines for enumerated types */ + +/* enumerated values for rip2IfStatStatus */ +#define M2_rip2IfStatStatus_valid 1 +#define M2_rip2IfStatStatus_invalid 2 + +/* enumerated values for rip2IfConfAuthType */ +#define M2_rip2IfConfAuthType_noAuthentication 1 +#define M2_rip2IfConfAuthType_simplePassword 2 +#define M2_rip2IfConfAuthType_md5 3 + +/* enumerated values for rip2IfConfSend */ +#define M2_rip2IfConfSend_doNotSend 1 +#define M2_rip2IfConfSend_ripVersion1 2 +#define M2_rip2IfConfSend_rip1Compatible 3 +#define M2_rip2IfConfSend_ripVersion2 4 + +/* enumerated values for rip2IfConfReceive */ +#define M2_rip2IfConfReceive_rip1 1 +#define M2_rip2IfConfReceive_rip2 2 +#define M2_rip2IfConfReceive_rip1OrRip2 3 + +/* enumerated values for rip2IfConfStatus */ +#define M2_rip2IfConfStatus_valid 1 +#define M2_rip2IfConfStatus_invalid 2 + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * The rip2GlobalGroup family. + */ + + +typedef struct + { + unsigned long rip2GlobalRouteChanges; + unsigned long rip2GlobalQueries; + } M2_RIP2_GLOBAL_GROUP; + +/* + * The rip2IfStatEntry family. + */ + + +typedef struct + { + unsigned long rip2IfStatAddress; + unsigned long rip2IfStatRcvBadPackets; + unsigned long rip2IfStatRcvBadRoutes; + unsigned long rip2IfStatSentUpdates; + long rip2IfStatStatus; + } M2_RIP2_IFSTAT_ENTRY; + +/* + * The rip2IfConfEntry family. + */ + + +/* Defines for the fields that can be set. */ + +#define M2_RIP2_IF_CONF_DOMAIN 0x1 +#define M2_RIP2_IF_CONF_AUTH_TYPE 0x2 +#define M2_RIP2_IF_CONF_AUTH_KEY 0x4 +#define M2_RIP2_IF_CONF_SEND 0x8 +#define M2_RIP2_IF_CONF_RECEIVE 0x10 +#define M2_RIP2_IF_CONF_DEFAULT_METRIC 0x20 +#define M2_RIP2_IF_CONF_STATUS 0x40 + +typedef struct + + { + unsigned long rip2IfConfAddress; + char rip2IfConfDomain[2]; + long rip2IfConfAuthType; + char rip2IfConfAuthKey[AUTHKEYLEN]; + long rip2IfConfSend; + long rip2IfConfReceive; + long rip2IfConfDefaultMetric; + long rip2IfConfStatus; + } M2_RIP2_IFCONF_ENTRY; + +/* + * The rip2PeerEntry family. + */ + + +typedef struct + { + unsigned long rip2PeerAddress; + char* rip2PeerDomain; + unsigned long rip2PeerLastUpdate; + long rip2PeerVersion; + unsigned long rip2PeerRcvBadPackets; + unsigned long rip2PeerRcvBadRoutes; + } M2_RIP2_PEER_ENTRY; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* function declarations */ + +STATUS m2RipInit (void); +STATUS m2RipDelete (void); +STATUS m2RipGlobalCountersGet(M2_RIP2_GLOBAL_GROUP* pRipGlobal); +STATUS m2RipIfStatEntryGet(int search, M2_RIP2_IFSTAT_ENTRY* pRipIfStat); +STATUS m2RipIfConfEntryGet(int search, M2_RIP2_IFCONF_ENTRY* pRipIfConf); +STATUS m2RipIfConfEntrySet(unsigned int varToSet, + M2_RIP2_IFCONF_ENTRY* pRipIfConf); + +#ifdef __cplusplus +} +#endif +#endif /* INCm2RipLibh */ diff --git a/h/rip/rip2.h b/h/rip/rip2.h new file mode 100644 index 0000000..8e53aa5 --- /dev/null +++ b/h/rip/rip2.h @@ -0,0 +1,87 @@ +/* rip2.h - Defines specifically for RIP version 2 */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,28apr02,rae added extern C jazz (SPR #76303) +01e,12oct01,rae merge from truestack (authentication) +01d,15may97,gnn added another new define. +01c,08may97,gnn added a new define. +01b,24feb97,gnn made rip_2_pkt look more logical. +01a,14nov96,gnn written. + +*/ + +#ifndef __INCrip2h +#define __INCrip2h + +#ifdef __cplusplus +extern "C" { +#endif + +/* +DESCRIPTION + +INCLUDE FILES: +*/ + +/* includes */ + +/* defints */ +#define RIP2_AUTH_LEN 16 +#define RIP2_AUTH 0xffff +#define RIP2_DEST_OFFSET 2 +#define RIP2_GATE_OFFSET 10 +#define RIP2_MASK_OFFSET 6 + +/* typedefs */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct rip_2_pkt + { + UINT16 family; + UINT16 tag; + UINT32 dest; + UINT32 subnet; + UINT32 gateway; + UINT32 metric; + } RIP2PKT; + +typedef struct rip2AuthPktHdr + { + UINT16 authIdent; /* authentication identifier (always 0xff) */ + UINT16 authType; /* the authentication type */ + UINT16 packetLen; /* the offset (in bytes) to the digest */ + UINT8 keyId; /* key identifier used to compute digest */ + UINT8 authDataLen; /* length of the digest */ + UINT32 sequence; /* sequence number of the packet */ + UINT32 zero1; /* zeroed out */ + UINT32 zero2; /* zeroed out */ + } RIP2_AUTH_PKT_HDR; + +typedef struct rip2AuthPktTrl + { + UINT16 authIdent; /* authentication identifier (always 0xff) */ + UINT16 authTag; /* the authentication type/tag (always 0x01) */ + UINT8 authDigest [AUTH_KEY_LEN]; /* the computed packet digest */ + } RIP2_AUTH_PKT_TRL; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* globals */ + +/* locals */ + +/* forward declarations */ + +#ifdef __cplusplus +} +#endif +#endif /* __INCrip2h */ diff --git a/h/rip/ripLib.h b/h/rip/ripLib.h new file mode 100644 index 0000000..ff0fe3d --- /dev/null +++ b/h/rip/ripLib.h @@ -0,0 +1,190 @@ +/* ripLib.h - primary include file for Routing Information Protocol (RIP) */ + +/* Copyright 1996 - 2001 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1983, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)routed.h 8.1 (Berkeley) 6/2/93 + */ + +/* +modification history +-------------------- +01f,22mar02,niq Merged from Synth view, tor3_x.synth branch, ver 01h +01e,12oct01,rae merge from truestack +01d,11sep98,spm updated contents to prevent compilation problems (SPR #22352); + removed references to bloated trace commands (SPR #22350) +01c,12mar97,gnn added multicast support + added timer variables +01b,24feb97,gnn Changed include protection. + Added prototype for ripLibInit. + Put in WRS proper typedefs. +01a,26nov96,gnn created from BSD4.4 routed +*/ + + +#ifndef __INCripLibh +#define __INCripLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "sys/socket.h" +#include "net/route.h" +#include "net/if.h" +#include "rip/table.h" +#include "rip/interface.h" +#include "rip/rip2.h" + +/* + * Routing Information Protocol + * + * Derived from Xerox NS Routing Information Protocol + * by changing 32-bit net numbers to sockaddr's and + * padding stuff to 32-bit boundaries. + */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct route_info + { + struct rt_msghdr rtm; /* Route message header */ + struct sockaddr addrs [RTAX_MAX]; /* Array of sockaddrs */ + } ROUTE_INFO; + + +typedef struct netinfo { + struct sockaddr rip_dst; /* destination net/host */ + int rip_metric; /* cost of route */ +} NETINFO; + +typedef struct rip_pkt { + u_char rip_cmd; /* request/response */ + u_char rip_vers; /* protocol version # */ + u_char rip_domain[2]; /* Version 2 routing domain. */ + union { + struct netinfo ru_nets[1]; /* variable length... */ + } ripun; +#define rip_nets ripun.ru_nets +} RIP_PKT; + +typedef struct rt_iflist + { + NODE node; + char rtif_name [IFNAMSIZ]; + } RT_IFLIST; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Packet types. + */ +#define RIPCMD_REQUEST 1 /* want info */ +#define RIPCMD_RESPONSE 2 /* responding to request */ +#define RIPCMD_TRACEON 3 /* obsolete: turn tracing on */ +#define RIPCMD_TRACEOFF 4 /* obsolete: turn tracing off */ + +#define RIPCMD_MAX 5 + +#define HOPCNT_INFINITY 16 /* per Xerox NS */ +#define MAXPACKETSIZE 512 /* max broadcast size */ + +/* + * Flag values for the route hook routine + */ + +#define RIP_REDIRECT_RECD 0x1 /* Received redirect message */ +#define RIP_ROUTE_CHANGE_RECD 0x2 /* Received route change message */ + +/* +* Timer values used in managing the routing table. Complete tables are +* broadcast at periodic intervals (30 seconds by default). If changes occur +* between updates, triggered updates containing the changed entries may be +* sent to speed convergence of the routing tables. The MIN_WAITTIME and +* MAX_WAITTIME constants control the scheduling of these updates. No +* triggered update will occur within MAX_WAITTIME of a regular update. +* After the update is sent, further triggered updates will be supressed +* for a random interval between MIN_WAITTIME and MAX_WAITTIME to avoid +* flooding the network. +*/ + +#define MIN_WAITTIME 1 /* min. interval to broadcast changes */ +#define MAX_WAITTIME 5 /* max. time to delay changes */ + +/* Forward declarations for user callable routines. */ + +STATUS ripLibInit (BOOL, BOOL, BOOL, int, int, int, int, int, int); +void ripRouteShow (void); +STATUS ripAuthHookAdd (char *, FUNCPTR); +IMPORT STATUS ripAuthHook (char *, RIP_PKT *); +STATUS ripAuthHookDelete (char *); +STATUS ripLeakHookAdd (char *, FUNCPTR); +STATUS ripLeakHookDelete (char *); +STATUS ripSendHookAdd (char *, BOOL (*sendHook) (struct rt_entry *)); +STATUS ripSendHookDelete (char *); +void ripIfSearch (void); +STATUS ripIfReset (char *); +void ripFilterEnable (void); +void ripFilterDisable (void); +STATUS ripShutdown (void); +void ripDebugLevelSet (int); +void ripAuthKeyShow (UINT); +STATUS ripAuthKeyAdd (char *, UINT16, char *, UINT, UINT, ULONG); +STATUS ripAuthKeyDelete (char *, UINT16); +STATUS ripAuthKeyFind (struct interface *, UINT16, RIP_AUTH_KEY **); +STATUS ripAuthKeyFindFirst (struct interface *, RIP_AUTH_KEY **); +STATUS ripAuthKeyInMD5 (struct interface *, RIP_PKT *, UINT); +STATUS ripAuthKeyOut1MD5 (struct interface *, struct netinfo *, + RIP2_AUTH_PKT_HDR **, RIP_AUTH_KEY **); +void ripAuthKeyOut2MD5 (RIP_PKT *, UINT *, struct netinfo *, + RIP2_AUTH_PKT_HDR *, RIP_AUTH_KEY *); +STATUS ripRouteHookAdd (FUNCPTR); +STATUS ripRouteHookDelete (void); +STATUS ripRouteHook (ROUTE_INFO *, int, BOOL, int); +void ripAddrsXtract (ROUTE_INFO *, struct sockaddr **, struct sockaddr **, + struct sockaddr **, struct sockaddr **); +STATUS ripIfExcludeListAdd (char *); +STATUS ripIfExcludeListDelete (char *); +STATUS ripIfExcludeListCheck (char *); +void ripIfExcludeListShow (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCripLibh */ diff --git a/h/rip/table.h b/h/rip/table.h new file mode 100644 index 0000000..d32374a --- /dev/null +++ b/h/rip/table.h @@ -0,0 +1,179 @@ +/* table.h - definitions for managing RIP internal routing table */ + +/* Copyright 1984 - 2002 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)table.h 8.1 (Berkeley) 6/5/93 + */ + +/* +modification history +-------------------- +01i,28apr02,rae added extern C jazz (SPR #76303) +01h,22mar02,niq Merged from Synth view, tor3_x.synth branch, ver 01k +01g,24jan02,niq SPR 72415 - Added support for Route tags +01f,12oct01,rae merge from truestack ver 01h, base 01e +01e,16mar99,spm recovered orphaned code from tor1_0_1.sens1_1 (SPR #25770) +01d,29sep98,spm added support for IP group MIB (SPR #9374); removed unused + entries from rt_entry structure (SPR #22535) +01c,11sep98,spm updated contents to prevent compilation problems (SPR #22352) +01b,24feb97,gnn Reworked the rt_entry structure. +01a,26nov96,gnn created from BSD4.4 routed +*/ + +#ifndef __INCtableh +#define __INCtableh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "net/route.h" + +/* + * Routing table management daemon. + */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Routing table structure; differs a bit from kernel tables. + * + * Note: the union below must agree in the first 4 members + * so the ioctl's will work. + */ + +struct rthash { + struct rt_entry *rt_forw; + struct rt_entry *rt_back; +}; + +struct rt_entry + { + struct rt_entry *rt_forw; + struct rt_entry *rt_back; + BOOL inKernel; /* Route has been added to the kernel*/ + int rt_tag; /* Route tag - for RIP v2 only */ + short rt_refcnt; /* How many additional interfaces */ + /* need this route */ + short rt_subnets_cnt;/* How many subnetted interfaces */ + /* need an "internal" classful */ + /* network route. Set only for a */ + /* classful route (internal or */ + /* otherwise) when atleast two */ + /* subnetted interfaces or one */ + /* non-subnetted and atleast one */ + /* subnetted interface exists */ + /* for the network */ + struct rtuentry + { + u_long rtu_hash; + struct sockaddr rtu_dst; + struct sockaddr rtu_router; /* Route's gateway - route supplier */ + /* for V1 or V2 with unspecified next*/ + /* hop. Set to next hop value for */ + /* V2 if specified */ + + struct sockaddr rtu_netmask; + int rtu_orgrouter; /* router from whom route was */ + /* received. For V1 will be same as */ + /* rtu_router. For V2 might be */ + /* diffrent from rtu_router */ + int rtu_flags; + int rtu_state; + int rtu_timer; /* Route timer */ + int rtu_metric; /* Route metric */ + int rtu_proto; /* Protocol that owns the route */ + struct interface *rtu_ifp; /* Interface through which the */ + /* gateway is reachable */ + } rtu_entry; +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#define rt_hash rtu_entry.rtu_hash /* for net or host */ +#define rt_dst rtu_entry.rtu_dst /* match value */ +#define rt_router rtu_entry.rtu_router /* who to forward to */ +#define rt_orgrouter rtu_entry.rtu_orgrouter /* who received from */ +#define rt_netmask rtu_entry.rtu_netmask /* who to forward to */ +#define rt_flags rtu_entry.rtu_flags /* kernel flags */ +#define rt_timer rtu_entry.rtu_timer /* for invalidation */ +#define rt_state rtu_entry.rtu_state /* see below */ +#define rt_metric rtu_entry.rtu_metric /* cost of route */ +#define rt_ifp rtu_entry.rtu_ifp /* interface to take */ +#define rt_proto rtu_entry.rtu_proto /* protocol that owns this */ + /* route */ + +#define ROUTEHASHSIZ 32 /* must be a power of 2 */ +#define ROUTEHASHMASK (ROUTEHASHSIZ - 1) + +/* + * "State" of routing table entry. + */ +#define RTS_CHANGED 0x1 /* route has been altered recently */ +#define RTS_EXTERNAL 0x2 /* extern info, not installed or sent */ +#define RTS_INTERNAL 0x4 /* internal route, not installed */ +#define RTS_PASSIVE IFF_PASSIVE /* don't time out route */ +#define RTS_INTERFACE IFF_INTERFACE /* route is for network interface */ +#define RTS_REMOTE IFF_REMOTE /* route is for ``remote'' entity */ +#define RTS_SUBNET IFF_SUBNET /* route is for network subnet */ +#define RTS_OTHER 0x1000000 /* route installed by another */ + /* protocol */ +#define RTS_PRIMARY 0x2000000 /* This is a primary route */ + +/* + * Flags are same as kernel, with this addition for af_rtflags: + */ +#define RTF_SUBNET 0x80000 /* pseudo: route to subnet */ + +#ifndef VIRTUAL_STACK +struct rthash nethash[ROUTEHASHSIZ]; +struct rthash hosthash[ROUTEHASHSIZ]; +#endif + +struct rt_entry *rtlookup(); +struct rt_entry *rtfind(); + +IMPORT STATUS mPrivRouteEntryAdd (long, long, long, int, int, int, + struct rtentry **); +IMPORT STATUS mPrivRouteEntryDelete (long, long, long, int, int, int, + struct rtentry *); +#ifdef __cplusplus +} +#endif +#endif /* __INCtableh */ diff --git a/h/rlogLib.h b/h/rlogLib.h new file mode 100644 index 0000000..a7db01a --- /dev/null +++ b/h/rlogLib.h @@ -0,0 +1,51 @@ +/* rlogLib.h - header file for rlogLib.c */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01a,05oct90,shl created. +*/ + +#ifndef __INCrlogLibh +#define __INCrlogLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS rlogInit (void); +extern STATUS rlogin (char *host); +extern void rlogChildTask (void); +extern void rlogInTask (int sock, int ptyMfd); +extern void rlogOutTask (int sock, int ptyMfd); +extern void rlogind (void); + +#else /* __STDC__ */ + +extern STATUS rlogInit (); +extern STATUS rlogin (); +extern void rlogChildTask (); +extern void rlogInTask (); +extern void rlogOutTask (); +extern void rlogind (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrlogLibh */ diff --git a/h/rngLib.h b/h/rngLib.h new file mode 100644 index 0000000..a15e2d9 --- /dev/null +++ b/h/rngLib.h @@ -0,0 +1,149 @@ +/* rngLib.h - ring buffer subroutine library header */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02e,22oct04,aeg removed rngCreateKernel() and rngDeleteKernel() (SPR #102956) +02d,23mar04,job Removed special handling of STDC for function prototypes +02c,20jan04,dat Adding rngCreateKernel for 88437 +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01k,26may92,rrr the tree shuffle +01j,04oct91,rrr passed through the ansification filter + -changed VOID to void + -changed copyright notice +01i,06apr91,gae added NOMANUAL to avoid fooling mangen. +01h,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01g,10aug90,dnw added declaration of rngFlush(). +01f,07aug90,shl moved function declarations to end of file. +01e,22aug88,gae removed incorrect comment about using 'shorts' + for optimization. +01d,30may88,dnw changed to v4 names. +01c,10nov87,dnw changed ring pointers from shorts to ints. + rings can now be > 32K bytes. +01b,15aug84,dnw removed several macros, now routines in rngLib.cs; + only rngGetC and rngPutC remain as macros. +01a,06jun84,dnw culled from old drvLib.h +*/ + +#ifndef __INCrngLibh +#define __INCrngLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* HIDDEN */ + +/* typedefs */ + +typedef struct /* RING - ring buffer */ + { + int pToBuf; /* offset from start of buffer where to write next */ + int pFromBuf; /* offset from start of buffer where to read next */ + int bufSize; /* size of ring in bytes */ + char *buf; /* pointer to start of buffer */ + } RING; + +/* END_HIDDEN */ + +typedef RING *RING_ID; + + +/* + * The following macros are designed to do various operations on + * the RING object. By using them, users can avoid having to know + * the structure of RING. However they are intended to be very + * efficient and this is why they are macros in the first place. + * In general the parameters to them should be register variables + * for maximum efficiency. + */ + +/******************************************************************************* +* +* RNG_ELEM_GET - get one character from a ring buffer +* +* This macro gets a single character from the specified ring buffer. +* Must supply temporary variable (register int) 'fromP'. +* +* RETURNS: 1 if there was a char in the buffer to return, 0 otherwise +* +* NOMANUAL +*/ + +#define RNG_ELEM_GET(ringId, pCh, fromP) \ + ( \ + fromP = (ringId)->pFromBuf, \ + ((ringId)->pToBuf == fromP) ? \ + 0 \ + : \ + ( \ + *pCh = (ringId)->buf[fromP], \ + (ringId)->pFromBuf = ((++fromP == (ringId)->bufSize) ? 0 : fromP), \ + 1 \ + ) \ + ) + +/******************************************************************************* +* +* RNG_ELEM_PUT - put one character into a ring buffer +* +* This macro puts a single character into the specified ring buffer. +* Must supply temporary variable (register int) 'toP'. +* +* RETURNS: 1 if there was room in the buffer for the char, 0 otherwise +* +* NOMANUAL +*/ + +#define RNG_ELEM_PUT(ringId, ch, toP) \ + ( \ + toP = (ringId)->pToBuf, \ + (toP == (ringId)->pFromBuf - 1) ? \ + 0 \ + : \ + ( \ + (toP == (ringId)->bufSize - 1) ? \ + ( \ + ((ringId)->pFromBuf == 0) ? \ + 0 \ + : \ + ( \ + (ringId)->buf[toP] = ch, \ + (ringId)->pToBuf = 0, \ + 1 \ + ) \ + ) \ + : \ + ( \ + (ringId)->buf[toP] = ch, \ + (ringId)->pToBuf++, \ + 1 \ + ) \ + ) \ + ) + +/* function declarations */ + +extern BOOL rngIsEmpty (RING_ID ringId); +extern BOOL rngIsFull (RING_ID ringId); +extern RING_ID rngCreate (int nbytes); +extern int rngBufGet (RING_ID rngId, char *buffer, int maxbytes); +extern int rngBufPut (RING_ID rngId, char *buffer, int nbytes); +extern int rngFreeBytes (RING_ID ringId); +extern int rngNBytes (RING_ID ringId); +extern void rngDelete (RING_ID ringId); +extern void rngFlush (RING_ID ringId); +extern void rngMoveAhead (RING_ID ringId, int n); +extern void rngPutAhead (RING_ID ringId, char byte, int offset); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrngLibh */ diff --git a/h/romfs.h b/h/romfs.h new file mode 100644 index 0000000..8e8a7d2 --- /dev/null +++ b/h/romfs.h @@ -0,0 +1,111 @@ +/*- + * Copyright (c) 1997 Berkeley Software Design, Inc. + * + * The Berkeley Software Design Inc. software License Agreement specifies + * the terms and conditions for redistribution. + * + * BSDI $Id: romfs.h,v 2.5 2001/10/30 17:09:27 polk Exp $ + */ + +#define RF_MAGIC "RFS1" +/* + * Round x to a 4 byte boundry + */ +#define LWROUND(x) (((x) + 3) & ~3) + +/* + * The rftime_t structure is a fixed size timespec structure + * Since it is used in an on-disk layout we cannot allow it to change + * size if a time_t or long have a size other than 32 bits. + */ +typedef struct { + u_int32_t tv_sec; /* Seconds since 00:00 1/1/1970 */ + u_int32_t tv_nsec; /* nanoseconds */ +} rftime_t; + +/* + * Each file is preceeded by an rfnode_t structure. + * The next rfnode_t structure is located at RFNEXTNODE(&rfn) + * Nodes are always stored on 4 byte boundries + * All meta data on disk is stored in network byte order (big endian) + */ +typedef struct rfnode_t { + u_int32_t rf_size; /* size of file */ + u_int16_t rf_mode; + int16_t rf_nlink; + rftime_t rf_ctime; + u_int32_t rf_flags; + u_int32_t rf_uid; + u_int32_t rf_gid; + u_int32_t rf_rdev; + u_int32_t rf_space; /* space allocated for file */ + + /* + * The entries below are not stored in the filesystem. + * but are computed when the rfnode_t block is read + */ + u_int32_t rf_offset; /* Offset into device */ + u_int32_t rf_seekp; /* Our current seek pointer */ +#if defined(KERNEL) && !defined(STANDALONE) + struct lock rf_lock; /* node lock */ + dev_t rf_dev; /* Device where inode resides */ + struct vnode *rf_vnode; /* Back pointer to the vnode */ + struct vnode *rf_devvp; /* Back pointer to the device vnode */ + struct rfnode_t *rf_next; + struct rfnode_t **rf_prev; +#endif +} rfnode_t; + +#define VTOI(vp) ((struct rfnode_t *)(vp)->v_data) +#define ITOV(ip) ((ip)->rf_vnode) + +#define RFNODESZ ((char *)(&(((rfnode_t *)0)->rf_offset)) - (char *)0) + +/* + * Given a pointer to an rfnode_t read from the filesystem, return a pointer + * to the next file + */ +#define RFNEXTNODE(rfp) ((rfp)->rf_offset + RFNODESZ + (rfp)->rf_space) + +/* + * Names are up to 255 bytes long + * The actual structure is truncated to the lowest long word boundry which + * allows the entire name to be stored. + * rd_offset is stored in network byte order (big endian) + */ +typedef struct { + u_int32_t rd_offset; /* "inode" number of entry */ + u_char rd_type; /* file type from */ + u_char rd_namelen; /* length of string in rd_name */ + char rd_name[255]; /* name of entry */ +} rfdir_t; + +#define RFDIRHDR (((rfdir_t *)0)->rd_name - (char *)0) + +/* + * Given a pointer to an rfdir_t entry return the offset of the next rfdir_t + * entry. In the current director. Note that an offset of 0 implies the + * end of the directory and all other fields are invalid. + */ +#define RFDIRSZ(n) LWROUND(((char *)(&(((rfdir_t *)0)->rd_name[strlen(n)])) - (char *)0)) +#define RFNDIRSZ(n) LWROUND(((char *)(&(((rfdir_t *)0)->rd_name[n])) - (char *)0)) +#define RFNEXTDIR(rfp, rdp) LWROUND((rfp)->rf_offset + (rdp)->rd_offset) + +struct open_file { + void *f_devdata; /* device specific data */ + void *f_fsdata; /* file system specific data */ +}; + +#if defined(STANDALONE) || defined(ROMFS_PROTOTYPES) +int rfs_open __P((char *, struct open_file *)); +int rfs_read __P((struct open_file *, char *, u_int, u_int *)); +off_t rfs_seek __P((struct open_file *, off_t, int)); +#ifndef SMALL +int rfs_close __P((struct open_file *)); +int rfs_write __P((struct open_file *, char *, u_int, u_int *)); +int rfs_stat __P((struct open_file *, struct stat *)); +int rfs_ls __P((struct open_file *)); +#endif +int rfsread __P((struct open_file *, u_int, char *, u_int *)); +#endif +void romfs_ntoh __P((rfnode_t *)); diff --git a/h/romfsDrv.h b/h/romfsDrv.h new file mode 100644 index 0000000..7992c53 --- /dev/null +++ b/h/romfsDrv.h @@ -0,0 +1,38 @@ +/* romfsDrv.h - header file for romfsDrv.c */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,14may03,md created. +*/ + +#ifndef __INCromfsDrvh +#define __INCromfsDrvh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "blkIo.h" + +#define ROMFS_BLOCK_SIZE 512 /* block size for I/O operations */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern BLK_DEV *romfsBlkDevCreate (char *addr, int size, int offset); + +#else + +extern BLK_DEV *romBlkDevCreate (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCromfsDrvh */ diff --git a/h/romfsLib.h b/h/romfsLib.h new file mode 100644 index 0000000..28bbf24 --- /dev/null +++ b/h/romfsLib.h @@ -0,0 +1,56 @@ +/* romfsLib.h - ROMFS file system driver */ + +/* Copyright 2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,05may03,md written +*/ + +#ifndef romfsLib_h +#define romfsLib_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include + + /* block size of underlying device */ +#define DEV_BSIZE ROMFS_BLOCK_SIZE + + /* magic number to identify ROMFS_VOL_DESC */ +#define ROMFS_MAGIC 0xDEADF00D + +typedef struct romfsVolDescr /* volume descriptor, one per mounted volume */ + { + DEV_HDR devHdr; /* for adding to device table */ + BLK_DEV *pBlkDev; /* pointer to block device structure */ + int magic; /* magic number for identifying structure */ + u_char cache[DEV_BSIZE]; /* buffer cache for one block */ + int cBlockNum; /* cached block number */ + SEM_ID devSem; /* device mutual-exclusion semaphore */ +} ROMFS_VOL_DESC; + +typedef ROMFS_VOL_DESC * ROMFS_VOL_DESC_ID; + +/* user-callable functions prototypes */ + +#if defined(__STDC__) || defined(__cplusplus) +extern ROMFS_VOL_DESC_ID romfsFsDevCreate( char * devName, BLK_DEV * pBlkDev ); +#else /* __STDC__ */ +extern ROMFS_VOL_DESC_ID romfsFsDevCreate (); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* romfsLib_h */ diff --git a/h/routeEnhLib.h b/h/routeEnhLib.h new file mode 100644 index 0000000..0f1c0c7 --- /dev/null +++ b/h/routeEnhLib.h @@ -0,0 +1,242 @@ +/* routeEnhLib.h - definitions for the route interface library */ + +/* Copyright 1984 - 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01u,24jan02,niq fixed call to new address message hook (SPR #71670) +01t,10sep01,niq Make RIP work on host stack - SPR 70188 +01s,03aug01,spm added flag to prevent incorrect interface reference count +01r,31jul01,spm fixed return type of callback handler to remove warning +01q,27jul01,spm removed unused handle from add and delete routines +01p,27jul01,spm updated registration process (WRN 1012 design, sec. 2.2.3) +01o,25jul01,spm added routine to reorganize any duplicate routes after + weight change with routing sockets +01n,25jul01,spm added new messages to report replacement of the primary route +01m,23jul01,niq Add the prototype for routeTableWalk and removed the + Fastpath kludge. +01l,22jun01,spm moved additional metric values to provide access with + routing sockets; added renamed route classification flag + to descriptor structure for callback routines +01m,25jun01,spm adding new socket messages. +01l,25jun01,spm added include file for RT_PROTO_SET/GET macro definitions +01k,19jun01,spm added routing socket messages (WRN 1012 design, sec. 2.2.7.1); + removed unused registration handle +01j,19jun01,spm cleanup: removed excess typecast from macro +01i,12jun01,niq Add the routeAgeSet routine prototype +01h,09jun01,spm added route weights (WRN 1012 design, section 2.3.6) +01g,10may01,spm added new route lookup routine +01f,03may01,niq Remove ROUTE_MOD stuff. Use ROUTE_CHANGE instead +01e,02may01,niq Correcting mod history +01d,01may01,niq Adding definition of ROUTE_MOD needed by Fastpath +01c,01may01,niq Merging Fastpath changes from tor2_0.open_stack branch + version 01h (routeEnhLib.h@@/main/tor2_0.open_stack/7) +01b,01may01,spm added routing socket messages for unified interface +01a,29mar01,spm file creation: copied from version 01f of tor2_0.open_stack + branch (wpwr VOB) for unified code base +*/ + +/* +DESCRIPTION +This file includes function prototypes for the routing interface, as well as the +route entry structures. +*/ + +#ifndef _INCrouteEnhLibh +#define _INCrouteEnhLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "net/socketvar.h" +#include "net/radix.h" +#include "net/mbuf.h" +#include "sys/socket.h" /* needed for route.h */ +#include "net/route.h" +#include "netinet/in.h" /* RT_PROTO_SET and RT_PROTO_GET */ +#include "m2Lib.h" + +#define MAX_ROUTE_PROTO 20 + +/* routeTag values understood by routing protocols */ +#define RFC1745_DEFAULT_ROUTE_TAG 0x0000 /* manual/default route */ +#define RFC1745_CONF_EXTERNAL_ROUTE_TAG 0x8000 /* configured external routes + * IP static to OSPF and BGP + */ +#define RFC1745_EGP_ORIGEGP_ROUTE_TAG 0x9000 /* BGP routes reached via OSPF */ +#define RFC1745_STUB_ASBR_BGP_ROUTE_TAG 0xa000 /* BGP routes at ASBR to STUB AS */ +#define RFC1745_IGP_TO_OSPF_ROUTE_TAG 0xc000 /* IGP dynamic routes */ +#define RFC1745_EGP_ORIGIGP_ROUTE_TAG_PER_AS 0xd000 /* BGP routes with orig IGP, + * next hop AS + */ +#define RFC1745_BGP_TO_OSPF_ROUTE_TAG 0xe000 /* BGP origin */ + +/* Operations performed */ +#define ROUTE_ADD 1 +#define ROUTE_DEL 2 +#define ROUTE_CHANGE 3 +#define ROUTE_IF_UP 4 +#define ROUTE_IF_DOWN 5 +#define ROUTE_IF_NEWADDR 6 +#define ROUTE_IF_DELADDR 7 +#define ROUTE_CACHE_RESET 8 +#define ROUTE_MISS 9 /* internal operation only: not published message */ +#define ROUTE_CLONE_FAIL 10 +#define ROUTE_SEARCH_FAIL 11 +#define ROUTE_GATEWAY_CHANGE 12 +#define ROUTE_OLD 13 +#define ROUTE_NEW 14 + +/* special case, when route is not deleted during routeEntryDel() */ +#define ROUTE_NOT_DELETED 0 + +/* + * Kernel routing table entry + * + * The routeEntry structure is an extension to the rtentry structure defined in + * route.h. The extension is to support some addtional members defined in RFC 1213 + * and multiple route entries by the same/different routing protocols. + * + * Since routeEntry is an extension of rtentry and currently rtrequest() is the only + * place where rtentry structure is allocated, the modification for allocating + * routeEntry instead of rtentry is binary backward backward compatible. + * + */ + + +typedef struct routeNode + { + struct routeEntry* pFrwd; /* forward pointer : for list traversal */ + struct routeEntry* pBack; /* backward pointer : for list traversal */ + } ROUTE_NODE; + + +typedef struct routeEntry + { + struct rtentry rtEntry; /* defined in net/route.h */ + BOOL primaryRouteFlag; /* IP forwarding route or alternate? */ + ROUTE_NODE sameNode; /* reference to multiple route entries + * for the same destination added by + * the same routing protocol. + */ + ROUTE_NODE diffNode; /* reference to multiple route entries + * for the same destination added by + * different routing protocols. + */ + } ROUTE_ENTRY; + +/* Macros to access the fields of ROUTE_ENTRY */ + +#define ROUTE_ENTRY_KEY(r) ((struct sockaddr *)(((r)->rtEntry) \ + .rt_nodes[0].rn_u.rn_leaf.rn_Key)) + +#define ROUTE_ENTRY_MASK(r) ((struct sockaddr *)(((r)->rtEntry) \ + .rt_nodes[0].rn_u.rn_leaf.rn_Mask)) + + +#define ROUTE_ENTRY_GATEWAY(r) ((r)->rtEntry.rt_gateway) +#define ROUTE_ENTRY_FLAGS(r) ((r)->rtEntry.rt_flags) + + +/* Route description structure + * + * This structure contains all the route information that needs to be stored and + * and retrived from the routing table. This structure is provided by the + * routing protocol, while adding (routeEntryADd()) or + * searching (routeEntryLookup()) a route. + + * When the lookup routine is called, searching for a specific route, the + * looked-up routing information is copied on to the following structure. + * The lookup routine is usually called by the routing protocol to figure out the + * interface to be used for a particular gateway. + * IP forwarding uses the internal BSD API and has direct access to ROUTE_ENTRY + * structure. + * + */ + +typedef struct routeDesc + { + struct sockaddr* pDstAddr; /* destination network/host address */ + struct sockaddr* pNetmask; /* network mask */ + struct sockaddr* pGateway; /* gateway address */ + short flags; /* up/down, host/net? defined in /h/net/route.h */ + short protoId; /* routing protocol ID: m2Lib.h */ + struct ifnet* pIf; /* interface to be used with this route, set to + * NULL for routeEntryAdd(). + */ + long value1; /* metrics as defined by RFC 1213 */ + long value2; + long value3; + long value4; + long value5; + long routeTag; /* property associated with the route, values are + * described above + */ + u_char weight; + + /* Read-only settings: valid in received messages */ + + BOOL primaryRouteFlag; /* IP forwarding route or alternate? */ + void *pData; /* additional message data, based on type */ + } ROUTE_DESC; + +/* routing system registration structure: see routeStorageBind() routine */ + +typedef struct routeBind + { + NODE node; /* internal connection for linked list */ + void (*pRouteMsgRtn) (int type, ROUTE_DESC *pDesc, void *pArg); + void * pArg; + } ROUTE_BINDING; + + +/* Routing Interface APIs */ + +/* Initialization */ +IMPORT STATUS routeIntInit(); + +/* Modification APIs */ +IMPORT STATUS routeEntryAdd (ROUTE_DESC * pRouteDesc); +IMPORT STATUS routeEntryDel (ROUTE_DESC* pRouteDesc); +IMPORT STATUS routeAgeSet (struct sockaddr *, struct sockaddr *, int, int); +IMPORT STATUS routeMetricSet (struct sockaddr *, struct sockaddr *, int, int); + +/* Route lookup */ +IMPORT STATUS routeEntryLookup (struct sockaddr *, ULONG *, int, + ROUTE_DESC *); +IMPORT STATUS routeTableWalk (struct sockaddr *, int, VOIDFUNCPTR, void *); + +/* Registration routines */ +IMPORT void * routeStorageBind (void (*)(int, ROUTE_DESC *, void *), void *); + +IMPORT STATUS routeStorageUnbind (void *); + +/* externs */ +IMPORT STATUS rtrequestAddEqui (struct sockaddr *, struct sockaddr *, + struct sockaddr *, short, short, UCHAR, + BOOL, BOOL, ROUTE_ENTRY **); +IMPORT STATUS rtrequestDelEqui (struct sockaddr *, struct sockaddr *, + struct sockaddr *, short, short, + BOOL, BOOL, ROUTE_ENTRY **); +IMPORT void routeWeightUpdate (ROUTE_ENTRY *, short, ROUTE_ENTRY *, + struct sockaddr *, UCHAR); +IMPORT void routeEntryFree (ROUTE_ENTRY *, BOOL); +IMPORT STATUS routeProtoShow(); + +/* Interfaces for internal stack events */ + +extern void (*rtIfaceMsgHook) (struct ifnet *); +extern void (*rtMissMsgHook) (int, struct rt_addrinfo *, int, int); +#ifdef ROUTER_STACK +extern void (*rtNewAddrMsgHook) (int, struct ifaddr *, struct rtentry *); +#else +extern void (*rtNewAddrMsgHook) (int, struct ifaddr *, int, struct rtentry *); +#endif /* ROUTER_STACK */ + +#ifdef _cplusplus +} +#endif + +#endif /* _INCrouteEnhLibh */ diff --git a/h/routeLib.h b/h/routeLib.h new file mode 100644 index 0000000..8b4d6a7 --- /dev/null +++ b/h/routeLib.h @@ -0,0 +1,73 @@ +/* routeLib.h - header file for the network routing library */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02f,26jun98,spm added mRouteEntryDelete prototype +02e,10jul97,rjc added flag param to mRouteDelete. +02d,11apr97,rjc changed interface of m2RouteEntryAdd +i02c,14feb97,rjc added mask versions of route add etc +02d,11jul94,dzb added prototype for routeNetAdd() (SPR #3395). +02c,22sep92,rrr added support for c++ +02b,27jul92,elh moved routeShow to netShow. +02a,04jul92,jcf cleaned up. +01g,26may92,rrr the tree shuffle +01f,02mar92,elh added routeCmd. +01e,04oct91,rrr passed through the ansification filter + -changed VOID to void + -changed copyright notice +01d,05oct90,shl added ANSI function prototypes. + added copyright notice. +01c,07aug90,shl added IMPORT type to function declarations. +01b,16nov87,llk documentation +01a,01nov87,llk written +*/ + +#ifndef __INCrouteLibh +#define __INCrouteLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" + + +/* status codes */ + +#define S_routeLib_ILLEGAL_INTERNET_ADDRESS (M_routeLib | 1) +#define S_routeLib_ILLEGAL_NETWORK_NUMBER (M_routeLib | 2) + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS routeAdd (char *destination, char *gateway); +extern STATUS routeDelete (char *destination, char *gateway); +extern STATUS routeNetAdd (char *destination, char *gateway); +extern STATUS routeCmd (int destInetAddr, int gateInetAddr, int ioctlCmd); +extern STATUS mRouteAdd (char *, char *, long, int, int); +extern STATUS mRouteEntryAdd (long , long, long, int, int, int); +extern STATUS mRouteEntryDelete (long , long, long, int, int, int); +extern STATUS mRouteDelete (char *, long, int, int); + +#else /* __STDC__ */ + +extern STATUS routeAdd (); +extern STATUS routeDelete (); +extern STATUS routeNetAdd (); +extern STATUS routeCmd (); +extern STATUS mRouteAdd (); +extern STATUS mRouteEntryAdd (); +extern STATUS mRouteEntryDelete (); +extern STATUS mRouteDelete (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrouteLibh */ diff --git a/h/rpc/auth.h b/h/rpc/auth.h new file mode 100644 index 0000000..e5e66b0 --- /dev/null +++ b/h/rpc/auth.h @@ -0,0 +1,216 @@ +/* auth.h - authentication interface */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +* Sun RPC is a product of Sun Microsystems, Inc. and is provided for +* unrestricted use provided that this legend is included on all tape +* media and as a part of the software program in whole or part. Users +* may copy or modify Sun RPC without charge, but are not authorized +* to license or distribute it to anyone else except as part of a product or +* program developed by the user. +* +* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE +* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR +* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. +* +* Sun RPC is provided with no support and without any obligation on the +* part of Sun Microsystems, Inc. to assist in its use, correction, +* modification or enhancement. +* +* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE +* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC +* OR ANY PART THEREOF. +* +* In no event will Sun Microsystems, Inc. be liable for any lost revenue +* or profits or other special, indirect and consequential damages, even if +* Sun has been advised of the possibility of such damages. +* +* Sun Microsystems, Inc. +* 2550 Garcia Avenue +* Mountain View, California 94043 +*/ +/* @(#)auth.h 1.1 86/02/03 SMI */ + +/* +* auth.h, Authentication interface. +* +* Copyright (C) 1984, Sun Microsystems, Inc. +* +* The data structures are completely opaque to the client. The client +* is required to pass a AUTH * to routines that create rpc +* "sessions". +*/ + +/* +modification history +-------------------- +01i,22sep92,rrr added support for c++ +01h,26may92,rrr the tree shuffle +01g,26feb92,wmd added #pragma align 1 to align properly data structures. +01f,23feb91,del removed useless checking and typedef of u_int32 as u_long. +01e,24oct90,shl deleted redundant function declarations. +01d,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01c,30apr90,gae fixed definition of u_int32 -- dependent of compiler define. +01b,26oct89,hjb upgraded to release 4.0 +*/ + +#ifndef __INCauthh +#define __INCauthh + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +#define MAX_AUTH_BYTES 400 +#define MAXNETNAMELEN 255 /* maximum length of network user's name - 4.0 */ + + +/* + * Status returned from authentication check + */ +enum auth_stat { + AUTH_OK=0, + /* + * failed at remote end + */ + AUTH_BADCRED=1, /* bogus credentials (seal broken) */ + AUTH_REJECTEDCRED=2, /* client should begin new session */ + AUTH_BADVERF=3, /* bogus verifier (seal broken) */ + AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */ + AUTH_TOOWEAK=5, /* rejected due to security reasons */ + /* + * failed locally + */ + AUTH_INVALIDRESP=6, /* bogus response verifier */ + AUTH_FAILED=7 /* some unknown reason */ +}; + +union des_block { + struct { + u_long high; + u_long low; + } key; + char c[8]; +}; + +typedef union des_block des_block; + + +/* + * Authentication info. Opaque to client. + */ +struct opaque_auth { + enum_t oa_flavor; /* flavor of auth */ + caddr_t oa_base; /* address of more auth stuff */ + u_int oa_length; /* not to exceed MAX_AUTH_BYTES */ +}; + + +/* + * Auth handle, interface to client side authenticators. + */ +typedef struct { + struct opaque_auth ah_cred; + struct opaque_auth ah_verf; + union des_block ah_key; + struct auth_ops { + void (*ah_nextverf)(); + int (*ah_marshal)(); /* nextverf & serialize */ + int (*ah_validate)(); /* validate varifier */ + int (*ah_refresh)(); /* refresh credentials */ + void (*ah_destroy)(); /* destroy this structure */ + } *ah_ops; + caddr_t ah_private; +} AUTH; + + +/* + * Authentication ops. + * The ops and the auth handle provide the interface to the authenticators. + * + * AUTH *auth; + * XDR *xdrs; + * struct opaque_auth verf; + */ +#define AUTH_NEXTVERF(auth) \ + ((*((auth)->ah_ops->ah_nextverf))(auth)) +#define auth_nextverf(auth) \ + ((*((auth)->ah_ops->ah_nextverf))(auth)) + +#define AUTH_MARSHALL(auth, xdrs) \ + ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) +#define auth_marshall(auth, xdrs) \ + ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) + +#define AUTH_VALIDATE(auth, verfp) \ + ((*((auth)->ah_ops->ah_validate))((auth), verfp)) +#define auth_validate(auth, verfp) \ + ((*((auth)->ah_ops->ah_validate))((auth), verfp)) + +#define AUTH_REFRESH(auth) \ + ((*((auth)->ah_ops->ah_refresh))(auth)) +#define auth_refresh(auth) \ + ((*((auth)->ah_ops->ah_refresh))(auth)) + +#define AUTH_DESTROY(auth) \ + ((*((auth)->ah_ops->ah_destroy))(auth)) +#define auth_destroy(auth) \ + ((*((auth)->ah_ops->ah_destroy))(auth)) + + +extern struct opaque_auth _null_auth; + + +/* + * These are the various implementations of client side authenticators. + */ + +/* + * Unix style authentication + * AUTH *authunix_create(machname, uid, gid, len, aup_gids) + * char *machname; + * int uid; + * int gid; + * int len; + * int *aup_gids; + */ +extern AUTH *authdes_create (); /* 4.0 */ + +#define AUTH_NONE 0 /* no authentication -- 4.0 */ +#define AUTH_NULL 0 /* backward compatibility */ +#define AUTH_UNIX 1 /* unix style (uid, gids) */ +#define AUTH_SHORT 2 /* short hand unix style */ +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern AUTH * authnone_create (void); +extern AUTH * authunix_create (char *machname, int uid, int gid, + int len, int *aup_gids); +extern AUTH * authunix_create_default(void); /* takes no parameters */ +extern bool_t xdr_des_block (XDR *xdrs, union des_block *blkp); + +#else + +extern AUTH * authunix_create (); +extern AUTH * authnone_create (); +extern AUTH * authunix_create_default(); /* takes no parameters */ +extern bool_t xdr_des_block (); + +#endif /* __STDC__ */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCauthh */ diff --git a/h/rpc/auth_unix.h b/h/rpc/auth_unix.h new file mode 100644 index 0000000..832d4f9 --- /dev/null +++ b/h/rpc/auth_unix.h @@ -0,0 +1,113 @@ +/* auth_unix.h - Protocol for UNIX style authentication parameters for RPC */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* @(#)auth_unix.h 1.1 86/02/03 SMI */ + +/* + * auth_unix.h, Protocol for UNIX style authentication parameters for RPC + * + * Copyright (C) 1984, Sun Microsystems, Inc. + */ + +/* +modification history +-------------------- +01g,22sep92,rrr added support for c++ +01f,26may92,rrr the tree shuffle +01e,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01d,24oct90,shl moved authunix_create and authunix_create_default prototypes + to auth.h. deleted redundant function declarations. +01c,05oct90,shl added ANSI function prototypes. + added copyright notice. +01b,26oct89,hjb upgraded to release 4.0 +*/ + +#ifndef __INCauth_unixh +#define __INCauth_unixh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The system is very weak. The client uses no encryption for it + * credentials and only sends null verifiers. The server sends backs + * null verifiers or optionally a verifier that suggests a new short hand + * for the credentials. + */ + +/* The machine name is part of a credential; it may not exceed 255 bytes */ +#define MAX_MACHINE_NAME 255 + +/* gids compose part of a credential; there may not be more than 10 of them */ +#define NGRPS 16 /* 4.0 */ + +/* + * Unix style credentials. + */ +struct authunix_parms { + u_long aup_time; + char *aup_machname; + int aup_uid; + int aup_gid; + u_int aup_len; + int *aup_gids; +}; + + +/* + * If a response verifier has flavor AUTH_SHORT, + * then the body of the response verifier encapsulates the following structure; + * again it is serialized in the obvious fashion. + */ +struct short_hand_verf { + struct opaque_auth new_cred; +}; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern bool_t xdr_authunix_parms (XDR *xdrs, struct authunix_parms *p); + +#else + +extern bool_t xdr_authunix_parms (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCauth_unixh */ diff --git a/h/rpc/clnt.h b/h/rpc/clnt.h new file mode 100644 index 0000000..da763ce --- /dev/null +++ b/h/rpc/clnt.h @@ -0,0 +1,433 @@ +/* clnt.h - Client side remote procedure call interface. */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* @(#)clnt.h 1.1 86/02/03 SMI */ + +/* + * clnt.h - Client side remote procedure call interface. + * + * Copyright (C) 1984, Sun Microsystems, Inc. + */ + +/* +modification history +-------------------- +01l,21jul05,vvv fixed C++ build problem (SPR #99889) +01k,22sep92,rrr added support for c++ +01j,07sep92,smb added includes of sys/times.h, rpc/xdr.h, rpc/auth.h +01i,26may92,rrr the tree shuffle + -changed includes to have absolute path from h/ +01h,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01g,01may01,elh removed clnt_tcpInit. +01f,10jan91,shl fixed prototype of callrpc(), included in.h. +01e,25oct90,dnw changed clnt_tcpInit from int to void. +01d,24oct90,shl commented out redundant function declarations. +01c,05oct90,shl added ANSI function prototypes. + added copyright notice. +01b,26oct89,hjb upgraded to release 4.0 +*/ + +#ifndef __INCclnth +#define __INCclnth + +#ifdef __cplusplus +extern "C" { +#endif + +#include "netinet/in.h" +#include "sys/times.h" +#include "rpc/xdr.h" +#include "rpc/auth.h" + +/* + * Rpc calls return an enum clnt_stat. This should be looked at more, + * since each implementation is required to live with this (implementation + * independent) list of errors. + */ +enum clnt_stat { + RPC_SUCCESS=0, /* call succeeded */ + /* + * local errors + */ + RPC_CANTENCODEARGS=1, /* can't encode arguments */ + RPC_CANTDECODERES=2, /* can't decode results */ + RPC_CANTSEND=3, /* failure in sending call */ + RPC_CANTRECV=4, /* failure in receiving result */ + RPC_TIMEDOUT=5, /* call timed out */ + /* + * remote errors + */ + RPC_VERSMISMATCH=6, /* rpc versions not compatible */ + RPC_AUTHERROR=7, /* authentication error */ + RPC_PROGUNAVAIL=8, /* program not available */ + RPC_PROGVERSMISMATCH=9, /* program version mismatched */ + RPC_PROCUNAVAIL=10, /* procedure unavailable */ + RPC_CANTDECODEARGS=11, /* decode arguments error */ + RPC_SYSTEMERROR=12, /* generic "other problem" */ + + /* + * callrpc errors + */ + RPC_UNKNOWNHOST=13, /* unknown host name */ + RPC_UNKNOWNPROTO=17, /* unknown protocol -- 4.0 */ + + /* + * _ create errors + */ + RPC_PMAPFAILURE=14, /* the pmapper failed in its call */ + RPC_PROGNOTREGISTERED=15, /* remote program is not registered */ + /* + * unspecified error + */ + RPC_FAILED=16 +}; + + +/* + * Error info. + */ +struct rpc_err { + enum clnt_stat re_status; + union { + int RE_errno; /* realated system error */ + enum auth_stat RE_why; /* why the auth error occurred */ + struct { + u_long low; /* lowest verion supported */ + u_long high; /* highest verion supported */ + } RE_vers; + struct { /* maybe meaningful if RPC_FAILED */ + long s1; + long s2; + } RE_lb; /* life boot & debugging only */ + } ru; +#define re_errno ru.RE_errno +#define re_why ru.RE_why +#define re_vers ru.RE_vers +#define re_lb ru.RE_lb +}; + + +/* + * Client rpc handle. + * Created by individual implementations, see e.g. rpc_udp.c. + * Client is responsible for initializing auth, see e.g. auth_none.c. + */ + +typedef struct { + AUTH *cl_auth; /* authenticator */ + struct clnt_ops *cl_ops; + caddr_t cl_private; /* private stuff */ +} CLIENT; + +struct clnt_ops { +#if defined(__STDC__) || defined(__cplusplus) + enum clnt_stat (*cl_call)(CLIENT *, u_long, xdrproc_t, caddr_t, + xdrproc_t, caddr_t, + struct timeval timeout); /* call remote procedure */ + void (*cl_abort)(CLIENT *); /* abort a call */ + void (*cl_geterr)(CLIENT *, struct rpc_err *); /* get specific error code */ + bool_t (*cl_freeres)(CLIENT *, xdrproc_t xres, + caddr_t resp); /* frees results */ + void (*cl_destroy)(CLIENT *); /* destroy this structure */ + bool_t (*cl_control)(CLIENT *, u_int, char *); /* the ioctl() of rpc -- 4.0 */ +#else + enum clnt_stat (*cl_call)(); /* call remote procedure */ + void (*cl_abort)(); /* abort a call */ + void (*cl_geterr)(); /* get specific error code */ + bool_t (*cl_freeres)(); /* frees results */ + void (*cl_destroy)(); /* destroy this structure */ + bool_t (*cl_control)(); /* the ioctl() of rpc -- 4.0 */ +#endif +}; + + +/* + * client side rpc interface ops + * + * Parameter types are: + * + */ + +/* + * enum clnt_stat + * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout) + * CLIENT *rh; + * u_long proc; + * xdrproc_t xargs; + * caddr_t argsp; + * xdrproc_t xres; + * caddr_t resp; + * struct timeval timeout; + */ +#define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \ + ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) +#define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \ + ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) + +/* + * void + * CLNT_ABORT(rh); + * CLIENT *rh; + */ +#define CLNT_ABORT(rh) ((*(rh)->cl_ops->cl_abort)(rh)) +#define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh)) + +/* + * struct rpc_err + * CLNT_GETERR(rh); + * CLIENT *rh; + */ +#define CLNT_GETERR(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) +#define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) + + +/* + * bool_t + * CLNT_FREERES(rh, xres, resp); + * CLIENT *rh; + * xdrproc_t xres; + * caddr_t resp; + */ +#define CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) +#define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) + +/* + * bool_t + * CLNT_CONTROL(cl, request, info) + * CLIENT *cl; + * u_int request; + * char *info; + */ +#define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) /* 4.0 */ +#define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) /* 4.0 */ + +/* + * control operations that apply to both udp and tcp transports + */ +#define CLSET_TIMEOUT 1 /* set timeout (timeval) */ +#define CLGET_TIMEOUT 2 /* get timeout (timeval) */ +#define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */ +/* + * udp only control operations + */ +#define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */ +#define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */ + +/* + * void + * CLNT_DESTROY(rh); + * CLIENT *rh; + */ +#define CLNT_DESTROY(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) +#define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) + + +/* + * RPCTEST is a test program which is accessable on every rpc + * transport/port. It is used for testing, performance evaluation, + * and network administration. + */ + +#define RPCTEST_PROGRAM ((u_long)1) +#define RPCTEST_VERSION ((u_long)1) +#define RPCTEST_NULL_PROC ((u_long)2) +#define RPCTEST_NULL_BATCH_PROC ((u_long)3) + +/* + * By convention, procedure 0 takes null arguments and returns them + */ + +#define NULLPROC ((u_long)0) + +/* + * Below are the client handle creation routines for the various + * implementations of client side rpc. They can return NULL if a + * creation failure occurs. + */ + +/* + * Memory based rpc (for speed check and testing) + * CLIENT * + * clntraw_create(prog, vers) + * u_long prog; + * u_long vers; + */ + +/* extern CLIENT *clntraw_create(); */ + +/* + * Generic client creation routine. Supported protocols are "udp" and "tcp" + */ + +/* extern CLIENT * clnt_create(host, prog, vers, prot); */ /* 4.0 */ + +/* + char *host; -- hostname + u_long prog; -- program number + u_long vers; -- version number + char *prot; -- protocol +*/ + +/* + * TCP based rpc + * CLIENT * + * clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz) + * struct sockaddr_in *raddr; + * u_long prog; + * u_long version; + * register int *sockp; + * u_int sendsz; + * u_int recvsz; + */ + +/* extern CLIENT *clnttcp_create(); */ + +/* + * UDP based rpc. + * CLIENT * + * clntudp_create(raddr, program, version, wait, sockp) + * struct sockaddr_in *raddr; + * u_long program; + * u_long version; + * struct timeval wait; + * int *sockp; + * + * Same as above, but you specify max packet sizes. + * CLIENT * + * clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz) + * struct sockaddr_in *raddr; + * u_long program; + * u_long version; + * struct timeval wait; + * int *sockp; + * u_int sendsz; + * u_int recvsz; + */ + +/* extern CLIENT *clntudp_create(); */ +/* extern CLIENT *clntudp_bufcreate(); */ + +/* + * Print why creation failed + */ + +/* void clnt_pcreateerror(char *msg); */ /* stderr -- 4.0 */ +/* char *clnt_spcreateerror(char *msg); */ /* string -- 4.0 */ + +/* + * Like clnt_perror () but is more verbose in its output + */ + +/* void clnt_perrno(enum clnt_stat num); */ /* stderr -- 4.0 */ + +/* + * Print an english error message, given the client error code + */ + +/* void clnt_perror(CLIENT *clnt, char *msg); */ /* stderr -- 4.0 */ +/* char *clnt_sperror(CLIENT *clnt, char *msg);*/ /* string -- 4.0 */ + + +/* + * If a creation fails, the following allows the user to figure out why. + */ + +struct rpc_createerr { + enum clnt_stat cf_stat; + struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */ +}; + +/* XXX this is now in the taskModuleList */ +/* XXX extern struct rpc_createerr rpc_createerr; */ + +/* + * copy error message to buffer. + */ + +/* char *clnt_sperrno(enum clnt_stat num); */ /* string -- 4.0 */ + +#define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */ +#define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern CLIENT * clnt_create (char *hostname, unsigned prog, + unsigned vers, char *proto); +extern char * clnt_sperror (CLIENT *rpch, char *s); +extern void clnt_perror (CLIENT *rpch, char *s); +extern char * clnt_sperrno (enum clnt_stat stat); +extern void clnt_perrno (enum clnt_stat num); +extern char * clnt_spcreateerror (char *s); +extern void clnt_pcreateerror (char *s); +extern CLIENT * clntraw_create (u_long prog, u_long vers); +extern int callrpc (char *host, int prognum, int versnum, + int procnum, xdrproc_t inproc, char* in, + xdrproc_t outproc, char *out); +extern CLIENT * clnttcp_create (struct sockaddr_in *raddr, u_long prog, + u_long vers, int *sockp, u_int sendsz, + u_int recvsz); +extern CLIENT * clntudp_bufcreate (struct sockaddr_in *raddr, + u_long program, u_long version, + struct timeval wait, int *sockp, + u_int sendsz, u_int recvsz); +extern CLIENT * clntudp_create (struct sockaddr_in *raddr, u_long program, + u_long version, struct timeval wait, + int *sockp); +extern bool_t clntudp_freeres (CLIENT *cl, xdrproc_t xdr_res, + caddr_t res_ptr); + +#else + +extern CLIENT * clnt_create (); +extern char * clnt_sperror (); +extern void clnt_perror (); +extern char * clnt_sperrno (); +extern void clnt_perrno (); +extern char * clnt_spcreateerror (); +extern void clnt_pcreateerror (); +extern CLIENT * clntraw_create (); +extern int callrpc (); +extern CLIENT * clnttcp_create (); +extern CLIENT * clntudp_bufcreate (); +extern CLIENT * clntudp_create (); +extern bool_t clntudp_freeres (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCclnth */ diff --git a/h/rpc/get_myaddr.h b/h/rpc/get_myaddr.h new file mode 100644 index 0000000..be26fd0 --- /dev/null +++ b/h/rpc/get_myaddr.h @@ -0,0 +1,38 @@ +/* get_myaddr.h - header file for get_myaddr.c */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01d,22sep92,rrr added support for c++ +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01a,05oct90,shl created. +*/ + +#ifndef __INCget_myaddrh +#define __INCget_myaddrh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern int get_myaddress (struct sockaddr_in *addr); + +#else + +extern int get_myaddress (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCget_myaddrh */ diff --git a/h/rpc/pmap_clnt.h b/h/rpc/pmap_clnt.h new file mode 100644 index 0000000..81c40b4 --- /dev/null +++ b/h/rpc/pmap_clnt.h @@ -0,0 +1,123 @@ +/* portmap_clnt.h - Supplies C routines to get to portmap services. */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* @(#)pmap_clnt.h 1.1 86/02/03 SMI */ + +/* + * portmap_clnt.h + * Supplies C routines to get to portmap services. + * + * Copyright (C) 1984, Sun Microsystems, Inc. + */ + +/* +modification history +-------------------- +01h,22sep92,rrr added support for c++ +01g,26may92,rrr the tree shuffle +01f,04oct91,rrr passed through the ansification filter + -fixed broken prototype + -fixed #else and #endif + -changed copyright notice +01e,21jan91,shl fxied typo in prototypes. +01d,24oct90,shl deleted redundant function declarations. +01c,05oct90,shl added ANSI function prototypes. + added copyright notice. +01b,27oct89,hjb added modification history and #ifndef's to avoid multiple + inclusion. +*/ + +#ifndef __INCpmap_clnth +#define __INCpmap_clnth + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Usage: + * success = pmap_set(program, version, protocol, port); + * success = pmap_unset(program, version); + * port = pmap_getport(address, program, version, protocol); + * head = pmap_getmaps(address); + * clnt_stat = pmap_rmtcall(address, program, version, procedure, + * xdrargs, argsp, xdrres, resp, tout, port_ptr) + * (works for udp only.) + * clnt_stat = clnt_broadcast(program, version, procedure, + * xdrargs, argsp, xdrres, resp, eachresult) + * (like pmap_rmtcall, except the call is broadcasted to all + * locally connected nets. For each valid response received, + * the procedure eachresult is called. Its form is: + * done = eachresult(resp, raddr) + * bool_t done; + * caddr_t resp; + * struct sockaddr_in raddr; + * where resp points to the results of the call and raddr is the + * address if the responder to the broadcast. + */ + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern bool_t pmap_set (u_long program, u_long version, + u_long protocol, int port); +extern bool_t pmap_unset (u_long program, u_long version); +extern struct pmaplist *pmap_getmaps (struct sockaddr_in *address); +extern u_short pmap_getport (struct sockaddr_in *address, u_long + program, u_long version, u_long protocol); +extern enum clnt_stat pmap_rmtcall (struct sockaddr_in *addr, u_long prog, + u_long vers, u_long proc, xdrproc_t xdrargs, + caddr_t argsp, xdrproc_t xdrres, caddr_t resp, + struct timeval tout, u_long *port_ptr); +extern enum clnt_stat clnt_broadcast (u_long prog, u_long vers, u_long proc, + xdrproc_t xargs, caddr_t argsp, + xdrproc_t xresults, caddr_t resultsp, + bool_t (*eachresult)()); + + +#else + +extern bool_t pmap_set (); +extern bool_t pmap_unset (); +extern struct pmaplist *pmap_getmaps (); +extern u_short pmap_getport (); +extern enum clnt_stat pmap_rmtcall(); +extern enum clnt_stat clnt_broadcast(); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpmap_clnth */ diff --git a/h/rpc/pmap_prot.h b/h/rpc/pmap_prot.h new file mode 100644 index 0000000..1120685 --- /dev/null +++ b/h/rpc/pmap_prot.h @@ -0,0 +1,132 @@ +/* pmap_prot.h - Protocol for the local binder service, or pmap. */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* @(#)pmap_prot.h 1.1 86/02/03 SMI */ + +/* Copyright (C) 1984, Sun Microsystems, Inc. */ + +/* +modification history +-------------------- +01g,22sep92,rrr added support for c++ +01f,26may92,rrr the tree shuffle +01e,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01d,24oct90,shl deleted redundant function declarations. +01c,05oct90,shl added ANSI function prototypes. + added copyright notice. +01b,27oct89,hjb added modification history and #ifndef's to avoid multiple + inclusion. +*/ + +#ifndef __INCpmap_proth +#define __INCpmap_proth + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The following procedures are supported by the protocol: + * + * PMAPPROC_NULL() returns () + * takes nothing, returns nothing + * + * PMAPPROC_SET(struct pmap) returns (bool_t) + * TRUE is success, FALSE is failure. Registers the tuple + * [prog, vers, prot, port]. + * + * PMAPPROC_UNSET(struct pmap) returns (bool_t) + * TRUE is success, FALSE is failure. Un-registers pair + * [prog, vers]. prot and port are ignored. + * + * PMAPPROC_GETPORT(struct pmap) returns (long unsigned). + * 0 is failure. Otherwise returns the port number where the pair + * [prog, vers] is registered. It may lie! + * + * PMAPPROC_DUMP() RETURNS (struct pmaplist *) + * + * PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>) + * RETURNS (port, string<>); + * usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc, encapsulatedargs); + * Calls the procedure on the local machine. If it is not registered, + * this procedure is quite; ie it does not return error information!!! + * This procedure only is supported on rpc/udp and calls via + * rpc/udp. This routine only passes null authentication parameters. + * This file has no interface to xdr routines for PMAPPROC_CALLIT. + * + * The service supports remote procedure calls on udp/ip or tcp/ip socket 111. + */ + +#define PMAPPORT ((u_short)111) +#define PMAPPROG ((u_long)100000) +#define PMAPVERS ((u_long)2) +#define PMAPVERS_PROTO ((u_long)2) +#define PMAPVERS_ORIG ((u_long)1) +#define PMAPPROC_NULL ((u_long)0) +#define PMAPPROC_SET ((u_long)1) +#define PMAPPROC_UNSET ((u_long)2) +#define PMAPPROC_GETPORT ((u_long)3) +#define PMAPPROC_DUMP ((u_long)4) +#define PMAPPROC_CALLIT ((u_long)5) + +struct pmap { + long unsigned pm_prog; + long unsigned pm_vers; + long unsigned pm_prot; + long unsigned pm_port; +}; + +struct pmaplist { + struct pmap pml_map; + struct pmaplist *pml_next; +}; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern bool_t xdr_pmap (XDR *xdrs, struct pmap *regs); +extern bool_t xdr_pmaplist (XDR *xdrs, struct pmaplist **rp); + +#else + +extern bool_t xdr_pmap (); +extern bool_t xdr_pmaplist (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpmap_proth */ diff --git a/h/rpc/pmap_rmt.h b/h/rpc/pmap_rmt.h new file mode 100644 index 0000000..ede18a6 --- /dev/null +++ b/h/rpc/pmap_rmt.h @@ -0,0 +1,94 @@ +/* pmap_rmt.h - client interface to pmap rpc service header file - 4.0 */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* @(#)pmap_rmt.h 2.1 88/07/29 4.0 RPCSRC; from 1.2 88/02/08 SMI */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +/* + * Structures and XDR routines for parameters to and replies from + * the portmapper remote-call-service. + * + * Copyright (C) 1986, Sun Microsystems, Inc. + */ + +/* +modification history +-------------------- +01f,22sep92,rrr added support for c++ +01e,26may92,rrr the tree shuffle +01d,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01c,24oct90,shl deleted redundant function declarations. moved clnt_broadcast + and pmap_rmtcall prototypes to pmap_clnt.h. +01b,05oct90,shl added ANSI function prototypes. + added copyright notice. +01a,26oct89,hjb first vxWorks version. +*/ + +#ifndef __INCpmap_rmth +#define __INCpmap_rmth + +#ifdef __cplusplus +extern "C" { +#endif + +struct rmtcallargs { + u_long prog, vers, proc, arglen; + caddr_t args_ptr; + xdrproc_t xdr_args; +}; + +struct rmtcallres { + u_long *port_ptr; + u_long resultslen; + caddr_t results_ptr; + xdrproc_t xdr_results; +}; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern bool_t xdr_rmtcall_args (XDR *xdrs, struct rmtcallargs *cap); +extern bool_t xdr_rmtcallres (XDR *xdrs, struct rmtcallres *crp); + +#else + +extern bool_t xdr_rmtcall_args (); +extern bool_t xdr_rmtcallres (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpmap_rmth */ diff --git a/h/rpc/portmap.h b/h/rpc/portmap.h new file mode 100644 index 0000000..24a9dcf --- /dev/null +++ b/h/rpc/portmap.h @@ -0,0 +1,41 @@ +/* portmap.h - header file for portmap.c */ + +/* Copyright 1984-2000 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01e,18apr00,ham changed int portmapd() to void portmapd(). +01d,22sep92,rrr added support for c++ +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01a,05oct90,shl created. +*/ + +#ifndef __INCportmaph +#define __INCportmaph + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void portmapd (void); +extern void reg_service (struct svc_req *rqstp, SVCXPRT *xprt); + +#else + +extern int portmapd (); +extern void reg_service (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCportmaph */ diff --git a/h/rpc/rpc.h b/h/rpc/rpc.h new file mode 100644 index 0000000..e3c08b7 --- /dev/null +++ b/h/rpc/rpc.h @@ -0,0 +1,106 @@ +/* rpc.h - remote procedure call header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* @(#)rpc.h 1.1 86/02/03 SMI */ + +/* + * rpc.h, Just includes the billions of rpc header files necessary to + * do remote procedure calling. + * + * Copyright (C) 1984, Sun Microsystems, Inc. + */ + +/* +modification history +-------------------- +01h,22sep92,rrr added support for c++ +01g,26may92,rrr the tree shuffle + -changed includes to have absolute path from h/ +01f,19nov91,rrr shut up some ansi warnings. +01e,04oct91,rrr passed through the ansification filter + -changed includes to have absolute path from h/ + -fixed #else and #endif + -changed copyright notice +01d,05oct90,shl added copyright notice. +01c,26oct89,hjb upgraded to release 4.0 and changed __RPC_HEADER__ to + INCrpch. +01b,22jun88,dnw added __RPC_HEADER__ test to prevent multiple includes. +*/ + +#ifndef __INCrpch +#define __INCrpch + +#ifdef __cplusplus +extern "C" { +#endif + +#include "rpc/rpctypes.h" /* some typedefs */ +#include "netinet/in.h" + +/* external data representation interfaces */ +#include "rpc/xdr.h" /* generic (de)serializer */ + +/* Client side only authentication */ +#include "rpc/auth.h" /* generic authenticator (client side) */ + +/* Client side (mostly) remote procedure call */ +#include "rpc/clnt.h" /* generic rpc stuff */ + +/* semi-private protocol headers */ +#include "rpc/rpc_msg.h" /* protocol for rpc messages */ +#include "rpc/auth_unix.h" /* protocol for unix style cred */ + +/* + * uncomment-out the next line if you are building the rpc library with + * DES authentication (see the README file in the secure_rpc/ directory). + */ +/* #include "auth_des.h" */ /* 4.0 */ + + +/* Server side only remote procedure callee */ +#include "rpc/svc.h" /* service manager and multiplexer */ +#include "rpc/svc_auth.h" /* service side authenticator */ + +/* + * comment out the next include if the running on sun OS or on a version + * of Unix based on NFSSRC. These systems will already have the structures + * defined by "rpcnetdb.h" included in "netdb.h" + * + * VxWorks doesn't support this. + */ +/* routines for parsing /etc/rpc */ /* 4.0 */ +/* #include "rpcnetdb.h" */ /* structures and routines to parse /etc/rpc */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrpch */ diff --git a/h/rpc/rpcGbl.h b/h/rpc/rpcGbl.h new file mode 100644 index 0000000..0fd835d --- /dev/null +++ b/h/rpc/rpcGbl.h @@ -0,0 +1,178 @@ +/* rpcGbl.h - header file for rpc globals */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01p,16nov01,spm fixed modification history: version 01o created +01o,25oct01,rae added build macro to support different Tornado versions +01n,16nov98,mak changes due to moving pRPCModList from the TCB to the LCB +01m,22sep92,rrr added support for c++ +01l,26may92,rrr the tree shuffle + -changed includes to have absolute path from h/ +01k,04oct91,rrr passed through the ansification filter + -changed includes to have absolute path from h/ + -changed copyright notice +01j,01may91,elh added references to filename. +01i,05oct90,shl added copyright notice. + made #endif ANSI style. +01h,02oct90,hjb defined RPC_ERRBUF_SIZE, added clnt_rawExit, svc_rawExit + and errBuf to struct rpcModList. +01g,15may90,dnw moved rpc static structures from various rpc modules to + the structure defined here. This simplifies the + initializations and requires fewer mallocs. + renamed the structure type from MODULE_LIST to RPC_STATICS + renamed the macro for pointer in the tcb from taskModuleList to + taskRpcStatics + added rpc_createerr macro +01f,15apr90,jcf made taskModuleList a macro thru taskIdCurrent. +01e,30oct89,hjb added bindresvport in MODULE_LIST +01d,20may88,ak made 01c version be rcs'd as part of yuba migration +01c,19apr88,llk added nfsClientCache to MODULE_LIST. +01b,05nov87,dnw moved definition of taskModuleList to rpcLib.c. +*/ + +#ifndef __INCrpcGblh +#define __INCrpcGblh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "rpc/xdr.h" +#include "netinet/in.h" +#include "rpc/auth.h" +#include "rpc/clnt.h" +#include "rpc/svc.h" +#include "taskLib.h" + +#define MAX_MARSHEL_SIZE 20 +#define RPC_ERRBUF_SIZE 256 + +/* statics from various rpc modules - + * are defined in this structure which is dynamically allocated and + * pointed to by a pointer in the tcb + */ +typedef struct rpcModList + { + /* statics from auth_none.c */ + + struct auth_none + { + AUTH no_client; + char marshalled_client[MAX_MARSHEL_SIZE]; + u_int mcnt; + } auth_none; + + /* statics from clnt_simple.c */ + + struct clnt_simple + { + CLIENT *client; + int socket; + int oldprognum; + int oldversnum; + int valid; + char oldhost [50]; + } clnt_simple; + + /* statics from svc.c */ + + struct svc + { + SVCXPRT *xports[FD_SETSIZE]; + fd_set svc_fdset; + + /* + * The services list + * Each entry represents a set of procedures (an rpc program). + * The dispatch routine takes request structs and runs the + * apropriate procedure. + */ + struct svc_callout + { + struct svc_callout *sc_next; + u_long sc_prog; + u_long sc_vers; + void (*sc_dispatch)(); + } *svc_head; + } svc; + + /* statics from svc_simple.c */ + + struct svc_simple + { + struct proglst + { + char *(*p_progname)(); + int p_prognum; + int p_procnum; + xdrproc_t p_inproc, p_outproc; + struct proglst *p_nxt; + } *proglst; + SVCXPRT *transp; + int madetransp; + struct proglst *pl; + } svc_simple; + + /* statics for nfs are defined in nfsLib and are allocated separately, + * but referenced by this pointer + */ + struct moduleStatics *nfsClientCache; + + /* statics for clnt_raw and svc_raw are in a structures in those modules, + * since those modules are not used very often. + * a pointer to the buffer that is used in common is defined here. + */ + struct moduleStatics *clnt_raw; + struct moduleStatics *svc_raw; + void (*clnt_rawExit)(); + void (*svc_rawExit)(); + char *_raw_buf; /* buffer for raw clnt/svc */ + char *errBuf; /* buffer for err msg's */ + + /* A handle on why an rpc creation routine failed (returned NULL.) */ + + struct rpc_createerr task_rpc_createerr; + + } RPC_STATICS; + +/* macro for the pointer to the current task's rpc statics */ + +#ifndef _WRS_VXWORKS_5_X +#define taskRpcStatics (windLcbCurrent->pRPCModList) +#else +#define taskRpcStatics (taskIdCurrent->pRPCModList) +#endif /* _WRS_VXWORKS_5_X */ + +/* macro for the current task's rpc_createerr structure */ + +#define rpc_createerr (taskRpcStatics->task_rpc_createerr) + +#if defined(__STDC__) || defined(__cplusplus) + +extern void clnt_genericInclude (void); +extern void clnt_rawInclude (void); +extern void clnt_simpleInclude (void); +extern void pmap_getmapsInclude (void); +extern void svc_rawInclude (void); +extern void svc_simpleInclude (void); +extern void xdr_floatInclude (void); + +#else + +extern void clnt_genericInclude (); +extern void clnt_rawInclude (); +extern void clnt_simpleInclude (); +extern void pmap_getmapsInclude (); +extern void svc_rawInclude (); +extern void svc_simpleInclude (); +extern void xdr_floatInclude (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrpcGblh */ diff --git a/h/rpc/rpc_msg.h b/h/rpc/rpc_msg.h new file mode 100644 index 0000000..2a7cba4 --- /dev/null +++ b/h/rpc/rpc_msg.h @@ -0,0 +1,240 @@ +/* rpc_msg.h - rpc message definition */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* @(#)rpc_msg.h 1.1 86/02/03 SMI */ + +/* + * rpc_msg.h + * rpc message definition + * + * Copyright (C) 1984, Sun Microsystems, Inc. + */ + +/* +modification history +-------------------- +01h,22sep92,rrr added support for c++ +01g,26may92,rrr the tree shuffle +01f,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01e,05mar91,ajm fixed spelling of #define INCrpc_msgh +01d,24oct90,shl commented redundant function declarations. +01c,05oct90,shl added ANSI function prototypes. + added copyright notice. +01b,27oct89,hjb added modification history and #ifndef's to avoid multiple + inclusion. +*/ + +#ifndef __INCrpc_msgh +#define __INCrpc_msgh + +#ifdef __cplusplus +extern "C" { +#endif + +#define RPC_MSG_VERSION ((u_long) 2) +#define RPC_SERVICE_PORT ((u_short) 2048) + +/* + * Bottom up definition of an rpc message. + * NOTE: call and reply use the same overall stuct but + * different parts of unions within it. + */ + +enum msg_type { + CALL=0, + REPLY=1 +}; + +enum reply_stat { + MSG_ACCEPTED=0, + MSG_DENIED=1 +}; + +enum accept_stat { + SUCCESS=0, + PROG_UNAVAIL=1, + PROG_MISMATCH=2, + PROC_UNAVAIL=3, + GARBAGE_ARGS=4, + SYSTEM_ERR=5 +}; + +enum reject_stat { + RPC_MISMATCH=0, + AUTH_ERROR=1 +}; + +/* + * Reply part of an rpc exchange + */ + +/* + * Reply to an rpc request that was accepted by the server. + * Note: there could be an error even though the request was + * accepted. + */ +struct accepted_reply { + struct opaque_auth ar_verf; + enum accept_stat ar_stat; + union { + struct { + u_long low; + u_long high; + } AR_versions; + struct { + caddr_t where; + xdrproc_t proc; + } AR_results; + /* and many other null cases */ + } ru; +#define ar_results ru.AR_results +#define ar_vers ru.AR_versions +}; + +/* + * Reply to an rpc request that was rejected by the server. + */ +struct rejected_reply { + enum reject_stat rj_stat; + union { + struct { + u_long low; + u_long high; + } RJ_versions; + enum auth_stat RJ_why; /* why authentication did not work */ + } ru; +#define rj_vers ru.RJ_versions +#define rj_why ru.RJ_why +}; + +/* + * Body of a reply to an rpc request. + */ +struct reply_body { + enum reply_stat rp_stat; + union { + struct accepted_reply RP_ar; + struct rejected_reply RP_dr; + } ru; +#define rp_acpt ru.RP_ar +#define rp_rjct ru.RP_dr +}; + +/* + * Body of an rpc request call. + */ +struct call_body { + u_long cb_rpcvers; /* must be equal to two */ + u_long cb_prog; + u_long cb_vers; + u_long cb_proc; + struct opaque_auth cb_cred; + struct opaque_auth cb_verf; /* protocol specific - provided by client */ +}; + +/* + * The rpc message + */ +struct rpc_msg { + u_long rm_xid; + enum msg_type rm_direction; + union { + struct call_body RM_cmb; + struct reply_body RM_rmb; + } ru; +#define rm_call ru.RM_cmb +#define rm_reply ru.RM_rmb +}; +#define acpted_rply ru.RM_rmb.ru.RP_ar +#define rjcted_rply ru.RM_rmb.ru.RP_dr + + +/* + * XDR routine to handle a rpc message. + * xdr_callmsg(xdrs, cmsg) + * XDR *xdrs; + * struct rpc_msg *cmsg; + */ + +/* extern bool_t xdr_callmsg(); */ + +/* + * XDR routine to pre-serialize the static part of a rpc message. + * xdr_callhdr(xdrs, cmsg) + * XDR *xdrs; + * struct rpc_msg *cmsg; + */ + +/* extern bool_t xdr_callhdr(); */ + +/* + * XDR routine to handle a rpc reply. + * xdr_replymsg(xdrs, rmsg) + * XDR *xdrs; + * struct rpc_msg *rmsg; + */ + +/* extern bool_t xdr_replymsg(); */ + +/* + * Fills in the error part of a reply message. + * _seterr_reply(msg, error) + * struct rpc_msg *msg; + * struct rpc_err *error; + */ + +/* extern void _seterr_reply(); */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern bool_t xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg); +extern bool_t xdr_replymsg (XDR *xdrs, struct rpc_msg *rmsg); +extern bool_t xdr_callhdr (XDR *xdrs, struct rpc_msg *cmsg); +extern void _seterr_reply (struct rpc_msg *msg, struct rpc_err *error); + +#else + +extern bool_t xdr_callmsg (); +extern bool_t xdr_replymsg (); +extern bool_t xdr_callhdr (); +extern void _seterr_reply (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrpc_msgh */ diff --git a/h/rpc/rpc_prot.h b/h/rpc/rpc_prot.h new file mode 100644 index 0000000..9d21ad2 --- /dev/null +++ b/h/rpc/rpc_prot.h @@ -0,0 +1,48 @@ +/* rpc_prot.h - header file for rpc_prot.c */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01d,22sep92,rrr added support for c++ +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01a,05oct90,shl created. +*/ + +#ifndef __INCrpc_proth +#define __INCrpc_proth + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern bool_t xdr_opaque_auth (XDR *xdrs, struct opaque_auth *ap); +extern bool_t xdr_deskey (XDR *xdrs, union des_block *blkp); +extern bool_t xdr_accepted_reply (XDR *xdrs, struct accepted_reply *ar); +extern bool_t xdr_rejected_reply (XDR *xdrs, struct rejected_reply *rr); +extern void accepted (enum accept_stat acpt_stat, struct rpc_err *error); +extern void rejected (enum reject_stat rjct_stat, struct rpc_err *error); + +#else + +extern bool_t xdr_opaque_auth (); +extern bool_t xdr_deskey (); +extern bool_t xdr_accepted_reply (); +extern bool_t xdr_rejected_reply (); +extern void accepted (); +extern void rejected (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrpc_proth */ diff --git a/h/rpc/rpcnetdb.h b/h/rpc/rpcnetdb.h new file mode 100644 index 0000000..7396672 --- /dev/null +++ b/h/rpc/rpcnetdb.h @@ -0,0 +1,36 @@ +/* rpcnetdb.h - definitions for rpc */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01f,22sep92,rrr added support for c++ +01e,26may92,rrr the tree shuffle +01d,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01c,05oct90,shl added copyright notice. +01b,27oct89,hjb added modification history and #ifndef's to avoid multiple + inclusion. +*/ + +#ifndef __INCrpcnetdbh +#define __INCrpcnetdbh + +#ifdef __cplusplus +extern "C" { +#endif + +struct rpcent { + char *r_name; /* name of server for this rpc program */ + char **r_aliases; /* alias list */ + int r_number; /* rpc program number */ +}; + +struct rpcent *getrpcbyname(), *getrpcbynumber(), *getrpcent(); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrpcnetdbh */ diff --git a/h/rpc/rpctypes.h b/h/rpc/rpctypes.h new file mode 100644 index 0000000..521f0a1 --- /dev/null +++ b/h/rpc/rpctypes.h @@ -0,0 +1,97 @@ +/* rpctypes.h - Rpc additions to */ + +/* Copyright 1984-2000 Wind River Systems, Inc. */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* @(#)types.h 1.1 86/02/03 SMI */ + +/* +modification history +-------------------- +02k,14jan00,ham redefined mem_* to KHEAP_* for PD support. +02j,24jul96,vin removed INADDR_LOOPBACK since it is defined netinet/in.h +02i,22sep92,rrr added support for c++ +02h,19aug92,smb changed systime.h to sys/times.h +02g,04jul92,smb added include vxWorks.h +02f,26may92,rrr the tree shuffle +02e,04oct91,rrr passed through the ansification filter + -changed includes to have absolute path from h/ + -fixed #else and #endif + -changed copyright notice +02d,25oct90,dnw added definitions of TRUE and FALSE if not already defined. + changed utime.h to systime.h. +02c,05oct90,shl added copyright notice. +02b,29oct89,hjb upgraded to release 4.0 +*/ + +#ifndef __INCrpctypesh +#define __INCrpctypesh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "memPartLib.h" + +/* + * Rpc additions to + */ + +#define bool_t int +#define enum_t int + +#ifndef FALSE +#define FALSE (0) +#endif + +#ifndef TRUE +#define TRUE (1) +#endif + +#define __dontcare__ -1 + +#define mem_alloc(bsize) KHEAP_ALLOC(bsize) +#define mem_free(ptr, bsize) KHEAP_FREE(ptr) + +#ifndef _TYPES_ /* if types.h is not include yet, include it here */ +#include "sys/types.h" +#endif + +#include "sys/times.h" /* 4.0 */ + +#ifndef MAXHOSTNAMELEN /* 4.0 */ +#define MAXHOSTNAMELEN 64 +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrpctypesh */ diff --git a/h/rpc/svc.h b/h/rpc/svc.h new file mode 100644 index 0000000..0e154c6 --- /dev/null +++ b/h/rpc/svc.h @@ -0,0 +1,379 @@ +/* svc.h, Server-side remote procedure call interface. */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* @(#)svc.h 1.1 86/02/03 SMI */ + +/* + * svc.h, Server-side remote procedure call interface. + * + * Copyright (C) 1984, Sun Microsystems, Inc. + */ + +/* +modification history +-------------------- +01p,21jul05,vvv fixed C++ build problem (SPR #99889) +01o,24jun04,vvv changed prototype for svcudp_enablecache() +01n,12sep03,skp Added support for server reply cache. +01m,24feb97,bjl moved struct xp_ops declaration outside of SVCXPRT + to make struct xp_ops globally visible for c++ +01l,15sep93,kdl changed prototype of svcudp_create() (SPR #2427). +01k,22sep92,rrr added support for c++ +01j,26may92,rrr the tree shuffle +01i,19nov91,rrr shut up some ansi warnings. +01h,04oct91,rrr passed through the ansification filter + -fixed broken prototype + -fixed #else and #endif + -changed copyright notice +01g,08may91,kdl fixed ANSI prototype of svc_register(). +01f,10jan91,shl fixed prototype of registerrpc(). +01e,25oct90,dnw added missing definition of svc_fds. +01d,24oct90,shl deleted redundant function declarations. +01c,05oct90,shl added ANSI function prototypes. + added copyright notice. +01b,26oct89,hjb upgraded to release 4.0 +*/ + +#ifndef __INCsvch +#define __INCsvch + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * This interface must manage two items concerning remote procedure calling: + * + * 1) An arbitrary number of transport connections upon which rpc requests + * are received. The two most notable transports are TCP and UDP; they are + * created and registered by routines in svc_tcp.c and svc_udp.c, respectively; + * they in turn call xprt_register and xprt_unregister. + * + * 2) An arbitrary number of locally registered services. Services are + * described by the following four data: program number, version number, + * "service dispatch" function, a transport handle, and a boolean that + * indicates whether or not the exported program should be registered with a + * local binder service; if true the program's number and version and the + * port number from the transport handle are registered with the binder. + * These data are registered with the rpc svc system via svc_register. + * + * A service's dispatch function is called whenever an rpc request comes in + * on a transport. The request's program and version numbers must match + * those of the registered service. The dispatch function is passed two + * parameters, struct svc_req * and SVCXPRT *, defined below. + */ + +enum xprt_stat { + XPRT_DIED, + XPRT_MOREREQS, + XPRT_IDLE +}; + +/* + * Server side transport handle + */ +typedef struct { + int xp_sock; + u_short xp_port; /* associated port number */ + struct xp_ops *xp_ops; + int xp_addrlen; /* length of remote address */ + struct sockaddr_in xp_raddr; /* remote address */ + struct opaque_auth xp_verf; /* raw response verifier */ + caddr_t xp_p1; /* private */ + caddr_t xp_p2; /* private */ +} SVCXPRT; + +struct xp_ops { +#if defined(__STDC__) || defined(__cplusplus) + bool_t (*xp_recv)(SVCXPRT *, struct rpc_msg *); /* receive incoming requests */ + enum xprt_stat (*xp_stat)(SVCXPRT *); /* get transport status */ + bool_t (*xp_getargs)(SVCXPRT *, xdrproc_t xargs, caddr_t argsp); /* get arguments */ + bool_t (*xp_reply)(SVCXPRT *, struct rpc_msg*); /* send reply */ + bool_t (*xp_freeargs)(SVCXPRT *, xdrproc_t xargs, caddr_t argsp); /* free mem allocated for args */ + void (*xp_destroy)(SVCXPRT *); /* destroy this struct */ +#else + bool_t (*xp_recv)(); /* receive incoming requests */ + enum xprt_stat (*xp_stat)(); /* get transport status */ + bool_t (*xp_getargs)(); /* get arguments */ + bool_t (*xp_reply)(); /* send reply */ + bool_t (*xp_freeargs)(); /* free mem allocated for args */ + void (*xp_destroy)(); /* destroy this struct */ +#endif +}; + +/* + * Approved way of getting address of caller + */ +#define svc_getcaller(x) (&(x)->xp_raddr) + +/* + * Operations defined on an SVCXPRT handle + * + * SVCXPRT *xprt; + * struct rpc_msg *msg; + * xdrproc_t xargs; + * caddr_t argsp; + */ +#define SVC_RECV(xprt, msg) \ + (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) +#define svc_recv(xprt, msg) \ + (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) + +#define SVC_STAT(xprt) \ + (*(xprt)->xp_ops->xp_stat)(xprt) +#define svc_stat(xprt) \ + (*(xprt)->xp_ops->xp_stat)(xprt) + +#define SVC_GETARGS(xprt, xargs, argsp) \ + (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp)) +#define svc_getargs(xprt, xargs, argsp) \ + (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp)) + +#define SVC_REPLY(xprt, msg) \ + (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) +#define svc_reply(xprt, msg) \ + (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) + +#define SVC_FREEARGS(xprt, xargs, argsp) \ + (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp)) +#define svc_freeargs(xprt, xargs, argsp) \ + (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp)) + +#define SVC_DESTROY(xprt) \ + (*(xprt)->xp_ops->xp_destroy)(xprt) +#define svc_destroy(xprt) \ + (*(xprt)->xp_ops->xp_destroy)(xprt) + +/* + * Service request + */ +struct svc_req { + u_long rq_prog; /* service program number */ + u_long rq_vers; /* service protocol version */ + u_long rq_proc; /* the desired procedure */ + struct opaque_auth rq_cred; /* raw creds from the wire */ + caddr_t rq_clntcred; /* read only cooked cred */ + SVCXPRT *rq_xprt; /* associated transport */ +}; + + +/* + * Service registration + * + * svc_register(xprt, prog, vers, dispatch, protocol) + * SVCXPRT *xprt; + * u_long prog; + * u_long vers; + * void (*dispatch)(); + * int protocol; /@ like TCP or UDP, zero means do not register @/ + */ + +/* + * Service un-registration + * + * svc_unregister(prog, vers) + * u_long prog; + * u_long vers; + */ + +/* + * Transport registration. + * + * xprt_register(xprt) + * SVCXPRT *xprt; + */ + +/* + * Transport un-register + * + * xprt_unregister(xprt) + * SVCXPRT *xprt; + */ + +/* + * When the service routine is called, it must first check to see if it + * knows about the procedure; if not, it should call svcerr_noproc + * and return. If so, it should deserialize its arguments via + * SVC_GETARGS (defined above). If the deserialization does not work, + * svcerr_decode should be called followed by a return. Successful + * decoding of the arguments should be followed the execution of the + * procedure's code and a call to svc_sendreply. + * + * Also, if the service refuses to execute the procedure due to too- + * weak authentication parameters, svcerr_weakauth should be called. + * Note: do not confuse access-control failure with weak authentication! + * + * NB: In pure implementations of rpc, the caller always waits for a reply + * msg. This message is sent when svc_sendreply is called. + * Therefore pure service implementations should always call + * svc_sendreply even if the function logically returns void; use + * xdr.h - xdr_void for the xdr routine. HOWEVER, tcp based rpc allows + * for the abuse of pure rpc via batched calling or pipelining. In the + * case of a batched call, svc_sendreply should NOT be called since + * this would send a return message, which is what batching tries to avoid. + * It is the service/protocol writer's responsibility to know which calls are + * batched and which are not. Warning: responding to batch calls may + * deadlock the caller and server processes! + */ + +/* + * Lowest level dispatching -OR- who owns this process anyway. + * Somebody has to wait for incoming requests and then call the correct + * service routine. The routine svc_run does infinite waiting; i.e., + * svc_run never returns. + * Since another (co-existant) package may wish to selectively wait for + * incoming calls or other events outside of the rpc architecture, the + * routine svc_getreq is provided. It must be passed readfds, the + * "in-place" results of a select system call (see select, section 2). + */ + +/* + * Global keeper of rpc service descriptors in use + * dynamic; must be inspected before each call to select + */ +#ifdef FD_SETSIZE +extern fd_set svc_fdset; +#define svc_fds svc_fdset.fds_bits[0] /* compatibility */ +#else +extern int svc_fds; +#endif /* def FD_SETSIZE */ + +/* + * a small program implemented by the svc_rpc implementation itself; + * also see clnt.h for protocol numbers. + */ +extern void rpctest_service(); + +/* + * Socket to use on svcxxx_create call to get default socket + */ +#define RPC_ANYSOCK -1 + +/* + * These are the existing service side transport implementations + */ + +/* + * Memory based rpc for testing and timing. + */ + +/* extern SVCXPRT *svcraw_create(); */ + +/* + * Udp based rpc. + */ + +/* +extern SVCXPRT *svcudp_create(); +extern SVCXPRT *svcudp_bufcreate(); +*/ + +/* + * Tcp based rpc. + */ + +/* +extern SVCXPRT *svctcp_create(); +*/ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void xprt_register (SVCXPRT *xprt); +extern void xprt_unregister (SVCXPRT *xprt); +extern bool_t svc_register (SVCXPRT *xprt, u_long prog, u_long vers, + void (*dispatch) (struct svc_req *, SVCXPRT *), + int protocol); +extern void svc_unregister (u_long prog, u_long vers); +extern struct svc_callout *svc_find (u_long prog, u_long vers, + struct svc_callout **prev); +extern bool_t svc_sendreply (SVCXPRT *xprt, xdrproc_t xdr_results, + caddr_t xdr_location); +extern void svcerr_noproc (SVCXPRT *xprt); +extern void svcerr_decode (SVCXPRT *xprt); +extern void svcerr_systemerr (SVCXPRT *xprt); +extern void svcerr_auth (SVCXPRT *xprt, enum auth_stat why); +extern void svcerr_weakauth (SVCXPRT *xprt); +extern void svcerr_noprog (SVCXPRT *xprt); +extern void svcerr_progvers (SVCXPRT *xprt, u_long low_vers, + u_long high_vers); +extern void svc_getreq (int rdfds); +extern void svc_getreqset (fd_set *rdfds); +extern void svc_run (void); +extern SVCXPRT * svcraw_create (void); +extern int registerrpc (int prognum, int versnum, int procnum, + char *(*progname)(), xdrproc_t inproc, + xdrproc_t outproc); +extern SVCXPRT * svctcp_create (int sock, u_int sendsize, u_int recvsize); +extern SVCXPRT * svcfd_create (int fd, u_int sendsize, u_int recvsize); +extern SVCXPRT * svcudp_bufcreate (int sock, u_int sendsz, u_int recvsz); +extern SVCXPRT * svcudp_create (int sock); +extern int svcudp_enablecache (SVCXPRT *transp, int prog, int vers, u_long size, BOOL partial); +extern void cache_fillparams (SVCXPRT *transp, void *nfsCache, + int prognum, int versnum, int procnum); + +#else + +extern void xprt_register (); +extern void xprt_unregister (); +extern bool_t svc_register (); +extern void svc_unregister (); +extern struct svc_callout *svc_find (); +extern bool_t svc_sendreply (); +extern void svcerr_noproc (); +extern void svcerr_decode (); +extern void svcerr_systemerr (); +extern void svcerr_auth (); +extern void svcerr_weakauth (); +extern void svcerr_noprog (); +extern void svcerr_progvers (); +extern void svc_getreq (); +extern void svc_getreqset (); +extern void svc_run (); +extern SVCXPRT * svcraw_create (); +extern int registerrpc (); +extern SVCXPRT * svctcp_create (); +extern SVCXPRT * svcfd_create (); +extern SVCXPRT * svcudp_bufcreate (); +extern SVCXPRT * svcudp_create (); +extern int svcudp_enablecache (); +extern void cache_fillparams (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsvch */ diff --git a/h/rpc/svc_auth.h b/h/rpc/svc_auth.h new file mode 100644 index 0000000..ed8cc8b --- /dev/null +++ b/h/rpc/svc_auth.h @@ -0,0 +1,82 @@ +/* svc_auth.h - Service side of rpc authentication. */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* @(#)svc_auth.h 1.1 86/02/03 SMI */ + +/* + * svc_auth.h, Service side of rpc authentication. + * + * Copyright (C) 1984, Sun Microsystems, Inc. + */ + +/* +modification history +-------------------- +01g,22sep92,rrr added support for c++ +01f,26may92,rrr the tree shuffle +01e,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01d,24oct90,shl deleted redundant function declarations. +01c,05oct90,shl added ANSI function prototypes. + added copyright notice. +01b,27oct89,hjb added modification history and #ifndef's to avoid multiple + inclusion. +*/ + +#ifndef __INCsvc_authh +#define __INCsvc_authh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern enum auth_stat _authenticate (struct svc_req *rqst, + struct rpc_msg *msg); +extern enum auth_stat _svcauth_null (void); + +#else + +extern enum auth_stat _authenticate (); +extern enum auth_stat _svcauth_null (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsvc_authh */ diff --git a/h/rpc/svc_auth_uni.h b/h/rpc/svc_auth_uni.h new file mode 100644 index 0000000..c731295 --- /dev/null +++ b/h/rpc/svc_auth_uni.h @@ -0,0 +1,40 @@ +/* svc_auth_uni.h - header file for svc_auth_uni.c */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01d,22sep92,rrr added support for c++ +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01a,05oct90,shl created. +*/ + +#ifndef __INCsvc_auth_unih +#define __INCsvc_auth_unih + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern enum auth_stat _svcauth_unix (struct svc_req *rqst, struct rpc_msg *msg); +extern enum auth_stat _svcauth_short (struct svc_req *rqst, struct rpc_msg *msg); + +#else + +extern enum auth_stat _svcauth_unix (); +extern enum auth_stat _svcauth_short (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsvc_auth_unih */ diff --git a/h/rpc/types.h b/h/rpc/types.h new file mode 100644 index 0000000..54bf5c6 --- /dev/null +++ b/h/rpc/types.h @@ -0,0 +1,12 @@ +/* rpc/types.h - definition of RPC data types */ + +/* Copyright 1984-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,09feb95,ms written. +*/ + +#include "rpc/rpc.h" + diff --git a/h/rpc/xdr.h b/h/rpc/xdr.h new file mode 100644 index 0000000..07ae856 --- /dev/null +++ b/h/rpc/xdr.h @@ -0,0 +1,460 @@ +/* xdr.h, External Data Representation Serialization Routines. */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* @(#)xdr.h 1.1 86/02/03 SMI */ + +/* + * xdr.h, External Data Representation Serialization Routines. + * + * Copyright (C) 1984, Sun Microsystems, Inc. + */ + +/* +modification history +-------------------- +01t,17may05,vvv fixed integer overflow (SPR #108521) +01s,15apr05,vvv changed prototype for xdrrec_create() (SPR #105654) +01r,24nov03,ann added support for long long (64 bit) +01q,27jul99,elg Add XDR_PUTWORDS and XDR_PUTLONGS. +01p,01mar99,spm added a C++ compatible XDR structure (SPR #24837) +01o,29jan96,mem replaced test of CPU_FAMILY with test of _BYTE_ORDER +01n,09jun93,hdn added support for I80X86 +01n,17oct94,ism fixed prototype of xdr_u_char() (SPR#2675) +01m,22sep92,rrr added support for c++ +01l,07sep92,smb added include of rpctypes.h +01k,26may92,rrr the tree shuffle +01j,26may92,ajm fixed #define of IXDR_GET_LONG for all compilers (see 01g) + updated copyright +01i,04oct91,rrr passed through the ansification filter + -fixed broken prototype + -fixed #else and #endif + -changed copyright notice +01h,18sep91,wmd use defined(HOST_MIPS) || defined(HOST_DEC) instead of + CPU=R3000 for the conditional. +01g,05aug91,ajm changed #define of IXDR_GET_LONG to be K+R compliant + for mips compiler (++ can't be applied to an expresion) +01f,05aug91,del IXDR_GET_LONG is ixdr_get_long function for I960 + problem w/htonl macro expansion. +01e,24oct90,shl commented out redundant function declarations. +01d,05oct90,shl added ANSI function prototypes. + added copyright notice. +01c,19apr90,hjb modified IXDR_GET_LONG, IXDR_PUT_LONG, IXDR_PUT_BOOL, + IXDR_PUT_ENUM, IXDR_PUT_U_LONG, IXDR_PUT_SHORT, + IXDR_PUT_U_SHORT. +01b,26oct89,hjb upgraded to release 4.0 +*/ + +#ifndef __INCxdrh +#define __INCxdrh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "rpctypes.h" + +/* + * XDR provides a conventional way for converting between C data + * types and an external bit-string representation. Library supplied + * routines provide for the conversion on built-in C data types. These + * routines and utility routines defined here are used to help implement + * a type encode/decode routine for each user-defined type. + * + * Each data type provides a single procedure which takes two arguments: + * + * bool_t + * xdrproc(xdrs, argresp) + * XDR *xdrs; + * *argresp; + * + * xdrs is an instance of a XDR handle, to which or from which the data + * type is to be converted. argresp is a pointer to the structure to be + * converted. The XDR handle contains an operation field which indicates + * which of the operations (ENCODE, DECODE * or FREE) is to be performed. + * + * XDR_DECODE may allocate space if the pointer argresp is null. This + * data can be freed with the XDR_FREE operation. + * + * We write only one procedure per data type to make it easy + * to keep the encode and decode procedures for a data type consistent. + * In many cases the same code performs all operations on a user defined type, + * because all the hard work is done in the component type routines. + * decode as a series of calls on the nested data types. + */ + +/* + * Xdr operations. XDR_ENCODE causes the type to be encoded into the + * stream. XDR_DECODE causes the type to be extracted from the stream. + * XDR_FREE can be used to release the space allocated by an XDR_DECODE + * request. + */ +enum xdr_op { + XDR_ENCODE=0, + XDR_DECODE=1, + XDR_FREE=2 +}; + +/* + * This is the number of bytes per unit of external data. + */ +#define BYTES_PER_XDR_UNIT (4) +#define RNDUP(x) \ + ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) * \ + BYTES_PER_XDR_UNIT) /* 4.0 */ + +/* + * A xdrproc_t exists for each data type which is to be encoded or decoded. + * + * The second argument to the xdrproc_t is a pointer to an opaque pointer. + * The opaque pointer generally points to a structure of the data type + * to be decoded. If this pointer is 0, then the type routines should + * allocate dynamic storage of the appropriate size and return it. + * bool_t (*xdrproc_t)(XDR *, caddr_t *); + */ +typedef bool_t (*xdrproc_t)(); + +/* + * The XDR handle. + * Contains operation which is being applied to the stream, + * an operations vector for the paticular implementation (e.g. see xdr_mem.c), + * and two private fields for the use of the particular impelementation. + */ + +#ifdef __cplusplus + +typedef struct { + enum xdr_op x_op; /* operation; fast additional param */ + struct xdr_ops { + /* get a long long from underlying stream */ + bool_t (*x_getlonglong)(...); + /* put a long long to underlying stream */ + bool_t (*x_putlonglong) (...); + /* get a long from underlying stream */ + bool_t (*x_getlong)(...); + /* put a long to underlying stream */ + bool_t (*x_putlong) (...); + /* get some bytes from underlying stream */ + bool_t (*x_getbytes) (...); + /* put some bytes to underlying stream */ + bool_t (*x_putbytes) (...); + /* put some words to underlying stream */ + bool_t (*x_putwords) (...); + /* put some longs to underlying stream */ + bool_t (*x_putlongs) (...); + /* returns bytes from beginning of stream*/ + u_int (*x_getpostn) (...); + /* reposition the stream */ + bool_t (*x_setpostn) (...); + /* buf quick ptr to buffered data */ + long * (*x_inline) (...); + /* free private elements of this stream */ + void (*x_destroy) (...); + } *x_ops; + caddr_t x_public; /* users' data */ + caddr_t x_private; /* pointer to private data */ + caddr_t x_base; /* private used for position info */ + u_int x_handy; /* extra private word */ +} XDR; + +#else + +typedef struct { + enum xdr_op x_op; /* operation; fast additional param */ + struct xdr_ops { + bool_t (*x_getlonglong)(); /* get a long long from underlying stream */ + bool_t (*x_putlonglong)(); /* put a long long to */ + bool_t (*x_getlong)(); /* get a long from underlying stream */ + bool_t (*x_putlong)(); /* put a long to " */ + bool_t (*x_getbytes)();/* get some bytes from " */ + bool_t (*x_putbytes)();/* put some bytes to " */ + bool_t (*x_putwords)();/* put some words to " */ + bool_t (*x_putlongs)();/* put some longs to " */ + u_int (*x_getpostn)();/* returns bytes off from beginning */ + bool_t (*x_setpostn)();/* lets you reposition the stream */ + long * (*x_inline)(); /* buf quick ptr to buffered data */ + void (*x_destroy)(); /* free privates of this xdr_stream */ + } *x_ops; + caddr_t x_public; /* users' data */ + caddr_t x_private; /* pointer to private data */ + caddr_t x_base; /* private used for position info */ + u_int x_handy; /* extra private word */ +} XDR; + +#endif /* __cplusplus */ + +/* + * Operations defined on a XDR handle + * + * XDR *xdrs; + * long *longp; + * caddr_t addr; + * u_int len; + * u_int pos; + */ +#define XDR_GETLONG(xdrs, longp) \ + (*(xdrs)->x_ops->x_getlong)(xdrs, longp) +#define xdr_getlong(xdrs, longp) \ + (*(xdrs)->x_ops->x_getlong)(xdrs, longp) + +#define XDR_PUTLONG(xdrs, longp) \ + (*(xdrs)->x_ops->x_putlong)(xdrs, longp) +#define xdr_putlong(xdrs, longp) \ + (*(xdrs)->x_ops->x_putlong)(xdrs, longp) + +#define XDR_GETLONGLONG(xdrs, longlongp) \ + (*(xdrs)->x_ops->x_getlonglong)(xdrs, longlongp) +#define xdr_getlonglong(xdrs, longp) \ + (*(xdrs)->x_ops->x_getlonglong)(xdrs, longlongp) + +#define XDR_PUTLONGLONG(xdrs, longlongp) \ + (*(xdrs)->x_ops->x_putlonglong)(xdrs, longlongp) +#define xdr_putlonglong(xdrs, longlongp) \ + (*(xdrs)->x_ops->x_putlonglong)(xdrs, longlongp) + + +#define XDR_GETBYTES(xdrs, addr, len) \ + (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) +#define xdr_getbytes(xdrs, addr, len) \ + (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) + +#define XDR_PUTBYTES(xdrs, addr, len) \ + (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) +#define xdr_putbytes(xdrs, addr, len) \ + (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) + +#define XDR_PUTWORDS(xdrs, addr, len) \ + (*(xdrs)->x_ops->x_putwords)(xdrs, addr, len) +#define xdr_putwords(xdrs, addr, len) \ + (*(xdrs)->x_ops->x_putwords)(xdrs, addr, len) + +#define XDR_PUTLONGS(xdrs, addr, len) \ + (*(xdrs)->x_ops->x_putlongs)(xdrs, addr, len) +#define xdr_putlongs(xdrs, addr, len) \ + (*(xdrs)->x_ops->x_putlongs)(xdrs, addr, len) + +#define XDR_GETPOS(xdrs) \ + (*(xdrs)->x_ops->x_getpostn)(xdrs) +#define xdr_getpos(xdrs) \ + (*(xdrs)->x_ops->x_getpostn)(xdrs) + +#define XDR_SETPOS(xdrs, pos) \ + (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) +#define xdr_setpos(xdrs, pos) \ + (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) + +#define XDR_INLINE(xdrs, len) \ + (*(xdrs)->x_ops->x_inline)(xdrs, len) +#define xdr_inline(xdrs, len) \ + (*(xdrs)->x_ops->x_inline)(xdrs, len) + +#define XDR_DESTROY(xdrs) \ + if ((xdrs)->x_ops->x_destroy) \ + (*(xdrs)->x_ops->x_destroy)(xdrs) +#define xdr_destroy(xdrs) \ + if ((xdrs)->x_ops->x_destroy) \ + (*(xdrs)->x_ops->x_destroy)(xdrs) + +/* + * Support struct for discriminated unions. + * You create an array of xdrdiscrim structures, terminated with + * a entry with a null procedure pointer. The xdr_union routine gets + * the discriminant value and then searches the array of structures + * for a matching value. If a match is found the associated xdr routine + * is called to handle that part of the union. If there is + * no match, then a default routine may be called. + * If there is no match and no default routine it is an error. + */ +#define NULL_xdrproc_t ((xdrproc_t)0) +struct xdr_discrim { + int value; + xdrproc_t proc; +}; + +/* + * In-line routines for fast encode/decode of primitve data types. + * Caveat emptor: these use single memory cycles to get the + * data from the underlying buffer, and will fail to operate + * properly if the data is not aligned. The standard way to use these + * is to say: + * if ((buf = XDR_INLINE(xdrs, count)) == NULL) + * return (FALSE); + * <<< macro calls >>> + * where ``count'' is the number of bytes of data occupied + * by the primitive data types. + * + * N.B. and frozen for all time: each data type here uses 4 bytes + * of external representation. + */ +#ifndef _BYTE_ORDER +#error _BYTE_ORDER must be defined. +#endif +#ifndef _BIG_ENDIAN +#error _BIG_ENDIAN must be defined. +#endif + +#if (_BYTE_ORDER == _BIG_ENDIAN) +#define IXDR_GET_LONG(buf) ntohl((u_long) *(buf)++) +#else +#define IXDR_GET_LONG(buf) ixdr_get_long (&buf) +#endif /* (_BYTE_ORDER == _BIG_ENDIAN) */ + +#define IXDR_PUT_LONG(buf, v) (*buf++ = htonl((u_long) (v))) + +#define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf)) +#define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf)) +#define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_LONG(buf)) +#define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf)) +#define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_LONG(buf)) + +#define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG((buf), (v)) +#define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG((buf), (v)) +#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG((buf), (v)) +#define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG((buf), (v)) +#define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG((buf), (v)) + + +/* + * Common opaque bytes objects used by many rpc protocols + * declared here due to commonality. + */ +#define MAX_NETOBJ_SZ 1024 + +struct netobj + { + u_int n_len; + char *n_bytes; + }; + +typedef struct netobj netobj; + +/* + * These are the public routines for the various implementations of + * xdr streams. + */ + +/* extern void xdrmem_create(); */ /* XDR using memory buffers */ +/* extern void xdrstdio_create(); */ /* XDR using stdio library */ +/* extern void xdrrec_create(); */ /* XDR pseudo records for tcp */ +/* extern bool_t xdrrec_endofrecord(); */ /* make end of xdr record */ +/* extern bool_t xdrrec_skiprecord(); */ /* move to begining of next record */ +/* extern bool_t xdrrec_eof(); */ /* true iff no more input */ + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void xdr_free (xdrproc_t proc, char *objp); +extern bool_t xdr_void (void); +extern bool_t xdr_int (XDR *xdrs, int *ip); +extern bool_t xdr_u_int (XDR *xdrs, u_int *up); +extern bool_t xdr_long (XDR *xdrs, long *lp); +extern bool_t xdr_u_long (XDR *xdrs, u_long *ulp); +extern bool_t xdr_short (XDR *xdrs, short *sp); +extern bool_t xdr_u_short (XDR *xdrs, u_short *usp); +extern bool_t xdr_char (XDR *xdrs, char *cp); +extern bool_t xdr_u_char (XDR *xdrs, u_char *ucp); +extern bool_t xdr_bool (XDR *xdrs, bool_t *bp); +extern bool_t xdr_enum (XDR *xdrs, enum_t *ep); +extern bool_t xdr_opaque (XDR *xdrs, caddr_t cp, u_int cnt); +extern bool_t xdr_bytes (XDR *xdrs, char **cpp, u_int *sizep, + u_int maxsize); +extern bool_t xdr_netobj (XDR *xdrs, struct netobj *np); +extern bool_t xdr_union (XDR *xdrs, enum_t *dscmp, caddr_t unp, + struct xdr_discrim *choices, xdrproc_t dfault); +extern bool_t xdr_string (XDR *xdrs, char **cpp, u_int maxsize); +extern bool_t xdr_wrapstring (XDR *xdrs, char **cpp); +extern bool_t xdr_array (XDR *xdrs, caddr_t *addrp, u_int *sizep, + u_int maxsize, u_int elsize, xdrproc_t elproc); +extern bool_t xdr_vector (XDR *xdrs, char *basep, u_int nelem, + u_int elemsize, xdrproc_t xdr_elem); +extern bool_t xdr_float (XDR *xdrs, float *fp); +extern bool_t xdr_double (XDR *xdrs, double *dp); +extern void xdrmem_create (XDR *xdrs, caddr_t addr, u_int size, + enum xdr_op op); +extern void * xdrrec_create (XDR *xdrs, u_int sendsize, u_int recvsize, + caddr_t tcp_handle, int (*readit)(), int (*writeit)()); +extern bool_t xdrrec_skiprecord (XDR *xdrs); +extern bool_t xdrrec_eof (XDR *xdrs); +extern bool_t xdrrec_endofrecord (XDR *xdrs, bool_t sendnow); +extern bool_t xdr_reference (XDR *xdrs, caddr_t *pp, u_int size, + xdrproc_t proc); +extern bool_t xdr_pointer (XDR *xdrs, char **objpp, u_int obj_size, + xdrproc_t xdr_obj); + +#else + +extern void xdr_free (); +extern bool_t xdr_void (); +extern bool_t xdr_int (); +extern bool_t xdr_u_int (); +extern bool_t xdr_long (); +extern bool_t xdr_u_long (); +extern bool_t xdr_short (); +extern bool_t xdr_u_short (); +extern bool_t xdr_char (); +extern bool_t xdr_u_char (); +extern bool_t xdr_bool (); +extern bool_t xdr_enum (); +extern bool_t xdr_opaque (); +extern bool_t xdr_bytes (); +extern bool_t xdr_netobj (); +extern bool_t xdr_union (); +extern bool_t xdr_string (); +extern bool_t xdr_wrapstring (); +extern bool_t xdr_array (); +extern bool_t xdr_vector (); +extern bool_t xdr_float (); +extern bool_t xdr_double (); +extern void * xdrmem_create (); +extern void xdrrec_create (); +extern bool_t xdrrec_skiprecord (); +extern bool_t xdrrec_eof (); +extern bool_t xdrrec_endofrecord (); +extern bool_t xdr_reference (); +extern bool_t xdr_pointer (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCxdrh */ diff --git a/h/rpcLib.h b/h/rpcLib.h new file mode 100644 index 0000000..39119e9 --- /dev/null +++ b/h/rpcLib.h @@ -0,0 +1,76 @@ +/* rpcLib.h - Remote Procedure Call library header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02c,22sep92,rrr added support for c++ +02b,07sep92,smb added include of rpc/clnt.h to remove warnings. +02a,04jul92,jcf cleaned up. +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01b,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01a,16nov88,llk written. +*/ + +#ifndef __INCrpcLibh +#define __INCrpcLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "rpc/clnt.h" + +/* rpcLib status codes derived from Sun's RPC specification (see rpc/clnt.h) */ + +#define S_rpcLib_RPC_SUCCESS (M_rpcClntStat | (int) RPC_SUCCESS) +/* + * local errors + */ +#define S_rpcLib_RPC_CANTENCODEARGS (M_rpcClntStat | (int) RPC_CANTENCODEARGS) +#define S_rpcLib_RPC_CANTDECODERES (M_rpcClntStat | (int) RPC_CANTDECODERES) +#define S_rpcLib_RPC_CANTSEND (M_rpcClntStat | (int) RPC_CANTSEND) +#define S_rpcLib_RPC_CANTRECV (M_rpcClntStat | (int) RPC_CANTRECV) +#define S_rpcLib_RPC_TIMEDOUT (M_rpcClntStat | (int) RPC_TIMEDOUT) +#define S_rpcLib_RPC_VERSMISMATCH (M_rpcClntStat | (int) RPC_VERSMISMATCH) +#define S_rpcLib_RPC_AUTHERROR (M_rpcClntStat | (int) RPC_AUTHERROR) +#define S_rpcLib_RPC_PROGUNAVAIL (M_rpcClntStat | (int) RPC_PROGUNAVAIL) +#define S_rpcLib_RPC_PROGVERSMISMATCH (M_rpcClntStat | (int) RPC_PROGVERSMISMATCH) +#define S_rpcLib_RPC_PROCUNAVAIL (M_rpcClntStat | (int) RPC_PROCUNAVAIL) +#define S_rpcLib_RPC_CANTDECODEARGS (M_rpcClntStat | (int) RPC_CANTDECODEARGS) +#define S_rpcLib_RPC_SYSTEMERROR (M_rpcClntStat | (int) RPC_SYSTEMERROR) +#define S_rpcLib_RPC_UNKNOWNHOST (M_rpcClntStat | (int) RPC_UNKNOWNHOST) +#define S_rpcLib_RPC_PMAPFAILURE (M_rpcClntStat | (int) RPC_PMAPFAILURE) +#define S_rpcLib_RPC_PROGNOTREGISTERED (M_rpcClntStat | (int) RPC_PROGNOTREGISTERED) +#define S_rpcLib_RPC_FAILED (M_rpcClntStat | (int) RPC_FAILED) + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS rpcInit (void); +extern STATUS rpcTaskInit (void); +extern int rpcErrnoGet (void); +extern void rpcClntErrnoSet (enum clnt_stat status); + +#else /* __STDC__ */ + +extern STATUS rpcInit (); +extern STATUS rpcTaskInit (); +extern int rpcErrnoGet (); +extern void rpcClntErrnoSet (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrpcLibh */ diff --git a/h/rt11FsLib.h b/h/rt11FsLib.h new file mode 100644 index 0000000..f75bdf0 --- /dev/null +++ b/h/rt11FsLib.h @@ -0,0 +1,244 @@ +/* rt11FsLib.h - header for RT-11 media-compatible file system library */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +02h,26may92,rrr the tree shuffle +02g,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed READ, WRITE and UPDATE to O_RDONLY O_WRONLY O_RDWR + -changed VOID to void + -changed copyright notice +02f,10jun91.del added pragma for gnu960 alignment. +02e,08oct90,kdl removed declarations of functions now made LOCAL. +02d,05oct90,shl added ANSI function prototypes. + added copyright notice. +02c,10aug90,dnw added declaration of rt11FsReadyChange(). +02b,09aug90,kdl changed name from rt11Lib to rt11FsLib. +02a,07aug90,shl added IMPORT type to function declarations. +01z,04may90,kdl moved volume mode from vol descriptor to BLK_DEV (blkIo.h), + added vd_changeNoWarn. +01y,23mar90,kdl added S_rt11Lib_NO_BLOCK_DEVICE. +01x,07mar90,kdl changed to support multi-filesystem device drivers. +01w,05jun88,dnw changed rtLib to rt11Lib. +01v,30may88,dnw changed to v4 names. +01u,04may88,jcf changed SEMAPHORE to SEM_ID. +01t,25may88,dnw deleted erroneous ")" in S_rtLib_ENTRY_NUMBER_TOO_BIG def'n. +01s,19aug87,dnw changed rfd_start to be int instead of short to support + disks larger than 32k blocks. +01r,21mar87,gae spelling, S_rtLib_ENTRY_NUMBER_TO_BIG. +01q,04feb87,llk made changes which allow a one segment directory to have any + number of file entries. Segments are now dynamically + allocated (vd_dir_seg). Added vd_nSegBlocks field to + volume descriptor. It tells how many blocks are in the + volume descriptor's segment. +01p,14jan87,llk added RT_MAX_FILE_SIZE. Made de_nblocks unsigned. +01o,24dec86,gae changed stsLib.h to vwModNum.h. +01n,16oct86,gae added vd_mode to RT_VOL_DESC. +01m,07apr86,dnw replaced vd_ready flag with vd_state in RT_VOL_DESC. +01l,11mar86,dnw added vd_retry to RT_VOL_DESC. +01k,04sep85,jlf added vd_ready and vd_reset to RT_VOL_DESC. +01j,14aug85,dnw added S_rtLib_INVALID_DEVICE_PARAMETERS. +01i,28may85,jlf changed RT_VOL_DESC to contain disk format info, and sec + read and write routines rather than block. +01h,13aug84,ecs changed status codes: NO_ROOM_ON_DISK to DISK_FULL, + NO_SUCH_FILE to FILE_NOT_FOUND, + NAME_IN_USE to FILE_ALREADY_EXISTS. +01g,08aug84,ecs added status codes and include of stsLib.h. +01f,01aug84,dnw removed single density disk definitions, SD_..., to fd208Drv.c. +01e,06jul84,ecs removed rfd_entry_num from RT_FILE_DESC. + added vd_sem to RT_VOL_DESC. + added include of semLib.h. + changed rfd_modified from TBOOL to BOOL. +01d,11jun84,dnw removed vd_volume and added vd_rdblk, vd_wrtblk, and vd_nblocks + to RT_VOL_DESC. + added definitions of SD_RT_... for single density specific + values. +01c,27jan84,ecs added inclusion test. +01b,14aug83,dnw replaced RT_FILE_DESC.rfd_vdnum volume descriptor number with + .rfd_vdptr volume descriptor pointer. + replaced RT_FILE_DESC.rfd_maxblock end block number with + .rfd_endptr end byte pointer. +01a,14Feb83,dnw written +*/ + +#ifndef __INCrt11FsLibh +#define __INCrt11FsLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "iosLib.h" +#include "semLib.h" +#include "blkIo.h" +#include "vwModNum.h" + + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ +/* rt11FsLib status codes */ + +#define S_rt11FsLib_VOLUME_NOT_AVAILABLE (M_rt11FsLib | 1) +#define S_rt11FsLib_DISK_FULL (M_rt11FsLib | 2) +#define S_rt11FsLib_FILE_NOT_FOUND (M_rt11FsLib | 3) +#define S_rt11FsLib_NO_FREE_FILE_DESCRIPTORS (M_rt11FsLib | 4) +#define S_rt11FsLib_INVALID_NUMBER_OF_BYTES (M_rt11FsLib | 5) +#define S_rt11FsLib_FILE_ALREADY_EXISTS (M_rt11FsLib | 6) +#define S_rt11FsLib_BEYOND_FILE_LIMIT (M_rt11FsLib | 7) +#define S_rt11FsLib_INVALID_DEVICE_PARAMETERS (M_rt11FsLib | 8) +#define S_rt11FsLib_NO_MORE_FILES_ALLOWED_ON_DISK (M_rt11FsLib | 9) +#define S_rt11FsLib_ENTRY_NUMBER_TOO_BIG (M_rt11FsLib | 10) +#define S_rt11FsLib_NO_BLOCK_DEVICE (M_rt11FsLib | 11) + +/* rt11Fs file system constants */ + +#define RT_DIR_BLOCK 6 +#define RT_BYTES_PER_BLOCK 512 +#define RT_FILES_FOR_2_BLOCK_SEG 72 +#define RT_MAX_BLOCKS_PER_FILE 0xffff /* maximum number of blocks per file, + largest size described by an unsigned + short (de_nblocks field of + RT_DIR_ENTRY) */ + + +/* directory entry status values */ + +#define DES_TENTATIVE 0x0100 /* tentative file */ +#define DES_EMPTY 0x0200 /* empty space */ +#define DES_PERMANENT 0x0400 /* permanent file */ +#define DES_END 0x0800 /* end of directory segment marker */ + +#define DES_BOGUS 0x0000 /* not a real rt11Fs directory entry */ + + +/* miscellaneous */ + +#define NOT_IN_USE -1 /* descriptor not-in-use flag, + * in fd.rfd_status, vd.rfd_status */ + +/* rt11Fs radix-50 name structure */ + +typedef struct /* RT_NAME */ + { + unsigned short nm_name1; /* filename chars 1-3 in radix-50 */ + unsigned short nm_name2; /* filename chars 4-6 in radix-50 */ + unsigned short nm_type; /* file type chars 1-3 in radix-50 */ + } RT_NAME; + + +/* directory entry */ + +typedef struct /* RT_DIR_ENTRY */ + { + short de_status; /* file status */ + RT_NAME de_name; /* filename in radix-50 structure */ + unsigned short de_nblocks; /* number of blocks in file */ + char de_jobnum; /* (temp file only) job with file open */ + char de_channel; /* (temp file only) channel with file is open */ + short de_date; /* file creation date: + * bits 14-10 = month (1-12) in decimal + * bits 9- 5 = day (1-31) in decimal + * bits 4- 0 = year minus 110 in octal + */ + } RT_DIR_ENTRY; + + +/* directory segment */ + +typedef struct /* RT_DIR_SEG */ + { + short ds_nsegs; /* number of segments in directory */ + short ds_next_seg; /* number of next segment (0 = end of list) */ + short ds_last_seg; /* number of highest segment used */ + short ds_extra; /* number of extra bytes on each dir entry */ + short ds_start; /* number of first data block for this seg */ + RT_DIR_ENTRY ds_entries [1]; /* directory entries, + actual size gets dynamically allocated */ + } RT_DIR_SEG; + + +/* volume descriptor */ + +typedef struct /* RT_VOL_DESC */ + { + DEV_HDR vd_devhdr; /* i/o system device header (MUST COME FIRST!)*/ + short vd_status; /* (OK | ERROR) */ + SEM_ID vd_semId; /* volume descriptor semaphore id */ + BLK_DEV *vd_pBlkDev; /* pointer to block device info */ + int vd_nblocks; /* number of blocks in volume */ + BOOL vd_rtFmt; /* TRUE if using RT-11 skew and track offset */ + int vd_secBlock; /* Number of sectors per block */ + int vd_state; /* state of volume (see below) */ + int vd_retry; /* retry count of disk operations */ + int vd_nSegBlocks; /* number of blocks in the directory segment, + there are always at least 2 */ + RT_DIR_SEG *vd_dir_seg; /* pointer to current directory segment */ + BOOL vd_changeNoWarn; /* TRUE if disk changed without readyChange */ + } RT_VOL_DESC; + +/* volume states */ + +#define RT_VD_READY_CHANGED 0 /* vol not accessed since ready change*/ +#define RT_VD_RESET 1 /* volume reset but not mounted */ +#define RT_VD_MOUNTED 2 /* volume mounted */ +#define RT_VD_CANT_RESET 3 /* volume reset failed */ +#define RT_VD_CANT_MOUNT 4 /* volume mount failed */ + + +/* rt11Fs file descriptor */ + +typedef struct /* RT_FILE_DESC */ + { + short rfd_status; /* (OK | NOT_IN_USE) */ + RT_VOL_DESC *rfd_vdptr; /* pointer to rt11Fs volume descriptor */ + int rfd_start; /* number of first block in file */ + short rfd_mode; /* access mode: O_RDONLY, O_WRONLY, O_RDWR */ + RT_DIR_ENTRY rfd_dir_entry; /* directory entry for this file */ + int rfd_curptr; /* file byte ptr of current buffer byte 0 */ + int rfd_newptr; /* file byte ptr for new read/writes */ + int rfd_endptr; /* file byte ptr to end of file */ + BOOL rfd_modified; /* TRUE = buffer has been modified */ + char rfd_buffer [RT_BYTES_PER_BLOCK]; + /* file I/O buffer */ + } RT_FILE_DESC; + + +/* Function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern RT_VOL_DESC *rt11FsDevInit (char *devName, BLK_DEV *pBlkDev, + BOOL rt11Fmt, int nEntries, + BOOL changeNoWarn); +extern RT_VOL_DESC *rt11FsMkfs (char *volName, BLK_DEV *pBlkDev); +extern STATUS rt11FsInit (int maxFiles); +extern void rt11FsDateSet (int year, int month, int day); +extern void rt11FsModeChange (RT_VOL_DESC *vdptr, int newMode); +extern void rt11FsReadyChange (RT_VOL_DESC *vdptr); + +#else /* __STDC__ */ + +extern RT_VOL_DESC *rt11FsDevInit (); +extern RT_VOL_DESC *rt11FsMkfs (); +extern STATUS rt11FsInit (); +extern void rt11FsDateSet (); +extern void rt11FsModeChange (); +extern void rt11FsReadyChange (); + +#endif /* __STDC__ */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrt11FsLibh */ diff --git a/h/rtpIoLib.h b/h/rtpIoLib.h new file mode 100644 index 0000000..804b131 --- /dev/null +++ b/h/rtpIoLib.h @@ -0,0 +1,52 @@ +/* rtpIoLib.h - real time process I/O library header file */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,31aug04,yvp Removed rtpIoInit(). +01e,30mar04,dat removed rtpIoFdNew. (use iosFdNew) +01d,18feb04,dat chg'd lengths from int to size_t +01c,12nov03,pmr default path defines +01b,10nov03,pmr new function rtpIoFdNew(). +01a,31oct03,pmr written. +*/ + +#ifndef __INCrtpIoLibh +#define __INCrtpIoLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" +#include "dllLib.h" +#include "vwModNum.h" +#include "rtpLibCommon.h" + +/* must have a minimum of 3 for standard I/O */ +#define RTP_IO_MIN_FDS 3 + +/* default length for default path */ +#define RTP_IO_DEF_PATH_LEN 256 + +#ifndef _ASMLANGUAGE + +/* function prototypes */ + +IMPORT int rtpIoFdValue (RTP_ID pRtp, int fd); +IMPORT STATUS rtpIoDefPathGet (RTP_ID, char *, size_t); +IMPORT STATUS rtpIoDefPathSet (RTP_ID, const char *); +IMPORT size_t rtpIoTableSizeGet (RTP_ID); +IMPORT STATUS rtpIoTableSizeSet (RTP_ID, size_t); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrtpIoLibh */ diff --git a/h/rtpLib.h b/h/rtpLib.h new file mode 100644 index 0000000..ac4eca4 --- /dev/null +++ b/h/rtpLib.h @@ -0,0 +1,69 @@ +/* rtpLib.h - real time process library header file */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01r,12oct04,kk updated kernelBaseLib.h to private/kernelBaseLibP.h, + added rtpShow prototype +01q,22sep04,ans moved rtpLibInit() rtpShowInit() rtpShellCmdInit() to + rtpLibP.h +01p,10aug04,kk renamed rtpBaseLib.h to kernelBaseLib.h +01p,02sep04,yvp Remove const from rtpLibInit params. +01o,27apr04,ans Added RTP_DEL_FORCE option +01n,15apr04,kk rename rtpSelfIdGet to rtpIdSelf(), added include of + rtpBaseLib.h +01m,06apr04,job Extended rtpLibInit() prototype. +01l,18feb04,ans Added rtpSignalQueueSz parameter to rtpLibInit (). +01k,17nov03,yvp Added RTP hook support. +01j,30oct03,nrj added support for waitpid +01j,22sep03,bpn Cleaned up. Added rtpShellCmdInit() prototype. +01i,22sep03,kk remove rtpSpawn, moved to rtpLibCommon.h +01h,15sep03,kk move common definitions to rtpLibCommon.h, + added options arg to rtpDelete(), + added RTP_DEL_VIA_TASK_DELETE option +01g,26aug03,nrj reorganized and moved to private hdr +01f,18aug03,job Added rtpShowInit() prototype. +01e,22jul03,pad Moved _exit() declaration to taskLibP.h for decoupling + reasons. +01d,07jul03,nrj added rtpDelete +01c,07jul03,nrj removing RTP_ID from here +01b,07jul03,nrj changed create API +01a,26jun03,nrj written. +*/ + +#ifndef __INCrtpLibh +#define __INCrtpLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" +#include "dllLib.h" +#include "vwModNum.h" +#include "rtpLibCommon.h" +#include "private/kernelBaseLibP.h" /* for kernelId */ + +/* defines */ + +#define RTP_DEL_VIA_TASK_DELETE 0x1 /* rtpDelete() via taskDestroy() */ +#define RTP_DEL_FORCE 0x2 /* Forceful rtpDelete() */ + +#ifndef _ASMLANGUAGE + +/* function declarations */ + +extern STATUS rtpDelete (RTP_ID id, int options, int status); +extern BOOL rtpShow (char * rtpNameOrId, int level); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrtpLibh */ diff --git a/h/rtpLibCommon.h b/h/rtpLibCommon.h new file mode 100644 index 0000000..4b8bb55 --- /dev/null +++ b/h/rtpLibCommon.h @@ -0,0 +1,137 @@ +/* rtpLibCommon.h - common RTP management definitions */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01m,16nov04,kk increase VX_RTP_LENGTH to 255, removed pArg & pEnv + from RTP_DESC (SPR# 102911) +01l,27sep04,ans code inspection comments. +01k,22sep04,ans renamed S_rtpLib_INVALID_OPTION to + S_rtpLib_INVALID_TASK_OPTION +01j,04jun04,job Added RTP_LOADED_WAIT option +01i,05may04,yvp Added taskOptions parameter to rtpSpawn. +01h,30apr04,tam added RTP_BUFFER_VAL_OFF +01g,27apr04,ans Added RTP state and status. +01f,08apr04,kk remove mmList & sharedDataNode from RTP_DESC +01e,11mar04,job Added ACCESS_DENIED error value & changes error range + to more sensibly start from 1. +01d,19mar04,pad Replaced option RTP_WITH_SYMBOLS with more complete set of + options. +01c,12mar04,pad Added error numbers (shared library support). +01b,22sep03,kk moved rtpSpawn here, added rtpInfoGet() +01a,15sep03,kk created based on rtpLib.h +*/ + +#ifndef __INCrtpLibCommonh +#define __INCrtpLibCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "vwModNum.h" + +/* creation mode options */ + +#define RTP_GLOBAL_SYMBOLS 0x01 /* register global symbols for RTP */ +#define RTP_LOCAL_SYMBOLS 0x02 /* idem for local symbols */ +#define RTP_ALL_SYMBOLS (RTP_GLOBAL_SYMBOLS | RTP_LOCAL_SYMBOLS) +#define RTP_DEBUG 0x10 /* set RTP in debug mode when created */ +#define RTP_BUFFER_VAL_OFF 0x20 /* disable buffer validation for all */ + /* system calls issued from the RTP */ +#define RTP_LOADED_WAIT 0x40 /* Wait until the RTP is loaded */ + +/* Error Status codes */ + +#define S_rtpLib_INVALID_FILE (M_rtpLib | 1) +#define S_rtpLib_INVALID_OPTION (M_rtpLib | 2) +#define S_rtpLib_ACCESS_DENIED (M_rtpLib | 3) +#define S_rtpLib_INVALID_RTP_ID (M_rtpLib | 4) +#define S_rtpLib_NO_SYMBOL_TABLE (M_rtpLib | 5) +#define S_rtpLib_INVALID_SEGMENT_START_ADDRESS (M_rtpLib | 6) +#define S_rtpLib_INVALID_SYMBOL_REGISTR_POLICY (M_rtpLib | 7) +#define S_rtpLib_INSTANTIATE_FAILED (M_rtpLib | 8) +#define S_rtpLib_INVALID_TASK_OPTION (M_rtpLib | 9) +#define S_rtpLib_RTP_NAME_LENGTH_EXCEEDED (M_rtpLib | 10) /* rtpInfoGet */ + +#define VX_RTP_NAME_LENGTH 255 /* max name length for diplay */ + +/* + * The 'status' field (32 bit integer) of a RTP holds the RTP state and status. + * + * NOTE: RTP_STATE_GET() : read the RTP state(s) + * RTP_STATE_PUT() : write the RTP state(s) + * RTP_STATE_SET() : set a RTP state + * RTP_STATE_UNSET() : unset a RTP state + * + * RTP_STATUS_GET() : read the RTP status + * RTP_STATUS_PUT() : write the RTP status + * RTP_STATUS_SET() : set a RTP status + * RTP_STATUS_UNSET() : unset a RTP status + * + * The PUT/SET/UNSET macros are available only in the kernel headers. + */ + +/* RTP states */ + +#define RTP_STATE_CREATE 0x0001 /* RTP is under construction */ +#define RTP_STATE_NORMAL 0x0002 /* RTP is ready */ +#define RTP_STATE_DELETE 0x0004 /* RTP is being deleted */ + +#define RTP_STATUS_STOP 0x0100 /* RTP has recieved stopped signal */ +#define RTP_STATUS_ELECTED_DELETER 0x0200 /* RTP delete has started */ + +#define RTP_STATE_MASK (RTP_STATE_CREATE | RTP_STATE_NORMAL | \ + RTP_STATE_DELETE) +#define RTP_STATUS_MASK (RTP_STATUS_STOP | RTP_STATUS_ELECTED_DELETER) + +#define RTP_STATE_GET(value) ((value) & RTP_STATE_MASK) +#define RTP_STATUS_GET(value) ((value) & RTP_STATUS_MASK) + +/* IS_RTP_ macros */ + +#define IS_RTP_STATE_NORMAL(value) ((RTP_STATE_GET (value) & RTP_STATE_NORMAL) \ + == RTP_STATE_NORMAL) +#define IS_RTP_STATE_CREATE(value) ((RTP_STATE_GET (value) & RTP_STATE_CREATE) \ + == RTP_STATE_CREATE) +#define IS_RTP_STATE_DELETE(value) ((RTP_STATE_GET (value) & RTP_STATE_DELETE) \ + == RTP_STATE_DELETE) +#define IS_RTP_STATUS_STOP(value) ((RTP_STATUS_GET (value) & \ + RTP_STATUS_STOP) == RTP_STATUS_STOP) +#define IS_RTP_STATUS_ELECTED_DELETER(value) ((RTP_STATUS_GET (value) & \ + RTP_STATUS_ELECTED_DELETER) == RTP_STATUS_ELECTED_DELETER) + +/* typedefs */ + +#ifndef _ASMLANGUAGE + +typedef struct /* RTP_DESC - information structure */ + { + char pathName[VX_RTP_NAME_LENGTH + 1]; /* path to RTP executable */ + int status; /* the status field of the RTP */ + UINT32 options; /* option bits, e.g. debug, symtable */ + void * entrAddr; /* entry point of ELF file */ + int initTaskId; /* the initial task ID */ + INT32 taskCnt; /* number of tasks in the RTP */ + RTP_ID parentId; /* RTP ID of the parent */ + } RTP_DESC; + +/* forward declarations */ + +extern RTP_ID rtpSpawn (const char * rtpFileName, const char * argv[], + const char * envp[], int priority, int uStackSize, + int options, int taskOptions); + +extern STATUS rtpInfoGet (RTP_ID rtpId, + RTP_DESC * rtpStruct); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrtpLibCommonh */ diff --git a/h/rtpVarLib.h b/h/rtpVarLib.h new file mode 100644 index 0000000..004237c --- /dev/null +++ b/h/rtpVarLib.h @@ -0,0 +1,38 @@ +/* rtpVarLib.h - header for RTP variables */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,02mar04,kk written +*/ + +#ifndef __INCrtpVarLibh +#define __INCrtpVarLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "rtpLib.h" +#include "rtpVarLibCommon.h" + +/* RTP variable structure */ + +typedef struct rtp_var + { + struct rtp_var * next; /* link the RTP vars */ + RTP_VAR_ADDR addr; /* address of variable to switch */ + RTP_VAR value; /* value of variable */ + } RTP_VAR_INFO; + +extern STATUS rtpVarAdd (RTP_VAR_ADDR pVar, RTP_VAR value, RTP_ID rtpId); +extern STATUS rtpVarDelete (RTP_VAR_ADDR pVar, RTP_ID rtpId); +extern STATUS rtpVarDeleteAll (RTP_ID rtpId); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrtpVarLibh */ diff --git a/h/rtpVarLibCommon.h b/h/rtpVarLibCommon.h new file mode 100644 index 0000000..92a451b --- /dev/null +++ b/h/rtpVarLibCommon.h @@ -0,0 +1,29 @@ +/* rtpVarLibCommon.h - header for user and kernel RTP variables */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,02mar04,kk written +*/ + +#ifndef __INCrtpVarLibCommonh +#define __INCrtpVarLibCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "rtpLib.h" + +/* typedefs */ + +typedef void * RTP_VAR; +typedef RTP_VAR * RTP_VAR_ADDR; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrtpVarLibCommonh */ diff --git a/h/scMemVal.h b/h/scMemVal.h new file mode 100644 index 0000000..b0a2b2d --- /dev/null +++ b/h/scMemVal.h @@ -0,0 +1,41 @@ +/* scMemVal.h - header file for system call validation routines */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01a,04nov04,zl created from private file. +*/ + +#ifndef __INCscMemValh +#define __INCscMemValh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + +/* defines */ + +#define SC_PROT_READ 0x1 /* read access in supervisor mode */ +#define SC_PROT_WRITE 0x2 /* write access in supervisor mode */ + +#ifndef _ASMLANGUAGE + +/* type definitions */ + +typedef unsigned int SC_PROT_ATTR; + +/* function declarations */ + +IMPORT STATUS scMemValidate (const void * addr, UINT size, SC_PROT_ATTR prot); +IMPORT void scMemValEnable (BOOL enable); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCscMemValh */ diff --git a/h/sched.h b/h/sched.h new file mode 100644 index 0000000..f37f79a --- /dev/null +++ b/h/sched.h @@ -0,0 +1,72 @@ +/* sched.h - POSIX scheduler header file */ + +/* Copyright 1984-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,05jan94,kdl removed include of private/schedP.h. +01a,04nov93,dvs written +*/ + +#ifndef __INCschedh +#define __INCschedh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "time.h" +#include "timers.h" + +/* scheduling policies */ + +#define SCHED_FIFO 0x1 /* FIFO per priority scheduling policy */ +#define SCHED_RR 0x2 /* round robin scheduling policy */ +#define SCHED_OTHER 0x4 /* implementation defined; not currently used */ + +/* high/low priority values per scheduling policy POSIX numbering */ + +#define SCHED_FIFO_HIGH_PRI 255 /* POSIX highest priority for FIFO */ +#define SCHED_FIFO_LOW_PRI 0 /* POSIX lowest priority for FIFO */ +#define SCHED_RR_HIGH_PRI 255 /* POSIX highest priority for RR */ +#define SCHED_RR_LOW_PRI 0 /* POSIX lowest priority for RR */ + +struct sched_param /* Scheduling parameter structure */ + { + int sched_priority; /* scheduling priority */ + }; + + +/* Function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern int sched_setparam (pid_t pid, const struct sched_param * param); +extern int sched_getparam (pid_t pid, struct sched_param * param); +extern int sched_setscheduler (pid_t pid, int policy, + const struct sched_param * param); +extern int sched_getscheduler (pid_t pid); +extern int sched_yield (void); +extern int sched_get_priority_max (int policy); +extern int sched_get_priority_min (int policy); +extern int sched_rr_get_interval (pid_t pid, struct timespec * interval); + +#else /* __STDC__ */ + +extern int sched_setparam (); +extern int sched_getparam (); +extern int sched_setscheduler (); +extern int sched_getscheduler (); +extern int sched_yield (); +extern int sched_get_priority_max (); +extern int sched_get_priority_min (); +extern int sched_rr_get_interval (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCschedh */ diff --git a/h/scsi1Lib.h b/h/scsi1Lib.h new file mode 100644 index 0000000..6c20f33 --- /dev/null +++ b/h/scsi1Lib.h @@ -0,0 +1,599 @@ +/* scsi1Lib.h - SCSI library header file */ + +/* Copyright 1984-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02l,18feb04,rfr Added SCSI_OPCODE_SYNC_CACHE +02k,10oct94,jds fixed for SCSI1 and SCSI2 compatability +02j,11jan93,ccc added #ifndef _ASMLANGUAGE. +02i,30sep92,ccc added two new errno's. +02h,24sep92,ccc removed timeout parameter to scsiAutoConfig(). +02g,22sep92,rrr added support for c++ +02f,27aug92,ccc added timeout to SCSI_TRANSACTION structure. +02e,26jul92,rrr Removed decl of scsiSyncTarget, it was made LOCAL. +02d,20jul92,eve Remove conditional compilation. +02c,14jul92,eve added a pScsiXaction info in SCSI_PHYS_DEV structure to + maintain the data direction information to support + cache coherency in drivers. +02b,06jul92,eve added declaration for extended sync functionalities. +02a,04jul92,jcf cleaned up. +01l,26may92,rrr the tree shuffle +01k,07apr92,yao changed BYTE_ORDER to _BYTE_ORDER, BIG_ENDIAN to _BIG_ENDIAN. +01j,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed READ, WRITE and UPDATE to O_RDONLY O_WRONLY O_RDWR + -changed VOID to void + -changed copyright notice +01i,07mar91,jcc added SCSI_BLK_DEV_LIST and SCSI_BLK_DEV_NODE definitions; + added SCSI_SWAB macro. added a few error codes. +01h,05oct90,shl added ANSI function prototypes. + added copyright notice. +01g,02oct90,jcc changed SEM_ID's to SEMAPHORE's in SCSI_PHYS_DEV and SCSI_CTRL + structures; modified structures to return variable length + REQUEST SENSE data; miscellaneous. +01f,20aug90,jcc added conditional defines and typedefs for 4.0.2 compatibility. +01e,10aug90,dnw changed scsiBusReset and scsiSelTimeOutCvt to VOIDFUNCPTR. +01d,07aug90,shl moved function declarations to end of file. +01c,12jul90,jcc misc. enhancements and changes. +01b,08jun90,jcc added scsiMsgInAck to SCSI_CTRL, which routine is invoked + to accept incoming messages. +01a,17apr89,jcc written. +*/ + +#ifndef __INCscsi1Libh +#define __INCscsi1Libh + +#ifndef _ASMLANGUAGE + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "blkIo.h" +#include "lstLib.h" +#include "private/semLibP.h" + +#ifndef WAIT_FOREVER /* the following is for 4.0.2 backward compatibility */ + +#define WAIT_FOREVER (-1) +typedef void (*VOIDFUNCPTR) (); /* ptr to function returning void */ +typedef unsigned char UINT8; +typedef unsigned short UINT16; + +#endif /* WAIT_FOREVER */ + +/* SCSI direct-access device and general purpose command opcodes are enumerated. + * NOTE: Some commands are optional and may not be supported by all devices. + */ + +#define SCSI_OPCODE_TEST_UNIT_READY ((UINT8) 0x00) /* test unit ready */ +#define SCSI_OPCODE_REZERO_UNIT ((UINT8) 0x01) /* rezero unit */ +#define SCSI_OPCODE_REWIND ((UINT8) 0x01) /* rewind */ +#define SCSI_OPCODE_REQUEST_SENSE ((UINT8) 0x03) /* request sense */ +#define SCSI_OPCODE_FORMAT_UNIT ((UINT8) 0x04) /* format unit */ +#define SCSI_OPCODE_READ_BLOCK_LIMITS ((UINT8) 0x05) /* read block limits */ +#define SCSI_OPCODE_REASSIGN_BLOCKS ((UINT8) 0x07) /* reassign blocks */ +#define SCSI_OPCODE_READ ((UINT8) 0x08) /* read */ +#define SCSI_OPCODE_RECEIVE ((UINT8) 0x08) /* receive */ +#define SCSI_OPCODE_WRITE ((UINT8) 0x0a) /* write */ +#define SCSI_OPCODE_PRINT ((UINT8) 0x0a) /* print */ +#define SCSI_OPCODE_SEND ((UINT8) 0x0a) /* send */ +#define SCSI_OPCODE_SEEK ((UINT8) 0x0b) /* seek */ +#define SCSI_OPCODE_TRACK_SELECT ((UINT8) 0x0b) /* track select */ +#define SCSI_OPCODE_SLEW_AND_PRINT ((UINT8) 0x0b) /* slew and print */ +#define SCSI_OPCODE_READ_REVERSE ((UINT8) 0x0f) /* read reverse */ +#define SCSI_OPCODE_WRITE_FILEMARKS ((UINT8) 0x10) /* write filemarks */ +#define SCSI_OPCODE_FLUSH_BUFFER ((UINT8) 0x10) /* flush buffer */ +#define SCSI_OPCODE_SPACE ((UINT8) 0x11) /* space */ +#define SCSI_OPCODE_INQUIRY ((UINT8) 0x12) /* inquiry */ +#define SCSI_OPCODE_VERIFY_SEQ ((UINT8) 0x13) /* seq. access verify */ +#define SCSI_OPCODE_RECOVER_BUF_DATA ((UINT8) 0x14) /* rec. buffered data */ +#define SCSI_OPCODE_MODE_SELECT ((UINT8) 0x15) /* mode select */ +#define SCSI_OPCODE_RESERVE ((UINT8) 0x16) /* reserve */ +#define SCSI_OPCODE_RELEASE ((UINT8) 0x17) /* release */ +#define SCSI_OPCODE_COPY ((UINT8) 0x18) /* copy */ +#define SCSI_OPCODE_ERASE ((UINT8) 0x19) /* erase */ +#define SCSI_OPCODE_MODE_SENSE ((UINT8) 0x1a) /* mode sense */ +#define SCSI_OPCODE_START_STOP_UNIT ((UINT8) 0x1b) /* start/stop unit */ +#define SCSI_OPCODE_LOAD_UNLOAD ((UINT8) 0x1b) /* load/unload */ +#define SCSI_OPCODE_STOP_PRINT ((UINT8) 0x1b) /* stop print */ +#define SCSI_OPCODE_RECV_DIAG_RESULTS ((UINT8) 0x1c) /* recv diag results */ +#define SCSI_OPCODE_SEND_DIAGNOSTIC ((UINT8) 0x1d) /* send diagnostic */ +#define SCSI_OPCODE_CTRL_MEDIUM_REMOVAL ((UINT8) 0x1e) /* ctrl med. removal */ +#define SCSI_OPCODE_READ_CAPACITY ((UINT8) 0x25) /* read capacity */ +#define SCSI_OPCODE_READ_EXT ((UINT8) 0x28) /* read extended */ +#define SCSI_OPCODE_WRITE_EXT ((UINT8) 0x2a) /* write extended */ +#define SCSI_OPCODE_SEEK_EXT ((UINT8) 0x2b) /* seek extended */ +#define SCSI_OPCODE_WRITE_AND_VERIFY ((UINT8) 0x2e) /* write and verify */ +#define SCSI_OPCODE_VERIFY ((UINT8) 0x2f) /* verify */ +#define SCSI_OPCODE_SEARCH_DATA_HIGH ((UINT8) 0x30) /* search data high */ +#define SCSI_OPCODE_SEARCH_DATA_EQUAL ((UINT8) 0x31) /* search data equal */ +#define SCSI_OPCODE_SEARCH_DATA_LOW ((UINT8) 0x32) /* search data low */ +#define SCSI_OPCODE_SET_LIMITS ((UINT8) 0x33) /* set limits */ +#define SCSI_OPCODE_SYNC_CACHE ((UINT8) 0x35) /* Synchronize Cache */ +#define SCSI_OPCODE_READ_DEFECT_DATA ((UINT8) 0x37) /* read defect data */ +#define SCSI_OPCODE_COMPARE ((UINT8) 0x39) /* compare */ +#define SCSI_OPCODE_COPY_AND_VERIFY ((UINT8) 0x3a) /* copy and verify */ +#define SCSI_OPCODE_WRITE_BUFFER ((UINT8) 0x3b) /* write buffer */ +#define SCSI_OPCODE_READ_BUFFER ((UINT8) 0x3c) /* read buffer */ + +/* SCSI general purpose sense keys are enumerated. + * NOTE: Some sense keys are optional and may not be supported by all devices. +*/ + +#define SCSI_SENSE_KEY_NO_SENSE 0x00 /* no sense sense key */ +#define SCSI_SENSE_KEY_RECOVERED_ERROR 0x01 /* recovered error sense key */ +#define SCSI_SENSE_KEY_NOT_READY 0x02 /* not ready sense key */ +#define SCSI_SENSE_KEY_MEDIUM_ERROR 0x03 /* medium error sense key */ +#define SCSI_SENSE_KEY_HARDWARE_ERROR 0x04 /* hardware error sense key */ +#define SCSI_SENSE_KEY_ILLEGAL_REQUEST 0x05 /* illegal request sense key */ +#define SCSI_SENSE_KEY_UNIT_ATTENTION 0x06 /* unit attention sense key */ +#define SCSI_SENSE_KEY_DATA_PROTECT 0x07 /* data protect sense key */ +#define SCSI_SENSE_KEY_BLANK_CHECK 0x08 /* blank check sense key */ +#define SCSI_SENSE_KEY_VENDOR_UNIQUE 0x09 /* vendor unique sense key */ +#define SCSI_SENSE_KEY_COPY_ABORTED 0x0a /* copy aborted sense key */ +#define SCSI_SENSE_KEY_ABORTED_COMMAND 0x0b /* aborted command sense key */ +#define SCSI_SENSE_KEY_EQUAL 0x0c /* key equal sense key */ +#define SCSI_SENSE_KEY_VOLUME_OVERFLOW 0x0d /* volume overflow sense key */ +#define SCSI_SENSE_KEY_MISCOMPARE 0x0e /* miscompare sense key */ +#define SCSI_SENSE_KEY_RESERVED 0x0f /* reserved sense key */ + +/* SCSI status byte codes are enumerated. + * NOTE: Some status codes are optional and may not be supported by all devices. +*/ + +#define SCSI_STATUS_MASK ((UINT8) 0x1e) /* mask vend uniq status */ +#define SCSI_STATUS_GOOD ((UINT8) 0x00) /* good status */ +#define SCSI_STATUS_CHECK_CONDITION ((UINT8) 0x02) /* check condition status */ +#define SCSI_STATUS_CONDITION_MET ((UINT8) 0x04) /* condition met/good stat */ +#define SCSI_STATUS_BUSY ((UINT8) 0x08) /* busy status */ +#define SCSI_STATUS_INTMED_GOOD ((UINT8) 0x10) /* intermediate/good stat */ +#define SCSI_STATUS_INTMED_COND_MET ((UINT8) 0x14) /* interm./cond. met stat */ +#define SCSI_STATUS_RESERV_CONFLICT ((UINT8) 0x18) /* reservation conflict */ +#define SCSI_STATUS_QUEUE_FULL ((UINT8) 0x28) /* queue full status */ + +/* SCSI message codes are enumerated. + * NOTE: Some message codes are optional and may not be supported by all + * devices. +*/ + +#define SCSI_MSG_COMMAND_COMPLETE ((UINT8) 0x00) /* command complete msg. */ +#define SCSI_MSG_EXTENDED_MESSAGE ((UINT8) 0x01) /* extended message msg. */ +#define SCSI_MSG_SAVE_DATA_POINTER ((UINT8) 0x02) /* save data pointer msg. */ +#define SCSI_MSG_RESTORE_POINTERS ((UINT8) 0x03) /* restore pointers msg. */ +#define SCSI_MSG_DISCONNECT ((UINT8) 0x04) /* disconnect msg. */ +#define SCSI_MSG_INITOR_DETECT_ERR ((UINT8) 0x05) /* initor. detect err msg. */ +#define SCSI_MSG_ABORT ((UINT8) 0x06) /* abort msg. */ +#define SCSI_MSG_MESSAGE_REJECT ((UINT8) 0x07) /* message reject msg. */ +#define SCSI_MSG_NO_OP ((UINT8) 0x08) /* no operation msg. */ +#define SCSI_MSG_MSG_PARITY_ERR ((UINT8) 0x09) /* message parity err msg. */ +#define SCSI_MSG_LINK_CMD_COMPLETE ((UINT8) 0x0a) /* linked cmd. comp. msg. */ +#define SCSI_MSG_LINK_CMD_FLAG_COMP ((UINT8) 0x0b) /* link cmd w/flag comp. */ +#define SCSI_MSG_BUS_DEVICE_RESET ((UINT8) 0x0c) /* bus device reset msg. */ +#define SCSI_MSG_IDENT_DISCONNECT ((UINT8) 0x40) /* identify disconnect bit */ +#define SCSI_MSG_IDENTIFY ((UINT8) 0x80) /* identify msg bit mask */ + +/* SCSI extended message codes */ + +#define SCSI_EXT_MSG_MODIFY_DATA_PTR ((UINT8) 0x00) /* modify data pointer */ +#define SCSI_EXT_MSG_SYNC_XFER_REQ ((UINT8) 0x01) /* sync. data xfer. req. */ +#define SCSI_EXT_MSG_WIDE_XFER_REQ ((UINT8) 0x03) /* wide data xfer req. */ + +/* SCSI extended message lengths */ + +#define SCSI_MODIFY_DATA_PTR_MSG_LENGTH 5 /* modify data pointer */ +#define SCSI_SYNC_XFER_REQ_MSG_LENGTH 3 /* sync. data xfer. req. */ +#define SCSI_WIDE_XFER_REQ_MSG_LENGTH 2 /* wide data xfer req. */ + +/* the largest SCSI ID and LUN a target drive can have */ + +#define SCSI_MIN_BUS_ID 0 /* min. bus ID under SCSI */ +#define SCSI_MAX_BUS_ID 7 /* max. bus ID under SCSI */ +#define SCSI_MIN_LUN 0 /* min. logical unit number */ +#define SCSI_MAX_LUN 7 /* max. logical unit number */ + +/* scsiLib errno's */ + +#define S_scsiLib_DEV_NOT_READY (M_scsiLib | 1) +#define S_scsiLib_WRITE_PROTECTED (M_scsiLib | 2) +#define S_scsiLib_MEDIUM_ERROR (M_scsiLib | 3) +#define S_scsiLib_HARDWARE_ERROR (M_scsiLib | 4) +#define S_scsiLib_ILLEGAL_REQUEST (M_scsiLib | 5) +#define S_scsiLib_BLANK_CHECK (M_scsiLib | 6) +#define S_scsiLib_ABORTED_COMMAND (M_scsiLib | 7) +#define S_scsiLib_VOLUME_OVERFLOW (M_scsiLib | 8) +#define S_scsiLib_UNIT_ATTENTION (M_scsiLib | 9) +#define S_scsiLib_SELECT_TIMEOUT (M_scsiLib | 10) +#define S_scsiLib_LUN_NOT_PRESENT (M_scsiLib | 11) +#define S_scsiLib_ILLEGAL_BUS_ID (M_scsiLib | 12) +#define S_scsiLib_NO_CONTROLLER (M_scsiLib | 13) +#define S_scsiLib_REQ_SENSE_ERROR (M_scsiLib | 14) +#define S_scsiLib_DEV_UNSUPPORTED (M_scsiLib | 15) +#define S_scsiLib_ILLEGAL_PARAMETER (M_scsiLib | 16) +#define S_scsiLib_EARLY_PHASE_CHANGE (M_scsiLib | 17) +#define S_scsiLib_PHASE_CHANGE_TIMEOUT (M_scsiLib | 18) +#define S_scsiLib_ILLEGAL_OPERATION (M_scsiLib | 19) +#define S_scsiLib_DEVICE_EXIST (M_scsiLib | 20) +#define S_scsiLib_SYNC_UNSUPPORTED (M_scsiLib | 21) +#define S_scsiLib_SYNC_VAL_UNSUPPORTED (M_scsiLib | 22) +#define S_scsiLib_DATA_TRANSFER_TIMEOUT (M_scsiLib | 23) +#define S_scsiLib_UNKNOWN_PHASE (M_scsiLib | 24) + + + /* default select timeout (usec) */ +#define SCSI_DEF_SELECT_TIMEOUT ((UINT) 250000) + + /* default auto-config timeout (usec) */ +#define SCSI_DEF_CONFIG_TIMEOUT ((UINT) 1000) + +#define SCSI_TIMEOUT_5SEC ((UINT) 5000000) +#define SCSI_TIMEOUT_1SEC ((UINT) 1000000) +#define SCSI_TIMEOUT_FULL ((UINT) 0x7fffffff) + + /* default bus ID for a vxWorks SCSI port */ + +#define SCSI_DEF_CTRL_BUS_ID 7 + +/* values in status register for SCSI bus phases */ + +#define SCSI_DATA_OUT_PHASE 0x0 +#define SCSI_DATA_IN_PHASE 0x1 +#define SCSI_COMMAND_PHASE 0x2 +#define SCSI_STATUS_PHASE 0x3 +#define SCSI_MSG_OUT_PHASE 0x6 +#define SCSI_MSG_IN_PHASE 0x7 +#define SCSI_BUS_FREE_PHASE 0x8 + +/* device status enumeration */ + +typedef enum scsiPhysDevStatus + { + IDLE, + SELECT_REQUESTED, + SELECT_IN_PROGRESS, + SELECT_SUCCESSFUL, + SELECT_TIMEOUT, + SELECT_LOST_ARBIT, + DISCONNECTED, + RECONNECTED + } SCSI_DEV_STATUS; + +/* device type enumeration */ + +#define SCSI_DEV_DIR_ACCESS ((UINT8) 0x00) /* direct-access dev (disk) */ +#define SCSI_DEV_SEQ_ACCESS ((UINT8) 0x01) /* sequent'l-access dev (tape) */ +#define SCSI_DEV_PRINTER ((UINT8) 0x02) /* printer dev */ +#define SCSI_DEV_PROCESSOR ((UINT8) 0x03) /* processor dev */ +#define SCSI_DEV_WORM ((UINT8) 0x04) /* write-once read-mult dev */ +#define SCSI_DEV_RO_DIR_ACCESS ((UINT8) 0x05) /* read-only direct-access dev */ +#define SCSI_LUN_NOT_PRESENT ((UINT8) 0x7f) /* logical unit not present */ + +#define MAX_SCSI_PHYS_DEVS 64 +#define MAX_MSG_IN_BYTES 8 +#define MAX_MSG_OUT_BYTES 8 + +#define VENDOR_ID_LENGTH 8 +#define PRODUCT_ID_LENGTH 16 +#define REV_LEVEL_LENGTH 4 + +typedef struct scsiBlkDevList + { + SEMAPHORE listMutexSem; + LIST blkDevNodes; + } SCSI_BLK_DEV_LIST; + +/* structure to pass to ioctl call to execute an SCSI command*/ + +typedef struct /* SCSI_TRANSACTION - information about a SCSI transaction */ + { + UINT8 *cmdAddress; /* address of SCSI command bytes */ + int cmdLength; /* length of command in bytes */ + UINT8 *dataAddress; /* address of data buffer */ + int dataDirection; /* direction of data transfer */ + int dataLength; /* length of data buffer in bytes (0=no data) */ int addLengthByte; /* if != -1 , byte # of additional length */ + UINT8 statusByte; /* status byte returned from target */ + int cmdTimeout; /* number of usec for this command timeout */ + } SCSI_TRANSACTION; + +/* NOTE: Not all of the fields in the following structure + * are currently supported or used. + */ + +typedef struct /* SCSI_PHYS_DEV - SCSI physical device info */ + { + SEMAPHORE devMutexSem; /* semaphore for exclusive access */ + SEMAPHORE devSyncSem; /* semaphore for waiting on I/O interrupt */ + int scsiDevBusId; /* device's address on SCSI bus */ + int scsiDevLUN; /* device's logical unit number */ + UINT selTimeOut; /* device select time-out (units var.) */ + UINT8 scsiDevType; /* SCSI device type */ + TBOOL disconnect; /* whether device supports disconnect */ + TBOOL expectDisconnect; /* TRUE if a disconnect is expected */ + TBOOL xmitsParity; /* TRUE if dev. xmits parity */ + TBOOL useIdentify; /* whether to use identify message at select */ + TBOOL syncXfer; /* TRUE for synchronous data transfer */ + int syncXferOffset; /* synchronous xfer maximum offset */ + int syncXferPeriod; /* synchronous xfer mimimum period */ + UINT8 *savedTransAddress; /* saved data pointer address */ + int savedTransLength; /* saved data pointer length */ + BOOL resetFlag; /* set TRUE when dev reset sensed */ + FUNCPTR postResetRtn; /* routine to call when dev has been reset */ + + char devVendorID [VENDOR_ID_LENGTH + 1]; /* vendor ID in ASCII */ + char devProductID [PRODUCT_ID_LENGTH + 1]; /* product ID in ASCII */ + char devRevLevel [REV_LEVEL_LENGTH + 1]; /* revision level in ASCII */ + + BOOL removable; /* whether medium is removable */ + UINT8 lastSenseKey; /* last sense key returned by dev */ + UINT8 lastAddSenseCode; /* last additional sense code returned by dev */ + int controlByte; /* vendor unique control byte for commands */ + int numBlocks; /* number of blocks on the physical device */ + int blockSize; /* size of an SCSI disk sector */ + struct scsiCtrl *pScsiCtrl; /* ptr to dev's SCSI controller info */ + SCSI_DEV_STATUS devStatus; /* status of most recent device operation */ + /* list of outgoing messages */ + UINT8 msgOutArray [MAX_MSG_OUT_BYTES + 1];/* msg[0] reserved for identify */ + int msgLength; /* number of bytes in outgoing message */ + BOOL extendedSense; /* whether device returns extended sense */ + UINT8 *pReqSenseData; /* ptr to last REQ SENSE data returned by dev */ + int reqSenseDataLength; /* size of REQ SENSE data array */ + /* ptr to first block dev created on device */ + struct scsiBlkDevList blkDevList; + struct scsiBlkDev *pScsiBlkDev; + int useMsgout; /* whether to send a message out at select */ + int syncReserved1; /* Reserved for hardware sync register value */ + int syncReserved2; /* Reserved for hardware sync register value */ + SCSI_TRANSACTION *pScsiXaction; /* current scsi action requested */ + } SCSI_PHYS_DEV; + + +/* Step scsi period ( look at the scsi ANSI ) */ + +#define SCSI_SYNC_STEP_PERIOD 4 /* scsi step period in sync msg */ + +/* Used to negotiate a scsi sync agreement for the synchronous transfert + * to return parameters computed both by the driver and target + */ +typedef struct + { + int syncPeriodCtrl; /* Closest period available with the controller */ + int syncOffsetCtrl; /* Closest offset available with the controller */ + int syncPeriodTarget; /* Period value returned by the target */ + int syncOffsetTarget; /* Offset value returned by the target */ + } SCSI_SYNC_AGREEMENT; + +typedef SCSI_PHYS_DEV *SCSI_PHYS_DEV_ID; + +typedef struct scsiBlkDev /* SCSI_BLK_DEV - + SCSI logical block device info */ + { + BLK_DEV blkDev; /* generic logical block device info */ + SCSI_PHYS_DEV *pScsiPhysDev;/* ptr to SCSI physical device info */ + int numBlocks; /* number of blocks on the logical device */ + int blockOffset; /* address of first block on logical device */ + } SCSI_BLK_DEV; + +typedef SCSI_BLK_DEV *SCSI_BLK_DEV_ID; + +typedef struct scsiBlkDevNode + { + NODE blkDevNode; + SCSI_BLK_DEV scsiBlkDev; + } SCSI_BLK_DEV_NODE; + +typedef struct scsiCtrl /* SCSI_CTRL - generic SCSI controller info */ + { + SEMAPHORE ctrlMutexSem; /* semaphore for exclusive access */ + SEMAPHORE ctrlSyncSem; /* semaphore for waiting on I/O interrupt */ + VOIDFUNCPTR scsiBusReset; /* function for resetting the SCSI bus */ + FUNCPTR scsiTransact; /* function for managing a SCSI transaction */ + FUNCPTR scsiDevSelect; /* function for selecting a SCSI device */ + FUNCPTR scsiBytesIn; /* function for SCSI input */ + FUNCPTR scsiBytesOut; /* function for SCSI output */ + FUNCPTR scsiDmaBytesIn; /* function for SCSI DMA input */ + FUNCPTR scsiDmaBytesOut; /* function for SCSI DMA output */ + FUNCPTR scsiBusPhaseGet; /* function returning the current bus phase */ + FUNCPTR scsiMsgInAck; /* function for accepting an incoming message */ + VOIDFUNCPTR scsiSelTimeOutCvt; /* func. for converting a select time-out */ + UINT maxBytesPerXfer; /* upper bound of ctrl. tansfer counter */ + UINT clkPeriod; /* period of the controller clock (nsec) */ + int scsiCtrlBusId; /* SCSI bus ID of this SCSI controller */ + int scsiPriority; /* priority of task when doing SCSI I/O */ + int scsiBusPhase; /* current phase of SCSI */ + TBOOL disconnect; /* globally enable / disable disconnect */ + /* info on devs. attached to this controller */ + SCSI_PHYS_DEV *physDevArr [MAX_SCSI_PHYS_DEVS]; + FUNCPTR scsiSyncMsgConvert; /* function for converting extended sync + * message in hardware register value */ + VOIDFUNCPTR scsiSetAtn; /* function to set atn */ + } SCSI_CTRL; + +/* definitions relating to SCSI commands */ + +#define MAX_SCSI_CMD_LENGTH 12 /* maximum length in bytes of a SCSI command */ + +typedef UINT8 SCSI_COMMAND [MAX_SCSI_CMD_LENGTH]; + +#define SCSI_GROUP_0_CMD_LENGTH 6 +#define SCSI_GROUP_1_CMD_LENGTH 10 +#define SCSI_GROUP_5_CMD_LENGTH 12 + +/* some useful defines and structures for CCS commands */ + +#define SCSI_FORMAT_DATA_BIT ((UINT8) 0x10) +#define SCSI_COMPLETE_LIST_BIT ((UINT8) 0x08) + +#define DEFAULT_INQUIRY_DATA_LENGTH 36 +#define REQ_SENSE_ADD_LENGTH_BYTE 7 +#define INQUIRY_ADD_LENGTH_BYTE 4 +#define MODE_SENSE_ADD_LENGTH_BYTE 0 +#define INQUIRY_REMOVABLE_MED_BIT ((UINT8) 0x80) + +typedef struct /* RD_CAP_DATA - results from O_RDONLY CAPACITY */ + { + int lastLogBlkAdrs; /* address of last logical block on device */ + int blkLength; /* block length of last logical block */ + } RD_CAP_DATA; + +#define NON_EXT_SENSE_DATA_LENGTH 4 + +#define SCSI_SENSE_DATA_CLASS 0x70 +#define SCSI_SENSE_DATA_CODE 0x0f + +#define SCSI_SENSE_KEY_MASK 0x0f + +#define SCSI_EXT_SENSE_CLASS 0x70 +#define SCSI_EXT_SENSE_CODE 0x00 + +/* Min/Max sync value in 4ns step */ + +#define MAX_SCSI_SYNC_PERIOD 0xfa /* ~1Mbytes/s value */ +#define MIN_SCSI_SYNC_PERIOD 0x19 /* ~10Mbytes/s value */ +#define DEFAULT_SCSI_OFFSET 0x4 /* scsi default offset */ + +/* Type of msgout to send */ +#define SCSI_NO_MSGOUT 0x00000000 /* No msgout capability */ +#define SCSI_SYNC_MSGOUT 0x00000001 /* Build and send sync message */ +#define SCSI_WIDE_MSGOUT 0x00000002 /* Build and send wide message */ +#define SCSI_DEV_RST_MSGOUT 0x00000004 /* Build and send wide message */ +#define SCSI_OTHER_MSGOUT 0x00000008 /* Send user message */ + +/* external variable declarations */ + +IMPORT BOOL scsiDebug; /* enable task level debug messages */ +IMPORT BOOL scsiIntsDebug; /* enable int level debug messages */ +IMPORT SCSI_CTRL * pSysScsiCtrl; +IMPORT SCSI_FUNC_TBL * pScsiIfTbl; /* scsiLib interface function table */ +IMPORT UINT32 scsiSelectTimeout; +IMPORT int blkDevListMutexOptions; +IMPORT int scsiCtrlMutexOptions; +IMPORT int scsiCtrlSemOptions; +IMPORT int scsiPhysDevMutexOptions; +IMPORT int scsiPhysDevSemOptions; + + + +/* macros */ + +#define SCSI_MSG \ + logMsg + +#define SCSI_DEBUG_MSG \ + if (scsiDebug) \ + SCSI_MSG + +#define SCSI_INT_DEBUG_MSG \ + if (scsiIntsDebug) \ + logMsg + +/* macros to get msgout pointer Identify and msg array */ + +#define SCSI_GET_PTR_IDENTIFY(pScsiPhysDev) (&pScsiPhysDev->msgOutArray[0]) +#define SCSI_GET_PTR_MSGOUT(pScsiPhysDev) (&pScsiPhysDev->msgOutArray[1]) + +/******************************************************************************* +* +* SCSI_SWAB - swap bytes on little-endian machines +* +* All fields which are defined as integers (short or long) by the SCSI spec +* and which are passed during the data phase should be pre- or post-processed +* by this macro. The macro does nothing on big-endian machines, but swaps +* bytes for little-endian machines. All SCSI quantities are big-endian. +* +* NOMANUAL +*/ + +#if (_BYTE_ORDER == _BIG_ENDIAN) +#define SCSI_SWAB(pBuffer, bufLength) +#else +#define SCSI_SWAB(pBuffer, bufLength) \ + do \ + { \ + char temp; \ + char *pHead = (char *) pBuffer; \ + char *pTail = (char *) pBuffer + bufLength - 1; \ + \ + while (pHead < pTail) \ + { \ + temp = *pTail; \ + *pTail-- = *pHead; \ + *pHead++ = temp; \ + } \ + } while (FALSE) +#endif + + +/* function declarations */ + +extern void scsi1IfInit (); + +#if defined(__STDC__) || defined(__cplusplus) + +extern BLK_DEV * scsiBlkDevCreate (SCSI_PHYS_DEV *, int, int); +extern SCSI_PHYS_DEV * scsiPhysDevCreate (SCSI_CTRL *, int, int, int, int, + BOOL, int, int); +extern SCSI_PHYS_DEV * scsiPhysDevIdGet (SCSI_CTRL *, int, int); +extern STATUS scsiAutoConfig (SCSI_CTRL *); +extern STATUS scsiBusReset (SCSI_CTRL *); +extern STATUS scsiCmdBuild (SCSI_COMMAND, int *, UINT8, int, BOOL, + int, int , UINT8); +extern STATUS scsiCtrlInit (SCSI_CTRL *); +extern STATUS scsiFormatUnit (SCSI_PHYS_DEV *, BOOL, int, int, int, + char *, int); +extern STATUS scsiInquiry (SCSI_PHYS_DEV *, char *, int); +extern STATUS scsiIoctl (SCSI_PHYS_DEV *, int, int); +extern STATUS scsiModeSelect (SCSI_PHYS_DEV *, int, int, char *, int); +extern STATUS scsiModeSense (SCSI_PHYS_DEV *, int, int, char *, int); +extern STATUS scsiPhysDevDelete (SCSI_PHYS_DEV *); +extern STATUS scsiRdSecs (SCSI_BLK_DEV *, int, int, char *); +extern STATUS scsiReadCapacity (SCSI_PHYS_DEV *, int *, int *); +extern STATUS scsiReqSense (SCSI_PHYS_DEV *, char *, int); +extern STATUS scsiShow (SCSI_CTRL *); +extern STATUS scsiTestUnitRdy (SCSI_PHYS_DEV *); +extern STATUS scsiTransact (SCSI_PHYS_DEV *, SCSI_TRANSACTION *); +extern STATUS scsiWrtSecs (SCSI_BLK_DEV *, int, int, char *); +extern char * scsiPhaseNameGet (int); +extern void scsiBlkDevInit (SCSI_BLK_DEV *, int, int); +extern void scsiBlkDevShow (SCSI_PHYS_DEV *); +extern STATUS scsiBuildByteMsgOut (UINT8 *,UINT8); +extern STATUS scsiBuildExtMsgOut (UINT8 *,UINT8); + +#else /* __STDC__ */ + +extern BLK_DEV * scsiBlkDevCreate (); +extern SCSI_PHYS_DEV * scsiPhysDevCreate (); +extern SCSI_PHYS_DEV * scsiPhysDevIdGet (); +extern STATUS scsiAutoConfig (); +extern STATUS scsiBusReset (); +extern STATUS scsiCmdBuild (); +extern STATUS scsiCtrlInit (); +extern STATUS scsiFormatUnit (); +extern STATUS scsiInquiry (); +extern STATUS scsiIoctl (); +extern STATUS scsiModeSelect (); +extern STATUS scsiModeSense (); +extern STATUS scsiPhysDevDelete (); +extern STATUS scsiRdSecs (); +extern STATUS scsiReadCapacity (); +extern STATUS scsiReqSense (); +extern STATUS scsiShow (); +extern STATUS scsiTestUnitRdy (); +extern STATUS scsiTransact (); +extern STATUS scsiWrtSecs (); +extern char * scsiPhaseNameGet (); +extern void scsiBlkDevInit (); +extern void scsiBlkDevShow (); +extern STATUS scsiBuildByteMsgOut (); +extern STATUS scsiBuildExtMsgOut (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ASMLANGUAGE */ +#endif /* __INCscsi1Libh */ diff --git a/h/scsi2Lib.h b/h/scsi2Lib.h new file mode 100644 index 0000000..f89380c --- /dev/null +++ b/h/scsi2Lib.h @@ -0,0 +1,1282 @@ +/* scsi2Lib.h - SCSI library header file */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +04p,18feb04,rfr Added SCSI_OPCODE_SYNC_CACHE +04o,18oct01,pmr setting SCSI_SYNC_XFER_MIN_PERIOD to 1 so that highest speed + is negotiated (SPR 71337). +04n,08oct01,rcs added SCSI_ADD_SENSE_NO_MEDIUM SPR# 32203 +04m,10jul97,dds added new fields to SCSI_CTRL structure. +04l,28mar97,dds SPR 8220: added new event type SCSI_EVENT_PARITY_ERR. +04k,06mar97,dds SPR 8120: changed declaration for scsiRdTape. +04j,13sep96,dds added declarations required by scsiMgrLib.c and scsiCtrlLib.c +04i,29jul96,jds added hardware cache snooping support +04h,15apr96,jds added WIDE data transfer support +04g,20jul95,jds added scsiSeqStatusCheck as a global function +04f,24jul95,jds added some additional sense key macros; added pointer to + SEQ_DEV in SCSI_PHYS_DEV +04e,28apr95,jds integrated into WRS tree; added backward compatability +04d,24mar95,ihw added "identMsg" field in SCSI_EVENT structure +04c,07oct94,ihw added errno's for reaching max threads, bad sense data +04b,27may94,ihw documented prior to release +04a,30mar94,ihw modified for enhanced SCSI library: tagged command queueing + removed redundant "pAddLengthByte" field from SCSI_PHYS_DEV + added definitions for proper handling of max length ext msgs +03a,12jan94,ihw modified for enhanced SCSI library: multiple initiators, + disconnect/reconnect and synchronous transfer supported +02j,11jan93,ccc added #ifndef _ASMLANGUAGE. +02i,30sep92,ccc added two new errno's. +02h,24sep92,ccc removed timeout parameter to scsiAutoConfig(). +02g,22sep92,rrr added support for c++ +02f,27aug92,ccc added timeout to SCSI_TRANSACTION structure. +02e,26jul92,rrr Removed decl of scsiSyncTarget, it was made LOCAL. +02d,20jul92,eve Remove conditional compilation. +02c,14jul92,eve added a pScsiXaction info in SCSI_PHYS_DEV structure to + maintain the data direction information to support + cache coherency in drivers. +02b,06jul92,eve added declaration for extended sync functionalities. +02a,04jul92,jcf cleaned up. +01l,26may92,rrr the tree shuffle +01k,07apr92,yao changed BYTE_ORDER to _BYTE_ORDER, BIG_ENDIAN to _BIG_ENDIAN. +01j,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed READ, WRITE and UPDATE to O_RDONLY O_WRONLY O_RDWR + -changed VOID to void + -changed copyright notice +01i,07mar91,jcc added SCSI_BLK_DEV_LIST and SCSI_BLK_DEV_NODE definitions; + added SCSI_SWAB macro. added a few error codes. +01h,05oct90,shl added ANSI function prototypes. + added copyright notice. +01g,02oct90,jcc changed SEM_ID's to SEMAPHORE's in SCSI_PHYS_DEV and SCSI_CTRL + structures; modified structures to return variable length + REQUEST SENSE data; miscellaneous. +01f,20aug90,jcc added conditional defines and typedefs for 4.0.2 compatibility. +01e,10aug90,dnw changed scsiBusReset and scsiSelTimeOutCvt to VOIDFUNCPTR. +01d,07aug90,shl moved function declarations to end of file. +01c,12jul90,jcc misc. enhancements and changes. +01b,08jun90,jcc added scsiMsgInAck to SCSI_CTRL, which routine is invoked + to accept incoming messages. +01a,17apr89,jcc written. +*/ + +#ifndef __INCscsi2Libh +#define __INCscsi2Libh + +#ifndef _ASMLANGUAGE + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "blkIo.h" +#include "seqIo.h" +#include "semLib.h" +#include "lstLib.h" +#include "msgQLib.h" +#include "rngLib.h" +#include "taskLib.h" +#include "wdLib.h" + + +/* SCSI direct-access device and general purpose command opcodes are enumerated. + * NOTE: Some commands are optional and may not be supported by all devices. + */ + +#define SCSI_OPCODE_TEST_UNIT_READY ((UINT8) 0x00) /* test unit ready */ +#define SCSI_OPCODE_REZERO_UNIT ((UINT8) 0x01) /* rezero unit */ +#define SCSI_OPCODE_REWIND ((UINT8) 0x01) /* rewind */ +#define SCSI_OPCODE_REQUEST_SENSE ((UINT8) 0x03) /* request sense */ +#define SCSI_OPCODE_FORMAT_UNIT ((UINT8) 0x04) /* format unit */ +#define SCSI_OPCODE_READ_BLOCK_LIMITS ((UINT8) 0x05) /* read block limits */ +#define SCSI_OPCODE_REASSIGN_BLOCKS ((UINT8) 0x07) /* reassign blocks */ +#define SCSI_OPCODE_READ ((UINT8) 0x08) /* read */ +#define SCSI_OPCODE_RECEIVE ((UINT8) 0x08) /* receive */ +#define SCSI_OPCODE_WRITE ((UINT8) 0x0a) /* write */ +#define SCSI_OPCODE_PRINT ((UINT8) 0x0a) /* print */ +#define SCSI_OPCODE_SEND ((UINT8) 0x0a) /* send */ +#define SCSI_OPCODE_SEEK ((UINT8) 0x0b) /* seek */ +#define SCSI_OPCODE_TRACK_SELECT ((UINT8) 0x0b) /* track select */ +#define SCSI_OPCODE_SLEW_AND_PRINT ((UINT8) 0x0b) /* slew and print */ +#define SCSI_OPCODE_READ_REVERSE ((UINT8) 0x0f) /* read reverse */ +#define SCSI_OPCODE_WRITE_FILEMARKS ((UINT8) 0x10) /* write filemarks */ +#define SCSI_OPCODE_FLUSH_BUFFER ((UINT8) 0x10) /* flush buffer */ +#define SCSI_OPCODE_SPACE ((UINT8) 0x11) /* space */ +#define SCSI_OPCODE_INQUIRY ((UINT8) 0x12) /* inquiry */ +#define SCSI_OPCODE_VERIFY_SEQ ((UINT8) 0x13) /* seq. access verify */ +#define SCSI_OPCODE_RECOVER_BUF_DATA ((UINT8) 0x14) /* rec. buffered data */ +#define SCSI_OPCODE_MODE_SELECT ((UINT8) 0x15) /* mode select */ +#define SCSI_OPCODE_RESERVE ((UINT8) 0x16) /* reserve */ +#define SCSI_OPCODE_RELEASE ((UINT8) 0x17) /* release */ +#define SCSI_OPCODE_COPY ((UINT8) 0x18) /* copy */ +#define SCSI_OPCODE_ERASE ((UINT8) 0x19) /* erase */ +#define SCSI_OPCODE_MODE_SENSE ((UINT8) 0x1a) /* mode sense */ +#define SCSI_OPCODE_START_STOP_UNIT ((UINT8) 0x1b) /* start/stop unit */ +#define SCSI_OPCODE_LOAD_UNLOAD ((UINT8) 0x1b) /* load/unload */ +#define SCSI_OPCODE_STOP_PRINT ((UINT8) 0x1b) /* stop print */ +#define SCSI_OPCODE_RECV_DIAG_RESULTS ((UINT8) 0x1c) /* recv diag results */ +#define SCSI_OPCODE_SEND_DIAGNOSTIC ((UINT8) 0x1d) /* send diagnostic */ +#define SCSI_OPCODE_CTRL_MEDIUM_REMOVAL ((UINT8) 0x1e) /* ctrl med. removal */ +#define SCSI_OPCODE_READ_CAPACITY ((UINT8) 0x25) /* read capacity */ +#define SCSI_OPCODE_READ_EXT ((UINT8) 0x28) /* read extended */ +#define SCSI_OPCODE_WRITE_EXT ((UINT8) 0x2a) /* write extended */ +#define SCSI_OPCODE_SEEK_EXT ((UINT8) 0x2b) /* seek extended */ +#define SCSI_OPCODE_WRITE_AND_VERIFY ((UINT8) 0x2e) /* write and verify */ +#define SCSI_OPCODE_VERIFY ((UINT8) 0x2f) /* verify */ +#define SCSI_OPCODE_SEARCH_DATA_HIGH ((UINT8) 0x30) /* search data high */ +#define SCSI_OPCODE_SEARCH_DATA_EQUAL ((UINT8) 0x31) /* search data equal */ +#define SCSI_OPCODE_SEARCH_DATA_LOW ((UINT8) 0x32) /* search data low */ +#define SCSI_OPCODE_SET_LIMITS ((UINT8) 0x33) /* set limits */ +#define SCSI_OPCODE_SYNC_CACHE ((UINT8) 0x35) /* Synchronize Cache */ +#define SCSI_OPCODE_READ_DEFECT_DATA ((UINT8) 0x37) /* read defect data */ +#define SCSI_OPCODE_COMPARE ((UINT8) 0x39) /* compare */ +#define SCSI_OPCODE_COPY_AND_VERIFY ((UINT8) 0x3a) /* copy and verify */ +#define SCSI_OPCODE_WRITE_BUFFER ((UINT8) 0x3b) /* write buffer */ +#define SCSI_OPCODE_READ_BUFFER ((UINT8) 0x3c) /* read buffer */ + +/* SCSI general purpose sense keys are enumerated. + * NOTE: Some sense keys are optional and may not be supported by all devices. +*/ + +#define SCSI_SENSE_KEY_NO_SENSE 0x00 /* no sense sense key */ +#define SCSI_SENSE_KEY_RECOVERED_ERROR 0x01 /* recovered error sense key */ +#define SCSI_SENSE_KEY_NOT_READY 0x02 /* not ready sense key */ +#define SCSI_SENSE_KEY_MEDIUM_ERROR 0x03 /* medium error sense key */ +#define SCSI_SENSE_KEY_HARDWARE_ERROR 0x04 /* hardware error sense key */ +#define SCSI_SENSE_KEY_ILLEGAL_REQUEST 0x05 /* illegal request sense key */ +#define SCSI_SENSE_KEY_UNIT_ATTENTION 0x06 /* unit attention sense key */ +#define SCSI_SENSE_KEY_DATA_PROTECT 0x07 /* data protect sense key */ +#define SCSI_SENSE_KEY_BLANK_CHECK 0x08 /* blank check sense key */ +#define SCSI_SENSE_KEY_VENDOR_UNIQUE 0x09 /* vendor unique sense key */ +#define SCSI_SENSE_KEY_COPY_ABORTED 0x0a /* copy aborted sense key */ +#define SCSI_SENSE_KEY_ABORTED_COMMAND 0x0b /* aborted command sense key */ +#define SCSI_SENSE_KEY_EQUAL 0x0c /* key equal sense key */ +#define SCSI_SENSE_KEY_VOLUME_OVERFLOW 0x0d /* volume overflow sense key */ +#define SCSI_SENSE_KEY_MISCOMPARE 0x0e /* miscompare sense key */ +#define SCSI_SENSE_KEY_RESERVED 0x0f /* reserved sense key */ + +/* SCSI additional sense keys */ + +#define SCSI_ADD_SENSE_MEDIUM_CHANGED 0x28 /* medium may have changed */ +#define SCSI_ADD_SENSE_DEVICE_RESET 0x29 /* hardware or bus device reset */ +#define SCSI_ADD_SENSE_WRITE_PROTECTED 0x27 /* write protected medium */ +#define SCSI_ADD_SENSE_NO_MEDIUM 0x3a /* medium not present */ + + +/* SCSI MODE header parameters */ + +#define SCSI_MODE_DEV_SPECIFIC_PARAM 0x2 /* device specific parameter */ +#define SCSI_DEV_SPECIFIC_WP_MASK 0x80 /* Write protect bit */ + +/* SCSI status byte codes are enumerated. + * NOTE: Some status codes are optional and may not be supported by all devices. +*/ + +#define SCSI_STATUS_MASK ((UINT8) 0x3e) /* mask vend uniq status */ +#define SCSI_STATUS_GOOD ((UINT8) 0x00) /* good status */ +#define SCSI_STATUS_CHECK_CONDITION ((UINT8) 0x02) /* check condition status */ +#define SCSI_STATUS_CONDITION_MET ((UINT8) 0x04) /* condition met/good stat */ +#define SCSI_STATUS_BUSY ((UINT8) 0x08) /* busy status */ +#define SCSI_STATUS_INTMED_GOOD ((UINT8) 0x10) /* intermediate/good stat */ +#define SCSI_STATUS_INTMED_COND_MET ((UINT8) 0x14) /* interm./cond. met stat */ +#define SCSI_STATUS_RESERV_CONFLICT ((UINT8) 0x18) /* reservation conflict */ +#define SCSI_STATUS_CMD_TERMINATED ((UINT8) 0x22) /* command terminated */ +#define SCSI_STATUS_QUEUE_FULL ((UINT8) 0x28) /* queue full status */ + +/* SCSI message codes are enumerated. + * NOTE: Some message codes are optional and may not be supported by all + * devices. +*/ + +#define SCSI_MSG_COMMAND_COMPLETE ((UINT8) 0x00) /* command complete msg. */ +#define SCSI_MSG_EXTENDED_MESSAGE ((UINT8) 0x01) /* extended message msg. */ +#define SCSI_MSG_SAVE_DATA_POINTER ((UINT8) 0x02) /* save data pointer msg. */ +#define SCSI_MSG_RESTORE_POINTERS ((UINT8) 0x03) /* restore pointers msg. */ +#define SCSI_MSG_DISCONNECT ((UINT8) 0x04) /* disconnect msg. */ +#define SCSI_MSG_INITOR_DETECT_ERR ((UINT8) 0x05) /* initor. detect err msg. */ +#define SCSI_MSG_ABORT ((UINT8) 0x06) /* abort msg. */ +#define SCSI_MSG_MESSAGE_REJECT ((UINT8) 0x07) /* message reject msg. */ +#define SCSI_MSG_NO_OP ((UINT8) 0x08) /* no operation msg. */ +#define SCSI_MSG_MSG_PARITY_ERR ((UINT8) 0x09) /* message parity err msg. */ +#define SCSI_MSG_LINK_CMD_COMPLETE ((UINT8) 0x0a) /* linked cmd. comp. msg. */ +#define SCSI_MSG_LINK_CMD_FLAG_COMP ((UINT8) 0x0b) /* link cmd w/flag comp. */ +#define SCSI_MSG_BUS_DEVICE_RESET ((UINT8) 0x0c) /* bus device reset msg. */ +#define SCSI_MSG_ABORT_TAG ((UINT8) 0x0d) /* abort tag msg. */ +#define SCSI_MSG_CLEAR_QUEUE ((UINT8) 0x0e) /* clear queue msg. */ +#define SCSI_MSG_INITIATE_RECOVERY ((UINT8) 0x0f) /* initiate recovery msg. */ +#define SCSI_MSG_RELEASE_RECOVERY ((UINT8) 0x10) /* release recovery msg. */ +#define SCSI_MSG_TERMINATE_PROCESS ((UINT8) 0x11) /* terminate i/o process */ + +#define SCSI_MSG_IDENTIFY ((UINT8) 0x80) /* identify msg bit mask */ +#define SCSI_MSG_IDENT_DISCONNECT ((UINT8) 0x40) /* identify disconnect bit */ +#define SCSI_MSG_IDENT_LUN_MASK ((UINT8) 0x07) /* identify bit mask for LUN */ + +/* SCSI two-byte message codes */ + +#define SCSI_MSG_SIMPLE_Q_TAG ((UINT8) 0x20) /* simple queue tag */ +#define SCSI_MSG_HEAD_OF_Q_TAG ((UINT8) 0x21) /* head of queue tag */ +#define SCSI_MSG_ORDERED_Q_TAG ((UINT8) 0x22) /* ordered queue tag */ +#define SCSI_MSG_IGNORE_WIDE_RESIDUE ((UINT8)0x23) /* ignore wide residue */ + +#define SCSI_IS_TWO_BYTE_MSG(m) ((0x20 <= (m)) && ((m) < 0x30)) + +/* SCSI extended message codes */ + +#define SCSI_EXT_MSG_MODIFY_DATA_PTR ((UINT8) 0x00) /* modify data pointer */ +#define SCSI_EXT_MSG_SYNC_XFER_REQ ((UINT8) 0x01) /* sync. data xfer. req. */ +#define SCSI_EXT_MSG_EXT_IDENTIFY ((UINT8) 0x02) /* extended identify */ +#define SCSI_EXT_MSG_WIDE_XFER_REQ ((UINT8) 0x03) /* wide data xfer req. */ + +/* SCSI extended message lengths */ + +#define SCSI_EXT_MSG_HDR_LENGTH 2 /* generic part of ext msg */ + +#define SCSI_MODIFY_DATA_PTR_MSG_LENGTH 5 /* modify data pointer */ +#define SCSI_SYNC_XFER_REQ_MSG_LENGTH 3 /* sync. data xfer. req. */ +#define SCSI_WIDE_XFER_REQ_MSG_LENGTH 2 /* wide data xfer req. */ + +#define SCSI_EXT_MSG_MAX_LENGTH 256 /* max. possible length */ + +/* byte offsets within SCSI extended messages */ + +#define SCSI_EXT_MSG_LENGTH_BYTE 1 /* # bytes to follow */ +#define SCSI_EXT_MSG_TYPE_BYTE 2 /* defines type of ext. msg. */ + +#define SCSI_MODIFY_DATA_PTR_UU 3 /* argument (MSB) */ +#define SCSI_MODIFY_DATA_PTR_UM 4 +#define SCSI_MODIFY_DATA_PTR_LM 5 +#define SCSI_MODIFY_DATA_PTR_LL 6 /* argument (LSB) */ + +#define SCSI_SYNC_XFER_MSG_PERIOD 3 /* min xfer period (x 4 ns) */ +#define SCSI_SYNC_XFER_MSG_OFFSET 4 /* max req/ack offset */ + +#define SCSI_WIDE_XFER_MSG_WIDTH 3 /* wide data transfer width */ + +#define SCSI_EXT_IDENTIFY_SUB_LUN 3 /* sub-logical unit number */ + +/* the largest SCSI ID and LUN a target drive can have */ + +#define SCSI_MIN_BUS_ID 0 /* min. bus ID under SCSI */ +#define SCSI_MAX_BUS_ID 7 /* max. bus ID under SCSI */ +#define SCSI_MIN_LUN 0 /* min. logical unit number */ +#define SCSI_MAX_LUN 7 /* max. logical unit number */ + +#define SCSI_MAX_TARGETS 8 +#define SCSI_MAX_LUNS_PER_TARGET 8 +#define SCSI_MAX_PHYS_DEVS (SCSI_MAX_TARGETS * \ + SCSI_MAX_LUNS_PER_TARGET) + +/* byte offsets and bitmasks within the data returned by an INQUIRY command */ + +#define SCSI_INQUIRY_DEV_TYPE 0 /* device type and qualifier */ +#define SCSI_INQUIRY_DEV_MODIFIER 1 /* type modifier, removable */ +#define SCSI_INQUIRY_VERSION 2 /* ISO, ECMA and ANSI versions */ +#define SCSI_INQUIRY_FORMAT 3 /* reponse format, etc. */ +#define SCSI_INQUIRY_ADD_LENGTH 4 /* additional length byte */ +#define SCSI_INQUIRY_FLAGS 7 /* miscellaneous flags (below) */ +#define SCSI_INQUIRY_VENDOR_ID 8 /* vendor ID */ +#define SCSI_INQUIRY_PRODUCT_ID 16 /* product ID */ +#define SCSI_INQUIRY_REV_LEVEL 32 /* product revision level */ + +#define SCSI_INQUIRY_DEV_TYPE_MASK 0x1f /* mask for device type (byte 0) */ + +#define SCSI_INQUIRY_REMOVABLE_MASK 0x80 /* removable media flag (byte 1) */ + +#define SCSI_INQUIRY_ANSI_VSN_MASK 0x07 /* ANSI version (byte 2) */ + +#define SCSI_INQUIRY_FORMAT_MASK 0x0f /* response data format (byte 3) */ + +#define SCSI_INQUIRY_CMD_QUEUE_MASK 0x02 /* command queuing flag (byte 7) */ +#define SCSI_INQUIRY_WIDE_32_MASK 0x40 /* wide bus 32 flag (byte 7) */ +#define SCSI_INQUIRY_WIDE_16_MASK 0x20 /* wide bus 16 flag (byte 7) */ +#define SCSI_INQUIRY_SYNC_XFER_MASK 0x10 /* synch. xfer flag (byte 7) */ + +#define SCSI_INQUIRY_VENDOR_ID_LENGTH 8 +#define SCSI_INQUIRY_PRODUCT_ID_LENGTH 16 +#define SCSI_INQUIRY_REV_LEVEL_LENGTH 4 + + +/* device type enumeration */ + +#define SCSI_DEV_DIR_ACCESS ((UINT8) 0x00) /* direct-access dev (disk) */ +#define SCSI_DEV_SEQ_ACCESS ((UINT8) 0x01) /* sequent'l-access dev (tape) */ +#define SCSI_DEV_PRINTER ((UINT8) 0x02) /* printer dev */ +#define SCSI_DEV_PROCESSOR ((UINT8) 0x03) /* processor dev */ +#define SCSI_DEV_WORM ((UINT8) 0x04) /* write-once read-mult dev */ +#define SCSI_DEV_RO_DIR_ACCESS ((UINT8) 0x05) /* read-only direct-access dev */ +#define SCSI_LUN_NOT_PRESENT ((UINT8) 0x7f) /* logical unit not present */ + +/* miscellaneous SCSI constants, etc. */ + +#define SCSI_SYNC_XFER_MAX_OFFSET 0xff /* in sync xfer request msg */ +#define SCSI_SYNC_XFER_MIN_PERIOD 1 /* shoot for highest speed */ +#define SCSI_SYNC_XFER_ASYNC_OFFSET 0 /* special value for async. */ +#define SCSI_SYNC_XFER_ASYNC_PERIOD 0 /* (irrelevant for async.) */ + +#define SCSI_WIDE_XFER_SIZE_DEFAULT 1 /* 16 bit default wide width */ +#define SCSI_WIDE_XFER_SIZE_NARROW 0 /* 8 bit narrow width */ + +#define SCSI_MAX_MSG_IN_BYTES (2 + SCSI_EXT_MSG_MAX_LENGTH) +#define SCSI_MAX_MSG_OUT_BYTES (2 + SCSI_EXT_MSG_MAX_LENGTH) + +#define SCSI_MAX_IDENT_MSG_LENGTH (1 + 2) /* IDENTIFY + QUEUE TAG msg */ + +#define SCSI_MAX_TAGS 256 /* tags numbered 0 - 255 */ + +/* definitions relating to SCSI commands */ + +#define SCSI_MAX_CMD_LENGTH 12 /* maximum length in bytes of a SCSI command */ + +typedef UINT8 SCSI_COMMAND [SCSI_MAX_CMD_LENGTH]; + +#define SCSI_GROUP_0_CMD_LENGTH 6 +#define SCSI_GROUP_1_CMD_LENGTH 10 +#define SCSI_GROUP_5_CMD_LENGTH 12 + +/* some useful defines and structures for CCS commands */ + +#define SCSI_FORMAT_DATA_BIT ((UINT8) 0x10) +#define SCSI_COMPLETE_LIST_BIT ((UINT8) 0x08) + +#define DEFAULT_INQUIRY_DATA_LENGTH 36 +#define REQ_SENSE_ADD_LENGTH_BYTE 7 +#define INQUIRY_ADD_LENGTH_BYTE 4 +#define MODE_SENSE_ADD_LENGTH_BYTE 0 + +#define NON_EXT_SENSE_DATA_LENGTH 4 + +#define SCSI_SENSE_DATA_CLASS 0x70 +#define SCSI_SENSE_DATA_CODE 0x0f + +#define SCSI_SENSE_KEY_MASK 0x0f + +#define SCSI_EXT_SENSE_CLASS 0x70 +#define SCSI_EXT_SENSE_CODE 0x00 + +#define SPACE_CODE_DATABLK 0x00 /* space data blocks */ +#define SPACE_CODE_FILEMARK 0x01 /* space file-marks */ + + +/* scsiLib errno's */ + +#define S_scsiLib_DEV_NOT_READY (M_scsiLib | 1) +#define S_scsiLib_WRITE_PROTECTED (M_scsiLib | 2) +#define S_scsiLib_MEDIUM_ERROR (M_scsiLib | 3) +#define S_scsiLib_HARDWARE_ERROR (M_scsiLib | 4) +#define S_scsiLib_ILLEGAL_REQUEST (M_scsiLib | 5) +#define S_scsiLib_BLANK_CHECK (M_scsiLib | 6) +#define S_scsiLib_ABORTED_COMMAND (M_scsiLib | 7) +#define S_scsiLib_VOLUME_OVERFLOW (M_scsiLib | 8) +#define S_scsiLib_UNIT_ATTENTION (M_scsiLib | 9) +#define S_scsiLib_SELECT_TIMEOUT (M_scsiLib | 10) +#define S_scsiLib_LUN_NOT_PRESENT (M_scsiLib | 11) +#define S_scsiLib_ILLEGAL_BUS_ID (M_scsiLib | 12) +#define S_scsiLib_NO_CONTROLLER (M_scsiLib | 13) +#define S_scsiLib_REQ_SENSE_ERROR (M_scsiLib | 14) +#define S_scsiLib_DEV_UNSUPPORTED (M_scsiLib | 15) +#define S_scsiLib_ILLEGAL_PARAMETER (M_scsiLib | 16) +#define S_scsiLib_INVALID_PHASE (M_scsiLib | 17) +#define S_scsiLib_ABORTED (M_scsiLib | 18) +#define S_scsiLib_ILLEGAL_OPERATION (M_scsiLib | 19) +#define S_scsiLib_DEVICE_EXIST (M_scsiLib | 20) +#define S_scsiLib_DISCONNECTED (M_scsiLib | 21) +#define S_scsiLib_BUS_RESET (M_scsiLib | 22) +#define S_scsiLib_INVALID_TAG_TYPE (M_scsiLib | 23) +#define S_scsiLib_SOFTWARE_ERROR (M_scsiLib | 24) +#define S_scsiLib_NO_MORE_THREADS (M_scsiLib | 25) +#define S_scsiLib_UNKNOWN_SENSE_DATA (M_scsiLib | 26) +#define S_scsiLib_INVALID_BLOCK_SIZE (M_scsiLib | 27) + + /* default select timeout (usec) */ +#define SCSI_DEF_SELECT_TIMEOUT ((UINT) 250000) + + /* default auto-config timeout (usec) */ +#define SCSI_DEF_CONFIG_TIMEOUT ((UINT) 1000) + +#define SCSI_TIMEOUT_5SEC ((UINT) 5000000) +#define SCSI_TIMEOUT_1SEC ((UINT) 1000000) +#define SCSI_TIMEOUT_FULL ((UINT) 0xffffffff) + +#define SCSI_DEF_MIN_TIMEOUT SCSI_TIMEOUT_1SEC +#define SCSI_DEF_MAX_TIMEOUT SCSI_TIMEOUT_FULL + + /* default bus ID for a vxWorks SCSI port */ + +#define SCSI_DEF_CTRL_BUS_ID 7 + +/* parameters for SCSI manager task (also see specific controller drivers) */ + +#define SCSI_DEF_TASK_NAME "tScsiTask" +#define SCSI_DEF_TASK_OPTIONS VX_UNBREAKABLE +#define SCSI_DEF_TASK_STACK_SIZE 4000 +#define SCSI_DEF_TASK_PRIORITY 5 + +/* parameters for SCSI manager queues, thread allocation, etc. */ + +#define SCSI_DEF_MAX_THREADS 64 /* max total # threads allowed */ +#define SCSI_DEF_ALLOC_THREADS 16 /* # threads allocated at once */ + +#define SCSI_DEF_EVENT_Q_SIZE 8 /* 2 should normally be enough ! */ +#define SCSI_DEF_REQUEST_Q_SIZE SCSI_DEF_MAX_THREADS +#define SCSI_DEF_REPLY_Q_SIZE SCSI_DEF_MAX_THREADS +#define SCSI_DEF_TIMEOUT_Q_SIZE SCSI_DEF_MAX_THREADS + +/* + * Cache flush threshold - the entire data cache will be cleared (read) + * or flushed (write) if the data buffer used for a SCSI command is this + * size or bigger. Otherwise, just the buffer will be cleared/flushed. + */ +#define SCSI_DEF_CACHE_FLUSH_THRESHOLD 2048 + + +/* SCSI bus information transfer phases (MCI codes) */ + +#define SCSI_NUM_XFER_PHASE 8 + +#define SCSI_DATA_OUT_PHASE 0x0 +#define SCSI_DATA_IN_PHASE 0x1 +#define SCSI_COMMAND_PHASE 0x2 +#define SCSI_STATUS_PHASE 0x3 +#define SCSI_MSG_OUT_PHASE 0x6 +#define SCSI_MSG_IN_PHASE 0x7 + + +/* + * Structure to pass to ioctl call to execute an SCSI command + */ +/* SCSI command priority */ + +typedef UINT SCSI_PRIORITY; + +#define SCSI_THREAD_TASK_PRIORITY ((UINT)-1) /* use current task priority */ + +#define SCSI_THREAD_MIN_PRIORITY 255 /* same as min task priority */ +#define SCSI_THREAD_MAX_PRIORITY 0 /* same as max task priority */ + +#define SCSI_IS_HIGHER_PRIORITY(x,y) (x < y) /* numerically lower */ +#define SCSI_IS_LOWER_PRIORITY(x,y) (x > y) /* numerically higher */ + +/* SCSI tag type enumeration */ + +typedef enum /* SCSI_TAG_TYPE */ + { + SCSI_TAG_DEFAULT = -1, /* use default for device */ + SCSI_TAG_UNTAGGED = 0, /* untagged command */ + SCSI_TAG_SENSE_RECOVERY, /* untagged, even if tagged cmds present */ + SCSI_TAG_SIMPLE, /* tagged with simple queue tag */ + SCSI_TAG_ORDERED, /* tagged with ordered queue tag */ + SCSI_TAG_HEAD_OF_Q /* tagged with head-of-queue tag */ + } SCSI_TAG_TYPE; + +/* default tag type (all targets use this by default) */ + +#define SCSI_DEF_TAG_TYPE SCSI_TAG_SIMPLE + +/* SCSI transation structure */ + +typedef struct /* SCSI_TRANSACTION - information about a SCSI transaction */ + { + UINT8 * cmdAddress; /* address of SCSI command bytes */ + int cmdLength; /* length of command in bytes */ + UINT8 * dataAddress; /* address of data buffer */ + int dataDirection; /* direction of data transfer: O_{RD,WR}ONLY */ + int dataLength; /* length of data buffer in bytes (0 = none) */ + int addLengthByte; /* no longer used */ + UINT8 statusByte; /* status byte returned from target */ + UINT cmdTimeout; /* number of usec for this command timeout */ + SCSI_TAG_TYPE tagType; /* tag type to use for this command */ + SCSI_PRIORITY priority; /* priority of this transaction */ + } SCSI_TRANSACTION; + + +/* + * Data structure and constants for "scsiTargetOptionsSet()" + */ +#define SCSI_SET_OPT_ALL_TARGETS ((UINT) -1) + +#define SCSI_SET_OPT_BITMASK 0x003f /* mask for valid option bits */ +#define SCSI_SET_OPT_TIMEOUT 0x0001 /* bit values to select options */ +#define SCSI_SET_OPT_MESSAGES 0x0002 +#define SCSI_SET_OPT_DISCONNECT 0x0004 +#define SCSI_SET_OPT_XFER_PARAMS 0x0008 +#define SCSI_SET_OPT_TAG_PARAMS 0x0010 +#define SCSI_SET_OPT_WIDE_PARAMS 0x0020 + +typedef struct /* SCSI_OPTIONS - programmable options */ + { + UINT selTimeOut; /* device select time-out (us) */ + BOOL messages; /* FALSE => do not use SCSI messages */ + BOOL disconnect; /* FALSE => do not use disconnect */ + UINT8 maxOffset; /* max sync xfer offset (0 => async.) */ + UINT8 minPeriod; /* min sync xfer period (x 4 ns) */ + SCSI_TAG_TYPE tagType; /* default tag type (see SCSI_TRANSACTION) */ + UINT maxTags; /* max cmd tags available (0 => untagged) */ + UINT8 xferWidth; /* wide data transfer width in SCSI units */ + } SCSI_OPTIONS; + +/* + * Structure for results of READ CAPACITY command + */ +typedef struct /* RD_CAP_DATA - results from READ CAPACITY */ + { + int lastLogBlkAdrs; /* address of last logical block on device */ + int blkLength; /* block length of last logical block */ + } RD_CAP_DATA; + +typedef struct /* RD_BLOCK_LIMIT_DATA - results from READ BLOCK LIMITS */ + { + int maxBlockLength; /* maximum block length limit */ + UINT16 minBlockLength; /* minimum block length limit */ + } RD_BLOCK_LIMIT_DATA; + +/* HIDDEN */ + +/* + * SCSI Target and related structures + */ +typedef enum /* Synchronous transfer state */ + { + SYNC_XFER_NOT_NEGOTIATED = 0, /* no negotiation ever started */ + SYNC_XFER_REQUEST_PENDING, /* attempting to send request */ + SYNC_XFER_REQUEST_SENT, /* waiting for target's reply */ + SYNC_XFER_REPLY_PENDING, /* attempting to send reply */ + SYNC_XFER_NEGOTIATION_COMPLETE /* all done (at least once) */ + } SCSI_SYNC_XFER_STATE; + +typedef enum /* Synchronous transfer event */ + { + SYNC_XFER_RESET = 1, /* reset synchronous transfer fsm */ + SYNC_XFER_NEW_THREAD, /* new thread is being activated */ + SYNC_XFER_MSG_IN, /* target has sent message in */ + SYNC_XFER_MSG_OUT, /* target has rcvd message out */ + SYNC_XFER_MSG_REJECTED /* target has rejected message out */ + } SCSI_SYNC_XFER_EVENT; + +typedef enum /* Wide data transfer state */ + { + WIDE_XFER_NOT_NEGOTIATED = 0, /* no negotiation ever stared */ + WIDE_XFER_REQUEST_PENDING, /* attempting to send wide request */ + WIDE_XFER_REQUEST_SENT, /* waiting for target's reply */ + WIDE_XFER_REPLY_PENDING, /* attempting to send reply */ + WIDE_XFER_NEGOTIATION_COMPLETE /* negotiations done (min. once) */ + } SCSI_WIDE_XFER_STATE; + +typedef enum /* Wide data transfer event */ + { + WIDE_XFER_RESET = 1, /* reset wide transfer */ + WIDE_XFER_NEW_THREAD, /* new thread is being activated */ + WIDE_XFER_MSG_IN, /* target has sent message in */ + WIDE_XFER_MSG_OUT, /* target has received message out */ + WIDE_XFER_MSG_REJECTED /* target has rejected message out */ + } SCSI_WIDE_XFER_EVENT; + +typedef struct /* SCSI_TARGET - SCSI target information */ + { + int scsiDevBusId; /* device's address on SCSI bus */ + UINT selTimeOut; /* device select time-out (us) */ + BOOL messages; /* FALSE => do not use SCSI messages */ + BOOL disconnect; /* FALSE => do not use disconnect */ + SCSI_TAG_TYPE tagType; /* default tag type (cmds may override) */ + UINT maxTags; /* max cmd tags available (0 => untagged) */ + UINT8 maxOffset; /* maximum sync xfer offset (0 => async.) */ + UINT8 minPeriod; /* minimum sync xfer period (x 4 ns) */ + UINT8 xferOffset; /* current sync xfer offset (0 => async.) */ + UINT8 xferPeriod; /* current sync xfer period (x 4 ns) */ + UINT8 xferWidth; /* width in bits of the wide transfer */ + UINT8 syncSupport; /* supports synchronous transfers */ + UINT8 wideSupport; /* supports synchronous transfers */ + SCSI_SYNC_XFER_STATE syncXferState; /* state of sync xfer negotiation */ + SCSI_WIDE_XFER_STATE wideXferState; /* state of wide xfer negotiation */ + } SCSI_TARGET; + + +/* + * Structures and definitions related to SCSI tags + */ +typedef UINT SCSI_TAG; /* has the values [0..255] or SCSI_TAG_NONE */ + +#define SCSI_TAG_NONE ((SCSI_TAG) NONE) + +typedef struct scsiTagInfo + { + UINT8 inUse; /* actually a BOOL (but want to save space) */ + } SCSI_TAG_INFO; + + +/* + * SCSI Physical Device and related structures + */ +typedef enum scsiDevEvent /* SCSI phys dev event type enumeration */ + { + SCSI_DEV_ACTIVATED = 1, /* thread using this dev has been activated */ + SCSI_DEV_DISCONNECTED, /* thread using this dev has disconnected */ + SCSI_DEV_RECONNECTED, /* thread using this dev has reconnected */ + SCSI_DEV_COMPLETED /* thread using this dev has completed */ + } SCSI_DEV_EVENT_TYPE; + +typedef enum /* SCSI nexus type enumeration */ + { + SCSI_NEXUS_NONE = 0, /* no nexus */ + SCSI_NEXUS_IT, /* an I-T nexus */ + SCSI_NEXUS_ITL, /* an I-T-L nexus */ + SCSI_NEXUS_ITLQ /* an I-T-L-Q nexus */ + } SCSI_NEXUS_TYPE; + +typedef struct /* SCSI_PHYS_DEV - SCSI physical device info */ + { + SEM_ID mutexSem; /* semaphore for access to blk dev list */ + struct scsiCtrl *pScsiCtrl; /* ptr to dev's SCSI controller info */ + SCSI_TARGET *pScsiTarget; /* ptr to data for corresponding SCSI target */ + int scsiDevLUN; /* device's logical unit number */ + UINT8 scsiDevType; /* SCSI device type */ + BOOL resetFlag; /* set TRUE when dev reset sensed */ + + /* product info from INQUIRY command */ + char devVendorID [SCSI_INQUIRY_VENDOR_ID_LENGTH + 1]; + char devProductID [SCSI_INQUIRY_PRODUCT_ID_LENGTH + 1]; + char devRevLevel [SCSI_INQUIRY_REV_LEVEL_LENGTH + 1]; + + BOOL removable; /* whether medium is removable */ + SCSI_TAG_TYPE tagType; /* default tag type: cmds may over-ride */ + UINT nTags; /* total number of tags for device */ + UINT8 lastSenseKey; /* last sense key returned by dev */ + UINT8 lastAddSenseCode; /* last additional sense code returned */ + int controlByte; /* vendor unique control byte for commands */ + int numBlocks; /* number of blocks on the physical device */ + int blockSize; /* size of an SCSI disk sector */ + int maxVarBlockLimit; /* maximum size of a variable block: seq dev */ + BOOL extendedSense; /* whether device returns extended sense */ + UINT8 *pReqSenseData; /* ptr to last REQ SENSE data returned */ + int reqSenseDataLength; /* size of REQ SENSE data array */ + LIST blkDevList; /* list of block devs created on device */ + struct scsiSeqDev *pScsiSeqDev;/* ptr to SCSI seq dev; one per phys dev */ + + SCSI_NEXUS_TYPE nexus; /* type of current nexuses in progress */ + UINT nTaggedNexus; /* number of tagged nexuses in progress */ + BOOL connected; /* currently connected to SCSI bus ? */ + BOOL pendingCA; /* contingent allegiance condition pending ? */ + SCSI_NEXUS_TYPE savedNexus; /* type of nexus prior to CA recovery */ + LIST waitingThreads; /* list of threads waiting for device */ + LIST activeThreads; /* list of threads active on device */ + SCSI_TAG curTag; /* currently-connected tag (or NONE) */ + SCSI_TAG nextTag; /* next free tag number (if any) */ + UINT nFreeTags; /* number of free tags (if tags supported) */ + SCSI_TAG_INFO untagged; /* "tag" info for a single untagged thread */ + SCSI_TAG_INFO * pTagInfo; /* ptr to tag info table for tagged threads */ + } SCSI_PHYS_DEV; + + +typedef SCSI_PHYS_DEV *SCSI_PHYS_DEV_ID; + +/* SCSI Sequential device */ + +typedef struct scsiSeqDev /* SCSI_SEQ_DEV - + SCSI logical sequential device info */ + { + SEQ_DEV seqDev; /* generic logical sequential device info */ + SCSI_PHYS_DEV *pScsiPhysDev;/* ptr to SCSI physical device info */ + } SCSI_SEQ_DEV; + + +/* + * SCSI Block Device and related structures + */ +typedef struct scsiBlkDev /* SCSI_BLK_DEV - + SCSI logical block device info */ + { + BLK_DEV blkDev; /* generic logical block device info */ + SCSI_PHYS_DEV *pScsiPhysDev;/* ptr to SCSI physical device info */ + int numBlocks; /* number of blocks on the logical device */ + int blockOffset; /* address of first block on logical device */ + } SCSI_BLK_DEV; + + +typedef SCSI_BLK_DEV *SCSI_BLK_DEV_ID; + +typedef struct scsiBlkDevNode + { + NODE blkDevNode; + SCSI_BLK_DEV scsiBlkDev; + } SCSI_BLK_DEV_NODE; + + +/* + * SCSI Controller and related structures + */ +typedef enum /* Message In state */ + { + SCSI_MSG_IN_NONE = 0, /* no message in being assembled */ + SCSI_MSG_IN_SECOND_BYTE, /* next byte in is second of two */ + SCSI_MSG_IN_EXT_MSG_LEN, /* next byte in is ext msg length */ + SCSI_MSG_IN_EXT_MSG_DATA /* next byte(s) in are ext msg data */ + } SCSI_MSG_IN_STATE; + + +typedef enum /* Message Out state */ + { + SCSI_MSG_OUT_NONE = 0, /* no message out available */ + SCSI_MSG_OUT_PENDING, /* message out not yet sent */ + SCSI_MSG_OUT_SENT /* message out already sent */ + } SCSI_MSG_OUT_STATE; + + +typedef enum /* Identification In state */ + { + SCSI_IDENT_IN_NONE = 0, /* no identification in progress */ + SCSI_IDENT_IN_IDENT, /* next byte in is IDENTIFY msg */ + SCSI_IDENT_IN_QUEUE_TAG /* next bytes in are QUEUE TAG msg */ + } SCSI_IDENT_IN_STATE; + + +typedef enum scsiCacheAction /* Cache management actions */ + { + SCSI_CACHE_PRE_COMMAND = 0, /* flush/invalidate before command */ + SCSI_CACHE_POST_COMMAND /* flush/invalidate after command */ + } SCSI_CACHE_ACTION; + + +#define SCSI_BUS_NEGATE_ACK 0x0001 /* bitmasks for scsiBusControl() */ +#define SCSI_BUS_ASSERT_ATN 0x0002 +#define SCSI_BUS_DISCONNECT 0x0004 +#define SCSI_BUS_RESET 0x0008 + +typedef struct scsiCtrl /* SCSI_CTRL - generic SCSI controller info */ + { + SEM_ID mutexSem; /* semaphore for exclusive access */ + SEM_ID actionSem; /* sync with controller events or clients */ + RING_ID eventQ; /* ring buffer for controller events */ + RING_ID timeoutQ; /* ring buffer for request timeouts */ + RING_ID requestQ; /* ring buffer for client requests */ + RING_ID replyQ; /* ring buffer for client replies */ + int scsiMgrId; /* SCSI manager task ID */ + FUNCPTR scsiTransact; /* function for managing a SCSI transaction */ + VOIDFUNCPTR scsiEventProc; /* function for processing controller events */ + FUNCPTR scsiThreadInit; /* function for initializing a new thread */ + FUNCPTR scsiThreadActivate; /* function for (re)activating a thread */ + FUNCPTR scsiThreadAbort; /* function for aborting a thread */ + FUNCPTR scsiDevSelect; /* function for selecting a SCSI device */ + FUNCPTR scsiBusControl; /* function for misc SCSI bus control */ + FUNCPTR scsiInfoXfer; /* function for SCSI input/output transfers */ + FUNCPTR scsiXferParamsQuery;/* function for getting sync xfer params */ + FUNCPTR scsiXferParamsSet; /* function for setting sync xfer params */ + FUNCPTR scsiWideXferParamsSet;/* function for setting wide xfer params */ + FUNCPTR scsiWideXferParamsQuery;/* function for getting Wide xfer params */ + UINT maxBytesPerXfer; /* upper bound of ctrl. transfer counter */ + int eventSize; /* sizeof event msg (0 = use default) */ + int threadSize; /* sizeof thread (0 = use default) */ + int scsiCtrlBusId; /* SCSI bus ID of this SCSI controller */ + BOOL disconnect; /* globally enable / disable disconnect */ + BOOL syncXfer; /* globally enable / disable sync xfer. */ + BOOL wideXfer; /* globally enable / disable wide xfer. */ + + BOOL active; /* there is an active SCSI thread */ + int peerBusId; /* ID of connected SCSI peer device */ + UINT nThreads; /* total number of threads in existence */ + LIST freeThreads; /* list (set) of free threads */ + UINT nextDev; /* phys dev index for round-robin scheduling */ + + struct scsiThread * pIdentThread; /* reserved identification thread */ + struct scsiThread * pThread; /* currently active thread */ + + UINT msgInLength; /* message in bytes read so far */ + UINT msgOutLength; /* pending message out length */ + SCSI_MSG_IN_STATE msgInState; /* status of incoming message */ + SCSI_MSG_OUT_STATE msgOutState; /* status of outgoing message */ + + UINT8 identBuf [SCSI_MAX_IDENT_MSG_LENGTH];/* incoming ident msg buffer */ + UINT8 msgInBuf [SCSI_MAX_MSG_IN_BYTES]; /* incoming message buffer */ + UINT8 msgOutBuf [SCSI_MAX_MSG_OUT_BYTES]; /* outgoing message buffer */ + + SCSI_TARGET targetArr [SCSI_MAX_TARGETS]; /* attached SCSI targets */ + SCSI_PHYS_DEV *physDevArr [SCSI_MAX_PHYS_DEVS]; /* attached phys. devs. */ + BOOL cacheSnooping; /* is hardware snooping enabled */ + FUNCPTR scsiSpecialHandler; /* negotiate transfer paramaters */ + } SCSI_CTRL; + + +/* + * SCSI thread and related structures + */ +typedef enum /* event types for "scsiMgrThreadEvent()" */ + { + SCSI_THREAD_EVENT_ACTIVATED = 1, /* thread has been activated */ + SCSI_THREAD_EVENT_DISCONNECTED, /* thread has disconnected */ + SCSI_THREAD_EVENT_RECONNECTED, /* thread has reconnected */ + SCSI_THREAD_EVENT_COMPLETED, /* thread has completed */ + SCSI_THREAD_EVENT_DEFERRED /* thread has been deferred */ + } SCSI_THREAD_EVENT_TYPE; + +typedef enum /* SCSI thread state enumeration */ + { + SCSI_THREAD_INACTIVE = 0, /* thread is not doing anything */ + SCSI_THREAD_WAITING, /* thread is waiting for access to phys dev */ + SCSI_THREAD_DISCONNECTED, /* thread is disconnected from SCSI bus */ + SCSI_THREAD_CONNECTING, /* thread is selecting target device */ + SCSI_THREAD_IDENT_IN, /* thread is receiving identification msg(s) */ + SCSI_THREAD_IDENT_OUT, /* thread is sending identification msg(s) */ + SCSI_THREAD_ESTABLISHED, /* thread has established a SCSI nexus */ + SCSI_THREAD_WAIT_DISCONNECT,/* thread is waiting for disconnection */ + SCSI_THREAD_WAIT_COMPLETE, /* thread is waiting for final disconnection */ + SCSI_THREAD_ABORTING, /* thread is aborting a normal connection */ + SCSI_THREAD_IDENT_ABORTING, /* thread is aborting identification msg in */ + SCSI_THREAD_WAIT_ABORT /* thread has been aborted */ + } SCSI_THREAD_STATE; + +typedef enum /* status of incoming identification */ + { + SCSI_IDENT_INCOMPLETE, /* identification message not yet complete */ + SCSI_IDENT_COMPLETE, /* identification successfully completed */ + SCSI_IDENT_FAILED /* identification incorrect: to be rejected */ + } SCSI_IDENT_STATUS; + +typedef enum /* SCSI role type enumeration */ + { + SCSI_ROLE_INITIATOR = 0, /* initiating a SCSI transaction */ + SCSI_ROLE_TARGET, /* target for a SCSI transaction */ + SCSI_ROLE_IDENT_INIT, /* identifying a reselecting target */ + SCSI_ROLE_IDENT_TARG /* identifying a selecting initiator */ + } SCSI_ROLE; + +typedef struct scsiThread /* SCSI_THREAD */ + { + NODE lstNode; /* node to support lists of threads */ + SCSI_CTRL *pScsiCtrl; /* SCSI controller thread is using */ + SCSI_TARGET *pScsiTarget; /* SCSI target device thread is using */ + SCSI_PHYS_DEV *pScsiPhysDev;/* SCSI physical device thread is using */ + MSG_Q_ID replyQ; /* reply from thread manager */ + WDOG_ID wdog; /* request timeout watchdog */ + SCSI_THREAD_STATE state; /* thread's current state */ + SCSI_ROLE role; /* SCSI role (initiator/target/ident) */ + STATUS status; /* completion status for thread request */ + int errNum; /* error code for thread request */ + UINT tagNumber; /* tag number used by this thread */ + SCSI_TAG_TYPE tagType; /* tag type used by this thread */ + UINT timeout; /* timeout period (ticks) */ + SCSI_PRIORITY priority; /* thread priority: 0 highest, 255 lowest */ + int dataDirection; /* data direction: O_{RDONLY,WRONLY} */ + /* identification msg to be sent (if any) */ + UINT8 identMsg[SCSI_MAX_IDENT_MSG_LENGTH]; + UINT identMsgLength; /* number of identification bytes to send */ + UINT8 *cmdAddress; /* SCSI command pointer */ + UINT cmdLength; /* number of command bytes to transfer */ + UINT8 *statusAddress; /* buffer for SCSI status byte */ + UINT statusLength; /* number of status bytes to transfer */ + UINT8 *dataAddress; /* SCSI data pointer (init'l value) */ + UINT dataLength; /* remaining data byte count (init'l value) */ + UINT8 *activeDataAddress; /* SCSI data pointer (active value) */ + UINT activeDataLength; /* remaining data byte count (active value) */ + UINT8 *savedDataAddress; /* SCSI data pointer (saved value) */ + UINT savedDataLength; /* remaining data byte count (saved value) */ + UINT nBytesIdent; /* number of ident bytes sent/received */ + } SCSI_THREAD; + + +/* + * Structures used by clients to communicate with the SCSI manager task + */ +typedef enum /* requests to SCSI manager */ + { + SCSI_REQUEST_ACTIVATE = 0, /* activate initiator thread */ + SCSI_REQUEST_WAIT_ACTIVATION, /* wait activation of target thread */ + SCSI_REQUEST_TRANSFER, /* transfer data on target thread */ + SCSI_REQUEST_DEACTIVATE, /* deactivate target thread */ + SCSI_REQUEST_REACTIVATE, /* reactivate target thread */ + SCSI_REQUEST_COMPLETE /* complete target thread */ + } SCSI_REQUEST_TYPE; + +typedef struct scsiRequest /* request message to SCSI manager */ + { + SCSI_REQUEST_TYPE type; /* type of request: as above */ + SCSI_THREAD * thread; /* thread request corresponds to */ + } SCSI_REQUEST; + + +typedef enum /* replies from SCSI manager */ + { + SCSI_REPLY_COMPLETE = 0 /* thread has completed (or failed) */ + } SCSI_REPLY_TYPE; + +typedef struct scsiReply /* reply message from SCSI manager */ + { + SCSI_REPLY_TYPE type; /* type of reply: as above */ + SCSI_THREAD * thread; /* thread reply corresponds to */ + STATUS status; /* status of last request */ + int errNum; /* errno, if status == ERROR */ + } SCSI_REPLY; + + +/* + * SCSI manager timeout message structure + */ +typedef struct scsiTimeout + { + SCSI_THREAD * thread; + } SCSI_TIMEOUT; + + +/* + * SCSI Controller Event message structure + */ +typedef enum /* SCSI controller event enumeration */ + { + SCSI_EVENT_CONNECTED = 1, /* (re)select cmd has successfully completed */ + SCSI_EVENT_DISCONNECTED, /* target device has disconnected */ + SCSI_EVENT_RESELECTED, /* controller has been reselected */ + SCSI_EVENT_SELECTED, /* controller has been selected */ + SCSI_EVENT_XFER_REQUEST, /* target device has requested info xfer */ + SCSI_EVENT_TIMEOUT, /* (re)selection or info xfer timed out */ + SCSI_EVENT_BUS_RESET, /* the SCSI bus has been reset */ + SCSI_EVENT_PARITY_ERR /* parity error detected */ + } SCSI_EVENT_TYPE; + +typedef struct scsiEvent /* SCSI_EVENT */ + { + /* + * Note: some fields may not be used, depending on the event type. + * If this structure gets much bigger, it should probably be made into + * a tagged union. + */ + SCSI_EVENT_TYPE type; /* type of event: as above */ + int busId; /* bus ID of SCSI peer (con, resel, sel) */ + int nBytesIdent; /* # bytes ident in/out (con, resel, sel) */ + UINT8 identMsg [SCSI_MAX_IDENT_MSG_LENGTH]; /* ident msg (resel, sel) */ + int phase; /* requested SCSI bus phase (xfer req) */ + } SCSI_EVENT; + +/* END_HIDDEN */ + + +/* external variable declarations */ + +IMPORT BOOL scsiDebug; +IMPORT BOOL scsiIntsDebug; +IMPORT SCSI_CTRL *pSysScsiCtrl; + +/* macros */ + +#define SCSI_MSG \ + logMsg + +#define SCSI_ERROR_MSG \ + if (scsiErrors || scsiDebug) \ + SCSI_MSG + +#define SCSI_DEBUG_MSG \ + if (scsiDebug) \ + SCSI_MSG + +#define SCSI_INT_DEBUG_MSG \ + if (scsiIntsDebug) \ + logMsg + +/******************************************************************************* +* +* SCSI_SWAB - swap bytes on little-endian machines +* +* All fields which are defined as integers (short or long) by the SCSI spec +* and which are passed during the data phase should be pre- or post-processed +* by this macro. The macro does nothing on big-endian machines, but swaps +* bytes for little-endian machines. All SCSI quantities are big-endian. +* +* NOMANUAL +*/ + +#if (_BYTE_ORDER == _BIG_ENDIAN) +#define SCSI_SWAB(pBuffer, bufLength) +#else +#define SCSI_SWAB(pBuffer, bufLength) \ + do \ + { \ + char temp; \ + char *pHead = (char *) pBuffer; \ + char *pTail = (char *) pBuffer + bufLength - 1; \ + \ + while (pHead < pTail) \ + { \ + temp = *pTail; \ + *pTail-- = *pHead; \ + *pHead++ = temp; \ + } \ + } while (FALSE) +#endif + +/* global variables */ + +extern SCSI_FUNC_TBL * pScsiIfTbl; /* scsiLib interface function table */ + +extern BOOL scsiErrors; /* enable SCSI error messages */ +extern int scsiMgrActionSemOptions; +extern int scsiThreadReplyQOptions; +extern int scsiMgrEventQSize; +extern int scsiMgrTimeoutQSize; +extern int scsiMgrRequestQSize; +extern int scsiMgrReplyQSize; + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void scsi2IfInit (); + +/* SCSI block device driver functions */ + +extern BLK_DEV *scsiBlkDevCreate (SCSI_PHYS_DEV *pScsiPhysDev, int numBlocks, + int blockOffset); +extern void scsiBlkDevInit (SCSI_BLK_DEV *pScsiBlkDev, int blksPerTrack, + int nHeads); +extern void scsiBlkDevShow (SCSI_PHYS_DEV *pScsiPhysDev); +extern STATUS scsiRdSecs (SCSI_BLK_DEV *pScsiBlkDev, int sector, + int numSecs, char *buffer); +extern STATUS scsiWrtSecs (SCSI_BLK_DEV *pScsiBlkDev, int sector, + int numSecs, char *buffer); + +/* general SCSI functions */ + +extern SCSI_PHYS_DEV *scsiPhysDevCreate (SCSI_CTRL *pScsiCtrl, int devBusId, + int devLUN, int reqSenseLength, + int devType, BOOL removable, + int numBlocks, int blockSize); +extern SCSI_PHYS_DEV *scsiPhysDevIdGet (SCSI_CTRL *pScsiCtrl, int devBusId, + int devLUN); +extern STATUS scsiPhysDevDelete (SCSI_PHYS_DEV *pScsiPhysDev); +extern STATUS scsiAutoConfig (SCSI_CTRL *pScsiCtrl); +extern STATUS scsiBusReset (SCSI_CTRL *pScsiCtrl); +extern STATUS scsiCmdBuild (SCSI_COMMAND scsiCmd, int *pCmdLength, + UINT8 opCode, int LUN, BOOL relAdrs, + int logBlockAdrs, int xferLength, + UINT8 controlByte); +extern STATUS scsiCtrlInit (SCSI_CTRL *pScsiCtrl); + +extern SCSI_THREAD * scsiCtrlIdentThreadCreate (SCSI_CTRL *pScsiCtrl); +extern STATUS scsiCtrlThreadInit (SCSI_CTRL * pScsiCtrl, + SCSI_THREAD * pThread); +extern STATUS scsiCtrlThreadActivate (SCSI_CTRL * pScsiCtrl, + SCSI_THREAD * pThread); +extern void scsiCtrlEvent (SCSI_CTRL * pScsiCtrl, + SCSI_EVENT * pEvent); +extern BOOL scsiCtrlThreadAbort (SCSI_CTRL * pScsiCtrl, + SCSI_THREAD * pThread); + +extern STATUS scsiIoctl (SCSI_PHYS_DEV *pScsiPhysDev, int function, int arg); +extern STATUS scsiShow (SCSI_CTRL *pScsiCtrl); +extern STATUS scsiTransact (SCSI_PHYS_DEV *pScsiPhysDev, + SCSI_TRANSACTION *pScsiXaction); +extern STATUS scsiTargetOptionsSet (SCSI_CTRL *pScsiCtrl, int devBusId, + SCSI_OPTIONS *pOptions, UINT which); +extern STATUS scsiTargetOptionsGet (SCSI_CTRL *pScsiCtrl, int devBusId, + SCSI_OPTIONS *pOptions); +extern void scsiTargetReset (SCSI_CTRL * pScsiCtrl, UINT busId); +extern void scsiThreadListShow (LIST * pList); +extern void scsiThreadListIdShow (LIST * pList); + +extern void scsiPhysDevShow (SCSI_PHYS_DEV * pScsiPhysDev, + BOOL showThreads, BOOL noHeader); + +extern char * scsiPhaseNameGet (int scsiPhase); +extern void scsiCacheSnoopEnable (SCSI_CTRL * pScsiCtrl); +extern void scsiCacheSnoopDisable (SCSI_CTRL * pScsiCtrl); + +/* functions to execute specific SCSI commands */ + +extern STATUS scsiFormatUnit (SCSI_PHYS_DEV *pScsiPhysDev, + BOOL cmpDefectList, int defListFormat, + int vendorUnique, int interleave, + char *buffer, int bufLength); +extern STATUS scsiInquiry (SCSI_PHYS_DEV *pScsiPhysDev, char *buffer, + int bufLength); +extern STATUS scsiModeSelect (SCSI_PHYS_DEV *pScsiPhysDev, int pageFormat, + int saveParams, char *buffer, int bufLength); +extern STATUS scsiModeSense (SCSI_PHYS_DEV *pScsiPhysDev, int pageControl, + int pageCode, char *buffer, int bufLength); +extern STATUS scsiReadCapacity (SCSI_PHYS_DEV *pScsiPhysDev, int *pLastLBA, + int *pBlkLength); +extern STATUS scsiReqSense (SCSI_PHYS_DEV *pScsiPhysDev, char *buffer, + int bufLength); +extern STATUS scsiTestUnitRdy (SCSI_PHYS_DEV *pScsiPhysDev); + +extern STATUS scsiStartStopUnit(SCSI_PHYS_DEV *pScsiPhysDev, BOOL start); + +extern STATUS scsiRelease (SCSI_PHYS_DEV * pScsiPhysDev); + +extern STATUS scsiReserve (SCSI_PHYS_DEV * pScsiPhysDev); + +/* Functions to execute SCSI sequential access commands */ + +extern SEQ_DEV *scsiSeqDevCreate (SCSI_PHYS_DEV *pScsiPhysDev); + +extern STATUS scsiErase (SCSI_PHYS_DEV *pScsiPhysDev, BOOL longErase); + +extern STATUS scsiTapeModeSelect (SCSI_PHYS_DEV *pScsiPhysDev, int pageFormat, + int saveParams, char *buffer, int bufLength); + +extern STATUS scsiTapeModeSense (SCSI_PHYS_DEV *pScsiPhysDev, int pageControl, + int pageCode, char *buffer, int bufLength); + +extern STATUS scsiReadBlockLimits (SCSI_PHYS_DEV *pScsiPhysDev, + int *pMaxBlockLength, + UINT16 *pMinBlockLength); + +extern STATUS scsiSeqReadBlockLimits (SCSI_SEQ_DEV *pScsiSeqDev, + int *pMaxBlockLength, + UINT16 *pMinBlockLength); + +extern int scsiRdTape (SCSI_SEQ_DEV *pScsiSeqDev, UINT numBytes, + char *buffer, BOOL fixedSize); + +extern STATUS scsiWrtTape (SCSI_SEQ_DEV *pScsiSeqDev, int numBytes, + char *buffer, BOOL fixedSize); + +extern STATUS scsiRewind (SCSI_SEQ_DEV *pScsiSeqDev); + +extern STATUS scsiReserveUnit (SCSI_SEQ_DEV *pScsiSeqDev); + +extern STATUS scsiReleaseUnit (SCSI_SEQ_DEV *pScsiSeqDev); + +extern STATUS scsiLoadUnit (SCSI_SEQ_DEV *pScsiSeqDev, BOOL load, BOOL reten, + BOOL eot); + +extern STATUS scsiWrtFileMarks (SCSI_SEQ_DEV *pScsiSeqDev, int numMarks, + BOOL shortMark); + +extern STATUS scsiSpace (SCSI_SEQ_DEV *pScsiSeqDev, int count, int spaceCode); + +extern STATUS scsiSeqStatusCheck (SCSI_SEQ_DEV *pScsiSeqDev); + +STATUS scsiSeqIoctl (SCSI_SEQ_DEV * pScsiSeqDev, int function, int arg); + +/* SCSI controller driver support functions (not callable by applications) */ + +extern int scsiIdentMsgBuild (UINT8 *msg, + SCSI_PHYS_DEV *pScsiPhysDev, + SCSI_TAG_TYPE tagType, + SCSI_TAG tagNumber); + +extern SCSI_IDENT_STATUS scsiIdentMsgParse (SCSI_CTRL *pScsiCtrl, + UINT8 *msg, + int msgLength, + SCSI_PHYS_DEV **ppScsiPhysDev, + SCSI_TAG *pTagNum); + +extern STATUS scsiMsgInComplete (SCSI_CTRL *pScsiCtrl, SCSI_THREAD *pThread); +extern STATUS scsiMsgOutComplete (SCSI_CTRL *pScsiCtrl, SCSI_THREAD *pThread); +extern void scsiMsgOutReject (SCSI_CTRL *pScsiCtrl, SCSI_THREAD *pThread); + +extern void scsiSyncXferNegotiate (SCSI_CTRL *pScsiCtrl, + SCSI_TARGET *pScsiTarget, + SCSI_SYNC_XFER_EVENT eventType); +extern void scsiWideXferNegotiate (SCSI_CTRL *pScsiCtrl, + SCSI_TARGET *pScsiTarget, + SCSI_WIDE_XFER_EVENT eventType); + + +extern void scsiMgr (SCSI_CTRL *pScsiCtrl); + +extern STATUS scsiMgrEventNotify (SCSI_CTRL *pScsiCtrl, + SCSI_EVENT *pEvent, + int eventSize); + +extern void scsiMgrCtrlEvent (SCSI_CTRL *pScsiCtrl, SCSI_EVENT_TYPE type); +extern void scsiMgrBusReset (SCSI_CTRL *pScsiCtrl); + +extern void scsiMgrThreadEvent (SCSI_THREAD *pThread, + SCSI_THREAD_EVENT_TYPE type); + +extern SCSI_THREAD * scsiMgrPhysDevActiveThreadFind (SCSI_PHYS_DEV *pScsiPhysDev, + SCSI_TAG tagNumber); + +extern STATUS scsiMgrRequestExecute (SCSI_CTRL * pScsiCtrl, + SCSI_REQUEST * pRequest, + SCSI_REPLY * pReply); +extern void scsiMgrPhysDevTagInit (SCSI_PHYS_DEV * pScsiPhysDev); + +extern void scsiBusResetNotify (SCSI_CTRL *pScsiCtrl); + +extern STATUS scsiThreadInit (SCSI_THREAD *pThread); +extern void scsiCacheSynchronize (SCSI_THREAD *pThread, + SCSI_CACHE_ACTION action); + +#else /* __STDC__ */ + +/* SCSI block device driver functions */ + +extern BLK_DEV * scsiBlkDevCreate (); +extern void scsiBlkDevInit (); +extern void scsiBlkDevShow (); +extern STATUS scsiRdSecs (); +extern STATUS scsiWrtSecs (); + +/* general SCSI functions */ + +extern SCSI_PHYS_DEV * scsiPhysDevCreate (); +extern SCSI_PHYS_DEV * scsiPhysDevIdGet (); +extern STATUS scsiPhysDevDelete (); +extern STATUS scsiAutoConfig (); +extern STATUS scsiBusReset (); +extern STATUS scsiCmdBuild (); +extern STATUS scsiCtrlInit (); +extern SCSI_THREAD * scsiCtrlIdentThreadCreate (); +extern STATUS scsiCtrlThreadInit (); +extern STATUS scsiCtrlThreadActivate (); +extern void scsiCtrlEvent (); +extern BOOL scsiCtrlThreadAbort (); + +extern STATUS scsiIoctl (); +extern STATUS scsiShow (); +extern STATUS scsiTransact (); +extern STATUS scsiTargetOptionsSet (); +extern STATUS scsiTargetOptionsGet (); +extern void scsiTargetReset (); +extern void scsiThreadListShow (); +extern void scsiThreadListIdShow (); +extern void scsiPhysDevShow (); +extern char * scsiPhaseNameGet (); +extern void scsiCacheSnoopEnable (); +extern void scsiCacheSnoopDisable (); + +/* functions to execute specific SCSI commands */ + +extern STATUS scsiFormatUnit (); +extern STATUS scsiInquiry (); +extern STATUS scsiModeSelect (); +extern STATUS scsiModeSense (); +extern STATUS scsiReadCapacity (); +extern STATUS scsiReqSense (); +extern STATUS scsiTestUnitRdy (); + +/* SCSI controller driver support functions (not callable by applications) */ + +extern int scsiIdentMsgBuild (); +extern SCSI_IDENT_STATUS scsiIdentMsgParse (); + +extern STATUS scsiMsgInComplete (); +extern STATUS scsiMsgOutComplete (); +extern void scsiMsgOutReject (); +extern void scsiSyncXferNegotiate (); +extern void scsiWideXferNegotiate (); + +extern void scsiMgr (); +extern STATUS scsiMgrEventNotify (); +extern void scsiMgrCtrlEvent (); +extern void scsiMgrBusReset (); +extern void scsiMgrThreadEvent (); +extern STATUS scsiMgrRequestExecute (); +extern void scsiMgrPhysDevTagInit (); +extern SCSI_THREAD *scsiMgrPhysDevActiveThreadFind (); + +extern void scsiBusResetNotify (); +extern STATUS scsiThreadInit (); +extern void scsiCacheSynchronize (); + + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ASMLANGUAGE */ +#endif /* __INCscsi2Libh */ diff --git a/h/scsiLib.h b/h/scsiLib.h new file mode 100644 index 0000000..1f81325 --- /dev/null +++ b/h/scsiLib.h @@ -0,0 +1,63 @@ +/* scsi2Lib.h - SCSI library header file */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,08may02,dat cplusplus protection SPR 74987 +01b,19aug95,jds added comments +01a,10oct94,jds merged for SCSI1 and SCSI2 compatability +*/ + +#ifndef __INCscsiLibh +#define __INCscsiLibh + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct scsifunctbl + { + FUNCPTR scsiCtrlInit; /* SCSI controller initialisation */ + FUNCPTR scsiBlkDevInit; /* Initialise a block device */ + FUNCPTR scsiBlkDevCreate; /* Create a block device */ + FUNCPTR scsiBlkDevShow; /* Show list of block devices */ + FUNCPTR scsiPhaseNameGet; /* Get the name of the SCSI phase */ + FUNCPTR scsiPhysDevCreate; /* Create a SCSI physical device */ + FUNCPTR scsiPhysDevDelete; /* Delete a SCSI physical device */ + FUNCPTR scsiPhysDevIdGet; /* Get the SCSI ID of the device */ + FUNCPTR scsiAutoConfig; /* Configure all devices on SCSI bus */ + FUNCPTR scsiShow; /* Show all configured SCSI devices */ + FUNCPTR scsiBusReset; /* Reset the SCSI bus */ + FUNCPTR scsiCmdBuild; /* Build a SCSI CDB */ + FUNCPTR scsiTransact; /* Transact an entire SCSI command */ + FUNCPTR scsiIoctl; /* SCSI I/O control operations */ + FUNCPTR scsiFormatUnit; /* Format a SCSI direct access dev */ + FUNCPTR scsiModeSelect; /* Issue a MODE_SELECT command */ + FUNCPTR scsiModeSense; /* Issue a MODE_SENSE command */ + FUNCPTR scsiReadCapacity; /* Issue a READ CAPACITY command */ + FUNCPTR scsiRdSecs; /* Read SCSI disk sectors */ + FUNCPTR scsiWrtSecs; /* Write SCSI disk sectors */ + FUNCPTR scsiTestUnitRdy; /* Issue a TEST_UNIT_READY command */ + FUNCPTR scsiInquiry; /* Issue an INQUIRY command */ + FUNCPTR scsiReqSense; /* Issue a REQUEST_SENSE command */ + } SCSI_FUNC_TBL; + +#ifdef __cplusplus +} +#endif + +/* The default is to include SCSI1 headers */ + +#ifndef INCLUDE_SCSI2 + +#include "scsi1Lib.h" + +#else + +#include "scsi2Lib.h" + +#endif + +#endif /* INCscsiLibh */ diff --git a/h/sdLib.h b/h/sdLib.h new file mode 100644 index 0000000..1f7ad18 --- /dev/null +++ b/h/sdLib.h @@ -0,0 +1,51 @@ +/* sdLib.h - shared data library header file */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,25oct04,gls made pVirtAddress a void ** +01h,11oct04,gls added mode parameter to sdOpen (SPR #101348) +01g,02oct04,gls moved sdLibInit() and sdShowInit() declarations to sdLibP.h +01f,29sep04,gls made physicalAddr parameter type off_t +01e,20jul04,gls added hookTblSize parameter to sdLibInit() +01d,01apr04,gls added sdLibInit() and sdShowInit() +01c,17feb04,gls fixed copyright +01b,11dec03,gls added functionality +01a,04nov03,kk written from AE 1.1 version +*/ + +#ifndef __INCsdLibh +#define __INCsdLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "vwModNum.h" +#include "sdLibCommon.h" + +/* functional API to the library */ + +SD_ID sdCreate (char * name, + int options, + UINT32 size, + off_t64 physAddress, + MMU_ATTR attr, + void ** pVirtAddress); + +SD_ID sdOpen (char * name, + int options, + int mode, + UINT32 size, + off_t64 physAddress, + MMU_ATTR attr, + void ** pVirtAddress); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCsdLibh */ diff --git a/h/sdLibCommon.h b/h/sdLibCommon.h new file mode 100644 index 0000000..00a0036 --- /dev/null +++ b/h/sdLibCommon.h @@ -0,0 +1,153 @@ +/* sdLibCommon.h - common shared data library header file */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,24nov04,zl added text coherency option. +01i,14oct04,gls added SD_CACHE_COHERENCY and SD_CACHE_GUARDED +01h,11oct04,gls added include of objLibCommon.h +01g,28sep04,gls moved sdOpen and sdCreate definitions to sdLib.h +01f,24sep04,gls SD attribute maintenance +01e,19jul04,gls added hook add/delete routines (SPR #98361) +01d,06apr04,gls added support for sdInfoGet() +01c,29mar04,gls added include of vmLibCommon.h (SPR #95051) +01b,17feb04,gls cleaned up +01a,23jan04,gls created based on sdLib.h +*/ + +#ifndef __INCsdLibCommonh +#define __INCsdLibCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "vmLibCommon.h" +#include "objLibCommon.h" +#include "vwModNum.h" + +/* errno values */ + +#define S_sdLib_NOT_IMPLEMENTED (M_sdLib | 1) +#define S_sdLib_NAME_NOT_VALID (M_sdLib | 2) +#define S_sdLib_VIRT_PAGES_NOT_AVAILABLE (M_sdLib | 3) +#define S_sdLib_PHYS_PAGES_NOT_AVAILABLE (M_sdLib | 4) +#define S_sdLib_ARG_LIST_IS_NULL (M_sdLib | 5) +#define S_sdLib_VIRT_ADDR_PTR_IS_NULL (M_sdLib | 6) +#define S_sdLib_SIZE_IS_NULL (M_sdLib | 7) +#define S_sdLib_INVALID_OPTIONS (M_sdLib | 8) +#define S_sdLib_INVALID_MMU_ATTR (M_sdLib | 9) +#define S_sdLib_NOT_MAPPED (M_sdLib | 10) +#define S_sdLib_ADDR_NOT_ALIGNED (M_sdLib | 11) +#define S_sdLib_CLIENT_COUNT_NOT_NULL (M_sdLib | 12) +#define S_sdLib_INVALID_SD_ID (M_sdLib | 13) +#define S_sdLib_SD_IS_PRIVATE (M_sdLib | 14) +#define S_sdLib_PHYS_ADDR_OUT_OF_RANGE (M_sdLib | 15) + +/* defines */ + +#define VX_SD_NAME_LENGTH 31 /* max name length for diplay */ + +/* SD_ATTR definitions */ + +#define SD_ATTR_RW (MMU_ATTR_SUP_RW | MMU_ATTR_USR_RW | \ + MMU_ATTR_VALID) + +#define SD_ATTR_RO (MMU_ATTR_SUP_RO | MMU_ATTR_USR_RO | \ + MMU_ATTR_VALID) + +#define SD_ATTR_RWX (MMU_ATTR_SUP_RWX | MMU_ATTR_USR_RWX | \ + MMU_ATTR_VALID) + +#define SD_ATTR_RX (MMU_ATTR_SUP_EXE | MMU_ATTR_USR_EXE | \ + MMU_ATTR_SUP_RO | MMU_ATTR_USR_RO | \ + MMU_ATTR_VALID) + +#define SD_CACHE_COPYBACK (MMU_ATTR_CACHE_COPYBACK) +#define SD_CACHE_WRITETHROUGH (MMU_ATTR_CACHE_WRITETHRU) +#define SD_CACHE_OFF (MMU_ATTR_CACHE_OFF) +#define SD_CACHE_DEFAULT (MMU_ATTR_CACHE_DEFAULT) +#define SD_CACHE_COHERENCY (MMU_ATTR_CACHE_COHERENCY) +#define SD_CACHE_GUARDED (MMU_ATTR_CACHE_GUARDED) + +/* reserved attributes */ + +#define SD_CACHE_TEXT_UPDATE 0x80000000 + +/* Options */ + +#define SD_LINGER 0x00000001 /* SD stays after last client exits */ +#define SD_PRIVATE 0x00000002 /* SD is private to an application */ + + +typedef struct sd_desc /* SD_DESC - information structure */ + { + char name[VX_SD_NAME_LENGTH+1]; /* name of SD */ + int options; /* options, e.g. SD_LINGER, SD_PRIVATE */ + MMU_ATTR defaultAttr; /* default attributes of SD */ + MMU_ATTR currentAttr; /* current attributes of SD */ + UINT size; /* size of SD */ + VIRT_ADDR startAddr; /* start address of SD */ + } SD_DESC; + +/* typedefs for Shared Data hook functions */ + +typedef void (* SD_CREATE_HOOK) (const SD_ID); +typedef void (* SD_DELETE_HOOK) (const SD_ID); +typedef STATUS (* SD_GENERIC_HOOK) (void *, int); + +typedef enum sd_routines { + SD_HOOK_TYPE_MSK = 0x00000001, + SD_HOOK_ID = 0x00000000, + SD_HOOK_NAME = 0x00000001, + SD_HOOK_ROUTINE_MSK = 0x0000000e, + SD_HOOK_CREATE = 0x00000002, + SD_HOOK_OPEN = 0x00000004, + SD_HOOK_DELETE = 0x00000006, + SD_HOOK_MAP = 0x00000008, + SD_HOOK_UNMAP = 0x0000000a, + SD_HOOK_PROTECT = 0x0000000c +} SD_HOOK_OPTIONS; + + +/* functional API to the library */ + +STATUS sdDelete (SD_ID sdId, + int options); + +VIRT_ADDR sdMap (SD_ID sdId, + MMU_ATTR attr, + int options); + +STATUS sdUnmap (SD_ID sdId, + int options); + +STATUS sdProtect (SD_ID sdId, + MMU_ATTR attr); + +STATUS sdInfoGet (SD_ID sdId, + SD_DESC * pSdStruct); + +STATUS sdCreateHookAdd (SD_CREATE_HOOK sdCreateHook, + BOOL addToHead); + +STATUS sdCreateHookDelete (SD_CREATE_HOOK sdCreateHook); + +STATUS sdDeleteHookAdd (SD_DELETE_HOOK sdDeleteHook, + BOOL addToHead); + +STATUS sdDeleteHookDelete (SD_DELETE_HOOK sdDeleteHook); + +STATUS sdGenericHookAdd (SD_GENERIC_HOOK sdGenericHook, + BOOL addToHead); + +STATUS sdGenericHookDelete (SD_GENERIC_HOOK sdGenericHook); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCsdLibCommonh */ diff --git a/h/selectLib.h b/h/selectLib.h new file mode 100644 index 0000000..853a3c6 --- /dev/null +++ b/h/selectLib.h @@ -0,0 +1,104 @@ +/* selectLib.h - select header file */ + +/* + * Copyright (c) 1991-1994, 2000-2001, 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +02h,17aug05,mcm Using sys/time.h for RTP space. +02g,25mar04,mcm Including time.h instead of sys/time.h in user-space +02f,10dec03,dat adding SELEXCEPT select type +02e,12nov03,dat modifications for RTP support +02d,18sep01,aeg added selWakeupListTerm(); moved private definitions to + private/selectLibP.h; added S_selectLib_NO_SELECT_CONTEXT + and S_selectLib_WIDTH_OUT_OF_RANGE error codes. +02c,22sep92,rrr added support for c++ +02b,19aug92,smb changed systime.h to sys/times.h +02a,04jul92,jcf cleaned up. +01k,26may92,rrr the tree shuffle +01j,04oct91,rrr passed through the ansification filter + -removed comma from end of enum + -changed includes to have absolute path from h/ + -changed VOID to void + -changed copyright notice +01i,25oct90,dnw changed utime.h to systime.h. +01h,19oct90,shl added #include of "utime.h". +01g,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01f,07aug90,shl added function declarations comment. +01e,01aug90,jcf clean up. +01d,13jul90,rdc added original read and write fd_sets to wakeup node struct. +01c,30apr90,gae added HIDDEN comments to internal data structures. +01b,20mar90,jcf cleanup. +01a,26jan90,rdc written +*/ + +#ifndef __INCselectLibh +#define __INCselectLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef _WRS_KERNEL +# include +#else +# include +#endif + +/* error codes are shared */ + +#define S_selectLib_NO_SELECT_SUPPORT_IN_DRIVER (M_selectLib | 1) +#define S_selectLib_NO_SELECT_CONTEXT (M_selectLib | 2) +#define S_selectLib_WIDTH_OUT_OF_RANGE (M_selectLib | 3) + +#ifdef _WRS_KERNEL + +/* Only the kernel defines the driver support routines */ + +typedef enum + { + SELREAD, + SELWRITE, + SELEXCEPT + } SELECT_TYPE; + +#include "private/selectLibP.h" + +extern SELECT_TYPE selWakeupType (SEL_WAKEUP_NODE *pWakeupNode); +extern STATUS selNodeAdd (SEL_WAKEUP_LIST *pWakeupList, + SEL_WAKEUP_NODE *pWakeupNode); +extern STATUS selNodeDelete (SEL_WAKEUP_LIST *pWakeupList, + SEL_WAKEUP_NODE *pWakeupNode); +extern int selWakeupListLen (SEL_WAKEUP_LIST *pWakeupList); +extern void selWakeup (SEL_WAKEUP_NODE *pWakeupNode); +extern void selWakeupAll (SEL_WAKEUP_LIST *pWakeupList, + SELECT_TYPE type); +extern void selWakeupListInit (SEL_WAKEUP_LIST *pWakeupList); +extern void selWakeupListTerm (SEL_WAKEUP_LIST *pWakeupList); + +#endif /* _WRS_KERNEL */ + +/* In user space, the select API comes from the POSIX header sys/select.h */ +#ifdef _WRS_KERNEL +extern int select (int width, fd_set *pReadFds, + fd_set *pWriteFds, fd_set *pExceptFds, + struct timeval *pTimeOut); +#else +#include +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCselectLibh */ diff --git a/h/semEvLib.h b/h/semEvLib.h new file mode 100644 index 0000000..6f15d3d --- /dev/null +++ b/h/semEvLib.h @@ -0,0 +1,44 @@ +/* semEvLib.h - semaphore events library header file */ + +/* Copyright 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,20sep01.bwa Initial creation. +*/ + +#ifndef __INCsemEvLibh +#define __INCsemEvLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "semLib.h" + +#ifndef _ASMLANGUAGE + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS semEvStart (SEM_ID semId, UINT32 events, UINT8 options); +extern STATUS semEvStop (SEM_ID semId); + +#else /* __STDC__ */ + +extern STATUS semEvStart (); +extern STATUS semEvStop (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsemEvLibh */ + diff --git a/h/semLib.h b/h/semLib.h new file mode 100644 index 0000000..9da83af --- /dev/null +++ b/h/semLib.h @@ -0,0 +1,211 @@ +/* semLib.h - semaphore library header file */ + +/* + * Copyright (c) 1990-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +04p,07oct05,yvp Used VX_OBJ_ALIGN_SIZE to align statically instantiated + objects (SPR 113405). +04o,30aug05,yvp Reworked VX_SEMAPHORE macro to undo struct workaround. +04n,08aug05,yvp Added VX_SEMAPHORE macro for static semaphore instantiation. + Added prototypes for semXInitialize(). Copyright update. + #include now with angle brackets. +04m,26oct04,fr added semOpenInit() routine (SPR 101491) +04l,08mar04,aeg removed Diab _WRS_DEPRECATED C++ workaround. +04k,02mar04,aeg deprecated semOLib APIs. +04j,25nov03,aeg added semInfo() function prototype from semLibCommon.h. +04i,21aug03,dcc moved common definitions with user side to semLibCommon.h. +04h,20jun03,ymz updated year of copyright. +04g,14mar03,dcc moved SEM_ID definition to types/vxWind.h. +04f,19oct01,bwa Added SEM_EVENTSEND_ERR_NOTIFY option. +04e,16feb98,cdp added #ifndef _ASMLANGUAGE. +04d,10jul96,dbt added declaration of semMGiveForce (SPR #4352). + Updated copyright. +03c,14jul94,dvs added non-ANSI prototype for semCreate/semOLibInit (SPR# 2648). +03b,22sep92,rrr added support for c++. +03a,04jul92,jcf cleaned up. +02k,26may92,rrr the tree shuffle. +02j,18apr92,jmm added prototype for semTerminate. +02i,19nov91,rrr shut up some ansi warnings. +02h,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +02g,10jun91.del added pragma for gnu960 alignment. +02f,16oct90,shl made #else ANSI style. +02e,05oct90,dnw deleted private functions; doc tweaks +02d,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +02c,27jun90,jcf added defines for optimized version. +02a,26jun90,jcf rewritten to provide binary/counting/mutex w/ one structure. + introduced semaphore options. + removed generic status codes. +01a,02jan90,jcf written. +*/ + +#ifndef __INCsemLibh +#define __INCsemLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + + +/* semaphore options */ + +#define SEM_Q_MASK 0x03 /* q-type mask */ + + +#ifndef _ASMLANGUAGE + +/* macro used to statically declare semaphores */ + +#define VX_SEMAPHORE(name) \ + _WRS_DATA_ALIGN_BYTES(VX_OBJ_ALIGN_SIZE) char name [VX_SEMAPHORE_SIZE]; + + +/******************************************************************************* +* +* VX_BINARY_SEMAPHORE - declare storage for a binary semaphore +* +* This macro declares storage for a binary semaphore having name . +* This macro only generates data declarations for the binary semaphore. +* To fully instantiate the semaphore and make it ready for use, function +* semBInitialize() must be called after using this macro. This macro is +* useful for declaring semaphores statically (i.e. at compile time, without +* using any dynamic memory allocation at runtime). +* +* Sample usage of this macro is as follows: +* \cs +* #include +* #include +* +* VX_BINARY_SEMAPHORE(mySemB); /@ declare the semaphore @/ +* SEM_ID mySemBId; /@ semaphore ID for further operations @/ +* +* STATUS initializeFunction (void) +* { +* if ((mySemBId = semBInitialize (mysemB, options, 0)) == NULL) +* return (ERROR); /@ initialization failed @/ +* else +* return (OK); +* } +* \ce +* +* SEE ALSO: semCInitialize(), semMInitialize() +* \NOMANUAL +*/ + +#define VX_BINARY_SEMAPHORE VX_SEMAPHORE + + +/******************************************************************************* +* +* VX_COUNTING_SEMAPHORE - declare storage for a counting semaphore +* +* This macro declares storage for a counting semaphore having name . +* This macro only generates data declarations for the counting semaphore. +* To fully instantiate the semaphore and make it ready for use, function +* semCInitialize() must be called after using this macro. This macro is +* useful for declaring semaphores statically (i.e. at compile time, without +* using any dynamic memory allocation at runtime). +* +* Sample usage of this macro is as follows: +* \cs +* #include +* #include +* +* VX_COUNTING_SEMAPHORE(mySemC); /@ declare the semaphore @/ +* SEM_ID mySemCId; /@ semaphore ID for further operations @/ +* +* STATUS initializeFunction (void) +* { +* if ((mySemCId = semCInitialize (mysemC, options, 0)) == NULL) +* return (ERROR); /@ initialization failed @/ +* else +* return (OK); +* } +* \ce +* +* SEE ALSO: semBInitialize(), semMInitialize() +* \NOMANUAL +*/ + +#define VX_COUNTING_SEMAPHORE VX_SEMAPHORE + + +/******************************************************************************* +* +* VX_MUTEX_SEMAPHORE - declare storage for a mutual exclusion semaphore +* +* This macro declares storage for a mutex semaphore having name . +* This macro only generates data declarations for the mutex semaphore. +* To fully instantiate the semaphore and make it ready for use, function +* semMInitialize() must be called after using this macro. This macro is +* useful for declaring semaphores statically (i.e. at compile time, without +* using any dynamic memory allocation at runtime). +* +* Sample usage of this macro is as follows: +* \cs +* #include +* #include +* +* VX_MUTEX_SEMAPHORE(mySemM); /@ declare the semaphore @/ +* SEM_ID mySemMId; /@ semaphore ID for further operations @/ +* +* STATUS initializeFunction (void) +* { +* if ((mySemMId = semMInitialize (mySemM, options, 0)) == NULL) +* return (ERROR); /@ initialization failed @/ +* else +* return (OK); +* } +* \ce +* +* SEE ALSO: semBInitialize(), semCInitialize() +* \NOMANUAL +*/ + +#define VX_MUTEX_SEMAPHORE VX_SEMAPHORE + + +/* function declarations */ + +extern STATUS semBLibInit (void); +extern STATUS semCLibInit (void); +extern STATUS semMLibInit (void); +extern void semOpenInit (void); +extern STATUS semMGiveForce (SEM_ID semId); +extern SEM_ID semBInitialize (char * pSemMem, int options, + SEM_B_STATE initialState); +extern SEM_ID semCInitialize (char * pSemMem, int options, + int initialCount); +extern SEM_ID semMInitialize (char * pSemMem, int options); + +/* workaround Diab handling of deprecated attribute in C++ */ + +extern STATUS semOLibInit (void) _WRS_DEPRECATED ("please use semBLib instead"); +extern SEM_ID semCreate (void) _WRS_DEPRECATED ("please use semBLib instead"); +extern void semShowInit (void); +extern STATUS semShow (SEM_ID semId, int level); +extern int semInfo (SEM_ID semId, int idList[], int maxTasks); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsemLibh */ diff --git a/h/semLibCommon.h b/h/semLibCommon.h new file mode 100644 index 0000000..0fcb743 --- /dev/null +++ b/h/semLibCommon.h @@ -0,0 +1,152 @@ +/* semLibCommon.h - common semaphore library header file */ + +/* + * Copyright (c) 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. +*/ + +/* +modification history +-------------------- +01k,03aug05,gls added read/write semaphore support +01j,05apr05,kk added OPTIONS_MASK for each type of semaphore +01i,02sep04,bwa added S_semLib_INVALID_INITIAL_COUNT/COUNT_OVERFLOW errnos. +01h,04may04,cjj modified SEM_INFO struct. Removed semInfo prototype. +01g,23apr04,dcc added "context" to semOpen() parameters +01f,11mar04,dcc added semClose() and semUnlink() prototypes. +01e,30mar04,ans added SEM_INTERRUPTIBLE semaphore option +01d,05nov03,md added user level semaphores +01c,25nov03,aeg added SEM_INFO structure definition. +01b,05sep03,dcc added SEM_TYPE_OLD to the SEM_TYPE enum. +01a,26aug03,cjj written based on kernel version 04h of semLib.h +*/ + +#ifndef __INCsemLibCommonh +#define __INCsemLibCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +/* generic status codes */ + +#define S_semLib_INVALID_STATE (M_semLib | 101) +#define S_semLib_INVALID_OPTION (M_semLib | 102) +#define S_semLib_INVALID_QUEUE_TYPE (M_semLib | 103) +#define S_semLib_INVALID_OPERATION (M_semLib | 104) +#define S_semLib_INVALID_INITIAL_COUNT (M_semLib | 105) +#define S_semLib_COUNT_OVERFLOW (M_semLib | 106) + +/* semaphore options */ + +#define SEM_Q_FIFO 0x00 /* first in first out queue */ +#define SEM_Q_PRIORITY 0x01 /* priority sorted queue */ +#define SEM_DELETE_SAFE 0x04 /* owner delete safe (mutex opt.) */ +#define SEM_INVERSION_SAFE 0x08 /* no priority inversion (mutex opt.) */ +#define SEM_EVENTSEND_ERR_NOTIFY 0x10 /* notify when eventRsrcSend fails */ +#define SEM_INTERRUPTIBLE 0x20 /* interruptible on RTP signal */ + +/* option masks for the types of semaphores */ + +#if !defined (_WRS_KERNEL) + +#define SEM_BIN_OPTIONS_MASK (SEM_Q_FIFO | \ + SEM_Q_PRIORITY | \ + SEM_EVENTSEND_ERR_NOTIFY | \ + SEM_INTERRUPTIBLE | \ + SEM_KUTYPE_MASK) + +#else +#define SEM_BIN_OPTIONS_MASK (SEM_Q_FIFO | \ + SEM_Q_PRIORITY | \ + SEM_EVENTSEND_ERR_NOTIFY | \ + SEM_INTERRUPTIBLE) +#endif /* !_WRS_KERNEL */ + +#define SEM_CNT_OPTIONS_MASK SEM_BIN_OPTIONS_MASK + +#define SEM_MUT_OPTIONS_MASK (SEM_BIN_OPTIONS_MASK | \ + SEM_DELETE_SAFE | \ + SEM_INVERSION_SAFE) + +#ifndef _ASMLANGUAGE + +/* semaphore types */ + +typedef enum /* SEM_TYPE */ + { + SEM_TYPE_BINARY, /* 0: binary semaphore */ + SEM_TYPE_MUTEX, /* 1: mutual exclusion semaphore */ + SEM_TYPE_COUNTING, /* 2: counting semaphore */ + SEM_TYPE_OLD, /* 3: 4.x style semaphore (not in user space) */ + SEM_TYPE_RW, /* 4: read/write semaphore (not in user space) */ + + /* + * Add new semaphore types above this one. Only 8 types + * are allowed without making major modifications to the + * kernel + */ + SEM_TYPE_MAX = 8 + } SEM_TYPE; + +/* binary semaphore initial state */ + +typedef enum /* SEM_B_STATE */ + { + SEM_EMPTY, /* 0: semaphore not available */ + SEM_FULL /* 1: semaphore available */ + } SEM_B_STATE; + +/* + * Information structure filled by semInfoGet. The taskIdListMax + * and taskIdList information is not provided in user land. + */ + +typedef struct /* SEM_INFO */ + { + UINT numTasks; /* OUT: number of blocked tasks */ + SEM_TYPE semType; /* OUT: semaphore type */ + int options; /* OUT: options with which sem was created */ + union + { + UINT count; /* OUT: semaphore count (couting sems) */ + BOOL full; /* OUT: binary semaphore FULL? */ + int owner; /* OUT: task ID of mutex semaphore owner */ + } state; +#ifdef _WRS_KERNEL + int taskIdListMax; /* IN: max tasks to fill in taskIdList */ + int * taskIdList; /* PTR: array of pending task IDs */ +#endif /* _WRS_KERNEL */ + } SEM_INFO; + + +/* function declarations */ + +extern SEM_ID semMCreate (int options); +extern SEM_ID semBCreate (int options, SEM_B_STATE initialState); +extern SEM_ID semCCreate (int options, int initialCount); +extern STATUS semDelete (SEM_ID semId); +extern STATUS semFlush (SEM_ID semId); +extern STATUS semGive (SEM_ID semId); +extern STATUS semTake (SEM_ID semId, int timeout); +extern SEM_ID semOpen (const char * name, SEM_TYPE type, + int initState, int options, int mode, + void * context); +extern STATUS semInfoGet (SEM_ID semId, SEM_INFO *pInfo); +extern STATUS semClose (SEM_ID semId); +extern STATUS semUnlink (const char * name); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsemLibCommonh */ diff --git a/h/semPxShow.h b/h/semPxShow.h new file mode 100644 index 0000000..d7d01a8 --- /dev/null +++ b/h/semPxShow.h @@ -0,0 +1,39 @@ +/* semPxShow.h - posix semaphore show routines */ + +/* Copyright 1984-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,06apr93,smb written +*/ + +#ifndef __INCsemPxShowh +#define __INCsemPxShowh + +#include "semaphore.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS semPxShow (sem_t * semDesc, int level); +extern STATUS semPxShowInit (void); + +#else /* __STDC__ */ + +extern STATUS semPxShow (); +extern STATUS semPxShowInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsemPxShowh*/ diff --git a/h/semSmLib.h b/h/semSmLib.h new file mode 100644 index 0000000..04e217b --- /dev/null +++ b/h/semSmLib.h @@ -0,0 +1,47 @@ +/* semSmLib.h - shared semaphore library header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01d,29sep92,pme changed semSm[BC]Create to sem[BC]SmCreate. +01c,22sep92,rrr added support for c++ +01b,28jul92,pme added #include "semLib.h". +01a,19jul92,pme written. +*/ + +#ifndef __INCsemSmLibh +#define __INCsemSmLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" +#include "semLib.h" +#include "smDllLib.h" + + +typedef struct sm_semaphore * SM_SEM_ID; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern SEM_ID semBSmCreate (int options, SEM_B_STATE initialState); +extern SEM_ID semCSmCreate (int options, int initialCount); +extern void semSmShowInit (); + +#else /* __STDC__ */ + +extern SEM_ID semBSmCreate (); +extern SEM_ID semCSmCreate (); +extern void semSmShowInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsemSmLibh */ diff --git a/h/semaphore.h b/h/semaphore.h new file mode 100644 index 0000000..b37dab1 --- /dev/null +++ b/h/semaphore.h @@ -0,0 +1,60 @@ +/* semaphore.h - header for POSIX 1003.1b semaphore synchronization */ + +/* + * Copyright (c) 1993-1994, 1999, 2003, 2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01h,22aug05,kk moved kernel specific protoypes here +01g,02aug05,kk move SEM_NSEMS_MAX SEM_VALUE_MAX from semaphoreCommon.h to here +01f,05dec03,m_s code-inspection changes +01e,310ct03,m_s moved the descriptor structure to private header file + ported to Base 6 +01d,12mar99,elg include private header to get semPxLibInit() (SPR 20532). +01c,08apr94,dvs added pragma for gnu960 alignment. +01b,05jan94,kdl changed sem_t "close" field to "refCnt"; general cleanup. +01a,06apr93,smb written +*/ + +#ifndef __INCsemaphoreh +#define __INCsemaphoreh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +/* defines */ + +/* typedefs */ + +/* the semaphore descriptor for kernel apps */ + +typedef void * sem_t; + + +/* include the common header file after defining the semaphore descriptor */ + +#include "semaphoreCommon.h" + +#define SEM_VALUE_MAX 100 /* maximum value to initialize a semaphore */ +#define SEM_NSEMS_MAX 100 /* maximum number of semaphores in the system */ + +/* function declarations */ + +/* others are in semaphoreCommon.h */ + +extern int sem_init (sem_t *, int, unsigned int); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsemaphoreh */ diff --git a/h/semaphoreCommon.h b/h/semaphoreCommon.h new file mode 100644 index 0000000..a2e8b80 --- /dev/null +++ b/h/semaphoreCommon.h @@ -0,0 +1,58 @@ +/* semaphoreCommon.h - POSIX usr/kernel shared semaphore header file */ + +/* + * Copyright (c) 2003, 2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01d,22aug05,kk moved sem_init() to RTP and kernel specific semaphore.h files +01c,02aug05,kk move SEM_NSEMS_MAX and SEM_VALUE_MAX into kernel + semaphore.h, user side has these in limits.h +01b,18nov03,m_s code-inspection changes +01a,31oct03,m_s Written +*/ + +#ifndef __INCsemaphoreCommonh +#define __INCsemaphoreCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "fcntl.h" +#include "limits.h" + +/* defines */ + +#define SEM_FAILED ((sem_t *) ERROR) /* failure for sem_open */ + +#undef _POSIX_NO_TRUNC /* do not limit pathname length */ + +/* typedefs */ + +/* function declarations */ + +/* sem_init() is in semaphore.h */ + +extern int sem_destroy (sem_t *); +extern sem_t * sem_open (const char *, int, ...); +extern int sem_close (sem_t *); +extern int sem_unlink (const char *); +extern int sem_wait (sem_t *); +extern int sem_trywait (sem_t *); +extern int sem_post (sem_t *); +extern int sem_getvalue (sem_t *, int *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsemaphoreCommonh */ diff --git a/h/seqIo.h b/h/seqIo.h new file mode 100644 index 0000000..46739b4 --- /dev/null +++ b/h/seqIo.h @@ -0,0 +1,57 @@ +/* seqIo.h - Sequential I/O header file */ + +/* Copyright 1984-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,17jul95,jds written +*/ + +#ifndef __INCseqIoh +#define __INCseqIoh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + +typedef struct /* SEQ_DEV */ + { + FUNCPTR sd_seqRd; /* function to read blocks */ + FUNCPTR sd_seqWrt; /* function to write blocks */ + FUNCPTR sd_ioctl; /* function to ioctl device */ + FUNCPTR sd_seqWrtFileMarks; /* function to write f-marks */ + FUNCPTR sd_rewind; /* function to rewind device */ + FUNCPTR sd_reserve; /* function to reserve dev */ + FUNCPTR sd_release; /* function to release dev */ + FUNCPTR sd_readBlkLim; /* function to read blk lims */ + FUNCPTR sd_load; /* function to load device */ + FUNCPTR sd_space; /* function to space device */ + FUNCPTR sd_erase; /* function to erase device */ + FUNCPTR sd_reset; /* function to reset device */ + FUNCPTR sd_statusChk; /* function to check status */ + int sd_blkSize; /* block size for device */ + int sd_mode; /* O_RDONLY or O_WRONLY */ + BOOL sd_readyChanged; /* indicates medium change */ + int sd_maxVarBlockLimit; /* maximum variable blk size */ + int sd_density; /* density of seq device */ + } SEQ_DEV; + + +/* tapeFsLib ioctls */ + +#define FIOBLKSIZESET 1000 /* ioctl to set block size */ +#define FIOBLKSIZEGET 1001 /* ioctl to get block size */ +#define FIODENSITYSET 1002 /* ioctl to set tape density */ +#define FIODENSITYGET 1003 /* ioctl to get tape density */ +#define FIOERASE 1004 /* ioctl to erase tape */ +#define MTIOCTOP 1005 /* MTIO ioctl */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCseqIoh */ diff --git a/h/setLib.h b/h/setLib.h new file mode 100644 index 0000000..57a7e02 --- /dev/null +++ b/h/setLib.h @@ -0,0 +1,87 @@ +/* setLib.h - header file for Wind Object Sets */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,12dec02,dat node is a tuple, not a single +01e,14oct02,dat 5.X compatibility +01d,18apr01,cjj mods for FHA 1.0 code inspection +01c,27nov00,cjj moved OBJ_SET definition to setLibP.h +01b,14jul99,mas added define of SET_BAD for DMS. +01a,04aug98,mas original version. TOR 1.0.1/VXW 5.3 compliant. +*/ + +/* +DESCRIPTION +This file contains the public configuration parameters and macros for the Wind +Object Set library. + +A set is an object containing a collection of objects with no implied order +although application-specific ordering may be enforced through other libraries. +A set may have any number of objects. A set may contain other sets. A set +with no objects is a null set. Sets have no size restrictions other than +available memory. + +Objects are referenced by a set, never included directly. This allows objects +to be independent of set implementation and target architecture variations. +*/ + +#ifndef INCsetLibh +#define INCsetLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes */ + +#include "vxWorks.h" +#include "vwModNum.h" +#include "objLib.h" /* The set itself is an object */ +#include "semLib.h" +#include "lstLib.h" + +/* defines */ + +/* status codes */ + +#define S_setLib_LIB_INIT (M_setLib | 1) /* set lib already initialized*/ +#define S_setLib_LIB_NOT_INIT (M_setLib | 2) /* set lib not initialized */ +#define S_setLib_ARG_NOT_VALID (M_setLib | 3) /* invalid input arg(s) */ +#define S_setLib_OBJ_NOT_IN_SET (M_setLib | 4) /* obj not from given set */ + +/* Typedefs */ + +typedef struct setObj * SET_ID; +typedef void * SET_ITEM; + + +/* Function Prototypes */ + +STATUS setLibInit (void); +SET_ID setCreate (void); + +STATUS setInit (SET_ID setId); +STATUS setDelete (SET_ID setId); +STATUS setDestroy (SET_ID setId, BOOL dealloc); +SET_ID setDuplicate (SET_ID setId); +STATUS setTerminate (SET_ID setId); +STATUS setItemAdd (SET_ID setId, SET_ITEM itemId); +STATUS setItemDelete (SET_ID setId, SET_ITEM itemId); +SET_ITEM setItemFirst (SET_ID setId); +SET_ITEM setItemLast (SET_ID setId); +SET_ITEM setItemNext (SET_ID setId); +SET_ITEM setItemPrev (SET_ID setId); +STATUS setItemEach (SET_ID setId, STATUS (*pFunc)(SET_ITEM,int), int arg); +STATUS setLock (SET_ID setId, int semWait); +STATUS setUnlock (SET_ID setId); +ULONG setSize (SET_ID setId); +BOOL setIsNull (SET_ID setId); + +#ifdef __cplusplus +} +#endif + +#endif /* INCsetLibh */ diff --git a/h/setjmp.h b/h/setjmp.h new file mode 100644 index 0000000..bbec7bd --- /dev/null +++ b/h/setjmp.h @@ -0,0 +1,79 @@ +/* setjmp.h - setjmp/longjmp header */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02k,16feb04,m_s added excCnt to jump buffer +02j,09jul96,ms fixed prototype of sigsetjmp (SPR 7002). +02i,27dec95,mem removed macros for VxSim hppa +02h,27mar95,kkk fixed multiple definition of jmp_buf & sigjmp_buf (SPR 4051) +02g,31mar94,cd modified jmp_buf and sigjmp_buf structures for use + with 32/64 bit processors. +02g,12may94,ms added macros for VxSim hppa +02f,22sep92,rrr added support for c++ +02e,31aug92,rrr added setjmp +02d,10jul92,rrr set it up to use the new signal code. One more pass is needed + to make it ANSI. +02c,09jul92,jwt removed structure version of jmp_buf for SPARC - merge error. +02b,09jul92,rrr fixed sparc from having two typedefs for jmp_buf +02a,04jul92,jcf cleaned up. +01l,26may92,rrr the tree shuffle +01k,09jan92,jwt converted CPU==SPARC to CPU_FAMILY==SPARC. +01j,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01i,20jul91,jwt modified jmp_buf for SPARC; added #ifndef _ASMLANGUAGE. +01h,02aug91,ajm added defines and macros for MIPS architecture. +01g,29apr91,hdn added defines and macros for TRON architecture. +01f,20apr91,del added I960 specifics. +01e,19oct90,shl changed IMPORT to extern for ANSI compatibility, + fixed wrong type definition for longjmp(). +01d,05oct90,shl added ANSI function prototypes. + added copyright notice. + made #endif ANSI style. +01c,25aug88,ecs added SPARC version of jmp_buf. +01b,01jul88,rdc changed order of stuff in jmp_buf. +01a,22jun88,dnw written +*/ + +#ifndef __INCsetjmph +#define __INCsetjmph + +#ifdef __cplusplus +extern "C" { +#endif + +#include "regs.h" + +typedef struct _jmp_buf + { + REG_SET reg; + int excCnt; + int extra[3]; + } jmp_buf[1]; + +typedef struct _sigjmp_buf + { + REG_SET regs; + int excCnt; + int extra[3]; + } sigjmp_buf[1]; + + +/* function declarations */ + +extern int setjmp (jmp_buf __env); +extern void longjmp (jmp_buf __env, int __val); + +extern int sigsetjmp (sigjmp_buf __env, int __savemask); +extern void siglongjmp (sigjmp_buf __env, int __val); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsetjmph */ diff --git a/h/shellConfigLib.h b/h/shellConfigLib.h new file mode 100644 index 0000000..0fe481c --- /dev/null +++ b/h/shellConfigLib.h @@ -0,0 +1,62 @@ +/* shellConfigLib.h - header for the shell configuration management module */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,03aug04,bpn Simplified APIs. +01c,15apr04,bpn Added shellConfigGet2(). +01b,07apr04,bpn Added shellConfigValueGet2() prototype. +01a,29oct03,bpn Written. +*/ + +#ifndef __INCshellConfigLibh +#define __INCshellConfigLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes */ + +#ifdef HOST +#include +#endif + +#include + +/* Defines */ + +/* Possible errnos */ + +/* Structures */ + +/* Function declarations */ + +extern STATUS shellConfigDefaultSet (const char * config); +extern STATUS shellConfigSet (SHELL_ID shellId, const char * config); +extern char * shellConfigDefaultGet (void); +extern char * shellConfigGet (SHELL_ID shellId); + +extern STATUS shellConfigDefaultValueSet (const char * name, + const char * value); +extern STATUS shellConfigValueSet (SHELL_ID shellId, const char * name, + const char * value); + +extern const char * shellConfigDefaultValueGet (const char * name); +extern const char * shellConfigValueGet (SHELL_ID shellId, + const char * name); + +extern void shellConfigDefaultValueUnset (const char * name); +extern STATUS shellConfigValueUnset (SHELL_ID shellId, const char * name); + +#ifdef HOST +extern char ** shellConfigListGet (void); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCshellConfigLibh */ diff --git a/h/shellDataLib.h b/h/shellDataLib.h new file mode 100644 index 0000000..160b70e --- /dev/null +++ b/h/shellDataLib.h @@ -0,0 +1,62 @@ +/* shellDataLib.h - header for the shell data management module */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,23sep04,bpn Added SHELL_DATA_FUNCPTR definition. +01b,07apr04,bpn Modified shellDataFirst() and shellDataNext() API. +01a,28oct03,bpn Written. +*/ + +#ifndef __INCshellDataLibh +#define __INCshellDataLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes */ +#ifdef HOST +#include +#endif + +#include + +/* Defines */ + +/* Structures */ + +/* Typedefs */ + +typedef void (*SHELL_DATA_FUNCPTR) (SHELL_ID shellId, const char * key, + void * pData); + +/* Function declarations */ + +extern STATUS shellDataFromNameAdd (const char * taskName, + const char * key, void * pData, + SHELL_DATA_FUNCPTR finalizeRtn); + +extern STATUS shellDataAdd (SHELL_ID shellId, const char * key, + void * pData, SHELL_DATA_FUNCPTR finalizeRtn); + +extern void shellDataRemove (SHELL_ID shellId, const char * key, + BOOL finalize); + +extern STATUS shellDataFromNameGet (const char * taskName, + const char * key, void ** ppData); + +extern STATUS shellDataGet (SHELL_ID shellId, const char * key, + void ** ppData); + +extern SHELL_ID shellDataFirst (const char * key, void ** ppData); +extern SHELL_ID shellDataNext (const char * key, SHELL_ID shellId, + void ** ppData); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCshellDataLibh */ diff --git a/h/shellInterpCmdLib.h b/h/shellInterpCmdLib.h new file mode 100644 index 0000000..6cc0770 --- /dev/null +++ b/h/shellInterpCmdLib.h @@ -0,0 +1,103 @@ +/* shellInterpCmdLib.h - header file of the command interpreter library */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,09sep04,bpn Updated some APIs. +01g,28jul04,bpn Moved prototypes to shellInterpCmdLibP.h. +01f,11may04,bpn Added shellCmdPreParse() prototype. +01e,28jan04,bpn Added shellCmdTaskIdConvert(), shellCmdInfoGet() and + shellCmdLineConsume() prototypes. +01d,28jan04,bpn Added shellCmdSymTabIdGet() prototype. Removed shellCmdInit(). +01c,09oct03,bpn Added definitions for the alias related routines. +01b,22aug03,bpn Moved definitions to shellInternalLib.h and shellLib.h. +01a,22jul03,bpn Written. +*/ + +#ifndef __INCshellInterpCmdLibh +#define __INCshellInterpCmdLibh + +#ifndef HOST +#include +#include +#else +#include + +#ifndef SYMTAB_ID +#define SYMTAB_ID int /* XXX bpn - to change */ +#endif +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Defines */ + +#ifdef HOST +#define M_shellInterpCmdLib (174 << 16) +#endif + +#define SHELL_INTERP_CMD_NAME "Cmd" + +/* Size of the PIPE buffer used by the 'more' command */ + +#define SHELL_PIPE_BUFFER 256 + +#define S_shellInterpCmdLib_UNKNOWN_CMD (M_shellInterpCmdLib | 1) +#define S_shellInterpCmdLib_UNKNOWN_TOPIC (M_shellInterpCmdLib | 2) +#define S_shellInterpCmdLib_WRONG_CMD (M_shellInterpCmdLib | 3) + +/* Typedefs */ + +typedef struct shell_cmd /* a command description */ + { + const char * name; /* complete command name */ + FUNCPTR func; /* command routine */ + const char * opt; /* options string; may be NULL */ + const char * shortDesc; /* short description; may be NULL */ + const char * fullDesc; /* complete description; may be NULL */ + const char * synopsis; /* synopsis; may be NULL */ + } SHELL_CMD; + +typedef struct shell_cmd_alias /* a command alias */ + { + const char * alias; /* alias name */ + const char * string; /* replacement string */ + } SHELL_CMD_ALIAS; + +/* Functions */ + +extern STATUS shellCmdAdd (const char * topic, const SHELL_CMD * pShellCmd); +extern STATUS shellCmdArrayAdd (const char * topic, + const SHELL_CMD shellCmdArray[]); +extern STATUS shellCmdTopicAdd (const char * topic, const char * desc); +extern STATUS shellCmdAliasAdd (const char * aliasName, + const char * string, + BOOL allocate); +extern STATUS shellCmdAliasArrayAdd (const SHELL_CMD_ALIAS aliasArray[], + BOOL allocate); +extern STATUS shellCmdAliasDelete (const char * alias); +extern STATUS shellCmdPreParseAdd (const char * name, + char * (*preParseRtn) (char * line)); + +extern STATUS shellCmdStatementExec (const char * statement); +extern STATUS shellCmdExec (const char * name, const char * args); + +extern SYMTAB_ID shellCmdSymTabIdGet (SHELL_ID shellId); + +extern int shellCmdTaskIdConvert (const char * taskIdHandleName, + const char * errorStr); + +extern STATUS shellCmdMemRegister (void * pMem, BOOL shellPool); +extern STATUS shellCmdMemUnregister (void * pMem); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCshellInterpCmdLibh */ diff --git a/h/shellInterpLib.h b/h/shellInterpLib.h new file mode 100644 index 0000000..d0d1c9b --- /dev/null +++ b/h/shellInterpLib.h @@ -0,0 +1,86 @@ +/* shellInterpLib.h - header file for the interpreters management module */ + +/* Copyright 2003-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,08feb05,bpn Added dfltPrompt field to interpreter structure (SPR#106114). +01h,28jul04,bpn Added shellInterpCtxGet() prototypes. +01g,26feb04,bpn Added ctxRestart field to SHELL_INTERP. +01f,10feb04,lcs Add host routine to handle DFW asynchronous events. +01e,06nov03,bpn Added shellInterpDefaultNameGet() and shellInterpNameGet() + prototypes. +01d,24oct03,bpn Added completion field to SHELL_INTERP structure. +01c,23sep03,bpn Added prototypes of the initialization functions of the + C and command interpreters. +01b,24jun03,bpn Added history list to each interpreter. +01a,17feb03,bpn Written. +*/ + +#ifndef __INCshellInterpLibh +#define __INCshellInterpLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes */ + +#include +#include + +#include + +/* Defines */ + +/* The interpreter data structure */ + +typedef struct shell_interp + { + NODE node; + const char * name; /* interpreter name */ + FUNCPTR ctxInit; /* interpreter ctx init routine */ + VOIDFUNCPTR ctxRestart; /* interpreter ctx restart routine */ + FUNCPTR ctxFinalize;/* interpreter ctx terminate routine */ + FUNCPTR parser; /* interpreter parser routine */ + FUNCPTR evaluate; /* interpreter evaluation routine */ + FUNCPTR completion; /* interpreter input completion routine */ + const char * prompt; /* original prompt of the interpreter */ + /* BELOW IS Wind River RESERVED INFO */ + char * dfltPrompt; /* default interpreter prompt (malloc-ed) */ + LED_HIST history; /* initial commands history list */ +#ifdef HOST + FUNCPTR asyncEvtDispatch; /* called when a DFW msg is recvd */ +#endif /* HOST */ + } SHELL_INTERP; + +typedef struct shell_interp_ctx + { + NODE node; + SHELL_INTERP * pInterp; /* interpreter used */ + void * pInterpParam; /* internal data of the interpreter */ + char * currentPrompt; /* prompt to use (malloc()-ed) */ + LED_HIST history; /* commands history list */ + void * reserved; /* FOR INTERNAL USE ONLY */ + } SHELL_INTERP_CTX; + +/* Function declarations */ + +extern STATUS shellInterpRegister (FUNCPTR interpInitRtn); + +extern const char * shellInterpDefaultNameGet (void); +extern const char * shellInterpNameGet (SHELL_ID shellId); + +extern SHELL_INTERP_CTX * shellInterpCtxGet (SHELL_ID shellId); + +/* Functions call at boot time */ + +extern STATUS shellInterpCInit (SHELL_INTERP * pInterp); +extern STATUS shellInterpCmdInit (SHELL_INTERP * pInterp); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCshellInterpLibh */ diff --git a/h/shellLib.h b/h/shellLib.h new file mode 100644 index 0000000..fce4257 --- /dev/null +++ b/h/shellLib.h @@ -0,0 +1,184 @@ +/* shellLib.h - header for the kernel shell module */ + +/* Copyright 2003-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02c,08feb05,bpn Moved shellPromptFmtStrAdd() API to shellPromptLib.h. +02b,18aug04,bpn Added CPLUS_SYM_MATCH configuration variable. +02a,28jul04,bpn Added _WRS_DEPRECATED attributes to obsolete routines. + Moved APIs to shellLibP.h +01z,12jul04,bpn Updated shellLogout() API. +01y,28apr04,bpn Added shellBackgroundInit() and shellBackgroundRead() + prototypes. +01x,26apr04,bpn Added new configuration variable AUTOLOGOUT. +01w,07apr04,bpn Added new configuration variables. +01v,26mar04,bpn Added shellErrnoSet() and shellErrnoGet() prototypes. +01u,26feb04,bpn Added shellCompatibleCheck (), shellIdVerify() and + shellTaskGet() prototypes. +01t,25nov03,bpn Added ALL_SHELL_SESSIONS and CURRENT_SHELL_SESSION definitions. + Added shellInOutBlock() and shellInOutUnblock() prototypes. +01s,06nov03,bpn Update shellXxxxInit() API to use configuration string. + Added default configuration variable name +01r,28oct03,bpn Moved shellDataXxx() API to shellDataLib.h. +01q,23sep03,bpn Moved structures to shellInternalLib.h. Added prototype + for shellPromptFmtStrAdd(). Updated API names. +01p,22aug03,bpn Added S_shellLib_MISSING_ARG, S_shellLib_UNKNOWN_OPT and + S_shellLib_ARG_ERROR. +01o,22jul03,bpn Added S_shellLib_UNMATCHED_QUOTE. +01n,26jun03,bpn Added dummy functions shellRestart() and + shellIsRemoteConnectedSet() for rlogLib. +01m,19may03,bpn Moved structure definition to shellInterpLib.h. +01l,17apr03,lcs Add routines to configure shell environment. +01k,08apr03,bpn Added shellCompatibleSet() declaration. +01j,20mar03,bpn Added new errno value and shellLedModeSet() declaration. +01i,14mar03,bpn Changed long long to INT64. +01h,13mar03,lcs Integrate host shell host function call support. +01g,12mar03,lcs Added support for host shell. +01f,10mar03,bpn Added interpreter switch mechanism. Changed SHELL_CONTEXT + structure name to SHELL_CTX. +01e,06mar03,bpn Added definition of shellExitWrapper(). +01d,04mar03,bpn Added definitions of shellInOutSet() and shellInOutGet(). +01c,28feb03,bpn Added shellxxxPrint() routines declarations. Reworked APIs. +01b,20feb03,bpn Moved the SHELL_CONTEXT structure to shellLibP.h. Changed + SHELL_CTX_INTERP structure. +01a,17feb03,bpn Written. +*/ + +#ifndef __INCshellLibh +#define __INCshellLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes */ +#ifndef HOST +#include +#else +#include +#include +#endif + +#include + +/* Defines */ + +/* Configuration variable names */ + +#define SHELL_CFG_LED_MODE "LINE_EDIT_MODE" /* for ledLib */ +#define SHELL_CFG_INTERP "INTERPRETER" /* current interpreter */ +#define SHELL_CFG_INTERP_EVAL "INTERPRETER_EVAL" +#define SHELL_CFG_LINE_LENGTH "LINE_LENGTH" /* shell line length */ +#define SHELL_CFG_EXC_PRINT "EXC_PRINT" /* exception notification */ +#define SHELL_CFG_BP_PRINT "BP_PRINT" /* breakpoint notif. */ +#define SHELL_CFG_AUTOLOGOUT "AUTOLOGOUT" /* inactivity timeout */ +#define SHELL_CFG_CPLUS_MATCH "CPLUS_SYM_MATCH" /* cplus symbol matching */ + +/* Special shell session identifier */ + +#define ALL_SHELL_SESSIONS ((SHELL_ID)-1) +#define CURRENT_SHELL_SESSION ((SHELL_ID)0) + +/* Possible errnos */ + +#define S_shellLib_NO_INTERP (M_shellLib | 1) +#define S_shellLib_INTERP_EXISTS (M_shellLib | 2) +#define S_shellLib_NOT_SHELL_TASK (M_shellLib | 3) +#define S_shellLib_SHELL_TASK_EXISTS (M_shellLib | 4) +#define S_shellLib_SHELL_TASK_MAX (M_shellLib | 5) +#define S_shellLib_NO_SHELL_CMD (M_shellLib | 6) +#define S_shellLib_NO_USER_DATA (M_shellLib | 7) +#define S_shellLib_NO_LED_MODE (M_shellLib | 8) +#define S_shellLib_INTERP_INIT_ERROR (M_shellLib | 9) + +#define S_shellLib_LEX_ERROR (M_shellLib | 20) +#define S_shellLib_SYNTAX_ERROR (M_shellLib | 21) +#define S_shellLib_INTERNAL_ERROR (M_shellLib | 22) + +#define S_shellLib_UNMATCHED_QUOTE (M_shellLib | 30) +#define S_shellLib_MISSING_ARG (M_shellLib | 31) +#define S_shellLib_UNKNOWN_OPT (M_shellLib | 32) +#define S_shellLib_ARG_ERROR (M_shellLib | 33) + +#define S_shellLib_CONFIG_ERROR (M_shellLib | 40) + +/* Structures */ + +typedef struct shell_ctx * SHELL_ID; + +/* Function declarations */ + +/* Compatibility with vxWorks 5.5 */ + +#ifndef HOST +extern STATUS shellInit (int stackSize, int interactive) + _WRS_DEPRECATED("VxWorks 5.5 Compatibility"); +extern void shell (BOOL interactive) + _WRS_DEPRECATED("VxWorks 5.5 Compatibility"); +#endif +extern BOOL shellLock (BOOL request); +extern STATUS shellOrigStdSet (int which, int fd) + _WRS_DEPRECATED("VxWorks 5.5 Compatibility"); +extern STATUS shellScriptAbort (void); +extern STATUS shellHistory (int size); +extern STATUS shellPromptSet (const char * newPrompt); + +/* New shell functions */ + +extern STATUS shellConsoleInit (const char * config, int stackSize, + const char * shellName, char ** pShellName); + +extern STATUS shellSecureInit (const char * config, int stackSize, + const char * shellName, char ** pShellName, + int fdin, int fdout, int fderr); + +extern STATUS shellGenericInit (const char * config, int stackSize, + const char * shellName, char ** pShellName, + BOOL interactive, BOOL loginAccess, + int fdin, int fdout, int fderr); + +extern BOOL shellCompatibleCheck (void); + +extern STATUS shellParserControl (UINT32 remoteEvent, UINT32 sessionId, + UINT32 slaveFd, VOIDFUNCPTR logoutFunc); + +extern void shellLoginInstall (FUNCPTR logRtn, int logVar); +extern void shellLogoutInstall (FUNCPTR logRtn, int logVar); +extern STATUS shellLogout (SHELL_ID shellId); +extern STATUS shellRestart (SHELL_ID shellId); +extern STATUS shellAbort (SHELL_ID shellId); +extern int shellTaskIdDefault (SHELL_ID shellId, int taskId); +extern void shellTerminate (SHELL_ID shellId); + +extern void shellExitWrapper (int code); + +extern STATUS shellIdVerify (SHELL_ID shellId); +extern int shellTaskGet (SHELL_ID shellId); +extern SHELL_ID shellFromTaskGet (int taskId); +extern SHELL_ID shellFromNameGet (const char * taskName); +extern SHELL_ID shellFirst (); +extern SHELL_ID shellNext (SHELL_ID shellId); + +extern void shellErrnoSet (SHELL_ID shellId, int errNo); +extern int shellErrnoGet (SHELL_ID shellId); + +/* Private functions: do not use! */ + +extern void shellCompatibleSet (BOOL isCompatible); +extern void shellTaskDefaultOptionsSet (int taskOpt); +extern int shellTaskDefaultOptionsGet (); +extern void shellTaskDefaultStackSizeSet (int stackSize); +extern int shellTaskDefaultStackSizeGet (); +extern void shellTaskDefaultPrioritySet (int priority); +extern int shellTaskDefaultPriorityGet (); +extern void shellTaskDefaultBaseNameSet (const char * taskBaseName); +extern char * shellTaskDefaultBaseNameGet (); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCshellLibh */ diff --git a/h/shellPromptLib.h b/h/shellPromptLib.h new file mode 100644 index 0000000..690d9e6 --- /dev/null +++ b/h/shellPromptLib.h @@ -0,0 +1,40 @@ +/* shellPromptLib.h - header for the shell prompt module */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,08feb05,bpn Written. +*/ + +#ifndef __INCshellPromptLibh +#define __INCshellPromptLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes */ +#ifdef HOST +#include +#include +#endif + +/* Defines */ + +/* Structures */ + +/* Functions */ + +extern STATUS shellPromptFmtStrAdd (char fmt, VOIDFUNCPTR fmtRtn, BOOL force); +extern STATUS shellPromptFmtSet (SHELL_ID shellId, const char * interp, + const char * promptFmt); +extern STATUS shellPromptFmtDftSet (const char * interp, + const char * promptFmt); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCshellPromptLibh */ diff --git a/h/shlLib.h b/h/shlLib.h new file mode 100644 index 0000000..21bd7a8 --- /dev/null +++ b/h/shlLib.h @@ -0,0 +1,44 @@ +/* shlLib.h - shared library support library header file */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,21sep04,bpn Added shlShow() and rtpShlShow() prototypes. +01f,09sep04,job Added shlLibInit() prototype +01e,14may04,kk added shlShowInit() & shlShellCmdInit() prototype +01d,10may04,dms Switch to an integral type for SHL_ID in the kernel. +01c,03may04,kk added SHL_XXX verbosity levels for shlShow() +01b,20apr04,pad Moved declarations of shlLibInit() and shlRtpDeleteAll() in + private/shlLibP.h +01a,26mar04,dms created based on sdLib.h +*/ + +#ifndef __INCshlLibh +#define __INCshlLibh + +#include "vxWorks.h" + +/* defines */ + +#define SHL_SHOW_VERBOSE_ALL 3 /* for shlShow() */ +#define SHL_SHOW_ALL 2 +#define SHL_SHOW_VERBOSE 1 +#define SHL_SHOW_DEFAULT 0 + +/* typedefs */ + +typedef int SHL_ID; + +#include "shlLibCommon.h" + +/* prototypes */ + +extern STATUS shlLibInit (void); +extern STATUS shlShowInit (void); /* initialize show routines for SHL */ +extern BOOL shlShow (SHL_ID shlId, int level); +extern STATUS rtpShlShow (RTP_ID rtpId); +extern STATUS shlShellCmdInit (void); /* initialize cmd shell rtns for SHL */ + +#endif /* __INCshlLibh */ diff --git a/h/shlLibCommon.h b/h/shlLibCommon.h new file mode 100644 index 0000000..9b63f87 --- /dev/null +++ b/h/shlLibCommon.h @@ -0,0 +1,71 @@ +/* shlLibCommon.h - common shared library support library header file */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05nov04,kk added S_shlLib_SHL_ACCESS_DENIED +01b,20apr04,pad Added errno S_shlLib_INVALID_PARAMETER. +01a,26mar04,dms created based on sdLibCommon.h +*/ + +#ifndef __INCshlLibCommonh +#define __INCshlLibCommonh + +#include "vxWorks.h" +#include "vwModNum.h" + +/* errno values */ + +#define S_shlLib_ID_SPACE_EXHAUSTED (M_shlLib | 1) +#define S_shlLib_INVALID_SH_INITFLG_CHANGE (M_shlLib | 2) +#define S_shlLib_INVALID_GOTT_INDEX (M_shlLib | 3) +#define S_shlLib_INVALID_SHL_ID (M_shlLib | 4) +#define S_shlLib_INVALID_PARAMETER (M_shlLib | 5) +#define S_shlLib_SHL_ACCESS_DENIED (M_shlLib | 6) + +/* data structures */ + +typedef struct + { + UINT32 shlFlags; + int shlGOTTINDEX; /* unique small integer ID */ + VIRT_ADDR shlTextBase; /* address of shared library text segment */ + size_t shlTextSize; /* size of shared library text segment */ + VIRT_ADDR shlDataBase; /* address of shared library data in the RTP */ + size_t shlDataSize; /* size of shared library data segment */ + } SHLINFO; + +/* options */ + +/* Set in shlFlags to indicate that the library has been initialized. */ +#define SHL_INITFLG 0x00000001 + +/* This is a system-wide limit on the number of shared objects. */ +#define MAX_SHARED_OBJECTS 1023 + +#ifdef __cplusplus +extern "C" { +#endif + +/* functional API to the library */ + +SHL_ID _shlOpen (const char * name, + int options); + +void _shlUnlock (SHL_ID shlId); + +STATUS _shlGet (SHL_ID shlId, + SHLINFO * info); + +STATUS _shlPut (SHL_ID shlId, + const SHLINFO * info); + +STATUS _shlClose (SHL_ID shlId); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCshlLibCommonh */ diff --git a/h/sigCodes.h b/h/sigCodes.h new file mode 100644 index 0000000..ad02d14 --- /dev/null +++ b/h/sigCodes.h @@ -0,0 +1,56 @@ +/* sigCodes.h - defines for the code passed to signal handlers */ + +/* Copyright 1984-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,01mar00,frf Add SH4 support for T2. +01f,23apr97,hk added support for SH. +01e,07jun95,yao added support for PPC. +01d,19mar95,dvs removed #ifdef TRON - tron no longer supported. +01c,09jun93,hdn added support for I80X86 +01b,22sep92,rrr added support for c++ +01a,20aug92,rrr written. +*/ + +#ifndef __INCsigCodesh +#define __INCsigCodesh + +#ifdef __cplusplus +extern "C" { +#endif + +#if CPU_FAMILY==I960 +#include "arch/i960/sigI960Codes.h" +#endif /* CPU_FAMILY==I960 */ + +#if CPU_FAMILY==MC680X0 +#include "arch/mc68k/sigMc68kCodes.h" +#endif /* CPU_FAMILY==MC680X0 */ + +#if CPU_FAMILY==MIPS +#include "arch/mips/sigMipsCodes.h" +#endif /* CPU_FAMILY==MIPS */ + +#if CPU_FAMILY==SPARC +#include "arch/sparc/sigSparcCodes.h" +#endif /* CPU_FAMILY==SPARC */ + +#if CPU_FAMILY==I80X86 +#include "arch/i86/sigI86Codes.h" +#endif /* CPU_FAMILY==I80X86 */ + +#if CPU_FAMILY==PPC +#include "arch/ppc/sigPpcCodes.h" +#endif /* CPU_FAMILY==PPC */ + +#if CPU_FAMILY==SH +#include "arch/sh/sigShCodes.h" +#endif /* CPU_FAMILY==SH */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsigCodesh */ diff --git a/h/sigLib.h b/h/sigLib.h new file mode 100644 index 0000000..c688ef2 --- /dev/null +++ b/h/sigLib.h @@ -0,0 +1,53 @@ +/* sigLib.h - obsolete vxWorks 5.0 header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,09feb93,rrr added SIGCONTEXT typedef for compatibility with 5.0. +01e,05feb93,rrr fixed spr 1906 (signal numbers to match sun os) +01d,22sep92,rrr added support for c++ +01c,21sep92,rrr more stuff to be more like 5.0. +01a,20sep92,smb changed signalP.h to sigLibP.h +01a,19sep92,jcf written for compatibility with 5.0. +*/ + +#ifndef __INCsigLibh +#define __INCsigLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "signal.h" +#include "sigCodes.h" +#include "unistd.h" +#include "private/sigLibP.h" + +#define NUM_SIGNALS 32 + +#define SIGIO (SIGRTMIN + 0) +#define SIGXCPU (SIGRTMIN + 1) +#define SIGXFSZ (SIGRTMIN + 2) +#define SIGVTALRM (SIGRTMIN + 3) +#define SIGPROF (SIGRTMIN + 4) +#define SIGWINCH (SIGRTMIN + 5) +#define SIGLOST (SIGRTMIN + 6) +#define SIGURG 16 + +#define SIGIOT SIGABRT +#define SIGCLD SIGCHLD +#define SIGPOLL SIGIO +#define SIGSYS SIGFMT + +#define NUM_SIGNALS 32 + +typedef struct sigvec SIGVEC; +typedef struct sigcontext SIGCONTEXT; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsigLibh */ diff --git a/h/sigevent.h b/h/sigevent.h new file mode 100644 index 0000000..c7f0e08 --- /dev/null +++ b/h/sigevent.h @@ -0,0 +1,39 @@ +/* sigevent.h - sigevent structure, needed by several header files */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02e,02dec03,ans Added taskId parameter to sigeventInit (). +02d,14oct03,ans Added sigevenLib support. +02c,09nov93,rrr update to posix 1003.4 draft 14 +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01b,26may92,rrr the tree shuffle +01a,19feb92,rrr written from posix spec +*/ + +#ifndef __INCsigeventh +#define __INCsigeventh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "sigeventCommon.h" + +typedef struct sigevent_t * SIGEVENT_ID; + +extern SIGEVENT_ID sigeventCreate (struct sigevent * pSigev); +extern STATUS sigeventInit (SIGEVENT_ID sigevId, int taskId, + struct sigevent * pSigev); +extern STATUS sigeventNotify (SIGEVENT_ID sigevId); +extern STATUS sigeventDelete (SIGEVENT_ID sigevId); +extern int sigeventSigOverrunGet (SIGEVENT_ID sigevId); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsigeventh */ diff --git a/h/sigeventCommon.h b/h/sigeventCommon.h new file mode 100644 index 0000000..cb4f192 --- /dev/null +++ b/h/sigeventCommon.h @@ -0,0 +1,47 @@ +/* sigeventCommon.h - sigevent structure, needed by several header files */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,29sep03,ans written. +*/ + +#ifndef __INCsigeventcommonh +#define __INCsigeventcommonh + +#ifdef __cplusplus +extern "C" { +#endif + +#define SIGEV_NONE 0x0 +#define SIGEV_SIGNAL 0x1 +#define SIGEV_TASK_SIGNAL 0x2 +#define SIGEV_TIMER_SIGNAL 0x4 +#define SIGEV_TIMER_TASK_SIGNAL 0x8 +#define SIGEV_MASK 0xf + +#define IS_SIGEV_TYPE_SUPPORTED(notify) ((notify) & SIGEV_MASK || !(notify)) +#define IS_SIGEV_SIGNAL_TASK(notify) ((notify) & \ + (SIGEV_TASK_SIGNAL | SIGEV_TIMER_TASK_SIGNAL)) + + +union sigval + { + int sival_int; + void *sival_ptr; + }; + +struct sigevent + { + int sigev_signo; /* signal number */ + union sigval sigev_value; /* signal value */ + int sigev_notify; /* notification type */ + }; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsigeventcommonh */ diff --git a/h/signal.h b/h/signal.h new file mode 100644 index 0000000..4a04966 --- /dev/null +++ b/h/signal.h @@ -0,0 +1,296 @@ +/* signal.h - signal facility library header */ + +/* + * Copyright (c) 1992-1994, 2000, 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +02w,22aug05,kk updated prototype of sigtimedwait() and sigwaitinfo() +02v,19aug05,kk updated prototype for RTP sigqueue() to conform to POSIX +02u,04aug05,kk added sys/types.h to get pid_t for POSIX +02t,07feb05,hya added missing prototype +02s,30sep04,ans added _rtpSigqueue() +02r,27sep04,ans updated job control signals documentation. +02q,13sep04,yvp Added aliases for posix functions to get API uniformity across + both kernel/userland. +02p,19may04,ans alternate signal stack support. +02o,04may04,ans added SIG_NODEFER +02n,27oct03,nrj added support for waitpid +02m,17oct03,nrj added SA_RESTART +02l,14oct03,ans Moved SIGEV_NONE SIGEV_SIGNAL to sigeventCommon.h +02k,09nov00,jgn remove inaccurate comment from SIGKILL (SPR #35996) +02j,19jul00,jgn add thread cancellation signal for pthreads support + + update the sigwait prototype to match the POSIX version +02i,11nov94,kdl provide paramless func ptrs in structs, for non-ANSI (SPR 3742) +02h,10nov94,caf adjusted placement of _ASMLANGUAGE conditional. +02g,06oct93,yao added _ASMLANGUAGE conditional. +02h,12jan94,kdl added sigqueue() prototype. +02g,09nov93,rrr update to posix 1003.4 draft 14 +02f,05feb93,rrr fixed spr 1986 (SIG_ERR ... prototype) and + spr 1906 (signal numbers to match sun os) +02e,15oct92,rrr silenced warnings +02d,22sep92,rrr added support for c++ +02c,22aug92,rrr added bsd prototypes. +02b,27jul92,smb added prototype for raise(). +02a,04jul92,jcf cleaned up. +01b,26may92,rrr the tree shuffle +01a,19feb92,rrr written from posix spec +*/ + +#ifndef __INCsignalh +#define __INCsignalh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE +#include /* for sigevent structure */ +#include /* for pid_t for POSIX */ + +struct timespec; +#endif /* _ASMLANGUAGE */ + +/* + * Signal Numbers: + * Required .1 signals 1-13 + * Job Control signals 17-22 + * These are no implemented for kernel tasks. The default action in this + * case is SIG_IGN. + * For RTP tasks, these are implemented as per the below signal number + * definition. + * A bas + * Realtime signals 20-27 + */ +#define SIGHUP 1 /* hangup */ +#define SIGINT 2 /* interrupt */ +#define SIGQUIT 3 /* quit */ +#define SIGILL 4 /* illegal instruction (not reset when caught) */ +#define SIGTRAP 5 /* trace trap (not reset when caught) */ +#define SIGABRT 6 /* used by abort, replace SIGIOT in the future */ +#define SIGEMT 7 /* EMT instruction */ +#define SIGFPE 8 /* floating point exception */ +#define SIGKILL 9 /* kill */ +#define SIGBUS 10 /* bus error */ +#define SIGSEGV 11 /* segmentation violation */ +#define SIGFMT 12 /* STACK FORMAT ERROR (not posix) */ +#define SIGPIPE 13 /* write on a pipe with no one to read it */ +#define SIGALRM 14 /* alarm clock */ +#define SIGTERM 15 /* software termination signal from kill */ +#define SIGCNCL 16 /* pthreads cancellation signal */ +#define SIGSTOP 17 /* sendable stop signal not from tty */ +#define SIGTSTP 18 /* stop signal from tty */ +#define SIGCONT 19 /* continue a stopped process */ +#define SIGCHLD 20 /* to parent on child stop or exit */ +#define SIGTTIN 21 /* to readers pgrp upon background tty read */ +#define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */ + +#define SIGUSR1 30 /* user defined signal 1 */ +#define SIGUSR2 31 /* user defined signal 2 */ + +#define SIGRTMIN 23 /* Realtime signal min */ +#define SIGRTMAX 29 /* Realtime signal max */ + + +#define _NSIGS 31 + +#ifndef _ASMLANGUAGE +/* + * ANSI Args and returns from signal() + */ +#if defined(__STDC__) || defined(__cplusplus) + +#define SIG_ERR (void (*)(int))-1 +#define SIG_DFL (void (*)(int))0 +#define SIG_IGN (void (*)(int))1 + +#else + +#define SIG_ERR (void (*)())-1 +#define SIG_DFL (void (*)())0 +#define SIG_IGN (void (*)())1 + +#endif + +/* + * The sa_flags in struct sigaction + */ +#define SA_NOCLDSTOP 0x0001 /* Do not generate SIGCHLD when children stop */ +#define SA_SIGINFO 0x0002 /* Pass additional siginfo structure */ +#define SA_ONSTACK 0x0004 /* Run on sigstack */ +#define SA_INTERRUPT 0x0008 /* (Not posix) Don't restart the function */ +#define SA_RESETHAND 0x0010 /* (Not posix) Reset the handler, like sysV */ +#define SA_RESTART 0x0020 /* (Not posix) restart the system call */ +#define SA_NODEFER 0x0040 /* + * signal not automatically blocked on entry + * to signal handler + */ +#define SA_NOCLDWAIT 0x0080 /* no zombie created on child death */ + +/* + * The how in sigprocmask() + */ +#define SIG_BLOCK 1 +#define SIG_UNBLOCK 2 +#define SIG_SETMASK 3 + +/* + * The si_code returned in siginfo + */ +#define SI_SYNC 0 /* (Not posix) gernerated by hardware */ +#define SI_KILL 1 /* signal from .1 kill() function */ +#define SI_QUEUE 2 /* signal from .4 sigqueue() function */ +#define SI_TIMER 3 /* signal from expiration of a .4 timer */ +#define SI_ASYNCIO 4 /* signal from completion of an async I/O */ +#define SI_MESGQ 5 /* signal from arrival of a message */ +#define SI_CHILD 6 /* signal from child, stopped or terminated */ +#define SI_USER SI_KILL /* signal from kill() function */ + +typedef unsigned long sigset_t; +typedef unsigned char sig_atomic_t; + +typedef struct siginfo + { + int si_signo; + int si_code; + union sigval si_value; + } siginfo_t; + +struct sigaction + { + union + { +#if defined(__STDC__) || defined(__cplusplus) + void (*__sa_handler)(int); + void (*__sa_sigaction)(int, siginfo_t *, void *); +#else + void (*__sa_handler)(); + void (*__sa_sigaction)(); +#endif /* __STDC__ */ + } sa_u; +#define sa_handler sa_u.__sa_handler +#define sa_sigaction sa_u.__sa_sigaction + sigset_t sa_mask; + int sa_flags; + }; + + +/* + * From here to the end is not posix, it is for bsd compatibility. + */ +#define SV_ONSTACK SA_ONSTACK +#define SV_INTERRUPT SA_INTERRUPT +#define SV_RESETHAND SA_RESETHAND + +#define sigmask(m) (1 << ((m)-1)) +#define SIGMASK(m) (1 << ((m)-1)) + +struct sigvec + { +#if defined(__STDC__) || defined(__cplusplus) + void (*sv_handler)(int); /* signal handler */ +#else + void (*sv_handler)(); /* signal handler */ +#endif /* __STDC__ */ + int sv_mask; /* signal mask to apply */ + int sv_flags; /* see signal options */ + }; + +struct sigcontext; + +/* end for bsd compatibilty */ + +typedef struct sig_stack + { + int * ss_sp; + long ss_size; + int ss_flags; + } stack_t; + +struct rtpSigCtx; + +/* Bit definitions for ss_flags */ + +#define SS_DISABLE 0x1 +#define SS_ONSTACK 0x2 + +#define MINSIGSTKSZ 1024 +#define SIGSTKSZ MINSIGSTKSZ * 4 + +/* prototypes */ + +extern void (*signal(int __sig, void (*__handler)(int)))(int); +extern int raise(int __signo); + +extern int sigemptyset(sigset_t *__set); +extern int sigfillset(sigset_t *__set); +extern int sigaddset(sigset_t *__set, int __signo); +extern int sigdelset(sigset_t *__set, int __signo); +extern int sigismember(const sigset_t *__set, int __signo); +extern int sigaction(int __sig, const struct sigaction *__act, + struct sigaction *__oact); +extern int sigprocmask(int __how, const sigset_t *__set, sigset_t *__oset); +extern int sigpending(sigset_t *__set); +extern int sigsuspend(const sigset_t *__sigmask); +extern int sigwait(const sigset_t *__set, int* sig); +extern int sigvec(int __sig, const struct sigvec *__vec, + struct sigvec *__ovec); +extern void sigreturn(struct sigcontext *__context); +extern int sigsetmask(int __mask); +extern int sigblock(int __mask); +extern int sigaltstack (const stack_t *ss, stack_t *oss); +extern int sigwaitinfo(const sigset_t *__set, siginfo_t *__value); +extern int sigtimedwait(const sigset_t *__set, siginfo_t *__value, + const struct timespec *); + +#ifndef _WRS_KERNEL /* user-mode API's */ + +extern int kill (pid_t rtpId, int signo); +extern int taskKill (int taskId, int signo); +extern int sigqueue (pid_t rtpId, int signo, const union sigval value); +extern int taskSigqueue (int taskId, int signo, const union sigval value); +extern int _taskSigqueue (int taskId, int signo, + const union sigval *value, int sigCode); + +/* thread APIs */ + +#include /* to get pthread_t */ + +int pthread_sigmask (int how, const sigset_t *set, sigset_t *oset); +int pthread_kill (pthread_t thread, int sig); + +/* These aliases provide consistent meaning in both kernel & user modes */ + +#define rtpKill(rtpId,signo) kill((rtpId),(signo)) +#define rtpSigqueue(rtpId,signo,value) sigqueue((rtpId),(signo),(value)) +#define _rtpSigqueue(rtpId,signo,value,code) \ + _sigqueue((rtpId),(signo),(value),(code)) +#define taskRaise(signo) taskKill(taskIdCurrent,(signo)) +#define rtpRaise(signo) raise((signo)) + +#else /* kernel-mode API's */ + +extern int kill(int __tid, int __signo); +extern int sigqueue (int tid, int signo, const union sigval value); + + /* These aliases provide consistent meaning in both kernel & user modes */ + +#define taskKill(tid,signo) kill((tid),(signo)) +#define taskRaise(signo) raise((signo)) +#define taskSigqueue(tid,signo,value) sigqueue((tid),(signo),(value)) + +#endif /* _WRS_KERNEL */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsignalh */ diff --git a/h/simLib.h b/h/simLib.h new file mode 100644 index 0000000..1fea5e0 --- /dev/null +++ b/h/simLib.h @@ -0,0 +1,91 @@ +/* simLib.h - miscellaneous simulator routines header */ + +/* +modification history +-------------------- +02i,19dec01,jmp added simReadSelect(). +02h,04apr97,kab added HPSIM ioctls, added more open() flags. (HPSIM merge, + 18mar98.) +02g,26mar97,jmb added macros for converting file modes in HPSIM. (HPSIM merge, + 18mar98.) +02f,21mar97,cth added forward declaration for s_ulipIoctl (SPR 8221, 8240) +02e,29jan97,pr moved conversion code from simLib.c into a macro +02d,09jan97,pr added macros for converting file modes in simsolaris +02c,14dec93,gae removed u_printf() declaration (u_Lib.c) conflict for non stdc. +02b,14jul93,gae fixed banner. +02a,09jan93,gae renamed from sysULib.h; discarded major portions. +01c,05aug92,gae added non-ANSI forward declarations. +01b,29jul92,gae added more prototypes; ANSIfied. +01a,04jun92,gae written. +*/ + +/* +This header contains the declarations for miscellaneous simulator routines. +*/ + +#ifndef INCsimLibh +#define INCsimLibh + +/* prototypes */ + +#ifdef __STDC__ + +extern void s_userGet (char *hostname, char *hostip, char *username, char *cwd); +extern void s_fdint (int fd, int raw); +extern void s_uname (char *sysname, char *nodename, char *release, + char *version, char *machine); +extern int simReadSelect (int u_fd, int tv_sec, int tv_usec); + +#if CPU==SIMSPARCSOLARIS +extern unsigned int solarisCvtFlags (unsigned int oFlags); +extern int s_ulipIoctl (int fd, int cmd, char *pData, int len); +#endif /* CPU==SIMSPARCSOLARIS */ + +#else /* __STDC__ */ + +extern void s_userGet (); +extern void s_fdint (); +extern void s_uname (); +extern int simReadSelect (); + +#if CPU==SIMSPARCSOLARIS +extern unsigned int solarisCvtFlags (); +extern int s_ulipIoctl (); +#endif /* CPU==SIMSPARCSOLARIS */ + +#endif /* __STDC__ */ + +/* + * VxWorks, SunOS and HPUX currently all use the same defines for most + * of the file modes. Local versions of the modes are converted using yhe + * following macros so that they can be used instead of hard coded values. + */ + +#if CPU==SIMSPARCSOLARIS + +#define L_RDONLY 0x000 +#define L_WRONLY 0x001 +#define L_RDWR 0x002 +#define L_NDELAY 0x004 +#define L_APPEND 0x008 +#define L_SYNC 0x010 +#define L_DSYNC 0x040 +#define L_NONBLOCK 0x080 +#define L_CREAT 0x100 +#define L_TRUNC 0x200 +#define L_EXCL 0x400 +#define L_NOCTTY 0x800 +#define L_RSYNC 0x8000 + +#define L_VXSTART 0x4000 + +#define ARCHCVTFLAGS(x) ((x&O_RDONLY ? L_RDONLY : 0) | (x&O_RDWR ? L_RDWR : 0)|\ + (x&O_WRONLY ? L_WRONLY : 0) | (x&O_SYNC ? L_SYNC : 0)|\ + (x&O_NDELAY ? L_NDELAY : 0)| (x&O_CREAT ? L_CREAT : 0)|\ + (x&O_APPEND ? L_APPEND : 0) | (x&O_TRUNC ? L_TRUNC:0)|\ + (x&O_EXCL ? L_EXCL : 0) | (x&O_NOCTTY ? L_NOCTTY : 0)|\ + (x&O_NONBLOCK ? L_NONBLOCK : 0)) + +#endif /* CPU==SIMSPARCSOLARIS */ + +#endif /* INCsimLibh */ diff --git a/h/sioLib.h b/h/sioLib.h new file mode 100644 index 0000000..df3b6b6 --- /dev/null +++ b/h/sioLib.h @@ -0,0 +1,126 @@ +/* sioLib.h - header file for binary interface serial drivers */ + +/* Copyright 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01j,22mar05,hya moved common part into sioLibCommon.h. +01i,09may02,wef adding keyboard led set and get ioctls. +01h,29sep01,dat added SIO_ERRROR_NONE, new MODEM ctrl values. +01g,26apr00,dat added error callback +01f,04feb00,db added support for handling modem control signals and + multiple keyboard modes(SPR #29348). +01e,14jan97,db added SIO_OPEN and SIO_HUP for modem control(SPR #7637). +01d,24oct95,ms removed "static __inline__" (SPR #4500) +01c,15jun95,ms Added SIO_MODE_SET, SIO_MODE_GET, SIO_AVAIL_MODES_GET iotcl's + Renamed SIO_CHAN to SIO_CHAN + Changed prototype and name of callbackInstall() + Added documentation. +01b,22may95,ms removed unneeded include file. +01a,21feb95,ms written. +*/ + +#ifndef __INCsioLibh +#define __INCsioLibh + +#include "types/vxTypes.h" +#include "types/vxTypesOld.h" +#include "sioLibCommon.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* callback type codes */ + +#define SIO_CALLBACK_GET_TX_CHAR 1 +#define SIO_CALLBACK_PUT_RCV_CHAR 2 +#define SIO_CALLBACK_ERROR 3 + +/* Get Tx Chara callback (getTxCallbk) (callbkArg, pChar) */ + +/* Put Rx Chara callback (putRxCallbk) (callbkArg, char) */ + +/* Error callback codes: (errorCallbk) (callbkArg, code, pData, size) */ + +#define SIO_ERROR_NONE (-1) +#define SIO_ERROR_FRAMING 0 +#define SIO_ERROR_PARITY 1 +#define SIO_ERROR_OFLOW 2 +#define SIO_ERROR_UFLOW 3 +#define SIO_ERROR_CONNECT 4 +#define SIO_ERROR_DISCONNECT 5 +#define SIO_ERROR_NO_CLK 6 +#define SIO_ERROR_UNKNWN 7 + +/* serial device data structures */ + +typedef struct sio_drv_funcs SIO_DRV_FUNCS; + +typedef struct sio_chan /* a serial channel */ + { + SIO_DRV_FUNCS * pDrvFuncs; + /* device data */ + } SIO_CHAN; + +struct sio_drv_funcs /* driver functions */ + { + int (*ioctl) + ( + SIO_CHAN * pSioChan, + int cmd, + void * arg + ); + + int (*txStartup) + ( + SIO_CHAN * pSioChan + ); + + int (*callbackInstall) + ( + SIO_CHAN * pSioChan, + int callbackType, + STATUS (*callback)(void *, ...), + void * callbackArg + ); + + int (*pollInput) + ( + SIO_CHAN * pSioChan, + char * inChar + ); + + int (*pollOutput) + ( + SIO_CHAN * pSioChan, + char outChar + ); + }; + + +/* in-line macros */ + +#define sioIoctl(pSioChan, cmd, arg) \ + ((pSioChan)->pDrvFuncs->ioctl (pSioChan, cmd, arg)) +#define sioTxStartup(pSioChan) \ + ((pSioChan)->pDrvFuncs->txStartup (pSioChan)) +#define sioCallbackInstall(pSioChan, callbackType, callback, callbackArg) \ + ((pSioChan)->pDrvFuncs->callbackInstall (pSioChan, callbackType, \ + callback, callbackArg)) +#define sioPollInput(pSioChan, inChar) \ + ((pSioChan)->pDrvFuncs->pollInput (pSioChan, inChar)) +#define sioPollOutput(pSioChan, thisChar) \ + ((pSioChan)->pDrvFuncs->pollOutput (pSioChan, thisChar)) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsioLibh */ diff --git a/h/sioLibCommon.h b/h/sioLibCommon.h new file mode 100644 index 0000000..ad3c835 --- /dev/null +++ b/h/sioLibCommon.h @@ -0,0 +1,154 @@ +/* Header file for SIO serial drivers ioctl control, used by + both kernel and RTP user side. */ + +/* Copyright 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01a,22mar05,hya created from target/h/sioLib.h. +*/ + +#ifndef __INCsioLibCommonh +#define __INCsioLibCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +/* serial device I/O controls */ + +#define SIO_BAUD_SET 0x1003 +#define SIO_BAUD_GET 0x1004 + +#define SIO_HW_OPTS_SET 0x1005 +#define SIO_HW_OPTS_GET 0x1006 + +#define SIO_MODE_SET 0x1007 +#define SIO_MODE_GET 0x1008 +#define SIO_AVAIL_MODES_GET 0x1009 + +/* These are used to communicate open/close between layers */ + +#define SIO_OPEN 0x100A +#define SIO_HUP 0x100B + +/* + * The ioctl commands listed below provide a way for reading and + * setting the modem lines. + * + * SIO_MSTAT_GET: returns status of all input and output modem signals. + * SIO_MCTRL_BITS_SET: sets modem signals specified in argument. + * SIO_MCTRL_BITS_CLR: clears modem signal(s) specified in argument. + * SIO_MCTRL_ISIG_MASK: returns mask of all input modem signals. + * SIO_MCTRL_OSIG_MASK: returns mask of all output(writable) modem signals. + */ + +#define SIO_MSTAT_GET 0x100C /* get modem status lines */ +#define SIO_MCTRL_BITS_SET 0x100D /* set selected modem lines */ +#define SIO_MCTRL_BITS_CLR 0x100E /* clear selected modem lines */ +#define SIO_MCTRL_ISIG_MASK 0x100F /* mask of lines that can be read */ +#define SIO_MCTRL_OSIG_MASK 0x1010 /* mask of lines that can be set */ + +/* Ioctl cmds for reading/setting keyboard mode */ + +#define SIO_KYBD_MODE_SET 0x1011 +#define SIO_KYBD_MODE_GET 0x1012 + + +/* Ioctl cmds for reading/setting keyboard led state */ + +#define SIO_KYBD_LED_SET 0x1013 +#define SIO_KYBD_LED_GET 0x1014 + +/* options to SIO_MODE_SET */ + +#define SIO_MODE_POLL 1 +#define SIO_MODE_INT 2 + +/* options to SIO_HW_OPTS_SET (ala POSIX), bitwise or'ed together */ + +#define CLOCAL 0x1 /* ignore modem status lines */ +#define CREAD 0x2 /* enable device reciever */ + +#define CSIZE 0xc /* bits 3 and 4 encode the character size */ +#define CS5 0x0 /* 5 bits */ +#define CS6 0x4 /* 6 bits */ +#define CS7 0x8 /* 7 bits */ +#define CS8 0xc /* 8 bits */ + +#define HUPCL 0x10 /* hang up on last close */ +#define STOPB 0x20 /* send two stop bits (else one) */ +#define PARENB 0x40 /* parity detection enabled (else disabled) */ +#define PARODD 0x80 /* odd parity (else even) */ + +/* + * Modem signals definitions + * + * The following six macros define the different modem signals. They + * are used as arguments to the modem ioctls commands to specify + * the signals to read(set) and also to parse the returned value. They + * provide hardware independence, as modem signals bits vary from one + * chip to another. + */ + +#define SIO_MODEM_DTR 0x01 /* data terminal ready */ +#define SIO_MODEM_RTS 0x02 /* request to send */ +#define SIO_MODEM_CTS 0x04 /* clear to send */ +#define SIO_MODEM_CD 0x08 /* carrier detect */ +#define SIO_MODEM_RI 0x10 /* ring */ +#define SIO_MODEM_DSR 0x20 /* data set ready */ + +/* + * options to SIO_KYBD_MODE_SET + * + * These macros are used as arguments by the keyboard ioctl comands. + * When used with SIO_KYBD_MODE_SET they mean the following: + * + * SIO_KYBD_MODE_RAW: + * Requests the keyboard driver to return raw key values as read + * by the keyboard controller. + * + * SIO_KYBD_MODE_ASCII: + * Requests the keyboard driver to return ASCII codes read from a + * known table that maps raw key values to ASCII. + * + * SIO_KYBD_MODE_UNICODE: + * Requests the keyboard driver to return 16 bit UNICODE values for + * multiple languages support. + */ + +#define SIO_KYBD_MODE_RAW 1 +#define SIO_KYBD_MODE_ASCII 2 +#define SIO_KYBD_MODE_UNICODE 3 + +/* + * options to SIO_KYBD_LED_SET + * + * These macros are used as arguments by the keyboard ioctl comands. + * When used with SIO_KYBD_LED_SET they mean the following: + * + * SIO_KYBD_LED_NUM: + * Sets the Num Lock LED on the keyboard - bit 1 + * + * SIO_KYBD_LED_CAP: + * Sets the Caps Lock LED on the keyboard - bit 2 + * + * SIO_KYBD_LED_SRC: + * Sets the Scroll Lock LED on the keyboard - bit 4 + */ + +#define SIO_KYBD_LED_NUM 1 +#define SIO_KYBD_LED_CAP 2 +#define SIO_KYBD_LED_SCR 4 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsioLibCommonh */ diff --git a/h/sllLib.h b/h/sllLib.h new file mode 100644 index 0000000..32ea427 --- /dev/null +++ b/h/sllLib.h @@ -0,0 +1,264 @@ +/* sllLib.h - singly linked list library header */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02c,19jan05,vvv moved some macros from osdep.h +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01f,26may92,rrr the tree shuffle +01e,04oct91,rrr passed through the ansification filter + -changed VOID to void + -changed copyright notice +01d,08apr91,jdi added NOMANUAL to prevent mangen. +01c,05oct90,shl added ANSI function prototypes. + added copyright notice. +01b,10aug90,dnw changed declaration of sllRemove() from STATUS to void. +01a,03jun89,jcf written. +*/ + +#ifndef __INCsllLibh +#define __INCsllLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* type definitions */ + +typedef struct slnode /* Node of a linked list. */ + { + struct slnode *next; /* Points at the next node in the list */ + } SL_NODE; + + +/* HIDDEN */ + +typedef struct /* Header for a linked list. */ + { + SL_NODE *head; /* header of list */ + SL_NODE *tail; /* tail of list */ + } SL_LIST; + +/* END_HIDDEN */ + +/******************************************************************************* +* +* SLL_INIT - initialize singly linked list head +* +* Initialize the specified list to an empty list. +* +* NOMANUAL +*/ + +#define SLL_INIT(list) \ + { \ + ((SL_LIST *)(list))->head = NULL; \ + ((SL_LIST *)(list))->tail = NULL; \ + } + +/******************************************************************************* +* +* SLL_PUT_AT_HEAD - add node to beginning of list +* +* This macro adds the specified node to the end of the specified list. +* +* NOMANUAL +*/ + +#define SLL_PUT_AT_HEAD(list, node) \ +{ \ + if ((((SL_NODE *)(node))->next = ((SL_LIST *)(list))->head) == NULL) \ + { \ + ((SL_LIST *)(list))->head = ((SL_NODE *)(node)); \ + ((SL_LIST *)(list))->tail = ((SL_NODE *)(node)); \ + } \ + else \ + ((SL_LIST *)(list))->head = (node); \ + } + +/******************************************************************************* +* +* SLL_PUT_AT_TAIL - add node to end of list +* +* This macro adds the specified node to the end of the specified singly +* linked list. +* +* NOMANUAL +*/ + +#define SLL_PUT_AT_TAIL(list, node) \ + { \ + ((SL_NODE *)(node))->next = NULL; \ + if (((SL_LIST *)(list))->head == NULL) \ + { \ + ((SL_LIST *)(list))->head = (SL_NODE *)(node); \ + ((SL_LIST *)(list))->tail = (SL_NODE *)(node); \ + } \ + else \ + ((SL_LIST *)(list))->tail->next = (SL_NODE *)(node); \ + ((SL_LIST *)(list))->tail = (SL_NODE *)(node); \ + } + +/******************************************************************************* +* +* SLL_GET - get (delete and return) first node from list +* +* This macro gets the first node from the specified singly linked list, +* deletes the node from the list, and returns a pointer to the node gotten. +* +* NOMANUAL +*/ + +#define SLL_GET(list, node) \ + { \ + if (((node) = (void *)((SL_LIST *)(list))->head) != NULL) \ + ((SL_LIST *)(list))->head = ((SL_NODE *)(node))->next; \ + } + +/******************************************************************************* +* +* SLL_REMOVE - remove specified node in list +* +* Remove the specified node in a singly linked list. +* +* NOMANUAL +*/ + +#define SLL_REMOVE(list, deleteNode, previousNode) \ + { \ + if (((SL_NODE *)(previousNode)) == NULL) \ + { \ + ((SL_LIST *)(list))->head = ((SL_NODE *)(deleteNode))->next; \ + if (((SL_LIST *)(list))->tail == ((SL_NODE *)(deleteNode))) \ + ((SL_LIST *)(list))->tail = NULL; \ + } \ + else \ + { \ + ((SL_NODE *)(previousNode))->next = ((SL_NODE *)(deleteNode))->next; \ + if (((SL_LIST *)(list))->tail == ((SL_NODE *)(deleteNode))) \ + ((SL_LIST *)(list))->tail = ((SL_NODE *)(previousNode)); \ + } \ + } + +/******************************************************************************* +* +* SLL_PREVIOUS - find and return previous node in list +* +* Find and return the previous node in a singly linked list. +* +* NOMANUAL +*/ + +#define SLL_PREVIOUS(list, node, previousNode) \ + { \ + SL_NODE *temp; \ + (SL_NODE *)(previousNode) = NULL; \ + temp = ((SL_LIST *)(list))->head; \ + if (temp != NULL) && (temp != (node)) \ + while (temp->next != NULL) \ + { \ + if (temp->next == (node)) \ + { \ + (SL_NODE *)(previousNode) = temp; \ + break; \ + } \ + temp = temp->next; \ + } \ + } + +/************************************************************************ +* +* sllFirst - find first node in list +* +* DESCRIPTION +* Finds the first node in a singly linked list. +* +* RETURNS +* Pointer to the first node in a list, or +* NULL if the list is empty. +* +* NOMANUAL +*/ + +#define SLL_FIRST(pList) \ + ( \ + (((SL_LIST *)pList)->head) \ + ) + +/************************************************************************ +* +* sllLast - find last node in list +* +* This routine finds the last node in a singly linked list. +* +* RETURNS +* pointer to the last node in list, or +* NULL if the list is empty. +* +* NOMANUAL +*/ + +#define SLL_LAST(pList) \ + ( \ + (((SL_LIST *)pList)->tail) \ + ) + +/************************************************************************ +* +* sllNext - find next node in list +* +* Locates the node immediately after the node pointed to by the pNode. +* +* RETURNS: +* Pointer to the next node in the list, or +* NULL if there is no next node. +* +* NOMANUAL +*/ + +#define SLL_NEXT(pNode) \ + ( \ + (((SL_NODE *)pNode)->next) \ + ) + +/************************************************************************ +* +* sllEmpty - boolean function to check for empty list +* +* RETURNS: +* TRUE if list is empty +* FALSE otherwise +* +* NOMANUAL +*/ + +#define SLL_EMPTY(pList) \ + ( \ + (((SL_LIST *)pList)->head == NULL) \ + ) + + +/* function declarations */ + +extern SL_LIST *sllCreate (void); +extern SL_NODE *sllEach (SL_LIST *pList, FUNCPTR routine, int routineArg); +extern SL_NODE *sllGet (SL_LIST *pList); +extern SL_NODE *sllPrevious (SL_LIST *pList, SL_NODE *pNode); +extern STATUS sllDelete (SL_LIST *pList); +extern STATUS sllInit (SL_LIST *pList); +extern STATUS sllTerminate (SL_LIST *pList); +extern int sllCount (SL_LIST *pList); +extern void sllPutAtHead (SL_LIST *pList, SL_NODE *pNode); +extern void sllPutAtTail (SL_LIST *pList, SL_NODE *pNode); +extern void sllRemove (SL_LIST *pList, SL_NODE *pDeleteNode, + SL_NODE *pPrevNode); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsllLibh */ diff --git a/h/smDllLib.h b/h/smDllLib.h new file mode 100644 index 0000000..d53e995 --- /dev/null +++ b/h/smDllLib.h @@ -0,0 +1,179 @@ +/* smDllLib.h - shared memory doubly linked list library header */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,06may02,mas macros use volatile pointers (SPR 68334) +01d,29jan93,pme added little endian support +01c,22sep92,rrr added support for c++ +01b,27jul92,pme changed structure declarations. +01a,19jul92,pme written from dllLib +*/ + +#ifndef __INCsmDllLibh +#define __INCsmDllLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* typedefs */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct sm_dl_node /* Node of a shared linked list. */ + { + struct sm_dl_node * next; /* Points at the next node in list */ + struct sm_dl_node * previous;/* Points at the previous node in list */ + } SM_DL_NODE; + +/* HIDDEN */ + +typedef struct sm_dl_list /* Header for a shared linked list. */ + { + SM_DL_NODE * head; /* Header list node */ + SM_DL_NODE * tail; /* Tail list node */ + } SM_DL_LIST; + +/* END_HIDDEN */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/******************************************************************************* +* +* smDllFirst - find first node in shared memory list +* +* DESCRIPTION +* Finds the first node in a doubly linked shared memory list. +* +* RETURNS +* Local address of the first node in a list, or +* LOC_NULL if the list is empty. +* +* NOMANUAL +*/ + +#define SM_DL_FIRST(pList) \ + ( \ + (GLOB_TO_LOC_ADRS (ntohl ((int)(((SM_DL_LIST volatile *)(pList))->head))))\ + ) + +/******************************************************************************* +* +* smDllLast - find last node in shared memory list +* +* Finds the last node in a doubly linked shared memory list. +* +* RETURNS +* Local address pointer to the last node in list, or +* LOC_NULL if the list is empty. +* +* NOMANUAL +*/ + +#define SM_DL_LAST(pList) \ + ( \ + (GLOB_TO_LOC_ADRS (ntohl ((int)(((SM_DL_LIST volatile *)(pList))->tail))))\ + ) + + +/******************************************************************************* +* +* smDllNext - find next node in shared memory list +* +* Locates the node immediately after the node pointed to by the pNode. +* +* RETURNS: +* Local address pointer to the next node in the list, or +* LOC_NULL if there is no next node. +* +* NOMANUAL +*/ + +#define SM_DL_NEXT(pNode) \ + ( \ + (GLOB_TO_LOC_ADRS (ntohl ((int)(((SM_DL_NODE volatile *)(pNode))->next))))\ + ) + +/******************************************************************************* +* +* smDllPrevious - find previous node in shared memory doubly linked list +* +* Locates the node immediately before the node pointed to by the pNode. +* +* RETURNS: +* Local address pointer to the preceding node in the list, or +* LOC_NULL if there is no next node. +* +* NOMANUAL +*/ + +#define SM_DL_PREVIOUS(pNode) \ + ( \ + (GLOB_TO_LOC_ADRS (ntohl ((int) \ + ((SM_DL_NODE volatile *) (pNode))->previous))))\ + ) + +/******************************************************************************* +* +* smDllEmpty - boolean function to check for empty shared memory list +* +* RETURNS: +* TRUE if list is empty +* FALSE otherwise +* +* NOMANUAL +*/ + +#define SM_DL_EMPTY(pList) \ + ( \ + (((SM_DL_LIST volatile *)pList)->head == NULL) \ + ) + + +/* function declarations */ + + +#if defined(__STDC__) || defined(__cplusplus) + +extern SM_DL_LIST * smDllCreate (void); +extern SM_DL_NODE * smDllEach (SM_DL_LIST * pList, FUNCPTR routine, + int routineArg); +extern SM_DL_NODE * smDllGet (SM_DL_LIST * pList); +extern STATUS smDllDelete (SM_DL_LIST * pList); +extern STATUS smDllInit (SM_DL_LIST * pList); +extern STATUS smDllTerminate (SM_DL_LIST * pList); +extern int smDllCount (SM_DL_LIST * pList); +extern void smDllAdd (SM_DL_LIST * pList, SM_DL_NODE * pNode); +extern void smDllInsert (SM_DL_LIST * pList, SM_DL_NODE * pPrev, + SM_DL_NODE * pNode); +extern void smDllRemove (SM_DL_LIST * pList, SM_DL_NODE * pNode); +extern void smDllConcat (SM_DL_LIST * pDstList, SM_DL_LIST * pAddList); + +#else /* __STDC__ */ + +extern SM_DL_LIST * smDllCreate (); +extern SM_DL_NODE * smDllEach (); +extern SM_DL_NODE * smDllGet (); +extern STATUS smDllDelete (); +extern STATUS smDllInit (); +extern STATUS smDllTerminate (); +extern int smDllCount (); +extern void smDllAdd (); +extern void smDllInsert (); +extern void smDllRemove (); +extern void smDllConcat (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsmDllLibh */ diff --git a/h/smLib.h b/h/smLib.h new file mode 100644 index 0000000..da0d190 --- /dev/null +++ b/h/smLib.h @@ -0,0 +1,288 @@ +/* smLib.h - include file for VxWorks shared memory common library */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01v,17mar05,bwa added smIsInstAlive(). +01u,31aug04,bwa moved DEFAULT_CPUS_MAX from smPktLib.h (SPR97418). +01t,05mar02,mas added SM_MAX_WAIT (SPR 73371) +01s,14nov01,mas added smLibInit() prototype for future common code base +01r,16mar99,dat added SM_INT_USER_1/2 (SPR 25804) +01q,29jan93,pme changed SM_ALIGN_BOUNDARY to 16. +01p,22sep92,rrr added support for c++ +01o,12sep92,ajm moved previously redundant define DEFAULT_BEATS_TO_WAIT from + smObjLib.h, and smPktLib.h +01n,28jul92,pme added SM_ALIGN_BOUNDARY. +01m,24jul92,elh Moved heartbeat from anchor. +01l,19jul92,pme added external declaration of smCurMaxTries. +01k,23jun92,elh added SM_ constants from if_bp, cleanup. +01j,22jun92,rrr fix decl of smLibInit when __STDC__ is not defined +01i,02jun92,elh the tree shuffle +01h,28may92.elh General clean up. +01g,20may92,pme+ Split even further. Removed USE_OFFSET. + elh Moved pkt specific stuff to smPktLib.h. +01f,13may92,pme Added smObjHeaderAdrs fields to anchor. +01e,03may92,elh Added smNetReserved fields to anchor. +01d,01apr92,elh Removed references to shMemHwTasFunc and + shMemIntGenFunc (now in smUtilLib). + Removed interrupt types. +01c,04feb92,elh ansified +01b,17dec91,elh externed hooks, added ifdef around file, changed VOID + to void. Added masterCpu, user1 and user2, to SM_ANCHOR. + Added S_shMemLib_MEMORY_ERROR. Changed copyright. +01a,15aug90,kdl written. +*/ + +#ifndef __INCsmLibh +#define __INCsmLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vwModNum.h" + + +/* defines */ + +/* Error codes */ + +#define S_smLib_MEMORY_ERROR (M_smLib | 1) +#define S_smLib_INVALID_CPU_NUMBER (M_smLib | 2) +#define S_smLib_NOT_ATTACHED (M_smLib | 3) +#define S_smLib_NO_REGIONS (M_smLib | 4) + +/* Miscellaneous Constants */ + +#define SM_READY ((UINT) 0x87654321) + /* value set in anchor when init'd */ +#define SM_MASTER 0 /* default CPU 0 is master */ + +#define SM_ALIGN_BOUNDARY 16 /* shared memory address alignement */ + +/* default values */ + +#define SM_REGIONS_MAX 20 /* max number of regions */ +#define DEFAULT_CPUS_MAX 10 /* max number of CPUs */ +#define DEFAULT_ALIVE_TIMEOUT 600 /* default seconds to wait for h'beat */ +#define DEFAULT_BEATS_TO_WAIT 5 /* beats to wait 'til believe sm dead */ +#define SM_MAX_WAIT 3000 /* max ticks to wait for master boot */ + +/* Test-and-set type values */ + +#define SM_TAS_SOFT 0 /* software test-and-set */ +#define SM_TAS_HARD 1 /* hardware test-and-set */ + +/* CPU status values */ + +#define SM_CPU_ATTACHED 1 /* cpu attached to shared mem */ +#define SM_CPU_NOT_ATTACHED 0 /* cpu not attached */ + +/* backplane interrupt methods */ + +#define SM_INT_NONE 0 /* no interrupt - poll instead */ + + /* mailbox write interrupts */ +#define SM_INT_MAILBOX_1 1 /* write byte */ +#define SM_INT_MAILBOX_2 2 /* write word */ +#define SM_INT_MAILBOX_4 3 /* write long */ + + /* arg1 = bus address space + * arg2 = bus address + * arg3 = value + */ + +#define SM_INT_BUS 4 /* vme bus interrupt */ + /* arg1 = interrupt level + * arg2 = interrupt vector + * arg3 = N/A + */ + + /* mailbox read interrupts */ + /* arg1 = bus address space + * arg2 = bus address + * arg3 = value + */ +#define SM_INT_MAILBOX_R1 5 /* read byte */ +#define SM_INT_MAILBOX_R2 6 /* read word */ +#define SM_INT_MAILBOX_R4 7 /* read long */ + +#define SM_INT_USER_1 8 /* User defined proc #1 */ + /* (smUtilUser1Rtn)(arg1,arg2,arg3)*/ +#define SM_INT_USER_2 9 /* User defined proc #2 */ + /* (smUtilUser2Rtn)(arg1,arg2,arg3)*/ + +#define SM_OFFSET_TO_LOCAL(offset , baseAddr, typeCast) \ + ((typeCast) ((char *) offset + baseAddr)) + +#define SM_LOCAL_TO_OFFSET(localAdrs, baseAddr) \ + ((int) ((char *) localAdrs - baseAddr)) + + +/* typedefs */ + +#ifndef _ASMLANGUAGE + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* CPU Descriptor */ + +typedef struct sm_cpu_desc /* SM_CPU_DESC */ + { + int status; /* CPU status - attached/unattached */ + int intType; /* interrupt type */ + int intArg1; /* interrupt argument #1 */ + int intArg2; /* interrupt argument #2 */ + int intArg3; /* interrupt argument #3 */ + int reserved1; /* (future use) */ + int reserved2; /* (future use) */ + } SM_CPU_DESC; + + +/* Shared Memory Header */ + +typedef struct sm_hdr /* SM_HDR */ + { + int tasType; /* test-and-set type (test-and-set-and-check?)*/ + int maxCpus; /* maximum number of CPU's in table */ + int cpuTable; /* CPU descriptor table (offset) */ + int reserved1; /* (future use) */ + int reserved2; /* (future use) */ + int reserved3; /* (future use) */ + int reserved4; /* (future use) */ + int reserved5; /* (future use) */ + int reserved6; /* (future use) */ + int reserved7; /* (future use) */ + int reserved8; /* (future use) */ + } SM_HDR; + + +/* Shared Memory Anchor */ + +typedef struct sm_anchor /* SM_ANCHOR */ + { + UINT readyValue; /* set to SM_READY when sh mem init'd */ + int version; /* version number */ + int masterCpu; /* shared memory master */ + int smHeader; /* offset of shared mem header */ + int smPktHeader; /* offset of smPkt header */ + int smObjHeader; /* offset of smObj header */ + int user1; /* user defined space 1 */ + int user2; /* user defined space 2 */ + int reserved1; /* (future use) */ + int reserved2; /* (future use) */ + int reserved3; /* (future use) */ + } SM_ANCHOR; + +/* Shared Memory Descriptor (maintained by each CPU) */ + +typedef struct sm_desc /* SM_DESC */ + { + int status; /* cpu status (attached/not attached) */ + SM_ANCHOR *anchorLocalAdrs;/* local addr of sh mem anchor */ + SM_HDR *headerLocalAdrs;/* local addr of sh mem header */ + SM_CPU_DESC *cpuTblLocalAdrs;/* local addr of cpu descriptor tbl */ + int base; /* base address */ + int cpuNum; /* this CPU's number */ + int ticksPerBeat; /* cpu ticks per sh mem heartbeat */ + int intType; /* interrupt type */ + int intArg1; /* interrupt argument #1 */ + int intArg2; /* interrupt argument #2 */ + int intArg3; /* interrupt argument #3 */ + int maxCpus; /* max number of CPU's using sh mem */ + FUNCPTR tasRoutine; /* addr of TAS routine to use */ + FUNCPTR tasClearRoutine;/* addr of TAS clear routine to use */ + } SM_DESC; + + +/* Shared Memory Information Structure */ + +typedef struct sm_info /* SM_INFO */ + { + int version; /* shared memory protocol version */ + int tasType; /* test-and-set method */ + int maxCpus; /* maximum number of cpu's */ + int attachedCpus; /* number of cpu's currently attached */ + } SM_INFO; + + +/* CPU Information Structure */ + +typedef struct sm_cpu_info /* SM_CPU_INFO */ + { + int cpuNum; /* cpu number */ + int status; /* cpu status - attached/unattached */ + int intType; /* interrupt type */ + int intArg1; /* interrupt argument #1 */ + int intArg2; /* interrupt argument #2 */ + int intArg3; /* interrupt argument #3 */ + } SM_CPU_INFO; + +typedef struct sm_region /* shared memory region */ + { + SM_ANCHOR * anchor; /* shared memory anchor */ + } SM_REGION; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* Variable Declaration */ + +extern int smCurMaxTries; /* current maximum # of tries to get lock */ +extern VOIDFUNCPTR smUtilTasClearRtn; +extern FUNCPTR smUtilUser1Rtn; +extern FUNCPTR smUtilUser2Rtn; + +/* Function Declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void smLibInit (void * pRgnCfgTbl, UINT objSize, UINT netSize); +extern STATUS smSetup (SM_ANCHOR *anchorLocalAdrs, char *smLocalAdrs, + int tasType, int maxCpus, int * pMemUsed); +extern STATUS smAttach (SM_DESC *pSmDesc); +extern STATUS smDetach (SM_DESC *pSmDesc); +extern void smInit (SM_DESC *pSmDesc, SM_ANCHOR *anchorLocalAdrs, + int ticksPerBeat, int intType, int intArg1, + int intArg2, int intArg3); +extern BOOL smIsInstAlive (SM_ANCHOR *pAnchor, int *pHeader, int base, + int heartBeats, int ticksPerBeat, int offset); +extern BOOL smIsAlive (SM_ANCHOR *pAnchor, int *pHeader, int base, + int heartBeats, int ticksPerBeat); +extern STATUS smLockTake (int * lockLocalAdrs, FUNCPTR tasRoutine, + int numTries, int * pOldLvl); +extern void smLockGive (int *lockLocalAdrs, FUNCPTR tasClearRoutine, + int oldLvl); +extern STATUS smInfoGet (SM_DESC *pSmDesc, SM_INFO *pInfo); +extern STATUS smCpuInfoGet (SM_DESC *pSmDesc, int cpuNum, + SM_CPU_INFO *pCpuInfo); + + +#else /* __STDC__ */ + +extern void smLibInit (); +extern STATUS smSetup (); +extern STATUS smAttach (); +extern STATUS smDetach (); +extern void smInit (); +extern BOOL smIsAlive (); +extern STATUS smLockTake (); +extern void smLockGive (); +extern STATUS smInfoGet (); +extern STATUS smCpuInfoGet (); + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsmLibh */ diff --git a/h/smMemLib.h b/h/smMemLib.h new file mode 100644 index 0000000..96812e3 --- /dev/null +++ b/h/smMemLib.h @@ -0,0 +1,62 @@ +/* smMemLib.h - shared memory management library header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01g,29jan93,pme made smMemAddToPool() return STATUS. +01f,15oct92,rrr silenced warnings +01e,29sep92,pme changed user callable routine names + moved smMemPartShow prototype to private/smMemPartLibP.h +01d,22sep92,rrr added support for c++ +01c,28jul92,pme made smMemPartCreate return PART_ID instead of SM_PART_ID. +01b,28jul92,pme removed unnecessary includes. +01a,19jul92,pme written from 03f memLib.h +*/ + +#ifndef __INCsmMemLibh +#define __INCsmMemLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "memLib.h" + +typedef struct sm_obj_partition * SM_PART_ID; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern PART_ID memPartSmCreate (char * pPool, unsigned poolSize); +extern STATUS smMemFree (void * ptr); +extern int smMemFindMax (void); +extern void * smMemMalloc (unsigned nBytes); +extern void * smMemCalloc (int elemNum, int elemSize); +extern void * smMemRealloc (void * pBlock, unsigned newSize); +extern STATUS smMemAddToPool (char * pPool, unsigned poolSize); +extern STATUS smMemOptionsSet (unsigned options); +extern void smMemShowInit (void); +extern void smMemShow (int type); + +#else /* __STDC__ */ + +extern PART_ID memPartSmCreate (); +extern STATUS smMemFree (); +extern int smMemFindMax (); +extern void * smMemMalloc (); +extern void * smMemCalloc (); +extern void * smMemRealloc (); +extern STATUS smMemAddToPool (); +extern STATUS smMemOptionsSet (); +extern void smMemShowInit (); +extern void smMemShow (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsmMemLibh */ diff --git a/h/smNameLib.h b/h/smNameLib.h new file mode 100644 index 0000000..09ee211 --- /dev/null +++ b/h/smNameLib.h @@ -0,0 +1,74 @@ +/* smNameLib.h - shared memory name database library header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01c,29sep92,pme changed function names and changed smObjId parameter to value. + changed S_smNameLib_ID_NOT_FOUND to S_smNameLib_VALUE_NOT_FOUND +01b,22sep92,rrr added support for c++ +01a,19jul92,pme cleaned up according to code review. + written. +*/ + +#ifndef __INCsmNameLibh +#define __INCsmNameLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "smDllLib.h" + +/* generic status codes */ + +#define S_smNameLib_NOT_INITIALIZED (M_smNameLib | 1) +#define S_smNameLib_NAME_TOO_LONG (M_smNameLib | 2) +#define S_smNameLib_NAME_NOT_FOUND (M_smNameLib | 3) +#define S_smNameLib_VALUE_NOT_FOUND (M_smNameLib | 4) +#define S_smNameLib_NAME_ALREADY_EXIST (M_smNameLib | 5) +#define S_smNameLib_DATABASE_FULL (M_smNameLib | 6) +#define S_smNameLib_INVALID_WAIT_TYPE (M_smNameLib | 7) + +#define MAX_NAME_LENGTH 19 /* maximum lengh of a name in database */ + +/* default object types */ + +#define MAX_DEF_TYPE 5 /* number of predefined types */ + +#define T_SM_SEM_B 0 /* shared binary semaphore type */ +#define T_SM_SEM_C 1 /* shared counting semaphore type */ +#define T_SM_MSG_Q 2 /* shared message queue type */ +#define T_SM_PART_ID 3 /* shared memory partition type */ +#define T_SM_BLOCK 4 /* shared memory allocated block type */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS smNameAdd (char * name, void * value, int type); +extern STATUS smNameFind (char * name, void ** pValue, + int * pType, int waitType); +extern STATUS smNameFindByValue (void * value, char * name, + int * pType, int waitType); +extern STATUS smNameRemove (char * name); +extern void smNameShowInit (void); +extern STATUS smNameShow (int level); + +#else + +extern STATUS smNameAdd (); +extern STATUS smNameFind (); +extern STATUS smNameFindByValue (); +extern STATUS smNameRemove (); +extern void smNameShowInit (); +extern STATUS smNameShow (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsmNameLibh */ diff --git a/h/smObjLib.h b/h/smObjLib.h new file mode 100644 index 0000000..698cb35 --- /dev/null +++ b/h/smObjLib.h @@ -0,0 +1,252 @@ +/* smObjLib.h - shared memory object library header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01m,21nov03,dat adding objLib.h +01l,03may02,mas made global pointers volatile (SPR 68334) +01k,01aug94,dvs backed out pme's changes for reserved fields in main data structures. +01j,20mar94,pme added reserved fields in main data structures to allow + compatibility between future versions. +01i,29jan93,pme added little endian support + made smObjLibInit() return STATUS. +01h,15oct92,rrr silenced warnings +01g,29sep92,pme added version number +01f,22sep92,rrr added support for c++ +01e,11sep92,ajm moved redundant define of DEFAULT_BEATS_TO_WAIT to smLib.h +01d,30jul92,pme made SM_LOCK_GIVE() call smLockGive(). + added pre-declaration of smObjTasClearRoutine. +01c,24jul92,elh added heartbeat to header. +01b,22jul92,pme added S_smObjLib_NO_OBJECT_DESTROY status +01a,19jul92,pme added DEFAULT_BEATS_TO_WAIT. + written. +*/ + +#ifndef __INCsmObjLibh +#define __INCsmObjLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "smDllLib.h" +#include "smLib.h" +#include "objLib.h" +#include "netinet/in.h" +#include "private/smFixBlkLibP.h" +#include "private/smMemLibP.h" +#include "private/smNameLibP.h" + +/* generic status codes */ + +#define S_smObjLib_NOT_INITIALIZED (M_smObjLib | 1) +#define S_smObjLib_NOT_A_GLOBAL_ADRS (M_smObjLib | 2) +#define S_smObjLib_NOT_A_LOCAL_ADRS (M_smObjLib | 3) +#define S_smObjLib_SHARED_MEM_TOO_SMALL (M_smObjLib | 4) +#define S_smObjLib_TOO_MANY_CPU (M_smObjLib | 5) +#define S_smObjLib_LOCK_TIMEOUT (M_smObjLib | 6) +#define S_smObjLib_NO_OBJECT_DESTROY (M_smObjLib | 7) + +#define SM_OBJ_MAX_CPU 20 /* absolute maximum number of CPU */ + +/* useful shared memory object ids handling macros */ + +#define ID_IS_LOCAL(id) ((((UINT32) id) & 1) == 0) +#define ID_IS_SHARED(id) ((((UINT32) id) & 1) != 0) +#define SM_OBJ_ID_TO_ADRS(id) (((int)(id)) + smObjPoolMinusOne) +#define SM_OBJ_ADRS_TO_ID(adrs) (((int)(adrs)) - smObjPoolMinusOne) + +/* local to global and global to local address conversion; local NULL pointer */ + +#define GLOB_TO_LOC_ADRS(adrs) (((int)(adrs)) + localToGlobalOffset) +#define LOC_TO_GLOB_ADRS(adrs) (((int)(adrs)) - localToGlobalOffset) +#define LOC_NULL ((void *)localToGlobalOffset) + + +/******************************************************************************* +* +* SM_OBJ_VERIFY - check the validity of a shared memory object +* +* This macro verifies the validity of the specified shared memory object by +* comparing the id and its verify field. +* +* RETURNS: OK or ERROR if invalid shared memory object +* +* ERRNO: +* +* S_objLib_OBJ_ID_ERROR +* +* NOMANUAL +*/ + +#define SM_OBJ_VERIFY(smObjId) \ + ( \ + ((LOC_TO_GLOB_ADRS ((smObjId))) == ntohl ((smObjId->verify))) ? OK \ + : \ + (errno = S_objLib_OBJ_ID_ERROR, ERROR) \ + ) + +/******************************************************************************* +* +* SM_OBJ_LOCK_TAKE - acquire lock access on a shared ressource +* +* This macro tries to acquire exclusive access to a shared ressource +* via a test-and-set on a long word memory location. It uses shMemLockTake +* with smObjSpinTries tries to get lock using smObjTasRoutine test and +* set routine (usually sysBusTas). +* +* NOMANUAL +*/ + +#define SM_OBJ_LOCK_TAKE(lockLocalAdrs, pOldLvl) \ + (smLockTake ((int *) lockLocalAdrs, smObjTasRoutine, \ + smObjSpinTries, (int *) pOldLvl)) + +/******************************************************************************* +* +* SM_OBJ_LOCK_GIVE - release lock access on a shared ressource +* +* This macro release exclusive access to a shared ressource by clearing +* a long word memory location. +* +* NOMANUAL +*/ + +#define SM_OBJ_LOCK_GIVE(lockLocalAdrs,oldLvl) \ + (smLockGive ((int *) lockLocalAdrs, smObjTasClearRoutine, \ + oldLvl)) + +/* typedefs */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* shared memory object header located on top of shared memory pool */ + +typedef struct sm_obj_mem_hdr /* SM_OBJ_MEM_HDR - shared memory header */ + { + UINT heartBeat; /* incremented via smObjBeat() */ + BOOL initDone; /* TRUE if initialization done */ + UINT version; /* version number */ + SM_FIX_BLK_PART smTcbPart; /* partition for shared TCB's */ + SM_PARTITION smSemPart; /* partition for shared semaphores */ + SM_PARTITION smNamePart;/* partition for shared names */ + SM_PARTITION smMsgQPart;/* partition for shared msgQ */ + SM_PARTITION smPartPart;/* partition for shared user partitions */ + SM_PARTITION smSysPart; /* default shared system partition */ + SM_OBJ_NAME_DB nameDtb; /* name database header */ + int objCpuTbl; /* smObj descriptor table (offset) */ + + int maxSems; /* max number of semaphores */ + int maxMsgQueues; /* max number of messages queues */ + int maxTasks; /* max number of tasks */ + int maxMemParts; /* max number of shared memory partitions */ + int maxNames; /* max number of name of shared objects */ + + int curNumSemB; /* current number of binary semaphores */ + int curNumSemC; /* current number of counting semaphores */ + int curNumMsgQ; /* current number of messages queues */ + int curNumTask; /* current number of tasks */ + int curNumPart; /* current number of shared partitions */ + int curNumName; /* current number of names */ + + } SM_OBJ_MEM_HDR; + +#define smSemPartId (&pSmObjHdr->smSemPart) +#define smNamePartId (&pSmObjHdr->smNamePart) +#define smMsgQPartId (&pSmObjHdr->smMsgQPart) +#define smPartPartId (&pSmObjHdr->smPartPart) +#define smSystemPartId (&pSmObjHdr->smSysPart) + +typedef struct sm_obj_event_q /* SM_OBJ_EVENT_Q - events input queue */ + { + UINT32 lock; /* multi processor lock */ + SM_DL_LIST eventList; /* list of smObj events */ + } SM_OBJ_EVENT_Q; + +/* per CPU shared memory object Descriptor */ + +typedef struct sm_obj_cpu_desc /* SM_OBJ_CPU_DESC */ + { + int status; /* CPU status - attached/unattached */ + SM_OBJ_EVENT_Q smObjEventQ; /* smObj CPU event queue */ + } SM_OBJ_CPU_DESC; + +typedef struct sm_obj_desc /* SM_OBJ_DESC - shared memory object descriptor */ + { + int status; + SM_DESC smDesc; /* shared memory descriptor */ + SM_OBJ_MEM_HDR * hdrLocalAdrs; /* smObj memory header local adrs */ + SM_OBJ_CPU_DESC * cpuLocalAdrs; /* smObj cpu descriptor local adrs */ + } SM_OBJ_DESC; + +typedef struct sm_obj_params /* setup parameters */ + { + BOOL allocatedPool; /* TRUE if shared memory pool is malloced */ + SM_ANCHOR * pAnchor; /* shared memory anchor */ + char * smObjFreeAdrs; /* start address of shared memory pool */ + int smObjMemSize; /* memory size reserved for shared memory */ + int maxCpus; /* max number of CPU in the system */ + int maxTasks; /* max number of tasks using smObj */ + int maxSems; /* max number of shared semaphores */ + int maxMsgQueues; /* max number of shared message queues */ + int maxMemParts; /* max number of shared memory partitions */ + int maxNames; /* max number of name of shared objects */ + } SM_OBJ_PARAMS; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* variable declarations */ + +extern int smObjProcNum; /* processor number */ +extern int smObjPoolMinusOne; /* smObj pool local address - 1 */ +extern int localToGlobalOffset; /* localAdrs - globalAdrs */ +extern FUNCPTR smObjTasRoutine; /* test and set routine */ +extern FUNCPTR smObjTasClearRoutine; /* clear routine */ +extern int smObjSpinTries; /* maximum retries for lock access */ +extern SM_HDR volatile * pSmHdr; /* pointer to shared memory header */ +extern SM_OBJ_MEM_HDR volatile * pSmObjHdr; /* pointer to sm objects header */ +extern SM_OBJ_DESC smObjDesc; /* shared memory object descriptor */ + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS smObjLibInit (void); +extern STATUS smObjSetup (SM_OBJ_PARAMS * smObjParams); +extern void smObjInit (SM_OBJ_DESC * pSmObjDesc, SM_ANCHOR * pAnchor, + int ticksPerBeat, int smObjMaxTries, int intType, + int intArg1, int intArg2, int intArg3); +extern STATUS smObjAttach (SM_OBJ_DESC * pSmObjDesc); +extern void * smObjLocalToGlobal (void * localAdrs); +extern void * smObjGlobalToLocal (void * globalAdrs); +extern void smObjTimeoutLogEnable (BOOL timeoutLogEnable); +extern void smObjShowInit (void); +extern STATUS smObjShow (void); + +#else /* __STDC__ */ + +extern STATUS smObjLibInit (); +extern STATUS smObjSetup (); +extern void smObjInit (); +extern STATUS smObjAttach (); +extern void * smObjLocalToGlobal (); +extern void * smObjGlobalToLocal (); +extern void smObjTimeoutLogEnable (); +extern void smObjShowInit (); +extern STATUS smObjShow (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsmObjLibh */ diff --git a/h/smPktLib.h b/h/smPktLib.h new file mode 100644 index 0000000..5ce0617 --- /dev/null +++ b/h/smPktLib.h @@ -0,0 +1,222 @@ +/* smPktLib.h - include file for VxWorks shared packets protocol library */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02h,17mar05,bwa added smPktAttachTo(), smPktSetupInst(). +02g,31aug04,bwa moved DEFAULT_CPUS_MAX to smLib.h (SPR97418). +02f,11mar02,mas added SM_MAX_PKTS (SPR 73371) +02e,22sep92,rrr added support for c++ +02d,11sep92,ajm moved redundant define of DEFAULT_BEATS_TO_WAIT to smLib.h +02c,29jul92,pme changed DEFAULT_CPUS_MAX to 10. +02b,24jul92,elh Moved heartbeat to header from anchor. +02a,04jul92,jcf cleaned up. +01h,02jun92,elh the tree shuffle +01g,27may92,elh split from shMemLib, general cleanup. +01f,13may92,pme Added smObjHeaderAdrs fiels to anchor. +01e,03may92,elh Added smNetReserved fields to anchor. +01d,01apr92,elh Removed references to shMemHwTasFunc and + shMemIntGenFunc (now in smUtilLib). + Removed interrupt types. +01c,04feb92,elh ansified +01b,17dec91,elh externed hooks, added ifdef around file, changed VOID + to void. Added masterCpu, user1 and user2, to SM_ANCHOR. + Added S_shMemLib_MEMORY_ERROR. Changed copyright. +01a,15aug90,kdl written. +*/ + +#ifndef __INCsmPktLibh +#define __INCsmPktLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vwModNum.h" +#include "smLib.h" + +/* defines */ + +/* Error codes */ + +#define S_smPktLib_SHARED_MEM_TOO_SMALL (M_smPktLib | 1) +#define S_smPktLib_MEMORY_ERROR (M_smPktLib | 2) +#define S_smPktLib_DOWN (M_smPktLib | 3) +#define S_smPktLib_NOT_ATTACHED (M_smPktLib | 4) +#define S_smPktLib_INVALID_PACKET (M_smPktLib | 5) +#define S_smPktLib_PACKET_TOO_BIG (M_smPktLib | 6) +#define S_smPktLib_INVALID_CPU_NUMBER (M_smPktLib | 7) +#define S_smPktLib_DEST_NOT_ATTACHED (M_smPktLib | 8) +#define S_smPktLib_INCOMPLETE_BROADCAST (M_smPktLib | 9) +#define S_smPktLib_LIST_FULL (M_smPktLib | 10) +#define S_smPktLib_LOCK_TIMEOUT (M_smPktLib | 11) + +/* Miscellaneous Constants */ + +#define SM_BROADCAST 0xbbbbbbbb /* dest cpu number to send to all cpus*/ + +#define SM_FLUSH 0 /* dont flush queued packets */ +#define SM_NO_FLUSH 1 + +/* default values */ + +#define DEFAULT_MEM_SIZE 0x10000 /* default memory size */ +#define DEFAULT_PKT_SIZE 2176 /* default packet size */ +#define DEFAULT_PKTS_MAX 200 /* max input packets */ +#define SM_MAX_PKTS 200 /* max #packets to support */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* Packet List Node */ + +typedef struct sm_sll_node /* SM_SLL_NODE */ + { + int next; /* ptr to next node in list */ + } SM_SLL_NODE; + + +/* Packet Singly-Linked List */ + +typedef struct sm_sll_list /* SM_SLL_LIST */ + { + int lock; /* mutual exclusion lock (for TAS) */ + int head; /* head (first node) of list (offset) */ + int tail; /* tail (last node) of list (offset) */ + int count; /* number of packets currently in list */ + int limit; /* max number of packets allowed in list */ + } SM_SLL_LIST; + +/* Packet Header */ + +typedef struct sm_pkt_hdr /* SM_PKT_HDR */ + { + SM_SLL_NODE node; /* node header for linked lists */ + int type; /* packet type */ + int nBytes; /* number of bytes of data in packet */ + int srcCpu; /* source CPU number */ + int ownerCpu; /* owner CPU number (future use) */ + int reserved1; /* (future use) */ + int reserved2; /* (future use) */ + } SM_PKT_HDR; + +/* Packet */ + +typedef struct sm_pkt /* SM_PKT */ + { + SM_PKT_HDR header; /* packet header */ + char data [1]; /* data buffer (actual size = maxPktBytes) */ + } SM_PKT; + + +/* per CPU Packet Descriptor */ + +typedef struct sm_pkt_cpu_desc /* SM_PKT_CPU_DESC */ + { + int status; /* CPU status - attached/unattached */ + SM_SLL_LIST inputList; /* input list of packets */ + SM_SLL_LIST freeList; /* free list of packets (future use) */ + } SM_PKT_CPU_DESC; + + +/* Shared Memory Packet Memory Header */ + +typedef struct sm_pkt_mem_hdr /* SM_PKT_MEM_HDR */ + { + UINT heartBeat; /* incremented via smPktBeat() */ + SM_SLL_LIST freeList; /* global list of free packets */ + int pktCpuTbl; /* packet descriptor table (offset) */ + int maxPktBytes; /* max size of packet data (in bytes) */ + int reserved1; /* (future use) */ + int reserved2; /* (future use) */ + } SM_PKT_MEM_HDR; + +typedef struct sm_pkt_desc /* SM_PKT_DESC */ + { + int status; + SM_DESC smDesc; /* shared memory descriptor */ + int maxPktBytes; /* max size of packet buffer */ + int maxInputPkts; /* max packets allowed in queue */ + SM_PKT_MEM_HDR * hdrLocalAdrs; /* pkt memory header local adrs */ + SM_PKT_CPU_DESC * cpuLocalAdrs; /* pkt cpu local adrs */ + } SM_PKT_DESC; + +/* Shared Memory Packet Information Structure */ + +typedef struct sm_pkt_info /* SM_INFO */ + { + SM_INFO smInfo; + int attachedCpus; /* number of cpu's currently attached */ + int maxPktBytes; /* max number of data bytes in packet */ + int totalPkts; /* total number of sh mem packets */ + int freePkts; /* number of packets currently free */ + } SM_PKT_INFO; + +/* CPU Information Structure */ + +typedef struct sm_pkt_cpu_info /* SM_CPU_INFO */ + { + SM_CPU_INFO smCpuInfo; + int status; /* cpu status - attached/unattached */ + int maxInputPkts; /* max packets allowed in input queue */ + int inputPkts; /* current count of input pkts queued */ + int totalPkts; /* (future use) */ + int freePkts; /* (future use) */ + } SM_PKT_CPU_INFO; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* Function Declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS smPktFreeGet (SM_PKT_DESC *pSmPktDesc, SM_PKT **ppPkt); +extern STATUS smPktFreePut (SM_PKT_DESC *pSmPktDesc, SM_PKT *pPkt); +extern STATUS smPktRecv (SM_PKT_DESC *pSmPktDesc, SM_PKT **ppPkt); +extern STATUS smPktSend (SM_PKT_DESC *pSmPktDesc, SM_PKT *pPkt, int destCpu); +extern STATUS smPktSetup (SM_ANCHOR * anchorLocalAdrs, char * smLocalAdrs, + int smSize, int tasType, int maxCpus, + int maxPktBytes); +extern STATUS smPktSetupInst (SM_ANCHOR * anchorLocalAdrs, char * smLocalAdrs, + int smSize, int tasType, int maxCpus, + int maxPktBytes, int instance); +extern void smPktInit (SM_PKT_DESC *pSmPktDesc, SM_ANCHOR *anchorLocalAdrs, + int maxInputPkts, int ticksPerBeat, int intType, + int intArg1, int intArg2, int intArg3); +extern STATUS smPktAttach (SM_PKT_DESC *pSmPktDesc); +extern STATUS smPktAttachTo (SM_PKT_DESC *pSmPktDesc, int instance); +extern STATUS smPktDetach (SM_PKT_DESC *pSmPktDesc, BOOL noFlush); +extern STATUS smPktInfoGet (SM_PKT_DESC *pSmPktDesc, SM_PKT_INFO *pInfo); +extern STATUS smPktCpuInfoGet (SM_PKT_DESC *pSmPktDesc, int cpuNum, + SM_PKT_CPU_INFO *pCpuInfo); +extern void smPktBeat (SM_PKT_MEM_HDR *pSmPktHdr); + + +#else /* __STDC__ */ + +extern STATUS smPktFreeGet (); +extern STATUS smPktFreePut (); +extern STATUS smPktInfoGet (); +extern STATUS smPktRecv (); +extern STATUS smPktSend (); +extern STATUS smPktSetup (); +extern void smPktInit (); +extern STATUS smPktDetach (); +extern STATUS smPktInfoGet (); +extern STATUS smPktCpuInfoGet (); +extern void smPktBeat (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsmPktLibh */ diff --git a/h/smUtilLib.h b/h/smUtilLib.h new file mode 100644 index 0000000..f99e803 --- /dev/null +++ b/h/smUtilLib.h @@ -0,0 +1,96 @@ +/* smUtilLib.h - include file for VxWorks shared memory utility library */ + +/* Copyright 1984-1999, 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02e,17mar05,bwa added TIPC_PRIORITY priority type. +02d,16mar99,dat smUtilIntRoutine is made global (SPR 25804) +02c,09feb96,dat chg'd arg for smUtilSoftTas to be volatile +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01c,23jun92,elh cleanup. +01b,02jun92,elh the tree shuffle + -changed includes to have absolute path from h/ +01a,07feb92,elh created. +*/ + +#ifndef __INCsmUtilLibh +#define __INCsmUtilLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "netinet/in.h" +#include "string.h" +#include "intLib.h" +#include "stdio.h" +#include "errno.h" + +/* defines */ + +/* priority types of routines connected to shared memory interrupts */ + +#define LOW_PRIORITY 0x00 +#define TIPC_PRIORITY 0x80 +#define HIGH_PRIORITY 0xff + + +/* typedefs */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* shared memory event handling routines */ + +typedef struct /* SM_ROUTINE - shared memory routine */ + { + FUNCPTR routine; /* routine to call */ + int param; /* routine parameter */ + } SM_ROUTINE; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* function prototypes */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS smUtilMemProbe (char *pAddr, int op, int size, char *pVal); +extern BOOL smUtilSoftTas (volatile int * lockLocalAdrs); +extern BOOL smUtilTas (char * adrs); +extern void smUtilTasClear (char * adrs); +extern int smUtilProcNumGet (void); +extern STATUS smUtilDelay (char * pAddr, int ticks); +extern int smUtilRateGet (void); +extern STATUS smUtilIntGen (SM_CPU_DESC *pCpuDesc, int cpuNum); +extern STATUS smUtilIntConnect (int priorityType, FUNCPTR routine, + int param, int intType, + int intArg1, int intArg2, int intArg3); +extern void smUtilIntRoutine (void); +#else + +extern STATUS smUtilMemProbe (); +extern BOOL smUtilSoftTas (); +extern BOOL smUtilTas (); +extern void smUtilTasClear (); +extern int smUtilProcNumGet (); +extern STATUS smUtilDelay (); +extern int smUtilRateGet (); +extern STATUS smUtilIntGen (); +extern STATUS smUtilIntConnect (); +extern void smUtilIntRoutine (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsmUtilLibh */ diff --git a/h/snark.h b/h/snark.h new file mode 100644 index 0000000..42701da --- /dev/null +++ b/h/snark.h @@ -0,0 +1,38 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/vxworks/snark.h,v 1.1.1.1 2001/11/05 17:47:17 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: snark.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:17 tneale + * Tornado shuffle + * + * Revision 1.1 2000/01/27 18:25:30 josh + * initial checkin of porting files for vxWorks + * + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + +#include + +#define vsnprintf(w, x, y, z) vsprintf(w, y, z) + diff --git a/h/snmpdLib.h b/h/snmpdLib.h new file mode 100644 index 0000000..834f81b --- /dev/null +++ b/h/snmpdLib.h @@ -0,0 +1,110 @@ +/* snmpdLib.h - VxWorks SNMP Agent */ + +/* Copyright 1984-1994 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01e,02oct98,ann added missing function prototypes (SPR# 7017) +01d,30apr98,ann changed snmpVbPrivFree prototype to avoid + conflict with master-subagent. +01c,07jun96,rjc removed extra } #ifdef'd under _cplusplus +01b,16may96,rjc rewritten for snmp v1/v2c product +01a,18feb94,elh written. +*/ + +#ifndef __INCsnmpdLibh +#define __INCsnmpdLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" +#include +#include +#include +#include /* for htonl, ntohl etc */ + + +#define MAX_OID_LEN 128 /* Max no of components in an OID */ + +#define SNMP_ERROR 1 /* error messages */ +#define SNMP_WARN 2 /* warning messages */ +#define SNMP_INFO 3 /* information messages */ + + +#define S_snmpdLib_VIEW_CREATE_FAILURE (M_snmpdLib | 1) +#define S_snmpdLib_VIEW_INSTALL_FAILURE (M_snmpdLib | 2) +#define S_snmpdLib_VIEW_MASK_FAILURE (M_snmpdLib | 3) +#define S_snmpdLib_VIEW_DEINSTALL_FAILURE (M_snmpdLib | 4) +#define S_snmpdLib_VIEW_LOOKUP_FAILURE (M_snmpdLib | 5) +#define S_snmpdLib_MIB_ADDITION_FAILURE (M_snmpdLib | 6) +#define S_snmpdLib_NODE_NOT_FOUND (M_snmpdLib | 7) +#define S_snmpdLib_INVALID_SNMP_VERSION (M_snmpdLib | 8) +#define S_snmpdLib_TRAP_CREATE_FAILURE (M_snmpdLib | 9) +#define S_snmpdLib_TRAP_BIND_FAILURE (M_snmpdLib | 10) +#define S_snmpdLib_TRAP_ENCODE_FAILURE (M_snmpdLib | 11) +#define S_snmpdLib_INVALID_OID_SYNTAX (M_snmpdLib | 12) + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void snmpdPktProcess (int, char *, void *, void *, void *); +extern void snmpdLog (int, char *); +extern STATUS snmpdTreeAdd (char *, MIBNODE_T *); +extern void snmpdTreeRemove (char *); +extern STATUS snmpdViewEntrySet (OIDC_T *, int, UINT_16_T, uchar_t *, int, + int); +extern void snmpdViewEntryRemove (OIDC_T *, int, UINT_16_T); +extern int snmpOidToIpHostOrder (int, OIDC_T *, ulong_t *); + +extern void snmpdTrapSend (void *, int, void **, void *, int, char *, + OIDC_T *, int, u_long *, int, int, int, FUNCPTR, + void *); +extern STATUS snmpNextIndex (int, const OIDC_T *, OIDC_T * , const OIDC_T *, int); +extern void snmpdGroupByGetprocAndInstance (SNMP_PKT_T *, VB_T *, int, OIDC_T *); +extern void snmpdContinue (SNMP_PKT_T *); +extern void snmpNextError (SNMP_PKT_T *, VB_T *); +extern void snmpVbPrivFree (VB_T *); +extern int snmpOidStrToArray (char *, OIDC_T *); +extern void snmpdInitFinish (VOIDFUNCPTR, FUNCPTR, FUNCPTR, FUNCPTR, FUNCPTR); +extern STATUS snmpdPktLockGet (SNMP_PKT_T *); + +#else /* __STDC__ */ + +extern void snmpdPktProcess (); +extern void snmpdLog (); +extern STATUS snmpdTreeAdd (); +extern void snmpdTreeRemove (); +extern int snmpdViewEntrySet (); +extern void snmpdViewEntryRemove (); +extern int snmpOidToIpHostOrder (); +extern void snmpdTrapSend (); +extern int snmpNextIndex (); +extern void groupVarBinds (); +extern void snmpNextError (); +extern void snmpVbPrivFree (); +extern int snmpOidStrToArray (); +extern void snmpdInitFinish (); +extern STATUS snmpdPktLockGet (); +extern void snmpdGroupByGetprocAndInstance (); +extern void snmpdContinue (); + + +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif + + +#endif /* __INCsnmpdLibh */ + + diff --git a/h/snmptalk.h b/h/snmptalk.h new file mode 100644 index 0000000..cf3f80e --- /dev/null +++ b/h/snmptalk.h @@ -0,0 +1,44 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/vxworks/snmptalk.h,v 1.1.1.1 2001/11/05 17:47:17 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + +/**************************************************************************** + * Copyright 1995-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: snmptalk.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:17 tneale + * Tornado shuffle + * + * Revision 1.1 2000/02/04 21:49:31 josh + * modified header files for clean builds of vxWorks demo + * + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + +#include +#include +#include + +/* defines for nvutils for file manipulation */ +#define SNMP_READONLY "r" +#define SNMP_READPLUS "r+" +#define SNMP_WRITEPLUS "w+" +#define SNMP_REMOVE_FILE(fname) unlink(fname) + diff --git a/h/sntp.h b/h/sntp.h new file mode 100644 index 0000000..6a120dd --- /dev/null +++ b/h/sntp.h @@ -0,0 +1,143 @@ +/* sntp.h - Simple Network Time Protocol common include file */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01c,28apr02,rae added extern C jazz (SPR #76303) +01b,15jul97,spm code cleanup, documentation, and integration; entered in + source code control +01a,20apr97,kyc written + +*/ + +#ifndef __INCsntph +#define __INCsntph + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "timers.h" + +/* defines */ + +/* constants used by the NTP packet. See RFC 1769 for details. */ + +/* 2 bit leap indicator field */ + +#define SNTP_LI_MASK 0xC0 +#define SNTP_LI_0 0x00 /* no warning */ +#define SNTP_LI_1 0x40 /* last minute has 61 seconds */ +#define SNTP_LI_2 0x80 /* last minute has 59 seconds */ +#define SNTP_LI_3 0xC0 /* alarm condition + (clock not synchronized) */ + +/* 3 bit version number field */ + +#define SNTP_VN_MASK 0x38 +#define SNTP_VN_0 0x00 /* not supported */ +#define SNTP_VN_1 0x08 /* the earliest version */ +#define SNTP_VN_2 0x10 +#define SNTP_VN_3 0x18 /* VxWorks implements this + version */ +#define SNTP_VN_4 0x20 /* the latest version, not yet + solidified */ +#define SNTP_VN_5 0x28 /* reserved */ +#define SNTP_VN_6 0x30 /* reserved */ +#define SNTP_VN_7 0x38 /* reserved */ + +/* 3 bit mode field */ + +#define SNTP_MODE_MASK 0x07 +#define SNTP_MODE_0 0x00 /* reserve */ +#define SNTP_MODE_1 0x01 /* symmetric active */ +#define SNTP_MODE_2 0x02 /* symmetric passive */ +#define SNTP_MODE_3 0x03 /* client */ +#define SNTP_MODE_4 0x04 /* server */ +#define SNTP_MODE_5 0x05 /* broadcast */ +#define SNTP_MODE_6 0x06 /* reserve for NTP control + message */ +#define SNTP_MODE_7 0x07 /* reserve for private use */ + + + +/* 8 bit stratum number. Only the first 2 are valid for SNTP. */ + +#define SNTP_STRATUM_0 0x00 /* unspecified or unavailable */ +#define SNTP_STRATUM_1 0x01 /* primary source */ + +/* + * No default constants are defined for poll, precision, root delay, + * root dispersion and reference identifier. Users are expected to supply + * values for the poll interval and the refererence identifier. SNTP ignores + * the precision, root delay and root dispersion fields. + */ + + +/* + * Time conversion constant. NTP timestamps are relative to + * 0h on 1 January 1900, Unix uses 0h GMT on 1 January 1970 as a base. + * The defined constant incorporates 53 standard years and 17 leap years, + * but omits all leap second adjustments, since these are applied to + * both timescales, keeping the offset constant. + */ + +#define SNTP_UNIX_OFFSET 0x83aa7e80 /* 1970 - 1900 in seconds */ + +/* the range of the struct timeval is 0 - 1000000 */ + +#define TIMEVAL_USEC_MAX 1000000 + + +/* + * SNTP_PACKET - Network Time Protocol message format (without authentication). + * See RFC1769 for details. + */ + +#if CPU_FAMILY==I960 +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct sntpPacket + { + unsigned char leapVerMode; + unsigned char stratum; + char poll; + char precision; + u_long rootDelay; + u_long rootDispersion; + u_long referenceIdentifier; + + /* latest available time, in 64-bit NTP timestamp format */ + + u_long referenceTimestampSec; + u_long referenceTimestampFrac; + + /* client transmission time, in 64-bit NTP timestamp format */ + + u_long originateTimestampSec; + u_long originateTimestampFrac; + + /* server reception time, in 64-bit NTP timestamp format */ + + u_long receiveTimestampSec; + u_long receiveTimestampFrac; + + /* server transmission time, in 64-bit NTP timestamp format */ + + u_long transmitTimestampSec; + u_long transmitTimestampFrac; + } SNTP_PACKET; + +#if CPU_FAMILY==I960 +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif +#endif /* __INCsntph */ diff --git a/h/sntpcLib.h b/h/sntpcLib.h new file mode 100644 index 0000000..7ae270a --- /dev/null +++ b/h/sntpcLib.h @@ -0,0 +1,44 @@ +/* sntpcLib.h - Simple Network Time Protocol client include file */ + +/* Copyright 1984-1997 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01c,25aug99,cno Add extern "C" definition (SPR21825) +01b,15jul97,spm code cleanup, documentation, and integration; entered in + source code control +01a,20apr97,kyc written + +*/ + +#ifndef __INCsntpch +#define __INCsntpch + +/* includes */ + +#include "sntp.h" + +/* defines */ + +#define S_sntpcLib_INVALID_PARAMETER (M_sntpcLib | 1) +#define S_sntpcLib_INVALID_ADDRESS (M_sntpcLib | 2) +#define S_sntpcLib_TIMEOUT (M_sntpcLib | 3) +#define S_sntpcLib_VERSION_UNSUPPORTED (M_sntpcLib | 4) +#define S_sntpcLib_SERVER_UNSYNC (M_sntpcLib | 5) + +#define SNTP_CLIENT_REQUEST 0x0B /* standard SNTP client request */ + +#ifdef __cplusplus +extern "C" { +#endif + +IMPORT STATUS sntpcInit (u_short); +IMPORT STATUS sntpcTimeGet (char *, u_int, struct timespec *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsntpch */ + diff --git a/h/sntpsLib.h b/h/sntpsLib.h new file mode 100644 index 0000000..5f2db80 --- /dev/null +++ b/h/sntpsLib.h @@ -0,0 +1,71 @@ +/* sntpsLib.h - Simple Network Time Protocol (SNTP) server include file */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01c,30aug01,vvv added extern "C" definition (SPR #21825) +01b,15jul97,spm code cleanup, documentation, and integration; entered in + source code control +01a,20apr97,kyc written + +*/ + +#ifndef __INCsntpsh +#define __INCsntpsh + +/* includes */ + +#include "sntp.h" + +/* defines */ + +#define S_sntpsLib_INVALID_PARAMETER (M_sntpsLib | 1) +#define S_sntpsLib_INVALID_ADDRESS (M_sntpsLib | 2) + +/* Valid settings for SNTPS_MODE in configAll.h */ + +#define SNTP_ACTIVE 1 +#define SNTP_PASSIVE 2 + +/* Values for "request" parameter to clock hook routine. */ + +#define SNTPS_ID 1 +#define SNTPS_RESOLUTION 2 +#define SNTPS_TIME 3 + +/* Values for "setting" parameter to sntpsConfigSet() routine. */ + +#define SNTPS_ADDRESS 1 +#define SNTPS_DELAY 2 + +#if CPU_FAMILY==I960 +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct sntpsTimeData + { + ULONG seconds; + ULONG fraction; + } SNTP_TIMESTAMP; + +#if CPU_FAMILY==I960 +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +extern "C" { +#endif + +IMPORT STATUS sntpsInit (char *, u_char, char *, short, u_short, FUNCPTR); +IMPORT STATUS sntpsClockSet (FUNCPTR); +IMPORT ULONG sntpsNsecToFraction (ULONG); +IMPORT STATUS sntpsConfigSet (int, void *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsntpsh */ + diff --git a/h/sockFunc.h b/h/sockFunc.h new file mode 100644 index 0000000..1614227 --- /dev/null +++ b/h/sockFunc.h @@ -0,0 +1,79 @@ +/* sockFunc.h - socket function table header */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,12oct01,rae merge from truestack (add sockLibMap) +01e,29apr99,pul Upgraded NPT phase3 code to tor2.0.0 +01d,02feb99,sgv added zbufRtn to sockFunc structure. +01c,02aug95,dzb removed inclusion of iosLib.h, added sys/socket.h. +01b,25jul95,dzb removed SOCKET_DEV structure. +01a,21jul95,dzb created. +*/ + +#ifndef __INCsockFunch +#define __INCsockFunch + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "sys/times.h" +#include "sys/socket.h" + +/* HIDDEN */ + +/* typedefs */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct sockFunc /* SOCK_FUNC */ + { + FUNCPTR libInitRtn; /* sockLibInit() */ + FUNCPTR acceptRtn; /* accept() */ + FUNCPTR bindRtn; /* bind() */ + FUNCPTR connectRtn; /* connect() */ + FUNCPTR connectWithTimeoutRtn; /* connectWithTimeout() */ + FUNCPTR getpeernameRtn; /* getpeername() */ + FUNCPTR getsocknameRtn; /* getsockname() */ + FUNCPTR listenRtn; /* listen() */ + FUNCPTR recvRtn; /* recv() */ + FUNCPTR recvfromRtn; /* recvfrom() */ + FUNCPTR recvmsgRtn; /* recvmsg() */ + FUNCPTR sendRtn; /* send() */ + FUNCPTR sendtoRtn; /* sendto() */ + FUNCPTR sendmsgRtn; /* sendmsg() */ + FUNCPTR shutdownRtn; /* shutdown() */ + FUNCPTR socketRtn; /* socket() */ + FUNCPTR getsockoptRtn; /* getsockopt() */ + FUNCPTR setsockoptRtn; /* setsockopt() */ + FUNCPTR zbufRtn; /* ZBUF support */ + } SOCK_FUNC; + +/* typedefs */ + +typedef struct sockLibMap + { + int domainMap; /* mapping address family */ + int domainReal; /* real address family */ + SOCK_FUNC * pSockFunc; /* socket function table */ + struct sockLibMap * pNext; /* next socket lib mapping */ + } SOCK_LIB_MAP; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* END_HIDDEN */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsockFunch */ diff --git a/h/sockLib.h b/h/sockLib.h new file mode 100644 index 0000000..1ef4af7 --- /dev/null +++ b/h/sockLib.h @@ -0,0 +1,98 @@ +/* sockLib.h - UNIX BSD 4.3 compatible socket library header */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02l,12oct01,rae merge from truestack (update copyright) +02k,14nov00,rae removed unused argument from sockLibAdd() +02j,09nov99,pul integrating T2 cumulative patch +02i,17aug99,pai changed send() prototype to use const on the second param + (SPR 21829) +02h,29apr99,pul Upgraded NPT phase3 code to tor2.0.0 +02g,02feb99,sgv added bitflags to sockLibAdd(). +02f,25jul95,dzb added prototype for sockLibAdd(). +02e,24jul95,dzb changed sockInit() to sockLibInit(). +02d,23jul93,jmm changed #include "socket.h" to "sys/socket.h" (spr 2033) +02c,22sep92,rrr added support for c++ +02b,19aug92,smb changed systime.h to sys/times.h +02a,04jul92,jcf cleaned up. +01e,26may92,rrr the tree shuffle +01d,16dec91,gae added includes for ANSI. +01c,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01b,23oct90,shl replaced all occurances of "int flag s" to "int s". +01a,05oct90,shl created. +*/ + +#ifndef __INCsockLibh +#define __INCsockLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "sys/times.h" +#include "sys/socket.h" + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS sockLibInit (int fdMax); +extern STATUS sockLibAdd (FUNCPTR sockLibInitRtn, int domainMap, + int domainReal); +extern STATUS bind (int s, struct sockaddr *name, int namelen); +extern STATUS connect (int s, struct sockaddr *name, int namelen); +extern STATUS connectWithTimeout (int sock, struct sockaddr *adrs, + int adrsLen, struct timeval *timeVal); +extern STATUS getpeername (int s, struct sockaddr *name, int *namelen); +extern STATUS getsockname (int s, struct sockaddr *name, int *namelen); +extern STATUS getsockopt (int s, int level, int optname, char *optval, + int *optlen); +extern STATUS listen (int s, int backlog); +extern STATUS setsockopt (int s, int level, int optname, char *optval, + int optlen); +extern STATUS shutdown (int s, int how); +extern int accept (int s, struct sockaddr *addr, int *addrlen); +extern int recv (int s, char *buf, int bufLen, int flags); +extern int recvfrom (int s, char *buf, int bufLen, int flags, + struct sockaddr *from, int *pFromLen); +extern int recvmsg (int sd, struct msghdr *mp, int flags); +extern int send (int s, const char *buf, int bufLen, int flags); +extern int sendmsg (int sd, struct msghdr *mp, int flags); +extern int sendto (int s, caddr_t buf, int bufLen, int flags, + struct sockaddr *to, int tolen); +extern int socket (int domain, int type, int protocol); + +#else /* __STDC__ */ + +extern STATUS sockLibInit (); +extern STATUS sockLibAdd (); +extern STATUS bind (); +extern STATUS connect (); +extern STATUS connectWithTimeout (); +extern STATUS getpeername (); +extern STATUS getsockname (); +extern STATUS getsockopt (); +extern STATUS listen (); +extern STATUS setsockopt (); +extern STATUS shutdown (); +extern int accept (); +extern int recv (); +extern int recvfrom (); +extern int recvmsg (); +extern int send (); +extern int sendmsg (); +extern int sendto (); +extern int socket (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsockLibh */ diff --git a/h/socket.h b/h/socket.h new file mode 100644 index 0000000..1632600 --- /dev/null +++ b/h/socket.h @@ -0,0 +1,11 @@ +/* socket.h - obsolete vxWorks 5.0 header file */ + +/* Copyright 1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,09feb93,rrr written for compatibility with 5.0 +*/ + +#include "sys/socket.h" diff --git a/h/som_coff.h b/h/som_coff.h new file mode 100644 index 0000000..f8f7077 --- /dev/null +++ b/h/som_coff.h @@ -0,0 +1,506 @@ +/* som_coff.h - HP-PA a.out object module header */ + +/* Copyright 1993 Wind River Systems, Inc. */ + +/* +modification history +------------------- +01a,10sep93,yao written. +*/ + +#ifndef INCsom_coffh +#define INCsom_coffh + +/* + * VxWorks values for n_type. + */ + +#define N_UNDF 0x0 /* undefined */ +#define N_ABS 0x2 /* absolute */ +#define N_TEXT 0x4 /* text */ +#define N_DATA 0x6 /* data */ +#define N_BSS 0x8 /* bss */ +#define N_COMM 0x12 /* common (internal to ld) */ +#define N_FN 0x1f /* file name symbol */ + +#define N_EXT 01 /* external bit, or'ed in */ +#define N_TYPE 0x1e /* mask for all the type bits */ +#define N_STAB 0xe0 /* if any of these bits set, a SDB entry */ + + +struct sys_clock { + unsigned int secs; + unsigned int nanosecs; + }; + +union name_pt { + char *n_name; + unsigned int n_strx; + }; + +typedef struct unwind_table_entry { + unsigned int startAddr; /* word 1 */ + unsigned int endAddr; /* word 2 */ + unsigned int cantUnwind:1; /* word 3 */ + unsigned int millicode:1; + unsigned int millicode_save_sr0:1; + unsigned int regionDescriptor:2; + unsigned int bunk:22; + unsigned int saveSP:1; + unsigned int saveRP:1; + unsigned int saveMRP:1; + unsigned int reserved3:1; + unsigned int cleanupDefined:1; + unsigned int interruptMarker:2; /* word 4 */ + unsigned int largeFrame:1; + unsigned int reserved4:2; + unsigned int frameSize:27; + } UNWIND_ENTRY; + +#define UNWIND_DISCONTINUOUS 3 +#define UNWIND_NORMAL 0 + +#define symbol_name name.n_name +#define subspace_name name.n_name +#define space_name name.n_name + +typedef struct header { + short int system_id; /* system id */ + short int a_magic; /* magic number */ + unsigned int version_id; /* format version */ + struct sys_clock file_time; /* timestamp */ + unsigned int entry_space; /* reserved */ + unsigned int entry_subspace; /* reserved */ + unsigned int entry_offset; /* reserved */ + unsigned int aux_header_location; /* file ptr to aux hdrs */ + unsigned int aux_header_size; /* size of aux hdrs */ + unsigned int som_length; /* length of object module */ + unsigned int presumed_dp; /* reserved */ + unsigned int space_location; /* file ptr to space dict */ + unsigned int space_total; /* number of spaces */ + unsigned int subspace_location; /* file ptr to subspace dict */ + unsigned int subspace_total; /* number of subspaces */ + unsigned int loader_fixup_location; /* reserved */ + unsigned int loader_fixup_total; /* reserved */ + unsigned int space_strings_location; /* file ptr to space strings */ + unsigned int space_strings_size; /* size of space strings */ + unsigned int init_array_location; /* reserved */ + unsigned int init_array_total; /* reserved */ + unsigned int compiler_location; /* file ptr to compiler records */ + unsigned int compiler_total; /* number of compiler records */ + unsigned int symbol_location; /* file ptr to symbol table */ + unsigned int symbol_total; /* number of symbols */ + unsigned int fixup_request_location;/* file ptr to fixups */ + unsigned int fixup_request_total; /* number of fixups */ + unsigned int symbol_strings_location;/* file ptr to symbol strings */ + unsigned int symbol_strings_size; /* size of to symbol strings */ + unsigned int unloadable_sp_location;/* file ptr to debug info */ + unsigned int unloadable_sp_size; /* size of to debug info */ + unsigned int checksum; /* header checksum */ + } SOM_HDR; + +struct aux_id { + unsigned int mandatory : 1; /* reserved */ + unsigned int copy : 1; /* reserved */ + unsigned int append : 1; /* reserved */ + unsigned int ignore : 1; /* reserved */ + unsigned int reserved : 12; /* reserved */ + unsigned int type : 16; /* reserved */ + unsigned int length; /* reserved */ + }; + +/* values for magic number */ + +#define RELOC_MAGIC 0x106 /* relocatable only */ +#define EXEC_MAGIC 0x107 /* normal executable */ +#define SHARE_MAGIC 0x108 /* shared executable */ + +/* values for new and old versions */ + +#define VERSION_ID 85082112 +#define NEW_VERSION_ID 87102412 /* relocatable with new fixups */ + +/* values for the aux_id.type field */ + +#define HPUX_AUX_ID 4 +#define VERSION_AUX_ID 6 +#define COPYRIGHT_AUX_ID 10 + +typedef struct som_exec_auxhdr { /* HP-UX auxiliary header */ + struct aux_id som_auxhdr; /* aux header id */ + long exec_tsize; /* text size */ + long exec_tmem; /* start address of text */ + long exec_tfile; /* file ptr to text */ + long exec_dsize; /* data size */ + long exec_dmem; /* start address of data size */ + long exec_dfile; /* file ptr to data */ + long exec_bsize; /* bss size */ + long exec_entry; /* address of entry point */ + long exec_flags; /* loader flags */ + long exec_bfill; /* bss initialization value */ + } AUX_HDR; + +/* values for exec_flags */ + +#define TRAP_NIL_PTRS 01 + +struct user_string_aux_hdr { /* version string auxiliary header */ + struct aux_id header_id; /* aux header id */ + unsigned int string_length; /* strlen(user_string) */ + char user_string[1]; /* user-defined string */ + }; + +struct copyright_aux_hdr { /* copyright string auxiliary header */ + struct aux_id header_id; /* aux header id */ + unsigned int string_length; /* strlen(user_string) */ + char user_string[1]; /* user-defined string */ + }; + +/* space dictionary from scnhdr.h */ + +typedef struct space_dictionary_record { + union name_pt name; /* index to space name */ + unsigned int is_loadable: 1;/* space is loadable */ + unsigned int is_defined: 1; /* space is defined within file */ + unsigned int is_private: 1; /* space is not sharable */ + unsigned int reserved: 13; /* space is not sharable */ + unsigned int sort_key: 8; /* sort key for space */ + unsigned int reserved2: 8; /* reserved */ + int space_number; /* space index */ + int subspace_index;/* subspace index */ + unsigned int subspace_quantity;/* number of subspaces in space */ + int loader_fix_index;/* reserved */ + int loader_fix_quantity;/* reserved */ + int int_pointer_index;/* reserved */ + int int_pointer_quantity;/* reserved */ + } SPACE; + +typedef struct subspace_dictionary_record { + int space_index; + unsigned int access_control_bits: 7; /* access for PDIR entries */ + unsigned int memory_resident : 1; /* lock in memory */ + unsigned int dup_common : 1; /* data name clashes allowed */ + unsigned int is_common : 1; /* subspace is a common block */ + unsigned int is_loadable : 1; + unsigned int quadrant : 2; /* quadrant request */ + unsigned int initially_frozen : 1; /* must be locked into memory + when OS is booted */ + unsigned int is_first : 1; /* must be first subspace */ + unsigned int code_only : 1; /* must contain only code */ + unsigned int sort_key : 8; /* subspace sort key */ + unsigned int replicate_init : 1; /* init values replicated to + fill subspace_length */ + unsigned int continuation : 1; /* subspace is a continuation */ + unsigned int reserved : 6; + int file_loc_init_value; /* file location or + initialization value */ + unsigned int initialization_length; + unsigned int subspace_start; /* starting offset */ + unsigned int subspace_length; /* number of bytes defined by + * this subspace */ + unsigned int reserved2 :16; + unsigned int alignment :16; /* alignment required for the + * subspace (largest alignment + * requested for any item in the + * subspace) */ + union name_pt name; /* index of subspace name */ + int fixup_request_index; /* index into fixup array */ + unsigned int fixup_request_quantity; /* number of fixup requests */ + } SUBSPACE; + +#define SBPSZ sizeof(SUBSPACE) + +/* + * Define constants for names of spaces + */ + +#define _SPACE_TEXT "$TEXT$" +#define _SPACE_PRIVATE "$PRIVATE$" + +/* from syms.h */ +typedef struct symbol_dictionary_record { + unsigned int hidden : 1; /* reserved */ + unsigned int secondary_def : 1; /* symbol type */ + unsigned int symbol_type : 6; /* symbol type */ + unsigned int symbol_scope : 4; /* symbol value */ + unsigned int check_level : 3; /* type checking level */ + unsigned int must_qualify : 1; /* qualifier required */ + unsigned int initially_frozen : 1; /* reserved */ + unsigned int memory_resident : 1; /* reserved */ + unsigned int is_common : 1; /* common block */ + unsigned int dup_common : 1; /* COBOL-style common */ + unsigned int xleast : 2; /* reserved */ + unsigned int arg_reloc :10; /* parameter relocation bits */ + union name_pt name; /* index to symbol name */ + union name_pt qualifier_name; /* index to qual name */ + unsigned int symbol_info; /* subspace index */ + unsigned int symbol_value; /* symbol value */ + } SYMREC; + +#define n_nptr name.n_name +#define n_offset name.n_strx +#define q_nptr qualifier_name.n_name +#define q_offset qualifier_name.n_strx + +/* values for symbol_type */ + +#define ST_NULL 0 /* unused symbol entry */ +#define ST_ABSOLUTE 1 /* non-relocatable symbol */ +#define ST_DATA 2 /* data symbol */ +#define ST_CODE 3 /* generic code symbol */ +#define ST_PRI_PROG 4 /* program entry point */ +#define ST_SEC_PROG 5 /* secondary prog entry point */ +#define ST_ENTRY 6 /* procedure entry point */ +#define ST_STORAGE 7 /* storage request */ +#define ST_STUB 8 /* reserved */ +#define ST_MODULE 9 /* Pascal module name */ +#define ST_SYM_EXT 10 /* symbol extension record */ +#define ST_ARG_EXT 11 /* argument extension record */ +#define ST_MILLICODE 12 /* millicode entry point */ +#define ST_PLABEL 13 /* reserved */ +#define ST_OCT_DIS 14 /* reserved */ +#define ST_MILLI_EXT 15 /* reserved */ + +/* symbol scopes */ + +#define SS_UNSAT 0 /* unsatisfied reference */ +#define SS_EXTERNAL 1 /* reserved */ +#define SS_LOCAL 2 /* local symbol */ +#define SS_UNIVERSAL 3 /* global symbol */ + +/* symbol extension records (for type checking) */ + +union arg_descriptor { + struct + { + unsigned int reserved :3; /* not used */ + unsigned int packing :1; /* reserved */ + unsigned int alignment :4; /* byte alignment */ + unsigned int mode :4; /* not used */ + unsigned int structure :4; /* use of symbol */ + unsigned int hash :1; /* structure of symbol */ + int arg_type :15; /* set if arg_type is hashed */ + } arg_desc; + unsigned int word; + }; + +struct symbol_extension_record + { + unsigned int type :8; /* always type SYM_EXT (12) for + * this record */ + unsigned int max_num_args :8; /* max # of parameters */ + unsigned int min_num_args :8; /* min # of parameters */ + unsigned int num_args :8; /* actual # of parameters */ + union arg_descriptor symbol_desc; /* first 3 parameters */ + union arg_descriptor argument_desc[3]; + }; + +struct argument_desc_array + { + unsigned int type : 8; /* always type ARG_EXT (13) for + * this record */ + unsigned int reserved: 24; /* not used */ + union arg_descriptor argument_desc[4]; /* nexet 4 parameters */ + }; + +#define SYMESZ sizeof(SYMREC) +#define AUXENT struct symbol_extension_record +#define AUXESZ sizeof(AUXENT) + +/* relocation information */ + +/* + * The following declarations are for relocation entries in new-format + * relocatable object files, produced by compilers on HP-UX Release 3.0 + * and later. A relocatable object file with this format will have + * a version number in the file header of NEW_VERSION_ID (see filehdr.h). + * + * Relocation entries are a stream of bytes; each subspace (see scnhdr.h) + * contains a byte offset from the beginning of the fixup table, and a + * length in bytes of the relocation entries for that subspace. + * The first byte of each relocation entry is the opcode as described + * below. Entries can be from 1 to 12 (currently) bytes long, and + * describe 0, 1, or more words of data to be relocated. + */ + +#define R_NO_RELOCATION 0x00 /* 00-1f: n words, not relocatable */ +#define R_ZEROES 0x20 /* 20-21: n words, all zero */ +#define R_UNINIT 0x22 /* 22-23: n words, uninitialized */ +#define R_RELOCATION 0x24 /* 24: 1 word, relocatable data */ +#define R_DATA_ONE_SYMBOL 0x25 /* 25-26: 1 word, data external reference */ +#define R_DATA_PLABEL 0x27 /* 27-28: 1 word, data plabel reference */ +#define R_SPACE_REF 0x29 /* 29: 1 word, initialized space id */ +#define R_REPEATED_INIT 0x2a /* 2a-2d: n words, repeated pattern */ + /* 2e-2f: reserved */ +#define R_PCREL_CALL 0x30 /* 30-3d: 1 word, pc-relative call */ + /* 3e-3f: reserved */ +#define R_ABS_CALL 0x40 /* 40-4d: 1 word, absolute call */ + /* 4e-4f: reserved */ +#define R_DP_RELATIVE 0x50 /* 50-72: 1 word, dp-relative load/store */ + /* 73-77: reserved */ +#define R_DLT_REL 0x78 /* 78-79: 1 word, dlt-relative load/store */ +#define R_CODE_ONE_SYMBOL 0x80 /* 80-a2: 1 word, relocatable code */ + /* a3-ad: reserved */ +#define R_MILLI_REL 0xae /* ae-af: 1 word, millicode-relative branch */ +#define R_CODE_PLABEL 0xb0 /* b0-b1: 1 word, code plabel reference */ +#define R_BREAKPOINT 0xb2 /* b2: 1 word, statement breakpoint */ +#define R_ENTRY 0xb3 /* b3-b4: procedure entry */ +#define R_ALT_ENTRY 0xb5 /* b5: alternate exit */ +#define R_EXIT 0xb6 /* b6: procedure exit */ +#define R_BEGIN_TRY 0xb7 /* b7: start of try block */ +#define R_END_TRY 0xb8 /* b8-ba: end of try block */ +#define R_BEGIN_BRTAB 0xbb /* bb: start of branch table */ +#define R_END_BRTAB 0xbc /* bc: end of branch table */ +#define R_STATEMENT 0xbd /* bd-bf: statement number */ +#define R_DATA_EXPR 0xc0 /* c0: 1 word, relocatable data expr */ +#define R_CODE_EXPR 0xc1 /* c1: 1 word, relocatable code expr */ +#define R_FSEL 0xc2 /* c2: F' override */ +#define R_LSEL 0xc3 /* c3: L'/LD'/LS'/LR' override */ +#define R_RSEL 0xc4 /* c4: R'/RD'/RS'/RR' override */ +#define R_N_MODE 0xc5 /* c5: set L'/R' mode */ +#define R_S_MODE 0xc6 /* c6: set LS'/RS' mode */ +#define R_D_MODE 0xc7 /* c7: set LD'/RD' mode */ +#define R_R_MODE 0xc8 /* c8: set LR'/RR' mode */ +#define R_DATA_OVERRIDE 0xc9 /* c9-cd: get data from fixup area */ +#define R_TRANSLATED 0xce /* ce: toggle translated mode */ +#define R_AUX_UNWIND 0xcf /* cf: auxiliary unwind (proc begin) */ +#define R_COMP1 0xd0 /* d0: arbitrary expression */ + +#define R_PUSH_PCON1 0x00 /* 00-3f: positive constant */ +#define R_PUSH_DOT 0x40 +#define R_MAX 0x41 +#define R_MIN 0x42 +#define R_ADD 0x43 +#define R_SUB 0x44 +#define R_MULT 0x45 +#define R_DIV 0x46 +#define R_MOD 0x47 +#define R_AND 0x48 +#define R_OR 0x49 +#define R_XOR 0x4a +#define R_NOT 0x4b + /* 4c-5f: reserved */ +#define R_LSHIFT 0x60 /* 60-7f: shift count (0-variable) */ +#define R_ARITH_RSHIFT 0x80 /* 80-9f: shift count (0-variable) */ +#define R_LOGIC_RSHIFT 0xa0 /* a0-bf: shift count (0-variable) */ +#define R_PUSH_NCON1 0xc0 /* c0-ff: negative constant */ + +#define R_COMP2 0xd1 /* d1: arbitrary expression */ +#define R_PUSH_PCON2 0x00 /* 00-7f: positive constant */ +#define R_PUSH_SYM 0x80 + /* 81: reserved */ +#define R_PUSH_PLABEL 0x82 /* 82-83: plabel */ + /* 84-bf: reserved */ +#define R_PUSH_NCON2 0xc0 /* c0-ff: negative constant */ + +#define R_COMP3 0xd2 /* d2: arbitrary expression */ +#define R_PUSH_PROC 0x00 /* 00-01: procedure */ +#define R_PUSH_CONST 0x02 /* 02: constant */ + /* 03-ff: reserved */ + +#define R_PREV_FIXUP 0xd3 /* d3-d6: apply previous fixup again */ +#define R_SEC_STMT 0xd7 /* d7: secondary statement number */ + /* d8-df: reserved */ +#define R_RESERVED 0xe0 /* e0-ff: reserved for compiler/linker */ + + +/* + * Loader fixups + * + * These are produced by the linker only when the -HK option is used. + * They indicate initialized pointers in the data space that contain + * the addresses of other locations in the data space, so that those + * pointers can be relocated at load time if the data is loaded at + * some address other than that specified at link time. (References + * from code to data are always relative to the dp register (r27), + * and will not need to be relocated.) These are needed primarily + * for the MPE XL operating system, but may be useful for some + * dynamic loading applications on HP-UX. + */ + +struct loader_fixup { + unsigned int fixup_type; + unsigned int space_index; /* index of space to fix up */ + unsigned int space_offset; /* offset at which to patch */ + int constant; /* constant used to patch the space */ +}; + +/* loader fixup types */ + +#define LD_SPACE_REF 0 /* space reference fixup */ +#define LD_DATA_REF 1 /* data reference fixup */ +#define LD_XRT_REF 2 /* XRT reference fixup */ + +#define LDRFIX struct loader_fixup +#define LDRFIXSZ sizeof(LDRFIX) + + +/* + * The following definitions are for old-format relocatable object + * files, and for absolute fixups (e_abs) in all executable files. + * Old relocatable object files were produced by compilers before + * HP-UX Release 3.0 on the Series 800, and the file header contains + * the version number VERSION_ID (see filehdr.h). + * + * Absolute fixups are produced by the linker only when the -HF + * option is specified. They record the locations of all absolute + * branches (LDIL/BLE) in the code, so that code can be relocated + * without being completely relinked. They are primarily useful + * only on MPE XL, but may be useful in dynamic loading applications + * on HP-UX. + */ + +typedef struct fixup_request_record { + unsigned int need_data_ref : 1; + unsigned int arg_reloc : 10; + unsigned int expression_type: 5; /* type of expr. providing value */ + unsigned int exec_level : 2; /* execution level at point of call */ + unsigned int fixup_format : 6; /* inst. or data format */ + unsigned int fixup_field : 8; /* field from fixup value */ + unsigned int subspace_offset; /* offset of word to be fixed up */ + unsigned int symbol_index_one; /* sequence # of symbol */ + unsigned int symbol_index_two; /* sequence # of second symbol */ + int fixup_constant; /* constant part */ +} FIXUP; + +/* field selectors */ + +#define e_fsel 0 /* F' : no change */ +#define e_lssel 1 /* LS' : if (bit 21) then add 0x800 + arithmetic shift right 11 bits */ +#define e_rssel 2 /* RS' : Sign extend from bit 21 */ +#define e_lsel 3 /* L' : Arithmetic shift right 11 bits */ +#define e_rsel 4 /* R' : Set bits 0-20 to zero */ +#define e_ldsel 5 /* LD' : Add 0x800, arithmetic shift + right 11 bits */ +#define e_rdsel 6 /* RD' : Set bits 0-20 to one */ +#define e_lrsel 7 /* LR' : L' with "rounded" constant */ +#define e_rrsel 8 /* RR' : R' with "rounded" constant */ + +/* expression types */ + +#define e_one 0 /* label + constant */ +#define e_two 1 /* label - label + constant */ +#define e_pcrel 2 /* label - subspace offset + constant */ +#define e_con 3 /* constant */ +#define e_plabel 7 /* plabel for label */ +#define e_abs 18 /* absolute, 1st sym index is address */ + +/* fixup formats */ + +#define i_exp14 0 /* 14 bit signed long displacement */ +#define i_exp21 1 /* 21 bit signed immediate */ +#define i_exp11 2 /* signed 11 bit immediate */ +#define i_rel17 3 /* 19 bit signed displacement, discard */ + /* 2 low order bits to make 17 bits */ +#define i_rel12 4 /* 14 bit signed displacement, discard */ + /* 2 low order bits to make 12 bits */ +#define i_data 5 /* whole word */ +#define i_none 6 /* no expression in this word */ +#define i_abs17 7 /* same as i_rel17 */ +#define i_milli 8 /* i_abs17 plus SR bits */ +#define i_break 9 /* conditionally replace NOP w/ BREAK */ + +#define RELSZ sizeof(FIXUP) + +#endif /* INCsom_coffh */ diff --git a/h/speLib.h b/h/speLib.h new file mode 100644 index 0000000..c122e7f --- /dev/null +++ b/h/speLib.h @@ -0,0 +1,64 @@ +/* speLib.h - SPE coprocessor support library header */ + +/* Copyright 1984-1997 Wind River Systems, Inc. */ + +/* +modification history +-------------------- + +*/ + +#ifndef __INCspeLibh +#define __INCspeLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE +#include "taskLib.h" +#endif /* _ASMLANGUAGE */ + +#if CPU_FAMILY==PPC +#include "arch/ppc/spePpcLib.h" +#endif /* CPU_FAMILY==PPC */ + + +/* function declarations */ + +#ifndef _ASMLANGUAGE + +#if defined(__STDC__) || defined(__cplusplus) + +extern void speInit (void); +extern void speShowInit (void); +extern void speTaskRegsShow (int task); +extern STATUS speTaskRegsGet (int task, SPEREG_SET *pSpeRegSet); +extern STATUS speTaskRegsSet (int task, SPEREG_SET *pSpeRegSet); +extern STATUS speProbe (void); +extern void speRestore (SPE_CONTEXT *pSpeContext); +extern void speSave (SPE_CONTEXT *pSpeContext); +extern void speRegsToCtx (SPEREG_SET *pSpeRegSet, SPE_CONTEXT *pSpeContext); +extern void speCtxToRegs (SPE_CONTEXT *pSpeContext, SPEREG_SET *pSpeRegSet); + +#else + +extern void speInit (); +extern void speShowInit (); +extern void speTaskRegsShow (); +extern STATUS speTaskRegsGet (); +extern STATUS speTaskRegsSet (); +extern STATUS speProbe (); +extern void speRestore (); +extern void speSave (); +extern void speRegsToCtx (); +extern void speCtxToRegs (); + +#endif /* __STDC__ */ +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCspeLibh */ diff --git a/h/spyLib.h b/h/spyLib.h new file mode 100644 index 0000000..4e3fc7a --- /dev/null +++ b/h/spyLib.h @@ -0,0 +1,61 @@ +/* spyLib.h - header file for spyLib.c */ + +/* Copyright 1984-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02d,09may03,pes PAL conditional compilation cleanup. Phase 2. +02c,27may95,p_m added spyLibInit() and allow decoupling of the result printing. +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01a,05oct90,shl created. +*/ + +#ifndef __INCspyLibh +#define __INCspyLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#if !defined (_WRS_SPY_TASK_SIZE) +#define _WRS_SPY_TASK_SIZE 6000 /* Default: may be overridden by arch */ +#endif /* _WRS_SPY_TASK_SIZE */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void spyLibInit (void); +extern STATUS spyClkStartCommon (int intsPerSec, FUNCPTR printRtn); +extern void spyCommon (int freq, int ticksPerSec, FUNCPTR printRtn); +extern void spyClkStopCommon (void); +extern void spyReportCommon (FUNCPTR printRtn); +extern void spyStopCommon (void); +extern void spyComTask (int freq, FUNCPTR printRtn); + +#else /* __STDC__ */ + +extern void spyLibInit (); +extern STATUS spyClkStartCommon (); +extern void spyCommon (); +extern void spyClkStopCommon (); +extern void spyReportCommon (); +extern void spyStopCommon (); +extern void spyComTask (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCspyLibh */ diff --git a/h/stat.h b/h/stat.h new file mode 100644 index 0000000..303ac48 --- /dev/null +++ b/h/stat.h @@ -0,0 +1,26 @@ +/* stat.h - obsolete vxWorks 5.0 header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,29sep92,rrr changed name of __INCstath to avoid conflict +01b,22sep92,rrr added support for c++ +01a,19sep92,smb written for compatibility with 5.0 +*/ + +#ifndef __INCobsolete_stath +#define __INCobsolete_stath + +#ifdef __cplusplus +extern "C" { +#endif + +#include "sys/stat.h" + +#ifdef __cplusplus +} +#endif + +#endif /* __INCobsolete_stath */ diff --git a/h/stdio.h b/h/stdio.h new file mode 100644 index 0000000..6366b4f --- /dev/null +++ b/h/stdio.h @@ -0,0 +1,377 @@ +/* stdio.h - stdio header file */ + +/* Copyright 1992-2003 Wind River Systems, Inc. */ +/* Copyright (c) 1990 The Regents of the University of California */ + +/* +modification history +-------------------- +02o,11mar04,md added oprintf(), voprintf() +02n,16sep02,aeg added snprintf() and vsnprintf(). +02m,25jun03,to de-classified FILE +02l,17feb99,mrs Add C++ support for NULL, (SPR #25079). +02k,10dec93,smb added include of private/classLibP.h for OBJ_VERIFY +02j,14nov92,jcf added prototype for stdioShowInit(). +02i,13nov92,dnw changed defns of stdin,out,err to be assignable (SPR #1770) + removed include of taskLib.h (SPR #1768) + made include of stdarg.h conditional on __STDC__ +02h,24sep92,smb removed POSIX extensions. +02g,22sep92,rrr added support for c++ +02f,10sep92,rfs removed FAST from stdioShow prototype +02e,08sep92,smb added #ifndef around EOF definition. +02d,07sep92,smb added prototypes for stdioShow() and stdioInit(). +02c,02aug92,jcf added _swbuf()/_srget() prototypes. +02b,31jul92,rrr changed __sclearerr() definition. +02a,29jul92,smb rewritten based on UCB stdio. + This code is derived from software contributed to Berkeley by + Chris Torek. +01p,04jul92,jcf cleaned up. +01o,26may92,rrr the tree shuffle +01n,05dec91,rrr added missings routines to !__STDC__ section +01m,26nov91,llk added include of stdarg.h as per Marc Ullman. +01l,07oct91,rrr fixed fread and fwrite. +01k,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01j,10jun91.del added pragma for gnu960 alignment. +01i,21may91,kdl added non-ANSI def's for stdioFillBuf() and stdioFlushBuf(). +01h,10jan91,shl fixed stdioFillBuf() type int, fixed stdioFlushBuf + argument type. changed remove() and rename() to have + same type as in ioLib.h +01g,19oct90,shl added #include of stddef.h and stdarg.h. +01f,05oct90,dnw added definitions for ANSI compatibility. +01e,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01d,07aug90,shl added function declarations comment. +01c,18mar90,jcf made stdin/stdout/stderr macros thru taskIdCurrent. +01b,30jan90,dab changed declaration of sprintf() from char ptr to int. +01a,28mar88,gae created. +*/ + +#ifndef __INCstdioh +#define __INCstdioh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types/vxANSI.h" /* includes size_t and fpos_t types */ +#include "errno.h" +#include "private/handleLibP.h" + +#if defined(__STDC__) || defined(__cplusplus) +#include "stdarg.h" +#endif /* __STDC__ */ + +#ifndef NULL +#if defined __GNUG__ +#define NULL (__null) +#else +#if !defined(__cplusplus) && 0 +#define NULL ((void*)0) +#else +#define NULL (0) +#endif +#endif +#endif + +/* types */ + +struct __sbuf /* stdio buffers */ + { + uchar_t * _base; /* base address of {std,unget,line} buffer */ + int _size; /* size of the buffer */ + }; + +typedef struct __sFILE + { + HANDLE handle; /* file pointer handle managemet */ + uchar_t * _p; /* current position in (some) buffer */ + int _r; /* read space left for getc() */ + int _w; /* write space left for putc() */ + short _flags; /* flags, below;this FILE is free if 0*/ + short _file; /* fileno, if Unix descriptor, else -1*/ + struct __sbuf _bf; /* buffer (at least 1 byte,if !NULL) */ + int _lbfsize; /* 0 or -_bf._size, for inline putc */ + struct __sbuf _ub; /* ungetc buffer */ + uchar_t * _up; /* old _p if _p is doing ungetc data */ + int _ur; /* old _r if _r counting ungetc data */ + uchar_t _ubuf[3]; /* guarantee an ungetc() buffer */ + uchar_t _nbuf[1]; /* guarantee a getc() buffer */ + struct __sbuf _lb; /* buffer for fgetline() */ + int _blksize; /* stat.st_blksize (may be!=_bf._size)*/ + int _offset; /* current lseek offset */ + int taskId; /* task that owns this file pointer */ + } FILE; + +/* __SRD and __SWR are never simultaneously asserted */ + +#define __SLBF 0x0001 /* line buffered */ +#define __SNBF 0x0002 /* unbuffered */ +#define __SRD 0x0004 /* OK to read */ +#define __SWR 0x0008 /* OK to write */ +#define __SWRNBF (__SWR|__SNBF) /* write unbuffered */ +#define __SRW 0x0010 /* open for reading & writing */ +#define __SEOF 0x0020 /* found EOF */ +#define __SERR 0x0040 /* found error */ +#define __SMBF 0x0080 /* _buf is from malloc */ +#define __SAPP 0x0100 /* fdopen()ed in append mode */ +#define __SSTR 0x0200 /* this is an sprintf/snprintf string */ +#define __SOPT 0x0400 /* do fseek() optimisation */ +#define __SNPT 0x0800 /* do not do fseek() optimisation */ +#define __SOFF 0x1000 /* set iff _offset is in fact correct */ +#define __SMOD 0x2000 /* true => fgetline modified _p text */ + +#define _IOFBF 0 /* setvbuf should set fully buffered */ +#define _IOLBF 1 /* setvbuf should set line buffered */ +#define _IONBF 2 /* setvbuf should set unbuffered */ + +#define BUFSIZ _PARM_BUFSIZ /* size of buffer used by setbuf */ +#define BUFSIZE BUFSIZ + +#ifndef EOF +#define EOF (-1) +#endif /* EOF */ + +#define FOPEN_MAX _PARM_FOPEN_MAX +#define FILENAME_MAX _PARM_FILENAME_MAX + +#define L_tmpnam _PARM_L_tmpnam +#define TMP_MAX _PARM_TMP_MAX + +#ifndef SEEK_SET +#define SEEK_SET 0 /* set file offset to offset */ +#endif + +#ifndef SEEK_CUR +#define SEEK_CUR 1 /* set file offset to current plus offset */ +#endif + +#ifndef SEEK_END +#define SEEK_END 2 /* set file offset to EOF plus offset */ +#endif + +#if _EXTENSION_POSIX_1003 + +#define L_cuserid _PARM_L_cuserid +#define L_ctermid _PARM_L_ctermid +#define STREAM_MAX FOPEN_MAX + +#endif /* _EXTENSION_POSIX_1003 */ + + +#if defined(__STDC__) || defined(__cplusplus) + +extern void clearerr (FILE *); +extern int fclose (FILE *); +extern int feof (FILE *); +extern int ferror (FILE *); +extern int fflush (FILE *); +extern int fgetc (FILE *); +extern int fgetpos (FILE *, fpos_t *); +extern char * fgets (char *, size_t, FILE *); +extern FILE * fopen (const char *, const char *); +extern int fprintf (FILE *, const char *, ...); +extern int fputc (int, FILE *); +extern int fputs (const char *, FILE *); +extern int fread (void *, size_t, size_t, FILE *); +extern FILE * freopen (const char *, const char *, FILE *); +extern int fscanf (FILE *, const char *, ...); +extern int fseek (FILE *, long, int); +extern int fsetpos (FILE *, const fpos_t *); +extern long ftell (FILE *); +extern int fwrite (const void *, size_t, size_t, FILE *); +extern int getc (FILE *); +extern int getchar (void); +extern char * gets (char *); +extern int oprintf (FUNCPTR routine, int arg, const char *, ...); +extern void perror (const char *); +extern int printf (const char *, ...); +extern int putc (int, FILE *); +extern int putchar (int); +extern int puts (const char *); +extern int remove (const char *); +extern int rename (const char *, const char *); +extern void rewind (FILE *); +extern int scanf (const char *, ...); +extern void setbuf (FILE *, char *); +extern int setvbuf (FILE *, char *, int, size_t); +extern int sprintf (char *, const char *, ...); +extern int snprintf (char *, size_t, const char *, ...); +extern int sscanf (const char *, const char *, ...); +extern FILE * tmpfile (void); +extern char * tmpnam (char *); +extern int ungetc (int, FILE *); +extern int vfprintf (FILE *, const char *, va_list); +extern int voprintf (FUNCPTR routine, int arg, const char *, va_list); +extern int vprintf (const char *, va_list); +extern int vsprintf (char *, const char *, va_list); +extern int vsnprintf (char *, size_t, const char *, va_list); +extern int __srget (FILE *); /* for macro definition below */ +extern int __swbuf (int, FILE *); /* for macro definition below */ + +/* _EXTENSION_POSIX_1003 */ + +extern FILE * fdopen (int, const char *); +extern int fileno (FILE *); + +/* _EXTENSION_POSIX_1003 */ + +/* WRS stdio functions declarations */ + +#if _EXTENSION_WRS /* undef for ANSI */ + +extern int fdprintf (int fd, const char *fmt, ...); +extern int vfdprintf (int fd, const char *fmt, va_list ap); +extern int printErr (const char *fmt, ...); +extern int getw (FILE *); +extern int putw (int, FILE *); +extern void setbuffer (FILE *, char *, int); +extern int setlinebuf (FILE *); +extern FILE * stdioFp (int std); +extern STATUS stdioShow (FILE * fp, int level); +extern STATUS stdioShowInit (void); +extern STATUS stdioInit (void); + +#endif /* _EXTENSION_WRS */ + +#else /* __STDC__ */ + +extern void clearerr (); +extern int fclose (); +extern int feof (); +extern int ferror (); +extern int fflush (); +extern int fgetc (); +extern int fgetpos (); +extern char * fgets (); +extern FILE * fopen (); +extern int fprintf (); +extern int fputc (); +extern int fputs (); +extern int fread (); +extern FILE * freopen (); +extern int fscanf (); +extern int fseek (); +extern int fsetpos (); +extern long ftell (); +extern int fwrite (); +extern int getc (); +extern int getchar (); +extern char * gets (); +extern int oprintf (); +extern void perror (); +extern int printf (); +extern int putc (); +extern int putchar (); +extern int puts (); +extern int remove (); +extern int rename (); +extern void rewind (); +extern int scanf (); +extern void setbuf (); +extern int setvbuf (); +extern int sprintf (); +extern int snprintf (); +extern int sscanf (); +extern FILE * tmpfile (); +extern char * tmpnam (); +extern int ungetc (); +extern int vfprintf (); +extern int vprintf (); +extern int vsprintf (); +extern int vsnprintf (); +extern int __srget (); /* for macro definition below */ +extern int __swbuf (); /* for macro definition below */ + +/* _EXTENSION_POSIX_1003 */ + +extern FILE * fdopen (); +extern int fileno (); + +/* _EXTENSION_POSIX_1003 */ + +/* WRS stdio functions declarations */ + +#if _EXTENSION_WRS /* undef for ANSI */ + +extern int fdprintf (); +extern int vfdprintf (); +extern int printErr (); +extern int getw (); +extern int putw (); +extern void setbuffer (); +extern int setlinebuf (); +extern FILE * stdioFp (); +extern STATUS stdioShow (); +extern STATUS stdioShowInit (); +extern STATUS stdioInit (); + +#endif /* _EXTENSION_WRS */ + +#endif /* __STDC__ */ + + +/* Definition of stdin, stdout, stderr */ + +#if defined(__STDC__) || defined(__cplusplus) +extern FILE ** __stdin(void); /* returns current task's stdin */ +extern FILE ** __stdout(void); /* returns current task's stdout */ +extern FILE ** __stderr(void); /* returns current task's stderr */ +#else +extern FILE ** __stdin(); +extern FILE ** __stdout(); +extern FILE ** __stderr(); +#endif /* __STDC__ */ + +#define stdin (*__stdin()) +#define stdout (*__stdout()) +#define stderr (*__stderr()) + + +/* definition of stdio macros */ + +#define __sfileno(p) ((HANDLE_VERIFY(p, handleTypeFile) != OK) ? (-1) : \ + ((p)->_file)) + +#define __sgetc(p) ((HANDLE_VERIFY(p, handleTypeFile) != OK) ? (EOF) : \ + ((--(p)->_r < 0) ? (__srget(p)) : ((int)(*(p)->_p++)))) + +#define __sputc(c, p) ((HANDLE_VERIFY(p, handleTypeFile) != OK) ? (EOF) : \ + (--(p)->_w < 0 ? \ + (p)->_w >= (p)->_lbfsize ? \ + (*(p)->_p = (c)), *(p)->_p != '\n' ? \ + (int)*(p)->_p++ : \ + __swbuf('\n', p) : \ + __swbuf((int)(c), p) : \ + (*(p)->_p = (c), (int)*(p)->_p++))) + +#define __sfeof(p) ((HANDLE_VERIFY(p, handleTypeFile) != OK) ? \ + (FALSE) : (((p)->_flags & __SEOF) != 0)) + +#define __sferror(p) ((HANDLE_VERIFY(p, handleTypeFile) != OK) ? \ + (FALSE) : (((p)->_flags & __SERR) != 0)) + +#define __sclearerr(p) ((void)((HANDLE_VERIFY(p, handleTypeFile) != OK) ? \ + (0) : (((p)->_flags &= ~(__SERR|__SEOF))))) + + +#define getchar() __sgetc(stdin) +#define getc(p) __sgetc(p) +#define putchar(c) (__sputc(c, (stdout))) +#define putc(c,p) __sputc(c, p) +#define feof(p) __sfeof(p) +#define ferror(p) __sferror(p) +#define clearerr(p) __sclearerr(p) + +#if _EXTENSION_POSIX_1003 /* undef for ANSI */ +#define fileno(p) __sfileno(p) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCstdioh */ diff --git a/h/stdioLib.h b/h/stdioLib.h new file mode 100644 index 0000000..e2bb7a6 --- /dev/null +++ b/h/stdioLib.h @@ -0,0 +1,25 @@ +/* stdioLib.h - obsolete vxWorks 5.0 header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,22sep92,rrr added support for c++ +01a,19sep92,smb written for compatibility with 5.0 +*/ + +#ifndef __INCstdioLibh +#define __INCstdioLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "stdio.h" + +#ifdef __cplusplus +} +#endif + +#endif /* __INCstdioLibh */ diff --git a/h/stdlib.h b/h/stdlib.h new file mode 100644 index 0000000..c89914e --- /dev/null +++ b/h/stdlib.h @@ -0,0 +1,191 @@ +/* stdlib.h - standard library header file */ + +/* Copyright 1992-1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02n,13sep04,yvp Made taskExit an alias for exit(). +02m,26mar01,max Fixing a type +02l,26mar01,max According to the AltiVec ABI, we need to introduce new + functions for memory allocation/deallocation: + vec_malloc, vec_calloc, vec_realloc, and vec_free. + They should be 16-byte aligned and are supposed to be used + for memory operations with AltiVec vector data. +02k,10oct00,sn deleted size_t, wchar_t definitions +02j,17feb99,mrs Add C++ support for NULL, (SPR #25079). +02i,15oct93,cd added #ifndef _ASMLANGUAGE. +02h,05feb93,smb corrected prototype for strtoul +02g,22sep92,rrr added support for c++ +02f,21sep92,smb reordered prototype list. +02e,24jul92,smb replaced types. +02d,24jul92,smb added prototypes for div_r and ldiv_r + removed the ifndef for types div_t, ldiv_t and wchar_T +02c,20jul92,smb replaced modification history. +02b,19jul92,smb rewritten +02a,04jul92,jcf cleaned up. +01f,26may92,rrr the tree shuffle +01e,25nov91,llk added ansi definitions EXIT_FAILURE, EXIT_SUCCESS, RAND_MAX, + MB_CUR_MAX. + included more function prototypes. Some are commented out. +01d,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01c,10jun91.del added pragma for gnu960 alignment. +01b,19oct90,shl fixed typo in modhist 01a. +01a,05oct90,dnw created based on Marc Ullman's version +*/ + +#ifndef __INCstdlibh +#define __INCstdlibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types/vxANSI.h" /* includes types div_t, ldiv_t, wchar_t */ + +#ifndef _ASMLANGUAGE + +#define EXIT_FAILURE _PARM_EXIT_FAILURE +#define EXIT_SUCCESS _PARM_EXIT_SUCCESS +#define MB_CUR_MAX _PARM_MB_CUR_MAX +#define RAND_MAX _PARM_RAND_MAX + +#ifndef NULL +#if defined __GNUG__ +#define NULL (__null) +#else +#if !defined(__cplusplus) && 0 +#define NULL ((void*)0) +#else +#define NULL (0) +#endif +#endif +#endif + +/* AltiVec ABI extension. As soon as we decided to force VxWorks + to do all memory allocations with 16-byte alignment (At least + for the EAR) we can just alias standard "malloc"-family + functions with appropriate "vec_malloc" functions. +*/ + +#ifdef __VEC__ /* PowerPC AltiVec technology */ + +#define vec_malloc(SIZE) malloc (SIZE) +#define vec_calloc(N,SIZE) calloc (N,SIZE) +#define vec_realloc(PTR,SIZE) realloc(PTR,SIZE) +#define vec_free(PTR) free (PTR) + +#endif + +#ifdef _TYPE_div_t +_TYPE_div_t; +#undef _TYPE_div_t +#endif + +#ifdef _TYPE_ldiv_t +_TYPE_ldiv_t; +#undef _TYPE_ldiv_t +#endif + +typedef struct { /* used by mblen and mbtowc */ + unsigned char __state; + unsigned short __wchar; + } _Mbsave; + +/* This alias provides consistent meaning in both kernel & user modes */ + +#define taskExit(exitCode) exit((exitCode)) + + +#if defined(__STDC__) || defined(__cplusplus) + +extern void abort (void); +extern int abs (int __i); +extern int atexit (void (*__func)(void)); +extern double atof (const char *__s); +extern int atoi (const char *__s); +extern long atol (const char *__s); +extern void * bsearch (const void *__key, const void *__base, + size_t __nelem, size_t __size, + int (*__cmp)(const void *__ck, const void *__ce)); +extern div_t div (int __numer, int __denom); +extern long labs (long __i); +extern ldiv_t ldiv (long __numer, long __denom); +extern int mblen (const char *__s, size_t __n); +extern size_t mbstowcs (wchar_t *__wcs, const char *__s, size_t __n); +extern int mbtowc (wchar_t *__pwc, const char *__s, size_t __n); +extern void qsort (void *__base, size_t __nelem, size_t __size, + int (*__cmp)(const void *__e1, const void *__e2)); +extern int rand (void); +extern void * srand (unsigned int __seed); +extern double strtod (const char *__s, char **__endptr); +extern long strtol (const char *__s, char **__endptr, int __base); +extern unsigned long strtoul (const char *__s, char **__endptr, int __base); +extern int system (const char *__s); +extern size_t wcstombs (char *__s, const wchar_t *__wcs, size_t __n); +extern int wctomb (char *__s, wchar_t __wchar); + +extern void * calloc (size_t __nelem, size_t __size); +extern void exit (int __status); +extern void free (void *__ptr); +extern char * getenv (const char *__name); +extern void * malloc (size_t __size); +extern void * realloc (void *__ptr, size_t __size); + +#if _EXTENSION_WRS + +extern void div_r (int numer, int denom, div_t * divStructPtr); +extern void ldiv_r (long numer, long denom, ldiv_t * divStructPtr); + +#endif + +#else /* __STDC__ */ + +extern void abort (); +extern int abs (); +extern int atexit (); +extern double atof (); +extern int atoi (); +extern long atol (); +extern void * bsearch (); +extern div_t div (); +extern long labs (); +extern ldiv_t ldiv (); +extern int mblen (); +extern size_t mbstowcs (); +extern int mbtowc (); +extern void qsort (); +extern int rand (); +extern void * srand (); +extern double strtod (); +extern long strtol (); +extern unsigned long strtoul (); +extern int system (); +extern size_t wcstombs (); +extern int wctomb (); + +extern void * calloc (); +extern void exit (); +extern void free (); +extern char * getenv (); +extern void * malloc (); +extern void * realloc (); + +#if _EXTENSION_WRS + +extern void div_r (); +extern void ldiv_r (); + +#endif + +#endif /* _ASMLANGUAGE */ + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCstdlibh */ diff --git a/h/strLib.h b/h/strLib.h new file mode 100644 index 0000000..ae95655 --- /dev/null +++ b/h/strLib.h @@ -0,0 +1,25 @@ +/* strLib.h - obsolete vxWorks 5.0 header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,22sep92,rrr added support for c++ +01a,19sep92,smb written for compatibility with 5.0 +*/ + +#ifndef __INCstrLibh +#define __INCstrLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "string.h" + +#ifdef __cplusplus +} +#endif + +#endif /* __INCstrLibh */ diff --git a/h/strSearchLib.h b/h/strSearchLib.h new file mode 100644 index 0000000..410a3c8 --- /dev/null +++ b/h/strSearchLib.h @@ -0,0 +1,41 @@ +/* strSearchLib.h - String search library header file */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01a,04apr05,svk written +*/ + +#ifndef __INCstrSearchLibh +#define __INCstrSearchLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +extern char * fastStrSearch (char * pattern, int patternLen, + char * buffer, int bufferLen, + BOOL caseSensitive); +extern char * bmsStrSearch (char * pattern, int patternLen, + char * buffer, int bufferLen, + BOOL caseSensitive); +extern char * bfStrSearch (char * pattern, int patternLen, + char * buffer, int bufferLen, + BOOL caseSensitive); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCstrSearchLibh */ + diff --git a/h/string.h b/h/string.h new file mode 100644 index 0000000..5a6089e --- /dev/null +++ b/h/string.h @@ -0,0 +1,151 @@ +/* string.h - string library header file */ + +/* Copyright 1992-1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02j,20sep04,ans Added strdup() +02i,10sep03,aim added strlcat, strlcpy +02h,00oct00,sn Removed size_t typedef +02g,17feb99,mrs Add C++ support for NULL, (SPR #25079). +02f,22sep92,rrr added support for c++ +02e,14sep92,smb added const to the prototype of bcopy. +02d,07sep92,smb removed macros for memcpy and memset. +02c,30jul92,smb added macros for memcpy and memset. +02b,09jul92,smb removed extra memmove declarations. +02a,04jul92,jcf cleaned up. +01b,03jul92,smb macro override for strerror added. +01a,29jul91,rrr written. +*/ + +#ifndef __INCstringh +#define __INCstringh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types/vxANSI.h" + +#ifndef NULL +#if defined __GNUG__ +#define NULL (__null) +#else +#if !defined(__cplusplus) && 0 +#define NULL ((void*)0) +#else +#define NULL (0) +#endif +#endif +#endif + +#if defined(__STDC__) || defined(__cplusplus) + +extern void * memchr (const void *__s, int __c, size_t __n); +extern int memcmp (const void *__s1, const void *__s2, size_t __n); +extern void * memcpy (void *__s1, const void *__s2, size_t __n); +extern void * memmove (void *__s1, const void *__s2, size_t __n); +extern void * memset (void *__s, int __c, size_t __n); + +extern char * strcat (char *__s1, const char *__s2); +extern char * strchr (const char *__s, int __c); +extern int strcmp (const char *__s1, const char *__s2); +extern int strcoll (const char *__s1, const char *__s2); +extern char * strcpy (char *__s1, const char *__s2); +extern size_t strcspn (const char *__s1, const char *__s2); +extern char * strdup (const char * str); +extern size_t strlen (const char *__s); +extern char * strncat (char *__s1, const char *__s2, size_t __n); +extern int strncmp (const char *__s1, const char *__s2, size_t __n); +extern char * strncpy (char *__s1, const char *__s2, size_t __n); +extern char * strpbrk (const char *__s1, const char *__s2); +extern char * strrchr (const char *__s, int __c); +extern size_t strspn (const char *__s1, const char *__s2); +extern char * strstr (const char *__s1, const char *__s2); +extern char * strtok (char *__s, const char *__sep); +extern size_t strxfrm (char *__s1, const char *__s2, size_t __n); +extern char * strerror(int __errcode); + +#if _EXTENSION_POSIX_REENTRANT /* undef for ANSI */ +extern char * strtok_r (char *__s, const char *__sep, char **__ppLast); +#endif + +#if _EXTENSION_WRS /* undef for ANSI */ +extern int strerror_r (int __errcode, char *__buf); +extern void bcopy (const char *source, char *dest, int nbytes); +extern void bcopyBytes (char *source, char *dest, int nbytes); +extern void bcopyWords (char *source, char *dest, int nwords); +extern void bcopyLongs (char *source, char *dest, int nlongs); +extern void bfill (char *buf, int nbytes, int ch); +extern void bfillBytes (char *buf, int nbytes, int ch); +extern void bzero (char *buffer, int nbytes); +extern int bcmp (char *buf1, char *buf2, int nbytes); +extern void binvert (char *buf, int nbytes); +extern void bswap (char *buf1, char *buf2, int nbytes); +extern void uswab (char *source, char *destination, int nbytes); +extern void swab (char *source, char *dest, int nbytes); +extern char * index (const char *s, int c); +extern char * rindex (const char *s, int c); +extern size_t strlcat (char *dst, const char *src, size_t siz); +extern size_t strlcpy (char *dst, const char *src, size_t siz); +#endif + +#else /* __STDC__ */ + +extern void * memchr (); +extern int memcmp (); +extern void * memcpy (); +extern void * memmove (); +extern void * memset (); + +extern char * strcat (); +extern char * strchr (); +extern int strcmp (); +extern int strcoll (); +extern char * strcpy (); +extern char * strdup (); +extern size_t strcspn (); +extern size_t strlen (); +extern char * strncat (); +extern int strncmp (); +extern char * strncpy (); +extern char * strpbrk (); +extern char * strrchr (); +extern size_t strspn (); +extern char * strstr (); +extern char * strtok (); +extern size_t strxfrm (); +extern char * strerror (); + +#if _EXTENSION_POSIX_REENTRANT /* undef for ANSI */ +extern char * strtok_r (); +#endif + +#if _EXTENSION_WRS /* undef for ANSI */ +extern int strerror_r (); +extern void bcopy (); +extern void bcopyBytes (); +extern void bcopyWords (); +extern void bcopyLongs (); +extern void bfill (); +extern void bfillBytes (); +extern void bzero (); +extern int bcmp (); +extern void binvert (); +extern void bswap (); +extern void uswab (); +extern void swab (); +extern char * index (); +extern char * rindex (); +extern size_t strlcat (); +extern size_t strlcpy (); +#endif + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCstringh */ diff --git a/h/sun.h b/h/sun.h new file mode 100644 index 0000000..ca5b8eb --- /dev/null +++ b/h/sun.h @@ -0,0 +1,54 @@ +/* sun.h - miscellaneous SUN constants */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +------------------ +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -changed copyright notice +01b,05oct90,shl added copyright notice. + made #endif ANSI style. +01a,28apr89,gae created. +*/ + +#ifndef __INCsunh +#define __INCsunh + +#ifdef __cplusplus +extern "C" { +#endif + +#define NBPG 0x2000 + +#define SYSBASE 0x0F000000 + +#define MMU_PAGESIZE 0x2000 /* 8192 bytes */ +#define MMU_PAGESHIFT 13 /* log2(MMU_PAGESIZE) */ +#define MMU_PAGEOFFSET (MMU_PAGESIZE-1)/* Mask of address bits in page */ +#define MMU_PAGEMASK (~MMU_PAGEOFFSET) + +#define PAGESIZE 0x2000 /* All of the above, for logical */ +#define PAGESHIFT 13 +#define PAGEOFFSET (PAGESIZE - 1) +#define PAGEMASK (~PAGEOFFSET) + +#define ptob(x) ((x) << PAGESHIFT) +#define btop(x) (((unsigned)(x)) >> PAGESHIFT) +#define btopr(x) ((((unsigned)(x) + PAGEOFFSET) >> PAGESHIFT)) + +/* memory space types */ + +#define SUN_MEM 0x0 /* Main Memory/ video memory */ +#define SUN_IO 0x1 /* SUN I/O space */ +#define SUN_VME16 0x2 /* VME 16 bit data space */ +#define SUN_VME32 0x3 /* VME 32 bit data space */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsunh */ diff --git a/h/symLib.h b/h/symLib.h new file mode 100644 index 0000000..0e3ff0f --- /dev/null +++ b/h/symLib.h @@ -0,0 +1,131 @@ +/* symLib.h - symbol table subroutine library header */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +04k,14apr05,v_r Marked obsolete errnos. +04j,03mar05,v_r Fixed SPR #98274 (loader backward compatibility errno review). + Cleanups + code conventions compliancy work. +04i,06apr04,jn Clean up - remove unused declarations and development-related + comments (merge work done in AE loader here) +04h,03apr03,to added status codes. +04g,15oct01,jn move private funcs into symLibP.h +04f,04sep98,cdp make Thumb-specific changes dependent on ARM_THUMB. +04e,02dec97,cdp added thumbSymTblAdd(). +04d,30oct96,elp Added syncSymAddRtn, symSymRemoveRtn function pointers and + symSAdd(). +04c,22sep92,rrr added support for c++ +04b,28jul92,jmm added prototype for symAdd +04a,04jul92,jcf cleaned up. +03t,22jun92,jmm removed symFooWithGroup, added parameter to routines instead +03s,26may92,rrr the tree shuffle +03r,15may92,jmm Changed "symFooGroup" to "symFooWithGroup" +03i,30apr92,jmm Added support for goup numbers +03h,02jan92,gae used UINT's for value in symFindByValue{AndType}. +03g,13dec91,gae made symFindByCName() consistent with other symFind* routines. +03f,26nov91,llk added symName(). +03e,04oct91,rrr passed through the ansification filter + -changed copyright notice +03d,05oct90,dnw deleted private functions. +03c,05oct90,shl added ANSI function prototypes. + added copyright notice. +03b,26jun90,jcf removed symbol table id error. +03a,22nov89,jcf changed for hasing/multiple access implementation +02d,30may88,dnw changed to v4 names. +02c,24dec86,gae changed stsLib.h to vwModNum.h. +02b,05jun86,dnw changed SYMTAB structure to have ptr to symbol array + instead of imbedded array. +02a,11oct85,dnw changed SYMTAB structure to have maxSymbols instead of + string table pool pointer. + deleted obsolete definition of MAX_SYM_LENGTH. +01g,11jun85,rdc added maxSymLength and free to the SYMTAB structure. + These were necessary + for variable symbol length. +01f,13aug84,ecs deleted status code S_sysLib_EMPTY_SYMBOL_TABLE. +01e,08aug84,ecs added include of stsLib.h, symLib status codes. +01d,27jun84,ecs changed length of name in SYMBOL to allow room for EOS. +01c,15jun84,dnw moved typedefs for SYMBOL and SYMTAB here from symLib.c. + added typedef for SYMTAB_ID. +01b,27jan84,ecs added inclusion test. +01a,03aug83,dnw written +*/ + +#ifndef __INCsymLibh +#define __INCsymLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HOST +#include "tgtmem.h" +#endif + +#include "symbol.h" + +/* status codes */ + +#define S_symLib_SYMBOL_NOT_FOUND (M_symLib | 1) +#define S_symLib_NAME_CLASH (M_symLib | 2) +#define S_symLib_TABLE_NOT_EMPTY (M_symLib | 3) +#define S_symLib_SYMBOL_STILL_IN_TABLE (M_symLib | 4) /* obsoleted */ +#define S_symLib_INVALID_SYMBOL_NAME (M_symLib | 5) +#define S_symLib_INVALID_SYMTAB_ID (M_symLib | 12) +#define S_symLib_INVALID_SYM_ID_PTR (M_symLib | 13) + +/* Type definitions */ + +typedef struct symtab * SYMTAB_ID; + +/* default group number */ + +IMPORT UINT16 symGroupDefault; +IMPORT FUNCPTR syncSymAddRtn; +IMPORT FUNCPTR syncSymRemoveRtn; + +/* function declarations */ + +extern STATUS symAdd (SYMTAB_ID symTblId, char *name, char *value, + SYM_TYPE type, UINT16 group); +extern STATUS symByValueAndTypeFind (SYMTAB_ID symTblId, UINT value, + char ** pName, int * pValue, + SYM_TYPE * pType, SYM_TYPE sType, + SYM_TYPE mask); +extern STATUS symByValueFind (SYMTAB_ID symTblId, UINT value, char ** pName, + int * pValue, SYM_TYPE * pType); +extern SYMBOL * symEach (SYMTAB_ID symTblId, FUNCPTR routine, int routineArg); +extern STATUS symFindByNameAndType (SYMTAB_ID symTblId, char * name, + char** pValue, SYM_TYPE *pType, + SYM_TYPE sType, SYM_TYPE mask); +extern STATUS symFindByName(SYMTAB_ID symTblId, char * name, char ** pValue, + SYM_TYPE * pType); +extern STATUS symFindByValueAndType (SYMTAB_ID symTblId, UINT value, + char * name, int *pValue, + SYM_TYPE * pType, SYM_TYPE sType, + SYM_TYPE mask); +extern STATUS symFindByValue(SYMTAB_ID symTblId, UINT value, char * name, + int * pValue, SYM_TYPE * pType); +extern STATUS symFree (SYMTAB_ID symTblId, SYMBOL *pSymbol); +extern STATUS symLibInit (void); +extern STATUS symRemove (SYMTAB_ID symTblId, char *name, SYM_TYPE type); +extern void symShowInit (void); +extern STATUS symShow (SYMTAB_ID symTblId, char *substr); +extern STATUS symTblAdd (SYMTAB_ID symTblId, SYMBOL *pSymbol); +extern SYMTAB_ID symTblCreate (int hashSizeLog2, BOOL sameNameOk, + PART_ID symPartId); +extern STATUS symTblDelete (SYMTAB_ID symTblId); +extern STATUS symTblRemove (SYMTAB_ID symTblId, SYMBOL *pSymbol); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsymLibh */ diff --git a/h/symSync.h b/h/symSync.h new file mode 100644 index 0000000..0805d27 --- /dev/null +++ b/h/symSync.h @@ -0,0 +1,37 @@ +/* symSync.h - symbol table synchronisation */ + +/* Copyright 1984-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,06apr93,smb written +*/ + +#ifndef __INCsymsynch +#define __INCsymsynch + + +#ifdef __cplusplus +extern "C" { +#endif + +/* Function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +STATUS symTblLock (SYMTAB_ID symTblId); +STATUS symTblUnlock (SYMTAB_ID symTblId); + +#else /* __STDC__ */ + +STATUS symTblLock (); +STATUS symTblUnlock (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsymsynch*/ diff --git a/h/symSyncLib.h b/h/symSyncLib.h new file mode 100644 index 0000000..a0d5c4f --- /dev/null +++ b/h/symSyncLib.h @@ -0,0 +1,52 @@ +/* symSyncLib.h - header file for symSyncLib.c */ + +/* Copyright 1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,13dec96,elp changed syncLibInit() into symSyncLibInit(), added + symSyncTimeoutSet(). +01b,06nov96,elp Removed useless definitions. +01a,04oct96,elp written. +*/ + +#ifndef __INCsyncLibh +#define __INCsyncLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" +#include "stdlib.h" +#include "wtx.h" +#include "symLib.h" +#include "moduleLib.h" +#include "dllLib.h" + +/* externals */ + +extern UINT32 syncRegistry; /* registry inet address */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void symSyncLibInit (); +extern UINT32 symSyncTimeoutSet (UINT32 timeout); + +#else /* __STDC__ */ + +extern void symSyncLibInit (); +extern UINT32 symSyncTimeoutSet (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsyncLibh */ diff --git a/h/symUtilLib.h b/h/symUtilLib.h new file mode 100644 index 0000000..edd6430 --- /dev/null +++ b/h/symUtilLib.h @@ -0,0 +1,56 @@ +/* symUtilLib.h - symbol table utilities library header */ + +/* Copyright 1999-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,18aug04,bpn Modified to support C++ demangled symbol names in a better + way. +01f,04mar04,bpn Added support for C++ symbol namespace. +01e,28jan04,bpn Modified symListGet() API. +01d,08jul03,bpn Updated symListGet() API. +01c,27jun03,bpn Removed PD references. +01b,20dec99,rlp modified the symListGet API and the MATCH_SYMBOL structure. +01a,18aug99,jmp written. +*/ + +#ifndef __INCsymUtilLibh +#define __INCsymUtilLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* typedefs */ + +typedef enum + { + STR_MATCH, /* C symbol contains the string */ + C_MATCH, /* C symbol begins by string */ + TERSE_MATCH, /* Terse name begins by string */ + DEMANGLE_MATCH /* Demangled name begins by string */ + } MATCH_SYMBOL_TYPE; + +/* This structure is entirely allocated in one memory block */ + +typedef struct + { + NODE node; + char * name; /* matching C symbol name */ + char * terseName; /* terse name or NULL */ + char * signature; /* signature or NULL */ + MATCH_SYMBOL_TYPE type; /* matching type */ + } MATCH_SYMBOL; + +extern void symListGet (SYMTAB_ID symTabId, const char * string, + BOOL demangleMatching, LIST * pSymList); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsymUtilLibh */ diff --git a/h/symbol.h b/h/symbol.h new file mode 100644 index 0000000..f178870 --- /dev/null +++ b/h/symbol.h @@ -0,0 +1,102 @@ +/* symbol.h - symbol structure header */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +02i,07mar05,v_r Cleanups + code conventions compliancy work. + Moved SYMBOL struct here as it's needed by published APIs. +02h,18sep04,jn Apply code review changes +02g,01apr04,jn Change values of symbol type macros. Symbol types + should now only be examined using the SYM_IS_... + family of macros defined here. +02f,29oct01,jn create symbolP.h +02e,25jul97,cdp added SYM_THUMB. +02d,26mai96,dbt added support for PowerPC SDA-related symbols. +02c,22sep92,rrr added support for c++ +02b,14jul92,jmm added define of SYM_MASK_EXACT for symTblRemove +02a,04jul92,jcf cleaned up. +01f,26may92,rrr the tree shuffle +01e,30apr92,jmm Added support for group numbers +01d,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed TINY and UTINY to INT8 and UINT8 + -changed copyright notice +01c,19may91,gae changed UINT8 to unsigned char. +01b,05oct90,shl added copyright notice. +01a,10dec89,jcf written by pulling out of symLib.h. +*/ + +#ifndef __INCsymbolh +#define __INCsymbolh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "sllLib.h" + +/* symbol types */ + +typedef unsigned char SYM_TYPE; + +typedef struct symbol /* SYMBOL - entry in symbol table */ + { + SL_NODE nameHNode; /* hash node (must come first) */ + char *name; /* pointer to symbol name */ + void *value; /* symbol value */ + UINT32 symRef; /* moduleId of module, or predefined SYMREF. */ + UINT32 group; /* symbol group */ + SYM_TYPE type; /* symbol type */ + } SYMBOL; + +typedef SYMBOL * SYMBOL_ID; + +/* + * NOTE: Do not use these symbol type macro definitions directly. Instead + * use the SYM_IS_ masks, defined below, to test whether a symbol + * is global, absolute, etc. This will prevent backwards and/or forwards + * compatibility issues in the case that it becomes necessary to change + * the values of these macros or method of storing the symbol type. + */ + +#define SYM_UNDF 0x0 /* undefined (lowest 8 bits only) */ +#define SYM_GLOBAL 0x1 /* global (external) */ +#define SYM_ABS 0x2 /* absolute */ +#define SYM_TEXT 0x4 /* text */ +#define SYM_DATA 0x8 /* data */ +#define SYM_BSS 0x10 /* bss */ +#define SYM_COMM 0x20 /* common symbol */ +#define SYM_LOCAL 0x40 /* local */ +#define SYM_THUMB 0x80 /* Thumb function */ + +#define SYM_IS_UNDF(symType) (!(symType)) +#define SYM_IS_GLOBAL(symType) ((symType) & SYM_GLOBAL) +#define SYM_IS_LOCAL(symType) ((symType) & SYM_LOCAL) +#define SYM_IS_TEXT(symType) ((symType) & SYM_TEXT) +#define SYM_IS_DATA(symType) ((symType) & SYM_DATA) +#define SYM_IS_BSS(symType) ((symType) & SYM_BSS) +#define SYM_IS_ABS(symType) ((symType) & SYM_ABS) +#define SYM_IS_COMMON(symType) ((symType) & SYM_COMM) + +/* symbol masks */ + +#define SYM_MASK_ALL 0xff /* all bits of symbol type valid */ +#define SYM_MASK_NONE 0x00 /* no bits of symbol type valid */ +#define SYM_MASK_EXACT 0x1ff /* match symbol pointer exactly */ + +#define SYM_MASK_ANY_TYPE SYM_MASK_NONE /* ignore type in searches */ +#define SYM_MASK_EXACT_TYPE SYM_MASK_ALL /* match type exactly in searches */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsymbolh */ diff --git a/h/sys/fcntlcom.h b/h/sys/fcntlcom.h new file mode 100644 index 0000000..533377d --- /dev/null +++ b/h/sys/fcntlcom.h @@ -0,0 +1,179 @@ +/* fcntlcom.h - basic control types header */ + +/* Copyright 1984-1999, 2005 Wind River Systems, Inc. */ +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +/* +modification history +-------------------- +01e,01mar05,hya added new defines to support POSIX compliance +01d,13dec99,jkf added _ASMLANGUAGE +01c,25jan93,smb added documentation for POSIX +01b,22sep92,rrr added support for c++ +01a,29jul92,smb taken from UCB stdio. +*/ + +#ifndef __INCfcntlcomh +#define __INCfcntlcomh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types/vxANSI.h" + +/* + * Rewack the FXXXXX values as _FXXXX so that _POSIX_SOURCE works. + */ +#define _FOPEN (-1) /* from sys/file.h, kernel use only */ +#define _FREAD 0x0001 /* read enabled */ +#define _FWRITE 0x0002 /* write enabled */ +#define _FNDELAY 0x0004 /* non blocking I/O (4.2 style) */ +#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */ +#define _FMARK 0x0010 /* internal; mark during gc() */ +#define _FDEFER 0x0020 /* internal; defer for next gc pass */ +#define _FASYNC 0x0040 /* signal pgrp when data ready */ +#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */ +#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */ +#define _FCREAT 0x0200 /* open with file create */ +#define _FTRUNC 0x0400 /* open with truncation */ +#define _FEXCL 0x0800 /* error on open if file exists */ +#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */ +#define _FSYNC 0x2000 /* do all writes synchronously */ +#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */ +#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */ +#define _FDSYNC 0x10000 /* file data only integrity while writing */ +#define _FRSYNC 0x20000 /* sync read operations at same level by */ + /* _FSYNC and _FDSYNC flags */ + +#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) +#define DEFFILEMODE 0666 + +/* + * Flag values for open(2) and fcntl(2) + * The kernel adds 1 to the open modes to turn it into some + * combination of FREAD and FWRITE. + */ +#define O_RDONLY 0 /* +1 == FREAD */ +#define O_WRONLY 1 /* +1 == FWRITE */ +#define O_RDWR 2 /* +1 == FREAD|FWRITE */ +#define O_CREAT _FCREAT + +/* + * added for future POSIX extensions + */ +#define O_APPEND _FAPPEND +#define O_TRUNC _FTRUNC +#define O_EXCL _FEXCL +#define O_NONBLOCK _FNONBLOCK +#define O_NOCTTY _FNOCTTY + +#ifndef _POSIX_SOURCE + +#define O_SYNC _FSYNC +#define O_DSYNC _FDSYNC +#define O_RSYNC _FRSYNC + +/* + * Flags that work for fcntl(fd, F_SETFL, FXXXX) + */ +#define FAPPEND _FAPPEND +#define FSYNC _FSYNC +#define FDSYNC _FDSYNC +#define FRSYNC _FRSYNC +#define FASYNC _FASYNC +#define FNBIO _FNBIO +#define FNONBIO _FNONBLOCK +#define FNDELAY _FNDELAY + +/* + * Flags that are disallowed for fcntl's (FCNTLCANT); + * used for opens, internal state, or locking. + */ +#define FREAD _FREAD +#define FWRITE _FWRITE +#define FMARK _FMARK +#define FDEFER _FDEFER +#define FSHLOCK _FSHLOCK +#define FEXLOCK _FEXLOCK + +/* + * The rest of the flags, used only for opens + */ +#define FOPEN _FOPEN +#define FCREAT _FCREAT +#define FTRUNC _FTRUNC +#define FEXCL _FEXCL +#define FNOCTTY _FNOCTTY + +#endif /*!_POSIX_SOURCE*/ + +/* XXX close on exec request; must match UF_EXCLOSE in user.h */ +#define FD_CLOEXEC 1 /* posix */ + +/* fcntl(2) requests */ +#define F_DUPFD 0 /* Duplicate fildes */ +#define F_GETFD 1 /* Get fildes flags (close on exec) */ +#define F_SETFD 2 /* Set fildes flags (close on exec) */ +#define F_GETFL 3 /* Get file flags */ +#define F_SETFL 4 /* Set file flags */ +#ifndef _POSIX_SOURCE +#define F_GETOWN 5 /* Get owner - for ASYNC */ +#define F_SETOWN 6 /* Set owner - for ASYNC */ +#endif /* !_POSIX_SOURCE */ +#define F_GETLK 7 /* Get record-locking information */ +#define F_SETLK 8 /* Set or Clear a record-lock (Non-Blocking) */ +#define F_SETLKW 9 /* Set or Clear a record-lock (Blocking) */ +#ifndef _POSIX_SOURCE +#define F_RGETLK 10 /* Test a remote lock to see if it is blocked */ +#define F_RSETLK 11 /* Set or unlock a remote lock */ +#define F_CNVT 12 /* Convert a fhandle to an open fd */ +#define F_RSETLKW 13 /* Set or Clear remote record-lock(Blocking) */ +#endif /* !_POSIX_SOURCE */ + +/* fcntl(2) flags (l_type field of flock structure) */ +#define F_RDLCK 1 /* read lock */ +#define F_WRLCK 2 /* write lock */ +#define F_UNLCK 3 /* remove lock(s) */ +#ifndef _POSIX_SOURCE +#define F_UNLKSYS 4 /* remove remote locks for a given system */ +#endif /* !_POSIX_SOURCE */ + +#ifndef _ASMLANGUAGE + +/* file segment locking set data type - information passed to system by user */ +struct flock { + short l_type; /* F_RDLCK, F_WRLCK, or F_UNLCK */ + short l_whence; /* flag to choose starting offset */ + long l_start; /* relative offset, in bytes */ + long l_len; /* length, in bytes; 0 means lock to EOF */ + short l_pid; /* returned with F_GETLK */ + short l_xxx; /* reserved for future use */ +}; + +#ifndef _POSIX_SOURCE +/* extended file segment locking set data type */ +struct eflock { + short l_type; /* F_RDLCK, F_WRLCK, or F_UNLCK */ + short l_whence; /* flag to choose starting offset */ + long l_start; /* relative offset, in bytes */ + long l_len; /* length, in bytes; 0 means lock to EOF */ + short l_pid; /* returned with F_GETLK */ + short l_xxx; /* reserved for future use */ + long l_rpid; /* Remote process id wanting this lock */ + long l_rsys; /* Remote system id wanting this lock */ +}; +#endif /* !_POSIX_SOURCE */ + +#endif /* #ifndef _ASMLANGUAGE */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfcntlcomh */ diff --git a/h/sys/ioctl.h b/h/sys/ioctl.h new file mode 100644 index 0000000..ec42efa --- /dev/null +++ b/h/sys/ioctl.h @@ -0,0 +1,164 @@ +/* ioctl.h - socket ioctl header file */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02n,22jul05,kch Added SIOCMUXL2PASSTHRU for Layer 2 support. +02m,24feb05,dlk Added SIOCMUXPASSTHRU support. Increase maximum + ioctl argument size to 4095 bytes. Added IOCPARM_MAX + and IOCPARM_LEN macros, and other items from ioccom.h. +02l,12oct01,rae merge from truestack (SIOCGMTU) +02k,29apr99,pul Upgraded NPT phase3 code to tor2.0.0 +02j,18mar99,sj added SIOCSIFASYNCFLAGS +02i,11aug93,jmm Changed ioctl.h and socket.h to sys/ioctl.h and sys/socket.h +02h,22sep92,rrr added support for c++ +02g,04jul92,jcf cleaned up. +02f,26may92,rrr the tree shuffle +02e,04oct91,rrr passed through the ansification filter + -changed copyright notice +02d,19aug91,rrr changed to work with ansi compiler +02c,24mar91,del changes to work with gnu960 compiler for i960 port. +02b,05oct90,shl fixed copyright notice. +02a,29apr87,dnw removed unnecessary junk. + added header and copyright. +*/ + +#ifndef __INCioctlh +#define __INCioctlh + +#ifdef __cplusplus +extern "C" { +#endif + +/* socket i/o controls */ + +/* + * Ioctl's have the command encoded in the lower word, + * and the size of any in or out parameters in the upper + * word. The high 2 bits of the upper word are used + * to encode the in/out status of the parameter; for now + * we restrict parameters to at most 4095 bytes, reserving + * the 0x10000000 bit for other use. + */ +#define IOCPARM_MASK 0xfff /* parameters must be < 4096 bytes */ +#define IOCPARM_MAX 0xfff /* absolute maximum param size */ +#define IOC_VOID 0x20000000 /* no parameters */ +#define IOC_OUT 0x40000000 /* copy out parameters */ +#define IOC_IN 0x80000000 /* copy in parameters */ +#define IOC_INOUT (IOC_IN|IOC_OUT) +/* the 0x20000000 is so we can distinguish new ioctl's from old */ + +#define IOCPARM_LEN(x) ((((u_long)(x)) >> 16) & IOCPARM_MAX) +#define IOCBASECMD(x) ((x) & ~(IOCPARM_MASK << 16)) +#define IOCGROUP(x) (((x) >> 8) & 0xff) + +#define _IOC(inout,group,num,len) \ + ((unsigned long)(inout | ((len & IOCPARM_MASK) << 16) | \ + ((group) << 8) | (num))) +#define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0) +#define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t)) +#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t)) +/* this should be _IORW, but stdio got there first */ +#define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t)) + +/* + * These definitions are primarily to support SIOCMUXPASSTHRU. + * It's assumed that tunnellable IOCTLs will have IOC_USER set. + * Note that IOC_USER overlaps the high bit of the type (x) byte. + * When this byte is an ASCII character, its high bit will be 0; + * but if the high bit of the type byte x is set, _IOR(x,y,t) + * and _IORU(x,y,t) (for instance) will be indistinguishable. + */ + +#define IOC_USER 0x8000 /* tunnellable from RTP space */ +#define _IOU(g,n) (IOC_USER|_IO(g,n)) +#define _IORU(g,n,t) (IOC_USER|_IOR(g,n,t)) +#define _IOWU(g,n,t) (IOC_USER|_IOW(g,n,t)) +#define _IOWRU(g,n,t) (IOC_USER|_IOWR(g,n,t)) + + +#define SIOCSHIWAT _IOW('s', 0, int) /* set high watermark */ +#define SIOCGHIWAT _IOR('s', 1, int) /* get high watermark */ +#define SIOCSLOWAT _IOW('s', 2, int) /* set low watermark */ +#define SIOCGLOWAT _IOR('s', 3, int) /* get low watermark */ +#define SIOCATMARK _IOR('s', 7, int) /* at oob mark? */ +#define SIOCSPGRP _IOW('s', 8, int) /* set process group */ +#define SIOCGPGRP _IOR('s', 9, int) /* get process group */ + +#define SIOCADDRT _IOW('r', 10, struct ortentry) /* add route */ +#define SIOCDELRT _IOW('r', 11, struct ortentry) /* delete route */ + +#if 0 /* OLD XXX */ +#define SIOCSIFADDR _IOW('i', 12, struct ifreq) /* set ifnet address */ +#define SIOCGIFADDR _IOWR('i',13, struct ifreq) /* get ifnet address */ +#define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) /* set p-p address */ +#define SIOCGIFDSTADDR _IOWR('i',15, struct ifreq) /* get p-p address */ +#define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) /* set ifnet flags */ +#define SIOCGIFFLAGS _IOWR('i',17, struct ifreq) /* get ifnet flags */ +#define SIOCGIFBRDADDR _IOWR('i',18, struct ifreq) /* get broadcast addr */ +#define SIOCSIFBRDADDR _IOW('i',19, struct ifreq) /* set broadcast addr */ +#define SIOCGIFCONF _IOWR('i',20, struct ifconf) /* get ifnet list */ +#define SIOCGIFNETMASK _IOWR('i',21, struct ifreq) /* get net addr mask */ +#define SIOCSIFNETMASK _IOW('i',22, struct ifreq) /* set net addr mask */ +#define SIOCGIFMETRIC _IOWR('i',23, struct ifreq) /* get IF metric */ +#define SIOCSIFMETRIC _IOW('i',24, struct ifreq) /* set IF metric */ + +#define SIOCSARP _IOW('i', 30, struct arpreq) /* set arp entry */ +#define SIOCGARP _IOWR('i',31, struct arpreq) /* get arp entry */ +#define SIOCDARP _IOW('i', 32, struct arpreq) /* delete arp entry */ +#endif + +#define SIOCSIFADDR _IOW('i', 12, struct ifreq) /* set ifnet address */ +#define OSIOCGIFADDR _IOWR('i', 13, struct ifreq) /* get ifnet address */ +#define SIOCGIFADDR _IOWR('i', 33, struct ifreq) /* get ifnet address */ +#define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) /* set p-p address */ +#define OSIOCGIFDSTADDR _IOWR('i', 15, struct ifreq) /* get p-p address */ +#define SIOCGIFDSTADDR _IOWR('i', 34, struct ifreq) /* get p-p address */ +#define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) /* set ifnet flags */ +#define SIOCGIFFLAGS _IOWR('i', 17, struct ifreq) /* get ifnet flags */ +#define OSIOCGIFBRDADDR _IOWR('i', 18, struct ifreq) /* get broadcast addr */ +#define SIOCGIFBRDADDR _IOWR('i', 35, struct ifreq) /* get broadcast addr */ +#define SIOCSIFBRDADDR _IOW('i', 19, struct ifreq) /* set broadcast addr */ +#define SIOCSARP _IOW('i', 30, struct arpreq) /* set arp entry */ +#define SIOCGARP _IOWR('i',31, struct arpreq) /* get arp entry */ +#define SIOCDARP _IOW('i', 32, struct arpreq) /* delete arp entry */ + +#define OSIOCGIFCONF _IOWR('i', 20, struct ifconf) /* get ifnet list */ +#define SIOCGIFCONF _IOWR('i', 36, struct ifconf) /* get ifnet list */ +#define OSIOCGIFNETMASK _IOWR('i', 21, struct ifreq) /* get net addr mask */ +#define SIOCGIFNETMASK _IOWR('i', 37, struct ifreq) /* get net addr mask */ +#define SIOCSIFNETMASK _IOW('i', 22, struct ifreq) /* set net addr mask */ +#define SIOCGIFMETRIC _IOWR('i', 23, struct ifreq) /* get IF metric */ +#define SIOCSIFMETRIC _IOW('i', 24, struct ifreq) /* set IF metric */ +#define SIOCDIFADDR _IOW('i', 25, struct ifreq) /* delete IF addr */ +#define SIOCAIFADDR _IOW('i', 26, struct ifaliasreq)/* add/chg IF alias */ + +#define SIOCADDMULTI _IOW('i', 49, struct ifreq) /* add m'cast addr */ +#define SIOCDELMULTI _IOW('i', 50, struct ifreq) /* del m'cast addr */ +#define SIOCGETMULTI _IOWR('i', 51, struct ifmreq) /* get m'cast addr */ + + +#define SIOCSIFMTU _IOW('i', 127, struct ifreq) /* set ifnet mtu */ +#define SIOCGIFMTU _IOWR('i', 126, struct ifreq) /* get ifnet mtu */ +#define SIOCSIFASYNCMAP _IOW('i', 125, struct ifreq) /* set ppp asyncmap */ +#define SIOCGIFASYNCMAP _IOWR('i', 124, struct ifreq) /* get ppp asyncmap */ +#define SIOCSIFASYNCFLAGS _IOWR('i', 123, struct ifreq) /* intf. flags changed*/ + +#define SIOCMUXPASSTHRU _IOW('e', 122, MUX_PASSTHRU) /* tunnel ioctl to + mux layer */ + +#define SIOCMUXL2PASSTHRU _IOW('e', 123, MUX_PASSTHRU) /* tunnel L2 ioctl to + mux layer */ + +/* Duplicate of END ioctl to prevent include file dependencies. */ + +#define SIOCGMTU _IOR('e', 26, MTU_QUERY *) /* get mtu for PMP case */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCioctlh */ diff --git a/h/sys/mman.h b/h/sys/mman.h new file mode 100644 index 0000000..a98fa3e --- /dev/null +++ b/h/sys/mman.h @@ -0,0 +1,89 @@ +/* mman.h - memory management library header file */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,06jan05,zl added _mctrl support. reversed previous change. +01e,01oct04,gls made type off_t64 +01d,14jun04,gls added MAP_ANON_FD and MAP_ANONYMOUS +01c,11jun04,gls added MAP_ANON +01b,09sep03,zl added mmap(), mmunmap(), mprotect() +01a,05nov93,dvs written +*/ + +#ifndef __INCmmanh +#define __INCmmanh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" + +/* memory locking flags */ + +#define MCL_CURRENT 0x1 /* currently not used */ +#define MCL_FUTURE 0x2 /* currently not used */ + +/* mmap protection, flag and return value */ + +#define PROT_NONE 0x0000 /* Page cannot be accessed */ +#define PROT_READ 0x0001 /* Page can be read */ +#define PROT_WRITE 0x0002 /* Page can be written */ +#define PROT_EXEC 0x0004 /* Page can be executed */ + +#define MAP_SHARED 0x0001 /* Share changes */ +#define MAP_PRIVATE 0x0002 /* Changes are private */ +#define MAP_ANON 0x0004 /* Use anonymous memory */ +#define MAP_FIXED 0x0010 /* Interpret addr exactly */ + +#define MAP_FAILED ((void *) -1) /* mmap() error return value */ + +#define MAP_ANON_FD -1 /* required fd value for mmap */ + +/* BSD uses MAP_ANON and Linux uses MAP_ANONYMOUS. We'll provide both */ + +#define MAP_ANONYMOUS MAP_ANON + +/* + * function definitions for _mctrl(); these should not be used directly, + * but via the wrapper functions, such as cacheLib. + */ + +#define MCTL_CACHE_FLUSH 1 /* cache flush */ +#define MCTL_CACHE_INVALIDATE 2 /* cache invalidate */ +#define MCTL_CACHE_CLEAR 3 /* cache clear*/ +#define MCTL_CACHE_TEXT_UPDATE 4 /* cache text update */ + + +#ifndef _ASMLANGUAGE + +/* Function declarations */ + +extern int mlockall (int flags); +extern int munlockall (void); +extern int mlock (const void * addr, size_t len); +extern int munlock (const void * addr, size_t len); +extern void * mmap (void *addr, size_t len, int prot, int flags, int fildes, + off_t off); +extern int mprotect (void *addr, size_t len, int prot); +extern int munmap (void * addr, size_t len); + +#ifdef _WRS_KERNEL +extern void * mmap64 (void *addr, size_t len, int prot, int flags, int fildes, + off_t64 off); +#else +extern int _mctl (void *addr, size_t len, int function, int arg); +#endif + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmmanh */ diff --git a/h/sys/resource.h b/h/sys/resource.h new file mode 100644 index 0000000..87e8a71 --- /dev/null +++ b/h/sys/resource.h @@ -0,0 +1,53 @@ +/* resource.h - process resource access header file */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,23sep04,yvp written. +*/ + +#ifndef __INCresourceh +#define __INCresourceh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "types/vxTypesOld.h" + + /* defines */ + +#define P_PID 0 + +/* Resource limits */ + +#define RLIMIT_CPU 0 /* cpu time in seconds */ +#define RLIMIT_FSIZE 1 /* maximum file size */ +#define RLIMIT_DATA 2 /* data size */ +#define RLIMIT_STACK 3 /* stack size */ +#define RLIMIT_CORE 4 +#define RLIMIT_RSS 5 +#define RLIMIT_MEMLOCK 6 +#define RLIMIT_NPROC 7 /* number of processes */ +#define RLIMIT_NOFILE 8 /* number of open files */ +#define RLIMIT_OFILE RLIMIT_NOFILE /* compat */ + +#define RLIM_NLIMITS 9 /* number of resource limits */ + +#define RLIM_INFINITY (((UINT64)1 << 63) - 1) + +struct rlimit { + size_t rlim_cur; /* current (soft) limit */ + size_t rlim_max; /* maximum value for rlim_cur */ +}; + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCresourceh */ diff --git a/h/sys/socket.h b/h/sys/socket.h new file mode 100644 index 0000000..189611c --- /dev/null +++ b/h/sys/socket.h @@ -0,0 +1,384 @@ +/* socket.h - socket header */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* $NetBSD: socket.h,v 1.10 1994/06/29 06:45:27 cgd Exp $ */ + +/* + * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)socket.h 8.4 (Berkeley) 2/21/94 + */ + +/* +modification history +-------------------- +03c,12oct01,rae merge from truestack (path MTU, VIRTUAL_STACK) +03b,04feb97,vin added #defines in msghdr struct for backward compatibility. + the fields msg_accrights in bsd4.3 is used with only + unix domains, which we do not support. +03a,03mar96,vin integrated with 02e of socket.h. +02e,25jul95,dzb added AF_INET_BSD and AF_INET_STREAMS. +02d,27mar95,sgv added Mentat socket.h diffs. +02c,26sep94,dzb added MSG_MBUF, MSG_IGNORE_SB socket flags. +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01m,04jul92,smb made to include vxWorks.h +01l,26may92,rrr the tree shuffle +01k,04oct91,rrr passed through the ansification filter + -changed includes to have absolute path from h/ + -fixed #else and #endif + -changed copyright notice +01j,10jun91,del added pragma for gnu960 alignment. +01h,06oct90,hjb restored typedef of SOCKADDR +01g,05oct90,shl added copyright notice. + made #endif ANSI style. +01f,18mar90,hjb added MSG_NO_UIO +01e,16apr89,gae updated to new 4.3BSD. +01d,29apr87,dnw added header and copyright. +01c,02apr87,ecs added typedef of SOCKADDR +01b,21dec86,dnw added include of types.h +*/ + +#ifndef __INCsocketh +#define __INCsocketh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Definitions related to sockets: types, address families, options. + */ + +/* + * Types + */ +#define SOCK_STREAM 1 /* stream socket */ +#define SOCK_DGRAM 2 /* datagram socket */ +#define SOCK_RAW 3 /* raw-protocol interface */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequenced packet stream */ + +/* + * Option flags per-socket. + */ +#define SO_DEBUG 0x0001 /* turn on debugging info recording */ +#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */ +#define SO_REUSEADDR 0x0004 /* allow local address reuse */ +#define SO_KEEPALIVE 0x0008 /* keep connections alive */ +#define SO_DONTROUTE 0x0010 /* just use interface addresses */ +#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */ +#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ +#define SO_LINGER 0x0080 /* linger on close if data present */ +#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ +#define SO_REUSEPORT 0x0200 /* allow local address & port reuse */ +#define SO_USEPATHMTU 0x0400 /* enable path MTU discovery */ +#define SO_VSID 0x0800 /* virtual stack id */ + +/* + * Additional options, not kept in so_options. + */ +#define SO_SNDBUF 0x1001 /* send buffer size */ +#define SO_RCVBUF 0x1002 /* receive buffer size */ +#define SO_SNDLOWAT 0x1003 /* send low-water mark */ +#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ +#define SO_SNDTIMEO 0x1005 /* send timeout */ +#define SO_RCVTIMEO 0x1006 /* receive timeout */ +#define SO_ERROR 0x1007 /* get error status and clear */ +#define SO_TYPE 0x1008 /* get socket type */ +#define SO_PROTOTYPE 0x1009 /* get/set protocol type */ + +#define SO_PATHMTU_TBL 0x100a /* get/set path MTU table */ + +/* + * An option specification consists of an opthdr, followed by the value of + * the option. An options buffer contains one or more options. The len + * field of opthdr specifies the length of the option value in bytes. This + * length must be a multiple of sizeof (long) (use OPTLEN macro). + */ + +struct opthdr { + long level; /* protocol level affected */ + long name; /* option to modify */ + long len; /* length of option value */ +}; + +#define OPTLEN(x) ((((x) + sizeof (long) - 1) / sizeof (long)) * sizeof (long)) +#define OPTVAL(opt) ((char *)(opt + 1)) + +/* + * Structure used for manipulating linger option. + */ +struct linger { + int l_onoff; /* option on/off */ + int l_linger; /* linger time */ +}; + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +#define SOL_SOCKET 0xffff /* options for socket level */ + +/* + * Address families. + */ +#define AF_UNSPEC 0 /* unspecified */ +#define AF_LOCAL 1 /* local to host (pipes, portals) */ +#define AF_UNIX AF_LOCAL /* backward compatibility */ +#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ +#define AF_IMPLINK 3 /* arpanet imp addresses */ +#define AF_PUP 4 /* pup protocols: e.g. BSP */ +#define AF_CHAOS 5 /* mit CHAOS protocols */ +#define AF_NS 6 /* XEROX NS protocols */ +#define AF_ISO 7 /* ISO protocols */ +#define AF_OSI AF_ISO +#define AF_ECMA 8 /* european computer manufacturers */ +#define AF_DATAKIT 9 /* datakit protocols */ +#define AF_CCITT 10 /* CCITT protocols, X.25 etc */ +#define AF_SNA 11 /* IBM SNA */ +#define AF_DECnet 12 /* DECnet */ +#define AF_DLI 13 /* DEC Direct data link interface */ +#define AF_LAT 14 /* LAT */ +#define AF_HYLINK 15 /* NSC Hyperchannel */ +#define AF_APPLETALK 16 /* Apple Talk */ +#define AF_ROUTE 17 /* Internal Routing Protocol */ +#define AF_LINK 18 /* Link layer interface */ +#define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */ +#define AF_COIP 20 /* connection-oriented IP, aka ST II */ +#define AF_CNT 21 /* Computer Network Technology */ +#define pseudo_AF_RTIP 22 /* Help Identify RTIP packets */ +#define AF_IPX 23 /* Novell Internet Protocol */ +#define AF_SIP 24 /* Simple Internet Protocol */ +#define pseudo_AF_PIP 25 /* Help Identify PIP packets */ + +#define AF_MAX 26 + +#define AF_INET_BSD 100 /* BSD-specific INET af */ +#define AF_INET_STREAMS 101 /* STREAMS-specific INET af */ + + +/* + * Structure used by kernel to store most + * addresses. + */ +struct sockaddr { + u_char sa_len; /* total length */ + u_char sa_family; /* address family */ + char sa_data[14]; /* actually longer; address value */ +}; + +typedef struct sockaddr SOCKADDR; + +/* + * Structure used by kernel to pass protocol + * information in raw sockets. + */ +struct sockproto { + u_short sp_family; /* address family */ + u_short sp_protocol; /* protocol */ +}; + +/* + * Protocol families, same as address families for now. + */ +#define PF_UNSPEC AF_UNSPEC +#define PF_LOCAL AF_LOCAL +#define PF_UNIX PF_LOCAL /* backward compatibility */ +#define PF_INET AF_INET +#define PF_IMPLINK AF_IMPLINK +#define PF_PUP AF_PUP +#define PF_CHAOS AF_CHAOS +#define PF_NS AF_NS +#define PF_ISO AF_ISO +#define PF_OSI AF_ISO +#define PF_ECMA AF_ECMA +#define PF_DATAKIT AF_DATAKIT +#define PF_CCITT AF_CCITT +#define PF_SNA AF_SNA +#define PF_DECnet AF_DECnet +#define PF_DLI AF_DLI +#define PF_LAT AF_LAT +#define PF_HYLINK AF_HYLINK +#define PF_APPLETALK AF_APPLETALK +#define PF_ROUTE AF_ROUTE +#define PF_LINK AF_LINK +#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */ +#define PF_COIP AF_COIP +#define PF_CNT AF_CNT +#define PF_SIP AF_SIP +#define PF_IPX AF_IPX /* same format as AF_NS */ +#define PF_RTIP pseudo_AF_FTIP /* same format as AF_INET */ +#define PF_PIP pseudo_AF_PIP + +#define PF_MAX AF_MAX + +/* + * Definitions for network related sysctl, CTL_NET. + * + * Second level is protocol family. + * Third level is protocol number. + * + * Further levels are defined by the individual families below. + */ +#define NET_MAXID AF_MAX + +#define CTL_NET_NAMES { \ + { 0, 0 }, \ + { "unix", CTLTYPE_NODE }, \ + { "inet", CTLTYPE_NODE }, \ + { "implink", CTLTYPE_NODE }, \ + { "pup", CTLTYPE_NODE }, \ + { "chaos", CTLTYPE_NODE }, \ + { "xerox_ns", CTLTYPE_NODE }, \ + { "iso", CTLTYPE_NODE }, \ + { "emca", CTLTYPE_NODE }, \ + { "datakit", CTLTYPE_NODE }, \ + { "ccitt", CTLTYPE_NODE }, \ + { "ibm_sna", CTLTYPE_NODE }, \ + { "decnet", CTLTYPE_NODE }, \ + { "dec_dli", CTLTYPE_NODE }, \ + { "lat", CTLTYPE_NODE }, \ + { "hylink", CTLTYPE_NODE }, \ + { "appletalk", CTLTYPE_NODE }, \ + { "route", CTLTYPE_NODE }, \ + { "link_layer", CTLTYPE_NODE }, \ + { "xtp", CTLTYPE_NODE }, \ + { "coip", CTLTYPE_NODE }, \ + { "cnt", CTLTYPE_NODE }, \ + { "rtip", CTLTYPE_NODE }, \ + { "ipx", CTLTYPE_NODE }, \ + { "sip", CTLTYPE_NODE }, \ + { "pip", CTLTYPE_NODE }, \ +} + +/* + * PF_ROUTE - Routing table + * + * Three additional levels are defined: + * Fourth: address family, 0 is wildcard + * Fifth: type of info, defined below + * Sixth: flag(s) to mask with for NET_RT_FLAGS + */ +#define NET_RT_DUMP 1 /* dump; may limit to a.f. */ +#define NET_RT_FLAGS 2 /* by flags, e.g. RESOLVING */ +#define NET_RT_IFLIST 3 /* survey interface list */ +#define NET_RT_MAXID 4 + +#define CTL_NET_RT_NAMES { \ + { 0, 0 }, \ + { "dump", CTLTYPE_STRUCT }, \ + { "flags", CTLTYPE_STRUCT }, \ + { "iflist", CTLTYPE_STRUCT }, \ +} + +/* + * Maximum queue length specifiable by listen. + */ +#define SOMAXCONN 5 + +/* + * Message header for recvmsg and sendmsg calls. + * Used value-result for recvmsg, value only for sendmsg. + */ +struct msghdr { + caddr_t msg_name; /* optional address */ + u_int msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + u_int msg_iovlen; /* # elements in msg_iov */ + caddr_t msg_control; /* ancillary data, see below */ + u_int msg_controllen; /* ancillary data buffer len */ +/* provided for backward compatibility, access rights not supported by wrs */ +#define msg_accrights msg_control +#define msg_accrightslen msg_controllen + int msg_flags; /* flags on received message */ +}; + +#define MSG_OOB 0x1 /* process out-of-band data */ +#define MSG_PEEK 0x2 /* peek at incoming message */ +#define MSG_DONTROUTE 0x4 /* send without using routing tables */ +#if 1 /* OLD XXX */ +#define MSG_NO_UIO 0x8 /* for system use only */ +#endif /* XXX */ +#define MSG_EOR 0x8 /* data completes record */ +#define MSG_TRUNC 0x10 /* data discarded before delivery */ +#define MSG_CTRUNC 0x20 /* control data lost before delivery */ +#define MSG_WAITALL 0x40 /* wait for full request or error */ +#define MSG_DONTWAIT 0x80 /* this message should be nonblocking */ +#define MSG_MBUF 0x10000 /* mbuf interface - WRS ext. */ +#define MSG_IGNORE_SB 0x20000 /* ignore socket write buf - WRS ext. */ + +#define MSG_MAXIOVLEN 16 +/* + * Header for ancillary data objects in msg_control buffer. + * Used for additional information with/about a datagram + * not expressible by flags. The format is a sequence + * of message elements headed by cmsghdr structures. + */ +struct cmsghdr { + u_int cmsg_len; /* data byte count, including hdr */ + int cmsg_level; /* originating protocol */ + int cmsg_type; /* protocol-specific type */ +/* followed by u_char cmsg_data[]; */ +}; + +/* given pointer to struct cmsghdr, return pointer to data */ +#define CMSG_DATA(cmsg) ((u_char *)((cmsg) + 1)) + + +/* given pointer to struct cmsghdr, return pointer to next cmsghdr */ +#define CMSG_NXTHDR(mhdr, cmsg) \ + (((caddr_t)(cmsg) + (cmsg)->cmsg_len + sizeof(struct cmsghdr) > \ + (mhdr)->msg_control + (mhdr)->msg_controllen) ? \ + (struct cmsghdr *)NULL : \ + (struct cmsghdr *)((caddr_t)(cmsg) + MEM_ALIGNED((cmsg)->cmsg_len))) + +#define CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control) + +/* "Socket"-level control message types: */ +#define SCM_RIGHTS 0x01 /* access rights (array of int) */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsocketh */ diff --git a/h/sys/stat.h b/h/sys/stat.h new file mode 100644 index 0000000..206a1df --- /dev/null +++ b/h/sys/stat.h @@ -0,0 +1,163 @@ +/* stat.h - POSIX definitions for obtaining file characteristics */ + +/* Copyright 1984-1995, 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01o,09aug05,hya added chmod(). +01n,26jan05,jlk SPR 105359 - added const to stat() for POSIX compliance +01m,23sep01,jkf added const to mkdir +01l,28mar95,kdl removed obsolete date/time fields from stat structure. +01k,19apr94,jmm added support for file system stat ({f}statfs()) +01j,22sep92,rrr added support for c++ +01i,18sep92,smb added mkdir prototype +01h,26may92,rrr the tree shuffle +01g,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed TINY and UTINY to INT8 and UINT8 + -changed copyright notice +01f,10jun91.del added pragma for gnu960 alignment. +01e,05oct90,dnw added fstat() and stat() declarations. +01d,05oct90,shl added copyright notice. + made #endif ANSI style. +01c,03oct90,kdl changed comments. +01b,05may90,llk added st_blksize and st_blocks fields so that net directory + can use stat structure. Coincided with removal of + h/net/stat.h. +01a,30apr90,kdl written. +*/ + +#ifndef __INCstath +#define __INCstath + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +#define TIME ULONG /* type for file time fields */ + + +struct stat + { + ULONG st_dev; /* device ID number */ + ULONG st_ino; /* file serial number */ + USHORT st_mode; /* file mode (see below) */ + short st_nlink; /* number of links to file */ + short st_uid; /* user ID of file's owner */ + short st_gid; /* group ID of file's group */ + ULONG st_rdev; /* device ID, only if special file */ + ULONG st_size; /* size of file, in bytes */ + TIME st_atime; /* time of last access */ + TIME st_mtime; /* time of last modification */ + TIME st_ctime; /* time of last change of file status */ + long st_blksize; + long st_blocks; + UINT8 st_attrib; /* file attribute byte (dosFs only) */ + int reserved1; /* reserved for future use */ + int reserved2; /* reserved for future use */ + int reserved3; /* reserved for future use */ + int reserved4; /* reserved for future use */ + int reserved5; /* reserved for future use */ + int reserved6; /* reserved for future use */ + }; + +typedef struct + { + long val[2]; /* file system id type */ + } fsid_t; + +/* + * file system statistics + */ +struct statfs + { + long f_type; /* type of info, zero for now */ + long f_bsize; /* fundamental file system block size */ + long f_blocks; /* total blocks in file system */ + long f_bfree; /* free block in fs */ + long f_bavail; /* free blocks avail to non-superuser */ + long f_files; /* total file nodes in file system */ + long f_ffree; /* free file nodes in fs */ + fsid_t f_fsid; /* file system id */ + long f_spare[7]; /* spare for later */ + }; + +/* File mode (st_mode) bit masks */ + +#define S_IFMT 0xf000 /* file type field */ +#define S_IFIFO 0x1000 /* fifo */ +#define S_IFCHR 0x2000 /* character special */ +#define S_IFDIR 0x4000 /* directory */ +#define S_IFBLK 0x6000 /* block special */ +#define S_IFREG 0x8000 /* regular */ +#define S_IFLNK 0xa000 /* symbolic link */ +#define S_IFSOCK 0xc000 /* socket */ + +#define S_ISUID 0x0800 /* set user id on execution */ +#define S_ISGID 0x0400 /* set group id on execution */ + +#define S_IRUSR 0x0100 /* read permission, owner */ +#define S_IWUSR 0x0080 /* write permission, owner */ +#define S_IXUSR 0x0040 /* execute/search permission, owner */ +#define S_IRWXU 0x01c0 /* read/write/execute permission, owner */ + +#define S_IRGRP 0x0020 /* read permission, group */ +#define S_IWGRP 0x0010 /* write permission, group */ +#define S_IXGRP 0x0008 /* execute/search permission, group */ +#define S_IRWXG 0x0038 /* read/write/execute permission, group */ + +#define S_IROTH 0x0004 /* read permission, other */ +#define S_IWOTH 0x0002 /* write permission, other */ +#define S_IXOTH 0x0001 /* execute/search permission, other */ +#define S_IRWXO 0x0007 /* read/write/execute permission, other */ + + +/* File type test macros */ + +#define S_ISDIR(mode) ((mode & S_IFMT) == S_IFDIR) /* directory */ +#define S_ISCHR(mode) ((mode & S_IFMT) == S_IFCHR) /* character special */ +#define S_ISBLK(mode) ((mode & S_IFMT) == S_IFBLK) /* block special */ +#define S_ISREG(mode) ((mode & S_IFMT) == S_IFREG) /* regular file */ +#define S_ISFIFO(mode) ((mode & S_IFMT) == S_IFIFO) /* fifo special */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS mkdir (const char *dirName); +extern STATUS fstat (int fd, struct stat *pStat); +extern STATUS stat (const char *name, struct stat *pStat); +extern STATUS fstatfs (int fd, struct statfs *pStat); +extern STATUS statfs (char *name, struct statfs *pStat); +extern int chmod (const char *path, mode_t mode); + +#else + +extern STATUS mkdir (); +extern STATUS fstat (); +extern STATUS stat (); +extern STATUS fstatfs (); +extern STATUS statfs (); +extern int chmod (); + +#endif /* __STDC__ */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCstath */ diff --git a/h/sys/sysctl.h b/h/sys/sysctl.h new file mode 100644 index 0000000..77ee376 --- /dev/null +++ b/h/sys/sysctl.h @@ -0,0 +1,589 @@ +/* sysctl.h - sysctl definitions */ + +/* + * Copyright (c) 2004-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Mike Karels at Berkeley Software Design, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)sysctl.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/sys/sys/sysctl.h,v 1.81.2.6 2001/05/17 17:59:53 ru Exp $ + */ + +/* +modification history +-------------------- +02a,26aug05,kk update prototypes to not use C++ keyword new (SPR# 110779) +01z,11apr05,wap Reorganize things so that CTL_MAXNAME is visible to RTPs (SPR + #106195) +01y,07feb05,vvv _KERNEL cleanup +01x,31jan05,niq virtual stack changes for sysctl +01w,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01v,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5-int/1) +01u,24feb04,vvv updated based on review comments +01t,20feb04,vvv added support for transparent nodes +01t,23feb04,kkz added #defines for remlib +01t,12feb04,asr added new defines for loginLib +01s,24nov03,vvv added include for logLib.h +01r,20nov03,niq Remove copyright_wrs.h file inclusion +01q,20nov03,vvv updated for RTP support +01p,05nov03,cdw Removal of unnecessary _KERNEL guards. +01o,04nov03,rlm Ran batch header path update for header re-org. +01n,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01m,08sep03,vvv merged from ACCORDION_BASE6_MERGE_BASELINE +01l,10jun03,vvv include netVersion.h +01k,14may03,vvv made sysctlbyname() available when _KERNEL is not defined +01j,11apr03,syy Fixed Diab compiler warnings +01i,10mar03,ann removed the preceding ## from the macros. +01h,09sep02,hsh add c++ protection +01g,18mar02,ann adding the prototype for sysctlnametomib +01f,11mar02,ann fixing compilation warnings +01e,22feb02,ham changed for tornado build. +01d,21feb02,ann removed the references to MGMT_LOCK +01c,10jan02,ann adding the prototype for sysctl +01b,12dec01,ann corrected the LOG message in SYSCTL_NODE_CHILDREN +01a,05dec01,niq Created from BSD 4.3 +*/ + +#ifndef _SYS_SYSCTL_H_ +#define _SYS_SYSCTL_H_ + +#include +#include +#ifdef _WRS_KERNEL +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + +/* + * Definitions for sysctl call. The sysctl call uses a hierarchical name + * for objects that can be examined or modified. The name is expressed as + * a sequence of integers. Like a file path name, the meaning of each + * component depends on its place in the hierarchy. The top-level and kern + * identifiers are defined here, and other identifiers are defined in the + * respective subsystem header files. + */ + +#include + +/* + * Each subsystem defined by sysctl defines a list of variables + * for that subsystem. Each name is either a node with further + * levels defined below it, or it is a leaf of some particular + * type given below. Each sysctl level defines a set of name/type + * pairs to be used by sysctl(1) in manipulating the subsystem. + */ +struct ctlname { + char *ctl_name; /* subsystem name */ + int ctl_type; /* type of name */ +}; + +#define CTLTYPE 0xf /* Mask for the type */ +#define CTLTYPE_NODE 1 /* name is a node */ +#define CTLTYPE_INT 2 /* name describes an integer */ +#define CTLTYPE_STRING 3 /* name describes a string */ +#define CTLTYPE_QUAD 4 /* name describes a 64-bit number */ +#define CTLTYPE_OPAQUE 5 /* name describes a structure */ +#define CTLTYPE_STRUCT CTLTYPE_OPAQUE /* name describes a structure */ +#define CTLTYPE_UINT 6 /* name describes an unsigned integer */ +#define CTLTYPE_LONG 7 /* name describes a long */ +#define CTLTYPE_ULONG 8 /* name describes an unsigned long */ + +#define CTLFLAG_RD 0x80000000 /* Allow reads of variable */ +#define CTLFLAG_WR 0x40000000 /* Allow writes to the variable */ +#define CTLFLAG_RW (CTLFLAG_RD|CTLFLAG_WR) +#define CTLFLAG_NOLOCK 0x20000000 /* XXX Don't Lock */ +#define CTLFLAG_ANYBODY 0x10000000 /* All users can set this var */ +#define CTLFLAG_SECURE 0x08000000 /* Permit set only if securelevel<=0 */ +#define CTLFLAG_PRISON 0x04000000 /* Prisoned roots can fiddle */ +#define CTLFLAG_DYN 0x02000000 /* Dynamic oid - can be freed */ +#define CTLFLAG_TRANSP 0x01000000 /* Treat node as transparent although */ + /* it has a handler. */ + +/* + * A node is transparent if it has no handler, or if CTLFLAG_TRANSP is set. + * The following macro assumes that oidp points to a node. When CTLFLAG_TRANSP + * is set, the handler is in fact an entry/exit handler. Its arguments are used + * as follows (see SYSCTL_HANDLER_ARGS): + * + * oidp points to the struct sysctl_oid as usual. On exit, this is + * the same (original) oid pointer as passed on entry. + * arg1 points to a transpHandlerData structure which contains two pointers: + * - a (struct sysctl_oid_list *) variable where a pointer to the oid's + * child list is returned. This variable is initialized to oidp->arg1, + * so if there is no child-list swizzling, nothing needs to be done with + * this by the entry handler. + * - a void pointer (pCtx) which can be used by the handler to store + * some status information when invoked as an entry handler which can + * be used later when it is called in exit mode. + * arg2 TRUE on entry, FALSE on exit. The entry/exit handler is always + * called with FALSE after being called with TRUE, as the code + * proceeds deeper into and then back out of the sysctl tree. + * req The sysctl_req structure, as usual. + * + * The handler is called with arg2 TRUE when code is about to descend + * past the transparent node to get its child list. + */ + +#define NODE_TRANSPARENT(oidp) (((oidp)->oid_handler == 0) || \ + (((oidp)->oid_kind & CTLFLAG_TRANSP) != 0)) + + +/* + * USE THIS instead of a hardwired number from the categories below + * to get dynamically assigned sysctl entries using the linker-set + * technology. This is the way nearly all new sysctl variables should + * be implemented. + * e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, ""); + */ +#define OID_AUTO (-1) + +#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, int arg2, \ + struct sysctl_req *req + +/* + * This structure is used to pass data to the transparent node handler (entry/exit). + * It is passed in arg1. pArg1 contains the child list. pCtx can be used by the + * handler to store some context on entry which can then be retrieved on exit. + * For example, the handler for the "net" node (netSysctlHandler) uses pCtx to + * store the splnet status on entry which is then used by splx when the exit + * handler is called. + */ + +struct transpHandlerData + { + struct sysctl_oid_list ** pArg1; + void * pCtx; + }; + +/* supports transparent nodes with entry/exit handlers */ + +struct sysctlTranspData + { + struct sysctl_oid *pStack [CTL_MAXNAME]; /* stores the oid for each */ + /* transparent node. */ + void *pCtx [CTL_MAXNAME]; /* stores the context, if any, */ + /* for the entry/exit handler */ + }; + +/* + * This describes the access space for a sysctl request. This is needed + * so that we can use the interface from the kernel or from user-space. + */ +struct sysctl_req { + struct proc *p; + void *oldptr; + size_t oldlen; + size_t oldidx; + int (*oldfunc)(struct sysctl_req *, const void *, size_t); + void *newptr; + size_t newlen; + size_t newidx; + int (*newfunc)(struct sysctl_req *, void *, size_t); + + /* supports transparent nodes with entry/exit handlers */ + + struct sysctlTranspData transpData; +}; + +SLIST_HEAD(sysctl_oid_list, sysctl_oid); + +/* + * This describes one "oid" in the MIB tree. Potentially more nodes can + * be hidden behind it, expanded by the handler. + */ +struct sysctl_oid { + struct sysctl_oid_list *oid_parent; + SLIST_ENTRY(sysctl_oid) oid_link; + int oid_number; + int oid_kind; + void *oid_arg1; + int oid_arg2; + const char *oid_name; + int (*oid_handler)(SYSCTL_HANDLER_ARGS); + const char *oid_fmt; + int oid_refcnt; +}; + +#define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l) +#define SYSCTL_OUT(r, p, l) (r->oldfunc)(r, p, l) + +int sysctl_handle_int(SYSCTL_HANDLER_ARGS); +int sysctl_handle_long(SYSCTL_HANDLER_ARGS); +int sysctl_handle_intptr(SYSCTL_HANDLER_ARGS); +int sysctl_handle_string(SYSCTL_HANDLER_ARGS); +int sysctl_handle_opaque(SYSCTL_HANDLER_ARGS); + +/* + * These functions are used to add/remove an oid from the mib. + */ +STATUS sysctl_register_oid(struct sysctl_oid *oidp); +void sysctl_unregister_oid(struct sysctl_oid *oidp); + +#define SYSCTL_DECL(name) + +/* Declare the pointer to the oid of a node */ +#define SYSCTL_DECL_NODE(name) \ + struct sysctl_oid * name##_node = 0 + +/* + * Declare the pointer to the oid of a node registered in another module + * as extern + */ +#define SYSCTL_DECL_NODE_EXT(name) \ + extern struct sysctl_oid * name##_node + +/* Hide these in macros */ +#define SYSCTL_CHILDREN(oid_ptr) (struct sysctl_oid_list *)((oid_ptr)->oid_arg1) +#define SYSCTL_STATIC_CHILDREN(oid_name) + +#ifdef _FREE_VERSION + +#define SYSCTL_NODE_CHILDREN(name) \ + ((struct sysctl_oid_list *) (name##_node)->oid_arg1) + +#else /* ! _FREE_VERSION */ + +#define SYSCTL_NODE_CHILDREN(name) \ + _sysctlDbgNodeChildren (name##_node, __FILE__, __LINE__, #name) + +#endif /* ! _FREE_VERSION */ + +/* === Structs and macros related to context handling === */ + +/* All dynamically created sysctls can be tracked in a context list. */ +struct sysctl_ctx_entry { + struct sysctl_oid *entry; + TAILQ_ENTRY(sysctl_ctx_entry) link; +}; + +TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); + +/* Clarinet - Get the externally declared network context list name */ + +#ifndef VIRTUAL_STACK +IMPORT struct sysctl_ctx_list * pNetSysctlCtxList; +#endif +IMPORT struct sysctl_ctx_list * pSysctlCtxList; + +/* This constructs a "raw" MIB oid. */ +#define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ + SYSCTL_ADD_OID(pSysctlCtxList, parent, nbr, name, \ + kind, a1, a2, handler, fmt, descr) + +#define SYSCTLN_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ + SYSCTL_ADD_OID(pNetSysctlCtxList, parent, nbr, name, \ + kind, a1, a2, handler, fmt, descr) + +/* + * The SYSCTLN_TOP_NODE macro is used to install a top level child + * node in the 'net' node (parent should always be net). For virtual stacks, + * the stack specific net_node child list is used as opposed to the one + * pointed to by net_node->oid_arg1 which points to the child list for the + * management stack + */ + +#ifdef VIRTUAL_STACK +#define SYSCTLN_TOP_NODE(parent, nbr, name, access, handler, descr) \ + do { \ + name##_node = sysctl_add_oid (pNetSysctlCtxList, \ + net_node_children, \ + nbr, #name, CTLTYPE_NODE|access, \ + 0, 0, handler, "N", descr); \ + } while (FALSE) +#else +#define SYSCTLN_TOP_NODE SYSCTLN_NODE +#endif /* VIRTUAL_STACK */ + + +#ifdef _FREE_VERSION + +#define SYSCTL_ADD_OID(ctx, parent, nbr, name, kind, a1, a2, \ + handler, fmt, descr) \ + sysctl_add_oid(ctx, SYSCTL_NODE_CHILDREN(parent), nbr, #name, \ + kind, a1, a2, handler, fmt, descr); + +#define SYSCTL_NODE(parent, nbr, name, access, handler, descr) \ + do { \ + name##_node = sysctl_add_oid (pSysctlCtxList, \ + SYSCTL_NODE_CHILDREN(parent), \ + nbr, #name, CTLTYPE_NODE|access, \ + 0, 0, handler, "N", descr); \ + } while (FALSE) + + +#define SYSCTLN_NODE(parent, nbr, name, access, handler, descr) \ + do { \ + name##_node = sysctl_add_oid (pNetSysctlCtxList, \ + SYSCTL_NODE_CHILDREN(parent), \ + nbr, #name, CTLTYPE_NODE|access, \ + 0, 0, handler, "N", descr); \ + } while (FALSE) + +#else /* ! defined _FREE_VERSION */ + +#define SYSCTL_ADD_OID(ctx, parent, nbr, name, kind, a1, a2, \ + handler, fmt, descr) \ + _sysctlDbgAddOid ((ctx), parent##_node, (nbr), #name, (kind), \ + (a1), (a2), (handler), (fmt), (descr), \ + __FILE__, __LINE__, #parent); + +#define SYSCTL_NODE(parent, nbr, name, access, handler, descr) \ + do { \ + name##_node = _sysctlDbgAddOid (pSysctlCtxList, parent##_node,\ + (nbr), #name, \ + CTLTYPE_NODE|(access), 0, 0, \ + (handler), \ + "N", (descr), \ + __FILE__, __LINE__, #parent); \ + } while (FALSE) + + +#define SYSCTLN_NODE(parent, nbr, name, access, handler, descr) \ + do { \ + name##_node = _sysctlDbgAddOid (pNetSysctlCtxList, parent##_node,\ + (nbr), #name, \ + CTLTYPE_NODE|(access), 0, 0, \ + (handler), \ + "N", (descr), \ + __FILE__, __LINE__, #parent); \ + } while (FALSE) +#endif /* ! defined _FREE_VERSION */ + +/* This constructs a node from which other oids can hang. */ + +#define SYSCTL_ADD_NODE(ctx, parent, nbr, name, access, handler, descr) \ + sysctl_add_oid(ctx, parent, nbr, name, \ + CTLTYPE_NODE|access, 0, 0, handler, "N", descr) + +/* Oid for a string. len can be 0 to indicate '\0' termination. */ +#define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \ + SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|access, \ + arg, len, sysctl_handle_string, "A", descr) + +#define SYSCTLN_STRING(parent, nbr, name, access, arg, len, descr) \ + SYSCTLN_OID(parent, nbr, name, CTLTYPE_STRING|access, \ + arg, len, sysctl_handle_string, "A", descr) + +#define SYSCTL_ADD_STRING(ctx, parent, nbr, name, access, arg, len, descr) \ + SYSCTL_ADD_OID(ctx, parent, nbr, name, CTLTYPE_STRING|access, \ + arg, len, sysctl_handle_string, "A", descr) + +/* Oid for an int. If ptr is NULL, val is returned. */ +#define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \ + SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|access, \ + ptr, val, sysctl_handle_int, "I", descr) + +#define SYSCTLN_INT(parent, nbr, name, access, ptr, val, descr) \ + SYSCTLN_OID(parent, nbr, name, CTLTYPE_INT|access, \ + ptr, val, sysctl_handle_int, "I", descr) + +#define SYSCTL_ADD_INT(ctx, parent, nbr, name, access, ptr, val, descr) \ + SYSCTL_ADD_OID(ctx, parent, nbr, name, CTLTYPE_INT|access, \ + ptr, val, sysctl_handle_int, "I", descr) + +/* Oid for an unsigned int. If ptr is NULL, val is returned. */ +#define SYSCTL_UINT(parent, nbr, name, access, ptr, val, descr) \ + SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|access, \ + ptr, val, sysctl_handle_int, "IU", descr) + +#define SYSCTLN_UINT(parent, nbr, name, access, ptr, val, descr) \ + SYSCTLN_OID(parent, nbr, name, CTLTYPE_INT|access, \ + ptr, val, sysctl_handle_int, "IU", descr) + +#define SYSCTL_ADD_UINT(ctx, parent, nbr, name, access, ptr, val, descr) \ + SYSCTL_ADD_OID(ctx, parent, nbr, name, CTLTYPE_INT|access, \ + ptr, val, sysctl_handle_int, "IU", descr) + +/* Oid for a long. The pointer must be non NULL. */ +#define SYSCTL_LONG(parent, nbr, name, access, ptr, val, descr) \ + SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|access, \ + ptr, val, sysctl_handle_long, "L", descr) + +#define SYSCTLN_LONG(parent, nbr, name, access, ptr, val, descr) \ + SYSCTLN_OID(parent, nbr, name, CTLTYPE_INT|access, \ + ptr, val, sysctl_handle_long, "L", descr) + +#define SYSCTL_ADD_LONG(ctx, parent, nbr, name, access, ptr, descr) \ + SYSCTL_ADD_OID(ctx, parent, nbr, name, CTLTYPE_INT|access, \ + ptr, 0, sysctl_handle_long, "L", descr) + +/* Oid for a long. The pointer must be non NULL. */ +#define SYSCTL_ULONG(parent, nbr, name, access, ptr, val, descr) \ + SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|access, \ + ptr, val, sysctl_handle_long, "LU", descr) + +#define SYSCTLN_ULONG(parent, nbr, name, access, ptr, val, descr) \ + SYSCTLN_OID(parent, nbr, name, CTLTYPE_INT|access, \ + ptr, val, sysctl_handle_long, "LU", descr) + +#define SYSCTL_ADD_ULONG(ctx, parent, nbr, name, access, ptr, descr) \ + SYSCTL_ADD_OID(ctx, parent, nbr, name, CTLTYPE_INT|access, \ + ptr, 0, sysctl_handle_long, "LU", descr) + +/* Oid for an opaque object. Specified by a pointer and a length. */ +#define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \ + SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|access, \ + ptr, len, sysctl_handle_opaque, fmt, descr) + +#define SYSCTLN_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \ + SYSCTLN_OID(parent, nbr, name, CTLTYPE_OPAQUE|access, \ + ptr, len, sysctl_handle_opaque, fmt, descr) + +#define SYSCTL_ADD_OPAQUE(ctx, parent, nbr, name, access, ptr, len, fmt, descr)\ + SYSCTL_ADD_OID(ctx, parent, nbr, name, CTLTYPE_OPAQUE|access, \ + ptr, len, sysctl_handle_opaque, fmt, descr) + +/* Oid for a struct. Specified by a pointer and a type. */ +#define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \ + SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|access, \ + ptr, sizeof(struct type), sysctl_handle_opaque, \ + "S," #type, descr) + +#define SYSCTLN_STRUCT(parent, nbr, name, access, ptr, type, descr) \ + SYSCTLN_OID(parent, nbr, name, CTLTYPE_OPAQUE|access, \ + ptr, sizeof(struct type), sysctl_handle_opaque, \ + "S," #type, descr) + +#define SYSCTL_ADD_STRUCT(ctx, parent, nbr, name, access, ptr, type, descr) \ + SYSCTL_ADD_OID(ctx, parent, nbr, name, CTLTYPE_OPAQUE|access, \ + ptr, sizeof(struct type), sysctl_handle_opaque, \ + "S," #type, descr) + +/* Oid for a procedure. Specified by a pointer and an arg. */ +#define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr) \ + SYSCTL_OID(parent, nbr, name, access, ptr, arg, handler, fmt, descr) + +#define SYSCTLN_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr)\ + SYSCTLN_OID(parent, nbr, name, access, ptr, arg, handler, fmt, descr) + +#define SYSCTL_ADD_PROC(ctx, parent, nbr, name, access, ptr, arg, handler, fmt, descr) \ + SYSCTL_ADD_OID(ctx, parent, nbr, name, access, \ + ptr, arg, handler, fmt, descr) + + +#ifdef _WRS_KERNEL + +/* + * Declare some common oids. + */ +extern struct sysctl_oid_list sysctl__children; +SYSCTL_DECL(_kern); +SYSCTL_DECL(_sysctl); +SYSCTL_DECL(_vm); +SYSCTL_DECL(_vfs); +SYSCTL_DECL(_net); +SYSCTL_DECL(_debug); +SYSCTL_DECL(_hw); +SYSCTL_DECL(_machdep); +SYSCTL_DECL(_user); +SYSCTL_DECL(_compat); + +extern char machine[]; +extern char osrelease[]; +extern char ostype[]; + +typedef struct + { + UINT32 (*readFunc)(void); + void (*writeFunc)(UINT32); + UINT32 shift; + UINT32 mask; + } SYSCTL_ACCESS; + +int sysctl_handle_reg (SYSCTL_HANDLER_ARGS); + +/* Dynamic oid handling */ +struct sysctl_oid *sysctl_add_oid(struct sysctl_ctx_list *clist, + struct sysctl_oid_list *parent, int nbr, const char *name, + int kind, void *arg1, int arg2, + int (*handler) (SYSCTL_HANDLER_ARGS), + const char *fmt, const char *descr); +int sysctl_remove_oid(struct sysctl_oid *oidp, int del, int recurse); +int sysctl_ctx_init(struct sysctl_ctx_list *clist); +int sysctl_ctx_free(struct sysctl_ctx_list *clist); +struct sysctl_ctx_entry *sysctl_ctx_entry_add(struct sysctl_ctx_list *clist, + struct sysctl_oid *oidp); +struct sysctl_ctx_entry *sysctl_ctx_entry_find(struct sysctl_ctx_list *clist, + struct sysctl_oid *oidp); +int sysctl_ctx_entry_del(struct sysctl_ctx_list *clist, + struct sysctl_oid *oidp); + +int kernel_sysctl(struct proc *p, int *name, u_int namelen, void *old, + size_t *oldlenp, void *pNew, size_t newlen, + size_t *retval); +int userland_sysctl(struct proc *p, int *name, u_int namelen, void *old, + size_t *oldlenp, int inkernel, void *pNew, + size_t newlen, size_t *retval); +int sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid, + int *nindx, struct sysctl_req *req); + +int sysctlnametomib __P((const char *name, int *mibp, size_t *sizep)); + +int sysctlbyname __P((char *, void *, size_t *, void *, size_t)); + +#ifndef _FREE_VERSION + +struct sysctl_oid_list * _sysctlDbgNodeChildren (struct sysctl_oid *parent, + char * filename, int lineNo, + char * parentName); +struct sysctl_oid * _sysctlDbgAddOid (struct sysctl_ctx_list *clist, + struct sysctl_oid *parent, + int number, const char *name, int kind, + void *arg1, int arg2, + int (*handler)(SYSCTL_HANDLER_ARGS), + const char *fmt, const char *descr, + char * filename, int lineNo, + char * parentName); + +#endif /* ! defined _FREE_VERSION */ + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_SYS_SYSCTL_H_ */ diff --git a/h/sys/sysctlCommon.h b/h/sys/sysctlCommon.h new file mode 100644 index 0000000..d5957b6 --- /dev/null +++ b/h/sys/sysctlCommon.h @@ -0,0 +1,556 @@ +/* sysctlCommon.h - sysctl definitions common between user & kernel mode */ + +/* + * Copyright (c) 2004-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Mike Karels at Berkeley Software Design, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)sysctl.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/sys/sys/sysctl.h,v 1.81.2.6 2001/05/17 17:59:53 ru Exp $ + */ + +/* +modification history +-------------------- +02d,24aug05,pad Updated a few comments. +02c,18aug05,pad Added KERN_OSBUILDDATE identifier. Reset KERN_VERSION to be + linked with the kernel version proper. Activated KERN_OSTYPE, + KERN_OSRELEASE and KERN_OSREV (via rtpLib). Changed type of + KERN_OSREV and KERN_OSRELDATE from integer to string. +02b,11apr05,wap Add definition for CTL_MAXNAME (SPR #106195) +02a,28oct04,to Added HSR definitions for PPC970 +01z,17aug04,pad Added KERN_RTP_PTHREAD_INFO identifier. +01y,14jun04,job Added MMU_BLOCKSIZE and MMU_PAGESIZE entries. + Created block of HSR values & created processor specific + overlaps. +01x,11jun04,dcc Added clock macros +01w,07jun04,job Added a number of new definitions +01v,11may04,job Moved common definitions to this file + Removed __P macro around sysctl() prototype. +01u,24feb04,vvv updated based on review comments +01t,20feb04,vvv added support for transparent nodes +01t,23feb04,kkz added #defines for remlib +01t,12feb04,asr added new defines for loginLib +01s,24nov03,vvv added include for logLib.h +01r,20nov03,niq Remove copyright_wrs.h file inclusion +01q,20nov03,vvv updated for RTP support +01p,05nov03,cdw Removal of unnecessary _KERNEL guards. +01o,04nov03,rlm Ran batch header path update for header re-org. +01n,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01m,08sep03,vvv merged from ACCORDION_BASE6_MERGE_BASELINE +01l,10jun03,vvv include netVersion.h +01k,14may03,vvv made sysctlbyname() available when _KERNEL is not defined +01j,11apr03,syy Fixed Diab compiler warnings +01i,10mar03,ann removed the preceding ## from the macros. +01h,09sep02,hsh add c++ protection +01g,18mar02,ann adding the prototype for sysctlnametomib +01f,11mar02,ann fixing compilation warnings +01e,22feb02,ham changed for tornado build. +01d,21feb02,ann removed the references to MGMT_LOCK +01c,10jan02,ann adding the prototype for sysctl +01b,12dec01,ann corrected the LOG message in SYSCTL_NODE_CHILDREN +01a,05dec01,niq Created from BSD 4.3 +*/ + +#ifndef _SYS_SYSCTLCOMMON_H_ +#define _SYS_SYSCTLCOMMON_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifndef CTL_MAXNAME +#define CTL_MAXNAME 12 /* largest number of components supported */ +#endif + +/* + * Top-level identifiers + */ +#define CTL_UNSPEC 0 /* unused */ +#define CTL_KERN 1 /* "high kernel": proc, limits */ +#define CTL_VM 2 /* virtual memory */ +#define CTL_VFS 3 /* file system, mount type is next */ +#define CTL_NET 4 /* network, see socket.h */ +#define CTL_DEBUG 5 /* debugging parameters */ +#define CTL_HW 6 /* generic cpu/io */ +#define CTL_MACHDEP 7 /* machine dependent */ +#define CTL_USER 8 /* user-level */ +#define CTL_P1003_1B 9 /* POSIX 1003.1B */ +#define CTL_MAXID 10 /* number of valid top-level ids */ + +#ifdef _WRS_KERNEL +#define CTL_NAMES { \ + { 0, 0 }, \ + { "kern", CTLTYPE_NODE }, \ + { "vm", CTLTYPE_NODE }, \ + { "vfs", CTLTYPE_NODE }, \ + { "net", CTLTYPE_NODE }, \ + { "debug", CTLTYPE_NODE }, \ + { "hw", CTLTYPE_NODE }, \ + { "machdep", CTLTYPE_NODE }, \ + { "user", CTLTYPE_NODE }, \ + { "p1003_1b", CTLTYPE_NODE }, \ +} +#endif /* _WRS_KERNEL */ + +/* + * CTL_KERN identifiers + */ +#define KERN_OSTYPE 1 /* string: system name */ +#define KERN_OSRELEASE 2 /* string: system release (maj.min.maint) */ +#define KERN_OSREV 3 /* string: system version (reserved) */ +#define KERN_VERSION 4 /* string: kernel version */ +#define KERN_MAXVNODES 5 /* int: max vnodes */ +#define KERN_MAXPROC 6 /* int: max processes */ +#define KERN_MAXFILES 7 /* int: max open files */ +#define KERN_ARGMAX 8 /* int: max arguments to exec */ +#define KERN_SECURELVL 9 /* int: system security level */ +#define KERN_HOSTNAME 10 /* string: hostname */ +#define KERN_HOSTID 11 /* int: host identifier */ +#define KERN_CLOCKRATE 12 /* int: system clockrate */ +#define KERN_VNODE 13 /* struct: vnode structures */ +#define KERN_PROC 14 /* struct: process entries */ +#define KERN_FILE 15 /* struct: file entries */ +#define KERN_PROF 16 /* node: kernel profiling info */ +#define KERN_POSIX1 17 /* int: POSIX.1 version */ +#define KERN_NGROUPS 18 /* int: # of supplemental group ids */ +#define KERN_JOB_CONTROL 19 /* int: is job control available */ +#define KERN_SAVED_IDS 20 /* int: saved set-user/group-ID */ +#define KERN_BOOTTIME 21 /* struct: time kernel was booted */ +#define KERN_NISDOMAINNAME 22 /* string: YP domain name */ +#define KERN_UPDATEINTERVAL 23 /* int: update process sleep time */ +#define KERN_OSRELDATE 24 /* string: OS release date */ +#define KERN_NTP_PLL 25 /* node: NTP PLL control */ +#define KERN_BOOTFILE 26 /* string: name of booted kernel */ +#define KERN_MAXFILESPERPROC 27 /* int: max open files per proc */ +#define KERN_MAXPROCPERUID 28 /* int: max processes per uid */ +#define KERN_DUMPDEV 29 /* dev_t: device to dump on */ +#define KERN_IPC 30 /* node: anything related to IPC */ +#define KERN_LOGINVERIFY 31 /* login user verification */ +#define KERN_PS_STRINGS 32 /* int: address of PS_STRINGS */ +#define KERN_USRSTACK 33 /* int: address of USRSTACK */ +#define KERN_LOGSIGEXIT 34 /* int: do we log sigexit procs? */ +#define KERN_USERID 35 /* string: target-wide username */ +#define KERN_PASSWORD 36 /* string: target-wide password */ + +/* These ones are defined by rtpSysctl.c at run time */ + +#define KERN_TICKGET 37 /* long: current tick count */ +#define KERN_TICK64GET 38 /* quad: current tick count (64 bit) */ +#define KERN_SYSCALL 39 /* node: is a system call present */ +#define KERN_AUXCLOCKRATE 40 /* int: auxilary clock rate */ +#define KERN_MEMTOP 41 /* int: top of logical memory */ +#define KERN_PHYSMEMTOP 42 /* int: top of physical memory */ +#define KERN_PROCESSORNUM 43 /* int: processor number for CPU board */ +#define KERN_CLOCK_GETRES 44 /* node: clock resolution */ +#define KERN_CLOCK_TIME 45 /* node: set/get clock time */ + +#define KERN_RTP_PTHREAD_INFO 46 /* opaque: pthread-related information. + This is a private entry */ + +#define KERN_OSBUILDDATE 47 /* string: OS build date (compile time) */ +#define KERN_MAXID 48 /* number of valid kern ids */ + +/* The System call node is organized into various functions, where the + * OID is KERN.SYSCALL..identifier + */ + +#define KERN_SYSCALL_NAME 0 /* string: system call name */ +#define KERN_SYSCALL_NARGS 1 /* int: number of arguments taken */ +#define KERN_SYSCALL_GROUP 2 /* string: system call group name */ +#define KERN_SYSCALL_GROUP_NROUTINE 3 /* int: number of routines in group */ +#define KERN_SYSCALL_MAX 3 + +#ifdef _WRS_KERNEL +#define CTL_KERN_NAMES { \ + { 0, 0 }, \ + { "ostype", CTLTYPE_STRING }, \ + { "osrelease", CTLTYPE_STRING }, \ + { "osrevision", CTLTYPE_STRING }, \ + { "version", CTLTYPE_STRING }, \ + { "maxvnodes", CTLTYPE_INT }, \ + { "maxproc", CTLTYPE_INT }, \ + { "maxfiles", CTLTYPE_INT }, \ + { "argmax", CTLTYPE_INT }, \ + { "securelevel", CTLTYPE_INT }, \ + { "hostname", CTLTYPE_STRING }, \ + { "hostid", CTLTYPE_INT }, \ + { "clockrate", CTLTYPE_INT }, \ + { "vnode", CTLTYPE_STRUCT }, \ + { "proc", CTLTYPE_STRUCT }, \ + { "file", CTLTYPE_STRUCT }, \ + { "profiling", CTLTYPE_NODE }, \ + { "posix1version", CTLTYPE_INT }, \ + { "ngroups", CTLTYPE_INT }, \ + { "job_control", CTLTYPE_INT }, \ + { "saved_ids", CTLTYPE_INT }, \ + { "boottime", CTLTYPE_STRUCT }, \ + { "nisdomainname", CTLTYPE_STRING }, \ + { "update", CTLTYPE_INT }, \ + { "osreldate", CTLTYPE_STRING }, \ + { "ntp_pll", CTLTYPE_NODE }, \ + { "bootfile", CTLTYPE_STRING }, \ + { "maxfilesperproc", CTLTYPE_INT }, \ + { "maxprocperuid", CTLTYPE_INT }, \ + { "dumpdev", CTLTYPE_STRUCT }, /* we lie; don't print as int */ \ + { "ipc", CTLTYPE_NODE }, \ + { "loginverify", CTLTYPE_INT }, \ + { "ps_strings", CTLTYPE_INT }, \ + { "usrstack", CTLTYPE_INT }, \ + { "logsigexit", CTLTYPE_INT }, \ + { "userid", CTLTYPE_STRING }, \ + { "password", CTLTYPE_STRING }, \ + { "tickGet", CTLTYPE_LONG }, \ + { "tick64Get", CTLTYPE_QUAD }, \ + { "syscall", CTLTYPE_NODE }, \ + { "auxclockrate", CTLTYPE_INT }, \ + { "memtop", CTLTYPE_INT }, \ + { "physmemtop", CTLTYPE_INT }, \ + { "processornum", CTLTYPE_INT }, \ + { "clock_getres", CTLTYPE_NODE }, \ + { "clock_time", CTLTYPE_NODE }, \ + { "osbuilddate", CTLTYPE_STRING }, \ +} + +/* + * CTL_VFS identifiers + */ +#define CTL_VFS_NAMES { \ + { "vfsconf", CTLTYPE_STRUCT }, \ +} +#endif /* _WRS_KERNEL */ + +/* + * KERN_PROC subtypes + */ +#define KERN_PROC_ALL 0 /* everything */ +#define KERN_PROC_PID 1 /* by process id */ +#define KERN_PROC_PGRP 2 /* by process group id */ +#define KERN_PROC_SESSION 3 /* by session of pid */ +#define KERN_PROC_TTY 4 /* by controlling tty */ +#define KERN_PROC_UID 5 /* by effective uid */ +#define KERN_PROC_RUID 6 /* by real uid */ +#define KERN_PROC_ARGS 7 /* get/set arguments/proctitle */ + +/* + * KERN_IPC identifiers + */ +#define KIPC_MAXSOCKBUF 1 /* int: max size of a socket buffer */ +#define KIPC_SOCKBUF_WASTE 2 /* int: wastage factor in sockbuf */ +#define KIPC_SOMAXCONN 3 /* int: max length of connection q */ +#define KIPC_MAX_LINKHDR 4 /* int: max length of link header */ +#define KIPC_MAX_PROTOHDR 5 /* int: max length of network header */ +#define KIPC_MAX_HDR 6 /* int: max total length of headers */ +#define KIPC_MAX_DATALEN 7 /* int: max length of data? */ +#define KIPC_MBSTAT 8 /* struct: mbuf usage statistics */ +#define KIPC_NMBCLUSTERS 9 /* int: maximum mbuf clusters */ + +/* + * CTL_HW identifiers + */ +#define HW_MACHINE 1 /* string: machine class */ +#define HW_MODEL 2 /* string: specific machine model */ +#define HW_NCPU 3 /* int: number of cpus */ +#define HW_BYTEORDER 4 /* int: machine byte order */ +#define HW_PHYSMEM 5 /* int: total memory */ +#define HW_USERMEM 6 /* int: non-kernel memory */ +#define HW_PAGESIZE 7 /* int: software page size */ +#define HW_DISKNAMES 8 /* strings: disk drive names */ +#define HW_DISKSTATS 9 /* struct: diskstats[] */ +#define HW_FLOATINGPT 10 /* int: has HW floating point? */ +#define HW_MACHINE_ARCH 11 /* string: machine architecture */ +#define HW_ENDIAN 12 /* string: endianness (big/little) */ +#define HW_BSP 13 /* node: bsp information */ +#define HW_PAL 14 /* node: pal information */ +#define HW_CACHE 15 /* node: cache information */ +#define HW_MMU 16 /* node: mmu information */ +#define HW_MAXID 16 /* number of valid hw ids */ + +/* CTL_HW.BSP identifiers */ + +#define HW_BSP_MODEL 0 /* string: model name of CPU board */ +#define HW_BSP_REVISION 1 /* string: BSP revision */ + +/* CTL_HW.PAL identifiers */ + +#define HW_PAL_CPU 0 /* node: cpu information */ +#define HW_PAL_VERSION 1 /* string: PAL version */ + +/* CTL_HW.PAL.CPU identifiers */ + +/* A set of generic Hardware Specific Registers. Different architectures + * can map specific registers onto this set of OIDs + */ + +#define HW_PAL_CPU_HSR0 0 /* int: Hardware Specific Register 0 */ +#define HW_PAL_CPU_HSR1 1 /* int: Hardware Specific Register 1 */ +#define HW_PAL_CPU_HSR2 2 /* int: Hardware Specific Register 2 */ +#define HW_PAL_CPU_HSR3 3 /* int: Hardware Specific Register 3 */ +#define HW_PAL_CPU_HSR4 4 /* int: Hardware Specific Register 4 */ +#define HW_PAL_CPU_HSR5 5 /* int: Hardware Specific Register 5 */ +#define HW_PAL_CPU_HSR6 6 /* int: Hardware Specific Register 6 */ +#define HW_PAL_CPU_HSR7 7 /* int: Hardware Specific Register 7 */ +#define HW_PAL_CPU_HSR8 8 /* int: Hardware Specific Register 8 */ +#define HW_PAL_CPU_HSR9 9 /* int: Hardware Specific Register 9 */ +#define HW_PAL_CPU_HSR10 10 /* int: Hardware Specific Register 10 */ +#define HW_PAL_CPU_HSR11 11 /* int: Hardware Specific Register 11 */ +#define HW_PAL_CPU_HSR12 12 /* int: Hardware Specific Register 12 */ +#define HW_PAL_CPU_HSR13 13 /* int: Hardware Specific Register 13 */ +#define HW_PAL_CPU_HSR14 14 /* int: Hardware Specific Register 14 */ +#define HW_PAL_CPU_HSR15 15 /* int: Hardware Specific Register 15 */ +#define HW_PAL_CPU_HSR16 16 /* int: Hardware Specific Register 16 */ +#define HW_PAL_CPU_HSR17 17 /* int: Hardware Specific Register 17 */ +#define HW_PAL_CPU_HSR18 18 /* int: Hardware Specific Register 18 */ +#define HW_PAL_CPU_HSR19 19 /* int: Hardware Specific Register 19 */ +#define HW_PAL_CPU_HSR20 20 /* int: Hardware Specific Register 20 */ +#define HW_PAL_CPU_HSR21 21 /* int: Hardware Specific Register 21 */ +#define HW_PAL_CPU_HSR22 22 /* int: Hardware Specific Register 22 */ +#define HW_PAL_CPU_HSR23 23 /* int: Hardware Specific Register 23 */ +#define HW_PAL_CPU_HSR24 24 /* int: Hardware Specific Register 24 */ +#define HW_PAL_CPU_HSR25 25 /* int: Hardware Specific Register 25 */ +#define HW_PAL_CPU_HSR26 26 /* int: Hardware Specific Register 26 */ +#define HW_PAL_CPU_HSR27 27 /* int: Hardware Specific Register 27 */ +#define HW_PAL_CPU_HSR28 28 /* int: Hardware Specific Register 28 */ +#define HW_PAL_CPU_HSR29 29 /* int: Hardware Specific Register 29 */ +#define HW_PAL_CPU_HSR30 30 /* int: Hardware Specific Register 30 */ +#define HW_PAL_CPU_HSR31 31 /* int: Hardware Specific Register 31 */ + +/* PAL generic information */ + +#define HW_PAL_CPU_PROCESSOR 32 /* string: processor chip name */ +#define HW_PAL_CPU_FAMILY 33 /* string: CPU family */ +#define HW_PAL_CPU_TLBENTRIES 34 /* int: number of TLB entries */ + +/* ARM/XScale Hardware Specific Registers: These map onto specific HSR values */ + +#define HW_PAL_CPU_ARM_MMUID 0 /* int: processor ID register */ + +/* PPC Hardware Specific Registers: These map onto specific HSR values */ + +#define HW_PAL_CPU_PPC_PVR 0 /* int: processor version register */ +#define HW_PAL_CPU_PPC_HID0 1 /* int: hardware specific register 0 */ +#define HW_PAL_CPU_PPC_HID1 2 /* int: hardware specific register 0 */ + +#define HW_PAL_CPU_PPC_HID0L 1 /* int: hardware specific register 0 */ +#define HW_PAL_CPU_PPC_HID0H 2 /* int: hardware specific register 0 */ +#define HW_PAL_CPU_PPC_HID1L 3 /* int: hardware specific register 0 */ +#define HW_PAL_CPU_PPC_HID1H 4 /* int: hardware specific register 0 */ +#define HW_PAL_CPU_PPC_HID4L 5 /* int: hardware specific register 0 */ +#define HW_PAL_CPU_PPC_HID4H 6 /* int: hardware specific register 0 */ +#define HW_PAL_CPU_PPC_HID5L 7 /* int: hardware specific register 0 */ +#define HW_PAL_CPU_PPC_HID5H 8 /* int: hardware specific register 0 */ + +/* MIPS Hardware Specific Registers: These map onto specific HSR values */ + +#define HW_PAL_CPU_MIPS_WIRED 0 /* int: processor WIRED register */ +#define HW_PAL_CPU_MIPS_PRID 1 /* int: processor PRID register */ +#define HW_PAL_CPU_MIPS_CONFIG 2 /* int: processor CONFIG register */ +#define HW_PAL_CPU_MIPS_CONFIG1 3 /* int: processor CONFIG1 register */ +#define HW_PAL_CPU_MIPS_CONFIG2 4 /* int: processor CONFIG2 register */ +#define HW_PAL_CPU_MIPS_CONFIG3 5 /* int: processor CONFIG3 register */ + +/* CTL_HW.CACHE identifiers */ + +#define HW_CACHE_INSTR_LINE_SIZE 0 /* int: instruction cache line size */ +#define HW_CACHE_DATA_LINE_SIZE 1 /* int: data cache line size */ +#define HW_CACHE_BRANCH_LINE_SIZE 2 /* int: branch cache line size */ +#define HW_CACHE_L2_LINE_SIZE 3 /* int: L2 cache line size */ +#define HW_CACHE_L3_LINE_SIZE 4 /* int: L3 cache line size */ +#define HW_CACHE_INSTR_TLB_LINE_SIZE 5 /* int: instr. TLB cache line size */ +#define HW_CACHE_DATA_TLB_LINE_SIZE 6 /* int: data TLB cache line size */ +#define HW_CACHE_ALTPRI_LINE_SIZE 7 /* int: alt. primary cache line size */ + +#define HW_CACHE_INSTR_SIZE 10 /* int: instruction cache size */ +#define HW_CACHE_DATA_SIZE 11 /* int: data cache size */ +#define HW_CACHE_BRANCH_SIZE 12 /* int: branch cache size */ +#define HW_CACHE_L2_SIZE 13 /* int: L2 cache size */ +#define HW_CACHE_L3_SIZE 14 /* int: L3 cache size */ +#define HW_CACHE_INSTR_TLB_SIZE 15 /* int: instr. TLB cache size */ +#define HW_CACHE_DATA_TLB_SIZE 16 /* int: data TLB cache size */ +#define HW_CACHE_ALTPRI_SIZE 17 /* int: alt. primary cache size */ + +/* CTL_HW.MMU identifiers */ + +#define HW_MMU_TLBSIZE 0 /* int: TLB size */ +#define HW_MMU_BLOCKSIZE 1 /* int: block size */ +#define HW_MMU_PAGESIZE 2 /* int: page size */ + +#ifdef _WRS_KERNEL +#define CTL_HW_NAMES { \ + { 0, 0 }, \ + { "machine", CTLTYPE_STRING }, \ + { "model", CTLTYPE_STRING }, \ + { "ncpu", CTLTYPE_INT }, \ + { "byteorder", CTLTYPE_INT }, \ + { "physmem", CTLTYPE_INT }, \ + { "usermem", CTLTYPE_INT }, \ + { "pagesize", CTLTYPE_INT }, \ + { "disknames", CTLTYPE_STRUCT }, \ + { "diskstats", CTLTYPE_STRUCT }, \ + { "floatingpoint", CTLTYPE_INT }, \ + { "machine_arch", CTLTYPE_STRING }, \ + { "endian", CTLTYPE_STRING }, \ + { "bsp", CTLTYPE_NODE }, \ + { "pal", CTLTYPE_NODE }, \ + { "cache", CTLTYPE_NODE }, \ + { "mmu", CTLTYPE_NODE }, \ +} +#endif /* _WRS_KERNEL */ + +/* + * CTL_USER definitions + */ +#define USER_CS_PATH 1 /* string: _CS_PATH */ +#define USER_BC_BASE_MAX 2 /* int: BC_BASE_MAX */ +#define USER_BC_DIM_MAX 3 /* int: BC_DIM_MAX */ +#define USER_BC_SCALE_MAX 4 /* int: BC_SCALE_MAX */ +#define USER_BC_STRING_MAX 5 /* int: BC_STRING_MAX */ +#define USER_COLL_WEIGHTS_MAX 6 /* int: COLL_WEIGHTS_MAX */ +#define USER_EXPR_NEST_MAX 7 /* int: EXPR_NEST_MAX */ +#define USER_LINE_MAX 8 /* int: LINE_MAX */ +#define USER_RE_DUP_MAX 9 /* int: RE_DUP_MAX */ +#define USER_POSIX2_VERSION 10 /* int: POSIX2_VERSION */ +#define USER_POSIX2_C_BIND 11 /* int: POSIX2_C_BIND */ +#define USER_POSIX2_C_DEV 12 /* int: POSIX2_C_DEV */ +#define USER_POSIX2_CHAR_TERM 13 /* int: POSIX2_CHAR_TERM */ +#define USER_POSIX2_FORT_DEV 14 /* int: POSIX2_FORT_DEV */ +#define USER_POSIX2_FORT_RUN 15 /* int: POSIX2_FORT_RUN */ +#define USER_POSIX2_LOCALEDEF 16 /* int: POSIX2_LOCALEDEF */ +#define USER_POSIX2_SW_DEV 17 /* int: POSIX2_SW_DEV */ +#define USER_POSIX2_UPE 18 /* int: POSIX2_UPE */ +#define USER_STREAM_MAX 19 /* int: POSIX2_STREAM_MAX */ +#define USER_TZNAME_MAX 20 /* int: POSIX2_TZNAME_MAX */ +#define USER_MAXID 21 /* number of valid user ids */ + +#ifdef _WRS_KERNEL +#define CTL_USER_NAMES { \ + { 0, 0 }, \ + { "cs_path", CTLTYPE_STRING }, \ + { "bc_base_max", CTLTYPE_INT }, \ + { "bc_dim_max", CTLTYPE_INT }, \ + { "bc_scale_max", CTLTYPE_INT }, \ + { "bc_string_max", CTLTYPE_INT }, \ + { "coll_weights_max", CTLTYPE_INT }, \ + { "expr_nest_max", CTLTYPE_INT }, \ + { "line_max", CTLTYPE_INT }, \ + { "re_dup_max", CTLTYPE_INT }, \ + { "posix2_version", CTLTYPE_INT }, \ + { "posix2_c_bind", CTLTYPE_INT }, \ + { "posix2_c_dev", CTLTYPE_INT }, \ + { "posix2_char_term", CTLTYPE_INT }, \ + { "posix2_fort_dev", CTLTYPE_INT }, \ + { "posix2_fort_run", CTLTYPE_INT }, \ + { "posix2_localedef", CTLTYPE_INT }, \ + { "posix2_sw_dev", CTLTYPE_INT }, \ + { "posix2_upe", CTLTYPE_INT }, \ + { "stream_max", CTLTYPE_INT }, \ + { "tzname_max", CTLTYPE_INT }, \ +} +#endif /* _WRS_KERNEL */ + +#define CTL_P1003_1B_ASYNCHRONOUS_IO 1 /* boolean */ +#define CTL_P1003_1B_MAPPED_FILES 2 /* boolean */ +#define CTL_P1003_1B_MEMLOCK 3 /* boolean */ +#define CTL_P1003_1B_MEMLOCK_RANGE 4 /* boolean */ +#define CTL_P1003_1B_MEMORY_PROTECTION 5 /* boolean */ +#define CTL_P1003_1B_MESSAGE_PASSING 6 /* boolean */ +#define CTL_P1003_1B_PRIORITIZED_IO 7 /* boolean */ +#define CTL_P1003_1B_PRIORITY_SCHEDULING 8 /* boolean */ +#define CTL_P1003_1B_REALTIME_SIGNALS 9 /* boolean */ +#define CTL_P1003_1B_SEMAPHORES 10 /* boolean */ +#define CTL_P1003_1B_FSYNC 11 /* boolean */ +#define CTL_P1003_1B_SHARED_MEMORY_OBJECTS 12 /* boolean */ +#define CTL_P1003_1B_SYNCHRONIZED_IO 13 /* boolean */ +#define CTL_P1003_1B_TIMERS 14 /* boolean */ +#define CTL_P1003_1B_AIO_LISTIO_MAX 15 /* int */ +#define CTL_P1003_1B_AIO_MAX 16 /* int */ +#define CTL_P1003_1B_AIO_PRIO_DELTA_MAX 17 /* int */ +#define CTL_P1003_1B_DELAYTIMER_MAX 18 /* int */ +#define CTL_P1003_1B_MQ_OPEN_MAX 19 /* int */ +#define CTL_P1003_1B_PAGESIZE 20 /* int */ +#define CTL_P1003_1B_RTSIG_MAX 21 /* int */ +#define CTL_P1003_1B_SEM_NSEMS_MAX 22 /* int */ +#define CTL_P1003_1B_SEM_VALUE_MAX 23 /* int */ +#define CTL_P1003_1B_SIGQUEUE_MAX 24 /* int */ +#define CTL_P1003_1B_TIMER_MAX 25 /* int */ + +#define CTL_P1003_1B_MAXID 26 + +#ifdef _WRS_KERNEL +#define CTL_P1003_1B_NAMES { \ + { 0, 0 }, \ + { "asynchronous_io", CTLTYPE_INT }, \ + { "mapped_files", CTLTYPE_INT }, \ + { "memlock", CTLTYPE_INT }, \ + { "memlock_range", CTLTYPE_INT }, \ + { "memory_protection", CTLTYPE_INT }, \ + { "message_passing", CTLTYPE_INT }, \ + { "prioritized_io", CTLTYPE_INT }, \ + { "priority_scheduling", CTLTYPE_INT }, \ + { "realtime_signals", CTLTYPE_INT }, \ + { "semaphores", CTLTYPE_INT }, \ + { "fsync", CTLTYPE_INT }, \ + { "shared_memory_objects", CTLTYPE_INT }, \ + { "synchronized_io", CTLTYPE_INT }, \ + { "timers", CTLTYPE_INT }, \ + { "aio_listio_max", CTLTYPE_INT }, \ + { "aio_max", CTLTYPE_INT }, \ + { "aio_prio_delta_max", CTLTYPE_INT }, \ + { "delaytimer_max", CTLTYPE_INT }, \ + { "mq_open_max", CTLTYPE_INT }, \ + { "pagesize", CTLTYPE_INT }, \ + { "rtsig_max", CTLTYPE_INT }, \ + { "nsems_max", CTLTYPE_INT }, \ + { "sem_value_max", CTLTYPE_INT }, \ + { "sigqueue_max", CTLTYPE_INT }, \ + { "timer_max", CTLTYPE_INT }, \ +} +#endif /* _WRS_KERNEL */ + +int sysctl (int *, u_int, void *, size_t *, void *, size_t); + +#ifdef __cplusplus +} +#endif + +#endif /* !_SYS_SYSCTLCOMMON_H_ */ diff --git a/h/sys/taskDefs.h b/h/sys/taskDefs.h new file mode 100644 index 0000000..6a1f05e --- /dev/null +++ b/h/sys/taskDefs.h @@ -0,0 +1,50 @@ +/* taskDefs.h - Constants and other definitions required by taskLib */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01a,15aug05,yvp written by extracting definitions from taskLib.h & taskLibP.h +*/ + +#ifndef __INCtaskDefsh +#define __INCtaskDefsh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" + +/* defines */ + +#define VX_USER_MODE 0x0000 /* INTERNAL: tasks in user mode */ +#define VX_SUPERVISOR_MODE 0x0001 /* INTERNAL: tasks in sup mode */ +#define VX_DEALLOC_STACK 0x0004 /* INTERNAL: deallocate stack */ +#define VX_TASK_OBJ_OWNER 0x0800 /* INTERNAL: task owns objs directly */ +#define VX_DEALLOC_EXC_STACK 0x1000 /* INTERNAL: deallocate the exc stack */ +#define VX_DEALLOC_TCB 0x8000 /* INTERNAL: deallocate the task TCB */ + + +#ifndef _WRS_ARCH_IS_SIMULATOR +#define KERNEL_TASK_EXC_STACK_SIZE 4096 +#else +#define KERNEL_TASK_EXC_STACK_SIZE (4096*3) +#endif /* _WRS_ARCH_IS_SIMULATOR */ + + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtaskDefsh */ diff --git a/h/sys/times.h b/h/sys/times.h new file mode 100644 index 0000000..135513a --- /dev/null +++ b/h/sys/times.h @@ -0,0 +1,62 @@ +/* times.h - UNIX-style timeval structure defenition */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02d,22sep92,rrr added support for c++ +02c,19aug92,smb moved from systime.h +02b,31jul92,gae changed INCtimeh to INCsystimeh. +02a,04jul92,jcf cleaned up. +01g,26may92,rrr the tree shuffle +01f,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01e,10jun91.del added pragma for gnu960 alignment. +01d,25oct90,dnw changed name from utime.h to systime.h. + added test for SunOS headers already included. +01c,05oct90,shl added copyright notice. +01b,04nov87,dnw removed unnecessary stuff. +01a,15oct87,rdc written +*/ + +#ifndef __INCtimesh +#define __INCtimesh + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* the following conditional is to avoid conflict with SunOS header + * (_TIME_ is used in SunOS 4.0.3 and _sys_time_h is used in 4.1) + */ +#if !defined(_TIME_) && !defined(_sys_time_h) + +struct timeval + { + long tv_sec; /* seconds */ + long tv_usec; /* microseconds */ + }; + +struct timezone + { + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of dst correction */ + }; + +#endif /* !_TIME_ && !_sys_time_h */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtimesh */ diff --git a/h/sys/types.h b/h/sys/types.h new file mode 100644 index 0000000..029e823 --- /dev/null +++ b/h/sys/types.h @@ -0,0 +1,56 @@ +/* types.h - basic unix types header */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * and the VxWorks Software License Agreement specify the terms and + * conditions for redistribution. + * + * @(#)types.h 7.1 (Berkeley) 6/4/86 + */ + +/* +modification history +-------------------- +03c,20sep04,job Fix for SPR#96712 +03b,09feb04,mcm Fix for SPR:93253 +03a,16sep03,mcm included vxTypesBase.h and vxTypesOld.h header files to + make it a "complete" header file and enable its use as + "sys/types.h" for the libc build. +02j,22sep92,rrr added support for c++ +02i,03jul92,smb moved typedefs to types/vxTypes.h. +02h,26may92,rrr the tree shuffle +02g,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +02f,25oct90,dnw added test for SunOS 4.1 sys/types.h. +02e,05oct90,dnw added ifdef around size_t. +02d,05oct90,shl added copyright notice. + made #endif ANSI style. +02c,21feb90,dab added typedef for addr_t. +02b,29mar88,gae added necessary junk BSD4.3 style select(). +02a,29apr87,dnw removed unnecessary junk. + added header and copyright. +*/ + +#ifndef __INCtypesh +#define __INCtypesh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _WRS_KERNEL +#include "types/vxCpu.h" +#include "types/vxArch.h" +#endif /* _WRS_KERNEL */ +#include "types/vxTypesBase.h" +#include "types/vxTypes.h" +#include "types/vxTypesOld.h" + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtypesh */ diff --git a/h/sys/un.h b/h/sys/un.h new file mode 100644 index 0000000..3307f2b --- /dev/null +++ b/h/sys/un.h @@ -0,0 +1,40 @@ +/* un.h - AF_LOCAL (Unix) header file */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,19feb04,bwa updated copyright +01b,04dec03,bwa removed UN_PROTO_COMP definition; removed debugging help +01a,10oct03,bwa written +*/ + +#ifndef __INCunh +#define __INCunh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define UN_PROTO_MAX 1 /* max nb of protos in AF_LOCAL protosw */ + +#define UN_SOCKADDR_UN_SIZE sizeof (struct sockaddr_un) + +/* data structures */ + +struct sockaddr_un /* LOCAL (UNIX) family address */ + { /* --------------------------- */ + uint8_t sun_len; /* 0x00: structure size */ + uint8_t sun_family; /* 0x01: address family */ + char sun_path [104]; /* 0x02: actual address */ + }; /* 0x6A: TOTAL SIZE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCunh */ + diff --git a/h/sys/vxLibCfgDefsP.h b/h/sys/vxLibCfgDefsP.h new file mode 100644 index 0000000..037d3df --- /dev/null +++ b/h/sys/vxLibCfgDefsP.h @@ -0,0 +1,162 @@ +/* vxLibCfgDefsP.h - Configuration head for the VxWorks system layers */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01s,30sep05,yvp Reworked SPR 112908 fix. +01r,26sep05,kk renamed FORMATTED_IO_BASE to FORMATTED_OUT_BASIC +01q,29aug05,h_k removed INCLUDE_CACHE_xxx. +01p,15aug05,mil Added INCLUDE_VM_RTP for OSL. +01o,15aug05,mil Added INCLUDE_OBJ_LIB for BKL. +01n,15aug05,md Cleanup defines, add project build section +01m,10aug05,md Turn on EDR_ERROR_INJECT_STUBS for MKL +01l,09aug05,md Enable EDR_ERROR_INJECT_STUBS for all layers +01l,12aug05,mmi Add INCLUDE_PWR_MGMT +01k,27jul05,md Fixed ED&R defines for non-layered build +01j,25jul05,md Added new ED&R defines +01i,26jul05,mil Added macro for isr objects. +01h,25jul05,yvp Conditionalize library build configuration defines. + Formatting cleanups. +01g,22jul05,h_k Added macros for various layers. +01f,22jul05,h_k undefed WV_INSTRUMENTATION for lower layers. +01e,21jul05,yvp Added more component defines. +01d,12jul05,mil Added INCLUDE_MEM_ALLOT to MKL. +01c,04jun05,yvp Made OSL the default layer. + Updated copyright. +01b,16may05,yvp Layer numbers start with 1, not 0. +01a,26apr05,yvp written. +*/ + +#ifndef __INCvxLibCfgDefsPh +#define __INCvxLibCfgDefsPh + +/* + * The six layers of a VxWorks system. + */ + +#define _MKL_ 1 +#define _BKL_ 2 +#define _KSL_ 3 +#define _OSL_ 4 +#define _ASL_ 5 +#define _MSL_ 6 + + +#ifndef _WRS_LAYER +#define _WRS_LAYER _OSL_ +#endif /* _WRS_LAYER */ + +#if ((_WRS_LAYER < _MKL_) || (_WRS_LAYER > _MSL_)) +#error "_WRS_LAYER value is out of range - cannot proceed" +#endif /* ((_WRS_LAYER < _MKL_) || (_WRS_LAYER > _MSL_)) */ + + +#if (defined _WRS_LIB_BUILD) && !(defined PRJ_BUILD) + +/* defines for standard (non-project) VxWorks source code builds */ + +/* + * Minimal Kernel Configuration + */ + +#if (_WRS_LAYER == _MKL_) +#undef INCLUDE_EDR_POLICY_HOOKS +#undef INCLUDE_FULL_EDR_STUBS +#undef INCLUDE_TASK_HOOKS +#undef INCLUDE_WINDVIEW +#define INCLUDE_FORMATTED_OUT_BASIC +#define INCLUDE_MEM_ALLOT /* for memAllotLib */ +#endif /* _WRS_LAYER == _MKL_ */ + + +/* + * Basic Kernel Configuration + */ + +#if (_WRS_LAYER == _BKL_) +#undef INCLUDE_EDR_POLICY_HOOKS +#undef INCLUDE_FULL_EDR_STUBS +#undef INCLUDE_WINDVIEW +#define INCLUDE_FORMATTED_OUT_BASIC +#define INCLUDE_OBJ_LIB +#define INCLUDE_TASK_HOOKS +#endif /* _WRS_LAYER == _BKL_ */ + + +/* + * Basic OS Configuration + */ + +#if (_WRS_LAYER == _KSL_) +#undef INCLUDE_EDR_POLICY_HOOKS +#undef INCLUDE_FULL_EDR_STUBS +#undef INCLUDE_WINDVIEW +#define INCLUDE_FORMATTED_OUT_BASIC +#define INCLUDE_FORMATTED_IO +#define INCLUDE_OBJ_LIB +#define INCLUDE_SHELL +#define INCLUDE_SM_OBJ +#define INCLUDE_TASK_HOOKS +#endif /* _WRS_LAYER == _KSL_ */ + + +/* + * Standard OS Configuration + */ + +#if (_WRS_LAYER == _OSL_) +#define INCLUDE_EDR_POLICY_HOOKS +#define INCLUDE_FULL_EDR_STUBS +#define INCLUDE_FORMATTED_OUT_BASIC +#define INCLUDE_FORMATTED_IO +#define INCLUDE_ISR_OBJECTS +#define INCLUDE_MMU_BASIC +#define INCLUDE_OBJ_LIB +#define INCLUDE_RTP +#define INCLUDE_SHELL +#define INCLUDE_SM_OBJ +#define INCLUDE_TASK_HOOKS +#define INCLUDE_TTY_DEV +#define INCLUDE_VM_RTP +#define INCLUDE_WINDVIEW +#define INCLUDE_CPU_PWR_MGMT +#endif /* _WRS_LAYER == _OSL_ */ + + +/* general for all layers */ + +#ifdef INCLUDE_WINDVIEW +#define WV_INSTRUMENTATION +#else /* INCLUDE_WINDVIEW */ +#undef WV_INSTRUMENTATION +#endif /* INCLUDE_WINDVIEW */ + +#else /* (defined _WRS_LIB_BUILD) && !(defined PRJ_BUILD) */ + +/* defines for project based VxWorks source code builds */ + +/* ED&R policy hooks are always minimal in a non-OSL build */ + +#if (_WRS_LAYER != _OSL_) + +# undef INCLUDE_EDR_POLICY_HOOKS +# undef INCLUDE_FULL_EDR_STUBS + +#else /* _WRS_LAYER != _OSL_ */ + +# define INCLUDE_EDR_POLICY_HOOKS +# define INCLUDE_FULL_EDR_STUBS + +#endif /* _WRS_LAYER != _OSL_ */ + +#endif /* (defined _WRS_LIB_BUILD) && !(defined PRJ_BUILD) */ + +#endif /* __INCvxLibCfgDefsPh */ diff --git a/h/sys/wait.h b/h/sys/wait.h new file mode 100644 index 0000000..13f41c7 --- /dev/null +++ b/h/sys/wait.h @@ -0,0 +1,62 @@ +/* wait.h - Unix compatible wait structures for remote debugging support */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01f,22sep92,rrr added support for c++ +01e,26may92,rrr the tree shuffle +01d,04oct91,rrr passed through the ansification filter + -changed copyright notice +01c,05oct90,shl added copyright notice. + made #endif ANSI style. +01b,17nov87,dnw removed unnecessary stuff. +*/ + +#ifndef __INCwaith +#define __INCwaith + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * If w_stopval==WSTOPPED, then the second structure + * describes the information returned, else the first. + */ +union wait + { + int w_status; + + /* Terminated process status. */ + + struct + { + unsigned short w_Fill1:16; /* high 16 bits unused */ + unsigned short w_Retcode:8; /* exit code if w_termsig==0 */ + unsigned short w_Coredump:1; /* core dump indicator */ + unsigned short w_Termsig:7; /* termination signal */ + } w_T; + + /* Stopped process status. */ + + struct + { + unsigned short w_Fill2:16; /* high 16 bits unused */ + unsigned short w_Stopsig:8; /* signal that stopped us */ + unsigned short w_Stopval:8; /* == W_STOPPED if stopped */ + } w_S; + }; +#define w_termsig w_T.w_Termsig +#define w_coredump w_T.w_Coredump +#define w_retcode w_T.w_Retcode +#define w_stopval w_S.w_Stopval +#define w_stopsig w_S.w_Stopsig + +#define WSTOPPED 0177 /* value of s.stopval if process is stopped */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwaith */ diff --git a/h/sysLib.h b/h/sysLib.h new file mode 100644 index 0000000..f5ed757 --- /dev/null +++ b/h/sysLib.h @@ -0,0 +1,316 @@ +/* sysLib.h - system dependent routines header */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +03w,21may04,dtr Fix SPR 96824. +03v,04feb04,elp added VxSim sysNetIfConfig(). +03u,19aug03,dbs add ED&R system debug mode flag +03t,07may03,pes PAL conditional compilation cleanup. Phase 2. +03s,24apr02,pai Removed sysHwInit0() prototype. A generic interface of this + name is not yet defined. +03r,15apr02,pai added sysHwInit0() prototype (SPR 74951). +03q,10oct01,dat SPR 70855, adding sysNanoDelay as an optional BSP API +03p,09jun98,dat rework of optional BSP routine declarations +03o,14nov97,db added functions forward declarations for PPC family. +03n,05nov96,hdn moved NETIF structure from bootConfig.c. +03m,18sep96,dat added sysBspRev, sysPhysMemTop, sysScsiConfig, + sysSerialHwInit, sysSerialHwInit2, sysSerialReset +03l,06aug96,dat using #include timerDev.h to declare timer functions +03k,13jun96,hdn added sysInLong() sysInLongString() sysOutLong() + sysOutLongString(). +03j,15jun95,ms updated for new serial driver +03i,14jun95,hdn added x86 specific prototypes. +03h,22may95,ms added sysSerialDevGet() prototype. +03g,22sep92,rrr added support for c++ +03f,15sep92,jcf cleaned up. +03e,31jul92,ccc added tyCoDrv() and tyCoDevCreate() prototypes. +03d,27jul92,ccc added prototypes to clean up os warnings. +03c,09rdc92,rdc moved PHYS_MEM_DESC struct to vmLib.c. +03b,08rdc92,rdc added PHYS_MEM_DESC struct. +03a,04jul92,jcf cleaned up. +02b,26jun92,wmd modified prototype for sysFaultTableInit(). +02a,16jun92,ccc removed function declarations for sysLib break-up. +01z,26may92,rrr the tree shuffle +01y,23apr92,wmd added sysFaultVecSet() prototype declaration for i960. +01x,21apr92,ccc added SCSI declarations. +01w,16apr92,elh added SYSFLG_PROXY. +01v,04apr92,elh added SYSFLG_TFTP. +01u,18dec91,wmd added mre ANSI prototypes for i960. +01t,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01s,23oct90,shl added a set of generic system dependent function prototypes. +01r,05oct90,dnw added some ANSI prototypes. +01q,05oct90,shl added copyright notice. + made #endif ANSI style. +01p,10aug90,dnw added SYSFLG_BOOTP +01o,28jul90,dnw removed BOOT_FIELD_LEN to bootLib.h + added declaration of sysBootParams + added include of bootLib.h +01m,20jun90,gae changed start types to be bit fields and renamed types. + added import of sysModel. +01l,24apr90,shl added SYSFLG_NO_SECURITY. +01k,23may89,dnw added SYSFLG_NO_STARTUP_SCRIPT. +01j,02may89,dnw added SYSFLG_VENDOR_{0,1,2,3}. +01i,15oct88,dnw added SYSFLG_NO_AUTOBOOT, SYSFLG_QUICK_AUTOBOOT, + and BOOT_WARM_QUICK_AUTOBOOT. +01h,24mar88,ecs added declaration of sysExcMsg. +01g,13nov87,jcf changed names of boot types. +01f,29oct87,dnw added SYSFLG_DEBUG. +01e,14oct87,dnw added SYSFLG_NO_SYS_CONTROLLER. +01d,14jul87,dnw added more system global varaibles. + deleted sysLocalToBusAdrs(). + added system restart types. +01c,14feb87,dnw added sysBus, sysCpu, sysLocalToBusAdrs +01b,18dec86,llk added BOOT_FIELD_LEN. +01a,04aug84,dnw written +*/ + +#ifndef __INCsysLibh +#define __INCsysLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE +#include "bootLib.h" +#include "ttyLib.h" +#include "sioLib.h" +#include "drv/timer/timerDev.h" + +typedef struct /* NETIF - network interface table */ + { + char *ifName; /* interface name */ + FUNCPTR attachRtn; /* attach routine */ + char *arg1; /* address */ + int arg2; /* vector */ + int arg3; /* level */ + int arg4; + int arg5; + int arg6; + int arg7; + int arg8; + } NETIF; + +#endif /* _ASMLANGUAGE */ + +/* system restart types */ + +#define BOOT_NORMAL 0x00 /* normal reboot with countdown */ +#define BOOT_NO_AUTOBOOT 0x01 /* no autoboot if set */ +#define BOOT_CLEAR 0x02 /* clear memory if set */ +#define BOOT_QUICK_AUTOBOOT 0x04 /* fast autoboot if set */ + +/* for backward compatibility */ + +#define BOOT_WARM_AUTOBOOT BOOT_NORMAL +#define BOOT_WARM_NO_AUTOBOOT BOOT_NO_AUTOBOOT +#define BOOT_WARM_QUICK_AUTOBOOT BOOT_QUICK_AUTOBOOT +#define BOOT_COLD BOOT_CLEAR + + +/* system configuration flags in sysFlags */ + +/* Some targets have system controllers that can be enabled in software. + * By default, the system controller is enabled for processor 0. + * When set this flag inhibits enabling the system controller even + * for processor 0. + */ + +#define SYSFLG_NO_SYS_CONTROLLER 0x01 + +/* System debug option: + * load kernel symbol table with all symbols (not just globals) + */ + +#define SYSFLG_DEBUG 0x02 + +#define SYSFLG_NO_AUTOBOOT 0x04 /* Don't start autoboot sequence */ +#define SYSFLG_QUICK_AUTOBOOT 0x08 /* Immediate autoboot (no countdown) */ +#define SYSFLG_NO_STARTUP_SCRIPT 0x10 /* Don't read startup script */ +#define SYSFLG_NO_SECURITY 0x20 /* Don't ask passwd on network login */ +#define SYSFLG_AUTOCONFIG 0x40 /* Use bootp or DHCP to get boot */ + /* parameters */ +#define SYSFLG_TFTP 0x80 /* Use tftp to get boot image */ +#define SYSFLG_PROXY 0x100 /* Use proxy arp */ +#define SYSFLG_WDB 0x200 /* Use WDB agent */ +#define SYSFLG_SYS_MODE_DEBUG 0x400 /* System is in 'debug' mode */ + +#define SYSFLG_VENDOR_0 0x1000 /* vendor defined flag 0 */ +#define SYSFLG_VENDOR_1 0x2000 /* vendor defined flag 1 */ +#define SYSFLG_VENDOR_2 0x4000 /* vendor defined flag 2 */ +#define SYSFLG_VENDOR_3 0x8000 /* vendor defined flag 3 */ + + +/* system parameters */ + +#ifndef _ASMLANGUAGE + +extern int sysBus; /* system bus type (VME_BUS, MULTI_BUS, etc) */ +extern int sysCpu; /* system cpu type (MC680x0, SPARC, etc.) */ +extern int sysProcNum; /* processor number of this cpu */ +extern char * sysBootLine; /* address of boot line */ +extern char * sysExcMsg; /* address of exception message area */ +extern int sysFlags; /* configuration flags */ +extern BOOT_PARAMS sysBootParams; /* parameters from boot line */ + +/* obsolete - but remain for backward compatiblity */ + +extern char sysBootHost[]; /* name of host from which system was booted */ +extern char sysBootFile[]; /* name of file from which system was booted */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern char * sysModel (void); +extern char * sysBspRev (void); +extern void sysHwInit (void); +extern void sysHwInit2 (void); +extern char * sysMemTop (void); +extern char * sysPhysMemTop (void); +extern STATUS sysToMonitor (int startType); +extern int sysProcNumGet (void); +extern void sysProcNumSet (int procNum); +extern BOOL sysBusTas (char *adrs); +extern STATUS sysNvRamGet (char *string, int strLen, int offset); +extern STATUS sysNvRamSet (char *string, int strLen, int offset); +extern STATUS sysScsiInit (void); +extern STATUS sysScsiConfig (void); +extern void sysSerialHwInit (void); +extern void sysSerialHwInit2 (void); +extern SIO_CHAN * sysSerialChanGet (int channel); +extern void sysSerialReset (void); +extern STATUS sysLocalToBusAdrs (int adrsSpace, char *localAdrs, + char **pBusAdrs); +extern STATUS sysBusToLocalAdrs (int adrsSpace, char *busAdrs, + char **pLocalAdrs); +extern STATUS sysIntDisable (int intLevel); +extern STATUS sysIntEnable (int intLevel); +extern int sysBusIntAck (int intLevel); +extern STATUS sysBusIntGen (int level, int vector); +extern STATUS sysMailboxConnect (FUNCPTR routine, int arg); +extern STATUS sysMailboxEnable (char *mailboxAdrs); +extern int tyCoDrv (void); +extern int tyCoDevCreate (char *name, int channel, int rdBufSize, + int wrtBufSize); + +/* For all architectures, except X86, the arguments are unsigned. */ +#if defined (_WRS_SIGNED_IO_ARGS) +#define _WRS_IOLONG int +#define _WRS_IOSHORT short +#define _WRS_IOCHAR char +#else /* _WRS_SIGNED_IOARGS */ +#define _WRS_IOLONG ULONG +#define _WRS_IOSHORT UINT16 +#define _WRS_IOCHAR UCHAR +#endif /* _WRS_SIGNED_IO_ARGS */ + + +extern UCHAR sysInByte (_WRS_IOLONG port); +extern USHORT sysInWord (_WRS_IOLONG port); +extern ULONG sysInLong (_WRS_IOLONG port); +extern void sysInWordString (_WRS_IOLONG port, _WRS_IOSHORT *pData, int count); +extern void sysInLongString (_WRS_IOLONG port, _WRS_IOLONG *pData, int count); +extern void sysOutByte (_WRS_IOLONG port, _WRS_IOCHAR data); +extern void sysOutWord (_WRS_IOLONG port, _WRS_IOSHORT data); +extern void sysOutLong (_WRS_IOLONG port, _WRS_IOLONG data); +extern void sysOutWordString (_WRS_IOLONG port, _WRS_IOSHORT *pData, int count); +extern void sysOutLongString (_WRS_IOLONG port, _WRS_IOLONG *pData, int count); + + +/* optional support routines used by several architectures */ + +extern void sysNanoDelay (UINT32 nanoseconds); +extern void sysReboot (void); +extern void sysDelay (void); +extern void sysWait (void); +extern STATUS sysIntDisablePIC (int intLevel); +extern STATUS sysIntEnablePIC (int intLevel); + +/* i960 special routines */ + +extern void sysFaultTableInit (void (*func)(void)); +extern UINT32 sysFaultVecSet (INSTR *vector, UINT32 faultNo, + UINT32 type); +extern void sysExcInfoPrint (UINT32 type); + +/* X86 special routines */ + +extern void sysLoadGdt (char *sysGdtr); + +/* VxSim special routines */ +#ifdef _WRS_ARCH_IS_SIMULATOR +extern void sysNetIfConfig (void); +#endif /* _WRS_ARCH_IS_SIMULATOR */ + +#else /* __STDC__ */ + +extern char * sysModel (); +extern void sysHwInit (); +extern void sysHwInit2 (); +extern char * sysMemTop (); +extern STATUS sysToMonitor (); +extern int sysProcNumGet (); +extern void sysProcNumSet (); +extern BOOL sysBusTas (); +extern STATUS sysNvRamGet (); +extern STATUS sysNvRamSet (); +extern STATUS sysScsiInit (); +extern SIO_CHAN *sysSerialChanGet (); +extern STATUS sysLocalToBusAdrs (); +extern STATUS sysBusToLocalAdrs (); +extern STATUS sysIntDisable (); +extern STATUS sysIntEnable (); +extern int sysBusIntAck (); +extern STATUS sysBusIntGen (); +extern STATUS sysMailboxConnect (); +extern STATUS sysMailboxEnable (); +extern int tyCoDrv (); +extern int tyCoDevCreate (); + +#if CPU_FAMILY == I960 +extern void sysFaultTableInit (); +extern UINT32 sysFaultVecSet (); +extern void sysExcInfoPrint (); +#endif /* CPU_FAMILY == I960 */ + +#if defined (_WRS_SYS_IO) +extern UCHAR sysInByte (); +extern USHORT sysInWord (); +extern ULONG sysInLong (); +extern void sysInWordString (); +extern void sysInLongString (); +extern void sysOutByte (); +extern void sysOutWord (); +extern void sysOutLong (); +extern void sysOutWordString (); +extern void sysOutLongString (); +extern void sysReboot (); +extern void sysDelay (); +extern void sysWait (); +extern void sysLoadGdt (); +extern STATUS sysIntDisablePIC (); +extern STATUS sysIntEnablePIC (); +#endif /* _WRS_SYS_IO */ + +/* VxSim special routines */ +#ifdef _WRS_ARCH_IS_SIMULATOR +extern void sysNetIfConfig (); +#endif /* _WRS_ARCH_IS_SIMULATOR */ + +#endif /* __STDC__ */ + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsysLibh */ diff --git a/h/sysSymTbl.h b/h/sysSymTbl.h new file mode 100644 index 0000000..9437058 --- /dev/null +++ b/h/sysSymTbl.h @@ -0,0 +1,48 @@ +/* sysSymTbl.h - system symbol table header */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02d,22sep92,rrr added support for c++ +02c,15sep92,jcf added symbol table declarations. +02b,01aug92,jcf bumped maximum symbol length to 256. +02a,04jul92,jcf cleaned up. +01e,26may92,rrr the tree shuffle +01d,04oct91,rrr passed through the ansification filter + -changed copyright notice +01c,05oct90,shl added copyright notice. +02b,21nov89,jcf removed obsolete definition. +02a,08apr86,dnw removed obsolete definitions. + clean-up. +01d,27aug85,rdc made MAX_SYS_SYM_LEN real big. +01c,24jun85,rdc changed name in SYS_SYM_STRUCT to char pointer +01b,13jun85,rdc created MAX_SYS_SYM_LEN +01a,17may85,rdc written +*/ + +#ifndef __INCsysSymTblh +#define __INCsysSymTblh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "symLib.h" +#include "symbol.h" + +#define MAX_SYS_SYM_LEN 256 /* system symbols will not exceed this limit */ + +extern SYMTAB_ID sysSymTbl; /* system symbol table */ +extern SYMBOL standTbl[]; /* standalone symbol table array */ +extern ULONG standTblSize; /* symbols in standalone table */ +extern SYMTAB_ID statSymTbl; /* system error code symbol table */ +extern SYMBOL statTbl[]; /* status string symbol table array */ +extern ULONG statTblSize; /* status strings in status table */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsysSymTblh */ diff --git a/h/syscall.h b/h/syscall.h new file mode 100644 index 0000000..99dec37 --- /dev/null +++ b/h/syscall.h @@ -0,0 +1,194 @@ +/* syscall.h - System Call Group and Number definition file */ + +/* Copyright (c) 2003-2005 Wind River Systems, Inc. */ + +/* THIS FILE IS AUTO_GENERATED. PLEASE DO NOT EDIT. */ + +#ifndef __INCsyscallh +#define __INCsyscallh + +#ifdef __cplusplus +extern "C" { +#endif + + /* defines */ + + /* + * SYSTEM CALL NUMBERS: + * System Call Numbers (SCN) are unique 32-bit numbers identifying + * the kernel routine requested by the user. The SCI decodes this + * number to identify and call the requested kernel function on + * behalf of the application. The SCN is organized as follows: + * + * SYSCALL_GROUP_NUM_BITS SYSCALL_ROUTINE_NUM_BITS + * ----------------------------------------------------------------- + * | | | | + * | reserved | Group# | Routine# | + * | | | | + * ----------------------------------------------------------------- + * 31 0 + */ + +#define SYSCALL_GROUP_NUM_BITS 8 +#define SYSCALL_ROUTINE_NUM_BITS 8 +#define SYSCALL_GROUP_NO_BIT_START 8 + +#define SYSCALL_NUMBER(grp,rtn) (((grp) << SYSCALL_GROUP_NO_BIT_START) | (rtn)) + + + /* List of System Call Groups + * + * Groups 0 and 1 are reserved for future Wind River use. + * Groups 2 through 7 are for customer use. + * Groups 8 onwards are for Wind River and partner use. + */ + +#define SCG_RESERVED0 0 +#define SCG_RESERVED0_Name "RESERVED0Group" +#define SCG_RESERVED1 1 +#define SCG_RESERVED1_Name "RESERVED1Group" +#define SCG_USER0 2 +#define SCG_USER0_Name "USER0Group" +#define SCG_USER1 3 +#define SCG_USER1_Name "USER1Group" +#define SCG_USER2 4 +#define SCG_USER2_Name "USER2Group" +#define SCG_USER3 5 +#define SCG_USER3_Name "USER3Group" +#define SCG_USER4 6 +#define SCG_USER4_Name "USER4Group" +#define SCG_USER5 7 +#define SCG_USER5_Name "USER5Group" +#define SCG_STANDARD 8 +#define SCG_STANDARD_Name "STANDARDGroup" +#define SCG_VXWORKS 9 +#define SCG_VXWORKS_Name "VXWORKSGroup" +#define SCG_VXTEST 10 +#define SCG_VXTEST_Name "VXTESTGroup" +#define SCG_RTI 11 +#define SCG_RTI_Name "RTIGroup" + +/* Routines for SCG_STANDARD */ + +#define SCN__exit SYSCALL_NUMBER (SCG_STANDARD, 0) +#define SCN_creat SYSCALL_NUMBER (SCG_STANDARD, 1) +#define SCN__open SYSCALL_NUMBER (SCG_STANDARD, 2) +#define SCN_close SYSCALL_NUMBER (SCG_STANDARD, 3) +#define SCN_read SYSCALL_NUMBER (SCG_STANDARD, 4) +#define SCN_write SYSCALL_NUMBER (SCG_STANDARD, 5) +#define SCN__ioctl SYSCALL_NUMBER (SCG_STANDARD, 6) +#define SCN_dup SYSCALL_NUMBER (SCG_STANDARD, 7) +#define SCN_dup2 SYSCALL_NUMBER (SCG_STANDARD, 8) +#define SCN_pipe SYSCALL_NUMBER (SCG_STANDARD, 9) +#define SCN_remove SYSCALL_NUMBER (SCG_STANDARD, 10) +#define SCN_select SYSCALL_NUMBER (SCG_STANDARD, 11) +#define SCN_socket SYSCALL_NUMBER (SCG_STANDARD, 12) +#define SCN_bind SYSCALL_NUMBER (SCG_STANDARD, 13) +#define SCN_listen SYSCALL_NUMBER (SCG_STANDARD, 14) +#define SCN_accept SYSCALL_NUMBER (SCG_STANDARD, 15) +#define SCN_connect SYSCALL_NUMBER (SCG_STANDARD, 16) +#define SCN_sendto SYSCALL_NUMBER (SCG_STANDARD, 17) +#define SCN_send SYSCALL_NUMBER (SCG_STANDARD, 18) +#define SCN_sendmsg SYSCALL_NUMBER (SCG_STANDARD, 19) +#define SCN_recvfrom SYSCALL_NUMBER (SCG_STANDARD, 20) +#define SCN_recv SYSCALL_NUMBER (SCG_STANDARD, 21) +#define SCN_recvmsg SYSCALL_NUMBER (SCG_STANDARD, 22) +#define SCN_setsockopt SYSCALL_NUMBER (SCG_STANDARD, 23) +#define SCN_getsockopt SYSCALL_NUMBER (SCG_STANDARD, 24) +#define SCN_getsockname SYSCALL_NUMBER (SCG_STANDARD, 25) +#define SCN_getpeername SYSCALL_NUMBER (SCG_STANDARD, 26) +#define SCN_shutdown SYSCALL_NUMBER (SCG_STANDARD, 27) +#define SCN_mmap SYSCALL_NUMBER (SCG_STANDARD, 28) +#define SCN_munmap SYSCALL_NUMBER (SCG_STANDARD, 29) +#define SCN_mprotect SYSCALL_NUMBER (SCG_STANDARD, 30) +#define SCN_kill SYSCALL_NUMBER (SCG_STANDARD, 31) +#define SCN_pause SYSCALL_NUMBER (SCG_STANDARD, 32) +#define SCN_sigpending SYSCALL_NUMBER (SCG_STANDARD, 33) +#define SCN_sigprocmask SYSCALL_NUMBER (SCG_STANDARD, 34) +#define SCN__sigqueue SYSCALL_NUMBER (SCG_STANDARD, 35) +#define SCN_sigsuspend SYSCALL_NUMBER (SCG_STANDARD, 36) +#define SCN_sigtimedwait SYSCALL_NUMBER (SCG_STANDARD, 37) +#define SCN__sigaction SYSCALL_NUMBER (SCG_STANDARD, 38) +#define SCN__sigreturn SYSCALL_NUMBER (SCG_STANDARD, 39) +#define SCN_chdir SYSCALL_NUMBER (SCG_STANDARD, 40) +#define SCN__getcwd SYSCALL_NUMBER (SCG_STANDARD, 41) +#define SCN_getpid SYSCALL_NUMBER (SCG_STANDARD, 43) +#define SCN_getppid SYSCALL_NUMBER (SCG_STANDARD, 44) +#define SCN_waitpid SYSCALL_NUMBER (SCG_STANDARD, 45) +#define SCN_sysctl SYSCALL_NUMBER (SCG_STANDARD, 46) +#define SCN__schedPxInfoGet SYSCALL_NUMBER (SCG_STANDARD, 47) +#define SCN_sigaltstack SYSCALL_NUMBER (SCG_STANDARD, 48) +#define SCN_unlink SYSCALL_NUMBER (SCG_STANDARD, 49) +#define SCN_link SYSCALL_NUMBER (SCG_STANDARD, 50) +#define SCN_fsync SYSCALL_NUMBER (SCG_STANDARD, 51) +#define SCN_fdatasync SYSCALL_NUMBER (SCG_STANDARD, 52) +#define SCN_rename SYSCALL_NUMBER (SCG_STANDARD, 53) +#define SCN_fpathconf SYSCALL_NUMBER (SCG_STANDARD, 54) +#define SCN_pathconf SYSCALL_NUMBER (SCG_STANDARD, 55) +#define SCN_access SYSCALL_NUMBER (SCG_STANDARD, 56) +#define SCN_chmod SYSCALL_NUMBER (SCG_STANDARD, 57) + +#define STANDARDRtnTblNum (sizeof(STANDARDRtnTbl)/sizeof(STANDARDRtnTbl[0])) + +/* Routines for SCG_VXWORKS */ + +#define SCN_eventReceive SYSCALL_NUMBER (SCG_VXWORKS, 0) +#define SCN_eventSend SYSCALL_NUMBER (SCG_VXWORKS, 1) +#define SCN_eventCtl SYSCALL_NUMBER (SCG_VXWORKS, 2) +#define SCN_msgQSend SYSCALL_NUMBER (SCG_VXWORKS, 3) +#define SCN_msgQReceive SYSCALL_NUMBER (SCG_VXWORKS, 4) +#define SCN__msgQOpen SYSCALL_NUMBER (SCG_VXWORKS, 5) +#define SCN_objDelete SYSCALL_NUMBER (SCG_VXWORKS, 6) +#define SCN_objInfoGet SYSCALL_NUMBER (SCG_VXWORKS, 7) +#define SCN__semTake SYSCALL_NUMBER (SCG_VXWORKS, 8) +#define SCN__semGive SYSCALL_NUMBER (SCG_VXWORKS, 9) +#define SCN__semOpen SYSCALL_NUMBER (SCG_VXWORKS, 10) +#define SCN_semCtl SYSCALL_NUMBER (SCG_VXWORKS, 11) +#define SCN__taskOpen SYSCALL_NUMBER (SCG_VXWORKS, 12) +#define SCN_taskCtl SYSCALL_NUMBER (SCG_VXWORKS, 13) +#define SCN_taskDelay SYSCALL_NUMBER (SCG_VXWORKS, 14) +#define SCN_rtpSpawn SYSCALL_NUMBER (SCG_VXWORKS, 15) +#define SCN_rtpInfoGet SYSCALL_NUMBER (SCG_VXWORKS, 16) +#define SCN_taskKill SYSCALL_NUMBER (SCG_VXWORKS, 17) +#define SCN__taskSigqueue SYSCALL_NUMBER (SCG_VXWORKS, 18) +#define SCN__timer_open SYSCALL_NUMBER (SCG_VXWORKS, 19) +#define SCN_timerCtl SYSCALL_NUMBER (SCG_VXWORKS, 20) +#define SCN_pxOpen SYSCALL_NUMBER (SCG_VXWORKS, 21) +#define SCN_pxClose SYSCALL_NUMBER (SCG_VXWORKS, 22) +#define SCN_pxUnlink SYSCALL_NUMBER (SCG_VXWORKS, 23) +#define SCN_pxCtl SYSCALL_NUMBER (SCG_VXWORKS, 24) +#define SCN_pxMqReceive SYSCALL_NUMBER (SCG_VXWORKS, 25) +#define SCN_pxMqSend SYSCALL_NUMBER (SCG_VXWORKS, 26) +#define SCN_pxSemWait SYSCALL_NUMBER (SCG_VXWORKS, 27) +#define SCN_pxSemPost SYSCALL_NUMBER (SCG_VXWORKS, 28) +#define SCN_pipeDevCreate SYSCALL_NUMBER (SCG_VXWORKS, 29) +#define SCN_pipeDevDelete SYSCALL_NUMBER (SCG_VXWORKS, 30) +#define SCN__sdCreate SYSCALL_NUMBER (SCG_VXWORKS, 31) +#define SCN__sdOpen SYSCALL_NUMBER (SCG_VXWORKS, 32) +#define SCN_sdDelete SYSCALL_NUMBER (SCG_VXWORKS, 33) +#define SCN_sdMap SYSCALL_NUMBER (SCG_VXWORKS, 34) +#define SCN_sdUnmap SYSCALL_NUMBER (SCG_VXWORKS, 35) +#define SCN_sdProtect SYSCALL_NUMBER (SCG_VXWORKS, 36) +#define SCN__edrErrorInject SYSCALL_NUMBER (SCG_VXWORKS, 37) +#define SCN_edrFlagsGet SYSCALL_NUMBER (SCG_VXWORKS, 38) +#define SCN_resSearchN SYSCALL_NUMBER (SCG_VXWORKS, 39) +#define SCN_wvEvent SYSCALL_NUMBER (SCG_VXWORKS, 40) +#define SCN_rtpVarAdd SYSCALL_NUMBER (SCG_VXWORKS, 41) +#define SCN_sdInfoGet SYSCALL_NUMBER (SCG_VXWORKS, 42) +#define SCN__shlOpen SYSCALL_NUMBER (SCG_VXWORKS, 43) +#define SCN__shlUnlock SYSCALL_NUMBER (SCG_VXWORKS, 44) +#define SCN__shlClose SYSCALL_NUMBER (SCG_VXWORKS, 45) +#define SCN__shlGet SYSCALL_NUMBER (SCG_VXWORKS, 46) +#define SCN__shlPut SYSCALL_NUMBER (SCG_VXWORKS, 47) +#define SCN_objUnlink SYSCALL_NUMBER (SCG_VXWORKS, 48) +#define SCN_getprlimit SYSCALL_NUMBER (SCG_VXWORKS, 49) +#define SCN_setprlimit SYSCALL_NUMBER (SCG_VXWORKS, 50) +#define SCN__mctl SYSCALL_NUMBER (SCG_VXWORKS, 51) + +#define VXWORKSRtnTblNum (sizeof(VXWORKSRtnTbl)/sizeof(VXWORKSRtnTbl[0])) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsyscallh */ diff --git a/h/syscallArgs.h b/h/syscallArgs.h new file mode 100644 index 0000000..15e3968 --- /dev/null +++ b/h/syscallArgs.h @@ -0,0 +1,76 @@ +/* syscallArgs.h - Top-level file to include the syscall argument structures */ + +/* Copyright 2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01c,27apr04,mil Fixed names for MIPS include files. +01b,15dec03,yvp Changed arch-specific header file names. +01a,10dec03,yvp written. +*/ + +#ifndef __INCsyscallArgsh +#define __INCsyscallArgsh + +#ifdef __cplusplus +extern "C" { +#endif + +#if (CPU_FAMILY==PPC) +#include "arch/ppc/syscallArgsppc.h" +#endif + +#if (CPU_FAMILY==ARM) +#include "arch/arm/syscallArgsarm.h" +#endif + +#if (CPU_FAMILY==MIPS) +# if (_WRS_INT_REGISTER_SIZE == 8) +# if (_BYTE_ORDER == _LITTLE_ENDIAN) +# include "arch/mips/syscallArgsMIPS64LE.h" +# elif (_BYTE_ORDER == _BIG_ENDIAN) +# include "arch/mips/syscallArgsMIPS64BE.h" +# else /* _BYTE_ORDER */ +# error "Byte order cannot be determined\n" +# endif /* _BYTE_ORDER */ +# elif (_WRS_INT_REGISTER_SIZE == 4) +# include "arch/mips/syscallArgsMIPS32.h" +# else /* _WRS_INT_REGISTER_SIZE */ +# error "Register size cannot be determined\n" +# endif /* _WRS_INT_REGISTER_SIZE */ +#endif /* CPU_FAMILY==MIPS */ + +#if (CPU_FAMILY==I80X86) +#include "arch/i86/syscallArgsx86.h" +#endif + +#if (CPU_FAMILY==SH) +#if (CPU == SH7600) +#include "arch/sh/syscallArgssh2.h" +#elif (CPU == SH7700) +#include "arch/sh/syscallArgssh3.h" +#elif (CPU == SH7750) +#include "arch/sh/syscallArgssh4.h" +#endif +#endif + +#if (CPU_FAMILY==SIMNT) +#include "arch/simnt/syscallArgsx86.h" +#endif + +#if (CPU_FAMILY==SIMLINUX) +#include "arch/simlinux/syscallArgsx86.h" +#endif + +#if (CPU_FAMILY==SIMSPARCSOLARIS) +#include "arch/simsolaris/syscallArgssparc.h" +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsyscallArgsh */ diff --git a/h/syscallLib.h b/h/syscallLib.h new file mode 100644 index 0000000..84ae183 --- /dev/null +++ b/h/syscallLib.h @@ -0,0 +1,68 @@ +/* syscallLib.h - System Call Infrastructure library header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01f,12nov03,yvp Changed syscallLibInit to take hook tbl size param. +01e,31oct03,yvp Added S_syscallLib_VECTOR_INIT_FAILED. +01d,29sep03,yvp Added errno S_syscallLib_INVALID_USER_SP. +01c,15sep03,yvp Moved syscallDispatch prototype to syscallLibP.h +01b,03sep03,yvp Added extern for syscallGroupTbl. +01a,26aug03,yvp written. +*/ + +#ifndef __INCsyscallLibh +#define __INCsyscallLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" +#include "vwModNum.h" + +/* generic status codes for syscallLib */ + +#define S_syscallLib_UNKNOWN_GROUP (M_syscallLib | 1) +#define S_syscallLib_GROUP_EXISTS (M_syscallLib | 2) +#define S_syscallLib_INVALID_ROUTINE_COUNT (M_syscallLib | 3) +#define S_syscallLib_NO_ROUTINES_TBL (M_syscallLib | 4) +#define S_syscallLib_INVALID_USER_SP (M_syscallLib | 5) +#define S_syscallLib_VECTOR_INIT_FAILED (M_syscallLib | 6) + +#ifndef _ASMLANGUAGE + +/* typedefs */ + +typedef struct syscall_rtn_tbl_entry + { + FUNCPTR pMethod; + int numArgs; /* numArgs should be the total number of native */ + /* words that the argument list takes (max = 8) */ + /* including 64-bit arguments & alignment pad */ + char * methodName; + UINT32 spare; /* make sizeof == 16 bytes for cache efficiency */ + } SYSCALL_RTN_TBL_ENTRY; + + /* externals */ + +extern char * syscallGroupName []; + +/* function declarations */ + +STATUS syscallLibInit (const int); +STATUS syscallGroupRegister (int, char *, int, SYSCALL_RTN_TBL_ENTRY *, BOOL); +void syscallShow (int, int); + +#ifdef __cplusplus +} +#endif + +#endif /* _ASMLANGUAGE */ + +#endif /* __INCsyscallLibh */ diff --git a/h/syscallTbl.h b/h/syscallTbl.h new file mode 100644 index 0000000..7956c8c --- /dev/null +++ b/h/syscallTbl.h @@ -0,0 +1,449 @@ + +/* THIS FILE IS AUTO_GENERATED. PLEASE DO NOT EDIT. */ + +extern int _exitSc(void *); +extern int creatSc(void *); +extern int _openSc(void *); +extern int closeSc(void *); +extern int readSc(void *); +extern int writeSc(void *); +extern int _ioctlSc(void *); +extern int dupSc(void *); +extern int dup2Sc(void *); +extern int pipeSc(void *); +extern int removeSc(void *); +extern int selectSc(void *); +extern int socketSc(void *); +extern int bindSc(void *); +extern int listenSc(void *); +extern int acceptSc(void *); +extern int connectSc(void *); +extern int sendtoSc(void *); +extern int sendSc(void *); +extern int sendmsgSc(void *); +extern int recvfromSc(void *); +extern int recvSc(void *); +extern int recvmsgSc(void *); +extern int setsockoptSc(void *); +extern int getsockoptSc(void *); +extern int getsocknameSc(void *); +extern int getpeernameSc(void *); +extern int shutdownSc(void *); +extern int mmapSc(void *); +extern int munmapSc(void *); +extern int mprotectSc(void *); +extern int killSc(void *); +extern int pauseSc(void *); +extern int sigpendingSc(void *); +extern int sigprocmaskSc(void *); +extern int _sigqueueSc(void *); +extern int sigsuspendSc(void *); +extern int sigtimedwaitSc(void *); +extern int _sigactionSc(void *); +extern int _sigreturnSc(void *); +extern int chdirSc(void *); +extern int _getcwdSc(void *); +extern int getpidSc(void *); +extern int getppidSc(void *); +extern int waitpidSc(void *); +extern int sysctlSc(void *); +extern int _schedPxInfoGetSc(void *); +extern int sigaltstackSc(void *); +extern int unlinkSc(void *); +extern int linkSc(void *); +extern int fsyncSc(void *); +extern int fdatasyncSc(void *); +extern int renameSc(void *); +extern int fpathconfSc(void *); +extern int pathconfSc(void *); +extern int accessSc(void *); +extern int chmodSc(void *); +extern int eventReceiveSc(void *); +extern int eventSendSc(void *); +extern int eventCtlSc(void *); +extern int msgQSendSc(void *); +extern int msgQReceiveSc(void *); +extern int _msgQOpenSc(void *); +extern int objDeleteSc(void *); +extern int objInfoGetSc(void *); +extern int _semTakeSc(void *); +extern int _semGiveSc(void *); +extern int _semOpenSc(void *); +extern int semCtlSc(void *); +extern int _taskOpenSc(void *); +extern int taskCtlSc(void *); +extern int taskDelaySc(void *); +extern int rtpSpawnSc(void *); +extern int rtpInfoGetSc(void *); +extern int taskKillSc(void *); +extern int _taskSigqueueSc(void *); +extern int _timer_openSc(void *); +extern int timerCtlSc(void *); +extern int pxOpenSc(void *); +extern int pxCloseSc(void *); +extern int pxUnlinkSc(void *); +extern int pxCtlSc(void *); +extern int pxMqReceiveSc(void *); +extern int pxMqSendSc(void *); +extern int pxSemWaitSc(void *); +extern int pxSemPostSc(void *); +extern int pipeDevCreateSc(void *); +extern int pipeDevDeleteSc(void *); +extern int _sdCreateSc(void *); +extern int _sdOpenSc(void *); +extern int sdDeleteSc(void *); +extern int sdMapSc(void *); +extern int sdUnmapSc(void *); +extern int sdProtectSc(void *); +extern int _edrErrorInjectSc(void *); +extern int edrFlagsGetSc(void *); +extern int resSearchNSc(void *); +extern int wvEventSc(void *); +extern int rtpVarAddSc(void *); +extern int sdInfoGetSc(void *); +extern int _shlOpenSc(void *); +extern int _shlUnlockSc(void *); +extern int _shlCloseSc(void *); +extern int _shlGetSc(void *); +extern int _shlPutSc(void *); +extern int objUnlinkSc(void *); +extern int getprlimitSc(void *); +extern int setprlimitSc(void *); +extern int _mctlSc(void *); + +_WRS_DATA_ALIGN_BYTES(16) SYSCALL_RTN_TBL_ENTRY STANDARDRtnTbl [] = { +/*0*/ { _exitSc, 1, "_exit", 0}, +/*1*/ { creatSc, 2, "creat", 0}, +/*2*/ { _openSc, 3, "_open", 0}, +/*3*/ { closeSc, 1, "close", 0}, +/*4*/ { readSc, 3, "read", 0}, +/*5*/ { writeSc, 3, "write", 0}, +/*6*/ { _ioctlSc, 3, "_ioctl", 0}, +/*7*/ { dupSc, 1, "dup", 0}, +/*8*/ { dup2Sc, 2, "dup2", 0}, +/*9*/ { pipeSc, 1, "pipe", 0}, +/*10*/ { removeSc, 1, "remove", 0}, +/*11*/ { selectSc, 5, "select", 0}, +#if defined(INCLUDE_SC_SOCKLIB) +/*12*/ { socketSc, 3, "socket", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SC_SOCKLIB) +/*13*/ { bindSc, 3, "bind", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SC_SOCKLIB) +/*14*/ { listenSc, 2, "listen", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SC_SOCKLIB) +/*15*/ { acceptSc, 3, "accept", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SC_SOCKLIB) +/*16*/ { connectSc, 3, "connect", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SC_SOCKLIB) +/*17*/ { sendtoSc, 6, "sendto", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SC_SOCKLIB) +/*18*/ { sendSc, 4, "send", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SC_SOCKLIB) +/*19*/ { sendmsgSc, 3, "sendmsg", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SC_SOCKLIB) +/*20*/ { recvfromSc, 6, "recvfrom", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SC_SOCKLIB) +/*21*/ { recvSc, 4, "recv", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SC_SOCKLIB) +/*22*/ { recvmsgSc, 3, "recvmsg", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SC_SOCKLIB) +/*23*/ { setsockoptSc, 5, "setsockopt", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SC_SOCKLIB) +/*24*/ { getsockoptSc, 5, "getsockopt", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SC_SOCKLIB) +/*25*/ { getsocknameSc, 3, "getsockname", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SC_SOCKLIB) +/*26*/ { getpeernameSc, 3, "getpeername", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SC_SOCKLIB) +/*27*/ { shutdownSc, 2, "shutdown", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +/*28*/ { mmapSc, 8, "mmap", 0}, +/*29*/ { munmapSc, 2, "munmap", 0}, +/*30*/ { mprotectSc, 3, "mprotect", 0}, +/*31*/ { killSc, 2, "kill", 0}, +/*32*/ { pauseSc, 0, "pause", 0}, +/*33*/ { sigpendingSc, 1, "sigpending", 0}, +/*34*/ { sigprocmaskSc, 3, "sigprocmask", 0}, +/*35*/ { _sigqueueSc, 4, "_sigqueue", 0}, +/*36*/ { sigsuspendSc, 1, "sigsuspend", 0}, +/*37*/ { sigtimedwaitSc, 3, "sigtimedwait", 0}, +/*38*/ { _sigactionSc, 4, "_sigaction", 0}, +/*39*/ { _sigreturnSc, 0, "_sigreturn", 0}, +/*40*/ { chdirSc, 1, "chdir", 0}, +/*41*/ { _getcwdSc, 2, "_getcwd", 0}, +/*42*/ { NULL, }, +/*43*/ { getpidSc, 0, "getpid", 0}, +/*44*/ { getppidSc, 0, "getppid", 0}, +/*45*/ { waitpidSc, 3, "waitpid", 0}, +#if defined(INCLUDE_SC_SYSCTL) +/*46*/ { sysctlSc, 6, "sysctl", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_POSIX_SCHED) +/*47*/ { _schedPxInfoGetSc, 2, "_schedPxInfoGet", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +/*48*/ { sigaltstackSc, 2, "sigaltstack", 0}, +/*49*/ { unlinkSc, 1, "unlink", 0}, +/*50*/ { linkSc, 2, "link", 0}, +/*51*/ { fsyncSc, 1, "fsync", 0}, +/*52*/ { fdatasyncSc, 1, "fdatasync", 0}, +/*53*/ { renameSc, 2, "rename", 0}, +/*54*/ { fpathconfSc, 2, "fpathconf", 0}, +/*55*/ { pathconfSc, 2, "pathconf", 0}, +/*56*/ { accessSc, 2, "access", 0}, +/*57*/ { chmodSc, 2, "chmod", 0}, +}; +#define STANDARDRtnTblNum (sizeof(STANDARDRtnTbl)/sizeof(STANDARDRtnTbl[0])) + +_WRS_DATA_ALIGN_BYTES(16) SYSCALL_RTN_TBL_ENTRY VXWORKSRtnTbl [] = { +/*0*/ { eventReceiveSc, 4, "eventReceive", 0}, +/*1*/ { eventSendSc, 2, "eventSend", 0}, +/*2*/ { eventCtlSc, 4, "eventCtl", 0}, +#if defined(INCLUDE_MSG_Q) +/*3*/ { msgQSendSc, 5, "msgQSend", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_MSG_Q) +/*4*/ { msgQReceiveSc, 4, "msgQReceive", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_MSG_Q) +/*5*/ { _msgQOpenSc, 6, "_msgQOpen", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +/*6*/ { objDeleteSc, 2, "objDelete", 0}, +/*7*/ { objInfoGetSc, 4, "objInfoGet", 0}, +/*8*/ { _semTakeSc, 2, "_semTake", 0}, +/*9*/ { _semGiveSc, 1, "_semGive", 0}, +/*10*/ { _semOpenSc, 6, "_semOpen", 0}, +/*11*/ { semCtlSc, 4, "semCtl", 0}, +/*12*/ { _taskOpenSc, 1, "_taskOpen", 0}, +/*13*/ { taskCtlSc, 4, "taskCtl", 0}, +/*14*/ { taskDelaySc, 1, "taskDelay", 0}, +/*15*/ { rtpSpawnSc, 7, "rtpSpawn", 0}, +/*16*/ { rtpInfoGetSc, 2, "rtpInfoGet", 0}, +/*17*/ { taskKillSc, 2, "taskKill", 0}, +/*18*/ { _taskSigqueueSc, 4, "_taskSigqueue", 0}, +#if defined(INCLUDE_POSIX_TIMERS) +/*19*/ { _timer_openSc, 5, "_timer_open", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_POSIX_TIMERS) +/*20*/ { timerCtlSc, 4, "timerCtl", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_POSIX_SEM) || defined(INCLUDE_POSIX_MQ) +/*21*/ { pxOpenSc, 4, "pxOpen", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_POSIX_SEM) || defined(INCLUDE_POSIX_MQ) +/*22*/ { pxCloseSc, 1, "pxClose", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_POSIX_SEM) || defined(INCLUDE_POSIX_MQ) +/*23*/ { pxUnlinkSc, 2, "pxUnlink", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_POSIX_SEM) || defined(INCLUDE_POSIX_MQ) +/*24*/ { pxCtlSc, 4, "pxCtl", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_POSIX_MQ) +/*25*/ { pxMqReceiveSc, 6, "pxMqReceive", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_POSIX_MQ) +/*26*/ { pxMqSendSc, 6, "pxMqSend", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_POSIX_SEM) +/*27*/ { pxSemWaitSc, 3, "pxSemWait", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_POSIX_SEM) +/*28*/ { pxSemPostSc, 1, "pxSemPost", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_PIPES) +/*29*/ { pipeDevCreateSc, 3, "pipeDevCreate", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_PIPES) +/*30*/ { pipeDevDeleteSc, 2, "pipeDevDelete", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SHARED_DATA) +/*31*/ { _sdCreateSc, 8, "_sdCreate", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SHARED_DATA) +/*32*/ { _sdOpenSc, 8, "_sdOpen", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SHARED_DATA) +/*33*/ { sdDeleteSc, 2, "sdDelete", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SHARED_DATA) +/*34*/ { sdMapSc, 3, "sdMap", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SHARED_DATA) +/*35*/ { sdUnmapSc, 2, "sdUnmap", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SHARED_DATA) +/*36*/ { sdProtectSc, 2, "sdProtect", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +/*37*/ { _edrErrorInjectSc, 6, "_edrErrorInject", 0}, +/*38*/ { edrFlagsGetSc, 0, "edrFlagsGet", 0}, +#if defined(INCLUDE_DNS_RESOLVER) +/*39*/ { resSearchNSc, 2, "resSearchN", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_WINDVIEW) +/*40*/ { wvEventSc, 3, "wvEvent", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +/*41*/ { rtpVarAddSc, 2, "rtpVarAdd", 0}, +#if defined(INCLUDE_SHARED_DATA) +/*42*/ { sdInfoGetSc, 2, "sdInfoGet", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SHL) +/*43*/ { _shlOpenSc, 2, "_shlOpen", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SHL) +/*44*/ { _shlUnlockSc, 1, "_shlUnlock", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SHL) +/*45*/ { _shlCloseSc, 1, "_shlClose", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SHL) +/*46*/ { _shlGetSc, 2, "_shlGet", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +#if defined(INCLUDE_SHL) +/*47*/ { _shlPutSc, 2, "_shlPut", 0}, +#else + { NULL, 0, NULL, 0}, +#endif +/*48*/ { objUnlinkSc, 2, "objUnlink", 0}, +/*49*/ { getprlimitSc, 4, "getprlimit", 0}, +/*50*/ { setprlimitSc, 4, "setprlimit", 0}, +/*51*/ { _mctlSc, 4, "_mctl", 0}, +}; +#define VXWORKSRtnTblNum (sizeof(VXWORKSRtnTbl)/sizeof(VXWORKSRtnTbl[0])) + +SYSCALL_GROUP_ENTRY syscallGroupTbl [SYSCALL_GROUPS_MAX] = { + { NULL, 0}, + { NULL, 0}, + { NULL, 0}, + { NULL, 0}, + { NULL, 0}, + { NULL, 0}, + { NULL, 0}, + { NULL, 0}, + { STANDARDRtnTbl, STANDARDRtnTblNum, }, + { VXWORKSRtnTbl, VXWORKSRtnTblNum, }, + { NULL, 0}, + { NULL, 0}, +}; + +char * syscallGroupName [SYSCALL_GROUPS_MAX] = { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "STANDARDGroup", + "VXWORKSGroup", + NULL, + NULL, +}; + diff --git a/h/systime.h b/h/systime.h new file mode 100644 index 0000000..b4a9646 --- /dev/null +++ b/h/systime.h @@ -0,0 +1,37 @@ +/* systime.h - obsolete vxWorks 5.0 header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02d,22sep92,rrr added support for c++ +02c,19sep92,smb contents have been moved to sys/times.h +02b,31jul92,gae changed INCtimeh to INCsystimeh. +02a,04jul92,jcf cleaned up. +01g,26may92,rrr the tree shuffle +01f,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01e,10jun91.del added pragma for gnu960 alignment. +01d,25oct90,dnw changed name from utime.h to systime.h. + added test for SunOS headers already included. +01c,05oct90,shl added copyright notice. +01b,04nov87,dnw removed unnecessary stuff. +01a,15oct87,rdc written +*/ + +#ifndef __INCsystimeh +#define __INCsystimeh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "sys/times.h" + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsystimeh */ diff --git a/h/tapeFsLib.h b/h/tapeFsLib.h new file mode 100644 index 0000000..86152ff --- /dev/null +++ b/h/tapeFsLib.h @@ -0,0 +1,153 @@ +/* tapeFsLib.h - header for tape sequential device file system library */ + +/* Copyright 1984-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,17jul95,jds written +*/ + +#ifndef __INCtapeFsLibh +#define __INCtapeFsLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "seqIo.h" +#include "iosLib.h" +#include "semLib.h" +#include "vwModNum.h" + +/* Tape configuration parameters structure */ + +typedef struct /* TAPE_CONFIG */ + { + int blkSize; /* 0 => variable blocksize; > 0 => fixed blocksize */ + BOOL rewind; /* TRUE => a rewind device; FALSE => no rewind */ + int numFileMarks; /* How many filemarks to write upon closing a file */ + int density; /* Tape density, which is a SEQ_DEV parameter */ + } TAPE_CONFIG; + + +/* Tape volume descriptor */ + +typedef struct /* TAPE_VOL_DESC */ + { + DEV_HDR tapevd_devHdr; /* std. I/O system device header */ + SEM_ID tapevd_semId; /* volume descriptor semaphore id */ + SEQ_DEV * tapevd_pSeqDev; /* ptr to sequential device info */ + struct tapefd * tapevd_pTapeFd; /* ptr to file descriptor */ + int tapevd_status; /* (OK | ERROR) */ + int tapevd_state; /* state of volume (see below) */ + int tapevd_retry; /* current retry count for I/O errors */ + BOOL tapevd_rewind; /* is this a rewind | norewind volume */ + int tapevd_blkSize; /* 0 => variable blk; >0 => fixed blk */ + int tapevd_numFileMarks;/* num of f-marks to write upon close */ + int tapevd_density; /* density of the tape device */ + } TAPE_VOL_DESC; + + +/* Tape file descriptor */ + +typedef struct tapefd /* TAPE_FILE_DESC */ + { + TAPE_VOL_DESC * tapefd_pTapeVol; /* pointer to tape volume descriptor */ + BOOL tapefd_inUse; /* is the tape fd in use */ + int tapefd_mode; /* mode of tape O_RDONLY | O_WRONLY */ + + /* Buffering is used for fixed blocks only */ + + char * tapefd_buffer; /* pointer to read/write buffer area */ + int tapefd_bufSize; /* buffer size */ + int tapefd_bufIndex; /* current byte index within the buf */ + } TAPE_FILE_DESC; + + +/* + * Structure that defines the Unix MT ioctl parameter passed to the ioctl + * routine in tapeFsLib + */ + +typedef struct mtop + { + short mt_op; /* operation */ + int mt_count; /* number of operations */ + } MTOP; + + +/* Volume states */ + +#define TAPE_VD_READY_CHANGED 0 /* vol not accessed since ready change*/ +#define TAPE_VD_MOUNTED 2 /* volume mounted */ +#define TAPE_VD_UNMOUNTED 4 /* volume unmounted */ + +#define VARIABLE_BLOCK_SIZE 0 /* blkSize of 0 means variable block */ +#define LOAD TRUE /* load or mount a volume */ +#define UNLOAD FALSE /* unload or unmount a volume */ +#define LONG TRUE /* erase entire tape (long erase) */ +#define RETEN TRUE /* retension the tape during load */ +#define EOT TRUE /* unload tape at the end-of-tape */ +#define FIXED_BLK TRUE /* use fixed block size */ +#define VARIABLE_BLK FALSE /* use variable block size */ + +/* defined in scsiLib */ + +#define SPACE_CODE_DATABLK 0x00 /* space data blocks */ +#define SPACE_CODE_FILEMARK 0x01 /* space file-marks */ + +/* I/O controls */ + +/* MTIOCTOP operations */ + +#define MTWEOF 0 /* write an end-of-file record */ +#define MTFSF 1 /* forward space over file mark */ +#define MTBSF 2 /* backward space over file mark (1/2" only) */ +#define MTFSR 3 /* forward space to inter-record gap */ +#define MTBSR 4 /* backward space to inter-record gap */ +#define MTREW 5 /* rewind */ +#define MTOFFL 6 /* rewind and put the drive offline */ +#define MTNOP 7 /* no operation, sets status only */ +#define MTRETEN 8 /* retension the tape (cartridge tape only) */ +#define MTERASE 9 /* erase the entire tape */ +#define MTEOM 10 /* position to end of media */ +#define MTNBSF 11 /* backward space file to BOF */ + +/* tapeFsLib errnos */ + +#define S_tapeFsLib_NO_SEQ_DEV (M_tapeFsLib | 1) +#define S_tapeFsLib_ILLEGAL_TAPE_CONFIG_PARM (M_tapeFsLib | 2) +#define S_tapeFsLib_SERVICE_NOT_AVAILABLE (M_tapeFsLib | 3) +#define S_tapeFsLib_INVALID_BLOCK_SIZE (M_tapeFsLib | 4) +#define S_tapeFsLib_ILLEGAL_FILE_SYSTEM_NAME (M_tapeFsLib | 5) +#define S_tapeFsLib_ILLEGAL_FLAGS (M_tapeFsLib | 6) +#define S_tapeFsLib_FILE_DESCRIPTOR_BUSY (M_tapeFsLib | 7) +#define S_tapeFsLib_VOLUME_NOT_AVAILABLE (M_tapeFsLib | 8) +#define S_tapeFsLib_BLOCK_SIZE_MISMATCH (M_tapeFsLib | 9) +#define S_tapeFsLib_INVALID_NUMBER_OF_BYTES (M_tapeFsLib | 10) + +/* Function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern TAPE_VOL_DESC * tapeFsDevInit (char *volName, SEQ_DEV *pBlkDev, + TAPE_CONFIG *pTapeConfig); +extern STATUS tapeFsInit (); +extern STATUS tapeFsVolUnmount (TAPE_VOL_DESC *vdptr); +extern STATUS tapeFsReadyChange (TAPE_VOL_DESC *vdptr); + +#else /* __STDC__ */ + +extern TAPE_VOL_DESC * tapeFsDevInit (); +extern STATUS tapeFsInit (); +extern STATUS tapeFsVolUnmount (); +extern STATUS tapeFsReadyChange (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtapeFsLibh */ diff --git a/h/tarLib.h b/h/tarLib.h new file mode 100644 index 0000000..1256abd --- /dev/null +++ b/h/tarLib.h @@ -0,0 +1,41 @@ +/* tarLib.h - UNIX tar compatible library */ + +/* Copyright 1999-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,20sep01,jkf SPR#69031, common code for both AE & 5.x. +01b,31jul99,jkf T2 merge, tidiness & spelling. +01a,08jun98,lrn written +*/ + +#ifndef __INCtarLibh +#define __INCtarLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function prototypes */ + +#if defined(__STDC__) || defined(__cplusplus) +IMPORT void tarHelp ( void ); +IMPORT STATUS tarExtract (char * pTape, int bfactor, BOOL verbose); +IMPORT STATUS tarArchive ( char *pTape, int bfactor, BOOL verbose, char *pName); +IMPORT STATUS tarToc ( char * tape, int bfactor); +#else +IMPORT void tarHelp (); +IMPORT STATUS tarExtract (); +IMPORT STATUS tarArchive (); +IMPORT STATUS tarToc (); +#endif + +/* globals */ +IMPORT char * TAPE ; /* default archive file */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtarLibh */ diff --git a/h/taskArchLib.h b/h/taskArchLib.h new file mode 100644 index 0000000..075a9e9 --- /dev/null +++ b/h/taskArchLib.h @@ -0,0 +1,65 @@ +/* taskArchLib.h - header file for taskArchLib.c */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01l,08may03,pes PAL conditional compilation cleanup. Phase 2. +01k,11oct01,cjj removed Am29K support +01j,10dec93,hdn added support for i86. +01j,02dec93,pme added am29K family stack support. +01i,22sep92,rrr added support for c++ +01h,03jul92,jcf cleaned up. +01g,26may92,rrr the tree shuffle +01f,19mar92,yao moved ANSI prototype for taskStackAllot() to taskLib.h. +01e,12mar92,yao removed ANSI prototype for taskRegsShow(). added ANSI + prototype for taskRegsInit(), taskArgs{S,G}et(), + taskRtnValueSet(). +01d,10jan92,jwt added ANSI prototype for taskStackAllot(). +01c,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01b,05oct90,dnw deleted private functions. +01a,05oct90,shl created. +*/ + +#ifndef __INCtaskArchLibh +#define __INCtaskArchLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "taskLib.h" + +/* function declarations */ + +#if !defined _WRS_SR_SIZE +#define _WRS_SR_SIZE UINT16 +#endif + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS taskSRSet (int tid, _WRS_SR_SIZE sr); +extern void taskRegsInit (WIND_TCB *pTcb, char *pStackBase); +extern void taskArgsSet (WIND_TCB *pTcb, char *pStackBase,int pArgs[]); +extern void taskArgsGet (WIND_TCB *pTcb, char *pStackBase,int pArgs[]); +extern void taskRtnValueSet (WIND_TCB *pTcb, int returnValue); + +#else + +extern STATUS taskSRSet (); +extern void taskRegsInit (); +extern void taskArgsSet (); +extern void taskArgsGet (); +extern void taskRtnValueSet (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtaskArchLibh */ diff --git a/h/taskHookLib.h b/h/taskHookLib.h new file mode 100644 index 0000000..5895962 --- /dev/null +++ b/h/taskHookLib.h @@ -0,0 +1,71 @@ +/* taskHookLib.h - header file for taskHookLib.c */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01a,05oct90,shl created. +*/ + +#ifndef __INCtaskHookLibh +#define __INCtaskHookLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void taskHookInit (void); +extern STATUS taskCreateHookAdd (FUNCPTR createHook); +extern STATUS taskCreateHookDelete (FUNCPTR createHook); +extern STATUS taskDeleteHookAdd (FUNCPTR deleteHook); +extern STATUS taskDeleteHookDelete (FUNCPTR deleteHook); +extern STATUS taskSwapHookAdd (FUNCPTR swapHook); +extern STATUS taskSwapHookAttach (FUNCPTR swapHook,int tid,BOOL in,BOOL out); +extern STATUS taskSwapHookDelete (FUNCPTR swapHook); +extern STATUS taskSwapHookDetach (FUNCPTR swapHook,int tid,BOOL in,BOOL out); +extern STATUS taskSwitchHookAdd (FUNCPTR switchHook); +extern STATUS taskSwitchHookDelete (FUNCPTR switchHook); +extern void taskHookShowInit (void); +extern void taskCreateHookShow (void); +extern void taskDeleteHookShow (void); +extern void taskSwapHookShow (void); +extern void taskSwitchHookShow (void); + +#else /* __STDC__ */ + +extern void taskHookInit (); +extern STATUS taskCreateHookAdd (); +extern STATUS taskCreateHookDelete (); +extern STATUS taskDeleteHookAdd (); +extern STATUS taskDeleteHookDelete (); +extern STATUS taskSwapHookAdd (); +extern STATUS taskSwapHookAttach (); +extern STATUS taskSwapHookDelete (); +extern STATUS taskSwapHookDetach (); +extern STATUS taskSwitchHookAdd (); +extern STATUS taskSwitchHookDelete (); +extern void taskHookShowInit (); +extern void taskCreateHookShow (); +extern void taskDeleteHookShow (); +extern void taskSwapHookShow (); +extern void taskSwitchHookShow (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtaskHookLibh */ diff --git a/h/taskLib.h b/h/taskLib.h new file mode 100644 index 0000000..266975c --- /dev/null +++ b/h/taskLib.h @@ -0,0 +1,828 @@ +/* taskLib.h - generic kernel interface header */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +06w,09sep05,jln added _WRS_ABSOLUTE_EXTERN(_vx_qNodeToPschedInfo) +06v,30aug05,yvp Reworked VX_TASK macros to undo struct workaround. +06u,31aug05,jln added TASK_QNODE_TO_PSCHEDINFO macro +06t,25aug05,kk fix VX_TASK_INSTANTIATE macro +06s,11aug05,mmi Change pad from int --> UINT32 +06r,09aug05,mmi Add pCpuPwrMgmtPState +06q,15aug05,yvp Added include of sys/taskDefs.h. +06p,10aug05,yvp Added macros VX_TASK and VX_TASK_INITIALIZE. +06o,04aug05,yvp Added prototype for create/delete library init. +06n,02aug05,yvp Converted while(0) to while ((0)) - suppress diab warnings. +06m,01apr05,kk added kernelBaseLibP.h for IS_KERNEL_TASK, added some docs. +06l,04mar05,kk added cpuTimeInfo1, cpuTimeInfo2, pSchedInfo to TCB + fixed apigen errors (SPR# 106451) +06k,25feb05,pcs Modified prototype of fn. taskLibInit to accept distint stack + overflow and underflow sizes for both user and kernel tasks. +06j,01feb05,kk added IS_KERNEL_TASK() (SPR# 104271) +06i,26oct04,fr added taskOpenInit() routine (SPR 101491) +06h,04oct04,aeg removed #ifndef _ASMLANGUAGE around #include msgQLibP.h +06g,03oct04,kk surround include of msgQLibP.h by #ifndef _ASMLANGUAGE +06f,24sep04,dcc added accessObjId and taskVarSemId to WIND_TCB. +06e,01oct04,pcm increased the number of task create/delete hooks from 16 to 20 +06d,22sep04,pcm changed WIND_TCB field name msgPassing to msgQInfo +06c,22sep04,md moved taskSafe()/taskUnsafe() to taskLibCommon.h +06b,02sep04,aeg removed NULL pointer check from TASK_ID_VERIFY(); + changed taskInit2() to taskInitExcStk(). +06b,20jul04,tcr fix TASK_LOCK/TASK_SAFE macros for WV_INSTRUMENTATION +06a,11jun04,aeg changed definition of VX_DEALLOC_TCB (SPR #98106). +05z,15may04,hya added VX_DEALLOC_TCB. +05y,05may04,cjj removed I960 preprocessor directives +05x,30mar04,jb Renaming I80X86 pad entry to reflect new use +05w,29mar04,dcc brought back VX_TASK_OBJ_OWNER option bit. +05v,17feb04,dcc adjusted offsets in WIND_TCB and added currentCtx member. +05u,22jan04,aeg moved coprocessor related task option bit to taskLibCommon.h +04w,09dec03,dlk Restored reserved2 field for I80X86 cpu family only. +04v,02apr03,dtr Reseving TCB slot for compiler. +04u,03sep02,dtr Adding VX_SPE_TASK option. +05t,07nov03,tcr allow WV instrumentation to OBJ_VERIFY +05s,26aug03,tcr update WindView instrumentation +05r,31oct03,dcc added some members to the WIND_TCB: pEdrInfo, pCompilerData, + pDbgInfo, pShellInfo and pUTcb. Reserved 8bytes for WRAMP use. + Removed windxLock member. Adjusted offsets as a result of + OBJ_CORE expansion. +05q,30oct03,pcm implemented changes from code review +05p,20oct03,pcm added new TCB field ; replaced various + priority inheritance TCB fields with +05p,09sep03,kk change taskLibInit prototype, added excCnt to TCB, + made VX_USER_MODE = 0, added VX_DEALLOC_EXC_STACK option bit, + added taskInit2(), renamed pKStackXXX to pExcStackXXX. +05o,05sep03,dcc moved common definitions with user side to taskLibCommon.h +05n,19aug03,dbt Added PAL coprocessor support for VxSim. +05m,24jul03,kam updated offset comments for all simulators +05l,10apr03,pes PAL Coprocessor Abstraction +05k,21jul03,kk changed tcbPad[0,1] to pKStackBase and pKStackPtr +05j,08jul03,kk added VX_USER_MODE option bit for user mode task +05i,15jul03,kam rebased to Base6 integration branch +05h,23jun03,ymz added 8-byte alignment padding for MIPS. +05g,20jun03,to deleted dummyNode, move rtpId, resurrect reserved2. +05f,13may03,to added rtpId to TCB, added task option VX_TASK_OBJ_OWNER, + deleted K&R style prototypes. +05e,14apr03,to replaced activeNode with dummyNode in TCB for now +05d,14apr03,to made task name a copy in TASK_DESC instead of a pointer. +05c,20mar03,ymz moved OBJ_CORE as the first element of WIND_TCB +05b,16jan02,to added fpStatus to TCB for ARM. +05a,17apr03,dbt Added SIMLINUX support. +04z,27mar03,jmp removed unused fields from SIMNT TCB, removed SUNOS and HPPA + simulators refernces. +04y,14mar03,jmp removed windowsThreadId and windowsThread from SIMNT TCB. +04x,19nov01,aeg added td_events to TASK_DESC. +04w,09nov01,jhw Revert WDB_INFO to reside inside WIND_TCB. +04v,06nov01,gls cleaned up compilation warnings +04u,06nov01,dee fixed offsets in coldfire specific portion + for EXC_INFO and REG_SET per sh-coldfire.tcl +04t,30oct01,jhw Removed wdbInfo and wdbExitHook from WIND_TCB. + gsl Reused wdbExitHook for pPthread. +04s,22oct01,dee Mergeed from T2.1.0 ColdFire +04r,04oct01,yvp Fixed SPR69306: added member pCoprocCtx to PPC section for + Altivec support. +04q,27sep01,aeg changed comment on WIND_TCB reservedX fields. +04p,24sep01,s_l Fixed a systax error on line "UINT32 regSetPad[2]" missing ';' +04o,18sep01,aeg deleted selectSem, pad1, & pSelWakeupNode from WIND_TCB, + and added pSelContext, events, pWdbTaskInfo, & wdbExitHook; + added code barriers to TASK_LOCK and TASK_SAFE macros. +04n,01mar00,frf Added SH4 support for T2. +04m,10sep98,kab expanded WDB_INFO struct to match TOR2.x., moved pDspContext + to end of TCB, replaced spare4. +04l,22jul98,mem added pDspContext to TCB, removed spare4. Added VX_DSP_TASK. +04k,23apr97,hk added SH support. +04j,14mar01,pcs Added VX_ALTIVEC_TASK. +04i,12mar99,dbs added COM task-local storage to TCB +04h,29may98,cym added windowsContextValid flag for SIMNT. +04g,24apr98,kkk moved wdbInfo after ARM stuff in TCB. (bug created by merge) +04f,19aug97,cym added SIMNT support. +04e,28nov96,cdp added ARM support. +04d,06nov97,dbt modified WIND_TCB for new debugger scheme. Removed Am29K + family support. +04c,22jul96,jmb merged ease patch for HP Sim +04b,26may94,yao added PPC support. +04a,26may95,ms added wdbExitHook field to the TCB +03z,16may95,rrr added WDB_INFO structure to TCB. +03y,12jul95,ism added simsolaris support +03x,19mar95,dvs removed #ifdef TRON - tron no longer supported. +03w,15mar94,smb modified TASK_SAFE macro +03v,24jan94,smb added instrumentation macros +03u,10dec93,smb instrumented TASK_LOCK macro +03t,02dec93,pme added Am29K family support +03s,12nov93,hdn added support for I80X86 +03r,15oct93,cd removed junk values from MIPS TCB. +03q,16sep93,jmm added S_taskLib_ILLEGAL_PRIORITY and taskPriRangeCheck +03p,11aug93,gae vxsim hppa. +03o,20jun93,rrr vxsim. +03m,11feb93,jcf added __PROTOTYPE_5_0 for compatibility. +03l,08feb93,smb added a null check to taskIdVerify. +03k,13nov92,dnw changed declaration of pSmObjTcb to struct sm_obj_tcb * + removed include of smObjTcbP.h (SPR #1768) + moved typedef of DBG_INFO here from dbgLib.h + removed include of dbgLib.h (SPR #1768) +03j,22sep92,rrr added support for c++ +03i,21sep92,smb removed exit prototype and added include of stdlib.h +03h,02aug92,jcf changed reserved3 field to pExcRegSet for exception handling. +03g,29jul92,smb made modification for the stdio library. +03f,28jul92,jcf added windxLock/reserved[12]; moved dbgInfo/pSmTcbObj; + removed funcRestart. +03e,12jul92,yao replace pDbgState pointer with data structure DBG_INFO + in WIND_TCB. added dbgPCWSave to i960. +03d,19jul92,pme added shared memory objects support. +03c,10jul92,jwt moved padding out of REG_SET in into WIND_TCB for SPARC. +03b,06jul92,ajm removed taskSummary from forward declarations +03a,04jul92,jcf cleaned up. +02y,16jun92,yao made pDbgState available for all architectures. +02x,26may92,rrr the tree shuffle + -changed includes to have absolute path from h/ +02w,19mar92,yao added ANSI prototype for taskStackAllot(). +02v,12mar92,yao removed ifdef CPU. added taskRegsShow(). +02u,10jan92,jwt added CPU_FAMILY==SPARC architecture dependent prototypes. +02t,11nov91,rrr Added funcRestart to tcb for signals. +02s,28oct91,wmd Added changes for i960KB from Intel. +02r,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +02q,20sep91,hdn deleted foroff from WIND_TCB for TRON. + added pDbgState to WIND_TCB for TRON. +02p,20aug91,ajm made architecture independant. +02o,10jun91,del added pragma for gnu960 alignment. +02n,23may91,wmd added defines and macros for SPARC architecture. +02m,29apr91,hdn added defines and macros for TRON architecture. +02l,08apr91,jdi added NOMANUAL to prevent mangen. +02k,24mar91,del added pDbgState for use with new dbgLib. And I960 defines. +02j,16oct90,shl made #else ANSI style. +02i,05oct90,dnw deleted private functions. + made taskSpawn, taskInit, taskCreate take var args. +02h,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +02g,01oct90,jcf added addtional spares to WIND_TCB. +02f,03aug90,jcf moved arch dependent portion of WIND_TCB to end of struct +02e,13jul90,rdc added support for environment variables and additional + select functionality. +02d,30jun90,jcf added assembly language defines. +02c,26jun90,jcf removed obsolete generic status codes + changed inheritance protocol. + changed safetyQSem to a safetyQHead. + reworked priority mananagement. + changed topOfStack to endOfStack. +02b,17may90,rdc changed select semaphores in tcb to be binary semaphores. +02a,17apr90,jcf added error codes. + changed to wind 2.0. +01l,16mar90,rdc added select semaphore to tcbx. +01k,25may89,gae added VX_FORTRAN option. +01j,21apr89,jcf added KERNEL_{UNINIT,VRTX,PSOS,WIND}. +01i,07nov88,rdc added VX_ADA_DEBUG to task options. +01h,22jun88,dnw name tweaks. +01g,30may88,dnw changed to v4 names. +01f,28may88,dnw deleted obsolete status values. + added EXC_INFO to tcbx. +01e,18may88,jcf added psos semaphore head to tcbx. + extended maximum number of hooks to 10. +01d,13may88,rdc added signal info to tcbx. +01c,28apr88,ecs added IMPORTs of idle & taskName. +01b,13apr88,gae added function declarations; option bit VX_STDIO; + taskStd[] to TCB extension. +01a,25jan88,jcf written by extracting from vxLib.h v02l. +*/ + +#ifndef __INCtaskLibh +#define __INCtaskLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* kernelId for IS_KERNEL_TASK */ +#if defined (_WRS_PAL_COPROC_LIB) +#include +#endif /* _WRS_PAL_COPROC_LIB */ +#include +#include +#include + +/* miscellaneous */ + +#define MAX_TASK_ARGS 10 /* max args passed to a task */ +#define VX_MAX_TASK_SWITCH_RTNS 16 /* max task switch callout routines */ +#define VX_MAX_TASK_SWAP_RTNS 16 /* max task swap callout routines */ +#define VX_MAX_TASK_DELETE_RTNS 20 /* max task delete callout routines */ +#define VX_MAX_TASK_CREATE_RTNS 20 /* max task create callout routines */ + +/* kernel only task option bits (see taskLibCommon.h for common option bits) */ + +#define VX_UNBREAKABLE 0x0002 /* breakpoints ignored */ + +#define VX_STDIO 0x0010 /* OBSOLETE: need not be set for stdio*/ +#define VX_ADA_DEBUG 0x0020 /* 1 = VADS debugger support */ +#define VX_FORTRAN 0x0040 /* 1 = NKR FORTRAN support */ + +/* VX_PRIVATE_ENV 0x0080 defined in taskLibCommon.h */ +/* VX_NO_STACK_FILL 0x0100 defined in taskLibCommon.h */ +/* VX_TASK_NOACTIVATE 0x2000 defined in taskLibCommon.h */ +/* VX_NO_STACK_PROTECT 0x4000 defined in taskLibCommon.h */ + +/* the following are now defined in sys/taskDefs.h */ + +/* #define VX_USER_MODE 0x0000 INTERNAL: tasks in user mode */ +/* #define VX_SUPERVISOR_MODE 0x0001 INTERNAL: tasks in sup mode */ +/* #define VX_DEALLOC_STACK 0x0004 INTERNAL: deallocate stack */ +/* #define VX_TASK_OBJ_OWNER 0x0800 INTERNAL: task owns objs directly */ +/* #define VX_DEALLOC_EXC_STACK 0x1000 INTERNAL: deallocate the exc stack */ +/* #define VX_DEALLOC_TCB 0x8000 INTERNAL: deallocate the task TCB */ + +/* typedefs */ + +#ifndef _ASMLANGUAGE + +typedef struct wdb_info /* task debugging state info */ + { + int wdbState; /* debug state */ + REG_SET * wdbRegisters; /* cause of trace exception */ + struct + { + void * wdb1; + void * wdb2; + } wdbEvtList; /* dll_t of ptr to breakpoint info */ + int bpAddr; /* address of last breakpoint */ + /* encountered */ + int taskBpAddr; /* task breakpoint address */ + int taskPc; /* task program couner */ + int taskFp; /* task frame pointer */ + int taskSp; /* task stack pointer */ + VOIDFUNCPTR wdbExitHook; /* WDB notify routine on task exit */ + } WDB_INFO; + +typedef struct priInheritData + { + UINT priMutexCnt; /* 0x00: # of inv safe sems a task has */ + UINT priInheritCnt; /* 0x04: # of times task priority bumped */ + int priNormal; /* 0x08: normal running priority */ + int priDrop; /* 0x0c: priority to drop task to */ + SEMAPHORE * pPriMutex; /* 0x10: pointer to mutex task pends on */ + } PRI_INHERIT_DATA; + +/* + * ############################# WARNING ############################### + * + * The WIND_TCB structure below will be moved into the private/taskLibP.h + * header in the next major release of VxWorks. In future releases, direct + * access to fields in the WIND_TCB structure will not be supported. Please + * migrate to using the available published APIs in the task libraries + * to access fields in the TCB. + */ + +/* + * INTERNAL: When adding fields to WIND_TCB, be sure to update the + * offsets in private/taskLibP.h. + */ + +typedef struct windTcb /* WIND_TCB - task control block */ + { + OBJ_CORE objCore; /* 0x00: object management */ + + Q_NODE qNode; /* 0x40: multiway q node: rdy/pend q */ + Q_NODE tickNode; /* 0x50: multiway q node: tick q */ + + char * pExcStackBase; /* 0x60: ptr to exc stack base */ + char * pExcStackEnd; /* 0x64: ptr to exc stack end */ + char * pExcStackStart; /* 0x68: ptr to start of exc stack */ + int excCnt; /* 0x6c: exception next cnt */ + + UINT status; /* 0x70: status of task */ + UINT priority; /* 0x74: task's current priority */ + PRI_INHERIT_DATA * pPriInheritData;/* 0x78: ptr to inheritance data */ + UINT lockCnt; /* 0x7c: preemption lock count */ + + /* SH arch. requires for the previous members to be within a 0x7f offset */ + RTP_ID currentCtx; /* 0x80: task's current context */ + RTP_ID rtpId; /* 0x84: real time process ID */ + + int options; /* 0x88: task option bits */ + void * pUTcb; /* 0x8c: ptr to user level TCB */ + UINT tslice; /* 0x90: current count of time slice */ + + UINT16 swapInMask; /* 0x94: task's switch in hooks */ + UINT16 swapOutMask; /* 0x96: task's switch out hooks */ + + Q_HEAD * pPendQ; /* 0x98: q head pended on (if any) */ + + UINT safeCnt; /* 0x9c: safe-from-delete count */ + Q_HEAD safetyQHead; /* 0xa0: safe-from-delete q head */ + + FUNCPTR entry; /* 0xb0: entry point of task */ + + char * pStackBase; /* 0xb4: points to bottom of stack */ + char * pStackEnd; /* 0xb8: points to end of stack */ + void * pEdrInfo; /* 0xbc: ptr to ED&R info */ + + int errorStatus; /* 0xc0: most recent task error */ + int exitCode; /* 0xc4: error passed to exit () */ + + struct sigtcb * pSignalInfo; /* 0xc8: ptr to signal info for task */ + struct selContext * pSelectContext; /* 0xcc: ptr to select info for task */ + + UINT taskTicks; /* 0xd0: total number of ticks */ + UINT taskIncTicks; /* 0xd4: number of ticks in slice */ + + struct taskVar * pTaskVar; /* 0xd8: ptr to task variable list */ + struct rpcModList * pRPCModList; /* 0xdc: ptr to rpc module statics */ +#if defined (_WRS_PAL_COPROC_LIB) + COPROC_TBL_ENTRY * pCoprocTbl; /* 0xe0: fpoint coprocessor context */ +#else /* _WRS_PAL_COPROC_LIB */ + struct fpContext * pFpContext; /* 0xe0: fpoint coprocessor context */ +#endif /* _WRS_PAL_COPROC_LIB */ + + struct __sFILE * taskStdFp[3]; /* 0xe4: stdin,stdout,stderr fps */ + int taskStd[3]; /* 0xf0: stdin,stdout,stderr fds */ + + char ** ppEnviron; /* 0xfc: environment var table */ + int envTblSize; /* 0x100: number of slots in table */ + int nEnvVarEntries; /* 0x104: num env vars used */ + struct sm_obj_tcb * pSmObjTcb; /* 0x108: shared mem object TCB */ + void * pComLocal; /* 0x10c: COM task-local storage ptr */ + REG_SET * pExcRegSet; /* 0x110: exception regSet ptr or NULL*/ + EVENTS events; /* 0x114: event info for the task */ + + WDB_INFO * pWdbInfo; /* 0x120: ptr to WDB info -future use */ + void * pDbgInfo; /* 0x124: ptr to DBG info -future use */ + + void * pPthread; /* 0x128: ptr to pthread data structs */ + void * pCompilerData; /* 0x12c: ptr to thread and EH data */ + void * pShellInfo; /* 0x130: ptr to kernel shell info */ + MSGQ_TCB msgQInfo; /* 0x134: used for message queues */ + OBJ_ID accessObjId; /* 0x13c: objId task is accessing */ + SEM_ID taskVarSemId; /* 0x140: task variable mutex */ + + /* extensions provided for plug-in schedulers */ + + void * pSchedInfo; /* 0x144: ptr to scheduler info */ + UINT64 cpuTimeInfo[2]; /* 0x148: sched extension - CPU time */ + void * pPwrMgmtPState; /* 0x158: cpu pwr mgmt Task P-State */ + int reserved1; /* 0x15c: possible WRS extension */ + int reserved2; /* 0x160: possible WRS extension */ + int spare1; /* 0x164: possible user extension */ + int spare2; /* 0x168: possible user extension */ + int spare3; /* 0x16c: possible user extension */ + int spare4; /* 0x170: possible user extension */ + + /* ARCHITECTURE DEPENDENT */ + +#if (CPU_FAMILY==MC680X0) + EXC_INFO excInfo; /* 0x174: exception info */ + + /* REG_SET must be aligned on a 4 byte boundary */ + + REG_SET regs; /* 0x188: register set */ + UINT16 foroff; /* 0x1d0: format/offset from frame */ + UINT16 pad2; /* 0x1d2: pad format/offset to UINT */ +#endif /* CPU_FAMILY==MC680X0 */ + +#if (CPU_FAMILY==COLDFIRE) + EXC_INFO excInfo; /* 0x174: exception info */ + REG_SET regs; /* 0x188: register set */ +#endif /* CPU_FAMILY==COLDFIRE */ + +#if (CPU_FAMILY==MIPS) + + /* make excInfo on 8-byte boundary */ + UINT32 pad; /* 0x174: padding for align */ + EXC_INFO excInfo; /* 0x178: exception info */ + + /* REG_SET should be on a 8-byte boundary */ + + REG_SET regs; /* 0x198: register set */ +#endif /* CPU_FAMILY==MIPS */ + +#if (CPU_FAMILY == PPC) + EXC_INFO excInfo; /* 0x174: exception info */ + UINT pCoprocCtx; /* 0x198: pointer to Coprocessor Ctx */ + + /* REG_SET must be aligned on a 16 byte boundary */ + int pad; /* 0x19c: padding for 16 bytes align */ + REG_SET regs; /* 0x1a0: register set */ +#endif /* (CPU_FAMILY == PPC) */ + +#if (CPU_FAMILY == SPARC) + EXC_INFO excInfo; /* 0x174: exception info */ + + /* REG_SET must be aligned on an 8 byte boundary */ + + REG_SET regs; /* 0x188: register set */ +#endif /* CPU_FAMILY == SPARC */ + +#if (CPU_FAMILY==SIMSPARCSOLARIS) + EXC_INFO excInfo; /* 0x174: exception info */ + + /* REG_SET must be aligned on an 8 byte boundary */ + int pad; /* 0x194: pad for 8 bytes align */ + REG_SET regs; /* 0x198: register set */ +#endif /* CPU_FAMILY==SIMSPARCSOLARIS*/ + +#if (CPU_FAMILY==SIMNT) + EXC_INFO excInfo; /* 0x174: exception info */ + + /* REG_SET must be aligned on a 4 byte boundary */ + + REG_SET regs; /* 0x188: register set */ +#endif /* CPU_FAMILY==SIMNT */ + +#if (CPU_FAMILY==SIMLINUX) + EXC_INFO excInfo; /* 0x174: exception info */ + + /* REG_SET must be aligned on a 4 byte boundary */ + + REG_SET regs; /* 0x188: register set */ +#endif /* CPU_FAMILY==SIMLINUX */ + +#if CPU_FAMILY==I960 /* ARCHITECTURE DEPENDENT */ + EXC_INFO excInfo; /* 0x174: exception info */ + + /* REG_SET must be aligned on a 16 byte boundary */ + int pad[3]; /* 0x194: pad for 16 bytes align */ + REG_SET regs; /* 0x1a0: register set */ + UINT32 dbgPCWSave; /* 0x?: PCW saved for debugger */ +#if CPU==I960KB + UINT8 intResumptionRec[16]; +#endif +#endif /* CPU_FAMILY==I960 */ + +#if (CPU_FAMILY==I80X86) + EXC_INFO excInfo; /* 0x174: exception info */ + CTX_SET * ctxSet; /* 0x1cc: ptr to extra context */ + + /* REG_SET must be aligned on an 8 byte boundary for PENTIUM */ + REG_SET regs; /* 0x1d0: register set */ +#endif /* CPU_FAMILY==I80X86 */ + +#if (CPU_FAMILY==SH) + EXC_INFO excInfo; /* 0x174: exception info */ + + /* REG_SET must be aligned on a 4 byte boundary */ + + REG_SET regs; /* 0x188: register set */ +#endif /* CPU_FAMILY==SH */ + +#if (CPU_FAMILY==ARM) + EXC_INFO excInfo; /* 0x174: exception info */ + + UINT32 fpStatus; /* 0x184: fp status word */ + + /* REG_SET must be aligned on a 16 byte boundary */ + + UINT32 pad[2]; /* 0x188: pad to align REG_SET */ + REG_SET regs; /* 0x190: register set */ +#endif /* CPU_FAMILY==ARM */ + +#if !defined (_WRS_PAL_COPROC_LIB) + struct dspContext * pDspContext; /* dsp coprocessor context */ +#else /* _WRS_PAL_COPROC_LIB */ + void * pUnused; +#endif /* _WRS_PAL_COPROC_LIB */ + WDB_INFO wdbInfo; /* target debug info */ + } WIND_TCB; + +#if CPU_FAMILY==I960 +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/******************************************************************************* +* +* TASK_ID_VERIFY - check the validity of a task +* +* This macro verifies the existence of the specified object by comparing the +* task's classId with the expected class id. If the task does not check +* out, errno is set with the appropriate invalid id status. +* +* RETURNS: OK or ERROR if invalid task id +* +* \NOMANUAL +*/ + +#define TASK_ID_VERIFY(tid) \ + ( \ + (OBJ_VERIFY (&((WIND_TCB *)(tid))->objCore, taskClassId)) \ + ) + +/******************************************************************************* +* +* TASK_LOCK - lock preemption for calling task +* +* This macro performs the taskLock (2) routine. +* windview - this macro has been instrumented for windview. +* +* \NOMANUAL +*/ + +#ifdef WV_INSTRUMENTATION +#define TASK_LOCK() \ + do \ + { \ + WRS_ASM (""); \ + EVT_CTX_0 (EVENT_TASKLOCK); \ + taskIdCurrent->lockCnt++; \ + WRS_ASM (""); \ + } while ((0)) +#else /* WV_INSTRUMENTATION */ +#define TASK_LOCK() \ + do \ + { \ + WRS_ASM (""); \ + taskIdCurrent->lockCnt++; \ + WRS_ASM (""); \ + } while ((0)) +#endif /* WV_INSTRUMENTATION */ + +/******************************************************************************* +* +* TASK_UNLOCK - unlock preemption for calling task +* +* This macro performs the taskUnlock (2) routine. +* +* \NOMANUAL +*/ + +#define TASK_UNLOCK() \ + ( \ + taskUnlock () \ + ) + +/******************************************************************************* +* +* TASK_SAFE - guard self from deletion +* +* This macro performs the taskSafe (2) routine. +* windview - this macro has been instrumented for windview. +* +* \NOMANUAL +*/ + +#ifdef WV_INSTRUMENTATION +#define TASK_SAFE() \ + do \ + { \ + WRS_ASM (""); \ + EVT_OBJ_2 (taskIdCurrent, taskClassId, EVENT_TASKSAFE, \ + taskIdCurrent, taskIdCurrent->safeCnt); \ + taskIdCurrent->safeCnt++; \ + WRS_ASM (""); \ + } while ((0)) +#else /* WV_INSTRUMENTATION */ +#define TASK_SAFE() \ + do \ + { \ + WRS_ASM (""); \ + taskIdCurrent->safeCnt++; \ + WRS_ASM (""); \ + } while ((0)) +#endif /* WV_INSTRUMENTATION */ + +/******************************************************************************* +* +* TASK_UNSAFE - unguard self from deletion +* +* This macro performs the taskUnsafe (2) routine. +* +* \NOMANUAL +*/ + +#define TASK_UNSAFE() \ + ( \ + taskUnsafe () \ + ) + +/******************************************************************************* +* +* IS_KERNEL_TASK - determine a task is a kernel task +* +* This macro returns 1 if the specified task is a kernel task. Otherwise +* 0 or if tid == 0, return the ID of the current task. +* +* \NOMANUAL +*/ + +#define IS_KERNEL_TASK( tid ) \ + ( \ + (((tid) == 0 ? taskIdCurrent:(WIND_TCB *)(tid))->rtpId == kernelId) \ + ) + +/****************************************************************************** +* +* TASK_QNODE_TO_PSCHEDINFO - get the pSchedInfo from a task qNode +* +* This macro returns the address of "pSchedInfo" of WIND_TCB to which a "qNode" +* belongs. This macro is intended to be used by user specified schedulers, when +* the component INCLUDE_CUSTOM_SCHEDULER is configured. +* +* NOTE: This macro should NOT be used in loadable objects since the absolute +* symbols may not be resolved by the module loader. +* +* \NOMANUAL +*/ + +#define TASK_QNODE_TO_PSCHEDINFO(node) \ + ( \ + (UINT)(node) + _vx_qNodeToPSchedInfo \ + ) + +/******************************************************************************* +* +* VX_TASK - declare storage for a task +* +* This macro declares storage for a task with name with a stack size +* bytes. This macro only generates data declarations for the task. +* This macro is useful for declaring tasks statically (i.e. at compile +* time, without using any dynamic memory allocation at runtime). To fully +* initialize the task, macro VX_TASK_INITIALIZE must be called. To initialize +* and activate the task, macro VX_TASK_INSTANTIATE must be called. +* +* SEE ALSO: VX_TASK_INITIALIZE, VX_TASK_INSTANTIATE +* +* \NOMANUAL +*/ + +#define VX_TASK(name,stackSz) \ + WIND_TCB name##Tcb; \ + _WRS_DATA_ALIGN_BYTES(_STACK_ALIGN_SIZE) \ + char name##Stk [STACK_ROUND_UP((stackSz))]; \ + _WRS_DATA_ALIGN_BYTES(_STACK_ALIGN_SIZE) \ + char name##ExcStk [STACK_ROUND_UP((KERNEL_TASK_EXC_STACK_SIZE))]; + + +/******************************************************************************* +* +* VX_TASK_INITIALIZE - initialize a task declared with the VX_TASK macro +* +* This macro initializes a task declared previously with the VX_TASK macro. +* with name having a stack size of bytes. This macro only +* initializes the task and leaves it suspended. It returns a task ID for +* the initialized task on successful initialization, or NULL on failure. +* To activate (i.e. schedule) the task, function taskActivate must be called +* with the task id returned by this macro. Only then is the task functional. +* The arguments to this macro and their types are the same as those passed to +* function taskSpawn(). Please refer to the documentation for taskSpawn() for +* more details on the arguments. +* +* RETURNS: task ID on success or NULL on error. +* +* Sample usage of this macro is as follows: +* \cs +* #include +* #include +* +* VX_TASK(myTask,4096); +* int myTaskId; +* +* STATUS initializeFunction (void) +* { +* myTaskId = VX_TASK_INITIALIZE(myTask, 100, 0, 4096, pEntry, \ +* 0,1,2,3,4,5,6,7,8,9); +* +* if (myTaskId != NULL) +* { +* taskActivate (myTaskId); +* return (OK); +* } +* else +* return (ERROR); +* } +* \ce +* +* SEE ALSO: VX_TASK, VX_TASK_INSTANTIATE, taskSpawn() +* \NOMANUAL +*/ + +#define VX_TASK_INITIALIZE(name,prio,options,stackSz,entryPt,arg1,arg2,arg3, \ + arg4,arg5,arg6,arg7,arg8,arg9,arg10) \ + ((taskInitExcStk (&name##Tcb, #name, (prio), (options), \ + &name##Stk[STACK_ROUND_UP((stackSz))], \ + STACK_ROUND_UP((stackSz)), \ + &name##ExcStk \ + [STACK_ROUND_UP((KERNEL_TASK_EXC_STACK_SIZE))], \ + STACK_ROUND_UP((KERNEL_TASK_EXC_STACK_SIZE)), \ + ((FUNCPTR) (entryPt)), (arg1), (arg2), (arg3), (arg4), \ + (arg5), (arg6), (arg7), (arg8), (arg8), (arg10)) == OK) \ + ? ((int) &name##Tcb) \ + : ((int) NULL)) + + +/******************************************************************************* +* +* VX_TASK_INSTANTIATE - initialize and activate a task declared using VX_TASK +* +* This macro initializes and activates a task declared previously with the +* VX_TASK macro. The task is fully functional after the call to this macro +* if it succeeds. This macro returns a task ID for the instantiated task on +* or NULL on failure. The arguments to this macro and their types are the same +* as those passed to function taskSpawn(). Please refer to the documentation +* for taskSpawn() for more details on the arguments. +* +* RETURNS: task ID on success or ERROR. +* +* Sample usage of this macro is as follows: +* \cs +* #include +* #include +* +* VX_TASK(myTask,4096); +* int myTaskId; +* +* STATUS initializeFunction (void) +* { +* myTaskId = VX_TASK_INSTANTIATE(myTask, 100, 0, 4096, pEntry, \ +* 0,1,2,3,4,5,6,7,8,9); +* +* if (myTaskId != ERROR) +* return (OK); /@ instantiation succeeded @/ +* else +* return (ERROR); +* } +* \ce +* +* SEE ALSO: VX_TASK, VX_TASK_INITIALIZE, taskSpawn() +* \NOMANUAL +*/ + +#define VX_TASK_INSTANTIATE(name,prio,options,stackSz,entryPt,arg1,arg2,arg3, \ + arg4,arg5,arg6,arg7,arg8,arg9,arg10) \ + (((VX_TASK_INITIALIZE(name,prio,options,stackSz,entryPt,arg1,arg2,arg3, \ + arg4,arg5,arg6,arg7,arg8,arg9,arg10) == NULL) || \ + (taskActivate ((int)&name##Tcb) != OK)) \ + ? (ERROR) \ + : ((int) &name##Tcb)) + + +/* variable declarations */ + +extern CLASS_ID taskClassId; /* task class id */ +extern WIND_TCB * taskIdCurrent; /* always current executing task */ +extern BOOL taskPriRangeCheck; /* limit priorities to 0-255 */ + +/* _vx_qNodeToPSchedInfo is a private absolute symbol */ + +_WRS_ABSOLUTE_EXTERN(_vx_qNodeToPSchedInfo); + +/* function declarations */ + +extern STATUS taskLibInit (int usrDefExcStackSize, + int usrDefExcStackOverflowSize, + int kernelDefExcStackOverflowSize, + int usrDefExecStackOverflowSize, + int usrDefExecStackUnderflowSize, + int kernelDefExecStackOverflowSize, + int kernelDefExecStackUnderflowSize); +extern void taskCreateLibInit (void); +extern void taskOpenInit (void); +extern STATUS taskInit (WIND_TCB * pTcb, char * name, int priority, + int options, char * pStackBase, int stackSize, + FUNCPTR entryPt, int arg1, int arg2, int arg3, + int arg4, int arg5, int arg6, int arg7, + int arg8, int arg9, int arg10); +extern STATUS taskInitExcStk (WIND_TCB * pTcb, char * name, int priority, + int options, char * pStackBase, int stackSize, + char * pExcStackBase, int excStackSize, + FUNCPTR entryPt, int arg1, int arg2, int arg3, + int arg4, int arg5, int arg6, int arg7, + int arg8, int arg9, int arg10); +extern STATUS taskOptionsSet (int tid, int mask, int newOptions); +extern WIND_TCB * taskTcb (int tid); +extern int taskIdListGet (int idList [ ], int maxTasks); +extern STATUS taskStatusString (int tid, char * pString); +extern STATUS taskOptionsString (int tid, char * pString); +extern STATUS taskRegsGet (int tid, REG_SET * pRegs); +extern STATUS taskRegsSet (int tid, REG_SET * pRegs); +extern void taskRegsShow (int tid); +extern void * taskStackAllot (int tid, unsigned nBytes); +extern void taskShowInit (void); +extern STATUS taskShow (int tid, int level); +extern STATUS taskLock (void); +extern STATUS taskUnlock (void); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtaskLibh */ diff --git a/h/taskLibCommon.h b/h/taskLibCommon.h new file mode 100644 index 0000000..9b01f10 --- /dev/null +++ b/h/taskLibCommon.h @@ -0,0 +1,240 @@ +/* taskLibCommon.h - VxWorks tasking library common (user/kernel) definitions */ + +/* + * Copyright (c) 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. +*/ + +/* +modification history +-------------------- +01x,01apr05,kk remove old coprocessor options, now all archs PAL'ifies + coprocs +01w,28sep04,aeg added td_excStackCurrent to TASK_DESC. +01v,27sep04,tam updated VX_NO_STACK_PROTECT documentation +01u,22sep04,md added taskSafe()/taskUnsafe() prototype. +01u,03aug04,scm add hook for coprocArm.h... +01t,20may04,dcc added taskUnlink() prototype. +01s,05may04,cjj added VX_USR_TASK_OPTIONS. +01r,29apr04,h_k added SH coprocessor support. +01q,22apr04,dcc added inclusion of objLib.h +01p,25mar04,dbt Added SIMPENTIUM support. +01o,13apr04,zmm Add Pentium coprocessor. +01n,29mar04,dcc added taskClose() prototype. Moved VX_TASK_OBJ_OWNER option + bit to kernel taskLib.h +01m,29mar04,aeg updated taskOpen() function prototype. +01l,22jan04,aeg added coprocessor related task option bits. +01k,25nov03,aeg added S_taskLib_ILLEGAL_OPERATION errno; + changed taskOpen() function prototype. +01j,14nov03,kk added VX_NO_STACK_PROTECT option +01i,31oct03,aeg added taskIsPended(). +01h,10oct03,pcm added td_pExcStackStart; removed td_pStackLimit +01g,09oct03,aeg added S_taskLib_NO_TCB errno. +01f,15sep03,kk added exception stack info and RTP id +01e,12sep03,aeg added S_taskLib_ILLEGAL_OPTIONS errno. +01d,10sep03,dcc moved more function prototypes from taskLib.h +01c,09sep03,dcc added #ifndef _ASMLANGUAGE directives. +01b,05sep03,dcc added function prototypes. +01a,19aug03,aeg written based on v05b of kernel version of taskLib.h +*/ + +#ifndef __INCtaskLibCommonh +#define __INCtaskLibCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "eventLibCommon.h" +#include "objLib.h" + +/* generic status codes */ + +#define S_taskLib_NAME_NOT_FOUND (M_taskLib | 101) +#define S_taskLib_TASK_HOOK_TABLE_FULL (M_taskLib | 102) +#define S_taskLib_TASK_HOOK_NOT_FOUND (M_taskLib | 103) +#define S_taskLib_TASK_SWAP_HOOK_REFERENCED (M_taskLib | 104) +#define S_taskLib_TASK_SWAP_HOOK_SET (M_taskLib | 105) +#define S_taskLib_TASK_SWAP_HOOK_CLEAR (M_taskLib | 106) +#define S_taskLib_TASK_VAR_NOT_FOUND (M_taskLib | 107) +#define S_taskLib_TASK_UNDELAYED (M_taskLib | 108) +#define S_taskLib_ILLEGAL_PRIORITY (M_taskLib | 109) +#define S_taskLib_ILLEGAL_OPTIONS (M_taskLib | 110) +#define S_taskLib_NO_TCB (M_taskLib | 111) +#define S_taskLib_ILLEGAL_OPERATION (M_taskLib | 112) + + +/* miscellaneous */ + +#define VX_TASK_NAME_LENGTH 31 /* max length of name in TASK_DESC */ + +/* + * Task option bits. BE SURE to modify either of the + * VX_USR_TASK_OPTIONS_BASE or VX_USR_TASK_OPTIONS definitions + * below when modifying/adding individual task options. + */ + + +#define VX_PRIVATE_ENV 0x0080 /* 1 = private environment variables */ +#define VX_NO_STACK_FILL 0x0100 /* 1 = avoid stack fill of 0xee */ +#define VX_TASK_NOACTIVATE 0x2000 /* taskOpen() does not taskActivate() */ +#define VX_NO_STACK_PROTECT 0x4000 /* no over/underflow stack protection,*/ + /* stack space remains executable */ + + +/* define for all valid user task options */ + +#define VX_USR_TASK_OPTIONS_BASE (VX_PRIVATE_ENV | \ + VX_NO_STACK_FILL | \ + VX_TASK_NOACTIVATE | \ + VX_NO_STACK_PROTECT) + +/* + * All 6.0 architectures have PAL'ified the coprocessor layer by specifying + * _WRS_PAL_COPROC_LIB. The definition of the coprocessor task options + * (e.g. VX_FP_TASK, VX_DSP_TASK, VX_ALTIVEC_TASK) are now defined in + * the architecture file target/h/arch//coproc.h. + */ + +#define VX_COPROC1_TASK 0x01000000 +#define VX_COPROC2_TASK 0x02000000 +#define VX_COPROC3_TASK 0x04000000 +#define VX_COPROC4_TASK 0x08000000 +#define VX_COPROC5_TASK 0x10000000 +#define VX_COPROC6_TASK 0x20000000 +#define VX_COPROC7_TASK 0x40000000 +#define VX_COPROC8_TASK 0x80000000 + +/* define for all valid user task options */ + +#define VX_USR_TASK_OPTIONS (VX_USR_TASK_OPTIONS_BASE | \ + VX_COPROC1_TASK | \ + VX_COPROC2_TASK | \ + VX_COPROC3_TASK | \ + VX_COPROC4_TASK | \ + VX_COPROC5_TASK | \ + VX_COPROC6_TASK | \ + VX_COPROC7_TASK | \ + VX_COPROC8_TASK) + +#if (CPU_FAMILY == PPC) +#include "arch/ppc/coprocPpc.h" +#endif /* (CPU_FAMILY == PPC) */ + +#if (CPU_FAMILY == I80X86) +#include "arch/i86/coprocI86.h" +#endif /* (CPU_FAMILY == I80X86) */ + +#if (CPU_FAMILY == ARM) +#include "arch/arm/coprocArm.h" +#endif /* (CPU_FAMILY == ARM) */ + +#if (CPU_FAMILY == MIPS) +#include "arch/mips/coprocMips.h" +#endif /* (CPU_FAMILY == MIPS) */ + +#if (CPU_FAMILY == SH) +#include "arch/sh/coprocSh.h" +#endif /* (CPU_FAMILY == SH) */ + +#if (CPU_FAMILY == SIMNT) +#include "arch/simnt/coprocSimnt.h" +#endif /* (CPU_FAMILY == SIMNT) */ + +#if (CPU_FAMILY == SIMLINUX) +#include "arch/simlinux/coprocSimlinux.h" +#endif /* (CPU_FAMILY == SIMLINUX) */ + +#if (CPU_FAMILY == SIMPENTIUM) +#include "arch/simpentium/coprocSimpentium.h" +#endif /* (CPU_FAMILY == SIMPENTIUM) */ + +#if (CPU_FAMILY == SIMSPARCSOLARIS) +#include "arch/simsolaris/coprocSimsolaris.h" +#endif /* (CPU_FAMILY == SIMSPARCSOLARIS) */ + +/* typedefs */ + +#ifndef _ASMLANGUAGE + +typedef struct /* TASK_DESC - information structure */ + { + int td_id; /* task id */ + int td_priority; /* task priority */ + int td_status; /* task status */ + int td_options; /* task option bits (see below) */ + FUNCPTR td_entry; /* original entry point of task */ + char * td_sp; /* saved stack pointer */ + char * td_pStackBase; /* the bottom of the stack */ + char * td_pStackEnd; /* the actual end of the stack */ + int td_stackSize; /* size of stack in bytes */ + int td_stackCurrent;/* current stack usage in bytes */ + int td_stackHigh; /* maximum stack usage in bytes */ + int td_stackMargin; /* current stack margin in bytes */ + int td_errorStatus; /* most recent task error status */ + int td_delay; /* delay/timeout ticks */ + EVENTS_DESC td_events; /* VxWorks events information */ + char td_name [VX_TASK_NAME_LENGTH+1]; /* name of task */ + RTP_ID td_rtpId; /* RTP owning the task */ + int td_excStackSize; /* size of exception stack in bytes */ + char * td_pExcStackBase; /* exception stack base */ + char * td_pExcStackEnd; /* exception stack end */ + char * td_pExcStackStart;/* exception stack start */ + int td_excStackHigh; /* exception stack max usage */ + int td_excStackMargin;/* exception stack margin */ + int td_excStackCurrent;/* current exc stack usage (bytes) */ + } TASK_DESC; + +/* function declarations */ + +extern int taskSpawn (char * name, int priority, int options, + int stackSize, FUNCPTR entryPt, int arg1, + int arg2, int arg3, int arg4, int arg5, + int arg6, int arg7, int arg8, int arg9, + int arg10); +extern int taskCreate (char * name, int priority, int options, + int stackSize, FUNCPTR entryPt, int arg1, + int arg2, int arg3, int arg4, int arg5, + int arg6, int arg7, int arg8, int arg9, + int arg10); +extern STATUS taskActivate (int tid); +extern STATUS taskDelete (int tid); +extern STATUS taskDeleteForce (int tid); +extern STATUS taskSuspend (int tid); +extern STATUS taskResume (int tid); +extern STATUS taskRestart (int tid); +extern STATUS taskPrioritySet (int tid, int newPriority); +extern STATUS taskPriorityGet (int tid, int * pPriority); +extern char * taskName (int tid); +extern int taskNameToId (char * name); +extern STATUS taskIdVerify (int tid); +extern int taskIdSelf (void); +extern int taskIdDefault (int tid); +extern BOOL taskIsReady (int tid); +extern BOOL taskIsSuspended (int tid); +extern BOOL taskIsPended (int tid); +extern STATUS taskInfoGet (int tid, TASK_DESC * pTaskDesc); +extern STATUS taskOptionsGet (int tid, int * pOptions); +extern STATUS taskDelay (int ticks); +extern int taskOpen (const char * name, int priority, int options, + int mode, char * pStackBase, int stackSize, + void * context, FUNCPTR entryPt, int arg1, + int arg2, int arg3, int arg4, int arg5, + int arg6, int arg7, int arg8, int arg9, + int arg10); +extern STATUS taskClose (int tid); +extern STATUS taskUnlink (const char * name); +extern STATUS taskSafe (void); +extern STATUS taskUnsafe (void); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtaskLibCommonh */ diff --git a/h/taskUtilLib.h b/h/taskUtilLib.h new file mode 100644 index 0000000..da52c6c --- /dev/null +++ b/h/taskUtilLib.h @@ -0,0 +1,81 @@ +/* taskUtilLib.h - kernel utility interface header */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01c,10oct05,kk fix TASK_SCHED_INFO_SET macro +01b,31aug05,gls updated for checkin +01a,04mar05,kk written +*/ + +#ifndef __INCtaskUtilLibh +#define __INCtaskUtilLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* typdef */ + +typedef UINT32 SPARE_NUM; /* allotted number for TCB spare field */ + +/* defines */ + +/******************************************************************************* +* +* TASK_SCHED_INFO_GET - get the pSchedInfo field in the TCB +* +* This macro gets the value of the pSchedInfo field in the TCB. +* +* PROTOTYPE: void * TASK_SCHED_INFO_GET(int tid) +* +* RETURNS: N/A +* +* \NOMANUAL +*/ + +#define TASK_SCHED_INFO_GET(tid) \ + ( \ + ((WIND_TCB *)(tid))->pSchedInfo \ + ) + +/******************************************************************************* +* +* TASK_SCHED_INFO_SET - set the pSchedInfo field in the TCB +* +* This macro sets the value of the pSchedInfo field in the TCB. +* +* PROTOTYPE: void TASK_SCHED_INFO_SET(int tid, void * schedInfo) +* +* RETURNS: N/A +* +* \NOMANUAL +*/ + +#define TASK_SCHED_INFO_SET(tid, schedInfo) \ + ( \ + ((WIND_TCB *)(tid))->pSchedInfo = (void *) schedInfo \ + ) + +/* function declarations */ + +extern void taskSpareNumAllot (int tid, SPARE_NUM * numAllotted); +extern int taskSpareFieldGet (int tid, SPARE_NUM num); +extern STATUS taskSpareFieldSet (int tid, SPARE_NUM num, int value); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtaskUtilLibh */ diff --git a/h/taskVarLib.h b/h/taskVarLib.h new file mode 100644 index 0000000..7d2a0ca --- /dev/null +++ b/h/taskVarLib.h @@ -0,0 +1,65 @@ +/* taskVarLib.h - header for task variables */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01f,26may92,rrr the tree shuffle +01e,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01d,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01c,08aug90,shl added INCtaskVarLibh to #endif. +01b,01aug90,jcf cleanup. +01a,25jan88,jcf written by extracting from vxLib.h v02l. +*/ + +#ifndef __INCtaskVarLibh +#define __INCtaskVarLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* task variable descriptor */ + +typedef struct taskVar /* TASK_VAR */ + { + struct taskVar * next; /* ptr to next task variable */ + int * address;/* address of variable to swap */ + int value; /* when task is not running: save of task's val; + * when task is running: save of orig. val */ + } TASK_VAR; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS taskVarAdd (int tid, int *pVar); +extern STATUS taskVarDelete (int tid, int *pVar); +extern STATUS taskVarInit (void); +extern STATUS taskVarSet (int tid, int *pVar, int value); +extern int taskVarGet (int tid, int *pVar); +extern int taskVarInfo (int tid, TASK_VAR varList [], int maxVars); + +#else /* __STDC__ */ + +extern STATUS taskVarAdd (); +extern STATUS taskVarDelete (); +extern STATUS taskVarInit (); +extern STATUS taskVarSet (); +extern int taskVarGet (); +extern int taskVarInfo (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtaskVarLibh */ diff --git a/h/taskWaitShow.h b/h/taskWaitShow.h new file mode 100644 index 0000000..85880ec --- /dev/null +++ b/h/taskWaitShow.h @@ -0,0 +1,24 @@ +/* taskWaitShow.h - header file for taskWaitShow routines */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,07sep04,bpn Written. +*/ + +#ifndef __INCtaskWaitShowh +#define __INCtaskWaitShowh + +#ifdef __cplusplus +extern "C" { +#endif + +extern STATUS taskWaitShow (int taskId, int level); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtaskWaitShowh */ diff --git a/h/telnetLib.h b/h/telnetLib.h new file mode 100644 index 0000000..adb39fa --- /dev/null +++ b/h/telnetLib.h @@ -0,0 +1,163 @@ +/* telnetLib.h - telnet library header */ + +/* Copyright 1984 - 2002 Wind River Systems, Inc. */ + +/* +modification history +------------------- +02d,30apr02,elr Changed session data structure to include all allocated + resources for reliable cleanup during logout +02c,14feb01,spm merged from version 02c of tor2_0_x branch (base 02b): + general overhaul of telnet server (SPR #28675) +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01e,26may92,rrr the tree shuffle +01d,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01c,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01b,08aug90,shl added INCtelnetLibh to #endif. +01a,10oct86,dnw written +*/ + +#ifndef __INCtelnetLibh +#define __INCtelnetLibh + +#include "lstLib.h" +#include "semLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if CPU_FAMILY==I960 +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +#define PTY_DEVICE_NAME_MAX_LEN 128 /* The maximum string length of a pty device */ + +typedef struct + { + NODE node; /* for link-listing */ + char ptyRemoteName[PTY_DEVICE_NAME_MAX_LEN]; /* name of the pty for this session */ + int socket; /* socket connection */ + int inputFd; /* input to command interpreter */ + int outputFd; /* output to command interpreter */ + int slaveFd; /* command interpreter side fd of pty */ + int outputTask; /* Task ID to send data to socket */ + int inputTask; /* Task ID to send data to socket */ + FUNCPTR parserControl; /* source of input/output files */ + SEM_ID startInput; /* begin reading from socket connection */ + SEM_ID startOutput; /* begin writing to socket connection */ + BOOL busyFlag; /* input/output tasks in use? */ + BOOL loggedIn; /* Has a shell been started on this slot? */ + UINT32 userData; /* A storage for application developers */ + int shellTaskId; /* Task ID of the shell associated with this session */ + } TELNETD_SESSION_DATA; + +typedef struct + { + TELNETD_SESSION_DATA *pSession; /* link to session data for tasks */ + } TELNETD_TASK_DATA; + +#if CPU_FAMILY==I960 +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* command interpreter control operations */ + +#define REMOTE_START 0 +#define REMOTE_STOP 1 +#define REMOTE_INIT 2 + +/* Definitions for the TELNET protocol. */ + +#define IAC 255 /* interpret as command: */ +#define DONT 254 /* you are not to use option */ +#define DO 253 /* please, you use option */ +#define WONT 252 /* I won't use option */ +#define WILL 251 /* I will use option */ +#define SB 250 /* interpret as subnegotiation */ +#define GA 249 /* you may reverse the line */ +#define EL 248 /* erase the current line */ +#define EC 247 /* erase the current character */ +#define AYT 246 /* are you there */ +#define AO 245 /* abort output--but let prog finish */ +#define IP 244 /* interrupt process--permanently */ +#define BREAK 243 /* break */ +#define DM 242 /* data mark--for connect. cleaning */ +#define NOP 241 /* nop */ +#define SE 240 /* end sub negotiation */ +#define EOR 239 /* end of record (transparent mode) */ + +#define SYNCH 242 /* for telfunc calls */ + + +/* telnet options */ + +#define TELOPT_BINARY 0 /* 8-bit data path */ +#define TELOPT_ECHO 1 /* echo */ +#define TELOPT_RCP 2 /* prepare to reconnect */ +#define TELOPT_SGA 3 /* suppress go ahead */ +#define TELOPT_NAMS 4 /* approximate message size */ +#define TELOPT_STATUS 5 /* give status */ +#define TELOPT_TM 6 /* timing mark */ +#define TELOPT_RCTE 7 /* remote controlled transmission and echo */ +#define TELOPT_NAOL 8 /* negotiate about output line width */ +#define TELOPT_NAOP 9 /* negotiate about output page size */ +#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ +#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ +#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ +#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ +#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ +#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ +#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ +#define TELOPT_XASCII 17 /* extended ascic character set */ +#define TELOPT_LOGOUT 18 /* force logout */ +#define TELOPT_BM 19 /* byte macro */ +#define TELOPT_DET 20 /* data entry terminal */ +#define TELOPT_SUPDUP 21 /* supdup protocol */ +#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ +#define TELOPT_SNDLOC 23 /* send location */ +#define TELOPT_TTYPE 24 /* terminal type */ +#define TELOPT_EOR 25 /* end or record */ +#define TELOPT_EXOPL 255 /* extended-options-list */ + +/* sub-option qualifiers */ + +#define TELQUAL_IS 0 /* option is... */ +#define TELQUAL_SEND 1 /* send option */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void telnetInTask (TELNETD_SESSION_DATA *pSlot); +extern STATUS telnetdInit (int numClients, BOOL staticFlag); +extern STATUS telnetdStart (int port); +extern void telnetOutTask (TELNETD_SESSION_DATA *pSlot); +extern STATUS telnetdParserSet (FUNCPTR pParserCtrlRtn); +extern void telnetd (void); +extern void telnetdExit (UINT32 sessionId); +extern BOOL telnetdStaticTaskInitializationGet(); + +#else /* __STDC__ */ + +extern void telnetInTask (); +extern STATUS telnetInit (); +extern void telnetOutTask (); +extern STATUS telnetdParserSet (); +extern void telnetd (); +extern void telnetdExit (); +extern BOOL telnetdStaticTaskInitializationGet(); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtelnetLibh */ diff --git a/h/tffs/backgrnd.h b/h/tffs/backgrnd.h new file mode 100644 index 0000000..3bebffb --- /dev/null +++ b/h/tffs/backgrnd.h @@ -0,0 +1,46 @@ +/* backgrnd.h - True Flash File System */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* FAT-FTL Lite Software Development Kit + * Copyright (C) M-Systems Ltd. 1995-1997 */ + +/* +modification history +-------------------- +01a,29jul04,alr modified file header, restarted history +*/ + +#ifndef BACKGRND_H +#define BACKGRND_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "flsocket.h" + +#define BG_RESUME 1 +#define BG_SUSPEND 2 + +#ifdef BACKGROUND + +extern int flForeground(int sendValue); +extern int flBackground(int sendValue); +extern int flStartBackground(unsigned volNo, void (*routine)(void *), void *object); +extern void flCreateBackground(void); + +#else + +#define flForeground(n) BG_RESUME +#define flBackground(n) + +#endif + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/h/tffs/dosformt.h b/h/tffs/dosformt.h new file mode 100644 index 0000000..95a9a31 --- /dev/null +++ b/h/tffs/dosformt.h @@ -0,0 +1,227 @@ +/* dosformt.h - True Flash File System */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* FAT-FTL Lite Software Development Kit + * Copyright (C) M-Systems Ltd. 1995-1997 */ + +/* +modification history +-------------------- +01a,29jul04,alr modified file header, restarted history +*/ + +#ifndef DOSFORMT_H +#define DOSFORMT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "flbase.h" + +/* The BIOS parameter block (a part of the boot sector) */ +/* Note that this is NOT the customary definition of the BPB */ +/* (customary is to start it on 'bytesPerSector'). To avoid the */ +/* nuisance of a structure that starts at an odd offset, we add */ +/* the first 11 bytes of the boot sector here. */ +typedef struct { + unsigned char jumpInstruction[3]; + char OEMname[8]; + Unaligned bytesPerSector; + unsigned char sectorsPerCluster; + LEushort reservedSectors; + unsigned char noOfFATS; + Unaligned rootDirectoryEntries; + Unaligned totalSectorsInVolumeDOS3; + unsigned char mediaDescriptor; + LEushort sectorsPerFAT; + LEushort sectorsPerTrack; + LEushort noOfHeads; + LEulong noOfHiddenSectors; + LEulong totalSectorsInVolume; +} BPB; + + +typedef struct { + BPB bpb; + unsigned char physicalDriveNo; + char reserved0; + char extendedBootSignature; + char volumeId[4]; + char volumeLabel[11]; + char systemId[8]; + char bootstrap[448]; + LEushort signature; +} DOSBootSector; + + +typedef struct { + char name[11]; + unsigned char attributes; /* mapped below */ + unsigned char reserved[10]; + LEushort updateTime; + /* The date field is encoded as follows: */ + /* bit 0-4: Day of month (1-31) */ + /* bit 5-8: Month (1-12) */ + /* bit 9-15: Year relative to 1980 */ + LEushort updateDate; + /* The DOS time field is encoded as follows: */ + /* bit 0-4: seconds divided by 2 (0-29) */ + /* bit 5-10: minutes (0-59) */ + /* bit 11-15: hours (0-23) */ + LEushort startingCluster; + LEulong fileSize; +} DirectoryEntry; + + +/* Directory entry attribute bits */ + +#define ATTR_READ_ONLY 1 +#define ATTR_HIDDEN 2 +#define ATTR_SYSTEM 4 +#define ATTR_VOL_LABEL 8 +#define ATTR_DIRECTORY 0x10 +#define ATTR_ARCHIVE 0x20 + +#define DIRECTORY_ENTRY_SIZE sizeof(DirectoryEntry) + +#define DIRECTORY_ENTRIES_PER_SECTOR (SECTOR_SIZE / DIRECTORY_ENTRY_SIZE) + +#define NEVER_USED_DIR_ENTRY 0 +#define DELETED_DIR_ENTRY ((char) 0xe5) + + +/* FAT definitions */ + +#define FAT_FREE 0 +#define FAT_BAD_CLUSTER 0xfff7 +#define FAT_LAST_CLUSTER 0xffff /* actually any of 0xfff8-0xffff */ + + +/* Partition table definitions */ + +#define PARTITION_SIGNATURE 0xaa55 + +#define CYLINDER_SECTOR(cylinder,sector) \ + ((sector) + ((cylinder & 0xff) << 8) + ((cylinder & 0x300) >> 2)) + +typedef struct { + char reserved[0x1be]; + /* First partition entry starts here. We do not map it as a */ + /* separate structure because it is not longword aligned */ + unsigned char activeFlag; /* 80h = bootable */ + unsigned char startingHead; + LEushort startingCylinderSector; + char type; + unsigned char endingHead; + LEushort endingCylinderSector; + Unaligned4 startingSectorOfPartition; + Unaligned4 sectorsInPartition; + /* Partition entries 2,3 and 4 are structured as the 1st partition */ + char partition23and4[0x30]; + LEushort signature; /* = PARTITION_SIGNATURE */ +} PartitionTable; + + +#ifdef FORMAT_VOLUME + +/* Formatting parameter structure definition */ + +typedef struct { + /* FTL formatting section */ + long int bootImageLen; + /* Space to reserve for a boot-image at the start of the + medium. The FLite volume will begin at the next higher + erase unit boundary */ + + unsigned percentUse; + /* FTL performance depends on how full the Flash media is, + getting slower when the media is close to 100%. It is + possible to avoid the worst consequences of this effect by + formatting the media to less than 100% capacity, so + guaranteeing some free space at all times. This of course + sacrifices some capcity. + The standard value to use is 99 */ + + unsigned noOfSpareUnits; + /* FTL needs at least one spare erase unit to function as a + read/write media (it is possible to specify 0 to achieve + WORM functionality). It is possible to specify more than + one spare unit, which costs more media space. + The advantage to doing this is in case one of the Flash + erase units becomes bad and unerasable in the future, one + of the spare units will need to replace it. A second spare + unit will then enable to continue read/write functionality + (in its absence, the media will go into read-only mode). + The standard value to use is 1 */ + + unsigned long vmAddressingLimit; + /* A part of the FTL Virtual Map always resides in RAM. The + RAM part is the one that is used to address the part of + the media below the VM addressing limit. Reading and + writing to this part is usually faster to some degree. + The downside is that the bigger the limit, the more RAM + size is required. + To get the extra RAM requirement in bytes, divide the + limit by 128 or by 256, depending on whether you + specified in #2.9 more than 32 or not, respectively. + The minimum VM limit is 0. + The standard value to use is 0x10000 (first 64 KBytes) */ + + FLStatus (*progressCallback)(int totalUnitsToFormat, + int totalUnitsFormattedSoFar); + /* Progress callback routine, will be called if not NULL. + The callback routine is called after erasing each unit, + and its parameters are the total number of erase units + to format and the number erased so far. + The callback routine returns a Status value. A value of + OK (0) allows formatting to continue. Any other value + will abort the formatting with the returned status code. */ + + /* DOS formatting section */ + char volumeId[4]; + /* Volume identification number */ + + char FAR1 * volumeLabel; + /* Volume label string. If NULL, no label */ + + unsigned noOfFATcopies; + /* It is customary to format DOS media with 2 FAT copies. + The first copy is always used, but more copies make it + possible to recover if the FAT becomes corrupted (a + rare occurrence). On the other hand, this slows down + performance and uses media space. + The standard value to use is 2 */ + + unsigned embeddedCISlength; + /* Length in bytes of CIS to embed after the unit header */ + + char FAR1 * embeddedCIS; + /* The unit header is structured as a beginning of a PCMCIA + 'tuple' chain (a CIS). The unit header contains a + data-organization tuple, which points past the end of the + unit header to a location which usually just contains + hex FF's which mark an 'end-of-tuple-chain'. Optionally, + it is possible to embed an entire CIS chain at this + location. If so, 'embeddedCISlength' marks the length in + bytes */ + +} FormatParams; + +/* Standard initializer for FormatParams structure */ +#define STD_FORMAT_PARAMS {0, 99, 1, 0x10000l, NULL, {0,0,0,0}, NULL, 2, 0, NULL} + +#include "fltl.h" + +extern FLStatus flDosFormat(TL *, FormatParams FAR1 *formatParams); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/h/tffs/fatlite.h b/h/tffs/fatlite.h new file mode 100644 index 0000000..3159206 --- /dev/null +++ b/h/tffs/fatlite.h @@ -0,0 +1,878 @@ +/* fatlite.h - True Flash File System */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* FAT-FTL Lite Software Development Kit + * Copyright (C) M-Systems Ltd. 1995-1997 */ + +/* +modification history +-------------------- +01a,29jul04,alr modified file header, restarted history +*/ + +#ifndef FATLITE_H +#define FATLITE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "flbase.h" +#include "dosformt.h" + +typedef unsigned FLHandle; /* Handle of an open file or drive. */ + /* Actually an index to file table or */ + /* drive table. */ + + +/*----------------------------------------------------------------------*/ +/* P a t h - N a m e s */ +/* */ +/* A path-name is represented as an array of SimplePath records. */ +/* Each SimplePath record holds a directory or file name segment, with */ +/* the full 8.3 (spaces not compressed) name. */ +/* */ +/* Path-names always start at the root directory. There is no current */ +/* directory. The directories pointers '.' and '..' can be specified */ +/* as the 'name' part of the path-segment, except at the root-directory.*/ +/* */ +/* Lower-case letters are different from upper-case. To be compatible */ +/* with DOS, file-names should be upper-case. File names may contain */ +/* any character, but files starting with hex E5 are considered deleted */ +/* according to DOS convention. */ +/* */ +/* A null (hex 0) in the first byte of the name field denotes that the */ +/* path ends here. */ +/* */ +/* Note that paths can be specified as strings: For example: */ +/* */ +/* "UTIL FATLITE H " ===> "\UTIL\FATLITE.H". */ +/* "" ===> "\" (root directory) */ +/* "AUTOEXECBAT" ===> "\AUTOEXEC.BAT" */ +/* "UTIL .. " ===> "\UTIL\.." (root directory) */ +/* */ +/* The optional service flParsePath may be used to convert regular */ +/* string paths to this format. */ +/*----------------------------------------------------------------------*/ + +typedef struct { + char name[8]; /* name part of path segment */ + /* A hex 0 in 1st character indicates end of path */ + char ext[3]; /* extension part of path segment */ +} FLSimplePath; + + +/*----------------------------------------------------------------------*/ +/* I O r e q */ +/* */ +/* IOreq is a common structure passed to all file-system functions. */ +/* Refer to the description of individual functions for specific usage */ +/* of fields. Some fields have different names when used by different */ +/* functions, hence the use of unions. */ +/* */ +/*----------------------------------------------------------------------*/ + +typedef struct { + FLHandle irHandle; /* Handle of file or drive for operation*/ + unsigned irFlags; /* function-specific flags */ + FLSimplePath FAR1 * irPath; /* path of file for operation */ + void FAR1 * irData; /* Pointer to user-buffer for operation */ + long irLength; /* No. of bytes, size or position for */ + /* operation */ +} IOreq; + +/* definiftions for absolute read & write */ +#define irSectorCount irFlags +#define irSectorNo irLength + +/* definitions for physical read & write */ +#define irByteCount irFlags +#define irAddress irLength + +/* definitions for physical erase */ +#define irUnitCount irFlags +#define irUnitNo irLength + +/*----------------------------------------------------------------------*/ +/* f l C a l l */ +/* */ +/* Common entry-point to all file-system functions. Macros are */ +/* to call individual function, which are separately described below. */ +/* */ +/* Parameters: */ +/* function : file-system function code (listed below) */ +/* ioreq : IOreq structure */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/*----------------------------------------------------------------------*/ + +typedef enum {FL_MOUNT_VOLUME, + FL_DISMOUNT_VOLUME, + FL_CHECK_VOLUME, + FL_OPEN_FILE, + FL_CLOSE_FILE, + FL_READ_FILE, + FL_WRITE_FILE, + FL_SEEK_FILE, + FL_FIND_FILE, + FL_FIND_FIRST_FILE, + FL_FIND_NEXT_FILE, + FL_GET_DISK_INFO, + FL_DELETE_FILE, + FL_RENAME_FILE, + FL_DEFRAGMENT_VOLUME, + FL_FORMAT_VOLUME, + FL_MAKE_DIR, + FL_REMOVE_DIR, + FL_ABS_READ, + FL_ABS_WRITE, + FL_ABS_DELETE, + FL_GET_BPB, + FL_SPLIT_FILE, + FL_JOIN_FILE, + FL_GET_PHYSICAL_INFO, + FL_PHYSICAL_READ, + FL_PHYSICAL_WRITE, + FL_PHYSICAL_ERASE, + FL_DONT_MONITOR_FAT} FLFunctionNo; + + +FLStatus flCall(FLFunctionNo functionNo, IOreq FAR2 *ioreq); + + +/*----------------------------------------------------------------------*/ +/* f l M o u n t V o l u m e */ +/* */ +/* Mounts, verifies or dismounts the Flash medium. */ +/* */ +/* In case the inserted volume has changed, or on the first access to */ +/* the file system, it should be mounted before file operations can be */ +/* done on it. */ +/* Mounting a volume has the effect of discarding all open files (the */ +/* files cannot be properly closed since the original volume is gone), */ +/* and turning off the media-change indication to allow file processing */ +/* calls. */ +/* */ +/* The volume automatically becomes unmounted if it is removed or */ +/* changed. */ +/* */ +/* Parameters: */ +/* irHandle : Drive number (0, 1, ...) */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/*----------------------------------------------------------------------*/ + +#define flMountVolume(ioreq) flCall(FL_MOUNT_VOLUME,ioreq) + + +/*----------------------------------------------------------------------*/ +/* f l D i s m o u n t V o l u m e */ +/* */ +/* Dismounts the volume, closing all files. */ +/* This call is not normally necessary, unless it is known the volume */ +/* will soon be removed. */ +/* */ +/* Parameters: */ +/* irHandle : Drive number (0, 1, ...) */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/*----------------------------------------------------------------------*/ + +#define flDismountVolume(ioreq) flCall(FL_DISMOUNT_VOLUME,ioreq) + + +/*----------------------------------------------------------------------*/ +/* f l C h e c k V o l u m e */ +/* */ +/* Verifies that the current volume is mounted. */ +/* */ +/* Parameters: */ +/* irHandle : Drive number (0, 1, ...) */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/*----------------------------------------------------------------------*/ + +#define flCheckVolume(ioreq) flCall(FL_CHECK_VOLUME,ioreq) + + +#ifdef DEFRAGMENT_VOLUME + +/*----------------------------------------------------------------------*/ +/* f l D e f r a g m e n t V o l u m e */ +/* */ +/* Performs a general defragmentation and recycling of non-writable */ +/* Flash areas, to achieve optimal write speed. */ +/* */ +/* NOTE: The required number of sectors (in irLength) may be changed */ +/* (from another execution thread) while defragmentation is active. In */ +/* particular, the defragmentation may be cut short after it began by */ +/* modifying the irLength field to 0. */ +/* */ +/* Parameters: */ +/* irHandle : Drive number (0, 1, ...) */ +/* irLength : Minimum number of sectors to make available */ +/* for writes. */ +/* */ +/* Returns: */ +/* irLength : Actual number of sectors available for writes */ +/* FLStatus : 0 on success, otherwise failed */ +/*----------------------------------------------------------------------*/ + +#define flDefragmentVolume(ioreq) flCall(FL_DEFRAGMENT_VOLUME,ioreq) + +#endif /* DEFRAGMENT_VOLUME */ + + +#ifdef FORMAT_VOLUME + +/*----------------------------------------------------------------------*/ +/* f l F o r m a t V o l u m e */ +/* */ +/* Formats a volume, writing a new and empty file-system. All existing */ +/* data is destroyed. Optionally, a low-level FTL formatting is also */ +/* done. */ +/* Formatting leaves the volume in the dismounted state, so that a */ +/* flMountVolume call is necessary after it. */ +/* */ +/* Parameters: */ +/* irHandle : Drive number (0, 1, ...) */ +/* irFlags : NO_FTL_FORMAT: Do FAT formatting only */ +/* FTL_FORMAT: Do FTL & FAT formatting */ +/* FTL_FORMAT_IF_NEEDED: Do FTL formatting only */ +/* if current format is invalid */ +/* irData : Address of FormatParams structure to use */ +/* (defined in dosformt.h) */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/*----------------------------------------------------------------------*/ + +/** Values of irFlags for flFormatVolume: */ + +#define NO_FTL_FORMAT 0 /* FAT formatting only */ +#define FTL_FORMAT 1 /* FAT & FTL formatting */ +#define FTL_FORMAT_IF_NEEDED 2 /* FAT formatting & FTL formatting if necessary */ +#define PROGRESS_REPORT /* Format progress is reported via callback */ + +#define flFormatVolume(ioreq) flCall(FL_FORMAT_VOLUME,ioreq) + +#endif /* FORMAT_VOLUME */ + + +#if FILES > 0 + +/*----------------------------------------------------------------------*/ +/* f l O p e n F i l e */ +/* */ +/* Opens an existing file or creates a new file. Creates a file handle */ +/* for further file processing. */ +/* */ +/* Parameters: */ +/* irHandle : Drive number (0, 1, ...) */ +/* irFlags : Access and action options, defined below */ +/* irPath : path of file to open */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/* irHandle : New file handle for open file */ +/* */ +/*----------------------------------------------------------------------*/ + +/** Values of irFlags for flOpenFile: */ + +#define ACCESS_MODE_MASK 3 /* Mask for access mode bits */ + +/* Individual flags */ + +#define ACCESS_READ_WRITE 1 /* Allow read and write */ +#define ACCESS_CREATE 2 /* Create new file */ + +/* Access mode combinations */ +#define OPEN_FOR_READ 0 /* open existing file for read-only */ +#define OPEN_FOR_UPDATE 1 /* open existing file for read/write access */ +#define OPEN_FOR_WRITE 3 /* create a new file, even if it exists */ + + +#define flOpenFile(ioreq) flCall(FL_OPEN_FILE,ioreq) + + +/*----------------------------------------------------------------------*/ +/* f l C l o s e F i l e */ +/* */ +/* Closes an open file, records file size and dates in directory and */ +/* releases file handle. */ +/* */ +/* Parameters: */ +/* irHandle : Handle of file to close. */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/*----------------------------------------------------------------------*/ + +#define flCloseFile(ioreq) flCall(FL_CLOSE_FILE,ioreq) + + +#ifdef SPLIT_JOIN_FILE + +/*------------------------------------------------------------------------*/ +/* f l S p l i t F i l e */ +/* */ +/* Splits the file into two files. The original file contains the first */ +/* part, and a new file (which is created for that purpose) contains */ +/* the second part. If the current position is on a cluster */ +/* boundary, the file will be split at the current position. Otherwise, */ +/* the cluster of the current position is duplicated, one copy is the */ +/* first cluster of the new file, and the other is the last cluster of the*/ +/* original file, which now ends at the current position. */ +/* */ +/* Parameters: */ +/* file : file to split. */ +/* irPath : Path name of the new file. */ +/* */ +/* Returns: */ +/* irHandle : handle of the new file. */ +/* FLStatus : 0 on success, otherwise failed. */ +/* */ +/*------------------------------------------------------------------------*/ + +#define flSplitFile(ioreq) flCall(FL_SPLIT_FILE,ioreq) + + +/*------------------------------------------------------------------------*/ +/* f l J o i n F i l e */ +/* */ +/* joins two files. If the end of the first file is on a cluster */ +/* boundary, the files will be joined there. Otherwise, the data in */ +/* the second file from the beginning until the offset that is equal to */ +/* the offset in cluster of the end of the first file will be lost. The */ +/* rest of the second file will be joined to the first file at the end of */ +/* the first file. On exit, the first file is the expanded file and the */ +/* second file is deleted. */ +/* Note: The second file will be open by this function, it is advised to */ +/* close it before calling this function in order to avoid */ +/* inconsistencies. */ +/* */ +/* Parameters: */ +/* file : file to join to. */ +/* irPath : Path name of the file to be joined. */ +/* */ +/* Return: */ +/* FLStatus : 0 on success, otherwise failed. */ +/* */ +/*------------------------------------------------------------------------*/ + +#define flJoinFile(ioreq) flCall(FL_JOIN_FILE,ioreq) + +#endif /* SPLIT_JOIN_FILE */ + +/*----------------------------------------------------------------------*/ +/* f l R e a d F i l e */ +/* */ +/* Reads from the current position in the file to the user-buffer. */ +/* Parameters: */ +/* irHandle : Handle of file to read. */ +/* irData : Address of user buffer */ +/* irLength : Number of bytes to read. If the read extends */ +/* beyond the end-of-file, the read is truncated */ +/* at the end-of-file. */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/* irLength : Actual number of bytes read */ +/*----------------------------------------------------------------------*/ + +#define flReadFile(ioreq) flCall(FL_READ_FILE,ioreq) + + +/*----------------------------------------------------------------------*/ +/* f l W r i t e F i l e */ +/* */ +/* Writes from the current position in the file from the user-buffer. */ +/* */ +/* Parameters: */ +/* irHandle : Handle of file to write. */ +/* irData : Address of user buffer */ +/* irLength : Number of bytes to write. */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/* irLength : Actual number of bytes written */ +/*----------------------------------------------------------------------*/ + +#define flWriteFile(ioreq) flCall(FL_WRITE_FILE,ioreq) + + +/*----------------------------------------------------------------------*/ +/* f l S e e k F i l e */ +/* */ +/* Sets the current position in the file, relative to file start, end or*/ +/* current position. */ +/* Note: This function will not move the file pointer beyond the */ +/* beginning or end of file, so the actual file position may be */ +/* different from the required. The actual position is indicated on */ +/* return. */ +/* */ +/* Parameters: */ +/* irHandle : File handle to close. */ +/* irLength : Offset to set position. */ +/* irFlags : Method code */ +/* SEEK_START: absolute offset from start of file */ +/* SEEK_CURR: signed offset from current position */ +/* SEEK_END: signed offset from end of file */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/* irLength : Actual absolute offset from start of file */ +/*----------------------------------------------------------------------*/ + +/** Values of irFlags for flSeekFile: */ + +#define SEEK_START 0 /* offset from start of file */ +#define SEEK_CURR 1 /* offset from current position */ +#define SEEK_END 2 /* offset from end of file */ + + +#define flSeekFile(ioreq) flCall(FL_SEEK_FILE,ioreq) + + +/*----------------------------------------------------------------------*/ +/* f l F i n d F i l e */ +/* */ +/* Finds a file entry in a directory, optionally modifying the file */ +/* time/date and/or attributes. */ +/* Files may be found by handle no. provided they are open, or by name. */ +/* Only the Hidden, System or Read-only attributes may be modified. */ +/* Entries may be found for any existing file or directory other than */ +/* the root. A DirectoryEntry structure describing the file is copied */ +/* to a user buffer. */ +/* */ +/* The DirectoryEntry structure is defined in dosformt.h */ +/* */ +/* Parameters: */ +/* irHandle : If by name: Drive number (0, 1, ...) */ +/* else : Handle of open file */ +/* irPath : If by name: Specifies a file or directory path*/ +/* irFlags : Options flags */ +/* FIND_BY_HANDLE: Find open file by handle. */ +/* Default is access by path. */ +/* SET_DATETIME: Update time/date from buffer */ +/* SET_ATTRIBUTES: Update attributes from buffer */ +/* irDirEntry : Address of user buffer to receive a */ +/* DirectoryEntry structure */ +/* */ +/* Returns: */ +/* irLength : Modified */ +/* FLStatus : 0 on success, otherwise failed */ +/*----------------------------------------------------------------------*/ + +/** Bit assignment of irFlags for flFindFile: */ + +#define SET_DATETIME 1 /* Change date/time */ +#define SET_ATTRIBUTES 2 /* Change attributes */ +#define FIND_BY_HANDLE 4 /* Find file by handle rather than by name */ + +#define flFindFile(ioreq) flCall(FL_FIND_FILE,ioreq) + + +/*----------------------------------------------------------------------*/ +/* f l F i n d F i r s t F i l e */ +/* */ +/* Finds the first file entry in a directory. */ +/* This function is used in combination with the flFindNextFile call, */ +/* which returns the remaining file entries in a directory sequentially.*/ +/* Entries are returned according to the unsorted directory order. */ +/* flFindFirstFile creates a file handle, which is returned by it. Calls*/ +/* to flFindNextFile will provide this file handle. When flFindNextFile */ +/* returns 'noMoreEntries', the file handle is automatically closed. */ +/* Alternatively the file handle can be closed by a 'closeFile' call */ +/* before actually reaching the end of directory. */ +/* A DirectoryEntry structure is copied to the user buffer describing */ +/* each file found. This structure is defined in dosformt.h. */ +/* */ +/* Parameters: */ +/* irHandle : Drive number (0, 1, ...) */ +/* irPath : Specifies a directory path */ +/* irData : Address of user buffer to receive a */ +/* DirectoryEntry structure */ +/* */ +/* Returns: */ +/* irHandle : File handle to use for subsequent operations. */ +/* FLStatus : 0 on success, otherwise failed */ +/*----------------------------------------------------------------------*/ + +#define flFindFirstFile(ioreq) flCall(FL_FIND_FIRST_FILE,ioreq) + + +/*----------------------------------------------------------------------*/ +/* f l F i n d N e x t F i l e */ +/* */ +/* See the description of 'flFindFirstFile'. */ +/* */ +/* Parameters: */ +/* irHandle : File handle returned by flFindFirstFile. */ +/* irData : Address of user buffer to receive a */ +/* DirectoryEntry structure */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/*----------------------------------------------------------------------*/ + +#define flFindNextFile(ioreq) flCall(FL_FIND_NEXT_FILE,ioreq) + + +/*----------------------------------------------------------------------*/ +/* f l G e t D i s k I n f o */ +/* */ +/* Returns general allocation information. */ +/* */ +/* The bytes/sector, sector/cluster, total cluster and free cluster */ +/* information are returned into a DiskInfo structure. */ +/* */ +/* Parameters: */ +/* irHandle : Drive number (0, 1, ...) */ +/* irData : Address of DiskInfo structure */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/*----------------------------------------------------------------------*/ + +typedef struct { + unsigned bytesPerSector; + unsigned sectorsPerCluster; + unsigned totalClusters; + unsigned freeClusters; +} DiskInfo; + + +#define flGetDiskInfo(ioreq) flCall(FL_GET_DISK_INFO,ioreq) + + +/*----------------------------------------------------------------------*/ +/* f l D e l e t e F i l e */ +/* */ +/* Deletes a file. */ +/* */ +/* Parameters: */ +/* irHandle : Drive number (0, 1, ...) */ +/* irPath : path of file to delete */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/*----------------------------------------------------------------------*/ + +#define flDeleteFile(ioreq) flCall(FL_DELETE_FILE,ioreq) + + +#ifdef RENAME_FILE + +/*----------------------------------------------------------------------*/ +/* f l R e n a m e F i l e */ +/* */ +/* Renames a file to another name. */ +/* */ +/* Parameters: */ +/* irHandle : Drive number (0, 1, ...) */ +/* irPath : path of existing file */ +/* irData : path of new name. */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/*----------------------------------------------------------------------*/ + +#define flRenameFile(ioreq) flCall(FL_RENAME_FILE,ioreq) + +#endif /* RENAME_FILE */ + + +#ifdef SUB_DIRECTORY + +/*----------------------------------------------------------------------*/ +/* f l M a k e D i r */ +/* */ +/* Creates a new directory. */ +/* */ +/* Parameters: */ +/* irHandle : Drive number (0, 1, ...) */ +/* irPath : path of new directory. */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/*----------------------------------------------------------------------*/ + +#define flMakeDir(ioreq) flCall(FL_MAKE_DIR,ioreq) + + +/*----------------------------------------------------------------------*/ +/* f l R e m o v e D i r */ +/* */ +/* Removes an empty directory. */ +/* */ +/* Parameters: */ +/* irHandle : Drive number (0, 1, ...) */ +/* irPath : path of directory to remove. */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/*----------------------------------------------------------------------*/ + +#define flRemoveDir(ioreq) flCall(FL_REMOVE_DIR,ioreq) + +#endif /* SUB_DIRECTORY */ + +#endif /* FILES > 0 */ + +#ifdef PARSE_PATH + +/*----------------------------------------------------------------------*/ +/* f l P a r s e P a t h */ +/* */ +/* Converts a DOS-like path string to a simple-path array. */ +/* */ +/* Parameters: */ +/* irHandle : Drive number (0, 1, ...) */ +/* irData : address of path string to convert */ +/* irPath : address of array to receive parsed-path */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/*----------------------------------------------------------------------*/ + +extern FLStatus flParsePath(IOreq FAR2 *ioreq); + +#endif /* PARSE_PATH */ + + +#ifdef ABS_READ_WRITE + +/*----------------------------------------------------------------------*/ +/* f l A b s R e a d */ +/* */ +/* Reads absolute sectors by sector no. */ +/* */ +/* Parameters: */ +/* irHandle : Drive number (0, 1, ...) */ +/* irData : Address of user buffer to read into */ +/* irSectorNo : First sector no. to read (sector 0 is the */ +/* DOS boot sector). */ +/* irSectorCount : Number of consectutive sectors to read */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/* irSectorCount : Number of sectors actually read */ +/*----------------------------------------------------------------------*/ + +#define flAbsRead(ioreq) flCall(FL_ABS_READ,ioreq) + + +/*----------------------------------------------------------------------*/ +/* f l A b s W r i t e */ +/* */ +/* Writes absolute sectors by sector no. */ +/* */ +/* Parameters: */ +/* irHandle : Drive number (0, 1, ...) */ +/* irData : Address of user buffer to write from */ +/* irSectorNo : First sector no. to write (sector 0 is the */ +/* DOS boot sector). */ +/* irSectorCount : Number of consectutive sectors to write */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/* irSectorCount : Number of sectors actually written */ +/*----------------------------------------------------------------------*/ + +#define flAbsWrite(ioreq) flCall(FL_ABS_WRITE,ioreq) + + +/*----------------------------------------------------------------------*/ +/* f l A b s D e l e t e */ +/* */ +/* Marks absolute sectors by sector no. as deleted. */ +/* */ +/* Parameters: */ +/* irHandle : Drive number (0, 1, ...) */ +/* irSectorNo : First sector no. to write (sector 0 is the */ +/* DOS boot sector). */ +/* irSectorCount : Number of consectutive sectors to delete */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/* irSectorCount : Number of sectors actually deleted */ +/*----------------------------------------------------------------------*/ + +#define flAbsDelete(ioreq) flCall(FL_ABS_DELETE,ioreq) + + +/*----------------------------------------------------------------------*/ +/* f l G e t B P B */ +/* */ +/* Reads the BIOS Parameter Block from the boot sector */ +/* */ +/* Parameters: */ +/* irHandle : Drive number (0, 1, ...) */ +/* irData : Address of user buffer to read BPB into */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/*----------------------------------------------------------------------*/ + +#define flGetBPB(ioreq) flCall(FL_GET_BPB,ioreq) + +#endif /* ABS_READ_WRITE */ + +#ifdef LOW_LEVEL + +/*----------------------------------------------------------------------*/ +/* P h y s i c a l I n f o */ +/* */ +/* A structure that holds physical information about the media. The */ +/* information includes JEDEC ID, unit size and media size. Pointer */ +/* to this structure is passed to the function flGetPhysicalInfo where */ +/* it receives the relevant data. */ +/* */ +/*----------------------------------------------------------------------*/ + +typedef struct { + unsigned short type; /* Flash device type (JEDEC id) */ + long int unitSize; /* Smallest physically erasable size + (with interleaving taken in account) */ + long int mediaSize; /* media size */ +} PhysicalInfo; + +/*----------------------------------------------------------------------*/ +/* f l G e t P h y s i c a l I n f o */ +/* */ +/* Get physical information of the media. The information includes */ +/* JEDEC ID, unit size and media size. */ +/* */ +/* Parameters: */ +/* irHandle : Drive number (0,1,..) */ +/* irData : Address of user buffer to read physical */ +/* information into. */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/*----------------------------------------------------------------------*/ + +#define flGetPhysicalInfo(ioreq) flCall(FL_GET_PHYSICAL_INFO, ioreq) + +/*----------------------------------------------------------------------*/ +/* f l P h y s i c a l R e a d */ +/* */ +/* Read from a physical address. */ +/* */ +/* Parameters: */ +/* irHandle : Drive number (0,1,..) */ +/* irAddress : Physical address to read from. */ +/* irByteCount : Number of bytes to read. */ +/* irData : Address of user buffer to read into. */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/*----------------------------------------------------------------------*/ + +#define flPhysicalRead(ioreq) flCall(FL_PHYSICAL_READ,ioreq) + +/*----------------------------------------------------------------------*/ +/* f l P h y s i c a l W r i t e */ +/* */ +/* Write to a physical address. */ +/* */ +/* Parameters: */ +/* irHandle : Drive Number (0,1,..) */ +/* irAddress : Physical address to write to. */ +/* irByteCount : Number of bytes to write. */ +/* irData : Address of user buffer to write from. */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/*----------------------------------------------------------------------*/ + +#define flPhysicalWrite(ioreq) flCall(FL_PHYSICAL_WRITE,ioreq) + +/*----------------------------------------------------------------------*/ +/* f l P h y s i c a l E r a s e */ +/* */ +/* Erase physical units. */ +/* */ +/* Parameters: */ +/* irHandle : Drive number (0,1,..) */ +/* irUnitNo : First unit to erase. */ +/* irUnitCount : Number of units to erase. */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/*----------------------------------------------------------------------*/ + +#define flPhysicalErase(ioreq) flCall(FL_PHYSICAL_ERASE,ioreq) + +#endif /* LOW_LEVEL */ + +/*----------------------------------------------------------------------*/ +/* f l D o n t W a t c h F A T */ +/* */ +/* Turns off FAT monitoring. */ +/* */ +/* Parameters: */ +/* irHandle : Drive number (0, 1, ...) */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/*----------------------------------------------------------------------*/ + +#define flDontMonitorFAT(ioreq) flCall(FL_DONT_MONITOR_FAT,ioreq) + + +/*----------------------------------------------------------------------*/ +/* f l I n i t */ +/* */ +/* Initializes the FLite system, sockets and timers. */ +/* */ +/* Calling this function is optional. If it is not called, */ +/* initialization will be done automatically on the first FLite call. */ +/* This function is provided for those applications who want to */ +/* explicitly initialize the system and get an initialization status. */ +/* */ +/* Calling flInit after initialization was done has no effect. */ +/* */ +/* Parameters: */ +/* None */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failed */ +/*----------------------------------------------------------------------*/ + +extern FLStatus flInit(void); + + +#ifdef EXIT + +/*----------------------------------------------------------------------*/ +/* f l E x i t */ +/* */ +/* If the application ever exits, flExit should be called before exit. */ +/* flExit flushes all buffers, closes all open files, powers down the */ +/* sockets and removes the interval timer. */ +/* */ +/* Parameters: */ +/* None */ +/* */ +/* Returns: */ +/* Nothing */ +/*----------------------------------------------------------------------*/ + +extern void flExit(void); + +#endif /* EXIT */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/tffs/flbase.h b/h/tffs/flbase.h new file mode 100644 index 0000000..8f96dac --- /dev/null +++ b/h/tffs/flbase.h @@ -0,0 +1,267 @@ +/* flbase.h - True Flash File System */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* FAT-FTL Lite Software Development Kit + * Copyright (C) M-Systems Ltd. 1995-1997 */ + +/* +modification history +-------------------- +01c,02feb05,aeg added include of logLib.h (SPR #106381). +01b,16nov04,mil removed deprecated __FUNCTION__ for GNU. +01a,29jul04,alr modified file header, restarted history +*/ + +#ifndef FLBASE_H +#define FLBASE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "flsystem.h" +#include "flcustom.h" +#include "logLib.h" + +/* standard type definitions */ +typedef int FLBoolean; + +/* Boolean constants */ + +#ifndef FALSE +#define FALSE 0 +#endif +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef TFFS_ON +#define TFFS_ON 1 +#endif +#ifndef TFFS_OFF +#define TFFS_OFF 0 +#endif + +#define SECTOR_SIZE (1 << SECTOR_SIZE_BITS) + +/* define SectorNo range according to media maximum size */ +#if (MAX_VOLUME_MBYTES * 0x100000l) / SECTOR_SIZE > 0x10000l +typedef unsigned long SectorNo; +#define UNASSIGNED_SECTOR 0xffffffffl +#else +typedef unsigned short SectorNo; +#define UNASSIGNED_SECTOR 0xffff +#endif + +#if FAR_LEVEL > 0 + #define FAR0 far +#else + #define FAR0 +#endif + +#if FAR_LEVEL > 1 + #define FAR1 far +#else + #define FAR1 +#endif + +#if FAR_LEVEL > 2 + #define FAR2 far +#else + #define FAR2 +#endif + + +#define vol (*pVol) + + +#ifndef TFFS_BIG_ENDIAN + +typedef unsigned short LEushort; +typedef unsigned long LEulong; + +#define LE2(arg) arg +#define toLE2(to,arg) (to) = (arg) +#define LE4(arg) arg +#define toLE4(to,arg) (to) = (arg) +#define COPY2(to,arg) (to) = (arg) +#define COPY4(to,arg) (to) = (arg) + +typedef unsigned char Unaligned[2]; +typedef Unaligned Unaligned4[2]; + +#define UNAL2(arg) fromUNAL(arg) +#define toUNAL2(to,arg) toUNAL(to,arg) + +#define UNAL4(arg) fromUNALLONG(arg) +#define toUNAL4(to,arg) toUNALLONG(to,arg) + +extern void toUNAL(unsigned char FAR0 *unal, unsigned n); + +extern unsigned short fromUNAL(unsigned char const FAR0 *unal); + +extern void toUNALLONG(Unaligned FAR0 *unal, unsigned long n); + +extern unsigned long fromUNALLONG(Unaligned const FAR0 *unal); + +#else + +typedef unsigned char LEushort[2]; +typedef unsigned char LEulong[4]; + +#define LE2(arg) fromLEushort(arg) +#define toLE2(to,arg) toLEushort(to,arg) +#define LE4(arg) fromLEulong(arg) +#define toLE4(to,arg) toLEulong(to,arg) +#define COPY2(to,arg) copyShort(to,arg) +#define COPY4(to,arg) copyLong(to,arg) + +#define Unaligned LEushort +#define Unaligned4 LEulong + +extern void toLEushort(unsigned char FAR0 *le, unsigned n); + +extern unsigned short fromLEushort(unsigned char const FAR0 *le); + +extern void toLEulong(unsigned char FAR0 *le, unsigned long n); + +extern unsigned long fromLEulong(unsigned char const FAR0 *le); + +extern void copyShort(unsigned char FAR0 *to, + unsigned char const FAR0 *from); + +extern void copyLong(unsigned char FAR0 *to, + unsigned char const FAR0 *from); + +#define UNAL2 LE2 +#define toUNAL2 toLE2 + +#define UNAL4 LE4 +#define toUNAL4 toLE4 + +#endif /* TFFS_BIG_ENDIAN */ + + +#ifndef IFLITE_ERROR_CODES +typedef enum {flOK = 0, /* Status code for operation. + A zero value indicates success, + other codes are the extended + DOS codes. */ + flBadFunction = 1, + flFileNotFound = 2, + flPathNotFound = 3, + flTooManyOpenFiles = 4, + flNoWriteAccess = 5, + flBadFileHandle = 6, + flDriveNotAvailable = 9, + flNonFATformat = 10, + flFormatNotSupported = 11, + flNoMoreFiles = 18, + flWriteProtect = 19, + flBadDriveHandle = 20, + flDriveNotReady = 21, + flUnknownCmd = 22, + flBadFormat = 23, + flBadLength = 24, + flDataError = 25, + flUnknownMedia = 26, + flSectorNotFound = 27, + flOutOfPaper = 28, + flWriteFault = 29, + flReadFault = 30, + flGeneralFailure = 31, + flDiskChange = 34, + flVppFailure = 50, + flBadParameter = 51, + flNoSpaceInVolume = 52, + flInvalidFATchain = 53, + flRootDirectoryFull = 54, + flNotMounted = 55, + flPathIsRootDirectory = 56, + flNotADirectory = 57, + flDirectoryNotEmpty = 58, + flFileIsADirectory = 59, + flAdapterNotFound = 60, + flFormattingError = 62, + flNotEnoughMemory = 63, + flVolumeTooSmall = 64, + flBufferingError = 65, + flFileAlreadyExists = 80, + + flIncomplete = 100, + flTimedOut = 101, + flTooManyComponents = 102 +#else + +#include "type.h" + +typedef enum {flOK = ERR_NONE, + /* Status code for operation. + A zero value indicates success, + other codes are the extended + DOS codes. */ + flBadFunction = ERR_SW_HW, + flFileNotFound = ERR_NOTEXISTS, + flPathNotFound = ERR_NOTEXISTS, + flTooManyOpenFiles = ERR_MAX_FILES, + flNoWriteAccess = ERR_WRITE, + flBadFileHandle = ERR_NOTOPEN, + flDriveNotAvailable = ERR_SW_HW, + flNonFATformat = ERR_PARTITION, + flFormatNotSupported = ERR_PARTITION, + flNoMoreFiles = ERR_NOTEXISTS, + flWriteProtect = ERR_WRITE, + flBadDriveHandle = ERR_SW_HW, + flDriveNotReady = ERR_PARTITION, + flUnknownCmd = ERR_PARAM, + flBadFormat = ERR_PARTITION, + flBadLength = ERR_SW_HW, + flDataError = ERR_READ, + flUnknownMedia = ERR_PARTITION, + flSectorNotFound = ERR_READ, + flOutOfPaper = ERR_SW_HW, + flWriteFault = ERR_WRITE, + flReadFault = ERR_READ, + flGeneralFailure = ERR_SW_HW, + flDiskChange = ERR_PARTITION, + flVppFailure = ERR_WRITE, + flBadParameter = ERR_PARAM, + flNoSpaceInVolume = ERR_SPACE, + flInvalidFATchain = ERR_PARTITION, + flRootDirectoryFull = ERR_DIRECTORY, + flNotMounted = ERR_PARTITION, + flPathIsRootDirectory = ERR_DIRECTORY, + flNotADirectory = ERR_DIRECTORY, + flDirectoryNotEmpty = ERR_NOT_EMPTY, + flFileIsADirectory = ERR_DIRECTORY, + flAdapterNotFound = ERR_DETECT, + flFormattingError = ERR_FORMAT, + flNotEnoughMemory = ERR_SW_HW, + flVolumeTooSmall = ERR_FORMAT, + flBufferingError = ERR_SW_HW, + flFileAlreadyExists = ERR_EXISTS, + + flIncomplete = ERR_DETECT, + flTimedOut = ERR_SW_HW, + flTooManyComponents = ERR_PARAM +#endif + + } FLStatus; + +/* call a procedure returning status and fail if it fails. This works only in + routines that return Status */ + +#define checkStatus(exp) { FLStatus status = (exp); \ + if (status != flOK){ \ + logMsg("checkStatus() ERROR line %i\n",__LINE__,2,3,4,5,6); \ + return status; } } + +#include "flsysfun.h" + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/tffs/flbuffer.h b/h/tffs/flbuffer.h new file mode 100644 index 0000000..285b927 --- /dev/null +++ b/h/tffs/flbuffer.h @@ -0,0 +1,36 @@ +/* flbuffer.h - True Flash File System */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* FAT-FTL Lite Software Development Kit + * Copyright (C) M-Systems Ltd. 1995-1997 */ + +/* +modification history +-------------------- +01a,29jul04,alr modified file header, restarted history +*/ + +#ifndef FLBUFFER_H +#define FLBUFFER_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "flbase.h" + +typedef struct { + unsigned char data[SECTOR_SIZE]; /* sector buffer */ + SectorNo sectorNo; /* current sector in buffer */ + void *owner; /* owner of buffer */ + FLBoolean dirty; /* sector in buffer was changed */ + FLBoolean checkPoint; /* sector in buffer must be flushed */ +} FLBuffer; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/tffs/flcustom.h b/h/tffs/flcustom.h new file mode 100644 index 0000000..05396ed --- /dev/null +++ b/h/tffs/flcustom.h @@ -0,0 +1,303 @@ +/* flcustom.h - True Flash File System */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* FAT-FTL Lite Software Development Kit + * Copyright (C) M-Systems Ltd. 1995-1997 */ + +/* +modification history +-------------------- +01b,29jul04,alr activated DEFRAGMENT_VOLUME +01a,29jul04,alr modified file header, restarted history +*/ + +#ifndef FLCUSTOM_H +#define FLCUSTOM_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* This file is intended for modification only by TFFS SOURCE + * customers. Customers with the binary distribution of the product + * should not modify this file. + */ + + +/* + * + * Section 2: File System Customization + * ------------------------------------ + */ + +/* ISSUE #2.1: Number of drives + * + * Defines the maximum number of drives (and sockets) supported. + * + * The actual number of drives depends on which socket controllers are + * actually registered. + */ + +#define DRIVES 5 + + +/* ISSUE #2.1: Number of open files + * + * Defines the maximum number of files that may be open at a time. + */ + +#define FILES 0 + + +/* ISSUE #2.2: Sector size + * + * Define the log2 of sector size for the FAT & FTL layer. Note that the + * default 512 bytes is the de-facto standard and practically the only one + * that provides real PC interoperability. + */ + +#define SECTOR_SIZE_BITS 9 + + +/* ISSUE #2.3: Formatting + * + * Uncomment the following line if you need to format with fsFormatVolume. + */ + +#define FORMAT_VOLUME + + +/* ISSUE #2.4: Defragmentation + * + * Uncomment the following line if you need to defragment with + * fsDefragmentVolume. + */ + +#define DEFRAGMENT_VOLUME + + +/* ISSUE #2.5: Sub-directories + * + * Uncomment the following line if you need support for sub-directories + */ + +/* #define SUB_DIRECTORY */ + + +/* ISSUE #2.6: Rename file + * + * Uncomment the following line if you need to rename files with fsRenameFile. + */ + +/* #define RENAME_FILE */ + + +/* ISSUE #2.7: Split / join file + * + * Uncomment the following line if you need to split or join files with + * fsSplitFile and fsJoinFile + */ + +/* #define SPLIT_JOIN_FILE */ + + +/* ISSUE #2.8: 12-bit FAT support + * + * Comment the following line if you do not need support for DOS media with + * 12-bit FAT (typically media of 2 MBytes or less). + */ + +#define FAT_12BIT + + +/* ISSUE #2.9: Parse path function + * + * Uncomment the following line if you need to parse DOS-like path names + * with fsParsePath. + */ + +/* #define PARSE_PATH */ + + +/* ISSUE #2.10: Maximum supported medium size + * + * Define here the largest Flash medium size (in MBytes) you want supported. + */ + + +/* limit is set to 2047 to avoid integer overflow warning */ + +#define MAX_VOLUME_MBYTES 2047 + + +/* ISSUE #2.11: Assumed card parameters + * + * This issue is relevant only if you are not defining any allocation + * routines in #5.2. + * + * The following are assumptions about FTL parameters of the Flash media. + * They affect the size of the heap buffer allocated in FTLLITE.C. + */ + +#define ASSUMED_FTL_UNIT_SIZE 0x20000l /* Intel interleave-2 */ +#define ASSUMED_VM_LIMIT 0x10000l /* limit at 64 KB */ +#define ASSUMED_NFTL_UNIT_SIZE 0x4000l + + +/* ISSUE #2.12: Number of buffers + * + * Normally two sector buffers are needed, one for the FAT layer, another + * for the FTL layer. You may save about 512 bytes of RAM requirements by + * uncommenting the following definition. + * This will come at the cost of both read and write performance. + */ + +/*#define SINGLE_BUFFER */ + + +/* ISSUE #2.13: Absolute read & write + * + * Uncomment the following line if you want to be able to read & write + * sectors by absolute sector number (i.e. without regard to files and + * directories). + */ + +#define ABS_READ_WRITE + + +/* ISSUE #2.14: Low level operations + * + * Uncomment the following line if you want to do low level operations. + * Low level operations include: read from a physical address, write to + * a physical address, erase a unit according to its physical unit number. + */ + +#define LOW_LEVEL + + +/* ISSUE #2.15: Application exit + * + * If the FLite application ever exits, it needs to call fsEXit before + * exitting. Uncomment the following line to enable this. + */ + +/* #define EXIT */ + + +/* ISSUE #2.16: Number of sectors per cluster + * + * Define the minimum cluster size in sectors. + */ + +#define MIN_CLUSTER_SIZE 4 + + +/* + * + * Section 3: Socket Hardware Customization + * ---------------------------------------- + */ + +/* ISSUE #3.1: Vpp voltage + * + * If your socket does not supply 12 volts, comment the following line. In + * this case, you will be able to work only with Flash cards that do not + * require external 12 Volt Vpp. + * + */ + +#define SOCKET_12_VOLTS + + +/* ISSUE #3.2: Fixed or removable media + * + * If your Flash media is fixed, uncomment the following line, and ignore + * issue #3.3. + */ + +/* #define FIXED_MEDIA */ + + +/* ISSUE #3.3: Hardware card change detection + * + * This issue is now obsolete + * + */ + + +/* ISSUE #3.4: Interval timer + * + * The following defines a timer polling interval in milliseconds. If the + * value is 0, an interval timer is not installed. + * + * If you select an interval timer, you should provide an implementation + * for 'installTimer' defined in timer.h. + * + * An interval timer is not a must, but it is recommended. The following + * will occur if an interval timer is absent: + * + * - Card changes can be recognized only if socket hardware detects them + * (see issue #3.2). + * - The Vpp delayed turn-off procedure is not applied. This may downgrade + * write performance significantly if the Vpp switching time is slow. + * - The watchdog timer that guards against certain operations being stuck + * indefinitely will not be active. + */ + +#define POLLING_INTERVAL 100 /* Polling interval in millisec. + if 0, no polling is done */ + + +/* + * + * Section 4: MTD Customization + * ---------------------------- + */ + +/* ISSUE #4.1: MTD Installation + * + * This issue is now obsolete + * + */ + + +/* ISSUE #4.2: Background erasing + * + * If you include support for Flash technology that has suspend-for-write + * capability, you can gain considerable write performance and improve + * real-time response for your write operations by including background erase + * capability. In some cases, you can gain performance by including this + * feature even if no suspend-for-write capability is supported. See the + * FLite manual for complete details. + * + * On the other hand, this feature adds to required code & RAM, makes + * necessary some additional customization on your part, and depends on + * compiler features that, while defined as ANSI-C standard, may have + * a problematic implementation in your particular environment. See the + * FLite manual for complete details. + * + * Uncomment the following line to support background erasing. + */ + +/* #define BACKGROUND */ + + +/* ISSUE #4.3: Maximum MTD's and Translation Layers + * + * Define here the maximum number of Memory Technology Drivers and + * Translation Layers that may be installed. Note that the actual + * number installed is determined by which components are installed in + * 'registerComponents' (custom.c) + */ + +#define MTDS 10 /* Up to 5 MTD's */ + +#define TLS 5 /* Up to 3 Translation Layers */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/tffs/flflash.h b/h/tffs/flflash.h new file mode 100644 index 0000000..ff88520 --- /dev/null +++ b/h/tffs/flflash.h @@ -0,0 +1,206 @@ +/* flflash.h - True Flash File System */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* FAT-FTL Lite Software Development Kit + * Copyright (C) M-Systems Ltd. 1995-1997 */ + +/* +modification history +-------------------- +01a,29jul04,alr modified file header, restarted history +*/ + +#ifndef FLFLASH_H +#define FLFLASH_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "flsocket.h" + +/* Some useful types for mapped Flash locations */ + +typedef volatile unsigned char FAR0 * FlashPTR; +typedef volatile unsigned short int FAR0 * FlashWPTR; +typedef volatile unsigned long FAR0 * FlashDPTR; + +typedef unsigned short FlashType; /* JEDEC id */ + +#define NOT_FLASH 0 + +/* page characteristics flags */ +#define BIG_PAGE 0x0100 /* page size > 100H*/ +#define FULL_PAGE 0x0200 /* no partial page programming*/ + +/* MTD write routine mode flags */ +#define OVERWRITE 1 /* Overwriting non-erased area */ +#define EDC 2 /* Activate ECC/EDC */ +#define EXTRA 4 /* Read/write spare area */ + + +/*----------------------------------------------------------------------*/ +/* Flash array identification structure */ +/* */ +/* This structure contains a description of the Flash array and */ +/* routine pointers for the map, read, write & erase functions. */ +/* */ +/* The structure is initialized by the MTD that identifies the Flash */ +/* array. */ +/* On entry to an MTD, the Flash structure contains default routines */ +/* for all operations. This routines are sufficient forread-only access */ +/* to NOR Flash on a memory-mapped socket. The MTD should override the */ +/* default routines with MTD specific ones when appropriate. */ +/*----------------------------------------------------------------------*/ + +/* Flash array identification structure */ + +typedef struct tFlash FLFlash; /* Forward definition */ + +struct tFlash { + FlashType type; /* Flash device type (JEDEC id) */ + long int erasableBlockSize; /* Smallest physically erasable size + (with interleaving taken in account) */ + long int chipSize; /* chip size */ + int noOfChips; /* no of chips in array */ + int interleaving; /* chip interleaving + (The interleaving is defined as + the address difference between + two consecutive bytes on a chip) */ + unsigned flags; /* Special capabilities & options + Bits 0-7 may be used by FLite. + Bits 8-15 are not used bt FLite + and may be used by MTD's for MTD- + specific purposes. */ + void * mtdVars; /* Points to MTD private area for + this socket. + This field, if used by the MTD, is + initialized by the MTD identification + routine */ + FLSocket * socket; /* Socket of this drive */ + + +/* Flag bit values */ + +#define SUSPEND_FOR_WRITE 1 /* MTD provides suspend for write */ +#define NFTL_ENABLED 2 /* Flash can run NFTL */ + + +/*----------------------------------------------------------------------*/ +/* f l a s h . m a p */ +/* */ +/* MTD specific map routine */ +/* */ +/* The default routine maps by socket mapping, and is suitable for all */ +/* NOR Flash. */ +/* NAND or other type Flash should use map-through-copy emulation: Read */ +/* a block of Flash to an internal buffer and return a pointer to that */ +/* buffer. */ +/* */ +/* Parameters: */ +/* vol : Pointer identifying drive */ +/* address : Card address to map */ +/* length : Length to map */ +/* */ +/* Returns: */ +/* Pointer to required card address */ +/*----------------------------------------------------------------------*/ + void FAR0 * (*map)(FLFlash *, CardAddress, int); + +/*----------------------------------------------------------------------*/ +/* f l a s h . r e a d */ +/* */ +/* MTD specific Flash read routine */ +/* */ +/* The default routine reads by copying from a mapped window, and is */ +/* suitable for all NOR Flash. */ +/* */ +/* Parameters: */ +/* vol : Pointer identifying drive */ +/* address : Card address to read */ +/* buffer : Area to read into */ +/* length : Length to read */ +/* */ +/*----------------------------------------------------------------------*/ + FLStatus (*read)(FLFlash *, CardAddress, void FAR1 *, int, int); + +/*----------------------------------------------------------------------*/ +/* f l a s h . w r i t e */ +/* */ +/* MTD specific Flash write routine */ +/* */ +/* The default routine returns a write-protect error. */ +/* */ +/* Parameters: */ +/* vol : Pointer identifying drive */ +/* address : Card address to write to */ +/* buffer : Address of data to write */ +/* length : Number of bytes to write */ +/* modes : See write mode flags definition above */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, failed otherwise */ +/*----------------------------------------------------------------------*/ + FLStatus (*write)(FLFlash *, CardAddress, const void FAR1 *, int, int); + +/*----------------------------------------------------------------------*/ +/* f l a s h . e r a s e */ +/* */ +/* Erase one or more contiguous Flash erasable blocks */ +/* */ +/* The default routine returns a write-protect error. */ +/* */ +/* Parameters: */ +/* vol : Pointer identifying drive */ +/* firstErasableBlock : Number of first block to erase */ +/* numOfErasableBlocks: Number of blocks to erase */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, failed otherwise */ +/*----------------------------------------------------------------------*/ + FLStatus (*erase)(FLFlash *, int, int); + +/*----------------------------------------------------------------------*/ +/* f l a s h . s e t P o w e r O n C a l l b a c k */ +/* */ +/* Register power on callback routine. Default: no routine is */ +/* registered. */ +/* */ +/* Parameters: */ +/* vol : Pointer identifying drive */ +/* */ +/*----------------------------------------------------------------------*/ + void (*setPowerOnCallback)(FLFlash *); +}; + + + +/* MTD registration information */ + +extern int noOfMTDs; /* No. of MTDs actually registered */ + +typedef FLStatus (*MTDidentifyRoutine) (FLFlash vol); + +extern MTDidentifyRoutine mtdTable[]; + + +/* See interface documentation of functions in flash.c */ + +extern void flIntelIdentify(FLFlash *, + void (*)(FLFlash *, CardAddress, unsigned char, FlashPTR), + CardAddress); + +extern FLStatus flIntelSize(FLFlash *, + void (*)(FLFlash *, CardAddress, unsigned char, FlashPTR), + CardAddress); + +extern FLStatus flIdentifyFlash(FLSocket *socket, FLFlash *flash); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/h/tffs/flsocket.h b/h/tffs/flsocket.h new file mode 100644 index 0000000..63c26ea --- /dev/null +++ b/h/tffs/flsocket.h @@ -0,0 +1,269 @@ +/* flsocket.h - True Flash File System */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* FAT-FTL Lite Software Development Kit + * Copyright (C) M-Systems Ltd. 1995-1997 */ + +/* +modification history +-------------------- +01a,29jul04,alr modified file header, restarted history +*/ + +#ifndef FLSOCKET_H +#define FLSOCKET_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "flbase.h" +#include "flbuffer.h" + +#define ATTRIBUTE_SPACE_MAPPED 0x8000 + +typedef enum {PowerOff, PowerGoingOff, PowerOn} PowerState; + + +/* Socket state variables */ +typedef struct tSocket FLSocket; /* Forward definition */ + +struct tSocket { + unsigned volNo; /* Volume no. of socket */ + unsigned serialNo; /* Serial no. of socket on controller */ + + FLBoolean cardChanged; /* need media change notification */ + + int VccUsers; /* No. of current VCC users */ + int VppUsers; /* No. of current VPP users */ + + PowerState VccState; /* Actual VCC state */ + PowerState VppState; /* Actual VPP state */ + + FLBoolean remapped; /* set to TRUE whenever the socket window is moved */ + + void (*powerOnCallback)(void *flash); /* Notification routine for Vcc on */ + void * flash; /* Flash object for callback */ + + struct { /* Window state */ + unsigned int baseAddress; /* Physical base as a 4K page */ + unsigned int currentPage; /* Our current window page mapping */ + void FAR0 * base; /* Pointer to window base */ + long int size; /* Window size (must by power of 2) */ + unsigned speed; /* in nsec. */ + unsigned busWidth; /* 8 or 16 bits */ + } window; + +/*----------------------------------------------------------------------*/ +/* c a r d D e t e c t e d */ +/* */ +/* Detect if a card is present (inserted) */ +/* */ +/* Parameters: */ +/* vol : Pointer identifying drive */ +/* */ +/* Returns: */ +/* 0 = card not present, other = card present */ +/*----------------------------------------------------------------------*/ + FLBoolean (*cardDetected)(FLSocket vol); + +/*----------------------------------------------------------------------*/ +/* V c c O n */ +/* */ +/* Turns on Vcc (3.3/5 Volts). Vcc must be known to be good on exit. */ +/* */ +/* Parameters: */ +/* vol : Pointer identifying drive */ +/* */ +/*----------------------------------------------------------------------*/ + void (*VccOn)(FLSocket vol); + +/*----------------------------------------------------------------------*/ +/* V c c O f f */ +/* */ +/* Turns off Vcc. */ +/* */ +/* Parameters: */ +/* vol : Pointer identifying drive */ +/* */ +/*----------------------------------------------------------------------*/ + void (*VccOff)(FLSocket vol); + +#ifdef SOCKET_12_VOLTS + +/*----------------------------------------------------------------------*/ +/* V p p O n */ +/* */ +/* Turns on Vpp (12 Volts. Vpp must be known to be good on exit. */ +/* */ +/* Parameters: */ +/* vol : Pointer identifying drive */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, failed otherwise */ +/*----------------------------------------------------------------------*/ + FLStatus (*VppOn)(FLSocket vol); + + +/*----------------------------------------------------------------------*/ +/* V p p O f f */ +/* */ +/* Turns off Vpp. */ +/* */ +/* Parameters: */ +/* vol : Pointer identifying drive */ +/* */ +/*----------------------------------------------------------------------*/ + void (*VppOff)(FLSocket vol); + +#endif /* SOCKET_12_VOLTS */ + +/*----------------------------------------------------------------------*/ +/* i n i t S o c k e t */ +/* */ +/* Perform all necessary initializations of the socket or controller */ +/* */ +/* Parameters: */ +/* vol : Pointer identifying drive */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, failed otherwise */ +/*----------------------------------------------------------------------*/ + FLStatus (*initSocket)(FLSocket vol); + +/*----------------------------------------------------------------------*/ +/* s e t W i n d o w */ +/* */ +/* Sets in hardware all current window parameters: Base address, size, */ +/* speed and bus width. */ +/* The requested settings are given in the 'vol.window' structure. */ +/* */ +/* If it is not possible to set the window size requested in */ +/* 'vol.window.size', the window size should be set to a larger value, */ +/* if possible. In any case, 'vol.window.size' should contain the */ +/* actual window size (in 4 KB units) on exit. */ +/* */ +/* Parameters: */ +/* vol : Pointer identifying drive */ +/* */ +/*----------------------------------------------------------------------*/ + void (*setWindow)(FLSocket vol); + + +/*----------------------------------------------------------------------*/ +/* s e t M a p p i n g C o n t e x t */ +/* */ +/* Sets the window mapping register to a card address. */ +/* */ +/* The window should be set to the value of 'vol.window.currentPage', */ +/* which is the card address divided by 4 KB. An address over 128KB, */ +/* (page over 32K) specifies an attribute-space address. */ +/* */ +/* The page to map is guaranteed to be on a full window-size boundary. */ +/* */ +/* Parameters: */ +/* vol : Pointer identifying drive */ +/* */ +/*----------------------------------------------------------------------*/ + void (*setMappingContext)(FLSocket vol, unsigned page); + +/*----------------------------------------------------------------------*/ +/* g e t A n d C l e a r C a r d C h a n g e I n d i c a t o r */ +/* */ +/* Returns the hardware card-change indicator and clears it if set. */ +/* */ +/* Parameters: */ +/* vol : Pointer identifying drive */ +/* */ +/* Returns: */ +/* 0 = Card not changed, other = card changed */ +/*----------------------------------------------------------------------*/ + FLBoolean (*getAndClearCardChangeIndicator)(FLSocket vol); + +/*----------------------------------------------------------------------*/ +/* w r i t e P r o t e c t e d */ +/* */ +/* Returns the write-protect state of the media */ +/* */ +/* Parameters: */ +/* vol : Pointer identifying drive */ +/* */ +/* Returns: */ +/* 0 = not write-protected, other = write-protected */ +/*----------------------------------------------------------------------*/ + FLBoolean (*writeProtected)(FLSocket vol); + +/*----------------------------------------------------------------------*/ +/* f r e e S o c k e t */ +/* */ +/* Free resources that were allocated for this socket. */ +/* This function is called when FLite exits. */ +/* */ +/* Parameters: */ +/* vol : Pointer identifying drive */ +/* */ +/*----------------------------------------------------------------------*/ +#ifdef EXIT + void (*freeSocket)(FLSocket vol); +#endif +}; + + +#define UNDEFINED_MAPPING 0x7fff + +typedef unsigned long CardAddress; /* Physical offset on card */ + +/* See interface documentation of functions in socket.c */ + +extern FLStatus flInitSockets(void); + +#ifdef EXIT +extern void flExitSocket(FLSocket *); +#endif + +extern unsigned flSocketNoOf(const FLSocket *); +extern FLSocket * flSocketOf(unsigned volNo); +extern FLBuffer *flBufferOf(unsigned volNo); + +extern void flNeedVcc(FLSocket *); +extern void flDontNeedVcc(FLSocket *); +#ifdef SOCKET_12_VOLTS +extern FLStatus flNeedVpp(FLSocket *); +extern void flDontNeedVpp(FLSocket *); +#endif +extern void flSocketSetBusy(FLSocket *, FLBoolean); /* entry/exit operations */ +extern FLBoolean flWriteProtected(FLSocket *); /* write-protection status */ +#ifndef FIXED_MEDIA +extern FLStatus flMediaCheck(FLSocket *); /* check for media status change */ +extern void flResetCardChanged(FLSocket *); +#endif +extern unsigned flGetMappingContext(FLSocket *); /* Currently mapped 4KB page */ +extern void FAR0 *flMap(FLSocket *, CardAddress); /* map and point at card address */ +extern void flSetWindowBusWidth(FLSocket *, unsigned); /* set window data-path */ +extern void flSetWindowSpeed(FLSocket *, unsigned); /* set window speed (nsec.) */ +extern void flSetWindowSize(FLSocket *, unsigned); /* in 4KB units */ + +extern void flSetPowerOnCallback(FLSocket *, void (*)(void *), void *); + /* Set MTD notification for socket power on */ +extern void flIntervalRoutine(FLSocket *); /* socket interval routine */ + + +extern unsigned noOfDrives; /* No. of drives actually registered */ + +/* The milliseconds counter is active when socket polling is enabled. When + the socket interval routine is called, the counter is incremented by + the interval in milliseconds. + The counter can be used to avoid getting in a loop that is not guaranteed + to terminate (such as waiting for a flash status register). Save the counter + at entry to the loop, and check in the loop the amount of time that + was spent in the loop. */ + +extern volatile unsigned long flMsecCounter; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/tffs/flsysfun.h b/h/tffs/flsysfun.h new file mode 100644 index 0000000..2b34c62 --- /dev/null +++ b/h/tffs/flsysfun.h @@ -0,0 +1,314 @@ +/* flsysfun.h - True Flash File System */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* FAT-FTL Lite Software Development Kit + * Copyright (C) M-Systems Ltd. 1995-1997 */ + +/* +modification history +-------------------- +01a,29jul04,alr modified file header, restarted history +*/ + +#ifndef FLSYSFUN_H +#define FLSYSFUN_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "flbase.h" + +/*----------------------------------------------------------------------*/ +/* f l S y s f u n I n i t */ +/* */ +/* Do any necessary initialization for routines in this module. */ +/* */ +/* Called from fatlite.c (flInit) */ +/* */ +/* Parameters: */ +/* None */ +/* */ +/*----------------------------------------------------------------------*/ + +extern void flSysfunInit(void); + + +/*----------------------------------------------------------------------*/ +/* f l D e l a y L o o p */ +/* */ +/* Short delay. It is BSp specific routine */ +/* */ +/* Parameters: */ +/* cycles : wait loop cycles to perform */ +/*----------------------------------------------------------------------*/ + +extern void flDelayLoop (int cycles); + + +/*----------------------------------------------------------------------*/ +/* f l R a n d B y t e */ +/* */ +/* Returns a random number between 0 and 255 */ +/* */ +/* Called from FTLLITE.C */ +/* */ +/* Parameters: */ +/* None */ +/* */ +/* Returns: */ +/* A random number between 0 and 255 */ +/*----------------------------------------------------------------------*/ + +extern unsigned flRandByte(void); + + +/*----------------------------------------------------------------------*/ +/* f l D e l a y M s e c s */ +/* */ +/* Delays execution for a number of milliseconds. */ +/* If there is no msec-accuracy to the clock, this routine should wait */ +/* at least the time specified. */ +/* */ +/* This routine may be called from the socket interface or MTD's, and */ +/* is not necessary for all implementations. */ +/* */ +/* Parameters: */ +/* milliseconds : Milliseconds to wait */ +/* */ +/*----------------------------------------------------------------------*/ + +extern void flDelayMsecs(unsigned milliseconds); + + +/*----------------------------------------------------------------------*/ +/* f l I n s t a l l T i m e r */ +/* */ +/* Installs an interval timer. */ +/* The implementation of this routine usually means hooking a clock */ +/* interrupt. The polling interval is specified as a parameter. If the */ +/* clock frequency is faster, the interval timer should count several */ +/* clock ticks before calling the interval routine. */ +/* */ +/* This routine is necessary if POLLING_INTERVAL (custom.h) is greater */ +/* than 0. In this case this routine will be called from socket.c */ +/* (init). It will be called to install 'socketIntervalRoutine' with a */ +/* period specified by POLLING_INTERVAL. */ +/* */ +/* Parameters: */ +/* routine : Routine to call at each interval */ +/* interval : Milliseconds per polling interval */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failure */ +/*----------------------------------------------------------------------*/ + +extern FLStatus flInstallTimer(void (*routine)(void), unsigned interval); + + +#ifdef EXIT + +/*----------------------------------------------------------------------*/ +/* f l R e m o v e T i m e r */ +/* */ +/* Removes the active interval timer. */ +/* This routine removes the active interval timer set by 'removeTimer'. */ +/* */ +/* Parameters: */ +/* None */ +/* */ +/*----------------------------------------------------------------------*/ + +extern void flRemoveTimer(void); + +#endif + + +/*----------------------------------------------------------------------*/ +/* f l C u r r e n t D a t e */ +/* */ +/* Returns the current DOS-format date */ +/* */ +/* The DOS date format is documented in dosformt.h. */ +/* */ +/* If a TOD clock is not available, return the value of 1/1/80. */ +/* */ +/* Parameters: */ +/* None */ +/* */ +/* Returns: */ +/* Current date */ +/*----------------------------------------------------------------------*/ + +extern unsigned flCurrentDate(void); + + +/*----------------------------------------------------------------------*/ +/* f l C u r r e n t T i m e */ +/* */ +/* Returns the current DOS-format time */ +/* */ +/* The DOS time format is documented in dosformt.h. */ +/* */ +/* If a TOD clock is not available, return the value of 0:00 AM. */ +/* */ +/* Parameters: */ +/* None */ +/* */ +/* Returns: */ +/* Current time */ +/*----------------------------------------------------------------------*/ + +extern unsigned flCurrentTime(void); + + +/*----------------------------------------------------------------------*/ +/* f l C r e a t e M u t e x */ +/* */ +/* Creates and initializes a mutex object */ +/* */ +/* The mutex is initializes as not owned by anyone. */ +/* */ +/* Parameters: */ +/* mutex : Pointer to mutex object */ +/* */ +/* Returns: */ +/* FLStatus : 0 on success, otherwise failure */ +/*----------------------------------------------------------------------*/ + +extern FLStatus flCreateMutex(FLMutex *mutex); + + +/*----------------------------------------------------------------------*/ +/* f l D e l e t e M u t e x */ +/* */ +/* Destroys a mutex object */ +/* */ +/* This function frees any resources taken by flCreateMutex. */ +/* */ +/* Parameters: */ +/* mutex : Pointer to mutex object */ +/* */ +/* Returns: */ +/* None */ +/*----------------------------------------------------------------------*/ + +extern void flDeleteMutex(FLMutex *mutex); + + +/*----------------------------------------------------------------------*/ +/* f l T a k e M u t e x */ +/* */ +/* Attempts to take ownership of a mutex. If the mutex is currently not */ +/* owned, TRUE is returned and the mutex becomes owned. If the mutex is */ +/* currently owned, FALSE is returned and ownership is not taken. */ +/* */ +/* Parameters: */ +/* mutex : Pointer to mutex object */ +/* */ +/* Returns: */ +/* FLBoolean : TRUE if ownership taken, FALSE otherwise */ +/*----------------------------------------------------------------------*/ + +extern FLBoolean flTakeMutex(FLMutex *mutex, int mode); + + +/*----------------------------------------------------------------------*/ +/* f l F r e e M u t e x */ +/* */ +/* Frees ownership of a mutex */ +/* */ +/* Parameters: */ +/* mutex : Pointer to mutex object */ +/* */ +/* Returns: */ +/* None */ +/*----------------------------------------------------------------------*/ + +extern void flFreeMutex(FLMutex *mutex); + + +#if FALSE +/*----------------------------------------------------------------------*/ +/* f l I n p o r t b */ +/* */ +/* Reads a byte from an I/O port. */ +/* */ +/* Parameters: */ +/* portId : Id or address of port */ +/* */ +/* Returns: */ +/* unsigned char : Value of I/O port */ +/*----------------------------------------------------------------------*/ + +extern unsigned char flInportb(unsigned portId); + + +/*----------------------------------------------------------------------*/ +/* f l O u t p o r t b */ +/* */ +/* Writes a byte to an I/O port. */ +/* */ +/* Parameters: */ +/* portId : Id or address of port */ +/* value : Value to write */ +/* */ +/* Returns: */ +/* None */ +/*----------------------------------------------------------------------*/ + +extern void flOutportb(unsigned portId, unsigned char value); +#endif /* FALSE */ + + +/*----------------------------------------------------------------------*/ +/* f l S w a p B y t e s */ +/* */ +/* Swap bytes in a given buffer. */ +/* */ +/* Parameters: */ +/* buf : buffer that holds bytes to swap */ +/* len : number of bytes to swap */ +/* */ +/* Returns: */ +/* None */ +/*----------------------------------------------------------------------*/ + +extern void flSwapBytes(char FAR1 *buf, int len); + + +/*----------------------------------------------------------------------*/ +/* f l A d d L o n g T o F a r P o i n t e r */ +/* */ +/* Add unsigned long offset to the far pointer */ +/* */ +/* Parameters: */ +/* ptr : far pointer */ +/* offset : offset in bytes */ +/* */ +/*----------------------------------------------------------------------*/ + +extern void FAR0* flAddLongToFarPointer(void FAR0 *ptr, unsigned long offset); + +/*----------------------------------------------------------------------*/ +/* f l F i t I n S o c k e t W i n d o w */ +/* */ +/* Check if flash array fits in socket window */ +/* */ +/* Parameters: */ +/* chipSize : long int */ +/* interleaving : int */ +/* windowSize : long int */ +/* */ +/*----------------------------------------------------------------------*/ + +extern long int flFitInSocketWindow (long int chipSize, int interleaving, + long int windowSize); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/tffs/flsystem.h b/h/tffs/flsystem.h new file mode 100644 index 0000000..c476922 --- /dev/null +++ b/h/tffs/flsystem.h @@ -0,0 +1,287 @@ +/* flsystem.h - True Flash File System */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* FAT-FTL Lite Software Development Kit + * Copyright (C) M-Systems Ltd. 1995-1997 */ + +/* +modification history +-------------------- +01a,29jul04,alr modified file header, restarted history +*/ + +#ifndef FLSYSTEM_H +#define FLSYSTEM_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/* + * signed/unsigned char + * + * It is assumed that 'char' is signed. If this is not your compiler + * default, use compiler switches, or insert a #pragma here to define this. + * + */ + +/* char is signed by default in GNU C */ + + +/* CPU target + * + * Use compiler switches or insert a #pragma here to select the CPU type + * you are targeting. + * + * If the target is an Intel 80386 or above, also uncomment the CPU_i386 + * definition. + */ + +/* defined in VxWorks makefile */ + +/* NULL constant + * + * Some compilers require a different definition for the NULL pointer + */ + +/* #include <_null.h> */ + + +/* Little-endian/big-endian + * + * FAT and FTL structures use the little-endian (Intel) format for integers. + * If your machine uses the big-endian (Motorola) format, uncomment the + * following line. + * This option needs a C++ compiler. + * Note that even on big-endian machines you may omit the BIG_ENDIAN + * definition for smaller code size and better performance, but your media + * will not be compatible with standard FAT and FTL. + */ + +/* we are using VxWorks #define _BYTE_ORDER here */ +#ifndef _BYTE_ORDER +#error "byte order is not defined" +#else /* _BYTE_ORDER */ +#if (_BYTE_ORDER == _BIG_ENDIAN) +#define TFFS_BIG_ENDIAN +#else /* (_BYTE_ORDER == _BIG_ENDIAN) */ +#undef TFFS_BIG_ENDIAN +#endif /* (_BYTE_ORDER == _BIG_ENDIAN) */ +#endif /* _BYTE_ORDER */ + + +/* Far pointers + * + * Specify here which pointers may be far, if any. + * Far pointers are usually relevant only to 80x86 architectures. + * + * Specify FAR_LEVEL: + * 0 - if using a flat memory model or having no far pointers. + * 1 - if only the socket window may be far + * 2 - if only the socket window and caller's read/write buffers + * may be far. + * 3 - if socket window, caller's read/write buffers and the + * caller's I/O request packet may be far + */ + +#define FAR_LEVEL 0 + + +/* Memory routines + * + * You need to supply library routines to copy, set and compare blocks of + * memory, internally and to/from callers. The code uses the names 'tffscpy', + * 'tffsset' and 'tffscmp' with parameters as in the standard 'memcpy', + * 'memset' and 'memcmp' C library routines. + */ + +#if FAR_LEVEL > 0 +#define tffscpy _fmemcpy +#define tffsset _fmemset +#define tffscmp _fmemcmp +#else +/* XXX +#define tffscpy sysTffsCpy +#define tffsset sysTffsSet +*/ +#define tffscpy memcpy +#define tffsset memset +#define tffscmp memcmp +#endif + +#define tffscpyWords(dest,src,nbytes) bcopyWords((char *)(src), \ + (char *)(dest), (nbytes)/2) +#define tffscpyLongs(dest,src,nbytes) bcopyLongs((char *)(src), \ + (char *)(dest), (nbytes)/4) + +extern int tffscmpWords(void *buf1, void *buf2, int nbytes); + + +/* Pointer arithmetic + * + * The following macros define machine- and compiler-dependent macros for + * handling pointers to physical window addresses. The definitions below are + * for PC real-mode Borland-C. + * + * 'physicalToPointer' translates a physical flat address to a (far) pointer. + * Note that if when your processor uses virtual memory, the code should + * map the physical address to virtual memory, and return a pointer to that + * memory (the size parameter tells how much memory should be mapped). + * + * 'addToFarPointer' adds an increment to a pointer and returns a new + * pointer. The increment may be as large as your window size. The code + * below assumes that the increment may be larger than 64 KB and so performs + * huge pointer arithmetic. + */ + +#if FAR_LEVEL > 0 +#include + +#define physicalToPointer(physical,size,drive) \ + MK_FP((int) ((physical) >> 4),(int) (physical) & 0xF) + +#define addToFarPointer(base,increment) \ + MK_FP(FP_SEG(base) + \ + ((unsigned short) ((FP_OFF(base) + (increment)) >> 16) << 12), \ + FP_OFF(base) + (int) (increment)) +#else +#define physicalToPointer(physical,size,drive) \ + ((void *) (physical)) + +#define addToFarPointer(base,increment) \ + ((void *) ((unsigned char *) (base) + (increment))) +#endif + + +/* Default calling convention + * + * C compilers usually use the C calling convention to routines (cdecl), but + * often can also use the pascal calling convention, which is somewhat more + * economical in code size. Some compilers also have specialized calling + * conventions which may be suitable. Use compiler switches or insert a + * #pragma here to select your favorite calling convention. + */ + +/* use GNU C default calling convention */ + + + +/* Mutex type + * + * If you intend to access the FLite API in a multi-tasking environment, + * you may need to implement some resource management and mutual-exclusion + * of FLite with mutex & semaphore services that are available to you. In + * this case, define here the Mutex type you will use, and provide your own + * implementation of the Mutex functions incustom.c + * + * By default, a Mutex is defined as a simple counter, and the Mutex + * functions in custom.c implement locking and unlocking by incrementing + * and decrementing the counter. This will work well on all single-tasking + * environment, as well as on many multi-tasking environments. + */ + +typedef SEM_ID FLMutex; + +#define flStartCriticalSection(mutexPtr) flTakeMutex(mutexPtr,1) +#define flEndCriticalSection(mutexPtr) flFreeMutex(mutexPtr) + + + +/* Memory allocation + * + * The translation layers (e.g. FTL) need to allocate memory to handle + * Flash media. The size needed depends on the media being handled. + * + * You may choose to use the standard 'malloc' and 'free' to handle such + * memory allocations, provide your own equivalent routines, or you may + * choose not to define any memory allocation routine. In this case, the + * memory will be allocated statically at compile-time on the assumption of + * the largest media configuration you need to support. This is the simplest + * choice, but may cause your RAM requirements to be larger than you + * actually need. + * + * If you define routines other than malloc & free, they should have the + * same parameters and return types as malloc & free. You should either code + * these routines in custom.c or include them when you link your application. + */ + +#define MALLOC_TFFS malloc +#define FREE_TFFS free + +/* isRAM fault safe write + * The function isRAM() does a direct write to verify if the location + * specified is RAM. It is possible that hardware is tailered to fault + * in such situations. + */ + +#ifdef ORIG +#define ISRAM_WRITE(src,dst) dst = src +#else /* !ORG */ +#define ISRAM_WRITE(src,dst) \ + vxMemProbe ((char *)dst, VX_WRITE, 4, (char *)&src) +#endif /* ORIG */ + +/* Pointer arithmetic + * + * The following macros define machine- and compiler-dependent macros for + * handling pointers to physical window addresses. The definitions below are + * for PC real-mode Borland-C. + * + * 'physicalToPointer' translates a physical flat address to a (far) pointer. + * Note that if when your processor uses virtual memory, the code should + * map the physical address to virtual memory, and return a pointer to that + * memory (the size parameter tells how much memory should be mapped). + * + * 'addToFarPointer' adds an increment to a pointer and returns a new + * pointer. The increment may be as large as your window size. The code + * below assumes that the increment may be larger than 64 KB and so performs + * huge pointer arithmetic. + */ + +#if FAR_LEVEL > 0 +#include + +#define physicalToPointer(physical,size,drive) \ + MK_FP((int) ((physical) >> 4),(int) (physical) & 0xF) + +/*NEW*/ #define pointerToPhysical(ptr) \ + (((unsigned long) FP_SEG(ptr) << 4) + FP_OFF(ptr)) + +#define addToFarPointer(base,increment) \ + MK_FP(FP_SEG(base) + \ + ((unsigned short) ((FP_OFF(base) + (increment)) >> 16) << 12), \ + FP_OFF(base) + (int) (increment)) +#else +#define physicalToPointer(physical,size,drive) \ + ((void *) (physical)) + +/*NEW*/ #define pointerToPhysical(ptr) ((unsigned long)(ptr)) + +#define addToFarPointer(base,increment) \ + ((void *) ((unsigned char *) (base) + (increment))) +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/tffs/fltl.h b/h/tffs/fltl.h new file mode 100644 index 0000000..501a45a --- /dev/null +++ b/h/tffs/fltl.h @@ -0,0 +1,77 @@ +/* fltl.h - True Flash File System */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* FAT-FTL Lite Software Development Kit + * Copyright (C) M-Systems Ltd. 1995-1997 */ + +/* +modification history +-------------------- +01a,29jul04,alr modified file header, restarted history +*/ + +#ifndef FLTL_H +#define FLTL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "flflash.h" + +/* See interface documentation of functions in ftllite.c */ + +typedef struct tTL TL; /* Forward definition */ +typedef struct tTLrec TLrec; /* Defined by translation layer */ + +struct tTL { + TLrec *rec; + + const void FAR0 *(*mapSector)(TLrec *, SectorNo sectorNo, CardAddress *physAddr); + FLStatus (*writeSector)(TLrec *, SectorNo sectorNo, void FAR1 *fromAddress); + FLStatus (*deleteSector)(TLrec *, SectorNo sectorNo, int noOfSectors); + void (*tlSetBusy)(TLrec *, FLBoolean); + void (*dismount)(TLrec *); + + #if defined(DEFRAGMENT_VOLUME) || defined(SINGLE_BUFFER) + FLStatus (*defragment)(TLrec *, long FAR2 *bytesNeeded); + #endif + + #ifdef FORMAT_VOLUME + SectorNo (*sectorsInVolume)(TLrec *); + #endif +}; + + +#ifdef FORMAT_VOLUME +#include "dosformt.h" +#endif + +/* Translation layer registration information */ + +extern int noOfTLs; /* No. of translation layers actually registered */ + +typedef struct { + FLStatus (*mountRoutine) (FLFlash *flash, TL *tl, FLFlash **volForCallback); +#ifdef FORMAT_VOLUME + FLStatus (*formatRoutine) (FLFlash *flash, FormatParams FAR1 *formatParams); +#endif +} TLentry; + +extern TLentry tlTable[]; + + +extern FLStatus flMount(unsigned volNo, TL *, FLFlash *); + +#ifdef FORMAT_VOLUME +extern FLStatus flFormat(unsigned, FormatParams FAR1 *formatParams); +#endif + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/h/tffs/pcic.h b/h/tffs/pcic.h new file mode 100644 index 0000000..9ce7b8a --- /dev/null +++ b/h/tffs/pcic.h @@ -0,0 +1,103 @@ +/* pcic.h - True Flash File System */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* FAT-FTL Lite Software Development Kit + * Copyright (C) M-Systems Ltd. 1995-1997 */ + +/* +modification history +-------------------- +01a,29jul04,alr modified file header, restarted history +*/ + +#ifndef PCIC_H +#define PCIC_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* ----- Equates */ + +#define BASE_PORT 0x3e0 + +#define INDEX_REG BASE_PORT +#define DATA_REG (BASE_PORT + 1) + +#define VPP_WAIT_TICK 3 /* At least 100 msec. */ + +#define NO_OF_WINDOWS 5 + +/* ----- Function index values */ + +#define IDENTIFICATION 0 +#define INTERFACE 1 +#define POWER 2 +#define INTERRUPT 3 +#define CARD_STATUS_CHANGE 4 +#define CARD_STATUS_INTERRUPT 5 +#define ADDRESS_WINDOW_ENABLE 6 +#define WINDOW_0_START_LO 0x10 +#define WINDOW_0_START_HI 0x11 +#define WINDOW_0_STOP_LO 0x12 +#define WINDOW_0_STOP_HI 0x13 +#define WINDOW_0_ADDRESS_LO 0x14 +#define WINDOW_0_ADDRESS_HI 0x15 + +/* ----- Register bit mapping */ + +/* Identification */ +#define PCIC_STEP_A 0x82 +#define PCIC_STEP_B 0x83 + +/* Interface */ +#define CARD_DETECT_1 4 +#define CARD_DETECT_2 8 +#define MEMORY_WRITE_PROTECT 0x10 +#define CARD_READY 0x20 +#define CARD_POWER_ACTIVE 0x40 +#define VPP_VALID 0x80 /* Step A only */ + +/* Power */ +#define VPP1_CONTROL 3 +#define VPP2_CONTROL 0xc +#define CARD_POWER_ENABLE 0x10 +#define AUTO_POWER_SWITCH_ENABLE 0x20 +#define DISABLE_RESUME_RESETDRV 0x40 +#define ENABLE_OUTPUTS 0x80 + +#define VPP_ON_12V 0xa +#define VPP_ON_5V 5 + +/* Interrupt */ +#define PC_CARD_TYPE 0x20 +#define PC_CARD_NOT_RESET 0x40 + +/* Card Status Change */ +#define CARD_DETECT_CHANGE 8 + +/* Card Status Interrupt */ +#define CARD_DETECT_ENABLE 8 + +/* Address Window Enable */ +#define MEMORY_WINDOW_0_ENABLE 1 +#define MEMORY_WINDOW_1_ENABLE 2 +#define MEMORY_WINDOW_2_ENABLE 4 +#define MEMORY_WINDOW_3_ENABLE 8 +#define MEMORY_WINDOW_4_ENABLE 0x10 +#define MEMCS16_DECODE 0x20 + +/* Window 0 Base Start High */ +#define DATA_16_BITS 0x80 + +/* Window 0 Address High */ +#define REG_ACTIVE 0x40 +#define WRITE_PROTECT 0x80 + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/tffs/reedsol.h b/h/tffs/reedsol.h new file mode 100644 index 0000000..d3f0aa7 --- /dev/null +++ b/h/tffs/reedsol.h @@ -0,0 +1,32 @@ +/* reedsol.h - True Flash File System */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* FAT-FTL Lite Software Development Kit + * Copyright (C) M-Systems Ltd. 1995-1997 */ + +/* +modification history +-------------------- +01a,29jul04,alr modified file header, restarted history +*/ + +#ifndef FLEDC_H +#define FLEDC_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "flbase.h" + +typedef enum { NO_EDC_ERROR, CORRECTABLE_ERROR, UNCORRECTABLE_ERROR, EDC_ERROR } EDCstatus; + +EDCstatus flCheckAndFixEDC(char FAR1 *block, char *syndrom, FLBoolean byteSwap); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/tffs/stdcomp.h b/h/tffs/stdcomp.h new file mode 100644 index 0000000..adaf8f2 --- /dev/null +++ b/h/tffs/stdcomp.h @@ -0,0 +1,59 @@ +/* stdcomp.h - True Flash File System */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* FAT-FTL Lite Software Development Kit + * Copyright (C) M-Systems Ltd. 1995-1997 */ + +/* +modification history +-------------------- +01a,29jul04,alr modified file header, restarted history +*/ + +#ifndef STDCOMP_H +#define STDCOMP_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "flbase.h" +#include "fltl.h" +#include "flflash.h" + + +/* MTD Identify Routines */ + +FLStatus amdMTDIdentify (FLFlash vol); +FLStatus i28f008Identify (FLFlash vol); +FLStatus i28f008BajaIdentify (FLFlash vol); +FLStatus i28f016Identify (FLFlash vol); +FLStatus cdsnIdentify (FLFlash vol); +FLStatus doc2Identify (FLFlash vol); +FLStatus cfiscsIdentify (FLFlash vol); +FLStatus cfiAmdIdentify (FLFlash vol); +FLStatus flwAmdMTDIdentify (FLFlash vol); + +/* TL Mount and Format Routines */ + +FLStatus mountFTL (FLFlash *flash, TL *tl, FLFlash **volForCallback); +FLStatus formatFTL (FLFlash *flash, FormatParams FAR1 *formatParams); +FLStatus mountNFTL (FLFlash *flash, TL *tl, FLFlash **volForCallback); +FLStatus formatNFTL (FLFlash *flash, FormatParams FAR1 *formatParams); +FLStatus mountSSFDC (FLFlash *flash, TL *tl, FLFlash **volForCallback); +FLStatus formatSSFDC (FLFlash *flash, FormatParams FAR1 *formatParams); + + +/*----------------------------------------------------------------------*/ +/* Component registration routine in CUSTOM.C */ +/*----------------------------------------------------------------------*/ + +void flRegisterComponents(void); + +#ifdef __cplusplus +} +#endif + +#endif /* STDCOMP_H */ diff --git a/h/tffs/tffsDrv.h b/h/tffs/tffsDrv.h new file mode 100644 index 0000000..d555047 --- /dev/null +++ b/h/tffs/tffsDrv.h @@ -0,0 +1,204 @@ +/* tffsDrv.h - TFFS FLite driver header */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01k,06may05,jb3 Add New function tffsDrvOptionsSet for Datalight +01j,29jul04,alr added (EAN) patch for device locking +01i,25jan99,yp added new function tffsDevOptionsSet()'s prototype. +01h,19jan98,hdn added new function tffsShowAll()'s prototype. +01g,06jan98,hdn added usrTffsConfig()'s prototype. +01f,06jan98,hdn changed tffsShow()'s prototype. +01e,15dec97,hdn added _ASMLANGUAGE macro. +01d,11dec97,hdn added tffsShow()'s prototype. +01c,05dec97,hdn added tffsRawio()'s function codes and prototype. +01b,07nov97,hdn cleaned up. +01a,25aug97,and written by Andray in M-Systems +*/ + +#ifndef __INCtffsDrvh +#define __INCtffsDrvh + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifndef _ASMLANGUAGE + +#include "blkIo.h" + +#define TFFS_MAX_DRIVES 5 /* same to DRIVES in flcustom.h */ + +/* function number for tffsRawio() */ + +#define TFFS_GET_PHYSICAL_INFO 0 /* get physical info */ +#define TFFS_PHYSICAL_READ 1 /* physical read */ +#define TFFS_PHYSICAL_WRITE 2 /* physical write */ +#define TFFS_PHYSICAL_ERASE 3 /* physical erase */ +#define TFFS_ABS_READ 4 /* absolute read */ +#define TFFS_ABS_WRITE 5 /* absolute write */ +#define TFFS_ABS_DELETE 6 /* absolute erase */ +#define TFFS_DEFRAGMENT_VOLUME 7 /* defragment volume */ + + +/*--------------------------------------------------------------------------*/ +/* TFFS block devices */ +/*--------------------------------------------------------------------------*/ + +#include "semLib.h" + +typedef struct + { + BLK_DEV tffsBlkdev; /* VxWorks block device descriptor */ + int tffsDriveNo; /* 0..DRIVES-1, internal FLite numbering */ + SEM_ID tffsSem; /* Device lock semaphore */ + } TFFS_DEV; + +/*---------------------------------------------------------------------------*/ +/* Formatting parameter structure definition */ +/*---------------------------------------------------------------------------*/ + +typedef struct + { + /* FTL formatting section */ + long int bootImageLen; + /* Space to reserve for a boot-image at the start of the + medium. The FLite volume will begin at the next higher + erase unit boundary */ + + unsigned percentUse; + /* FTL performance depends on how full the Flash media is, + getting slower when the media is close to 100%. It is + possible to avoid the worst consequences of this effect by + formatting the media to less than 100% capacity, so + guaranteeing some free space at all times. This of course + sacrifices some capcity. + The standard value to use is 99 */ + + unsigned noOfSpareUnits; + /* FTL needs at least one spare erase unit to function as a + read/write media (it is possible to specify 0 to achieve + WORM functionality). It is possible to specify more than + one spare unit, which costs more media space. + The advantage to doing this is in case one of the Flash + erase units becomes bad and unerasable in the future, one + of the spare units will need to replace it. A second spare + unit will then enable to continue read/write functionality + (in its absence, the media will go into read-only mode). + The standard value to use is 1 */ + + unsigned long vmAddressingLimit; + /* A part of the FTL Virtual Map always resides in RAM. The + RAM part is the one that is used to address the part of + the media below the VM addressing limit. Reading and + writing to this part is usually faster to some degree. + The downside is that the bigger the limit, the more RAM + size is required. + The minimum VM limit is 0. + The standard value to use is 0x10000 (first 64 KBytes) */ + + int (*progressCallback)(int totalUnitsToFormat, + int totalUnitsFormattedSoFar); + /* Progress callback routine, will be called if not NULL. + The callback routine is called after erasing each unit, + and its parameters are the total number of erase units + to format and the number erased so far. + The callback routine returns a Status value. A value of + OK (0) allows formatting to continue. Any other value + will abort the formatting with the returned status code. */ + + /* DOS formatting section */ + char volumeId[4]; + /* Volume identification number */ + + char * volumeLabel; + /* Volume label string. If NULL, no label */ + + unsigned noOfFATcopies; + /* It is customary to format DOS media with 2 FAT copies. + The first copy is always used, but more copies make it + possible to recover if the FAT becomes corrupted (a + rare occurrence). On the other hand, this slows down + performance and uses media space. + The standard value to use is 2 */ + + unsigned embeddedCISlength; + /* Length in bytes of CIS to embed after the unit header */ + + char * embeddedCIS; + /* The unit header is structured as a beginning of a PCMCIA + 'tuple' chain (a CIS). The unit header contains a + data-organization tuple, which points past the end of the + unit header to a location which usually just contains + hex FF's which mark an 'end-of-tuple-chain'. Optionally, + it is possible to embed an entire CIS chain at this + location. If so, 'embeddedCISlength' marks the length in + bytes */ + + } tffsFormatParams; + +/*---------------------------------------------------------------------------*/ +/* IOCTL FIODISKFORMAT structure definition */ +/*---------------------------------------------------------------------------*/ + +typedef struct + { + tffsFormatParams formatParams; + unsigned formatFlags; + } tffsDevFormatParams; + +/* values for tffsDevFormatParams.formatFlags */ + +#define FTL_FORMAT 1 /* FAT & FTL formatting */ +#define FTL_FORMAT_IF_NEEDED 2 /* FAT formatting, FTL formatting if needed */ +#define NO_FTL_FORMAT 0 /* FAT formatting only */ + +/* Standard initializer for IOCTLParams structure */ + +#define TFFS_STD_FORMAT_PARAMS {{0, 99, 1, 0x10000l, NULL, {0,0,0,0}, NULL, \ + 2, 0, NULL}, FTL_FORMAT_IF_NEEDED} + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS tffsDrv (void); +extern BLK_DEV * tffsDevCreate (int tffsDriveNo, int removableMediaFlag); +extern STATUS tffsDevFormat (int tffsDriveNo, int arg); +extern void flAnnonceDiskChange (unsigned volNo); +extern void tffsShowAll (void); +extern void tffsShow (int driveNo); +extern STATUS tffsRawio (int tffsDriveNo, int functionNo, int arg0, + int arg1, int arg2); +extern STATUS tffsDevOptionsSet (TFFS_DEV * pTffsDev); +extern STATUS tffsDrvOptionsSet (int tffsDriveNo); +extern STATUS usrTffsConfig (int drive, int removable, char * fileName); + + + +#else /* __STDC__ */ + +extern STATUS tffsDrv (); +extern BLK_DEV * tffsDevCreate (); +extern STATUS tffsDevFormat (); +extern void flAnnonceDiskChange (); +extern void tffsShowAll (); +extern void tffsShow (); +extern STATUS tffsRawio (); +extern STATUS tffsDevOptionsSet (); +extern STATUS usrTffsConfig (); + +#endif /* __STDC__ */ + + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtffsDrvh */ diff --git a/h/tftpLib.h b/h/tftpLib.h new file mode 100644 index 0000000..cb9e06d --- /dev/null +++ b/h/tftpLib.h @@ -0,0 +1,224 @@ +/* tftpLib.h - vxWorks Trival File Transfer protocol header file */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,24may02,vvv replaced GNU_PACKED with _WRS_PACK_ALIGN +01i,19jan01,scm ARM - add gnu compiler work around for pragma 1... +01h,09oct97,nbs modified TFTP_DESC to include the file name + in the request, spr # 9413 +01g,22sep92,rrr added support for c++ +01f,18sep92,jcf added include of netinet/in.h. +01e,04jul92,jcf cleaned up. +01d,15jun92,elh changed retransmission time. +01c,26may92,rrr the tree shuffle +01b,29feb92,elh ansified. + incorperated changes done by jmm for server. +01a,19Jul91,elh written. +*/ + +#ifndef __INCtftpLibh +#define __INCtftpLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "netinet/in.h" + +/* defines */ + +/* TFTP constant values. */ + +#define TFTP_SEGSIZE 512 /* data segment size */ +#define TFTP_FILENAME_SIZE 128 /* max length of */ + /* filename */ +#define TFTP_ACK_SIZE 4 /* size of ack message */ +#define TFTP_DATA_HDR_SIZE 4 /* header size */ +#define TFTP_TIMEOUT 2 /* secs between rexmt's */ +#define TFTP_PORT 69 /* tftp default port */ + +#define TFTP_CLIENT 0 +#define TFTP_SERVER 1 + +/* TFTP Op Codes/packet types */ + +#define TFTP_RRQ 01 /* read request */ +#define TFTP_WRQ 02 /* write request */ +#define TFTP_DATA 03 /* data packet */ +#define TFTP_ACK 04 /* acknowledgement */ +#define TFTP_ERROR 05 /* error packet */ + +/* + TFTP message formats are: + + +Type Op # Format without header + + 2 bytes string 1 byte string 1 byte + ------------------------------------------ +TFTP_RRQ/ | [01|02]| filename | 0 | mode | 0 | +TFTP_WRQ ------------------------------------------ + + 2 bytes 2 bytes n bytes + --------------------------- +TFTP_DATA | 03 | block # | data | + --------------------------- + + 2 bytes 2 bytes + ------------------ +TFTP_ACK | 04 | block #| + ------------------ + + 2 bytes 2 bytes string 1 byte + ------------------------------------- +TFTP_ERROR | 05 | ErrorCode | ErrMsg | 0 | + ------------------------------------- +*/ + +#if CPU_FAMILY==I960 +#pragma align 1 /* don't to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +#if (defined __arm__) +#define TFTP_PACKED _WRS_PACK_ALIGN(1) +#else +#define TFTP_PACKED +#endif + +/* TFTP packet structure. */ + +struct tftpFormat + { + u_short blockOrError; + char data [TFTP_SEGSIZE]; + } TFTP_PACKED; + +typedef struct tftp_msg + { + u_short th_opcode; /* packet op code */ + union + { + char request [TFTP_SEGSIZE + 2]; /* request string */ + struct tftpFormat misc; + } TFTP_PACKED th; + } TFTP_MSG; + +#if CPU_FAMILY==I960 +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + + +/* useful defines to access the TFTP packet */ + +#define th_request th.request /* request string */ +#define th_block th.misc.blockOrError /* block number */ +#define th_error th.misc.blockOrError /* error code */ +#define th_errMsg th.misc.data /* error message */ +#define th_data th.misc.data /* data */ + + +/* TFTP defined error codes. */ + +#define EUNDEF 0 /* not defined */ +#define ENOTFOUND 1 /* file not found */ +#define EACCESS 2 /* access violation */ +#define ENOSPACE 3 /* disk full */ +#define EBADOP 4 /* illegal operation */ +#define EBADID 5 /* unknown transfer ID */ +#define EEXISTS 6 /* file already exists */ +#define ENOUSER 7 /* no such user */ + +/* mode structure */ + +typedef struct tftp_mode + { + char *m_name; /* mode name */ + char *m_mode; /* mode type */ + } TFTP_MODE; + +/* error structure */ + +typedef struct tftp_errmsg + { + int e_code; /* error code */ + char *e_msg; /* error message */ + } TFTP_ERRMSG; + +/* TFTP descriptor */ + +typedef struct tftp_desc + { + char mode [32]; /* mode */ + BOOL connected; /* state */ + char serverName [128]; /* server ascii name */ + struct sockaddr_in serverAddr; /* server address */ + int sock; /* socket */ + u_short serverPort; /* server port number */ + char fileName [TFTP_FILENAME_SIZE]; /* requested file name */ + } TFTP_DESC; + +/* TFTP task defaults */ + +#define TFTP_TASK_PRIORITY 70 /* TFTP task priority */ +#define TFTP_TASK_OPTIONS 0 /* TFTP task options */ +#define TFTP_TASK_STACKSIZE 7000 /* TFTP stack size */ + +/* tftpLib error values */ + +#define S_tftpLib_INVALID_ARGUMENT (M_tftpLib | 1) +#define S_tftpLib_INVALID_DESCRIPTOR (M_tftpLib | 2) +#define S_tftpLib_INVALID_COMMAND (M_tftpLib | 3) +#define S_tftpLib_INVALID_MODE (M_tftpLib | 4) +#define S_tftpLib_UNKNOWN_HOST (M_tftpLib | 5) +#define S_tftpLib_NOT_CONNECTED (M_tftpLib | 6) +#define S_tftpLib_TIMED_OUT (M_tftpLib | 7) +#define S_tftpLib_TFTP_ERROR (M_tftpLib | 8) + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS tftpXfer (char * pHost, int port, char * pFilename, + char * pCommand, char * pMode, int * pDataDesc, + int * pErrorDesc); +extern STATUS tftpCopy (char * pHost, int port, char * pFilename, + char * pCommand, char * pMode, int fd); +extern TFTP_DESC *tftpInit (void); +extern STATUS tftpModeSet (TFTP_DESC * pTftpDesc, char * pMode); +extern STATUS tftpPeerSet (TFTP_DESC * pTftpDesc, char * pHostname, + int port); +extern STATUS tftpPut (TFTP_DESC *pTftpDesc, char *pFilename, int fd, + int clientOrServer); +extern STATUS tftpGet (TFTP_DESC *pTftpDesc, char *pFilename, int fd, + int clientOrServer); +extern STATUS tftpInfoShow (TFTP_DESC * pTftpDesc); +extern STATUS tftpQuit (TFTP_DESC * pTftpDesc); +extern int tftpSend (TFTP_DESC *pTftpDesc, TFTP_MSG *pTftpMsg, int sizeMsg, + TFTP_MSG *pTftpReply, int opReply, int blockReply, + int *pPort); +extern int tftpErrorCreate (TFTP_MSG * pTftpMsg, int errorNum); + +#else /* __STDC__ */ + +extern STATUS tftpXfer (); +extern STATUS tftpCopy (); +extern TFTP_DESC *tftpInit (); +extern STATUS tftpModeSet (); +extern STATUS tftpPeerSet (); +extern STATUS tftpPut (); +extern STATUS tftpGet (); +extern STATUS tftpInfoShow (); +extern STATUS tftpQuit (); +extern int tftpSend (); +extern int tftpErrorCreate (); + +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtftpLibh */ diff --git a/h/tftpdLib.h b/h/tftpdLib.h new file mode 100644 index 0000000..fb655ab --- /dev/null +++ b/h/tftpdLib.h @@ -0,0 +1,65 @@ +/* tftpdLib.h - vxWorks Trival File Transfer protocol header file */ + +/* Copyright 1992-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01b,26may92,rrr the tree shuffle + -changed includes to have absolute path from h/ +01a,06Feb92,jmm written. +*/ + +#ifndef __INCtftpdLibh +#define __INCtftpdLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "lstLib.h" +#include "ioLib.h" +#include "netinet/in.h" +#include "tftpLib.h" + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct tftpd_dir + { + NODE node; + char dirName [MAX_FILENAME_LENGTH]; + } TFTPD_DIR; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS tftpdInit (int stackSize, int nDirectories, + char ** directoryNames, BOOL noControl, + int maxConnections); +extern STATUS tftpdTask (int nDirectories, char ** directoryNames, + int maxConnections); +extern STATUS tftpdDirectoryAdd (char *fileName); +extern STATUS tftpdDirectoryRemove (char *fileName); + +#else /* __STDC__ */ + +extern STATUS tftpdInit (); +extern STATUS tftpdTask (); +extern STATUS tftpdDirectoryAdd (); +extern STATUS tftpdDirectoryRemove (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtftpdLibh */ diff --git a/h/tickLib.h b/h/tickLib.h new file mode 100644 index 0000000..631e147 --- /dev/null +++ b/h/tickLib.h @@ -0,0 +1,47 @@ +/* tickLib.h - header file for tickLib.c */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +02e,05aug05,jln added tickAnnounceHookAdd() +02d,31jan05,kk add tick64[GS]et() APIs (SPR# 105938) +02c,22may02,jgn removed vxTicks and vxAbsTicks declarations - SPR #70255 +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01a,05oct90,shl created. +*/ + +#ifndef __INCtickLibh +#define __INCtickLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +extern void tickAnnounce (void); +extern void tickSet (ULONG ticks); +extern ULONG tickGet (void); +extern void tick64Set (UINT64 ticks); +extern UINT64 tick64Get (void); +extern STATUS tickAnnounceHookAdd (FUNCPTR pFunc); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtickLibh */ diff --git a/h/time.h b/h/time.h new file mode 100644 index 0000000..69387e7 --- /dev/null +++ b/h/time.h @@ -0,0 +1,164 @@ +/* time.h - POSIX time header */ + +/* + * Copyright (c) 1992-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01o,18aug05,mcm Merging contents of timeCommon.h with time.h. +01n,01mar05,gls moved _POSIX macro definitions to limits.h (SPR #105358) + removed _POSIX_INTERVAL_MAX definition +01m,04dec03,pad Further re-arrangement of content with share/timeCommon.h +01l,02dec03,ans removed ANSI C definition. +01k,01oct03,ans Rearranged contents with share/h/timeCommon.h. +01j,00oct00,sn Removed defns of size_t etc. +01i,17feb99,mrs Add C++ support for NULL, (SPR #25079). +01h,13aug96,dbt modifed comment for tm_sec (SPR #4436). + Updated copyright. +01g,02jul96,dbt added #include "vxWorks.h" (SPR #4370). +01f,14jul94,dvs changed def of CLOCKS_PER_SEC to sysClkRateGet() (SPR# 2486). +01f,29nov93,dvs folded in timers.h, made draft 14 POSIX compliant +01e,15oct92,rrr silenced warnings. +01d,22sep92,rrr added support for c++ +01c,31jul92,gae added undef of _TYPE_timer_t. +01b,27jul92,gae added _TYPE_timer_t, CLOCK_REALTIME, TIMER_ABSTIME. +01a,22jul92,smb written + +rrr +*/ + +#ifndef __INCtimeh +#define __INCtimeh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + +#include "types/vxANSI.h" +#include "sigevent.h" +#include "objLib.h" +#include "limits.h" + +#ifndef NULL +#if defined __GNUG__ +#define NULL (__null) +#else +#if !defined(__cplusplus) && 0 +#define NULL ((void*)0) +#else +#define NULL (0) +#endif +#endif +#endif + +#ifdef _TYPE_timer_t +_TYPE_timer_t; +#undef _TYPE_timer_t +#endif + +#ifdef _TYPE_clock_t +_TYPE_clock_t; +#undef _TYPE_clock_t +#endif + +#ifdef _TYPE_time_t +_TYPE_time_t; +#undef _TYPE_time_t +#endif + +typedef int clockid_t; + +#define CLOCKS_PER_SEC sysClkRateGet() + +#define CLOCK_REALTIME 0x0 /* system wide realtime clock */ +#define TIMER_ABSTIME 0x1 /* absolute time */ +#define TIMER_RELTIME (~TIMER_ABSTIME) /* relative time */ + +struct timespec + { + /* interval = tv_sec*10**9 + tv_nsec */ + time_t tv_sec; /* seconds */ + long tv_nsec; /* nanoseconds (0 - 1,000,000,000) */ + }; + +struct itimerspec + { + struct timespec it_interval; /* timer period (reload value) */ + struct timespec it_value; /* timer expiration */ + }; + +struct tm + { + int tm_sec; /* seconds after the minute - [0, 59] */ + int tm_min; /* minutes after the hour - [0, 59] */ + int tm_hour; /* hours after midnight - [0, 23] */ + int tm_mday; /* day of the month - [1, 31] */ + int tm_mon; /* months since January - [0, 11] */ + int tm_year; /* years since 1900 */ + int tm_wday; /* days since Sunday - [0, 6] */ + int tm_yday; /* days since January 1 - [0, 365] */ + int tm_isdst; /* Daylight Saving Time flag */ + }; + +/* function declarations */ + +extern uint_t _clocks_per_sec(void); +extern char * asctime (const struct tm *_tptr); +extern clock_t clock (void); +extern char * ctime (const time_t *_cal); +extern double difftime (time_t _t1, time_t _t0); +extern struct tm * gmtime (const time_t *_tod); +extern struct tm * localtime (const time_t *_tod); +/* function declarations */ + +extern int timer_create (clockid_t clock_id, struct sigevent *evp, + timer_t *ptimer); +extern int timer_delete (timer_t timerid); +extern int timer_gettime (timer_t timerid, struct itimerspec *value); +extern int timer_settime (timer_t timerid, int flags, + const struct itimerspec *value, + struct itimerspec *ovalue); +extern int timer_getoverrun (timer_t timerid); + +extern int timer_connect (timer_t timerid, VOIDFUNCPTR routine, int arg); +extern int timer_cancel (timer_t timerid); +extern int nanosleep (const struct timespec *rqtp, struct timespec *rmtp); +extern timer_t timer_open (const char * name, int mode, clockid_t clockId, + struct sigevent * evp, void * context); +extern STATUS timer_close (timer_t timerId); +extern STATUS timer_unlink (const char * name); + +extern int clock_gettime (clockid_t clock_id, struct timespec *tp); +extern int clock_settime (clockid_t clock_id, const struct timespec *tp); +extern int clock_getres (clockid_t clock_id, struct timespec *res); + +extern time_t mktime (struct tm *_tptr); +extern size_t strftime (char *_s, size_t _n, const char *_format, + const struct tm *_tptr); +extern time_t time (time_t *_tod); + +extern int timer_show (timer_t timerid); +extern STATUS timer_modify (timer_t timerId, struct sigevent * pSigev); + +#if _EXTENSION_POSIX_REENTRANT /* undef this for ANSI */ + +extern int asctime_r(const struct tm *_tm, char *_buffer, + size_t *_buflen); +extern char * ctime_r (const time_t *_cal, char *_buffer, size_t *_buflen); +extern int gmtime_r (const time_t *_tod, struct tm *_result); +extern int localtime_r (const time_t *_tod, struct tm *_result); + +#endif /* _EXTENSION_POSIX_REENTRANT */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtimeh */ diff --git a/h/timers.h b/h/timers.h new file mode 100644 index 0000000..f6f25c0 --- /dev/null +++ b/h/timers.h @@ -0,0 +1,41 @@ +/* timers.h - POSIX time header */ + +/* Copyright 1991-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02f,29nov93,dvs moved code to time.h +02e,30sep92,smb corrected STDC prototype listing. +02d,22sep92,rrr added support for c++ +02c,22jul92,gae fixed clock_id types; more POSIXy. +02b,25jul92,smb moves contents of time.h to timers.h. +02a,04jul92,jcf cleaned up. +01d,26may92,rrr the tree shuffle +01c,30apr92,rrr some preparation for posix signals. +01b,10feb91,gae revised according to DEC review. + defined sigevent and sigval structures according to Draft; + added ENOSYS errno here, temporarily; + flagged definitions in wrong location with xPOSIX. +01a,16oct91,gae written. +*/ + +/* +DESCRIPTION +This file provides header information for the POSIX time interface definitions. +*/ + +#ifndef __INCtimersh +#define __INCtimersh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "time.h" + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtimersh */ diff --git a/h/timexLib.h b/h/timexLib.h new file mode 100644 index 0000000..14349b2 --- /dev/null +++ b/h/timexLib.h @@ -0,0 +1,65 @@ +/* timexLib.h - header for execution timer facilities */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01e,26may92,rrr the tree shuffle +01d,04oct91,rrr passed through the ansification filter + -changed VOID to void + -changed copyright notice +01c,19oct90,shl changed timexFunc(), etc, to use variable length argument list. +01b,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01a,10aug90,dnw written +*/ + +#ifndef __INCtimexLibh +#define __INCtimexLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void timex (FUNCPTR func, int arg1, int arg2, int arg3, int arg4, + int arg5, int arg6, int arg7, int arg8); +extern void timexClear (void); +extern void timexFunc (int i, FUNCPTR func, int arg1, int arg2, int arg3, + int arg4, int arg5, int arg6, int arg7, int arg8); +extern void timexHelp (void); +extern void timexInit (void); +extern void timexN (FUNCPTR func, int arg1, int arg2, int arg3, int arg4, + int arg5, int arg6, int arg7, int arg8); +extern void timexPost (int i, FUNCPTR func, int arg1, int arg2, int arg3, + int arg4, int arg5, int arg6, int arg7, int arg8); +extern void timexPre (int i, FUNCPTR func, int arg1, int arg2, int arg3, + int arg4, int arg5, int arg6, int arg7, int arg8); +extern void timexShow (void); + +#else /* __STDC__ */ + +extern void timex (); +extern void timexClear (); +extern void timexFunc (); +extern void timexHelp (); +extern void timexInit (); +extern void timexN (); +extern void timexPost (); +extern void timexPre (); +extern void timexShow (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtimexLibh */ diff --git a/h/tipc/sm_media.h b/h/tipc/sm_media.h new file mode 100644 index 0000000..9e7e352 --- /dev/null +++ b/h/tipc/sm_media.h @@ -0,0 +1,75 @@ +/* sm_media.h - TIPC Shared Memory bearer external definitions */ + +/* Copyright (c) 2005 Wind River Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * Neither the names of the copyright holders nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* +modification history +-------------------- +01c,14apr05,bwa updated following code review. +01b,14apr05,als added licensing info; removed unneeded prototypes +01a,15fev05,bwa written. +*/ + +#ifndef __INCsm_mediah +#define __INCsm_mediah + +#ifdef __cplusplus +extern "C" { +#endif + +#include "smLib.h" +#include "smPktLib.h" + +/* types */ + +typedef struct _smTipcMediaInt /* interrupt type and arguments */ + { /* ---------------------------- */ + int type; /* 0x00: interrupt type */ + int arg1; /* 0x04: interupts argument #1 */ + int arg2; /* 0x08: interupts argument #2 */ + int arg3; /* 0x0c: interupts argument #3 */ + } SM_TIPC_MEDIA_INT; /* 0x10: TOTAL SIZE */ + +/* prototypes */ + +extern void smTipcMediaPktHdrSetup (const SM_ANCHOR * pAnchor); +extern STATUS smTipcMediaHeartbeatSetup (const int timeout); +extern STATUS smTipcMediaDriverSetup ( SM_ANCHOR * pAnchor, + const SM_TIPC_MEDIA_INT * pSmInt, + const int cpu, + const unsigned int qlen, + const int numbuf, + const int instance); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCsm_mediah */ + diff --git a/h/tipc/tipc.h b/h/tipc/tipc.h new file mode 100644 index 0000000..9e2b876 --- /dev/null +++ b/h/tipc/tipc.h @@ -0,0 +1,684 @@ +/* ------------------------------------------------------------------------ + * + * tipc.h + * + * Short description: TIPC header file + * + * ------------------------------------------------------------------------ + * + * Copyright (c) 2003, Ericsson Research Canada + * Copyright (c) 2004, 2005 Wind River Systems, Inc. + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * Neither the names of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * ------------------------------------------------------------------------ + * + * Created 2003-10-20 by Jon Maloy + * + * ------------------------------------------------------------------------ + * + * Revision history: + * ---------------- + * + * PA1 2003-10-20 Jon Maloy Created. + * + * ------------------------------------------------------------------------ + * modification history + * -------------------- + * 01j,12may05,als update AF_TIPC to avoid conflict with AF_ATM + * 01i,08apr05,als consolidate copyright info; fix compiler inlining warnings + * 01h,08feb05,bwa added shared memory address type. + * 01g,15dec04,als add support for poll()-like events + * 01f,25oct04,als fix comment + * 01e,05oct04,als Fix misleading comment + * 01d,14sep04,als name table display enhancements + * 01c,03sep04,als incorporated code inspection feedback + * 01b,07aug04,p_r code update + * 01a,30jun04,als Ported to VxWorks + * + */ + +#ifndef __NET_TIPC_H_ +#define __NET_TIPC_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* Scalar data types used by TIPC (WRS) */ + +typedef unsigned char __u8, unchar; +typedef char __s8; +typedef unsigned short __u16; +typedef short __s16; +typedef unsigned int __u32, uint; +typedef int __s32; + + +/* + * TIPC addressing primitives + * + * (Uses macros rather than inline functions to avoid compiler warnings) + */ +struct tipc_portid { + __u32 ref; + __u32 node; +}; + +struct tipc_name { + __u32 type; + __u32 instance; +}; + +struct tipc_name_seq { + __u32 type; + __u32 lower; + __u32 upper; +}; + +#define tipc_addr(Z,C,N) (((Z)<<24)|((C)<<12)|(N)) +#define tipc_zone(A) ((A)>> 24) +#define tipc_cluster(A) (((A) >> 12) & 0xfff) +#define tipc_node(A) ((A) & 0xfff) + + +/* + * Binding scopes for port names and port name sequences: + */ +#define TIPC_ZONE_SCOPE 1 +#define TIPC_CLUSTER_SCOPE 2 +#define TIPC_NODE_SCOPE 3 + +/* + * Message importance levels: + */ +#define TIPC_LOW_IMPORTANCE 0 /* default importance level */ +#define TIPC_NORMAL_IMPORTANCE 1 /* actually means "medium importance" */ +#define TIPC_HIGH_IMPORTANCE 2 +#define TIPC_NON_REJECTABLE 3 + +/* + * Topology event values: + */ +#define TIPC_PUBLISHED 1 +#define TIPC_WITHDRAWN 2 +#define TIPC_SUBSCR_TIMEOUT 3 + +/* + * Msg rejection/connection shutdown reasons: + */ +#define TIPC_CONN_SHUTDOWN 0x0010 +#define TIPC_ERR_NO_NAME 0x1000 +#define TIPC_ERR_NO_PORT 0x2000 +#define TIPC_ERR_NO_NODE 0x4000 +#define TIPC_ERR_OVERLOAD 0x8000 + + +#define TIPC_MAX_MSG_SIZE 66000 +#define TIPC_MAX_SECTION_COUNT 128 + +/* + * Socket interface: + * ----------------- + */ + +#ifndef AF_TIPC +#define AF_TIPC 33 +#endif + +#define TIPC_ADDR_NAMESEQ 1 +#define TIPC_ADDR_MCAST 1 +#define TIPC_ADDR_NAME 2 +#define TIPC_ADDR_ID 3 + + +struct sockaddr_tipc { + unsigned char addrlen; /* 16 (WRS only) */ + unsigned char family; /* AF_TIPC */ + unsigned char addrtype; /* TIPC_ADDR_xxx */ + unsigned char scope; /* used with bind */ + union { + struct tipc_portid id; /* if TIPC_ADDR_ID */ + struct tipc_name_seq nameseq; /* if TIPC_ADDR_NAMESEQ/_MCAST */ + struct { /* if TIPC_ADDR_NAME */ + struct tipc_name name; + __u32 domain; /* used with connect, sendto */ + } name; + } addr; +}; + +/* + * Poll events from TIPC sockets. May be combined with + * previously defined reject/shutdown reasons + */ +#define TIPC_MSG_PENDING 0x0041 /* POLLRDNORM|POLLIN */ +#define TIPC_UNDELIVERED_MSG 0x0049 /* POLLRDNORM|POLLERR|POLLIN */ +#define TIPC_CONN_ABORT 0x0018 /* POLLHUP|POLLERR */ +#define TIPC_TOPOLOGY_EVENT 0x0800 + +/* + * Parameters for getsockopt() and setsockopt(): + */ +#define SOL_TIPC 50 +#define IMPORTANCE_OPTION 127 /* Default: LOW_IMPORTANCE */ +#define UNRELIABLE_OPTION 128 /* Default: reliable,no args */ +#define O_NONBLOCK_OPTION 129 /* Default: blocking read */ +#define CONN_ACK_TIMEOUT 130 /* Default: 8000 ms */ +#define TIPC_POLLEVENTS 131 /* Get/clear poll() events (get only) */ + +/* + * TIPC topology services definitions. + * + * Subscriptions fire repeatedly on any event until cancelled or + * until the timeout expires. Need not be cancelled after timeout. + * + * Details about a fired/expired subscription MUST be obtained + * using the GET_EVENT command or BLOCK_GET_EVENT command (WRS only). + * + * Availability of nodes is obtained by using the special "type" 0: + * e.g. == <0,tipc_addr(z,c,0),tipc_addr(z,c,0xfff)> + */ + +struct tipc_subscr { + struct tipc_name_seq seq; + __u32 timeout; /* [ms] */ + __u32 ref; + __u32 all; /* All events, or available/unavailable */ + char usr_handle[8]; +}; +#define TIPC_SUBSCRIBE 300 /* ioctl(tipc_subscr*) */ +#define TIPC_UNSUBSCRIBE 301 /* ioctl(tipc_subscr.ref) */ +#define TIPC_WAIT_FOREVER ~0 + +struct tipc_event { + __u32 event; + __u32 found_lower; + __u32 found_upper; + struct tipc_portid port; + struct tipc_subscr s; +}; +#define TIPC_GET_EVENT 173 /* ioctl(tipc_event*) */ +#define TIPC_BLOCK_GET_EVENT 182 /* ioctl(tipc_event*) (WRS only) */ + +/* + * Blocking subscription for availability of port name. + * No cancelling needed. + */ +struct tipc_block_subscr{ + struct tipc_name name; + unsigned int timeout; + int is_published; /* Return value */ +}; + +#define TIPC_BLOCK_SUBSCRIBE 175 /* Takes tipc_block_subscr* */ + +/* + * More ioctls: + */ +#define TIPC_OWN_NODE 177 /* Takes __u32* */ +#define TIPC_UNBIND 178 /* Takes tipc_name_seq* or zero */ + +#if 0 /* NOT SUPPORTED BY WRS */ +#define TIPC_CONNECT 179 /* Local connect. Takes sockaddr_tipc* */ +#define TIPC_DISCONNECT 180 /* Local disconnect. */ +#endif + +#define TIPC_GET_DEST_ADDR 181 /* Destination of received msg. + Takes sockaddr_tipc* */ + +#if 0 /* NOT SUPPORTED BY WRS */ +/* + * Flag for SOCK_SEQPACKET/recv(): return and consume pending + * message if it fits into the buffer. Otherwise put pending msg + * length into the first four bytes of buffer and return 0 + */ +#define MSG_PEEP 0x8000 +#endif + +/* + * Port interface: + * -------------- + */ + +__u32 tipc_own_node(void); + +/* + * Return codes: + */ +#define TIPC_OK 0 +#define TIPC_FAILURE -22 +#define TIPC_CONGESTION -2 + + +struct tipc_msg_section { + unsigned char const *data; + unsigned int size; +}; + +#define TIPC_NOT_RUNNING 0 +#define TIPC_NODE_MODE 1 +#define TIPC_NET_MODE 2 + +typedef void (*tipc_mode_event) (void *usr_handle, + int mode, + __u32 addr); + +int tipc_attach(unsigned int *userref, + tipc_mode_event, void *usr_handle); + +void tipc_detach(unsigned int userref); + +int tipc_get_mode(void); + +typedef void (*tipc_conn_shutdown_event) (void *usr_handle, + __u32 portref, + unsigned char const *data, + unsigned int size, + int reason, + void **buf); + +typedef void (*tipc_msg_err_event) (void * usr_handle, + __u32 portref, + unsigned char const *data, + unsigned int size, + struct tipc_portid const *attmpt_destid, + int reason, + void **buf); + +typedef void (*tipc_named_msg_err_event) (void * usr_handle, + __u32 portref, + unsigned char const *data, + unsigned int size, + struct tipc_name_seq const *attmpt_dest, + int reason, + void **buf); + +typedef void (*tipc_msg_event) (void * usr_handle, + __u32 portref, + unsigned char const *data, + unsigned int size, + struct tipc_portid const *origin, + unsigned int importance, + void **buf); + +typedef void (*tipc_named_msg_event) (void *usr_handle, + __u32 portref, + unsigned char const *data, + unsigned int size, + struct tipc_portid const *orig, + struct tipc_name_seq const *dest, + unsigned int importance, + void **buf); + +typedef void (*tipc_conn_msg_event) (void *usr_handle, + __u32 portref, + unsigned char const *data, + unsigned int size, + void **buf); + +typedef void (*tipc_continue_event) (void *usr_handle, __u32 portref); + +int tipc_createport(unsigned int tipc_user, + void * usr_handle, + unsigned int importance, + tipc_msg_err_event error_cb, + tipc_named_msg_err_event named_error_cb, + tipc_conn_shutdown_event conn_error_cb, + tipc_msg_event message_cb, + tipc_named_msg_event named_message_cb, + tipc_conn_msg_event conn_message_cb, + tipc_continue_event continue_event_cb,/* May be zero */ + __u32 *portref); + +int tipc_deleteport(__u32 portref); + +int tipc_ownidentity(__u32 portref, struct tipc_portid *port); + +int tipc_portimportance(__u32 portref, unsigned int *importance); + +int tipc_set_portimportance(__u32 portref, + unsigned int importance); + +int tipc_set_unreliable(__u32 portref); + +int tipc_publish(__u32 portref, + unsigned int scope, + struct tipc_name_seq const *); + +int tipc_withdraw(__u32 portref, + struct tipc_name_seq const *); /* 0: all */ + +int tipc_connect2port(__u32 portref, + struct tipc_portid const *port); + +int tipc_disconnect(__u32 portref); + +int tipc_shutdown(__u32 ref); /* Sends SHUTDOWN msg */ + +int tipc_isconnected(__u32 portref, int *isconnected); + +int tipc_peer(__u32 portref, struct tipc_portid *peer); + +int tipc_ref_valid(__u32 portref); + +int tipc_send(__u32 portref, + unsigned int section_count, + struct tipc_msg_section const *msg); + +int tipc_send_buf(__u32 ref, + void *buf, + uint size); + +int tipc_send2name(__u32 portref, + struct tipc_name const *name, + __u32 domain, /* 0:own zone */ + unsigned int section_count, + struct tipc_msg_section const *msg); + +int tipc_send_buf2name(__u32 ref, + struct tipc_name const *name, + __u32 domain, + void *buf, + uint size); + +int tipc_send2port(__u32 portref, + struct tipc_portid const *dest, + unsigned int section_count, + struct tipc_msg_section const *msg); + +int tipc_send_buf2port(__u32 ref, + struct tipc_portid const *dest, + void *buf, + uint size); + +int tipc_forward2name(__u32 portref, + struct tipc_name const *name, + __u32 domain, /*0: own zone */ + unsigned int section_count, + struct tipc_msg_section const *msg, + struct tipc_portid const *origin, + unsigned int importance); + +int tipc_forward2port(__u32 portref, + struct tipc_portid const *dest, + unsigned int section_count, + struct tipc_msg_section const *msg, + struct tipc_portid const *origin, + unsigned int importance); + + +int +tipc_multicast(__u32 portref, + struct tipc_name_seq const *seq, + __u32 domain, /* 0:own zone */ + unsigned int section_count, + struct tipc_msg_section const *msg); + +int +tipc_multicast_buf(__u32 portref, + struct tipc_name_seq const *seq, + __u32 domain, /* 0:own zone */ + void *buf, + uint size); +/* + * Subscriptions: + */ + +typedef void (*tipc_subscr_event) (void *usr_handle, + __u32 subscr_ref, + unsigned int event, + unsigned int type, + unsigned int found_lower, + unsigned int found_upper); + +int tipc_subscribe(__u32 user, + void *usr_handle, + unsigned int type, + unsigned int lower, + unsigned int upper, + unsigned int timeout, + unsigned int all, + tipc_subscr_event event_cb, + __u32 * ref); + +int tipc_unsubscribe(__u32 subscr_ref); + +int tipc_ispublished(struct tipc_name const *name); + +unsigned int tipc_available_nodes(const __u32 scope); + + +/* + * Build interface: (WRS only) + * --------------- + */ + +struct tipc_media_descr { + int type; /* media type identifier */ + VOIDFUNCPTR start; /* media initialization routine */ + VOIDFUNCPTR stop; /* media termination routine */ + char * name; /* prefix string ("xyz:") */ + int priority; /* default priority */ +}; + +/* + * Management interface: + * -------------------- + * + * Integers and addresses below are in network byte order. + * Character arrays are zero-terminated strings. + * Send with size = sizeof(struct tipc_command_msg) + */ + +#define TIPC_MAGIC 0x54495043 +#define MAX_BEARER_NAME 48 +#define MAX_LINK_NAME 72 + +#define ETH_ADDR 0 +#define SOCKADDR_IPV4 1 +#define SOCK_DESCR 2 +#define SM_ADDR 3 + +struct tipc_media_addr { + __u32 type; + union{ + struct { + __u16 sin_family; + __u16 sin_port; + struct { + __u32 s_addr; + }sin_addr; + char pad[4]; + }addr_in; + __u8 eth_addr[6]; + __u16 sock_descr; + __u32 sm; /* 0-20, 0xbbbbbbbb broadcast, WRS-specific */ + }dev_addr; +}; + + +struct tipc_enable_bearer_argv { + __u32 priority; /* Range [1,31]. Override per link */ + __u32 detect_scope; + char name[MAX_BEARER_NAME]; /* Format \0 */ +}; + +struct tipc_create_link_argv { + __u32 domain; + struct tipc_media_addr peer_addr; + char bearer_name[MAX_BEARER_NAME]; +}; + +struct tipc_config_link_argv { + __u32 value; /* priority/tolerance/window */ + char name[MAX_LINK_NAME]; +}; + +struct tipc_get_name_table_argv { + __u32 depth; /* 1:type, 2:+port name, 3:+port id, 4+:+debug info */ + __u32 type; /* 0:all types, unless lowbound or upbound nonzero */ + __u32 lowbound; /* low=0,up=0:all instances, low>0,up=0:low only */ + __u32 upbound; /* low>0,up>=low:from low to up, low>0,up. May also be called + * via the mangement connection. + */ +#define TIPC_GET_PORT_STATISTICS 100u /* arg: port ref */ +#define TIPC_RESET_PORT_STATISTICS 101u /* arg: port ref */ +#define TIPC_GET_NODES 102u /* arg: domain */ +#define TIPC_GET_LINKS 103u /* arg: domain */ +#define TIPC_GET_ROUTES 104u /* arg: domain */ +#define TIPC_GET_LINK_STATISTICS 105u /* arg: link name */ +#define TIPC_RESET_LINK_STATISTICS 106u /* arg: link name */ +#define TIPC_GET_PEER_ADDRESS 107u /* arg: link name */ +#define TIPC_GET_NAME_TABLE 108u /* tipc_get_name_table_argv */ +#define TIPC_GET_BEARERS 109u /* no arg */ +#define TIPC_GET_MEDIA 110u /* no arg */ +#define TIPC_GET_PORTS 111u /* no arg */ + +/* + * Command Group 2: + * "Risky" commands: The first call must be an TIPC_ESTABLISH, + * sent to <0,address> as above. Upon receiving the confirmation + * the new connection is used for subsequent commands. + * There may only exist one such connection per node at any + * time, so by holding on this connection the manager process + * can exclude other users from changing the configuration values. + * The commands return an empty (result_len == 0) confirmation + * message when successful. + */ + +#define TIPC_ESTABLISH 200u /* Send first. No arg */ +#define TIPC_CREATE_LINK 201u /* tipc_create_link_argv */ +#define TIPC_REMOVE_LINK 202u /* arg: link name */ +#define TIPC_BLOCK_LINK 203u /* arg: link name */ +#define TIPC_UNBLOCK_LINK 204u /* arg: link name */ +#define TIPC_SET_LINK_TOLERANCE 205u /* tipc_config_link_argv */ +#define TIPC_SET_LINK_PRIORITY 206u /* tipc_config_link_argv */ +#define TIPC_SET_LINK_WINDOW 207u /* tipc_config_link_argv */ +#define TIPC_ENABLE_BEARER 208u /* arg: tipc_enable_bearer_argv */ +#define TIPC_DISABLE_BEARER 209u /* arg: bearer name */ + + +/* + * Command Group 3: + * Subscriptions: Establishes a connection associated to + * the subscription, confirmed by an empty response message. + * Thereafter a message is received each time the subsription fires. + * Sending any message over the connection or deleting the + * socket/port causes the subscription to be cancelled. + * Timed-out subscriptions also abort the connection. + * Link events are associated with a link name string. + */ + +#define TIPC_NAME_SUBSCRIBE 300u +#define TIPC_LINK_SUBSCRIBE 302u + +/* + * Command Group 4: + * ioctls which can be done on any socket: + */ +#define TIPC_SET_OWN_NODE 400u /* arg: __u32 */ +#define TIPC_ENABLE_REMOTE_MNG 401u /* no argument */ +#define TIPC_DISABLE_REMOTE_MNG 402u /* no argument */ +#define TIPC_SET_MAX_PORTS 403u /* arg: integer */ +#define TIPC_GET_MAX_PORTS 404u /* no argument */ +#define TIPC_SET_MAX_PUBLICATIONS 405u /* arg: integer */ +#define TIPC_GET_MAX_PUBLICATIONS 406u /* no argument */ +#define TIPC_SET_MAX_SUBSCRIPTIONS 407u /* arg: integer */ +#define TIPC_GET_MAX_SUBSCRIPTIONS 408u /* no argument */ +#define TIPC_SET_MAX_ZONES 409u /* arg: integer */ +#define TIPC_GET_MAX_ZONES 410u /* no argument */ +#define TIPC_SET_MAX_CLUSTERS 411u /* arg: integer */ +#define TIPC_GET_MAX_CLUSTERS 412u /* no argument */ +#define TIPC_SET_MAX_NODES 413u /* arg: integer */ +#define TIPC_GET_MAX_NODES 414u /* no argument */ +#define TIPC_SET_MAX_SLAVES 415u /* arg: integer */ +#define TIPC_GET_MAX_SLAVES 416u /* no argument */ +#define TIPC_SET_NET_ID 417u /* arg: integer */ +#define TIPC_GET_NET_ID 418u /* no argument */ +#define TIPC_SET_BCAST_THRESHOLD 419u /* arg: integer */ +#define TIPC_GET_BCAST_THRESHOLD 420u /* no argument */ + + +struct tipc_cmd_msg { + __u32 magic; + __u32 cmd; + char usr_handle[8]; + union { + __u32 port_ref; + __u32 domain; + struct tipc_create_link_argv create_link; + struct tipc_config_link_argv config_link; + char link_name[72]; + struct tipc_enable_bearer_argv enable_bearer; + char bearer_name[32]; + struct tipc_get_name_table_argv get_name_table; + struct tipc_subscr subscr; + } argv; +}; + +#define VAR_ARRAY_SIZE 1 + +struct tipc_node_info { + int up; + __u32 addr; +}; + +struct tipc_route_info { + __u32 dest; + __u32 router; +}; + +struct tipc_link_info { + __u32 up; + __u32 dest; + char str[MAX_LINK_NAME]; +}; + +struct tipc_cmd_result_msg { + __u32 cmd; /* The original command */ + char usr_handle[8]; + int retval; + __u32 remains; /* If more messages to follow */ + __u32 result_len; /* In this message */ + union { + struct tipc_media_addr peer_address; + struct tipc_event event; + struct tipc_node_info nodes[VAR_ARRAY_SIZE]; + struct tipc_route_info routes[VAR_ARRAY_SIZE]; + struct tipc_link_info links[VAR_ARRAY_SIZE]; + char str[VAR_ARRAY_SIZE]; + } result; +}; + +#endif diff --git a/h/tool/common/defs.arm b/h/tool/common/defs.arm new file mode 100644 index 0000000..3e1d659 --- /dev/null +++ b/h/tool/common/defs.arm @@ -0,0 +1,35 @@ +# defs.arm - ARM specific definitions shared by all toolchains +# +# modification history +# -------------------- +# 01b,10dec03,yvp Added ABI_SPEC. +# 01a,18dec01,to written +# +# DESCRIPTION +# This file contains ARM specific definitions and flags to be +# shared by all toolchains. +# +# NOTE +# The file name comes from defs.$(VX_CPU_FAMILY) +# + +TOOLENV = arm +VX_CPU_FAMILY = arm +ARCH_DIR = arm +ABI_SPEC = arm + +ROM_ENTRY = romInit +USR_ENTRY = usrInit +SYS_ENTRY = sysInit + +ifeq ($(findstring be,$(TOOL)),be) +# definitions for big endian +DEFINE_CC = -DARMEB +OBJCOPY_OLD_OMF = -O coff-arm-big +else +# definitions for little endian +DEFINE_CC = -DARMEL +OBJCOPY_OLD_OMF = -O coff-arm-little +endif + +# end of defs.arm diff --git a/h/tool/common/defs.common b/h/tool/common/defs.common new file mode 100644 index 0000000..56b3ee7 --- /dev/null +++ b/h/tool/common/defs.common @@ -0,0 +1,68 @@ +# defs.common - arch independent definitions shared by all toolchains +# +# modification history +# -------------------- +# 01f,05jul04,fle Remove VMA_START value, it is defined in defs.memory +# 01e,05apr04,mcm Fix for SPR 95829 - defining a new macro LD_LINK_TOOL_DIR +# to help set the path for Diab C++ libraries. +# 01d,22jan04,zmm Move definitions of ROM_ENTRY, SYS_ENTRY and USR_ENTRY +# from defs.diab and defs.gnu here. Use HLL_PREFIX so that +# prepended underscores could be redefined in +# architecture/toolchain fragments. +# 01c,09jan04,c_c Removed automatic version search (SPR #92774). +# 01b,08dec03,tpw Eliminate use of --ignore-vma from .hex builds. +# 01b,14nov03,c_c Added compiler root path definition. +# 01a,29oct01,tpw created. +# +# DESCRIPTION +# This file contains architecture independent definitions and flags to be +# shared by all toolchains. +# + +# compute the path for compiler. This path is dependent of the toolchain +# version, which is located under WIND_BASE/host/TOOL_FAMILY/version. + +CC_ROOT = $(WIND_BASE)/host/$(TOOL_FAMILY) + +# Determine CC_BASE (can be overriden from the command line or later) +CC_BASE = $(CC_ROOT)/$(CC_VERSION) + +# Determine CC_BIN_DIR +CC_BIN_DIR = $(CC_BASE)/$(CC_HOST)/bin + +# Toolchain specific CPU variant independent library directory +LD_LINK_TOOL_DIR = $(TGT_DIR)/lib/$(VX_CPU_FAMILY)/$(CPU)/$(TOOL) + +## macros for file conversion and rom image builds + +EXTRACT_BIN_FLAG= -O binary --binary-without-bss +EXTRACT_HEX_FLAG= -O srec --gap-fill=0 +EXTRACT_SYM_FLAG= --extract-symbol + +START_FLAGS = +HEX_FLAGS = + +NO_VMA_FLAGS = -I srec -O binary +VMA_FLAGS = -I binary -O srec --adjust-vma=$(VMA_START) + +## bsp flags + +HLL_PREFIX = _ + +ROM_ENTRY = $(HLL_PREFIX)romInit +SYS_ENTRY = $(HLL_PREFIX)sysInit +USR_ENTRY = $(HLL_PREFIX)usrInit + +# linker scripts data alignment + +LD_DATA_SEG_NOALIGN = $(strip $(LD_DATA_SEG_ALIGN_FLAG))=1 + +# VMA adjust macros + +KERNEL_VMA_ADJUST = @ $(NOP) + +## obsolete macros + +EXTRACT_BIN_NAME= false Used obsolete EXTRACT_BIN_NAME macro +BINXSYM_NAME = false Used obsolete BINXSYM_NAME macro +BINHEX_NAME = false Used obsolete BINHEX_NAME macro diff --git a/h/tool/common/defs.mips b/h/tool/common/defs.mips new file mode 100644 index 0000000..88a234a --- /dev/null +++ b/h/tool/common/defs.mips @@ -0,0 +1,121 @@ +# defs.mips - MIPS specific definitions shared by all toolchains +# +# modification history +# -------------------- +# 01j,22mar05,rlg Added _rm9xxx variant. +# 01i,17feb05,pes Added _mti24kx variant. +# 01h,15nov04,agf Removed variants not being shipped for v6.0 +# 01g,20jul04,fle Added KERNEL_VMA_ADJUST definition +# 01f,06apr04,yvp Moved ABI_SPEC into h/tool/diab/make.MIPS* +# 01e,10dec03,yvp Added ABI_SPEC. +# 01d,13nov03,c_c Added CPU VARIANT definitions. +# 01c,31mar03,sn append to rather than overwrite LD_LINK_PATH_EXTRA +# to allow other contributions (e.g. from defs.diab) +# 01b,16jan02,pes Define LD_LINK_PATH_EXTRA +# 01a,09jan02,pes written +# +# DESCRIPTION +# This file contains MIPS specific definitions and flags to be +# shared by all toolchains. +# +# NOTE +# The file name comes from defs.$(VX_CPU_FAMILY) +# +# CPU VARIANTS +# To compile part of the source tree for a CPU variant, first a tag must be +# defined with which archive directory names are modified. In addition several +# variables must be defined for each CPU variant build. Refer to the example +# further below for more details. Note that CPU variant builds are normaly +# started automatically at the end of the corresponding generic CPU build. +# + + +ifeq ($(findstring le,$(TOOL)),le) +DEFINE_CC += -DMIPSEL +CFLAGS_AS += -DMIPSEL +else +DEFINE_CC += -DMIPSEB +CFLAGS_AS += -DMIPSEB +endif + +ifeq ($(findstring sf,$(TOOL)),sf) +# definitions for soft float +DEFINE_CC += -DSOFT_FLOAT +CFLAGS_AS += -DSOFT_FLOAT +endif + +ifeq ($(findstring r3k,$(TOOL)),r3k) +# needed for r3k exception handling +DEFINE_CC += -D_WRS_R3K_EXC_SUPPORT +CFLAGS_AS += -D_WRS_R3K_EXC_SUPPORT +endif + +TOOLENV = mips +VX_CPU_FAMILY = mips +ARCH_DIR = mips + +## bsp flags +ROM_ENTRY = romInit +SYS_ENTRY = sysInit +USR_ENTRY = usrInit + +LD_LINK_PATH_EXTRA += \ + -L$(TGT_DIR)/lib/$(VX_CPU_FAMILY)/$(CPU)/$(TOOL)$(CPU_VARIANT) \ + -L$(TGT_DIR)/lib/$(VX_CPU_FAMILY)/$(CPU)/$(TOOL_COMMON_DIR)$(CPU_VARIANT) + +# override kernel vma adjust tool + +KERNEL_VMA_ADJUST = $(BIN_DIR)/mipsBootPrep + +## CPU variants builds +# +# For CPU variants builds, the name of the directory(ies) where archives are +# installed is appended with a unique tag defined by LIB_DIR_TAG. The make +# variable CPU_VARIANT_LIST define the whole list of these CPU variant tags +# and should be updated everytime a new CPU variant build is introduced. For +# instance: +# CPU_VARIANT_LIST = _cpuVariant1 _cpuVariant2 _cpuVariant3 + +CPU_VARIANT_LIST = _bcm125x \ + _mti4kx \ + _mti5kx \ + _mti24kx \ + _tx49xx \ + _vr55xx \ + _rm9xxx \ + +# Each CPU variant build must define the following variables: +# +# - VX_ARCHIVE_LIST$(LIB_DIR_TAG): this is the list of archive(s) to +# build for this CPU variant. Note that $(LIB_DIR_TAG) must be equal +# to one of the item defined in CPU_VARIANT_LIST. For instance: +# VX_ARCHIVE_LIST_cpuVariant1 = libarch.a libdrv.a +# +# - CPU_VARIANT_CPU_TOOL_LIST$(LIB_DIR_TAG): this is the list of +# CPU/TOOL combination(s) for which the CPU variant build must be +# run. For instance: +# CPU_VARIANT_CPU_TOOL_LIST_cpuVariant2 = MIPS32diab MIPS64diab +# +# NOTE: CPU variant build(s) are kicked off by the default build rule +# in target/h/make/rules.library. + +VX_ARCHIVE_LIST_bcm125x = libarch.a +VX_ARCHIVE_LIST_mti4kx = libarch.a +VX_ARCHIVE_LIST_mti5kx = libarch.a +VX_ARCHIVE_LIST_mti24kx = libarch.a +VX_ARCHIVE_LIST_tx49xx = libarch.a +VX_ARCHIVE_LIST_vr55xx = libarch.a +VX_ARCHIVE_LIST_rm9xxx = libarch.a + +CPU_VARIANT_CPU_TOOL_LIST_bcm125x = MIPS64diab MIPS64diable +CPU_VARIANT_CPU_TOOL_LIST_mti4kx = MIPS32sfdiab MIPS32sfdiable +CPU_VARIANT_CPU_TOOL_LIST_mti5kx = MIPS32sfdiab MIPS32sfdiable \ + MIPS64diab MIPS64diable +CPU_VARIANT_CPU_TOOL_LIST_mti24kx = MIPS32sfdiab MIPS32sfdiable +CPU_VARIANT_CPU_TOOL_LIST_tx49xx = MIPS32sfdiab MIPS32sfdiable \ + MIPS64diab MIPS64diable +CPU_VARIANT_CPU_TOOL_LIST_vr55xx = MIPS32sfdiab MIPS32sfdiable \ + MIPS64diab MIPS64diable +CPU_VARIANT_CPU_TOOL_LIST_rm9xxx = MIPS64diab MIPS64diable + +#end of defs.mips diff --git a/h/tool/common/defs.ppc b/h/tool/common/defs.ppc new file mode 100644 index 0000000..254c7fb --- /dev/null +++ b/h/tool/common/defs.ppc @@ -0,0 +1,266 @@ +# defs.ppc - PPC specific definitions shared by all toolchains +# +# modification history +# -------------------- +# 01p,15sep05,jlb Add CPU_CLASS macro set to PPC32 +# 01o,18jul05,dtr _e500v2 cpu variant added. +# 01n,04apr05,kkz removing PPC970 until it is shippable +# 01p,25mar05,dtr Add in 83xx and g2le CPU_VARIANT. +# 01o,10feb05,pch Add _ppc970. +# 01n,12nov04,dtr Adding in _ppc860 CPU variant. +# 01m,26jul04,pch SPR 99846: Add support for _745x variant +# 01l,02jun04,mil Removed libaim.a after consolidated into PPC32. +# 01k,10may04,mil Added libaim.a for ppc440, ppc60x and ppc85XX. +# 01j,09apr04,rec add PPC970 +# 01i,05apr04,mcm Fix for SPR 95829 - added a new macro to help set the path +# for Diab C++ libraries. Also fixed the assignments to +# LD_LINK_PATH_ATEND and LD_LINK_PATH_EXTRA to use += +# 01h,04mar04,pch temporarily disable ppc860 build +# 01g,03mar04,mil Added PPC85XX. +# 01f,04feb04,pch PPC32 floating-point adjustments +# *** mention of libhwdb.a in variants of PPC32 is temporary +# *** until it supports runtime selection among single-step, +# *** emulation using breakpoints, and hands-off mode. +# 01e,19dec03,kab Add 440gx diab support +# 01d,10dec03,yvp Added ABI_SPEC. +# 01c,19nov03,c_c Added VX_CPU_FAMILY definition here. +# 01b,30jan03,pch add LD_LINK_PATH_ATEND to support generic build +# 01a,12dec02,pch written +# +# DESCRIPTION +# This file contains PPC specific definitions and flags +# to be shared by all toolchains. +# +# NOTE +# The file name comes from defs.$(VX_CPU_FAMILY) +# + +## map TOOL to TOOL_FAMILY, if not already done + +ifeq ($(TOOL_FAMILY),) +ifeq ($(findstring gnu,$(TOOL)),gnu) +TOOL_FAMILY = gnu +else +ifeq ($(findstring diab,$(TOOL)),diab) +TOOL_FAMILY = diab +endif +endif +endif + +include $(TGT_DIR)/h/tool/$(TOOL_FAMILY)/defs.$(TOOL_FAMILY) + +TOOLENV = ppc +VX_CPU_FAMILY = ppc +ARCH_DIR = ppc +ABI_SPEC = ppc +CPU_CLASS = PPC32 + +ifeq ($(LIB_DIR_TAG),) + # We are not already building a variant, so set up variant lists + # for those processors which support them. + ifeq ($(CPU),PPC440) + # Base PPC440 supports the 440x4 core, used in the PPC440GP. + # The _x5 variant supports the 440x5 core, used in the PPC440GX, + # which has a separate exception class for Machine Check. + CPU_VARIANT_LIST = _x5 + VX_ARCHIVE_LIST_x5 = libarch.a + CPU_VARIANT_CPU_TOOL_LIST_x5 = PPC440diab PPC440gnu + endif + ifeq ($(CPU),PPC85XX) + # Base PPC85XX supports the e500v2 core, used in the + # PPC8540/8560/8555/8541. + # The _e500v2 variant supports the e500v2 core, used in the MPC8548, + # which has extended addressing for MMU and data cache flush assist. + CPU_VARIANT_LIST = _e500v2 + VX_ARCHIVE_LIST_e500v2 = libarch.a + CPU_VARIANT_CPU_TOOL_LIST_e500v2 = PPC85XXsfdiab PPC85XXsfgnu + endif + + ifeq ($(CPU),PPC604) + # Base PPC604 supports 604, 604e, 750, 750CX, 750FX, 755, 7400, 7410. + # The _745x variant supports the MPC745x family, which have different + # synchronization requirements, mostly involving HID0 and MSR. + CPU_VARIANT_LIST = _745x + VX_ARCHIVE_LIST_745x = libarch.a + CPU_VARIANT_CPU_TOOL_LIST_745x = PPC604diab PPC604gnu + endif + + ifeq ($(CPU),PPC603) + # Base PPC603 support 603,603e, 826x, 827x, 828x, 824x. + CPU_VARIANT_LIST = _83xx _g2le + VX_ARCHIVE_LIST_83xx = libarch.a + # The _83xx variant supports the MPC83xx family, which have different + # cache sizes and support for additional secondary functionality + CPU_VARIANT_CPU_TOOL_LIST_83xx = PPC603diab PPC603gnu + # The _g2le variant supports the next generation of the MPC82xx family + # which have additional functionality beyond 603 core + VX_ARCHIVE_LIST_g2le = libarch.a + CPU_VARIANT_CPU_TOOL_LIST_g2le = PPC603diab PPC603gnu + endif + + ifeq ($(CPU),PPC32) + # Variants of PPC32 are the same as the old PPC CPU names, but + # in lower case and with a leading underscore. Each variant is + # built with either the hard- or soft-float TOOLs, as appropriate. + # The 440 is built both ways, because it is supported both with + # and without its optional FPU. + + CPU_VARIANT_LIST = _ppc403 _ppc405 _ppc440 _ppc440_x5 \ + _ppc603 _ppc603_83xx _ppc603_g2le _ppc604 \ + _ppc604_745x _ppc85XX _ppc85XX_e500v2 \ + _ppc860 _ppc970 + + VX_ARCHIVE_LIST_ppc403 = libarch.a libhwdb.a + CPU_VARIANT_CPU_TOOL_LIST_ppc403 = PPC32sfdiab PPC32sfgnu + VX_ARCHIVE_LIST_ppc405 = libarch.a libhwdb.a + CPU_VARIANT_CPU_TOOL_LIST_ppc405 = PPC32sfdiab PPC32sfgnu + VX_ARCHIVE_LIST_ppc440 = libarch.a libhwdb.a + CPU_VARIANT_CPU_TOOL_LIST_ppc440 = PPC32diab PPC32gnu \ + PPC32sfdiab PPC32sfgnu + VX_ARCHIVE_LIST_ppc440_x5 = libarch.a libhwdb.a + CPU_VARIANT_CPU_TOOL_LIST_ppc440_x5 = PPC32diab PPC32gnu \ + PPC32sfdiab PPC32sfgnu + VX_ARCHIVE_LIST_ppc603 = libarch.a libhwdb.a + CPU_VARIANT_CPU_TOOL_LIST_ppc603 = PPC32diab PPC32gnu + + VX_ARCHIVE_LIST_ppc603_83xx = libarch.a libhwdb.a + CPU_VARIANT_CPU_TOOL_LIST_ppc603_83xx = PPC32diab PPC32gnu + + VX_ARCHIVE_LIST_ppc603_g2le = libarch.a libhwdb.a + CPU_VARIANT_CPU_TOOL_LIST_ppc603_g2le = PPC32diab PPC32gnu + + VX_ARCHIVE_LIST_ppc604 = libarch.a libhwdb.a + CPU_VARIANT_CPU_TOOL_LIST_ppc604 = PPC32diab PPC32gnu + VX_ARCHIVE_LIST_ppc604_745x = libarch.a libhwdb.a + CPU_VARIANT_CPU_TOOL_LIST_ppc604_745x = PPC32diab PPC32gnu + VX_ARCHIVE_LIST_ppc860 = libarch.a libhwdb.a + CPU_VARIANT_CPU_TOOL_LIST_ppc860 = PPC32sfdiab PPC32sfgnu + VX_ARCHIVE_LIST_ppc85XX = libarch.a libhwdb.a + CPU_VARIANT_CPU_TOOL_LIST_ppc85XX = PPC32sfdiab PPC32sfgnu + + VX_ARCHIVE_LIST_ppc85XX_e500v2 = libarch.a libhwdb.a + CPU_VARIANT_CPU_TOOL_LIST_ppc85XX_e500v2 = PPC32sfdiab PPC32sfgnu + VX_ARCHIVE_LIST_ppc970 = libarch.a libhwdb.a + CPU_VARIANT_CPU_TOOL_LIST_ppc970 = PPC32diab PPC32gnu + + PPC32VARIANT= + endif + +else + # LIB_DIR_TAG set => this is a library build for a CPU variant. + + ifeq ($(CPU),PPC32) + # Remap LIB_DIR_TAG to CPU for CPP, and remember type number + # for use in setting TGT_FLAG or CC_ARCH_SPEC. + ifeq ($(LIB_DIR_TAG),_ppc440_x5) + DEFINE_CC += -UCPU -DCPU=PPC440 -DCPU_VARIANT=_x5 + PPC32VARIANT=440 + else + ifeq ($(LIB_DIR_TAG),_ppc604_745x) + DEFINE_CC += -UCPU -DCPU=PPC604 -DCPU_VARIANT=_745x + PPC32VARIANT=604 + else + ifeq ($(LIB_DIR_TAG),_ppc603_83xx) + DEFINE_CC += -UCPU -DCPU=PPC603 -DCPU_VARIANT=_83xx + PPC32VARIANT=603 + else + ifeq ($(LIB_DIR_TAG),_ppc603_g2le) + DEFINE_CC += -UCPU -DCPU=PPC603 -DCPU_VARIANT=_g2le + PPC32VARIANT=603 + else + ifeq ($(LIB_DIR_TAG),_ppc85XX_e500v2) + DEFINE_CC += -UCPU -DCPU=PPC85XX -DCPU_VARIANT=_e500v2 + PPC32VARIANT=85XX + else + DEFINE_CC += -UCPU -DCPU=$(LIB_DIR_TAG:_ppc%=PPC%) + PPC32VARIANT=$(LIB_DIR_TAG:_ppc%=%) + endif + endif + endif + endif + endif + else + DEFINE_CC += -DCPU_VARIANT=$(LIB_DIR_TAG) + endif + +endif + +# BSP builds for CPU variants set CPU_VARIANT +ifneq ($(CPU_VARIANT),) + + DEFINE_CC += -DCPU_VARIANT=$(CPU_VARIANT) + + # prepended to the "normal" link path + LD_LINK_PATH_EXTRA += \ + -L$(TGT_DIR)/lib/$(VX_CPU_FAMILY)/$(CPU)/$(TOOL)$(CPU_VARIANT) \ + -L$(TGT_DIR)/lib/$(VX_CPU_FAMILY)/$(CPU)/$(TOOL_COMMON_DIR)$(CPU_VARIANT) + + # variants of PPC32 need CPP's "CPU" redefined and the type number saved + # as for LIB_DIR_TAG, so that the BSP can build processor-specific code; + # but use ADDED_CFLAGS instead of DEFINE_CC so that the project builder + # will pick up the redefinition. + ifeq ($(CPU),PPC32) + ifeq ($(CPU_VARIANT),_ppc440_x5) + ADDED_CFLAGS += -UCPU -DCPU=PPC440 -UCPU_VARIANT -DCPU_VARIANT=_x5 + PPC32VARIANT=440 + else + ifeq ($(CPU_VARIANT),_ppc604_745x) + ADDED_CFLAGS += -UCPU -DCPU=PPC604 -UCPU_VARIANT -DCPU_VARIANT=_745x + PPC32VARIANT=604 + else + ifeq ($(CPU_VARIANT),_ppc603_83xx) + ADDED_CFLAGS += -UCPU -DCPU=PPC603 -UCPU_VARIANT -DCPU_VARIANT=_83xx + PPC32VARIANT=603 + else + ifeq ($(CPU_VARIANT),_ppc603_g2le) + ADDED_CFLAGS += -UCPU -DCPU=PPC603 -UCPU_VARIANT -DCPU_VARIANT=_g2le + PPC32VARIANT=603 + else + ifeq ($(CPU_VARIANT),_ppc85XX_e500v2) + ADDED_CFLAGS += -UCPU -DCPU=PPC85XX -UCPU_VARIANT -DCPU_VARIANT=_e500v2 + PPC32VARIANT=85XX + else + ADDED_CFLAGS += -UCPU -DCPU=$(CPU_VARIANT:_ppc%=PPC%) + PPC32VARIANT=$(CPU_VARIANT:_ppc%=%) + endif + endif + endif + endif + endif + endif + +endif + +# Legacy BSP compatibility: old BSP's specify CPU=PPC603 etc. and possibly a +# CPU_VARIANT relative to the specified CPU. Hard or soft float is implicit +# in the CPU setting rather than being specified as part of the TOOL. These +# legacy settings require no special handling for compilation, which gets the +# correct settings from the make.$(CPU)$(TOOL) files; but the link search path +# needs to be adjusted to find libarch.a in its new location. + +# If specified CPU is not PPC32, look in PPC32 (appropriate variant first, +# then base, both under appropriate TOOL depending on CPU) for anything not +# found in the specified variant or CPU. These go at the end of the link path. +ifneq ($(CPU),PPC32) + VAR_OF_32=$(CPU:PPC%=_ppc%)$(CPU_VARIANT) + SF_32= + ifneq ($(CPU),PPC603) + ifneq ($(CPU),PPC604) + ifneq ($(CPU),PPC970) +ifneq ($(findstring sf,$(TOOL)),sf) + SF_32=sf +endif + endif + endif + endif + # The LD_LINK_TOOL_DIR macro is used by defs.diab to set the path + # for the C++ libraries + LD_LINK_TOOL_DIR = $(TGT_DIR)/lib/$(VX_CPU_FAMILY)/PPC32/$(SF_32)$(TOOL) + LD_LINK_PATH_ATEND += \ + -L$(LD_LINK_TOOL_DIR)$(VAR_OF_32) \ + -L$(TGT_DIR)/lib/$(VX_CPU_FAMILY)/PPC32/$(SF_32)$(TOOL_COMMON_DIR)$(VAR_OF_32) \ + -L$(LD_LINK_TOOL_DIR) \ + -L$(TGT_DIR)/lib/$(VX_CPU_FAMILY)/PPC32/$(SF_32)$(TOOL_COMMON_DIR) +endif + +# end of defs.ppc diff --git a/h/tool/common/ldscripts/genScript.sh b/h/tool/common/ldscripts/genScript.sh new file mode 100644 index 0000000..d32cfa7 --- /dev/null +++ b/h/tool/common/ldscripts/genScript.sh @@ -0,0 +1,341 @@ +#!/bin/sh + +# genScript.sh +# +# a shell script to generate linker scripts. +# +# TODO: +# 1. convenience labels like etext, edata, end, and wrs_kernel_*_{start,end} +# are primarily used by ROM kernels and can most likely be omitted from RAM +# kernels. But they're harmless and it makes script sharing easier. +# 2. "classic" convenience labels (etext/edata/end) should be phased out in +# favor of the newer ones. Further, DAT has requested that we make the new +# names conform to wrsInitialCapitals style. +# 3. Due to the template generation strategy employed here, the final output +# may look a little awkwardly formatted and certainly is not as clean and +# simple as the early versions of the Diab scripts. Suggestions welcome. +# I actually think this might not be such a bad application for (gasp!) Tcl, +# so a future Tcl rewrite (which also helps windows users) is possible. +# 4. Currently GNU aligns everything to 16. This is probably overkill on many +# chips, and especially once everyone is ELF, the internal section alignment +# should take care of things -- except for convenience labels which need to +# guarantee 4 byte alignment for use with copyLongs and fillLongs. +# 5. General convergence... + +mod_history() +{ +cat <<'EOF' +/* +modification history +-------------------- +01r,25aug05,dlk Support .text.init, .text.fast, .data.init, .data.fast. +01r,29jul05,slk SPR 104264: fix MIPS romResident images +01q,06may05,rlg changes for MIPS specific devices +01p,03jul04,f_b Improved support for data alignment +01o,12dec03,sn added more .rodata.str1.* handlers +01n,04dec03,sn Diab: .rodata.* is not handled correctly by Diab linker; instead + use specific names +01m,28oct03,sn Diab: collapse .rodata.cst* sections into .rodata +01l,29may02,tpw Diab: pad out sections, needed for MIPS byteswap. SPR 78076 +01k,24apr02,sn GNU: SPR 75835 - added support for relocatable script link.OUT +01j,19apr02,tpw Diab: provide _etext for ColdFire. SPR 75122 +01i,06feb02,sn Both: place .got2 to handle tramp.o (_x_gnu_tramp.o). +01h,25jan02,tpw GNU: give debug sections explicit 0 addresses. +01g,14jan02,tpw Diab: place .eh_frame data, in case of insistent GNU objects. +01f,14dec01,tpw Diab: provide both underscore options of wrs_kernel* here too. +01e,05dec01,tpw Both: Add .boot and .reset section support, for PPC 4xx series + and Book E. +01d,05dec01,tpw Diab: Add .frame_info section to text region. +01c,03dec01,jab Diab: replaced LOAD() with AT() +01b,14nov01,tpw ALL: Correct some more bootrom/kernel issues. +01b,06nov01,tpw GNU: Add /DISCARD/ directive to discard uninteresting sections +01a,01nov01,tpw gnu script written +01a,29oct01,jab diab script written +*/ + +EOF +} + +filename="$1" +TOOL="$2" +shift 2 +style="$*" + +align=16 +am1=`expr $align - 1` + +bind="" +[ "$TOOL" = diab ] && bind=BIND +dot_boot_text=" + .boot $bind(wrs_kernel_text_start + wrs_kernel_rom_size - 0x800) : + { + *(.boot) + } + .reset $bind(wrs_kernel_text_start + wrs_kernel_rom_size - 4) : + { + *(.reset) + } +" + +bind="" +[ "$TOOL" = diab ] && bind=BIND +kseg0data_text=" + .kseg0data $bind((_VX_START_TEXT - 0x7e00) & 0xbfffffff) : + { + *(.kseg0data) + } +" + +bind="" +[ "$TOOL" = diab ] && bind=BIND +kseg0data_data=" + .kseg0data $bind((_VX_START_DATA - 0x7e00) & 0xbfffffff) : + { + *(.kseg0data) + } +" + +diab_data_group_text=" } + GROUP BIND(_VX_START_DATA) : {" + +diab_data_group_aligned=" } + GROUP BIND((etext + _VX_DATA_ALIGN - 1) & -_VX_DATA_ALIGN) : {" + +gnu_data_group_aligned=" . = ALIGN(_VX_DATA_ALIGN);" + +named_debug_sections=" + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) }" + +rom_at="" +dot_boot="" +kseg0data="" +gnu_data_group="" +diab_data_group="" + +zero="" +wrs_kernel_text_start="wrs_kernel_text_start = .; _wrs_kernel_text_start = .;" +wrs_kernel_text_fast="wrs_kernel_text_fast = .; _wrs_kernel_text_fast = .;" +wrs_kernel_text_init="wrs_kernel_text_init = .; _wrs_kernel_text_init = .;" +wrs_kernel_text_end="wrs_kernel_text_end = .; _wrs_kernel_text_end = .;" +etext="etext = .; _etext = .;" +wrs_kernel_data_start="wrs_kernel_data_start = .; _wrs_kernel_data_start = .;" +wrs_kernel_data_fast="wrs_kernel_data_fast = .; _wrs_kernel_data_fast = .;" +wrs_kernel_data_init="wrs_kernel_data_init = .; _wrs_kernel_data_init = .;" +wrs_kernel_data_end="wrs_kernel_data_end = .; _wrs_kernel_data_end = .;" +edata="edata = .; _edata = .;" +wrs_kernel_bss_start="wrs_kernel_bss_start = .; _wrs_kernel_bss_start = .;" +wrs_kernel_bss_end="wrs_kernel_bss_end = .; _wrs_kernel_bss_end = .;" +end="end = .; _end = .;" + +gp_mips_diab="_gp = ((. + $am1) & ~$am1) + 0x7ff0;" +gp_mips_gnu="_gp = ALIGN(16) + 0x7ff0; /* set gp for MIPS startup code */" + +sec_align_diab=". = ((. + 3) & ~3);" +sec_align_gnu=". = ALIGN($align);" + +for arg +do + case "$arg" in + AOUT) named_debug_sections="" ;; + ROM) diab_data_group="$diab_data_group_text" ; + if [ "$kseg0data" != "" ]; then + kseg0data="$kseg0data_data" + fi + rom_at=" AT(etext)" ;; + RAM) gnu_data_group="$gnu_data_group_aligned" ; + diab_data_group="$diab_data_group_aligned" ;; + DOTBOOT) dot_boot="$dot_boot_text" ;; + MIPS) kseg0data="$kseg0data_text" ;; + OUT) zero="0" + wrs_kernel_text_start="" + wrs_kernel_text_fast="" + wrs_kernel_text_init="" + wrs_kernel_text_end="" + etext="" + wrs_kernel_data_start="" + wrs_kernel_data_fast="" + wrs_kernel_data_init="" + wrs_kernel_data_end="" + edata="" + wrs_kernel_bss_start="" + wrs_kernel_bss_end="" + end="" + gp_mips_gnu="" + gp_mips_diab="" + sec_align_gnu="" + sec_align_diab="" + ;; + *) echo "$0: '$arg' unknown." 1>&2 ; exit 1 ;; + esac +done + +cat <&2 +echo Usage: $0 '[-update] TOOL' 1>&2 +exit 1 +} + +[ -z "$1" ] && usage + +dash_update=no +if [ "X-update" = "X$1" ]; then + dash_update=yes + shift +fi + +TOOL="$1" +shift + +[ -n "$*" ] && usage Extra junk after TOOL argument: "$*" + +if [ -z "$WIND_BASE" ]; then + echo $0: 'No value for $WIND_BASE set.' 1>&2 + exit 1 +fi + +TGT_DIR=$WIND_BASE/target +GEN_DIR=$TGT_DIR/h/tool/common/ldscripts +GEN_SH=$GEN_DIR/genScript.sh + +# regen_one_file > +regen_one_file () +{ + # TODO keep blank lines we do want but + # get rid of blank lines we don't want! + sh $GEN_SH "$@" #| sed '/^[ ]*$/d' +} + +regen () +{ +variant="$1" + +suffix=`echo "$variant" | tr -d ,` +old=link.$suffix +new=new-link.$suffix + +gen_args=`echo "$variant" | tr ',' ' '` + +rm -f $new +if regen_one_file $old $TOOL $gen_args > $new ; then + if cmp -s $old $new ; then + echo "$old has not changed." + rm -f $new + elif [ $dash_update = yes ]; then + echo "$old has changed, updating with new version." + mv $new $old + else + echo "$old has changed, new version placed in $new" + fi +else + rm -f $new +fi +} + +case "$TOOL" in + gnu) tool_script_list="AOUT,RAM AOUT,ROM OUT" ;; + *) tool_script_list="" ;; +esac + +# MIPS,ROM must appear in that order to be caught by the kseg0data_data check. +# +common_script_list="RAM ROM DOTBOOT,RAM DOTBOOT,ROM MIPS,RAM MIPS,ROM" + +for v in $common_script_list $tool_script_list +do + regen $v +done + +exit 0 diff --git a/h/tool/diab/defs.arm b/h/tool/diab/defs.arm new file mode 100644 index 0000000..2fca7c9 --- /dev/null +++ b/h/tool/diab/defs.arm @@ -0,0 +1,36 @@ +# defs.arm - ARM specific definitions for the Diab toolchain +# +# modification history +# -------------------- +# 01c,24jun02,m_h define LONGCALL to allow far away ld relocations +# 01b,15jan02,to disable auto literal pool inserting +# 01a,18dec01,to written +# +# DESCRIPTION +# This file contains ARM specific definitions and flags for the +# Diab tools (compiler, assembler, linker etc.) +# +# compile flags: +# -Wa,-Xgnu-thumb generate STT_ARM_TFUNC for the compatibility +# with GNU +# -Wa,-Xlit-auto-off disable auto literal pool inserting +# +# NOTE +# The file name comes from defs.$(VX_CPU_FAMILY) +# + +include $(TGT_DIR)/h/tool/diab/defs.diab +include $(TGT_DIR)/h/tool/common/defs.arm + +LONGCALL = -Xcode-absolute-far + +ifeq ($(findstring _T,$(CPU)),_T) +# definitions for Thumb mode +CC_ARCH_SPEC += -Xinterwork -Wa,-Xgnu-thumb +else +# definitions for ARM mode +endif + +OPTION_LANG_ASM = -Wa,-Xlit-auto-off + +# end of defs.arm diff --git a/h/tool/diab/defs.diab b/h/tool/diab/defs.diab new file mode 100644 index 0000000..d6a95df --- /dev/null +++ b/h/tool/diab/defs.diab @@ -0,0 +1,366 @@ +# defs.diab - arch independent definitions specific to the Diab toolchain +# +# Copyright 2000-2005 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 03n,31aug05,mcm Changing DIAB_T_ENVIRON to vxworks62 +# 03m,22aug05,pee Added OPTION_DEPEND_TARGET +# 03l,18jul05,pee Added CC_LIBINTRINSICS +# 03k,08jul05,pee Added OPTION_CC_GENMAP +# 03j,29apr05,md Added OPTION_DEPEND_GEN_D +# 03i,31mar05,gvm Changing DIAB_T_ENVIRON to vxworks61 +# 03h,16feb05,pee Added OPTION_POINTERS_VOLATILE +# 03j,24jan05,aeg added -Xforce-declarations to CC_WARNINGS_LOW (SPR #106381). +# 03g,03jul04,f_b Improved support for data alignment +# 03f,11jun04,mcm Removed -Wa,-Xsemi-is-newline (will come from .conf file). +# Also removed -Xstrings-in-text=0 from CC_WARNINGS_MED. +# 03f,15jun04,fle SPR#98164 : substitute backslashes with slashes in CC_BASE +# 03e,29apr04,c_c Get compiler version from the resource file. +# 03d,04may04,mcm Updating compiler version to 5.2.0.2 +# 03c,26apr04,f_b Removed absolute path to objcopy to prepare for new +# directory structure and align with how nm & size are found +# 03b,26mar04,mcm Using -Xpointers-volatile instead of the +# -Xmemory-is-volatile, which is too restrictive. +# 03a,25mar04,c_c Update the Path variable when exists (SPR #95324). +# 02z,05apr04,mcm Fix for SPR 95829 - using the new macro LD_LINK_TOOL_DIR +# to set the path for Diab C++ libraries. +# 02y,12mar04,c_c Updated version to 5.2.0.1 +# 02x,18feb04,mcm Using vxworks60 instead of base6 +# 02w,09feb04,fle Updated to new host utilities location +# 02v,28jan04,dat Diab compiler level warnings +# 02u,22jan04,zmm Moved definitions of ROM_ENTRY, SYS_ENTRY and USR_ENTRY +# into defs.common +# 02t,09jan04,c_c Don't hardcode compiler path in macro (SPR #92774). +# 02s,07nov03,c_c Check compiler version. +# 02r,27oct03,dat adding -ei1499 to ignore empty file warning (broken) +# 02q,08oct03,dat New warning flags and settings, created +# CC_WARNINGS_OLD to be the old settings. +# 02p,13may03,sn removed autosetting of -Xc++-abr (does not work with project +# facility, causes confusion if tcInfo regenerated with +# CXX_STL_VARIANT=abridged). +# 02o,08apr03,sn use -r5 instead of -r for partial links +# 02n,19mar03,sn use Diab ddump for NM and SIZE +# 02m,18feb03,sn added support for Diab 5.1 standard vs abridged library +# 02o,17sep03,yvp Added -Xcpp-no-space to OPTION_PP_AS. +# 02n,05sep03,pch parameterize Diab "environment" setting +# 02m,19aug03,fle SPR#88802, set TCL to tclsh and added WTXTCL macro +# 02l,08may02,jab removed -Xexception as it is default +# 02k,01may02,sn Define TOOL_FAMILY, deprecate TOOL_VENDOR +# 02j,18apr02,jab workaround CPP_PRINT_MACROS problem of writing .o (SPR75718 +# + SPR75486) +# 02i,03apr02,jab made -Xmismatch-warning only visible to C +# 02h,21mar02,rbl adding macro so that project facility can add +# -Xmemory-is-volatile to bsp files +# 02g,22mar02,dat Adding PIC flags for bootInit.o (72825) +# 02f,13mar02,sn SPR 74080 - added large project support for Diab +# 02e,07mar02,jab added -Xlocal-data-area-static-only option +# 02d,14feb02,jab added -r4 to LD_PARTIAL_LAST_FLAGS +# 02c,06feb02,t_m change ranlib to ranlib$(TOOLENV) +# 02b,21jan02,sn removed obsolete WFC flags; removed unused C++_TEMPLATE_INST +# 02a,02jan02,jab use -Xclib-optim-off instead of -Xintrinsic-mask +# 01z,20dec01,jab use -r instead of -r4 +# 01y,13dec01,jab added make variable BOOTCONFIG_FLAGS +# 01x,07dec01,dat Adding -w to all dependency generation macros +# 01x,05dec01,tpw Rename Diab linker scripts to facilitate regeneration from +# a common template. +# 01w,28nov01,jab modified ldscript path +# 01v,13nov01,tam changed definition of CC_LIB (repackaging) +# 01u,13nov01,dat adding project link flags +# 01t,05nov01,rbl let project facility know about optimization flags +# 01s,12nov01,tam remove -Xrescan-restart; changed TOOL_CONFIG to +# TOOL_COMMON_DIR +# 01r,12nov01,jab really fixed CPP_PRINT_MACROS +# 01q,12nov01,jab fixed CPP_PRINT_MACROS +# 01p,07nov01,jab added -Xgenerate-paddr to LD_FLAGS +# 01o,06nov01,sn pass the architecture name to munch +# 01n,06nov01,jab various flag changes and documentation +# 01m,03nov01,tam updated for repackaging +# 01l,01nov01,jab flag changes +# 01k,30oct01,tpw Take generic defaults from new fragment defs.common +# 01j,30oct01,sn Use GNU nm and objcopy +# 01i,30oct01,jab sync diab CPP definition with gnu +# 01h,29oct01,jab added new ld script variables +# 01g,24oct01,dat Relocating tool specific macros +# 01f,24oct01,jab added new dependency generation variables +# 01e,22oct01,jab cleaned up +# 01d,23oct01,dee remove nm$(TOOLENV) +# 01c,19oct01,jab added make variables for dependency generation option +# added missing OPTION_* make variables +# 01b,18oct01,dat Moving tool specifics out of h/make +# 01a,17feb00,jab created. +# +# DESCRIPTION +# This file contains architecture independent definitions and flags for the +# Diab tools (compiler, assembler, linker etc.) +# +# +# The following switches are used to compile C/C++ source. Most of these +# are being used to make the compiler lax regarding coding conventions +# used in many source files; however, some are being used to work around +# problems in specific source files. +# +# +# -Xintrinsic-mask=0x0 turn off generation of abs/fabs intrinsic; is +# this still needed? +# + +## generic defaults from defs.common come first, so they can be overridden + +include $(TGT_DIR)/h/tool/common/defs.common + +## system name, used in -t settings +DIAB_T_ENVIRON = vxworks62 + +## get TOOL_COMMON_DIR, TOOL_DIAB and TOOL_GNU from TOOL + +TOOL_FAMILY = diab +TOOL_COMMON_DIR = $(subst diab,common,$(TOOL)) +TOOL_DIAB = $(TOOL) +TOOL_GNU = $(subst diab,gnu,$(TOOL)) + +# Deprecated, use TOOL_FAMILY instead +TOOL_VENDOR = diab + +# Set path to diab utilities: +# if WIND_DIAB_PATH is set, then use it as the compiler base directory. +# else, if WIND_DIAB_VERSION is set, use it. +# else, get the version from tools.version file. + +ifneq ($(WIND_DIAB_PATH),) +CC_BASE = $(subst \,/,$(WIND_DIAB_PATH)) +else +# set default version to WIND_DIAB_VERSION set in +# $(WIND_BASE)/host/resource/hutils/tools.version, but allow environment, +# ARCH or CPU specific make fragment to override the value. + +ifeq ($(WIND_DIAB_VERSION),) +include $(WIND_BASE)/host/resource/hutils/tools.version +endif +CC_VERSION = $(WIND_DIAB_VERSION) +endif + + +## set path to diab utilities + +ifeq ($(WIND_HOST_TYPE),x86-win32) +CC_HOST = WIN32 +else +ifeq ($(WIND_HOST_TYPE),sun4-solaris2) +CC_HOST = SUNS +else +CC_HOST = LINUX386 +endif +endif + +ifeq ($(WIND_HOST_TYPE),x86-win32) + +ifneq ($(Path),) +export Path := $(CC_BIN_DIR);$(Path) +endif + +ifneq ($(PATH),) +export PATH := $(CC_BIN_DIR);$(PATH) +endif + +else + +ifneq ($(PATH),) +export PATH := $(CC_BIN_DIR):$(PATH) +endif + +endif + +## diab toolchain binaries + +AR = dar +AS = $(CC) +CC = dcc +CXX = $(CC) +CPLUS = dplus +CPP = $(CC) -E -Xpreprocessor-lineno-off +LD = dld +NM = ddump -Ng + +## utility binaries + +RANLIB = ranlib$(TOOLENV) +TCL = tclsh +WTXTCL = wtxtcl +OBJCPY = objcopy$(TOOLENV) +SIZE = ddump -Z + +MUNCH_SCRIPT = $(WIND_BASE)/host/resource/hutils/tcl/munch.tcl +MUNCH = $(TCL) $(MUNCH_SCRIPT) $(MUNCH_FLAGS) + +CF = + +CPP_PRINT_MACROS = $(CC) $(TGT_FLAG) $(COMMON_COMPILER) -w -P \ + -Xcpp-dump-symbols $(CC_INCLUDE) $(CC_DEFINES) \ + -o $(NULL_DEVICE) + +## project facility variables + +LARGE_PROJECT = true +OPTION_INDIRECT_FILE = -@ +OPTION_NM_INDIRECT_FILE = @ + +CC_PROJECT_OPTIMIZE_FLAGS = -O -XO +PROJECT_BSP_FLAGS_EXTRA = $(filter -Xpointers-volatile,$(CC_OPTIM_TARGET)) + +## C flags + +COMMON_COMPILER = -W:c:,-Xclib-optim-off -Xansi \ + -Xlocal-data-area-static-only + +CC_ARCH_SPEC = $(TGT_FLAG) +CC_COMPILER = $(COMMON_COMPILER) + +CC_OPTIM_NORMAL = -XO -Xsize-opt +CC_OPTIM_TARGET = -XO -Xsize-opt -Xpointers-volatile +CC_OPTIM_DRIVER = -Xpointers-volatile + +# Compiler warning levels + +# old T2.2 warning level (formerly part of CC_COMMON) + +CC_WARNINGS_OLD_1 = -W:c:,-Xmismatch-warning=2 \ + -ew1554,1551,1552,1086,1047,1547 \ + -ei1516,1643,1604 +CC_WARNINGS_OLD = $(CC_WARNINGS_OLD_1) -Xstrings-in-text=0 + +# old standard warning levels + +CC_WARNINGS_ALL= $(CC_WARNINGS_OLD) -Xlint +CC_WARNINGS_NONE= $(CC_WARNINGS_OLD) + +# New warning levels, low, med, high + +# Highest warning level, all warnings should be investigated, but do not fix +# by adding copious casts. Every cast is a potential code error in the +# future. + +CC_WARNINGS_HIGH = -Xlint + +# medium warnings, Code SHOULD be warning free at this level. Avoid +# excessive casts just to eliminate warnings. + +CC_WARNINGS_MED = $(CC_WARNINGS_OLD_1) -Xlint + +# minimum warnings. Code MUST be warning free at this level. Apply all fixes +# necessary to eliminate every warning and error. + +CC_WARNINGS_LOW = -Xforce-declarations + +# For T2.2, we only use this flag for GNU/MIPS combination. +# We will activate this for all arch's after T2.2 release (SPR 72825) +# CC_PIC = -Xcode-relative-far + +## C++ flags + +C++_COMPILER = $(COMMON_COMPILER) + +## assembler flags + +CFLAGS_AS = $(CC_ARCH_SPEC) $(CC_COMPILER) $(CC_OPTIM) $(CC_INCLUDE) \ + $(CC_DEFINES) $(OPTION_PP_AS) $(OPTION_LANG_ASM) -c \ + $(ADDED_CFLAGS) + +## linker flags + +LDFLAGS = $(TGT_FLAG) -X -N -Xgenerate-paddr +# -r5 is exactly the same as -r except that COMDAT sections +# (used for C++ templates) are collapsed. We collapse the +# sections at this point to avoid running into the ELF +# 65535 section limitation. +LD_PARTIAL_FLAGS = $(TGT_FLAG) -X -r5 +LD_PARTIAL = $(LD) $(LD_PARTIAL_FLAGS) +LD_ENTRY_OPT = -e + +# These are flags to pass to the linker the last time we do a +# relocatable link. They never get used by a bootable project +# and they only get used once by a downloadable project. + +LD_PARTIAL_LAST_FLAGS = -r4 + +LD_SCRIPT_RAM = $(TGT_DIR)/h/tool/diab/ldscripts/link.RAM +LD_SCRIPT_ROM = $(TGT_DIR)/h/tool/diab/ldscripts/link.ROM + +# for cyclic link support + +LD_START_GROUP = +LD_END_GROUP = +LD_PARTIAL_START_GROUP = +LD_PARTIAL_END_GROUP = + +LD_DATA_SEG_ALIGN_FLAG = $(OPTION_DEFINE_MACRO)_VX_DATA_ALIGN + +LD_LOW_FLAGS = -D_VX_START_TEXT=0x$(RAM_LOW_ADRS) +LD_HIGH_FLAGS = -D_VX_START_TEXT=0x$(RAM_HIGH_ADRS) +RES_LOW_FLAGS = -D_VX_START_TEXT=0x$(ROM_LINK_ADRS) -D_VX_START_DATA=0x$(RAM_LOW_ADRS) +RES_HIGH_FLAGS = -D_VX_START_TEXT=0x$(ROM_LINK_ADRS) -D_VX_START_DATA=0x$(RAM_HIGH_ADRS) + +# Flags for VxWorks Project builds + +LD_RAM_FLAGS = $(LD_LOW_FLAGS) +LD_ROM_CPY_FLAGS = $(RES_HIGH_FLAGS) +LD_ROM_CMP_FLAGS = $(RES_HIGH_FLAGS) +LD_ROM_RES_FLAGS = $(RES_LOW_FLAGS) + +# For 960 IMI +LD_IMI_ADRS = -D_VX_TEXT_START=0x$(IMI_TEXT_ADRS) -D_VX_DATA_START=0x$(IMI_DATA_ADRS) + +## utility flags + +MUNCH_FLAGS = -c $(TOOLENV) + +NM_GLOB_FLAGS = -g + +## bsp flags + +# compressedEntry() must be first routine in .text section +BOOTCONFIG_FLAGS=-Xkill-opt=0x400000 + +## options + +OPTION_PP = -E +OPTION_PP_AS = -Xpreprocess-assembly -Xcpp-no-space +OPTION_PP_NOLINENO = -Xpreprocessor-lineno-off +OPTION_PP_COMMENT = -C + +OPTION_DEPEND = -Xmake-dependency -w +OPTION_DEPEND_GEN = -Xmake-dependency -Xincfile-missing-ignore -w +OPTION_DEPEND_GEN_D = -Xmake-dependency=0x04 +OPTION_DEPEND_C = $(OPTION_DEPEND_GEN) +OPTION_DEPEND_AS = $(OPTION_DEPEND) +OPTION_DEPEND_TARGET = -Xmake-dependency-target= + +OPTION_CC_GENMAP = -m6 > $@.map + +OPTION_DOLLAR_SYMBOLS = -Xdollar-in-ident +OPTION_ANSI = -Xansi +OPTION_PASS_TO_LD = + +OPTION_NO_WARNINGS = + +OPTION_OBJECT_ONLY = -c +OPTION_INCLUDE_DIR = -I +OPTION_DEFINE_MACRO = -D +# this line has a space at the end ("-o ") +OPTION_OBJECT_NAME = -o +OPTION_EXE_NAME = $(OPTION_OBJECT_NAME) + +OPTION_POINTERS_VOLATILE = -Xpointers-volatile + +LD_LINK_PATH_EXTRA += -L$(LD_LINK_TOOL_DIR)_$(CXX_STL_VARIANT) + +ifeq ($(CXX_STL_VARIANT),) +CXX_STL_VARIANT = standard +# If you would like to create projects using the abridged standard library, +# replace the above line with: +# CXX_STL_VARIANT = abridged +endif + +# Library containing compiler support routines +CC_LIB = +CC_LIBINTRINSICS = -ldcc diff --git a/h/tool/diab/defs.mips b/h/tool/diab/defs.mips new file mode 100644 index 0000000..12e682e --- /dev/null +++ b/h/tool/diab/defs.mips @@ -0,0 +1,23 @@ +# defs.mips - MIPS specific definitions for the Diab toolchain +# +# modification history +# -------------------- +# 01b,22may02,mem Added -Xno-mips16-calls +# 01a,08jan02,pes written +# +# DESCRIPTION +# This file contains MIPS specific definitions and flags for the +# Diab tools (compiler, assembler, linker etc.) +# +# NOTE +# The file name comes from defs.$(VX_CPU_FAMILY) +# + +include $(TGT_DIR)/h/tool/diab/defs.diab +include $(TGT_DIR)/h/tool/common/defs.mips + +# Indicate that MIPS16 isn't supported, so that tail-call optimizations +# can be enabled. +CC_ARCH_SPEC += -Xno-mips16-calls + +# end of defs.mips diff --git a/h/tool/diab/intrinsics.h b/h/tool/diab/intrinsics.h new file mode 100644 index 0000000..72ed424 --- /dev/null +++ b/h/tool/diab/intrinsics.h @@ -0,0 +1,22 @@ +/* intrinsics.h - map INCLUDE_INTRINSICS to toolchain specific intrinsics */ + +/* Copyright 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,06feb02,sn wrote +*/ + +/* +DESCRIPTION +Map INCLUDE_INTRINSICS to INCLUDE_DIAB_INTRINSICS. Included when TOOL_FAMILY=diab. + +NOMANUAL +*/ + +#ifdef INCLUDE_INTRINSICS +#ifndef INCLUDE_DIAB_INTRINSICS +#define INCLUDE_DIAB_INTRINSICS +#endif +#endif diff --git a/h/tool/diab/ldscripts/Makefile b/h/tool/diab/ldscripts/Makefile new file mode 100644 index 0000000..c957287 --- /dev/null +++ b/h/tool/diab/ldscripts/Makefile @@ -0,0 +1,22 @@ +# Makefile - makefile for regenerating Diab linker scripts from common template +# +# modification history +# -------------------- +# 01a,05dec01,tpw written +# +# DESCRIPTION +# This file contains the makefile rules to regenerate cross-target linker +# scripts using the template system in tool/common/ldscripts. +# +#*/ + +TGT_DIR=$(WIND_BASE)/target +GEN_DIR=$(TGT_DIR)/h/tool/common/ldscripts +REGEN_SH=$(GEN_DIR)/regen.sh +TOOL=diab + +regen all: + sh $(REGEN_SH) $(TOOL) + +update: + sh $(REGEN_SH) -update $(TOOL) diff --git a/h/tool/diab/ldscripts/link.DOTBOOTRAM b/h/tool/diab/ldscripts/link.DOTBOOTRAM new file mode 100644 index 0000000..61df7bf --- /dev/null +++ b/h/tool/diab/ldscripts/link.DOTBOOTRAM @@ -0,0 +1,93 @@ +/* link.DOTBOOTRAM - diab linker command file for VxWorks: DOTBOOT RAM */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* This file was automatically generated using tool/common/ldscripts. */ + +/* +modification history +-------------------- +01r,25aug05,dlk Support .text.init, .text.fast, .data.init, .data.fast. +01r,29jul05,slk SPR 104264: fix MIPS romResident images +01q,06may05,rlg changes for MIPS specific devices +01p,03jul04,f_b Improved support for data alignment +01o,12dec03,sn added more .rodata.str1.* handlers +01n,04dec03,sn Diab: .rodata.* is not handled correctly by Diab linker; instead + use specific names +01m,28oct03,sn Diab: collapse .rodata.cst* sections into .rodata +01l,29may02,tpw Diab: pad out sections, needed for MIPS byteswap. SPR 78076 +01k,24apr02,sn GNU: SPR 75835 - added support for relocatable script link.OUT +01j,19apr02,tpw Diab: provide _etext for ColdFire. SPR 75122 +01i,06feb02,sn Both: place .got2 to handle tramp.o (_x_gnu_tramp.o). +01h,25jan02,tpw GNU: give debug sections explicit 0 addresses. +01g,14jan02,tpw Diab: place .eh_frame data, in case of insistent GNU objects. +01f,14dec01,tpw Diab: provide both underscore options of wrs_kernel* here too. +01e,05dec01,tpw Both: Add .boot and .reset section support, for PPC 4xx series + and Book E. +01d,05dec01,tpw Diab: Add .frame_info section to text region. +01c,03dec01,jab Diab: replaced LOAD() with AT() +01b,14nov01,tpw ALL: Correct some more bootrom/kernel issues. +01b,06nov01,tpw GNU: Add /DISCARD/ directive to discard uninteresting sections +01a,01nov01,tpw gnu script written +01a,29oct01,jab diab script written +*/ + +SECTIONS { + GROUP BIND(_VX_START_TEXT) : { + .text (TEXT) : { + wrs_kernel_text_start = .; _wrs_kernel_text_start = .; + *(.text) + wrs_kernel_text_fast = .; _wrs_kernel_text_fast = .; + *(.text.fast) + wrs_kernel_text_init = .; _wrs_kernel_text_init = .; + *(.text.init) + *(.rdata) *(.rodata) *(.rodata.cst8) *(.rodata.cst4) *(.rodata.str1.1) *(.rodata.str1.2) *(.rodata.str1.4) *(.rodata.str1.8) *(.rodata.str1.16) *(.rodata.str1.32) *(.rodata.str1.64) *(.rodata.str1.128) *(.rodata.str1.256) + *(.init) *(.fini) + *(.frame_info) + *(.sdata2) + . = ((. + 3) & ~3); + } + . = ((. + 3) & ~3); + etext = .; _etext = .; + wrs_kernel_text_end = .; _wrs_kernel_text_end = .; + } + GROUP BIND((etext + _VX_DATA_ALIGN - 1) & -_VX_DATA_ALIGN) : { + .data (DATA) : { + wrs_kernel_data_start = .; _wrs_kernel_data_start = .; + *(.data) + wrs_kernel_data_fast = .; _wrs_kernel_data_fast = .; + *(.data.fast) + wrs_kernel_data_init = .; _wrs_kernel_data_init = .; + *(.data.init) + *(.eh_frame) /* Some GNU objects insist on having .eh_frame data. */ + *(.ctors) + *(.dtors) + /* set gp for MIPS startup code */ + _gp = ((. + 15) & ~15) + 0x7ff0; + *(.got2) + *(.sdata) + . = ((. + 3) & ~3); + } + . = ((. + 3) & ~3); + edata = .; _edata = .; + wrs_kernel_data_end = .; _wrs_kernel_data_end = .; + .bss (BSS) : { + wrs_kernel_bss_start = .; _wrs_kernel_bss_start = .; + *(.sbss) + *(.bss) + . = ((. + 3) & ~3); + } + . = ((. + 3) & ~3); + end = .; _end = .; + wrs_kernel_bss_end = .; _wrs_kernel_bss_end = .; + } + + .boot BIND(wrs_kernel_text_start + wrs_kernel_rom_size - 0x800) : + { + *(.boot) + } + .reset BIND(wrs_kernel_text_start + wrs_kernel_rom_size - 4) : + { + *(.reset) + } +} diff --git a/h/tool/diab/ldscripts/link.DOTBOOTROM b/h/tool/diab/ldscripts/link.DOTBOOTROM new file mode 100644 index 0000000..98cd408 --- /dev/null +++ b/h/tool/diab/ldscripts/link.DOTBOOTROM @@ -0,0 +1,93 @@ +/* link.DOTBOOTROM - diab linker command file for VxWorks: DOTBOOT ROM */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* This file was automatically generated using tool/common/ldscripts. */ + +/* +modification history +-------------------- +01r,25aug05,dlk Support .text.init, .text.fast, .data.init, .data.fast. +01r,29jul05,slk SPR 104264: fix MIPS romResident images +01q,06may05,rlg changes for MIPS specific devices +01p,03jul04,f_b Improved support for data alignment +01o,12dec03,sn added more .rodata.str1.* handlers +01n,04dec03,sn Diab: .rodata.* is not handled correctly by Diab linker; instead + use specific names +01m,28oct03,sn Diab: collapse .rodata.cst* sections into .rodata +01l,29may02,tpw Diab: pad out sections, needed for MIPS byteswap. SPR 78076 +01k,24apr02,sn GNU: SPR 75835 - added support for relocatable script link.OUT +01j,19apr02,tpw Diab: provide _etext for ColdFire. SPR 75122 +01i,06feb02,sn Both: place .got2 to handle tramp.o (_x_gnu_tramp.o). +01h,25jan02,tpw GNU: give debug sections explicit 0 addresses. +01g,14jan02,tpw Diab: place .eh_frame data, in case of insistent GNU objects. +01f,14dec01,tpw Diab: provide both underscore options of wrs_kernel* here too. +01e,05dec01,tpw Both: Add .boot and .reset section support, for PPC 4xx series + and Book E. +01d,05dec01,tpw Diab: Add .frame_info section to text region. +01c,03dec01,jab Diab: replaced LOAD() with AT() +01b,14nov01,tpw ALL: Correct some more bootrom/kernel issues. +01b,06nov01,tpw GNU: Add /DISCARD/ directive to discard uninteresting sections +01a,01nov01,tpw gnu script written +01a,29oct01,jab diab script written +*/ + +SECTIONS { + GROUP BIND(_VX_START_TEXT) : { + .text (TEXT) : { + wrs_kernel_text_start = .; _wrs_kernel_text_start = .; + *(.text) + wrs_kernel_text_fast = .; _wrs_kernel_text_fast = .; + *(.text.fast) + wrs_kernel_text_init = .; _wrs_kernel_text_init = .; + *(.text.init) + *(.rdata) *(.rodata) *(.rodata.cst8) *(.rodata.cst4) *(.rodata.str1.1) *(.rodata.str1.2) *(.rodata.str1.4) *(.rodata.str1.8) *(.rodata.str1.16) *(.rodata.str1.32) *(.rodata.str1.64) *(.rodata.str1.128) *(.rodata.str1.256) + *(.init) *(.fini) + *(.frame_info) + *(.sdata2) + . = ((. + 3) & ~3); + } + . = ((. + 3) & ~3); + etext = .; _etext = .; + wrs_kernel_text_end = .; _wrs_kernel_text_end = .; + } + GROUP BIND(_VX_START_DATA) : { + .data (DATA) AT(etext) : { + wrs_kernel_data_start = .; _wrs_kernel_data_start = .; + *(.data) + wrs_kernel_data_fast = .; _wrs_kernel_data_fast = .; + *(.data.fast) + wrs_kernel_data_init = .; _wrs_kernel_data_init = .; + *(.data.init) + *(.eh_frame) /* Some GNU objects insist on having .eh_frame data. */ + *(.ctors) + *(.dtors) + /* set gp for MIPS startup code */ + _gp = ((. + 15) & ~15) + 0x7ff0; + *(.got2) + *(.sdata) + . = ((. + 3) & ~3); + } + . = ((. + 3) & ~3); + edata = .; _edata = .; + wrs_kernel_data_end = .; _wrs_kernel_data_end = .; + .bss (BSS) : { + wrs_kernel_bss_start = .; _wrs_kernel_bss_start = .; + *(.sbss) + *(.bss) + . = ((. + 3) & ~3); + } + . = ((. + 3) & ~3); + end = .; _end = .; + wrs_kernel_bss_end = .; _wrs_kernel_bss_end = .; + } + + .boot BIND(wrs_kernel_text_start + wrs_kernel_rom_size - 0x800) : + { + *(.boot) + } + .reset BIND(wrs_kernel_text_start + wrs_kernel_rom_size - 4) : + { + *(.reset) + } +} diff --git a/h/tool/diab/ldscripts/link.MIPSRAM b/h/tool/diab/ldscripts/link.MIPSRAM new file mode 100644 index 0000000..b87d6e9 --- /dev/null +++ b/h/tool/diab/ldscripts/link.MIPSRAM @@ -0,0 +1,89 @@ +/* link.MIPSRAM - diab linker command file for VxWorks: MIPS RAM */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* This file was automatically generated using tool/common/ldscripts. */ + +/* +modification history +-------------------- +01r,25aug05,dlk Support .text.init, .text.fast, .data.init, .data.fast. +01r,29jul05,slk SPR 104264: fix MIPS romResident images +01q,06may05,rlg changes for MIPS specific devices +01p,03jul04,f_b Improved support for data alignment +01o,12dec03,sn added more .rodata.str1.* handlers +01n,04dec03,sn Diab: .rodata.* is not handled correctly by Diab linker; instead + use specific names +01m,28oct03,sn Diab: collapse .rodata.cst* sections into .rodata +01l,29may02,tpw Diab: pad out sections, needed for MIPS byteswap. SPR 78076 +01k,24apr02,sn GNU: SPR 75835 - added support for relocatable script link.OUT +01j,19apr02,tpw Diab: provide _etext for ColdFire. SPR 75122 +01i,06feb02,sn Both: place .got2 to handle tramp.o (_x_gnu_tramp.o). +01h,25jan02,tpw GNU: give debug sections explicit 0 addresses. +01g,14jan02,tpw Diab: place .eh_frame data, in case of insistent GNU objects. +01f,14dec01,tpw Diab: provide both underscore options of wrs_kernel* here too. +01e,05dec01,tpw Both: Add .boot and .reset section support, for PPC 4xx series + and Book E. +01d,05dec01,tpw Diab: Add .frame_info section to text region. +01c,03dec01,jab Diab: replaced LOAD() with AT() +01b,14nov01,tpw ALL: Correct some more bootrom/kernel issues. +01b,06nov01,tpw GNU: Add /DISCARD/ directive to discard uninteresting sections +01a,01nov01,tpw gnu script written +01a,29oct01,jab diab script written +*/ + +SECTIONS { + GROUP BIND(_VX_START_TEXT) : { + .text (TEXT) : { + wrs_kernel_text_start = .; _wrs_kernel_text_start = .; + *(.text) + wrs_kernel_text_fast = .; _wrs_kernel_text_fast = .; + *(.text.fast) + wrs_kernel_text_init = .; _wrs_kernel_text_init = .; + *(.text.init) + *(.rdata) *(.rodata) *(.rodata.cst8) *(.rodata.cst4) *(.rodata.str1.1) *(.rodata.str1.2) *(.rodata.str1.4) *(.rodata.str1.8) *(.rodata.str1.16) *(.rodata.str1.32) *(.rodata.str1.64) *(.rodata.str1.128) *(.rodata.str1.256) + *(.init) *(.fini) + *(.frame_info) + *(.sdata2) + . = ((. + 3) & ~3); + } + . = ((. + 3) & ~3); + etext = .; _etext = .; + wrs_kernel_text_end = .; _wrs_kernel_text_end = .; + } + GROUP BIND((etext + _VX_DATA_ALIGN - 1) & -_VX_DATA_ALIGN) : { + .data (DATA) : { + wrs_kernel_data_start = .; _wrs_kernel_data_start = .; + *(.data) + wrs_kernel_data_fast = .; _wrs_kernel_data_fast = .; + *(.data.fast) + wrs_kernel_data_init = .; _wrs_kernel_data_init = .; + *(.data.init) + *(.eh_frame) /* Some GNU objects insist on having .eh_frame data. */ + *(.ctors) + *(.dtors) + /* set gp for MIPS startup code */ + _gp = ((. + 15) & ~15) + 0x7ff0; + *(.got2) + *(.sdata) + . = ((. + 3) & ~3); + } + . = ((. + 3) & ~3); + edata = .; _edata = .; + wrs_kernel_data_end = .; _wrs_kernel_data_end = .; + .bss (BSS) : { + wrs_kernel_bss_start = .; _wrs_kernel_bss_start = .; + *(.sbss) + *(.bss) + . = ((. + 3) & ~3); + } + . = ((. + 3) & ~3); + end = .; _end = .; + wrs_kernel_bss_end = .; _wrs_kernel_bss_end = .; + } + + .kseg0data BIND((_VX_START_TEXT - 0x7e00) & 0xbfffffff) : + { + *(.kseg0data) + } +} diff --git a/h/tool/diab/ldscripts/link.MIPSROM b/h/tool/diab/ldscripts/link.MIPSROM new file mode 100644 index 0000000..9767e1b --- /dev/null +++ b/h/tool/diab/ldscripts/link.MIPSROM @@ -0,0 +1,89 @@ +/* link.MIPSROM - diab linker command file for VxWorks: MIPS ROM */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* This file was automatically generated using tool/common/ldscripts. */ + +/* +modification history +-------------------- +01r,25aug05,dlk Support .text.init, .text.fast, .data.init, .data.fast. +01r,29jul05,slk SPR 104264: fix MIPS romResident images +01q,06may05,rlg changes for MIPS specific devices +01p,03jul04,f_b Improved support for data alignment +01o,12dec03,sn added more .rodata.str1.* handlers +01n,04dec03,sn Diab: .rodata.* is not handled correctly by Diab linker; instead + use specific names +01m,28oct03,sn Diab: collapse .rodata.cst* sections into .rodata +01l,29may02,tpw Diab: pad out sections, needed for MIPS byteswap. SPR 78076 +01k,24apr02,sn GNU: SPR 75835 - added support for relocatable script link.OUT +01j,19apr02,tpw Diab: provide _etext for ColdFire. SPR 75122 +01i,06feb02,sn Both: place .got2 to handle tramp.o (_x_gnu_tramp.o). +01h,25jan02,tpw GNU: give debug sections explicit 0 addresses. +01g,14jan02,tpw Diab: place .eh_frame data, in case of insistent GNU objects. +01f,14dec01,tpw Diab: provide both underscore options of wrs_kernel* here too. +01e,05dec01,tpw Both: Add .boot and .reset section support, for PPC 4xx series + and Book E. +01d,05dec01,tpw Diab: Add .frame_info section to text region. +01c,03dec01,jab Diab: replaced LOAD() with AT() +01b,14nov01,tpw ALL: Correct some more bootrom/kernel issues. +01b,06nov01,tpw GNU: Add /DISCARD/ directive to discard uninteresting sections +01a,01nov01,tpw gnu script written +01a,29oct01,jab diab script written +*/ + +SECTIONS { + GROUP BIND(_VX_START_TEXT) : { + .text (TEXT) : { + wrs_kernel_text_start = .; _wrs_kernel_text_start = .; + *(.text) + wrs_kernel_text_fast = .; _wrs_kernel_text_fast = .; + *(.text.fast) + wrs_kernel_text_init = .; _wrs_kernel_text_init = .; + *(.text.init) + *(.rdata) *(.rodata) *(.rodata.cst8) *(.rodata.cst4) *(.rodata.str1.1) *(.rodata.str1.2) *(.rodata.str1.4) *(.rodata.str1.8) *(.rodata.str1.16) *(.rodata.str1.32) *(.rodata.str1.64) *(.rodata.str1.128) *(.rodata.str1.256) + *(.init) *(.fini) + *(.frame_info) + *(.sdata2) + . = ((. + 3) & ~3); + } + . = ((. + 3) & ~3); + etext = .; _etext = .; + wrs_kernel_text_end = .; _wrs_kernel_text_end = .; + } + GROUP BIND(_VX_START_DATA) : { + .data (DATA) AT(etext) : { + wrs_kernel_data_start = .; _wrs_kernel_data_start = .; + *(.data) + wrs_kernel_data_fast = .; _wrs_kernel_data_fast = .; + *(.data.fast) + wrs_kernel_data_init = .; _wrs_kernel_data_init = .; + *(.data.init) + *(.eh_frame) /* Some GNU objects insist on having .eh_frame data. */ + *(.ctors) + *(.dtors) + /* set gp for MIPS startup code */ + _gp = ((. + 15) & ~15) + 0x7ff0; + *(.got2) + *(.sdata) + . = ((. + 3) & ~3); + } + . = ((. + 3) & ~3); + edata = .; _edata = .; + wrs_kernel_data_end = .; _wrs_kernel_data_end = .; + .bss (BSS) : { + wrs_kernel_bss_start = .; _wrs_kernel_bss_start = .; + *(.sbss) + *(.bss) + . = ((. + 3) & ~3); + } + . = ((. + 3) & ~3); + end = .; _end = .; + wrs_kernel_bss_end = .; _wrs_kernel_bss_end = .; + } + + .kseg0data BIND((_VX_START_DATA - 0x7e00) & 0xbfffffff) : + { + *(.kseg0data) + } +} diff --git a/h/tool/diab/ldscripts/link.RAM b/h/tool/diab/ldscripts/link.RAM new file mode 100644 index 0000000..b845e4e --- /dev/null +++ b/h/tool/diab/ldscripts/link.RAM @@ -0,0 +1,84 @@ +/* link.RAM - diab linker command file for VxWorks: RAM */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* This file was automatically generated using tool/common/ldscripts. */ + +/* +modification history +-------------------- +01r,25aug05,dlk Support .text.init, .text.fast, .data.init, .data.fast. +01r,29jul05,slk SPR 104264: fix MIPS romResident images +01q,06may05,rlg changes for MIPS specific devices +01p,03jul04,f_b Improved support for data alignment +01o,12dec03,sn added more .rodata.str1.* handlers +01n,04dec03,sn Diab: .rodata.* is not handled correctly by Diab linker; instead + use specific names +01m,28oct03,sn Diab: collapse .rodata.cst* sections into .rodata +01l,29may02,tpw Diab: pad out sections, needed for MIPS byteswap. SPR 78076 +01k,24apr02,sn GNU: SPR 75835 - added support for relocatable script link.OUT +01j,19apr02,tpw Diab: provide _etext for ColdFire. SPR 75122 +01i,06feb02,sn Both: place .got2 to handle tramp.o (_x_gnu_tramp.o). +01h,25jan02,tpw GNU: give debug sections explicit 0 addresses. +01g,14jan02,tpw Diab: place .eh_frame data, in case of insistent GNU objects. +01f,14dec01,tpw Diab: provide both underscore options of wrs_kernel* here too. +01e,05dec01,tpw Both: Add .boot and .reset section support, for PPC 4xx series + and Book E. +01d,05dec01,tpw Diab: Add .frame_info section to text region. +01c,03dec01,jab Diab: replaced LOAD() with AT() +01b,14nov01,tpw ALL: Correct some more bootrom/kernel issues. +01b,06nov01,tpw GNU: Add /DISCARD/ directive to discard uninteresting sections +01a,01nov01,tpw gnu script written +01a,29oct01,jab diab script written +*/ + +SECTIONS { + GROUP BIND(_VX_START_TEXT) : { + .text (TEXT) : { + wrs_kernel_text_start = .; _wrs_kernel_text_start = .; + *(.text) + wrs_kernel_text_fast = .; _wrs_kernel_text_fast = .; + *(.text.fast) + wrs_kernel_text_init = .; _wrs_kernel_text_init = .; + *(.text.init) + *(.rdata) *(.rodata) *(.rodata.cst8) *(.rodata.cst4) *(.rodata.str1.1) *(.rodata.str1.2) *(.rodata.str1.4) *(.rodata.str1.8) *(.rodata.str1.16) *(.rodata.str1.32) *(.rodata.str1.64) *(.rodata.str1.128) *(.rodata.str1.256) + *(.init) *(.fini) + *(.frame_info) + *(.sdata2) + . = ((. + 3) & ~3); + } + . = ((. + 3) & ~3); + etext = .; _etext = .; + wrs_kernel_text_end = .; _wrs_kernel_text_end = .; + } + GROUP BIND((etext + _VX_DATA_ALIGN - 1) & -_VX_DATA_ALIGN) : { + .data (DATA) : { + wrs_kernel_data_start = .; _wrs_kernel_data_start = .; + *(.data) + wrs_kernel_data_fast = .; _wrs_kernel_data_fast = .; + *(.data.fast) + wrs_kernel_data_init = .; _wrs_kernel_data_init = .; + *(.data.init) + *(.eh_frame) /* Some GNU objects insist on having .eh_frame data. */ + *(.ctors) + *(.dtors) + /* set gp for MIPS startup code */ + _gp = ((. + 15) & ~15) + 0x7ff0; + *(.got2) + *(.sdata) + . = ((. + 3) & ~3); + } + . = ((. + 3) & ~3); + edata = .; _edata = .; + wrs_kernel_data_end = .; _wrs_kernel_data_end = .; + .bss (BSS) : { + wrs_kernel_bss_start = .; _wrs_kernel_bss_start = .; + *(.sbss) + *(.bss) + . = ((. + 3) & ~3); + } + . = ((. + 3) & ~3); + end = .; _end = .; + wrs_kernel_bss_end = .; _wrs_kernel_bss_end = .; + } +} diff --git a/h/tool/diab/ldscripts/link.ROM b/h/tool/diab/ldscripts/link.ROM new file mode 100644 index 0000000..5ae5783 --- /dev/null +++ b/h/tool/diab/ldscripts/link.ROM @@ -0,0 +1,84 @@ +/* link.ROM - diab linker command file for VxWorks: ROM */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* This file was automatically generated using tool/common/ldscripts. */ + +/* +modification history +-------------------- +01r,25aug05,dlk Support .text.init, .text.fast, .data.init, .data.fast. +01r,29jul05,slk SPR 104264: fix MIPS romResident images +01q,06may05,rlg changes for MIPS specific devices +01p,03jul04,f_b Improved support for data alignment +01o,12dec03,sn added more .rodata.str1.* handlers +01n,04dec03,sn Diab: .rodata.* is not handled correctly by Diab linker; instead + use specific names +01m,28oct03,sn Diab: collapse .rodata.cst* sections into .rodata +01l,29may02,tpw Diab: pad out sections, needed for MIPS byteswap. SPR 78076 +01k,24apr02,sn GNU: SPR 75835 - added support for relocatable script link.OUT +01j,19apr02,tpw Diab: provide _etext for ColdFire. SPR 75122 +01i,06feb02,sn Both: place .got2 to handle tramp.o (_x_gnu_tramp.o). +01h,25jan02,tpw GNU: give debug sections explicit 0 addresses. +01g,14jan02,tpw Diab: place .eh_frame data, in case of insistent GNU objects. +01f,14dec01,tpw Diab: provide both underscore options of wrs_kernel* here too. +01e,05dec01,tpw Both: Add .boot and .reset section support, for PPC 4xx series + and Book E. +01d,05dec01,tpw Diab: Add .frame_info section to text region. +01c,03dec01,jab Diab: replaced LOAD() with AT() +01b,14nov01,tpw ALL: Correct some more bootrom/kernel issues. +01b,06nov01,tpw GNU: Add /DISCARD/ directive to discard uninteresting sections +01a,01nov01,tpw gnu script written +01a,29oct01,jab diab script written +*/ + +SECTIONS { + GROUP BIND(_VX_START_TEXT) : { + .text (TEXT) : { + wrs_kernel_text_start = .; _wrs_kernel_text_start = .; + *(.text) + wrs_kernel_text_fast = .; _wrs_kernel_text_fast = .; + *(.text.fast) + wrs_kernel_text_init = .; _wrs_kernel_text_init = .; + *(.text.init) + *(.rdata) *(.rodata) *(.rodata.cst8) *(.rodata.cst4) *(.rodata.str1.1) *(.rodata.str1.2) *(.rodata.str1.4) *(.rodata.str1.8) *(.rodata.str1.16) *(.rodata.str1.32) *(.rodata.str1.64) *(.rodata.str1.128) *(.rodata.str1.256) + *(.init) *(.fini) + *(.frame_info) + *(.sdata2) + . = ((. + 3) & ~3); + } + . = ((. + 3) & ~3); + etext = .; _etext = .; + wrs_kernel_text_end = .; _wrs_kernel_text_end = .; + } + GROUP BIND(_VX_START_DATA) : { + .data (DATA) AT(etext) : { + wrs_kernel_data_start = .; _wrs_kernel_data_start = .; + *(.data) + wrs_kernel_data_fast = .; _wrs_kernel_data_fast = .; + *(.data.fast) + wrs_kernel_data_init = .; _wrs_kernel_data_init = .; + *(.data.init) + *(.eh_frame) /* Some GNU objects insist on having .eh_frame data. */ + *(.ctors) + *(.dtors) + /* set gp for MIPS startup code */ + _gp = ((. + 15) & ~15) + 0x7ff0; + *(.got2) + *(.sdata) + . = ((. + 3) & ~3); + } + . = ((. + 3) & ~3); + edata = .; _edata = .; + wrs_kernel_data_end = .; _wrs_kernel_data_end = .; + .bss (BSS) : { + wrs_kernel_bss_start = .; _wrs_kernel_bss_start = .; + *(.sbss) + *(.bss) + . = ((. + 3) & ~3); + } + . = ((. + 3) & ~3); + end = .; _end = .; + wrs_kernel_bss_end = .; _wrs_kernel_bss_end = .; + } +} diff --git a/h/tool/diab/limits.h b/h/tool/diab/limits.h new file mode 100644 index 0000000..1237cf0 --- /dev/null +++ b/h/tool/diab/limits.h @@ -0,0 +1,28 @@ +#define CHAR_BIT 8 +#if defined(__ppc) || defined(__rce) || defined(__arm) +#define CHAR_MAX UCHAR_MAX +#define CHAR_MIN 0 +#else +#define CHAR_MAX SCHAR_MAX +#define CHAR_MIN SCHAR_MIN +#endif +#define MB_LEN_MAX 5 +#define INT_MAX 2147483647 +#define INT_MIN (-2147483647-1) +#define LONG_MAX 2147483647L +#define LONG_MIN (-2147483647L-1L) +#define SCHAR_MAX 127 +#define SCHAR_MIN (-128) +#define SHRT_MAX 32767 +#define SHRT_MIN (-32768) +#define UCHAR_MAX 255 +#define UINT_MAX 4294967295U +#define ULONG_MAX 4294967295LU +#define USHRT_MAX 65535 +#if defined(_WRS_KERNEL) +#define WCHAR_MIN 0 +#define WCHAR_MAX USHRT_MAX +#endif /* _WRS_KERNEL */ +#define WINT_MIN INT_MIN +#define WINT_MAX INT_MAX + diff --git a/h/tool/diab/make.ARMARCH5diab b/h/tool/diab/make.ARMARCH5diab new file mode 100644 index 0000000..9e56609 --- /dev/null +++ b/h/tool/diab/make.ARMARCH5diab @@ -0,0 +1,25 @@ +# make.ARMARCH5diab - Diab compilation tools definitions for ARMARCH5 +# +# modification history +# -------------------- +# 01f,30sep03,sn changed :vxworks55 to :$(DIAB_T_ENVIRON) +# 01e,14jan02,to move 'include defs.arm' after TOOL and CPU definitions to be +# consistent with gnu ones +# 01d,18dec01,to move common definitions to defs.arm +# 01c,05dec01,jab change :tornado, :simple ,etc. to :vxworks55 +# 01b,16nov01,t_m Change sysInit entry +# 01a,08nov01,t_m Copied from ARMARCH5_T +# +# DESCRIPTION +# This file contains ARMARCH5 specific definitions and flags for the +# Diab tools (compiler, assembler, linker etc.) +# + +CPU = ARMARCH5 +TOOL = diab + +include $(TGT_DIR)/h/tool/diab/defs.arm + +TGT_FLAG = -tARMV5LS:$(DIAB_T_ENVIRON) + +# end of make.ARMARCH5diab diff --git a/h/tool/diab/make.ARMARCH5diabbe b/h/tool/diab/make.ARMARCH5diabbe new file mode 100644 index 0000000..096e026 --- /dev/null +++ b/h/tool/diab/make.ARMARCH5diabbe @@ -0,0 +1,22 @@ +# make.ARMARCH5diabbe - Diab compilation tools definitions for ARMARCH5 +# +# modification history +# -------------------- +# 01c,30sep03,sn changed :vxworks55 to :$(DIAB_T_ENVIRON) +# 01b,14jan02,to move 'include defs.arm' after TOOL and CPU definitions to be +# consistent with gnu ones +# 01a,18dec01,to created from make.ARMARCH5diab +# +# DESCRIPTION +# This file contains ARMARCH5 specific definitions and flags for the +# Diab tools (compiler, assembler, linker etc.) +# + +CPU = ARMARCH5 +TOOL = diabbe + +include $(TGT_DIR)/h/tool/diab/defs.arm + +TGT_FLAG = -tARMV5ES:$(DIAB_T_ENVIRON) + +# end of make.ARMARCH5diabbe diff --git a/h/tool/diab/make.ARMARCH6diab b/h/tool/diab/make.ARMARCH6diab new file mode 100644 index 0000000..37a3648 --- /dev/null +++ b/h/tool/diab/make.ARMARCH6diab @@ -0,0 +1,19 @@ +# make.ARMARCH6diab - Diab compilation tools definitions for ARMARCH5 +# +# modification history +# -------------------- +# 01a,06dec04,jb Copied from make.ARMARCH5diab +# +# DESCRIPTION +# This file contains ARMARCH6 specific definitions and flags for the +# Diab tools (compiler, assembler, linker etc.) +# + +CPU = ARMARCH6 +TOOL = diab + +include $(TGT_DIR)/h/tool/diab/defs.arm + +TGT_FLAG = -tARMV6LS:$(DIAB_T_ENVIRON) + +# end of make.ARMARCH6diab diff --git a/h/tool/diab/make.ARMARCH6diabbe b/h/tool/diab/make.ARMARCH6diabbe new file mode 100644 index 0000000..3f4796e --- /dev/null +++ b/h/tool/diab/make.ARMARCH6diabbe @@ -0,0 +1,19 @@ +# make.ARMARCH6diabbe - Diab compilation tools definitions for ARMARCH6 +# +# modification history +# -------------------- +# 01a,06dec04,jb created from make.ARMARCH5diabbe +# +# DESCRIPTION +# This file contains ARMARCH6 specific definitions and flags for the +# Diab tools (compiler, assembler, linker etc.) +# + +CPU = ARMARCH6 +TOOL = diabbe + +include $(TGT_DIR)/h/tool/diab/defs.arm + +TGT_FLAG = -tARMV6ES:$(DIAB_T_ENVIRON) + +# end of make.ARMARCH6diabbe diff --git a/h/tool/diab/make.I80486diab b/h/tool/diab/make.I80486diab new file mode 100644 index 0000000..a44b2e9 --- /dev/null +++ b/h/tool/diab/make.I80486diab @@ -0,0 +1,28 @@ +# make.I80486diab - Diab compilation tools definitions for I80486 +# +# modification history +# -------------------- +# 01b,23apr04,yvp added ABI_SPEC +# 01a,18nov03,zmm Written based on make.PENTIUM3diab +# +# DESCRIPTION +# This file contains I80486 specific definitions and flags for the +# diab tools (compiler, assembler, linker etc.) +#*/ + +include $(TGT_DIR)/h/tool/diab/defs.diab +CPU = I80486 +TOOL = diab + +TGT_FLAG = -tX86LH:$(DIAB_T_ENVIRON) + +TOOLENV = pentium +VX_CPU_FAMILY = pentium +ARCH_DIR = i86 +ABI_SPEC = x86 + +CFLAGS_AS += -Wa,-Xmnem-mit + +HLL_PREFIX = + +# end of make.I80486diab diff --git a/h/tool/diab/make.MIPS32sfdiab b/h/tool/diab/make.MIPS32sfdiab new file mode 100644 index 0000000..1afcf23 --- /dev/null +++ b/h/tool/diab/make.MIPS32sfdiab @@ -0,0 +1,38 @@ +# make.MIPS32sfdiab - Diab compilation tools definitions for MIPS32 sf +# +# modification history +# -------------------- +# 01l,06may05,rlg Changes for MIPS specific devices +# 01k,06apr04,yvp Added correct ABI_SPEC for use by scgen. +# 01j,30sep03,sn changed :vxworks55 to :$(DIAB_T_ENVIRON) +# 01i,10jan02,pes Move include of defs.mips after CPU and TOOL are defined +# 01h,08jan02,pes Move common definitions to target/h/tool/diab/defs.mips +# and/or target/h/tool/common/defs.mips +# 01g,05dec01,pes Override defs.diab values for ROM_ENTRY, SYS_ENTRY and +# USR_ENTRY +# 01f,05dec01,pes Update TGT_FLAG +# 01e,29nov01,pes Remove definitions of DEPEND_GEN_UTIL and other macros. +# 01d,12nov01,pes Adjusting compiler flags +# 01c,09nov01,pes Remove explicit LDFLAGS settings (use defaults from +# defs.diab) +# 01b,19oct01,mem include defs.diab +# 01a,17feb00,jab written from make.MIPS32sfgnu. +# +# DESCRIPTION +# This file contains MIPS32 (soft-float) specific definitions and flags +# for the Diab tools (compiler, assembler, linker etc.) +# + +CPU = MIPS32 +TOOL = sfdiab +include $(TGT_DIR)/h/tool/diab/defs.mips +#add the next two line for MIPS specific devices +LD_SCRIPT_RAM = $(TGT_DIR)/h/tool/diab/ldscripts/link.MIPSRAM +LD_SCRIPT_ROM = $(TGT_DIR)/h/tool/diab/ldscripts/link.MIPSROM + +# Select MIPS-II, soft-float +TGT_FLAG = -tMIPS2FS:$(DIAB_T_ENVIRON) + +ABI_SPEC = MIPS32 + +# end of make.MIPS32sfdiab diff --git a/h/tool/diab/make.MIPS32sfdiable b/h/tool/diab/make.MIPS32sfdiable new file mode 100644 index 0000000..3965d08 --- /dev/null +++ b/h/tool/diab/make.MIPS32sfdiable @@ -0,0 +1,38 @@ +# make.MIPS32sfdiable - Diab compilation tools definitions for MIPS32sfle +# +# modification history +# -------------------- +# 01l,06may05,rlg Changes for MIPS specific devices +# 01k,06apr04,yvp Added correct ABI_SPEC for use by scgen. +# 01j,30sep03,sn changed :vxworks55 to :$(DIAB_T_ENVIRON) +# 01i,10jan02,pes Move include of defs.mips after CPU and TOOL are defined +# 01h,08jan02,pes Move common definitions to target/h/tool/diab/defs.mips +# and/or target/h/tool/common/defs.mips +# 01g,05dec01,pes Override defs.diab values for ROM_ENTRY, SYS_ENTRY and +# USR_ENTRY +# 01f,05dec01,pes Update TGT_FLAG +# 01e,29nov01,pes Remove definitions of DEPEND_GEN_UTIL and other macros. +# 01d,12nov01,pes Adjusting compiler flags +# 01c,09nov01,pes Modify TGT_FLAG value. Remove explicit LDFLAGS settings +# (use defaults from defs.diab). +# 01b,19oct01,mem include defs.diab +# 01a,05oct01,mem written from make.MIPS32sfgnule. +# +# DESCRIPTION +# This file contains MIPS32 (soft-float) specific definitions and flags +# for the Diab tools (compiler, assembler, linker etc.) +# + +CPU = MIPS32 +TOOL = sfdiable +include $(TGT_DIR)/h/tool/diab/defs.mips +#add the next two line for MIPS specific devices +LD_SCRIPT_RAM = $(TGT_DIR)/h/tool/diab/ldscripts/link.MIPSRAM +LD_SCRIPT_ROM = $(TGT_DIR)/h/tool/diab/ldscripts/link.MIPSROM + +# Select MIPS-II, soft-float, little-endian +TGT_FLAG = -tMIPS2MS:$(DIAB_T_ENVIRON) + +ABI_SPEC = MIPS32 + +# end of make.MIPS32sfdiable diff --git a/h/tool/diab/make.MIPS64diab b/h/tool/diab/make.MIPS64diab new file mode 100644 index 0000000..43c803d --- /dev/null +++ b/h/tool/diab/make.MIPS64diab @@ -0,0 +1,39 @@ +# make.MIPS64diab - Diab compilation tools definitions for MIPS64 +# +# modification history +# -------------------- +# 01m,06may05,rlg Changes for MIPS specific devices +# 01l,06apr04,yvp Added correct ABI_SPEC for use by scgen. +# 01k,30sep03,sn changed :vxworks55 to :$(DIAB_T_ENVIRON) +# 01j,25mar02,pes Revert to MIPS ISA III. +# 01i,10jan02,pes Move include of defs.mips after CPU and TOOL are defined +# 01h,08jan02,pes Move common definitions to target/h/tool/diab/defs.mips +# and/or target/h/tool/common/defs.mips +# 01g,05dec01,pes Override defs.diab values for ROM_ENTRY, SYS_ENTRY and +# USR_ENTRY +# 01f,05dec01,pes Update TGT_FLAG +# 01e,29nov01,pes Remove definitions of DEPEND_GEN_UTIL and other macros. +# 01d,12nov01,pes Adjusting compiler flags +# 01c,09nov01,pes Remove explicit LDFLAGS settings (use defaults from +# defs.diab) +# 01b,19oct01,mem include defs.diab +# 01a,17feb00,jab written from make.MIPS64gnu. +# +# DESCRIPTION +# This file contains MIPS64 (hard-float) specific definitions and flags +# for the Diab tools (compiler, assembler, linker etc.) +# + +CPU = MIPS64 +TOOL = diab +include $(TGT_DIR)/h/tool/diab/defs.mips +#add the next two line for MIPS specific devices +LD_SCRIPT_RAM = $(TGT_DIR)/h/tool/diab/ldscripts/link.MIPSRAM +LD_SCRIPT_ROM = $(TGT_DIR)/h/tool/diab/ldscripts/link.MIPSROM + +# Select MIPS-IV, hard-float +TGT_FLAG = -tMIPS3XH:$(DIAB_T_ENVIRON) + +ABI_SPEC = MIPS64BE + +# end of make.MIPS64diab diff --git a/h/tool/diab/make.MIPS64diable b/h/tool/diab/make.MIPS64diable new file mode 100644 index 0000000..7759e89 --- /dev/null +++ b/h/tool/diab/make.MIPS64diable @@ -0,0 +1,40 @@ +# make.MIPS64diable - Diab compilation tools definitions for MIPS64le +# +# modification history +# -------------------- +# 01m,06may05,rlg Changes for MIPS specific devices +# 01l,06apr04,yvp Added correct ABI_SPEC for use by scgen. +# 01k,30sep03,sn changed :vxworks55 to :$(DIAB_T_ENVIRON) +# 01j,25mar02,pes Revert to MIPS ISA III. +# 01i,10jan02,pes Move include of defs.mips after CPU and TOOL are defined +# 01h,08jan02,pes Move common definitions to target/h/tool/diab/defs.mips +# and/or target/h/tool/common/defs.mips +# 01g,05dec01,pes Override defs.diab values for ROM_ENTRY, SYS_ENTRY and +# USR_ENTRY +# 01f,05dec01,pes Update TGT_FLAG +# 01e,29nov01,pes Remove definitions of DEPEND_GEN_UTIL and other macros. +# 01e,15nov01,pes Correct TGT_FLAG: MIPSZH -> MIPS4ZH +# 01d,12nov01,pes Adjusting compiler flags +# 01c,09nov01,pes Remove explicit LDFLAGS settings (use defaults from +# defs.diab) +# 01b,19oct01,mem include defs.diab +# 01a,05oct01,mem written from make.MIPS64gnu. +# +# DESCRIPTION +# This file contains MIPS64 (little-endian) specific definitions and flags +# for the Diab tools (compiler, assembler, linker etc.) +# + +CPU = MIPS64 +TOOL = diable +include $(TGT_DIR)/h/tool/diab/defs.mips +#add the next two line for MIPS specific devices +LD_SCRIPT_RAM = $(TGT_DIR)/h/tool/diab/ldscripts/link.MIPSRAM +LD_SCRIPT_ROM = $(TGT_DIR)/h/tool/diab/ldscripts/link.MIPSROM + +# Select MIPS-III, hard-float +TGT_FLAG = -tMIPS3ZH:$(DIAB_T_ENVIRON) + +ABI_SPEC = MIPS64LE + +# end of make.MIPS64diable diff --git a/h/tool/diab/make.PENTIUM2diab b/h/tool/diab/make.PENTIUM2diab new file mode 100644 index 0000000..dccf658 --- /dev/null +++ b/h/tool/diab/make.PENTIUM2diab @@ -0,0 +1,34 @@ +# make.PENTIUM2diab - Diab compilation tools definitions for Pentium-II +# +# modification history +# -------------------- +# 01f,17may05,zmm Emulate GNU assembler's encoding of +# fdivp/fdivrp/fsubp/fsubrp instructions. SPR 108421. +# 01e,10oct04,mcm Using the CPU name for the target switch. It is mapped to +# X86 by the compiler. +# 01d,20jan04,zmm Redefined prepended underscore HLL_PREFIX for diab/pentium +# 01c,12dec03,yvp Corrected ARCH_DIR. +# 01b,10dec03,yvp Added ABI_SPEC. +# 01a,27oct03,zmm Created based on 01a version of make.PENTIUM3diab. Only CPU is changed into PENTIUM2 +# +# DESCRIPTION +# This file contains Pentium-II specific definitions and flags for the +# diab tools (compiler, assembler, linker etc.) +#*/ + +include $(TGT_DIR)/h/tool/diab/defs.diab +CPU = PENTIUM2 +TOOL = diab + +TGT_FLAG = -tPENTIUM2LH:$(DIAB_T_ENVIRON) + +TOOLENV = pentium +VX_CPU_FAMILY = pentium +ARCH_DIR = i86 +ABI_SPEC = x86 + +CFLAGS_AS += -Wa,-Xmnem-mit,-Xemul-gnu-bug + +HLL_PREFIX = + +# end of make.PENTIUM2diab diff --git a/h/tool/diab/make.PENTIUM3diab b/h/tool/diab/make.PENTIUM3diab new file mode 100644 index 0000000..f786a09 --- /dev/null +++ b/h/tool/diab/make.PENTIUM3diab @@ -0,0 +1,35 @@ +# make.PENTIUM3diab - Diab compilation tools definitions for Pentium-III +# +# modification history +# -------------------- +# 01f,17may05,zmm Emulate GNU assembler's encoding of +# fdivp/fdivrp/fsubp/fsubrp instructions. SPR 108421. +# 01e,10oct04,mcm Using the CPU name for the target switch. It is mapped to +# X86 by the compiler. +# 01d,20jan04,zmm Redefined prepended underscore HLL_PREFIX for diab/pentium +# 01c,10dec03,yvp Added ABI_SPEC. +# 01b,28oct03,zmm Fix typo in the file name. +# 01a,30sep03,sn changed :vxworks55 to :$(DIAB_T_ENVIRON) +# maxim Initial +# +# DESCRIPTION +# This file contains Pentium-III specific definitions and flags for the +# diab tools (compiler, assembler, linker etc.) +#*/ + +include $(TGT_DIR)/h/tool/diab/defs.diab +CPU = PENTIUM3 +TOOL = diab + +TGT_FLAG = -tPENTIUM3LH:$(DIAB_T_ENVIRON) + +TOOLENV = pentium +VX_CPU_FAMILY = pentium +ARCH_DIR = i86 +ABI_SPEC = x86 + +CFLAGS_AS += -Wa,-Xmnem-mit,-Xemul-gnu-bug + +HLL_PREFIX = + +# end of make.PENTIUM3diab diff --git a/h/tool/diab/make.PENTIUM4diab b/h/tool/diab/make.PENTIUM4diab new file mode 100644 index 0000000..0dab026 --- /dev/null +++ b/h/tool/diab/make.PENTIUM4diab @@ -0,0 +1,34 @@ +# make.PENTIUM4diab - Diab compilation tools definitions for Pentium-4 +# +# modification history +# -------------------- +# 01e,17may05,zmm Emulate GNU assembler's encoding of +# fdivp/fdivrp/fsubp/fsubrp instructions. SPR 108421. +# 01d,10oct04,mcm Using the CPU name for the target switch. It is mapped to +# X86 by the compiler. +# 01c,20jan04,zmm Redefined prepended underscore HLL_PREFIX for diab/pentium +# 01b,10dec03,yvp Added ABI_SPEC. +# 01a,30sep03,sn changed :vxworks55 to :$(DIAB_T_ENVIRON) +# maxim Initial +# +# DESCRIPTION +# This file contains Pentium-4 specific definitions and flags for the +# diab tools (compiler, assembler, linker etc.) +#*/ + +include $(TGT_DIR)/h/tool/diab/defs.diab +CPU = PENTIUM4 +TOOL = diab + +TGT_FLAG = -tPENTIUM4LH:$(DIAB_T_ENVIRON) + +TOOLENV = pentium +VX_CPU_FAMILY = pentium +ARCH_DIR = i86 +ABI_SPEC = x86 + +CFLAGS_AS += -Wa,-Xmnem-mit,-Xemul-gnu-bug + +HLL_PREFIX = + +# end of make.PENTIUM4diab diff --git a/h/tool/diab/make.PENTIUMdiab b/h/tool/diab/make.PENTIUMdiab new file mode 100644 index 0000000..c9470f4 --- /dev/null +++ b/h/tool/diab/make.PENTIUMdiab @@ -0,0 +1,30 @@ +# make.PENTIUMdiab - Diab compilation tools definitions for Pentium +# +# modification history +# -------------------- +# 01b,17may05,zmm Emulate GNU assembler's encoding of +# fdivp/fdivrp/fsubp/fsubrp instructions. SPR 108421. +# 01a,18nov03,zmm Written based on make.PENTIUM3diab +# maxim Initial +# +# DESCRIPTION +# This file contains Pentium specific definitions and flags for the +# diab tools (compiler, assembler, linker etc.) +#*/ + +include $(TGT_DIR)/h/tool/diab/defs.diab +CPU = PENTIUM +TOOL = diab + +TGT_FLAG = -tPENTIUMLH:$(DIAB_T_ENVIRON) + +TOOLENV = pentium +VX_CPU_FAMILY = pentium +ARCH_DIR = i86 +ABI_SPEC = x86 + +CFLAGS_AS += -Wa,-Xmnem-mit,-Xemul-gnu-bug + +HLL_PREFIX = + +# end of make.PENTIUMdiab diff --git a/h/tool/diab/make.PPC32diab b/h/tool/diab/make.PPC32diab new file mode 100644 index 0000000..8907546 --- /dev/null +++ b/h/tool/diab/make.PPC32diab @@ -0,0 +1,75 @@ +# make.PPC32diab - diab compilation tools definitions for generic PowerPC +# +# Copyright 1995-2004 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01i,28mar05,dr Adding definitions for LD_SCRIPT_RAM and LD_SCRIPT_ROM +# 01h,28oct04,to remove TOOLENV, etc. which are now defined in defs.ppc. +# 01g,27may04,to added -Xstmw-slow to avoid stmw/lmw alignment exception. +# 01f,21may04,to PPC970 support +# 01e,10aug04,pch SPR 99846: Add support for _745x variant +# 01d,08jun04,pch set _WRS_HARDWARE_FP for hard-float 440 +# 01c,04feb04,pch PPC32 floating-point adjustments +# 01b,05sep03,pch parameterize Diab "environment" setting +# 01a,06feb03,pch Written from make.PPC603diab vn 01f & make.PPC32gnu vn 01b +# +# DESCRIPTION +# This file contains definitions and flags for the diab tools +# (compiler, assembler, linker etc.) to build for a generic +# PowerPC with PPC60x hardware floating point. +# If building for a specific processor (as a variant), +# defs.ppc will set its type number into PPC32VARIANT. +#*/ + +CPU = PPC32 +TOOL = diab +include $(TGT_DIR)/h/tool/common/defs.ppc + +LD_SCRIPT_RAM = -Dwrs_kernel_rom_size=0x0$(ROM_SIZE) \ + $(TGT_DIR)/h/tool/diab/ldscripts/link.DOTBOOTRAM +LD_SCRIPT_ROM = -Dwrs_kernel_rom_size=0x0$(ROM_SIZE) \ + $(TGT_DIR)/h/tool/diab/ldscripts/link.DOTBOOTROM + + +ifeq ($(LIB_DIR_TAG),_ppc604_745x) + # Library build for 745x variant + # Enable AltiVec opcodes e.g. dssall, but not "vector" keyword. Strictly + # speaking, -Xkeywords=0x0 is only for C (not asm), but das does not object. + TGT_FLAG = -tPPC7400FV:$(DIAB_T_ENVIRON) -Xkeywords=0x0 +else + ifeq ($(CPU_VARIANT),_ppc604_745x) + # BSP build with CPU=PPC32 CPU_VARIANT=_ppc604_745x also needs AV opcodes. + # Use CC_ARCH_SPEC since dld *does* object to -Xkeywords. + TGT_FLAG = -tPPC7400FV:$(DIAB_T_ENVIRON) + CC_ARCH_SPEC += -Xkeywords=0x0 + else + TGT_FLAG = -tPPC$(PPC32VARIANT)FH:$(DIAB_T_ENVIRON) + endif +endif + +ifeq ($(PPC32VARIANT),) + CC_ARCH_SPEC += -Xstmw-slow -DPPC32_fp60x + # *** TEMP HACK: enable AltiVec support for math/fioLib.c + # *** Remove this when the coprocessor abstraction + # *** supports printf/scanf format extensions. + OPTION_ALTIVEC_C = -tPPCFV:$(DIAB_T_ENVIRON) -Xkeywords=0x0 -D_WRS_ALTIVEC_SUPPORT +endif + +ifeq ($(PPC32VARIANT),604) + OPTION_ALTIVEC_AS = -tPPC7400FV:$(DIAB_T_ENVIRON) + OPTION_ALTIVEC_C = -tPPC7400FV:$(DIAB_T_ENVIRON) -Xkeywords=0x0 +endif + +ifeq ($(PPC32VARIANT),440) + # inform ppc440.h that we are building for hardware FP + CC_ARCH_SPEC += -D_WRS_HARDWARE_FP +endif + +ifeq ($(PPC32VARIANT),970) + CC_ARCH_SPEC += -Xstmw-slow + OPTION_ALTIVEC_AS = -tPPC970FV:$(DIAB_T_ENVIRON) + OPTION_ALTIVEC_C = -tPPC970FV:$(DIAB_T_ENVIRON) -Xkeywords=0x0 +endif + +# end of make.PPC32diab diff --git a/h/tool/diab/make.PPC32sfdiab b/h/tool/diab/make.PPC32sfdiab new file mode 100644 index 0000000..acfc77a --- /dev/null +++ b/h/tool/diab/make.PPC32sfdiab @@ -0,0 +1,42 @@ +# make.PPC32sfdiab - diab compilation tools definitions for generic PowerPC +# +# Copyright 1995-2004 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01c,16dec04,dr Adding definitions for LD_SCRIPT_RAM and LD_SCRIPT_ROM +# 01b,03mar04,mil Added support for PPC85XX. +# 01a,04feb04,pch Written from make.PPC32diab vn 01b +# +# DESCRIPTION +# This file contains definitions and flags for the diab tools +# (compiler, assembler, linker etc.) to build for a generic +# PowerPC without PPC60x hardware floating point. +# If building for a specific processor (as a variant), +# defs.ppc will set its type number into PPC32VARIANT. +#*/ + +CPU = PPC32 +TOOL = sfdiab +include $(TGT_DIR)/h/tool/common/defs.ppc + +LD_SCRIPT_RAM = -Dwrs_kernel_rom_size=0x0$(ROM_SIZE) \ + $(TGT_DIR)/h/tool/diab/ldscripts/link.DOTBOOTRAM +LD_SCRIPT_ROM = -Dwrs_kernel_rom_size=0x0$(ROM_SIZE) \ + $(TGT_DIR)/h/tool/diab/ldscripts/link.DOTBOOTROM + + +ifeq ($(PPC32VARIANT),85XX) +TGT_FLAG = -tPPCE500FS:$(DIAB_T_ENVIRON) +else +TGT_FLAG = -tPPC$(PPC32VARIANT)FS:$(DIAB_T_ENVIRON) +endif + +CC_COMPILER += -Xstsw-slow +C++_COMPILER += -Xstsw-slow + +TOOLENV = ppc +VX_CPU_FAMILY = ppc +ARCH_DIR = ppc + +# end of make.PPC32diab diff --git a/h/tool/diab/make.PPC403diab b/h/tool/diab/make.PPC403diab new file mode 100644 index 0000000..6ebe38b --- /dev/null +++ b/h/tool/diab/make.PPC403diab @@ -0,0 +1,37 @@ +# make.PPC403diab - Diab compilation tools definitions for PowerPC 403 +# +# Copyright 1995-2003 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01i,05sep03,pch parameterize Diab "environment" setting +# 01h,31jan03,pch Add PPC32 support +# 01g,10dec01,tpw Ensure ROM_SIZE defaults to 0x0 if the macro is not set. +# 01f,05dec01,tpw Utilize DOTBOOT{RAM,ROM} linker scripts on all PPC4xx BSPs. +# 01e,05dec01,jab change :tornado, :simple ,etc. to :vxworks55 +# 01d,16nov01,mil Changed VX_CPU_FAMILY from PPC to ppc. +# 01c,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01b,23oct01,jab added PPC specific definitions +# 01a,16oct01,jab Written from make.PPC403gnu 01n version. +# +# DESCRIPTION +# This file contains PowerPC 403 specific definitions and flags for the +# diab tools (compiler, assembler, linker etc.) +#*/ + +CPU = PPC403 +TOOL = diab +include $(TGT_DIR)/h/tool/common/defs.ppc + +TGT_FLAG = -tPPC403FS:$(DIAB_T_ENVIRON) + +LD_SCRIPT_RAM = -Dwrs_kernel_rom_size=0x0$(ROM_SIZE) \ + $(TGT_DIR)/h/tool/diab/ldscripts/link.DOTBOOTRAM +LD_SCRIPT_ROM = -Dwrs_kernel_rom_size=0x0$(ROM_SIZE) \ + $(TGT_DIR)/h/tool/diab/ldscripts/link.DOTBOOTROM + +TOOLENV = ppc +VX_CPU_FAMILY = ppc +ARCH_DIR = ppc + +# end of make.PPC403diab diff --git a/h/tool/diab/make.PPC405diab b/h/tool/diab/make.PPC405diab new file mode 100644 index 0000000..587d588 --- /dev/null +++ b/h/tool/diab/make.PPC405diab @@ -0,0 +1,38 @@ +# make.PPC405diab - Diab compilation tools definitions for PowerPC 405 +# +# Copyright 1995-2003 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01j,10aug04,kab SPR#100219: support for TOOL=sfdiab, sfgnu. +# 01i,05sep03,pch parameterize Diab "environment" setting +# 01h,31jan03,pch Add PPC32 support +# 01g,10dec01,tpw Ensure ROM_SIZE defaults to 0x0 if the macro is not set. +# 01f,05dec01,tpw Utilize DOTBOOT{RAM,ROM} linker scripts on all PPC4xx BSPs. +# 01e,05dec01,jab change :tornado, :simple ,etc. to :vxworks55 +# 01d,16nov01,mil Changed VX_CPU_FAMILY from PPC to ppc. +# 01c,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01b,23oct01,jab added PPC specific definitions +# 01a,16oct01,jab Written from make.PPC405gnu 01e version. +# +# DESCRIPTION +# This file contains PowerPC 405 specific definitions and flags for the +# diab tools (compiler, assembler, linker etc.) +#*/ + +CPU = PPC405 +TOOL = diab +include $(TGT_DIR)/h/tool/common/defs.ppc + +TGT_FLAG = -tPPC405FS:$(DIAB_T_ENVIRON) + +LD_SCRIPT_RAM = -Dwrs_kernel_rom_size=0x0$(ROM_SIZE) \ + $(TGT_DIR)/h/tool/diab/ldscripts/link.DOTBOOTRAM +LD_SCRIPT_ROM = -Dwrs_kernel_rom_size=0x0$(ROM_SIZE) \ + $(TGT_DIR)/h/tool/diab/ldscripts/link.DOTBOOTROM + +TOOLENV = ppc +VX_CPU_FAMILY = ppc +ARCH_DIR = ppc + +# end of make.PPC405diab diff --git a/h/tool/diab/make.PPC405sfdiab b/h/tool/diab/make.PPC405sfdiab new file mode 100644 index 0000000..081769b --- /dev/null +++ b/h/tool/diab/make.PPC405sfdiab @@ -0,0 +1,38 @@ +# make.PPC405sfdiab - Diab compilation tools definitions for PowerPC 405 +# +# Copyright 1995-2003 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01j,10aug04,kab SPR#100219: support for TOOL=sfdiab, sfgnu. +# 01i,05sep03,pch parameterize Diab "environment" setting +# 01h,31jan03,pch Add PPC32 support +# 01g,10dec01,tpw Ensure ROM_SIZE defaults to 0x0 if the macro is not set. +# 01f,05dec01,tpw Utilize DOTBOOT{RAM,ROM} linker scripts on all PPC4xx BSPs. +# 01e,05dec01,jab change :tornado, :simple ,etc. to :vxworks55 +# 01d,16nov01,mil Changed VX_CPU_FAMILY from PPC to ppc. +# 01c,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01b,23oct01,jab added PPC specific definitions +# 01a,16oct01,jab Written from make.PPC405gnu 01e version. +# +# DESCRIPTION +# This file contains PowerPC 405 specific definitions and flags for the +# diab tools (compiler, assembler, linker etc.) +#*/ + +CPU = PPC405 +TOOL = sfdiab +include $(TGT_DIR)/h/tool/common/defs.ppc + +TGT_FLAG = -tPPC405FS:$(DIAB_T_ENVIRON) + +LD_SCRIPT_RAM = -Dwrs_kernel_rom_size=0x0$(ROM_SIZE) \ + $(TGT_DIR)/h/tool/diab/ldscripts/link.DOTBOOTRAM +LD_SCRIPT_ROM = -Dwrs_kernel_rom_size=0x0$(ROM_SIZE) \ + $(TGT_DIR)/h/tool/diab/ldscripts/link.DOTBOOTROM + +TOOLENV = ppc +VX_CPU_FAMILY = ppc +ARCH_DIR = ppc + +# end of make.PPC405sfdiab diff --git a/h/tool/diab/make.PPC440diab b/h/tool/diab/make.PPC440diab new file mode 100644 index 0000000..11f7c80 --- /dev/null +++ b/h/tool/diab/make.PPC440diab @@ -0,0 +1,35 @@ +# make.PPC440diab - Diab compilation tools definitions for PowerPC 440 +# +# Copyright 1995-2002 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01o,09aug04,kab SPR#100219: support for TOOL=sfdiab, sfgnu. +# 01f,05sep03,pch parameterize Diab "environment" setting +# 01e,12dec02,pch Add PPC32 support +# 01d,10dec01,tpw Ensure ROM_SIZE defaults to 0x0 if the macro is not set. +# 01c,05dec01,tpw Utilize DOTBOOT{RAM,ROM} linker scripts on all PPC4xx BSPs. +# 01b,05dec01,jab change :tornado, :simple ,etc. to :vxworks55 +# 01a,27nov01,pch Written from make.PPC405diab vn 01d. +# +# DESCRIPTION +# This file contains PowerPC 440 specific definitions and flags for the +# diab tools (compiler, assembler, linker etc.) +#*/ + +CPU = PPC440 +TOOL = diab +include $(TGT_DIR)/h/tool/common/defs.ppc + +TGT_FLAG = -tPPC440FH:$(DIAB_T_ENVIRON) + +LD_SCRIPT_RAM = -Dwrs_kernel_rom_size=0x0$(ROM_SIZE) \ + $(TGT_DIR)/h/tool/diab/ldscripts/link.DOTBOOTRAM +LD_SCRIPT_ROM = -Dwrs_kernel_rom_size=0x0$(ROM_SIZE) \ + $(TGT_DIR)/h/tool/diab/ldscripts/link.DOTBOOTROM + +TOOLENV = ppc +VX_CPU_FAMILY = ppc +ARCH_DIR = ppc + +# end of make.PPC440diab diff --git a/h/tool/diab/make.PPC440sfdiab b/h/tool/diab/make.PPC440sfdiab new file mode 100644 index 0000000..b28f338 --- /dev/null +++ b/h/tool/diab/make.PPC440sfdiab @@ -0,0 +1,35 @@ +# make.PPC440sfdiab - Diab compilation tools definitions for PowerPC 440 +# +# Copyright 1995-2002 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01o,09aug04,kab SPR#100219: support for TOOL=sfdiab, sfgnu. +# 01f,05sep03,pch parameterize Diab "environment" setting +# 01e,12dec02,pch Add PPC32 support +# 01d,10dec01,tpw Ensure ROM_SIZE defaults to 0x0 if the macro is not set. +# 01c,05dec01,tpw Utilize DOTBOOT{RAM,ROM} linker scripts on all PPC4xx BSPs. +# 01b,05dec01,jab change :tornado, :simple ,etc. to :vxworks55 +# 01a,27nov01,pch Written from make.PPC405diab vn 01d. +# +# DESCRIPTION +# This file contains PowerPC 440 specific definitions and flags for the +# diab tools (compiler, assembler, linker etc.) +#*/ + +CPU = PPC440 +TOOL = sfdiab +include $(TGT_DIR)/h/tool/common/defs.ppc + +TGT_FLAG = -tPPC440FS:$(DIAB_T_ENVIRON) + +LD_SCRIPT_RAM = -Dwrs_kernel_rom_size=0x0$(ROM_SIZE) \ + $(TGT_DIR)/h/tool/diab/ldscripts/link.DOTBOOTRAM +LD_SCRIPT_ROM = -Dwrs_kernel_rom_size=0x0$(ROM_SIZE) \ + $(TGT_DIR)/h/tool/diab/ldscripts/link.DOTBOOTROM + +TOOLENV = ppc +VX_CPU_FAMILY = ppc +ARCH_DIR = ppc + +# end of make.PPC440sfdiab diff --git a/h/tool/diab/make.PPC603diab b/h/tool/diab/make.PPC603diab new file mode 100644 index 0000000..1ff693c --- /dev/null +++ b/h/tool/diab/make.PPC603diab @@ -0,0 +1,30 @@ +# make.PPC603diab - diab compilation tools definitions for PowerPC 603/604 +# +# Copyright 1995-2003 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01g,05sep03,pch parameterize Diab "environment" setting +# 01f,31jan03,pch Add PPC32 support +# 01e,05dec01,jab change :tornado, :simple ,etc. to :vxworks55 +# 01d,16nov01,mil Changed VX_CPU_FAMILY from PPC to ppc. +# 01c,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01b,23oct01,jab added PPC specific definitions +# 01a,16oct01,jab Written from make.PPC603gnu 01r version. +# +# DESCRIPTION +# This file contains PowerPC 603/604 specific definitions and flags for the +# diab tools (compiler, assembler, linker etc.) +#*/ + +CPU = PPC603 +TOOL = diab +include $(TGT_DIR)/h/tool/common/defs.ppc + +TGT_FLAG = -tPPC603FH:$(DIAB_T_ENVIRON) + +TOOLENV = ppc +VX_CPU_FAMILY = ppc +ARCH_DIR = ppc + +# end of make.PPC603diab diff --git a/h/tool/diab/make.PPC604diab b/h/tool/diab/make.PPC604diab new file mode 100644 index 0000000..20309cc --- /dev/null +++ b/h/tool/diab/make.PPC604diab @@ -0,0 +1,49 @@ +# make.PPC604diab - Diab compilation tools definitions for PowerPC 604 +# +# Copyright 1995-2003 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01i,10aug04,pch SPR 99846: Add support for _745x variant +# 01h,05sep03,pch parameterize Diab "environment" setting +# 01g,31jan03,pch Add PPC32 support +# 01f,05dec01,jab change :tornado, :simple ,etc. to :vxworks55 +# 01e,16nov01,mil Changed VX_CPU_FAMILY from PPC to ppc. +# 01d,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01c,25oct01,jab added OPTION_ALTIVEC_C make variable +# 01b,23oct01,jab added OPTION_ALTIVEC_AS and PPC specific defs +# 01a,16oct01,jab Written from make.PPC604gnu 01r version. +# +# DESCRIPTION +# This file contains PowerPC 604 specific definitions and flags for the +# diab tools (compiler, assembler, linker etc.) +#*/ + +CPU = PPC604 +TOOL = diab +include $(TGT_DIR)/h/tool/common/defs.ppc + +ifeq ($(LIB_DIR_TAG),_745x) + # Library build for 745x variant + # Enable AltiVec opcodes e.g. dssall, but not "vector" keyword. Strictly + # speaking, -Xkeywords=0x0 is only for C (not asm), but das does not object. + TGT_FLAG = -tPPC7400FV:$(DIAB_T_ENVIRON) -Xkeywords=0x0 +else + ifeq ($(CPU_VARIANT),_745x) + # BSP build with CPU=PPC604 CPU_VARIANT=_745x also needs AV opcodes. + # Use CC_ARCH_SPEC since dld *does* object to -Xkeywords. + TGT_FLAG = -tPPC7400FV:$(DIAB_T_ENVIRON) + CC_ARCH_SPEC += -Xkeywords=0x0 + else + TGT_FLAG = -tPPC604FH:$(DIAB_T_ENVIRON) + endif +endif + +TOOLENV = ppc +VX_CPU_FAMILY = ppc +ARCH_DIR = ppc + +OPTION_ALTIVEC_AS = -tPPC7400FV:$(DIAB_T_ENVIRON) +OPTION_ALTIVEC_C = -tPPC7400FV:$(DIAB_T_ENVIRON) -Xkeywords=0x0 + +# end of make.PPC604diab diff --git a/h/tool/diab/make.PPC85XXdiab b/h/tool/diab/make.PPC85XXdiab new file mode 100644 index 0000000..aa12a7f --- /dev/null +++ b/h/tool/diab/make.PPC85XXdiab @@ -0,0 +1,44 @@ +# make.PPC85XXdiab - diab compilation tools definitions for PowerPC e500 Core +# +# modification history +# -------------------- +# 01o,09aug04,kab SPR#100219: support for TOOL=sfdiab, sfgnu. +# 01n,26sep03,mil Added intrinsic mask to work around missing alloca. +# 01m,26sep03,xav Define SIZE macro using 5.1.2 diab ddump utility (-Z support) +# 01l,13aug03,dtr Removing hardware floating point option. +# 01k,01aug03,xav Set compilers values to specific e500 diab 5.1.2 values +# 01j,04jun03,sn E500 requires Diab >= 5.1.1 +# 01i,03jun03,dtr Adding -Xstsw-slow and changing target flag to FF for +# single precision floating point support. +# 01h,09may03,tpw Fix typo +# 01g,03oct02,mil Changed flag from -tPPCE500FV to -tPPCE500FS. +# 01f,03sep02,dtr Changing compiler options to PPCE500. +# 01e,05dec01,jab change :tornado, :simple ,etc. to :vxworks55 +# 01d,16nov01,mil Changed VX_CPU_FAMILY from PPC to ppc. +# 01c,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01b,23oct01,jab added PPC specific definitions +# 01a,16oct01,jab Written from make.PPC603gnu 01r version. +# +# DESCRIPTION +# This file contains PowerPC e500 specific definitions and flags for the +# diab tools (compiler, assembler, linker etc.) +#*/ + +CPU = PPC85XX +TOOL = diab + +include $(TGT_DIR)/h/tool/common/defs.ppc + +TGT_FLAG = -tPPCE500FS:$(DIAB_T_ENVIRON) + +LD_SCRIPT_RAM = -Dwrs_kernel_rom_size=0x0$(ROM_SIZE) \ + $(TGT_DIR)/h/tool/diab/ldscripts/link.DOTBOOTRAM +LD_SCRIPT_ROM = -Dwrs_kernel_rom_size=0x0$(ROM_SIZE) \ + $(TGT_DIR)/h/tool/diab/ldscripts/link.DOTBOOTROM + +TOOLENV = ppc +VX_CPU_FAMILY = ppc +ARCH_DIR = ppc + + +# end of make.PPC85XXdiab diff --git a/h/tool/diab/make.PPC85XXsfdiab b/h/tool/diab/make.PPC85XXsfdiab new file mode 100644 index 0000000..99c1bf0 --- /dev/null +++ b/h/tool/diab/make.PPC85XXsfdiab @@ -0,0 +1,44 @@ +# make.PPC85XXsfdiab - diab compilation tools definitions for PowerPC e500 Core +# +# modification history +# -------------------- +# 01o,09aug04,kab SPR#100219: support for TOOL=sfdiab, sfgnu. +# 01n,26sep03,mil Added intrinsic mask to work around missing alloca. +# 01m,26sep03,xav Define SIZE macro using 5.1.2 diab ddump utility (-Z support) +# 01l,13aug03,dtr Removing hardware floating point option. +# 01k,01aug03,xav Set compilers values to specific e500 diab 5.1.2 values +# 01j,04jun03,sn E500 requires Diab >= 5.1.1 +# 01i,03jun03,dtr Adding -Xstsw-slow and changing target flag to FF for +# single precision floating point support. +# 01h,09may03,tpw Fix typo +# 01g,03oct02,mil Changed flag from -tPPCE500FV to -tPPCE500FS. +# 01f,03sep02,dtr Changing compiler options to PPCE500. +# 01e,05dec01,jab change :tornado, :simple ,etc. to :vxworks55 +# 01d,16nov01,mil Changed VX_CPU_FAMILY from PPC to ppc. +# 01c,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01b,23oct01,jab added PPC specific definitions +# 01a,16oct01,jab Written from make.PPC603gnu 01r version. +# +# DESCRIPTION +# This file contains PowerPC e500 specific definitions and flags for the +# diab tools (compiler, assembler, linker etc.) +#*/ + +CPU = PPC85XX +TOOL = sfdiab + +include $(TGT_DIR)/h/tool/common/defs.ppc + +TGT_FLAG = -tPPCE500FS:$(DIAB_T_ENVIRON) + +LD_SCRIPT_RAM = -Dwrs_kernel_rom_size=0x0$(ROM_SIZE) \ + $(TGT_DIR)/h/tool/diab/ldscripts/link.DOTBOOTRAM +LD_SCRIPT_ROM = -Dwrs_kernel_rom_size=0x0$(ROM_SIZE) \ + $(TGT_DIR)/h/tool/diab/ldscripts/link.DOTBOOTROM + +TOOLENV = ppc +VX_CPU_FAMILY = ppc +ARCH_DIR = ppc + + +# end of make.PPC85XXsfdiab diff --git a/h/tool/diab/make.PPC860sfdiab b/h/tool/diab/make.PPC860sfdiab new file mode 100644 index 0000000..09be066 --- /dev/null +++ b/h/tool/diab/make.PPC860sfdiab @@ -0,0 +1,28 @@ +# make.PPC860sfdiab - Diab compilation tools definitions for PowerPC 860 +# +# Copyright (c) 2005 Wind River Systems, Inc. The right to copy, +# distribute, modify, or otherwise make use of this software may +# be licensed only pursuant to the terms of an applicable Wind River +# license agreement. +# +# modification history +# -------------------- +# 01a,20jun05,cjj written based on make.PPC860diab version 01g. +# changed TOOL definition from diab to sfdiab +# +# DESCRIPTION +# This file contains PowerPC 860 specific definitions and flags for the +# diab tools (compiler, assembler, linker etc.) +#*/ + +CPU = PPC860 +TOOL = sfdiab +include $(TGT_DIR)/h/tool/common/defs.ppc + +TGT_FLAG = -tPPC860FS:$(DIAB_T_ENVIRON) + +TOOLENV = ppc +VX_CPU_FAMILY = ppc +ARCH_DIR = ppc + +# end of make.PPC860sfdiab diff --git a/h/tool/diab/make.SH7750diab b/h/tool/diab/make.SH7750diab new file mode 100644 index 0000000..55b660b --- /dev/null +++ b/h/tool/diab/make.SH7750diab @@ -0,0 +1,30 @@ +# make.SH7750diab - Diab compilation tools definitions for Hitachi SH7750 (SH4) +# +# modification history +# -------------------- +# 01e,07feb05,h_k moved assembly flags to OPTION_LANG_ASM. (SPR #106163) +# 01d,10dec03,yvp Added ABI_SPEC. +# 01c,30sep03,sn changed :vxworks55 to :$(DIAB_T_ENVIRON) +# 01b,05dec01,jab change :tornado, :simple ,etc. to :vxworks55 +# 01a,31Oct01,h_k written from make.PPC860diab. +# +# DESCRIPTION +# This file contains SH7750 (SH4) specific definitions and flags for the +# Diab tools (compiler, assembler, linker etc.) +# + +include $(TGT_DIR)/h/tool/diab/defs.diab +CPU = SH7750 +TOOL = diab + +TGT_FLAG = -tSH4EH:$(DIAB_T_ENVIRON) + +CC_ARCH_SPEC += -Xunderscore-leading +OPTION_LANG_ASM += -Wa,-Xalign-power2 + +TOOLENV = sh +VX_CPU_FAMILY = sh +ARCH_DIR = sh +ABI_SPEC = sh4 + +# end of make.SH7750diab diff --git a/h/tool/diab/make.SH7750diable b/h/tool/diab/make.SH7750diable new file mode 100644 index 0000000..fab0469 --- /dev/null +++ b/h/tool/diab/make.SH7750diable @@ -0,0 +1,31 @@ +# make.SH7750diable - Diab little endian compilation tools definitions for +# Hitachi SH7750 (SH4) +# +# modification history +# -------------------- +# 01e,04feb05,h_k moved assembly flags to OPTION_LANG_ASM. (SPR #106163) +# 01d,10dec03,yvp Added ABI_SPEC. +# 01c,30sep03,sn changed :vxworks55 to :$(DIAB_T_ENVIRON) +# 01b,05dec01,jab change :tornado, :simple ,etc. to :vxworks55 +# 01a,31Oct01,h_k written from make.SH7750diab. +# +# DESCRIPTION +# This file contains SH7750 (SH4) specific definitions and flags for the +# Diab tools (compiler, assembler, linker etc.) +# + +include $(TGT_DIR)/h/tool/diab/defs.diab +CPU = SH7750 +TOOL = diable + +TGT_FLAG = -tSH4LH:$(DIAB_T_ENVIRON) + +CC_ARCH_SPEC += -Xunderscore-leading +OPTION_LANG_ASM += -Wa,-Xalign-power2 + +TOOLENV = sh +VX_CPU_FAMILY = sh +ARCH_DIR = sh +ABI_SPEC = sh4 + +# end of make.SH7750diable diff --git a/h/tool/diab/make.SIMLINUXdiab b/h/tool/diab/make.SIMLINUXdiab new file mode 100644 index 0000000..13f7319 --- /dev/null +++ b/h/tool/diab/make.SIMLINUXdiab @@ -0,0 +1,28 @@ +# make.SIMLINUXdiab - Diab compilation tools definitions for SIMLINUX +# +# modification history +# -------------------- +# 01d,31mar05,dbt moved assembly flags to OPTION_LANG_ASM. (SPR #106199). +# 01c,10dec03,yvp Added ABI_SPEC. +# 01b,30sep03,sn changed :vxworks55 to :$(DIAB_T_ENVIRON) +# 01a,26mar03,dbt written +# +# DESCRIPTION +# This file contains Linux VSim specific definitions and flags for the +# diab tools (compiler, assembler, linker etc.) +#*/ + +include $(TGT_DIR)/h/tool/diab/defs.diab +CPU = SIMLINUX +TOOL = diab + +TGT_FLAG = -tX86LH:$(DIAB_T_ENVIRON) + +TOOLENV = pentium +VX_CPU_FAMILY = simlinux +ARCH_DIR = simlinux +ABI_SPEC = x86 + +OPTION_LANG_ASM += -Wa,-Xmnem-mit + +# end of make.SIMLINUXdiab diff --git a/h/tool/diab/make.SIMNTdiab b/h/tool/diab/make.SIMNTdiab new file mode 100644 index 0000000..84fdbde --- /dev/null +++ b/h/tool/diab/make.SIMNTdiab @@ -0,0 +1,28 @@ +# make.SIMNTdiab - Diab compilation tools definitions for SIMNT +# +# modification history +# -------------------- +# 01d,31mar05,dbt moved assembly flags to OPTION_LANG_ASM. (SPR #106199). +# 01c,10dec03,yvp Added ABI_SPEC. +# 01b,30sep03,sn changed :vxworks55 to :$(DIAB_T_ENVIRON) +# 01a,26mar03,dbt written +# +# DESCRIPTION +# This file contains Windows VxSim specific definitions and flags for the +# diab tools (compiler, assembler, linker etc.) +#*/ + +include $(TGT_DIR)/h/tool/diab/defs.diab +CPU = SIMNT +TOOL = diab + +TGT_FLAG = -tX86LH:$(DIAB_T_ENVIRON) + +TOOLENV = pentium +VX_CPU_FAMILY = simpc +ARCH_DIR = simnt +ABI_SPEC = x86 + +OPTION_LANG_ASM += -Wa,-Xmnem-mit + +# end of make.SIMNTdiab diff --git a/h/tool/diab/make.SIMSPARCSOLARISdiab b/h/tool/diab/make.SIMSPARCSOLARISdiab new file mode 100644 index 0000000..cb877b0 --- /dev/null +++ b/h/tool/diab/make.SIMSPARCSOLARISdiab @@ -0,0 +1,28 @@ +# make.SIMSPARCSOLARISdiab - Diab compilation tools def. for SIMSPARCSOLARIS +# +# modification history +# -------------------- +# 01e,15dec03,dbt Updated to use new sparc binutils. +# 01d,10dec03,yvp Added ABI_SPEC. +# 01c,30sep03,sn changed :vxworks55 to :$(DIAB_T_ENVIRON); removed unnecessary PATH setting +# 01b,22jul03,dbt Updated to use DIAB 5.2 +# 01a,26mar03,dbt written +# +# DESCRIPTION +# This file contains SIMSPARCSOLARIS specific definitions and flags for the +# Diab tools (compiler, assembler, linker etc.) +#*/ + +include $(TGT_DIR)/h/tool/diab/defs.diab + +CPU = SIMSPARCSOLARIS +TOOL = diab + +TGT_FLAG = -tSPARCFH:$(DIAB_T_ENVIRON) + +TOOLENV = sparc +VX_CPU_FAMILY = simso +ARCH_DIR = simsolaris +ABI_SPEC = sparc + +# end of make.SIMSPARCSOLARISdiab diff --git a/h/tool/diab/make.XSCALEdiab b/h/tool/diab/make.XSCALEdiab new file mode 100644 index 0000000..b00caff --- /dev/null +++ b/h/tool/diab/make.XSCALEdiab @@ -0,0 +1,25 @@ +# make.XSCALEdiab - Diab compilation tools definitions for XSCALE +# +# modification history +# -------------------- +# 01f,30sep03,sn changed :vxworks55 to :$(DIAB_T_ENVIRON) +# 01e,14jan02,to move 'include defs.arm' after TOOL and CPU definitions to be +# consistent with gnu ones +# 01d,18dec01,to move common definitions to defs.arm +# 01c,05dec01,jab change :tornado, :simple ,etc. to :vxworks55 +# 01b,16nov01,t_m Change sysInit entry +# 01a,08nov01,t_m Copied from make.ARMARCH4diab +# +# DESCRIPTION +# This file contains XSCALE specific definitions and flags for the +# Diab tools (compiler, assembler, linker etc.) +# + +CPU = XSCALE +TOOL = diab + +include $(TGT_DIR)/h/tool/diab/defs.arm + +TGT_FLAG = -tARMXLS:$(DIAB_T_ENVIRON) + +# end of make.XSCALEdiab diff --git a/h/tool/diab/make.XSCALEdiabbe b/h/tool/diab/make.XSCALEdiabbe new file mode 100644 index 0000000..d741ff3 --- /dev/null +++ b/h/tool/diab/make.XSCALEdiabbe @@ -0,0 +1,22 @@ +# make.XSCALEdiabbe - Diab compilation tools definitions for XSCALE +# +# modification history +# -------------------- +# 01c,30sep03,sn changed :vxworks55 to :$(DIAB_T_ENVIRON) +# 01b,14jan02,to move 'include defs.arm' after TOOL and CPU definitions to be +# consistent with gnu ones +# 01a,10jan02,to Copied from make.XSCALEdiab +# +# DESCRIPTION +# This file contains XSCALE specific definitions and flags for the +# Diab tools (compiler, assembler, linker etc.) +# + +CPU = XSCALE +TOOL = diabbe + +include $(TGT_DIR)/h/tool/diab/defs.arm + +TGT_FLAG = -tARMXES:$(DIAB_T_ENVIRON) + +# end of make.XSCALEdiabbe diff --git a/h/tool/diab/toolMacros.h b/h/tool/diab/toolMacros.h new file mode 100644 index 0000000..46788e1 --- /dev/null +++ b/h/tool/diab/toolMacros.h @@ -0,0 +1,130 @@ +/* toolMacros.h - compile time macros for Diab C compiler */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +01l,09sep05,jln added _WRS_ABSOLUTE_EXTERN +01k,08aug05,wap Add section relocation macros +01j,17mar04,dat remove leading underscore from _absSymbols_xxx (95052) +01i,05mar04,dat temp fix for c++ and deprecated +01h,05feb04,dat add macros for _WRS_ABSOLUTE +01g,26nov03,dat Adding INLINE and DEPRECATED +01f,12oct03,dat new macros for V7 of portable C guide. +01e,23sep03,zl added _WRS_CONSTRUCTOR definition +01d,26nov01,dat New macros for alignment checking and unaligned copies +01c,14nov01,dat Adding underscores to macro names +01b,18oct01,jab fixed WRS_ASM macro +01a,04sep01,dat written (assumes Diab 4.4b or later) +*/ + +#ifndef __INCtoolMacrosh +#define __INCtoolMacrosh + +#define _WRS_PACK_ALIGN(x) __attribute__((packed, aligned(x))) + +#define _WRS_ASM(x) __asm volatile (x) + +#define _WRS_DATA_ALIGN_BYTES(x) __attribute__((aligned(x))) + +/* This tool uses the ANSI variadic macro style */ + +#undef _WRS_GNU_VAR_MACROS /* Diab uses ANSI syntax */ + +/* New macros for alignment issues */ + +#define _WRS_ALIGNOF(x) sizeof(x,1) + +#define _WRS_UNALIGNED_COPY(pSrc, pDest, size) \ + (memcpy ((pDest), (pSrc), (size))) + +#define _WRS_ALIGN_CHECK(ptr, type) \ + (((int)(ptr) & ( _WRS_ALIGNOF(type) - 1)) == 0 ? TRUE : FALSE) + +/* + * Macros to force code or data into specific sections. These + * can be used to force the compiler to place a given piece of + * code or data into a separate section. The idea is to improve + * cache usage by either clustering frequently referenced code + * close together, or moving infrequenly used code (i.e. "run-once" + * init routines that are only used during bootstrap) out of the + * way. The "init" sections are used for the latter case, while + * the "fast" sections are used to group performance-critical + * routines together. + */ + +#ifndef _WRS_NO_SPECIAL_SECTIONS +#define _WRS_INITTEXT __attribute__ ((__section__ (".text.init"))) +#define _WRS_FASTTEXT __attribute__ ((__section__ (".text.fast"))) +#define _WRS_INITDATA __attribute__ ((__section__ (".data.init"))) +#define _WRS_FASTDATA __attribute__ ((__section__ (".data.fast"))) +#else +#define _WRS_INITTEXT +#define _WRS_FASTTEXT +#define _WRS_INITDATA +#define _WRS_FASTDATA +#endif + +/* + * macro for static initializer (constructor) definitions; assumes + * Diab 5.2 or later with constructor support. + */ + +#define _WRS_CONSTRUCTOR(rtn,lvl) \ + __attribute__((constructor(lvl))) void _STI__##lvl##__##rtn (void) + +/* + * New Basix macros, (Portable Coding Guide, v7) + * + * HAS_GCC_ASM_SYNTAX if Gnu inline assembly syntax is supported. + * HAS_DCC_ASM_SYNTAX if Diab inline assembly function syntax is supported. + * INLINE for static inline C functions, (prefix) + * DEPRECATED for obsolete API warnings. (postfix) + */ + + +#undef _WRS_HAS_GCC_ASM_SYNTAX +#define _WRS_HAS_DCC_ASM_SYNTAX +#define _WRS_INLINE static __inline__ + +#ifdef __cplusplus +#define _WRS_DEPRECATED(x) /* temp workaround for c++ compiler failure */ +#else +#define _WRS_DEPRECATED(x) __attribute__((deprecated(x))) +#endif + +/* (New V7) For absolute symbol support. (use with semicolon) */ + +#define _WRS_ABSOLUTE(name,value) \ + const int name __attribute__((absolute)) = value + +#define _WRS_ABSOLUTE_EXTERN(name) \ + extern const char name[] + +/* prefix and suffix to surround absolute symbol declarations (nops for diab)*/ + +#define _WRS_ABSOLUTE_BEGIN(x) STATUS absSymbols_##x (void) {return OK;} +#define _WRS_ABSOLUTE_END + + +/* + * For backward compatibility with v5 of portable C coding guide. + * + * These are now obsolete, please don't use them. + */ + +#define WRS_PACK_ALIGN(x) _WRS_PACK_ALIGN(x) +#define WRS_ASM(x) _WRS_ASM(x) +#define WRS_DATA_ALIGN_BYTES(x) _WRS_DATA_ALIGN_BYTES(x) +#undef WRS_GNU_VAR_MACROS + +#endif /* __INCtoolMacrosh */ diff --git a/h/tool/gnu/defs.arm b/h/tool/gnu/defs.arm new file mode 100644 index 0000000..71d81cb --- /dev/null +++ b/h/tool/gnu/defs.arm @@ -0,0 +1,46 @@ +# defs.arm - ARM specific definitions for the GNU toolchain +# +# modification history +# -------------------- +# 01c,24jun02,m_h define LONGCALL to allow far away ld relocations +# 01b,21jan02,sn removed unused C++_TEMPLATE_INST +# 01a,18dec01,to written +# +# DESCRIPTION +# This file contains ARM specific definitions and flags for the +# GNU tools (compiler, assembler, linker etc.) +# +# NOTE +# The file name comes from defs.$(VX_CPU_FAMILY) +# + +include $(TGT_DIR)/h/tool/gnu/defs.gnu +include $(TGT_DIR)/h/tool/common/defs.arm + +CC_OPTIM_DRIVER = -O2 -fno-builtin -fvolatile +CC_OPTIM_NORMAL = -O2 -fno-builtin +CC_OPTIM_TARGET = -O2 -fno-builtin -fvolatile + +LONGCALL = -mlong-calls + +ifeq ($(findstring _T,$(CPU)),_T) +# definitions for Thumb mode +CC_ARCH_SPEC = -mthumb -mthumb-interwork +else +# definitions for ARM mode +CC_ARCH_SPEC = -mapcs-32 +endif + +ifeq ($(findstring be,$(TOOL)),be) +# definitions for big endian +CC_ARCH_SPEC += -mbig-endian +LDFLAGS = -X -EB -N +LD_PARTIAL_FLAGS= -X -EB -r +else +# definitions for little endian +CC_ARCH_SPEC += -mlittle-endian +LDFLAGS = -X -EL -N +LD_PARTIAL_FLAGS= -X -EL -r +endif + +# end of defs.arm diff --git a/h/tool/gnu/defs.gnu b/h/tool/gnu/defs.gnu new file mode 100644 index 0000000..101e879 --- /dev/null +++ b/h/tool/gnu/defs.gnu @@ -0,0 +1,269 @@ +# defs.gnu - definitions for GNU toolchain builds +# +# Copyright 2000-2005 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 03m,22aug05,pee Added OPTION_DEPEND_TARGET +# 02y,18jul05,pee Added CC_LIBINTRINSICS +# 02x,08Jul05,pee Added OPTION_CC_GENMAP +# 02w,29apr05,md Added OPTION_DEPEND_GEN_D +# 02v,16feb05,pee Added OPTION_POINTERS_VOLATILE +# 02u,15nov04,gvm Fix for SPR103853: no -P when pre-processing assembly files. +# 02t,16sep04,mcm Adding -fno-zero-initialized-in-bss +# 02s,12jul04,fle Improved support for data alignment +# 02r,15jun04,fle SPR#98164 : substitute backslashes with slashes in CC_BASE +# 02q,29apr04,c_c Get compiler version from the resource file. +# 02p,04may04,mcm Updating compiler version to 3.3.2-vxworks60 +# 02o,26apr04,f_b Removed absolute path to objcopy to prepare for new +# directory structure and align with how nm & size are found +# 02n,03feb04,mcm Fix for SPR 93149 +# 02m,09feb04,fle Updated to new host utilities location +# 02l,22jan04,zmm Moved definitions of ROM_ENTRY, SYS_ENTRY and USR_ENTRY +# into defs.common +# 02k,09jan04,c_c Don't hardcode compiler path in macro (SPR #92774). +# 02j,10dec03,dbt Updated for GCC 3.3.2 compiler +# 02i,07nov03,c_c Check compiler version. +# 02h,15oct03,dat New warning macros +# 02g,19aug03,fle SPR#88802, set TCL to tclsh and added WTXTCL macro +# 02f,06may02,sn SPR 76627 - Use CC to link by default +# 02e,03may02,tpw LD_SCRIPT_DOWNLOAD cannot be derived from LD_SCRIPT_RAM. +# It meshes poorly with scripts not named link.RAM (PPC4xx). +# 02d,01may02,sn Restore TOOL_VENDOR (some people use it) +# 02c,24apr02,sn SPR 75835 - collapse sections into text/data/bss before +# download +# 02b,24apr02,sn SPR 75123 - always munch -c (avoiding idiosyncratic asm +# behaviour) +# 02a,25apr02,pai introduced HLL_PREFIX so that prepended underscores could +# be redefined in architecture/toolchain fragments (SPR 73382) +# 01z,21mar02,rbl adding macro so that project facility can add -fvolatile to +# bsp files +# 01y,19mar02,dat Adding PIC flags for bootInit.o (72825) +# 01x,13mar02,sn SPR 74080 - added large project support for Diab +# 01w,12feb02,sn removed obsolete refs to GCC_EXEC_PREFIX +# 01v,06feb02,t_m change ranlib to ranlib$(TOOLENV) +# 01u,21jan02,sn removed obsolete WFC flags +# 01t,13dec01,jab added make variable BOOTCONFIG_FLAGS +# 01s,05dec01,tpw Use TGT_DIR to find linker scripts. +# 01r,13nov01,tam changed definition of CC_LIB (repackaging) +# 01q,05nov01,rbl let project facility know about optimization flags +# 01p,09nov01,tam fixed use of OPTION_PASS_TO_LD; renamed TOOL_CONFIG +# 01o,02nov01,dat adding -w to dependency generation options +# 01n,30oct01,tpw Take generic defaults from new fragment defs.common +# 01m,29oct01,jab added new ld script variables +# 01l,26oct01,tam fixed Wl usage after merge +# 01k,19oct01,j_s define cyclic link support macros +# add TOOL_CONFIG +# 01j,24oct01,dat Relocating tool specific macros +# 01i,24oct01,jab added new dependency generation variables +# 01h,23oct01,jab added variables from defs.default cleanup +# 01g,19oct01,jab added make variables for dependency generation option +# 01f,18oct01,dat Moving tool specific defines out of target/h/make +# 01e,12sep01,sn added LARGE_PROJECT, MUNCH_FLAGS and LD_PARTIAL +# 01d,05jun01,mem Added EXTRACT_HEX_FLAG, EXTRACT_BIN_FLAG, VMA_START & +# VMA_FLAGS +# 01c,13mar01,sn added defn of OPTION_LANG_ASM +# 01b,10jan01,sn added defn of OPTION_LANG_C +# 01a,16oct00,sn wrote +# +# DESCRIPTION +# This file contains default definitions and flags for builds that use the +# GNU toolchain. + +## generic defaults from defs.common come first, so they can be overridden + +include $(TGT_DIR)/h/tool/common/defs.common + +# get TOOL_COMMON_DIR, TOOL_DIAB and TOOL_GNU from TOOL + +TOOL_FAMILY = gnu +TOOL_COMMON_DIR = $(subst gnu,common,$(TOOL)) +TOOL_DIAB = $(subst gnu,diab,$(TOOL)) +TOOL_GNU = $(TOOL) + +# Deprecated, use TOOL_FAMILY instead +TOOL_VENDOR = gnu + +# Preprocessor option forcing every input file to be treated as a "C" file +OPTION_LANG_C=-xc + +## set path to gnu utilities + +CC_HOST = $(WIND_HOST_TYPE) + +# Set path to gnu utilities: +# if WIND_GNU_PATH is set, then use it as the compiler base directory. +# else, if WIND_GNU_VERSION is set, use it. +# else, get the version from tools.version file. + +ifneq ($(WIND_GNU_PATH),) +CC_BASE = $(subst \,/,$(WIND_GNU_PATH)) +else +# set default version to WIND_GNU_VERSION set in +# $(WIND_BASE)/host/resource/hutils/tools.version, but allow environment, +# ARCH or CPU specific make fragment to override the value. + +ifeq ($(WIND_GNU_VERSION),) +include $(WIND_BASE)/host/resource/hutils/tools.version +endif +CC_VERSION = $(WIND_GNU_VERSION) +endif + +ifeq ($(WIND_HOST_TYPE),x86-win32) +ifneq ($(Path),) +export Path := $(CC_BIN_DIR);$(Path) +endif +ifneq ($(PATH),) +export PATH := $(CC_BIN_DIR);$(PATH) +endif +else +ifneq ($(PATH),) +export PATH := $(CC_BIN_DIR):$(PATH) +endif +endif + +# Preprocessor option forcing every input file to be treated as a assembly +# file requiring C preprocessing +OPTION_LANG_ASM=-xassembler-with-cpp + +# Library containing compiler support routines +CC_LIB= +CC_LIBINTRINSICS = -lgcc + + +OPTION_PP = -E +OPTION_PP_AS = +OPTION_PP_NOLINENO = -P +OPTION_PP_COMMENT = -C +OPTION_DOLLAR_SYMBOLS = -fdollars-in-identifiers +OPTION_DEPEND = -M -w +OPTION_DEPEND_GEN = -M -MG -w +OPTION_DEPEND_GEN_D = -MD +OPTION_DEPEND_C = $(OPTION_DEPEND_GEN) +OPTION_DEPEND_AS = $(OPTION_DEPEND) +OPTION_DEPEND_TARGET = -MT +OPTION_NO_WARNINGS = -w +OPTION_ANSI = -ansi +OPTION_OBJECT_ONLY = -c +OPTION_INCLUDE_DIR = -I +OPTION_CC_GENMAP = -Wl,-Map,$@.map,-cref + +# this line has a space at the end ("-o ") +OPTION_OBJECT_NAME = -o +OPTION_EXE_NAME = $(OPTION_OBJECT_NAME) +OPTION_DEFINE_MACRO = -D +OPTION_PIC = -fpic +OPTION_POINTERS_VOLATILE = -fvolatile + +CC_OPTIM_DRIVER = -fvolatile +CC_OPTIM_NORMAL = -O -fstrength-reduce -fcombine-regs +CC_OPTIM_TARGET = -O -fvolatile + +# Old warning macros +CC_WARNINGS_ALL = -Wall +CC_WARNINGS_NONE = + +# New warning macros. The new default is CC_WARNINGS_LOW, but for GNU +# we are leaving the setting the same as before (-Wall). As we switch +# to Diab, we are also requiring that the base library build be error +# AND warning free. The higher settings are for code inspection and lint +# purposes. + +CC_WARNINGS_HIGH = $(CC_WARNINGS_ALL) +CC_WARNINGS_MED = $(CC_WARNINGS_ALL) +CC_WARNINGS_LOW = $(CC_WARNINGS_ALL) + +CC_COMPILER = -ansi +C++_COMPILER = -ansi + +# used by project facility + +CC_PROJECT_OPTIMIZE_FLAGS = -O -O1 -O2 -O3 -O4 +PROJECT_BSP_FLAGS_EXTRA = $(filter -fvolatile,$(CC_OPTIM_TARGET)) + +# For generating PIC code +# For T2.2, CC_PIC is only defined for MIPS architecture see defs.mips. +# CC_PIC = $(OPTION_PIC) + +## C flags + +CFLAGS += -fno-zero-initialized-in-bss + +## toolchain binaries + +AS = as$(TOOLENV) +CC = cc$(TOOLENV) +CF = CC +CXX = $(CC) +LD = ld$(TOOLENV) +RANLIB = ranlib$(TOOLENV) +CPP = $(CC) -E -P +CPP_PRINT_MACROS = $(CPP) -dM -E -pipe $(CC_INCLUDE) $(CC_DEFINES) +TCL = tclsh +WTXTCL = wtxtcl +OBJCPY = objcopy$(TOOLENV) +SIZE = size$(TOOLENV) +NM = nm$(TOOLENV) +AR = ar$(TOOLENV) + +MUNCH_SCRIPT = $(WIND_BASE)/host/resource/hutils/tcl/munch.tcl +MUNCH = $(TCL) $(MUNCH_SCRIPT) $(MUNCH_FLAGS) + +LARGE_PROJECT = true +OPTION_INDIRECT_FILE = @ +OPTION_NM_INDIRECT_FILE = @ + +MUNCH_FLAGS = -c $(TOOLENV) +NM_GLOB_FLAGS = -g + + +BOOTCONFIG_FLAGS = + + +LDFLAGS = -X -N + +LD_ENTRY_OPT = -e +LD_PARTIAL_FLAGS = -X -r + +# Wherever possible we use the compiler driver as a frontend to +# the linker. In particular this facilitates the GNU -frepo +# template repository system. Configurations using GNU Tools +# but non-GNU linkers (such as SIMHPPA) should define +# GNU_USE_LD_TO_LINK = yes + +ifeq ($(GNU_USE_LD_TO_LINK),) +BASE_LD_PARTIAL_FLAGS = $(filter-out -r -nostdlib,$(LD_PARTIAL_FLAGS)) +LD_PARTIAL = $(CC) -r -nostdlib $(patsubst %,$(OPTION_PASS_TO_LD)%,$(BASE_LD_PARTIAL_FLAGS)) +OPTION_PASS_TO_LD = -Wl, +else +LD_PARTIAL = $(LD) $(LD_PARTIAL_FLAGS) +OPTION_PASS_TO_LD = +endif + +# These are flags to pass to the linker the last time we do a +# relocatable link. They never get used by a bootable project +# and they only get used once by a downloadable project. + +LD_SCRIPT_DOWNLOAD = -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.OUT +LD_COLLAPSE_SECTIONS = $(LD_SCRIPT_DOWNLOAD) +LD_PARTIAL_LAST_FLAGS = $(LD_COLLAPSE_SECTIONS) + +LD_SCRIPT_RAM = -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.RAM +LD_SCRIPT_ROM = -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.ROM + +# for cyclic link support + +LD_START_GROUP = --start-group +LD_END_GROUP = --end-group +LD_PARTIAL_START_GROUP = $(OPTION_PASS_TO_LD)$(LD_START_GROUP) +LD_PARTIAL_END_GROUP = $(OPTION_PASS_TO_LD)$(LD_END_GROUP) + +LD_DATA_SEG_ALIGN_FLAG = -defsym _VX_DATA_ALIGN + +LD_LOW_FLAGS = -Ttext $(RAM_LOW_ADRS) +LD_HIGH_FLAGS = -Ttext $(RAM_HIGH_ADRS) +RES_LOW_FLAGS = -Ttext $(ROM_LINK_ADRS) -Tdata $(RAM_LOW_ADRS) +RES_HIGH_FLAGS = -Ttext $(ROM_LINK_ADRS) -Tdata $(RAM_HIGH_ADRS) + +# For 960 IMI +LD_IMI_ADRS = -Ttext $(IMI_TEXT_ADRS) -Tdata $(IMI_DATA_ADRS) diff --git a/h/tool/gnu/defs.mips b/h/tool/gnu/defs.mips new file mode 100644 index 0000000..29c64ae --- /dev/null +++ b/h/tool/gnu/defs.mips @@ -0,0 +1,83 @@ +# defs.mips - MIPS specific definitions for the GNU toolchain +# +# modification history +# -------------------- +# 01h,04mar05,pes Remove options for r3k +# 01g,05may04,pes Fixing compile flag used for gnu for MIPS64. +# 01f,07nov03,c_c Removed GNULIBROOT define. +# 01e,26mar02,pes Revert to MIPS ISA III. Clean up -mno-branch-likely +# selection. +# 01d,19mar02,dat Adding PIC flags for bootInit.o (72825) +# 01c,12feb02,sn removed obsolete refs to GCC_EXEC_PREFIX +# removed -fno-for-scope +# 01b,21jan02,sn removed unused C++_TEMPLATE_INST +# 01a,09jan02,pes written +# +# DESCRIPTION +# This file contains MIPS specific definitions and flags for the +# GNU tools (compiler, assembler, linker etc.) +# +# NOTE +# The file name comes from defs.$(VX_CPU_FAMILY) +# + +include $(TGT_DIR)/h/tool/gnu/defs.gnu +include $(TGT_DIR)/h/tool/common/defs.mips + +CC_OPTIM_DRIVER = -O -fvolatile +CC_OPTIM_NORMAL = -O2 +CC_OPTIM_TARGET = -O2 + +# Compiler flags for PIC code +# For T2.2, used only for MIPS gnu compiler. +CC_PIC = $(OPTION_PIC) + +CC_COMPILER = -ansi -fno-builtin +C++_COMPILER += -fno-builtin + +LONGCALL = -mlong-calls + +# override/modify standard command definitions +AS += -G 0 +RANLIB = ranlibmips + +# Build up architecture specification +# Set initial value +CC_ARCH_SPEC = -G 0 -mno-branch-likely + +# +# Modify CC_ARCH_SPEC for processor ISA level and endianness +# +# select processor ISA +# 32-bit is ISA II +# 64-bit is ISA III +# +ifeq ($(findstring MIPS32,$(CPU)),MIPS32) +CC_ARCH_SPEC += -mips2 +AS += -mips2 +else +CC_ARCH_SPEC += -mips3 -mabi=o64 -mgp64 +AS += -mips3 -mabi=o64 -mgp64 +endif + +# select endianness +ifeq ($(findstring le,$(TOOL)),le) +CC_ARCH_SPEC += -EL +AS += -EL +LDFLAGS = -EL -X -N +LD_PARTIAL_FLAGS= -EL -X -r +LD_ENDIAN_FLAG = -Wl,-EL +else +CC_ARCH_SPEC += -EB +AS += -EB +LDFLAGS = -EB -X -N +LD_PARTIAL_FLAGS= -EB -X -r +endif + +# check for software floating point request +ifeq ($(findstring sf,$(TOOL)),sf) +CC_SOFT_FLOAT = -msoft-float +endif + + +# end of defs.mips diff --git a/h/tool/gnu/intrinsics.h b/h/tool/gnu/intrinsics.h new file mode 100644 index 0000000..5ee2379 --- /dev/null +++ b/h/tool/gnu/intrinsics.h @@ -0,0 +1,22 @@ +/* intrinsics.h - map INCLUDE_INTRINSICS to toolchain specific intrinsics */ + +/* Copyright 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,06feb02,sn wrote +*/ + +/* +DESCRIPTION +Map INCLUDE_INTRINSICS to INCLUDE_GNU_INTRINSICS. Included when TOOL_FAMILY=gnu. + +NOMANUAL +*/ + +#ifdef INCLUDE_INTRINSICS +#ifndef INCLUDE_GNU_INTRINSICS +#define INCLUDE_GNU_INTRINSICS +#endif +#endif diff --git a/h/tool/gnu/ldscripts/Makefile b/h/tool/gnu/ldscripts/Makefile new file mode 100644 index 0000000..c9cb2de --- /dev/null +++ b/h/tool/gnu/ldscripts/Makefile @@ -0,0 +1,22 @@ +# Makefile - makefile for regenerating GNU linker scripts from common template +# +# modification history +# -------------------- +# 01a,05dec01,tpw written +# +# DESCRIPTION +# This file contains the makefile rules to regenerate cross-target linker +# scripts using the template system in tool/common/ldscripts. +# +#*/ + +TGT_DIR=$(WIND_BASE)/target +GEN_DIR=$(TGT_DIR)/h/tool/common/ldscripts +REGEN_SH=$(GEN_DIR)/regen.sh +TOOL=gnu + +regen all: + sh $(REGEN_SH) $(TOOL) + +update: + sh $(REGEN_SH) -update $(TOOL) diff --git a/h/tool/gnu/ldscripts/link.AOUTRAM b/h/tool/gnu/ldscripts/link.AOUTRAM new file mode 100644 index 0000000..08c80b3 --- /dev/null +++ b/h/tool/gnu/ldscripts/link.AOUTRAM @@ -0,0 +1,104 @@ +/* link.AOUTRAM - gnu linker command file for VxWorks: AOUT RAM */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* This file was automatically generated using tool/common/ldscripts. */ + +/* +modification history +-------------------- +01r,25aug05,dlk Support .text.init, .text.fast, .data.init, .data.fast. +01r,29jul05,slk SPR 104264: fix MIPS romResident images +01q,06may05,rlg changes for MIPS specific devices +01p,03jul04,f_b Improved support for data alignment +01o,12dec03,sn added more .rodata.str1.* handlers +01n,04dec03,sn Diab: .rodata.* is not handled correctly by Diab linker; instead + use specific names +01m,28oct03,sn Diab: collapse .rodata.cst* sections into .rodata +01l,29may02,tpw Diab: pad out sections, needed for MIPS byteswap. SPR 78076 +01k,24apr02,sn GNU: SPR 75835 - added support for relocatable script link.OUT +01j,19apr02,tpw Diab: provide _etext for ColdFire. SPR 75122 +01i,06feb02,sn Both: place .got2 to handle tramp.o (_x_gnu_tramp.o). +01h,25jan02,tpw GNU: give debug sections explicit 0 addresses. +01g,14jan02,tpw Diab: place .eh_frame data, in case of insistent GNU objects. +01f,14dec01,tpw Diab: provide both underscore options of wrs_kernel* here too. +01e,05dec01,tpw Both: Add .boot and .reset section support, for PPC 4xx series + and Book E. +01d,05dec01,tpw Diab: Add .frame_info section to text region. +01c,03dec01,jab Diab: replaced LOAD() with AT() +01b,14nov01,tpw ALL: Correct some more bootrom/kernel issues. +01b,06nov01,tpw GNU: Add /DISCARD/ directive to discard uninteresting sections +01a,01nov01,tpw gnu script written +01a,29oct01,jab diab script written +*/ + +ENTRY(_start) +SECTIONS +{ + .text : + { + wrs_kernel_text_start = .; _wrs_kernel_text_start = .; + _VX_START_TEXT = .; + *(.text) + wrs_kernel_text_fast = .; _wrs_kernel_text_fast = .; + *(.text.fast) + wrs_kernel_text_init = .; _wrs_kernel_text_init = .; + *(.text.init) + *(.text.*) *(.stub) *(.gnu.warning) *(.gnu.linkonce.t*) + KEEP(*(.init)) KEEP(*(.fini)) + *(.glue_7t) *(.glue_7) *(.rdata) /* for ARM */ + *(.mips16.fn.*) *(.mips16.call.*) *(.reginfo) /* for MIPS */ + *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) *(.rodata1) + *(.sdata2) *(.sbss2) /* for PPC */ + . = ALIGN(16); + } + . = ALIGN(16); + wrs_kernel_text_end = .; _wrs_kernel_text_end = .; + etext = .; _etext = .; + . = ALIGN(_VX_DATA_ALIGN); + .data : + { + wrs_kernel_data_start = .; _wrs_kernel_data_start = .; + _VX_START_DATA = .; + *(.data) + wrs_kernel_data_fast = .; _wrs_kernel_data_fast = .; + *(.data.fast) + wrs_kernel_data_init = .; _wrs_kernel_data_init = .; + *(.data.init) + *(.data.*) *(.gnu.linkonce.d*) SORT(CONSTRUCTORS) *(.data1) + *(.eh_frame) *(.gcc_except_table) + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + _gp = ALIGN(16) + 0x7ff0; /* set gp for MIPS startup code */ + /* got*, dynamic, sdata*, lit[48], and sbss should follow _gp */ + *(.got.plt) *(.got) *(.dynamic) + *(.got2) + *(.sdata) *(.sdata.*) *(.lit8) *(.lit4) + . = ALIGN(16); + } + . = ALIGN(16); + edata = .; _edata = .; + wrs_kernel_data_end = .; _wrs_kernel_data_end = .; + .bss : + { + wrs_kernel_bss_start = .; _wrs_kernel_bss_start = .; + *(.sbss) *(.scommon) *(.dynbss) *(.bss) *(COMMON) + . = ALIGN(16); + } + . = ALIGN(16); + end = .; _end = .; + wrs_kernel_bss_end = .; _wrs_kernel_bss_end = .; + + /DISCARD/ : + { + *(.note) /* seen on Pentium ELF */ + *(.comment) /* seen on PPC & SH ELF */ + *(.pdr) /* seen on MIPS ELF */ + } +} diff --git a/h/tool/gnu/ldscripts/link.AOUTROM b/h/tool/gnu/ldscripts/link.AOUTROM new file mode 100644 index 0000000..4cc03ea --- /dev/null +++ b/h/tool/gnu/ldscripts/link.AOUTROM @@ -0,0 +1,104 @@ +/* link.AOUTROM - gnu linker command file for VxWorks: AOUT ROM */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* This file was automatically generated using tool/common/ldscripts. */ + +/* +modification history +-------------------- +01r,25aug05,dlk Support .text.init, .text.fast, .data.init, .data.fast. +01r,29jul05,slk SPR 104264: fix MIPS romResident images +01q,06may05,rlg changes for MIPS specific devices +01p,03jul04,f_b Improved support for data alignment +01o,12dec03,sn added more .rodata.str1.* handlers +01n,04dec03,sn Diab: .rodata.* is not handled correctly by Diab linker; instead + use specific names +01m,28oct03,sn Diab: collapse .rodata.cst* sections into .rodata +01l,29may02,tpw Diab: pad out sections, needed for MIPS byteswap. SPR 78076 +01k,24apr02,sn GNU: SPR 75835 - added support for relocatable script link.OUT +01j,19apr02,tpw Diab: provide _etext for ColdFire. SPR 75122 +01i,06feb02,sn Both: place .got2 to handle tramp.o (_x_gnu_tramp.o). +01h,25jan02,tpw GNU: give debug sections explicit 0 addresses. +01g,14jan02,tpw Diab: place .eh_frame data, in case of insistent GNU objects. +01f,14dec01,tpw Diab: provide both underscore options of wrs_kernel* here too. +01e,05dec01,tpw Both: Add .boot and .reset section support, for PPC 4xx series + and Book E. +01d,05dec01,tpw Diab: Add .frame_info section to text region. +01c,03dec01,jab Diab: replaced LOAD() with AT() +01b,14nov01,tpw ALL: Correct some more bootrom/kernel issues. +01b,06nov01,tpw GNU: Add /DISCARD/ directive to discard uninteresting sections +01a,01nov01,tpw gnu script written +01a,29oct01,jab diab script written +*/ + +ENTRY(_start) +SECTIONS +{ + .text : + { + wrs_kernel_text_start = .; _wrs_kernel_text_start = .; + _VX_START_TEXT = .; + *(.text) + wrs_kernel_text_fast = .; _wrs_kernel_text_fast = .; + *(.text.fast) + wrs_kernel_text_init = .; _wrs_kernel_text_init = .; + *(.text.init) + *(.text.*) *(.stub) *(.gnu.warning) *(.gnu.linkonce.t*) + KEEP(*(.init)) KEEP(*(.fini)) + *(.glue_7t) *(.glue_7) *(.rdata) /* for ARM */ + *(.mips16.fn.*) *(.mips16.call.*) *(.reginfo) /* for MIPS */ + *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) *(.rodata1) + *(.sdata2) *(.sbss2) /* for PPC */ + . = ALIGN(16); + } + . = ALIGN(16); + wrs_kernel_text_end = .; _wrs_kernel_text_end = .; + etext = .; _etext = .; + + .data : AT(etext) + { + wrs_kernel_data_start = .; _wrs_kernel_data_start = .; + _VX_START_DATA = .; + *(.data) + wrs_kernel_data_fast = .; _wrs_kernel_data_fast = .; + *(.data.fast) + wrs_kernel_data_init = .; _wrs_kernel_data_init = .; + *(.data.init) + *(.data.*) *(.gnu.linkonce.d*) SORT(CONSTRUCTORS) *(.data1) + *(.eh_frame) *(.gcc_except_table) + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + _gp = ALIGN(16) + 0x7ff0; /* set gp for MIPS startup code */ + /* got*, dynamic, sdata*, lit[48], and sbss should follow _gp */ + *(.got.plt) *(.got) *(.dynamic) + *(.got2) + *(.sdata) *(.sdata.*) *(.lit8) *(.lit4) + . = ALIGN(16); + } + . = ALIGN(16); + edata = .; _edata = .; + wrs_kernel_data_end = .; _wrs_kernel_data_end = .; + .bss : + { + wrs_kernel_bss_start = .; _wrs_kernel_bss_start = .; + *(.sbss) *(.scommon) *(.dynbss) *(.bss) *(COMMON) + . = ALIGN(16); + } + . = ALIGN(16); + end = .; _end = .; + wrs_kernel_bss_end = .; _wrs_kernel_bss_end = .; + + /DISCARD/ : + { + *(.note) /* seen on Pentium ELF */ + *(.comment) /* seen on PPC & SH ELF */ + *(.pdr) /* seen on MIPS ELF */ + } +} diff --git a/h/tool/gnu/ldscripts/link.DOTBOOTRAM b/h/tool/gnu/ldscripts/link.DOTBOOTRAM new file mode 100644 index 0000000..b81d79b --- /dev/null +++ b/h/tool/gnu/ldscripts/link.DOTBOOTRAM @@ -0,0 +1,146 @@ +/* link.DOTBOOTRAM - gnu linker command file for VxWorks: DOTBOOT RAM */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* This file was automatically generated using tool/common/ldscripts. */ + +/* +modification history +-------------------- +01r,25aug05,dlk Support .text.init, .text.fast, .data.init, .data.fast. +01r,29jul05,slk SPR 104264: fix MIPS romResident images +01q,06may05,rlg changes for MIPS specific devices +01p,03jul04,f_b Improved support for data alignment +01o,12dec03,sn added more .rodata.str1.* handlers +01n,04dec03,sn Diab: .rodata.* is not handled correctly by Diab linker; instead + use specific names +01m,28oct03,sn Diab: collapse .rodata.cst* sections into .rodata +01l,29may02,tpw Diab: pad out sections, needed for MIPS byteswap. SPR 78076 +01k,24apr02,sn GNU: SPR 75835 - added support for relocatable script link.OUT +01j,19apr02,tpw Diab: provide _etext for ColdFire. SPR 75122 +01i,06feb02,sn Both: place .got2 to handle tramp.o (_x_gnu_tramp.o). +01h,25jan02,tpw GNU: give debug sections explicit 0 addresses. +01g,14jan02,tpw Diab: place .eh_frame data, in case of insistent GNU objects. +01f,14dec01,tpw Diab: provide both underscore options of wrs_kernel* here too. +01e,05dec01,tpw Both: Add .boot and .reset section support, for PPC 4xx series + and Book E. +01d,05dec01,tpw Diab: Add .frame_info section to text region. +01c,03dec01,jab Diab: replaced LOAD() with AT() +01b,14nov01,tpw ALL: Correct some more bootrom/kernel issues. +01b,06nov01,tpw GNU: Add /DISCARD/ directive to discard uninteresting sections +01a,01nov01,tpw gnu script written +01a,29oct01,jab diab script written +*/ + +ENTRY(_start) +SECTIONS +{ + .text : + { + wrs_kernel_text_start = .; _wrs_kernel_text_start = .; + _VX_START_TEXT = .; + *(.text) + wrs_kernel_text_fast = .; _wrs_kernel_text_fast = .; + *(.text.fast) + wrs_kernel_text_init = .; _wrs_kernel_text_init = .; + *(.text.init) + *(.text.*) *(.stub) *(.gnu.warning) *(.gnu.linkonce.t*) + KEEP(*(.init)) KEEP(*(.fini)) + *(.glue_7t) *(.glue_7) *(.rdata) /* for ARM */ + *(.mips16.fn.*) *(.mips16.call.*) *(.reginfo) /* for MIPS */ + *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) *(.rodata1) + *(.sdata2) *(.sbss2) /* for PPC */ + . = ALIGN(16); + } + . = ALIGN(16); + wrs_kernel_text_end = .; _wrs_kernel_text_end = .; + etext = .; _etext = .; + . = ALIGN(_VX_DATA_ALIGN); + .data : + { + wrs_kernel_data_start = .; _wrs_kernel_data_start = .; + _VX_START_DATA = .; + *(.data) + wrs_kernel_data_fast = .; _wrs_kernel_data_fast = .; + *(.data.fast) + wrs_kernel_data_init = .; _wrs_kernel_data_init = .; + *(.data.init) + *(.data.*) *(.gnu.linkonce.d*) SORT(CONSTRUCTORS) *(.data1) + *(.eh_frame) *(.gcc_except_table) + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + _gp = ALIGN(16) + 0x7ff0; /* set gp for MIPS startup code */ + /* got*, dynamic, sdata*, lit[48], and sbss should follow _gp */ + *(.got.plt) *(.got) *(.dynamic) + *(.got2) + *(.sdata) *(.sdata.*) *(.lit8) *(.lit4) + . = ALIGN(16); + } + . = ALIGN(16); + edata = .; _edata = .; + wrs_kernel_data_end = .; _wrs_kernel_data_end = .; + .bss : + { + wrs_kernel_bss_start = .; _wrs_kernel_bss_start = .; + *(.sbss) *(.scommon) *(.dynbss) *(.bss) *(COMMON) + . = ALIGN(16); + } + . = ALIGN(16); + end = .; _end = .; + wrs_kernel_bss_end = .; _wrs_kernel_bss_end = .; + + .boot (wrs_kernel_text_start + wrs_kernel_rom_size - 0x800) : + { + *(.boot) + } + .reset (wrs_kernel_text_start + wrs_kernel_rom_size - 4) : + { + *(.reset) + } + + /DISCARD/ : + { + *(.note) /* seen on Pentium ELF */ + *(.comment) /* seen on PPC & SH ELF */ + *(.pdr) /* seen on MIPS ELF */ + } + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} diff --git a/h/tool/gnu/ldscripts/link.DOTBOOTROM b/h/tool/gnu/ldscripts/link.DOTBOOTROM new file mode 100644 index 0000000..9ba32e3 --- /dev/null +++ b/h/tool/gnu/ldscripts/link.DOTBOOTROM @@ -0,0 +1,146 @@ +/* link.DOTBOOTROM - gnu linker command file for VxWorks: DOTBOOT ROM */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* This file was automatically generated using tool/common/ldscripts. */ + +/* +modification history +-------------------- +01r,25aug05,dlk Support .text.init, .text.fast, .data.init, .data.fast. +01r,29jul05,slk SPR 104264: fix MIPS romResident images +01q,06may05,rlg changes for MIPS specific devices +01p,03jul04,f_b Improved support for data alignment +01o,12dec03,sn added more .rodata.str1.* handlers +01n,04dec03,sn Diab: .rodata.* is not handled correctly by Diab linker; instead + use specific names +01m,28oct03,sn Diab: collapse .rodata.cst* sections into .rodata +01l,29may02,tpw Diab: pad out sections, needed for MIPS byteswap. SPR 78076 +01k,24apr02,sn GNU: SPR 75835 - added support for relocatable script link.OUT +01j,19apr02,tpw Diab: provide _etext for ColdFire. SPR 75122 +01i,06feb02,sn Both: place .got2 to handle tramp.o (_x_gnu_tramp.o). +01h,25jan02,tpw GNU: give debug sections explicit 0 addresses. +01g,14jan02,tpw Diab: place .eh_frame data, in case of insistent GNU objects. +01f,14dec01,tpw Diab: provide both underscore options of wrs_kernel* here too. +01e,05dec01,tpw Both: Add .boot and .reset section support, for PPC 4xx series + and Book E. +01d,05dec01,tpw Diab: Add .frame_info section to text region. +01c,03dec01,jab Diab: replaced LOAD() with AT() +01b,14nov01,tpw ALL: Correct some more bootrom/kernel issues. +01b,06nov01,tpw GNU: Add /DISCARD/ directive to discard uninteresting sections +01a,01nov01,tpw gnu script written +01a,29oct01,jab diab script written +*/ + +ENTRY(_start) +SECTIONS +{ + .text : + { + wrs_kernel_text_start = .; _wrs_kernel_text_start = .; + _VX_START_TEXT = .; + *(.text) + wrs_kernel_text_fast = .; _wrs_kernel_text_fast = .; + *(.text.fast) + wrs_kernel_text_init = .; _wrs_kernel_text_init = .; + *(.text.init) + *(.text.*) *(.stub) *(.gnu.warning) *(.gnu.linkonce.t*) + KEEP(*(.init)) KEEP(*(.fini)) + *(.glue_7t) *(.glue_7) *(.rdata) /* for ARM */ + *(.mips16.fn.*) *(.mips16.call.*) *(.reginfo) /* for MIPS */ + *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) *(.rodata1) + *(.sdata2) *(.sbss2) /* for PPC */ + . = ALIGN(16); + } + . = ALIGN(16); + wrs_kernel_text_end = .; _wrs_kernel_text_end = .; + etext = .; _etext = .; + + .data : AT(etext) + { + wrs_kernel_data_start = .; _wrs_kernel_data_start = .; + _VX_START_DATA = .; + *(.data) + wrs_kernel_data_fast = .; _wrs_kernel_data_fast = .; + *(.data.fast) + wrs_kernel_data_init = .; _wrs_kernel_data_init = .; + *(.data.init) + *(.data.*) *(.gnu.linkonce.d*) SORT(CONSTRUCTORS) *(.data1) + *(.eh_frame) *(.gcc_except_table) + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + _gp = ALIGN(16) + 0x7ff0; /* set gp for MIPS startup code */ + /* got*, dynamic, sdata*, lit[48], and sbss should follow _gp */ + *(.got.plt) *(.got) *(.dynamic) + *(.got2) + *(.sdata) *(.sdata.*) *(.lit8) *(.lit4) + . = ALIGN(16); + } + . = ALIGN(16); + edata = .; _edata = .; + wrs_kernel_data_end = .; _wrs_kernel_data_end = .; + .bss : + { + wrs_kernel_bss_start = .; _wrs_kernel_bss_start = .; + *(.sbss) *(.scommon) *(.dynbss) *(.bss) *(COMMON) + . = ALIGN(16); + } + . = ALIGN(16); + end = .; _end = .; + wrs_kernel_bss_end = .; _wrs_kernel_bss_end = .; + + .boot (wrs_kernel_text_start + wrs_kernel_rom_size - 0x800) : + { + *(.boot) + } + .reset (wrs_kernel_text_start + wrs_kernel_rom_size - 4) : + { + *(.reset) + } + + /DISCARD/ : + { + *(.note) /* seen on Pentium ELF */ + *(.comment) /* seen on PPC & SH ELF */ + *(.pdr) /* seen on MIPS ELF */ + } + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} diff --git a/h/tool/gnu/ldscripts/link.MIPSRAM b/h/tool/gnu/ldscripts/link.MIPSRAM new file mode 100644 index 0000000..a805cd7 --- /dev/null +++ b/h/tool/gnu/ldscripts/link.MIPSRAM @@ -0,0 +1,142 @@ +/* link.MIPSRAM - gnu linker command file for VxWorks: MIPS RAM */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* This file was automatically generated using tool/common/ldscripts. */ + +/* +modification history +-------------------- +01r,25aug05,dlk Support .text.init, .text.fast, .data.init, .data.fast. +01r,29jul05,slk SPR 104264: fix MIPS romResident images +01q,06may05,rlg changes for MIPS specific devices +01p,03jul04,f_b Improved support for data alignment +01o,12dec03,sn added more .rodata.str1.* handlers +01n,04dec03,sn Diab: .rodata.* is not handled correctly by Diab linker; instead + use specific names +01m,28oct03,sn Diab: collapse .rodata.cst* sections into .rodata +01l,29may02,tpw Diab: pad out sections, needed for MIPS byteswap. SPR 78076 +01k,24apr02,sn GNU: SPR 75835 - added support for relocatable script link.OUT +01j,19apr02,tpw Diab: provide _etext for ColdFire. SPR 75122 +01i,06feb02,sn Both: place .got2 to handle tramp.o (_x_gnu_tramp.o). +01h,25jan02,tpw GNU: give debug sections explicit 0 addresses. +01g,14jan02,tpw Diab: place .eh_frame data, in case of insistent GNU objects. +01f,14dec01,tpw Diab: provide both underscore options of wrs_kernel* here too. +01e,05dec01,tpw Both: Add .boot and .reset section support, for PPC 4xx series + and Book E. +01d,05dec01,tpw Diab: Add .frame_info section to text region. +01c,03dec01,jab Diab: replaced LOAD() with AT() +01b,14nov01,tpw ALL: Correct some more bootrom/kernel issues. +01b,06nov01,tpw GNU: Add /DISCARD/ directive to discard uninteresting sections +01a,01nov01,tpw gnu script written +01a,29oct01,jab diab script written +*/ + +ENTRY(_start) +SECTIONS +{ + .text : + { + wrs_kernel_text_start = .; _wrs_kernel_text_start = .; + _VX_START_TEXT = .; + *(.text) + wrs_kernel_text_fast = .; _wrs_kernel_text_fast = .; + *(.text.fast) + wrs_kernel_text_init = .; _wrs_kernel_text_init = .; + *(.text.init) + *(.text.*) *(.stub) *(.gnu.warning) *(.gnu.linkonce.t*) + KEEP(*(.init)) KEEP(*(.fini)) + *(.glue_7t) *(.glue_7) *(.rdata) /* for ARM */ + *(.mips16.fn.*) *(.mips16.call.*) *(.reginfo) /* for MIPS */ + *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) *(.rodata1) + *(.sdata2) *(.sbss2) /* for PPC */ + . = ALIGN(16); + } + . = ALIGN(16); + wrs_kernel_text_end = .; _wrs_kernel_text_end = .; + etext = .; _etext = .; + . = ALIGN(_VX_DATA_ALIGN); + .data : + { + wrs_kernel_data_start = .; _wrs_kernel_data_start = .; + _VX_START_DATA = .; + *(.data) + wrs_kernel_data_fast = .; _wrs_kernel_data_fast = .; + *(.data.fast) + wrs_kernel_data_init = .; _wrs_kernel_data_init = .; + *(.data.init) + *(.data.*) *(.gnu.linkonce.d*) SORT(CONSTRUCTORS) *(.data1) + *(.eh_frame) *(.gcc_except_table) + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + _gp = ALIGN(16) + 0x7ff0; /* set gp for MIPS startup code */ + /* got*, dynamic, sdata*, lit[48], and sbss should follow _gp */ + *(.got.plt) *(.got) *(.dynamic) + *(.got2) + *(.sdata) *(.sdata.*) *(.lit8) *(.lit4) + . = ALIGN(16); + } + . = ALIGN(16); + edata = .; _edata = .; + wrs_kernel_data_end = .; _wrs_kernel_data_end = .; + .bss : + { + wrs_kernel_bss_start = .; _wrs_kernel_bss_start = .; + *(.sbss) *(.scommon) *(.dynbss) *(.bss) *(COMMON) + . = ALIGN(16); + } + . = ALIGN(16); + end = .; _end = .; + wrs_kernel_bss_end = .; _wrs_kernel_bss_end = .; + + .kseg0data ((_VX_START_TEXT - 0x7e00) & 0xbfffffff) : + { + *(.kseg0data) + } + + /DISCARD/ : + { + *(.note) /* seen on Pentium ELF */ + *(.comment) /* seen on PPC & SH ELF */ + *(.pdr) /* seen on MIPS ELF */ + } + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} diff --git a/h/tool/gnu/ldscripts/link.MIPSROM b/h/tool/gnu/ldscripts/link.MIPSROM new file mode 100644 index 0000000..bcbffb1 --- /dev/null +++ b/h/tool/gnu/ldscripts/link.MIPSROM @@ -0,0 +1,142 @@ +/* link.MIPSROM - gnu linker command file for VxWorks: MIPS ROM */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* This file was automatically generated using tool/common/ldscripts. */ + +/* +modification history +-------------------- +01r,25aug05,dlk Support .text.init, .text.fast, .data.init, .data.fast. +01r,29jul05,slk SPR 104264: fix MIPS romResident images +01q,06may05,rlg changes for MIPS specific devices +01p,03jul04,f_b Improved support for data alignment +01o,12dec03,sn added more .rodata.str1.* handlers +01n,04dec03,sn Diab: .rodata.* is not handled correctly by Diab linker; instead + use specific names +01m,28oct03,sn Diab: collapse .rodata.cst* sections into .rodata +01l,29may02,tpw Diab: pad out sections, needed for MIPS byteswap. SPR 78076 +01k,24apr02,sn GNU: SPR 75835 - added support for relocatable script link.OUT +01j,19apr02,tpw Diab: provide _etext for ColdFire. SPR 75122 +01i,06feb02,sn Both: place .got2 to handle tramp.o (_x_gnu_tramp.o). +01h,25jan02,tpw GNU: give debug sections explicit 0 addresses. +01g,14jan02,tpw Diab: place .eh_frame data, in case of insistent GNU objects. +01f,14dec01,tpw Diab: provide both underscore options of wrs_kernel* here too. +01e,05dec01,tpw Both: Add .boot and .reset section support, for PPC 4xx series + and Book E. +01d,05dec01,tpw Diab: Add .frame_info section to text region. +01c,03dec01,jab Diab: replaced LOAD() with AT() +01b,14nov01,tpw ALL: Correct some more bootrom/kernel issues. +01b,06nov01,tpw GNU: Add /DISCARD/ directive to discard uninteresting sections +01a,01nov01,tpw gnu script written +01a,29oct01,jab diab script written +*/ + +ENTRY(_start) +SECTIONS +{ + .text : + { + wrs_kernel_text_start = .; _wrs_kernel_text_start = .; + _VX_START_TEXT = .; + *(.text) + wrs_kernel_text_fast = .; _wrs_kernel_text_fast = .; + *(.text.fast) + wrs_kernel_text_init = .; _wrs_kernel_text_init = .; + *(.text.init) + *(.text.*) *(.stub) *(.gnu.warning) *(.gnu.linkonce.t*) + KEEP(*(.init)) KEEP(*(.fini)) + *(.glue_7t) *(.glue_7) *(.rdata) /* for ARM */ + *(.mips16.fn.*) *(.mips16.call.*) *(.reginfo) /* for MIPS */ + *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) *(.rodata1) + *(.sdata2) *(.sbss2) /* for PPC */ + . = ALIGN(16); + } + . = ALIGN(16); + wrs_kernel_text_end = .; _wrs_kernel_text_end = .; + etext = .; _etext = .; + + .data : AT(etext) + { + wrs_kernel_data_start = .; _wrs_kernel_data_start = .; + _VX_START_DATA = .; + *(.data) + wrs_kernel_data_fast = .; _wrs_kernel_data_fast = .; + *(.data.fast) + wrs_kernel_data_init = .; _wrs_kernel_data_init = .; + *(.data.init) + *(.data.*) *(.gnu.linkonce.d*) SORT(CONSTRUCTORS) *(.data1) + *(.eh_frame) *(.gcc_except_table) + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + _gp = ALIGN(16) + 0x7ff0; /* set gp for MIPS startup code */ + /* got*, dynamic, sdata*, lit[48], and sbss should follow _gp */ + *(.got.plt) *(.got) *(.dynamic) + *(.got2) + *(.sdata) *(.sdata.*) *(.lit8) *(.lit4) + . = ALIGN(16); + } + . = ALIGN(16); + edata = .; _edata = .; + wrs_kernel_data_end = .; _wrs_kernel_data_end = .; + .bss : + { + wrs_kernel_bss_start = .; _wrs_kernel_bss_start = .; + *(.sbss) *(.scommon) *(.dynbss) *(.bss) *(COMMON) + . = ALIGN(16); + } + . = ALIGN(16); + end = .; _end = .; + wrs_kernel_bss_end = .; _wrs_kernel_bss_end = .; + + .kseg0data ((_VX_START_DATA - 0x7e00) & 0xbfffffff) : + { + *(.kseg0data) + } + + /DISCARD/ : + { + *(.note) /* seen on Pentium ELF */ + *(.comment) /* seen on PPC & SH ELF */ + *(.pdr) /* seen on MIPS ELF */ + } + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} diff --git a/h/tool/gnu/ldscripts/link.OUT b/h/tool/gnu/ldscripts/link.OUT new file mode 100644 index 0000000..0f40b81 --- /dev/null +++ b/h/tool/gnu/ldscripts/link.OUT @@ -0,0 +1,137 @@ +/* link.OUT - gnu linker command file for VxWorks: OUT */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* This file was automatically generated using tool/common/ldscripts. */ + +/* +modification history +-------------------- +01r,25aug05,dlk Support .text.init, .text.fast, .data.init, .data.fast. +01r,29jul05,slk SPR 104264: fix MIPS romResident images +01q,06may05,rlg changes for MIPS specific devices +01p,03jul04,f_b Improved support for data alignment +01o,12dec03,sn added more .rodata.str1.* handlers +01n,04dec03,sn Diab: .rodata.* is not handled correctly by Diab linker; instead + use specific names +01m,28oct03,sn Diab: collapse .rodata.cst* sections into .rodata +01l,29may02,tpw Diab: pad out sections, needed for MIPS byteswap. SPR 78076 +01k,24apr02,sn GNU: SPR 75835 - added support for relocatable script link.OUT +01j,19apr02,tpw Diab: provide _etext for ColdFire. SPR 75122 +01i,06feb02,sn Both: place .got2 to handle tramp.o (_x_gnu_tramp.o). +01h,25jan02,tpw GNU: give debug sections explicit 0 addresses. +01g,14jan02,tpw Diab: place .eh_frame data, in case of insistent GNU objects. +01f,14dec01,tpw Diab: provide both underscore options of wrs_kernel* here too. +01e,05dec01,tpw Both: Add .boot and .reset section support, for PPC 4xx series + and Book E. +01d,05dec01,tpw Diab: Add .frame_info section to text region. +01c,03dec01,jab Diab: replaced LOAD() with AT() +01b,14nov01,tpw ALL: Correct some more bootrom/kernel issues. +01b,06nov01,tpw GNU: Add /DISCARD/ directive to discard uninteresting sections +01a,01nov01,tpw gnu script written +01a,29oct01,jab diab script written +*/ + +ENTRY(_start) +SECTIONS +{ + .text 0 : + { + + _VX_START_TEXT = .; + *(.text) + + *(.text.fast) + + *(.text.init) + *(.text.*) *(.stub) *(.gnu.warning) *(.gnu.linkonce.t*) + KEEP(*(.init)) KEEP(*(.fini)) + *(.glue_7t) *(.glue_7) *(.rdata) /* for ARM */ + *(.mips16.fn.*) *(.mips16.call.*) *(.reginfo) /* for MIPS */ + *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) *(.rodata1) + *(.sdata2) *(.sbss2) /* for PPC */ + + } + + + + + .data 0 : + { + + _VX_START_DATA = .; + *(.data) + + *(.data.fast) + + *(.data.init) + *(.data.*) *(.gnu.linkonce.d*) SORT(CONSTRUCTORS) *(.data1) + *(.eh_frame) *(.gcc_except_table) + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + + /* got*, dynamic, sdata*, lit[48], and sbss should follow _gp */ + *(.got.plt) *(.got) *(.dynamic) + *(.got2) + *(.sdata) *(.sdata.*) *(.lit8) *(.lit4) + + } + + + + .bss 0 : + { + + *(.sbss) *(.scommon) *(.dynbss) *(.bss) *(COMMON) + + } + + + + + /DISCARD/ : + { + *(.note) /* seen on Pentium ELF */ + *(.comment) /* seen on PPC & SH ELF */ + *(.pdr) /* seen on MIPS ELF */ + } + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} diff --git a/h/tool/gnu/ldscripts/link.RAM b/h/tool/gnu/ldscripts/link.RAM new file mode 100644 index 0000000..b842710 --- /dev/null +++ b/h/tool/gnu/ldscripts/link.RAM @@ -0,0 +1,137 @@ +/* link.RAM - gnu linker command file for VxWorks: RAM */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* This file was automatically generated using tool/common/ldscripts. */ + +/* +modification history +-------------------- +01r,25aug05,dlk Support .text.init, .text.fast, .data.init, .data.fast. +01r,29jul05,slk SPR 104264: fix MIPS romResident images +01q,06may05,rlg changes for MIPS specific devices +01p,03jul04,f_b Improved support for data alignment +01o,12dec03,sn added more .rodata.str1.* handlers +01n,04dec03,sn Diab: .rodata.* is not handled correctly by Diab linker; instead + use specific names +01m,28oct03,sn Diab: collapse .rodata.cst* sections into .rodata +01l,29may02,tpw Diab: pad out sections, needed for MIPS byteswap. SPR 78076 +01k,24apr02,sn GNU: SPR 75835 - added support for relocatable script link.OUT +01j,19apr02,tpw Diab: provide _etext for ColdFire. SPR 75122 +01i,06feb02,sn Both: place .got2 to handle tramp.o (_x_gnu_tramp.o). +01h,25jan02,tpw GNU: give debug sections explicit 0 addresses. +01g,14jan02,tpw Diab: place .eh_frame data, in case of insistent GNU objects. +01f,14dec01,tpw Diab: provide both underscore options of wrs_kernel* here too. +01e,05dec01,tpw Both: Add .boot and .reset section support, for PPC 4xx series + and Book E. +01d,05dec01,tpw Diab: Add .frame_info section to text region. +01c,03dec01,jab Diab: replaced LOAD() with AT() +01b,14nov01,tpw ALL: Correct some more bootrom/kernel issues. +01b,06nov01,tpw GNU: Add /DISCARD/ directive to discard uninteresting sections +01a,01nov01,tpw gnu script written +01a,29oct01,jab diab script written +*/ + +ENTRY(_start) +SECTIONS +{ + .text : + { + wrs_kernel_text_start = .; _wrs_kernel_text_start = .; + _VX_START_TEXT = .; + *(.text) + wrs_kernel_text_fast = .; _wrs_kernel_text_fast = .; + *(.text.fast) + wrs_kernel_text_init = .; _wrs_kernel_text_init = .; + *(.text.init) + *(.text.*) *(.stub) *(.gnu.warning) *(.gnu.linkonce.t*) + KEEP(*(.init)) KEEP(*(.fini)) + *(.glue_7t) *(.glue_7) *(.rdata) /* for ARM */ + *(.mips16.fn.*) *(.mips16.call.*) *(.reginfo) /* for MIPS */ + *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) *(.rodata1) + *(.sdata2) *(.sbss2) /* for PPC */ + . = ALIGN(16); + } + . = ALIGN(16); + wrs_kernel_text_end = .; _wrs_kernel_text_end = .; + etext = .; _etext = .; + . = ALIGN(_VX_DATA_ALIGN); + .data : + { + wrs_kernel_data_start = .; _wrs_kernel_data_start = .; + _VX_START_DATA = .; + *(.data) + wrs_kernel_data_fast = .; _wrs_kernel_data_fast = .; + *(.data.fast) + wrs_kernel_data_init = .; _wrs_kernel_data_init = .; + *(.data.init) + *(.data.*) *(.gnu.linkonce.d*) SORT(CONSTRUCTORS) *(.data1) + *(.eh_frame) *(.gcc_except_table) + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + _gp = ALIGN(16) + 0x7ff0; /* set gp for MIPS startup code */ + /* got*, dynamic, sdata*, lit[48], and sbss should follow _gp */ + *(.got.plt) *(.got) *(.dynamic) + *(.got2) + *(.sdata) *(.sdata.*) *(.lit8) *(.lit4) + . = ALIGN(16); + } + . = ALIGN(16); + edata = .; _edata = .; + wrs_kernel_data_end = .; _wrs_kernel_data_end = .; + .bss : + { + wrs_kernel_bss_start = .; _wrs_kernel_bss_start = .; + *(.sbss) *(.scommon) *(.dynbss) *(.bss) *(COMMON) + . = ALIGN(16); + } + . = ALIGN(16); + end = .; _end = .; + wrs_kernel_bss_end = .; _wrs_kernel_bss_end = .; + + /DISCARD/ : + { + *(.note) /* seen on Pentium ELF */ + *(.comment) /* seen on PPC & SH ELF */ + *(.pdr) /* seen on MIPS ELF */ + } + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} diff --git a/h/tool/gnu/ldscripts/link.ROM b/h/tool/gnu/ldscripts/link.ROM new file mode 100644 index 0000000..8b8b608 --- /dev/null +++ b/h/tool/gnu/ldscripts/link.ROM @@ -0,0 +1,137 @@ +/* link.ROM - gnu linker command file for VxWorks: ROM */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* This file was automatically generated using tool/common/ldscripts. */ + +/* +modification history +-------------------- +01r,25aug05,dlk Support .text.init, .text.fast, .data.init, .data.fast. +01r,29jul05,slk SPR 104264: fix MIPS romResident images +01q,06may05,rlg changes for MIPS specific devices +01p,03jul04,f_b Improved support for data alignment +01o,12dec03,sn added more .rodata.str1.* handlers +01n,04dec03,sn Diab: .rodata.* is not handled correctly by Diab linker; instead + use specific names +01m,28oct03,sn Diab: collapse .rodata.cst* sections into .rodata +01l,29may02,tpw Diab: pad out sections, needed for MIPS byteswap. SPR 78076 +01k,24apr02,sn GNU: SPR 75835 - added support for relocatable script link.OUT +01j,19apr02,tpw Diab: provide _etext for ColdFire. SPR 75122 +01i,06feb02,sn Both: place .got2 to handle tramp.o (_x_gnu_tramp.o). +01h,25jan02,tpw GNU: give debug sections explicit 0 addresses. +01g,14jan02,tpw Diab: place .eh_frame data, in case of insistent GNU objects. +01f,14dec01,tpw Diab: provide both underscore options of wrs_kernel* here too. +01e,05dec01,tpw Both: Add .boot and .reset section support, for PPC 4xx series + and Book E. +01d,05dec01,tpw Diab: Add .frame_info section to text region. +01c,03dec01,jab Diab: replaced LOAD() with AT() +01b,14nov01,tpw ALL: Correct some more bootrom/kernel issues. +01b,06nov01,tpw GNU: Add /DISCARD/ directive to discard uninteresting sections +01a,01nov01,tpw gnu script written +01a,29oct01,jab diab script written +*/ + +ENTRY(_start) +SECTIONS +{ + .text : + { + wrs_kernel_text_start = .; _wrs_kernel_text_start = .; + _VX_START_TEXT = .; + *(.text) + wrs_kernel_text_fast = .; _wrs_kernel_text_fast = .; + *(.text.fast) + wrs_kernel_text_init = .; _wrs_kernel_text_init = .; + *(.text.init) + *(.text.*) *(.stub) *(.gnu.warning) *(.gnu.linkonce.t*) + KEEP(*(.init)) KEEP(*(.fini)) + *(.glue_7t) *(.glue_7) *(.rdata) /* for ARM */ + *(.mips16.fn.*) *(.mips16.call.*) *(.reginfo) /* for MIPS */ + *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) *(.rodata1) + *(.sdata2) *(.sbss2) /* for PPC */ + . = ALIGN(16); + } + . = ALIGN(16); + wrs_kernel_text_end = .; _wrs_kernel_text_end = .; + etext = .; _etext = .; + + .data : AT(etext) + { + wrs_kernel_data_start = .; _wrs_kernel_data_start = .; + _VX_START_DATA = .; + *(.data) + wrs_kernel_data_fast = .; _wrs_kernel_data_fast = .; + *(.data.fast) + wrs_kernel_data_init = .; _wrs_kernel_data_init = .; + *(.data.init) + *(.data.*) *(.gnu.linkonce.d*) SORT(CONSTRUCTORS) *(.data1) + *(.eh_frame) *(.gcc_except_table) + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + _gp = ALIGN(16) + 0x7ff0; /* set gp for MIPS startup code */ + /* got*, dynamic, sdata*, lit[48], and sbss should follow _gp */ + *(.got.plt) *(.got) *(.dynamic) + *(.got2) + *(.sdata) *(.sdata.*) *(.lit8) *(.lit4) + . = ALIGN(16); + } + . = ALIGN(16); + edata = .; _edata = .; + wrs_kernel_data_end = .; _wrs_kernel_data_end = .; + .bss : + { + wrs_kernel_bss_start = .; _wrs_kernel_bss_start = .; + *(.sbss) *(.scommon) *(.dynbss) *(.bss) *(COMMON) + . = ALIGN(16); + } + . = ALIGN(16); + end = .; _end = .; + wrs_kernel_bss_end = .; _wrs_kernel_bss_end = .; + + /DISCARD/ : + { + *(.note) /* seen on Pentium ELF */ + *(.comment) /* seen on PPC & SH ELF */ + *(.pdr) /* seen on MIPS ELF */ + } + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} diff --git a/h/tool/gnu/ldscripts/link.SIMNT b/h/tool/gnu/ldscripts/link.SIMNT new file mode 100644 index 0000000..8092627 --- /dev/null +++ b/h/tool/gnu/ldscripts/link.SIMNT @@ -0,0 +1,110 @@ +OUTPUT_FORMAT(pei-i386) +ENTRY(_mainCRTStartup) +SECTIONS +{ + .text __image_base__ + __section_alignment__ : + { + *(.init) + *(.text) + *(SORT(.text[0-9]*)) + *(SORT(.text$*)) + *(SORT(.text*)) + *(.glue_7t) + *(.glue_7) + ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; + LONG (-1); *(.ctors); *(.ctor); LONG (0); + ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; + LONG (-1); *(.dtors); *(.dtor); LONG (0); + *(.fini) + /* ??? Why is .gcc_exc here? */ + *(.gcc_exc) + etext = .; + *(.gcc_except_table) + } + /* Move .idata up here, just after .text, so that all text-like sections + are grouped together. Unfortunately, we can't merge it into the .text + section -- vxWorks.exe won't run in that case. Apparently, something + about windows application loading depends on .idata being distinct. */ + .idata BLOCK(__section_alignment__) : + { + /* This cannot currently be handled with grouped sections. + See pe.em:sort_sections. */ + SORT(*)(.idata$2) + SORT(*)(.idata$3) + /* These zeroes mark the end of the import list. */ + LONG (0); LONG (0); LONG (0); LONG (0); LONG (0); + SORT(*)(.idata$4) + SORT(*)(.idata$5) + SORT(*)(.idata$6) + SORT(*)(.idata$7) + } + /* The Cygwin32 library uses a section to avoid copying certain data + on fork. This used to be named ".data". The linker used + to include this between __data_start__ and __data_end__, but that + breaks building the cygwin32 dll. Instead, we name the section + ".data_cygwin_nocopy" and explictly include it after __data_end__. */ + .data BLOCK(__section_alignment__) : + { + __data_start__ = . ; + *(.data) + *(.data2) + *(SORT(.data[0-9]*)) + *(SORT(.data$*)) + *(SORT(.data*)) + __data_end__ = . ; + *(.data_cygwin_nocopy) + + *(.rdata) + *(SORT(.rdata[0-9]*)) + *(SORT(.rdata$*)) + *(SORT(.rdata*)) + *(.eh_frame) + + *(.pdata) + } + .bss BLOCK(__section_alignment__) : + { + __bss_start__ = . ; + *(.bss) + *(COMMON) + __bss_end__ = . ; + + *(.edata) + } + /DISCARD/ : + { + *(.debug$S) + *(.debug$T) + *(.debug$F) + *(.drectve) + } + .CRT BLOCK(__section_alignment__) : + { + *(SORT(.CRT$*)) + } + .endjunk BLOCK(__section_alignment__) : + { + /* end is deprecated, don't use it */ + end = .; + _end = .; + __end__ = .; + } + .rsrc BLOCK(__section_alignment__) : + { + *(.rsrc) + *(SORT(.rsrc$*)) + } + .reloc BLOCK(__section_alignment__) : + { + *(.reloc) + } + .stab BLOCK(__section_alignment__) (NOLOAD) : + { + [ .stab ] + } + .stabstr BLOCK(__section_alignment__) (NOLOAD) : + { + [ .stabstr ] + } +} + diff --git a/h/tool/gnu/limits.h b/h/tool/gnu/limits.h new file mode 100644 index 0000000..559e712 --- /dev/null +++ b/h/tool/gnu/limits.h @@ -0,0 +1,98 @@ +#ifndef _LIMITS_H___ +#ifndef _MACH_MACHLIMITS_H_ + +/* _MACH_MACHLIMITS_H_ is used on OSF/1. */ +#define _LIMITS_H___ +#define _MACH_MACHLIMITS_H_ + +/* Number of bits in a `char'. */ +#undef CHAR_BIT +#define CHAR_BIT 8 + +/* Maximum length of a multibyte character. */ +#ifndef MB_LEN_MAX +#define MB_LEN_MAX 1 +#endif + +/* Minimum and maximum values a `signed char' can hold. */ +#undef SCHAR_MIN +#define SCHAR_MIN (-128) +#undef SCHAR_MAX +#define SCHAR_MAX 127 + +/* Maximum value an `unsigned char' can hold. (Minimum is 0). */ +#undef UCHAR_MAX +#define UCHAR_MAX 255 + +/* Minimum and maximum values a `char' can hold. */ +#ifdef __CHAR_UNSIGNED__ +#undef CHAR_MIN +#define CHAR_MIN 0 +#undef CHAR_MAX +#define CHAR_MAX 255 +#else +#undef CHAR_MIN +#define CHAR_MIN (-128) +#undef CHAR_MAX +#define CHAR_MAX 127 +#endif + +/* Minimum and maximum values a `signed short int' can hold. */ +#undef SHRT_MIN +/* For the sake of 16 bit hosts, we may not use -32768 */ +#define SHRT_MIN (-32767-1) +#undef SHRT_MAX +#define SHRT_MAX 32767 + +/* Maximum value an `unsigned short int' can hold. (Minimum is 0). */ +#undef USHRT_MAX +#define USHRT_MAX 65535 + +/* Minimum and maximum values a `signed int' can hold. */ +#ifndef __INT_MAX__ +#define __INT_MAX__ 2147483647 +#endif +#undef INT_MIN +#define INT_MIN (-INT_MAX-1) +#undef INT_MAX +#define INT_MAX __INT_MAX__ + +/* Maximum value an `unsigned int' can hold. (Minimum is 0). */ +#undef UINT_MAX +#define UINT_MAX (INT_MAX * 2U + 1) + +/* Minimum and maximum values a `signed long int' can hold. + (Same as `int'). */ +#ifndef __LONG_MAX__ +#if defined (__alpha__) || defined (__sparc_v9__) || defined (__sparcv9) +#define __LONG_MAX__ 9223372036854775807L +#else +#define __LONG_MAX__ 2147483647L +#endif /* __alpha__ || sparc64 */ +#endif +#undef LONG_MIN +#define LONG_MIN (-LONG_MAX-1) +#undef LONG_MAX +#define LONG_MAX __LONG_MAX__ + +/* Maximum value an `unsigned long int' can hold. (Minimum is 0). */ +#undef ULONG_MAX +#define ULONG_MAX (LONG_MAX * 2UL + 1) + +#if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__) +/* Minimum and maximum values a `signed long long int' can hold. */ +#ifndef __LONG_LONG_MAX__ +#define __LONG_LONG_MAX__ 9223372036854775807LL +#endif +#undef LONG_LONG_MIN +#define LONG_LONG_MIN (-LONG_LONG_MAX-1) +#undef LONG_LONG_MAX +#define LONG_LONG_MAX __LONG_LONG_MAX__ + +/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */ +#undef ULONG_LONG_MAX +#define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1) +#endif + +#endif /* _MACH_MACHLIMITS_H_ */ +#endif /* _LIMITS_H___ */ diff --git a/h/tool/gnu/make.ARMARCH5gnu b/h/tool/gnu/make.ARMARCH5gnu new file mode 100644 index 0000000..bc97f0f --- /dev/null +++ b/h/tool/gnu/make.ARMARCH5gnu @@ -0,0 +1,35 @@ +# make.ARMARCH5gnu - GNU compilation tools definitions for ARM architecture 5 +# +# modification history +# -------------------- +# 01n,05dec03,sn updated flags for gcc 3.3.2 +# 01m,10jan02,to move 'include defs.arm' after CPU and TOOL defines for +# libgcc build +# 01l,18dec01,to move common definitions to defs.arm +# 01k,16nov01,t_m Change sysInit entry +# 01j,06nov01,tpw Add %.old rule to facilitate conversions to old OMFs +# 01i,26oct01,t_m Switch to ARCH5 +# 01i,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01h,19oct01,jb include of defs.gnu is out of sequence - fixed +# 01g,25sep01,dat Location of defs.gnu changed to tool/gnu +# 01f,10aug01,rec add gnu 2.96 architecture definitions +# 01e,05jun01,mem Remove HEX_FLAGS +# 01d,30mar01,t_m -fno-for-scope for C++ and rogue-wave +# 01c,28feb01,t_m merge in XScale changes +# 01b,24aug00,rec add support for big endian +# 01a,26nov98,cdp created from 01g of make.ARMSA110gnu. +# +# DESCRIPTION +# This file contains ARM Architecture 5 little-endian-specific definitions +# and flags for the GNU software generation tools (compiler, assembler, +# linker etc.). +#*/ + +CPU = ARMARCH5 +TOOL = gnu + +include $(TGT_DIR)/h/tool/gnu/defs.arm + +CC_ARCH_SPEC = -t5 + +# end of make.ARMARCH5gnu diff --git a/h/tool/gnu/make.ARMARCH5gnube b/h/tool/gnu/make.ARMARCH5gnube new file mode 100644 index 0000000..6318746 --- /dev/null +++ b/h/tool/gnu/make.ARMARCH5gnube @@ -0,0 +1,39 @@ +# make.ARMARCH5gnube - GNU compilation tools definitions for ARM architecture 5 +# +# modification history +# -------------------- +# 01r,17dec03,mcm Workaround for SPR 92687 +# 01q,05dec03,sn updated flags for gcc 3.3.2 +# 01p,10jan02,to move 'include defs.arm' after CPU and TOOL defines for +# libgcc build +# 01o,18dec01,to move common definitions to defs.arm +# 01n,10dec01,tpw Fix %.old configuration for Big Endian ARM. +# 01m,16nov01,t_m Change sysInit entry +# 01l,06nov01,tpw Add %.old rule to facilitate conversions to old OMFs +# 01k,26oct01,t_m Switch to ARCH5 +# 01k,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01j,19oct01,jb include of defs.gnu is out of sequence - fixed +# 01i,25sep01,dat Location of defs.gnu changed to tool/gnu +# 01h,10aug01,rec add gnu 2.96 architecture definitions +# 01g,05jun01,mem Remove HEX_FLAGS +# 01f,04apr01,t_m add fno-for-scope +# 01e,14mar01,t_m fix CCC_ARCH type +# 01d,14mar01,rec gnu 2.9 tool chain changes +# 01c,18dec00,rec define CPP for big endian builds +# 01b,04dec00,rec renamed element +# 01a,26nov98,cdp created from 01g of make.ARMSA110gnu. +# +# DESCRIPTION +# This file contains ARM Architecture 5 big-endian-specific definitions +# and flags for the GNU software generation tools (compiler, assembler, +# linker etc.). +#*/ + +CPU = ARMARCH5 +TOOL = gnube + +include $(TGT_DIR)/h/tool/gnu/defs.arm + +CC_ARCH_SPEC = -t5be -Wa,-EB + +# end of make.ARMARCH5gnube diff --git a/h/tool/gnu/make.ARMARCH6gnu b/h/tool/gnu/make.ARMARCH6gnu new file mode 100644 index 0000000..9fd3c2b --- /dev/null +++ b/h/tool/gnu/make.ARMARCH6gnu @@ -0,0 +1,20 @@ +# make.ARMARCH6gnu - GNU compilation tools definitions for ARM architecture 6 +# +# modification history +# -------------------- +# 01a,06dec04,jb Copied from make.ARMARCH5gnu +# +# DESCRIPTION +# This file contains ARM Architecture 6 little-endian-specific definitions +# and flags for the GNU software generation tools (compiler, assembler, +# linker etc.). +#*/ + +CPU = ARMARCH6 +TOOL = gnu + +include $(TGT_DIR)/h/tool/gnu/defs.arm + +CC_ARCH_SPEC = -t5 + +# end of make.ARMARCH6gnu diff --git a/h/tool/gnu/make.ARMARCH6gnube b/h/tool/gnu/make.ARMARCH6gnube new file mode 100644 index 0000000..7b925de --- /dev/null +++ b/h/tool/gnu/make.ARMARCH6gnube @@ -0,0 +1,20 @@ +# make.ARMARCH6gnube - GNU compilation tools definitions for ARM architecture 6 +# +# modification history +# -------------------- +# 01a,06dec04,jb Copied from make.ARMARCH5gnube +# +# DESCRIPTION +# This file contains ARM Architecture 6 big-endian-specific definitions +# and flags for the GNU software generation tools (compiler, assembler, +# linker etc.). +#*/ + +CPU = ARMARCH6 +TOOL = gnube + +include $(TGT_DIR)/h/tool/gnu/defs.arm + +CC_ARCH_SPEC = -t5be -Wa,-EB + +# end of make.ARMARCH6gnube diff --git a/h/tool/gnu/make.I80486gnu b/h/tool/gnu/make.I80486gnu new file mode 100644 index 0000000..7374e72 --- /dev/null +++ b/h/tool/gnu/make.I80486gnu @@ -0,0 +1,62 @@ +# make.I80486gnu - GNU compilation tools definitions for I80486 +# +# modification history +# -------------------- +# 01y,30apr04,kk added ABI_SPEC +# 01x,07nov03,c_c Removed Compiler definitions. +# 01w,11dec02,hdn revived for I80486 support +# 01v,12feb02,sn removed obsolete refs to GCC_EXEC_PREFIX +# 01u,21jan02,sn removed unused C++_TEMPLATE_INST +# 01t,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01s,25sep01,dat Location of defs.gnu changed to tool/gnu +# 01r,10jan01,sn use pentium toolchain +# 01q,18oct00,sn update arch flags for new compiler: +# generate code for and schedule for 486 +# 01p,16oct00,sn added include gnu; removed LIBS defn +# 01o,18sep98,sn Defined C++_TEMPLATE_INST +# 01n,07apr98,pcn Re-set some definitions removed by previous changed. +# 01m,02apr98,pcn Removed Objcopy changes from Tempest view +# 01l,15dec97,pcn Added Objcopy in BSP build. +# 01k,18sep97,ms added ARCH_DIR +# 01l,04oct96,yp Added -B option so compiler driver doesn't need EXEC_PREFIX, +# added CC_ARCH_SPEC for machine specific flags +# 01k,01nov95,yp Added NM definition for C++ +# 01j,21jun95,yp change definitions for BIN tools used in bsp build +# 01i,19jun95,srh made C++ compiler name specific to cfront. +# 01h,18jun95,srh added more C++ support. +# 01g,28may95,srh workaround gmake problem with "C++=..." +# 01f,25may95,jcf new environment variables +# 01e,23may95,srh add C++ support +# 01d,26apr94,hdn added -O flag. +# 01c,08dec93,hdn added EXTRACT_BIN, BINXSYM, BINHEX. +# 01b,17nov93,hdn added -fno-defer-pop flag. +# 01a,09jun93,hdn written +# +# DESCRIPTION +# This file contains I80486 specific definitions and flags for the GNU +# software generation tools (compiler, assembler, linker etc.). +#*/ + +CPU = I80486 +TOOL = gnu + +include $(TGT_DIR)/h/tool/gnu/defs.gnu + +CC_OPTIM_DRIVER = -fvolatile -nostdlib -fno-builtin -fno-defer-pop +CC_OPTIM_NORMAL = -O2 -nostdlib -fno-builtin -fno-defer-pop +CC_OPTIM_TARGET = -O2 -fvolatile -nostdlib -fno-builtin -fno-defer-pop +# Schedule for (-mcpu=) and generate code for (-march=) i486 +CC_ARCH_SPEC = -mcpu=i486 -march=i486 + +TOOLENV = pentium +VX_CPU_FAMILY = pentium +ARCH_DIR = i86 +ABI_SPEC = x86 + +CF = + +HLL_PREFIX = + +OBJCOPY_OLD_OMF = -O a.out-i386 --gap-fill=0 + +# end of make.I80486gnu diff --git a/h/tool/gnu/make.MIPS32sfgnu b/h/tool/gnu/make.MIPS32sfgnu new file mode 100644 index 0000000..503b275 --- /dev/null +++ b/h/tool/gnu/make.MIPS32sfgnu @@ -0,0 +1,40 @@ +# make.MIPS32sfgnu - GNU tools definitions for MIPS32 with software floating pt. +# +# Copyright 2000-2001 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01p,06may05,rlg Changes for MIPS specific devices +# 01o,23apr04,yvp added ABI_SPEC +# 01n,10jan02,pes Move include of defs.mips after CPU and TOOL are defined +# 01m,09jan02,pes Move common definitions to defs.mips +# 01l,07dec01,s_l Add a flag to allow target side build (-fno-schedule-insn). +# Must be rmove when a comp fix goes in. +# 01k,28nov01,tpw Remove -funroll-loops from MIPS*gnu* makefile fragments. +# 01j,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01i,11oct01,dat SPR 20403, OPTIM_DRIVER must have -fvolatile +# 01h,25sep01,dat Location of defs.gnu changed to tool/gnu +# 01g,27jun01,agf add LONGCALL macro +# 01f,05mar01,mem Added -DSOFT_FLOAT to command line args. +# 01e,08feb01,mem Changed RES_LDFLAGS to -m vxr5ebmip +# 01d,18jan01,mem Added -mno-branch-likely. +# 01c,08jan01,pes Remove -pedantic switch from compiler command line. +# 01b,04jan01,mem Updated to use new bootrom extraction +# 01a,08Dec00,pes created based on make.R4000sfgnu. +# +# DESCRIPTION +# This file contains MIPS32 specific definitions and flags for the GNU +# software generation tools (compiler, assembler, linker etc) when used +# to generate a 32 bit compatible vxWorks. +#*/ + +CPU = MIPS32 +TOOL = sfgnu +ABI_SPEC = MIPS32 + +include $(TGT_DIR)/h/tool/gnu/defs.mips +#add the next two line for MIPS specific devices +LD_SCRIPT_RAM = -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.MIPSRAM +LD_SCRIPT_ROM = -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.MIPSROM + +# end of make.MIPS32sfgnu diff --git a/h/tool/gnu/make.MIPS32sfgnule b/h/tool/gnu/make.MIPS32sfgnule new file mode 100644 index 0000000..01b2505 --- /dev/null +++ b/h/tool/gnu/make.MIPS32sfgnule @@ -0,0 +1,42 @@ +# make.MIPS32sfgnule - GNU definitions for MIPS32 software float (little endian) +# +# Copyright 2000-2001 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01r,06may05,rlg Changes for MIPS specific devices +# 01q,23apr04,yvp added ABI_SPEC +# 01p,10jan02,pes Move include of defs.mips after CPU and TOOL are defined +# 01o,09jan02,pes Move common definitions to defs.mips +# 01n,07dec01,s_l Add a flag to allow target side build (-fno-schedule-insn). +# Must be rmove when a comp fix goes in. +# 01m,28nov01,tpw Remove -funroll-loops from MIPS*gnu* makefile fragments. +# 01l,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01k,11oct01,dat SPR 20403, OPTIM_DRIVER must have -fvolatile +# 01j,25sep01,dat Location of defs.gnu changed to tool/gnu +# 01i,27jun01,agf add LONGCALL macro +# 01h,23mar01,roz Added LD_ENDIAN_FLAG +# 01g,05mar01,mem Added -DSOFT_FLOAT to command line args. +# 01f,08feb01,mem Changed RES_LDFLAGS to -m vxr5ebmip +# 01e,18jan01,mem Added -mno-branch-likely. +# 01d,08jan01,pes Remove -pedantic compiler command line option. +# 01c,04jan01,mem Updated to use new bootrom extraction +# 01b,04jan01,pes Correct endian specification in CC_ARCH_SPEC +# 01a,08dec00,pes created based on make.MIPS64gnu +# +# DESCRIPTION +# This file contains MIPS32 specific definitions and flags for the GNU +# software generation tools (compiler, assembler, linker etc) when used +# to generate a 32 bit compatible vxWorks. +#*/ + +CPU = MIPS32 +TOOL = sfgnule +ABI_SPEC = MIPS32 + +include $(TGT_DIR)/h/tool/gnu/defs.mips +#add the next two line for MIPS specific devices +LD_SCRIPT_RAM = -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.MIPSRAM +LD_SCRIPT_ROM = -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.MIPSROM + +# end of make.MIPS32sfgnule diff --git a/h/tool/gnu/make.MIPS64gnu b/h/tool/gnu/make.MIPS64gnu new file mode 100644 index 0000000..9445bfa --- /dev/null +++ b/h/tool/gnu/make.MIPS64gnu @@ -0,0 +1,36 @@ +# make.MIPS64gnu - GNU compilation tools definitions for MIPS64 +# +# Copyright 2000-2001 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01m,06may05,rlg Changes for MIPS specific devices +# 01l,23apr04,yvp added ABI_SPEC +# 01k,10jan02,pes Move include of defs.mips after CPU and TOOL are defined +# 01j,09jan02,pes Move common definitions to defs.mips +# 01i,28nov01,tpw Remove -funroll-loops from MIPS*gnu* makefile fragments. +# 01h,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01g,11oct01,dat SPR 20403, OPTIM_DRIVER must have -fvolatile +# 01f,25sep01,dat Location of defs.gnu changed to tool/gnu +# 01e,27jun01,agf add LONGCALL macro +# 01d,08feb01,mem Changed RES_LDFLAGS to -m vxr5ebmip +# 01c,11jan01,mem Added -mno-branch-likely. +# 01b,04jan01,mem Added support for objcopy-style extraction. +# 01a,08dec00,pes created based on make.r4000gnu +# +# DESCRIPTION +# This file contains MIPS64 specific definitions and flags for the GNU +# software generation tools (compiler, assembler, linker etc) when used +# to generate a 64 bit compatible vxWorks. +#*/ + +CPU = MIPS64 +TOOL = gnu +ABI_SPEC = MIPS64BE + +include $(TGT_DIR)/h/tool/gnu/defs.mips +#add the next two line for MIPS specific devices +LD_SCRIPT_RAM = -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.MIPSRAM +LD_SCRIPT_ROM = -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.MIPSROM + +# end of make.MIPS64gnu diff --git a/h/tool/gnu/make.MIPS64gnule b/h/tool/gnu/make.MIPS64gnule new file mode 100644 index 0000000..764ff92 --- /dev/null +++ b/h/tool/gnu/make.MIPS64gnule @@ -0,0 +1,38 @@ +# make.MIPS64gnule - GNU tools definitions for MIPS64 (little endian) +# +# Copyright 2000-2001 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01n,23apr04,yvp added ABI_SPEC +# 01m,10jan02,pes Move include of defs.mips after CPU and TOOL are defined +# 01l,09jan02,pes Move common definitions to defs.mips +# 01k,07dec01,s_l Add a flag to allow target side build (-fno-schedule-insn). +# Must be rmove when a comp fix goes in. +# 01j,28nov01,tpw Remove -funroll-loops from MIPS*gnu* makefile fragments. +# 01i,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01h,11oct01,dat SPR 20403, OPTIM_DRIVER must have -fvolatile +# 01g,25sep01,dat Location of defs.gnu changed to tool/gnu +# 01f,27jun01,agf add LONGCALL macro +# 01e,06apr01,mem Change to make.MIPS64gnule, update command line flags +# 01d,23mar01,roz Added LD_ENDIAN_FLAG +# 01c,08feb01,mem Changed RES_LDFLAGS to -m vxr5ebmip +# 01b,04jan01,mem Updated to use new bootrom extraction +# 01a,11dec00,pes created based on make.MIPS64gnu +# +# DESCRIPTION +# This file contains MIPS64 specific definitions and flags for the GNU +# software generation tools (compiler, assembler, linker etc) when used +# to generate a 64 bit compatible vxWorks in little-endian mode. +#*/ + +CPU = MIPS64 +TOOL = gnule +ABI_SPEC = MIPS64LE + +include $(TGT_DIR)/h/tool/gnu/defs.mips +#add the next two line for MIPS specific devices +LD_SCRIPT_RAM = -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.MIPSRAM +LD_SCRIPT_ROM = -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.MIPSROM + +# end of make.MIPS64gnule diff --git a/h/tool/gnu/make.PENTIUM2gnu b/h/tool/gnu/make.PENTIUM2gnu new file mode 100644 index 0000000..bb741b2 --- /dev/null +++ b/h/tool/gnu/make.PENTIUM2gnu @@ -0,0 +1,44 @@ +# make.PENTIUM2gnu - GNU compilation tools definitions for PENTIUM2 +# +# modification history +# -------------------- +# 01j,10dec03,yvp Added ABI_SPEC. +# 01i,07nov03,c_c Removed Compiler definitions. +# 01h,24apr02,pai redefined HLL_PREFIX for GNU ELF support (SPR 73382). +# 01g,12feb02,sn removed obsolete refs to GCC_EXEC_PREFIX +# 01f,21jan02,sn removed unused C++_TEMPLATE_INST +# 01e,06nov01,tpw Add %.old rule to facilitate conversions to old OMFs +# 01d,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01c,25sep01,dat Location of defs.gnu changed to tool/gnu +# 01b,17aug01,max adjustments for new pentium toolchain +# 01a,15aug01,hdn written based on 01g version of make.PENTIUMgnu +# +# DESCRIPTION +# This file contains PENTIUM2 specific definitions and flags for the GNU +# software generation tools (compiler, assembler, linker etc.). +#*/ + +CPU = PENTIUM2 +TOOL = gnu + +include $(TGT_DIR)/h/tool/gnu/defs.gnu + +CC_OPTIM_DRIVER = -fvolatile -nostdlib -fno-builtin -fno-defer-pop +CC_OPTIM_NORMAL = -O2 -nostdlib -fno-builtin -fno-defer-pop +CC_OPTIM_TARGET = -O2 -fvolatile -nostdlib -fno-builtin -fno-defer-pop +# Generate code for (-mcpu=) and schedule for (-march=) pentium +CC_ARCH_SPEC = -mcpu=pentiumpro -march=pentiumpro + + +TOOLENV = pentium +VX_CPU_FAMILY = pentium +ARCH_DIR = i86 +ABI_SPEC = x86 + +CF = + +HLL_PREFIX = + +OBJCOPY_OLD_OMF = -O a.out-i386 --gap-fill=0 + +# end of make.PENTIUM2gnu diff --git a/h/tool/gnu/make.PENTIUM3gnu b/h/tool/gnu/make.PENTIUM3gnu new file mode 100644 index 0000000..7f73e83 --- /dev/null +++ b/h/tool/gnu/make.PENTIUM3gnu @@ -0,0 +1,50 @@ +# make.PENTIUM3gnu - GNU compilation tools definitions for PENTIUM3 +# +# modification history +# -------------------- +# 01m,21sep04,rec add -mno-sse -mno-sse2 +# 01l,10dec03,yvp Added ABI_SPEC. +# 01k,18nov03,sn updated flags for GCC 3.3.2 +# 01k,07nov03,c_c Removed Compiler definitions. +# 01j,24apr02,pai redefined HLL_PREFIX for GNU ELF support (SPR 73382). +# 01i,12feb02,sn removed obsolete refs to GCC_EXEC_PREFIX +# 01h,21jan02,sn removed unused C++_TEMPLATE_INST +# 01g,06nov01,tpw Add %.old rule to facilitate conversions to old OMFs +# 01f,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01e,27sep01,dat Location of defs.gnu changed to tool/gnu +# 01d,26sep01,max New specific options for Pentium-III +# 01c,21sep01,rhe Repair CC_ARCH_SPEC to work with current toolchain. +# 01b,17aug01,max adjustments for new pentium toolchain +# 01a,15aug01,hdn written based on 01g version of make.PENTIUMgnu +# +# DESCRIPTION +# This file contains PENTIUM3 specific definitions and flags for the GNU +# software generation tools (compiler, assembler, linker etc.). +#*/ + +CPU = PENTIUM3 +TOOL = gnu + +include $(TGT_DIR)/h/tool/gnu/defs.gnu + +CC_OPTIM_DRIVER = -fvolatile -nostdlib -fno-builtin -fno-defer-pop \ + -mno-sse -mno-sse2 +CC_OPTIM_NORMAL = -O2 -nostdlib -fno-builtin -fno-defer-pop \ + -mno-sse -mno-sse2 +CC_OPTIM_TARGET = -O2 -fvolatile -nostdlib -fno-builtin -fno-defer-pop \ + -mno-sse -mno-sse2 +# Generate code for (-mcpu=) and schedule for (-march=) pentium +CC_ARCH_SPEC = -mcpu=pentium3 -march=pentium3 + +TOOLENV = pentium +VX_CPU_FAMILY = pentium +ARCH_DIR = i86 +ABI_SPEC = x86 + +CF = + +HLL_PREFIX = + +OBJCOPY_OLD_OMF = -O a.out-i386 --gap-fill=0 + +# end of make.PENTIUM3gnu diff --git a/h/tool/gnu/make.PENTIUM4gnu b/h/tool/gnu/make.PENTIUM4gnu new file mode 100644 index 0000000..b8d944b --- /dev/null +++ b/h/tool/gnu/make.PENTIUM4gnu @@ -0,0 +1,49 @@ +# make.PENTIUM4gnu - GNU compilation tools definitions for PENTIUM4 +# +# modification history +# -------------------- +# 01k,28sep04,rec add -mno-sse -mno-sse2 +# 01j,10dec03,yvp Added ABI_SPEC. +# 01i,07nov03,c_c Removed Compiler definitions. +# 01i,18nov03,sn updated flags for GCC 3.3.2; use pentium4 specific +# flags, rather than pentium3 +# 01h,24apr02,pai redefined HLL_PREFIX for GNU ELF support (SPR 73382). +# 01g,12feb02,sn removed obsolete refs to GCC_EXEC_PREFIX +# 01f,21jan02,sn removed unused C++_TEMPLATE_INST +# 01e,06nov01,tpw Add %.old rule to facilitate conversions to old OMFs +# 01d,02nov01,hdn used PENTIUM3's options temporary +# 01c,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01b,25sep01,dat Location of defs.gnu changed to tool/gnu +# 01a,15aug01,hdn written based on 01g version of make.PENTIUMgnu +# +# DESCRIPTION +# This file contains PENTIUM4 specific definitions and flags for the GNU +# software generation tools (compiler, assembler, linker etc.). +#*/ + +CPU = PENTIUM4 +TOOL = gnu + +include $(TGT_DIR)/h/tool/gnu/defs.gnu + +CC_OPTIM_DRIVER = -fvolatile -nostdlib -fno-builtin -fno-defer-pop \ + -mno-sse -mno-sse2 +CC_OPTIM_NORMAL = -O2 -nostdlib -fno-builtin -fno-defer-pop \ + -mno-sse -mno-sse2 +CC_OPTIM_TARGET = -O2 -fvolatile -nostdlib -fno-builtin -fno-defer-pop \ + -mno-sse -mno-sse2 +# Generate code for (-mcpu=) and schedule for (-march=) pentium4 +CC_ARCH_SPEC = -mcpu=pentium4 -march=pentium4 + +TOOLENV = pentium +VX_CPU_FAMILY = pentium +ARCH_DIR = i86 +ABI_SPEC = x86 + +CF = + +HLL_PREFIX = + +OBJCOPY_OLD_OMF = -O a.out-i386 --gap-fill=0 + +# end of make.PENTIUM4gnu diff --git a/h/tool/gnu/make.PENTIUMgnu b/h/tool/gnu/make.PENTIUMgnu new file mode 100644 index 0000000..6d08f58 --- /dev/null +++ b/h/tool/gnu/make.PENTIUMgnu @@ -0,0 +1,49 @@ +# make.PENTIUMgnu - GNU compilation tools definitions for PENTIUM +# +# modification history +# -------------------- +# 01o,10dec03,yvp Added ABI_SPEC. +# 01n,07nov03,c_c Removed Compiler definitions. +# 01m,24apr02,pai redefined HLL_PREFIX for GNU ELF support (SPR 73382). +# 01l,12feb02,sn removed obsolete refs to GCC_EXEC_PREFIX +# 01k,21jan02,sn removed unused C++_TEMPLATE_INST +# 01j,06nov01,tpw Add %.old rule to facilitate conversions to old OMFs +# 01i,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01h,25sep01,dat Location of defs.gnu changed to tool/gnu +# 01g,10jan01,sn use pentium toolchain +# 01f,18oct00,sn update arch flags for new compiler: +# generate code for and schedule for pentium +# 01e,16oct00,sn added include gnu; removed LIBS defn +# 01d,05nov98,hdn added -fno-defer-pop to make it faster +# 01c,18sep98,sn Defined C++_TEMPLATE_INST +# 01b,04may98,hdn replaced -m486 with -mpentium +# 01a,17jul97,hdn written based on make.I80486gnu +# +# DESCRIPTION +# This file contains PENTIUM specific definitions and flags for the GNU +# software generation tools (compiler, assembler, linker etc.). +#*/ + +CPU = PENTIUM +TOOL = gnu + +include $(TGT_DIR)/h/tool/gnu/defs.gnu + +CC_OPTIM_DRIVER = -fvolatile -nostdlib -fno-builtin -fno-defer-pop +CC_OPTIM_NORMAL = -O2 -nostdlib -fno-builtin -fno-defer-pop +CC_OPTIM_TARGET = -O2 -fvolatile -nostdlib -fno-builtin -fno-defer-pop +# Generate code for (-mcpu=) and schedule for (-march=) pentium +CC_ARCH_SPEC = -mcpu=pentium -march=pentium + +TOOLENV = pentium +VX_CPU_FAMILY = pentium +ARCH_DIR = i86 +ABI_SPEC = x86 + +CF = + +HLL_PREFIX = + +OBJCOPY_OLD_OMF = -O a.out-i386 --gap-fill=0 + +# end of make.PENTIUMgnu diff --git a/h/tool/gnu/make.PPC32gnu b/h/tool/gnu/make.PPC32gnu new file mode 100644 index 0000000..d402012 --- /dev/null +++ b/h/tool/gnu/make.PPC32gnu @@ -0,0 +1,72 @@ +# make.PPC32gnu - GNU compilation tools definitions for generic PowerPC +# +# Copyright 1995-2004 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01j,28oct04,to removed -fno-zero-initialized-in-bss (now in defs.gnu) +# 01i,27may04,to 970 cleanups. +# 01h,19apr04,to Add -fno-zero-initialized-in-bss flag for gcc3.x (tmp?) +# 01g,14apr04,rec PPC970 support +# 01f,02jul04,pch SPR 98864: AltiVec support for gnu build of fioLib +# 01e,08jun04,pch set _WRS_HARDWARE_FP for hard-float 440 +# 01d,04feb04,pch PPC32 floating-point adjustments +# 01c,07nov03,c_c Removed Compiler definitions. +# 01b,05feb03,pch Add CPU_VARIANT support +# 01a,11dec02,pch Created (from make.PPC440gnu vn 01f). +# +# DESCRIPTION +# This file contains definitions and flags for the gnu tools +# (compiler, assembler, linker etc.) to build for a generic +# PowerPC with PPC60x hardware floating point. +# If building for a specific processor (as a variant), +# defs.ppc will set its type number into PPC32VARIANT. +#*/ + +CPU = PPC32 +TOOL = gnu + +include $(TGT_DIR)/h/tool/common/defs.ppc + +CC_OPTIM_DRIVER = -fno-builtin -fvolatile +CC_OPTIM_NORMAL = -O2 -fstrength-reduce -fno-builtin +CC_OPTIM_TARGET = -O2 -fvolatile -fno-builtin + +ifneq ($(PPC32VARIANT),) + ifneq ($(PPC32VARIANT),970) + CC_ARCH_SPEC = -mcpu=$(PPC32VARIANT) \ + -mhard-float -mstrict-align -mno-implicit-fp + else + CC_ARCH_SPEC = -mcpu=power4 -Wa,-mppc64bridge \ + -mhard-float -mstrict-align -mno-implicit-fp + OPTION_ALTIVEC_AS = -Wa,-maltivec + OPTION_ALTIVEC_C = -maltivec + endif + ifeq ($(PPC32VARIANT),440) + # inform ppc440.h that we are building for hardware FP + CC_ARCH_SPEC += -D_WRS_HARDWARE_FP + endif + ifeq ($(PPC32VARIANT),604) + OPTION_ALTIVEC_AS = -Wa,-maltivec + OPTION_ALTIVEC_C = -maltivec + endif +else + CC_ARCH_SPEC = -mhard-float -mstrict-align -mno-implicit-fp -DPPC32_fp60x + # *** TEMP HACK: enable AltiVec support for math/fioLib.c + # *** Remove this when the coprocessor abstraction + # *** supports printf/scanf format extensions. + OPTION_ALTIVEC_C = -maltivec -D_WRS_ALTIVEC_SUPPORT +endif + +LD_SCRIPT_RAM = -defsym wrs_kernel_rom_size=0x0$(ROM_SIZE) \ + -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.DOTBOOTRAM +LD_SCRIPT_ROM = -defsym wrs_kernel_rom_size=0x0$(ROM_SIZE) \ + -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.DOTBOOTROM + +CF = + +# No Cfront support for PowerPC +MAKETAIL = +CLEANTAIL = + +# end of make.PPC32gnu diff --git a/h/tool/gnu/make.PPC32sfgnu b/h/tool/gnu/make.PPC32sfgnu new file mode 100644 index 0000000..7ce6729 --- /dev/null +++ b/h/tool/gnu/make.PPC32sfgnu @@ -0,0 +1,48 @@ +# make.PPC32sfgnu - GNU compilation tools definitions for generic PowerPC +# +# Copyright 1995-2004 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01b,03mar04,mil Added support for PPC85XX. +# 01a,04feb04,pch Created (from make.PPC32gnu vn 01c). +# +# DESCRIPTION +# This file contains definitions and flags for the gnu tools +# (compiler, assembler, linker etc.) to build for a generic +# PowerPC without PPC60x hardware floating point. +# If building for a specific processor (as a variant), +# defs.ppc will set its type number into PPC32VARIANT. +#*/ + +CPU = PPC32 +TOOL = sfgnu + +include $(TGT_DIR)/h/tool/common/defs.ppc + +CC_OPTIM_DRIVER = -fno-builtin -fvolatile +CC_OPTIM_NORMAL = -O2 -fstrength-reduce -fno-builtin +CC_OPTIM_TARGET = -O2 -fvolatile -fno-builtin + +ifneq ($(PPC32VARIANT),) + ifeq ($(PPC32VARIANT),85XX) + CC_ARCH_SPEC = -mcpu=8540 -msoft-float -mstrict-align + else + CC_ARCH_SPEC = -mcpu=$(PPC32VARIANT) -msoft-float -mstrict-align + endif +else + CC_ARCH_SPEC = -msoft-float -mstrict-align +endif + +LD_SCRIPT_RAM = -defsym wrs_kernel_rom_size=0x0$(ROM_SIZE) \ + -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.DOTBOOTRAM +LD_SCRIPT_ROM = -defsym wrs_kernel_rom_size=0x0$(ROM_SIZE) \ + -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.DOTBOOTROM + +CF = + +# No Cfront support for PowerPC +MAKETAIL = +CLEANTAIL = + +# end of make.PPC32gnu diff --git a/h/tool/gnu/make.PPC403gnu b/h/tool/gnu/make.PPC403gnu new file mode 100644 index 0000000..84f96c7 --- /dev/null +++ b/h/tool/gnu/make.PPC403gnu @@ -0,0 +1,62 @@ +# make.PPC403gnu - GNU compilation tools definitions for PowerPC 403 +# +# Copyright 1995-2003 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01w,10dec03,sn added -msoft-float to allow the compiler to correctly find +# its own libraries (needed when we build target/src/tool) +# 01x,26nov03,c_c Use += instead of := for AS assignment. +# 01w,07nov03,c_c Removed Compiler definitions. +# 01v,31jan03,pch Add PPC32 support +# 01u,12feb02,sn removed obsolete refs to GCC_EXEC_PREFIX +# 01t,21jan02,sn removed unused C++_TEMPLATE_INST +# 01s,10dec01,tpw Ensure ROM_SIZE defaults to 0x0 if the macro is not set. +# 01r,05dec01,tpw Utilize DOTBOOT{RAM,ROM} linker scripts on all PPC4xx BSPs. +# 01q,16nov01,mil Changed VX_CPU_FAMILY from PPC to ppc. +# 01p,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01o,11oct01,dat SPR 20403, OPTIM_DRIVER must have -fvolatile +# 01n,25sep01,dat Location of defs.gnu changed to tool/gnu +# 01m,18oct00,sn removed -fno-for-scope +# 01l,16oct00,sn added include gnu; removed LIBS defn +# 01k,18jan99,sn Defined C++_TEMPLATE_INST +# 01j,27oct98,ms undid 01j +# 01i,02apr98,pcn Removed Objcopy changes from Tempest view +# 01h,15dec97,pcn Added Objcopy in BSP build. +# 01g,18sep97,ms added ARCH_DIR +# 01f,09dec96,tpr Removed GNU path in LIBS. +# 01e,04oct96,yp Added -B option so compiler driver doesn't need EXEC_PREFIX, +# added CC_ARCH_SPEC for machine specific flags +# 01d,16jul96,tpr removed EXTRA_DEFINE = -D_GNU_TOOL +# 01c,01apr96,tam added "-mstrict-align" flag, and definition for LIBS. +# 01b,06mar96,tam removed "-msdata" flag. +# 01a,31jan96,tam written from make.PPC603gnu 01b version. +# +# DESCRIPTION +# This file contains PowerPC 403 specific definitions and flags for the +# gnu tools (compiler, assembler, linker etc.) +#*/ + +CPU = PPC403 +TOOL = gnu + +include $(TGT_DIR)/h/tool/common/defs.ppc + +CC_OPTIM_DRIVER = -fno-builtin -fvolatile +CC_OPTIM_NORMAL = -O2 -fstrength-reduce -fno-builtin +CC_OPTIM_TARGET = -O2 -fvolatile -fno-builtin +CC_ARCH_SPEC = -mcpu=403 -mstrict-align -msoft-float + +LD_SCRIPT_RAM = -defsym wrs_kernel_rom_size=0x0$(ROM_SIZE) \ + -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.DOTBOOTRAM +LD_SCRIPT_ROM = -defsym wrs_kernel_rom_size=0x0$(ROM_SIZE) \ + -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.DOTBOOTROM + +AS += -m403 +CF = + +# No Cfront support for PowerPC +MAKETAIL = +CLEANTAIL = + +# end of make.PPC403gnu diff --git a/h/tool/gnu/make.PPC405gnu b/h/tool/gnu/make.PPC405gnu new file mode 100644 index 0000000..03afe79 --- /dev/null +++ b/h/tool/gnu/make.PPC405gnu @@ -0,0 +1,54 @@ +# make.PPC405gnu - GNU compilation tools definitions for PowerPC 405 +# +# Copyright 1995-2003 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01o,10aug04,kab SPR#100219: support for TOOL=sfdiab, sfgnu. +# 01n,10dec03,sn added -msoft-float to allow the compiler to correctly find +# its own libraries (needed when we build target/src/tool) +# 01o,26nov03,c_c Use += instead of := for AS assignment. +# 01n,07nov03,c_c Removed Compiler definitions. +# 01m,31jan03,pch Add PPC32 support +# 01l,12feb02,sn removed obsolete refs to GCC_EXEC_PREFIX +# removed -fno-for-scope +# 01k,21jan02,sn removed unused C++_TEMPLATE_INST +# 01j,10dec01,tpw Ensure ROM_SIZE defaults to 0x0 if the macro is not set. +# 01i,05dec01,tpw Utilize DOTBOOT{RAM,ROM} linker scripts on all PPC4xx BSPs. +# 01h,16nov01,mil Changed VX_CPU_FAMILY from PPC to ppc. +# 01g,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01f,11oct01,dat SPR 20403, OPTIM_DRIVER must have -fvolatile +# 01e,25sep01,dat Location of defs.gnu changed to tool/gnu +# 01d,22may01,pch Remove unneeded LIBS definition +# 01c,17nov00,jrs Change over to native 405 architecture. +# 01b,24oct00,s_m renaming cpu type +# 01a,22jun2k,alp Created from make.PPC403gnu. +# +# DESCRIPTION +# This file contains PowerPC 405 specific definitions and flags for the +# gnu tools (compiler, assembler, linker etc.) +#*/ + +CPU = PPC405 +TOOL = gnu + +include $(TGT_DIR)/h/tool/common/defs.ppc + +CC_OPTIM_DRIVER = -fno-builtin -fvolatile +CC_OPTIM_NORMAL = -O2 -fstrength-reduce -fno-builtin +CC_OPTIM_TARGET = -O2 -fvolatile -fno-builtin +CC_ARCH_SPEC = -mcpu=405 -mstrict-align -msoft-float + +LD_SCRIPT_RAM = -defsym wrs_kernel_rom_size=0x0$(ROM_SIZE) \ + -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.DOTBOOTRAM +LD_SCRIPT_ROM = -defsym wrs_kernel_rom_size=0x0$(ROM_SIZE) \ + -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.DOTBOOTROM + +AS += -m405 +CF = + +# No Cfront support for PowerPC +MAKETAIL = +CLEANTAIL = + +# end of make.PPC405gnu diff --git a/h/tool/gnu/make.PPC405sfgnu b/h/tool/gnu/make.PPC405sfgnu new file mode 100644 index 0000000..c7e3c1e --- /dev/null +++ b/h/tool/gnu/make.PPC405sfgnu @@ -0,0 +1,54 @@ +# make.PPC405sfgnu - GNU compilation tools definitions for PowerPC 405 +# +# Copyright 1995-2003 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01o,10aug04,kab SPR#100219: support for TOOL=sfdiab, sfgnu. +# 01n,10dec03,sn added -msoft-float to allow the compiler to correctly find +# its own libraries (needed when we build target/src/tool) +# 01o,26nov03,c_c Use += instead of := for AS assignment. +# 01n,07nov03,c_c Removed Compiler definitions. +# 01m,31jan03,pch Add PPC32 support +# 01l,12feb02,sn removed obsolete refs to GCC_EXEC_PREFIX +# removed -fno-for-scope +# 01k,21jan02,sn removed unused C++_TEMPLATE_INST +# 01j,10dec01,tpw Ensure ROM_SIZE defaults to 0x0 if the macro is not set. +# 01i,05dec01,tpw Utilize DOTBOOT{RAM,ROM} linker scripts on all PPC4xx BSPs. +# 01h,16nov01,mil Changed VX_CPU_FAMILY from PPC to ppc. +# 01g,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01f,11oct01,dat SPR 20403, OPTIM_DRIVER must have -fvolatile +# 01e,25sep01,dat Location of defs.gnu changed to tool/gnu +# 01d,22may01,pch Remove unneeded LIBS definition +# 01c,17nov00,jrs Change over to native 405 architecture. +# 01b,24oct00,s_m renaming cpu type +# 01a,22jun2k,alp Created from make.PPC403gnu. +# +# DESCRIPTION +# This file contains PowerPC 405 specific definitions and flags for the +# gnu tools (compiler, assembler, linker etc.) +#*/ + +CPU = PPC405 +TOOL = sfgnu + +include $(TGT_DIR)/h/tool/common/defs.ppc + +CC_OPTIM_DRIVER = -fno-builtin -fvolatile +CC_OPTIM_NORMAL = -O2 -fstrength-reduce -fno-builtin +CC_OPTIM_TARGET = -O2 -fvolatile -fno-builtin +CC_ARCH_SPEC = -mcpu=405 -mstrict-align -msoft-float + +LD_SCRIPT_RAM = -defsym wrs_kernel_rom_size=0x0$(ROM_SIZE) \ + -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.DOTBOOTRAM +LD_SCRIPT_ROM = -defsym wrs_kernel_rom_size=0x0$(ROM_SIZE) \ + -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.DOTBOOTROM + +AS += -m405 +CF = + +# No Cfront support for PowerPC +MAKETAIL = +CLEANTAIL = + +# end of make.PPC405sfgnu diff --git a/h/tool/gnu/make.PPC440gnu b/h/tool/gnu/make.PPC440gnu new file mode 100644 index 0000000..c0826ed --- /dev/null +++ b/h/tool/gnu/make.PPC440gnu @@ -0,0 +1,48 @@ +# make.PPC440gnu - GNU compilation tools definitions for PowerPC 440 +# +# Copyright 1995-2002 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01j,09aug04,kab SPR#100219: support for TOOL=sfdiab, sfgnu. +# 01h,10dec03,sn added -msoft-float to allow the compiler to correctly find +# its own libraries (needed when we build target/src/tool) +# 01i,26nov03,c_c Use += instead of := for AS assignment. +# 01h,07nov03,c_c Removed Compiler definitions. +# 01g,12dec02,pch Add PPC32 support +# 01f,12feb02,sn removed obsolete refs to GCC_EXEC_PREFIX +# remove -fno-for-scope +# 01e,21jan02,sn removed unused C++_TEMPLATE_INST +# 01d,10dec01,tpw Ensure ROM_SIZE defaults to 0x0 if the macro is not set. +# 01c,05dec01,tpw Utilize DOTBOOT{RAM,ROM} linker scripts on all PPC4xx BSPs. +# 01b,27nov01,pch merged in make.PPC405gnu vns 01e-01h +# 01a,13aug01,pch Created (from make.PPC405gnu vn 01d). +# +# DESCRIPTION +# This file contains PowerPC 440 specific definitions and flags for the +# gnu tools (compiler, assembler, linker etc.) +#*/ + +CPU = PPC440 +TOOL = gnu + +include $(TGT_DIR)/h/tool/common/defs.ppc + +CC_OPTIM_DRIVER = -fno-builtin -fvolatile +CC_OPTIM_NORMAL = -O2 -fstrength-reduce -fno-builtin +CC_OPTIM_TARGET = -O2 -fvolatile -fno-builtin +CC_ARCH_SPEC = -mcpu=440 -mstrict-align -msoft-float + +LD_SCRIPT_RAM = -defsym wrs_kernel_rom_size=0x0$(ROM_SIZE) \ + -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.DOTBOOTRAM +LD_SCRIPT_ROM = -defsym wrs_kernel_rom_size=0x0$(ROM_SIZE) \ + -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.DOTBOOTROM + +AS += -m440 +CF = + +# No Cfront support for PowerPC +MAKETAIL = +CLEANTAIL = + +# end of make.PPC440gnu diff --git a/h/tool/gnu/make.PPC440sfgnu b/h/tool/gnu/make.PPC440sfgnu new file mode 100644 index 0000000..cd584cb --- /dev/null +++ b/h/tool/gnu/make.PPC440sfgnu @@ -0,0 +1,48 @@ +# make.PPC440sfgnu - GNU compilation tools definitions for PowerPC 440 +# +# Copyright 1995-2002 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01j,09aug04,kab SPR#100219: support for TOOL=sfdiab, sfgnu. +# 01h,10dec03,sn added -msoft-float to allow the compiler to correctly find +# its own libraries (needed when we build target/src/tool) +# 01i,26nov03,c_c Use += instead of := for AS assignment. +# 01h,07nov03,c_c Removed Compiler definitions. +# 01g,12dec02,pch Add PPC32 support +# 01f,12feb02,sn removed obsolete refs to GCC_EXEC_PREFIX +# remove -fno-for-scope +# 01e,21jan02,sn removed unused C++_TEMPLATE_INST +# 01d,10dec01,tpw Ensure ROM_SIZE defaults to 0x0 if the macro is not set. +# 01c,05dec01,tpw Utilize DOTBOOT{RAM,ROM} linker scripts on all PPC4xx BSPs. +# 01b,27nov01,pch merged in make.PPC405gnu vns 01e-01h +# 01a,13aug01,pch Created (from make.PPC405gnu vn 01d). +# +# DESCRIPTION +# This file contains PowerPC 440 specific definitions and flags for the +# gnu tools (compiler, assembler, linker etc.) +#*/ + +CPU = PPC440 +TOOL = sfgnu + +include $(TGT_DIR)/h/tool/common/defs.ppc + +CC_OPTIM_DRIVER = -fno-builtin -fvolatile +CC_OPTIM_NORMAL = -O2 -fstrength-reduce -fno-builtin +CC_OPTIM_TARGET = -O2 -fvolatile -fno-builtin +CC_ARCH_SPEC = -mcpu=440 -mstrict-align -msoft-float + +LD_SCRIPT_RAM = -defsym wrs_kernel_rom_size=0x0$(ROM_SIZE) \ + -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.DOTBOOTRAM +LD_SCRIPT_ROM = -defsym wrs_kernel_rom_size=0x0$(ROM_SIZE) \ + -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.DOTBOOTROM + +AS += -m440 +CF = + +# No Cfront support for PowerPC +MAKETAIL = +CLEANTAIL = + +# end of make.PPC440sfgnu diff --git a/h/tool/gnu/make.PPC603gnu b/h/tool/gnu/make.PPC603gnu new file mode 100644 index 0000000..c3a34d0 --- /dev/null +++ b/h/tool/gnu/make.PPC603gnu @@ -0,0 +1,58 @@ +# make.PPC603gnu - GNU compilation tools definitions for PowerPC 603/604 +# +# Copyright 1995-2003 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01z,06feb04,pch add missing -mno-implicit-fp +# 01y,07nov03,c_c Removed Compiler definitions. +# 01x,31jan03,pch Add PPC32 support +# 01w,12feb02,sn removed obsolete refs to GCC_EXEC_PREFIX +# 01v,21jan02,sn removed unused C++_TEMPLATE_INST +# 01u,16nov01,mil Changed VX_CPU_FAMILY from PPC to ppc. +# 01t,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01s,11oct01,dat SPR 20403, OPTIM_DRIVER must have -fvolatile +# 01r,25sep01,dat Location of defs.gnu changed to tool/gnu +# 01q,18oct00,sn removed -fno-for-scope +# 01p,16oct00,sn added include gnu; removed LIBS defn +# 01o,09oct00,sn Added -mcpu=603 +# 01n,18jan99,sn Defined C++_TEMPLATE_INST +# 01m,27oct98,ms undid 01m +# 01l,02apr98,pcn Removed Objcopy changes from Tempest view +# 01k,15dec97,pcn Added Objcopy in BSP build. +# 01j,18sep97,ms added ARCH_DIR +# 01i,04oct96,yp Added -B option so compiler driver doesn't need EXEC_PREFIX, +# added CC_ARCH_SPEC for machine specific flags +# 01h,06aug96,tam added -mstrict-align flag. +# 01g,16jul96,tpr removed EXTRA_DEFINE +# 01f,04feb96,tpr removed -msdata flag. +# 01e,23feb96,yp added defs for ELF tools +# 01d,14feb96,tpr moved -msdata from EXTRA_DEFINE to CC_OPTIM_NORMAL. +# 01c,13feb96,tpr removed Cfront support for PowerPC. +# 01b,27jan96,tpr replaced gccppc by ccppc. +# 01a,29nov95,tpr written from make.PPC603diab 01d version. +# +# DESCRIPTION +# This file contains PowerPC 603/604 specific definitions and flags for the +# gnu tools (compiler, assembler, linker etc.) +#*/ + +CPU = PPC603 +TOOL = gnu + +include $(TGT_DIR)/h/tool/common/defs.ppc + +CC_OPTIM_DRIVER = -fno-builtin -fvolatile +CC_OPTIM_NORMAL = -O2 -fstrength-reduce -fno-builtin +CC_OPTIM_TARGET = -O2 -fvolatile -fno-builtin +CC_ARCH_SPEC = -mcpu=603 -mstrict-align -mno-implicit-fp + +#CC_SDA_FLAGS = -Xsmall-data=0 -Xsmall-const=0 + +CF = + +# No Cfront support for PowerPC +MAKETAIL = +CLEANTAIL = + +# end of make.PPC603gnu diff --git a/h/tool/gnu/make.PPC604gnu b/h/tool/gnu/make.PPC604gnu new file mode 100644 index 0000000..dc64d09 --- /dev/null +++ b/h/tool/gnu/make.PPC604gnu @@ -0,0 +1,63 @@ +# make.PPC604gnu - GNU compilation tools definitions for PowerPC 604 +# +# Copyright 1995-2003 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 02b,06feb04,pch add missing -mno-implicit-fp +# 02a,07nov03,c_c Removed Compiler definitions. +# 02a,05nov03,sn Updated definitions of OPTION_ALTIVEC_C/AS for gcc3 +# 01z,31jan03,pch Add PPC32 support +# 01y,12feb02,sn removed obsolete refs to GCC_EXEC_PREFIX +# 01x,21jan02,sn removed unused C++_TEMPLATE_INST +# 01w,16nov01,mil Changed VX_CPU_FAMILY from PPC to ppc. +# 01v,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01u,25oct01,jab added OPTION_ALTIVEC_C make variable +# 01t,23oct01,jab added OPTION_ALTIVEC_AS +# 01s,11oct01,dat SPR 20403, OPTIM_DRIVER must have -fvolatile +# 01r,20sep01,dat Moving to h/tool/gnu +# 01q,02apr01,kab Removing -fvec: too invasive for full build +# 01p,27mar01,pcs ADD -fvec option to pull in altivec awareness in the +# compiler in CC_ARCH_SPEC. +# 01o,18oct00,sn removed -fno-for-scope +# 01n,16oct00,sn added include gnu; removed LIBS defn +# 01m,09oct00,sn Added -mcpu=604 +# 01l,18jan99,sn Defined C++_TEMPLATE_INST +# 01k,27oct98,ms undid 01k +# 01j,02apr98,pcn Removed Objcopy changes from Tempest view +# 01i,15dec97,pcn Added Objcopy in BSP build. +# 01h,18sep97,ms added ARCH_DIR +# 01g,04oct96,yp Added -B option so compiler driver doesn't need EXEC_PREFIX, +# added CC_ARCH_SPEC for machine specific flags +# 01f,06aug96,tam added -mstrict-align flag. +# 01e,16jul96,tpr removed EXTRA_DEFINE = -D_GNU_TOOL. +# 01d,04mar96,tpr removed -msdata flag. +# 01c,23feb96,yp added defs for ELF tools +# 01b,14feb96,tpr moved -msdata from EXTRA_DEFINE to CC_OPTIM_NORMAL. +# 01a,12feb96,tpr written from make.PPC603gnu 01c version. +# +# DESCRIPTION +# This file contains PowerPC 604 specific definitions and flags for the +# gnu tools (compiler, assembler, linker etc.) +#*/ + +CPU = PPC604 +TOOL = gnu + +include $(TGT_DIR)/h/tool/common/defs.ppc + +CC_OPTIM_DRIVER = -fno-builtin -fvolatile +CC_OPTIM_NORMAL = -O2 -fstrength-reduce -fno-builtin +CC_OPTIM_TARGET = -O2 -fvolatile -fno-builtin +CC_ARCH_SPEC = -mcpu=604 -mstrict-align -mno-implicit-fp + +OPTION_ALTIVEC_AS = -Wa,-maltivec +OPTION_ALTIVEC_C = -maltivec + +CF = + +# No Cfront support for PowerPC +MAKETAIL = +CLEANTAIL = + +# end of make.PPC604gnu diff --git a/h/tool/gnu/make.PPC85XXgnu b/h/tool/gnu/make.PPC85XXgnu new file mode 100644 index 0000000..3a782ee --- /dev/null +++ b/h/tool/gnu/make.PPC85XXgnu @@ -0,0 +1,67 @@ +# make.PPC85XXgnu - GNU compilation tools definitions for PowerPC e500 Core +# +# Copyright 1995-2001 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 02c,04nov04,dtr SPR 103587 - set soft float flag for backward compatibility +# only. +# 02b,09aug04,kab SPR#100219: support for TOOL=sfdiab, sfgnu. +# 02a,27aug03,xav Change NM value to avoid failure on win32 host and SIZE +# value to avoid warnings during the project creation. +# 01z,08aug03,xav Change the CC compiler value to ccppc +# 01y,01aug03,xav Set compilers values to specific e500 gnu 3.3 values +# 01x,03jun03,dtr Changing cpu type to 8540. +# 01w,12feb02,sn removed obsolete refs to GCC_EXEC_PREFIX +# 01v,21jan02,sn removed unused C++_TEMPLATE_INST +# 01u,16nov01,mil Changed VX_CPU_FAMILY from PPC to ppc. +# 01t,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01s,11oct01,dat SPR 20403, OPTIM_DRIVER must have -fvolatile +# 01r,25sep01,dat Location of defs.gnu changed to tool/gnu +# 01q,18oct00,sn removed -fno-for-scope +# 01p,16oct00,sn added include gnu; removed LIBS defn +# 01o,09oct00,sn Added -mcpu=603 +# 01n,18jan99,sn Defined C++_TEMPLATE_INST +# 01m,27oct98,ms undid 01m +# 01l,02apr98,pcn Removed Objcopy changes from Tempest view +# 01k,15dec97,pcn Added Objcopy in BSP build. +# 01j,18sep97,ms added ARCH_DIR +# 01i,04oct96,yp Added -B option so compiler driver doesn't need EXEC_PREFIX, +# added CC_ARCH_SPEC for machine specific flags +# 01h,06aug96,tam added -mstrict-align flag. +# 01g,16jul96,tpr removed EXTRA_DEFINE +# 01f,04feb96,tpr removed -msdata flag. +# 01e,23feb96,yp added defs for ELF tools +# 01d,14feb96,tpr moved -msdata from EXTRA_DEFINE to CC_OPTIM_NORMAL. +# 01c,13feb96,tpr removed Cfront support for PowerPC. +# 01b,27jan96,tpr replaced gccppc by ccppc. +# 01a,29nov95,tpr written from make.PPC603diab 01d version. +# +# DESCRIPTION +# This file contains PowerPC e500 core specific definitions and flags for the +# gnu tools (compiler, assembler, linker etc.) +#*/ + +include $(TGT_DIR)/h/tool/gnu/defs.gnu +CPU = PPC85XX +TOOL = gnu + +include $(TGT_DIR)/h/tool/common/defs.ppc + +CC_OPTIM_DRIVER = -fno-builtin -fvolatile +CC_OPTIM_NORMAL = -O2 -fstrength-reduce -fno-builtin +CC_OPTIM_TARGET = -O2 -fvolatile -fno-builtin +CC_ARCH_SPEC = -mcpu=8540 -mstrict-align -msoft-float -mabi=no-spe + +LD_SCRIPT_RAM = -defsym wrs_kernel_rom_size=0x0$(ROM_SIZE) \ + -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.DOTBOOTRAM +LD_SCRIPT_ROM = -defsym wrs_kernel_rom_size=0x0$(ROM_SIZE) \ + -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.DOTBOOTROM + +CF = + +# No Cfront support for PowerPC +MAKETAIL = +CLEANTAIL = + +# end of make.PPC85XXgnu diff --git a/h/tool/gnu/make.PPC85XXsfgnu b/h/tool/gnu/make.PPC85XXsfgnu new file mode 100644 index 0000000..2fc6300 --- /dev/null +++ b/h/tool/gnu/make.PPC85XXsfgnu @@ -0,0 +1,66 @@ +# make.PPC85XXsfgnu - GNU compilation tools definitions for PowerPC e500 Core +# +# Copyright 1995-2001 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 02c,03nov04,dtr SPR#103587:Ensure no hw float or SPE instructions produced. +# 02b,09aug04,kab SPR#100219: support for TOOL=sfdiab, sfgnu. +# 02a,27aug03,xav Change NM value to avoid failure on win32 host and SIZE +# value to avoid warnings during the project creation. +# 01z,08aug03,xav Change the CC compiler value to ccppc +# 01y,01aug03,xav Set compilers values to specific e500 gnu 3.3 values +# 01x,03jun03,dtr Changing cpu type to 8540. +# 01w,12feb02,sn removed obsolete refs to GCC_EXEC_PREFIX +# 01v,21jan02,sn removed unused C++_TEMPLATE_INST +# 01u,16nov01,mil Changed VX_CPU_FAMILY from PPC to ppc. +# 01t,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01s,11oct01,dat SPR 20403, OPTIM_DRIVER must have -fvolatile +# 01r,25sep01,dat Location of defs.gnu changed to tool/gnu +# 01q,18oct00,sn removed -fno-for-scope +# 01p,16oct00,sn added include gnu; removed LIBS defn +# 01o,09oct00,sn Added -mcpu=603 +# 01n,18jan99,sn Defined C++_TEMPLATE_INST +# 01m,27oct98,ms undid 01m +# 01l,02apr98,pcn Removed Objcopy changes from Tempest view +# 01k,15dec97,pcn Added Objcopy in BSP build. +# 01j,18sep97,ms added ARCH_DIR +# 01i,04oct96,yp Added -B option so compiler driver doesn't need EXEC_PREFIX, +# added CC_ARCH_SPEC for machine specific flags +# 01h,06aug96,tam added -mstrict-align flag. +# 01g,16jul96,tpr removed EXTRA_DEFINE +# 01f,04feb96,tpr removed -msdata flag. +# 01e,23feb96,yp added defs for ELF tools +# 01d,14feb96,tpr moved -msdata from EXTRA_DEFINE to CC_OPTIM_NORMAL. +# 01c,13feb96,tpr removed Cfront support for PowerPC. +# 01b,27jan96,tpr replaced gccppc by ccppc. +# 01a,29nov95,tpr written from make.PPC603diab 01d version. +# +# DESCRIPTION +# This file contains PowerPC e500 core specific definitions and flags for the +# gnu tools (compiler, assembler, linker etc.) +#*/ + +include $(TGT_DIR)/h/tool/gnu/defs.gnu +CPU = PPC85XX +TOOL = sfgnu + +include $(TGT_DIR)/h/tool/common/defs.ppc + +CC_OPTIM_DRIVER = -fno-builtin -fvolatile +CC_OPTIM_NORMAL = -O2 -fstrength-reduce -fno-builtin +CC_OPTIM_TARGET = -O2 -fvolatile -fno-builtin +CC_ARCH_SPEC = -mcpu=8540 -mstrict-align -msoft-float -mabi=no-spe + +LD_SCRIPT_RAM = -defsym wrs_kernel_rom_size=0x0$(ROM_SIZE) \ + -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.DOTBOOTRAM +LD_SCRIPT_ROM = -defsym wrs_kernel_rom_size=0x0$(ROM_SIZE) \ + -T $(TGT_DIR)/h/tool/gnu/ldscripts/link.DOTBOOTROM + +CF = + +# No Cfront support for PowerPC +MAKETAIL = +CLEANTAIL = + +# end of make.PPC85XXsfgnu diff --git a/h/tool/gnu/make.PPC860sfgnu b/h/tool/gnu/make.PPC860sfgnu new file mode 100644 index 0000000..722597a --- /dev/null +++ b/h/tool/gnu/make.PPC860sfgnu @@ -0,0 +1,37 @@ +# make.PPC860sfgnu - GNU compilation tools definitions for PowerPC 860 +# +# Copyright (c) 2005 Wind River Systems, Inc. The right to copy, +# distribute, modify, or otherwise make use of this software may +# be licensed only pursuant to the terms of an applicable Wind River +# license agreement. +# +# modification history +# -------------------- +# 01b,21jun05,cjj added missing # in mod history +# 01a,20jun05,cjj written based on make.PPC860gnu version 01y. +# changed TOOL definition from gnu to sfgnu. +# +# DESCRIPTION +# This file contains PowerPC 860 specific definitions and flags for the +# gnu tools (compiler, assembler, linker etc.) +#*/ + +CPU = PPC860 +TOOL = sfgnu + +include $(TGT_DIR)/h/tool/common/defs.ppc + +CC_OPTIM_DRIVER = -fno-builtin -fvolatile +CC_OPTIM_NORMAL = -O2 -fstrength-reduce -fno-builtin +CC_OPTIM_TARGET = -O2 -fvolatile -fno-builtin +CC_ARCH_SPEC = -mcpu=860 -mstrict-align -msoft-float + +CF = + +# No Cfront support for PowerPC +MAKETAIL = +CLEANTAIL = + +GNULIBROOT = $(WIND_BASE)/host/$(WIND_HOST_TYPE)/lib/gcc-lib/ + +# end of make.PPC860sfgnu diff --git a/h/tool/gnu/make.SH7750gnu b/h/tool/gnu/make.SH7750gnu new file mode 100644 index 0000000..3a1bf40 --- /dev/null +++ b/h/tool/gnu/make.SH7750gnu @@ -0,0 +1,59 @@ +# make.SH7750gnu - GNU compilation tools definitions for Hitachi SH7750 (SH4) +# +# Copyright 1996-2003 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01u,10dec03,yvp Added ABI_SPEC. +# 01t,07nov03,c_c Removed Compiler definitions. +# 01s,21jan02,sn removed unused C++_TEMPLATE_INST +# 01r,09nov01,zl removed GNULIBROOT, GCC_EXEC_PREFIX, -fno-for-scope and +# -fno-weak options. +# 01q,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01p,11oct01,dat SPR 20403, OPTIM_DRIVER must have -fvolatile +# 01o,25sep01,dat Location of defs.gnu changed to tool/gnu +# 01n,31jul01,sn Removed LIBS defn (libgcc.a linked against automatically) +# 01m,18jul00,rsh add support for c++ template instantiation a'la Salim's direction. +# 01l,14jun00,hk changed EXTRACT_BIN_NAME definition (it was elfToBin -r 4) +# 01k,12may00,zl removed LD_PARTIAL workaround (conflict with project builds) +# 01j,28apr00,zl Don't use ccsh to link on Windows because search path +# notation (LD_PARTIAL) +# 01i,20apr00,max Replacing SH7750gnu by m4 +# 01h,17apr00,zl removed BSP-local linker scripts; changed -N to -n. +# 01g,07mar00,zl updated for gcc-2.96 +# 01f,15sep99,zl use -r option for elfToBin +# 01e,12aug99,zl added libgcc to LIBS +# 01d,04jun99,zl hitachi SH4 architecture port, provided by Highlander +# Engineering. Now using new toolchain with ELF. +# 01c,08feb99,hk Keep frame pointer for stack trace afer GDB attach. +# Get rid of -S in LDFLAGS so debugging info will be retained +# when a BSP is built with -g. (sync w/make.SH7729gnu 01f jmb) +# 01b,12sep98,hk fixed typo. +# 01a,09may96,st derived from make.SH7700gnu-01e. +# +# DESCRIPTION +# This file contains SH7750 (SH4) specific definitions and flags for the GNU +# software generation tools (compiler, assembler, linker etc.). +#*/ + +CPU = SH7750 +TOOL = gnu + +include $(TGT_DIR)/h/tool/gnu/defs.gnu + +CC_OPTIM_DRIVER = -O2 -fno-builtin -fvolatile +CC_OPTIM_NORMAL = -O2 -fno-builtin +CC_OPTIM_TARGET = -O2 -fno-builtin -fvolatile +CC_SOFT_FLOAT = +CC_ARCH_SPEC = -m4 + +TOOLENV = sh +VX_CPU_FAMILY = sh +ARCH_DIR = sh +ABI_SPEC = sh4 + +LDFLAGS = -X -n + + + +# end of make.SH7750gnu diff --git a/h/tool/gnu/make.SH7750gnule b/h/tool/gnu/make.SH7750gnule new file mode 100644 index 0000000..86c1558 --- /dev/null +++ b/h/tool/gnu/make.SH7750gnule @@ -0,0 +1,57 @@ +# make.SH7750gnule - GNU little endian tools defs for Hitachi SH7750 (SH4) +# +# Copyright 1999-2004 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 01t,07may04,h_k changed -mshlelf which is workaround in GNU 2.9 or earlier +# to -EL. (SPR #97043) +# 01s,10dec03,yvp Added ABI_SPEC. +# 01r,26nov03,c_c Use += instead of := for AS assignment. +# 01q,07nov03,c_c Removed Compiler definitions. +# 01p,07may02,sn SPR 76627 - moved -mshlelf into LDFLAGS, LD_PARTIAL_FLAGS +# 01o,21jan02,sn removed unused C++_TEMPLATE_INST +# 01n,09nov01,zl removed GNULIBROOT, -fno-for-scope, LD_PARTIAL, -fno-weak. +# 01m,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01l,11oct01,dat SPR 20403, OPTIM_DRIVER must have -fvolatile +# 01k,25sep01,dat Location of defs.gnu changed to tool/gnu +# 01j,31jul01,sn Removed LIBS defn (libgcc.a linked against automatically) +# 01i,22jan01,zl redefine LD_PARTIAL to include -ml. +# 01h,21dec00,zl moved -ml option to CC. +# 01g,14aug00,rsh add support for c++ template instantiation a'la Salim's +# direction +# 01f,16jun00,hk Changed EXTRACT_BIN_NAME definition (it was elfToBin -r 4) +# 01e,11may00,zl Added LD_PARTIAL_FLAGS +# 01d,24apr00,zl changed libgcc location +# 01c,17apr00,zl corrected little endian library location; +# removed BSP-local linker scripts; changed -N to -n. +# 01b,07mar00,zl updated for gcc-2.96 +# 01a,09may99,zl derived from make.SH7750gnu-01f. +# +# DESCRIPTION +# This file contains SH7750 (SH4) specific definitions and flags for the GNU +# software generation tools (compiler, assembler, linker etc.). +#*/ + +CPU = SH7750 +TOOL = gnule + +include $(TGT_DIR)/h/tool/gnu/defs.gnu + +CC_OPTIM_DRIVER = -O2 -fno-builtin -fvolatile +CC_OPTIM_NORMAL = -O2 -fno-builtin +CC_OPTIM_TARGET = -O2 -fno-builtin -fvolatile +CC_SOFT_FLOAT = +CC_ARCH_SPEC = -m4 -ml + +TOOLENV = sh +VX_CPU_FAMILY = sh +ARCH_DIR = sh +ABI_SPEC = sh4 + +AS += -little + +LDFLAGS = -X -n -EL +LD_PARTIAL_FLAGS = -X -r -EL + +# end of make.SH7750gnule diff --git a/h/tool/gnu/make.SIMLINUXgnu b/h/tool/gnu/make.SIMLINUXgnu new file mode 100644 index 0000000..87ba42d --- /dev/null +++ b/h/tool/gnu/make.SIMLINUXgnu @@ -0,0 +1,33 @@ +# make.SIMLINUXgnu - GNU compilation tools definitions for Linux VxSim +# +# modification history +# -------------------- +# 01c,10dec03,yvp Added ABI_SPEC. +# 01b,07nov03,c_c Removed Compiler definitions. +# 01a,17apr03,dbt written from make.SIMNTgnu +# +# DESCRIPTION +# This file contains Linux VxSim specific definitions and flags for the GNU +# software generation tools (compiler, assembler, linker etc.). +#*/ + +CPU = SIMLINUX +TOOL = gnu + +include $(TGT_DIR)/h/tool/gnu/defs.gnu + +CC_OPTIM_DRIVER = -fvolatile -nostdlib -fno-builtin -fno-defer-pop +CC_OPTIM_NORMAL = -O2 -nostdlib -fno-builtin -fno-defer-pop +CC_OPTIM_TARGET = -O2 -fvolatile -nostdlib -fno-builtin -fno-defer-pop + +# Generate code for (-mcpu=) and schedule for (-march=) i486 +CC_ARCH_SPEC = -mcpu=i486 -march=i486 + +TOOLENV = pentium +VX_CPU_FAMILY = simlinux +ARCH_DIR = simlinux +ABI_SPEC = x86 + +CF = + +# end of make.SIMNTgnu diff --git a/h/tool/gnu/make.SIMNTgnu b/h/tool/gnu/make.SIMNTgnu new file mode 100644 index 0000000..0735a90 --- /dev/null +++ b/h/tool/gnu/make.SIMNTgnu @@ -0,0 +1,57 @@ +# make.SIMNTgnu - GNU compilation tools definitions for NTSIM +# +# modification history +# -------------------- +# 01x,10dec03,yvp Added ABI_SPEC. +# 01w,07nov03,c_c Removed Compiler definitions. +# 01v,31mar03,jmp removed MACH_DEP redefinition, there is now a sysALib.s on +# SIMNT. +# 01u,18feb03,jmp modified to use pentium toolchain on SIMNT. +# 01t,12feb02,sn removed obsolete refs to GCC_EXEC_PREFIX +# 01s,05feb02,tpw Fix SPR 72107, PECOFF stabs not being relocated within GDB. +# 01r,21jan02,sn removed unused C++_TEMPLATE_INST +# 01q,28nov01,tpw Fix SPRs 30726 and 70932, stray sections causing trouble. +# 01p,20nov01,jmp changed VX_CPU_FAMILY to simpc instead of SIMNT. +# 01o,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01n,25sep01,dat Location of defs.gnu changed to tool/gnu +# 01m,10apr01,sn Remove --force-stabs-reloc hack +# 01l,21mar01,mrs Fix up flags. +# 01k,16oct00,sn added include gnu; removed LIBS defn +# 01j,31mar99,tdl Added $(LD_PARTIAL_LAST_FLAGS) +# 01i,17dec98,sn Added def'n of C++_TEMPLATE_INST +# 01h,07jul98,cym removed sysAlib.o from MACH_DEP +# added --subsystem=windows to LD_FLAGS. +# 01g,29jun98,cym removed .exe extension from executables. +# 01f,16jun98,sn fixed def'n of TOOLENV +# ensure that WIN32 and WINNT macros are *not* defined +# 01e,29apr98,cym added .exe extension to executables +# 01d,13mar98,jmb fix vxWorks.st build +# 01c,13mar98,jmb fix bsp link +# 01b,05mar98,jmb cleaned up (partial) +# 01a,19jan98,jmb cribbed from make.I80386gnu +# +# DESCRIPTION +# This file contains SIMNT specific definitions and flags for the GNU +# software generation tools (compiler, assembler, linker etc.). +#*/ + +CPU = SIMNT +TOOL = gnu + +include $(TGT_DIR)/h/tool/gnu/defs.gnu + +CC_OPTIM_DRIVER = -fvolatile -nostdlib -fno-builtin -fno-defer-pop +CC_OPTIM_NORMAL = -O2 -nostdlib -fno-builtin -fno-defer-pop +CC_OPTIM_TARGET = -O2 -fvolatile -nostdlib -fno-builtin -fno-defer-pop + +# Generate code for (-mcpu=) and schedule for (-march=) i486 +CC_ARCH_SPEC = -mcpu=i486 -march=i486 + +TOOLENV = pentium +VX_CPU_FAMILY = simpc +ARCH_DIR = simnt +ABI_SPEC = x86 + +CF = + +# end of make.SIMNTgnu diff --git a/h/tool/gnu/make.SIMSPARCSOLARISgnu b/h/tool/gnu/make.SIMSPARCSOLARISgnu new file mode 100644 index 0000000..2c23dd3 --- /dev/null +++ b/h/tool/gnu/make.SIMSPARCSOLARISgnu @@ -0,0 +1,64 @@ +# make.SIMSPARCSOLARISgnu - GNU compilation tools definitions for SIMSPARCSUNOS +# +# Copyright 1993-2003 Wind River Systems, Inc. +# +# modification history +# -------------------- +# 02q,15dec03,dbt Updated to use sparc compiler. +# 02p,10dec03,yvp Added ABI_SPEC. +# 02o,07nov03,c_c Removed Compiler definitions. +# 02n,25mar03,jeg restored TOOLENV to simso +# 02m,19feb03,jeg update tool chain from ccsimso to ccsparc +# 02l,08may02,sn SPR 76627 - moved LD definitions here from BSP Makefile +# 02k,06may02,sn SPR 75835 - no special linker script needed for simulator +# relocatable links +# 02j,12feb02,sn removed obsolete refs to GCC_EXEC_PREFIX +# 02i,30oct01,tpw Standardize kernel links and bootrom conversions. +# 02h,11oct01,dat SPR 20403, OPTIM_DRIVER must have -fvolatile +# 02g,25sep01,dat Location of defs.gnu changed to tool/gnu +# 02f,16oct00,sn added include gnu; removed LIBS defn +# 02e,02apr98,pcn Removed Objcopy changes from Tempest view +# 02d,15dec97,pcn Added Objcopy in BSP build. +# 02c,18sep97,ms added ARCH_DIR +# 02b,04oct96,yp Added -B option so compiler driver doesn't need EXEC_PREFIX +# 02b,01oct96,dvs added MAKETAIL and CLEANTAIL +# +yp +# 02a,19dec95,ism Changed to SIMSPARCSOLARIS +# 01g,10nov95,jeh added NM rule. +# 01f,24oct95,dat removed unnecessary .s.o rule +# 01e,19jun95,srh made C++ compiler name specific to cfront. +# 01d,18jun95,srh added more C++ support. +# 01c,21may95,srh added C++ support. +# 01b,23aug93,rrr changed to use ccsparc +# 01a,22jun93,rrr derived from make.SPARCgnu. +# +# DESCRIPTION +# This file contains macros and flags to build the a.out version for +# the simsparcsunos processor. +#*/ + +CPU = SIMSPARCSOLARIS +TOOL = gnu + +include $(TGT_DIR)/h/tool/gnu/defs.gnu + +LD_COLLAPSE_SECTIONS = + +CPU = SIMSPARCSOLARIS +TOOL = gnu + +MAKETAIL = +CLEANTAIL = + +CC_OPTIM_DRIVER = -fno-builtin -fvolatile +CC_OPTIM_NORMAL = -O2 -fstrength-reduce -fno-builtin +CC_OPTIM_TARGET = -O2 -fvolatile -fno-builtin + +TOOLENV = sparc +VX_CPU_FAMILY = simso +ARCH_DIR = simsolaris +ABI_SPEC = sparc + +CF = + +# end of make.SIMSPARCSOLARISgnu diff --git a/h/tool/gnu/make.XSCALEgnu b/h/tool/gnu/make.XSCALEgnu new file mode 100644 index 0000000..925ebea --- /dev/null +++ b/h/tool/gnu/make.XSCALEgnu @@ -0,0 +1,34 @@ +# make.XSCALEgnu - GNU compilation tools definitions for Intel XScale +# +# modification history +# -------------------- +# 01i,05dec03,sn updated flags for gcc 3.3.2 +# 01h,10jan02,to move 'include defs.arm' after CPU and TOOL defines for +# libgcc build +# 01g,18dec01,to move common definitions to defs.arm +# 01f,16nov01,t_m Change sysInit entry +# 01e,30oct01,tpw Standardize kernel links and bootrom conversions. +# 01d,19oct01,jb include of defs.gnu is out of sequence - fixed +# 01c,25sep01,dat Location of defs.gnu changed to tool/gnu +# 01b,05jun01,mem Remove HEX_FLAGS +# 01a,05apr01,t_m add -fno-for-scope +# 01a,22jan01,??? fix sarm to arm +# 01b,09jan01,??? modify -mcpu for xscale... +# 01a,26oct00,jb Removing the OS and OPT references +# 01b,24oct00,scm modify compiler naming convention... +# 01a,31aug00,scm based on make.ARMSA110gnu +# +# DESCRIPTION +# This file contains Intel XScale little-endian-specific definitions +# and flags for the GNU software generation tools (compiler, assembler, +# linker etc.). +#*/ + +CPU = XSCALE +TOOL = gnu + +include $(TGT_DIR)/h/tool/gnu/defs.arm + +CC_ARCH_SPEC = -txscale + +# end of make.XSCALEgnu diff --git a/h/tool/gnu/make.XSCALEgnube b/h/tool/gnu/make.XSCALEgnube new file mode 100644 index 0000000..23a2941 --- /dev/null +++ b/h/tool/gnu/make.XSCALEgnube @@ -0,0 +1,22 @@ +# make.XSCALEgnube - GNU compilation tools definitions for Intel XScale +# +# modification history +# -------------------- +# 01c,17dec03,mcm Workaround for SPR 92687 +# 01b,05dec03,sn updated flags for gcc 3.3.2 +# 01a,10jan02,to created from make.XSCALEgnu +# +# DESCRIPTION +# This file contains Intel XScale big-endian-specific definitions +# and flags for the GNU software generation tools (compiler, assembler, +# linker etc.). +#*/ + +CPU = XSCALE +TOOL = gnube + +include $(TGT_DIR)/h/tool/gnu/defs.arm + +CC_ARCH_SPEC = -txscalebe -Wa,-EB + +# end of make.XSCALEgnube diff --git a/h/tool/gnu/toolMacros.h b/h/tool/gnu/toolMacros.h new file mode 100644 index 0000000..aacfead --- /dev/null +++ b/h/tool/gnu/toolMacros.h @@ -0,0 +1,176 @@ +/* toolMacros.h - compile time macros for GNU C compiler */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +01n,09sep05,jln added _WRS_ABSOLUTE_EXTERN +01m,08aug05,wap Add section relocation macros +01l,02oct04,mcm Fixing definition of _WRS_ABSOLUTE_ for Pentium. +01k,25aug04,h_k updated _WRS_ABSOLUTE for the arches which require + specific semantics, such as arm and sh. (SPR #100726) +01j,30jul04,mcm Undefining WRS_GNU_VAR_MACROS since GCC 3.3.2 supports the + ANSI syntax +01i,17mar04,dat remove leading underscore from _absSymbols_xxx (95052) +01h,05mar04,dat fix abs symbols +01g,05feb04,dat add macros for _WRS_ABSOLUTE +01f,26nov03,dat Adding INLINE and DEPRECATED +01e,16oct03,dat New macros for INLINE both C and ASM +01d,23sep03,zl added _WRS_CONSTRUCTOR definition +01c,26nov01,dat New macros for alignment checking and unaligned copies +01b,14nov01,dat Adding underscores to macro names +01a,18apr01,dat written +*/ + +#ifndef __INCtoolMacrosh +#define __INCtoolMacrosh + +#define _WRS_PACK_ALIGN(x) __attribute__((packed, aligned(x))) + +#define _WRS_ASM(x) __asm__ volatile (x) + +#define _WRS_DATA_ALIGN_BYTES(x) __attribute__((aligned(x))) + +#undef _WRS_GNU_VAR_MACROS /* GCC 3.3.2 supports the ANSI syntax */ + +/* Macros for alignment issues */ + +#define _WRS_ALIGNOF(x) __alignof__(x) + +#define _WRS_ALIGN_CHECK(ptr, type) \ + (((int)(ptr) & ( _WRS_ALIGNOF(type) - 1)) == 0 ? TRUE : FALSE) + +#define _WRS_UNALIGNED_COPY(pSrc, pDest, size) \ + ( __builtin_memcpy ((pDest), (void *)(pSrc), size)) + +/* + * Macros to force code or data into specific sections. These + * can be used to force the compiler to place a given piece of + * code or data into a separate section. The idea is to improve + * cache usage by either clustering frequently referenced code + * close together, or moving infrequenly used code (i.e. "run-once" + * init routines that are only used during bootstrap) out of the + * way. The "init" sections are used for the latter case, while + * the "fast" sections are used to group performance-critical + * routines together. + */ + +#ifndef _WRS_NO_SPECIAL_SECTIONS +#define _WRS_INITTEXT __attribute__ ((__section__ (".text.init"))) +#define _WRS_FASTTEXT __attribute__ ((__section__ (".text.fast"))) +#define _WRS_INITDATA __attribute__ ((__section__ (".data.init"))) +#define _WRS_FASTDATA __attribute__ ((__section__ (".data.fast"))) +#else +#define _WRS_INITTEXT +#define _WRS_FASTTEXT +#define _WRS_INITDATA +#define _WRS_FASTDATA +#endif + +/* + * macro for static initializer (constructor) definitions; assumes + * GCC 3.3 or later with C constructor support. + */ + +#define _WRS_CONSTRUCTOR(rtn,lvl) \ + __attribute__((constructor(lvl))) void _STI__##lvl##__##rtn (void) + +/* + * New Basix macros, (Portable Coding Guide, v7) + * + * HAS_GCC_ASM_SYNTAX if Gnu inline assembly syntax is supported. + * HAS_DCC_ASM_SYNTAX if Diab inline assembly function syntax is supported. + * INLINE for static inline C functions, + * DEPRECATED for obsolete API warnings. + */ + + +#define _WRS_HAS_GCC_ASM_SYNTAX +#undef _WRS_HAS_DCC_ASM_SYNTAX +#define _WRS_INLINE static __inline__ +#define _WRS_DEPRECATED(x) __attribute__((deprecated)) + +#ifndef LEADING_UNDERSCORE +#define LEADING_UNDERSCORE FALSE /* defualt in B6 except SH arch */ +#endif /* LEADING_UNDERSCORE */ + +#if (LEADING_UNDERSCORE == TRUE) +#define _WRS_ABSOLUTE(name,value) _WRS_ABSOLUTE_(_##name,value) +#else /* LEADING_UNDERSCORE == FALSE */ +#define _WRS_ABSOLUTE(name,value) _WRS_ABSOLUTE_(name,value) +#endif /* LEADING_UNDERSCORE == TRUE */ + +/* (New V7) For absolute symbol support. (use with semicolon) */ + +#if (CPU_FAMILY == ARM) || (CPU_FAMILY == ARM_THUMB) +/* + * GNU/ARM backend does not have a proper operand modifier which does not + * produces prefix # followed by value, such as %0 for PPC, PENTIUM, MIPS + * and %O0 for SH. The workaround made here is using %B0 which converts + * the value to ~(value). Thus "n"(~(value)) is set in operand constraint + * to output (value) in the ARM specific _WRS_ABSOLUTE macro. + * (The related SPR is #101463.) + */ + +#define _WRS_ABSOLUTE_(name,value) \ + __asm__ (".globl\t"#name \ + "\n\t.equ\t"#name",%B0" \ + "\n\t.type\t"#name",%%object" \ + :: "n"(~(value))) + +#elif (CPU_FAMILY == SH) +#define _WRS_ABSOLUTE_(name,value) \ + __asm__ (".globl\t"#name \ + "\n\t.equ\t"#name",%O0" \ + "\n\t.type\t"#name",@object" \ + :: "n"(value)) + +#elif (CPU_FAMILY == I80X86) || (CPU_FAMILY == SIMNT) || (CPU_FAMILY == SIMLINUX) || (CPU_FAMILY == SIMPENTIUM) +#define _WRS_ABSOLUTE_(name,value) \ + __asm__ (".globl\t"#name \ + "\n\t.equ\t"#name",%c0" \ + "\n\t.type\t"#name",@object" \ + :: "n"(value)) + +#else /* CPU_FAMILY != ARM && CPU_FAMILY != ARM_THUMB && CPU_FAMILY != SH && CPU_FAMILY != PENTIUM */ +#define _WRS_ABSOLUTE_(name,value) \ + __asm__ (".globl\t"#name \ + "\n\t.equ\t"#name",%0" \ + "\n\t.type\t"#name",@object" \ + :: "n"(value)) + +#endif /* CPU_FAMILY == ARM || CPU_FAMILY == ARM_THUMB || CPU_FAMILY == SH && CPU_FAMILY != PENTIUM */ + +#define _WRS_ABSOLUTE_EXTERN(name) \ + extern const char name[] + +/* Prefix and suffix for assembly declarations (private function) */ + +#define _WRS_ABSOLUTE_BEGIN(x) \ + STATUS absSymbols_##x (void) { + +#define _WRS_ABSOLUTE_END \ + return OK; } + + +/* + * For compatibility with v5 of portable C coding guide + * + * These versions are obsolete, please don't use them + */ + +#define WRS_PACK_ALIGN(x) _WRS_PACK_ALIGN(x) +#define WRS_ASM(x) _WRS_ASM(x) +#define WRS_DATA_ALIGN_BYTES(x) _WRS_DATA_ALIGN_BYTES(x) +#undef WRS_GNU_VAR_MACROS + +#endif /* __INCtoolMacrosh */ diff --git a/h/transCbio.h b/h/transCbio.h new file mode 100644 index 0000000..a512ff4 --- /dev/null +++ b/h/transCbio.h @@ -0,0 +1,157 @@ +/* transCbio.h - Transaction Block I/O library */ + +/* + * Copyright (c) 2004-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01c,18aug05,act add prototype for xbdTransInit +01b,31may05,act convert from CBIO to XBD +01a,23sep04,rfr Added include guards + 17mai04,alr created +*/ + +/* +DESCRIPTION + +This library provides... + +See description of XBDs. + + +SEE ALSO +.I "VxWorks Programmers Guide: I/O System" + +INCLUDE FILES +transCbio.h + +INTERNAL +*/ + +#ifndef __INCtransCbioh +#define __INCtransCbioh + +#include "vxWorks.h" +#include "semLib.h" +#include "cbioLib.h" /* XXX - for block_t */ +#include "drv/xbd/bio.h" +#include "drv/xbd/xbd.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* error codes */ +#define ERROR_LOCK 0 /* error acquiring lock (semTake()) */ +#define ERROR_TRANS_WRITE 1 /* error writing transaction */ +#define ERROR_CONSISTENCY 3 /* internal consistency check error */ +#define ERROR_IO_OPERATION 4 /* general IO error (underlying layer should not return error!) */ +#define ERROR_OUTOFMEMORY 5 /* out of heap memory */ +#define ERROR_UNCATCHED 6 /* system was unable to recover from warning */ +#define ERROR_OUT_OF_UNITS 7 /* out of physical units */ +#define ERROR_DEFRAG 8 /* error while defragmenting */ + +/* warning codes */ +#define WARN_OUT_OF_UNITS 10 /* out of physical units */ +#define WARN_TRANS_CRC_MIS 11 /* transaction CRC mismatch */ + +/* Implementation dependent data structures */ +typedef struct transCtrl TRANS_CTRL; + +/* + * Transaction data, some stored on disk (via TRANS_MASTER; see xbdTran.c). + * Note that block_t should probably be sector_t, but we store block_t + * values on disk. + */ +struct transCtrl + { + /* physical disk geometry */ + block_t physStartOffset; /* spare offset to leave on disk (e.g. TFFS=1) */ + block_t physTrans1Offset; /* physical block offset translation table 1 */ + block_t physTrans2Offset; /* physical block offset translation table 2 */ + block_t physTransSize; /* # of physical data blocks for a translation table */ + block_t physDataOffset; /* physical block offset for data */ + block_t physDataSize; /* # of physical data blocks */ + + /* translation information */ + int blkshift; /* blk size shifter (used to increase the logical block sizes) */ + int overhead; /* overhead size */ + + /* physical disk geometry seen in units (blocks including blkshift) */ + block_t physDataUnits; /* # of physical data units */ + block_t physFreeUnits; /* # of free physical data units */ + block_t physReplacedUnits; /* # of replaced physical data units */ + char * physUnitFree; /* physical units free table */ + char * physUnitReplaced; /* physical units replaced table */ + block_t physLastFreeUnit; /* last found free physical data units */ + + /* logical disk geometry */ + block_t * virtToPhys; /* virtual # to physical # mapping table */ + char * virtToPhysDirty1; /* virtToPhys dirty table */ + char * virtToPhysDirty2; /* virtToPhys dirty table */ + + /* transaction information */ + u_long transSerial; /* current transaction serial number */ + u_char transNumber; /* current transaction image */ + + /* disk identification */ + u_long diskSerial1; /* disk serial number 1 (random) */ + u_long diskSerial2; /* disk serial number 2 (random hash) */ + + /* transaction layer options */ + u_long options; /* options for transaction layer */ + }; + +typedef struct transXbd TRANS_XBD, *TRANS_XBD_ID; +/* the actual details of a transXbd are only in xbdTrans.c */ + +/* Function Pointers */ +extern STATUS (*transpanic)(TRANS_XBD *dev, int code, char * message); +extern STATUS (*transwarning)(TRANS_XBD *dev, int code, char * message); + +/* format structure + types */ +#define FORMAT_REGULAR 0 /* Regular type. It includes a TMR at the + * beginning and end of the media to + * increase reliability. It should be used + * for all regular devices, which are neither + * TFFS, nor require DosFS compatiblity + * (will never be accessed in a pure FAT + * system). */ + +#define FORMAT_TFFS 1 /* TFFS type. It leaves the first sector + * empty (for TFFS), and only uses a TMR + * on the end of the media. */ + +#define FORMAT_DOS 2 /* DOS FAT compatiblity type. It immediately + * starts the media, moving all transaction + * data and TMR to the end of the media. + * A media prepared with this (and + * defragmented) will be read and + * accessible in a Dos FAT system. */ + +/* XXX this structure is obsolete (? but do we want to handle the ioctl?) */ +typedef struct transFmt + { + /* translation information */ + int blkshift; /* blk size shifter (used to increase logical block sizes) */ + int overhead; /* overhead size */ + int type; /* format type */ + } TRANS_FORMAT; + +TRANS_XBD *transDevCreate(device_t subDev); +STATUS formatTrans(int rawFd, int blkshift, int overhead, int type); +STATUS transShow(TRANS_XBD *dev, int verb); +device_t xbdTransDevCreate(device_t subDev); +STATUS xbdTransInit(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtransCbioh */ diff --git a/h/trcLib.h b/h/trcLib.h new file mode 100644 index 0000000..1484efc --- /dev/null +++ b/h/trcLib.h @@ -0,0 +1,52 @@ +/* trcLib.h - header file for trcLib.c */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,24oct03,dbs added re-entrant trcStack option +01h,22sep92,rrr added support for c++ +01g,18sep92,jcf added include of regs.h. +01f,04jul92,jcf cleaned up. +01e,26may92,rrr the tree shuffle +01d,07apr92,yao made ANSI prototype of trcStack() consistent for all + architecutres. +01c,09jan92,jwt modified trcStack() prototype for SPARC. +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01a,05oct90,shl created. +*/ + +#ifndef __INCtrcLibh +#define __INCtrcLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "regs.h" + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void trcStack (REG_SET *pRegs, FUNCPTR printRtn, int tid); + +extern void trcStack_r (REG_SET *pRegs, FUNCPTR printRtn, int tid, void* context); + +#else + +extern void trcStack (); + +extern void trcStack_r (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtrcLibh */ diff --git a/h/trgLib.h b/h/trgLib.h new file mode 100644 index 0000000..c3da016 --- /dev/null +++ b/h/trgLib.h @@ -0,0 +1,104 @@ + +/* trgLib.h - event triggers header */ + +/* Copyright 1997 - 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,10nov03,cpd Add declarations for trgReset +01f,23sep03,tcr move TRIGGER_ID def'n +01e,15sep03,tcr tidy up +01d,16mar99,spm recovered orphaned code from tor1_0_1.sens1_1 (SPR #25770) +01c,16dec98,nps fix last change(!) +01b,14dec98,nps added prototype for trgShowInit. +01a,27jan98,pr written + +*/ + +#ifndef __INCtrglibh +#define __INCtrglibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* This file contains event triggering elements. */ + +#define TRIGGER_COND_NO 0 +#define TRIGGER_COND_YES 1 + +#define TRIGGER_COND_FUNC 0 +#define TRIGGER_COND_VAR 1 +#define TRIGGER_COND_LIB 2 + +#define TRG_DISABLE 0 +#define TRG_ENABLE 1 + +#define TRIGGER_EQ 0 +#define TRIGGER_NEQ 1 +#define TRIGGER_LSS 2 +#define TRIGGER_LEQ 3 +#define TRIGGER_GRT 4 +#define TRIGGER_GEQ 5 +#define TRIGGER_OR 6 +#define TRIGGER_AND 7 + +#define TRG_CTX_ANY 0 +#define TRG_CTX_ANY_TASK 1 +#define TRG_CTX_TASK 2 +#define TRG_CTX_ANY_ISR 3 +#define TRG_CTX_ISR 4 +#define TRG_CTX_SYSTEM 5 + +#define TRG_ACT_NONE 0 +#define TRG_ACT_WV_START 1 +#define TRG_ACT_WV_STOP 2 +#define TRG_ACT_FUNC 3 +#define TRG_ACT_NOTIFY 4 +#define TRG_ACT_STOP 5 +#define TRG_ACT_LIB 6 + +#ifndef _ASMLANGUAGE + +typedef struct trigger * TRIGGER_ID; + +#include "private/trgLibP.h" + + +extern STATUS trgLibInit (void); +extern TRIGGER_ID trgAdd ( + event_t event, + int status, + int contextType, + UINT32 contextId, + OBJ_ID objId, + int conditional, + int condType, + int * condEx1, + int condOp, + int condEx2, + BOOL disable, + TRIGGER_ID chain, + int actionType, + FUNCPTR actionFunc, + BOOL actionDef, + int actionArg + ); +extern STATUS trgDelete (TRIGGER_ID trgId); +extern STATUS trgReset (TRIGGER_ID trgId); +extern STATUS trgOn (void); +extern void trgOff (void); +extern STATUS trgEnable (TRIGGER_ID trgId); +extern STATUS trgDisable (TRIGGER_ID trgId); +extern STATUS trgChainSet (TRIGGER_ID fromId, TRIGGER_ID toId); +extern STATUS trgShow (TRIGGER_ID trgId, int options); +extern void trgShowInit (void); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCtrglibph*/ diff --git a/h/ttyLib.h b/h/ttyLib.h new file mode 100644 index 0000000..72a2710 --- /dev/null +++ b/h/ttyLib.h @@ -0,0 +1,33 @@ +/* ttyLib.h - header file for terminal drivers on top of sio core drivers */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,05may04,dat fix ttyDrv declaration, 96824 +01c,15jun95,ms updated for new serial driver. +01b,22may95,ms removed unneded include file. +01a,21feb95,ms written. +*/ + +#ifndef __INCttyLibh +#define __INCttyLibh + +#include "types/vxTypes.h" +#include "sioLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern STATUS ttyDrv (void); +extern STATUS ttyDevCreate (char* name, SIO_CHAN* pChan, int rdBufSize, + int wrtBufSize); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCttyLibh */ + diff --git a/h/tyLib.h b/h/tyLib.h new file mode 100644 index 0000000..4adc41c --- /dev/null +++ b/h/tyLib.h @@ -0,0 +1,146 @@ +/* tyLib.h - tty handler support library header */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +03h,10may04,dat SPR 70498, change canceled flag to a counter +03g,07apr04,dat merge from AE for 88437 +03f,20jun03,bpn added tyAbortGet() prototype. +03e,29jan00,dat added threshold values and xoff funcptr (SPR 20978) +03d,11nov98,aeg added tyDevTerminate(). +03c,08may97,db added numOpen entry to TY_DEV structure(SPR #7637). +03b,22sep92,rrr added support for c++ +03a,04jul92,jcf cleaned up. +02u,26may92,rrr the tree shuffle +02t,04oct91,rrr passed through the ansification filter + -changed VOID to void + -changed copyright notice +02s,11jul91,jwt removed divisible bit-field operations in TY_DEV structure. +02r,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +02q,07aug90,shl added function declarations comment. +02p,26jun90,jcf embedded the TY_DEV semaphores. +02o,12may90,gae added IMPORTs of ty{Read,Write,ITx,IRd}. + removed unused wdog. changed UTINY to UINT8. +02n,29mar90,rdc reworked to lower interrupt latency. +02m,16mar90,rdc added select support. +02l,27jul89,hjb added protoHook and protoArg to TY_DEV. +02k,18nov88,dnw removed NOT_GENERIC stuff. +02j,04may88,jcf changed SEMAPHORE to SEM_ID. +02i,15jun87,ecs added canceled to rdState & wrtState of TY_DEV. +02h,24dec86,gae changed stsLib.h to vwModNum.h. +02g,07apr86,dnw removed ST_ERROR status and added rdError flag to smpte mode. +02f,23mar86,jlf changed GENERIC to NOT_GENERIC. +02e,22aug85,dnw replaced xState with rdState and wrtState structures. + added rdSmpteState and wrtSmpteState to SMPTE only version. +02d,16aug84,dnw removed S_tyLib_SMPTE_READ_ERROR from GENERIC version. + added lnNBytes and lnBytesLeft members to TY_DEV for + line-protocol mode. +02c,15aug84,jlf changed back to tyLib.h +02b,13aug84,ecs got rid of S_tyLib_UNKNOWN_REQUEST. + changed S_tyLib_READ_ERROR to S_tyLib_SMPTE_READ_ERROR. +02a,10aug84,jlf changed to tyLib.hx - new mega-file format. +01g,08aug84,ecs added include of stsLib.h, status codes. +01f,15jun84,dnw changed TY_DEV to work with new i/o system and ring buffer lib. +01e,27jan84,ecs added inclusion test. +01d,15sep83,dnw added xon/xoff stuff: xState field in TY_DEV and definitions + of states XST_... +01c,29jul83,dnw added ST_TX_CR and removed txStopped. + diddled with TY_DEV to make it simpler & more consistent. + fiddled with device states to put them in order and + confuse the innocent. +01b,22jul83,ecs added options & status, changed expectCk to TBOOL. +01a,24jun83,ecs written +*/ + +#ifndef __INCtyLibh +#define __INCtyLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "iosLib.h" +#include "rngLib.h" +#include "selectLib.h" +#include "vwModNum.h" +#include "private/semLibP.h" + +/* HIDDEN */ + +typedef struct /* TY_DEV - tty device descriptor */ + { + DEV_HDR devHdr; /* I/O device header */ + + RING_ID rdBuf; /* ring buffer for read */ + SEMAPHORE rdSyncSem; /* reader synchronization semaphore */ + SEMAPHORE mutexSem; /* mutual exclusion semaphore */ + struct /* current state of the read channel */ + { + UINT16 canceled; /* read has been canceled */ + unsigned char xoff; /* input has been XOFF'd */ + unsigned char pending; /* XON/XOFF will be sent when xmtr is free*/ + unsigned char flushingRdBuf; /* critical section marker */ + } rdState; + + RING_ID wrtBuf; /* ring buffer for write */ + SEMAPHORE wrtSyncSem; /* writer synchronization semaphore */ + struct /* current state of the write channel */ + { + UINT16 canceled; /* write has been canceled */ + unsigned char busy; /* transmitter is busy sending character */ + unsigned char xoff; /* output has been XOFF'd */ + unsigned char cr; /* CR should be inserted next (after LF) */ + unsigned char flushingWrtBuf; /* critical section marker */ + unsigned char wrtBufBusy; /* task level writing to buffer */ + } wrtState; + + UINT8 lnNBytes; /* number of bytes in unfinished new line */ + UINT8 lnBytesLeft; /* number of bytes left in incompletely + dequeued line */ + USHORT options; /* options in effect for this channel */ + FUNCPTR txStartup; /* pointer to routine to start xmitter */ + FUNCPTR protoHook; /* protocol specific hook routine */ + int protoArg; /* protocol specific argument */ + SEL_WAKEUP_LIST selWakeupList;/* tasks that are selected on this dev */ + int numOpen; /* number of open paths to device */ + + int xoffThreshold; /* Rx Threshold for sending XOFF */ + int xonThreshold; /* Rx Threshold for sending XON */ + int wrtThreshold; /* Tx Threshold for other senders */ + FUNCPTR xoffHook; /* device specific Xoff/Xon routine */ + int xoffArg; /* argument 1 for xoff/xon routine */ + } TY_DEV; + +/* END_HIDDEN */ + +typedef TY_DEV * TY_DEV_ID; + +/* function declarations */ + +extern STATUS tyLibInit (int xoffThresh, int xonThresh, int wrtThresh); +extern STATUS tyDevInit (TY_DEV_ID pTyDev, int rdBufSize, int wrtBufSize, + FUNCPTR txStartup); +extern STATUS tyDevTerminate (TY_DEV_ID pTyDev); +extern STATUS tyITx (TY_DEV_ID pTyDev, char *pChar); +extern STATUS tyIRd (TY_DEV_ID pTyDev, char inchar); +extern STATUS tyIoctl (TY_DEV_ID pTyDev, int request, int arg); +extern int tyRead (TY_DEV_ID pTyDev, char *buffer, int maxbytes); +extern int tyWrite (TY_DEV_ID pTyDev, char *buffer, int nbytes); +extern void tyAbortFuncSet (FUNCPTR func); +extern void tyAbortSet (char ch); +extern char tyAbortGet (); +extern void tyBackspaceSet (char ch); +extern void tyDeleteLineSet (char ch); +extern void tyEOFSet (char ch); +extern void tyMonitorTrapSet (char ch); +extern STATUS tyXoffHookSet (TY_DEV_ID pTyDev, FUNCPTR func, int arg); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtyLibh */ diff --git a/h/types.h b/h/types.h new file mode 100644 index 0000000..ecc8a65 --- /dev/null +++ b/h/types.h @@ -0,0 +1,26 @@ +/* types.h - obsolete vxWorks 5.0 header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,29sep92,rrr changed name of __INCtypesh to avoid conflict +01b,22sep92,rrr added support for c++ +01a,19sep92,smb written for compatibility with 5.0 +*/ + +#ifndef __INCobsolete_typesh +#define __INCobsolete_typesh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "sys/types.h" + +#ifdef __cplusplus +} +#endif + +#endif /* __INCobsolete_typesh */ diff --git a/h/types/vxANSI.h b/h/types/vxANSI.h new file mode 100644 index 0000000..50b90bb --- /dev/null +++ b/h/types/vxANSI.h @@ -0,0 +1,53 @@ +/* vxANSI.h - ANSI header file */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,13nov92,dnw added define for _EXTENSION_POSIX_1003 +01c,22sep92,rrr added support for c++ +01b,07sep92,smb added documentation. +01a,03jul92,smb written. +*/ + +/* +DESCRIPTION +This header file includes the minimum configuration necessary for +an ANSI compatible file. + +vxCpu.h contains CPU_FAMILY definition +vxArch.h contains architecture specific definitions +vxParams.h contains system parameters specified by ANSI or POSIX standards +vxTypesBase.h contains type definitions for ALL types specified by ANSI or + POSIX not already defined in vxArch.h +*/ + +#ifndef __INCvxANSIh +#define __INCvxANSIh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The following defines enable various extensions to strict ANSI definitions. + * To achieve strict ANSI compliance without extensions, define these + * to be 0. + */ + +#define _EXTENSION_POSIX_1003 1 /* include POSIX extensions */ +#define _EXTENSION_POSIX_REENTRANT 1 /* include POSIX reentrant ext. */ +#define _EXTENSION_WRS 1 /* include WRS extensions */ + + +#include "types/vxCpu.h" /* CPU family definition */ +#include "types/vxArch.h" /* architecture definitions */ +#include "types/vxParams.h" /* system defaults */ +#include "types/vxTypesBase.h" /* defaults for machine dependant */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvxANSIh */ diff --git a/h/types/vxArch.h b/h/types/vxArch.h new file mode 100644 index 0000000..3622e12 --- /dev/null +++ b/h/types/vxArch.h @@ -0,0 +1,249 @@ +/* vxArch.h - architecture header */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01z,07oct05,yvp Defined VX_OBJ_ALIGN_SIZE (SPR 113405). +01y,07jun05,yvp Updated copyright. #include now with angle-brackets. +01x,26apr05,yvp Transferred previous 2 changes into vxLayerConfig.h +01w,16mar05,yvp Undef'ed WV_INSTRUMENTATION and EDR_ERROR_INJECT_STUBS. + Defined MINIMAL_KERNAL and _FREE_VERSION for now. +01v,04apr05,scm re-enable WV_INSTRUMENTATION for ARM/XScale... +01u,22mar05,scm disable WV_INSTRUMENTATION until windview work complete for ARM... +01t,17dec04,scm add WV_INSTRUMENTATION for arm/xscale... +01s,15nov04,h_k enabled WV_INSTRUMENTATION for SH. +01r,04may04,tcr add WV_INSTRUMENTATION to MIPS +01q,06apr04,dbt Enabled WindView support for VxSim. +01p,13mar04,dlk disable WV_INSTRUMENTATION if _FREE_VERSION defined. +01o,25mar04,dbt Added SIMPENTIUM support. +01n,19nov04,job Combined user & kernel mode versions. Moved kernel mode + STACK, ALLOC & CACHE_ALIGN_SIZE macros here so that they + are set correctly. +01m,16dec03,kk re-enable WV_INSTRUMENTATION +01l,14dec03,kk temporarily disable WV_INSTRUMENTATION until network builds +01k,11nov03,tcr enable WindView on selected archs +01j,15jul03,kam rebased to Base6 integration branch +01i,26jun03,dcc temporarily comment out the definition of WV_INSTRUMENTATION +01h,17apr03,dbt Added SIMLINUX support. Removed SIMHPPA & SIMSPARCSUNOS +01g,16nov01,dee add COLDFIRE architecture +01f,14nov01,tcr Undo previous change +01e,29oct01,tcr add INCLUDE_WVNET for instrumented network stack +01d,25feb00,frf Add SH support for T2 +01c,06Aug98,ms added WV_INSTRUMENTATION. +02b,15aug97,cym added SIMNT support. +02b,28nov96,cdp added ARM support. +02a,26may94,yao added PPC support. +01n,30oct95,ism added SIMSOLARIS support. +01m,19mar95,dvs removed #ifdef TRON - tron no longer supported. +01l,02dec93,pme added Am29K family support. +01k,11aug93,gae vxsim hppa. +01j,12jun93,rrr vxsim. +01i,09jun93,hdn added support for I80X86 +01h,22sep92,rrr added support for c++ +01g,07sep92,smb added documentation +01f,07jul92,rrr added defines for BIG & LITTLE ENDIAN and STACK direction +01e,07jul92,ajm added _ARCH_MULTIPLE_CACHELIB for cache init +01d,03jul92,smb changed name from arch.h. +01c,06jun92,ajm corrected definition of mips CPU_FAMILY +01b,26may92,rrr the tree shuffle + -changed includes to have absolute path from h/ +01a,22apr92,yao written. +*/ + +/* +DESCRIPTION +This header file includes a architecture specific header file depending +on the value of CPU_FAMILY defined in vxCpu.h. The header file contains +definitions specific to this CPU family. This header file must be +preceded by an include of vxCpu.h +*/ + +#ifndef __INCvxArchh +#define __INCvxArchh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _BIG_ENDIAN +#undef _BIG_ENDIAN +#endif +#define _BIG_ENDIAN 1234 + +#ifdef _LITTLE_ENDIAN +#undef _LITTLE_ENDIAN +#endif +#define _LITTLE_ENDIAN 4321 + +#define _STACK_GROWS_DOWN (-1) +#define _STACK_GROWS_UP 1 + +#ifdef _WRS_KERNEL + +#if (CPU_FAMILY==MC680X0) +#include +#endif /* (CPU_FAMILY== MC680X0) */ + +#if (CPU_FAMILY==COLDFIRE) +#include +#endif /* (CPU_FAMILY== COLDFIRE) */ + +#if (CPU_FAMILY==SPARC) +#include +#endif /* (CPU_FAMILY== SPARC) */ + +#if (CPU_FAMILY==I960) +#include +#endif /* (CPU_FAMILY== I960) */ + +#if (CPU_FAMILY==AM29XXX) +#include +#endif /* (CPU_FAMILY==AM29XXX) */ + +#else /* _WRS_KERNEL */ + +#if (CPU_FAMILY==SIMPENTIUM) +#include +#endif /* (CPU_FAMILY== SIMPENTIUM) */ + +#endif /* _WRS_KERNEL */ + +#if (CPU_FAMILY==SIMSPARCSOLARIS) +#ifdef _WRS_KERNEL +#ifndef WV_INSTRUMENTATION +#define WV_INSTRUMENTATION +#endif +#endif /* _WRS_KERNEL */ +#include +#endif /* (CPU_FAMILY== SIMSPARCSOLARIS) */ + +#if (CPU_FAMILY==SIMLINUX) +#ifdef _WRS_KERNEL +#ifndef WV_INSTRUMENTATION +#define WV_INSTRUMENTATION +#endif +#endif /* _WRS_KERNEL */ +#include +#endif /* (CPU_FAMILY== SIMLINUX) */ + +#if (CPU_FAMILY==SIMNT) +#ifdef _WRS_KERNEL +#ifndef WV_INSTRUMENTATION +#define WV_INSTRUMENTATION +#endif +#endif /* _WRS_KERNEL */ +#include +#endif /* (CPU_FAMILY== SIMNT) */ + +#if (CPU_FAMILY==MIPS) +#ifdef _WRS_KERNEL +#ifndef WV_INSTRUMENTATION +#define WV_INSTRUMENTATION +#endif +#endif /* _WRS_KERNEL */ +#include +#endif /* (CPU_FAMILY==MIPS) */ + +#if (CPU_FAMILY==PPC) +#ifdef _WRS_KERNEL +#ifndef WV_INSTRUMENTATION +#define WV_INSTRUMENTATION +#endif +#endif /* _WRS_KERNEL */ +#include +#endif /* (CPU_FAMILY==PPC) */ + +#if (CPU_FAMILY==I80X86) +#ifdef _WRS_KERNEL +#ifndef WV_INSTRUMENTATION +#define WV_INSTRUMENTATION +#endif +#endif /* _WRS_KERNEL */ +#include +#endif /* (CPU_FAMILY==I80X86) */ + +#if (CPU_FAMILY==SH) +#ifdef _WRS_KERNEL +#ifndef WV_INSTRUMENTATION +#define WV_INSTRUMENTATION +#endif +#endif /* _WRS_KERNEL */ +#include +#endif /* (CPU_FAMILY==SH) */ + +#if (CPU_FAMILY==ARM) +#ifdef _WRS_KERNEL +#ifndef WV_INSTRUMENTATION +#define WV_INSTRUMENTATION +#endif +#endif /* _WRS_KERNEL */ +#include +#endif /* (CPU_FAMILY==ARM) */ + +#ifdef _FREE_VERSION +#undef WV_INSTRUMENTATION +#undef EDR_ERROR_INJECT_STUBS +#endif /* _FREE_VERSION */ + +#ifndef _BYTE_ORDER +#define _BYTE_ORDER _BIG_ENDIAN +#endif /* _BYTE_ORDER */ + +#ifndef _STACK_DIR +#define _STACK_DIR _STACK_GROWS_DOWN +#endif /* _STACK_DIR */ + +#ifndef _ALLOC_ALIGN_SIZE +#define _ALLOC_ALIGN_SIZE 4 /* 4 byte boundary */ +#endif /* _ALLOC_ALIGN_SIZE */ + +/* Note: for architectures not reguiring stack alignment, enforcing 4 byte + * alignment is recommended for better efficiency. + */ + +#ifndef _STACK_ALIGN_SIZE +#define _STACK_ALIGN_SIZE 4 /* 4 byte boundary */ +#endif /* _STACK_ALIGN_SIZE */ + +#ifndef _CACHE_ALIGN_SIZE +#define _CACHE_ALIGN_SIZE 16 +#endif /* _CACHE_ALIGN_SIZE */ + +#ifndef _ARCH_MULTIPLE_CACHELIB +#define _ARCH_MULTIPLE_CACHELIB FALSE +#endif /* _ARCH_MULTIPLE_CACHELIB */ + +/* alignment requirement when accessing bus */ + +#ifndef _DYNAMIC_BUS_SIZING +#define _DYNAMIC_BUS_SIZING TRUE /* dynamic bus sizing */ +#endif /* _DYNAMIC_BUS_SIZING */ + + +/* + * VX_OBJ_ALIGN_SIZE is the default allocation boundary for kernel + * objects allocated statically. If the CPU defines a default allocation + * alignment value, use it. Otherwise default to an 8-byte alignment + * boundary. This is because for some CPU's _ALLOC_ALIGN_SIZE may not be + * known at compile time. + */ + +#ifdef _CPU_ALLOC_ALIGN_SIZE +#define VX_OBJ_ALIGN_SIZE _CPU_ALLOC_ALIGN_SIZE +#else /* _CPU_ALLOC_ALIGN_SIZE */ +#define VX_OBJ_ALIGN_SIZE 8 +#endif /* _CPU_ALLOC_ALIGN_SIZE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvxArchh */ diff --git a/h/types/vxCpu.h b/h/types/vxCpu.h new file mode 100644 index 0000000..55e43cf --- /dev/null +++ b/h/types/vxCpu.h @@ -0,0 +1,399 @@ +/* vxCpu.h - VxWorks CPU definitions header */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* + * vxCpu.h is now generated -- DO NOT EDIT + * + * To change the boilerplate, edit vxCpu.in + * + * To add CPU types or otherwise change the substance, + * edit $WIND_BASE/host/src/target/architecturedb + */ + +/* +modification history +-------------------- +02i,10aug01,pch Rename to vxCpu.in, revise for use in generating vxCpu.h + from host/src/target/architecturedb +02m,23jul01,scm change XScale name to conform to coding standards... +02h,07may01,kab Fix PPC enum clashes +02l,04may01,scm add STRONGARM support... +02g,25oct00,s_m renamed PPC405 cpu types +02f,14jun00,alp Added PPC405 support +02k,11dec00,scm replace references to ARMSA2 with XScale +02j,31aug00,scm add sa2 support under arm +02i,20jan99,cdp marked old ARM CPU numbers 'obsoleted'. +02h,13nov98,cdp added ARMARCH3, ARMARCH4, ARMARCH4_T. +02n,28mar01,mem Update SH cpu numbers. +02m,14dec00,pes Remove more obsolete MIPS CPU designations. +02m,01dec00,??? Update ARM block +02l,06oct00,ish fix MCF5400 +02k,07jul00,dh rationalised mcf family to 2 cpus. +02j,23nov99,yvp adding CPU_FAMILY FRV and CPU type FR500 for Fujitsu FR-V + (a.k.a Venus) family processors +02i,27mar00,ish Fixed CPU identifiers in ColdFire support +02h,15mar00,dra Added ColdFire support. +02g,12oct99,yvp Merge from .../tor2_0_0.coretools-baseline branch to make + Tor2 code work with T3 main/LATEST compiler +02f,09sep99,myz added CW4000_16 support +02f,22jul99,jld Regularize CPU=MCOREx tags. +02e,17dec97,ur added MCORE support. +02f,05nov97,mem added SPARCV9 support. +02n,18oct99,dra added CW4000, CW4011, VR4100, VR5000 and VR5400 support. +02m,13jul99,bc Added SH7718 <-> sh3e +02l,02jul98,st added SH7750 support (SH4). +02k,05may98,jmc added SH-DSP and SH3-DSP support. +02j,23apr97,hk added SH support. +02i,17aug97,tpr added PowerPC EC 603 support. +02h,15aug97,cym added SIMNT support. +02g,09apr98,hdn added support for Pentium, PentiumPro. +02f,26mar97,cdp added Thumb (ARM7TDMI_T) support. +02e,28nov96,cdp added ARM support. +02d,12jul96,kkk added CW4000 & R4650 support. +02c,08feb96,tpr added PPC505 and PPC860 support. +02b,23feb96,tpr undefined the PPC macro defined by the PowerPC Gnu. +02a,26may94,yao added PPC support. +01k,24jul95,ism added SIMSOLARIS support. +01j,27dec95,myz added I960HX stuff. +01i,20mar95,kvk added I960JX specific stuff. +01h,31oct94,kdl removed comment-within-comment. +01f,27sep93,cd added R4000 support. +01g,26oct94,tmk added new cpu type MC68LC040 +01f,21jul94,tpr added MC68060 cpu. +01f,09jun93,hdn added support for I80X86 +01g,02dec93,tpr added definition for the AMD 29200 microcontroller + pad added definitions for the AMD 29030 cpu +01g,11aug93,gae vxsim hppa. +01f,22jun93,gae vxsim: added SIMSPARCSUNOS. +01e,13nov92,dnw added test for correct definition of CPU +01d,22sep92,rrr added support for c++ +01c,07sep92,smb added documentation +01b,23jul92,jwt restored SPARClite reference omitted in file creation. +01a,11jul92,smb CPU definitions moved from vxWorks.h. +*/ + +/* +DESCRIPTION +Depending on the value of CPU passed to the system by the compiler command +line, the CPU_FAMILY is defined. This must be the first header file +included by vxWorks.h. +*/ + +#ifndef __INCvxCpuh +#define __INCvxCpuh + +#ifdef __cplusplus +extern "C" { +#endif + +/* CPU types */ + +/* Turn off stuff that some compilers pre-define ... */ +#ifdef MC68000 +#undef MC68000 +#endif +#ifdef I960 +#undef I960 +#endif +#ifdef PPC +#undef PPC +#endif + +/* Ensure CPU_FAMILY undefined initially */ +#ifdef CPU_FAMILY +#undef CPU_FAMILY +#endif + +#define MC68000 1 /* CPU */ +#define MC68010 2 /* CPU */ +#define MC68020 3 /* CPU */ +#define MC68030 4 /* CPU */ +#define MC68040 5 /* CPU */ +#define MC68LC040 6 /* CPU */ +#define MC68060 7 /* CPU */ +#define CPU32 8 /* CPU */ +#define MC680X0 9 /* CPU_FAMILY */ +#define SPARC 10 /* CPU & CPU_FAMILY */ +#define SPARClite 11 /* CPU */ +#define I960 20 /* CPU_FAMILY */ +#define I960CA 21 /* CPU */ +#define I960KA 22 /* CPU */ +#define I960KB 23 /* CPU */ +#define I960JX 24 /* CPU */ +#define I960HX 25 /* CPU */ +#define TRON 30 /* CPU_FAMILY */ +#define G100 31 /* CPU */ +#define G200 32 /* CPU */ +#define MIPS 40 /* CPU_FAMILY */ +#define MIPS32 41 /* CPU */ +#define MIPS64 42 /* CPU */ +#define AM29XXX 50 /* CPU_FAMILY */ +#define AM29030 51 /* CPU */ +#define AM29200 52 /* CPU */ +#define AM29035 53 /* CPU */ +#define SIMSPARCSUNOS 60 /* CPU & CPU_FAMILY */ +#define SIMSPARCSOLARIS 61 /* CPU & CPU_FAMILY */ +#define SIMHPPA 70 /* CPU & CPU_FAMILY */ +#define I80X86 80 /* CPU_FAMILY */ +#define I80386 81 /* CPU */ +#define I80486 82 /* CPU */ +#define PENTIUM 83 /* CPU */ +#define PENTIUM2 84 /* CPU */ +#define PENTIUM3 85 /* CPU */ +#define PENTIUM4 86 /* CPU */ +#define PPC32 90 /* CPU & CPU_FAMILY */ +#define PPC 90 /* CPU_FAMILY */ +#define PPC601 91 /* CPU */ +#define PPC602 92 /* CPU */ +#define PPC603 93 /* CPU */ +#define PPC604 94 /* CPU */ +#define PPC403 95 /* CPU */ +#define PPC505 96 /* CPU */ +#define PPC860 97 /* CPU */ +#define PPCEC603 98 /* CPU */ +#define PPC555 99 /* CPU */ +#define SIMNT 100 /* CPU & CPU_FAMILY */ +#define SPARCV9 110 /* CPU_FAMILY */ +#define ULTRASPARC 111 /* CPU */ +#define ARM 120 /* CPU_FAMILY */ +#define ARM710A 121 /* CPU */ +#define ARM7TDMI 122 /* CPU */ +#define ARM810 123 /* CPU */ +#define ARMSA110 124 /* CPU */ +#define ARM7TDMI_T 125 /* CPU */ +#define ARMARCH3 126 /* CPU */ +#define ARMARCH4 127 /* CPU */ +#define ARMARCH4_T 128 /* CPU */ +#define STRONGARM 129 /* CPU */ +#define SH32 130 /* CPU & CPU_FAMILY */ +#define SH 130 /* CPU_FAMILY */ +#define SH7000 131 /* CPU */ +#define SH7600 132 /* CPU */ +#define SH7040 133 /* CPU */ +#define SH7700 134 /* CPU */ +#define SH7410 135 /* CPU */ +#define SH7729 136 /* CPU */ +#define SH7750 137 /* CPU */ +#define MCORE 150 /* CPU_FAMILY */ +#define MCORE10 151 /* CPU */ +#define MCORE15 152 /* CPU */ +#define MCORE200 153 /* CPU */ +#define MCORE300 154 /* CPU */ +#define COLDFIRE 160 /* CPU_FAMILY */ +#define MCF5200 161 /* CPU */ +#define MCF5400 162 /* CPU */ +#define FRV 170 /* CPU_FAMILY */ +#define FR500 171 /* CPU */ +#define MAP1000 180 /* CPU & CPU_FAMILY */ +#define MAP 180 /* CPU_FAMILY */ +#define MAP1000A 181 /* CPU */ +#define MAPCA 182 /* CPU */ +#define SIMLINUX 190 /* CPU & CPU_FAMILY */ +#define SIMPENTIUM 191 /* CPU & CPU_FAMILY */ +#define XSCALE 1120 /* CPU */ +#define ARMARCH5 1121 /* CPU */ +#define ARMARCH5_T 1122 /* CPU */ +#define ARMARCH6 1123 /* CPU */ +#define ARMARCH6_T 1124 /* CPU */ +#define PPC509 2000 /* CPU */ +#define PPC405 2001 /* CPU */ +#define PPC405F 2002 /* CPU */ +#define PPC440 2003 /* CPU */ +#define PPC85XX 2004 /* CPU */ +#define PPC970 2005 /* CPU */ +#define PPC750 2010 /* CPU */ +#define PPC7400 2011 /* CPU */ +#define PPC8260 2012 /* CPU */ +#define PPC8560 2013 /* CPU */ + +#if (CPU==MC68000 || \ + CPU==MC68010 || \ + CPU==MC68020 || \ + CPU==MC68030 || \ + CPU==MC68040 || \ + CPU==MC68LC040 || \ + CPU==MC68060 || \ + CPU==CPU32) +#define CPU_FAMILY MC680X0 +#define CPU_FAMILY_PREPENDS_UNDERSCORE TRUE +#endif /* CPU_FAMILY==MC680X0 */ + +#if (CPU==SPARC || \ + CPU==SPARClite) +#define CPU_FAMILY SPARC +#define CPU_FAMILY_PREPENDS_UNDERSCORE TRUE +#endif /* CPU_FAMILY==SPARC */ + +#if (CPU==I960CA || \ + CPU==I960KA || \ + CPU==I960KB || \ + CPU==I960JX || \ + CPU==I960HX) +#define CPU_FAMILY I960 +#define CPU_FAMILY_PREPENDS_UNDERSCORE TRUE +#endif /* CPU_FAMILY==I960 */ + +#if (CPU==G100 || \ + CPU==G200) +#define CPU_FAMILY TRON +#define CPU_FAMILY_PREPENDS_UNDERSCORE FALSE +#endif /* CPU_FAMILY==TRON */ + +#if (CPU==MIPS32 || \ + CPU==MIPS64) +#define CPU_FAMILY MIPS +#define CPU_FAMILY_PREPENDS_UNDERSCORE FALSE +#endif /* CPU_FAMILY==MIPS */ + +#if (CPU==AM29030 || \ + CPU==AM29200 || \ + CPU==AM29035) +#define CPU_FAMILY AM29XXX +#define CPU_FAMILY_PREPENDS_UNDERSCORE FALSE +#endif /* CPU_FAMILY==AM29XXX */ + +#if (CPU==SIMSPARCSUNOS) +#define CPU_FAMILY SIMSPARCSUNOS +#define CPU_FAMILY_PREPENDS_UNDERSCORE TRUE +#endif /* CPU_FAMILY==SIMSPARCSUNOS */ + +#if (CPU==SIMSPARCSOLARIS) +#define CPU_FAMILY SIMSPARCSOLARIS +#define CPU_FAMILY_PREPENDS_UNDERSCORE FALSE +#endif /* CPU_FAMILY==SIMSPARCSOLARIS */ + +#if (CPU==SIMHPPA) +#define CPU_FAMILY SIMHPPA +#define CPU_FAMILY_PREPENDS_UNDERSCORE FALSE +#endif /* CPU_FAMILY==SIMHPPA */ + +#if (CPU==I80386 || \ + CPU==I80486 || \ + CPU==PENTIUM || \ + CPU==PENTIUM2 || \ + CPU==PENTIUM3 || \ + CPU==PENTIUM4) +#define CPU_FAMILY I80X86 +#define CPU_FAMILY_PREPENDS_UNDERSCORE FALSE +#endif /* CPU_FAMILY==I80X86 */ + +#if (CPU==PPC32 || \ + CPU==PPC601 || \ + CPU==PPC602 || \ + CPU==PPC603 || \ + CPU==PPC604 || \ + CPU==PPC403 || \ + CPU==PPC505 || \ + CPU==PPC860 || \ + CPU==PPCEC603 || \ + CPU==PPC555 || \ + CPU==PPC509 || \ + CPU==PPC405 || \ + CPU==PPC405F || \ + CPU==PPC440 || \ + CPU==PPC85XX || \ + CPU==PPC970 || \ + CPU==PPC750 || \ + CPU==PPC7400 || \ + CPU==PPC8260 || \ + CPU==PPC8560) +#define CPU_FAMILY PPC +#define CPU_FAMILY_PREPENDS_UNDERSCORE FALSE +#endif /* CPU_FAMILY==PPC */ + +#if (CPU==SIMNT) +#define CPU_FAMILY SIMNT +#define CPU_FAMILY_PREPENDS_UNDERSCORE FALSE +#endif /* CPU_FAMILY==SIMNT */ + +#if (CPU==ULTRASPARC) +#define CPU_FAMILY SPARCV9 +#define CPU_FAMILY_PREPENDS_UNDERSCORE FALSE +#endif /* CPU_FAMILY==SPARCV9 */ + +#if (CPU==ARM710A || \ + CPU==ARM7TDMI || \ + CPU==ARM810 || \ + CPU==ARMSA110 || \ + CPU==ARM7TDMI_T || \ + CPU==ARMARCH3 || \ + CPU==ARMARCH4 || \ + CPU==ARMARCH4_T || \ + CPU==STRONGARM || \ + CPU==XSCALE || \ + CPU==ARMARCH5 || \ + CPU==ARMARCH5_T || \ + CPU==ARMARCH6 || \ + CPU==ARMARCH6_T) +#define CPU_FAMILY ARM +#define CPU_FAMILY_PREPENDS_UNDERSCORE FALSE +#endif /* CPU_FAMILY==ARM */ + +#if (CPU==SH32 || \ + CPU==SH7000 || \ + CPU==SH7600 || \ + CPU==SH7040 || \ + CPU==SH7700 || \ + CPU==SH7410 || \ + CPU==SH7729 || \ + CPU==SH7750) +#define CPU_FAMILY SH +#define CPU_FAMILY_PREPENDS_UNDERSCORE TRUE +#endif /* CPU_FAMILY==SH */ + +#if (CPU==MCORE10 || \ + CPU==MCORE15 || \ + CPU==MCORE200 || \ + CPU==MCORE300) +#define CPU_FAMILY MCORE +#define CPU_FAMILY_PREPENDS_UNDERSCORE FALSE +#endif /* CPU_FAMILY==MCORE */ + +#if (CPU==MCF5200 || \ + CPU==MCF5400) +#define CPU_FAMILY COLDFIRE +#define CPU_FAMILY_PREPENDS_UNDERSCORE TRUE +#endif /* CPU_FAMILY==COLDFIRE */ + +#if (CPU==FR500) +#define CPU_FAMILY FRV +#define CPU_FAMILY_PREPENDS_UNDERSCORE TRUE +#endif /* CPU_FAMILY==FRV */ + +#if (CPU==MAP1000 || \ + CPU==MAP1000A || \ + CPU==MAPCA) +#define CPU_FAMILY MAP +#define CPU_FAMILY_PREPENDS_UNDERSCORE TRUE +#endif /* CPU_FAMILY==MAP */ + +#if (CPU==SIMLINUX) +#define CPU_FAMILY SIMLINUX +#define CPU_FAMILY_PREPENDS_UNDERSCORE FALSE +#endif /* CPU_FAMILY==SIMLINUX */ + +#if (CPU==SIMPENTIUM) +#define CPU_FAMILY SIMPENTIUM +#define CPU_FAMILY_PREPENDS_UNDERSCORE FALSE +#endif /* CPU_FAMILY==SIMPENTIUM */ + +/* + * Check that CPU and CPU_FAMILY are now defined correctly. + * If CPU is defined to be one of the above valid values then + * the CPU_FAMILY will have been properly selected. + * This is required in order to select the right headers + * and definitions for that CPU in subsequent headers. + * If CPU or CPU_FAMILY is not defined at this point, + * we generate an error and abort the compilation. + */ + +#if !defined(CPU) || !defined(CPU_FAMILY) +#error CPU is not defined correctly +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvxCpuh */ diff --git a/h/types/vxCpu.in b/h/types/vxCpu.in new file mode 100644 index 0000000..4c5275b --- /dev/null +++ b/h/types/vxCpu.in @@ -0,0 +1,128 @@ +/* vxCpu.h - VxWorks CPU definitions header */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* + * vxCpu.h is now generated -- DO NOT EDIT + * + * To change the boilerplate, edit vxCpu.in + * + * To add CPU types or otherwise change the substance, + * edit $WIND_BASE/host/src/target/architecturedb + */ + +/* +modification history +-------------------- +02i,10aug01,pch Rename to vxCpu.in, revise for use in generating vxCpu.h + from host/src/target/architecturedb +02m,23jul01,scm change XScale name to conform to coding standards... +02h,07may01,kab Fix PPC enum clashes +02l,04may01,scm add STRONGARM support... +02g,25oct00,s_m renamed PPC405 cpu types +02f,14jun00,alp Added PPC405 support +02k,11dec00,scm replace references to ARMSA2 with XScale +02j,31aug00,scm add sa2 support under arm +02i,20jan99,cdp marked old ARM CPU numbers 'obsoleted'. +02h,13nov98,cdp added ARMARCH3, ARMARCH4, ARMARCH4_T. +02n,28mar01,mem Update SH cpu numbers. +02m,14dec00,pes Remove more obsolete MIPS CPU designations. +02m,01dec00,??? Update ARM block +02l,06oct00,ish fix MCF5400 +02k,07jul00,dh rationalised mcf family to 2 cpus. +02j,23nov99,yvp adding CPU_FAMILY FRV and CPU type FR500 for Fujitsu FR-V + (a.k.a Venus) family processors +02i,27mar00,ish Fixed CPU identifiers in ColdFire support +02h,15mar00,dra Added ColdFire support. +02g,12oct99,yvp Merge from .../tor2_0_0.coretools-baseline branch to make + Tor2 code work with T3 main/LATEST compiler +02f,09sep99,myz added CW4000_16 support +02f,22jul99,jld Regularize CPU=MCOREx tags. +02e,17dec97,ur added MCORE support. +02f,05nov97,mem added SPARCV9 support. +02n,18oct99,dra added CW4000, CW4011, VR4100, VR5000 and VR5400 support. +02m,13jul99,bc Added SH7718 <-> sh3e +02l,02jul98,st added SH7750 support (SH4). +02k,05may98,jmc added SH-DSP and SH3-DSP support. +02j,23apr97,hk added SH support. +02i,17aug97,tpr added PowerPC EC 603 support. +02h,15aug97,cym added SIMNT support. +02g,09apr98,hdn added support for Pentium, PentiumPro. +02f,26mar97,cdp added Thumb (ARM7TDMI_T) support. +02e,28nov96,cdp added ARM support. +02d,12jul96,kkk added CW4000 & R4650 support. +02c,08feb96,tpr added PPC505 and PPC860 support. +02b,23feb96,tpr undefined the PPC macro defined by the PowerPC Gnu. +02a,26may94,yao added PPC support. +01k,24jul95,ism added SIMSOLARIS support. +01j,27dec95,myz added I960HX stuff. +01i,20mar95,kvk added I960JX specific stuff. +01h,31oct94,kdl removed comment-within-comment. +01f,27sep93,cd added R4000 support. +01g,26oct94,tmk added new cpu type MC68LC040 +01f,21jul94,tpr added MC68060 cpu. +01f,09jun93,hdn added support for I80X86 +01g,02dec93,tpr added definition for the AMD 29200 microcontroller + pad added definitions for the AMD 29030 cpu +01g,11aug93,gae vxsim hppa. +01f,22jun93,gae vxsim: added SIMSPARCSUNOS. +01e,13nov92,dnw added test for correct definition of CPU +01d,22sep92,rrr added support for c++ +01c,07sep92,smb added documentation +01b,23jul92,jwt restored SPARClite reference omitted in file creation. +01a,11jul92,smb CPU definitions moved from vxWorks.h. +*/ + +/* +DESCRIPTION +Depending on the value of CPU passed to the system by the compiler command +line, the CPU_FAMILY is defined. This must be the first header file +included by vxWorks.h. +*/ + +#ifndef __INCvxCpuh +#define __INCvxCpuh + +#ifdef __cplusplus +extern "C" { +#endif + +/* CPU types */ + +/* Turn off stuff that some compilers pre-define ... */ +#ifdef MC68000 +#undef MC68000 +#endif +#ifdef I960 +#undef I960 +#endif +#ifdef PPC +#undef PPC +#endif + +/* Ensure CPU_FAMILY undefined initially */ +#ifdef CPU_FAMILY +#undef CPU_FAMILY +#endif + +@@@@@@ this line of vxCpu.in gets replaced by generated content @@@@@@ + +/* + * Check that CPU and CPU_FAMILY are now defined correctly. + * If CPU is defined to be one of the above valid values then + * the CPU_FAMILY will have been properly selected. + * This is required in order to select the right headers + * and definitions for that CPU in subsequent headers. + * If CPU or CPU_FAMILY is not defined at this point, + * we generate an error and abort the compilation. + */ + +#if !defined(CPU) || !defined(CPU_FAMILY) +#error CPU is not defined correctly +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvxCpuh */ diff --git a/h/types/vxParams.h b/h/types/vxParams.h new file mode 100644 index 0000000..a057588 --- /dev/null +++ b/h/types/vxParams.h @@ -0,0 +1,61 @@ +/* vxParams.h - system parameters header file */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,19feb04,dat Chg name and path lengths, requested by jkf +01e,22sep92,rrr added support for c++ +01d,07sep92,smb added documentation +01c,22jul92,kdl reduced _PARM_PATH_MAX from 511 to 255. +01b,03jul92,smb corrected comment after #endif + modified values for _PARM_PATH_MAX and _PARM_NAME_MAX +01a,29jul91,rrr written. +*/ + +/* +DESCRIPTION +This file defines system parameters specified by the ANSI or POSIX +specifications. The actual value are sometimes suggested by the standards +but can be changed to tune the system. +*/ + +#ifndef __INCvxParamsh +#define __INCvxParamsh + +#ifdef __cplusplus +extern "C" { +#endif + +#define _PARM_BUFSIZ 1024 +#define _PARM_EXIT_FAILURE 1 +#define _PARM_EXIT_SUCCESS 0 +#define _PARM_FILENAME_MAX 20 +#define _PARM_FOPEN_MAX 20 +#define _PARM_L_ctermid 64 +#define _PARM_L_cuserid 64 +#define _PARM_L_tmpnam 64 +#define _PARM_MB_CUR_MAX 1 /* must not be greater than MB_LEN_MAX*/ +#define _PARM_NAME_MAX 255 +#define _PARM_PATH_MAX 1023 /* max path length, not including EOS */ +#define _PARM_RAND_MAX 32767 /* as defined by the ANSI spec. */ +#define _PARM_TMP_MAX 64 + +#define _PARM_UTS_MACHINE_MAX 64 +#define _PARM_UTS_NODENAME_MAX 64 +#define _PARM_UTS_RELEASE_MAX 64 +#define _PARM_UTS_SYSNAME_MAX 64 +#define _PARM_UTS_VERSION_MAX 64 + +#define _PARM_BIG_ENDIAN 1234 +#define _PARM_LITTLE_ENDIAN 4321 +#define _PARM_STACK_GROWS_UP 1 +#define _PARM_STACK_GROWS_DOWN (-1) + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvxParamsh */ diff --git a/h/types/vxTypes.h b/h/types/vxTypes.h new file mode 100644 index 0000000..148ddeb --- /dev/null +++ b/h/types/vxTypes.h @@ -0,0 +1,250 @@ +/* vxTypes.h - POSIX compliant (_t) types header file */ + +/* + * Copyright (c) 1991-1992, 2001, 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. +*/ + +/* +modification history +-------------------- +01p,08sep05,pad Added protection around ssize_t type definition (SPR 112064). +01o,24aug05,mcm Adding the definition of the protection macros to help + prevent redefinition for ssize_t, time_t and fpos_t. +01n,23aug05,mcm Adding protection for type definitions like uid_t, off_t etc. +01m,31mar05,kk merged user and kernel version +01l,28sep04,gls changed off_t to long long +01k,04dec03,mcm Protecting the definition of fpos_t, time_t +01j,29aug03,cjj written based on kernel version 01d of vxTypes.h +01i,25jan05,vvv added new types to support the dual-stack +01h,28sep04,gls added off_t64 +01g,05dec01,mem Added support for 64-bit types. +01f,13nov92,dnw added include of vxANSI.h + pruned some non-POSIX stuff. +01e,22sep92,rrr added support for c++ +01d,08sep92,smb made some MIPS specific additions. +01c,07sep92,smb added __STDC__ conditional and some documentation. +01b,29jul92,smb added fpos_t type for stdio.h +01a,03jul92,smb written. +*/ + +/* +DESCRIPTION +This file actually typedef's the system types defined in vxArch.h or +vxTypesBase.h. + +Architecture specific values for the standard types are defined in vxArch.h +as follows: + + #ifndef _TYPE_sometype_t + #define _TYPE_sometype_t typedef unsigned int sometype_t + #endif + +Defaults for each type are provided in vxTypesBase.h as follows: + + #ifndef _TYPE_sometype_t + #define _TYPE_sometype_t typedef int sometype_t + #endif + +When vxTypesBase.h is included following the include of vxArch.h, +_TYPE_sometype_t will already be defined and so will not be redefined +in vxTypesBase.h. + +Alternatively, if it not defined in vxArch.h, it will be defined in +vxTypesBase.h. So after vxArch.h and vxTypesBase.h are included all ANSI +and POSIX types will be defined but they will not have been typedef'ed yet. + +The typedef happens in this file, vxTypes.h + + #ifdef _TYPE_sometype_t + _TYPE_sometype_t + #undef _TYPE_sometype_t + #endif + +The '#undef _TYPE_sometype_t' is necessary because a type may be defined in +different header files. For example, ANSI says that size_t must be defined +in time.h and stddef.h + +*/ + +#ifndef __INCvxTypesh +#define __INCvxTypesh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _WRS_KERNEL +#include "types/vxANSI.h" +#endif /* _WRS_KERNEL */ + +#ifdef _TYPE_ssize_t +#ifndef _SSIZE_T +#define _SSIZE_T +_TYPE_ssize_t; +#undef _TYPE_ssize_t +#endif +#endif + +#if !defined(__RTP__) +#ifdef _TYPE_time_t +#define _TIME_T +_TYPE_time_t; +#undef _TYPE_time_t +#endif +#endif /* __RTP__ */ + +#if !defined(__RTP__) +#ifdef _TYPE_fpos_t +#define _FPOS_T +_TYPE_fpos_t; +#undef _TYPE_fpos_t +#endif +#endif /* __RTP__ */ + +#ifdef _TYPE_int8_t +_TYPE_int8_t; +#undef _TYPE_int8_t +#endif + +#ifdef _TYPE_uint8_t +_TYPE_uint8_t; +#undef _TYPE_uint8_t +#endif + +#ifdef _TYPE_int16_t +_TYPE_int16_t; +#undef _TYPE_int16_t +#endif + +#ifdef _TYPE_uint16_t +_TYPE_uint16_t; +#undef _TYPE_uint16_t +#endif + +#ifdef _TYPE_int32_t +_TYPE_int32_t; +#undef _TYPE_int32_t +#endif + +#ifdef _TYPE_uint32_t +_TYPE_uint32_t; +#undef _TYPE_uint32_t +#endif + +#ifdef _TYPE_int64_t +_TYPE_int64_t; +#undef _TYPE_int64_t +#endif + +#ifdef _TYPE_uint64_t +_TYPE_uint64_t; +#undef _TYPE_uint64_t +#endif + +/* The following types have been added to support the dual-stack */ + +#ifdef _TYPE_u_int8_t +_TYPE_u_int8_t; +#undef _TYPE_u_int8_t +#endif + +#ifdef _TYPE_u_int16_t +_TYPE_u_int16_t; +#undef _TYPE_u_int16_t +#endif + +#ifdef _TYPE_u_int32_t +_TYPE_u_int32_t; +#undef _TYPE_u_int32_t +#endif + +#ifdef _TYPE_u_int64_t +_TYPE_u_int64_t; +#undef _TYPE_u_int64_t +#endif + +#ifdef _TYPE_u_quad_t +_TYPE_u_quad_t; +#undef _TYPE_u_quad_t +#endif + +#ifdef _TYPE_quad_t +_TYPE_quad_t; +#undef _TYPE_quad_t +#endif + + +/* old Berkeley definitions */ + +typedef unsigned char uchar_t; +typedef unsigned short ushort_t; +typedef unsigned int uint_t; +typedef unsigned long ulong_t; + +typedef struct _quad { long val[2]; } quad; +typedef long daddr_t; +typedef char * caddr_t; +typedef char * addr_t; +typedef long swblk_t; + +/* POSIX required */ + +#ifndef _DEV_T +#define _DEV_T +typedef short dev_t; +#endif /* _DEV_T */ + +#ifndef _GID_T +#define _GID_T +typedef unsigned short gid_t; +#endif /* _GID_T */ + +#ifndef _INO_T +#define _INO_T +typedef unsigned long ino_t; +#endif /* _INO_T */ + +#ifndef _MODE_T +#define _MODE_T +typedef int mode_t; +#endif /* _MODE_T */ + +#ifndef _NLINK_T +#define _NLINK_T +typedef unsigned long nlink_t; +#endif /* _NLINK_T */ + +#ifndef _OFF_T +#define _OFF_T +#ifdef __RTP__ +typedef long long off_t; +#else +typedef long off_t; +#ifndef _OFF_T64 +#define _OFF_T64 +typedef long long off_t64; +#endif /* _OFF_T64 */ +#endif /* __RTP__ */ +#endif /* _OFF_T */ + +#ifndef _PID_T +#define _PID_T +typedef int pid_t; +#endif /* _PID_T */ + +#ifndef _UID_T +#define _UID_T +typedef unsigned short uid_t; +#endif /* _UID_T */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvxTypesh */ diff --git a/h/types/vxTypesBase.h b/h/types/vxTypesBase.h new file mode 100644 index 0000000..d1b9d2a --- /dev/null +++ b/h/types/vxTypesBase.h @@ -0,0 +1,403 @@ +/* vxTypesBase.h - default types (when undefined) header file */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02e,25jan05,vvv added new types for dual-stack support +02d,05dec01,mem Added support for 64-bit types. +02c,14dec99,dra Added simulator/coretools support. +02b,03mar98,bc fixed _ARCH_*_MIN definitions to avoid compiler warnings +02b,01apr99,bc Deleted size_t, etc. They belong in a toolchain header (stddef.h). +02a,12feb98,mrs fixed wchar_t for c++ +01i,08nov94,dvs cleaned values for _ARCH_FLT_EPSILON and _ARCH_FLT_MIN + that got munged in clear case conversion +01h,18oct93,cd added __STDC__ definitions for unsigned maximum values. +01g,13nov92,dnw pruned some non-POSIX stuff +01f,22sep92,rrr added support for c++ +01e,07sep92,smb added __STDC__ conditional and documentation. +01d,30jul92,jwt made safe for assembly language files. +01c,30jul92,gae added timer_t; fixed clock_t, fpos_t. +01b,29jul92,smb added type define for fpos_t. +01a,03jul92,smb written +*/ + +/* +DESCRIPTION +Types not defined by the architecture specific header file will be +defined here so that a complete set of definitions are achieved. +For this reason this file, vxTypesBase.h must be included after vxArch.h +in which the architecture definitions are located. +*/ + +#ifndef __INCvxTypesBaseh +#define __INCvxTypesBaseh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +#include + +/* global typedefs */ + +#ifndef _TYPE_sig_atomic_t +#define _TYPE_sig_atomic_t typedef unsigned int sig_atomic_t +#endif + +#ifndef _TYPE_timer_t +struct __timer; +#define _TYPE_timer_t typedef struct __timer *timer_t +#endif + +#ifndef _TYPE_clock_t +#define _TYPE_clock_t typedef unsigned int clock_t +#endif + +#ifndef _TYPE_time_t +#define _TYPE_time_t typedef unsigned long time_t +#endif + +#ifndef _TYPE_fpos_t +#define _TYPE_fpos_t typedef long fpos_t +#endif + +#ifndef _TYPE_int8_t +#if defined(__STDC__) || defined(__cplusplus) +#define _TYPE_int8_t typedef signed char int8_t +#else +#define _TYPE_int8_t typedef char int8_t +#endif +#endif + +#ifndef _TYPE_uint8_t +#define _TYPE_uint8_t typedef unsigned char uint8_t +#endif + +#ifndef _TYPE_int16_t +#define _TYPE_int16_t typedef short int16_t +#endif + +#ifndef _TYPE_uint16_t +#define _TYPE_uint16_t typedef unsigned short uint16_t +#endif + +#ifndef _TYPE_int32_t +#define _TYPE_int32_t typedef long int32_t +#endif + +#ifndef _TYPE_uint32_t +#define _TYPE_uint32_t typedef unsigned long uint32_t +#endif + +#ifndef _TYPE_int64_t +#define _TYPE_int64_t typedef long long int64_t +#endif + +#ifndef _TYPE_uint64_t +#define _TYPE_uint64_t typedef unsigned long long uint64_t +#endif + +#ifndef _TYPE_div_t +#define _TYPE_div_t typedef struct { int quot; int rem; } div_t +#endif + +#ifndef _TYPE_ldiv_t +#define _TYPE_ldiv_t typedef struct { long quot; long rem; } ldiv_t +#endif + +#ifndef _TYPE_ssize_t +#define _TYPE_ssize_t typedef int ssize_t +#endif + +/* The following types were added to support the dual-stack */ + +#ifndef _TYPE_u_int8_t +#define _TYPE_u_int8_t typedef unsigned char u_int8_t +#endif + +#ifndef _TYPE_u_int16_t +#define _TYPE_u_int16_t typedef unsigned short u_int16_t +#endif + +#ifndef _TYPE_u_int32_t +#define _TYPE_u_int32_t typedef unsigned int u_int32_t +#endif + +#ifndef _TYPE_u_int64_t +#define _TYPE_u_int64_t typedef unsigned long long u_int64_t +#endif + +#ifndef _TYPE_u_quad_t +#define _TYPE_u_quad_t typedef unsigned long long u_quad_t +#endif + +#ifndef _TYPE_quad_t +#define _TYPE_quad_t typedef long long quad_t +#endif + + +/* + * stuff for setjmp.h + */ +#ifndef _ARCH_jmp_buf_len +#define _ARCH_jmp_buf_len 8 +#endif + +/* + * stuff for stdarg.h + */ +#ifndef _ARCH_va_arg +#define _ARCH_va_arg(list, type) ((type *)(list += sizeof(type)))[-1] +#endif + +#ifndef _ARCH_va_end +#define _ARCH_va_end(list) +#endif + +#ifndef _ARCH_va_start +#define _ARCH_va_start(list, last_arg) (list = (va_list)(&last_arg + 1)) +#endif + +#ifndef _ARCH_va_list +#define _ARCH_va_list typedef char *va_list +#endif + +#endif /* _ASMLANGUAGE */ + +/* + * stuff for limits.h + */ +#ifndef _ARCH_MB_LEN_MAX +#define _ARCH_MB_LEN_MAX 1 +#endif + +#ifndef _ARCH_CHAR_BIT +#define _ARCH_CHAR_BIT 8 +#endif + +#ifndef _ARCH_CHAR_MAX +#define _ARCH_CHAR_MAX 127 +#endif + +#ifndef _ARCH_CHAR_MIN +#define _ARCH_CHAR_MIN (-127-1) +#endif + +#ifndef _ARCH_SHRT_MAX +#define _ARCH_SHRT_MAX 32767 +#endif + +#ifndef _ARCH_SHRT_MIN +#define _ARCH_SHRT_MIN (-32767-1) +#endif + +#ifndef _ARCH_INT_MAX +#define _ARCH_INT_MAX 2147483647 +#endif + +#ifndef _ARCH_INT_MIN +#define _ARCH_INT_MIN (-2147483647-1) +#endif + +#ifndef _ARCH_LONG_MAX +#define _ARCH_LONG_MAX 2147483647 +#endif + +#ifndef _ARCH_LONG_MIN +#define _ARCH_LONG_MIN (-2147483647-1) +#endif + +#ifndef _ARCH_SCHAR_MAX +#define _ARCH_SCHAR_MAX 127 +#endif + +#ifndef _ARCH_SCHAR_MIN +#define _ARCH_SCHAR_MIN (-127-1) +#endif + +#ifndef _ARCH_UCHAR_MAX +#define _ARCH_UCHAR_MAX 255 +#endif + +#ifndef _ARCH_USHRT_MAX +#define _ARCH_USHRT_MAX 65535 +#endif + +#ifndef _ARCH_UINT_MAX +#ifdef __STDC__ +#define _ARCH_UINT_MAX 4294967295u +#else +#define _ARCH_UINT_MAX 4294967295 +#endif +#endif + +#ifndef _ARCH_ULONG_MAX +#ifdef __STDC__ +#define _ARCH_ULONG_MAX 4294967295u +#else +#define _ARCH_ULONG_MAX 4294967295 +#endif +#endif + +/* + * stuff for float.h + */ +#ifndef _ARCH_FLT_RADIX +#define _ARCH_FLT_RADIX 2 +#endif + +#ifndef _ARCH_FLT_MANT_DIG +#define _ARCH_FLT_MANT_DIG 24 +#endif + +#ifndef _ARCH_FLT_DIG +#define _ARCH_FLT_DIG 7 /* not correct in ANSI spec.s */ +#endif + +#ifndef _ARCH_FLT_ROUNDS +#define _ARCH_FLT_ROUNDS 1 +#endif + +#ifndef _ARCH_FLT_EPSILON +#define _ARCH_FLT_EPSILON 1.19209290e-07F +#endif + +#ifndef _ARCH_FLT_MIN_EXP +#define _ARCH_FLT_MIN_EXP (-125) +#endif + +#ifndef _ARCH_FLT_MIN +#define _ARCH_FLT_MIN 1.17549435e-38F +#endif + +#ifndef _ARCH_FLT_MIN_10_EXP +#define _ARCH_FLT_MIN_10_EXP (-37) +#endif + +#ifndef _ARCH_FLT_MAX_EXP +#define _ARCH_FLT_MAX_EXP 128 +#endif + +#ifndef _ARCH_FLT_MAX +#define _ARCH_FLT_MAX 3.40282347e+38F +#endif + +#ifndef _ARCH_FLT_MAX_10_EXP +#define _ARCH_FLT_MAX_10_EXP 38 +#endif + +#ifndef _ARCH_DBL_MANT_DIG +#define _ARCH_DBL_MANT_DIG 53 +#endif + +#ifndef _ARCH_DBL_DIG +#define _ARCH_DBL_DIG 15 +#endif + +#ifndef _ARCH_DBL_EPSILON +#define _ARCH_DBL_EPSILON 2.2204460492503131e-16 +#endif + +#ifndef _ARCH_DBL_MIN_EXP +#define _ARCH_DBL_MIN_EXP (-1021) +#endif + +#ifndef _ARCH_DBL_MIN +#define _ARCH_DBL_MIN 2.2250738585072014e-308 +#endif + +#ifndef _ARCH_DBL_MIN_10_EXP +#define _ARCH_DBL_MIN_10_EXP (-307) +#endif + +#ifndef _ARCH_DBL_MAX_EXP +#define _ARCH_DBL_MAX_EXP 1024 +#endif + +#ifndef _ARCH_DBL_MAX +#define _ARCH_DBL_MAX 1.7976931348623157e+308 +#endif + +#ifndef _ARCH_DBL_MAX_10_EXP +#define _ARCH_DBL_MAX_10_EXP 308 +#endif + +#ifndef _ARCH_LDBL_MANT_DIG +#define _ARCH_LDBL_MANT_DIG 53 +#endif + +#ifndef _ARCH_LDBL_DIG +#define _ARCH_LDBL_DIG 15 +#endif + +#ifndef _ARCH_LDBL_EPSILON +#define _ARCH_LDBL_EPSILON 2.2204460492503131e-16L +#endif + +#ifndef _ARCH_LDBL_MIN_EXP +#define _ARCH_LDBL_MIN_EXP (-1021) +#endif + +#ifndef _ARCH_LDBL_MIN +#define _ARCH_LDBL_MIN 2.2250738585072014e-308L +#endif + +#ifndef _ARCH_LDBL_MIN_10_EXP +#define _ARCH_LDBL_MIN_10_EXP (-307) +#endif + +#ifndef _ARCH_LDBL_MAX_EXP +#define _ARCH_LDBL_MAX_EXP 1024 +#endif + +#ifndef _ARCH_LDBL_MAX +#define _ARCH_LDBL_MAX 1.7976931348623157e+308L +#endif + +#ifndef _ARCH_LDBL_MAX_10_EXP +#define _ARCH_LDBL_MAX_10_EXP 308 +#endif + +/* + * stuff for math.h + */ +#ifndef _ARCH_HUGH_VAL +#define _ARCH_HUGH_VAL _ARCH_DBL_MAX +#endif + +/* + * stuff for the kernel + */ +#ifndef _ARCH_BYTE_ORDER +#define _ARCH_BYTE_ORDER _PARM_BIG_ENDIAN +#endif + +#ifndef _ARCH_STACK_DIR +#define _ARCH_STACK_DIR _PARM_STACK_GROWS_DOWN +#endif + +#ifndef _ARCH_ALIGN_STACK +#define _ARCH_ALIGN_STACK 4 +#endif + +#ifndef _ARCH_ALIGN_MEMORY +#define _ARCH_ALIGN_MEMORY 4 +#endif + +#ifndef _ARCH_ALIGN_REGS +#define _ARCH_ALIGN_REGS 4 +#endif + +#ifndef _ARCH_MOVE_SIZE +#define _ARCH_MOVE_SIZE 4 +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvxTypesBaseh */ diff --git a/h/types/vxTypesOld.h b/h/types/vxTypesOld.h new file mode 100644 index 0000000..2b75294 --- /dev/null +++ b/h/types/vxTypesOld.h @@ -0,0 +1,362 @@ +/* vxTypesOld.h - old VxWorks type definition header */ + +/* + * Copyright (c) 1990-1997, 2000-2001, 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. +*/ + +/* +modification history +-------------------- +02x,24aug05,mcm Adding protection for STATUS. +02w,23aug05,mcm Protecting definitions of the funcptr types to prevent + redefinition errors. +02v,18aug05,mcm Adding a macro to detect the definition of fd_set etc. +02u,01oct04,tam defined PHYS_ADDR only for kernel side +02t,30sep04,yvp Added LOW32 and HIGH32 definitions. +02s,29nov03,yp moving ADDR to pgPoolLibP.h +02r,14oct03,sru Added 'signed' to INT8..INT32 typedefs; also, allow + VIRT_ADDR and PHYS_ADDR types to be defined in an + architecture-specific manner. +02q,11aug03,yp adding VIRT_ADDR and PHYS_ADDR +02p,18aug03,dbt Added PAL support for VxSim. +02o,07may03,pes PAL conditional compilation cleanup. Phase 2. Moving + arch-specific definitions out to arch files. +02n,17apr03,dbt Added SIMLINUX support. Removed SIMHPPA and SIMSPARCSUNOS. +02m,05dec01,mem Added INT64 and UINT64. +02l,27nov01,sbs changed FD_SETSIZE from 256 to 2048 (SPR #9377) +02k,22oct01,dee Merge from T2.1.0 ColdFire +02j,18apr01,mem Updated Arm/Thumb detection. +02i,25feb00,frf Add SH support for T2 +02h,15aug97,cym added simnt support. +02g,26mar97,cdp added Thumb (ARM7TDMI_T) support. +02f,28nov96,cdp added ARM support. +02e,28sep95,ms removed "static __inline__" (SPR #4500) +02d,12jul95,ism added simsolaris support +02c,19mar95,dvs removed tron references. +02b,01sep94,ism fixed comment as per SPR# 1512. +02a,02dec93,pme added Am29K family support. +01z,12jun93,rrr vxsim. +01y,26may94,yao added PPC support. +01x,09jun93,hdn added support for I80X86 +01w,12feb93,srh added C++ versions of FUNCPTR, et al. +01v,13nov92,dnw added definition of VOID (SPR #1781) +01u,02oct92,srh replaced conditional around volatile, const, and signed so + they won't be elided when __STDC__ is defined. + added __cplusplus to __STDC__ condition. +01t,22sep92,rrr added support for c++ +01s,08sep92,smb made some additions for the MIPS. +01r,07sep92,smb added __STDC__ and modes to maintain compatibility with 5.0 +01q,07jul92,rrr moved STACK_GROW and ENDIAN to vxArch.h +01p,03jul92,smb changed name from vxTypes.h. +01o,26may92,rrr the tree shuffle +01n,25nov91,llk included sys/types.h. +01m,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -removed TINY and UTINY + -changed VOID to void + -changed ASMLANGUAGE to _ASMLANGUAGE + -changed copyright notice +01l,01oct91,jpb fixed MIPS conditional for undefined CPU_FAMILY. +01k,20sep91,wmd conditionalized out defines for const, unsigned and volatile + for the MIPS architecture. +01j,02aug91,ajm added support for MIPS_R3k. +01i,15may91,gae added define for "signed" when not available for pre-ANSI. +01h,29apr91,hdn added defines and macros for TRON architecture. +01g,28apr91,del added defines of __volatile__ and __const__ if !_STDC_ + && _GNUC__ +01f,24mar91,del added INSTR * define for I960. +01e,28jan91,kdl added DBLFUNCPTR and FLTFUNCPTR. +01d,25oct90,dnw changed void to void except when linting. +01c,05oct90,shl added copyright notice. + made #endif ANSI style. +01b,10aug90,dnw added VOIDFUNCPTR +01a,29may90,del written. +*/ + +/* +DESCRIPTION +This header file contains a mixture of stuff. +1) the old style typedefs (ie. POSIX now says they must end with _t). + These will be phased out gradually. +2) a mechanism for getting rid of const warning which are produced by the + GNU C compiler. Hopefully, this will be removed in the future. +3) macros that are so longer needed for vxWorks source code but maybe needed + by some customer applications and are therefore provided for backward + compatability. +4) system III typedefs (used by netinet) which do not fit in anywhere else. + +*/ + +#ifndef __INCvxTypesOldh +#define __INCvxTypesOldh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "sys/types.h" + +/* vxWorks types */ + +typedef signed char INT8; +typedef signed short INT16; +typedef signed int INT32; +typedef signed long long INT64; + +typedef unsigned char UINT8; +typedef unsigned short UINT16; +typedef unsigned int UINT32; +typedef unsigned long long UINT64; + +typedef unsigned char UCHAR; +typedef unsigned short USHORT; +typedef unsigned int UINT; +typedef unsigned long ULONG; + +typedef int BOOL; +typedef int ARGINT; +typedef void VOID; + +#ifndef _STATUS_DEFINED +#define _STATUS_DEFINED +typedef int STATUS; +#endif /* _STATUS_DEFINED */ + +#ifndef _FUNCPTR_DEFINED +#define _FUNCPTR_DEFINED +#ifdef __cplusplus +typedef int (*FUNCPTR) (...); /* ptr to function returning int */ +#else +typedef int (*FUNCPTR) (); /* ptr to function returning int */ +#endif /* __cplusplus */ +#endif /* _FUNCPTR_DEFINED */ + +#ifndef _VOIDFUNCPTR_DEFINED +#define _VOIDFUNCPTR_DEFINED +#ifdef __cplusplus +typedef void (*VOIDFUNCPTR) (...); /* ptr to function returning void */ +#else +typedef void (*VOIDFUNCPTR) (); /* ptr to function returning void */ +#endif /* __cplusplus */ +#endif /* _VOIDFUNCPTR_DEFINED */ + +#ifndef _DBLFUNCPTR_DEFINED +#define _DBLFUNCPTR_DEFINED +#ifdef __cplusplus +typedef double (*DBLFUNCPTR) (...); /* ptr to function returning double*/ +#else +typedef double (*DBLFUNCPTR) (); /* ptr to function returning double*/ +#endif /* __cplusplus */ +#endif /* _DBLFUNCPTR_DEFINED */ + +#ifndef _FLTFUNCPTR_DEFINED +#define _FLTFUNCPTR_DEFINED +#ifdef __cplusplus +typedef float (*FLTFUNCPTR) (...); /* ptr to function returning float */ +#else +typedef float (*FLTFUNCPTR) (); /* ptr to function returning float */ +#endif /* __cplusplus */ +#endif /* _FLTFUNCPTR_DEFINED */ + + +/* This structure and the following definitions are needed to get rid + of const warning produced by the GNU C compiler. + */ + +#if defined(__STDC__) || defined(__cplusplus) +typedef union + { + long pm_int; + void *pm_v; + const void *pm_cv; + char *pm_c; + unsigned char *pm_uc; + + signed char *pm_sc; + const char *pm_cc; + const unsigned char *pm_cuc; + const signed char *pm_csc; + short *pm_s; + ushort_t *pm_us; + const short *pm_cs; + const ushort_t *pm_cus; + int *pm_i; + uint_t *pm_ui; + const int *pm_ci; + const uint_t *pm_cui; + long *pm_l; + ulong_t *pm_ul; + const long *pm_cl; + const ulong_t *pm_cul; + + int8_t *pm_i8; + uint8_t *pm_ui8; + const int8_t *pm_ci8; + const uint8_t *pm_cui8; + int16_t *pm_i16; + uint16_t *pm_ui16; + const int16_t *pm_ci16; + const uint16_t *pm_cui16; + int32_t *pm_i32; + uint32_t *pm_ui32; + const int32_t *pm_ci32; + const uint32_t *pm_cui32; +#if _ARCH_MOVE_SIZE > 4 + int64_t *pm_i64; + const int64_t *pm_ci64; +#if _ARCH_MOVE_SIZE > 8 + int128_t *pm_i128; + const int128_t *pm_ci128; +#endif +#endif + } pointer_mix_t; + +#define CHAR_FROM_CONST(x) (char *)(x) +#define VOID_FROM_CONST(x) (void *)(x) + +#endif /* __STDC__ */ + +#define STACK_DIR _ARCH_STACK_DIR +#define ALIGN_MEMORY _ARCH_ALIGN_MEMORY +#define ALIGN_STACK _ARCH_ALIGN_STACK +#define ALIGN_REGS _ARCH_ALIGN_REGS + +#ifndef NBBY +#define NBBY 8 /* number of bits in a byte */ +#endif + +/* modes - must match O_RDONLY/O_WRONLY/O_RDWR in ioLib.h! */ + +#define READ 0 +#define WRITE 1 +#define UPDATE 2 + +/* Select uses bit masks of file descriptors in longs. + * These macros manipulate such bit fields (the filesystem macros use chars). + * FD_SETSIZE may be defined by the user, but the default here + * should be >= maxFiles parameter in iosInit call found in usrConfig.c. + * If this define is changed, recompile the source, or else select() will + * not work.(The user can set the number lower, but not higher). + * + * Changing the default to 2048 adds 224 bytes to the size of the fd_set + * structure. + */ + +#ifndef FD_SETSIZE +#define FD_SETSIZE 2048 +#endif /* FD_SETSIZE */ + +#ifndef _FD_MASK_DEFINED +#define _FD_MASK_DEFINED +typedef long fd_mask; +#endif /* _FD_MASK_DEFINED */ + +#ifndef NFDBITS +#define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */ +#endif /* NFDBITS */ + +#ifndef howmany +#define howmany(x, y) ((unsigned int)(((x)+((y)-1)))/(unsigned int)(y)) +#endif /* howmany */ + +#ifndef _FD_SET_DEFINED +#define _FD_SET_DEFINED +typedef struct fd_set + { + fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; + } fd_set; +#endif + +#ifndef _FD_FUNC_DEFINED +#define _FD_FUNC_DEFINED +#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) +#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) +#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) +#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p))) +#endif /* _FD_FUNC_DEFINED */ + +/* system III typedefs (used by netinet) */ + +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; +typedef unsigned short ushort; + + +/* historical definitions - now obsolete */ + +typedef char TBOOL; /* obsolete */ + +/* new memory management global defines */ + +#ifndef _TYPE_VIRT_ADDR +#define _TYPE_VIRT_ADDR typedef UINT32 VIRT_ADDR +#endif +_TYPE_VIRT_ADDR; + +#ifdef _WRS_KERNEL +#ifndef _TYPE_PHYS_ADDR +#define _TYPE_PHYS_ADDR typedef UINT32 PHYS_ADDR +#endif +_TYPE_PHYS_ADDR; +#endif /* _WRS_KERNEL */ + +/* macro's for extracting 32-bit halves of a 64-bit number */ + +#define LOW32(x) (long) (((long long)(x)) & (unsigned long) 0xffffffff) +#define HIGH32(x) (long) ((((long long)(x)) >> 32) & (unsigned long)0xffffffff) + +/* architecture dependent typedefs */ + +#ifdef CPU_FAMILY + +#if CPU_FAMILY==MC680X0 +typedef unsigned short INSTR; /* word-aligned instructions */ +#endif /* CPU_FAMILY==MC680X0 || CPU_FAMILY==SH */ + +#if CPU_FAMILY==SPARC +typedef unsigned long INSTR; /* 32 bit word-aligned instructions */ +#endif /* CPU_FAMILY==SPARC */ + +#if CPU_FAMILY==I960 +typedef unsigned long INSTR; /* 32 bit word-aligned instructions */ +#endif /* CPU_FAMILY==I960 */ + +#if CPU_FAMILY==AM29XXX +typedef unsigned long INSTR; /* 32 bit word-aligned instructions */ +#endif /* CPU_FAMILY==AM29XXX */ + +#if CPU_FAMILY==COLDFIRE +typedef unsigned short INSTR; /* word-aligned instructions */ +#endif /* CPU_FAMILY==COLDFIRE */ + +#endif /* CPU_FAMILY */ + +/* ANSI type qualifiers */ + +#if !defined(__STDC__) && !defined(__cplusplus) + +#ifdef __GNUC__ +#define volatile __volatile__ +#define const __const__ +#define signed __signed__ +#else +#if !(defined(CPU_FAMILY) && CPU_FAMILY==MIPS) +#define volatile +#define const +#define signed +#endif /* !(defined(CPU_FAMILY) && CPU_FAMILY==MIPS) */ +#endif /* __GNUC__ */ + +#endif /* !defined(__STDC__) && !defined(__cplusplus) */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvxTypesOldh */ diff --git a/h/types/vxWind.h b/h/types/vxWind.h new file mode 100644 index 0000000..f218d23 --- /dev/null +++ b/h/types/vxWind.h @@ -0,0 +1,90 @@ +/* vxWind.h - WIND object types header file */ + +/* Copyright 1999-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01z,26aug05,gls updated VX_SEMAPHORE_SIZE (SPR #111547) +01y,11aug05,yvp Added VX_xxx_SIZE macros. +01x,03feb05,kk added OBJ_HANDLE typedef +01w,29mar04,dcc moved enum definitions to vxWindCommon.h +01v,01mar04,dcc modified handleTypeStart to be 100. +01u,02dec03,bwa removed all MsgC/S references +01t,04nov03,kk added windSdClass for shared data +01s,29oct03,kam ISR Object code inspection mods +01r,30sep03,ans Added windTimerClass +01q,04may03,kam added windIsr class definition +01p,04jun03,bwa Added 'windMsgCClass' and 'windMsgSClass' definitions. +01o,11jul03,rec merge in vxWind.h@@/main/base6_itn1_kernel-int/5 +01n,20jun03,bwa added typedefs of MSG_C_ID and MSG_S_ID +01m,04jun03,bwa Added 'windMsgCClass' and 'windMsgSClass' definitions. +01l,09may03,to replace PD with RTP. +01k,28mar03,dcc ported from AE1.1 +01j,13mar01,ahm Added windSetClass (SPR# 64431) +01i,19sep00,dbs add hamHandleType to handleType enum +01h,24aug00,bwa added #ifndef _ASMLANGUAGE +01g,18jul00,bwa put typedefs of _ID here and removed them from their + respective files (SPR #32543) +01f,12jun00,aeg added windOmsClass to windObjClassType. +01e,19jan00,jkf added cbio handle type +01d,18jan00,jgn add new handle type for environments +01c,07jan00,aeg added handleType and windObjClassType enums. +01b,27jan99,aeg changed OBJ_ID typedef to void * +01a,07jan99,mak written. +*/ + +/* +DESCRIPTION +This file typedefs the opaque types for WIND kernel objects. They +are typedef-ed here so that other header files can declare functions +containing more than one of these types as parameters without having +to include each other - which could cause circular header file +inclusion problems. + +The Wind object type and handle type enumerations are also defined here. +*/ + +#ifndef __INCvxWindh +#define __INCvxWindh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWindCommon.h" /* windObjClassType and handleType enum defs */ + +#define VX_SEMAPHORE_SIZE 108 +#define VX_MSG_Q_SIZE 152 +#define VX_WDOG_SIZE 92 + +#ifndef _ASMLANGUAGE + +typedef int OBJ_HANDLE; + +typedef void * OBJ_ID; +typedef struct wind_class * CLASS_ID; +typedef struct wind_group * GROUP_ID; + +typedef struct msg_q * MSG_Q_ID; +typedef struct semaphore * SEM_ID; +typedef struct wind_rtp * RTP_ID; +typedef struct wind_task * TASK_ID; +typedef struct wdog * WDOG_ID; +typedef struct page_pool_obj * PAGE_POOL_ID; +typedef struct pgMgrObj * PAGE_MGR_ID; +typedef struct vm_context * VM_CONTEXT_ID; +typedef struct mem_part * PART_ID; +typedef struct wind_isr * ISR_ID; +#if 0 /* XXX these will be moved here soon */ +typedef struct wind_dms * DMS_ID; +#endif +typedef struct wind_sd * SD_ID; + +#endif /* #ifndef _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvxWindh */ diff --git a/h/types/vxWindCommon.h b/h/types/vxWindCommon.h new file mode 100644 index 0000000..d847b00 --- /dev/null +++ b/h/types/vxWindCommon.h @@ -0,0 +1,112 @@ +/* vxWindCommon.h - Common WIND object types header file */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,29jul04,dcc removed windOmsClass from windObjClassType enum. +01a,29mar04,dcc created from vxWind.h 01v, kernel version. +*/ + +/* +DESCRIPTION +This file typedefs the opaque types for WIND kernel objects. They +are typedef-ed here so that other header files can declare functions +containing more than one of these types as parameters without having +to include each other - which could cause circular header file +inclusion problems. + +The Wind object type and handle type enumerations are also defined here. +*/ + +#ifndef __INCvxWindCommonh +#define __INCvxWindCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* + * The values for Wind object types and handle types are defined in + * the enumerated types windObjClassType and handleType, respectively. + * The values for Wind objects begin at 0, and the value for handle + * based structs begin at 1000. The non-overlapping range of values + * allows tools to easily distinguish between Wind objects, which contain + * a HANDLE struct as the first field, and handle based structures by + * examining the type field of the HANDLE struct. + * + * Do not shuffle or delete any types without updating the various host + * tools that depend on these definitions, e.g. XML and TOM. + */ + +enum windObjClassType + { + windInvalidClass = 0, /* invalid class type class */ + windSemClass, /* Wind native semaphore */ + windSemPxClass, /* POSIX semaphore */ + windMsgQClass, /* Wind native message queue */ + windMqPxClass, /* POSIX message queue */ + windRtpClass, /* real time process */ + windTaskClass, /* task */ + windWdClass, /* watchdog */ + windFdClass, /* file descriptor */ + windPgPoolClass, /* page pool */ + windPgMgrClass, /* page manager */ + windGrpClass, /* group */ + windVmContextClass, /* virtual memory context */ + windTrgClass, /* trigger */ + windMemPartClass, /* memory partition */ + windI2oClass, /* I2O */ + windDmsClass, /* device management system */ + windSetClass, /* Set */ + windIsrClass, /* ISR object */ + windTimerClass, /* Timer services */ + windSdClass, /* Shared data region */ + + /* + * The value of 'windNumObjClass' represents the number of VxWorks kernel + * object classes. Add new object classes above 'windNumObjClass'. + * IMPORTANT: When a handle is initialized, this value is stored in the + * type member of the HANDLE structure, which is declared as an INT8. + * Therefore, windNumObjClass must be less than handleTypeStart, and + * the last handleType must be less than 256. + */ + + windNumObjClass + }; + +enum handleType + { + handleTypeUnknown = -1, /* bad handle */ + handleTypeStart = 100, /* starting value for handle types */ + handleTypeHashTbl = 100, /* hashLib HASH_TBL */ + handleTypeSymTbl, /* symLib SYMTAB */ + handleTypeFile, /* stdioLib FILE */ + handleTypeRbuff, /* rbuffLib RBUFF */ + handleTypeModuleDesc, /* moduleLib MODULE_DESC */ + handleTypeClass, /* classLib OBJ_CLASS */ + handleTypeModuleListDesc, /* moduleLib MODLIST_DESC */ + handleTypeModuleHdl, /* malLib MODULE_HDL */ + handleTypeSectionDesc, /* moduleLib SECTION_DESC */ + handleTypeEnvironment, /* envLib ENV_TBL */ + handleTypeCbioHdl, /* cbioLib CBIO_DEV handle */ + handleTypeHamChannel, /* hamLib (Foundation HA) HAM_ID */ + + /* The value of 'handleNumType' represents the number of handle + * types. Add new object classes above 'handleNumType' and + * update the definition of 'handleNumType'. + */ + + handleNumType = handleTypeHamChannel - handleTypeStart + 1 + }; + +#endif /* #ifndef _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvxWindCommonh */ diff --git a/h/u_Lib.h b/h/u_Lib.h new file mode 100644 index 0000000..5566b7b --- /dev/null +++ b/h/u_Lib.h @@ -0,0 +1,420 @@ +/* u_Lib.h - simulator UNIX/VxSim interface header */ + +/* +modification history +-------------------- +02j,23dec02,jmp added unix_statvfs (SPR #29024). +02i,08nov01,jmp moved some structures from solaris/sysLib.c. +02h,24oct01,hbh Added u_usleep, u_getppid, u_signal. +02g,19may98,dbt added u_lockf prototype. +02f,20nov96,dvs took out redundant u_sigprocmask entry during merge. +02e,23jul96,ism added SIMSPARCSOLARIS support +02d,19jan94,gae alphabetized. +02c,14dec93,gae added setsid, system, execlp, fork. +02b,10jul93,gae fixed dirent's. +02a,09jan93,gae renamed from sysULib.h; discarded major portions. +01c,05aug92,gae added non-ANSI forward declarations. +01b,29jul92,gae added more prototypes; ANSIfied. +01a,04jun92,gae written. +*/ + +/* +This header contains the prototype declarations for all UNIX +calls made by VxSim. +*/ + +#ifndef INCu_Libh +#define INCu_Libh + +#ifndef SIMSPARCSUNOS +#define SIMSPARCSUNOS 50 /* CPU & CPU_FAMILY */ +#endif + +#ifndef SIMHPPA +#define SIMHPPA 60 /* CPU & CPU_FAMILY */ +#endif + +/* defines used by u_lockf routine */ + +#define F_ULOCK 0 /* unlock previously locked section */ +#define F_LOCK 1 /* lock section for exclusive use */ +#define F_TLOCK 2 /* test & lock section for exclusive use */ +#define F_TEST 3 /* test section for other locks */ + +/* + * Definitions for UNIX library routines operating on directories. + */ + +#if CPU==SIMSPARCSUNOS +typedef struct unix__dirdesc + { + int dd_fd; /* file descriptor */ + long dd_loc; /* buf offset of entry from last readddir() */ + long dd_size; /* amount of valid data in buffer */ + long dd_bsize; /* amount of entries read at a time */ + long dd_off; /* Current offset in dir (for telldir) */ + char *dd_buf; /* directory data buffer */ + } UNIX_DIR; + +struct unix_dirent + { + long d_off; /* offset of next disk dir entry */ + unsigned long d_fileno; /* file number of entry */ + unsigned short d_reclen; /* length of this record */ + unsigned short d_namlen; /* length of string in d_name */ + char d_name[255+1]; /* name (up to MAXNAMLEN + 1) */ + }; + +struct unix_stat + { + short st_dev; + unsigned long st_ino; + unsigned short st_mode; + unsigned short st_nlink; + unsigned short st_uid; + unsigned short st_gid; + short st_rdev; + long st_size; + long st_atime; + int st_spare1; + long st_mtime; + int st_spare2; + long st_ctime; + int st_spare3; + long st_blksize; + long st_blocks; + long st_spare4[2]; + }; +#endif /* CPU==SIMSPARCSUNOS */ + +#if CPU==SIMSPARCSOLARIS +#undef st_atime +#undef st_ctime +#undef st_mtime +struct unix_stat + { + unsigned long st_dev; + long st_pad1[3]; + unsigned long st_ino; + unsigned long st_mode; + unsigned long st_nlink; + long st_uid; + long st_gid; + unsigned long st_rdev; + long st_pad2[2]; + long st_size; + long st_pad3; + long st_atime; /* st_atime */ + long st_spare1; /* " */ + long st_mtime; /* st_mtime */ + long st_spare2; /* " */ + long st_ctime; /* st_ctime */ + long st_spare3; /* " */ + long st_blksize; + long st_blocks; + char st_fstype[16]; + long st_pad4[8]; + }; + +#define FSTYPSZ 16 + +struct unix_statvfs + { + unsigned long f_bsize; /* preferred file system block size */ + unsigned long f_frsize; /* fundamental file system block size */ + unsigned long f_blocks; /* total blocks of f_frsize on fs */ + unsigned long f_bfree; /* total free blocks of f_frsize */ + unsigned long f_bavail; /* free blocks avail to non-superuser */ + unsigned long f_files; /* total file nodes (inodes) */ + unsigned long f_ffree; /* total free file nodes */ + unsigned long f_favail; /* free nodes avail to non-superuser */ + unsigned long f_fsid; /* file system id (dev for now) */ + char f_basetype[FSTYPSZ]; /* target fs type name, */ + /* null-terminated */ + unsigned long f_flag; /* bit-mask of flags */ + unsigned long f_namemax; /* maximum file name length */ + char f_fstr[32]; /* filesystem-specific string */ + unsigned long f_filler[16]; /* reserved for future expansion */ + }; + +struct unix_dirent + { + long d_ino; /* inode number of entry */ + long d_off; /* offset of next disk dir entry */ + unsigned short d_reclen; /* length of this record */ + char d_name[1+255]; /* name (up to MAXNAMLEN + 1) */ + }; + +typedef struct unix__dirdesc + { + int dd_fd; /* file descriptor */ + long dd_loc; /* buf offset of entry from last readddir() */ + long dd_size; /* amount of valid data in buffer */ + long dd_bsize; /* amount of entries read at a time */ + long dd_off; /* Current offset in dir (for telldir) */ + char *dd_buf; /* directory data buffer */ + } UNIX_DIR; + +struct unix_timeval /* don't drag in sys/time.h */ + { + long tv_sec; /* seconds */ + long tv_usec; /* and microseconds */ + }; + +struct unix_itimerval + { + struct unix_timeval it_interval; /* timer interval */ + struct unix_timeval it_value; /* current value */ + }; + +#endif /* CPU==SIMSPARCSOLARIS */ + +#if CPU==SIMHPPA +typedef struct unix__dirdesc + { + int dd_fd; /* file descriptor */ + long dd_loc; + long dd_size; + long dd_bbase; /* ? */ + /* long dd_entno; / * directory entry number */ + long dd_off; /* Current offset in dir (for telldir) !XXX */ + long dd_bsize; /* buffer size */ + char *dd_buf; /* malloc'ed buffer */ + } UNIX_DIR; + +struct unix_dirent + { + /* ino_t d_ino; / * file number of entry */ + long d_off; /* offset of next disk dir entry !XXX */ + short d_reclen; /* length of this record */ + short d_namlen; /* length of string in d_name */ + char d_name[255 + 1]; /* name must be no longer than this */ + }; + +typedef unsigned short hp__site_t; /* see stat.h */ +typedef unsigned short hp__cnode_t; /* see stat.h */ +typedef long hp_dev_t; /* For device numbers */ +typedef unsigned long hp_ino_t; /* For file serial numbers */ +typedef long hp_gid_t; /* For group IDs */ +typedef long hp_uid_t; /* For user IDs */ + +struct unix_stat + { + short st_dev; + unsigned long st_ino; + unsigned short st_mode; + unsigned short st_nlink; + unsigned short st_reserved1; /* old st_uid, replaced spare positions */ + unsigned short st_reserved2; /* old st_gid, replaced spare positions */ + short st_rdev; + long st_size; + long st_atime; + int st_spare1; + long st_mtime; + int st_spare2; + long st_ctime; + int st_spare3; + long st_blksize; + long st_blocks; + unsigned int st_pad:30; + unsigned int st_acl:1; + unsigned int st_remote:1; + hp_dev_t st_netdev; + hp_ino_t st_netino; + hp__cnode_t st_cnode; + hp__cnode_t st_rcnode; + hp__site_t st_netsite; + short st_fstype; + hp_dev_t st_realdev; + unsigned short st_basemode; + unsigned short st_spareshort; +#ifdef _CLASSIC_ID_TYPES + unsigned short st_filler_uid; + unsigned short st_uid; +#else + hp_uid_t st_uid; +#endif +#ifdef _CLASSIC_ID_TYPES + unsigned short st_filler_gid; + unsigned short st_gid; +#else + hp_gid_t st_gid; +#endif +#define _SPARE4_SIZE 3 + long st_spare4[_SPARE4_SIZE]; + }; +#endif /* CPU==SIMHPPA */ + + +struct unix_tm + { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; +#if CPU==SIMSPARCSUNOS + char *tm_zone; + long tm_gmtoff; +#endif /* CPU==SIMSPARCSUNOS */ + }; + +#ifdef __STDC__ + +/* UNIX routines */ + +extern int u_connect (int s, int name, int namelen); +extern int u_closedir (struct unix__dirdesc *dirp); +extern int u_close (int fd); +extern int u_dup2 (int fd1, int fd2); +extern int u_errno (void); +extern int u_execl (char *path, int arg0, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9); +extern int u_execlp (char *file, int arg0, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9); +extern int u_execvp (char *file, char *argv[]); +extern void u_exit (int status); +extern int u_fcntl (int fd, int cmd, int arg); +extern int u_fork (void); +extern int u_fpsetmask (int value); +extern int u_free (char *ptr); +extern int u_fstat (int fd, char *buf); +extern char *u_getcwd (char *pathname, int size); +extern char *u_getenv (char *name); +extern int u_getgid (void); +extern char *u_gethostbyname (char *name); +extern int u_gethostname (char *name, int namelen); +extern int u_getpgrp (int pid); +extern int u_getpid (void); +extern int u_getppid (void); +extern int u_getuid (void); +extern char *u_getwd (char *pathname); +extern int u_ioctl (int fd, int request, char *arg); +extern int u_isatty (int fd); +extern int u_kill (int pid, int sig); +extern int u_killpg (int pgrp, int sig); +extern struct tm *u_localtime (long *clock); +extern void u_longjmp (char *jmpbuf, int ret); +extern int u_lseek (int fd, int offset, int whence); +extern void *u_malloc (int size); +extern int u_mkdir (char *path, int mode); +extern int u_open (char *name, int flags, int mode); +extern struct unix__dirdesc *u_opendir (char *dirname); +extern int u_read (int fd, char *buf, int len); +extern struct unix_dirent *u_readdir (struct unix__dirdesc *dirp); +extern int u_rename (char *path1, char *path2); +extern int u_rmdir (char *path); +extern int u_select (int width, int *readfds, int *writefds, int *exceptfds, int *timeout); +extern int u_setitimer (int which, int *value, int *ovalue); +extern int u_setjmp (char *jmpbuf); +extern int u_setsid (void); +extern char *u_shmat (int shmid, char *shmaddr, int shmflg); +extern int u_shmctl (int shmid, int cmd, char *buf); +extern int u_shmget (int key, int size, int shmflg); +extern int u_sigaction (int sig, int *act, int *oact); +extern int u_sigaddset (int *set, int signo); +extern int u_sigblock (int mask); +extern int u_sigdelset (int *set, int signo); +extern int u_sigemptyset (int *set); +extern int u_sigfillset (int *set); +#if (CPU==SIMSPARCSOLARIS) +extern int u_sigprocmask (int how, int *set, int *oldset); +extern int u_sigaltstack (int *stk, int *ostk); +#else /* CPU==SIMSPARCSOLARIS */ +extern int u_sigsetmask (int mask); +extern int u_sigstack (int *stk, int *ostk); +#endif /* CPU==SIMSPARCSOLARIS */ +extern int u_signal (int sig, void * disp); +extern int u_sigsuspend (int *pMask); +extern int u_socket (int domain, int type, int protocol); +extern int u_stat (char *path, char *buf); +extern int u_statvfs (char *path, char *buf); +extern int u_system (char *cmd); +extern int u_tcgetpgrp (int fd); +extern int u_time (int *tloc); +extern int u_uname (char *name); +extern int u_unlink (char *path); +extern int u_usleep (unsigned int useconds); +extern int u_wait (int *statusp); +extern int u_write (int fd, char *buf, int len); +extern int u_lockf (int fd, int function, int size); + +#else + +extern int u_connect (/* int s, int name, int namelen */); +extern int u_closedir (/* struct unix__dirdesc *dirp */); +extern int u_close (/* int fd */); +extern int u_dup2 (/* int fd1, int fd2 */); +extern int u_errno (/* void */); +extern int u_execl (/* char *path, int arg0, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9 */); +extern int u_execlp (/* char *file, int arg0, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9 */); +extern int u_execvp (/* char *file, char *argv[] */); +extern void u_exit (/* int status */); +extern int u_fcntl (/* int fd, int cmd, int arg */); +extern int u_fork (/* void */); +extern int u_free (/* char *ptr */); +extern int u_fstat (/* int fd, char *buf */); +extern char *u_getcwd (/* char *pathname, int size */); +extern char *u_getenv (/* char *name */); +extern int u_getgid (/* void */); +extern char *u_gethostbyname (/* char *name */); +extern int u_gethostname (/* char *name, int namelen */); +extern int u_getpgrp (/* int pid */); +extern int u_getpid (/* void */); +extern int u_getppid (/* void */); +extern int u_getuid (/* void */); +extern char *u_getwd (/* char *pathname */); +extern int u_ioctl (/* int fd, int request, char *arg */); +extern int u_isatty (/* int fd */); +extern int u_kill (/* int pid, int sig */); +extern int u_killpg (/* int pgrp, int sig */); +extern struct tm *u_localtime (/* long *clock */); +extern void u_longjmp (/* char *jmpbuf, int ret */); +extern int u_lseek (/* int fd, int offset, int whence */); +extern void *u_malloc (/* int size */); +extern int u_mkdir (/* char *path, int mode */); +extern int u_open (/* char *name, int flags, int mode */); +extern struct unix__dirdesc *u_opendir (/* char *dirname */); +extern int u_read (/* int fd, char *buf, int len */); +extern struct unix_dirent *u_readdir (/* struct unix__dirdesc *dirp */); +extern int u_rename (/* char *path1, char *path2 */); +extern int u_rmdir (/* char *path */); +extern int u_select (/* int width, int *readfds, int *writefds, int *exceptfds, int *timeout */); +extern int u_setjmp (/* char *jmpbuf */); +extern int u_setitimer (/* int which, int *value, int *ovalue */); +extern int u_setsid (/* void */); +extern char *u_shmat (/* int shmid, char *shmaddr, int shmflg */); +extern int u_shmctl (/* int shmid, int cmd, char *buf */); +extern int u_shmget (/* int key, int size, int shmflg */); +extern int u_sigaction (/* int sig, int *act, int *oact */); +extern int u_sigaddset (/* int *set, int signo */); +extern int u_sigblock (/* int mask */); +extern int u_sigdelset (/* int *set, int signo */); +extern int u_sigemptyset (/* int *set */); +extern int u_sigfillset (/* int *set */); +#if (CPU==SIMSPARCSOLARIS) +extern int u_sigprocmask (/* int how, sigset_t *set, sigset_t *oldset */); +extern int u_sigaltstack (/* int *stk, int *ostk */); +#else /* CPU==SIMSPARCSOLARIS */ +extern int u_signal (/* int sig, void * disp */); +extern int u_sigsetmask (/* int mask */); +extern int u_sigstack (/* int *stk, int *ostk */); +#endif /* CPU==SIMSPARCSOLARIS */ +extern int u_sigsuspend (/* int *pMask */); +extern int u_socket (/* int domain, int type, int protocol */); +extern int u_stat (/* char *path, char *buf */); +extern int u_statvfs (/* char *path, char *buf */); +extern int u_system (/* char *cmd */); +extern int u_tcgetpgrp (/* int fd */); +extern int u_time (/* int *tloc */); +extern int u_uname (/* char *name */); +extern int u_unlink (/* char *path */); +extern int u_usleep (/*unsigned int useconds*/); +extern int u_wait (/* int *statusp */); +extern int u_write (/* int fd, char *buf, int len */); +extern int u_lockf (/* int fd, int function, int size */); +#endif /* __STDC__ */ + +#endif /* INCu_Libh */ diff --git a/h/unistd.h b/h/unistd.h new file mode 100644 index 0000000..cba8b1b --- /dev/null +++ b/h/unistd.h @@ -0,0 +1,150 @@ +/* unistd.h - unix standard library header file */ + +/* Copyright 1991-1994, 2000-2001, 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +02t,02aug05,pad Removed user-side elements, now useless since this file is no + longer shared. Updated copyright information. +02s,04jul05,hya Added more _POSIX macros. +02r,18apr05,pcm moved _PC_xxx macros for pathconf() from hrFsLib.h to here +02q,18apr05,hya Added file system posix prototypes. +02p,17mar05,dlk Make 'place' a member of the GETOPT type. +02o,25feb05,niq Added definitions for reentrant version of getopt +02n,06oct04,pad Added declaration of the environ array for the user side. +02m,01oct04,yvp Change lseek args to use off_t (for Posix). +02l,13sep04,yvp Added prorotype for _exit(). +02k,09jun04,kk added getpid() & getppid() prototypes SPR#98109 +02j,29mar04,job Added getopt prototype. Removed non-STDC function prototypes +02i,08dec03,dat adding const to unlink and chdir +02h,20jul00,jgn add POSIX version information + removed old style prototypes +02g,24sep01,jkf added const to rmdir() +02f,19aug94,ism added getcwd() prototypes (SPR #3536) +02e,12nov93,dvs added prototype for ftruncate. +02d,08feb93,smb changed int to size_t in protype for read() and write() +02c,22sep92,rrr added support for c++ +02b,18sep92,smb added the rmdir prototype. +02a,04jul92,jcf cleaned up. +01c,26may92,rrr the tree shuffle +01b,05dec91,rrr added SEEK_ macros (was in ioLib.h) +01a,19nov91,rrr written. +*/ + +#ifndef __INCunistdh +#define __INCunistdh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifndef SEEK_SET +#define SEEK_SET 0 /* absolute offset, was L_SET */ +#define SEEK_CUR 1 /* relative to current offset, was L_INCR */ +#define SEEK_END 2 /* relative to end of file, was L_XTND */ +#endif + +/* POSIX defines */ + +#ifndef _POSIX_VERSION +#define _POSIX_VERSION 199506L +#endif + +#ifndef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 199506L +#endif + +/* Symbolic constants for the "access" routine: */ +#define R_OK 4 /* Test for Read permission */ +#define W_OK 2 /* Test for Write permission */ +#define X_OK 1 /* Test for eXecute permission */ +#define F_OK 0 /* Test for existence of File */ + +/* command names for POSIX pathconf, fpathconf */ +#define _PC_2_SYMLINKS 1 +#define _PC_ALLOC_SIZE_MIN 2 +#define _PC_ASYNC_IO 3 +#define _PC_CHOWN_RESTRICTED 4 +#define _PC_FILESIZEBITS 5 +#define _PC_LINK_MAX 6 +#define _PC_MAX_CANON 7 +#define _PC_MAX_INPUT 8 +#define _PC_NAME_MAX 9 +#define _PC_NO_TRUNC 10 +#define _PC_PATH_MAX 11 +#define _PC_PIPE_BUF 12 +#define _PC_PRIO_IO 13 +#define _PC_REC_INCR_XFER_SIZE 14 +#define _PC_REC_MAX_XFER_SIZE 15 +#define _PC_REC_MIN_XFER_SIZE 16 +#define _PC_REC_XFER_ALIGN 17 +#define _PC_SYMLINK_MAX 18 +#define _PC_SYNC_IO 19 +#define _PC_VDISABLE 20 + +/* + * compile-time symbolic constants, + */ +#define _POSIX_ASYNC_IO 0 +#define _POSIX_PRIO_IO 0 +#define _POSIX_SYNC_IO 0 +#define _POSIX_NO_TRUNC 0 +#define _POSIX_SYNCHRONIZED_IO 0 + +extern char *optarg; +extern int optind, opterr, optopt; +extern int optreset; + +struct getopt_s + { + int opterr; /* if error message should be printed */ + int optind; /* index into parent argv vector */ + int optopt; /* character checked for validity */ + int optreset; /* reset getopt */ + char *optarg; /* argument associated with option */ + char *place; + }; + +typedef struct getopt_s GETOPT; +typedef struct getopt_s * GETOPT_ID; + +/* function declarations */ + +extern STATUS unlink (const char *name); +extern STATUS link (const char *, const char *); +extern STATUS fsync(int); +extern STATUS fdatasync(int); +extern STATUS rename(const char *, const char *); +extern long fpathconf(int, int); +extern long pathconf(const char *, int); +extern STATUS access(const char *, int); +extern off_t lseek (int fd, off_t offset, int whence); +extern STATUS chdir (const char *pathname); +extern STATUS pause (void); +extern BOOL isatty (int fd); +extern STATUS rmdir (const char *dirName); +extern char * getcwd (char *buffer, int size); +extern int ftruncate (int fildes, off_t length); +extern unsigned int sleep (unsigned int); +extern unsigned int alarm (unsigned int); +extern int getopt (int, char * const [], const char *); +extern int getopt_r (int, char * const [], const char *, + GETOPT_ID pGetOpt); +extern void getoptInit (GETOPT_ID pArg); +extern STATUS getOptServ (char *ParamString, const char * progName, + int *argc, char *argvloc[], int argvlen); + +extern RTP_ID getpid(void); /* for porting from user to kernel */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCunistdh */ diff --git a/h/unldLib.h b/h/unldLib.h new file mode 100644 index 0000000..455790f --- /dev/null +++ b/h/unldLib.h @@ -0,0 +1,72 @@ +/* unldLib.h - header for unload library */ + +/* + * Copyright (c) 1992-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01l,14apr05,v_r Removed unnecessary includes and marked obsolete errnos. +01k,28feb05,v_r Fixed SPR #106542 (unldByGroup not working). + Removed unused moduleByIdUnload(). +01j,21sep04,jn Final minor modification to allow sharing w/ host +01i,18sep04,jn Move towards shared code on host and target +01h,05apr04,jn Clean up - remove unused declarations and development-related + comments +01g,30oct96,elp Added syncUnldRtn function pointer + UNLD_SYNC option. +01f,22aug93,jmm added option type to supress breakpoint deletion +01e,16aug93,jmm added new errno - S_unldLib_TEXT_IN_USE +01d,30oct92,jmm added prototype for reld() (spr 1716) +01c,22sep92,rrr added support for c++ +01b,18sep92,jcf added include of moduleLib.h. +01a,14may92,jmm written. +*/ + +#ifndef __INCunldLibh +#define __INCunldLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "moduleLib.h" + +/* unldLib Status Codes */ + +#define S_unldLib_MODULE_NOT_FOUND (M_unldLib | 1) /* obsoleted */ +#define S_unldLib_TEXT_IN_USE (M_unldLib | 2) + +/* User options for the unloader */ + +#define UNLD_KEEP_BREAKPOINTS 0x1 /* don't delete breakpoints on unload */ +#define UNLD_FORCE 0x2 /* Do not test whether text sections + are in use */ + +#define UNLD_CPLUS_XTOR_AUTO 0x20 /* call the C++ destructors */ +#define UNLD_CPLUS_XTOR_MANUAL 0x40 /* don't call the C++ destructors */ + +/* The following options are restricted for internal use only */ + +#define UNLD_SYNC 0x10000 /* already synchronizing a module */ + +/* globals */ + +extern FUNCPTR syncUnldRtn; + +/* function declarations */ + +extern STATUS unldByGroup(UINT16 group, int options); +extern STATUS unldByModuleId(MODULE_ID moduleId, int options); +extern STATUS unldByNameAndPath(char * name, char * path, int options); +extern STATUS unldLibInit (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCunldLibh */ diff --git a/h/usb/ossLib.h b/h/usb/ossLib.h new file mode 100644 index 0000000..7c6456c --- /dev/null +++ b/h/usb/ossLib.h @@ -0,0 +1,296 @@ +/* ossLib.h - O/S-independent services */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01g,18sep01,wef merge from wrs.tor2_0.usb1_1-f for veloce +01f,07may01,wef changed module number to be (module sub num << 8) | + M_usbHostLib +01e,02may01,wef changed module number to be M_ + M_usbHostLib +01d,16mar01,wef changed priority levels of OSS_PRIORITY_HIGH and + OSS_PRIORITY_INTERRUPT to be 5 and 10 respectivly +01d,05dec00,wef moved Module number defs to vwModNum.h - add this + to #includes +01c,07mar00,rcb Change MUTEX_HANDLE, SEM_HANDLE, and THREAD_HANDLE from + UINT32 to pVOID to allow comparison with NULL. +01b,13jul99,rcb Removed queue functions to usbQueueLib.h. +01a,07jun99,rcb First. +*/ + +/* +DESCRIPTION + +Defines constants, structures, and functions provided by the ossLib. +These functions include: + +o Multithreading services (thread management and thread synchronization). +o Shared memory allocation (for passing memory globally). +o Time services. + +Other system-unique services may be provided in the future. + +IMPORTANT: Code using ossLib may be ported to preemptive and +non-preemptive multitasking environments. Therefore, code must observe the +following rules: + +1. Code must not assume that the scheduler is preemptive. Therefore, no +task is permitted to "hog" the processor indefinitely. All threads should +regularly relinquish the processor, either through calls which may block in +ossLib functions - which automatically relinquish, or through explicit +calls to the threadSleep() function. + +2. Code must not assume that the scheduler is NOT preemptive. Therefore, +critical sections must be protected from reentrancy. This protection is +typically managed through the use of mutexes. +*/ + + +#ifndef __INCossLibh +#define __INCossLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include "vwModNum.h" /* USB Module Number Def's */ + +/* Defines */ + +/* ossLib return codes. */ + +/* + * USB errnos are defined as being part of the USB host Module, as are all + * vxWorks module numbers, but the USB Module number is further divided into + * sub-modules. Each sub-module has upto 255 values for its own error codes + */ + +#define USB_OSS_SUB_MODULE 1 + +#define M_ossLib ( (USB_OSS_SUB_MODULE << 8) | M_usbHostLib ) + +#define ossErr(x) (M_ossLib | (x)) + +#define S_ossLib_BAD_HANDLE ossErr (1) +#define S_ossLib_BAD_PARAMETER ossErr (2) +#define S_ossLib_OUT_OF_MEMORY ossErr (3) +#define S_ossLib_OUT_OF_RESOURCES ossErr (4) +#define S_ossLib_INTERNAL_FAULT ossErr (5) +#define S_ossLib_TIMEOUT ossErr (6) +#define S_ossLib_GENERAL_FAULT ossErr (7) +#define S_ossLib_DESTROY_FAILED ossErr (8) +#define S_ossLib_QUEUE_FULL ossErr (9) +#define S_ossLib_QUEUE_EMPTY ossErr (10) +#define S_ossLib_NO_SIGNAL ossErr (11) +#define S_ossLib_TAKE_MUTEX ossErr (12) +#define S_ossLib_RELEASE_MUTEX ossErr (13) +#define S_ossLib_NOT_IMPLEMENTED ossErr (14) + + +/* Blocking/non-blocking parameters for functions which can block. */ + +#define OSS_BLOCK 0xffffffff /* Function will block indefinitely */ +#define OSS_DONT_BLOCK 0x0 /* Function will not block */ + /* NOTE: All other values are interpreted */ + /* as a count of milliseconds to block */ + + +/* Thread priority parameters for ossThreadCreate */ + +#define OSS_PRIORITY_INHERIT 0xffff /* inherit caller's priority */ +#define OSS_PRIORITY_LOW 255 +#define OSS_PRIORITY_TYPICAL 100 +#define OSS_PRIORITY_HIGH 10 +#define OSS_PRIORITY_INTERRUPT 5 + + +/* Maximum length of a thread name string. */ + +#define MAX_OSS_NAME_LEN 32 + + +/* Structure definitions. */ + +/* Handles. */ + +typedef pVOID THREAD_HANDLE; /* Thread handle */ +typedef THREAD_HANDLE *pTHREAD_HANDLE; + +typedef pVOID SEM_HANDLE; /* Semaphore handle */ +typedef SEM_HANDLE *pSEM_HANDLE; + +typedef pVOID MUTEX_HANDLE; /* Mutex handle */ +typedef MUTEX_HANDLE *pMUTEX_HANDLE; + + +/* Structure of a thread entry point */ + +typedef VOID (*THREAD_PROTOTYPE) (pVOID param); + + +/* function prototypes */ + +STATUS ossStatus + ( + int status + ); + + +STATUS ossInitialize (void); + + +STATUS ossShutdown (void); + + +STATUS ossThreadCreate + ( + THREAD_PROTOTYPE func, /* function to spawn as new thread */ + pVOID param, /* Parameter to be passed to new thread */ + UINT16 priority, /* OSS_PRIORITY_xxxx */ + pCHAR name, /* thread name or NULL */ + pTHREAD_HANDLE pThreadHandle /* Handle of newly spawned thread */ + ); + +#define OSS_THREAD_CREATE(func, param, priority, name, pThreadHandle) \ + ossThreadCreate (func, param, priority, name, pThreadHandle) + + +STATUS ossThreadDestroy + ( + THREAD_HANDLE threadHandle /* handle of thread to be destroyed */ + ); + +#define OSS_THREAD_DESTROY(threadHandle) ossThreadDestroy (threadHandle) + + +STATUS ossThreadSleep + ( + UINT32 msec /* Number of msec to sleep */ + ); + +#define OSS_THREAD_SLEEP(msec) ossThreadSleep (msec) + + +STATUS ossSemCreate + ( + UINT32 maxCount, /* Max count allowed for semaphore */ + UINT32 curCount, /* initial count for semaphore */ + pSEM_HANDLE pSemHandle /* newly created semaphore handle */ + ); + +#define OSS_SEM_CREATE(maxCount, curCount, pSemHandle) \ + ossSemCreate (maxCount, curCount, pSemHandle) + + +STATUS ossSemDestroy + ( + SEM_HANDLE semHandle /* Handle of semaphore to destroy */ + ); + +#define OSS_SEM_DESTROY(semHandle) ossSemDestroy (semHandle) + + +STATUS ossSemGive + ( + SEM_HANDLE semHandle /* semaphore to signal */ + ); + +#define OSS_SEM_GIVE(semHandle) ossSemGive (semHandle) + + +STATUS ossSemTake + ( + SEM_HANDLE semHandle, /* semaphore to take */ + UINT32 blockFlag /* specifies blocking action */ + ); + +#define OSS_SEM_TAKE(semHandle, blockFlag) ossSemTake (semHandle, blockFlag) + + +STATUS ossMutexCreate + ( + pMUTEX_HANDLE pMutexHandle /* Handle of newly created mutex */ + ); + +#define OSS_MUTEX_CREATE(pMutexHandle) ossMutexCreate (pMutexHandle) + + +STATUS ossMutexDestroy + ( + MUTEX_HANDLE mutexHandle /* Handle of mutex to destroy */ + ); + +#define OSS_MUTEX_DESTROY(mutexHandle) ossMutexDestroy (mutexHandle) + + +STATUS ossMutexTake + ( + MUTEX_HANDLE mutexHandle, /* Mutex to take */ + UINT32 blockFlag /* specifies blocking action */ + ); + +#define OSS_MUTEX_TAKE(mutexHandle, blockFlag) \ + ossMutexTake (mutexHandle, blockFlag) + + +STATUS ossMutexRelease + ( + MUTEX_HANDLE mutexHandle /* Mutex to be released */ + ); + +#define OSS_MUTEX_RELEASE(mutexHandle) ossMutexRelease(mutexHandle) + + +pVOID ossMalloc + ( + UINT32 numBytes /* Size of buffer to allocate */ + ); + +#define OSS_MALLOC(numBytes) ossMalloc(numBytes) + + +pVOID ossCalloc + ( + UINT32 numBytes /* size of buffer to allocate */ + ); + +#define OSS_CALLOC(numBytes) ossCalloc(numBytes) + + +pVOID ossMallocAlign + ( + UINT32 numBytes, /* size of buffer to allocate */ + UINT32 alignment, /* alignment, must be power of 2 */ + BOOL zero /* indicates if memory to be zeroed */ + ); + +#define OSS_MALLOC_ALIGN(numBytes, alignment, zero) \ + ossMallocAlign (numBytes, alignment, zero) + + +VOID ossFree + ( + pVOID bfr + ); + +#define OSS_FREE(bfr) ossFree (bfr) + + +UINT32 ossTime (void); + +#define OSS_TIME() ossTime () + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCossLibh */ + + +/* End of file. */ + diff --git a/h/usb/pciConstants.h b/h/usb/pciConstants.h new file mode 100644 index 0000000..56e8a46 --- /dev/null +++ b/h/usb/pciConstants.h @@ -0,0 +1,148 @@ +/* pciConstants.h - Defines constants related to the PCI bus. */ + +/* Copyright 2000-2005 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01d,28mar05,pdg non-PCI changes +01c,18sep01,wef merge from wrs.tor2_0.usb1_1-f for veloce +01b,05dec00,wef removed some macros that were defined in pciConfigLib.h +01a,29may99,rcb First. +*/ + +#ifndef __INCpciConstantsh +#define __INCpciConstantsh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "drv/pci/pciConfigLib.h" + +/* Constants */ + +#ifndef PCI_MAX_BUS +#define PCI_MAX_BUS 255 /* Max number of PCI buses in system */ +#endif /* PCI_MAX_BUS */ + +#ifndef PCI_MAX_DEV +#define PCI_MAX_DEV 32 /* Max number of PCI devices in system */ +#endif /* PCI_MAX_DEV */ + + +/* Constants related to PCI configuration */ + +#define PCI_CFG_NUM_BASE_REG 6 /* Number of base address registers */ + /* in PCI config. space for a device */ + + +/* The following PCI_CFG_ADDRESS_xxxx constants qualify the address in each +of the PCI configuration base address registers. */ + +#define PCI_CFG_BASE_IO 0x00000001 /* Mask indicates adrs is I/O adrs */ +#define PCI_CFG_BASE_MEM 0x00000000 /* Mask indicates adrs is mem adrs */ + +#define PCI_CFG_IOBASE_MASK ~(0x3) +#define PCI_CFG_MEMBASE_MASK ~(0xf) + +#define OHCI_CLASS 0x0c /* BASEC value for serial bus */ +#define OHCI_SUBCLASS 0x03 /* SCC value for USB */ +#define OHCI_PGMIF 0x10 /* OpenHCI */ + +#define UHCI_CLASS 0x0c /* BASEC value for serial bus */ +#define UHCI_SUBCLASS 0x03 /* SCC value for USB */ +#define UHCI_PGMIF 0x00 /* no specific pgm i/f defined */ +#define PCI_UHCI_LEGREG_OFFSET 0xC0 /* UHCI Legacy register offset */ +#define PCI_UHCI_LEGREG_VALUE 0x2000 /* UHCI Legacy register value */ + +#define EHCI_CLASS 0x0c /* BASEC value for serial bus */ +#define EHCI_SUBCLASS 0x03 /* SCC value for USB */ +#define EHCI_PGMIF 0x20 /* EnhancedHCI */ + +#define EHCI_HCCPARAMS 0x08 /* HCCPARAMS register offset */ +#define EHCI_HCCPARAMS_EECP_MASK 0x0000FF00 /* + * extended capabilities + * field position mask value + */ +#define EHCI_HCCPARAMS_EECP_MIN 0x40 /* + * extended capabilities + * minimum value + */ +#define EHCI_USBLEGSUP_OS_OFFSET 3 /* + * Offset into the USBLEGSUP + * register to access the OS + * controllable space + */ + +#define USB_IF_NON_PCI 0x80 /* Mask value for non-PCI bus */ + +/* typedefs */ + +/* + * PCI_CFG_HEADER + * + * PCI_CFG_HEADER defines the invariant portion of a PCI devices configuration + * space. + * + * NOTE: If 0-byte packing is in effect, this structure will match the PCI + * configuration header byte-for-byte. + */ + +typedef struct pci_cfg_header + { + UINT16 vendorId; /* PCI-assigned vendor ID */ + UINT16 deviceId; /* Vendor-assigned device ID */ + UINT16 command; /* Config. cmd register */ + UINT16 status; /* Cfg status register */ + UINT8 revisionId; /* Revision ID */ + UINT8 pgmIf; /* Programming interface */ + UINT8 subClass; /* PCI Sub-class */ + UINT8 pciClass; /* PCI Class code */ + UINT8 cacheLineSize; /* Cache line size */ + UINT8 latencyTimer; /* Latency timer */ + UINT8 headerType; /* Header type */ + UINT8 bist; /* BIST */ + UINT32 baseReg [PCI_CFG_NUM_BASE_REG]; /* Base adrs registers */ + UINT32 reserved [2]; + UINT32 romBase; /* Expansion ROM base address */ + UINT32 reserved1 [2]; + UINT8 intLine; /* Interrupt line chosen by POST */ + UINT8 intPin; /* HW int assignment (INTA = 1, etc) */ + UINT8 minGrant; /* Minimum grant */ + UINT8 maxLatency; /* Maximum latency */ + } PCI_CFG_HEADER, *pPCI_CFG_HEADER; + +/* + * USB_HCD_BUS_INFO + * + * USB_HCD_BUS_INFO defines the function pointers which can be used for + * performing host bus specific operations. + */ +typedef struct usbHcdBusInfo + { + FUNCPTR pFuncDataSwap; /* Function to swap data */ + FUNCPTR pFuncCpuToBus; /* Function to convert CPU to Bus memory */ + FUNCPTR pFuncBusToCpu; /* Function to convert Bus to CPU memory */ + FUNCPTR pFuncIntConnect;/* Function to hook an ISR */ + FUNCPTR pFuncIntDisconnect;/* Function to unhook an ISR */ + pVOID pBaseAddress; /* Base Address of registers */ + UINT32 irq; /* Irq value of the controller */ + FUNCPTR pFuncBufferSwap;/* Function to swap buffer contents */ + pVOID pDeviceSpecificData;/* + * Pointer which can be used for + * storing device specific data + */ + }USB_HCD_BUS_INFO, *pUSB_HCD_BUS_INFO; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpciConstantsh */ + + +/* End of file. */ + diff --git a/h/usb/target/usbHal.h b/h/usb/target/usbHal.h new file mode 100644 index 0000000..79c791a --- /dev/null +++ b/h/usb/target/usbHal.h @@ -0,0 +1,93 @@ +/* usbHal.h - Defines structures/interfaces used only by HAL */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01d,03aug04,mta Modification History Changes +01c,19jul04,ami Coding Convention Changes +01b,03may04,pdg Fix for receiving less than expected data from the host +01a,04mar04,mta First. +*/ + +/* +DESCRIPTION + +Defines structures/interfaces used only by Hardware Adaption Layer (HAL). +*/ + + +#ifndef __INCusbHalh +#define __INCusbHalh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "usb/usbHandleLib.h" +#include "usb/usb.h" +#include "usb/target/usbTcd.h" +#include "usb/target/usbHalLib.h" + +/* typedefs */ + +typedef struct usbHalPipeInfo /* USBHAL_PIPE_INFO */ + { + UINT8 uEndpointAddress; /* endpoint address */ + UINT16 maxPacketSize; /* maximum packet size of the endpoint */ + UINT32 pipeHandle; /* pipe handle returned from the TCD */ + LIST_HEAD listHead; /* head of the list of ERPs queued */ + /* for this endpoint */ + UINT32 uEndpointInterruptStatus;/* endpoint interrupt status */ + MUTEX_HANDLE mutexHandle; /* pointer to the mutex handle */ + } USBHAL_PIPE_INFO, *pUSBHAL_PIPE_INFO; + +typedef struct usbHalTcd /* USBHAL_TCD */ + { + pVOID pTCDHandle; /* pointer to the TCD handle */ + USB_TCD_EXEC_FUNC tcdExecFunc; /* single entry point of the TCD */ + SEM_HANDLE intPendingSemaphore; /* semaphore of the interrupt */ + /* handler thread */ + UINT32 uInterruptStatus; /* bitmap specifying interrupt */ + /* status */ + MUTEX_HANDLE mutex; /* mutex for accessing the shared */ + /* resources */ + struct usbHalPipeInfo ** pPipeInfo; /* pointer to array of */ + /* USBHAL_PIPE_INFO structures */ + UINT32 uActiveEndpointsBitmap; /* bitmap holding the */ + /* endpoints which are active*/ + + UINT8 uActiveEndpoints; /* number of endpoints which */ + /* are active */ + USBHAL_DEVICE_INFO halDeviceInfo;/* information about features supported */ + USB_TCD_MNGMT_CALLBACK mngmtCallback; /* pointer to the Management callback*/ + /* function of the usbTargLib */ + pVOID mngmtCallbackParam;/* parameter to the management */ + /* callback function */ + THREAD_HANDLE threadId; /* interrupt handler thread ID */ + } USBHAL_TCD, *pUSBHAL_TCD; + +/* functions declarations */ + +extern STATUS usbHalProcessEndpointOUT (pUSBHAL_TCD pHalInfo, + pUSBHAL_PIPE_INFO pPipeInfo); + +extern STATUS usbHalProcessEndpointIN (pUSBHAL_TCD pHalInfo, + pUSBHAL_PIPE_INFO pPipeInfo); + +extern VOID usbHalIsr (pUSBHAL_TCD pHalTcd); + + +extern VOID usbHalInterruptThread (pUSBHAL_TCD pHalTcd); + +extern VOID trbHeaderInit (pTRB_HEADER pTrb, pVOID pTCDHandle, + UINT16 uFunctionCode,UINT16 uTotalLen); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbHalh */ diff --git a/h/usb/target/usbHalCommon.h b/h/usb/target/usbHalCommon.h new file mode 100644 index 0000000..3dd3dc5 --- /dev/null +++ b/h/usb/target/usbHalCommon.h @@ -0,0 +1,57 @@ +/* usbHalCommon.h - Defines structures/interfaces used by HAL and above layers */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01c,03aug04,mta Modification History Changes +01b,19jul04,ami Coding Convention Changes +01a,04mar04,mta First. +*/ + +/* +DESCRIPTION + +Defines structures/interfaces used by Hardware Adaption Layer (HAL) and above +layers. +*/ + + +#ifndef __INCusbHalCommonh +#define __INCusbHalCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +/* Device features */ +#define USB_FEATURE_DEVICE_REMOTE_WAKEUP 0x01 /* remote wake up */ +#define USB_FEATURE_TEST_MODE 0x02 /* test mode feature */ +#define USB_FEATURE_USB20 0x04 /* USB 2.0 Device */ + +/* Device speeds */ +#define USB_TCD_FULL_SPEED (UINT8)0x00 /* full speed device */ +#define USB_TCD_LOW_SPEED (UINT8)0x01 /* low speed device */ +#define USB_TCD_HIGH_SPEED (UINT8)0x02 /* high speed device */ + +/* typedefs */ + +typedef struct usbApplnDeviceInfo /* USB_APPLN_DEVICE_INFO */ + { + UINT32 uDeviceFeature; /* bitmap giving featues supported by device */ + UINT32 uEndpointNumberBitmap; /* bitmap giving endpoint numbers */ + /* supported by device */ + }USB_APPLN_DEVICE_INFO, *pUSB_APPLN_DEVICE_INFO; + +/* primary TCD entry point */ + +typedef STATUS (*USB_TCD_EXEC_FUNC) (pVOID pTrb); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbHalCommomh */ diff --git a/h/usb/target/usbHalDebug.h b/h/usb/target/usbHalDebug.h new file mode 100644 index 0000000..1ec71be --- /dev/null +++ b/h/usb/target/usbHalDebug.h @@ -0,0 +1,68 @@ +/* usbHalDebug.h - Defines the debug macros used by the HAL sub-modules */ + +/* Copyright 2004-2005 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01f,20jan05,hch Corrected the _WRS_VXWORKS_MAJOR usage +01e,31oct04,hch comment out the extern for usbLogMsg temperarily. +01d,26oct04,ami Debug Messages Changes +01c,06oct04,ami SPR #94684 Fix +01b,19jul04,ami Coding Convention Changes +01a,08mar04,pdg First. +*/ + +/* +DESCRIPTION + +Defines the debug macros which are used by the HAL sub-modules +*/ + +#ifndef __INCusbHalDebugh +#define __INCusbHalDebugh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include + +#if (defined(_WRS_VXWORKS_MAJOR) && (_WRS_VXWORKS_MAJOR >= 6)) + + extern void usbPeriLogMsg (char *,int,int,int,int,int,int); + +#else /* _WRS_VXWORKS_MAJOR */ + +/* SPR #85391 is included in the cumulative patch. If customer has + * installed the cumulative patch, then it is OK for customer to + * uncomment out the following extern definition. Curretnly, there will + * be some warnings when build USB Periphral source + */ + /* extern void usbPeriLogMsg (char *,int,int,int,int,int,int);*/ + +#endif /* _WRS_VXWORKS_MAJOR */ + +/* defines */ + +#define USBHAL_DEBUG_MSG 0x01 /* for debugging macros */ +#define USBHAL_DEBUG_ERR 0x02 /* for Error macros */ + +#define USBHAL_DEBUG \ + if (usbHalDebug & USBHAL_DEBUG_MSG) \ + usbPeriLogMsg /* debugging Macros */ + + +#define USBHAL_ERR \ + if (usbHalDebug & USBHAL_DEBUG_ERR) \ + usbPeriLogMsg /* error macros */ + +extern UINT32 usbHalDebug; /* define the debugging flag */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbHalDebugh */ + diff --git a/h/usb/target/usbHalLib.h b/h/usb/target/usbHalLib.h new file mode 100644 index 0000000..6c3a88d --- /dev/null +++ b/h/usb/target/usbHalLib.h @@ -0,0 +1,118 @@ +/* usbHalLib.h - define the API's exposed by HAL */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01c,03aug04,mta Modification History Changes +01b,19jul04,amit Coding Convention Changes +01a,04mar04,mta First. +*/ + +/* +DESCRIPTION + +This file defines the interfaces and data structures exposed by the +Hardware Adaption Layer to the usbTargLib layer +*/ + +#ifndef __INCusbHalLibh +#define __INCusbHalLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include "usb/usbHandleLib.h" +#include "usb/usb.h" +#include "usb/target/usbTcd.h" + +/* defines */ + +/* managment codes passed to USB_TCD_MANAGEMENT_CALLBACK */ + +#define TCD_MNGMT_BUS_RESET 1 /* bus reset */ +#define TCD_MNGMT_SUSPEND 2 /* suspend signalling detected */ +#define TCD_MNGMT_RESUME 3 /* resume signalling detected */ +#define TCD_MNGMT_DISCONNECT 4 /* disconnect detected */ + + +/* typedefs */ + +typedef struct usbHalTcdNexus /* USBHAL_TCD_NEXUS */ + { + USB_TCD_EXEC_FUNC tcdExecFunc; /* TCD primary entry point */ + TCD_HANDLE handle; /* client's handle with TCD */ + } USBHAL_TCD_NEXUS, *pUSBHAL_TCD_NEXUS; + +/* management notification callback function */ + +typedef VOID (*USB_TCD_MNGMT_CALLBACK) + ( + pVOID mngmtCallbackParam, + UINT16 mngmtCode, + pVOID pContext + ); + +/* functions declarration */ + +extern STATUS usbHalTcdAttach (USB_TCD_EXEC_FUNC tcdExecFunc, pVOID tcdParam, + pUSBHAL_TCD_NEXUS pNexus, + pUSB_APPLN_DEVICE_INFO pDeviceInfo, + USB_TCD_MNGMT_CALLBACK mngmtCallback, + pVOID mngmtCallbackParam); + +extern STATUS usbHalTcdDetach (pUSBHAL_TCD_NEXUS pNexus); + + +extern STATUS usbHalTcdEnable (pUSBHAL_TCD_NEXUS pNexus); + + +extern STATUS usbHalTcdDisable (pUSBHAL_TCD_NEXUS pNexus); + + +extern STATUS usbHalTcdAddressSet (pUSBHAL_TCD_NEXUS pNexus,UINT8 deviceAddress); + +extern STATUS usbHalTcdSignalResume (pUSBHAL_TCD_NEXUS pNexus); + +extern STATUS usbHalTcdDeviceFeatureSet (pUSBHAL_TCD_NEXUS pNexus, + UINT16 uFeatureSelector, + UINT8 uTestSelector); + +extern STATUS usbHalTcdDeviceFeatureClear (pUSBHAL_TCD_NEXUS pNexus, + UINT16 uFeatureSelector); + +extern STATUS usbHalTcdCurrentFrameGet (pUSBHAL_TCD_NEXUS pNexus, + pUINT16 pFrameNo); + + +extern STATUS usbHalTcdEndpointAssign (pUSBHAL_TCD_NEXUS pNexus, + pUSB_ENDPOINT_DESCR pEndpointDesc, + UINT16 uConfigurationValue, + UINT16 uInterface, + UINT16 uAltSetting, + VOID ** ppPipeHandle); + + +extern STATUS usbHalTcdEndpointRelease (pUSBHAL_TCD_NEXUS pNexus, + pVOID pPipeHandle); + +extern STATUS usbHalTcdEndpointStateSet (pUSBHAL_TCD_NEXUS pNexus, + pVOID pPipeHandle, UINT16 state); + +extern STATUS usbHalTcdEndpointStatusGet (pUSBHAL_TCD_NEXUS pNexus, + pVOID pPipeHandle, pUINT8 pStatus); + +extern STATUS usbHalTcdErpSubmit (pUSBHAL_TCD_NEXUS pNexus, pUSB_ERP pErp); + +extern STATUS usbHalTcdErpCancel (pUSBHAL_TCD_NEXUS pNexus, pUSB_ERP pErp); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbHalLibh */ diff --git a/h/usb/target/usbIsaLib.h b/h/usb/target/usbIsaLib.h new file mode 100644 index 0000000..f28ad45 --- /dev/null +++ b/h/usb/target/usbIsaLib.h @@ -0,0 +1,163 @@ +/* usbIsaLib.h - System-specific ISA Functions */ + +/* Copyright 2000-2001 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01d,03aug04,hch Fix compiler warning +01c,21aug01,hdn added PENTIUM2/3/4 support +01b,17mar00,rcb Change name of #include from "i8237dma.h" to + "i8237Dma.h" to reflect case-sensitive nature of + filenames on unix build platforms. +01a,11aug99,rcb First. +*/ + +/* +DESCRIPTION + +This file defines platform-independent functions accessing ISA bus +capabilities. These functions allow ISA device drivers to be written +independent of the underlying O/S's ISA access mechanisms. +*/ + +#ifndef __INCusbIsaLibh +#define __INCusbIsaLibh + + +/* Includes */ + +#include "ioLib.h" /* defines O_RDONLY/O_WRONLY */ + +#include "usb/usbPciLib.h" + + +/* defines */ + +/* Define USE_PCI_INT_FUNCS to map USB_ISA_INT_CONNECT() and + * USB_ISA_INT_RESTORE() to the corresponding functions in usbPciLib.c. + * The PCI functions have the advantage that they define both an + * "intConnect()" as well as an "intDisconnect()" function, allowing + * interrupts to be unhooked effectively. + */ + +#define USE_PCI_INT_FUNCS + + +/* platform-dependent definitions */ + +#if (CPU_FAMILY==I80X86) + +/* Pentium (e.g, PC Pentium) */ + +/* The 8237 DMA controller is enabled using a function called dmaSetup(). + * A prototype for this function exists in the vxWorks header file below. + */ + +#include "drv/dma/i8237Dma.h" + +#define DMA_SETUP(direction, pAddr, nBytes, chan) \ + dmaSetup (direction, pAddr, nBytes, chan) + +/* Unknown platform */ + +#else + +#warning "Unknown platform. Must create platform mapping in usbIsaLib.h." + +#define DMA_SETUP(direction, pAddr, nBytes, chan) + +#endif /* #if CPU == xxxx */ + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* typedefs */ + +/* I/O functions */ + +#define USB_ISA_BYTE_IN(address) USB_PCI_BYTE_IN(address) +#define USB_ISA_BYTE_OUT(address, value) USB_PCI_BYTE_OUT(address, value) + + +/* memory mapping functions */ + +#define USB_MEM_TO_ISA(pMem) USB_MEM_TO_PCI(pMem) +#define USB_ISA_TO_MEM(isaAdrs) USB_PCI_TO_MEM(isaAdrs) + + +/* cache functions */ + +#define USB_ISA_MEM_FLUSH(pMem, size) USB_PCI_MEM_FLUSH(pMem, size) +#define USB_ISA_MEM_INVALIDATE(pMem, size) USB_PCI_MEM_INVALIDATE(pMem, size) + + +/* interrupt functions */ + +#ifdef USE_PCI_INT_FUNCS + +#define USB_ISA_INT_CONNECT(func, param, intNo) \ + usbPciIntConnect (func, param, intNo) +#define USB_ISA_INT_RESTORE(func, param, intNo) \ + usbPciIntRestore (func, param, intNo) + +#else + +#define USB_ISA_INT_CONNECT(func, param, intNo) \ + usbIsaIntConnect (func, param, intNo) +#define USB_ISA_INT_RESTORE(func, param, intNo) \ + usbIsaIntRestore (func, param, intNo) + +#endif /* #ifdef USE_PCI_INT_FUNCS */ + + +/* DMA functions + * + * NOTE: WRS convention for DMA transfer is that a "read from memory" + * by the DMAC (what we call DMA_MEM_READ) is actually the direction + * O_WRONLY. + */ + +#define DMA_MEM_READ 0 +#define DMA_MEM_WRITE 1 + +#define USB_ISA_DMA_SETUP(direction, isaAdrs, bfrLen, channel) \ + DMA_SETUP ((direction == DMA_MEM_READ) ? O_WRONLY : O_RDONLY, \ + (void *) isaAdrs, bfrLen, channel) + + +#ifndef USE_PCI_INT_FUNCS + +/* function prototypes */ + +STATUS usbIsaIntConnect + ( + INT_HANDLER_PROTOTYPE func, /* new interrupt handler */ + pVOID param, /* parameter for int handler */ + UINT16 intNo /* interrupt vector number */ + ); + + +VOID usbIsaIntRestore + ( + INT_HANDLER_PROTOTYPE func, /* int handler to be removed */ + pVOID param, /* parameter for int handler */ + UINT16 intNo /* interrupt vector number */ + ); + +#endif /* #ifndef USE_PCI_INT_FUNCS */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbIsaLibh */ + + +/* End of file. */ + + diff --git a/h/usb/target/usbPeriphInstr.h b/h/usb/target/usbPeriphInstr.h new file mode 100644 index 0000000..48d9eab --- /dev/null +++ b/h/usb/target/usbPeriphInstr.h @@ -0,0 +1,97 @@ +/* usbPeriphInstr.h - WindView Instrumentation for Peripheral Stack */ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +modification history +-------------------- +01b,08sep04,ami Event IDs for NET2280 added +01a,11aug04,ami Initial Version +*/ + +/* +DESCRIPTION + +This file contains the definitions for the WindView Instrumentation for all +the modules for the USB2.0 Peripheral Stack i.e. + 1) The Target Layer + 2) The HAL Layer + 3) The TCD Layer (PDIUSBD12 & ISP1582) +*/ + +#ifndef __INCusbPeriphInstrh +#define __INCusbPeriphInstrh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +/* Event Ids */ + +/* Event ID for Target Layer */ + +#define USB_TARG_INIT_EXIT 10120 +#define USB_TARG_DEFAULT_PIPE 10121 +#define USB_TARG_DEVICE_CONTROL 10122 +#define USB_TARG_PIPE_FUNC 10123 + +/* Event IDs for HAL */ + +#define USB_HAL_INIT_EXIT 10124 +#define USB_HAL_INTERRUPT_HANDLER 10125 +#define USB_HAL_DEVICE_CNTL 10126 +#define USB_HAL_ENDPOINT 10127 + +/* Event IDs for TCD */ + +#define USB_TCD_ISP1582_INIT_EXIT 10128 +#define USB_TCD_ISP1582_INTERRUPT 10129 +#define USB_TCD_ISP1582_ENDPOINT 10130 +#define USB_TCD_ISP1582_DEVICE_CONTROL 10131 + +#define USB_TCD_PDIUSBD12_DEVCE_CONTROL 10132 +#define USB_TCD_PDIUSBD12_ENDPOINT 10133 +#define USB_TCD_PDIUSBD12_INIT_EXIT 10134 +#define USB_TCD_PDIUSBD12_INTERRUPT 10135 + +/* The needs to be verified */ +#define USB_TCD_NET2280_INIT_EXIT 10136 +#define USB_TCD_NET2280_INTERRUPT 10137 +#define USB_TCD_NET2280_DEVICE_CONTROL 10138 +#define USB_TCD_NET2280_ENDPOINT 10139 + +/* Event filters */ + +#define USB_TARG_WV_FILTER 0x00000001 +#define USB_HAL_WV_FILTER 0x00000002 +#define USB_TCD_ISP582_WV_FILTER 0x00000004 +#define USB_TCD_PDIUSBD12_WV_FILTER 0x00000008 +#define USB_TCD_NET2280_WV_FILTER 0x00000010 + + +extern void usbPeriphWindViewLog (UINT32, char *, UINT32); + +/* Macro to log the instrumentation event */ + +#define USB_TCD_LOG_EVENT(eventId, eventBuf, USB2_FILTER) \ + usbPeriphWindViewLog (eventId, eventBuf, USB2_FILTER); + +#define USB_HAL_LOG_EVENT(eventId, eventBuf, USB2_FILTER) \ + usbPeriphWindViewLog (eventId, eventBuf, USB2_FILTER); + +#define USB_TARG_LOG_EVENT(eventId, eventBuf, USB2_FILTER) \ + usbPeriphWindViewLog (eventId, eventBuf, USB2_FILTER); + +#ifdef __cplusplus +} +#endif + +#endif /* usbPeriphInstr */ diff --git a/h/usb/target/usbTargLib.h b/h/usb/target/usbTargLib.h new file mode 100644 index 0000000..05954b2 --- /dev/null +++ b/h/usb/target/usbTargLib.h @@ -0,0 +1,345 @@ +/* usbTargLib.h - Defines interface to usbTargLib.c */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +02d,03aug04,mta Modification History Changes +02c,19jul04,ami Coding Convention Changes +02b,18may04,mta Modification to USB_TARG_STATUS_GET_FUNC +02a,30mar04,ami changes made according to USB 2.0 Extn Design doc +01e,18sep01,wef merge from wrs.tor2_0.usb1_1-f for veloce +01d,07may01,wef changed module number to be (module sub num << 8) | + M_usbPeriphLib +01c,02may01,wef changed module number to be M_ + M_usbPeriphLib +01b,05dec00,wef moved Module number defs to vwModNum.h - add this + to #includes +01a,04aug99,rcb First. +*/ + +/* +DESCRIPTION + +Defines the interface to usbTargLib.c. usbTargLib.c implements a hardware- +independent interface to USB target controller drivers. +*/ + +#ifndef __INCusbTargLibh +#define __INCusbTargLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "usb/usbHandleLib.h" +#include "usb/usb.h" +#include "vwModNum.h" +#include "usb/target/usbHalCommon.h" +#include "usb/target/usbHalLib.h" +#include "usb/usbListLib.h" + + +/* defines */ + +#define TARG_TCD_SIG ((UINT32) 0xaaaa00cd) /* signature for Tcd */ +#define TARG_PIPE_SIG ((UINT32) 0xaaaa000e) /* signature for Pipe */ + +/* managements codes */ + +#define TARG_MNGMT_ATTACH 0x0000 /* TARG Attach Management Code */ +#define TARG_MNGMT_DETACH 0x0001 /* TARG Detach Management Code */ +#define TARG_MNGMT_DISCONNECT 0x0002 /* TARG Disconnect Management Code */ +#define TARG_MNGMT_BUS_RESET 0x0003 /* TARG Bus Reset Management Code */ +#define TARG_MNGMT_SUSPEND 0x0004 /* TARG Suspend Management Code */ +#define TARG_MNGMT_RESUME 0x0005 /* TARG Resume Managemnt Code */ + +/* usbTargLib error codes */ + +/* + * USB errnos are defined as being part of the USB peripheral Module, as are + * all vxWorks module numbers, but the USB Module number is further divided + * into sub-modules. Each sub-module has upto 255 values for its own error + * codes + */ + +#define USB_TARG_SUB_MODULE 1 + +#define M_usbTargLib ( (USB_TARG_SUB_MODULE << 8) | M_usbPeriphLib ) + +#define usbTargErr(x) (M_usbTargLib | (x)) + +#define S_usbTargLib_BAD_PARAM usbTargErr(1) /* bad parameter */ +#define S_usbTargLib_BAD_HANDLE usbTargErr(2) /* bad handle */ +#define S_usbTargLib_OUT_OF_MEMORY usbTargErr(3) /* out of memory */ +#define S_usbTargLib_OUT_OF_RESOURCES usbTargErr(4) /* Out of resource */ +#define S_usbTargLib_NOT_IMPLEMENTED usbTargErr(5) /* not Implemented */ +#define S_usbTargLib_GENERAL_FAULT usbTargErr(6) /* general fault */ +#define S_usbTargLib_NOT_INITIALIZED usbTargErr(7) /* uninilialized */ +#define S_usbTargLib_CANNOT_CANCEL usbTargErr(8) /* cannot cancel */ +#define S_usbTargLib_TCD_FAULT usbTargErr(9) /* TCD related fault */ +#define S_usbTargLib_ENDPOINT_IN_USE usbTargErr(10) /* endpoint in use */ +#define S_usbTargLib_APP_FAULT usbTargErr(11) /* application fault */ + + +/* typedefs */ + +typedef GENERIC_HANDLE USB_TARG_CHANNEL,*pUSB_TARG_CHANNEL; +typedef GENERIC_HANDLE USB_TARG_DESCR, *pUSB_TARG_DESCR; +typedef GENERIC_HANDLE USB_TARG_PIPE, *pUSB_TARG_PIPE; + +/* caller-supplied target callbacks */ + +/* target management callback */ + +typedef STATUS (*USB_TARG_MANAGEMENT_FUNC) + ( + pVOID param, + USB_TARG_CHANNEL targChannel, + UINT16 mngmtCode, /* management code */ + pVOID pContext + ); + + +/* control pipe callbacks */ + +typedef STATUS (*USB_TARG_FEATURE_CLEAR_FUNC) + ( + pVOID param, /* TCD specific parameter */ + USB_TARG_CHANNEL targChannel, /* target channel */ + UINT8 requestType, /* request type */ + UINT16 feature, /* feature to clear */ + UINT16 uIndex /* wIndex */ + ); + +typedef STATUS (*USB_TARG_FEATURE_SET_FUNC) + ( + pVOID param, /* TCD Specific Parameter */ + USB_TARG_CHANNEL targChannel, /* target channel */ + UINT8 requestType, /* request type */ + UINT16 feature, /* feature to set */ + UINT16 index /* wIndex */ + ); + +typedef STATUS (*USB_TARG_CONFIGURATION_GET_FUNC) + ( + pVOID param, /* TCD specific parameter */ + USB_TARG_CHANNEL targChannel, /* target channel */ + pUINT8 pConfiguration /* pointer to configuration value */ + ); + +typedef STATUS (*USB_TARG_CONFIGURATION_SET_FUNC) + ( + pVOID param, /* TCD specific paramter */ + USB_TARG_CHANNEL targChannel, /* target channel */ + UINT8 configuration /* configuration value */ + ); + +typedef STATUS (*USB_TARG_DESCRIPTOR_GET_FUNC) + ( + pVOID param, /* TCD specific parameter */ + USB_TARG_CHANNEL targChannel, /* target channel */ + UINT8 requestType, /* request type */ + UINT8 descriptorType, /* descriptor type */ + UINT8 descriptorIndex,/* descriptor index */ + UINT16 languageId, /* language ID */ + UINT16 length, /* length of descriptor */ + pUINT8 pBfr, /* pointer to buffer */ + pUINT16 pActLen /* length of data sent */ + ); + +typedef STATUS (*USB_TARG_DESCRIPTOR_SET_FUNC) + ( + pVOID param, /* TCD Specific Parameter */ + USB_TARG_CHANNEL targChannel, /* target channel */ + UINT8 requestType, /* request type */ + UINT8 descriptorType, /* descriptor type */ + UINT8 descriptorIndex,/* descriptor index */ + UINT16 languageId, /* language ID */ + UINT16 length, /* length of descriptor */ + pUINT8 pBfr, /* pointer to buffer */ + pUINT16 pActLen /* length of data in buffer */ + ); + +typedef STATUS (*USB_TARG_INTERFACE_GET_FUNC) + ( + pVOID param, /* TCD specific parameter */ + USB_TARG_CHANNEL targChannel, /* target channel */ + UINT16 interface, /* interface number */ + pUINT8 pAlternateSetting /* alternate setting */ + ); + +typedef STATUS (*USB_TARG_INTERFACE_SET_FUNC) + ( + pVOID param, /* TCD specific parameter */ + USB_TARG_CHANNEL targChannel, /* target channel */ + UINT16 interface, /* interface number */ + UINT8 alternateSetting /* alternate setting */ + ); + +typedef STATUS (*USB_TARG_STATUS_GET_FUNC) + ( + pVOID param, /* TCD specific parameter */ + USB_TARG_CHANNEL targChannel, /* target channel */ + UINT16 requestType, /* request type */ + UINT16 index, /* wIndex */ + UINT16 length, /* length */ + pUINT8 pBfr /* pointer to buffer */ + ); + +typedef STATUS (*USB_TARG_ADDRESS_SET_FUNC) + ( + pVOID param, /* TCD specific parameter */ + USB_TARG_CHANNEL targChannel, /* target channel */ + UINT16 deviceAddress /* device address */ + ); + +typedef STATUS (*USB_TARG_SYNCH_FRAME_GET_FUNC) + ( + pVOID param, /* TCD specific parameter */ + USB_TARG_CHANNEL targChannel, /* target channel */ + UINT16 endpoint, /* endpoint */ + pUINT16 pFrameNo /* frame number obtained */ + ); + +typedef STATUS (*USB_TARG_VENDOR_SPECIFIC_FUNC) + ( + pVOID param, /* TCD specific parameter */ + USB_TARG_CHANNEL targChannel, /* target channel */ + UINT8 requestType, /* type of request */ + UINT8 request, /* request name */ + UINT16 value, /* wValue */ + UINT16 index, /* wIndex */ + UINT16 length /* wLength */ + ); + + +typedef struct usbTargCallbackTable /* USB_TARG_CALLBACK_TABLE */ + { + /* device management callbacks */ + + USB_TARG_MANAGEMENT_FUNC mngmtFunc; /* management callback */ + + /* Control pipe callbacks */ + + USB_TARG_FEATURE_CLEAR_FUNC featureClear; /* feature clear */ + USB_TARG_FEATURE_SET_FUNC featureSet; /* feature set */ + USB_TARG_CONFIGURATION_GET_FUNC configurationGet; /*configuration get*/ + USB_TARG_CONFIGURATION_SET_FUNC configurationSet; /*configuration set*/ + USB_TARG_DESCRIPTOR_GET_FUNC descriptorGet; /* descriptor get */ + USB_TARG_DESCRIPTOR_SET_FUNC descriptorSet; /* descriptor set */ + USB_TARG_INTERFACE_GET_FUNC interfaceGet; /* interface get */ + USB_TARG_INTERFACE_SET_FUNC interfaceSet; /* interface set */ + USB_TARG_STATUS_GET_FUNC statusGet; /* status get */ + USB_TARG_ADDRESS_SET_FUNC addressSet; /* address set */ + USB_TARG_SYNCH_FRAME_GET_FUNC synchFrameGet; /* frame get */ + USB_TARG_VENDOR_SPECIFIC_FUNC vendorSpecific; /* vendor specific */ + } USB_TARG_CALLBACK_TABLE, *pUSB_TARG_CALLBACK_TABLE; + +/* Data Structures of the USB Target Library */ + +typedef struct targTcd /* TARG_TCD */ + { + LINK tcdLink; /* link to the next TCD */ + USB_TARG_CHANNEL targChannel; /* handle to TCD */ + pUSB_TARG_CALLBACK_TABLE pCallbacks;/* table of application callback*/ + pVOID callbackParam; /* callback defined callback parameter*/ + USBHAL_TCD_NEXUS tcdNexus; /* TCD Nexus Pointer */ + UINT16 speed; /* speed of operation */ + USB_TARG_PIPE defaultControlPipeIN;/* handle to default control In */ + /* pipe */ + USB_TARG_PIPE defaultControlPipeOUT;/*handle to default control Out*/ + /* pipe */ + USB_ERP setupErp; /* to handle setup transfers */ + USB_ERP defaultControlErp;/* erp used to transfer to/from */ + /* default pipe */ + UINT8 setupBfr [sizeof (USB_SETUP)];/*for receiving */ + /* setup packet */ + UINT8 dataBfr [USB_MAX_DESCR_LEN]; /* sending/receiving data */ + /* to/from default control */ + /* pipe */ + BOOL controlErpPending;/* flag indicating setup erp pending*/ + MUTEX_HANDLE tcdMutex; /* for synchronization operations */ + } TARG_TCD, *pTARG_TCD; + + +typedef struct targPipe /* TARG_PIPE */ + { + USB_TARG_PIPE pipeHandle; /* pipe handle information */ + pVOID pHalPipeHandle; /* HAL specific pipe handle */ + pTARG_TCD pTargTcd; /* pointer to targ_tcd data structure*/ + } TARG_PIPE, *pTARG_PIPE; + +/* function declarations */ + +/* Function declarations for initializing & uninitializing */ + +extern STATUS usbTargInitialize (void); + + +extern STATUS usbTargShutdown (void); + + +extern STATUS usbTargTcdAttach (USB_TCD_EXEC_FUNC tcdExecFunc, pVOID tcdParam, + pUSB_TARG_CALLBACK_TABLE pCallbacks, + pVOID callbackParam, + pUSB_TARG_CHANNEL pTargChannel); + + +extern STATUS usbTargTcdDetach (USB_TARG_CHANNEL targChannel); + +extern STATUS usbTargEnable (USB_TARG_CHANNEL targChannel); + +extern STATUS usbTargDisable (USB_TARG_CHANNEL targChannel); + +/* Function declarations for Pipe Specific Request */ + +extern STATUS usbTargPipeCreate (USB_TARG_CHANNEL targChannel, + pUSB_ENDPOINT_DESCR pEndpointDesc, + UINT16 uConfigurationValue, UINT16 uInterface, + UINT16 uAltSetting, + pUSB_TARG_PIPE pPipeHandle); + +extern STATUS usbTargPipeDestroy (USB_TARG_PIPE pipeHandle); + +extern STATUS usbTargTransfer (USB_TARG_PIPE pipeHandle, pUSB_ERP pErp); + +extern STATUS usbTargTransferAbort (USB_TARG_PIPE pipeHandle, pUSB_ERP pErp); + +extern STATUS usbTargPipeStatusSet (USB_TARG_PIPE pipeHandle, UINT16 state); + +extern STATUS usbTargPipeStatusGet (USB_TARG_PIPE pipeHandle, pUINT8 pBuf); + +/* Function declarations for default pipe requests */ + +extern STATUS usbTargControlResponseSend (USB_TARG_CHANNEL targChannel, + UINT16 bfrLen, pUINT8 pBfr); + + +extern STATUS usbTargControlPayloadRcv (USB_TARG_CHANNEL targChannel, + UINT16 bfrLen, pUINT8 pBfr, + ERP_CALLBACK userCallback); + +extern STATUS usbTargControlStatusSend (USB_TARG_CHANNEL targChannel); + +/* Function declarations for Device Control & Status Information */ + +extern STATUS usbTargCurrentFrameGet (USB_TARG_CHANNEL targChannel, + pUINT16 pFrameNo); + +extern STATUS usbTargSignalResume (USB_TARG_CHANNEL targChannel); + +extern STATUS usbTargDeviceFeatureSet (USB_TARG_CHANNEL targChannel, + UINT16 ufeatureSelector, + UINT8 uTestSelector); + +extern STATUS usbTargDeviceFeatureClear (USB_TARG_CHANNEL targChannel, + UINT16 ufeatureSelector); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbTargLibh */ diff --git a/h/usb/target/usbTargPhilipsD12EvalLib.h b/h/usb/target/usbTargPhilipsD12EvalLib.h new file mode 100644 index 0000000..929d8c7 --- /dev/null +++ b/h/usb/target/usbTargPhilipsD12EvalLib.h @@ -0,0 +1,36 @@ +/* usbTargPhilipsD12EvalLib.h - Defines usbTargPhilipsD12EvalLib interface */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01a,03sep99,rcb First. +*/ + +#ifndef __INCusbTargPhilipsD12EvalLibh +#define __INCusbTargPhilipsD12EvalLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* function prototypes */ + +VOID usbTargPhilipsD12EvalCallbackInfo + ( + pUSB_TARG_CALLBACK_TABLE *ppCallbacks, + pVOID *pCallbackParam + ); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbTargPhilipsD12EvalLibh */ + + +/* End of file. */ + diff --git a/h/usb/target/usbTargUtil.h b/h/usb/target/usbTargUtil.h new file mode 100644 index 0000000..9b54b81 --- /dev/null +++ b/h/usb/target/usbTargUtil.h @@ -0,0 +1,47 @@ +/* usbTargUtil.h - Defines Utility functions */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +02b,11may04,hch merge after D12 driver testing. +01b,19jul04,ami Coding Convention Changes +01a,30mar04,ami First + +*/ + +/* Descriptions + +This file defines the various utility functions + +*/ + + +#ifndef __INCusbTargUtilh +#define __INCusbTargUtilh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +extern int validateTarg (USB_TARG_CHANNEL targChannel,struct targTcd ** ppTcd); + +extern STATUS mngmtFunc (pTARG_TCD pTcd, UINT16 mngmtCode, pVOID pContext); + +extern VOID cntlEndpointStall (pTARG_TCD pTcd); + +extern STATUS usbTargMgmtCallback (pVOID pTargTcd, UINT16 mngmtCode, + pVOID pContext); + +extern VOID usbTargSetupErpCallback (pUSB_ERP pErp); + +extern VOID initSetupErp (pTARG_TCD pTcd); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbTargUtilh */ diff --git a/h/usb/target/usbTcd.h b/h/usb/target/usbTcd.h new file mode 100644 index 0000000..c7c5f16 --- /dev/null +++ b/h/usb/target/usbTcd.h @@ -0,0 +1,322 @@ +/* usbTcd.h - Defines generic interface to USB target controller drivers */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01e,01sep04,pdg Removed multiple definition +01d,03aug04,mta Modification History Changes +01c,19jul04,ami Coding Convnetion Changes +01b,14jul04,mta ISP1582 and Mass Storage Functionality Changes +01a,04mar04,mta First. +*/ + +/* +DESCRIPTION + +Defines the generic interface to a USB target controller driver (TCD). +*/ + + +#ifndef __INCusbTcdh +#define __INCusbTcdh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "usb/usbHandleLib.h" +#include "usb/usb.h" +#include "vwModNum.h" +#include "usb/target/usbHalCommon.h" + +/* defines */ + +/* TRB function codes */ + +/* Initialization and un-initialization Function Codes */ + +#define TCD_FNC_ATTACH 0x0000 /* attach/init target controller */ +#define TCD_FNC_DETACH 0x0001 /* detach/shutdown target controller */ +#define TCD_FNC_ENABLE 0x0002 /* enable target controller */ +#define TCD_FNC_DISABLE 0x0003 /* disable target controller */ + +/* Device Control and Status Function Codes */ + +#define TCD_FNC_ADDRESS_SET 0x0100 /* set device address */ +#define TCD_FNC_SIGNAL_RESUME 0x0101 /* drive resume signalling */ +#define TCD_FNC_DEVICE_FEATURE_SET 0x0102 /* set feature on device */ +#define TCD_FNC_DEVICE_FEATURE_CLEAR 0x0103 /* clear freature on device */ +#define TCD_FNC_CURRENT_FRAME_GET 0x0104 /* get current frame number */ + +/* Endpoint Specific Function Codes */ + +#define TCD_FNC_ENDPOINT_ASSIGN 0x0200 /* assigns an endpoint */ +#define TCD_FNC_ENDPOINT_RELEASE 0x0201 /* releases an endpoint */ +#define TCD_FNC_ENDPOINT_STATE_SET 0x0202 /* set endpoint state */ +#define TCD_FNC_ENDPOINT_STATUS_GET 0x0203 /* get endpoint status */ +#define TCD_FNC_IS_BUFFER_EMPTY 0x0204 /* is endpoint buffer empty */ +#define TCD_FNC_COPY_DATA_FROM_EPBUF 0x0205 /* copy data from endpoint buffer */ +#define TCD_FNC_COPY_DATA_TO_EPBUF 0x0206 /* copy data to endpoint buffer */ + +/* Interrupt Specific Function Codes */ + +#define TCD_FNC_INTERRUPT_STATUS_GET 0x0300 /* get interrupt status*/ +#define TCD_FNC_INTERRUPT_STATUS_CLEAR 0x0301 /* Clear Interrupt */ +#define TCD_FNC_ENDPOINT_INTERRUPT_STATUS_GET 0x0302 /* get endpoint */ + /* interrupt status */ +#define TCD_FNC_ENDPOINT_INTERRUPT_STATUS_CLEAR 0x0303 /* clear endpoint */ + /* interrupt status */ +#define TCD_FNC_HANDLE_DISCONNECT_INTERRUPT 0x0304 /* handle disconnect */ + /* interrupt */ +#define TCD_FNC_HANDLE_RESET_INTERRUPT 0x0305 /* handle reset interrupt */ +#define TCD_FNC_HANDLE_RESUME_INTERRUPT 0x0306 /* handle resume interrupt */ +#define TCD_FNC_HANDLE_SUSPEND_INTERRUPT 0x0307 /* handle suspend interrupt */ + + +/* TRB result codes */ + +/* + * USB errnos are defined as being part of the USB peripheral Module, as are + * all vxWorks module numbers, but the USB Module number is further divided + * into sub-modules. Each sub-module has upto 255 values for its own error + * codes + */ + +/* MATHEW:THESE ERROR CODES NEED TO BE REVIEWED */ + +#define USB_TCD_SUB_MODULE 2 + +#define M_usbTcdLib ( (USB_TCD_SUB_MODULE << 8) | M_usbPeriphLib ) + +#define tcdErr(x) (M_usbTcdLib | (x)) + +#define S_usbTcdLib_BAD_PARAM tcdErr(1) /* bad parameter */ +#define S_usbTcdLib_BAD_HANDLE tcdErr(2) /* bad handle */ +#define S_usbTcdLib_OUT_OF_MEMORY tcdErr(3) /* out of memory */ +#define S_usbTcdLib_OUT_OF_RESOURCES tcdErr(4) /* out of resource */ +#define S_usbTcdLib_NOT_IMPLEMENTED tcdErr(5) /* not implemented */ +#define S_usbTcdLib_GENERAL_FAULT tcdErr(6) /* general fault */ +#define S_usbTcdLib_NOT_INITIALIZED tcdErr(7) /* not initialized */ +#define S_usbTcdLib_INT_HOOK_FAILED tcdErr(8) /* faliure in int. hooking */ +#define S_usbTcdLib_HW_NOT_READY tcdErr(9) /* hardware not ready */ +#define S_usbTcdLib_NOT_SUPPORTED tcdErr(10) /* not supported */ +#define S_usbTcdLib_ERP_CANCELED tcdErr(11) /* erp cancelled */ +#define S_usbTcdLib_CANNOT_CANCEL tcdErr(12) /* cannot cancel ERP */ +#define S_usbTcdLib_SHUTDOWN tcdErr(13) /* shutdown error */ +#define S_usbTcdLib_DATA_TOGGLE_FAULT tcdErr(14) /* data toggle error */ +#define S_usbTcdLib_PID_MISMATCH tcdErr(15) /* PID mismatch */ +#define S_usbTcdLib_COMM_FAULT tcdErr(16) /* communication fault */ +#define S_usbTcdLib_STALL_ERROR tcdErr(17) /* stall error */ +#define S_usbTcdLib_NEW_SETUP_PACKET tcdErr(18) /* setup packet error */ +#define S_usbTcdLib_DATA_OVERRUN tcdErr(19) /* data overrun */ + +/* endpoint states */ + +#define TCD_ENDPOINT_STALL 0x01 /* endpoint stall */ +#define TCD_ENDPOINT_UNSTALL 0x02 /* endpoint unstall */ + + +/* Interrupt status masks */ +#define USBTCD_DISCONNECT_INTERRUPT_MASK 0x01 /* disconnect interrupt mask */ +#define USBTCD_RESET_INTERRUPT_MASK 0x02 /* reset interrupt mask */ +#define USBTCD_SUSPEND_INTERRUPT_MASK 0x04 /* suspend interrupt mask */ +#define USBTCD_RESUME_INTERRUPT_MASK 0x08 /* resume interrupt mask */ +#define USBTCD_ENDPOINT_INTERRUPT_MASK 0x10 /* endpoint interrupt mask */ + +/* Endpoint interrupt status masks */ +#define USBTCD_ENDPOINT_INTERRUPT_PENDING_MASK 0x01 /* endpoint interrupt */ + /* pending mask */ +#define USBTCD_ENDPOINT_SETUP_PID_MASK 0x02 /* setup interrupt */ +#define USBTCD_ENDPOINT_OUT_PID_MASK 0x04 /* out interrupt mask */ +#define USBTCD_ENDPOINT_IN_PID_MASK 0x08 /* in interrupt mask */ +#define USBTCD_ENDPOINT_TRANSFER_STATUS_MASK 0x0FF0 /* endpoint transfer */ + /* status mask */ + +/* Endpoint interrupt status error code values */ +#define USBTCD_ENDPOINT_TRANSFER_SUCCESS 0x0000 /* transfer success */ +#define USBTCD_ENDPOINT_DATA_TOGGLE_ERROR 0x00E0 /* data toggle error */ +#define USBTCD_ENDPOINT_PID_MISMATCH 0x00F0 /* PID mismatch */ +#define USBTCD_ENDPOINT_COMMN_FAULT 0x0100 /*Communication Fault*/ +#define USBTCD_ENDPOINT_STALL_ERROR 0x0110 /* stall error */ +#define USBTCD_ENDPOINT_DATA_OVERRUN 0x0120 /* data overrun */ +#define USBTCD_ENDPOINT_DATA_UNDERRUN 0x0130 /* data underrun */ +#define USBTCD_ENDPOINT_CRC_ERROR 0x0140 /* CRC error */ +#define USBTCD_ENDPOINT_TIMEOUT_ERROR 0x0150 /* Time Out error */ +#define USBTCD_ENDPOINT_BIT_STUFF_ERROR 0x0160 /* bit stuff error */ + +/* typedefs */ + +typedef GENERIC_HANDLE TCD_HANDLE, *pTCD_HANDLE; + +/* hal isr callback */ + +typedef void (*USB_HAL_ISR_CALLBACK)( pVOID pHALData); + +typedef struct usbHalDeviceInfo /* USBHAL_DEVICE_INFO */ + { + UINT8 uNumberEndpoints; /* no of endpoints supported */ + } USBHAL_DEVICE_INFO, *pUSBHAL_DEVICE_INFO; + +typedef struct trbHeader /* TRB_HEADER */ + { + TCD_HANDLE handle; /* I/O caller's TCD client handle */ + UINT16 function; /* IN TCD function code */ + UINT16 trbLength; /* IN Length of the total TRB */ + } TRB_HEADER, *pTRB_HEADER; + + +typedef struct trbAttach /* TRB_ATTACH */ + { + TRB_HEADER header; /* I/0 TRB header */ + pVOID tcdParam; /* IN TCD specific info */ + USB_HAL_ISR_CALLBACK usbHalIsr; /* IN isr callback function of HAL */ + pVOID usbHalIsrParam; /* IN isr callback function parameter */ + pUSBHAL_DEVICE_INFO pHalDeviceInfo; /* OUT HAL specific device info ptr */ + pUSB_APPLN_DEVICE_INFO pDeviceInfo; /* OUT device specific info ptr*/ + } TRB_ATTACH, *pTRB_ATTACH; + +typedef struct trbDetach /* TRB_DETACH */ + { + TRB_HEADER header; /* IN TRB header */ + } TRB_DETACH, *pTRB_DETACH; + +typedef struct trbEnableDisable /* TRB_ENABLE_DISABLE */ + { + TRB_HEADER header; /* IN TRB header */ + } TRB_ENABLE_DISABLE, *pTRB_ENABLE_DISABLE; + +typedef struct trbAddressSet /* TRB_ADDRESS_SET */ + { + TRB_HEADER header; /* IN TRB header */ + UINT8 deviceAddress; /* IN new device address */ + } TRB_ADDRESS_SET, *pTRB_ADDRESS_SET; + +typedef struct trbSignalResume /* TRB_SIGNAL_RESUME */ + { + TRB_HEADER header; /* IN TRB header */ + } TRB_SIGNAL_RESUME, *pTRB_SIGNAL_RESUME; + +typedef struct trbDeviceFeatureSetClear /* TRB_DEVICE_FEATURE_SET_CLEAR */ + { + TRB_HEADER header; /* IN TRB header */ + UINT16 uFeatureSelector; /* IN Feature to be set or cleared */ + UINT8 uTestSelector; /* IN Test Selector Value */ + } TRB_DEVICE_FEATURE_SET_CLEAR,*pTRB_DEVICE_FEATURE_SET_CLEAR; + +typedef struct trbCurrentFrameGet /* TRB_CURRENT_FRAME_GET */ + { + TRB_HEADER header; /* IN TRB header */ + UINT16 frameNo; /* OUT current frame number */ + } TRB_CURRENT_FRAME_GET, *pTRB_CURRENT_FRAME_GET; + + +typedef struct trbEndpointAssign /* TRB_ENDPOINT_ASSIGN */ + { + TRB_HEADER header; /* IN TRB header */ + pUSB_ENDPOINT_DESCR pEndpointDesc; /* IN Ptr to Endpoint Descriptor */ + UINT32 uConfigurationValue; /* IN configuration calue */ + UINT32 uInterface; /* IN interface number of endpoint */ + UINT32 uAltSetting; /* IN alternate setting for interface */ + UINT32 pipeHandle; /* OUT pipe handle */ + }TRB_ENDPOINT_ASSIGN, *pTRB_ENDPOINT_ASSIGN; + +typedef struct trbEndpointRelease /* TRB_ENDPOINT_RELEASE */ + { + TRB_HEADER header; /* IN TRB header */ + UINT32 pipeHandle; /* IN pipe handle */ + } TRB_ENDPOINT_RELEASE, *pTRB_ENDPOINT_RELEASE; + +typedef struct trbEndpointStateSet /* TRB_ENDPOINT_STATE_SET */ + { + TRB_HEADER header; /* IN TRB header */ + UINT32 pipeHandle; /* IN pipe handle */ + UINT16 state; /* IN state of pipe TCD_ENDPOINT_xxxx */ + } TRB_ENDPOINT_STATE_SET, *pTRB_ENDPOINT_STATE_SET; + +typedef struct trbEndpointStatusGet /* TRB_ENDPOINT_STATUS_GET */ + { + TRB_HEADER header; /* IN TRB header */ + UINT32 pipeHandle; /* IN pipe handle */ + pUINT8 pStatus; /* OUT ptr to status of pipe */ + } TRB_ENDPOINT_STATUS_GET, *pTRB_ENDPOINT_STATUS_GET; + + +typedef struct trbIsBufferEmpty /* TRB_IS_BUFFER_EMPTY */ + { + TRB_HEADER header; /* IN TRB header */ + UINT32 pipeHandle; /* IN pipe handle */ + BOOL bufferEmpty; /* OUT if buffer is empty TRUE */ + } TRB_IS_BUFFER_EMPTY, *pTRB_IS_BUFFER_EMPTY; + +typedef struct trbCopyDataFromEpbuf /* TRB_COPY_DATA_FROM_EPBUF */ + { + TRB_HEADER header; /* IN TRB header */ + UINT32 pipeHandle; /* IN pipe handle */ + UCHAR* pBuffer; /* IN buffer pointer */ + UINT32 uActLength; /* I/O length of buffer before */ + /* function call, actual data length */ + /* copied on function call return */ + } TRB_COPY_DATA_FROM_EPBUF, *pTRB_COPY_DATA_FROM_EPBUF; + +typedef struct trbCopyDataToEpbuf /* TRB_COPY_DATA_TO_EPBUF */ + { + TRB_HEADER header; /* IN TRB header */ + UINT32 pipeHandle; /* IN pipe handle */ + UCHAR * pBuffer; /* IN buffer pointer */ + UINT32 uActLength; /* I/O length of buffer before */ + /*function call, actual data length */ + /*copied on function call return */ + BOOL zeroLengthPacket; /* IN , if TRUE zero length packet */ + /* is sent */ + } TRB_COPY_DATA_TO_EPBUF, *pTRB_COPY_DATA_TO_EPBUF; + +typedef struct trbInterruptStatusGetClear /* TRB_INTERRUPT_STATUS_GET_CLEAR */ + { + TRB_HEADER header; /* IN TRB header */ + UINT32 uInterruptStatus; /* I/O interrupt bit mask */ + } TRB_INTERRUPT_STATUS_GET_CLEAR, *pTRB_INTERRUPT_STATUS_GET_CLEAR; + +typedef struct trbEndpointInterruptStatusGet /*TRB_ENDPOINT_INTERRUPT_STATUS_GET*/ + { + TRB_HEADER header; /* IN TRB header */ + UINT32 pipeHandle; /* IN pipe handle */ + UINT32 uEndptInterruptStatus; /* OUT endpoint interrupt status */ + } TRB_ENDPOINT_INTERRUPT_STATUS_GET,*pTRB_ENDPOINT_INTERRUPT_STATUS_GET; + +typedef struct trbEndpointInterruptStatusClear /* TRB_ENDPOINT_INTERRUPT_STATUS_CLEAR */ + { + TRB_HEADER header; /* IN TRB header */ + UINT32 pipeHandle; /* IN pipe handle */ + } TRB_ENDPOINT_INTERRUPT_STATUS_CLEAR,*pTRB_ENDPOINT_INTERRUPT_STATUS_CLEAR; + +typedef struct trbHandleDisconnectInterrupt /* TRB_HANDLE_DISCONNECT_INTERRUPT */ + { + TRB_HEADER header; /* IN TRB header */ + } TRB_HANDLE_DISCONNECT_INTERRUPT,*pTRB_HANDLE_DISCONNECT_INTERRUPT; + +typedef struct trbHandleResetInterrupt /* TRB_HANDLE_RESET_INTERRUPT */ + { + TRB_HEADER header; /* IN TRB header */ + UINT32 uSpeed; /* OUT Operating speed of the device */ + } TRB_HANDLE_RESET_INTERRUPT, *pTRB_HANDLE_RESET_INTERRUPT; + +typedef struct trbHandleResumeInterrupt /* TRB_HANDLE_RESUME_INTERRUPT */ + { + TRB_HEADER header; /* IN TRB header */ + } TRB_HANDLE_RESUME_INTERRUPT, *pTRB_HANDLE_RESUME_INTERRUPT; + +typedef struct trbHandleSuspendInterrupt /* TRB_HANDLE_SUSPEND_INTERRUPT */ + { + TRB_HEADER header; /* IN TRB header */ + } TRB_HANDLE_SUSPEND_INTERRUPT,*pTRB_HANDLE_SUSPEND_INTERRUPT; + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbTcdh */ diff --git a/h/usb/target/usbTcdLib.h b/h/usb/target/usbTcdLib.h new file mode 100644 index 0000000..8944e05 --- /dev/null +++ b/h/usb/target/usbTcdLib.h @@ -0,0 +1,152 @@ +/* usbTcdLib.h - TCD functional API */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01b,17aug04,hch correct the directory reference for usbTcd.h +01a,09aug99,rcb First. +*/ + +/* +DESCRIPTION + +This file defines a functional interface to the TCD. +*/ + +#ifndef __INCusbTcdLibh +#define __INCusbTcdLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include "usb/target/usbTcd.h" + + +/* defines */ + + +/* typedefs */ + +/* + * TCD_NEXUS + * + * TCD_NEXUS contains the entry point and TCD_CLIENT_HANDLE needed by a + * TCD caller to invoke a TCD. + */ + +typedef struct tcd_nexus + { + USB_TCD_EXEC_FUNC tcdExecFunc; /* TCD primary entry point */ + TCD_HANDLE handle; /* client's handle with TCD */ + } TCD_NEXUS, *pTCD_NEXUS; + + +/* functions */ + +STATUS usbTcdAttach + ( + USB_TCD_EXEC_FUNC tcdExecFunc, /* TCD's primary entry point */ + pVOID tcdParam, /* TCD-specific param */ + pTCD_NEXUS pNexus, /* nexus will be initialized on return */ + USB_TCD_MNGMT_CALLBACK mngmtCallback, /* caller's management callback */ + pVOID mngmtCallbackParam, /* caller-defined mngmt callback param */ + pUINT16 pSpeed, /* bfr to receive target's speed */ + pUINT16 pNumEndpoints, /* bfr to receive nbr of endpoints */ + pUSB_TARG_ENDPOINT_INFO *ppEndpoints /* bfr to receive ptr to endpt tbl */ + ); + + +STATUS usbTcdDetach + ( + pTCD_NEXUS pNexus /* client's nexus */ + ); + + +STATUS usbTcdEnable + ( + pTCD_NEXUS pNexus /* client's nexus */ + ); + + +STATUS usbTcdDisable + ( + pTCD_NEXUS pNexus /* client's nexus */ + ); + + +STATUS usbTcdAddressSet + ( + pTCD_NEXUS pNexus, /* client's nexus */ + UINT16 deviceAddress /* new address for target */ + ); + + +STATUS usbTcdSignalResume + ( + pTCD_NEXUS pNexus /* client's nexus */ + ); + + +STATUS usbTcdEndpointAssign + ( + pTCD_NEXUS pNexus, /* client's nexus */ + UINT16 endpointId, /* TCD-assigned endpoint ID */ + UINT16 endpointNum, /* endpoint number to be assigned */ + UINT16 configuration, /* configuration associated with endpoint */ + UINT16 interface, /* interface associated with endpoint */ + UINT16 transferType, /* transfer type for endpoint */ + UINT16 direction /* direction for endpoint */ + ); + + +STATUS usbTcdEndpointRelease + ( + pTCD_NEXUS pNexus, /* client's nexus */ + UINT16 endpointId /* endpointId to release */ + ); + + +STATUS usbTcdEndpointStateSet + ( + pTCD_NEXUS pNexus, /* client's nexus */ + UINT16 endpointId, /* endpointId */ + UINT16 state /* TCD_ENDPOINT_STALL/UNSTALL */ + ); + + +STATUS usbTcdCurrentFrameGet + ( + pTCD_NEXUS pNexus, /* client's nexus */ + pUINT16 pFrameNo /* current frame number */ + ); + + +STATUS usbTcdErpSubmit + ( + pTCD_NEXUS pNexus, /* client's nexus */ + pUSB_ERP pErp /* ERP to be executed */ + ); + + +STATUS usbTcdErpCancel + ( + pTCD_NEXUS pNexus, /* client's nexus */ + pUSB_ERP pErp /* ERP to be canceled */ + ); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbTcdLibh */ + + +/* End of file. */ + diff --git a/h/usb/target/usbTcdPdiusbd12EvalLib.h b/h/usb/target/usbTcdPdiusbd12EvalLib.h new file mode 100644 index 0000000..4bcc205 --- /dev/null +++ b/h/usb/target/usbTcdPdiusbd12EvalLib.h @@ -0,0 +1,58 @@ +/* usbTcdPdiusbd12EvalLib.h - Defines interface to Philips usbTcdPdiusbd12Lib.c */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01a,05aug99,rcb First. +*/ + +/* +DESCRIPTION + +Defines the interface to the USB TCD (target controller driver) for the Philips +PDIUSBD12 evaluation board. +*/ + +#ifndef __INCusbTcdPdiusbd12EvalLibh +#define __INCusbTcdPdiusbd12EvalLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* typedefs */ + +/* USB_TCD_PDIUSBD12_PARAMS + * + * The to the USB_TCD_ATTACH function for this TCD must be a pointer + * to the following structure. The caller must initialize the structure with the + * correct parameters for the hardware to be attached. + */ + +typedef struct usb_tcd_pdiusbd12_params + { + UINT32 ioBase; /* Base I/O address range */ + UINT16 irq; /* IRQ channel (e.g., 5 = IRQ5) */ + UINT16 dma; /* DMA channel (e.g., 3 = DMA3) */ + } USB_TCD_PDIUSBD12_PARAMS, *pUSB_TCD_PDIUSBD12_PARAMS; + + +/* function prototypes */ + +/* Primary TCD entry point */ + +STATUS usbTcdPdiusbd12EvalExec (pVOID pTrb); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbTcdPdiusbd12EvalLibh */ + + +/* End of file. */ + diff --git a/h/usb/tools/cmdParser.h b/h/usb/tools/cmdParser.h new file mode 100644 index 0000000..06d166b --- /dev/null +++ b/h/usb/tools/cmdParser.h @@ -0,0 +1,205 @@ +/* cmdParser.h - Command line parsing utility functions */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01b,23nov99,rcb Make KeywordMatch() function public. +01a,01jun99,rcb First. +*/ + +/* +DESCRIPTION + +This file includes a collection of command-line parsing functions which are +useful in the creation of command line utilities, such as bus exercisers. + +There are three groups of functions defined by this library. The first is +a collection of general string parser functions, such as functions to eliminate +white space, functions to strip tokens out of a string, and so forth. + +The second set of functions drive the actual parsing process. In order to +use this second set of functions, clients must construct a table of CMD_DESCR +structures which define the commands to be recognized by the parser. A +brief example of such a table is shown below. + +.CS +CMD_DESCR commands [] = + { + {"Help", 4, "Help/?", "Displays list of commands.", CmdParserHelpFunc}, + {"?", 1, NULL, NULL, CmdParserHelpFunc}, + {"Exit", 4, "Exit", "Exits program.", CmdParserExitFunc}, + {NULL, 0, NULL, NULL, NULL} + }; +.CE + +The first field is the keyword for the command. The second field specifies +the number of characters of the command which must match - allowing the user +to enter only a portion of the keyword as a shortcut. The third and fourth +fields are strings giving the command usage and a brief help string. A NULL +in the Help field indicates that the corresponding keyword is a synonym for +another command its usage/help should not be shown. The final field is a +pointer to a function of type CMD_EXEC_FUNC which will be invoked if the +parser encounters the corresponding command. + +The third group of functions provide standard CMD_EXEC_FUNCs for certain +commonly used commands, such as CmdParserHelpFunc and CmdParserExitFunc as +shown in the preceding example. + +The caller may pass a generic (pVOID) parameter to the command line parsing +functions in the second group. This function is in turn passed to the +CMD_EXEC_FUNCs. In this way, the caller can specify context information +for the command execution functions. + +Commands are executed after the user presses [enter]. Multiple commands may +be entered on the same command line separated by semicolons (';'). Each +command as if it had been entered on a separate line (unless a command +terminates with an error, in which case all remaining commands entered on the +same line will be ignored). +*/ + + +#ifndef __INCcmdParserh +#define __INCcmdParserh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Constants */ + +/* Command parser return codes */ + +#define RET_OK 0 /* Normal termination */ +#define RET_ERROR 1 /* Program failure */ +#define RET_CONTINUE 2 /* Program continues looping */ + + +/* Prompt & input definitions */ + +#define CMD_SEPARATOR ';' /* Command separator character */ + +#define MAX_CMD_LEN 256 /* Maximum command length */ +#define MAX_KEYWORD_LEN 32 /* Maximum cmd keyword length */ + + +/* Command descriptors */ + +/* + * CMD_EXEC_FUNC + * + * Note: The CMD_EXEC_FUNC is expected to update the parameter so + * that it points to the next character in the command line following + * the parameters consumed by the CMD_EXEC_FUNC itself. + */ + + +typedef UINT16 (*CMD_EXEC_FUNC) + ( + pVOID param, /* Generic parameter passed down */ + char **ppCmd, /* Ptr to remainder of cmd line */ + FILE *fin, /* stream for input (if any) */ + FILE *fout /* stream for output (if any) */ + ); + +/* + * CMD_DESCR - defines a command/keyword to be recognized by parser + */ + +typedef struct cmd_descr + { + char *keyword; /* Command keyword */ + int minMatch; /* Minimum # of chars to match */ + char *usage; /* Syntax */ + char *help; /* Description string */ + CMD_EXEC_FUNC execFunc; /* Command execution function */ + } CMD_DESCR, *pCMD_DESCR; + + +/* function prototypes */ + +UINT16 PromptAndExecCmd + ( + pVOID param, /* Generic parameter for exec funcs */ + char *pPrompt, /* Prompt to display */ + FILE *fin, /* Input stream */ + FILE *fout, /* Output stream */ + CMD_DESCR *pCmdTable /* CMD_DESCR table */ + ); + + +UINT16 ExecCmd + ( + pVOID param, /* Generic parameter for exec funcs */ + char *pCmd, /* Cmd buffer to be parsed/executed */ + FILE *fin, /* Stream for input */ + FILE *fout, /* Stream for output */ + CMD_DESCR *pCmdTable /* CMD_DESCR table */ + ); + + +int KeywordMatch + ( + char *s1, /* string 1 */ + char *s2, /* string 2 */ + int len /* max length to compare */ + ); + + +char *SkipSpace + ( + char *pStr /* Input string */ + ); + + +UINT16 TruncSpace + ( + char *pStr /* Input string */ + ); + + +char *GetNextToken + ( + char *pStr, /* Input string */ + char *pToken, /* Bfr to receive token */ + UINT16 tokenLen /* Max length of Token bfr */ + ); + + +char *GetHexToken + ( + char *pStr, /* input string */ + long *pToken, /* buffer to receive token value */ + long defVal /* default value */ + ); + + +UINT16 CmdParserHelpFunc + ( + pVOID param, /* Generic parameter passed down */ + char **ppCmd, /* Ptr to remainder of cmd line */ + FILE *fin, /* stream for input (if any) */ + FILE *fout /* stream for output (if any) */ + ); + + +UINT16 CmdParserExitFunc + ( + pVOID param, /* Generic parameter passed down */ + char **ppCmd, /* Ptr to remainder of cmd line */ + FILE *fin, /* stream for input (if any) */ + FILE *fout /* stream for output (if any) */ + ); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcmdParserh */ + + +/* End of file. */ + diff --git a/h/usb/tools/wavFormat.h b/h/usb/tools/wavFormat.h new file mode 100644 index 0000000..bc0fc7b --- /dev/null +++ b/h/usb/tools/wavFormat.h @@ -0,0 +1,90 @@ +/* wavFormat.h - WAV audio file format */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01a,14jan00,rcb First. +*/ + +#ifndef __INCwavFormath +#define __INCwavFormath + +#ifdef __cplusplus +extern "C" { +#endif + + +/* RIFF file header */ + +#define RIFF_HDR_SIG "RIFF" +#define RIFF_HDR_SIG_LEN 4 + +typedef struct riff_hdr + { + char signature [4]; /* identifier string = "RIFF" */ + UINT32 length; /* remaining length after this header */ + } RIFF_HDR, *pRIFF_HDR; + + +/* RIFF .wav file signature */ + +#define RIFF_WAV_DATA_SIG "WAVE" +#define RIFF_WAV_DATA_SIG_LEN 4 + + +/* RIFF chunk header */ + +#define RIFF_CHUNK_ID_LEN 4 + +typedef struct riff_chunk_hdr + { + char chunkId [RIFF_CHUNK_ID_LEN]; /* ID of chunk */ + UINT32 length; /* remaining length after header */ + } RIFF_CHUNK_HDR, *pRIFF_CHUNK_HDR; + + +/* .wav format chunk */ + +#define RIFF_WAV_FMT_CHUNK_ID "fmt " + +typedef struct wav_format_chunk + { + UINT16 formatTag; /* format category */ + UINT16 channels; /* number of channels */ + UINT32 samplesPerSec; /* sampling rate */ + UINT32 avgBytesPerSec; /* used to estminate bfr requirements */ + UINT16 blockAlign; /* data block size */ + union + { + struct /* MS PCM-specific data */ + { + UINT16 bitsPerSample; /* sample size */ + } msPcm; + } fmt; + } WAV_FORMAT_CHUNK, *pWAV_FORMAT_CHUNK; + + +/* .wav format categories */ + +#define WAV_FMT_MS_PCM 0x0001 /* Microsoft PCM */ +#define WAV_FMT_IBM_MULAW 0x0101 /* IBM mul-law */ +#define WAV_FMT_IBM_ALAW 0x0102 /* IBM a-law */ +#define WAV_FMT_IBM_ADPCM 0x0103 /* IBM AVC ADPCM */ + + +/* data chunk */ + +#define RIFF_WAV_DATA_CHUNK_SIG "data" + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwavFormath */ + + +/* End of file. */ + diff --git a/h/usb/usb.h b/h/usb/usb.h new file mode 100644 index 0000000..3208780 --- /dev/null +++ b/h/usb/usb.h @@ -0,0 +1,701 @@ +/* usb.h - Basic USB (Universal Serial Bus) definitions */ + +/* Copyright 2000-2005 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01b,19jan05,h_k added pragma pack to USB_DESCR_TYPLEN and USB_HID_DESCR and + added USB_HID_DESCR_LEN. (SPR #104230) +01a,08sep04,ami New macros added +01a,16jul04,??? Backward compatibility with the USB 1.1 Peripheral stack +02b,03may04,??? Addition of macros for USB 2.0 +02a,2April04,prashee USB 2.0 modifications +01i,28mar02,h_k removed #if (CPU==SH7700)&&(_BYTE_ORDER==_BIG_ENDIAN) and set + USB_MAX_DESCR_LEN 255 for SH7700 (SPR #73896). +01h,16nov11,wef Pack ENDPOINT_DESCRIPTOR structure. +01g,08nov11,wef add provisions for SH - pack structures and conditionally make + USB_MAX_DESCR_LEN a multiple of 4 +01f,18sep01,wef merge from wrs.tor2_0.usb1_1-f for veloce +01e,25jul01,rcb fixed spr #69287 +01d,26jan00,rcb Add "dataBlockSize" field to USB_IRP to give application + greater control over isochronous transfer sizes. + Change USB_BFR_LIST "bfrLen" and "actLen" fields to UINT32. +01c,12jan00,rcb Add definition for USB_CLASS_AUDIO. + Add typedef for USB_DESCR_HDR_SUBHDR. +01b,07sep99,rcb Add definition for USB_TIME_RESUME. +01a,03jun99,rcb First. +*/ + +/* +DESCRIPTION + +This file defines constants and structures related to the USB (Universal +Serial Bus). + +NOTE: The USB specification defines that multi-byte fields will be stored +in little-endian format. +*/ + +#ifndef __INCusbh +#define __INCusbh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include "usb/usbListLib.h" +#include "usb/usbHandleLib.h" + + +/* Defined by the USB */ + +/* defines */ + +#define USB_MAX_DEVICES 127 + +#define USB_MAX_TOPOLOGY_DEPTH 6 + +#define USB_MAX_DESCR_LEN 255 + + +/* USB class codes */ + +#define USB_CLASS_AUDIO 0x01 +#define USB_CLASS_HID 0x03 +#define USB_CLASS_PRINTER 0x07 +#define USB_CLASS_HUB 0x09 + + +/* USB requestType (bmRequestType) bit fields */ + +#define USB_RT_DIRECTION_MASK 0x80 +#define USB_RT_HOST_TO_DEV 0x00 +#define USB_RT_DEV_TO_HOST 0x80 + +#define USB_RT_CATEGORY_MASK 0x60 +#define USB_RT_STANDARD 0x00 +#define USB_RT_CLASS 0x20 +#define USB_RT_VENDOR 0x40 + +#define USB_RT_RECIPIENT_MASK 0x03 +#define USB_RT_DEVICE 0x00 +#define USB_RT_INTERFACE 0x01 +#define USB_RT_ENDPOINT 0x02 +#define USB_RT_OTHER 0x03 + + +/* USB requests (bRequest) */ + +#define USB_REQ_GET_STATUS 0 +#define USB_REQ_CLEAR_FEATURE 1 +#define USB_REQ_GET_STATE 2 +#define USB_REQ_SET_FEATURE 3 +#define USB_REQ_SET_ADDRESS 5 +#define USB_REQ_GET_DESCRIPTOR 6 +#define USB_REQ_SET_DESCRIPTOR 7 +#define USB_REQ_GET_CONFIGURATION 8 +#define USB_REQ_SET_CONFIGURATION 9 +#define USB_REQ_GET_INTERFACE 10 +#define USB_REQ_SET_INTERFACE 11 +#define USB_REQ_GET_SYNCH_FRAME 12 + + +/* USB descriptor types */ + +#define USB_DESCR_DEVICE 0x01 +#define USB_DESCR_CONFIGURATION 0x02 +#define USB_DESCR_STRING 0x03 +#define USB_DESCR_INTERFACE 0x04 +#define USB_DESCR_ENDPOINT 0x05 +#define USB_DESCR_DEVICE_QUALIFIER 0x06 +#define USB_DESCR_OTHER_SPEED_CONFIGURATION 0x07 +#define USB_DESCR_INTERFACE_POWER 0x08 +#define USB_DESCR_HID 0x21 +#define USB_DESCR_REPORT 0x22 /* HID report descriptor */ +#define USB_DESCR_PHYSICAL 0x23 /* HID physical descriptor */ +#define USB_DESCR_HUB 0x29 + + +/* configuration descriptor attributes values */ + +#define USB_ATTR_SELF_POWERED 0x40 +#define USB_ATTR_REMOTE_WAKEUP 0x20 + + +/* Max power available from a hub port */ + +#define USB_POWER_SELF_POWERED 500 /* 500 mA */ +#define USB_POWER_BUS_POWERED 100 /* 100 mA */ + + +/* power requirements as reported in configuration descriptors */ + +#define USB_POWER_MA_PER_UNIT 2 /* 2 mA per unit */ + + +/* endpoint descriptor attributes values */ + +#define USB_ATTR_EPTYPE_MASK 0x03 +#define USB_ATTR_CONTROL 0x00 +#define USB_ATTR_ISOCH 0x01 +#define USB_ATTR_BULK 0x02 +#define USB_ATTR_INTERRUPT 0x03 + + +/* standard USB feature selectors */ + +#define USB_FSEL_DEV_REMOTE_WAKEUP 1 +#define USB_FSEL_DEV_TEST_MODE 2 +#define USB_FSEL_DEV_ENDPOINT_HALT 0 + +/* test selector values for the TEST_MODE feature */ + +#define USB_TEST_MODE_J_STATE 0x01 /* Test_J */ +#define USB_TEST_MODE_K_STATE 0x02 /* Test_K */ +#define USB_TEST_MODE_SE0_ACK 0x03 /* Test_SE0 */ +#define USB_TEST_MODE_TEST_PACKET 0x04 /* Test Packet */ +#define USB_TEST_MODE_TEST_FORCE_ENABLE 0x05 /* Test Force Enable */ + +/* hub feature selections */ + +#define USB_HUB_FSEL_C_HUB_LOCAL_POWER 0 +#define USB_HUB_FSEL_C_HUB_OVER_CURRENT 1 +#define USB_HUB_FSEL_PORT_CONNECTION 0 +#define USB_HUB_FSEL_PORT_ENABLE 1 +#define USB_HUB_FSEL_PORT_SUSPEND 2 +#define USB_HUB_FSEL_PORT_OVER_CURRENT 3 +#define USB_HUB_FSEL_PORT_RESET 4 +#define USB_HUB_FSEL_PORT_POWER 8 +#define USB_HUB_FSEL_PORT_LOW_SPEED 9 +#define USB_HUB_FSEL_C_PORT_CONNECTION 16 +#define USB_HUB_FSEL_C_PORT_ENABLE 17 +#define USB_HUB_FSEL_C_PORT_SUSPEND 18 +#define USB_HUB_FSEL_C_PORT_OVER_CURRENT 19 +#define USB_HUB_FSEL_C_PORT_RESET 20 + + +/* endpoint direction mask */ + +#define USB_ENDPOINT_DIR_MASK 0x80 +#define USB_ENDPOINT_OUT 0x00 +#define USB_ENDPOINT_IN 0x80 + + +/* standard endpoints */ + +#define USB_MAX_ENDPOINT_NUM 15 +#define USB_ENDPOINT_MASK 0xf + +/* Max packet size related macros */ +#define USB_MAX_PACKET_SIZE_MASK 0x7ff +#define USB_NUMBER_OF_TRANSACTIONS_MASK 0x1800 +#define USB_NUMBER_OF_TRANSACTIONS_BITPOSITION 11 + + +#define USB_ENDPOINT_DEFAULT_CONTROL 0 + + +/* hub characteristics */ + +#define USB_HUB_GANGED_POWER 0x0000 +#define USB_HUB_INDIVIDUAL_POWER 0x0001 + +#define USB_HUB_NOT_COMPOUND 0x0000 +#define USB_HUB_COMPOUND 0x0004 + +#define USB_HUB_GLOBAL_OVERCURRENT 0x0000 +#define USB_HUB_INDIVIDUAL_OVERCURRENT 0x0008 + + +/* standard device status */ + +#define USB_DEV_STS_LOCAL_POWER 0x0001 +#define USB_DEV_STS_REMOTE_WAKEUP 0x0002 + + +/* standard endpoint status */ + +#define USB_ENDPOINT_STS_HALT 0x0001 + + +/* hub status & change */ + +#define USB_HUB_STS_LOCAL_POWER 0x0001 +#define USB_HUB_STS_OVER_CURRENT 0x0002 + +#define USB_HUB_C_LOCAL_POWER 0x0001 +#define USB_HUB_C_OVER_CURRENT 0x0002 + + +/* hub port status & change */ + +#define USB_HUB_STS_PORT_CONNECTION 0x0001 +#define USB_HUB_STS_PORT_ENABLE 0x0002 +#define USB_HUB_STS_PORT_SUSPEND 0x0004 +#define USB_HUB_STS_PORT_OVER_CURRENT 0x0008 +#define USB_HUB_STS_PORT_RESET 0x0010 +#define USB_HUB_STS_PORT_POWER 0x0100 +#define USB_HUB_STS_PORT_LOW_SPEED 0x0200 + +#define USB_HUB_C_PORT_CONNECTION 0x0001 +#define USB_HUB_C_PORT_ENABLE 0x0002 +#define USB_HUB_C_PORT_SUSPEND 0x0004 +#define USB_HUB_C_PORT_OVER_CURRENT 0x0008 +#define USB_HUB_C_PORT_RESET 0x0010 + + +/* hub status endpoint */ + +#define USB_HUB_ENDPOINT_STS_HUB 0x01 +#define USB_HUB_ENDPOINT_STS_PORT0 0x02 + + +/* USB timing */ + +#define USB_TIME_POWER_ON 100 /* 100 msec */ +#define USB_TIME_RESET 50 /* 50 msec */ +#define USB_TIME_RESET_RECOVERY 10 /* 10 msec */ +#define USB_TIME_SET_ADDRESS 2 /* 2 msec */ +#define USB_TIME_REQUEST 5000 /* 5 seconds */ +#define USB_TIME_RESUME 20 /* 20 msec */ + + +/* USB packet identifiers */ + +#define USB_PID_SETUP 0x2d +#define USB_PID_OUT 0xe1 +#define USB_PID_IN 0x69 + + +/* packet size range */ + +#define USB_MIN_CTRL_PACKET_SIZE 8 /* min for control pipe */ +#define USB_MAX_CTRL_PACKET_SIZE 64 /* max for control pipe */ +#define USB_MAX_HIGH_SPEED_BULK_SIZE 512 /* Maximum size for a high speed + * bulk pipe + */ + +#define USB_MAX_BULK_OUT_NAK_RATE 255 /* Maximum NAK rate for a bulk + * OUT pipe + */ + + +/* maximum bandwidth (expressed as nanoseconds per frame) which may be + * allocated for various purposes. + */ + +#define USB_LIMIT_ISOCH_INT ((UINT32) 900000L) /* 900 usec */ +#define USB_LIMIT_ALL ((UINT32) 999000L) /* 999 usec */ + + +/* Typedefs */ + +/* + * USB_SETUP + */ + +typedef struct usb_setup + { + UINT8 requestType; /* bmRequestType */ + UINT8 request; /* bRequest */ + UINT16 value; /* wValue */ + UINT16 index; /* wIndex */ + UINT16 length; /* wLength */ + } USB_SETUP, *pUSB_SETUP; + + +/* + * USB_DESCR_HDR + * + * header common to all USB descriptors + */ + +typedef struct usb_descr_hdr + { + UINT8 length; /* bLength */ + UINT8 descriptorType; /* bDescriptorType */ + } USB_DESCR_HDR, *pUSB_DESCR_HDR; + +#define USB_DESCR_HDR_LEN 2 + +/* + * USB_DESCR_HDR_SUBHDR + * + * Some classes of USB devices (e.g., audio) use descriptors with a + * header and a subheader. + */ + +typedef struct usb_descr_hdr_subhdr + { + UINT8 length; /* bLength */ + UINT8 descriptorType; /* bDescriptorType */ + UINT8 descriptorSubType; /* bDescriptorSubType */ + } USB_DESCR_HDR_SUBHDR, *pUSB_DESCR_HDR_SUBHDR; + + +/* + * USB_DEVICE_DESCR + */ + +typedef struct usb_device_descr + { + UINT8 length; /* bLength */ + UINT8 descriptorType; /* bDescriptorType */ + UINT16 bcdUsb; /* bcdUSB - USB release in BCD */ + UINT8 deviceClass; /* bDeviceClass */ + UINT8 deviceSubClass; /* bDeviceSubClass */ + UINT8 deviceProtocol; /* bDeviceProtocol */ + UINT8 maxPacketSize0; /* bMaxPacketSize0 */ + UINT16 vendor; /* idVendor */ + UINT16 product; /* idProduct */ + UINT16 bcdDevice; /* bcdDevice - dev release in BCD */ + UINT8 manufacturerIndex; /* iManufacturer */ + UINT8 productIndex; /* iProduct */ + UINT8 serialNumberIndex; /* iSerialNumber */ + UINT8 numConfigurations; /* bNumConfigurations */ + } WRS_PACK_ALIGN(4) USB_DEVICE_DESCR, *pUSB_DEVICE_DESCR; + +#define USB_DEVICE_DESCR_LEN 18 + +/* Device Qualifier Descriptor */ + +typedef struct usb_device_qualifier_descr + { + UINT8 length; /* bLength */ + UINT8 descriptorType; /* bDescriptorType */ + UINT16 bcdUsb; /* bcdUSB - USB release in BCD */ + UINT8 deviceClass; /* bDeviceClass */ + UINT8 deviceSubClass; /* bDeviceSubClass */ + UINT8 deviceProtocol; /* bDeviceProtocol */ + UINT8 maxPacketSize0; /* bMaxPacketSize0 */ + UINT8 numConfigurations; /* bNumConfigurations */ + UINT8 reserved; /* reserved */ + } WRS_PACK_ALIGN(4) USB_DEVICE_QUALIFIER_DESCR, *pUSB_DEVICE_QUALIFIER_DESCR; + +#define USB_DEVICE_QUALIFIER_DESCR_LEN 10 +/* + * USB_CONFIG_DESCR + */ + +typedef struct usb_config_descr + { + UINT8 length; /* bLength */ + UINT8 descriptorType; /* bDescriptorType */ + UINT16 totalLength; /* wTotalLength */ + UINT8 numInterfaces; /* bNumInterfaces */ + UINT8 configurationValue; /* bConfigurationValue */ + UINT8 configurationIndex; /* iConfiguration */ + UINT8 attributes; /* bmAttributes */ + UINT8 maxPower; /* MaxPower */ + } WRS_PACK_ALIGN(4) USB_CONFIG_DESCR, *pUSB_CONFIG_DESCR; + +#define USB_CONFIG_DESCR_LEN 9 + + +/* + * USB_INTERFACE_DESCR + */ + +typedef struct usb_interface_descr + { + UINT8 length; /* bLength */ + UINT8 descriptorType; /* bDescriptorType */ + UINT8 interfaceNumber; /* bInterfaceNumber */ + UINT8 alternateSetting; /* bAlternateSetting */ + UINT8 numEndpoints; /* bNumEndpoints */ + UINT8 interfaceClass; /* bInterfaceClass */ + UINT8 interfaceSubClass; /* bInterfaceSubClass */ + UINT8 interfaceProtocol; /* bInterfaceProtocol */ + UINT8 interfaceIndex; /* iInterface */ + } USB_INTERFACE_DESCR, *pUSB_INTERFACE_DESCR; + +#define USB_INTERFACE_DESCR_LEN 9 + + +/* + * USB_ENDPOINT_DESCR + */ + +typedef struct usb_endpoint_descr + { + UINT8 length; /* bLength */ + UINT8 descriptorType; /* bDescriptorType */ + UINT8 endpointAddress; /* bEndpointAddress */ + UINT8 attributes; /* bmAttributes */ + UINT16 maxPacketSize; /* wMaxPacketSize */ + UINT8 interval; /* bInterval */ + } WRS_PACK_ALIGN(1) USB_ENDPOINT_DESCR, *pUSB_ENDPOINT_DESCR; + +#define USB_ENDPOINT_DESCR_LEN 7 + + +/* + * USB_LANGUAGE_DESCR + */ + +typedef struct usb_language_descr + { + UINT8 length; /* bLength */ + UINT8 descriptorType; /* bDescriptorType */ + UINT16 langId [1]; /* wLANGID[] - variable len */ + } USB_LANGUAGE_DESCR, *pUSB_LANGUAGE_DESCR; + + +/* + * USB_STRING_DESCR + */ + +typedef struct usb_string_descr + { + UINT8 length; /* bLength */ + UINT8 descriptorType; /* bDescriptorType */ + UINT8 string [1]; /* bString - variable len */ + } USB_STRING_DESCR, *pUSB_STRING_DESCR; + + +/* + * USB_HID_DESCR + */ + +typedef struct usb_descr_typlen + { + UINT8 type; /* bDescriptorType */ + UINT16 length; /* wDescriptorLength */ + } WRS_PACK_ALIGN(1) USB_DESCR_TYPLEN; + +typedef struct usb_hid_descr + { + UINT8 length; /* bLength */ + UINT8 descriptorType; /* bDescriptorType */ + UINT16 bcdHid; /* bcdHID */ + UINT8 countryCode; /* bCountryCode */ + UINT8 numDescriptors; /* bNumDescriptors */ + USB_DESCR_TYPLEN descriptor [1]; /* (variable length) */ + } WRS_PACK_ALIGN(1) USB_HID_DESCR, *pUSB_HID_DESCR; + +#define USB_HID_DESCR_LEN 9 /* size of USB_HID_DESCR */ + + +/* + * USB_HUB_DESCR + */ + +typedef struct usb_hub_descr + { + UINT8 length; /* bLength */ + UINT8 descriptorType; /* bDescriptorType */ + UINT8 nbrPorts; /* bNbrPorts */ + UINT16 hubCharacteristics; /* wHubCharacteristics */ + UINT8 pwrOn2PwrGood; /* bPwrOn2PwrGood */ + UINT8 hubContrCurrent; /* bHubContrCurrent */ + UINT8 deviceRemovable [1]; /* DeviceRemovable - variable len */ + UINT8 portPwrCtrlMask [1]; /* portPwrCtrlMask - variable len */ + } WRS_PACK_ALIGN(4) USB_HUB_DESCR, *pUSB_HUB_DESCR; + +#define USB_HUB_DESCR_LEN 9 + + +/* + * USB_STANDARD_STATUS + */ + +typedef struct usb_standard_status + { + UINT16 status; /* status word */ + } USB_STANDARD_STATUS, *pUSB_STANDARD_STATUS; + + +/* + * USB_HUB_STATUS + */ + +typedef struct usb_hub_status + { + UINT16 status; /* wHubStatus or wPortStatus*/ + UINT16 change; /* wHubChange or wPortChange*/ + } USB_HUB_STATUS, *pUSB_HUB_STATUS; + + +/* Implementation-specific host definitions */ + +/* defines */ + +/* node types */ + +#define USB_NODETYPE_NONE 0 +#define USB_NODETYPE_HUB 1 +#define USB_NODETYPE_DEVICE 2 + + +/* node speeds */ + +#define USB_SPEED_FULL 0 /* 12 mbit device */ +#define USB_SPEED_LOW 1 /* low speed device (1.5 mbit) */ + + +/* standard endpoints */ + +#define USB_ENDPOINT_CONTROL 0 + + +/* transfer (pipe) types */ + +#define USB_XFRTYPE_CONTROL 1 +#define USB_XFRTYPE_ISOCH 2 +#define USB_XFRTYPE_INTERRUPT 3 +#define USB_XFRTYPE_BULK 4 + + +/* direction indicators for IRPs */ + +#define USB_DIR_OUT 1 +#define USB_DIR_IN 2 +#define USB_DIR_INOUT 3 + + +/* data toggle specifiers for USB_IRP */ + +#define USB_DATA0 0 +#define USB_DATA1 1 + + +/* flags for IRPs */ + +#define USB_FLAG_SHORT_OK 0x00 +#define USB_FLAG_SHORT_FAIL 0x01 +#define USB_FLAG_ISO_ASAP 0x02 + + +/* IRP timeouts */ + +#define USB_TIMEOUT_DEFAULT 5000 /* 5 seconds */ +#define USB_TIMEOUT_NONE 0xffffffff /* no timeout */ + + +/* typedefs */ + +/* + * IRP_CALLBACK + */ + +typedef VOID (*IRP_CALLBACK) (pVOID pIrp); + + +/* + * USB_BFR_LIST + */ + +typedef struct usb_bfr_list + { + UINT16 pid; /* Specifies packet type as USB_PID_xxxx */ + pUINT8 pBfr; /* Pointer to bfr */ + UINT32 bfrLen; /* Length of buffer */ + UINT32 actLen; /* actual length transferred */ + } USB_BFR_LIST, *pUSB_BFR_LIST; + + +/* + * USB_IRP + * + * NOTE: There are certain requirements on the layout of buffers described + * in the bfrList[]. + * + * For control transfers, the first bfrList [] entry must be the Setup packet. + * If there is a data stage, the bfrList [] entry for the data stage should + * follow. Finally, a zero-length bfrList [] entry must follow which serves + * as a place-holder for the status stage. + * + * For isochronous, interrupt, and bulk transfers there may be one or more + * bfrList[] entries. + * + * If there is more than one bfrList[] entry for an isochronous, interrupt, + * or bulk transfers or more than two bfrList [] entries for control + * transfers, then each bfrList[].bfrLen (except the last) must be an exact + * multiple of the maxPacketSize. The HCD and underlying hardware will + * make no attempt to gather (during OUT) or scatter (during IN) a single + * USB packet across multiple bfrList[] entries. + */ + +typedef struct usb_irp + { + LINK usbdLink; /* Link field used internally by USBD */ + pVOID usbdPtr; /* Ptr field for use by USBD */ + LINK hcdLink; /* Link field used internally by USB HCD */ + pVOID hcdPtr; /* Ptr field for use by USB HCD */ + pVOID userPtr; /* Ptr field for use by client */ + UINT16 irpLen; /* Total length of IRP structure */ + int result; /* IRP completion result: S_usbHcdLib_xxxx */ + IRP_CALLBACK usbdCallback; /* USBD completion callback routine */ + IRP_CALLBACK userCallback; /* client's completion callback routine */ + UINT16 dataToggle; /* IRP should start with DATA0/DATA1. */ + UINT16 flags; /* Defines other IRP processing options */ + UINT32 timeout; /* IRP timeout in milliseconds */ + UINT16 startFrame; /* Start frame for isoch transfer */ + UINT16 dataBlockSize; /* Data granularity for isoch transfer */ + UINT32 transferLen; /* Total length of data to be transferred */ + UINT16 bfrCount; /* Indicates count of buffers in BfrList */ + USB_BFR_LIST bfrList [1]; + } USB_IRP, *pUSB_IRP; + + +/* Implementation-specific target definitions */ + +/* + * ERP_CALLBACK + */ + +typedef VOID (*ERP_CALLBACK) (pVOID pErp); + + +/* + * USB_ERP + * + * The USB_ERP is similar to the USB_IRP, except that it applies to data transfers + * as viewed from the perspective of a USB device - as opposed to the USB_IRP, which + * is used by the USB host. + * + * Each USB_ERP (USB Endpoint Request Packet) describes a transfer through a device + * endpoint. As with USB_IRPs, the USB_ERP carries a bfrList[] which is an array + * of USB_BFR_LIST structures - each describing a block of data to be transferred. + * + * There are certain limitations on the bfrList[]. If the first entry in a bfrList[] + * has a PID of USB_PID_SETUP, then there may be only a single bfrList[] entry. + * + * bfrList[] entries must be all IN or all OUT. A single ERP cannot describe + * transfers in both directions. + */ + +typedef struct usb_erp + { + LINK targLink; /* Link field used internally by usbTargLib */ + pVOID targPtr; /* Ptr field for use by usbTargLib */ + LINK tcdLink; /* Link field used internally by USB TCD */ + pVOID tcdPtr; /* Ptr field for use by USB TCD */ + pVOID userPtr; /* Ptr field for use by client */ + UINT16 erpLen; /* Total length of ERP structure */ + int result; /* ERP completion result: S_usbTcdLib_xxxx */ + ERP_CALLBACK targCallback; /* usbTargLib completion callback routine */ + ERP_CALLBACK userCallback; /* client's completion callback routine */ + pVOID pPipeHandle; /* Pipe handle */ + UINT16 transferType; /* Type of ERP: control, bulk, etc. */ + UINT16 dataToggle; /* ERP should start with DATA0/DATA1. */ + UINT16 bfrCount; /* Indicates count of buffers in BfrList */ + USB_BFR_LIST bfrList [1]; + UINT16 endpointId; /* device endpoint */ + /* Added for complaince with the old stack */ + } USB_ERP, *pUSB_ERP; + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbh */ + + +/* End of file. */ + diff --git a/h/usb/usbAudio.h b/h/usb/usbAudio.h new file mode 100644 index 0000000..c4657cf --- /dev/null +++ b/h/usb/usbAudio.h @@ -0,0 +1,704 @@ +/* usbAudio.h - Definitions for USB audio class */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01b,20mar00,rcb Re-define UINT16 members of structures as arrays of + UINT8...UINT16 fields may not be word aligned and that + causes fits for some processor families. +01a,12jan00,rcb First. +*/ + +#ifndef __INCusbAudioh +#define __INCusbAudioh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* defines */ + +/* USB audio subclass codes */ + +#define USB_SUBCLASS_AUDIO_NONE 0x00 +#define USB_SUBCLASS_AUDIO_AUDIOCONTROL 0x01 +#define USB_SUBCLASS_AUDIO_AUDIOSTREAMING 0x02 +#define USB_SUBCLASS_AUDIO_MIDISTREAMING 0x03 + + +/* USB audio protocol codes */ + +#define USB_PROTOCOL_AUDIO_NONE 0x00 + + +/* USB audio class-specific descriptor types */ + +#define USB_DESCR_AUDIO_UNDEFINED 0x20 +#define USB_DESCR_AUDIO_DEVICE 0x21 +#define USB_DESCR_AUDIO_CONFIGURATION 0x22 +#define USB_DESCR_AUDIO_STRING 0x23 +#define USB_DESCR_AUDIO_INTERFACE 0x24 +#define USB_DESCR_AUDIO_ENDPOINT 0x25 + + +/* USB audio class-specific AC interface descriptor subtypes */ + +#define USB_DESCR_AUDIO_AC_UNDEFINED 0x00 +#define USB_DESCR_AUDIO_AC_HEADER 0x01 +#define USB_DESCR_AUDIO_AC_INPUT_TERMINAL 0x02 +#define USB_DESCR_AUDIO_AC_OUTPUT_TERMINAL 0x03 +#define USB_DESCR_AUDIO_AC_MIXER_UNIT 0x04 +#define USB_DESCR_AUDIO_AC_SELECTOR_UNIT 0x05 +#define USB_DESCR_AUDIO_AC_FEATURE_UNIT 0x06 +#define USB_DESCR_AUDIO_AC_PROCESSING_UNIT 0x07 +#define USB_DESCR_AUDIO_AC_EXTENSION_UNIT 0x08 + + +/* USB audio class-specific AS interface descriptor subtypes */ + +#define USB_DESCR_AUDIO_AS_UNDEFINED 0x00 +#define USB_DESCR_AUDIO_AS_GENERAL 0x01 +#define USB_DESCR_AUDIO_AS_FORMAT_TYPE 0x02 +#define USB_DESCR_AUDIO_AS_FORMAT_SPECIFIC 0x03 + + +/* processing unit process types */ + +#define USB_AUDIO_PROCESS_UNDEFINED 0x00 +#define USB_AUDIO_PROCESS_UP_DOWN_MIX 0x01 +#define USB_AUDIO_PROCESS_DOLBY_PROLOGIC 0x02 +#define USB_AUDIO_PROCESS_3D_STEREO_EXT 0x03 +#define USB_AUDIO_PROCESS_REVERB 0x04 +#define USB_AUDIO_PROCESS_CHORUS 0x05 +#define USB_AUDIO_PROCESS_DYN_RANGE_COMP 0x06 + + +/* audio class-specific endpoint descriptor subtypes */ + +#define USB_DESCR_AUDIO_EP_UNDEFINED 0x00 +#define USB_DESCR_AUDIO_EP_GENERAL 0x01 + + +/* USB requests for audio devices */ + +#define USB_REQ_AUDIO_UNDEFINED 0x00 +#define USB_REQ_AUDIO_SET_CUR 0x01 +#define USB_REQ_AUDIO_GET_CUR 0x81 +#define USB_REQ_AUDIO_SET_MIN 0x02 +#define USB_REQ_AUDIO_GET_MIN 0x82 +#define USB_REQ_AUDIO_SET_MAX 0x03 +#define USB_REQ_AUDIO_GET_MAX 0x83 +#define USB_REQ_AUDIO_SET_RES 0x04 +#define USB_REQ_AUDIO_GET_RES 0x84 +#define USB_REQ_AUDIO_SET_MEM 0x05 +#define USB_REQ_AUDIO_GET_MEM 0x86 +#define USB_REQ_AUDIO_GET_STAT 0xff + + +/* terminal control selectors */ + +#define USB_AUDIO_TCS_UNDEFINED 0x00 +#define USB_AUDIO_TCS_COPY_PROTECT 0x01 + + +/* feature unit control selectors */ + +#define USB_AUDIO_FCS_UNDEFINED 0x00 +#define USB_AUDIO_FCS_MUTE 0x01 +#define USB_AUDIO_FCS_VOLUME 0x02 +#define USB_AUDIO_FCS_BASS 0x03 +#define USB_AUDIO_FCS_MID 0x04 +#define USB_AUDIO_FCS_TREBLE 0x05 +#define USB_AUDIO_FCS_GRAPHIC_EQUALIZER 0x06 +#define USB_AUDIO_FCS_AUTOMATIC_GAIN 0x07 +#define USB_AUDIO_FCS_DELAY 0x08 +#define USB_AUDIO_FCS_BASS_BOOST 0x09 +#define USB_AUDIO_FCS_LOUDNESS 0x0a + + +/* control bit mask in a feature unit descriptor */ + +#define USB_AUDIO_FCM_MUTE 0x0001 +#define USB_AUDIO_FCM_VOLUME 0x0002 +#define USB_AUDIO_FCM_BASS 0x0004 +#define USB_AUDIO_FCM_MID 0x0008 +#define USB_AUDIO_FCM_TREBLE 0x0010 +#define USB_AUDIO_FCM_GRAPHIC_EQUALIZER 0x0020 +#define USB_AUDIO_FCM_AUTOMATIC_GAIN 0x0040 +#define USB_AUDIO_FCM_DELAY 0x0080 +#define USB_AUDIO_FCM_BASS_BOOST 0x0100 +#define USB_AUDIO_FCM_LOUDNESS 0x0200 + + +/* Width of values for feature unit controls */ + +#define USB_AUDIO_MUTE_ATTR_WIDTH 1 +#define USB_AUDIO_VOLUME_ATTR_WIDTH 2 +#define USB_AUDIO_BASS_ATTR_WIDTH 1 +#define USB_AUDIO_MID_ATTR_WIDTH 1 +#define USB_AUDIO_TREBLE_ATTR_WIDTH 1 + + +/* up/down mix processing unit selectors */ + +#define USB_AUDIO_UDM_UNDEFINED 0x00 +#define USB_AUDIO_UDM_ENABLE 0x01 +#define USB_AUDIO_UDM_MODE_SELECT 0x02 + + +/* dolby prologic processing unit control sectors */ + +#define USB_AUDIO_DPL_UNDEFINED 0x00 +#define USB_AUDIO_DPL_ENABLE 0x01 +#define USB_AUDIO_DPL_MODE_SELECT 0x02 + + +/* 3d stereo extender processing unit control selectors */ + +#define USB_AUDIO_3D_UNDEFINED 0x00 +#define USB_AUDIO_3D_ENABLE 0x01 +#define USB_AUDIO_3D_SPACIOUSNESS 0x03 + + +/* reverberation processing unit control selectors */ + +#define USB_AUDIO_RCS_UNDEFINED 0x00 +#define USB_AUDIO_RCS_ENABLE 0x01 +#define USB_AUDIO_RCS_REVERB_LEVEL 0x02 +#define USB_AUDIO_RCS_REVERB_TIME 0x03 +#define USB_AUDIO_RCS_REVERB_FEEDBACK 0x04 + + +/* chorus processing unit control selectors */ + +#define USB_AUDIO_CH_UNDEFINED 0x00 +#define USB_AUDIO_CH_ENABLE 0x01 +#define USB_AUDIO_CH_CHORUS_LEVEL 0x02 +#define USB_AUDIO_CH_CHORUS_RATE 0x03 +#define USB_AUDIO_CH_CHORUS_DEPTH 0x04 + + +/* dynamic range compressor processing unit control selectors */ + +#define USB_AUDIO_DRC_UNDEFINED 0x00 +#define USB_AUDIO_DRC_ENABLE 0x01 +#define USB_AUDIO_DRC_COMPRESSION_RATE 0x02 +#define USB_AUDIO_DRC_MAXAMPL 0x03 +#define USB_AUDIO_DRC_THRESHOLD 0x04 +#define USB_AUDIO_DRC_ATTACK_TIME 0x05 +#define USB_AUDIO_DRC_RELEASE_TIME 0x06 + + +/* extension unit control selectors */ + +#define USB_AUDIO_ECS_UNDEFINED 0x00 +#define USB_AUDIO_ECS_ENABLE 0x01 + + +/* endpoint control selectors */ + +#define USB_AUDIO_EPS_UNDEFINED 0x00 +#define USB_AUDIO_EPS_SAMPLING_FREQ 0x01 +#define USB_AUDIO_EPS_PITCH 0x02 + + +/* spatial locations in an audio cluster */ + +#define USB_AUDIO_LOC_LEFT_FRONT 0x0001 +#define USB_AUDIO_LOC_RIGHT_FRONT 0x0002 +#define USB_AUDIO_LOC_CENTER_FRONT 0x0004 +#define USB_AUDIO_LOC_LOW_FREQ_ENHANCE 0x0008 +#define USB_AUDIO_LOC_LEFT_SURROUND 0x0010 +#define USB_AUDIO_LOC_RIGHT_SURROUND 0x0020 +#define USB_AUDIO_LOC_LEFT_OF_CENTER 0x0040 +#define USB_AUDIO_LOC_RIGHT_OF_CENTER 0x0080 +#define USB_AUDIO_LOC_SURROUND 0x0100 +#define USB_AUDIO_LOC_SIDE_LEFT 0x0200 +#define USB_AUDIO_LOC_SIDE_RIGHT 0x0400 +#define USB_AUDIO_LOC_TOP 0x0800 + + +/* terminal types */ + +#define USB_AUDIO_TERM_UNDEFINED 0x0100 +#define USB_AUDIO_TERM_STREAMING 0x0101 +#define USB_AUDIO_TERM_VENDOR_SPECIFIC 0x01ff + + +/* input terminal types */ + +#define USB_AUDIO_INTERM_UNDEFINED 0x0200 +#define USB_AUDIO_INTERM_MIC 0x0201 +#define USB_AUDIO_INTERM_DESKTOP_MIC 0x0202 +#define USB_AUDIO_INTERM_PERSONAL_MIC 0x0203 +#define USB_AUDIO_INTERM_OMNI_DIR_MIC 0x0204 +#define USB_AUDIO_INTERM_MIC_ARRAY 0x0205 +#define USB_AUDIO_INTERM_PROC_MIC_ARRAY 0x0206 + + +/* output terminal types */ + +#define USB_AUDIO_OUTTERM_UNDEFINED 0x0300 +#define USB_AUDIO_OUTTERM_SPEAKER 0x0301 +#define USB_AUDIO_OUTTERM_HEADPHONES 0x0302 +#define USB_AUDIO_OUTTERM_HEAD_MOUNT 0x0303 +#define USB_AUDIO_OUTTERM_DESKTOP_SPKR 0x0304 +#define USB_AUDIO_OUTTERM_ROOM_SPKR 0x0305 +#define USB_AUDIO_OUTTERM_COMM_SPKR 0x0306 +#define USB_AUDIO_OUTTERM_LOW_FREQ_SPKR 0x0307 + + +/* bi-directional terminal types */ + +#define USB_AUDIO_BITERM_UNDEFINED 0x0400 +#define USB_AUDIO_BITERM_HEADSET 0x0401 +#define USB_AUDIO_BITERM_HEADSET_ALT 0x0402 +#define USB_AUDIO_BITERM_SPKRPHONE 0x0403 +#define USB_AUDIO_BITERM_SPKRPHONE_ECHO_SUP 0x0404 +#define USB_AUDIO_BITERM_SPKRPHONE_ECHO_CAN 0x0405 + + +/* telephony terminal types */ + +#define USB_AUDIO_TELTERM_UNDEFINED 0x0500 +#define USB_AUDIO_TELTERM_PHONE_LINE 0x0501 +#define USB_AUDIO_TELTERM_TELEPHONE 0x0502 +#define USB_AUDIO_TELTERM_DOWN_LINE_PHONE 0x0503 + + +/* external terminal types */ + +#define USB_AUDIO_EXTTERM_UNDEFINED 0x0600 +#define USB_AUDIO_EXTTERM_ANALOG 0x0601 +#define USB_AUDIO_EXTTERM_DIGITAL 0x0602 +#define USB_AUDIO_EXTTERM_LINE 0x0603 +#define USB_AUDIO_EXTTERM_LEGACY 0x0604 +#define USB_AUDIO_EXTTERM_SPDIF 0x0605 +#define USB_AUDIO_EXTTERM_1394_DA 0x0606 +#define USB_AUDIO_EXTTERM_1394_DV_SOUND 0x0607 + + +/* embedded function terminal types */ + +#define USB_AUDIO_EMBTERM_UNDEFINED 0x0700 +#define USB_AUDIO_EMBTERM_LEVEL_CAL_NOISE 0x0701 +#define USB_AUDIO_EMBTERM_EQUAL_NOISE 0x0702 +#define USB_AUDIO_EMBTERM_CD_PLAYER 0x0703 +#define USB_AUDIO_EMBTERM_DAT 0x0704 +#define USB_AUDIO_EMBTERM_DCC 0x0705 +#define USB_AUDIO_EMBTERM_MINIDISK 0x0706 +#define USB_AUDIO_EMBTERM_ANALOG_TAPE 0x0707 +#define USB_AUDIO_EMBTERM_PHONOGRAPH 0x0708 +#define USB_AUDIO_EMBTERM_VCR_AUDIO 0x0709 +#define USB_AUDIO_EMBTERM_VIDEO_DISC 0x070a +#define USB_AUDIO_EMBTERM_DVD_AUDIO 0x070b +#define USB_AUDIO_EMBTERM_TV_TUNER 0x070c +#define USB_AUDIO_EMBTERM_SAT_RECEIVER 0x070d +#define USB_AUDIO_EMBTERM_CABLE_TUNER 0x070e +#define USB_AUDIO_EMBTERM_DSS 0x070f +#define USB_AUDIO_EMBTERM_RADIO_RECEIVER 0x0710 +#define USB_AUDIO_EMBTERM_RADIO_TRANSMITTER 0x0711 +#define USB_AUDIO_EMBTERM_MULTI_TRACK_REC 0x0712 +#define USB_AUDIO_EMBTERM_SYNTHESIZER 0x0713 + + +/* audio data format type I codes */ + +#define USB_AUDIO_TYPE1_UNDEFINED 0x0000 +#define USB_AUDIO_TYPE1_PCM 0x0001 +#define USB_AUDIO_TYPE1_PCM8 0x0002 +#define USB_AUDIO_TYPE1_IEEE_FLOAT 0x0003 +#define USB_AUDIO_TYPE1_ALAW 0x0004 +#define USB_AUDIO_TYPE1_MULAW 0x0005 + + +/* audio data format type II codes */ + +#define USB_AUDIO_TYPE2_UNDEFINED 0x1000 +#define USB_AUDIO_TYPE2_MPEG 0x1001 +#define USB_AUDIO_TYPE2_AC3 0x1002 + + +/* audio data format type III codes */ + +#define USB_AUDIO_TYPE3_UNDEFINED 0x2000 +#define USB_AUDIO_TYPE3_1937_AC3 0x2001 +#define USB_AUDIO_TYPE3_1937_MPEG1_L1 0x2002 +#define USB_AUDIO_TYPE3_1937_MPEG1_L2_3 0x2003 +#define USB_AUDIO_TYPE3_1937_MPEG2_NOEXT 0x2003 +#define USB_AUDIO_TYPE3_1937_MPEG2_EXT 0x2004 +#define USB_AUDIO_TYPE3_1937_MPEG2_L1_LS 0x2005 +#define USB_AUDIO_TYPE3_1937_MPEG2_L2_3_LS 0x2006 + + +/* format type codes */ + +#define USB_AUDIO_FORMAT_UNDEFINED 0x00 +#define USB_AUDIO_FORMAT_TYPE1 0x01 +#define USB_AUDIO_FORMAT_TYPE2 0x02 +#define USB_AUDIO_FORMAT_TYPE3 0x03 + + +/* typedefs */ + +/* status word format */ + +typedef struct usb_audio_status_word + { + UINT8 statusType; + UINT8 originatorId; + } USB_AUDIO_STATUS_WORD, *pUSB_AUDIO_STATUS_WORD; + + +/* USB_AUDIO_STATUS_WORD.statusType */ + +#define USB_AUDIO_ST_AUDIO_CONTROL 0x00 +#define USB_AUDIO_ST_AUDIO_STREAMING_IF 0x01 +#define USB_AUDIO_ST_AUDIO_STREAMING_EP 0x02 +#define USB_AUDIO_ST_MEMORY_CHANGED 0x40 +#define USB_AUDIO_ST_INT_PENDING 0x80 + + +/* common audio descriptor header */ + +typedef struct usb_audio_descr_header + { + UINT8 length; /* length of descriptor in bytes */ + UINT8 descriptorType; /* descriptor type */ + UINT8 descriptorSubType; /* descriptor sub type */ + } USB_AUDIO_DESCR_HEADER, *pUSB_AUDIO_DESCR_HEADER; + + +/* standard AC (AudioControl) interface descriptor. + * + * NOTE: This structure is identical to the standard USB interface descriptor, + * except that interfaceClass is defined as the Audio interface class, + * interfaceSubClass is defined as the audio interface subclass, and + * interfaceProtocol is always 0. + */ + + +/* class-specific AC interface descriptor */ + +typedef struct usb_audio_ac_descr + { + UINT8 length; /* length of descriptor in bytes */ + UINT8 descriptorType; /* descriptor type */ + UINT8 descriptorSubType; /* descriptor sub type */ + UINT8 bcdAdc [2]; /* release level in BCD */ + UINT8 totalLength [2]; /* combined length of all descr */ + UINT8 inCollection; /* number of streaming interfaces */ + UINT8 interfaceNbr [1]; /* variable number of interface numbers */ + } USB_AUDIO_AC_DESCR, *pUSB_AUDIO_AC_DESCR; + + +/* header common to all AudioControl unit/terminal descriptors */ + +typedef struct usb_audio_ac_common + { + UINT8 length; /* length of descriptor in bytes */ + UINT8 descriptorType; /* descriptor type */ + UINT8 descriptorSubType; /* descriptor sub type */ + UINT8 unitId; /* unit/terminal ID */ + } USB_AUDIO_AC_COMMON, *pUSB_AUDIO_AC_COMMON; + + +/* input terminal descriptor */ + +typedef struct usb_audio_input_term_descr + { + UINT8 length; /* length of descriptor in bytes */ + UINT8 descriptorType; /* descriptor type */ + UINT8 descriptorSubType; /* descriptor sub type */ + UINT8 terminalId; /* ID of this terminal */ + UINT8 terminalType [2]; /* type of terminal */ + UINT8 assocTerminal; /* ID of associated output terminal */ + UINT8 channels; /* count of channels */ + UINT8 channelConfig [2]; /* see USB_AUDIO_LOC_xxxx */ + UINT8 channelNamesIndex; /* index of first string descr */ + UINT8 terminalNameIndex; /* index of string descr for this term */ + } USB_AUDIO_INPUT_TERM_DESCR, *pUSB_AUDIO_INPUT_TERM_DESCR; + + +/* output terminal descriptor */ + +typedef struct usb_audio_output_term_descr + { + UINT8 length; /* length of descriptor in bytes */ + UINT8 descriptorType; /* descriptor type */ + UINT8 descriptorSubType; /* descriptor sub type */ + UINT8 terminalId; /* ID of this terminal */ + UINT8 terminalType [2]; /* type of terminal */ + UINT8 assocTerminal; /* ID of associate input terminal */ + UINT8 sourceId; /* ID of connected unit/terminal */ + UINT8 terminalNameIndex; /* index of string desdr for this term */ + } USB_AUDIO_OUTPUT_TERM_DESCR, *pUSB_AUDIO_OUTPUT_TERM_DESCR; + + +/* mixer unit descriptor */ + +typedef struct usb_audio_mixer_unit_descr + { + UINT8 length; /* length of descriptor in bytes */ + UINT8 descriptorType; /* descriptor type */ + UINT8 descriptorSubType; /* descriptor sub type */ + UINT8 unitId; /* ID of this unit */ + UINT8 nbrInPins; /* number of input pins */ + UINT8 sourceId [1]; /* array of sources */ + /* followed by a cluster descr */ + /* followed by a controls byte */ + /* followed by iMixer */ + } USB_AUDIO_MIXER_UNIT_DESCR, *pUSB_AUDIO_MIXER_UNIT_DESCR; + + +/* selector unit descriptor */ + +typedef struct usb_audio_selector_unit_descr + { + UINT8 length; /* length of descriptor in bytes */ + UINT8 descriptorType; /* descriptor type */ + UINT8 descriptorSubType; /* descriptor sub type */ + UINT8 unitId; /* ID of this unit */ + UINT8 nbrInPins; /* number of input pins */ + UINT8 sourceId [1]; /* array of sources */ + /* followed by iMixer */ + } USB_AUDIO_SELECTOR_UNIT_DESCR, *pUSB_AUDIO_SELECTOR_UNIT_DESCR; + + +/* feature unit descriptor */ + +typedef struct usb_audio_feature_unit_descr + { + UINT8 length; /* length of descriptor in bytes */ + UINT8 descriptorType; /* descriptor type */ + UINT8 descriptorSubType; /* descriptor sub type */ + UINT8 unitId; /* unique ID of this unit */ + UINT8 sourceId; /* ID of source unit/terminal */ + UINT8 controlSize; /* size of entries in controls array */ + UINT8 controls [1]; /* variable length, 1 + no. of channels */ + /* iFeature byte follows controls array */ + } USB_AUDIO_FEATURE_UNIT_DESCR, *pUSB_AUDIO_FEATURE_UNIT_DESCR; + + +/* processing unit descriptor (common part) */ + +typedef struct usb_audio_process_unit_descr + { + UINT8 length; /* length of descriptor in bytes */ + UINT8 descriptorType; /* descriptor type */ + UINT8 descriptorSubType; /* descriptor sub type */ + UINT8 unitId; /* unique ID of this unit */ + UINT8 processType [2]; /* type of process performed by unit */ + UINT8 nbrInPins; /* number of input pins */ + UINT8 sourceId [1]; /* array of sources */ + /* ... */ + } USB_AUDIO_PROCESS_UNIT_DESCR, *pUSB_AUDIO_PROCESS_UNIT_DESCR; + + +/* extension unit descriptor */ + +typedef struct usb_audio_ext_unit_descr + { + UINT8 length; /* length of descriptor in bytes */ + UINT8 descriptorType; /* descriptor type */ + UINT8 descriptorSubType; /* descriptor sub type */ + UINT8 unitId; /* unique ID of this unit */ + UINT8 extensionCode [2]; /* type of extension */ + UINT8 nbrInPins; /* number of input pins */ + UINT8 sourceId [1]; /* array of sources */ + /* ... */ + } USB_AUDIO_EXT_UNIT_DESCR, *pUSB_AUDIO_EXT_UNIT_DESCR; + + +/* standard AC interrupt endpoint descriptor */ + +typedef struct usb_audio_int_ep_descr + { + UINT8 length; /* bLength */ + UINT8 descriptorType; /* bDescriptorType */ + UINT8 endpointAddress; /* bEndpointAddress */ + UINT8 attributes; /* bmAttributes */ + UINT8 maxPacketSize [2]; /* wMaxPacketSize */ + UINT8 interval; /* bInterval */ + UINT8 refresh; /* reset to 0 */ + UINT8 synchAddress; /* reset to 0 */ + } USB_AUDIO_INT_EP_DESCR, *pUSB_AUDIO_INT_EP_DESCR; + + +/* standard AS (AudioStreaming) interface descriptor + * + * NOTE: This structure is identical to the standard USB interface descriptor, + * except that interfaceClass is defined as the Audio interface class, + * interfaceSubClass is defined as the audio interface subclass, and + * interfaceProtocol is always 0. + */ + + +/* class-specific AS interface descriptor */ + +typedef struct usb_audio_as_descr + { + UINT8 length; /* length of descriptor in bytes */ + UINT8 descriptorType; /* descriptor type */ + UINT8 descriptorSubType; /* descriptor sub type */ + UINT8 terminalLink; /* ID of connected terminal */ + UINT8 delay; /* delay introduced by data path */ + UINT8 formatTag [2]; /* audio data format */ + } USB_AUDIO_AS_DESCR, *pUSB_AUDIO_AS_DESCR; + + +/* standard AS isochronous audio data endpoint descriptor */ + +typedef struct usb_audio_std_isoch_ep_descr + { + UINT8 length; /* bLength */ + UINT8 descriptorType; /* bDescriptorType */ + UINT8 endpointAddress; /* bEndpointAddress */ + UINT8 attributes; /* bmAttributes */ + UINT8 maxPacketSize [2]; /* wMaxPacketSize */ + UINT8 interval; /* bInterval */ + UINT8 refresh; /* reset to 0 */ + UINT8 synchAddress; /* address of synch endpoint */ + } USB_AUDIO_STD_ISOCH_EP_DESCR, *pUSB_AUDIO_STD_ISOCH_EP_DESCR; + + +/* class-specific isochronous audio data endpoint descriptor */ + +typedef struct usb_audio_class_isoch_ep_descr + { + UINT8 length; /* length of descriptor in bytes */ + UINT8 descriptorType; /* descriptor type */ + UINT8 descriptorSubType; /* descriptor sub type */ + UINT8 attributes; /* bmAttributes */ + UINT8 lockDelayUnits; /* indicates units for lockDelay */ + UINT8 lockDelay; /* internal clock lock time */ + } USB_AUDIO_CLASS_ISOCH_EP_DESCR, *pUSB_AUDIO_CLASS_ISOCH_EP_DESCR; + + +/* standard AS isoch synch endpoint descriptor */ + +typedef struct usb_audio_isoch_synch_ep_descr + { + UINT8 length; /* bLength */ + UINT8 descriptorType; /* bDescriptorType */ + UINT8 endpointAddress; /* bEndpointAddress */ + UINT8 attributes; /* bmAttributes */ + UINT8 maxPacketSize [2]; /* wMaxPacketSize */ + UINT8 interval; /* bInterval */ + UINT8 refresh; /* synch refresh rate (pwr of 2) */ + UINT8 synchAddress; /* reset to 0 */ + } USB_AUDIO_ISOCH_SYNCH_EP_DESCR, *pUSB_AUDIO_ISOCH_SYNCH_EP_DESCR; + + +/* common sampling frequency information */ + +typedef UINT8 USB_AUDIO_SAM_FREQ [3]; + +typedef struct usb_audio_sample_info + { + UINT8 freqType; /* how sampling freq. can be programmed */ + union + { + struct + { + USB_AUDIO_SAM_FREQ lowerFreq; /* lower bound */ + USB_AUDIO_SAM_FREQ upperFreq; /* upper bound */ + } continous; + struct + { + USB_AUDIO_SAM_FREQ freq [1]; /* discrete sampling frequency */ + } discrete; + } freq; + } USB_AUDIO_SAMPLE_INFO, *pUSB_AUDIO_SAMPLE_INFO; + + +/* type I format type descriptor */ + +typedef struct usb_audio_type_1_type_descr + { + UINT8 length; /* length of descriptor in bytes */ + UINT8 descriptorType; /* descriptor type */ + UINT8 descriptorSubType; /* descriptor sub type */ + UINT8 formatType; /* identifies format type */ + UINT8 nbrChannels; /* number of channels */ + UINT8 subFrameSize; /* number of bytes for one audio subframe */ + UINT8 bitResolution; /* number of bits used per audio subframe */ + USB_AUDIO_SAMPLE_INFO sample; /* sampling frequency info */ + } USB_AUDIO_TYPE_1_TYPE_DESCR, *pUSB_AUDIO_TYPE_1_TYPE_DESCR; + + +/* type II format type descriptor */ + +typedef struct usb_audio_type_2_type_descr + { + UINT8 length; /* length of descriptor in bytes */ + UINT8 descriptorType; /* descriptor type */ + UINT8 descriptorSubType; /* descriptor sub type */ + UINT8 formatType; /* identifies format type */ + UINT8 maxBitRate [2]; /* max bits per second sup. by interface */ + UINT8 samplesPerFrame [2]; /* nbr PCM audio samples in audio frame */ + USB_AUDIO_SAMPLE_INFO sample; /* sampling frequency info */ + } USB_AUDIO_TYPE_2_TYPE_DESCR, *pUSB_AUDIO_TYPE_2_TYPE_DESCR; + + +/* type III format type descriptor */ + +typedef struct usb_audio_type_3_type_descr + { + UINT8 length; /* length of descriptor in bytes */ + UINT8 descriptorType; /* descriptor type */ + UINT8 descriptorSubType; /* descriptor sub type */ + UINT8 formatType; /* identifies format type */ + UINT8 nbrChannels; /* number of channels */ + UINT8 subFrameSize; /* number of bytes for one audio subframe */ + UINT8 bitResolution; /* number of bits used per audio subframe */ + USB_AUDIO_SAMPLE_INFO sample; /* sampling frequency info */ + } USB_AUDIO_TYPE_3_TYPE_DESCR, *pUSB_AUDIO_TYPE_3_TYPE_DESCR; + + +/* composite type descriptor */ + +typedef struct usb_audio_type_descr + { + UINT8 length; /* length of descriptor in bytes */ + UINT8 descriptorType; /* descriptor type */ + UINT8 descriptorSubType; /* descriptor sub type */ + UINT8 formatType; /* identifies format type */ + union + { + struct + { + UINT8 nbrChannels; /* number of channels */ + UINT8 subFrameSize; /* number of bytes for one audio subframe */ + UINT8 bitResolution; /* number of bits used per audio subframe */ + USB_AUDIO_SAMPLE_INFO sample; /* sampling frequency info */ + } type1; + struct + { + UINT8 maxBitRate [2]; /* max bits per second sup. by interface */ + UINT8 samplesPerFrame [2]; /* nbr PCM audio samples in audio frame */ + USB_AUDIO_SAMPLE_INFO sample; /* sampling frequency info */ + } type2; + struct + { + UINT8 nbrChannels; /* number of channels */ + UINT8 subFrameSize; /* number of bytes for one audio subframe */ + UINT8 bitResolution; /* number of bits used per audio subframe */ + USB_AUDIO_SAMPLE_INFO sample; /* sampling frequency info */ + } type3; + } ts; + } USB_AUDIO_TYPE_DESCR, *pUSB_AUDIO_TYPE_DESCR; + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbAudioh */ + + +/* End of file. */ + diff --git a/h/usb/usbCommdevices.h b/h/usb/usbCommdevices.h new file mode 100644 index 0000000..a57b396 --- /dev/null +++ b/h/usb/usbCommdevices.h @@ -0,0 +1,84 @@ +/* usbCommdevices.h - Class-specific definitions for USB Communications class */ + +/* Copyright 2000-2001 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- + +01a,02may00,vis created. + +*/ + +#ifndef __INCusbCommDevicesh +#define __INCusbCommDevicesh + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* defines */ + +/* Communications Device Class code */ + +#define USB_CLASS_COMMDEVICE 0x02 + +/* Communications Interface Class code */ + +#define USB_CLASS_COMMINTERFACE 0x02 + +/* Data Interface Class code */ + +#define USB_CLASS_DATAINTERFACE 0x0a + + +/* Communications Interface Class Subclass codes */ + +#define USB_SUBCLASS_DLCM 0x01 /* Direct Line Control Model */ +#define USB_SUBCLASS_ACM 0x02 /* Abstract Control Model */ +#define USB_SUBCLASS_TCM 0x03 /* Telephone Control Model */ +#define USB_SUBCLASS_MCCM 0x04 /* MultiChannel Control Model */ +#define USB_SUBCLASS_CAPI 0x05 /* CAPI Control Model */ +#define USB_SUBCLASS_ENET 0x06 /* Ethernet Control Model */ +#define USB_SUBCLASS_ATM 0x07 /* ATM Control Model */ + +/* Data Interface Class Subclass codes */ + +#define USB_SUBCLASS_DATA 0x00 /* Currently not used */ + + +/* Communication Interface Class Control Protocol codes */ + +#define USB_COMM_PROTOCOL_NONE 0x00 /* No protocol required */ +#define USB_COMM_PROTOCOL_COMMONAT 0x01 /* common AT commands (hayes */ + /* compatible ) */ +#define USB_COMM_PROTOCOL_VENDOR 0xff /* Vendor Specific protocol */ + + +/* Data Interface Class Control Protocol codes */ + +#define USB_COMM_PROTOCOL_ISDN 0x30 /* Physical interface protocol*/ + /* for ISDN BRI */ +#define USB_COMM_PROTOCOL_HDLC 0x31 /* HDLC */ +#define USB_COMM_PROTOCOL_TRANSPARENT 0x32 /* None.. */ +#define USB_COMM_PROTOCOL_Q921M 0x50 /* Management protocol for */ + /* Q.921 data link protocol */ +#define USB_COMM_PROTOCOL_Q921 0x51 /* data link protocol for */ + /* Q.921 */ +#define USB_COMM_PROTOCOL_Q921T 0x52 /* TEI multiplexor for */ + /* Q.921 data link protocol */ +#define USB_COMM_PROTOCOL_V42BIS 0x90 /* Data compression procedures */ +#define USB_COMM_PROTOCOL_Q931 0x91 /* Q.931 or Euro ISDN */ +#define USB_COMM_PROTOCOL_V120 0x92 /* V.24 adaptation to ISDN */ +#define USB_COMM_PROTOCOL_CAPI20 0x93 /* CAPI Commands */ +#define USB_COMM_PROTOCOL_HBD 0xfd /* Host based driver */ +#define USB_COMM_PROTOCOL_CDC 0xfe /* CDC Specification */ + + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCusbCommDevicesh */ diff --git a/h/usb/usbDescrCopyLib.h b/h/usb/usbDescrCopyLib.h new file mode 100644 index 0000000..17aff5c --- /dev/null +++ b/h/usb/usbDescrCopyLib.h @@ -0,0 +1,71 @@ +/* usbDescrCopyLib.h - USB descriptor copy utility functions */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01b,13apr00,wef fixed #ifndef bug +01a,05apr00,wef First -removed these functions from usbLib.c to decouple host / + peripheral stack interdependency. +*/ + +#ifndef __INCusbDescrCopyLibh +#define __INCusbDescrCopyLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include "usb/usb.h" + + +/* function prototypes */ + +VOID usbDescrCopy + ( + pUINT8 pBfr, /* destination buffer */ + pVOID pDescr, /* source buffer */ + UINT16 bfrLen, /* dest len */ + pUINT16 pActLen /* actual length copied */ + ); + + +VOID usbDescrCopy32 + ( + pUINT8 pBfr, /* destination buffer */ + pVOID pDescr, /* source buffer */ + UINT32 bfrLen, /* dest len */ + pUINT32 pActLen /* actual length copied */ + ); + + +VOID usbDescrStrCopy + ( + pUINT8 pBfr, /* destination buffer */ + char *pStr, /* source buffer */ + UINT16 bfrLen, /* dest len */ + pUINT16 pActLen /* actual length copied */ + ); + + +VOID usbDescrStrCopy32 + ( + pUINT8 pBfr, /* destination buffer */ + char *pStr, /* source buffer */ + UINT32 bfrLen, /* dest len */ + pUINT32 pActLen /* actual length copied */ + ); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbDescrCopyLibh*/ + +/* End of file. */ + diff --git a/h/usb/usbEnet.h b/h/usb/usbEnet.h new file mode 100644 index 0000000..0536c80 --- /dev/null +++ b/h/usb/usbEnet.h @@ -0,0 +1,128 @@ +/* usbEnet.h - Class-specific definitions for USB Ethernet Adapters */ + +/* Copyright 2000-2001 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01a,02may00, vis Created +*/ + +#ifndef __INCusbEneth +#define __INCusbEneth + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* includes */ + +#include "usb/usbCommdevices.h" +#include "usb/usbPlatform.h" +#include "usb/ossLib.h" +#include "usb/usbListLib.h" +#include "usb/usbQueueLib.h" +#include "usb/usbdLib.h" +#include "usb/usbdCoreLib.h" + + +/* defines */ + +/* USB Ethernet Control Model Sub class-specific requests */ + +#define USB_ENET_REQ_SEND_ENCAP_COMMAND 0x00 +#define USB_ENET_REQ_GET_ENCAP_RESPONSE 0x01 +#define USB_ENET_REQ_SET_MCAST_FILTERS 0x40 +#define USB_ENET_REQ_SET_POWMGMT_FILTER 0x41 +#define USB_ENET_REQ_GET_POWMGMT_FILTER 0x42 +#define USB_ENET_REQ_SET_PACKET_FILTER 0x43 +#define USB_ENET_REQ_GET_ENET_STATISTIC 0x44 + + +/* USB Ethernet Control Model Notification codes.*/ + +#define USB_ENET_NOTIFY_NETWORK_CONNECTION 0x00 +#define USB_ENET_NOTIFY_RESPONSE_AVAILABLE 0x01 +#define USB_ENET_NOTIFY_CONNECTION_SPD_CHANGE 0x2a + + +/* + * USB Ethernet Control Model - Statistics + * These values are used in 2 places. + * 1. In GetEthernetStatistic request, as feature selector + * 2. In decifering the Function descriptor. + */ + +#define USB_ENET_STAT_XMIT_OK 1 +#define USB_ENET_STAT_RVC_OK 2 +#define USB_ENET_STAT_XMIT_ERROR 3 +#define USB_ENET_STAT_RVC_ERROR 4 +#define USB_ENET_STAT_RVC_NO_BUFFER 5 +#define USB_ENET_STAT_DIRECTED_BYTES_XMIT 6 +#define USB_ENET_STAT_DIRECTED_FRAMES_XMIT 7 +#define USB_ENET_STAT_MULTICAST_BYTES_XMIT 8 +#define USB_ENET_STAT_MULTICAST_FRAMES_XMIT 9 +#define USB_ENET_STAT_BROADCAST_BYTES_XMIT 10 +#define USB_ENET_STAT_BROADCAST_FRAMES_XMIT 11 +#define USB_ENET_STAT_DIRECTED_BYTES_RCV 12 +#define USB_ENET_STAT_DIRECTED_FRAMES_RCV 13 +#define USB_ENET_STAT_MULTICAST_BYTES_RCV 14 +#define USB_ENET_STAT_MULTICAST_FRAMES_RCV 15 +#define USB_ENET_STAT_BROADCAST_BYTES_RCV 16 +#define USB_ENET_STAT_BROADCAST_FRAMES_RCV 17 +#define USB_ENET_STAT_RCV_CRC_ERROR 18 +#define USB_ENET_STAT_TRANSMIT_QUEUE_LENGTH 19 +#define USB_ENET_STAT_RCV_ERROR_ALIGNMENT 20 +#define USB_ENET_STAT_XMIT_ONE_COLLISION 21 +#define USB_ENET_STAT_XMIT_MORE_COLLISIONS 22 +#define USB_ENET_STAT_XMIT_DEFERRED 23 +#define USB_ENET_STAT_XMIT_MAX_COLLISIONS 24 +#define USB_ENET_STAT_RCV_OVERRUN 25 +#define USB_ENET_STAT_XMIT_UNDERRUN 26 +#define USB_ENET_STAT_XMIT_HEARTBEAT_FAILURE 27 +#define USB_ENET_STAT_XMIT_TIMES_CRS_LOST 28 +#define USB_ENET_STAT_XMIT_LATE_COLLISIONS 29 + +/* here is how the Function descriptor is deciphered */ + +#define GetEnetStat(x) (0x1<<(x-1)) + + +#define MCAST_FILTER_MASK 0x1000 + + +/* + * USB Ethernet Control Model - Packet Filter Setup Options. + * These are used in the SetEthernetPacketFilter request. + * The Packet Filter is the inclusive OR ofthe below options + */ + +#define USB_ENET_PKT_TYPE_PROMISCOUS 0x0001 +#define USB_ENET_PKT_TYPE_ALL_MULTICAST 0x0002 +#define USB_ENET_PKT_TYPE_DIRECTED 0x0004 +#define USB_ENET_PKT_TYPE_BROADCAST 0x0008 +#define USB_ENET_PKT_TYPE_MULTICAST 0x0010 + + +/* USB Ethernet Control Model - Function descriptor */ + +typedef struct usbEnet_Func_descr + { + UINT8 length; /* bFunctionLength */ + UINT8 descriptorType; /* bDescriptorType */ + UINT8 descriptorSubType; /* bDescriptorType */ + UINT8 macAddressIndex; /* iMACAddress */ + UINT32 statisticsBitmap; /* bmEthernetStatistics */ + UINT16 maxSegmentSize; /* wMaxSegmentSize */ + UINT16 noOfMCastFilters; /* wNumbereMCFilters */ + UINT8 noOfPowerFilters; /* bNumberPowerFilters */ + } USB_ENET_FUNC_DESCR, *pUSB_ENET_FUNC_DESCR; + +#define USB_ENET_FUNC_DESCR_LEN 13 + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCusbEneth */ diff --git a/h/usb/usbHandleLib.h b/h/usb/usbHandleLib.h new file mode 100644 index 0000000..a195eb5 --- /dev/null +++ b/h/usb/usbHandleLib.h @@ -0,0 +1,115 @@ +/* usbHandleLib.h - handle utility functions */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01f,18sep01,wef merge from wrs.tor2_0.usb1_1-f for veloce +01e,07may01,wef changed module number to be (module sub num << 8) | + M_usbHostLib +01d,02may01,wef changed module number to be M_ + M_usbHostLib +01c,05dec00,wef moved Module number defs to vwModNum.h - add this + to #includes +01b,07mar00,rcb Change definition of GENERIC_HANDLE from UINT32 to + pVOID so handles can be compared against NULL without + generating warnings (e.g., on MIPS gnu toolchain). +01a,07jun99,rcb First. +*/ + +/* +DESCRIPTION + +Defines a set of general-purpose handle creation and validation functions. + +Using these services, libraries can return handles to callers which can +subsequently be validated for authenticity. This provides libraries with +an additional measure of "bullet-proofing." +*/ + +#ifndef __INCusbHandleLibh +#define __INCusbHandleLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "usb/usbPlatform.h" /* USB Module number def's */ +#include "vwModNum.h" /* USB Module number def's */ + + +/* defines */ + +/* Handle utility library return values */ + +/* + * USB errnos are defined as being part of the USB host Module, as are all + * vxWorks module numbers, but the USB Module number is further divided into + * sub-modules. Each sub-module has upto 255 values for its own error codes + */ + +#define USB_HANDLE_SUB_MODULE 3 + +#define M_usbHandleLib ( (USB_HANDLE_SUB_MODULE << 8) | M_usbHostLib ) + +#define hdlErr(x) (M_usbHandleLib | (x)) + +#define S_usbHandleLib_OUT_OF_MEMORY hdlErr(1) +#define S_usbHandleLib_OUT_OF_RESOURCES hdlErr(2) +#define S_usbHandleLib_OUT_OF_HANDLES hdlErr(3) +#define S_usbHandleLib_BAD_PARAM hdlErr(4) +#define S_usbHandleLib_BAD_HANDLE hdlErr(5) +#define S_usbHandleLib_NOT_INITIALIZED hdlErr(6) +#define S_usbHandleLib_GENERAL_FAULT hdlErr(7) + + +/* typedefs */ + +typedef pVOID GENERIC_HANDLE; /* type of a generic handle */ +typedef GENERIC_HANDLE *pGENERIC_HANDLE; + + +/* functions */ + +STATUS usbHandleInitialize + ( + UINT32 maxHandles /* max handles allocated by library */ + ); + + +STATUS usbHandleShutdown (void); + + +STATUS usbHandleCreate + ( + UINT32 handleSignature, /* Arbitrary handle signature */ + pVOID handleParam, /* Arbitrary handle parameter */ + pGENERIC_HANDLE pHandle /* Newly allocated handle */ + ); + + +STATUS usbHandleDestroy + ( + GENERIC_HANDLE handle /* handle to be destroyed */ + ); + + +STATUS usbHandleValidate + ( + GENERIC_HANDLE handle, /* handle to be validated */ + UINT32 handleSignature, /* signature used to validate handle */ + pVOID *pHandleParam /* Handle parameter on return */ + ); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbHandleLibh */ + + +/* End of file. */ + diff --git a/h/usb/usbHcdLib.h b/h/usb/usbHcdLib.h new file mode 100644 index 0000000..71aebff --- /dev/null +++ b/h/usb/usbHcdLib.h @@ -0,0 +1,166 @@ +/* usbHcdLib.h - HCD functional API */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01e,26jan00,rcb Change parameter in usbHcdPipeCreate() to + and redefined as UINT32. +01d,29nov99,rcb Remove obsolete function usbHcdBusReset(). + Increase frame number fields to 32 bits. +01c,23nov99,rcb Replace bandwidth alloc/release functions with pipe + create/destroy functions...generalizes approach for use + with OHCI HCD. +01b,07sep99,rcb Add support for management callbacks in attach. + Add set-bus-state API. +01a,08jun99,rcb First. +*/ + +/* +DESCRIPTION + +This file defines a functional interface to the HCD. +*/ + +#ifndef __INCusbHcdLibh +#define __INCusbHcdLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include "drv/usb/usbHcd.h" + + +/* defines */ + + +/* typedefs */ + +/* + * HCD_NEXUS + * + * HCD_NEXUS contains the entry point and HCD_CLIENT_HANDLE needed by an + * HCD caller to invoke an HCD. + */ + +typedef struct hcd_nexus + { + HCD_EXEC_FUNC hcdExecFunc; /* HCD primary entry point */ + HCD_CLIENT_HANDLE handle; /* client's handle with HCD */ + } HCD_NEXUS, *pHCD_NEXUS; + + +/* functions */ + +STATUS usbHcdAttach + ( + HCD_EXEC_FUNC hcdExecFunc, /* HCD's primary entry point */ + pVOID param, /* HCD-specific param */ + USB_HCD_MNGMT_CALLBACK callback,/* management callback */ + pVOID callbackParam, /* parameter to management callback */ + pHCD_NEXUS pNexus, /* nexus will be initialized on return */ + pUINT16 pBusCount + ); + + +STATUS usbHcdDetach + ( + pHCD_NEXUS pNexus /* client's nexus */ + ); + + +STATUS usbHcdSetBusState + ( + pHCD_NEXUS pNexus, /* client's nexus */ + UINT16 busNo, /* bus number to suspend */ + UINT16 busState /* desired bus state */ + ); + + +STATUS usbHcdSofIntervalGet + ( + pHCD_NEXUS pNexus, /* client's nexus */ + UINT16 busNo, /* bus number */ + pUINT16 pSofInterval /* bfr to receive SOF interval */ + ); + + +STATUS usbHcdSofIntervalSet + ( + pHCD_NEXUS pNexus, /* client's nexus */ + UINT16 busNo, /* bus number */ + UINT16 sofInterval /* new SOF interval */ + ); + + +STATUS usbHcdCurrentFrameGet + ( + pHCD_NEXUS pNexus, /* client's nexus */ + UINT16 busNo, /* bus number */ + pUINT32 pFrameNo, /* current frame number */ + pUINT32 pFrameWindow /* size of frame window */ + ); + + +STATUS usbHcdIrpSubmit + ( + pHCD_NEXUS pNexus, /* client's nexus */ + HCD_PIPE_HANDLE pipeHandle, /* pipe to which IRP is directed */ + pUSB_IRP pIrp /* IRP to be executed */ + ); + + +STATUS usbHcdIrpCancel + ( + pHCD_NEXUS pNexus, /* client's nexus */ + pUSB_IRP pIrp /* IRP to be canceled */ + ); + + +STATUS usbHcdPipeCreate + ( + pHCD_NEXUS pNexus, /* client's nexus */ + UINT16 busNo, /* bus number for IRP */ + UINT16 busAddress, /* bus address of USB device */ + UINT16 endpoint, /* endpoint on device */ + UINT16 transferType, /* transfer type */ + UINT16 direction, /* pipe/transfer direction */ + UINT16 speed, /* transfer speed */ + UINT16 maxPacketSize, /* packet size */ + UINT32 bandwidth, /* bandwidth required by pipe */ + UINT16 interval, /* service interval */ + pUINT32 pTime, /* calculated packet time on return */ + pHCD_PIPE_HANDLE pPipeHandle /* HCD pipe handle */ + ); + + +STATUS usbHcdPipeDestroy + ( + pHCD_NEXUS pNexus, /* client's nexus */ + HCD_PIPE_HANDLE pipeHandle /* pipe to be destroyed */ + ); + + +STATUS usbHcdPipeModify + ( + pHCD_NEXUS pNexus, /* client's nexus */ + HCD_PIPE_HANDLE pipeHandle, /* pipe to be modified */ + UINT16 busAddress, /* new bus address or 0 */ + UINT16 maxPacketSize /* new max packet size or 0 */ + ); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbHcdLibh */ + + +/* End of file. */ + diff --git a/h/usb/usbHid.h b/h/usb/usbHid.h new file mode 100644 index 0000000..8861e71 --- /dev/null +++ b/h/usb/usbHid.h @@ -0,0 +1,146 @@ +/* usbHid.h - USB HID (Human Interface Devices) definitions */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01b,07oct99,rcb Add definitions for mouse device. +01a,30aug99,rcb First. +*/ + +#ifndef __INCusbHidh +#define __INCusbHidh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* defines */ + +/* USB HID subclass codes */ + +#define USB_SUBCLASS_HID_NONE 0x00 +#define USB_SUBCLASS_HID_BOOT 0x01 + + +/* USB HID BOOT protocol codes (part of interface class) + * + * NOTE: Do not confuse with similarly named USB_HID_PROTOCOL_xxxx defines + * later in this file. */ + +#define USB_PROTOCOL_HID_BOOT_NONE 0x00 +#define USB_PROTOCOL_HID_BOOT_KEYBOARD 0x01 +#define USB_PROTOCOL_HID_BOOT_MOUSE 0x02 + + +/* USB requests for HID devices */ + +#define USB_REQ_HID_GET_REPORT 0x01 +#define USB_REQ_HID_GET_IDLE 0x02 +#define USB_REQ_HID_GET_PROTOCOL 0x03 +#define USB_REQ_HID_SET_REPORT 0x09 +#define USB_REQ_HID_SET_IDLE 0x0a +#define USB_REQ_HID_SET_PROTOCOL 0x0b + + +/* USB HID report types */ + +#define USB_HID_RPT_TYPE_INPUT 0x01 +#define USB_HID_RPT_TYPE_OUTPUT 0x02 +#define USB_HID_RPT_TYPE_FEATURE 0x03 + + +/* USB HID idle interval */ + +#define USB_HID_IDLE_MSEC_PER_UNIT 4 + + +/* USB HID protocol values (used for USB_REQ_HID_SET_PROTOCOL) + * + * NOTE: Do not confuse with similarly named USB_PROTOCOL_HID_xxxx + * defines earlier in this file. + */ + +#define USB_HID_PROTOCOL_BOOT 0 +#define USB_HID_PROTOCOL_REPORT 1 + + +/* HID keyboard definitions */ + +#define BOOT_RPT_KEYCOUNT 6 /* 6 keys returned in std boot report */ + + +/* HID keyboard modifier key definitions */ + +#define MOD_KEY_LEFT_CTRL 0x01 +#define MOD_KEY_LEFT_SHIFT 0x02 +#define MOD_KEY_LEFT_ALT 0x04 +#define MOD_KEY_LEFT_GUI 0x08 +#define MOD_KEY_RIGHT_CTRL 0x10 +#define MOD_KEY_RIGHT_SHIFT 0x20 +#define MOD_KEY_RIGHT_ALT 0x40 +#define MOD_KEY_RIGHT_GUI 0x80 + +#define MOD_KEY_CTRL (MOD_KEY_LEFT_CTRL | MOD_KEY_RIGHT_CTRL) +#define MOD_KEY_SHIFT (MOD_KEY_LEFT_SHIFT | MOD_KEY_RIGHT_SHIFT) +#define MOD_KEY_ALT (MOD_KEY_LEFT_ALT | MOD_KEY_RIGHT_ALT) +#define MOD_KEY_GUI (MOD_KEY_LEFT_GUI | MOD_KEY_RIGHT_GUI) + + +/* HID keyboard LED definitions for output report */ + +#define RPT_LED_NUM_LOCK 0x01 +#define RPT_LED_CAPS_LOCK 0x02 +#define RPT_LED_SCROLL_LOCK 0x04 +#define RPT_LED_COMPOSE 0x08 +#define RPT_LED_KANA 0x10 + + +/* HID mouse report definitions */ + +#define MOUSE_BUTTON_1 0x01 +#define MOUSE_BUTTON_2 0x02 +#define MOUSE_BUTTON_3 0x04 + + +/* Maximum length for a HID "boot report" */ + +#define HID_BOOT_REPORT_MAX_LEN 8 + + +/* typedefs */ + +/* + * HID_KBD_BOOT_REPORT + */ + +typedef struct hid_kbd_boot_report + { + UINT8 modifiers; /* modifier keys */ + UINT8 reserved; /* reserved */ + UINT8 scanCodes [BOOT_RPT_KEYCOUNT]; /* individual scan codes */ + } HID_KBD_BOOT_REPORT, *pHID_KBD_BOOT_REPORT; + + +/* + * HID_MSE_BOOT_REPORT + */ + +typedef struct hid_mse_boot_report + { + UINT8 buttonState; /* buttons */ + char xDisplacement; /* signed x-displacement */ + char yDisplacement; /* signed y-displacement */ + } HID_MSE_BOOT_REPORT, *pHID_MSE_BOOT_REPORT; + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbHidh */ + + +/* End of file. */ diff --git a/h/usb/usbLib.h b/h/usb/usbLib.h new file mode 100644 index 0000000..f258ea6 --- /dev/null +++ b/h/usb/usbLib.h @@ -0,0 +1,130 @@ +/* usbLib.h - USB utility functions */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01d,26jan00,rcb Modify usbRecurringTime() to accept instead + of . + Add usbDescrCopy32() and usbDescrStrCopy32(). +01c,17jan99,rcb Add usbConfigDescrGet() function. +01b,23nov99,rcb Add usbRecurringTime() function. +01a,16jul99,rcb First. +*/ + +#ifndef __INCusbLibh +#define __INCusbLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include "usb/usb.h" +#include "usb/usbHid.h" +#include "usb/usbdLib.h" +#include "usb/usbDescrCopyLib.h" + + +/* function prototypes */ + +UINT32 usbTransferTime + ( + UINT16 transferType, /* transfer type */ + UINT16 direction, /* transfer direction */ + UINT16 speed, /* speed of pipe */ + UINT32 bytes, /* number of bytes for packet to be calc'd */ + UINT32 hostDelay, /* host controller delay per packet */ + UINT32 hostHubLsSetup /* host controller time for low-speed setup */ + ); + + +UINT32 usbRecurringTime + ( + UINT16 transferType, /* transfer type */ + UINT16 direction, /* transfer direction */ + UINT16 speed, /* speed of pipe */ + UINT16 packetSize, /* max packet size for endpoint */ + UINT32 bandwidth, /* number of bytes to transfer per second */ + UINT32 hostDelay, /* host controller delay per packet */ + UINT32 hostHubLsSetup /* host controller time for low-speed setup */ + ); + + +pVOID usbDescrParseSkip + ( + pUINT8 *ppBfr, /* buffer to parse */ + pUINT16 pBfrLen, /* length of buffer to parse */ + UINT8 descriptorType /* type of descriptor being sought */ + ); + + +pVOID usbDescrParse + ( + pUINT8 pBfr, /* buffer to parse */ + UINT16 bfrLen, /* length of buffer to parse */ + UINT8 descriptorType /* type of descriptor being sought */ + ); + + +STATUS usbConfigCountGet + ( + USBD_CLIENT_HANDLE usbdClientHandle, /* caller's USBD client handle */ + USBD_NODE_ID nodeId, /* device node ID */ + pUINT16 pNumConfig /* bfr to receive nbr of config */ + ); + + +STATUS usbConfigDescrGet + ( + USBD_CLIENT_HANDLE usbdClientHandle, /* caller's USBD client handle */ + USBD_NODE_ID nodeId, /* device node ID */ + UINT16 cfgNo, /* specifies configuration nbr */ + pUINT16 pBfrLen, /* receives length of buffer */ + pUINT8 *ppBfr /* receives pointer to buffer */ + ); + + +STATUS usbHidReportSet + ( + USBD_CLIENT_HANDLE usbdClientHandle, /* caller's USBD client handle */ + USBD_NODE_ID nodeId, /* desired node */ + UINT16 interface, /* desired interface */ + UINT16 reportType, /* report type */ + UINT16 reportId, /* report Id */ + pUINT8 reportBfr, /* report value */ + UINT16 reportLen /* length of report */ + ); + + +STATUS usbHidIdleSet + ( + USBD_CLIENT_HANDLE usbdClientHandle, /* caller's USBD client handle */ + USBD_NODE_ID nodeId, /* desired node */ + UINT16 interface, /* desired interface */ + UINT16 reportId, /* desired report */ + UINT16 duration /* idle duration */ + ); + + +STATUS usbHidProtocolSet + ( + USBD_CLIENT_HANDLE usbdClientHandle, /* caller's USBD client handle */ + USBD_NODE_ID nodeId, /* desired node */ + UINT16 interface, /* desired interface */ + UINT16 protocol /* USB_HID_PROTOCOL_xxxx */ + ); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbLibh */ + + +/* End of file. */ + diff --git a/h/usb/usbListLib.h b/h/usb/usbListLib.h new file mode 100644 index 0000000..c1d10e2 --- /dev/null +++ b/h/usb/usbListLib.h @@ -0,0 +1,129 @@ +/* usbListLib.h - Linked list utility functions */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01a,10jun99,rcb First. +*/ + +/* +DESCRIPTION + +This file defines a set of general-purpose linked-list functions which are +portable across OS's. +*/ + +#ifndef __INCusbListLibh +#define __INCusbListLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include "usb/ossLib.h" + + +/* defines */ + +/* Arguments passed to the usbListLink/usbListLinkProt utility function. */ + +#define LINK_HEAD 0 +#define LINK_TAIL 1 + + +/* Arguments passed to the usbListFind utility function. */ + +#define LINK_TEST 0 +#define LINK_REMOVE 1 + + +/* typedefs */ + +/* + * LINK + * + * Linked-list management structure. + * + * NOTE: Code relies on the fact that LINK.linkFwd and LIST_HEAD.pLink are + * both the first fields in their respective structures. + */ + +typedef struct link + { + struct link *linkFwd; /* Link to next entry */ + struct link *linkBack; /* Link to previous entry */ + pVOID pStruct; /* Points to base of structure being linked */ + } LINK, *pLINK; + + +/* + * LIST_HEAD + * + * Defines the head of a linked list. + */ + +typedef struct list_head + { + pLINK pLink; /* Pointer to first entry on list */ + } LIST_HEAD, *pLIST_HEAD; + + +/* Function prototypes. */ + +VOID usbListLink + ( + pLIST_HEAD pHead, /* list head */ + pVOID pStruct, /* ptr to base of structure to be linked */ + pLINK pLink, /* ptr to LINK structure to be linked */ + UINT16 flag /* indicates LINK_HEAD or LINK_TAIL */ + ); + +VOID usbListLinkProt + ( + pLIST_HEAD pHead, /* list head */ + pVOID pStruct, /* ptr to base of structure to be linked */ + pLINK pLink, /* ptr to LINK structure to be linked */ + UINT16 flag, /* indicates LINK_HEAD or LINK_TAIL */ + MUTEX_HANDLE mutex /* list guard mutex */ + ); + + +VOID usbListUnlink + ( + pLINK pLink /* LINK structure to be unlinked */ + ); + + +VOID usbListUnlinkProt + ( + pLINK pLink, /* LINK structure to be unlinked */ + MUTEX_HANDLE mutex /* list guard mutex */ + ); + + +pVOID usbListFirst + ( + pLIST_HEAD pListHead /* head of linked list */ + ); + + +pVOID usbListNext + ( + pLINK pLink /* LINK structure */ + ); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbListLibh */ + + +/* End of file. */ + diff --git a/h/usb/usbMassStorage.h b/h/usb/usbMassStorage.h new file mode 100644 index 0000000..e3eb003 --- /dev/null +++ b/h/usb/usbMassStorage.h @@ -0,0 +1,46 @@ +/* usbMassStorage.h - Definitions for USB mass storage class */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01a,14dec00,wef First. +*/ + +#ifndef __INCusbMassStorageh +#define __INCusbMassStorageh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* typedefs */ + + +/* USB Command execution status codes */ + +typedef enum + { + USB_COMMAND_SUCCESS = 0, + USB_COMMAND_FAILED, + USB_INVALID_CSW, + USB_PHASE_ERROR, + USB_IRP_FAILED, + USB_DATA_INCOMPLETE, + USB_BULK_IO_ERROR, + USB_INTERNAL_ERROR + } USB_COMMAND_STATUS; + + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbMassStorageh */ + + +/* End of file. */ + diff --git a/h/usb/usbPciLib.h b/h/usb/usbPciLib.h new file mode 100644 index 0000000..8196db2 --- /dev/null +++ b/h/usb/usbPciLib.h @@ -0,0 +1,240 @@ +/* usbPciLib.h - System-specific PCI Functions */ + +/* Copyright 2000 Wind River Systems, Inc. */ +/* +Modification history +-------------------- +01e,08mar05,hch Fixed the USB_PCI_CFG_BYTE_OUT error +01d,27oct04,hch adding macros for USB_PCI_CFG_WORD_OUT, USB_PCI_FIND_DEVICE, + USB_PCI_ASSIGN_RESOURCE. +01c,08mar00,rcb Correct prototype for usbPciMemioOffset()... + was incorrectly called usbPciMemOffset(). +01b,10dec99,rcb Add definition for usbPciMemioOffset(). +01a,31may99,rcb First. +*/ + +/* +DESCRIPTION + +This file defines platform-independent functions accessing PCI bus +capabilities. These functions allow PCI device drivers to be written +independent of the underlying O/S's PCI access mechanisms. +*/ + +#ifndef __INCusbPciLibh +#define __INCusbPciLibh + + +/* Includes */ + +#include "usb/pciConstants.h" +#include "usb/usbPlatform.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/* typedefs */ + +/* function prototype for an interrupt vector */ + +typedef VOID (*INT_HANDLER_PROTOTYPE) (pVOID param); + + +/* Function prototypes */ + +BOOL usbPciClassFind + ( + UINT8 pciClass, /* PCI device class */ + UINT8 subClass, /* PCI device sub-class */ + UINT8 pgmIf, /* Programming interface */ + UINT16 index, /* Caller wants nth matching dev */ + pUINT8 pBusNo, /* Bus number of matching dev */ + pUINT8 pDeviceNo, /* Device number of matching dev */ + pUINT8 pFuncNo /* Function number of matching dev */ + ); + + +UINT8 usbPciByteGet + ( + UINT8 busNo, /* Bus number of device */ + UINT8 deviceNo, /* Device number of device */ + UINT8 funcNo, /* Function number of device */ + UINT16 regOffset /* Offset into PCI config space */ + ); + +#define USB_PCI_CFG_BYTE_GET(busNo, deviceNo, funcNo, regOffset) \ + usbPciByteGet (busNo, deviceNo, funcNo, regOffset) + + +UINT32 usbPciWordGet + ( + UINT8 busNo, /* Bus number of device */ + UINT8 deviceNo, /* Device number of device */ + UINT8 funcNo, /* Function number of device */ + UINT16 regOffset /* Offset into PCI config space */ + ); + +#define USB_PCI_CFG_WORD_GET(busNo, deviceNo, funcNo, regOffset) \ + usbPciWordGet (busNo, deviceNo, funcNo, regOffset) + + +UINT32 usbPciDwordGet + ( + UINT8 busNo, /* Bus number of device */ + UINT8 deviceNo, /* Device number of device */ + UINT8 funcNo, /* Function number of device */ + UINT16 regOffset /* Offset into PCI config space */ + ); + +#define USB_PCI_CFG_DWORD_GET(busNo, deviceNo, funcNo, regOffset) \ + usbPciDwordGet (busNo, deviceNo, funcNo, regOffset) + + +VOID usbPciConfigHeaderGet + ( + UINT8 busNo, /* Bus number of device */ + UINT8 deviceNo, /* Device number of device */ + UINT8 funcNo, /* Function number of device */ + pPCI_CFG_HEADER pCfgHdr /* Buffer provided by caller */ + ); + + +UINT8 usbPciByteIn + ( + UINT32 address /* PCI I/O address */ + ); + +#define USB_PCI_BYTE_IN(address) usbPciByteIn (address) + + +UINT16 usbPciWordIn + ( + UINT32 address /* PCI I/O address */ + ); + +#define USB_PCI_WORD_IN(address) usbPciWordIn (address) + + +UINT32 usbPciDwordIn + ( + UINT32 address /* PCI I/O address */ + ); + +#define USB_PCI_DWORD_IN(address) usbPciDwordIn (address) + + +VOID usbPciByteOut + ( + UINT32 address, /* PCI I/O address */ + UINT8 value /* value */ + ); + +#define USB_PCI_BYTE_OUT(address, value) usbPciByteOut (address, value) + + +VOID usbPciWordOut + ( + UINT32 address, /* PCI I/O address */ + UINT16 value /* value */ + ); + +#define USB_PCI_WORD_OUT(address, value) usbPciWordOut (address, value) + + +VOID usbPciDwordOut + ( + UINT32 address, /* PCI I/O address */ + UINT32 value /* value */ + ); + +#define USB_PCI_DWORD_OUT(address, value) usbPciDwordOut (address, value) + + +UINT32 usbPciMemioOffset (void); + +#define USB_PCI_MEMIO_OFFSET() usbPciMemioOffset () + + + +UINT32 usbMemToPci + ( + pVOID pMem /* memory address to convert */ + ); + +#define USB_MEM_TO_PCI(pMem) usbMemToPci (pMem) + + +pVOID usbPciToMem + ( + UINT32 pciAdrs /* 32-bit PCI address to be converted */ + ); + +#define USB_PCI_TO_MEM(pciAdrs) usbPciToMem (pciAdrs) + + +VOID usbPciMemInvalidate + ( + pVOID pMem, /* base of memory region to invalidate */ + UINT32 size /* size of region to invalidate */ + ); + +#define USB_PCI_MEM_INVALIDATE(pMem, size) usbPciMemInvalidate (pMem, size) + + +VOID usbPciMemFlush + ( + pVOID pMem, /* base of memory region to invalidate */ + UINT32 size /* size of region to invalidate */ + ); + +#define USB_PCI_MEM_FLUSH(pMem, size) usbPciMemFlush (pMem, size) + + +STATUS usbPciIntConnect + ( + INT_HANDLER_PROTOTYPE func, /* new interrupt handler */ + pVOID param, /* parameter for int handler */ + UINT16 intNo /* interrupt vector number */ + ); + + +VOID usbPciIntRestore + ( + INT_HANDLER_PROTOTYPE func, /* int handler to be removed */ + pVOID param, /* parameter for int handler */ + UINT16 intNo /* interrupt vector number */ + ); + +#ifndef USB_PCI_CFG_WORD_OUT +#define USB_PCI_CFG_WORD_OUT(busNo, deviceNo, funcNo, address, data) \ + pciConfigOutWord (busNo, deviceNo, funcNo, address, data) +#endif + +#ifndef USB_PCI_FIND_DEVICE +#define USB_PCI_FIND_DEVICE(vendorId, deviceId, index, pBusNo, pDeviceNo, \ + pFuncNo) \ + pciFindDevice (vendorId, deviceId, index, pBusNo, pDeviceNo,pFuncNo) +#endif + +#ifndef USB_PCI_ASSIGN_RESOURCES +#define USB_PCI_ASSIGN_RESOURCES(busNo, deviceNo, funcNo) \ + pciAssignResources (busNo, deviceNo, funcNo); +#endif + +#ifndef USB_PCI_CFG_BYTE_OUT +#define USB_PCI_CFG_BYTE_OUT(busNo, deviceNo, funcNo, address, data) \ + pciConfigOutByte (busNo, deviceNo, funcNo, address, data) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbPciLibh */ + + +/* End of file. */ + + diff --git a/h/usb/usbPlatform.h b/h/usb/usbPlatform.h new file mode 100644 index 0000000..70978ce --- /dev/null +++ b/h/usb/usbPlatform.h @@ -0,0 +1,107 @@ +/* usbPlatform.h - Basic platform definitions for USB driver stack */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01e,18sep01,wef merge from wrs.tor2_0.usb1_1-f for veloce +01d,05dec00,wef removed M_usb* and put in vwModNum.h +01c,12jan00,rcb Add definition for M_usbSpeakerLib. +01b,26may99,rcb Add definition of VOLATILE. +01a,31may99,rcb First. +*/ + +/* +DESCRIPTION + +This file contains basic platform definitions used to write portable (O/S- +independent) code. + +By convention, this should be the only file in a set of "portable" code which +contains #ifdef's and other constructs used to accomodate machine or O/S +dependencies. +*/ + + +#ifndef __INCusbPlatformh +#define __INCusbPlatformh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* + * Structure packing + * + * By convention, all code wants "zero-byte packing". That is, the compiler + * should assemble structures so that fields are contiguous in memory...no + * padding should be added. CMC's use of this convention was approved by + * D'Anne Thompson of WRS on 09jun99. + */ + + +/* + * Basic data types + * + * vxWorks.h defines UINT8, UINT16, UINT32, BOOL, VOID, and STATUS. + * + * vxWorks.h defines min(x,y), max(x,y). + * + * vxWorks.h defines _BIG_ENDIAN, _BYTE_ORDER, MSB, LSB, LONGSWAP. + * + * vxWorks.h defines OK, ERROR. + */ + +#include "vxWorks.h" + +/* pointers to data types */ + +typedef UINT8 *pUINT8; +typedef UINT16 *pUINT16; +typedef UINT32 *pUINT32; +typedef BOOL *pBOOL; +typedef char *pCHAR; +typedef VOID *pVOID; + + +/* VOLATILE */ + +#define VOLATILE volatile + + +/* Macros to deal with byte order issues */ + +#if (_BYTE_ORDER == _BIG_ENDIAN) + +#define FROM_LITTLEW(w) (MSB((w)) | (LSB((w)) << 8)) +#define FROM_LITTLEL(l) (LONGSWAP((l))) +#define FROM_BIGW(w) (w) +#define FROM_BIGL(l) (l) + +#else + +#define FROM_LITTLEW(w) (w) +#define FROM_LITTLEL(l) (l) +#define FROM_BIGW(w) (MSB((w)) | (LSB((w)) << 8)) +#define FROM_BIGL(l) (LONGSWAP((l))) + +#endif + + +#define TO_LITTLEW(w) FROM_LITTLEW((w)) +#define TO_LITTLEL(l) FROM_LITTLEL((l)) +#define TO_BIGW(w) FROM_BIGW((w)) +#define TO_BIGL(w) FROM_BIGL((l)) + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbPlatformh */ + + +/* End of file. */ + diff --git a/h/usb/usbPrinter.h b/h/usb/usbPrinter.h new file mode 100644 index 0000000..40509c9 --- /dev/null +++ b/h/usb/usbPrinter.h @@ -0,0 +1,80 @@ +/* usbPrinter.h - Class-specific definitions for USB printers */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01a,,rcb First. +*/ + +#ifndef __INCusbPrinterh +#define __INCusbPrinterh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* defines */ + +/* USB PRINTER subclass codes */ + +#define USB_SUBCLASS_PRINTER 0x01 + + +/* USB PRINTER protocol codes */ + +#define USB_PROTOCOL_PRINTER_UNIDIR 0x01 +#define USB_PROTOCOL_PRINTER_BIDIR 0x02 + + +/* USB PRINTER class-specific requests */ + +#define USB_REQ_PRN_GET_DEVICE_ID 0x00 +#define USB_REQ_PRN_GET_PORT_STATUS 0x01 +#define USB_REQ_PRN_SOFT_RESET 0x02 + + +/* USB_PRINTER_PORT_STATUS.status bit definitions */ + +#define USB_PRN_STS_PAPER_EMPTY 0x20 +#define USB_PRN_STS_SELECTED 0x10 +#define USB_PRN_STS_NOT_ERROR 0x08 + + +#define USB_PRN_MAX_DEVICE_ID_LEN 256 + + +/* typedefs */ + +/* USB_PRINTER_CAPABILITIES + * + * NOTE: The USB_PRINTER_CAPABILITIES structure matches that of the IEEE-1284 + * "device ID" string. + */ + +typedef struct usb_printer_capabilities + { + UINT16 length; /* length of string, big-endian */ + UINT8 caps [1]; /* variable length string */ + } USB_PRINTER_CAPABILITIES, *pUSB_PRINTER_CAPABILITIES; + + +/* USB_PRINTER_PORT_STATUS */ + +typedef struct usb_printer_port_status + { + UINT8 status; + } USB_PRINTER_PORT_STATUS, *pUSB_PRINTER_PORT_STATUS; + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbPrinterh */ + + +/* End of file. */ + diff --git a/h/usb/usbQueueLib.h b/h/usb/usbQueueLib.h new file mode 100644 index 0000000..7eb1534 --- /dev/null +++ b/h/usb/usbQueueLib.h @@ -0,0 +1,125 @@ +/* usbQueueLib.h - O/S-independent queue services */ + +/* Copyright 2000 Wind River Systems, Inc. */ +/* +Modification history +-------------------- +01f,18sep01,wef merge from wrs.tor2_0.usb1_1-f for veloce +01e,07may01,wef changed module number to be (module sub num << 8) | + M_usbHostLib +01d,02may01,wef changed module number to be M_ + M_usbHostLib +01c,05dec00,wef moved Module number defs to vwModNum.h - add this + to #includes +01b,07mar00,rcb Change QUEUE_HANDLE from UINT32 to pVOID. +01a,13jul99,rcb First. +*/ + +/* +DESCRIPTION + +Defines an O/S-independent queueing mechanism which is typically used for +inter-thread communication in a multi-threaded environment. +*/ + + +#ifndef __INCusbQueueLibh +#define __INCusbQueueLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include "usb/ossLib.h" +#include "vwModNum.h" /* USB Module number def's */ + + +/* Defines */ + +/* USB return codes. */ + +/* + * USB errnos are defined as being part of the USB host Module, as are all + * vxWorks module numbers, but the USB Module number is further divided into + * sub-modules. Each sub-module has upto 255 values for its own error codes + */ + +#define USB_QUEUE_SUB_MODULE 2 + +#define M_usbQueueLib ( (USB_QUEUE_SUB_MODULE << 8) | M_usbHostLib ) + +#define usbQueueErr(x) (M_usbQueueLib | (x)) + +#define S_usbQueueLib_BAD_HANDLE usbQueueErr (1) +#define S_usbQueueLib_BAD_PARAMETER usbQueueErr (2) +#define S_usbQueueLib_OUT_OF_MEMORY usbQueueErr (3) +#define S_usbQueueLib_OUT_OF_RESOURCES usbQueueErr (4) +#define S_usbQueueLib_Q_NOT_AVAILABLE usbQueueErr (5) + + +/* Structure definitions. */ + +/* Handles. */ + +typedef pVOID QUEUE_HANDLE; /* Queue handle */ +typedef QUEUE_HANDLE *pQUEUE_HANDLE; + + +/* + * USB_MESSAGE + * + * Defines the format of a message which can be passed through a queue. + */ + +typedef struct usb_message + { + UINT16 msg; /* Message code - application specific */ + UINT16 wParam; /* WORD parameter - application specific */ + UINT32 lParam; /* DWORD parameter - application specific */ + } USB_MESSAGE, *pUSB_MESSAGE; + + +/* function prototypes */ + +STATUS usbQueueCreate + ( + UINT16 depth, /* Max entries queue can handle */ + pQUEUE_HANDLE pQueueHandle /* Handle of newly created queue */ + ); + + +STATUS usbQueueDestroy + ( + QUEUE_HANDLE queueHandle /* Hnadle of queue to destroy */ + ); + + +STATUS usbQueuePut + ( + QUEUE_HANDLE queueHandle, /* queue handle */ + UINT16 msg, /* app-specific message */ + UINT16 wParam, /* app-specific parameter */ + UINT32 lParam, /* app-specific parameter */ + UINT32 blockFlag /* specifies blocking action */ + ); + + +STATUS usbQueueGet + ( + QUEUE_HANDLE queueHandle, /* queue handle */ + pUSB_MESSAGE pMsg, /* USB_MESSAGE to receive msg */ + UINT32 blockFlag /* specifies blocking action */ + ); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbQueueLibh */ + + +/* End of file. */ + diff --git a/h/usb/usbdCoreLib.h b/h/usb/usbdCoreLib.h new file mode 100644 index 0000000..d83a995 --- /dev/null +++ b/h/usb/usbdCoreLib.h @@ -0,0 +1,513 @@ +/* usbdCoreLib.h - Defines internal between usbdLib and usbdCoreLib */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01d,26jan00,rcb Redefine "bandwidth" field in URB_PIPE_CREATE as UINT32. +01c,29nov99,rcb Increase frame number fields to 32 bits in + URB_CURRENT_FRAME_GET. +01b,07sep99,rcb Add support for management callbacks and set-bus-state API. +01a,20aug99,rcb First. +*/ + +#ifndef __INCusbdCoreLibh +#define __INCusbdCoreLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include "usb/usbdLib.h" + + +/* defines */ + +/* USBD Function Request Codes - URB_HEADER.Function */ + +#define USBD_FNC_ASYNC_MASK 0x8000 /* Set if USBD function */ + /* execute asynchronously */ + +/* + * Synchronous USBD functions always execute synchronously. + * + * Asynchronous USBD functions may or may not execute asynchronously, + * depending on the USBD implementation. However, clients must expect that + * such functions may execute asynchronously. + */ + +#define USBD_FNC_INITIALIZE 0x0000 /* initialize USBD */ +#define USBD_FNC_SHUTDOWN 0x0001 /* shut down USBD */ + +#define USBD_FNC_CLIENT_REG 0x0100 /* Client register */ +#define USBD_FNC_CLIENT_UNREG 0x0101 /* Client unregister */ +#define USBD_FNC_MNGMT_CALLBACK_SET 0x0102 /* set client's mngmt callback */ + +#define USBD_FNC_VERSION_GET 0x0200 /* Get USBD version */ +#define USBD_FNC_HCD_ATTACH 0x0201 /* Attach HCD to USBD */ +#define USBD_FNC_HCD_DETACH 0x0202 /* Detach HCD from USBD */ +#define USBD_FNC_STATISTICS_GET 0x0203 /* Get USBD statistics */ + +#define USBD_FNC_BUS_COUNT_GET 0x0300 /* Get bus count */ +#define USBD_FNC_ROOT_ID_GET 0x0301 /* Get root id */ +#define USBD_FNC_HUB_PORT_COUNT_GET 0x0302 /* Get count of hub ports */ +#define USBD_FNC_NODE_ID_GET 0x0303 /* Get node id */ +#define USBD_FNC_NODE_INFO_GET 0x0304 /* Get node information */ + +#define USBD_FNC_DYNA_ATTACH_REG 0x0400 /* Dynamic attach register */ +#define USBD_FNC_DYNA_ATTACH_UNREG 0x0401 /* Dynamic attach unregister */ + +#define USBD_FNC_FEATURE_CLEAR 0x8500 /* Clear feature */ +#define USBD_FNC_FEATURE_SET 0x8501 /* Set feature */ +#define USBD_FNC_CONFIG_GET 0x8502 /* Get configuration */ +#define USBD_FNC_CONFIG_SET 0x8503 /* Set configuration */ +#define USBD_FNC_DESCRIPTOR_GET 0x8504 /* Get descriptor */ +#define USBD_FNC_DESCRIPTOR_SET 0x8505 /* Set descriptor */ +#define USBD_FNC_INTERFACE_GET 0x8506 /* Get interface */ +#define USBD_FNC_INTERFACE_SET 0x8507 /* Set interface */ +#define USBD_FNC_STATUS_GET 0x8508 /* Get status */ +#define USBD_FNC_ADDRESS_GET 0x0509 /* Get device address */ +#define USBD_FNC_ADDRESS_SET 0x850a /* Set device address */ +#define USBD_FNC_VENDOR_SPECIFIC 0x850b /* Vendor specific */ + +#define USBD_FNC_PIPE_CREATE 0x0600 /* Create pipe */ +#define USBD_FNC_PIPE_DESTROY 0x0601 /* Destroy pipe */ +#define USBD_FNC_TRANSFER 0x0602 /* Initiate transfer */ +#define USBD_FNC_TRANSFER_ABORT 0x0603 /* Abort transfers */ +#define USBD_FNC_SYNCH_FRAME_GET 0x8604 /* Get synch frame */ +#define USBD_FNC_CURRENT_FRAME_GET 0x8605 /* Get current frame */ +#define USBD_FNC_SOF_MASTER_TAKE 0x0606 /* Become SOF master */ +#define USBD_FNC_SOF_MASTER_RELEASE 0x0607 /* release SOF master */ +#define USBD_FNC_SOF_INTERVAL_GET 0x0608 /* retrieve SOF */ +#define USBD_FNC_SOF_INTERVAL_SET 0x0609 /* set SOF (master only) */ +#define USBD_FNC_BUS_STATE_SET 0x060a /* set bus state */ + + +/* typedefs */ + +/* + * URB_HEADER + * + * The URB_HEADER must be the first field in each URB data structure. It + * identifies the USBD function to be executed, the size of the URB, etc. + */ + +typedef struct urb_header + { + pVOID link; /* n/a USBD private link ptr */ + USBD_CLIENT_HANDLE handle; /* I/O Client's handle with USBD */ + UINT16 function; /* IN USBD function code */ + int result; /* OUT Final URB result: S_usbdLib_xxxx */ + UINT16 urbLength; /* IN Length of the total URB */ + URB_CALLBACK callback; /* IN Completion callback */ + pVOID userPtr; /* IN Generic pointer for client use */ + } URB_HEADER, *pURB_HEADER; + + +/* URBs */ + +/* + * URB_CLIENT_REG + * + * Note: For this function and only this function, the client does *not* pass + * its USBD_CLIENT_HANDLE in the URB_HEADER.Handle field. Instead, upon + * completion of this function, the USBD will have stored a newly assigned + * USBD_CLIENT_HANDLE in the URB_HEADER.Handle field, from which it should + * be retrieved by the client. + */ + +typedef struct urb_client_reg + { + URB_HEADER header; /* URB header */ + char clientName [USBD_NAME_LEN+1]; /* IN Client name */ + } URB_CLIENT_REG, *pURB_CLIENT_REG; + + +/* + * URB_CLIENT_UNREG + */ + +typedef struct urb_client_unreg + { + URB_HEADER header; /* URB header */ + } URB_CLIENT_UNREG, *pURB_CLIENT_UNREG; + + +/* + * URB_MNGMT_CALLBACK_SET + */ + +typedef struct urb_mngmt_callback_set + { + URB_HEADER header; /* URB header */ + USBD_MNGMT_CALLBACK mngmtCallback; /* IN management callback or NULL */ + pVOID mngmtCallbackParam; /* IN client-defined mngmt callback */ + } URB_MNGMT_CALLBACK_SET, *pURB_MNGMT_CALLBACK_SET; + + +/* + * URB_BUS_STATE_SET + */ + +typedef struct urb_bus_state_set + { + URB_HEADER header; /* URB header */ + USBD_NODE_ID nodeId; /* IN node ID */ + UINT16 busState; /* IN desired bus state */ + } URB_BUS_STATE_SET, *pURB_BUS_STATE_SET; + + +/* + * URB_BUS_COUNT_GET + */ + +typedef struct urb_bus_count_get + { + URB_HEADER header; /* URB header */ + UINT16 busCount; /* OUT bus count */ + } URB_BUS_COUNT_GET, *pURB_BUS_COUNT_GET; + + +/* + * URB_ROOT_ID_GET + */ + +typedef struct urb_root_id_get + { + URB_HEADER header; /* URB header */ + UINT16 busIndex; /* IN bus index */ + USBD_NODE_ID rootId; /* OUT Node Id for root hub */ + } URB_ROOT_ID_GET, *pURB_ROOT_ID_GET; + + +/* + * URB_HUB_PORT_COUNT_GET + */ + +typedef struct urb_hub_port_count_get + { + URB_HEADER header; /* URB header */ + USBD_NODE_ID hubId; /* IN Node Id for desired hub */ + UINT16 portCount; /* OUT port count for specified hub */ + } URB_HUB_PORT_COUNT_GET, *pURB_HUB_PORT_COUNT_GET; + + +/* + * URB_NODE_ID_GET + */ + +typedef struct urb_node_id_get + { + URB_HEADER header; /* URB header */ + USBD_NODE_ID hubId; /* IN Node Id for desired hub */ + UINT16 portIndex; /* IN Index of desired port */ + UINT16 nodeType; /* OUT Type of node attached to port */ + USBD_NODE_ID nodeId; /* OUT Node Id for device attached to port */ + } URB_NODE_ID_GET, *pURB_NODE_ID_GET; + + +/* + * URB_NODE_INFO_GET + */ + +typedef struct urb_node_info_get + { + URB_HEADER header; /* URB header */ + USBD_NODE_ID nodeId; /* IN Node id of device/hub */ + pUSBD_NODE_INFO pNodeInfo; /* IN Ptr to struct to receive info */ + UINT16 infoLen; /* IN Length of struct allocated by client */ + } URB_NODE_INFO_GET, *pURB_NODE_INFO_GET; + + +/* + * URB_DYNAMIC_ATTACH_REG_UNREG + */ + +typedef struct urb_dynamic_attach_reg_unreg + { + URB_HEADER header; /* URB header */ + UINT16 deviceClass; /* IN USB Device class to register */ + UINT16 deviceSubClass; /* IN USB Device sub-class to register */ + UINT16 deviceProtocol; /* IN USB Device protocol */ + USBD_ATTACH_CALLBACK attachCallback; + /* IN Caller-supplied notification callback */ + } URB_DYNA_ATTACH_REG_UNREG, *pURB_DYNA_ATTACH_REG_UNREG; + + +/* + * URB_FEATURE_CLEAR_SET + * + * NOTE: Same URB is used for USBD_FNC_FEATURE_CLEAR and USBD_FNC_FEATURE_SET. + */ + +typedef struct urb_feature_clear_set + { + URB_HEADER header; /* URB header */ + USBD_NODE_ID nodeId; /* IN Node ID of device/hub */ + UINT16 requestType; /* IN Selects request type */ + UINT16 feature; /* IN Feature selector */ + UINT16 index; /* IN Interface/endpoint index */ + } URB_FEATURE_CLEAR_SET, *pURB_FEATURE_CLEAR_SET; + + +/* + * URB_CONFIG_GET_SET + * + * NOTE: Same URB is used for USBD_FNC_CONFIG_GET and USBD_FNC_CONFIG_SET. + */ + +typedef struct urb_config_get_set + { + URB_HEADER header; /* URB header */ + USBD_NODE_ID nodeId; /* IN Node Id of device/hub */ + UINT16 maxPower; /* IN Max power to be consumed (set only) */ + UINT16 configuration; /* I/O Configuration value */ + } URB_CONFIG_GET_SET, *pURB_CONFIG_GET_SET; + + +/* + * URB_DECSRIPTOR_GET_SET + * + * NOTE: Same URB is used for USBD_FNC_DESCRIPTOR_GET and + * USBD_FNC_DESCRIPTOR_SET. + */ + +typedef struct urb_descriptor_get_set + { + URB_HEADER header; /* URB header */ + USBD_NODE_ID nodeId; /* IN Node Id of device/hub */ + UINT8 requestType; /* IN selects request type */ + UINT8 descriptorType; /* IN Type of descriptor */ + UINT8 descriptorIndex; /* IN Index of descriptor */ + UINT16 languageId; /* IN Language ID */ + UINT16 bfrLen; /* IN Max length of data to be returned */ + pUINT8 pBfr; /* IN Pointer to bfr to receive data */ + UINT16 actLen; /* OUT Actual length of data transferred */ + } URB_DESCRIPTOR_GET_SET, *pURB_DESCRIPTOR_GET_SET; + + +/* + * URB_INTERFACE_GET_SET + * + * NOTE: Same URB is used for USBD_FNC_INTERFACE_GET and USBD_FNC_INTERFACE_SET. + */ + +typedef struct urb_interface_get_set + { + URB_HEADER header; /* URB header */ + USBD_NODE_ID nodeId; /* IN Node Id of device/hub */ + UINT16 interfaceIndex; /* IN Index of interface */ + UINT16 alternateSetting; /* I/O Current alternate setting */ + } URB_INTERFACE_GET_SET, *pURB_INTERFACE_GET_SET; + + +/* + * URB_STATUS_GET + */ + +typedef struct urb_status_get + { + URB_HEADER header; /* URB header */ + USBD_NODE_ID nodeId; /* IN Node Id of device/hub */ + UINT8 requestType; /* IN selects request type */ + UINT16 index; /* IN Interface/endpoint index */ + UINT16 bfrLen; /* IN max len of status to receive */ + pUINT8 pBfr; /* OUT bfr to receive status from device */ + UINT16 actLen; /* OUT actual length of status received */ + } URB_STATUS_GET, *pURB_STATUS_GET; + + +/* + * URB_ADDRESS_GET_SET + * + * NOTE: Same URB is used for USBD_FNC_ADDRESS_GET and USBD_FNC_ADDRESS_SET. + */ + +typedef struct urb_address_get_set + { + URB_HEADER header; /* URB header */ + USBD_NODE_ID nodeId; /* IN Node Id of device/hub */ + UINT16 deviceAddress; /* I/O device address */ + } URB_ADDRESS_GET_SET, *pURB_ADDRESS_GET_SET; + + +/* + * URB_VENDOR_SPECIFIC + */ + +typedef struct urb_vendor_specific + { + URB_HEADER header; /* URB header */ + USBD_NODE_ID nodeId; /* IN Node Id of device/hub */ + UINT8 requestType; /* IN bmRequestType in USB spec. */ + UINT8 request; /* IN bRequest in USB spec. */ + UINT16 value; /* IN wValue in USB spec. */ + UINT16 index; /* IN wIndex in USB spec. */ + UINT16 length; /* IN wLength in USB spec. */ + pUINT8 pBfr; /* IN ptr to data buffer */ + UINT16 actLen; /* OUT actual length transferred */ + } URB_VENDOR_SPECIFIC, *pURB_VENDOR_SPECIFIC; + + +/* + * URB_PIPE_CREATE + */ + +typedef struct urb_pipe_create + { + URB_HEADER header; /* URB header */ + USBD_NODE_ID nodeId; /* IN Node Id of device/hub */ + UINT16 endpoint; /* IN Endpoint number */ + UINT16 configuration; /* IN config w/which pipe associated */ + UINT16 interface; /* IN interface w/which pipe associated */ + UINT16 transferType; /* IN Type of transfer: control, bulk, etc. */ + UINT16 direction; /* IN Specifies IN or OUT endpoint */ + UINT16 maxPayload; /* IN Maximum data payload per packet */ + UINT32 bandwidth; /* IN Bandwidth required for pipe */ + UINT16 serviceInterval; /* IN Required service interval */ + USBD_PIPE_HANDLE pipeHandle;/* OUT pipe handle returned by USBD */ + } URB_PIPE_CREATE, *pURB_PIPE_CREATE; + + +/* + * URB_PIPE_DESTROY + */ + +typedef struct urb_pipe_destroy + { + URB_HEADER header; /* URB header */ + USBD_PIPE_HANDLE pipeHandle;/* IN handle returned by usbdPipeCreate */ + } URB_PIPE_DESTROY, *pURB_PIPE_DESTROY; + + +/* + * URB_TRANSFER + */ + +typedef struct urb_transfer + { + URB_HEADER header; /* URB header */ + USBD_PIPE_HANDLE pipeHandle;/* IN Pipe handle */ + pUSB_IRP pIrp; /* IN ptr to I/O request packet */ + } URB_TRANSFER, *pURB_TRANSFER; + + +/* + * URB_SYNCH_FRAME_GET + */ + +typedef struct urb_synch_frame_get + { + URB_HEADER header; /* URB header */ + USBD_NODE_ID nodeId; /* IN Node Id of device/hub */ + UINT16 endpoint; /* IN Endpoint to be queried */ + UINT16 frameNo; /* OUT Frame number returned by device */ + } URB_SYNCH_FRAME_GET, *pURB_SYNCH_FRAME_GET; + + +/* + * URB_CURRENT_FRAME_GET + */ + +typedef struct urb_current_frame_get + { + URB_HEADER header; /* URB header */ + USBD_NODE_ID nodeId; /* IN Node Id of a device on desired USB */ + UINT32 frameNo; /* OUT Current frame number for USB */ + UINT32 frameWindow; /* OUT Frame scheduling window */ + } URB_CURRENT_FRAME_GET, *pURB_CURRENT_FRAME_GET; + + +/* + * URB_SOF_MASTER + */ + +typedef struct urb_sof_master + { + URB_HEADER header; /* URB header */ + USBD_NODE_ID nodeId; /* IN node ID of a device on desired USB */ + } URB_SOF_MASTER, *pURB_SOF_MASTER; + + +/* + * URB_SOF_INTERVAL_GET_SET + */ + +typedef struct urb_sof_interval_get_set + { + URB_HEADER header; /* URB header */ + USBD_NODE_ID nodeId; /* IN node ID of a device on desired USB */ + UINT16 sofInterval; /* I/O SOF interval in bit times */ + } URB_SOF_INTERVAL_GET_SET, *pURB_SOF_INTERVAL_GET_SET; + + +/* + * URB_VERSION_GET + */ + +typedef struct urb_version_get + { + URB_HEADER header; /* URB header */ + UINT16 version; /* OUT USBD version in BCD */ + UINT8 mfg [USBD_NAME_LEN+1];/* OUT USBD manufacturer name */ + } URB_VERSION_GET, *pURB_VERSION_GET; + + +/* + * URB_HCD_ATTACH + */ + +typedef struct urb_hcd_attach + { + URB_HEADER header; /* URB header */ + HCD_EXEC_FUNC hcdExecFunc; /* IN HCD primary entry point */ + pVOID param; /* IN HCD-specific parameter */ + GENERIC_HANDLE attachToken; /* OUT attach token */ + } URB_HCD_ATTACH, *pURB_HCD_ATTACH; + + +/* + * URB_HCD_DETACH + */ + +typedef struct urb_hcd_detach + { + URB_HEADER header; /* URB header */ + GENERIC_HANDLE attachToken; /* IN attach token */ + } URB_HCD_DETACH, *pURB_HCD_DETACH; + + +/* + * URB_STATISTICS_GET + */ + +typedef struct urb_statistics_get + { + URB_HEADER header; /* URB header */ + USBD_NODE_ID nodeId; /* IN Node Id of a node on desired USB */ + pUSBD_STATS pStatistics; /* IN Ptr to structure to receive stats */ + UINT16 statLen; /* IN Len of stats bfr provided by caller */ + } URB_STATISTICS_GET, *pURB_STATISTICS_GET; + + +/* function prototypes */ + +STATUS usbdCoreEntry + ( + pURB_HEADER pUrb /* URB to be executed */ + ); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbdCoreLibh */ + + +/* End of file. */ + diff --git a/h/usb/usbdLib.h b/h/usb/usbdLib.h new file mode 100644 index 0000000..6d602ba --- /dev/null +++ b/h/usb/usbdLib.h @@ -0,0 +1,506 @@ +/* usbdLib.h - USBD functional interface definition */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01h,18sep01,wef merge from wrs.tor2_0.usb1_1-f for veloce +01g,07may01,wef changed module number to be (module sub num << 8) | + M_usbHostLib +01f,02may01,wef changed module number to be M_ + M_usbHostLib +01e,05dec00,wef moved Module number defs to vwModNum.h - add this + to #includes +01d,26jan00,rcb Redefine parameter to usbdPipeCreate() as UINT32. +01c,29nov99,rcb Increase frame number fields to 32-bits in + usbdCurrentFrameGet(). +01b,07sep99,rcb Add management callbacks and set-bus-state API. +01a,07may99,rcb First. +*/ + +/* +DESCRIPTION + +Defines the USBD functional interface. Functions are provided to invoke +each of the underlying USBD URBs (request blocks). +*/ + +#ifndef __INCusbdLibh +#define __INCusbdLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include "usb/usbHandleLib.h" /* handle utility funcs */ +#include "usb/usb.h" /* Basic USB definitions */ +#include "drv/usb/usbHcd.h" /* USB HCD interface definitions */ +#include "vwModNum.h" /* USB Module number def's */ + +/* defines */ + +/* USBD Results - URB_HEADER.Result */ + +/* + * USB errnos are defined as being part of the USB host Module, as are all + * vxWorks module numbers, but the USB Module number is further divided into + * sub-modules. Each sub-module has upto 255 values for its own error codes + */ + +#define USB_USBD_SUB_MODULE 5 + +#define M_usbdLib ( (USB_USBD_SUB_MODULE << 8) | M_usbHostLib ) + +#define usbdErr(x) (M_usbdLib | (x)) + +#define S_usbdLib_BAD_CLIENT usbdErr(1) +#define S_usbdLib_BAD_PARAM usbdErr(2) +#define S_usbdLib_BAD_HANDLE usbdErr(3) +#define S_usbdLib_OUT_OF_MEMORY usbdErr(4) +#define S_usbdLib_OUT_OF_RESOURCES usbdErr(5) +#define S_usbdLib_NOT_IMPLEMENTED usbdErr(6) +#define S_usbdLib_GENERAL_FAULT usbdErr(7) +#define S_usbdLib_NOT_INITIALIZED usbdErr(8) +#define S_usbdLib_INTERNAL_FAULT usbdErr(9) +#define S_usbdLib_TIMEOUT usbdErr(10) +#define S_usbdLib_HCD_FAULT usbdErr(11) +#define S_usbdLib_IO_FAULT usbdErr(12) +#define S_usbdLib_NOT_HUB usbdErr(13) +#define S_usbdLib_CANNOT_CANCEL usbdErr(14) +#define S_usbdLib_BANDWIDTH_FAULT usbdErr(15) +#define S_usbdLib_POWER_FAULT usbdErr(16) +#define S_usbdLib_SOF_MASTER_FAULT usbdErr(17) + + +/* String length definitions */ + +#define USBD_NAME_LEN 32 /* Maximum length for name */ + + +/* management events */ + +#define USBD_MNGMT_RESUME 1 /* remote wakeup/resume */ + + +/* bus states - see usbdBusStateSet() */ + +#define USBD_BUS_SUSPEND 0x0001 /* suspend bus */ +#define USBD_BUS_RESUME 0x0002 /* resume bus */ + + +/* USBD_NOTIFY_ALL pertains to dynamic attach/removal notification */ + +#define USBD_NOTIFY_ALL 0xffff + +#define USBD_DYNA_ATTACH 0 +#define USBD_DYNA_REMOVE 1 + + +/* typedefs */ + +/* Handles and callbacks. */ + +typedef GENERIC_HANDLE USBD_CLIENT_HANDLE, *pUSBD_CLIENT_HANDLE; +typedef GENERIC_HANDLE USBD_NODE_ID, *pUSBD_NODE_ID; +typedef GENERIC_HANDLE USBD_PIPE_HANDLE, *pUSBD_PIPE_HANDLE; + +typedef VOID (*URB_CALLBACK) (pVOID pUrb); + +typedef VOID (*USBD_ATTACH_CALLBACK) + ( + USBD_NODE_ID nodeId, + UINT16 attachAction, + UINT16 configuration, + UINT16 interface, + UINT16 deviceClass, + UINT16 deviceSubClass, + UINT16 deviceProtocol + ); + +typedef VOID (*USBD_MNGMT_CALLBACK) + ( + pVOID callbackParam, + USBD_NODE_ID nodeId, + UINT16 mngmtCode + ); + + +/* + * USBD_NODE_INFO + */ + +typedef struct usbd_node_info + { + UINT16 nodeType; /* Type of node */ + UINT16 nodeSpeed; /* Speed of node, e.g., 12MBit, 1.5MBit */ + USBD_NODE_ID parentHubId; /* Node Id of hub to which node is connected */ + UINT16 parentHubPort; /* Port on parent hub to which connected */ + USBD_NODE_ID rootId; /* Node Id of root for USB to which connected */ + } USBD_NODE_INFO, *pUSBD_NODE_INFO; + + +/* + * USBD_STATS + */ + +typedef struct usbd_stats + { + UINT16 totalTransfersIn; /* Total # of inbound transfers */ + UINT16 totalTransfersOut; /* Total # of outbound transfers */ + UINT16 totalReceiveErrors; /* Errors on inbound traffic */ + UINT16 totalTransmitErrors; /* Errors on transmit */ + } USBD_STATS, *pUSBD_STATS; + + +/* function prototypes */ + +STATUS usbdInitialize (void); + + +STATUS usbdShutdown (void); + + +STATUS usbdClientRegister + ( + pCHAR pClientName, /* Client name */ + pUSBD_CLIENT_HANDLE pClientHandle /* Client hdl returned by USBD */ + ); + + +STATUS usbdClientUnregister + ( + USBD_CLIENT_HANDLE clientHandle /* Client handle */ + ); + + +STATUS usbdMngmtCallbackSet + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_MNGMT_CALLBACK mngmtCallback, /* management callback */ + pVOID mngmtCallbackParam /* client-defined parameter */ + ); + + +STATUS usbdBusStateSet + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_NODE_ID nodeId, /* node ID */ + UINT16 busState /* new bus state: USBD_BUS_xxxx */ + ); + + +STATUS usbdBusCountGet + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + pUINT16 pBusCount /* Word bfr to receive bus count */ + ); + + +STATUS usbdRootNodeIdGet + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + UINT16 busIndex, /* Bus index */ + pUSBD_NODE_ID pRootId /* bfr to receive Root Id */ + ); + + +STATUS usbdHubPortCountGet + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_NODE_ID hubId, /* Node Id for desired hub */ + pUINT16 pPortCount /* UINT16 bfr to receive port count */ + ); + + +STATUS usbdNodeIdGet + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_NODE_ID hubId, /* Node Id for desired hub */ + UINT16 portIndex, /* Port index */ + pUINT16 pNodeType, /* bfr to receive node type */ + pUSBD_NODE_ID pNodeId /* bfr to receive Node Id */ + ); + + +STATUS usbdNodeInfoGet + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_NODE_ID nodeId, /* Node Id of device/hub */ + pUSBD_NODE_INFO pNodeInfo, /* Structure to receive node info */ + UINT16 infoLen /* Len of bfr allocated by client */ + ); + + +STATUS usbdDynamicAttachRegister + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + UINT16 deviceClass, /* USB class code */ + UINT16 deviceSubClass, /* USB sub-class code */ + UINT16 deviceProtocol, /* USB device protocol */ + USBD_ATTACH_CALLBACK attachCallback /* User-supplied callback routine */ + ); + + +STATUS usbdDynamicAttachUnRegister + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + UINT16 deviceClass, /* USB class code */ + UINT16 deviceSubClass, /* USB sub-class code */ + UINT16 deviceProtocol, /* USB device protocol */ + USBD_ATTACH_CALLBACK attachCallback /* User-supplied callback routine */ + ); + + +STATUS usbdFeatureClear + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_NODE_ID nodeId, /* Node Id of device/hub */ + UINT16 requestType, /* Selects request type */ + UINT16 feature, /* Feature selector */ + UINT16 index /* Interface/endpoint index */ + ); + + +STATUS usbdFeatureSet + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_NODE_ID nodeId, /* Node Id of device/hub */ + UINT16 requestType, /* Selects request type */ + UINT16 feature, /* Feature selector */ + UINT16 index /* Interface/endpoint index */ + ); + + +STATUS usbdConfigurationGet + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_NODE_ID nodeId, /* Node Id of device/hub */ + pUINT16 pConfiguration /* bfr to receive config value */ + ); + + +STATUS usbdConfigurationSet + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_NODE_ID nodeId, /* Node Id of device/hub */ + UINT16 configuration, /* New configuration to be set */ + UINT16 maxPower /* max power this config will draw */ + ); + + +STATUS usbdDescriptorGet + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_NODE_ID nodeId, /* Node Id of device/hub */ + UINT8 requestType, /* specifies type of request */ + UINT8 descriptorType, /* Type of descriptor */ + UINT8 descriptorIndex, /* Index of descriptor */ + UINT16 languageId, /* Language ID */ + UINT16 bfrLen, /* Max length of data to be returned */ + pUINT8 pBfr, /* Pointer to bfr to receive data */ + pUINT16 pActLen /* bfr to receive actual length */ + ); + + +STATUS usbdDescriptorSet + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_NODE_ID nodeId, /* Node Id of device/hub */ + UINT8 requestType, /* selects request type */ + UINT8 descriptorType, /* Type of descriptor */ + UINT8 descriptorIndex, /* Index of descriptor */ + UINT16 languageId, /* Language ID */ + UINT16 bfrLen, /* Max length of data to be returned */ + pUINT8 pBfr /* Pointer to bfr to receive data */ + ); + + +STATUS usbdInterfaceGet + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_NODE_ID nodeId, /* Node Id of device/hub */ + UINT16 interfaceIndex, /* Index of interface */ + pUINT16 pAlternateSetting /* Current alternate setting */ + ); + + +STATUS usbdInterfaceSet + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_NODE_ID nodeId, /* Node Id of device/hub */ + UINT16 interfaceIndex, /* Index of interface */ + UINT16 alternateSetting /* Alternate setting */ + ); + + +STATUS usbdStatusGet + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_NODE_ID nodeId, /* Node Id of device/hub */ + UINT16 requestType, /* Selects device/interface/endpoint */ + UINT16 index, /* Interface/endpoint index */ + UINT16 bfrLen, /* length of bfr */ + pUINT8 pBfr, /* bfr to receive status */ + pUINT16 pActLen /* bfr to receive act len xfr'd */ + ); + + +STATUS usbdAddressGet + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_NODE_ID nodeId, /* Node Id of device/hub */ + pUINT16 pDeviceAddress /* Currently assigned device address */ + ); + + +STATUS usbdAddressSet + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_NODE_ID nodeId, /* Node Id of device/hub */ + UINT16 deviceAddress /* New device address */ + ); + + +STATUS usbdVendorSpecific + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_NODE_ID nodeId, /* Node Id of device/hub */ + UINT8 requestType, /* bmRequestType in USB spec. */ + UINT8 request, /* bRequest in USB spec. */ + UINT16 value, /* wValue in USB spec. */ + UINT16 index, /* wIndex in USB spec. */ + UINT16 length, /* wLength in USB spec. */ + pUINT8 pBfr, /* ptr to data buffer */ + pUINT16 pActLen /* actual length of IN */ + ); + + +STATUS usbdPipeCreate + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_NODE_ID nodeId, /* Node Id of device/hub */ + UINT16 endpoint, /* Endpoint number */ + UINT16 configuration, /* config w/which pipe associated */ + UINT16 interface, /* interface w/which pipe associated */ + UINT16 transferType, /* Type of transfer: control, bulk... */ + UINT16 direction, /* Specifies IN or OUT endpoint */ + UINT16 maxPayload, /* Maximum data payload per packet */ + UINT32 bandwidth, /* Bandwidth required for pipe */ + UINT16 serviceInterval, /* Required service interval */ + pUSBD_PIPE_HANDLE pPipeHandle /* pipe handle returned by USBD */ + ); + + +STATUS usbdPipeDestroy + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_PIPE_HANDLE pipeHandle /* pipe handle */ + ); + + +STATUS usbdTransfer + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_PIPE_HANDLE pipeHandle, /* Pipe handle */ + pUSB_IRP pIrp /* ptr to I/O request packet */ + ); + + +STATUS usbdTransferAbort + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_PIPE_HANDLE pipeHandle, /* Pipe handle */ + pUSB_IRP pIrp /* ptr to I/O to abort */ + ); + + +STATUS usbdSynchFrameGet + ( + USBD_CLIENT_HANDLE clientHandle, /* Client Handle */ + USBD_NODE_ID nodeId, /* Node Id of device/hub */ + UINT16 endpoint, /* Endpoint to be queried */ + pUINT16 pFrameNo /* Frame number returned by device */ + ); + + +STATUS usbdCurrentFrameGet + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_NODE_ID nodeId, /* Node Id of root for desired USB */ + pUINT32 pFrameNo, /* bfr to receive current frame no. */ + pUINT32 pFrameWindow /* bfr to receive frame window */ + ); + + +STATUS usbdSofMasterTake + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_NODE_ID nodeId /* Node Id of node on desired USB */ + ); + + +STATUS usbdSofMasterRelease + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_NODE_ID nodeId /* Node Id of node on desired USB */ + ); + + +STATUS usbdSofIntervalGet + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_NODE_ID nodeId, /* Node Id of node on desired USB */ + pUINT16 pSofInterval /* bfr to receive SOF interval */ + ); + + +STATUS usbdSofIntervalSet + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_NODE_ID nodeId, /* Node Id of node on desired USB */ + UINT16 sofInterval /* new SOF interval */ + ); + + +STATUS usbdVersionGet + ( + pUINT16 pVersion, /* UINT16 bfr to receive version */ + pCHAR pMfg /* bfr to receive USBD mfg string */ + ); + + +STATUS usbdHcdAttach + ( + HCD_EXEC_FUNC hcdExecFunc, /* Ptr to HCD’s primary entry point */ + pVOID param, /* HCD-specific parameter */ + pGENERIC_HANDLE pAttachToken /* Token to identify HCD in future */ + ); + + +STATUS usbdHcdDetach + ( + GENERIC_HANDLE attachToken /* AttachToken returned */ + ); + + +STATUS usbdStatisticsGet + ( + USBD_CLIENT_HANDLE clientHandle, /* Client handle */ + USBD_NODE_ID nodeId, /* Node Id of a node on desired USB */ + pUSBD_STATS pStatistics, /* Ptr to structure to receive stats */ + UINT16 statLen /* Len of bfr provided by caller */ + ); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbdLibh */ + + +/* End of file. */ + diff --git a/h/usb/usbdStructures.h b/h/usb/usbdStructures.h new file mode 100644 index 0000000..db732b4 --- /dev/null +++ b/h/usb/usbdStructures.h @@ -0,0 +1,313 @@ +/* usbdStructures.h - USBD control structures */ + +/* Copyright 2000-2002 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01f,08nov11,wef change definition of hubStatus to be pHubStatus +01e,20mar00,rcb Add USB_DEV_DESCR field to USBD_NODE. +01d,26jan00,rcb Redefine "bandwidth" field in USBD_PIPE as UINT32. +01c,23nov99,rcb Add support for HCD_PIPE_HANDLE. +01b,07sep99,rcb Add support for management callbacks. +01a,08jun99,rcb First. +*/ + +/* +DESCRIPTION + +This file defines structures & constants used by the USBD to manage USB +buses attached to the system. +*/ + +#ifndef __INCusbdStructuresh +#define __INCusbdStructuresh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include "usb/ossLib.h" +#include "usb/usbHandleLib.h" +#include "usb/usbListLib.h" +#include "usb/usb.h" +#include "drv/usb/usbHcd.h" + +/* defines */ + +/* signatures used to validate handles - values are arbitrary */ + +#define USBD_CLIENT_SIG ((UINT32) 0x00bd000c) +#define USBD_HCD_SIG ((UINT32) 0x00bd00cd) +#define USBD_NODE_SIG ((UINT32) 0x00bd00de) +#define USBD_PIPE_SIG ((UINT32) 0x00bd000e) + + +/* defines related to hubs */ + +/* MAX_HUB_STATUS_LEN is the maximum length of data which can be + * returned when querying a hub's status endpoint. The status + * has one bit per port plus one bit for the hub itself. The length + * of the array is rounded up to the next whole byte. + */ + +#define MAX_HUB_STATUS_LEN ((USB_MAX_DEVICES + 1 + 7) / 8) + + +/* USB_DEV_VECTOR_LEN is the length of an array of bytes which can + * hold one bit for each USB device. + */ + +#define USB_DEV_VECTOR_LEN ((USB_MAX_DEVICES + 7) / 8) + + +/* typedefs */ + +/* + * USBD_NOTIFY_REQ + * + * Each time a client registers for dynamic attach/removal notification, + * a USBD_NOTIFY_REQ structure is linked to the client's USBD_CLIENT struct. + * + * A value of USBD_NOTIFY_ALL in deviceClass, deviceSubclass, or devicePgmIf + * will match any value reported by the device. + */ + +typedef struct usbd_notify_req + { + LINK reqLink; /* linked list of registrations */ + UINT16 deviceClass; /* desired device class */ + UINT16 deviceSubClass; /* desired device sub-class */ + UINT16 deviceProtocol; /* desired protocol */ + USBD_ATTACH_CALLBACK callback; /* client's callback routine */ + } USBD_NOTIFY_REQ, *pUSBD_NOTIFY_REQ; + + +/* + * USBD_NODE_CLASS + * + * Each device exposes one or more class/subclass/pgmif types. Some + * devices expose only one type through the device descriptor. Others + * expose many types, one through each interface descriptor. + */ + +typedef struct usbd_node_class + { + LINK classLink; /* linked list of class types */ + UINT16 configuration; /* corresponding configuration (or 0) */ + UINT16 interface; /* corresponding interface (or 0) */ + UINT16 deviceClass; /* device class */ + UINT16 deviceSubClass; /* device subclass */ + UINT16 deviceProtocol; /* device protocol */ + } USBD_NODE_CLASS, *pUSBD_NODE_CLASS; + + +/* + * USBD_PIPE + * + * Each open channel of communication between the host and an endpoint on a + * device/hub is termed a "pipe". USBD_PIPE maintains all currently available + * information for each open pipe. + * + * NOTE: By convention, the USBD uses the usbdLink field in each USB_IRP + * structure to point back to the USBD_PIPE with which the IPR is associated. + */ + +typedef struct usbd_pipe + { + USBD_PIPE_HANDLE handle; /* handled assigned to pipe by USBD */ + HCD_PIPE_HANDLE hcdHandle; /* handled assigned to pipe by HCD */ + + struct usbd_client *pClient; /* pointer to client owning this pipe */ + + BOOL pipeDeletePending; /* TRUE when pipe being deleted. */ + + struct usbd_node *pNode; /* node to which pipe is addressed */ + UINT16 endpoint; /* endpoint address */ + UINT16 configuration; /* config w/which pipe associated */ + UINT16 interface; /* interface w/which pipe associated */ + UINT16 transferType; /* type of pipe */ + UINT16 direction; /* direction of pipe */ + UINT16 maxPacketSize; /* max packet size */ + UINT32 bandwidth; /* bandwidth used by pipe (bytes/sec) */ + UINT16 interval; /* service interval (intrp pipes) */ + UINT16 dataToggle; /* current DATA0/DATA1 toggle */ + + UINT32 nanoseconds; /* bandwidth required if pipe is */ + /* isochronous or interrupt, else 0 */ + + LINK clientPipeLink; /* link on list of client's pipes */ + LINK nodePipeLink; /* link on list of node's pipes */ + + LIST_HEAD irps; /* list of IRPs on this pipe */ + + pUSB_IRP irpBeingDeleted; /* used to synchronize IRP deletion */ + BOOL irpDeleted; /* " " " " " */ + + } USBD_PIPE, *pUSBD_PIPE; + + +/* + * USBD_CLIENT + * + * Each client registered with the USBD is tracked by a USBD_CLIENT structure. + */ + +typedef struct usbd_client + { + LINK clientLink; /* client linked list */ + + USBD_CLIENT_HANDLE handle; /* handle assigned to client */ + + USBD_MNGMT_CALLBACK mngmtCallback; /* client's mngmt callback */ + pVOID mngmtCallbackParam; /* client-define parameter */ + + THREAD_HANDLE callbackThread; /* thread used for client callbacks */ + QUEUE_HANDLE callbackQueue; /* queue of callback requests */ + SEM_HANDLE callbackExit; /* signalled when callback thrd exits */ + + LIST_HEAD pipes; /* list of pipes owned by client */ + + LIST_HEAD notifyReqs; /* list of dynamic attach requests */ + + char clientName [USBD_NAME_LEN+1]; /* client's text name */ + + } USBD_CLIENT, *pUSBD_CLIENT; + + +/* + * USBD_PORT + * + * USB hubs have one or more ports to which additional USB devices/hubs + * may be attached. The USBD_PORT structure maintains all currently available + * inforamtion for each port on a hub. + */ + +typedef struct usbd_port + { + struct usbd_node *pNode; /* node attached to port */ + } USBD_PORT, *pUSBD_PORT; + + +/* + * USBD_NODE + * + * Each device or hub attached to the USB is termed a "node" by the USBD. + * The USBD_NODE structure maintains all currently available information + * about a node. If the node is a hub, then space will be allocated for + * a ports[] array large enough to accomodate each port on the hub. + */ + +typedef struct usbd_node + { + USBD_NODE_ID nodeHandle; /* handle assigned to node */ + USBD_NODE_INFO nodeInfo; /* Current node information */ + struct usbd_bus *pBus; /* pointer to parent bus */ + UINT16 busAddress; /* USB bus address for dev/hub */ + UINT16 topologyDepth; /* number of cable hops from root */ + UINT16 maxPower; /* power draw for selected config */ + + USB_DEVICE_DESCR devDescr; /* Device descriptor */ + LIST_HEAD classTypes; /* list of device class types */ + + BOOL nodeDeletePending; /* TRUE when node being deleted */ + + /* NOTE: The following fields are used during control pipe transfers to + * this node. controlSem is used to ensure that only one control pipe + * request is active for each device at any given time. + */ + + USBD_PIPE_HANDLE controlPipe; /* control pipe handle */ + SEM_HANDLE controlSem; /* only one outstanding request */ + /* to control pipe at a time */ + pUSBD_CLIENT pClient; /* client invoking the control URB */ + pURB_HEADER pUrb; /* Ptr to pending control xfr URB */ + pUINT16 pActLen; /* Ptr to bfr to receive IN actlen */ + + USB_SETUP setup; /* control pipe Setup packet */ + USB_IRP irp; /* irp to describe control transfer */ + USB_BFR_LIST extra [2]; /* irp includes room for a single */ + /* USB_BFR_LIST. We need room for 3 */ + /* so we allocate an extra here */ + + LIST_HEAD pipes; /* list of pipes addressed to node */ + + /* NOTE: The following fields are used only for hub nodes. */ + + UINT16 pwrGoodDelay; /* power-ON to power good delay */ + UINT16 hubContrCurrent; /* hub controller power requirements */ + BOOL selfPowered; /* TRUE if hub/port is self powered */ + UINT16 maxPowerPerPort; /* max power port can provide */ + + USBD_PIPE_HANDLE hubStatusPipe; /* status pipe handle */ + USB_IRP hubIrp; /* IRP used to monitor hub status */ + UINT16 numPorts; /* number of ports, used for hubs */ + pUSBD_PORT pPorts; /* Array of ports, used for hubs */ + UINT8 * pHubStatus; /* receives hub status */ + + } USBD_NODE, *pUSBD_NODE; + + +/* + * USBD_BUS + * + * Each HCD attached to the USBD may control one or more bus. The USBD_BUS + * structure contains all information for a given bus. + */ + +typedef struct usbd_bus + { + struct usbd_hcd *pHcd; /* pointer to parent HCD */ + UINT16 busNo; /* this bus's index with HCD */ + + pUSBD_NODE pRoot; /* root node for this bus */ + + THREAD_HANDLE busThread; /* thread to monitor bus events */ + QUEUE_HANDLE busQueue; /* queue to receive bus events */ + SEM_HANDLE busExit; /* signallen when bus thd exits */ + + UINT32 nanoseconds; /* bus bandwidth in use for */ + /* isochronous and interrupt pipes */ + + pUSBD_CLIENT pSofMasterClient; /* client which is SOF master or NULL */ + + USBD_STATS stats; /* bus operating statistics */ + + UINT8 adrsVec [USB_MAX_DEVICES]; /* USB addresses in use */ + + BOOL suspended; /* TRUE if bus currently SUSPENDed */ + + } USBD_BUS, *pUSBD_BUS; + + +/* + * USBD_HCD + * + * The USBD maintains a list of currently attached HCDs. Each HCD may control + * one or more buses. + */ + +typedef struct usbd_hcd + { + LINK hcdLink; /* linked list of HCDs */ + + GENERIC_HANDLE attachToken; /* Attach token returned for this HCD */ + HCD_NEXUS nexus; /* identifies connection to HCD */ + + UINT16 busCount; /* number of buses managed by HCD */ + pUSBD_BUS pBuses; /* buses managed by HCD */ + } USBD_HCD, *pUSBD_HCD; + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbdStructuresh */ + + +/* End of file. */ + diff --git a/h/usb2/BusAbstractionLayer.h b/h/usb2/BusAbstractionLayer.h new file mode 100644 index 0000000..d78c766 --- /dev/null +++ b/h/usb2/BusAbstractionLayer.h @@ -0,0 +1,329 @@ +/* usbBusAbstractionLayer.h - USB Bus Abstraction Layer Definitions */ + +/* Copyright 2004 - 2005 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +Modification history +-------------------- +01d,02mar05,ami Macros for Maximum Host Controllers removed +01c,22Jul03,gpd usage of a common bus abstraction layer file for all platforms +01b,08jul03,nld Changes to make use of usbPci... calls +01a,17mar03,ssh written +*/ + +/* +DESCRIPTION + +This file contains the definitions to access the HCD Controllers on the PCI Bus. +*/ + +/* +INTERNAL + ******************************************************************************* + * Filename : BusAbstractionLayer.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : This file contains functions to access the OHCI Controller + * on the PCI Bus. + * + * FIX ME : None. + * + * TO DO : None. + * + ******************************************************************************/ + +#ifndef __INCusbBusAbstractionLayerh +#define __INCusbBusAbstractionLayerh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +/* + * This file is a VxWorks BSP specific file. + * + * This file is included for obtaining the platform specific information. + * For example on a pcPentium environment, there is a difference in interrupt + * allocation. This file will be used to obtain such information. + */ +#include "drv/pci/pciConfigLib.h" +#include "drv/pci/pciIntLib.h" +#include "vmLib.h" +#include "cacheLib.h" +#include "usb/usbPlatform.h" +#include "usb/usbPciLib.h" + + +/* defines */ + +/* + * Offset of the class code register. + * + * NOTE: The offset of the class code register is 0x09. The class code + * information is stored at locations 0x09, 0x0A and 0x0B. + * + * In order to reduce the number of read operations, the following + * logic is used. + * + * a) Read the data (UINT32) from offset 0x08 (instead of 0x09) + * b) Shift the data read by 8 bits to the right. + * + * If an offset of 0x09 is passed to the READ_BUS_LONG() function, it + * will return an error (since the offset is not aligned to word [32 + * bit] boundary). + */ +#define CLASS_CODE_REGISTER_OFFSET 0x08 + +/* To hold the offset of the base address register */ +#define BASE_ADDRESS_REGISTER_OFFSET 0x10 + +/* To hold the class code for UHCI Complaint USB Host Controllers */ +#define USB_UHCI_HOST_CONTROLLER 0x000C0300 + +/* To hold the class code for OHCI Complaint USB Host Controllers */ +#define USB_OHCI_HOST_CONTROLLER 0x000C0310 + +/* To hold the class code for EHCI Complaint USB Host Controllers */ +#define USB_EHCI_HOST_CONTROLLER 0x000C0320 + +/* + * Specifies the maximum number of USB controllers supported. + * + * NOTE: This is a configurable parameter. Based on the requirement, this + * can be changed. + */ + +/************* MACROS TO HOLD THE STATUS OF PCI FUNCTION CALLS ****************/ + +/* To specify the request completed successfully */ +#define BUS_OPERATION_SUCCESS OK + +/* To specify the request failed */ +#define BUS_OPERATION_FAILURE ERROR + +/* To hold the request status */ +#define BUS_OPERATION_STATUS STATUS + +/******************* MODULE SPECIFIC VARIABLES DEFINITION *********************/ +extern int usbPciIntEnable(UINT16); +extern int usbPciIntDisable(UINT16); + +/************************* GLOBAL MACRO DEFINITION ****************************/ + +/******************************************************************************* + * Macro Name : FIND_USB_CONTROLLER + * Description : This function is used to detect USB Controllers on the + * PCI Bus. This function will search for a device based + * on the PCI class code. If there are multiple devices with + * the same PCI class code, the device index is used to uniquely + * reference the devices. + * Parameters : nClassCode IN PCI class code for the device. + * nDeviceIndex IN Device Index for the device. + * pPCIBusNumber OUT PCI bus number corresponding to + * the bus on which the device is + * connected. + * pPCIDeviceNumber OUT PCI device number for the device. + * pPCIFunctionNumber OUT PCI function number for the device. + * Return Type : TRUE if USB controller is found, FALSE otherwise + ******************************************************************************/ +#define FIND_USB_CONTROLLER(nClassCode, \ + nDeviceIndex, \ + pPCIBusNumber, \ + pPCIDeviceNumber, \ + pPCIFunctionNumber) \ + \ + usbPciClassFind(((nClassCode >> 16) & 0x00FF), \ + ((nClassCode >> 8) & 0x0000FF), \ + (nClassCode & 0x000000FF), \ + nDeviceIndex, \ + (UINT8 *)pPCIBusNumber, \ + (UINT8 *)pPCIDeviceNumber, \ + (UINT8 *)pPCIFunctionNumber) + + + +/******************************************************************************* + * Macro Name : GET_CLASS_CODE + * Description : This function is used to obtain the class code of the + * USB Host Controller. + * Parameters : nPCIBusNumber IN Bus number corresponding to the device. + * nPCIDeviceNumber IN Device number corresponding to the + * device. + * nPCIFunctionNumber IN Function number corresponding to the + * device. + * pClassCodeBuffer OUT Pointer to the buffer which will + * hold the data read. + * Return Type : None + ******************************************************************************/ +#define GET_CLASS_CODE(nPCIBusNumber, \ + nPCIDeviceNumber, \ + nPCIFunctionNumber, \ + pClassCodeBuffer) \ + \ + READ_BUS_LONG(nPCIBusNumber, \ + nPCIDeviceNumber, \ + nPCIFunctionNumber, \ + CLASS_CODE_REGISTER_OFFSET, \ + pClassCodeBuffer) + + + +/******************************************************************************* + * Macro Name : REGISTER_INTERRUPT_HANDLER + * Description : This function is used to register the interrupt hander for + * the OHCI Coontroller. + * + * Attach the interrupt handler. The pciIntConnect() adds the + * interrupt handler for the specified IRQ. If multiple interrupt + * handlers are connected to the same interrupt number, this + * function creates a linked list. + * + * NOTE: Do not use the IRQ number directly. Different BSP have + * different mapping for the IRQ numbers to be actual + * IRQ. For example, on pcPentium IRQ0 is assigned interrupt + * number 0x20. Use the INT_VEC_GET() macro to obtain the + * interrupt number. + * + * Parameters : nIRQNumber IN IRQ number for the OHCI controller. + * pISR IN Pointer to the ISR function. + * nParameter IN Parameter to be passed to the ISR function. + * Return Type : OK if interrupt handler is registered successfully, ERROR + * otherwise + ******************************************************************************/ +#define REGISTER_INTERRUPT_HANDLER(nIRQNumber, \ + pISR, \ + nParameter) \ + \ + usbPciIntConnect( \ + (INT_HANDLER_PROTOTYPE)pISR, \ + (pVOID)nParameter, \ + (UINT16)nIRQNumber) + +/******************************************************************************* + * Macro Name : UNREGISTER_INTERRUPT_HANDLER + * Description : This function is used to unregister the interrupt handler + * for the OHCI Controller. + * + * NOTE: Do not use the IRQ number directly. Different BSP have + * different mapping for the IRQ numbers to be actual + * IRQ. For example, on pcPentium IRQ0 is assigned interrupt + * number 0x20. Use the INT_VEC_GET() macro to obtain the + * interrupt number. + * + * Parameters : nIRQNumber IN IRQ number for the OHCI controller. + * pISR IN Pointer to the ISR function. + * Return Type : None + ******************************************************************************/ +#define UNREGISTER_INTERRUPT_HANDLER(nIRQNumber, \ + pISR, \ + nParameter) \ + usbPciIntRestore( \ + (INT_HANDLER_PROTOTYPE)pISR, \ + (pVOID)nParameter, \ + (UINT16)nIRQNumber) + +/******************* MACROS TO ENABLE OR DISABLE INTERRUPTS *******************/ +/******************************************************************************* + * Function Name : DISABLE_BUS_INTERRUPT + * Description : Macro to disable the interrupts for the OHCI Controller. + * Parameters : nIRQNumber IN IRQ number for the OHCI controller. + * Return Type : None + ******************************************************************************/ +#define DISABLE_BUS_INTERRUPT(nIRQNumber) \ + usbPciIntDisable((nIRQNumber)) + + +/******************************************************************************* + * Function Name : ENABLE_BUS_INTERRUPT + * Description : Macro to enable the interrupts for the OHCI Controller. + * Parameters : nIRQNumber IN IRQ number for the OHCI controller. + * Return Type : None + ******************************************************************************/ + +#define ENABLE_BUS_INTERRUPT(nIRQNumber) \ + usbPciIntEnable(nIRQNumber) + +/******************** MODULE SPECIFIC MACRO DEFINITION ************************/ + +/******************************************************************************* + * Macro Name : READ_BUS_LONG + * Description : This function is used to read a long (32 bits) from the + * PCI configuration ROM. + * Parameters : nPCIBusNumber IN PCI bus number corresponding to the + * device. + * nPCIDeviceNumber IN PCI device number corresponding + * to the device. + * nPCIFunctionNumber IN PCI function number corresponding + * to the device. + * nOffset IN Offset into the configuration ROM + * from where the data should be read. + * pBuffer OUT Pointer to the buffer which will + * hold the data read. + * Return Type : None + ******************************************************************************/ +#define READ_BUS_LONG(nPCIBusNumber, \ + nPCIDeviceNumber, \ + nPCIFunctionNumber, \ + nOffset, \ + pBuffer) \ + \ + *(pBuffer) = usbPciDwordGet(nPCIBusNumber, \ + nPCIDeviceNumber, \ + nPCIFunctionNumber, \ + nOffset) + +/******************************************************************************* + * Macro Name : READ_BUS_BYTE + * Description : This function is used to read a byte (8 bits) from the + * PCI configuration ROM. + * Parameters : nPCIBusNumber IN PCI bus number corresponding to the + * device. + * nPCIDeviceNumber IN PCI device number corresponding + * to the device. + * nPCIFunctionNumber IN PCI function number corresponding + * to the device. + * nOffset IN Offset into the configuration ROM + * from where the data should be read. + * pBuffer OUT Pointer to the buffer which will + * hold the data read. + * Return Type : None + ******************************************************************************/ +#define READ_BUS_BYTE(nPCIBusNumber, \ + nPCIDeviceNumber, \ + nPCIFunctionNumber, \ + nOffset, \ + pBuffer) \ + *(pBuffer) = usbPciByteGet(nPCIBusNumber, \ + nPCIDeviceNumber, \ + nPCIFunctionNumber, \ + nOffset) + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbBusAbstractionLayerh */ + +/********************** End of File BusAbstractionLayer.h *********************/ + diff --git a/h/usb2/usbEhcdConfig.h b/h/usb2/usbEhcdConfig.h new file mode 100644 index 0000000..785d665 --- /dev/null +++ b/h/usb2/usbEhcdConfig.h @@ -0,0 +1,60 @@ +/* usbEhcdConfig.h - Utility Functions for EHCI */ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +DESCRIPTION +This contains the configuration parameters of the USB +EHCD. +*/ + +/* +INTERNAL + ******************************************************************************* + * Filename : usbEhcdConfig.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : This contains the configuration parameters of the USB + * EHCD. + * + ******************************************************************************/ +#ifndef __INCehcdConfigh +#define __INCehcdConfigh + +#ifdef __cplusplus +extern "C" { +#endif + +#define USB_EHCD_VENDOR_ID 0x1033 /* + * Vendor ID of the EHCI + * Host Controller + */ +#define USB_EHCD_DEVICE_ID 0x00E0 /* + * Device ID of the EHCI + * Host Controller + */ + +#ifdef __cplusplus +} +#endif + +#endif /* End of __INCehcdConfigh */ +/***************************** End of file usbEhcdConfig.h*********************/ diff --git a/h/usb2/usbEhcdDataStructures.h b/h/usb2/usbEhcdDataStructures.h new file mode 100644 index 0000000..ba2598a --- /dev/null +++ b/h/usb2/usbEhcdDataStructures.h @@ -0,0 +1,1064 @@ +/* EHCD_DataStructures.h - Data Structures for EHCI */ + +/* Copyright 2004 - 2005 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +modification history +-------------------- +01l,22apr05,pdg Fix for 64 bit split isochronous transfer +01k,28mar05,pdg non-PCI changes +01k,22mar05,mta SPR 104950 +01j,15feb05,pdg Added comments for 64 bit support +01i,04feb05,pdg Fix for SPR #104950(USB STACK 2.1 FROM PID 2.1 ISN'T + CORRECTLY SUPPORTING INTEL 82801DB/DBM EHCI HOST CONTROLLER) +01h,03dec04,ami Merged IP Changes +01g,05oct04,mta SPR100704- Removal of floating point math +01f,16aug04,pdg Fix for print-stop-reprint +01e,28Jul03,god Incorporated changes identified during integration testing. +01d,23Jul03,gpd Incorporated the changes after testing on MIPS. +01c,03Jul03,gpd Added separate reclamation lists of asynch and periodic lists. + Added new field for identifying the next element of isochronous + TD. +01b,26jun03,gpd changing the code to WRS standards. +01a,25apr02,ram written. +*/ + +/* +DESCRIPTION +This contains the data structures used by the EHCI Host Controller Driver. +*/ + +/* +INTERNAL + ******************************************************************************* + * Filename : EHCD_DataStructures.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : This contains the data structures used by the EHCI Host + * Controller Driver. + * + ******************************************************************************/ +#ifndef __EHCD_DATASTRUCTURES_H__ +#define __EHCD_DATASTRUCTURES_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "usb/pciConstants.h" + +#define USB_EHCD_MAX_FRAMELIST_SIZE 1024 /* Maximum size of the + frame list */ +#define USB_EHCD_FRAME_OFFSET 8 /* Offset for frame Index */ +#define USB_EHCD_MAX_MICROFRAME_NUMBER 8 /* Maximum microframe number*/ +#define USB_EHCD_MAX_FULL_SPEED_UFRAME 4 /* Maximum no. of microframe used + for split transaction. Means sum + of start and complete split */ +#define USB_EHCD_MAX_TREE_NODES 63 /* Maximum number of nodes + * in the interrupt tree + */ +#define USB_EHCD_MAX_LEAF_NODES 32 /* Maximum number of leaves + * available in the interrupt + * tree + */ +#define USB_EHCD_FIRST_LEAF_NODE_INDEX 31 /* Index of the first + * leaf node + */ +#define USB_EHCD_MAX_DELAY_INTERVAL 1000 /* Maximum interval for the + * Host Controller bit to be + * set or reset + */ +#define USB_EHCD_PAGE_SIZE 4096 /* Page size value */ +#define USB_EHCD_HC_DATA_STRUCTURE_ALIGNMENT 32 /* Alignment size of the data + * structures of the Host + * Controller + */ +#define USB_EHCD_64BIT_HC_DATA_STRUCTURE_ALIGNMENT 64 + /* Alignment size of */ + /* 64 bit SITD data */ + /* structure */ + + +#define USB_EHCD_RH_PORT_STATUS_SIZE 4 /* Size of the port status */ +#define USB_EHCD_PARENT_HUB_ADDRESS_MASK 0xFF00 /* To hold the parent + * hub address mask + */ +#define USB_EHCD_HUB_PORT_NUMBER_MASK 0x00FF /* Holds the hub port + * number mask + */ +#define USB_EHCD_INT_THREAD_PRIORITY 100 /* Priority of the interrupt + * handler thread + */ +#define USB_EHCD_NO_LIST -1 /* Value indicating the + * empty list + */ +#define USB_EHCD_RH_PORT_CONNECT_CHANGE 0x00010000 /* Port connect + * change mask + */ +/* Status bit fields of QTD - start */ + +#define USB_EHCD_QTD_STATUS_ACTIVE 0x80 /* Status indicating that + * the TD is active + */ +#define USB_EHCD_QTD_STATUS_HALTED 0x40 /* Halted bit mask in + * the status field + */ +#define USB_EHCD_QTD_STATUS_DATA_BUFFER_ERROR 0x20 /* Data buffer error bit + * mask in the status field + */ +#define USB_EHCD_QTD_STATUS_BABBLE_DETECTED 0x10 /* Babble detected bit mask + * in the status field + */ +#define USB_EHCD_QTD_STATUS_XACTERR 0x08 /* Transaction Error bit + * mask in the status field + */ +#define USB_EHCD_QTD_STATUS_MISSED_UFRAME 0x04 /* Missed microframe bit + * mask in the status + * field + */ +#define USB_EHCD_QTD_STATUS_SPLITXSTATE 0x02 /* SplitXState bit mask + * in the status field + */ +#define USB_EHCD_QTD_STATUS_PING_STATE 0x01 /* Ping State bit mask in + * the status field + */ +/* Status bit fields of QTD - End */ + +/* Status bit fields of the ITD - Start */ + +#define USB_EHCD_ITD_STATUS_ACTIVE 0x08/* ITD is active */ + +#define USB_EHCD_ITD_STATUS_BUFFER_ERROR 0x04/* Data buffer error */ + +#define USB_EHCD_ITD_STATUS_BABBLE_DETECTED 0x02/* Babble detected */ + +#define USB_EHCD_ITD_STATUS_XACTERR 0x01/* Transaction error */ + +/* Status bit fields of the ITD - End */ + + +/* Status bit fields of the SITD - Start */ + +#define USB_EHCD_SITD_STATUS_ACTIVE 0x80/* SITD is active */ + +#define USB_EHCD_SITD_STATUS_ERROR 0x40/* Response error */ + +#define USB_EHCD_SITD_STATUS_BUFFER_ERROR 0x20/* Data buffer error */ + +#define USB_EHCD_SITD_STATUS_BABBLE_DETECTED 0x10/* Babble detected */ + +#define USB_EHCD_SITD_STATUS_XACTERR 0x08/* Transaction error */ + +#define USB_EHCD_SITD_STATUS_MISSED_FRAME 0x04/* Frame missing */ + +/* Status bit fields of the SITD - End */ + +/* Type fields of the link pointer - Start */ +#define USB_EHCD_TYPE_ITD 0 /* Isochronous TD type */ +#define USB_EHCD_TYPE_QH 1 /* Queue Head Type */ +#define USB_EHCD_TYPE_SITD 2 /* Split isochronous TD type */ +#define USB_EHCD_TYPE_FSTN 3 /* FSTN(Frame Span Traversal Node) type */ +/* Type fields of the link pointer - End */ + +/* Transaction pointer value for SITD - Start */ +#define USB_EHCD_SITD_TP_ALL 0 /* Complete payload in one SITD */ +#define USB_EHCD_SITD_TP_BEGIN 1 /* Complete payload is more than 188 byte */ +#define USB_EHCD_SITD_TP_MID 2 /* Middle of Split isochronous TD */ +#define USB_EHCD_SITD_TP_END 3 /* End of Split isochronous TD */ +/* Transaction pointer value for SITD - End */ + +/* Terminate bit field values - Start */ +#define USB_EHCD_VALID_LINK 0 /* Valid link */ +#define USB_EHCD_INVALID_LINK 1 /* Invalid link */ +/* Terminate bit field values - End */ + +#define USB_EHCD_MAX_ERRORS 3 /* Maximum errors acceptable */ + +/* Values for the device speeds - End */ + +/* Data toggle carry values - Start */ +#define USB_EHCD_DTC_PRESERVE_IN_QH 0 /* The data toggle bit is + * preserved in the Queue Head + */ +#define USB_EHCD_DTC_RETRIEVE_FROM_QTD 1 /* The data toggle bit is + * retrieved from the QTD + */ +/* Data toggle carry values - End */ + +#define USB_EHCD_DEFAULT_MAX_PACKET_SIZE 64 /* Default maximum packet + * size value + */ +#define USB_EHCD_MAX_NAK_RATE 255 /* Maximum NAK rate for high + * speed control/bulk endpoints + */ +#define USB_EHCD_HOST_DELAY 5 /* Maximum host delay in + * nanoseconds + */ +#define USB_EHCD_HUB_LS_SETUP 333 /* Hub Low Speed setup time in + * nanoseconds- this value has + * to be checked + */ +#define USB_EHCD_DIR_IN 0x80 /* Value indicating IN + * direction + */ +#define USB_EHCD_DIR_BIT_POSITION 7 + +#define USB_EHCD_ENDPOINT_NUMBER_MASK 0x0F /* Mask value for the + * endpoint number + */ +#define USB_EHCD_BIT_STUFF_TIME(uByteCount) (7 * 8 * uByteCount/6) /* Bit + stuff time */ +#define USB_EHCD_ENDPOINT_TYPE_MASK 0x03 /* Mask value for the endpoint + * type + */ +#define USB_EHCD_ENDPOINT_MAX_PACKET_SIZE_MASK 0x7FF /* Mask value for the + * maximum packet size + */ +#define USB_EHCD_ENDPOINT_NUMBER_OF_TRANSACTIONS_MASK 0x1800 /* Mask value to + * retrieve the + * number of + * transactions + * in a + * microframe + */ +/* Size of the Root hub status information */ +#define USB_EHCD_HUBSTATUS_SIZE 4 +#define USB_EHCD_MAX_BW 125000 /* To hold the maximum + * bandwidth which can be + * accomodated + * 125 microsec = 125 * 1000 + * nanosec + */ +#define USB_EHCD_EIGHTY_PERCENT_BW 100000 /* To hold the 80 % bandwidth + * value in a microframe + */ +#define USB_EHCD_MAX_USB20_POLLING_INTERVAL 16 /* To hold the maximum polling + * interval supported + */ +/* Macros for split masks - start */ +#define USB_EHCD_SPLIT_MASK_1 0x1D /* Value of mask is 00011101 + * Start split in microframe 1 + * Complete splits in microframes + * 3,4, 5 + */ +#define USB_EHCD_SPLIT_MASK_2 0x3A /* Value of mask is 00111010 + * Start split in microframe 2 + * Complete splits in microframes + * 4,5, 6 + */ +#define USB_EHCD_SPLIT_MASK_3 0x74 /* Value of mask is 01110100 + * Start split in microframe 3 + * Complete splits in microframes + * 5, 6, 7 + */ +#define USB_EHCD_SPLIT_MASK_4 0xE8 /* Value of mask is 11101000 + * Start split in microframe 4 + * Complete splits in microframes + * 6, 7, 8 + */ +/* Macros for split masks - End */ + + +#define USB_EHCD_MAX_USB11_INTERRUPT_POLL_INTERVAL 32 /*Maximum polling + * interval which can + * be supported for + * USB 1.1 + * interrupt + * transfers + */ +#define USB_EHCD_MAX_INT_SPLIT_MASKS 4 /* Maximum number of + * masks defined for + * split interrupt + */ +#define USB_EHCD_MAX_DEVICE_ADDRESS 127 /* Maximum device + * address + */ + +/* PID values - Start */ +#define USB_EHCD_OUT_PID 0 /* OUT PID */ +#define USB_EHCD_IN_PID 1 /* IN PID */ +#define USB_EHCD_SETUP_PID 2 /* SETUP PID */ +/* PID values - End */ + +#define USB_EHCD_QTD_MAX_TRANSFER_SIZE 20480 /* Maximum size of data + * which can be + * transferred using + * a QTD + */ +#define USB_EHCD_SITD_MAX_SPLIT_SIZE 188 /* Maximum size for one split + Transaction */ +#define USB_EHCD_SITD_MAX_TRANSFER_SIZE 0x3FF /* Maximum size of data which + can be transferred using + a SITD is 1023 byte only*/ + +#define USB_EHCD_RH_MASK_VALUE 0x02 /* Mask value used for + * populating the + * interrupt status + * data + */ +#define USB_EHCD_INTERRUPT_ENABLE_MASK 0x17 /* Interrupt enable + * mask + */ + +#define USB_EHCD_QH_64BIT_ADDITIONAL_SIZE 20 /* + * 64 bit QH + * additional + * size + */ +#define USB_EHCD_QTD_64BIT_ADDITIONAL_SIZE 20 /* + * 64 bit QTD + * additional + * size + */ +#define USB_EHCD_ITD_64BIT_ADDITIONAL_SIZE 28 /* + * 64 bit ITD + * additional + * size + */ +#define USB_EHCD_SITD_64BIT_ADDITIONAL_SIZE 8 /* + * 64 bit SITD + * additional + * size + */ +#define USB_EHCD_QH_HEADER_SIZE 20 /* + * QH header + * size + */ +#define USB_EHCD_QTD_HEADER_SIZE 14 /* + * QTD header + * size + */ +#define USB_EHCD_ITD_HEADER_SIZE 24 /* + * ITD header + * size + */ +#define USB_EHCD_SITD_HEADER_SIZE 26 /* + * SITD header + * size + */ + + +/* Masks for data structure member starts */ + +/* Masks for frame list pointer */ + +#define USB_EHCD_FRAME_LIST_POINTER_VALID_ENTRY_MASK 0x00000001 +#define USB_EHCD_FRAME_LIST_POINTER_TYPE_MASK 0x00000006 +#define USB_EHCD_FRAME_LIST_POINTER_RESERVED_MASK 0x00000018 +#define USB_EHCD_FRAME_LIST_POINTER_MASK 0xFFFFFFE0 + +/* mask bits for Queue Head */ + +#define USB_EHCD_QH_HORIZONTAL_LINK_POINTER_T_MASK 0x00000001 +#define USB_EHCD_QH_HORIZONTAL_LINK_POINTER_TYPE_MASK 0x00000006 +#define USB_EHCD_QH_HORIZONTAL_LINK_POINTER_MASK 0xFFFFFFE0 +#define USB_EHCD_QH_ENDPOINT_CHARACTERISTICS_DEVICE_ADDRESS_MASK 0x0000007F +#define USB_EHCD_QH_ENDPOINT_CHARACTERISTICS_INACTIVATE_MASK 0x00000080 +#define USB_EHCD_QH_ENDPOINT_CHARACTERISTICS_ENDPT_NUMBER_MASK 0x00000F00 +#define USB_EHCD_QH_ENDPOINT_CHARACTERISTICS_ENDPT_SPEED_MASK 0x00003000 +#define USB_EHCD_QH_ENDPOINT_CHARACTERISTICS_DTC_MASK 0x00004000 +#define USB_EHCD_QH_ENDPOINT_CHARACTERISTICS_HEAD_RECLAMATION_LIST_MASK \ + 0x00008000 +#define USB_EHCD_QH_ENDPOINT_CHARACTERISTICS_MAXIMUM_PACKET_LENGTH_MASK \ + 0x07FF0000 +#define USB_EHCD_QH_ENDPOINT_CHARACTERISTICS_CONTROL_ENDPOINT_FLAG_MASK \ + 0x08000000 +#define USB_EHCD_QH_ENDPOINT_CHARACTERISTICS_RL_MASK 0xF0000000 +#define USB_EHCD_QH_ENDPOINT_CAPABILITIES_UFRAME_S_MASK 0x000000FF +#define USB_EHCD_QH_ENDPOINT_CAPABILITIES_UFRAME_C_MASK 0x0000FF00 +#define USB_EHCD_QH_ENDPOINT_CAPABILITIES_HUB_ADDR_MASK 0x007F0000 +#define USB_EHCD_QH_ENDPOINT_CAPABILITIES_PORT_NUMBER_MASK 0x3F800000 +#define USB_EHCD_QH_ENDPOINT_CAPABILITIES_MULT_MASK 0xC0000000 +#define USB_EHCD_QH_CURRENTQTD_POINTER_MASK 0xFFFFFFE0 +#define USB_EHCD_QH_NEXTQTD_POINTER_T_MASK 0x00000001 +#define USB_EHCD_QH_NEXTQTD_POINTER_MASK 0xFFFFFFE0 +#define USB_EHCD_QH_ALTERNATE_NEXTQTDPOINTER_T_MASK 0x00000001 +#define USB_EHCD_QH_ALTERNATE_NEXTQTDPOINTER_NAKCNT_MASK 0x0000001E +#define USB_EHCD_QH_ALTERNATE_NEXTQTDPOINTER_MASK 0xFFFFFFE0 +#define USB_EHCD_QH_TRANSFERINFO_STATUS_MASK 0x000000FF +#define USB_EHCD_QH_TRANSFERINFO_PID_CODE_MASK 0x00000300 +#define USB_EHCD_QH_TRANSFERINFO_CERR_MASK 0x00000C00 +#define USB_EHCD_QH_TRANSFERINFO_C_PAGE_MASK 0x00007000 +#define USB_EHCD_QH_TRANSFERINFO_IOC_MASK 0x00008000 +#define USB_EHCD_QH_TRANSFERINFO_TOTAL_BYTES_TO_TRASFER_MASK 0x7FFF0000 +#define USB_EHCD_QH_TRANSFERINFO_DT_MASK 0x80000000 +#define USB_EHCD_QH_BUFFERPOINTER_CURRENT_OFFSET_MASK 0x00000FFF +#define USB_EHCD_QH_BUFFER_POINTER_MASK 0xFFFFF000 +#define USB_EHCD_QH_BUFFERPOINTER_C_PROG_MASK 0x000000FF +#define USB_EHCD_QH_BUFFERPOINTER_FRAME_TAG_MASK 0x0000001F +#define USB_EHCD_BUFFERPOINTER_S_BYTES_MASK 0x00000FE0 + +/* Mask bits for siTD */ + +#define USB_EHCD_SITD_NEXT_LINK_POINTER_T_MASK 0x00000001 +#define USB_EHCD_SITD_NEXT_LINK_POINTER_TYPE_MASK 0x00000006 +#define USB_EHCD_SITD_NEXT_LINK_POINTER_MASK 0xFFFFFFE0 +#define USB_EHCD_SITD_ENDPOINT_CHARACTERISTICS_DEVICE_ADDRESS_MASK 0x0000007F +#define USB_EHCD_SITD_ENDPOINT_CHARACTERISTICS_ENDPT_NUMBER_MASK 0x00000F00 +#define USB_EHCD_SITD_ENDPOINT_CHARACTERISTICS_HUB_ADDR_MASK 0x007F0000 +#define USB_EHCD_SITD_ENDPOINT_CHARACTERISTICS_PORT_NUMBER_MASK 0x7F000000 +#define USB_EHCD_SITD_ENDPOINT_CHARACTERISTICS_DIRECTION_MASK 0x80000000 +#define USB_EHCD_SITD_SCHEDULE_CONTROL_UFRAME_S_MASK 0x000000FF +#define USB_EHCD_SITD_SCHEDULE_CONTROL_UFRAME_C_MASK 0x0000FF00 +#define USB_EHCD_SITD_TRANSFER_STATE_STATUS_MASK 0x000000FF +#define USB_EHCD_SITD_TRANSFER_STATE_UFRAME_PROG_C_MASK 0x0000FF00 +#define USB_EHCD_SITD_TRANSFER_STATE_TOTAL_BYTES_TO_TRANSFER_MASK 0x03FF0000 +#define USB_EHCD_SITD_TRANSFER_STATE_PAGE_SELECT_MASK 0x40000000 +#define USB_EHCD_SITD_TRANSFER_STATE_IOC_MASK 0x80000000 +#define USB_EHCD_SITD_BUFFERPOINTER_CURRENT_OFFSET_MASK 0x00000FFF +#define USB_EHCD_SITD_BUFFERPOINTER_BACKPTR_T_MASK 0X00000001 +#define USB_EHCD_SITD_BUFFERPOINTER_MASK 0xFFFFF000 +#define USB_EHCD_SITD_BUFFERPOINTER_TP_MASK 0x00000018 +#define USB_EHCD_SITD_BUFFERPOINTER_TCOUNT_MASK 0x00000007 + +/* Mask bits for iTD */ + +#define USB_EHCD_ITD_NEXT_LINK_POINTER_T_MASK 0x00000001 +#define USB_EHCD_ITD_NEXT_LINK_POINTER_TYPE_MASK 0x00000006 +#define USB_EHCD_ITD_NEXT_LINK_POINTER_MASK 0xFFFFFFE0 +#define USB_EHCD_ITD_TRANSACTION_OFFSET_MASK 0x00000FFF +#define USB_EHCD_ITD_TRANSACTION_PAGE_SELECT_MASK 0x00007000 +#define USB_EHCD_ITD_TRANSACTION_IOC_MASK 0x00008000 +#define USB_EHCD_ITD_TRANSACTION_LENGTH_MASK 0x0FFF0000 +#define USB_EHCD_ITD_TRANSACTION_STATUS_MASK 0xF0000000 +#define USB_EHCD_ITD_BUFFER_POINTER_DEVICE_ADDRESS_MASK 0x0000007F +#define USB_EHCD_ITD_BUFFER_POINTER_END_POINT_NUMBER_MASK 0x00000F00 +#define USB_EHCD_ITD_BUFFER_POINTER_MAX_PACKET_SIZE_MASK 0x000007FF +#define USB_EHCD_ITD_BUFFER_POINTER_DIRECTION_MASK 0x00000800 +#define USB_EHCD_ITD_BUFFER_POINTER_MULT_MASK 0x00000003 +#define USB_EHCD_ITD_BUFFER_POINTER_MASK 0xFFFFF000 + +/* Masks for data structure member Ends */ +/* Bit positions of fields in structure elements start */ + +/*Frame List Pointer */ + +#define USB_EHCD_FRAME_LIST_POINTER_VALID_ENTRY_E 0 +#define USB_EHCD_FRAME_LIST_POINTER_TYPE_E 1 +#define USB_EHCD_FRAME_LIST_POINTER_E 5 + +/* Queue Head */ + +#define USB_EHCD_QH_HORIZONTAL_LINK_POINTER_T_E 0 +#define USB_EHCD_QH_HORIZONTAL_LINK_POINTER_TYPE_E 1 +#define USB_EHCD_QH_HORIZONTAL_LINK_POINTER_E 5 +#define USB_EHCD_QH_ENDPOINT_CHARACTERISTICS_DEVICE_ADDRESS_E 0 +#define USB_EHCD_QH_ENDPOINT_CHARACTERISTICS_INACTIVATE_E 7 +#define USB_EHCD_QH_ENDPOINT_CHARACTERISTICS_ENDPT_NUMBER_E 8 +#define USB_EHCD_QH_ENDPOINT_CHARACTERISTICS_ENDPT_SPEED_E 12 +#define USB_EHCD_QH_ENDPOINT_CHARACTERISTICS_DTC_E 14 +#define USB_EHCD_QH_ENDPOINT_CHARACTERISTICS_HEAD_RECLAMATION_LIST_E 15 +#define USB_EHCD_QH_ENDPOINT_CHARACTERISTICS_MAXIMUM_PACKET_LENGTH_E 16 +#define USB_EHCD_QH_ENDPOINT_CHARACTERISTICS_CONTROL_ENDPOINT_FLAG_E 27 +#define USB_EHCD_QH_ENDPOINT_CHARACTERISTICS_RL_E 28 +#define USB_EHCD_QH_ENDPOINT_CAPABILITIES_UFRAME_S_E 0 +#define USB_EHCD_QH_ENDPOINT_CAPABILITIES_UFRAME_C_E 8 +#define USB_EHCD_QH_ENDPOINT_CAPABILITIES_HUB_ADDR_E 16 +#define USB_EHCD_QH_ENDPOINT_CAPABILITIES_PORT_NUMBER_E 23 +#define USB_EHCD_QH_ENDPOINT_CAPABILITIES_MULT_E 30 +#define USB_EHCD_QH_CURRENTQTD_POINTER_E 5 +#define USB_EHCD_QH_NEXTQTD_POINTER_T_E 0 +#define USB_EHCD_QH_NEXTQTD_POINTER_E 5 +#define USB_EHCD_QH_ALTERNATE_NEXTQTDPOINTER_T_E 0 +#define USB_EHCD_QH_ALTERNATE_NEXTQTDPOINTER_NAKCNT_E 1 +#define USB_EHCD_QH_ALTERNATE_NEXTQTDPOINTER_E 5 +#define USB_EHCD_QH_TRANSFERINFO_STATUS_E 0 +#define USB_EHCD_QH_TRANSFERINFO_PID_CODE_E 8 +#define USB_EHCD_QH_TRANSFERINFO_CERR_E 10 +#define USB_EHCD_QH_TRANSFERINFO_C_PAGE_E 12 +#define USB_EHCD_QH_TRANSFERINFO_IOC_E 15 +#define USB_EHCD_QH_TRANSFERINFO_TOTAL_BYTES_TO_TRANSFER_E 16 +#define USB_EHCD_QH_TRANSFERINFO_DT_E 31 +#define USB_EHCD_QH_BUFFERPOINTER_CURRENT_OFFSET_E 0 +#define USB_EHCD_QH_BUFFER_POINTER_E 12 +#define USB_EHCD_QH_BUFFERPOINTER_C_PROG_E 0 +#define USB_EHCD_QH_BUFFERPOINTER_FRAME_TAG_E 0 +#define USB_EHCD_QH_BUFFERPOINTER_S_BYTES_E 5 + +/* QTD */ +#define USB_EHCD_QTD_NEXTQTD_POINTER_T_E 0 +#define USB_EHCD_QTD_NEXTQTD_POINTER_E 5 +#define USB_EHCD_QTD_ALTERNATE_NEXTQTDPOINTER_T_E 0 +#define USB_EHCD_QTD_ALTERNATE_NEXTQTDPOINTER_E 5 +#define USB_EHCD_QTD_TOKEN_STATUS_E 0 +#define USB_EHCD_QTD_TOKEN_PID_CODE_E 8 +#define USB_EHCD_QTD_TOKEN_CERR_E 10 +#define USB_EHCD_QTD_TOKEN_C_PAGE_E 12 +#define USB_EHCD_QTD_TOKEN_IOC_E 15 +#define USB_EHCD_QTD_TOKEN_TOTAL_BYTES_TO_TRANSFER_E 16 +#define USB_EHCD_QTD_TOKEN_DT_E 31 +#define USB_EHCD_QTD_BUFFERPOINTER_CURRENT_OFFSET_E 0 +#define USB_EHCD_QTD_BUFFER_POINTER_E 12 + +/* siTD */ + +#define USB_EHCD_SITD_NEXT_LINK_POINTER_T_E 0 +#define USB_EHCD_SITD_NEXT_LINK_POINTER_TYPE_E 1 +#define USB_EHCD_SITD_NEXT_LINK_POINTER_E 5 +#define USB_EHCD_SITD_ENDPOINT_CHARACTERISTICS_DEVICE_ADDRESS_E 0 +#define USB_EHCD_SITD_ENDPOINT_CHARACTERISTICS_ENDPT_NUMBER_E 8 +#define USB_EHCD_SITD_ENDPOINT_CHARACTERISTICS_HUB_ADDR_E 16 +#define USB_EHCD_SITD_ENDPOINT_CHARACTERISTICS_PORT_NUMBER_E 24 +#define USB_EHCD_SITD_ENDPOINT_CHARACTERISTICS_DIRECTION_E 31 +#define USB_EHCD_SITD_SCHEDULE_CONTROL_UFRAME_S_E 0 +#define USB_EHCD_SITD_SCHEDULE_CONTROL_UFRAME_C_E 8 +#define USB_EHCD_SITD_TRANSFER_STATE_STATUS_E 0 +#define USB_EHCD_SITD_TRANSFER_STATE_UFRAME_PROG_C_E 8 +#define USB_EHCD_SITD_TRANSFER_STATE_TOTAL_BYTES_TO_TRANSFER_E 16 +#define USB_EHCD_SITD_TRANSFER_STATE_PAGE_SELECT_E 30 +#define USB_EHCD_SITD_TRANSFER_STATE_IOC_E 31 +#define USB_EHCD_SITD_BUFFERPOINTER_CURRENT_OFFSET_E 0 +#define USB_EHCD_SITD_BUFFERPOINTER_E 12 +#define USB_EHCD_SITD_BUFFERPOINTER_TP_E 3 +#define USB_EHCD_SITD_BUFFERPOINTER_TCOUNT_E 0 +#define USB_EHCD_SITD_BUFFERPOINTER_BACKPTR_T_E 0 +#define USB_EHCD_SITD_BUFFERPOINTER_BACKPTR_E 5 + +/* iTD */ + +#define USB_EHCD_ITD_NEXT_LINK_POINTER_T_E 0 +#define USB_EHCD_ITD_NEXT_LINK_POINTER_TYPE_E 1 +#define USB_EHCD_ITD_NEXT_LINK_POINTER_E 5 +#define USB_EHCD_ITD_TRANSACTION_OFFSET_E 0 +#define USB_EHCD_ITD_TRANSACTION_PAGE_SELECT_E 12 +#define USB_EHCD_ITD_TRANSACTION_IOC_E 15 +#define USB_EHCD_ITD_TRANSACTION_LENGTH_E 16 +#define USB_EHCD_ITD_TRANSACTION_STATUS_E 28 +#define USB_EHCD_ITD_BUFFER_POINTER_DEVICE_ADDRESS_E 0 +#define USB_EHCD_ITD_BUFFER_POINTER_END_POINT_NUMBER_E 8 +#define USB_EHCD_ITD_BUFFER_POINTER_MAX_PACKET_SIZE_E 0 +#define USB_EHCD_ITD_BUFFER_POINTER_DIRECTION_E 11 +#define USB_EHCD_ITD_BUFFER_POINTER_MULT_E 0 +#define USB_EHCD_ITD_BUFFER_POINTER_E 12 + +/* Mask bits for QTD */ + +#define USB_EHCD_QTD_NEXTQTD_POINTER_T_MASK 0x00000001 +#define USB_EHCD_QTD_NEXTQTD_POINTER_MASK 0xFFFFFFE0 +#define USB_EHCD_QTD_ALTERNATE_NEXTQTDPOINTER_T_MASK 0x00000001 +#define USB_EHCD_QTD_ALTERNATE_NEXTQTDPOINTER_MASK 0xFFFFFFE0 +#define USB_EHCD_QTD_TOKEN_STATUS_MASK 0x000000FF +#define USB_EHCD_QTD_TOKEN_PID_CODE_MASK 0x00000300 +#define USB_EHCD_QTD_TOKEN_CERR_MASK 0x00000C00 +#define USB_EHCD_QTD_TOKEN_C_PAGE_MASK 0x00007000 +#define USB_EHCD_QTD_TOKEN_IOC_MASK 0x00008000 +#define USB_EHCD_QTD_TOKEN_TOTAL_BYTES_TO_TRANSFER_MASK 0x7FFF0000 +#define USB_EHCD_QTD_TOKEN_DT_MASK 0x80000000 +#define USB_EHCD_QTD_BUFFERPOINTER_CURRENT_OFFSET_MASK 0x00000FFF +#define USB_EHCD_QTD_BUFFER_POINTER_MASK 0xFFFFF000 + +extern pUSB_HCD_BUS_INFO pEhciBusInfo[]; + +/* Macro used for converting the CPU memory to bus specific memory */ + +#define USB_EHCD_CONVERT_TO_BUS_MEM(INDEX, ADDRESS) \ + (((ADDRESS) == NULL) ? 0: \ + pEhciBusInfo[INDEX]->pFuncCpuToBus((pVOID)ADDRESS)) + +/* Macro used for converting the bus specific memory to CPU memory */ +#define USB_EHCD_CONVERT_FROM_BUS_MEM(INDEX ,ADDRESS) \ + (((ADDRESS) == 0) ? 0 : \ + pEhciBusInfo[INDEX]->pFuncBusToCpu((UINT32)ADDRESS)) + +/* Macro used for swapping the 32 bit values */ + +#define USB_EHCD_SWAP_DATA(INDEX,VALUE) \ + (((pEhciBusInfo[INDEX]->pFuncDataSwap) == NULL) ? VALUE : \ + pEhciBusInfo[INDEX]->pFuncDataSwap(VALUE)) + +/* Macro used for swapping the contents of buffers */ + +#define USB_EHCD_SWAP_BUFDATA(INDEX,BUFFER,SIZE) \ + (((pEhciBusInfo[INDEX]->pFuncBufferSwap) == NULL) ? (SIZE): \ + pEhciBusInfo[INDEX]->pFuncBufferSwap(BUFFER, SIZE)) + +/* Bit positions of fields in structure elements end */ + +/******************************************************************************* + + * Macro Name : USB_EHCD_GET_BITFIELD + + * Description : This macro is used to get the fields of EHCI data + structures. + + * Parameters : INDEX IN Index of the host controller + + * STRUCT_TYPE IN Type of Data structure. + + * STRUCT_DATA IN Struct variable + + * FIELD IN Field of the structure + + * Return Type : Value in the specified field of the register. + + ******************************************************************************/ + +#define USB_EHCD_GET_BITFIELD(INDEX, \ + STRUCT_TYPE, \ + STRUCT_DATA, \ + FIELD) \ + \ + ((USB_EHCD_SWAP_DATA(INDEX, (UINT32)(STRUCT_DATA)) & \ + USB_EHCD_##STRUCT_TYPE##_##FIELD##_MASK) \ + >> USB_EHCD_##STRUCT_TYPE##_##FIELD##_E) + +/******************************************************************************* + + * Macro Name : USB_EHCD_SET_BITFIELD + + * Description : This macro is used to set the fields of EHCI data + structures. + + * Parameters : INDEX IN Index of the host controller + STRUCT_TYPE IN Type of Data structure. + STRUCT_DATA IN Struct variable + * VALUE IN value of field + + * FIELD IN Field of the structure + + * Return Type : Value in the specified field of the register. + + ******************************************************************************/ +#define USB_EHCD_SET_BITFIELD(INDEX, \ + STRUCT_TYPE, \ + STRUCT_DATA, \ + VALUE, \ + FIELD) \ + \ +{ \ + \ + UINT32 uValueTemp = USB_EHCD_SWAP_DATA(INDEX, (UINT32)(STRUCT_DATA)); \ + \ + uValueTemp = (uValueTemp & \ + (~USB_EHCD_##STRUCT_TYPE##_##FIELD##_MASK)); \ + \ + uValueTemp = (uValueTemp | \ + (VALUE << USB_EHCD_##STRUCT_TYPE##_##FIELD##_E)); \ + \ + STRUCT_DATA = USB_EHCD_SWAP_DATA(INDEX, uValueTemp); \ +} + + +/* Errors specific to EHCD */ +#define USB_EHCD_TIMEOUT ((INT8)15) + +/* Data structure holding the status values of the bus initialization function */ +typedef enum _USB_EHCD_BUS_STATUS +{ + USB_EHCD_HCBUS_INITIALIZED, /* HC bus is initialized successfully */ + USB_EHCD_HC_NOT_PRESENT, /* HC is not present */ + USB_EHCD_HCBUS_NOT_INITIALIZED /* HC bus is not initialized */ +}USB_EHCD_BUS_STATUS, *pUSB_EHCD_BUS_STATUS; + + +/* Forward declaration for the USB_EHCD_PIPE structure */ +typedef struct _USB_EHCD_PIPE USB_EHCD_PIPE, *pUSB_EHCD_PIPE; + +/* + * Structure holding the format of the Queue Head. + * This is to be created for every bulk, control and interrupt endpoint + * created. + */ +typedef struct _USB_EHCD_QH +{ + struct _USB_EHCD_QH *pNext; /* Pointer to the next QH element. */ + struct _USB_EHCD_QTD *pQTD; /* Pointer to the first QTD attached to the QH. */ + VOID * pAllocatedMem; /* Pointer to the allocated QH memory. */ + pUSB_EHCD_PIPE pHCDPipe; /* + * To hold the pointer to the + * USB_EHCD_PIPE data structure. + */ + UINT32 uSize; /* Size of QH */ + UINT32 uQueueHeadHorizontalLinkPointer; /* Queue head horizontal link ptr */ + UINT32 uEndPointCharacteristics;/* Endpoint characteristics */ + UINT32 uEndPointCapabilities; /* Endpoint capabilities */ + UINT32 uCurrentQtdPointer; /* Current QTD pointer */ + UINT32 uNextQtdPointer; /* Next QTD pointer */ + UINT32 uAlternateNextQtdPointer;/* Alternate next QTD pointer */ + UINT32 uTransferInfo; /* Transfer information */ + UINT32 uBufferPointerPageZero; /* Buffer page 0 */ + UINT32 uBufferPointerPageOne; /* Buffer page 1 */ + UINT32 uBufferPointerPageTwo; /* Buffer page 2 */ + UINT32 uBufferPointerPageThree; /* Buffer page 3 */ + UINT32 uBufferPointerPageFour; /* Buffer page 4 */ +} OS_STRUCT_PACKED USB_EHCD_QH, *pUSB_EHCD_QH ; + +/* + * Structure holding the format of the Transfer Descriptor to be queued + * to the QH. This is to be created for a high speed interrupt, control + * or bulk data transfer on the bus. + */ +typedef struct _USB_EHCD_QTD +{ + UINT16 uBytesToTransfer; /* To hold the number of bytes to transfer */ + + + + VOID * pAllocatedMem; /* Pointer to the allocated qTD */ + + struct _USB_EHCD_QTD *pNext; /* Pointer to the next qTD in the queue */ + + UINT32 uSize; /* Size of QTD */ + UINT32 uNextQTDPointer; /* Next QTD pointer */ + UINT32 uAlternateNextQTDPointer;/* Alternate next QTD pointer */ + UINT32 uTransferInfo; /* Transfer information */ + UINT32 uBufferPagePointerList[5]; /* Array of buffer pointers */ + +}OS_STRUCT_PACKED USB_EHCD_QTD, *pUSB_EHCD_QTD ; + +/* + + * Structure holding the format of the isochronous Transfer Descriptor. + + * This is to be created for a high speed isochronous data transfer on the bus. + + */ + +typedef struct _USB_EHCD_ITD + +{ + VOID * pAllocatedMem; /* To hold the pointer to the allocated memory */ + UINT16 uFrameListIndex; /* To hold the index into the frame list */ + + VOID *pPreviousTD; /* pointer to the previous iTD */ + VOID *pNext; /* + * To hold the pointer to the next element in + * the horizontal queue, It can be any type. + */ + struct _USB_EHCD_ITD *pVerticalNext; /* + * To hold the pointer to the next + * element in the vertical queue + */ + + UINT8 uPreviousTDType; /* Type of the previous element */ + UINT8 uNextTDType; /* Type of the next element */ + UINT32 uSize; /* Size of ITD */ + UINT32 uNextLinkPointer; /* Next link pointer */ + UINT32 uTransactionStatusControlList[8]; /* Transaction status and control + * list + */ + UINT32 uBufferPointerList[7]; /* Array of buffer pointers */ + +} OS_STRUCT_PACKED USB_EHCD_ITD, *pUSB_EHCD_ITD ; + +/* + * Structure holding the format of the split isochronous Transfer Descriptor. + * This is to be created for a full speed isochronous data transfer on the bus. + */ +typedef struct _USB_EHCD_SITD +{ + UINT16 uBytesToTransfer;/* To hold the number of bytes to be transferred */ + + VOID * pAllocatedMem;/* To hold the pointer to the allocated memory */ + + UINT16 uFrameListIndex; /* To hold the index into the frame list */ + VOID * pNext; /* + * To hold the pointer to the next element + * in the horizontal queue + */ + struct _USB_EHCD_SITD *pVerticalNext; /* + * To hold the pointer to the next + * element in the vertical queue + */ + VOID * pPreviousTD; /* + * To hold the pointer to the + * previous isochronous TD element. + */ + + UINT8 uPreviousTDType; /* Type of the previous element */ + UINT8 uNextTDType; /* Type of the next element */ + UINT32 uSize; /* Size of siTD */ + UINT32 uNextLinkPointer; + UINT32 uEndPointCharacteristics; + UINT32 uMicroFrameScheduleControl; + UINT32 uTransferState; + UINT32 uBufferPointerList[2]; + UINT32 uBackPointer; +} OS_STRUCT_PACKED USB_EHCD_SITD, *pUSB_EHCD_SITD ; + +/* Data structure holding the format of one element of the periodic frame list */ +typedef UINT32 USB_EHCD_PERIODIC_FRAME_ELEMENT,* pUSB_EHCD_PERIODIC_FRAME_ELEMENT; + +/* Forward declaration of the request information */ +typedef struct _USB_EHCD_REQUEST_INFO USB_EHCD_REQUEST_INFO, *pUSB_EHCD_REQUEST_INFO; + +/* Holds the information about a pipe */ +struct _USB_EHCD_PIPE +{ + UINT16 uListIndex; /* Index into the array of endpoint structures. */ + ULONG uBandwidth; /* Bandwidth reserved for this endpoint. */ + UINT8 uEndpointAddress; /* Address of the endpoint */ + UINT8 uAddress; /* Address of the device holding the endpoint */ + UINT8 uSpeed; /* Speed of the device */ + UINT8 uEndpointType; /* Type of endpoint */ + UINT8 uEndpointDir; /* Direction of the endpoint */ + UINT8 PipeDeletedFlag;/* + * Flag indicating whether the endpoint + * is being deleted. + */ + OS_EVENT_ID DeleteSynchEventID; /* + * Event ID used for synchronisation + * of the cancel/delete pipe with HCD. + */ + UINT16 uMaximumPacketSize; /* To hold the maximum packet size */ + pUSB_EHCD_QH pQH; /* + * Pointer to the EHCD_QH data structure + * for this pipe. + */ + pUSB_EHCD_REQUEST_INFO pRequestQueueHead; /* + * Pointer to the head of the request + * queue structure. + */ + pUSB_EHCD_REQUEST_INFO pRequestQueueTail; /* + * Pointer to the tail of the request + * queue structure. + */ + UINT16 uHubInfo; /* + * This holds any additional details needed for an + * endpoint like the details of the parent hub address + * and the port number to which the device is + * connected. + */ + UINT8 uUFrameMaskValue; /* + * To hold the mask value indicating + * the microframes in which the transfer should + * happen + */ + struct _USB_EHCD_PIPE *pNext;/* + * Pointer to the next EHCD_PIPE pointer in the + * reclamation list + */ + UINT8 bIsHalted; /* + * Flag indicating that the endpoint is halted. This is + * set only when the low/ full speed control/ bulk + * endpoint results in a transaction error. + */ + + INT16 uLastIndex; /* + * This index holds the index which was populated last + * during an isochronous transfer request + */ + INT16 uStartIndex; /* Start index of the last submitted URB */ +}OS_STRUCT_PACKED; + +/* Data structure maintained by HCD to hold the request information */ +struct _USB_EHCD_REQUEST_INFO +{ + pUSBHST_URB pUrb; /* Pointer to the URB */ + pUSB_EHCD_PIPE pHCDPipe; /* Pointer to the HCD maintained data structure */ + UINT32 uAdditionalInfo; /* + * Additional information which need to be added for + * isochronous requests. For full speed isochronous + * requests, this holds the index value. + * For high speed isochronous requests, this holds + * the mask value indicating the microframes in which + * the data needs to be sent. + */ + VOID *pHead; /* Head of the TD queue for this request. */ + VOID *pTail; /* Tail of the TD queue for this request. */ + struct _USB_EHCD_REQUEST_INFO *pNext;/* + * Pointer to the next queue element for + * the endpoint. + */ + struct _USB_EHCD_REQUEST_INFO *pListRequest;/* + * Pointer to the next element in + * the list of requests maintained. + */ +}; + +/* Data structure holding the details of a particular list */ + +typedef struct _USB_EHCD_LIST_DATA +{ + UINT32 uBandwidth[USB_EHCD_MAX_MICROFRAME_NUMBER];/* + * Array holding the + * bandwidth reserved in all + * the microframes in a + * frame. + */ + UINT32 uNextListIndex; /* Index to the next list in the tree */ + VOID * pHeadPointer; /* + * Pointer to the node element which forms the + * head of the list + */ + VOID * pTailPointer; /* Pointer to the tail of the list. */ + UINT8 uHeadPointerType; /* type of the tail pointer in this list */ +} USB_EHCD_LIST_DATA, *pUSB_EHCD_LIST_DATA; + +/* This data structure holds the details of the Root hub */ +typedef struct _USB_EHCD_RH_DATA +{ + UCHAR * pPortStatus; /* + * Pointer to an array of port status + * information + */ + UCHAR HubStatus[USB_EHCD_HUBSTATUS_SIZE];/* Buffer holding the hub status */ + UINT8 uNumDownstreamPorts; /* + * Number of downstream ports supported + * by the Root hub. + */ + UCHAR * pHubInterruptData; /* + * Buffer holding the data to be + * returned on an interrupt request. + */ + UINT32 uSizeInterruptData; /* + * To hold the size of + * the interrupt data + */ + pUSB_EHCD_PIPE pControlPipe; /* Control pipe information */ + pUSB_EHCD_PIPE pInterruptPipe; /* + * Pointer to the USB_EHCD_PIPE data + * structure for the interrupt endpoint. + */ + UINT8 bRemoteWakeupEnabled; /* + * Flag indicating whether Remote Wakeup + * is enabled or not + */ + UINT8 bInterruptEndpointHalted; /* + * Flag indicating whether the + * interrupt endpoint is halted or not. + */ + UINT8 uDeviceAddress; /* Address of the Root hub. */ + UINT8 uConfigValue; /* Value of the configuration which is set. */ +}USB_EHCD_RH_DATA, *pUSB_EHCD_RH_DATA; + +/* This is the data structure maintained for every EHCI Host Controller. */ +typedef struct _USB_EHCD_DATA +{ + UINT32 uBusIndex; /* Index into the array of host controllers */ + UINT8 uIRQ; /* To hold the Interrupt Request Number */ + UINT8 *pEHCBaseAddress; /* + * Base address of the host controller + * operational registers + */ + UINT8 *pPCIBaseAddress; /* + * Base address read from the PCI + * Configuration space + */ + UINT8 addressMode64; /* + * Set to 1 if the addressing + * mode of HC is 64 bit + */ + pUSB_EHCD_PERIODIC_FRAME_ELEMENT pFrameList; /* + * Pointer to the tail of the + * isochronous list. + */ + VOID * pAllocatedFrameList; /* Allocated memory for the frame list. */ + UINT FrameBandwidth[USB_EHCD_MAX_FRAMELIST_SIZE] + [USB_EHCD_MAX_MICROFRAME_NUMBER]; + /* + * To hold the bandwidth + * occupied in the frame + */ + USB_EHCD_LIST_DATA FrameListData[USB_EHCD_MAX_FRAMELIST_SIZE]; /* + * Array maintained + * for the frame + * list data. + */ + USB_EHCD_LIST_DATA TreeListData[USB_EHCD_MAX_TREE_NODES]; /* + * Array maintained for + * the list associated + * with a node. + */ + OS_EVENT_ID InterruptEvent; /* + * Event indicating that an interrupt + * has occurred. + */ + OS_THREAD_ID IntHandlerThreadID;/* + * Thread ID of the thread which handles + * EHCI interrupts. + */ + + OS_EVENT_ID RequestSynchEventID; /* + * Event ID used for synchronisation + * of the requests. + */ + USB_EHCD_RH_DATA RHData; /* + * Data structure holding the details + * of a Root hub. + */ + pUSB_EHCD_REQUEST_INFO pRequestQueueHead;/* + * Pointer to the head of the request + * queue maintained. + */ + pUSB_EHCD_REQUEST_INFO pRequestQueueTail;/* + * Pointer to the tail of the request + * queue maintained. + */ + pUSB_EHCD_PIPE pIsochPipeList; /* + * Pointer to the head of the list + * of Isochronous pipe + */ + + pUSB_EHCD_PIPE pAsynchReclamationListHead; /* + * Pointer to the head of the list + * of EHCD_PIPE data structures + * which need to be removed. + */ + pUSB_EHCD_PIPE pPeriodicReclamationListHead; /* + * Pointer to the head of the list + * of EHCD_PIPE data structures + * which need to be removed. + */ + + OS_EVENT_ID ReclamationListSynchEventID;/* + * Event ID used for + * synchronisation of the EHCD_PIPE + * reclamation list. + */ + pUSB_EHCD_PIPE pDefaultPipe; /* Default pipe information */ + + pUSB_EHCD_PIPE pAsynchTailPipe; /* + * Holds the tail of EHCD_PIPE list + * maintained for the asynchronous + * schedule. + */ + + OS_EVENT_ID BandwidthEventID; /* + * Event used for synchronising + * the bandwidth reservations + */ + + UINT32 uInterruptStatus; /* + * To hold the status of the interrupt. + * This value is populated in the ISR. + */ + + pUSB_EHCD_REQUEST_INFO pHeadAsynchCancelList; /* To hold the head of the + * list of asynchronous + * requests which need to be + * cancelled + */ + + pUSB_EHCD_REQUEST_INFO pHeadPeriodicCancelList; /* To hold the head of the + * list of periodic + * requests which need to be + * cancelled + */ + +}USB_EHCD_DATA, *pUSB_EHCD_DATA; + +#ifdef __cplusplus +} +#endif + +#endif /* End of __EHCD_DATASTRUCTURES_H__ */ +/********************** End of file EHCD_DataStructures.h**********************/ diff --git a/h/usb2/usbEhcdDebug.h b/h/usb2/usbEhcdDebug.h new file mode 100644 index 0000000..0af474a --- /dev/null +++ b/h/usb2/usbEhcdDebug.h @@ -0,0 +1,87 @@ +/* usbEhcdDebug.h - Utility Functions for EHCI */ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +DESCRIPTION +This contains the debug message macros which are used by +the EHCI Host Controller Driver. +*/ +/* +INTERNAL + ******************************************************************************* + * Filename : usbEhcdDebug.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : This contains the debug message macros which are used by + * the EHCI Host Controller Driver. + * + ******************************************************************************/ +#ifndef __INCehcdDebugh +#define __INCehcdDebugh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "usbOsal.h" +/*******************Macros for debug messages - start**********************/ +/* Debug levels defined */ +#define USB_EHCD_DEBUG_LOW 1 +#define USB_EHCD_DEBUG_MEDIUM 2 +#define USB_EHCD_DEBUG_HIGH 3 + +#if 0 +#define USB_EHCD_CURRENT_DEBUG_SEVERITY USB_EHCD_DEBUG_HIGH /* Current debug + severity level */ +#endif + +/*for compilation starts*/ +/* Macro definition for logging high severity messages */ +#if (USB_EHCD_CURRENT_DEBUG_SEVERITY <= USB_EHCD_DEBUG_HIGH) +#define USB_EHCD_LOG_HIGH(FORMAT, ARGS...) \ + _OS_LOG_MESSAGE_RAW(FORMAT, 0, 0) +#else +#define USB_EHCD_LOG_HIGH(FORMAT, ARGS...) +#endif /* (CURRENT_DEBUG_SEVERITY <= DEBUG_HIGH) */ + +/* Macro definition for logging medium severity messages */ +#if (USB_EHCD_CURRENT_DEBUG_SEVERITY <= USB_EHCD_DEBUG_MEDIUM) +#define USB_EHCD_LOG_MEDIUM(FORMAT, ARGS...) \ + _OS_LOG_MESSAGE_RAW(FORMAT, 0, 0) +#else +#define USB_EHCD_LOG_MEDIUM(FORMAT, ARGS...) +#endif /* (CURRENT_DEBUG_SEVERITY <= DEBUG_MEDIUM) */ + +/* Macro definition for logging low severity messages */ +#if (USB_EHCD_CURRENT_DEBUG_SEVERITY <= USB_EHCD_DEBUG_LOW) +#define USB_EHCD_LOG_LOW(FORMAT, ARGS...)\ + _OS_LOG_MESSAGE_RAW(FORMAT, 0, 0) +#else +#define USB_EHCD_LOG_LOW(FORMAT, ARGS...) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* end of __INCehcdDebugh */ +/* End of file */ diff --git a/h/usb2/usbEhcdEventHandler.h b/h/usb2/usbEhcdEventHandler.h new file mode 100644 index 0000000..21227f0 --- /dev/null +++ b/h/usb2/usbEhcdEventHandler.h @@ -0,0 +1,64 @@ +/* usbEhcdEventHandler.h - Utility Functions for EHCI */ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +DESCRIPTION +This contains interrupt routines which handle the EHCI +interrupts. +*/ + +/* +INTERNAL + ******************************************************************************* + * Filename : usbEhcdEventHandler.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * + * Description : This contains interrupt routines which handle the EHCI + * interrupts. + * + * + ******************************************************************************/ +#ifndef __INCehcdEventHandlerh +#define __INCehcdEventHandlerh + +#ifdef __cplusplus +extern "C" { +#endif + +extern VOID usbEhcdISR + ( + pUSB_EHCD_DATA pEHCDData + ); + +extern VOID usbEhcdInterruptHandler + ( + pUSB_EHCD_DATA pEHCDData + ); + +#ifdef __cplusplus +} +#endif + +#endif /* End of __INCehcdEventHandlerh */ +/************************** End of file usbEhcdISR.h*****************************/ + diff --git a/h/usb2/usbEhcdHal.h b/h/usb2/usbEhcdHal.h new file mode 100644 index 0000000..653c671 --- /dev/null +++ b/h/usb2/usbEhcdHal.h @@ -0,0 +1,2610 @@ +/* usbEhcdHal.h - Utility Functions for EHCI */ + +/* Copyright 2004-2005 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +modification history +-------------------- +01i,22apr05,pdg Corrected the error on reading HCCPARAMS::ADDRCAP field +01h,28mar05,pdg non-PCI changes +01g,22mar05,mta Complete 64-bit support added (SPR #104950) +01f,18feb05,pdg Added macro for clearing CF bt of CONFIGFLAG register +01e,28Jul03,gpd Incorporated the changes identified during integration testing +01d,23Jul03,gpd Incorporated the changes identified during testing on MIPS +01c,03Jul03,gpd Changed the interrupt status mask +01b,26jun03,gpd changing the code to WRS standards. +01a,25apr02,ram written. +*/ + +/* +DESCRIPTION +This contains the constants and macros used for +accessing the EHCI Host Controller registers. +*/ + +/* +INTERNAL + ******************************************************************************* + * Filename : usbEhcdHal.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : This contains the constants and macros used for + * accessing the EHCI Host Controller registers. + * + * + ******************************************************************************/ +#ifndef __INCusbEhcdHalh + +#define __INCusbEhcdHalh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Value of the Class Code register for EHCI Host Controller */ +#define USB_EHCD_CLASS_CODE 0x000C0320 + +/* Offsets of the Host Controller capability registers - Start */ +#define USB_EHCD_CAPLENGTH 0x00 /* Offset of the CAPLENGTH register */ +#define USB_EHCD_HCIVERSION 0x02 /* Offset of the HCIVERSION register */ +#define USB_EHCD_HCSPARAMS 0x04 /* Offset of the HCSPARAMS register */ +#define USB_EHCD_HCCPARAMS 0x08 /* Offset of the HCCPARAMS register */ +#define USB_EHCD_HCSP_PORTROUTE 0x0C /* Offset of the HCSP_PORTROUTE register */ +/* Offsets of the Host Controller capability registers - End */ + +/* Offsets of the Host Controller operational registers - Start */ +#define USB_EHCD_USBCMD 0x00 /* Offset of the USBCMD register */ +#define USB_EHCD_USBSTS 0x04 /* Offset of the USBSTS register */ +#define USB_EHCD_USBINTR 0x08 /* Offset of the USBINTR register */ +#define USB_EHCD_FRINDEX 0x0C /* Offset of the FRINDEX register */ +#define USB_EHCD_CTRLDSSEGMENT 0x10 /* Offset of the CTRLDSSEGMENT register */ +#define USB_EHCD_PERIODICLISTBASE 0x14 /* Offset of the PERIODICLISTBASE register*/ +#define USB_EHCD_ASYNCLISTADDR 0x18 /* Offset of the ASYNCLISTADDR register */ +#define USB_EHCD_CONFIGFLAG 0x40 /* Offset of the CONFIGFLAG register */ + +/* Offset of the PORTSC register*/ +#define USB_EHCD_PORTSC(PORT_INDEX) (0x44 + ((PORT_INDEX) * 4)) + +/* Offsets of the Host Controller operational registers - End */ + +/* Bit positions of USBCMD register - Start */ + +/* Interrupt threshold level bitposition */ +#define USB_EHCD_USBCMD_INT_THRESHOLD 16 + +/* Asynch schedule park mode enable bitposition */ +#define USB_EHCD_USBCMD_ASYNCH_SCHEDULE_PARK_MODE_ENABLE 11 + +/* Asynch schedule park mode count bitposition */ +#define USB_EHCD_USBCMD_ASYNCH_SCHEDULE_PARK_MODE_COUNT 8 + +/* Light Host Controller reset bitposition */ +#define USB_EHCD_USBCMD_LIGHT_HC_RESET 7 + +/* Interrupt On Async Advance Doorbell bitposition */ +#define USB_EHCD_USBCMD_INTERRUPT_ON_ASYNC_ADVANCE_DOORBELL 6 + +/* Asynchronous Schedule Enable bitposition */ +#define USB_EHCD_USBCMD_ASYNCHRONOUS_SCHEDULE_ENABLE 5 + +/* Periodic Schedule Enable bitposition */ +#define USB_EHCD_USBCMD_PERIODIC_SCHEDULE_ENABLE 4 + +/* Frame list size bitposition */ +#define USB_EHCD_USBCMD_FRAME_LIST_SIZE 2 + +/* Host Controller Reset bitposition */ +#define USB_EHCD_USBCMD_HC_RESET 1 + +/* Run/Stop bitposition */ +#define USB_EHCD_USBCMD_RS 0 + +/* Bit positions of USBCMD register - End */ + +/* Mask values of the HCSPARAMS register - Start */ + +/* Mask value of the N_PORTS field */ +#define USB_EHCD_HCSPARAMS_N_PORTS_MASK 0x0F + +/* Mask value of the PPC field */ +#define USB_EHCD_HCSPARAMS_PPC_MASK 0x10 + +#define USB_EHCD_HCCPARAMS_ADDRCAP_MASK 0x01 +/* Mask values of the HCSPARAMS register - End */ + +/* Bit positions of HCSPARAMS register - Start */ + +/* Bitposition of PPC field */ +#define USB_EHCD_HCSPARAMS_PPC 4 + +/* Bit positions of HCSPARAMS register - End */ + +/* Bit positions of USBSTS register - Start */ + +/* Asyncronous Schedule Status bitposition */ +#define USB_EHCD_USBSTS_ASYNCHRONOUS_SCHEDULE_STATUS 15 +/* Periodic Schedule Status bitposition */ +#define USB_EHCD_USBSTS_PERIODIC_SCHEDULE_STATUS 14 +/* Reclamation bitposition */ +#define USB_EHCD_USBSTS_RECLAMATION 13 +/* HCHalted bitposition */ +#define USB_EHCD_USBSTS_HCHALTED 12 +/* Interrupt On Async Advance bitposition */ +#define USB_EHCD_USBSTS_INTERRUPT_ON_ASYNC_ADVANCE 5 +/* Host System Error bitposition */ +#define USB_EHCD_USBSTS_HOST_SYSTEM_ERROR 4 + +/* Frame list Rollover bitposition */ +#define USB_EHCD_USBSTS_FRAME_LIST_ROLLOVER 3 + +/* Port Change Detect field bitposition */ +#define USB_EHCD_USBSTS_PORT_CHANGE_DETECT 2 +/* USB Error Interrupt field bitposition */ +#define USB_EHCD_USBSTS_USBERRINT 1 +/* USB Interrupt field bitposition */ +#define USB_EHCD_USBSTS_USBINT 0 +/* Bit positions of USBSTS register - End */ + +/* Bit positions of the USBINTR register - Start */ +/* Interrupt on Aync Advance Enable bitposition */ +#define USB_EHCD_USBINTR_INTERRUPT_ON_ASYNC_ADVANCE_ENABLE 5 +/* Interrupt on Aync Advance Enable bitposition */ +#define USB_EHCD_USBINTR_HOST_SYSTEM_ERROR_ENABLE 4 +/* Frame List Rollover Enable bitposition */ +#define USB_EHCD_USBINTR_FRAME_LIST_ROLLOVER_ENABLE 3 +/* Port Change Interrupt Enable bitposition */ +#define USB_EHCD_USBINTR_PORT_CHANGE_INTERRUPT_ENABLE 2 +/* USB Error Interrupt Enable bitposition */ +#define USB_EHCD_USBINTR_USB_ERROR_INTERRUPT_ENABLE 1 +/* USB Interrupt Enable bitposition */ +#define USB_EHCD_USBINTR_USB_INT_ENABLE 0 +/* Bit positions of the USBINTR register - End */ + +/* Frame Index bitposition of FRINDEX register */ +#define USB_EHCD_FRINDEX_FRAME_INDEX 0 +/* Bit position of the Base Address field of the PERIODICLISTBASE register */ +#define USB_EHCD_PERIODICLISTBASE_BASE_ADDRESS 12 +/* Bit position of the Link Pointer field of the ASYNCHLISTADDR register */ +#define USB_EHCD_ASYNCHLISTADDR_LINK_PTR_LOW 5 + +/* Bit position of the Configure Flag field of the CONFIGFLAG register */ +#define USB_EHCD_CONFIGFLAG_CF 0 + +/* Bit positions of PORTSC register - Start */ +#define USB_EHCD_PORTSC_WKOC_E 22 /* WKOC_E bitposition */ +#define USB_EHCD_PORTSC_WKDSCNNT_E 21 /* WKDSCNNT_E bitposition */ +#define USB_EHCD_PORTSC_WKCNNT_E 20 /* WKCNNT_E bitposition */ +#define USB_EHCD_PORTSC_PORT_TEST_CONTROL 16 /* Port Test Control + bitposition */ +#define USB_EHCD_PORTSC_PORT_INDICATOR_CONTROL 14 /* Port Indicator Control + bitposition */ +#define USB_EHCD_PORTSC_PORT_OWNER 13 /* Port Owner bitposition */ +#define USB_EHCD_PORTSC_PORT_POWER 12 /* Port Power bitposition */ +#define USB_EHCD_PORTSC_LINE_STATUS 10 /* Line status bitposition */ +#define USB_EHCD_PORTSC_PORT_RESET 8 /* Port Reset bitposition */ +#define USB_EHCD_PORTSC_SUSPEND 7 /* Suspend bitposition */ +#define USB_EHCD_PORTSC_FORCE_PORT_RESUME 6 /* Force Port Resume + bitposition */ +#define USB_EHCD_PORTSC_OVER_CURRENT_CHANGE 5 /* Over-current change + bitposition */ +#define USB_EHCD_PORTSC_OVER_CURRENT_ACTIVE 4 /* Over-current Active + bitposition */ +#define USB_EHCD_PORTSC_PORT_ENABLE_DISABLE_CHANGE 3 /* Port Enable/Disable + change bitposition */ +#define USB_EHCD_PORTSC_PORT_ENABLED_DISABLED 2 /* Port Enabled/Disabled + bitposition */ +#define USB_EHCD_PORTSC_CONNECT_STATUS_CHANGE 1 /* Connect Status Change + bitposition */ +#define USB_EHCD_PORTSC_CURRENT_CONNECT_STATUS 0 /* Current Connect Status + field bitposition */ +/* Bit positions of PORTSC register - End */ + +/* Mask values for USBCMD register - Start */ +#define USB_EHCD_USBCMD_INT_THRESHOLD_MASK 0x00FF0000 /* Interrupt threshold + mask */ + +/* Asynch Schedule Park Mode Enable mask */ +#define USB_EHCD_USBCMD_ASYNCH_SCHEDULE_PARK_MODE_EN_MASK 0x00000800 +/* Asynch Schedule Park Mode Count mask */ +#define USB_EHCD_USBCMD_ASYNCH_SCHEDULE_PARK_MODE_COUNT_MASK 0x00000300 +/* Light HC Reset mask */ +#define USB_EHCD_USBCMD_LIGHT_HC_RESET_MASK 0x00000080 +/* Interrupt on Asynch Advance doorbell mask */ +#define USB_EHCD_USBCMD_ASYNC_ADVANCE_DOORBELL_MASK 0x00000040 +/* Asynch Schedule Enable mask */ +#define USB_EHCD_USBCMD_ASYNCH_SCHEDULE_ENABLE_MASK 0x00000020 +/* Periodic Schedule Enable mask */ +#define USB_EHCD_USBCMD_PERIODIC_SCHEDULE_ENABLE_MASK 0x00000010 +/* Frame list size mask */ +#define USB_EHCD_USBCMD_FRAME_LIST_SIZE_MASK 0x0000000C +/* HCRESET mask */ +#define USB_EHCD_USBCMD_HCRESET_MASK 0x00000002 +/* RS mask */ +#define USB_EHCD_USBCMD_RS_MASK 0x00000001 +/* Mask values for USBCMD register - End */ + +/* Mask values for USBSTS register - Start */ +/* Asynch Schedule Status mask */ +#define USB_EHCD_USBSTS_ASYCH_SCHEDULE_STATUS_MASK 0x00008000 +/* Periodic Schedule Status mask */ +#define USB_EHCD_USBSTS_PERIODIC_SCHEDULE_STATUS_MASK 0x00004000 +/* Reclamation mask */ +#define USB_EHCD_USBSTS_RECLAMATION_MASK 0x00002000 +/* HCHalted mask */ +#define USB_EHCD_USBSTS_HCHALTED_MASK 0x00001000 +/* Interrupt On Asynch Advance mask */ +#define USB_EHCD_USBSTS_INTERRUPT_ON_ASYNC_ADVANCE_MASK 0x00000020 +/* Host System Error mask */ +#define USB_EHCD_USBSTS_HOST_SYSTEM_ERROR_MASK 0x00000010 +/* Frame list Rollover mask */ +#define USB_EHCD_USBSTS_FRAME_LIST_ROLLOVER_MASK 0x00000008 +/* Port Change detect mask */ +#define USB_EHCD_USBSTS_PORT_CHANGE_DETECT_MASK 0x00000004 +/* USBERRINT mask */ +#define USB_EHCD_USBSTS_USBERRINT_MASK 0x00000002 +/* USBINT mask */ +#define USB_EHCD_USBSTS_USBINT_MASK 0x00000001 +/* Mask values for USBSTS register - End */ + +/* Mask values for USBINTR register - Start */ +/* Asynch Advance Enable mask */ +#define USB_EHCD_USBINTR_INTERRUPT_ON_ASYNC_ADVANCE_MASK 0x00000020 +/* Host System Error Enable mask */ +#define USB_EHCD_USBINTR_HOST_SYSTEM_ERROR_ENABLE_MASK 0x00000010 +/* Host Frame List Rollover Enable mask */ +#define USB_EHCD_USBINTR_FRAME_LIST_ROLLOVER_ENABLE_MASK 0x00000008 +/* Port change Enable mask */ +#define USB_EHCD_USBINTR_PORT_CHANGE_INTERRUPT_ENABLE_MASK 0x00000004 +/* USB Error Enable mask */ +#define USB_EHCD_USBINTR_USB_ERROR_INTERRUPT_ENABLE_MASK 0x00000002 +/* USB Interrupt mask */ +#define USB_EHCD_USBINTR_USB_INT_ENABLE_MASK 0x00000001 +/* Mask values for USBINTR register - End */ + +/* Mask values for FRINDEX register - Start changed "Vijay" */ +#define USB_EHCD_FRINDEX_FRAME_INDEX_MASK 0x00001FFF +/* Mask values for FRINDEX register - End */ + +/* Mask values for PERIODICLISTBASE register - Start */ +#define USB_EHCD_PERIODICLISTBASE_BASE_ADDRESS_MASK 0xFFFFF000 +/* Mask values for PERIODICLISTBASE register - End */ + +/* Mask values for ASYNCHLISTADDR register - Start */ +/* Link pointer low mask */ +#define USB_EHCD_ASYNCHLISTADDR_LINK_PTR_LOW_MASK 0xFFFFFFE0 +/* Mask values for ASYNCHLISTADDR register - End */ + +/* Mask values for CONFIGFLAG register - Start */ +/* Configure Flag mask */ +#define USB_EHCD_CONFIGFLAG_CF_MASK 0x00000001 +/* Mask values for CONFIGFLAG register - End */ + +/* Mask values for PORTSC register - Start */ +/* WKOC_E mask */ +#define USB_EHCD_PORTSC_WKOC_E_MASK 0x00400000 +/* WKDSCNNT_E mask */ +#define USB_EHCD_PORTSC_WKDSCNNT_E_MASK 0x00200000 +/* WKCNNT_E mask */ +#define USB_EHCD_PORTSC_WKCNNT_E_MASK 0x00100000 +/* Port Test Control mask */ +#define USB_EHCD_PORTSC_PORT_TEST_CONTROL_MASK 0x000F0000 +/* Port Indicator Control mask */ +#define USB_EHCD_PORTSC_PORT_INDICATOR_CONTROL_MASK 0x0000C000 +/* Port Owner mask */ +#define USB_EHCD_PORTSC_PORT_OWNER_MASK 0x00002000 +/* Port Power mask */ +#define USB_EHCD_PORTSC_PORT_POWER_MASK 0x00001000 +/* Line Status mask */ +#define USB_EHCD_PORTSC_LINE_STATUS_MASK 0x00000C00 +/* Port Reset mask */ +#define USB_EHCD_PORTSC_PORT_RESET_MASK 0x00000100 +/* Suspend mask */ +#define USB_EHCD_PORTSC_SUSPEND_MASK 0x00000080 +/* Force port resume mask */ +#define USB_EHCD_PORTSC_FORCE_PORT_RESUME_MASK 0x00000040 +/* Overcurrent change mask */ +#define USB_EHCD_PORTSC_OVER_CURRENT_CHANGE_MASK 0x00000020 +/* Overcurrent active mask */ +#define USB_EHCD_PORTSC_OVER_CURRENT_ACTIVE_MASK 0x00000010 +/* Port enable/ disable change mask */ +#define USB_EHCD_PORTSC_PORT_ENABLE_DISABLE_CHANGE_MASK 0x00000008 +/* Port enabled/ disabled mask */ +#define USB_EHCD_PORTSC_PORT_ENABLED_DISABLED_MASK 0x00000004 +/* Port connect status change mask */ +#define USB_EHCD_PORTSC_CONNECT_STATUS_CHANGE_MASK 0x00000002 +/* Port current connect status mask */ +#define USB_EHCD_PORTSC_CURRENT_CONNECT_STATUS_MASK 0x00000001 +/* Mask values for PORTSC register - End */ + +/* Value to be written to the interrupt enable register */ +/* Enable the Host System Error interrupt */ +#define USB_EHCD_INTERRUPT_MASK 0x00000010 +/* Mask value of the USBSTS register for reading the interrupt status */ +#define USB_EHCD_USBSTS_INTERRUPT_MASK 0x0000003F + +/******************************************************************************* + * Macro Name : USB_EHCD_READ_REG + * Description : This macro is used to read the contents of the register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * OFFSET IN Offset of the register + * Return Type : UINT32 + * - Returns the dword read from the address. + ******************************************************************************/ +#define USB_EHCD_READ_REG(PEHCDDATA, \ + OFFSET) \ + \ + (USB_EHCD_SWAP_DATA((PEHCDDATA)->uBusIndex, \ + *((volatile UINT32 *)(((PEHCDDATA)->pEHCBaseAddress) + (OFFSET))))) + + +/******************************************************************************* + * Macro Name : USB_EHCD_WRITE_REG + * Description : This macro is used to write to a register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * OFFSET IN Offset of the register + * VALUE IN Value to be written to the register. + * Return Type : None. + ******************************************************************************/ + +#define USB_EHCD_WRITE_REG(PEHCDDATA, \ + OFFSET, \ + VALUE) \ + \ + { \ + (*((volatile UINT32 *)(((PEHCDDATA)->pEHCBaseAddress) + (OFFSET))) = \ + USB_EHCD_SWAP_DATA((PEHCDDATA)->uBusIndex, (VALUE))); \ + } + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD + * Description : This macro is used to get the fields of a register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * REGNAME IN Name of the register + * FIELD IN Field of the register + * Return Type : Value in the specified field of the register. + ******************************************************************************/ +#define USB_EHCD_GET_FIELD(PEHCDDATA, \ + REGNAME, \ + FIELD) \ + \ + USB_EHCD_GET_FIELD_##REGNAME##__##FIELD (PEHCDDATA) + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT + * Description : This macro is used to set the fields of a register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * REGNAME IN Name of the register + * FIELD IN Field of the register + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT(PEHCDDATA, \ + REGNAME, \ + FIELD) \ + \ + USB_EHCD_SET_BIT_##REGNAME##__##FIELD (PEHCDDATA) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT + * Description : This macro is used to clear the fields of a register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * REGNAME IN Name of the register + * FIELD IN Field of the register + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT(PEHCDDATA, \ + REGNAME, \ + FIELD) \ + \ + USB_EHCD_CLR_BIT_##REGNAME##__##FIELD (PEHCDDATA) + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_FIELD + * Description : This macro is used to set a particular value in the + * specified field of a register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * REGNAME IN Name of the register + * FIELD IN Field of the register + * VALUE IN Value to be set in the specified field. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_FIELD(PEHCDDATA, \ + REGNAME, \ + FIELD, \ + VALUE) \ + \ + USB_EHCD_SET_FIELD_##REGNAME##__##FIELD (PEHCDDATA, \ + VALUE) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_PORT + * Description : This macro is used to get the fields of a port register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register + * FIELD IN Field of the register + * Return Type : Value in the specified field of the register. + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_PORT(PEHCDDATA, \ + PORT_INDEX, \ + FIELD) \ + \ + USB_EHCD_GET_FIELD_PORTSC__##FIELD (PEHCDDATA, \ + PORT_INDEX) + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT_PORT + * Description : This macro is used to set the fields of a port register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register + * FIELD IN Field of the register + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT_PORT(PEHCDDATA, \ + PORT_INDEX, \ + FIELD) \ + \ + USB_EHCD_SET_BIT_PORTSC__##FIELD (PEHCDDATA, \ + PORT_INDEX) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_PORT + * Description : This macro is used to clear the fields of a port register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register + * FIELD IN Field of the register + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_PORT(PEHCDDATA, \ + PORT_INDEX, \ + FIELD) \ + \ + USB_EHCD_CLR_BIT_PORTSC__##FIELD (PEHCDDATA, \ + PORT_INDEX) + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_FIELD_PORT + * Description : This macro is used to set a particular value in the + * specified field of a port register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register + * FIELD IN Field of the register + * VALUE IN Value to be set in the specified field. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_FIELD_PORT(PEHCDDATA, \ + PORT_INDEX, \ + FIELD, \ + VALUE) \ + \ + USB_EHCD_SET_FIELD_PORTSC__##FIELD (PEHCDDATA, \ + PORT_INDEX, \ + VALUE) + +/******************************************************************************* + * Macro Name : USB_EHCD_READ_CAPLENGTH + * Description : This macro is used to read the contents of the CAPLENGTH + * register + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : UINT8 + * - Returns the contents of the CAPLENGTH register. + ******************************************************************************/ +#define USB_EHCD_READ_CAPLENGTH(PEHCDDATA) \ + \ + *((UINT8 *)(((PEHCDDATA)->pPCIBaseAddress) + USB_EHCD_CAPLENGTH)) + + +/******************************************************************************* + * Macro Name : USB_EHCD_READ_HCSPARAMS + * Description : This macro is used to read the contents of the HCSPARAMS + * register + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : UINT32 + * - Returns the contents of the HCSPARAMS register. + ******************************************************************************/ +#define USB_EHCD_READ_HCSPARAMS(PEHCDDATA) \ + \ + (USB_EHCD_SWAP_DATA((PEHCDDATA)->uBusIndex, \ + *((volatile UINT32 *)(((PEHCDDATA)->pPCIBaseAddress) + USB_EHCD_HCSPARAMS)))) + +/* + ******************************************************************************* + * Macro Name : USB_EHCD_READ_HCCPARAMS + * Description : This macro is used to read the contents of the HCCPARAMS + * register + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : UINT32 + * - Returns the contents of the HCCPARAMS register. + ***************************************************************************** + */ +#define USB_EHCD_READ_HCCPARAMS(PEHCDDATA) \ + \ + (USB_EHCD_SWAP_DATA((PEHCDDATA)->uBusIndex, \ + *((volatile UINT32 *)(((PEHCDDATA)->pPCIBaseAddress) + USB_EHCD_HCCPARAMS)))) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_HCSPARAMS__N_PORTS + * Description : This macro is used to read the value of N_PORTS of the + * HCSPARAMS register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : UINT32 + * - Returns the contents of the N_PORTS field of + * HCSPARAMS register. + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_HCSPARAMS__N_PORTS(PEHCDDATA) \ + \ + (USB_EHCD_READ_HCSPARAMS(PEHCDDATA) & USB_EHCD_HCSPARAMS_N_PORTS_MASK) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_HCSPARAMS__PPC + * Description : This macro is used to read the value of PPC of the + * HCSPARAMS register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : UINT32 + * - Returns the contents of the PPC field of + * HCSPARAMS register. + ******************************************************************************/ + +#define USB_EHCD_GET_FIELD_HCSPARAMS__PPC(PEHCDDATA) \ + \ + ((USB_EHCD_READ_HCSPARAMS(PEHCDDATA) & \ + USB_EHCD_HCSPARAMS_PPC_MASK) >> USB_EHCD_HCSPARAMS_PPC) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_HCCPARAMS__ADDRCAP + * Description : This macro is used to read the value of ADDRCAP of the + * HCCPARAMS register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : UINT32 + * - Returns the contents of the ADDRCAP field of + * HCCPARAMS register. + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_HCCPARAMS__ADDRCAP(PEHCDDATA) \ + \ + (USB_EHCD_READ_HCCPARAMS(PEHCDDATA) & USB_EHCD_HCCPARAMS_ADDRCAP_MASK) + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_FIELD_USBCMD__INT_THRESHOLD_CONTROL + * Description : This macro is used to set the INT_THRESHOLD_CONTROL field + * of the USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * VALUE IN Value to be set in the field + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_FIELD_USBCMD__INT_THRESHOLD_CONTROL(PEHCDDATA, \ + VALUE) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBCMD) & \ + ~(USB_EHCD_USBCMD_INT_THRESHOLD_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBCMD) | \ + (VALUE << USB_EHCD_USBCMD_INT_THRESHOLD)); \ +} + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT_USBCMD__ASYNCH_SCHEDULE_PARK_MODE_ENABLE + * Description : This macro is used to set the + * ASYNCH_SCHEDULE_PARK_MODE_ENABLE field of the + * USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT_USBCMD__ASYNCH_SCHEDULE_PARK_MODE_ENABLE(PEHCDDATA) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBCMD) & \ + ~(USB_EHCD_USBCMD_ASYNCH_SCHEDULE_PARK_MODE_EN_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBCMD) | \ + USB_EHCD_USBCMD_ASYNCH_SCHEDULE_PARK_MODE_EN_MASK); \ +} + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_FIELD_USBCMD__ASYCH_SCHEDULE_PARK_MODE_COUNT + * Description : This macro is used to set the + * ASYCH_SCHEDULE_PARK_MODE_COUNT field + * of the USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * VALUE IN Value to be set in the field + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_FIELD_USBCMD__ASYCH_SCHEDULE_PARK_MODE_COUNT(PEHCDDATA, \ + VALUE) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBCMD) & \ + ~(USB_EHCD_USBCMD_ASYNCH_SCHEDULE_PARK_MODE_COUNT_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBCMD) | \ + (VALUE << USB_EHCD_USBCMD_ASYNCH_SCHEDULE_PARK_MODE_COUNT));\ +} +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT_USBCMD__LIGHT_HC_RESET + * Description : This macro is used to set the + * LIGHT_HCRESET field of the + * USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT_USBCMD__LIGHT_HC_RESET(PEHCDDATA) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBCMD) & \ + ~(USB_EHCD_USBCMD_LIGHT_HC_RESET_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBCMD) | \ + USB_EHCD_USBCMD_LIGHT_HC_RESET_MASK); \ +} + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT_USBCMD__INT_ON_ASYNC_ADVANCE_DOORBELL + * Description : This macro is used to set the + * INT_ON_ASYNCH_ADVANCE_DOORBELL field of the + * USBINTR register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT_USBINTR_INT_ON_ASYNC_ADVANCE_DOORBELL(PEHCDDATA) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBINTR, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBINTR) | \ + USB_EHCD_USBSTS_INTERRUPT_ON_ASYNC_ADVANCE_MASK); \ +} +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT_USBCMD_ASYNC_ADVANCE_DOORBELL + * Description : This macro is used to set the + * INT_ON_ASYNCH_ADVANCE_DOORBELL field of the + * USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT_USBCMD_INT_ON_ASYNC_ADVANCE_DOORBELL(PEHCDDATA) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBCMD) | \ + USB_EHCD_USBCMD_ASYNC_ADVANCE_DOORBELL_MASK); \ +} +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT_USBINTR_INT_ON_FRAME_LIST_ROLLOVER + * Description : This macro is used to set the + * INT_ON_FRAME_LIST_ROLLOVER field of the + * USBINT register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT_USBINTR_INT_ON_FRAME_LIST_ROLLOVER(PEHCDDATA) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBINTR, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBINTR) | \ + USB_EHCD_USBSTS_FRAME_LIST_ROLLOVER_MASK); \ +} +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_USBINTR_INT_ON_FRAME_LIST_ROLLOVER + * Description : This macro is used to clear the + * INT_ON_FRAME_LIST_ROLLOVER field of the + * USBINT register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_USBINTR_INT_ON_FRAME_LIST_ROLLOVER(PEHCDDATA) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBINTR, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBINTR) & \ + ~(USB_EHCD_USBSTS_FRAME_LIST_ROLLOVER_MASK)); \ +} + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_USBCMD__INT_ON_ASYNC_ADVANCE_DOORBELL + * Description : This macro is used to clear the + * INT_ON_ASYNCH_ADVANCE_DOORBELL field of the + * USBINTR register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_USBINTR_INT_ON_ASYNC_ADVANCE_DOORBELL(PEHCDDATA) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBINTR, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBINTR) & \ + ~(USB_EHCD_USBSTS_INTERRUPT_ON_ASYNC_ADVANCE_MASK)); \ +} +/******************************************************************************* + * Macro Name : USB_EHCD_SET_CLR_USBCMD_ASYNC_ADVANCE_DOORBELL + * Description : This macro is used to clear the + * INT_ON_ASYNCH_ADVANCE_DOORBELL field of the + * USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_USBCMD_INT_ON_ASYNC_ADVANCE_DOORBELL(PEHCDDATA) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBCMD) & \ + ~(USB_EHCD_USBCMD_ASYNC_ADVANCE_DOORBELL_MASK)); \ +} +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT_USBCMD__ASYNCH_SCHEDULE_ENABLE + * Description : This macro is used to set the + * ASYNCH_SCHEDULE_ENABLE field of the + * USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT_USBCMD__ASYNCH_SCHEDULE_ENABLE(PEHCDDATA) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBCMD) & \ + ~(USB_EHCD_USBCMD_ASYNCH_SCHEDULE_ENABLE_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBCMD) | \ + USB_EHCD_USBCMD_ASYNCH_SCHEDULE_ENABLE_MASK)); \ +} + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT_USBCMD__PERIODIC_SCHEDULE_ENABLE + * Description : This macro is used to set the + * PERIODIC_SCHEDULE_ENABLE field of the + * USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT_USBCMD__PERIODIC_SCHEDULE_ENABLE(PEHCDDATA) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBCMD) & \ + ~(USB_EHCD_USBCMD_PERIODIC_SCHEDULE_ENABLE_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBCMD) | \ + USB_EHCD_USBCMD_PERIODIC_SCHEDULE_ENABLE_MASK); \ +} + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_FIELD_USBCMD__FRAME_LIST_SIZE + * Description : This macro is used to set the + * FRAME_LIST_SIZE field + * of the USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * VALUE IN Value to be set in the field + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_FIELD_USBCMD__FRAME_LIST_SIZE(PEHCDDATA, \ + VALUE) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBCMD)& \ + ~(USB_EHCD_USBCMD_FRAME_LIST_SIZE_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBCMD) | \ + (VALUE << USB_EHCD_USBCMD_FRAME_LIST_SIZE)); \ +} + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT_USBCMD__HCRESET + * Description : This macro is used to set the HCRESET field of the + * USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT_USBCMD__HCRESET(PEHCDDATA) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBCMD) & \ + ~(USB_EHCD_USBCMD_HCRESET_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBCMD) | \ + USB_EHCD_USBCMD_HCRESET_MASK); \ +} + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT_USBCMD__RS + * Description : This macro is used to set the RS field of the + * USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT_USBCMD__RS(PEHCDDATA) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBCMD) & \ + ~(USB_EHCD_USBCMD_RS_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBCMD) | \ + USB_EHCD_USBCMD_RS_MASK); \ +} + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_USBCMD__ASYNCH_SCHEDULE_PARK_MODE_ENABLE + * Description : This macro is used to clear the + * ASYNCH_SCHEDULE_PARK_MODE_ENABLE field of the + * USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_USBCMD__ASYNCH_SCHEDULE_PARK_MODE_ENABLE(PEHCDDATA) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + (USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBCMD) & \ + (~USB_EHCD_USBCMD_ASYNCH_SCHEDULE_PARK_MODE_EN_MASK)) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_FIELD_USBCMD__ASYCH_SCHEDULE_PARK_MODE_COUNT + * Description : This macro is used to clear the + * ASYCH_SCHEDULE_PARK_MODE_COUNT field + * of the USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * VALUE IN Value to be set in the field + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_FIELD_USBCMD__ASYCH_SCHEDULE_PARK_MODE_COUNT(PEHCDDATA, \ + VALUE) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + (USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBCMD) & \ + (~USB_EHCD_USBCMD_ASYNCH_SCHEDULE_PARK_MODE_COUNT_MASK))) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_USBCMD__LIGHT_HC_RESET + * Description : This macro is used to clear the + * LIGHT_HCRESET field of the + * USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_USBCMD__LIGHT_HC_RESET(PEHCDDATA) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + (USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBCMD) & \ + ~(USB_EHCD_USBCMD_LIGHT_HCRESET_MASK))) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_USBCMD__INT_ON_ASYNC_ADVANCE_DOORBELL + * Description : This macro is used to clear the + * INT_ON_ASYNC_ADVANCE_DOORBELL field of the + * USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_USBCMD__INT_ON_ASYNC_ADVANCE_DOORBELL(PEHCDDATA) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + (USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBCMD) & \ + (~USB_EHCD_USBCMD_ASYNC_ADVANCE_DOORBELL_MASK))) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_USBCMD__ASYNCH_SCHEDULE_ENABLE + * Description : This macro is used to clear the + * ASYNCH_SCHEDULE_ENABLE field of the + * USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_USBCMD__ASYNCH_SCHEDULE_ENABLE(PEHCDDATA) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + (USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBCMD) & \ + (~USB_EHCD_USBCMD_ASYNCH_SCHEDULE_ENABLE_MASK))) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_USBCMD__PERIODIC_SCHEDULE_ENABLE + * Description : This macro is used to clear the + * PERIODIC_SCHEDULE_ENABLE field of the + * USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_USBCMD__PERIODIC_SCHEDULE_ENABLE(PEHCDDATA) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + (USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBCMD) & \ + (~USB_EHCD_USBCMD_PERIODIC_SCHEDULE_ENABLE_MASK))) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_USBCMD__HCRESET + * Description : This macro is used to clear the HCRESET field of the + * USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_USBCMD__HCRESET(PEHCDDATA) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + (USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBCMD) & \ + (~USB_EHCD_USBCMD_HCRESET_MASK))) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_USBCMD__RS + * Description : This macro is used to clear the RS field of the + * USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_USBCMD__RS(PEHCDDATA) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + (USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBCMD) & \ + ~(USB_EHCD_USBCMD_RS_MASK))) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBCMD__INT_THRESHOLD_CONTROL + * Description : This macro is used to get the INT_THRESHOLD_CONTROL field + * of the USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of INT_THRESHOLD_CONTROL field. + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBCMD__INT_THRESHOLD_CONTROL(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBCMD) & USB_EHCD_USBCMD_INT_THRESHOLD_MASK) \ + >> USB_EHCD_USBCMD_INT_THRESHOLD) + + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBCMD__ASYNCH_SCHEDULE_PARK_MODE_ENABLE + * Description : This macro is used to get the + * ASYNCH_SCHEDULE_PARK_MODE_ENABLE field of the + * USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of ASYNCH_SCHEDULE_PARK_MODE_ENABLE + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBCMD__ASYNCH_SCHEDULE_PARK_MODE_ENABLE(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBCMD) & \ + USB_EHCD_USBCMD_ASYNCH_SCHEDULE_PARK_MODE_EN_MASK) \ + >> USB_EHCD_USBCMD_ASYNCH_SCHEDULE_PARK_MODE_ENABLE) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBCMD__ASYCH_SCHEDULE_PARK_MODE_COUNT + * Description : This macro is used to get the + * ASYCH_SCHEDULE_PARK_MODE_COUNT field + * of the USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of ASYCH_SCHEDULE_PARK_MODE_COUNT + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBCMD__ASYCH_SCHEDULE_PARK_MODE_COUNT(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBCMD) & \ + USB_EHCD_USBCMD_ASYNCH_SCHEDULE_PARK_MODE_COUNT_MASK) \ + >> USB_EHCD_USBCMD_ASYNCH_SCHEDULE_PARK_MODE_COUNT) + + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBCMD__LIGHT_HCRESET + * Description : This macro is used to get the + * LIGHT_HCRESET field of the + * USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of LIGHT_HC_RESET field. + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBCMD__LIGHT_HCRESET(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBCMD) & \ + USB_EHCD_USBCMD_LIGHT_HC_RESET_MASK) \ + >> USB_EHCD_USBCMD_LIGHT_HC_RESET) + + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBCMD__INT_ON_ASYNC_ADVANCE_DOORBELL + * Description : This macro is used to get the + * INT_ON_ASYNC_ADVANCE_DOORBELL field of the + * USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of INT_ON_ASYNC_ADVANCE_DOORBELL field. + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBCMD__INT_ON_ASYNC_ADVANCE_DOORBELL(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBCMD) & \ + USB_EHCD_USBCMD_ASYNC_ADVANCE_DOORBELL_MASK) \ + >> USB_EHCD_USBCMD_INTERRUPT_ON_ASYNC_ADVANCE_DOORBELL) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBCMD__ASYNCH_SCHEDULE_ENABLE + * Description : This macro is used to get the + * ASYNCH_SCHEDULE_ENABLE field of the + * USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of ASYNCH_SCHEDULE_ENABLE field. + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBCMD__ASYNCH_SCHEDULE_ENABLE(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBCMD) & \ + USB_EHCD_USBCMD_ASYNCH_SCHEDULE_ENABLE_MASK) \ + >> USB_EHCD_USBCMD_ASYNCHRONOUS_SCHEDULE_ENABLE) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBCMD__PERIODIC_SCHEDULE_ENABLE + * Description : This macro is used to get the + * PERIODIC_SCHEDULE_ENABLE field of the + * USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of PERIODIC_SCHEDULE_ENABLE field. + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBCMD__PERIODIC_SCHEDULE_ENABLE(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBCMD) & \ + USB_EHCD_USBCMD_PERIODIC_SCHEDULE_ENABLE_MASK) \ + >> USB_EHCD_USBCMD_PERIODIC_SCHEDULE_ENABLE) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBCMD__FRAME_LIST_SIZE + * Description : This macro is used to get the + * FRAME_LIST_SIZE field + * of the USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of FRAME_LIST_SIZE field. + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBCMD__FRAME_LIST_SIZE(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBCMD) & \ + USB_EHCD_USBCMD_FRAME_LIST_SIZE_MASK) \ + >> USB_EHCD_USBCMD_FRAME_LIST_SIZE) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBCMD__HCRESET + * Description : This macro is used to get the HCRESET field of the + * USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of HCRESET field. + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBCMD__HCRESET(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBCMD) & \ + USB_EHCD_USBCMD_HCRESET_MASK) \ + >> USB_EHCD_USBCMD_HC_RESET) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBCMD__RS + * Description : This macro is used to get the RS field of the + * USBCMD register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of RS field. + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBCMD__RS(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBCMD) & \ + USB_EHCD_USBCMD_RS_MASK) \ + >> USB_EHCD_USBCMD_RS) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_USBSTS__INTERRUPT_ON_ASYNC_ADVANCE + * Description : This macro is used to clear the + * INTERRUPT_ON_ASYNC_ADVANCE field of the + * USBSTS register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_USBSTS__INTERRUPT_ON_ASYNC_ADVANCE(PEHCDDATA) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBSTS, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBSTS) | \ + USB_EHCD_USBSTS_INTERRUPT_ON_ASYNC_ADVANCE_MASK) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_USBSTS__HOST_SYSTEM_ERROR + * Description : This macro is used to clear the + * HOST_SYSTEM_ERROR field of the + * USBSTS register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_USBSTS__HOST_SYSTEM_ERROR(PEHCDDATA) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBSTS, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBSTS) | \ + USB_EHCD_USBSTS_HOST_SYSTEM_ERROR_MASK) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_USBSTS__FRAME_LIST_ROLLOVER + * Description : This macro is used to clear the + * FRAME_LIST_ROLLOVER field of the + * USBSTS register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_USBSTS__FRAME_LIST_ROLLOVER(PEHCDDATA) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBSTS, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBSTS) | \ + USB_EHCD_USBSTS_FRAME_LIST_ROLLOVER_MASK) + + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_USBSTS__FRAME_LIST_ROLLOVER + * Description : This macro is used to clear the + * FRAME_LIST_ROLLOVER field of the + * USBSTS register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_USBSTS__FRAME_LIST_ROLLOVER(PEHCDDATA) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBSTS, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBSTS) | \ + USB_EHCD_USBSTS_FRAME_LIST_ROLLOVER_MASK) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_USBSTS__PORT_CHANGE_DETECT + * Description : This macro is used to clear the + * FRAME_LIST_ROLLOVER field of the + * USBSTS register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_USBSTS__PORT_CHANGE_DETECT(PEHCDDATA) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBSTS, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBSTS) | \ + USB_EHCD_USBSTS_PORT_CHANGE_DETECT_MASK) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_USBSTS__USBERRINT + * Description : This macro is used to clear the + * USBERRINT field of the + * USBSTS register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_USBSTS__USBERRINT(PEHCDDATA) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBSTS, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBSTS) | \ + USB_EHCD_USBSTS_USBERRINT_MASK) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_USBSTS__USBINT + * Description : This macro is used to clear the + * USBINT field of the + * USBSTS register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_USBSTS__USBINT(PEHCDDATA) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBSTS, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBSTS) | \ + USB_EHCD_USBSTS_USBINT_MASK) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBSTS__ASYCHRONOUS_SCHEDULE_STATUS + * Description : This macro is used to get the + * ASYCHRONOUS_SCHEDULE_STATUS field + * of the USBSTS register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of ASYCHRONOUS_SCHEDULE_STATUS + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBSTS__ASYCHRONOUS_SCHEDULE_STATUS(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBSTS) & \ + USB_EHCD_USBSTS_ASYCH_SCHEDULE_STATUS_MASK) \ + >> USB_EHCD_USBSTS_ASYNCHRONOUS_SCHEDULE_STATUS) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBSTS__PERIODIC_SCHEDULE_STATUS + * Description : This macro is used to get the + * PERIODIC_SCHEDULE_STATUS field + * of the USBSTS register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of PERIODIC_SCHEDULE_STATUS + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBSTS__PERIODIC_SCHEDULE_STATUS(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBSTS) & \ + USB_EHCD_USBSTS_PERIODIC_SCHEDULE_STATUS_MASK) \ + >> USB_EHCD_USBSTS_PERIODIC_SCHEDULE_STATUS) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBSTS__RECLAMATION + * Description : This macro is used to get the + * RECLAMATION field + * of the USBSTS register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of RECLAMATION + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBSTS__RECLAMATION(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBSTS) & \ + USB_EHCD_USBSTS_RECLAMATION_MASK) \ + >> USB_EHCD_USBSTS_RECLAMATION) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBSTS__HCHALTED + * Description : This macro is used to get the + * HCHALTED field + * of the USBSTS register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of HCHALTED + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBSTS__HCHALTED(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBSTS) & \ + USB_EHCD_USBSTS_HCHALTED_MASK) \ + >> USB_EHCD_USBSTS_HCHALTED) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBSTS__INTERRUPT_ON_ASYNC_ADVANCE + * Description : This macro is used to get the + * INTERRUPT_ON_ASYNC_ADVANCE field + * of the USBSTS register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of INTERRUPT_ON_ASYNC_ADVANCE + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBSTS__INTERRUPT_ON_ASYNC_ADVANCE(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBSTS) & \ + USB_EHCD_USBSTS_INTERRUPT_ON_ASYNC_ADVANCE_MASK) \ + >> USB_EHCD_USBSTS_INTERRUPT_ON_ASYNC_ADVANCE) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBSTS__HOST_SYSTEM_ERROR + * Description : This macro is used to get the + * HOST_SYSTEM_ERROR field + * of the USBSTS register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of HOST_SYSTEM_ERROR + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBSTS__HOST_SYSTEM_ERROR(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBSTS) & \ + USB_EHCD_USBSTS_HOST_SYSTEM_ERROR_MASK) \ + >> USB_EHCD_USBSTS_HOST_SYSTEM_ERROR) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBSTS__FRAME_LIST_ROLLOVER + * Description : This macro is used to get the + * FRAME_LIST_ROLLOVER field + * of the USBSTS register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of FRAME_LIST_ROLLOVER + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBSTS__FRAME_LIST_ROLLOVER(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBSTS) & \ + USB_EHCD_USBSTS_FRAME_LIST_ROLLOVER_MASK) \ + >> USB_EHCD_USBSTS_FRAME_LIST_ROLLOVER) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBSTS__PORT_CHANGE_DETECT + * Description : This macro is used to get the + * PORT_CHANGE_DETECT field + * of the USBSTS register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of PORT_CHANGE_DETECT + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBSTS__PORT_CHANGE_DETECT(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBSTS) & \ + USB_EHCD_USBSTS_PORT_CHANGE_DETECT_MASK) \ + >> USB_EHCD_USBSTS_PORT_CHANGE_DETECT) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBSTS__USBERRINT + * Description : This macro is used to get the + * USBERRINT field of the USBSTS register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of USBERRINT + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBSTS__USBERRINT(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBSTS) & \ + USB_EHCD_USBSTS_USBERRINT_MASK) \ + >> USB_EHCD_USBSTS_USBERRINT) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBSTS__USBINT + * Description : This macro is used to get the + * USBINT field of the USBSTS register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of USBINT + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBSTS__USBINT(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBSTS) & \ + USB_EHCD_USBSTS_USBINT_MASK) \ + >> USB_EHCD_USBSTS_USBINT) + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT_USBINTR__INTERRUPT_ON_ASYNC_ADVANCE_ENABLE + * Description : This macro is used to set the + * INTERRUPT_ON_ASYNC_ADVANCE_ENABLE field of the + * USBINTR register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT_USBINTR__INTERRUPT_ON_ASYNC_ADVANCE_ENABLE(PEHCDDATA) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBINTR, \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBINTR) & \ + ~(USB_EHCD_USBINTR_INTERRUPT_ON_ASYNC_ADVANCE_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBINTR, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBINTR) | \ + USB_EHCD_USBINTR_INTERRUPT_ON_ASYNC_ADVANCE_MASK); \ +} + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT_USBINTR__HOST_SYSTEM_ERROR_ENABLE + * Description : This macro is used to set the + * HOST_SYSTEM_ERROR_ENABLE field of the + * USBINTR register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT_USBINTR__HOST_SYSTEM_ERROR_ENABLE(PEHCDDATA) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBINTR, \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBINTR)& \ + ~(USB_EHCD_USBINTR_HOST_SYSTEM_ERROR_ENABLE_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBINTR, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBINTR) | \ + USB_EHCD_USBINTR_HOST_SYSTEM_ERROR_ENABLE_MASK); \ +} + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT_USBINTR__FRAME_LIST_ROLLOVER_ENABLE + * Description : This macro is used to set the + * FRAME_LIST_ROLLOVER_ENABLE field of the + * USBINTR register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT_USBINTR__FRAME_LIST_ROLLOVER_ENABLE(PEHCDDATA) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBINTR, \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBINTR) & \ + ~(USB_EHCD_USBINTR_FRAME_LIST_ROLLOVER_ENABLE_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBINTR, \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBINTR) | \ + USB_EHCD_USBINTR_FRAME_LIST_ROLLOVER_ENABLE_MASK)); \ +} + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT_USBINTR__PORT_CHANGE_INTERRUPT_ENABLE + * Description : This macro is used to set the + * PORT_CHANGE_INTERRUPT_ENABLE field of the + * USBINTR register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT_USBINTR__PORT_CHANGE_INTERRUPT_ENABLE(PEHCDDATA) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBINTR, \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBINTR) & \ + ~(USB_EHCD_USBINTR_PORT_CHANGE_INTERRUPT_ENABLE_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBINTR, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBINTR) | \ + USB_EHCD_USBINTR_PORT_CHANGE_INTERRUPT_ENABLE_MASK); \ +} +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT_USBINTR__USB_ERROR_INTERRUPT_ENABLE + * Description : This macro is used to set the + * USB_ERROR_INTERRUPT_ENABLE field of the + * USBINTR register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT_USBINTR__USB_ERROR_INTERRUPT_ENABLE(PEHCDDATA) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBINTR, \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBINTR) & \ + ~(USB_EHCD_USBINTR_USB_ERROR_INTERRUPT_ENABLE_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBINTR, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBINTR) | \ + USB_EHCD_USBINTR_USB_ERROR_INTERRUPT_ENABLE_MASK); \ +} + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT_USBINTR__USB_INT_ENABLE + * Description : This macro is used to set the + * USB_INT_ENABLE field of the + * USBINTR register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT_USBINTR__USB_INT_ENABLE(PEHCDDATA) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBINTR, \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBINTR) & \ + ~(USB_EHCD_USBINTR_USB_INT_ENABLE_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBINTR, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_USBINTR) | \ + USB_EHCD_USBINTR_USB_INT_ENABLE_MASK); \ +} +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_USBINTR__INTERRUPT_ON_ASYNC_ADVANCE + * Description : This macro is used to clear the + * INTERRUPT_ON_ASYNC_ADVANCE field of the + * USBINTR register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_USBINTR__INTERRUPT_ON_ASYNC_ADVANCE(PEHCDDATA) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + (USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBINTR) & \ + (~USB_EHCD_USBINTR_INTERRUPT_ON_ASYNC_ADVANCE_MASK)) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_USBINTR__HOST_SYSTEM_ERROR_ENABLE + * Description : This macro is used to clear the + * HOST_SYSTEM_ERROR_ENABLE field of the + * USBINTR register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_USBINTR__HOST_SYSTEM_ERROR_ENABLE(PEHCDDATA) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + (USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBINTR) & \ + (~USB_EHCD_USBINTR_HOST_SYSTEM_ERROR_ENABLE_MASK)) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_USBINTR__FRAME_LIST_ROLLOVER_ENABLE + * Description : This macro is used to clear the + * FRAME_LIST_ROLLOVER_ENABLE field of the + * USBINTR register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_USBINTR__FRAME_LIST_ROLLOVER_ENABLE(PEHCDDATA) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + (USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBINTR) & \ + (~USB_EHCD_USBINTR_FRAME_LIST_ROLLOVER_ENABLE_MASK)) +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_USBINTR__PORT_CHANGE_INTERRUPT_ENABLE + * Description : This macro is used to clear the + * PORT_CHANGE_INTERRUPT_ENABLE field of the + * USBINTR register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_USBINTR__PORT_CHANGE_INTERRUPT_ENABLE(PEHCDDATA) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + (USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBINTR) & \ + (~USB_EHCD_USBINTR_PORT_CHANGE_INTERRUPT_ENABLE_MASK)) +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_USBINTR__USB_ERROR_INTERRUPT_ENABLE + * Description : This macro is used to clear the + * USB_ERROR_INTERRUPT_ENABLE field of the + * USBINTR register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_USBINTR__USB_ERROR_INTERRUPT_ENABLE(PEHCDDATA) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + (USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBINTR) & \ + (~USB_EHCD_USBINTR_USB_ERROR_INTERRUPT_ENABLE_MASK)) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_USBINTR__USB_INT_ENABLE + * Description : This macro is used to clear the + * USB_INT_ENABLE field of the + * USBINTR register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_USBINTR__USB_INT_ENABLE(PEHCDDATA) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_USBCMD, \ + (USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBINTR) & \ + (~USB_EHCD_USBINTR_USB_INT_ENABLE_MASK)) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBINTR__INTERRUPT_ON_ASYNC_ADVANCE_ENABLE + * Description : This macro is used to get the + * INTERRUPT_ON_ASYNC_ADVANCE_ENABLE field + * of the USBINTR register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of INTERRUPT_ON_ASYNC_ADVANCE_ENABLE + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBSTS__INTERRUPT_ON_ASYNC_ADVANCE_ENABLE(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBSTS) & \ + USB_EHCD_USBINTR_INTERRUPT_ON_ASYNC_ADVANCE_MASK) \ + >> USB_EHCD_USBINTR_INTERRUPT_ON_ASYNC_ADVANCE_ENABLE) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBINTR__HOST_SYSTEM_ERROR_ENABLE + * Description : This macro is used to get the + * HOST_SYSTEM_ERROR_ENABLE field + * of the USBINTR register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of HOST_SYSTEM_ERROR_ENABLE + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBSTS__HOST_SYSTEM_ERROR_ENABLE(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBSTS) & \ + USB_EHCD_USBINTR_HOST_SYSTEM_ERROR_ENABLE_MASK) \ + >> USB_EHCD_USBINTR_HOST_SYSTEM_ERROR_ENABLE) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBINTR__FRAME_LIST_ROLLOVER_ENABLE + * Description : This macro is used to get the + * FRAME_LIST_ROLLOVER_ENABLE field + * of the USBINTR register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of FRAME_LIST_ROLLOVER_ENABLE + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBSTS__FRAME_LIST_ROLLOVER_ENABLE(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBSTS) & \ + USB_EHCD_USBINTR_FRAME_LIST_ROLLOVER_ENABLE_MASK) \ + >> USB_EHCD_USBINTR_FRAME_LIST_ROLLOVER_ENABLE) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBINTR__PORT_CHANGE_INTERRUPT_ENABLE + * Description : This macro is used to get the + * PORT_CHANGE_INTERRUPT_ENABLE field + * of the USBINTR register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of PORT_CHANGE_INTERRUPT_ENABLE + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBSTS__PORT_CHANGE_INTERRUPT_ENABLE(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBSTS) & \ + USB_EHCD_USBINTR_PORT_CHANGE_INTERRUPT_ENABLE_MASK) \ + >> USB_EHCD_USBINTR_PORT_CHANGE_INTERRUPT_ENABLE) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBINTR__USB_ERROR_INTERRUPT_ENABLE + * Description : This macro is used to get the + * USB_ERROR_INTERRUPT_ENABLE field + * of the USBINTR register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of USB_ERROR_INTERRUPT_ENABLE + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBSTS__USB_ERROR_INTERRUPT_ENABLE(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBSTS) & \ + USB_EHCD_USBINTR_USB_ERROR_INTERRUPT_ENABLE_MASK) \ + >> USB_EHCD_USBINTR_USB_ERROR_INTERRUPT_ENABLE) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_USBINTR__USB_INT_ENABLE + * Description : This macro is used to get the + * USB_INT_ENABLE field + * of the USBINTR register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of USB_INT_ENABLE + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_USBSTS__USB_INT_ENABLE(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_USBSTS) & \ + USB_EHCD_USBINTR_USB_INT_ENABLE_MASK) \ + >> USB_EHCD_USBINTR_USB_INT_ENABLE) + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_FIELD_FRINDEX__FRAME_INDEX + * Description : This macro is used to set the + * FRAME_INDEX field + * of the FRINDEX register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * VALUE IN Value to be set in the field + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_FIELD_FRINDEX__FRAME_INDEX(PEHCDDATA, \ + VALUE) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_FRINDEX, \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_FRINDEX) & \ + ~(USB_EHCD_FRINDEX_FRAME_INDEX_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_FRINDEX, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_FRINDEX) | \ + (VALUE << USB_EHCD_FRINDEX_FRAME_INDEX)); \ +} + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_FRINDEX__FRAME_INDEX + * Description : This macro is used to get the + * FRAME_INDEX field + * of the FRINDEX register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of FRAME_INDEX + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_FRINDEX__FRAME_INDEX(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_FRINDEX) & \ + USB_EHCD_FRINDEX_FRAME_INDEX_MASK) \ + >> USB_EHCD_FRINDEX_FRAME_INDEX) + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_FIELD_PERIODICLISTBASE__BASE_ADDRESS + * Description : This macro is used to set the + * BASE_ADDRESS field + * of the PERIODICLISTBASE register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * VALUE IN Value to be set in the field + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_FIELD_PERIODICLISTBASE__BASE_ADDRESS(PEHCDDATA, \ + VALUE) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PERIODICLISTBASE, \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_PERIODICLISTBASE) & \ + ~(USB_EHCD_PERIODICLISTBASE_BASE_ADDRESS_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PERIODICLISTBASE, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_PERIODICLISTBASE) | \ + (VALUE << USB_EHCD_PERIODICLISTBASE_BASE_ADDRESS)); \ +} + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_PERIODICLISTBASE__BASE_ADDRESS + * Description : This macro is used to get the + * BASE_ADDRESS field + * of the PERIODICLISTBASE register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of BASE_ADDRESS + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_PERIODICLISTBASE__BASE_ADDRESS(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PERIODICLISTBASE) & \ + USB_EHCD_PERIODICLISTBASE_BASE_ADDRESS_MASK) \ + >> USB_EHCD_PERIODICLISTBASE_BASE_ADDRESS) + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_FIELD_ASYNCLISTADDR__LINK_PTR_LOW + * Description : This macro is used to set the + * LINK_PTR_LOW field + * of the ASYNCLISTADDR register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * VALUE IN Value to be set in the field + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_FIELD_ASYNCLISTADDR__LINK_PTR_LOW(PEHCDDATA, \ + VALUE) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_ASYNCLISTADDR, \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_ASYNCLISTADDR) & \ + ~(USB_EHCD_ASYNCHLISTADDR_LINK_PTR_LOW_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_ASYNCLISTADDR, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_ASYNCLISTADDR) | \ + (VALUE << USB_EHCD_ASYNCHLISTADDR_LINK_PTR_LOW)); \ +} + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_ASYNCLISTADDR__LINK_PTR_LOW + * Description : This macro is used to get the + * LINK_PTR_LOW field + * of the ASYNCLISTADDR register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of LINK_PTR_LOW + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_ASYNCLISTADDR__LINK_PTR_LOW(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_ASYNCLISTADDR) & \ + USB_EHCD_ASYNCHLISTADDR_LINK_PTR_LOW_MASK) \ + >> USB_EHCD_ASYNCHLISTADDR_LINK_PTR_LOW) + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT_CONFIGFLAG__CF + * Description : This macro is used to set the + * CF field of the CONFIGFLAG register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT_CONFIGFLAG__CF(PEHCDDATA) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_CONFIGFLAG, \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_CONFIGFLAG) & \ + ~(USB_EHCD_CONFIGFLAG_CF_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_CONFIGFLAG, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_CONFIGFLAG) | \ + USB_EHCD_CONFIGFLAG_CF_MASK); \ +} + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_CONFIGFLAG__CF + * Description : This macro is used to clear the + * CF field of the CONFIGFLAG register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_CONFIGFLAG__CF(PEHCDDATA) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_CONFIGFLAG, \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_CONFIGFLAG) & \ + ~(USB_EHCD_CONFIGFLAG_CF_MASK))); \ +} +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_CONFIGFLAG__CF + * Description : This macro is used to get the + * CF field of the CONFIGFLAG register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * Return Type : Value of CF + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_CONFIGFLAG__CF(PEHCDDATA) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_CONFIGFLAG) & \ + USB_EHCD_CONFIGFLAG_CF_MASK) \ + >> USB_EHCD_CONFIGFLAG_CF) + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT_PORTSC__WKOC_E + * Description : This macro is used to set the + * WKOC_E field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT_PORTSC__WKOC_E(PEHCDDATA, \ + PORT_INDEX) \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_PORTSC(PORT_INDEX)) & \ + ~(USB_EHCD_PORTSC_WKOC_E_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_PORTSC(PORT_INDEX)) | \ + (USB_EHCD_PORTSC_WKOC_E_MASK)); \ +} + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT_PORTSC__WKDSCNNT_E + * Description : This macro is used to set the + * WKDSCNNT_E field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT_PORTSC__WKDSCNNT_E(PEHCDDATA, \ + PORT_INDEX) \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_PORTSC(PORT_INDEX)) & \ + ~(USB_EHCD_PORTSC_WKDSCNNT_E_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC, \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_PORTSC(PORT_INDEX)) | \ + (USB_EHCD_PORTSC_WKDSCNNT_E_MASK)); \ +} + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT_PORTSC__WKCNNT_E + * Description : This macro is used to set the + * WKCNNT_E field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT_PORTSC__WKCNNT_E(PEHCDDATA, \ + PORT_INDEX) \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_PORTSC(PORT_INDEX)) & \ + ~(USB_EHCD_PORTSC_WKCNNT_E_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_PORTSC(PORT_INDEX)) | \ + (USB_EHCD_PORTSC_WKCNNT_E_MASK)); \ +} + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_FIELD_PORTSC__PORT_TEST_CONTROL + * Description : This macro is used to set the + * PORT_TEST_CONTROL field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register + * VALUE IN Value to be set in the PORT_TEST_CONTROL + * field. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_FIELD_PORTSC__PORT_TEST_CONTROL(PEHCDDATA, \ + PORT_INDEX, \ + VALUE) \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_PORTSC(PORT_INDEX)) & \ + ~(USB_EHCD_PORTSC_PORT_TEST_CONTROL_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_PORTSC(PORT_INDEX)) | \ + (VALUE << USB_EHCD_PORTSC_PORT_TEST_CONTROL)); \ +} + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_FIELD_PORTSC__PORT_INDICATOR_CONTROL + * Description : This macro is used to set the + * PORT_INDICATOR_CONTROL field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register + * VALUE IN Value to be set in the PORT_INDICATOR_CONTROL + * field. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_FIELD_PORTSC__PORT_INDICATOR_CONTROL(PEHCDDATA, \ + PORT_INDEX, \ + VALUE) \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_PORTSC(PORT_INDEX)) & \ + ~(USB_EHCD_PORTSC_PORT_INDICATOR_CONTROL_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_PORTSC(PORT_INDEX)) | \ + (VALUE << USB_EHCD_PORTSC_PORT_INDICATOR_CONTROL)); \ +} +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT_PORTSC__PORT_OWNER + * Description : This macro is used to set the + * PORT_OWNER field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT_PORTSC__PORT_OWNER(PEHCDDATA, \ + PORT_INDEX) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_PORTSC(PORT_INDEX)) & \ + ~(USB_EHCD_PORTSC_PORT_OWNER_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_PORTSC(PORT_INDEX)) | \ + USB_EHCD_PORTSC_PORT_OWNER_MASK); \ +} + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT_PORTSC__PORT_POWER + * Description : This macro is used to set the + * PORT_POWER field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT_PORTSC__PORT_POWER(PEHCDDATA, \ + PORT_INDEX) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_PORTSC(PORT_INDEX)) & \ + ~(USB_EHCD_PORTSC_PORT_POWER_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_PORTSC(PORT_INDEX)) | \ + USB_EHCD_PORTSC_PORT_POWER_MASK); \ +} +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT_PORTSC__PORT_RESET + * Description : This macro is used to set the + * PORT_RESET field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT_PORTSC__PORT_RESET(PEHCDDATA, \ + PORT_INDEX) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_PORTSC(PORT_INDEX)) & \ + ~(USB_EHCD_PORTSC_PORT_RESET_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_PORTSC(PORT_INDEX)) | \ + USB_EHCD_PORTSC_PORT_RESET_MASK); \ +} +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT_PORTSC__SUSPEND + * Description : This macro is used to set the + * SUSPEND field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT_PORTSC__SUSPEND(PEHCDDATA, \ + PORT_INDEX) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_PORTSC(PORT_INDEX)) & \ + ~(USB_EHCD_PORTSC_SUSPEND_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_PORTSC(PORT_INDEX)) | \ + USB_EHCD_PORTSC_SUSPEND_MASK); \ +} + +/******************************************************************************* + * Macro Name : USB_EHCD_SET_BIT_PORTSC__FORCE_PORT_RESUME + * Description : This macro is used to set the + * FORCE_PORT_RESUME field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_SET_BIT_PORTSC__FORCE_PORT_RESUME(PEHCDDATA, \ + PORT_INDEX) \ + \ +{ \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_PORTSC(PORT_INDEX)) & \ + ~(USB_EHCD_PORTSC_FORCE_PORT_RESUME_MASK))); \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_PORTSC(PORT_INDEX)) | \ + USB_EHCD_PORTSC_FORCE_PORT_RESUME_MASK); \ +} +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_PORTSC__WKOC_E + * Description : This macro is used to clear the + * WKOC_E field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_PORTSC__WKOC_E(PEHCDDATA, \ + PORT_INDEX) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + (USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + ~(USB_EHCD_PORTSC_WKOC_E_MASK))) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_PORTSC__WKDSCNNT_E + * Description : This macro is used to clear the + * WKDSCNNT_E field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_PORTSC__WKDSCNNT_E(PEHCDDATA, \ + PORT_INDEX) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + (USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + ~(USB_EHCD_PORTSC_WKDSCNNT_E_MASK))) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_PORTSC__WKCNNT_E + * Description : This macro is used to clear the + * WKCNNT_E field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_PORTSC__WKCNNT_E(PEHCDDATA, \ + PORT_INDEX) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + (USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + ~(USB_EHCD_PORTSC_WKCNNT_E_MASK))) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_PORTSC__PORT_TEST_CONTROL + * Description : This macro is used to clear the + * PORT_TEST_CONTROL field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_PORTSC__PORT_TEST_CONTROL(PEHCDDATA, \ + PORT_INDEX) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + (USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + ~(USB_EHCD_PORTSC_PORT_TEST_CONTROL_MASK))) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_PORTSC__PORT_INDICATOR_CONTROL + * Description : This macro is used to clear the + * PORT_INDICATOR_CONTROL field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_PORTSC__PORT_INDICATOR_CONTROL(PEHCDDATA, \ + PORT_INDEX) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + (USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + ~(USB_EHCD_PORTSC_PORT_INDICATOR_CONTROL_MASK))) +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_PORTSC__PORT_OWNER + * Description : This macro is used to clear the + * PORT_OWNER field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_PORTSC__PORT_OWNER(PEHCDDATA, \ + PORT_INDEX) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + (USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + ~(USB_EHCD_PORTSC_PORT_OWNER_MASK))) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_PORTSC__PORT_POWER + * Description : This macro is used to clear the + * PORT_POWER field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_PORTSC__PORT_POWER(PEHCDDATA, \ + PORT_INDEX) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + (USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + ~(USB_EHCD_PORTSC_PORT_POWER_MASK))) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_PORTSC__PORT_RESET + * Description : This macro is used to clear the + * PORT_RESET field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_PORTSC__PORT_RESET(PEHCDDATA, \ + PORT_INDEX) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + (USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + ~(USB_EHCD_PORTSC_PORT_RESET_MASK))) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_PORTSC__FORCE_PORT_RESUME + * Description : This macro is used to clear the + * FORCE_PORT_RESUME field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_PORTSC__FORCE_PORT_RESUME(PEHCDDATA, \ + PORT_INDEX) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + (USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + ~(USB_EHCD_PORTSC_FORCE_PORT_RESUME_MASK))) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_PORTSC__OVER_CURRENT_CHANGE + * Description : This macro is used to clear the + * OVER_CURRENT_CHANGE field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_PORTSC__OVER_CURRENT_CHANGE(PEHCDDATA, \ + PORT_INDEX) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_PORTSC(PORT_INDEX)) | \ + USB_EHCD_PORTSC_OVER_CURRENT_CHANGE_MASK) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_PORTSC__PORT_ENABLE_DISABLE_CHANGE + * Description : This macro is used to clear the + * PORT_ENABLE_DISABLE_CHANGE field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_PORTSC__PORT_ENABLE_DISABLE_CHANGE(PEHCDDATA, \ + PORT_INDEX) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_PORTSC(PORT_INDEX)) | \ + USB_EHCD_PORTSC_PORT_ENABLE_DISABLE_CHANGE_MASK) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_PORTSC__PORT_ENABLED_DISABLED + * Description : This macro is used to clear the + * PORT_ENABLED_DISABLED field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_PORTSC__PORT_ENABLED_DISABLED(PEHCDDATA, \ + PORT_INDEX) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + (USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + ~(USB_EHCD_PORTSC_PORT_ENABLED_DISABLED_MASK))) + +/******************************************************************************* + * Macro Name : USB_EHCD_CLR_BIT_PORTSC__CONNECT_STATUS_CHANGE + * Description : This macro is used to clear the + * CONNECT_STATUS_CHANGE field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : None. + ******************************************************************************/ +#define USB_EHCD_CLR_BIT_PORTSC__CONNECT_STATUS_CHANGE(PEHCDDATA, \ + PORT_INDEX) \ + \ + USB_EHCD_WRITE_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX), \ + (USB_EHCD_READ_REG(PEHCDDATA,USB_EHCD_PORTSC(PORT_INDEX)) | \ + USB_EHCD_PORTSC_CONNECT_STATUS_CHANGE_MASK)) +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_PORTSC__WKOC_E + * Description : This macro is used to get the + * WKOC_E field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : Value of WKOC_E + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_PORTSC__WKOC_E(PEHCDDATA, \ + PORT_INDEX) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + USB_EHCD_PORTSC_WKOC_E_MASK) \ + >> USB_EHCD_PORTSC_WKOC_E) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_PORTSC__WKDSCNNT_E + * Description : This macro is used to get the + * WKDSCNNT_E field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : Value of WKDSCNNT_E + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_PORTSC__WKDSCNNT_E(PEHCDDATA, \ + PORT_INDEX) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + USB_EHCD_PORTSC_WKDSCNNT_E_MASK) \ + >> USB_EHCD_PORTSC_WKDSCNNT_E) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_PORTSC__WKCNNT_E + * Description : This macro is used to get the + * WKCNNT_E field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : Value of WKCNNT_E + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_PORTSC__WKCNNT_E(PEHCDDATA, \ + PORT_INDEX) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + USB_EHCD_PORTSC_WKCNNT_E_MASK) \ + >> USB_EHCD_PORTSC_WKCNNT_E) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_PORTSC__PORT_TEST_CONTROL + * Description : This macro is used to get the + * PORT_TEST_CONTROL field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : Value of PORT_TEST_CONTROL + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_PORTSC__PORT_TEST_CONTROL(PEHCDDATA, \ + PORT_INDEX) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + USB_EHCD_PORTSC_PORT_TEST_CONTROL_MASK) \ + >> USB_EHCD_PORTSC_PORT_TEST_CONTROL) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_PORTSC__PORT_INDICATOR_CONTROL + * Description : This macro is used to get the + * PORT_INDICATOR_CONTROL field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : Value of PORT_INDICATOR_CONTROL + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_PORTSC__PORT_INDICATOR_CONTROL(PEHCDDATA, \ + PORT_INDEX) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + USB_EHCD_PORTSC_PORT_INDICATOR_CONTROL_MASK) \ + >> USB_EHCD_PORTSC_PORT_INDICATOR_CONTROL) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_PORTSC__PORT_OWNER + * Description : This macro is used to get the + * PORT_OWNER field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : Value of PORT_OWNER + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_PORTSC__PORT_OWNER(PEHCDDATA, \ + PORT_INDEX) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + USB_EHCD_PORTSC_PORT_OWNER_MASK) \ + >> USB_EHCD_PORTSC_PORT_OWNER) +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_PORTSC__PORT_POWER + * Description : This macro is used to get the + * PORT_POWER field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : Value of PORT_POWER + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_PORTSC__PORT_POWER(PEHCDDATA, \ + PORT_INDEX) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + USB_EHCD_PORTSC_PORT_POWER_MASK) \ + >> USB_EHCD_PORTSC_PORT_POWER) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_PORTSC__LINE_STATUS + * Description : This macro is used to get the + * LINE_STATUS field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : Value of LINE_STATUS + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_PORTSC__LINE_STATUS(PEHCDDATA, \ + PORT_INDEX) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + USB_EHCD_PORTSC_LINE_STATUS_MASK) \ + >> USB_EHCD_PORTSC_LINE_STATUS) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_PORTSC__PORT_RESET + * Description : This macro is used to get the + * PORT_RESET field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : Value of PORT_RESET + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_PORTSC__PORT_RESET(PEHCDDATA, \ + PORT_INDEX) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + USB_EHCD_PORTSC_PORT_RESET_MASK) \ + >> USB_EHCD_PORTSC_PORT_RESET) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_PORTSC__SUSPEND + * Description : This macro is used to get the + * SUSPEND field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : Value of SUSPEND + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_PORTSC__SUSPEND(PEHCDDATA, \ + PORT_INDEX) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + USB_EHCD_PORTSC_SUSPEND_MASK) \ + >> USB_EHCD_PORTSC_SUSPEND) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_PORTSC__FORCE_PORT_RESUME + * Description : This macro is used to get the + * FORCE_PORT_RESUME field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : Value of FORCE_PORT_RESUME + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_PORTSC__FORCE_PORT_RESUME(PEHCDDATA, \ + PORT_INDEX) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + USB_EHCD_PORTSC_FORCE_PORT_RESUME_MASK) \ + >> USB_EHCD_PORTSC_FORCE_PORT_RESUME) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_PORTSC__OVER_CURRENT_CHANGE + * Description : This macro is used to get the + * OVER_CURRENT_CHANGE field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : Value of OVER_CURRENT_CHANGE + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_PORTSC__OVER_CURRENT_CHANGE(PEHCDDATA, \ + PORT_INDEX) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + USB_EHCD_PORTSC_OVER_CURRENT_CHANGE_MASK) \ + >> USB_EHCD_PORTSC_OVER_CURRENT_CHANGE) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_PORTSC__OVER_CURRENT_ACTIVE + * Description : This macro is used to get the + * OVER_CURRENT_ACTIVE field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : Value of OVER_CURRENT_ACTIVE + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_PORTSC__OVER_CURRENT_ACTIVE(PEHCDDATA, \ + PORT_INDEX) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + USB_EHCD_PORTSC_OVER_CURRENT_ACTIVE_MASK) \ + >> USB_EHCD_PORTSC_OVER_CURRENT_ACTIVE) +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_PORTSC__PORT_ENABLE_CHANGE + * Description : This macro is used to get the + * PORT_ENABLE_CHANGE field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : Value of PORT_ENABLE_CHANGE + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_PORTSC__PORT_ENABLE_CHANGE(PEHCDDATA, \ + PORT_INDEX) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + USB_EHCD_PORTSC_PORT_ENABLE_DISABLE_CHANGE_MASK) \ + >> USB_EHCD_PORTSC_PORT_ENABLE_DISABLE_CHANGE) +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_PORTSC__PORT_ENABLED_DISABLED + * Description : This macro is used to get the + * PORT_ENABLED_DISABLED field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : Value of PORT_ENABLED_DISABLED + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_PORTSC__PORT_ENABLED_DISABLED(PEHCDDATA, \ + PORT_INDEX) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + USB_EHCD_PORTSC_PORT_ENABLED_DISABLED_MASK) \ + >> USB_EHCD_PORTSC_PORT_ENABLED_DISABLED) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_PORTSC__CONNECT_STATUS_CHANGE + * Description : This macro is used to get the + * CONNECT_STATUS_CHANGE field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : Value of CONNECT_STATUS_CHANGE + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_PORTSC__CONNECT_STATUS_CHANGE(PEHCDDATA, \ + PORT_INDEX) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + USB_EHCD_PORTSC_CONNECT_STATUS_CHANGE_MASK) \ + >> USB_EHCD_PORTSC_CONNECT_STATUS_CHANGE) + +/******************************************************************************* + * Macro Name : USB_EHCD_GET_FIELD_PORTSC__CURRENT_CONNECT_STATUS + * Description : This macro is used to get the + * CURRENT_CONNECT_STATUS field of the PORTSC register. + * Parameters : PEHCDDATA IN Pointer to the USB_EHCD_DATA structure. + * PORT_INDEX IN Index of the port register. + * Return Type : Value of CURRENT_CONNECT_STATUS + ******************************************************************************/ +#define USB_EHCD_GET_FIELD_PORTSC__CURRENT_CONNECT_STATUS(PEHCDDATA, \ + PORT_INDEX) \ + \ + ((USB_EHCD_READ_REG(PEHCDDATA, \ + USB_EHCD_PORTSC(PORT_INDEX)) & \ + USB_EHCD_PORTSC_CURRENT_CONNECT_STATUS_MASK) \ + >> USB_EHCD_PORTSC_CURRENT_CONNECT_STATUS) + + +#ifdef __cplusplus +} +#endif + +#endif /* End of __INCusbEhcdHalh */ +/*************************** End of file usbEhcdHal.h**************************/ + diff --git a/h/usb2/usbEhcdInitExit.h b/h/usb2/usbEhcdInitExit.h new file mode 100644 index 0000000..32c2a61 --- /dev/null +++ b/h/usb2/usbEhcdInitExit.h @@ -0,0 +1,63 @@ +/* usbEhcdInitExit.h - Initialization/Uninitializations Functions for EHCI */ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +Modification history +-------------------- +01a,27oct,04,hch add modification history section +*/ + +/* +DESCRIPTION +This contains the initialization and uninitialization +function prototypes of the EHCI Host Controller Driver. +*/ + +/* +INTERNAL + ******************************************************************************* + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + */ + + +#ifndef __INCusbEhcdInitExith +#define __INCusbEhcdInitExith + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +extern BOOLEAN usbEhcdInit(VOID); + +extern BOOLEAN usbEhcdExit(VOID); + +extern VOID usbEhcdDisableHC(int startType); + +#ifdef __cplusplus +} +#endif + +#endif /* End of __INCusbEhcdInitExith */ + +/* End of file */ diff --git a/h/usb2/usbEhcdInterfaces.h b/h/usb2/usbEhcdInterfaces.h new file mode 100644 index 0000000..8d48252 --- /dev/null +++ b/h/usb2/usbEhcdInterfaces.h @@ -0,0 +1,135 @@ +/* ehcd_Interfaces.h - Utility Functions for EHCI */ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +DESCRIPTION +This contains the interfaces which are registered with +the USBD. +*/ + +/* +INTERNAL + ******************************************************************************* + * Filename : usbEhcdInterfaces.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * + * Description : This contains the interfaces which are registered with + * the USBD. + * + * + ******************************************************************************/ +#ifndef __INCusbEhcdInterfacesh +#define __INCusbEhcdInterfacesh + +#ifdef __cplusplus +extern "C" { +#endif + +extern USBHST_STATUS usbEhcdCreatePipe + ( + UINT8 uBusIndex, + UINT8 uDeviceAddress, + UINT8 uDeviceSpeed, + UCHAR * pEndpointDescriptor, + UINT16 uHighSpeedHubInfo, + UINT32 * puPipeHandle + ); + +extern USBHST_STATUS usbEhcdDeletePipe + ( + UINT8 uBusIndex, + UINT32 uPipeHandle + ); + +extern USBHST_STATUS usbEhcdModifyDefaultPipe + ( + UINT8 uBusIndex, + UINT32 uDefaultPipeHandle, + UINT8 uDeviceSpeed, + UINT8 uMaxPacketSize, + UINT16 uHighSpeedHubInfo + ); + +extern USBHST_STATUS usbEhcdIsBandwidthAvailable + ( + UINT8 uBusIndex, + UINT8 uDeviceAddress, + UINT8 uDeviceSpeed, + UCHAR * pCurrentDescriptor, + UCHAR * pNewDescriptor + ); + +extern USBHST_STATUS usbEhcdSubmitURB + ( + UINT8 uBusIndex, + UINT32 uPipeHandle, + pUSBHST_URB pURB + ); + +extern USBHST_STATUS usbEhcdCancelURB + ( + UINT8 uBusIndex, + UINT32 uPipeHandle, + pUSBHST_URB pURB + ); + +extern USBHST_STATUS usbEhcdIsRequestPending + ( + UINT8 uBusIndex, + UINT32 uPipeHandle + ); + +extern USBHST_STATUS usbEhcdGetFrameNumber + ( + UINT8 uBusIndex, + UINT16 * puFrameNumber + ); + +extern USBHST_STATUS usbEhcdSetBitRate + ( + UINT8 uBusIndex, + BOOL bIncrement, + UINT32 * puCurrentFrameWidth + ); + + +extern USBHST_STATUS usbEhcdResetTTRequestComplete + ( + UINT8 uRelativeBusIndex, + VOID * pContext, + USBHST_STATUS nStatus + ); + +extern USBHST_STATUS usbEhcdClearTTRequestComplete + ( + UINT8 uRelativeBusIndex, + VOID * pContext, + USBHST_STATUS nStatus + ); + +#ifdef __cplusplus +} +#endif + +#endif /* End of __INCusbEhcdInterfacesh */ +/********************** End of file __INCehcdInterfacesh***********************/ diff --git a/h/usb2/usbEhcdRhEmulation.h b/h/usb2/usbEhcdRhEmulation.h new file mode 100644 index 0000000..4906a26 --- /dev/null +++ b/h/usb2/usbEhcdRhEmulation.h @@ -0,0 +1,125 @@ +/* usbEhcdRHEmulation.h - Utility Functions for EHCI */ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +DESCRIPTION +This contains the data structures and prototypes of +functions of the Root Hub Emulation module used by +the EHCI Host Controller Driver. +*/ + +/* +INTERNAL + ******************************************************************************* + * Filename : usbEhcdRHEmulation.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : This contains the data structures and prototypes of + * functions of the Root Hub Emulation module used by + * the EHCI Host Controller Driver. + * + ******************************************************************************/ +#ifndef __INCehcdRHEmulationh +#define __INCehcdRHEmulationh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define USB_EHCD_RH_REQUEST_TYPE 0x60 /* Request type mask */ +#define USB_EHCD_RH_STANDARD_REQUEST 0x0 /* Standard request identifier */ +#define USB_EHCD_RH_CLASS_SPECIFIC_REQUEST 0x20 /* Class specific request */ +#define USB_EHCD_RH_RECIPIENT_MASK 0x1F /* Mask value for indicating the + recipient */ +#define USB_EHCD_RH_DEVICE_DESC_SIZE 0x12 /* Size of device descriptor */ +#define USB_EHCD_RH_CONFIG_DESC_SIZE 0x19 /* Size of config descriptor */ +#define USB_EHCD_RH_GET_STATUS_SIZE 0x02 /*Size of GetStatus request data */ +#define USB_EHCD_RH_GET_CONFIG_SIZE 0x01 /* Size of GetConfiguration size */ +#define USB_EHCD_RH_DESCRIPTOR_BITPOSITION 0x08 /* Descriptor type bitposition in + setup packet for + GetDesc request */ +#define USB_EHCD_RH_CONFIG_INTERRUPT_MASK 0x17 /* Mask value to enable interrupt*/ +#define USB_EHCD_RH_PORT_NUMBER_MASK 0x08 /* Port number mask in + index field */ +#define USB_EHCD_RH_PORT_RESET_CHANGE 0x00100000 /* Port reset change mask */ +#define USB_EHCD_RH_PORT_SUSPEND_CHANGE 0x00040000 /* Port suspend change + mask */ +#define USB_EHCD_RH_PORT_SUSPEND_MASK 0x00000004 /* Port suspend mask */ + +/* Class specific values - Start */ +#define USB_EHCD_RH_C_HUB_LOCAL_POWER 0x0 +#define USB_EHCD_RH_C_HUB_OVER_CURRENT 0x01 +#define USB_EHCD_RH_PORT_CONNECTION 0x0 +#define USB_EHCD_RH_PORT_ENABLE 0x01 +#define USB_EHCD_RH_PORT_SUSPEND 0x02 +#define USB_EHCD_RH_PORT_OVER_CURRENT 0x03 +#define USB_EHCD_RH_PORT_RESET 0x04 +#define USB_EHCD_RH_PORT_POWER 0x08 +#define USB_EHCD_RH_PORT_LOW_SPEED 0x09 +#define USB_EHCD_RH_C_PORT_CONNECTION 0x10 +#define USB_EHCD_RH_C_PORT_ENABLE 0x11 +#define USB_EHCD_RH_C_PORT_SUSPEND 0x12 +#define USB_EHCD_RH_C_PORT_OVER_CURRENT 0x13 +#define USB_EHCD_RH_C_PORT_RESET 0x14 +#define USB_EHCD_RH_PORT_TEST 0x15 +#define USB_EHCD_RH_PORT_INDICATOR 0x16 +/* Class specific values - End */ + + +extern USBHST_STATUS usbEhcdRhCreatePipe + ( + pUSB_EHCD_DATA pHCDData, + UINT8 uDeviceAddress, + UINT8 uDeviceSpeed, + UCHAR * pEndpointDescriptor, + UINT32 * puPipeHandle + ); + + +extern USBHST_STATUS usbEhcdRHDeletePipe + ( + pUSB_EHCD_DATA pHCDData, + UINT32 uPipeHandle + ); + +extern USBHST_STATUS usbEhcdRHSubmitURB + ( + pUSB_EHCD_DATA pHCDData, + UINT32 uPipeHandle, + pUSBHST_URB pURB + ); + +USBHST_STATUS usbEhcdRHCancelURB + ( + pUSB_EHCD_DATA pHCDData, + UINT32 uPipeHandle, + pUSBHST_URB pURB + ); +extern USBHST_STATUS usbEhcdRHIsRequestPending + ( + pUSB_EHCD_DATA pHCDData, + UINT32 uPipeHandle + ); +#endif /* End of __INCehcdRHEmulationh*/ +/******************** End of file usbEhcdRHEmulation.h**********************/ diff --git a/h/usb2/usbEhcdUtil.h b/h/usb2/usbEhcdUtil.h new file mode 100644 index 0000000..96acdae --- /dev/null +++ b/h/usb2/usbEhcdUtil.h @@ -0,0 +1,989 @@ +/* usbEhcdUtil.h - Utility Functions for EHCI */ + +/* Copyright 2004-2005 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +Modification history +-------------------- +01h,28mar05,pdg non-PCI changes +01g,22mar05,mta 64-bit support added (SPR #104950) +01f,02feb05,pdg Fix for multiple device connection/disconnection +01e,03aug04,ami Warning Messages Removed +01d,23Jul03,gpd Incorporated the changes identified during testing on MIPS +01c,03Jul03,gpd fixed the bug with asynchronous schedule updation. + Added separate reclamation lists for asynchronous and periodic + Added reclamation lists for asynch and periodic request + cancellation. +01b,26jun03,psp changing the code to WRS standards. +01a,25apr03,ram written. +*/ + +/* +DESCRIPTION +This contains the prototypes of the utility functions +which are used by the EHCI Driver. +*/ + +/* +INTERNAL + ******************************************************************************* + * Filename : usbEhcdUtil.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + ******************************************************************************/ + + + +#ifndef __INCusbEhcdUtilh +#define __INCusbEhcdUtilh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* defines */ + +/*Macro to Initialize USB_USB_EHCD_PIPE */ +#define USB_EHCD_PIPE_INITIALIZE(pEHCDPipe) \ +{ \ + OS_MEMSET(pEHCDPipe, 0, sizeof(USB_EHCD_PIPE)); \ + pEHCDPipe->PipeDeletedFlag = FALSE; \ +} + +/* Macro to Add QH to asynchronousschedule */ +#define USB_EHCD_ADD_TO_HC_ASYNCH_SCHEDULE(pHCDData, \ + pQH) \ +{ \ + /* To hold the field returned by GET_FIELD macro. */ \ + UINT32 getField; \ + /* Temporary pointer to hold the queue head */ \ + PUCHAR pQhPtr = NULL; \ + \ + UINT32 uBusIndex = pHCDData->uBusIndex;/* bus index */ \ + \ + CACHE_DMA_INVALIDATE(pHCDData->pAsynchTailPipe->pQH, sizeof(USB_EHCD_QH)); \ + \ + getField = USB_EHCD_GET_BITFIELD(uBusIndex, \ + QH, \ + pHCDData->pAsynchTailPipe->pQH->uQueueHeadHorizontalLinkPointer,\ + HORIZONTAL_LINK_POINTER ); \ + \ + USB_EHCD_SET_BITFIELD(uBusIndex, \ + QH, pQH->uQueueHeadHorizontalLinkPointer, \ + getField, HORIZONTAL_LINK_POINTER ); \ + \ + \ + /* Disable the asynchronous schedule */ \ + \ + USB_EHCD_CLR_BIT(pHCDData, \ + USBCMD, \ + ASYNCH_SCHEDULE_ENABLE); \ + \ + while ((USB_EHCD_GET_FIELD(pHCDData, \ + USBCMD, \ + ASYNCH_SCHEDULE_ENABLE) != 0) || \ + (USB_EHCD_GET_FIELD(pHCDData, \ + USBSTS, \ + ASYCHRONOUS_SCHEDULE_STATUS) !=0)) \ + OS_DELAY_MS(1); \ + \ + pQhPtr = (PUCHAR) pQH; \ + pQhPtr += USB_EHCD_QH_HEADER_SIZE; \ + /* Update the tail's next pointer */ \ + USB_EHCD_SET_BITFIELD(uBusIndex, \ + QH, \ + pHCDData->pAsynchTailPipe->pQH->uQueueHeadHorizontalLinkPointer,\ + ((unsigned)USB_EHCD_CONVERT_TO_BUS_MEM( \ + pHCDData->uBusIndex,pQhPtr) >> 5), \ + HORIZONTAL_LINK_POINTER ); \ + \ + \ + /* This USB_EHCD_PIPE pointer's next element is the tail's next element*/ \ + pQH->pHCDPipe->pNext = pHCDData->pAsynchTailPipe->pNext; \ + \ + CACHE_DMA_FLUSH(pQH, sizeof(USB_EHCD_QH)); \ + \ + CACHE_DMA_FLUSH(pHCDData->pAsynchTailPipe->pQH, sizeof(USB_EHCD_QH)); \ + \ + \ + /* Enable the asynchronous schedule */ \ + \ + USB_EHCD_SET_BIT(pHCDData, \ + USBCMD, \ + ASYNCH_SCHEDULE_ENABLE); \ + \ + while ((USB_EHCD_GET_FIELD(pHCDData, \ + USBCMD, \ + ASYNCH_SCHEDULE_ENABLE) == 0) || \ + (USB_EHCD_GET_FIELD(pHCDData, \ + USBSTS, \ + ASYCHRONOUS_SCHEDULE_STATUS) ==0)) \ + OS_DELAY_MS(1); \ + \ + /* The tail pointer's next points to this QH's USB_EHCD_PIPE pointer */ \ + pHCDData->pAsynchTailPipe->pNext = pQH->pHCDPipe; \ + \ + /* Make this as the tail element */ \ + pHCDData->pAsynchTailPipe = pQH->pHCDPipe; \ +} + +/* Macro to Add QH to Interrupt Schedule */ +#define USB_EHCD_ADD_TO_HC_INTERRUPT_SCHEDULE(pHCDData, \ + uListIndex, \ + pQH) \ +{ \ + /* To hold the field returned by GET_FIELD macro. */ \ + UINT32 getField; \ + \ + UINT32 uBusIndex = pHCDData->uBusIndex;/* bus index */ \ + \ + /* Pointer to the tail of the list */ \ + pUSB_EHCD_QH pTailQH = NULL; \ + \ + /* temporary pointer to hold the queue head */ \ + PUCHAR pQhPtr = NULL; \ + \ + /* Copy the tail of the list */ \ + pTailQH = (pUSB_EHCD_QH)pHCDData->TreeListData[uListIndex].pTailPointer; \ + \ + /* Retrieve the HCD accessible pointer */ \ + \ + pTailQH =(pUSB_EHCD_QH) ((UINT32)pTailQH -USB_EHCD_QH_HEADER_SIZE); \ + \ + CACHE_DMA_INVALIDATE(pTailQH, sizeof(USB_EHCD_QH)); \ + \ + /* Copy the next data structure type from the tail element */ \ + getField = USB_EHCD_GET_BITFIELD(pHCDData->uBusIndex, \ + QH, \ + pTailQH->uQueueHeadHorizontalLinkPointer, \ + HORIZONTAL_LINK_POINTER_TYPE); \ + \ + USB_EHCD_SET_BITFIELD(pHCDData->uBusIndex, \ + QH,pQH->uQueueHeadHorizontalLinkPointer, \ + getField, HORIZONTAL_LINK_POINTER_TYPE ); \ + \ + /* \ + * Copy tail element's 't' type which indicates whether the next \ + * data structure is a valid data structure \ + */ \ + /* pQH->dword0.t = pTailQH->dword0.t; */ \ + \ + getField = USB_EHCD_GET_BITFIELD(uBusIndex, \ + QH, \ + pTailQH->uQueueHeadHorizontalLinkPointer, \ + HORIZONTAL_LINK_POINTER_T); \ + \ + USB_EHCD_SET_BITFIELD(uBusIndex, \ + QH,pQH->uQueueHeadHorizontalLinkPointer, \ + getField, \ + HORIZONTAL_LINK_POINTER_T); \ + \ + /* The QH's next pointer should point to the tail's next element */ \ + /* pQH->dword0.queue_head_horizontal_link_pointer = \ + pTailQH->dword0.queue_head_horizontal_link_pointer; */ \ + getField = USB_EHCD_GET_BITFIELD(uBusIndex, \ + QH, \ + pTailQH->uQueueHeadHorizontalLinkPointer, \ + HORIZONTAL_LINK_POINTER); \ + \ + USB_EHCD_SET_BITFIELD(uBusIndex, \ + QH,pQH->uQueueHeadHorizontalLinkPointer, \ + getField, \ + HORIZONTAL_LINK_POINTER); \ + \ + \ + /* Update the next pointer of the QH */ \ + pQH->pNext = pTailQH->pNext; \ + \ + CACHE_DMA_FLUSH(pQH, sizeof(USB_EHCD_QH)); \ + \ + /* Update the tail's next pointer */ \ + pTailQH->pNext = pQH; \ + \ + /* Update the tail pointer */ \ + pHCDData->TreeListData[uListIndex].pTailPointer = (pVOID)((UINT32)pQH + \ + USB_EHCD_QH_HEADER_SIZE); \ + \ + \ + \ + /* Make the Queue Head point to the host controller accessable region \ + * by adding the offest USB_EHCD_QH_HEADER_SIZE to queue head */ \ + \ + pQhPtr = (PUCHAR)pQH; \ + pQhPtr += USB_EHCD_QH_HEADER_SIZE; \ + \ + \ + /* Update the next element of the tail pointer */ \ + /* pTailQH->dword0.queue_head_horizontal_link_pointer = \ + (unsigned) (pQH) >> 5; */ \ + USB_EHCD_SET_BITFIELD(uBusIndex, \ + QH,pTailQH->uQueueHeadHorizontalLinkPointer, \ + (((unsigned)(USB_EHCD_CONVERT_TO_BUS_MEM( \ + pHCDData->uBusIndex,pQhPtr))) >> 5), \ + HORIZONTAL_LINK_POINTER); \ + \ + CACHE_DMA_FLUSH(pTailQH, sizeof(USB_EHCD_QH)); \ +} +/* Macro to add pointer to USB_EHCD_PIPE in Asynch Reclamation List */ +#define USB_EHCD_ADD_TO_ASYNCH_RECLAMATION_LIST(pHCDData, \ + pHCDPipe) \ +{ \ + /* Exclusively access the list */ \ + OS_WAIT_FOR_EVENT(pHCDData->ReclamationListSynchEventID, OS_WAIT_INFINITE);\ + \ + /* Add to the list */ \ + pHCDPipe->pNext = pHCDData->pAsynchReclamationListHead; \ + \ + /* Update the asynch reclamation list head */ \ + pHCDData->pAsynchReclamationListHead = pHCDPipe; \ + \ + /* Release the exclusive access */ \ + OS_RELEASE_EVENT(pHCDData->ReclamationListSynchEventID); \ +} + +/* Macro to add pointer to USB_EHCD_PIPE in Periodic Reclamation List */ +#define USB_EHCD_ADD_TO_PERIODIC_RECLAMATION_LIST(pHCDData, \ + pHCDPipe) \ +{ \ + /* Exclusively access the list */ \ + OS_WAIT_FOR_EVENT(pHCDData->ReclamationListSynchEventID, OS_WAIT_INFINITE);\ + \ + /* Add to the list */ \ + pHCDPipe->pNext = pHCDData->pPeriodicReclamationListHead; \ + \ + /* Update the periodic reclamation list head */ \ + pHCDData->pPeriodicReclamationListHead = pHCDPipe; \ + \ + /* Release the exclusive access */ \ + OS_RELEASE_EVENT(pHCDData->ReclamationListSynchEventID); \ +} + +/* Macro to add pointer to USB_EHCD_PIPE in Isoch pipe List */ +#define USB_EHCD_ADD_TO_ISOCH_PIPE_LIST(pHCDData, \ + pHCDPipe) \ +{ \ + /* Exclusively access the list */ \ + OS_WAIT_FOR_EVENT(pHCDData->ReclamationListSynchEventID, OS_WAIT_INFINITE);\ + \ + /* Add to the list */ \ + pHCDPipe->pNext = pHCDData->pIsochPipeList; \ + \ + /* Update the asynch reclamation list head */ \ + pHCDData->pIsochPipeList = pHCDPipe; \ + \ + /* Release the exclusive access */ \ + OS_RELEASE_EVENT(pHCDData->ReclamationListSynchEventID); \ +} + +/* Macro to add pointer to USB_EHCD_PIPE in Isoch pipe List */ +#define USB_EHCD_REMOVE_ISOCH_PIPE(pHCDData, \ + pHCDPipe) \ +{ \ + pUSB_EHCD_PIPE pTempPipe; \ + \ + if (pHCDPipe == pHCDData->pIsochPipeList) \ + { \ + /* If it is the hesd element, \ + * update the head of list to next pointer */ \ + pHCDData->pIsochPipeList = pHCDPipe->pNext; \ + } \ + else \ + { \ + /* Search for the pipe in the list */ \ + for (pTempPipe = pHCDData->pIsochPipeList; \ + (NULL != pTempPipe) && \ + (pHCDPipe != pTempPipe->pNext); \ + pTempPipe = pTempPipe->pNext); \ + \ + /* If Pipe not found, Assert an error */ \ + OS_ASSERT(NULL != pTempPipe); \ + pTempPipe->pNext = pHCDPipe->pNext; \ + } \ +} + + +/* Macro to add request to the list of asynchronous requests to be removed */ +#define USB_EHCD_ADD_TO_ASYNCH_REQUEST_REMOVAL_LIST(pHCDData, \ + pRequestInfo) \ +{ \ + /* Exclusively access the list */ \ + OS_WAIT_FOR_EVENT(pHCDData->ReclamationListSynchEventID, OS_WAIT_INFINITE);\ + \ + /* Add to the list */ \ + pRequestInfo->pListRequest = pHCDData->pHeadAsynchCancelList; \ + \ + /* Update the asynch cancel request list */ \ + pHCDData->pHeadAsynchCancelList = pRequestInfo; \ + \ + /* Release the exclusive access */ \ + OS_RELEASE_EVENT(pHCDData->ReclamationListSynchEventID); \ +} + +/* Macro to add request to the list of periodic requests to be removed */ +#define USB_EHCD_ADD_TO_PERIODIC_REQUEST_REMOVAL_LIST(pHCDData, \ + pRequestInfo) \ +{ \ + /* Exclusively access the list */ \ + OS_WAIT_FOR_EVENT(pHCDData->ReclamationListSynchEventID, OS_WAIT_INFINITE);\ + \ + /* Add to the periodic list */ \ + pRequestInfo->pListRequest = pHCDData->pHeadPeriodicCancelList; \ + \ + /* Update the periodic cancel request list */ \ + pHCDData->pHeadPeriodicCancelList = pRequestInfo; \ + \ + /* Release the exclusive access */ \ + OS_RELEASE_EVENT(pHCDData->ReclamationListSynchEventID); \ +} + +/*Macro to add the request to Request list maintained Host Controller Driver */ +#define USB_EHCD_ADD_TO_HCD_REQUEST_LIST(pHCDData, \ + pRequest) \ +{ \ + /* \ + * If there is no element in the list, \ + * make the head and tail point to the request \ + */ \ + if (NULL == pHCDData->pRequestQueueHead) \ + { \ + pHCDData->pRequestQueueHead = pRequest; \ + pHCDData->pRequestQueueTail = pRequest; \ + } \ + else \ + { \ + /* Update the next pointer of the tail element */ \ + pHCDData->pRequestQueueTail->pListRequest = pRequest; \ + /* Update the tail element to point to the request */ \ + pHCDData->pRequestQueueTail = pRequest; \ + } \ + \ +} + +/*Macro to add the request to requests list maintained for the endpoint. */ +#define USB_EHCD_ADD_TO_ENDPOINT_LIST(pHCDData, \ + pRequest) \ +{ \ + \ + /* \ + * If there is no element in the list, \ + * make the head and tail point to the request \ + */ \ + if (NULL == pRequest->pHCDPipe->pRequestQueueHead) \ + { \ + pRequest->pHCDPipe->pRequestQueueHead = pRequest; \ + pRequest->pHCDPipe->pRequestQueueTail = pRequest; \ + } \ + else \ + { \ + /* Update the next pointer of the tail element */ \ + pRequest->pHCDPipe->pRequestQueueTail->pNext = pRequest; \ + /* Update the tail element to point to the request */ \ + pRequest->pHCDPipe->pRequestQueueTail = pRequest; \ + } \ +} + +/* This macro is used to to delete the request from request list maintained + * for the endpoint */ +#define USB_EHCD_DELETE_FROM_ENDPOINT_LIST(pRequestInfo) \ +{ \ + \ + /* Remove the request from the Endpoint list - Start */ \ + \ + /* Extract the pipe pointer for the request */ \ + \ + pUSB_EHCD_PIPE pHCDPipe = pRequestInfo->pHCDPipe; \ + \ + /* Check if it is the head element */ \ + \ + if (pRequestInfo == pHCDPipe->pRequestQueueHead) \ + { \ + /* If it is the only element, \ + * update the head and tail pointers to NULL */ \ + \ + if (pRequestInfo == pHCDPipe->pRequestQueueTail) \ + { \ + pHCDPipe->pRequestQueueTail = NULL; \ + pHCDPipe->pRequestQueueHead = NULL; \ + \ + } \ + \ + /* Update the head element */ \ + else \ + { \ + pHCDPipe->pRequestQueueHead = pRequestInfo->pNext; \ + } \ + } \ + \ + /* if it is not head element */ \ + else \ + { \ + pUSB_EHCD_REQUEST_INFO pTempRequestInfo; \ + \ + /* Search for the request in the list */ \ + \ + for (pTempRequestInfo = pHCDPipe->pRequestQueueHead; \ + (NULL != pTempRequestInfo) && \ + (pTempRequestInfo->pNext != pRequestInfo); \ + pTempRequestInfo = pTempRequestInfo->pNext); \ + \ + if (pTempRequestInfo != NULL) \ + { \ + /* Update the next pointers */ \ + pTempRequestInfo->pNext = pRequestInfo->pNext; \ + } \ + } \ + /* Remove the request from the Endpoint list - End */ \ + \ +} + +/* This macro is used to to delete the request from request list maintained + * for the endpoint */ +#define USB_EHCD_DELETE_FROM_HCD_LIST(pRequestInfo, pEHCDData) \ +{ \ + \ + /* If this is the head element */ \ + \ + if (pRequestInfo == pEHCDData->pRequestQueueHead) \ + { \ + /* Update the head of the request list */ \ + pEHCDData->pRequestQueueHead = pRequestInfo->pListRequest; \ + \ + /* Update the tail to NULL if the head is NULL */ \ + if (NULL == pEHCDData->pRequestQueueHead) \ + { \ + pEHCDData->pRequestQueueTail = NULL; \ + } \ + } \ + else \ + { \ + /* if it is not head element */ \ + pUSB_EHCD_REQUEST_INFO pTempRequestInfo; \ + \ + /* Search for the request in the list */ \ + \ + for (pTempRequestInfo = pEHCDData->pRequestQueueHead; \ + (NULL != pTempRequestInfo) && \ + (pTempRequestInfo->pListRequest != pRequestInfo); \ + pTempRequestInfo = pTempRequestInfo->pListRequest); \ + \ + /* If the temporary request pointer is NULL, \ + * it is an error \ + */ \ + OS_ASSERT(NULL != pTempRequestInfo); \ + \ + /* Update the next pointers */ \ + pTempRequestInfo->pListRequest = pRequestInfo->pListRequest; \ + \ + /* If List Request for TempRequest is NULL, the update \ + Tail to Temp request */ \ + \ + if (NULL == pTempRequestInfo->pListRequest) \ + { \ + pEHCDData->pRequestQueueTail = pTempRequestInfo; \ + } \ + } \ +} + +/* This macro is used to to delete the request from request list maintained + * for the endpoint */ +#define USB_EHCD_UNLINK_ISOCH_REQ(pEHCDData, pRequestInfo, uSpeed) \ +{ \ + /* If it is a full speed isochronous endpoint, \ + * update the SITD's link pointers */ \ + \ + if (USBHST_FULL_SPEED == uSpeed) \ + { \ + \ + /* Pointer to the SITD data structure */ \ + \ + pUSB_EHCD_SITD pSITD = NULL; \ + \ + /* Unlinking all SITDs from hardware frame list. */ \ + \ + /* Extract the head of the request */ \ + pSITD = (pUSB_EHCD_SITD)pRequestInfo->pHead; \ + \ + /* Remove all the SITDs from request list. */ \ + while (NULL != pSITD) \ + { \ + usbEhcdUnLinkSITD(pEHCDData, pSITD); \ + pSITD = pSITD->pVerticalNext; \ + } \ + \ + } /* End of Full speed isochronous endpoint removal handling */\ + \ + /* It is a high speed endpoint, update the ITD's link pointers */ \ + else \ + { \ + /* Pointer to the ITD data structure */ \ + \ + pUSB_EHCD_ITD pITD = NULL; \ + \ + /* Unlinking all ITDs from hardware frame list. */ \ + \ + /* Extract the head of the request */ \ + pITD = (pUSB_EHCD_ITD)pRequestInfo->pHead; \ + \ + /* Remove all the SITDs from request list. */ \ + while (NULL != pITD) \ + { \ + usbEhcdUnLinkITD(pEHCDData, pITD); \ + pITD = pITD->pVerticalNext; \ + } \ + \ + }/* End of high speed isochronous endpoint removal handling */ \ +} + + +/* This macro is used to calculate the bandwidth occupied in the frame */ +#define USB_EHCD_CALCULATE_FRAME_BANDWIDTH(pEHCDData, uFrameIndex, uCalBandwidth) \ +{ \ + /* To hold the index into the microframe array */ \ + UINT32 uMicroFrameCount = 0; \ + \ + /* This loop adds up the bandwidth in every microframe */ \ + for (uMicroFrameCount = 0; \ + uMicroFrameCount < USB_EHCD_MAX_MICROFRAME_NUMBER; \ + uMicroFrameCount++) \ + { \ + uCalBandwidth += \ + pEHCDData->FrameBandwidth[uFrameIndex][uMicroFrameCount]; \ + } \ +} + +/*This macro is used to calculate the bandwidth occupied in the microframes + specified by the mask. */ +#define USB_EHCD_CALCULATE_BW_MICROFRAMES(pHCDData, \ + uFrameMask, \ + uFrameIndex, \ + uCalBandwidth) \ +{ \ + /* To hold the index into the microframes in a frame */ \ + UINT8 uIndex = 0; \ + \ + /* \ + * If this microframe is to be acounted \ + * for bandwidth calculation, calculate \ + */ \ + for (uIndex = 0; USB_EHCD_MAX_MICROFRAME_NUMBER > uIndex; uIndex++) \ + { \ + /* Check if this microframe's bandwidth is to be calculated */ \ + if (0 != ((uFrameMask >> uIndex) & 0x01)) \ + { \ + uCalBandwidth += pHCDData->FrameBandwidth[uFrameIndex][uIndex]; \ + } \ + } \ +} +/* This macro is used to calculate the traversal count */ + #define USB_EHCD_CALCULATE_TRAVERSAL_COUNT(uPollInterval, uTraversalCount) \ +{ \ + /* \ + * If the pollinterval is between 32(not including 32) and 16 \ + * the list needs to be traversed once \ + */ \ + if (16 <= uPollInterval) \ + { \ + uTraversalCount = 1; \ + } \ + /* Pollinterval lies between 8 and 16(excluded) */ \ + else if (8 <= uPollInterval) \ + { \ + uTraversalCount = 2; \ + } \ + /* Pollinterval lies between 4 and 8(excluded) */ \ + else if (4 <= uPollInterval) \ + { \ + uTraversalCount = 3; \ + } \ + /* Pollinterval lies between 2 and 4(excluded) */ \ + else if (2 <= uPollInterval) \ + { \ + uTraversalCount = 4; \ + } \ + /* Polling interval is 1 */ \ + else \ + { \ + uTraversalCount = 5; \ + } \ +} + +/* This macro is used to calculate the traversal count */ + #define USB_EHCD_CALCULATE_LEAF_START_INDEX(uPollInterval, uTreeListCount) \ +{ \ + /* \ + * If the pollinterval is between 32(not including 32) and 16 \ + * the list needs to be traversed once \ + */ \ + if (16 <= uPollInterval) \ + { \ + uTraversalCount = 1; \ + } \ + /* Pollinterval lies between 8 and 16(excluded) */ \ + else if (8 <= uPollInterval) \ + { \ + uTraversalCount = 2; \ + } \ + /* Pollinterval lies between 4 and 8(excluded) */ \ + else if (4 <= uPollInterval) \ + { \ + uTraversalCount = 3; \ + } \ + /* Pollinterval lies between 2 and 4(excluded) */ \ + else if (2 <= uPollInterval) \ + { \ + uTraversalCount = 4; \ + } \ + /* Polling interval is 1 */ \ + else \ + { \ + uTraversalCount = 5; \ + } \ +} + +#define USB_EHCD_GET_POLL_INTERVAL(uPollInterval) \ +{ \ + /* Calculate the polling interval in terms of frames */ \ + \ + if (0 != (uPollInterval % USB_EHCD_MAX_MICROFRAME_NUMBER)) \ + { \ + uPollInterval = 1; \ + } \ + else \ + { \ + uPollInterval /= USB_EHCD_MAX_MICROFRAME_NUMBER; \ + } \ + \ + /* If the bandwidth is more than what is supported, \ + * update the polling interval to the supported polling interval \ + */ \ + \ + if (USB_EHCD_MAX_USB11_INTERRUPT_POLL_INTERVAL < \ + uPollInterval) \ + { \ + uPollInterval = USB_EHCD_MAX_USB11_INTERRUPT_POLL_INTERVAL; \ + } \ +} + +#define USB_EHCD_GET_ISOCH_BANDWIDTH(pHCDData, IsochBW) \ +{ \ + UINT32 uFrameIndex, uUFrameIndex; \ + for (uFrameIndex = 0; \ + USB_EHCD_MAX_FRAMELIST_SIZE > uFrameIndex; \ + uFrameIndex++) \ + { \ + for (uUFrameIndex = 0; \ + USB_EHCD_MAX_MICROFRAME_NUMBER > uUFrameIndex; \ + uUFrameIndex++) \ + { \ + IsochBW[uFrameIndex][uUFrameIndex] \ + = pHCDData->FrameListData[uFrameIndex]. \ + uBandwidth[uUFrameIndex]; \ + } \ + } \ +} + +#define USB_EHCD_GET_INTERRUPT_BANDWIDTH(pHCDData, InterruptBW) \ +{ \ + UINT32 uFrameIndex, uUFrameIndex; \ + for (uFrameIndex = 0; \ + USB_EHCD_MAX_TREE_NODES > uFrameIndex; \ + uFrameIndex++) \ + { \ + for (uUFrameIndex = 0; \ + USB_EHCD_MAX_MICROFRAME_NUMBER > uUFrameIndex; \ + uUFrameIndex++) \ + { \ + InterruptBW[uFrameIndex][uUFrameIndex] \ + = pHCDData->TreeListData[uFrameIndex]. \ + uBandwidth[uUFrameIndex]; \ + } \ + } \ +} + + +#define USB_EHCD_GET_FRAME_BANDWIDTH(pHCDData, IsochBW, InterruptBW, pTotalFrameBW) \ +{ \ + UINT32 uFrameIndex, uUFrameIndex, uBandwidth, uTreeListIndex; \ + /* This loop calculates bandwidth for each frame */ \ + \ + for (uFrameIndex =0; \ + USB_EHCD_MAX_FRAMELIST_SIZE > uFrameIndex; \ + uFrameIndex++) \ + { \ + /* This loop will calculates bandwidth for \ + each microframes in a frame */ \ + \ + for (uUFrameIndex = 0; \ + USB_EHCD_MAX_MICROFRAME_NUMBER > uUFrameIndex; \ + uUFrameIndex++) \ + { \ + \ + /* Copy the bandwidth occupied \ + * in the frame by isochronous endpoints \ + */ \ + uBandwidth = IsochBW[uFrameIndex][uUFrameIndex]; \ + \ + /* Hold the index of the list into the periodic tree */ \ + \ + uTreeListIndex \ + = pHCDData->FrameListData[uFrameIndex].uNextListIndex; \ + \ + /* This loop calculates the bandwidth for \ + tree list data in the microframe \ + */ \ + \ + for (; ((int)uTreeListIndex != USB_EHCD_NO_LIST); \ + uTreeListIndex \ + = pHCDData->TreeListData[uTreeListIndex]. \ + uNextListIndex) \ + \ + { \ + uBandwidth += \ + InterruptBW[uTreeListIndex][uUFrameIndex]; \ + } \ + \ + pTotalFrameBW[uFrameIndex] += uBandwidth; \ + } /* End of loop for each microframe */ \ + } /* End of loop for each frame */ \ + \ +} + + + +/* function declarations */ + +extern VOID usbEhcdFreeAllLists(VOID); + +extern VOID * usbEhcdAlign + ( + VOID * pMemory, + UINT32 uAlignment + ); + +extern pUSB_EHCD_QH usbEhcdFormEmptyQH + ( + pUSB_EHCD_DATA pHCDData + ); + +extern INT32 usbEhcdCalculateBusTime + ( + UINT32 uSpeed, + UINT32 uDirection, + UINT32 uPipeType, + UINT32 uDataByteCount + ); + +extern BOOLEAN usbEhcdCheckBandwidth + ( + pUSB_EHCD_DATA pHCDData, + ULONG uBandwidth, + UINT32 uSpeed, + pUSBHST_ENDPOINT_DESCRIPTOR pEndpointDesc, + UINT32 * puListIndex, + UINT32 * puMicroFrameMask + ); + +extern BOOLEAN usbEhcdAddToFreeQHList + ( + pUSB_EHCD_QH pQH + ); + +extern BOOLEAN usbEhcdAddToFreeQTDList + ( + pUSB_EHCD_QTD pQTD + ); + +extern BOOLEAN usbEhcdAddToFreeITDList + ( + pUSB_EHCD_ITD pITD + ); + +extern BOOLEAN usbEhcdAddToFreeSITDList + ( + pUSB_EHCD_SITD pSITD + ); + +extern pUSB_EHCD_QTD usbEhcdGetFreeQTD + ( + UINT32 uSize + ); + +extern pUSB_EHCD_QH usbEhcdGetFreeQH + ( + UINT32 uSize + ); + +extern pUSB_EHCD_ITD usbEhcdGetFreeITD + ( + UINT32 uSize + ); + +extern pUSB_EHCD_SITD usbEhcdGetFreeSITD + ( + UINT32 uSize + ); + +extern pUSB_EHCD_QTD usbEhcdFormEmptyQTD + ( + pUSB_EHCD_DATA pHCDData + ); + +extern VOID usbEhcdUpdateNonIsochStatusAndBytes + ( + UINT8 index, + pUSB_EHCD_QTD pHead, + pUSB_EHCD_QTD pTail, + pUSBHST_URB pUrb + ); + +extern VOID usbEhcdUpdateITDData + ( + UINT8 index, + pUSB_EHCD_ITD pHead, /* Pointer to the head QTD */ + pUSB_EHCD_ITD pTail, /* Pointer to the tail QTD */ + pUSBHST_ISO_PACKET_DESC pPacketDes, /* Pointer to the Packet descriptor */ + UINT8 uMicroFrameMask + ); + +extern VOID usbEhcdUpdateSITDData + ( + UINT8 index, + pUSB_EHCD_SITD pHead, /* Pointer to the head QTD */ + pUSB_EHCD_SITD pTail, /* Pointer to the tail QTD */ + pUSBHST_ISO_PACKET_DESC pPacketDes /* Pointer to the Packet descriptor */ + ); + +extern VOID usbEhcdUnLinkSITD + ( + pUSB_EHCD_DATA pHCDData, /* Pointer to the EHCD_DATA structure */ + pUSB_EHCD_SITD pSITD /* Pointer to the tail SITD */ + ); + +extern VOID usbEhcdUnLinkITD + ( + pUSB_EHCD_DATA pHCDData, /* Pointer to the EHCD_DATA structure */ + pUSB_EHCD_ITD pITD /* Pointer to the tail SITD */ + ); + +extern BOOLEAN usbEhcdCopyRHInterruptData + ( + pUSB_EHCD_DATA pHCDData, + UINT32 uStatusChange + ); + +extern BOOLEAN usbEhcdUpdateBandwidth + ( + pUSB_EHCD_DATA pHCDData + ); + +extern UINT32 usbEhcdFillQTDBuffer + ( + UINT8 index, + pUSB_EHCD_QTD pQTD, + VOID * pBuffer, + UINT32 uSize, + UINT32 uMaxPacketSize + ); +extern BOOLEAN usbEhcdCreateQTDs + ( + pUSB_EHCD_DATA pHCDData, + pUSB_EHCD_QTD *ppDataHead, + pUSB_EHCD_QTD *ppDataTail, + UCHAR * pTransferBuffer, + UINT32 uTransferLength, + UINT32 uMaximumPacketSize, + UINT8 uToggle, + UINT8 uPID + ); +extern VOID usbEhcdLinkITDs + ( + pUSB_EHCD_PIPE pHCDPipe, + pUSB_EHCD_DATA pHCDData, + UINT32 uFrameNumber, + pUSB_EHCD_ITD pHead, + pUSB_EHCD_ITD pTail + ); + +extern VOID usbEhcdLinkSITDs + ( + pUSB_EHCD_PIPE pHCDPipe, + pUSB_EHCD_DATA pHCDData, + UINT32 uFrameNumber, + pUSB_EHCD_SITD pHead, + pUSB_EHCD_SITD pTail + ); + +extern BOOLEAN usbEhcdGenerateITDs + ( + pUSB_EHCD_DATA pHCDData, + pUSB_EHCD_PIPE pHCDPipe, + pUSB_EHCD_ITD *ppHead, + pUSB_EHCD_ITD *ppTail, + UCHAR *pBuffer, + UINT32 uPktCnt, + pUSBHST_ISO_PACKET_DESC pIsocPktDesc + ); + +extern BOOLEAN usbEhcdGenerateSITDs + ( + pUSB_EHCD_DATA pHCDData, + pUSB_EHCD_PIPE pHCDPipe, + pUSB_EHCD_SITD *ppDataHead, + pUSB_EHCD_SITD *ppDataTail, + UCHAR *pTransferBuffer, + UINT32 uPktCnt, + pUSBHST_ISO_PACKET_DESC pIsocPktDesc + ); + +extern USBHST_STATUS usbEhcdSubBandwidth + ( + pUSB_EHCD_DATA pHCDData, + UINT32 uDeviceAddress, + UINT32 uDeviceSpeed, + pUSBHST_INTERFACE_DESCRIPTOR pInterfaceDesc, + UINT32 * pTotalFrameBW + ); + +extern USBHST_STATUS usbEhcdSubDeviceBandwidth + ( + pUSB_EHCD_DATA pHCDData, + UINT32 uDeviceAddress, + UINT32 * pTotalFrameBW + ); + +extern BOOLEAN usbEhcdAddBandwidth + ( + UINT32 uDeviceSpeed, + pUSBHST_INTERFACE_DESCRIPTOR pInterfaceDesc, + UINT32 * pTotalFrameBW + ); + + +#ifdef __cplusplus +} +#endif + +#endif /* End of __INCusbEhcdUtilh */ +/************************* End of file usbEhcdUtil.h***************************/ + + + diff --git a/h/usb2/usbHcdInstr.h b/h/usb2/usbHcdInstr.h new file mode 100644 index 0000000..c0c85de --- /dev/null +++ b/h/usb2/usbHcdInstr.h @@ -0,0 +1,90 @@ +/* usbHcdInstr.h - WindView Instrumentation definitions for HCD module */ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +modification history +-------------------- +01b,22sep04,tcr move event ids from user-event range +01a,03jun03,nld Initial Version +*/ + +/* +DESCRIPTION + +This file contains the definitions for the WindView Instrumentation for all +three HCD modules i.e. EHCD, OHCD and UHCD. +*/ + +#ifndef __INCusbHcdInstrh +#define __INCusbHcdInstrh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +/* Event IDs for EHCD module */ +#define USB_EHCI_WV_INIT_EXIT 10150 +#define USB_EHCI_WV_EVENT_HANDLER 10151 +#define USB_EHCI_WV_PORT_ROUTE 10152 +#define USB_EHCI_WV_TRANSFER 10153 + +/* Event IDs for OHCD module */ +#define USB_OHCI_WV_INIT_EXIT 10160 +#define USB_OHCI_WV_EVENT_HANDLER 10161 +#define USB_OHCI_WV_TRANSFER 10162 + +/* Event IDs for UHCD module */ +#define USB_UHCI_WV_INIT_EXIT 10170 +#define USB_UHCI_WV_EVENT_HANDLER 10171 +#define USB_UHCI_WV_TRANSFER 10172 + +/* Event IDs for USBD module */ +#define USB_USBD_WV_INIT_EXIT 10180 +#define USB_USBD_WV_REGISTER 10181 +#define USB_USBD_WV_DEVICE 10182 +#define USB_USBD_WV_REQUEST 10183 + + +/* Event IDs for HUB module */ +#define USB_HUB_WV_INIT_EXIT 10190 +#define USB_HUB_WV_EVENT_HANDLER 10191 +#define USB_HUB_WV_DEVICE 10192 +#define USB_HUB_WV_TRANSFER 10193 + + +/* Event filters */ +#define USB_EHCD_WV_FILTER 0x00000001 +#define USB_OHCD_WV_FILTER 0x00000002 +#define USB_UHCD_WV_FILTER 0x00000004 +#define USB_USBD_WV_FILTER 0x00000008 +#define USB_HUB_WV_FILTER 0x0000000F + +extern void usb2WindViewLog (UINT32, char *, UINT32); + +/* Macro to log the instrumentation event */ +#define USB_HCD_LOG_EVENT(eventId, eventBuf, USB2_FILTER) \ + usb2WindViewLog(eventId, eventBuf, USB2_FILTER); + +#define USB_USBD_LOG_EVENT(eventId, eventBuf, USB2_FILTER) \ + usb2WindViewLog(eventId, eventBuf, USB2_FILTER); + +#define USB_HUB_LOG_EVENT(eventId, eventBuf, USB2_FILTER) \ + usb2WindViewLog(eventId, eventBuf, USB2_FILTER); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbHcdInstrh */ + +/* End of file usbHcdInstr.h */ + diff --git a/h/usb2/usbHst.h b/h/usb2/usbHst.h new file mode 100644 index 0000000..72af4a4 --- /dev/null +++ b/h/usb2/usbHst.h @@ -0,0 +1,1420 @@ +/* usbHst.h - USB Host Stack functional interface definition */ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +Modification history +-------------------- +01b,02jun03,nrv Changing the code to WRS standards +*/ + +/* +DESCRIPTION + +This file contains the application interface to the USB2 Host Stack. + +*/ + + +/* +INTERNAL + ******************************************************************************* + * Filename : Usbhst.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : This file contains the data structures for usbd and other + * modules. +\ * + ******************************************************************************/ + +#ifndef __USBHST_H__ +#define __USBHST_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "usbOsal.h" + +/********************** MACRO DEFINITION **************************************/ + + +/* Device class for vendor specific*/ +#define USBHST_VENDOR_SPECIFIC 0xFF + +/* Hub class code*/ +#define USBHST_HUB_CLASS 0x09 + +/* Timeout value for URB requests */ +#define USBHST_URB_TIMEOUT \ + OS_CONVERT_MILLISECONDS_TO_WAIT_VALUE(30000) + +/* To hold the URB transfer flags (BEGIN) */ + +/* Flag to specify that a short transfer is acceptable */ +#define USBHST_SHORT_TRANSFER_OK 0x01 + +/* + * Flag to specify that the isochronous transfer should be started as + * soon as possible. + */ +#define USBHST_START_ISOCHRONOUS_TRANSFER_ASAP 0x02 + +/* To hold the URB transfer flags (END) */ + +/* + * Default configuration index is used with USBHST_SetConfiguration () + * to set the device into address state. + */ +#define USBHST_DEFAULT_CONFIGURATION_INDEX 0xFF + +/* Default interface value */ +#define USBHST_DEFAULT_INTERFACE_VALUE 0x00 + +/************* Three different speeds - Start *********************************/ + +/* Full speed mode */ +#define USBHST_FULL_SPEED ((UINT8)0x00) + +/* Low speed mode */ +#define USBHST_LOW_SPEED ((UINT8)0x01) + +/* High Speed mode */ +#define USBHST_HIGH_SPEED ((UINT8)0x02) + +/************* Three different speeds - End ***********************************/ + +/******************* To hold the USB Transfer Types (BEGIN) *******************/ + +/* Value to specific an USB Control Transfer */ +#define USBHST_CONTROL_TRANSFER 0x00 + +/* Value to specific an USB Isochronous Transfer */ +#define USBHST_ISOCHRONOUS_TRANSFER 0x01 + +/* Value to specific an USB Bulk Transfer */ +#define USBHST_BULK_TRANSFER 0x02 + +/* Value to specific an USB Interrupt Transfer */ +#define USBHST_INTERRUPT_TRANSFER 0x03 + +/******************** To hold the USB Transfer Types (END) ********************/ + +/************* Different types of Feature Selector - Start ********************/ + +/* Endpoint halt for the endpoints */ +#define USBHST_FEATURE_ENDPOINT_HALT ((UINT16)0x00) + +/* Remote wakeup for the device */ +#define USBHST_FEATURE_DEVICE_REMOTE_WAKEUP ((UINT16)0x01) + +/* Test mode feature for the endpoints */ +#define USBHST_FEATURE_TEST_MODE ((UINT16)0x02) + +/************** Different types of Feature Selector - End *********************/ + + + +/************** Different test selectors values - Start ***********************/ + +/* Test selector for TEST_J */ +#define USBHST_TEST_J ((UINT8)0x01) + +/* Test selector for TEST_K */ +#define USBHST_TEST_K ((UINT8)0x02) + +/* Test selector for TEST_SE0_NAK */ +#define USBHST_TEST_SE0_NAK ((UINT8)0x03) + +/* Test selector for TEST_PACKET */ +#define USBHST_TEST_PACKET ((UINT8)0x04) + +/* Test selector for TEST_FORCE_ENABLE */ +#define USBHST_ TEST_FORCE_ENABLE ((UINT8)0x05) + + +/************** Different test selectors values - End ************************/ + + +/************** Different recipient types - Start ****************************/ + +/* Recipient is device */ +#define USBHST_RECIPIENT_DEVICE 0x00 + +/* Recipient is interface */ +#define USBHST_RECIPIENT_INTERFACE 0x01 + +/* Recipient is endpoint */ +#define USBHST_RECIPIENT_ENDPOINT 0x02 + +/* Other recipients */ +#define USBHST_RECIPIENT_OTHER 0x03 + +/************** Different recipient types - End ******************************/ + +/************** Different descriptor types - Start ***************************/ + +/* Defines device descriptor */ +#define USBHST_DEVICE_DESC ((UINT8) 0x01) + +/* Defines configuration descriptor */ +#define USBHST_CONFIG_DESC ((UINT8) 0x02) + +/* Defines string descriptor */ +#define USBHST_STRING_DESC ((UINT8) 0x03) + +/* Defines interface descriptor */ +#define USBHST_INTERFACE_DESC ((UINT8) 0x04) + +/* Defines endpoint descriptor */ +#define USBHST_ENDPOINT_DESC ((UINT8) 0x05) + + + +/* defines the device qualifier */ +#define USBHST_DEVICE_QUALIFIER_DESC ((UINT8) 0x06) + +/* defines the other speed configuration descriptor */ +#define USBHST_OTHER_SPEED_CONFIG_DESC ((UINT8) 0x07) + +/* defines the interface power descriptor */ +#define USBHST_INTERFACE_POWER_DESC ((UINT8) 0x08) + +/************** Different descriptor types - End *****************************/ + + +/************** Different Standard Request codes - Start **********************/ + +#define USBHST_REQ_GET_STATUS ((UINT8) 0x00) +#define USBHST_REQ_CLEAR_FEATURE ((UINT8) 0x01) +#define USBHST_REQ_SET_FEATURE ((UINT8) 0x03) +#define USBHST_REQ_SET_ADDRESS ((UINT8) 0x05) +#define USBHST_REQ_GET_DESCRIPTOR ((UINT8) 0x06) +#define USBHST_REQ_SET_DESCRIPTOR ((UINT8) 0x07) +#define USBHST_REQ_GET_CONFIGURATION ((UINT8) 0x08) +#define USBHST_REQ_SET_CONFIGURATION ((UINT8) 0x09) +#define USBHST_REQ_GET_INTERFACE ((UINT8) 0x0A) +#define USBHST_REQ_SET_INTERFACE ((UINT8) 0x0B) +#define USBHST_REQ_SYNCH_FRAME ((UINT8) 0x0C) + +/************** Different Standard Request codes - End ************************/ + +/************** Different USB status codes - Start ****************************/ + +#define USBHST_STATUS INT8 +#define USBHST_SUCCESS ((INT8)0) +#define USBHST_TRANSFER_COMPLETED ((INT8)1) +#define USBHST_FAILURE ((INT8)-1) +#define USBHST_MEMORY_NOT_ALLOCATED ((INT8)-2) +#define USBHST_INSUFFICIENT_BANDWIDTH ((INT8)-3) +#define USBHST_INSUFFICIENT_MEMORY ((INT8)-4) +#define USBHST_INSUFFICIENT_RESOURCE ((INT8)-5) +#define USBHST_INVALID_REQUEST ((INT8)-6) +#define USBHST_INVALID_PARAMETER ((INT8)-7) +#define USBHST_STALL_ERROR ((INT8)-8) +#define USBHST_DEVICE_NOT_RESPONDING_ERROR ((INT8)-9) +#define USBHST_DATA_OVERRUN_ERROR ((INT8)-10) +#define USBHST_DATA_UNDERRUN_ERROR ((INT8)-11) +#define USBHST_BUFFER_OVERRUN_ERROR ((INT8)-12) +#define USBHST_BUFFER_UNDERRUN_ERROR ((INT8)-13) +#define USBHST_TRANSFER_CANCELLED ((INT8)-14) +#define USBHST_TIMEOUT ((INT8)-15) +#define USBHST_BAD_START_OF_FRAME ((INT8)-16) + +/************** Different USB status codes - End ******************************/ + + +/******************************************************************************* + * Macro Name : USBHST_FILL_SETUP_PACKET + * Description : Initialize the SETUP_PACKET structure with the requisite + * parameter. + * Parameters : pSetup OUT Setup packet to be filled. + * uRequestType IN Bitmap for request characteristics. + * uRequest IN Standard request code. + * uValue IN Word size value field for standard request. + * uIndex IN Word size index field for standard request. + * uSize IN Number of bytes to transfer if there is + * data stage. + * Return Type : None + ******************************************************************************/ +#define USBHST_FILL_SETUP_PACKET(pSetup, \ + uRequestType, \ + uRequest, \ + uValue, \ + uIndex, \ + uSize) \ +{ \ + /* Store bitmap for request characteristics in the setup packet */ \ + (pSetup)->bmRequestType = (UINT8)(uRequestType); \ + \ + /* Store the request in the setup packet */ \ + (pSetup)->bRequest = (UINT8)(uRequest); \ + \ + /* Store word size value field for request in the setup packet */ \ + (pSetup)->wValue = OS_UINT16_CPU_TO_LE((UINT16)(uValue)); \ + \ + /* Store word size index field for request in the setup packet */ \ + (pSetup)->wIndex = OS_UINT16_CPU_TO_LE((UINT16)(uIndex)); \ + \ + /* Store number of bytes to transfer if there is data stage */ \ + (pSetup)->wLength = OS_UINT16_CPU_TO_LE((UINT16)(uSize)); \ +} + +/******************************************************************************* + * Macro Name : USBHST_FILL_CONTROL_URB + * Description : Initialize the URB with requisite parameters for control + * transfer. + * Parameters : Urb OUT Pointer to URB. + * Device IN Handle to the Device. + * EndPointAddress IN End Point Address for which URB is + * issued. + * TransferBuffer OUT Pointer to the buffer passed as + * parameter. + * TransferLength IN Length of the data transfer + * requested. + * TransferFlags IN Flags for data transfer. + * SetupPacket IN Pointer to setup packet. + * Callback IN Pointer to the callback function. + * Context IN Class driver specific URB information + * Status OUT Status of the request. + * Return Type : None + ******************************************************************************/ +#define USBHST_FILL_CONTROL_URB(Urb, \ + Device, \ + EndPointAddress, \ + TransferBuffer, \ + TransferLength, \ + TransferFlags, \ + SetupPacket, \ + Callback, \ + Context, \ + Status) \ +{ \ + /* Store the handle to the Device */ \ + (Urb)->hDevice = (Device); \ + \ + /* Store the end Point Address for which Urb is issued */ \ + (Urb)->uEndPointAddress = (EndPointAddress); \ + \ + /* Store pointer to the buffer passed as parameter */ \ + (Urb)->pTransferBuffer = (TransferBuffer); \ + \ + /* Store length of the data transfer requested */ \ + (Urb)->uTransferLength = (TransferLength); \ + \ + /* Store flags for data transfer */ \ + (Urb)->uTransferFlags = (TransferFlags); \ + \ + /* Store pointer to setup packet */ \ + (Urb)->pTransferSpecificData = (SetupPacket); \ + \ + /* Store the pointer to the callback function */ \ + (Urb)->pfCallback = (Callback); \ + \ + /* Store Class driver specific URB information */ \ + (Urb)->pContext = (Context); \ + \ + /* Store the status of the request */ \ + (Urb)->nStatus = (Status); \ +} + +/******************************************************************************* + * Macro Name : USBHST_FILL_BULK_URB + * Description : Initialize the URB with requisite parameters for bulk transfer. + * Parameters : Urb OUT Pointer to URB + * Device IN Handle to the Device + * EndPointAddress IN End Point Address for which URB is + * issued. + * TransferBuffer OUT Pointer to the buffer passed as + * parameter. + * TransferLength IN Length of the data transfer + * requested. + * TransferFlags IN Flags for data transfer. + * Callback IN Pointer to the callback function. + * Context IN Class driver specific URB information + * Status OUT Status of the request. + * Return Type : None + ******************************************************************************/ +#define USBHST_FILL_BULK_URB(Urb, \ + Device, \ + EndPointAddress, \ + TransferBuffer, \ + TransferLength, \ + TransferFlags, \ + Callback, \ + Context, \ + Status) \ +{ \ + /* Store the handle to the Device */ \ + (Urb)->hDevice = (Device); \ + \ + /* Store the end Point Address for which URB is issued */ \ + (Urb)->uEndPointAddress = (EndPointAddress); \ + \ + /* Store pointer to the buffer passed as parameter */ \ + (Urb)->pTransferBuffer = (TransferBuffer); \ + \ + /* Store length of the data transfer requested */ \ + (Urb)->uTransferLength = (TransferLength); \ + \ + /* Store flags for data transfer */ \ + (Urb)->uTransferFlags = (TransferFlags); \ + \ + /* Store pointer to setup packet */ \ + (Urb)->pTransferSpecificData = NULL; \ + \ + /* Store the pointer to the callback function */ \ + (Urb)->pfCallback = (Callback); \ + \ + /* Store Class driver specific URB information */ \ + (Urb)->pContext = (Context); \ + \ + /* Store the status of the request */ \ + (Urb)->nStatus = (Status); \ +} + +/******************************************************************************* + * Macro Name : USBHST_FILL_INTERRUPT_URB + * Description : Initialize the URB with requisite parameters for interrupt + * transfer. + * Parameters : Urb OUT Pointer to URB + * Device IN Handle to the Device + * EndPointAddress IN End Point Address for which URB is + * issued. + * TransferBuffer OUT Pointer to the buffer passed as + * parameter. + * TransferLength IN Length of the data transfer + * requested. + * TransferFlags IN Flags for data transfer. + * Callback IN Pointer to the callback function. + * Context IN Class driver specific URB information + * Status OUT Status of the request. + * Return Type : None +*******************************************************************************/ +#define USBHST_FILL_INTERRUPT_URB(Urb, \ + Device, \ + EndPointAddress, \ + TransferBuffer, \ + TransferLength, \ + TransferFlags, \ + Callback, \ + Context, \ + Status) \ +{ \ + /* Store the handle to the Device */ \ + (Urb)->hDevice = (Device); \ + \ + /* Store the end Point Address for which URB is issued */ \ + (Urb)->uEndPointAddress = (EndPointAddress); \ + \ + /* Store pointer to the buffer passed as parameter */ \ + (Urb)->pTransferBuffer = (TransferBuffer); \ + \ + /* Store length of the data transfer requested */ \ + (Urb)->uTransferLength = (TransferLength); \ + \ + /* Store flags for data transfer */ \ + (Urb)->uTransferFlags = (TransferFlags); \ + \ + /* Store pointer to setup packet */ \ + (Urb)->pTransferSpecificData = NULL; \ + \ + /* Store the pointer to the callback function */ \ + (Urb)->pfCallback = (Callback); \ + \ + /* Store Class driver specific (Urb) information */ \ + (Urb)->pContext = (Context); \ + \ + /* Store the status of the request */ \ + (Urb)->nStatus = (Status); \ +} + +/******************************************************************************* + * Macro Name : USBHST_FILL_ISOCHRONOUS_URB + * Description : Initialize the URB with requisite parameters for isochronous + * transfer. + * Device IN Handle to the Device + * EndPointAddress IN End Point Address for which URB is + * issued. + * TransferBuffer OUT Pointer to the buffer passed as + * parameter. + * TransferLength IN Length of the data transfer + * requested. + * TransferFlags IN Flags for data transfer. + * StartFrame IN Start of Frame information. + * NumberOfPackets IN Number of packets. + * Callback IN Pointer to the callback function. + * Context IN Class driver specific URB information + * Status OUT Status of the request. + * Return Type : None + ******************************************************************************/ +#define USBHST_FILL_ISOCHRONOUS_URB(Urb, \ + Device, \ + EndPointAddress, \ + TransferBuffer, \ + TransferLength, \ + TransferFlags, \ + StartFrame, \ + NumberOfPackets, \ + IsoPacketDesc, \ + Callback, \ + Context, \ + Status) \ +{ \ + /* Store the handle to the Device */ \ + (Urb)->hDevice = (Device); \ + \ + /* Store the end Point Address for which URB is issued */ \ + (Urb)->uEndPointAddress = (EndPointAddress); \ + \ + /* Store pointer to the buffer passed as parameter */ \ + (Urb)->pTransferBuffer = (TransferBuffer); \ + \ + /* Store length of the data transfer requested */ \ + (Urb)->uTransferLength = (TransferLength); \ + \ + /* Store flags for data transfer */ \ + (Urb)->uTransferFlags = (TransferFlags); \ + \ + /* Store the start of Frame information */ \ + (Urb)->uStartFrame = (StartFrame); \ + \ + /* Store the number of packets */ \ + (Urb)->uNumberOfPackets = (NumberOfPackets); \ + \ + /* Store pointer to setup packet */ \ + (Urb)->pTransferSpecificData = (IsoPacketDesc); \ + \ + /* Store the pointer to the callback function */ \ + (Urb)->pfCallback = (Callback); \ + \ + /* Store Class driver specific URB information */ \ + (Urb)->pContext = (Context); \ + \ + /* Store the status of the request */ \ + (Urb)->nStatus = (Status); \ +} + +/* Header used to identify the descriptor type and length */ +typedef struct usbhst_descriptor_header + { + UINT8 uLength; /* Size of this descriptor in bytes */ + UINT8 uDescriptorType; /* Descriptor Type */ + } __attribute__((packed)) USBHST_DESCRIPTOR_HEADER, + *pUSBHST_DESCRIPTOR_HEADER; + + + +/* Structure to hold the Standard Device Descriptor */ +typedef struct usbhst_device_descriptor + { + UINT8 bLength; /* Size of this descriptor */ + UINT8 bDescriptorType; /* DEVICE Descriptor Type */ + UINT16 bcdUSB; /* BCD USB Spec Release Number */ + UINT8 bDeviceClass; /* Class Class code */ + UINT8 bDeviceSubClass; /* SubClass Subclass code */ + UINT8 bDeviceProtocol; /* Protocol code */ + UINT8 bMaxPacketSize; /* Max packet size for endpoint zero */ + UINT16 idVendor; /* Vendor ID of this interface */ + UINT16 idProduct; /* Product ID of this interface */ + UINT16 bcdDevice; /* BCD Device release number */ + UINT8 iManufacturer; /* Manufacturer string descriptor index */ + UINT8 iProduct; /* Product string descriptor index */ + UINT8 iSerialNumber; /* Dev serial number string descriptor index */ + UINT8 bNumConfigurations; /* Num of possible configurations */ + }__attribute__((packed)) USBHST_DEVICE_DESCRIPTOR, + *pUSBHST_DEVICE_DESCRIPTOR; + + +/* Structure to hold the device qualifier */ +typedef struct usbhst_device_qualifier + { + UINT8 bLength; /* Size of this descriptor in bytes */ + UINT8 bDescriptorType; /* Interface Descriptor Type */ + UINT16 bcdUSB; /* BCD USB Specification release number */ + UINT8 bDeviceClass; /* Device class code */ + UINT8 bDeviceSubClass; /* Device subClass code */ + UINT8 bDeviceProtocol; /* Protocol code */ + UINT8 bMaxPacketSize; /* Max packet size for endpoint zero */ + UINT8 bNumConfigurations; /* Num of possible configurations */ + UINT8 bReserved; /* reserved for future use */ + }__attribute__((packed)) USBHST_DEVICE_QUALIFIER, + *pUSBHST_DEVICE_QUALIFIER; + + + +/* Structure to hold Standard Configuration Descriptor */ +typedef struct usbhst_config_descriptor + { + UINT8 bLength; /* Size of this descriptor in bytes */ + UINT8 bDescriptorType; /* CONFIGURATION Descriptor Type */ + UINT16 wTotalLength; /* Configuration data length */ + UINT8 bNumInterfaces; /* Number of interfaces supported */ + UINT8 bConfigurationValue; /* SetConfiguration() function argument */ + UINT8 iConfiguration; /* Configuration string descriptor */ + UINT8 bmAttributes; /* Bitmap configuration characteristics */ + UINT8 MaxPower; /* Max pwr consumption (mA) of operational device on bus*/ + }__attribute__((packed)) USBHST_CONFIG_DESCRIPTOR, + *pUSBHST_CONFIG_DESCRIPTOR; + +/* Structure to hold Standard Interface Descriptor */ +typedef struct usbhst_interface_descriptor + { + UINT8 bLength; /* Size of this descriptor in bytes */ + UINT8 bDescriptorType; /* Interface Descriptor Type */ + UINT8 bInterfaceNumber; /* Zero-based interface number */ + UINT8 bAlternateSetting; /* Alternate setting for interface */ + UINT8 bNumEndpoints; /* Num of endpoints (excluding endpoint zero)*/ + UINT8 bInterfaceClass; /* Class code of this interface */ + UINT8 bInterfaceSubClass; /* Subclass code of this interface */ + UINT8 bInterfaceProtocol; /* Interface protocol code */ + UINT8 iInterface; /* Interface string descriptor */ + }__attribute__((packed)) USBHST_INTERFACE_DESCRIPTOR, + *pUSBHST_INTERFACE_DESCRIPTOR; + + +/* Structure to hold Standard Endpoint Descriptor */ +typedef struct usbhst_endpoint_descriptor + { + UINT8 bLength; /* Descriptor length in bytes */ + UINT8 bDescriptorType; /* Endpoint Descriptor type */ + UINT8 bEndpointAddress; /* Endpoint address on the USB device */ + UINT8 bmAttributes; /* Endpoint transfer, sych & usage types attr*/ + UINT16 wMaxPacketSize; /* Endpoint max packet size */ + UINT8 bInterval; /* Polling interval for endpoint data xfer */ + }__attribute__((packed)) USBHST_ENDPOINT_DESCRIPTOR, + *pUSBHST_ENDPOINT_DESCRIPTOR; + +/* Structure to hold the String Descriptor */ +typedef struct usbhst_string_descriptor + { + UINT8 bLength; /* Descriptor length in bytes */ + UINT8 bDescriptorType; /* Endpoint Descriptor type */ + UINT16 wUnicodeString[1]; /* UNICODE encoded string */ + }__attribute__((packed)) USBHST_STRING_DESCRIPTOR, + *pUSBHST_STRING_DESCRIPTOR; + +/* + * This structure is used to store the pointers to entry points and class + * driver information + */ +typedef struct usbhst_device_driver + { + BOOL bFlagVendorSpecific; /* Vendor Specific or class specific flag */ + UINT16 uVendorIDorClass; /* Vendor ID (if vendor) or Class Code */ + UINT16 uProductIDorSubClass; /* Dev ID (if vendor) or SubClass Code */ + UINT16 uBCDUSBorProtocol; /* DevRel num (if vendor) or Protocol code */ + + /* + * Function registered as to be called when a matching interface/device + * is connected + */ + USBHST_STATUS (*addDevice) (UINT32 hDevice, + UINT8 uInterfaceNumber, + UINT8 uSpeed, + void **pDriverData); + /* + * Function registered as to be called when a matching interface/device + * is disconnected + */ + void (*removeDevice) (UINT32 hDevice, + void * pDriverData); + /* + * Function registered as to be called when a matching interface/device + * is suspended + */ + void (*suspendDevice) (UINT32 hDevice, + void * pDriverData); + + /* + * Function registered as to be called when a matching interface/device + * is resumed + */ + void (*resumeDevice) (UINT32 hDevice, + void * pDriverData); + } USBHST_DEVICE_DRIVER, *pUSBHST_DEVICE_DRIVER; + + +/* Setup packet structure */ +typedef struct usbhst_setup_packet + { + UINT8 bmRequestType; /* Bitmap for request characteristics */ + UINT8 bRequest; /* Specific request */ + UINT16 wValue; /* Word size value field for specific req */ + UINT16 wIndex; /* Word size index field for specific req */ + UINT16 wLength; /* Num of bytes to transfer if data stage */ + }__attribute__((packed)) USBHST_SETUP_PACKET, + *pUSBHST_SETUP_PACKET; + +/* + * This structure is used to store the information for isochronous + * transfer required by USB request Block + */ +typedef struct usbhst_iso_packet_desc + { + UINT32 uLength; /* Length of data */ + UINT32 uOffset; /* Offset in the pTransferBuffer for data */ + USBHST_STATUS nStatus; /* Per frame status. */ + } USBHST_ISO_PACKET_DESC, *pUSBHST_ISO_PACKET_DESC; + +typedef struct usbhst_urb USBHST_URB, *pUSBHST_URB; +typedef USBHST_STATUS (*pURB_CALLBACK_t)(pUSBHST_URB pURB); + +/* + * This structure is used to store the information required to fill a + * USB Request Block + */ +struct usbhst_urb + { + UINT32 hDevice; /* Device handle */ + UINT8 uEndPointAddress; /* EndPoint addr for which URB issued */ + UCHAR * pTransferBuffer; /* Ptr to the buffer passed as param */ + UINT32 uTransferLength; /* Len of the data transfer requested */ + UINT32 uTransferFlags; /* Flags for data transfer */ + UINT16 uStartFrame; /* Start of Frame information */ + UINT32 uNumberOfPackets; /* Number of packets */ + + + /* + * Pointer to setup packet in case of control transfers + * Pointer to isochronous packet descriptor in case of isochronous transfer. + * NULL in case of bulk and interrupt transfers + */ + void * pTransferSpecificData; + + pURB_CALLBACK_t pfCallback; /* Pointer to the callback function */ + void * pContext; /* Class driver specific URB info */ + USBHST_STATUS nStatus; /* Request status */ + }; + +/* + * This structure is used to store the pointers to USBD entry points that + * are visible to only Hub Class Driver. + */ +typedef struct usbhst_usbd_to_hub_function_list + { + /* + * Pointer to function, which will be called by Hub Class Driver to + * create a new USB device + */ + USBHST_STATUS (*newDevice)(UINT8 uSpeed, + UINT8 uUsbBusIndex, + UINT32 uHighSpeedHub, + UINT8 uHighSpeedHubPortNumber, + UINT32 *pDeviceHandle); + + /* + * Pointer to function, which will be called by Hub Class Driver to + * configure a new USB device + */ + USBHST_STATUS (*configureDevice)(UINT32 hDevice); + + /* + * Pointer to function, which will be called by Hub Class Driver to + * remove a USB device + */ + void (*removeDevice)(UINT32 hDevice); + + /* + * Pointer to function, which will be called by Hub Class Driver to + * suspend a USB device + */ + void (*suspendDevice)(UINT32 hDevice); + + /* + * Pointer to function, which will be called by Hub Class Driver to + * resume a USB device + */ + void (*resumeDevice)(UINT32 hDevice); + + + /* + * Pointer to function, which will be called by Hub Class Driver upon + * completion of Clear TT Request + */ + + USBHST_STATUS (*clearTTComplete)(USBHST_STATUS nStatus, + UINT32 hHighSpeedHub, + void * pContext); + /* + * Pointer to function, which will be called by Hub Class Driver upon + * completion of Reset TT Request + */ + USBHST_STATUS (*resetTTComplete)(USBHST_STATUS nStatus, + UINT32 uHighSpeedHub, + void * pContext); + + + } USBHST_USBD_TO_HUB_FUNCTION_LIST, *pUSBHST_USBD_TO_HUB_FUNCTION_LIST; + + +/* + * This structure is used to store the pointers to USBD entry points that + * are visible only to Enhanced Host Controller(EHCI) Driver. + */ +typedef struct usbHstUsbdToHcdFunctionList +{ + /* + * Pointer to function, which will be called by Host Controller Driver to + * submit clear TT request + */ + USBHST_STATUS (*clearTTRequest)(UINT32 hHCDriver, + UINT8 uRelBusIndex, + UINT8 uHighSpeedHubAddress, + UINT8 uHighSpeedPortNumber, + UINT16 wValue, + void * pContext); + + /* + * Pointer to function, which will be called by Host Controller Driver to + * submit reset TT request + */ + USBHST_STATUS (*resetTTRequest)(UINT32 hHCDriver, + UINT8 uRelBusIndex, + UINT8 uHighSpeedHubAddress, + UINT8 uHighSpeedPortNumber, + void * pContext); + +} USBHST_USBD_TO_HCD_FUNCTION_LIST, *pUSBHST_USBD_TO_HCD_FUNCTION_LIST; + + + +/* This structure contains the hub class driver function pointers */ +typedef struct usbhst_hub_function_list + { + /* Function pointer to suspend a device */ + USBHST_STATUS (*selectiveSuspendDevice)(UINT32 uDeviceHandle); + + /* Function pointer to resume a device */ + USBHST_STATUS (*selectiveResumeDevice) (UINT32 uDeviceHandle); + + /* Function pointer to add a root hub */ + USBHST_STATUS (*addRootHub) (UINT32 uDeviceHandle, + UINT8 uBusHandle, + UINT8 uSpeed); + + /* Function pointer to remove a root hub */ + void (*removeRootHub)(UINT8 uBusHandle); + + /* + * Function pointer to check whether the power required for a device can be + * supported. + */ + USBHST_STATUS (*checkForPower)(UINT32 uDeviceHandle, + UINT8 uPowerRequirement); + + /* Function pointer to reset a device */ + USBHST_STATUS (*resetDevice) (UINT32 uDeviceHandle); + + + + /* Function pointer to submit clear TT request */ + USBHST_STATUS (*clearTT)(UINT32 hHighSpeedHub, + UINT8 uPort, + UINT16 uValue, + void * pContext); + + /* Function pointer to submit reset TT request */ + USBHST_STATUS (*resetTT)(UINT32 hHighSpeedHub, + UINT8 uPort, + void * pContext); + + + + } USBHST_HUB_FUNCTION_LIST, *pUSBHST_HUB_FUNCTION_LIST; + + +typedef union usbHstFunctionList +{ + + USBHST_USBD_TO_HUB_FUNCTION_LIST UsbdToHubFunctionList; + USBHST_HUB_FUNCTION_LIST HubFunctionList; + +}USBHST_FUNCTION_LIST, *pUSBHST_FUNCTION_LIST; + +/* This structure contains the HC driver function pointers */ +typedef struct usbhst_hc_driver + { + /* Number of bus for this host controller */ + UINT8 uNumberOfBus; + + /* Function pointer to get the frame number */ + USBHST_STATUS (*getFrameNumber) (UINT8 uBusIndex, + UINT16 *puFrameNumber); + + /* Function pointer to set the bit rate */ + USBHST_STATUS (*setBitRate) (UINT8 uBusIndex, + BOOL bIncrement, + UINT32 *puCurrentFrameWidth); + + /* Function pointer to check if required bandwidth is avilable */ + USBHST_STATUS (*isBandwidthAvailable) + (UINT8 uBusIndex, + UINT8 uDeviceAddress, + UINT8 uDeviceSpeed, + UCHAR *pCurrentDescriptor, + UCHAR *pNewDescriptor); + + /* Function pointer to create a pipe */ + USBHST_STATUS (*createPipe) (UINT8 uBusIndex, + UINT8 uDeviceAddress, + UINT8 uDeviceSpeed, + UCHAR *pEndPointDescriptor, + UINT16 uHighSpeedHubInfo, + UINT32 *puPipeHandle); + + /* Function pointer to modify the default pipe */ + USBHST_STATUS (*modifyDefaultPipe) + (UINT8 uBusIndex, + UINT32 uDefaultPipeHandle, + UINT8 uDeviceSpeed, + UINT8 uMaxPacketSize, + UINT16 uHighSpeedHubInfo); + + /* Function pointer to delete a pipe */ + USBHST_STATUS (*deletePipe) (UINT8 uBusIndex, + UINT32 uPipeHandle); + + /* Function pointer to check if there is any request pending on the pipe */ + USBHST_STATUS (*isRequestPending)(UINT8 uBusIndex, + UINT32 uPipeHandle); + + /* Function pointer to submit USB request */ + USBHST_STATUS (*submitURB) (UINT8 uBusIndex, + UINT32 uPipeHandle, + pUSBHST_URB pURB); + + /* Function pointer to cancel USB request */ + USBHST_STATUS (*cancelURB) (UINT8 uBusIndex, + UINT32 uPipeHandle, + pUSBHST_URB pURB); + + + + /* Function pointer to submit the status of the clear TT request */ + USBHST_STATUS (*clearTTRequestComplete)(UINT8 uRelativeBusIndex, + void * pContext, + USBHST_STATUS nStatus); + /* Function pointer to submit the status of the reset TT request */ + USBHST_STATUS (*resetTTRequestComplete)(UINT8 uRelativeBusIndex, + void * pContext, + USBHST_STATUS nStatus); + + + } USBHST_HC_DRIVER, *pUSBHST_HC_DRIVER; + + + +/**************************** FUNCTIONS DECLARATION ***************************/ + + +/******************************************************************************* + * Function Name : USBHST_RegisterDriver + * Description : This function registers the class driver with the USB + * Host Stack. This function also associates the devices that + * can be supported by this class driver. + * Parameters : pDeviceDriverInfo IN Information about the class + * driver being registered. + * pContext IN OUT For Non-Hub Class Drivers: + * Not Interpreted. + * For Hub Class Drivers: + * IN: Pointer to structure + * containing function pointers + * required by USBD from Hub Driver + * OUT: Pointer to structure + * containing function pointers + * required by Hub Driver from USBD + * Return Type : USBHST_INVALID_PARAMETER if Parameters are not valid. + * USBHST_INSUFFICIENT_MEMORY Memory could not be allocated + * USBHST_FAILURE if Driver is already registered + * USBHST_SUCCESS if Class driver is registered successfully. + ******************************************************************************/ +extern USBHST_STATUS usbHstDriverRegister + ( + pUSBHST_DEVICE_DRIVER pDeviceDriverInfo, + void **pContext + ); + +/******************************************************************************* + * Function Name : USBHST_DeregisterDriver + * Description : This function deregisters the class driver from the USB + * Host Stack. The class driver is unloaded for all the + * supported devices + * Parameters : pDeviceDriverInfo IN Information about the class driver + * being deregistered + * Return Type : USBHST_INVALID_PARAMETER if Parameters are not valid. + * USBHST_FAILURE if Driver is not found or if it is a hub + * class driver and there are some functional devices present + * USBHST_SUCCESS if class driver deregistered successfully. + ******************************************************************************/ +extern USBHST_STATUS usbHstDriverDeregister + ( + pUSBHST_DEVICE_DRIVER pDeviceDriverInfo + ); + +/******************************************************************************* + * Function Name : USBHST_RegisterHCD + * Description : This function is used to register a Host Controller + * Driver with the USB Host Stack. + * Parameters : pHCDriver IN Information about the Host Controller + * Driver being registered. + * phHCDriver OUT Parameter to hold the handle for HC + * Driver. + * Return Type : USBHST_INVALID_PARAMETER if Parameters are not valid. + * USBHST_INSUFFICIENT_RESOURCE if Resources are not + * sufficient. + * USBHST_SUCCESS if Host Controller Driver is registered + * successfully. + ******************************************************************************/ +extern USBHST_STATUS usbHstHCDRegister + ( + pUSBHST_HC_DRIVER pHCDriver, + UINT32 *phHCDriver, + void * pContext + ); + +/******************************************************************************* + * Function Name : USBHST_DeregisterHCD + * Description : This function is used to deregister a Host Controller + * Driver from the USB Host Stack. + * Parameters : hHCDriver IN Handle for HC Driver being deregistered. + * Return Type : USBHST_INVALID_PARAMETER if Parameters are not valid. + * USBHST_FAILURE if bus count is not zero + * USBHST_SUCCESS if Host Controller Driver is deregistered + * successfully. + ******************************************************************************/ +extern USBHST_STATUS usbHstHCDDeregister + ( + UINT32 hHCDriver + ); + +/******************************************************************************* + * Function Name : USBHST_RegisterBus + * Description : This function registers an USB Bus corresponding to the + * host controller. + * Parameters : hHCDriver IN Handle for HC Driver requesting + * registration for its bus. + * uSpeed IN Speed of the USB Bus + * hDefaultPipe IN Handle to the default pipe for the USB + * Bus + * Return Type : USBHST_INVALID_PARAMETERS if Parameters are not valid. + * USBHST_INSUFFICIENT_RESOURCES if Resources are not + * sufficient for this operation. + * USBHST_FAILURE USB Bus is already registered. + * USBHST_SUCCESS USB Bus is registered successfully. + ******************************************************************************/ +extern USBHST_STATUS usbHstBusRegister + ( + UINT32 hHCDriver, + UINT8 uSpeed, + UINT32 hDefaultPipe + ); + +/******************************************************************************* + * Function Name : USBHST_DeregisterBus + * Description : This function deregisters an USB Bus corresponding to the + * host controller. + * Parameters : hHCDriver IN Handle for HC Driver requesting + * deregistration for its bus. + * uBusIndex IN Relative Index of the Bus being + * deregistered. + * hDefaultPipe IN Handle to the default pipe for the + * USB Bus + * Return Type : USBHST_INVALID_PARAMETERS if Parameters are not valid. + * USBHST_FAILURE when Attempt to deregister the USB Bus + * while there are functional devices on it. + * USBHST_SUCCESS if USB Bus is deregistered successfully. + ******************************************************************************/ +extern USBHST_STATUS usbHstBusDeregister + ( + UINT32 hHCDriver, + UINT32 uBusIndex, + UINT32 hDefaultPipe + ); + +/******************************************************************************* + * Function Name : USBHST_SelectiveSuspend + * Description : This function is called by the class drivers to + * selectively suspend its device. + * Parameters : hDevice IN Handle to the device to be suspended + * selectively. + * Return Type : USBHST_INVALID_PARAMETERS if Parameters are not valid. + * USBHST_SUCCESS Hub driver is informed successfully about + * selective suspend of the device. + ******************************************************************************/ +extern USBHST_STATUS usbHstSelectiveSuspend + ( + UINT32 hDevice + ); + +/******************************************************************************* + * Function Name : USBHST_SelectiveResume + * Description : This function is called by the class drivers to + * selectively resume its device. + * Parameters : hDevice IN Handle to the device to be resumed + * selectively. + * Return Type : USBHST_INVALID_PARAMETERS if Parameters are not valid. + * USBHST_SUCCESS Hub driver is informed successfully about + * selective resume of the device. + ******************************************************************************/ +extern USBHST_STATUS usbHstSelectiveResume + ( + UINT32 hDevice + ); + +/******************************************************************************* + * Function Name : USBHST_ResetDevice + * Description : This function is called by the class drivers to + * reset its device. + * Parameters : hDevice IN Handle to the device to be reset. + * Return Type : USBHST_INVALID_PARAMETERS if Parameters are not valid. + * USBHST_SUCCESS Hub driver is called successfully + * to reset the device. + ******************************************************************************/ +extern USBHST_STATUS usbHstResetDevice + ( + UINT32 hDevice + ); + +/******************************************************************************* + * Function Name : USBHST_GetDescriptor + * Description : This function is used to issue GET_DESCRIPTOR USB + * Standard Request. + * Parameters : hDevice IN Handle to USB Device. + * uDescType IN Specify the type of descriptor. + * uDescIndex IN Index of configuration or string + * descriptor. + * swLangID IN Language ID in case of string descriptor + * uSize IN Number of bytes of descriptor to fetch. + * pBuffer OUT Pointer to buffer to hold the fetched + * data. + * Return Type : USBHST_INVALID_PARAMETERS if parameters are not valid. + * USBHST_INSUFFICIENT_MEMORY on insufficient resource. + * USBHST_TIMEOUT if request submitted to Host controller + * driver is timed out. + * USBHST_SUCCESS if data for the descriptor is + * successfully fetched + ******************************************************************************/ +extern USBHST_STATUS usbHstGetDescriptor + ( + UINT32 hDevice, + UINT8 uDescType, + UINT8 uDescIndex, + UINT16 swLangID, + UINT32 *pSize, + UCHAR *pBuffer + ); + +/******************************************************************************* + * Function Name : USBHST_GetStatus + * Description : This function is used to issue GetStatus USB + * Standard Request. + * Parameters : hDevice IN Handle to USB Device. + * uRecipient IN Specify the desired recipient. + * uIndex IN Specify the index of recipient info list + * pBuffer OUT Pointer to buffer to hold the fetched + * data. + * Return Type : USBHST_INVALID_PARAMETERS if parameters are not valid. + * USBHST_INSUFFICIENT_MEMORY on insufficient resource. + * USBHST_TIMEOUT if request submitted to Host controller + * driver is timed out. + * USBHST_SUCCESS if Status of the requested recipient is + * fetched successfully. + ******************************************************************************/ +extern USBHST_STATUS usbHstGetStatus + ( + UINT32 hDevice, + UINT8 uRecipient, + UINT16 uIndex, + UCHAR *pBuffer + ); + +/******************************************************************************* + * Function Name : USBHST_ClearFeature + * Description : This function is used to issue ClearFeature USB + * Standard Request. + * Parameters : hDevice IN Handle to USB Device. + * uRecipient IN Specify the desired recipient. + * uIndex IN Specify the index of recipient info list + * uFeature IN Specify the feature selector + * Return Type : USBHST_INVALID_PARAMETERS if parameters are not valid. + * USBHST_INSUFFICIENT_MEMORY on insufficient resource. + * USBHST_TIMEOUT if request submitted to Host controller + * driver is timed out. + * USBHST_SUCCESS if Requested feature is cleared + * successfully. + ******************************************************************************/ +extern USBHST_STATUS usbHstClearFeature + ( + UINT32 hDevice, + UINT8 uRecipient, + UINT16 uIndex, + UINT16 uFeature + ); + +/******************************************************************************* + * Function Name : USBHST_GetConfiguration + * Description : This function is used to issue GetConfiguration USB + * Standard Request. + * Parameters : hDevice IN Handle to USB Device. + * pBuffer OUT Pointer to buffer to hold the fetched + * data. + * Return Type : USBHST_INVALID_PARAMETERS if parameters are not valid. + * USBHST_INSUFFICIENT_MEMORY on insufficient resource. + * USBHST_TIMEOUT if request submitted to Host controller + * driver is timed out. + * USBHST_SUCCESS if current configuration is successfully + * fetched + ******************************************************************************/ +extern USBHST_STATUS usbHstGetConfiguration + ( + UINT32 hDevice, + UCHAR *pBuffer + ); + +/******************************************************************************* + * Function Name : USBHST_GetInterface + * Description : This function is used to issue GetInterface USB + * Standard Request. + * Parameters : hDevice IN Handle to USB Device. + * uInterfaceNumber IN Specify the interface number. + * pBuffer OUT Pointer to buffer to hold the fetched + * data. + * Return Type : USBHST_INVALID_PARAMETERS if parameters are not valid. + * USBHST_INSUFFICIENT_MEMORY on insufficient resource. + * USBHST_TIMEOUT if request submitted to Host controller + * driver is timed out. + * USBHST_SUCCESS if Selected alternate setting for a + * requested interface is fetched successfully. + ******************************************************************************/ +extern USBHST_STATUS usbHstGetInterface + ( + UINT32 hDevice, + UINT16 uInterfaceNumber, + UCHAR *pBuffer + ); + +/******************************************************************************* + * Function Name : USBHST_SetConfiguration + * Description : This function is used to issue SetConfiguration USB + * Standard Request. + * Parameters : hDevice IN Handle to USB Device. + * uIndex IN Specify the Configuration index. + * Return Type : USBHST_INVALID_PARAMETERS if parameters are not valid. + * USBHST_INSUFFICIENT_MEMORY on insufficient resource. + * USBHST_TIMEOUT if request submitted to Host controller + * driver is timed out. + * USBHST_INSUFFICIENT_BANDWIDTH if Insufficient bandwidth + * for new configuration set up. + * USBHST_INSUFFICIENT_RESOURCES Insufficient power + * resources from the hub to support new configuration. + * USBHST_SUCCESS if Configuration is set successfully.. + ******************************************************************************/ +extern USBHST_STATUS usbHstSetConfiguration + ( + UINT32 hDevice, + UINT16 uIndex + ); + +/******************************************************************************* + * Function Name : USBHST_SetFeature + * Description : This function is used to issue SetFeature USB + * Standard Request. + * Parameters : hDevice IN Handle to USB Device. + * uRecipient IN Specify the desired recipient. + * uIndex IN Specify the index of recipient info list + * uFeature IN Specify the feature selector + * uTestSlector IN Specifiy the test selector in case the + * uFeature is USBHST_TEST_MODE + * Return Type : USBHST_INVALID_PARAMETERS if parameters are not valid. + * USBHST_INSUFFICIENT_MEMORY on insufficient resource. + * USBHST_TIMEOUT if request submitted to Host controller + * driver is timed out. + * USBHST_SUCCESS if Requested feature is set successfully. + ******************************************************************************/ +extern USBHST_STATUS usbHstSetFeature + ( + UINT32 hDevice, + UINT8 uRecipient, + UINT16 uIndex, + UINT16 uFeature, + UINT8 uTestSelector + ); + +/******************************************************************************* + * Function Name : USBHST_SetDescriptor + * Description : This function is used to issue SetDescriptor USB + * Standard Request. + * Parameters : hDevice IN Handle to USB Device. + * uDescType IN Type of descriptor to set. + * uDescIndex IN Parameter to hold the device handle. + * swLangID IN Language ID in case of string descriptor + * uSize IN Number of bytes of descriptor to fetch. + * pBuffer OUT Buffer Pointer containing data. + * Return Type : USBHST_INVALID_PARAMETERS if parameters are not valid. + * USBHST_INSUFFICIENT_MEMORY on insufficient resource. + * USBHST_TIMEOUT if request submitted to Host controller + * driver is timed out. + * USBHST_SUCCESS if the descriptor is set successfully. + ******************************************************************************/ +extern USBHST_STATUS usbHstSetDescriptor + ( + UINT32 hDevice, + UINT8 uDescType, + UINT8 uDescIndex, + UINT16 swLangID, + UCHAR *pBuffer, + UINT32 uSize + ); + +/******************************************************************************* + * Function Name : USBHST_SetInterface + * Description : This function is used to issue SetInterface USB + * Standard Request. + * Parameters : hDevice IN Handle to USB Device. . + * uIndex IN Specify the interface number. + * uAltIndex IN Specify the alternate interface + * setting value. + * Return Type : USBHST_INVALID_PARAMETERS if parameters are not valid. + * USBHST_INSUFFICIENT_MEMORY on insufficient resource. + * USBHST_TIMEOUT if request submitted to Host controller + * driver is timed out. + * USBHST_SUCCESS if the interface is set successfully + ******************************************************************************/ +extern USBHST_STATUS usbHstSetInterface + ( + UINT32 hDevice, + UINT16 uIndex, + UINT16 uAltIndex + ); + +/******************************************************************************* + * Function Name : USBHST_SetSynchFrame + * Description : This function is used to issue SetSynchFrame USB + * Standard Request. + * Parameters : hDevice IN Handle to USB Device. + * uEndPointNumber IN Specify the endpoint number + * pBuffer OUT Pointer to buffer to hold the + * synchronization frame number + * Return Type : USBHST_INVALID_PARAMETERS if parameters are not valid. + * USBHST_INSUFFICIENT_MEMORY on insufficient resource. + * USBHST_TIMEOUT if request submitted to Host controller + * driver is timed out. + * USBHST_SUCCESS if Synchronization frame for the requested + * end point is set and reported successfully. + ******************************************************************************/ +extern USBHST_STATUS usbHstSetSynchFrame + ( + UINT32 hDevice, + UINT16 uEndPointNumber, + UCHAR *pBuffer + ); + +/******************************************************************************* + * Function Name : USBHST_SubmitURB. + * Description : This function is used to submit the USB request to HCD. + * Parameters : pURB IN USB request block structure. + * Return Type : USBHST_INVALID_PARAMETERS if Parameters are not valid. + * USBHST_SUCCESS URB is successfully submitted to the Host + * Controller Driver. + ******************************************************************************/ +extern USBHST_STATUS usbHstURBSubmit + ( + USBHST_URB *pURB + ); + +/******************************************************************************* + * Function Name : USBHST_CancelURB. + * Description : This function is used to cancel the request submitted to + * HCD. + * Parameters : pURB IN USB request block structure. + * Return Type : USBHST_INVALID_PARAMETERS if Parameters are not valid. + * USBHST_SUCCESS Host controller driver is requested + * successfully to cancel the URB. + ******************************************************************************/ +extern USBHST_STATUS usbHstURBCancel + ( + USBHST_URB *pURB + ); + +/******************************************************************************* + * Function Name : USBHST_SetBitRate + * Description : This function is used to set the bit rate of specified bus + * Parameters : hDevice IN Handle to device requesting + * this operation. + * bIncrement IN Boolean Flag: + * 0:Decrement the bit rate. + * 1:Increment the bit rate. + * pCurrentFrameWidth OUT Pointer to hold the current bit + * rate. + * Return Type : USBHST_INVALID_PARAMETERS if Parameters are not valid. + * USBHST_SUCCESS Bit rate is set successfully. + ******************************************************************************/ +extern USBHST_STATUS usbHstSetBitRate + ( + UINT32 hDevice, + BOOL bIncrement, + UINT32 *pCurrentFrameWidth + ); + +/******************************************************************************* + * Function Name : USBHST_GetFrameNumber + * Description : This function is used to get the current frame number + * on specified bus. + * Parameters : hDevice IN Handle to the device requesting this + * operation. + * pFrameNumber OUT Pointer to hold the frame number. + * Return Type : USBHST_INVALID_PARAMETERS if Parameters are not valid. + * USBHST_SUCCESS if Frame number is fetched successfully. + ******************************************************************************/ +extern USBHST_STATUS usbHstGetFrameNumber + ( + UINT32 hDevice, + UINT16 *pFrameNumber + ); + +/******************************************************************************* + * Function Name : USBD_Init + * Description : This function initializes the global variables. + * Parameters : None + * Return Type : a) USBHST_FAILURE if USBD could not be initialized. + * b) USBHST_SUCCESS if all the global variables are + * properly initialized. + ******************************************************************************/ +extern USBHST_STATUS usbdInit(void); + +/******************************************************************************* + * Function Name : USBD_Exit + * Description : This function does the clean up. + * Parameters : None + * Return Type : a) USBHST_FAILURE if bus count is not zero. + * b) USBHST_SUCCESS when USBD successfully exited. + ******************************************************************************/ +extern USBHST_STATUS usbdExit(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* End of __USBHST_H__*/ + +/**************************** End of file Usbhst.h ****************************/ diff --git a/h/usb2/usbHubBusManager.h b/h/usb2/usbHubBusManager.h new file mode 100644 index 0000000..bb518c4 --- /dev/null +++ b/h/usb2/usbHubBusManager.h @@ -0,0 +1,83 @@ +/* usbHubBusManager.h - Manages the topology and other info about a bus */ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +Modification history +-------------------- +01a,27jun03,nrv Changing the code to WRS standards +*/ + +/* +DESCRIPTION + +This is the module that manages the topology and other information about +a bus. This is an autonomous thread that is initiated every time a root +hub is detected and this ends only when the USB Hub Class Driver is +unloaded or when the root hub is disabled. This is used in conjunction +with the Port Event Handling Module and Hub Event Handling Module. +*/ + + + +/* +INTERNAL + ******************************************************************************* + * Filename : HUB_BusManager.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : This is the module that manages the topology and other + * information about a bus. This is an autonomous thread that + * is initiated every time a root hub is detected and this + * ends only when the USB Hub Class Driver is unloaded or + * when the root hub is disabled. This is used in conjunction + * with the Port Event Handling Module and + * Hub Event Handling Module. + * + * + ******************************************************************************/ + +#ifndef __USBHUBUSBMANAGER_H___ +#define __USBHUBBUSMANAGER_H___ + +#ifdef __cplusplus +extern "C" { +#endif + + +/******************************************************************************* + * Function Name : HUB_MainThread + * Description : This Function is the thread that keeps checking every hub + * on a bus for events that require handling. + * Parameters : pContext IN The pointer to the bus to work on. + * Return Type : None. + ******************************************************************************/ +LOCAL void usbHubThread(void * pContext); + + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* End of #ifndef __USBHUBBUSMANAGER_H___ */ + +/**************************** End of file HUB_BusManager.h ********************/ diff --git a/h/usb2/usbHubClassInterface.h b/h/usb2/usbHubClassInterface.h new file mode 100644 index 0000000..dd1bab0 --- /dev/null +++ b/h/usb2/usbHubClassInterface.h @@ -0,0 +1,266 @@ +/* usbHubClassInterface.h - Functions used by the host software stcak */ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +Modification history +-------------------- +01a,27jun03,nrv Changing the code to WRS standards +*/ + +/* +DESCRIPTION + +This module implements the functions to be used by the USB Host +Software Stack. The following functions are described in this module: +1. Function for plug and play. +2. Function for power management. +3. Function for root hub management. +4. Function for selective suspend and resume. +5. Function for checking hub power capability. +6. Function for resetting a device. +*/ + + + +/* +INTERNAL + ******************************************************************************* + * Filename : HUB_ClassInterface.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * Description : This module implements the functions to be used by the + * USB Host Software Stack. The following functions are + * described in this module: + * 1. Function for plug and play. + * 2. Function for power management. + * 3. Function for root hub management. + * 4. Function for selective suspend and resume. + * 5. Function for checking hub power capability. + * 6. Function for resetting a device. + * + * + ******************************************************************************/ + +#ifndef __USBHUBCLASSINTERFACE_H___ +#define __USBHUBCLASSINTERFACE_H___ + +#ifdef __cplusplus +LOCAL "C" { +#endif + +/******************************************************************************* + * Function Name : HUB_AddHub + * Description : This function is called by USB Host Software for + * adding a new hub and to configure it. + * Parameters : uDeviceHandle IN Unique identifier for the hub + * device. + * uInterfaceNumber IN Interface number corresponding to + * the hub class functionality. + * pContext OUT Pointer to the context variable. + * Return Type : Returns USBHST_INVALID_PARAMETER if the parameters are + * wrong/ when it is unable to find a device in topology. + * USBHST_FAILURE if the operation failed. + * USBHST_SUCCESS if the operation passed. + ******************************************************************************/ + +LOCAL USBHST_STATUS usbHubAdd + ( + UINT32 uDeviceHandle, + UINT8 uInterfaceNumber, + UINT8 uSpeed, + void ** pContext + ); + + +/******************************************************************************* + * Function Name : HUB_RemoveHub + * Description : This function is called by the USB Host Software Stack + * for deletion of a hub. + * In this process it removes its children and does the + * required clean up. + * Parameters : uDeviceHandle IN Unique identifier for the hub + * device. + * pContext IN Pointer to the context variable. + * Return Type : None. + ******************************************************************************/ + +LOCAL void usbHubRemove + ( + UINT32 uDeviceHandle, + void * pContext + ); + +/******************************************************************************* + * Function Name : HUB_SuspendHub + * Description : This function is called by the USB Host Software Stack + * for suspending a hub. + * Parameters : uDeviceHandle IN Unique identifier for the hub + * device. + * pContext IN Pointer to the context variable. + * Return Type : None. + ******************************************************************************/ + +LOCAL void usbHubSuspend + ( + UINT32 uDeviceHandle, + void * pContext + ); + +/******************************************************************************* + * Function Name : HUB_ResumeHub + * Description : This function is called by the USB Host Software Stack + * for resuming a hub. + * Parameters : uDeviceHandle IN Unique identifier for the hub + * device. + * pContext IN Pointer to the context variable. + * Return Type : None. + ******************************************************************************/ + +LOCAL void usbHubResume + ( + UINT32 uDeviceHandle, + void * pContext + ); + +/******************************************************************************* + * Function Name : HUB_SelectiveSuspendDevice + * Description : This function is called by the USB Host Software Stack for + * selectively suspending a device. In this process, it + * selectively suspends the port of the parent hub where the + * device is connected. + * Parameters : uDeviceHandle IN Unique identifier for the hub + * device. + * Return Type : None. + ******************************************************************************/ + +LOCAL USBHST_STATUS usbHubSelectiveSuspendDevice (UINT32 uDeviceHandle); + + +/******************************************************************************* + * Function Name : HUB_SelectiveResumeDevice + * Description : This function is called by the USB Host Software Stack for + * selectively resuming a device. In this process it + * selectively resumes the port of the parent hub where the + * device is connected. + * Parameters : uDeviceHandle IN Unique identifier for the hub + * device. + * Return Type : None. + ******************************************************************************/ + +LOCAL USBHST_STATUS usbHubSelectiveResumeDevice (UINT32 uDeviceHandle); + + +/******************************************************************************* + * Function Name : HUB_AddRootHub + * Description : This function is called by the USB Host Software Stack + * for adding a new root hub. In this process, it configures + * the root hub and also initializes the structures to handle + * the bus under the root hub. + * Parameters : uDeviceHandle IN Unique identifier for the hub + * device. + * uBusHandle IN Unique identifier for the bus + * Return Type : None. + ******************************************************************************/ + +LOCAL USBHST_STATUS usbHubAddRoot + ( + UINT32 uDeviceHandle, + UINT8 uBusHandle, + UINT8 uSpeed + ); + +/******************************************************************************* + * Function Name : HUB_RemoveRootHub + * Description : This function is called by the USB Host Software Stack for + * removing a root hub. + * Parameters : uBusHandle IN Unique identifier for the bus + * Return Type : None. + ******************************************************************************/ + +LOCAL void usbHubRemoveRoot (UINT8 uBusHandle); + +/******************************************************************************* + * Function Name : HUB_CheckPower + * Description : This function is called by the USB Host Software Stack for + * checking if the parent hub can support a power for a + * device. + * Parameters : uDeviceHandle IN Unique identifier for the hub + * device. + * uPowerRequirement OUT Power Requirement for the device + * in units of 2 mA. + * Return Type : Returns USBHST_INVALID_PARAMETER if the parameters are + * wrong. + * Returns USBHST_FAILURE if the power cannot be supported. + * Returns USBHST_SUCCESS if the power can be supported. + ******************************************************************************/ + +LOCAL USBHST_STATUS usbHubCheckPower + ( + UINT32 uDeviceHandle, + UINT8 uPowerRequirement + ); + +/******************************************************************************* + * Function Name : HUB_ResetDevice + * Description : This function is called by the USB Host Software Stack + * for resetting a device. + * Parameters : uDeviceHandle IN Unique identifier for the hub + * device. + * Return Type : None. + ******************************************************************************/ + +LOCAL USBHST_STATUS usbHubResetDevice (UINT32 uDeviceHandle); + + +/******************************************************************************* + * Function Name : HUB_ClearTT + * Description : This function submits a request for clear TT + * Parameters : uHubHandle IN Hub handle. + * uPortNumber IN Port To which the TT is attached + * uValue IN wValue for ClearTT request + * + * pContext IN Context for USBD + * Return Type : a) Status + * + ******************************************************************************/ +LOCAL USBHST_STATUS usbHubClearTT( UINT32 uHubHandle ,UINT8 uPortNumber , + UINT16 uValue, void * pContext ); +/******************************************************************************* + * Function Name : HUB_ResetTT + * Description : This function submits a request for clear TT + * Parameters : uHubHandle IN Hub handle. + * uPortNumber IN Port To which the TT is attached + * pContext IN Context for USBD + * Return Type : a) Status + ******************************************************************************/ +LOCAL USBHST_STATUS usbHubResetTT(UINT32 uHubHandle , UINT8 uPortNumber , + void * pContext); + + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* End of #ifndef __USBHUBCLASSINTERFACE_H___ */ + +/**************************** End of file HUB_ClassInterface.h ****************/ diff --git a/h/usb2/usbHubCommon.h b/h/usb2/usbHubCommon.h new file mode 100644 index 0000000..fed3a73 --- /dev/null +++ b/h/usb2/usbHubCommon.h @@ -0,0 +1,715 @@ +/* usbHubCommon.h - Macro definitions used in USB Hub class driver */ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +Modification history +-------------------- +01b,18aug05,ami Fix for enumerating hubs with class code 0x101 +01a,30may03,nrv Changing the code to WRS standards +*/ + +/* +DESCRIPTION + +This file contains the macro definitions that are used through +out the USB Hub Class Driver. +*/ + + +/* + INTERNAL + ****************************************************************************** + * Filename : HUB_Common.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : This contains the macro definitions that are used through + * out the USB Hub Class Driver. + * + ******************************************************************************/ + +#ifndef __USBHUBCOMMON_H__ +#define __USBHUBCOMMON_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "usbOsal.h" +#include "usbHst.h" + +/* defines */ + +#define USB_HUB_VERSION_NUMBER "Devel_0.01" +#define USB_HUB_VERSION_DATE "4th April 2003" + +/* Priority of the Hub's Threads */ +#define USB_HUB_THREAD_PRIORITY (100) + +/* The default configuration Index for a Hub */ +#define USB_DEF_ACTIVE_HUB_CONFIG_INDEX ((UINT8)0x00) + +/* Maximum retries for connection attempt */ +#define USB_HUB_CONFIG_RETRY_MAX ((UINT8)0x03) + +/* Maximum frame number 11 bits are allowed for this field */ +#define USB_HUB_MAXIMUM_FRAME_NUMBER ((UINT16) 2048) + +/* The Debounce Time intreval */ +#define USB_HUB_PORT_DEBOUNCE_TIME ((UINT16) 100) + +/* Define for the Maximum power per root hub */ +#define USB_MAXIMUM_POWER_PER_ROOT_HUB ((UINT8)0x5) + +/* Port number not found */ +#define USB_PORT_NUMBER_NOT_FOUND ((UINT8)255) + +/* The Maximum depth that the USB Tree can grow in USB1.1 */ +#define HUB_MAX_ALLOWED_DEPTH_USB1_1 ((UINT8)5) + + +/* The Maximum depth that the USB Tree can grow in USB2.0 */ +#define HUB_MAX_ALLOWED_DEPTH_USB2_0 ((UINT8)7) + + +/* The default endpoint */ +#define USB_HUB_DEFAULT_ENDPOINT ((UINT8)0x0) + +/* Flag for indicating a port as not a High Speed port */ +#define USB_NOT_HIGH_SPEED_HUB_PORT ((UINT8)0xFF) + +/* Defines for the Usb Version of Hub */ +#define USB_HUB_VERSION_0200 ((UINT16)0x0200) +#define USB_HUB_VERSION_0110 ((UINT16)0x0110) +#define USB_HUB_VERSION_0100 ((UINT16)0x0100) +#define USB_HUB_VERSION_0101 ((UINT16)0x0101) + +/* Defines Status bits USB2.0 spec- table 11-7 (wValue) */ +#define USB_HUB_LOCAL_POWER ((UINT8)0X0) +#define USB_HUB_OVER_CURRENT ((UINT8)0X1) +#define USB_PORT_CONNECTION ((UINT8)0X0) +#define USB_PORT_ENABLE ((UINT8)0X1) +#define USB_PORT_SUSPEND ((UINT8)0X2) +#define USB_PORT_OVER_CURRENT ((UINT8)0X3) +#define USB_PORT_RESET ((UINT8)0X4) +#define USB_PORT_POWER ((UINT8)0X8) +#define USB_PORT_LOW_SPEED ((UINT8)0X9) +#define USB_C_PORT_CONNECTION ((UINT8)0X10) +#define USB_C_PORT_ENABLE ((UINT8)0X11) +#define USB_C_PORT_SUSPEND ((UINT8)0X12) +#define USB_C_PORT_OVER_CURRENT ((UINT8)0X13) +#define USB_C_PORT_RESET ((UINT8)0X14) + +/* defines for the bit value of the wHubStatus */ +#define USB_HUB_LOCAL_POWER_VALUE ((UINT16)0X1) +#define USB_HUB_OVER_CURRENT_VALUE ((UINT16)0X2) + +/* defines for the bit value of the wHubStatusChange */ +#define USB_C_HUB_LOCAL_POWER_VALUE ((UINT16)0X1) +#define USB_C_HUB_OVER_CURRENT_VALUE ((UINT16)0X2) + +/* defines for the bit value of the wPortStatus */ +#define USB_PORT_CONNECTION_VALUE ((UINT16)0X0001) +#define USB_PORT_ENABLE_VALUE ((UINT16)0X0002) +#define USB_PORT_SUSPEND_VALUE ((UINT16)0X0004) +#define USB_PORT_OVER_CURRENT_VALUE ((UINT16)0X0008) +#define USB_PORT_RESET_VALUE ((UINT16)0X0010) +#define USB_PORT_POWER_VALUE ((UINT16)0X0100) +#define USB_PORT_SPEED_VALUE ((UINT16)0X0600) + +/* defines for the bit value of the wPortStatus */ +#define USB_C_PORT_CONNECTION_VALUE ((UINT16)0X0001) +#define USB_C_PORT_ENABLE_VALUE ((UINT16)0X0002) +#define USB_C_PORT_SUSPEND_VALUE ((UINT16)0X0004) +#define USB_C_PORT_OVER_CURRENT_VALUE ((UINT16)0X0008) +#define USB_C_PORT_RESET_VALUE ((UINT16)0X0010) + +/* Defines for the Features USB2.0 spec- table 9-4 (bRequest) */ +#define USB_CLEAR_FEATURE ((UINT8) 0x01) +#define USB_SET_FEATURE ((UINT8) 0x03) +#define USB_GET_DESCRIPTOR ((UINT8) 0x06) +#define USB_SET_CONFIGURATION ((UINT8) 0x09) +#define USB_GET_STATUS ((UINT8) 0x00) +#define USB_GET_HUB_DESCRIPTOR ((UINT8) 0xA0) + + +/* Defines for Hub Class Request */ +#define USB_CLEAR_TT_REQUEST ((UINT8) 0x08) +#define USB_RESET_TT ((UINT8) 0x09) + +/* Defines for the bmRequest Field */ +#define USB_HUB_TARGET_GET ((UINT8) 0xA0) +#define USB_HUB_TARGET_SET ((UINT8) 0x20) +#define USB_PORT_TARGET_GET ((UINT8) 0xA3) +#define USB_PORT_TARGET_SET ((UINT8) 0x23) +#define USB_DEVICE_TARGET_GET ((UINT8) 0x80) + +/* Defines for the Descriptor Types */ +#define USB_HUB_DESCRIPTOR ((UINT8) 0x29) +#define USB_CONFIGURATION_DESCRIPTOR ((UINT8) 0x02) + +/* Defines for the hub states */ +#define USB_HUB_STATES UINT8 +#define USB_HUB_NO_STATE ((USB_HUB_STATES) 0x00) +#define USB_MARKED_FOR_DELETION ((USB_HUB_STATES) 0x01) +#define USB_HUB_DEBOUNCE_PENDING ((USB_HUB_STATES) 0x02) +#define USB_HUB_RESET_PENDING ((USB_HUB_STATES) 0x03) +#define USB_HUB_RESET_COMPLETION_PENDING ((USB_HUB_STATES) 0x04) +#define USB_HUB_RESET_COMPLETED ((USB_HUB_STATES) 0x05) +#define USB_HUB_PORT_DEFAULT ((USB_HUB_STATES) 0x06) +#define USB_HUB_PORT_ADDRESSED ((USB_HUB_STATES) 0x07) +#define USB_HUB_PORT_CONFIGURED ((USB_HUB_STATES) 0x08) + + +/******************************************************************************* + * Macro Name : HUB_DESC_bNbrPorts + * Description : This returns the number of ports that a specific hub contains + * by parsing the hub descriptor. + * Parameters : pHubDescriptor IN pointer to the Hub descriptor. + * Return Type : UINT8 + ******************************************************************************/ + +#define USB_HUB_DESC_bNbrPorts(pHubDescriptor) \ + ((UINT8*) (pHubDescriptor))[2] \ + + +/******************************************************************************* + * Macro Name : HUB_DESC_wHubCharacteristics + * Description : This parses the hub descriptor and returns the + * wHubCharacteristic. + * Parameters : pHubDescriptor IN pointer to the Hub descriptor. + * Return Type : UINT16 + ******************************************************************************/ + +#define USB_HUB_DESC_wHubCharacteristics(pHubDescriptor) \ + ( ( ( (UINT8*) (pHubDescriptor))[4]<<8) | \ + ( ( (UINT8*) (pHubDescriptor))[3]) ) \ + + +/******************************************************************************* + * Macro Name : HUB_DESC_bPwrOn2PwrGood + * Description : This parses the hub descriptor and returns the bPwrOn2PwrGood. + * Parameters : pHubDescriptor IN pointer to the Hub descriptor. + * Return Type : UINT8 + ******************************************************************************/ + +#define USB_HUB_DESC_bPwrOn2PwrGood(pHubDescriptor) \ + ( ( (UINT8*) (pHubDescriptor) )[5] ) \ + + +/******************************************************************************* + * Macro Name : HUB_DESC_bHubContrCurrent + * Description : This parses the hub descriptor and returns the bHubContrCurrent. + * Parameters : pHubDescriptor IN pointer to the Hub descriptor. + * Return Type : UINT8 + ******************************************************************************/ + +#define USB_HUB_DESC_bHubContrCurrent(pHubDescriptor) \ + ( ( (UINT8*) (pHubDescriptor) )[6] ) \ + + +/******************************************************************************* + * Macro Name : HUB_DESC_GET_NUMPORT_OFFSET + * Description : This parses the hub descriptor and returns the offset required + * for data of the DeviceRemovableMap and PortPWrCtrlMask fields + * as per the byte granularity. + * Parameters : pHubDescriptor IN pointer to the Hub descriptor. + * uOffset OUT the offset for the number of ports + * Return Type : None + ******************************************************************************/ + +#define USB_HUB_DESC_GET_NUMPORT_OFFSET(pHubDescriptor,uOffset) \ +{ \ + UINT8 uNbrOfPorts = HUB_DESC_bNbrPorts(pHubDescriptor); \ + /* give the 0th Bit Padding */ \ + uNbrOfPorts++; \ + /* Implement the byte granurality */ \ + uOffset = USB_HUB_BYTE_GRANULARITY(uNbrOfPorts); \ +} \ + + +/******************************************************************************* + * Macro Name : HUB_DESC_DevRemovableMapStart + * Description : This parses the hub descriptor and returns the pointer to the + * start of the DeviceRemovable bit map + * Parameters : pHubDescriptor IN pointer to the Hub descriptor. + * Return Type : PUINT8 + ******************************************************************************/ + +#define USB_HUB_DESC_DevRemovableMapStart(pHubDescriptor) \ + ((UINT8*)( ( (UINT32) (pHubDescriptor) )+7 ) ) \ + + +/******************************************************************************* + * Macro Name : HUB_DESC_PortPwrCtrlMaskStart + * Description : This parses the hub descriptor and returns the pointer to the + * start of the PortPwrCtrlMask bit map + * Parameters : pHubDescriptor IN pointer to the Hub descriptor. + * Return Type : PUINT8 + ******************************************************************************/ + +#define USB_HUB_DESC_PortPwrCtrlMaskStart(pHubDescriptor,pPortPwrCtrlMask) \ +{ \ + UINT8 uOffset = 0; \ + HUB_DESC_GET_NUMPORT_OFFSET (pHubDescriptor,uOffset); \ + pPortPwrCtrlMask = ((UINT8*)( ( (UINT32) (pHubDescriptor) ) \ + +7+uOffset ) ); \ +} \ + + +/******************************************************************************* + * Macro Name : HUB_DESC_IS_GANG_POWERED + * Description : This parses the hub descriptor and returns if the device is + * Gang powered or not. + * Parameters : pHubDescriptor IN pointer to the Hub descriptor. + * Return Type : BOOLEAN + ******************************************************************************/ + +#define USB_HUB_DESC_IS_GANG_POWERED(pHubDescriptor) \ + (0==(UINT8)(HUB_DESC_wHubCharacteristics(pHubDescriptor)&0x1)? \ + FALSE:TRUE) \ + + +/******************************************************************************* + * Macro Name : HUB_CONFIG_wTotalLength + * Description : This parses the config descriptor and returns the total length + * of the descriptor + * Parameters : pConfigDescriptor IN pointer to the config descriptor. + * Return Type : UINT16 + ******************************************************************************/ + +#define USB_HUB_CONFIG_wTotalLength(pConfigDescriptor) \ + (((pConfigDescriptor)[2]&0xff) | ((pConfigDescriptor)[3]&0xff)<<8) \ + + +/******************************************************************************* + * Macro Name : HUB_DESC_IS_COMPOUND_DEVICE + * Description : This parses the hub descriptor and returns if the hub is part + * of a compound device or not. + * Parameters : pHubDescriptor IN pointer to the Hub descriptor. + * Return Type : BOOLEAN + ******************************************************************************/ + +#define USB_HUB_DESC_IS_COMPOUND_DEVICE(pHubDescriptor) \ + (0==(UINT8)(USB_HUB_DESC_wHubCharacteristics(pHubDescriptor)&0x4)? \ + FALSE:TRUE) \ + + +/******************************************************************************* + * Macro Name : HUB_DESC_POWER_PROTECTION_SCHEME + * Description : This parses the hub descriptor and returns the power protection + * scheme used - if this field is 0 this is Global protection + * scheme, if 1, it has per port reporting. If >1 then it has no + * power current protection + * Parameters : pHubDescriptor IN pointer to the Hub descriptor. + * Return Type : UINT8 + ******************************************************************************/ + +#define USB_HUB_DESC_POWER_PROTECTION_SCHEME(pHubDescriptor) \ + ( (USB_HUB_DESC_wHubCharacteristics(pHubDescriptor)&0x18)>>3 ) \ + + +/******************************************************************************* + * Macro Name : HUB_IS_HUB_EVENT + * Description : This parses the Event for a given Status and returns if any + * hub event has occurred. + * Parameters : uStatus IN Change status bitmap of the hub. + * Return Type : BOOLEAN + ******************************************************************************/ + +#define USB_HUB_IS_EVENT(uStatus) \ + ( ( 0==(((UINT8*)(uStatus))[0]&0x01))?FALSE:TRUE) \ + +/******************************************************************************* + * Macro Name : HUB_IS_PORT_EVENT + * Description : This parses the Event for a given Status and returns if any + * event has occurred in the port specified. + * Parameters : pStatus IN Change status bitmap of the hub. + * uPortNumber IN The port number of the change + * bResult OUT The result of the check + * Return Type : None. + ******************************************************************************/ + +#define USB_HUB_IS_PORT_EVENT(pStatus, uPortNumber) \ + ( (0 != ((pStatus)[(uPortNumber)/8]&((UINT8)0x1<<((uPortNumber)%8))) )? \ + TRUE:FALSE ) \ + + +/******************************************************************************* + * Macro Name : HUB_IS_CONNECTION_CHANGE + * Description : This parses the event for a given status and returns if any + * connect change event has occurred. + * Parameters : uStatus IN Change status of the port. + * Return Type : BOOLEAN + ******************************************************************************/ + +#define USB_HUB_IS_CONNECTION_CHANGE(uStatus) \ + (( 0==((uStatus)&USB_C_PORT_CONNECTION_VALUE))? FALSE:TRUE) \ + + +/******************************************************************************* + * Macro Name : HUB_IS_ENABLE_CHANGE + * Description : This parses the event for a given status and returns if any + * enable change event has occurred. + * Parameters : uStatus IN Change status of the port. + * Return Type : BOOLEAN + ******************************************************************************/ + +#define USB_HUB_IS_ENABLE_CHANGE(uStatus) \ + (( 0==((uStatus)&USB_C_PORT_ENABLE_VALUE))? FALSE:TRUE) \ + + +/******************************************************************************* + * Macro Name : HUB_IS_SUSPEND_CHANGE + * Description : This parses the event for a given status and returns if any + * suspend change event has occurred. + * Parameters : uStatus IN Change status of the port. + * Return Type : BOOLEAN + ******************************************************************************/ + +#define USB_HUB_IS_SUSPEND_CHANGE(uStatus) \ + (( 0==((uStatus)&USB_C_PORT_SUSPEND_VALUE))? FALSE:TRUE) \ + + +/******************************************************************************* + * Macro Name : HUB_IS_RESET_CHANGE + * Description : This parses the event for a given status and returns if any + * reset change event has occurred. + * Parameters : uStatus IN Change status of the port. + * Return Type : BOOLEAN + ******************************************************************************/ + +#define USB_HUB_IS_RESET_CHANGE(uStatus) \ + (( 0==((uStatus)&USB_C_PORT_RESET_VALUE))? FALSE:TRUE) \ + + +/******************************************************************************* + * Macro Name : HUB_IS_OVER_CURRENT_CHANGE + * Description : This parses the event for a given status and returns if any + * over current event has occurred. + * Parameters : uStatus IN Change status of the port. + * Return Type : BOOLEAN + ******************************************************************************/ + +#define USB_HUB_IS_OVER_CURRENT_CHANGE(uStatus) \ + (( 0==((uStatus)&USB_C_PORT_OVER_CURRENT_VALUE))? FALSE:TRUE) \ + + +/******************************************************************************* + * Macro Name : HUB_DEVICE_SPEED + * Description : This detects the speed of the device from the port status + * Parameters : uStatus IN status of the port. + * Return Type : UINT8 + ******************************************************************************/ + +#define USB_HUB_DEVICE_SPEED(uStatus) \ + ((UINT8)((((uStatus) & USB_PORT_SPEED_VALUE) >> 9) & 0xFF)) + +/******************************************************************************* + * Macro Name : HUB_SET_HUB_FEATURE + * Description : This will submit a blocking call to set a hub feature. + * Parameters : pHub IN The Hub pointer. + * bResult OUT The result will be stored here + * Feature IN The feature on the hub to be set + * Return Type : None + ******************************************************************************/ + +#define USB_HUB_SET_HUB_FEATURE(pHub,bResult,Feature) \ +{ \ + bResult=usbHubSubmitControlRequest(pHub,USB_HUB_TARGET_SET, \ + USB_SET_FEATURE,Feature ,0); \ +} \ + + +/******************************************************************************* + * Macro Name : HUB_CLEAR_HUB_FEATURE + * Description : This will submit a blocking call to clear a hub feature. + * Parameters : pHub IN The Hub pointer. + * bResult OUT The result will be stored here + * Feature IN The feature on the hub to be set + * Return Type : None + ******************************************************************************/ + +#define USB_HUB_CLEAR_HUB_FEATURE(pHub,bResult,Feature) \ +{ \ + bResult=usbHubSubmitControlRequest(pHub, USB_HUB_TARGET_SET, \ + USB_CLEAR_FEATURE,Feature ,0); \ +} \ + + +/******************************************************************************* + * Macro Name : HUB_SET_PORT_FEATURE + * Description : This will submit a blocking call to set a port feature. + * Converts the port number + * Parameters : pHub IN The Hub pointer. + * uPortIndex IN Port index +1 = port number + * Feature IN The feature on the hub to be set + * Return Type : None + ******************************************************************************/ + +#define USB_HUB_SET_PORT_FEATURE(pHub,uPortIndex,Feature) \ + usbHubSubmitControlRequest(pHub, \ + USB_PORT_TARGET_SET, \ + USB_SET_FEATURE, \ + Feature, \ + uPortIndex+1) \ + + +/******************************************************************************* + * Macro Name : HUB_CLEAR_PORT_FEATURE + * Description : This will submit a blocking call to clear a port feature. + * Parameters : pHub IN The Hub pointer. + * uPortIndex IN Port index +1 = port number + * Feature IN The feature on the hub to be set + * Return Type : None + ******************************************************************************/ + +#define USB_HUB_CLEAR_PORT_FEATURE(pHub,uPortIndex,Feature) \ + usbHubSubmitControlRequest(pHub, \ + USB_PORT_TARGET_SET, \ + USB_CLEAR_FEATURE, \ + Feature, \ + uPortIndex+1) \ + + +/******************************************************************************* + * Macro Name : HUB_GET_HUB_STATUS + * Description : This will submit a blocking call to get a hub status. + * Parameters : pHub IN The Hub pointer. + * pBuffer IN OUT The buffer to which the status is + * copied + * pBufferLength IN OUT The Length of the Buffer + * Return Type : None + ******************************************************************************/ + +#define USB_HUB_GET_STATUS(pHub,pBuffer,pBufferLength) \ + usbHubGetStatus(pHub, 0, USB_HUB_TARGET_GET,pBuffer,pBufferLength) \ + + +/******************************************************************************* + * Macro Name : HUB_GET_PORT_STATUS + * Description : This will submit a blocking call to get a port status. + * Parameters : pHub IN The Hub pointer. + * uPortIndex IN Port index +1 = port number + * pBuffer IN OUT The buffer to which the status is + * copied + * pBufferLength IN OUT The Length of the Buffer + * Return Type : None + ******************************************************************************/ + +#define USB_HUB_GET_PORT_STATUS(pHub,uPortIndex,pBuffer,pBufferLength) \ + usbHubGetStatus(pHub, uPortIndex+1,USB_PORT_TARGET_GET,pBuffer,pBufferLength)\ + + +/******************************************************************************* + * Macro Name : HUB_TIME_DIFF + * Description : This finds the difference of time between the current + * frame number and a different frame number. + * Parameters : uCurrentFrame IN This is the current frame number. + * uLastFrame IN This is the last frame number. + * Return Type : UINT16 + ******************************************************************************/ + +#define USB_HUB_TIME_DIFF(uCurrentFrame,uLastFrame) \ + ( ((uLastFrame)>(uCurrentFrame))? \ + (USB_HUB_MAXIMUM_FRAME_NUMBER - (uLastFrame)+uCurrentFrame ): \ + (uCurrentFrame-(uLastFrame)) ) \ + + +/******************************************************************************* + * Macro Name : HUB_BYTE_GRANULARITY + * Description : This converts the parameter into nearest largest byte count + * (byte granularity form). + * Parameters : uNumberOfBits IN This is the value that has to be + * converted to byte granularity form. + * Return Type : UINT8 + ******************************************************************************/ + +#define USB_HUB_BYTE_GRANULARITY(uNumberOfBits) \ + ( (((UINT8)(uNumberOfBits)%8)>0)? \ + (((uNumberOfBits)/8)+1): ((uNumberOfBits)/8) ) \ + + +/******************************************************************************* + * Macro Name : MARK_FOR_DELETE_PORT + * Description : This marks the port for deletion. This takes care of reseting + * the global bus state if the device connected to the port is in + * default state + * Parameters : pHub IN pointer to the Hub + * pPort IN pointer to the port on the hub + * Return Type : None. + ******************************************************************************/ + +#define USB_MARK_FOR_DELETE_PORT(pHub,pPort) \ + { \ + /* Check if we have the bus information */ \ + if ( (NULL != (pHub)->pBus) & \ + (USB_HUB_PORT_CONFIGURED > (pPort)->StateOfPort ) & \ + (USB_HUB_RESET_PENDING < (pPort)->StateOfPort ) ) \ + { \ + /* Set the bus state as no device is being configured */ \ + (pHub)->pBus->bDeviceBeingConfigured = FALSE; \ + if (NULL != pHub->pBus->pResetURB) \ + { \ + /* Cancel Reset URB -We force this before we delete hub */ \ + if (USB_HUB_RESET_COMPLETED > (pPort)->StateOfPort) \ + { \ + if (USBHST_SUCCESS == usbHstURBCancel (pHub->pBus->pResetURB)) \ + { \ + /* Call the reset Callback */ \ + usbHubResetCallback(pHub->pBus->pResetURB); \ + } \ + } \ + }/* End of if (NULL !=.. */ \ + \ + } /* End of if (NULL !=.. */ \ + \ + (pPort)->StateOfPort = USB_MARKED_FOR_DELETION; \ + \ + } /* End of if ( (HUB_PORT_CONFIGURED > pPort->StateOfPort .. */ + +/******************************************************************************* + * Macro Name : VALIDATE_DESCRIPTOR_SEQUENCE + * Description : This validates the config descriptor + * Only valid descriptors Sequence is + * 1) 0x24210 (Endpoint,AlternateInterface, + * Endpoint,DefaultInterface,,Config) + * 2) 0x00210 (Endpoint,DefaultInterface,Config) + * Parameters : uDescriptorSequence IN Value showing the descriptor + * sequence + * Return Type : BOOLEAN + ******************************************************************************/ +#define USB_VALIDATE_DESCRIPTOR_SEQUENCE(uDescriptorSequence) \ + (( 0 == ((uDescriptorSequence == 0x24210) || \ + (uDescriptorSequence == 0x00210 ) ) ) ? FALSE:TRUE) \ + +/* This Data Structure stores information about the hub descriptor. */ +typedef struct usb_hub_descriptor_info +{ + UINT8 bNbrPorts; /* The Number of Ports */ + UINT16 wHubCharacteristics; /* Characteristics of the hub */ + UINT8 bPwrOn2PwrGood; /* Time to wait before the Power is stable */ + UINT8 bHubContrCurrent; /* Power Requiement by the hub electronics */ +} OS_STRUCT_PACKED USB_HUB_DESCRIPTOR_INFO, * pUSB_HUB_DESCRIPTOR_INFO; + +/* + * This Data Structure stores information about the hub Status Change + * information. + */ +typedef struct usb_hub_status +{ + UINT16 wHubStatus; /* Contains the status of the hub */ + UINT16 wHubChange; /* Contains the change status of the hub */ +} OS_STRUCT_PACKED USB_HUB_STATUS,* pUSB_HUB_STATUS; + +/* + * This Data Structure stores information about the Port status change + * information. + */ +typedef struct usb_hub_port_status +{ + UINT16 wPortStatus; /* The port status information */ + UINT16 wPortChange; /* The port status change. */ +} OS_STRUCT_PACKED USB_HUB_PORT_STATUS, * pUSB_HUB_PORT_STATUS; + +/* + * The following have been pre defined here as a method to handle cyclic + * dependency + */ +typedef struct usb_hub_info * pUSB_HUB_INFO; +typedef struct usb_hub_bus_info * pUSB_HUB_BUS_INFO; +typedef struct usb_hub_port_info * pUSB_HUB_PORT_INFO; + +/* + * This data structure holds the information about a port of a hub as to what + * device is connected to that port. The port status is also stored in this + * structure. + */ +typedef struct usb_hub_port_info +{ + UINT32 uDeviceHandle; /* Identification of the hub device */ + BOOLEAN bDebouncePeriod; /* States if the port is in debounce*/ + BOOLEAN bOldConnectStatus; /* previous connect status */ + UINT16 uConnectFrame; /* The frame num when last connected*/ + UINT8 uConnectRetry; /* number of times connect retried */ + pUSB_HUB_INFO pHub; /* pointer to the hub if this is hub*/ + USB_HUB_STATES StateOfPort; /* State of this port */ +} USB_HUB_PORT_INFO; + +/* + * This data structure holds the information about the BUS that is present and + * this forms the starting point for the entire topology of the bus. + */ +typedef struct usb_hub_bus_info +{ + UINT8 uBusHandle; /* Identification of a Bus */ + OS_THREAD_ID BusManagerThreadID; /* Thread ID of the Bus manager */ + UINT8 uNumberOfHubEvents; /* Number of Hub events */ + BOOLEAN bDeviceBeingConfigured; /* Is any device being configured */ + UINT8 uNumberOfConfigRetries; /* Number of configuration retries */ + UINT32 uDeviceHandle; /* The root hub device handle */ + UINT8 uBusSpeed; /* Speed of the bus */ + pUSB_HUB_INFO pRootHubInfo; /* The pointer to root hub structure*/ + pUSBHST_URB pResetURB; /* pointer to the reset URB */ + struct usb_hub_bus_info *pNextBus; /* The pointer to the next bus */ +} USB_HUB_BUS_INFO; + +/* + * This data structure holds the information about a hub and provides the + * linking info about the devices connected to this hub. + */ + /* + * NOTE1: The status change bit map obtained in response to the status change + * interrupt IN request. + */ + /* + * NOTE2: The pointer to the URB structure that is used for the polling of the + * interrupt endpoint for status change bit map + */ + +typedef struct usb_hub_info +{ + UINT32 uDeviceHandle; /* Identification of the hub device */ + UINT8 * pStatus; /* NOTE1: */ + USB_HUB_BUS_INFO * pBus; /* Pointer to the bus structure */ + UINT8 uPowerPerPort; /* power that can be supplied to port*/ + /* The Endpoint Address where the Interrupt Pipe resides. */ + UINT8 uInterruptEndpointNumber; + USB_HUB_DESCRIPTOR_INFO HubDescriptor; /* fields of the hub descriptor */ + USBHST_URB StatusChangeURB;/* NOTE2: */ + BOOLEAN bURBSubmitted; /* Denotes if the URB Was submitted */ + UINT8 uCurrentTier; /* USB Tier of this hub */ + + UINT8 uHubTTInfo; /* describing the TT organization */ + + USB_HUB_STATES StateOfHub; /* State of this Hub */ + USB_HUB_PORT_INFO* pPortList[1]; /* List of pointers to ports */ +} USB_HUB_INFO; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* End of #ifndef __HUB_COMMON_H__ */ + +/**************************** End of file Hub_Common.h ************************/ diff --git a/h/usb2/usbHubEventHandler.h b/h/usb2/usbHubEventHandler.h new file mode 100644 index 0000000..37924e1 --- /dev/null +++ b/h/usb2/usbHubEventHandler.h @@ -0,0 +1,87 @@ +/* usbHubEventHandler.h - Functions for handling HUB events */ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +Modification history +-------------------- +01a,27jun03,nrv Changing the code to WRS standards +*/ + +/* +DESCRIPTION + +This provides the functions for handling the hub events.This is +used in conjunction with the Port Event Handling Module and +Bus Manager Module. +*/ + + + +/* +INTERNAL + ******************************************************************************* + * Filename : HUB_HubEventHandler.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : This provides the functions for handling the hub events. + * This is used in conjunction with the Port Event Handling + * Module and Bus Manager Module. + * + ******************************************************************************/ + + +#ifndef __USBHUBHUBEVENTHANDLER_H___ +#define __USBHUBHUBEVENTHANDLER_H___ + + +#ifdef __cplusplus +extern "C" { +#endif + + +/******************************************************************************* + * Function Name : HUB_HubEventHandler + * Description : This is the function to handle the hub event. This has + * the maximum priority over any other event. Each Bus + * structure maintains a variable whose count is incremented + * every time a hub event is detected and decremented every + * time a hub event is handled. Only when this counter is 0 + * are other events handled. + * Parameters : pHub IN Pointer to the hub structure which + * has to be checked. + * Return Type : Returns USBHST_INVALID_PARAMETER if parameters are wrong. + * Returns USBHST_FAILURE If errors were encountered while + * handling hub event. + * Returns USBHST_SUCCESS If the hub event handling + * was success. + ******************************************************************************/ + +LOCAL USBHST_STATUS usbHubEventHandler (pUSB_HUB_INFO pHub); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* End of #ifndef __HUB_HUBEVENTHANDLER_H___ */ + +/**************************** End of file HUB_HubEventHandler.h ***************/ diff --git a/h/usb2/usbHubGlobalVariables.h b/h/usb2/usbHubGlobalVariables.h new file mode 100644 index 0000000..6d6787e --- /dev/null +++ b/h/usb2/usbHubGlobalVariables.h @@ -0,0 +1,72 @@ +/* usbHubGlobalVariables.h - Global Variables used in USB Hub class driver */ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +Modification history +-------------------- +01a,30may03,nrv Changing the code to WRS standards +*/ + +/* +DESCRIPTION + +This file contains the global variables that are used through +out the USB Hub Class Driver. +*/ + + + +/* +INTERNAL + ******************************************************************************* + * Filename : HUB_GlobalVariables.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : This module provides the initialization and the clean up + * functions for the USB Hub Class Driver. + * + ******************************************************************************/ + +#ifndef __USBHUBGLOBALVARIABLES_H___ +#define __USBHUBGLOBALVARIABLES_H___ + + +#ifdef __cplusplus +extern "C" { +#endif + + +/*************************** Include Files ************************************/ +#include "usbHubCommon.h" +#include "usbHst.h" + +/*************************** Variable Declarations ****************************/ + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* End of #ifndef __HUB_GLOBALVARIABLES_H___ */ + +/**************************** End of file HUB_GlobalVariables.h ***************/ + diff --git a/h/usb2/usbHubHostStackInterface.h b/h/usb2/usbHubHostStackInterface.h new file mode 100644 index 0000000..33a1fe7 --- /dev/null +++ b/h/usb2/usbHubHostStackInterface.h @@ -0,0 +1,95 @@ +/* usbHubHostStackInterface.h - Allows the host stack to interact with hub +class driver */ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +Modification history +-------------------- +01a,27jun03,nrv Changing the code to WRS standards +*/ + +/* +DESCRIPTION + +This provides the structure that allow the USB Host Stack +Software to interact with the USB Hub Class Driver. +*/ + + + +/* +INTERNAL + ******************************************************************************* + * Filename : HUB_HostStackInterface.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * Description : This provides the structure that allow the USB Host Stack + * Software to interact with the USB Hub Class Driver. + * + ******************************************************************************/ + + +#ifndef __USBHUBHOSTSTACKINTERFACE_H__ +#define __USBHUBHOSTSTACKINTERFACE_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This structure is used to store the pointers to USB Hub Class Driver function + * pointers that are visible to only USB Host Software Stack. + */ + typedef struct usb_hub_function_list +{ + /* Function pointer to suspend a device */ + USBHST_STATUS (*usbHubSelectiveSuspendDevice)( UINT32 uDeviceHandle); + + /* Function pointer to resume a device */ + USBHST_STATUS (*usbHubSelectiveResumeDevice) ( UINT32 uDeviceHandle); + + /* Function pointer to add a root hub */ + USBHST_STATUS (*usbHubAddRoot) ( UINT32 uDeviceHandle, UINT8 uBusHandle ,UINT8 uSpeed); + + /* Function pointer to remove a root hub */ + void (*usbHubRemoveRoot)( UINT8 uBusHandle); + + /* + * Function pointer to check whether the power for a device can be supported + */ + USBHST_STATUS (*usbHubCheckForPower)( UINT32 uDeviceHandle, + UINT8 uPowerRequirement); + /* Function pointer to reset a device */ + USBHST_STATUS (*usbHubResetDevice) ( UINT32 uDeviceHandle); + +} USB_HUB_FUNCTION_LIST, *pUSB_HUB_FUNCTION_LIST; + + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* End of #ifndef __HUB_HOSTSTACKINTERFACE_H__ */ + +/********************** End of file HUB_HostStackInterface.h ******************/ diff --git a/h/usb2/usbHubInitialization.h b/h/usb2/usbHubInitialization.h new file mode 100644 index 0000000..6aabf24 --- /dev/null +++ b/h/usb2/usbHubInitialization.h @@ -0,0 +1,94 @@ +/* usbHubInitialization.h - Initialization and cleanup for hub class driver */ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +Modification history +-------------------- +01a,27jun03,nrv Changing the code to WRS standards +*/ + +/* +DESCRIPTION + +This module provides the initialization and the clean up +functions for the USB Hub Class Driver. +*/ + + + +/* +INTERNAL + ******************************************************************************* + * Filename : HUB_Initialization.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : This module provides the initialization and the clean up + * functions for the USB Hub Class Driver. + * + * + ******************************************************************************/ + + +#ifndef __USBHUBINITIALIZATION_H___ +#define __USBHUBINITIALIZATION_H___ + + +#ifdef __cplusplus +extern "C" { +#endif + + +/******************************************************************************* + * Function Name : HUB_Init + * Description : This function initializes the global variables and + * registers USB Hub Class Driver function pointers with the + * USB Host Software Stack. + * This also retrieves the USB Host Software Stack functions + * for future access. + * Parameters : None. + * Return Type : This returns 0 if the operation was successful. + * Else this returns -1. + ******************************************************************************/ + +INT8 usbHubInit(); + + +/******************************************************************************* + * Function Name : HUB_Exit + * Description : This function de-registers and cleans up the + * USB Hub Class Driver from the USB Host Software Stack. + * Parameters : None. + * Return Type : This returns 0 if the operation was successful. + * Else this returns -1. + ******************************************************************************/ + +INT8 usbHubExit(); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* End of #ifndef __HUB_INITIALIZATION_H___ */ + +/**************************** End of file HUB_Initialization.h ****************/ diff --git a/h/usb2/usbHubMisc.h b/h/usb2/usbHubMisc.h new file mode 100644 index 0000000..0fd1446 --- /dev/null +++ b/h/usb2/usbHubMisc.h @@ -0,0 +1,91 @@ +/* usbHubMisc.h - Miscellaneous for hub class driver */ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +Modification history +-------------------- +01a,27jun03,cfc Changing the code to WRS standards +*/ + + +/* +INTERNAL + ******************************************************************************* + * Filename : usbHubMisc.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : This module provides the debug functionality function + * header file for the USB Hub Class Driver. + * + * + ******************************************************************************/ + + +#ifndef __usbHubMisch +#define __usbHubMisch + + +/************************ GLOBAL FUNCTIONS ************************************/ + + +/******************************************************************************* + * Function Name : usbHubPortCntGet + * Description : This function returns the number of ports connected to a + * hub. + * Parameters : uHubId IN Hub Device Handle + * pPortCount OUT pointer to the Port count + * Return Type : a) USBHST_SUCCESS if port count was successfully returned + * b) USBHST_FAILURE if error occured. + ******************************************************************************/ +USBHST_STATUS usbHubPortCntGet(UINT32 uHubId, PUINT16 pPortCount); + +/******************************************************************************* + * Function Name : usbHubNodeIDGet + * Description : Gets the node id of the node connected to hub port + * Parameters : uHubId IN Handle to the hub. + * uPortIndex IN port index + * pNodeType OUT pointer to recieve the node type + * pNodeId OUT pointer to recive the node Id + * Return Type : a) USBHST_SUCCESS if node id was successfully returned + * b) USBHST_FAILURE if error occured. + ******************************************************************************/ +USBHST_STATUS usbHubNodeIDGet(UINT32 uHubId, + UINT16 uPortIndex, + PUINT16 pNodeType, + PUINT32 pNodeId); + +/******************************************************************************* + * Function Name : usbHubGetRootHubHandle + * Description : This function is called by the USB Host Software Stack for + * Finding the root hub handle of a Bus. + * Parameters : uBusHandle IN Unique identifier for the bus + * pRootHubHandle OUT Pointer to the root hub handle + * Return Type : a) USBHST_SUCCESS if handle was successfully returned + * b) USBHST_FAILURE if error occured. + ******************************************************************************/ +USBHST_STATUS usbHubGetRootHubHandle (UINT8 uBusHandle, PUINT32 pRootHubHandle); + + +#endif /* End of #ifndef __usbHubMisch */ + + +/**************************** End of File usbHubMisc.h *************************/ diff --git a/h/usb2/usbHubPortEventHandler.h b/h/usb2/usbHubPortEventHandler.h new file mode 100644 index 0000000..078b151 --- /dev/null +++ b/h/usb2/usbHubPortEventHandler.h @@ -0,0 +1,85 @@ +/* usbHubPortEventHandler.h - Functions for handling port events */ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +Modification history +-------------------- +01a,27jun03,nrv Changing the code to WRS standards +*/ + +/* +DESCRIPTION + +This provides the functions for handling the port events.This module +is used in conjunction with the Hub Event Handling Module and Bus +Manager Module. +*/ + + + +/* +INTERNAL + ******************************************************************************* + * Filename : HUB_PortEventHandler.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : This provides the functions for handling the port events. + * This module is used in conjunction with the Hub Event + * Handling Module and Bus Manager Module. + * + ******************************************************************************/ + +#ifndef __USBHUBPORTEVENTHANDLER_H___ +#define __USBHUBPORTEVENTHANDLER_H___ + + +#ifdef __cplusplus +extern "C" { +#endif + + +/******************************************************************************* + * Function Name : HUB_PortEventHandler + * Description : This function is the handler for any port event that has + * happened. + * Parameters : pHub IN The hub on which the event occurred. + * uPortNumber IN The port number where the event occurred. + * Return Type : Returns USBHST_INVALID_PARAMETER if parameters are wrong. + * Returns USBHST_FAILURE If any event handler failed. + * Returns USBHST_SUCCESS If all the events were handled + * successfully. + ******************************************************************************/ + +LOCAL USBHST_STATUS usbHubPortEventHandler + ( + pUSB_HUB_INFO pHub, + UINT8 uPortNumber + ); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* End of #ifndef __HUB_PORTEVENTHANDLER_H___ */ + +/**************************** End of file HUB_PortEventHandler.h **************/ diff --git a/h/usb2/usbHubTemplate.h b/h/usb2/usbHubTemplate.h new file mode 100644 index 0000000..ff6b840 --- /dev/null +++ b/h/usb2/usbHubTemplate.h @@ -0,0 +1,82 @@ +/* usbHubTemplate.h - Sample description */ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +Modification history +-------------------- +01a,27jun03,nrv Changing the code to WRS standards +*/ + +/* +DESCRIPTION + +This is the module that is used to used to perform the host side +data transfer validations. +*/ + + + +/* +INTERNAL + ******************************************************************************* + * Filename : Sample.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : This is a sample description + * Some other sample description. + * + * + ******************************************************************************/ + +#ifndef __USBHUBTEMPLATE_H__ +#define __USBHUBTEMPLATE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +/******************************************************************************* + * Function Name : HostDataTransferTest + * Description : This function is used to perform the host side data transfer + * validations. + * Parameters : uTransferType IN Specifies the type of Data Transfer. + * uNumberOfIterations IN Specifies the number of iterations + * to be performed. + * Return Type : None + ******************************************************************************/ + +void UsbHostDataTransferTest + ( + unsigned int uTransferType, + unsigned int uNumberOfIterations + ); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* End of #ifndef __SAMPLE_H__ */ + +/**************************** End of file Sample.h ****************************/ diff --git a/h/usb2/usbHubUtility.h b/h/usb2/usbHubUtility.h new file mode 100644 index 0000000..9ffd057 --- /dev/null +++ b/h/usb2/usbHubUtility.h @@ -0,0 +1,425 @@ +/* usbHubUtility.h - Manages topology and other information about bus */ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +Modification history +-------------------- +01b,24nov04,hch Add macros for USB BusM task name. +01a,27jun03,nrv Changing the code to WRS standards +*/ + +/* +DESCRIPTION + +This is the module that manages the topology and other information +about a bus. This is an autonomous thread that is initiated every time +a root hub is detected and this ends only when the USB Hub Class Driver +is unloaded or when the root hub is disabled. This is used in conjunction +with the Port Event Handling Module and Hub Event Handling Module. +*/ + + + +/* +INTERNAL + ******************************************************************************* + * Filename : HUB_Utility.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : This is the module that manages the topology and other + * information about a bus. This is an autonomous thread that + * is initiated every time a root hub is detected and this + * ends only when the USB Hub Class Driver is unloaded or + * when the root hub is disabled. This is used in conjunction + * with the Port Event Handling Module and + * Hub Event Handling Module. + * + * + ******************************************************************************/ + +#ifndef __USBHUB_UTILITY_H___ +#define __USBHUB_UTILITY_H___ + +#ifdef __cplusplus +LOCAL "C" { +#endif + + +/* includes */ + +#include "usbOsal.h" +#include "usbHst.h" +#include "usbHubCommon.h" + +/* defines */ + +#define USB_BUSM_TASK_NAME_BASE "BusM " +#define USB_BUSM_TASK_NAME_BASE_LEN 7 + + +/************************ GLOBAL FUNCTIONS DECLARATION ************************/ + +/******************************************************************************* + * Function Name : HUB_FindPortNumber + * Description : This function finds the port number of a device given the + * device handle and hub pointer. + * Parameters : uDeviceHandle IN Unique identifier for the device. + * pHub IN search at this Hub. + * Return Type : PORT_NUMBER_NOT_FOUND if the match was not found/invalid + * params. + * If found, it returns the port number. + ******************************************************************************/ + +LOCAL UINT8 usbHubFindPortNumber + ( + pUSB_HUB_INFO pHub, + UINT32 uDeviceHandle + ); + + +/******************************************************************************* + * Function Name : HUB_FindParentHubInBuses + * Description : This searches for a parent hub. + * Parameters : uDeviceHandle IN Unique identifier for the device. + * Return Type : NULL if the match was not found/invalid params. + * If found, it returns pointer to the PHUB_INFO structure of + * the parent hub. + ******************************************************************************/ + +LOCAL pUSB_HUB_INFO usbHubFindParentHubInBuses (UINT32 uDeviceHandle); + + +/******************************************************************************* + * Function Name : HUB_FindParentHub + * Description : This function recursively searches for the parent hub of + * the specified device. + * Parameters : uDeviceHandle IN Unique identifier for the device. + * pHub IN Start search at this Hub. + * Return Type : NULL if the match was not found/invalid params. + * If found, it returns pointer to the PHUB_INFO structure of + * the parent hub. + ******************************************************************************/ + +LOCAL pUSB_HUB_INFO usbHubFindParentHub + ( + UINT32 uDeviceHandle , + pUSB_HUB_INFO pHub + ); + + +/******************************************************************************* + * Function Name : HUB_CreateBusStructure + * Description : This function creates a bus structure and connects the + * same to the global Bus list. This also launches a + * thread to handle the events occurring on the Bus. + * Parameters : uBusHandle IN Unique identifier for the bus + * Return Type : This returns NULL if If the bus structure was unable to be + * created, thread was unable to be created, + * memory allocation failure. + * This returns HUB_BUS_INFO if the The pointer to the bus + * structure which was created. + ******************************************************************************/ + +LOCAL pUSB_HUB_BUS_INFO usbHubCreateBusStructure + ( + UINT8 uBusHandle + ); + + +/******************************************************************************* + * Function Name : HUB_DeleteBusStructure + * Description : This function deletes the Bus Structure and kills any + * thread associated with it. + * Parameters : uBusHandle IN Unique identifier for the bus + * Return Type : None. + ******************************************************************************/ + +LOCAL void usbHubDeleteBusStructure ( UINT8 uBusHandle); + + +/******************************************************************************* + * Function Name : HUB_PortDebounceHandler + * Description : This function is used for handling de-bounce condition. + * Parameters : pHub IN The hub on which the event occurred. + * uPortNumber IN The port number where the event occurred. + * Return Type : Returns USBHST_INVALID_PARAMETER if parameters are wrong. + * Returns USBHST_FAILURE If errors were encountered while + * handling de-bounce. + * Returns USBHST_SUCCESS If the handling was successful/ the + * time is not reached yet. + ******************************************************************************/ + +LOCAL USBHST_STATUS usbHubPortDebounceHandler + ( + pUSB_HUB_INFO pHub, + UINT8 uPortNumber + ); + + +/******************************************************************************* + * Function Name : HUB_ConfigureHub + * Description : This function configures a given hub. + * Parameters : pHub OUT Returns the hub Structure + * uDeviceHandle IN Unique identifier for the hub + * device. + * pBus IN Pointer to the Bus Structure of + * which this hub would be a child. + * pParentHub IN Pointer to the Parent of the hub + * to be added. + * Return Type : Returns USBHST_INSUFFICIENT_MEMORY if the + * memory allocation failed. + * returns USBHST_FAILURE If any requests + * failed due to errors. + * Returns USBHST_SUCCESS If the configuration + * was successful. + ******************************************************************************/ + +LOCAL USBHST_STATUS usbHubConfigure + ( + pUSB_HUB_INFO * pHub, + UINT32 uDeviceHandle, + pUSB_HUB_BUS_INFO pBus, + pUSB_HUB_INFO pParentHub + ); + + +/******************************************************************************* + * Function Name : HUB_HandleDeviceConnection + * Description : This function handles the device connection. + * Parameters : pHub IN The hub on which the device is connected. + * uPortNumber IN The port on which the device is + * connected. + * Return Type : Returns USBHST_INVALID_PARAMETERS If there are errors in + * parameters passed. + * Returns USBHST_SUCCESS other wise. + ******************************************************************************/ + + LOCAL USBHST_STATUS usbHubHandleDeviceConnection + ( + pUSB_HUB_INFO pHub, + UINT8 uPortNumber + ); + + +/******************************************************************************* + * Function Name : HUB_RetryDeviceConfiguration + * Description : This function is called to retry a device configuration. + * If the configuration retries have expired, then + * the port is disabled. + * Parameters : pHub IN The hub on which the device configuration + * is retried. + * uPortNumber IN The port number on which the device + * configuration is retried. + * Return Type : Returns USBHST_INVALID_PARAMETER if parameters are wrong. + * Returns USBHST_FAILURE If errors were encountered while + * handling re-configuration. + * Returns USBHST_SUCCESS If the re-configuration was success + ******************************************************************************/ + +LOCAL USBHST_STATUS usbHubRetryDeviceConfiguration + ( + pUSB_HUB_INFO pHub, + UINT8 uPortNumber + ); + + +/******************************************************************************* + * Function Name : HUB_PowerOnPort + * Description : This function is to re-enable a port that has caused a + * serious error. + * Parameters : pHub IN The hub on which the device is to be + * re-enabled. + * uPortNumber IN The port on the hub on which the device + * is to be re-enabled. + * Return Type : Returns USBHST_INVALID_PARAMETER if parameters are wrong. + * Returns USBHST_FAILURE If Error in trying to power + * on the port. + * Returns USBHST_SUCCESS If the power on of the port was + * successfully initiated. + ******************************************************************************/ + +LOCAL USBHST_STATUS usbHubPowerOnPort + ( + pUSB_HUB_INFO pHub, + UINT8 uPortNumber + ); + + +/******************************************************************************* + * Function Name : HUB_ResetPort + * Description : This function is used to reset a Port. This function + * ensures that the reset is issued to only one device per + * bus. + * Parameters : pHub IN The hub on which the reset has to be + * initiated. + * uPortNumber IN The port number on which the reset has + * to be initiated. + * Return Type : Returns USBHST_INVALID_PARAMETER if parameters are wrong. + * Returns USBHST_FAILURE If Error in trying to reset + * the port. + * Returns USBHST_SUCCESS If the reset was successfully + * initiated. + ******************************************************************************/ + +LOCAL USBHST_STATUS usbHubResetPort + ( + pUSB_HUB_INFO pHub, + UINT8 uPortNumber + ); + + +/******************************************************************************* + * Function Name : HUB_SubmitControlRequest + * Description : This function is to submit a blocking feature request to + * the hub. + * Parameters : pHub IN The pointer to the hub where the control + * request has to be issued. + * bmRequest IN The bmRequest field. + * bRequest IN The bRequest field. + * wValue IN The wValue field. + * wIndex IN The wIndex field. + * Return Type : Returns USBHST_INVALID_PARAMETER if parameters are wrong. + * Returns USBHST_FAILURE If Error in trying to submit a + * control request to the hub. + * Returns USBHST_SUCCESS If the submission of control + * request to the hub is successful. + ******************************************************************************/ + +LOCAL USBHST_STATUS usbHubSubmitControlRequest + ( + pUSB_HUB_INFO pHub, + UINT8 bmRequest, + UINT8 bRequest, + UINT16 wValue, + UINT8 wIndex + ); + + +/******************************************************************************* + * Function Name : HUB_GetHubDescriptor + * Description : This function is to retrieve the Hub descriptor. + * Parameters : uDeviceHandle IN The Device handle of the hub device. + * pBuffer IN OUT The buffer to copy the data to. + * pBufferLength IN OUT The length of the buffer. + * Return Type : a) Returns USBHST_INVALID_PARAMETER if parameters + * are wrong. + * b) Returns USBHST_FAILURE If Error in trying to submit a + * GetHubDescriptor request to the hub. + * c) Returns USBHST_SUCCESS If the submission of + * get status request to the hub is successful. + ******************************************************************************/ + +LOCAL USBHST_STATUS usbHubGetDescriptor + ( + UINT32 uDeviceHandle, + UINT8 * pBuffer, + UINT32 * pBufferLength + ); + + +/******************************************************************************* + * Function Name : HUB_GetStatus + * Description : This function is to submit a blocking get status + * request to the hub. + * Parameters : pHub IN The Hub in which the status is to be + * recieved. + * uPortNumber IN If this is a GetPortStatus request + * then this contains the port number + * Else this is 0. + * bmRequest IN Specifies if this is a hub status or + * a request for port status request. + * pBuffer IN OUT The buffer to copy the data to. + * pBufferLength IN OUT The length of the buffer. + * Return Type : Returns USBHST_INVALID_PARAMETER if parameters are wrong. + * Returns USBHST_FAILURE If Error in trying to submit a + * getStatus request to the hub. + * Returns USBHST_SUCCESS If the submission of + * get status request to the hub is successful. + ******************************************************************************/ + +LOCAL USBHST_STATUS usbHubGetStatus + ( + pUSB_HUB_INFO pHub, + UINT8 uPortNumber, + UINT8 bmRequest, + UINT8 * pBuffer, + UINT8 * pBufferLength + ); + + +/******************************************************************************* +* Function Name : HUB_SubmitInterruptRequest + * Description : This function is used for submitting a status change + * Interrupt IN request. + * Parameters : pHub IN The hub on which the status change interrupt + * IN request has to be initiated. + * Return Type : Returns USBHST_INVALID_PARAMETER if parameters are wrong. + * Returns USBHST_FAILURE If Error in trying to submit a + * status change interrupt IN request to the hub. + * Returns USBHST_SUCCESS If the submission of status change + * interrupt IN request to the hub was successful. + ******************************************************************************/ + +LOCAL USBHST_STATUS usbHubSubmitInterruptRequest (pUSB_HUB_INFO pHUB); + + + +/******************************************************************************* +* Function Name : HUB_FindNearestParentHub + * Description : This function is used to find the nearest high speed parent + * hub + * Parameters : uDeviceHandle IN Handle to the device + * pHub IN Pointer to HubInfo structure + * pPortNumber OUT Pointer to port number + * Return Type : Returns PHUB_INFO pointer to the nearest high speed + * parent Hub + * + ******************************************************************************/ + +LOCAL pUSB_HUB_INFO usbHubFindNearestParent + ( + UINT32 uDeviceHandle , + pUSB_HUB_INFO pHub , + UINT8 * pPortNumber + ); + + + +/******************************************************************************* + * Function Name : HUB_RemoveDevice + * Description : This calls the remove device of the Host stack.This + * also frees the memory as required. + * Parameters : pHub IN pointer to the Parent Hub. + * uPortIndex IN port Index + * Return Type : a) USBHST_INVALID_PARAMETER if there are invalid params + * b) USBHST_SUCCESS other wise. + * + ******************************************************************************/ +LOCAL USBHST_STATUS usbHubRemoveDevice(pUSB_HUB_INFO pHub, UINT8 uPortIndex); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* End of #ifndef __HUB_UTILITY_H___ */ + +/**************************** End of file HUB_Utility.h ***********************/ diff --git a/h/usb2/usbOhci.h b/h/usb2/usbOhci.h new file mode 100644 index 0000000..7e7c9d1 --- /dev/null +++ b/h/usb2/usbOhci.h @@ -0,0 +1,158 @@ +/* usbOhci.h - OHCI host controller driver interface definition */ + +/* Copyright 2004-2005 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +modification history +-------------------- +01f,28mar05,pdg non-pci changes +01e,25feb05,mta SPR 106276 +01d,18aug04,hch remove the DMA_MALLOC and DMA_FREE macro +01c,16jul04,hch adding OHCI PCI class definition +01b,26jun03,nld Changing the code to WRS standards +01a,17mar03,ssh Initial Version +*/ + +/* +DESCRIPTION + +This file contains the constants, data structures and functions exposed by the +OHCI host controller driver. +*/ + +/* +INTERNAL + ******************************************************************************* + * Filename : OHCI.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : This file contains the constants, data structures and + * functions exposed by the OHCI host controller driver. + * + * + ******************************************************************************/ + +#ifndef __INCusbOhcih +#define __INCusbOhcih + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +/* WindView Instrumentation */ +#include "usbHcdInstr.h" +#include +#include "usb/pciConstants.h" + +/* defines */ + +/* OpenHCI PCI class defintion */ + +#define OHCI_CLASS 0x0c /* BASEC value for serial bus */ +#define OHCI_SUBCLASS 0x03 /* SCC value for USB */ +#define OHCI_PGMIF 0x10 /* OpenHCI */ + +/* To hold the speed of the device (BEGIN) */ + +/* To hold the value for the full speed devices */ +#define USB_OHCI_DEVICE_FULL_SPEED 0x00 + +/* To hold the value for the low speed devices */ +#define USB_OHCI_DEVICE_LOW_SPEED 0x01 + +/* To hold the speed of the device (END) */ + +/* Macros used for bus specific handling - Start */ + +extern pUSB_HCD_BUS_INFO pOhciBusInfo[]; + +/* Macro used for converting the CPU memory to bus specific memory */ + +#define USB_OHCD_CONVERT_TO_BUS_MEM(INDEX, ADDRESS) \ + (((ADDRESS) == NULL) ? 0: \ + pOhciBusInfo[INDEX]->pFuncCpuToBus((pVOID)ADDRESS)) + +/* Macro used for converting the bus specific memory to CPU memory */ +#define USB_OHCD_CONVERT_FROM_BUS_MEM(INDEX ,ADDRESS) \ + (((ADDRESS) == 0) ? 0: \ + pOhciBusInfo[INDEX]->pFuncBusToCpu((UINT32)ADDRESS)) + +/* Macro used for swapping the 32 bit values */ + +#define USB_OHCD_SWAP_DATA(INDEX,VALUE) \ + (((pOhciBusInfo[INDEX]->pFuncDataSwap) == NULL) ? VALUE : \ + pOhciBusInfo[INDEX]->pFuncDataSwap(VALUE)) + +/* Macro used for swapping the contents of buffers */ + +#define USB_OHCD_SWAP_BUFDATA(INDEX,BUFFER,SIZE) \ + (((pOhciBusInfo[INDEX]->pFuncBufferSwap) == NULL) ? SIZE : \ + pOhciBusInfo[INDEX]->pFuncBufferSwap(BUFFER, SIZE)) + +/* Macros used for bus specific handling - End */ + +/* Size of DMA memory */ + +#define OHCI_FREE(pBfr) OS_FREE ((char *) pBfr) + +#define DMA_FLUSH(pBfr, bytes) CACHE_DMA_FLUSH (pBfr, bytes) +#define DMA_INVALIDATE(pBfr, bytes) CACHE_DMA_INVALIDATE (pBfr, bytes) + +#define USER_FLUSH(pBfr, bytes) CACHE_USER_FLUSH (pBfr, bytes) +#define USER_INVALIDATE(pBfr,bytes) CACHE_USER_INVALIDATE (pBfr, bytes) + +#define OHCI_STATUS INT8 +#define OHCI_SUCCESS ((INT8) 0) +#define OHCI_FAILURE ((INT8) -12) + + +/* function declarations */ + +/******************************************************************************* + * Function Name : usbOhciInit + * Description : Function to initialise the OHCI Host Controller Driver. + * This function detects the number of OHCI Controllers + * present on the system and initializes all the OHCI + * controllers. + * Parameters : None. + * Return Type : Returns TRUE if the OHCI Host Controllers are initialized + * successfully. Else returns FALSE. + ******************************************************************************/ +BOOLEAN usbOhciInit (void); + +/******************************************************************************* + * Function Name : usbOhciExit + * Description : Function to uninitialise the OHCI Host Controller Driver. + * Parameters : None. + * Return Type : Returns TRUE if all the OHCI Controllers are reset and + * the cleanup is successful. Else returns FALSE. + ******************************************************************************/ +BOOLEAN usbOhciExit (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbOhcih */ + +/* End of file usbOhci.h */ diff --git a/h/usb2/usbOhciRegisterInfo.h b/h/usb2/usbOhciRegisterInfo.h new file mode 100644 index 0000000..8195760 --- /dev/null +++ b/h/usb2/usbOhciRegisterInfo.h @@ -0,0 +1,365 @@ +/* usbOhciRegisterInfo.h - OHCI host controller register definition */ + +/* Copyright 2004-2005 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +modification history +-------------------- +01d,02apr05,pdg Fix for exception during initialization +01c,29mar05,pdg non-PCI changes +01b,26jun03,nld Changing the code to WRS standards +01a,01jan03,ssh Initial Version +*/ + +/* +DESCRIPTION + +This file defines the register offsets and macros for the OHCI Host Controller. +*/ + +/* +INTERNAL + ******************************************************************************* + * Filename : RegisterInfo.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : This file defines the register offsets and macros for the + * OHCI Host Controller. + * + * + ******************************************************************************/ + +#ifndef __INCusbOhciRegisterInfoh +#define __INCusbOhciRegisterInfoh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +/*********************** MACROS FOR REGISTER OFFSETS **************************/ + +/* Offset of the OHCI Controller Revision register */ +#define USB_OHCI_REVISION_REGISTER_OFFSET 0x00 + +/* Offset of the OHCI Controller Control register */ +#define USB_OHCI_CONTROL_REGISTER_OFFSET 0x04 + +/* Offset of the OHCI Controller Command Status register */ +#define USB_OHCI_COMMAND_STATUS_REGISTER_OFFSET 0x08 + +/* Offset of the OHCI Controller Interrupt Status register */ +#define USB_OHCI_INTERRUPT_STATUS_REGISTER_OFFSET 0x0C + +/* Offset of the OHCI Controller Interrupt Enable register */ +#define USB_OHCI_INTERRUPT_ENABLE_REGISTER_OFFSET 0x10 + +/* Offset of the OHCI Controller Interrupt Disable register */ +#define USB_OHCI_INTERRUPT_DISABLE_REGISTER_OFFSET 0x14 + +/* Offset of the OHCI Contoller Communication Area register */ +#define USB_OHCI_HCCA_REGISTER_OFFSET 0x18 + +/* Offset of the OHCI Controller Periodic Current ED register */ +#define USB_OHCI_PERIOD_CURRENT_ED_REGISTER_OFFSET 0x1C + +/* Offset of the OHCI Controller Control Head ED register */ +#define USB_OHCI_CONTROL_HEAD_ED_REGISTER_OFFSET 0x20 + +/* Offset of the OHCI Controller Control Current ED register */ +#define USB_OHCI_CONTROL_CURRENT_ED_REGISTER_OFFSET 0x24 + +/* Offset of the OHCI Controller Bulk Head ED register */ +#define USB_OHCI_BULK_HEAD_ED_REGISTER_OFFSET 0x28 + +/* Offset of the OHCI Controller Bulk Current ED register */ +#define USB_OHCI_BULK_CURRENT_ED_REGISTER_OFFSET 0x2C + +/* Offset of the OHCI Controller Done Head register */ +#define USB_OHCI_DONE_HEAD_REGISTER_OFFSET 0x30 + +/* Offset of the OHCI Controller Frame Interval register */ +#define USB_OHCI_FM_INTERVAL_REGISTER_OFFSET 0x34 + +/* Offset of the OHCI Controller Frame Remaining register */ +#define USB_OHCI_FM_REMAINING_REGISTER_OFFSET 0x38 + +/* Offset of the OHCI Controller Frame Number register */ +#define USB_OHCI_FM_NUMBER_REGISTER_OFFSET 0x3C + +/* Offset of the OHCI Controller Periodic Start register */ +#define USB_OHCI_PERIODIC_START_REGISTER_OFFSET 0x40 + +/* Offset of the OHCI Controller LS Threshold register */ +#define USB_OHCI_LC_THRESHOLD_REGISTER_OFFSET 0x44 + +/* Offset of the OHCI Controller Root Hub Descriptor A register */ +#define USB_OHCI_RH_DESCRIPTOR_A_REGISTER_OFFSET 0x48 + +/* Offset of the OHCI Controller Root Hub Descriptor B register */ +#define USB_OHCI_RH_DESCRIPTOR_B_REGISTER_OFFSET 0x4C + +/* Offset of the OHCI Controller Root Hub Status register */ +#define USB_OHCI_RH_STATUS_REGISTER_OFFSET 0x50 + +/* + * Offset of the OHCI Controller Root Hub Port Status register. The + * port status corresponding to the root hub port 1 is stared at the + * following offset. + * + * The following is the calculation to obtain the offset of port + * status register corresponding to root hub port 'n': + * + * USB_OHCI_RH_PORT_STATUS_BASE_REGISTER_OFFSET + (n * 4) + */ +#define USB_OHCI_RH_PORT_STATUS_BASE_REGISTER_OFFSET 0x54 + + +/****************** MACROS FOR THE REGISTER FIELD VALUES **********************/ + +/* Mask value for the HCFS field of the HcControl register */ +#define USB_OHCI_CONTROL_HCFS_MASK 0x000000C0 + +/* Value to set the HCFS field of the HcControl register (for USB Reset) */ +#define USB_OHCI_CONTROL_HCFS_USB_RESET 0x00000000 + +/* Value to set the HCFS field of the HcControl register (for USB Resume) */ +#define USB_OHCI_CONTROL_HCFS_USB_RESUME 0x00000040 + +/* + * Value to set the HCFS field of the HcControl register (for USB Operational) + */ +#define USB_OHCI_CONTROL_HCFS_USB_OPERATIONAL 0x00000080 + +/* Value to set the HCFS field of the HcControl register (for USB Suspend) */ +#define USB_OHCI_CONTROL_HCFS_USB_SUSPEND 0x000000C0 + +/* + * Value to clear the Remote Wakeup Enable (RWE) bit of the HcControl + * register + */ +#define USB_OHCI_CONTROL_RWE 0x00000400 + +/* Value to set the Control List Enable (CLE) bit of the HcControl register */ +#define USB_OHCI_CONTROL_CLE 0x00000010 + +/* Value to set the Bulk List Enable (BLE) bit of the HcControl register */ +#define USB_OHCI_CONTROL_BLE 0x00000020 + +/* Value to set the Periodic List Enable (PLE) bit of the HcControl register */ +#define USB_OHCI_CONTROL_PLE 0x00000004 + +/* Value to set Isochronous List Enable (IE) bit of the HcControl register */ +#define USB_OHCI_CONTROL_IE 0x00000008 + +/* Value to set the HCR field of the HcCommandStatus register */ +#define USB_OHCI_COMMAND_STATUS_HCR 0x00000001 + +/* + * Value to set the Control List Filled (CLF) bit of the HcCommandStatus + * register + */ +#define USB_OHCI_COMMAND_STATUS_CLF 0x00000002 + +/* + * Value to set the Bulk List Filled (BLF) bit of the HcCommandStatus + * register + */ +#define USB_OHCI_COMMAND_STATUS_BLF 0x00000004 + +/* Value to check whether SOF interrupt is pending */ +#define USB_OHCI_INTERRUPT_STATUS_SOF 0x00000004 + +/* Value to check whether a Write Back Done Head interrupt has occurred */ +#define USB_OHCI_INTERRUPT_STATUS_DONE_HEAD 0x00000002 + +/* Value to check whether root hub status change interrupt is pending */ +#define USB_OHCI_INTERRUPT_STATUS_RHSC 0x00000040 + +/* + * Value to check whether resume detect interrupt is pending. + * + * NOTE: This value is also used to enable or disable 'Resume Detect' interrupt + * based on the ClearFeature(REMOTE_WAKEUP) or SetFeature(REMOTE_WAKEUP) + * request. + */ +#define USB_OHCI_INTERRUPT_STATUS_RESUME_DETECT 0x00000008 + +/* + * Mask value to obtain the contents of the number of downsteam ports (NDP) + * field of the HcRhDescriptorA register. + */ +#define USB_OHCI_RH_DESCRIPTOR_A_REGISTER_NDP_MASK 0x000000FF + +/* + * Mask value to obtain the contents of the power switching mode (PSM) + * field of the HcRhDescriptorA register. + */ +#define USB_OHCI_RH_DESCRIPTOR_A_REGISTER__PSM_MASK 0x00000100 + +/* + * Mask value to obtain the contents of the Port Power Control + * Mask (PPCM) field of the HcRhDescriptorB register. + */ +#define USB_OHCI_HC_RH_DESCRIPTOR_B_REGISTER__PPCM_MASK 0xFFFE0000 + + +/* To hold the mask value to indicate a status change on the root hub */ +#define USB_OHCI_RH_STATUS_CHANGE_MASK 0x00030000 + +/* + * Value to check the local power status (LPS) bit of the HcRhStatus + * register. This value will be used for clearing the global power status. + */ + +#define USB_OHCI_RH_STATUS__LPS 0x00000001 + +/* + * Value to check the local power status change (LPSC) bit of the HcRhStatus + * register. This value will be used for setting the global power status. + */ +#define USB_OHCI_RH_STATUS_LPSC 0x00010000 + +/* + * Value to check the over current indicator change (OCIC) bit of the + * HcRhStatus register. This value will be used for clearing the OCIC bit. + */ +#define USB_OHCI_RH_STATUS_OCIC 0x00020000 + +/* To hold the mask value to indicate a status change on the root hub port */ +#define USB_OHCI_RH_PORT_STATUS_CHANGE_MASK 0x001F0000 + +/* Value to check the port current connect status (CCS) bit */ +#define USB_OHCI_RH_PORT_STATUS_CCS 0x00000001 + +/* Value to check the port enable status (PES) bit */ +#define USB_OHCI_RH_PORT_STATUS_PES 0x00000002 + +/* Value to check the port suspend status (PSS) bit */ +#define USB_OHCI_RH_PORT_STATUS_PSS 0x00000004 + +/* Value to check the port over current indicator (POCI) bit */ +#define USB_OHCI_RH_PORT_STATUS_POCI 0x00000008 + +/* Value to check the port reset status (PRS) bit */ +#define USB_OHCI_RH_PORT_STATUS_PRS 0x00000010 + +/* Value to check the port power status (PPS) bit */ +#define USB_OHCI_RH_PORT_STATUS_PPS 0x00000100 + +/* Value to check the low speed device attached (LSDA) bit */ +#define USB_OHCI_RH_PORT_STATUS_LSDA 0x00000200 + +/* Value to check the connect status change (CSC) bit */ +#define USB_OHCI_RH_PORT_STATUS_CSC 0x00010000 + +/* Value to check the port enable status change (PESC) bit */ +#define USB_OHCI_RH_PORT_STATUS_PESC 0x00020000 + +/* Value to check the port suspend status change (PSSC) bit */ +#define USB_OHCI_RH_PORT_STATUS_PSSC 0x00040000 + +/* Value to check the over current indicator chage (OCIC) bit */ +#define USB_OHCI_RH_PORT_STATUS_OCIC 0x00080000 + +/* Value to check the port reset status change (PRSC) bit */ +#define USB_OHCI_RH_PORT_STATUS_PRSC 0x00100000 + +/* globals */ + +#ifdef NO_CACHE_COHERENCY + +extern UINT32 usbOhciRegRead + ( + UINT32 index, /* Index of host controller */ + UINT32 address /* Address from which contents have to be read */ + ); + +extern VOID usbOhciRegWrite + ( + UINT32 index, /* Index of host controller */ + UINT32 address,/* Address to which contents have to be written */ + UINT32 value /* Value to be written */ + ); +#endif +/********************* MACROS FOR REGISTER READ/WRITE *************************/ + +/******************************************************************************* + * MACRO NAME : USB_OHCI_RH_PORT_STATUS_REGISTER_OFFSET + * DESCRIPTION : Macro to obtain the register offset for the root hub port. + * PARAMETERS : PORT_NUMBER IN Port number corresponding to the root hub + * port. + * RETURN TYPE : None + ******************************************************************************/ +#define USB_OHCI_RH_PORT_STATUS_REGISTER_OFFSET(PORT_NUMBER) \ + USB_OHCI_RH_PORT_STATUS_BASE_REGISTER_OFFSET + (4 * (PORT_NUMBER - 1)) + +/******************************************************************************* + * MACRO NAME : USB_OHCI_REG_WRITE + * DESCRIPTION : Macro to write to the register. + * PARAMETERS : INDEX IN Index of the host controller. + ADDRESS IN Address of the location. + * VALUE IN Value to be written into the register. + * RETURN TYPE : None + ******************************************************************************/ + +#ifndef NO_CACHE_COHERENCY + +#define USB_OHCI_REG_WRITE(INDEX, ADDRESS, VALUE) \ + \ + { \ + (*((volatile UINT32 *) (ADDRESS)) = \ + (USB_OHCD_SWAP_DATA (INDEX, ((UINT32) VALUE)))) ; \ + } +#else + +#define USB_OHCI_REG_WRITE(INDEX, ADDRESS, VALUE) \ + usbOhciRegWrite(INDEX, ADDRESS, VALUE) + +#endif + +/******************************************************************************* + * MACRO NAME : USB_OHCI_REG_READ + * DESCRIPTION : Macro to read the contents of a register. + * PARAMETERS : INDEX IN Index of the host controller + ADDRESS IN Address of the location. + * RETURN TYPE : Returns the contents of the register. + ******************************************************************************/ + +#ifndef NO_CACHE_COHERENCY + +#define USB_OHCI_REG_READ(INDEX, ADDRESS) \ + (USB_OHCD_SWAP_DATA (INDEX, *((volatile UINT32 *)(ADDRESS)))) +#else + +#define USB_OHCI_REG_READ(INDEX, ADDRESS) \ + usbOhciRegRead (INDEX, ADDRESS) + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbOhciRegisterInfoh */ + +/* End of file usbOhciRegisterInfo.h */ diff --git a/h/usb2/usbOhciTransferManagement.h b/h/usb2/usbOhciTransferManagement.h new file mode 100644 index 0000000..3d4034b --- /dev/null +++ b/h/usb2/usbOhciTransferManagement.h @@ -0,0 +1,1297 @@ +/* usbOhciTransferManagement.h - OHCI host controller transgfer management */ + +/* Copyright 2004-2005 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +modification history +-------------------- +01g,29mar05,pdg non-PCI changes +01g,02mar05,ami Structure members removed (SPR #106373) +01f,03feb05,ami The check for endpoint halt macro handled properly + (OHCI_IS_ENDPOINT_HALTED) for big-endian targets +01d,05oct04,mta SPR100704- Removal of floating point math +01c,16aug04,pdg Fix for print-stop-reprint +01b,26jun03,nld Changing the code to WRS standards +01a,17mar03,ssh Initial Version +*/ + +/* +DESCRIPTION + +This file contains the data structure declarations for transfer management. +*/ + +/* +INTERNAL + ******************************************************************************* + * Filename : OHCI_TransferManagement.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : This file contains the data structure declarations for + * transfer management. + * + * + ******************************************************************************/ + +#ifndef __INCusbOhciTransferManagementh +#define __INCusbOhciTransferManagementh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +/********************** MODULE SPECIFIC MACRO DEFINITION **********************/ + +/* To hold the status of the OHCI transfer */ +#define USB_OHCI_TRANSFER_STATUS UCHAR + + +/* To hold the USB Descriptor Types (BEGIN) */ + +/* To hold the value used to identify the USB Device Descriptor */ +#define USB_OHCI_DEVICE_DESCRIPTOR_TYPE 0x01 + +/* To hold the value used to identify the USB Configuration Descriptor */ +#define USB_OHCI_CONFIGURATION_DESCRIPTOR_TYPE 0x02 + +/* To hold the value used to identify the USB String Descriptor */ +#define USB_OHCI_STRING_DESCRIPTOR_TYPE 0x03 + +/* To hold the value used to identify the USB Interface Descriptor */ +#define USB_OHCI_INTERFACE_DESCRIPTOR_TYPE 0x04 + +/* To hold the value used to identify the USB Endpoint Descriptor */ +#define USB_OHCI_ENDPOINT_DESCRIPTOR_TYPE 0x05 + +/* To hold the USB Descriptor Types (END) */ + +/* To hold the USB Transfer Types (BEGIN) */ + +/* Value to specific an USB Control Transfer */ +#define USB_OHCI_CONTROL_TRANSFER 0x00 + +/* Value to specific an USB Isochronous Transfer */ +#define USB_OHCI_ISOCHRONOUS_TRANSFER 0x01 + +/* Value to specific an USB Bulk Transfer */ +#define USB_OHCI_BULK_TRANSFER 0x02 + +/* Value to specific an USB Interrupt Transfer */ +#define USB_OHCI_INTERRUPT_TRANSFER 0x03 + +/* To hold the USB Transfer Types (END) */ + +/* Condition codes for transfer completion (BEGIN) */ + +/* Value to specify 'No Error' condition */ +#define USB_OHCI_COMPLETION_CODE_NO_ERROR 0x00 + +/* Value to specify 'Device Not Responding' condition */ +#define USB_OHCI_COMPLETION_CODE_DEVICE_NOT_RESPONDING 0x05 + +/* Value to specify 'Not Accessed' condition */ +#define USB_OHCI_COMPLETION_CODE_NOT_ACCESSED 0x0F + +/* Condition codes for transfer completion (END) */ + +/********************* MODULE SPECIFIC MACRO DECLARATION **********************/ + +/* Macro definitions used to populate the endpoint descriptor (BEGIN) */ + +/* + * To hold the endpoint transfer type as defined in the bmAttributes field + * of the USB endpoint descriptor. + */ + +#define USB_CONTROL_ENDPOINT 0x00 /* Control Endpoint */ +#define USB_ISOCHRONOUS_ENDPOINT 0x01 /* Isochronous Endpoint */ +#define USB_BULK_ENDPOINT 0x02 /* Bulk Endpoint */ +#define USB_INTERRUPT_ENDPOINT 0x03 /* Interrupt Endpoint */ + +/* + * To hold the endpoint direction as defined in the bEndpointAddress field of + * the USB endpoint descriptor. + */ + +#define USB_OUT_ENDPOINT 0x00 /* OUT Endpoint */ +#define USB_IN_ENDPOINT 0x80 /* IN Endpoint */ + +/* + * To hold the control transfer direction as specified in the bmRequestType + * field of the SETUP packet. + */ + +#define USB_CONTROL_OUT_TRANSFER 0x00 /* Control OUT Transfer */ +#define USB_CONTROL_IN_TRANSFER 0x80 /* Control IN Transfer */ + +/* To hold the SETUP packet size */ + +#define USB_SETUP_PACKET_LENGTH 0x08 + +/* To hold the endpoint direction as define in the OHCI Specification */ + +#define OHCI_BIDIRECTIONAL_ENDPOINT 0x00 /* + * Bidirectional endpoint. Transfer + * direction will be obtained from + * the transfer descriptor (TD). + */ +#define OHCI_OUT_ENDPOINT 0x01 /* OUT Endpoint */ +#define OHCI_IN_ENDPOINT 0x02 /* IN Endpoint */ + +/* To hold the format of the transfer descriptor (TD) */ + +#define OHCI_GENERAL_TD_FORMAT 0x00 /* Control, Bulk or Interrupt TD */ +#define OHCI_ISOCHRONOUS_TD_FORMAT 0x01 /* Isochronous TD */ + +/* Macro definitions used to populate the endpoint descriptor (END) */ + +/* To hold the data toggle value for the general transfer descriptor */ + +#define USB_OHCI_TD_DATA_TOGGLE0 0x00000000 /* Data toggle 0 */ +#define USB_OHCI_TD_DATA_TOGGLE1 0x01000000 /* Data toggle 1 */ + + +/**************** MACROS TO PARSE THE USB ENDPOINT DESCRIPTOR *****************/ + +/******************************************************************************* + * MACRO NAME : USB_GET_ENDPOINT_NUMBER + * DESCRIPTION : Macro to obtain the endpoint number from the bEndpointAddress + * field of the USB endpoint descriptor. + * PARAMETERS : bEndpointAddress IN Endpoint address as specified in the + * USB endpoint descriptor. + * RETURN TYPE : None + ******************************************************************************/ +#define USB_GET_ENDPOINT_NUMBER(bEndpointAddress) (bEndpointAddress & 0x0F) + +/******************************************************************************* + * MACRO NAME : USB_GET_ENDPOINT_DIRECTION + * DESCRIPTION : Macro to obtain the endpoint direction from the + * bEndpointAddress field of the USB endpoint descriptor. + * PARAMETERS : bEndpointAddress IN Endpoint address as specified in the + * USB endpoint descriptor. + * RETURN TYPE : None + ******************************************************************************/ +#define USB_GET_ENDPOINT_DIRECTION(bEndpointAddress) (bEndpointAddress & 0x80) + +/******************************************************************************* + * MACRO NAME : USB_GET_ENDPOINT_TRANSFER_TYPE + * DESCRIPTION : Macro to obtain the transfer type from the bmAttributes + * field of the USB endpoint descriptor. + * PARAMETERS : bmAttributes IN Endpoint attributes as specified in the + * USB endpoint descriptor. + * RETURN TYPE : None + ******************************************************************************/ +#define USB_GET_ENDPOINT_TRANSFER_TYPE(bmAttributes) (bmAttributes & 0x03) + +/******************************************************************************* + * MACRO NAME : USB_GET_CONTROL_TRANSFER_DIRECTION + * DESCRIPTION : Macro to obtain the direction of the control transfer. + * PARAMETERS : bmRequestType IN bmRequestType field of the SETUP + * packet. + * RETURN TYPE : None + ******************************************************************************/ +#define USB_GET_CONTROL_TRANSFER_DIRECTION(bmRequestType) \ + (bmRequestType & USB_CONTROL_IN_TRANSFER) + + +/**************** MACROS TO HANDLE THE OHCI ENDPOINT DESCRIPTOR ***************/ + +/******************************************************************************* + * MACRO NAME : OHCI_POPULATE_ED_CONTROL_INFO + * DESCRIPTION : Macro to populate the control information of the OHCI + * endpoint descriptor. + * for the endpoint. + * PARAMETERS : index IN index of the host controller + * uControlInformation OUT Control information for the + * OHCI Endpoint Descriptor. + * uFunctionAddress IN Device Address. + * uEndpointNumber IN Endpoint number. + * uDirection IN Endpoint direction. + * uSpeed IN Device speed. + * uFormat IN Transfer descriptor format. + * uMaximumPacketSize IN Maximum packet size for the + * endpoint. + * RETURN TYPE : None + ******************************************************************************/ + +#define OHCI_POPULATE_ED_CONTROL_INFO(index, \ + uControlInformation, \ + uFunctionAddress, \ + uEndpointNumber, \ + uDirection, \ + uSpeed, \ + uFormat, \ + uMaximumPacketSize) \ + \ + { \ + /* Initialize the endpoint descriptor control information */ \ + (uControlInformation) = 0; \ + \ + /* Populate the device address */ \ + (uControlInformation) |= (uFunctionAddress); \ + \ + /* Populate the endpoint number */ \ + (uControlInformation) |= (uEndpointNumber << 7); \ + \ + /* Populate the endpoint direction */ \ + (uControlInformation) |= (uDirection << 11); \ + \ + /* Populate the device speed */ \ + (uControlInformation) |= (uSpeed << 13); \ + \ + /* Populate the transfer descriptor format */ \ + (uControlInformation) |= (uFormat << 15); \ + \ + /* Populate the maximum packet size for the endpoint */ \ + (uControlInformation) |= (uMaximumPacketSize << 16); \ + \ + uControlInformation = USB_OHCD_SWAP_DATA(index, uControlInformation); \ + } + + +/******************************************************************************* + * MACRO NAME : OHCI_SET_ED_SKIP_BIT + * DESCRIPTION : Macro to set the SKIP bit in the control information of the + * OHCI endpoint descriptor. + * PARAMETERS : index IN index of the host controller + * uControlInformation OUT Control information for the + * OHCI Endpoint Descriptor. + * RETURN TYPE : None + ******************************************************************************/ +#define OHCI_SET_ED_SKIP_BIT(index, uControlInformation) \ + { \ + uControlInformation = USB_OHCD_SWAP_DATA(index,uControlInformation); \ + (uControlInformation) |= 0x00004000; \ + uControlInformation = USB_OHCD_SWAP_DATA(index,uControlInformation); \ + } + +/******************************************************************************* + * MACRO NAME : OHCI_CLEAR_ED_SKIP_BIT + * DESCRIPTION : Macro to clear the SKIP bit in the control information of + * the OHCI endpoint descriptor. + * PARAMETERS : index IN index of the host controller + * uControlInformation OUT Control information for the + * OHCI Endpoint Descriptor. + * RETURN TYPE : None + ******************************************************************************/ +#define OHCI_CLEAR_ED_SKIP_BIT(index, uControlInformation) \ + { \ + uControlInformation = USB_OHCD_SWAP_DATA(index,uControlInformation); \ + (uControlInformation) &= (~0x00004000); \ + uControlInformation = USB_OHCD_SWAP_DATA(index,uControlInformation); \ + } + + +/******************************************************************************* + * MACRO NAME : OHCI_GET_SKIP_BIT + * DESCRIPTION : Macro to get the value of the SKIP bit in the control + * information of the OHCI endpoint descriptor. + * PARAMETERS : index IN index of the host controller + * uControlInformation IN Control information for the + * OHCI Endpoint Descriptor. + * RETURN TYPE : UINT32 + ******************************************************************************/ +#define OHCI_GET_SKIP_BIT(index, uControlInformation) \ + ((USB_OHCD_SWAP_DATA(index, uControlInformation) & 0x00004000) >> 14) + +/******************************************************************************* + * MACRO NAME : OHCI_GET_ED_MPS + * DESCRIPTION : Macro to obtain the maximum packet size of the endpoint from + * the control information of the OHCI endpoint descriptor. + * PARAMETERS : index IN index of the host controller + * uControlInformation OUT Control information for the + * OHCI Endpoint Descriptor. + * RETURN TYPE : None + ******************************************************************************/ +#define OHCI_GET_ED_MPS(index, uControlInformation) \ + ((USB_OHCD_SWAP_DATA(index, uControlInformation) & \ + 0x07FF0000) >> 16); + +/******************************************************************************* + * MACRO NAME : OHCI_MODIFY_ED_SPEED_AND_MPS + * DESCRIPTION : Macro to modify the speed and the maximum packet size or + * the endpoint descriptor. + * + * PARAMETERS : index IN index of the host controller + * uControlInformation IN Control information for the + * OHCI Endpoint Descriptor. + * RETURN TYPE : None + ******************************************************************************/ +#define OHCI_MODIFY_ED_SPEED_AND_MPS(index, \ + uControlInformation, \ + uSpeed, \ + uMaximumPacketSize) \ + \ + { \ + uControlInformation = USB_OHCD_SWAP_DATA(index, uControlInformation); \ + \ + /* Clear the device speed field */ \ + (uControlInformation) &= (~0x00002000); \ + \ + /* Populate the device speed */ \ + (uControlInformation) |= (uSpeed << 13); \ + \ + /* Clear the maximum packet size field for the endpoint */ \ + (uControlInformation) &= (~0x07FF0000); \ + \ + /* Populate the maximum packet size for the endpoint */ \ + (uControlInformation) |= (uMaximumPacketSize << 16); \ + \ + uControlInformation = USB_OHCD_SWAP_DATA(index, uControlInformation); \ + } + +/******************************************************************************* + * MACRO NAME : OHCI_IS_CONTROL_ENDPOINT + * DESCRIPTION : Macro to identify whether the OHCI endpoint descriptor + * corresponds to an control endpoint. + * + * If the ENDPOINT_DESCRIPTOR::FORMAT bit is not set and + * the ENDPOINT_DESCRIPTOR::DIRECTION bit is GET DIRECTION + * FROM TD, it means a control endpoint. + * + * PARAMETERS : index IN index of the host controller + * uControlInformation IN Control information for the + * OHCI Endpoint Descriptor. + * RETURN TYPE : None + ******************************************************************************/ +#define OHCI_IS_CONTROL_ENDPOINT(index, uControlInformation) \ + ((0 == ((USB_OHCD_SWAP_DATA(index, uControlInformation)) \ + & 0x00008000)) \ + && \ + (0 == ((USB_OHCD_SWAP_DATA(index, uControlInformation)) \ + & 0x00001800))) + +/******************************************************************************* + * MACRO NAME : OHCI_IS_BULK_OR_INTERRUPT_ENDPOINT + * DESCRIPTION : Macro to identify whether the OHCI endpoint descriptor + * corresponds to a bulk or interrupt endpoint. + * PARAMETERS : index IN index of the host controller + * uControlInformation IN Control information for the + * OHCI Endpoint Descriptor. + * RETURN TYPE : None + ******************************************************************************/ +#define OHCI_IS_BULK_OR_INTERRUPT_ENDPOINT(index, uControlInformation) \ + ((0 == ((USB_OHCD_SWAP_DATA(index, uControlInformation)) \ + & 0x00008000)) \ + && \ + ((0x00000800 == ((USB_OHCD_SWAP_DATA(index, uControlInformation)) \ + & 0x00000800)) \ + || \ + (0x00001000 == ((USB_OHCD_SWAP_DATA(index, uControlInformation)) \ + & 0x00001000)))) + + +/******************************************************************************* + * MACRO NAME : OHCI_IS_ISOCHRONOUS_ENDPOINT + * DESCRIPTION : Macro to identify whether the OHCI endpoint descriptor + * corresponds to an isochronous endpoint. + * PARAMETERS : index IN index of the host controller + * uControlInformation IN Control information for the + * OHCI Endpoint Descriptor. + * RETURN TYPE : None + ******************************************************************************/ +#define OHCI_IS_ISOCHRONOUS_ENDPOINT(index, uControlInformation) \ + ((USB_OHCD_SWAP_DATA(index, uControlInformation)) & 0x00008000) + + +/******************************************************************************* + * MACRO NAME : OHCI_IS_ENDPOINT_HALTED + * DESCRIPTION : Macro to check whether the endpoint is halted. + * PARAMETERS : index IN index of the host controller + * pEndpointDescriptor IN Pointer to the endpoint descriptor. + * RETURN TYPE : None + ******************************************************************************/ + +#define OHCI_IS_ENDPOINT_HALTED(index, pEndpointDescriptor) \ + ((0 != \ + ((USB_OHCD_SWAP_DATA(index, \ + (UINT32)(pEndpointDescriptor->TDQueueHead.pGeneralTDQueueHead)))\ + & 0x01)) ? TRUE : FALSE) + + +/******************************************************************************* + * MACRO NAME : OHCI_CLEAR_ENDPOINT_HALT + * DESCRIPTION : Macro to clear the endpoint halt condition. + * PARAMETERS : index IN index of the host controller + * pEndpointDescriptor IN Pointer to the endpoint descriptor. + * RETURN TYPE : None + ******************************************************************************/ +#define OHCI_CLEAR_ENDPOINT_HALT(index, pEndpointDescriptor) \ + pEndpointDescriptor->TDQueueHead.pGeneralTDQueueHead = \ + (PUSB_OHCI_GENERAL_TRANSFER_DESCRIPTOR) \ + ((UINT32)(pEndpointDescriptor->TDQueueHead.pGeneralTDQueueHead) \ + & (~(USB_OHCD_SWAP_DATA(index, 0x01)))) + + +/******************************************************************************* + * MACRO NAME : OHCI_GET_DEVICE_SPEED_FROM_ED + * DESCRIPTION : Macro to obtain the speed of the device from the control + * information of the OHCI endpoint descriptor. + * PARAMETERS : index IN index of the host controller + * uControlInformation IN Control information for the + * OHCI Endpoint Descriptor. + * RETURN TYPE : None + ******************************************************************************/ +#define OHCI_GET_DEVICE_SPEED_FROM_ED(index, uControlInformation) \ + (((USB_OHCD_SWAP_DATA(index, uControlInformation)) & 0x00002000) >> 13) + + /******************************************************************************* + * MACRO NAME : OHCI_GET_DEVICE_ADDRESS_FROM_ED + * DESCRIPTION : Macro to obtain the USB device address from the control + * information of the OHCI endpoint descriptor. + * PARAMETERS : index IN index of the host controller + * uControlInformation IN Control information for the + * OHCI Endpoint Descriptor. + * RETURN TYPE : None + ******************************************************************************/ +#define OHCI_GET_DEVICE_ADDRESS_FROM_ED(index, uControlInformation) \ + ((USB_OHCD_SWAP_DATA(index, uControlInformation)) & 0x0000007F) + +/******************************************************************************* + * MACRO NAME : OHCI_GET_ENDPOINT_NUMBER_FROM_ED + * DESCRIPTION : Macro to obtain the endpoint number from the control + * information of the OHCI endpoint descriptor. + * PARAMETERS : index IN index of the host controller + * uControlInformation IN Control information for the + * OHCI Endpoint Descriptor. + * RETURN TYPE : None + ******************************************************************************/ +#define OHCI_GET_ENDPOINT_NUMBER_FROM_ED(index, uControlInformation) \ + (((USB_OHCD_SWAP_DATA(index, uControlInformation)) & 0x00000780) >> 7) + +/******************************************************************************* + * MACRO NAME : OHCI_GET_ENDPOINT_DIRECTION_FROM_ED + * DESCRIPTION : Macro to obtain the endpoint direction from the control + * information of the OHCI endpoint descriptor. + * PARAMETERS : index IN index of the host controller + * uControlInformation IN Control information for the + * OHCI Endpoint Descriptor. + * RETURN TYPE : None + ******************************************************************************/ +#define OHCI_GET_ENDPOINT_DIRECTION_FROM_ED(index, uControlInformation) \ + (((USB_OHCD_SWAP_DATA(index, uControlInformation)) & 0x00001800) >> 11) + +/******************************************************************************* + * MACRO NAME : OHCI_GET_ENDPOINT_MAXIMUM_PACKET_SIZE_FROM_ED + * DESCRIPTION : Macro to obtain the endpoint maximum packet size from the + * control information of the OHCI endpoint descriptor. + * PARAMETERS : index IN index of the host controller + * uControlInformation IN Control information for the + * OHCI Endpoint Descriptor. + * RETURN TYPE : None + ******************************************************************************/ +#define OHCI_GET_ENDPOINT_MAXIMUM_PACKET_SIZE_FROM_ED(index,uControlInformation) \ + (((USB_OHCD_SWAP_DATA(index, uControlInformation)) & 0x07FF0000) >> 16) + + +/******************************************************************************* + * MACRO NAME : OHCI_GET_TOGGLE_CARRY_FROM_ED + * DESCRIPTION : Macro to obtain the toggle carry + * information of the OHCI endpoint descriptor. + * PARAMETERS : index IN index of the host controller + * uHeadTD IN TD which forms the head of the TD list + * RETURN TYPE : None + ******************************************************************************/ + +#define OHCI_GET_TOGGLE_CARRY_FROM_ED(index, uHeadTD) \ + ((USB_OHCD_SWAP_DATA(index, (UINT32)uHeadTD) & 0x02) >> 1) + +/******************************************************************************* + * MACRO NAME : OHCI_SET_ENDPOINT_TOGGLE + * DESCRIPTION : Macro to set the toggle field. + * PARAMETERS : index IN index of the host controller + * pEndpointDescriptor IN Pointer to the OHCI ED. + * RETURN TYPE : None + ******************************************************************************/ + +#define OHCI_SET_ENDPOINT_TOGGLE(index, pEndpointDescriptor) \ + pEndpointDescriptor->TDQueueHead.pGeneralTDQueueHead = \ + (PUSB_OHCI_GENERAL_TRANSFER_DESCRIPTOR) \ + ((UINT32)(pEndpointDescriptor->TDQueueHead.pGeneralTDQueueHead) \ + | (USB_OHCD_SWAP_DATA(index, 0x02))) + +/******************************************************************************* + * MACRO NAME : OHCI_RESET_ENDPOINT_TOGGLE + * DESCRIPTION : Macro to reset the toggle field. + * PARAMETERS : index IN index of the host controller + * pEndpointDescriptor IN Pointer to the OHCI ED. + * RETURN TYPE : None + ******************************************************************************/ +#define OHCI_RESET_ENDPOINT_TOGGLE(index, pEndpointDescriptor) \ + pEndpointDescriptor->TDQueueHead.pGeneralTDQueueHead = \ + (PUSB_OHCI_GENERAL_TRANSFER_DESCRIPTOR) \ + ((UINT32)(pEndpointDescriptor->TDQueueHead.pGeneralTDQueueHead) \ + & (USB_OHCD_SWAP_DATA(index, ~0x02))) + +/************ MACROS TO HANDLE THE OHCI GENERAL TRANSFER DESCRIPTOR ***********/ + +#if 0 + +/* + * Redundant macros. If these macros are to be enabled, move the + * #defines corresponding to the transfer descriptor to this file. + */ + +/******************************************************************************* + * MACRO NAME : OHCI_APPEND_GENERAL_TRANSFER_DESCRIPTOR + * DESCRIPTION : Macro to append the general transfer descriptor to a list of + * transfer descriptors. + * PARAMETERS : pCurrentTransferDescriptor IN Pointer to the current + * transfer descriptor. + * pNewTransferDescriptor IN Pointer to the next transfer + * descriptor. + * + * NOTE: Both the parameters are pointers to the transfer + * descriptors to be passed to the host controller. Refer + * the following description for more information. + * + * The OHCI transfer descriptor structure is as follows: + * + * struct _OHCI_GENERAL_TRANSFER_DESCRIPTOR + * { + * POHCI_ENDPOINT_DESCRIPTOR pEndpointDescriptor; + * UINT32 uControlInformation; + * PUCHAR pCurrentBufferPointer; + * + * . + * . + * . + * + * }; + * + * + * Out of these, the field from uControlInformation is + * provided to the hardware. + * + * The parameters passed to this function should be the + * pointer corresponding uControlInformation location + * of the transfer descriptor. + * + * RETURN TYPE : None + ******************************************************************************/ +#define USB_OHCI_APPEND_GENERAL_TRANSFER_DESCRIPTOR \ + (pCurrentTransferDescriptor, pNewTransferDescriptor) \ + { \ + /* To hold the pointer to the actual transfer descriptor */ \ + PUSB_OHCI_GENERAL_TRANSFER_DESCRIPTOR pTempTransferDescriptor;\ + \ + /* Obtain the pointer to the actual transfer descriptor */ \ + pTempTransferDescriptor = \ + (PUSB_OHCI_GENERAL_TRANSFER_DESCRIPTOR) \ + ((UINT32) pCurrentTransferDescriptor - \ + USB_OHCI_GENERAL_TRANSFER_DESCRIPTOR_HEADER); \ + \ + /* Append the transfer descriptor to the end of the list */ \ + pTempTransferDescriptor->pNextTransferDescriptor = \ + pNewTransferDescriptor; \ + } + +/******************************************************************************* + * MACRO NAME : USB_OHCI_GET_GENERAL_TRANSFER_DESCRIPTOR + * DESCRIPTION : Macro to obtained the general transfer descriptor. + * PARAMETERS : pCurrentTransferDescriptor IN Pointer to the current + * transfer descriptor. + * pTempTransferDescriptor OUT Pointer to the general + * transfer descriptor. + * + * NOTE: The first parameter is the pointer to the transfer + * descriptors passed to the host controller. + * + * The second paramter is the pointer to the origial + * transfer descriptor as defined in the + * OHCI_GENERAL_TRANSFER_DESCRIPTOR structure. + * + * Refer the following description for more information. + * + * The OHCI transfer descriptor structure is as follows: + * + * struct _OHCI_GENERAL_TRANSFER_DESCRIPTOR + * { + * POHCI_ENDPOINT_DESCRIPTOR pEndpointDescriptor; + * UINT32 uControlInformation; + * PUCHAR pCurrentBufferPointer; + * + * . + * . + * . + * + * }; + * + * + * Out of these, the field from uControlInformation is + * provided to the hardware. + * + * The first parameter passed to this function should be + * the pointer corresponding uControlInformation location + * of the transfer descriptor. + * + * The second parameter passed to this function will be + * the pointer to the begining of the above structure. + * + * RETURN TYPE : None + ******************************************************************************/ +#define USB_OHCI_GET_GENERAL_TRANSFER_DESCRIPTOR(pCurrentTransferDescriptor, \ + pTempTransferDescriptor) \ + pTempTransferDescriptor = \ + (PUSB_OHCI_GENERAL_TRANSFER_DESCRIPTOR) \ + ((UINT32)pCurrentTransferDescriptor - \ + USB_OHCI_GENERAL_TRANSFER_DESCRIPTOR_HEADER) + +#endif /* #if 0 */ + +/******************************************************************************* + * MACRO NAME : USB_OHCI_SET_TD_BUFFER_ROUND + * DESCRIPTION : Macro to set the buffer rounding field of the transfer + * descriptor. This macro is meaningful only for general + * transfer descriptor. + * PARAMETERS : index IN index of the host controller + * uControlInformation IN Control information for the + * OHCI Transfer Descriptor. + * RETURN TYPE : None + ******************************************************************************/ +#define USB_OHCI_SET_TD_BUFFER_ROUND(index, uControlInformation) \ + { \ + uControlInformation = USB_OHCD_SWAP_DATA(index, uControlInformation); \ + (uControlInformation) |= 0x00040000; \ + uControlInformation = USB_OHCD_SWAP_DATA(index, uControlInformation); \ + } + + +/******************************************************************************* + * MACRO NAME : USB_OHCI_SET_TD_PID_OUT + * DESCRIPTION : Macro to set PID field of the TD to OUT. + * PARAMETERS : index IN index of the host controller + * uControlInformation IN Control information for the OHCI + * Transfer Descriptor. + * RETURN TYPE : None + ******************************************************************************/ +#define USB_OHCI_SET_TD_PID_OUT(index, uControlInformation) \ + { \ + uControlInformation = USB_OHCD_SWAP_DATA(index, uControlInformation); \ + ((uControlInformation) |= 0x00080000); \ + uControlInformation = USB_OHCD_SWAP_DATA(index, uControlInformation); \ + } + + +/******************************************************************************* + * MACRO NAME : USB_OHCI_SET_TD_PID_IN + * DESCRIPTION : Macro to set PID field of the TD to IN. + * PARAMETERS : index IN index of the host controller + * uControlInformation IN Control information for the OHCI + * Transfer Descriptor. + * RETURN TYPE : None + ******************************************************************************/ +#define USB_OHCI_SET_TD_PID_IN(index, uControlInformation) \ + { \ + uControlInformation = USB_OHCD_SWAP_DATA(index, uControlInformation); \ + ((uControlInformation) |= 0x00100000); \ + uControlInformation = USB_OHCD_SWAP_DATA(index, uControlInformation); \ + } + +/******************************************************************************* + * MACRO NAME : USB_OHCI_SET_TD_DATA_TOGGLE + * DESCRIPTION : Macro to set data toggle for the TD. + * PARAMETERS : index IN index of the host controller + * uControlInformation IN Control information for the OHCI + * Transfer Descriptor. + * uDataToggleValue IN Data toggle value to be set. + * RETURN TYPE : None + ******************************************************************************/ + +#define USB_OHCI_SET_TD_DATA_TOGGLE(index, uControlInformation, uDataToggleValue) \ + { \ + uControlInformation = USB_OHCD_SWAP_DATA(index, uControlInformation); \ + ((uControlInformation) |= (0x02000000 | uDataToggleValue)); \ + uControlInformation = USB_OHCD_SWAP_DATA(index, uControlInformation); \ + } + +/******************************************************************************* + * MACRO NAME : USB_OHCI_CLEAR_TD_COMPLETION_INTERRUPT + * DESCRIPTION : Macro to clear the transfer completion interrupt for the + * transfer descriptor. This macro can be used for both + * general transfer descriptor and isochronous transfer + * descriptor. + * PARAMETERS : index IN index of the host controller + * uControlInformation IN Control information for the + * OHCI Transfer Descriptor. + * RETURN TYPE : None + ******************************************************************************/ + +#define USB_OHCI_CLEAR_TD_COMPLETION_INTERRUPT(index, uControlInformation) \ + { \ + uControlInformation = USB_OHCD_SWAP_DATA(index, uControlInformation); \ + ((uControlInformation) |= 0x00E00000); \ + uControlInformation = USB_OHCD_SWAP_DATA(index, uControlInformation); \ + } + +/******************************************************************************* + * MACRO NAME : USB_OHCI_IS_GENERAL_TRANSFER_SUCCESSFUL + * DESCRIPTION : Macro to check whether the general transfer descriptor + * completed successfully. + * PARAMETERS : index IN index of the host controller + * uControlInformation IN Control information for the + * OHCI General Transfer Descriptor. + * RETURN TYPE : None + ******************************************************************************/ +#define USB_OHCI_IS_GENERAL_TRANSFER_SUCCESSFUL(index, uControlInformation) \ + ((0x00000000 == ((USB_OHCD_SWAP_DATA(index, uControlInformation)) \ + & 0xF0000000)) ? TRUE : FALSE) + +/******************************************************************************* + * MACRO NAME : USB_OHCI_IS_ISOCHRONOUS_TRANSFER_SUCCESSFUL + * DESCRIPTION : Macro to check whether the isochronous transfer descriptor + * completed successfully. + * PARAMETERS : index IN index of the host controller + * uControlInformation IN Control information for the + * OHCI Isochronous Transfer + * Descriptor. + * RETURN TYPE : None + ******************************************************************************/ +#define USB_OHCI_IS_ISOCHRONOUS_TRANSFER_SUCCESSFUL(index, uControlInformation)\ + ((0x00000000 == ((USB_OHCD_SWAP_DATA(index, uControlInformation)) \ + & 0xF0000000)) ? TRUE : FALSE) + +/******************************************************************************* + * MACRO NAME : USB_OHCI_GET_TRANSFER_COMPLETION_CODE + * DESCRIPTION : Macro to obtain the completion code for the transfer. + * PARAMETERS : index IN index of the host controller + * uControlInformation IN Control information for the + * OHCI General Transfer Descriptor. + * RETURN TYPE : None + ******************************************************************************/ +#define USB_OHCI_GET_TRANSFER_COMPLETION_CODE(index, uControlInformation) \ + (((USB_OHCD_SWAP_DATA(index, uControlInformation)) & 0xF0000000) >> 28) + +/********************** MACROS FOR BANDWIDTH CALCULATION **********************/ + +/* To hold the maximum polling interval supported by the OHCI host controller */ +#define USB_OHCI_MAXIMUM_POLLING_INTERVAL 32 + +/* To hold the polling interval for isochronous endpoint (fixed to 1 ms) */ +#define USB_OHCI_ISOCHRONOUS_ENDPOINT_POLLING_INTERVAL 1 + +/* + * To hold the host controller and system dependent delay due to gaining access + * to memory or other implementation dependencies. + */ +#define OHCI_HOST_DELAY 0 + +/* To hold the delay an hub takes to enable low speed transactions */ +#define OHCI_HUB_LS_SETUP_DELAY 0 + +/******************************************************************************* + * MACRO NAME : USB_OHCI_COMPUTE_BANDWIDTH_FOR_INTERRUPT_ENDPOINT + * DESCRIPTION : Macro to compute the bandwidth required for an interrupt + * endpoint of the specified maximum packet size. + * + * NOTE: THE FOLLOWING BANDWIDTH FORMULAS ARE DIRECTLY TAKEN + * FROM THE USB 1.1 SPECIFICATION. + * + * PARAMETERS : SPEED IN Speed of the device. + * DIRECTION IN Direction of the endpoint. + * MAXIMUM_PACKET_SIZE IN Maximum packet size of the + * RETURN TYPE : Returns the bandwidth required for the specified interrupt + * endpoint. + ******************************************************************************/ +#define USB_OHCI_COMPUTE_BANDWIDTH_FOR_INTERRUPT_ENDPOINT( \ + SPEED, \ + DIRECTION, \ + MAXIMUM_PACKET_SIZE) \ + (USBHST_FULL_SPEED == (SPEED))? \ + (9107 + \ + (84 * (4 + (MAXIMUM_PACKET_SIZE) * 2)) + \ + OHCI_HOST_DELAY): \ + ((OHCI_IN_ENDPOINT == (DIRECTION))? \ + (64060 + \ + (2 * OHCI_HUB_LS_SETUP_DELAY) + \ + (677 * (4 + (MAXIMUM_PACKET_SIZE) * 2)) + \ + OHCI_HOST_DELAY): \ + (64107 + \ + (2 * OHCI_HUB_LS_SETUP_DELAY) + \ + (667 * (4 + (MAXIMUM_PACKET_SIZE) * 2)) + \ + OHCI_HOST_DELAY)) + +/******************************************************************************* + * MACRO NAME : USB_OHCI_COMPUTE_BANDWIDTH_FOR_ISOCHRONOUS_ENDPOINT + * DESCRIPTION : Macro to compute the bandwidth required for an isochronous + * endpoint of the specified maximum packet size. + * + * NOTE: THE FOLLOWING BANDWIDTH FORMULAS ARE DIRECTLY TAKEN + * FROM THE USB 1.1 SPECIFICATION. + * + * PARAMETERS : SPEED IN Speed of the device. + * DIRECTION IN Direction of the endpoint. + * MAXIMUM_PACKET_SIZE IN Maximum packet size of the + * isochronous endpoint. + * RETURN TYPE : Returns the bandwidth required for the specified isochronous + * endpoint. + ******************************************************************************/ +#define USB_OHCI_COMPUTE_BANDWIDTH_FOR_ISOCHRONOUS_ENDPOINT( \ + SPEED, \ + DIRECTION, \ + MAXIMUM_PACKET_SIZE) \ + (OHCI_IN_ENDPOINT == (DIRECTION))? \ + (7268 + \ + (84 * (4 + (MAXIMUM_PACKET_SIZE) * 2)) + \ + OHCI_HOST_DELAY): \ + (6265 + \ + (84 * (4 + (MAXIMUM_PACKET_SIZE) * 2)) + \ + OHCI_HOST_DELAY) + +/* typedefs */ + +/****************** MODULE SPECIFIC DATA STRUCTURE DECLARATION ****************/ + +/* Structure to hold the list of URB's pending for the endpoint */ + +typedef struct usbOhciUrbList + { + pUSBHST_URB pUrb; + /* To hold the pointer to the URB */ + PVOID pTransferDescriptorListHead; + /* To hold the pointer to head of transfer descriptor */ + /* list corresponding to the transfer */ + PVOID pTransferDescriptorListTail; + /* To hold the pointer to tail of transfer descriptor */ + /* list corresponding to the transfer */ + struct usbOhciUrbList * pNext; + /* To hold the pointer to next element in URB list */ + } USB_OHCI_URB_LIST; + +typedef struct usbOhciUrbList * PUSB_OHCI_URB_LIST; + +/* Structure to hold the Endpoint Descriptor Information */ + +typedef struct usbOhciEndpointDescriptor + { + UINT32 uControlInformation; + /* To hold the control information. Bit fields are not used */ + /* to avoid little endian and big endian problems */ + union /* To hold the pointer to the TD Queue Tail Pointer */ + { + struct usbOhciGeneralTransferDescriptor * + pGeneralTDQueueTail; + /* To hold the pointer to the General Transfer Descriptor */ + struct usbOhciIsochronousTransferDescriptor * + pIsochronousTDQueueTail; + /* To hold the pointer to the Isochronous Transfer Descriptor */ + } TDQueueTail; + union /* To hold the pointer to the TD Queue Head Pointer */ + { + struct usbOhciGeneralTransferDescriptor * + pGeneralTDQueueHead; + /* To hold the pointer to the General Transfer Descriptor */ + struct usbOhciIsochronousTransferDescriptor * + pIsochronousTDQueueHead; + /* To hold the pointer to the Isochronous Transfer Descriptor */ + } TDQueueHead; + struct usbOhciEndpointDescriptor * pNextEndpointDescriptor; + /* To hold the pointer to the next Endpoint Descriptor */ + struct usbOhciEndpointDescriptor * pNonAlignedEndpointDescriptor; + /* To hold the pointer to the non aligned endpoint descriptor.*/ + /* When the memory for the endpoint descriptor should be */ + /* released, the value of this pointer should be used in the */ + /* call to OS_FREE() */ + UINT32 uBandwidthAvailable; + /* To hold the bandwidth available in this list. */ + /* NOTE: The interrupt endpoint list is as follows: */ + /* 1MS_LIST -> 2MS_LIST -> 4MS_LIST -> 8MS_LIST */ + /* -> 16MS_LIST -> 32MS_LIST */ + /* The pointer to 1MS_LIST is stored in the interrupt list */ + /* The bandwidth available for the list corresponds to the */ + /* following: */ + /* Maximum bandwidth available - (Sum of bandwidth */ + /* reserved for the 1ms, 2ms, 4ms, 8ms, 16ms and */ + /* 32ms lists) */ + PUSB_OHCI_URB_LIST pUrbListHead; + /* To hold the pointer to the head of the list of transfers */ + /* pending for this endpoint */ + PUSB_OHCI_URB_LIST pUrbListTail; + /* To hold the pointer to the tail of the list of transfers */ + /* pending for this endpoint */ + PVOID pLastCompletedTransferDescriptor; + /* To hold the pointer to last transfer desriptor completed */ + /* for this endpoint */ + struct usbOhciEndpointDescriptor * pNextEndpointDescriptorToBeDisabled; + /* To hold the pointer to the next endpoint descriptor to be */ + /* disabled. A list of endpoints to be disabled is maintained */ + /* for the following operations: */ + /* a) OHCI_DeletePipe() */ + /* b) OHCI_CancelURB() */ + /* However, the pNextEndpointDescriptor field should not be */ + /* used. This is because, when a transfer is cancelled, the */ + /* SKIP bit is set. This informs the host controller that */ + /* this endpoint should not be processed. The */ + /* pNextEndpointDescriptor will be used to process the next */ + /* endpoint descriptor. */ + /* To summarize, pNextEndpointDescriptor is used by the */ + /* host controller. Whereas, the field */ + /* pNextEndpointDescriptorToBeDisabled will be used by the */ + /* software (host controller driver) */ + OS_EVENT_ID DisableEndpointEvent; + /* To hold the event to be used for removal of the endpoint. */ + /* In order to remove the endpoint, corresponding endpoint */ + /* list should be disabled. After the list disable, the host */ + /* controller driver should wait for an SOF before attempting */ + /* to remove an endpoint descriptor. Similarly, for the */ + /* cancellation of the transfer. This event is used to */ + /* synchronize the above operation. */ + UINT8 uPollingInterval; + /* To hold the polling interval for the endpoint */ + + struct usbOhciEndpointDescriptor * pHCDNextEndpointDescriptor;/* Pointer + * to the + * next ED + */ + + struct usbOhciEndpointDescriptor * pAlignedED; /* Pointer to the aligned + * ED. This is useful + * to retrieve the + * ED from the PCI ptr + */ + + VOID *pHCDTDTail;/* To hold the pointer to the tail of the TD list */ + /* To hold the actual pointer to the ED */ + + OS_EVENT_ID synchEvent; /* To synchronise the request lists + * for the endpoint. + */ + OS_EVENT_ID cancelEvent; /* To signal that the cancellation is + * successful. + */ + } __attribute__((__packed__)) USB_OHCI_ENDPOINT_DESCRIPTOR; + +typedef struct usbOhciEndpointDescriptor * PUSB_OHCI_ENDPOINT_DESCRIPTOR; + +/* Structure to hold the General Transfer Descriptor Information */ + +typedef struct usbOhciGeneralTransferDescriptor + { + PUSB_OHCI_ENDPOINT_DESCRIPTOR pEndpointDescriptor; + /* To hold pointer to the endpoint descriptor. This pointer */ + /* will be used to handle the completion of transfers */ + UINT32 uControlInformation; + /* To hold the control information. Bit fields are not used */ + /* to avoid little endian and big endian problems */ + PUCHAR pCurrentBufferPointer; + /* To hold the current buffer pointer */ + struct usbOhciGeneralTransferDescriptor * + pNextTransferDescriptor; + /* To hold the pointer to the next Transfer Descriptor */ + PUCHAR pEndOfBuffer; + /* To hold the pointer to the end of the buffer */ + struct usbOhciGeneralTransferDescriptor * + pNonAlignedTransferDescriptor; + /* To hold the pointer to the non aligned transfer descriptor */ + /* When the memory for the transfer descriptor should be */ + /* released, the value of this pointer should be used in the */ + /* call to OS_FREE() */ + struct usbOhciGeneralTransferDescriptor * + pHCDNextTransferDescriptor; + /* To hold the pointer to the next Transfer Descriptor. This */ + /* pointer will be used to handle the transfer completion. An */ + /* additional pointer is required because of the following */ + /* reason: */ + /* a) On completion of a transfer, the host controller */ + /* moves the transfer to the done head list. */ + /* b) In the done head list, the transfers list is in */ + /* reverse and has to be modified before processing */ + + + struct usbOhciGeneralTransferDescriptor *pAlignedTD;/* To store the pointer + * to the aligned TD + * which is used for + * retrieving the TD + * actually used by the + * HCD + */ + UINT32 uTDActualLength;/* Actual length of data transferred */ + PUCHAR pStartAddress; /* Copy of the current buffer pointer */ + PUSB_OHCI_URB_LIST pUrbListElement; /* Pointer to the URB list element */ + + } __attribute__((__packed__)) USB_OHCI_GENERAL_TRANSFER_DESCRIPTOR; + +typedef struct usbOhciGeneralTransferDescriptor * + PUSB_OHCI_GENERAL_TRANSFER_DESCRIPTOR; + +/* Structure to hold the Isochronous Transfer Descriptor Information */ + +typedef struct usbOhciIsochronousTransferDescriptor + { + PUSB_OHCI_ENDPOINT_DESCRIPTOR pEndpointDescriptor; + /* To hold pointer to the endpoint descriptor. This pointer */ + /* will be used to handle the completion of transfers */ + UINT32 uControlInformation; + /* To hold the control information. Bit fields are not used */ + /* to avoid little endian and big endian problems */ + PUCHAR pCurrentBufferPointer; + /* To hold the current buffer pointer */ + struct usbOhciIsochronousTransferDescriptor * + pNextTransferDescriptor; + /* To hold the pointer to the next Transfer Descriptor */ + PUCHAR pEndOfBuffer; + /* To hold the pointer to the end of the buffer */ + UINT32 uOffsetAndStatus0And1; + /* To hold the offset and status 0 and 1 */ + UINT32 uOffsetAndStatus2And3; + /* To hold the offset and status 2 and 3 */ + UINT32 uOffsetAndStatus4And5; + /* To hold the offset and status 4 and 5 */ + UINT32 uOffsetAndStatus6And7; + /* To hold the offset and status 6 and 7 */ + struct usbOhciIsochronousTransferDescriptor * + pNonAlignedTransferDescriptor; + /* To hold the pointer to the non aligned transfer */ + /* descriptor. When the memory for the transfer descriptor */ + /* should be released, the value of this pointer should be */ + /* used in the call to OS_FREE() */ + struct usbOhciIsochronousTransferDescriptor * + pHCDNextTransferDescriptor; + /* To hold the pointer to the next Transfer Descriptor. */ + /* This pointer will be used to handle transfer completion. */ + /* An additional pointer is required because of the */ + /* following reason: */ + /* a) On completion of a transfer, the host controller */ + /* moves the transfer to the done head list. */ + /* b) In the done head list, the transfers list is in */ + /* reverse and has to be modified before processing. */ + + struct usbOhciIsochronousTransferDescriptor *pAlignedTD; + /* To store the pointer + * to the aligned TD + * which is used for + * retrieving the TD + * actually used by the + * HCD + */ + PUSB_OHCI_URB_LIST pUrbListElement; /* Pointer to the URB list element */ + + } __attribute__((__packed__)) USB_OHCI_ISOCHRONOUS_TRANSFER_DESCRIPTOR; + +typedef struct usbOhciIsochronousTransferDescriptor * + PUSB_OHCI_ISOCHRONOUS_TRANSFER_DESCRIPTOR; + +/* Structure to hold the Host Controller Communication Area. This structure +* should be packed since this structure will be used by the Host Controller. +*/ + +typedef struct usbOhciHcca + { + UINT32 uHccaInterruptTable[32]; /* To hold the pointer to the */ + /* interrupt list. It consists of 32 pointers to */ + /* the interrupt endpoint descriptors (EDs) */ + UINT16 uHccaFrameNumber; /* To hold the current frame number */ + /* which will be used by the Host Controller */ + UINT16 uHccaPad1; /* To be used by the Host Controller */ + UINT32 uHccaDoneHead; /* To hold the pointer to Done Head */ + UINT32 uReserved[29]; /* Reserved for future use */ + } OS_STRUCT_PACKED USB_OHCI_HCCA; + +typedef struct usbOhciHcca * PUSB_OHCI_HCCA; + +/* Structure to hold the OHCI Controller Information. If there are multiple +* OHCI Controllers on a system, for each such OHCI Controller a variables of +* this structure should be created. +*/ + +typedef struct usbOhciInformation + { + UINT32 uBaseAddress; /* To hold the OHCI Controller base address */ + + PUSB_OHCI_ENDPOINT_DESCRIPTOR pDefaultEndpointDescriptor; + /* To hold the pointer to the default to control endpoint */ + /* descriptor. This pointer remains as long as the host */ + /* controller driver is loaded. For every new device */ + /* connection, this pointer will be used for initial */ + /* communication with the device. This pointer should be */ + /* aligned to 16 bytes boundary. In order to acheive this, */ + /* memory as big as {sizeof (ENDPOINT_DESCRIPTOR) + 16} bytes */ + /* is allocated. The memory is then aligned to 16 bytes */ + /* boundary and then programmed into the OHCI Controller */ + /* registers. */ + PUSB_OHCI_ENDPOINT_DESCRIPTOR pControlEndpointDescriptorListTail; + /* To hold the pointer to tail of list of control endpoints */ + PUSB_OHCI_ENDPOINT_DESCRIPTOR pBulkEndpointDescriptorListTail; + /* To hold the pointer to tail of the list of bulk endpoints */ + PUSB_OHCI_HCCA pHcca; + /* Pointer to the OHCI Host Controller Communication Area. */ + /* This pointer should be aligned to 256 bytes boundary. In */ + /* order to achieve this, memory as big as {sizeof (OHCI_HCCA)*/ + /* + 256} bytes is allocated. The memory is then aligned to */ + /* 256 bytes boundary and then programmed into the OHCI */ + /* Controller registers. */ + PUSB_OHCI_HCCA pHccaAligned; + /* Pointer to the OHCI Host Controller Communication Area. */ + /* This pointer should be aligned to 256 bytes boundary. */ + PUSB_OHCI_ENDPOINT_DESCRIPTOR pDisabledEndpointListHead; + /* To hold the pointer to the head of the list of endpoints */ + /* pending for the following operations: */ + /* a) OHCI_DeletePipe() */ + /* b) OHCI_CancelURB() */ + PUSB_OHCI_ENDPOINT_DESCRIPTOR pDisabledEndpointListTail; + /* To hold the pointer to the tail of the list of endpoints */ + /* pending for the following operations: */ + /* a) OHCI_DeletePipe() */ + /* b) OHCI_CancelURB() */ + + /* Data members to support root hub emulation (BEGIN) */ + + pUSBHST_URB pRootHubInterruptRequest; + /* To hold the URB pending interrupt request (status change */ + /* request) for the root hub. */ + OS_EVENT_ID endpointListAccessEvent; + /* To hold the event to be used for modifying the endpoint */ + /* list. It is logical to have separate events for control, */ + /* bulk, interrupt and isochronous list. This will be lead */ + /* to storing four events. However, this event is needed */ + /* only for adding, modifying or deleting an endpoint */ + /* descriptor. Since these operations occur rarely, only one */ + /* event is used for all the list. This event is used in the */ + /* following cases: */ + /* a) Modify the properties of the default control pipe */ + /* (address 0, endpoint 0). */ + /* b) To add a new pipe to the list of pipes. */ + /* c) To delete a pipe from the list of pipes. */ + /* d) For queuing a pipe marked for deletion. Queuing */ + /* the pipe in the list pointed to by */ + /* pDisabledEndpointListHead. */ + /* e) For queuing a pipe in which transfers are marked */ + /* for cancellation. */ + UINT32 uMaximumBandwidthAvailable; + /* To hold the maximum periodic bandwidth available on this */ + /* OHCI host controller. */ + + OS_THREAD_ID isrThreadId; /* To hold the Thread ID of ISR function */ + +#ifndef USB_OHCI_POLLING_MODE + OS_EVENT_ID isrEvent; /* To hold the ISR event. This event will be */ + /* signalled when an interrupt is pending. */ +#endif /* End of #ifndef USB_OHCI_POLLING_MODE */ + + UINT8 uIrqNumber; /* To hold IRQ number for the OHCI Controller */ + UINT8 uNumberOfDownStreamPorts; + /* To hold the number of downstream ports supported on the */ + /* OHCI Controller */ + UINT8 uRootHubState; /* To hold the USB device state of the root hub */ + UINT8 uRootHubAddress;/* To hold the USB address assigned to root hub */ + UINT8 bCurrentConfigurationValue; /* To hold the current configuration */ + /* value of the root hub */ + BOOLEAN bRemoteWakeupEnabled; /* To hold the flag indicating whether */ + /* the remote wake up feature is */ + /* enabled or not */ + + BOOLEAN bHostControllerInitialized; /* Flag to indicate whether this host */ + /* controller is initialized */ + + /* Data members to support root hub emulation (END) */ + UINT8 padByte0; + } __attribute__((__packed__)) USB_OHCI_INFORMATION; + +typedef struct usbOhciInformation * PUSB_OHCI_INFORMATION; + +/********** DATA STRUCTURES FOR PARSING THE USB STANDARD DESCRIPTORS **********/ + +/* Structure of the USB Generic descriptor */ + +typedef struct usbOhciGenericDescriptor + { + UINT8 bLength; /* To hold the length of the descriptor */ + UINT8 bDescriptorType; /* To hold the type of the descriptor */ + UINT8 bDescriptorData[1]; /* To hold additional fields of descriptor */ + } __attribute__((__packed__)) USB_OHCI_GENERIC_DESCRIPTOR; + +typedef struct usbOhciGenericDescriptor * PUSB_OHCI_GENERIC_DESCRIPTOR; + +/* Structure of the USB configuration descriptor */ + +typedef struct usbOhciConfigurationDescriptor + { + UINT8 bLength; /* To hold the length of configuration descriptor */ + UINT8 bDescriptorType; /* To hold the type of the descriptor */ + UINT16 wTotalLength;/* To hold total length of configuration descriptor */ + UINT8 bNumInterfaces; /* To hold number of interfaces in configuration */ + UINT8 bConfigurationValue;/* To hold configuration value to enable */ + /* this configuration */ + UINT8 iConfiguration; /* To hold the index of the string descriptor */ + /* describing this configuration */ + UINT8 bmAttributes; /* To hold the attributes of this configuration */ + UINT8 MaxPower; /* To hold the maximum power consumption of the */ + /* device in this configuration */ + USB_OHCI_GENERIC_DESCRIPTOR GenericDescriptor[1]; + /* To hold the descriptors following the configuration */ + /* descriptor. Normally, an interface descriptor follows */ + /* the configuration descriptor. However, class specific */ + /* descriptors can also follow the configuration descriptor. */ + } __attribute__((__packed__)) USB_OHCI_CONFIGURATION_DESCRIPTOR; + +typedef struct usbOhciConfigurationDescriptor * + PUSB_OHCI_CONFIGURATION_DESCRIPTOR; + +/* Structure of the USB interface descriptor */ + +typedef struct usbOhciInterfaceDescriptor + { + UINT8 bLength; /* To hold the length of the interface descriptor */ + UINT8 bDescriptorType; /* To hold the type of the descriptor */ + UINT8 bInterfaceNumber; /* To hold the interface number */ + UINT8 bAlternateSetting; /* To hold the alternate setting number */ + UINT8 bNumEndpoints; /* To hold the number of endpoints */ + UINT8 bInterfaceClass; /* To hold the interface class code */ + UINT8 bInterfaceSubClass; /* To hold the interface sub class code */ + UINT8 bInterfaceProtocol; /* To hold the interface protocol code */ + UINT8 iInterface; /* To hold the index of the string */ + /* descriptor describing this interface */ + USB_OHCI_GENERIC_DESCRIPTOR GenericDescriptor[1]; + /* To hold the descriptors following the interface descriptor. */ + /* Normally, an endpoint descriptor follows the interface */ + /* descriptor. However, class specific descriptors can also */ + /* follow the interface descriptor. */ + } __attribute__((packed)) USB_OHCI_INTERFACE_DESCRIPTOR; + +typedef struct usbOhciInterfaceDescriptor * PUSB_OHCI_INTERFACE_DESCRIPTOR; + +/* Structure of the USB endpoint descriptor */ + +typedef struct usbEndpointDescriptor + { + UINT8 bLength; /* To hold the length of the endpoint descriptor */ + UINT8 bDescriptorType; /* To hold the type of the descriptor */ + UINT8 bEndpointAddress; /* To hold the endpoint address (direction */ + /* and endpoint number) */ + UINT8 bmAttributes; /* To hold endpoint attributes (transfer type) */ + UINT16 wMaxPacketSize; /* To hold maximum packet size for the endpoint */ + UINT8 bInterval; /* To hold the polling interface for the endpoint */ + } __attribute__((packed)) USB_ENDPOINT_DESCRIPTOR; + +typedef struct usbEndpointDescriptor * PUSB_ENDPOINT_DESCRIPTOR; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusbOhciTransferManagementh */ + +/* End of File usbOhciTransferManagement.h */ + + + diff --git a/h/usb2/usbOsal.h b/h/usb2/usbOsal.h new file mode 100644 index 0000000..7bb4491 --- /dev/null +++ b/h/usb2/usbOsal.h @@ -0,0 +1,781 @@ +/* usbOsal.h - USB OS Abstraction Layer Definitions */ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +Modification history +-------------------- +01c,26oct04,ami Debug Messages Changes +01d,06oct04,ami SPR #94684 Fix +01c,02jun04,hch remove duplicate definition of TRUE and FALSE macros +01b,09may04,dat add parens around TRUE and FALSE. +01a,17mar03,ssh written +*/ + +/* +DESCRIPTION + +This file contains the definitions of the OS Abstraction Layer for the USB2.0 +Host Stack core code +*/ + +/* +INTERNAL + ******************************************************************************* + * Filename : OSAL.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * + * Description : OS Abstraction layer (OSAL) - for VxWorks 5.4. + * + ******************************************************************************/ + +#ifndef __USBOSAL_H__ +#define __USBOSAL_H__ + +#include +#include /* For error logging */ +#include +#include /* For semaphores */ +#include /* For task */ +#include /* For memset(), memcpy() */ +#include /* For intLock() */ +#include /* For sysClkRateGet(), etc */ +#include /* For printf() and scanf() support */ +#include /* For watch dog timers */ +#include /* For using floor() */ +#include +#include /* os specific services */ +#include +#include + + +#include "usbOsalDebug.h" /* For module level message logging support */ + +/* To define a structure with the packed attribute */ +#define OS_STRUCT_PACKED __attribute__((__packed__)) + + +/* Just in case anyone else has redefined BOOLEAN */ +#ifdef BOOLEAN +#undef BOOLEAN +#endif + +/* To hold a boolean variable */ +typedef UINT8 BOOLEAN; + +/* To hold a pointer to UINT8 */ +typedef UINT8 *PUINT8; + + +/* To hold a pointer to UINT16 */ +typedef UINT16 *PUINT16; + +/* To hold a pointer to UINT32 */ +typedef UINT32 *PUINT32; + +/* To hold a pointer to an UCHAR */ +typedef UCHAR *PUCHAR; + +/* To hold the type definition for void and pointer to void */ +typedef VOID *PVOID; + +extern void usbLogMsg (char *,int,int,int,int,int,int); + +/*************************** MACROS FOR MESSAGE LOGGING ***********************/ + +/******************************************************************************* + * MACRO NAME : _OS_LOG_MESSAGE + * DESCRIPTION : Macro to log the debug messages. + * PARAMETERS : None + * RETURN TYPE : None + ******************************************************************************/ + +#ifdef DEBUG +#define _OS_LOG_MESSAGE(FORMAT, ARG1, ARG2, ARG3, ARG4 ) \ + usbLogMsg ("%s (%d): "FORMAT,(INT32)__FILE__, __LINE__, ARG1, ARG2, ARG3, ARG4) +#else +#define _OS_LOG_MESSAGE(FORMAT, ARG1, ARG2, ARG3, ARG4) +#endif /* End of #ifdef DEBUG */ + +/******************************************************************************* + * MACRO NAME : _OS_LOG_MESSAGE_RAW + * DESCRIPTION : Macro to log the messages. This macro should be used if the + * raw display is required. + * + * NOTE: Avoid using this macro in the code. This macro takes + * only two parameter in addition to the format string. + * + * Also note that this macro cannot be suppressed on + * module basis. + * PARAMETERS : None + * RETURN TYPE : None + ******************************************************************************/ +#ifdef DEBUG +#define _OS_LOG_MESSAGE_RAW(FORMAT, PARAM1, PARAM2) \ + usbLogMsg (FORMAT,PARAM1, PARAM2, 0, 0, 0, 0) +#else +#define _OS_LOG_MESSAGE_RAW(FORMAT, PARAM1, PARAM2) +#endif /* End of #ifdef DEBUG */ + + +/************************* MACROS FOR PRINTF AND SCANF ************************/ + +/******************************************************************************* + * MACRO NAME : OS_PRINTF + * DESCRIPTION : Macro to print a text. + * + * NOTE: Avoid using this macro in the code. This should be + * used only for diagnostics. + * + * PARAMETERS : None + * RETURN TYPE : None + ******************************************************************************/ +#define OS_PRINTF(FORMAT, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \ + printf(FORMAT, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6 ) + +/******************************************************************************* + * MACRO NAME : OS_SCANF + * DESCRIPTION : Macro to obtain inputs from the user. + * + * NOTE: Avoid using this macro in the code. This should be + * used only for diagnostics. + * + * PARAMETERS : None + * RETURN TYPE : None + ******************************************************************************/ +#define OS_SCANF(FORMAT, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \ + scanf(FORMAT, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) + + +/****************************** MACROS FOR ASSERT *****************************/ + +/******************************************************************************* + * MACRO NAME : OS_ASSERT + * DESCRIPTION : Macro for asserting the program execution. This is used to + * identify invalid conditions. + * + * NOTE: This macro will be enabled only for debug mode. + * PARAMETERS : BOOLEAN_EXPRESSION IN Boolean expression. + * RETURN TYPE : None + ******************************************************************************/ +#ifdef DEBUG +#define OS_ASSERT(BOOLEAN_EXPRESSION) \ + assert(BOOLEAN_EXPRESSION) +#else +#define OS_ASSERT(BOOLEAN_EXPRESSION) +#endif /* End of #ifdef DEBUG */ + + +/*********************** MACROS FOR MEMORY OPERATION **************************/ + +/******************************************************************************* + * MACRO NAME : OS_MEMPOOL_INIT + * DESCRIPTION : Initialize memory pool information. + * PARAMETERS : NONE. + * RETURN TYPE : OK + ******************************************************************************/ +#define OS_MEMPOOL_INIT() \ + ossInitialize() + +/******************************************************************************* + * MACRO NAME : OS_MALLOC + * DESCRIPTION : Macro to allocate memory. + * PARAMETERS : MEMORY_SIZE IN Size of memory to be allocated. + * RETURN TYPE : On success, returns the pointer to the memory. Else returns + * NULL. + ******************************************************************************/ +#define OS_MALLOC(MEMORY_SIZE) \ + OSS_MALLOC(MEMORY_SIZE) + +/******************************************************************************* + * MACRO NAME : OS_FREE + * DESCRIPTION : Macro to release the specified memory. + * PARAMETERS : MEMORY_POINTER IN Pointer to the memory to be released. + * RETURN TYPE : None + ******************************************************************************/ +#define OS_FREE(MEMORY_POINTER) \ + OSS_FREE(MEMORY_POINTER) + +/******************************************************************************* + * MACRO NAME : OS_MEMSET + * DESCRIPTION : Macro to initialize the memory with the specified value. + * PARAMETERS : SRC_POINTER IN Pointer to the source memory location. + * VALUE IN Value to be assigned to the memory location. + * LENGTH IN Number of bytes to be copied. + * RETURN TYPE : Returns the number of bytes copied. + ******************************************************************************/ +#define OS_MEMSET(SRC_POINTER, VALUE, LENGTH) \ + memset(SRC_POINTER, VALUE, LENGTH) + +/******************************************************************************* + * MACRO NAME : OS_MEMCPY + * DESCRIPTION : Macro to copy the memory from the source to the destination. + * PARAMETERS : DST_POINTER IN Pointer to the destination memory location. + * SRC_POINTER IN Pointer to the source memory location. + * LENGTH IN Number of bytes to be copied. + * RETURN TYPE : Returns the number of bytes copied. + ******************************************************************************/ +#define OS_MEMCPY(DST_POINTER, SRC_POINTER, LENGTH) \ + memcpy(DST_POINTER, SRC_POINTER, LENGTH) + + +/************************* MACROS FOR STRING OPERATION ************************/ + +/******************************************************************************* + * MACRO NAME : OS_STRLEN + * DESCRIPTION : Macro to obtain the length of a null terminated string. + * PARAMETERS : STRING IN Pointer to the string. + * RETURN TYPE : Returns the length of the string. + ******************************************************************************/ +/* To obtain the length of the string */ +#define OS_STRLEN(STRING) \ + strlen(STRING) + +/******************************************************************************* + * MACRO NAME : OS_STRCPY + * DESCRIPTION : Macro to copy the source string into the destination string. + * PARAMETERS : DST OUT Pointer to the destination string. + * SRC IN Pointer to the source string. + * RETURN TYPE : Returns the length of the string. + ******************************************************************************/ +#define OS_STRCPY(DST, SRC) \ + strcpy(DST, SRC) + + + +/************************* MACROS FOR USING EVENTS ****************************/ + +/* To hold the Event ID */ +#define OS_EVENT_ID SEM_ID + +/* To hold the invalid Event ID */ +#define OS_INVALID_EVENT_ID NULL + +/* To create an event in signaled state */ +#define OS_EVENT_SIGNALED SEM_FULL + +/* To create an event in non signaled state */ +#define OS_EVENT_NON_SIGNALED SEM_EMPTY + +/* To wait infinitely for an event to become available */ +#define OS_WAIT_INFINITE WAIT_FOREVER + +/* To come out immediately without waiting for an event to become available */ +#define OS_NO_WAIT NO_WAIT + +/* Macro to indicate the OS_WAIT_FOR_EVENT returned with a timeout */ +#define OS_WAIT_TIMEOUT ERROR + +/******************************************************************************* + * MACRO NAME : OS_CREATE_EVENT + * DESCRIPTION : Macro to create an event. + * + * The VxWorks Mutual Exclusion Semaphore is created. The + * semBCreate() function allocates memory for the mutual + * exclusion semaphore and initializes the semaphore. + * + * PARAMETERS : INITIAL_EVENT_STATE IN Initial state of the event. + * + * Use OS_EVENT_SIGNALED to create + * an in signaled state. + * + * Use OS_EVENT_NON_SIGNALED to + * create an in non signaled state. + * + * RETURN TYPE : On success, returns the OS_EVENT_ID corresponding to the + * mutual exclustion semaphore. Else returns NULL. + ******************************************************************************/ +#define OS_CREATE_EVENT(INITIAL_EVENT_STATE) \ + semBCreate(SEM_Q_PRIORITY, INITIAL_EVENT_STATE) + +/******************************************************************************* + * MACRO NAME : OS_DESTROY_EVENT + * DESCRIPTION : Macro to destroy an event. + * + * NOTE: The semDelete() call terminates a semaphore and + * deallocates any associated memory. When deleting event, + * first obtain the event by calling OS_WAIT_FOR_EVENT() and + * then delete the event. This ensure that the event is not + * released when some other task is still using the event. + * PARAMETERS : EVENT_ID IN Event ID corresponding to the event to be + * destroyed. + * RETURN TYPE : Returns the OS_EVENT_ID corresponding to the mutual + * exclustion semaphore. + ******************************************************************************/ +#define OS_DESTROY_EVENT(EVENT_ID) \ + semDelete(EVENT_ID) + +/******************************************************************************* + * MACRO NAME : OS_WAIT_FOR_EVENT + * DESCRIPTION : Macro to wait for an event. + * PARAMETERS : EVENT_ID IN Event ID corresponding to the event for + * which to wait. + * WAIT_VALUE IN Amount of time to wait. + * + * To wait infinitely, use the macro + * OS_WAIT_INFINITE. + * + * To come out immediately without waiting, + * use the macro OS_NO_WAIT. + * + * To wait for a specified number of milli + * seconds, use macro + * OS_CONVERT_MILLISECONDS_TO_WAIT_VALUE() + * with the parameter specifing the required + * milli second. + * + * RETURN TYPE : None + ******************************************************************************/ +#define OS_WAIT_FOR_EVENT(EVENT_ID, WAIT_VALUE) \ + semTake(EVENT_ID, WAIT_VALUE) + +/******************************************************************************* + * MACRO NAME : OS_RELEASE_EVENT + * DESCRIPTION : Macro to release an event. + * PARAMETERS : EVENT_ID IN Event ID corresponding to the event to be + * released. + * RETURN TYPE : None + ******************************************************************************/ +#define OS_RELEASE_EVENT(EVENT_ID) \ + semGive(EVENT_ID) + + +/********************* MACROS FOR USING CRITICAL SECTIONS *********************/ + +/* To hold the Critical Section ID */ +#define OS_CRITICAL_SECTION_ID UINT32 + +/******************************************************************************* + * MACRO NAME : OS_ENTER_CRITICAL_SECTION + * DESCRIPTION : Macro to enter a critical section. This macro disables all + * the interrupts on the system. + * + * NOTE: In a real-time system, it is not adviceable to disable + * interrupts for a long time. Hence, the code in the + * critical section should be as small as possible. + * + * PARAMETERS : None + * RETURN TYPE : Returns the critical section ID. This ID should be used + * while leaving the critical section. + ******************************************************************************/ +#ifdef POLLING_MODE +#define OS_ENTER_CRITICAL_SECTION() \ + taskLock() +#else /* Else for #ifdef POLLING_MODE */ +#define OS_ENTER_CRITICAL_SECTION() \ + intLock() +#endif /* End of #ifdef POLLING_MODE */ + +/******************************************************************************* + * MACRO NAME : OS_LEAVE_CRITICAL_SECTION + * DESCRIPTION : Macro to leave a critical section. This macro disables all + * the interrupts on the system. + * + * NOTE: In a real-time system, it is not adviceable to disable + * interrupts for a long time. Hence, the code in the + * critical section should be as small as possible. + * + * PARAMETERS : CRITICAL_SECTION_ID IN Critical section ID returned by + * the call OS_ENTER_CRITICAL_SECTION + * function. + * RETURN TYPE : None + ******************************************************************************/ +#ifdef POLLING_MODE +#define OS_LEAVE_CRITICAL_SECTION(CRITICAL_SECTION_ID) \ + taskUnlock() +#else /* Else for #ifdef POLLING_MODE */ +#define OS_LEAVE_CRITICAL_SECTION(CRITICAL_SECTION_ID) \ + intUnlock(CRITICAL_SECTION_ID) +#endif /* End of #ifdef POLLING_MODE */ + + + +/************************* MACROS FOR USING DELAYS ****************************/ + +/******************************************************************************* + * MACRO NAME : OS_CONVERT_MILLISECONDS_TO_WAIT_VALUE + * DESCRIPTION : Macro to convert the specified duration parameter in milli + * seconds into the number of ticks. + * + * In order to compute the number of ticks corresponding to the + * number of milli seconds specified, the following logic is + * used: + * + * a) Call the sysClkRateGet() function to obtain the number + * number of ticks per second. + * b) Compute the number of ticks for the specified number of + * milli seconds. + * c) If the required millisecond cannot be supported, 1 tick + * of delay will be introduced. + * + * PARAMETERS : DURATION IN Duration in milli seconds. + * RETURN TYPE : Returns the number of ticks. + ******************************************************************************/ +#define OS_CONVERT_MILLISECONDS_TO_WAIT_VALUE(DURATION) \ + (0 == ((sysClkRateGet() * DURATION) / 1000) \ + ?1 \ + :((sysClkRateGet() * DURATION) / 1000)) + +/******************************************************************************* + * MACRO NAME : OS_DELAY_MS + * DESCRIPTION : Macro to introduce a delay in milli seconds. + * + * The taskDelay() function is used to introduce the delay. + * The taskDelay() function takes the delay in number of ticks. + * PARAMETERS : DELAY_INTERVAL IN Specifies the delay interval in milli + * seconds. + * RETURN TYPE : None + ******************************************************************************/ +#define OS_DELAY_MS(DELAY_INTERVAL) \ + taskDelay(OS_CONVERT_MILLISECONDS_TO_WAIT_VALUE(DELAY_INTERVAL)) + + +/************************ MACROS FOR USING THREADS ****************************/ + +/* To hold the thread ID */ +#define OS_THREAD_ID INT32 + +/* To hold the thread options */ +#define OS_THREAD_OPTIONS 0 + +/* To hold the stack size of the thread */ +#define OS_THREAD_STACK_SIZE 4096 << 1 + +/* To hold the value returned when a thread operation fails */ +#define OS_THREAD_FAILURE ERROR + +/* To hold the value returned when a thread operation is successful */ +#define OS_THREAD_SUCCESS OK + + +/******************************************************************************* + * MACRO NAME : OS_CREATE_THREAD + * DESCRIPTION : Macro to create a thread. + * PARAMETERS : NAME IN Name of the task. + * PRIORITY IN Priority of the task. Tasks may have + * priorities ranging from 0 (the highest + * priority), to 255 (the lowest priority). + * ENTRY_POINT IN Entry point for the task. + * ARGS IN Arguments to be passed to the task. + * Only one argument can be passed to the task. + * + * NOTE: Even though VxWorks allows upto 10 parameters to be + * passed to the task, this macro takes only one argument. + * If there are more than one argument, pass them in a + * structure. + * + * RETURN TYPE : On success, returns the OS_THREAD_ID corresponding to the + * thread. Else return OS_THREAD_FAILURE. + ******************************************************************************/ +#define OS_CREATE_THREAD(NAME, PRIORITY, ENTRY_POINT, ARGUMENT) \ + taskSpawn(NAME, \ + PRIORITY, \ + OS_THREAD_OPTIONS, \ + OS_THREAD_STACK_SIZE, \ + (FUNCPTR)ENTRY_POINT, \ + (int)ARGUMENT, \ + 0, \ + 0, \ + 0, \ + 0, \ + 0, \ + 0, \ + 0, \ + 0, \ + 0) + +/******************************************************************************* + * MACRO NAME : OS_DESTROY_THREAD + * DESCRIPTION : Macro to destroy a thread. + * PARAMETERS : THREAD_ID IN Thread ID corresponding to the thread to be + * deleted. + * RETURN TYPE : On success, returns OS_THREAD_SUCCESS. Else returns + * OS_THREAD_FAILURE. + ******************************************************************************/ +#define OS_DESTROY_THREAD(THREAD_ID) \ + taskDelete(THREAD_ID) + +/******************************************************************************* + * MACRO NAME : OS_RESCHEDULE_THREAD + * DESCRIPTION : Macro to manually reschedule the thread. This macro allows + * the other threads in the schedule queue to execute. + * PARAMETERS : None + * RETURN TYPE : None + ******************************************************************************/ +#define OS_RESCHEDULE_THREAD() \ + taskDelay(1) + +/******************************************************************************* + * MACRO NAME : OS_GET_THREAD_PRIORITY + * DESCRIPTION : Macro to obtain the priority of the thread.. + * PARAMETERS : THREAD_PRIORITY OUT Variable to hold the priority of the + * thread. Tasks may have priorities + * ranging from 0 (the highest priority), + * to 255 (the lowest priority). + * ENTRY_POINT IN Entry point for the task. + * RETURN TYPE : None + ******************************************************************************/ +#define OS_GET_THREAD_PRIORITY(THREAD_PRIORITY) \ + taskPriorityGet(taskIdSelf(), (THREAD_PRIORITY)) + + +/****************** MACROS FOR USING DEFERRED PROCEDURE CALLS *****************/ + +/* To hold deferred procedure call (DPC) ID */ +#define OS_DPC_ID WDOG_ID + +/* To hold the status of a DPC operation */ +#define OS_DPC_STATUS STATUS + +/* To hold the value returned when a DPC operation fails */ +#define OS_DPC_FAILURE ERROR + +/* To hold the value returned when a DPC operation is successful */ +#define OS_DPC_SUCCESS OK + + +/******************************************************************************* + * MACRO NAME : OS_CREATE_DPC + * DESCRIPTION : Macro to create a deferred procedure call. + * PARAMETERS : None. + * RETURN TYPE : On success returns OS_DPC_ID. Else returns NULL + ******************************************************************************/ +#define OS_CREATE_DPC() \ + wdCreate() + +/******************************************************************************* + * MACRO NAME : OS_DESTROY_DPC + * DESCRIPTION : Macro to destroy a deferred procedure call. + * PARAMETERS : DPC_ID IN Specifies the DPC ID. + * RETURN TYPE : On success returns OS_DPC_SUCCESS. Else returns + * OS_DPC_FAILURE. + ******************************************************************************/ +#define OS_DESTROY_DPC(DPC_ID) \ + wdDelete(DPC_ID) + +/******************************************************************************* + * MACRO NAME : OS_START_DPC + * DESCRIPTION : Macro to start a deferred procedure call. + * PARAMETERS : DPC_ID IN Specifies the DPC ID. + * DELAY IN Delay count, in ticks. + * DPC_FUNCTION IN Routine to call on time out. + * DPC_PARAMETER IN Parameter to be passed to the DPC + * routine. + * RETURN TYPE : On success returns OS_DPC_SUCCESS. Else returns + * OS_DPC_FAILURE. + ******************************************************************************/ +#define OS_START_DPC(DPC_ID, DELAY, DPC_FUNCTION, DPC_PARAMETER) \ + wdStart(DPC_ID, DELAY, (FUNCPTR)DPC_FUNCTION, DPC_PARAMETER) + +/******************************************************************************* + * MACRO NAME : OS_CANCEL_DPC + * DESCRIPTION : Macro to cancel a deferred procedure call. + * PARAMETERS : DPC_ID IN Specifies the DPC ID. + * RETURN TYPE : On success returns OS_DPC_SUCCESS. Else returns + * OS_DPC_FAILURE. + ******************************************************************************/ +#define OS_CANCEL_DPC(DPC_ID) \ + wdCancel(DPC_ID) + + +/****************** MACROS FOR LOCKED INCREMENT OR DECREMENT ******************/ + +/******************************************************************************* + * MACRO NAME : OS_LOCKED_DECREMENT + * DESCRIPTION : Macro to decrement a variable safely. + * + * NOTE: This macro should be used only when the race condition + * with the ISR. + * + * PARAMETERS : VARIABLE IN Variable to be decremented. + * RETURN TYPE : None + ******************************************************************************/ +#define OS_LOCKED_DECREMENT(VARIABLE) \ + { \ + /* To hold the critical section ID */ \ + OS_CRITICAL_SECTION_ID CriticalSectionID; \ + \ + /* Enter the critical section */ \ + CriticalSectionID = OS_ENTER_CRITICAL_SECTION(); \ + \ + /* Decrement the variable */ \ + (VARIABLE)--; \ + \ + /* Leave the critical section */ \ + OS_LEAVE_CRITICAL_SECTION(CriticalSectionID); \ + } + +/******************************************************************************* + * MACRO NAME : OS_LOCKED_INCREMENT + * DESCRIPTION : Macro to increment a variable safely. + * + * NOTE: This macro should be used only when the race condition + * with the ISR. + * + * PARAMETERS : VARIABLE IN Variable to be incremented. + * RETURN TYPE : None + ******************************************************************************/ +#define OS_LOCKED_INCREMENT(VARIABLE) \ + { \ + /* To hold the critical section ID */ \ + OS_CRITICAL_SECTION_ID CriticalSectionID; \ + \ + /* Enter the critical section */ \ + CriticalSectionID = OS_ENTER_CRITICAL_SECTION(); \ + \ + /* Increment the variable */ \ + (VARIABLE)++; \ + \ + /* Leave the critical section */ \ + OS_LEAVE_CRITICAL_SECTION(CriticalSectionID); \ + } + + +/********************** MACROS FOR HANDLING ENDIANESS *************************/ + +#if (_BYTE_ORDER == _BIG_ENDIAN) + +/******************************************************************************* + * MACRO NAME : OS_UINT32_CPU_TO_LE + * DESCRIPTION : Macro to convert an 32 bit integer from CPU format to the + * little endian format. + * PARAMETERS : DATA IN Data to be converted. + * RETURN TYPE : None + ******************************************************************************/ + +#define OS_UINT32_CPU_TO_LE(DATA) \ + (((DATA & 0xFF) << 24) | \ + (((DATA >> 8) & 0xFF) << 16) | \ + (((DATA >> 16) & 0xFF) << 8) | \ + ((DATA >> 24) & 0xFF)) + +/******************************************************************************* + * MACRO NAME : OS_UINT32_LE_TO_CPU + * DESCRIPTION : Macro to convert an 32 bit integer from little endian format + * to the CPU format. + * PARAMETERS : DATA IN Data to be converted. + * RETURN TYPE : None + ******************************************************************************/ +#define OS_UINT32_LE_TO_CPU(DATA) \ + (((DATA & 0xFF) << 24) | \ + (((DATA >> 8) & 0xFF) << 16) | \ + (((DATA >> 16) & 0xFF) << 8) | \ + ((DATA >> 24) & 0xFF)) + +/******************************************************************************* + * MACRO NAME : OS_UINT16_LE_TO_CPU + * DESCRIPTION : Macro to convert an 16 bit integer from little endian format + * to the CPU format. + * PARAMETERS : DATA IN Data to be converted. + * RETURN TYPE : None + ******************************************************************************/ +#define OS_UINT16_LE_TO_CPU(DATA) \ + ((((DATA >> 8) & 0xFF) | ((DATA & 0xFF) << 8))) + +/******************************************************************************* + * MACRO NAME : OS_UINT16_CPU_TO_LE + * DESCRIPTION : Macro to convert an 16 bit integer from CPU format to the + * little endian format. + * PARAMETERS : DATA IN Data to be converted. + * RETURN TYPE : None + ******************************************************************************/ +#define OS_UINT16_CPU_TO_LE(DATA) \ + ((((DATA >> 8) & 0xFF) | ((DATA & 0xFF) << 8))) + +#define OS_BUFFER_CPU_TO_LE(BUFFER, LENGTH) + +#define OS_BUFFER_LE_TO_CPU(BUFFER, LENGTH) + +#else + +/* + * Macros for handling the endianess on little endian + * systems + */ + +/******************************************************************************* + * MACRO NAME : OS_BUFFER_LE_TO_CPU + * DESCRIPTION : Macro to convert a buffer from little endian format to the + * CPU format. + * PARAMETERS : BUFFER IN Pointer to the buffer location. + * LENGTH IN Number of bytes to be converted. + * RETURN TYPE : None + ******************************************************************************/ +#define OS_BUFFER_LE_TO_CPU(BUFFER, LENGTH) + +/******************************************************************************* + * MACRO NAME : OS_BUFFER_CPU_TO_LE + * DESCRIPTION : Macro to convert a buffer from CPU format to the little + * endian format . + * PARAMETERS : BUFFER IN Pointer to the buffer location. + * LENGTH IN Number of bytes to be converted. + * RETURN TYPE : None + ******************************************************************************/ +#define OS_BUFFER_CPU_TO_LE(BUFFER, LENGTH) + +/******************************************************************************* + * MACRO NAME : OS_UINT16_LE_TO_CPU + * DESCRIPTION : Macro to convert an 16 bit integer from little endian format + * to the CPU format. + * PARAMETERS : DATA IN Data to be converted. + * RETURN TYPE : None + ******************************************************************************/ +#define OS_UINT16_LE_TO_CPU(DATA) \ + DATA + +/******************************************************************************* + * MACRO NAME : OS_UINT16_CPU_TO_LE + * DESCRIPTION : Macro to convert an 16 bit integer from CPU format to the + * little endian format. + * PARAMETERS : DATA IN Data to be converted. + * RETURN TYPE : None + ******************************************************************************/ +#define OS_UINT16_CPU_TO_LE(DATA) \ + DATA + +/******************************************************************************* + * MACRO NAME : OS_UINT32_LE_TO_CPU + * DESCRIPTION : Macro to convert an 32 bit integer from little endian format + * to the CPU format. + * PARAMETERS : DATA IN Data to be converted. + * RETURN TYPE : None + ******************************************************************************/ +#define OS_UINT32_LE_TO_CPU(DATA) \ + DATA + +/******************************************************************************* + * MACRO NAME : OS_UINT32_CPU_TO_LE + * DESCRIPTION : Macro to convert an 32 bit integer from CPU format to the + * little endian format. + * PARAMETERS : DATA IN Data to be converted. + * RETURN TYPE : None + ******************************************************************************/ +#define OS_UINT32_CPU_TO_LE(DATA) \ + DATA + + +#endif /* End of #if (_BYTE_ORDER != _BIG_ENDIAN) */ + +#endif /* End of __OSAL_H__ */ + +/****************************** End of File OSAL.h ****************************/ + diff --git a/h/usb2/usbOsalDebug.h b/h/usb2/usbOsalDebug.h new file mode 100644 index 0000000..54d914d --- /dev/null +++ b/h/usb2/usbOsalDebug.h @@ -0,0 +1,190 @@ +/* usbOsalDebug.h - USB OS Abstraction Layer Debug Definitions */ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +Modification history +-------------------- +01a,17mar03,ssh written +*/ + +/* +DESCRIPTION + +This file contains the definitions the debugging macros for the OS Abstraction +Layer +*/ + +/* +INTERNAL + ******************************************************************************* + * Filename : OSAL_DEBUG.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : OS Abstraction layer debugging support. This file contains + * the macros to enable or disable the debugging support on + * a module basis. + * + * + ******************************************************************************/ + +#ifndef __USBOSALDEBUG_H__ +#define __USBOSALDEBUG_H__ + + +/*************************** MACROS FOR MESSAGE LOGGING ***********************/ + +/* + * NOTE: + * + * 1. The file name and the line number will be printed by default. + * 2. Maximum 4 parameters can be passed to the log message macros. More than + * 4 parameters will result in error. + */ + +/* Macros to hold the debug log severity */ +#define DEBUG_OFF 0x00 /* Debug None */ +#define DEBUG_HIGH 0x01 /* Debug High */ +#define DEBUG_MEDIUM 0x02 /* Debug Medium */ +#define DEBUG_LOW 0x03 /* Debug Low */ +#define DEBUG_LVL_MASK 0xff + +#define USBD 0x01 /* Debug USBD component */ +#define HUB 0x02 /* Debug HUB component */ +#define EHCD 0x04 /* Debug EHCD component */ +#define OHCD 0x08 /* Debug OHCD component */ +#define UHCD 0x10 /* Debug UHCD component */ + +/* Note: To enable HIGH level debugging of the USBD component, then the debug + * flag usbdOsalDbg should be set to value 0x00000101. If Low level + * debugging of the UHCD component is enabled, then the usbdOsalDbg + * flag should be set to 0x00001003 + */ + +/* + * The following debug macros are enabled for debug build. For release build + * the debug logs should be saved in to a file. This is currently not supported. + */ +#ifdef DEBUG + + +extern UINT32 usbdOsalDbg; /* Define the debugging flag */ + +/******************************************************************************* + * MACRO NAME : OS_LOG_FLAG_INIT + * DESCRIPTION : Macro to initialize the logging flag for debug messaging. This + * macro is intended to only be called once when the USBD + * interface has been enabled. + * PARAMETERS : INIT_VALUE Initial value of debug log severity + * RETURN TYPE : None + ******************************************************************************/ +#define OS_LOG_FLAG_INIT(INIT_VALUE) \ + UINT32 usbdOsalDbg = INIT_VALUE; + +/******************************************************************************* + * MACRO NAME : OS_LOG_MESSAGE_HIGH + * DESCRIPTION : Macro to log the messages of high severity. This macro will + * be enable only if the current debug severity is greater than + * or equal to DEBUG_HIGH. + * PARAMETERS : None + * RETURN TYPE : None + ******************************************************************************/ +#define OS_LOG_MESSAGE_HIGH(MODULE_NAME, FORMAT, ARG1,ARG2,ARG3,ARG4) \ + { \ + if ( ((usbdOsalDbg & DEBUG_LVL_MASK) >= DEBUG_HIGH) && \ + (((usbdOsalDbg >> 8) & MODULE_NAME) == MODULE_NAME) ) \ + { \ + _OS_LOG_MESSAGE(FORMAT, ARG1,ARG2,ARG3,ARG4); \ + } \ + } + +/******************************************************************************* + * MACRO NAME : OS_LOG_MESSAGE_MEDIUM + * DESCRIPTION : Macro to log the messages of medimm severity. This macro will + * be enable only if the current debug severity is greater than + * or equal to DEBUG_MEDIUM. + * PARAMETERS : None + * RETURN TYPE : None + ******************************************************************************/ +#define OS_LOG_MESSAGE_MEDIUM(MODULE_NAME, FORMAT, ARG1,ARG2,ARG3,ARG4) \ + { \ + if ( ((usbdOsalDbg & DEBUG_LVL_MASK) >= DEBUG_MEDIUM) && \ + (((usbdOsalDbg >> 8) & MODULE_NAME) == MODULE_NAME) ) \ + { \ + _OS_LOG_MESSAGE(FORMAT, ARG1,ARG2,ARG3,ARG4); \ + } \ + } + +/******************************************************************************* + * MACRO NAME : OS_LOG_MESSAGE_LOW + * DESCRIPTION : Macro to log the messages of low severity. This macro will + * be enable only if the current debug severity is greater than + * or equal to DEBUG_LOW. + * PARAMETERS : None + * RETURN TYPE : None + ******************************************************************************/ +#define OS_LOG_MESSAGE_LOW(MODULE_NAME, FORMAT, ARG1,ARG2,ARG3,ARG4) \ + { \ + if ( ((usbdOsalDbg & DEBUG_LVL_MASK) >= DEBUG_LOW) && \ + (((usbdOsalDbg >> 8) & MODULE_NAME) == MODULE_NAME) ) \ + { \ + _OS_LOG_MESSAGE(FORMAT, ARG1,ARG2,ARG3,ARG4); \ + } \ + } + +/******************************************************************************* + * MACRO NAME : OS_LOG_MESSAGE + * DESCRIPTION : Macro to log the messages. This macro should be used if the + * raw display is required. + * + * NOTE: Avoid using this macro in the code. This macro takes + * only two parameter in addition to the format string. + * + * Also note that this macro cannot be suppressed on + * module basis. + * PARAMETERS : None + * RETURN TYPE : None + ******************************************************************************/ +#define OS_LOG_MESSAGE(MODULE_NAME, FORMAT, PARAM1, PARAM2) \ + { \ + if (((usbdOsalDbg >> 8) & MODULE_NAME) == MODULE_NAME) \ + { \ + _OS_LOG_MESSAGE_RAW(FORMAT, PARAM1, PARAM2); \ + } \ + } + +#else /* Else of #ifdef DEBUG */ + +/* Message logging is not enable in release mode */ +#define OS_LOG_FLAG_INIT(INIT_VALUE) +#define OS_LOG_MESSAGE_HIGH(MODULE_NAME, FORMAT, ARG1,ARG2,ARG3,ARG4) +#define OS_LOG_MESSAGE_MEDIUM(MODULE_NAME, FORMAT, ARG1,ARG2,ARG3,ARG4) +#define OS_LOG_MESSAGE_LOW(MODULE_NAME, FORMAT, ARG1,ARG2,ARG3,ARG4) +#define OS_LOG_MESSAGE(MODULE_NAME, FORMAT, PARAM1, PARAM2) + +#endif /* End of #ifdef DEBUG */ + + + +#endif /* End of __OSAL_DEBUG_H__ */ + +/*************************** End of File OSAL_Debug.h *************************/ + diff --git a/h/usb2/usbUhcdCommon.h b/h/usb2/usbUhcdCommon.h new file mode 100644 index 0000000..676eb8e --- /dev/null +++ b/h/usb2/usbUhcdCommon.h @@ -0,0 +1,82 @@ +/* usbUhcdCommon.h - header file for common USB UHCD HCD registers*/ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +Modification history +-------------------- +01b,26jun03,mat changing the code to WRS standards. +01a,25apr03,ram written. +*/ + +/* +DESCRIPTION + +This file contains the macros which are common for all the the +USB UHCD HCD functional modules. +*/ + + +/* +INTERNAL + ******************************************************************************* + * Filename : usbUhcdCommon.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : This file contains the macros which are common all the + * the UHCD HCD functional modules. + * + * + */ + +#ifndef __INCusbUhcdCommonh +#define __INCusbUhcdCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "usbOsal.h" + +/* defines */ + +#define USB_UHCD_USBCMD 0x00 /* Offset of the USBCMD register */ +#define USB_UHCD_USBSTS 0x02 /* Offset of the USBSTS register */ +#define USB_UHCD_USBINTR 0x04 /* Offset of the USBINTR register */ +#define USB_UHCD_FRNUM 0x06 /* Offset of the FRNUM register */ +#define USB_UHCD_FLBASEADD 0x08 /* Offset of the FLBASEADD register */ +#define USB_UHCD_SOF_MODIFY 0x0C /* Offset of the SOF_MODIFY register*/ +#define USB_UHCD_PORT1 0x10 /* Offset of the PORT1 register */ +#define USB_UHCD_PORT2 0x12 /* Offset of the PORT2 register */ + +/* To hold the loop iteration number used for settling time of the HC reset */ + +#define USB_UHCD_NUM_OF_RETRIES 1000000 + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCusbUhcdCommonh */ + + diff --git a/h/usb2/usbUhcdRhEmulate.h b/h/usb2/usbUhcdRhEmulate.h new file mode 100644 index 0000000..75973b7 --- /dev/null +++ b/h/usb2/usbUhcdRhEmulate.h @@ -0,0 +1,258 @@ +/* usbUhcdRhEmulate.h - header for USB UHCD HCD Roothub Emulation */ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +Modification history +-------------------- +01b,26jun03,mat changing the code to WRS standards. +01a,25apr03,ram written. +*/ + +/* +DESCRIPTION + +This file contains the data structures used by the Roothub Emulation module +*/ +/* +INTERNAL + ******************************************************************************* + * Filename : usbUhcdRhEmulate.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : This file contains the data structures used by the + * Roothub Emulation module + * + * + */ + +#ifndef __INCusbUhcdRhEmulateh +#define __INCusbUhcdRhEmulateh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "usbOsal.h" + +/* defines */ + +/* Configuration value of the root hub device */ + +#define USB_UHCD_CONFIG_VALUE 1 + +/* Definition of success */ + +#define USB_UHCD_DEF_SUCCESSDEF_SUCCESS 0 + +/* Value of the device descriptor */ + +#define USB_UHCD_DESCRIPTOR 1 + +/* Value of the configuration descriptor */ + +#define USB_UHCD_CONFIGURATION_DESCRIPTOR 2 + +/* Feature Selector values used for the Root hub - Start */ + +/* PORT_ENABLE feature value */ + +#define USB_UHCD_PORT_ENABLE 1 + +/* PORT_SUSPEND feature value */ + +#define USB_UHCD_PORT_SUSPEND 2 + +/* PORT_RESET feature value */ + +#define USB_UHCD_PORT_RESET 4 + +/* PORT_POWER feature value */ + +#define USB_UHCD_PORT_POWER 8 + +/* PORT_LOW_SPEED feature value */ +#define USB_UHCD_PORT_LOW_SPEED 9 + +/* C_PORT_CONNECTION feature value */ + +#define USB_UHCD_C_PORT_CONNECTION 16 + +/* C_PORT_ENABLE feature value */ + +#define USB_UHCD_C_PORT_ENABLE 17 + +/* C_PORT_SUSPEND feature value */ + +#define USB_UHCD_C_PORT_SUSPEND 18 + +/* C_PORT_OVERCURRENT feature value */ + +#define USB_UHCD_C_PORT_OVERCURRENT 19 + +/* C_PORT_RESET feature value */ + +#define USB_UHCD_C_PORT_RESET 20 + +/* C_PORT_TEST feature value */ + +#define USB_UHCD_PORT_TEST 21 + +/* C_PORT_INDICATOR feature value */ + +#define USB_UHCD_PORT_INDICATOR 22 + +/* Feature Selector values used for the Root hub - End */ + +/* Value indicating a pass condition */ + +#define USB_UHCD_PASS 1 + +/* Value indicating a failure condition */ + +#define USB_UHCD_FAIL 0 + +#define USB_UHCD_PORT_1 1 +#define USB_UHCD_PORT_2 2 + +#define USB_UHCD_BYTE_TX_DATA_STAGE 4 + +#ifdef INCLUDED_FROM_RH_EMULATE + +/* Bus signal line logical level */ +#define USB_UHCD_D_NEGATIVE_SIGNAL 0x00 +#define USB_UHCD_D_POSITIVE_SIGNAL 0x01 + +/* Device Descriptor value for the Root hub */ + +UCHAR usbUhcdGdDeviceDescriptor[] = + { + 0x12, /* bLength */ + 0x01, /* Device Descriptor type */ + 0x10, + 0x01, /* bcdUSB - USB 1.1 */ + 0x09, /* Hub DeviceClass */ + 0x00, /* bDeviceSubClass */ + 0x00, /* bDeviceProtocol */ + 0x08, /* Max packet size is 8 */ + 0x00, + 0x00, /* idVendor */ + 0x00, + 0x00, /* idProduct */ + 0x00, + 0x00, /* bcdDevice */ + 0x00, /* iManufacturer */ + 0x00, /* iProduct */ + 0x00, /* iSerialNumber */ + 0x01 /* 1 configuration */ + }; + +/* + * Descriptor structure returned on a request for + * Configuration descriptor for the Root hub. + * This includes the Configuration descriptor, interface descriptor and + * the endpoint descriptor + */ + +UCHAR usbUhcdGdConfigDescriptor[] = + { + + /* Configuration descriptor */ + + 0x09, /* bLength */ + 0x02, /* + * Configuration descriptor + * type + */ + 0x19, 0x00, /* wTotalLength */ + 0x01, /* 1 interface */ + USB_UHCD_CONFIG_VALUE, /* bConfigurationValue */ + 0x00, /* iConfiguration */ + 0xE0, /* bmAttributes */ + 0x00, /* bMaxPower */ + + /* Interface Descriptor */ + + 0x09, /* bLength */ + 0x04, /* + * Interface Descriptor + * type + */ + 0x00, /* bInterfaceNumber */ + 0x00, /* bAlternateSetting */ + 0x01, /* bNumEndpoints */ + 0x09, /* bInterfaceClass */ + 0x00, /* bInterfaceSubClass */ + 0x00, /* bInterfaceProtocol */ + 0x00, /* iInterface */ + + /* Endpoint Descriptor */ + + 0x07, /* bLength */ + 0x05, /* + * Endpoint Descriptor + * Type + */ + 0x81, /* bEndpointAddress */ + 0x03, /* bmAttributes */ + 0x08, + 0x00, /* wMaxPacketSize */ + 0x01 /* bInterval - 1 ms */ + }; + +/* This stucture is added to be send as argument for OS_CREATE_TASK */ +typedef struct HCDDataURB +{ + /* pointer to the particular Host controller stucture */ + PUHCD_DATA pHCDData; + + /* pointer to the URB */ + USBHST_URB *purb; + +}HCD_DATA_URB, *PHCD_DATA_URB; + +#endif /* End of INCLUDED_FROM_RH_EMULATE */ + +/******************************************************************************* + * Function Name : usbUhcdCancelRhRequest + * Description : This function is used to cancel a request submitted for + * an endpoint. + * Parameters : uPipeHandle IN Handle to the pipe. + * pUrb IN Pointer to the URB which needs to + * be cancelled. + * Return Type : USBHST_SUCCESS - Returned if the URB is cancelled + * successfully. + * USBHST_INVALID_PARAMETER - Returned if the parameters are + * not valid. + ******************************************************************************/ +extern USBHST_STATUS usbUhcdCancelRhRequest(PUHCD_DATA pHCDData, + USBHST_URB *pUrb , + UINT32 uPipeHandle); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCusbUhcdRhEmulateh */ + + diff --git a/h/usb2/usbUhcdScheduleQSupport.h b/h/usb2/usbUhcdScheduleQSupport.h new file mode 100644 index 0000000..242e4fc --- /dev/null +++ b/h/usb2/usbUhcdScheduleQSupport.h @@ -0,0 +1,586 @@ +/* usbUhcdScheduleQSupport.h - scheduling and queueing support for USB UHCD HCD*/ + +/* Copyright 2004-2005 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +Modification history +-------------------- +01d,28mar05,pdg non-PCI changes +01c,05oct04,mta SPR100704- Removal of floating point math +01c,05oct04,mta SPR100704- Removal of floating point math +01b,26jun03,mat changing the code to WRS standards. +01a,25apr03,ram written. +*/ + +/* +DESCRIPTION + +This file contains the macros and prototypes of functions used as +supporting functions for the scheduling and queuing operations. +*/ + +/* +INTERNAL + ******************************************************************************* + * Filename : usbUhcdScheduleQSupport.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : This file contains the macros and prototypes of + * functions used as supporting functions for the + * scheduling and queuing operations. + * + * + */ + +#ifndef __INCusbUhcdSceduleQSupporth +#define __INCusbUhcdSceduleQSupporth + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "usbOsal.h" + +/* defines */ + +/* mask for endpoint type */ + +#define USB_UHCD_ATTR_EPTYPE_MASK 0x03 +#define USB_UHCD_ATTR_CONTROL 0x00 +#define USB_UHCD_ATTR_ISOCHRO 0x01 +#define USB_UHCD_ATTR_BULK 0x02 +#define USB_UHCD_ATTR_INTERRUPT 0x03 + +/* Values for checking the interrupt mask value */ +#define USB_UHCD_IOSP_ENABLE 0x08 +#define USB_UHCD_IOC_ENABLE 0x04 +#define USB_UHCD_IORESUME_ENABLE 0x02 +#define USB_UHCD_IOCRC_ENABLE 0x01 + +#define USB_UHCD_IOSP_ENABLE_BIT 0x03 +#define USB_UHCD_IOC_ENABLE_BIT 0x02 +#define USB_UHCD_IORESUME_ENABLE_BIT 0x01 +#define USB_UHCD_IOCRC_ENABLE_BIT 0x00 +/* + * Value set by the software before the TD is being placed on the list to be + * processed by the HC + */ +#define USB_UHCD_NOT_ACCESSED 15 + +/* UHCD HCD specific status - Start */ + +#define USB_UHCD_BABBLE 91 /* Babble error */ + +#define USB_UHCD_NAK 92 /* The transfer has NAK */ + +#define USB_UHCD_TIMEOUT 93 /* Timeout error */ + +#define USB_UHCD_BITSTUFF 94 /* Bitstuff error */ + +/* UHCD HCD specific status - End */ + +#define USB_UHCD_SAFETY_MARGIN 100 /* Safety margin value */ + +#define USB_UHCD_NINETY_PERCENT_BW 900000 /* Value indicating 90 */ + /* % of the bandwidth */ + +#define USB_UHCD_BW 1000000 /* Value indicating 100 % */ + /* of the bandwidth */ + +#define USB_UHCD_HOST_DELAY 1000 /* Delay value used for */ + /* calculating the bus time */ + +/* Margin value for adding to the periodic frame list */ + +#define USB_UHCD_PERIODIC_LIST_MODIFICATION_MARGIN 4 + +/* The Window size allowed for adding an set of Isoc TDs */ +#define USB_UHCD_PERIODIC_LIST_WINDOW_SIZE 1024 + +/* Constants used in bandwidth calculation */ +#define usbUhcdBitStuffTime(data) (7 * 8 * data/6) /* Bit stuff time */ + + +/* PENDING : This might vary for USB 2.0 */ + +#define USB_UHCD_HOST_DELAY 1000 /* The values are in nanoseconds */ +#define USB_UHCD_HUB_LS_SETUP 333 + +/* typedefs */ + +/* Data transfer directions */ + +typedef enum usbUhcdDirection + { + BIDIRECTIONAL = 0, /* No data transfer, applicable in case of + * control */ + DIR_OUT, /* Data transfer is from host to device */ + DIR_IN /* Data transfer is from device to host */ + } USB_UHCD_DIRECTION; + +/* Device speeds */ + +typedef enum usbUhcdSpeed + { + FULL_SPEED, /* Full speed */ + LOW_SPEED, /* Low speed */ + USB20_HIGH_SPEED /* High speed */ + } USB_UHCD_SPEED; + +/* Pipe types */ + +typedef enum usbUhcdPipeType + { + PIPE_CONTROL, + PIPE_ISOCHRONOUS, + PIPE_BULK, + PIPE_INTERRUPT + } USB_UHCD_PIPETYPE; + + +/******************************************************************************* + * Function Name : usbUhcdFormEmptyTd + * Description : This function forms an empty Transfer Descriptor + * Parameters : pipe IN Pointer to the Pipe data structure + * Return Type : Pointer to struct uhc_td if TD is created successfully. + * Else NULL. + ******************************************************************************/ + +extern USB_UHCD_TD *usbUhcdFormEmptyTd (UINT32 uPipeHandle ); + +/******************************************************************************* + * Function Name : usbUhcdFormEmptyQh + * Description : This function forms an empty Queue Head. + * Parameters : None. + * Return Type : Pointer to struct uhc_qh if QH is created successfully. + * Else NULL + ******************************************************************************/ + +extern USB_UHCD_QH *usbUhcdFormEmptyQh (void); + +/******************************************************************************* + * Function Name : usbUhcdFindLinkForQh + * Description : This function is used to find the index of the next node + * in the list. + * Parameters : n IN Index of the node element in the tree + * Return Type : INT32. + * Returns the index of the next node in the list. + ******************************************************************************/ + +extern INT32 usbUhcdFindLinkForQh (INT32 n); + +/******************************************************************************* + * Function Name : usbUhcdFindQlinkToTree + * Description : This function is used to determine the Index into the + * periodic tree which, the Nth entry of the + * frame list must point to. We have a 1024 entries in the + * frame list and a 128 leafed tree. Thus every 128th + * entry of the frame list points to the same point of the + * periodic tree + * Parameters : None. + * Return Type : INT32. + * Returns the index into the periodic tree which the + * n th entry of the periodic tree will point to. + ******************************************************************************/ + +extern INT32 usbUhcdFindQlinkToTree (INT32 n); + +/******************************************************************************* + * Function Name : usbUhcdFindHcdPipe + * Description : This functions is used to locate an HCD pipe structure + * Parameters : pipe IN Pointer to the Pipe data structure. + * Return Type : Pointer to struct USB_UHCD_HCD_PIPE if the pipe is located. + * NULL otherwise + ******************************************************************************/ + +extern USB_UHCD_HCD_PIPE *usbUhcdFindHcdPipe + (UINT8 BusIndex, UINT8 deviceNum, UINT8 endPointNum, UINT8 direction, UINT8 type); + + +/******************************************************************************* + * Function Name : usbUhcdFormEmptyPipe + * Description : This function is called to create an empty pipe block + * Parameters : None. + * Return Type : Pointer to USB_UHCD_HCD_PIPE structure if pipe creation is + * successful. + * NULL otherwise. + ******************************************************************************/ + +extern USB_UHCD_HCD_PIPE *usbUhcdFormEmptyPipe (void); + +/******************************************************************************* + * Function Name : usbUhcdLinkQheadBetween + * Description : This function is used to link a new Queue Head after + * the existing Queue Head. + * Parameters : newQh IN - pointer to the QH to be added. + * presentQh - pointer to the QH after which the new + * QH is to be added. + * Return Type : None + ******************************************************************************/ + +extern void usbUhcdLinkQheadBetween(UINT32 uBusIndex, + USB_UHCD_QH *newQh, + USB_UHCD_QH *presentQh); + +/******************************************************************************* + * Function Name : usbUhcdCalculateBusTime + * Description : This function is used to calculate the BW occupied by + * a pipe. + * Parameters : speed IN Speed of the device + * direction IN Direction of the pipe + * pipeType IN Type of the transfer supported by the pipe + * data IN Maximum byte count supported by the pipe. + * Return Type : INT32 + * Returns the calculated bus time in nano seconds + ******************************************************************************/ + +extern INT32 usbUhcdCalculateBusTime (UINT8 speed, + UINT8 direction, + UINT8 pipeType, + UINT16 data); + +/******************************************************************************* + * Function Name : usbUhcdFindTreeBw + * Description : This function is used to determine the bandwidth occupied + * by the list of nodes starting from index "treeIndex". + * Parameter : treeIndex IN Index to the interrupt tree + * usbUhcdTree IN Pointer to the list of Periodic Tree + * Return Type : INT32 + * Returns the bandwidth occupied by the list. + * Global Variables : None + * Calls : usbUhcdFindLinkForQh () + * Called by : usbUhcdCanIsoBeAccomodated + * usbUhcdFindPosForIntQh + * + * To Do : None + ******************************************************************************/ + +extern INT32 usbUhcdFindTreeBw( + INT32 treeIndex, + USB_UHCD_PERIODIC_TREE * usbUhcdTree); + +/******************************************************************************* + * Function Name : UHCD_IsBandwidthAvailable + * Description : This function is used to determine whether the bandwidth + * specified as parameter can be accomodated in the + * schedule maintained in the HCD. + * Parameters : bw_reqd IN Bandwidth which need to be accomodated. + * Return Type : BOOLEAN + * Returns + * TRUE - if bandwidth is available + * FALSE - if bandwidth is not available + ******************************************************************************/ +extern USBHST_STATUS usbUhcdIsBandwidthAvailable + (UINT8 uBusIndex, + UINT8 uDeviceAddress, + UINT8 uDeviceSpeed, + UCHAR *pCurrentDescriptor, + UCHAR *pNewDescriptor); + +/******************************************************************************* + * Function Name : usbUhcdMaxIsoBwLinkedTo + * Description : This function is used to determine the maximum + * bandwidth linked to the isochronous list which is linked + * to the tree node of index 'index'. + * Parameters : index IN Index into the tree. The node in this index + * should be in the leaf of the tree. + * usbUhcdTable IN Pointer to the list of Periodic Table + * Return Type : INT32 + * Returns the maximum isochronous bandwidth linked to the + * list + ******************************************************************************/ +extern INT32 usbUhcdMaxIsoBwLinkedTo( + INT32 index, + USB_UHCD_PERIODIC_TABLE * usbUhcdTable); + +/******************************************************************************* + * Function Name : usbUhcdFindPosForIntQh + * Description : This function is used to locate a suitable point + * for queueing the interrupt QH based on the bandwidth + * required and the poll rate + * Parameters : bwReqd IN bandwidth required for the endpoint + * reqPollRate IN polling rate required for the endpoint. + * list_index OUT pointer to the variable holding the + * index of the list to which the QH can + * be linked. + * usbUhcdTable IN Pointer to the list of Periodic Table + * usbUhcdTree IN Pointer to the list of Periodic Tree + * Return Type : BOOLEAN + * Returns + * TRUE - if bandwidth can be accomodated for the + * interrupt pipe. + * FALSE - if bandwidth cannot be accomodated for the + * interrupt pipe. + ******************************************************************************/ + +extern BOOLEAN usbUhcdFindPosForIntQh( + INT32 bwReqd, + UINT reqPollRate, + INT32 *listIndex, + USB_UHCD_PERIODIC_TABLE * usbUhcdTable, + USB_UHCD_PERIODIC_TREE * usbUhcdTree); + +/******************************************************************************* + * Function Name : usbUhcdIsLinked + * Description : This function is used to determine whether 2 nodes of + * the tree is the part of the same list or not + * Parameters : listIndexOuter IN Index of the node with a greater + * index + * listIndexInner IN Index of the node with a smaller index + * Return Type : BOOLEAN + * Returns + * TRUE - If the nodes are linked. + * FALSE - If the nodes are not linked. + ******************************************************************************/ + +extern BOOLEAN usbUhcdIsLinked (INT32 listIndexOuter, + INT32 listIndexInner); + + +/******************************************************************************* + * Function Name : usbUhcdMakeTds + * Description : This function is used to create the TDs needed for + * a transfer + * Parameters : head OUT Pointer holding the pointer to the head of the + * TDs formed. + * tail OUT Pointer holding the pointer to the tail of the + * TDs formed. + * urb IN Pointer to the URB. + * toggle IN Toggle value + * Return Type : BOOLEAN + * Returns + * TRUE - If TDs are created successfully. + FALSE - If TDs are not created successfully. + ******************************************************************************/ +extern BOOLEAN usbUhcdMakeTds( UINT32 uBusIndex, + USB_UHCD_TD **head, + USB_UHCD_TD **tail, + USBHST_URB *urb, + UINT8 *toggle, + USB_UHCD_HCD_PIPE *targetPipe); + +/******************************************************************************* + * Function Name : usbUhcdFillNonisoStatus + * Description : This function is used to fill the status of a + * non isochronous data transfer upon completion. + * Parameters : status IN Status of the request completion. + * statusInUrb OUT Pointer to the status of the URB. + * markedForDel IN Flag indicating whether it is marked + * for deletion. + * reqThatHalted IN Flag indicating whether the request is + * halted. + * Return Type : void + ******************************************************************************/ +extern void usbUhcdFillNonisoStatus (UINT status, + INT8* statusInUrb, + UINT8 markedForDel, + UINT8 reqThatHalted); + +/******************************************************************************* + * Function Name : usbUhcdFreeTds + * Description : This function is used to free up memory allocated + * for a chain of TDs. + * Parameters : start IN Address of the first TD + * stop IN Address of the last TD + * Return Type : void + ******************************************************************************/ + +extern void usbUhcdFreeTds (USB_UHCD_TD *start, USB_UHCD_TD *stop); + +/******************************************************************************* + * Function Name : usbUhcdGetTransferLength + * Description : This fucntion is used to determine the number of bytes + * actually transfered at the end of a transfer. + * Parameters : ni_request IN Pointer to the non isochronous request + * queue element. + * Return Type : UINT + * Returns the number of bytes transferred at the end of the + * transfer + ******************************************************************************/ + +extern UINT usbUhcdGetTransferLength + (USB_UHCD_NON_ISO_REQUEST_QUEUE *niRequest); + +/******************************************************************************* + * Function Name : usbUhcdCanIsoBeAccomodated + * Description : This function is used to determine whether the + * Isochronous transfer can be accomodated + * Parameters : bwReqd IN bandwidth required + * startIndex IN Starting index of the list + * maxNumOfItd IN Maximum number of isochronous TDs + * usbUhcdTable IN Pointer to the list of Periodic Table + * usbUhcdTree IN Pointer to the list of Periodic Tree + * Return Type : BOOLEAN + * Returns + * TRUE - If isochronous endpoint can be + * accomodated. + * FALSE - If isochronous endpoint cannot be + * accomodated. + ******************************************************************************/ +extern BOOLEAN usbUhcdCanIsoBeAccomodated( + INT32 bwReqd, + INT32 startIndex, + INT32 maxNumOfItd, + USB_UHCD_PERIODIC_TABLE * usbUhcdTable, + USB_UHCD_PERIODIC_TREE * usbUhcdTree); + + +/******************************************************************************* + * Function Name : usbUhcdLinkItds + * Description : This function is used to link the isochronous TDs + * to the HC list. This adds each TD to the periodic table. + * Parameters : iTd IN Pointer to the isochronous TD to be + * linked. + * startIndex IN Starting index of the list. + * bwReqd IN Bandwidth required for the transfer. + * Return Type : void + ******************************************************************************/ +extern void usbUhcdLinkItds (UINT8 BusIndex, + USB_UHCD_TD *iTd, + INT32 startIndex); + +/******************************************************************************* + * Function Name : usbUhcdUnlinkItds + * Description : This function is used to unlink and free up the iTDs + * from the periodic table + * Parameters : iTd IN Pointer to the isochronous TD to be + * linked. + * startIndex IN Starting index of the list. + * bw IN Bandwidth required for the transfer. + * Return Type : void + ******************************************************************************/ +extern void usbUhcdUnlinkItds (PUHCD_DATA pHCDData, + USB_UHCD_TD *iTd, + BOOLEAN freetds); + +/******************************************************************************* + * Function Name : usbUhcdGetIsoTransferLength + * Description : This function is used to get the isochronous transfer + * length. + * Parameters : iRequest IN Pointer to the isochronous request + * queue. + * Return Type : UINT + * Returns the isochronous transfer length + ******************************************************************************/ +extern VOID usbUhcdGetIsoTransferLength + (UINT32 uBusIndex, + USB_UHCD_ISO_REQUEST_QUEUE *iRequest); + + +/******************************************************************************* + * Function Name : usbUhcdEnterCritical, + * usbUhcdLeaveCritical + * Description : This function is called before accessing shared data + * structures to guard them from multiple access. + ******************************************************************************/ + +extern void usbUhcdEnterCritical (PUHCD_DATA pHCDData); +extern void usbUhcdLeaveCritical (PUHCD_DATA pHCDData); + + +/******************************************************************************* + * Function Name : usbUhcdFillIsoStatus + * Description : This function is used to fill the status of a + * Isochronous data transfer upon completion. + * Parameters : status IN Status of the request completion. + * statusInUrb OUT Pointer to the status of the URB. + * markedForDel IN Flag indicating whether it is marked + * for deletion. + * reqThatHalted IN Flag indicating whether the request is + * halted. + * Return Type : void + * Global Variables : None + * Calls : None + * Called by : uhc_ProcessCompletedTDs + * To Do : None + ******************************************************************************/ + +extern VOID usbUhcdFillIsoStatus(UINT32 uBusIndex, + USBHST_STATUS status, + pUSBHST_URB pUrb, + USB_UHCD_ISO_REQUEST_QUEUE *iReQ); + + +/******************************************************************************* + * Function Name : usbUhcdProcessIsocTds + * Description : This function is used to handle isoc TDs maked for deletion + * Parameters : None. + * Return Type : void + * Global Variables : + * Calls : + * Called by : + * To Do : None + ******************************************************************************/ + +/*************************************************************************** +* +* usbUhcdProcessIsocTds - handles the isoc TDs maked for deletion +* +* RETURNS: N/A +*/ + +extern VOID usbUhcdProcessIsocTds(PUHCD_DATA pHCDData); + + +/******************************************************************************* + * Function Name : usbUhcdMakeIsocTds + * Description : This function is used to create the TDs needed for + * a transfer + * Parameters : head OUT Pointer holding the pointer to the head of the + * TDs formed. + * tail OUT Pointer holding the pointer to the tail of the + * TDs formed. + * urb IN Pointer to the URB. + * toggle IN Toggle value + * Return Type : BOOLEAN + * Returns + * TRUE - If TDs are created successfully. + FALSE - If TDs are not created successfully. + * Global Variables : None + * Calls : usbUhcdFormEmptyTd + * free + * Called by : UHCD_SubmitURB + * To Do : None + ******************************************************************************/ + +/*************************************************************************** +* +* usbUhcdMakeIsocTds - create the TDs needed for a transfer +* +* RETURNS: FALSE if TDs are not created successfully. +*/ + +extern BOOLEAN usbUhcdMakeIsocTds(UINT32 uBusIndex, + USB_UHCD_TD **head, + USB_UHCD_TD **tail, + USBHST_URB *purb, + UINT8 *toggle , + USB_UHCD_HCD_PIPE *targetPipe); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCusbUhcdScheduleQSupporth */ + + diff --git a/h/usb2/usbUhcdScheduleQueue.h b/h/usb2/usbUhcdScheduleQueue.h new file mode 100644 index 0000000..8a8b55e --- /dev/null +++ b/h/usb2/usbUhcdScheduleQueue.h @@ -0,0 +1,909 @@ +/* usbUhcdScheduleQueue.h - header for scheduling and queuing USB UHCD HCD */ + +/* Copyright 2004 - 2005 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +Modification history +-------------------- +01e,28mar05,pdg non-PCI changes +01d,03mar05,mta SPR 96604 +01c,18jan05,ami New member outTokScheduled added (SPR #104979 added) +01b,26jun03,mat changing the code to WRS standards. +01a,25apr03,ram written. +*/ + +/* +DESCRIPTION + +This file contains the data structures maintained by the USB UHCD and the HCD +and the prototypes of the functions used for the scheduling and the queuing +of transfers requests. +*/ + + +/* +INTERNAL + ******************************************************************************* + * Filename : usbUhcdScheduleQueue.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : This file contains the data structures maintained by the + * HC and the HCD and the prototypes of the functions used + * for the scheduling and the queuing of transfers requests. + * + * + */ +#ifndef __INCusbUhcdScheduleQueueh +#define __INCusbUhcdScheduleQueueh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "usbOsal.h" +#include "usbHst.h" +#include "BusAbstractionLayer.h" +#include "usbPciLib.h" + +/* defines */ + +/* + * UHCD link pointers, including frame list pointers and the pointers found + * in USB_UHCD_TD and USB_UHCD_QH structures, use the same basic structure as defined + * below. The exception is the VF (Depth/Breadth select) which is only used + * in the USB_UHCD_TD structure. + */ + +#define USBUHCD_LINK_PTR_MASK 0xfffffff0 /* For the frame list ptr : Not used + directly*/ +#define USBUHCD_LINK_PTR_ROT 4 + +#define USBUHCD_LINK_VF 0x00000004 /* for the vf bit */ + /* 1=Depth first, 0=breadth first */ + + +#define USBUHCD_LINK_QH 0x00000002 /* For the q bit */ + +#define USBUHCD_LINK_TD 0x00000000 /* 1=QH, 0=TD */ + + +#define USBUHCD_LINK_TERMINATE 0x00000001 /*for the t bit */ + /* 1=End of list, 0=pointer valid */ + +/* Macros to retrieve/format link ptr */ + +#define USBUHCD_LINK_PTR(x) \ + (((x) & USBUHCD_LINK_PTR_MASK) >> USBUHCD_LINK_PTR_ROT) + +#define USBUHCD_LINK_PTR_FMT(x) \ + (((x) << USBUHCD_LINK_PTR_ROT) & USBUHCD_LINK_PTR_MASK) + +/* Frame List related macros */ + +#define USBUHCD_FRAME_LIST_ENTRIES 1024 +#define USBUHCD_FRAME_LIST_ALIGNMENT 4096 + +/* Transfer Descriptor related macros */ + +#define UHCI_TD_LEN 32 /* TD length required by UHCD hardware */ +#define UHCI_TD_ACTLEN sizeof (USB_UHCD_TD) + +/* + * USB_UHCD_TD.dWord1Td definitions. + */ + +#define USBUHCD_TDCS_SHORT 0x20000000 /* Short Packet Detect */ + /* 1=Enable, 0=Disable */ + +#define USBUHCD_TDCS_ERRCTR_MASK 0x18000000 /* Error Counter Mask*/ +#define USBUHCD_TDCS_ERRCTR_NOLIM 0x00000000 /* No limit */ +#define USBUHCD_TDCS_ERRCTR_1ERR 0x08000000 /* 1 error */ +#define USBUHCD_TDCS_ERRCTR_2ERR 0x10000000 /* 2 errors */ +#define USBUHCD_TDCS_ERRCTR_3ERR 0x18000000 /* 3 errors : used to set + error count*/ + +#define USBUHCD_TDCS_LOWSPEED 0x04000000 /* Low Speed Device */ + /* 1=low speed dev, 0=full speed */ +#define USBUHCD_TDCS_ISOCH 0x02000000 /* Isochronous Select */ + /* 1=isoch TD, 0=non-isoch TD */ +#define USBUHCD_TDCS_COMPLETE 0x01000000 /* Interrupt on Complete */ + /* 1=Issue Ioc*/ + + +/* USB_UHCD_TD.dWord1Td Status bits */ +#define USBUHCD_TDCS_STS_MASK 0x00ff0000 /* Mask for status bits */ +#define USBUHCD_TDCS_STS_ACTIVE 0x00800000 /* Active */ +#define USBUHCD_TDCS_STS_STALLED 0x00400000 /* Stalled */ +#define USBUHCD_TDCS_STS_DBUFERR 0x00200000 /* Data buffer error */ +#define USBUHCD_TDCS_STS_BABBLE 0x00100000 /* Babble Detected */ +#define USBUHCD_TDCS_STS_NAK 0x00080000 /* NAK Received */ +#define USBUHCD_TDCS_STS_TIME_CRC 0x00040000 /* CRC/Timeout error */ +#define USBUHCD_TDCS_STS_BITSTUFF 0x00020000 /* Bitstuff error */ + + +/* USB_UHCD_TD.dWord1Td Actlen Related macros */ + + +#define USBUHCD_TDCS_ACTLEN_MASK 0x000007ff /* Actual Length mask */ +#define USBUHCD_TDCS_ACTLEN_ROT 0 /* Actual length bit loc */ + +#define USBUHCD_PACKET_SIZE_MASK 0x000007ff /* Mask for 11-bit field */ + + +/* Macro to retrieve USBUHCD_TDCS_ACTLEN + * + * NOTE: UHCD actlen is one less than the real length. + * The macro compensates automatically. + * + */ + +#define USBUHCD_TDCS_ACTLEN(x) \ + ((((x) >> USBUHCD_TDCS_ACTLEN_ROT) ) & USBUHCD_PACKET_SIZE_MASK) + +/* USB_UHCD_TD.dWord1Td Token related macros */ + + +#define USBUHCD_TDTOK_MAXLEN_MASK 0xffe00000 /* Maximum length mask */ +#define USBUHCD_TDTOK_MAXLEN_ROT 21 /* Maximum length bit loc */ + +#define USBUHCD_TDTOK_DATA_TOGGLE 0x00080000 /* Data Toggle */ + /* 0=DATA0, 1=DATA1 */ + +#define USBUHCD_TDTOK_ENDPT_MASK 0x00078000 /* Endpoint Mask */ +#define USBUHCD_TDTOK_ENDPT_ROT 15 /* Endpoint bit loc */ + +#define USBUHCD_TDTOK_DEVADRS_MASK 0x00007f00 /* Device Address Mask */ +#define USBUHCD_TDTOK_DEVADRS_ROT 8 /* Device Address bit loc */ + +#define USBUHCD_TDTOK_PID_MASK 0x000000ff /* Packet ID mask */ +#define USBUHCD_TDTOK_PID_ROT 0 /* Packet ID bit loc */ + + +/* Macros to retrieve/format USBUHCD_TDTOK_MAXLEN + * + * NOTE: UHCD maxlen is one less than the real length. The macro + * compensates automatically. + */ + + +#define USBUHCD_TDTOK_MAXLEN(x) \ + ((((x) >> USBUHCD_TDTOK_MAXLEN_ROT) ) & USBUHCD_PACKET_SIZE_MASK) + + + +#define USBUHCD_TDTOK_MAXLEN_FMT(x) \ + ((((x)) & USBUHCD_PACKET_SIZE_MASK) << USBUHCD_TDTOK_MAXLEN_ROT) + + +/* Macros to retrieve/format USBUHCD_TDTOK_ENDPT */ + + + +#define USBUHCD_TDTOK_ENDPT(x) \ + (((x) & USBUHCD_TDTOK_ENDPT_MASK) >> USBUHCD_TDTOK_ENDPT_ROT) + + + +#define USBUHCD_TDTOK_ENDPT_FMT(x) \ + (((x) << USBUHCD_TDTOK_ENDPT_ROT) & USBUHCD_TDTOK_ENDPT_MASK) + + +/* Macros to retrieve/format USBUHCD_TDTOK_DEVADRS */ + + + +#define USBUHCD_TDTOK_DEVADRS(x) \ + (((x) & USBUHCD_TDTOK_DEVADRS_MASK) >> USBUHCD_TDTOK_DEVADRS_ROT) + + + +#define USBUHCD_TDTOK_DEVADRS_FMT(x) \ + (((x) << USBUHCD_TDTOK_DEVADRS_ROT) & USBUHCD_TDTOK_DEVADRS_MASK) + + + +/* Macros to retrieve/format USBUHCD_TDTOK_PID */ + +#define USBUHCD_TDTOK_PID(x) \ + (((x) & USBUHCD_TDTOK_PID_MASK) >> USBUHCD_TDTOK_PID_ROT) + +#define USBUHCD_TDTOK_PID_FMT(x) \ + (((x) << USBUHCD_TDTOK_PID_ROT) & USBUHCD_TDTOK_PID_MASK) + +/* Queue Head related macros */ + +#define UHCI_QH_ALIGNMENT 16 +#define UHCI_QH_LEN 8 /* QH length required by UHCI hardware */ +#define UHCI_QH_ACTLEN sizeof (USB_UHCD_QH) + + +/* PCI pointer macros */ + +#define TO_PCIPTR(p) TO_LITTLEL(USB_MEM_TO_PCI (p)) +#define QH_TO_PCIPTR(p) (TO_PCIPTR (p) | TO_LITTLEL (USBUHCD_LINK_QH)) +#define TD_TO_PCIPTR(p) (TO_PCIPTR (p)) + +#define FROM_PCIPTR(d) USB_PCI_TO_MEM((FROM_LITTLEL(d))) + +#define QH_FROM_PCIPTR(d) \ + ((PUSB_UHCD_QH) (FROM_PCIPTR ( FROM_LITTLEL (d) & USBUHCD_LINK_PTR_MASK))) + +#define TD_FROM_PCIPTR(d) \ + ((PUSB_UHCD_TD) (FROM_PCIPTR ( FROM_LITTLEL (d) & USBUHCD_LINK_PTR_MASK))) + +#define USBUHCD_END_OF_LIST(INDEX) USB_UHCD_SWAP_DATA(INDEX, USBUHCD_LINK_TERMINATE) + + +/* interrupt bits */ + +#define UHCI_STS_HALTED 0x0020 /* Host Controller Halted */ +#define UHCI_STS_PROCERR 0x0010 /* Host Controller Process Error */ +#define UHCI_STS_HOSTERR 0x0008 /* Host System Error */ +#define UHCI_STS_RESUME 0x0004 /* Resume Detect */ +#define UHCI_STS_USBERR 0x0002 /* USB Error Interrupt */ +#define UHCI_STS_USBINT 0x0001 /* USB Interrupt */ + +#define UHC_INT_PENDING_MASK (UHCI_STS_PROCERR | UHCI_STS_HOSTERR | \ + UHCI_STS_RESUME | UHCI_STS_USBERR | \ + UHCI_STS_USBINT) + + +#if (_BYTE_ORDER == _BIG_ENDIAN) + +#define FROM_LITTLEW(w) (MSB((w)) | (LSB((w)) << 8)) +#define FROM_LITTLEL(l) (LONGSWAP((l))) +#define FROM_BIGW(w) (w) +#define FROM_BIGL(l) (l) + +#else + +#define FROM_LITTLEW(w) (w) +#define FROM_LITTLEL(l) (l) +#define FROM_BIGW(w) (MSB((w)) | (LSB((w)) << 8)) +#define FROM_BIGL(l) (LONGSWAP((l))) + +#endif + + +#define TO_LITTLEW(w) FROM_LITTLEW((w)) +#define TO_LITTLEL(l) FROM_LITTLEL((l)) +#define TO_BIGW(w) FROM_BIGW((w)) +#define TO_BIGL(w) FROM_BIGL((l)) + +/* typedefs */ + +/* + * Structure holding the format of the Transfer Descriptor + * This is to be created for every packet to be transmitted in the USB bus. + */ + +typedef struct usbUhcdTd + { + + /* HC understood Transfer Descriptor format - start */ + + UINT32 dWord0Td; /* DWORD 0 of TD */ + + UINT32 dWord1Td; /* DWORD 1 of TD */ + + UINT32 dWord2Td; /* DWORD 2 of TD */ + + UINT32 dWord3Td; /* DWORD 3 of TD */ + + /* HC understood Transfer Descriptor format - End */ + /* HCD understood Transfer Descriptor format - start */ + + /* + * When the TD is to be freed, this address is to be used. + * This will hold the non-aligned memory address(if allocated memory + * is not aligned to 16 bytes) or an aligned memory address. + */ + UINT offsetForFreeing; + + /* Pointer to the next TD in the queue of requests created by the HCD */ + + struct usbUhcdTd *hNextTd; + + /* Pointer to the previous TD in the queue of requests created by the HCD */ + + struct usbUhcdTd *hPrevTd; + + /* Pointer to the next TD in the queue maintained by the HC */ + + struct usbUhcdTd *vNextTd; + + /* Pointer to the previous TD in the queue maintained by the HC */ + + struct usbUhcdTd *vPrevTd; + + UINT8 toggle; + /* HCD understood Transfer Descriptor format - End */ + + } USB_UHCD_TD; + +typedef struct usbUhcdTd *PUSB_UHCD_TD; + +/* + * Structure holding the format of the Queue Head. + * This is to be created for every bulk, control and interrupt endpoint + * created. + */ + +typedef struct usbUhcdQh + { + + /* HC understood Queue Head format - start */ + + UINT32 dWord0Qh; /* DWORD 0 of QH */ + + UINT32 dWord1Qh; /* DWORD 1 of QH */ + + /* HC understood Queue Head format - End */ + + /* HCD maintained Queue Head format - start */ + /* + * When the QH is to be freed, this address is to be used. + * This will hold the non-aligned memory address(if allocated memory + * is not aligned to 16 bytes) or an aligned memory address. + */ + + UINT offsetForFreeing; + + /* Pointer to the TD which is attached to the queue */ + + USB_UHCD_TD *td; + + /* Pointer to the previous QH in the schedule */ + + struct usbUhcdQh *prevQh; + + /* Pointer to the next QH in the schedule */ + + struct usbUhcdQh *nextQh; + + /* To hold the data toggle field */ + + UINT8 toggle; + + /* To hold the flag indicating whether the endpoint is halted */ + + UINT8 halted; + + /* flag indicating whether the endpoint is marked for deletion */ + + UINT8 markedForDeletion; + + /* Pointer to the TD which is at the last in the queue */ + + USB_UHCD_TD *tdLast; + + /* HCD maintained Queue Head format - End */ + + } USB_UHCD_QH; + +typedef struct usbUhcdQh *PUSB_UHCD_QH; + +/* + * Structure holding the format of the frame list of the HC + * Each element in the list is accessed by the HC on every frame. + */ + +typedef struct usbUhcdFrameList + { + UINT32 pfl[1024]; + } USB_UHCD_FRAME_LIST; + +/* + * The UHCD HCD maintains an array of 1024 elements to hold the + * information about the isochronous TDs in a frame. + * This structure holds information about each element of the array + */ + +typedef struct usbUhcdPeriodicTable + { + UINT32 bandWidth; /* + * Bandwidth occupied by the isochronous + * TDs in the frame + */ + USB_UHCD_TD *td; /* Pointer to the first isochronous TD */ + }USB_UHCD_PERIODIC_TABLE; + +/* + * The UHCD HCD maintains a tree to hold the information about the + * interrupt transfers which need to be serviced at different polling intervals. + * This structure holds information about each node of the tree. + */ +typedef struct usbUhcdPeriodicTree + { + UINT32 bandWidth; /* + * Bandwidth occupied by the interrupt transfers + * in a particular node + */ + USB_UHCD_QH *qh; /* Pointer to the first interrupt TD in the node*/ + }USB_UHCD_PERIODIC_TREE; + +/* + * The HCD creates a pipe for every endpoint which needs to be + * serviced and maintains it in a list. + * This structure holds information about the HCD maintained pipe + */ +typedef struct usbUhcdHcdPipe + { + UINT8 deviceNum; /* Device number */ + UINT8 endPointNum; /* Endpoint number */ + UINT8 endPointDirection; /* Direction of the endpoint */ + UINT8 endPointType; /* Type of the endpoint */ + UINT8 uDeviceSpeed; + UINT16 uMaximumPacketSize; + USB_UHCD_QH *qh; /* + * Pointer to the QH + * representing the endpoint + */ + UINT listIndex; /* Index of the node next in the list */ + INT32 bw; /* + * To hold the bandwidth + * occupied by the endpoint + */ + + UINT32 lastIndexAllocated; /* For an Isochronous pipe this field stores the + * the Index allocated to the last request for + * this endpoint(pipe) + */ + UINT32 uLastStartIndex; /* Start index of the last request */ + + struct usbUhcdHcdPipe *next; /* + * Pointer to the next pipe structure in the + * list of pipes maintained by the HCD + */ + + BOOL outTokScheduled; /* + * Out Token Scheduled for Short Packet + * Transfer + */ + + }USB_UHCD_HCD_PIPE; + +/* + * The HCD maintains a queue of non-isochronous requests + * This gives the format of one element of the queue + */ + +typedef struct usbUhcdNonIsochronousRequestQueue + { + + USBHST_URB *pUrb; /* Pointer to the URB */ + USB_UHCD_QH *qh; /* + * Pointer to the QH to which the + * request is queued + */ + + USB_UHCD_HCD_PIPE * pipe; /* Pointer to pipe structure */ + + /*thru pipe we can reach queue head , may be we remove qh*/ + USB_UHCD_TD *head; /* + * Pointer to the TD which + * forms the head of this request + */ + USB_UHCD_TD *tail; /* + * Pointer to the TD which forms + * the tail of this request + */ + struct usbUhcdNonIsochronousRequestQueue *next;/* + * Pointer to the next + * request element in + * the queue + */ + }USB_UHCD_NON_ISO_REQUEST_QUEUE; + +/* + * The HCD maintains a queue of isochronous requests + * This gives the format of one element of the queue + */ + +typedef struct usbUhcdIsochronousRequestQueue + { + USBHST_URB *pUrb; /* Pointer to the URB */ + + USB_UHCD_HCD_PIPE * pipe; /* Pointer to pipe structure */ + + + USB_UHCD_TD *head; /* + * Pointer to the TD which forms the head of + * this request + */ + USB_UHCD_TD *tail; /* + * Pointer to the TD which forms the tail of + * this request + */ + INT32 startIndex; /* + * Index of the frame in which the transfer + * should be initiated + */ + INT32 bw; /* Bandwidth occupied by this endpoint */ + + UINT8 markedForDeletion; /* The request is marked for deletion */ + + struct usbUhcdIsochronousRequestQueue *next; /* + * Pointer to the next request + * element in the queue + */ + }USB_UHCD_ISO_REQUEST_QUEUE; + +/* This data structure holds the details of the Root hub */ + +typedef struct usbUhcdRhData + { + PUCHAR pPortStatus; + USB_UHCD_HCD_PIPE * pControlPipe; + USB_UHCD_HCD_PIPE * pInterruptPipe; + UINT8 bInterruptEndpointHalted; + UINT8 uDeviceAddress; /* Address of the Root hub. */ + UINT8 uConfigValue; /* Value of the configuration which is set. */ + }USB_UHCD_RH_DATA; + +typedef struct usbUhcdRhData *PUSB_UHCD_RH_DATA; + + +/* This is the data structure maintained for every UHCD Host Controller. */ + +typedef struct usbUhcdData +{ + UINT8 busIndex; /* Index into the array of host controllers */ + INT32 busNumber; /* + * Bus number corresponding to the bus to which the + * Host Controller is connected. + */ + INT32 deviceNumber; /* Device number for the device. */ + INT32 functionNumber; /* Function number for the device. */ + + UINT8 irq; /* IRQ number used by the UHC */ + + UINT32 usbUhcdUsbBase; /* Base address of UHCD's regx */ + + USB_UHCD_FRAME_LIST * usbUhcdFrameList; /* + * To hold the UHCD's frame list. + * The UHCD Host controller maintains an array of indices + * which are pointers to the list of requests to be serviced. + */ + + USB_UHCD_FRAME_LIST * forFreeing; /* To Hold the actual pointer to FrameList */ + + + USB_UHCD_PERIODIC_TABLE * usbUhcdTable; /* + * To hold the pointer to the table containing the + * bandwidth information of the isochronous transfers + */ + + USB_UHCD_PERIODIC_TREE * usbUhcdTree; /* To hold the tip of the periodic + * tree maintained for interrupt transfers + */ + + + PUSB_UHCD_QH usbUhcdCQh; /* Control Queue Head */ + + PUSB_UHCD_QH usbUhcdBQh; /* Bulk Queue Head */ + + + PUSB_UHCD_QH usbUhcdBRQh; /* Bandwidth Reclamation Queue Head */ + + + USB_UHCD_HCD_PIPE * hcDefaultPipe;/* default control pipe */ + + USB_UHCD_HCD_PIPE * usbUhcdPipe; /* list of pipes belonging to host conroller */ + + USB_UHCD_NON_ISO_REQUEST_QUEUE * usbUhcdNonIsoRequestQ; /* non isoch request list */ + + USB_UHCD_NON_ISO_REQUEST_QUEUE * usbUhcdNonIsoRequestQTail; /* non isoch request list tail pointer */ + + USB_UHCD_ISO_REQUEST_QUEUE * usbUhcdIsoRequestQ; /* isoch request list */ + + USB_UHCD_ISO_REQUEST_QUEUE * usbUhcdIsoRequestQTail; /* isoch request list tail pointer */ + + /*INT32 usbUhcdCBBw;*/ /* To hold the bandwidth information of the control and bulk transfers */ + + USB_UHCD_RH_DATA rootHub; /* Root Hub Details of host controller*/ + + UINT8 usbUhcdResetChange[2] ;/* Flag used for monitoring Reset Change on ports */ + + UCHAR usbUhcdRhConfig;/* Value indicating the configuration number which is set */ + + OS_THREAD_ID usbUhcdThdTransferComp; /*Thread ID for the thread created for handling transfer completion */ + + OS_THREAD_ID usbUhcdThdManagePort;/*Thread ID for the thread created for managing port */ + + SEM_ID usbUhcdSemCheckPort; /* Semaphore used to indicate a change in the Root hub ports */ + + SEM_ID usbUhcdSemPortInterruptTransfer;/* Semaphore used by the Root hub emulation module's interrupt task */ + + SEM_ID usbUhcdSemCleanupTd; /* Semaphore used to indicate a safe cleanup of resources */ + + SEM_ID usbUhcdSemCritical; /* + * Semphore for mutual exclusion. This semaphore + * for handling shared global data structures + */ + +/* WDOG_ID wid;*/ /* + * Watch dog timer ID. Watch dog timer is used for scanning + * the UHCD's port at regular intervals + */ + UINT8 flagRhIntDel; /* Flag used for checking the deletion of the interrupt + task for Root Hub */ + UINT32 usbUhcdIntStatusValue; /* place holder to store the Interrupt register value */ + + UINT32 usbUhcdIntEnableValue; /* place holder to store the Interrupt register value */ + + +}UHCD_DATA, *PUHCD_DATA; + + +/* This data structure holds the details of the Endpoint of a New Interface */ + +typedef struct usbUhcdNewEndpointDetails + { + UINT8 endpointType; /* Type of the endpoint*/ + INT32 Bw; /* Bandwidth need by the endpoint. */ + UINT8 pollingInterval;/* Polling interval for the Interrupt pipe. */ + }USB_UHCD_NEW_ENDPOINT_DETAILS; + +typedef struct usbUhcdNewEndpointDetails *PUSB_UHCD_NEW_ENDPOINT_DETAILS; + + + + +/******************************************************************************* + * Function Name : usbUhcdQueueRhRequest + * Description : This function handles the request queued to the Root hub. + * Parameters : pUrb IN Pointer to the URB. + * Return Type : BOOLEAN + * Returns + * TRUE - If the request for Root hub is queued + * successfully + * FALSE - If the request for the Root hub is not + * queued. + ******************************************************************************/ + +extern BOOLEAN usbUhcdQueueRhRequest (PUHCD_DATA pHCDData, USBHST_URB *pUrb ,UINT32 pipeHandle); +extern USBHST_STATUS usbUhcdRhDeletePipe (PUHCD_DATA pHCDData, UINT32 uPipeHandle); +extern USBHST_STATUS usbUhcdRhCreatePipe (PUHCD_DATA pHCDData, + UINT8 uDeviceAddress, + UINT8 uDeviceSpeed, + PUCHAR pEndpointDescriptor, + PUINT32 puPipeHandle); +/******************************************************************************* + * Function Name : usbUhcdCreateFrameList + * Description : The HCD maintains + * - a tree of 256 elements to maintain the bandwidth usage + * in every frame for the interrupt transfers. + * - an array of 1024 static isochronous Transfer + * Descriptor elements. + * This function allocates memory for the data structures and + * initialises them. Also this function allocates memory for + * the frame list maintained by the UHCD Host controller and + * initialises the list. + * Parameters : None. + * Return Type : BOOLEAN + * Returns + * TRUE - If frame list creation is success + * FALSE- If frame list creation is a failure + ******************************************************************************/ +extern BOOLEAN usbUhcdCreateFrameList (PUHCD_DATA pHCDData); + +/******************************************************************************* + * Function Name : usbUhcdDeleteFrameList + * Description : The HCD maintains + * - a tree of 256 elements to maintain the bandwidth usage + * in every frame for the interrupt transfers. + * - an array of 1024 static isochronous Transfer + * Descriptor elements. + * This function deallocates memory for the data structures + * Parameters : None. + * Return Type : BOOLEAN + * Returns + * TRUE - If frame list deletion is success + * FALSE- If frame list deletion is a failure + ******************************************************************************/ +extern BOOLEAN usbUhcdDeleteFrameList (PUHCD_DATA pHCDData); + +/******************************************************************************* + * Function Name : usbUhcdCreatePipe + * Description : This function creates + * - the HCD maintained pipe + * - HC maintained QH for control, bulk and interrupt + * transfers + * - Updates the bandwidth utilised. + * Parameters : pipe IN Pointer to the Pipe data structure. + * Return Type : BOOLEAN + * Returns + * TRUE - If pipe is created successfully + * FALSE - If pipe is not created successfully. + ******************************************************************************/ +extern USBHST_STATUS usbUhcdCreatePipe (UINT8 uBusIndex, + UINT8 uDeviceAddress, + UINT8 uDeviceSpeed, + UCHAR *pEndpointDescriptor, + UINT16 uHighSpeedHubInfo, + UINT32 *puPipeHandle); +/******************************************************************************* + * Function Name : usbUhcdDeletePipe + * Description : This function is used to delete the HCD maintained pipe + * and the QH created for the pipe. + * Parameters : pipe IN Pointer to the Pipe data structure. + * Return Type : BOOLEAN + * Returns + * TRUE - If pipe is deleted successfully. + * FALSE - If pipe is not deleted successfully. + ******************************************************************************/ +extern USBHST_STATUS usbUhcdDeletePipe (UINT8 uBusIndex, + UINT32 uPipeHandle); +/******************************************************************************* + * Function Name : UHCD_SubmitURB + * Description : This function is used to submit a transfer request to the + * HCD. + * Parameters : pUrb IN Pointer to URB. + * Return Type : BOOLEAN + * Returns + * TRUE - If request is submitted successfully + * FALSE - If request is not submitted successfully + ******************************************************************************/ +extern USBHST_STATUS usbUhcdSubmitUrb (UINT8 uBusIndex, + UINT32 uPipeHandle, + USBHST_URB *pUrb); +/******************************************************************************* + * Function Name : usbUhcdCancelUrb + * Description : This function is used to cancel a request queued to + * already + * Parameters : None. + * Return Type : BOOLEAN + * Returns + * TRUE - If the request is cancelled successfully + * FALSE - If the request is not cancelled + * successfully. + ******************************************************************************/ +extern USBHST_STATUS usbUhcdCancelUrb (UINT8 uBusIndex, + UINT32 uPipeHandle, + USBHST_URB *pUrb); + + +/******************************************************************************* + * Function Name : usbUhcdGetFrameNumber + * Description : This function is used to get the current frame number + * of the Host Controller. + * Parameters : None. + * Return Type : UINT + * Returns the least 11 bits of the current frame number. + ******************************************************************************/ +extern USBHST_STATUS usbUhcdGetFrameNumber (UINT8 uBusIndex, + UINT16 *puFrameNumber); + +/******************************************************************************* + * Function Name : usbUhcdSetBitRate + * Description : This function is used to set the bit rate + * + * Parameters : . + * Return Type : USBHST_SUCCESS + * Returns USBHST_SUCCESS, or USBHST_FAILURE in case of failure + ******************************************************************************/ + +extern USBHST_STATUS usbUhcdSetBitRate (UINT8 uBusIndex, + BOOL bIncrement, + PUINT32 puCurrentFrameWidth); + +/******************************************************************************* + * Function Name : usbUhcdIsRequestPending + * Description : This function is detrmine if request is pending on pipe + * + * Parameters : uBusIndex Host Controller Bus Index + * uPipeHandle : Handle to pipe + * Return Type : USBHST_SUCCESS + * Returns USBHST_SUCCESS, or USBHST_FAILURE + ******************************************************************************/ + + +extern USBHST_STATUS usbUhcdIsRequestPending (UINT8 uBusIndex, + UINT32 uPipeHandle); + +/******************************************************************************* + * Function Name : usbUhcdModifyDefaultPipe + * Description : This function is modify the default pipe + * + * Parameters : uBusIndex Host Controller Bus Index + * uDefaultPipeHandle : Handle to default pipe + uDeviceSpeed : speed of device + uMaxPacketSize : max packet size + * Return Type : USBHST_SUCCESS + * Returns USBHST_SUCCESS, or USBHST_FAILURE + ******************************************************************************/ + + +USBHST_STATUS usbUhcdModifyDefaultPipe (UINT8 uBusIndex, + UINT32 uDefaultPipeHandle, + UINT8 uDeviceSpeed, + UINT8 uMaxPacketSize, + UINT16 uHighSpeedHubInfo); + +/******************************************************************************* + * Function Name : usbUhcdProcessCompletedTds + * Description : This function is used to handle the completed TDs. + * Parameters : PUHCD_DATA + * Return Type : void + ******************************************************************************/ +extern VOID usbUhcdProcessCompletedTds(PUHCD_DATA pHCDData); + + +/******************************************************************************* + * Function Name : usbUhcdGetCurrentEndpointDetails + * Description : This function searches all for the pipes with a + * particular device address. + * + * Parameters : + * uBusindex: Host Controller Bus Index. + * uDeviceAddress : device address + * pListOfCurrentEndpointPipes : Contains the list of the pipes + * found + * uNumberOfEndpoint Store the number of pipes + * + * Return Type : None + * Global Variables : g_pUHCDData + * Calls : + * Called by : + * To Do : None + ******************************************************************************/ + +extern VOID usbUhcdGetCurrentEndpointDetails( + UINT8 uBusIndex, + UINT8 uDeviceAddress, + USB_UHCD_HCD_PIPE **pListOfCurrentEndpointPipes, + pUSBHST_ENDPOINT_DESCRIPTOR pCurrentEndpointDesc, + UINT8 *uNumberOfEndpoint); + + +/******************************************************************************* + * Function Name : usbUhcdGetDetailsForEndpoints + * Description : This function Get details for the Endpoint + * of the new interface + * + * Parameters : + * uDeviceSpeed : IN device Speed + * uNumberOfEndpoints : IN Number of Endpoints + * pEndpointDesc : IN all the endpoint desc for + * the Interface + * pNewEndpointDetails OUT Details of the Periodic endpoint + * + * Return Type : None. + * Global Variables : None + * Calls : + * Called by : + * To Do : None + ******************************************************************************/ +extern VOID usbUhcdGetDetailsForEndpoints(UINT8 uDeviceSpeed, + UINT8 *uNumberOfEndpoints, + pUSBHST_ENDPOINT_DESCRIPTOR *pEndpointDesc, + PUSB_UHCD_NEW_ENDPOINT_DETAILS pNewEndpointDetails); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCusbUhcdScheduleQueueh */ + + diff --git a/h/usb2/usbUhcdSupport.h b/h/usb2/usbUhcdSupport.h new file mode 100644 index 0000000..fb084b3 --- /dev/null +++ b/h/usb2/usbUhcdSupport.h @@ -0,0 +1,287 @@ +/* usbUhcdSupport.h - header file for USB UHCD HCD register access*/ + +/* Copyright 2004-2005 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +Modification history +-------------------- +01d,28mar05,pdg non-PCI changes +01c,05oct04,mta SPR100704- Removal of floating point math +01c,05oct04,mta SPR100704- Removal of floating point math +01b,26jun03,amn changing the code to WRS standards. +01a,25apr03,ram written. +*/ + +/* +DESCRIPTION + +This file contains the constants and function prototypes +which are used for accessing the registers. +*/ + +/* +INTERNAL + ******************************************************************************* + * Filename : usbUhcdSupport.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : This file contains the constants and function prototypes + * which are used for accessing the registers. + * + * + */ + +#ifndef __INCusbUhciSupporth +#define __INCusbUhciSupporth + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "usbOsal.h" +#include "usbUhcdScheduleQueue.h" + +/* defines */ + + +#define USB_UHCD_DWORD_OUT( INDEX, ADDRESS, VALUE) \ + usbPciDwordOut(ADDRESS, VALUE) + +#define USB_UHCD_DWORD_IN(p) \ + usbPciDwordIn(p) + +#define USB_UHCD_WRITE_WORD(address, data2Byte) \ + usbPciWordOut(address, data2Byte) + +#define USB_UHCD_READ_WORD(address) \ + usbPciWordIn(address) + + +/* Interrupt status values */ + +#define USB_UHCD_COMPLETION_INT 0x01 +#define USB_UHCD_TRANSACTION_ERR 0x02 +#define USB_UHCD_TRANSACTION_ERR_IOC 0x03 +#define USB_UHCD_RESUME_DETECT 0x04 +#define USB_UHCD_HST_SYSTEM_ERR 0x08 +#define USB_UHCD_HC_PROCESS_ERR 0x10 +#define USB_UHCD_HC_HALTED 0x20 + + +#ifdef __USE_UHCD_MACRO__ + +#define usbUhcdUpdateReg USB_UHCD_UPDATE_REG + +#define usbUhcdRegxSetBit USB_UHCD_REG_SET_BIT + +#define usbUhcdRegxClearBit USB_UHCD_REG_CLEAR_BIT + +#define usbUhcdPortSetBit USB_UHCD_PORT_SET_BIT + +#define usbUhcdPortClearBitWriting1 USB_UHCD_PORT_CLEAR_BIT_WTITING_1 + +#define usbUhcdIsBitSet USB_UHCD_IS_BIT_SET + +#define usbUhcdIsBitReset USB_UHCD_IS_BIT_RESET + +#define usbUhcdGetBit USB_UHCD_GET_BIT + +#else + +/* function declarations */ + +/*************************************************************************** + * Function Name : usbUhcdHcreset + * Description : This function is used to reset the HC. + * Parameters : void. + * Return Type : N/A + */ + +extern void usbUhcdHcReset (PUHCD_DATA pHCDData); + +/*************************************************************************** + * Function Name : usbUhcdRegxSetBit + * Description : This function is used to set a bit of the UHCD's register. + * Parameters : usbUhcdRegBaseAddr IN Offset from the base address + * setBit IN Bit number which is to be set + * Return Type : N/A + */ + +extern void usbUhcdRegxSetBit (PUHCD_DATA pHCDData, + UINT8 usbUhcdRegBaseOffset, + UINT8 setBit); + +/*************************************************************************** + * Function Name : usbUhcdRegxClearBit + * Description : This function is used to clear a bit of the UHCD's + * register. + * Parameters : usbUhcdRegBaseAddr IN Offset from the base address + * clearBit IN Bit number which is to be cleared + * Return Type : N/A + */ + +extern void usbUhcdRegxClearBit (PUHCD_DATA pHCDData, + UINT8 usbUhcdRegBaseOffset, + UINT8 clearBit); + +/*************************************************************************** + * Function Name : usbUhcdPortSetBit + * Description : This function is used to set a bit of the UHCD's port + * register + * Parameters : usbUhcdRegBaseAddr IN Offset from the base address + * setBit IN Bit number which is to be set + * Return Type : N/A + */ + +extern void usbUhcdPortSetBit (PUHCD_DATA pHCDData, + UINT8 usbUhcdRegBaseOffset, + UINT8 setBit); + +/*************************************************************************** + * Function Name : usbUhcdPortClearBit + * Description : This function is used to clear a bit of the UHCD's port + * register. + * Parameters : usbUhcdRegBaseAddr IN Offset from the base address + * clearBit IN Bit number which is to be cleared + * Return Type : void + */ + +extern void usbUhcdPortClearBit (PUHCD_DATA pHCDData, + UINT8 usbUhcdRegBaseOffset, + UINT8 clearBit); + +/*************************************************************************** + * Function Name : usbUhcdIsBitSet + * Description : This function is used to check whether a bit is set + * in the UHCD's register. + * Parameters : usbUhcdRegBaseAddr IN Offset from the base address + * which_bit IN Bit number which is to be checked + * Return Type : BOOLEAN + * Returns + * TRUE - If bit is set. + * FALSE - If bit is not set. + */ + +extern BOOLEAN usbUhcdIsBitSet (PUHCD_DATA pHCDData, + UINT8 usbUhcdRegBaseOffset, + UINT8 whichBit); + +/*************************************************************************** + * Function Name : usbUhcdIsBitReset + * Description : This function is used to check whether a bit is + * reset in the UHCD's register + * Parameters : usbUhcdRegBaseAddr IN Offset from the base address + * which_bit IN Bit number which is to be checked + * Return Type : BOOLEAN + * Returns + * TRUE - If bit is reset + * FALSE - If bit is not reset + */ + +extern BOOLEAN usbUhcdIsBitReset (PUHCD_DATA pHCDData, + UINT8 usbUhcdRegBaseOffset, + UINT8 whichBit); + +/*************************************************************************** + * Function Name : usbUhcdGetBit + * Description : This function is used to get the bit value of the + * UHCD's register. + * Parameters : usbUhcdRegBaseAddr IN Offset from the base address + * which_bit IN Bit number whose value is to be + * retrieved. + * Return Type : UINT8 + * Returns the value at the bit specified + */ + +extern UINT8 usbUhcdGetBit (PUHCD_DATA pHCDData, + UINT8 usbUhcdRegBaseOffset, + UINT8 whichBit); + + +/******************************************************************************* + * Function Name : usbUhcdReadReg + * Description : This function is used to read a value from the UHCD's register. + * Parameters : pHCDData IN pointer to UHC Data Structure + * usbUhcdRegBaseOffse IN Offset from the base address + * Return Type : INT16 + * Global Variables : uhcUhcdUsbBase. + * Calls : UHCD_READ_WORD + * UHCD_WRITE_WORD + * Called by : None + * To Do : None + ******************************************************************************/ +extern INT16 usbUhcdReadReg(PUHCD_DATA pHCDData, UINT8 usbUhcdRegBaseOffset ); + + +/******************************************************************************* + * Function Name : usbUhcdIsBitSetReg + * Description : This function is used to check whether a bit is set + * of the given value. + * Parameters : regValue IN any Value + * whichBit IN Bit number which is to be checked + * Return Type : BOOLEAN + * Returns + * TRUE - If bit is set. + * FALSE - If bit is not set. + * Calls : None + * + * Called by : None + * To Do : None + ******************************************************************************/ + +/*************************************************************************** +* +* usbUhcdIsBitSetReg - check whether a bit is set of the UHCI's register +* +* RETURNS: TRUE, FALSE if bit is not set +*/ + +extern BOOLEAN usbUhcdIsBitSetReg(UINT16 regValue,UINT8 whichBit); + +#endif + +/*************************************************************************** +* +* usbUhciDelay - +* +* RETURNS: N/A +*/ +extern void usbUhciDelay(PUHCD_DATA pHCDData, + UINT16 uDelay); + +/*************************************************************************** +* +* Function Name : usbUhciLog2 +* Description : This function is used to calculate log to the base 2 +* +* Return Type : UINT32 +* Returns the log value to the base 2 +*/ +extern UINT32 usbUhciLog2(UINT32 value); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCusbUhcdSupporth */ + diff --git a/h/usb2/usbUhci.h b/h/usb2/usbUhci.h new file mode 100644 index 0000000..22da0de --- /dev/null +++ b/h/usb2/usbUhci.h @@ -0,0 +1,129 @@ +/* usbUhci.h - USB UHCD host controller header */ + +/* Copyright 2004-2005 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +Modification history +-------------------- +01g,28mar05,pdg non-PCI changes +01f,25feb05,mta SPR106276 +01e,18aug04,hch remove the DMA_MALLOC and DMA_FREE macro +01d,17aug04,pdg Fix for removing the dependency on OHCI while building the + project +01c,16jul04,hch add UHCI PCI class definition +01b,26jun03,amn changing the code to WRS standards. +01a,25apr03,ram written. +*/ + +/* +DESCRIPTION + +This file contains the constants of the USB UHCD host controller +*/ + +/* +INTERNAL + *************************************************************************** + * Filename : usbUhci.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * Description : This file contains the constants of the UHCD host + * controller + * + */ + +#ifndef __INCusbUhcih +#define __INCusbUhcih + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "usbOsal.h" +#include "usbHcdInstr.h" /* WindView Instrumentation */ +#include +#include "usb/pciConstants.h" + +/* defines */ + +/* UHCI PCI class definition */ + +#define UHCI_CLASS 0x0c /* BASEC value for serial bus */ +#define UHCI_SUBCLASS 0x03 /* SCC value for USB */ +#define UHCI_PGMIF 0x00 /* no specific pgm i/f defined */ + +#ifdef __DEBUG_ERROR__ +#define USB_UHCD_LOG_ERROR_MESSAGE(str) logMsg(str,0,0,0,0,0,0) +#else +#define USB_UHCD_LOG_ERROR_MESSAGE(str) +#endif + +extern pUSB_HCD_BUS_INFO pUhciBusInfo[]; + +/* index of the host controller device */ + +#define USB_UHCI_DEVICE_INDEX 00 + + +/* Number of maximum resources can be allocated.. */ +#define MAX_RESOURCE_ALLOCATED 0x0E + +#define UHCI_FREE(pBfr) OS_FREE((char *) pBfr) + +#define DMA_FLUSH(pBfr, bytes) CACHE_DMA_FLUSH (pBfr, bytes) +#define DMA_INVALIDATE(pBfr, bytes) CACHE_DMA_INVALIDATE (pBfr, bytes) + +#define USER_FLUSH(pBfr, bytes) CACHE_USER_FLUSH (pBfr, bytes) +#define USER_INVALIDATE(pBfr,bytes) CACHE_USER_INVALIDATE (pBfr, bytes) + +/* Non PCI support macros */ + +#define USB_UHCD_CONVERT_TO_BUS_MEM(INDEX, ADDRESS) \ + (((ADDRESS) == NULL) ? 0: \ + pUhciBusInfo[INDEX]->pFuncCpuToBus((pVOID)ADDRESS)) + +/* Macro used for converting the bus specific memory to CPU memory */ +#define USB_UHCD_CONVERT_FROM_BUS_MEM(INDEX ,ADDRESS) \ + (((ADDRESS) == 0) ? 0: \ + pUhciBusInfo[INDEX]->pFuncBusToCpu((UINT32)ADDRESS)) + +/* Macro used for swapping the 32 bit values */ + +#define USB_UHCD_SWAP_DATA(INDEX,VALUE) \ + (((pUhciBusInfo[INDEX]->pFuncDataSwap) == NULL) ? VALUE : \ + pUhciBusInfo[INDEX]->pFuncDataSwap(VALUE)) + +/* Macro used for swapping the contents of buffers */ + +#define USB_UHCD_SWAP_BUFDATA(INDEX,BUFFER,SIZE) \ + (((pUhciBusInfo[INDEX]->pFuncBufferSwap) == NULL) ? SIZE : \ + pUhciBusInfo[INDEX]->pFuncBufferSwap(BUFFER, SIZE)) + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCusbUhcih */ + + + diff --git a/h/usb2/usbd.h b/h/usb2/usbd.h new file mode 100644 index 0000000..d72f0bd --- /dev/null +++ b/h/usb2/usbd.h @@ -0,0 +1,707 @@ +/* usbd.h - USBD functional interface definition */ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +Modification history +-------------------- +01a,30may03,nrv Changing the code to WRS standards +*/ + +/* +DESCRIPTION + +This file contains the data structures for usbd module. +*/ + +/* +INTERNAL + ******************************************************************************* + * Filename : Usbd.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * Description : This file contains the data structures for usbd module. + * + ******************************************************************************/ + +#ifndef __USBD_H__ +#define __USBD_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Include Files */ +#include "usbOsal.h" +#include "usbHst.h" +#include "objLib.h" +#include "usbHcdInstr.h" + +/* To be removed - Start */ + +#define USBD_MAX_HCD_NUM 4 /* to hold the max # of host controllers */ +#define USBD_MAX_BUS_NUM 8 /* to hold the max # if bus in all the HCD */ +#define USBD_ADDRESS_MAP_SIZE (128/(8*sizeof(UINT8))) /* max # of devices */ +#define USBD_INVALID_CRC_VALUE 0 /* invalid CRC value for configuration */ +#define USBD_PARSE_AND_CREATE 0x01 /* used as flag to parse and create pipe */ +#define USBD_PARSE_ONLY 0x02 /* used as flag to parse only */ +#define CRC16_MASK 0xFFFF /* CRC16 info */ +#define CRC16_INITIAL_HOLD 0xFFFF /* CRC16 info */ +#define CRC16_GENERATOR_POLY 0x8005 /* 1000 0000 0000 0101b */ + +/*************************************************************************** +* +* USBD_INCREMENT_FUNCTIONAL_DEVICE_COUNT - Increment the functional +* device count +* +* This Macro is used to increment a functional device count on the +* specified bus . +* +* RETURNS: N/A +*/ +#define USBD_INCREMENT_FUNCTIONAL_DEVICE_COUNT(uBusIndex) \ +{ \ + /* Lock the bus before modifying functional count */ \ + OS_WAIT_FOR_EVENT((gUSBBusInfoList[(uBusIndex)].busOperationLock), \ + OS_WAIT_INFINITE); \ + \ + /* Increment the functional count of the bus */ \ + gUSBBusInfoList[(uBusIndex)].uFunctionalCount++; \ + \ + /* Release the lock */ \ + OS_RELEASE_EVENT(gUSBBusInfoList[(uBusIndex)].busOperationLock); \ +} + +/*************************************************************************** +* +* USBD_DECREMENT_FUNCTIONAL_DEVICE_COUNT - decrement a functional device +* count +* +* This Macro is used to decrement a functional device count on the +* specified bus . +* +* RETURNS: N/A +*/ +#define USBD_DECREMENT_FUNCTIONAL_DEVICE_COUNT(uBusIndex) \ +{ \ + /* Lock the bus before modifying functional count */ \ + OS_WAIT_FOR_EVENT((gUSBBusInfoList[(uBusIndex)].busOperationLock), \ + OS_WAIT_INFINITE); \ + /* Just to check the count is not zero */ \ + OS_ASSERT (gUSBBusInfoList[(uBusIndex)].uFunctionalCount != 0); \ + /* Decrement the functional count of the bus */ \ + gUSBBusInfoList[(uBusIndex)].uFunctionalCount--; \ + \ + /* Release the lock */ \ + OS_RELEASE_EVENT((gUSBBusInfoList[(uBusIndex)].busOperationLock)); \ +} + +/********************** STRUCTURES DEFINITION *********************************/ + +/* + * This structure is used to maintain the list of Class Drivers registered + * with USBD + */ +typedef struct usbd_device_driver_list + { + pUSBHST_DEVICE_DRIVER pDriver; /* pointer to driver */ + struct usbd_device_driver_list *pNextDriver; /* pointer to next driver */ + } USBD_DEVICE_DRIVER_LIST, *pUSBD_DEVICE_DRIVER_LIST; + + +/* Structure to hold the endpoint information */ +typedef struct usbd_endpoint_info + { + UINT8 uEndpointAddress; /* Address of the end Point */ + UINT32 hPipe; /* Ptr to pipe corresponding to the end point */ + } USBD_ENDPOINT_INFO, *pUSBD_ENDPOINT_INFO; + + +/* + * This structure is used to store the information about an interface required + * by a USB device. + */ +typedef struct usbd_interface_info + { + UINT8 uInterfaceNum; /* Interface number */ + UINT8 uAlternateSetting; /* Alt settting value for this interface */ + UINT8 uNumEndpoints; /* # of end points in the interface */ + UINT8 uInterfaceClass; /* Class code for the interface */ + UINT8 uInterfaceSubClass; /* Sub class ocde for the interface */ + UINT8 uInterfaceProtocol; /* protocol code for the interface */ + pUSBHST_DEVICE_DRIVER pDriver; /* Ptr to the DEVICE_DRIVER struct */ + void * pDriverData; /* Driver data specific to interface */ + pUSBD_ENDPOINT_INFO pEndpointInformation; /* Ptr to end point info */ + } USBD_INTERFACE_INFO, *pUSBD_INTERFACE_INFO; + + +/* This structure is used to store the information about a USB device */ +typedef struct usbd_device_info +{ + UINT32 hDevice; /* Handle to the device */ + UINT8 uDeviceSpeed; /* Speed of the device */ + UINT8 uDeviceAddress; /* Device addr on particular USB bus */ + UINT8 uBusIndex; /* Index of the bus in global bus list */ + UINT16 uHighSpeedHubInfo; /* Nearest high speed hub and port number + * info; used for split transfer to full/low + * speed devices. high byte holds high speed + * address, low byte is port number + */ + UINT32 hDefaultPipe; /* Ptr to pipe for end point 0 */ + UINT8 uDeviceClass; /* Class code of the device */ + UINT8 uDeviceSubClass; /* Sub class code of the device */ + UINT8 uDeviceProtocol; /* Protocol code of the device */ + UINT16 uVendorID; /* Vendor Id of the device */ + UINT16 uDeviceID; /* Device Id for device */ + UINT16 uBCDDevice; /* USB device release version binary coded decimal */ + pUSBHST_DEVICE_DRIVER pDriver; /* Store the driver data */ + void * pDriverData; /* Driver data specific to interface */ + UINT8 uInterfaceNumber; /* Interface # */ + UINT8 uInterfaceCount; /* # of interfaces supported */ + UCHAR *pCurrentConfiguration; /* Ptr to hold config of the device */ + UINT8 uNumConfigurations; /* # of possible configurations */ + UINT16 uConfigCRCValue; /* CRC Value */ + pUSBD_INTERFACE_INFO pInterfacesInfo; /* Info about interfaces */ + struct usbd_device_info *pNextUSBDeviceInfo; /* Ptr to next USB devinfo */ + + } USBD_DEVICE_INFO, *pUSBD_DEVICE_INFO; + + +/* + * To store the information about a bus and also to maintain a list of USB + * devices connected on the specific bus. + */ +typedef struct usbd_bus_info + { + UINT8 uDeviceAddressMap[USBD_ADDRESS_MAP_SIZE]; /* + * Device address map + * of devs on bus. + */ + UINT8 uRelativeBusIndex; /* rellative bus index in the host controller */ + UINT8 hcdIndex; /* Host controller driver index */ + UINT32 hDefaultPipe; /* Handle to the default pipe */ + UINT32 uFunctionalCount; /* Count of functional interfaces/devices */ + OS_EVENT_ID busOperationLock; /* Lock used while accessing list */ + pUSBD_DEVICE_INFO pUSBDeviceInfoList; /* info about devices connected */ + } USBD_BUS_INFO, *pUSBD_BUS_INFO; + + +/**************************** FUNCTIONS DECLARATION ***************************/ + +/******************************************************************************* + * Function Name : usbdMatchDriver + * Description : This function scans the driver list for the driver that + * can support the specified device. + * Parameters : bFlagVendorSpecific IN Flag TRUE if device is + * ClassSpecific; FALSE if + * VendorSpecific. + * uParam1 IN Deivce ID or Class Code + * uParam2 IN Vendor ID or Sub Class Code + * uParam3 IN USB revision number + * pDriver OUT Pointer to structure containing + * the matched device driver. + * hDeviceHandle if no driver is + * matched. + * Return Type : USBHST_INVALID_PARAMETER if Parameters are not valid. + * USBHST_SUCCESS if matching driver is found + * USBHST_FAILURE if no matching driver is found + ******************************************************************************/ +LOCAL USBHST_STATUS usbdMatchDriver + ( + BOOL bFlagVendorSpecific, + UINT16 uParam1, + UINT16 uParam2, + UINT16 uParam3, + pUSBHST_DEVICE_DRIVER *pDriver + ); + +/******************************************************************************* + * Function Name : USBD_FindDevices + * Description : This function scans the USB bus for the devices that can + * be supported for the specified class driver. The class + * driver is loaded for all the devices identified. + * Parameters : pDeviceDriverInfo IN Information about the class driver + * for which the devices are searched. + * Return Type : USBHST_INVALID_PARAMETER if Parameters are not valid. + * USBHST_SUCCESS if all supported device by this driver, + * if any, are added successfully. + ******************************************************************************/ +LOCAL USBHST_STATUS usbdFindDevices + ( + pUSBHST_DEVICE_DRIVER pDeviceDriverInfo + ); + +/******************************************************************************* + * Function Name : USBD_FindDriver + * Description : This function scans the driver list for the driver that + * can support the specified device. + * Parameters : pUSBDeviceInfo IN Information about the USB device + * for which the driver is searched. + * Return Type : USBHST_INVALID_PARAMETER if Parameters are not valid. + * USBHST_SUCCESS if Drivers for the specified device is + * searched and loaded, if found, successfully. + ******************************************************************************/ +LOCAL USBHST_STATUS usbdFindDriver + ( + pUSBD_DEVICE_INFO pUSBDeviceInfo + ); + +/******************************************************************************* + * Function Name : USBHST_NewDevice + * Description : This function handles a new device connection. The Hub + * Class Driver calls this function, when a device connection + * is detected. + * Parameters : uSpeed IN Speed of the device + * uBusIndex IN Index of bus on which the device is + * connected. + * hHighSpeedHub IN Handle to the nearest high speed hub for + * the device + * uHighSpeedHubPortNumber + * IN Port number of the nearest high speed hub + * for the device + * pDeviceHanle OUT Parameter to hold the device handle + * Return Type : USBHST_INVALID_PARAMETERS if Parameters are not valid. + * USBHST_INSUFFICIENT_RESOURCES Resources not sufficient. + * USBHST_INSUFFICIENT_MEMORY Memory insufficient. + * USBHST_FAILURE Operation is failed. + * USBHST_SUCCESS New device is created and set to + * address state successfully. + ******************************************************************************/ + +LOCAL USBHST_STATUS usbHstDeviceNew + ( + UINT8 uSpeed, + UINT8 uBusIndex, + UINT32 hHighSpeedHub, + UINT8 uHighSpeedHubPortNumber, + UINT32 *pDeviceHandle + ); + +/******************************************************************************* + * Function Name : USBHST_ConfigureDevice + * Description : This function loads the class driver for a newly connected + * device. + * Parameters : hDevice IN Handle to the device being configured. + * Return Type : USBHST_INVALID_PARAMETERS if Parameters are not valid. + * USBHST_INSUFFICIENT_MEMORY if Memory is insufficient. + * USBHST_FAILURE if Operation failed. + * USBHST_SUCCESS if Driver for device is loaded, if found. + ******************************************************************************/ +LOCAL USBHST_STATUS usbHstDeviceConfigure + ( + UINT32 hDevice + ); + +/******************************************************************************* + * Function Name : USBHST_RemoveDevice + * Description : This function will call the remove function of the driver + * for each of the interface in active configuration of the + * device, free the device address and remove the device + * from the corresponding bus. + * Parameters : hDevice IN Handle to the device to be removed. + * Return Type : None + ******************************************************************************/ +LOCAL VOID usbHstDeviceRemove + ( + UINT32 hDevice + ); + +/******************************************************************************* + * Function Name : USBHST_SuspendDevice + * Description : This function will be called by hub when a device is + * suspended. + * Parameters : hDevice IN Handle to the device to be suspended. + * Return Type : None + ******************************************************************************/ +LOCAL VOID usbHstDeviceSuspend + ( + UINT32 hDevice + ); + +/******************************************************************************* + * Function Name : USBHST_ResumeDevice + * Description : This function will be called by hub when the device resume + * Parameters : hDevice IN Handle to the device to be suspended. + * Return Type : None. + ******************************************************************************/ +LOCAL VOID usbHstDeviceResume + ( + UINT32 hDevice + ); + +/******************************************************************************* + * Function Name : USBD_LINK_DEVICE_INFO + * Description : This function is used to link specified device information + * to the specified bus. + * Parameters : uBusIndex IN Bus Index to which the device + * information is to be linked. + * pDeviceInfo IN Pointer to device Information. + * Return Type : None + ******************************************************************************/ +LOCAL void usbdLinkDeviceInfo + ( + UINT8 uBusIndex, + pUSBD_DEVICE_INFO pDeviceInfo + ); + +/******************************************************************************* + * Function Name : USBD_UNLINK_DEVICE_INFO + * Description : This function is used to unlink specified device + * information to the specified bus. + * Parameters : uBusIndex IN Bus Index to which device information + * is to be linked. + * pDeviceInfo IN Pointer to device Information. + * Return Type : None + ******************************************************************************/ +LOCAL void usbdUlinkDeviceInfo + ( + UINT8 uBusIndex, + pUSBD_DEVICE_INFO pDeviceInfo + ); + +/******************************************************************************* + * Function Name : USBD_GENERATE_DEVICE_HANDLE + * Description : This function is used to generate unique device handle + * for USB device on specified bus. + * Parameters : pHandle OUT Pointer to hold the generated handle. + * uBusIndex IN Bus Index. + * uDeviceAddress IN Address of the device. + * Return Type : None + ******************************************************************************/ +LOCAL void usbdGenerateDeviceHandle + ( + UINT32 * pHandle, + UINT8 uBusIndex, + UINT8 uDeviceAddress + ); + +/******************************************************************************* + * Function Name : USBD_TRANSLATE_DEVICE_HANDLE + * Description : This function is used to translate device handle + * to USB device information. . + * Parameters : uHandle IN Device handle to be translated. + * pDeviceInfo OUT Pointer to hold the translated device + * information. + * Return Type : None + ******************************************************************************/ +LOCAL void usbdTranslateDeviceHandle + ( + UINT32 uHandle, + pUSBD_DEVICE_INFO *pDeviceInfo + ); + +/******************************************************************************* + * Function Name : USBD_GetFreeAddress + * Description : This function returns the free address in the given bus. + * Parameters : uBusIndex IN Index of bus on which the device is + * connected. + * pAddress OUT Free address available. + * Return Type : USBHST_FAILURE if no free address is found + * USBHST_SUCCESS if free address is found + ******************************************************************************/ +LOCAL USBHST_STATUS usbdGetFreeAddress + ( + UINT8 uBusIndex, + UINT8 * pAddress + ); + + +/******************************************************************************* + * Function Name : USBD_ReserveAddress + * Description : This function reserves the specified address on the + * specified bus + * Parameters : uBusIndex IN Index of bus on which the device is + * connected. + * uAddress IN Address to be reserved. + * Return Type : USBHST_FAILURE if the address is not found + * USBHST_SUCCESS if free address is reserved. + ******************************************************************************/ +LOCAL USBHST_STATUS usbdReserveAddress + ( + UINT8 uBusIndex, + UINT8 uAddress + ); + +/******************************************************************************* + * Function Name : USBD_ReleaseAddress + * Description : This function releases the specified address on the + * specified bus. + * Parameters : uBusIndex IN Index of bus on which the device is + * connected. + * uAddress IN Address to be released + * Return Type : USBHST_FAILURE if the parameters are invalid or the + * address not found + * USBHST_SUCCESS if address is released + ******************************************************************************/ +LOCAL USBHST_STATUS usbdReleaseAddress + ( + UINT8 uBusIndex, + UINT8 uAddress + ); + + +/******************************************************************************* + * Function Name : USBD_SetAddress + * Description : This function is used to issue SetAddress USB + * Standard Request. + * Parameters : pDeviceInfo IN Pointer to USB Device info. + * Return Type : USBHST_INVALID_PARAMETERS if parameters are not valid. + * USBHST_INSUFFICIENT_MEMORY on insufficient resource. + * USBHST_TIMEOUT if request submitted to Host controller + * driver is timed out. + * USBHST_SUCCESS ifAddress of the device is set successfully + ******************************************************************************/ +LOCAL USBHST_STATUS usbdSetAddress + ( + pUSBD_DEVICE_INFO pDeviceInfo + ); + +/******************************************************************************* + * Function Name : USBD_ParseConfiguration + * Description : This function is used to parse the configuration + * and update the device info with interface info + * and endpoint info. + * Parameters : pDeviceInfo IN OUT Pointer to USB Device info. + * uParserFlag IN USBD_PARSE_ONLY: + * Parse without creating pipe + * USBD_PARSE_AND_CREATE + * Parse and create pipe + * Return Type : USBHST_INSUFFICIENT_MEMORY on insufficient resource. + * USBHST_FAILURE if all the interfaces are not found in the + * configuration. + * USBHST_SUCCESS if configuration is parsed and device info + * updated successfully. + ******************************************************************************/ +LOCAL USBHST_STATUS usbdParseConfiguration + ( + pUSBD_DEVICE_INFO pDeviceInfo, + UINT8 uParserFlag + ); + +/******************************************************************************* + * Function Name : USBD_GetInterfaceOffset + * Description : This function is used to parse the configuration + * and get the start of requested interface descriptor. + * Parameters : pConfigBuffer IN Pointer to configuration buffer. + * uInterfaceNum IN Interface number. + * uAltIndex IN Alternate setting index. + * pStartOffset OUT Pointer to hold the start + * offset. + * Return Type : USBHST_FAILURE if interface is not found in the + * configuration. + * USBHST_SUCCESS if interface is found. + ******************************************************************************/ +LOCAL USBHST_STATUS usbdGetInterfaceOffset + ( + UCHAR * pConfigBuffer, + UINT16 uInterfaceNum, + UINT16 uAltIndex, + UINT32 * pStartOffset + ); + +/******************************************************************************* + * Function Name : USBD_CreatePipeForInterface + * Description : This function is used to parse the interface descriptor + * create and update the endpoint info in device info. + * Parameters : pDeviceInfo IN OUT Pointer to USB Device info. + * pNewInterfaceDesc IN Pointer to start of the + * interface descriptor. + * uInterfaceNum IN Interface number. + * Return Type : USBHST_INSUFFICIENT_MEMORY on insufficient resource. + * USBHST_SUCCESS if pipe is created for all endpoints + * successfully. + ******************************************************************************/ +LOCAL USBHST_STATUS usbdCreatePipeForInterface + ( + pUSBD_DEVICE_INFO pDeviceInfo, + UCHAR * pNewInterfaceDesc, + UINT16 uInterfaceNum + ); + +/******************************************************************************* + * Function Name : USBD_ComputeCRC + * Description : This function is used to compute the 16-bit CRC value + * for the passed data buffer. + * Parameters : pBuffer IN Pointer to data buffer. + * uLength IN Number of bytes in buffer. + * Return Type : 16-bit CRC value for the data buffer. + * + ******************************************************************************/ +LOCAL UINT16 usbdComputeCRC + ( + UCHAR * pBuffer, + UINT16 uLength + ); + +/******************************************************************************* + * Function Name : USBD_ReverseHold16 + * Description : This function is used to reverse the 16-bit hold value. + * Parameters : uHold IN Hold value to be reversed. + * Return Type : 16-bit reversed value for the hold value. + ******************************************************************************/ +LOCAL UINT16 usbdReverseHold16 + ( + UINT16 uHold + ); + +/******************************************************************************* + * Function Name : USBD_ComputeCRCForByte + * Description : This function is used to compute 16-Bit CRC value for + * passed 8-bit data. + * Parameters : cData IN 8-Bit value. + * uHold IN 16-Bit initial hold value. + * Return Type : 16-bit reversed value for the 8-Bit data. + ******************************************************************************/ +LOCAL UINT16 usbdComputeCRCForByte + ( + UCHAR cData, + UINT16 uHold + ); + +/******************************************************************************* + * Function Name : USBD_IsValidEndpoint + * Description : This function is used to validate the endpoint descriptor. + * Parameters : pDeviceInfo IN pointer to the device info. + * pEndpointDesc IN Pointer to endpoint descriptor. + * Return Type : TRUE If the endpoint is valid. + * FALSE If the endpoint is invalid. + ******************************************************************************/ +LOCAL BOOL usbdIsValidEndpoint + ( + pUSBD_DEVICE_INFO pDeviceInfo, + pUSBHST_ENDPOINT_DESCRIPTOR pEndpointDesc + ); + +/******************************************************************************* + * Function Name : USBD_SubmitRequest + * Description : This function is used to submit a request to the HCD. + * Parameters : pDeviceInfo IN pointer to the device info. + * pEndpointDesc IN Pointer to endpoint descriptor. + * Return Type : TRUE If the endpoint is valid. + * FALSE If the endpoint is invalid. + ******************************************************************************/ + +LOCAL USBHST_STATUS usbdSubmitRequest (pUSBD_DEVICE_INFO pDeviceInfo, + UINT8 bmRequestType, + UINT8 bRequest, + UINT16 wValue, + UINT16 wIndex, + UINT32 * pwLength, + UCHAR * pBuffer); + + +/******************************************************************************* + * Function Name : USBHST_ClearTTRequest + * Description : This function is called by the Host controller driver to + * submit Clear TT request to the Hub class driver + * Parameters : hHCDriver IN Handle to HCD + * uRelBusIndex IN Relative Bus Index of the HCD + * hHighSpeedHubAddress IN Handle to the High speed hub + * uHighSpeedHubPortNumber IN Port number on the high speed hub + * wValue IN Contains additional information + * such as endpoint number,endpoint + * direction etc + * pContext IN HCD specific context + * Return Type : a) USBHST_FAILURE if unsuccessful + * b) USBHST_SUCCESS if request was successful + * c) USBHST_INVALID_PARAMETER if invalid parameters are passed + * Global Variables : + * Calls : + * + * Called by : None + * To Do : None + ******************************************************************************/ +LOCAL USBHST_STATUS usbHstClearTTRequest (UINT32 hHCDriver, + UINT8 uRelBusIndex, + UINT8 uHighSpeedHubAddress, + UINT8 uHighSpeedPortNumber, + UINT16 wValue, + void * pContext); + +/******************************************************************************* + * Function Name : USBHST_ClearTTComplete + * Description : This function is called by the Hub class driver to + * indicate completion of Clear TT request. + * Parameters : nStatus IN Status of the operation. + * hHighSpeedHub IN Handle to the High speed hub + * pContext IN HCD specific Context + * Return Type : a) USBHST_FAILURE if unsuccessful + * b) USBHST_SUCCESS if request was successful + * Global Variables : + * Calls : + * + * Called by : None + * To Do : None + ******************************************************************************/ +LOCAL USBHST_STATUS usbHstClearTTComplete (USBHST_STATUS nStatus, + UINT32 hHighSpeedHub, + void * pContext); + +/*******************************Reset************************************************ + * Function Name : USBHST_ResetTTRequest + * Description : This function is called by the Host controller driver to + * submit Reset TT request to the Hub class driver + * Parameters : hHCDriver IN Handle to HCD + * uRelBusIndex IN Relative Bus Index of the HCD + * hHighSpeedHubAddress IN Handle to the High speed hub + * uHighSpeedHubPortNumber IN Port number on the high speed hub + * pContext IN HCD specific context + * Return Type : a) USBHST_FAILURE if unsuccessful + * b) USBHST_SUCCESS if request was successful + * c) USBHST_INVALID_PARAMETER if invalid parameters are passed + * Global Variables : + * Calls : + * + * Called by : None + * To Do : None + ******************************************************************************/ +LOCAL USBHST_STATUS usbHstResetTTRequest (UINT32 hHCDriver, + UINT8 uRelBusIndex, + UINT8 uHighSpeedHubAddress, + UINT8 uHighSpeedPortNumber, + void * pContext); + +/******************************************************************************* + * Function Name : USBHST_ResetTTComplete + * Description : This function is called by the Hub class driver to + * indicate completion of Reset TT request. + * Parameters : nStatus IN Status of the operation. + * hHighSpeedHub IN Handle to the High speed hub + * pContext IN HCD specific context + * Return Type : a) USBHST_FAILURE if unsuccessful + * b) USBHST_SUCCESS if request was successful + * Global Variables : + * Calls : + * + * Called by : None + * To Do : None + ******************************************************************************/ +LOCAL USBHST_STATUS usbHstResetTTComplete (USBHST_STATUS nStatus, + UINT32 hHighSpeedHub, + void * pContext); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* End of __USBD_H__ */ +/**************************** End of file Usbd.h ******************************/ diff --git a/h/usb2/usbdMisc.h b/h/usb2/usbdMisc.h new file mode 100644 index 0000000..35fcfc1 --- /dev/null +++ b/h/usb2/usbdMisc.h @@ -0,0 +1,178 @@ +/* usbdMisc.h - USBD Miscellaneous Definitions */ + +/* Copyright 2004 Wind River Systems, Inc. + + This software includes software licensed to Wind River Systems, Inc. + by Wipro, Ltd. Wind River licensees may use this software according + to the terms of their Wind River license agreement(s) applicable to + this software. +*/ + +/* +Modification history +-------------------- +01a,17mar03,ssh written +*/ + +/* +DESCRIPTION + +This file contains the function prototypes, macros and structures +required for interfaces that provide user specific information +from USBD +*/ + + +/* +INTERNAL + ******************************************************************************* + * Filename : usbdMisc.h + * + * Copyright : + * + * THE COPYRIGHT IN THE CONTENTS OF THIS SOFTWARE VEST WITH WIPRO + * LIMITED A COMPANY INCORPORATED UNDER THE LAWS OF INDIA AND HAVING + * ITS REGISTERED OFFICE AT DODDAKANNELLI SARJAPUR ROAD BANGALORE + * 560 035. DISTRIBUTION OR COPYING OF THIS SOFTWARE BY + * ANY INDIVIDUAL OR ENTITY OTHER THAN THE ADDRESSEE IS STRICTLY + * PROHIBITED AND MAY INCUR LEGAL LIABILITY. IF YOU ARE NOT THE + * ADDRESSEE PLEASE NOTIFY US IMMEDIATELY BY PHONE OR BY RETURN EMAIL. + * THE ADDRESSEE IS ADVISED TO MAINTAIN THE PROPRIETARY INTERESTS OF + * THIS COPYRIGHT AS PER APPLICABLE LAWS. + * + * + * Description : This file contains the function prototypes, macros and + * structures required for interfaces that provide user + * specific information from USBD + * + * + ******************************************************************************/ + + #ifndef __INCusbdMisch + #define __INCusbdMisch + + +#ifdef __cplusplus +extern "C" { +#endif + +/******************************** GLOBAL FUNCTIONS ***************************/ + +/******************************************************************************* + * Function Name : usbdBusCntGet + * Description : This function is called by the Integration testing tool to + * obtain the number of USB's attached to the host. + * Parameters : Total number of buses(host controllers)on the system + * Return Type : UINT16 (bus count) + * Global Variables : gHCDriverList + * Calls : None + * Called by : Translation Unit + * To Do : None + ******************************************************************************/ +UINT16 usbdBusCntGet(void); + + /******************************************************************************* + * Function Name : usbdRootNodeIDGet + * Description : This function is called by the Integration testing tool to + * obtain the node id of the root hub on a Host Controller. + * Parameters : uBusIndex - Bus Index + * phRootHub - Pointer to the root hub handle + * Return Type : USBHST_SUCCESS - If successful + * USBHST_FAILURE - If unsuccessful + * USBHST_INVALID_PARAMETER - If invalid parameter was passed + * Global Variables : None + * Calls : None + * Called by : Translation Unit + * To Do : None + ******************************************************************************/ + USBHST_STATUS usbdRootNodeIDGet(UINT16 uBusIndex, + PUINT32 phRootHub); + +#if 0 +/*************************************************************************** +* +* usbdHubPortCntGet - Returns number of ports connected to a hub +* +* usbdHubPortCountGet() provides clients with a convenient mechanism to +* retrieve the number of downstream ports provided by the specified hub. +* Clients can also retrieve this information by retrieving configuration +* descriptors from the hub using the Configuration Functions describe in +* a following section. +* +* must be the Node Id for the desired USB hub. An error will be +* returned if does not refer to a hub. must point to +* a UINT16 variable in which the total number of ports on the specified +* hub will be stored. +* Return Type : USBHST_SUCCESS - If successful +* USBHST_FAILURE - If unsuccessful +* USBHST_INVALID_PARAMETER - If invalid parameter was passed +* +*/ + +USBHST_STATUS usbdHubPortCntGet + ( + UINT32 hubId, /* Node Id for desired hub */ + PUINT16 pPortCount /* bfr to receive port count */ + ); +/*************************************************************************** +* +* usbdNodeIDGet - Gets the id of the node connected to a hub port +* +* Clients use this function to retrieve the Node Id for devices attached to +* each of a hub’s ports. and identify the hub and port +* to which a device may be attached. must point to a UINT16 +* variable to receive a type code as follows: +* +* .IP "USB_NODETYPE_NONE" +* No device is attached to the specified port. +* .IP "USB_NODETYPE_HUB" +* A hub is attached to the specified port. +* .IP "USB_NODETYPE_DEVICE" +* A device (non-hub) is attached to the specified port. +* +* If the node type is returned as USBD_NODE_TYPE_NONE, then a Node Id is +* not returned and the value returned in is undefined. If the +* node type indicates a hub or device is attached to the port, then +* will contain that hub or device’s nodeId upon return. +* +* RETURNS: OK, or ERROR if unable to get node ID. +*/ + +USBHST_STATUS usbdNodeIDGet + ( + UINT32 hubId, /* Node Id for desired hub */ + UINT16 portIndex, /* Port index */ + PUINT16 pNodeType, /* bfr to receive node type */ + PUINT32 pNodeId /* bfr to receive Node Id */ + ); + + + /******************************************************************************* + * Function Name : usbdFrameWindowGet + * Description : This function is called by the Integration testing tool to + * obtain the Frame Window and current frame number from HCD. + * Parameters : nodeId - Node ID of the device + * pFrameWindow - Pointer to frame information i.e,Max frame + * scheduling window and current frame number + * Return Type : USBHST_SUCCESS - If successful + * USBHST_FAILURE - If unsuccessful + * USBHST_INVALID_PARAMETER - If invalid parameter was passed + * Global Variables : g_pHCDriverList + * Calls : None + * Called by : None + * To Do : None + ******************************************************************************/ + +#endif + +USBHST_STATUS usbdFrameWindowGet(UINT32 nodeId, + PUINT16 pFrameWindow); + + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* End of #ifndef __INCusbdMisch */ + /**************************** End of usbdMisc.h ****************************/ diff --git a/h/usrConfig.h b/h/usrConfig.h new file mode 100644 index 0000000..8aa705a --- /dev/null +++ b/h/usrConfig.h @@ -0,0 +1,436 @@ +/* usrConfig.h - header file for usrConfig.c */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + + + +/* +modification history +-------------------- +04x,08sep05,dcc removed INCLUDE_TAPEFS component (SPR# 111788) +04w,25feb05,h_k included aimMmuLib.h and added prototype declaration for + usrAimMmuConfig(). (SPR #106193). +04v,23feb05,gls added wdb/wdbLib.h +04u,14feb05,dlk Remove include of ftpdLib.h. +04t,12oct04,kk updated kernelBaseLib.h to private/kernelBaseLibP.h +04s,29sep04,tam removed edrKHLib.h, added private/taskMemLibP.h +04r,24sep04,jn Make prototype of loadLibInit visible +04q,13sep04,kk renamed rtpBaseLib.h to kernelBaseLib.h +04p,09sep04,bpn Added shell commands init routines prototypes. +04s,24sep04,rfr Added #include +04r,23sep04,rfr Added transCbio.h +04q,23sep04,ann merge from networking: removed usrFtpInit. +04p,07sep04,jyo Fixing SPR 100119: Removing references to RT11. +04o,13jul04,p_r added SNS_SHOW info (SPR#99392) +04n,02jun04,bpn Added moduleShellCmdInit() and unloadShellCmdInit() prototypes. +04m,18may04,bpn Added usrRtpLibInit() prototype. +04l,18may04,bpn Added usrFsShellCmdInit() prototype. +04k,02apr04,jn Move loader related includes into usrConfig.c. +04j,29apr04,cjj Added includes for rtpBaseLib.h and isrLibP.h +04i,24feb04,jln remove smNetLib.h +04i,02mar04,pad Removed stray slash character at end of line (SPR 94513). +04h,05dec03,jn Remove references to a.out and coff +04g,03dec03,dat added dirent.h for POSIX_DIRLIB component +04f,02dec03,p_r added SAL headers +04e,17nov03,rp header file path update +04d,18nov03,bpn Added includes for shellConfigLib.h +04c,17nov03,yvp Added includes for rtpLibP.h and syscallLibP.h +04b,06oct03,dbs add EDR KH support +04a,26aug03,dbs added ED&R features +03z,24jul03,jeg added vxsim virtual disk support +03y,10apr03,pes PAL Coprocessor Abstraction +03x,15jul03,kam rebased to Base6 integration branch +03w,19may03,to added include of rtpLib.h, deleted K&R style prototypes. +03v,20feb03,jmp simulator code cleanup. +03u,20feb03,bpn Added ledLib header file. +03v,16aug02,ham guarded SM stuffs. +03u,13aug02,ham merged IPv6 version 01g,10jun02,rvr to Veloce. +03t,05mar02,mas updated to support new SM components (SPR 73371) +03s,22jan02,mas made smObjLib.h and smNetLib.h conditional inclusions +03r,21jan02,sn include cplusLib.h +03q,13nov01,yvp Added include for private/excLibP.h +03p,31oct01,gls merged in pthread code from AE +03o,04oct01,jkf added dosFs2 headers. +03n,14oct99,jk added conditional include for sound driver (sb16drv.h). +03m,01sep98,drm added extern for usrWindMPInit() +03l,18jun98,cjtc including header files to prevent compilation warnings for + WV2.0 (SPR 21494) +03s,04may98,cym fixed end and edata for SIMNT. +03r,27jan98,cth changed INCLUDE_INSTRUMENTATION to INCLUDE_WINDVIEW, + removed connLib.h +03p,21jan98,jmb removed end and edata for SIMNT (only when using Visual C) +03o,02jan98,cym removed end and edata for SIMNT. +03n,16nov97,cth removed includes of evtTsfsSockLibP.h and evtSockLibP.h +03m,21aug97,cth added conditional include of evtTsfsSockLibP.h +03l,18aug97,cdp added conditional declaration of thumbSymTblAdd(). +03k,07apr97,spm added support for unit numbers +03j,24feb97,gnn added conditional RIP includes +03i,27nov96,spm added conditional includes for DHCP client +03h,28dec96,ms added conditional include of tapeFs.h +03g,13dec96,elp changed syncLib.c into symSyncLib.c +03f,30oct96,elp Added syncLib.h. +03e,09aug96,dbt include all posix headers if INCLUDE_POSIX_ALL is defined + (SPR #5524). +03d,26jul96,hdn added a function declaration of usrAtaConfig(). +03c,20mar96,hdn made inclusion of pppLib.h conditional. +03b,15mar96,sgv made inclusion of strmLib.h conditional. +03a,22jun95,caf no longer need "_" for GHSxPPC. +02m,10oct95,dat removed #include "bspVersion.h" +02l,27jul95,dzb added strmLib.h inclusion. Added usrStrmInit(). +02k,25jul95,dzb added sockLib.h and bsdSockLib.h inclusion. +02j,09may95,ms prototype for WDB agent +02i,28mar95,kkk changed edata and end to arrays (SPR #3917) +02h,09jan95,dzb added prototype for PPP. +02h,22may95,yao add "_" to edata, end for PowerPC with Green Hills tool. +02g,25oct93,hdn added prototype for floppy and IDE driver. +02m,22feb94,elh added function defs for snmp. +02m,25jul94,jmm removed prototype of printConfig() (spr 3461) +02l,28jan94,dvs changed INCLUDE_POSIX_MM_MAN to INCLUDE_POSIX_MEM +02k,12jan94,kdl changed aio includes. +02j,10dec93,smb added include of seqDrvP.h for windview +02i,07dec93,dvs added #ifdef's around POSIX includes for component releases +02h,02dec93,dvs added includes for POSIX modules +02g,22nov93,dvs added include of sched.h +02f,23aug93,srh added include of private/cplusLibP.h. +02e,20oct92,pme added vxLib.h. +02d,22sep92,rrr added support for c++ +02c,21sep92,ajm fixes for lack of #elif support on mips +02b,20sep92,kdl added include of private/ftpLibP.h. +02a,18sep92,jcf major clean up. added prototypes and #includes. +01d,04jul92,jcf cleaned up. +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01a,05oct90,shl created. +*/ + +#ifndef __INCusrConfigh +#define __INCusrConfigh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef INCLUDE_AIM_MMU_SHOW +#include "aimMmuLib.h" +#endif /* INCLUDE_AIM_MMU_SHOW */ +#include "bootLib.h" +#include +#include "cacheLib.h" +#include "cplusLib.h" +#include "ctype.h" +#include "dbgLib.h" +#include "dosFsLib.h" +#if defined (_WRS_PAL_COPROC_LIB) +#include "coprocLib.h" +#endif /* _WRS_PAL_COPROC_LIB */ +#include "cbioLib.h" +#include "tarLib.h" +#include "transCbio.h" +#include "usrTransLib.h" +#include "dcacheCbio.h" +#include "dpartCbio.h" +#include "usrFdiskPartLib.h" +#include "ramDiskCbio.h" +#include "edrLib.h" +#include "envLib.h" +#include "errno.h" +#include "esf.h" +#include "fcntl.h" +#include "fioLib.h" +#include "fppLib.h" +#include +#include +#include +#include "hookLib.h" /* for hookLibInit() and hookShowInit() prototypes */ +#include "if_bp.h" +#include "if_sl.h" +#include +#include "intLib.h" +#include "ioLib.h" +#include "iosLib.h" +#include "iv.h" +#include "kernelLib.h" +#include "ledLib.h" +#include "loadLib.h" +#include "logLib.h" +#include "loginLib.h" +#include "math.h" +#include "memLib.h" +#include "mmuLib.h" +#include "msgQLib.h" +#include +#include +#include +#include "pmLib.h" +#include "pipeDrv.h" +#include "qLib.h" +#include "qPriBMapLib.h" +#include "ramDrv.h" +#include "rawFsLib.h" +#include "rebootLib.h" +#include +#include +#include "rpcLib.h" +#include "rtpLib.h" /* XXX tmp */ +#include "private/kernelBaseLibP.h" /* for kernelBaseInit() prototype */ +#include "scsiLib.h" +#include "selectLib.h" +#include "semLib.h" +#include "shellLib.h" +#include "shellInterpLib.h" +#include "shellConfigLib.h" +#include +#include "spyLib.h" +#include "stdio.h" +#include "string.h" +#include "symSyncLib.h" +#include "sysLib.h" +#include "sysSymTbl.h" +#include "taskHookLib.h" +#include "taskLib.h" +#include "taskVarLib.h" +#include +#include +#include +#include "tickLib.h" +#include "time.h" +#include "timers.h" +#include "timexLib.h" +#include "unistd.h" +#include "unldLib.h" +#include "usrLib.h" +#include "version.h" +#include "vxLib.h" +#include "wdLib.h" +#include +#include "rpc/rpcGbl.h" +#include "rpc/rpctypes.h" +#include "rpc/xdr.h" +#include "private/cplusLibP.h" +#include "private/excLibP.h" +#include +#include "private/isrLibP.h" /* for isrLibInit() and isrShowInit() prototypes */ +#include "private/kernelLibP.h" +#include "private/sigLibP.h" +#include "private/vmLibP.h" +#include "private/workQLibP.h" /* for workQInit() prototype */ +#include "wdb/wdbLib.h" + +#ifdef INCLUDE_SM_COMMON +#include "smLib.h" +#include "smUtilLib.h" +#endif /* INCLUDE_SM_COMMON */ + +#ifdef INCLUDE_SM_OBJ +#include "smObjLib.h" +#include "smDllLib.h" +#include "smMemLib.h" +#include "smNameLib.h" +#endif /* INCLUDE_SM_OBJ */ + +#ifdef INCLUDE_SM_NET +#include "smPktLib.h" +#endif /* INCLUDE_SM_NET */ + +#ifdef INCLUDE_PPP +#include "pppLib.h" +#endif /* INCLUDE_PPP */ + +#ifdef INCLUDE_RIP +#include +#endif /* INCLUDE_RIP */ + +#ifdef INCLUDE_VIRTUAL_DISK +#include "virtualDiskLib.h" +#endif /* INCLUDE_VIRTUAL_DISK */ + +#ifdef INCLUDE_POSIX_ALL + +#include "aio.h" /* INCLUDE_POSIX_AIO */ +#include "aioSysDrv.h" /* INCLUDE_POSIX_AIO_SYSDRV */ +#include "private/mqPxLibP.h" /* INCLUDE_POSIX_MQ */ +#include "mqPxShow.h" /* INCLUDE_SHOW_ROUTINES */ +#include "pthread.h" /* INCLUDE_POSIX_PTHREADS */ +#include "sched.h" /* INCLUDE_POSIX_SCHED */ +#include "private/semPxLibP.h" /* INCLUDE_POSIX_SEM */ +#include "semPxShow.h" /* INCLUDE_POSIX_SEM */ +#include "sys/mman.h" /* INCLUDE_POSIX_MEM */ +#include "dirent.h" /* INCLUDE_POSIX_DIRLIB */ + +#else /* INCLUDE_POSIX_ALL */ + +#ifdef INCLUDE_POSIX_AIO +#include "aio.h" +#ifdef INCLUDE_POSIX_AIO_SYSDRV +#include "aioSysDrv.h" +#endif /* INCLUDE_POSIX_AIO_SYSDRV */ +#endif /* INCLUDE_POSIX_AIO */ + +#ifdef INCLUDE_POSIX_MQ +#include "private/mqPxLibP.h" +#ifdef INCLUDE_SHOW_ROUTINES +#include "mqPxShow.h" +#endif /* INCLUDE_SHOW_ROUTINES */ +#endif /* INCLUDE_POSIX_MQ */ + +#ifdef INCLUDE_POSIX_PTHREADS +#include "pthread.h" +#endif /* INCLUDE_POSIX_PTHREADS */ + +#ifdef INCLUDE_POSIX_SCHED +#include "sched.h" +#endif /* INCLUDE_POSIX_SCHED */ + +#ifdef INCLUDE_POSIX_SEM +#include "private/semPxLibP.h" +#ifdef INCLUDE_SHOW_ROUTINES +#include "semPxShow.h" +#endif /* INCLUDE_SHOW_ROUTINES */ +#endif /* INCLUDE_POSIX_SEM */ + +#ifdef INCLUDE_POSIX_MEM +#include "sys/mman.h" +#endif /* INCLUDE_POSIX_MEM */ + +#ifdef INCLUDE_POSIX_DIRLIB +#include "dirent.h" +#endif + +#endif /* INCLUDE_POSIX_ALL */ + +#if defined(INCLUDE_SAL_CLIENT) +#include "dsi/salClient.h" +#endif /* INCLUDE_SAL_CLIENT */ + +#if defined(INCLUDE_SAL_SERVER) +#include "dsi/salServer.h" +#endif /* INCLUDE_SAL_SERVER */ + +#if defined(INCLUDE_SNS_SHOW) +#include "dsi/snsLib.h" +#endif /* INCLUDE_SNS_SHOW */ + +#if defined(INCLUDE_RBUFF) +#include "rBuffLib.h" +#endif /* INCLUDE_RBUFF */ + +#if defined(INCLUDE_WINDVIEW) +#include "wvLib.h" +#include "wvTmrLib.h" +#include "private/seqDrvP.h" +#endif /* INCLUDE_WINDVIEW */ + +#if defined(INCLUDE_TRIGGERING) +#include "private/trgLibP.h" +#endif /* INCLUDE_TRIGGERING */ + +#if defined(INCLUDE_SOUND) && defined(INCLUDE_SB16) +#include "drv/sound/sb16drv.h" +#endif /* INCLUDE_SOUND && INCLUDE_SB16 */ + +#ifdef INCLUDE_PCCARD +#include "drv/pccard/csLib.h" +#ifdef INCLUDE_PCCARD_SHOW +#include "drv/pccard/csShow.h" +#endif /* INCLUDE_PCCARD_SHOW */ +#endif /* INCLUDE_PCCARD */ + +#ifdef INCLUDE_RTP +#include "private/rtpLibP.h" +#include "private/syscallLibP.h" +#include "private/dbgRtpLibP.h" +#endif /* INCLUDE_RTP */ + +#if defined(INCLUDE_PROTECT_TASK_STACK) || \ + defined(INCLUDE_TASK_STACK_NO_EXEC) || \ + defined(INCLUDE_KERNEL_HARDENING) +#include "private/taskMemLibP.h" +#endif + +/* variable declarations */ + +extern char edata []; /* automatically defined by loader */ +extern char end []; /* automatically defined by loader */ + +/* function declarations */ + +extern void usrInit (int startType); +extern void usrRoot (char * pMemPoolStart, unsigned memPoolSize); +extern void usrClock (void); +extern STATUS usrScsiConfig (void); +extern STATUS usrFdConfig (int type, int drive, char * fileName); +extern STATUS usrIdeConfig (int drive, char * fileName); +extern STATUS usrAtaConfig (int ctrl, int drive, char * fileName); +extern void devSplit (char * fullFileName, char * devName); +extern STATUS usrNetInit (char * bootString); +extern STATUS checkInetAddrField (char * pInetAddr, BOOL subnetMaskOK); +extern STATUS netLoadSymTbl (void); +extern STATUS usrBootLineCrack (char * bootString, BOOT_PARAMS * pParams); +extern void usrBootLineInit (int startType); +extern STATUS usrBpInit (char * devName, int unitNum, u_long startAddr); +extern void usrDemo (void); +extern STATUS usrEdrInit (void); +extern STATUS usrNetIfAttach (char * devName, int unitNum, char * inetAdrs); +extern STATUS usrSlipInit (char * pBootDev, int unitNum, char * localAddr, + char * peerAddr); +extern STATUS usrPPPInit (char * pBootDev, int unitNum, char * localAddr, + char * peerAddr); + +#ifdef INCLUDE_SM_OBJ +extern STATUS usrSmObjInit (char * bootString); +#endif /* INCLUDE_SM_OBJ */ + +extern STATUS usrWindMPInit (char * bootString); +extern void usrStartupScript (char * fileName); +extern STATUS usrStrmInit (void); +extern STATUS usrNetIfConfig (char * devName, int unitNum, char * inetAdrs, + char * inetName, int netmask); +extern STATUS usrSnmpdInit (void); +extern STATUS usrMib2Init (void); +extern STATUS usrMib2CleanUp (void); +extern STATUS wdbConfig (void); + +#if (defined(INCLUDE_STANDALONE_SYM_TBL) && (CPU_FAMILY == ARM) && ARM_THUMB) +extern STATUS thumbSymTblAdd (SYMTAB_ID, SYMBOL *); +#endif +#ifdef INCLUDE_FTP +extern STATUS usrFtpInit (void); +#endif + +extern STATUS usrFsShellCmdInit (); +extern STATUS usrRtpLibInit (); + +#ifdef INCLUDE_LOADER +extern STATUS moduleShellCmdInit (void); +extern STATUS loadLibInit (BOOL storeAbsSyms); +#endif + +#ifdef INCLUDE_UNLOADER +extern STATUS unloadShellCmdInit (void); +#endif + +#ifdef INCLUDE_DEBUG +extern STATUS dbgShellCmdInit (void); +#endif + +extern STATUS symShellCmdInit (void); +extern STATUS taskShellCmdInit (void); + +#ifdef INCLUDE_AIM_MMU_CONFIG +extern void usrAimMmuConfig (void); +#endif /* INCLUDE_AIM_MMU_CONFIG */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusrConfigh */ diff --git a/h/usrFdiskPartLib.h b/h/usrFdiskPartLib.h new file mode 100644 index 0000000..1ce10e8 --- /dev/null +++ b/h/usrFdiskPartLib.h @@ -0,0 +1,81 @@ +/* usrFdiskPartLib.h - FDISK partition support header */ + +/* Copyright 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,20sep01,jkf written +*/ + +#ifndef __INCusrFdiskPartLibh +#define __INCusrFdiskPartLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "cbioLib.h" /* for CBIO_DEV_ID */ +#include "dpartCbio.h" /* for PART_TABLE_ENTRY */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS usrFdiskPartRead + ( + CBIO_DEV_ID cDev, /* device from which to read blocks */ + PART_TABLE_ENTRY *pPartTab, /* table where to fill results */ + int nPart /* # of entries in */ + ); + +extern STATUS usrFdiskPartCreate + ( + CBIO_DEV_ID cDev, /* device representing the entire disk */ + int nPart, /* how many partitions needed, default=1, max=4 */ + int size1, /* space percentage for second partition */ + int size2, /* space percentage for third partition */ + int size3 /* space percentage for fourth partition */ + ); + +#else + +STATUS usrFdiskPartRead (); +STATUS usrFdiskPartCreate (); + +#endif /* __STDC__ */ + +/* macro's */ + +/* partition table structure offsets */ + +#define PART_SIG_ADRS 0x1fe /* dos partition signature */ +#define PART_SIG_MSB 0x55 /* msb of the partition sig */ +#define PART_SIG_LSB 0xaa /* lsb of the partition sig */ +#define PART_IS_BOOTABLE 0x80 /* a dos bootable partition */ +#define PART_NOT_BOOTABLE 0x00 /* not a bootable partition */ +#define PART_TYPE_DOS4 0x06 /* dos 16b FAT, 32b secnum */ +#define PART_TYPE_DOSEXT 0x05 /* msdos extended partition */ +#define PART_TYPE_DOS3 0x04 /* dos 16b FAT, 16b secnum */ +#define PART_TYPE_DOS12 0x01 /* dos 12b FAT, 32b secnum */ +#define PART_TYPE_DOS32 0x0b /* dos 32b FAT, 32b secnum */ +#define PART_TYPE_DOS32X 0x0c /* dos 32b FAT, 32b secnum */ +#define PART_TYPE_WIN95_D4 0x0e /* Win95 dosfs 16bf 32bs */ +#define PART_TYPE_WIN95_EXT 0x0f /* Win95 extended partition */ + +#define BOOT_TYPE_OFFSET 0x0 /* boot type */ +#define STARTSEC_HD_OFFSET 0x1 /* beginning sector head value */ +#define STARTSEC_SEC_OFFSET 0x2 /* beginning sector */ +#define STARTSEC_CYL_OFFSET 0x3 /* beginning cylinder */ +#define SYSTYPE_OFFSET 0x4 /* system indicator */ +#define ENDSEC_HD_OFFSET 0x5 /* ending sector head value */ +#define ENDSEC_SEC_OFFSET 0x6 /* ending sector */ +#define ENDSEC_CYL_OFFSET 0x7 /* ending cylinder */ +#define NSECTORS_OFFSET 0x8 /* sector offset from reference */ +#define NSECTORS_TOTAL 0xc /* number of sectors in part */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusrFdiskPartLibh */ diff --git a/h/usrFsLib.h b/h/usrFsLib.h new file mode 100644 index 0000000..727bceb --- /dev/null +++ b/h/usrFsLib.h @@ -0,0 +1,54 @@ +/* usrFsLib.h - header for user file (io) interface subroutines */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + + +/* +modification history +-------------------- +01b,23aug05,pcm added hrfsDiskFormat() and dosfsDiskFormat() +01a,09apr04,dat written (from usrLib.h, ver 02j) +*/ + +#ifndef __INCusrFsLibh +#define __INCusrFsLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +IMPORT STATUS copy (const char *in, const char *out); +IMPORT STATUS copyStreams (int inFd, int outFd); +IMPORT STATUS diskFormat (const char *devName); +IMPORT STATUS diskInit (const char *devName); +IMPORT STATUS cd (const char *name); +IMPORT void pwd (void); +IMPORT STATUS chkdsk (const char * pDevName, u_int repairLevel, u_int verbose); +IMPORT STATUS ls (const char *dirName, BOOL doLong); +IMPORT STATUS ll (const char * dirName); +IMPORT STATUS lsr (const char * dirName); +IMPORT STATUS llr (const char * dirName); +IMPORT STATUS rm (const char *fileName); +IMPORT STATUS cp (const char * src, const char *dest); +IMPORT STATUS mv (const char * src, const char *dest); +IMPORT STATUS xcopy (const char * src, const char *dest); +IMPORT STATUS xdelete (const char * src); +IMPORT STATUS attrib (const char * fileName, const char * attr); +IMPORT STATUS xattrib (const char * fileName, const char * attr); +IMPORT STATUS dirList (int fd, const char * dirName, BOOL doLong, BOOL doTree); +IMPORT STATUS hrfsDiskFormat (const char * pDevName, int files); +IMPORT STATUS dosfsDiskFormat (const char * pDevName); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusrFsLibh */ diff --git a/h/usrLib.h b/h/usrLib.h new file mode 100644 index 0000000..92aa248 --- /dev/null +++ b/h/usrLib.h @@ -0,0 +1,145 @@ +/* usrLib.h - header for user interface subroutines */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02t,10nov04,dbt Added reld() prototype (SPR #103739). +02s,02oct04,bpn Exported sp() variables. +02r,18sep04,jn Move unld from unldLib to usrLib +02q,09sep04,bpn Added w() and tw() prototypes. +02p,03aug04,bpn Added shConfig() prototype. +02o,18may04,bpn Moved function prototypes to usrLibP.h. +02n,07apr04,bpn Changed shStrFree() to strFree(). +02m,01apr04,bpn Added showCoreRtn() prototype. +02l,12mar04,bpn Added shStrFree() prototype. +02k,09apr04,dat mv usrFsLib stuff to separate header +02j,22sep03,bpn Cleaned up. Added usrFsShellCmdInit() prototype. +02i,09may03,pes PAL conditional compilation cleanup. Phase 2. +02h,17oct01,jkf added prototypes for usrFsLib.c functions, SPR#74904 +02g,24sep01,jkf added const to prototypes cd(), rm(), disk*(), copy(). +02f,27may95,p_m added spy routines prototypes. +02e,22sep92,rrr added support for c++ +02d,18sep92,smb moved mkdir and rmdir prototype to sys/stat.h and + unistd.h repecatively and included sys/stat.h and unistd.h +02c,29jul92,smb changed parameter to printErrno from errno to errNo. +02b,15jul92,jmm changed ld() to return MODULE_ID rather than STATUS +02a,04jul92,jcf cleaned up. +01v,25jun92,yao added ANSI definition for pc(). +01u,16jun92,yao changed declaration for mRegs(). +01t,26may92,rrr the tree shuffle +01s,20jan92,yao removed ANSI definition for register displaying routines. + removed conditional CPU_FAMILY != I960. changed ANSI + propotype definition for d(), m() and mRegs(). +01r,09jan92,jwt converted CPU==SPARC to CPU_FAMILY==SPARC. +01q,07nov91,hdn added defines F0 - F15, FPMCR, FPSR, FPQR for G200. +01p,07nov91,wmd conditionalized declaration of d() with BYTE_ORDER. +01o,29oct91,shl removed duplicate rename() prototype -- SPR #927. +01n,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01m,20aug91,ajm added MIPS_R3k support. +01l,14aug91,del (intel) added FPx regs for I960KB support. +01k,29apr91,hdn added defines and macros for TRON architecture. +01j,03feb90,del added I960 support. +01i,05oct90,dnw deleted private functions. + changed spawn, etc, to take var args. +01h,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01g,20aug89,gae changed ifdef to CPU_FAMILY. +01f,16jul88,ecs added SPARC register codes. +01e,24dec86,gae changed stsLib.h to vwModNum.h. +01d,20aug86,llk added register codes. +01c,10feb86,dnw deleted obsolete definition of S_usrLib_NO_FREE_TID. +01b,13aug84,dnw changed name to usrLib. +01a,06aug84,ecs written +*/ + +#ifndef __INCusrLibh +#define __INCusrLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "regs.h" +#include "fppLib.h" +#include "moduleLib.h" +#include "sys/stat.h" +#include "usrFsLib.h" + +#if !defined _WRS_TASK_REG_WIDTH +#define _WRS_TASK_REG_WIDTH 4 +#endif /* _WRS_TASK_REG_WIDTH */ + +#if !defined _WRS_FPCTL_REG_WIDTH +#define _WRS_FPCTL_REG_WIDTH 4 +#endif /* _WRS_FPCTL_REG_WIDTH */ + +/* usrLib status codes */ + +#define S_usrLib_NOT_ENOUGH_ARGS (M_usrLib | 1) + +/* Global variables */ + +extern int spTaskPriority; +extern int spTaskOptions; +extern int spTaskStackSize; + +/* Function declarations */ + +extern void help (void); +extern void netHelp (void); +extern void tw (int taskNameOrId); +extern void w (int taskNameOrId); +extern void shConfig (const char * config); +extern void strFree (char * string); +extern void bootChange (void); +extern void periodRun (int sec,FUNCPTR rtn,int,int,int,int,int,int,int,int); +extern int period (int secs, FUNCPTR func,int,int,int,int,int,int,int,int); +extern void repeatRun (int n, FUNCPTR func,int,int,int,int,int,int,int,int); +extern int repeat (int n, FUNCPTR func, int,int,int,int,int,int,int,int); +extern int sp (FUNCPTR func, int,int,int,int,int,int,int,int,int); +extern int taskIdFigure (int taskNameOrId); +extern void checkStack (int taskNameOrId); +extern void i (int taskNameOrId); +extern void ts (int taskNameOrId); +extern void tr (int taskNameOrId); +extern void td (int taskNameOrId); +extern void ti (int taskNameOrId); +extern void version (void); +extern void m (void *adrs, int width); +extern void d (void *adrs, int nwords, int width); +extern STATUS squeeze (char *devName); +extern MODULE_ID ld (int syms, BOOL noAbort, char *name); +extern STATUS lsOld (char *dirName); +extern void devs (void); +extern void lkup (char *substr); +extern void lkAddr (unsigned int addr); +extern STATUS mRegs (char *regName, int taskNameOrId); +extern void printErrno (int errNo); +extern void printLogo (void); +extern void logout (void); +extern void h (int size); +extern int pc (int task); +extern void show (int objId, int level); +extern STATUS spyClkStart (int intsPerSec); +extern void spyClkStop (void); +extern void spy (int freq, int ticksPerSec); +extern void spyStop (void); +extern void spyHelp (void); +extern void spyReport (void); +extern void spyTask (int freq); +extern STATUS unld (void *name, int options); +extern MODULE_ID reld (void * nameOrId, int options); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusrLibh */ diff --git a/h/usrTransLib.h b/h/usrTransLib.h new file mode 100644 index 0000000..eba2389 --- /dev/null +++ b/h/usrTransLib.h @@ -0,0 +1,49 @@ +/* usrTransLib.h - Access library for transCbio */ + +/* + * Copyright 2004 - 2005 - Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01c,26aug05,jlk modified usrTransCommit to take a path instead of an XBD +01b,20jun05,act transaction CBIO device is now a transaction XBD +01a,05oct04,rfr Removed unnecessary parameter "blkshift" from + usrFormatTrans() +*/ + +#ifndef __INCusrTransLibh +#define __INCusrTransLibh + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern STATUS usrFormatTrans + ( + char *dev, /* Reference to the cbioTrans we are going to format */ + int overhead, /* Maximum size of uncommitted transactions */ + int type /* 0 = FORMAT_REGULAR, 1 = FORMAT_TFFS */ + ); + +extern STATUS usrTransCommit + ( + char *volume /* path for the trans XBD to commit */ + ); + +extern STATUS usrTransCommitFd + ( + int fd /* File descriptor referencing the F/S to commit */ + ); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/h/utfLib.h b/h/utfLib.h new file mode 100644 index 0000000..7bc519a --- /dev/null +++ b/h/utfLib.h @@ -0,0 +1,79 @@ +/* utfLib.h - Unicode encoding library header file */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +#ifndef __INCutfLib +#define __INCutfLib + +#ifdef __cplusplus +extern "C" { +#endif + +/* Constants */ +#define UTF16_TO_8_MULT 3 /* UTF-16 string of length N (2N bytes long) + can require up to 3N bytes in UTF-8 format, + always not including terminating '\0's */ + +/* Error Codes */ + +#define UC_BUFFER -1 /* Target buffer cannot hold result */ +#define UC_FORMAT -2 /* Source is in illegal format */ +#define UC_NOSRC -3 /* Insufficient source for legal conversion */ + +int utf8ToCP( + const unsigned char *utf8, + const int length, + unsigned long *codePoint); + +int utf16ToCP( + const unsigned short *utf16, + const int length, /* Length is in shorts */ + const int littleEndian, + unsigned long *codePoint); + +int CPToUtf8( + const unsigned long codePoint, + unsigned char *utf8, + const int length); + +int CPToUtf16( + const unsigned long codePoint, + unsigned short *utf16, + const int length, /* Length is in shorts */ + const int littleEndian); + + +int utflen8(const unsigned char *utf8); + +int utflen16(const unsigned short *utf16); + +int proofUtf8String(const unsigned char *utf8); + +int utf8ToUtf16String( + const unsigned char *utf8, + unsigned short *utf16, + const int len16, + int littleEndian); + +int utf16ToUtf8String( + const unsigned short *utf16, + int littleEndian, + unsigned char *utf8, + const int len8); + +int utf8ToUtf16StringBOM( + const unsigned char *utf8, + unsigned short *utf16, + const int len16, + int littleEndian); + +int utf16ToUtf8StringBOM( + const unsigned short *utf16, + unsigned char *utf8, + const int len8); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/utime.h b/h/utime.h new file mode 100644 index 0000000..1afe46b --- /dev/null +++ b/h/utime.h @@ -0,0 +1,30 @@ +/* utime.h - POSIX file time modification */ + +/* +modification history +-------------------- +01a,07nov03,dat started history, added const to utime args, removed + old style declaration. +*/ + + +#ifndef __INCutimeh +#define __INCutimeh + +#ifdef __cplusplus +extern "C" { +#endif + +struct utimbuf + { + time_t actime; /* set the access time */ + time_t modtime; /* set the modification time */ + }; + +extern int utime (const char * file, const struct utimbuf * newTimes); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdosFsLibh */ diff --git a/h/version.h b/h/version.h new file mode 100644 index 0000000..daa18de --- /dev/null +++ b/h/version.h @@ -0,0 +1,93 @@ +/* version.h - VxWorks version information */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +03p,28sep05,tam removed RDR from version string +03o,01sep05,pad Moved #ifdef _WRS_KERNEL pragma lower in the file so as to + allow for the build of the host-side part of vxsim. +03n,24aug05,pad this file is now shared between kernel and user sides + (SPR #105066) but only the _WRS_VXWORKS_xxx macros are visible + on the user side. +03m,11aug05,kkz Updating version strings for 6.2 +03l,12may05,tam changed RUNTIME_VERSION to 6.1 +03k,22apr05,tam changed RUNTIME_VERSION to 6.1 - Reference Design Release +03j,17feb05,tam changed RUNTIME_VERSION to 6.1 - Early Access Release +03i,18oct04,dbt change RUNTIME_VERSION to 6.0. +03h,11may04,md add global variables for VxWorks version numbers +03g,05may04,dat move version number macros from vxWorks.c to version.h, + change version to 'Beta' +03f,16mar04,rhe Change RUNTIME_VERSION to 6.0 - Technology Access Release 2 +03e,12dec03,dat change release to 6.0, TAR version 1, added a space to + VXWORKS_VERSION between the name and the version. +03d,05oct03,kk change release to 5.5 (BASE 6 - Iter 2) +03c,02jul03,job change release to 5.5 (BASE 6 - Iter 1) +03c,25mar03,sfp update for CP-1 release: VxWorks 5.5.1 +03b,12sep01,fmk change release to 5.5 +03a,17jan01,sn simplify job of host val +03a,08dec00,cmf changed release to 5.4.2 +02z,08jul98,ms changed release to 5.4. +02y,02oct96,p_m changed release to 5.3.1. + removed pre 02r history. +02x,15mar96,p_m changed release to 5.3 for everything except 960 K. +02w,06mar96,dat removed length macros, no longer needed +02v,23jan96,tpr changed release to 5.3-PowerPC-beta +02t,06jun95,caf changed release to 5.2-PowerPC-beta. +02u,25oct95,ms changed release to 5.3 +02t,21jun95,ms changed release to 5.3-beta +02s,29mar95,kdl changed release to 5.2. +02r,12nov94,dvs changed release to 5.2-beta +*/ + +#ifndef __INCversionh +#define __INCversionh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Release identification, major, minor, and maintenance numbers. + * + * Current VxWorks release number is 6.2.0 + */ + +#define _WRS_VXWORKS_MAJOR 6 +#define _WRS_VXWORKS_MINOR 2 +#define _WRS_VXWORKS_MAINT 0 + +/* For printLogo(), the max combined length is 44 characters */ + +#define RUNTIME_NAME "VxWorks" +#define RUNTIME_VERSION "6.2" + +/* there is now a space between the runtime name, and the version */ + +#define VXWORKS_VERSION RUNTIME_NAME " " RUNTIME_VERSION + +#ifdef _WRS_KERNEL +#ifndef _ASMLANGUAGE +IMPORT char * creationDate; +IMPORT char * runtimeVersion; +IMPORT char * runtimeName; +IMPORT char * vxWorksVersion; + +IMPORT const unsigned int vxWorksVersionMajor; +IMPORT const unsigned int vxWorksVersionMinor; +IMPORT const unsigned int vxWorksVersionMaint; +#endif +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCversionh */ diff --git a/h/virtualDiskLib.h b/h/virtualDiskLib.h new file mode 100644 index 0000000..a6a99c8 --- /dev/null +++ b/h/virtualDiskLib.h @@ -0,0 +1,40 @@ +/* virtualDiskLib.h - VxSim virtual disk driver header */ + +/* Copyright 2003 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01b,16oct03,jeg added virtualDiskClose () prototype. +01a,22jun03,jeg written +*/ + +#ifndef __INCvirtualDiskLibh +#define __INCvirtualDiskLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "blkIo.h" +#include "private/virtualDiskLibP.h" + +/* defines */ + +#define DEFAULT_SIZE 512 /* default parameters value */ +#define BLOCKSIZE 8192 /* default block size */ +#define DEFAULT_DISK_SIZE (1024*1024) /* default disk size */ + +/* function declarations */ + +extern BLK_DEV * virtualDiskCreate (char * hostFile, int bytesPerBlk, + int blksPerTrack, int nBlocks); +extern STATUS virtualDiskInit (void); +extern STATUS virtualDiskClose (BLK_DEV * blkDev); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvirtualDiskLibh */ diff --git a/h/vmLib.h b/h/vmLib.h new file mode 100644 index 0000000..26e67b8 --- /dev/null +++ b/h/vmLib.h @@ -0,0 +1,227 @@ +/* vmLib.h - header for architecture independent mmu interface */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +02j,11aug05,zl move init routines to future non-public section. +02i,15apr05,zl added S_vmLib_FUNCTION_UNSUPPORTED. +02h,07feb05,zl removed inclusion of private header files +02g,22oct04,pch SPR 102912: add #ifndef _ASMLANGUAGE +02f,14oct04,pcs Change VM_STATE_GUARDED_NOT & VM_STATE_MEM_COHERENCY_NOT from + MMU_ATTR_CACHE_DEFAULT to 0. +02e,30sep04,rlg undo false checkin - return cache state bits to proper + settings +02d,12oct04,pcs Remove protectSemId from struct vm_context, since it is not + being used. +02c,29sep04,pcs Change VM_STATE_CACHEABLE,VM_STATE_MEM_COHERANCY_NOT & + VM_STATE_GUARDED_NOT from MMU_ATTR_CACHE_COPYBACK to + VM_ATTR_CACHE_DEFAULT. +02b,11jun04,pcs Rename MMU_ATTR_CACHE_IO to MMU_ATTR_CACHE_GUARDED. +02a,11may04,tam added S_vmLib_KERNEL_TEXT_NOT_ALIGNED +01z,03may04,pcs Add prototypes for optimize/lock/unlock . +01y,17dec03,zmm Change VM_STATE_WBACK definitions. +01x,26sep03,scm fix for vmLib prototypes... +01w,17sep03,scm x-bit support... +01v,04sep03,pcs Add SEM_ID protectSemId; to struct vm_context. +01u,09jul03,pcs change physicalAddr to type PHYS_ADDR from void * +01t,08may03,pes PAL conditional compilation cleanup. Phase 2. +01s,14mar03,dcc moved VM_CONTEXT_ID definition to types/vxWind.h +01r,26jul01,scm add extended small page table support for XScale... +01q,13nov98,jpd added vmMpuLib routine definitions and new error numbers. +01p,09apr98,hdn added support for Pentium and PentiumPro. +01o,09mar98,jpd added extra ARM VM_STATEs. +01n,28nov96,jpd added comment about VM_STATE_CACHEABLE_WRITETHROUGH for + ARM710A as well as MC68040. +01m,01jan96,tpr changed value of the PPC specific macro. +01l,18sep95,tpr added VM_STATE_MASK_MEM_COHERENCY, VM_STATE_MASK_GUARDED, + VM_STATE_MASK_GUARDED and VM_STATE_MASK_EXECUTE for powerPc. +01k,26jul94,tpr added VM_STATE_CACHEABLE_NOT_IMPRECISE for MC68060. +01j,09feb93,rdc added prototypes for vmBaseStateSet and vmBasePageSizeGet; +01i,19oct92,pme replaced _STDC__ by __STDC__. +01h,19oct92,jcf cleanup. added vmContextDelete() prototype. +01g,22sep92,rrr added support for c++ +01f,22sep92,rdc changed prototype for vmGlobalInfoGet. + Added prototype for vmPageBlockSizeGet. + Added support for sun1e. +01e,30jul92,rdc added prototype for vmContextShow. +01d,28jul92,rdc added non-ansi function prototypes and prototypes for + vmBaseLib.c and vmShow.c. +01c,13jul92,rdc moved private data structures to vmLibP.h. +01b,09jul92,rdc added VM_LIB_INFO and PHYS_MEM_DESC. +01a,08jul92,rdc written. +*/ + +#ifndef __INCvmLibh +#define __INCvmLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +/* status codes */ + +#define S_vmLib_NOT_PAGE_ALIGNED (M_vmLib | 1) +#define S_vmLib_BAD_STATE_PARAM (M_vmLib | 2) +#define S_vmLib_BAD_MASK_PARAM (M_vmLib | 3) +#define S_vmLib_ADDR_IN_GLOBAL_SPACE (M_vmLib | 4) +#define S_vmLib_TEXT_PROTECTION_UNAVAILABLE (M_vmLib | 5) +#define S_vmLib_KERNEL_TEXT_NOT_ALIGNED (M_vmLib | 6) +#define S_vmLib_FUNCTION_UNSUPPORTED (M_vmLib | 7) + +/* + * The VM_STATE_XXX macros have been redefined to use the MMU_ATTR_XXX + * macros defined in vmLibCommon.h; use of the VM_STATE_XXX macros should + * be avoided. + */ + +#define VM_STATE_MASK_VALID MMU_ATTR_VALID_MSK +#define VM_STATE_MASK_WRITABLE MMU_ATTR_PROT_MSK +#define VM_STATE_MASK_CACHEABLE MMU_ATTR_CACHE_MSK + +#define VM_STATE_VALID MMU_ATTR_VALID +#define VM_STATE_VALID_NOT MMU_ATTR_VALID_NOT +#define VM_STATE_WRITABLE MMU_ATTR_SUP_RWX +#define VM_STATE_WRITABLE_NOT (MMU_ATTR_PROT_SUP_READ | \ + MMU_ATTR_PROT_SUP_EXE) +#define VM_STATE_CACHEABLE MMU_ATTR_CACHE_DEFAULT +#define VM_STATE_CACHEABLE_NOT MMU_ATTR_CACHE_OFF +#define VM_STATE_CACHEABLE_WRITETHROUGH MMU_ATTR_CACHE_WRITETHRU + +/* additional cache states for PowerPC arch. */ + +#define VM_STATE_MASK_MEM_COHERENCY MMU_ATTR_CACHE_MSK +#define VM_STATE_MEM_COHERENCY MMU_ATTR_CACHE_COHERENCY +#define VM_STATE_MEM_COHERENCY_NOT 0 + +#define VM_STATE_MASK_GUARDED MMU_ATTR_CACHE_MSK +#define VM_STATE_GUARDED MMU_ATTR_CACHE_GUARDED +#define VM_STATE_GUARDED_NOT 0 + + +/* additional cache states for i86 arch */ + +#define VM_STATE_WBACK MMU_ATTR_CACHE_COPYBACK +#define VM_STATE_WBACK_NOT MMU_ATTR_CACHE_WRITETHRU + +#define VM_STATE_MASK_WBACK VM_STATE_MASK_MEM_COHERENCY +#define VM_STATE_MASK_GLOBAL MMU_ATTR_SPL_MSK +#define VM_STATE_GLOBAL MMU_ATTR_SPL_0 +#define VM_STATE_GLOBAL_NOT 0 + + +/* additional cache states for ARM/XScale arch. */ + +#define VM_STATE_MASK_BUFFERABLE (MMU_ATTR_CACHE_MSK | MMU_ATTR_SPL_MSK) +#define VM_STATE_BUFFERABLE (MMU_ATTR_SPL_0) +#define VM_STATE_BUFFERABLE_NOT 0x00 + +#if (CPU == XSCALE) + +#define VM_STATE_MASK_EX_CACHEABLE (MMU_ATTR_CACHE_MSK | MMU_ATTR_SPL_MSK) +#define VM_STATE_NO_COALESCE (MMU_ATTR_SPL_2 | MMU_ATTR_CACHE_OFF) +#define VM_STATE_WRITEALLOCATE (MMU_ATTR_SPL_3 | MMU_ATTR_CACHE_COPYBACK) +#define VM_STATE_CACHEABLE_MINICACHE (MMU_ATTR_SPL_1) +#define VM_STATE_EX_CACHEABLE_NOT 0x00 + +/* backwards compatability for vxWorks 5.5 */ + +#define VM_STATE_MASK_EX_BUFFERABLE VM_STATE_MASK_EX_CACHEABLE +#define VM_STATE_EX_BUFFERABLE VM_STATE_NO_COALESCE +#define VM_STATE_EX_CACHEABLE VM_STATE_WRITEALLOCATE +#define VM_STATE_EX_BUFFERABLE_NOT VM_STATE_EX_CACHEABLE_NOT + +#else + +/* additional cache states for ARM SA-1100 */ + +#define VM_STATE_CACHEABLE_MINICACHE 0x30 + +#endif + + + +#ifndef _ASMLANGUAGE + +/* + * physical memory descriptor is used to map virtual memory in sysLib + * and usrConfig. + */ + +typedef struct phys_mem_desc + { + VIRT_ADDR virtualAddr; /* block virtual address */ + PHYS_ADDR physicalAddr; /* block physical address */ + UINT len; /* block length */ + UINT initialStateMask; /* mask parameter to vmStateSet */ + UINT initialState; /* state parameter to vmStateSet */ + } PHYS_MEM_DESC; + +IMPORT PHYS_MEM_DESC sysPhysMemDesc[]; +IMPORT int sysPhysMemDescNumEnt; + + + +/* function declarations */ + +extern STATUS vmStateSet (VM_CONTEXT_ID context, VIRT_ADDR pVirtual, + int len, UINT stateMask, UINT state); +extern STATUS vmStateGet (VM_CONTEXT_ID context, VIRT_ADDR pageAddr, + UINT *state); +extern STATUS vmMap (VM_CONTEXT_ID context, VIRT_ADDR virtualAddr, + PHYS_ADDR physicalAddr, UINT len); +extern STATUS vmTranslate (VM_CONTEXT_ID context, VIRT_ADDR virtualAddr, + PHYS_ADDR *physicalAddr); +extern STATUS vmPhysTranslate (VM_CONTEXT_ID context, PHYS_ADDR physicalAddr, + VIRT_ADDR *virtualAddr ); +extern int vmPageSizeGet (); +extern STATUS vmTextProtect (BOOL setState); +extern STATUS vmBufferWrite (VM_CONTEXT_ID vmCtx, VIRT_ADDR fromAddr, + VIRT_ADDR toAddr, UINT nbBytes); +extern STATUS vmPageOptimize (VM_CONTEXT_ID context, VIRT_ADDR virtualAddr, + UINT len, UINT option); +extern STATUS vmPageLock (VM_CONTEXT_ID context, VIRT_ADDR virtualAddr, + UINT len, UINT option); +extern STATUS vmPageUnlock (VM_CONTEXT_ID context, VIRT_ADDR virtualAddr); +extern STATUS vmContextShow (VM_CONTEXT_ID context); + + +/* APIs being deprecated */ + +extern VM_CONTEXT_ID vmBaseGlobalMapInit (PHYS_MEM_DESC * pMemDescArray, + int numDescArrayElements, + BOOL enable, int cacheDefault) + _WRS_DEPRECATED("Use vmGlobalMap instead"); +extern STATUS vmBaseStateSet (VM_CONTEXT_ID context, + VIRT_ADDR pVirtual, + int len, UINT stateMask, UINT state) + _WRS_DEPRECATED ("use vmStateSet instead") ; +extern int vmBasePageSizeGet (void) + _WRS_DEPRECATED("Use vmPageSizeGet instead"); + +/* APIs to become private */ + +extern VM_CONTEXT_ID vmGlobalMapInit (PHYS_MEM_DESC * pMemDescArray, + int numDescArrayElements, BOOL enable, + int cacheDefault); +extern STATUS vmBaseLibInit (int cacheDefault); + + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvmLibh */ diff --git a/h/vmLibCommon.h b/h/vmLibCommon.h new file mode 100644 index 0000000..b8d46b5 --- /dev/null +++ b/h/vmLibCommon.h @@ -0,0 +1,133 @@ +/* vmLibCommon.h - Virtual Memory Attribute Information */ + +/* + * Copyright (c) 1998-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01f,02sep05,pch add IS_VALID_CACHEABLE macro for SPR 110099 +01e,22oct04,pch SPR 102912: add #ifndef _ASMLANGUAGE +01d,13sep04,dtr Use SPL7 for NO_BLOCK attribute. +01c,10jun04,pcs Rename MMU_ATTR_CACHE_IO MMU_ATTR_CACHE_GUARDED +01b,14may04,pcs Add MMU_ATTR_SPL_[4-7]. +01a,28jan04,gls created from mmuAttr.h +*/ + +#ifndef __INCvmLibCommonh +#define __INCvmLibCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +/* defines */ + +#define MMU_ATTR_SUP_RO (MMU_ATTR_PROT_SUP_READ) +#define MMU_ATTR_SUP_RW (MMU_ATTR_PROT_SUP_READ | MMU_ATTR_PROT_SUP_WRITE) +#define MMU_ATTR_SUP_EXE (MMU_ATTR_PROT_SUP_READ | MMU_ATTR_PROT_SUP_EXE) +#define MMU_ATTR_SUP_RWX (MMU_ATTR_SUP_RW | MMU_ATTR_PROT_SUP_EXE) + +#define MMU_ATTR_USR_RO (MMU_ATTR_PROT_USR_READ) +#define MMU_ATTR_USR_RW (MMU_ATTR_PROT_USR_READ | MMU_ATTR_PROT_USR_WRITE) +#define MMU_ATTR_USR_EXE (MMU_ATTR_PROT_USR_READ | MMU_ATTR_PROT_USR_EXE) +#define MMU_ATTR_USR_RWX (MMU_ATTR_USR_RW | MMU_ATTR_PROT_USR_EXE) + +#define MMU_ATTR_SUP_TEXT (MMU_ATTR_SUP_EXE) +#define MMU_ATTR_SUP_TEXT_W (MMU_ATTR_SUP_RWX) +#define MMU_ATTR_SUP_DATA (MMU_ATTR_SUP_RW) +#define MMU_ATTR_SUP_DATA_RO (MMU_ATTR_SUP_RO) + +#define MMU_ATTR_USR_TEXT (MMU_ATTR_USR_EXE | MMU_ATTR_SUP_TEXT) +#define MMU_ATTR_USR_TEXT_W (MMU_ATTR_USR_RWX | MMU_ATTR_SUP_TEXT_W) +#define MMU_ATTR_USR_DATA (MMU_ATTR_USR_RW | MMU_ATTR_SUP_DATA) +#define MMU_ATTR_USR_DATA_RO (MMU_ATTR_USR_RO | MMU_ATTR_SUP_DATA_RO) + +#define MMU_ATTR_SUP_IO (MMU_ATTR_SUP_RW | MMU_ATTR_CACHE_IO) +#define MMU_ATTR_SUP_IO_RO (MMU_ATTR_SUP_RO | MMU_ATTR_CACHE_IO) +#define MMU_ATTR_USR_IO (MMU_ATTR_USR_RW | MMU_ATTR_SUP_IO) +#define MMU_ATTR_USR_IO_RO (MMU_ATTR_USR_RO | MMU_ATTR_SUP_IO_RO) + +/* Special attribute rename */ +#define MMU_ATTR_NO_BLOCK (MMU_ATTR_SPL_7) + +/* typedefs */ + +#ifdef _ASMLANGUAGE + +#define MMU_ATTR_PROT_MSK 0x0000003f /* Protection Mask */ +#define MMU_ATTR_PROT_SUP_READ 0x00000001 /* Supervisor -- Read */ +#define MMU_ATTR_PROT_SUP_WRITE 0x00000002 /* Supervisor -- Write */ +#define MMU_ATTR_PROT_SUP_EXE 0x00000004 /* Supervisor -- Execute */ +#define MMU_ATTR_VALID_MSK 0x00000040 /* Valid Mask */ +#define MMU_ATTR_VALID 0x00000040 /* Valid -- Valid */ + +#else /* _ASMLANGUAGE */ + +typedef enum mmu_attributes { + MMU_ATTR_MSK_ID_MSK = 0x000000e0, /* Distinguishing Bits Mask */ + MMU_ATTR_PROT_MSK = 0x0000003f, /* Protection Mask */ + MMU_ATTR_PROT_SUP_MSK = 0x00000007, /* Sup Mode protection bits */ + MMU_ATTR_PROT_SUP_READ = 0x00000001, /* Supervisor -- Read */ + MMU_ATTR_PROT_SUP_WRITE = 0x00000002, /* Supervisor -- Write */ + MMU_ATTR_PROT_SUP_EXE = 0x00000004, /* Supervisor -- Execute */ + MMU_ATTR_PROT_USR_MSK = 0x00000038, /* User Mode protection bits */ + MMU_ATTR_PROT_USR_READ = 0x00000008, /* User -- Read */ + MMU_ATTR_PROT_USR_WRITE = 0x00000010, /* User -- Write */ + MMU_ATTR_PROT_USR_EXE = 0x00000020, /* User -- Execute */ + MMU_ATTR_VALID_MSK = 0x00000040, /* Valid Mask */ + MMU_ATTR_VALID_NOT = 0x00000000, /* Valid -- Not Valid */ + MMU_ATTR_VALID = 0x00000040, /* Valid -- Valid */ + MMU_ATTR_CACHE_MSK = 0x00000f80, /* Cache Mask */ + MMU_ATTR_CACHE_OFF = 0x00000080, /* Cache -- Turned off */ + MMU_ATTR_CACHE_COPYBACK = 0x00000100, /* Cache -- Copy/Writeback */ + MMU_ATTR_CACHE_WRITETHRU = 0x00000180, /* Cache -- Write through */ + MMU_ATTR_CACHE_COHERENCY = 0x00000200, /* Cache -- mem coherency */ + MMU_ATTR_CACHE_GUARDED = 0x00000400, /* Cache -- guarded */ + MMU_ATTR_CACHE_DEFAULT = 0x00000800, /* Cache -- use default */ + MMU_ATTR_SPL_MSK = 0x000FF000, /* MMU specific spl attributes */ + MMU_ATTR_SPL_0 = 0x00001000, + MMU_ATTR_SPL_1 = 0x00002000, + MMU_ATTR_SPL_2 = 0x00004000, + MMU_ATTR_SPL_3 = 0x00008000, + MMU_ATTR_SPL_4 = 0x00010000, + MMU_ATTR_SPL_5 = 0x00020000, + MMU_ATTR_SPL_6 = 0x00040000, + MMU_ATTR_SPL_7 = 0x00080000 /* Reserved - used for NO_BLOCK */ +} MMU_ATTR; + +/* + * In principle, a region in sysPhysMemDesc is cacheable if its mask includes + * specification of validity and cacheability, and the specifications are: + * valid + * and not cache-off + * and one of copyback, writethrough, or default. + * Due to the relationships among the OFF, CB, and WT bit values, + * we check for only CB or DEFAULT. + */ +#define IS_VALID_CACHEABLE(mask, attr) \ + ( \ + ((mask) & MMU_ATTR_VALID_MSK) == MMU_ATTR_VALID_MSK \ + && ((mask) & MMU_ATTR_CACHE_MSK) == MMU_ATTR_CACHE_MSK \ + && ((attr) & MMU_ATTR_VALID) == MMU_ATTR_VALID \ + && ((attr) & (MMU_ATTR_CACHE_COPYBACK | MMU_ATTR_CACHE_DEFAULT)) != 0 \ + ) + +#endif /* _ASMLANGUAGE */ + +/* variable declarations */ + +/* function prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvmLibCommonh */ diff --git a/h/vme.h b/h/vme.h new file mode 100644 index 0000000..5127bfc --- /dev/null +++ b/h/vme.h @@ -0,0 +1,71 @@ +/* vme.h - VMEbus constants header file */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02d,06sep01,rcs added VME_AM_CSR SPR# 7243 +02c,10feb99,tm added documentation about number 0x40 and above +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01g,26may92,rrr the tree shuffle +01f,13jan92,ccc fixed VME_AM_IS_XXX macro for 16 and 24 bit AM's. +01e,04oct91,rrr passed through the ansification filter + -changed copyright notice +01d,05oct90,shl added copyright notice. + made #endif ANSI style. +01c,04may90,gae added VME_AM_IS_XXX test macros for 16, 24, & 32 bit AM's. +01b,08nov89,shl added ifdef to prevent inclusion of vxWorks.h more than once. +01a,02jun87,dnw written. +*/ + +/* +DESCRIPTION + +This file contains address space descriptor definitions for the VME bus. + +Note that address space descriptors above 0x3f have already been assigned +to other busses, and additional address space descriptors should be +added only after consulting the appropriate header files and allocating +the next available descriptor. +*/ + +#ifndef __INCvmeh +#define __INCvmeh + +#ifdef __cplusplus +extern "C" { +#endif + +/* address modifier codes */ + +#define VME_AM_STD_SUP_ASCENDING 0x3f +#define VME_AM_STD_SUP_PGM 0x3e +#define VME_AM_STD_SUP_DATA 0x3d + +#define VME_AM_STD_USR_ASCENDING 0x3b +#define VME_AM_STD_USR_PGM 0x3a +#define VME_AM_STD_USR_DATA 0x39 + +#define VME_AM_CSR 0x2f +#define VME_AM_SUP_SHORT_IO 0x2d +#define VME_AM_USR_SHORT_IO 0x29 + +#define VME_AM_EXT_SUP_ASCENDING 0x0f +#define VME_AM_EXT_SUP_PGM 0x0e +#define VME_AM_EXT_SUP_DATA 0x0d + +#define VME_AM_EXT_USR_ASCENDING 0x0b +#define VME_AM_EXT_USR_PGM 0x0a +#define VME_AM_EXT_USR_DATA 0x09 + +#define VME_AM_IS_SHORT(addr) ((addr & 0xf0) == 0x20) +#define VME_AM_IS_STD(addr) ((addr & 0xf0) == 0x30) +#define VME_AM_IS_EXT(addr) ((addr & 0xf0) == 0x00) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvmeh */ diff --git a/h/vnode.h b/h/vnode.h new file mode 100644 index 0000000..5252040 --- /dev/null +++ b/h/vnode.h @@ -0,0 +1,723 @@ +/* vnode.h - vnode interface */ + +/* + * Copyright 1998-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01r,22jul05,jlk removed IO_* macros. Updated readdir macros, prototypes to use + struct dirent * instead of struct uio *. +01q,21jul05,act change IO_* to VNIO_* to avoid clashes with ioQLib.h +01p,20jul05,act add vaccess() +01o,04jul05,jlk added macros to upgrade and downgrade vnode locks +01n,13jun05,act add VRENAME vnode flag +01m,16apr05,act don't need vop_error_link_eisdir +01l,16apr05,act add vopErrorENOTDIR and vopErrorEISDIR functions +01k,15apr05,act rm v_size, which is not being used +01j,13apr05,act add struct ucred +01i,12apr05,act vop_strategy and vop_print should return void +01h,12apr05,act can't have a generic "error rename", supply a specific one + instead +01g,05apr05,act put one cookie back into readdir vop +01f,04apr05,act remove cookies args from VOP_READDIR +01e,30mar05,act simplify various vnode ops by not requiring unlocking +01d,30mar05,act VOP_CREATE is simpler if it leaves dvp locked +01c,25feb05,act fixed several VOP macros; added prototype for vattr_null +01b,23feb05,pcm added vop_error_open() +*/ + +#ifndef __INCvnodeh +#define __INCvnodeh + +/* from $NetBSD: vnode.h,v 1.126 2004/09/21 03:10:35 thorpej Exp $ */ + +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)vnode.h 8.17 (Berkeley) 5/20/95 + */ + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef notyet +struct namecache; +#endif +struct componentname; +struct uio; +struct ucred; +struct vattr; +struct flock; + +typedef int64_t voff_t; +/* typedef int64_t ino_t; ?? vxTypes.h already defines it as u_long */ + +/* + * The vnode is the focus of all file activity. There is a + * unique vnode allocated for each active file (plus one for + * file-system-metadata). + * + * Unlike the BSDs, vnodes are allocated per mount, so vnodes never + * need to move from one file system type to another. + */ + +/* + * Vnode hashing, per mount-point. This hash function probably needs + * tuning. Note that the current VN_HASH definition depends on VN_VHSIZE + * being a power of two. + */ +#define VN_VHSIZE 32 +#define VN_HASH(ino) ((ino) & (VN_VHSIZE - 1)) + +/* + * Vnode types. VNON means no type. We may not need VBAD, and + * the block, character, link, socket, and fifo types are named + * only for BSD compatibility. + */ +enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VMETA, VBAD }; + +LIST_HEAD(buflists, buf); + +/* + * Reading or writing any of these items requires holding the appropriate lock. + * v_freelist is locked by the mount point's vnode hash chain lock + * v_flag, v_usecount, v_holdcount and v_writecount are + * locked by the v_interlock simple lock + * + * Each underlying filesystem has its own private area for v_data. + * + * Unlike BSD vnodes, ours have an inode number attached at all times. + * This is the same as the number that will be used in the vfs_vget operation + * (see mount.h). Vnodes can cache inode data by inode number. For a + * vnode that does not correspond to an ordinary file in the file system, + * use VNOINODE. + * + * Similarly, all vnodes always have a working vnode lock, locked + * with VN_EXLOCK (exclusive lock) or VN_SHLOCK (shared lock) and + * unlocked with VN_UNLOCK. (Upgrade/downgrade is not yet implemented + * and VN_SHLOCK is currently an exclusive lock.) There is no VOP_LOCK + * nor VOP_UNLOCK as vnodes do not stack. + */ +struct vnode { + SEM_ID v_interlock; + int v_flag; /* flags */ + int v_numoutput; /* number of pending writes */ + SEM_ID v_output_active; /* binary sem for numout==0 */ + long v_usecount; /* reference count of users */ + long v_writecount; /* reference count of writers */ + long v_holdcnt; /* page & buffer references */ + ino_t v_inode; /* inode number, or 0 */ + struct mount *v_mount; /* ptr to vfs we are in */ + struct vnode_ops *v_ops; /* vnode operations */ + TAILQ_ENTRY(vnode) v_freelist; /* vnode freelist */ + LIST_ENTRY(vnode) v_hash; /* hash chain */ + struct buflists v_cleanblkhd; /* clean blocklist head */ + struct buflists v_dirtyblkhd; /* dirty blocklist head */ + LIST_ENTRY(vnode) v_synclist; /* vnodes with dirty buffers */ +#ifdef notyet + LIST_HEAD(, namecache) v_dnclist; /* namecaches for children */ + LIST_HEAD(, namecache) v_nclist; /* namecaches for parent */ +#endif + enum vtype v_type; /* vnode type */ +#ifdef notyet /* don't have read/writer locks yet */ + struct lock v_lock; /* lock for this vnode */ +#else + SEM_ID v_lock; +#endif + + /* + * Per-file-system data. This is actually variable length, + * allocated when you instantiate a file system and its + * "struct mount" and so forth, according to the size you + * give for the file system module. + */ + union { + char v_data[1]; /* vnode data */ + /* these merely force v_data to be aligned */ + long v_un_long; + long long v_un_llong; + void *v_un_ptr; + } v_data_un; +}; +#define VTODATA(type, vp) ((type *)((vp)->v_data_un.v_data)) + +/* inode number for "not a file" vnodes */ +#define VNOINODE ((ino_t)0) + +/* + * Vnode flags. + * + * Many of these (commented out) are not used in vxWorks. + * We add VRUNNING to distinguish between "vnode that is being + * initialized" and "vnode that has finished initializing". + * We add VRENAME to mark a directory that is being renamed + * (it cannot be held locked, but only one rename should be + * allowed to proceed at a time). + */ +#define VROOT 0x0001 /* root of its file system */ +/* VTEXT 0x0002 -- vnode is a pure text prototype */ +#define VRUNNING 0x0002 /* vnode is up and running */ + /* VSYSTEM only used to skip vflush()ing quota files */ +/* VSYSTEM 0x0004 -- vnode being used by kernel */ + /* VISTTY used when reading dead vnodes */ +/* VISTTY 0x0008 -- vnode represents a tty */ +/* VEXECMAP 0x0010 -- vnode has PROT_EXEC mappings */ +/* VLOCKSWORK 0x0080 -- FS supports locking discipline */ +/* VXLOCK 0x0100 -- vnode is locked to change underlying type */ +#define VRENAME 0x0100 /* vnode is being rename()d */ +/* VXWANT 0x0200 -- process is waiting for vnode */ +/* VBWAIT 0x0400 -- waiting for output to complete */ +/* VALIASED 0x0800 -- vnode has an alias */ +/* VDIROP 0x1000 -- LFS: vnode is involved in a directory op */ +/* VLAYER 0x2000 -- vnode is on a layer filesystem */ +#define VONWORKLST 0x4000 /* On syncer work-list */ +/* VDIRTY 0x8000 -- vnode possibly has dirty pages */ + +/* + * Vnode operations. + * + * BSD computes the set of operations at boot time; we do not need this + * and just have this fixed set. + * + * For each op's vnodes, we include a specification of the locking + * protocol for that operation. The three columns are in, out, and error + * respectively. The "in" column defines the lock state on input, the + * "out" column defines the state on successful return, and the "error" + * column defines the state on error exit. + * + * The locking value can take the following values: + * L: locked + * U: unlocked + * -: not applicable, vnode does not yet (or no longer) exists + * =: the same on input and output, may be either L or U + * X: locked if not nil. + * + * The lookup operation defies simple description, however. Its lock + * state depends on the flags and operations fields in the (cnp) structure. + * Note especially that *vpp may equal dvp and both may be locked. + * + * There are three types of lookups: ".", ".." (ISDOTDOT), and other. + * On successful lookup of ".", a reference is added to dvp, and it + * is returned in *vpp. + * To look up ISDOTDOT, dvp is unlocked, the ".." node is locked, and + * then dvp is relocked iff LOCKPARENT is set and this is the last + * component name (ISLASTCN set). This preserves the protocol of + * always locking nodes from the root ("/") downward and prevents + * deadlock. + * Other lookups find the named node (creating the vnode if needed) and + * return it, locked, in *vpp. + * For non-"." lookups, if LOCKPARENT is not set or this was not the + * last component name, dvp is returned unlocked on a successful + * lookup. + * On failure, *vpp is NULL, and *dvp is left locked or unlocked (as + * desired by the file system). + * + * All of this is relaxed inside actual file systems, which merely need + * to return successful new vnodes locked in *vpp (handling "." by increasing + * the reference count), or setting the PDIRUNLOCK flag if dvp has been + * unlocked. If the file system leaves dvp locked but the lookup operation + * does not need dvp locked, the lookup code will unlock it; if the file + * system has unlocked dvp for ISDOTDOT purposes, it can leave it unlocked + * and just set PDIRUNLOCK. + * + * In other words: if you are implementing a file system, you must handle + * "." and ".." specially (by returning with *vpp = dvp in the first case, + * after increasing the reference count, and by unlocking dvp before going + * up the tree in the second case). You must also set PDIRUNLOCK if you + * return with dvp unlocked. Other than that, you should just leave dvp + * locked. + */ +struct vnode_ops { + int (*vop_lookup)( + struct vnode *dvp, /* L ? ? */ + struct vnode **vpp, /* - L - */ + struct componentname *cnp + ); + int (*vop_create)( + struct vnode *dvp, /* L L L */ + struct vnode **vpp, /* - L - */ + struct componentname *cnp, /* cnp flags: CREATE, LOCKPARENT */ + struct vattr *vap + ); + int (*vop_open)( + struct vnode *vp, /* L L L */ + int mode, + struct ucred *cred + ); + int (*vop_close)( + struct vnode *vp, /* L L L */ + int fflag, + struct ucred *cred + ); + int (*vop_access)( + struct vnode *vp, /* L L L */ + int mode, + struct ucred *cred + ); + int (*vop_getattr)( + struct vnode *vp, /* = = = */ + struct vattr *vap, + struct ucred *cred + ); + int (*vop_setattr)( + struct vnode *vp, /* L L L */ + struct vattr *vap, + struct ucred *cred + ); + int (*vop_read)( + struct vnode *vp, /* L L L */ + struct uio *uio, + int ioflag, + struct ucred *cred + ); + int (*vop_write)( + struct vnode *vp, /* L L L */ + struct uio *uio, + int ioflag, + struct ucred *cred + ); + int (*vop_ioctl)( + struct vnode *vp, /* L L L */ + u_long command, + void *data, + int fflag, + struct ucred *cred + ); + int (*vop_fcntl)( + struct vnode *vp, /* L L L */ + u_int command, + void *data, + int fflag, + struct ucred *cred + ); + int (*vop_fsync)( + struct vnode *vp, /* L L L */ + struct ucred *cred, + int flags + ); + int (*vop_seek)( + struct vnode *vp, /* ? ? ? */ + voff_t oldoff, + voff_t newoff, + struct ucred *cred + ); + int (*vop_remove)( + struct vnode *dvp, /* L L L */ + struct vnode *vp, /* L L L */ + struct componentname *cnp /* DELETE, LOCKPARENT | LOCKLEAF */ + ); + int (*vop_link)( + struct vnode *dvp, /* L L L */ + struct vnode *vp, /* U U U */ + struct componentname *cnp /* CREATE, LOCKPARENT */ + ); + int (*vop_rename)( + struct vnode *fdvp, /* U U U */ + struct vnode *fvp, /* U U U */ + struct componentname *fcnp, /* DELETE, WANTPARENT | SAVESTART */ + struct vnode *tdvp, /* L U U */ + struct vnode *tvp, /* X U U */ + struct componentname *tcnp /* RENAME, LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART */ + /* XXX the vop_rename routines should REALLY NOT be depending on SAVESTART! */ + ); + int (*vop_mkdir)( + struct vnode *dvp, /* L L L */ + struct vnode **vpp, /* - L - */ + struct componentname *cnp, /* CREATE, LOCKPARENT */ + struct vattr *vap + ); + int (*vop_rmdir)( + struct vnode *dvp, /* L L L */ + struct vnode *vp, /* L L L */ + struct componentname *cnp /* DELETE, LOCKPARENT | LOCKLEAF */ + ); + int (*vop_symlink)( + struct vnode *dvp, /* L L L */ + struct vnode **vpp, /* - L - */ + struct componentname *cnp, /* CREATE, LOCKPARENT */ + struct vattr *vap, + char *target + ); + int (*vop_readdir)( + struct vnode *vp, /* L L L */ + struct dirent *direntp, + struct ucred *cred, + int *eofflag, + int *cookie /* really, FS-level seek offset */ + ); + int (*vop_readlink)( + struct vnode *vp, /* L L L */ + struct uio *uio, + struct ucred *cred + ); + int (*vop_abortop)( + struct vnode *dvp, /* = = = */ + struct componentname *cnp /* flags per op being aborted */ + ); + int (*vop_activate)( + struct vnode *vp /* L L L */ + ); + int (*vop_inactive)( + struct vnode *vp /* L L L */ + ); +#if 0 + int (*vop_lock)( + struct vnode *vp /* U L U */ + ); + int (*vop_unlock)( + struct vnode *vp /* L U L */ + ); +#endif + void (*vop_strategy)( + struct vnode *vp, /* = = = */ + struct buf *bp + ); + void (*vop_print)( + struct vnode *vp /* = = = */ + ); + int (*vop_pathconf)( + struct vnode *vp, /* L L L */ + int name, + long *retval + ); + int (*vop_advlock)( + struct vnode *vp, /* U U U */ + void *id, + int op, + struct flock *fl, + int flags + ); + int (*vop_truncate)( + struct vnode *vp, /* L L L */ + voff_t length, + int flags, + struct ucred *ucred + ); +}; + +/* + * Vnode attributes. A field value of VNOVAL represents a field whose value + * is unavailable (getattr) or which is not to be changed (setattr). + */ +struct vattr { + enum vtype va_type; /* vnode type (for create) */ + mode_t va_mode; /* file access mode and type */ + nlink_t va_nlink; /* number of references to file */ + uid_t va_uid; /* owner user id */ + gid_t va_gid; /* owner group id */ + long va_fsid; /* file system id (dev for now) */ + uint64_t va_fileid; /* file id */ + uint64_t va_size; /* file size in bytes */ + long va_blocksize; /* blocksize preferred for i/o */ + struct timespec va_atime; /* time of last access */ + struct timespec va_mtime; /* time of last modification */ + struct timespec va_ctime; /* time file changed */ + struct timespec va_birthtime; /* time file created */ + u_long va_gen; /* generation number of file */ + u_long va_flags; /* flags defined for file */ + dev_t va_rdev; /* device the special file represents */ + uint64_t va_bytes; /* bytes of disk space held by file */ + uint64_t va_filerev; /* file modification number */ + u_int va_vaflags; /* operations flags, see below */ + long va_spare; /* remain quad aligned */ +}; + +/* + * Flags for va_vaflags. + */ +#define VA_UTIMES_NULL 0x01 /* utimes argument was NULL */ +#define VA_EXCLUSIVE 0x02 /* exclusive create request */ + +/* + * Flags for ioflag (read/write vnode ops). + */ +#define VNIO_UNIT 0x01 /* do I/O as atomic unit */ +#define VNIO_APPEND 0x02 /* append write to end */ +#define VNIO_SYNC (0x04|VNIO_DSYNC) /* sync I/O file integrity completion */ +#define VNIO_NODELOCKED 0x08 /* underlying node already locked */ +#define VNIO_NDELAY 0x10 /* FNDELAY flag set in file table */ +#define VNIO_DSYNC 0x20 /* sync I/O data integrity completion */ +#define VNIO_ALTSEMANTICS 0x40 /* use alternate i/o semantics */ + +/* + * Modes for vaccess() (fifth argument). + */ +#define VREAD 0004 /* read, write, execute permissions */ +#define VWRITE 0002 +#define VEXEC 0001 + +/* + * Token indicating no attribute value yet assigned. + */ +#define VNOVAL (-1) + +/* + * Flags to various vnode functions. + * XXX DON'T KNOW IF WE NEED MOST OF THESE + */ +/*efine SKIPSYSTEM 0x0001 -- vflush: skip vnodes marked VSYSTEM */ +#define FORCECLOSE 0x0002 /* vflush: force file closeure */ +#define WRITECLOSE 0x0004 /* vflush: only close writeable file */ +#define DOCLOSE 0x0004 /* vclean: close active files */ +#define V_SAVE 0x0001 /* vinvalbuf: sync file first */ + +/* + * Flags to various vnode operations. + */ +#define FSYNC_WAIT 0x0001 /* fsync: wait for completion */ +#define FSYNC_DATAONLY 0x0002 /* fsync: hint: sync file data only */ +#define FSYNC_RECLAIM 0x0004 /* fsync: hint: vnode is being reclaimed */ +#define FSYNC_LAZY 0x0008 /* fsync: lazy sync (trickle) */ + +#define UPDATE_WAIT 0x0001 /* update: wait for completion */ +#define UPDATE_DIROP 0x0002 /* update: hint for fs to wait or not */ +#define UPDATE_CLOSE 0x0004 /* update: clean up on close */ + +/* hold/holdrele should not appear outside vnodeSubr.c */ +/* #define HOLDRELE(vp) holdrele(vp) */ +/* #define VHOLD(vp) vhold(vp) */ + +#define VREF(vp) vref(vp) + +/* + * Get shared or exclusive lock on vnode. Currently shared locks are + * actually exclusive. + */ +#define VN_SHLOCK(vp) semTake((vp)->v_lock, WAIT_FOREVER) +#define VN_EXLOCK(vp) semTake((vp)->v_lock, WAIT_FOREVER) +#define VN_UNLOCK(vp) semGive((vp)->v_lock) +/* + * These macros upgrade from a shared lock to an exclusive locks and downgrade + * from an exclusive lock to a shared lock. Currently, as there's no difference + * in lock types they do nothing. + */ +#define VN_UPLOCK(vp) +#define VN_DOWNLOCK(vp) + +/* + * File system operations. + */ +#define VOP_LOOKUP(dvp, vpp, cnp) \ + ((dvp)->v_ops->vop_lookup(dvp, vpp, cnp)) +#define VOP_CREATE(dvp, vpp, cnp, vap) \ + ((dvp)->v_ops->vop_create(dvp, vpp, cnp, vap)) +#define VOP_OPEN(vp, mode, cred) \ + ((vp)->v_ops->vop_open(vp, mode, cred)) +#define VOP_CLOSE(vp, fflag, cred) \ + ((vp)->v_ops->vop_close(vp, fflag, cred)) +#define VOP_ACCESS(vp, mode, cred) \ + ((vp)->v_ops->vop_access(vp, mode, cred)) +#define VOP_GETATTR(vp, vap, cred) \ + ((vp)->v_ops->vop_getattr(vp, vap, cred)) +#define VOP_SETATTR(vp, vap, cred) \ + ((vp)->v_ops->vop_setattr(vp, vap, cred)) +#define VOP_READ(vp, uio, ioflag, cred) \ + ((vp)->v_ops->vop_read(vp, uio, ioflag, cred)) +#define VOP_WRITE(vp, uio, ioflag, cred) \ + ((vp)->v_ops->vop_write(vp, uio, ioflag, cred)) +#define VOP_IOCTL(vp, cmd, data, fflag, cred) \ + ((vp)->v_ops->vop_ioctl(vp, cmd, data, fflag, cred)) +#define VOP_FCNTL(vp, cmd, data, fflag, cred) \ + ((vp)->v_ops->vop_fcntl(vp, cmd, data, fflag, cred)) +#define VOP_FSYNC(vp, cred, flags) \ + ((vp)->v_ops->vop_fsync(vp, cred, flags)) +#define VOP_SEEK(vp, oldoff, newoff, cred) \ + ((vp)->v_ops->vop_seek(vp, oldoff, newoff, cred)) +#define VOP_REMOVE(dvp, vp, cnp) \ + ((dvp)->v_ops->vop_remove(dvp, vp, cnp)) +#define VOP_LINK(dvp, vp, cnp) \ + ((dvp)->v_ops->vop_link(dvp, vp, cnp)) +#define VOP_RENAME(fdvp, fvp, fcnp, tdvp, tvp, tcnp) \ + ((fdvp)->v_ops->vop_rename(fdvp, fvp, fcnp, tdvp, tvp, tcnp)) +#define VOP_MKDIR(dvp, vpp, cnp, vap) \ + ((dvp)->v_ops->vop_mkdir(dvp, vpp, cnp, vap)) +#define VOP_RMDIR(dvp, vp, cnp) \ + ((dvp)->v_ops->vop_rmdir(dvp, vp, cnp)) +#define VOP_SYMLINK(dvp, vpp, cnp, vap, target) \ + ((dvp)->v_ops->vop_symlink(dvp, vpp, cnp, vap, target)) +#define VOP_READDIR(vp, direntp, cred, eofflag, cookie) \ + ((vp)->v_ops->vop_readdir(vp, direntp, cred, eofflag, cookie)) +#define VOP_READLINK(vp, uio, cred) \ + ((vp)->v_ops->vop_readlink(vp, uio, cred)) + +#define VOP_PATHCONF(vp, name, retval) \ + ((vp)->v_ops->vop_pathconf(vp, name, retval)) +#define VOP_ADVLOCK(vp, id, op, fl, flags) \ + ((vp)->v_ops->vop_advlock(vp, id, op, fl, flags)) +#define VOP_TRUNCATE(vp, length, flags, ucred) \ + ((vp)->v_ops->vop_truncate(vp, length, flags, ucred)) + +/* + * Housekeeping and other internals. Note: VOP_ACTIVATE is not in BSD. + */ +#define VOP_ABORTOP(vp, cnp) ((vp)->v_ops->vop_abortop(vp, cnp)) +#define VOP_ACTIVATE(vp) ((vp)->v_ops->vop_activate(vp)) +#define VOP_INACTIVE(vp) ((vp)->v_ops->vop_inactive(vp)) +#if 0 +#define VOP_LOCK(vp) ((vp)->v_ops->vop_lock(vp)) +#define VOP_UNLOCK(vp) ((vp)->v_ops->vop_unlock(vp)) +#endif +#define VOP_STRATEGY(vp, bp) ((vp)->v_ops->vop_strategy(vp, bp)) +#define VOP_PRINT(vp) ((vp)->v_ops->vop_print(vp)) + +extern int enosys(void); +extern int vopErrorENOTDIR(void); +extern int vopErrorEISDIR(void); +extern int vop_error_rename(struct vnode *, struct vnode *, + struct componentname *, + struct vnode *, struct vnode *, struct componentname *); +#define vop_error_lookup \ + ((int (*)(struct vnode *, struct vnode **, \ + struct componentname *))enosys) +#define vop_error_lookup_enotdir \ + ((int (*)(struct vnode *, struct vnode **, \ + struct componentname *))vopErrorENOTDIR) +#define vop_error_create \ + ((int (*)(struct vnode *, struct vnode **, struct componentname *, \ + struct vattr *))enosys) +#define vop_error_open \ + ((int (*)(struct vnode *, int, struct ucred *))enosys) +#define vop_error_close \ + ((int (*)(struct vnode *, int, struct ucred *))enosys) +#define vop_error_access \ + ((int (*)(struct vnode *, int, struct ucred *))enosys) +#define vop_error_getattr \ + ((int (*)(struct vnode *, struct vattr *, struct ucred *))enosys) +#define vop_error_setattr \ + ((int (*)(struct vnode *, struct vattr *, struct ucred *))enosys) +#define vop_error_read \ + ((int (*)(struct vnode *, struct uio *, int, struct ucred *))enosys) +#define vop_error_write \ + ((int (*)(struct vnode *, struct uio *, int, struct ucred *))enosys) +#define vop_error_ioctl \ + ((int (*)(struct vnode *, u_long, void *, int, struct ucred *))enosys) +#define vop_error_fcntl \ + ((int (*)(struct vnode *, u_int, void *, int, struct ucred *))enosys) +#define vop_error_fsync \ + ((int (*)(struct vnode *, struct ucred *, int))enosys) +#define vop_error_seek \ + ((int (*)(struct vnode *, voff_t, voff_t, struct ucred *))enosys) +#define vop_error_remove \ + ((int (*)(struct vnode *, struct vnode *, \ + struct componentname *))enosys) +#define vop_error_link \ + ((int (*)(struct vnode *, struct vnode *, \ + struct componentname *))enosys) +#define vop_error_mkdir \ + ((int (*)(struct vnode *, struct vnode **, struct componentname *, \ + struct vattr *))enosys) +#define vop_error_rmdir \ + ((int (*)(struct vnode *, struct vnode *, \ + struct componentname *))enosys) +#define vop_error_rmdir_enotdir \ + ((int (*)(struct vnode *, struct vnode *, \ + struct componentname *))vopErrorENOTDIR) +#define vop_error_symlink \ + ((int (*)(struct vnode *, struct vnode **, struct componentname *, \ + struct vattr *, char *))enosys) +#define vop_error_readdir \ + ((int (*)(struct vnode *, struct dirent *, struct ucred *, int *, \ + int *))enosys) +#define vop_error_readdir_enotdir \ + ((int (*)(struct vnode *, struct dirent *, struct ucred *, int *, \ + int *))vopErrorENOTDIR) +#define vop_error_readlink \ + ((int (*)(struct vnode *, struct uio *, struct ucred *))enosys) +#define vop_error_abortop \ + ((int (*)(struct vnode *, struct componentname *))enosys) +/* NOTE: THERE IS NO "error" FUNCTION FOR inactive OR print */ +void vop_error_strategy(struct vnode *, struct buf *); +#define vop_error_pathconf \ + ((int (*)(struct vnode *, int, long *))enosys) +#define vop_error_advlock \ + ((int (*)(struct vnode *, void *, int, struct flock *, int))enosys) +#define vop_error_truncate \ + ((int (*)(struct vnode *, voff_t, int, struct ucred *))enosys) + +int vn_makevnodes(struct mount *, int); +void vn_deletevnodes(struct mount *); +void vattr_null(struct vattr *); + +void bgetvp(struct vnode *, struct buf *); +void brelvp(struct buf *); +void vreassignbuf(struct buf *); + +void vn_incr_numoutput(struct vnode *); +void vn_decr_numoutput(struct vnode *); + +int getnewvnode(struct mount *, struct vnode_ops *, struct vnode **); +int vgetino(struct mount *, ino_t, struct vnode_ops *, struct vnode **); +void vref(struct vnode *); +void vput(struct vnode *); +void vrele(struct vnode *); + +int vaccess(enum vtype, mode_t, uid_t, gid_t, int, struct ucred *); + +void vprint(const char *, struct vnode *); + +/* + * vn_start_write and vn_finished_write are intended to allow + * mount points to be "downgraded" from r/w to r/o: if the mount + * point is waiting for a downgrade, the "start" calls will pause + * or return an error (depending on supplied flags). + * + * We do not implement this yet so we just define this away to 0 + * for now. + */ +#define vn_start_write(vp, mp, flags) (0) +#define vn_finished_write(mp, flags) + +/* + * This perhaps belongs elsewhere (BSD has a separate ucred.h) but + * will serve for now. Note that we only have one gid, rather than + * a group-array and number-of-groups - this may eventually change + * (for NFS)... + */ +struct ucred { + uid_t cr_uid; + gid_t cr_gid; +}; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvnodeh */ diff --git a/h/vwModNum.h b/h/vwModNum.h new file mode 100644 index 0000000..44e383c --- /dev/null +++ b/h/vwModNum.h @@ -0,0 +1,324 @@ +/* vwModNum.h - VxWorks module numbers */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +05v,12aug05,pcm M_hrfsLib, M_erfLib and M_taskPxLib are now unique +05u,08jul05,jln updated comment +05t,28jun05,jln add M_taskPxLib +05s,03aug05,dbt Added core dump errnos. +05r,22jul05,jmt Add M_erfLib +05q,03feb05,pcm added M_hrfsLib +05p,22oct04,pch SPR 92598: add M_excLib +05o,07sep04,jyo Fixing SPR 100119: Removing references to RT11. +05n,24jun04,jn Add loadFileLib +05m,16may04,kk added S_tlsLib mod num +05l,30mar04,dms Added SHL-specific errno class. +05m,29mar04,jn Rename rtpLoadLib -> loadRtpLib +05l,16mar04,bpn Updated errnoTbl.tcl location. +05k,11dec03,gls added M_sdLib +05j,04dec03,als removed M_snsLib (merged with M_salLib) +05i,02dec03,bwa removed M_msgCLib and M_msgSLib +05h,24nov03,ann added the module numbers for NFSv3 +05g,26nov03,bwa merged M_unLib and M_unCompLib definitions +05f,21nov03,bwa added M_unLib and M_unCompLib definitions; + added M_salLib and M_snsLib +05e,14oct03,gls added M_pgMgrLib +05d,18nov03,yvp Added M_hookLib. +05c,28oct03,jn Add M_rtpLoadLib +05b,18sep03,vvv added M_ipRouteLib +05a,11aug03,yp adding M_adrSpaceLib and M_pgPoolLib +04z,26aug03,dbs added ED&R modules M_edrLib, M_pmLib, M_memLogLib +04y,26aug03,yvp Added M_syscallLib +04x,11apr03,pes PAL Coprocessor Abstraction: Added M_coprocLib +04w,01jul03,nrj added RTP support +04v,15jul03,kam rebased to Base6 integration branch +04u,20jun03,t_m added module number for Card and Socket services (pccard) +04t,04jun03,bwa Added M_msgCLib and M_msgSLib definitions. +04s,04jun03,kam added M_isrLib +04r,18feb03.bpn Added M_shellLib and M_shellCmdLib. +04q,01nov02,vvv added M_fastUdpLib +04p,20jun02,jws Added HA related numbers. This creates a gap. +04o,14mar02,elr Added M_ftpDrv +04n,12oct01,rae Added M_fastPathLib +04m,09oct01,bwa Added M_eventLib +04l,24sep01,jkf added M_cbioLib. +04k,02may01,wef changed usb error codes to M_usbHostLib and M_usbTargLib +04j,05dec00,wef added usb error codes +04i,04may01,dlk Added M_qPriMaskLib. +04h,12dec00,agf Adding #define for M_devCfgLib, required as part of the + es.coretools merge +04g,24apr00,gnn merged in from tor2_0.open_stack +04f,28mar00,rae merging in IGMPv2 changes +04e,14jan00,brx added M_rarpLib definition +04d,03sep99,mas removed dmsObjLib following merge of it with dmsLib. +04c,08jul99,mas added M_poolLib, M_setLib, M_dmsObjLib, M_dmsLib +04b,14jun99,cn added M_miiLib. +04a,05oct98,jmp added M_if_ul definition (SPR #22585). +03z,19may98,drm merged 3rd party changes for distributed message queues + - added M_msgQDistLib, M_distNameLib, M_msgQDistGrpLib, + and M_distLib + - merged code was originally based on version 03s +03y,04May98,cym added M_loadPecoffLib +03x,13nov97,vin added M_netBufLib +03w,15jul97,spm added M_sntpcLib and M_sntpsLib +03v,16may97,vin added M_dhcpsLib. +03u,27apr97,rjc added M_ospfLib. +03t,07apr97,gnn added M_endLib, M_muxLib, and M_m2RipLib. +03s,14feb97,rjc added M_snmpdLib +03r,13dec96,jag added M_resolvLib +03q,17oct96,spm added M_dhcpcLib +03s,02jul97,ms moved M_cdromFs here from cdromFsLib.h +03q,29nov96,p_m added to a comment to tell people to go edit errnoTbl.tcl +03r,01nov96,hdn added M_pcmciaLib. +03q,22aug95,jds added M_tapeFsLib +03p,23may96,rjc added M_snmpdLib +03o,30nov95,vin added M_pppHookLib. +03n,09may95,dzb added M_pppSecretLib. +03m,29mar95,sgv added M_strmLib. +03l,04nov94,dzb added M_mbufLib and M_pingLib. +03k,15oct93,cd added M_loadElfLib. +03j,04nov93,yao added M_loadSomCoffLib. +03i,22apr94,jmm added M_nfsdLib and M_mountLib +03h,14feb94,jag added M_ for MIB-II library. +03g,22sep92,rrr added support for c++ +03f,01aug92,srh added M_cxxLib +03e,19jul92,pme added M_smObjLib and M_smNameLib. +03d,15jul92,jmm added M_moduleLib and M_unldLib. +03c,08jul92,rdc added M_vmLib and M_mmuLib. +03b,30jun92,wmd added M_loadCoffLib. +03a,09jun92,ajm added M_loadEcoffLib, M_loadAoutLib, M_loadBoutLib, + and M_bootLoadLib +02z,02jun92,elh added M_smPktLib, and M_smUtilLib, renamed M_shMemLib + to M_smLib. +02y,26may92,rrr the tree shuffle +02x,28feb92,elh added M_bootpLib, M_tftpLib, and M_icmpLib +02w,04feb92,elh added M_shMemLib, changed year on copyright +02v,07jan92,elh added M_arpTblLib +02u,04oct91,rrr passed through the ansification filter + -changed copyright notice +02t,05oct90,shl added copyright notice. + made #endif ANSI style. +02s,02oct90,kdl added M_rawFsLib. +02r,09aug90,kdl changed M_msdosLib to M_dosFsLib, changed M_rt11Lib to + M_rt11FsLib. +02q,18jul90,jcf added M_cacheLib +02p,26jun90,jcf removed M_semCore, M_semILib. added M_semLib. +02o,04may90,kdl added M_dirLib. +02n,18mar90,jcf added M_hashLib, M_qLib, M_tickLib, M_objLib, + M_qPriHeapLib, M_qPriBMapLib, M_bufLib, + M_msgQLib, M_classLib +02m,16mar90,kdl added M_scsiLib, M_msdosLib. + rdc added M_selectLib. +02l,13mar90,shl added M_loginLib. +02k,27jul89,hjb added M_if_sl. +02j,25may89,gae added M_ftnLib. +02i,04jun88,dnw changed ldLib->loadLib, rtLib->rt11Lib, stsLib->errnoLib. + changed M_errno, M_taskLib, M_vrtx, M_psos. +02h,29may88,dnw added M_sigLib. + deleted some obsolete modules. +02g,28may88,dnw added M_hostLib. +02f,29apr88,gae added M_stsLib. +02e,19apr88,llk added M_nfsDrv, M_nfsLib, M_rpcClntStat, M_nfsStat. +02d,25jan88,jcf added M_taskLib. +02c,01nov87,llk added M_inetLib and M_routeLib. +...pre 1987 mod history removed. See RCS. +*/ + +#ifndef __INCvwModNumh +#define __INCvwModNumh + +#ifdef __cplusplus +extern "C" { +#endif + +/* module numbers - DO NOT CHANGE NUMBERS! Add or delete only! */ +#define M_errno (0 << 16) /* THIS MUST BE ZERO! */ +#define M_kernel (1 << 16) +#define M_taskLib (3 << 16) +#define M_dbgLib (4 << 16) +#define M_dsmLib (7 << 16) +#define M_fioLib (9 << 16) +#define M_ioLib (12 << 16) +#define M_iosLib (13 << 16) +#define M_loadLib (14 << 16) +#define M_lstLib (15 << 16) +#define M_memLib (17 << 16) +#define M_rngLib (19 << 16) + +#define M_semLib (22 << 16) +#define M_vwModNum (27 << 16) +#define M_symLib (28 << 16) +#define M_tyLib (31 << 16) +#define M_wdLib (34 << 16) +#define M_usrLib (35 << 16) +#define M_remLib (37 << 16) +#define M_netDrv (41 << 16) +#define M_inetLib (43 << 16) +#define M_routeLib (44 << 16) +#define M_nfsDrv (45 << 16) +#define M_nfsLib (46 << 16) +#define M_rpcClntStat (47 << 16) +#define M_nfsStat (48 << 16) +#define M_errnoLib (49 << 16) +#define M_hostLib (50 << 16) +#define M_sigLib (51 << 16) +#define M_ftnLib (52 << 16) +#define M_if_sl (53 << 16) +#define M_loginLib (54 << 16) +#define M_scsiLib (55 << 16) +#define M_dosFsLib (56 << 16) +#define M_selectLib (57 << 16) +#define M_hashLib (58 << 16) +#define M_qLib (59 << 16) +#define M_tickLib (60 << 16) +#define M_objLib (61 << 16) +#define M_qPriHeapLib (62 << 16) +#define M_qPriBMapLib (63 << 16) +#define M_bufLib (64 << 16) +#define M_msgQLib (65 << 16) +#define M_classLib (66 << 16) +#define M_intLib (67 << 16) +#define M_dirLib (68 << 16) +#define M_cacheLib (69 << 16) +#define M_rawFsLib (70 << 16) +#define M_arpLib (71 << 16) +#define M_smLib (72 << 16) +#define M_bootpLib (73 << 16) +#define M_icmpLib (74 << 16) +#define M_tftpLib (75 << 16) +#define M_proxyArpLib (76 << 16) +#define M_smUtilLib (77 << 16) +#define M_smPktLib (78 << 16) +#define M_loadEcoffLib (79 << 16) +#define M_loadAoutLib (80 << 16) +#define M_loadBoutLib (81 << 16) +#define M_bootLoadLib (82 << 16) +#define M_loadCoffLib (83 << 16) +#define M_vmLib (84 << 16) +#define M_mmuLib (85 << 16) +#define M_moduleLib (86 << 16) +#define M_unldLib (87 << 16) +#define M_smObjLib (88 << 16) +#define M_smNameLib (89 << 16) +#define M_cplusLib (90 << 16) +#define M_m2Lib (91 << 16) +#define M_aioPxLib (92 << 16) +#define M_loadAoutHppaLib (93 << 16) +#define M_mountLib (94 << 16) +#define M_nfsdLib (95 << 16) +#define M_loadSomCoffLib (96 << 16) +#define M_loadElfLib (97 << 16) +#define M_mbufLib (98 << 16) +#define M_pingLib (99 << 16) +#define M_strmLib (100 << 16) +#define M_pppSecretLib (101 << 16) +#define M_pppHookLib (102 << 16) +#define M_tapeFsLib (103 << 16) +#define M_snmpdLib (104 << 16) +#define M_pcmciaLib (105 << 16) +#define M_dhcpcLib (106 << 16) +#define M_resolvLib (107 << 16) +#define M_endLib (108 << 16) +#define M_muxLib (109 << 16) +#define M_m2RipLib (110 << 16) +#define M_ospfLib (111 << 16) +#define M_dhcpsLib (112 << 16) +#define M_sntpcLib (113 << 16) +#define M_sntpsLib (114 << 16) +#define M_netBufLib (115 << 16) +#define M_cdromFsLib (116 << 16) +#define M_loadPecoffLib (117 << 16) +#define M_distLib (118 << 16) +#define M_distNameLib (119 << 16) +#define M_msgQDistGrpLib (120 << 16) +#define M_msgQDistLib (121 << 16) +#define M_if_ul (122 << 16) +#define M_miiLib (123 << 16) +#define M_poolLib (124 << 16) +#define M_setLib (125 << 16) +#define M_dmsLib (126 << 16) +#define M_rarpLib (127 << 16) +#define M_igmpRouterLib (128 << 16) +#define M_devCfgLib (129 << 16) +#define M_qPriMaskLib (130 << 16) +#define M_usbHostLib (131 << 16) +#define M_usbPeriphLib (132 << 16) +#define M_cbioLib (133 << 16) +#define M_eventLib (134 << 16) +#define M_fastPathLib (135 << 16) +#define M_ftpLib (136 << 16) +#define M_fastUdpLib (137 << 16) +#define M_csLib (138 << 16) +#define M_edrLib (138 << 16) +#define M_pmLib (139 << 16) +#define M_memLogLib (140 << 16) +#define M_ipRouteLib (141 << 16) +#define M_nfs3Stat (142 << 16) + +#define M_alarmLib (153 << 16) +#define M_amsLib (154 << 16) +#define M_fmsLib (155 << 16) +#define M_hsiLib (156 << 16) +#define M_hsmsLib (157 << 16) +#define M_omsLib (158 << 16) +#define M_rpmLib (159 << 16) +#define M_umsLib (160 << 16) +#define M_cmsLib (161 << 16) +#define M_mmsLib (162 << 16) +#define M_pspLib (163 << 16) +#define M_xcomLib (164 << 16) +#define M_ipsLib (165 << 16) +#define M_rdsLib (166 << 16) +#define M_grmLib (167 << 16) +#define M_mtpLib (168 << 16) +#define M_exEngLib (169 << 16) +#define M_tplLib (170 << 16) +#define M_smmLib (171 << 16) +#define M_graLib (172 << 16) +#define M_shellLib (173 << 16) +#define M_shellInterpCmdLib (174 << 16) +#define M_isrLib (175 << 16) + +#define M_rtpLib (178 << 16) +#define M_coprocLib (179 << 16) +#define M_adrSpaceLib (180 << 16) +#define M_pgPoolLib (181 << 16) +#define M_pgPoolPhysLib (182 << 16) +#define M_pgPoolVirtLib (183 << 16) +#define M_syscallLib (184 << 16) +#define M_pgMgrLib (185 << 16) +#define M_loadRtpLib (186 << 16) +#define M_hookLib (187 << 16) +#define M_unLib (188 << 16) +#define M_salLib (189 << 16) +#define M_sdLib (190 << 16) +#define M_shlLib (191 << 16) +#define M_tlsLib (192 << 16) +#define M_loadFileLib (193 << 16) + +#define M_excLib (194 << 16) +#define M_hrfsLib (195 << 16) +#define M_erfLib (196 << 16) +#define M_coreDumpLib (197 << 16) +#define M_taskPxLib (198 << 16) + +/* + * The host file that contains VxWorks errnos for the host shell is now + * created automatically. Building the target directory target/src/usr will + * force a recreate of the file host/resource/tcl/VxWorksErrnoTbl.tcl + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvwModNumh */ diff --git a/h/vxBusLib.h b/h/vxBusLib.h new file mode 100644 index 0000000..54d34bf --- /dev/null +++ b/h/vxBusLib.h @@ -0,0 +1,90 @@ +/* vxBusLib.h - vxBus definitions and API to OS/middleware */ + +/* Copyright (c) 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,01sep05,mdo Add vxb prefix +01a,06jul05,tor Written +*/ + +#ifndef _INC_VXBUSLIB_H +#define _INC_VXBUSLIB_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* types */ + +typedef struct vxbDev VXB_DEVICE; +typedef struct vxbDev * VXB_DEVICE_ID; + +/* + * Driver Method callback function for device instances. + */ + +typedef STATUS (*VXB_ITERATE_FUNC) + ( + VXB_DEVICE_ID devID, /* device ID */ + void * pArg /* user-supplied argument */ + ); + +/* defines */ + +/* + * when OS/Middleware define or use driver methods, they + * should use the following macros to reference and declare + * the methodID. + */ + +#define VXB_DRIVER_METHOD(NAME) ((UINT32)&NAME##_desc[0]) +#define VXB_DRIVER_METHOD_DECL(NAME) IMPORT char NAME##_desc[]; + +/* forward declarations */ + +/* + * Run the specified driver method on all devices supporting + * it, giving pArg as an argument to each VXB_ITERATE_FUNC */ + +IMPORT STATUS vxbDeviceMethodRun + ( + VXB_DEVICE_ID devID, /* device ID */ + void * pArg + ); + +/* + * Fetch the entry point to a specified driver method + * point for a specific device. + */ + +IMPORT VXB_ITERATE_FUNC vxbDeviceMethodGet + ( + VXB_DEVICE_ID devID, /* device ID */ + UINT32 method /* method to find */ + ); + +/* + * Iterate through devices and/or instances, and perform + * the specified action on each. + */ + +IMPORT STATUS vxbDeviceIterate + ( + VXB_ITERATE_FUNC func, /* function to call */ + void * pArg, /* 2nd argument to func */ + UINT32 flags /* flags to determine what to do */ + ); + +/* + * Show vxBus state + */ + +IMPORT int vxbShow(int verboseLevel); + +#ifdef __cplusplus +} +#endif + +#endif /* _INC_VXBUSLIB_H */ diff --git a/h/vxLib.h b/h/vxLib.h new file mode 100644 index 0000000..7a381f3 --- /dev/null +++ b/h/vxLib.h @@ -0,0 +1,129 @@ +/* vxLib.h - header file for vxLib.c */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02t,26aug03,rec remove SYS_PWR_MGMT conditional +02s,18aug03,dbt Added inclusion of vxSimlinuxLib.h file for Linux VxSim. + Renamed vxSimnt.h in vxSimntLib.h +02r,15jul03,kam rebased to Base6 integration branch +02q,10jul03,rec fix archPwrDown data type +02p,01jul03,rec code review comments +02o,28may03,rec Power management, added vxArchPowerDownSet, vxArchPowerDown, archPwrDown +02n,02apr03,jmp Added inclusion of vxSimnt.h file for Windows VxSim. +02m,25mar03,dbt Added inclusion of vxSimsolarisLib.h file for Solaris VxSim. +02l,14nov01,ahm added vxI86Lib.h for I80x86 family +02k,11oct01,cjj removed Am29K support +02j,17apr00,hk added #include for sh/vxShLib.h. +02i,04jun97,dat added _func_vxMemProbeHook and vxMemArchProbe, SPR 8658 + removed sysMemProbe. +02h,22oct96,spm added comment specifying location of checksum() definition +02g,28feb96,tam added #include for ppc/vxPpcLib.h. +02f,04jul94,tpr added #include for mc68k/vx68kLib.h. +02e,02dec93,pme added Am29K family support. +02d,26jul94,jwt added vxMemProbeAsi() prototype for SPARC; copyright '94. +02c,24sep92,yao added missing arg in vxTas() declaration. +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01f,30jun92,jmm moved checksum() declarations to here from icmpLib.h +01e,26may92,rrr the tree shuffle + -changed includes to have absolute path from h/ +01d,21apr92,ccc added vxTas. +01c,27feb92,wmd added #include for i960/vx960Lib.h. +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01a,05oct90,shl created. +*/ + +#ifndef __INCvxLibh +#define __INCvxLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#if (CPU_FAMILY == MC680X0) +#include "arch/mc68k/vx68kLib.h" +#endif /* (CPU_FAMILY == MC680X0) */ + +#if CPU_FAMILY==I960 +#include "arch/i960/vxI960Lib.h" +#endif /* CPU_FAMILY==I960 */ + +#if CPU_FAMILY==PPC +#include "arch/ppc/vxPpcLib.h" +#endif /* CPU_FAMILY==PPC */ + +#if CPU_FAMILY==SH +#include "arch/sh/vxShLib.h" +#endif /* CPU_FAMILY==SH */ + +#if CPU_FAMILY==I80X86 +#include "arch/i86/vxI86Lib.h" +#endif /* CPU_FAMILY==I80X86 */ + +#if CPU_FAMILY==SIMSPARCSOLARIS +#include "arch/simsolaris/vxSimsolarisLib.h" +#endif /* CPU_FAMILY==SIMSPARCSOLARIS */ + +#if CPU_FAMILY==SIMLINUX +#include "arch/simlinux/vxSimlinuxLib.h" +#endif /* CPU_FAMILY==SIMLINUX */ + +#if CPU_FAMILY==SIMNT +#include "arch/simnt/vxSimntLib.h" +#endif /* CPU_FAMILY==SIMNT */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +/* typedefs */ + +typedef void (*VX_PWR_DOWN)(void); + +extern STATUS vxMemProbe (char * adrs, int mode, int length, char * pVal); +extern BOOL vxTas (void * address); +extern STATUS vxMemArchProbe (void * adrs, int mode, int length, void * pVal); +extern STATUS (* _func_vxMemProbeHook)(void *, int, int, void *); + +extern void vxArchPowerDownSet (VX_PWR_DOWN powerDownRtn); +extern VX_PWR_DOWN vxArchPowerDown; +extern void archPwrDown (void); + +/* checksum is defined in ./target/src/util/cksumLib.c */ +extern u_short checksum (u_short * pAddr, int len); + +#if (CPU_FAMILY == SPARC) +extern STATUS vxMemProbeAsi (char * adrs, int mode, int length, char * pVal, + int asi); +#endif /* CPU_FAMILY == SPARC */ + +#else /* __STDC__ */ + +/* typedefs */ + +typedef void (*VX_PWR_DOWN)(); + +extern STATUS vxMemProbe (); +extern STATUS vxMemArchProbe (); +extern FUNCPTR _func_vxMemProbeHook; +extern BOOL vxTas (); + +extern void vxArchPowerDownSet (); +extern VX_PWR_DOWN vxArchPowerDown; +extern void archPwrDown (); + +/* checksum is defined in ./target/src/util/cksumLib.c */ +extern u_short checksum (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvxLibh */ diff --git a/h/vxStream.h b/h/vxStream.h new file mode 100644 index 0000000..16056bd --- /dev/null +++ b/h/vxStream.h @@ -0,0 +1,230 @@ +/* vxStream.h generated by WIDL Version 2.2.1 on 06-Dec-01 at 11:42:42 AM */ + +#include "comBase.h" + +#ifndef __INCvxStream_h +#define __INCvxStream_h + + +#include "comCoreTypes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int include_vxStream (void); + +#ifndef __ISequentialStream_FWD_DEFINED__ +#define __ISequentialStream_FWD_DEFINED__ +typedef interface ISequentialStream ISequentialStream; +#endif /* __ISequentialStream_FWD_DEFINED__ */ + +#ifndef __IStream_FWD_DEFINED__ +#define __IStream_FWD_DEFINED__ +typedef interface IStream IStream; +#endif /* __IStream_FWD_DEFINED__ */ + +typedef IStream* LPSTREAM; + +struct tagSTATSTG +{ +LPOLESTR pwcsName; +DWORD type; +ULARGE_INTEGER cbSize; +FILETIME mtime; +FILETIME ctime; +FILETIME atime; +DWORD grfMode; +DWORD grfLocksSupported; +CLSID clsid; +DWORD grfStateBits; +DWORD reserved; +}; + +typedef struct tagSTATSTG STATSTG; + +enum tagSTGTY +{ +STGTY_STORAGE = 1, +STGTY_STREAM = 2, +STGTY_LOCKBYTES = 3, +STGTY_PROPERTY = 4, +}; + +typedef enum tagSTGTY STGTY; + +enum tagSTREAM_SEEK +{ +STREAM_SEEK_SET = 0, +STREAM_SEEK_CUR = 1, +STREAM_SEEK_END = 2, +}; + +typedef enum tagSTREAM_SEEK STREAM_SEEK; + +enum tagLOCKTYPE +{ +LOCK_WRITE = 1, +LOCK_EXCLUSIVE = 2, +LOCK_ONLYONCE = 4, +}; + +typedef enum tagLOCKTYPE LOCKTYPE; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, Read, (ISequentialStream* pThis, void* pv, ULONG cb, ULONG* pcbRead)); + +#define ISequentialStream_Read(pThis, pv, cb, pcbRead) pThis->lpVtbl->Read(COM_ADJUST_THIS(pThis), pv, cb, pcbRead) + + COM_VTBL_ENTRY (HRESULT, Write, (ISequentialStream* pThis, const void* pv, ULONG cb, ULONG* pcbWritten)); + +#define ISequentialStream_Write(pThis, pv, cb, pcbWritten) pThis->lpVtbl->Write(COM_ADJUST_THIS(pThis), pv, cb, pcbWritten) + + COM_VTBL_END + } ISequentialStreamVtbl; + +#ifdef __cplusplus + +interface ISequentialStream : public IUnknown +{ +virtual HRESULT Read (void* pv, ULONG cb, ULONG* pcbRead) =0; + +virtual HRESULT Write (const void* pv, ULONG cb, ULONG* pcbWritten) =0; + +}; + +#else + +/* C interface definition for ISequentialStream */ + +interface ISequentialStream + { + const ISequentialStreamVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_ISequentialStream; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, Read, (ISequentialStream* pThis, void* pv, ULONG cb, ULONG* pcbRead)); + +#define ISequentialStream_Read(pThis, pv, cb, pcbRead) pThis->lpVtbl->Read(COM_ADJUST_THIS(pThis), pv, cb, pcbRead) + + COM_VTBL_ENTRY (HRESULT, Write, (ISequentialStream* pThis, const void* pv, ULONG cb, ULONG* pcbWritten)); + +#define ISequentialStream_Write(pThis, pv, cb, pcbWritten) pThis->lpVtbl->Write(COM_ADJUST_THIS(pThis), pv, cb, pcbWritten) + + COM_VTBL_ENTRY (HRESULT, Seek, (IStream* pThis, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition)); + +#define IStream_Seek(pThis, dlibMove, dwOrigin, plibNewPosition) pThis->lpVtbl->Seek(COM_ADJUST_THIS(pThis), dlibMove, dwOrigin, plibNewPosition) + + COM_VTBL_ENTRY (HRESULT, SetSize, (IStream* pThis, ULARGE_INTEGER libNewSize)); + +#define IStream_SetSize(pThis, libNewSize) pThis->lpVtbl->SetSize(COM_ADJUST_THIS(pThis), libNewSize) + + COM_VTBL_ENTRY (HRESULT, CopyTo, (IStream* pThis, IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten)); + +#define IStream_CopyTo(pThis, pstm, cb, pcbRead, pcbWritten) pThis->lpVtbl->CopyTo(COM_ADJUST_THIS(pThis), pstm, cb, pcbRead, pcbWritten) + + COM_VTBL_ENTRY (HRESULT, Commit, (IStream* pThis, DWORD grfCommitFlags)); + +#define IStream_Commit(pThis, grfCommitFlags) pThis->lpVtbl->Commit(COM_ADJUST_THIS(pThis), grfCommitFlags) + + COM_VTBL_ENTRY (HRESULT, Revert, (IStream* pThis)); + +#define IStream_Revert(pThis) pThis->lpVtbl->Revert(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, LockRegion, (IStream* pThis, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)); + +#define IStream_LockRegion(pThis, libOffset, cb, dwLockType) pThis->lpVtbl->LockRegion(COM_ADJUST_THIS(pThis), libOffset, cb, dwLockType) + + COM_VTBL_ENTRY (HRESULT, UnlockRegion, (IStream* pThis, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)); + +#define IStream_UnlockRegion(pThis, libOffset, cb, dwLockType) pThis->lpVtbl->UnlockRegion(COM_ADJUST_THIS(pThis), libOffset, cb, dwLockType) + + COM_VTBL_ENTRY (HRESULT, Stat, (IStream* pThis, STATSTG* pstatstg, DWORD grfStatFlag)); + +#define IStream_Stat(pThis, pstatstg, grfStatFlag) pThis->lpVtbl->Stat(COM_ADJUST_THIS(pThis), pstatstg, grfStatFlag) + + COM_VTBL_ENTRY (HRESULT, Clone, (IStream* pThis, IStream** ppstm)); + +#define IStream_Clone(pThis, ppstm) pThis->lpVtbl->Clone(COM_ADJUST_THIS(pThis), ppstm) + + COM_VTBL_END + } IStreamVtbl; + +#ifdef __cplusplus + +interface IStream : public ISequentialStream +{ +virtual HRESULT Seek (LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition) =0; + +virtual HRESULT SetSize (ULARGE_INTEGER libNewSize) =0; + +virtual HRESULT CopyTo (IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten) =0; + +virtual HRESULT Commit (DWORD grfCommitFlags) =0; + +virtual HRESULT Revert () =0; + +virtual HRESULT LockRegion (ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) =0; + +virtual HRESULT UnlockRegion (ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) =0; + +virtual HRESULT Stat (STATSTG* pstatstg, DWORD grfStatFlag) =0; + +virtual HRESULT Clone (IStream** ppstm) =0; + +}; + +#else + +/* C interface definition for IStream */ + +interface IStream + { + const IStreamVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IStream; + +#ifdef __cplusplus +} +#endif + + + +#endif /* __INCvxStream_h */ + + diff --git a/h/vxWorks.h b/h/vxWorks.h new file mode 100644 index 0000000..b33651e --- /dev/null +++ b/h/vxWorks.h @@ -0,0 +1,129 @@ +/* vxWorks.h - VxWorks standard definitions header */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +04c,30sep05,yvp Reworked SPR 112908 fix. +04b,26sep05,yvp Reworked lib configuration inclusion (SPR 112908). +04a,12aug05,yvp Moved vxLibCfgDefsP.h to h/sys. +03z,25jul05,yvp Moved LIB_BUILD conditional to vxLibCfgDefsP.h. +03y,21jul05,yvp Added include of vxLibCfgDefsP.h and prjComps.h + Updated copyright. Includes now with angle brackets. +03x,28jun05,pad Added definition of _WRS_KERNEL macro (SPR 110428). + Updated copyright notice. +03w,18mar04,job Refactored file to use vxWorksCommon.h +03v,18mar04,mcm Fix for SPR 95066 - moving isascii/toascii to ctype.h +03u,09feb04,dat New release id macros +03t,02dec03,dat removing NULL +03s,14may03,pes PAL conditional compilation cleanup. Phase 2. +03r,25jun03,dcc removed non-ANSI prototypes. +03q,14mar03,dcc added include of types/vxWind.h +03p,27nov01,mrs Fix to conform to ANSI standard for token pasting. +03o,31oct01,tdl Check for preexsiting __P def before defining it +03n,18oct01,dat Chg TOOLCHAIN to TOOL_FAMILY +03m,24sep01,gls Added definition of __P() macro (SPR #28330) +03l,28sep01,rae added #define _WRS_VXWORKS_5_X +03k,19sep01,dat Rework of gnu-diab changes +03j,08sep01,dat Gnu-Diab infrastructure +03i,20aug01,dat Gnu-Diab, added #include toolMacros.h +03h,17feb99,mrs Add C++ support for NULL, (SPR #25079). +03g,25nov97,dat added BUS_TYPE macros +03f,26nov96,vin modified BSD to 44. +03e,23aug94,ism added the MSW() and LSW() macros (SPR#3541) +03d,22sep92,rrr added support for c++ +03c,07sep92,smb added #undef BSD to remove previous definition +03b,11jul92,smb moved CPU definitions to types/vxCpu.h +03a,04jul92,jcf cleaned up. +02q,28jun92,smb reworked for ANSI lib. +02p,22jun92,rrr added MIPS CPU_FAMILY +02o,16jun92,jwt added (CPU_FAMILY = SPARC) for (CPU == SPARClite). +02n,26may92,rrr the tree shuffle +02m,17mar92,yao added _STACK_GROWS_DOWN/UP. added macros ROUND_UP/DOWN, + ALIGNED, MEM_ROUND_UP/DOWN, STACK_ROUND_UP/DOWN, MEM_ALIGNED. + changed copyright notice. included arch.h. moved ffsMSB + definitions for 960 to changed BYTE_ORDER to _BYTE_ORDER, + BIG/LITTLE_ENDIAN to _BIG/LITTLE_ENDIAN. arch960.h. removed + conditional include of r3k/arch.h. +02l,09jan91,wmd conditionalized out ffsMSB inline definition to shut up + ansi warnings. +02k,11nov91,jpb added definition for R3K CPU_FAMILY. +02j,28oct91,wmd for lack of better place - added Intel's 960 ffsMSB + inline definition here. +02i,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed READ, WRITE and UPDATE to O_RDONLY O_WRONLY and ... + -changed copyright notice +02h,25sep91,yao added CPU32. +02g,10sep91,wmd added MIPS to conditional for BIG_ENDIAN byte order. +02f,20aug91,ajm added MIPS_R3k support. +02e,14aug91,del (intel) added I960KA/KB defines. +02d,29apr91,hdn added defines and macros for TRON architecture +02c,31mar91,del added #define of BYTE_ORDER for network etc. +02b,25oct90,dnw changed to allow NULL to be redefined. +02a,25oct90,shl combined CPU test for I960KB and I960CA into one. +...deleted pre v2a history - see RCS +*/ + +#ifndef __INCvxWorksh +#define __INCvxWorksh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * The following block selects configuration defines with which to build + * the sources. Projects built from source take their configuration + * defines from prjComps.h. VxWorks library builds take their configuration + * defines from sys/vxLibCfgDefsP.h, while BSP build see neither. + */ + +#ifdef PRJ_BUILD +#include +#endif /* PRJ_BUILD */ + +#include /* VxWorks library build configuration */ + +/* BUS types */ + +#define BUS_TYPE_NONE NONE +#define BUS_TYPE_VME 1 +#define BUS_TYPE_MULTIBUS 2 +#define BUS_TYPE_PCI 3 + +#define VME_BUS BUS_TYPE_VME /* for backward compat. */ +#define MULTI_BUS BUS_TYPE_MULTIBUS + +#if !defined _WRS_CHANGE_INSN_SET_ENABLE +/* these macros can be used to switch target calls into an + * alternate instruction set and back, e.g., ARM/Thumb, or MIPS16. + * They are null functions by default. +*/ +#define _WRS_CHANGE_INSN_SET(p) {} +#define _WRS_CHANGE_INSN_SET_PTR(p) (p) +#define _WRS_REV_INSN_SET_CHANGE(p) (p) +#endif /* _WRS_CHANGE_INSN_SET */ + +/* The _WRS_KERNEL macro must be defined for kernel-side builds only */ + +#ifndef _WRS_KERNEL +#define _WRS_KERNEL +#endif /* !_WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvxWorksh */ diff --git a/h/vxWorksCommon.h b/h/vxWorksCommon.h new file mode 100644 index 0000000..5599189 --- /dev/null +++ b/h/vxWorksCommon.h @@ -0,0 +1,289 @@ +/* vxWorksCommon.h - VxWorks standard definitions header */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +04c,21jul05,yvp Deleted inclusion of vxLayerConfig.h and prjComps.h + Updated copyright. Includes now with angle brackets. +04b,07jul05,pee Added conditinal inclusion of prjComps for building projects from source +04a,17may05,yvp Moved #include vxLayerConfig.h outside the _ASMLANGUAGE block. +03z,26apr05,yvp Added include for vxLayerConfig.h +03y,23mar05,yvp Added include for vxGlobal.h. +03x,22oct04,mcm Fix for SPR#102899 - min/max namespace pollution. +03w,05may04,dat move version number macros from vxWorks.c to version.h, + added parens around TRUE and FALSE +03v,18mar04,job Removed isascii and toascii macros as these have been + moved to ctypes.h. Refactored into common file. + Moved BUS definitions to kernel only version + Moved *_INSN_* macros to kernel only version. + Moved STACK, ALLOC & CACHE_ALIGN_SIZE macros to types/vxArch.h +03u,09feb04,dat New release id macros +03t,02dec03,dat removing NULL +03s,14may03,pes PAL conditional compilation cleanup. Phase 2. +03r,25jun03,dcc removed non-ANSI prototypes. +03q,14mar03,dcc added include of types/vxWind.h +03p,27nov01,mrs Fix to conform to ANSI standard for token pasting. +03o,31oct01,tdl Check for preexsiting __P def before defining it +03n,18oct01,dat Chg TOOLCHAIN to TOOL_FAMILY +03m,24sep01,gls Added definition of __P() macro (SPR #28330) +03l,28sep01,rae added #define _WRS_VXWORKS_5_X +03k,19sep01,dat Rework of gnu-diab changes +03j,08sep01,dat Gnu-Diab infrastructure +03i,20aug01,dat Gnu-Diab, added #include toolMacros.h +03h,17feb99,mrs Add C++ support for NULL, (SPR #25079). +03g,25nov97,dat added BUS_TYPE macros +03f,26nov96,vin modified BSD to 44. +03e,23aug94,ism added the MSW() and LSW() macros (SPR#3541) +03d,22sep92,rrr added support for c++ +03c,07sep92,smb added #undef BSD to remove previous definition +03b,11jul92,smb moved CPU definitions to types/vxCpu.h +03a,04jul92,jcf cleaned up. +02q,28jun92,smb reworked for ANSI lib. +02p,22jun92,rrr added MIPS CPU_FAMILY +02o,16jun92,jwt added (CPU_FAMILY = SPARC) for (CPU == SPARClite). +02n,26may92,rrr the tree shuffle +02m,17mar92,yao added _STACK_GROWS_DOWN/UP. added macros ROUND_UP/DOWN, + ALIGNED, MEM_ROUND_UP/DOWN, STACK_ROUND_UP/DOWN, MEM_ALIGNED. + changed copyright notice. included arch.h. moved ffsMSB + definitions for 960 to changed BYTE_ORDER to _BYTE_ORDER, + BIG/LITTLE_ENDIAN to _BIG/LITTLE_ENDIAN. arch960.h. removed + conditional include of r3k/arch.h. +02l,09jan91,wmd conditionalized out ffsMSB inline definition to shut up + ansi warnings. +02k,11nov91,jpb added definition for R3K CPU_FAMILY. +02j,28oct91,wmd for lack of better place - added Intel's 960 ffsMSB + inline definition here. +02i,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed READ, WRITE and UPDATE to O_RDONLY O_WRONLY and ... + -changed copyright notice +02h,25sep91,yao added CPU32. +02g,10sep91,wmd added MIPS to conditional for BIG_ENDIAN byte order. +02f,20aug91,ajm added MIPS_R3k support. +02e,14aug91,del (intel) added I960KA/KB defines. +02d,29apr91,hdn added defines and macros for TRON architecture +02c,31mar91,del added #define of BYTE_ORDER for network etc. +02b,25oct90,dnw changed to allow NULL to be redefined. +02a,25oct90,shl combined CPU test for I960KB and I960CA into one. +...deleted pre v2a history - see RCS +*/ + +#ifndef __INCvxWorksCommonh +#define __INCvxWorksCommonh + +#if !defined(EOF) || (EOF!=(-1)) +#define EOF (-1) +#endif + +#if !defined(FALSE) || (FALSE!=(0)) +#define FALSE (0) +#endif + +#if !defined(TRUE) || (TRUE!=(1)) +#define TRUE (1) +#endif + + +#define NONE (-1) /* for times when NULL won't do */ +#define EOS '\0' /* C string terminator */ + + +/* return status values */ + +#define OK 0 +#define ERROR (-1) + +/* timeout defines */ + +#define NO_WAIT 0 +#define WAIT_FOREVER (-1) + +/* low-level I/O input, output, error fd's */ + +#define STD_IN 0 +#define STD_OUT 1 +#define STD_ERR 2 + +/* modes - must match O_RDONLY/O_WRONLY/O_RDWR in ioLib.h! */ + +#define VX_READ 0 +#define VX_WRITE 1 + +/* SYSTEM types */ + +#define V7 1 /* ATT version 7 */ +#define SYS_V 2 /* ATT System 5 */ +#define BSD_4_2 3 /* Berkeley BSD 4.2 */ + +/* network configuration parameters */ + +#define INET /* include internet protocols */ +#undef BSD /* remove any previous definition */ +#define BSD 44 /* BSD 4.4 like OS */ +#define BSDDEBUG /* turn on debug */ +#define GATEWAY /* tables to be initialized for gateway routing */ + +/* common macros */ + +#define MSB(x) (((x) >> 8) & 0xff) /* most signif byte of 2-byte integer */ +#define LSB(x) ((x) & 0xff) /* least signif byte of 2-byte integer*/ +#define MSW(x) (((x) >> 16) & 0xffff) /* most signif word of 2-word integer */ +#define LSW(x) ((x) & 0xffff) /* least signif byte of 2-word integer*/ + +/* swap the MSW with the LSW of a 32 bit integer */ +#define WORDSWAP(x) (MSW(x) | (LSW(x) << 16)) + +#define LLSB(x) ((x) & 0xff) /* 32bit word byte/word swap macros */ +#define LNLSB(x) (((x) >> 8) & 0xff) +#define LNMSB(x) (((x) >> 16) & 0xff) +#define LMSB(x) (((x) >> 24) & 0xff) +#define LONGSWAP(x) ((LLSB(x) << 24) | \ + (LNLSB(x) << 16)| \ + (LNMSB(x) << 8) | \ + (LMSB(x))) + +#define OFFSET(structure, member) /* byte offset of member in structure*/\ + ((int) &(((structure *) 0) -> member)) + +#define MEMBER_SIZE(structure, member) /* size of a member of a structure */\ + (sizeof (((structure *) 0) -> member)) + +#define NELEMENTS(array) /* number of elements in an array */ \ + (sizeof (array) / sizeof ((array) [0])) + +#define FOREVER for (;;) + +/* + * min & max are C++ standard functions which are provided by the user + * side C++ libraries + */ +#if defined(_WRS_KERNEL) || !defined(__cplusplus) +#define max(x, y) (((x) < (y)) ? (y) : (x)) +#define min(x, y) (((x) < (y)) ? (x) : (y)) +#endif /* _WRS_KERNEL || !__cplusplus */ + +/* storage class specifier definitions */ + +#define FAST register +#define IMPORT extern +#define LOCAL static + +#include /* must come before vxArch.h include */ +#include /* must come before include of types */ +#ifndef _ASMLANGUAGE +#include /* must come before include of types */ +#include /* must come between vxArch/vxTypes */ +#include +#include +#include +#endif /* _ASMLANGUAGE */ + + +#define ROUND_UP(x, align) (((int) (x) + (align - 1)) & ~(align - 1)) +#define ROUND_DOWN(x, align) ((int)(x) & ~(align - 1)) +#define ALIGNED(x, align) (((int)(x) & (align - 1)) == 0) + +/* In the kernel, the alignment sizes are a property of the specific + * architecture varient we build for. In user mode, the alignment sizes + * are passed from the kernel to the RTP via the aux_v mechanism, so we + * need to override the definitions here. This needs to be done now, + * rather than in types/vxArch.h because we're referencing variables of + * type size_t, which aren't defined until vxTypes.h + */ + +#ifndef _WRS_KERNEL +#ifndef _ASMLANGUAGE + +/* XXX Note - there is probably an issue with Assembly builds with this + * model. This needs to be fixed. + */ + +extern size_t allocAlignSize; +extern size_t stackAlignSize; +extern size_t cacheAlignSize; +extern size_t vmPageSize; + +#ifdef _ALLOC_ALIGN_SIZE +#undef _ALLOC_ALIGN_SIZE +#endif /* _ALLOC_ALIGN_SIZE */ +#define _ALLOC_ALIGN_SIZE allocAlignSize + +#ifdef _STACK_ALIGN_SIZE +#undef _STACK_ALIGN_SIZE +#endif /* _STACK_ALIGN_SIZE */ +#define _STACK_ALIGN_SIZE stackAlignSize + +#ifdef _CACHE_ALIGN_SIZE +#undef _CACHE_ALIGN_SIZE +#endif /* _CACHE_ALIGN_SIZE */ +#define _CACHE_ALIGN_SIZE cacheAlignSize + +#define VM_PAGE_SIZE_GET() vmPageSize + +#endif /* _ASMLANGUAGE */ +#endif /* _WRS_KERNEL */ + +#if defined(_ASMLANGUAGE) && !defined(_WRS_KERNEL) + +/* XXX only exclude these macros if user mode & assembly build */ + +#else + +#define MEM_ROUND_UP(x) ROUND_UP(x, _ALLOC_ALIGN_SIZE) +#define MEM_ROUND_DOWN(x) ROUND_DOWN(x, _ALLOC_ALIGN_SIZE) +#define STACK_ROUND_UP(x) ROUND_UP(x, _STACK_ALIGN_SIZE) +#define STACK_ROUND_DOWN(x) ROUND_DOWN(x, _STACK_ALIGN_SIZE) +#define MEM_ALIGNED(x) ALIGNED(x, _ALLOC_ALIGN_SIZE) + +#endif /* defined(_ASMLANGUAGE) && !defined(_WRS_KERNEL) */ + +/* + * In case TOOL_FAMILY isn't defined, we shal assume gnu for + * backward compatibility. All this is so we can include + * the toolMacros.h file from the h/tool/$(TOOL_FAMILY) directory + * path. This is needed because for host tool building we can't + * always specify additional include paths for compiler tool + * builds. + */ + +#ifndef TOOL_FAMILY +# define TOOL_FAMILY gnu +#endif + +/* All this to generate a string we can #include */ + +#define TOOL_HDR_STRINGIFY(x) #x +#define TOOL_HDR(tc, file) TOOL_HDR_STRINGIFY(tool/tc/file) +#define TOOL_HEADER(file) TOOL_HDR(TOOL_FAMILY,file) + +/* Now include the correct header file */ + +#include TOOL_HEADER(toolMacros.h) + +#define _WRS_VXWORKS_5_X + +#ifdef _WRS_KERNEL +#include /* kernel version numbers */ +#endif + +/* + * Before we insist on defining __P here make sure there + * aren't any previous occurrences! __P may clash with + * the compiler's definition of it. + */ + +#ifndef __P +#define __P(protos) protos /* Use ANSI C proto */ +#endif + +#endif /* __INCvxWorksCommonh */ diff --git a/h/vxfusion/distIfLib.h b/h/vxfusion/distIfLib.h new file mode 100644 index 0000000..f66e7a5 --- /dev/null +++ b/h/vxfusion/distIfLib.h @@ -0,0 +1,79 @@ +/* distIfLib.h - defines and protypes for interface adapters (VxFusion) */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,24may99,drm adding vxfusion prefix to vxfusion related includes +01c,22feb99,drm removed distNetInput() +01b,12aug98,drm added distNetInput() to function prototypes +01a,01sep97,ur written. +*/ + +#ifndef __INCdistIfLibh +#define __INCdistIfLibh + +#include "vxWorks.h" +#include "vxfusion/distNodeLib.h" +#include "vxfusion/distTBufLib.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* DIST_IF is a structure which is used to communicate information about + * an interface such as MTU size to the upper layers. */ + +/* defines */ + +#define DIST_IF_NAME \ + (pDistIf->distIfName) /* macro to access name field */ + +#define DIST_IF_MTU \ + (pDistIf->distIfMTU) /* macro to access MTU size field */ + +#define DIST_IF_HDR_SZ \ + (pDistIf->distIfHdrSize) /* macro to access network hdr size field */ + +#define DIST_IF_BROADCAST_ADDR \ + (pDistIf->distIfBroadcastAddr) /* macro to access broadcast addr field */ + +#define DIST_IF_RNG_BUF_SZ \ + (pDistIf->distIfRngBufSz) /* macro to access ring buffer size field */ + +#define DIST_IF_MAX_FRAGS \ + (pDistIf->distIfMaxFrags) /* macro to access max fragments field */ + +#define DIST_IF_FILTERADD(mask) \ + ((pDistIf->distIfIoctl) (IOFILTERADD, (mask))) /* macro to call IOCTL */ + +#define DIST_IF_SEND(destId, pTBuf, prio) \ + ((pDistIf->distIfSend) ((destId), (pTBuf), (prio))) /* macro to call send */ + +/* typedefs */ + +typedef struct /* DIST_IF */ + { + char *distIfName; /* name of the interface */ + int distIfMTU; /* MTU size of interface's transport */ + int distIfHdrSize; /* network header size */ + DIST_NODE_ID distIfBroadcastAddr; /* broadcast address for the interface */ + short distIfRngBufSz; /* # buffers in sliding window protocol */ + short distIfMaxFrags; /* max frags a msg can be broken into */ + + int (*distIfIoctl) (int fnc, ...); /* adapter IOCTL function */ + STATUS (*distIfSend) (DIST_NODE_ID destId, DIST_TBUF *pTBuf, int prio); + /* send function of the adapter */ + } DIST_IF; + +extern DIST_IF *pDistIf; /* ptr to DIST_IF struct in adapter */ + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCdistIfLibh */ + diff --git a/h/vxfusion/distLib.h b/h/vxfusion/distLib.h new file mode 100644 index 0000000..3b0c9d2 --- /dev/null +++ b/h/vxfusion/distLib.h @@ -0,0 +1,84 @@ +/* distLib.h - defines for distributed objects (VxFusion) */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,24may99,drm adding vxfusion prefix to VxFusion related includes +01d,10nov98,drm added typedef for DIST_NODE_ID +01c,08sep98,drm added #defines for default startup parameters +01b,12aug98,drm removed #includes for private files. +01a,04sep97,ur written. +*/ + +#ifndef __INCdistLibh +#define __INCdistLibh + +#include "vxWorks.h" +#include "errno.h" +#include "vwModNum.h" +#include "vxfusion/distNodeLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define DIST_MAX_TBUFS_LOG2_DFLT 9 /* max # TBufs log 2 */ +#define DIST_MAX_NODES_LOG2_DFLT 5 /* max # nodes in node DB log 2 */ +#define DIST_MAX_QUEUES_LOG2_DFLT 7 /* max # queues per node log 2 */ +#define DIST_MAX_GROUPS_LOG2_DFLT 6 /* max # msg Q groups log 2*/ +#define DIST_MAX_NAME_DB_ENTRIES_LOG2_DFLT 8 /* max # entries in name DB log 2*/ +#define DIST_MAX_TICKS_TO_WAIT_DFLT (4*sysClkRateGet()) /* max ticks to wait */ + /* for other nodes to */ + /* respond at startup */ + +#define DIST_OBJ_TYPE_MSG_Q 0x0 /* message queue object type */ + +#define DIST_ID_MSG_Q_SERV 0 /* message queue service */ +#define DIST_ID_MSG_Q_GRP_SERV 1 /* message queue group service */ +#define DIST_ID_DNDB_SERV 2 /* distributed name database */ +#define DIST_ID_DGDB_SERV 3 /* distributed group database */ +#define DIST_ID_INCO_SERV 4 /* incorporation protocol */ +#define DIST_ID_GAP_SERV 5 /* group agreement protocol */ + +#define DIST_ID_DIST_LIB 16 /* */ +#define DIST_ID_NODE_LIB 17 /* node library */ +#define DIST_ID_NET_LIB 18 /* network library */ + +#define DIST_CTL_TYPE_MASK 0xff /* control functions 0-255 */ + +#define DIST_CTL_TYPE_DIST DIST_ID_DIST_LIB + +#define DIST_CTL_LOG_HOOK ((0 << 8) | DIST_CTL_TYPE_DIST) +#define DIST_CTL_PANIC_HOOK ((1 << 8) | DIST_CTL_TYPE_DIST) + +#define DIST_NAME_MAX_LENGTH 19 /* max name length for dist name DB */ + +/* typedefs */ + +typedef uint32_t DIST_NODE_ID; /* unique node identifier */ + +#if defined(__STDC__) || defined(__cplusplus) + +STATUS distInit (DIST_NODE_ID me, FUNCPTR ifIntiRtn, void *pIfInitConf, + int maxTBufsLog2, int maxNodesLog2, int maxQueuesLog2, + int maxGroupsLog2, int maxNamesLog2, int waitNTicks); +int distCtl (int function, int argument); + +#else /* __STDC__ */ + +STATUS distInit (); /* function to startup distributed objects */ +int distCtl (); /* control function for distrubted objects */ + +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCdistLibh */ + diff --git a/h/vxfusion/distNameLib.h b/h/vxfusion/distNameLib.h new file mode 100644 index 0000000..940e5d0 --- /dev/null +++ b/h/vxfusion/distNameLib.h @@ -0,0 +1,78 @@ +/* distNameLib.h - distributed name database header (VxFusion) */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,24may99,drm adding vxfusion prefix to VxFusion related includes +01b,12aug98,drm removed #include of private file +01a,10jun97,ur written. +*/ + +#ifndef __INCdistNameLibh +#define __INCdistNameLibh + +#include "vxWorks.h" +#include "vwModNum.h" +#include "vxfusion/distLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define T_DIST_MSG_Q DIST_OBJ_TYPE_MSG_Q /* message queue */ +#define T_DIST_NODE 16 /* node identifier */ +#define T_DIST_UINT8 64 /* 8 bit integer */ +#define T_DIST_UINT16 65 /* 16 bit integer */ +#define T_DIST_UINT32 66 /* 32 bit integer */ +#define T_DIST_UINT64 67 /* 64 bit integer */ +#define T_DIST_FLOAT 68 /* float */ +#define T_DIST_DOUBLE 69 /* double */ + +#define S_distNameLib_NAME_TOO_LONG (M_distNameLib | 1) /* error code */ +#define S_distNameLib_ILLEGAL_LENGTH (M_distNameLib | 2) /* error code */ +#define S_distNameLib_INVALID_WAIT_TYPE (M_distNameLib | 3) /* error code */ +#define S_distNameLib_DATABASE_FULL (M_distNameLib | 4) /* error code */ +#define S_distNameLib_INCORRECT_LENGTH (M_distNameLib | 5) /* error code */ + +/* typedefs */ + +typedef uint16_t DIST_NAME_TYPE; /* type of object assoc. with name */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +void distNameLibInit (void); +STATUS distNameInit (int sizeLog2); +STATUS distNameAdd (char *name, void *value, int len, DIST_NAME_TYPE type); +STATUS distNameFind (char *name, void **pValue, DIST_NAME_TYPE *pType, + int waitType); +STATUS distNameFindByValueAndType (void *value, DIST_NAME_TYPE pType, + char *name, int waitType); +STATUS distNameRemove (char *name); +void distNameShow (void); +void distNameFilterShow (DIST_NAME_TYPE type); + +#else /* __STDC__ */ + +void distNameLibInit (); +STATUS distNameInit (); +STATUS distNameAdd (); +STATUS distNameFind (); +STATUS distNameFindByValueAndType (); +STATUS distNameRemove (); +void distNameShow (); +void distNameFilterShow (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCdistNameLibh */ + diff --git a/h/vxfusion/distNetLib.h b/h/vxfusion/distNetLib.h new file mode 100644 index 0000000..68d2faf --- /dev/null +++ b/h/vxfusion/distNetLib.h @@ -0,0 +1,59 @@ +/* distNetLib.h - distribted objects network layer header file (VxFusion) */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,24may99,drm adding vxfusion prefix to VxFusion related includes +01b,22feb99,drm added distNetInput() +01a,10nov98,drm written. +*/ + +#ifndef __INCdistNetLibh +#define __INCdistNetLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" +#include "vxfusion/distLib.h" +#include "vxfusion/distNodeLib.h" +#include "vxfusion/distTBufLib.h" + +/* defines */ + +#define DIST_CTL_TYPE_NET DIST_ID_NET_LIB +#define DIST_CTL_SERVICE_HOOK ((0 << 8) | DIST_CTL_TYPE_NET) +#define DIST_CTL_SERVICE_CONF ((1 << 8) | DIST_CTL_TYPE_NET) + +/* typedefs */ + +typedef struct /* DIST_SERV_CONF */ + { + int servId; /* ID of service to configure */ + int taskPrio; /* priority of service task */ + int netPrio; /* network priority of service */ + } DIST_SERV_CONF; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +void distNetInput (DIST_NODE_ID nodeIdIn, int prioIn, DIST_TBUF *pTBufIn); + +#else /* __STDC__ */ + +void distNetInput (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdistNetLibh */ + diff --git a/h/vxfusion/distNodeLib.h b/h/vxfusion/distNodeLib.h new file mode 100644 index 0000000..0394d85 --- /dev/null +++ b/h/vxfusion/distNodeLib.h @@ -0,0 +1,45 @@ +/* distNodeLib - distributed objects node library header (VxFusion) */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,24may99,drm adding vxfusion prefix to VxFusion related includes +01b,10nov98,drm added defines for node-related control parameters +01a,21oct97,ur written. +*/ + +#ifndef __INCdistNodeLibh +#define __INCdistNodeLibh + +/* includes */ + +#include "vxWorks.h" +#include "vxfusion/distLib.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* defines */ + +/* Node-related control function codes */ + +#define DIST_CTL_TYPE_NODE DIST_ID_NODE_LIB +#define DIST_CTL_OPERATIONAL_HOOK ((0 << 8) | DIST_CTL_TYPE_NODE) +#define DIST_CTL_CRASHED_HOOK ((1 << 8) | DIST_CTL_TYPE_NODE) +#define DIST_CTL_GET_LOCAL_ID ((2 << 8) | DIST_CTL_TYPE_NODE) +#define DIST_CTL_GET_LOCAL_STATE ((3 << 8) | DIST_CTL_TYPE_NODE) +#define DIST_CTL_RETRY_TIMEOUT ((4 << 8) | DIST_CTL_TYPE_NODE) +#define DIST_CTL_MAX_RETRIES ((5 << 8) | DIST_CTL_TYPE_NODE) +#define DIST_CTL_NACK_SUPPORT ((6 << 8) | DIST_CTL_TYPE_NODE) +#define DIST_CTL_PGGYBAK_UNICST_SUPPORT ((7 << 8) | DIST_CTL_TYPE_NODE) +#define DIST_CTL_PGGYBAK_BRDCST_SUPPORT ((8 << 8) | DIST_CTL_TYPE_NODE) + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCdistNodeLibh */ + diff --git a/h/vxfusion/distStatLib.h b/h/vxfusion/distStatLib.h new file mode 100644 index 0000000..4a52a71 --- /dev/null +++ b/h/vxfusion/distStatLib.h @@ -0,0 +1,70 @@ +/* distStatLib.h - statistics library header (VxFusion) */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,11sep98,drm removed forward function declarations +01a,01sep97,ur written. +*/ + +#ifndef __INCdistStatLibh +#define __INCdistStatLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + +typedef struct /* DIST_STAT */ + { + /* generel */ + u_long tBufShortage; /* times no more tBufs were available */ + u_long memShortage; /* times no memory was available */ + + /* interface layer */ + u_long ifInReceived; /* incoming telegrams received by if layer */ + u_long ifOutReceived; /* outgoing telegrams received by if layer */ + u_long ifInDiscarded; /* incoming telegrams discarded by if layer */ + u_long ifOutDiscarded; /* outgoing telegrams discarded by if layer */ + u_long ifInLength; /* incoming telegrams discarded: wrong length */ + + /* net layer */ + u_long netInReceived; /* incoming pkts received by net layer */ + u_long netOutReceived; /* outgoing pkts received by net layer */ + u_long netInDiscarded; /* incoming pkts discarded by net layer */ + u_long netOutDiscarded; /* outgoing pkts discarded by net layer */ + u_long netReassembled; /* pkts reassembled */ + + /* node layer */ + u_long nodeOutReceived; /* outgoing pkts received */ + u_long nodeInDiscarded; /* pkts discarded */ + u_long nodeAcked; /* pkts aknowleded */ + u_long nodeNotAlive; /* pkts tried to send to node not alive */ + u_long nodePktResend; /* pkts resent */ + u_long nodeFragResend; /* fragments resent */ + u_long nodeDBNoMatch; /* node not found in node DB */ + u_long nodeDBFatal; /* fatal error in node DB */ + + /* msg queue objects */ + u_long msgQInDiscarded; /* #pkts discarded */ + u_long msgQInTooShort; /* #pkts too short */ + + /* msg queue group objects */ + u_long msgQGrpInDiscarded; /* #pkts discarded */ + u_long msgQGrpInTooShort; /* #pkts too short */ + + /* distributed name database */ + u_long dndbInReceived; /* #pkts received by DNDB */ + u_long dndbInDiscarded; /* #pkts discarded */ + + /* incorporation protocol */ + u_long incoInDiscarded; /* #pkts discarded */ + + } DIST_STAT; + +extern DIST_STAT distStat; + +#endif __INCdistStatLibh diff --git a/h/vxfusion/distTBufLib.h b/h/vxfusion/distTBufLib.h new file mode 100644 index 0000000..57ba2bb --- /dev/null +++ b/h/vxfusion/distTBufLib.h @@ -0,0 +1,90 @@ +/* distTBufLibP.h - telegram buffer library header (VxFusion) */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,29oct98,drm moved distTBufLibInit() to private header file +01a,12aug98,drm initial version - portions moved from private header file +*/ + +#ifndef __INCdistTBufLibh +#define __INCdistTBufLibh + +#include "vxWorks.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* defines */ + +#ifdef DIST_DIAGNOSTIC +#define tBufHeader tBufGen.tBufGenHeader +#define tBufHdrHeader tBufGen.tBufGenHeader +#endif + +#define DIST_TBUF_FLAG_HDR 0x01 /* telegram is header */ +#define DIST_TBUF_FLAG_MF 0x02 /* more fragments */ +#define DIST_TBUF_FLAG_BROADCAST 0x04 /* broadcast telegram */ + +#define DIST_TBUF_IS_HDR(pTBuf) \ + ((pTBuf)->tBufFlags & DIST_TBUF_FLAG_HDR) /* check if hdr flag set */ +#define DIST_TBUF_HAS_MF(pTBuf) \ + ((pTBuf)->tBufFlags & DIST_TBUF_FLAG_MF) /* check if MF flag set */ +#define DIST_TBUF_IS_BROADCAST(pTBuf) \ + ((pTBuf)->tBufFlags & DIST_TBUF_FLAG_BROADCAST) /* check if bcast flg set*/ + +#define DIST_TBUF_TTYPE_DTA 0 /* data */ +#define DIST_TBUF_TTYPE_ACK 1 /* acknowledge */ +#define DIST_TBUF_TTYPE_BDTA 2 /* broadcast data */ +#define DIST_TBUF_TTYPE_BACK 3 /* broadcast acknowledge */ +#define DIST_TBUF_TTYPE_BOOTSTRAP 4 /* bootstrap message */ +#define DIST_TBUF_TTYPE_NACK 5 /* negative acknowledge */ + +/* typedefs */ + +typedef struct _DIST_TBUF_GEN /* DIST_TBUF_GEN */ + { + struct _DIST_TBUF_GEN *pTBufGenNext; /* next TBuf */ + struct _DIST_TBUF_GEN *pTBufGenLast; /* previous TBuf */ +#ifdef DIST_DIAGNOSTIC + BOOL tBufGenHeader; +#endif + } DIST_TBUF_GEN; + +typedef struct /* DIST_TBUF */ + { + DIST_TBUF_GEN tBufGen; /* TBufGen struct */ + void *pTBufData; /* pointer to the data */ + uint16_t tBufId; /* id of the packet */ + uint16_t tBufAck; /* id of packet last received and */ + /* ackowledged without error */ + uint16_t tBufSeq; /* sequence number of the fragment */ + uint16_t tBufNBytes; /* number of non-network header data */ + /* bytes */ + uint16_t tBufType; /* type of telegram */ + uint16_t tBufFlags; /* telegrams flags */ + } DIST_TBUF; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +DIST_TBUF *distTBufAlloc (void); +void distTBufFree (DIST_TBUF *pTBuf); + +#else /* __STDC__ */ + +DIST_TBUF *distTBufAlloc (); +void distTBufFree (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCdistTBufLibh */ + diff --git a/h/vxfusion/msgQDistGrpLib.h b/h/vxfusion/msgQDistGrpLib.h new file mode 100644 index 0000000..6b6d0a1 --- /dev/null +++ b/h/vxfusion/msgQDistGrpLib.h @@ -0,0 +1,56 @@ +/* msgQDistGrpLib.h - distributed message queue group library hdr (VxFusion) */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,11jun97,ur written. +*/ + +#ifndef __INCmsgQDistGrpLibh +#define __INCmsgQDistGrpLibh + +#include "vxWorks.h" +#include "vwModNum.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define S_msgQDistGrpLib_NAME_TOO_LONG (M_msgQDistGrpLib | 1) /* error code */ +#define S_msgQDistGrpLib_INVALID_OPTION (M_msgQDistGrpLib | 2) /* error code */ +#define S_msgQDistGrpLib_DATABASE_FULL (M_msgQDistGrpLib | 3) /* error code */ +#define S_msgQDistGrpLib_NO_MATCH (M_msgQDistGrpLib | 4) /* error code */ + +/* typedefs */ + +typedef int DIST_GRP_OPT; /* distributed msgQ group options */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +void msgQDistGrpLibInit (void); +STATUS msgQDistGrpInit (int sizeLog2); +MSG_Q_ID msgQDistGrpAdd (char *grpName, MSG_Q_ID msgQId, DIST_GRP_OPT options); +STATUS msgQDistGrpDelete (char *grpName, MSG_Q_ID msgQId); + +#else /* __STDC__ */ + +void msgQDistGrpLibInit (); +STATUS msgQDistGrpInit (); +MSG_Q_ID msgQDistGrpAdd (); +STATUS msgQDistGrpDelete (); + +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmsgQDistGrpLibh */ + diff --git a/h/vxfusion/msgQDistGrpShow.h b/h/vxfusion/msgQDistGrpShow.h new file mode 100644 index 0000000..b1401f1 --- /dev/null +++ b/h/vxfusion/msgQDistGrpShow.h @@ -0,0 +1,42 @@ +/* msgQDistGrpShow.h - distributed group show library header (VxFusion) */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,09jul97,ur written. +*/ + +#ifndef __INCmsgQDistGrpShowh +#define __INCmsgQDistGrpShowh + +#include "vxWorks.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +void msgQDistGrpShowInit (void); +STATUS msgQDistGrpShow (char *distGrpName); +STATUS msgQDistGrpDbShow (void); + +#else /* __STDC__ */ + +void msgQDistGrpShowInit (); +STATUS msgQDistGrpShow (); +STATUS msgQDistGrpDbShow (); + +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCmsgQDistGrpShowh */ + diff --git a/h/vxfusion/msgQDistLib.h b/h/vxfusion/msgQDistLib.h new file mode 100644 index 0000000..abc7490 --- /dev/null +++ b/h/vxfusion/msgQDistLib.h @@ -0,0 +1,72 @@ +/* msgQDistLib.h - distributed message queue library header (VxFusion) */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,18feb99,drm Added error code S_msgQDistLib_OVERALL_TIMEOUT +01b,12aug98,drm removed #include of private files +01a,06jun97,ur written. +*/ + +#ifndef __INCmsgQDistLibh +#define __INCmsgQDistLibh + +#include "vxWorks.h" +#include "vwModNum.h" +#include "msgQLib.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* defines */ + +#define DIST_MSG_PRI_0 ((VX_TYPE_DIST_OBJ << 8) | 0x0) /* highest priority */ +#define DIST_MSG_PRI_1 ((VX_TYPE_DIST_OBJ << 8) | 0x1) /* priority 1 */ +#define DIST_MSG_PRI_2 ((VX_TYPE_DIST_OBJ << 8) | 0x2) /* priority 2 */ +#define DIST_MSG_PRI_3 ((VX_TYPE_DIST_OBJ << 8) | 0x3) /* priority 3 */ +#define DIST_MSG_PRI_4 ((VX_TYPE_DIST_OBJ << 8) | 0x4) /* priority 4 */ +#define DIST_MSG_PRI_5 ((VX_TYPE_DIST_OBJ << 8) | 0x5) /* priority 5 */ +#define DIST_MSG_PRI_6 ((VX_TYPE_DIST_OBJ << 8) | 0x6) /* priority 6 */ +#define DIST_MSG_PRI_7 ((VX_TYPE_DIST_OBJ << 8) | 0x7) /* lowest priority */ + +#define S_msgQDistLib_INVALID_PRIORITY (M_msgQDistLib | 1) /* error code */ +#define S_msgQDistLib_INVALID_MSG_LENGTH (M_msgQDistLib | 2) /* error code */ +#define S_msgQDistLib_INVALID_TIMEOUT (M_msgQDistLib | 3) /* error code */ +#define S_msgQDistLib_NOT_GROUP_CALLABLE (M_msgQDistLib | 4) /* error code */ +#define S_msgQDistLib_RMT_MEMORY_SHORTAGE (M_msgQDistLib | 5) /* error code */ +#define S_msgQDistLib_OVERALL_TIMEOUT (M_msgQDistLib | 6) /* error code */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +void msgQDistLibInit (void); +STATUS msgQDistInit (int msgQDistMax); +MSG_Q_ID msgQDistCreate (int maxMsgs, int maxMsgLength, int options); +STATUS msgQDistSend (MSG_Q_ID msgQId, char *buffer, UINT nBytes, + int msgQTimeout, int overallTimeout, int priority); +int msgQDistReceive (MSG_Q_ID msgQId, char *buffer, + UINT maxNBytes, int msgQTimeout, int overallTimeout); +int msgQDistNumMsgs (MSG_Q_ID msgQId, int overallTimeout); + +#else /* __STDC__ */ + +void msgQDistLibInit (); +STATUS msgQDistInit (); +MSG_Q_ID msgQDistCreate (); +STATUS msgQDistSend (); +int msgQDistReceive (); +int msgQDistNumMsgs (); + +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCmsgQDistLibh */ + diff --git a/h/vxfusion/msgQDistShow.h b/h/vxfusion/msgQDistShow.h new file mode 100644 index 0000000..f2417cb --- /dev/null +++ b/h/vxfusion/msgQDistShow.h @@ -0,0 +1,38 @@ +/* msgQDisthow.h - distributed message queue show library header (VxFusion) */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,28jul98,drm written. +*/ + +#ifndef __INCmsgQDistShowh +#define __INCmsgQDistShowh + +#include "vxWorks.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +void msgQDistShowInit (void); + +#else /* __STDC__ */ + +void msgQDistShowInit (); + +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCmsgQDistShowh */ + diff --git a/h/vxidl.h b/h/vxidl.h new file mode 100644 index 0000000..6815afc --- /dev/null +++ b/h/vxidl.h @@ -0,0 +1,112 @@ +/* vxidl.h generated by WIDL Version 2.2.1 on 06-Dec-01 at 11:42:45 AM */ + +#include "comBase.h" + +#ifndef __INCvxidl_h +#define __INCvxidl_h + + +#include "comCoreTypes.h" + +#include "comAutomation.h" + +#include "vxStream.h" + +#include "ConnectionPoint.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int include_vxidl (void); + +#ifndef __IMarshal_FWD_DEFINED__ +#define __IMarshal_FWD_DEFINED__ +typedef interface IMarshal IMarshal; +#endif /* __IMarshal_FWD_DEFINED__ */ + +/* vxidl.h -- Copyright (c) Wind River Systems, Inc. 2001 */ +typedef IMarshal* LPMARSHAL; + +typedef struct + { + COM_VTBL_BEGIN + COM_VTBL_ENTRY (HRESULT, QueryInterface, (IUnknown* pThis, REFIID riid, void** ppvObject)); + +#define IUnknown_QueryInterface(pThis, riid, ppvObject) pThis->lpVtbl->QueryInterface(COM_ADJUST_THIS(pThis), riid, ppvObject) + + COM_VTBL_ENTRY (ULONG, AddRef, (IUnknown* pThis)); + +#define IUnknown_AddRef(pThis) pThis->lpVtbl->AddRef(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (ULONG, Release, (IUnknown* pThis)); + +#define IUnknown_Release(pThis) pThis->lpVtbl->Release(COM_ADJUST_THIS(pThis)) + + COM_VTBL_ENTRY (HRESULT, GetUnmarshalClass, (IMarshal* pThis, REFIID riid, void* pv, DWORD dwDestContext, void* pvDestContext, DWORD mshlflags, CLSID* pCid)); + +#define IMarshal_GetUnmarshalClass(pThis, riid, pv, dwDestContext, pvDestContext, mshlflags, pCid) pThis->lpVtbl->GetUnmarshalClass(COM_ADJUST_THIS(pThis), riid, pv, dwDestContext, pvDestContext, mshlflags, pCid) + + COM_VTBL_ENTRY (HRESULT, GetMarshalSizeMax, (IMarshal* pThis, REFIID riid, void* pv, DWORD dwDestContext, void* pvDestContext, DWORD mshlflags, DWORD* pSize)); + +#define IMarshal_GetMarshalSizeMax(pThis, riid, pv, dwDestContext, pvDestContext, mshlflags, pSize) pThis->lpVtbl->GetMarshalSizeMax(COM_ADJUST_THIS(pThis), riid, pv, dwDestContext, pvDestContext, mshlflags, pSize) + + COM_VTBL_ENTRY (HRESULT, MarshalInterface, (IMarshal* pThis, IStream* pStm, REFIID riid, void* pv, DWORD dwDestContext, void* pvDestContext, DWORD mshlflags)); + +#define IMarshal_MarshalInterface(pThis, pStm, riid, pv, dwDestContext, pvDestContext, mshlflags) pThis->lpVtbl->MarshalInterface(COM_ADJUST_THIS(pThis), pStm, riid, pv, dwDestContext, pvDestContext, mshlflags) + + COM_VTBL_ENTRY (HRESULT, UnmarshalInterface, (IMarshal* pThis, IStream* pStm, REFIID riid, void** ppv)); + +#define IMarshal_UnmarshalInterface(pThis, pStm, riid, ppv) pThis->lpVtbl->UnmarshalInterface(COM_ADJUST_THIS(pThis), pStm, riid, ppv) + + COM_VTBL_ENTRY (HRESULT, ReleaseMarshalData, (IMarshal* pThis, IStream* pStm)); + +#define IMarshal_ReleaseMarshalData(pThis, pStm) pThis->lpVtbl->ReleaseMarshalData(COM_ADJUST_THIS(pThis), pStm) + + COM_VTBL_ENTRY (HRESULT, DisconnectObject, (IMarshal* pThis, DWORD dwReserved)); + +#define IMarshal_DisconnectObject(pThis, dwReserved) pThis->lpVtbl->DisconnectObject(COM_ADJUST_THIS(pThis), dwReserved) + + COM_VTBL_END + } IMarshalVtbl; + +#ifdef __cplusplus + +interface IMarshal : public IUnknown +{ +virtual HRESULT GetUnmarshalClass (REFIID riid, void* pv, DWORD dwDestContext, void* pvDestContext, DWORD mshlflags, CLSID* pCid) =0; + +virtual HRESULT GetMarshalSizeMax (REFIID riid, void* pv, DWORD dwDestContext, void* pvDestContext, DWORD mshlflags, DWORD* pSize) =0; + +virtual HRESULT MarshalInterface (IStream* pStm, REFIID riid, void* pv, DWORD dwDestContext, void* pvDestContext, DWORD mshlflags) =0; + +virtual HRESULT UnmarshalInterface (IStream* pStm, REFIID riid, void** ppv) =0; + +virtual HRESULT ReleaseMarshalData (IStream* pStm) =0; + +virtual HRESULT DisconnectObject (DWORD dwReserved) =0; + +}; + +#else + +/* C interface definition for IMarshal */ + +interface IMarshal + { + const IMarshalVtbl * lpVtbl; + }; + +#endif /* __cplusplus */ + +EXTERN_C const IID IID_IMarshal; + +#ifdef __cplusplus +} +#endif + + + +#endif /* __INCvxidl_h */ + + diff --git a/h/vxsimHostLib.h b/h/vxsimHostLib.h new file mode 100644 index 0000000..47dc027 --- /dev/null +++ b/h/vxsimHostLib.h @@ -0,0 +1,76 @@ +/* vxsimHostLib.h - Host/VxSim interface header */ + +/* Copyright 2003-2005 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01y,11jan05,jmp added vxsimHostWdbPipe* routines. +01x,03may04,jeg moved the private APIs to vxsimHostLibP.h file. +01w,14apr04,elp added vxsimHostSimnetParamGet/Set(). +01v,09apr04,jeg removed vxsimBufLib.h header included +01u,08mar04,jmp updated vxsimHostBufInit() & vxsimHostBufDelete() prototypes. + added missing passfs prototypes. +01t,05mar04,dbt Removed simip references. +01s,25nov03,jmp added vxsimHostVirtualMemInfoGet(). +01r,13oct03,jeg added vxsimHostOpendir () prototype. Renamed passFs specific + routines. +01q,07oct03,elp removed vxsimNetArchLib.h, added SIMNET host driver interfaces. +01p,03oct03,dbt Added vxsimHostSimipEnetAddrGet() interface. +01o,01oct03,jmp added MMU routines. +01n,30sep03,elp added vxsimNetArchLib.h. +01m,26sep03,dbt Added SIMIP host driver interfaces. +01l,05sep03,jmp added vxsimHostDllLoad(). +01k,07aug03,jeg added vxsimHostShMemInit () and vxsimHostBusIntGen () + prototypes. +01j,31jul03,jeg added non-volatile RAM routines declarations +01i,31jul03,jmp added VxSim buffer library support. +01h,30jul03,jeg added vxsimHostFtruncate () prototype. +01g,19jun03,jmp added prototype for vxsimHostDbg(). +01f,17jun03,dbt Added vxsimHostTimeGet() & vxsimHostStat() prototypes. +01e,15may03,jmp added vxsimHostCurrentPathGet(). +01d,30apr03,dbt Added timestamp timer prototypes. +01c,04apr03,dbt Removed vxsimHostIntLock(). +01b,04apr03,jeg add common host interface prototypes +01a,30jan03,jmp written. +*/ + +#ifndef __INCvxsimHostLibh +#define __INCvxsimHostLibh + +/* includes */ + +#if (CPU == SIMNT) +#include "arch/simnt/vxsimHostArchLib.h" +#include "arch/simnt/mmuArchLib.h" +#elif (CPU == SIMSPARCSOLARIS) +#include "arch/simsolaris/vxsimHostArchLib.h" +#include "arch/simsolaris/mmuArchLib.h" +#elif (CPU == SIMLINUX) +#include "arch/simlinux/vxsimHostArchLib.h" +#include "arch/simlinux/mmuArchLib.h" +#endif +#include "drv/end/simnetEnd.h" +#include "utime.h" +#include "private/vxsimHostLibP.h" + +/* common host side defined routines */ + +extern FUNCPTR vxsimHostProcAddrGet (char * routine); +extern STATUS vxsimHostDllLoad (char * dllName); +extern STATUS vxsimHostWdbPipeInit (void * inputBuffer, + int * pHostTargetFd, + int * pTargetHostFd, + int * pIntVecNum, + int pipePktMtu); +extern void vxsimHostWdbPipeModeSet (int pipeFd, int newMode); +extern void vxsimHostWdbPipeFlush (int pipeFd); +extern STATUS vxsimHostWdbPipeRead (int pipeFd, void * inputBuffer, + int * pSize); +extern STATUS vxsimHostWdbPipeWrite (int pipeFd, void * buffer, int len); +extern STATUS vxsimHostWdbPipePoll (void); +extern void vxsimHostWdbPipePktDrop (void); +extern void vxsimHostSleep (UINT32 duration); + +#endif /* __INCvxsimHostLibh */ diff --git a/h/vxwErr.h b/h/vxwErr.h new file mode 100644 index 0000000..52ff845 --- /dev/null +++ b/h/vxwErr.h @@ -0,0 +1,55 @@ +// VXWError/vxwErr.h - error handling class + +// Copyright 1995-1999 Wind River Systems, Inc. + +// +// modification history +// -------------------- +// 01c,08jun99,dgp doc: add descrip for correct refgen processing +// 01b,23feb99,fle doc : made it refgen parsable +// 01a,15jun95,srh written. +// + +// DESCRIPTION +// The `VXWError' class provides a generic error handling facility. +// +// INCLUDE FILE: vxwErr.h +// +// SEE ALSO: +// + +#ifndef vxwErr_h +#define vxwErr_h + +#include "errnoLib.h" + +class VXWError + { + public: + VXWError (const char *); + VXWError (const int); + VXWError (const VXWError &); + virtual ~VXWError (); + + const char * why () const + { + return errorMessage_; + } + + protected: + VXWError () + { + } + void makeCopy (const char * s); + const char * errorMessage_; + }; + +void vxwSetErrHandler (void (*)(const VXWError &)); +void vxwThrow (const VXWError & err); + +inline void vxwThrowErrno () + { + vxwThrow (VXWError (errnoGet ())); + } + +#endif /* #ifndef vxwErr_h */ diff --git a/h/vxwLoadLib.h b/h/vxwLoadLib.h new file mode 100644 index 0000000..bda3648 --- /dev/null +++ b/h/vxwLoadLib.h @@ -0,0 +1,342 @@ +// VXWModule/vxwLoadLib.h - object module class + +// Copyright 1995-1999 Wind River Systems, Inc. + +// modification history +// -------------------- +// 01e,08mar99,jdi doc: fixed wrong cross-references. +// 01d,23feb99,fle made it refgen parsable +// 01c,21feb99,jdi added library section, checked in documentation. +// 01b,03oct95,rhp documented. +// 01a,15jun95,srh written. + +// DESCRIPTION +// The `VXWModule' class provides a generic object-module loading +// facility. Any object files in a supported format may be loaded +// into memory, relocated properly, their external references +// resolved, and their external definitions added to the system symbol +// table for use by other modules. Modules may be loaded from any I/O +// stream. +// +// INCLUDE FILE: vxwLoadLib.h +// +// SEE ALSO: usrLib, symLib, VXWMemPart, +// .pG "C++ Development" +// +// SECTION: 1C +// + +#ifndef vxwLoadLib_h +#define vxwLoadLib_h + +#include "vxWorks.h" +#include "loadLib.h" +#include "moduleLib.h" +#include "unldLib.h" +#include "vxwObject.h" +#include "vxwErr.h" + +class VXWModule : virtual public VXWIdObject + { + public: + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWModule::VXWModule - build module object from module ID +// +// Use this constructor to manipulate a module that was not loaded +// using C++ interfaces. The argument is the module +// identifier returned and used by the C interface to the VxWorks +// target-resident load facility. +// +// RETURNS: N/A. +// +// SEE ALSO: loadLib + + VXWModule (MODULE_ID aModuleId) + : mid_ (aModuleId) + { + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWModule::VXWModule - load an object module at specified memory addresses +// +// This constructor reads an object module from , and loads the +// code, data, and BSS segments at the specified load addresses in +// memory set aside by the caller using VXWMemPart::alloc(), or in the +// system memory partition as described below. The module is properly +// relocated according to the relocation commands in the file. +// Unresolved externals will be linked to symbols found in the system +// symbol table. Symbols in the module being loaded can optionally be +// added to the system symbol table. +// +// LINKING UNRESOLVED EXTERNALS +// As the module is loaded, any unresolved external references are resolved +// by looking up the missing symbols in the the system symbol table. +// If found, those references are correctly linked to the new module. +// If unresolved external references cannot be found in the system symbol +// table, then an error message ("undefined symbol: ...") is printed for +// the symbol, but the loading/linking continues. In this case, NULL is +// returned after the module is loaded. +// +// ADDING SYMBOLS TO THE SYMBOL TABLE +// The symbols defined in the module to be loaded may be optionally added +// to the target-resident system symbol table, depending on the value of +// : +// .iP "LOAD_NO_SYMBOLS" 29 +// add no symbols to the system symbol table +// .iP "LOAD_LOCAL_SYMBOLS" +// add only local symbols to the system symbol table +// .iP "LOAD_GLOBAL_SYMBOLS" +// add only external symbols to the system symbol table +// .iP "LOAD_ALL_SYMBOLS" +// add both local and external symbols to the system symbol table +// .iP "HIDDEN_MODULE" +// do not display the module via moduleShow(). +// .LP +// +// In addition, the following symbols are also added to the symbol table +// to indicate the start of each segment: +// _text, _data, and _bss, +// where is the name associated with the fd. +// +// RELOCATION +// The relocation commands in the object module are used to relocate +// the text, data, and BSS segments of the module. The location of each +// segment can be specified explicitly, or left unspecified in which +// case memory is allocated for the segment from the system memory +// partition. This is determined by the parameters , , and +// , each of which can have the following values: +// .iP "NULL" +// no load address is specified, none will be returned; +// .iP "A pointer to LD_NO_ADDRESS" +// no load address is specified, the return address is referenced by the +// pointer; +// .iP "A pointer to an address" +// the load address is specified. +// .LP +// +// The , , and parameters specify where to load +// the text, data, and bss sections respectively. Each of these +// parameters is a pointer to a pointer; for example, ** +// gives the address where the text segment is to begin. +// +// For any of the three parameters, there are two ways to request that +// new memory be allocated, rather than specifying the section's +// starting address: you can either specify the parameter itself as +// NULL, or you can write the constant LD_NO_ADDRESS in place of an +// address. In the second case, this constructor replaces the +// LD_NO_ADDRESS value with the address actually used for each section +// (that is, it records the address at *, *, or +// *). +// +// The double indirection not only permits reporting the addresses +// actually used, but also allows you to specify loading a segment +// at the beginning of memory, since the following cases can be +// distinguished: +// .IP (1) 4 +// Allocate memory for a section (text in this example): == NULL +// .IP (2) +// Begin a section at address zero (the text section, below): * == 0 +// .LP +// Note that loadModule() is equivalent to this routine if all three of the +// segment-address parameters are set to NULL. +// +// COMMON +// Some host compiler/linker combinations internally use another +// storage class known as \f2common\f1. In the C language, +// uninitialized global variables are eventually put in the BSS +// segment. However, in partially linked object modules they are +// flagged internally as common and the static linker on the host +// resolves these and places them in BSS as a final step in creating a +// fully linked object module. However, the VxWorks target-resident +// dynamic loader is most often used to load partially linked object +// modules. When the VxWorks loader encounters a variable labeled as +// common, memory for the variable is allocated, and the variable is +// entered in the system symbol table (if specified) at that address. +// Note that most static loaders have an option that forces resolution +// of the common storage while leaving the module relocatable. +// +// RETURNS: N/A. +// +// SEE ALSO +// .pG "C++ Development" + + VXWModule (int fd, int symFlag, char **ppText, + char **ppData=0, char **ppBss=0) + : mid_ (loadModuleAt (fd, symFlag, ppText, ppData, ppBss)) + { + if (mid_ == NULL) + vxwThrowErrno (); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWModule::VXWModule - load an object module into memory +// +// This constructor loads an object module from the file descriptor +// , and places the code, data, and BSS into memory allocated from +// the system memory pool. +// +// RETURNS: N/A + + VXWModule (int fd, int symFlag) + : mid_ (loadModule (fd, symFlag)) + { + if (mid_ == NULL) + vxwThrowErrno (); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWModule::VXWModule - create and initialize an object module +// +// This constructor creates an object module descriptor. It is usually +// called from another constructor. +// +// The arguments specify the name of the object module file, +// the object module format, and a collection of options . +// +// Space for the new module is dynamically allocated. +// +// RETURNS: N/A + + VXWModule (char *name, int format, int flags) + : mid_ (moduleCreate (name, format, flags)) + { + if (mid_ == 0) + vxwThrowErrno (); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWModule::~VXWModule - unload an object module +// +// This destructor unloads the object module from the target system. +// For a.out and ECOFF format modules, unloading does the following: +// .IP (1) 4 +// It frees the space allocated for text, data, +// and BSS segments, unless VXWModule::VXWModule() was called with specific +// addresses, in which case the application is responsible for freeing space. +// .IP (2) +// It removes all symbols associated with the object module from the +// system symbol table. +// .IP (3) +// It removes the module descriptor from the module list. +// .LP +// +// For other modules of other formats, unloading has similar effects. +// +// Unloading modules with this interface has no effect on breakpoints +// in other modules. +// +// RETURNS: N/A + + ~VXWModule () + { + if (unldByModuleId (mid_, UNLD_KEEP_BREAKPOINTS) != OK) + vxwThrowErrno (); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWModule::flags - get the flags associated with this module +// +// This routine returns the flags associated with its module. +// +// RETURNS: The option flags. + + int flags () const + { + return moduleFlagsGet (mid_); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWModule::info - get information about object module +// +// This routine fills in a MODULE_INFO structure with information about the +// object module. +// +// RETURNS: OK or ERROR. + + STATUS info (MODULE_INFO * pModuleInfo) const + { + return moduleInfoGet (mid_, pModuleInfo); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWModule::name - get the name associated with module +// +// This routine returns a pointer to the name associated with its module. +// +// RETURNS: A pointer to the module name. + + char * name () const + { + return moduleNameGet (mid_); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWModule::segFirst - find the first segment in module +// +// This routine returns information about the first segment of a module +// descriptor. +// +// RETURNS: A pointer to the segment ID. +// +// SEE ALSO: VXWModule::segGet() + + SEGMENT_ID segFirst () const + { + return moduleSegFirst (mid_); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWModule::segGet - get (delete and return) the first segment from module +// +// This routine returns information about the first segment of a module +// descriptor, and then deletes the segment from the module. +// +// RETURNS: A pointer to the segment ID, or NULL if the segment list is empty. +// +// SEE ALSO: VXWModule::segFirst() + + SEGMENT_ID segGet () + { + return moduleSegGet (mid_); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWModule::segNext - find the next segment in module +// +// This routine returns the segment in the list immediately following +// . +// +// RETURNS: A pointer to the segment ID, or NULL if there is no next segment. + + SEGMENT_ID segNext (SEGMENT_ID segmentId) const + { + return moduleSegNext (segmentId); + } + protected: + VXWModule () + { + } + VXWModule (const VXWModule &) + { + } + VXWModule & operator = (const VXWModule &) + { + return *this; + } + virtual void * myValue (); + MODULE_ID mid_; + }; + +#endif /* ifndef vxwLoadLib_h */ diff --git a/h/vxwLstLib.h b/h/vxwLstLib.h new file mode 100644 index 0000000..84647ba --- /dev/null +++ b/h/vxwLstLib.h @@ -0,0 +1,364 @@ +// VXWList/vxwLstLib.h - simple linked list class + +// Copyright 1995-1999 Wind River Systems, Inc. + +// modification history +// -------------------- +// 01e,28mar99,jdi doc: removed mention of support for Booch class. +// 01d,23feb99,fle made it refgen parsable +// 01c,21feb99,jdi added library section, checked in documentation. +// 01b,03oct95,rhp moved "Using" instructions to library man page; +// documented constructors and member fns. +// 01a,15jun95,srh written. + +// DESCRIPTION +// The VXWList class supports the creation and maintenance of a doubly +// linked list. The class contains pointers to the first and last +// nodes in the list, and a count of the number of nodes in the list. +// The nodes in the list are derived from the structure NODE, which +// provides two pointers: `NODE::next' and `NODE::previous'. +// Both the forward and backward chains are terminated with a NULL pointer. +// +// The VXWList class simply manipulates the linked-list data structures; +// no kernel functions are invoked. In particular, linked lists by themselves +// provide no task synchronization or mutual exclusion. If multiple tasks will +// access a single linked list, that list must be guarded with some +// mutual-exclusion mechanism (such as a mutual-exclusion semaphore). +// +// NON-EMPTY LIST: +// .CS +// --------- -------- -------- +// | head--------------->| next----------->| next--------- +// | | | | | | | +// | | ------- prev |<---------- prev | | +// | | | | | | | | +// | tail------ | | ... | ----->| ... | | +// | | | v | v +// |count=2| | ----- | ----- +// --------- | --- | --- +// | - | - +// | | +// ------------------------ +// .CE +// +// EMPTY LIST: +// .CS +// ----------- +// | head------------------ +// | | | +// | tail---------- | +// | | | v +// | count=0 | ----- ----- +// ----------- --- --- +// - - +// .CE +// +// WARNINGS +// Use only single inheritance! This class is an interface to the +// VxWorks library lstLib. More sophisticated alternatives are +// available in the Tools.h++ class libraries. +// +// EXAMPLE +// The following example illustrates how to create a list by deriving +// elements from NODE and putting them on a VXWList. +// +// .CS +// class myListNode : public NODE +// { +// public: +// myListNode () +// { +// } +// private: +// }; +// +// VXWList myList; +// myListNode a, b, c; +// +// NODE * pEl = &c; +// +// void useList () +// { +// myList.add (&a); +// myList.insert (pEl, &b); +// } +// .CE +// +// INCLUDE FILES: vxwLstLib.h +// +// SECTION: 1C +// + +#ifndef vxwLstLib_h +#define vxwLstLib_h + +#include "vxWorks.h" +#include "lstLib.h" +#include "vxwErr.h" + +class VXWList : virtual public LIST + { + public: + +//_ VXWList Public Constructors + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWList::VXWList - initialize a list +// +// This constructor initializes a list as an empty list. +// +// RETURNS: N/A + + VXWList () + { + lstInit (&list_); + } + + VXWList & operator = (const VXWList &); + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWList::VXWList - initialize a list as a copy of another +// +// This constructor builds a new list as a copy of an existing list. +// +// RETURNS: N/A + + VXWList (const VXWList &); + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWList::~VXWList - free up a list +// +// This destructor frees up memory used for nodes. +// +// RETURNS: N/A + + ~VXWList () + { + lstFree (&list_); + } + +//_ VXWList Public Member Functions + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWList::add - add a node to the end of list +// +// This routine adds a specified node to the end of the list. +// +// RETURNS: N/A + + void add (NODE *pNode) + { + lstAdd (&list_, pNode); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWList::concat - concatenate two lists +// +// This routine concatenates the specified list to the end of the current list. +// The specified list is left empty. Either list (or both) can be +// empty at the beginning of the operation. +// +// RETURNS: N/A + + void concat (VXWList &aList) + { + lstConcat (&list_, &aList.list_); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWList::count - report the number of nodes in a list +// +// This routine returns the number of nodes in a specified list. +// +// RETURNS: +// The number of nodes in the list. + + int count () const + { + return lstCount ((LIST *) &list_); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWList::extract - extract a sublist from list +// +// This routine extracts the sublist that starts with and ends +// with . It returns the extracted list. +// +// RETURNS: The extracted sublist. + + LIST extract (NODE *pStart, NODE *pEnd) + { + LIST rVal; + lstExtract (&list_, pStart, pEnd, &rVal); + return rVal; + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWList::find - find a node in list +// +// This routine returns the node number of a specified node (the +// first node is 1). +// +// RETURNS: +// The node number, or +// ERROR if the node is not found. + + int find (NODE *pNode) const + { + return lstFind ((LIST *) &list_, pNode); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWList::first - find first node in list +// +// This routine finds the first node in its list. +// +// RETURNS +// A pointer to the first node in the list, or +// NULL if the list is empty. + + NODE * first () const + { + return lstFirst ((LIST *) &list_); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWList::get - delete and return the first node from list +// +// This routine gets the first node from its list, deletes the node +// from the list, and returns a pointer to the node gotten. +// +// RETURNS +// A pointer to the node gotten, or +// NULL if the list is empty. + + NODE * get () + { + return lstGet (&list_); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWList::insert - insert a node in list after a specified node +// +// This routine inserts a specified node into the list. +// The new node is placed following the list node . +// If is NULL, the node is inserted at the head of the list. +// +// RETURNS: N/A + + void insert (NODE *pPrev, NODE *pNode) + { + lstInsert (&list_, pPrev, pNode); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWList::last - find the last node in list +// +// This routine finds the last node in its list. +// +// RETURNS +// A pointer to the last node in the list, or +// NULL if the list is empty. + + NODE * last () const + { + return lstLast ((LIST *) &list_); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWList::next - find the next node in list +// +// This routine locates the node immediately following a specified node. +// +// RETURNS: +// A pointer to the next node in the list, or +// NULL if there is no next node. + + NODE * next (NODE *pNode) const + { + return lstNext (pNode); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWList::nStep - find a list node steps away from a specified node +// +// This routine locates the node steps away in either direction from +// a specified node. If is positive, it steps toward the tail. If +// is negative, it steps toward the head. If the number of steps is +// out of range, NULL is returned. +// +// RETURNS: +// A pointer to the node steps away, or +// NULL if the node is out of range. + + NODE * nStep (NODE *pNode, int nStep) const + { + return lstNStep (pNode, nStep); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWList::nth - find the Nth node in a list +// +// This routine returns a pointer to the node specified by a number +// where the first node in the list is numbered 1. +// Note that the search is optimized by searching forward from the beginning +// if the node is closer to the head, and searching back from the end +// if it is closer to the tail. +// +// RETURNS: +// A pointer to the Nth node, or +// NULL if there is no Nth node. + + NODE * nth (int nodeNum) const + { + return lstNth ((LIST *) &list_, nodeNum); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWList::previous - find the previous node in list +// +// This routine locates the node immediately preceding the node pointed to +// by . +// +// RETURNS: +// A pointer to the previous node in the list, or +// NULL if there is no previous node. + + NODE * previous (NODE *pNode) const + { + return lstPrevious (pNode); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWList::remove - delete a specified node from list +// +// This routine deletes a specified node from its list. +// +// RETURNS: N/A + + void remove (NODE *pNode) + { + lstDelete (&list_, pNode); + } + protected: + LIST list_; + }; + +#endif /* ifndef vxwLstLib_h */ diff --git a/h/vxwMemPartLib.h b/h/vxwMemPartLib.h new file mode 100644 index 0000000..516e9db --- /dev/null +++ b/h/vxwMemPartLib.h @@ -0,0 +1,286 @@ +// VXWMemPart/vxwMemPartLib.h - memory partition classes + +// Copyright 1995-1999 Wind River Systems, Inc. + +// modification history +// -------------------- +// 01c,08mar99,jdi doc: fixed wrong cross-references. +// 01b,23feb99,fle doc : made it refgen compliant +// 01c,21feb99,jdi added library section, checked in documentation. +// 01b,03oct95,rhp documented. +// 01a,15jun95,srh written. + +// DESCRIPTION +// The `VXWMemPart' class provides core facilities for managing the +// allocation of blocks of memory from ranges of memory called memory +// partitions. +// +// The allocation of memory, using routines such as +// VXWMemPart::alloc(), is done with a first-fit algorithm. Adjacent +// blocks of memory are coalesced when they are freed with +// VXWMemPart::free(). There is also a routine provided for +// allocating memory aligned to a specified boundary from a specific +// memory partition, VXWMemPart::alignedAlloc(). +// +// CAVEATS +// Architectures have various alignment constraints. To provide +// optimal performance, VXWMemPart::alloc() returns a pointer to a +// buffer having the appropriate alignment for the architecture in +// use. The portion of the allocated buffer reserved for system +// bookkeeping, known as the overhead, may vary depending on the +// architecture. +// +// .TS +// center,tab(|); +// lf3 cf3 cf3 +// a n n . +// Architecture | Boundary | Overhead +// _ +// 68K | 4 | 8 +// SPARC | 8 | 12 +// MIPS | 8 | 12 +// i960 | 16 | 16 +// .TE +// +// INCLUDE FILES: vxwMemPartLib.h +// +// SEE ALSO: VXWSem +// +// SECTION: 1C +// + +#ifndef vxwMemPartLib_h +#define vxwMemPartLib_h + +#include "vxWorks.h" +#include "memLib.h" +#include "stdlib.h" +#include "private/memPartLibP.h" +#include "vxwObject.h" +#include "vxwErr.h" + +class VXWMemPart : virtual public VXWIdObject + { + public: + +//_ VXWMemPart Public Constructors + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWMemPart::VXWMemPart - create a memory partition +// +// This constructor creates a new memory partition containing a specified +// memory pool. Partitions can be created to manage +// any number of separate memory pools. +// +// NOTE +// The descriptor for the new partition is allocated out of the system memory +// partition (i.e., with malloc()). +// +// RETURNS: N/A. + + VXWMemPart (char *pool, unsigned poolSize) + : partid_ (memPartCreate (pool, poolSize)) + { + if (partid_ == NULL) + vxwThrowErrno (); + } + +//_ VXWMemPart Public Member Functions + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWMemPart::addToPool - add memory to a memory partition +// +// This routine adds memory to its memory partition. +// The new memory added need not be contiguous with +// memory previously assigned to the partition. +// +// RETURNS: OK or ERROR. + + STATUS addToPool (char *pool, unsigned poolSize) + { + return memPartAddToPool (partid_, pool, poolSize); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWMemPart::alignedAlloc - allocate aligned memory from partition +// +// This routine allocates a buffer of size from its +// partition. Additionally, it ensures that the allocated buffer begins on a +// memory address evenly divisible by . The parameter +// must be a power of 2. +// +// RETURNS: +// A pointer to the newly allocated block, or NULL if the buffer cannot be +// allocated. + + void * alignedAlloc (unsigned nBytes, unsigned alignment) + { + return memPartAlignedAlloc (partid_, nBytes, alignment); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWMemPart::alloc - allocate a block of memory from partition +// +// This routine allocates a block of memory from its partition. +// The size of the block allocated is equal to or greater than . +// +// RETURNS: +// A pointer to a block, or NULL if the call fails. +// +// SEE ALSO: VXWMemPart::free() + + void * alloc (unsigned nBytes) + { + return memPartAlloc (partid_, nBytes); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWMemPart::findMax - find the size of the largest available free block +// +// This routine searches for the largest block in the memory partition free +// list and returns its size. +// +// RETURNS: The size, in bytes, of the largest available block. + + int findMax () const + { + return memPartFindMax (partid_); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWMemPart::free - free a block of memory in partition +// +// This routine returns to the partition's free memory list a block of +// memory previously allocated with VXWMemPart::alloc(). +// +// RETURNS: OK, or ERROR if the block is invalid. +// +// SEE ALSO: VXWMemPart::alloc() + + STATUS free (char *pBlock) + { + return memPartFree (partid_, pBlock); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWMemPart::info - get partition information +// +// This routine takes a pointer to a MEM_PART_STATS structure. +// All the parameters of the structure are filled in with the current partition +// information. +// +// RETURNS: OK if the structure has valid data, otherwise ERROR. +// +// SEE ALSO: VXWMemPart::show() + + STATUS info (MEM_PART_STATS *pPartStats) const + { + return memPartInfoGet (partid_, pPartStats); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWMemPart::options - set the debug options for memory partition +// +// This routine sets the debug options for its memory partition. +// Two kinds of errors are detected: attempts to allocate more memory +// than is available, and bad blocks found when memory is freed. In both +// cases, the error status is returned. There are four error-handling +// options that can be individually selected: +// +// .iP "MEM_ALLOC_ERROR_LOG_FLAG" 8 +// Log a message when there is an error in allocating memory. +// .iP "MEM_ALLOC_ERROR_SUSPEND_FLAG" +// Suspend the task when there is an error in allocating memory (unless +// the task was spawned with the VX_UNBREAKABLE option, in which case it +// cannot be suspended). +// .iP "MEM_BLOCK_ERROR_LOG_FLAG" +// Log a message when there is an error in freeing memory. +// .iP "MEM_BLOCK_ERROR_SUSPEND_FLAG" +// Suspend the task when there is an error in freeing memory (unless +// the task was spawned with the VX_UNBREAKABLE option, in which case it +// cannot be suspended). +// .LP +// +// These options are discussed in detail in the library manual entry for +// memLib. +// +// RETURNS: OK or ERROR. + + STATUS options (unsigned options) + { + return memPartOptionsSet (partid_, options); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWMemPart::realloc - reallocate a block of memory in partition +// +// This routine changes the size of a specified block of memory and returns a +// pointer to the new block. The contents that fit inside the new size (or +// old size if smaller) remain unchanged. The memory alignment of the new +// block is not guaranteed to be the same as the original block. +// +// If is NULL, this call is equivalent to VXWMemPart::alloc(). +// +// RETURNS: +// A pointer to the new block of memory, or NULL if the call fails. + + void * realloc (char *pBlock, int nBytes) + { + return memPartRealloc (partid_, pBlock, nBytes); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWMemPart::show - show partition blocks and statistics +// +// This routine displays statistics about the available and allocated memory +// in its memory partition. It shows the number of bytes, the number +// of blocks, and the average block size in both free and allocated memory, +// and also the maximum block size of free memory. It also shows the number +// of blocks currently allocated and the average allocated block size. +// +// In addition, if is 1, the routine displays a list of all the blocks +// in the free list of the specified partition. +// +// RETURNS: OK or ERROR. + + STATUS show (int type = 0) const + { + return memPartShow (partid_, type); + } + + protected: + VXWMemPart () + { + } + VXWMemPart (PART_ID aPartId) + : partid_ (aPartId) + { + } + VXWMemPart (const VXWMemPart & aMemPart) + : partid_ (aMemPart.partid_) + { + } + VXWMemPart & operator = (const VXWMemPart & aMemPart) + { + partid_ = aMemPart.partid_; + return *this; + } + ~VXWMemPart () + { + } + virtual void * myValue (); + + PART_ID partid_; + }; + +#endif /* ifndef vxwMemPartLib_h */ diff --git a/h/vxwMsgQLib.h b/h/vxwMsgQLib.h new file mode 100644 index 0000000..ffe44d6 --- /dev/null +++ b/h/vxwMsgQLib.h @@ -0,0 +1,435 @@ +// VXWMsgQ/vxwMsgQLib.h - message queue classes + +// Copyright 1995-1999 Wind River Systems, Inc. + +// modification history +// -------------------- +// 01b,23feb99,fle doc : made it refgen compliant +// 01c,21feb99,jdi added library section, checked in documentation. +// 01b,03oct95,rhp documented. +// 01a,15jun95,srh written. + +// DESCRIPTION +// The `VXWMsgQ' class provides message queues, the primary intertask +// communication mechanism within a single CPU. Message queues allow +// a variable number of messages (varying in length) to be queued in +// first-in-first-out (FIFO) order. Any task or interrupt service +// routine can send messages to a message queue. Any task can receive +// messages from a message queue. Multiple tasks can send to and +// receive from the same message queue. Full-duplex communication +// between two tasks generally requires two message queues, one for +// each direction. +// +// CREATING AND USING MESSAGE QUEUES +// The message-queue constructor takes parameters to specify the +// maximum number of messages that can be queued to that message queue and +// the maximum length in bytes of each message. Enough buffer space is +// pre-allocated to accommodate the specified number of messages of +// specified length. +// +// A task or interrupt service routine sends a message to a message +// queue with VXWMsgQ::send(). If no tasks are waiting for messages +// on the message queue, the message is simply added to the buffer of +// messages for that queue. If any tasks are already waiting to +// receive a message from the message queue, the message is +// immediately delivered to the first waiting task. +// +// A task receives a message from a message queue with VXWMsgQ::receive(). +// If any messages are already available in the message queue's buffer, +// the first message is immediately dequeued and returned to the caller. +// If no messages are available, the calling task blocks and joins +// a queue of tasks waiting for messages. This queue of waiting tasks can +// be ordered either by task priority or FIFO, as specified in an option +// parameter when the queue is created. +// +// TIMEOUTS +// Both VXWMsgQ::send() and VXWMsgQ::receive() take timeout +// parameters. When sending a message, if no buffer space is +// available to queue the message, the timeout specifies how many +// ticks to wait for space to become available. When receiving a +// message, the timeout specifies how many ticks to wait if no message +// is immediately available. The parameter can have the +// special values NO_WAIT (0) or WAIT_FOREVER (-1). NO_WAIT means the +// routine should return immediately; WAIT_FOREVER means the routine +// should never time out. +// +// URGENT MESSAGES +// The VXWMsgQ::send() routine allows the priority of a message to be specified +// as either normal (MSG_PRI_NORMAL) or urgent (MSG_PRI_URGENT). Normal +// priority messages are added to the tail of the list of queued messages, +// while urgent priority messages are added to the head of the list. +// +// INCLUDE FILES: vxwMsgQLib.h +// +// SEE ALSO: pipeDrv, msgQSmLib, +// .pG "Basic OS" +// +// SECTION: 1C +// + +#ifndef vxwMsgQLib_h +#define vxwMsgQLib_h + +#include "vxWorks.h" +#include "msgQLib.h" +#include "vxwObject.h" +#include "vxwErr.h" + +class VXWMsgQ : virtual public VXWIdObject + { + public: + +//_ VXWMsgQ Public Constructors + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWMsgQ::VXWMsgQ - create and initialize a message queue +// +// This constructor creates a message queue capable of holding up to +// messages, each up to bytes long. The queue can be created +// with the following options specified as : +// .iP MSG_Q_FIFO 20 +// queue pended tasks in FIFO order. +// .iP MSG_Q_PRIORITY +// queue pended tasks in priority order. +// +// RETURNS: N/A. +// +// ERRNO: +// S_memLib_NOT_ENOUGH_MEMORY +// - unable to allocate memory for message queue and message buffers. +// +// S_intLib_NOT_ISR_CALLABLE +// - called from an interrupt service routine. +// +// SEE ALSO: vxwSmLib + + VXWMsgQ (int maxMsgs, int maxMsgLen, int opts) + : msgq_ (msgQCreate (maxMsgs, maxMsgLen, opts)) + { + if (msgq_ == 0) + vxwThrowErrno (); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWMsgQ::VXWMsgQ - build message-queue object from ID +// +// Use this constructor to manipulate a message queue that was not created +// using C++ interfaces. The argument is the message-queue +// identifier returned and used by the C interface to the VxWorks +// message queue facility. +// +// RETURNS: N/A. +// +// SEE ALSO: msgQLib + + VXWMsgQ (MSG_Q_ID id) + : msgq_ (id) + { + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWMsgQ::~VXWMsgQ - delete message queue +// +// This destructor deletes a message queue. Any task blocked on either +// a VXWMsgQ::send() or VXWMsgQ::receive() is unblocked and receives an error +// from the call with `errno' set to S_objLib_OBJECT_DELETED. +// +// RETURNS: N/A. +// +// ERRNO: +// S_objLib_OBJ_ID_ERROR +// - is invalid. +// +// S_intLib_NOT_ISR_CALLABLE +// - called from an interrupt service routine. + + virtual ~VXWMsgQ () + { + if (msgQDelete (msgq_) != OK) + vxwThrowErrno (); + } + +//_ VXWMsgQ Public Member Functions + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWMsgQ::send - send a message to message queue +// +// This routine sends the message in of length to +// its message queue. If any tasks are already waiting to receive +// messages on the queue, the message is immediately delivered to the +// first waiting task. If no task is waiting to receive messages, the +// message is saved in the message queue. +// +// The parameter specifies the number of ticks to wait for free +// space if the message queue is full. The parameter can also have +// the following special values: +// .iP NO_WAIT 22 +// return immediately, even if the message has not been sent. +// .iP WAIT_FOREVER +// never time out. +// .LP +// +// The parameter specifies the priority of the message being sent. +// The possible values are: +// .iP MSG_PRI_NORMAL 22 +// normal priority; add the message to the tail of the list of queued +// messages. +// .iP MSG_PRI_URGENT +// urgent priority; add the message to the head of the list of queued messages. +// .LP +// +// USE BY INTERRUPT SERVICE ROUTINES +// This routine can be called by interrupt service routines as well as +// by tasks. This is one of the primary means of communication +// between an interrupt service routine and a task. When called from an +// interrupt service routine, must be NO_WAIT. +// +// RETURNS: OK or ERROR. +// +// ERRNO: +// S_objLib_OBJ_DELETED +// - the message queue was deleted while waiting to a send message. +// +// S_objLib_OBJ_UNAVAILABLE +// - is set to NO_WAIT, and the queue is full. +// +// S_objLib_OBJ_TIMEOUT +// - the queue is full for ticks. +// +// S_msgQLib_INVALID_MSG_LENGTH +// - is larger than the set for the message queue. +// +// S_msgQLib_NON_ZERO_TIMEOUT_AT_INT_LEVEL +// - called from an ISR, with not set to NO_WAIT. + + STATUS send (char * buffer, UINT nBytes, int timeout, int pri) + { + return msgQSend (msgq_, buffer, nBytes, timeout, pri); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWMsgQ::receive - receive a message from message queue +// +// This routine receives a message from its message queue. +// The received message is copied into the specified , which is +// in length. If the message is longer than , +// the remainder of the message is discarded (no error indication +// is returned). +// +// The parameter specifies the number of ticks to wait for +// a message to be sent to the queue, if no message is available when +// VXWMsgQ::receive() is called. The parameter can also have +// the following special values: +// .iP NO_WAIT 22 +// return immediately, even if the message has not been sent. +// .iP WAIT_FOREVER +// never time out. +// .LP +// +// WARNING: This routine must not be called by interrupt service routines. +// +// RETURNS: +// The number of bytes copied to , or ERROR. +// +// ERRNO: +// S_objLib_OBJ_DELETED +// - the message queue was deleted while waiting to receive a message. +// +// S_objLib_OBJ_UNAVAILABLE +// - is set to NO_WAIT, and no messages are available. +// +// S_objLib_OBJ_TIMEOUT +// - no messages were received in ticks. +// +// S_msgQLib_INVALID_MSG_LENGTH +// - is less than 0. + + int receive (char * buffer, UINT nBytes, int timeout) + { + return msgQReceive (msgq_, buffer, nBytes, timeout); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWMsgQ::numMsgs - report the number of messages queued +// +// This routine returns the number of messages currently queued to the +// message queue. +// +// RETURNS: +// The number of messages queued, or ERROR. +// +// ERRNO: +// S_objLib_OBJ_ID_ERROR +// - is invalid. + + int numMsgs () const + { + return msgQNumMsgs (msgq_); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWMsgQ::info - get information about message queue +// +// This routine gets information about the state and contents of its message +// queue. The parameter is a pointer to a structure of type MSG_Q_INFO +// defined in msgQLib.h as follows: +// +// .CS +// typedef struct /@ MSG_Q_INFO @/ +// { +// int numMsgs; /@ OUT: number of messages queued @/ +// int numTasks; /@ OUT: number of tasks waiting on msg q @/ +// int sendTimeouts; /@ OUT: count of send timeouts @/ +// int recvTimeouts; /@ OUT: count of receive timeouts @/ +// int options; /@ OUT: options with which msg q was created @/ +// int maxMsgs; /@ OUT: max messages that can be queued @/ +// int maxMsgLength; /@ OUT: max byte length of each message @/ +// int taskIdListMax; /@ IN: max tasks to fill in taskIdList @/ +// int * taskIdList; /@ PTR: array of task IDs waiting on msg q @/ +// int msgListMax; /@ IN: max msgs to fill in msg lists @/ +// char ** msgPtrList; /@ PTR: array of msg ptrs queued to msg q @/ +// int * msgLenList; /@ PTR: array of lengths of msgs @/ +// } MSG_Q_INFO; +// .CE +// +// If the message queue is empty, there may be tasks blocked on receiving. +// If the message queue is full, there may be tasks blocked on sending. +// This can be determined as follows: +// .iP "" 4 +// If is 0, then indicates the number of tasks blocked +// on receiving. +// .iP +// If is equal to , then is the number of +// tasks blocked on sending. +// .iP +// If is greater than 0 but less than , then +// will be 0. +// .LP +// +// A list of pointers to the messages queued and their lengths can be +// obtained by setting and to the addresses of +// arrays to receive the respective lists, and setting to +// the maximum number of elements in those arrays. If either list pointer +// is NULL, no data is returned for that array. +// +// No more than message pointers and lengths are returned, +// although is always returned with the actual number of messages +// queued. +// +// For example, if the caller supplies a and +// with room for 10 messages and sets to 10, but there are 20 +// messages queued, then the pointers and lengths of the first 10 messages in +// the queue are returned in and , but is +// returned with the value 20. +// +// A list of the task IDs of tasks blocked on the message queue can be obtained +// by setting to the address of an array to receive the list, and +// setting to the maximum number of elements in that array. +// If is NULL, then no task IDs are returned. No more than +// task IDs are returned, although is always +// returned with the actual number of tasks blocked. +// +// For example, if the caller supplies a with room for 10 task IDs +// and sets to 10, but there are 20 tasks blocked on the +// message queue, then the IDs of the first 10 tasks in the blocked queue +// are returned in , but is returned with +// the value 20. +// +// Note that the tasks returned in may be blocked for either send +// or receive. As noted above this can be determined by examining . +// The variables and are the counts of +// the number of times VXWMsgQ::send() and VXWMsgQ::receive() (or +// their equivalents in other language bindings) respectively returned +// with a timeout. +// +// The variables , , and are the parameters +// with which the message queue was created. +// +// WARNING +// The information returned by this routine is not static and may be +// obsolete by the time it is examined. In particular, the lists of +// task IDs and/or message pointers may no longer be valid. However, +// the information is obtained atomically, thus it is an accurate +// snapshot of the state of the message queue at the time of the call. +// This information is generally used for debugging purposes only. +// +// WARNING +// The current implementation of this routine locks out interrupts while +// obtaining the information. This can compromise the overall interrupt +// latency of the system. Generally this routine is used for debugging +// purposes only. +// +// RETURNS: OK or ERROR. + + STATUS info (MSG_Q_INFO *pInfo) const + { + return msgQInfoGet (msgq_, pInfo); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWMsgQ::show - show information about a message queue +// +// This routine displays the state and optionally the contents of a message +// queue. +// +// A summary of the state of the message queue is displayed as follows: +// .CS +// Message Queue Id : 0x3f8c20 +// Task Queuing : FIFO +// Message Byte Len : 150 +// Messages Max : 50 +// Messages Queued : 0 +// Receivers Blocked : 1 +// Send timeouts : 0 +// Receive timeouts : 0 +// .CE +// +// If is 1, more detailed information is displayed. +// If messages are queued, they are displayed as follows: +// .CS +// Messages queued: +// # address length value +// 1 0x123eb204 4 0x00000001 0x12345678 +// .CE +// +// If tasks are blocked on the queue, they are displayed as follows: +// .CS +// Receivers blocked: +// +// NAME TID PRI DELAY +// ---------- -------- --- ----- +// tExcTask 3fd678 0 21 +// .CE +// +// RETURNS: OK or ERROR. + + STATUS show (int level) const + { + return msgQShow (msgq_, level); + } + protected: + VXWMsgQ () + { + } + VXWMsgQ (const VXWMsgQ & aMsgQ) + : msgq_ (aMsgQ.msgq_) + { + } + VXWMsgQ & operator = (const VXWMsgQ & aMsgQ) + { + msgq_ = aMsgQ.msgq_; + return *this; + } + virtual void * myValue (); + MSG_Q_ID msgq_; + }; + +#endif // ifndef vxwMsgQLib_h diff --git a/h/vxwMutex.h b/h/vxwMutex.h new file mode 100644 index 0000000..f7aec1b --- /dev/null +++ b/h/vxwMutex.h @@ -0,0 +1,102 @@ +/* vxwMutex.h - simple locking macros for multithread safe iostreams and STL*/ + +/* Copyright 1998 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,16jun01,yvp use brackets with "extern C++" to avoid compiler error. +01h,09nov99,sn prevent locks from being destroyed twice +01g,25feb99,sn wrap the struct defn in extern "C++" +01f,24feb99,sn make sure sem is initialized to zero +01e,09nov98,sn ensure that initialization occurs whether we use + the macros (C) or the methods (C++) +01d,29oct98,sn lazily initialize locks on first use +01c,04sep98,sn added void return type to lock and unlock methods +01b,01sep98,sn vxw_mutex_... macros are now defined for both C and C++ +01a,01may98,sn wrote +*/ + +#ifndef __INCvxwMutexh +#define __INCvxwMutexh + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* There are C files that include this header. We must set everything + * up so that vxw_mutex_t looks like an ordinary struct if + * we're compiling C and a full blown class if its C++. + */ + +/* The following macros take the place of member functions in C code + */ + +#define vxw_mutex_init(_name) (_name).sem = semMCreate (SEM_Q_PRIORITY | \ + SEM_DELETE_SAFE | \ + SEM_INVERSION_SAFE) + /* + * Apparently the iostreams code will sometimes destroy a lock + * explicitly (via vxw_mutex_fini) and implictly (through the + * vxw_mutex destructor). We ensure deletion is only performed + * once. + */ + +#define vxw_mutex_fini(_name) do \ + { \ + if ((_name).sem != 0) \ + { \ + semTake ((_name).sem, WAIT_FOREVER); \ + semDelete ((_name).sem); \ + (_name).sem = 0 ; \ + } \ + } while (0) + +#define vxw_mutex_lock(_name) do \ + { \ + /* initialize on first use: this works around a compiler bug that \ + * may allow a global lock to be taken before its constructor is \ + * called ... */ \ + if ((_name).sem == 0) \ + { \ + vxw_mutex_init(_name); \ + } \ + semTake ((_name).sem, WAIT_FOREVER); \ + } while (0) + +#define vxw_mutex_unlock(_name) do \ + { \ + if ((_name).sem == 0) \ + { \ + vxw_mutex_init(_name); \ + } \ + semGive ((_name).sem); \ + } while (0) + +#ifdef __cplusplus +extern "C++" { +#endif + +struct vxw_mutex_t + { + SEM_ID sem; +#ifdef __cplusplus + vxw_mutex_t () : sem (0) {/* NO-OP for now*/} + ~vxw_mutex_t () {vxw_mutex_fini(*this);} + + void lock () {vxw_mutex_lock(*this);} + void unlock () {vxw_mutex_unlock(*this);} + +#endif + }; + + +#ifdef __cplusplus +} +} +#endif + + +#endif /* __INCvxwMutexh */ diff --git a/h/vxwObject.h b/h/vxwObject.h new file mode 100644 index 0000000..66e3b02 --- /dev/null +++ b/h/vxwObject.h @@ -0,0 +1,20 @@ +/* vxwObject.h - behavior common to all VXW clases */ + +/* Copyright 1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,15jun95,srh written. +*/ + +#ifndef vxwObject_h +#define vxwObject_h + +class VXWIdObject + { + public: + virtual void * myValue () = 0; + }; + +#endif /* ifndef vxwObject_h */ diff --git a/h/vxwRngLib.h b/h/vxwRngLib.h new file mode 100644 index 0000000..3d86830 --- /dev/null +++ b/h/vxwRngLib.h @@ -0,0 +1,251 @@ +// VXWRingBuf/vxwRngLib.h - ring buffer class + +// Copyright 1995-1999 Wind River Systems, Inc. + +// modification history +// -------------------- +// 01b,23feb99,fle doc : made it refgen compliant +// 01d,21feb99,jdi added library section, checked in documentation. +// 01c,03oct95,rhp documented. +// 01b,05feb97,bss fixed SPR #7821 by defining myValue() method. +// 01a,15jun95,srh written. + +// DESCRIPTION +// The `VXWRingBuf' class provides routines for creating and using +// ring buffers, which are first-in-first-out circular buffers. The +// routines simply manipulate the ring buffer data structure; no +// kernel functions are invoked. In particular, ring buffers by +// themselves provide no task synchronization or mutual exclusion. +// +// However, the ring buffer pointers are manipulated in such a way +// that a reader task (invoking VXWRingBuf::get()) and a writer task +// (invoking VXWRingBuf::put()) can access a ring simultaneously +// without requiring mutual exclusion. This is because readers only +// affect a pointer and writers only affect a +// pointer in a ring buffer data structure. However, access by +// multiple readers or writers be interlocked through a +// mutual exclusion mechanism (for example, a mutual-exclusion +// semaphore guarding a ring buffer). +// +// INCLUDE FILES: vxwRngLib.h +// +// SECTION: 1C +// + +#ifndef vxwRngLib_h +#define vxwRngLib_h + +#include "vxWorks.h" +#include "rngLib.h" +#include "vxwObject.h" +#include "vxwErr.h" + +class VXWRingBuf : virtual public VXWIdObject + { + public: +//_ VXWRingBuf Public Constructors + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWRingBuf::VXWRingBuf - create an empty ring buffer +// +// This constructor creates a ring buffer of size , and initializes +// it. Memory for the buffer is allocated from the system memory partition. +// +// RETURNS: N/A. + + VXWRingBuf (int nbytes) + : rid_ (rngCreate (nbytes)) + { + if (rid_ == 0) + vxwThrowErrno (); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWRingBuf::VXWRingBuf - build ring-buffer object from existing ID +// +// Use this constructor to build a ring-buffer object from an existing +// ring buffer. This permits you to use the C++ ring-buffer +// interfaces even if the ring buffer itself was created by a routine +// written in C. +// +// RETURNS: N/A. +// +// SEE ALSO: rngLib + + VXWRingBuf (RING_ID aRingId) + : rid_ (aRingId) + { + } +/////////////////////////////////////////////////////////////////////////////// +// +// VXWRingBuf::~VXWRingBuf - delete ring buffer +// +// This destructor deletes a specified ring buffer. +// Any data in the buffer at the time it is deleted is lost. +// +// RETURNS: N/A + + ~VXWRingBuf () + { + rngDelete (rid_); + } + +//_ VXWRingBuf Public Member Functions + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWRingBuf::get - get characters from ring buffer +// +// This routine copies bytes from the ring buffer into . +// It copies as many bytes as are available in the ring, up to . +// The bytes copied are then removed from the ring. +// +// RETURNS: +// The number of bytes actually received from the ring buffer; +// it may be zero if the ring buffer is empty at the time of the call. + + int get (char * buffer, int maxbytes) + { + return rngBufGet (rid_, buffer, maxbytes); + } +/////////////////////////////////////////////////////////////////////////////// +// +// VXWRingBuf::put - put bytes into ring buffer +// +// This routine puts bytes from into the ring buffer. The +// specified number of bytes is put into the ring, up to the number of +// bytes available in the ring. +// +// RETURNS: +// The number of bytes actually put into the ring buffer; +// it may be less than number requested, even zero, +// if there is insufficient room in the ring buffer at the time of the call. + + int put (char * buffer, int nBytes) + { + return rngBufPut (rid_, buffer, nBytes); + } +/////////////////////////////////////////////////////////////////////////////// +// +// VXWRingBuf::flush - make ring buffer empty +// +// This routine initializes the ring buffer to be empty. +// Any data in the buffer is lost. +// +// RETURNS: N/A + + void flush () + { + rngFlush (rid_); + } +/////////////////////////////////////////////////////////////////////////////// +// +// VXWRingBuf::freeBytes - determine the number of free bytes in ring buffer +// +// This routine determines the number of bytes currently unused in the +// ring buffer. +// +// RETURNS: The number of unused bytes in the ring buffer. + + int freeBytes () const + { + return rngFreeBytes (rid_); + } +/////////////////////////////////////////////////////////////////////////////// +// +// VXWRingBuf::isEmpty - test whether ring buffer is empty +// +// This routine reports on whether the ring buffer is empty. +// +// RETURNS: +// TRUE if empty, FALSE if not. + + BOOL isEmpty () const + { + return rngIsEmpty (rid_); + } +/////////////////////////////////////////////////////////////////////////////// +// +// VXWRingBuf::isFull - test whether ring buffer is full (no more room) +// +// This routine reports on whether the ring buffer is completely full. +// +// RETURNS: +// TRUE if full, FALSE if not. + + BOOL isFull () const + { + return rngIsFull (rid_); + } +/////////////////////////////////////////////////////////////////////////////// +// +// VXWRingBuf::moveAhead - advance ring pointer by bytes +// +// This routine advances the ring buffer input pointer by bytes. +// This makes bytes available in the ring buffer, after having +// been written ahead in the ring buffer with VXWRingBuf::putAhead(). +// +// RETURNS: N/A + + void moveAhead (int n) + { + rngMoveAhead (rid_, n); + } +/////////////////////////////////////////////////////////////////////////////// +// +// VXWRingBuf::nBytes - determine the number of bytes in ring buffer +// +// This routine determines the number of bytes currently in the +// ring buffer. +// +// RETURNS: The number of bytes filled in the ring buffer. + + int nBytes () const + { + return rngNBytes (rid_); + } +/////////////////////////////////////////////////////////////////////////////// +// +// VXWRingBuf::putAhead - put a byte ahead in a ring buffer without moving ring pointers +// +// This routine writes a byte into the ring, but does not move the +// ring buffer pointers. Thus the byte is not yet be available to +// VXWRingBuf::get() calls. The byte is written bytes ahead +// of the next input location in the ring. Thus, an offset of 0 puts +// the byte in the same position as VXWRingBuf::put() would put a +// byte, except that the input pointer is not updated. +// +// Bytes written ahead in the ring buffer with this routine can be +// made available all at once by subsequently moving the ring buffer +// pointers with the routine VXWRingBuf::moveAhead(). +// +// Before calling VXWRingBuf::putAhead(), the caller must verify that at least +// + 1 bytes are available in the ring buffer. +// +// RETURNS: N/A + + void putAhead (char byte, int offset) + { + rngPutAhead (rid_, byte, offset); + } + protected: + VXWRingBuf () + { + } + VXWRingBuf (const VXWRingBuf &) + { + } + VXWRingBuf & operator = (const VXWRingBuf &) + { + return *this; + } + + // Added to fix SPR # 7821. + virtual void * myValue (); + + RING_ID rid_; + }; + +#endif /* ifndef vxwRngLib_h */ diff --git a/h/vxwSemLib.h b/h/vxwSemLib.h new file mode 100644 index 0000000..c7e6c5e --- /dev/null +++ b/h/vxwSemLib.h @@ -0,0 +1,696 @@ +// VXWSem/vxwSemLib.h - semaphore classes + +// Copyright 1995-1999 Wind River Systems, Inc. + +// modification history +// -------------------- +// 01d,08mar99,jdi doc: fixed wrong cross-references. +// 01c,21feb99,jdi added library section, checked in documentation. +// 01b,02oct95,rhp documented. +// 01a,15jun95,srh written. + +// DESCRIPTION +// Semaphores are the basis for synchronization and mutual exclusion in +// VxWorks. They are powerful in their simplicity and form the foundation +// for numerous VxWorks facilities. +// +// Different semaphore types serve different needs, and while the +// behavior of the types differs, their basic interface is the same. +// The VXWSem class provides semaphore routines common to all VxWorks +// semaphore types. For all types, the two basic operations are +// VXWSem::take() and VXWSem::give(), the acquisition or relinquishing +// of a semaphore. +// +// Semaphore creation and initialization is handled by the following classes, +// which inherit the basic operations from `VXWSem': +// +// `VXWBSem' - binary semaphores +// `VXWCSem' - counting semaphores +// `VXWMSem' - mutual exclusion semaphores +// +// Two additional semaphore classes provide semaphores that operate +// over shared memory (with the optional product VxMP). These classes +// also inherit from `VXWSmNameLib'; they are described in vxwSmLib. +// The following are the class names for these shared-memory +// semaphores: +// +// `VXWSmBSem' - shared-memory binary semaphores +// `VXWSmCSem' - shared-memory counting semaphores +// +// Binary semaphores offer the greatest speed and the broadest applicability. +// +// The `VXWSem' class provides all other semaphore operations, including +// routines for semaphore control, deletion, and information. +// +// SEMAPHORE CONTROL +// The VXWSem::take() call acquires a specified semaphore, blocking the calling +// task or making the semaphore unavailable. All semaphore types support a +// timeout on the VXWSem::take() operation. The timeout is specified as the +// number of ticks to remain blocked on the semaphore. Timeouts of +// WAIT_FOREVER and NO_WAIT codify common timeouts. If a VXWSem::take() times +// out, it returns ERROR. Refer to the library of the specific semaphore +// type for the exact behavior of this operation. +// +// The VXWSem::give() call relinquishes a specified semaphore, +// unblocking a pended task or making the semaphore available. Refer +// to the library of the specific semaphore type for the exact +// behavior of this operation. +// +// The VXWSem::flush() call may be used to atomically unblock all +// tasks pended on a semaphore queue; that is, it unblocks all tasks +// before any are allowed to run. It may be thought of as a +// broadcast operation in synchronization applications. The state of +// the semaphore is unchanged by the use of VXWSem::flush(); it is not +// analogous to VXWSem::give(). +// +// SEMAPHORE DELETION +// The VXWSem::~VXWSem() destructor terminates a semaphore and +// deallocates any associated memory. The deletion of a semaphore +// unblocks tasks pended on that semaphore; the routines which were +// pended return ERROR. Take care when deleting semaphores, +// particularly those used for mutual exclusion, to avoid deleting a +// semaphore out from under a task that already has taken (owns) that +// semaphore. Applications should adopt the protocol of only deleting +// semaphores that the deleting task has successfully taken. +// +// SEMAPHORE INFORMATION +// The VXWSem::info() call is a useful debugging aid, reporting all +// tasks blocked on a specified semaphore. It provides a snapshot of +// the queue at the time of the call, but because semaphores are +// dynamic, the information may be out of date by the time it is +// available. As with the current state of the semaphore, use of the +// queue of pended tasks should be restricted to debugging uses only. +// +// INCLUDE FILES: vxwSemLib.h +// +// SEE ALSO: VXWTask, vxwSmLib, +// .pG "Basic OS" +// +// SECTION: 1C +// + + +#ifndef vxwSemLib_h +#define vxwSemLib_h + +#include "vxWorks.h" +#include "semLib.h" +#include "vxwObject.h" +#include "vxwErr.h" +#include "private/semLibP.h" + +class VXWSem : virtual public VXWIdObject + { + public: + +//_ VXWSem Public Constructors + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSem::VXWSem - build semaphore object from semaphore ID +// +// Use this constructor to manipulate a semaphore that was not created +// using C++ interfaces. The argument is the semaphore +// identifier returned and used by the C interface to the VxWorks +// semaphore facility. +// +// RETURNS: N/A +// +// SEE ALSO: semLib + + VXWSem (SEM_ID id) + : sem_ (id) + { + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSem::~VXWSem - delete a semaphore +// +// This destructor terminates and deallocates any memory associated with a +// specified semaphore. Any pended tasks unblock and return ERROR. +// +// WARNING +// Take care when deleting semaphores, particularly those used for +// mutual exclusion, to avoid deleting a semaphore out from under a +// task that already has taken (owns) that semaphore. Applications +// should adopt the protocol of only deleting semaphores that the +// deleting task has successfully taken. +// +// RETURNS: N/A +// +// SEE ALSO +// .pG "Basic OS" + + virtual ~VXWSem () + { + if (semDelete (sem_) != OK) + vxwThrowErrno (); + } + +//_ VXWSem Public Member Functions + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSem::give - give a semaphore +// +// This routine performs the give operation on a specified semaphore. +// Depending on the type of semaphore, the state of the semaphore and of the +// pending tasks may be affected. The behavior of VXWSem::give() is +// discussed fully in the constructor description for the specific semaphore +// type being used. +// +// RETURNS: OK. +// +// SEE ALSO +// VXWCSem::VXWCsem(), VXWBSem::VXWBsem(), VXWMSem::VXWMsem(), +// .pG "Basic OS" + + STATUS give () + { + return semGive (sem_); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSem::take - take a semaphore +// +// This routine performs the take operation on a specified semaphore. +// Depending on the type of semaphore, the state of the semaphore and +// the calling task may be affected. The behavior of VXWSem::take() is +// discussed fully in the constructor description for the specific semaphore +// type being used. +// +// A timeout in ticks may be specified. If a task times out, VXWSem::take() +// returns ERROR. Timeouts of WAIT_FOREVER and NO_WAIT indicate to wait +// indefinitely or not to wait at all. +// +// When VXWSem::take() returns due to timeout, it sets the errno to +// S_objLib_OBJ_TIMEOUT (defined in objLib.h). +// +// The VXWSem::take() routine must not be called from interrupt +// service routines. +// +// RETURNS: OK, or ERROR if the task timed out. +// +// SEE ALSO +// VXWCSem::VXWCsem(), VXWBSem::VXWBsem(), VXWMSem::VXWMsem(), +// .pG "Basic OS" + + STATUS take (int timeout) + { + return semTake (sem_, timeout); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSem::flush - unblock every task pended on a semaphore +// +// This routine atomically unblocks all tasks pended on a specified +// semaphore; that is, all tasks are unblocked before any is allowed +// to run. The state of the underlying semaphore is unchanged. All +// pended tasks will enter the ready queue before having a chance to +// execute. +// +// The flush operation is useful as a means of broadcast in +// synchronization applications. Its use is illegal for mutual-exclusion +// semaphores created with VXWMSem::VXWMSem(). +// +// RETURNS: OK, or ERROR if the operation is not supported. +// +// SEE ALSO +// VXWCSem::VXWCsem(), VXWBSem::VXWBsem(), VXWMSem::VXWMsem(), +// .pG "Basic OS" + + STATUS flush () + { + return semFlush (sem_); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSem::id - reveal underlying semaphore ID +// +// This routine returns the semaphore ID corresponding to a semaphore +// object. The semaphore ID is used by the C interface to VxWorks +// semaphores. +// +// RETURNS: Semaphore ID. +// +// SEE ALSO: semLib + + SEM_ID id () const + { + return sem_; + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSem::info - get a list of task IDs that are blocked on a semaphore +// +// This routine reports the tasks blocked on a specified semaphore. +// Up to task IDs are copied to the array specified by . +// The array is unordered. +// +// WARNING: +// There is no guarantee that all listed tasks are still valid or that new +// tasks have not been blocked by the time VXWSem::info() returns. +// +// RETURNS: The number of blocked tasks placed in . + + STATUS info (int idList[], int maxTasks) const + { + return semInfo (sem_, idList, maxTasks); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSem::show - show information about a semaphore +// +// This routine displays (on standard output) the state and optionally +// the pended tasks of a semaphore. +// +// A summary of the state of the semaphore is displayed as follows: +// .CS +// Semaphore Id : 0x585f2 +// Semaphore Type : BINARY +// Task Queuing : PRIORITY +// Pended Tasks : 1 +// State : EMPTY {Count if COUNTING, Owner if MUTEX} +// .CE +// +// If is 1, more detailed information is displayed. +// If tasks are blocked on the queue, they are displayed in the order +// in which they will unblock, as follows: +// .CS +// NAME TID PRI DELAY +// ---------- -------- --- ----- +// tExcTask 3fd678 0 21 +// tLogTask 3f8ac0 0 611 +// .CE +// +// RETURNS: OK or ERROR. + + STATUS show (int level) const + { + return semShow (sem_, level); + } + + protected: + VXWSem () + { + } + VXWSem & operator = (const VXWSem &) + { + return *this; + } + VXWSem (const VXWSem &) + { + } + virtual void * myValue (); + SEM_ID sem_; + }; + +class VXWCSem : public VXWSem + { + public: +//_ VXWCSem Public Constructors + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWCSem::VXWCSem - create and initialize a counting semaphore +// +// This routine allocates and initializes a counting semaphore. The +// semaphore is initialized to the specified initial count. +// +// The parameter specifies the queuing style for blocked tasks. +// Tasks may be queued on a priority basis or a first-in-first-out basis. +// These options are SEM_Q_PRIORITY and SEM_Q_FIFO, respectively. +// +// A counting semaphore may be viewed as a cell in memory whose contents +// keep track of a count. When a task takes a counting semaphore, using +// VXWSem::take(), subsequent action depends on the state of the count: +// .IP (1) 4 +// If the count is non-zero, it is decremented and the calling task +// continues executing. +// .IP (2) +// If the count is zero, the task is blocked, pending the availability +// of the semaphore. If a timeout is specified and the timeout expires, the +// pended task is removed from the queue of pended tasks and enters the +// ready state with an ERROR status. A pended task is ineligible for CPU +// allocation. Any number of tasks may be pended simultaneously on the same +// counting semaphore. +// .LP +// When a task gives a semaphore, using VXWSem::give(), the next +// available task in the pend queue is unblocked. If no task is +// pending on this semaphore, the semaphore count is incremented. +// Note that if a semaphore is given, and a task is unblocked that is +// of higher priority than the task that called VXWSem::give(), the +// unblocked task preempts the calling task. +// +// A VXWSem::flush() on a counting semaphore atomically unblocks all pended +// tasks in the semaphore queue. Thus, all tasks are made ready before any +// task actually executes. The count of the semaphore remains unchanged. +// +// INTERRUPT USAGE +// Counting semaphores may be given but not taken from interrupt level. +// +// CAVEATS +// There is no mechanism to give back or reclaim semaphores automatically when +// tasks are suspended or deleted. Such a mechanism, though desirable, is not +// currently feasible. Without explicit knowledge of the state of the guarded +// resource or region, reckless automatic reclamation of a semaphore could +// leave the resource in a partial state. Thus, if a task ceases execution +// unexpectedly, as with a bus error, currently owned semaphores are not +// given back, effectively leaving a resource permanently unavailable. The +// mutual-exclusion semaphores provided by `VXWMSem' offer protection from +// unexpected task deletion. +// +// RETURNS: N/A + + VXWCSem (int opts, int count) + : VXWSem (semCCreate (opts, count)) + { + if (sem_ == 0) + vxwThrowErrno (); + } + protected: + VXWCSem () + { + } + VXWCSem (const VXWCSem &) + { + } + VXWCSem & operator = (const VXWCSem &) + { + return *this; + } + }; + +class VXWBSem : public VXWSem + { + public: +//_ VXWBSem Public Constructors + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWBSem::VXWBSem - create and initialize a binary semaphore +// +// This routine allocates and initializes a binary semaphore. The +// semaphore is initialized to the state : either SEM_FULL +// (1) or SEM_EMPTY (0). +// +// The parameter specifies the queuing style for blocked tasks. +// Tasks can be queued on a priority basis or a first-in-first-out basis. +// These options are SEM_Q_PRIORITY and SEM_Q_FIFO, respectively. +// +// Binary semaphores are the most versatile, efficient, and conceptually +// simple type of semaphore. They can be used to: (1) control mutually +// exclusive access to shared devices or data structures, or (2) synchronize +// multiple tasks, or task-level and interrupt-level processes. Binary +// semaphores form the foundation of numerous VxWorks facilities. +// +// A binary semaphore can be viewed as a cell in memory whose contents +// are in one of two states, full or empty. When a task takes a +// binary semaphore, using VXWSem::take(), subsequent action depends +// on the state of the semaphore: +// .IP (1) 4 +// If the semaphore is full, the semaphore is made empty, and the calling task +// continues executing. +// .IP (2) +// If the semaphore is empty, the task is blocked, pending the +// availability of the semaphore. If a timeout is specified and the timeout +// expires, the pended task is removed from the queue of pended tasks +// and enters the ready state with an ERROR status. A pended task +// is ineligible for CPU allocation. Any number of tasks may be pended +// simultaneously on the same binary semaphore. +// .LP +// When a task gives a binary semaphore, using VXWSem::give(), the +// next available task in the pend queue is unblocked. If no task is +// pending on this semaphore, the semaphore becomes full. Note that +// if a semaphore is given, and a task is unblocked that is of higher +// priority than the task that called VXWSem::give(), the unblocked +// task preempts the calling task. +// +// MUTUAL EXCLUSION +// To use a binary semaphore as a means of mutual exclusion, first create it +// with an initial state of full. +// +// Then guard a critical section or resource by taking the semaphore with +// VXWSem::take(), and exit the section or release the resource by giving +// the semaphore with VXWSem::give(). +// +// While there is no restriction on the same semaphore being given, +// taken, or flushed by multiple tasks, it is important to ensure the +// proper functionality of the mutual-exclusion construct. While +// there is no danger in any number of processes taking a semaphore, +// the giving of a semaphore should be more carefully controlled. If +// a semaphore is given by a task that did not take it, mutual +// exclusion could be lost. +// +// SYNCHRONIZATION +// To use a binary semaphore as a means of synchronization, create it +// with an initial state of empty. A task blocks by taking a +// semaphore at a synchronization point, and it remains blocked until +// the semaphore is given by another task or interrupt service +// routine. +// +// Synchronization with interrupt service routines is a particularly +// common need. Binary semaphores can be given, but not taken, from +// interrupt level. Thus, a task can block at a synchronization point +// with VXWSem::take(), and an interrupt service routine can unblock +// that task with VXWSem::give(). +// +// A semFlush() on a binary semaphore atomically unblocks all pended +// tasks in the semaphore queue; that is, all tasks are unblocked at once, +// before any actually execute. +// +// CAVEATS +// There is no mechanism to give back or reclaim semaphores automatically when +// tasks are suspended or deleted. Such a mechanism, though desirable, is not +// currently feasible. Without explicit knowledge of the state of the guarded +// resource or region, reckless automatic reclamation of a semaphore could +// leave the resource in a partial state. Thus, if a task ceases execution +// unexpectedly, as with a bus error, currently owned semaphores will not be +// given back, effectively leaving a resource permanently unavailable. The +// mutual-exclusion semaphores provided by `VXWMSem' offer protection from +// unexpected task deletion. +// +// RETURNS: N/A + + VXWBSem (int opts, SEM_B_STATE iState) + : VXWSem (semBCreate (opts, iState)) + { + if (sem_ == 0) + vxwThrowErrno (); + } + protected: + VXWBSem () + { + } + VXWBSem (const VXWBSem &) + { + } + VXWBSem & operator = (const VXWBSem &) + { + return *this; + } + }; + +class VXWMSem : public VXWSem + { + public: +//_ VXWMSem Public Constructors + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWMSem::VXWMSem - create and initialize a mutual-exclusion semaphore +// +// This routine allocates and initializes a mutual-exclusion semaphore. The +// semaphore state is initialized to full. +// +// Semaphore options include the following: +// .iP SEM_Q_PRIORITY 8 +// Queue pended tasks on the basis of their priority. +// .iP SEM_Q_FIFO +// Queue pended tasks on a first-in-first-out basis. +// .iP SEM_DELETE_SAFE +// Protect a task that owns the semaphore from unexpected deletion. +// This option enables an implicit taskSafe() for each VXWSem::take(), +// and an implicit taskUnsafe() for each VXWSem::give(). +// .iP SEM_INVERSION_SAFE +// Protect the system from priority inversion. With this option, the +// task owning the semaphore executes at the highest priority of the +// tasks pended on the semaphore, if that is higher than its current +// priority. This option must be accompanied by the SEM_Q_PRIORITY +// queuing mode. +// .LP +// +// Mutual-exclusion semaphores offer convenient options suited for +// situations that require mutually exclusive access to resources. +// Typical applications include sharing devices and protecting data +// structures. Mutual-exclusion semaphores are used by many +// higher-level VxWorks facilities. +// +// The mutual-exclusion semaphore is a specialized version of the +// binary semaphore, designed to address issues inherent in mutual +// exclusion, such as recursive access to resources, priority +// inversion, and deletion safety. The fundamental behavior of the +// mutual-exclusion semaphore is identical to the binary semaphore as +// described for VXWBSem::VXWBSem(), except for the following +// restrictions: +// +// .iP +// It can only be used for mutual exclusion. +// .iP +// It can only be given by the task that took it. +// .iP +// It may not be taken or given from interrupt level. +// .iP +// The VXWSem::flush() operation is illegal. +// .LP +// +// These last two operations have no meaning in mutual-exclusion situations. +// +// RECURSIVE RESOURCE ACCESS +// +// A special feature of the mutual-exclusion semaphore is that it may +// be taken "recursively;" that is, it can be taken more than once by +// the task that owns it before finally being released. Recursion is +// useful for a set of routines that need mutually exclusive access to +// a resource, but may need to call each other. +// +// Recursion is possible because the system keeps track of which task +// currently owns a mutual-exclusion semaphore. Before being +// released, a mutual-exclusion semaphore taken recursively must be +// given the same number of times it has been taken; this is tracked +// by means of a count which increments with each VXWSem::take() +// and decrements with each VXWSem::give(). +// +// PRIORITY-INVERSION SAFETY +// If the option SEM_INVERSION_SAFE is selected, the library adopts a +// priority-inheritance protocol to resolve potential occurrences of +// "priority inversion," a problem stemming from the use semaphores for +// mutual exclusion. Priority inversion arises when a higher-priority task +// is forced to wait an indefinite period of time for the completion of a +// lower-priority task. +// +// Consider the following scenario: T1, T2, and T3 are tasks of high, +// medium, and low priority, respectively. T3 has acquired some +// resource by taking its associated semaphore. When T1 preempts T3 +// and contends for the resource by taking the same semaphore, it +// becomes blocked. If we could be assured that T1 would be blocked +// no longer than the time it normally takes T3 to finish with the +// resource, the situation would not be problematic. However, the +// low-priority task is vulnerable to preemption by medium-priority +// tasks; a preempting task, T2, could inhibit T3 from relinquishing +// the resource. This condition could persist, blocking T1 for an +// indefinite period of time. +// +// The priority-inheritance protocol solves the problem of priority +// inversion by elevating the priority of T3 to the priority of T1 +// during the time T1 is blocked on T3. This protects T3, and +// indirectly T1, from preemption by T2. Stated more generally, the +// priority-inheritance protocol assures that a task which owns a +// resource executes at the priority of the highest priority task +// blocked on that resource. When execution is complete, the task +// gives up the resource and returns to its normal, or standard, +// priority. Hence, the "inheriting" task is protected from +// preemption by any intermediate-priority tasks. +// +// The priority-inheritance protocol also takes into consideration a task's +// ownership of more than one mutual-exclusion semaphore at a time. Such a +// task will execute at the priority of the highest priority task blocked on +// any of the resources it owns. The task returns to its normal priority +// only after relinquishing all of its mutual-exclusion semaphores that have +// the inversion-safety option enabled. +// +// SEMAPHORE DELETION +// The VXWSem::~VXWSem() destructor terminates a semaphore and deallocates any +// associated memory. The deletion of a semaphore unblocks tasks pended +// on that semaphore; the routines which were pended return ERROR. Take +// special care when deleting mutual-exclusion semaphores to avoid +// deleting a semaphore out from under a task that already owns (has +// taken) that semaphore. Applications should adopt the protocol of only +// deleting semaphores that the deleting task owns. +// +// TASK-DELETION SAFETY +// If the option SEM_DELETE_SAFE is selected, the task owning the semaphore +// is protected from deletion as long as it owns the semaphore. This +// solves another problem endemic to mutual exclusion. Deleting a task +// executing in a critical region can be catastrophic. The resource could be +// left in a corrupted state and the semaphore guarding the resource would be +// unavailable, effectively shutting off all access to the resource. +// +// As discussed in taskLib, the primitives taskSafe() and taskUnsafe() +// offer one solution, but as this type of protection goes hand in +// hand with mutual exclusion, the mutual-exclusion semaphore provides +// the option SEM_DELETE_SAFE, which enables an implicit taskSafe() +// with each VXWSem::take(), and a taskUnsafe() with each +// VXWSem::give(). This convenience is also more efficient, as the +// resulting code requires fewer entrances to the kernel. +// +// CAVEATS +// There is no mechanism to give back or reclaim semaphores automatically when +// tasks are suspended or deleted. Such a mechanism, though desirable, is not +// currently feasible. Without explicit knowledge of the state of the guarded +// resource or region, reckless automatic reclamation of a semaphore could +// leave the resource in a partial state. Thus if a task ceases execution +// unexpectedly, as with a bus error, currently owned semaphores will not be +// given back, effectively leaving a resource permanently unavailable. The +// SEM_DELETE_SAFE option partially protects an application, to the extent +// that unexpected deletions will be deferred until the resource is released. +// +// RETURNS: N/A +// +// SEE ALSO: taskSafe(), taskUnsafe() + + VXWMSem (int opts) + : VXWSem (semMCreate (opts)) + { + if (sem_ == 0) + vxwThrowErrno (); + } + +//_ VXWMSem Public Member Functions + +////////////////////////////////////////////////////////////////////////////// +// +// VXWMSem::giveForce - give a mutual-exclusion semaphore without restrictions +// +// This routine gives a mutual-exclusion semaphore, regardless of semaphore +// ownership. It is intended as a debugging aid only. +// +// The routine is particularly useful when a task dies while holding some +// mutual-exclusion semaphore, because the semaphore can be resurrected. The +// routine gives the semaphore to the next task in the pend queue, or makes +// the semaphore full if no tasks are pending. In effect, execution +// continues as if the task owning the semaphore had actually given the +// semaphore. +// +// CAVEATS +// Use this routine should only as a debugging aid, when the condition of +// the semaphore is known. +// +// RETURNS: OK. +// +// SEE ALSO: VXWSem::give() + + STATUS giveForce () + { + return semMGiveForce (sem_); + } + protected: + VXWMSem () + { + } + VXWMSem (const VXWMSem &) + { + } + VXWMSem & operator = (const VXWMSem &) + { + return *this; + } + }; + +#endif /* ifndef vxwSemLib_h */ diff --git a/h/vxwSmLib.h b/h/vxwSmLib.h new file mode 100644 index 0000000..7b2d2f7 --- /dev/null +++ b/h/vxwSmLib.h @@ -0,0 +1,453 @@ +// VXWSm/vxwSmLib.h - support for shared memory objects + +// Copyright 1995-1999 Wind River Systems, Inc. + +// modification history +// -------------------- +// 01d,09apr99,fle added it to the doc build +// 01c,21feb99,jdi added library section, checked in documentation. +// 01b,02oct95,rhp documented. +// 01a,15jun95,srh written. + +// DESCRIPTION +// This library defines wrapper classes for VxWorks shared-memory +// objects: `VXWSmBSem' (shared-memory binary semaphores), `VXWSmCSem' +// (shared-memory counting semaphores), `VXWSmMsgQ' (shared-memory +// message queues), `VXWSmMemPart' (shared memory partitions), and +// `VXWSmMemBlock' (shared memory blocks). +// +// INHERITANCE +// All of the shared-memory object wrappers inherit the public members +// of `VXWSmNameLib'. +// +// The `VXWSmBSem' and `VXWSmCSem' classes also inherit from `VXWSem'; +// `VXWSmMsgQ' also inherits from `VXWMsgQ'; `VXWSmMemPart' also +// inherits from `VXWMemPArt'. +// +// INCLUDE FILES: vxwSmLib.h +// +// SEE ALSO +// vxwSmNameLib, vxwMsgQLib, vxwMemPartLib, vxwSemLib, +// .pG "Shared-Memory Objects" +// +// SECTION: 1C +// + +#ifndef vxwSmLib_h +#define vxwSmLib_h + +#include "vxWorks.h" +#include "memLib.h" +#include "smMemLib.h" +#include "msgQSmLib.h" +#include "semLib.h" +#include "semSmLib.h" +#include "smNameLib.h" +#include "vxwObject.h" +#include "vxwMemPartLib.h" +#include "vxwMsgQLib.h" +#include "vxwSemLib.h" +#include "vxwSmNameLib.h" +#include "vxwErr.h" +#include "private/semLibP.h" + +class VXWSmSem : public VXWSem, public VXWSmName +{ +protected: + VXWSmSem (SEM_ID aSemId) + : VXWSem (aSemId) + { + } + VXWSmSem () + { + } + VXWSmSem (const VXWSmSem & ) + { + } + const VXWSmSem & operator = (const VXWSmSem &) + { + return *this; + } +}; + +class VXWSmBSem : public VXWSmSem +{ +public: + +//_ VXWSmBSem Public Constructors + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSmBSem::VXWSmBSem - create and initialize binary shared-memory semaphore (VxMP Option) +// +// This routine allocates and initializes a shared memory binary semaphore. +// The semaphore is initialized to an initial state of either +// SEM_FULL (available) or SEM_EMPTY (not available). The shared semaphore +// structure is allocated from the shared semaphore dedicated memory +// partition. Use the optional argument to identify the new +// semaphore by name. +// +// The queuing style for blocked tasks is set by ; the only +// supported queuing style for shared memory semaphores is first-in-first-out, +// selected by SEM_Q_FIFO. +// +// The maximum number of shared memory semaphores (binary plus counting) that +// can be created is SM_OBJ_MAX_SEM, defined in configAll.h. +// +// AVAILABILITY +// This routine depends on code distributed as a component of the unbundled +// shared memory support option, VxMP. +// +// RETURNS: N/A. +// +// ERRNO: +// S_smMemLib_NOT_ENOUGH_MEMORY +// S_semLib_INVALID_QUEUE_TYPE +// S_semLib_INVALID_STATE +// S_smObjLib_LOCK_TIMEOUT +// +// SEE ALSO: vxwSemLib, vxwSmNameLib + + VXWSmBSem (int opts, SEM_B_STATE istate, char * name = 0) + : VXWSmSem (semBSmCreate (opts, istate)) + { + if (sem_ == 0) + vxwThrowErrno (); + if (name != 0 && nameSet (name) != OK) + vxwThrowErrno (); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSmBSem::VXWSmBSem - build a binary shared-memory semaphore object (VxMP Option) +// +// This routine builds a shared-memory binary semaphore object around +// an existing named shared-memory semaphore. The argument +// identifies the existing semaphore; specifies whether to +// wait if the desired name is not found in the shared-memory name +// database; see VXWSmName::nameGet(). +// +// Use this routine to take advantage of the VXWSmBSem class while +// working with semaphores created by some other means (for example, +// previously existing C code). +// +// RETURNS: N/A. +// +// SEE ALSO: VXWSmName::nameGet() + + VXWSmBSem (char * name, int waitType) + { + int type; + + if (smNameFind (name, (void **)(&sem_), &type, waitType) != OK) + vxwThrowErrno (); + } + virtual STATUS nameSet (char * name); +protected: + VXWSmBSem () + { + } + VXWSmBSem (const VXWSmBSem &) + { + } + VXWSmBSem & operator = (const VXWSmBSem &) + { + return *this; + } +}; + +class VXWSmCSem : public VXWSmSem +{ +public: + +//_ VXWSmCSem Public Constructors + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSmCSem::VXWSmCSem - create and initialize a shared memory counting semaphore (VxMP Option) +// +// This routine allocates and initializes a shared memory counting +// semaphore. The initial count value of the semaphore (the number of +// times the semaphore must be taken before it can be given) is specified +// by . +// +// The queuing style for blocked tasks is set by ; the only +// supported queuing style for shared memory semaphores is first-in-first-out, +// selected by SEM_Q_FIFO. +// +// The maximum number of shared memory semaphores (binary plus counting) that +// can be created is SM_OBJ_MAX_SEM, defined in configAll.h. +// +// AVAILABILITY +// This routine depends on code distributed as a component of the unbundled +// shared memory support option, VxMP. +// +// RETURNS: N/A. +// +// ERRNO: +// S_smMemLib_NOT_ENOUGH_MEMORY +// S_semLib_INVALID_QUEUE_TYPE +// S_smObjLib_LOCK_TIMEOUT +// +// SEE ALSO: vxwSemLib, vxwSmNameLib + + VXWSmCSem (int opts, int icount, char * name = 0) + : VXWSmSem (semCSmCreate (opts, icount)) + { + if (sem_ == 0) + vxwThrowErrno (); + if (name != 0 && nameSet (name) != OK) + vxwThrowErrno (); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSmCSem::VXWSmCSem - build a shared-memory counting semaphore object (VxMP Option) +// +// This routine builds a shared-memory semaphore object around +// an existing named shared-memory counting semaphore. The argument +// identifies the existing semaphore, and specifies whether to +// wait if the desired name is not found in the shared-memory name +// database; see VXWSmName::nameGet(). +// +// Use this routine to take advantage of the VXWSmBSem class while +// working with semaphores created by some other means (for example, +// previously existing C code). +// +// RETURNS: N/A. +// +// SEE ALSO: VXWSmName::nameGet() + + VXWSmCSem (char * name, int waitType) + { + int type; + + if (smNameFind (name, (void **)(&sem_), &type, waitType) != OK) + vxwThrowErrno (); + } + virtual STATUS nameSet (char * name); +protected: + VXWSmCSem () + { + } + VXWSmCSem (const VXWSmCSem &) + { + } + VXWSmCSem & operator = (const VXWSmCSem &) + { + return *this; + } +}; + +class VXWSmMsgQ : public VXWMsgQ, public VXWSmName +{ +public: +//_ VXWSmMsgQ Public Constructors + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSmMsgQ::VXWSmMsgQ - create and initialize a shared-memory message queue (VxMP Option) +// +// This routine creates a shared memory message queue capable of holding up +// to messages, each up to bytes long. The queue +// can only be created with the option MSG_Q_FIFO (0), thus queuing pended +// tasks in FIFO order. +// +// If there is insufficient memory to store the message queue structure +// in the shared memory message queue partition or if the shared memory system +// pool cannot handle the requested message queue size, shared memory message +// queue creation fails with `errno' set to S_smMemLib_NOT_ENOUGH_MEMORY. +// This problem can be solved by incrementing the SM_OBJ_MAX_MSG_Q value +// in configAll.h and/or the size of memory dedicated to shared-memory objects +// SM_OBJ_MEM_SIZE in config.h. +// +// AVAILABILITY: +// This routine depends on code distributed as a component of the unbundled +// shared memory objects support option, VxMP. +// +// RETURNS: N/A. +// +// ERRNO: +// S_smMemLib_NOT_ENOUGH_MEMORY +// S_intLib_NOT_ISR_CALLABLE +// S_msgQLib_INVALID_QUEUE_TYPE +// S_smObjLib_LOCK_TIMEOUT +// +// SEE ALSO: vxwMsgQLib, vxwSmNameLib + + VXWSmMsgQ (int maxMsgs, int maxMsgLength, int options) + : VXWMsgQ (msgQSmCreate (maxMsgs, maxMsgLength, options)) + { + if (msgq_ == 0) + vxwThrowErrno (); + } + virtual STATUS nameSet (char *name); +}; + +class VXWSmMemPart : public VXWMemPart, public VXWSmName +{ +public: +//_ VXWSmMemPart Public Constructors + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSmMemPart::VXWSmMemPart - create a shared memory partition (VxMP Option) +// +// This routine creates a shared memory partition that can be used by tasks +// on all CPUs in the system to manage memory blocks . Because the +// `VXWSmMemPart' class inherits from `VXWMemPart', you can use the +// general-purpose methods in that class to manage the partition (that +// is, to allocate and free memory blocks in the partition). +// +// is a pointer to the global address of shared memory dedicated to the +// partition. The memory area where points must be in the same +// address space as the shared memory anchor and shared memory pool. +// +// is the size in bytes of shared memory dedicated to the partition. +// +// NOTE +// The descriptor for the new partition is allocated out of an internal +// dedicated shared memory partition. The maximum number of partitions that can +// be created is SM_OBJ_MAX_MEM_PART, defined in configAll.h. +// +// Memory pool size is rounded down to a 16-byte boundary. +// +// AVAILABILITY +// This routine depends on code distributed as a component of the unbundled +// shared memory objects support option, VxMP. +// +// RETURNS: N/A. +// +// ERRNO: +// S_memLib_NOT_ENOUGH_MEMORY +// S_smObjLib_LOCK_TIMEOUT +// +// SEE ALSO: vxwMemPartLib, vxwSmNameLib + + VXWSmMemPart (char *pool, unsigned poolSize) + : VXWMemPart (memPartSmCreate (pool, poolSize)) + { + if (partid_ == 0) + vxwThrowErrno (); + } + virtual STATUS nameSet (char *name); +}; + +class VXWSmMemBlock : public VXWSmName +{ +public: +//_ VXWSmMemBlock Public Constructors + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSmMemBlock::VXWSmMemBlock - allocate a block of memory from the shared memory system partition (VxMP Option) +// +// This routine allocates, from the shared memory system partition, a +// block of memory whose size is equal to or greater than . +// The local address of the allocated shared memory block can be +// obtained from VXWSmMemBlock::baseAddress(). +// +// AVAILABILITY +// This routine depends on code distributed as a component of the unbundled +// shared memory objects support option, VxMP. +// +// RETURNS: N/A. +// +// ERRNO: +// S_memLib_NOT_ENOUGH_MEMORY +// S_smObjLib_LOCK_TIMEOUT +// + + VXWSmMemBlock (int nBytes) + : pBlock_ (smMemMalloc (nBytes)), nBytes_ (nBytes) + { + if (pBlock_ == 0) + vxwThrowErrno (); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSmMemBlock::VXWSmMemBlock - allocate memory for an array from the shared memory system partition (VxMP Option) +// +// This routine allocates a block of memory for an array that contains +// elements of size from the shared memory system +// partition. +// The local address of the allocated shared memory block can be +// obtained from VXWSmMemBlock::baseAddress(). +// +// AVAILABILITY +// This routine depends on code distributed as a component of the unbundled +// shared memory objects support option, VxMP. +// +// RETURNS: +// A pointer to the block, or NULL if the memory cannot be allocated. +// +// ERRNO: +// S_memLib_NOT_ENOUGH_MEMORY +// S_smObjLib_LOCK_TIMEOUT + + VXWSmMemBlock (int nElems, int sizeOfElem) + : pBlock_ (smMemCalloc (nElems, sizeOfElem)), + nBytes_ (nElems * sizeOfElem) + { + if (pBlock_ == 0) + vxwThrowErrno (); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSmMemBlock::~VXWSmMemBlock - free a shared memory system partition block of memory (VxMP Option) +// +// This routine returns a `VXWSmMemBlock' shared-memory block to the +// free-memory pool in the shared-memory system partition. +// +// AVAILABILITY +// This routine depends on code distributed as a component of the unbundled shared memory +// objects support option, VxMP. +// +// RETURNS: N/A. +// +// ERRNO: +// S_smObjLib_LOCK_TIMEOUT +// +// SEE ALSO: VXWSmMemBlock::VXWSmMemBlock() + + virtual ~VXWSmMemBlock () + { + if (smMemFree (pBlock_) != OK) + vxwThrowErrno (); + } + +//_ VXWSmMemBlock Public Member Functions + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSmMemBlock::baseAddress - address of shared-memory block +// +// This routine reports the local address of a block of shared memory +// managed as a `VXWSmMemBlock' object. +// +// RETURNS: Local address of memory block in shared-memory system partition. + + void * baseAddress () const + { + return pBlock_; + } + virtual STATUS nameSet (char * name); + virtual void * myValue (); +protected: + VXWSmMemBlock () + { + } + VXWSmMemBlock (const VXWSmMemBlock &) + { + } + VXWSmMemBlock & operator = (const VXWSmMemBlock &) + { + return *this; + } + void * pBlock_; + unsigned nBytes_; +}; + +#endif /* ifndef vxwSmLib_h */ diff --git a/h/vxwSmNameLib.h b/h/vxwSmNameLib.h new file mode 100644 index 0000000..e7a9e32 --- /dev/null +++ b/h/vxwSmNameLib.h @@ -0,0 +1,190 @@ +// VXWSmName/vxwSmNameLib.h - naming behavior common to all shared memory classes + +// Copyright 1995-1999 Wind River Systems, Inc. + +// modification history +// -------------------- +// 01b,23feb99,fle doc : made it refgen compliant +// 01c,21feb99,jdi added library section, checked in documentation. +// 01b,30sep95,rhp documented. +// 01a,15jun95,srh written. + +// DESCRIPTION +// This class library provides facilities for managing entries in the shared +// memory objects name database. The shared memory objects name +// database associates a name and object type with a value and makes +// that information available to all CPUs. A name is an arbitrary, +// null-terminated string. An object type is a small integer, and its +// value is a global (shared) ID or a global shared memory address. +// +// Names are added to the shared memory name database with +// VXWSmName::VXWSmName(). They are removed by VXWSmName::~VXWSmName(). +// +// Name database contents can be viewed using smNameShow(). +// +// The maximum number of names to be entered in the database SM_OBJ_MAX_NAME is +// defined in configAll.h. This value is used to determine the size of a +// dedicated shared memory partition from which name database fields are +// allocated. +// +// The estimated memory size required for the name database can be calculated +// as follows: +// +// .CS +// = SM_OBJ_MAX_NAME * 40 (bytes) +// .CE +// +// The display facility for the shared memory objects name database is provided +// by smNameShow. +// +// CONFIGURATION +// Before routines in this library can be called, the shared memory object +// facility must be initialized by calling usrSmObjInit(), which is found in +// src/config/usrSmObj.c. This is done automatically from the root +// task, usrRoot(), in usrConfig.c if INCLUDE_SM_OBJ is defined in +// configAll.h. +// +// AVAILABILITY +// This module depends on code that is distributed as a component of +// the unbundled shared memory objects support option, VxMP. +// +// INCLUDE FILES: vxwSmNameLib.h +// +// SEE ALSO: smNameLib, smNameShow, vxwSmLib, smObjShow, usrSmObjInit(), +// .pG "Shared Memory Objects" +// +// SECTION: 1C +// + +#ifndef vxwSmNameLib_h +#define vxwSmNameLib_h + +#include "vxWorks.h" +#include "smNameLib.h" +#include "vxwErr.h" +#include "vxwObject.h" + +class VXWSmName : virtual public VXWIdObject + { + public: + +//_ VXWSmName Public Constructors + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSmName::~VXWSmName - remove an object from the shared memory objects name database (VxMP Option) +// +// This routine removes an object from the shared memory objects +// name database. +// +// AVAILABILITY +// This routine depends on code distributed as a component of the unbundled +// shared memory objects support option, VxMP. +// +// RETURNS: OK, or ERROR if the database is not initialized, or the +// name-database lock times out. +// +// ERRNO: +// S_smNameLib_NOT_INITIALIZED +// S_smObjLib_LOCK_TIMEOUT + + virtual ~VXWSmName (); + +//_ VXWSmName Public Member Functions + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSmName::nameSet - define a name string in the shared-memory name database (VxMP Option) +// +// This routine adds a name of the type appropriate for each derived class +// to the database of memory object names. +// +// The parameter is an arbitrary null-terminated string with a +// maximum of 20 characters, including EOS. +// +// A name can be entered only once in the database, but there can be more +// than one name associated with an object ID. +// +// AVAILABILITY +// This routine depends on the unbundled shared memory +// objects support option, VxMP. +// +// RETURNS: OK, or ERROR if there is insufficient memory for to be +// allocated, if is already in the database, or if the database is +// already full. +// +// ERRNO: +// S_smNameLib_NOT_INITIALIZED +// S_smNameLib_NAME_TOO_LONG +// S_smNameLib_NAME_ALREADY_EXIST +// S_smNameLib_DATABASE_FULL +// S_smObjLib_LOCK_TIMEOUT + + virtual STATUS nameSet (char * name) = 0; + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSmName::nameGet - get name and type of a shared memory object (VxMP Option) +// +// This routine searches the shared memory name database for an object matching +// this VXWSmName instance. If the object is found, its name and type are +// copied to the addresses pointed to by and . The value of +// can be one of the following: +// .iP "NO_WAIT (0)" +// The call returns immediately, even if the object value is not in the database +// .iP "WAIT_FOREVER (-1)" +// The call returns only when the object value is available in the database. +// .LP +// +// AVAILABILITY +// This routine depends on the unbundled shared memory +// objects support option, VxMP. +// +// RETURNS: OK, or ERROR if is not found or if the wait type is invalid. +// +// ERRNO: +// S_smNameLib_NOT_INITIALIZED +// S_smNameLib_VALUE_NOT_FOUND +// S_smNameLib_INVALID_WAIT_TYPE +// S_smObjLib_LOCK_TIMEOUT + + STATUS nameGet (char * name, int * pType, int waitType) + { + return smNameFindByValue (myValue (), name, pType, waitType); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSmName::nameGet - get name of a shared memory object (VxMP Option) +// +// This routine searches the shared memory name database for an object matching +// this VXWSmName instance. If the object is found, its name is copied +// to the address pointed to by . The value of +// can be one of the following: +// .iP "NO_WAIT (0)" +// The call returns immediately, even if the object value is not in the database +// .iP "WAIT_FOREVER (-1)" +// The call returns only when the object value is available in the database. +// .LP +// +// AVAILABILITY +// This routine depends on the unbundled shared memory +// objects support option, VxMP. +// +// RETURNS: OK, or ERROR if is not found or if the wait type is invalid. +// +// ERRNO: +// S_smNameLib_NOT_INITIALIZED +// S_smNameLib_VALUE_NOT_FOUND +// S_smNameLib_INVALID_WAIT_TYPE +// S_smObjLib_LOCK_TIMEOUT + + STATUS nameGet (char * name, int waitType) + { + int ignore; + return nameGet (name, &ignore, waitType); + } + protected: + }; + +#endif /* ifndef vxwSmNameLib_h */ diff --git a/h/vxwSymLib.h b/h/vxwSymLib.h new file mode 100644 index 0000000..52259f5 --- /dev/null +++ b/h/vxwSymLib.h @@ -0,0 +1,314 @@ +// VXWSymTab/vxwSymLib.h - symbol table class + +// Copyright 1995-1999 Wind River Systems, Inc. + +// modification history +// -------------------- +// 01c,09mar99,jdi doc: fixed wrong cross-references. +// 01b,23feb99,fle doc : made it refgen compliant +// 01c,21feb99,jdi added library section, checked in documentation. +// 01b,30sep95,rhp documented. +// 01a,15jun95,srh written. + +// DESCRIPTION +// This class library provides facilities for managing symbol tables. A symbol +// table associates a name and type with a value. A name is simply an +// arbitrary, null-terminated string. A symbol type is a small integer +// (typedef SYM_TYPE), and its value is a character pointer. Though commonly +// used as the basis for object loaders, symbol tables may be used whenever +// efficient association of a value with a name is needed. +// +// If you use the VXWSymTab class to manage symbol tables local to +// your own applications, the values for SYM_TYPE objects are completely +// arbitrary; you can use whatever one-byte integers are appropriate for +// your application. +// +// If the VxWorks system symbol table is configured into your target +// system, you can use the VXWSymTab class to manipulate it based on +// its symbol-table ID, recorded in the global \f3sysSymTbl\f1; see +// VXWSymTab::VXWSymTab() to construct an object based on this global. +// In the VxWorks target-resident global symbol table, the values for +// SYM_TYPE are N_ABS, N_TEXT, N_DATA, and N_BSS (defined in a_out.h); +// these are all even numbers, and any of them may be combined (via +// boolean or) with N_EXT (1). These values originate in the section +// names for a.out object code format, but the VxWorks system symbol +// table uses them as symbol types across all object formats. (The +// VxWorks system symbol table also occasionally includes additional +// types, in some object formats.) +// +// All operations on a symbol table are interlocked by means of a +// mutual-exclusion semaphore in the symbol table structure. +// +// Symbols are added to a symbol table with VXWSymTab::add(). Each +// symbol in the symbol table has a name, a value, and a type. +// Symbols are removed from a symbol table with VXWSymTab::remove(). +// +// Symbols can be accessed by either name or value. The routine +// VXWSymTab::findByName() searches the symbol table for a symbol of a +// specified name. The routine VXWSymTab::findByValue() finds the +// symbol with the value closest to a specified value. The routines +// VXWSymTab::findByNameAndType() and VXWSymTab::findByValueAndType() +// allow the symbol type to be used as an additional criterion in the +// searches. +// +// Symbols in the symbol table are hashed by name into a hash table +// for fast look-up by name, for instance with VXWSymTab::findByName(). The +// size of the hash table is specified during the creation of a symbol +// table. Look-ups by value, such as with VXWSymTab::findByValue(), must +// search the table linearly; these look-ups can thus be much slower. +// +// The routine VXWSymTab::each() allows each symbol in the symbol +// table to be examined by a user-specified function. +// +// Name clashes occur when a symbol added to a table is identical in +// name and type to a previously added symbol. Whether or not symbol +// tables can accept name clashes is set by a parameter when the +// symbol table is created with VXWSymTab::VXWSymTab(). If name +// clashes are not allowed, VXWSymTab::add() returns an error if +// there is an attempt to add a symbol with identical name and type. +// If name clashes are allowed, adding multiple symbols with the same +// name and type is not an error. In such cases, +// VXWSymTab::findByName() returns the value most recently added, +// although all versions of the symbol can be found by +// VXWSymTab::each(). +// +// INCLUDE FILES: vxwSymLib.h +// +// SEE ALSO: VXWModule +// + +#ifndef vxwSymLib_h +#define vxwSymLib_h + +#include "vxWorks.h" +#include "symLib.h" +#include "vxwObject.h" +#include "vxwErr.h" + +class VXWSymTab : virtual public VXWIdObject + { + public: +//_ VXWSymTab Public Constructors + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSymTab::VXWSymTab - create a symbol table +// +// This constructor creates and initializes a symbol table with a hash table of +// a specified size. The size of the hash table is specified as a power of two. +// For example, if is 6, a 64-entry hash table is created. +// +// If is FALSE, attempting to add a symbol with +// the same name and type as an already-existing symbol results in an error. +// +// Memory for storing symbols as they are added to the symbol table will be +// allocated from the memory partition . The ID of the system +// memory partition is stored in the global variable `memSysPartId', which +// is declared in memLib.h. +// +// RETURNS: N/A + + VXWSymTab (int hashSizeLog2, BOOL sameNameOk, PART_ID symPartId) + : stid_ (symTblCreate (hashSizeLog2, sameNameOk, symPartId)) + { + if (stid_ == 0) + vxwThrowErrno (); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSymTab::VXWSymTab - create a symbol-table object +// +// This constructor creates a symbol table object based on an existing +// symbol table. For example, the following statement creates a +// symbol-table object for the VxWorks system symbol table (assuming +// you have configured a target-resident symbol table into your +// VxWorks system): +// .CS +// VXWSymTab sSym; +// ... +// sSym = VXWSymTab (sysSymTbl); +// .CE + + VXWSymTab (SYMTAB_ID aSymTabId) + : stid_ (aSymTabId) + { + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSymTab::~VXWSymTab - delete a symbol table +// +// This routine deletes a symbol table; it deallocates all memory +// associated with its symbol table, including the hash table, and +// marks the table as invalid. +// +// Deletion of a table that still contains symbols throws an error. +// Successful deletion includes the deletion of the internal hash table and +// the deallocation of memory associated with the table. The table is marked +// invalid to prohibit any future references. +// +// RETURNS: OK, or ERROR if the table still contains symbols. + + ~VXWSymTab () + { + if (symTblDelete (stid_) != OK) + vxwThrowErrno (); + } + +//_ VXWSymTab Public Member Functions + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSymTab::add - create and add a symbol to a symbol table, including a group number +// +// This routine allocates a symbol and adds it to its symbol +// table with the specified parameters , , and . +// The parameter specifies the group number assigned to a module when +// it is loaded on the target; see the manual entry for moduleLib. +// +// RETURNS: OK, or ERROR if there is insufficient memory for the symbol to be +// allocated. +// +// SEE ALSO: moduleLib + + STATUS add (char *name, char *value, SYM_TYPE type, UINT16 group) + { + return symAdd (stid_, name, value, type, group); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSymTab::each - call a routine to examine each entry in a symbol table +// +// This routine calls a user-supplied routine to examine each entry in the +// symbol table; it calls the specified routine once for each entry. The +// routine must have the following type signature: +// .CS +// BOOL routine +// ( +// char * name, /@ entry name @/ +// int val, /@ value associated with entry @/ +// SYM_TYPE type, /@ entry type @/ +// int arg, /@ arbitrary user-supplied arg @/ +// UINT16 group /@ group number @/ +// ) +// .CE +// The user-supplied routine must return TRUE if VXWSymTab::each() is to +// continue calling it for each entry, or FALSE if it is done and +// VXWSymTab::each() can exit. +// +// RETURNS: A pointer to the last symbol reached, or NULL if all symbols are +// reached. + + SYMBOL * each (FUNCPTR routine, int routineArg) + { + return symEach (stid_, routine, routineArg); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSymTab::findByName - look up a symbol by name +// +// This routine searches its symbol table for a symbol matching a specified +// name. If the symbol is found, its value and type are copied to +// and . If multiple symbols have the same name but differ in type, +// the routine chooses the matching symbol most recently added to the symbol +// table. +// +// RETURNS: OK, or ERROR if the symbol cannot be found. + + STATUS findByName (char *name, char **pValue, SYM_TYPE *pType) const + { + return symFindByName (stid_, name, pValue, pType); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSymTab::findByNameAndType - look up a symbol by name and type +// +// This routine searches its symbol table for a symbol matching both name and +// type ( and ). If the symbol is found, its value and type are +// copied to and . The parameter can be used to match +// sub-classes of type. +// +// RETURNS: OK, or ERROR if the symbol is not found. + + STATUS findByNameAndType (char *name, char **pValue, SYM_TYPE *pType, + SYM_TYPE goalType, SYM_TYPE mask) const + { + return symFindByNameAndType (stid_, name, pValue, + pType, goalType, mask); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSymTab::findByValue - look up a symbol by value +// +// This routine searches its symbol table for a symbol matching a specified +// value. If there is no matching entry, it chooses the table entry with the +// next lower value. The symbol name (with terminating EOS), the actual +// value, and the type are copied to , , and . +// +// RETURNS: OK, or ERROR if is less than the lowest value in the table. + + STATUS findByValue (UINT value, char *name, int *pValue, + SYM_TYPE *pType) const + { + return symFindByValue (stid_, value, name, pValue, pType); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSymTab::findByValueAndType - look up a symbol by value and type +// +// This routine searches a symbol table for a symbol matching both +// value and type ( and ). If there is no matching +// entry, it chooses the table entry with the next lower value. The +// symbol name (with terminating EOS), the actual value, and the type +// are copied to , , and . The parameter +// can be used to match sub-classes of type. +// +// RETURNS: OK, or ERROR if is less than the lowest value in the table. + + STATUS findByValueAndType (UINT value, char *name, int *pValue, + SYM_TYPE *pType, SYM_TYPE goalType, + SYM_TYPE mask) const + { + return symFindByValueAndType (stid_, value, name, pValue, + pType, goalType, mask); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWSymTab::remove - remove a symbol from a symbol table +// +// This routine removes a symbol of matching name and type from +// its symbol table. The symbol is deallocated if found. +// Note that VxWorks symbols in a standalone VxWorks image (where the +// symbol table is linked in) cannot be removed. +// +// RETURNS: OK, or ERROR if the symbol is not found +// or could not be deallocated. + + STATUS remove (char *name, SYM_TYPE type) + { + return symRemove (stid_, name, type); + } + + protected: + VXWSymTab () + { + } + VXWSymTab (const VXWSymTab &) + { + } + VXWSymTab & operator = (const VXWSymTab &) + { + return *this; + } + virtual void * myValue (); + SYMTAB_ID stid_; + }; + +#endif /* ifndef vxwSymLib_h */ diff --git a/h/vxwTaskLib.h b/h/vxwTaskLib.h new file mode 100644 index 0000000..d91ac8f --- /dev/null +++ b/h/vxwTaskLib.h @@ -0,0 +1,1008 @@ +// VXWTask/vxwTaskLib.h - task class + +// Copyright 1995-1999 Wind River Systems, Inc. + +// modification history +// -------------------- +// 01c,08mar99,jdi doc: fixed wrong cross-references. +// 01b,23feb99,fle doc : made it refgen compliant +// 01c,21feb99,jdi added library section, checked in documentation. +// 01b,29sep95,rhp documented. +// 01a,15jun95,srh written. + +// DESCRIPTION +// This library provides the interface to the VxWorks task management +// facilities. This class library provides task control services, +// programmatic access to task information and debugging features, and +// higher-level task information display routines. +// +// TASK CREATION +// Tasks are created with the constructor VXWTask::VXWTask(). Task +// creation consists of the following: allocation of memory for the stack +// and task control block (WIND_TCB), initialization of the WIND_TCB, and +// activation of the WIND_TCB. Special needs may require the use of the +// lower-level method VXWTask::activate(). +// +// Tasks in VxWorks execute in the most privileged state of the underlying +// architecture. In a shared address space, processor privilege offers no +// protection advantages and actually hinders performance. +// +// There is no limit to the number of tasks created in VxWorks, as long as +// sufficient memory is available to satisfy allocation requirements. +// +// TASK DELETION +// If a task exits its "main" routine, specified during task creation, +// the kernel implicitly calls exit() to delete the task. Tasks can +// be deleted with the exit() routine, or explicitly with the +// operator, which arranges to call the class destructor +// VXWTask::~VXWTask(). +// +// Task deletion must be handled with extreme care, due to the inherent +// difficulties of resource reclamation. Deleting a task that owns a +// critical resource can cripple the system, since the resource may no longer +// be available. Simply returning a resource to an available state is not a +// viable solution, since the system can make no assumption as to the state +// of a particular resource at the time a task is deleted. +// +// A task can protect itself from deletion by taking a +// mutual-exclusion semaphore created with the SEM_DELETE_SAFE option +// (see vxwSemLib for more information). Many VxWorks system resources +// are protected in this manner, and application designers may wish to +// consider this facility where dynamic task deletion is a +// possibility. +// +// The sigLib facility may also be used to allow a task to +// execute clean-up code before actually expiring. +// +// TASK CONTROL +// The following methods control task state: VXWTask::resume(), +// VXWTask::suspend(), VXWTask::restart(), VXWTask::priority(), +// and VXWTask::registers(). +// +// TASK SCHEDULING +// VxWorks schedules tasks on the basis of priority. Tasks may have +// priorities ranging from 0, the highest priority, to 255, the lowest +// priority. The priority of a task in VxWorks is dynamic, and an existing +// task's priority can be changed or examined using VXWTask:priority(). +// +// INCLUDE FILES: taskLib.h +// +// SEE ALSO: taskLib, taskHookLib, VXWSem, +// kernelLib, +// .pG "Basic OS" +// +// SECTION: 1C +// + +#ifndef vxwTaskLib_h +#define vxwTaskLib_h + +#include "vxWorks.h" +#include "envLib.h" +#include "errnoLib.h" +#include "sigLib.h" +#include "taskArchLib.h" +#include "taskLib.h" +#include "taskVarLib.h" +#include "vxwObject.h" +#include "vxwErr.h" + +class VXWTask : virtual public VXWIdObject + { + public: +//_ VXWTask Public Constructors + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::VXWTask - initialize a task object +// +// This constructor creates a task object from the task ID of an existing task. +// Because of the VxWorks convention that a task ID of 0 refers to the calling +// task, this constructor can be used to derive a task object for the +// calling task, as follows: +// .CS +// myTask = VXWTask (0); +// .CE +// +// RETURNS: N/A +// +// SEE ALSO: taskLib, VXWTask::~VXWTask(), sp() + + VXWTask (int tid) + : tid_ (tid), managePrivateEnv_ (FALSE) + { + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::VXWTask - create and spawn a task +// +// This constructor creates and activates a new task with a specified priority +// and options. +// +// A task may be assigned a name as a debugging aid. This name appears +// in displays generated by various system information facilities such as +// i(). The name may be of arbitrary length and content, but the current +// VxWorks convention is to limit task names to ten characters and prefix +// them with a "t". If is specified as NULL, an ASCII name is +// assigned to the task of the form "t" where is an integer which +// increments as new tasks are spawned. +// +// The only resource allocated to a spawned task is a stack of a specified +// size , which is allocated from the system memory partition. +// Stack size should be an even integer. A task control block (TCB) is +// carved from the stack, as well as any memory required by the task name. +// The remaining memory is the task's stack and every byte is filled with the +// value 0xEE for the checkStack() facility. See the manual entry for +// checkStack() for stack-size checking aids. +// +// The entry address is the address of the "main" routine of the task. +// The routine is called after the C environment is set up. +// The specified routine is called with the ten arguments provided. +// Should the specified main routine return, a call to exit() is +// made automatically. +// +// Note that ten (and only ten) arguments must be passed for the +// spawned function. +// +// Bits in the options argument may be set to run with the following modes: +// .iP VX_FP_TASK 22 +// execute with floating-point coprocessor support. +// .iP VX_PRIVATE_ENV +// include private environment support. +// .iP VX_NO_STACK_FILL +// do not fill the stack for use by checkstack(). +// .iP VX_UNBREAKABLE +// do not allow breakpoint debugging. +// .LP +// See the definitions in taskLib.h. +// +// RETURNS: N/A +// +// SEE ALSO: VXWTask::~VXWTask(), VXWTask::activate(), sp(), +// .pG "Basic OS" + + VXWTask (char * name, + int priority, + int options, + int stackSize, + FUNCPTR entryPoint, + int arg1=0, + int arg2=0, + int arg3=0, + int arg4=0, + int arg5=0, + int arg6=0, + int arg7=0, + int arg8=0, + int arg9=0, + int arg10=0) + : tid_ (taskSpawn (name, + priority, + options, + stackSize, + entryPoint, + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9, + arg10)), managePrivateEnv_ (FALSE) + { + if (tid_ == ERROR) + vxwThrowErrno (); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::VXWTask - initialize a task with a specified stack +// +// This constructor initializes user-specified regions of memory for a task +// stack and control block instead of allocating them from memory. +// This constructor uses the specified pointers to the WIND_TCB +// and stack as the components of the task. This allows, for example, the +// initialization of a static WIND_TCB variable. It also allows for special +// stack positioning as a debugging aid. +// +// As in other constructors, a task may be given a name. If no name is +// specified, this constructor creates a task without a name (rather +// than assigning a default name). +// +// Other arguments are the same as in the previous constructor. This +// constructor does not activate the task. This must be done by calling +// VXWTask::activate(). +// +// Normally, tasks should be started using the previous constructor rather +// than this one, +// except when additional control is required for task memory allocation or +// a separate task activation is desired. +// +// RETURNS: OK, or ERROR if the task cannot be initialized. +// +// SEE ALSO: VXWTask::activate() + + VXWTask (WIND_TCB * pTcb, + char * name, + int priority, + int options, + char * pStackBase, + int stackSize, + FUNCPTR entryPoint, + int arg1=0, + int arg2=0, + int arg3=0, + int arg4=0, + int arg5=0, + int arg6=0, + int arg7=0, + int arg8=0, + int arg9=0, + int arg10=0) + : tid_ (-1), managePrivateEnv_ (FALSE) + { + if (taskInit (pTcb, + name, + priority, + options, + pStackBase, + stackSize, + entryPoint, + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9, + arg10) != OK) + vxwThrowErrno (); + else + tid_ = int (pTcb); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::~VXWTask - delete a task +// +// This destructor causes the task to cease to exist and deallocates the +// stack and WIND_TCB memory resources. Upon deletion, all routines specified +// by taskDeleteHookAdd() are called in the context of the deleting task. +// +// RETURNS: N/A +// +// SEE ALSO: excLib, taskDeleteHookAdd(), VXWTask::VXWTask(), +// .pG "Basic OS" + + virtual ~VXWTask () + { + if (managePrivateEnv_ && envPrivateDestroy (tid_) != OK) + vxwThrowErrno (); + if (taskDelete (tid_) != OK) + vxwThrowErrno (); + } + +//_ VXWTask Public Member Functions + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::activate - activate a task +// +// This routine activates tasks created by the form of the constructor +// that does not automatically activate a task. Without activation, a +// task is ineligible for CPU allocation by the scheduler. +// +// RETURNS: OK, or ERROR if the task cannot be activated. +// +// SEE ALSO: VXWTask::VXWTask() + + STATUS activate () + { + return taskActivate (tid_); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::deleteForce - delete a task without restriction +// +// This routine deletes a task even if the task is protected from deletion. +// It is similar to VXWTask::~VXWTask(). Upon deletion, all routines +// specified by taskDeleteHookAdd() are called in the context of the +// deleting task. +// +// CAVEATS +// This routine is intended as a debugging aid, and is generally inappropriate +// for applications. Disregarding a task's deletion protection could leave the +// the system in an unstable state or lead to system deadlock. +// +// The system does not protect against simultaneous VXWTask:deleteForce() calls. +// Such a situation could leave the system in an unstable state. +// +// RETURNS: OK, or ERROR if the task cannot be deleted. +// +// SEE ALSO: taskDeleteHookAdd(), VXWTask::~VXWTask() + + STATUS deleteForce () + { + return taskDeleteForce (tid_); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::envCreate - create a private environment +// +// This routine creates a private set of environment variables for a specified +// task, if the environment variable task create hook is not installed. +// +// RETURNS: OK, or ERROR if memory is insufficient. +// +// SEE ALSO: envLib + + STATUS envCreate (int envSource) + { + STATUS rval = OK; + if (envPrivateCreate (tid_, envSource) != OK) + rval = ERROR; + managePrivateEnv_ = TRUE; + return rval; + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::errNo - retrieve error status value +// +// This routine gets the error status for the task. +// +// RETURNS: +// The error status value contained in `errno'. +// + + int errNo () const + { + return errnoOfTaskGet (tid_); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::errNo - set error status value +// +// This routine sets the error status value for its task. +// +// RETURNS: OK. + + STATUS errNo (int errorValue) + { + return errnoOfTaskSet (tid_, errorValue); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::id - reveal task ID +// +// This routine reveals the task ID for its task. The task ID is necessary +// to call C routines that affect or inquire on a task. +// +// RETURNS: task ID +// +// SEE ALSO: taskLib + + int id () const + { + return tid_; + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::info - get information about a task +// +// This routine fills in a specified task descriptor (TASK_DESC) for its +// task. The information in the task descriptor is, for the most +// part, a copy of information kept in the task control block (WIND_TCB). +// The TASK_DESC structure is useful for common information and avoids +// dealing directly with the unwieldy WIND_TCB. +// +// NOTE +// Examination of WIND_TCBs should be restricted to debugging aids. +// +// RETURNS: OK + + STATUS info (TASK_DESC *pTaskDesc) const + { + return taskInfoGet (tid_, pTaskDesc); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::isReady - check if task is ready to run +// +// This routine tests the status field of its task to determine +// whether the task is ready to run. +// +// RETURNS: TRUE if the task is ready, otherwise FALSE. + + BOOL isReady () const + { + return taskIsReady (tid_); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::isSuspended - check if task is suspended +// +// This routine tests the status field of its task to determine +// whether the task is suspended. +// +// RETURNS: TRUE if the task is suspended, otherwise FALSE. + + BOOL isSuspended () const + { + return taskIsSuspended (tid_); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::kill - send a signal to task +// +// This routine sends a signal to its task. +// +// RETURNS: OK (0), or ERROR (-1) if the signal number is invalid. +// +// ERRNO: EINVAL + + int kill (int signo) + { + return ::kill (tid_, signo); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::name - get the name associated with a task ID +// +// This routine returns a pointer to the name of its task, if +// it has a name; otherwise it returns NULL. +// +// RETURNS: A pointer to the task name, or NULL. + + char * name () const + { + return taskName (tid_); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::options - examine task options +// +// This routine gets the current execution options of its task. +// The option bits returned indicate the following modes: +// .iP VX_FP_TASK 22 +// execute with floating-point coprocessor support. +// .iP VX_PRIVATE_ENV +// include private environment support (see envLib). +// .iP VX_NO_STACK_FILL +// do not fill the stack for use by checkstack(). +// .iP VX_UNBREAKABLE +// do not allow breakpoint debugging. +// .LP +// For definitions, see taskLib.h. +// +// RETURNS: OK. + + STATUS options (int *pOptions) const + { + return taskOptionsGet (tid_, pOptions); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::options - change task options +// +// This routine changes the execution options of its task. +// The only option that can be changed after a task has been created is: +// .iP VX_UNBREAKABLE 21 +// do not allow breakpoint debugging. +// .LP +// For definitions, see taskLib.h. +// +// RETURNS: OK. + + STATUS options (int mask, int newOptions) + { + return taskOptionsSet (tid_, mask, newOptions); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::priority - examine the priority of task +// +// This routine reports the current priority of its task. +// The current priority is copied to the integer pointed to by . +// +// RETURNS: OK. + + STATUS priority (int *pPriority) const + { + return taskPriorityGet (tid_, pPriority); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::priority - change the priority of a task +// +// This routine changes its task's priority to a specified priority. +// Priorities range from 0, the highest priority, to 255, the lowest priority. +// +// RETURNS: OK. + + STATUS priority (int newPriority) + { + return taskPrioritySet (tid_, newPriority); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::registers - set a task's registers +// +// This routine loads a specified register set into the +// task's TCB. +// +// NOTE +// This routine only works well if the task is known not to be in the ready +// state. Suspending the task before changing the register set is +// recommended. +// +// RETURNS: OK. +// +// SEE ALSO: VXWTask::suspend() + + STATUS registers (const REG_SET *pRegs) + { + return taskRegsSet (tid_, (REG_SET *)(pRegs)); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::registers - get task registers from the TCB +// +// This routine gathers task information kept in the TCB. It copies the +// contents of the task's registers to the register structure . +// +// NOTE +// This routine only works well if the task is known to be in a stable, +// non-executing state. Self-examination, for instance, is not advisable, +// as results are unpredictable. +// +// RETURNS: OK. +// +// SEE ALSO: VXWTask::suspend() + + STATUS registers (REG_SET *pRegs) const + { + return taskRegsGet (tid_, pRegs); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::restart - restart task +// +// This routine "restarts" its task. The task is first terminated, and then +// reinitialized with the same ID, priority, options, original entry point, +// stack size, and parameters it had when it was terminated. Self-restarting +// of a calling task is performed by the exception task. +// +// NOTE +// If the task has modified any of its start-up parameters, the restarted +// task will start with the changed values. +// +// RETURNS: OK, or ERROR if the task could not be restarted. + + STATUS restart () + { + return taskRestart (tid_); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::resume - resume task +// +// This routine resumes its task. Suspension is cleared, and +// the task operates in the remaining state. +// +// RETURNS: OK, or ERROR if the task cannot be resumed. + + STATUS resume () + { + return taskResume (tid_); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::show - display the contents of task registers +// +// This routine displays the register contents of its task +// on standard output. +// +// EXAMPLE: The following shell command line displays the register of a task +// `vxwT28': +// .CS 4 +// -> vxwT28.show () +// .CE +// +// The example prints on standard output a display like the following +// (68000 family): +// .CS +// d0 = 0 d1 = 0 d2 = 578fe d3 = 1 +// d4 = 3e84e1 d5 = 3e8568 d6 = 0 d7 = ffffffff +// a0 = 0 a1 = 0 a2 = 4f06c a3 = 578d0 +// a4 = 3fffc4 a5 = 0 fp = 3e844c sp = 3e842c +// sr = 3000 pc = 4f0f2 +// .CE +// +// RETURNS: N/A + + void show () const + { + taskRegsShow (tid_); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::show - display task information from TCBs +// +// This routine displays the contents of its task's task control block (TCB). +// If is 1, it also displays task options +// and registers. If is 2, it displays all tasks. +// +// The TCB display contains the following fields: +// +// .TS +// tab(|); +// lf3 lf3 +// l l . +// Field | Meaning +// _ +// NAME | Task name +// ENTRY | Symbol name or address where task began execution +// TID | Task ID +// PRI | Priority +// STATUS | Task status, as formatted by taskStatusString() +// PC | Program counter +// SP | Stack pointer +// ERRNO | Most recent error code for this task +// DELAY | If task is delayed, number of clock ticks remaining in delay (0 otherwise) +// .TE +// +// EXAMPLE: +// The following example shows the TCB contents for a task named `t28': +// .CS +// +// NAME ENTRY TID PRI STATUS PC SP ERRNO DELAY +// ---------- --------- -------- --- --------- -------- -------- ------ ----- +// t28 _appStart 20efcac 1 READY 201dc90 20ef980 0 0 +// +// stack: base 0x20efcac end 0x20ed59c size 9532 high 1452 margin 8080 +// +// options: 0x1e +// VX_UNBREAKABLE VX_DEALLOC_STACK VX_FP_TASK VX_STDIO +// +// +// D0 = 0 D4 = 0 A0 = 0 A4 = 0 +// D1 = 0 D5 = 0 A1 = 0 A5 = 203a084 SR = 3000 +// D2 = 0 D6 = 0 A2 = 0 A6 = 20ef9a0 PC = 2038614 +// D3 = 0 D7 = 0 A3 = 0 A7 = 20ef980 +// .CE +// +// RETURNS: N/A +// +// SEE ALSO: +// VXWTaskstatusString(), +// .tG "The Tornado Shell" + + STATUS show (int level) const + { + return taskShow (tid_, level); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::sigqueue - send a queued signal to task +// +// The routine sigqueue() sends to its task the signal specified by with +// the signal-parameter value specified by . +// +// RETURNS: OK (0), or ERROR (-1) if the signal number is invalid, +// or if there are no queued-signal buffers available. +// +// ERRNO: EINVAL EAGAIN + + int sigqueue (int signo, const union sigval value) + { + return ::sigqueue (tid_, signo, value); + } + +#if (CPU_FAMILY == MC680X0) +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::SRSet - set the task status register (MC680x0, MIPS, i386/i486) +// +// SYNOPSIS (I80X86) +// .CS +// STATUS SRSet +// ( +// UINT sr +// ) +// .CE +// +// SYNOPSIS (MIPS) +// .CS +// STATUS SRSet +// ( +// UINT32 sr +// ) +// .CE +// +// This routine sets the status register of a task that is not running; +// that is, you must not call this->SRSet(). +// Debugging facilities use this routine to set the trace bit in the +// status register of a task that is being single-stepped. +// +// RETURNS: OK. + + STATUS SRSet (UINT16 sr) +#elif (CPU_FAMILY == I80X86) + STATUS SRSet (UINT sr) +#elif (CPU_FAMILY == MIPS) + STATUS SRSet (UINT32 sr) +#endif +#if (CPU_FAMILY == MC680X0) || (CPU_FAMILY == I80X86) || (CPU_FAMILY == MIPS) + { + return taskSRSet (tid_, sr); + } +#endif + + + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::statusString - get task status as a string +// +// This routine deciphers the WIND task status word in the TCB for its +// task, and copies the appropriate string to . +// +// The formatted string is one of the following: +// +// .TS +// tab(|); +// lf3 lf3 +// l l . +// String | Meaning +// _ +// READY | Task is not waiting for any resource other than the CPU. +// PEND | Task is blocked due to the unavailability of some resource. +// DELAY | Task is asleep for some duration. +// SUSPEND | Task is unavailable for execution (but not suspended, delayed, or pended). +// DELAY+S | Task is both delayed and suspended. +// PEND+S | Task is both pended and suspended. +// PEND+T | Task is pended with a timeout. +// PEND+S+T | Task is pended with a timeout, and also suspended. +// \&...+I | Task has inherited priority (+I may be appended to any string above). +// DEAD | Task no longer exists. +// .TE +// +// RETURNS: OK. + + STATUS statusString (char *pString) const + { + return taskStatusString (tid_, pString); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::suspend - suspend task +// +// This routine suspends its task. Suspension is additive: thus, tasks +// can be delayed and suspended, or pended and suspended. Suspended, delayed +// tasks whose delays expire remain suspended. Likewise, suspended, +// pended tasks that unblock remain suspended only. +// +// Care should be taken with asynchronous use of this facility. The +// task is suspended regardless of its current state. The task could, for +// instance, have mutual exclusion to some system resource, such as the network +// or system memory partition. If suspended during such a time, the facilities +// engaged are unavailable, and the situation often ends in deadlock. +// +// This routine is the basis of the debugging and exception handling packages. +// However, as a synchronization mechanism, this facility should be rejected +// in favor of the more general semaphore facility. +// +// RETURNS: OK, or ERROR if the task cannot be suspended. + + STATUS suspend () + { + return taskSuspend (tid_); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::tcb - get the task control block +// +// This routine returns a pointer to the task control block (WIND_TCB) for +// its task. Although all task state information is contained in the +// TCB, users must not modify it directly. To change registers, for instance, +// use VXWTask::registers(). +// +// RETURNS: A pointer to a WIND_TCB. + + WIND_TCB * tcb () const + { + return taskTcb (tid_); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::varAdd - add a task variable to task +// +// This routine adds a specified variable (4-byte memory location) to +// its task's context. After calling this routine, the variable is +// private to the task. The task can access and modify the variable, but +// the modifications are not visible to other tasks, and other tasks' +// modifications to that variable do not affect the value seen by the +// task. This is accomplished by saving and restoring the variable's initial +// value each time a task switch occurs to or from the calling task. +// +// This facility can be used when a routine is to be spawned repeatedly as +// several independent tasks. Although each task has its own stack, +// and thus separate stack variables, they all share the same static and +// global variables. To make a variable \f2not\fP shareable, the routine can +// call VXWTask::varAdd() to make a separate copy of the variable for each +// task, but all at the same physical address. +// +// Note that task variables increase the task switch time to and from the +// tasks that own them. Therefore, it is desirable to limit the number of +// task variables that a task uses. One efficient way to use task variables +// is to have a single task variable that is a pointer to a dynamically +// allocated structure containing the task's private data. +// +// EXAMPLE: +// Assume that three identical tasks are spawned with a main routine called +// \f2operator()\f1. All three use the structure OP_GLOBAL for all variables +// that are specific to a particular incarnation of the task. The following +// code fragment shows how this is set up: +// +// .CS +// OP_GLOBAL *opGlobal; // ptr to operator task's global variables +// VXWTask me; // task object for self +// +// void operator +// ( +// int opNum // number of this operator task +// ) +// { +// me = VXWTask (0); // task object for running task +// if (me.varAdd ((int *)&opGlobal) != OK) +// { +// printErr ("operator%d: can't VXWTask::varAdd opGlobal\en", opNum); +// me.suspend (); +// } +// +// if ((opGlobal = (OP_GLOBAL *) malloc (sizeof (OP_GLOBAL))) == NULL) +// { +// printErr ("operator%d: can't malloc opGlobal\en", opNum); +// me.suspend (); +// } +// ... +// } +// .CE +// +// RETURNS: +// OK, or ERROR if memory is insufficient for the task variable descriptor. +// +// SEE ALSO: VXWTask::varDelete(), VXWTask::varGet(), VXWTask::varSet() + + STATUS varAdd (int * pVar) + { + return taskVarAdd (tid_, pVar); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::varDelete - remove a task variable from task +// +// This routine removes a specified task variable, , from its +// task's context. The private value of that variable is lost. +// +// RETURNS +// OK, or +// ERROR if the task variable does not exist for the task. +// +// SEE ALSO: VXWTask::varAdd(), VXWTask::varGet(), VXWTask:varSet() + + STATUS varDelete (int * pVar) + { + return taskVarDelete (tid_, pVar); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::varGet - get the value of a task variable +// +// This routine returns the private value of a task variable for its +// task. The task is usually not the calling task, +// which can get its private value by directly accessing the variable. +// This routine is provided primarily for debugging purposes. +// +// RETURNS: +// The private value of the task variable, or +// ERROR if the task does not own the task variable. +// +// SEE ALSO: VXWTask::varAdd(), VXWTask::varDelete(), VXWTask::varSet() + + int varGet (int * pVar) const + { + return taskVarGet (tid_, pVar); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::varInfo - get a list of task variables +// +// This routine provides the calling task with a list of all of the task +// variables of its task. The unsorted array of task variables is +// copied to . +// +// CAVEATS +// Kernel rescheduling is disabled while task variables are +// looked up. +// +// There is no guarantee that all the task variables are still +// valid or that new task variables have not been created by the time this +// routine returns. +// +// RETURNS: The number of task variables in the list. + + int varInfo (TASK_VAR varList[], int maxVars) const + { + return taskVarInfo (tid_, varList, maxVars); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// VXWTask::varSet - set the value of a task variable +// +// This routine sets the private value of the task variable for a specified +// task. The specified task is usually not the calling task, which can set +// its private value by directly modifying the variable. This routine is +// provided primarily for debugging purposes. +// +// RETURNS: +// OK, or ERROR if the task does not own the task variable. +// +// SEE ALSO: VXWTask::varAdd(), VXWTask::varDelete(), VXWTask::varGet() + + STATUS varSet (int * pVar, int value) + { + return taskVarSet (tid_, pVar, value); + } + + protected: + VXWTask () + { + } + VXWTask (const VXWTask &) + { + } + VXWTask & operator = (const VXWTask &) + { + return *this; + } + virtual void * myValue (); + + int tid_; + BOOL managePrivateEnv_; + }; + +#endif /* ifndef vxwTaskLib_h */ diff --git a/h/vxwWdLib.h b/h/vxwWdLib.h new file mode 100644 index 0000000..c7d6d7c --- /dev/null +++ b/h/vxwWdLib.h @@ -0,0 +1,217 @@ +// VXWWd/vxwWdLib.h - watchdog timer class + +// Copyright 1995-1999 Wind River Systems, Inc. + +// modification history +// -------------------- +// 01c,08mar99,jdi doc: fixed cross-reference. +// 01b,23feb99,fle doc : made it refgen compliant +// 01c,21feb99,jdi added library section, checked in documentation. +// 01b,29sep95,rhp adjusted comments for new mangen-C++ conventions +// 01a,15jun95,srh written. + +// DESCRIPTION +// This library provides a general watchdog timer facility. Any task may +// create a watchdog timer and use it to run a specified routine in +// the context of the system-clock ISR, after a specified delay. +// +// Once a timer has been created, it can be started with +// VXWWd::start(). The VXWWd::start() routine specifies what routine to run, a +// parameter for that routine, and the amount of time (in ticks) before +// the routine is to be called. (The timeout value is in ticks as +// determined by the system clock; see sysClkRateSet() for more +// information.) After the specified delay ticks have elapsed (unless +// VXWWd::cancel() is called first to cancel the timer) the timeout routine is +// invoked with the parameter specified in the VXWWd::start() call. The +// timeout routine is invoked whether the task which started the watchdog +// is running, suspended, or deleted. +// +// The timeout routine executes only once per VXWWd::start() invocation; there +// is no need to cancel a timer with VXWWd::cancel() after it has expired, or +// in the expiration callback itself. +// +// Note that the timeout routine is invoked at interrupt level, rather than +// in the context of the task. Thus, there are restrictions on what the +// routine may do. Watchdog routines are constrained to the same rules +// as interrupt service routines. For example, they may not take semaphores, +// issue other calls that may block, or use I/O system routines like printf(). +// +// EXAMPLE +// In the fragment below, if maybeSlowRoutine() takes more than 60 +// ticks, logMsg() will be called with the string as a parameter, +// causing the message to be printed on the console. Normally, of +// course, more significant corrective action would be taken. +// .CS +// VXWWd *pWd = new VXWWd; +// pWd->start (60, logMsg, "Help, I've timed out!"); +// maybeSlowRoutine (); /@ user-supplied routine @/ +// delete pWd; +// .CE +// +// INCLUDE FILES: vxwWdLib.h +// +// SEE ALSO: wdLib, logLib, +// .pG "Basic OS", +// .pG "C++ Development" +// +// SECTION: 1C +// + +#ifndef vxwWdLib_h +#define vxwWdLib_h + +#include "vxWorks.h" +#include "wdLib.h" +#include "vxwObject.h" +#include "vxwErr.h" + + +class VXWWd : virtual public VXWIdObject + { + public: + +//_ VXWWd Public Constructors + +//////////////////////////////////////////////////////////////////////////////// +// +// VXWWd::VXWWd - construct a watchdog timer +// +// This routine creates a watchdog timer. +// +// RETURNS: N/A +// +// SEE ALSO: VXWWd::~VXWWd() + + VXWWd () + : wd_ (wdCreate ()) + { + if (wd_ == 0) + vxwThrowErrno (); + } + +//////////////////////////////////////////////////////////////////////////////// +// +// VXWWd::VXWWd - construct a watchdog timer +// +// This routine creates a watchdog timer from an existing WDOG_ID. +// +// RETURNS: N/A +// +// SEE ALSO: VXWWd::~VXWWd() + + VXWWd (WDOG_ID aWdId) + : wd_ (aWdId) + { + } + +//////////////////////////////////////////////////////////////////////////////// +// +// VXWWd::~VXWWd - destroy a watchdog timer +// +// This routine destroys a watchdog timer. The watchdog will be removed +// from the timer queue if it has been started. +// +// RETURNS: N/A +// +// SEE ALSO: VXWWd::VXWWd() + + ~VXWWd () + { + if (wdDelete (wd_) != OK) + vxwThrowErrno (); + } + +//_ VXWWd Public Member Functions + +//////////////////////////////////////////////////////////////////////////////// +// +// VXWWd::cancel - cancel a currently counting watchdog +// +// This routine cancels a currently running watchdog timer by +// zeroing its delay count. Watchdog timers may be canceled from interrupt +// level. +// +// RETURNS: OK, or ERROR if the watchdog timer cannot be canceled. +// +// SEE ALSO: VXWWd::start() +// + + STATUS cancel () + { + return wdCancel (wd_); + } + + STATUS show () const + { + return wdShow (wd_); + } + +//////////////////////////////////////////////////////////////////////////////// +// +// VXWWd::start - start a watchdog timer +// +// This routine adds a watchdog timer to the system tick queue. The +// specified watchdog routine will be called from interrupt level after +// the specified number of ticks has elapsed. Watchdog timers may be +// started from interrupt level. +// +// To replace either the timeout or the routine to be executed, +// call VXWWd::start() again; only the most recent +// VXWWd::start() on a given watchdog ID has any effect. (If your +// application requires multiple watchdog routines, use VXWWd::VXWWd() to +// generate separate a watchdog for each.) To cancel a watchdog +// timer before the specified tick count is reached, call VXWWd::cancel(). +// +// Watchdog timers execute only once, but some applications require +// periodically executing timers. To achieve this effect, the timer +// routine itself must call VXWWd::start() to restart the timer on each +// invocation. +// +// WARNING: The watchdog routine runs in the context of the +// system-clock ISR; thus, it is subject to all ISR restrictions. +// +// RETURNS: OK, or ERROR if the watchdog timer cannot be started. +// +// SEE ALSO: VXWWd::cancel() +// + + STATUS start (int delay, FUNCPTR pRoutine, int parameter) + { + return wdStart (wd_, delay, pRoutine, parameter); + } + + protected: + +//////////////////////////////////////////////////////////////////////////////// +// +// VXWWd::VXWWd (const VXWWd &) - copy constructor +// +// RETURNS: N/A +// +// NOMANUAL +// + + VXWWd (const VXWWd & aWd) + : wd_ (aWd.wd_) + { + } + +//////////////////////////////////////////////////////////////////////////////// +// +// VXWWd::operator=(const VXWWd &) - assignment operator +// +// RETURNS: reference to +// +// NOMANUAL +// + + VXWWd & operator = (const VXWWd & aWd) + { + wd_ = aWd.wd_; + return *this; + } + virtual void * myValue (); + WDOG_ID wd_; + }; + +#endif /* ifndef vxwWdLib_h */ diff --git a/h/wait.h b/h/wait.h new file mode 100644 index 0000000..35960f6 --- /dev/null +++ b/h/wait.h @@ -0,0 +1,65 @@ +/* wait.h - wait facility library header */ + +/* + * Copyright (c) 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. + */ + +/* +modification history +-------------------- +01d,24aug05,kk updated wait() and waitpid() API +01c,27aug04,md fixed WIFSIGNALED() macro +01b,26nov03,nrj added function prototype +01a,28oct03,nrj written from posix spec +*/ + +#ifndef __INCwaith +#define __INCwaith + +#ifdef __cplusplus +extern "C" { +#endif + +#define WNOHANG 0x01 /* do not hang if no status is */ + /* available; return immediately */ + +/* not supported, for compatibility */ + +#define WUNTRACED 0x02 /* report status of stopped childs */ + +/* macros for analyzing process status */ + +#define WIFEXITED(status) ((int)((status) & 0xFF00) == 0) +#define WIFSIGNALED(status) ((int)((status) & 0xFF00) != 0) +#define WIFSTOPPED(status) ((int)((status) & 0xFF0000) != 0) +#define WEXITSTATUS(status) ((int)((status) & 0xFF)) +#define WTERMSIG(status) ((int)(((status) >> 8) & 0xFF)) +#define WSTOPSIG(status) ((int)(((status) >> 16) & 0xFF)) + +/* Only include while building kernel */ + +#ifdef _WRS_KERNEL + +#define SET_EXITSTATUS(status) ((int)((status)&0xFF)) +#define SET_TERMSIG(sig) ((int)(((sig)<<8)&0xFF00)) +#define SET_STOPSIG(sig) ((int)(((sig)<<16)&0xFF0000)) + +extern RTP_ID wait(int *); +extern RTP_ID waitpid(RTP_ID, int *, int); + +#else + +extern pid_t wait(int *); +extern pid_t waitpid(pid_t, int *, int); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwaith */ diff --git a/h/wdLib.h b/h/wdLib.h new file mode 100644 index 0000000..18f442e --- /dev/null +++ b/h/wdLib.h @@ -0,0 +1,104 @@ +/* wdLib.h - watchdog timer library header */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +02h,07oct05,yvp Used VX_OBJ_ALIGN_SIZE to align statically instantiated + objects (SPR 113405). +02g,30aug05,yvp Reworked VX_WDOG macro to undo struct workaround. +02f,08aug05,yvp Added VX_WDOG macro for static instantiation of watchdogs. + Added prototype for wdInitialize(). + Updated copyright. #include now with angle brackets. +02e,04aug05,yvp Added prototype for create/delete library init. +02d,26jun03,dcc removed non-ANSI prototypes +02c,14mar03,dcc moved WDOG_ID definition to types/vxWind.h +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01h,26may92,rrr the tree shuffle +01g,04oct91,rrr passed through the ansification filter + -changed copyright notice +01f,23oct90,shl changed wdStart()'s third parameter type to VOIDFUNCPTR. +01e,05oct90,dnw deleted private functions. +01d,05oct90,shl added ANSI function prototypes. + added copyright notice. +01c,26jun90,jcf removed generic status codes. +01b,17apr90,jcf subsumed into wind 2.0. +01a,21may84,dnw written +*/ + +#ifndef __INCwdLibh +#define __INCwdLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#ifndef _ASMLANGUAGE + +/* macro used to statically declare watchdogs */ + +/******************************************************************************* +* +* VX_WDOG - declare storage for a watchdog +* +* This macro declares storage for a watchdog having name . It only +* generates data declarations for the watchdog. To fully instantiate the +* watchdog and make it ready for use, function wdInitialize() must be called +* after using this macro. This macro is useful for declaring watchdogs +* statically (i.e. at compile time, without using any dynamic memory +* allocation at runtime). +* +* Sample usage of this macro is as follows: +* \cs +* #include +* #include +* +* VX_WDOG(myWdog); /@ declare the watchdog @/ +* WDOG_ID myWdogId; /@ watchdog ID for further operations @/ +* +* STATUS initializeFunction (void) +* { +* if ((myWdogId = wdInitialize (myWdog)) == NULL) +* return (ERROR); /@ initialization failed @/ +* else +* return (OK); +* } +* \ce +* +* SEE ALSO: wdInitialize() +* \NOMANUAL +*/ + +#define VX_WDOG(name) \ + _WRS_DATA_ALIGN_BYTES(VX_OBJ_ALIGN_SIZE) char name [VX_WDOG_SIZE] + +/* function declarations */ + +extern STATUS wdLibInit (void); +extern WDOG_ID wdInitialize (char * pWdMem); +extern void wdCreateLibInit (void); +extern WDOG_ID wdCreate (void); +extern STATUS wdDelete (WDOG_ID wdId); +extern STATUS wdStart (WDOG_ID wdId, int delay, FUNCPTR pRoutine, + int parameter); +extern STATUS wdCancel (WDOG_ID wdId); +extern void wdShowInit (void); +extern STATUS wdShow (WDOG_ID wdId); +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdLibh */ diff --git a/h/wdb/dll.h b/h/wdb/dll.h new file mode 100644 index 0000000..f448cc5 --- /dev/null +++ b/h/wdb/dll.h @@ -0,0 +1,57 @@ +/* dll.h - doubly linked list library */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,25apr02,jhw Added C++ support (SPR 76304). +01c,11oct95,ms removed "static __inline__" (SPR #4500) +01b,05apr95,ms cleanup + fixes for when !define(__GNUC__). +01a,10oct94,rrr written. +*/ + +#ifndef _INCdllh +#define _INCdllh + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct __dll + { + struct __dll *__dll_next; + struct __dll *__dll_prev; + } dll_t; + +#define __dll_init(d) ((d)->__dll_next = (d)->__dll_prev = (d)) +#define __dll_remove(d) ((d)->__dll_prev->__dll_next = (d)->__dll_next, \ + (d)->__dll_next->__dll_prev = (d)->__dll_prev) +#define __dll_head(d) ((d)->__dll_next) +#define __dll_tail(d) ((d)->__dll_prev) +#define __dll_next(d) ((d)->__dll_next) +#define __dll_prev(d) ((d)->__dll_prev) +#define __dll_end(d) (d) +#define __dll_empty(d) ((d)->__dll_next == (d)) +#define __dll_insert(pNode, pPrev) { \ + __dll_next(pNode) = __dll_next(pPrev); \ + __dll_prev(pNode) = (pPrev); \ + __dll_next(pPrev) = (pNode); \ + __dll_prev(__dll_next(pNode)) = (pNode); \ + } + +#define dll_empty(pList) __dll_empty(pList) +#define dll_insert(pNode, pPrev) __dll_insert(pNode, pPrev) +#define dll_init(pNode) __dll_init(pNode) +#define dll_remove(pNode) __dll_remove(pNode) +#define dll_head(pNode) __dll_head(pNode) +#define dll_tail(pNode) __dll_tail(pNode) +#define dll_next(pNode) __dll_next(pNode) +#define dll_prev(pNode) __dll_prev(pNode) +#define dll_end(pNode) __dll_end(pNode) + +#ifdef __cplusplus +} +#endif + +#endif /* _INCdllh */ diff --git a/h/wdb/wdb.h b/h/wdb/wdb.h new file mode 100644 index 0000000..16cde77 --- /dev/null +++ b/h/wdb/wdb.h @@ -0,0 +1,1195 @@ +/* wdb.h - WDB protocol definition header */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use of this + * software may be licensed only pursuant to the terms of an applicable Wind + * River license agreement. + */ + +/* +modification history +-------------------- +03k,29apr05,bpn Added WDB_RET_TYPE_CLEAR macro (SPR#108704). +03j,04jun04,dbt Added ctors and dtors fields in WDB_MOD_INFO. +03i,06may04,dbt Updated Modules & Symbols synchronization structures. +03h,28apr04,elg Change context name in exception information structure. +03g,27apr04,elg Add signal number information in exception event. +03f,13apr04,elg Remove coprocessor types. +03e,23mar04,elg Rework way contexts are transmitted in events. +03d,05mar04,elg Modify context structure to have more generic. +03c,22jan04,elg Add new events for breakpoint synchronization. + Add new event for agent mode change notification. + Modify exception event information. +03c,26feb04,mil Added SPE support for PPC85XX. +03b,05nov03,x_p Changed CTX_CREATE_DESC to handle argc and envp for Linux +03a,13oct03,elg Modify breakpoint information. +02z,30sep03,elg Finalize WDB protocol. + Add CPU family and CPU variant fields. +02y,29sep03,fle rather include rpc/rpc.h than xdr/rpc.h +02x,08sep03,tbu added WDB_LINUX_INFO type +02w,20may03,elg Add RTP context type. +02v,27feb03,elg Merge file with BSD. +02u,04feb03,elg Add WDB merged protocol. +02t,19dec00,elg Documentation check up. +02s,05sep00,elg Modify the WDB_RT_INFO structure (SPR 32724). +02r,29aug00,elg Modify wdbCore structure (SPR 32749). +02q,06jun00,dbt Added several fields in module descriptor. +02p,30may00,dbt Added partition ID in section descriptor. +02o,12apr00,elg Add address information for shared libraries and shared data. +02n,06mar00,elg Add WDB_VXWORKS_INFO structure. +02m,31jan00,dbt Added event to notify tgtsvr when a context is updated, + updated WDB version +02l,30jan00,dbt Added user services. +02k,25jan00,elg Fix doc generation error. +02j,10jan00,dbt Code cleanup for module/symbol synchronization code review. +02i,22nov99,elg Add float support in WDB_FUNC_CALL. +02h,04nov99,dbt Updated symbol table synchronization support. +02g,02nov99,elg Update WDB_CTX_CREATE_DESC for PD creation. +02f,26oct99,dbt Added support for trigger. +02e,17sep99,dbt added support for WDB symbol table synchronization. +02d,15sep99,elg Add support for overlapped memory model. +02c,02sep99,bpn The WDBPORT define makes reference to the communication port + variable (SPR #28606). +02b,06aug99,elg Add tool Id in WDB_CALL_RET_INFO. +02a,28jun99,elg Add WDB_CORE support. +01z,06apr99,elg add new WDB requests for Aeolus. +01a,04apr95,ms derived from work by tpr (and pme and ms). + merged wdb.h, wdbtypes.h, comtypes.h, and xdrwdb.h + removed #ifdef UNIX + made all data types of the form wdbXxx_t. + added types WDB_STRING_T, WDB_OPQ_DATA_T, TGT_ADDR_T + TGT_INT_T, and UINT32 + made most event data an array of ints. + removed obsolete data types. +*/ + +#ifndef __INCwdbh +#define __INCwdbh + +#ifdef __cplusplus +extern "C" { +#endif + +/* +DESCRIPTION + +The WDB protocol provides and extensible interface for remote debugging. + +The WDB agent has a fixed UDP port number in order to remove the complexity +of having a portmapper (which adds significant overhead if the +agent is configured as a ROM-monitor). + +Every RPC request sent to the agent has a four byte sequence number +appended to the begining of the parameters. The two most significant +bytes are the ID of the host. + +Every RPC reply from the agent has a four byte error status appended +to the begining of the reply. One of the bits of the error status +is reserved to mean that events are pending on the target, and another one is +reserved to mean that another request is needed to get a full result. The rest +of the error status is either OK (on success) or the reason +for failure. If a procedure fails, then the rest of the reply is +not decoded (e.g., it contains garbage). + +REQUIREMENTS + +Both the host and target must support 32 bit integers. + +INTERFACE + +errCode = wtxBeCall (HBackend, procNum, ¶ms, &reply); + +DATA TYPES + + UINT32 /@ 32 bit unsigned integer (defined in host.h) @/ + BOOL /@ TRUE or FALSE @/ + STATUS /@ OK or ERROR @/ + TGT_ADDR_T /@ target address (defined in host.h) @/ + TGT_INT_T /@ target integer (defined in host.h) @/ + WDB_STRING_T /@ pointer to a string (a local address) @/ + WDB_OPQ_DATA_T /@ pointer to a block of memory (a local address) @/ + +Each side must also provide the following XDR filters: + + xdr_UINT32 /@ encode/decode a 32 bit integer @/ +*/ + +/* includes */ + +#ifdef HOST +#include "host.h" +#else /* HOST */ +#include "wdb/wdbOsLib.h" +#endif /* HOST */ + +#include "rpc/rpc.h" + +/* definitions */ + +/* + * WDB function numbers. + * Each remote service is identified by an integer. + */ + + /* Session Management */ + +#define WDB_TARGET_PING 0 /* check if agent is alive */ +#define WDB_TARGET_CONNECT 1 /* connect to the agent */ +#define WDB_TARGET_DISCONNECT 2 /* terminate the connection */ +#define WDB_TARGET_MODE_SET 3 /* change the agents mode */ +#define WDB_TARGET_MODE_GET 4 /* get the agent mode */ + + /* Memory Operations */ + +#define WDB_MEM_READ 10 /* read a memory block */ +#define WDB_MEM_WRITE 11 /* write a memory block */ +#define WDB_MEM_FILL 12 /* fill memory with pattern */ +#define WDB_MEM_MOVE 13 /* move memory on target */ +#define WDB_MEM_CHECKSUM 14 /* checksum a memory block */ +#define WDB_MEM_PROTECT 15 /* write (un)protecting */ +#define WDB_MEM_CACHE_TEXT_UPDATE 16 /* called after loading text */ +#define WDB_MEM_SCAN 17 /* scan memory for a pattern */ +#define WDB_MEM_MANY_WRITE 18 /* scatter write */ +#define WDB_MEM_WRITE_MANY_INT 19 /* scatter write of ints */ + + /* Context Control */ + +#define WDB_CONTEXT_CREATE 30 /* create a new context */ +#define WDB_CONTEXT_KILL 31 /* remove a context */ +#define WDB_CONTEXT_SUSPEND 32 /* suspend a context */ +#define WDB_CONTEXT_RESUME 33 /* resume a context */ +#define WDB_CONTEXT_STATUS_GET 34 /* get the context status */ +#define WDB_CONTEXT_ATTACH 35 /* attach ctx to the agent */ +#define WDB_CONTEXT_DETACH 36 /* detach ctx from the agent */ + + /* Register Manipulation */ + +#define WDB_REGS_GET 40 /* get register(s) */ +#define WDB_REGS_SET 41 /* set register(s) */ + + /* Virtual I/O */ + +#define WDB_VIO_WRITE 51 /* write a virtual I/O buffer */ + + /* Eventpoints */ + +#define WDB_EVENTPOINT_ADD 60 /* add an eventpoint */ +#define WDB_EVENTPOINT_DELETE 61 /* delete an eventpoint */ + + /* Events */ + +#define WDB_EVENT_GET 70 /* get info about an event */ + + /* debugging */ + +#define WDB_CONTEXT_CONT 80 /* XXX - same as resume? */ +#define WDB_CONTEXT_STEP 81 /* continue a context */ +#define WDB_CONTEXT_STOP 82 /* stop a context */ + + /* Miscelaneous */ + +#define WDB_FUNC_CALL 90 /* spawn a function */ +#define WDB_EVALUATE_GOPHER 91 /* evaluate a gopher tape */ +#define WDB_DIRECT_CALL 92 /* call a function directly */ + + /* module management */ + +#define WDB_SYM_LIST_ADD 100 /* add a symbol list */ +#define WDB_SYM_GET 101 /* get symbol info. */ +#define WDB_MOD_INFO_GET 102 /* get module info. */ +#define WDB_MOD_ADD 103 /* add a module */ +#define WDB_MOD_REMOVE 104 /* remove a module */ + + /* Target commands */ + +#define WDB_USR_SVC_CTRL 110 /* Add or Remove a command */ + /* on the target */ +#define WDB_USR_SVC_CALL 111 /* call a command on the */ + /* target */ + + /* Thread Management */ + +#define WDB_THREAD_INFO_SET 120 /* set thread debug info */ +#define WDB_THREAD_INFO_GET 121 /* get thread debug info */ + +/* + * WDB error codes. + * Each WDB function returns an error code. + * If the error code is zero (OK), then the procedure succeded and + * the reply data is valid. + * If the error code is nonzero, then the procedure failed. In this case + * the error code indicates the reason for failure and the reply data + * is invalid. + */ + +#define WDB_OK OK /* success */ +#define WDB_ERR_INVALID_PARAMS 0x501 /* params invalid */ +#define WDB_ERR_MEM_ACCESS 0x502 /* memory fault */ +#define WDB_ERR_AGENT_MODE 0x503 /* wrong agent mode */ +#define WDB_ERR_RT_ERROR 0x504 /* run-time callout failed */ +#define WDB_ERR_INVALID_CONTEXT 0x505 /* bad context ID */ +#define WDB_ERR_INVALID_VIO_CHANNEL 0x506 /* bad virtual I/O channel */ +#define WDB_ERR_INVALID_EVENT 0x507 /* no such event type */ +#define WDB_ERR_INVALID_EVENTPOINT 0x508 /* no such eventpoint */ +#define WDB_ERR_GOPHER_FAULT 0x509 /* gopher fault */ +#define WDB_ERR_GOPHER_TRUNCATED 0x50a /* gopher tape too large */ +#define WDB_ERR_EVENTPOINT_TABLE_FULL 0x50b /* out of room */ +#define WDB_ERR_NO_AGENT_PROC 0x50c /* agent proc not installed */ +#define WDB_ERR_NO_RT_PROC 0x50d /* run-time callout unavail */ +#define WDB_ERR_GOPHER_SYNTAX 0x50e /* gopher syntax error */ +#define WDB_ERR_NOT_FOUND 0x50f /* object not found */ +#define WDB_ERR_HW_REGS_EXHAUSTED 0x510 /* hw breakpoint regs full */ +#define WDB_ERR_INVALID_HW_BP 0x511 /* invalid hw breakpoint */ +#define WDB_ERR_USR_SVC_EXHAUSTED 0x512 /* no more use service */ + /* available */ +#define WDB_ERR_USR_SVC_ALREADY_USED 0x513 /* specified user service id */ + /* is already used */ +#define WDB_ERR_NO_RT_CTX 0x514 /* context not supported by */ + /* run time */ +#define WDB_ERR_NO_PROCESS 0x515 /* no process support */ + +#define WDB_ERR_FILE_NOT_FOUND 0x520 /* file not found */ +#define WDB_ERR_FILE_NULL_SIZE 0x521 /* size of file = 0 */ +#define WDB_ERR_FILE_BAD_FORMAT 0x522 /* bad file format */ + +#define WDB_ERR_PROC_FAILED 0x5ff /* generic proc failure */ + +#define WDB_ERR_NO_CONNECTION 0x600 /* not connected */ +#define WDB_ERR_CONNECTION_BUSY 0x601 /* someone else connected */ +#define WDB_ERR_COMMUNICATION 0x6ff /* generic comm error */ + +/* + * WDB miscelaneous definitions. + */ + + /* agent modes */ + +#define WDB_MODE_APP 1 /* application mode agent */ +#define WDB_MODE_TASK WDB_MODE_APP /* task mode agent */ +#define WDB_MODE_USER WDB_MODE_APP /* user mode agent */ +#define WDB_MODE_SYSTEM 2 /* system mode agent */ +#define WDB_MODE_EXTERN WDB_MODE_SYSTEM /* system mode agent */ +#define WDB_MODE_DUAL (WDB_MODE_TASK | WDB_MODE_EXTERN) /* dual mode */ +#define WDB_MODE_BI WDB_MODE_DUAL + + /* size of WDB headers */ + +#define WDB_IP_HDR_SZ 20 +#define WDB_UDP_HDR_SZ 8 +#define WDB_RPC_REPLY_HDR_SZ 24 +#define WDB_RPC_REQUEST_HDR_SZ 40 +#define WDB_WRAPPER_HDR_SZ 12 + + /* maximum number of words of event data */ + +#define WDB_MAX_EVT_DATA 20 + + /* gopher stream format type codes */ + +#define GOPHER_UINT32 0 +#define GOPHER_STRING 1 +#define GOPHER_UINT16 2 +#define GOPHER_UINT8 3 +#define GOPHER_FLOAT32 4 +#define GOPHER_FLOAT64 5 +#define GOPHER_FLOAT80 6 +#define GOPHER_SEPARATOR 7 +#define GOPHER_UINT64 8 + + /* option bits for task creation */ + +#define WDB_UNBREAKABLE 0x0002 /* ignore breakpoints */ +#define WDB_FP_RETURN 0x8000 /* return value is a double */ + +/* set / get / clear the return type in the options word */ + +#define WDB_RET_TYPE_SET(x) (((x) & 0x3) << 15) +#define WDB_RET_TYPE_GET(x) (((x) >> 15) & 0x3) +#define WDB_RET_TYPE_CLEAR(x) *(x) &= ~(0x3 << 15); + + /* TSFS file type bits */ + +#define WDB_TSFS_S_IFREG 0x4000 /* directory */ +#define WDB_TSFS_S_IFDIR 0x8000 /* regular file */ + + /* TSFS open mode flags */ + +#define WDB_TSFS_O_RDONLY 0 +#define WDB_TSFS_O_WRONLY 1 +#define WDB_TSFS_O_RDWR 2 +#define WDB_TSFS_O_CREAT 0x0200 +#define WDB_TSFS_O_TRUNC 0x0400 +#define WDB_TSFS_O_APPEND 0x0008 +#define WDB_TSFS_O_EXCL 0x0800 +#define WDB_TSFS_O_TEXT 0x4000 /* for Win32 hosts; to override default + binary translation mode */ + + /* TSFS portable errno values */ + +/* + * POSIX errnos are used by the TSFS but not defined here. These errno + * values are portable between the target and host, because they are not + * supported by one of the host platforms, or the errno is numbered + * differently on each host platform. + */ + +#define WDB_TSFS_ERRNO_ENOTEMPTY (1 << 16) +#define WDB_TSFS_ERRNO_EDEADLK (2 << 16) +#define WDB_TSFS_ERRNO_ENOLCK (3 << 16) +#define WDB_TSFS_ERRNO_EMSGSIZE (4 << 16) +#define WDB_TSFS_ERRNO_EOPNOTSUPP (5 << 16) +#define WDB_TSFS_ERRNO_EADDRNOTAVAIL (6 << 16) +#define WDB_TSFS_ERRNO_ENOTSOCK (7 << 16) +#define WDB_TSFS_ERRNO_ENETRESET (8 << 16) +#define WDB_TSFS_ERRNO_ECONNABORTED (9 << 16) +#define WDB_TSFS_ERRNO_ECONNRESET (10 << 16) +#define WDB_TSFS_ERRNO_ECONNREFUSED (11 << 16) +#define WDB_TSFS_ERRNO_ENOBUFS (12 << 16) +#define WDB_TSFS_ERRNO_ENOTCONN (13 << 16) +#define WDB_TSFS_ERRNO_ESHUTDOWN (14 << 16) +#define WDB_TSFS_ERRNO_ETIMEDOUT (15 << 16) +#define WDB_TSFS_ERRNO_EINPROGRESS (16 << 16) +#define WDB_TSFS_ERRNO_EWOULDBLOCK (17 << 16) +#define WDB_TSFS_ERRNO_ENOSR (18 << 16) +#define WDB_TSFS_ERRNO_ELOOP (19 << 16) +#define WDB_TSFS_ERRNO_ENAMETOOLONG (20 << 16) +#define WDB_TSFS_ERRNO_EBADMSG (21 << 16) + +/* session information */ + +#ifndef HOST +#define WDBPORT wdbPort /* this variable contains */ + /* the UDP port to connect */ +#else /* HOST */ +#define WDBPORT (UINT16) 0x4321 /* UDP port to connect */ +#endif /* HOST */ + +#define WDBPROG (u_long) 0x55555555 /* RPC program number */ +#define WDBVERS (u_long) 1 /* RPC version number */ +#define WDB_VERSION_STR "4.0" + +/* message cores */ + +#define WDB_EVENT_NOTIFY 0x8000 /* notify bit in errCode */ +#define WDB_TO_BE_CONTINUED 0x4000 /* continue bit in errCode */ +#define WDB_HOST_ID_MASK 0xffff0000 /* hostId in seqNum */ + +/* memory options */ + +#define WDB_MEM_OPT_UNPROTECT 0x1 /* unprotect memory */ +#define WDB_MEM_OPT_BYTE 0x10000000 /* memory byte access */ +#define WDB_MEM_OPT_SHORT 0x20000000 /* memory short access */ +#define WDB_MEM_OPT_INT 0x40000000 /* memory int access */ + +#define WDB_MEM_WIDTH_GET(x) ((x & 0xf0000000) >> 28) +#define WDB_MEM_WIDTH_SET(x) ((x & 0xf) << 28) + +/* symbol table synchronization options */ + +#define WDB_SYM_SYNC_CORE_FILE 0x1 /* synchronize core file sym. */ + +/* available agent options */ + +#define WDB_AGENT_IS_SCALABLE 0x1 /* agent is scalable */ +#define WDB_AGENT_HAS_MDL_SYM_SYNC 0x2 /* support for module and */ + /* SYNC */ + +/* keep these values for backward compatibility issues */ + +#define WDB_REG_SET_IU 0 /* integer unit register set */ +#define WDB_REG_SET_FPU 1 /* floating point unit register set */ +#define WDB_REG_SET_MMU 2 /* memory management unit reg set */ +#define WDB_REG_SET_CU 3 /* cache unit register set */ +#define WDB_REG_SET_TPU 4 /* timer processor unit register set */ +#define WDB_REG_SET_SYS 5 /* system registers */ +#define WDB_REG_SET_DSP 6 /* dsp registers */ +#define WDB_REG_SET_AV 7 /* altivec registers */ +#define WDB_REG_SET_SPE 8 /* SPE registers */ + +/* typedefs */ + +/* + * WDB enum types. + */ + +typedef enum wdb_ctx_type /* type of context on the target */ + { + WDB_CTX_SYSTEM = 0, /* system mode */ + WDB_CTX_GROUP = 1, /* process group (not implemented) */ + WDB_CTX_ANY = 2, /* any context (not implemented) */ + WDB_CTX_TASK = 3, /* specific task or processes */ + WDB_CTX_ANY_TASK = 4, /* any task */ + WDB_CTX_ISR = 5, /* specific ISR */ + WDB_CTX_ANY_ISR = 6, /* any ISR */ + WDB_CTX_PD = 7, /* specific protection domain */ + WDB_CTX_PROCESS = 8, /* specific process */ + WDB_CTX_RTP = 9, /* specific RTP */ + WDB_CTX_TYPE_NUM /* type number, must be last field */ + } WDB_CTX_TYPE; + +typedef enum wdb_ctx_status /* status of context on the target */ + { + WDB_CTX_RUNNING = 0, /* context is running */ + WDB_CTX_SUSPENDED = 1, /* context is suspended */ + WDB_CTX_STOPPED = 2 /* context is stopped */ + } WDB_CTX_STATUS; + +typedef enum wdb_evt_type /* type of event on the target */ + { + WDB_EVT_NONE = 0, /* no event */ + WDB_EVT_CTX_START = 1, /* context creation */ + WDB_EVT_CTX_EXIT = 2, /* context exit */ + WDB_EVT_BP = 3, /* breakpoint */ + WDB_EVT_HW_BP = 4, /* hardware breakpoint */ + WDB_EVT_WP = 5, /* watchpoint */ + WDB_EVT_EXC = 6, /* exception */ + WDB_EVT_VIO_WRITE = 7, /* virtual I/O write */ + WDB_EVT_CALL_RET = 8, /* function call finished */ + WDB_EVT_TSFS_OP = 9, /* VIO II operation */ + WDB_EVT_USER = 10, /* user event */ + WDB_EVT_MOD_LOAD = 11, /* object module load */ + WDB_EVT_MOD_UNLOAD = 12, /* object module unload */ + WDB_EVT_SYM_ADD = 13, /* symbol add */ + WDB_EVT_TRIGGER = 14, /* trigger event */ + WDB_EVT_CTX_UPDATE = 15, /* context update */ + WDB_EVT_BP_CREATE = 16, /* breakpoint creation */ + WDB_EVT_BP_DELETE = 17, /* breakpoint deletion */ + WDB_EVT_MODE = 18, /* WDB mode changed */ + WDB_EVT_CTX_DUMP = 30 /* context dump */ + } WDB_EVT_TYPE; + +typedef enum wdb_action_type /* what to do when an event occurs */ + { + WDB_ACTION_CALL = 1, /* condition the evtpt via a proc */ + WDB_ACTION_NOTIFY = 2, /* notify the host */ + WDB_ACTION_STOP = 4, /* stop the task or process */ + WDB_ACTION_SYS_STOP = 8, /* stop system */ + WDB_ACTION_ALL_STOP = 16 /* stop RTP tasks, or kernel tasks */ + } WDB_ACTION_TYPE; + +/* additional defines */ + +#define WDB_SYS_PROHIB_ACTION (WDB_ACTION_STOP | WDB_ACTION_ALL_STOP) +#define WDB_ACTION_STOP_MASK (WDB_ACTION_STOP | WDB_ACTION_ALL_STOP | \ + WDB_ACTION_SYS_STOP) + +typedef enum wdb_vt_option_type /* breakpoint options */ + { + WDB_EVT_BP_PERSISTENT = 1 /* breakpoint is persistent */ + } WDB_EVT_OPTION_TYPE; + +typedef enum wdb_call_ret_type /* type of return value */ + { + WDB_CALL_RET_INT = 0, /* an integer is returned */ + WDB_CALL_RET_DBL = 1, /* a double is returned */ + WDB_CALL_RET_FLT = 2 /* a float is returned */ + } WDB_CALL_RET_TYPE; + +typedef enum wdb_rt_type /* type of run-time system */ + { + WDB_RT_NULL = 0, /* standalone WDB agent */ + WDB_RT_VXWORKS = 1 /* WDB agent integrated in VxWorks */ + } WDB_RT_TYPE; + +/* + * WDB primitive data types. + */ + +#ifndef HOST +typedef UINT32 TGT_ADDR_T; +typedef INT32 TGT_INT_T; +#endif /* HOST */ + +typedef char * WDB_STRING_T; +typedef char * WDB_OPQ_DATA_T; +typedef char ** WDB_STRING_ARRAY; + +/* + * WDB compound data types. + */ + +typedef struct wdb_core /* common header WDB structure */ + { + TGT_INT_T numInts; /* WDB_CORE length: 2 */ + UINT32 toolId; /* tool ID */ + UINT32 memCtx; /* context WDB request sees */ + } WDB_CORE; + +/* Context Structures */ + +#define WDB_CTX_MAX_ARGS 2 /* maximum of information in context */ + +typedef struct wdb_ctx /* a particular context */ + { + WDB_CTX_TYPE contextType; /* type of context */ + TGT_INT_T numArgs; /* structure length: it depends on */ + /* context type and OS */ + TGT_INT_T * args; /* information to characterize */ + /* a context */ + } WDB_CTX; + +typedef struct wdb_ctx_create_desc /* how to create a context */ + { + WDB_CTX_TYPE contextType; /* task, PD, process or system */ + WDB_STRING_T name; /* name */ + TGT_INT_T redirIn; /* redirect input file (or 0) */ + TGT_INT_T redirOut; /* redirect output file (or 0) */ + TGT_INT_T redirErr; /* redirect error output file (or 0) */ + TGT_ADDR_T baseAddr; /* virtual base address */ + + union + { + + /* the following are used for system contexts */ + + struct + { + TGT_ADDR_T entry; /* context entry point */ + TGT_INT_T numArgs; /* number of arguments */ + TGT_INT_T * args; /* arguments */ + } sys; + + /* the following are only used for task contexts */ + + struct + { + TGT_ADDR_T entry; /* task entry point */ + TGT_INT_T numArgs; /* number of arguments */ + TGT_INT_T * args; /* arguments */ + TGT_ADDR_T pdId; /* protection domain father */ + TGT_INT_T priority; /* priority */ + UINT32 size; /* task stack size */ + TGT_INT_T options; /* context options */ + } task; + + /* the following are only used for protection domain contexts */ + + struct + { + TGT_INT_T loPriority; /* lowest priority of a task */ + TGT_INT_T hiPriority; /* highest priority of a task */ + TGT_ADDR_T physAddr; /* shared data physical addr */ + WDB_STRING_T pagePoolList; /* list page pools */ + WDB_STRING_T linkPath; /* link path */ + UINT32 size; /* heap size */ + TGT_INT_T options; /* context options */ + } pd; + + /* the following are only used for RTP contexts */ + + struct + { + TGT_INT_T numArgv; /* number of argv elements */ + WDB_STRING_ARRAY argv; /* pointer to argv array */ + TGT_INT_T numEnvp; /* number of envp elements */ + WDB_STRING_ARRAY envp; /* pointer to envp array */ + TGT_INT_T priority; /* priority of initial task */ + TGT_INT_T stackSize; /* stack for initial task */ + TGT_INT_T options; /* options passed to RTP */ + } rtp; + + /* the following are only used for process contexts */ + + struct + { + TGT_INT_T uid; /* process user ID */ + TGT_INT_T gid; /* process group ID */ + TGT_INT_T numArgv; /* number of argv elements */ + WDB_STRING_ARRAY argv; /* pointer to argv array */ + TGT_INT_T numEnvp; /* number of envp elements */ + WDB_STRING_ARRAY envp; /* pointer to envp array */ + TGT_INT_T priority; /* priority of initial task */ + TGT_INT_T stackSize; /* stack for initial task */ + TGT_INT_T options; /* options passed to RTP */ + } process; + } ctxSpecific; + } WDB_CTX_CREATE_DESC; + +typedef struct wdb_ctx_kill_desc /* how to kill a context */ + { + WDB_CTX context; /* context to kill */ + TGT_INT_T options; /* how to kill a context */ + } WDB_CTX_KILL_DESC; + +typedef struct wdb_direct_call_ret /* direct call return info */ + { + TGT_INT_T returnVal; /* returned value */ + TGT_INT_T errnoVal; /* errno value */ + } WDB_DIRECT_CALL_RET; + +/* Memory Structures */ + +typedef struct wdb_mem_region /* a region of target memory */ + { + UINT32 options; /* memory options */ + TGT_ADDR_T baseAddr; /* memory region base address */ + TGT_INT_T numBytes; /* memory region size */ + UINT32 param; /* procedure dependent parameter */ + } WDB_MEM_REGION; + +typedef struct wdb_mem_xfer /* transfer a block of memory */ + { + UINT32 options; /* memory options */ + WDB_OPQ_DATA_T source; /* data to transfer */ + TGT_ADDR_T destination; /* requested destination */ + TGT_INT_T numBytes; /* number of bytes transferred */ + } WDB_MEM_XFER; + +typedef struct wdb_mem_scan_desc + { + WDB_MEM_REGION memRegion; /* region of memory to scan */ + WDB_MEM_XFER memXfer; /* pattern to scan for */ + } WDB_MEM_SCAN_DESC; + +/* Debug Structures */ + +typedef struct wdb_ctx_step_desc /* how to single step a context */ + { + WDB_CTX context; /* context to step */ + TGT_ADDR_T startAddr; /* lower bound of step range */ + TGT_ADDR_T endAddr; /* upper bound of step range */ + } WDB_CTX_STEP_DESC; + +/* Register Structures */ + +typedef struct wdb_reg_read_desc /* register data to read */ + { + UINT32 regSetType; /* type of register set to read */ + WDB_CTX context; /* context associated with registers */ + WDB_MEM_REGION memRegion; /* subregion of the register block */ + } WDB_REG_READ_DESC; + +typedef struct wdb_reg_write_desc /* register data to write */ + { + UINT32 regSetType; /* type of register set to write */ + WDB_CTX context; /* context associated with registers */ + WDB_MEM_XFER memXfer; /* new value of the register set */ + } WDB_REG_WRITE_DESC; + +/* Target Structures */ + +typedef struct wdb_linux_info /* Linux specific information */ + { + UINT32 dummy; + } WDB_LINUX_INFO; + +typedef struct wdb_bsd_info /* BSD/OS specific information */ + { + UINT32 dummy; + } WDB_BSD_INFO; + +typedef struct wdb_vxworks_info /* vxWorks specific information */ + { + TGT_ADDR_T pdList; /* pointer on protection domain list */ + } WDB_VXWORKS_INFO; + +typedef struct wdb_rt_info /* info on the run-time system */ + { + WDB_STRING_T rtName; /* runtime name */ + WDB_STRING_T rtVersion; /* run time version */ + TGT_INT_T cpuFamily; /* target processor family type */ + TGT_INT_T cpuType; /* target processor type */ + WDB_STRING_T cpuVariant; /* target processor variant */ + WDB_STRING_T toolName; /* tool used to build the kernel */ + WDB_STRING_T bspShortName; /* BSP short name */ + UINT32 hasCoprocessor; /* target has a floating point unit */ + BOOL hasWriteProtect; /* target can write protect memory */ + TGT_INT_T pageSize; /* size of a page */ + TGT_INT_T endian; /* endianness (0x4321 or 0x1234) */ + WDB_STRING_T bspName; /* board support package name */ + WDB_STRING_T bootline; /* boot file path or NULL if embedded */ + TGT_ADDR_T memBase; /* target main memory base address */ + UINT32 memSize; /* target main memory size */ + TGT_INT_T numRegions; /* number of memory regions */ + WDB_MEM_REGION * memRegion; /* memory region descriptor(s) */ + TGT_ADDR_T hostPoolBase; /* host-controlled target memory pool */ + UINT32 hostPoolSize; /* host-controlled memory pool size */ + TGT_INT_T numInts; /* RT specific union length */ + union + { + WDB_VXWORKS_INFO vxWorksInfo; /* vxWorks specific information */ + WDB_BSD_INFO bsdInfo; /* BSD/OS specific information */ + WDB_LINUX_INFO linuxInfo; /* Linux specific information */ + } rtSpecific; + } WDB_RT_INFO; + +typedef struct wdb_agent_info /* info on the debug agent */ + { + WDB_STRING_T agentVersion; /* version of the WDB agent */ + TGT_INT_T mtu; /* maximum transfer size in bytes */ + TGT_INT_T mode; /* available agent modes */ + TGT_INT_T options; /* available agent options */ + } WDB_AGENT_INFO; + +typedef struct wdb_tgt_info /* info on the target */ + { + WDB_AGENT_INFO agentInfo; /* info on the agent */ + WDB_RT_INFO rtInfo; /* info on the run time system */ + } WDB_TGT_INFO; + +/* Eventpoint Structures */ + +typedef struct wdb_action /* a specific action */ + { + WDB_ACTION_TYPE actionType; + UINT32 actionArg; + TGT_ADDR_T callRtn; + TGT_INT_T callArg; + } WDB_ACTION; + +typedef struct wdb_evtpt_add_desc /* how to add an eventpoint */ + { + WDB_EVT_TYPE evtType; /* type of event to detect */ + TGT_INT_T numArgs; /* eventType dependent arguments */ + UINT32 * args; /* arguments list */ + WDB_CTX context; /* context in which event must occur */ + WDB_ACTION action; /* action to perform */ + } WDB_EVTPT_ADD_DESC; + +typedef struct wdb_evtpt_del_desc /* how to delete an eventpoint */ + { + WDB_EVT_TYPE evtType; /* type of event */ + TGT_ADDR_T evtptId; /* eventpoint ID */ + } WDB_EVTPT_DEL_DESC; + +/* Event Structures */ + +typedef struct wdb_evt_info /* event info for anything but VIO */ + { + TGT_INT_T numInts; /* number of ints of event data */ + UINT32 info [WDB_MAX_EVT_DATA]; /* event data */ + } WDB_EVT_INFO; + +typedef struct wdb_call_ret_info + { + UINT32 callId; /* returned from WDB_FUNC_CALL */ + UINT32 toolId; /* tool that did the function call */ + WDB_CALL_RET_TYPE returnType; /* return type */ + union + { + double returnValDbl; /* double return value */ + TGT_INT_T returnValInt; /* integer return value */ + float returnValFlt; /* float return value */ + } returnVal; + TGT_INT_T errnoVal; /* error status */ + } WDB_CALL_RET_INFO; + +typedef struct wdb_evt_data /* reply to a WDB_EVENT_GET */ + { + WDB_EVT_TYPE evtType; /* event type detected */ + union /* eventType specific info */ + { + WDB_MEM_XFER vioWriteInfo; /* vio write event data */ + WDB_CALL_RET_INFO callRetInfo; /* call return event data */ + WDB_EVT_INFO evtInfo; /* any other event info */ + } eventInfo; + } WDB_EVT_DATA; + +typedef struct wdb_exc_info /* WDB_EVT_INFO for exceptions */ + { + TGT_INT_T numInts; /* structure length */ + WDB_CTX_STATUS status; /* status of context */ + WDB_CTX_TYPE stoppedCtxType; /* context stopped by exception */ + TGT_INT_T stoppedArgs [WDB_CTX_MAX_ARGS]; + WDB_CTX_TYPE excCtxType; /* context that got exception */ + TGT_INT_T excArgs [WDB_CTX_MAX_ARGS]; + TGT_INT_T vec; /* hardware trap number */ + TGT_ADDR_T pEsf; /* address of exception stack frame */ + TGT_INT_T sigNum; /* signal number */ + } WDB_EXC_INFO; + +typedef struct wdb_bp_info /* WDB_EVT_INFO for breakpoints */ + { + TGT_INT_T numInts; /* structure length */ + WDB_CTX_STATUS status; /* status of stopped context */ + WDB_CTX_TYPE stoppedCtxType; /* context stopped on breakpoint */ + TGT_INT_T stoppedArgs [WDB_CTX_MAX_ARGS]; + WDB_CTX_TYPE hitCtxType; /* context that hit breakpoint */ + TGT_INT_T hitArgs [WDB_CTX_MAX_ARGS]; + TGT_ADDR_T pc; /* program counter */ + TGT_ADDR_T fp; /* frame pointer */ + TGT_ADDR_T sp; /* stack pointer */ + TGT_ADDR_T addr; /* breakpoint address (watchpoint) */ + } WDB_BP_INFO; + +typedef struct wdb_bp_create_info /* WDB_EVT_INFO for BP creation */ + { + TGT_INT_T numInts; /* structure length */ + TGT_ADDR_T bpId; /* breakpoint ID */ + WDB_EVT_TYPE bpType; /* breakpoint type */ + TGT_ADDR_T addr; /* breakpoint address */ + TGT_INT_T count; /* breakpoint count */ + WDB_CTX_TYPE ctxType; /* breakpoint context */ + TGT_INT_T ctxArgs [WDB_CTX_MAX_ARGS]; + WDB_ACTION action; /* action on breakpoint */ + WDB_EVT_OPTION_TYPE options; /* breakpoint options */ + UINT32 type; /* hardware breakpoint type */ + } WDB_BP_CREATE_INFO; + +typedef struct wdb_bp_delete_info /* WDB_EVT_INFO for BP deletion */ + { + TGT_INT_T numInts; /* 2 */ + TGT_ADDR_T bpId; /* breakpoint ID deleted */ + WDB_EVT_TYPE bpType; /* breakpoint type */ + } WDB_BP_DELETE_INFO; + +typedef struct wdb_mempart_info /* memory partition information */ + { + TGT_INT_T numInts; /* structure length */ + TGT_ADDR_T partId; /* memory partition address */ + TGT_ADDR_T pdId; /* context owner */ + WDB_STRING_T name; /* memory partition name */ + UINT32 size; /* memory partition size */ + } WDB_MEMPART_INFO; + +typedef struct wdb_mode_info /* WDB_EVT_INFO for mode change */ + { + TGT_INT_T numInts; /* 1 */ + TGT_INT_T mode; /* new mode */ + } WDB_MODE_INFO; + +typedef struct wdb_ctx_exit_info /* WDB_EVT_INFO for context exit */ + { + TGT_INT_T numInts; /* structure length */ + WDB_CTX_TYPE ctxType; /* context that exited */ + TGT_INT_T ctxArgs [WDB_CTX_MAX_ARGS]; + TGT_INT_T returnVal; /* context's return value/exit code */ + TGT_INT_T errnoVal; /* context's error status */ + } WDB_CTX_EXIT_INFO; + +typedef struct wdb_ctx_update_info /* WDB_EVT_INFO for context update */ + { + TGT_INT_T numInts; /* structure length */ + WDB_CTX_TYPE ctxType; /* context updated */ + TGT_INT_T ctxArgs [WDB_CTX_MAX_ARGS]; + } WDB_CTX_UPDATE_INFO; + +/* thread management */ + +typedef struct wdb_th_id + { + TGT_INT_T threadId; /* thread ID */ + TGT_INT_T threadStatus; /* thread status */ + } WDB_THREAD_ID; + +typedef struct wdb_th_id_list + { + TGT_INT_T numThreads; /* number of threads */ + WDB_THREAD_ID * pThreadId; /* thread ID array */ + } WDB_THREAD_ID_LIST; + +/* symbol table synchronization structures */ + +#define WDB_MOD_NUM_SEGS 3 /* Number of segments in a module */ + +typedef struct wdb_sym_info /* WDB_SYM_INFO for symbols */ + { + struct wdb_sym_info * next; /* next symbol */ + TGT_INT_T symId; /* host or target symbol's ID */ + TGT_ADDR_T value; /* symbol value */ + TGT_INT_T symRef; /* symbols reference */ + TGT_INT_T type; /* symbol type */ + TGT_INT_T group; /* symbol group */ + TGT_INT_T nameLength; /* symbol name length */ + WDB_STRING_T name; /* symbol name */ + } WDB_SYM_INFO; + +typedef struct wdb_sym_list /* symbol list */ + { + TGT_INT_T index; /* request index */ + BOOL moreData; /* more data to come ? */ + WDB_SYM_INFO * pSymInfo; /* Start of symbol list */ + } WDB_SYM_LIST; + +typedef struct wdb_sym_id /* host and target symbol ID */ + { + TGT_INT_T hostSymbolId; /* host symbol ID */ + TGT_INT_T tgtSymbolId; /* target symbol ID */ + } WDB_SYM_ID; + +typedef struct wdb_sym_id_list /* symbols' ID list */ + { + TGT_INT_T numSym; /* number of symbols */ + WDB_SYM_ID * pSymId; /* symbol ID array */ + } WDB_SYM_ID_LIST; + +typedef struct wdb_sect_info /* section information */ + { + struct wdb_sect_info * next; /* next section */ + TGT_INT_T nameLength; /* section name length */ + WDB_STRING_T name; /* section name */ + TGT_INT_T type; /* section type */ + TGT_ADDR_T address; /* section address */ + TGT_INT_T size; /* section size */ + TGT_INT_T flags; /* section flags */ + TGT_INT_T cksum; /* section checksum */ + } WDB_SECT_INFO; + +typedef struct wdb_seg_info /* segment information */ + { + TGT_INT_T type; /* segment type */ + TGT_ADDR_T address; /* segment address */ + TGT_INT_T size; /* segment size */ + TGT_INT_T flags; /* segment flags */ + } WDB_SEG_INFO; + +typedef struct wdb_mod_info /* module information */ + { + TGT_INT_T index; /* request index */ + TGT_INT_T nameLength; /* module name length */ + WDB_STRING_T name; /* module name */ + TGT_INT_T flags; /* load flags */ + TGT_INT_T group; /* group number */ + TGT_INT_T commTotalSize; /* memory used by common symbols */ + TGT_INT_T swapNeeded; /* TRUE if the headers need byte swap */ + TGT_INT_T undefSymCount; /* number of undefined symbols */ + TGT_ADDR_T ctors; /* static constructors */ + TGT_ADDR_T dtors; /* static constructors */ + BOOL moreData; /* more data to come ? */ + WDB_SEG_INFO segment[WDB_MOD_NUM_SEGS]; /* segments desc. */ + WDB_SECT_INFO * section; /* section list */ + } WDB_MOD_INFO; + +typedef struct wdb_sym_mod_desc /* descriptor used to get sym. info */ + { + TGT_INT_T moduleId; /* module to synchronize */ + TGT_INT_T symbolId; /* symbol to synchronize */ + TGT_INT_T options; /* options */ + } WDB_SYM_MOD_DESC; + +/* command structures */ + +typedef enum wdb_usr_svc_ctrl_opcode /* opcode for WDB_USR_SVC_CTRL op. */ + { + WDB_USR_SVC_ADD = 0, /* add a new service on the target */ + WDB_USR_SVC_REMOVE = 1, /* remove a service on the target */ + WDB_USR_SVC_FIND = 2 /* find a service on the target */ + } WDB_USR_SVC_CTRL_OPCODE; + +typedef struct wdb_usr_svc_add_info /* extra field for WDB_USR_SVC_ADD */ + { + TGT_INT_T func; /* routine associated with service */ + TGT_INT_T initRtn; /* init routine for the new service */ + TGT_INT_T initRtnArg; /* argument for init routine */ + } WDB_USR_SVC_ADD_INFO; + +typedef struct wdb_usr_svc_rem_info /* extra field for WDB_USR_SVC_REM */ + { + TGT_INT_T stopRtn; /* routine to call to stop the */ + /* command service */ + TGT_INT_T stopRtnArg; /* argument for stop command service */ + } WDB_USR_SVC_REM_INFO; + +typedef struct wdb_usr_svc_find_info /* extra field for WDB_USR_SVC_FIND */ + { + TGT_INT_T func; /* routine associated with service */ + } WDB_USR_SVC_FIND_INFO; + +typedef struct wdb_usr_svc_ctrl_info /* user service control information */ + { + TGT_INT_T numInts; /* depends on opcode */ + TGT_INT_T svcId; /* service Id */ + TGT_INT_T opcode; /* operation to perform */ + union + { + WDB_USR_SVC_ADD_INFO add; /* specific params to add a service */ + WDB_USR_SVC_REM_INFO remove; /* specific params to rem. a service */ + WDB_USR_SVC_FIND_INFO find; /* specific params to find a service */ + } extra; + } WDB_USR_SVC_CTRL_INFO; + +/* + * #pragma align 1 for i960 will prevent gcc960 from aligning all structures + * on a 16 byte boundary. + */ + +#ifndef HOST +#if (defined (CPU_FAMILY) && (CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ +#endif /* HOST */ + +typedef struct wdb_ctx_start_info /* WDB_EVT_INFO for context creation */ + { + TGT_INT_T numInts; /* structure length */ + WDB_CTX_TYPE createdCtxType; /* created context */ + TGT_INT_T createdArgs [WDB_CTX_MAX_ARGS]; + WDB_CTX_TYPE creationCtxType; /* creation context */ + TGT_INT_T creationArgs [WDB_CTX_MAX_ARGS]; + } WDB_CTX_START_INFO; + +typedef struct wdb_ctx_dump_info /* WDB_EVT_INFO for context dump */ + { + TGT_INT_T numInts; /* structure length */ + WDB_CTX_TYPE dumpedCtxType; /* dumped context */ + TGT_INT_T ctxArgs [WDB_CTX_MAX_ARGS]; + } WDB_CTX_DUMP_INFO; + +typedef enum wdb_tsfs_opcode /* opcode for TSFS operation */ + { + WDB_TSFS_OPEN = 0, /* open target server file */ + WDB_TSFS_READ = 1, /* read target server file */ + WDB_TSFS_WRITE = 2, /* write target server file */ + WDB_TSFS_CLOSE = 3, /* close target server file */ + WDB_TSFS_IOCTL = 4, /* ioctl target server file */ + WDB_TSFS_DELETE = 5 /* delete target server file */ + } WDB_TSFS_OPCODE; + +typedef enum wdb_tsfs_ioctl_req /* portable TSFS ioctl requests */ + { + WDB_TSFS_IOCTL_FIOSEEK = 0, /* set file pointer */ + WDB_TSFS_IOCTL_FIOWHERE = 1, /* get file pointer */ + WDB_TSFS_IOCTL_FIONREAD = 2, /* # bytes readable */ + WDB_TSFS_IOCTL_FIOFSTATGET = 3, /* fill a struct stat for file */ + WDB_TSFS_IOCTL_FIOREADDIR = 4, /* read one directory entry */ + WDB_TSFS_IOCTL_FIORENAME = 5, /* rename a file or directory */ + WDB_TSFS_IOCTL_SO_SNDURGB = 6, /* send urgent-mode byte over sock */ + WDB_TSFS_IOCTL_SO_SETDEBUG = 7, /* set SO_DEBUG for sock */ + WDB_TSFS_IOCTL_SO_GETDEBUG = 8, /* get SO_DEBUG for sock */ + WDB_TSFS_IOCTL_SO_SETSNDBUF = 9, /* set SO_SNDBUF for sock */ + WDB_TSFS_IOCTL_SO_SETRCVBUF = 11, /* set SO_RCVBUF for sock */ + WDB_TSFS_IOCTL_SO_SETDONTROUTE = 13,/* set SO_DONTROUT for sock */ + WDB_TSFS_IOCTL_SO_GETDONTROUTE = 14,/* get SO_DONTROUT for sock */ + WDB_TSFS_IOCTL_SO_SETOOBINLINE = 15,/* set SO_OOBINLINE for sock */ + WDB_TSFS_IOCTL_SO_GETOOBINLINE = 16 /* get SO_OOBINLINE for sock */ + } WDB_TSFS_IOCTL_REQ; + +typedef struct wdb_tsfs_generic_info /* base structure for any TSFS op */ + { + TGT_INT_T numInts; /* depends on opcode */ + TGT_INT_T channel; /* TSFS channel for operation */ + TGT_INT_T opcode; /* TSFS operation to perform */ + TGT_ADDR_T semId; /* semaphore to "give" when op done */ + TGT_ADDR_T pResult; /* where to store result */ + TGT_ADDR_T pErrno; /* where to store errno */ + TGT_ADDR_T semGiveAddr; /* semGive address to give semId */ + } WDB_TSFS_GENERIC_INFO; + +typedef struct wdb_tsfs_open_info /* extra fields for TSFS open op */ + { + TGT_ADDR_T filename; /* address of filename string on tgt */ + TGT_INT_T fnameLen; /* length of above */ + TGT_INT_T mode; /* mode to open with */ + TGT_INT_T perm; /* permission bits */ + } WDB_TSFS_OPEN_INFO; + +typedef struct wdb_tsfs_rw_info /* extra fields for TSFS read/write */ + { + TGT_ADDR_T buffer; /* buffer of data to write/read */ + TGT_INT_T nBytes; /* length of above */ + } WDB_TSFS_RW_INFO; + +typedef struct wdb_tsfs_ioctl_info /* extra fields for TSFS ioctl */ + { + WDB_TSFS_IOCTL_REQ request; + TGT_INT_T arg; + TGT_ADDR_T pExtra1; /* meaning depends on request */ + TGT_ADDR_T pExtra2; /* meaning depends on request */ + } WDB_TSFS_IOCTL_INFO; + +typedef struct wdb_tsfs_delete_info /* extra fields for TSFS delete op */ + { + TGT_ADDR_T filename; /* address of filename string on tgt */ + TGT_INT_T fnameLen; /* length of above */ + } WDB_TSFS_DELETE_INFO; + +typedef struct wdb_tsfs_info /* generic TSFS event */ + { + WDB_TSFS_GENERIC_INFO info; /* generic params for all TSFS ops */ + union + { + WDB_TSFS_OPEN_INFO open; /* specific params for open() */ + WDB_TSFS_DELETE_INFO remove; /* specific params for unlink() */ + WDB_TSFS_RW_INFO rw; /* specific params for read/write() */ + WDB_TSFS_IOCTL_INFO ioctl; /* specific params for ioctl() */ + } extra; + } WDB_TSFS_INFO; + +#ifndef HOST +#if (defined (CPU_FAMILY) && (CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ +#endif /* HOST */ + +typedef struct wdb_param_wrapper + { + struct wdb_core wdbCore; /* core parameters */ + void * pParams; /* real parameters */ + xdrproc_t xdr; /* XDR filter for the real params */ + UINT32 seqNum; /* sequence number */ + } WDB_PARAM_WRAPPER; + +typedef struct wdb_reply_wrapper + { + void * pReply; /* real reply */ + xdrproc_t xdr; /* XDR filter for the real reply */ + UINT32 errCode; /* error status */ + } WDB_REPLY_WRAPPER; + +/* variable declarations */ + +#ifndef HOST +IMPORT UINT16 wdbPort; /* UDP port number to connect */ +#endif /* HOST */ + +/* function prototypes */ + +IMPORT BOOL xdr_UINT32 (XDR *xdrs, UINT32 *objp); +IMPORT BOOL xdr_TGT_ADDR_T (XDR *xdrs, TGT_ADDR_T *objp); +IMPORT BOOL xdr_TGT_INT_T (XDR *xdrs, TGT_INT_T *objp); +IMPORT BOOL xdr_WDB_CORE (XDR *xdrs, WDB_CORE *objp); +IMPORT BOOL xdr_WDB_STRING_T (XDR *xdrs, WDB_STRING_T *objp); +IMPORT BOOL xdr_WDB_OPQ_DATA_T (XDR *xdrs, WDB_OPQ_DATA_T *objp, + UINT32 len, UINT32 width); +IMPORT BOOL xdr_ARRAY (XDR *xdrs, char **, TGT_INT_T *, + TGT_INT_T, TGT_INT_T, + xdrproc_t elproc); +IMPORT BOOL xdr_WDB_STRING_ARRAY (XDR * xdrs, char **, + TGT_INT_T *, TGT_INT_T); +IMPORT BOOL xdr_CHECKSUM (XDR *xdrs, UINT32 xdrCksumVal, + UINT32 xdrStreamSize, + UINT32 xdrCksumValPos, + UINT32 xdrStreamSizePos); +IMPORT BOOL xdr_REFERENCE (XDR * xdrs, caddr_t * pp, + TGT_INT_T size, xdrproc_t elproc); + +IMPORT BOOL xdr_WDB_PARAM_WRAPPER (XDR *xdrs, WDB_PARAM_WRAPPER *objp); +IMPORT BOOL xdr_WDB_REPLY_WRAPPER (XDR *xdrs, WDB_REPLY_WRAPPER *objp); +IMPORT BOOL xdr_WDB_AGENT_INFO (XDR *xdrs, WDB_AGENT_INFO *objp); +IMPORT BOOL xdr_WDB_TGT_INFO (XDR *xdrs, WDB_TGT_INFO *objp); +IMPORT BOOL xdr_WDB_MEM_REGION (XDR *xdrs, WDB_MEM_REGION *objp); +IMPORT BOOL xdr_WDB_MEM_XFER (XDR *xdrs, WDB_MEM_XFER *objp); +IMPORT BOOL xdr_WDB_MEM_SCAN_DESC (XDR *xdrs, WDB_MEM_SCAN_DESC *objp); +IMPORT BOOL xdr_WDB_CTX (XDR *xdrs, WDB_CTX *objp); +IMPORT BOOL xdr_WDB_CTX_CREATE_DESC (XDR *xdrs, WDB_CTX_CREATE_DESC *objp); +IMPORT BOOL xdr_WDB_CTX_KILL_DESC (XDR *xdrs, WDB_CTX_KILL_DESC *objp); +IMPORT BOOL xdr_WDB_CTX_STEP_DESC (XDR *xdrs, WDB_CTX_STEP_DESC *objp); +IMPORT BOOL xdr_WDB_DIRECT_CALL_RET (XDR *xdrs, WDB_DIRECT_CALL_RET *objp); +IMPORT BOOL xdr_WDB_CALL_RETURN_INFO(XDR *xdrs, WDB_CALL_RET_INFO *objp); +IMPORT BOOL xdr_WDB_REG_READ_DESC (XDR *xdrs, WDB_REG_READ_DESC *objp); +IMPORT BOOL xdr_WDB_REG_WRITE_DESC (XDR *xdrs, WDB_REG_WRITE_DESC *objp); +IMPORT BOOL xdr_WDB_EVTPT_ADD_DESC (XDR *xdrs, WDB_EVTPT_ADD_DESC *objp); +IMPORT BOOL xdr_WDB_EVTPT_DEL_DESC (XDR *xdrs, WDB_EVTPT_DEL_DESC *objp); +IMPORT BOOL xdr_WDB_EVT_DATA (XDR *xdrs, WDB_EVT_DATA *objp); +IMPORT BOOL xdr_WDB_EVT_INFO (XDR *xdrs, WDB_EVT_INFO *objp); +IMPORT BOOL xdr_WDB_SYM_INFO (XDR * xdrs, WDB_SYM_INFO * objp); +IMPORT BOOL xdr_WDB_SYM_LIST (XDR * xdrs, WDB_SYM_LIST * objp); +IMPORT BOOL xdr_WDB_SECT_INFO (XDR * xdrs, WDB_SECT_INFO * objp) ; +IMPORT BOOL xdr_WDB_SEG_INFO (XDR * xdrs, WDB_SEG_INFO * objp); +IMPORT BOOL xdr_WDB_MOD_INFO (XDR * xdrs, WDB_MOD_INFO * objp); +IMPORT BOOL xdr_WDB_SYM_MOD_DESC (XDR * xdrs, WDB_SYM_MOD_DESC * objp); +IMPORT BOOL xdr_WDB_SYM_ID_LIST (XDR * xdrs, WDB_SYM_ID_LIST * objp); +IMPORT BOOL xdr_WDB_SYM_ID (XDR * xdrs, WDB_SYM_ID * objp); +IMPORT BOOL xdr_WDB_RT_INFO (XDR * xdrs, WDB_RT_INFO * objp); +IMPORT BOOL xdr_WDB_USR_SVC_CTRL_INFO (XDR * xdrs, + WDB_USR_SVC_CTRL_INFO * objp); +IMPORT BOOL xdr_WDB_THREAD_ID_LIST (XDR * xdrs, WDB_THREAD_ID_LIST * objp); +IMPORT BOOL xdr_WDB_THREAD_ID (XDR * xdrs, WDB_THREAD_ID * objp); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbh */ diff --git a/h/wdb/wdbArchIfLib.h b/h/wdb/wdbArchIfLib.h new file mode 100644 index 0000000..9b64dc9 --- /dev/null +++ b/h/wdb/wdbArchIfLib.h @@ -0,0 +1,38 @@ +/* wdbArchIfLib.h - header file for arch-specific routines needed by wdb */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03dec03,elg Fix compilation errors: remove some conflicting declarations. +01d,25apr02,jhw Added C++ support (SPR 76304). +01c,15jun95,ms removed _sigCtxIntLock prototype +01b,05apr95,ms new data types. +01a,21dec94,ms written. +*/ + +#ifndef __INCwdbArchIfLibh +#define __INCwdbArchIfLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "wdb/wdb.h" +#include "wdb/wdbRegs.h" +#include "intLib.h" + +/* function prototypes */ + +extern int _sigCtxSave (WDB_IU_REGS *pContext); +extern void _sigCtxRtnValSet (WDB_IU_REGS *pContext, int val); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbArchIfLibh */ + diff --git a/h/wdb/wdbBpLib.h b/h/wdb/wdbBpLib.h new file mode 100644 index 0000000..a6b7084 --- /dev/null +++ b/h/wdb/wdbBpLib.h @@ -0,0 +1,113 @@ +/* wdbBpLib.h - wdb break point library */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01v,08mar04,elg Change WDB_CTX structure. +01u,13nov03,elg Change WDB_BP_CTX_BP_ADD() prototype. +01t,10oct03,elg Remove debug handler function pointers. +01s,29sep03,tbu go back +01r,15sep03,tbu Added wdbSysBpLibInit prototype +01q,27feb03,elg Merge file with BSD and define new interface. +01p,25apr02,jhw Added C++ support (SPR 76304). +01o,28oct99,elg Add support for all-tasks breakpoints. +01n,07oct99,elg Remove _wdbPdStop() and _wdbPdCont() declarations. +01m,04aug99,elg Fix WDB dependencies problem. +01l,26may99,elg Add new debug facilities for protection domains. +01k,21apr98,dbt removed useless defines for ARM. +01j,04feb98,dbt moved wdbSysBpLibInit() and wdbTaskBpLibInit() to wdbLib.h +01i,12jan98,dbt modified for new debugger scheme +01h,17apr97,cdp added Thumb (ARM7TDMI_T) support. +01g,28nov96,cdp added ARM support. +01f,22jul96,jmb merged mem's (ease) patch for HPSIM. +01e,20may96,ms imported prototypes and macros from wdb[Task]BpLib.h. +01d,25feb96,tam added single step support for PPC403. +01d,04apr96,ism added simsolaris support +01c,23jan96,tpr added PowerPC support. +01c,28nov95,mem added MIPS support, added macros WDB_CTX_{LOAD,SAVE}. +01b,08jun95,ms change CPU==SPARC to CPU_FAMILY==SPARC +01a,20nov94,rrr written. +*/ + +#ifndef __INCwdbBpLibh +#define __INCwdbBpLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASMLANGUAGE + +/* includes */ + +#include "wdb/wdbRegs.h" +#include "wdb/wdbDbgLib.h" + +/* typedefs */ + +typedef struct wdb_ctx_bp_if + { + UINT32 (*bpAdd) (WDB_CTX * pCtx, WDB_ACTION * pAction, INSTR * addr, + UINT32 count, UINT32 type, UINT32 * pId); + UINT32 (*step) (UINT32 contextId, TGT_ADDR_T startAddr, + TGT_ADDR_T endAddr); + UINT32 (*stop) (UINT32 contextId); + UINT32 (*cont) (UINT32 contextId); + } WDB_CTX_BP_IF; + +/* defines */ + +#define WDB_BP_CTX(pCtx) (pWdbCtxBpIf [(pCtx)->contextType]) +#define WDB_BP_ENTRY(pCtx) (pWdbCtxBpIf [(pCtx)->context.contextType]) + +#define WDB_BP_CTX_BP_ADD(pCtx, pAction, addr, count, type, pId) \ + (WDB_BP_CTX (pCtx) == NULL ? \ + WDB_ERR_NO_RT_CTX : \ + ((WDB_BP_CTX (pCtx))->bpAdd == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + (WDB_BP_CTX (pCtx))->bpAdd ((pCtx), (pAction), (addr), \ + (count), (type), (pId)))) + +#define WDB_BP_CTX_STEP(pCtx) \ + (WDB_BP_ENTRY (pCtx) == NULL ? \ + WDB_ERR_NO_RT_CTX : \ + (WDB_BP_ENTRY (pCtx))->step == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + (WDB_BP_ENTRY (pCtx))->step (WDB_CTX_ID_GET (&(pCtx)->context),\ + (pCtx)->startAddr, \ + (pCtx)->endAddr)) + +#define WDB_BP_CTX_STOP(pCtx) \ + (WDB_BP_CTX (pCtx) == NULL ? \ + WDB_ERR_NO_RT_CTX : \ + (WDB_BP_CTX (pCtx))->stop == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + (WDB_BP_CTX (pCtx))->stop (WDB_CTX_ID_GET (pCtx))) + +#define WDB_BP_CTX_CONT(pCtx) \ + (WDB_BP_CTX (pCtx) == NULL ? \ + WDB_ERR_NO_RT_CTX : \ + (WDB_BP_CTX (pCtx))->cont == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + (WDB_BP_CTX (pCtx))->cont (WDB_CTX_ID_GET (pCtx))) + +/* context specific debug interface */ + +IMPORT WDB_CTX_BP_IF * pWdbCtxBpIf [WDB_CTX_TYPE_NUM]; + +IMPORT VOIDFUNCPTR wdbBpSysEnterHook; +IMPORT VOIDFUNCPTR wdbBpSysExitHook; + +/* function declarations */ + +IMPORT void wdbBpInstall (void); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbBpLibh */ diff --git a/h/wdb/wdbCommIfLib.h b/h/wdb/wdbCommIfLib.h new file mode 100644 index 0000000..89e7d81 --- /dev/null +++ b/h/wdb/wdbCommIfLib.h @@ -0,0 +1,84 @@ +/* wdbCommIfLib.h - header file for the WDB agents communication interface */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,25apr02,jhw Added C++ support (SPR 76304). +01c,03jun95,ms changed read/write to sendto/rcvfrom +01b,05apr95,ms new data types. +01a,23sep94,ms written. +*/ + +#ifndef __INCwdbCommIfLibh +#define __INCwdbCommIfLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "wdb/wdb.h" +#include "netinet/in.h" + +/* definitions */ + +#define WDB_COMM_MODE_POLL 1 +#define WDB_COMM_MODE_INT 2 + +/* data types */ + +/* + * WDB_COMM_IF - interface used by the agent to talk to the host. + */ + +typedef void * WDB_COMM_ID; + +typedef struct wdb_comm_if + { + WDB_COMM_ID commId; + int (*rcvfrom) (WDB_COMM_ID commId, caddr_t addr, uint_t len, + struct sockaddr_in *pAddr, struct timeval *tv); + int (*sendto) (WDB_COMM_ID commId, caddr_t addr, uint_t len, + struct sockaddr_in *pAddr); + int (*modeSet) (WDB_COMM_ID commId, uint_t newMode); + int (*cancel) (WDB_COMM_ID commId); + int (*hookAdd) (WDB_COMM_ID commId, void (*rout)(), uint_t arg); + int (*notifyHost) (WDB_COMM_ID commId); + } WDB_COMM_IF; + +/* + * WDB_DRV_IF - interface between a driver and the agents pseudo-UDP/IP stack + * + * The default agent configuration uses the native VxWorks UDP/IP stack which + * has its own interface to a driver (a net_if structure). + * The agent can also be configured to use a pseudo-UDP/IP stack that + * is independant of the OS. The pseudo-UDP/IP stack is used for + * communication with the system mode agent. + * The WDB_DRV_IF structure allows new drivers to be installed in the + * pseudo-UDP/IP stack. + */ + +typedef struct wdb_drv_if + { + uint_t mode; /* available device modes */ + uint_t mtu; /* maximum transmit packet size */ + void (*stackRcv)(); /* callback when pkt arrives */ + + /* driver routines */ + + void * devId; /* device ID */ + STATUS (*pollRtn)(); /* poll device for data */ + STATUS (*pktTxRtn)(); /* transmit a packet */ + STATUS (*modeSetRtn)(); /* toggle driver mode */ + int (*ioctl)(); /* misc */ + } WDB_DRV_IF; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbCommIfLibh */ + diff --git a/h/wdb/wdbCtxIfLib.h b/h/wdb/wdbCtxIfLib.h new file mode 100644 index 0000000..1a3a915 --- /dev/null +++ b/h/wdb/wdbCtxIfLib.h @@ -0,0 +1,187 @@ +/* wdbCtxIfLib.h - header file for the WDB agent context runtime interface */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,13apr04,elg Remove obsolete type WDB_REG_SET_TYPE. +01e,23mar04,elg Move macros to get information on context in wdbOsLib.h +01d,08mar04,elg Change WDB_CTX structure. +01c,12sep03,tbu Moved inclusion of netinet/in_systm.h to wdbOsLib.h +01b,22may03,elg Modify context creation hook add API to add action type. +01a,11mar03,elg Written. +*/ + +#ifndef __INCwdbCtxIfLibh +#define __INCwdbCtxIfLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "wdb/wdb.h" +#include "wdb/wdbRegs.h" + +/* data types */ + +typedef struct wdb_ctx_if + { + UINT32 (*create) (WDB_CTX_CREATE_DESC * pCtx, UINT32 * pRetVal); + UINT32 (*delete) (WDB_CTX_KILL_DESC * pCtx); + UINT32 (*suspend) (int ctxId); + UINT32 (*resume) (int ctxId); + UINT32 (*attach) (WDB_CTX * pCtx); + UINT32 (*detach) (WDB_CTX * pCtx); + STATUS (*stop) (int ctxId); + STATUS (*cont) (int ctxId); + UINT32 (*regsGet) (WDB_CTX * pCtx, UINT32 type, char ** ppRegs); + UINT32 (*regsSet) (WDB_CTX * pCtx, UINT32 type, char * pRegs); + UINT32 (*createHookAdd) (VOIDFUNCPTR hook, WDB_ACTION_TYPE actionType); + UINT32 (*deleteHookAdd) (UINT32 pCtx, VOIDFUNCPTR hook); + STATUS (*enterHookAdd) (WDB_CTX * pCtx, VOIDFUNCPTR hook); + STATUS (*exitHookAdd) (WDB_CTX * pCtx, VOIDFUNCPTR hook); + UINT32 (*statusGet) (WDB_CTX * pCtx, UINT32 * pStatus); + STATUS (*idVerify) (int ctxId); + void * (*isAttached) (UINT32 memCtx); + } WDB_CTX_IF; + +/* context specific macros */ + +#define WDB_RT_CTX(pCtx) pWdbRtIf->pWdbCtxIf [(pCtx)->contextType] +#define WDB_RT_ENTRY(pEntry) \ + pWdbRtIf->pWdbCtxIf [(pCtx)->context.contextType] + +#define WDB_RT_CTX_CREATE(pCtxCreate, pCid) \ + (WDB_RT_CTX (pCtxCreate) == NULL ? \ + WDB_ERR_NO_RT_CTX : \ + ((WDB_RT_CTX (pCtxCreate))->create == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + (WDB_RT_CTX (pCtxCreate))->create ((pCtxCreate), (pCid)))) + +#define WDB_RT_CTX_DELETE(pCtx) \ + (WDB_RT_ENTRY (pCtx) == NULL ? \ + WDB_ERR_NO_RT_CTX : \ + ((WDB_RT_ENTRY (pCtx))->delete == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + (WDB_RT_ENTRY (pCtx))->delete (pCtx))) + +#define WDB_RT_CTX_SUSPEND(pCtx) \ + (WDB_RT_CTX (pCtx) == NULL ? \ + WDB_ERR_NO_RT_CTX : \ + ((WDB_RT_CTX (pCtx))->suspend == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + ((WDB_RT_CTX (pCtx))->suspend (WDB_CTX_ID_GET (pCtx)) == OK ? \ + WDB_OK : WDB_ERR_RT_ERROR))) + +#define WDB_RT_CTX_RESUME(pCtx) \ + (WDB_RT_CTX (pCtx) == NULL ? \ + WDB_ERR_NO_RT_CTX : \ + ((WDB_RT_CTX (pCtx))->resume == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + ((WDB_RT_CTX (pCtx))->resume (WDB_CTX_ID_GET (pCtx)) == OK ? \ + WDB_OK : WDB_ERR_RT_ERROR))) + +#define WDB_RT_CTX_ATTACH(pCtx) \ + (WDB_RT_CTX (pCtx) == NULL ? \ + WDB_ERR_NO_RT_CTX : \ + ((WDB_RT_CTX (pCtx))->attach == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + (WDB_RT_CTX (pCtx))->attach (pCtx))) + +#define WDB_RT_CTX_DETACH(pCtx) \ + (WDB_RT_CTX (pCtx) == NULL ? \ + WDB_ERR_NO_RT_CTX : \ + ((WDB_RT_CTX (pCtx))->detach == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + (WDB_RT_CTX (pCtx))->detach (pCtx))) + +#define WDB_RT_CTX_STOP(pCtx) \ + (WDB_RT_CTX (pCtx) == NULL ? \ + WDB_ERR_NO_RT_CTX : \ + ((WDB_RT_CTX (pCtx))->stop == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + ((WDB_RT_CTX (pCtx))->stop (WDB_CTX_ID_GET (pCtx)) == OK ? \ + WDB_OK : WDB_ERR_RT_ERROR))) + +#define WDB_RT_CTX_CONT(pCtx) \ + (WDB_RT_CTX (pCtx) == NULL ? \ + WDB_ERR_NO_RT_CTX : \ + ((WDB_RT_CTX (pCtx))->cont == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + ((WDB_RT_CTX (pCtx))->cont (WDB_CTX_ID_GET (pCtx)) == OK ? \ + WDB_OK : WDB_ERR_RT_ERROR))) + +#define WDB_RT_CTX_REGS_GET(pCtx, regType, pRegs) \ + (WDB_RT_CTX (pCtx) == NULL ? \ + WDB_ERR_NO_RT_CTX : \ + ((WDB_RT_CTX (pCtx))->regsGet == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + (WDB_RT_CTX (pCtx))->regsGet ((pCtx), (regType), (pRegs)))) + +#define WDB_RT_CTX_REGS_SET(pCtx, regType, pRegs) \ + (WDB_RT_CTX (pCtx) == NULL ? \ + WDB_ERR_NO_RT_CTX : \ + ((WDB_RT_CTX (pCtx))->regsSet == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + (WDB_RT_CTX (pCtx))->regsSet ((pCtx), (regType), (pRegs)))) + +#define WDB_RT_CTX_CREATE_HOOK_ADD(pCtx, hook, actionType) \ + (WDB_RT_CTX (pCtx) == NULL ? \ + WDB_ERR_NO_RT_CTX : \ + ((WDB_RT_CTX (pCtx))->createHookAdd == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + (WDB_RT_CTX (pCtx))->createHookAdd ((hook), (actionType)))) + +#define WDB_RT_CTX_DELETE_HOOK_ADD(pCtx, hook) \ + (WDB_RT_CTX (pCtx) == NULL ? \ + WDB_ERR_NO_RT_CTX : \ + ((WDB_RT_CTX (pCtx))->deleteHookAdd == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + (WDB_RT_CTX (pCtx))->deleteHookAdd (WDB_CTX_ID_GET (pCtx), \ + (hook)))) + +#define WDB_RT_CTX_ENTER_HOOK_ADD(pCtx, hook) \ + (WDB_RT_CTX (pCtx) == NULL ? \ + WDB_ERR_NO_RT_CTX : \ + ((WDB_RT_CTX (pCtx))->enterHookAdd == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + (WDB_RT_CTX (pCtx))->enterHookAdd (WDB_CTX_ID_GET (pCtx), \ + (hook)))) + +#define WDB_RT_CTX_EXIT_HOOK_ADD(pCtx, hook) \ + (WDB_RT_CTX (pCtx) == NULL ? \ + WDB_ERR_NO_RT_CTX : \ + ((WDB_RT_CTX (pCtx))->exitHookAdd == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + (WDB_RT_CTX (pCtx))->exitHookAdd (WDB_CTX_ID_GET (pCtx), \ + (hook)))) + +#define WDB_RT_CTX_STATUS_GET(pCtx, pStatus) \ + (WDB_RT_CTX (pCtx) == NULL ? \ + WDB_ERR_NO_RT_CTX : \ + ((WDB_RT_CTX (pCtx))->statusGet == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + (WDB_RT_CTX (pCtx))->statusGet ((pCtx), (pStatus)))) + +#define WDB_RT_CTX_ID_VERIFY(pCtx) \ + (WDB_RT_CTX (pCtx) == NULL ? \ + WDB_ERR_NO_RT_CTX : \ + ((WDB_RT_CTX (pCtx))->idVerify == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + (WDB_RT_CTX (pCtx))->idVerify (WDB_CTX_ID_GET (pCtx)))) + +#define WDB_RT_CTX_IS_ATTACHED(pCtx) \ + (WDB_RT_CTX (pCtx) == NULL ? \ + NULL : \ + ((WDB_RT_CTX (pCtx))->isAttached == NULL ? \ + NULL : \ + (WDB_RT_CTX (pCtx))->isAttached (WDB_CTX_ID_GET (pCtx)))) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbCtxIfLibh */ diff --git a/h/wdb/wdbDbgLib.h b/h/wdb/wdbDbgLib.h new file mode 100644 index 0000000..7b2de58 --- /dev/null +++ b/h/wdb/wdbDbgLib.h @@ -0,0 +1,364 @@ +/* wdbDbgLib.h - debugger library */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +03b,07jul04,elg Add wdbDbgBpAddrCheck() definition. +03a,27may04,elg Add _func_wdbIsNowExternal definition. +02z,01apr04,elg Rename macros that have too generic names. +02y,09feb04,elg Add system call check prototype. +02x,13jan04,elg Add system call check support. +02w,27nov03,elg Update TEXT_(UN)LOCK() to use pid. +02v,16oct03,bpn Added back the default value of the DBG_CRET macro. Added + the default value of DBG_INST_ALIGN. +02u,10oct03,elg Add debugger handler function pointer definitions. +02t,03oct03,elg Add debugger enhancements. +02s,02oct03,elg Rework TEXT_(UN)LOCK macros and check previous state. +02r,29sep03,tbu Added WDB_TRACE_MODE_SET/CLEAR, USR_BREAKPOINT_SET, + applied coding conventions for TEXT_(UN)LOCK. +02q,12sep03,tbu TEXT_(UN)LOCK has now 3 parameters to keep compliant to UNIXs +02p,07may03,pes PAL conditional compilation cleanup. Phase 2. +02o,22apr03,dbt Added SIMLINUX support, removed SIMHPPA. +02n,20feb03,jmp removed TEXT_UNLOCK/LOCK SIMNT specific code. +02m,28feb03,elg Merge file from BSD/OS. +02l,25apr02,jhw Added C++ support (SPR 76304). +02k,22oct01,dee Merge from T2.1.0 ColdFire +02j,05sep01,pch Avoid declaring functions which will not be defined + according to setting of DBG_NO_SINGLE_STEP +02i,22aug00,hbh Added SIMLINUX support. +02h,09aug00,elg Add context locks/unlocks in TEXT_LOCK()/TEXT_UNLOCK(). +02g,23may00,elp switched to generic macro TEXT_LOCK()/TEXT_UNLOCK() for SIMNT. +02f,27apr00,elg Update TEXT_LOCK() and TEXT_UNLOCK(). + Declare _func_isAnLte. +02e,03apr00,elg Change usrBreakpointSet() prototype. +02d,29mar00,elg Code cleanup. +02c,23mar00,jgn add new state flag for task being deleted +02b,29feb00,elg Add _func_isPdAttached. +02a,25feb00,frf Add SH support for T2 +01z,25feb00,rlp modified the WDB_CTX_LOAD default macro. +01y,31jan00,elg Fix component dependencies problems. +01x,13jan00,dra PAL: replaced CPU tests. +01w,20dec99,elp adapted SIMNT to TEXT_LOCK() change. +01v,15dec99,rlp modified the WDB_CTX_SAVE default macro. +01u,23nov99,elg Add float support in WDB_FUNC_CALL. +01t,19nov99,rlp added the WDB_CTX_SETUP macro. +01s,10nov99,gls modified TEXT_UNLOCK() and TEXT_LOCK() definitions +01r,10nov99,elg Add wdbDbgArchExitSet() to set exit routine. +01q,08nov99,elp fix simTextLock() simTextUnlock() prototypes (SIMNT). +01p,08oct99,elg Add _func_dbgPdDelete(). +01o,04oct99,elg Add extern mode support for Aeolus. +01n,30aug99,jgn update for overlapped memory model (2) + remove non-ANSI + prototypes +01m,27aug99,jgn merge in overlapping memory model +01l,11aug99,jgn update for protection domains +01k,04aug99,elg Replace _wdbPdget() by dbgPdGet(). +01j,04aug99,elg Fix WDB dependencies problem. +01i,26may99,elg Add new debug facilities for protection domains. +01h,13apr99,tam modified TEXT_UNLOCK() and TEXT_LOCK() definitions +01g,19feb99,jgn update for protection domains +01f,14may98,dbt fixed previous modification. +01e,13may98,dbt added stddef.h include for offsetof definition. +01d,01may98,cym added SIMNT support. +01c,29apr98,dbt code cleanup. +01b,15apr98,kkk added ARM support. +01a,07oct97,dbt written +*/ + +#ifndef __INCwdbDbgLibh +#define __INCwdbDbgLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" + +#if CPU_FAMILY == I960 +#include "arch/i960/dbgI960Lib.h" +#endif /* CPU_FAMILY == I960 */ + +#if CPU_FAMILY == MIPS +#include "arch/mips/dbgMipsLib.h" +#endif /* CPU_FAMILY == MIPS */ + +#if CPU_FAMILY == PPC +#include "arch/ppc/dbgPpcLib.h" +#endif /* CPU_FAMILY == PPC */ + +#if CPU_FAMILY == SPARC +#include "arch/sparc/dbgSparcLib.h" +#endif /* CPU_FAMILY == SPARC */ + +#if CPU_FAMILY == SIMSPARCSOLARIS +#include "arch/simsolaris/dbgSimsolarisLib.h" +#endif /* CPU_FAMILY == SIMSPARCSOLARIS */ + +#if CPU_FAMILY == SIMLINUX +#include "arch/simlinux/dbgSimlinuxLib.h" +#endif /* CPU_FAMILY == SIMLINUX */ + +#if CPU_FAMILY == SIMNT +#include "arch/simnt/dbgSimntLib.h" +#endif /* CPU_FAMILY == SIMNT */ + +#if CPU_FAMILY==I80X86 +#include "arch/i86/dbgI86Lib.h" +#endif /* CPU_FAMILY==I80X86 */ + +#if CPU_FAMILY == ARM +#include "arch/arm/dbgArmLib.h" +#endif /* CPU_FAMILY == ARM */ + +#if CPU_FAMILY == COLDFIRE +#include "arch/coldfire/dbgColdfireLib.h" +#endif /* CPU_FAMILY == COLDFIRE */ + +#if CPU_FAMILY == SH +#include "arch/sh/dbgShLib.h" +#endif /* CPU_FAMILY == SH */ + + +#ifndef _ASMLANGUAGE +#include "wdb/dll.h" +#include "wdb/wdbRegs.h" +#include "esf.h" +#include "stddef.h" + +#include "private/vmLibP.h" +#include "private/rtpLibP.h" + +#ifndef _WRS_ADJUST_PC_FOR_BRANCH_DELAY +#define _WRS_ADJUST_PC_FOR_BRANCH_DELAY(pReg) {} +#endif /* _WRS_ADJUST_PC_FOR_BRANCH_DELAY */ + +#ifndef DBG_SYSCALL_CHECK +#define DBG_SYSCALL_CHECK(pc) FALSE +#endif /* DBG_SYSCALL_CHECK */ + +/* defines */ + +#ifndef WDB_CTX_LOAD +#define WDB_CTX_LOAD(pRegs) _sigCtxLoad(pRegs) +#endif /* WDB_CTX_LOAD */ + +#ifndef WDB_CTX_SAVE +#define WDB_CTX_SAVE(pRegs) _sigCtxSave(pRegs) +#endif /* WDB_CTX_SAVE */ + +#ifndef WDB_CTX_SETUP +#define WDB_CTX_SETUP(pRegs, pStack, taskEntry, pArgs) \ + _sigCtxSetup ((pRegs), (pStack), (taskEntry), (pArgs)) +#endif /* WDB_CTX_SETUP */ + +#define WDB_STEP 0x0001 +#define WDB_STEP_OVER 0x0002 +#define WDB_STEP_RANGE 0x0004 +#define WDB_STEPPING (WDB_STEP | WDB_STEP_OVER | WDB_STEP_RANGE) +#define WDB_CLEANME 0x0008 +#define WDB_QUEUED 0x0010 +#define WDB_TARGET 0x0020 +#define WDB_STEP_TARGET (WDB_STEP | WDB_TARGET) + +/* + * Protection domains special bit indicating that we are stepping over a + * system call boundary. In this state no other breakpoints should be + * present! + */ + +#define WDB_STEP_SC_ENTRY 0x0040 +#define WDB_PD_STOP 0x0080 /* this breakpoint stops a PD */ +#define WDB_ALL_STOP 0x0100 /* this breakpoint stops all tasks */ + +/* + * A special flag that allows the switch hook routines to know that the + * delete hook has been run for this task and act accordingly. + */ + +#define WDB_TASK_BEING_DELETED 0x0200 + +#define PD_MODE_NO_STEP_OUT 0 +#define PD_MODE_STEP_OUT 1 + +#ifndef BRK_HARDMASK /* hardware breakpoint mask */ +#define BRK_HARDMASK 0x0 +#endif /* BRK_HARDMASK */ + +#ifndef BRK_HARDWARE /* hardware breakpoint bit */ +#define BRK_HARDWARE 0x0 +#endif /* BRK_HARDWARE*/ + +#ifndef DBG_HARDWARE_BP /* support of hardware breakpoint */ +#define DBG_HARDWARE_BP 0 +#endif /* DBG_HARDWARE_BP */ + +#ifndef DBG_NO_SINGLE_STEP /* trace mode (single step) support */ +#define DBG_NO_SINGLE_STEP 0 +#endif /* DBG_NO_SINGLE_STEP */ + +#ifndef DBG_CRET /* continue until return (cret) support */ +#define DBG_CRET TRUE +#endif /* DBG_CRET */ + +#ifndef DBG_INST_ALIGN +#define DBG_INST_ALIGN 4 /* default to long word alignment */ +#endif + +/* bp_flags values */ + +#define BP_INSTALLED 0x80000000 /* bp is installed */ +#define BP_HOST 0x40000000 /* host breakpoint */ + +/* defines used only by the target shell debugger */ + +#define BP_SO 0x08000000 /* step over (or cret) breakpoint */ +#define BP_STEP 0x04000000 /* step breakpoint */ +#define BP_EVENT 0x02000000 /* windview eventpoint */ + +/* different types of breakpoints */ + +#define BP_SYS 0x00800000 /* system in external mode */ +#define BP_ANY_TASK 0x00400000 /* any task in the system */ +#define BP_TASK 0x00200000 /* one specified task */ +#define BP_PD 0x00100000 /* all tasks of a protection domain */ +#define BP_PROCESS 0x00080000 /* one specified process */ +#define BP_RTP 0x00040000 /* all tasks of a RTP */ +#define BP_TYPE_MASK (BP_SYS | BP_ANY_TASK | BP_TASK | BP_PD | BP_RTP) + +#define WDB_PAGE_SIZE VM_PAGE_SIZE_GET () +#define WDB_PAGE_ADDR(addr) (void *) ((UINT) (addr) & ~(WDB_PAGE_SIZE - 1)) +#define VM_CTX_GET(pid) ((pid) == NULL ? NULL : \ + ((RTP_ID) (pid))->kernelRtpCmn.memInfo->vmContextId) + +/****************************************************************************** +* +* TEXT_UNLOCK - unprotect memory +* +* This macro unprotects memory. +* +* RETURNS: ERROR if memory cannot be unprotected (e.g. memory is unmapped) +* OK otherwise +* +* NOMANUAL +*/ + +#define TEXT_UNLOCK(pid, addr, oldAttr) \ + ((VM_STATE_GET (VM_CTX_GET (pid), WDB_PAGE_ADDR (addr), \ + oldAttr) == ERROR) ? \ + ERROR : \ + ((((*(oldAttr) & VM_STATE_MASK_WRITABLE) == VM_STATE_WRITABLE) ? \ + OK : \ + VM_STATE_SET (VM_CTX_GET (pid), WDB_PAGE_ADDR (addr), \ + WDB_PAGE_SIZE, VM_STATE_MASK_WRITABLE, \ + VM_STATE_WRITABLE)))) + +/****************************************************************************** +* +* TEXT_LOCK - protect memory +* +* This macro restores old memory protection settings. +* +* RETURNS: ERROR if memory cannot be reprotected (e.g. memory is unmapped) +* OK otherwise. +* +* NOMANUAL +*/ + +#define TEXT_LOCK(pid, addr, oldAttr) \ + (((*(oldAttr) & VM_STATE_MASK_WRITABLE) == VM_STATE_WRITABLE) ? \ + OK : \ + VM_STATE_SET (VM_CTX_GET (pid), WDB_PAGE_ADDR (addr), \ + WDB_PAGE_SIZE, VM_STATE_MASK_WRITABLE, \ + *(oldAttr))) + +#define WDB_TRACE_MODE_SET(pRegs) wdbDbgTraceModeSet (pRegs) +#define WDB_TRACE_MODE_CLEAR(not_used, pRegs, bpData) \ + wdbDbgTraceModeClear ((pRegs), (bpData)) + +/* data types */ + +typedef struct brkpt /* breakpoint structure */ + { + dll_t bp_chain; /* breakpoint chain */ + UINT32 bp_id; /* breakpoint ID */ + INSTR * bp_addr; /* breakpoint address */ + INSTR bp_instr; /* instruction at breakpoint address */ + int bp_ownerId; /* breakpoint owner task ID */ + UINT32 bp_ctxId; /* breakpoint context ID */ + unsigned bp_flags; /* breakpoint flags */ + unsigned bp_count; /* breakpoint count */ + unsigned bp_action; /* action associated with breakpoint */ + void (*bp_callRtn)();/* routine to call (if any) */ + int bp_callArg; /* called routine argument */ + } BRKPT; + +#define STRUCT_BASE(s,m,p) ((s *)(void *)((char *)(p) - offsetof(s,m))) +#define BP_BASE(p) (STRUCT_BASE(struct brkpt, bp_chain, (p))) + +/* externals */ + +extern dll_t bpList; +extern dll_t bpFreeList; + +#if DBG_NO_SINGLE_STEP +extern FUNCPTR _func_sysDbgTrap; /* system debug trap handler */ +extern FUNCPTR _func_usrDbgTrap; /* user debug trap handler */ +#else /* DBG_NO_SINGLE_STEP */ +extern FUNCPTR _func_sysDbgBreakpoint; /* system breakpoint handler */ +extern FUNCPTR _func_usrDbgBreakpoint; /* user breakpoint handler */ +extern FUNCPTR _func_sysDbgTrace; /* system trace handler */ +extern FUNCPTR _func_usrDbgTrace; /* user trace handler */ +#endif /* DBG_NO_SINGLE_STEP */ + +extern VOIDFUNCPTR _func_wdbDbgSystemStop; +extern FUNCPTR _func_wdbIsNowExternal; + +/* function declarations */ + +extern void wdbDbgArchInit (void); +extern void wdbDbgBpListInit (void); +extern STATUS wdbDbgBpFind (INSTR * pc, int context); +extern void wdbDbgBpRemoveAll (void); +extern STATUS wdbDbgBpRemove (BRKPT *pBp); +extern BRKPT * wdbDbgBpAdd (INSTR * addr, int task, unsigned flags, + unsigned action, unsigned count, + FUNCPTR callRtn, int callArg); +extern STATUS wdbDbgBpGet (INSTR * pc, int context, int type, BRKPT * pBp); +extern int wdbDbgTraceModeSet (REG_SET * pRegs); +extern void wdbDbgTraceModeClear (REG_SET * pRegs, int traceData); +#if DBG_NO_SINGLE_STEP +extern INSTR * wdbDbgGetNpc (REG_SET * pRegs); +extern void wdbDbgTrap (INSTR * addr, REG_SET * pRegisters, void * pInfo, + void * pDbgRegSet, BOOL hardware); +#else /* DBG_NO_SINGLE_STEP */ +extern void wdbDbgBreakpoint (void * pInfo, REG_SET * pRegisters, + void * pDbgRegSet, BOOL hardware); +extern void wdbDbgTrace (void * pInfo, REG_SET * pRegisters); +#endif /* DBG_NO_SINGLE_STEP */ +#if DBG_HARDWARE_BP +extern void wdbDbgRegsSet (DBG_REGS * pDbgReg); +extern void wdbDbgRegsClear (void); +extern STATUS wdbDbgHwBpSet (DBG_REGS * pDbgRegs, UINT32 type, UINT32 addr); +extern STATUS wdbDbgHwBpFind (DBG_REGS * pDbgRegs, UINT32 * pType, + UINT32 * pAddr); +extern STATUS wdbDbgHwAddrCheck (UINT32 addr, UINT32 type, + FUNCPTR memProbeRtn); +#endif /* DBG_HARDWARE_BP */ +extern STATUS dbgTaskCont (UINT32 contextId); +extern STATUS dbgTaskStep (UINT32 contextId, UINT32 startAddr, + UINT32 endAddr); +extern void usrBreakpointSet (INSTR * addr, INSTR value, RTP_ID pid); +extern BRKPT * wdbDbgBpPtrGet (void); +extern BOOL wdbDbgSysCallCheck (REG_SET * pRegs); +extern STATUS wdbDbgBpAddrCheck (RTP_ID memCtx, INSTR * addr, INSTR * val); + +#endif /* _ASMLANGUAGE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbDbgLibh */ diff --git a/h/wdb/wdbEvtLib.h b/h/wdb/wdbEvtLib.h new file mode 100644 index 0000000..cc48903 --- /dev/null +++ b/h/wdb/wdbEvtLib.h @@ -0,0 +1,70 @@ +/* wdbEvtLib.h - header file for remote debug events */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,28feb03,elg Merge file from BSD/OS. +01f,25apr02,jhw Added C++ support (SPR 76304). +01e,12feb99,dbt use wdb/ prefix to include wdb.h header file. +01d,04feb98,dbt moved eventpoint handling to wdbEvtptLib.h +01c,07jun95,ms added prototype for wdbEvtptDeleteAll +01b,05apr95,ms new data types. +01a,20sep94,ms written. +*/ + +#ifndef __INCwdbEvtLibh +#define __INCwdbEvtLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "wdb/dll.h" +#include "wdb/wdb.h" + +/* defines */ + +#define wdbEventListIsEmpty() (__wdbEventListIsEmpty == NULL ? TRUE : \ + (*__wdbEventListIsEmpty)()) + +/* data types */ + +typedef struct /* hidden */ + { + dll_t evt_list; + WDB_EVT_TYPE evt_type; + UINT32 (*evt_eventAdd) (WDB_EVTPT_ADD_DESC *pEvtpt, UINT32 *pId); + UINT32 (*evt_eventDel) (TGT_ADDR_T *pId); + } WDB_EVT_CLASS; + +typedef struct + { + dll_t node; + BOOL onQueue; + void (*getEvent) (void *arg, WDB_EVT_DATA *pEvtData); + void (*deq) (void *arg); + void * arg; + } WDB_EVT_NODE; + +/* function prototypes */ + +IMPORT void wdbEventNodeInit (WDB_EVT_NODE * pEvtNode, + void (*getEvent) (void *arg, + WDB_EVT_DATA *pEvtData), + void (*deq) (void *arg), + void *arg); +IMPORT void wdbEventPost (WDB_EVT_NODE * pEvtNode); +IMPORT STATUS wdbEventDeq (WDB_EVT_NODE * pEvtNode); +IMPORT void wdbEventClassConnect (WDB_EVT_CLASS * pEvtList); +IMPORT BOOL (*__wdbEventListIsEmpty) (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbEvtLibh */ + diff --git a/h/wdb/wdbEvtptLib.h b/h/wdb/wdbEvtptLib.h new file mode 100644 index 0000000..b0eaba1 --- /dev/null +++ b/h/wdb/wdbEvtptLib.h @@ -0,0 +1,53 @@ +/* wdbEvtptLib.h - header file for remote debug eventpoints */ + +/* Copyright 1998-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,28feb03,elg Merge file from BSD/OS. +01d,25apr02,jhw Added C++ support (SPR 76304). +01c,25jan00,elg Add WDB_CORE in evtptAdd(). +01b,12feb99,dbt use wdb/ prefix to include wdb.h header file. +01a,12feb98,dbt written. +*/ + +#ifndef __INCwdbEvtptLibh +#define __INCwdbEvtptLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "wdb/dll.h" +#include "wdb/wdb.h" + +/* defines */ + +#define wdbEvtptDeleteAll() { if (__wdbEvtptDeleteAll != NULL) \ + (*__wdbEvtptDeleteAll) (); } + +/* data types */ + +typedef struct /* hidden */ + { + dll_t evtptList; + WDB_EVT_TYPE evtptType; + UINT32 (*evtptAdd) (WDB_CORE * pWdbCore, + WDB_EVTPT_ADD_DESC * pEvtpt, + UINT32 * pId); + UINT32 (*evtptDel) (TGT_ADDR_T * pId); + } WDB_EVTPT_CLASS; + +/* function prototypes */ + +IMPORT void wdbEvtptClassConnect (WDB_EVTPT_CLASS * pEvtList); +IMPORT void (*__wdbEvtptDeleteAll) (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbEvtptLibh */ diff --git a/h/wdb/wdbGopherLib.h b/h/wdb/wdbGopherLib.h new file mode 100644 index 0000000..2fd401c --- /dev/null +++ b/h/wdb/wdbGopherLib.h @@ -0,0 +1,63 @@ +/* wdbGopherLib.h - info gathering interpreter header for the agent */ + +/* + * Copyright (c) 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01d,16jun05,jmp moved to share/src/agents/wdb. +01c,28may04,elg Fix compiler warning. +01b,29mar04,elg Add information to reorder numbers following endianness if + necessary. +01a,19feb03,elg Written from wdbGopherLib.c. +*/ + +/* +DESCRIPTION +*/ + +#ifndef __INCwdbGopherLibh +#define __INCwdbGopherLibh + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* data types */ + +enum byte_reorder + { + NO_REORDER, /* no byte reordering */ + NTOH_REORDER, /* perform a hton() before writing to tape */ + HTON_REORDER /* perform a ntoh() before writing to tape */ + }; + +typedef struct + { + char * program; /* where to start executing */ + UINT32 p; /* initial value of pointer */ + char * pTape; /* tape array */ + int tapeIx; /* index in tape to write next cell */ + int tapeLen; /* total length of tape */ + int execute; /* whether to execute, or just parse */ + unsigned int status; /* error code */ + enum byte_reorder byteReorder; /* do we have to reorder numbers ? */ + } wdbGopherCtx_t; + +/* externals */ + +IMPORT STATUS gopherWriteScalar (wdbGopherCtx_t * gc, UINT8 * src, int type); +IMPORT STATUS gopherWriteString (wdbGopherCtx_t * gc, char * string); +IMPORT STATUS gopherNewTapeAllocate (wdbGopherCtx_t * gc); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCwdbGopherLibh */ diff --git a/h/wdb/wdbLib.h b/h/wdb/wdbLib.h new file mode 100644 index 0000000..153ad4b --- /dev/null +++ b/h/wdb/wdbLib.h @@ -0,0 +1,103 @@ +/* wdbLib.h - header file for remote debug server */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01w,23sep04,elg Change wdbGopherLibInit() prototype. +01v,15dec03,elg Add new initialization routine: wdbTaskHookInit(). +01u,04jul03,elg Export wdbTaskModeInit() instead of wdbTaskRtIfInit(). +01t,27feb03,elg Merge file with BSD. +01s,13feb03,elg Add WDB_MAX_ARGS ddefinition. +01r,25apr02,jhw Added C++ support (SPR 76304). +01q,28aug00,elg Add wdbPdLibInit() declaration. +01p,21aug00,elg Add a new routine wdbFuncCallFpLibInit() (SPR 33747). +01o,31jan00,dbt Added wdbUserSvcLibInit() and wdbTrgLibInit() prototypes. +01n,14jan00,dbt Renamed wdbSymSyncLibInit(). +01m,16dec99,elg Add WDB_MAX_ARGS. +01l,19oct99,dbt added wdbSymSyncLibInit() prototype. +01k,02aug99,dbt added support for standalonagent. +01j,26may99,elg Add new facilities for protection domain debug. +01i,25mar98,dbt added wdbSystemSuspend() prototype. +01h,04mar98,dbt added wdbCtxStartLibInit(), wdbUserEvtLibInit() and + wdbUserEvtPost() prototypes. + added WDB_MAX_USER_EVT_SIZE define. +01g,04feb98,dbt added wdbEvtptLibInit() prototype. Undo 01f change +01f,12jan98,dbt moved wdbSysBpLibInit() and wdbTaskBpLibInit() to wdbBpLib.h +01e,20jun95,tpr added wdbMemCoreLibInit() prototype. +01d,19jun95,ms added prototypes for wdbCtxExitLibInit and wdbSioTest +01c,01jun95,ms changed prototype for wdbGopherLibInit. +01b,05apr95,ms new data types. +01a,20sep94,ms written. +*/ + +#ifndef __INCwdbLibh +#define __INCwdbLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "wdb/wdb.h" +#include "wdb/wdbLibP.h" +#include "wdb/wdbBpLib.h" +#include "wdb/wdbRtIfLib.h" +#include "wdb/wdbRpcLib.h" +#include "wdb/wdbCommIfLib.h" + +/* defines */ + +#define WDB_MAX_USER_EVT_SIZE 250 /* max. WDB user event size (bytes) */ +#define WDB_MAX_ARGS 10 /* maximum of arguments in a task */ + +/* function prototypes */ + +extern void wdbMdlSymSyncLibInit (void); +extern STATUS wdbExternInit (void * stackBase); +extern void wdbInstallRtIf (WDB_RT_IF *); +extern void wdbInstallCommIf (WDB_COMM_IF *, WDB_XPORT *); +extern void wdbConnectLibInit (void); +extern void wdbMemLibInit (void); +extern void wdbMemCoreLibInit (void); +extern void wdbCtxExitLibInit (void); +extern void wdbRegsLibInit (void); +extern void wdbEventLibInit (void); +extern void wdbEvtptLibInit (void); +extern void wdbFuncCallLibInit (void); +extern void wdbDirectCallLibInit (void); +extern void wdbGopherLibInit (char primaryTape [], UINT32 tapeLen, + UINT32 tapeNb); +extern void wdbVioLibInit (void); +extern void wdbExcLibInit (void); +extern void wdbSysBpLibInit (struct brkpt * pBps, UINT32 bpCnt); +extern void wdbTaskBpLibInit (void); +extern void wdbPdBpLibInit (void); +extern void wdbUserEvtLibInit (void); +extern STATUS wdbUserEvtPost (char * event); +extern void wdbUserSvcLibInit (WDB_USR_SVC * pWdbUsrSvcStruct, + UINT32 numService); +extern void wdbCtxStartLibInit (void); +extern STATUS wdbSystemSuspend (void); +extern void wdbCtxLibInit (void); +extern void wdbFuncCallFpLibInit (void); +extern void wdbPdLibInit (void); +extern STATUS wdbTaskModeInit (UINT32 spawnStackSize, + UINT32 taskPriority, + UINT32 taskOptions, + UINT32 stackSize, + UINT32 maxRestarts, + UINT32 restartTime); +extern void wdbRtpLibInit (int priority); +extern void wdbRtpBpLibInit (void); +extern void wdbTaskHookInit (void); +extern void wdbBpSyncLibInit (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbLibh */ + diff --git a/h/wdb/wdbLibP.h b/h/wdb/wdbLibP.h new file mode 100644 index 0000000..a984c56 --- /dev/null +++ b/h/wdb/wdbLibP.h @@ -0,0 +1,135 @@ +/* wdbLibP.h - private header file for remote debug agent */ + +/* + * Copyright (c) 1994-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use of this + * software may be licensed only pursuant to the terms of an applicable Wind + * River license agreement. + */ + +/* +modification history +-------------------- +01z,01aug05,bpn Add new register buffer. +01y,28may04,elg Add new function pointers. +01x,08apr04,elg Define wdbMemChunk. + Remove obsolete type WDB_REG_SET_TYPE. +01w,13jan04,elg Add prototype of wdbCnctModePost(). +01v,26sep03,tbu Moved definition of wdbMbufInit & wdbSioTest to wdbOsLib.h +01u,15sep03,elg Add definition of wdbSioTest(). +01t,27aug03,elg Add declarations of context event routines. +01s,15jul03,pch Conditional compilation cleanup +01r,26jun03,elg Add definition of wdbSuspendSystem() as extern routine. +01q,27feb03,elg Merge file with BSD. +01p,04feb03,elg Add WDB merged protocol. +01o,20jul00,dbt Added wdbExternCmdRun() prototype. +01n,03feb00,elg Fix component dependencies problems. +01m,31jan00,dbt Added wdbPdUpdateNotify() prototype. +01l,21jan00,dbt Added WDB_USR_SVC_STRUCT structure. +01k,25oct99,elg Rename PD creation and deletion hooks. +01j,15oct99,dbt added wdbConnectHookAdd() and wdbDisconnectHookAdd() + prototypes. +01i,19aug99,elg Add hooks for protection domains. +01h,29jun99,elg Add WDB_CORE support. +01g,25apr02,jhw Added C++ support (SPR 76304). +01f,14sep01,jhw Added wdbExternRegsGet() and wdbExternRegsSet() function + prototypes. + Removed __STDC__ precompiler conditional. +01e,11jun98,dbt removed wdbTgtHasFpp() prototype. +01d,03jun95,ms added prototype for wdbTargetIsConnected() +01c,05apr95,ms new data types. +01b,06feb95,ms removes wdbRpcLib specific things. +01a,20sep94,ms written. +*/ + +#ifndef __INCwdbLibPh +#define __INCwdbLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include +#include + +/* defines */ + +#define WDB_STATE_EXTERN_RUNNING 1 + +#define WDB_IS_NOW_EXTERNAL() (wdbMode & WDB_MODE_SYSTEM) + +/* data types */ + +typedef struct wdb_usr_svc /* user service structure */ + { + FUNCPTR func; /* service entry point */ + UINT32 svcId; /* service ID */ + } WDB_USR_SVC; + +/* agent variables */ + +extern UINT32 wdbCommMtu; +extern UINT32 wdbTgtMemBase; +extern UINT32 wdbTgtMemSize; +extern UINT32 wdbTgtNumMemRegions; +extern WDB_MEM_REGION * pWdbTgtMemRegions; +extern UINT32 wdbAvailOptions; +extern VOIDFUNCPTR _func_dbgPdDelete; +extern UINT32 wdbMode; +extern BOOL wdbOneShot; +extern BOOL wdbSystemModeSupported; +extern FUNCPTR _func_IsNowExternal; +extern UINT32 wdbAvailModes; +extern BOOL wdbIsInitialized; +extern FUNCPTR wdbTaskRestartHook; +extern char wdbRegsBuffer[]; +extern UINT wdbRegsBufferSize; +extern VOIDFUNCPTR _func_wdbExternRegSave; +extern VOIDFUNCPTR _func_wdbExternRegRestore; + +/* function prototypes */ + +extern void wdbInfoGet (WDB_AGENT_INFO * pInfo); +extern void wdbNotifyHost (void); +extern BOOL wdbTargetIsConnected (void); + +extern STATUS wdbModeSet (INT32 newMode); +extern BOOL wdbIsNowExternal (void); +extern BOOL wdbRunsExternal (void); +extern BOOL wdbIsNowTasking (void); +extern BOOL wdbRunsTasking (void); + +extern void wdbSuspendSystem (WDB_IU_REGS * pRegs, + void (*callBack) (), + int arg); +extern void wdbSuspendSystemHere (VOIDFUNCPTR callBack, INT32 arg); +extern void wdbExternCmdRun (VOIDFUNCPTR callBack, UINT32 arg); +extern STATUS wdbExternInfRegsGet (UINT32 type, char ** ppRegs); +extern STATUS wdbExternRegsGet (UINT32 type, char ** ppRegs); +extern void wdbExternEnterHook (void); +extern void wdbExternExitHook (void); +extern void wdbCtxCreateNotify (void * pNode); +extern void wdbCtxDeleteNotify (void * pNode); +extern void wdbCtxEvtLibInit (void); +extern STATUS wdbConnectHookAdd (FUNCPTR connectHook); +extern STATUS wdbDisconnectHookAdd (FUNCPTR disconnectHook); +extern void wdbMemRtLibInit (WDB_RT_IF * pWdbRtIf); +extern void wdbCmdLoop (void); +extern void wdbRtLibInit (WDB_RT_IF * pWdbRtIf); +extern void wdbCnctModePost (UINT32 mode); +extern STATUS wdbExternRegsSet (UINT32 type, char * pRegs); +extern STATUS wdbExternRegLibInit (void); +extern STATUS wdbTaskRegLibInit (void); + +/* globals */ + +extern WDB_IU_REGS * pWdbExternSystemRegs; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbLibPh */ diff --git a/h/wdb/wdbMbufLib.h b/h/wdb/wdbMbufLib.h new file mode 100644 index 0000000..22cfff7 --- /dev/null +++ b/h/wdb/wdbMbufLib.h @@ -0,0 +1,97 @@ +/* wdbMbufLib.h - header file for WDB I/O buffer handling */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,25apr02,jhw Added C++ support (SPR 76304). +01c,19sep97,vin modified for cluster Blk logic, removed hardcoded assumption + of the location of the refcnt. +01b,24jul96,vin upgraded to BSD4.4 mbufs +01a,04may95,ms written. +*/ + +#ifndef __INCwdbMbufLibh +#define __INCwdbMbufLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "net/mbuf.h" + +/* macros */ + +#define wdbMbufClusterInit(pMbuf, addr, nBytes, callBackRtn, callBackArg) \ + { \ + (pMbuf)->m_next = NULL; \ + (pMbuf)->m_nextpkt = NULL; \ + (pMbuf)->m_data = (caddr_t)(addr); \ + (pMbuf)->m_len = nBytes; \ + (pMbuf)->m_type = MT_DATA; \ + (pMbuf)->m_flags |= M_EXT; \ + (pMbuf)->m_extBuf = (caddr_t)(addr); \ + (pMbuf)->m_extSize = nBytes; \ + (pMbuf)->m_extFreeRtn = callBackRtn; \ + (pMbuf)->m_extRefCnt = 1; \ + (pMbuf)->m_extArg1 = callBackArg; \ + (pMbuf)->m_extArg2 = 0; \ + (pMbuf)->m_extArg3 = 0; \ + } + +#define wdbMbufChainFree(pMbuf) \ + { \ + struct mbuf *__pNextMbuf; \ + struct mbuf *__pThisMbuf; \ + __pThisMbuf = pMbuf; \ + while (__pThisMbuf != NULL) \ + { \ + __pNextMbuf = __pThisMbuf->m_next; \ + wdbMbufFree (__pThisMbuf); \ + __pThisMbuf = __pNextMbuf; \ + } \ + } + +#define wdbMbufDataGet(__pMbuf, __pDest, __len, __pLen) \ + { \ + int __nBytes; \ + struct mbuf * __pThisMbuf; \ + \ + __nBytes = 0; \ + for (__pThisMbuf = __pMbuf; \ + __pThisMbuf != NULL; \ + __pThisMbuf = __pThisMbuf->m_next) \ + { \ + int __moreBytes = MIN (__pThisMbuf->m_len, __len - __nBytes); \ + bcopy (mtod (__pThisMbuf, char *), __pDest + __nBytes, __moreBytes); \ + __nBytes += __moreBytes; \ + if (__nBytes >= __len) \ + break; \ + } \ + \ + *(__pLen) = __nBytes; \ + } + +/* function prototypes */ + +#ifdef __STDC__ + +extern struct mbuf * wdbMbufAlloc (void); +extern void wdbMbufFree (struct mbuf * segId); + +#else /* __STDC__ */ + +extern struct mbuf * wdbMbufAlloc (); +extern void wdbMbufFree (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbMbufLibh */ + diff --git a/h/wdb/wdbMemLib.h b/h/wdb/wdbMemLib.h new file mode 100644 index 0000000..c809621 --- /dev/null +++ b/h/wdb/wdbMemLib.h @@ -0,0 +1,43 @@ +/* wdbMemLib.h - WDB memory services header file */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,30sep03.elg Fix build warnings. +01c,29sep03,tbu Changed wdbMemScan usage (now returns a status) +01b,16sep03,tbu Added _wdbMemCksum +01a,06jan03,elg Written. +*/ + +#ifndef __INCwdbMemLibh +#define __INCwdbMemLibh + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* externs */ + +extern UINT32 (*_wdbMemCopy) (char * pSource, char * pDestination, + UINT32 nBytes, UINT32 width); +extern UINT32 (*_wdbMemFill) (char * addr, UINT32 nBytes, UINT32 pattern, + UINT32 width); +extern UINT32 (*_wdbMemRead) (char * pSource, char ** pDestination, + UINT32 nBytes); +extern UINT32 (*_wdbMemScan) (char * pStart, char * pEnd, char * pattern, + UINT32 nBytes, int step, BOOL match, + TGT_ADDR_T * pAdrr); +extern UINT32 (*_wdbMemCksum) (char * addr, UINT32 nBytes, UINT32 * pCksum); + +extern UINT32 wdbMemTest (char * addr, UINT32 nBytes, UINT32 accessType, + UINT32 width); +extern UINT32 wdbCksum (UINT16 * pData, UINT32 nBytes, UINT32 init, + BOOL moreData); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCwdbMemLibh */ diff --git a/h/wdb/wdbOsLib.h b/h/wdb/wdbOsLib.h new file mode 100644 index 0000000..0cff137 --- /dev/null +++ b/h/wdb/wdbOsLib.h @@ -0,0 +1,120 @@ +/* wdbOsLib.h - WDB vxWorks specific header */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,23mar04,elg Macros to get information in context are now OS specific. +01e,12sep03,tbu Added inclusion of netinet/in_systm.h +01d,29aug03,elg Redefine GOPHER_STRTOL to do strtoul() (fix SPR #90223). + Include vxWorks.h first (fix SPR #90034). +01c,14jul03,pch Conditional compilation cleanup +01b,06may03,elg Fix compilation error when Altivec is supported. +01a,03jan03,elg Written. +*/ + +#ifndef __INCwdbOsLibh +#define __INCwdbOsLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* +DESCRIPTION + +The vxWorks specific header contains definitions that cannot be used by other +OSes. +*/ + +/* includes */ + +#include "vxWorks.h" /* this file must be included first */ + +#include "types/vxANSI.h" +#include "rpc/types.h" + +#include "ctype.h" +#include "limits.h" +#include "sioLib.h" +#include "stdlib.h" +#include "string.h" +#include "regs.h" +#include "dspLib.h" +#include "taskHookLib.h" +#include "intLib.h" +#include "fppLib.h" + +#if !defined (_WRS_PAL_COPROC_LIB) +#ifdef _WRS_ALTIVEC_SUPPORT +#include "altivecLib.h" +#endif /* _WRS_ALTIVEC_SUPPORT */ +#endif /* ! _WRS_PAL_COPROC_LIB */ + +/* definitions */ + +/* OS definitions */ + +#define WDB_KERNEL_ID -1 /* kernel ID in WDB agent */ + +/* access to registers */ + +#define WDB_PC(ptr) (ptr)->reg_pc +#define WDB_FP(ptr) (ptr)->reg_fp +#define WDB_SP(ptr) (ptr)->reg_sp + +/* debug info */ + +/* on vxWorks, PC does not need to be changed */ + +#define _WRS_ADJUST_PC_AFTER_SW_BP(pRegs) + +/* gopher routines */ + +#define GOPHER_STRTOL strtoul +#define GOPHER_WRITE_SCALAR gopherWriteScalar + +/* macros to get and set ID from context structure */ + +#define WDB_CTX_ID_GET(pCtx) ((pCtx)->numArgs > 0 ? (pCtx)->args [0] : 0) + +#define WDB_CTX_SYS_INFO_SET(pArgs) \ + { \ + (pArgs) [0] = 0; \ + (pArgs) [1] = 0; \ + } + +#define WDB_CTX_TASK_INFO_SET(pArgs, tid, pid) \ + { \ + (pArgs) [0] = (TGT_INT_T) (tid); \ + (pArgs) [1] = (TGT_INT_T) (pid); \ + } + +#define WDB_CTX_RTP_INFO_SET(pArgs, pid) \ + { \ + (pArgs) [0] = (TGT_INT_T) (pid); \ + (pArgs) [1] = 0; \ + } + +#define WDB_CTX_INFO_COPY(pArgs, pCtx) \ + { \ + int ix; \ + \ + for (ix = 0; ix < (pCtx)->numArgs; ix++) \ + (pArgs) [ix] = (pCtx)->args [ix]; \ + for (ix = (pCtx)->numArgs; ix < WDB_CTX_MAX_ARGS; ix++) \ + (pArgs) [ix] = 0; \ + } + +/* globals */ + +IMPORT void wdbMbufInit (struct mbuf *, UINT32, + CL_BLK *, UINT32); +IMPORT void wdbSioTest (SIO_CHAN *, int, char); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCwdbOsLibh */ diff --git a/h/wdb/wdbRegs.h b/h/wdb/wdbRegs.h new file mode 100644 index 0000000..e0d67c8 --- /dev/null +++ b/h/wdb/wdbRegs.h @@ -0,0 +1,109 @@ +/* wdbRegs.h - header file for register layout as view by the WDB agent */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01l,13apr04,elg Remove obsolete type WDB_REG_SET_TYPE. +01k,05feb04,aeg added include of altivecLib.h +01j,27feb03,elg Merge file with BSD. +01j,03sep02,dtr Adding wdb external SPE function declarations. +01i,25apr02,jhw Added C++ support (SPR 76304). +01h,13jul01,kab Cleanup for merge to mainline +01g,13apr01,pcs Add Altivec Support. +01f,15mar01,pcs Change include filename altiVecLib.h to altivecLib.h +01e,29jan01,dtr Adding altivec register support. +01e,28feb00,frf Add SH4 support for T2 +01d,31jul98,kab Added DSP register support. +01d,12feb99,dbt fixed __STDC__ use. +01c,17dec96,ms WDB now uses FP_CONTEXT instead of FPREG_SET (SPR 7654). +01b,25may95,ms defined register objects. +01a,03may95,ms written. +*/ + +#ifndef __INCwdbRegsh +#define __INCwdbRegsh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "wdb/dll.h" +#include "wdb/wdb.h" + +/* data types */ + +typedef REG_SET WDB_IU_REGS; + +typedef FP_CONTEXT WDB_FPU_REGS; +typedef DSP_CONTEXT WDB_DSP_REGS; + +typedef struct + { + dll_t node; + UINT32 regSetType; /* type of register set */ + void (*save) (void); /* save current regs */ + void (*load) (void); /* load saved regs */ + void (*get) (char ** ppRegs); /* get saved regs */ + void (*set) (char *pRegs); /* change saved regs */ + } WDB_REG_SET_OBJ; + +#ifdef _WRS_ALTIVEC_SUPPORT + +#include "altivecLib.h" + +typedef ALTIVEC_CONTEXT WDB_ALTIVEC_REGS; + +typedef struct + { + /* NOTE: altivecContext has to be the first element in the struct. + altivecContext has to be 16 byte aligned. Anyone who uses + this object should define it as a pointer and memalign to + get it 16 byte aligned. + */ + WDB_ALTIVEC_REGS altivecContext; /* the hardware context */ + WDB_REG_SET_OBJ regSet; /* generic register set */ + } ALTIVEC_REG_SET_OBJ; + +#endif /* _WRS_ALTIVEC_SUPPORT */ + +#ifdef _WRS_SPE_SUPPORT + +#include "speLib.h" + +typedef SPE_CONTEXT WDB_SPE_REGS; + +typedef struct + { + /* NOTE: speContext has to be the first element in the struct. + speContext should be _CACHE_ALIGN_SIZE aligned + (which is always > 8 bytes). Anyone who uses + this object should define it as a pointer and memalign to + get it _CACHE_ALIGN_SIZE byte aligned. + */ + WDB_SPE_REGS speContext; /* the hardware context */ + WDB_REG_SET_OBJ regSet; /* generic register set */ + } SPE_REG_SET_OBJ; + +#endif /* _WRS_SPE_SUPPORT */ + +/* externs */ + +IMPORT WDB_IU_REGS * pWdbExternSystemRegs; + +/* function prototypes */ + +extern WDB_REG_SET_OBJ * wdbAltivecLibInit (void); +extern WDB_REG_SET_OBJ * wdbSpeLibInit (void); +extern WDB_REG_SET_OBJ * wdbFpLibInit (void); +extern WDB_REG_SET_OBJ * wdbDspLibInit (void); +extern void wdbExternRegSetObjAdd (WDB_REG_SET_OBJ *pRegSet); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbRegsh */ diff --git a/h/wdb/wdbRpcLib.h b/h/wdb/wdbRpcLib.h new file mode 100644 index 0000000..0a87efb --- /dev/null +++ b/h/wdb/wdbRpcLib.h @@ -0,0 +1,76 @@ +/* wdbRpcLib.h - header file for remote debug agents RPC interface */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,25apr02,jhw Added C++ support (SPR 76304). +01c,03jun95,ms added wdbRpcNotifyConnect. +01b,05apr95,ms new data types. +01a,06feb95,ms written. +*/ + +#ifndef __INCwdbRpcLibh +#define __INCwdbRpcLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "wdb/wdbCommIfLib.h" + +/* data types */ + +typedef struct /* hidden */ + { + WDB_COMM_IF * pCommIf; /* communication interface */ + XDR xdrs; /* XDR stream */ + UINT32 * pInBuf; /* input buffer */ + int numBytesIn; /* # bytes recv'ed */ + UINT32 * pOutBuf; /* output buffer */ + u_int numBytesOut; /* # bytes sent */ + u_int bufSize; /* size of buffers in bytes */ + u_int xid; /* transport ID */ + struct sockaddr_in notifyAddr; /* address to send event data */ + struct sockaddr_in replyAddr; /* address to send reply */ + } WDB_XPORT; + +/* function prototypes */ + +#if defined(__STDC__) + +extern void wdbRpcXportInit (WDB_XPORT *pXport, WDB_COMM_IF *pIf, + caddr_t pInBuf, caddr_t pOutBuf, + u_int bufSize); +extern BOOL wdbRpcRcv (void *pXport, struct timeval *tv); +extern BOOL wdbRpcGetArgs (void *pXport, BOOL (*inProc)(), + caddr_t args); +extern void wdbRpcReply (void *pXport, BOOL (*inProc)(), + caddr_t addr); +extern void wdbRpcReplyErr (void *pXport, uint_t errStatus); +extern void wdbRpcResendReply (void *pXport); +extern void wdbRpcNotifyHost (void *pXport); +extern void wdbRpcNotifyConnect (void *pXport); + +#else /* __STDC__ */ + +extern void wdbRpcXportInit (); +extern BOOL wdbRpcRcv (); +extern void wdbRpcIn (); +extern BOOL wdbRpcGetArgs (); +extern void wdbRpcReply (); +extern void wdbRpcReplyErr (); +extern void wdbRpcResendReply (); +extern void wdbRpcNotifyHost (); +extern void wdbRpcNotifyConnect (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbRpcLibh */ diff --git a/h/wdb/wdbRtIfLib.h b/h/wdb/wdbRtIfLib.h new file mode 100644 index 0000000..65300b1 --- /dev/null +++ b/h/wdb/wdbRtIfLib.h @@ -0,0 +1,229 @@ +/* wdbRtIfLib.h - header file for the WDB agents runtime interface */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01t,13aug04,dbt Added signal information in exception notification. +01s,31mar04,elg Change prototype of excHookAdd() pointer. +01r,30sep03,elg Fix build warnings. + Fix pointer error with memory probe runtime interface. +01q,12sep03,tbu Moved inclusion of netinet/in_systm.h to wdbOsLib.h +01p,27feb03,elg Merge file with BSD and define new runtime interface. +01o,25apr02,jhw Added C++ support (SPR 76304). +01n,01feb01,dtr Adding in call for test for Altivec Registers. +01m,28aug00,elg Change pdIsValid() to pdIdVerify(). +01l,16aug00,elg Change memProtect() prototype. +01k,25apr00,elg Add taskCtxGet() routine. +01j,12apr00,elg Add parmeters in pdCreate(). +01i,02feb00,dbt Added pdIsValid and removed pdListGet. +01h,15nov99,elg Add returnNodeGet() in WDB runtime interface. +01g,08nov99,elg Add ltExitCreate(). +01f,15oct99,elg Change pdCreate() interface. +01e,09sep99,elg Add taskCtxSwitch() to Runtime interface. +01d,06may99,elg Add 2 new routines in the Runtime Interface: taskDebugStart() + and taskDebugEnd(). +01c,01jun95,ms added taskLock/Unlock, removed timers +01b,05apr95,ms new data types. +01a,23sep94,ms written. +*/ + +#ifndef __INCwdbRtIfLibh +#define __INCwdbRtIfLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "wdb/wdb.h" +#include "wdb/wdbCtxIfLib.h" +#include "wdb/wdbRegs.h" + +/* data types */ + +typedef struct wdb_rt_if + { + /* this function must be provided always */ + + UINT32 (*rtInfoGet) (WDB_RT_INFO * pRtInfo); + + /* function call to reboot machine */ + + UINT32 (*reboot) (void); + + /* function to call after loading text */ + + UINT32 (*cacheTextUpdate) (char * addr, UINT32 nBytes); + + /* function to call to write protect memory */ + + STATUS (*memProtect) ( + UINT32 pdId, + char * addr, + UINT32 nBytes, + BOOL protect, + UINT32 * oldAttr + ); + + /* function needed to probe memory (required) */ + + STATUS (*memProbe) ( + char * addr, + UINT32 mode, + UINT32 len, + char * pVal + ); + + /* memory operations */ + + void * (*memalloc) (size_t nBytes); + UINT32 (*memfree) (void * pData); + + /* Context switch for a task */ + + UINT32 (*memCtxSwitch) (UINT32 newCtx); + UINT32 (*memCtxGet) (void); + + /* premption disable/reenable routine (for gopher interlocking) */ + + UINT32 (*schedLock) (void); + UINT32 (*schedUnlock) (void); + + UINT32 (*intLock) (void); + UINT32 (*intUnlock) (int level); + + /* errno management */ + + int (*errnoGet) (void); + STATUS (*errnoSet) (int); + + /* function to install an exception hook (for exc event notification) */ + + UINT32 (*excHookAdd) (void (*hook) ( + WDB_CTX stoppedCtx, + WDB_CTX excCtx, + UINT32 vec, + UINT32 sigNum, + char * pESF, + WDB_IU_REGS * pRegs, + BOOL systemSuspend + )); + + /* Page Size information */ + + int pageSize; + + /* node on context specific routines */ + + WDB_CTX_IF * pWdbCtxIf [WDB_CTX_TYPE_NUM]; + } WDB_RT_IF; + +/* global variables */ + +IMPORT WDB_RT_IF * pWdbRtIf; /* runtime interface */ + +/* macros */ + +/* info macro */ + +#define WDB_RT_INFO_GET(pRtInfo) \ + (pWdbRtIf->rtInfoGet == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + pWdbRtIf->rtInfoGet (pRtInfo)) + +/* reboot macro */ + +#define WDB_RT_REBOOT() \ + (pWdbRtIf->reboot == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + pWdbRtIf->reboot ()) + +/* memory macros */ + +#define WDB_RT_MEM_CACHE_UPDATE(addr, nBytes) \ + (pWdbRtIf->cacheTextUpdate == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + pWdbRtIf->cacheTextUpdate ((addr), (nBytes))) + +#define WDB_RT_MEM_PROTECT(memCtx, dest, nBytes, protect, oldAttr) \ + (pWdbRtIf->memProtect == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + pWdbRtIf->memProtect ((memCtx), (dest), (nBytes), \ + (protect), (oldAttr))) + +#define WDB_RT_MEM_PROBE(dest, option, nBytes, source) \ + (pWdbRtIf->memProbe == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + pWdbRtIf->memProbe ((dest), (option), (nBytes), (source))) + +#define WDB_RT_MEM_ALLOC(type, size) \ + (pWdbRtIf->memalloc == NULL ? \ + (type *) NULL : \ + (type *) pWdbRtIf->memalloc ((size_t) ((size) * sizeof (type)))) + +#define WDB_RT_MEM_FREE(addr) \ + (pWdbRtIf->memfree == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + pWdbRtIf->memfree (addr)) + +#define WDB_RT_MEM_SWITCH(memCtx) \ + (pWdbRtIf->memCtxSwitch == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + pWdbRtIf->memCtxSwitch (memCtx)) + +#define WDB_RT_MEM_CTX_GET() \ + (pWdbRtIf->memCtxGet == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + pWdbRtIf->memCtxGet ()) + +/* scheduler macros */ + +#define WDB_RT_SCHED_LOCK() \ + (!WDB_IS_NOW_EXTERNAL () ? \ + ((pWdbRtIf->schedLock == NULL) ? \ + WDB_ERR_NO_RT_PROC : \ + pWdbRtIf->schedLock ()) : 0) + +#define WDB_RT_SCHED_UNLOCK() \ + (!WDB_IS_NOW_EXTERNAL () ? \ + ((pWdbRtIf->schedUnlock == NULL) ? \ + WDB_ERR_NO_RT_PROC : \ + pWdbRtIf->schedUnlock ()) : 0) + +#define WDB_RT_INT_LOCK() \ + (pWdbRtIf->intLock == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + pWdbRtIf->intLock ()) + +#define WDB_RT_INT_UNLOCK(level) \ + (pWdbRtIf->intUnlock == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + pWdbRtIf->intUnlock (level)) + +/* errno management */ + +#define WDB_RT_ERRNO_GET() \ + (pWdbRtIf->errnoGet == NULL ? \ + ERROR : \ + pWdbRtIf->errnoGet ()) + +#define WDB_RT_ERRNO_SET(x) \ + (pWdbRtIf->errnoSet == NULL ? \ + ERROR : \ + pWdbRtIf->errnoSet (x)) + +/* hooks */ + +#define WDB_RT_EXC_HOOK_ADD(hook) \ + (pWdbRtIf->excHookAdd == NULL ? \ + WDB_ERR_NO_RT_PROC : \ + pWdbRtIf->excHookAdd (hook)) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbRtIfLibh */ diff --git a/h/wdb/wdbRtpLibP.h b/h/wdb/wdbRtpLibP.h new file mode 100644 index 0000000..5b1dd04 --- /dev/null +++ b/h/wdb/wdbRtpLibP.h @@ -0,0 +1,47 @@ +/* wdbRtpLibP.h - private header file for RTP runtime interface */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use of this + * software may be licensed only pursuant to the terms of an applicable Wind + * River license agreement. + */ + +/* +modification history +-------------------- +01a,25jul05,bpn Created. +*/ + +#ifndef __INCwdbRtpLibPh +#define __INCwdbRtpLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include + +/* data types */ + +typedef struct wdb_rtp_info + { + VOIDFUNCPTR wdbDeleteHook; /* RTP exit hook for WDB */ + VOIDFUNCPTR wdbDetachHook; /* RTP Detach routine */ + BOOL childProcessStop; /* TRUE if CPS is set for that task */ + } WDB_RTP_INFO; + +/* function prototypes */ + +extern void wdbRtpCtrlLibInit (void); +extern STATUS wdbRtpDeleteHookManage (BOOL addHook); +extern WDB_RTP_INFO * wdbRtpInfoAlloc (RTP_ID pid); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbRtpLibPh */ diff --git a/h/wdb/wdbSvcLib.h b/h/wdb/wdbSvcLib.h new file mode 100644 index 0000000..705ac4f --- /dev/null +++ b/h/wdb/wdbSvcLib.h @@ -0,0 +1,59 @@ +/* wdbSvcLib.h - header file for remote debug server */ + +/* + * Copyright (c) 1994-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use of this + * software may be licensed only pursuant to the terms of an applicable Wind + * River license agreement. + */ + +/* +modification history +-------------------- +01h,28jul05,bpn Remove DSA support. +01g,27feb03,elg Merge file with BSD. +01f,25apr02,jhw Added C++ support (SPR 76304). +01e,11jan99,dbt added wdbSvcHookAdd() prototype (SPR #24323). +01d,12feb98,dbt added "dynamic" field in WDB_SVC structure + added wdbSvcDsaSvcRemove() declaration. +01c,05apr95,ms new data types. +01b,06feb95,ms added XPORT handle to dispatch routine. +01a,20sep94,ms written. +*/ + +#ifndef __INCwdbSvcLibh +#define __INCwdbSvcLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include +#include + +/* data types */ + +typedef struct /* hidden */ + { + u_int serviceNum; + UINT32 (*serviceRtn)(); + xdrproc_t inProc; + xdrproc_t outProc; + } WDB_SVC; + +/* function prototypes */ + +IMPORT void wdbSvcLibInit (WDB_SVC * wdbSvcArray, UINT32 size); +IMPORT STATUS wdbSvcAdd (UINT32 procNum, UINT32 (*rout) (), + xdrproc_t xdrIn, xdrproc_t xdrOut); +IMPORT void wdbSvcDispatch (WDB_XPORT * pXport, UINT32 procNum); +IMPORT void wdbSvcHookAdd (FUNCPTR hookRtn, UINT32 arg); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbSvcLibh */ diff --git a/h/wdb/wdbTaskLib.h b/h/wdb/wdbTaskLib.h new file mode 100644 index 0000000..ad52da3 --- /dev/null +++ b/h/wdb/wdbTaskLib.h @@ -0,0 +1,63 @@ +/* wdbTaskLib.h - header file for task support in WDB agent */ + +/* + * Copyright (c) 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use of this + * software may be licensed only pursuant to the terms of an applicable Wind + * River license agreement. + */ + +/* +modification history +-------------------- +01b,12jul05,bpn Added childProcessStop field to WDB_TASK_INFO. +01a,16dec03,elg Written. +*/ + +#ifndef __INCwdbTaskLibh +#define __INCwdbTaskLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define WDB_INFO(p) ((WDB_TASK_INFO *) (((WIND_TCB *) (p))->pWdbInfo)) + +/* data types */ + +typedef struct wdb_task_info /* task information for WDB */ + { + struct + { + void * wdb1; + void * wdb2; + } wdbEvtList; /* dll for event */ + int taskBpAddr; /* current breakpoint address */ + int taskPc; /* task program counter */ + int taskFp; /* task frame pointer */ + int taskSp; /* task stack pointer */ + VOIDFUNCPTR wdbExitHook; /* task exit hook */ + UINT32 tid; /* task ID */ + UINT32 ctxType; /* context stopped by breakpoint */ + UINT32 status; /* status of context that hit BP */ + BOOL childProcessStop; /* TRUE if CPS is set for that task */ + } WDB_TASK_INFO; + +/* function prototypes */ + +extern UINT32 wdbTaskDeleteHookAdd (UINT32 tid, VOIDFUNCPTR hook); +extern UINT32 wdbTaskCreateHookAdd (VOIDFUNCPTR hook, + WDB_ACTION_TYPE action); + +extern UINT32 wdbTaskBpAdd (WDB_CTX * pCtx, WDB_ACTION * pAction, + INSTR * addr, UINT32 count, + UINT32 type, UINT32 * pBpId); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbTaskLibh */ diff --git a/h/wdb/wdbTipcSockLib.h b/h/wdb/wdbTipcSockLib.h new file mode 100644 index 0000000..7dbc218 --- /dev/null +++ b/h/wdb/wdbTipcSockLib.h @@ -0,0 +1,38 @@ +/* wdbTipcSockLib.h - header file for remote debug agent TIPC library */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use of this + * software may be licensed only pursuant to the terms of an applicable Wind + * River license agreement. + */ + +/* +modification history +-------------------- +01a,30may05,dbt written. +*/ + +#ifndef __INCwdbTipcSockLibh +#define __INCwdbTipcSockLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "wdb/wdbCommIfLib.h" + +/* function prototypes */ + +extern STATUS wdbTipcSockIfInit (WDB_COMM_IF * pCommIf, + UINT8 tipcPortType, + UINT8 tipcPortInstance); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbTipcSockLibh */ diff --git a/h/wdb/wdbTyCoDrv.h b/h/wdb/wdbTyCoDrv.h new file mode 100644 index 0000000..4c5982d --- /dev/null +++ b/h/wdb/wdbTyCoDrv.h @@ -0,0 +1,54 @@ +/* wdbTyCoDrv.h - header file for BSP serial drivers used by the agent */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,25apr02,jhw Added C++ support (SPR 76304). +01c,15jun95,ms updated for new serial driver. +01b,05apr95,ms new data types. +01a,20dec94,ms written. +*/ + +#ifndef __INCwdbTyCoDrvh +#define __INCwdbTyCoDrvh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "sioLib.h" + +/* data types */ + +typedef struct + { + SIO_DRV_FUNCS * pDrvFuncs; /* driver functions */ + STATUS (*getTxChar)(); /* tx callback */ + void * getTxArg; /* callback arg */ + STATUS (*putRcvChar)(); /* receive callback */ + void * putRcvArg; /* callback arg */ + int fd; /* underlying tyCo file descriptor */ + } WDB_TYCO_SIO_CHAN; + +/* function prototypes */ + +#if defined(__STDC__) + +extern STATUS wdbTyCoDevInit (WDB_TYCO_SIO_CHAN *pDev, char *devName, + int baud); + +#else /* __STDC__ */ + +extern STATUS wdbTyCoInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbTyCoDrvh */ diff --git a/h/wdb/wdbUdpLib.h b/h/wdb/wdbUdpLib.h new file mode 100644 index 0000000..bc9e9b7 --- /dev/null +++ b/h/wdb/wdbUdpLib.h @@ -0,0 +1,43 @@ +/* wdbUdpLib.h - header file for remote debug agents UDP library */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25apr02,jhw Added C++ support (SPR 76304). +01b,05apr95,ms new data types. +01a,20dec94,ms written. +*/ + +#ifndef __INCwdbUdpLibh +#define __INCwdbUdpLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "wdb/wdbCommIfLib.h" +#include "wdb/wdbMbufLib.h" + +/* function prototypes */ + +#if defined(__STDC__) + +extern STATUS udpCommIfInit (WDB_COMM_IF *pWdbCommIf, WDB_DRV_IF *pDrvIf); +extern void udpRcv (struct mbuf *pMbuf); + +#else /* __STDC__ */ + +extern STATUS udpCommIfInit (); +extern void udpRcv (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbUdpLibh */ diff --git a/h/wdb/wdbUdpSockLib.h b/h/wdb/wdbUdpSockLib.h new file mode 100644 index 0000000..2ccce13 --- /dev/null +++ b/h/wdb/wdbUdpSockLib.h @@ -0,0 +1,40 @@ +/* wdbUdpSockLib.h - header file for remote debug agents UDP library */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25apr02,jhw Added C++ support (SPR 76304). +01b,05apr95,ms new data types. +01a,08mar95,ms written. +*/ + +#ifndef __INCwdbUdpSockLibh +#define __INCwdbUdpSockLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "wdb/wdbCommIfLib.h" + +/* function prototypes */ + +#if defined(__STDC__) + +extern STATUS wdbUdpSockIfInit (WDB_COMM_IF *pCommIf); + +#else /* __STDC__ */ + +extern STATUS wdbUdpSockIfInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbUdpSockLibh */ diff --git a/h/wdb/wdbVioLib.h b/h/wdb/wdbVioLib.h new file mode 100644 index 0000000..a3f5fb9 --- /dev/null +++ b/h/wdb/wdbVioLib.h @@ -0,0 +1,76 @@ +/* wdbVioLib.h - VIO header file for remote debug server */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,25apr02,jhw Added C++ support (SPR 76304). +01g,27may98,cth removed get snd/rcv buffer ioctl commands for tsfs sockets +01f,19mar98,cth add ioctl commands for tsfs sockets +01e,18aug97,cth add FIOSNDURGB ioctl cmd for tsfs +01d,12nov96,c_s add wdbTsfsDrv prototype +01c,24may95,ms added wdbVioChannelUnregister(). +01b,05apr95,ms new data types. +01a,15nov94,ms written. +*/ + +#ifndef __INCwdbVioLibh +#define __INCwdbVioLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "wdb/wdb.h" +#include "wdb/dll.h" + +/* data types */ + +typedef struct wdb_vio_node + { + dll_t node; + uint_t channel; + int (*inputRtn) (struct wdb_vio_node *pNode, char *pData, + uint_t nBytes); + void * pVioDev; + } WDB_VIO_NODE; + +/* ioctl commands for Target-Server File System (TSFS) */ + +#define SO_SNDURGB 5000 /* send an out-of-band byte on sock */ +#define SO_SETDEBUG 5001 /* setsockopt SO_DEBUG for sock (int) */ +#define SO_GETDEBUG 5002 /* getsockopt SO_DEBUG for sock (int) */ +#define SO_SETSNDBUF 5003 /* setsockopt SO_SNDBUF for sock (int) */ +#define SO_SETRCVBUF 5005 /* setsockopt SO_RCVBUF for sock (int) */ +#define SO_SETDONTROUTE 5007 /* setsockopt SO_DONTROUTE for sock (int) */ +#define SO_GETDONTROUTE 5008 /* getsockopt SO_DONTROUTE for sock (int) */ +#define SO_SETOOBINLINE 5009 /* setsockopt SO_OOBINLINE for sock (int) */ +#define SO_GETOOBINLINE 5010 /* getsockopt SO_OOBINLINE for sock (int) */ + + +/* function prototypes */ + +#if defined(__STDC__) + +extern void wdbVioLibInit (void); +extern STATUS wdbVioChannelRegister (WDB_VIO_NODE *pVioNode); +extern void wdbVioChannelUnregister (WDB_VIO_NODE *pVioNode); +extern STATUS wdbTsfsDrv (char * root); + +#else /* __STDC__ */ + +extern void wdbVioLibInit (); +extern STATUS wdbVioDevRegister (); +extern void wdbVioChannelUnregister (); +extern STATUS wdbTsfsDrv (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwdbVioLibh */ diff --git a/h/win_Lib.h b/h/win_Lib.h new file mode 100644 index 0000000..e6d5477 --- /dev/null +++ b/h/win_Lib.h @@ -0,0 +1,181 @@ +/* win_Lib.h - simulator UNIX/VxSim interface header */ + +/* Copyright 1998-2001 Wind River Systems, Inc */ + +/* +modification history +-------------------- +01c,03sep01,hbh Fixed field types for win_stat structure (SPR 29146 & 65372). +01b,29apr98,cym added file stat/find structures and exceptions. +01a,31jan98,jmb written. +*/ + +/* +DESCRIPTION +This header contains the prototype declarations for all Win32 +calls made by VxSim outside of simLib.c +*/ + +#ifndef INCwin_Libh +#define INCwin_Libh + +/* This typedef doesn't really belong here */ + +typedef struct ntsim_int_vec +{ + int message; + void (*handler)(); + int arg; +} NTSIM_INT_VEC; + +#define INT_WAS_IN_PROGRESS 0x1000000 + +#define WIN_INFINITE 0xFFFFFFFF + +typedef int WIN_BOOL; +typedef unsigned int WIN_DWORD; +typedef WIN_DWORD * WIN_LPDWORD; +typedef void * WIN_HANDLE; +typedef void * WIN_LPVOID; +typedef const void * WIN_LPCVOID; + +typedef struct _WIN_FLOATING_SAVE_AREA +{ + WIN_DWORD ControlWord; + WIN_DWORD StatusWord; + WIN_DWORD TagWord; + WIN_DWORD ErrorOffset; + WIN_DWORD ErrorSelector; + WIN_DWORD DataOffset; + WIN_DWORD DataSelector; + WIN_DWORD RegisterArea[80]; + WIN_DWORD Cr0NpxState; + +} WIN_FLOATING_SAVE_AREA; + +typedef struct _WIN_CONTEXT +{ + WIN_DWORD ContextFlags; + WIN_DWORD Dr0; + WIN_DWORD Dr1; + WIN_DWORD Dr3; + WIN_DWORD Dr6; + WIN_DWORD Dr7; + + WIN_FLOATING_SAVE_AREA FloatSave; + + WIN_DWORD SegGs; + WIN_DWORD SegFs; + WIN_DWORD SegEs; + WIN_DWORD SegDs; + + WIN_DWORD Edi; + WIN_DWORD Esi; + WIN_DWORD Ebx; + WIN_DWORD Edx; + WIN_DWORD Ecx; + WIN_DWORD Eax; + + WIN_DWORD Ebp; + WIN_DWORD Eip; + WIN_DWORD SegCs; + WIN_DWORD Eflags; + WIN_DWORD Esp; + WIN_DWORD SegSs; + +} WIN_CONTEXT,*WIN_LPCONTEXT; + +struct win_stat { + short st_dev; + short st_ino; + unsigned short st_mode; + short st_nlink; + int st_uid; + short st_gid; + short st_rdev; + long st_size; + long st_atime; + long st_mtime; + long st_ctime; + }; + +typedef struct _WIN_FILETIME { + DWORD LowTime; + DWORD HighTime; + } WIN_FILETIME; + +typedef struct _WIN_FIND_DATA { + WIN_DWORD attrib; + WIN_FILETIME tCreate; + WIN_FILETIME tAccess; + WIN_FILETIME tWrite; + WIN_DWORD szHigh; + WIN_DWORD szLow; + WIN_DWORD reserved0; + WIN_DWORD reserved1; + char name[ 260 ]; + char altName[ 14 ]; + }WIN_FIND_DATA; + +/* Only use __stdcall under Win32 compiler */ + +#ifdef i386 +#define WIN_STDCALL __attribute__ ((stdcall)) +#define WIN_WINAPI WIN_STDCALL +#define WIN_CALLBACK WIN_WINAPI +#else +#define WIN_CALLBACK __stdcall +#endif + +typedef WIN_DWORD (WIN_CALLBACK *WIN_LPTHREAD_START_ROUTINE) (WIN_LPVOID); + +typedef struct _WIN_SECURITY_ATTRIBUTES +{ + WIN_DWORD nLength; + WIN_LPVOID lpSecurityDescriptors; + WIN_BOOL bInheritHandle; + +} *WIN_LPSECURITY_ATTRIBUTES; + +#ifdef __STDC__ + +extern WIN_DWORD win_SetTimer(unsigned int id,unsigned int msecs); +extern WIN_BOOL win_KillTimer(unsigned int id); +extern WIN_BOOL win_FindNextFile(HANDLE hFind, WIN_FIND_DATA *findData); +extern WIN_HANDLE win_FindFirstFile(char *searchStr, WIN_FIND_DATA *findData); +extern WIN_BOOL win_FindClose(HANDLE hFind); +extern WIN_BOOL win_WaitMessage (void); +extern WIN_BOOL win_GetThreadContext (WIN_HANDLE hThread,WIN_LPCONTEXT lpContext); +extern WIN_BOOL win_SetThreadContext (WIN_HANDLE hThread,WIN_LPCONTEXT lpContext); +extern WIN_HANDLE win_CreateThread (WIN_LPSECURITY_ATTRIBUTES security, WIN_DWORD stack,\ + WIN_LPTHREAD_START_ROUTINE start, WIN_LPVOID param, WIN_DWORD flags, WIN_LPDWORD threadId); +extern WIN_DWORD win_ResumeThread (WIN_HANDLE hThread); +extern WIN_DWORD win_SuspendThread (WIN_HANDLE hThread); +extern WIN_HANDLE win_GetCurrentThread (void); +extern WIN_HANDLE win_GetCurrentProcess (void); +extern WIN_DWORD win_SemTake (WIN_HANDLE sem); +extern WIN_BOOL win_SemGive (WIN_HANDLE sem); +extern WIN_BOOL win_FlushInstructionCache(WIN_HANDLE process, WIN_LPCVOID addr, WIN_DWORD bytes); +extern void *u_malloc (int size); + + +#else + +extern WIN_DWORD win_SetTimer(); +extern WIN_BOOL win_KillTimer(); +extern WIN_BOOL win_WaitMessage (); +extern WIN_BOOL win_GetThreadContext (); +extern WIN_BOOL win_SetThreadContext (); +extern WIN_HANDLE win_CreateThread (); +extern WIN_DWORD win_ResumeThread (); +extern WIN_DWORD win_SuspendThread (); +extern WIN_HANDLE win_GetCurrentThread (); +extern WIN_HANDLE win_GetCurrentProcess (); +extern WIN_DWORD win_WinSemTake (); +extern WIN_BOOL win_WinSemGive (); +extern WIN_BOOL win_FlushInstructionCache (); +extern void *u_malloc (); + +#endif /* __STDC__ */ + +#endif /* INCwin_Libh */ diff --git a/h/windPwrLib.h b/h/windPwrLib.h new file mode 100644 index 0000000..812782f --- /dev/null +++ b/h/windPwrLib.h @@ -0,0 +1,89 @@ +/* windPwrLib.h - Power Management header file */ + +/* Copyright 2002 - 2003 Wind River Systems, Inc */ + +/* +modification history +-------------------- +01d,19oct04,rec SPR 10255 - move POWER_MGMT_DEFAULT_MODE here + add sysCpuPwrEnable prototype +01c,06nov03,rec make WIND_PWR_DOWN_RTN void fct +01b,26jun03,rec code review comments +01a,26apr02,rec written. +*/ + +/* +* DESCRIPTION +* This header contains the datatype and prototype declarations for +* power management +*/ + +#ifndef __INCwindPwrLibh +#define __INCwindPwrLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* POWER MANAGEMENT DEFAULT MODE */ + +#ifdef INCLUDE_CPU_SLEEP_MODE_OFF +#define POWER_MGMT_DEFAULT_MODE windPwrModeOff +#elif defined INCLUDE_CPU_SLEEP_MODE_SHORT +#define POWER_MGMT_DEFAULT_MODE windPwrModeShort +#elif defined INCLUDE_CPU_SLEEP_MODE_LONG +#define POWER_MGMT_DEFAULT_MODE windPwrModeLong +#else +#define POWER_MGMT_DEFAULT_MODE windPwrModeLong +#endif /* INCLUDE_CPU_SLEEP_MODE_OFF */ + +/* +* windPwrModeShort is the CPU power mode where the CPU sleeps between +* system clock ticks but always wakes up for every tick. In other +* words, the tick interrupt source is not turned off when this CPU +* power mode is set. +* +* windPwrModeLong is the CPU power mode where the CPU sleeps for +* multiple ticks at a time or until an external interrupt wakes +* the system. With this mode, the BSP turns off the tick interrupt +* source and schedules an interrupt to occur some number of ticks +* in the future. +*/ + +typedef enum windPwrMode + { + windPwrModeOff = 0, + windPwrModeShort = 1, + windPwrModeLong = 2 + } WIND_PWR_MODE; + +typedef void (*WIND_PWR_DOWN_RTN)( WIND_PWR_MODE mode, ULONG nTicks); +typedef void (*WIND_PWR_UP_RTN)( WIND_PWR_MODE mode, ULONG * nTicks); + +/* function prototypes */ + +#ifdef __STDC__ + +extern void sysCpuPwrEnable (void); +extern void windPwrModeSet (WIND_PWR_MODE mode); +extern WIND_PWR_MODE windPwrModeGet (void); +extern void windPwrDownRtnSet (WIND_PWR_DOWN_RTN dRtn); +extern void windPwrUpRtnSet (WIND_PWR_UP_RTN uRtn); +extern void windPwrDown (void); + +#else + +extern void sysCpuPwrEnable (); +extern void windPwrModeSet (); +extern WIND_PWR_MODE windPwrModeGet (); +extern void windPwrDownRtnSet (); +extern void windPwrUpRtnSet (); +extern void windPwrDown (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwindPwrLibh */ diff --git a/h/wrProxyLib.h b/h/wrProxyLib.h new file mode 100644 index 0000000..b53c669 --- /dev/null +++ b/h/wrProxyLib.h @@ -0,0 +1,41 @@ +/* wrProxyLib.h - Wind River proxy interface header */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01b,22aug05,dbt Added TIPC support for host proxy. +01a,15apr05,dbt written +*/ + +#ifndef __INCwrProxyLibh +#define __INCwrProxyLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +void wrProxyUdpSockRegister (void); +void wrProxyTipcSockRegister (void); +#ifdef HOST +void wrProxyTcpSockRegister (void); +STATUS wrProxyLibInit (unsigned short portNumber); +#else /* HOST */ +STATUS wrProxyLibInit (UINT16 portNumber, UINT32 priority, + UINT32 stackSize, UINT32 options); +#endif /* HOST */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwrProxyLibh */ diff --git a/h/wrn/arp_if.h b/h/wrn/arp_if.h new file mode 100644 index 0000000..d694a15 --- /dev/null +++ b/h/wrn/arp_if.h @@ -0,0 +1,35 @@ +/************************************************************************/ +/* Copyright (C) 1999 RouterWare, Inc. */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Blvd. Suite 212, Newport Beach, CA */ +/************************************************************************/ +#if !defined (__ARP_IF_H__) +#define __ARP_IF_H__ +/* ************************************************************************************************************************ */ +/* ARP Interface */ +/* ************************************************************************************************************************ */ +typedef void (*FP_ARP_USER_ON_SEND_ARP_PACKET) (ARP_USER_HANDLE, RW_DEVICE_MESSAGE* p_rw_device_message); + +typedef void (*FP_ARP_USER_ON_ADDRESS_RESOLUTION) (ARP_USER_HANDLE, ARP_RESULT arp_result, IP_ADDRESS, + BYTE* p_mac_address, UINT length); + +typedef struct ARP_IF +{ + bool (*fp_arp_if_register) (struct ARP_IF*, ARP_USER_HANDLE, FP_ARP_USER_ON_ADDRESS_RESOLUTION, + FP_ARP_USER_ON_SEND_ARP_PACKET); + + enum ARP_RESULT (*fp_arp_if_get_mac_address) (struct ARP_IF*, IP_ADDRESS, BYTE* p_buffer, UINT buffer_size); + + bool (*fp_arp_if_receive) (struct ARP_IF*, RW_DEVICE_MESSAGE*); + + bool (*fp_arp_if_add_entry) (struct ARP_IF* p_arp_if, IP_ADDRESS sender_ip_address, + BYTE* p_sender_mac_address, UINT mac_address_length); + + bool (*fp_arp_if_remove_entry) (struct ARP_IF* p_arp_if, IP_ADDRESS sender_ip_address); +} ARP_IF; +/* ************************************************************************************************************************ */ +#endif /* __ARP_IF_H__ */ \ No newline at end of file diff --git a/h/wrn/bridge/bridge.h b/h/wrn/bridge/bridge.h new file mode 100644 index 0000000..2b9b240 --- /dev/null +++ b/h/wrn/bridge/bridge.h @@ -0,0 +1,47 @@ +/* bridge.h - simple learning bridge declarations */ + +/* Copyright 2000-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,21jul05,svk Increment version number for Service Pack 1 +01e,07feb05,svk Increment version number +01d,19jul04,svk Increment version number +01c,07may03,svk Add support for static mac addresses in bridge station cache +01b,17apr03,svk Implement version number, update copyright +01a,27sep00,jhl created +*/ + + +#ifndef __INCbridgeh +#define __INCbridgeh + +#ifdef __cplusplus +extern "C" { +#endif + +#define BRIDGE_VERSION "1.3.1" + +#define BRIDGE_STATIC_FLAG 0x00000001 /* Station cache entry is static */ + +IMPORT const char * bridgeVersion; + +IMPORT STATUS bridgeInit(void); +IMPORT STATUS bridgePortAdd(char* pDevName, int unitNum); +IMPORT STATUS bridgePortRemove(char* pDevName, int unitNum); +IMPORT STATUS bridgeMacAdd(char* pDevName, int unitNum, char* pMacAddr, + UINT32 flags); +IMPORT STATUS bridgeMacRemove(char* pMacAddr); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCbridgeh */ + + +/*************************************************************************** + * END OF FILE + ***************************************************************************/ + diff --git a/h/wrn/bridge/mirrorEnd.h b/h/wrn/bridge/mirrorEnd.h new file mode 100644 index 0000000..b55d9cb --- /dev/null +++ b/h/wrn/bridge/mirrorEnd.h @@ -0,0 +1,56 @@ +/* mirrorEnd.h - Mirroring END device driver declarations */ + +/* Copyright 2000-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,17apr03,svk Update copyright +01a,10oct00,jhl created +*/ + + +#ifndef __INCmirrorEndh +#define __INCmirrorEndh + + +#ifdef __cplusplus +extern "C" { +#endif + +IMPORT void mirrorEnetAddrGet (char *); + + +/* defines */ + +#define MIRROR_END_OBJ_STRING "Mirroring Enhanced Network Driver" +#define MIRROR_DEV_NAME "mirror" +#define MIRROR_DEV_NAME_LEN 7 + +#define MIRROR_STACK_UNIT_NUM 0 +#define MIRROR_BRIDGE_UNIT_NUM 1 + +#define ENDERRBLOCK 2000 /* for END_ERR_BLOCK */ + +#define MIRROR_END_ERR_UNBLOCK 0x666 +#define MIRROR_END_ERR_BLOCK 0x888 +#define MIRROR_END_ERR_BLOCK_CHECK 0x999 + + +#define MIRROR_END_ERR_BLOCK_TRUE 100 +#define MIRROR_END_ERR_BLOCK_FALSE 200 + +#define SYS_ENET_ADDR_GET(address) mirrorEnetAddrGet (address); + +#ifdef __cplusplus +} +#endif + + +#endif /* __INCmirrorEndh */ + + +/*************************************************************************** + * END OF FILE + ***************************************************************************/ + diff --git a/h/wrn/cci/cci.h b/h/wrn/cci/cci.h new file mode 100644 index 0000000..5ee9db3 --- /dev/null +++ b/h/wrn/cci/cci.h @@ -0,0 +1,2849 @@ +/* +** +** CCI STATUS definitions. +** +*/ +/* cci.h - Main CCI header file */ + +/* +Copyright (c) 2005 Wind River Systems, Inc. + +The right to copy, distribute, modify or otherwise make use +of this software may be licensed only pursuant to the terms +of an applicable Wind River license agreement. +*/ + +/* +DESCRIPTION +This file is the main include header for CCI. All relevent headers are to be referenced +from this file. +*/ + +/* +DESCRIPTION +This module implements CCI macros routines. + +INCLUDE: cci.h +*/ + + +/* +modification history +-------------------- +01a,26sep05,cdw Remapped sdLib calls +01Jun22,ralvarez - Merged multiple headers into single header. +03Apr02,ralvarez - Initial code checkin. +17Aug05,ralvarez - Added CCI_AES_XCBC_DIGESTSIZE. + +*/ +#ifndef CCI_INCLUDED +#define CCI_INCLUDED + + +#define CCI_MAJOR_VER 3 +#define CCI_MINOR_VER 1 + + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "stdio.h" /* Standard I/O header */ +#include "stdlib.h" /* Standard library header */ +#include /* variable argument header */ +#include /* string processing header */ + +/* +** --- Non-VxWorks operating system headers (BSD, WIN32, etc...) +*/ +#ifndef WIN32 +#ifndef VXWORKS +#define VXWORKS +#endif +#endif + +#ifndef VXWORKS +#include /* time structures */ +#include /* Standard Windows header(s) */ +#include /* Windows I/O definitions */ +#include /* Windows task/thread definitions */ +#include + +#define CCI_LITTLE_ENDIAN + +/* +** --- VxWorks headers +*/ +#else +#include "vxWorks.h" /* Standard vxWorks header(s) */ +#include "semLib.h" /* vxWorks semaphore header */ +#include "time.h" /* time structures */ +#include "taskLib.h" /* task/thread definitions */ + +#ifndef _BYTE_ORDER +#error '_BYTE_ORDER' macro not defined!!! +#endif + +/* +** --- For VxWorks, Check endianness of platform +*/ +#if _BYTE_ORDER == _BIG_ENDIAN +#undef CCI_LITTLE_ENDIAN +#else +#define CCI_LITTLE_ENDIAN +#endif +#endif + +#ifdef _WRS_VXWORKS_MAJOR /* Building in kernel for 6.x and above */ +#define CCI_SHAREDMEM_REGION /* Running in RTP/KERNEL share mode */ +#define CCI_ENVIRONMENT_KERNEL /* Build for kernel instance */ +#else +#ifdef _WRS_KERNEL +#define CCI_ENVIRONMENT_KERNEL /* By default, we're always running in kernel mode */ +#else /* RTP */ +#define CCI_SHAREDMEM_REGION /* Running in RTP/KERNEL share mode */ +#define CCI_ENVIRONMENT_PROCESS /* Build for RTP instance */ +#endif +#endif +/* +** --- CCI Data types +*/ +typedef void *cci_g; /* Opague binary byte stream object. */ +typedef cci_g CCISessionCtx; /* CCI Session context */ +typedef unsigned long cci_l; /* Unsigned long data type */ +typedef unsigned int cci_t; /* Unsigned integer data type */ +typedef unsigned char cci_b; /* Unsigned byte data type */ +typedef unsigned short cci_w; /* Unsigned short data type */ +typedef unsigned char *cci_z; /* NULL-terminated ASCII string object */ +typedef unsigned int CCI_CLASS_ID; /* CCI CLASS object type */ +typedef unsigned int CCI_ALGORITHM_ID; /* CCI Algorithm object type */ +typedef unsigned int CCI_ATTRIBUTE_ID; /* CCI attribute object type */ +typedef unsigned int CCI_PROVIDER_ID; /* CCI provider object type */ +typedef unsigned int cci_bool; /* Boolean TRUE=1/FALSE=0 data type */ +typedef unsigned char CCISecurityTag; /* CCI security tag */ + + +#ifndef VXWORKS +typedef HANDLE CCIMutex; /* non-vxworks Mutex object */ +typedef HANDLE CCISemaphore; /* non-vxworks Semaphire object */ +typedef HANDLE CCIEvent; /* non-vxworks Trigger/event object */ +typedef unsigned long CCITaskId; /* non-vxworks Thread/task object */ +#else +typedef SEM_ID CCIMutex; /* VxWorks Mutex object */ +typedef SEM_ID CCISemaphore; /* VxWorks Semaphire object */ +typedef SEM_ID CCIEvent; /* VxWorks Trigger/event object */ +typedef int CCITaskId; /* VxWorks Thread/task object */ +#endif + +#ifdef CCI_LIBRARY_INIT +#define _EXTERN +#else +#define _EXTERN extern +#endif + +_EXTERN CCI_PROVIDER_ID CCI_APP_PROVIDER_ID; /* Default application provider */ +_EXTERN CCI_PROVIDER_ID CCI_DEF_PROVIDER_ID; /* Default CCI provider */ +_EXTERN int (*cci_default_rng_seed_functptr)(); /* User's RNG seeding function */ + + +#define CCI_SUCCESS S_cciLib_SUCCESS +#define CCI_FAILURE S_cciLib_FAILURE + +#ifndef __max /* not implemented in VxWorks */ +#define __max(a,b) (((a) > (b)) ? (a) : (b)) +#endif +#ifndef __min /* not implemented in VxWorks */ +#define __min(a,b) (((a) < (b)) ? (a) : (b)) +#endif + + +/* +** --- GMP GNU mpz macros +*/ +typedef unsigned char mpz_bool; +#define CCI_ASYNC_IS_SUPPORTED + +#define CCI_ATTR_BIT_SET( bits, attr ) (bits[attr/32] |= (1<<(attr%32))) +#define CCI_ATTR_BIT_CLR( bits, attr ) (bits[attr/32] &=~(1<<(attr%32))) +#define CCI_IS_ATTR_BIT_SET( bits, attr ) (bits[attr/32] & (1<<(attr%32))) + +/* +** --- Control register bit masks +*/ +#define CCI_CTRL_FINAL_MSK 0x00000001 /* Finalalize context */ +#define CCI_CTRL_INIT_MSK 0x00000002 /* Initialize context */ +#define CCI_CTRL_ALGID_MSK 0x000003FC /* Algorithm ID */ +#define CCI_CTRL_CCLASS_MSK 0x00003C00 /* Crypto Class ID */ +#define CCI_CTRL_PROVID_MSK 0x0003C000 /* Provider ID */ +#define CCI_CTRL_MISSATT_MSK 0x03FC0000 /* Missing attribute */ +#define CCI_CTRL_RTP_REQ_MSK 0x04000000 /* RTP request */ +#define CCI_CTRL_KRNL_MEM_MSK 0x08000000 /* RTP w/kernel memory */ +#define CCI_CTRL_MESSAGE_MSK 0x10000000 /* RTP message to kernel */ +#define CCI_CTRL_UNUSED_MSK 0xE0000000 /* Unused bits */ + +#define CCI_CTRL_FINAL_SET( ctx ) ((ctx)->control |= CCI_CTRL_FINAL_MSK) +#define CCI_CTRL_FINAL_CLR( ctx ) ((ctx)->control &=~CCI_CTRL_FINAL_MSK) +#define CCI_IS_CTRL_FINAL_SET( ctx ) ((ctx)->control & CCI_CTRL_FINAL_MSK) +#define CCI_CTRL_INIT_SET( ctx ) ((ctx)->control |= CCI_CTRL_INIT_MSK) +#define CCI_CTRL_INIT_CLR( ctx ) ((ctx)->control &=~CCI_CTRL_INIT_MSK) +#define CCI_IS_CTRL_INIT_SET( ctx ) ((ctx)->control & CCI_CTRL_INIT_MSK) + +#define CCI_CTRL_MESSAGE_SET( ctx ) ((ctx)->control |= CCI_CTRL_MESSAGE_MSK) +#define CCI_CTRL_MESSAGE_CLR( ctx ) ((ctx)->control &=~CCI_CTRL_MESSAGE_MSK) +#define CCI_IS_CTRL_MESSAGE_SET( ctx ) ((ctx)->control & CCI_CTRL_MESSAGE_MSK) + +#define CCI_CTRL_RTP_REQ_SET( ctx ) ((ctx)->control |= CCI_CTRL_RTP_REQ_MSK) +#define CCI_CTRL_RTP_REQ_CLR( ctx ) ((ctx)->control &=~CCI_CTRL_RTP_REQ_MSK) +#define CCI_IS_CTRL_RTP_REQ_SET( ctx ) ((ctx)->control & CCI_CTRL_RTP_REQ_MSK) + +#define CCI_CTRL_KRNL_MEM_SET( ctx ) ((ctx)->control |= CCI_CTRL_KRNL_MEM_MSK) +#define CCI_CTRL_KRNL_MEM_CLR( ctx ) ((ctx)->control &=~CCI_CTRL_KRNL_MEM_MSK) +#define CCI_IS_CTRL_KRNL_MEM_SET( ctx ) ((ctx)->control & CCI_CTRL_KRNL_MEM_MSK) + + +#define CCI_CTRL_ALGID_SET( ctx, algId ) ((ctx)->control |= (CCI_CTRL_ALGID_MSK & ((int)algId<<2))) +#define CCI_CTRL_CCLASS_SET( ctx, classId ) ((ctx)->control |= (CCI_CTRL_CCLASS_MSK & ((int)classId<<10))) +#define CCI_CTRL_PROVID_SET( ctx, provId ) ((ctx)->control |= (CCI_CTRL_PROVID_MSK & ((int)provId<<14))) +#define CCI_CTRL_MISSATT_SET( ctx, missAttr ) ((ctx)->control |= (CCI_CTRL_MISSATT_MSK & ((int)missAttr<<18))) + +#define CCI_CTRL_ALGID( ctx ) ((((ctx)->control & CCI_CTRL_ALGID_MSK) >> 2)) +#define CCI_CTRL_CCLASS( ctx ) ((((ctx)->control & CCI_CTRL_CCLASS_MSK) >> 10)) +#define CCI_CTRL_PROVID( ctx ) ((((ctx)->control & CCI_CTRL_PROVID_MSK) >> 14)) +#define CCI_CTRL_MISSATT( ctx ) ((((ctx)->control & CCI_CTRL_MISSATT_MSK) >> 18)) + + +#define CCI_DEFAULT_PROVIDER ccip_default_provider +#define CCI_RNG_PROVIDER_ID( pid ) (cciIsAlgorithmSet( pid, CCI_CLASS_RNG, CCI_RNG_GENERIC ) ? pid : CCI_DEF_PROVIDER_ID) +#define CCI_IS_ATTRIBUTE_SET(ctx,attr) (CCI_IS_ATTR_BIT_SET((ctx)->attribMask, attr)) + + + +#define __iterator( a, b ) for( a = 0; a < b; a++ ) +#define _CLASS( macro ) CCI_CLASS_##macro +#define _MACRO_IN_RANGE( m, max ) ( (((int)m >= 0) && (m < max)) ? TRUE : FALSE ) +#define _TIME_SET( a ) ( a = ccip_time_ms() ) +#define _TIME_DELTA( a, b ) ( ((double)((double)(b - a) / (double)(1000))) ) +#define _ALGORITHM( c, a ) ( provider->algorithms[c][a] ) +#define _CLASS_ALGORITHM_MAX( c ) ( cryptoClassTable[c].algorithmMax ) +#define _CLASS_ATTRIBUTE_MAX( c ) ( cryptoClassTable[c].attributeMax ) +#define _CLASS_ATTRIBUTE_NAME(c,a) ( cryptoClassTable[c].attributeTable[a].name ) +#define _CLASS_ATTRIBUTE_DESC(c,a) ( cryptoClassTable[c].attributeTable[a].desc ) +#define _IS_PROVIDER_VALID( p ) \ + ( ((p < _ginstanceCtx->providerMax) && _ginstanceCtx->providerList[p]) ? TRUE : FALSE ) +#define _IS_CLASS_VALID(c) ( _MACRO_IN_RANGE( c, _CLASS( MAX ) ) ) +#define _IS_ALGORITHM_VALID(c, alg) ( _MACRO_IN_RANGE( alg, _CLASS_ALGORITHM_MAX( c ) ) ) +#define CCISUCCESS( statusCode ) ( statusCode == CCI_SUCCESS ? TRUE : FALSE ) +#define CCI_PROVIDER_NAME( p ) ( cciProviderName(p) ) +#define CCI_DEFAULT_PROVIDER_NAME "DEFAULT_PROVIDER" +#define CCI_SHOW_BUFFER( title, buffer, length )( ccip_show_buffer( title, buffer, length, 16 )); +#define CCI_IS_READY ( _ginstanceCtx!=NULL ? TRUE : FALSE ) +#define CCI_PARAM_NOT_USED(a) (a=a) + + +#ifndef VXWORKS +#define ccip_mutex_create( mtx ) ((*mtx) = ( CCIMutex )CreateMutex( 0, FALSE, 0 )) +#define ccip_mutex_lock( mtx ) (WaitForSingleObject( mtx, INFINITE )) +#define ccip_mutex_unlock( mtx ) (ReleaseMutex( mtx )) +#define ccip_mutex_destroy( mtx ) (CloseHandle( mtx )) +#define ccip_sem_create( sem, ic, max ) ((*sem) = (CCISemaphore)CreateSemaphore( 0, ic, max, NULL )) +#define ccip_sem_wait( sem ) (WaitForSingleObject(sem,INFINITE)) +#define ccip_sem_release( sem ) (ReleaseSemaphore( sem, 1, NULL )) +#define ccip_sem_destroy( sem ) (CloseHandle( sem )) +#define ccip_event_create( event ) (ccip_sem_create( event, 0, 1 )) +#define ccip_event_wait( event ) (ccip_sem_wait( event )) +#define ccip_event_release( event ) (ccip_sem_release( event )) +#define ccip_event_destroy( event ) (ccip_sem_destroy( event )) +#define ccip_task_create( tid, name, pri, funct, args ) ((*tid) = ( CCITaskId )_beginthread( funct, 0, args )) +#define ccip_task_exists( name ) (0) +#define ccip_task_delete( taskId ) +#else +#define ccip_mutex_create( mtx ) ((*mtx) = ( CCIMutex )semBCreate( SEM_Q_FIFO, SEM_FULL )) +#define ccip_mutex_lock( mtx ) (semTake(mtx,WAIT_FOREVER )) +#define ccip_mutex_unlock( mtx ) (semGive( mtx )) +#define ccip_mutex_destroy( mtx ) (semDelete( mtx )) +#define ccip_sem_create( sem, ic, max ) ((*sem) = (CCISemaphore)semCCreate( 0, ic )) +#define ccip_sem_wait( sem ) (semTake( sem, WAIT_FOREVER )) +#define ccip_sem_release( sem ) (semGive( sem )) +#define ccip_sem_destroy( sem ) (semDelete( sem )) +#define ccip_event_create( event ) ((*event) = ( CCIEvent )semBCreate( SEM_Q_FIFO, SEM_EMPTY )) +#define ccip_event_wait( event ) (semTake( event, WAIT_FOREVER )) +#define ccip_event_release( event ) (semGive( event )) +#define ccip_event_destroy( event ) (semDelete( event )) +#define ccip_task_create( tid, name, pri, funct, args ) ((*tid) = ( CCITaskId )taskSpawn( name, pri, 0, 20000, (FUNCPTR) funct, (int)args, (int)NULL,(int)NULL,(int)NULL,(int)NULL,(int)NULL,(int)NULL,(int)NULL,(int)NULL,(int)NULL )) +#define ccip_task_exists( name ) ((taskNameToId( name ) == ERROR) ? 0:1 ) +#define ccip_task_delete( taskId ) (taskDelete(taskId)) +#endif + +#define ccip_zero( memblock, size ) (memset( memblock, 0, size )) + + +/* +** --- Public interface macros +*/ + +/******************************************************************************* +* +* cciCtxAlgorithmId - Get algorithm type (macro). +* +* Returns algorithm identifier (CCI_CIPHER_DES, CCI_HASH_SHA1, etc... ) that +* is associated with a CCIContext object. +* +* SYNOPSIS: +* \cs +* CCI_ALGORITHM_ID cciCtxAlgorithmId +* ( +* CCIContext ctx // CCIContext object +* ) +* \ce +* +* Parameters: +* \is +* \i +* CCIContext object that was created with cciCtxCreate(). +* +* \ie +* +* RETURNS: Returns identifier of algorithm. Identifier returned depends on crypto +* class of the CCIContext. +* +* ERRNO: N/A +* +* +* EXAMPLE: +* \cs +* // +* // --- Show how to determine algorithm type from a CCIContext. +* // +* void some_function( CCIContext ctx ) +* { +* CCI_ALGORITHM_ID algorithmId; +* +* // +* // --- Make decision based on algorithm type... +* // +* algorithmId = cciCtxAlgorithmId( ctx ); +* if ( algorithmId == CCI_CIPHER_3DES ) +* { +* ...... +* } +* } +* \ce +* SEE ALSO: cciCtxProviderId(), cciCtxClassId() +* +*/ +#define cciCtxAlgorithmId( ctx ) (CCI_CTRL_ALGID( ctx )) + + +/******************************************************************************* +* +* cciCtxClassId - Get crypto class (macro). +* +* Returns crypto class identifier (CCI_CLASS_CIPHER, CCI_CLASS_HASH, etc... ) +* that is associated with a CCIContext object. +* +* SYNOPSIS: +* \cs +* CCI_CLASS_ID cciCtxClassId +* ( +* CCIContext ctx // CCIContext object +* ) +* \ce +* +* Parameters: +* \is +* \i +* CCIContext object that was created with cciCtxCreate(). +* +* \ie +* +* RETURNS: Returns CCI crypto class identifier. Possible values are +* CCI_CLASS_CIPHER, CCI_CLASS_HASH, CCI_CLASS_HMAC, CCI_CLASS_PUBLICKEY, +* CCI_CLASS_RNG and CCI_CLASS_COMPRESSION. +* +* ERRNO: N/A +* +* EXAMPLE: +* \cs +* // +* // --- Show how to determine the CCI_CLASS of a CCIContext. +* // +* void some_function( CCIContext ctx ) +* { +* CCI_CLASS_ID classId; +* +* // +* // --- Check ''class'' of request... +* // +* classId = cciCtxClassId( ctx ); +* if ( classId == CCI_CLASS_HMAC ) +* { +* ...... +* } +* } +* \ce +* SEE ALSO: cciCtxProviderId(), cciCtxAlgorithmId() +* +*/ +#define cciCtxClassId( ctx ) (CCI_CTRL_CCLASS( ctx )) + + +/******************************************************************************* +* +* cciCtxProviderId - Get provider Id (macro). +* +* Returns crypto provider identifier that is associated with a CCIContext. By +* default, there are at least two possible values that cciCtxProviderId() +* may return: +* +* CCI_DEF_PROVIDER_ID -- Default software provider module. +* CCI_APP_PROVIDER_ID -- Provider IDE selected by application +* +* Other values may be returned if three or more providers are loaded +* simultaneously. +* +* SYNOPSIS: +* \cs +* CCI_PROVIDER_ID cciCtxProviderId +* ( +* CCIContext ctx // CCIContext object +* ) +* \ce +* +* Parameters: +* \is +* \i +* CCIContext object that was created with cciCtxCreate(). +* +* \ie +* +* RETURNS: Returns identifier of provider. +* +* ERRNO: N/A +* +* EXAMPLE: +* \cs +* // +* // --- Show how to get the provider Id from a CCIContext. +* // +* void some_function( CCIContext ctx ) +* { +* CCI_PROVIDER_ID providerId; +* +* providerId = cciCtxProviderId( ctx ); +* if ( providerId == CCI_DEF_PROVIDER_ID ) +* { +* ...... +* } +* } +* \ce +* SEE ALSO: cciCtxAlgorithmId(), cciCtxClassId() +* +*/ +#define cciCtxProviderId( ctx ) (CCI_CTRL_PROVID( ctx )) + +/******************************************************************************* +* +* cciCtxIsAttrSet - Check attribute status (macro). +* +* Returns boolean indication if specified atttribute has been set in +* CCIContext object. +* +* SYNOPSIS: +* \cs +* BOOL cciCtxIsAttrSet +* ( +* CCIContext ctx, // CCIContext object +* CCI_ATTRIBUTE_ID id // attribute identifier +* ) +* \ce +* +* Parameters: +* \is +* \i +* CCIContext object that was created with cciCtxCreate(). +* +* \i +* Identifier of attribute that is to be checked. The attribute id value is +* dependant on the type of CCIContext object. +* +* \ie +* +* RETURNS: Returns TRUE if attribute is set, Otherwise, FALSE. +* +* ERRNO: N/A +* +* EXAMPLE: +* \cs +* // +* // --- Show how to check if attribute is set in a CCIContext. +* // +* void some_function( CCIContext ctx ) +* { +* if (cciCtxIsAttrSet( ctx, CCI_CIPHER_BLOCK_SIZE )) +* cciCtxAttrClr( ctx, CCI_CIPHER_BLOCK_SIZE ); +* } +* \ce +* SEE ALSO: cciCtxAttrClr(), cciCtxAttrGet(), cciCtxAttrSet() +* +*/ +#define cciCtxIsAttrSet(ctx,attr) (CCI_IS_ATTRIBUTE_SET(ctx,attr)) + +/******************************************************************************* +* +* cciCtxAttrClr - Clear attribute (macro). +* +* If set, clears specified attribute in CCIContext object. +* +* SYNOPSIS: +* \cs +* void cciCtxAttrClr +* ( +* CCIContext ctx, // CCIContext object +* CCI_ATTRIBUTE_ID id // attribute identifier +* ) +* \ce +* +* Parameters: +* \is +* \i +* CCIContext object that was created with cciCtxCreate(). +* +* \i +* Identifier of attribute. +* +* \ie +* +* RETURNS: N/A +* +* ERRNO: N/A +* +* EXAMPLE: +* \cs +* // +* // --- Show how to clear attribute flag in CCIContext. +* // +* void some_function( CCIContext ctx ) +* { +* if (cciCtxIsAttrSet( ctx, CCI_CIPHER_BLOCK_SIZE )) +* cciCtxAttrClr( ctx, CCI_CIPHER_BLOCK_SIZE ); +* } +* \ce +* SEE ALSO: cciCtxIsAttrSet(), cciCtxAttrGet(), cciCtxAttrSet() +* +*/ +#define cciCtxAttrClr( ctx, attr ) {(ctx)->attributes[attr] = (void *)NULL;(CCI_ATTR_BIT_CLR((ctx)->attribMask, attr));} + +/******************************************************************************* +* +* cciCtxAttrGet - Get attribute value (macro). +* +* Retrieve attribute value from CCIContext. The value parameter MUST be the +* address of a variable. +* +* SYNOPSIS: +* +* \cs +* cci_st cciCtxAttrGet +* ( +* CCIContext ctx, // CCIContext object +* CCI_ATTRIBUTE_ID id, // attribute identifier +* void *value // output variable +* ) +* \ce +* +* Parameters: +* \is +* \i +* CCIContext object that was created with cciCtxCreate(). +* +* \i +* Identifier of attribute. +* +* \i +* Address of variable where value is to be set into. +* +* \ie +* +* RETURNS: CCI_SUCCESS if attribute value was successfully retrieved. +* Otherwise, CCI_FAILURE. +* +* ERRNO: N/A +* +* EXAMPLE: +* \cs +* // +* // --- Show how to get attribute from CCIContext object. +* // +* void some_function( CCIContext ctx ) +* { +* CCI_CLASS_ID classId; +* cci_b *cipherKey; +* cci_t cipherKeyLength, cryptoMode; +* +* // +* // --- Check 'class' of request... +* // +* classId = cciCtxClassId( ctx ); +* if ( classId == CCI_CLASS_CIPHER ) +* { +* cciCtxAttrGet( ctx, CCI_CIPHER_KEY, &cipherKey ); +* cciCtxAttrGet( ctx, CCI_CIPHER_KEY_LENGTH, &cipherKeyLength ); +* cciCtxAttrGet( ctx, CCI_CIPHER_MODE, &cryptoMode ); +* } +* } +* \ce +* SEE ALSO: cciCtxIsAttrSet(), cciCtxAttrClr(), cciCtxAttrSet() +* +*/ +#define cciCtxAttrGet( ctx, attr, value ) (ccip_ctx_get_attr( ctx, attr, (void *)value )) + +/******************************************************************************* +* +* cciCtxAttrSet - Set attribute value (macro). +* +* Set attribute value into CCIContext. All attribute values MUST be passed +* in by value. +* +* SYNOPSIS: +* \cs +* void cciCtxAttrSet +* ( +* CCIContext ctx, // CCIContext object +* CCI_ATTRIBUTE_ID id, // attribute identifier +* cci_t value // attribute value to set +* ) +* \ce +* +* Parameters: +* \is +* \i +* CCIContext object that was created with cciCtxCreate(). +* +* \i +* Identifier of attribute. +* +* \i <'type-specific' value> +* Variable that is associated with attribute id. +* +* \ie +* +* RETURNS: N/A +* +* ERRNO: N/A +* +* EXAMPLE: +* \cs +* // +* // --- Show how to set attribute value in CCIContext object. +* // +* void some_function( CCIContext ctx ) +* { +* CCI_CLASS_ID classId; +* cci_b plaintText[100]; +* cci_t plaintTextLength = sizeof(plaintText); +* +* // +* // --- Check 'class' of request... +* // +* classId = cciCtxClassId( ctx ); +* if ( classId == CCI_CLASS_CIPHER ) +* { +* cciCtxAttrSet( ctx, CCI_INPUT_BUFFER, plaintText ); +* cciCtxAttrSet( ctx, CCI_INPUT_LENGTH, plaintTextLength ); +* } +* } +* \ce +* SEE ALSO: cciCtxAttrGet(), cciCtxAttrClr(), cciCtxIsAttrSet() +* +*/ +#define cciCtxAttrSet( ctx, attr, val) {(ctx)->attributes[attr] = (void *)val;(CCI_ATTR_BIT_SET((ctx)->attribMask, attr));} + + +/******************************************************************************* +* +* cciCtxInputGet - Get input buffer data and length (macro). +* +* Retrieve input buffer address and length information from CCIContext. +* Addresses of both 'buffer' and 'bufferLength' variables MUST be passed. +* +* Using cciCtxInputGet() has the same effect as using cciCtxAttrGet() to get +* the input buffer and lenth attribute values. +* +* SYNOPSIS: +* \cs +* void cciCtxInputGet +* ( +* CCIContext ctx, // CCIContext object +* void **buffer, // Address of pointer variable +* cci_t *bufferLength // Address of length variable +* ) +* \ce +* +* \cs +* void some_function( CCIContext ctx ) +* { +* cci_b *plaintText; +* cci_t plaintTextLength; +* +* cciCtxAttrGet( ctx, CCI_INPUT_BUFFER, &plaintText ); +* cciCtxAttrGet( ctx, CCI_INPUT_LENGTH, &plaintTextLength ); +* } +* \ce +* Parameters: +* \is +* \i +* CCIContext object that was created with cciCtxCreate(). +* +* \i +* Address of pointer variable. +* +* \i +* Address of length variable. +* +* \ie +* +* RETURNS: N/A +* +* ERRNO: N/A +* +* EXAMPLE: +* \cs +* // +* // --- Show how to determine length of message digest. +* // +* void some_function( CCIContext ctx ) +* { +* CCI_CLASS_ID classId; +* cci_b *plaintText; +* cci_t plaintTextLength; +* +* // +* // --- Check class of request... +* // +* classId = cciCtxClassId( ctx ); +* if ( classId == CCI_CLASS_CIPHER ) +* { +* cciCtxInputGet( ctx, &plaintText, &plaintTextLength ); +* +* // +* // --- Process request using plaintText and plaintTextLength information +* // +* .... +* } +* } +* \ce +* SEE ALSO: cciCtxAttrGet(), cciCtxOutputGet() +* +*/ +#define cciCtxInputGet( ctx, buffer, bufferLength ) {cciCtxAttrGet( ctx, CCI_INPUT_BUFFER, buffer );cciCtxAttrGet( ctx, CCI_INPUT_LENGTH, bufferLength );} + + +/******************************************************************************* +* +* cciCtxOutputGet - Get output buffer data and length (macro). +* +* Retrieve output buffer and buffer length data from CCIContext. Addresses of +* both 'buffer' and 'bufferLength' variables MUST be passed. +* +* Using cciCtxOutputGet() has the same effect as using cciCtxAttrGet() to get +* the output buffer and lenth attribute values. +* \cs +* void some_function( CCIContext ctx ) +* { +* cci_b *cipherText; +* cci_t cipherTextLength; +* +* cciCtxAttrGet( ctx, CCI_OUTPUT_BUFFER, &cipherText ); +* cciCtxAttrGet( ctx, CCI_OUTPUT_LENGTH, &cipherTextLength ); +* } +* \ce +* +* SYNOPSIS: +* \cs +* void cciCtxOutputGet +* ( +* CCIContext ctx, // CCIContext object +* void **buffer, // Address of pointer variable +* cci_t *bufferLength // Address of length variable +* ) +* \ce +* +* Parameters: +* \is +* \i +* CCIContext object that was created with cciCtxCreate(). +* +* \i +* Address of pointer variable. +* +* \i +* Address of length variable. +* +* \ie +* RETURNS: N/A +* +* ERRNO: N/A +* +* EXAMPLE: +* \cs +* // +* // --- Show how extract output buffer data from CCIContext object. +* // +* void some_function( CCIContext ctx ) +* { +* CCI_CLASS_ID classId; +* cci_b *cipherText; +* cci_t cipherTextLength; +* +* // +* // --- Check class of request... +* // +* classId = cciCtxClassId( ctx ); +* if ( classId == CCI_CLASS_CIPHER ) +* { +* // +* // --- Get processed cipher text.... +* // +* cciCtxOutputGet( ctx, &cipherText, &cipherTextLength ); +* } +* } +* \ce +* SEE ALSO: cciCtxAttrGet(), cciCtxOutputGet() +* +*/ +#define cciCtxOutputGet( ctx, buffer, bufferLength ) {cciCtxAttrGet( ctx, CCI_OUTPUT_BUFFER, buffer );cciCtxAttrGet( ctx, CCI_OUTPUT_LENGTH, bufferLength );} + + + +/******************************************************************************* +* +* cciCtxMissingAttrSet - Set missing attribute identifier (macro). +* +* Set missing attribute identifier in CCIContext. This function is used by a +* CPI provider module to inform the application that a required attribute was +* not set in the CCIContext crypto request. In order for the application to know +* to use this function, the CPI module must return +* an 'S_cciLib_MISSING_ATTRIBUTE' error. +* +* SYNOPSIS: +* \cs +* void cciCtxMissingAttrSet +* ( +* CCIContext ctx, // CCIContext object +* CCI_ATTRIBUTE_ID attributeId // Identifier of attribute +* ) +* \ce +* +* Parameters: +* \is +* \i +* CCIContext object that was created with cciCtxCreate(). +* +* \i +* Identifier of attribute. +* +* \ie +* +* RETURNS: N/A +* +* ERRNO: N/A +* +* EXAMPLE: +* \cs +* // +* // --- Show how to set missing attribute in CCIContext object. +* // +* cci_st some_function( CCIContext ctx ) +* { +* CCI_CLASS_ID classId; +* cci_b *cipherKey; +* cci_t cipherKeyLength, cryptoMode; +* cci_st cciStatus; +* +* classId = cciCtxClassId( ctx ); +* if ( classId == CCI_CLASS_CIPHER ) +* { +* // +* // --- Make sure CCI_CIPHER_KEY attribute is set. +* // +* cciStatus = cciCtxAttrGet( ctx, CCI_CIPHER_KEY, &cipherKey ); +* if ( cciStatus != CCI_SUCCESS ) +* { +* // +* // --- Notify application that CCI_CIPHER_KEY attribute was not set. +* // +* cciCtxMissingAttrSet( ctx, CCI_CIPHER_KEY ); +* return( S_cciLib_MISSING_ATTRIBUTE ); +* } +* } +* } +* \ce +* SEE ALSO: cciCtxMissingAttrGet() +* +*/ +#define cciCtxMissingAttrSet( ctx, attrId ) (CCI_CTRL_MISSATT_SET( ctx, attrId )) + + +/******************************************************************************* +* +* cciCtxMissingAttrGet - Get missing attribute identifier (macro). +* +* Get missing attribute from CCIContext. When a crypto request returns +* a 'S_cciLib_MISSING_ATTRIBUTE', use the 'cciCtxMissingAttrGet' to retrieve +* the ordinal value of the missing attribute. +* +* SYNOPSIS: +* \cs +* CCI_ATTRIBUTE_ID cciCtxMissingAttrGet +* ( +* CCIContext ctx // CCIContext object +* ) +* \ce + +* Parameters: +* \is +* \i +* CCIContext object that was created with cciCtxCreate(). +* +* \ie +* RETURNS: Identifier of missing attribute. +* +* ERRNO: N/A +* +* EXAMPLE: +* \cs +* // +* // --- Show how to get missing attribute from CCIContext object. +* // +* cci_st some_function( CCIContext ctx ) +* { +* CCI_ATTRIBUTE_ID attrId; +* cci_st cciStatus; +* +* cciStatus = cciCipher( ctx, ... ); +* if ( cciStatus == S_cciLib_MISSING_ATTRIBUTE ) +* { +* // +* // --- Oooops, forget to set required attribute. +* // +* attrId = cciCtxMissingAttrGet( ctx ); +* printf("Missing '%u' attribute in cipher request\n", attrId ); +* return( CCI_FAILURE ); +* } +* } +* \ce +* SEE ALSO: cciCtxMissingAttrSet() +* +*/ +#define cciCtxMissingAttrGet( ctx ) (CCI_CTRL_MISSATT( ctx )) + + +/******************************************************************************* +* +* cciProviderAttrSet - Set provider parameter (macro). +* +* Set provider-specific parameter into CCIProvider. Possible values include: +* +* CCI_PVR_SOFTWARE_DEFAULT -- Use default s/w algorithms +* CCI_PVR_SECURITY_PUBLIC_KEY -- Provider verification private key +* CCI_PVR_SECURITY_SIGNATURE -- Provider signature used for verification +* CCI_PVR_SECURITY_SIGNATURE_LEN -- Provider signature length +* CCI_PVR_SECURITY_TAG_TABLE -- Security tag table +* +* SYNOPSIS: +* \cs +* void cciProviderAttrSet +* ( +* CCIProvider provider, // CCIProvider object +* CCI_PROVIDER_PARAM attributeId, // Identifier of parameter +* cci_t value // Parameter value to be set +* ) +* \ce +* +* Parameters: +* \is +* \i +* CCIProvider object. +* +* \i +* Identifier of parameter. +* +* \i <'type-specific' value> +* Variable that is associated with parameter id. +* +* \ie +* +* RETURNS: N/A +* +* ERRNO: N/A +* +* EXAMPLE: +* \cs +* // +* // --- Create Provider Export Module. +* // +* CCIProvider Mpc190ExportCCIProvider( void ) +* { +* CCIProvider Mpc190Provider = ( CCIProvider ) NULL; +* cci_st cciStatus; +* +* // +* // --- Create CCIProvider object for MPC190 Security Processor +* // +* cciStatus = cciProviderCreate( &Mpc190Provider, MPC190_PROVIDER_NAME, +* mpc190ProviderInit, mpc190ProviderUninit ); +* if( CCISUCCESS( cciStatus ) ) +* { +* +* // +* // --- Create public key that reference RSA public key. +* // +* cciPKIKeyCreate( CCI_DEF_PROVIDER_ID, CCI_RSA_PUBLIC_KEY, &publicKey ); +* cciPKIKeyCompSet( publicKey, CCI_RSA_PUBLIC_EXPONENT, cci_public_key_e, +* sizeof(cci_public_key_e)); +* cciPKIKeyCompSet( publicKey, CCI_RSA_MODULAS, cci_public_key_n, +* sizeof(cci_public_key_n)); +* +* // +* // --- Register CPI Digital Signature (provider by WRS) +* // +* cciProviderAttrSet( Mpc190Provider, CCI_PVR_SECURITY_SIGNATURE, +* cci_provider_signature ); +* cciProviderAttrSet( Mpc190Provider, CCI_PVR_SECURITY_SIGNATURE_LEN, 256 ); +* cciProviderAttrSet( Mpc190Provider, CCI_PVR_SECURITY_PUBLIC_KEY, +* publicKey ); +* cciProviderAttrSet( Mpc190Provider, CCI_PVR_SECURITY_TAG_TABLE, +* security_tag_table ); +* +* // +* // --- Create CCIAlgorithm object, set required attributes and default +* // values, set processing handler and register with CCIProvider +* // object. +* // +* cciStatus = cciAlgorithmCreate( &algorithm, CCI_CLASS_CIPHER, +* CCI_CIPHER_DES ); +* if( CCISUCCESS( cciStatus ) ) +* { +* // +* // --- Set required attributes and default values. +* // +* cciAlgorithmAttrSet( algorithm, CCI_ASYNC_SUPPORT, TRUE ); +* cciAlgorithmAttrSet( algorithm, CCI_CIPHER_OPERATION, NULL ); +* cciAlgorithmAttrSet( algorithm, CCI_CIPHER_MODE, CCI_MODE_CBC ); +* cciAlgorithmAttrSet( algorithm, CCI_CIPHER_KEY, NULL ); +* cciAlgorithmAttrSet( algorithm, CCI_CIPHER_KEY_LENGTH, 8 ); +* cciAlgorithmAttrSet( algorithm, CCI_CIPHER_IV, NULL ); +* cciAlgorithmAttrSet( algorithm, CCI_CIPHER_IV_LENGTH, 8 ); +* +* // +* // --- Set processing handler... +* // +* cciAlgorithmHandlerSet( algorithm, CCI_HANDLER_SESSION, +* mpc190_handler_des ); +* +* // +* // --- Add CCIAlgorithm object to CCIProvider object. +* // +* cciProviderAlgorithmSet( Mpc190Provider, algorithm ); +* } +* } +* +* return( Mpc190Provider ); +* } +* \ce +* SEE ALSO: cciProviderAttrGet() +* +*/ +#define cciProviderAttrSet(provider,attribute,value) (ccip_pvr_set_param(provider, attribute, (cci_g)value)) + +/******************************************************************************* +* +* cciProviderAttrGet - Get parameter value (macro). +* +* Get value for parameter set in CCIProvider object. +* +* SYNOPSIS: +* \cs +* void cciProviderAttrGet +* ( +* CCIProvider provider, // CCIProvider object +* CCI_PROVIDER_PARAM attributeId, // Identifier of parameter +* void *value // Parameter value to be set +* ) +* \ce +* +* Parameters: +* \is +* \i +* CCIProvider object. +* +* \i +* Identifier of parameter. +* +* \i <'type-specific' *value> +* Address of variable that is associated with parameter id. +* +* \ie +* +* RETURNS: N/A +* +* ERRNO: N/A +* +* EXAMPLE: +* \cs +* // +* // --- Show how to extract attribute information from CCIProvider object. +* // +* cci_st some_function( CCIContext ctx ) +* { +* CCIProvider upkiExportCCIProvider( void ); +* CCIProvider upkiProvider = ( CCIProvider ) NULL; +* cci_st cciStatus; +* BOOL useSoftwareDefault; +* +* upkiProvider = upkiExportCCIProvider(); +* +* // +* // --- Check is provider uses default algorithms. +* // +* cciStatus = cciProviderAttrGet( upkiProvider, +* CCI_PVR_SOFTWARE_DEFAULT, &useSoftwareDefault ); +* if ( useSoftwareDefault == TRUE ) +* printf("Provider is using default software algorithms\n"); +* } +* \ce +* SEE ALSO: cciProviderAttrSet() +* +*/ +#define cciProviderAttrGet(provider,attribute,value) (ccip_pvr_get_param(provider, attribute, (cci_g *)value)) + + +/******************************************************************************* +* +* cciAlgorithmAttrSet - Set algorithm attribute (macro). +* +* Set algorithm-specific attribute. Setting of attributes in a CCIAlgorithm +* object define what attributes will be needed by the CCIContext object for +* that algorithm. In other words, attributes defined in the CCIAlgorithm object +* in the Provider Export Module determine what attributes will need to be set +* by the application for that particular crypto request.Values passed in will +* be inherited by the CCIContext object when it's created. +* +* Algorithm identifier values are determined by the CCI_CLASS used in +* cciAlgorithmCreate(). +* +* CCI_CLASS_CIPHER Attributes +* -------------------------------- +* CCI_CIPHER_OPERATION -- Direction of operation (CCI_ENCRYPT or CCI_DECRYPT). +* CCI_CIPHER_KEY -- Key used en/decryption operation. +* CCI_CIPHER_KEY_LENGTH -- Length of en/decryption key. +* CCI_CIPHER_MODE -- Cipher mode (CCI_MODE_ECB, CCI_MODE_CBC, etc...) +* CCI_CIPHER_IV -- Initialization Vector (IV) +* CCI_CIPHER_IV_LENGTH -- IV Length. +* CCI_CIPHER_BLOCK_SIZE -- Cipher Block Size. +* +* +* CCI_CLASS_HASH Attributes +* -------------------------------- +* CCI_HASH_DIGEST -- Buffer where message digest will be placed. +* CCI_HASH_DIGEST_LENGTH --- Length of allocated buffer. Value passed by reference. +* +* +* CCI_CLASS_HMAC Attributes +* -------------------------------- +* CCI_HMAC_KEY -- MAC Key. +* CCI_HMAC_KEY_LENGTH -- Length of MAC key. +* CCI_HMAC_TRUNCATE -- Truncate output digest to this length. +* CCI_HMAC_DIGEST -- Buffer where message digest will be placed. +* CCI_HMAC_DIGEST_LENGTH -- Length of allocated buffer. Value passed by reference. +* CCI_HMAC_BUFFER_PADDED -- Boolean value indicating if input buffer is padded or not. +* +* +* CCI_CLASS_RNG Attributes +* -------------------------------- +* CCI_RNG_BUFFER -- Buffer where random bytes will be placed. +* CCI_RNG_NUM_BYTES --- Number of random bytes to add to buffer. +* +* +* SYNOPSIS: +* \cs +* cci_st cciProviderAttrSet +* ( +* CCIAlgorithm algorithm, // CCIAlgorithm object +* CCI_ATTRIBUTE_ID attributeId, // Identifier of attribute +* cci_t value // Attribute value to be set +* ) +* \ce +* +* Parameters: +* \is +* \i +* CCIAlgorithm object. +* +* \i +* Identifier of attribute. +* +* \i <'type-specific' value> +* variable that is associated with attribute id. +* +* \ie +* RETURNS: CCI_SUCCESS, if successful, Otherwise, CCI_FAILURE. +* +* ERRNO: N/A +* +* EXAMPLE: +* \cs +* // +* // --- This code shows how an CCIAlgorithm object is created and is added +* // to a CCIProvider object. +* // +* CCIProvider Mpc190ExportCCIProvider( void ) +* { +* CCIProvider Mpc190Provider = ( CCIProvider ) NULL; +* CCIAlgorithm algorithm; +* +* // +* // --- Create CCIAlgorithm object, set required attributes and +* // default values, set processing handler and register with +* // CCIProvider object. +* // +* cciStatus = cciAlgorithmCreate( &algorithm, CCI_CLASS_CIPHER, +* CCI_CIPHER_DES ); +* if( CCISUCCESS( cciStatus ) ) +* { +* // +* // --- Set required attributes and default values. +* // +* cciAlgorithmAttrSet( algorithm, CCI_ASYNC_SUPPORT, TRUE ); +* cciAlgorithmAttrSet( algorithm, CCI_CIPHER_OPERATION, NULL ); +* cciAlgorithmAttrSet( algorithm, CCI_CIPHER_MODE, CCI_MODE_CBC ); +* cciAlgorithmAttrSet( algorithm, CCI_CIPHER_KEY, NULL ); +* cciAlgorithmAttrSet( algorithm, CCI_CIPHER_KEY_LENGTH, 8 ); +* cciAlgorithmAttrSet( algorithm, CCI_CIPHER_IV, NULL ); +* cciAlgorithmAttrSet( algorithm, CCI_CIPHER_IV_LENGTH, 8 ); +* +* // +* // --- Set processing handler... +* // +* cciAlgorithmHandlerSet( algorithm, CCI_HANDLER_SESSION, +* mpc190_handler_des ); +* +* // +* // --- Add algorithm object to provider object. +* // +* cciProviderAlgorithmSet( Mpc190Provider, algorithm ); +* } +* } +* \ce +* SEE ALSO: cciAlgorithmCreate(), cciAlgorithmHandlerSet(), cciProviderAlgorithmSet() +* +*/ +#define cciAlgorithmAttrSet( algorithmObject, attribute, value) (ccip_algorithm_set_attr( algorithmObject, attribute, (void *)value )) + + +/******************************************************************************* +* +* cciCtxIsAsyncReq - Check processing mode. +* +* Use this function in a CPI session handler to check if a CCIContext object +* is being submitted asynchronously or synchronously. Asynchronous requests +* do not block the calling application while synchronous requests do. If the +* device does not support non-blocking (asynchronous) operations this function +* need not be used --- in which case, all requests should be treated as +* blocking (synchronous) operations. +* +* SYNOPSIS: +* \cs +* BOOL cciCtxIsAsyncReq +* ( +* CCIContext cciContext // CCIContext object +* ) +* \ce +* +* Parameters: +* \is +* \i +* CCIContext object that was created with cciCtxCreate(). +* +* \ie +* +* RETURNS: TRUE, if request is non-blocking, Otherwise, FALSE if request +* is blocking. +* +* ERRNO: N/A +* +* EXAMPLE: +* +* \cs +* // +* // --- DES and 3DES session handler +* // +* cci_st myDesSessionHandler( CCIContext ctx ) +* { +* DeviceStatus devStatus; +* +* // +* // --- Extract attribute value data here... +* // +* cciCtxAttrGet( ctx, ... ); +* cciCtxAttrGet( ctx, ... ); +* cciCtxAttrGet( ctx, ... ); +* +* // +* // --- Submit crypto request to device. Since device accepts asynchronous +* // requests (by use of callback functions), the DeviceCipherOp() call +* // will NOT block. When processing is complete, the device will execute +* // the 'myDesCompletionCallback' callback. +* // +* if ( cciCtxIsAsyncReq( ctx ) ) +* devStatus = DeviceCipherOp(..., myDesCompletionCallback, ctx ); +* // +* // --- Otherwise, submit synchronous (blocking) request. +* // +* else +* devStatus = DeviceCipherOp(..., NULL, NULL ); +* } +* \ce +* +* SEE ALSO: cciCtxAsyncStatus() +* +*/ +#define cciCtxIsAsyncReq(ctx) (CCI_IS_ATTRIBUTE_SET(ctx,CCI_ASYNC_REQUEST) && CCI_IS_ATTRIBUTE_SET(ctx,CCI_ASYNC_SUPPORT)) + +/******************************************************************************* +* +* cciCtxSessionCtxSet - Set user-defined state information (macro). +* +* Use this function in a CPI session handler to set user-specific state +* information into a CCIContext object. +* +* SYNOPSIS: +* \cs +* void cciCtxSessionCtxSet +* ( +* CCIContext cciContext, // CCIContext object +* void *stateCtx // Address of user-defined object that is to be stored in CCIContext object +* ) +* \ce +* +* Parameters: +* \is +* \i +* CCIContext object that was created with cciCtxCreate(). +* +* \i +* Address of user-defined object that is to be stored in CCIContext object. +* +* \ie +* +* RETURNS: N/A +* +* ERRNO: N/A +* +* +* SEE ALSO: cciCtxSessionCtxGet() +* +*/ +#define cciCtxSessionCtxSet( ctx, stateCtx ) ( (ctx)->attributes[CCI_SESSION_CTX] = (cci_b *) stateCtx ) + +/******************************************************************************* +* +* cciCtxSessionCtxGet - Get user-defined state information. +* +* Use this function in a CPI session handler to get user-definedstate +* information from a CCIContext object. +* +* SYNOPSIS: +* \cs +* void * cciCtxSessionCtxSet +* ( +* CCIContext cciContext // CCIContext object +* ) +* \ce +* +* Parameters: +* \is +* \i +* CCIContext object that was created with cciCtxCreate(). +* +* \ie +* +* RETURNS: Pointer to state information object set with 'cciCtxSessionCtxSet'(). +* +* ERRNO: N/A +* +* +* SEE ALSO: cciCtxSessionCtxSet() +* +*/ +#define cciCtxSessionCtxGet( ctx ) ((ctx)->attributes[CCI_SESSION_CTX]) + + + +/******************************************************************************* +* +* cciPoolCreate - Create resource pool. +* +* Use this function to create a resource pool of user-defined elements. The +* resource pool routines 'cciPoolCreate()', 'cciPoolAlloc()', 'cciPoolRelease()' +* and 'cciPoolDestroy()' are used to pre-allocate a fixed-number of data +* structures that could be retrieved ad hoc by the application. Since only a +* fixed number of pool elements are available for use at any given time, the +* application can be ensured that excessive memory allocations are not done. The +* memory for each data structure, or pool element, is pre-allocated at +* initialization time with a call to cciPoolCreatet(). At runtime, rather than +* having to allocate a new memory-block via a malloc() or calloc() call, the +* application can just allocate a pool element with the cciPoolAlloc() routine, +* use it, and then return it to the free pool with a call to cciPoolRelease(). +* When the resource pool is no longer needed, the application should free it +* with a call to cciPoolDestroy(). +* +* SYNOPSIS: +* \cs +* cci_st cciPoolCreate +* ( +* CCIPool *pool, // Address to an uninstantiated CCIPool object +* cci_t elementSize, // Size of each element in the pool +* cci_t poolSize, // Number of initial elements in the pool +* cci_t poolMax // Maximum number of elements in the pool +* ) +* \ce +* +* +* Parameters: +* \is +* \i +* Address to an uninstantiated CCIPool object. +* +* \i +* The size of each element in the pool. +* +* \i +* The number of initial elements in the pool. +* +* \i +* The maximum number of elements that the pool can contain. If the number of +* pool elements is increased beyond the initial pool size, the pool will be +* automatically reduced back to the initial size when the number of free +* elements equals 'poolMax'. +* +* \ie +* +* RETURNS: CCI_SUCCESS, if successful, Otherwise, CCI_FAILURE. +* +* ERRNO: N/A +* +* +* SEE ALSO: cciPoolAlloc(), cciPoolRelease(), cciPoolDestroy() +* +*/ +#define cciPoolCreate( pool,eSize,size,max) (cciPoolCreateReg(pool,eSize,size,max,NULL,NULL)) + + +/******************************************************************************* +* +* cciHmacUpdate - Update message digest for HMAC CCIContext. +* +* Use this function to update the message digest associated with a HMAC +* CCIContext +* +* SYNOPSIS: +* \cs +* cci_st cciHmacUpdate +* ( +* CCIContext cciContext, // CCIContext object +* cci_b *input, // Input buffer pointer +* cci_t inputLength // Length of input buffer +* ) +* \ce +* +* Parameters: +* \is +* \i +* The CCIContext object created with 'cciHmacInit()'. +* +* \i +* An address to the message buffer to be used in the update operation. +* +* \i +* The length of the message buffer. +* +* \ie +* +* RETURNS: CCI_SUCCESS, if successful, Otherwise, CCI_FAILURE. +* +* ERRNO: N/A +* +* SEE ALSO: cciHmacInit(), cciHmacFinal(), cciHmacBlock() +* +*/ +#define cciHmacUpdate( ctx, in, len ) (ccip_ctx_update( ctx, in, len )) + + +/******************************************************************************* +* +* cciHmacFinal - Extract message digest from CCIContext of type CCI_HMAC. +* +* Use this function to extract the message digest associated with a HMAC +* CCIContext +* +* SYNOPSIS: +* \cs +* cci_st cciHmacFinal +* ( +* CCIContext cciContext, // CCIContext object +* cci_b *digest, // Output buffer pointer +* cci_t *digestLength // Length pointer +* ) +* \ce +* +* Parameters: +* \is +* \i +* The CCIContext object created with 'cciHmacInit()'. +* +* \i +* The address of a buffer where the digest will be copied to. +* +* \i +* The address of a variable that contains the length of the digest buffer. +* The variable that this pointer points to will be updated with the number of +* bytes that were copied into the digest buffer. +* +* \ie +* +* RETURNS: CCI_SUCCESS, if successful, Otherwise, CCI_FAILURE. +* +* ERRNO: N/A +* +* SEE ALSO: cciHmacInit(), cciHmacUpdate(), cciHmacBlock() +* +*/ +#define cciHmacFinal( ctx, dig, digLen ) (ccip_ctx_digest_get( ctx, dig, digLen )) + +/******************************************************************************* +* +* cciHashInit - Initialize HASH CCIContext. +* +* Initialize a HASH crypto context that will be used with 'cciHashUpdate()' and +* 'cciHashFinal()' operations. +* +* SYNOPSIS: +* \cs +* cci_st cciHashInit +* ( +* CCIContext *cciContext, // CCIContext object +* CCI_PROVIDER_ID providerId, // Provider to use +* CCI_ALGORITHM_ID algorithmId // Type of CCI_HASH algorithm to use +* ) +* \ce +* +* Parameters: +* \is +* \i +* The address of an un-initialized CCIContext object. +* +* \i +* Identifier of the CCI Provider the this object will be created for. +* +* \i +* The type of CCI_HASH algorithm that will be used. +* +* +* \ie +* +* RETURNS: CCI_SUCCESS, if successful, Otherwise, CCI_FAILURE. +* +* ERRNO: N/A +* +* SEE ALSO: cciHashUpdate(), cciHashFinal(), cciHashBlock() +* +*/ +#define cciHashInit( ctx, pvr, algId ) (cciCtxCreate( ctx, pvr, CCI_CLASS_HASH, algId )) + + +/******************************************************************************* +* +* cciHashUpdate - Update message digest for HASH CCIContext. +* +* Use this function to update the message digest associated with a HASH +* CCIContext +* +* SYNOPSIS: +* \cs +* cci_st cciHashUpdate +* ( +* CCIContext cciContext, // CCIContext object +* cci_b *input, // Input buffer pointer +* cci_t inputLength // Length of input buffer +* ) +* \ce +* Parameters: +* \is +* \i +* The CCIContext object created with 'cciHashInit()'. +* +* \i +* An address to the message buffer to be used in the update operation. +* +* \i +* The length of the message buffer. +* +* \ie +* +* RETURNS: CCI_SUCCESS, if successful, Otherwise, CCI_FAILURE. +* +* ERRNO: N/A +* +* SEE ALSO: cciHashInit(), cciHashFinal(), cciHashBlock() +* +*/ +#define cciHashUpdate( ctx, in, len ) (ccip_ctx_update( ctx, in, len )) + + +/******************************************************************************* +* +* cciHashFinal - Extract message digest from CCIContext of type CCI_HASH. +* +* Use this function to extract the message digest associated with a HASH +* CCIContext +* +* SYNOPSIS: +* \cs +* cci_st cciHashFinal +* ( +* CCIContext cciContext, // CCIContext object +* cci_b *digest, // Output buffer pointer +* cci_t *digestLength // Length pointer +* ) +* \ce +* Parameters: +* \is +* \i +* The CCIContext object created with 'cciHashInit()'. +* +* \i +* The address of a buffer where the digest will be copied to. +* +* \i +* The address of a variable that contains the length of the digest buffer. +* The variable that this pointer points to will be updated with the number of +* bytes that were copied into the digest buffer. +* +* \ie +* +* RETURNS: CCI_SUCCESS, if successful, Otherwise, CCI_FAILURE. +* +* ERRNO: N/A +* +* SEE ALSO: cciHashInit(), cciHashUpdate(), cciHashBlock() +* +*/ +#define cciHashFinal( ctx, dig, digLen ) (ccip_ctx_digest_get( ctx, dig, digLen )) + + +/* +** --- Misc macro routines +*/ +#define cciCtxUserObjectSet( ctx, obj ) ((ctx)->attributes[CCI_USER_ASSIGNED] = (cci_b *) obj) +#define cciCtxUserObjectGet( ctx ) ((void *)(ctx)->attributes[CCI_USER_ASSIGNED]) +#define cciCtxPoolCreate( pool, size, max ) ( cciPoolCreate( pool, sizeof(CCIContextRec), size, max )) +#define cciCtxPoolDestroy( pool ) ( cciPoolDestroy( pool )) + +#define CCI_SECURITY_NUM_TAG_DIGITS 20 + +#define CCI_RSA_BIT_MULTIPLE 16 +#define CCI_RSA_MIN_MODULAS_SIZE 46 + +#define CCI_AES_BLOCKSIZE 16 +#define CCI_DES_BLOCKSIZE 8 + +#define CCI_AESK_IV_LENGTH 8 +#define CCI_AES_IV_LENGTH CCI_AES_BLOCKSIZE /* AES Init Vector length */ +#define CCI_DES_IV_LENGTH CCI_DES_BLOCKSIZE /* DES Init Vector length */ +#define CCI_MAX_IV_LENGTH (__max(CCI_AES_IV_LENGTH, CCI_DES_IV_LENGTH)) + + +#define CCI_AES_XCBC_DIGESTSIZE 16 /* AES-XCBC Digest size */ +#define CCI_MD2_DIGESTSIZE 16 /* MD2 Digest size */ +#define CCI_MD2_BLOCKSIZE 16 /* MD2 Block size */ +#define CCI_MD4_DIGESTSIZE 16 /* MD4 Digest size */ +#define CCI_MD4_BLOCKSIZE 64 /* MD4 Block size */ +#define CCI_MD5_DIGESTSIZE 16 /* MD5 Digest size */ +#define CCI_MD5_BLOCKSIZE 64 /* MD5 Block size */ +#define CCI_SHA1_DIGESTSIZE 20 /* SHA1 Digest size */ +#define CCI_SHA1_BLOCKSIZE 64 /* SHA1 Block size */ +#define CCI_SHA256_BLOCKSIZE 64 /* SHA256 Block size */ +#define CCI_SHA384_BLOCKSIZE 128 /* SHA384 Block size */ +#define CCI_SHA512_BLOCKSIZE 128 /* SHA512 Block size */ +#define CCI_SHA256_DIGESTSIZE 32 /* SHA256 Digest size */ +#define CCI_SHA384_DIGESTSIZE 48 /* SHA384 Digest size */ +#define CCI_SHA512_DIGESTSIZE 64 /* SHA512 Digest size */ +#define CCI_RMD160_DIGESTSIZE 20 /* RMD160 Digest size */ +#define CCI_RMD160_BLOCKSIZE 64 /* RMD160 Block size */ +#define CCI_RMD128_DIGESTSIZE 16 /* RMD160 Digest size */ +#define CCI_RMD128_BLOCKSIZE 64 /* RMD160 Block size */ +#define CCI_HASH_OPENSSL_DIGESTSIZE 36 /* Special OpenSSL MD5+SHA1 Hash size */ + +/* +** --- Algorithm handler types... +*/ +typedef enum _CCI_SESSION_HANDLER +{ + CCI_HANDLER_SESSION_OPEN, /* Algorithm open session handler */ + CCI_HANDLER_SESSION_INIT, /* Algorithm initialize session handler */ + CCI_HANDLER_SESSION_UPDATE, /* Algorithm update session handler */ + CCI_HANDLER_SESSION_FINAL, /* Algorithm final session handler */ + CCI_HANDLER_SESSION, /* Algorithm process session handler */ + CCI_HANDLER_SESSION_CLOSE /* Algorithm close session handler */ +} CCI_SESSION_HANDLER; + + +/* +** --- IPC Communication types +*/ +typedef enum _CCI_NOTIFY_TYPE +{ + CCI_NOTIFY_CALLBACK, /* Notification type: Callback */ + CCI_NOTIFY_MSGQ, /* Notification type: Message queue */ + CCI_NOTIFY_SOCKET, /* Notification type: Socket */ + CCI_NOTIFY_NAMEDPIPE, /* Notification type: Named Pipe */ + CCI_NOTIFY_SYNC_SEMAPHORE /* Notification type: Binary/sync semaphore */ +} CCI_NOTIFY_TYPE; + + +/* +** --- CCI resource pool flags +*/ +typedef enum _CCI_POOL_FLAG +{ + CCI_P_NOWAIT = FALSE, /* Don't wait for resource */ + CCI_P_WAIT = TRUE /* Wait for next available resource */ +} CCI_POOL_FLAG; + + + +/* +** --- Priority levels +*/ +typedef enum _CCI_PRIORITY_LEVEL +{ + CCI_PRIORITY_1, /* Highest priority */ + CCI_PRIORITY_2, /* 2nd highest priority */ + CCI_PRIORITY_3, /* Medium priority */ + CCI_PRIORITY_4, /* 2nd lowest priority */ + CCI_PRIORITY_5, /* Lowest priority */ + CCI_PRIORITY_MAX /* Max num of priority levels */ +} CCI_PRIORITY_LEVEL; + + +/* +** --- Internal attributes +*/ +typedef enum _CCI_INTERNAL_ATTRIBUTES +{ + CCI_CONTEXT_MSGID, /* Internal attribute: Context msg identifier. */ + CCI_NOTIFICATION_TYPE, /* Internal attribute: IPC mechanism is use */ + CCI_NOTIFICATION_IPC, /* Internal attribute: IPC Object to be used */ + CCI_NOTIFICATION_ARG, /* Internal attribute: Optional IPC arguments */ + CCI_REQUEST_STATUS, /* Internal attribute: Request status */ + CCI_USER_ASSIGNED, /* Internal attribute: User specified attribute */ + CCI_HASH_BLOCK, /* Internal attribute: HASH Single Block */ + CCI_ASYNC_SUPPORT, /* Internal attribute: Module has async support */ + CCI_ASYNC_REQUEST, /* Internal attribute: This is an async request */ + CCI_INPUT_BUFFER, /* Internal attribute: Input buffer address */ + CCI_INPUT_LENGTH, /* Internal attribute: Input buffer length */ + CCI_OUTPUT_BUFFER, /* Internal attribute: Output buffer address */ + CCI_OUTPUT_LENGTH, /* Internal attribute: Output buffer length */ + CCI_SESSION_CTX, /* Internal attribute: Session context object */ + CCI_PRIORITY, /* Internal attribute: Request priority */ + +#ifdef CCI_SHAREDMEM_REGION /* Intenral attributes for 6.x and above */ + CCI_VIRTUAL_BASE_ADDR, /* Internal attribute: Share region virt addr */ + CCI_PHYSICAL_BASE_ADDR, /* Internal attribute: Share region phys addr */ + CCI_SHARE_PROCESS_PID, /* Internal attribute: RTP process ID */ + CCI_SHARE_RTP_REGION_ID, /* Internal attribute: RTP region identifier */ + CCI_SHARE_RTP_REGION_SIZE, /* Internal attribute: RTP region size */ + CCI_SHARE_INTEGER_SUBTYPE, /* Internal attribute: RTP integer subtype */ + CCI_SHARE_INTEGER_PARAMS, /* Internal attribute: RTP integer parameters */ + CCI_SHARE_PROVIDER_ID, /* Internal attribute: KERNEL mapping of APP */ + CCI_CONV_VIRTUAL_ADDRESS, /* Convert virtual addr to physical addr */ + CCI_SHARE_SYNC_SEM_ID, /* Synchronization semaphore */ + CCI_UNUSED_ATTRIBUTE_001, /* Internal attribute: future attr place holder */ + CCI_UNUSED_ATTRIBUTE_002, /* Internal attribute: future attr place holder */ + CCI_UNUSED_ATTRIBUTE_003, /* Internal attribute: future attr place holder */ + CCI_UNUSED_ATTRIBUTE_004, /* Internal attribute: future attr place holder */ + CCI_UNUSED_ATTRIBUTE_005, /* Internal attribute: future attr place holder */ + CCI_UNUSED_ATTRIBUTE_006, /* Internal attribute: future attr place holder */ +#endif + CCI_ATTRIBUTE_BASE /* Starting attribute for base classes */ +} CCI_INTERNAL_ATTRIBUTES; + + +#define CCI_PUBLIC_KEY_BASE 500 /* Base value for PKI private/public keys */ +#define CCI_PUBLIC_KEY_COMP_BASE 600 /* Base value for PKI components */ + +typedef enum _CCI_PUBLIC_KEY_TYPE +{ + CCI_RSA_PUBLIC_KEY = CCI_PUBLIC_KEY_BASE, /* RSA Public key */ + CCI_RSA_PRIVATE_KEY, /* RSA Private key */ + CCI_DSA_PUBLIC_KEY, /* DSA Public key */ + CCI_DSA_PRIVATE_KEY, /* DSA Private key */ + CCI_DH_PUBLIC_KEY, /* DH Public key */ + CCI_DH_PRIVATE_KEY /* DH Private key */ +} CCI_PUBLIC_KEY_TYPE; + +typedef enum _CCI_PUBLIC_KEY_COMPONENT +{ + CCI_RSA_MODULAS = CCI_PUBLIC_KEY_COMP_BASE, /* RSA n = (P)*(Q) */ + CCI_RSA_PUBLIC_EXPONENT, /* RSA e = d(exp-1)mod((P-1)(Q-1)) */ + CCI_RSA_PRIVATE_EXPONENT, /* RSA d = e(exp-1)mod((P-1)(Q-1)) */ + CCI_RSA_PRIME_FACTOR_P, /* RSA P Prime factor */ + CCI_RSA_PRIME_FACTOR_Q, /* RSA Q Prime factor */ + CCI_RSA_EXPONENT_dP, /* RSA dP = (d)mod(P-1) */ + CCI_RSA_EXPONENT_dQ, /* RSA dQ = (d)mod(Q-1) */ + CCI_RSA_CRT_PINV, /* RSA PINV = P(exp-1)mod(Q) */ + CCI_RSA_CRT_QINV, /* RSA QINV = Q(exp-1)mod(P) */ + CCI_RSA_PHI, /* RSA PHI */ + CCI_RSA_CQ, /* RSA CRT - Component CQ */ + CCI_RSA_CP, /* RSA CRT - Component CP */ + + CCI_DSA_MODULAS, /* DSA P Prime factor */ + CCI_DSA_SUBPRIME_Q /* DSA Q Subprime factor */ +} CCI_PUBLIC_KEY_COMPONENT; + +typedef enum _CCI_PROVIDER_PARAM +{ + CCI_PVR_SOFTWARE_DEFAULT, /* Use default s/w algorithms */ + CCI_PVR_SECURITY_PUBLIC_KEY, /* Provider verification private key */ + CCI_PVR_SECURITY_SIGNATURE, /* Provider signature used for verification */ + CCI_PVR_SECURITY_SIGNATURE_LEN, /* Provider signature length */ + CCI_PVR_SECURITY_TAG_TABLE, /* Security tag table */ + CCI_PVR_MAX +} CCI_PROVIDER_PARAM; + + +/* +** --- CCI STATUS definitions. +*/ +typedef enum _cci_st +{ + S_cciLib_SUCCESS = 0, /* Successful completion */ + S_cciLib_FAILURE = 1, /* Failure completion */ + S_cciLib_LIB_ALREADY_INITIALIZED = 2, /* CCI library is already been initialized */ + S_cciLib_LIB_NOT_INITIALIZED = 3, /* CCI library is NOT initialized */ + S_cciLib_CONTEXT_IS_INVALID = 4, /* Request context is NULL */ + S_cciLib_UNKNOWN_ATTRIBUTE = 5, /* Unknown attribute */ + S_cciLib_UNEXPECTED_ATTRIBUTE = 6, /* Unexpected attribute received */ + S_cciLib_UNEXPECTED_ATTRIBUTE_TYPE = 7, /* Unexpected attribute type */ + S_cciLib_UNKNOWN_ATTRIBUTE_DATATYPE = 8, /* Unknown attribute data type */ + S_cciLib_ATTRIBUTE_NOT_FOUND = 9, /* Attribute not found */ + S_cciLib_INVALID_ATTRIBUTE_VALUE = 10, /* Invalid attribute value */ + S_cciLib_MISSING_ATTRIBUTE = 11, /* Missing attribute from context */ + S_cciLib_MEMALLOC_FAILED = 12, /* Memory allocation failed */ + S_cciLib_MORE_DATA = 13, /* More data is available */ + S_cciLib_NO_MORE_DATA = 14, /* No more data is available */ + S_cciLib_ALGORITHM_NOT_SUPPORTED = 15, /* Provider does not support algorithm */ + S_cciLib_PROVIDER_NOT_REGISTED = 16, /* Provider is not registed */ + S_cciLib_INVALID_ALGORITHM_ID = 17, /* Invalid algorithm identifier */ + S_cciLib_INVALID_CRYPTO_CLASS_ID = 18, /* Invalid crypto class identifier */ + S_cciLib_INVALID_PROVIDER_ID = 19, /* Invalid provider identifier */ + S_cciLib_PROVIDER_NULL_FROM_LOADPROC = 20, /* Provider returned from procedure was NULL */ + S_cciLib_PROVIDER_INIT_FAILED = 21, /* Provider initialization failed */ + S_cciLib_PROVIDER_DEFINED_STATUS = 22, /* Provider defined status code */ + S_cciLib_INVALID_IDENTIFIER = 23, /* Identifier value is invalid */ + S_cciLib_PROVIDER_UNKNOWN_STATUS = 24, /* Provider returned an unknown status code */ + S_cciLib_INPUT_BUFFER_NOT_BYTE_ALIGNED = 25, /* Input buffer is not byte aligned */ + S_cciLib_CIPHER_MODE_NOT_SUPPORTED = 26, /* Cipher mode is not supported by provider */ + S_cciLib_INVALID_KEY_LENGTH = 27, /* Invalid key length */ + S_cciLib_PROVIDER_ALREADY_LOADED = 28, /* Provider is already loaded */ + S_cciLib_OUTPUT_BUFFER_TOO_SMALL = 29, /* Output buffer is to small processing */ + S_cciLib_INVALID_IV_LENGTH = 30, /* Invalid initialization vector size */ + S_cciLib_PARAMETER_STRING_TOO_LONG = 31, /* Parameter string too long */ + S_cciLib_DECODING_ERROR = 32, /* Decoding error */ + S_cciLib_MESSAGE_TOO_LONG = 33, /* Message too long */ + S_cciLib_INTENDED_MESSAGE_TOO_SHORT = 34, /* Intended message is too short */ + S_cciLib_INVALID_HASH_FUNCTION = 35, /* Invalid Hash function */ + S_cciLib_INVALID_ENCODING_FORMAT = 36, /* Invalid Encoding format */ + S_cciLib_MODULAS_TOO_SMALL = 37, /* Modulas is too small */ + S_cciLib_INVALID_SIGNATURE = 38, /* Invalid signature */ + S_cciLib_SESSION_OPEN_ERROR = 39, /* Session open exception */ + S_cciLib_VALIDATION_TEST_NOT_AVAIL = 40, /* Validation test not available */ + S_cciLib_MAX_MTU_LENGTH_EXCEEDED = 41, /* Max MTU length exceeded */ + S_cciLib_DIGEST_BUFFER_TOO_SMALL = 42, /* Digest buffer is too small */ + S_cciLib_PROVIDER_SIGNATURE_INVALID = 43, /* Invalid provider signature */ + S_cciLib_CONTEXT_POOL_EMPTY = 44, /* Context Pool is empty */ + S_cciLib_CHANNEL_NOT_AVAILABLE = 45, /* Channel not available message from provider */ + S_cciLib_INVALID_PADDING_ALG = 46, /* Invalid padding type */ + S_cciLib_MESSAGE_TOO_SHORT = 47, /* Message too short */ + S_cciLib_INVALID_MESSAGE_LENGTH = 48, /* Message message length not valid */ + S_cciLib_INVALID_BUFFER_ALIGNMENT = 49, /* Input buffer not properly aligned */ + S_cciLib_AUTHENTICATION_ERROR = 50, /* Authentication error */ + S_cciLib_ST_MAX /* Max value */ +} cci_st; + + + +/* +** +** --- CCI CIPHER definitions +** +** All macro definitions with this enumeration must be +** SEQUENTIAL and the first enum must begin with ZERO. +** +*/ +typedef enum _CCI_CIPHER +{ + CCI_CIPHER_DES, /* 56bit key DES block cipher */ + CCI_CIPHER_2DES, /* 112bit key DES block cipher */ + CCI_CIPHER_3DES, /* 168bit key TRIPLE-DES block cipher */ + CCI_CIPHER_IDEA, /* IDEA block cipher */ + CCI_CIPHER_DESX, /* 56bit key DESX block cipher */ + CCI_CIPHER_RC2, /* RC2 block cipher */ + CCI_CIPHER_RC5, /* RC5 block cipher */ + CCI_CIPHER_BLOWFISH, /* BLOWFISH block cipher */ + CCI_CIPHER_SKIPJACK, /* SKIPJACK block cipher */ + CCI_CIPHER_CAST128, /* CAST-128 block cipher */ + CCI_CIPHER_AES, /* AES block cipher */ + CCI_CIPHER_RC4, /* RC4 stream cipher */ + CCI_CIPHER_A5, /* A5 stream cipher */ + CCI_CIPHER_LEVIATHON, /* LEVIATHON stream cipher */ + CCI_CIPHER_SOBER, /* SOBER stream cipher */ + CCI_CIPHER_SEAL, /* SEAL stream cipher */ + CCI_CIPHER_FEAL, /* FEAL block cipher */ + CCI_CIPHER_ICE, /* ICE 64-bit block cipher */ + CCI_CIPHER_KASUMI, /* KASUMI 64-bit block cipher */ + CCI_CIPHER_MISTY, /* MISTY 64-bit block cipher */ + CCI_CIPHER_SAFER, /* SAFER 64-bit block cipher */ + CCI_CIPHER_SHARK, /* SHARK 64-bit block cipher */ + CCI_CIPHER_CAMELLIA, /* CAMELLIA 128-bit block cipher */ + CCI_CIPHER_SEED, /* SEED 128-bit block cipher */ + CCI_CIPHER_SQUARE, /* SQUARE 128-bit block cipher */ + CCI_CIPHER_UNICORN, /* UNICORN 128-bit block cipher */ + CCI_CIPHER_MERCY, /* MERCY Disk Sector block cipher */ + CCI_CIPHER_PANAMA, /* PANAMA cipher */ + CCI_CIPHER_NULL, /* NULL encryption cipher */ + CCI_CIPHER_AESKW, /* AES Key Wrap Algorithm */ + CCI_CIPHER_RC4TKIP, /* TKIP using RC4 algorithm */ + CCI_CIPHER_MAX /* Max value */ +} CCI_CIPHER; + +/* +** --- CIPHER attribute definitions +** +*/ +typedef enum _CCI_CIPHER_ATTRIBUTE +{ + CCI_CIPHER_OPERATION = CCI_ATTRIBUTE_BASE, /* Cipher operation: encrypt/decrypt */ + CCI_CIPHER_KEY, /* Symmetric cipher key */ + CCI_CIPHER_KEY_LENGTH, /* Symmetric cipher key length */ + CCI_CIPHER_MODE, /* Symmetric cipher mode */ + CCI_CIPHER_IV, /* Cipher initialization vector */ + CCI_CIPHER_IV_LENGTH, /* Cipher initialization vector length */ + CCI_CIPHER_BLOCK_SIZE, /* Cipher block size */ + CCI_CIPHER_KEY_OFFSET, /* Cipher KEY offset */ + CCI_CIPHER_ATTRIBUTE_MAX /* Max value */ +} +CCI_CIPHER_ATTRIBUTE; + +typedef enum _CCI_CIPHER_CONSTANTS +{ + CCI_ENCRYPT, /* Encryption flag */ + CCI_DECRYPT /* Decryption flag */ +} CCI_CIPHER_CONSTANTS; + +typedef enum _CCI_MODE_CONSTANTS +{ + CCI_MODE_NONE, /* No CIPHER mode needed */ + CCI_MODE_BC, /* Block Chaining Mode */ + CCI_MODE_PCBC, /* Propagating Cipher Block Chaining Mode */ + CCI_MODE_CBCC, /* Cipher Block Chaining Checksum Mode */ + CCI_MODE_OFBNLF, /* Output-Feedback Nonlinear Fuction Mode */ + CCI_MODE_PBC, /* Plainttext Block Chaining Mode */ + CCI_MODE_CBC, /* Cipher Block Chaining Mode */ + CCI_MODE_ECB, /* Electronic Codebook Mode */ + CCI_MODE_PFB, /* Plaintext-Feedback Mode */ + CCI_MODE_CFB, /* Cipher-Feedback Mode */ + CCI_MODE_CFB128, /* Cipher-Feedback 128-bit mode */ + CCI_MODE_CFB8, /* Cipher-Feedback 8-bit mode */ + CCI_MODE_CFB1, /* Cipher-Feedback 1-bit mode */ + CCI_MODE_CTR, /* AES counter Mode */ + CCI_MODE_OFB, /* Output-Feedback Mode */ + CCI_MODE_MAX /* Maximum cipher modes */ +} CCI_MODE_CONSTANTS; + + + + + +/* +** +** --- CCI HASH definitions +** +** All macro definitions with this enumeration must be +** SEQUENTIAL and the first enum must begin with ZERO. +** +*/ +typedef enum _CCI_HASH +{ + CCI_HASH_SHA1, /* SHAI hash algorithm */ + CCI_HASH_SHA256, /* SHA 256 hash algorithm */ + CCI_HASH_SHA384, /* SHA 384 hash algorithm */ + CCI_HASH_SHA512, /* SHA 512 hash algorithm */ + CCI_HASH_MD2, /* MD2 hash algorithm RFC1319 */ + CCI_HASH_MD4, /* MD4 hash algorithm */ + CCI_HASH_MD5, /* MD5 hash algorithm RFC1321 */ + CCI_HASH_RIPEMD160, /* RIPEMD160 hash algorithm */ + CCI_HASH_RIPEMD128, /* RIPEMD128 hash algorithm */ + CCI_HASH_TIGER, /* TIGER hash algorithm */ + CCI_HASH_PANAMA, /* PANAMA hash algorithm */ + CCI_HASH_CRC32, /* CRC hash algorithm */ + CCI_HASH_ADLER32, /* ADLER32 hash algorithm */ + CCI_HASH_MAX /* Max value */ +} CCI_HASH; + +/* +** --- HASH attribute definitions +** +*/ +typedef enum _CCI_HASH_ATTRIBUTE +{ + CCI_HASH_DIGEST = CCI_ATTRIBUTE_BASE, /* Digest to authenticate against */ + CCI_HASH_DIGEST_LENGTH, /* Digest length */ + CCI_HASH_ATTRIBUTE_MAX /* Max value */ +} +_CCI_HASH_ATTRIBUTE; + + +/* +** +** --- CCI MAC definitions +** +** All macro definitions with this enumeration must be +** SEQUENTIAL and the first enum must begin with ZERO. +** +*/ +typedef enum _CCI_HMAC +{ + CCI_HMAC_SHA1, /* SHA1 160 MAC algorithm */ + CCI_HMAC_SHA256, /* SHA 256 MAC algorithm */ + CCI_HMAC_SHA384, /* SHA 384 MAC algorithm */ + CCI_HMAC_SHA512, /* SHA 512 MAC algorithm */ + CCI_HMAC_MD4, /* MD5 MAC algorithm */ + CCI_HMAC_MD5, /* MD5 MAC algorithm */ + CCI_HMAC_RIPEMD160, /* RIPEMD160 MAC algorithm */ + CCI_HMAC_RIPEMD128, /* RIPEMD128 MAC algorithm */ + CCI_HMAC_AES_XCBC, /* AES-MAC Cipher Block Chaining Mode */ + CCI_HMAC_NONE, /* NO authentication required */ + CCI_HMAC_MAX /* Max value */ +} CCI_HMAC; + +/* +** --- MAC attribute definitions +** +*/ +typedef enum _CCI_HMAC_ATTRIBUTE +{ + CCI_HMAC_KEY = CCI_ATTRIBUTE_BASE, /* HMAC secret key */ + CCI_HMAC_KEY_LENGTH, /* HMAC secret key length in bytes */ + CCI_HMAC_TRUNCATE, /* Truncate output digest */ + CCI_HMAC_DIGEST, /* Digest to authenticate against */ + CCI_HMAC_DIGEST_LENGTH, /* Digest length */ + CCI_HMAC_BUFFER_PADDED, /* Input buffer is padded */ + CCI_HMAC_ATTRIBUTE_MAX /* Max value */ +} _CCI_HMAC_ATTRIBUTE; + + +/* +** +** --- CCI PUBLICKEY definitions +** +** All PUBLICKEYro definitions with this enumeration must be +** SEQUENTIAL and the first enum must begin with ZERO. +** +*/ +typedef enum _CCI_PUBLICKEY +{ + CCI_PUBLICKEY_RSA, /* RSA PUBLICKEY algorithm */ + CCI_PUBLICKEY_DSA, /* DSA PUBLICKEY algorithm */ + CCI_PUBLICKEY_ECC, /* Ellipic Curve algorithm */ + CCI_PUBLICKEY_ECDSA, /* ECDSA PUBLICKEY algorithm */ + CCI_PUBLICKEY_DH, /* DH PUBLICKEY algorithm */ + CCI_PUBLICKEY_ECDH, /* ECDH PUBLICKEY algorithm */ + CCI_PUBLICKEY_KEA, /* KEA PUBLICKEY algorithm (RFC2528) */ + CCI_PUBLICKEY_ELGAMAL, /* ELGMAL PUBLICKEY algorithm */ + CCI_PUBLICKEY_RABIN_WILLIAMS, /* RABIN-WILLIAMS PUBLICKEY algorithm */ + CCI_PUBLICKEY_BLUM_GOLDWASSER, /* BLUM GOLDWASSER algorithm */ + CCI_PUBLICKEY_MQV, /* MQV public key agreement algorithm */ + CCI_PUBLICKEY_MAX /* Max value */ +} CCI_PUBLICKEY; + +/* +** --- PUBLICKEY attribute definitions +** +*/ +typedef enum _CCI_PUBLICKEY_ATTRIBUTE +{ + CCI_PUBLICKEY_OPERATION = CCI_ATTRIBUTE_BASE, /* Public key operation */ + CCI_PUBLICKEY_LENGTH_BITS, /* Public/private key length in bits */ + CCI_PUBLICKEY_PRIVATE, /* Private key */ + CCI_PUBLICKEY_PUBLIC, /* Public key */ + CCI_PUBLICKEY_ENCRYPT_FORMAT, /* Encryption/decryption format */ + CCI_PUBLICKEY_SIGN_FORMAT, /* Signature/verification format */ + CCI_PUBLICKEY_HASH_FORMAT, /* Format of HASH */ + CCI_PUBLICKEY_PLAINTEXT, /* Plainetext data */ + CCI_PUBLICKEY_PLAINTEXT_LENGTH, /* Length of plaintext data */ + CCI_PUBLICKEY_SIGNATURE, /* Signature of signed data */ + CCI_PUBLICKEY_SIGNATURE_LENGTH, /* Signaure length */ + CCI_PUBLICKEY_HASH_DIGEST, /* HASH to sign */ + CCI_PUBLICKEY_CIPHER_TEXT, /* Signature of signed data */ + CCI_PUBLICKEY_CIPHER_TEXT_LENGTH, /* Signaure length */ + CCI_PUBLICKEY_KEY_TYPE, /* PKI Key type */ + CCI_PUBLICKEY_KEY, /* PKI key object */ + CCI_PUBLICKEY_KEY_SIZE, /* PKI key size */ + CCI_PUBLICKEY_KEY_COMP_TYPE, /* PKI Key component type */ + CCI_PUBLICKEY_KEY_COMP, /* PKI key component object */ + CCI_PUBLICKEY_KEY_COMP_LENGTH, /* PKI key component object length */ + CCI_PUBLICKEY_BLINDING, /* TRUE/FALSE state for Blinding */ + + CCI_PUBLICKEY_ATTRIBUTE_MAX /* Max value */ +} +_CCI_PUBLICKEY_ATTRIBUTE; + +typedef enum _CCI_PUBLICKEY_CONSTANTS +{ + CCI_PUBLICKEY_OP_CREATE_KEY, /* Generate public key pair */ + CCI_PUBLICKEY_OP_DESTROY_KEY, /* Destroy public key pair */ + CCI_PUBLICKEY_OP_SET_KEY_COMP, /* Set key component */ + CCI_PUBLICKEY_OP_GET_KEY_COMP, /* Get key component */ + CCI_PUBLICKEY_OP_GEN_KEYPAIR, /* Generate public key pair */ + CCI_PUBLICKEY_OP_SIGN, /* Perform public key signing operation */ + CCI_PUBLICKEY_OP_VERIFY, /* Perform public key verify operation */ + CCI_PUBLICKEY_OP_ENCRYPT, /* Perform public key encryption operation */ + CCI_PUBLICKEY_OP_DECRYPT, /* Perform public key decryption operation */ + CCI_PUBLICKEY_OP_SET_BLINDING, /* Set Enable/Disable Blinding operations */ + CCI_PUBLICKEY_OP_GET_BLINDING, /* Get Enable/Disable Blinding operations */ + CCI_PUBLICKEY_OP_KEY_SIZE, /* PKI keysize operations */ + CCI_PUBLICKEY_HASH_SHA1, /* SHA1 HASH digest */ + CCI_PUBLICKEY_HASH_MD5, /* MD5 HASH digest */ + CCI_PUBLICKEY_HASH_MD4, /* MD4 HASH digest */ + CCI_PUBLICKEY_HASH_MD2, /* MD2 HASH digest */ + CCI_PUBLICKEY_HASH_RIP160, /* RIPEMD160 HASH digest */ + CCI_PUBLICKEY_OAEP, /* Optimal asymmetric encryption padding */ + CCI_PUBLICKEY_PKCS1_V1_5, /* PKCS1 V1.5 format */ + CCI_PUBLICKEY_NO_PADDING, /* No padding of messages required */ + CCI_PUBLICKEY_SSLV23, /* PKCS1 V1.5 padding with SSL modification */ + CCI_PUBLICKEY_HASH_OPENSSL /* Special openSSL signing method */ +} CCI_PUBLICKEY_CONSTANTS; + + +/* +** +** --- CCI RANDOM NUMBER definitions +** +** All RANDOMNUMro definitions with this enumeration must be +** SEQUENTIAL and the first enum must begin with ZERO. +** +*/ +typedef enum _CCI_RNG +{ + CCI_RNG_GENERIC, /* Generic RANDOMNUM algorithm */ + CCI_RNG_FIPS186_SHA1, /* FIPS186_SHA1 RANDOMNUM algorithm */ + CCI_RNG_FIPS186_DES, /* FIPS186_DES RANDOMNUM algorithm */ + CCI_RNG_YARROW_DES, /* YARROW_DES RANDOMNUM algorithm */ + CCI_RNG_ISSAC, /* ISSAC RANDOMNUM algorithm */ + CCI_RNG_SEED, /* ISSAC RANDOMNUM algorithm */ + CCI_RNG_MAX /* Max value */ +} CCI_RNG; + +/* +** --- RANDOM NUMBER attribute definitions +** +*/ +typedef enum _CCI_RNG_ATTRIBUTE +{ + CCI_RNG_NUM_BYTES = CCI_ATTRIBUTE_BASE, /* RNG operation */ + CCI_RNG_BUFFER, /* List of random numbers generated */ + CCI_RNG_ATTRIBUTE_MAX /* Max value */ +} CCI_RNG_ATTRIBUTE; + +typedef enum _CCI_RNG_CONSTANTS +{ + CCI_SECURE_NUMBERS, /* Generate crypto secure random numbers */ + CCI_RAW_NUMBERS /* Generate un-processed random numbers */ +} CCI_RNG_CONSTANTS; + + +/* +** --- CCI compression algorithms +** +** All COMPRESSIONro definitions with this enumeration must be +** SEQUENTIAL and the first enum must begin with ZERO. +** +*/ +typedef enum CCI_COMPRESSION +{ + CCI_COMPRESSION_LZS, /* STAC Lempel-Ziv standard compression */ + CCI_COMPRESSION_LZS_STRIP0, /* STAC Lempel-Ziv STRIP0 standard compression */ + CCI_COMPRESSION_MPPC, /* Microsoft Point-to-Point Compression */ + CCI_COMPRESSION_MAX /* Max value */ +} CCI_COMPRESSION; + +/* +** +** --- COMPRESSION attribute definitions +** +*/ +typedef enum _CCI_COMPRESSION_ATTRIBUTE +{ + CCI_COMPRESSION_OPERATION = CCI_ATTRIBUTE_BASE, /* Compression/Decompression operation */ + CCI_COMPRESSION_ATTRIBUTE_MAX /* Max value */ +} +_CCI_COMPRESSION_ATTRIBUTE; + +typedef enum _CCI_COMPRESSION_CONSTANTS +{ + CCI_COMPRESS, /* Perform data compression operation */ + CCI_DECOMPRESS /* Perform data decompression operation */ +} CCI_COMPRESSION_CONSTANTS; + +/* +** +** --- CCI IPSEC definitions +** +** All macro definitions with this enumeration must be +** SEQUENTIAL and the first enum must begin with ZERO. +** +*/ +typedef enum _CCI_IPSEC +{ + CCI_IPSEC_SINGLEPASS, /* Single-pass operation */ + CCI_IPSEC_MAX /* Max value */ +} CCI_IPSEC; + +/* +** --- IPSEC attribute definitions +** +*/ +typedef enum _CCI_IPSEC_ATTRIBUTE +{ + CCI_IPSEC_OPERATION = CCI_ATTRIBUTE_BASE, /* Cipher operation: encrypt/decrypt */ + CCI_IPSEC_MODE, /* Mode: TUNNEL or TRANSPORT */ + CCI_IPSEC_PROTOCOL, /* Mode: AH or ESP Protocol */ + CCI_IPSEC_CIPHER, /* Cipher algorithm used */ + CCI_IPSEC_CIPHER_MODE, /* Cipher cipher mode */ + CCI_IPSEC_CIPHER_KEY, /* Cipher cipher key */ + CCI_IPSEC_CIPHER_KEY_LENGTH, /* Cipher cipher key length */ + CCI_IPSEC_CIPHER_IV, /* Cipher initialization vector */ + CCI_IPSEC_CIPHER_IV_LENGTH, /* Cipher initialization vector length */ + CCI_IPSEC_CIPHER_INPUT_BUFFER, /* Cipher input buffer */ + CCI_IPSEC_CIPHER_INPUT_LENGTH, /* Cipher input buffer length */ + CCI_IPSEC_CIPHER_OUTPUT_BUFFER, /* Cipher output buffer */ + CCI_IPSEC_CIPHER_OUTPUT_LENGTH, /* Cipher output buffer length */ + CCI_IPSEC_CIPHER_BLOCK_SIZE, /* Cipher Block Size */ + CCI_IPSEC_HMAC, /* Hmac algorithm used */ + CCI_IPSEC_HMAC_KEY, /* Hmac key */ + CCI_IPSEC_HMAC_KEY_LENGTH, /* Hmac key length */ + CCI_IPSEC_HMAC_INPUT_BUFFER, /* Hmac input buffer */ + CCI_IPSEC_HMAC_BUFFER_LENGTH, /* Hmac input buffer length */ + CCI_IPSEC_HMAC_TRUNCATE_LENGTH, /* Truncate output digest size */ + CCI_IPSEC_HMAC_DIGEST, /* Digest to authenticate against */ + CCI_IPSEC_HMAC_DIGEST_LENGTH, /* Digest length */ + CCI_IPSEC_ATTRIBUTE_MAX /* Max value */ +} CCI_IPSEC_ATTRIBUTE; + + +/* +** +** --- Library algorithm classes +** +** All macro definitions with this enumeration must be SEQUENTIAL and +** the first enum must begin with ZERO. The order of the class entries in +** the cryptoClassTable table MUST match exactly the order of the CCI_CLASS +** enumeration. +** +*/ +typedef enum CCI_CLASS +{ + _CLASS( CIPHER ), /* Base value */ + _CLASS( HASH ), /* Hash/Signature algorithms */ + _CLASS( HMAC ), /* MAC algorithms */ + _CLASS( PUBLICKEY ), /* Public Key Algorithms */ + _CLASS( RNG ), /* Random number generation algorithms */ + _CLASS( COMPRESSION ), /* Data compression algorithms */ + _CLASS( IPSEC ), /* IPSEC packet processing algorithms */ + _CLASS( MAX ) /* Max value */ +} CCI_CLASS; + + +typedef cci_g ( *mpi_CreateProc ) (); +typedef void ( *mpi_SetWordProc ) ( cci_g op, cci_t initValue ); +typedef cci_g ( *mpi_CreateDecProc ) ( cci_z decString ); +typedef cci_g ( *mpi_CreateHexProc ) ( cci_z hexString ); +typedef cci_g ( *mpi_CreateBinProc ) ( cci_b * bytes, cci_t numbytes ); +typedef cci_st ( *mpi_DestroyProc ) ( cci_g op ); +typedef cci_t ( *mpi_BinaryProc ) ( cci_g op, cci_b **byteArray ); +typedef cci_t ( *mpi_NumBitsProc ) ( cci_g op ); +typedef void ( *mpi_CopyProc ) ( cci_g op, cci_g op2 ); +typedef cci_z ( *mpi_HexStrProc ) ( cci_g op ); +typedef cci_z ( *mpi_DecStrProc ) ( cci_g op ); +typedef void ( *mpi_AddProc ) ( cci_g rop, cci_g op1, cci_g op2 ); +typedef void ( *mpi_SubtractProc ) ( cci_g rop, cci_g op1, cci_g op2 ); +typedef void ( *mpi_MultiplyProc ) ( cci_g rop, cci_g op1, cci_g op2 ); +typedef void ( *mpi_DivideProc ) ( cci_g rop, cci_g op1, cci_g op2, cci_g rem ); +typedef void ( *mpi_ExponentProc ) ( cci_g rop, cci_g op1, cci_g exponent ); +typedef void ( *mpi_ModProc ) ( cci_g rop, cci_g op1, cci_g numberM ); +typedef void ( *mpi_ModExpProc ) ( cci_g rop, cci_g op1, cci_g exp, cci_g numberM ); +typedef void ( *mpi_ModInverseProc ) ( cci_g rop, cci_g op, cci_g numberM ); +typedef void ( *mpi_ShiftRightProc ) ( cci_g rop, cci_g op, cci_t shiftAmount ); +typedef void ( *mpi_ShiftLeftProc ) ( cci_g rop, cci_g op, cci_t shiftAmount ); +typedef void ( *mpi_GCDProc ) ( cci_g rop, cci_g op, cci_g op2 ); +typedef int ( *mpi_CompareProc ) ( cci_g op1, cci_g op2 ); +typedef int ( *mpi_CmpWordProc ) ( cci_g op, cci_t value ); +typedef cci_bool ( *mpi_IsPosProc ) ( cci_g op ); +typedef cci_bool ( *mpi_IsNegProc ) ( cci_g op ); +typedef void ( *mpi_PosProc ) ( cci_g op ); +typedef void ( *mpi_NegProc ) ( cci_g op ); +typedef cci_bool ( *mpi_TstBitProc ) ( cci_g op, cci_t bit ); +typedef cci_bool ( *mpi_SetBitProc ) ( cci_g op, cci_t bit ); +typedef cci_bool ( *mpi_ClrBitProc ) ( cci_g op, cci_t bit ); +typedef cci_bool ( *mpi_MaskBitsProc ) ( cci_g op, cci_t value ); +typedef void ( *mpi_RandomProc ) ( cci_g op, cci_t numBits ); +typedef cci_bool ( *mpi_IsPrimeProc ) ( cci_g op ); +typedef void ( *mpi_PrimeProc ) ( cci_g op, cci_t numBits ); + + +typedef struct _CCIIntegerTableRec +{ + mpi_SetWordProc numSetWordProc; + mpi_CreateProc numCreateProc; + mpi_CreateDecProc numCreateDecProc; + mpi_CreateHexProc numCreateHexProc; + mpi_CreateBinProc numCreateBinProc; + mpi_DestroyProc numDestroyProc; + mpi_BinaryProc numBinaryProc; + mpi_NumBitsProc numNumBitsProc; + mpi_CopyProc numCopyProc; + mpi_HexStrProc numHexStrProc; + mpi_DecStrProc numDecStrProc; + mpi_AddProc numAddProc; + mpi_SubtractProc numSubtractProc; + mpi_MultiplyProc numMultiplyProc; + mpi_DivideProc numDivideProc; + mpi_ExponentProc numExponentProc; + mpi_ModProc numModProc; + mpi_ModExpProc numModExpProc; + mpi_ModInverseProc numModInverseProc; + mpi_ShiftRightProc numShiftRightProc; + mpi_ShiftLeftProc numShiftLeftProc; + mpi_CompareProc numCompareProc; + mpi_IsPosProc numIsPosProc; + mpi_IsNegProc numIsNegProc; + mpi_PosProc numPosProc; + mpi_NegProc numNegProc; + mpi_TstBitProc numTstBitProc; + mpi_SetBitProc numSetBitProc; + mpi_ClrBitProc numClrBitProc; + mpi_CmpWordProc numCmpWordProc; + mpi_MaskBitsProc numMaskBitsProc; + mpi_GCDProc numGCDProc; + mpi_RandomProc numRandomProc; + mpi_IsPrimeProc numIsPrimeProc; + mpi_PrimeProc numPrimeProc; +} CCIIntegerTableRec, CCIIntegerTable; + + + +/* make sure alloc is defined */ +#ifdef __GNUC__ +#ifndef alloca +#define alloca __builtin_alloca +#endif +#endif + +#ifndef VXWORKS +#ifndef alloca +#define alloca _alloca +#endif +#endif + + +/* +** --- Structure definitions +*/ +typedef struct _CCIContextRec *CCIContext; /* Request context object */ +typedef struct _CCIProviderRec *CCIProvider; /* Provider object */ +typedef struct _CCIPoolRec *CCIPool; /* Request pool object */ +typedef struct _CCIAlgorithmRec *CCIAlgorithm; /* CPI algorithm object */ +typedef struct _CCIPublicKeyRec *CCIPublicKey; /* PKI public/private key object */ +typedef struct _CCIIntegerRec *cci_m; /* Large integer object */ + +typedef void * ( *CCI_REALLOC_FUNCPTR ) (void *memblock, size_t size); +typedef void * ( *CCI_MALLOC_FUNCPTR ) ( size_t size ); +typedef void ( *CCI_FREE_FUNCPTR ) (void *memblock); +typedef void ( *FUNCTION_PTR )(); + + +/* +** --- Request context object definition +*/ +#define CCI_NATIVE_ALGORITHM( alg ) {cci_st alg##_native( CCIProvider provider );cciSetNativeAlgorithm( alg##_native );} +#define CCI_CLASS_ATTRIBUTE_MAX __max((int) CCI_IPSEC_ATTRIBUTE_MAX,__max((int) CCI_COMPRESSION_ATTRIBUTE_MAX,__max((int)CCI_RNG_ATTRIBUTE_MAX,__max((int)CCI_PUBLICKEY_ATTRIBUTE_MAX,__max((int)CCI_HMAC_ATTRIBUTE_MAX,__max((int)CCI_CIPHER_ATTRIBUTE_MAX,(int)CCI_HASH_ATTRIBUTE_MAX)))))) +typedef void ( *CCI_CALLBACK_FUNCPTR ) (const CCIContext cciContext, const cci_g callbackParams, const cci_st status); +typedef struct _CCIContextRec +{ + cci_t control; /* Context control register */ + CCIAlgorithm algorithm; /* Algorithm object/structure */ + cci_b *attributes[CCI_CLASS_ATTRIBUTE_MAX]; /* Request attributes */ + cci_t attribMask[(CCI_CLASS_ATTRIBUTE_MAX/32)+1]; /* Attribute set flags */ + CCIContext next; /* Pointer to next context */ +} CCIContextRec; + + + + +/* +** --- Function signatures +*/ +typedef cci_st ( *CCI_NATIVE_ALG_FUNCPTR ) (CCIProvider provider); +typedef cci_bool ( *CCI_LISTSEARCH_FUNCPTR ) (const void *source, const void *entry); +typedef void ( *CCI_THREAD_FUNCPTR ) (const void *entry); +typedef void ( *CCI_RANDNUM_FUNCPTR ) ( cci_b * randBuffer, cci_t numBits ); +typedef CCIProvider ( *CCIProviderLoadProc ) (); +typedef void ( *CCI_POOLELEM_FUNCPTR ) (void *elementObj, cci_t elemSize); +typedef cci_st ( *CCI_PROVIDER_IDINIT_FUNCPTR ) ( CCIProvider provider ); +typedef cci_st ( *CCI_PROVIDER_IDUNINIT_FUNCPTR ) ( CCIProvider provider ); +typedef cci_st ( *CCI_SESSION_FUNCPTR ) (const CCIContext cciContext); +typedef cci_st ( *CCI_SESSION_OPEN_FUNCPTR ) (const CCIContext cciContext); +typedef cci_st ( *CCI_SESSION_INIT_FUNCPTR ) (const CCIContext cciContext); +typedef cci_st ( *CCI_SESSION_UPDATE_FUNCPTR ) (const CCIContext cciContext); +typedef cci_st ( *CCI_SESSION_FINAL_FUNCPTR ) (const CCIContext cciContext); +typedef cci_st ( *CCI_SESSION_CLOSE_FUNCPTR ) (const CCIContext cciContext); +typedef void * ( *CCI_SD_OPEN_FUNCPTR ) (char *name, BOOL create, UINT32 size, void ** pVirtAddress); +typedef void ( *CCI_SD_UNMAP_DELETE_FUNCPTR ) (void * pShareRegionId); +typedef void * ( *CCI_VMTRANSLATE_FUNCPTR ) (void * virtualAddress); + +/* +** --- private functions used in public macros. (Used only for backward compatibility) +*/ +void ccip_show_buffer( char *title, void *buffer, cci_t length, cci_t lineLen ); +cci_st ccip_ctx_get_attr( const CCIContext cciContext, const CCI_ATTRIBUTE_ID attributeId, cci_g *value ); +cci_st ccip_ctx_update( const CCIContext cciContext, const cci_b *buffer, const cci_t bufferLength ); +cci_st ccip_ctx_digest_get( const CCIContext cciContext, const cci_b *digestBuffer, cci_t *digestLength ); +cci_st ccip_algorithm_set_attr( const CCIAlgorithm algorithm, const CCI_ATTRIBUTE_ID attributeId, cci_g value ); +cci_bool ccip_pvr_set_param( const CCIProvider provider, cci_t paramater, cci_g value ); +CCIProvider ccip_default_provider( void ); +#define ccip_ctx_output_buffer( ctx ) ( (ctx)->attributes[CCI_OUTPUT_BUFFER] ) +#define ccip_ctx_output_buffer_length( ctx ) ( (cci_t *)(ctx)->attributes[CCI_OUTPUT_LENGTH] ) +#define cciDebug +#define CCI_VERBOSE_TRACE 0x001 +#define CCI_VERBOSE_ERROR 0x002 +#define CCI_VERBOSE_DETAIL 0x003 +#define CCI_VERBOSE_DEBUG 0x004 +#define CCI_VERBOSE_FATAL 0x005 + + +/* +** +** --- Public Prototypes... +** +*/ +cci_st cciSharedRegionSet( cci_t sharedSegmentSize ); +cci_st cciTaskPrioritySet( cci_t taskPrority ); +void cciShowVersion( void ); +cci_st cciSetNativeAlgorithm( CCI_NATIVE_ALG_FUNCPTR nativeFunctPtr ); + +cci_st cciCipher( const CCI_PROVIDER_ID providerId, CCI_ALGORITHM_ID algorithmId, const cci_t direction, + const CCI_MODE_CONSTANTS cipherMode, const cci_b *key, const cci_t keyLength, const cci_b *inputBuffer, + const cci_t inputLength, cci_b *outputBuffer, cci_t *outputLength, const cci_g initVector, + const cci_t initVectorLength ); +cci_st cciHashBlock( const CCI_PROVIDER_ID providerId, const CCI_ALGORITHM_ID algorithmId, + const cci_b *input, const cci_t inputLength, + cci_b *digest, cci_t *digestLength ); +cci_st cciHmacInit( CCIContext *cciContext, const CCI_PROVIDER_ID providerId, + const CCI_ALGORITHM_ID algorithmId, const cci_b *key, const cci_t keyLength ); +cci_st cciHmacBlock( const CCI_PROVIDER_ID providerId, const CCI_ALGORITHM_ID algorithmId, + const cci_b *key, const cci_t keyLength, + const cci_b *input, const cci_t inputLength, + cci_b *digest, cci_t *digestLength ); +cci_st cciLibInit( void ); +cci_st cciLibUnInit( void ); + + +cci_st cciProviderCompare( const CCI_PROVIDER_ID providerId ); +cci_st cciProviderVerify( const CCI_PROVIDER_ID providerId, const CCI_CLASS_ID cciClass, CCI_ALGORITHM_ID ); +cci_st cciProviderValidate( const CCI_PROVIDER_ID providerId ); +cci_st cciProviderBenchmark( const CCI_PROVIDER_ID providerId ); + +cci_st cciRand( const CCI_PROVIDER_ID providerId, cci_b *buffer, const cci_t numBytes ); +cci_st cciRandSeed(const CCI_PROVIDER_ID providerId, cci_b *buffer, const cci_t numBytes ); + +cci_st cciProviderLoad( const CCIProviderLoadProc providerLoadProc, CCI_PROVIDER_ID *providerId ); +cci_st cciProviderUnload( const CCI_PROVIDER_ID providerId ); +cci_st cciProviderInherit( const CCI_PROVIDER_ID providerId ); + +cci_st cciPoolCreateReg( CCIPool *pool, cci_t elementSize, cci_t poolSize, cci_t poolMax, CCI_POOLELEM_FUNCPTR init, CCI_POOLELEM_FUNCPTR uninit ); +cci_st cciPoolDestroy( CCIPool pool ); +cci_st cciPoolAlloc( CCIPool pool, void **object, CCI_POOL_FLAG waitFlag ); +cci_st cciPoolRelease( CCIPool pool, void *object ); + + +/* +** +** --- CCI Allocation functions +** +*/ +void *cciAlloc( const size_t blocksize ); +void cciMemFunctions(const CCI_REALLOC_FUNCPTR reallocProc, const CCI_MALLOC_FUNCPTR mallocProc,const CCI_FREE_FUNCPTR freeProc ); +void cciFree( void *memblock ); +void *cciRealloc( void *memblock, const size_t blocksize ); +cci_st cciSetSharedRegionSize( cci_t sharedSegmentSize ); +void cciStats(); + +/* +** +** --- CCI Shared Memory functions +** +*/ +void cciSharedMemFunctions + ( + const CCI_SD_OPEN_FUNCPTR sdOpenProc, + const CCI_SD_UNMAP_DELETE_FUNCPTR sdUnmapDeleteProc, + const CCI_VMTRANSLATE_FUNCPTR vmTranslateProc + ); + +/* +** +** --- CCI Application API context processing functions +** +*/ +cci_st cciCtxCreate( CCIContext *cciContext, const CCI_PROVIDER_ID providerId, const CCI_CLASS cryptoClass, + const CCI_ALGORITHM_ID algorithmId ); +cci_st cciCtxExecute( const CCIContext cciContext ); +cci_st cciCtxDigestLenGet( const CCIContext cciContext ); +cci_st cciCtxIvLenGet( const CCIContext cciContext ); +cci_st cciCtxDestroy( CCIContext cciContext ); +cci_st cciCtxInit( CCIContext cciContext, const CCI_PROVIDER_ID providerId, const CCI_CLASS cryptoClass, + const CCI_ALGORITHM_ID algorithmId ); +cci_st cciCtxClear( CCIContext cciContext ); +cci_st cciCtxPoolAlloc( CCIPool pool, CCIContext *cciContext, + const CCI_PROVIDER_ID providerId, const CCI_CLASS cryptoClass, + const CCI_ALGORITHM_ID algorithmId, CCI_POOL_FLAG waitFlag ); +cci_st cciCtxPoolRelease( CCIPool pool, CCIContext cciContext ); +cci_st cciCtxAsyncStatus( CCIContext cciContext, cci_st cciStatus ); +cci_st cciCtxCipher( const CCIContext cciContext, const cci_b *inputBuffer, const cci_t inputLength, + const cci_b *outputBuffer, cci_t *outputLength ); +cci_st cciCtxCompress( const CCIContext cciContext, const cci_b *inputBuffer, const cci_t inputLength, + const cci_b *ouputBuffer, cci_t *outputLength ); +cci_bool cciIsAlgorithmSet( const CCI_PROVIDER_ID providerId, const CCI_CLASS cryptoClass, const CCI_ALGORITHM_ID algorithmId ); +cci_bool cciIsNative( const CCI_PROVIDER_ID providerId, const CCI_CLASS cryptoClass, const CCI_ALGORITHM_ID algorithmId ); +cci_st cciCtxHashCopy( CCIContext destCtx, CCIContext srcCtx ); + + +/* +** +** --- CCI Provider definition functions +** +*/ +cci_st cciProviderCreate( CCIProvider *provider, const cci_z providerName, + const CCI_PROVIDER_IDINIT_FUNCPTR initHandler, + const CCI_PROVIDER_IDUNINIT_FUNCPTR uninitHandler ); +cci_b *cciProviderName( const CCI_PROVIDER_ID providerId ); +cci_st cciProviderAlgorithmSet( const CCIProvider provider, const CCIAlgorithm algorithm ); +void cciProviderIntegerTableSet( const CCIProvider provider, const CCIIntegerTable *integerTable ); +cci_st cciProviderDestroy( const CCIProvider provider ); + +cci_st cciAlgorithmCreate( CCIAlgorithm *algorithm, const CCI_CLASS cryptoClass, const CCI_ALGORITHM_ID algorithmId ); +cci_st cciAlgorithmHandlerSet( const CCIAlgorithm algorithm, const CCI_SESSION_HANDLER sessionHandler, + CCI_SESSION_FUNCPTR handler ); +cci_st cciAlgorithmDestroy( const CCIAlgorithm algorithm ); + +/* +** +** --- CCI large Integer functions +** +*/ +#define cciNumBytes( op ) ((cciNumBits( op ) + 7)/8) +#define cciIsOdd( op ) (cciTestBit( op, 0 )) +#define cciIsEven( op ) (!cciIsOdd( op )) +#define cciSetZero( op ) (cciSetWord(op,0)) +#define cciInc( op ) (cciAddWord( op, op, 1 )) +#define cciDec( op ) (cciSubWord( op, op, 1 )) +#define cciIsWord( op, w ) (!cciCmpWord( op, w )?1:0) +#define cciIsZero( op ) (!cciCmpWord( op, 0 )?1:0) +#define cciSqr( rop, op ) (cciExpWord( rop, op, 2 )) +#define cciModAdd( rop, op1, op2, n){cci_m t=cciIntegerDup( rop );cciAdd( t, op1, op2);cciMod( rop, t, n);cciIntegerFree(t);} +#define cciModSub( rop, op1, op2, n){cci_m t=cciIntegerDup( rop );cciSub( t, op1, op2);cciMod( rop, t, n);cciIntegerFree(t);} +#define cciModMul( rop, op1, op2, n){cci_m t=cciIntegerDup( rop );cciMul( t, op1, op2);cciMod( rop, t, n);cciIntegerFree(t);} +#define cciModSqr( rop, op1, n) {cci_m t=cciIntegerDup( rop );cciSqr( t, op1 );cciMod( rop, t, n);cciIntegerFree(t);} + + +void cciGcd( cci_m rop, cci_m op1, cci_m op2 ); +cci_m cciInteger( CCI_PROVIDER_ID providerId ); +cci_st cciIntegerFree( cci_m op1 ); + +cci_m cciIntegerDec( CCI_PROVIDER_ID providerId, cci_z decValue ); +cci_m cciIntegerHex( CCI_PROVIDER_ID providerId, cci_z hexValue ); +cci_m cciIntegerBin( CCI_PROVIDER_ID providerId, cci_b *binvalue, cci_t binLength ); +cci_m cciIntegerDup( cci_m op ); + +void cciRandomInt( cci_m rop, cci_t numBits ); +void cciPrime( cci_m rop, cci_t numBits ); +cci_bool cciIsPrime( cci_m op1 ); + +void cciImportBin( cci_m op, cci_b *byteArray, cci_t binLength ); +cci_t cciExportBin( cci_m op, cci_b **byteArray ); +void cciCopy( cci_m op1, cci_m op2 ); + +void cciSetWord( cci_m op1, cci_t wordValue ); +void cciSetDec( cci_m op, cci_z decValue ); +void cciSetHex( cci_m op, cci_z hexValue ); + +void cciAddWord( cci_m rop, cci_m op, cci_t value ); +void cciSubWord( cci_m rop, cci_m op, cci_t value ); +void cciMulWord( cci_m rop, cci_m op, cci_t value ); +void cciExpWord( cci_m rop, cci_m op, cci_t value ); +void cciModWord( cci_m rop, cci_m op, cci_t modulas ); + +cci_b *cciHexStr( cci_m op1 ); +cci_b *cciDecStr( cci_m op1 ); + +void cciAdd( cci_m rop, cci_m op1, cci_m op2 ); +void cciSub( cci_m rop, cci_m op1, cci_m op2 ); +void cciMul( cci_m rop, cci_m op1, cci_m op2 ); +void cciDiv( cci_m rop, cci_m op1, cci_m op2, cci_m remainder ); +void cciExp( cci_m rop, cci_m op1, cci_m exponent ); +void cciMod( cci_m rop, cci_m op1, cci_m modulas ); +void cciModExp( cci_m, cci_m, cci_m, cci_m ); +void cciModInverse( cci_m rop, cci_m op1, cci_m modulas ); + +int cciCmp( cci_m op1, cci_m op2 ); +int cciCmpWord( cci_m op, cci_t value ); +int cciCmpDec( cci_m op, cci_z decValue ); +int cciCmpHex( cci_m op, cci_z hexValue ); + +void cciLShift( cci_m rop, cci_m op1, cci_t shift ); +void cciRShift( cci_m rop, cci_m op1, cci_t shift ); + +cci_bool cciIsPos( cci_m op1 ); +cci_bool cciIsNeg( cci_m op1 ); +void cciPos( cci_m op1 ); +void cciNeg( cci_m op1 ); + +cci_t cciNumBits( cci_m op1 ); +cci_bool cciTestBit( cci_m op, cci_t bit ); +cci_bool cciSetBit( cci_m op, cci_t bit ); +cci_bool cciClearBit( cci_m op, cci_t bit ); +cci_bool cciMaskBits( cci_m op, cci_t numBits ); + +cci_b *cciHexToBin( cci_z hexStr, cci_t *retBytes ); +cci_z cciBinToHex( cci_b *numBuffer, cci_t numBytes, cci_b *buffer, cci_t bufferLength, + cci_bool lsbFirst ); + +/* +** --- Obsolete Large Integer routines. Other routines whose interfaces can't be touched +** include cciIntegerBin(), cciIntegerFree() and cciExportBin() +*/ +cci_m cciModExpObsolete( cci_m op, cci_m exponent, cci_m modulas ); +#define cci_mp_initBin cciIntegerBin +#define cci_mp_destroy cciIntegerFree +#define cci_mp_export_bin cciExportBin +#define cci_mp_modExp cciModExpObsolete + + + + +/* +** +** --- CCI PUBLIC KEY functions +** +*/ +cci_st cciPKIKeyCreate( const CCI_PROVIDER_ID providerId, const CCI_PUBLIC_KEY_TYPE pkType, + CCIPublicKey *publicKey ); +cci_st cciPKIKeyDestroy( const CCIPublicKey publicKey ); +CCI_PUBLICKEY cciPKIAlgorithm( CCIPublicKey publicKey ); +cci_st cciPKIKeyCompSet( const CCIPublicKey publicKey, const CCI_PUBLIC_KEY_COMPONENT compType, + const cci_b *component, const cci_t compLength ); +cci_st cciPKIKeyCompGet( const CCIPublicKey publicKey, const CCI_PUBLIC_KEY_COMPONENT compType, + cci_b **component, cci_t *compLength ); +cci_st cciPKIGenerateKeys( CCI_PROVIDER_ID providerId, CCI_PUBLICKEY pkiAlgorithmType, + CCIPublicKey *privateKey, CCIPublicKey *publicKey, cci_t keyLength ); +cci_st cciPKISignMessage( CCIPublicKey privateKey, cci_t signType, + cci_b *message, cci_t messageLength, + cci_b **signature, cci_t *signatureLength ); +cci_st cciPKIVerifyMessage( CCIPublicKey publicKey, cci_t signType, + cci_b *message, cci_t messageLength, + cci_b *signature, cci_t signatureLength ); +cci_st cciPKISignDigest( CCIPublicKey privateKey, cci_t signType, + cci_b *digest, + cci_b **signature, cci_t *signatureLength ); +cci_st cciPKIVerifyDigest( CCIPublicKey publicKey, cci_t signType, + cci_b *digest, + cci_b *signature, cci_t signatureLength ); +cci_st cciPKIEncrypt( CCIPublicKey publicKey, cci_t paddingFormat, cci_t hashingFormat, + cci_b *plainText, cci_t plainTextLength, + cci_b **cipherText, cci_t *cipherTextLength); +cci_st cciPKIDecrypt( CCIPublicKey privateKey, cci_t paddingFormat, cci_t hashingFormat, + cci_b *cipherText, cci_t cipherTextLength, + cci_b **plainText, cci_t *plaintTextLength ); +cci_st cciPKIBlindingSet( CCIPublicKey publicKey, BOOL blindEnable ); +cci_st cciPKIBlindingGet( CCIPublicKey publicKey, BOOL *blindState ); +cci_t cciPKISize( CCIPublicKey publicPrivateKey ); + + +cci_st cciCtxPKIKeyGen( const CCIContext cciContext ); +cci_st cciCtxPKISign( const CCIContext cciContext ); +cci_st cciCtxPKIVerify( const CCIContext cciContext ); +cci_st cciCtxPKIEncrypt( const CCIContext cciContext ); +cci_st cciCtxPKIDecrypt( const CCIContext cciContext ); + + +/* +** --- For backward compatibility, keep older status codes around for a while... +**/ +#define CCI_SUCCESS S_cciLib_SUCCESS +#define CCI_FAILURE S_cciLib_FAILURE +#define CCI_LIB_ALREADY_INITIALIZED S_cciLib_LIB_ALREADY_INITIALIZED +#define CCI_LIB_NOT_INITIALIZED S_cciLib_LIB_NOT_INITIALIZED +#define CCI_CONTEXT_IS_INVALID S_cciLib_CONTEXT_IS_INVALID +#define CCI_UNKNOWN_ATTRIBUTE S_cciLib_UNKNOWN_ATTRIBUTE +#define CCI_UNEXPECTED_ATTRIBUTE S_cciLib_UNEXPECTED_ATTRIBUTE +#define CCI_UNEXPECTED_ATTRIBUTE_TYPE S_cciLib_UNEXPECTED_ATTRIBUTE_TYPE +#define CCI_UNKNOWN_ATTRIBUTE_DATATYPE S_cciLib_UNKNOWN_ATTRIBUTE_DATATYPE +#define CCI_ATTRIBUTE_NOT_FOUND S_cciLib_ATTRIBUTE_NOT_FOUND +#define CCI_INVALID_ATTRIBUTE_VALUE S_cciLib_INVALID_ATTRIBUTE_VALUE +#define CCI_MISSING_ATTRIBUTE S_cciLib_MISSING_ATTRIBUTE +#define CCI_MEMALLOC_FAILED S_cciLib_MEMALLOC_FAILED +#define CCI_MORE_DATA S_cciLib_MORE_DATA +#define CCI_NO_MORE_DATA S_cciLib_NO_MORE_DATA +#define CCI_ALGORITHM_NOT_SUPPORTED S_cciLib_ALGORITHM_NOT_SUPPORTED +#define CCI_PROVIDER_NOT_REGISTED S_cciLib_PROVIDER_NOT_REGISTED +#define CCI_INVALID_ALGORITHM_ID S_cciLib_INVALID_ALGORITHM_ID +#define CCI_INVALID_CRYPTO_CLASS_ID S_cciLib_INVALID_CRYPTO_CLASS_ID +#define CCI_INVALID_PROVIDER_ID S_cciLib_INVALID_PROVIDER_ID +#define CCI_PROVIDER_NULL_FROM_LOADPROC S_cciLib_PROVIDER_NULL_FROM_LOADPROC +#define CCI_PROVIDER_INIT_FAILED S_cciLib_PROVIDER_INIT_FAILED +#define CCI_PROVIDER_DEFINED_STATUS S_cciLib_PROVIDER_DEFINED_STATUS +#define CCI_INVALID_IDENTIFIER S_cciLib_INVALID_IDENTIFIER +#define CCI_PROVIDER_UNKNOWN_STATUS S_cciLib_PROVIDER_UNKNOWN_STATUS +#define CCI_INPUT_BUFFER_NOT_BYTE_ALIGNED S_cciLib_INPUT_BUFFER_NOT_BYTE_ALIGNED +#define CCI_CIPHER_MODE_NOT_SUPPORTED S_cciLib_CIPHER_MODE_NOT_SUPPORTED +#define CCI_INVALID_KEY_LENGTH S_cciLib_INVALID_KEY_LENGTH +#define CCI_PROVIDER_ALREADY_LOADED S_cciLib_PROVIDER_ALREADY_LOADED +#define CCI_OUTPUT_BUFFER_TOO_SMALL S_cciLib_OUTPUT_BUFFER_TOO_SMALL +#define CCI_INVALID_IV_LENGTH S_cciLib_INVALID_IV_LENGTH +#define CCI_PARAMETER_STRING_TOO_LONG S_cciLib_PARAMETER_STRING_TOO_LONG +#define CCI_DECODING_ERROR S_cciLib_DECODING_ERROR +#define CCI_MESSAGE_TOO_LONG S_cciLib_MESSAGE_TOO_LONG +#define CCI_INTENDED_MESSAGE_TOO_SHORT S_cciLib_INTENDED_MESSAGE_TOO_SHORT +#define CCI_INVALID_HASH_FUNCTION S_cciLib_INVALID_HASH_FUNCTION +#define CCI_INVALID_ENCODING_FORMAT S_cciLib_INVALID_ENCODING_FORMAT +#define CCI_MODULAS_TOO_SMALL S_cciLib_MODULAS_TOO_SMALL +#define CCI_INVALID_SIGNATURE S_cciLib_INVALID_SIGNATURE +#define CCI_SESSION_OPEN_ERROR S_cciLib_SESSION_OPEN_ERROR +#define CCI_VALIDATION_TEST_NOT_AVAIL S_cciLib_VALIDATION_TEST_NOT_AVAIL +#define CCI_MAX_MTU_LENGTH_EXCEEDED S_cciLib_MAX_MTU_LENGTH_EXCEEDED +#define CCI_DIGEST_BUFFER_TOO_SMALL S_cciLib_DIGEST_BUFFER_TOO_SMALL +#define CCI_PROVIDER_SIGNATURE_INVALID S_cciLib_PROVIDER_SIGNATURE_INVALID + + + + +/* +** --- For backward compatibility, reference previous function names... +*/ +#define cci_cipher cciCipher +#define cci_hmac_block cciHmacBlock +#define cci_hmac_init cciHmacInit +#define cci_hmac_update cciHmacUpdate +#define cci_hmac_final cciHmacFinal +#define cci_hash_block cciHashBlock +#define cci_hash_init cciHashInit +#define cci_hash_update cciHashUpdate +#define cci_hash_final cciHashFinal +#define cci_init cciLibInit +#define cci_done cciLibUnInit +#define cci_rand_num cciRand +#define cci_rand_seed cciRandSeed +#define cci_pvr_define cciProviderCreate +#define cci_pvr_set_param cciProviderAttrSet +#define cci_pvr_get_param cciProviderAttrGet +#define cci_pvr_add_algorithm cciProviderAlgorithmSet +#define cci_pvr_destroy cciProviderDestroy +#define cci_pvr_compare cciProviderCompare +#define cci_validate_algorithm cciProviderVerify +#define cci_pvr_validate cciProviderValidate +#define cci_pvr_performance cciProviderBenchmark +#define cci_load cciProviderLoad +#define cci_unload cciProviderUnload +#define cci_use_software_default cciProviderInherit +#define cci_alg_define cciAlgorithmCreate +#define cci_alg_set_handler cciAlgorithmHandlerSet +#define cci_alg_destroy cciAlgorithmDestroy +#define cci_is_algorithm_avail cciIsAlgorithmSet +#define cci_activity_cb cciActivityCbSet +#define cci_ctx_pool_create cciCtxPoolCreate +#define cci_ctx_pool_alloc cciCtxPoolAlloc +#define cci_ctx_pool_release cciCtxPoolRelease +#define cci_ctx_pool_destroy cciCtxPoolDestroy +#define cci_pool_create cciPoolCreate +#define cci_pool_alloc cciPoolAlloc +#define cci_pool_release cciPoolRelease +#define cci_pool_destroy cciPoolDestroy +#define cci_hex_to_bin cciHexToBin +#define cci_bin_to_hex cciBinToHex +#define cci_ctx_create cciCtxCreate +#define cci_ctx_init cciCtxInit +#define cci_ctx_destroy cciCtxDestroy +#define cci_ctx_update cciCtxUpdate +#define cci_ctx_set_attr cciCtxAttrSet +#define cci_ctx_get_attr cciCtxAttrGet +#define cci_ctx_clr_attr cciCtxAttrClr +#define cci_ctx_cipher cciCtxCipher +#define cci_ctx_digest_length cciCtxDigestLenGet +#define cci_ctx_iv_length cciCtxIvLenGet +#define cci_ctx_compression cciCtxCompress +#define cci_notification cciCtxAsyncStatus +#define cci_ctx_async_req cciCtxIsAsyncReq +#define cci_ctx_clear cciCtxClear +#define cci_ctx_provider cciCtxProviderId +#define cci_ctx_algorithm cciCtxAlgorithmId +#define cci_ctx_class cciCtxClassId +#define cci_ctx_set_missing_attr cciCtxMissingAttrSet +#define cci_ctx_missing_attr cciCtxMissingAttrGet +#define cci_ctx_set_user_object cciCtxUserObjectSet +#define cci_ctx_get_user_object cciCtxUserObjectGet +#define cci_ctx_get_data cciCtxInputGet +#define cci_ctx_get_session_ctx cciCtxSessionCtxGet +#define cci_ctx_set_session_ctx cciCtxSessionCtxSet +#define cci_ctx_publickey_sign cciCtxPKISign +#define cci_ctx_publickey_verify cciCtxPKIVerify +#define cci_ctx_publickey_encrypt cciCtxPKIEncrypt +#define cci_ctx_publickey_decrypt cciCtxPKIDecrypt +#define cci_ctx_publickey_gen cciCtxPKIKeyGen +#define cci_pki_create(a,b,c) cciPKIKeyCreate(b,c,a) +#define cci_pki_destroy cciPKIKeyDestroy +#define cci_pki_set_component cciPKIKeyCompSet +#define cci_pki_get_component cciPKIKeyCompGet +#define cci_alloc cciAlloc +#define cci_free cciFree +#define cci_realloc cciRealloc +#define cci_debug cciDebug + +#define cci_hnd_get_attr cciCtxAttrGet +#define cci_hnd_get_data cciCtxInputGet +#define cci_hnd_algorithm cciCtxAlgorithmId +#define cci_hnd_set_missing_attr + +#define cci_r unsigned char * +#define cci_alg_set_attr(a,b,c,d) (cciAlgorithmAttrSet(a,b,c)) +#define cci_ctx_get_outputbuffer( ctx ) (ctx->attributes[CCI_OUTPUT_BUFFER]) +#define cci_ctx_get_outputbuffer_length( ctx ) ((cci_t *)ctx->attributes[CCI_OUTPUT_LENGTH]) +#define cciPKIBlinding cciPKIBlindingSet + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/IGMPv2/igmpCacheLib.h b/h/wrn/coreip/IGMPv2/igmpCacheLib.h new file mode 100644 index 0000000..d372942 --- /dev/null +++ b/h/wrn/coreip/IGMPv2/igmpCacheLib.h @@ -0,0 +1,45 @@ +/* igmpCacheLib.h - header */ + +/* Copyright 2000 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,20nov03,niq Remove copyright_wrs.h file inclusion +01d,04nov03,rlm Ran batch header path update for header re-org. +01c,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01b,03nov03,rlm Relocated from .wind_vxw_h to /vobs/Clarinet_IPv6 vob for + header re-org. +01a,29mar01,spm file creation: copied from version 01b of tor2_0.open_stack + branch (wpwr VOB, written by rae) for unified code base +*/ + +#ifndef __INCigmpCacheLibh +#define __INCigmpCacheLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define MAX_IF_INDEX 0x7fffffff /* following MIB RFCs specification */ +#define INVALID_IF_INDEX ~0 + +/* typedefs */ + +/* function declarations */ + +extern STATUS igmpCacheLibInit(void); +extern STATUS igmpCacheAdd(UINT32 mcastAddr, UINT32 ifIndex, void* groupClass); +extern STATUS igmpCacheDel(UINT32 mcastAddr, UINT32 ifIndex); +extern STATUS igmpCacheGet(UINT32 mcastAddr, UINT32 ifIndex, void* * pgroupClass); +extern STATUS igmpCacheNextGet(UINT32 mcastAddr, UINT32 ifIndex, UINT32 * nextMcastAddr, + UINT32 * nextIfIndex, void * * pgroupClass); +extern STATUS igmpCacheLibQuit (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCigmpCacheLibh */ diff --git a/h/wrn/coreip/IGMPv2/igmpPortLib.h b/h/wrn/coreip/IGMPv2/igmpPortLib.h new file mode 100644 index 0000000..e703b1d --- /dev/null +++ b/h/wrn/coreip/IGMPv2/igmpPortLib.h @@ -0,0 +1,53 @@ +/* igmpPortLib.h - header */ + +/* Copyright 2000 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02a,02aug04,rae Ported to Dual Stack +01e,20nov03,niq Remove copyright_wrs.h file inclusion +01d,04nov03,rlm Ran batch header path update for header re-org. +01c,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01b,03nov03,rlm Relocated from .wind_vxw_h to /vobs/Clarinet_IPv6 vob for + header re-org. +01a,29mar01,spm file creation: copied from version 01b of tor2_0.open_stack + branch (wpwr VOB, written by rae) for unified code base +*/ + +#ifndef __INCigmpPortLibh +#define __INCigmpPortLibh + +#ifdef __cplusplus +extern "C" { +#endif +#include + +/* defines */ + +#define MAX_IF_INDEX 0x7fffffff /* following MIB RFCs specification */ +#define INVALID_IF_INDEX ~0 + +/* typedefs */ + +typedef struct + { + AVLU_NODE avlBase; + UINT32 vif; + } IGMP_PORT_ENTRY; + +/* function declarations */ +extern STATUS igmpPortLibInit(void); +extern STATUS igmpPortAdd(UINT32 ifIndex, UINT32 vif); +extern STATUS igmpPortDel(UINT32 ifIndex); +extern STATUS igmpPortGet(UINT32 ifIndex, UINT32 * pvif); +extern STATUS igmpPortNextGet(UINT32 ifIndex, UINT32 * nextIfIndex, + UINT32 * pvif); +extern STATUS igmpRootGet(AVLU_TREE ** pigmpPortTreePtr); +extern STATUS igmpPortLibQuit(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCigmpPortLibh */ diff --git a/h/wrn/coreip/IGMPv2/igmpR.h b/h/wrn/coreip/IGMPv2/igmpR.h new file mode 100644 index 0000000..c8c03b6 --- /dev/null +++ b/h/wrn/coreip/IGMPv2/igmpR.h @@ -0,0 +1,42 @@ +/* igmpR.h - header file for Routerware igmp code */ + +/* Copyright 1997 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,11aug04,rae fix VIRTUAL_STACK +01f,20nov03,niq Remove copyright_wrs.h file inclusion +01e,10nov03,rlm 2nd pass of include update for header re-org. +01d,04nov03,rlm Ran batch header path update for header re-org. +01c,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01b,03nov03,rlm Relocated from .wind_vxw_h to /vobs/Clarinet_IPv6 vob for + header re-org. +01a,29mar01,spm file creation: copied from version 01b of tor2_0.open_stack + branch (wpwr VOB, written by rae) for unified code base; + fixed header entries +*/ + +#ifndef __INCigmpRh +#define __INCigmpRh + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#ifdef VIRTUAL_STACK +#include +#include +#include +#endif + +#endif /* __INCigmpRh*/ diff --git a/h/wrn/coreip/IGMPv2/igmpRouterLib.h b/h/wrn/coreip/IGMPv2/igmpRouterLib.h new file mode 100644 index 0000000..a448fe6 --- /dev/null +++ b/h/wrn/coreip/IGMPv2/igmpRouterLib.h @@ -0,0 +1,117 @@ +/* igmpRouterLib.h - igmp include file for router side code */ + +/* + * Copyright (c) 2000-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +02b,30mar05,kch Removed igmpCapSend() prototype. +02a,02aug04,rae Ported to Dual Stack +01m,04nov03,rlm Ran batch header path update for header re-org. +01l,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01k,03nov03,rlm Relocated from .wind_vxw_h to /vobs/Clarinet_IPv6 vob for + header re-org. +01j,13jan03,rae Merged from velocecp branch (SPRs 83920, 72379) +01i,21dec01,niq added missing #else for non-ANSI C prototypes +01h,18dec01,spm added modification history entry for automatic merge +01g,18dec01,wrs automatic merge from version 5 of tor3_x.synth.irvine remote + branch: added callback to report interface status to PIM +01f,31jul01,rae add new error code +01e,28jul01,spm added modification history entry for automatic merge; fixed + version numbers from 01f changes +01d,27jul01,cjh fixed prototype for igmpSetPimCallback +01c,28jun01,cjh added APIs for new mroute/PIM +01b,29may01,rae added fixes from Beta +01a,29mar01,spm file creation: copied from version 01d of tor2_0.open_stack + branch (wpwr VOB, written by rae) for unified code base +*/ + +#ifndef __INCigmpRouterLibh +#define __INCigmpRouterLibh + +#include +#include +#include +#include "lstLib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define S_igmpRouterLib_NOT_INITIALIZED (M_igmpRouterLib | 1) +#define S_igmpRouterLib_VIF_OUT_OF_RANGE (M_igmpRouterLib | 2) +#define S_igmpRouterLib_NO_FREE_VIFS (M_igmpRouterLib | 3) +#define S_igmpRouterLib_INVALID_PORT_NUM (M_igmpRouterLib | 4) +#define S_igmpRouterLib_NOT_ALL_IFS_DOWN (M_igmpRouterLib | 5) +#define S_igmpRouterLib_THRESHOLD_REQUIRED (M_igmpRouterLib | 6) +#define MAX_PORT_NUM MAXVIFS + + +/* typedefs and enum */ + +enum iCapType { IGMP_TIMER_CAP, IGMP_MSG_CAP }; + +enum igmpIfMsgType { IGMP_IF_DOWN, IGMP_IF_UP }; + + + +typedef struct + { + struct in_addr addr; + struct in_addr mask; + struct ifnet * pIfnet; + int index; + } IGMP_PORT_INFO; + +typedef struct + { + int type; + int index; + struct in_addr source; + struct igmp igmp; + } IGMP_CAPSULE; + +typedef struct + { + NODE node; + VOIDFUNCPTR pNotifyHook; + } IGMP_HOOK_LIST; + +/* function declarations */ + +extern STATUS igmpInterfaceEnable (char* pDrv, int unit, UINT32 threshold, + UINT32 rate_limit); +extern STATUS igmpInterfaceDisable (char* pDrv, int unit); +extern STATUS igmpGroupDelete(int port, struct in_addr groupAddr); +extern STATUS igmpGroupAdd(int port, struct in_addr groupAddr); +extern int igmpPktSend(int port, caddr_t buf, int bufLen, struct sockaddr * to, + int toLen); +extern struct in_addr * portToIP(int port); +extern UINT32 portToIf(int port); +extern struct ifnet * portToIfnet(int port); +extern STATUS igmpRouterLibInit(void); +extern STATUS igmpRouterLibQuit(void); + +extern STATUS igmpPimCallbackSet(VOIDFUNCPTR _pimHook); +extern STATUS igmpPimInterfaceCallbackSet(VOIDFUNCPTR _pimInterfaceHook); +extern STATUS igmpAssertSet(FUNCPTR _pAssertHook); +extern struct ifnet* igmpPortToIfnet (int port); +extern STATUS igmpNameToPort(char*pDrv, int unit); +extern STATUS igmpDebugSet(int debug); +extern STATUS igmpMfcSet(int messageType, struct mfcctl* gCtl); +extern STATUS igmpNotifyHookAdd (VOIDFUNCPTR); +extern STATUS igmpNotifyHookDelete (VOIDFUNCPTR); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCigmpRouterLibh */ diff --git a/h/wrn/coreip/IGMPv2/igmp_constants.h b/h/wrn/coreip/IGMPv2/igmp_constants.h new file mode 100644 index 0000000..873ce5e --- /dev/null +++ b/h/wrn/coreip/IGMPv2/igmp_constants.h @@ -0,0 +1,159 @@ +/* igmp_constants.h - constants for Routerware igmp code */ + +/* Copyright 1997 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,20nov03,niq Remove copyright_wrs.h file inclusion +01c,04nov03,rlm Ran batch header path update for header re-org. +01b,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01a,29mar01,spm file creation: copied from version 01b of tor2_0.open_stack + branch (wpwr VOB, written by rae) for unified code base; + fixed header entries +*/ + +#ifndef __INCigmp_constantsh +#define __INCigmp_constantsh + +#define IGMP_PROTOCOL_ID 2 + +#define IGMP_V2_DEFAULT_IP_TTL 1 + +/* was IGMP_DEFAULT_ROBUSTNESS_VARIABLE */ +#define IGMP_DEFAULT_ROBUSTNESS_VALUE 2 + +#define IGMP_DEFAULT_GROUP_QUERY_INTERVAL 10 + +/* was IGMP_DEFAULT_RESPONSE_TIME_DIVISOR */ +#define IGMP_HOST_RESPONSE_TIME_DIVIDER 10 + +#define IGMP_HOST_V1_ROUTER_PRESENT_TIMEOUT 400 + +#define IGMP_HOST_DEFAULT_V1_MAX_RESPONSE_TIME 10 + +#define IGMP_DEFAULT_GENERAL_QUERY_INTERVAL 125 + +#define IGMP_DEFAULT_GENERAL_QUERY_MAX_RESPONSE_INTERVAL 100 + +#define IGMP_PROTOCOL_PRIORITY_FOR_MFAPI 255 + +#define IP_ADDRESS_PRINT_BUFFER_SIZE 20 + +/* as of IGMPv2, the IGMP message size can only be 8 octets */ +#define IGMP_MINIMUM_MESSAGE_SIZE 8 + +#define IGMP_INVALID_STATE 255 + +#define IGMP_ROUTER_INVALID_EVENT 255 + +#define ROUTER_ALERT_OPTION_ID 0x94 + +#define ROUTER_ALERT_OPTION_LENGTH 0x04 + +#define ALL_SYSTEMS_MULTICAST_GROUP_ADDRESS 0xe0000001 + +#define ALL_ROUTERS_GROUP_MULTICAST_ADDRESS 0xe0000002 + +enum IGMP_ROUTER_PORT_STATE +{ + IGMP_ROUTER_PORT_NON_QUERIER_STATE, + IGMP_ROUTER_PORT_QUERIER_STATE, + + NUMBER_OF_IGMP_ROUTER_PORT_STATES +}; + +enum IGMP_ROUTER_PORT_EVENT +{ + IGMP_ROUTER_PORT_GENERAL_QUERY_TIMER_EXPIRED_EVENT, + IGMP_ROUTER_PORT_QUERY_RECEIVED_FROM_ROUTER_WITH_LOWER_IP_ADDRESS_EVENT, + IGMP_ROUTER_PORT_OTHER_QUERIER_PRESENT_TIMER_EXPIRED_EVENT, + + NUMBER_OF_IGMP_ROUTER_PORT_EVENTS +}; + +enum IGMP_ROUTER_GROUP_STATE +{ + IGMP_ROUTER_GROUP_NO_MEMBERS_PRESENT_STATE, + IGMP_ROUTER_GROUP_V1_MEMBERS_PRESENT_STATE, + IGMP_ROUTER_GROUP_V2_MEMBERS_PRESENT_STATE, + IGMP_ROUTER_GROUP_CHECKING_MEMBERSHIP_STATE, + + NUMBER_OF_IGMP_ROUTER_GROUP_STATES +}; + +enum IGMP_ROUTER_GROUP_EVENT +{ + IGMP_ROUTER_GROUP_V2_REPORT_RECEIVED_EVENT, + IGMP_ROUTER_GROUP_V1_REPORT_RECEIVED_EVENT, + IGMP_ROUTER_GROUP_LEAVE_MESSAGE_RECEIVED_EVENT, + IGMP_ROUTER_GROUP_SPECIFIC_TIMER_EXPIRED_EVENT, + IGMP_ROUTER_GROUP_RETRANSMIT_TIMER_EXPIRED_EVENT, + IGMP_ROUTER_GROUP_V1_HOST_TIMER_EXPIRED_EVENT, + IGMP_ROUTER_GROUP_SPECIFIC_QUERY_RECEIVED_EVENT, + + NUMBER_OF_IGMP_ROUTER_GROUP_EVENTS +}; + +enum IGMP_HOST_GROUP_STATE +{ + IGMP_HOST_GROUP_NON_MEMBER_STATE, + IGMP_HOST_GROUP_DELAYING_MEMBER_STATE, + IGMP_HOST_GROUP_IDLE_MEMBER_STATE, + + NUMBER_OF_IGMP_HOST_GROUP_STATES +}; + +enum IGMP_HOST_GROUP_EVENT +{ + IGMP_HOST_GROUP_JOIN_EVENT, + IGMP_HOST_GROUP_LEAVE_EVENT, + IGMP_HOST_GROUP_QUERY_RECEIVED_EVENT, + IGMP_HOST_GROUP_REPORT_RECEIVED_EVENT, + IGMP_HOST_GROUP_REPORT_DELAY_TIMER_EXPIRED_EVENT, + + NUMBER_OF_IGMP_HOST_GROUP_EVENTS +}; + +#ifndef IGMP_MEMBERSHIP_QUERY +enum IGMP_MESSAGE_TYPE +{ + IGMP_MEMBERSHIP_QUERY = 0x11, + IGMP_V1_MEMBERSHIP_REPORT = 0x12, + IGMP_V2_MEMBERSHIP_REPORT = 0x16, + IGMP_LEAVE_GROUP = 0x17, + + NUMBER_OF_IGMP_MESSAGE_TYPES = 0x18 +}; +#else +enum IGMP_MESSAGE_TYPE +{ + + NUMBER_OF_IGMP_MESSAGE_TYPES = 0x18 +}; +#endif /* IGMP_MEMBERSHIP_QUERY */ + +enum IGMP_VERSION +{ + IGMP_VERSION_1 = 1, + IGMP_VERSION_2 = 2 +}; + +enum IGMP_TRACE_GROUP +{ + IGMP_TRACE, + IGMP_ALARM_TRACE +}; + +#if defined (__IGMP_DEBUG__) +#define IGMP_PROTOCOL_ALARM_TRACE igmp_trace +#define IGMP_PROTOCOL_TRACE igmp_trace +#define IGMP_PROTOCOL_TRACE_DISPLAY_MESSAGE igmp_display_message +#else +#define DISPLAY_MESSAGE_NULL(a, b, c, d, e) +#define IGMP_PROTOCOL_ALARM_TRACE igmp_trace_null +#define IGMP_PROTOCOL_TRACE igmp_trace_null +#define IGMP_PROTOCOL_TRACE_DISPLAY_MESSAGE DISPLAY_MESSAGE_NULL +#endif /* __IGMP_DEBUG__ */ + +#endif /*__INCigmp_constantsh */ diff --git a/h/wrn/coreip/IGMPv2/igmp_display_string.h b/h/wrn/coreip/IGMPv2/igmp_display_string.h new file mode 100644 index 0000000..bc48a7c --- /dev/null +++ b/h/wrn/coreip/IGMPv2/igmp_display_string.h @@ -0,0 +1,100 @@ +/* igmp_display_string.h - header containing display helpers */ + +/* Copyright 1996 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,20nov03,niq Remove copyright_wrs.h file inclusion +01a,29mar01,spm file creation: copied from version 01a of tor2_0.open_stack + branch (wpwr VOB) for unified code base +*/ +#if defined (GLOBAL_FILE) + +char *igmp_message_type_string [NUMBER_OF_IGMP_MESSAGE_TYPES] = +{ +/* 0x00 */ "UNKNOWN_MESSAGE_TYPE", +/* 0x01 */ "UNKNOWN_MESSAGE_TYPE", +/* 0x02 */ "UNKNOWN_MESSAGE_TYPE", +/* 0x03 */ "UNKNOWN_MESSAGE_TYPE", +/* 0x04 */ "UNKNOWN_MESSAGE_TYPE", +/* 0x05 */ "UNKNOWN_MESSAGE_TYPE", +/* 0x06 */ "UNKNOWN_MESSAGE_TYPE", +/* 0x07 */ "UNKNOWN_MESSAGE_TYPE", +/* 0x08 */ "UNKNOWN_MESSAGE_TYPE", +/* 0x09 */ "UNKNOWN_MESSAGE_TYPE", +/* 0x0a */ "UNKNOWN_MESSAGE_TYPE", +/* 0x0b */ "UNKNOWN_MESSAGE_TYPE", +/* 0x0c */ "UNKNOWN_MESSAGE_TYPE", +/* 0x0d */ "UNKNOWN_MESSAGE_TYPE", +/* 0x0e */ "UNKNOWN_MESSAGE_TYPE", +/* 0x0f */ "UNKNOWN_MESSAGE_TYPE", +/* 0x10 */ "UNKNOWN_MESSAGE_TYPE", +/* 0x11 */ /* IGMP_MEMBERSHIP_QUERY */ "MEMBERSHIP_QUERY", +/* 0x12 */ /* IGMP_V1_MEMBERSHIP_REPORT */ "V1_MEMBERSHIP_REPORT", +/* 0x13 */ "UNKNOWN_MESSAGE_TYPE", +/* 0x14 */ "UNKNOWN_MESSAGE_TYPE", +/* 0x15 */ "UNKNOWN_MESSAGE_TYPE", +/* 0x16 */ /* IGMP_V2_MEMBERSHIP_REPORT */ "V2_MEMBERSHIP_REPORT", +/* 0x17 */ /* IGMP_LEAVE_GROUP */ "LEAVE_GROUP" +}; + +char *igmp_router_port_state_string [NUMBER_OF_IGMP_ROUTER_PORT_STATES] = +{ +/* IGMP_ROUTER_PORT_NON_QUERIER_STATE */ "NON_QUERIER", +/* IGMP_ROUTER_PORT_QUERIER_STATE */ "QUERIER" +}; + +char *igmp_router_port_event_string [NUMBER_OF_IGMP_ROUTER_PORT_EVENTS] = +{ +/* IGMP_ROUTER_PORT_GENERAL_QUERY_TIMER_EXPIRED_EVENT */ "GENERAL_QUERY_TIMER_EXPIRED", +/* IGMP_ROUTER_PORT_QUERY_RECEIVED_FROM_ROUTER_WITH_LOWER_IP_ADDRESS_EVENT */ "QUERY_RECEIVED_FROM_ROUTER_WITH_LOWER_IP_ADDRESS", +/* IGMP_ROUTER_PORT_OTHER_QUERIER_PRESENT_TIMER_EXPIRED_EVENT */ "OTHER_QUERIER_PRESENT_TIMER_EXPIRED" +}; + +char *igmp_router_group_state_string [NUMBER_OF_IGMP_ROUTER_GROUP_STATES] = +{ +/* IGMP_ROUTER_GROUP_NO_MEMBERS_PRESENT_STATE */ "NO_MEMBERS_PRESENT", +/* IGMP_ROUTER_GROUP_V1_MEMBERS_PRESENT_STATE */ "V1_MEMBERS_PRESENT", +/* IGMP_ROUTER_GROUP_V2_MEMBERS_PRESENT_STATE */ "V2_MEMBERS_PRESENT", +/* IGMP_ROUTER_GROUP_CHECKING_MEMBERSHIP_STATE */ "CHECKING_MEMBERSHIP" +}; + +char *igmp_router_group_event_string [NUMBER_OF_IGMP_ROUTER_GROUP_EVENTS] = +{ +/* IGMP_ROUTER_GROUP_V2_REPORT_RECEIVED_EVENT */ "V2_REPORT_RECEIVED", +/* IGMP_ROUTER_GROUP_V1_REPORT_RECEIVED_EVENT */ "V1_REPORT_RECEIVED", +/* IGMP_ROUTER_GROUP_LEAVE_MESSAGE_RECEIVED_EVENT */ "LEAVE_MESSAGE_RECEIVED", +/* IGMP_ROUTER_GROUP_SPECIFIC_TIMER_EXPIRED_EVENT */ "GROUP_SPECIFIC_TIMER_EXPIRED", +/* IGMP_ROUTER_GROUP_RETRANSMIT_TIMER_EXPIRED_EVENT */ "RETRANSMIT_TIMER_EXPIRED", +/* IGMP_ROUTER_GROUP_V1_HOST_TIMER_EXPIRED_EVENT */ "V1_HOST_PRESENT_TIMER_EXPIRED", +/* IGMP_ROUTER_GROUP_SPECIFIC_QUERY_RECEIVED_EVENT */ "GROUP_SPECIFIC_QUERY_RECEIVED" +}; + +char *igmp_host_group_event_string [NUMBER_OF_IGMP_HOST_GROUP_EVENTS] = +{ +/* IGMP_HOST_GROUP_JOIN_EVENT */ "JOIN_GROUP", +/* IGMP_HOST_GROUP_LEAVE_EVENT */ "LEAVE_GROUP", +/* IGMP_HOST_GROUP_QUERY_RECEIVED_EVENT */ "QUERY_RECEIVED", +/* IGMP_HOST_GROUP_REPORT_RECEIVED_EVENT */ "REPORT_RECEIVED", +/* IGMP_HOST_GROUP_REPORT_DELAY_TIMER_EXPIRED_EVENT */ "DELAY_TIMER_EXPIRED" +}; + +char *igmp_host_group_state_string [NUMBER_OF_IGMP_HOST_GROUP_STATES] = +{ +/* IGMP_HOST_GROUP_NON_MEMBER_STATE */ "NON_MEMBER", +/* IGMP_HOST_GROUP_DELAYING_MEMBER_STATE */ "DELAYING_MEMBER", +/* IGMP_HOST_GROUP_IDLE_MEMBER_STATE */ "IDLE_MEMBER" +}; + +#else /* ! GLOBAL_FILE */ + +extern char *igmp_message_type_string []; +extern char *igmp_router_port_state_string []; +extern char *igmp_router_port_event_string []; +extern char *igmp_router_group_state_string []; +extern char *igmp_router_group_event_string []; +extern char *igmp_host_group_event_string[]; +extern char *igmp_host_group_state_string[]; + +#endif /* GLOBAL_FILE */ diff --git a/h/wrn/coreip/IGMPv2/igmp_externs.h b/h/wrn/coreip/IGMPv2/igmp_externs.h new file mode 100644 index 0000000..9910391 --- /dev/null +++ b/h/wrn/coreip/IGMPv2/igmp_externs.h @@ -0,0 +1,35 @@ +/* igmp_externs.h - publicly accessible routines from Routerware igmp code */ + +/* Copyright 1997 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,20nov03,niq Remove copyright_wrs.h file inclusion +01d,04nov03,rlm Ran batch header path update for header re-org. +01c,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01b,03nov03,rlm Relocated from .wind_vxw_h to /vobs/Clarinet_IPv6 vob for + header re-org. +01a,29mar01,spm file creation: copied from version 01a of tor2_0.open_stack + branch (wpwr VOB, written by rae) for unified code base; + fixed header entries +*/ + +#ifndef __INCigmp_externsh +#define __INCigmp_externsh + +/* added (or changed ...) by rae */ + +void igmpCallBack(char * buf, struct in_addr srcAddr, UINT port); +void terminate_igmp_port (UINT port); +/* igmp_control.c */ +int igmp_shutdown (void); + +int initialize_igmp (ULONG clock_ticks_per_second); +void initialize_igmp_port (UINT port); + +void igmp_timer (void); + + + +#endif /* __INCigmp_externsh */ diff --git a/h/wrn/coreip/IGMPv2/igmp_globals.h b/h/wrn/coreip/IGMPv2/igmp_globals.h new file mode 100644 index 0000000..a6f30fa --- /dev/null +++ b/h/wrn/coreip/IGMPv2/igmp_globals.h @@ -0,0 +1,20 @@ +/* igmp_globals.h - file with the single global */ + +/* Copyright 1996 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,20nov03,niq Remove copyright_wrs.h file inclusion +01a,29mar01,spm file creation: copied from version 01c of tor2_0.open_stack + branch (wpwr VOB) for unified code base +*/ + +#if !defined (_IGMP_GLOBAL_H_) +#define _IGMP_GLOBAL_H_ + +#ifndef VIRTUAL_STACK +IGMP_CLASS vs_igmp; +#endif /* VIRTUAL_STACK */ + +#endif /* _IGMP_GLOBAL_H_ */ diff --git a/h/wrn/coreip/IGMPv2/igmp_prototypes.h b/h/wrn/coreip/IGMPv2/igmp_prototypes.h new file mode 100644 index 0000000..a3d4854 --- /dev/null +++ b/h/wrn/coreip/IGMPv2/igmp_prototypes.h @@ -0,0 +1,67 @@ +/* igmp_prototypes.h - non-accessible routines from Routerware igmp code */ + +/* Copyright 1997 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,20nov03,niq Remove copyright_wrs.h file inclusion +01d,04nov03,rlm Ran batch header path update for header re-org. +01c,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01b,03nov03,rlm Relocated from .wind_vxw_h to /vobs/Clarinet_IPv6 vob for + header re-org. +01a,29mar01,spm file creation: copied from version 01b of tor2_0.open_stack + branch (wpwr VOB, written by rae) for unified code base; + fixed header entries +*/ + +#ifndef __INCigmp_prototypesh +#define __INCigmp_prototypesh + +#include +#include + +/* igmp_router_receive.c */ +void igmp_router_process_received_message (IGMP_MESSAGE *sptr_igmp_message); + +/* igmp_router_state.c */ +void igmp_process_router_port_state_transition (UINT port, ULONG group_ip_address,enum IGMP_ROUTER_PORT_EVENT event); +void igmp_process_router_group_state_transition (UINT port, ULONG group_ip_address, enum IGMP_ROUTER_GROUP_EVENT event); +void igmp_router_start_general_query_timer (UINT port, ULONG group_ip_address); +void igmp_router_start_other_querier_present_timer (UINT port, ULONG group_ip_address); +void igmp_router_notify_routing_of_group_addition (UINT port, ULONG group_ip_address); +void igmp_router_notify_routing_of_group_deletion (UINT port, ULONG group_ip_address); +void igmp_router_start_group_specific_timer (UINT port, ULONG group_ip_address); +void igmp_router_start_v1_host_timer (UINT port, ULONG group_ip_address); +void igmp_router_start_star_timer (UINT port, ULONG group_ip_address); +void igmp_router_start_retransmit_timer (UINT port, ULONG group_ip_address); +void igmp_router_clear_retransmit_timer (UINT port, ULONG group_ip_address); +void igmp_router_tx_message (UINT port, ULONG group_ip_address); + +/* igmp_serialize_message.c */ +STATUS igmp_serialize_message (UINT port, IGMP_MESSAGE *sptr_igmp_message); + + +/* igmp_timer.c */ +void igmp_timer (void); + +/* igmp_transmit.c */ +void igmp_transmit_message (UINT port, ULONG group_ip_address, enum IGMP_MESSAGE_TYPE message_type, int copy_to_router, int copy_to_host); + +/* igmp_utilities.c */ +char * ipToDot (char * pString, ULONG ipAddr); /* slight mod of inet_ntoa_b */ +void igmp_trace (enum IGMP_TRACE_GROUP printf_group, const char *cptr_format, ...); +void igmp_trace_null (enum IGMP_TRACE_GROUP printf_group, const char *cptr_format, ...); +void igmp_display_message (ULONG source_address, ULONG destination_address, enum IGMP_MESSAGE_TYPE igmp_message_type, + UINT igmp_message_max_response_time, ULONG igmp_message_group_ip_address); +IGMP_GROUP_CLASS *igmp_add_group_to_port (ULONG group_ip_address, UINT port); +IGMP_GROUP_CLASS *igmp_get_matching_group_node_on_port (ULONG group_ip_address, UINT port); +IGMP_MESSAGE *igmp_create_message (void); +void igmp_free_message (IGMP_MESSAGE *sptr_igmp_message); +void igmp_initialize_timer (IGMP_TIMER *sptr_timer); +void igmp_increment_timer (IGMP_TIMER *sptr_timer); +int igmp_timer_has_expired (IGMP_TIMER *sptr_timer); +void igmp_enable_timer (IGMP_TIMER *sptr_timer, UINT expiry_time); +ULONG igmp_get_ip_address_for_port_from_ip (UINT port); + +#endif /* __INCigmp_prototypesh */ diff --git a/h/wrn/coreip/IGMPv2/igmp_state_machine.h b/h/wrn/coreip/IGMPv2/igmp_state_machine.h new file mode 100644 index 0000000..96287ea --- /dev/null +++ b/h/wrn/coreip/IGMPv2/igmp_state_machine.h @@ -0,0 +1,426 @@ +/* igmp_state_machine.h - state transition definitions and table */ + +/* Copyright 1997 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,20nov03,niq Remove copyright_wrs.h file inclusion +01a,29mar01,spm file creation: copied from version 01c of tor2_0.open_stack + branch (wpwr VOB) for unified code base +*/ + +#if !defined (_IGMP_STATE_MACHINE_H_) +#define _IGMP_STATE_MACHINE_H_ + +#if defined GLOBAL_FILE + +/***************************************************************************************************************/ +/* Port State Transition Table */ +/* */ +/* +----------------------------++---------------------------------------------------------------------+ */ +/* | || State | */ +/* | ++---------------------------------+-----------------------------------| */ +/* | || | | */ +/* | Event || Non Querier | Querier | */ +/* |============================++=================================+===================================| */ +/* |General Query Timer Expired || o No actions | o Trasmit General Query | */ +/* | || | o Start General Query Timer | */ +/* | || | | */ +/* | || -> Invalid state | -> Querier | */ +/* |----------------------------++---------------------------------+-----------------------------------| */ +/* |Query Received from Router || o Start other Querier | o Start Other Querier | */ +/* | with Lower IP address || Present Timer | Present Timer | */ +/* | || | | */ +/* | || -> Non Querier | -> Non Querier | */ +/* |----------------------------++---------------------------------+-----------------------------------| */ +/* |Other Querier Present timer || o Transmit General Query | o No actions | */ +/* | || o Start General Query Timer | | */ +/* | || | | */ +/* | || -> Querier | -> Invalid State | */ +/* +----------------------------++---------------------------------+-----------------------------------+ */ +/* */ +/* */ +/***************************************************************************************************************/ + +IGMP_ROUTER_PORT_STATE_TRANSITION_TABLE_ENTRY + igmp_router_port_state_transition_table[NUMBER_OF_IGMP_ROUTER_PORT_STATES][NUMBER_OF_IGMP_ROUTER_PORT_EVENTS] = +{ +/*-------------------------------------------------*/ +/* IGMP_ROUTER_PORT_NON_QUERIER_STATE */ +/*-------------------------------------------------*/ +{ +/* IGMP_ROUTER_PORT_GENERAL_QUERY_TIMER_EXPIRED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_PORT_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_PORT_QUERY_RECEIVED_FROM_ROUTER_WITH_LOWER_IP_ADDRESS_EVENT */ {igmp_router_start_other_querier_present_timer, + NULL, + NULL, + (enum IGMP_ROUTER_PORT_STATE) IGMP_ROUTER_PORT_NON_QUERIER_STATE}, + +/* IGMP_ROUTER_PORT_OTHER_QUERIER_PRESENT_TIMER_EXPIRED_EVENT */ {igmp_router_tx_message, + igmp_router_start_general_query_timer, + NULL, + (enum IGMP_ROUTER_PORT_STATE) IGMP_ROUTER_PORT_QUERIER_STATE} +}, +/*-------------------------------------------------*/ +/* IGMP_ROUTER_PORT_QUERIER_STATE */ +/*-------------------------------------------------*/ +{ +/* IGMP_ROUTER_PORT_GENERAL_QUERY_TIMER_EXPIRED_EVENT */ {igmp_router_tx_message, + igmp_router_start_general_query_timer, + NULL, + (enum IGMP_ROUTER_PORT_STATE) IGMP_ROUTER_PORT_QUERIER_STATE}, + +/* IGMP_ROUTER_PORT_QUERY_RECEIVED_FROM_ROUTER_WITH_LOWER_IP_ADDRESS_EVENT */ {igmp_router_start_other_querier_present_timer, + NULL, + NULL, + (enum IGMP_ROUTER_PORT_STATE) IGMP_ROUTER_PORT_NON_QUERIER_STATE}, + +/* IGMP_ROUTER_PORT_OTHER_QUERIER_PRESENT_TIMER_EXPIRED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_PORT_STATE) IGMP_INVALID_STATE} +} +}; + +/***************************************************************************************************************************/ +/* Querier Mode Group Next State Table */ +/* */ +/* +-------------------++----------------------------------------------------------------------------------------------+ */ +/* | || | */ +/* | || State | */ +/* | ++----------------------------------------------------------------------------------------------| */ +/* | Event || No Members Present V1 Members Present V2 Members Present Checking Membership | */ +/* |-------------------++----------------------+-----------------------+-----------------------+-----------------------| */ +/* |V2 Report Received || o Notify Routing of | o Start Group | o Start Group | o Start Group | */ +/* | || Group Addition | Specific Timer | Specific Timer | Specific Timer | */ +/* | || o Start Group | | | | */ +/* | || Specific Timer | | | | */ +/* | || | | | | */ +/* | ||-> V2 Members Present |-> V1 Members Present |-> V2 Members Present |-> V2 Members Present | */ +/* |-------------------++----------------------+-----------------------+-----------------------+-----------------------| */ +/* |V1 Report Received || o Notify Routing of | o Start Group | o Start Group | o Start Group | */ +/* | || Group Addition | Specific Timer | Specific Timer | Specific Timer | */ +/* | || o Start Group | o Start V1 Host | o Start V1 Host | o Start V1 Host | */ +/* | || Specific Timer | Timer | Timer | Timer | */ +/* | || o Start V1 Host | | | | */ +/* | || Timer | | | | */ +/* | || | | | | */ +/* | ||-> V1 Members Present |-> V1 Members Present |-> V1 Members Present |-> V1 Members Present | */ +/* |-------------------++----------------------+-----------------------+-----------------------+-----------------------| */ +/* |Leave Message || o No actions | o No actions | o Start star timer | o No actions | */ +/* | Received || | | o Start retransmit | | */ +/* | || | | timer | | */ +/* | || | | o Send group specific | | */ +/* | || | | query | | */ +/* | || | | | | */ +/* | ||-> Invalid State |-> Invalid State |-> Checking Membership |-> Invalid State | */ +/* |-------------------++----------------------+-----------------------+-----------------------+-----------------------| */ +/* |Group Specific || o No actions | o Notify Routing of | o Notify Routing of | o Notify Routing of | */ +/* | Timer Expired || | Group Deletion | Group Deletion | Group Deletion | */ +/* | || | | | o Clear retransmit | */ +/* | || | | | timer | */ +/* | || | | | | */ +/* | || | | | | */ +/* | ||-> Invalid State |-> No Members Present |-> No Members Present |-> No Members Present | */ +/* |-------------------++----------------------+-----------------------+-----------------------+-----------------------| */ +/* |Retransmit Timer || o No actions | o No actions | o No actions | o Send group specific | */ +/* | Expired || | | | query | */ +/* | || | | | o Start retransmit | */ +/* | || | | | timer | */ +/* | || | | | | */ +/* | ||-> Invalid State |-> Invalid State |-> Invalid State |-> Checking Membership | */ +/* |-------------------++----------------------+-----------------------+-----------------------+-----------------------| */ +/* |V1 Host Timer || o No actions | o No actions | o No actions | o No actions | */ +/* | Expired || | | | | */ +/* | || | | | | */ +/* | ||-> Invalid State |-> V2 Members Present |-> Invalid State |-> Invalid State | */ +/* |-------------------++----------------------+-----------------------+-----------------------+-----------------------| */ +/* |Group Specific || o No actions | o No actions | o No actions | o No actions | */ +/* | Query Received || | | | | */ +/* | ||-> Invalid State |-> Invalid State |-> Invalid State |-> Invalid State | */ +/* +-------------------++----------------------+-----------------------+-----------------------+-----------------------+ */ +/* */ +/***************************************************************************************************************************/ + +IGMP_ROUTER_GROUP_STATE_TRANSITION_TABLE_ENTRY + igmp_router_querier_mode_group_state_transition_table[NUMBER_OF_IGMP_ROUTER_GROUP_STATES][NUMBER_OF_IGMP_ROUTER_GROUP_EVENTS] = +{ +/*-------------------------------------------------*/ +/* IGMP_ROUTER_GROUP_NO_MEMBERS_PRESENT_STATE */ +/*-------------------------------------------------*/ +{ +/* IGMP_ROUTER_GROUP_V2_REPORT_RECEIVED_EVENT */ {igmp_router_notify_routing_of_group_addition, + igmp_router_start_group_specific_timer, + NULL, + (enum IGMP_ROUTER_GROUP_STATE) IGMP_ROUTER_GROUP_V2_MEMBERS_PRESENT_STATE}, + +/* IGMP_ROUTER_GROUP_V1_REPORT_RECEIVED_EVENT */ {igmp_router_notify_routing_of_group_addition, + igmp_router_start_group_specific_timer, + igmp_router_start_v1_host_timer, + (enum IGMP_ROUTER_GROUP_STATE) IGMP_ROUTER_GROUP_V1_MEMBERS_PRESENT_STATE}, + +/* IGMP_ROUTER_GROUP_LEAVE_MESSAGE_RECEIVED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_SPECIFIC_TIMER_EXPIRED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_RETRANSMIT_TIMER_EXPIRED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_V1_HOST_TIMER_EXPIRED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_SPECIFIC_QUERY_RECEIVED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE} +}, +/*-------------------------------------------------*/ +/* IGMP_ROUTER_GROUP_V1_MEMBERS_PRESENT_STATE */ +/*-------------------------------------------------*/ +{ +/* IGMP_ROUTER_GROUP_V2_REPORT_RECEIVED_EVENT */ {igmp_router_start_group_specific_timer, + NULL, + NULL, + (enum IGMP_ROUTER_GROUP_STATE) IGMP_ROUTER_GROUP_V1_MEMBERS_PRESENT_STATE}, + +/* IGMP_ROUTER_GROUP_V1_REPORT_RECEIVED_EVENT */ {igmp_router_start_group_specific_timer, + igmp_router_start_v1_host_timer, + NULL, + (enum IGMP_ROUTER_GROUP_STATE) IGMP_ROUTER_GROUP_V1_MEMBERS_PRESENT_STATE}, + +/* IGMP_ROUTER_GROUP_LEAVE_MESSAGE_RECEIVED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_SPECIFIC_TIMER_EXPIRED_EVENT */ {igmp_router_notify_routing_of_group_deletion, + NULL, + NULL, + (enum IGMP_ROUTER_GROUP_STATE) IGMP_ROUTER_GROUP_NO_MEMBERS_PRESENT_STATE}, + +/* IGMP_ROUTER_GROUP_RETRANSMIT_TIMER_EXPIRED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_V1_HOST_TIMER_EXPIRED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_ROUTER_GROUP_V2_MEMBERS_PRESENT_STATE}, + +/* IGMP_ROUTER_GROUP_SPECIFIC_QUERY_RECEIVED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE} +}, +/*-------------------------------------------------*/ +/* IGMP_ROUTER_GROUP_V2_MEMBERS_PRESENT_STATE */ +/*-------------------------------------------------*/ +{ +/* IGMP_ROUTER_GROUP_V2_REPORT_RECEIVED_EVENT */ {igmp_router_start_group_specific_timer, + NULL, + NULL, + (enum IGMP_ROUTER_GROUP_STATE) IGMP_ROUTER_GROUP_V2_MEMBERS_PRESENT_STATE}, + +/* IGMP_ROUTER_GROUP_V1_REPORT_RECEIVED_EVENT */ {igmp_router_start_group_specific_timer, + igmp_router_start_v1_host_timer, + NULL, + (enum IGMP_ROUTER_GROUP_STATE) IGMP_ROUTER_GROUP_V1_MEMBERS_PRESENT_STATE}, + +/* IGMP_ROUTER_GROUP_LEAVE_MESSAGE_RECEIVED_EVENT */ {igmp_router_start_star_timer, + igmp_router_start_retransmit_timer, + igmp_router_tx_message, + (enum IGMP_ROUTER_GROUP_STATE) IGMP_ROUTER_GROUP_CHECKING_MEMBERSHIP_STATE}, + +/* IGMP_ROUTER_GROUP_SPECIFIC_TIMER_EXPIRED_EVENT */ {igmp_router_notify_routing_of_group_deletion, + NULL, + NULL, + (enum IGMP_ROUTER_GROUP_STATE) IGMP_ROUTER_GROUP_NO_MEMBERS_PRESENT_STATE}, + +/* IGMP_ROUTER_GROUP_RETRANSMIT_TIMER_EXPIRED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_V1_HOST_TIMER_EXPIRED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_SPECIFIC_QUERY_RECEIVED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE} +}, +/*-------------------------------------------------*/ +/* IGMP_ROUTER_GROUP_CHECKING_MEMBERSHIP_STATE */ +/*-------------------------------------------------*/ +{ +/* IGMP_ROUTER_GROUP_V2_REPORT_RECEIVED_EVENT */ {igmp_router_start_group_specific_timer, + NULL, + NULL, + (enum IGMP_ROUTER_GROUP_STATE) IGMP_ROUTER_GROUP_V2_MEMBERS_PRESENT_STATE}, + +/* IGMP_ROUTER_GROUP_V1_REPORT_RECEIVED_EVENT */ {igmp_router_start_group_specific_timer, + igmp_router_start_v1_host_timer, + NULL, + (enum IGMP_ROUTER_GROUP_STATE) IGMP_ROUTER_GROUP_V1_MEMBERS_PRESENT_STATE}, + +/* IGMP_ROUTER_GROUP_LEAVE_MESSAGE_RECEIVED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_SPECIFIC_TIMER_EXPIRED_EVENT */ {igmp_router_notify_routing_of_group_deletion, + igmp_router_clear_retransmit_timer, + NULL, + (enum IGMP_ROUTER_GROUP_STATE) IGMP_ROUTER_GROUP_NO_MEMBERS_PRESENT_STATE}, + +/* IGMP_ROUTER_GROUP_RETRANSMIT_TIMER_EXPIRED_EVENT */ {igmp_router_tx_message, + igmp_router_start_retransmit_timer, + NULL, + (enum IGMP_ROUTER_GROUP_STATE) IGMP_ROUTER_GROUP_CHECKING_MEMBERSHIP_STATE}, + +/* IGMP_ROUTER_GROUP_V1_HOST_TIMER_EXPIRED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_SPECIFIC_QUERY_RECEIVED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE} +} +}; + +/***************************************************************************************************************************/ +/* Non Querier Mode Group State Transition Table */ +/* */ +/* +-------------------++----------------------------------------------------------------------------------------------+ */ +/* | || | */ +/* | || State | */ +/* | ++----------------------------------------------------------------------------------------------| */ +/* | Event || No Members Present V1 Members Present V2 Members Present Checking Membership | */ +/* |-------------------++----------------------+-----------------------+-----------------------+-----------------------| */ +/* |V2 Report Received || o Notify Routing of | o Start Group | o No actions | o Start Group | */ +/* | || group addition | Specific Timer | | Specific Timer | */ +/* | || o Start Group | | | | */ +/* | || Specific Timer | | | | */ +/* | || | | | | */ +/* | ||-> V1 Members Present |-> V1 Members Present |-> Invalid State |-> V1 Members Present | */ +/* |-------------------++----------------------+-----------------------+-----------------------+-----------------------| */ +/* |V1 Report Received || o Notify Routing of | o Start Group | o No actions | o Start Group | */ +/* | || group addition | Specific Timer | | Specific Timer | */ +/* | || o Start Group | | | | */ +/* | || Specific Timer | | | | */ +/* | || | | | | */ +/* | ||-> V1 Members Present |-> V1 Members Present |-> Invalid State |-> V1 Members Present | */ +/* |-------------------++----------------------+-----------------------+-----------------------+-----------------------| */ +/* |Leave Message || o No actions | o No actions | o No actions | o No actions | */ +/* | Received || | | | | */ +/* | ||-> Invalid State |-> Invalid State |-> Invalid State |-> Invalid State | */ +/* |-------------------++----------------------+-----------------------+-----------------------+-----------------------| */ +/* |Group Specific || o No actions | o Notify Routing of | o No actions | o Notify Routing of | */ +/* | Timer Expired || | Group Deletion | | Group Deletion | */ +/* | || | | | | */ +/* | ||-> Invalid State |-> No Members Present |-> Invalid State |-> No Members Present | */ +/* |-------------------++----------------------+-----------------------+-----------------------+-----------------------| */ +/* |Retransmit Timer || o No actions | o No actions | o No actions | o No actions | */ +/* | Expired || | | | | */ +/* | ||-> Invalid State |-> Invalid State |-> Invalid State |-> Invalid State | */ +/* |-------------------++----------------------+-----------------------+-----------------------+-----------------------| */ +/* |V1 Host Timer || o No actions | o No actions | o No actions | o No actions | */ +/* | Expired || | | | | */ +/* | || | | | | */ +/* | ||-> Invalid State |-> Invalid State |-> Invalid State |-> Invalid State | */ +/* |-------------------++----------------------+-----------------------+-----------------------+-----------------------| */ +/* |Group Specific || o No actions | o Start star timer | o No actions | o No actions | */ +/* | Query Received || | | | | */ +/* | || | | | | */ +/* | ||-> Invalid State |-> Checking Membership |-> Invalid State |-> Invalid State | */ +/* +-------------------++----------------------+-----------------------+-----------------------+-----------------------+ */ +/* */ +/***************************************************************************************************************************/ + +IGMP_ROUTER_GROUP_STATE_TRANSITION_TABLE_ENTRY + igmp_router_non_querier_mode_group_state_transition_table[NUMBER_OF_IGMP_ROUTER_GROUP_STATES][NUMBER_OF_IGMP_ROUTER_GROUP_EVENTS] = +{ +/*-------------------------------------------------*/ +/* IGMP_ROUTER_GROUP_NO_MEMBERS_PRESENT_STATE */ +/*-------------------------------------------------*/ +{ +/* IGMP_ROUTER_GROUP_V2_REPORT_RECEIVED_EVENT */ {igmp_router_notify_routing_of_group_addition, + igmp_router_start_group_specific_timer, + NULL, + (enum IGMP_ROUTER_GROUP_STATE) IGMP_ROUTER_GROUP_V1_MEMBERS_PRESENT_STATE}, + +/* IGMP_ROUTER_GROUP_V1_REPORT_RECEIVED_EVENT */ {igmp_router_notify_routing_of_group_addition, + igmp_router_start_group_specific_timer, + NULL, + (enum IGMP_ROUTER_GROUP_STATE) IGMP_ROUTER_GROUP_V1_MEMBERS_PRESENT_STATE}, + +/* IGMP_ROUTER_GROUP_LEAVE_MESSAGE_RECEIVED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_SPECIFIC_TIMER_EXPIRED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_RETRANSMIT_TIMER_EXPIRED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_V1_HOST_TIMER_EXPIRED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_SPECIFIC_QUERY_RECEIVED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE} +}, +/*-------------------------------------------------*/ +/* IGMP_ROUTER_GROUP_V1_MEMBERS_PRESENT_STATE */ +/*-------------------------------------------------*/ +{ +/* IGMP_ROUTER_GROUP_V2_REPORT_RECEIVED_EVENT */ {igmp_router_start_group_specific_timer, + NULL, + NULL, + (enum IGMP_ROUTER_GROUP_STATE) IGMP_ROUTER_GROUP_V1_MEMBERS_PRESENT_STATE}, + +/* IGMP_ROUTER_GROUP_V1_REPORT_RECEIVED_EVENT */ {igmp_router_start_group_specific_timer, + NULL, + NULL, + (enum IGMP_ROUTER_GROUP_STATE) IGMP_ROUTER_GROUP_V1_MEMBERS_PRESENT_STATE}, + +/* IGMP_ROUTER_GROUP_LEAVE_MESSAGE_RECEIVED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_SPECIFIC_TIMER_EXPIRED_EVENT */ {igmp_router_notify_routing_of_group_deletion, + NULL, + NULL, + (enum IGMP_ROUTER_GROUP_STATE) IGMP_ROUTER_GROUP_NO_MEMBERS_PRESENT_STATE}, + +/* IGMP_ROUTER_GROUP_RETRANSMIT_TIMER_EXPIRED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_V1_HOST_TIMER_EXPIRED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_SPECIFIC_QUERY_RECEIVED_EVENT */ {igmp_router_start_star_timer, + NULL, + NULL, + (enum IGMP_ROUTER_GROUP_STATE) IGMP_ROUTER_GROUP_CHECKING_MEMBERSHIP_STATE} +}, +/*-------------------------------------------------*/ +/* IGMP_ROUTER_GROUP_V2_MEMBERS_PRESENT_STATE */ +/*-------------------------------------------------*/ +{ +/* IGMP_ROUTER_GROUP_V2_REPORT_RECEIVED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_V1_REPORT_RECEIVED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_LEAVE_MESSAGE_RECEIVED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_SPECIFIC_TIMER_EXPIRED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_RETRANSMIT_TIMER_EXPIRED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_V1_HOST_TIMER_EXPIRED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_SPECIFIC_QUERY_RECEIVED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE} +}, +/*-------------------------------------------------*/ +/* IGMP_ROUTER_GROUP_CHECKING_MEMBERSHIP_STATE */ +/*-------------------------------------------------*/ +{ +/* IGMP_ROUTER_GROUP_V2_REPORT_RECEIVED_EVENT */ {igmp_router_start_group_specific_timer, + NULL, + NULL, + (enum IGMP_ROUTER_GROUP_STATE) IGMP_ROUTER_GROUP_V1_MEMBERS_PRESENT_STATE}, + +/* IGMP_ROUTER_GROUP_V1_REPORT_RECEIVED_EVENT */ {igmp_router_start_group_specific_timer, + NULL, + NULL, + (enum IGMP_ROUTER_GROUP_STATE) IGMP_ROUTER_GROUP_V1_MEMBERS_PRESENT_STATE}, + +/* IGMP_ROUTER_GROUP_LEAVE_MESSAGE_RECEIVED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_SPECIFIC_TIMER_EXPIRED_EVENT */ {igmp_router_notify_routing_of_group_deletion, + NULL, + NULL, + (enum IGMP_ROUTER_GROUP_STATE) IGMP_ROUTER_GROUP_NO_MEMBERS_PRESENT_STATE}, + +/* IGMP_ROUTER_GROUP_RETRANSMIT_TIMER_EXPIRED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_V1_HOST_TIMER_EXPIRED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE}, + +/* IGMP_ROUTER_GROUP_SPECIFIC_QUERY_RECEIVED_EVENT */ {NULL, NULL, NULL, (enum IGMP_ROUTER_GROUP_STATE) IGMP_INVALID_STATE} +} +}; + + +#else + +extern IGMP_ROUTER_PORT_STATE_TRANSITION_TABLE_ENTRY + igmp_router_port_state_transition_table[NUMBER_OF_IGMP_ROUTER_PORT_STATES][NUMBER_OF_IGMP_ROUTER_PORT_EVENTS]; +extern IGMP_ROUTER_GROUP_STATE_TRANSITION_TABLE_ENTRY + igmp_router_querier_mode_group_state_transition_table[NUMBER_OF_IGMP_ROUTER_GROUP_STATES][NUMBER_OF_IGMP_ROUTER_GROUP_EVENTS]; +extern IGMP_ROUTER_GROUP_STATE_TRANSITION_TABLE_ENTRY + igmp_router_non_querier_mode_group_state_transition_table[NUMBER_OF_IGMP_ROUTER_GROUP_STATES][NUMBER_OF_IGMP_ROUTER_GROUP_EVENTS]; +extern IGMP_HOST_STATE_TRANSITION_TABLE_ENTRY + igmp_host_group_state_transition_table[NUMBER_OF_IGMP_HOST_GROUP_STATES][NUMBER_OF_IGMP_HOST_GROUP_EVENTS]; + +#endif /* GLOBAL_FILE */ + +#endif /* _IGMP_STATE_MACHINE_H_ */ diff --git a/h/wrn/coreip/IGMPv2/igmp_state_machine_structures.h b/h/wrn/coreip/IGMPv2/igmp_state_machine_structures.h new file mode 100644 index 0000000..1f9bf11 --- /dev/null +++ b/h/wrn/coreip/IGMPv2/igmp_state_machine_structures.h @@ -0,0 +1,43 @@ +/* igmp_state_machine_structures.h - supporting structures for state machine */ + +/* Copyright 1997 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,20nov03,niq Remove copyright_wrs.h file inclusion +01b,29mar01,spm file creation: copied from version 01a of tor2_0.open_stack + branch (wpwr VOB) for unified code base +*/ + +#if !defined (_IGMP_STATEMACH_STRUCTURES_H_) +#define _IGMP_STATEMACH_STRUCTURES_H_ + +typedef struct IGMP_ROUTER_PORT_STATE_TRANSITION_TABLE_ENTRY +{ + void (*fptr_action_1) (UINT port, ULONG group_ip_address); + void (*fptr_action_2) (UINT port, ULONG group_ip_address); + void (*fptr_action_3) (UINT port, ULONG group_ip_address); + + enum IGMP_ROUTER_PORT_STATE next_state; +} IGMP_ROUTER_PORT_STATE_TRANSITION_TABLE_ENTRY; + +typedef struct IGMP_ROUTER_GROUP_STATE_TRANSITION_TABLE_ENTRY +{ + void (*fptr_action_1) (UINT port, ULONG group_ip_address); + void (*fptr_action_2) (UINT port, ULONG group_ip_address); + void (*fptr_action_3) (UINT port, ULONG group_ip_address); + + enum IGMP_ROUTER_GROUP_STATE next_state; +} IGMP_ROUTER_GROUP_STATE_TRANSITION_TABLE_ENTRY; + +typedef struct IGMP_HOST_STATE_TRANSITION_TABLE_ENTRY +{ + void (*fptr_action_1) (UINT port, ULONG group_ip_address); + void (*fptr_action_2) (UINT port, ULONG group_ip_address); + void (*fptr_action_3) (UINT port, ULONG group_ip_address); + + enum IGMP_HOST_GROUP_STATE next_state; +} IGMP_HOST_STATE_TRANSITION_TABLE_ENTRY; + +#endif /* _IGMP_STATEMACH_STRUCTURES_H_*/ diff --git a/h/wrn/coreip/IGMPv2/igmp_structures.h b/h/wrn/coreip/IGMPv2/igmp_structures.h new file mode 100644 index 0000000..0ee9439 --- /dev/null +++ b/h/wrn/coreip/IGMPv2/igmp_structures.h @@ -0,0 +1,195 @@ +/* igmp_structures.h - main structures from Routerware igmp code */ + +/* Copyright 1997 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,20nov03,niq Remove copyright_wrs.h file inclusion +01d,04nov03,rlm Ran batch header path update for header re-org. +01c,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01b,03nov03,rlm Relocated from .wind_vxw_h to /vobs/Clarinet_IPv6 vob for + header re-org. +01a,29mar01,spm file creation: copied from version 01b of tor2_0.open_stack + branch (wpwr VOB, written by rae) for unified code base; + fixed header entries +*/ + +#ifndef __INCigmp_structuresh +#define __INCigmp_structuresh + +#ifndef NUMBER_OF_IP_PORTS +#define NUMBER_OF_IP_PORTS 32 +#endif + +#include +#include + +typedef struct IGMP_MESSAGE +{ + enum IGMP_MESSAGE_TYPE type; + + UINT max_response_time; + + ULONG group_ip_address; + + ULONG source_ip_address; + + UINT receiving_port; + +} IGMP_MESSAGE; + +typedef struct IGMP_TIMER +{ + int enabled; + + UINT second_counter; + + UINT expiry_time; + +} IGMP_TIMER; + + +typedef struct IGMP_ROUTER_GROUP_CLASS +{ + enum IGMP_ROUTER_GROUP_STATE state; + + UINT group_specific_query_count; +/* same as last member query count */ + + IGMP_TIMER group_specific_timer; + + IGMP_TIMER retransmit_timer; + + IGMP_TIMER v1_host_timer; + +} IGMP_ROUTER_GROUP_CLASS; + +typedef struct IGMP_HOST_GROUP_CLASS +{ + enum IGMP_HOST_GROUP_STATE state; +/* NON_MEMBER | DELAYING_MEMBER | IDLE_MEMBER_STATE */ + + int this_host_was_last_reporter; + + IGMP_TIMER report_delay_timer; + +} IGMP_HOST_GROUP_CLASS; + +typedef struct IGMP_GROUP_CLASS +{ + NODE links; + + int enabled; + + UINT port_number; + + ULONG multicast_group_ip_address; + + ULONG ip_address_of_last_reporter; + + ULONG start_time; + + IGMP_ROUTER_GROUP_CLASS router_group; + + IGMP_HOST_GROUP_CLASS host_group; + + +} IGMP_GROUP_CLASS; + + +typedef struct IGMP_HOST_PORT_CLASS +{ + int v1_router_present; + + UINT v1_router_present_timer; + +} IGMP_HOST_PORT_CLASS; + +typedef struct IGMP_ROUTER_PORT_CLASS +{ + enum IGMP_ROUTER_PORT_STATE state; +/* specifies whether Querier or Non-Querier */ + + int initializing; + + UINT number_of_startup_queries_sent; + + UINT number_of_startup_queries_to_send; + + UINT startup_query_interval; + + UINT general_query_interval; + + IGMP_TIMER general_query_timer; + + UINT general_query_max_response_time; + + UINT other_querier_present_timeout; + + IGMP_TIMER other_querier_present_timer; + +} IGMP_ROUTER_PORT_CLASS; + +typedef struct IGMP_PORT_CLASS +{ + int enabled; + + int router_enabled; + + int host_enabled; + + enum IGMP_VERSION version; + + UINT robustness; + + UINT port_number; + + ULONG ip_address_of_port; + + ULONG ip_address_of_querier; + + UINT max_response_time_from_most_recent_query; + + IGMP_ROUTER_PORT_CLASS router_port; + + IGMP_HOST_PORT_CLASS host_port; + + /* RAE IGMP_MIB_INTERFACE_ENTRY igmpInterfaceEntry; */ + M2_IGMP igmpInterfaceEntry; + + LIST active_group_list; + +} IGMP_PORT_CLASS; + +typedef struct IGMP_TRACE_CLASS +{ + int enabled; + + int alarm_enabled; + +} IGMP_TRACE_CLASS; + +typedef struct IGMP_CLASS +{ + int initialization_breakpoint; + + int enabled; + + UINT clock_ticks_per_second; + + UINT number_of_snmp_time_ticks_per_clock_tick; + + UINT tick_counter; + + ULONG stack_id; + + UINT number_of_ports; + + IGMP_TRACE_CLASS trace; + + IGMP_PORT_CLASS port_table[NUMBER_OF_IP_PORTS]; + +} IGMP_CLASS; + +#endif /* __INCigmp_structuresh */ diff --git a/h/wrn/coreip/adv_net.h b/h/wrn/coreip/adv_net.h new file mode 100644 index 0000000..2b343a3 --- /dev/null +++ b/h/wrn/coreip/adv_net.h @@ -0,0 +1,112 @@ +/* adv_net.h - Network header for project facility build */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01m,27sep05,nee marked for deprecation; fixed build errors +01l,31jan05,sar Fix defects found in GTF code inspection of 10/26/2004 + as described in SPRs 106685 - 105688 (removed gtfLibInit) +01k,19sep04,spm updated hostname cache initialization for virtual stack + startup: removed obsolete hostSetup.h file +01j,04nov03,rlm Ran batch header path update for header re-org. +01i,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01h,15sep03,vvv updated path for new headers +01g,08sep03,vvv merged from ACCORDION_BASE6_MERGE_BASELINE +01f,26aug02,ham added string.h and taskLib.h +01e,18jul02,ham consolidated across t3/t22/t202. removed netconf.h, + added m2Ipv6Lib.h +01d,16jul02,hsh add semLib.h wdLib.h selectLib.h before clarinet.h to make sure + it compiles for ppc +01d,10apr02,rvr made changes required for tor202 porting +01d,28feb02,ham added route.h, sysctlbyname. +01c,27feb02,ham changed daemon.h to netLib.h +01b,08feb02,ham added missing externs to resolve compilation warnings. +01a,03feb02,ham wrote. +*/ + +#warning "This file is deprecated and will be removed in a future release" + +#ifndef __INCadv_neth +#define __INCadv_neth + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* new for virtualization*/ +#ifdef VIRTUAL_STACK +#include +#include +#endif /* VIRTUAL_STACK */ + + +/* Config params headers */ + +#include +#include +#include +#include + +/* extern */ + +extern int routec (char *); +extern int ifconfig (char *); +extern STATUS ndp (char *); +extern void netstatInit (void); +extern void netShowInit (void); +extern int sysctlbyname (char *, void *, size_t *, void *, size_t); + +/* old config macros */ + +#ifdef INCLUDE_NET_INIT +#define INCLUDE_NETWORK +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCadv_neth */ diff --git a/h/wrn/coreip/applUtilLib.h b/h/wrn/coreip/applUtilLib.h new file mode 100644 index 0000000..2097533 --- /dev/null +++ b/h/wrn/coreip/applUtilLib.h @@ -0,0 +1,642 @@ +/* applUtilLib.h - Application utility library */ + +/* Copyright 2001 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01n,07aug04,dlk Substantial changes for scalability and consistency with + syslog API. +01m,20aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01l,03aug04,nee Removing distinction between LOG_* as functions or macros + depending on whether its GNU or diab +01k,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01j,03feb04,zhr Added telnet client to logging categories +01j,27jan04,asr Added rlogin & remLib to logging categories +01i,06dec03,niq Fix compile error with GNU +01h,24nov03,asr added an include for semLib.h + moved diab version of LOG_XXXX to applUtilLib.c to get rid of warnings +01g,20nov03,niq osdep.h cleanup +01f,01nov03,asr Changes to port application logger to RTP +01e,22aug03,niq Merging from Accordion label ACCORDION_BASE6_MERGE_BASELINE +01d,15jul02,rvr defined inline functions for LOG_INFO,LOG_ERROR,LOG_WARNING + and LOG_DEBUG for diab compiler +01c,21may02,ppp adding taskLib.h for T2 build +01b,21Jan02,ism change logging macros to remove need for array +01a,18Sep01,ism written +*/ + +#ifndef __INCapplUtilLibh +#define __INCapplUtilLibh + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* includes */ + +#include /* for FILE */ +#include /* for INT_MAX */ +#include +#include +#include + +/* defines */ + +#define SUPPORT_NBIO_LOG + +#ifndef _WRS_KERNEL +/* nbioLogLib is not presently supported in RTPs. + * It may or may not be desired in the kernel. + */ +#undef SUPPORT_NBIO_LOG +#endif + +#ifdef SUPPORT_NBIO_LOG +#define KERN_LOG_FD LOG_FD_NBIO +#else +#define KERN_LOG_FD STD_ERR +#endif + +#define CAT_SHIFT 8 +#define CAT_MASK ((UINT)(-(1 << CAT_SHIFT))) + +/* Logging categories */ + +typedef enum _LOG_CAT_NUM + { +#undef LOG_DB +#undef LOG_DB_LAST +#define LOG_DB(x, y, z) x##_LOG_NUM, +#define LOG_DB_LAST(x, y, z) x##_LOG_NUM, +#include + LOG_NUMCATS + } LOG_CAT_NUM; + +typedef enum _LOG_CAT + { +#undef LOG_DB +#undef LOG_DB_LAST +#define LOG_DB(x, y, z) x##_LOG = (x##_LOG_NUM << CAT_SHIFT), +#define LOG_DB_LAST(x, y, z) x##_LOG = (x##_LOG_NUM << CAT_SHIFT) +#include + } LOG_CAT; + +typedef struct categoryInfo + { + int fd; + UINT level; + } CATEGORY_INFO; + +typedef struct _APPL_UTIL_CFG + { + CFG_DATA_HDR cfgh; /* header */ + int fd; /* default logging file descriptor, all facilities + except KERN_LOG */ + UINT level; /* default logging decoration and level, non-KERN */ + int fdKern; /* default logging file descriptor for KERN_LOG */ + UINT levelKern; /* default logging decoration and level, KERN_LOG */ + } APPL_UTIL_CFG; + +#ifndef _LOG_DEC_DFLT +#define _LOG_DEC_DFLT ((LOG_DECOR|LOG_LOC) << 8) +#endif + +#ifndef _LOG_LVL_DFLT +#define _LOG_LVL_DFLT WARNING_LEVEL +#endif + +/* Priority levels */ + + +#define LOG_DEBUG 7 /* Messages containing information normally of use */ + /* only when debugging */ +#define LOG_INFO 6 /* Informational messages */ +#define LOG_NOTICE 5 /* Non-error conditions, which may require special */ + /* handling */ +#define LOG_WARNING 4 /* Warning messages */ +#define LOG_ERR 3 /* Errors */ +#define LOG_CRIT 2 /* Critical conditions, such as hard device errors */ +#define LOG_ALERT 1 /* A condition which requires immediate corrective */ + /* action */ +#define LOG_EMERG 0 /* Panic condition. The system is unstable. */ + + +#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */ + +/* Logging levels - convenience values for logging all levels + * up to a specified level. + */ + +#define DEBUG_LEVEL LOG_UPTO (LOG_DEBUG) +#define INFO_LEVEL LOG_UPTO (LOG_INFO) +#define NOTICE_LEVEL LOG_UPTO (LOG_NOTICE) +#define WARNING_LEVEL LOG_UPTO (LOG_WARNING) +#define ERR_LEVEL LOG_UPTO (LOG_ERR) +#define ERROR_LEVEL ERR_LEVEL /* deprecated */ +#define CRIT_LEVEL LOG_UPTO (LOG_CRIT) +#define ALERT_LEVEL LOG_UPTO (LOG_ALERT) +#define EMERG_LEVEL LOG_UPTO (LOG_EMERG) +#define DO_NOT_LOG 0x00 + +/* We share priority levels (although not level names) with syslog() */ + +#define LOG_DEBUG_BIT (1 << LOG_DEBUG) +#define LOG_INFO_BIT (1 << LOG_INFO) +#define LOG_NOTICE_BIT (1 << LOG_NOTICE) +#define LOG_WARNING_BIT (1 << LOG_WARNING) +#define LOG_ERR_BIT (1 << LOG_ERR) +#define LOG_CRIT_BIT (1 << LOG_CRIT) +#define LOG_ALERT_BIT (1 << LOG_ALERT) +#define LOG_EMERG_BIT (1 << LOG_EMERG) + +/* + * Special bit for compile-time enabling of kernel logging (log(), LOG()). + * Not really a priority bit. + */ + +#define LOG_KERNEL_BIT 0x100 + +/* + * These bits may be passed to the logging macros as part of the + * "category" argument to enable or disable various "decorations" + * on the log output. + * + * These bits are exlusive-or'ed with the corresponding bits set on + * a per-facility basis using logDecorationSet(). + */ + +#define LOG_DECOR 0x80 /* log priority level and facility */ +#define LOG_LOC 0x40 /* log file name or function and line number */ + +#ifdef ENABLE_LOG_TIME +#define LOG_TIME 0x20 /* log a timestamp */ +#endif +#define LOG_ERRNO 0x10 /* log errno */ + +/* Fake file descriptor value for non-blocking I/O */ + +#define LOG_FD_NBIO INT_MAX + +/* + * In the priority/category argument to _applLog(), + * + * Bits 0 - 2 are the priority + * Bits 3 - 7 are decoration bits. + * Bits 8 - 31 identify the category (Facility) + * + * Bit 0 is the least significant bit here. + */ + +#define PRI_CAT(pri, cat) ((cat) | (pri)) + +#define LOG_CAT(x) ((UINT32)(x) >> CAT_SHIFT) + + +/* Constants controlling compile-time enabling of logging levels */ + +/* Define LOG_ENABLE_MASK as 0 to disable at compile time + * all application logging. This might be done if a target platform + * has no available console or other file to which it can log. + * Define LOG_ENABLE_MASK as a collection of the LOG_*_BIT values above + * to enable particular logging levels. + */ + +#if !defined (LOG_ENABLE_MASK) + +#if FALSE /* change to TRUE if a logging destination is not available */ + +#define LOG_ENABLE_MASK (0) + +#elif FALSE /* change to TRUE to do full logging */ + +#define LOG_ENABLE_MASK (DEBUG_LEVEL | LOG_KERNEL_BIT) + +#else + +/* + * The _FREE_VERSION macro indicates a well-tested production + * system. We assume DEBUG and INFO levels are not of interest + * here (and should be removed to save space). + * + * For size reduction, remove these levels in the default (checked) + * build as well. + */ +#define LOG_ENABLE_MASK (LOG_NOTICE_BIT | \ + LOG_WARNING_BIT | \ + LOG_ERR_BIT | \ + LOG_CRIT_BIT | \ + LOG_ALERT_BIT | \ + LOG_EMERG_BIT | \ + LOG_KERNEL_BIT) + + +#endif + +#endif /* !defined (LOG_ENABLE_MASK) */ + +#if __DCC__ || (__GNUCC__ >= 3) +#define C99_VARIADIC_MACROS +#endif + +#if (LOG_ENABLE_MASK != 0) + +#define APPL_LOGGER_INIT(cat, fd) applLoggerInit ((cat), (fd)) +#define APPL_LOGGER_STOP(cat) applLoggerStop ((cat)) +#define LOG_LEVEL_CHANGE(cat, mask) logLevelChange ((cat), (mask)) +#define LOG_DECORATION_CHANGE(cat, disable, enable) \ + logDecorationChange ((cat), (disable), (enable)) +#define LOGGER_INFO_SHOW() loggerInfoShow () + +#ifdef C99_VARIADIC_MACROS +#define _APPL_LOG(cat, file, line, ...) \ + _applLog ((cat), (file), (line), __VA_ARGS__); +#else +#define _APPL_LOG(cat, file, line, fmt...) \ + _applLog ((cat), (file), (line), fmt); +#endif /* C99_VARIADIC_MACROS */ + +#else /* (LOG_ENABLE_MASK == 0) */ + +#define APPL_LOGGER_INIT(cat, fd) (OK) +#define APPL_LOGGER_STOP(cat) (OK) +#define LOG_LEVEL_CHANGE(cat, mask) (OK) +#define LOG_DECORATION_CHANGE(cat, disable, enable) (OK) +#define LOGGER_INFO_SHOW() do {} while (FALSE) + +#ifdef C99_VARIADIC_MACROS +#define _APPL_LOG(cat, file, line, ...) do {} while (FALSE) +#else +#define _APPL_LOG(cat, file, line, fmt...) do {} while (FALSE) +#endif /* C99_VARIADIC_MACROS */ + +#endif /* (LOG_ENABLE_MASK == 0) */ + + +/* + * A modicum of backwards compatibility: + */ +#define USE_PRINTF STD_OUT + +/* typedefs */ + +/* variables */ + +/* function declarations */ + +STATUS applLoggerInit (int category, int fd); +STATUS applLoggerStop (int category); +STATUS logLevelChange (int category, UINT mask); +UINT logDecorationChange (int category, UINT disableMask, UINT enableMask); +void loggerInfoShow (); +void _applLog (int priCat, const char * file, int line, const char * fmt, ...); + + +/* These functions are deprecated and should not be used */ + +#define APPL_LOGGER_DEPRECATED_ROUTINES + +#ifdef APPL_LOGGER_DEPRECATED_ROUTINES +int initApplLogger (int category, int fd); +int stopApplLogger (int category); +int changeLogLevel (int category, char level); +void showLoggerInfo (); +#endif /* APPL_LOGGER_DEPRECATED_ROUTINES */ + +#define GCC_VERSION \ + (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) + +/* XXX verify exact version numbers for _HAVE__FUNCTION__ and _HAVE__func__ */ + +#if defined (__GNUC__) || (defined (__DCC__) && __VERSION_NUMBER__ >= 5200) +#define _HAVE__FUNCTION__ +#endif + +#if (GCC_VERSION >= 30200) +#define _HAVE__func__ +#endif + +#define LOG_LOC_FILE 0 /* The default */ +#define LOG_LOC_FUNC 1 +#define LOG_LOC_NONE 2 + +#if LOG_LOCATION == LOG_LOC_NONE +#define _LOG_LOCATION NULL, 0 +#define _LOC_UNIT NULL +#elif (LOG_LOCATION == LOG_LOC_FUNC) && defined (_HAVE__func__) +#define _LOG_LOCATION __func__, __LINE__ +#define _LOC_UNIT __func__ +#elif (LOG_LOCATION == LOG_LOC_FUNC) && defined (_HAVE__FUNCTION__) +#define _LOG_LOCATION __FUNCTION__, __LINE__ +#define _LOC_UNIT __FUNCTION__ +#else +#define _LOG_LOCATION __FILE__, __LINE__ +#define _LOC_UNIT __FILE__ +#endif + +/* + * If logging is enabled, but LOG_ARGS is not defined, then + * logging decoration will be shown, but the specified log string + * and its variable arguments will not. + * This decreases space requirements while still providing + * logging information sufficient to locate code logging errors. + */ + +#ifndef LOG_ARGS +#define LOG_ARGS 1 +#endif + + +/* + * These macros provide the logging interface used by the VxWorks + * applications. Each macro takes a category, which identifies which + * application has made the call, and also a control string and multiple + * arguments, which are in exactly the same format as printf(). + * + * For each macro the current logging level of the specified category is + * compared to the level that the macro name implies. If the current logging + * level for the application is greater than or equal to the macro level + * then the message will be logged, if it is not then the message will + * be discarded. For example, if the current logging level of an application + * is INFO_LEVEL then all the logging calls in that application will + * succeed except the logging calls made using LOG_DEBUG. + * + */ + +#ifdef C99_VARIADIC_MACROS + +#if (LOG_ENABLE_MASK & LOG_DEBUG_BIT) +#if LOG_ARGS +#define log_debug(cat, ...) \ + do { \ + _applLog (PRI_CAT (LOG_DEBUG, cat), _LOG_LOCATION, \ + __VA_ARGS__); \ + } while (FALSE) +#else +#define log_debug(cat, ...) \ + do { \ + _applLog (PRI_CAT (LOG_DEBUG, cat), _LOG_LOCATION, ""); \ + } while (FALSE) +#endif /* LOG_ARGS */ +#else +#define log_debug(cat, ...) do {} while (FALSE) +#endif + +#if (LOG_ENABLE_MASK & LOG_INFO_BIT) +#if LOG_ARGS +#define log_info(cat, ...) \ + do { \ + _applLog (PRI_CAT (LOG_INFO, cat), _LOG_LOCATION, \ + __VA_ARGS__); \ + } while (FALSE) +#else +#define log_info(cat, ...) \ + do { \ + _applLog (PRI_CAT (LOG_INFO, cat), _LOG_LOCATION, ""); \ + } while (FALSE) +#endif /* LOG_ARGS */ +#else +#define log_info(cat, ...) do {} while (FALSE) +#endif + +#if (LOG_ENABLE_MASK & LOG_NOTICE_BIT) +#if LOG_ARGS +#define log_notice(cat, ...) \ + do { \ + _applLog (PRI_CAT (LOG_NOTICE, cat), _LOG_LOCATION, \ + __VA_ARGS__); \ + } while (FALSE) +#else +#define log_notice(cat, ...) \ + do { \ + _applLog (PRI_CAT (LOG_NOTICE, cat), _LOG_LOCATION, "");\ + } while (FALSE) +#endif /* LOG_ARGS */ +#else +#define log_notice(cat, ...) do {} while (FALSE) +#endif + +#if (LOG_ENABLE_MASK & LOG_WARNING_BIT) +#if LOG_ARGS +#define log_warning(cat, ...) \ + do { \ + _applLog (PRI_CAT (LOG_WARNING, cat), _LOG_LOCATION, \ + __VA_ARGS__); \ + } while (FALSE) +#else +#define log_warning(cat, ...) \ + do { \ + _applLog (PRI_CAT (LOG_WARNING, cat), _LOG_LOCATION, ""); \ + } while (FALSE) +#endif /* LOG_ARGS */ +#else +#define log_warning(cat, ...) do {} while (FALSE) +#endif + +#if (LOG_ENABLE_MASK & LOG_ERR_BIT) +#if LOG_ARGS +#define log_err(cat, ...) \ + do { \ + _applLog (PRI_CAT (LOG_ERR, cat), _LOG_LOCATION, \ + __VA_ARGS__); \ + } while (FALSE) +#else +#define log_err(cat, ...) \ + do { \ + _applLog (PRI_CAT (LOG_ERR, cat), _LOG_LOCATION, ""); \ + } while (FALSE) +#endif /* LOG_ARGS */ +#else +#define log_err(cat, ...) do {} while (FALSE) +#endif + +#if (LOG_ENABLE_MASK & LOG_CRIT_BIT) +#if LOG_ARGS +#define log_crit(cat, ...) \ + do { \ + _applLog (PRI_CAT (LOG_CRIT, cat), _LOG_LOCATION, \ + __VA_ARGS__); \ + } while (FALSE) +#else +#define log_crit(cat, ...) \ + do { \ + _applLog (PRI_CAT (LOG_CRIT, cat), _LOG_LOCATION, ""); \ + } while (FALSE) +#endif /* LOG_ARGS */ +#else +#define log_crit(cat, ...) do {} while (FALSE) +#endif + +#if (LOG_ENABLE_MASK & LOG_ALERT_BIT) +#if LOG_ARGS +#define log_alert(cat, ...) \ + do { \ + _applLog (PRI_CAT (LOG_ALERT, cat), _LOG_LOCATION, \ + __VA_ARGS__); \ + } while (FALSE) +#else +#define log_alert(cat, ...) \ + do { \ + _applLog (PRI_CAT (LOG_ALERT, cat), _LOG_LOCATION, ""); \ + } while (FALSE) +#endif /* LOG_ARGS */ +#else +#define log_alert(cat, ...) do {} while (FALSE) +#endif + +#if (LOG_ENABLE_MASK & LOG_EMERG_BIT) +#if LOG_ARGS +#define log_emerg(cat, ...) \ + do { \ + _applLog (PRI_CAT (LOG_EMERG, cat), _LOG_LOCATION, \ + __VA_ARGS__); \ + } while (FALSE) +#else +#define log_emerg(cat, ...) \ + do { \ + _applLog (PRI_CAT (LOG_EMERG, cat), _LOG_LOCATION, ""); \ + } while (FALSE) +#endif /* LOG_ARGS */ +#else +#define log_emerg(cat, ...) do {} while (FALSE) +#endif + +#else /* !defined (C99_VARIADIC_MACROS) -> assume old GNU variadic syntax */ + +#if (LOG_ENABLE_MASK & LOG_DEBUG_BIT) +#if LOG_ARGS +#define log_debug(cat, fmt...) \ + do { \ + _applLog (PRI_CAT (LOG_DEBUG, cat), _LOG_LOCATION, fmt); \ + } while (FALSE) +#else +#define log_debug(cat, fmt...) \ + do { \ + _applLog (PRI_CAT (LOG_DEBUG, cat), _LOG_LOCATION, ""); \ + } while (FALSE) +#endif /* LOG_ARGS */ +#else +#define log_debug(cat, fmt...) do {} while (FALSE) +#endif + +#if (LOG_ENABLE_MASK & LOG_INFO_BIT) +#if LOG_ARGS +#define log_info(cat, fmt...) \ + do { \ + _applLog (PRI_CAT (LOG_INFO, cat), _LOG_LOCATION, fmt); \ + } while (FALSE) +#else +#define log_info(cat, fmt...) \ + do { \ + _applLog (PRI_CAT (LOG_INFO, cat), _LOG_LOCATION, ""); \ + } while (FALSE) +#endif /* LOG_ARGS */ +#else +#define log_info(cat, fmt...) do {} while (FALSE) +#endif + +#if (LOG_ENABLE_MASK & LOG_NOTICE_BIT) +#if LOG_ARGS +#define log_notice(cat, fmt...) \ + do { \ + _applLog (PRI_CAT (LOG_NOTICE, cat), _LOG_LOCATION, fmt); \ + } while (FALSE) +#else +#define log_notice(cat, fmt...) \ + do { \ + _applLog (PRI_CAT (LOG_NOTICE, cat), _LOG_LOCATION, ""); \ + } while (FALSE) +#endif /* LOG_ARGS */ +#else +#define log_notice(cat, fmt...) do {} while (FALSE) +#endif + +#if (LOG_ENABLE_MASK & LOG_WARNING_BIT) +#if LOG_ARGS +#define log_warning(cat, fmt...) \ + do { \ + _applLog (PRI_CAT (LOG_WARNING, cat), _LOG_LOCATION, fmt); \ + } while (FALSE) +#else +#define log_warning(cat, fmt...) \ + do { \ + _applLog (PRI_CAT (LOG_WARNING, cat), _LOG_LOCATION, ""); \ + } while (FALSE) +#endif /* LOG_ARGS */ +#else +#define log_warning(cat, fmt...) do {} while (FALSE) +#endif + +#if (LOG_ENABLE_MASK & LOG_ERR_BIT) +#if LOG_ARGS +#define log_err(cat, fmt...) \ + do { \ + _applLog (PRI_CAT (LOG_ERR, cat), _LOG_LOCATION, fmt); \ + } while (FALSE) +#else +#define log_err(cat, fmt...) \ + do { \ + _applLog (PRI_CAT (LOG_ERR, cat), _LOG_LOCATION, ""); \ + } while (FALSE) +#endif /* LOG_ARGS */ +#else +#define log_err(cat, fmt...) do {} while (FALSE) +#endif + +#if (LOG_ENABLE_MASK & LOG_CRIT_BIT) +#if LOG_ARGS +#define log_crit(cat, fmt...) \ + do { \ + _applLog (PRI_CAT (LOG_CRIT, cat), _LOG_LOCATION, fmt); \ + } while (FALSE) +#else +#define log_crit(cat, fmt...) \ + do { \ + _applLog (PRI_CAT (LOG_CRIT, cat), _LOG_LOCATION, ""); \ + } while (FALSE) +#endif /* LOG_ARGS */ +#else +#define log_crit(cat, fmt...) do {} while (FALSE) +#endif + +#if (LOG_ENABLE_MASK & LOG_ALERT_BIT) +#if LOG_ARGS +#define log_alert(cat, fmt...) \ + do { \ + _applLog (PRI_CAT (LOG_ALERT, cat), _LOG_LOCATION, fmt); \ + } while (FALSE) +#else +#define log_alert(cat, fmt...) \ + do { \ + _applLog (PRI_CAT (LOG_ALERT, cat), _LOG_LOCATION, ""); \ + } while (FALSE) +#endif /* LOG_ARGS */ +#else +#define log_alert(cat, fmt...) do {} while (FALSE) +#endif + +#if (LOG_ENABLE_MASK & LOG_EMERG_BIT) +#if LOG_ARGS +#define log_emerg(cat, fmt...) \ + do { \ + _applLog (PRI_CAT (LOG_EMERG, cat), _LOG_LOCATION, fmt); \ + } while (FALSE) +#else +#define log_emerg(cat, fmt...) \ + do { \ + _applLog (PRI_CAT (LOG_EMERG, cat), _LOG_LOCATION, ""); \ + } while (FALSE) +#endif /* LOG_ARGS */ +#else +#define log_emerg(cat, fmt...) do {} while (FALSE) +#endif + +#endif /* !defined (C99_VARIADIC_MACROS) */ + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCapplUtilLibh */ diff --git a/h/wrn/coreip/arch/arm/ansi.h b/h/wrn/coreip/arch/arm/ansi.h new file mode 100644 index 0000000..4eb0256 --- /dev/null +++ b/h/wrn/coreip/arch/arm/ansi.h @@ -0,0 +1,147 @@ +/* ansi.h - basic typedefs */ + +/* Copyright 2001-2003 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ansi.h 8.2 (Berkeley) 1/4/94 + * $FreeBSD: src/sys/i386/include/ansi.h,v 1.18.2.2 2001/03/05 13:09:00 obrien Exp $ + */ + +/* +modification history +-------------------- +01d,20nov03,niq Remove copyright_wrs.h file inclusion +01c,01feb03,pas removed broken __GNUC__ version of __int64_t, __uint64_t +01b,15jul02,rvr typedef ed __int8_t to char for diab (teamf1) +01a,08may02,ppp merging the teamf1 port from T202 +*/ + +#ifndef _MACHINE_ANSI_H_ +#define _MACHINE_ANSI_H_ + +/* + * Types which are fundamental to the implementation and must be declared + * in more than one standard header are defined here. Standard headers + * then use: + * #ifdef _BSD_SIZE_T_ + * typedef _BSD_SIZE_T_ size_t; + * #undef _BSD_SIZE_T_ + * #endif + */ +#define _BSD_CLOCK_T_ unsigned long /* clock()... */ +#define _BSD_CLOCKID_T_ int /* clock_gettime()... */ +#ifndef _BSD_PTRDIFF_T_ +#define _BSD_PTRDIFF_T_ int /* ptr1 - ptr2 */ +#endif +#define _BSD_RUNE_T_ _BSD_CT_RUNE_T_ /* rune_t (see below) */ +#ifndef _BSD_SIZE_T_ +#define _BSD_SIZE_T_ unsigned int /* sizeof() */ +#endif +#define _BSD_SOCKLEN_T_ __uint32_t +#define _BSD_SSIZE_T_ int /* byte count or error */ +#define _BSD_TIME_T_ long /* time()... */ +#define _BSD_TIMER_T_ int /* timer_gettime()... */ +#define _BSD_WCHAR_T_ _BSD_CT_RUNE_T_ /* wchar_t (see below) */ + +/* + * Types which are fundamental to the implementation and must be used + * in more than one standard header although they are only declared in + * one (perhaps nonstandard) header are defined here. Standard headers + * use _BSD_XXX_T_ without undef'ing it. + */ +#define _BSD_CT_RUNE_T_ int /* arg type for ctype funcs */ +#define _BSD_OFF_T_ __int64_t /* file offset */ +#define _BSD_PID_T_ int /* process [group] */ +#define _BSD_VA_LIST_ char * /* va_list */ + +/* + * The rune type is declared to be an ``int'' instead of the more natural + * ``unsigned long'' or ``long''. Two things are happening here. It is not + * unsigned so that EOF (-1) can be naturally assigned to it and used. Also, + * it looks like 10646 will be a 31 bit standard. This means that if your + * ints cannot hold 32 bits, you will be in trouble. The reason an int was + * chosen over a long is that the is*() and to*() routines take ints (says + * ANSI C), but they use _BSD_CT_RUNE_T_ instead of int. By changing it + * here, you lose a bit of ANSI conformance, but your programs will still + * work. + */ + +/* + * Frequencies of the clock ticks reported by clock() and times(). They + * are the same as stathz for bogus historical reasons. They should be + * 1e6 because clock() and times() are implemented using getrusage() and + * there is no good reason why they should be less accurate. There is + * the bad reason that (broken) programs might not like clock_t or + * CLOCKS_PER_SEC being ``double'' (``unsigned long'' is not large enough + * to hold the required 24 hours worth of ticks if the frequency is + * 1000000ul, and ``unsigned long long'' would be nonstandard). + */ +#define _BSD_CLK_TCK_ 128 +#define _BSD_CLOCKS_PER_SEC_ 128 + +/* + * We define this here since both and needs it. + */ +#define __offsetof(type, field) ((size_t)(&((type *)0)->field)) + +/* + * Typedefs for especially magic types. + * This is not in , since that has too much namespace + * pollution for inclusion in ANSI headers, yet we need __int64_t in at + * least . + */ +/* LONGLONG */ +typedef long long __int64_t; +/* LONGLONG */ +typedef unsigned long long __uint64_t; + +/* + * Internal names for basic integral types. Omit the typedef if + * not possible for a machine/compiler combination. + */ +#ifdef __GNUC__ +typedef __signed char __int8_t; +#else +typedef char __int8_t; +#endif +typedef unsigned char __uint8_t; +typedef short __int16_t; +typedef unsigned short __uint16_t; +typedef int __int32_t; +typedef unsigned int __uint32_t; + +typedef int __intptr_t; +typedef unsigned int __uintptr_t; + +#endif /* !_MACHINE_ANSI_H_ */ diff --git a/h/wrn/coreip/arch/arm/endian.h b/h/wrn/coreip/arch/arm/endian.h new file mode 100644 index 0000000..21a72c7 --- /dev/null +++ b/h/wrn/coreip/arch/arm/endian.h @@ -0,0 +1,142 @@ +/* endian.h - byte-ordering macros */ + +/* Copyright 2001-2004 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1987, 1991 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)endian.h 7.8 (Berkeley) 4/3/91 + * $FreeBSD: src/sys/i386/include/endian.h,v 1.18 1999/12/29 04:33:01 peter Exp $ + */ + +/* +modification history +-------------------- +01d,09sep04,vvv removed checks for other architectures (SPR #92056) +01c,20nov03,niq Remove copyright_wrs.h file inclusion +01b,05nov03,rlm Ran batch header update for header re-org. +01a,15jul02,rvr BYTE_ORDER define (teamf1) +*/ + +#ifndef _MACHINE_ENDIAN_H_ +#define _MACHINE_ENDIAN_H_ + +/* + * Define the order of 32-bit words in 64-bit words. + */ +#define _QUAD_HIGHWORD 1 +#define _QUAD_LOWWORD 0 + +#ifndef _POSIX_SOURCE + +/* + * Definitions for byte order, according to byte significance from low + * address to high. + */ +#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ +#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ +#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ + +#if defined(ARMEB) || defined(__ARMEB__) +#define BYTE_ORDER BIG_ENDIAN +#else +#define BYTE_ORDER LITTLE_ENDIAN +#endif + +#include + +__BEGIN_DECLS +unsigned long htonl __P((unsigned long)); +unsigned short htons __P((unsigned short)); +unsigned long ntohl __P((unsigned long)); +unsigned short ntohs __P((unsigned short)); +__END_DECLS + +#define __word_swap_long(x) \ +__extension__ ({ register u_long __X = (x); \ + __asm ("rorl $16, %1" \ + : "=r" (__X) \ + : "0" (__X)); \ + __X; }) + +#define __byte_swap_long(x) \ +__extension__ ({ register u_long __X = (x); \ + __asm ("xchgb %h1, %b1\n\trorl $16, %1\n\txchgb %h1, %b1" \ + : "=q" (__X) \ + : "0" (__X)); \ + __X; }) + +#define __byte_swap_word(x) \ +__extension__ ({ register u_short __X = (x); \ + __asm ("xchgb %h1, %b1" \ + : "=q" (__X) \ + : "0" (__X)); \ + __X; }) + +/* + * Macros for network/external number representation conversion. + */ + +#if BYTE_ORDER==BIG_ENDIAN + +#define ntohl(x) (x) +#define ntohs(x) (x) +#define htonl(x) (x) +#define htons(x) (x) + +#else + +#define ntohl(x) ((((x) & 0x000000ff) << 24) | \ + (((x) & 0x0000ff00) << 8) | \ + (((x) & 0x00ff0000) >> 8) | \ + (((x) & 0xff000000) >> 24)) + +#define htonl(x) ((((x) & 0x000000ff) << 24) | \ + (((x) & 0x0000ff00) << 8) | \ + (((x) & 0x00ff0000) >> 8) | \ + (((x) & 0xff000000) >> 24)) + +#define ntohs(x) ((((x) & 0x00ff) << 8) | \ + (((x) & 0xff00) >> 8)) + +#define htons(x) ((((x) & 0x00ff) << 8) | \ + (((x) & 0xff00) >> 8)) +#endif + +#define NTOHL(x) ((x) = ntohl((u_long)(x))) +#define NTOHS(x) ((x) = ntohs((u_short)(x))) +#define HTONL(x) ((x) = htonl((u_long)(x))) +#define HTONS(x) ((x) = htons((u_short)(x))) + +#endif /* ! _POSIX_SOURCE */ + +#endif /* !_MACHINE_ENDIAN_H_ */ diff --git a/h/wrn/coreip/arch/arm/machdep.h b/h/wrn/coreip/arch/arm/machdep.h new file mode 100644 index 0000000..b29bbf1 --- /dev/null +++ b/h/wrn/coreip/arch/arm/machdep.h @@ -0,0 +1,50 @@ +/* + * machdep.h -- architecture dependent include files + * all other files should include this header for + * machine related dependencies + */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,20aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01g,16jun04,kc Fixed SPR#98289 - removed duplicate int64_t typedef (already + defined in vxTypes.h). +01f,20nov03,niq Remove copyright_wrs.h file inclusion +01f,11nov03,sn avoid duplicating int64_t typedef (already defined in vxTypes.h) +01e,23apr03,pas removed ptr_t +01d,27jun02,ppp merging TeamF1's t22 changes (01d,10jun02,rvr port to tor22 (teamf1)) +01c,01oct01,nee adding defin. for intptr_t +01b,08aug01,ann adding some more OS dependant includes +01a,06aug01,qli adding MACRO redefinitons +*/ + + +#ifndef _MACHINE_DEP_H_ +#define _MACHINE_DEP_H_ + +#include "ansi.h" +#include "endian.h" +#include "param.h" + +#include "../types.h" + +typedef __uintptr_t uintptr_t; +typedef __intptr_t intptr_t; + +#if 0 +typedef unsigned char u_int8_t; +typedef unsigned short u_int16_t; +typedef unsigned long u_int32_t; + +typedef __int64_t int64_t; +typedef __uint64_t uint64_t; + +typedef __intptr_t intptr_t; +typedef __uintptr_t uintptr_t; +#endif + +#endif /* _MACHINE_DEP_H */ + diff --git a/h/wrn/coreip/arch/arm/param.h b/h/wrn/coreip/arch/arm/param.h new file mode 100644 index 0000000..f7fc421 --- /dev/null +++ b/h/wrn/coreip/arch/arm/param.h @@ -0,0 +1,191 @@ +/* param.h - machine dependent constants */ + +/* Copyright 2001-2004 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)param.h 5.8 (Berkeley) 6/28/91 + * $FreeBSD: src/sys/i386/include/param.h,v 1.54.2.4 2000/12/29 10:59:18 asmodai Exp $ + */ + +/* +modification history +-------------------- +01c,02feb04,pas removed PATH_MAX, MAXPATHLEN, and PENTIUM stuff +01b,20nov03,niq Remove copyright_wrs.h file inclusion +01a,18oct02,hsh remove MAXHOSTNAMELEN definition +*/ + +/* + * Machine dependent constants for ARM + */ + +#ifndef _MACHINE_PARAMS_H_ +#define _MACHINE_PARAMS_H_ + + +/* + * Round p (pointer or byte index) up to a correctly-aligned value + * for all data types (int, long, ...). The result is unsigned int + * and must be cast to any desired pointer type. + */ +#ifndef _ALIGNBYTES +#define _ALIGNBYTES (sizeof(int) - 1) +#endif +#ifndef _ALIGN +#define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) +#endif + +#ifndef _MACHINE +#define _MACHINE arm +#endif +#ifndef _MACHINE_ARCH +#define _MACHINE_ARCH arm +#endif + +#ifndef _NO_NAMESPACE_POLLUTION + +#ifndef _MACHINE_PARAM_H_ +#define _MACHINE_PARAM_H_ + +#ifndef MACHINE +#define MACHINE "arm" +#endif +#ifndef MACHINE_ARCH +#define MACHINE_ARCH "arm" +#endif + +/* + * OBJFORMAT_NAMES is a comma-separated list of the object formats + * that are supported on the architecture. + */ +#define OBJFORMAT_NAMES "elf", "aout" +#define OBJFORMAT_DEFAULT "elf" + +#ifdef SMP +#define MAXCPU 16 +#else +#define MAXCPU 1 +#endif /* SMP */ + +#define ALIGNBYTES _ALIGNBYTES +#define ALIGN(p) _ALIGN(p) + +#define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */ +#define PAGE_SIZE (1<>PAGE_SHIFT) + +/* + * btodb() is messy and perhaps slow because `bytes' may be an off_t. We + * want to shift an unsigned type to avoid sign extension and we don't + * want to widen `bytes' unnecessarily. Assume that the result fits in + * a daddr_t. + */ +#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ + (sizeof (bytes) > sizeof(long) \ + ? (daddr_t)((unsigned long long)(bytes) >> DEV_BSHIFT) \ + : (daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT)) + +#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ + ((off_t)(db) << DEV_BSHIFT) + +/* + * Mach derived conversion macros + */ +#define trunc_page(x) ((x) & ~PAGE_MASK) +#define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK) +#define trunc_4mpage(x) ((unsigned)(x) & ~PDRMASK) +#define round_4mpage(x) ((((unsigned)(x)) + PDRMASK) & ~PDRMASK) + +#define atop(x) ((unsigned)(x) >> PAGE_SHIFT) +#define ptoa(x) ((unsigned)(x) << PAGE_SHIFT) + +#define i386_btop(x) ((unsigned)(x) >> PAGE_SHIFT) +#define i386_ptob(x) ((unsigned)(x) << PAGE_SHIFT) + +#define pgtok(x) ((x) * (PAGE_SIZE / 1024)) + +#endif /* !_MACHINE_PARAM_H_ */ +#endif /* !_NO_NAMESPACE_POLLUTION */ + + +#endif /* _MACHINE_PARAMS_H_ */ diff --git a/h/wrn/coreip/arch/mips/ansi.h b/h/wrn/coreip/arch/mips/ansi.h new file mode 100644 index 0000000..908af67 --- /dev/null +++ b/h/wrn/coreip/arch/mips/ansi.h @@ -0,0 +1,148 @@ +/* ansi.h - basic typedefs */ + +/* Copyright 2001-2003 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ansi.h 8.2 (Berkeley) 1/4/94 + * $FreeBSD: src/sys/i386/include/ansi.h,v 1.18.2.2 2001/03/05 13:09:00 obrien Exp $ + */ + +/* +modification history +-------------------- +01d,20jan05,dlk Make __int64_t and __uint64_t be 64-bit types now that + network stack pool clusters have at least 8-byte alignment. +01c,20nov03,niq Remove copyright_wrs.h file inclusion +01b,15jul02,rvr typedef ed __int8_t to char for diab (teamf1) +01a,08may02,ppp merging the teamf1 port from T202 +*/ + +#ifndef _MACHINE_ANSI_H_ +#define _MACHINE_ANSI_H_ + +/* + * Types which are fundamental to the implementation and must be declared + * in more than one standard header are defined here. Standard headers + * then use: + * #ifdef _BSD_SIZE_T_ + * typedef _BSD_SIZE_T_ size_t; + * #undef _BSD_SIZE_T_ + * #endif + */ +#define _BSD_CLOCK_T_ unsigned long /* clock()... */ +#define _BSD_CLOCKID_T_ int /* clock_gettime()... */ +#ifndef _BSD_PTRDIFF_T_ +#define _BSD_PTRDIFF_T_ int /* ptr1 - ptr2 */ +#endif +#define _BSD_RUNE_T_ _BSD_CT_RUNE_T_ /* rune_t (see below) */ +#ifndef _BSD_SIZE_T_ +#define _BSD_SIZE_T_ unsigned int /* sizeof() */ +#endif +#define _BSD_SOCKLEN_T_ __uint32_t +#define _BSD_SSIZE_T_ int /* byte count or error */ +#define _BSD_TIME_T_ long /* time()... */ +#define _BSD_TIMER_T_ int /* timer_gettime()... */ +#define _BSD_WCHAR_T_ _BSD_CT_RUNE_T_ /* wchar_t (see below) */ + +/* + * Types which are fundamental to the implementation and must be used + * in more than one standard header although they are only declared in + * one (perhaps nonstandard) header are defined here. Standard headers + * use _BSD_XXX_T_ without undef'ing it. + */ +#define _BSD_CT_RUNE_T_ int /* arg type for ctype funcs */ +#define _BSD_OFF_T_ __int64_t /* file offset */ +#define _BSD_PID_T_ int /* process [group] */ +#define _BSD_VA_LIST_ char * /* va_list */ + +/* + * The rune type is declared to be an ``int'' instead of the more natural + * ``unsigned long'' or ``long''. Two things are happening here. It is not + * unsigned so that EOF (-1) can be naturally assigned to it and used. Also, + * it looks like 10646 will be a 31 bit standard. This means that if your + * ints cannot hold 32 bits, you will be in trouble. The reason an int was + * chosen over a long is that the is*() and to*() routines take ints (says + * ANSI C), but they use _BSD_CT_RUNE_T_ instead of int. By changing it + * here, you lose a bit of ANSI conformance, but your programs will still + * work. + */ + +/* + * Frequencies of the clock ticks reported by clock() and times(). They + * are the same as stathz for bogus historical reasons. They should be + * 1e6 because clock() and times() are implemented using getrusage() and + * there is no good reason why they should be less accurate. There is + * the bad reason that (broken) programs might not like clock_t or + * CLOCKS_PER_SEC being ``double'' (``unsigned long'' is not large enough + * to hold the required 24 hours worth of ticks if the frequency is + * 1000000ul, and ``unsigned long long'' would be nonstandard). + */ +#define _BSD_CLK_TCK_ 128 +#define _BSD_CLOCKS_PER_SEC_ 128 + +/* + * We define this here since both and needs it. + */ +#define __offsetof(type, field) ((size_t)(&((type *)0)->field)) + +/* + * Typedefs for especially magic types. #define's wouldn't work in the + * __GNUC__ case, since __attribute__(()) only works in certain contexts. + * This is not in , since that has too much namespace + * pollution for inclusion in ANSI headers, yet we need __int64_t in at + * least . + */ + +typedef long long __int64_t; +typedef unsigned long long __uint64_t; + +/* + * Internal names for basic integral types. Omit the typedef if + * not possible for a machine/compiler combination. + */ +#ifdef __GNUC__ +typedef __signed char __int8_t; +#else +typedef char __int8_t; +#endif +typedef unsigned char __uint8_t; +typedef short __int16_t; +typedef unsigned short __uint16_t; +typedef int __int32_t; +typedef unsigned int __uint32_t; + +typedef int __intptr_t; +typedef unsigned int __uintptr_t; + +#endif /* !_MACHINE_ANSI_H_ */ diff --git a/h/wrn/coreip/arch/mips/endian.h b/h/wrn/coreip/arch/mips/endian.h new file mode 100644 index 0000000..8e0e2b9 --- /dev/null +++ b/h/wrn/coreip/arch/mips/endian.h @@ -0,0 +1,142 @@ +/* endian.h - byte-ordering macros */ + +/* Copyright 2001-2004 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1987, 1991 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)endian.h 7.8 (Berkeley) 4/3/91 + * $FreeBSD: src/sys/i386/include/endian.h,v 1.18 1999/12/29 04:33:01 peter Exp $ + */ + +/* +modification history +-------------------- +01d,09sep04,vvv removed checks for other architectures (SPR #92056) +01c,20nov03,niq Remove copyright_wrs.h file inclusion +01b,05nov03,rlm Ran batch header update for header re-org. +01a,15jul02,rvr BYTE_ORDER define (teamf1) +*/ + +#ifndef _MACHINE_ENDIAN_H_ +#define _MACHINE_ENDIAN_H_ + +/* + * Define the order of 32-bit words in 64-bit words. + */ +#define _QUAD_HIGHWORD 1 +#define _QUAD_LOWWORD 0 + +#ifndef _POSIX_SOURCE + +/* + * Definitions for byte order, according to byte significance from low + * address to high. + */ +#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ +#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ +#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ + +#if defined(MIPSEB) || defined(__MIPSEB__) +#define BYTE_ORDER BIG_ENDIAN +#else +#define BYTE_ORDER LITTLE_ENDIAN +#endif + +#include + +__BEGIN_DECLS +unsigned long htonl __P((unsigned long)); +unsigned short htons __P((unsigned short)); +unsigned long ntohl __P((unsigned long)); +unsigned short ntohs __P((unsigned short)); +__END_DECLS + +#define __word_swap_long(x) \ +__extension__ ({ register u_long __X = (x); \ + __asm ("rorl $16, %1" \ + : "=r" (__X) \ + : "0" (__X)); \ + __X; }) + +#define __byte_swap_long(x) \ +__extension__ ({ register u_long __X = (x); \ + __asm ("xchgb %h1, %b1\n\trorl $16, %1\n\txchgb %h1, %b1" \ + : "=q" (__X) \ + : "0" (__X)); \ + __X; }) + +#define __byte_swap_word(x) \ +__extension__ ({ register u_short __X = (x); \ + __asm ("xchgb %h1, %b1" \ + : "=q" (__X) \ + : "0" (__X)); \ + __X; }) + +/* + * Macros for network/external number representation conversion. + */ + +#if BYTE_ORDER==BIG_ENDIAN + +#define ntohl(x) (x) +#define ntohs(x) (x) +#define htonl(x) (x) +#define htons(x) (x) + +#else + +#define ntohl(x) ((((x) & 0x000000ff) << 24) | \ + (((x) & 0x0000ff00) << 8) | \ + (((x) & 0x00ff0000) >> 8) | \ + (((x) & 0xff000000) >> 24)) + +#define htonl(x) ((((x) & 0x000000ff) << 24) | \ + (((x) & 0x0000ff00) << 8) | \ + (((x) & 0x00ff0000) >> 8) | \ + (((x) & 0xff000000) >> 24)) + +#define ntohs(x) ((((x) & 0x00ff) << 8) | \ + (((x) & 0xff00) >> 8)) + +#define htons(x) ((((x) & 0x00ff) << 8) | \ + (((x) & 0xff00) >> 8)) +#endif + +#define NTOHL(x) ((x) = ntohl((u_long)(x))) +#define NTOHS(x) ((x) = ntohs((u_short)(x))) +#define HTONL(x) ((x) = htonl((u_long)(x))) +#define HTONS(x) ((x) = htons((u_short)(x))) + +#endif /* ! _POSIX_SOURCE */ + +#endif /* !_MACHINE_ENDIAN_H_ */ diff --git a/h/wrn/coreip/arch/mips/machdep.h b/h/wrn/coreip/arch/mips/machdep.h new file mode 100644 index 0000000..b29bbf1 --- /dev/null +++ b/h/wrn/coreip/arch/mips/machdep.h @@ -0,0 +1,50 @@ +/* + * machdep.h -- architecture dependent include files + * all other files should include this header for + * machine related dependencies + */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,20aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01g,16jun04,kc Fixed SPR#98289 - removed duplicate int64_t typedef (already + defined in vxTypes.h). +01f,20nov03,niq Remove copyright_wrs.h file inclusion +01f,11nov03,sn avoid duplicating int64_t typedef (already defined in vxTypes.h) +01e,23apr03,pas removed ptr_t +01d,27jun02,ppp merging TeamF1's t22 changes (01d,10jun02,rvr port to tor22 (teamf1)) +01c,01oct01,nee adding defin. for intptr_t +01b,08aug01,ann adding some more OS dependant includes +01a,06aug01,qli adding MACRO redefinitons +*/ + + +#ifndef _MACHINE_DEP_H_ +#define _MACHINE_DEP_H_ + +#include "ansi.h" +#include "endian.h" +#include "param.h" + +#include "../types.h" + +typedef __uintptr_t uintptr_t; +typedef __intptr_t intptr_t; + +#if 0 +typedef unsigned char u_int8_t; +typedef unsigned short u_int16_t; +typedef unsigned long u_int32_t; + +typedef __int64_t int64_t; +typedef __uint64_t uint64_t; + +typedef __intptr_t intptr_t; +typedef __uintptr_t uintptr_t; +#endif + +#endif /* _MACHINE_DEP_H */ + diff --git a/h/wrn/coreip/arch/mips/param.h b/h/wrn/coreip/arch/mips/param.h new file mode 100644 index 0000000..df8ce96 --- /dev/null +++ b/h/wrn/coreip/arch/mips/param.h @@ -0,0 +1,190 @@ +/* param.h - machine dependent constants */ + +/* Copyright 2001-2004 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)param.h 5.8 (Berkeley) 6/28/91 + * $FreeBSD: src/sys/i386/include/param.h,v 1.54.2.4 2000/12/29 10:59:18 asmodai Exp $ + */ + +/* +modification history +-------------------- +01c,02feb04,pas removed PATH_MAX, MAXPATHLEN, and PENTIUM stuff +01b,20nov03,niq Remove copyright_wrs.h file inclusion +01a,18oct02,hsh remove MAXHOSTNAMELEN definition +*/ + +/* + * Machine dependent constants for MIPS + */ + +#ifndef _MACHINE_PARAMS_H_ +#define _MACHINE_PARAMS_H_ + +/* + * Round p (pointer or byte index) up to a correctly-aligned value + * for all data types (int, long, ...). The result is unsigned int + * and must be cast to any desired pointer type. + */ +#ifndef _ALIGNBYTES +#define _ALIGNBYTES (sizeof(int) - 1) +#endif +#ifndef _ALIGN +#define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) +#endif + +#ifndef _MACHINE +#define _MACHINE mips +#endif +#ifndef _MACHINE_ARCH +#define _MACHINE_ARCH mips +#endif + +#ifndef _NO_NAMESPACE_POLLUTION + +#ifndef _MACHINE_PARAM_H_ +#define _MACHINE_PARAM_H_ + +#ifndef MACHINE +#define MACHINE "mips" +#endif +#ifndef MACHINE_ARCH +#define MACHINE_ARCH "mips" +#endif + +/* + * OBJFORMAT_NAMES is a comma-separated list of the object formats + * that are supported on the architecture. + */ +#define OBJFORMAT_NAMES "elf", "aout" +#define OBJFORMAT_DEFAULT "elf" + +#ifdef SMP +#define MAXCPU 16 +#else +#define MAXCPU 1 +#endif /* SMP */ + +#define ALIGNBYTES _ALIGNBYTES +#define ALIGN(p) _ALIGN(p) + +#define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */ +#define PAGE_SIZE (1<>PAGE_SHIFT) + +/* + * btodb() is messy and perhaps slow because `bytes' may be an off_t. We + * want to shift an unsigned type to avoid sign extension and we don't + * want to widen `bytes' unnecessarily. Assume that the result fits in + * a daddr_t. + */ +#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ + (sizeof (bytes) > sizeof(long) \ + ? (daddr_t)((unsigned long long)(bytes) >> DEV_BSHIFT) \ + : (daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT)) + +#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ + ((off_t)(db) << DEV_BSHIFT) + +/* + * Mach derived conversion macros + */ +#define trunc_page(x) ((x) & ~PAGE_MASK) +#define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK) +#define trunc_4mpage(x) ((unsigned)(x) & ~PDRMASK) +#define round_4mpage(x) ((((unsigned)(x)) + PDRMASK) & ~PDRMASK) + +#define atop(x) ((unsigned)(x) >> PAGE_SHIFT) +#define ptoa(x) ((unsigned)(x) << PAGE_SHIFT) + +#define i386_btop(x) ((unsigned)(x) >> PAGE_SHIFT) +#define i386_ptob(x) ((unsigned)(x) << PAGE_SHIFT) + +#define pgtok(x) ((x) * (PAGE_SIZE / 1024)) + +#endif /* !_MACHINE_PARAM_H_ */ +#endif /* !_NO_NAMESPACE_POLLUTION */ + + +#endif /* _MACHINE_PARAMS_H_ */ diff --git a/h/wrn/coreip/arch/pentium/ansi.h b/h/wrn/coreip/arch/pentium/ansi.h new file mode 100644 index 0000000..7bb4273 --- /dev/null +++ b/h/wrn/coreip/arch/pentium/ansi.h @@ -0,0 +1,144 @@ +/* ansi.h - basic typedefs */ + +/* Copyright 2001-2003 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ansi.h 8.2 (Berkeley) 1/4/94 + * $FreeBSD: src/sys/i386/include/ansi.h,v 1.18.2.2 2001/03/05 13:09:00 obrien Exp $ + */ + +/* +modification history +-------------------- +01c,20nov03,niq Remove copyright_wrs.h file inclusion +01b,01feb03,pas removed broken __GNUC__ version of __int64_t, __uint64_t +01a,08may02,ppp merging the teamf1 port from T202 +*/ + +#ifndef _MACHINE_ANSI_H_ +#define _MACHINE_ANSI_H_ + +/* + * Types which are fundamental to the implementation and must be declared + * in more than one standard header are defined here. Standard headers + * then use: + * #ifdef _BSD_SIZE_T_ + * typedef _BSD_SIZE_T_ size_t; + * #undef _BSD_SIZE_T_ + * #endif + */ +#define _BSD_CLOCK_T_ unsigned long /* clock()... */ +#define _BSD_CLOCKID_T_ int /* clock_gettime()... */ +#ifndef _BSD_PTRDIFF_T_ +#define _BSD_PTRDIFF_T_ int /* ptr1 - ptr2 */ +#endif +#define _BSD_RUNE_T_ _BSD_CT_RUNE_T_ /* rune_t (see below) */ +#ifndef _BSD_SIZE_T_ +#define _BSD_SIZE_T_ unsigned int /* sizeof() */ +#endif +#define _BSD_SOCKLEN_T_ __uint32_t +#define _BSD_SSIZE_T_ int /* byte count or error */ +#define _BSD_TIME_T_ long /* time()... */ +#define _BSD_TIMER_T_ int /* timer_gettime()... */ +#define _BSD_WCHAR_T_ _BSD_CT_RUNE_T_ /* wchar_t (see below) */ + +/* + * Types which are fundamental to the implementation and must be used + * in more than one standard header although they are only declared in + * one (perhaps nonstandard) header are defined here. Standard headers + * use _BSD_XXX_T_ without undef'ing it. + */ +#define _BSD_CT_RUNE_T_ int /* arg type for ctype funcs */ +#define _BSD_OFF_T_ __int64_t /* file offset */ +#define _BSD_PID_T_ int /* process [group] */ +#define _BSD_VA_LIST_ char * /* va_list */ + +/* + * The rune type is declared to be an ``int'' instead of the more natural + * ``unsigned long'' or ``long''. Two things are happening here. It is not + * unsigned so that EOF (-1) can be naturally assigned to it and used. Also, + * it looks like 10646 will be a 31 bit standard. This means that if your + * ints cannot hold 32 bits, you will be in trouble. The reason an int was + * chosen over a long is that the is*() and to*() routines take ints (says + * ANSI C), but they use _BSD_CT_RUNE_T_ instead of int. By changing it + * here, you lose a bit of ANSI conformance, but your programs will still + * work. + */ + +/* + * Frequencies of the clock ticks reported by clock() and times(). They + * are the same as stathz for bogus historical reasons. They should be + * 1e6 because clock() and times() are implemented using getrusage() and + * there is no good reason why they should be less accurate. There is + * the bad reason that (broken) programs might not like clock_t or + * CLOCKS_PER_SEC being ``double'' (``unsigned long'' is not large enough + * to hold the required 24 hours worth of ticks if the frequency is + * 1000000ul, and ``unsigned long long'' would be nonstandard). + */ +#define _BSD_CLK_TCK_ 128 +#define _BSD_CLOCKS_PER_SEC_ 128 + +/* + * We define this here since both and needs it. + */ +#define __offsetof(type, field) ((size_t)(&((type *)0)->field)) + +/* + * Typedefs for especially magic types. + * This is not in , since that has too much namespace + * pollution for inclusion in ANSI headers, yet we need __int64_t in at + * least . + */ +/* LONGLONG */ +typedef long long __int64_t; +/* LONGLONG */ +typedef unsigned long long __uint64_t; + +/* + * Internal names for basic integral types. Omit the typedef if + * not possible for a machine/compiler combination. + */ +#include + +typedef __signed char __int8_t; +typedef unsigned char __uint8_t; +typedef short __int16_t; +typedef unsigned short __uint16_t; +typedef int __int32_t; +typedef unsigned int __uint32_t; + +typedef int __intptr_t; +typedef unsigned int __uintptr_t; + +#endif /* !_MACHINE_ANSI_H_ */ diff --git a/h/wrn/coreip/arch/pentium/endian.h b/h/wrn/coreip/arch/pentium/endian.h new file mode 100644 index 0000000..58c2c66 --- /dev/null +++ b/h/wrn/coreip/arch/pentium/endian.h @@ -0,0 +1,143 @@ +/* endian.h - byte-ordering macros */ + +/* Copyright 2001-2002 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1987, 1991 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)endian.h 7.8 (Berkeley) 4/3/91 + * $FreeBSD: src/sys/i386/include/endian.h,v 1.18 1999/12/29 04:33:01 peter Exp $ + */ + +/* +modification history +-------------------- +01b,20nov03,niq Remove copyright_wrs.h file inclusion +01a,05nov03,rlm Ran batch header update for header re-org. +*/ + +#ifndef _MACHINE_ENDIAN_H_ +#define _MACHINE_ENDIAN_H_ + +/* + * Define the order of 32-bit words in 64-bit words. + */ +#define _QUAD_HIGHWORD 1 +#define _QUAD_LOWWORD 0 + +#ifndef _POSIX_SOURCE + +/* + * Definitions for byte order, according to byte significance from low + * address to high. + */ +#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ +#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ +#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ + +#define BYTE_ORDER LITTLE_ENDIAN + +#include + +__BEGIN_DECLS +unsigned long htonl __P((unsigned long)); +unsigned short htons __P((unsigned short)); +unsigned long ntohl __P((unsigned long)); +unsigned short ntohs __P((unsigned short)); +__END_DECLS + +#define __word_swap_long(x) \ +__extension__ ({ register u_long __X = (x); \ + __asm ("rorl $16, %1" \ + : "=r" (__X) \ + : "0" (__X)); \ + __X; }) + +#if defined(_KERNEL) && (defined(I486_CPU) || defined(I586_CPU) || defined(I686_CPU)) && !defined(I386_CPU) + +#define __byte_swap_long(x) \ +__extension__ ({ register u_long __X = (x); \ + __asm ("bswap %0" \ + : "=r" (__X) \ + : "0" (__X)); \ + __X; }) +#else + +#define __byte_swap_long(x) \ +__extension__ ({ register u_long __X = (x); \ + __asm ("xchgb %h1, %b1\n\trorl $16, %1\n\txchgb %h1, %b1" \ + : "=q" (__X) \ + : "0" (__X)); \ + __X; }) +#endif + +#define __byte_swap_word(x) \ +__extension__ ({ register u_short __X = (x); \ + __asm ("xchgb %h1, %b1" \ + : "=q" (__X) \ + : "0" (__X)); \ + __X; }) + +/* + * Macros for network/external number representation conversion. + */ +#if 0 +#define ntohl __byte_swap_long +#define ntohs __byte_swap_word +#define htonl __byte_swap_long +#define htons __byte_swap_word +#else +#define ntohl(x) ((((x) & 0x000000ff) << 24) | \ + (((x) & 0x0000ff00) << 8) | \ + (((x) & 0x00ff0000) >> 8) | \ + (((x) & 0xff000000) >> 24)) + +#define htonl(x) ((((x) & 0x000000ff) << 24) | \ + (((x) & 0x0000ff00) << 8) | \ + (((x) & 0x00ff0000) >> 8) | \ + (((x) & 0xff000000) >> 24)) + +#define ntohs(x) ((((x) & 0x00ff) << 8) | \ + (((x) & 0xff00) >> 8)) + +#define htons(x) ((((x) & 0x00ff) << 8) | \ + (((x) & 0xff00) >> 8)) +#endif + +#define NTOHL(x) ((x) = ntohl((u_long)(x))) +#define NTOHS(x) ((x) = ntohs((u_short)(x))) +#define HTONL(x) ((x) = htonl((u_long)(x))) +#define HTONS(x) ((x) = htons((u_short)(x))) + +#endif /* ! _POSIX_SOURCE */ + +#endif /* !_MACHINE_ENDIAN_H_ */ diff --git a/h/wrn/coreip/arch/pentium/machdep.h b/h/wrn/coreip/arch/pentium/machdep.h new file mode 100644 index 0000000..99b2aa7 --- /dev/null +++ b/h/wrn/coreip/arch/pentium/machdep.h @@ -0,0 +1,51 @@ +/* + * machdep.h -- architecture dependent include files + * all other files should include this header for + * machine related dependencies + */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01f,20nov03,niq Remove copyright_wrs.h file inclusion +01f,11nov03,sn avoid duplicating int64_t typedef (already defined in vxTypes.h) +01e,23apr03,pas removed ptr_t +01d,27jun02,ppp merging TeamF1's t22 changes (01d,10jun02,rvr port to tor22 (teamf1)) +01c,01oct01,nee adding defin. for intptr_t +01b,08aug01,ann adding some more OS dependant includes +01a,06aug01,qli adding MACRO redefinitons +*/ + + +#ifndef _MACHINE_DEP_H_ +#define _MACHINE_DEP_H_ + +#include "ansi.h" +#include "endian.h" +#include "param.h" + +#include "../types.h" + +typedef __uintptr_t uintptr_t; +typedef __intptr_t intptr_t; + +#if 0 +typedef unsigned char u_int8_t; +typedef unsigned short u_int16_t; +typedef unsigned long u_int32_t; + + +typedef __uint64_t uint64_t; + +typedef __intptr_t intptr_t; +typedef __uintptr_t uintptr_t; + +#endif + + +#endif + diff --git a/h/wrn/coreip/arch/pentium/param.h b/h/wrn/coreip/arch/pentium/param.h new file mode 100644 index 0000000..d181092 --- /dev/null +++ b/h/wrn/coreip/arch/pentium/param.h @@ -0,0 +1,191 @@ +/* param.h - machine dependent constants */ + +/* Copyright 2001-2004 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)param.h 5.8 (Berkeley) 6/28/91 + * $FreeBSD: src/sys/i386/include/param.h,v 1.54.2.4 2000/12/29 10:59:18 asmodai Exp $ + */ + +/* +modification history +-------------------- +01c,02feb04,pas removed PATH_MAX and MAXPATHLEN +01b,20nov03,niq Remove copyright_wrs.h file inclusion +01a,18oct02,hsh remove MAXHOSTNAMELEN definition +*/ + +/* + * Machine dependent constants for Intel 386. + */ + +#ifndef _MACHINE_PARAMS_H_ +#define _MACHINE_PARAMS_H_ + +/* + * Round p (pointer or byte index) up to a correctly-aligned value + * for all data types (int, long, ...). The result is unsigned int + * and must be cast to any desired pointer type. + */ +#ifndef _ALIGNBYTES +#define _ALIGNBYTES (sizeof(int) - 1) +#endif +#ifndef _ALIGN +#define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) +#endif + +#ifndef _MACHINE +#define _MACHINE i386 +#endif +#ifndef _MACHINE_ARCH +#define _MACHINE_ARCH i386 +#endif + +#ifndef _NO_NAMESPACE_POLLUTION + +#ifndef _MACHINE_PARAM_H_ +#define _MACHINE_PARAM_H_ + +#ifndef MACHINE +#define MACHINE "i386" +#endif +#ifndef MACHINE_ARCH +#define MACHINE_ARCH "i386" +#endif +#define MID_MACHINE MID_I386 + +/* + * OBJFORMAT_NAMES is a comma-separated list of the object formats + * that are supported on the architecture. + */ +#define OBJFORMAT_NAMES "elf", "aout" +#define OBJFORMAT_DEFAULT "elf" + +#ifdef SMP +#define MAXCPU 16 +#else +#define MAXCPU 1 +#endif /* SMP */ + +#define ALIGNBYTES _ALIGNBYTES +#define ALIGN(p) _ALIGN(p) + +#define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */ +#define PAGE_SIZE (1<>PAGE_SHIFT) + +/* + * btodb() is messy and perhaps slow because `bytes' may be an off_t. We + * want to shift an unsigned type to avoid sign extension and we don't + * want to widen `bytes' unnecessarily. Assume that the result fits in + * a daddr_t. + */ +#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ + (sizeof (bytes) > sizeof(long) \ + ? (daddr_t)((unsigned long long)(bytes) >> DEV_BSHIFT) \ + : (daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT)) + +#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ + ((off_t)(db) << DEV_BSHIFT) + +/* + * Mach derived conversion macros + */ +#define trunc_page(x) ((x) & ~PAGE_MASK) +#define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK) +#define trunc_4mpage(x) ((unsigned)(x) & ~PDRMASK) +#define round_4mpage(x) ((((unsigned)(x)) + PDRMASK) & ~PDRMASK) + +#define atop(x) ((unsigned)(x) >> PAGE_SHIFT) +#define ptoa(x) ((unsigned)(x) << PAGE_SHIFT) + +#define i386_btop(x) ((unsigned)(x) >> PAGE_SHIFT) +#define i386_ptob(x) ((unsigned)(x) << PAGE_SHIFT) + +#define pgtok(x) ((x) * (PAGE_SIZE / 1024)) + +#endif /* !_MACHINE_PARAM_H_ */ +#endif /* !_NO_NAMESPACE_POLLUTION */ + + +#endif /* _MACHINE_PARAMS_H_ */ diff --git a/h/wrn/coreip/arch/ppc/ansi.h b/h/wrn/coreip/arch/ppc/ansi.h new file mode 100644 index 0000000..32fabc2 --- /dev/null +++ b/h/wrn/coreip/arch/ppc/ansi.h @@ -0,0 +1,145 @@ +/* ansi.h - basic typedefs */ + +/* Copyright 2001-2003 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ansi.h 8.2 (Berkeley) 1/4/94 + * $FreeBSD: src/sys/i386/include/ansi.h,v 1.18.2.2 2001/03/05 13:09:00 obrien Exp $ + */ + +/* +modification history +-------------------- +01e,20nov03,niq Remove copyright_wrs.h file inclusion +01d,05nov03,rlm Ran batch header update for header re-org. +01c,27oct03,cdw update include statements post header re-org. +01b,01feb03,pas removed broken __GNUC__ version of __int64_t, __uint64_t +*/ + +#ifndef _MACHINE_ANSI_H_ +#define _MACHINE_ANSI_H_ + +/* + * Types which are fundamental to the implementation and must be declared + * in more than one standard header are defined here. Standard headers + * then use: + * #ifdef _BSD_SIZE_T_ + * typedef _BSD_SIZE_T_ size_t; + * #undef _BSD_SIZE_T_ + * #endif + */ +#define _BSD_CLOCK_T_ unsigned long /* clock()... */ +#define _BSD_CLOCKID_T_ int /* clock_gettime()... */ +#ifndef _BSD_PTRDIFF_T_ +#define _BSD_PTRDIFF_T_ int /* ptr1 - ptr2 */ +#endif +#define _BSD_RUNE_T_ _BSD_CT_RUNE_T_ /* rune_t (see below) */ +#ifndef _BSD_SIZE_T_ +#define _BSD_SIZE_T_ unsigned int /* sizeof() */ +#endif +#define _BSD_SOCKLEN_T_ __uint32_t +#define _BSD_SSIZE_T_ int /* byte count or error */ +#define _BSD_TIME_T_ long /* time()... */ +#define _BSD_TIMER_T_ int /* timer_gettime()... */ +#define _BSD_WCHAR_T_ _BSD_CT_RUNE_T_ /* wchar_t (see below) */ + +/* + * Types which are fundamental to the implementation and must be used + * in more than one standard header although they are only declared in + * one (perhaps nonstandard) header are defined here. Standard headers + * use _BSD_XXX_T_ without undef'ing it. + */ +#define _BSD_CT_RUNE_T_ int /* arg type for ctype funcs */ +#define _BSD_OFF_T_ __int64_t /* file offset */ +#define _BSD_PID_T_ int /* process [group] */ +#define _BSD_VA_LIST_ char * /* va_list */ + +/* + * The rune type is declared to be an ``int'' instead of the more natural + * ``unsigned long'' or ``long''. Two things are happening here. It is not + * unsigned so that EOF (-1) can be naturally assigned to it and used. Also, + * it looks like 10646 will be a 31 bit standard. This means that if your + * ints cannot hold 32 bits, you will be in trouble. The reason an int was + * chosen over a long is that the is*() and to*() routines take ints (says + * ANSI C), but they use _BSD_CT_RUNE_T_ instead of int. By changing it + * here, you lose a bit of ANSI conformance, but your programs will still + * work. + */ + +/* + * Frequencies of the clock ticks reported by clock() and times(). They + * are the same as stathz for bogus historical reasons. They should be + * 1e6 because clock() and times() are implemented using getrusage() and + * there is no good reason why they should be less accurate. There is + * the bad reason that (broken) programs might not like clock_t or + * CLOCKS_PER_SEC being ``double'' (``unsigned long'' is not large enough + * to hold the required 24 hours worth of ticks if the frequency is + * 1000000ul, and ``unsigned long long'' would be nonstandard). + */ +#define _BSD_CLK_TCK_ 128 +#define _BSD_CLOCKS_PER_SEC_ 128 + +/* + * We define this here since both and needs it. + */ +#define __offsetof(type, field) ((size_t)(&((type *)0)->field)) + +/* + * Typedefs for especially magic types. + * This is not in , since that has too much namespace + * pollution for inclusion in ANSI headers, yet we need __int64_t in at + * least . + */ +/* LONGLONG */ +typedef long long __int64_t; +/* LONGLONG */ +typedef unsigned long long __uint64_t; + +/* + * Internal names for basic integral types. Omit the typedef if + * not possible for a machine/compiler combination. + */ +#include + +typedef __signed char __int8_t; +typedef unsigned char __uint8_t; +typedef short __int16_t; +typedef unsigned short __uint16_t; +typedef int __int32_t; +typedef unsigned int __uint32_t; + +typedef int __intptr_t; +typedef unsigned int __uintptr_t; + +#endif /* !_MACHINE_ANSI_H_ */ diff --git a/h/wrn/coreip/arch/ppc/endian.h b/h/wrn/coreip/arch/ppc/endian.h new file mode 100644 index 0000000..fc3293e --- /dev/null +++ b/h/wrn/coreip/arch/ppc/endian.h @@ -0,0 +1,124 @@ +/* endian.h - byte-ordering macros */ + +/* Copyright 2001-2002 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1987, 1991 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)endian.h 7.8 (Berkeley) 4/3/91 + * $FreeBSD: src/sys/i386/include/endian.h,v 1.18 1999/12/29 04:33:01 peter Exp $ + */ + +/* +modification history +-------------------- +01c,20nov03,niq Remove copyright_wrs.h file inclusion +01b,05nov03,rlm Ran batch header update for header re-org. +01a,27oct03,cdw update include statements post header re-org. +*/ + +#ifndef _MACHINE_ENDIAN_H_ +#define _MACHINE_ENDIAN_H_ + +/* + * Define the order of 32-bit words in 64-bit words. + */ +#define _QUAD_HIGHWORD 1 +#define _QUAD_LOWWORD 0 + +#ifndef _POSIX_SOURCE + +/* + * Definitions for byte order, according to byte significance from low + * address to high. + */ +#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ +#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ +#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ + +#define BYTE_ORDER BIG_ENDIAN + +#include + +__BEGIN_DECLS +unsigned long htonl __P((unsigned long)); +unsigned short htons __P((unsigned short)); +unsigned long ntohl __P((unsigned long)); +unsigned short ntohs __P((unsigned short)); +__END_DECLS + +#ifdef __GNUC__ + +static __inline __uint16_t +__bswap16(__uint16_t _x) +{ + + return ((_x >> 8) | ((_x << 8) & 0xff00)); +} + +static __inline __uint32_t +__bswap32(__uint32_t _x) +{ + + return ((_x >> 24) | ((_x >> 8) & 0xff00) | ((_x << 8) & 0xff0000) | + ((_x << 24) & 0xff000000)); +} + +static __inline __uint64_t +__bswap64(__uint64_t _x) +{ + + return ((_x >> 56) | ((_x >> 40) & 0xff00) | ((_x >> 24) & 0xff0000) | + ((_x >> 8) & 0xff000000) | ((_x << 8) & ((__uint64_t)0xff << 32)) | + ((_x << 24) & ((__uint64_t)0xff << 40)) | + ((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56))); +} + +#endif /* __GNUC__ */ + + +/* + * Macros for network/external number representation conversion. + */ + +#define ntohl(x) (x) +#define ntohs(x) (x) +#define htonl(x) (x) +#define htons(x) (x) + +#define NTOHL(x) (x) = ntohl((u_long)(x)) +#define NTOHS(x) (x) = ntohs((u_short)(x)) +#define HTONL(x) (x) = htonl((u_long)(x)) +#define HTONS(x) (x) = htons((u_short)(x)) +#endif /* ! _POSIX_SOURCE */ + +#endif /* !_MACHINE_ENDIAN_H_ */ diff --git a/h/wrn/coreip/arch/ppc/machdep.h b/h/wrn/coreip/arch/ppc/machdep.h new file mode 100644 index 0000000..f9b1fb7 --- /dev/null +++ b/h/wrn/coreip/arch/ppc/machdep.h @@ -0,0 +1,39 @@ +/* + * machdep.h -- architecture dependent include files + * all other files should include this header for + * machine related dependencies + */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01h,09apr04,nee Fixing redundant declaration of int64_t +01g,20nov03,niq Remove copyright_wrs.h file inclusion +01f,23apr03,pas removed ptr_t +01e,01aug02,hsh clean up unused #if0 block +01d,18jul02,ham added conditional int64_t declaration +01c,01oct01,nee adding defin. for intptr_t +01b,08aug01,ann adding some more OS dependant includes +01a,06aug01,qli adding MACRO redefinitons +*/ + + +#ifndef _MACHINE_DEP_H_ +#define _MACHINE_DEP_H_ + +#include "ansi.h" +#include "endian.h" +#include "param.h" + +#include "../types.h" + +typedef __uintptr_t uintptr_t; +typedef __intptr_t intptr_t; + + +#endif + diff --git a/h/wrn/coreip/arch/ppc/param.h b/h/wrn/coreip/arch/ppc/param.h new file mode 100644 index 0000000..46751a0 --- /dev/null +++ b/h/wrn/coreip/arch/ppc/param.h @@ -0,0 +1,187 @@ +/* param.h - machine dependent constants */ + +/* Copyright 2001-2004 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)param.h 5.8 (Berkeley) 6/28/91 + * $FreeBSD: src/sys/i386/include/param.h,v 1.54.2.4 2000/12/29 10:59:18 asmodai Exp $ + */ + +/* +modification history +-------------------- +01c,02feb04,pas removed PATH_MAX, MAXPATHLEN, and PENTIUM stuff +01b,20nov03,niq Remove copyright_wrs.h file inclusion +01a,18oct02,hsh remove MAXHOSTNAMELEN definition +*/ + +/* + * Machine dependent constants for PPC + */ + +#ifndef _MACHINE_PARAMS_H_ +#define _MACHINE_PARAMS_H_ + +/* + * Round p (pointer or byte index) up to a correctly-aligned value + * for all data types (int, long, ...). The result is unsigned int + * and must be cast to any desired pointer type. + */ +#ifndef _ALIGNBYTES +#define _ALIGNBYTES (sizeof(int) - 1) +#endif +#ifndef _ALIGN +#define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) +#endif + +#ifndef _MACHINE +#define _MACHINE ppc +#endif +#ifndef _MACHINE_ARCH +#define _MACHINE_ARCH ppc +#endif + +#ifndef _NO_NAMESPACE_POLLUTION + +#ifndef _MACHINE_PARAM_H_ +#define _MACHINE_PARAM_H_ + +#ifndef MACHINE +#define MACHINE "ppc" +#endif +#ifndef MACHINE_ARCH +#define MACHINE_ARCH "ppc" +#endif + +/* + * OBJFORMAT_NAMES is a comma-separated list of the object formats + * that are supported on the architecture. + */ +#define OBJFORMAT_NAMES "elf", "aout" +#define OBJFORMAT_DEFAULT "elf" + +#ifdef SMP +#define MAXCPU 16 +#else +#define MAXCPU 1 +#endif /* SMP */ + +#define ALIGNBYTES _ALIGNBYTES +#define ALIGN(p) _ALIGN(p) + +#define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */ +#define PAGE_SIZE (1<>PAGE_SHIFT) + +/* + * btodb() is messy and perhaps slow because `bytes' may be an off_t. We + * want to shift an unsigned type to avoid sign extension and we don't + * want to widen `bytes' unnecessarily. Assume that the result fits in + * a daddr_t. + */ +#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ + (sizeof (bytes) > sizeof(long) \ + ? (daddr_t)((unsigned long long)(bytes) >> DEV_BSHIFT) \ + : (daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT)) + +#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ + ((off_t)(db) << DEV_BSHIFT) + +/* + * Mach derived conversion macros + */ +#define trunc_page(x) ((x) & ~PAGE_MASK) +#define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK) +#define trunc_4mpage(x) ((unsigned)(x) & ~PDRMASK) +#define round_4mpage(x) ((((unsigned)(x)) + PDRMASK) & ~PDRMASK) + +#define atop(x) ((unsigned)(x) >> PAGE_SHIFT) +#define ptoa(x) ((unsigned)(x) << PAGE_SHIFT) + +#define pgtok(x) ((x) * (PAGE_SIZE / 1024)) + +#endif /* !_MACHINE_PARAM_H_ */ +#endif /* !_NO_NAMESPACE_POLLUTION */ + + +#endif /* _MACHINE_PARAMS_H_ */ diff --git a/h/wrn/coreip/arch/sh/ansi.h b/h/wrn/coreip/arch/sh/ansi.h new file mode 100644 index 0000000..b9d7f13 --- /dev/null +++ b/h/wrn/coreip/arch/sh/ansi.h @@ -0,0 +1,143 @@ +/* ansi.h - basic typedefs */ + +/* Copyright 2001-2003 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ansi.h 8.2 (Berkeley) 1/4/94 + * $FreeBSD: src/sys/i386/include/ansi.h,v 1.18.2.2 2001/03/05 13:09:00 obrien Exp $ + */ + +/* +modification history +-------------------- +01c,20nov03,niq Remove copyright_wrs.h file inclusion +01b,01feb03,pas removed broken __GNUC__ version of __int64_t, __uint64_t +*/ + +#ifndef _MACHINE_ANSI_H_ +#define _MACHINE_ANSI_H_ + +/* + * Types which are fundamental to the implementation and must be declared + * in more than one standard header are defined here. Standard headers + * then use: + * #ifdef _BSD_SIZE_T_ + * typedef _BSD_SIZE_T_ size_t; + * #undef _BSD_SIZE_T_ + * #endif + */ +#define _BSD_CLOCK_T_ unsigned long /* clock()... */ +#define _BSD_CLOCKID_T_ int /* clock_gettime()... */ +#ifndef _BSD_PTRDIFF_T_ +#define _BSD_PTRDIFF_T_ int /* ptr1 - ptr2 */ +#endif +#define _BSD_RUNE_T_ _BSD_CT_RUNE_T_ /* rune_t (see below) */ +#ifndef _BSD_SIZE_T_ +#define _BSD_SIZE_T_ unsigned int /* sizeof() */ +#endif +#define _BSD_SOCKLEN_T_ __uint32_t +#define _BSD_SSIZE_T_ int /* byte count or error */ +#define _BSD_TIME_T_ long /* time()... */ +#define _BSD_TIMER_T_ int /* timer_gettime()... */ +#define _BSD_WCHAR_T_ _BSD_CT_RUNE_T_ /* wchar_t (see below) */ + +/* + * Types which are fundamental to the implementation and must be used + * in more than one standard header although they are only declared in + * one (perhaps nonstandard) header are defined here. Standard headers + * use _BSD_XXX_T_ without undef'ing it. + */ +#define _BSD_CT_RUNE_T_ int /* arg type for ctype funcs */ +#define _BSD_OFF_T_ __int64_t /* file offset */ +#define _BSD_PID_T_ int /* process [group] */ +#define _BSD_VA_LIST_ char * /* va_list */ + +/* + * The rune type is declared to be an ``int'' instead of the more natural + * ``unsigned long'' or ``long''. Two things are happening here. It is not + * unsigned so that EOF (-1) can be naturally assigned to it and used. Also, + * it looks like 10646 will be a 31 bit standard. This means that if your + * ints cannot hold 32 bits, you will be in trouble. The reason an int was + * chosen over a long is that the is*() and to*() routines take ints (says + * ANSI C), but they use _BSD_CT_RUNE_T_ instead of int. By changing it + * here, you lose a bit of ANSI conformance, but your programs will still + * work. + */ + +/* + * Frequencies of the clock ticks reported by clock() and times(). They + * are the same as stathz for bogus historical reasons. They should be + * 1e6 because clock() and times() are implemented using getrusage() and + * there is no good reason why they should be less accurate. There is + * the bad reason that (broken) programs might not like clock_t or + * CLOCKS_PER_SEC being ``double'' (``unsigned long'' is not large enough + * to hold the required 24 hours worth of ticks if the frequency is + * 1000000ul, and ``unsigned long long'' would be nonstandard). + */ +#define _BSD_CLK_TCK_ 128 +#define _BSD_CLOCKS_PER_SEC_ 128 + +/* + * We define this here since both and needs it. + */ +#define __offsetof(type, field) ((size_t)(&((type *)0)->field)) + +/* + * Typedefs for especially magic types. + * This is not in , since that has too much namespace + * pollution for inclusion in ANSI headers, yet we need __int64_t in at + * least . + */ +/* LONGLONG */ +typedef long long __int64_t; +/* LONGLONG */ +typedef unsigned long long __uint64_t; + +/* + * Internal names for basic integral types. Omit the typedef if + * not possible for a machine/compiler combination. + */ +#ifdef __GNUC__ +typedef __signed char __int8_t; +#endif +typedef unsigned char __uint8_t; +typedef short __int16_t; +typedef unsigned short __uint16_t; +typedef int __int32_t; +typedef unsigned int __uint32_t; + +typedef int __intptr_t; +typedef unsigned int __uintptr_t; + +#endif /* !_MACHINE_ANSI_H_ */ diff --git a/h/wrn/coreip/arch/sh/endian.h b/h/wrn/coreip/arch/sh/endian.h new file mode 100644 index 0000000..4e37826 --- /dev/null +++ b/h/wrn/coreip/arch/sh/endian.h @@ -0,0 +1,152 @@ +/* endian.h - byte-ordering macros */ + +/* Copyright 2001-2002 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1987, 1991 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)endian.h 7.8 (Berkeley) 4/3/91 + * $FreeBSD: src/sys/i386/include/endian.h,v 1.18 1999/12/29 04:33:01 peter Exp $ + */ + +/* +modification history +-------------------- +01e,03dec03,h_k changed the #if statement for byte order. +01d,20nov03,niq Remove copyright_wrs.h file inclusion +01c,05nov03,rlm Ran batch header update for header re-org. +01b,30sep02,ann added check for little endian +01a,06sep02,ann initial port +*/ + +#ifndef _MACHINE_ENDIAN_H_ +#define _MACHINE_ENDIAN_H_ + +/* + * Define the order of 32-bit words in 64-bit words. + */ +#define _QUAD_HIGHWORD 1 +#define _QUAD_LOWWORD 0 + +#ifndef _POSIX_SOURCE + +/* + * Definitions for byte order, according to byte significance from low + * address to high. + */ +#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ +#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ +#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ + +#if _BYTE_ORDER == _BIG_ENDIAN +#define BYTE_ORDER BIG_ENDIAN +#else +#define BYTE_ORDER LITTLE_ENDIAN +#endif + +#include + +__BEGIN_DECLS +unsigned long htonl __P((unsigned long)); +unsigned short htons __P((unsigned short)); +unsigned long ntohl __P((unsigned long)); +unsigned short ntohs __P((unsigned short)); +__END_DECLS + +#ifdef __GNUC__ + +static __inline __uint16_t +__bswap16(__uint16_t _x) +{ + + return ((_x >> 8) | ((_x << 8) & 0xff00)); +} + +static __inline __uint32_t +__bswap32(__uint32_t _x) +{ + + return ((_x >> 24) | ((_x >> 8) & 0xff00) | ((_x << 8) & 0xff0000) | + ((_x << 24) & 0xff000000)); +} + +static __inline __uint64_t +__bswap64(__uint64_t _x) +{ + + return ((_x >> 56) | ((_x >> 40) & 0xff00) | ((_x >> 24) & 0xff0000) | + ((_x >> 8) & 0xff000000) | ((_x << 8) & ((__uint64_t)0xff << 32)) | + ((_x << 24) & ((__uint64_t)0xff << 40)) | + ((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56))); +} + +#endif /* __GNUC__ */ + + +/* + * Macros for network/external number representation conversion. + */ + +#if BYTE_ORDER==BIG_ENDIAN + +#define ntohl(x) (x) +#define ntohs(x) (x) +#define htonl(x) (x) +#define htons(x) (x) + +#else + +#define ntohl(x) ((((x) & 0x000000ff) << 24) | \ + (((x) & 0x0000ff00) << 8) | \ + (((x) & 0x00ff0000) >> 8) | \ + (((x) & 0xff000000) >> 24)) + +#define htonl(x) ((((x) & 0x000000ff) << 24) | \ + (((x) & 0x0000ff00) << 8) | \ + (((x) & 0x00ff0000) >> 8) | \ + (((x) & 0xff000000) >> 24)) + +#define ntohs(x) ((((x) & 0x00ff) << 8) | \ + (((x) & 0xff00) >> 8)) + +#define htons(x) ((((x) & 0x00ff) << 8) | \ + (((x) & 0xff00) >> 8)) +#endif + +#define NTOHL(x) ((x) = ntohl((u_long)(x))) +#define NTOHS(x) ((x) = ntohs((u_short)(x))) +#define HTONL(x) ((x) = htonl((u_long)(x))) +#define HTONS(x) ((x) = htons((u_short)(x))) + +#endif /* ! _POSIX_SOURCE */ + +#endif /* !_MACHINE_ENDIAN_H_ */ diff --git a/h/wrn/coreip/arch/sh/machdep.h b/h/wrn/coreip/arch/sh/machdep.h new file mode 100644 index 0000000..0572a17 --- /dev/null +++ b/h/wrn/coreip/arch/sh/machdep.h @@ -0,0 +1,49 @@ +/* + * machdep.h -- architecture dependent include files + * all other files should include this header for + * machine related dependencies + */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,20aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01g,16jun04,kc Fixed SPR#98289 - removed duplicate int64_t typedef (already + defined in vxTypes.h). +01f,20nov03,niq Remove copyright_wrs.h file inclusion +01e,23apr03,pas removed ptr_t +01d,18jul02,ham added conditional int64_t declaration +01c,01oct01,nee adding defin. for intptr_t +01b,08aug01,ann adding some more OS dependant includes +01a,06aug01,qli adding MACRO redefinitons +*/ + + +#ifndef _MACHINE_DEP_H_ +#define _MACHINE_DEP_H_ + +#include "ansi.h" +#include "endian.h" +#include "param.h" + +#include "../types.h" + +typedef __uintptr_t uintptr_t; +typedef __intptr_t intptr_t; + +#if 0 +typedef unsigned char u_int8_t; +typedef unsigned short u_int16_t; +typedef unsigned long u_int32_t; + +typedef __int64_t int64_t; +typedef __uint64_t uint64_t; + +typedef __intptr_t intptr_t; +typedef __uintptr_t uintptr_t; +#endif + +#endif /* _MACHINE_DEP_H */ + diff --git a/h/wrn/coreip/arch/sh/param.h b/h/wrn/coreip/arch/sh/param.h new file mode 100644 index 0000000..651e8e7 --- /dev/null +++ b/h/wrn/coreip/arch/sh/param.h @@ -0,0 +1,188 @@ +/* param.h - machine dependent constants */ + +/* Copyright 2001-2004 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)param.h 5.8 (Berkeley) 6/28/91 + * $FreeBSD: src/sys/i386/include/param.h,v 1.54.2.4 2000/12/29 10:59:18 asmodai Exp $ + */ + +/* +modification history +-------------------- +01d,02feb04,pas removed PATH_MAX, MAXPATHLEN, and PENTIUM stuff +01c,04dec03,h_k enabled PATH_MAX. +01b,20nov03,niq Remove copyright_wrs.h file inclusion +01a,18oct02,hsh remove MAXHOSTNAMELEN definition +*/ + +/* + * Machine dependent constants for SH + */ + +#ifndef _MACHINE_PARAMS_H_ +#define _MACHINE_PARAMS_H_ + +/* + * Round p (pointer or byte index) up to a correctly-aligned value + * for all data types (int, long, ...). The result is unsigned int + * and must be cast to any desired pointer type. + */ +#ifndef _ALIGNBYTES +#define _ALIGNBYTES (sizeof(int) - 1) +#endif +#ifndef _ALIGN +#define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) +#endif + +#ifndef _MACHINE +#define _MACHINE sh +#endif +#ifndef _MACHINE_ARCH +#define _MACHINE_ARCH sh +#endif + +#ifndef _NO_NAMESPACE_POLLUTION + +#ifndef _MACHINE_PARAM_H_ +#define _MACHINE_PARAM_H_ + +#ifndef MACHINE +#define MACHINE "sh" +#endif +#ifndef MACHINE_ARCH +#define MACHINE_ARCH "sh" +#endif + +/* + * OBJFORMAT_NAMES is a comma-separated list of the object formats + * that are supported on the architecture. + */ +#define OBJFORMAT_NAMES "elf", "aout" +#define OBJFORMAT_DEFAULT "elf" + +#ifdef SMP +#define MAXCPU 16 +#else +#define MAXCPU 1 +#endif /* SMP */ + +#define ALIGNBYTES _ALIGNBYTES +#define ALIGN(p) _ALIGN(p) + +#define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */ +#define PAGE_SIZE (1<>PAGE_SHIFT) + +/* + * btodb() is messy and perhaps slow because `bytes' may be an off_t. We + * want to shift an unsigned type to avoid sign extension and we don't + * want to widen `bytes' unnecessarily. Assume that the result fits in + * a daddr_t. + */ +#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ + (sizeof (bytes) > sizeof(long) \ + ? (daddr_t)((unsigned long long)(bytes) >> DEV_BSHIFT) \ + : (daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT)) + +#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ + ((off_t)(db) << DEV_BSHIFT) + +/* + * Mach derived conversion macros + */ +#define trunc_page(x) ((x) & ~PAGE_MASK) +#define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK) +#define trunc_4mpage(x) ((unsigned)(x) & ~PDRMASK) +#define round_4mpage(x) ((((unsigned)(x)) + PDRMASK) & ~PDRMASK) + +#define atop(x) ((unsigned)(x) >> PAGE_SHIFT) +#define ptoa(x) ((unsigned)(x) << PAGE_SHIFT) + +#define pgtok(x) ((x) * (PAGE_SIZE / 1024)) + +#endif /* !_MACHINE_PARAM_H_ */ +#endif /* !_NO_NAMESPACE_POLLUTION */ + + +#endif /* _MACHINE_PARAMS_H_ */ diff --git a/h/wrn/coreip/arch/simpentium/ansi.h b/h/wrn/coreip/arch/simpentium/ansi.h new file mode 100644 index 0000000..d577ed4 --- /dev/null +++ b/h/wrn/coreip/arch/simpentium/ansi.h @@ -0,0 +1,148 @@ +/* ansi.h - basic typedefs */ + +/* Copyright 2001-2003 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ansi.h 8.2 (Berkeley) 1/4/94 + * $FreeBSD: src/sys/i386/include/ansi.h,v 1.18.2.2 2001/03/05 13:09:00 obrien Exp $ + */ + +/* +modification history +-------------------- +01d,25jan05,dlk Make __int64_t and __uint64_t be 64-bit types now that + network stack pool clusters have at least 8-byte alignment. +01c,20nov03,niq Remove copyright_wrs.h file inclusion +01b,15jul02,rvr typedef ed __int8_t to char for diab (teamf1) +01a,08may02,ppp merging the teamf1 port from T202 +*/ + +#ifndef _MACHINE_ANSI_H_ +#define _MACHINE_ANSI_H_ + +/* + * Types which are fundamental to the implementation and must be declared + * in more than one standard header are defined here. Standard headers + * then use: + * #ifdef _BSD_SIZE_T_ + * typedef _BSD_SIZE_T_ size_t; + * #undef _BSD_SIZE_T_ + * #endif + */ +#define _BSD_CLOCK_T_ unsigned long /* clock()... */ +#define _BSD_CLOCKID_T_ int /* clock_gettime()... */ +#ifndef _BSD_PTRDIFF_T_ +#define _BSD_PTRDIFF_T_ int /* ptr1 - ptr2 */ +#endif +#define _BSD_RUNE_T_ _BSD_CT_RUNE_T_ /* rune_t (see below) */ +#ifndef _BSD_SIZE_T_ +#define _BSD_SIZE_T_ unsigned int /* sizeof() */ +#endif +#define _BSD_SOCKLEN_T_ __uint32_t +#define _BSD_SSIZE_T_ int /* byte count or error */ +#define _BSD_TIME_T_ long /* time()... */ +#define _BSD_TIMER_T_ int /* timer_gettime()... */ +#define _BSD_WCHAR_T_ _BSD_CT_RUNE_T_ /* wchar_t (see below) */ + +/* + * Types which are fundamental to the implementation and must be used + * in more than one standard header although they are only declared in + * one (perhaps nonstandard) header are defined here. Standard headers + * use _BSD_XXX_T_ without undef'ing it. + */ +#define _BSD_CT_RUNE_T_ int /* arg type for ctype funcs */ +#define _BSD_OFF_T_ __int64_t /* file offset */ +#define _BSD_PID_T_ int /* process [group] */ +#define _BSD_VA_LIST_ char * /* va_list */ + +/* + * The rune type is declared to be an ``int'' instead of the more natural + * ``unsigned long'' or ``long''. Two things are happening here. It is not + * unsigned so that EOF (-1) can be naturally assigned to it and used. Also, + * it looks like 10646 will be a 31 bit standard. This means that if your + * ints cannot hold 32 bits, you will be in trouble. The reason an int was + * chosen over a long is that the is*() and to*() routines take ints (says + * ANSI C), but they use _BSD_CT_RUNE_T_ instead of int. By changing it + * here, you lose a bit of ANSI conformance, but your programs will still + * work. + */ + +/* + * Frequencies of the clock ticks reported by clock() and times(). They + * are the same as stathz for bogus historical reasons. They should be + * 1e6 because clock() and times() are implemented using getrusage() and + * there is no good reason why they should be less accurate. There is + * the bad reason that (broken) programs might not like clock_t or + * CLOCKS_PER_SEC being ``double'' (``unsigned long'' is not large enough + * to hold the required 24 hours worth of ticks if the frequency is + * 1000000ul, and ``unsigned long long'' would be nonstandard). + */ +#define _BSD_CLK_TCK_ 128 +#define _BSD_CLOCKS_PER_SEC_ 128 + +/* + * We define this here since both and needs it. + */ +#define __offsetof(type, field) ((size_t)(&((type *)0)->field)) + +/* + * Typedefs for especially magic types. #define's wouldn't work in the + * __GNUC__ case, since __attribute__(()) only works in certain contexts. + * This is not in , since that has too much namespace + * pollution for inclusion in ANSI headers, yet we need __int64_t in at + * least . + */ + +typedef long long __int64_t; +typedef unsigned long long __uint64_t; + +/* + * Internal names for basic integral types. Omit the typedef if + * not possible for a machine/compiler combination. + */ +#ifdef __GNUC__ +typedef __signed char __int8_t; +#else +typedef char __int8_t; +#endif +typedef unsigned char __uint8_t; +typedef short __int16_t; +typedef unsigned short __uint16_t; +typedef int __int32_t; +typedef unsigned int __uint32_t; + +typedef int __intptr_t; +typedef unsigned int __uintptr_t; + +#endif /* !_MACHINE_ANSI_H_ */ diff --git a/h/wrn/coreip/arch/simpentium/endian.h b/h/wrn/coreip/arch/simpentium/endian.h new file mode 100644 index 0000000..2eab7db --- /dev/null +++ b/h/wrn/coreip/arch/simpentium/endian.h @@ -0,0 +1,151 @@ +/* endian.h - byte-ordering macros */ + +/* Copyright 2001-2002 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1987, 1991 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)endian.h 7.8 (Berkeley) 4/3/91 + * $FreeBSD: src/sys/i386/include/endian.h,v 1.18 1999/12/29 04:33:01 peter Exp $ + */ + +/* +modification history +-------------------- +01b,20nov03,niq Remove copyright_wrs.h file inclusion +01a,15nov03,rp updating header file path +01a,15jul02, rvr BYTE_ORDER define (teamf1) +*/ + +#ifndef _MACHINE_ENDIAN_H_ +#define _MACHINE_ENDIAN_H_ + +/* + * Define the order of 32-bit words in 64-bit words. + */ +#define _QUAD_HIGHWORD 1 +#define _QUAD_LOWWORD 0 + +#ifndef _POSIX_SOURCE + +/* + * Definitions for byte order, according to byte significance from low + * address to high. + */ +#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ +#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ +#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ + + +/* from target/h/arch/simnt/archSimnt in Veloce, it is little endian */ + +#define BYTE_ORDER LITTLE_ENDIAN + +#include + +__BEGIN_DECLS +unsigned long htonl __P((unsigned long)); +unsigned short htons __P((unsigned short)); +unsigned long ntohl __P((unsigned long)); +unsigned short ntohs __P((unsigned short)); +__END_DECLS + +#define __word_swap_long(x) \ +__extension__ ({ register u_long __X = (x); \ + __asm ("rorl $16, %1" \ + : "=r" (__X) \ + : "0" (__X)); \ + __X; }) + +#if defined(_KERNEL) && (defined(I486_CPU) || defined(I586_CPU) || defined(I686_CPU)) && !defined(I386_CPU) + +#define __byte_swap_long(x) \ +__extension__ ({ register u_long __X = (x); \ + __asm ("bswap %0" \ + : "=r" (__X) \ + : "0" (__X)); \ + __X; }) +#else + +#define __byte_swap_long(x) \ +__extension__ ({ register u_long __X = (x); \ + __asm ("xchgb %h1, %b1\n\trorl $16, %1\n\txchgb %h1, %b1" \ + : "=q" (__X) \ + : "0" (__X)); \ + __X; }) +#endif + +#define __byte_swap_word(x) \ +__extension__ ({ register u_short __X = (x); \ + __asm ("xchgb %h1, %b1" \ + : "=q" (__X) \ + : "0" (__X)); \ + __X; }) + +/* + * Macros for network/external number representation conversion. + */ + +#if BYTE_ORDER==BIG_ENDIAN + +#define ntohl(x) (x) +#define ntohs(x) (x) +#define htonl(x) (x) +#define htons(x) (x) + +#else + +#define ntohl(x) ((((x) & 0x000000ff) << 24) | \ + (((x) & 0x0000ff00) << 8) | \ + (((x) & 0x00ff0000) >> 8) | \ + (((x) & 0xff000000) >> 24)) + +#define htonl(x) ((((x) & 0x000000ff) << 24) | \ + (((x) & 0x0000ff00) << 8) | \ + (((x) & 0x00ff0000) >> 8) | \ + (((x) & 0xff000000) >> 24)) + +#define ntohs(x) ((((x) & 0x00ff) << 8) | \ + (((x) & 0xff00) >> 8)) + +#define htons(x) ((((x) & 0x00ff) << 8) | \ + (((x) & 0xff00) >> 8)) +#endif + +#define NTOHL(x) ((x) = ntohl((u_long)(x))) +#define NTOHS(x) ((x) = ntohs((u_short)(x))) +#define HTONL(x) ((x) = htonl((u_long)(x))) +#define HTONS(x) ((x) = htons((u_short)(x))) + +#endif /* ! _POSIX_SOURCE */ + +#endif /* !_MACHINE_ENDIAN_H_ */ diff --git a/h/wrn/coreip/arch/simpentium/machdep.h b/h/wrn/coreip/arch/simpentium/machdep.h new file mode 100644 index 0000000..b182055 --- /dev/null +++ b/h/wrn/coreip/arch/simpentium/machdep.h @@ -0,0 +1,53 @@ +/* + * machdep.h -- architecture dependent include files + * all other files should include this header for + * machine related dependencies + */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,13jun05,vvv cleanup of build flags +01f,20nov03,niq Remove copyright_wrs.h file inclusion +01e,23apr03,pas removed ptr_t +01d,27jun02,ppp merging TeamF1's t22 changes (01d,10jun02,rvr port to tor22 (teamf1)) +01c,01oct01,nee adding defin. for intptr_t +01b,08aug01,ann adding some more OS dependant includes +01a,06aug01,qli adding MACRO redefinitons +*/ + + +#ifndef _MACHINE_DEP_H_ +#define _MACHINE_DEP_H_ + +#include "ansi.h" +#include "endian.h" +#include "param.h" + +#if 0 +typedef long long int64_t; +#endif /* #if 0 */ + +#include "../types.h" + +typedef __uintptr_t uintptr_t; +typedef __intptr_t intptr_t; + +#if 0 +typedef unsigned char u_int8_t; +typedef unsigned short u_int16_t; +typedef unsigned long u_int32_t; + + +typedef __uint64_t uint64_t; + +typedef __intptr_t intptr_t; +typedef __uintptr_t uintptr_t; + +#endif + + +#endif + diff --git a/h/wrn/coreip/arch/simpentium/param.h b/h/wrn/coreip/arch/simpentium/param.h new file mode 100644 index 0000000..f2b8097 --- /dev/null +++ b/h/wrn/coreip/arch/simpentium/param.h @@ -0,0 +1,184 @@ +/* param.h - machine dependent constants */ + +/* Copyright 2001-2004 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)param.h 5.8 (Berkeley) 6/28/91 + * $FreeBSD: src/sys/i386/include/param.h,v 1.54.2.4 2000/12/29 10:59:18 asmodai Exp $ + */ + +/* +modification history +-------------------- +01e,09sep04,vvv fixed architecture information (SPR #92056) +01d,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5-int/1) +01c,02feb04,pas removed PATH_MAX and MAXPATHLEN +01b,20nov03,niq Remove copyright_wrs.h file inclusion +01a,18oct02,hsh remove MAXHOSTNAMELEN definition +*/ + +/* + * Machine dependent constants for pentium simulator + */ + +#ifndef _MACHINE_PARAMS_H_ +#define _MACHINE_PARAMS_H_ + +/* + * Round p (pointer or byte index) up to a correctly-aligned value + * for all data types (int, long, ...). The result is unsigned int + * and must be cast to any desired pointer type. + */ +#ifndef _ALIGNBYTES +#define _ALIGNBYTES (sizeof(int) - 1) +#endif +#ifndef _ALIGN +#define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) +#endif + +#ifndef _NO_NAMESPACE_POLLUTION + +#ifndef _MACHINE_PARAM_H_ +#define _MACHINE_PARAM_H_ + +/* + * OBJFORMAT_NAMES is a comma-separated list of the object formats + * that are supported on the architecture. + */ +#define OBJFORMAT_NAMES "elf", "aout" +#define OBJFORMAT_DEFAULT "elf" + +#ifdef SMP +#define MAXCPU 16 +#else +#define MAXCPU 1 +#endif /* SMP */ + +#define ALIGNBYTES _ALIGNBYTES +#define ALIGN(p) _ALIGN(p) + +#if 0 +#define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */ +#define PAGE_SIZE (1<>PAGE_SHIFT) + +/* + * btodb() is messy and perhaps slow because `bytes' may be an off_t. We + * want to shift an unsigned type to avoid sign extension and we don't + * want to widen `bytes' unnecessarily. Assume that the result fits in + * a daddr_t. + */ +#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ + (sizeof (bytes) > sizeof(long) \ + ? (daddr_t)((unsigned long long)(bytes) >> DEV_BSHIFT) \ + : (daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT)) + +#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ + ((off_t)(db) << DEV_BSHIFT) + +/* + * Mach derived conversion macros + */ +#define trunc_page(x) ((x) & ~PAGE_MASK) +#define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK) +#define trunc_4mpage(x) ((unsigned)(x) & ~PDRMASK) +#define round_4mpage(x) ((((unsigned)(x)) + PDRMASK) & ~PDRMASK) + +#define atop(x) ((unsigned)(x) >> PAGE_SHIFT) +#define ptoa(x) ((unsigned)(x) << PAGE_SHIFT) + +#define i386_btop(x) ((unsigned)(x) >> PAGE_SHIFT) +#define i386_ptob(x) ((unsigned)(x) << PAGE_SHIFT) + +#define pgtok(x) ((x) * (PAGE_SIZE / 1024)) +#endif /* 0 */ + + +#endif /* !_MACHINE_PARAM_H_ */ +#endif /* !_NO_NAMESPACE_POLLUTION */ + + +#endif /* _MACHINE_PARAMS_H_ */ diff --git a/h/wrn/coreip/arch/types.h b/h/wrn/coreip/arch/types.h new file mode 100644 index 0000000..11d19e8 --- /dev/null +++ b/h/wrn/coreip/arch/types.h @@ -0,0 +1,195 @@ +/* types.h - fundamental typedefs */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1982, 1986, 1991, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)types.h 8.6 (Berkeley) 2/19/95 + * $FreeBSD: src/sys/sys/types.h,v 1.40.2.2 2001/04/21 14:53:06 ume Exp $ + */ + +/* +modification history +-------------------- +01f,30mar05,vvv added missing endif +01e,07feb05,vvv _KERNEL cleanup +01d,20nov03,niq Remove copyright_wrs.h file inclusion +01c,05nov03,rlm Ran batch header update for header re-org. +01b,30oct01,ppp merging changes from munich +01a,23aug01,ppp Removed some of the un-wanted definations +*/ + +#ifndef _SYSDEP_TYPES_H_ +#define _SYSDEP_TYPES_H_ + +#include + +#if 0 +#ifndef _POSIX_SOURCE +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; +typedef unsigned short ushort; /* Sys V compatibility */ +typedef unsigned int uint; /* Sys V compatibility */ +#endif +#endif /* 0 */ + +typedef __uint8_t u_int8_t; +typedef __uint16_t u_int16_t; +typedef __uint32_t u_int32_t; +typedef __uint64_t u_int64_t; + +typedef u_int64_t u_quad_t; /* quads */ +typedef int64_t quad_t; +typedef quad_t * qaddr_t; + +#if 0 +typedef char * caddr_t; /* core address */ +typedef int32_t daddr_t; /* disk address */ +typedef u_int32_t gid_t; /* group id */ +typedef u_int32_t ino_t; /* inode number */ +typedef u_int16_t mode_t; /* permissions */ +typedef u_int16_t nlink_t; /* link count */ +typedef _BSD_OFF_T_ off_t; /* file offset */ +typedef _BSD_PID_T_ pid_t; /* process id */ +typedef int32_t swblk_t; /* swap offset */ +typedef u_int32_t uid_t; /* user id */ +#endif /* 0 */ + +typedef __const char * c_caddr_t; /* core address, pointer to const */ +typedef __volatile char *v_caddr_t; /* core address, pointer to volatile */ +typedef u_int32_t u_daddr_t; /* unsigned disk address */ +typedef u_int32_t fixpt_t; /* fixed point number */ +typedef u_int32_t in_addr_t; /* base type for internet address */ +typedef u_int16_t in_port_t; +typedef long key_t; /* IPC key (for Sys V IPC) */ +typedef quad_t rlim_t; /* resource limit */ +#ifdef __alpha__ /* XXX should be in */ +typedef int64_t segsz_t; /* segment size */ +#else +typedef int32_t segsz_t; /* segment size */ +#endif +typedef int32_t ufs_daddr_t; + +#ifdef _WRS_KERNEL +typedef int boolean_t; +typedef u_int64_t uoff_t; +typedef struct vm_page *vm_page_t; + +struct specinfo; + +typedef u_int32_t udev_t; /* device number */ + +#endif /* _WRS_KERNEL */ + +#if 0 +#include +#endif /* 0 */ +#if 0 +#ifdef _BSD_CLOCK_T_ +typedef _BSD_CLOCK_T_ clock_t; +#undef _BSD_CLOCK_T_ +#endif + +#ifdef _BSD_CLOCKID_T_ +typedef _BSD_CLOCKID_T_ clockid_t; +#undef _BSD_CLOCKID_T_ +#endif +#ifdef _BSD_SIZE_T_ +typedef _BSD_SIZE_T_ size_t; +#undef _BSD_SIZE_T_ +#endif + +#ifdef _BSD_SSIZE_T_ +typedef _BSD_SSIZE_T_ ssize_t; +#undef _BSD_SSIZE_T_ +#endif + +#ifdef _BSD_TIME_T_ +typedef _BSD_TIME_T_ time_t; +#undef _BSD_TIME_T_ +#endif + +#ifdef _BSD_TIMER_T_ +typedef _BSD_TIMER_T_ timer_t; +#undef _BSD_TIMER_T_ +#endif +#endif /* 0 */ + +#ifndef _POSIX_SOURCE +#define NBBY 8 /* number of bits in a byte */ + +/* + * Select uses bit masks of file descriptors in longs. These macros + * manipulate such bit fields (the filesystem macros use chars). + * FD_SETSIZE may be defined by the user, but the default here should + * be enough for most uses. + */ +#ifndef FD_SETSIZE +#define FD_SETSIZE 1024 +#endif + +#if 0 +typedef unsigned long fd_mask; +#define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */ +#endif + +#ifndef howmany +#define howmany(x, y) (((x) + ((y) - 1)) / (y)) +#endif + + +#if 0 + +typedef struct fd_set { + fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; +} fd_set; + + +#define _fdset_mask(n) ((fd_mask)1 << ((n) % NFDBITS)) +#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= _fdset_mask(n)) +#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~_fdset_mask(n)) +#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & _fdset_mask(n)) +#define FD_COPY(f, t) bcopy(f, t, sizeof(*(f))) +#define FD_ZERO(p) bzero(p, sizeof(*(p))) + +#endif /* 0 */ + +#endif /* !_POSIX_SOURCE */ +#endif /* !_SYS_TYPES_H_ */ diff --git a/h/wrn/coreip/arpLib.h b/h/wrn/coreip/arpLib.h new file mode 100644 index 0000000..1d35c7e --- /dev/null +++ b/h/wrn/coreip/arpLib.h @@ -0,0 +1,67 @@ +/* arpLib.h - VxWorks ARP table manipulation header file */ + +/* Copyright 2001 - 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01l,09feb05,sar Move gtf include files per GTF code inspection of 10/26/2004 +01k,07feb05,vvv _KERNEL cleanup +01j,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01i,20nov03,niq Remove copyright_wrs.h file inclusion +01h,05nov03,cdw Removal of unnecessary _KERNEL guards. +01g,04nov03,rlm Ran batch header path update for header re-org. +01f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01e,23oct03,rlm updated #includes for header re-org +01d,08sep03,vvv merged from ACCORDION_BASE6_MERGE_BASELINE +01c,09may03,vvv included vwModNum.h and in.h +01b,07feb02,ppp re-enabling arpLibInit +01a,14dec01,ppp ported from A.E. 1.1 +*/ + +#ifndef __INCarpLibh +#define __INCarpLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include + + +#if defined(__STDC__) || defined(__cplusplus) +extern void arpLibInit (void); +extern STATUS arpAdd (char *host, char *eaddr, int flags); +extern STATUS arpDelete (char *host); +extern STATUS arpCmd (int cmd, struct in_addr * pIpAddr, u_char *pHwAddr, + int *pFlags); +extern void arpFlush (void); +extern STATUS arpResolve (char * targetAddr, char * pHwAddr, int numTries, + int numTicks); + +#else /* __STDC__ */ +extern void arpLibInit (); +extern STATUS arpAdd (); +extern STATUS arpDelete (); +extern STATUS arpCmd (); +extern void arpFlush (); +extern STATUS arpResolve (); + +#endif /* __STDC__ */ + +/* error values */ + +#define S_arpLib_INVALID_ARGUMENT (M_arpLib | 1) +#define S_arpLib_INVALID_HOST (M_arpLib | 2) +#define S_arpLib_INVALID_ENET_ADDRESS (M_arpLib | 3) +#define S_arpLib_INVALID_FLAG (M_arpLib | 4) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCarpLibh */ diff --git a/h/wrn/coreip/arpa/inet.h b/h/wrn/coreip/arpa/inet.h new file mode 100644 index 0000000..fdc65e1 --- /dev/null +++ b/h/wrn/coreip/arpa/inet.h @@ -0,0 +1,88 @@ +/* inet.h - Internet header */ + +/* Copyright 1986 - 2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1983 Regents of the University of California. + + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * @(#)inet.h 5.2 (Berkeley) 6/27/88 + */ + +/* +modification history +-------------------- +01n,29jun05,vvv added inet_ntop() and inet_pton() for RFC3542 +01m,04mar04,ann Removed #ifndef _KERNEL protection for including in.h + as this file is required for defining struct in_addr. +01l,20nov03,niq Remove copyright_wrs.h file inclusion +01k,04nov03,rlm Ran batch header path update for header re-org. +01j,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01i,13jun03,syy Added prototype for inet_ntoa_b() (SPR#88384) +01h,09may03,vvv included in.h +01g,26jul99,spm added ansi/c++ prototypes for routines (SPR #5307) +01f,22sep92,rrr added support for c++ +01e,26may92,rrr the tree shuffle +01d,04oct91,rrr passed through the ansification filter + -changed copyright notice +01c,05oct90,shl added copyright notice. + added title. +01b,16apr89,gae updated to new 4.3BSD. +01a,22dec86,rdc created. +*/ + +#ifndef __INCineth +#define __INCineth + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * External definitions for + * functions in inet(3N) + */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern unsigned long inet_addr (char *); +extern void inet_ntoa_b (struct in_addr, char *); +extern char * inet_ntoa (struct in_addr); +extern struct in_addr inet_makeaddr (int, int); +extern unsigned long inet_network (char *); +extern const char * inet_ntop (int af, const void *src, char *dst, + size_t size); +extern int inet_pton (int af, const char *src, void *dst); + +#else + +unsigned long inet_addr(); +void inet_ntoa_b (); +char *inet_ntoa(); +struct in_addr inet_makeaddr(); +unsigned long inet_network(); +const char * inet_ntop (); +int inet_pton (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCafh */ diff --git a/h/wrn/coreip/bootpLib.h b/h/wrn/coreip/bootpLib.h new file mode 100644 index 0000000..05518eb --- /dev/null +++ b/h/wrn/coreip/bootpLib.h @@ -0,0 +1,296 @@ +/* bootpLib.h - BOOTP client include file */ + +/* Copyright 1990 - 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01s,04nov03,rlm Ran batch header path update for header re-org. +01r,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01q,22jan03,wap Make init routine backwards compatible +01p,17jan03,wap Avoid compiler warning due to redefinition of IPHL/UDPHL + macros. (SPR #83244) +01o,13jan03,rae Merged from velocecp branch (SPR #83245) +01n,14jun00,spm upgraded to RFC 1542 and removed direct link-level access; + changed interface to isolate message body values from options +01m,07apr97,spm changed BOOTP interface to DHCP style: all options supported +01l,26sep96,spm fixed SPR 7120: added parameter for gateway to bootpParamsGet +01k,22sep92,rrr added support for c++ +01j,04jul92,jcf cleaned up. +01i,11jun92,elh modified parameters to bootpParamsGet. +01h,26may92,rrr the tree shuffle + -changed includes to have absolute path from h/ +01g,17apr92,elh moved prototypes icmpLib. +01f,28feb92,elh ansified. +01e,27aug91,elh added RFC 1048 stuff, and added errors. +01d,12aug90,dnw changed retransmission delay parameters +01c,12aug90,hjb major revision +01b,19apr90,hjb added VX_LOG_FILE definition +01a,11mar90,hjb written +*/ + +#ifndef __INCbootpLibh +#define __INCbootpLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include +#include + +/* defines */ + /* BOOTP reserved ports */ +#define _BOOTP_SPORT 67 +#define _BOOTP_CPORT 68 + +#define BOOTREQUEST 1 /* BOOTP operations */ +#define BOOTREPLY 2 + +#define SIZE_HLEN 16 +#define SIZE_SNAME 64 +#define SIZE_VEND 64 +#define SIZE_FILE 128 + +#ifndef UDPHL +#define UDPHL sizeof (struct udphdr) /* UDP header length */ +#endif + +#ifndef IPHL +#define IPHL sizeof (struct ip) /* IP header length */ +#endif + +/* retransmission delay parameters */ + +#define INIT_BOOTP_DELAY 4 /* initial retransmit delay (secs) */ +#define MAX_BOOTP_DELAY 64 /* maximum retransmit delay (secs) */ + +/* Hardware type values from the arp section of the assigned numbers RFC. */ + +#define ETHER 1 /* Ethernet (10Mb) */ +#define EXPETHER 2 /* Experimental Ethernet (3Mb) */ +#define AX25 3 /* Amateur Radio AX.25 */ +#define PRONET 4 /* Proteon ProNET Token Ring */ +#define CHAOS 5 /* Chaos */ +#define IEEE802 6 /* IEEE 802 Networks */ +#define ARCNET 7 /* ARCNET */ +#define HYPERCH 8 /* Hyperchannel */ +#define LANSTAR 9 /* Lanstar */ +#define AUTONET 10 /* Autonet Short Address */ +#define LOCALTALK 11 /* LocalTalk */ +#define LOCALNET 12 /* LocalNet */ +#define ULTRALINK 13 /* Ultra link */ +#define FRAMERELAY 15 /* Frame Relay */ +#define SERIAL 20 /* Serial Line */ +#define DNS_NAME 128 /* DNS name */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* dont optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + + /* BOOTP message structure */ +typedef struct bootp_msg + { + unsigned char bp_op; /* packet opcode type */ + unsigned char bp_htype; /* hardware addr type */ + unsigned char bp_hlen; /* hardware addr length */ + unsigned char bp_hops; /* gateway hops */ + unsigned long bp_xid; /* transaction ID */ + unsigned short bp_secs; /* seconds since boot */ + unsigned short bp_unused; + struct in_addr bp_ciaddr; /* client IP address */ + struct in_addr bp_yiaddr; /* 'your' IP address */ + struct in_addr bp_siaddr; /* server IP address */ + struct in_addr bp_giaddr; /* gateway IP address */ + unsigned char bp_chaddr [SIZE_HLEN]; /* client hardware addr */ + unsigned char bp_sname [SIZE_SNAME]; /* server host name */ + unsigned char bp_file [SIZE_FILE]; /* boot file name */ + unsigned char bp_vend [SIZE_VEND]; /* vendor-specific area */ + } BOOTP_MSG; + +#define BOOTPLEN sizeof (struct bootp_msg) + +struct in_addr_list + { + unsigned char num; + struct in_addr * addrlist; + }; + +struct ushort_list + { + unsigned char num; + unsigned short * shortlist; + }; + +struct bootpParams /* BOOTP options/vendor extensions from RFC 1533 */ + { + struct in_addr * netmask; + unsigned short * timeOffset; + struct in_addr_list * routers; + struct in_addr_list * timeServers; + struct in_addr_list * nameServers; + struct in_addr_list * dnsServers; + struct in_addr_list * logServers; + struct in_addr_list * cookieServers; + struct in_addr_list * lprServers; + struct in_addr_list * impressServers; + struct in_addr_list * rlpServers; + char * clientName; + unsigned short * filesize; + char * dumpfile; + char * domainName; + struct in_addr * swapServer; + char * rootPath; + char * extoptPath; + unsigned char * ipForward; + unsigned char * nonlocalSourceRoute; + struct in_addr_list * policyFilter; + unsigned short * maxDgramSize; + unsigned char * ipTTL; + unsigned long * mtuTimeout; + struct ushort_list * mtuTable; + unsigned short * intfaceMTU; + unsigned char * allSubnetsLocal; + struct in_addr * broadcastAddr; + unsigned char * maskDiscover; + unsigned char * maskSupplier; + unsigned char * routerDiscover; + struct in_addr * routerDiscAddr; + struct in_addr_list * staticRoutes; + unsigned char * arpTrailers; + unsigned long * arpTimeout; + unsigned char * etherPacketType; + unsigned char * tcpTTL; + unsigned long * tcpInterval; + unsigned char * tcpGarbage; + char * nisDomain; + struct in_addr_list * nisServers; + struct in_addr_list * ntpServers; + char * vendString; + struct in_addr_list * nbnServers; + struct in_addr_list * nbddServers; + unsigned char * nbNodeType; + char * nbScope; + struct in_addr_list * xFontServers; + struct in_addr_list * xDisplayManagers; + char * nispDomain; + struct in_addr_list * nispServers; + struct in_addr_list * ipAgents; + struct in_addr_list * smtpServers; + struct in_addr_list * pop3Servers; + struct in_addr_list * nntpServers; + struct in_addr_list * wwwServers; + struct in_addr_list * fingerServers; + struct in_addr_list * ircServers; + struct in_addr_list * stServers; + struct in_addr_list * stdaServers; + }; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off */ +#endif /* CPU_FAMILY==I960 */ + +#define VM_RFC1048 { 99, 130, 83, 99 } + + +#define TAG_PAD 0 /* RFC 1048 vendor tags */ +#define TAG_SUBNET_MASK 1 +#define TAG_TIME_OFFSET 2 +#define TAG_GATEWAY 3 +#define TAG_TIME_SERVER 4 +#define TAG_NAME_SERVER 5 +#define TAG_DNS_SERVER 6 +#define TAG_LOG_SERVER 7 +#define TAG_COOKIE_SERVER 8 +#define TAG_LPR_SERVER 9 +#define TAG_IMPRESS_SERVER 10 +#define TAG_RLP_SERVER 11 +#define TAG_HOSTNAME 12 +#define TAG_END 255 +#define TAG_BOOTSIZE 13 /* RFC 1084 vendor tags */ +#define TAG_MERIT_DUMP 14 /* RFC 1395 vendor tags */ +#define TAG_DNS_DOMAIN 15 +#define TAG_SWAP_SERVER 16 +#define TAG_ROOT_PATH 17 +#define TAG_EXTENSIONS_PATH 18 /* RFC 1497 vendor tags */ +#define TAG_IP_FORWARD 19 /* RFC 1533 vendor tags */ +#define TAG_NONLOCAL_SRCROUTE 20 +#define TAG_POLICY_FILTER 21 +#define TAG_MAX_DGRAM_SIZE 22 +#define TAG_DEFAULT_IP_TTL 23 +#define TAG_MTU_AGING_TIMEOUT 24 +#define TAG_MTU_PLATEAU_TABLE 25 +#define TAG_IF_MTU 26 +#define TAG_ALL_SUBNET_LOCAL 27 +#define TAG_BRDCAST_ADDR 28 +#define TAG_MASK_DISCOVER 29 +#define TAG_MASK_SUPPLIER 30 +#define TAG_ROUTER_DISCOVER 31 +#define TAG_ROUTER_SOLICIT 32 +#define TAG_STATIC_ROUTE 33 +#define TAG_TRAILER 34 +#define TAG_ARP_CACHE_TIMEOUT 35 +#define TAG_ETHER_ENCAP 36 +#define TAG_DEFAULT_TCP_TTL 37 +#define TAG_KEEPALIVE_INTER 38 +#define TAG_KEEPALIVE_GARBA 39 +#define TAG_NIS_DOMAIN 40 +#define TAG_NIS_SERVER 41 +#define TAG_NTP_SERVER 42 +#define TAG_VENDOR_SPEC 43 +#define TAG_NBN_SERVER 44 +#define TAG_NBDD_SERVER 45 +#define TAG_NB_NODETYPE 46 +#define TAG_NB_SCOPE 47 +#define TAG_XFONT_SERVER 48 +#define TAG_XDISPLAY_MANAGER 49 +#define TAG_NISP_DOMAIN 64 +#define TAG_NISP_SERVER 65 +#define TAG_MOBILEIP_HA 68 +#define TAG_SMTP_SERVER 69 +#define TAG_POP3_SERVER 70 +#define TAG_NNTP_SERVER 71 +#define TAG_WWW_SERVER 72 +#define TAG_FINGER_SERVER 73 +#define TAG_IRC_SERVER 74 +#define TAG_ST_SERVER 75 +#define TAG_STDA_SERVER 76 + +/* error values */ + +#define S_bootpLib_INVALID_ARGUMENT (M_bootpLib | 1) +#define S_bootpLib_INVALID_COOKIE (M_bootpLib | 2) +#define S_bootpLib_NO_BROADCASTS (M_bootpLib | 3) +#define S_bootpLib_PARSE_ERROR (M_bootpLib | 4) +#define S_bootpLib_INVALID_TAG (M_bootpLib | 5) +#define S_bootpLib_TIME_OUT (M_bootpLib | 6) +#define S_bootpLib_MEM_ERROR (M_bootpLib | 7) +#define S_bootpLib_NOT_INITIALIZED (M_bootpLib | 8) +#define S_bootpLib_BAD_DEVICE (M_bootpLib | 9) + +/* function prototypes */ + +#if defined(__STDC__) || defined(__cplusplus) +STATUS bootpLibInit (int); +STATUS bootpLibMultiInit (ULONG, int); +STATUS bootpParamsGet (struct ifnet *, u_int, struct in_addr *, + struct in_addr *, char *, char *, + struct bootpParams *); +STATUS bootpMsgGet (struct ifnet *, struct in_addr *, USHORT, USHORT, + BOOTP_MSG *, u_int); +#else /* __STDC__ */ + +STATUS bootpLibInit (); +STATUS bootpLibMultiInit (); +STATUS bootpParamsGet (); +STATUS bootpMsgGet (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCbootpLibh */ diff --git a/h/wrn/coreip/bpfDrv.h b/h/wrn/coreip/bpfDrv.h new file mode 100644 index 0000000..6d70ae9 --- /dev/null +++ b/h/wrn/coreip/bpfDrv.h @@ -0,0 +1,48 @@ +/* bpfDrv.h - include file for Berkeley Packet Filter (BPF) I/O interface */ + +/* Copyright 1999 - 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,20nov03,niq Remove copyright_wrs.h file inclusion +01f,05nov03,cdw Removal of unnecessary _KERNEL guards. +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01c,01jul03,ann dummy check-in to update the time-stamp on this file +01b,13feb02,ham changed for tornado build. +01a,15oct01,nee Ported from from bpfdrv.h@@/main/tor3_x/tor3_x.windnet_ipv6/0 +*/ + +#ifndef __INCbpfDrvh +#define __INCbpfDrvh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* function declarations */ + +#if defined (__STDC__) || defined(__cplusplus) + +extern STATUS bpfDrv (void); +extern STATUS bpfDevCreate (char *pDevName, int numUnits, int bufSize); +extern STATUS bpfDevDelete (char *pDevName); +extern STATUS bpfDrvRemove (void); +#else /* __STDC__ */ + +extern STATUS bpfDrv (); +extern STATUS bpfDevCreate (); +extern STATUS bpfDevDelete (); +extern STATUS bpfDrvRemove (); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCbpfDrvh */ + + diff --git a/h/wrn/coreip/bsdSockLib.h b/h/wrn/coreip/bsdSockLib.h new file mode 100644 index 0000000..079e874 --- /dev/null +++ b/h/wrn/coreip/bsdSockLib.h @@ -0,0 +1,119 @@ +/* bsdSockLib.h - UNIX BSD 4.4 compatible socket library header */ + +/* + * Copyright (c) 2001, 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +02n,05mar05,dlk Added cfg_priv_soLingerForever. +02m,07feb05,wap Allow sysctl init routines to be scaled out +02l,02jan04,vvv changed prototype for bsdConnectWithTimeout +02k,08dec03,vvv updated based on inspection comments +02j,03dec03,ann added the inclusion of socketvar.h +02i,03dec03,ann added the parameter names to avoid compilation errors +02h,13nov03,nee Reewritten for base6 +02g,05nov03,cdw Removal of unnecessary _KERNEL guards. +02f,04nov03,rlm Ran batch header path update for header re-org. +02e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +02d,15sep03,vvv updated path for new headers +02c,08sep03,vvv merged from ACCORDION_BASE6_MERGE_BASELINE +02b,10jun03,vvv include netVersion.h +02a,15aug01,ann ported to clarinet from AE1.1 version 01f +*/ + +#ifndef __INCbsdSockLibh +#define __INCbsdSockLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include +#include +#include +#include + +/* externals */ + +#ifdef BSD43_COMPATIBLE +IMPORT BOOL bsdSock43ApiFlag; +#endif + +/* + * This structure contains the configuration parameters for the + * INCLUDE_BSD_SOCKET component. + */ + +typedef struct bsdSock_config_params { + CFG_DATA_HDR cfgh; + + /* defined in uipc_sock.c */ + int cfg_priv_somaxconn; + + /* defined in uipc_sock2.c */ + u_long cfg_sb_max; + u_long cfg_priv_sb_efficiency; /* parameter for sbreserve() */ + FUNCPTR cfg_privInitSysctl; + BOOL cfg_priv_soLingerForever; + } BSDSOCK_CONFIG_PARAMS; + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern SOCK_FUNC *bsdSockLibInit (void); +extern STATUS bsdConnect (struct socket *so, struct sockaddr *name, int namelen); +extern STATUS bsdConnectWithTimeout (struct socket *so, struct sockaddr *adrs, + int adrsLen, struct timeval *timeVal); +extern STATUS bsdGetpeername (struct socket *so, struct sockaddr *name, int *namelen); +extern STATUS bsdGetsockname (struct socket *so, struct sockaddr *name, int *namelen); +extern STATUS bsdGetsockopt (struct socket *so, int level, int optname, char *optval, + int *optlen); +extern STATUS bsdSetsockopt (struct socket *so, int level, int optname, char *optval, + int optlen); +extern STATUS bsdShutdown (struct socket *so, int how); +extern int bsdAccept (struct socket **pSo, struct sockaddr *addr, int *addrlen); +extern int bsdRecv (struct socket *so, char *buf, int bufLen, int flags); +extern int bsdRecvfrom (struct socket *so, char *buf, int bufLen, int flags, + struct sockaddr *from, int *pFromLen); +extern int bsdRecvmsg (struct socket *so, struct msghdr *mp, int flags); +extern int bsdSend (struct socket *so, char *buf, int bufLen, int flags); +extern int bsdSendmsg (struct socket *so, struct msghdr *mp, int flags); +extern int bsdSendto (struct socket *so, caddr_t buf, int bufLen, int flags, + struct sockaddr *to, int tolen); +extern STATUS bsdZbufSockRtn (void); + +#else /* __STDC__ */ + +extern SOCK_FUNC *bsdSockLibInit (); +extern STATUS bsdConnect (); +extern STATUS bsdConnectWithTimeout (); +extern STATUS bsdGetpeername (); +extern STATUS bsdGetsockname (); +extern STATUS bsdGetsockopt (); +extern STATUS bsdSetsockopt (); +extern STATUS bsdShutdown (); +extern int bsdAccept (); +extern int bsdRecv (); +extern int bsdRecvfrom (); +extern int bsdRecvmsg (); +extern int bsdSend (); +extern int bsdSendmsg (); +extern int bsdSendto (); +extern STATUS bsdZbufSockRtn (); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCbsdsocklibh */ diff --git a/h/wrn/coreip/cfgDefs.h b/h/wrn/coreip/cfgDefs.h new file mode 100644 index 0000000..2cd7060 --- /dev/null +++ b/h/wrn/coreip/cfgDefs.h @@ -0,0 +1,30 @@ +/* cfgDefs.h - default configuration data set up support */ + +/* Copyright 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05nov03,cdw Removal of unnecessary _KERNEL guards. +01b,04nov03,rlm Ran batch header path update for header re-org. +01a,11jul02,spm automatic merge from version 1 of Accordion Munich branch: + (01a,05jul02,wie written) +*/ + +#ifndef __INCcfgDefsh +#define __INCcfgDefsh + +/* defines */ + +/* all default configuration data structures must have this structure at + the beginning */ + +typedef struct cfg_data_hdr{ +int len; +} CFG_DATA_HDR; + + +/* macros */ + + +#endif /* __INCcfgDefsh */ diff --git a/h/wrn/coreip/dhcp/common.h b/h/wrn/coreip/dhcp/common.h new file mode 100644 index 0000000..3c6974d --- /dev/null +++ b/h/wrn/coreip/dhcp/common.h @@ -0,0 +1,391 @@ +/* common.h - DHCP server include file for shared data structures */ + +/* Copyright 1984 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01o,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE +01n,16mar04,ann merged from orion to create the MSP base +01m,04nov03,rlm Ran batch header path update for header re-org. +01l,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01k,23oct03,rlm updated #includes for header re-org +01j,10jun03,vvv include netVersion.h +01i,06feb03,vvv merged from tor2_2-patch.alameda, ver01c (SPR #83244) +01h,22aug02,wap merge from T2.2 +01g,12dec01,wap Interface name field of if_info structure is too small for + some interface names (SPR #29087) +01f,09oct01,rae merge from truestack ver 01h, base 01e, minor fixes +01e,14jul00,spm upgraded to RFC 2131 and removed direct link-level access +01d,06oct97,spm added support for dynamic driver type detection +01c,06aug97,spm added definitions for C++ compilation +01b,06may97,spm changed memory access to align IP header on four byte boundary +01a,07apr97,spm created by modifying WIDE project DHCP implementation +*/ + +/* + * WIDE Project DHCP Implementation + * Copyright (c) 1995 Akihiro Tominaga + * Copyright (c) 1995 WIDE Project + * All rights reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided only with the following + * conditions are satisfied: + * + * 1. Both the copyright notice and this permission notice appear in + * all copies of the software, derivative works or modified versions, + * and any portions thereof, and that both notices appear in + * supporting documentation. + * 2. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by WIDE Project and + * its contributors. + * 3. Neither the name of WIDE Project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND WIDE + * PROJECT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES + * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ALSO, THERE + * IS NO WARRANTY IMPLIED OR OTHERWISE, NOR IS SUPPORT PROVIDED. + * + * Feedback of the results generated from any improvements or + * extensions made to this software would be much appreciated. + * Any such feedback should be sent to: + * + * Akihiro Tominaga + * WIDE Project + * Keio University, Endo 5322, Kanagawa, Japan + * (E-mail: dhcp-dist@wide.ad.jp) + * + * WIDE project has the rights to redistribute these changes. + */ + +#ifndef __INCcommonh +#define __INCcommonh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* Resources sent to client outside of options field, if at all. */ + +#define S_TABLE_CONT 0 +#define S_SNAME 1 +#define S_FILE 2 +#define S_SIADDR 3 +#define S_ALLOW_BOOTP 4 +#define S_IP_ADDR 5 +#define S_MAX_LEASE 6 +#define S_DEFAULT_LEASE 7 +#define S_CLIENT_ID 8 +#define S_PARAM_ID 9 +#define S_CLASS_ID 10 + +/* Resources sent to client as RFC 1533 options. */ + +#define S_SUBNET_MASK 11 +#define S_TIME_OFFSET 12 +#define S_ROUTER 13 +#define S_TIME_SERVER 14 +#define S_NAME_SERVER 15 +#define S_DNS_SERVER 16 +#define S_LOG_SERVER 17 +#define S_COOKIE_SERVER 18 +#define S_LPR_SERVER 19 +#define S_IMPRESS_SERVER 20 +#define S_RLS_SERVER 21 +#define S_HOSTNAME 22 +#define S_BOOTSIZE 23 +#define S_MERIT_DUMP 24 +#define S_DNS_DOMAIN 25 +#define S_SWAP_SERVER 26 +#define S_ROOT_PATH 27 +#define S_EXTENSIONS_PATH 28 +#define S_IP_FORWARD 29 +#define S_NONLOCAL_SRCROUTE 30 +#define S_POLICY_FILTER 31 +#define S_MAX_DGRAM_SIZE 32 +#define S_DEFAULT_IP_TTL 33 +#define S_MTU_AGING_TIMEOUT 34 +#define S_MTU_PLATEAU_TABLE 35 +#define S_IF_MTU 36 +#define S_ALL_SUBNET_LOCAL 37 +#define S_BRDCAST_ADDR 38 +#define S_MASK_DISCOVER 39 +#define S_MASK_SUPPLIER 40 +#define S_ROUTER_DISCOVER 41 +#define S_ROUTER_SOLICIT 42 +#define S_STATIC_ROUTE 43 +#define S_TRAILER 44 +#define S_ARP_CACHE_TIMEOUT 45 +#define S_ETHER_ENCAP 46 +#define S_DEFAULT_TCP_TTL 47 +#define S_KEEPALIVE_INTER 48 +#define S_KEEPALIVE_GARBA 49 +#define S_NIS_DOMAIN 50 +#define S_NIS_SERVER 51 +#define S_NTP_SERVER 52 +#define S_NBN_SERVER 53 +#define S_NBDD_SERVER 54 +#define S_NB_NODETYPE 55 +#define S_NB_SCOPE 56 +#define S_XFONT_SERVER 57 +#define S_XDISPLAY_MANAGER 58 +#define S_DHCP_T1 59 +#define S_DHCP_T2 60 +#define S_NISP_DOMAIN 61 +#define S_NISP_SERVER 62 +#define S_MOBILEIP_HA 63 +#define S_SMTP_SERVER 64 +#define S_POP3_SERVER 65 +#define S_NNTP_SERVER 66 +#define S_DFLT_WWW_SERVER 67 +#define S_DFLT_FINGER_SERVER 68 +#define S_DFLT_IRC_SERVER 69 +#define S_STREETTALK_SERVER 70 +#define S_STDA_SERVER 71 +#define S_VEND_OPT 72 + +#define S_LAST_OPTION S_VEND_OPT +#define VALIDSIZE ((S_LAST_OPTION / 8) + 1) + +/* Set length for entry names. Leave space to append unique value. */ + +#define BASE_NAME 8 /* length for user-provided name, excluding '\0' */ +#define MAX_NAME BASE_NAME + 2 * sizeof (u_long) + +#include +#include +#include +#include + +#define DHCPS_OFF 2 /* 4-byte alignment offset needed by Sun BSP's */ +#define ETHERHL sizeof(struct ether_header) /* ethernet header length */ + +#ifndef IPHL +#define IPHL sizeof(struct ip) /* IP header length */ +#endif + +#ifndef UDPHL +#define UDPHL sizeof(struct udphdr) /* UDP header length */ +#endif + +#define WORD 4 /* word alignment in bits */ + +#if CPU_FAMILY==I960 +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +struct msg +{ + struct ether_header *ether; + struct ip *ip; + struct udphdr *udp; + struct dhcp *dhcp; +}; + +struct if_info { + int fd; + char name[IFNAMSIZ]; + short unit; + int bpfDev; /* File descriptor for Berkeley Packet Filter */ + int mtuSize; + unsigned int htype; + unsigned char hlen; + char haddr[6]; + struct in_addr ipaddr; + struct in_addr subnetmask; + int buf_size; + char *buf; + struct if_info *next; /* Next entry in null terminated list. */ +}; + +struct relay_acl { + struct in_addr relay, + subnet_mask; +}; + +struct client_id { + unsigned char idtype, + idlen; + char id [MAXOPT]; + struct in_addr subnet; +}; + +struct u_shorts { + int num; + unsigned short *shorts; +}; + +struct in_addrs { + int num; + struct in_addr *addr; +}; + +struct ip_pairs { + int num; + struct in_addr *addr1, + *addr2; +}; + +struct chaddr { + unsigned char htype, + hlen; + char haddr [MAX_HLEN]; +}; + +struct dhcp_binding { + + /* external info */ + struct client_id cid; /* hashing key. client identifier */ + struct chaddr haddr; + time_t expire_epoch; /* lease expiration epoch */ + char res_name [MAX_NAME + 1]; /* name of resource */ + + /* internal info */ + char flag; +#define COMPLETE_ENTRY 0x1 /* complete entry */ +#define STATIC_ENTRY 0x2 /* static entry */ +#define BOOTP_ENTRY 0x4 /* bootp entry */ + time_t temp_epoch; /* memo expiration epoch */ + struct dhcp_resource *res; /* pointer to resource */ +}; + +struct dhcp_resource { + + /* external info */ + char allow_bootp, /* boolean */ + ip_forward, /* boolean */ + nonlocal_srcroute, /* boolean */ + all_subnet_local, /* boolean */ + mask_discover, /* boolean */ + mask_supplier, /* boolean */ + router_discover, /* boolean */ + trailer, /* boolean */ + ether_encap, /* boolean */ + keepalive_garba, /* boolean */ + entryname [MAX_NAME + 1], /* tag name of entry */ + sname [MAX_SNAME + 1], /* server host name */ + file [MAX_FILE + 1], /* boot file name */ + hostname [MAXOPT + 1], + merit_dump [MAXOPT + 1], + dns_domain [MAXOPT + 1], + root_path [MAXOPT + 1], + extensions_path [MAXOPT + 1], + nis_domain [MAXOPT + 1], + nb_scope [MAXOPT + 1], /* NetBIOS scope */ + nisp_domain [MAXOPT + 1], /* NIS+ domain name */ + vend_opt [MAXOPT + 1]; /* vendor options */ + unsigned char default_ip_ttl, /* time to live (1 - 255) */ + default_tcp_ttl, + nb_nodetype; /* NetBIOS node type */ +#define BNODE 0x1 +#define PNODE 0x2 +#define MNODE 0x4 +#define HNODE 0x8 + unsigned short bootsize, /* bootfile size in 16 bits */ + max_dgram_size, /* max dgram reassembly */ + intf_mtu, /* interface mtu */ + dhcp_t1, /* host byte order */ + dhcp_t2; /* host byte order */ + long time_offset; /* offset from UTC */ + unsigned long max_lease, /* maximum lease duration + (host byte order) */ + default_lease, /* default lease duration + (host byte order) */ + mtu_aging_timeout, /* unsigned 32 bits integer */ + arp_cache_timeout, + keepalive_inter; + struct u_shorts mtu_plateau_table; /* array of 16 bit ints */ + struct in_addr siaddr, /* (tftp) server */ + ip_addr, /* IP address */ + subnet_mask, + swap_server, + brdcast_addr, + router_solicit; + struct in_addrs router, + time_server, + name_server, + dns_server, /* DNS server */ + log_server, + cookie_server, + lpr_server, + impress_server, + rls_server, /* Resource Location Server */ + nis_server, + ntp_server, + nbn_server, /* NetBIOS name server */ + nbdd_server, /* NetBIOS dgram distrib server */ + xfont_server, /* X font erver */ + xdisplay_manager, /* X display manager */ + nisp_server, /* NIS+ server */ + mobileip_ha, /* Mobile IP Home Agent */ + smtp_server, /* SMTP server */ + pop3_server, /* POP3 server */ + nntp_server, /* NNTP server */ + dflt_www_server, /* Default WWW server */ + dflt_finger_server, /* Default Finger server */ + dflt_irc_server, /* Default IRC server */ + streettalk_server, /* StreetTalk server */ + stda_server; /* STDA server */ + struct ip_pairs policy_filter, + static_route; + + /* internal info */ + char valid[VALIDSIZE], /* indicate which are available */ + active[VALIDSIZE]; /* indicate which differ from + Host Requirements RFC */ + struct dhcp_binding *binding; /* pointer to identifier + * associated with resource. + */ +}; + +#if CPU_FAMILY==I960 +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif +#ifndef GOOD +#define GOOD 1 +#endif +#ifndef BAD +#define BAD 0 +#endif +#ifndef ADDRPOOL_DUMP +#define ADDRPOOL_DUMP "/tmp/addrpool_dump" +#endif +#define MAX_NBIND 500 /* maximum number of dhcp_binding + ( this is used in garbage_collect(); ) */ +#ifndef VIRTUAL_STACK +extern int nbind; +#endif /* VIRTUAL_STACK */ + +#ifndef sun +extern struct bpf_hdr *rbpf; /* pointer to bpf header */ +#endif +/* extern struct msg rcv; */ + +int add_bind(); +STATUS read_bind_db (void); +STATUS read_addrpool_db (int); +void read_relay_db (int); +void dump_bind_db(); +void finish(); +char *haddrtos(); +char *cidtos(); +char *_ctime(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/dhcp/common_subr.h b/h/wrn/coreip/dhcp/common_subr.h new file mode 100644 index 0000000..9f11a3a --- /dev/null +++ b/h/wrn/coreip/dhcp/common_subr.h @@ -0,0 +1,106 @@ +/* common_subr.h - DHCP server include file for function prototypes */ + +/* Copyright 1984 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,16mar04,ann merged from orion to create the MSP base +01c,14jul00,spm added support for non-Ethernet devices +01b,06aug97,spm added alignment pragma and definitions for C++ compilation +01a,07apr97,spm created by modifying WIDE project DHCP implementation +*/ + +/* + * WIDE Project DHCP Implementation + * Copyright (c) 1995 Akihiro Tominaga + * Copyright (c) 1995 WIDE Project + * All rights reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided only with the following + * conditions are satisfied: + * + * 1. Both the copyright notice and this permission notice appear in + * all copies of the software, derivative works or modified versions, + * and any portions thereof, and that both notices appear in + * supporting documentation. + * 2. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by WIDE Project and + * its contributors. + * 3. Neither the name of WIDE Project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND WIDE + * PROJECT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES + * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ALSO, THERE + * IS NO WARRANTY IMPLIED OR OTHERWISE, NOR IS SUPPORT PROVIDED. + * + * Feedback of the results generated from any improvements or + * extensions made to this software would be much appreciated. + * Any such feedback should be sent to: + * + * Akihiro Tominaga + * WIDE Project + * Keio University, Endo 5322, Kanagawa, Japan + * (E-mail: dhcp-dist@wide.ad.jp) + * + * WIDE project has the rights to redistribute these changes. + */ + +#ifndef __INCcommon_subrh +#define __INCcommon_subrh + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct dhcpEvent /* External event descriptor. */ + { + unsigned char source; /* Offset of receiving interface in list. */ + int length; /* Length of incoming message. */ + } +EVENT_DATA; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#define EVENT_RING_SIZE (10 * sizeof (EVENT_DATA)) + +/* Tests for flags field of DHCP messages. */ + +#define ISBRDCST(X) ((X & htons(0x8000)) != 0) +#define SETBRDCST(X) ((X) |= htons(0x8000)) + +#ifndef sun +void align_msg(); +#endif +void set_srvport(); +int check_ipsum(); +int check_udpsum(); +u_short udp_cksum(); +u_short get_ipsum(); +u_short get_udpsum(); +u_short cksum(); +#ifndef VIRTUAL_STACK +struct if_info *read_interfaces (struct if_info *, int *, int); +#else +struct if_info *read_interfaces (struct if_info *, int *, int, BOOL *); +#endif /* VIRTUAL_STACK */ + +#ifdef VIRTUAL_STACK +int dhcp_exit_sock_open (void); +#endif /* VIRTUAL_STACK */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCcommon_subrh */ diff --git a/h/wrn/coreip/dhcp/copyright_dhcp.h b/h/wrn/coreip/dhcp/copyright_dhcp.h new file mode 100644 index 0000000..f9d1604 --- /dev/null +++ b/h/wrn/coreip/dhcp/copyright_dhcp.h @@ -0,0 +1,48 @@ +/* copyright_dhcp.h - WIDE project copyright for DHCP implementation */ + +/* Copyright 1984 - 1996 Wind River Systems, Inc. */ + +/* +modification history +____________________ +01a,03oct96,spm created. +*/ + +/* + * WIDE Project DHCP Implementation + * Copyright (c) 1995 Akihiro Tominaga + * Copyright (c) 1995 WIDE Project + * All rights reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided only with the following + * conditions are satisfied: + * + * 1. Both the copyright notice and this permission notice appear in + * all copies of the software, derivative works or modified versions, + * and any portions thereof, and that both notices appear in + * supporting documentation. + * 2. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by WIDE Project and + * its contributors. + * 3. Neither the name of WIDE Project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND WIDE + * PROJECT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES + * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ALSO, THERE + * IS NO WARRANTY IMPLIED OR OTHERWISE, NOR IS SUPPORT PROVIDED. + * + * Feedback of the results generated from any improvements or + * extensions made to this software would be much appreciated. + * Any such feedback should be sent to: + * + * Akihiro Tominaga + * WIDE Project + * Keio University, Endo 5322, Kanagawa, Japan + * (E-mail: dhcp-dist@wide.ad.jp) + * + * WIDE project has the rights to redistribute these changes. + */ diff --git a/h/wrn/coreip/dhcp/database.h b/h/wrn/coreip/dhcp/database.h new file mode 100644 index 0000000..ca708cd --- /dev/null +++ b/h/wrn/coreip/dhcp/database.h @@ -0,0 +1,259 @@ +/* database.h - DHCP server include file for database functions */ + +/* Copyright 1984 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01l,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01k,16mar04,ann merged from orion to create the MSP base +01j,05nov03,cdw Removal of unnecessary _KERNEL guards. +01i,04nov03,rlm Ran batch header path update for header re-org. +01h,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01g,10jun03,vvv include netVersion.h +01f,22aug02,wap merge from T2.2 +01e,11jul02,wap add process_parameters() and all its associated machinery +01d,09oct01,rae merge from truestack (remove some variables) +01c,06aug97,spm added definitions for C++ compilation +01b,09may97,spm corrected declarations of hooks for storage routines +01a,07apr97,spm created by modifying WIDE project DHCP implementation +*/ + +/* + * WIDE Project DHCP Implementation + * Copyright (c) 1995 Akihiro Tominaga + * Copyright (c) 1995 WIDE Project + * All rights reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided only with the following + * conditions are satisfied: + * + * 1. Both the copyright notice and this permission notice appear in + * all copies of the software, derivative works or modified versions, + * and any portions thereof, and that both notices appear in + * supporting documentation. + * 2. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by WIDE Project and + * its contributors. + * 3. Neither the name of WIDE Project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND WIDE + * PROJECT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES + * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ALSO, THERE + * IS NO WARRANTY IMPLIED OR OTHERWISE, NOR IS SUPPORT PROVIDED. + * + * Feedback of the results generated from any improvements or + * extensions made to this software would be much appreciated. + * Any such feedback should be sent to: + * + * Akihiro Tominaga + * WIDE Project + * Keio University, Endo 5322, Kanagawa, Japan + * (E-mail: dhcp-dist@wide.ad.jp) + * + * WIDE project has the rights to redistribute these changes. + */ + +#ifndef __INCdatabaseh +#define __INCdatabaseh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * functions prototype definition + */ +void dump_bind_entry(); +static time_t strtotime(); +int bindcidcmp(); +int paramcidcmp(); +int resipcmp(); +int relayipcmp(); +time_t _mktime(); + +static void read_entry(); +int process_entry(); +void set_default(struct dhcp_resource *); +static void adjust(); +static void get_string(); +static void get_string_vend(); +int eval_symbol(); +static void eat_whitespace(); +static long get_integer(); +static int prs_inaddr(); +static STATUS get_ip(); +static void default_netmask(); +int resnmcmp(); +static int read_idtype(); +static int read_cid(); +static int read_haddr(); +static int read_subnet(); + +int proc_sname(); +int proc_file(); +int proc_tblc(); +int proc_mtpt(); +int proc_clid(); +int proc_class(); +int proc_ip(); +int proc_ips(); +int proc_ippairs(); +int proc_hl(); +int proc_hs(); +int proc_nl(); +int proc_ns(); +int proc_octet(); +int proc_str(); +int proc_bool(); +int proc_vend(); + +STATUS process_parameters (); /* pdr: retrieve parameters of an entry */ + +/* + * pdr: reverse function for proc_xxx to retrieve parameters list + * from a lease descriptor + */ +int proc_mtpt_rev(); +int proc_clid_rev(); +int proc_class_rev(); +int proc_ip_rev(); +int proc_ips_rev(); +int proc_ippairs_rev(); +int proc_hl_rev(); +int proc_hs_rev(); +int proc_nl_rev(); +int proc_ns_rev(); +int proc_octet_rev(); +int proc_str_rev(); +int proc_bool_rev(); + + + +#define SUCCESS 0 +#define E_END_OF_ENTRY 1 + +#define MAXENTRYLEN 4096 +#define MAXSTRINGLEN 260 +#define MAX_MTUPLTSZ 127 +#define MAX_IPS 63 +#define MAX_IPPAIR 31 + +#define OP_ADDITION 1 /* Operations on tags */ +#define OP_DELETION 2 + +#ifndef BUFSIZ +#define BUFSIZ 1024 +#endif + +#ifndef VIRTUAL_STACK +IMPORT FUNCPTR dhcpsLeaseHookRtn; +IMPORT FUNCPTR dhcpsAddressHookRtn; +#endif /* !VIRTUAL_STACK */ + +struct symbolmap { + char *symbol; + int code; + int (*func)(); + int (*funcRev) (); /* pdr: reverse function to retrieve data */ +}; + +static struct symbolmap symbol_list[] = { + { "tblc", S_TABLE_CONT , proc_tblc , NULL }, + { "snam", S_SNAME , proc_sname , proc_str_rev }, + { "file", S_FILE , proc_file , proc_str_rev }, + { "siad", S_SIADDR , proc_ip , proc_ip_rev }, + { "albp", S_ALLOW_BOOTP , proc_bool , proc_bool_rev }, + { "ipad", S_IP_ADDR , proc_ip , NULL }, + { "maxl", S_MAX_LEASE , proc_hl , proc_hl_rev }, + { "dfll", S_DEFAULT_LEASE , proc_hl , proc_hl_rev }, + { "clid", S_CLIENT_ID , proc_clid , proc_clid_rev }, + { "pmid", S_PARAM_ID , proc_clid , proc_clid_rev }, + { "clas", S_CLASS_ID , proc_class , proc_class_rev }, + { "snmk", S_SUBNET_MASK , proc_ip , proc_ip_rev }, + { "tmof", S_TIME_OFFSET , proc_nl , proc_nl_rev }, + { "rout", S_ROUTER , proc_ips , proc_ips_rev }, + { "tmsv", S_TIME_SERVER , proc_ips , proc_ips_rev }, + { "nmsv", S_NAME_SERVER , proc_ips , proc_ips_rev }, + { "dnsv", S_DNS_SERVER , proc_ips , proc_ips_rev }, + { "lgsv", S_LOG_SERVER , proc_ips , proc_ips_rev }, + { "cksv", S_COOKIE_SERVER , proc_ips , proc_ips_rev }, + { "lpsv", S_LPR_SERVER , proc_ips , proc_ips_rev }, + { "imsv", S_IMPRESS_SERVER , proc_ips , proc_ips_rev }, + { "rlsv", S_RLS_SERVER , proc_ips , proc_ips_rev }, + { "hstn", S_HOSTNAME , proc_str , proc_str_rev }, + { "btsz", S_BOOTSIZE , proc_ns , proc_ns_rev }, + { "mdmp", S_MERIT_DUMP , proc_str , proc_str_rev }, + { "dnsd", S_DNS_DOMAIN , proc_str , proc_str_rev }, + { "swsv", S_SWAP_SERVER , proc_ip , proc_ip_rev }, + { "rpth", S_ROOT_PATH , proc_str , proc_str_rev }, + { "epth", S_EXTENSIONS_PATH , proc_str , proc_str_rev }, + { "ipfd", S_IP_FORWARD , proc_bool , proc_bool_rev }, + { "nlsr", S_NONLOCAL_SRCROUTE , proc_bool , proc_bool_rev }, + { "plcy", S_POLICY_FILTER , proc_ippairs , proc_ippairs_rev }, + { "mdgs", S_MAX_DGRAM_SIZE , proc_ns , proc_ns_rev }, + { "ditl", S_DEFAULT_IP_TTL , proc_octet , proc_octet_rev }, + { "mtat", S_MTU_AGING_TIMEOUT , proc_nl , proc_nl_rev }, + { "mtpt", S_MTU_PLATEAU_TABLE , proc_mtpt , proc_mtpt_rev }, + { "ifmt", S_IF_MTU , proc_ns , proc_ns_rev }, + { "asnl", S_ALL_SUBNET_LOCAL , proc_bool , proc_bool_rev }, + { "brda", S_BRDCAST_ADDR , proc_ip , proc_ip_rev }, + { "mskd", S_MASK_DISCOVER , proc_bool , proc_bool_rev }, + { "msks", S_MASK_SUPPLIER , proc_bool , proc_bool_rev }, + { "rtrd", S_ROUTER_DISCOVER , proc_bool , proc_bool_rev }, + { "rtsl", S_ROUTER_SOLICIT , proc_ip , proc_ip_rev }, + { "strt", S_STATIC_ROUTE , proc_ippairs , proc_ippairs_rev }, + { "trlr", S_TRAILER , proc_bool , proc_bool_rev }, + { "arpt", S_ARP_CACHE_TIMEOUT , proc_nl , proc_nl_rev }, + { "encp", S_ETHER_ENCAP , proc_bool , proc_bool_rev }, + { "dttl", S_DEFAULT_TCP_TTL , proc_octet , proc_octet_rev }, + { "kain", S_KEEPALIVE_INTER , proc_nl , proc_nl_rev }, + { "kagb", S_KEEPALIVE_GARBA , proc_bool , proc_bool_rev }, + { "nisd", S_NIS_DOMAIN , proc_str , proc_str_rev }, + { "nisv", S_NIS_SERVER , proc_ips , proc_ips_rev }, + { "ntsv", S_NTP_SERVER , proc_ips , proc_ips_rev }, + { "nnsv", S_NBN_SERVER , proc_ips , proc_ips_rev }, + { "ndsv", S_NBDD_SERVER , proc_ips , proc_ips_rev }, + { "nbnt", S_NB_NODETYPE , proc_octet , proc_octet_rev }, + { "nbsc", S_NB_SCOPE , proc_str , proc_str_rev }, + { "xfsv", S_XFONT_SERVER , proc_ips , proc_ips_rev }, + { "xdmn", S_XDISPLAY_MANAGER , proc_ips , proc_ips_rev }, + { "dht1", S_DHCP_T1 , proc_hs , proc_hs_rev }, + { "dht2", S_DHCP_T2 , proc_hs , proc_hs_rev }, + { "nspd", S_NISP_DOMAIN , proc_str , NULL }, + { "nsps", S_NISP_SERVER , proc_ips , NULL }, + { "miph", S_MOBILEIP_HA , proc_ips , NULL }, + { "smtp", S_SMTP_SERVER , proc_ips , NULL }, + { "pops", S_POP3_SERVER , proc_ips , NULL }, + { "nntp", S_NNTP_SERVER , proc_ips , NULL }, + { "wwws", S_DFLT_WWW_SERVER , proc_ips , NULL }, + { "fngs", S_DFLT_FINGER_SERVER, proc_ips , NULL }, + { "ircs", S_DFLT_IRC_SERVER , proc_ips , NULL }, + { "stsv", S_STREETTALK_SERVER , proc_ips , NULL }, + { "stda", S_STDA_SERVER, proc_ips, NULL }, + { "vend", S_VEND_OPT, proc_vend, NULL } +}; +#ifdef notdef +#ifndef VIRTUAL_STACK +struct hash_tbl cidhashtable; +struct hash_tbl iphashtable; +struct hash_tbl nmhashtable; +struct hash_tbl relayhashtable; +struct hash_tbl paramhashtable; +struct hash_member *bindlist; +struct hash_member *reslist; +#endif /* !VIRTUAL_STACK */ +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/dhcp/dhcp.h b/h/wrn/coreip/dhcp/dhcp.h new file mode 100644 index 0000000..b4d4f14 --- /dev/null +++ b/h/wrn/coreip/dhcp/dhcp.h @@ -0,0 +1,293 @@ +/* dhcp.h - Common DHCP include file for server, relay agent, and client */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* +modification history +--------------------- +01n,04nov03,rlm Ran batch header path update for header re-org. +01m,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01l,23oct03,rlm updated #includes for header re-org +01k,22aug02,wap merge from T2.2 +01j,23apr02,wap Add prototype for dhcpTime() (SPR #68900) +01i,27jun01,ppp removed MIN LEASE since it is not supported any more (SPR + #34799) +01h,07sep00,spm moved client-specific transmit routine to private module +01g,05apr00,spm added entries for boot-time client shared code +01f,24nov99,spm upgraded to RFC 2131 and removed direct link-level access +01e,04dec97,spm added code review modifications +01d,06aug97,spm added definitions for C++ compilation +01c,02jun97,spm changed DHCP option tags to prevent name conflicts (SPR #8667) +01b,29jan97,spm added little-endian support and additional DHCP defines. +01a,03oct96,spm created by modifying WIDE project DHCP Implementation. +*/ + +#ifndef __INCdhcph +#define __INCdhcph + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * WIDE Project DHCP Implementation + * Copyright (c) 1995 Akihiro Tominaga + * Copyright (c) 1995 WIDE Project + * All rights reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided only with the following + * conditions are satisfied: + * + * 1. Both the copyright notice and this permission notice appear in + * all copies of the software, derivative works or modified versions, + * and any portions thereof, and that both notices appear in + * supporting documentation. + * 2. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by WIDE Project and + * its contributors. + * 3. Neither the name of WIDE Project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND WIDE + * PROJECT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES + * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ALSO, THERE + * IS NO WARRANTY IMPLIED OR OTHERWISE, NOR IS SUPPORT PROVIDED. + * + * Feedback of the results generated from any improvements or + * extensions made to this software would be much appreciated. + * Any such feedback should be sent to: + * + * Akihiro Tominaga + * WIDE Project + * Keio University, Endo 5322, Kanagawa, Japan + * (E-mail: dhcp-dist@wide.ad.jp) + * + * WIDE project has the rights to redistribute these changes. + */ + +#include + +/* Tag values for DHCP options. */ + +#define _DHCP_PAD_TAG ((char) 0) +#define _DHCP_SUBNET_MASK_TAG ((char) 1) +#define _DHCP_TIME_OFFSET_TAG ((char) 2) +#define _DHCP_ROUTER_TAG ((char) 3) +#define _DHCP_TIME_SERVER_TAG ((char) 4) +#define _DHCP_NAME_SERVER_TAG ((char) 5) +#define _DHCP_DNS_SERVER_TAG ((char) 6) +#define _DHCP_LOG_SERVER_TAG ((char) 7) +#define _DHCP_COOKIE_SERVER_TAG ((char) 8) +#define _DHCP_LPR_SERVER_TAG ((char) 9) +#define _DHCP_IMPRESS_SERVER_TAG ((char) 10) +#define _DHCP_RLS_SERVER_TAG ((char) 11) +#define _DHCP_HOSTNAME_TAG ((char) 12) +#define _DHCP_BOOTSIZE_TAG ((char) 13) +#define _DHCP_MERIT_DUMP_TAG ((char) 14) +#define _DHCP_DNS_DOMAIN_TAG ((char) 15) +#define _DHCP_SWAP_SERVER_TAG ((char) 16) +#define _DHCP_ROOT_PATH_TAG ((char) 17) +#define _DHCP_EXTENSIONS_PATH_TAG ((char) 18) +#define _DHCP_IP_FORWARD_TAG ((char) 19) +#define _DHCP_NONLOCAL_SRCROUTE_TAG ((char) 20) +#define _DHCP_POLICY_FILTER_TAG ((char) 21) +#define _DHCP_MAX_DGRAM_SIZE_TAG ((char) 22) +#define _DHCP_DEFAULT_IP_TTL_TAG ((char) 23) +#define _DHCP_MTU_AGING_TIMEOUT_TAG ((char) 24) +#define _DHCP_MTU_PLATEAU_TABLE_TAG ((char) 25) +#define _DHCP_IF_MTU_TAG ((char) 26) +#define _DHCP_ALL_SUBNET_LOCAL_TAG ((char) 27) +#define _DHCP_BRDCAST_ADDR_TAG ((char) 28) +#define _DHCP_MASK_DISCOVER_TAG ((char) 29) +#define _DHCP_MASK_SUPPLIER_TAG ((char) 30) +#define _DHCP_ROUTER_DISCOVER_TAG ((char) 31) +#define _DHCP_ROUTER_SOLICIT_TAG ((char) 32) +#define _DHCP_STATIC_ROUTE_TAG ((char) 33) +#define _DHCP_TRAILER_TAG ((char) 34) +#define _DHCP_ARP_CACHE_TIMEOUT_TAG ((char) 35) +#define _DHCP_ETHER_ENCAP_TAG ((char) 36) +#define _DHCP_DEFAULT_TCP_TTL_TAG ((char) 37) +#define _DHCP_KEEPALIVE_INTERVAL_TAG ((char) 38) +#define _DHCP_KEEPALIVE_GARBAGE_TAG ((char) 39) +#define _DHCP_NIS_DOMAIN_TAG ((char) 40) +#define _DHCP_NIS_SERVER_TAG ((char) 41) +#define _DHCP_NTP_SERVER_TAG ((char) 42) +#define _DHCP_VENDOR_SPEC_TAG ((char) 43) +#define _DHCP_NBN_SERVER_TAG ((char) 44) +#define _DHCP_NBDD_SERVER_TAG ((char) 45) +#define _DHCP_NB_NODETYPE_TAG ((char) 46) +#define _DHCP_NB_SCOPE_TAG ((char) 47) +#define _DHCP_XFONT_SERVER_TAG ((char) 48) +#define _DHCP_XDISPLAY_MANAGER_TAG ((char) 49) +#define _DHCP_REQUEST_IPADDR_TAG ((char) 50) +#define _DHCP_LEASE_TIME_TAG ((char) 51) +#define _DHCP_OPT_OVERLOAD_TAG ((char) 52) +#define _DHCP_MSGTYPE_TAG ((char) 53) +#define _DHCP_SERVER_ID_TAG ((char) 54) +#define _DHCP_REQ_LIST_TAG ((char) 55) +#define _DHCP_ERRMSG_TAG ((char) 56) +#define _DHCP_MAXMSGSIZE_TAG ((char) 57) +#define _DHCP_T1_TAG ((char) 58) +#define _DHCP_T2_TAG ((char) 59) +#define _DHCP_CLASS_ID_TAG ((char) 60) +#define _DHCP_CLIENT_ID_TAG ((char) 61) +#define _DHCP_NISP_DOMAIN_TAG ((char) 64) +#define _DHCP_NISP_SERVER_TAG ((char) 65) +#define _DHCP_TFTP_SERVERNAME_TAG ((char) 66) +#define _DHCP_BOOTFILE_TAG ((char) 67) +#define _DHCP_MOBILEIP_HA_TAG ((char) 68) +#define _DHCP_SMTP_SERVER_TAG ((char) 69) +#define _DHCP_POP3_SERVER_TAG ((char) 70) +#define _DHCP_NNTP_SERVER_TAG ((char) 71) +#define _DHCP_DFLT_WWW_SERVER_TAG ((char) 72) +#define _DHCP_DFLT_FINGER_SERVER_TAG ((char) 73) +#define _DHCP_DFLT_IRC_SERVER_TAG ((char) 74) +#define _DHCP_STREETTALK_SERVER_TAG ((char) 75) +#define _DHCP_STDA_SERVER_TAG ((char) 76) +#define _DHCP_END_TAG ((char) 255) + +#define _DHCP_LAST_OPTION _DHCP_STDA_SERVER_TAG +#define _DHCP_MAX_OPTLEN 255 + +/* + * Hardware type values from the arp section of the assigned numbers RFC. + * (Frequently used as client identifier types). + */ + +#define ETHER 1 /* Ethernet (10Mb) */ +#define EXPETHER 2 /* Experimental Ethernet (3Mb) */ +#define AX25 3 /* Amateur Radio AX.25 */ +#define PRONET 4 /* Proteon ProNET Token Ring */ +#define CHAOS 5 /* Chaos */ +#define IEEE802 6 /* IEEE 802 Networks */ +#define ARCNET 7 /* ARCNET */ +#define HYPERCH 8 /* Hyperchannel */ +#define LANSTAR 9 /* Lanstar */ +#define AUTONET 10 /* Autonet Short Address */ +#define LOCALTALK 11 /* LocalTalk */ +#define LOCALNET 12 /* LocalNet */ +#define ULTRALINK 13 /* Ultra link */ +#define FRAMERELAY 15 /* Frame Relay */ +#define SERIAL 20 /* Serial Line */ +#define DNS_NAME 128 /* DNS name */ + +/* Definitions for DHCP message format. */ + +#define MAX_HLEN 16 /* maximum length of haddr field */ +#define MAX_SNAME 64 +#define MAX_FILE 128 +#define DFLTOPTLEN 312 +#define BOOTPOPTLEN 64 +#define MAXOPT 0xff +#define INFINITY 0xffffffff + +/* Definitions for ARP messages. */ + +#define MAX_ARPLEN (sizeof (struct arphdr) + 2 * (MAX_HLEN + 4)) +#define ARPHL (sizeof (struct arphdr)) + +#if CPU_FAMILY==I960 +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* DHCP message format */ + +struct dhcp + { + unsigned char op; /* packet type */ + unsigned char htype; /* Link-level interface address type */ + unsigned char hlen; /* Link-level interface address length */ + unsigned char hops; /* Hops through DHCP relay agents */ + unsigned long xid; /* transaction ID */ + unsigned short secs; /* seconds since lease negotiation started */ + unsigned short flags; + struct in_addr ciaddr; /* Client's current IP address */ + struct in_addr yiaddr; /* Client's assigned IP address */ + struct in_addr siaddr; /* Address of (tftp) server */ + struct in_addr giaddr; /* Address of relay agent */ + char chaddr [MAX_HLEN]; /* Client's hardware address */ + char sname [MAX_SNAME]; /* Host name of DHCP server */ + char file [MAX_FILE]; /* File name of boot image */ + char options [DFLTOPTLEN]; /* DHCP message options */ + }; + +struct ps_udph /* pseudo udp header for checksum */ + { + struct in_addr srcip; + struct in_addr dstip; + char zero; + char prto; + short ulen; + }; + +#if CPU_FAMILY==I960 +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* Definitions for processing incoming DHCP messages */ + +#define DHCP_MSG_SIZE (DFLTDHCPLEN + UDPHL + IPHL) +#define MESSAGE_RING_SIZE (10 * DHCP_MSG_SIZE) +#define DFLTDHCPLEN sizeof (struct dhcp) /* default DHCP message size */ +#define DFLTBOOTPLEN (DFLTDHCPLEN - DFLTOPTLEN + BOOTPOPTLEN) +#define DHCPLEN(UDP) (ntohs(UDP->uh_ulen) - UDPHL) /* get DHCP msg size */ + /* from UDP header */ +#define OPTBODY(TAGP) ( ( (char *)TAGP) + 2) /* get DHCP option contents */ +#define DHCPOPTLEN(TAGP) ((UINT8) * ( ((char *)TAGP) + 1)) /* option length */ + +/* handle the word alignment */ +#define GETHS(PTR) (*((u_char *)PTR)*256 + *(((u_char *)PTR)+1)) +#define GETHL(PTR) (*((u_char *)PTR)*256*256*256 + *(((u_char *)PTR)+1)*256*256 +\ + *(((u_char *)PTR)+2)*256 + *(((u_char *)PTR)+3)) + +/* Bit operators for options flags. */ + +#define SETBIT(a,i) ((a)[(i) / 8] |= (1 << (7 - (i) % 8))) +#define CLRBIT(a,i) ((a)[(i) / 8] &= ~(1 << (7 - (i) % 8))) +#define ISSET(a,i) ((a)[(i) / 8] & (1 << (7 - (i) % 8))) +#define ISCLR(a,i) (((a)[(i) / 8] & (1 << (7 - (i) % 8))) == 0) + +#define BOOTREQUEST 1 +#define BOOTREPLY 2 + + +/* + * DHCP/BOOTP magic cookie defined in RFC 1048 + */ + +#define RFC1048_MAGIC { 99, 130, 83, 99 } +#define MAGIC_LEN 4 + +/* DHCP message types */ + +#define DHCPDISCOVER 1 +#define DHCPOFFER 2 +#define DHCPREQUEST 3 +#define DHCPDECLINE 4 +#define DHCPACK 5 +#define DHCPNAK 6 +#define DHCPRELEASE 7 +#define DHCPINFORM 8 +#define BOOTP 0 + +/* Classification of DHCP message fields */ + +#define FILE_ISOPT 1 +#define SNAME_ISOPT 2 +#define BOTH_AREOPT FILE_ISOPT + SNAME_ISOPT + +/* Common routines for all DHCP components */ + +IMPORT int dhcpConvert (int); +IMPORT char * pickup_opt (struct dhcp *, int, char); +IMPORT u_short udp_cksum (struct ps_udph *, char *, int); +IMPORT time_t dhcpTime (time_t *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/dhcp/dhcpc.h b/h/wrn/coreip/dhcp/dhcpc.h new file mode 100644 index 0000000..3874fec --- /dev/null +++ b/h/wrn/coreip/dhcp/dhcpc.h @@ -0,0 +1,355 @@ +/* dhcpc.h - DHCP runtime client include file for shared definitions */ + +/* Copyright 1984 - 2004 Wind River Systems, Inc. */ + +/* +modification history +--------------------- +01q,20aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01p,15mar04,ann merged from orion to create the MSP base. +01o,04nov03,rlm Ran batch header path update for header re-org. +01n,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01m,23oct03,rlm updated #includes for header re-org +01l,22aug02,wap merge from T2.2 +01k,12dec01,wap Interface name field of if_info structure is too small for + some interface names (SPR #29087) +01j,31oct01,vvv fixed warnings when BOOTP and DHCP are included in image +01i,09oct01,rae merge from truestack ver 01b/2 base 01h (SPRs 69850, 68014) +01h,05apr00,spm removed unused offset (BPF provides required alignment) +01g,24nov99,spm upgraded to RFC 2131 and removed direct link-level access +01f,06oct97,spm split interface name into device name and unit number +01e,06aug97,spm removed parameters linked list to reduce memory required; + added definitions for C++ compilation; renamed class field + of dhcp_reqspec structure to prevent C++ errors (SPR #9079) +01d,02jun97,spm changed DHCP option tags to prevent name conflicts (SPR #8667) +01c,07apr97,spm removed #define's now in configAll.h, changed router_solicit + field in parameter descriptor from pointer to structure +01b,03jan97,spm added little-endian support and moved macros to dhcp.h +01a,03oct96,spm created by modifying WIDE project DHCP implementation +*/ + +#ifndef __INCdhcpch +#define __INCdhcpch + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include +#include +#include +#include + +#define ETHERHL sizeof(struct ether_header) + +#ifndef IPHL +#define IPHL sizeof(struct ip) +#endif + +#ifndef UDPHL +#define UDPHL sizeof(struct udphdr) +#endif + +#define WORD 4 /* Multiplier for IP header length field */ + +/* Notification routine event types. */ + +#define DHCPC_LEASE_NEW 0 +#define DHCPC_LEASE_INVALID 1 + +/* DHCP client operations to access permanent storage. */ + +#define DHCP_CACHE_READ 0 +#define DHCP_CACHE_WRITE 1 +#define DHCP_CACHE_ERASE 2 + +#if CPU_FAMILY==I960 +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +struct client_id + { + /* + * The DHCP client identifer consists of a string of characters. + * Typically, the client identifier contains a type value (from the + * hardware type values in the ARP section of the assigned numbers + * RFC) followed by the hardware address from the data link layer. + */ + + unsigned char len; + char * id; + }; + +struct request_list + { + /* + * This structure defines the contents of the option request list, which + * consists of a sequence of DHCP option tags of the indicated length. + * A DHCP server may provide any, all, or none of the specified options + * to the requesting client. + */ + + u_char len; /* Length of request list. */ + char list [0xff]; /* Storage for option tags. */ + }; + +struct vendor_list + { + /* + * This structure defines the components of vendor-specific information + * which may be returned by a DHCP server. The contents of that option + * are not defined by the DHCP specification. + */ + + u_char len; /* Amount of vendor-specific data. */ + char list [255]; /* Contents of vendor-specific data. */ + }; + +/* + * Request specification for DHCP lease - partially filled by + * dhcpcOptionSet() and/or dhcpcOptionAdd() routines. + */ + +struct dhcp_reqspec + { + u_short maxlen; /* Maximum supported DHCP message */ + u_short optlen; /* Length of message's option field. */ + int waitsecs; /* Duration for collecting additional lease offers. */ + struct in_addr ipaddr; /* Requested IP address */ + struct in_addr srvaddr; /* IP address of DHCP server */ + struct request_list reqlist; /* List of requested options */ + struct client_id * clid; /* Client identifier */ + char * dhcp_errmsg; + struct dhcpcOpts * pOptList; /* Suggested values for options */ + char * pOptions; /* Derived options field contents */ + }; + +struct in_addrs + { + /* + * This structure defines the components of a list of IP addresses. + * Some of the options provided by the DHCP server use this format. + */ + + unsigned char num; /* Number of IP addresses returned. */ + struct in_addr * addr; /* IP address values. */ + }; + +struct u_shorts + { + /* + * This structure defines a list of 16-bit numbers used for some of + * the DHCP options. + */ + + unsigned char num; /* Number of 16-bit values returned. */ + unsigned short * shortnum; /* List of values returned. */ + }; + +#define MAXTAGNUM (_DHCP_LAST_OPTION + 1) +#define OPTMASKSIZE (MAXTAGNUM / 8 + 1 ) + +/* Options storage structure - used by the dhcpcOptionAdd () routine. */ + +struct dhcpcOpts + { + int optlen; /* Current total size of option data */ + char optmask [OPTMASKSIZE]; /* indicates available entries */ + ULONG tag1; /* subnet mask value */ + long tag2; /* time offset value */ + UCHAR * pTag3; /* router address values */ + UCHAR * pTag4; /* time server address values */ + UCHAR * pTag5; /* name server address values */ + UCHAR * pTag6; /* domain name server address values */ + UCHAR * pTag7; /* log server address values */ + UCHAR * pTag8; /* cookie server address values */ + UCHAR * pTag9; /* LPR server address values */ + UCHAR * pTag10; /* Impress server address values */ + UCHAR * pTag11; /* Resource location server address values */ + char * pTag12; /* Host name value */ + USHORT tag13; /* Boot file size value */ + char * pTag14; /* Merit dump file value */ + char * pTag15; /* Domain name value */ + ULONG tag16; /* Swap server value */ + char * pTag17; /* Root path value */ + char * pTag18; /* Extensions path value */ + UCHAR tag19; /* IP Forwarding flag value */ + UCHAR tag20; /* Non-local source routing flag value */ + UCHAR * pTag21; /* Policy filter address/mask values */ + USHORT tag22; /* Maximum datagram size value */ + UCHAR tag23; /* Default IP TTL value */ + ULONG tag24; /* Path MTU aging timeout value */ + UCHAR * pTag25; /* Path MTU plateau table values */ + USHORT tag26; /* MTU size value */ + UCHAR tag27; /* All subnets local flag value */ + ULONG tag28; /* Broadcast address value */ + UCHAR tag29; /* Mask discovery flag value */ + UCHAR tag30; /* Mask supplier flag value */ + UCHAR tag31; /* Router discovery flag value */ + ULONG tag32; /* Router soliciation address value */ + UCHAR * pTag33; /* Static route address/mask values */ + UCHAR tag34; /* Trailer encapsulation flag value */ + ULONG tag35; /* ARP cache timeout value */ + UCHAR tag36; /* Ethernet encapsulation flag value */ + UCHAR tag37; /* Default TCP TTL value */ + ULONG tag38; /* TCP keepalive interval value */ + UCHAR tag39; /* TCP keepalive garbage octet flag value */ + char * pTag40; /* NIS domain value */ + UCHAR * pTag41; /* NIS server address values */ + UCHAR * pTag42; /* NTP server address values */ + UCHAR * pTag43; /* Vendor specific information value */ + UCHAR * pTag44; /* NetBIOS name server address values */ + UCHAR * pTag45; /* NBDD server address values */ + UCHAR tag46; /* NetBIOS node type value */ + char * pTag47; /* NetBIOS scope value */ + UCHAR * pTag48; /* X Windows font server address values */ + UCHAR * pTag49; /* X Windows display manager address values */ + /* Tag 50 may not be set manually. */ + ULONG tag51; /* Lease time value */ + /* Tags 52, 53, 54 and 57 may not be set manually. */ + UCHAR * pTag55; /* Parameter request list value */ + char * pTag56; /* Error message value */ + ULONG tag58; /* Renewal time value */ + ULONG tag59; /* Rebinding time value */ + UCHAR * pTag60; /* Class identifier value */ + UCHAR * pTag61; /* Client identifier value */ + /* Tags 62 and 63 are currently undefined. */ + char * pTag64; /* NIS+ domain value */ + UCHAR * pTag65; /* NIS+ server address values */ + char * pTag66; /* TFTP server name value */ + char * pTag67; /* Boot file name value */ + UCHAR * pTag68; /* Mobile IP home agent address values */ + UCHAR * pTag69; /* SMTP server address values */ + UCHAR * pTag70; /* POP server address values */ + UCHAR * pTag71; /* NNTP server address values */ + UCHAR * pTag72; /* WWW server address values */ + UCHAR * pTag73; /* Finger server address values */ + UCHAR * pTag74; /* IRC server address values */ + UCHAR * pTag75; /* StreetTalk server address values */ + UCHAR * pTag76; /* STDA server address values */ + }; + +/* Parameter retrieval structure - used by the dhcpcParamsGet () routine. */ + +struct dhcp_param + { + char got_option [OPTMASKSIZE]; + char msgtype; /* DHCP reply or BOOTP reply? */ + char * sname; /* Host name of DHCP server */ + char * temp_sname; /* Server host name if 'sname' holds options. */ + char * file; /* Boot file name */ + char * temp_file; /* File name if 'file' holds options. */ + char * hostname; /* Host name of bootstrap server */ + char * merit_dump; + char * dns_domain; + char * root_path; + char * extensions_path; + char * nis_domain; + char * nb_scope; /* NetBIOS scope */ + char * errmsg; + char * nisp_domain; /* NIS+ domain name */ + char * tftp_server; /* TFTP Server name */ + unsigned char ip_forward; /* Boolean flag */ + unsigned char nonlocal_srcroute; /* Boolean flag */ + unsigned char all_subnet_local; /* Boolean flag */ + unsigned char mask_discover; /* Boolean flag */ + unsigned char mask_supplier; /* Boolean flag */ + unsigned char router_discover; /* Boolean flag */ + unsigned char trailer; /* Boolean flag */ + unsigned char ether_encap; /* Boolean flag */ + unsigned char keepalive_garba; /* Boolean flag */ + unsigned char nb_nodetype; /* NetBIOS node type */ + +#define BNODE 0x1 +#define PNODE 0x2 +#define MNODE 0x4 +#define HNODE 0x8 + unsigned char default_ip_ttl; /* time to live (1 - 255) */ + unsigned char default_tcp_ttl; + unsigned short bootsize; /* bootfile size in 16 bits */ + unsigned short max_dgram_size; /* max dgram reassembly */ + unsigned short intf_mtu; /* interface mtu */ + long time_offset; /* 32 bits integer (network byte order) + offset from UTC */ + unsigned long lease_origin; /* DHCP lease start time */ + unsigned long lease_duration; /* DHCP lease duration */ + unsigned long dhcp_t1; + unsigned long dhcp_t2; + unsigned long mtu_aging_timeout; /* 32 bit unsigned integer */ + unsigned long arp_cache_timeout; + unsigned long keepalive_inter; + struct u_shorts * mtu_plateau_table; /* array of 16 bit integers */ + struct in_addr server_id; /* DHCP server's IP address */ + struct in_addr ciaddr; /* Client's current address */ + struct in_addr yiaddr; /* Client's assigned address */ + struct in_addr siaddr; /* Address of (tftp) server */ + struct in_addr giaddr; /* Address of relay agent */ + struct in_addr * subnet_mask; + struct in_addr * swap_server; + struct in_addr * brdcast_addr; + struct in_addr router_solicit; + struct in_addrs * router; + struct in_addrs * time_server; + struct in_addrs * name_server; + struct in_addrs * dns_server; /* DNS server */ + struct in_addrs * log_server; + struct in_addrs * cookie_server; + struct in_addrs * lpr_server; + struct in_addrs * impress_server; + struct in_addrs * rls_server; /* Resource Location Server */ + struct in_addrs * policy_filter; + struct in_addrs * static_route; + struct in_addrs * nis_server; + struct in_addrs * ntp_server; + struct in_addrs * nbn_server; /* NetBIOS name server */ + struct in_addrs * nbdd_server; /* NetBIOS dgram distrib server */ + struct in_addrs * xfont_server; /* X font erver */ + struct in_addrs * xdisplay_manager; /* X display manager */ + struct in_addrs * nisp_server; /* NIS+ server */ + struct in_addrs * mobileip_ha; /* Mobile IP Home Agent */ + struct in_addrs * smtp_server; + struct in_addrs * pop3_server; + struct in_addrs * nntp_server; + struct in_addrs * dflt_www_server; + struct in_addrs * dflt_finger_server; + struct in_addrs * dflt_irc_server; + struct in_addrs * streettalk_server; + struct in_addrs * stda_server; /* StreetTalk Directory Assistance */ + struct vendor_list * vendlist; /* Vendor-specific information */ + }; + +struct chaddr + { + unsigned char htype; + unsigned char hlen; + char haddr[MAX_HLEN]; + }; + +struct if_info + { + char name [IFNAMSIZ]; + short unit; + int bpfDev; /* BPF file descriptor */ + int bufSize; /* Size of BPF data buffer */ + struct chaddr haddr; + struct ifnet * iface; + }; + +struct msg + { + struct ip *ip; + struct udphdr *udp; + struct dhcp *dhcp; + }; + +#if CPU_FAMILY==I960 +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/dhcp/dhcpcBoot.h b/h/wrn/coreip/dhcp/dhcpcBoot.h new file mode 100644 index 0000000..66284ed --- /dev/null +++ b/h/wrn/coreip/dhcp/dhcpcBoot.h @@ -0,0 +1,91 @@ +/* dhcpcBoot.h - DHCP client include file for boot-time internal usage */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01k,04nov03,rlm Ran batch header path update for header re-org. +01j,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01i,27oct03,rlm update include statements post header re-org. +01h,22aug02,wap merge from T2.2 +01g,05nov01,vvv fixed compilation warning +01f,09oct01,rae merge from truestack +01e,05apr00,spm upgraded to RFC 2131 and removed direct link-level access; + removed entries shared with run-time client +01d,04dec97,spm added code review modifications +01c,06oct97,spm added support for dynamic driver type detection +01b,02sep97,spm removed name conflicts with runtime DHCP client (SPR #9241) +01a,26aug97,spm created to preserve single-lease interface at boot time + from existing include files - 01f of dhcpClientCommon.h, + 01d of dhcp.h, 01c of dhcpCommonSubr.h, and 01e of dhcpc.h +*/ + +#ifndef __INCdhcpcBooth +#define __INCdhcpcBooth + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include + +/* Define sources for events. */ + +#define DHCP_AUTO_EVENT 0 + +/* Define types of events. */ + +#define DHCP_MSG_ARRIVED 0 +#define DHCP_TIMEOUT 1 + +/* Status of DHCP client. */ + +#define DHCP_MANUAL 0 /* IP address assigned manually. */ +#define DHCP_BOOTP 1 /* Lease established using BOOTP reply. */ +#define DHCP_NATIVE 2 /* Lease established using DHCP reply. */ + +/* DHCP boot-time client state definitions */ + +#define INIT 0 +#define WAIT_OFFER 1 +#define SELECTING 2 +#define REQUESTING 3 +#define BOUND 4 +#define INFORMING 5 + +/* DHCP client message processing definitions */ + +#define CHKOFF(LEN) (offopt + 2 + (LEN) < DFLTOPTLEN) /* check option offset */ + +#define WORD 4 + +#define EVENT_RING_SIZE (10 * sizeof (EVENT_DATA)) + +IMPORT int dhcpcBindType; /* Type of DHCP lease, if any. */ + +IMPORT struct dhcp_param * dhcpcBootParam; /* Configuration parameters */ + +/* Mirror variables for values assigned externally when building image. */ + +IMPORT int dhcpcMinLease; /* Minimum lease length accepted. */ +IMPORT int _dhcpcReadTaskPriority; /* Priority level of data retriever */ +IMPORT int _dhcpcReadTaskOptions; /* Option settings of data retriever */ +IMPORT int _dhcpcReadTaskStackSize; /* Stack size of data retriever */ +IMPORT int dhcpcReadTaskId; /* Identifier for data retrieval task */ + +/* + * Access point to start message exchanges for lease negotation, or for + * additional configuration parameters if an address is already known. + */ + +IMPORT int dhcp_boot_client (struct if_info *, int, int, BOOL); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/dhcp/dhcpcCommonLib.h b/h/wrn/coreip/dhcp/dhcpcCommonLib.h new file mode 100644 index 0000000..957ed48 --- /dev/null +++ b/h/wrn/coreip/dhcp/dhcpcCommonLib.h @@ -0,0 +1,198 @@ +/* dhcpcCommonLib.h - common include file for run-time and boot-time client */ + +/* + * Copyright (c) 1996-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01v,03may05,ijm init backoff shouldn't delay other leases, SPR#108221; + wait 10 secs minimum after a failed ARP check, SPR#103457; + read task must read descriptors after select, SPR#108223 +01u,16mar04,ann merged from orion to create the MSP base +01t,20nov03,niq Remove copyright_wrs.h file inclusion +01s,05nov03,cdw Removal of unnecessary _KERNEL guards. +01r,04nov03,rlm Ran batch header path update for header re-org. +01q,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01p,24feb03,vvv added prototype for dhcpcOptionAdd() +01o,06feb03,vvv merged from tor2_2-patch.alameda, ver01n (SPR #83246) +01n,22aug02,wap merge from T2.2 +01m,08jan02,wap fix duplicate error codes (SPR #72103) +01l,09oct01,rae merge from truestack (SPR 69850) +01k,07sep00,spm moved client-specific transmit routine from shared module +01j,05apr00,spm added entries for boot-time client shared code +01i,24nov99,spm upgraded to RFC 2131 and removed direct link-level access +01h,17mar99,spm enabled dhcpcRelease() routine (SPR #25482) +01g,06oct97,spm added relative paths to #include statements; removed warnings +01f,06aug97,spm removed parameters linked list to reduce memory required; + added definitions for C++ compilation +01e,10jun97,spm isolated incoming messages in state machine from input hooks +01d,06may97,spm added DHCPC_OFF to align IP header on four byte boundary +01c,07apr97,spm added shutdown return code +01b,29jan97,spm added little-endian support and modified for coding standards +01a,03oct96,spm created by modifying WIDE project DHCP implementation +*/ + +#ifndef __INCdhcpClientCommonh +#define __INCdhcpClientCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#define S_dhcpcLib_NOT_INITIALIZED (M_dhcpcLib | 1) +#define S_dhcpcLib_BAD_DEVICE (M_dhcpcLib | 2) +#define S_dhcpcLib_MAX_LEASES_REACHED (M_dhcpcLib | 3) +#define S_dhcpcLib_MEM_ERROR (M_dhcpcLib | 4) +#define S_dhcpcLib_BAD_COOKIE (M_dhcpcLib | 5) +#define S_dhcpcLib_NOT_BOUND (M_dhcpcLib | 6) +#define S_dhcpcLib_BAD_OPTION (M_dhcpcLib | 7) +#define S_dhcpcLib_OPTION_NOT_PRESENT (M_dhcpcLib | 8) +#define S_dhcpcLib_TIMER_ERROR (M_dhcpcLib | 9) +#define S_dhcpcLib_OPTION_NOT_STORED (M_dhcpcLib | 10) + +/* Define sources for events. */ + +#define DHCP_AUTO_EVENT 0 +#define DHCP_USER_EVENT 1 + +/* Define types of events. */ + +#define DHCP_MSG_ARRIVED 0 +#define DHCP_TIMEOUT 1 +#define DHCP_USER_BIND 2 +#define DHCP_USER_VERIFY 3 +#define DHCP_USER_RELEASE 4 +#define DHCP_USER_SHUTDOWN 5 +#define DHCP_USER_INFORM 6 + +/* State transition definitions (besides OK or ERROR). */ + +#define DHCPC_DONE 2 /* Lease relinquished or expired - exit. */ +#define DHCPC_MORE 3 /* Call a second routine when processing. */ +#define DHCPC_STATE_BEGIN 6 /* Initial processing after DHCPC_MORE. */ + +/* Return codes indicate special situations related to state machine. */ + +#define DHCPC_SHUTDOWN 11 +#define DHCPC_ERROR 12 + +/* Classification of DHCP client leases. */ + +#define DHCP_MANUAL 0 /* Lease established after system boot. */ +#define DHCP_BOOTP 1 /* Lease established using BOOTP reply. */ +#define DHCP_NATIVE 2 /* Lease established using DHCP reply. */ +#define DHCP_AUTOMATIC 3 /* Bound at boot time - lease still valid. */ + +/* Internal settings for state machine */ + +#define FIRSTTIMER 4 +#define MAXTIMER 64 +#define INIT_WAITING 10 +#define DISCOVER_RETRANS 4 + +#if CPU_FAMILY==I960 +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct leaseData /* Lease-specific variables. */ + { + BOOL initFlag; /* Lease initialized? */ + BOOL waitFlag; /* Synchronous or asynchronous bind attempt? */ + BOOL autoConfig; /* Apply parameters to network interface? */ + BOOL oldFlag; /* Use old (padded) DHCP message formats? */ + BOOL arpCheckFailed; /* ARP check after DHCP ACK failed? */ + BOOL initWaitDone; /* Initial wait in INIT state done? */ + SEM_ID leaseSem; /* Blocking semaphore for synchronous bind. */ + BOOL leaseGood; /* Bind attempt successful? */ + char * msgBuffer; + int leaseType; /* Static or dynamic parameters, or BOOTP. */ + int prevState; /* Preceding state in state machine. */ + int currState; /* Current/next state in state machine. */ + WDOG_ID timer; /* Timeout interval for DHCP events */ + time_t initEpoch; /* Timestamp of last request. */ + int timeout; /* Current timeout interval. */ + int numRetry; /* Number of retransmission timeouts. */ + FUNCPTR eventHookRtn; /* Event notification hook */ + FUNCPTR cacheHookRtn; /* Data storage hook */ + struct dhcp_reqspec leaseReqSpec; /* Options request list */ + struct if_info ifData; /* Transmit/receive interface */ + unsigned long xid; /* Current transaction ID. */ + struct dhcp_param *dhcpcParam; /* Current configuration parameters */ + } +LEASE_DATA; + +typedef struct messageData /* Storage for incoming DHCP messages */ + { + BOOL writeFlag; /* Buffer available? */ + char *msgBuffer; /* Data buffer contents (copied from BPF) */ + } +MESSAGE_DATA; + +typedef struct dhcpcEvent /* External event descriptor. */ + { + unsigned char source; /* Automatic event or manual event? */ + unsigned char type; /* Manual event - defines user request. + * Automatic - message arrival or timeout. + */ + void * leaseId; /* Cookie assigned by dhcpcInit (). */ + int slot; /* Offset of message buffer in list. */ + char * pMsg; /* Start of DHCP message */ + BOOL lastFlag; /* Release buffer when finished processing? */ + } +EVENT_DATA; + +/* Values for lease established during system boot. */ + +typedef struct dhcpLeaseData + { + struct in_addr yiaddr; /* assigned IP address */ + unsigned long lease_origin; /* start time of lease */ + unsigned long lease_duration; /* length of lease */ + } +DHCP_LEASE_DATA; + +struct buffer /* transmission buffer for DHCP messages */ + { + char * buf; + int size; + }; + +#if CPU_FAMILY==I960 +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#define EVENT_RING_SIZE (10 * sizeof (EVENT_DATA)) + +IMPORT RING_ID dhcpcEventRing; /* Ring buffer of DHCP events */ +IMPORT SEM_ID dhcpcEventSem; /* DHCP event notification */ + +IMPORT BOOL dhcpcInitialized; +IMPORT DHCP_LEASE_DATA dhcpcBootLease; /* Settings from boot-time lease. */ +IMPORT LEASE_DATA ** dhcpcLeaseList; /* List of available cookies. */ +IMPORT MESSAGE_DATA * dhcpcMessageList; /* Incoming DHCP messages. */ +IMPORT char * dhcpcDiscardBuf; /* Handle message list overflow. */ +IMPORT int dhcpcMaxLeases; /* Max. number of simultaneous leases. */ +IMPORT int dhcpcDiscoverRetries; /* Max. number of DISCOVER retries */ +IMPORT void dhcpcOptFieldCreate (struct dhcpcOpts *, UCHAR *); +IMPORT void dhcpcDefaultsSet (struct dhcp_param *); +IMPORT void dhcpcParamsCopy (LEASE_DATA *, struct dhcp_param *); +IMPORT STATUS dhcpcArpSend (struct ifnet *, char *, int); +IMPORT STATUS dhcpSend (struct ifnet *, struct sockaddr_in *, + char *, int, BOOL); +IMPORT STATUS dhcpcEventAdd (int, int, void *, BOOL); +IMPORT void dhcpcLeaseCleanup (LEASE_DATA *); +IMPORT STATUS dhcpcOptionAdd (void *, UCHAR, int, UCHAR *); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/dhcp/dhcpcInit.h b/h/wrn/coreip/dhcp/dhcpcInit.h new file mode 100644 index 0000000..d18b94b --- /dev/null +++ b/h/wrn/coreip/dhcp/dhcpcInit.h @@ -0,0 +1,48 @@ +/* dhcpcInit.h - DHCP runtime client include file for system startup */ + +/* Copyright 1984 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01n,16mar04,ann merged from orion to create the MSP base +01m,05nov03,cdw Removal of unnecessary _KERNEL guards. +01l,04nov03,rlm Ran batch header path update for header re-org. +01k,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01j,10jun03,vvv include netVersion.h +01i,25apr03,vvv deleted duplicate reference to dhcpcShowInit() +01h,22mar02,hgo change dhcpcConfigSet declaration +01g,16nov00,spm enabled new DHCP lease for runtime device setup (SPR #20438) +01f,24nov99,spm upgraded to RFC 2131 and removed direct link-level access +01e,06aug97,spm removed parameters linked list to reduce memory required; + added definitions for C++ compilation; renamed class field + of dhcp_reqspec structure to prevent C++ errors (SPR #9079) +01d,02jun97,spm changed DHCP option tags to prevent name conflicts (SPR #8667) +01c,07apr97,spm removed #define's now in configAll.h, changed router_solicit + field in parameter descriptor from pointer to structure +01b,03jan97,spm added little-endian support and moved macros to dhcp.h +01a,03oct96,spm created by modifying WIDE project DHCP implementation +*/ + +#ifndef __INCdhcpcInith +#define __INCdhcpcInith + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* Functions called at system startup. */ + +IMPORT STATUS dhcpcLibInit (int, int, int, int, int, int, int); +IMPORT STATUS dhcpcLeaseGet (char *, BOOL *); +IMPORT STATUS dhcpcConfigSet (BOOT_PARAMS *, char *, int *, BOOL * pDhcpStatus, + BOOL configFlag); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/dhcp/dhcpcInternal.h b/h/wrn/coreip/dhcp/dhcpcInternal.h new file mode 100644 index 0000000..b4f4907 --- /dev/null +++ b/h/wrn/coreip/dhcp/dhcpcInternal.h @@ -0,0 +1,99 @@ +/* dhcpcInternal.h - DHCP runtime client include file for internal usage */ + +/* Copyright 1984 - 2000 Wind River Systems, Inc. */ + +/* +modification history +--------------------- +01j,04nov03,rlm Ran batch header path update for header re-org. +01i,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01h,23oct03,rlm updated #includes for header re-org +01g,05apr00,spm removed entries shared with boot-time client +01f,24nov99,spm upgraded to RFC 2131 and removed direct link-level access +01e,04dec97,spm added code review modifications +01d,06oct97,spm added relative paths to #include statements +01c,06aug97,spm added definitions for C++ compilation +01b,27jan97,spm added support for little-endian architectures +01a,03oct96,spm created by modifying WIDE project DHCP Implementation +*/ + +#ifndef __INCdhcpcInternalh +#define __INCdhcpcInternalh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include +#include +#include +#include + + +IMPORT struct buffer sbuf; +IMPORT struct ps_udph spudph; +IMPORT struct msg dhcpcMsgIn; +IMPORT struct msg dhcpcMsgOut; +IMPORT unsigned char dhcpCookie [MAGIC_LEN]; + +IMPORT int initialize (int, int, int); +IMPORT int init (EVENT_DATA *); +IMPORT int wait_offer (EVENT_DATA *); +IMPORT int selecting (EVENT_DATA *); +IMPORT int requesting (EVENT_DATA *); +IMPORT int bound (EVENT_DATA *); +IMPORT int renewing (EVENT_DATA *); +IMPORT int rebinding (EVENT_DATA *); +IMPORT int init_reboot (EVENT_DATA *); +IMPORT int verify (EVENT_DATA *); +IMPORT int reboot_verify (EVENT_DATA *); +IMPORT int inform (EVENT_DATA *); + +IMPORT void dhcpcPrivateCleanup (void); + +IMPORT int config_if (struct if_info *, struct in_addr *, + struct in_addr *, struct in_addr *); +IMPORT void set_route (struct dhcp_param *); +IMPORT void down_if (struct if_info *); +IMPORT void reset_if (struct if_info *); + +IMPORT void align_msg (struct msg *, char *); +IMPORT char * pickup_opt (struct dhcp *, int, char); +IMPORT int dhcp_msgtoparam (struct dhcp *, int, struct dhcp_param *); +IMPORT int arp_check (struct in_addr *, struct if_info *); +IMPORT int arp_reply (struct in_addr *, struct if_info *); +IMPORT int merge_param (struct dhcp_param *, struct dhcp_param *); +IMPORT int clean_param (struct dhcp_param *); + +IMPORT int make_discover (LEASE_DATA *, BOOL); +IMPORT int make_request (LEASE_DATA *, int, BOOL); +IMPORT long generate_xid (struct if_info *); +IMPORT int send_unicast (struct in_addr *, struct dhcp *, int); +IMPORT int gen_retransmit (LEASE_DATA *, int); + +IMPORT void set_declinfo (struct dhcp_reqspec *, LEASE_DATA *, char *, int); +IMPORT int dhcp_decline (struct dhcp_reqspec *, struct if_info *); +IMPORT void set_relinfo (struct dhcp_reqspec *, LEASE_DATA *, char *); +IMPORT int dhcp_release (struct dhcp_reqspec *, struct if_info *, BOOL); + +IMPORT int use_parameter (struct dhcp_param *, LEASE_DATA *); +IMPORT void release (LEASE_DATA *, BOOL); + +IMPORT int handle_ip (char *, struct dhcp_param *); +IMPORT int handle_num (char *, struct dhcp_param *); +IMPORT int handle_ips (char *, struct dhcp_param *); +IMPORT int handle_str (char *, struct dhcp_param *); +IMPORT int handle_bool (char *, struct dhcp_param *); +IMPORT int handle_ippairs (char *, struct dhcp_param *); +IMPORT int handle_nums (char *, struct dhcp_param *); +IMPORT int handle_list (char *, struct dhcp_param *); + +IMPORT int (*handle_param[MAXTAGNUM])(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/dhcp/dhcpcShow.h b/h/wrn/coreip/dhcp/dhcpcShow.h new file mode 100644 index 0000000..8e21a66 --- /dev/null +++ b/h/wrn/coreip/dhcp/dhcpcShow.h @@ -0,0 +1,27 @@ +/* dhcpcShow.h - DHCP runtime client include file for show routines */ + +/* Copyright 1984 - 1997 Wind River Systems, Inc. */ + +/* +modification history +____________________ +01a,26oct97,spm written. +*/ + +#ifndef __INCdhcpcShowh +#define __INCdhcpcShowh + +#ifdef __cplusplus +extern "C" { +#endif + +IMPORT void dhcpcShowInit (void); +IMPORT STATUS dhcpcServerShow (void *); +IMPORT STATUS dhcpcTimersShow (void *); +IMPORT STATUS dhcpcParamsShow (void *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/dhcp/dhcpcStateLib.h b/h/wrn/coreip/dhcp/dhcpcStateLib.h new file mode 100644 index 0000000..18d3a3e --- /dev/null +++ b/h/wrn/coreip/dhcp/dhcpcStateLib.h @@ -0,0 +1,55 @@ +/* dhcpcStateLib.h - DHCP runtime client interface to state machine */ + +/* Copyright 1984 - 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,05nov03,cdw Removal of unnecessary _KERNEL guards. +01i,04nov03,rlm Ran batch header path update for header re-org. +01h,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01g,10jun03,vvv include netVersion.h +01f,12apr03,ijm fixed diab compiler warnings +01e,13jun00,spm increased size of function pointer array for new state +01d,24nov99,spm upgraded to RFC 2131 and removed direct link-level access +01c,06oct97,spm added relative paths to #include statements +01b,06aug97,spm added definitions for C++ compilation +01a,03oct96,spm created by modifying WIDE project DHCP implementation +*/ + +#ifndef __INCdhcpcStateLibh +#define __INCdhcpcStateLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* DHCP client states */ + +#define INIT 0 +#define WAIT_OFFER 1 +#define SELECTING 2 +#define REQUESTING 3 +#define BOUND 4 +#define RENEWING 5 +#define REBINDING 6 +#define INIT_REBOOT 7 +#define VERIFY 8 +#define REBOOTING 9 +#define VERIFYING 10 +#define INFORMING 11 +#define MAX_STATES INFORMING + 1 + +IMPORT int (*fsm[MAX_STATES])(); + +IMPORT STATUS dhcp_client_setup (int, int, int); +IMPORT int dhcp_client (void *, BOOL); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/dhcp/dhcps.h b/h/wrn/coreip/dhcp/dhcps.h new file mode 100644 index 0000000..f982395 --- /dev/null +++ b/h/wrn/coreip/dhcp/dhcps.h @@ -0,0 +1,244 @@ +/* dhcps.h - DHCP server primary include file */ + +/* Copyright 1984 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01i,16mar04,ann merged from orion to create the MSP base +01h,05nov03,cdw Removal of unnecessary _KERNEL guards. +01g,04nov03,rlm Ran batch header path update for header re-org. +01f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01e,10jun03,vvv include netVersion.h +01d,22aug02,wap merge from T2.2 +01c,11jul02,wap add free_element() +01b,06aug97,spm added definitions for C++ compilation +01a,07apr97,spm created by modifying WIDE project DHCP implementation +*/ + +/* + * WIDE Project DHCP Implementation + * Copyright (c) 1995 Akihiro Tominaga + * Copyright (c) 1995 WIDE Project + * All rights reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided only with the following + * conditions are satisfied: + * + * 1. Both the copyright notice and this permission notice appear in + * all copies of the software, derivative works or modified versions, + * and any portions thereof, and that both notices appear in + * supporting documentation. + * 2. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by WIDE Project and + * its contributors. + * 3. Neither the name of WIDE Project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND WIDE + * PROJECT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES + * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ALSO, THERE + * IS NO WARRANTY IMPLIED OR OTHERWISE, NOR IS SUPPORT PROVIDED. + * + * Feedback of the results generated from any improvements or + * extensions made to this software would be much appreciated. + * Any such feedback should be sent to: + * + * Akihiro Tominaga + * WIDE Project + * Keio University, Endo 5322, Kanagawa, Japan + * (E-mail: dhcp-dist@wide.ad.jp) + * + * WIDE project has the rights to redistribute these changes. + */ + +#ifndef __INCdhcpsh +#define __INCdhcpsh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define GC_INTERVAL 600 /* interval between garbage collections */ + +/* + * function prototype definition + */ +static void garbage_collect (void); +static void get_cid (struct dhcp *, int, struct client_id *); +static void clean_sbuf (void); +static void construct_msg (u_char, struct dhcp_resource *, + u_long, struct if_info *); +static void turnoff_bind (struct dhcp_binding *); +static int nvttostr (char *, char *, int); +static int get_maxoptlen (struct dhcp *, int); +static int get_subnet (struct dhcp *, int, struct in_addr *, struct if_info *); +static int available_res (struct dhcp_resource *, struct client_id *, time_t); +static int choose_lease (int, time_t, struct dhcp_resource *); +static int update_db (int, struct client_id *, struct dhcp_resource *, + u_long, time_t); +static int cidcmp (struct client_id *, struct client_id *); +static int icmp_check (int, struct in_addr *); +static int insert_it (char *); +int free_bind (struct hash_member *); +static int free_fake (struct hash_member *); +int free_element (struct hash_member *); +static int send_dhcp (struct if_info *, int); +static int insert_opt (struct dhcp_resource *, u_long, int, char *, char); +#define PASSIVE 0 +#define ACTIVE 1 +static u_long get_reqlease (struct dhcp *, int); +static struct dhcp_resource *select_wciaddr (struct client_id *, time_t, int *); +static struct dhcp_resource *select_wcid (int, struct client_id *, time_t); +static struct dhcp_resource *select_wreqip (int, struct client_id *, time_t); +static struct dhcp_resource *select_newone (int, struct client_id *, time_t, + u_long); +static struct dhcp_resource *choose_res (struct client_id *, time_t, u_long); + +#ifndef VIRTUAL_STACK +extern struct hash_member *reslist; +extern struct hash_member *bindlist; +extern struct hash_tbl cidhashtable; +extern struct hash_tbl iphashtable; +extern struct hash_tbl relayhashtable; +extern struct hash_tbl paramhashtable; +#endif /* VIRTUAL_STACK */ + +extern int bindcidcmp(); +extern int paramcidcmp(); +extern int resipcmp(); +extern int relayipcmp(); +extern int open_if(); + +static int discover(); +static int request(); +static int decline(); +static int release(); + +#ifndef NOBOOTP +static void construct_bootp(); +static int available_forbootp(); +static int send_bootp(); +static struct dhcp_resource *choose_forbootp(); +static int bootp(); +#endif /* NOBOOTP */ + +static int (*process_msg[])() = { +#ifdef NOBOOTP + NULL, +#else + bootp, +#endif + discover, + NULL, + request, + decline, + NULL, + NULL, + release +}; + +static int ins_ip (struct dhcp_resource *, u_long, int, char *, char); +static int ins_ips (struct dhcp_resource *, u_long, int, char *, char); +static int ins_ippairs (struct dhcp_resource *, u_long, int, char *, char); +static int ins_long (struct dhcp_resource *, u_long, int, char *, char); +static int ins_short (struct dhcp_resource *, u_long, int, char *, char); +static int ins_octet (struct dhcp_resource *, u_long, int, char *, char); +static int ins_str (struct dhcp_resource *, u_long, int, char *, char); +static int ins_mtpt (struct dhcp_resource *, u_long, int, char *, char); +static int ins_dht (struct dhcp_resource *, u_long, int, char *, char); +static int ins_vend (struct dhcp_resource *, u_long, int, char *, char); + +static int (*ins_opt []) (struct dhcp_resource *, u_long, int, char *, char) = + { + NULL, /* PAD == 0 */ + ins_ip, /* SUBNET_MASK */ + ins_long, /* TIME_OFFSET */ + ins_ips, /* ROUTER */ + ins_ips, /* TIME_SERVER */ + ins_ips, /* NAME_SERVER */ + ins_ips, /* DNS_SERVER */ + ins_ips, /* LOG_SERVER */ + ins_ips, /* COOKIE_SERVER */ + ins_ips, /* LPR_SERVER */ + ins_ips, /* IMPRESS_SERVER */ + ins_ips, /* RLS_SERVER */ + ins_str, /* HOSTNAME */ + ins_short, /* BOOTSIZE */ + ins_str, /* MERIT_DUMP */ + ins_str, /* DNS_DOMAIN */ + ins_ip, /* SWAP_SERVER */ + ins_str, /* ROOT_PATH */ + ins_str, /* EXTENSIONS_PATH */ + ins_octet, /* IP_FORWARD */ + ins_octet, /* NONLOCAL_SRCROUTE */ + ins_ippairs, /* POLICY_FILTER */ + ins_short, /* MAX_DGRAM_SIZE */ + ins_octet, /* DEFAULT_IP_TTL */ + ins_long, /* MTU_AGING_TIMEOUT */ + ins_mtpt, /* MTU_PLATEAU_TABLE */ + ins_short, /* IF_MTU */ + ins_octet, /* ALL_SUBNET_LOCAL */ + ins_ip, /* BRDCAST_ADDR */ + ins_octet, /* MASK_DISCOVER */ + ins_octet, /* MASK_SUPPLIER */ + ins_octet, /* ROUTER_DISCOVER */ + ins_ip, /* ROUTER_SOLICIT */ + ins_ippairs, /* STATIC_ROUTE */ + ins_octet, /* TRAILER */ + ins_long, /* ARP_CACHE_TIMEOUT */ + ins_octet, /* ETHER_ENCAP */ + ins_octet, /* DEFAULT_TCP_TTL */ + ins_long, /* KEEPALIVE_INTER */ + ins_octet, /* KEEPALIVE_GARBA */ + ins_str, /* NIS_DOMAIN */ + ins_ips, /* NIS_SERVER */ + ins_ips, /* NTP_SERVER */ + ins_vend, /* VENDOR_SPEC */ + ins_ips, /* NBN_SERVER */ + ins_ips, /* NBDD_SERVER */ + ins_octet, /* NB_NODETYPE */ + ins_str, /* NB_SCOPE */ + ins_ips, /* XFONT_SERVER */ + ins_ips, /* XDISPLAY_MANAGER */ + NULL, /* REQUEST_IPADDR */ + NULL, /* LEASE_TIME */ + NULL, /* OPT_OVERLOAD */ + NULL, /* DHCP_MSGTYPE */ + NULL, /* SERVER_ID */ + NULL, /* REQ_LIST */ + NULL, /* DHCP_ERRMSG */ + NULL, /* DHCP_MAXMSGSIZE */ + ins_dht, /* DHCP_T1 */ + ins_dht, /* DHCP_T2 */ + NULL, /* CLASS_ID */ + NULL, /* CLIENT_ID */ + NULL, + NULL, + ins_str, /* NISP_DOMAIN */ + ins_ips, /* NISP_SERVER */ + NULL, /* TFTP_SERVERNAME */ + NULL, /* BOOTFILE */ + ins_ips, /* MOBILEIP_HA */ + ins_ips, /* SMTP_SERVER */ + ins_ips, /* POP3_SERVER */ + ins_ips, /* NNTP_SERVER */ + ins_ips, /* DFLT_WWW_SERVER */ + ins_ips, /* DFLT_FINGER_SERVER */ + ins_ips, /* DFLT_IRC_SERVER */ + ins_ips, /* STREETTALK_SERVER */ + ins_ips /* STDA_SERVER */ +}; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/dhcp/hash.h b/h/wrn/coreip/dhcp/hash.h new file mode 100644 index 0000000..88ecff2 --- /dev/null +++ b/h/wrn/coreip/dhcp/hash.h @@ -0,0 +1,86 @@ +/* hash.h - DHCP server include file for hash table functions */ + +/* Copyright 1984 - 1997 Wind River Systems, Inc. */ + +/* +modification history +____________________ +01b,06aug97,spm added definitions for C++ compilation +01a,07apr97,spm created by modifying WIDE project DHCP implementation +*/ + +/* + * Modified by Akihiro Tominaga. (tomy@sfc.wide.ad.jp) + */ +/* + * Generalized hash table ADT + * + * Provides multiple, dynamically-allocated, variable-sized hash tables on + * various data and keys. + * + * This package attempts to follow some of the coding conventions suggested + * by Bob Sidebotham and the AFS Clean Code Committee. + * + * + * + * Copyright 1988 by Carnegie Mellon. + * + * Permission to use, copy, modify, and distribute this program for any + * purpose and without fee is hereby granted, provided that this copyright + * and permission notice appear on all copies and supporting documentation, + * the name of Carnegie Mellon not be used in advertising or publicity + * pertaining to distribution of the program without specific prior + * permission, and notice be given in supporting documentation that copying + * and distribution is by permission of Carnegie Mellon and Stanford + * University. Carnegie Mellon makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ +#ifndef __INChashh +#define __INChashh + +#ifdef __cplusplus +extern "C" { +#endif + +#define HASHTBL_SIZE 127 /* this is a prime number */ + +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif +#ifndef NULL +#define NULL 0 +#endif + +/* + * Define "hash_datum" as a universal data type + */ +#ifdef __STDC__ +typedef void hash_datum; +#else +typedef char hash_datum; +#endif + +struct hash_member { + struct hash_member *next; + hash_datum *data; +}; + +struct hash_tbl { + struct hash_member *head[HASHTBL_SIZE]; +}; + +extern int hash_exst(); +extern int hash_ins(); +extern int hash_del(); +extern hash_datum *hash_pickup(); +extern hash_datum *hash_find(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/dhcp6Lib.h b/h/wrn/coreip/dhcp6Lib.h new file mode 100644 index 0000000..6d392e3 --- /dev/null +++ b/h/wrn/coreip/dhcp6Lib.h @@ -0,0 +1,99 @@ +/* dhcp6Lib.h - header file for DHCPv6 related definitions */ + +/* + * Copyright (c) 2004-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01d,09jul05,ijm Added authentication options and api prototypes +01c,10aug04,syy Code review changes +01b,01jul04,syy Add prevention of multiple inclusion +01a,24jun04,syy Written +*/ + +#ifndef __INCdhcp6Libh +#define __INCdhcp6Libh + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +struct dhcp6sInitParams { + u_int ramDiskSize; + u_int downStreamPort; + u_int upStreamPort; + u_int priority; + u_int dhcp6sSize; + }; + +struct dhcp6cInitParams { + char *uplinkIfName; + char *downlinkIfName; + u_int downStreamPort; + u_int upStreamPort; + u_int priority; + u_int dhcp6cSize; + char *dhcp6cKeyRealm; /* e.g., domain name such as "example.com" */ + char *dhcp6cKeySecret; /* base 64 encoded secret */ + char *dhcp6cKeyExpire; /* e.g., "forever", "600", "200" (seconds) */ + }; + +struct dhcp6rInitParams { + char *srcAddr; + char *servAddr; + char *uIfName; + u_int hopLimit; + u_int downStreamPort; + u_int upStreamPort; + u_int priority; + u_int dhcp6rSize; + }; + +typedef enum {DNS_LIST=0, SIP_LIST, NTP_LIST, DNS_NAME_LIST, + SIP_NAME_LIST, PREFIX_LIST} dh6InfoType_t; + +/* function prototypes */ + +/* DHCPv6 client */ + +extern STATUS dhcp6c __P((char *ifname, int option, int debug_level)); +extern STATUS dhcp6cStop __P((void)); +extern STATUS dhcp6cAuthInfoSet (char * dhcp6cKeyRealm, + char * dhcp6cKeySecret, + char * dhcp6cKeyExpire); +extern void dhcp6cLibInit (char *uplinkName, char *downlinkName, u_int dPort, + u_int uPort, u_int priority, u_int taskSize, + char * dhcp6cKeyRealm, char *dhcp6cKeySecret, + char * dhcp6cKeyExpire); + +/* DHCPv6 server */ + +extern STATUS dhcp6s __P((char *confFileName, /* configuration file name */ + char *ifName, /* interface to monitor */ + u_int debugLevel /* verbosity */ + )); +extern STATUS dhcp6sStop __P((void)); +extern STATUS dhcp6sLibInit (u_int ramDiskSize, u_int dPort, u_int uPort, + u_int priority, u_int taskSize); + +/* DHCPv6 relay */ + +extern STATUS dhcp6relay __P((char *ifName, u_int debugLevel)); +extern STATUS dhcp6rStop __P((void)); +extern STATUS dhcp6rLibInit (char *srcAddr, char *servAddr, char *uIfName, + u_int hopLimit, u_int dPort, u_int uPort, + u_int priority, u_int taskSize); + +extern int dh6cInfoGet (dh6InfoType_t, char **, int, int); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* ! __INCdhcp6Libh */ diff --git a/h/wrn/coreip/dhcp6cShow.h b/h/wrn/coreip/dhcp6cShow.h new file mode 100644 index 0000000..60c7673 --- /dev/null +++ b/h/wrn/coreip/dhcp6cShow.h @@ -0,0 +1,25 @@ +/* dhcp6cShow.h - header file for DHCPv6 client show routines */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +____________________ +01a,08sep04,syy written. +*/ + +#ifndef __INCdhcp6cShowh +#define __INCdhcp6cShowh + +#ifdef __cplusplus +extern "C" { +#endif + +IMPORT void dh6cShowInit (void); +IMPORT STATUS dh6cInfoShow (void); + +#ifdef __cplusplus +} +#endif + +#endif /* !__INCdhcp6cShowh */ diff --git a/h/wrn/coreip/dhcpcBootLib.h b/h/wrn/coreip/dhcpcBootLib.h new file mode 100644 index 0000000..46cbc28 --- /dev/null +++ b/h/wrn/coreip/dhcpcBootLib.h @@ -0,0 +1,45 @@ +/* dhcpcBootLib.h - DHCP client include file for boot-time interface */ + +/* Copyright 1997-2002 Wind River Systems, Inc. */ + +/* +modification history +--------------------- +01j,20nov03,niq Remove copyright_wrs.h file inclusion +01i,04nov03,rlm Ran batch header path update for header re-org. +01h,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01g,23oct03,rlm updated #includes for header re-org +01f,13jun00,spm changed interface to support adding options to messages; + added prototype to prevent compiler warnings +01e,05apr00,spm upgraded to RFC 2131 and combined with run-time client +01d,04dec97,spm added code review modifications +01c,19aug97,spm major overhaul: preserved single-lease interface by + merging include files - 01f of dhcpClientCommon.h, + 01d of dhcp.h, 01c of dhcpCommonSubr.h, 01e of dhcpc.h +01b,06aug97,spm added conditional include and definitions for C++ compilation +01a,07apr97,spm created. +*/ + +#ifndef __INCdhcpcBootLibh +#define __INCdhcpcBootLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + + +/* DHCP boot-time high-level interface functions */ + +IMPORT void * dhcpcBootInit (struct ifnet *, int, int, int, int, int, int); +IMPORT STATUS dhcpcBootBind (void); +IMPORT STATUS dhcpcBootInformGet (char *); +IMPORT STATUS dhcpcBootParamsGet (struct dhcp_param *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/dhcpcLib.h b/h/wrn/coreip/dhcpcLib.h new file mode 100644 index 0000000..a6ae3aa --- /dev/null +++ b/h/wrn/coreip/dhcpcLib.h @@ -0,0 +1,63 @@ +/* dhcpcLib.h - DHCP include file for user interface of runtime client */ + +/* Copyright 1996-2002 Wind River Systems, Inc. */ + +/* +modification history +--------------------- +01l,20nov03,niq Remove copyright_wrs.h file inclusion +01k,04nov03,rlm Ran batch header path update for header re-org. +01j,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01i,23oct03,rlm updated #includes for header re-org +01h,05apr00,spm removed entries shared with boot-time client +01g,24nov99,spm upgraded to RFC 2131 and removed direct link-level access +01f,06oct97,spm added prototypes for user-callable routines +01e,06aug97,spm added definitions for C++ compilation +01d,30apr97,spm changed dhcpcOptionGet() prototype to return length +01c,07apr97,spm added prototypes for new functions +01b,29jan97,spm added support for little-endian architectures +01a,03oct96,spm created. +*/ + +#ifndef __INCdhcpcLibh +#define __INCdhcpcLibh + +#ifdef __cplusplus +extern "C" { +#endif + + + +#include +#include +#include +#include + +IMPORT void * pDhcpcBootCookie; /* User access to boot-time lease. */ + +/* DHCP data structures for option requests and retrieval. */ + +/* DHCP (runtime) client user interface routines */ + +IMPORT STATUS dhcpcLibInit (int, int, int, int, int, int, int); +IMPORT void * dhcpcInit (struct ifnet *, BOOL); +IMPORT STATUS dhcpcEventHookAdd (void *, FUNCPTR); +IMPORT STATUS dhcpcEventHookDelete (void *); +IMPORT STATUS dhcpcCacheHookAdd (FUNCPTR); +IMPORT STATUS dhcpcCacheHookDelete (void); +IMPORT STATUS dhcpcOptionSet (void *, int); +IMPORT STATUS dhcpcOptionAdd (void *, UCHAR, int, UCHAR *); +IMPORT STATUS dhcpcBind (void *, BOOL); +IMPORT STATUS dhcpcVerify (void *); +IMPORT STATUS dhcpcOptionGet (void *, int, int *, char *); +IMPORT STATUS dhcpcServerGet (void *, struct in_addr *); +IMPORT STATUS dhcpcTimerGet (void *, int *, int *); +IMPORT STATUS dhcpcParamsGet (void *, struct dhcp_param *); +IMPORT STATUS dhcpcRelease (void *); +IMPORT STATUS dhcpcShutdown (void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/dhcprLib.h b/h/wrn/coreip/dhcprLib.h new file mode 100644 index 0000000..b69e2b7 --- /dev/null +++ b/h/wrn/coreip/dhcprLib.h @@ -0,0 +1,91 @@ +/* dhcprLib.h - DHCP relay agent include file for user interface */ + +/* Copyright 1996-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01l,22jul05,ijm dhcprLib cannot be compiled on its own, SPR#109629 +01k,20nov03,niq Remove copyright_wrs.h file inclusion +01j,05nov03,cdw Removal of unnecessary _KERNEL guards. +01i,04nov03,rlm Ran batch header path update for header re-org. +01h,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01g,15sep03,vvv updated path for new headers +01f,06aug03,nee Accordion Base6 merge from ACCORDION_BASE6_MERGE_BASELINE + label +01e,10jun03,vvv include netVersion.h +01d,04dec97,spm added code review modifications +01c,06aug97,spm added definitions for C++ compilation +01b,28apr97,spm moved DHCP_MAX_HOPS to configAll.h +01a,07apr97,spm created. +*/ + +#ifndef __INCdhcprLibh +#define __INCdhcprLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#if CPU_FAMILY==I960 +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct serverDesc + { + char *pAddress; /* IP address of DHCP server target */ + } DHCP_TARGET_DESC; + +typedef struct server + { + struct in_addr ip; + struct server *next; + } DHCP_SERVER_DESC; + +typedef struct ifrDesc + { + char ifName[MAX_FILENAME_LENGTH]; /* name of interface to use */ + } DHCPR_IF_DESC; + +IMPORT DHCP_TARGET_DESC * pDhcpRelayTargetTbl; +IMPORT int dhcpNumTargets; +IMPORT DHCP_SERVER_DESC * pDhcpTargetList; +IMPORT struct msg dhcpMsgIn; + +#if CPU_FAMILY==I960 +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#include +#ifdef VIRTUAL_STACK +#include +#endif /* VIRTUAL_STACK */ + +typedef struct dhcpr_config_params + { + CFG_DATA_HDR cfgh; + DHCP_TARGET_DESC *cfg_dhcpTargetTbl; + int cfg_dhcpTargetTblSize; + DHCPR_IF_DESC *cfg_dhcprIfTbl; /* ptr to device table */ + int cfg_numDev; /* # of devices in table */ + int cfg_dhcpCPort; + int cfg_dhcpSPort; + int cfg_dhcpMaxHops; + int cfg_dhcpsMaxMsgSize; + } DHCPR_CONFIG_PARAMS; + +IMPORT int open_if(); +IMPORT void read_server_db (int); +#ifdef VIRTUAL_STACK +IMPORT STATUS dhcprDestructor (VSNUM vsnum); +#endif /* VIRTUAL_STACK */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/dhcpsLib.h b/h/wrn/coreip/dhcpsLib.h new file mode 100644 index 0000000..54f5e90 --- /dev/null +++ b/h/wrn/coreip/dhcpsLib.h @@ -0,0 +1,198 @@ +/* dhcpsLib.h - DHCP server include file for user interface */ + +/* Copyright 1984 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01s,15mar04,rp merged from orion +01r,20nov03,niq Remove copyright_wrs.h file inclusion +01q,05nov03,cdw Removal of unnecessary _KERNEL guards. +01p,04nov03,rlm Ran batch header path update for header re-org. +01o,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01n,16sep03,vvv backed out merge changes made in ver 01l (will be merged as + part of apps merge) +01m,15sep03,vvv updated path for new headers +01l,06aug03,nee Accordion Base6 merge from ACCORDION_BASE6_MERGE_BASELINE + label +01k,10jun03,vvv include netVersion.h +01j,22aug02,wap merge from T2.2 +01i,11jul02,wap add DHCPS_STORAGE_REMOVE +01h,10oct01,rae merge from truestack (virtual stack support) +01g,25jun01,ppp fixed the problem involving the dhcp server and client to be + built together (SPR #64194) +01f,14jul00,spm upgraded to RFC 2131 and removed direct link-level access +01e,04dec97,spm added code review modifications +01d,06oct97,spm moved default parameters from usrNetwork.c; added prototypes + for user-callable routines +01c,06aug97,spm added definitions for C++ compilation +01b,18apr97,spm added dhcpsInit() prototype to eliminate compiler warnings +01a,07apr97,spm created. +*/ + +#ifndef __INCdhcpsLibh +#define __INCdhcpsLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define S_dhcpsLib_NOT_INITIALIZED (M_dhcpsLib | 1) + +#include + +#define PROTO_ICMP 1 /* Normally found in /etc/protocols */ + +#if CPU_FAMILY==I960 +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct leaseDesc + { + /* + * This structure defines the components of an address pool entry. + * The DHCP server issues leases for individual IP addresses from + * the address pool. + */ + + char *pName; /* base name of pool entry */ + char *pStartIp; /* first IP address in range */ + char *pEndIp; /* last IP address in range */ + char *pParams; /* other lease parameters */ + } DHCPS_LEASE_DESC; + +typedef struct entryDesc + { + /* + * This structure defines the components of a single lease entry + * from the address pool which will be offered to DHCP clients. + */ + + char *pName; /* unique name of lease entry */ + char *pAddress; /* single IP address within range */ + char *pParams; /* associated lease parameters */ + } DHCPS_ENTRY_DESC; + +typedef struct ifDesc + { + char ifName[MAX_FILENAME_LENGTH]; /* name of interface to use */ + } DHCPS_IF_DESC; + +typedef struct relayDesc + { + /* + * This structure contains information for a relay agent used to + * communicate with DHCP clients or servers on other networks. + */ + + char *pAddress; /* IP address of relay agent */ + char *pMask; /* Subnet mask of supported network */ + } DHCPS_RELAY_DESC; + +#include /* Relay agent capability. */ +#include + +#if CPU_FAMILY==I960 +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +IMPORT DHCPS_LEASE_DESC * pDhcpsLeasePool; +IMPORT DHCPS_RELAY_DESC * pDhcpsRelaySourceTbl; + +typedef struct dhcpsConfigDesc + { + CFG_DATA_HDR cfgh; + int dhcpMaxHops; /* max hops */ + int dhcpSPort; /* server port */ + int dhcpCPort; /* client port */ + int dhcpMaxMsgSize; /* max msg size */ + long dhcpsDfltLease; /* Default for default lease length */ + long dhcpsMaxLease; /* Default maximum lease length */ + FUNCPTR pDhcpsLeaseFunc; /* ptr to lease function */ + FUNCPTR pDhcpsAddrFunc; /* ptr to address function */ + DHCPS_IF_DESC *pDhcpsIfTbl; /* ptr to device table */ + int numDev; /* # of devices in table */ + DHCPS_LEASE_DESC *pDhcpsLeaseTbl; /* lease tbl */ + int dhcpsLeaseTblSize; /* size of lease table */ + DHCP_TARGET_DESC *pDhcpsTargetTbl; /* target table */ + int dhcpTargetTblSize; /* size of target table */ + DHCPS_RELAY_DESC *pDhcpsRelayTbl; /* relay table */ + int dhcpsRelayTblSize; /* size of relay table */ + } DHCPS_CFG_PARAMS; + +/* User-callable routines */ + +IMPORT STATUS dhcpsInit (DHCPS_CFG_PARAMS *); +IMPORT STATUS dhcpsLeaseEntryAdd (char *, char *, char *, char *); +IMPORT STATUS dhcpsLeaseEntryDelete (char *); +IMPORT STATUS dhcpsLeaseEntryGet (char *, char *, char *, char *); +IMPORT STATUS dhcpsLeaseHookAdd (FUNCPTR); +IMPORT STATUS dhcpsAddressHookAdd (FUNCPTR); +IMPORT STATUS dhcpsVsInit (); + +#ifdef VIRTUAL_STACK +IMPORT STATUS dhcpsDestructor (VSNUM vsnum); +#endif /* VIRTUAL_STACK */ + +/* Critical section semaphore. */ + +IMPORT SEM_ID dhcpsMutexSem; + +/* Operations on database cache. */ + +#define DHCPS_STORAGE_START 0 +#define DHCPS_STORAGE_STOP 1 +#define DHCPS_STORAGE_WRITE 2 +#define DHCPS_STORAGE_READ 3 +#define DHCPS_STORAGE_CLEAR 4 +#define DHCPS_STORAGE_REMOVE 5 + +/* + * The following string contains host requirements defaults needed for + * RFC compliance - DO NOT REMOVE OR MODIFY!! + */ + +#define DHCPS_DEFAULT_ENTRY "ipfd=false:nlsr=false:mdgs=576:ditl=64:ifmt=576:\ +asnl=false:brda=255.255.255.255:mskd=false:msks=false:rtrd=true:\ +rtsl=255.255.255.255:trlr=false:arpt=60:encp=false:dttl=64:kain=7200:kagb=false" + +#define MAX_DHCPFILTERS 23 /* Number of filters as defined below */ + +#define DHCPS_FILTER_DEFINE { \ +BPF_STMT(BPF_LD+BPF_TYPE,0), /* Save lltype in accumulator */ \ +BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, ETHERTYPE_IP, 0, 20), /* IP packet? */ \ +/* \ + * The remaining statements use the (new) BPF_HLEN alias to avoid any \ + * link-layer dependencies. The expected length values are assigned to the \ + * correct values during startup. The expected destination port is also \ + * altered to match the actual value chosen. \ + */ \ +BPF_STMT(BPF_LD+BPF_H+BPF_ABS+BPF_HLEN, 6), /* A <- IP FRAGMENT field */ \ +BPF_JUMP(BPF_JMP+BPF_JSET+BPF_K, 0x1fff, 18, 0), /* OFFSET == 0 ? */ \ +BPF_STMT(BPF_LDX+BPF_HLEN, 0), /* X <- frame data offset */ \ +BPF_STMT(BPF_LD+BPF_H+BPF_IND, 2), /* A <- IP_LEN field */ \ +BPF_JUMP(BPF_JMP+BPF_JGE+BPF_K, 0, 0, 15), /* IP/UDP headers + DHCP? */ \ +BPF_STMT(BPF_LD+BPF_B+BPF_IND, 9), /* A <- IP_PROTO field */ \ +BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, IPPROTO_UDP, 0, 13), /* UDP ? */ \ +BPF_STMT(BPF_LD+BPF_HLEN, 0), /* A <- frame data offset */ \ +BPF_STMT(BPF_LDX+BPF_B+BPF_MSH+BPF_HLEN, 0), /* X <- IPHDR LEN field */ \ +BPF_STMT(BPF_ALU+BPF_ADD+BPF_X, 0), /* A <- start of UDP datagram */ \ +BPF_STMT(BPF_MISC+BPF_TAX, 0), /* X <- start of UDP datagram */ \ +BPF_STMT(BPF_LD+BPF_H+BPF_IND, 2), /* A <- UDP DSTPORT */ \ +BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 67, 0, 7), /* check DSTPORT */ \ +BPF_STMT(BPF_LD+BPF_H+BPF_IND, 4), /* A <- UDP LENGTH */ \ +BPF_JUMP(BPF_JMP+BPF_JGE+BPF_K, 0, 0, 5), /* UDP header + DHCP? */ \ +BPF_STMT(BPF_LD+BPF_B+BPF_IND, 11), /* A <- DHCP hops field */ \ +BPF_JUMP(BPF_JMP+BPF_JGT+BPF_K, -1, 3, 0), /* -1 replaced with max hops */ \ +BPF_STMT(BPF_LD+BPF_W+BPF_IND, 244), /* A <- DHCP options */ \ +BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 0x63825363, 0, 1), \ +BPF_STMT(BPF_RET+BPF_K+BPF_HLEN, DFLTDHCPLEN + UDPHL + IPHL), \ +BPF_STMT(BPF_RET+BPF_K, 0) /* unrecognized message: ignore frame */ } + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/dlink/gifNpt.h b/h/wrn/coreip/dlink/gifNpt.h new file mode 100644 index 0000000..bf831bb --- /dev/null +++ b/h/wrn/coreip/dlink/gifNpt.h @@ -0,0 +1,27 @@ +/* gifNpt.h - RFC2893 Configured Tunnels pseudo interface header */ + +/* Copyright 2003 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01a,20mar03,kal written +*/ + +#ifndef __INCgifNpth +#define __INCgifNpth + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) || defined(__cplusplus) +IMPORT END_OBJ * gifLoad (char * initString, void * pBsp); +#else +IMPORT END_OBJ * gifLoad (); +#endif /* defined(__STDC__) || defined(__cplusplus) */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCgifNpth */ diff --git a/h/wrn/coreip/dlink/qosIngressLib.h b/h/wrn/coreip/dlink/qosIngressLib.h new file mode 100644 index 0000000..6c2f147 --- /dev/null +++ b/h/wrn/coreip/dlink/qosIngressLib.h @@ -0,0 +1,58 @@ +/* qosIngressLib.h - definitions for qos support on ingress */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +01a,09aug05 niq created. +*/ + +#ifndef __INCqosIngressLibh +#define __INCqosIngressLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines for the return value of the packet classification hook */ + +typedef enum +{ + QOS_DELIVER_PKT, + QOS_DEFER_PKT, + QOS_IGNORE_PKT +} QOS_HOOK_RETVAL; + +/* definition for the packet classification hook */ +typedef QOS_HOOK_RETVAL (*QOS_ING_HOOK) (END_OBJ *, M_BLK_ID *, int *); + + +/* Configuration structure */ + +typedef struct _qosConfig +{ + JOB_QUEUE_ID cfg_pJobQueue; /* Job queue to use */ + int cfg_jobQPri; /* Priority for the process job */ + int cfg_qosDefaultPri; /* Default pri for queuing packets */ +} QOS_CONFIG_PARAMS; + +/* External APIs */ + +IMPORT STATUS qosIngressLibInit (void * cfgParams); +IMPORT STATUS qosIngressHookSet (int unit, char * ifname, QOS_ING_HOOK hookRtn); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCqosIngressLibh */ + diff --git a/h/wrn/coreip/dlink/stfNpt.h b/h/wrn/coreip/dlink/stfNpt.h new file mode 100644 index 0000000..e7344cb --- /dev/null +++ b/h/wrn/coreip/dlink/stfNpt.h @@ -0,0 +1,27 @@ +/* stfNpt.h - 6to4 Pseudo-NPT Driver header */ + +/* Copyright 2003 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01a,20mar03,kal written +*/ + +#ifndef __INCstfNpth +#define __INCstfNpth + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) || defined(__cplusplus) +IMPORT END_OBJ * stfLoad (char * initString, void * pBsp); +#else +IMPORT END_OBJ * stfLoad (); +#endif /* defined(__STDC__) || defined(__cplusplus) */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCstfNpth */ diff --git a/h/wrn/coreip/dlink/tunnelLib.h b/h/wrn/coreip/dlink/tunnelLib.h new file mode 100644 index 0000000..df3d0b1 --- /dev/null +++ b/h/wrn/coreip/dlink/tunnelLib.h @@ -0,0 +1,217 @@ +/* tunnelLib.h - Tunneling Support Library */ + +/* Copyright 2002 - 2003 Wind River Systems, Inc. */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* +modification history +-------------------- +01k,14jul05,nee Support for MIPv6 +01j,20nov03,niq Remove copyright_wrs.h file inclusion +01i,20mar03,kal Code review modifications +01h,30oct02,kal Added Perform PMTUD option and TUNNEL_CONFIG_PARAMS +01g,04sep02,kal Fixed tunnelInstInit and tunnelInstDestroy prototypes +01f,15aug02,syy Merge from version 13 of Accordion Munich branch +01e,11jul02,spm fixed modification history after automatic merge +01d,11jul02,wrs automatic merge from version 7 of Accordion Munich branch: + (xxjul02,kal cleanup from design review) +01c,08jul02,spm fixed modification history after automatic merge +01b,29jun02,wrs automatic merge from version 4 of Accordion Munich branch: + added tunnel6in4_ctlinput routine +01a,24jun02,spm automatic merge from version 1 of Accordion Munich branch: + (01a,xxxxxxx,kal written) +*/ + +#ifndef __INCtunnelLibh +#define __INCtunnelLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Must include avlLib.h */ +#include + +/* + * The following two structures (TUN_PROTO, TUNNEL_CONFIG_PARAMS) are + * passed to tunnelInstInit to configure tunnelLib. For virtual stack + * environments it is possible to use different configuration + * structures to achieve different tunneling configurations on a per + * stack instance basis. + */ + +typedef struct tunproto { + short pr_protocol; + FUNCPTR pr_input; + FUNCPTR pr_ctlinput; + } TUN_PROTO; + +typedef struct tunnelcfgparams { + CFG_DATA_HDR cfgh; + int mtuRefreshDelay; /* Timeout (secs) for PMTU Refresh */ + int numXin4Protos; /* Number of protos in Xin4ProtoArr */ + int numXin6Protos; /* Number of protos in Xin6ProtoArr */ + TUN_PROTO * Xin4ProtoArr; /* Up to numXin4Protos size */ + TUN_PROTO * Xin6ProtoArr; /* Up to numXin6Protos size */ + } TUNNEL_CONFIG_PARAMS; + +/* + * Header length for prepended next hop IP + * First byte contains TUNNEL_IPV4_GATE or TUNNEL_IPV6_GATE if the following + * bytes contain a gateway address. Tunnel interfaces can use this to + * determine if a gateway address is present. + * Last 16 bytes contain an IPv4 or IPv6 address, starting at the first + * byte of this block. + */ + +#define TUNNEL_HDR_LEN 17 + +#define TUNNEL_IPV4_GATE 0x1 +#define TUNNEL_IPV6_GATE 0x2 + +/* + * Default MTU value for automatic tunnels, and for use by configured + * tunnels until properly set up by tunnelAddrSet()/tunnelIfConfig(). + */ + +#define TUNNEL_DEFAULT_MTU 1280 + +/* Structure for linked list of tunnel interfaces */ + +typedef struct tunnelListElement + { + NODE node; /* lstLib element */ + char * ifname; /* Tunnel Interface name (e.g. "gif0") */ + int af; /* Address family (e.g. AF_INET = Xin4) */ + int proto; /* Protocol field (e.g. IPPROTO_IPv4 = 4inX */ + int overhead; /* Number of bytes prepended by tunnel IF */ + FUNCPTR rcvFunc; /* Function to call if a match is found */ + void * pDrvCtrl; /* Tunnel's END_OBJ/DRV_CTRL structure */ + BOOL configTunnel; /* Is this a configured tunnel ? */ + BOOL performPmtud; /* Perform Tunnel Path MTU Discovery */ + void * ifMtuTimo; /* GTF timer pointer for path MTU refresh */ + void * pLookup; /* lookupListElement ptr to node in AVL tree */ + } TUNNEL_LIST_ELEMENT; + + +/* Structure for AVL tree nodes */ + +struct lookupListElement + { + AVL_NODE lookupNode; /* Used by avlLib */ + struct sockaddr * srcAddr; /* IPv4 or IPv6 source address */ + struct sockaddr * dstAddr; /* IPv4 or IPv6 dest address */ + void * tunnelIf; /* TUNNEL_LIST_ELEMENT pointer */ + }; + + +/* + * Macro for getting the source and destination addresses + * + * TUNNEL_ADDR_EXIST() checks if address are registered + * TUNNEL_xxx_GET() return a pointer to the src/dst sockaddr structures + */ + +#define TUNNEL_ADDR_EXIST(tunnelListPtr) \ + ((TUNNEL_LIST_ELEMENT *)(tunnelListPtr))->pLookup + +#define TUNNEL_SRC_GET(tunnelListPtr) \ + ((struct lookupListElement *)(((TUNNEL_LIST_ELEMENT *)(tunnelListPtr))->pLookup))->srcAddr + +#define TUNNEL_DST_GET(tunnelListPtr) \ + ((struct lookupListElement *)(((TUNNEL_LIST_ELEMENT *)(tunnelListPtr))->pLookup))->dstAddr + +#define TUNNEL_PMTUD_IS_ON(tunnelListPtr) \ + ((TUNNEL_LIST_ELEMENT *)(tunnelListPtr))->performPmtud + +/* Error values from configuration API */ + +#define TUNNELLIB_IF_NOT_REGISTERED 0x01 +#define TUNNELLIB_IF_NOT_ATTACHED 0x02 +#define TUNNELLIB_WRONG_AF 0x03 +#define TUNNELLIB_ADDR_CONFLICT 0x04 +#define TUNNELLIB_INVALID_OPTIONS 0x05 +#define TUNNELLIB_INTERNAL_ERROR 0x06 +#define TUNNELLIB_MATCH_NOT_FOUND 0x07 + + +/* tunnelTosSelect() parameters */ + +#define TUNNEL_DIR_INGRESS 0x01 +#define TUNNEL_DIR_EGRESS 0x02 + +/* ECN/Diffser defines */ + +#define TOS_ECN_FULL 0x01 /* Full ECN functionality */ +#define TOS_DIFF_ON 0x02 /* Diffserv functionality */ + + +/* Function Declarations */ + +struct sockaddr; /* forward declaration */ + +void tunnelIfShow (char *); +void tunnelIfLookup (int, char *, char *); +STATUS tunnelAddrSet (char *, struct sockaddr *, struct sockaddr *); +STATUS tunnelAddrGet (char *, struct sockaddr *, struct sockaddr *); +STATUS tunnelAddrToIfFind (struct sockaddr *, struct sockaddr *, char *); +void tunnelIfConfig (char *, int, char *, char *); +STATUS tunnelPmtudSet (char *, int); +STATUS tunnelLibInit (void); +STATUS tunnelInstInit (void *); +#ifdef VIRTUAL_STACK +STATUS tunnelInstDestroy (VSNUM vsnum); +#endif /* VIRTUAL_STACK */ +STATUS tunnelDetach (void *); +void * tunnelAttach (int, int, int, FUNCPTR, void *); +void tunnelTosSelect (int, int, UINT8 *, UINT8 *); +void tunnelIPv4Input (M_BLK_ID, int, int); +int tunnelIPv6Input (M_BLK_ID *, int *, int); +void tunnelIPv4inIPv4_ctlinput (int, struct sockaddr *, void *); +void tunnelIPv6inIPv4_ctlinput (int, struct sockaddr *, void *); +void tunnelIPv4inIPv6_ctlinput (int, struct sockaddr *, void *); +void tunnelIPv6inIPv6_ctlinput (int, struct sockaddr *, void *); +int tunnelIpOutput (int, M_BLK_ID, void *, void *, int, void *, BOOL, int, BOOL); +int tunnelIfOutput (register struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *); + +#ifdef MIP6 +struct mip6_bc_internal; +struct mip6_bul_internal; +void * mipTunnelAttach (int, int, int, FUNCPTR, struct mip6_bc_internal *, + struct mip6_bul_internal *); +STATUS mipTunnelDetach (TUNNEL_LIST_ELEMENT *); +#endif /* MIP6 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtunnelLibh */ diff --git a/h/wrn/coreip/dlink/vlanTagLib.h b/h/wrn/coreip/dlink/vlanTagLib.h new file mode 100644 index 0000000..2722af8 --- /dev/null +++ b/h/wrn/coreip/dlink/vlanTagLib.h @@ -0,0 +1,194 @@ +/* vlanTagLib.h - defines for Layer 2 VLAN tagging library */ + +/* + * Copyright (c) 1994-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + + +/* +modification history +-------------------- +01i,25aug05,kch Changed formAddress and packetDataGet arguments for + ipVlanTagAttach() to have unspecified argument list. + Clean up unused prototypes. +01h,18mar05,kch Corrected the SPR# for previous checkin. +01g,17mar05,kch Removed ether_vlan_qtag_header structure definition + (SPR#106521). +01f,10sep04,kc Added pVlanTagHdrCheck FUNCPTR to ipVlanTagAttach() + prototype. +01e,19jun04,kc Fixed SPR#98401 - added vlanTagInstInit() and + vlanTagInstDestroy() prototypes. +01d,03jun04,kc Added vlanTagIfIngressTypeSet(), vlanTagIfIngressTypeGet(), + vlanTagIfIngressRulesSet(), vlanTagIfIngressRulesGet(), + vlanTagIfEgressTypeSet(), vlanTagIfEgressTypeGet(), + vlanTagIfEgressRulesSet() and vlanTagIfEgressRulesGet() + prototypes. Removed the obsolete vlanTagIfFlagsSet() and + vlanTagIfFlagsGet() prototypes. +01c,01jun04,kc Added VLAN_INGRESS_ALL_FRAMES and VLAN_INGRESS_SKIP_TAG + defines. Also added prototype for vlanTagSysDefaultVidSet(). + Added typedef for the TOS-to-Vlan-Priority conversion function + pointer and redefined function arguments for the routine + vlanTagIfTosToPriorityRegister(). +01b,19may04,kc Fixed compiler warnings and issues from the code review. + Renamed all defines from IF8021PQ_XXX to VLAN_XXX. + Renamed all prototypes from if8021pqXxx() to vlanTagIfXxx(). + Moved data structure and defines used internally to + vlanTagLibP.h private header file. Also added defines for + VLAN_EGRESS_PRIORITY_FRAMES and VLAN_EGRESS_UNTAGGED_FRAMES + as well as vlanTagLibInit() and vlanTagIfShow() prototypes. +01a,24mar04,chw written. +*/ + +#ifndef __INCvlantagLibh +#define __INCvlantagLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* this is the function pointer pointed to a user defined conversion function + * for converting the IP TOS field to the 3-bits vlan priority. The + * conversion routine takes the IP TOS value as its input and returns the + * vlan priority value (0-7) that needs to be inserted to the outgoing vlan tag + */ +typedef uchar_t (* TOS2_PRIORITY_FUNCPTR) (uchar_t tos); + + +/* defines */ + +/* + * The acceptable egress frame type: + * VLAN_EGRESS_TAGGED_FRAMES - send tagged frame with non-zero vlan id only. + * + * VLAN_EGRESS_PRIORITY_FRAMES - send priority-tagged frame with vlan id zero. + * If the VLAN_TAG_EGRESS_IP_TOS is not specified + * as well, the value of the priority bits + * configured for the interface via + * vlanTagIfPriorityBitsSet() will be applied + * to the vlan priority bit fields. + * + * VLAN_EGRESS_UNTAGGED_FRAMES - send untagged frame only. If the interface + * is previously configured to send tagged or + * priority-tagged frames, this flag essentially + * unwinds the interface configuration to send + * frames without any tag at all. + */ +#define VLAN_EGRESS_TAGGED_FRAMES 0x01 +#define VLAN_EGRESS_PRIORITY_FRAMES 0x02 +#define VLAN_EGRESS_UNTAGGED_FRAMES 0x04 + +/* + * The acceptable ingress frame type: + * VLAN_INGRESS_TAGGED_FRAMES - receive tagged frame with non-zero vlan id + * only, untagged frame and priority frame (with + * zero vlan id) will be discarded. If this flag + * is not explicitly set, the interface will + * receive all the tagged, priority-tagged and + * untagged frames. + * + * VLAN_INGRESS_ALL_FRAMES - receive all frames (tagged, untagged and + * priority-tagged). + */ +#define VLAN_INGRESS_TAGGED_FRAMES 0x01 +#define VLAN_INGRESS_ALL_FRAMES 0x02 + +/* + * Ingress rules that apply to every received frame: + * VLAN_INGRESS_SKIP_TAG - ignore the vlan tagged header if presnet. No vlan + * ingress filtering operations will be performed on + * the received frame to validate the vlan tag found + * in the received frame. + */ +#define VLAN_INGRESS_SKIP_TAG 0x01 + +/* + * Egress rules that apply to every frame trasmitted: + * VLAN_EGRESS_IP_TOS - send priority-tagged frame by converting the IP TOS + * fields to the vlan priority bit fields. The flag + * VLAN_EGRESS_PRIORITY_FRAME flag must be used in + * conjunction with this flag. + * + * VLAN_EGRESS_CFI_SET - set the CFI bit in the vlan tagged header. The CFI + * bit always takes the value of 0 for ethernet and 1 + * for token ring. + */ + +#define VLAN_EGRESS_IP_TOS 0x01 +#define VLAN_EGRESS_CFI_SET 0x02 + +/* Structure definitions */ + +/* + * The structure definition for the 802.1p/q vlan tagged ethernet header + * is now defined in if_ether.h::struct ether_tag_header + */ + +typedef M_BLK_ID (*ADDR_FORM_FUNC) (M_BLK_ID, M_BLK_ID, M_BLK_ID, BOOL); + +typedef STATUS (*PACKET_DATA_GET_FUNC) (M_BLK_ID, LL_HDR_INFO *); + +/* Forward declarations */ + +IMPORT void vlanTagLibInit (void); + +IMPORT STATUS vlanTagIfIngressTypeSet (char * pDevName, uint32_t unit, + ushort_t ingressType, char * pIfAddress); +IMPORT STATUS vlanTagIfIngressTypeGet (char * pDevName, uint32_t unit, + ushort_t * pIngressType, + char * pIfAddress); + +IMPORT STATUS vlanTagIfEgressTypeSet (char * pDevName, uint32_t unit, + ushort_t egressType, char * pIfAddress); +IMPORT STATUS vlanTagIfEgressTypeGet (char * pDevName, uint32_t unit, + ushort_t * pEgressType, + char * pIfAddress); + +IMPORT STATUS vlanTagIfIngressRulesSet(char * pDevName, uint32_t unit, + ushort_t ingressRules, + char * pIfAddress); +IMPORT STATUS vlanTagIfIngressRulesGet(char * pDevName, uint32_t unit, + ushort_t * pIngressRules, + char * pIfAddress); + +IMPORT STATUS vlanTagIfEgressRulesSet (char * pDevName, uint32_t unit, + ushort_t egressRules, char * pIfAddress); +IMPORT STATUS vlanTagIfEgressRulesGet (char * pDevName, uint32_t unit, + ushort_t * pIngressRules, + char * pIfAddress); + +IMPORT STATUS vlanTagIfVidSet (char * pDevName, uint32_t unit, + ushort_t vlanId, char * pIfAddress); +IMPORT STATUS vlanTagIfVidGet (char * pDevName, uint32_t unit, + ushort_t * pVlanId, char * pIfAddress); + +IMPORT STATUS vlanTagIfPriorityBitsSet (char * pDevName, uint32_t unit, + uchar_t priorityBits, + char * pIfAddress); +IMPORT STATUS vlanTagIfPriorityBitsGet (char * pDevName, uint32_t unit, + uchar_t * pPriorityBits, + char * pIfAddress); + +IMPORT STATUS vlanTagIfTosToPriorityRegister (char * pDevName, uint32_t unit, + TOS2_PRIORITY_FUNCPTR tos2PriorityConvRtn, + char * pIfAddress); + +IMPORT STATUS vlanTagIfShow (char * pDevName, uint32_t unit, + char * pIfAddress); + +IMPORT STATUS ipVlanTagAttach (int unit, char *pDevName, BOOL updateFuncs, + M_BLK_ID (*formAddress)(), + STATUS (*packetDataGet)(), + FUNCPTR pVlanTagHdrCheck); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvlantagLibh */ + diff --git a/h/wrn/coreip/etherLib.h b/h/wrn/coreip/etherLib.h new file mode 100644 index 0000000..2dd667e --- /dev/null +++ b/h/wrn/coreip/etherLib.h @@ -0,0 +1,43 @@ +/* etherLib.h - ethernet hook routines header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,05nov03,cdw Removal of unnecessary _KERNEL guards. +01d,04nov03,rlm Ran batch header path update for header re-org. +01c,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01b,10jun03,vvv include netVersion.h +01a,28sep02,ann provided only for backward compatibility +*/ + +#ifndef __INCetherLibh +#define __INCetherLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* defints */ +typedef struct enet_hdr + { + char dst [6]; + char src [6]; + USHORT type; + } ENET_HDR; + +#define ENET_HDR_SIZ sizeof(ENET_HDR) +#define ENET_HDR_REAL_SIZ 14 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCetherLibh */ diff --git a/h/wrn/coreip/etherMultiLib.h b/h/wrn/coreip/etherMultiLib.h new file mode 100644 index 0000000..19f2f3c --- /dev/null +++ b/h/wrn/coreip/etherMultiLib.h @@ -0,0 +1,72 @@ +/* etherMultiLib.h - definitions for the Ethernet multicast library */ + +/* Copyright 1996-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02h,20nov03,niq Remove copyright_wrs.h file inclusion +02g,04nov03,rlm Ran batch header path update for header re-org. +02f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +02e,23oct03,rlm updated #includes for header re-org +02d,28mar02,ppp Making changes to be compatible with AE 1.1 +02c,03mar02,ham renamed dummyend.h to end.h +02b,18sep01,ann correcting the inclusion of if_ether.h +02a,18sep01,ann ported to clarinet from 01d AE1.1 +01d,12aug97,gnn cleaned up dependencies for multicast handling. +01c,23oct96,gnn name changes to follow coding standards. +01b,07may96,gnn added routines to handle non-IP based multicast + addresses. + Added list handling library. +01a,15apr96,gnn written. + +*/ + +/* +DESCRIPTION + +This header file describes data structures and function prototypes for +the ethernet multicast library. + +INCLUDE FILES: +*/ + +#ifndef __INCetherMultiLibh +#define __INCetherMultiLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include +#include +#include + +/* defints */ + +/* typedefs */ + +/* globals */ + +/* locals */ + +/* forward declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern int etherMultiAdd(LIST *pList, char* pAddress ); +extern int etherMultiDel(LIST* pList, char* pAddress); +extern int etherMultiGet(LIST *pList, MULTI_TABLE* pTable); +#else /* __STDC__ */ + +extern int etherMultiAdd(); +extern int etherMultiDel(); +extern int etherMultiGet(); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCetherMultiLibh */ diff --git a/h/wrn/coreip/fastPath/fastPathFib.h b/h/wrn/coreip/fastPath/fastPathFib.h new file mode 100644 index 0000000..56d05a8 --- /dev/null +++ b/h/wrn/coreip/fastPath/fastPathFib.h @@ -0,0 +1,184 @@ +/* fastPathFib.h - Definitions for the Fast Forwarder FIB */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01m,02oct04,niq Performance changes +01l,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE +01k,20nov03,niq Remove copyright_wrs.h file inclusion +01j,05nov03,cdw Removal of unnecessary _KERNEL guards. +01i,04nov03,rlm Ran batch header path update for header re-org. +01h,15sep03,vvv updated path for new headers +01g,20mar03,niq Reorganize the locking model and fix locking bugs +01f,11mar03,niq Use the RIB API to access RIB data structure +01e,03mar03,niq Add some comments and use RIB macros to access RIB fields +01d,12feb03,deg FIB_ENTRY_MAC_ADDR changed according sockaddr_dl structure +01c,24jan03,deg #include "ptRouteNodeLib.h" and "avlRouteNodeLib.h" removed +01b,02dec02,deg Lock macros added, FIB entry flags updated +01a,07oct02,deg written +*/ + +/* +DESCRIPTION +This file contains FIB related definitions used by the IPv4 & IPv6 Fast +Forwarder modules + +*/ + +#ifndef __INCfastpathFibh +#define __INCfastpathFibh + +/* includes */ + +#include +#include + +/* extern */ + +IMPORT struct ipRouteDispatchTable ptRibDispatchTable; +IMPORT struct ipRouteDispatchTable avlRibDispatchTable; + +/* defines */ + +#define FIB_CREATE RIB_CREATE +#define FIB_DESTROY RIB_DESTROY +#define FIB_NODE_ADD RIB_NODE_ADD +#define FIB_NODE_DELETE RIB_NODE_DELETE +#define FIB_NODE_BEST_MATCH RIB_NODE_BEST_MATCH +#define FIB_NODE_EXACT_MATCH RIB_NODE_EXACT_MATCH +#define FIB_NODE_LEX_NEXT_GET RIB_NODE_LEX_NEXT_GET +#define FIB_NODE_LEX_NEXT_REPEAT RIB_NODE_LEX_NEXT_REPEAT + +#define FIB_DISPATCH_TBL struct ipRouteDispatchTable + +#define FIB_FORMAT_IPV4 RIB_FORMAT_IPV4 +#define FIB_FORMAT_IPV6 RIB_FORMAT_IPV6 + +/* Definitions for FIB entry flags */ + +#define FFF_UP RTF_UP /* 0x0001 */ +#define FFF_INDIRECT RTF_GATEWAY /* 0x0002 */ +#define FFF_HOST RTF_HOST /* 0x0004 */ +#define FFF_MAC RTF_LLINFO /* 0x0400 */ +#define FFF_VALID RTF_PROTO2 /* 0x4000 */ +#define FFF_COMPLETE RTF_PROTO1 /* 0x8000 */ + +/* Fastpath defines these values for fastpath interface use */ + +#define FFF_USABLE 0x01000000 /* Route is usable (VALID & COMPLETE)*/ +#define FFF_IF_ROUTE 0x02000000 /* Interface route */ +#define FFF_PTP 0x04000000 /* PTP interface route */ +#define FFNODE_DELETE 0x08000000 /* Internal: for delayed delete of FIB node*/ + +/* Mask to mask with the RTM flags */ + +#define FFF_FLAGS_MASK (FFF_UP | FFF_INDIRECT | FFF_HOST | FFF_MAC) + + +/* Conversion macros between FIB and FF entry */ + +#define FIB2FF_ENTRY(x) ((FF_ENTRY_ID)(RIB_RTM_ENTRY_GET (x))) +#define FF2FIB_ENTRY(x) ((IP_NODE_ID)((x)->pFibNode)) + +/* Access macros on FIB entry member */ + +#define FF_ENTRY_DEST_ADDR(x) ((x)->pDstAddr) +#define FF_ENTRY_NET_MASK(x) ((x)->pNetmask) +#define FF_ENTRY_GATE_ADDR(x) ((x)->pGateway) + +#define FF_ENTRY_MAC_ADDR(x) (SDL ((x)->pGateway)->sdl_data) +#define FF_ENTRY_GATE_ROUTE(x) ((x)->pGwRoute) +#define FF_ENTRY_ROUTE_METRIC(x) 1 +#define FF_ENTRY_IF_MTU(x) ((x)->ifMtu) +#define FF_ENTRY_IF_INDEX(x) ((x)->ifIndex) +#define FF_ENTRY_MUX_COOKIE(x) ((x)->pMuxCookie) +#define FF_ENTRY_IF_COOKIE(x) ((x)->pIfCookie) +#define FF_ENTRY_USE_COUNT(x) ((x)->useCnt) +#define FF_ENTRY_REFCNT(x) ((x)->refCnt) +#define FF_ENTRY_FLAGS(x) ((x)->flags) + +/* + * Macros to test if cache entry is direct, mac, complete, has a gateway route, + * is up, valid, an interface route, complete and valid, full cache valid + */ + +#define IS_FF_ENTRY_INDIRECT(x) ((FF_ENTRY_FLAGS (x) & FFF_INDIRECT)) +#define IS_FF_ENTRY_MAC(x) ((FF_ENTRY_FLAGS (x) & FFF_MAC)) +#define IS_FF_ENTRY_COMPLETE(x) ((FF_ENTRY_FLAGS (x) & FFF_COMPLETE)) +#define IS_FF_ENTRY_UP(x) (FF_ENTRY_FLAGS (x) & FFF_UP) +#define IS_FF_ENTRY_VALID(x) (FF_ENTRY_FLAGS (x) & FFF_VALID) +#define IS_FF_ENTRY_USABLE(x) (FF_ENTRY_FLAGS (x) & FFF_USABLE) +#define IS_FF_ENTRY_IF_ROUTE(x) (FF_ENTRY_FLAGS (x) & FFF_IF_ROUTE) +#define IS_GATEWAY_ROUTE_SET(x) FF_ENTRY_GATE_ROUTE (x) + +/* + * An entry is COMPLETE_AND_VALID if it is both + * valid : the interface is up and enabled for fast forwarding AND + * COMPLETE : The forwarding information is available + */ + +#define IS_FF_ENTRY_COMPLETE_AND_VALID(x) \ + ((FF_ENTRY_FLAGS (x) & (FFF_VALID | FFF_COMPLETE)) \ + == (FFF_VALID | FFF_COMPLETE)) + +/* + * If it is a direct entry, is the entry valid, else if the + * gateway route is set, is the gateway route entry valid + */ + +#define IS_FULL_CACHE_ENTRY_VALID(x) \ + (IS_FF_ENTRY_DIRECT (x) ? IS_FF_ENTRY_VALID (x) : \ + (IS_GATEWAY_ROUTE_SET (entry) && \ + IS_FF_ENTRY_VALID (FF_ENTRY_GATE_ROUTE (x)))) + + +/* Macros to manipulate the DELAYED_DELETE flag */ +#define MARK_FIB_NODE_DELAYED_DELETE(x) ((x)->delayedDelete)++ +#define CLEAR_FIB_NODE_DELAYED_DELETE(x) ((x)->delayedDelete)-- +#define FIB_NODE_DELAYED_DELETE_MARKED(x) ((x)->delayedDelete) + +/* Macros to manipulate the FFNODE_DELETE flag */ +#define MARK_FIB_NODE_DELETE(x) \ + ((x)->flags |= FFNODE_DELETE) + +#define CLEAR_FIB_NODE_DELETE(x) \ + ((x)->flags &= ~FFNODE_DELETE) +#define FIB_NODE_DELETE_MARKED(x) \ + ((x)->flags & FFNODE_DELETE) + +/* typedefs */ + +typedef struct ipRibHead FIB_COOKIE; +typedef FIB_COOKIE *FIB_COOKIE_ID; +typedef struct ipRouteNode FIB_ENTRY; +typedef FIB_ENTRY *FIB_ENTRY_ID; + +typedef struct ffEntry +{ + void *pFibNode; + struct sockaddr *pDstAddr; + struct sockaddr *pNetmask; + struct sockaddr *pGateway; + struct ffEntry *pGwRoute; + unsigned int flags; + unsigned int useCnt; + unsigned int refCnt; + void *pIfCookie; /* maybe struct ifnet * */ + unsigned int ifMtu; /* was struct rt_metrics */ + void *pMuxCookie; /* maybe struct ifaddr * */ + unsigned int ifIndex; + int delayedDelete; +} FF_ENTRY; + +typedef FF_ENTRY * FF_ENTRY_ID; + +typedef struct ffCacheEntry + { + SOCKADDR_STORAGE_T dstAddr; + FF_ENTRY_ID pFFEntry; + FF_ENTRY_ID pFFEntryGw; + } FF_CACHE_ENTRY; + +#endif /* __INCfastpathFibh */ diff --git a/h/wrn/coreip/fastPath/fastPathIp.h b/h/wrn/coreip/fastPath/fastPathIp.h new file mode 100644 index 0000000..44f2b02 --- /dev/null +++ b/h/wrn/coreip/fastPath/fastPathIp.h @@ -0,0 +1,56 @@ +/* fastPathIp.h - Definitions for the IP Fast Forwarder module */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +01f,01mar05,niq Fix the ipFFInit API (SPR 102586) +01e,20nov03,niq Remove copyright_wrs.h file inclusion +01d,05nov03,cdw Removal of unnecessary _KERNEL guards. +01c,15sep03,vvv updated path for new headers +01b,20mar03,niq Deprecate protocol specific APIs in favor of protocol + independent APIs +01a,12mar03,niq written - consolidated v4/v6 files +*/ + +/* +DESCRIPTION +This file contains definitions used by the IPv4/IPv6 Fast Forwarder module. + +*/ + +#ifndef __INCfastpathIph +#define __INCfastpathIph + +/* includes */ + +#include + +/* function declarations */ + +/* + * Following two APIs are deprecated and might go away in the next release + * Use the protocol independent APIs (ipFFInit, ipFFCacheLookup) instead + */ +IMPORT FF_OBJ_ID ipv4FFInit (int numRoutes, + int proto, + FIB_DISPATCH_TBL *pFibDispTbl); +IMPORT STATUS ipv4FFCacheLookup (FF_OBJ *pFFObj, struct sockaddr *pDstAddr, + FF_PUB_FIB_ENTRY *pPubFibEntry); + +/* Protocol independent APIs to initialize the fastpath and to lookup cache */ +IMPORT FF_OBJ_ID ipFFInit (int numRoutes, + int proto, + FIB_DISPATCH_TBL *pFibDispTbl); +IMPORT STATUS ipFFCacheLookup (FF_OBJ *pFFObj, struct sockaddr *pDstAddr, + FF_PUB_FIB_ENTRY *pPubFibEntry); +#endif /* __INCfastpathIph */ diff --git a/h/wrn/coreip/fastPath/fastPathIpLib.h b/h/wrn/coreip/fastPath/fastPathIpLib.h new file mode 100644 index 0000000..d4cfaae --- /dev/null +++ b/h/wrn/coreip/fastPath/fastPathIpLib.h @@ -0,0 +1,56 @@ +/* fastPathIpLib.h - Backward compatibility with the previous Fastpath Interface */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,07aug01,niq Add more prototypes +01c,02may01,niq Correcting mod history +01b,01may01,niq Copying over file from tor2_0.open_stack branch version 01d + (fastPathIpLib.h@@/main/tor2_0.open_stack/4) +01a,29mar01,spm file creation: copied from version 01a of tor2_0.open_stack + branch (wpwr VOB) for unified code base; fixed title entry + +*/ + +/* +DESCRIPTION + +This include file contains definitions used for backward compatibility with +the previous Fastpath interface. This should not be used by new applications +as it might be phased out in later releases. + +INCLUDE FILES: +*/ + +#ifndef _INCfastPathIpLibh +#define _INCfastPathIpLibh + +#ifdef __cplusplus +extern "C" { +#endif + + +#include +#include +#include +#include + + +IMPORT STATUS ffInit(void); +IMPORT STATUS ffShutdown(void); +IMPORT STATUS ffModeSet(int mode); +IMPORT BOOL ffModeGet(void); +IMPORT STATUS ffIntEnable(char *pIfName, int unitNo); +IMPORT STATUS ffIntDisable(char *pIfName, int unitNo); +IMPORT void ffCacheShow(void); +IMPORT STATUS ffCachePopulate(void); +IMPORT STATUS ffCacheFlush(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfastPathIpLibh */ diff --git a/h/wrn/coreip/fastPath/fastPathLib.h b/h/wrn/coreip/fastPath/fastPathLib.h new file mode 100644 index 0000000..10b8443 --- /dev/null +++ b/h/wrn/coreip/fastPath/fastPathLib.h @@ -0,0 +1,490 @@ +/* fastPathLib.h - Definitions for the Fastpath library */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +01r,21apr05,kch Removed unused FF_GET_SCOPE_ID macro. +01q,01mar05,niq Fix the ipFFInit API (SPR 102586) +01p,02oct04,niq Backward compatibility change +01o,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE +01n,20nov03,niq Remove copyright_wrs.h file inclusion +01m,05nov03,cdw Removal of unnecessary _KERNEL guards. +01l,04nov03,rlm Ran batch header path update for header re-org. +01k,15sep03,vvv updated path for new headers +01j,20mar03,niq Reorganize the locking model and fix locking bugs + Revert to + published API names for backwards compatilibility +01i,19mar03,niq Expand the ffRouteAdded API +01h,13mar03,niq Fastpath forwarding hook integration +01g,12mar03,niq Add a few macros - v4/v6 consolidation +01f,13feb03,deg include path for if_dl.h fixed +01e,06feb03,deg change type of macAddr in ffPubFibEntry to struct sockaddr_dl +01d,04feb03,deg include path changed +01c,24jan03,deg ff_config_params changed +01b,14nov02,deg #include deleted +01a,07oct02,deg written +*/ + +/* +DESCRIPTION +This file contains definitions used by the Fastpath library +and by the IPv4 & IPv6 Fast Forwarder modules. + +*/ + +#ifndef __INCfastPathLibh +#define __INCfastPathLibh + +/* includes */ + +#include +#include +#include +#include +#include +#include + +/* defines */ + +/* Fastpath interface version */ + +#define FF_VERSION 0x00000011 + +/* + * The following definitions define bitwise OR values for the ffIpv4State + * and ffIpv6State variables + */ + +#define FF_MODULE_NOT_INITIALIZED 0 /* Module (v4 or v6) not initialized*/ +#define FF_MODULE_INITIALIZED 1 /* Module (v4 or v6) not initialized*/ +#define FF_MODULE_STARTED 2 /* Calls can be made to module */ +#define FF_MODULE_ENABLED 4 /* Fastforwarding is in effect */ + +/* errno values */ + +#define S_fastPathLib_ALREADY_EXISTS (M_fastPathLib | 1) +#define S_fastPathLib_ALREADY_REGISTERED (M_fastPathLib | 2) +#define S_fastPathLib_INTERNAL_ERROR (M_fastPathLib | 3) +#define S_fastPathLib_INVALID_ARG (M_fastPathLib | 4) +#define S_fastPathLib_INVALID_OBJ (M_fastPathLib | 5) +#define S_fastPathLib_INVALID_PARAMS (M_fastPathLib | 6) +#define S_fastPathLib_INVALID_PROTO (M_fastPathLib | 7) +#define S_fastPathLib_INVALID_STATE (M_fastPathLib | 8) +#define S_fastPathLib_NOT_FOUND (M_fastPathLib | 9) +#define S_fastPathLib_NOT_INITIALIZED (M_fastPathLib | 10) + +/* Definitions for the Fast Forwarder (Hardware or Software) */ + +#define FF_HARDWARE_FORWARDER 0x01 +#define FF_SOFTWARE_FORWARDER 0x02 + +/* Protocol types supported by FastPath */ + +#define FF_PROTO_IPV4 0x01 +#define FF_PROTO_IPV6 0x02 + +/* Definition for unlimited FIB size */ + +#define FF_FIB_SIZE_UNLIMITED 0x00 + +/* Metric for routes passed onto the Fast Forwarder modules */ + +/* + * We use -1 for FF_REP_ROUTE as the route weight can never equal that value. + * We can't use zero as the route weight for all routes is zero for a + * host stack + */ + +#define FF_NON_REP_ROUTE 0x00 +#define FF_REP_ROUTE -1 + +/* Fastpath mode commands */ + +#define FF_START 0x01 /* Start the Fastpath module*/ +#define FF_STOP 0x02 /* Stop the Fastpath module */ +#define FF_ENABLE 0x04 /* Enable packet fast-forwarding */ +#define FF_DISABLE 0x08 /* Disable packet fast-forwarding */ +#define FF_IPFF_ENABLE 0x10 /* IP fast-forwarding enabled */ +#define FF_IPFF_DISABLE 0x20 /* IP fast-forwarding disabled */ + +/* Commands for interface status change call */ + +#define FF_IF_UP 0x01 +#define FF_IF_DOWN 0x02 +#define FF_IF_DELETE 0x04 +#define FF_IF_ADD 0x08 +#define FF_IFADDR_ADD 0x10 +#define FF_IFADDR_DELETE 0x20 + +/* Flags for the ffRouteAdded command - bitwise OR */ + +#define FF_INTF_ROUTE 0x01 + +/* Fastpath object locking macros */ + +#define FF_LOCK_INIT(x) ((x) = semMCreate (SEM_Q_PRIORITY | SEM_DELETE_SAFE | \ + SEM_INVERSION_SAFE)) +#define FF_LOCK_DESTROY(x) (semDelete (x)) +#define FF_OBJ_LOCK(pFFObj) semTake((pFFObj)->ffCacheLock, WAIT_FOREVER) +#define FF_OBJ_UNLOCK(pFFObj) semGive((pFFObj)->ffCacheLock) +#define FF_OBJ_CACHEWALK_LOCK(pFFObj) \ + semTake((pFFObj)->ffCacheWalkLock, WAIT_FOREVER) +#define FF_OBJ_CACHEWALK_UNLOCK(pFFObj) \ + semGive((pFFObj)->ffCacheWalkLock) + + +#define FF_DO_IP_FORWARDING IP_DO_FORWARDING +#define FF_WE_ARE_FORWARDING 0x40000000 + +#define FF_FLAGS_IP_MASK (IP_DO_FORWARDING) + +#define FF_GET_IP_FLAGS(pFFObj) ((pFFObj->ffFlags) & FF_FLAGS_IP_MASK) + +#define FF_SET_IP_FLAGS(pFFObj, flags) \ + (pFFObj->ffFlags = (pFFObj->ffFlags & ~FF_FLAGS_IP_MASK) | \ + (flags & FF_FLAGS_IP_MASK)) + +#define FF_SET_WE_ARE_FORWARDING(pFFObj) \ + (pFFObj->ffFlags |= FF_WE_ARE_FORWARDING) +#define FF_RESET_WE_ARE_FORWARDING(pFFObj) (pFFObj->ffFlags &= \ + ~FF_WE_ARE_FORWARDING) + +/* Macros used by various components of the system */ + +#define FF_ARE_WE_FORWARDING(pFFObj) (pFFObj->ffFlags & FF_WE_ARE_FORWARDING) + +#define SHOULD_MAKE_CALLS_TO_FF(pFFObj) ((pFFObj != NULL) && \ + FF_MOD_STARTED (pFFObj)) + +#define SHOULD_GIVE_PACKET_TO_FF(pFFObj, pIfp) \ + ((pFFObj != NULL) && \ + FF_ARE_WE_FORWARDING (pFFObj) && FF_MOD_ENABLED (pFFObj) && \ + FF_INTF_ENABLED (pFFObj, pIfp) && pFFObj->ffFuncTable->ffPktSend != NULL) + +/* Call Fast Forwarder module functions (private macro ) */ + +#define FF_CALL(pFFObj, func, args) (((pFFObj != NULL) && \ + (SHOULD_MAKE_CALLS_TO_FF (pFFObj)) && \ + (pFFObj->ffFuncTable->func != NULL)) ? \ + (*(pFFObj->ffFuncTable->func)) args : \ + ERROR) + +/* Same as above, except that checks have already been made */ + +#define FF_NC_CALL(pFFObj, func, args) \ + (((pFFObj != NULL) && (pFFObj->ffFuncTable->func != NULL)) ? \ + (*(pFFObj->ffFuncTable->func)) args : ERROR) + +/* Definitions for the flags field - bitwise OR */ + +#define FF_PUB_ENTRY_FLAG_MAC 0x01 +#define FF_PUB_ENTRY_FLAG_VALID 0x02 +#define FF_PUB_ENTRY_FLAG_COMPLETE 0x04 + +/* Macros to test the state of the public FIB entry */ + +#define IS_FF_PUB_ENTRY_MAC(x) ((x)->flags & FF_PUB_ENTRY_FLAG_MAC) +#define IS_FF_PUB_ENTRY_NON_MAC(x) (!((x)->flags & FF_PUB_ENTRY_FLAG_MAC)) +#define IS_FF_PUB_ENTRY_VALID(x) (((x)->flags & FF_PUB_ENTRY_FLAG_VALID)) +#define IS_FF_PUB_ENTRY_INVALID(x) (!((x)->flags & FF_PUB_ENTRY_FLAG_VALID)) +#define IS_FF_PUB_ENTRY_COMPLETE(x) (((x)->flags & FF_PUB_ENTRY_FLAG_COMPLETE)) +#define IS_FF_PUB_ENTRY_INCOMPLETE(x)(!((x)->flags & FF_PUB_ENTRY_FLAG_COMPLETE)) + +#define SET_FF_LIB_LOG_LEVEL(x) ffLibLogLevel = (x) + + +/* Macro to retrieve the hardware assist status of an interface */ +#define GET_HWASSIST_FLAGS(x) (((struct ifnet *)(x))->if_hwassist) + +/* Interface to get scope. Might change in the future */ + +#ifdef INET6 +#define IPADDR_MASKED_ARE_SAME(pD, pN, pG) \ + ((pD->sa_family == AF_INET) ? \ + ((SOCKADDR_IN(pD) & SOCKADDR_IN(pN)) == \ + (SOCKADDR_IN(pG) & SOCKADDR_IN(pN))) : \ + ((pD->sa_family == AF_INET6) ? \ + (((SA6(pD).s6_addr32[0] & SA6(pN).s6_addr32[0]) == \ + (SA6(pG).s6_addr32[0] & SA6(pN).s6_addr32[0])) && \ + ((SA6(pD).s6_addr32[1] & SA6(pN).s6_addr32[1]) == \ + (SA6(pG).s6_addr32[1] & SA6(pN).s6_addr32[1])) && \ + ((SA6(pD).s6_addr32[2] & SA6(pN).s6_addr32[2]) == \ + (SA6(pG).s6_addr32[2] & SA6(pN).s6_addr32[2])) && \ + ((SA6(pD).s6_addr32[3] & SA6(pN).s6_addr32[3]) == \ + (SA6(pG).s6_addr32[3] & SA6(pN).s6_addr32[3]))) : \ + (panic ("BAD address family: %d %x @ %s:%d\n", \ + pD->sa_family, pD, __FILE__, __LINE__), FALSE))) +#else +#define IPADDR_MASKED_ARE_SAME(pD, pN, pG) \ + ((pD->sa_family == AF_INET) ? \ + ((SOCKADDR_IN(pD) & SOCKADDR_IN(pN)) == \ + (SOCKADDR_IN(pG) & SOCKADDR_IN(pN))) : \ + (panic ("BAD address family: %d %x @ %s:%d\n", \ + pD->sa_family, pD, __FILE__, __LINE__), FALSE)) +#endif /* INET6 */ + +/* typedefs */ + +/* Generic Fast Forwarder object */ + +typedef struct ffObj +{ + NODE ffNode; /* Internal */ + int ffVersion; /* Internal - fastpath module version */ + char ffName[FF_NAME_MAX]; /* Name of Fast Forwarder module*/ + SEM_ID ffCacheLock; /* To synchronize access */ + SEM_ID ffCacheWalkLock;/* To synchronize access */ + int ffFlags; /* IP config states */ + int ffProto; /* Protocol type */ + int ffState; /* Fast Forwarder state */ + int ffFibSize; /* Max # of FIB entries */ + struct ffFunctions *ffFuncTable; /* Table of function pointers*/ + void *ffRouteHandle; /* acc_deg: ? */ + void *ffPrivate; /* Private data */ +} FF_OBJ; + +typedef FF_OBJ *FF_OBJ_ID; + +/* The following macro return the address family for the given Fastpath obj */ +#ifdef INET6 +#define FP_TO_AF(x) (((x)->ffProto == FF_PROTO_IPV4) ? AF_INET : \ + (((x)->ffProto == FF_PROTO_IPV6) ? AF_INET6 : \ + (panic ("BAD fastpath proto : %d @ %s:%d \n", \ + (x)->ffProto, __FILE__, __LINE__), 0))) +#else +#define FP_TO_AF(x) (((x)->ffProto == FF_PROTO_IPV4) ? AF_INET : \ + (panic ("BAD fastpath proto : %d @ %s:%d \n", \ + (x)->ffProto, __FILE__, __LINE__), 0)) +#endif /* INET6 */ + +/* + * Definition for the structure passed to the ffInterfaceStatusChanged + * function + */ + +struct ffIfAddrArg + { + struct sockaddr * pIfaAddr; + struct sockaddr * pIfaNetmask; + }; + +/* + * Definition of the structure that the ffFibWalk routine passes to the + * user defined function. This is the public format in which the + * Fastpath FIB entries are exported. + */ + +typedef struct ffPubFibEntry +{ + SOCKADDR_STORAGE_T dstAddr; + SOCKADDR_STORAGE_T netmask; + SOCKADDR_STORAGE_T gateAddr; + struct sockaddr_dl macAddr; + unsigned int routeMetric; + unsigned int ifMtu; + unsigned int ifIndex; + unsigned int useCount; + unsigned int refCount; + unsigned int flags; + void * pOutIfCookie; +} FF_PUB_FIB_ENTRY; + +/* Prototype for the user defined function that ffFibWalk invokes */ + +typedef STATUS (* FF_USER_WALK_FUNC_ID) (FF_PUB_FIB_ENTRY *, void *); + +/* Prototype for the user defined function that ffLibRouteTableWalk invokes */ + +typedef STATUS (* FF_USER_RT_WALK_FUNC_ID) (FF_OBJ_ID, struct rtentry *, void *); + +/* Prototype for the user defined fastpath module init function */ + +typedef struct ffObj * (*FFINIT_FUNC_PTR)(int, int, FIB_DISPATCH_TBL *); + +/* + * Definition of the function table structure that a Fast Forwarder module + * passes to the Fastpath library + */ + +typedef struct ffFunctions + { + STATUS (* ffShutdown) (FF_OBJ *); + BOOL (* ffPktSend) (FF_OBJ *, + struct sockaddr *, + M_BLK_ID , + USHORT, + void *); + STATUS (* ffRouteAdded) (FF_OBJ *, + int, + int, + struct sockaddr *, + struct sockaddr *, + struct sockaddr *, + int, + int, + void *); + STATUS (* ffRouteDeleted) (FF_OBJ *, + int, + int, + struct sockaddr *, + struct sockaddr *, + struct sockaddr *); + STATUS (* ffRouteModified) (FF_OBJ *, + int, + int, + struct sockaddr *, + struct sockaddr *, + struct sockaddr *, + struct sockaddr *); + STATUS (* ffRouteComplete) (FF_OBJ *, + struct sockaddr *, + struct sockaddr *, + struct sockaddr *, + char *, + int, + int, + int, + int, + void *); + STATUS (* ffMacEntryDeleted) (FF_OBJ *, + struct sockaddr *, + struct sockaddr *); + STATUS (* ffRouteDemoted) (FF_OBJ *, + int, + struct sockaddr *, + struct sockaddr *, + struct sockaddr *); + STATUS (* ffRoutePromoted) (FF_OBJ *, + int, + struct sockaddr *, + struct sockaddr *, + struct sockaddr *); + STATUS (* ffInterfaceModeChanged) (FF_OBJ *, + int, + int); + STATUS (* ffModeChanged) (FF_OBJ *, + int); + STATUS (* ffInterfaceStatusChanged) (FF_OBJ *, + int, + int, + void *); + STATUS (* ffFibFlush) (FF_OBJ *); + STATUS (* ffFibWalk) (FF_OBJ *, + FF_USER_WALK_FUNC_ID, + void *); + } FF_FUNCTIONS; + +typedef FF_FUNCTIONS *FF_FUNC_ID; + +/* Structure used by the ffLibRouteTableWalk() function */ + +typedef struct userRtFuncArg +{ + struct ffObj *pFFObj; + FF_USER_RT_WALK_FUNC_ID pUserFunc; + void *pUserArg; +} USER_RT_FUNC_ARG; + +typedef struct ff_config_params +{ + CFG_DATA_HDR cfgh; + FFINIT_FUNC_PTR pIPv4FFInit; + FFINIT_FUNC_PTR pIPv6FFInit; + FIB_DISPATCH_TBL * pFfIPv4FibDispTable; + FIB_DISPATCH_TBL * pFfIPv6FibDispTable; +} FF_CONFIG_PARAMS; + +#ifdef VIRTUAL_STACK +extern VS_REG_ID ffRegistrationNum; +#endif /* VIRTUAL_STACK */ +extern FF_CONFIG_PARAMS ffDefaultConfigParams; + +/* Exported variables */ + +#ifndef VIRTUAL_STACK +IMPORT int ffLibLogLevel; +IMPORT FF_OBJ_ID GET_IPV4_FF_ID; +#endif /* VIRTUAL_STACK */ + +/* function declarations */ + +IMPORT STATUS ffLibInit (FFINIT_FUNC_PTR pIPv4FFInit, + FFINIT_FUNC_PTR pIPv6FFInit, + FIB_DISPATCH_TBL * pFfIPv4FibDispTable, + FIB_DISPATCH_TBL * pFfIPv6FibDispTabl); +IMPORT STATUS ffLibShutdown (FF_OBJ *pFFObj); +IMPORT STATUS ffLibObjInit (FF_OBJ *pFFObj, + int numRoutes, + int proto, + char *pIdString, + FF_FUNC_ID pFuncTable, + void *pPrivateData); +IMPORT STATUS ffLibObjUnInit (FF_OBJ *pFFObj); + +IMPORT STATUS ffLibCachePopulate (FF_OBJ *pFFObj); +IMPORT STATUS ffLibCacheUpdate (FF_OBJ *, + int, + struct sockaddr *, + struct sockaddr *, + struct sockaddr *, + int, + int, + unsigned int); + +IMPORT STATUS ffLibCacheFlush (FF_OBJ *pFFObj); +IMPORT STATUS ffLibCachePrint (FF_OBJ *pFFObj); +IMPORT STATUS ffLibCacheDump (FF_OBJ *pFFObj, + unsigned char *pMemPtr, + int size); + +IMPORT STATUS ffLibRouteTableWalk (FF_OBJ *pFFObj, + FF_USER_RT_WALK_FUNC_ID pUserFunc, + void *pUserArg); + +IMPORT STATUS ffLibModeSet (FF_OBJ *pFFObj, + int mode); +IMPORT STATUS ffLibModeGet (FF_OBJ *pFFObj, + int * mode); +IMPORT STATUS ffLibInterfaceModeSet (FF_OBJ *pFFObj, + int ifIndex, + int mode); +IMPORT STATUS ffLibInterfaceModeGet (FF_OBJ *pFFObj, + int ifIndex, + int *mode); +IMPORT STATUS ffLibLogLevelSet (int level); +IMPORT int ffLibLogLevelGet (void); +IMPORT void *ffLibProtoCookieGet (int proto); +IMPORT void *ffLibIfCookieFromIfIndexGet (FF_OBJ * pFFObj, + unsigned short ifIndex); +IMPORT void *ffLibIfCookieFromEndGet (FF_OBJ * pFFObj, + struct end_object * pEnd); +IMPORT STATUS ffLibStatsUpdate (FF_OBJ *pFFObj, + int len, + void *pInIfCookie, + void *pOutIfCookie, + int flags); + +IMPORT STATUS ffLibRouteComplete (FF_OBJ *, + struct sockaddr *, + struct sockaddr *, + struct sockaddr *, + char *, + int, + int, + int, + int, + void *); +IMPORT STATUS ffLibMacEntryDeleted (FF_OBJ *, + struct sockaddr *, + struct sockaddr *); + +#endif /* __INCfastPathLibh */ diff --git a/h/wrn/coreip/fastPath/fastPathMon.h b/h/wrn/coreip/fastPath/fastPathMon.h new file mode 100644 index 0000000..e9e2a95 --- /dev/null +++ b/h/wrn/coreip/fastPath/fastPathMon.h @@ -0,0 +1,82 @@ +/* fastPathMon.h - Definitions for the Fastpath interface towards the RTM */ + +/* Copyright 1984 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE +01e,20nov03,niq Remove copyright_wrs.h file inclusion +01d,04nov03,rlm Ran batch header path update for header re-org. +01c,03apr03,niq Increase the buffer size for receiving messages +01b,15nov02,deg ffMonShutdown() changed to ffMonDestructor() +01a,07oct02,deg written +*/ + +/* +DESCRIPTION +This file contains definitions used by the Fastpath RTM monitor. + +*/ + +#ifndef __INCfastPathMonh +#define __INCfastPathMonh + +/* defines */ + +#define ffMonTaskPriority 75 +#define ffMonTaskOptions VX_SUPERVISOR_MODE +#define ffMonTaskStackSize 10000 + +#define FF_RTBUFSIZE 2048 +#define FF_CFGBUFSIZE 32 + +#define FF_MON_LIST_INIT(list) DLL_INIT(list) +#define FF_MON_LIST_FIRST(list) (FF_MON_LIST_NODE *)DLL_FIRST(list) +#define FF_MON_LIST_NEXT(node) (FF_MON_LIST_NODE *)DLL_NEXT(node) +#define FF_MON_LIST_PUT_REAR(list, node) DLL_ADD((list), (node)) +#define FF_MON_LIST_REMOVE(list, node) DLL_REMOVE ((list),(node)) + +/* alignment constraint for routing socket */ +#define ROUNDUP(a) \ + ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long)) + +/* typedefs */ + +typedef DL_NODE FF_MON_NODE; +typedef DL_LIST FF_MON_LIST; + +typedef struct ffMonListNode +{ + FF_MON_NODE node; + int sockDesc; +} FF_MON_LIST_NODE; + +typedef enum + { + FF_MON_STACK_SET_UP = 1, + FF_MON_STACK_SET_DOWN, + FF_MON_STACK_IS_UP, + FF_MON_STACK_IS_DOWN, + FF_MON_ERROR + } FF_MON_CMD; + +typedef struct ffMonCfgMsg +{ + FF_MON_CMD cmd; +#ifdef VIRTUAL_STACK + VSNUM vsnum; +#endif /* VIRTUAL_STACK */ + int sockDesc; + unsigned char len; +} FF_MON_CFG_MSG; + +/* function declarations */ + +IMPORT STATUS ffMonInstInit (void *cfgParams); +#ifndef VIRTUAL_STACK +IMPORT STATUS ffMonDestructor (void); +#endif /* VIRTUAL_STACK */ +IMPORT STATUS ffMonWakeup (FF_MON_CFG_MSG *); + +#endif /* __INCfastPathMonh */ diff --git a/h/wrn/coreip/fastPath/fastPathPatTree.h b/h/wrn/coreip/fastPath/fastPathPatTree.h new file mode 100644 index 0000000..d3c44f0 --- /dev/null +++ b/h/wrn/coreip/fastPath/fastPathPatTree.h @@ -0,0 +1,246 @@ +/* fastPathPatTree.h - Definitions for the Patricia tree Fastpath cache */ + +/* Copyright 1984 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE +01g,04nov03,rlm Ran batch header path update for header re-org. +01f,07aug01,niq Adding a lookup version with netmask + coding convention + compliance. +01e,29jun01,spm removed use of deleted metric for obsolete OSPF implementation +01d,02may01,niq Correcting mod history +01c,01may01,niq Copied over from tor2_0.open_stack branch +01b,20mar01,niq Adding comments +01a,29jan01,niq written +*/ + +/* +DESCRIPTION + +This include file contains definitions used by the Patricia tree +Fastpath cache implementation (fastPathPatTree.c) +It also includes MACROS that allow the Fastpath module (fastPathIp.c) to +access the fields on the cache entry without needing to know the +structure of the cache entry + +INCLUDE FILES: +*/ + +#ifndef __INCfastPathPatTreeh +#define __INCfastPathPatTreeh + +/* includes */ + +#include +#include +#include + +/* defines */ + +/* Maps to the Cache interface functions */ + +#define CACHE_INIT ptCacheInit +#define CACHE_DESTROY ptCacheDestroy +#define CACHE_ENTRY_ADD ptCacheEntryAdd +#define CACHE_ENTRY_PREFORMED_ADD ptCacheEntryInternalAdd +#define CACHE_ENTRY_DEL ptCacheEntryDel +#define CACHE_ENTRY_FREE ptCacheEntryFree +#define CACHE_LOOKUP ptCacheLookup +#define CACHE_LOOKUP_NM ptCacheNmLookup +#define CACHE_WALK ptCacheWalk +#define CACHE_DESTROY ptCacheDestroy + +/* Definitions for Cache entry flags */ + +#define FF_ENTRY_FLAG_UP RTF_UP /* 1 */ +#define FF_ENTRY_FLAG_INDIRECT RTF_GATEWAY /* 2 */ +#define FF_ENTRY_FLAG_HOST RTF_HOST /* 4 */ +#define FF_ENTRY_FLAG_INTF_ROUTE RTF_REJECT /* 8 */ +#define FF_ENTRY_FLAG_MAC RTF_LLINFO /* 0x400 */ +#define FF_ENTRY_FLAG_VALID RTF_PROTO2 /* 0x4000 */ +#define FF_ENTRY_FLAG_COMPLETE RTF_PROTO1 /* 0x8000 */ + +/* Use the following macros to access the fields of the cache entry */ + +#define GET_CACHE_ENTRY_DEST_ADDR(pRt) (rt_key (pRt)) +#define GET_CACHE_ENTRY_NET_MASK(pRt) (rt_mask (pRt)) +#define GET_CACHE_ENTRY_GATE_ADDR(pRt) ((pRt)->rt_gateway) + +#define GET_CACHE_ENTRY_MAC_ADDR(pRt) (((pRt)->rt_gateway)->sa_data) +#define SET_CACHE_ENTRY_MAC_ADDR(pRt, macAddr, len) \ + bcopy ((unsigned char *)macAddr, \ + (unsigned char *)GET_CACHE_ENTRY_MAC_ADDR (pRt), len) + +#define GET_CACHE_ENTRY_GATE_ROUTE(pRt) ((pRt)->rt_gwroute) +#define SET_CACHE_ENTRY_GATE_ROUTE(pRt, x) ((pRt)->rt_gwroute = x) + +#define GET_CACHE_ENTRY_ROUTE_METRIC(pRt) 1 + +#define GET_CACHE_ENTRY_IF_MTU(pRt) ((pRt)->rt_rmx.value1) +#define SET_CACHE_ENTRY_IF_MTU(pRt, x) ((pRt)->rt_rmx.value1 = x) + +#define GET_CACHE_ENTRY_IF_INDEX(pRt) ((int)((pRt)->rt_llinfo)) +#define SET_CACHE_ENTRY_IF_INDEX(pRt, x) ((pRt)->rt_llinfo = (caddr_t)x) + +#define GET_CACHE_ENTRY_MUX_COOKIE(pRt) ((pRt)->rt_ifa) +#define SET_CACHE_ENTRY_MUX_COOKIE(pRt, x) ((pRt)->rt_ifa = x) + +#define GET_CACHE_ENTRY_IF_COOKIE(pRt) ((pRt)->rt_ifp) +#define SET_CACHE_ENTRY_IF_COOKIE(pRt, x) ((pRt)->rt_ifp = x) + +#define GET_CACHE_ENTRY_USE_COUNT(pRt) ((pRt)->rt_use) +#define SET_CACHE_ENTRY_USE_COUNT(pRt, x) ((pRt)->rt_use = x) +#define INC_CACHE_ENTRY_USE_COUNT(pRt) (++GET_CACHE_ENTRY_USE_COUNT (pRt)) +#define DEC_CACHE_ENTRY_USE_COUNT(pRt) (--GET_CACHE_ENTRY_USE_COUNT (pRt)) + +#define GET_CACHE_ENTRY_FLAGS(pRt) ((pRt)->rt_flags) +#define SET_CACHE_ENTRY_FLAGS(pRt, x) ((pRt)->rt_flags = x) + +#define MARK_CACHE_ENTRY_UP(pRt) \ + SET_CACHE_ENTRY_FLAGS (pRt, GET_CACHE_ENTRY_FLAGS (pRt) | FF_ENTRY_FLAG_UP) +#define MARK_CACHE_ENTRY_NOTUP(pRt) \ + SET_CACHE_ENTRY_FLAGS (pRt, GET_CACHE_ENTRY_FLAGS (pRt) & \ + ~FF_ENTRY_FLAG_UP) + +#define MARK_CACHE_ENTRY_COMPLETE(pRt) \ + SET_CACHE_ENTRY_FLAGS (pRt, GET_CACHE_ENTRY_FLAGS (pRt) | \ + FF_ENTRY_FLAG_COMPLETE) +#define MARK_CACHE_ENTRY_INCOMPLETE(pRt) \ + SET_CACHE_ENTRY_FLAGS (pRt, GET_CACHE_ENTRY_FLAGS (pRt) & \ + ~FF_ENTRY_FLAG_COMPLETE) + +#define MARK_CACHE_ENTRY_VALID(pRt) \ + SET_CACHE_ENTRY_FLAGS (pRt, GET_CACHE_ENTRY_FLAGS (pRt) | \ + FF_ENTRY_FLAG_VALID) +#define MARK_CACHE_ENTRY_INVALID(pRt) \ + SET_CACHE_ENTRY_FLAGS (pRt, GET_CACHE_ENTRY_FLAGS (pRt) & \ + ~FF_ENTRY_FLAG_VALID) + +#define MARK_CACHE_ENTRY_INDIRECT(pRt) \ + SET_CACHE_ENTRY_FLAGS (pRt, GET_CACHE_ENTRY_FLAGS (pRt) | \ + FF_ENTRY_FLAG_INDIRECT) +#define MARK_CACHE_ENTRY_DIRECT(pRt) \ + SET_CACHE_ENTRY_FLAGS (pRt, GET_CACHE_ENTRY_FLAGS (pRt) & \ + ~FF_ENTRY_FLAG_INDIRECT) + +#define GET_CACHE_ENTRY_REFCNT(pRt) ((pRt)->rt_refcnt) +#define SET_CACHE_ENTRY_REFCNT(pRt, x) ((pRt)->rt_refcnt = x) +#define INC_CACHE_ENTRY_REFCNT(pRt) (++GET_CACHE_ENTRY_REFCNT (pRt)) +#define DEC_CACHE_ENTRY_REFCNT(pRt) (--GET_CACHE_ENTRY_REFCNT (pRt)) + +/* Is Cache entry a direct route or an Indirect route */ + +#define IS_CACHE_ENTRY_DIRECT(pRt) \ + ((GET_CACHE_ENTRY_FLAGS (pRt) & FF_ENTRY_FLAG_INDIRECT) == 0) +#define IS_CACHE_ENTRY_MAC(pRt) \ + ((GET_CACHE_ENTRY_FLAGS (pRt) & FF_ENTRY_FLAG_MAC)) +#define IS_CACHE_ENTRY_COMPLETE(pRt) \ + ((GET_CACHE_ENTRY_FLAGS (pRt) & FF_ENTRY_FLAG_COMPLETE)) + +/* Is the Gateway route set, as opposed to just being marked gateway */ + +#define IS_GATEWAY_ROUTE_SET(pRt) GET_CACHE_ENTRY_GATE_ROUTE (pRt) + +#define IS_CACHE_ENTRY_UP(pRt) (GET_CACHE_ENTRY_FLAGS (pRt) & \ + FF_ENTRY_FLAG_UP) +#define IS_CACHE_ENTRY_VALID(pRt) (GET_CACHE_ENTRY_FLAGS (pRt) & \ + FF_ENTRY_FLAG_VALID) + +/* Is the cache entry an Interface route */ + +#define IS_CACHE_ENTRY_INTF_ROUTE(pRt) (GET_CACHE_ENTRY_FLAGS (pRt) & \ + FF_ENTRY_FLAG_INTF_ROUTE) + +/* + * An entry is COMPLETE_AND_VALID if it is both + * valid : the interface is up and enabled for fast forwarding AND + * COMPLETE : The forwarding information is available + */ + +#define IS_CACHE_ENTRY_COMPLETE_AND_VALID(pRt) \ + ((GET_CACHE_ENTRY_FLAGS (pRt) & \ + (FF_ENTRY_FLAG_VALID | FF_ENTRY_FLAG_COMPLETE)) == \ + (FF_ENTRY_FLAG_VALID | FF_ENTRY_FLAG_COMPLETE)) + + +/* + * If it is a direct entry, is the entry valid, else if the + * gateway route is set, is the gateway route entry valid + */ + +#define IS_FULL_CACHE_ENTRY_VALID(pRt) \ + (IS_CACHE_ENTRY_DIRECT (pRt) ? IS_CACHE_ENTRY_VALID (pRt) : \ + (IS_GATEWAY_ROUTE_SET (pRt) && \ + IS_CACHE_ENTRY_VALID (GET_CACHE_ENTRY_GATE_ROUTE (pRt)))) + + +/* + * Get the cache entry that contains the MAC address. For a direct + * route, it is that entry itself. For an indirect route it is the + * gateway's MAC entry + */ + +#define GET_MAC_CACHE_ENTRY(pRt) \ + (IS_CACHE_ENTRY_DIRECT (pRt) ? pRt : (GET_CACHE_ENTRY_GATE_ROUTE (pRt))) + +/* + * Given an entry pRt, sets pNewRt to the entry that can be used + * for forwarding. If the entry cannot be used for forwarding, pNewRt + * is set to NULL + */ + +#define GET_USABLE_ENTRY(pNewRt, pRt) \ + { \ + if (IS_CACHE_ENTRY_COMPLETE_AND_VALID (pRt)) \ + { \ + if ((IS_GATEWAY_ROUTE_SET (pRt))) \ + { \ + if (!IS_CACHE_ENTRY_COMPLETE_AND_VALID ((pNewRt = \ + GET_CACHE_ENTRY_GATE_ROUTE (pRt)))) \ + pNewRt = NULL; \ + } \ + else \ + pNewRt = pRt; \ + } \ + else \ + pNewRt = NULL; \ + } + + + +/* typedef */ + +/* Prototype for the user defined function that ptCacheWalk invokes */ + +typedef int (* PT_CACHE_WALK_FUNC_ID) (void *, void *); + + +/* function declarations */ + +IMPORT void * ptCacheInit (unsigned char * pMemPtr, int numRoutes, int proto); +IMPORT STATUS ptCacheDestroy (void *pCookie); +IMPORT CACHE_ENTRY_ID ptCacheEntryAdd (void * pCookie, + struct sockaddr * pDstIpAddr, + struct sockaddr * pNetMask, + struct sockaddr * pGateIpAddr); +IMPORT STATUS ptCacheEntryInternalAdd (void * pCookie, + CACHE_ENTRY_ID pCacheEntry, + struct sockaddr * pDstIpAddr, + struct sockaddr * pNetMask); +IMPORT CACHE_ENTRY_ID ptCacheEntryDel (void * pCookie, + struct sockaddr * pDstIpAddr, + struct sockaddr * pDstNetMask, + BOOL free); +IMPORT void ptCacheEntryFree (CACHE_ENTRY_ID pCacheEntry); +IMPORT STATUS ptCacheWalk (void * pCookie, PT_CACHE_WALK_FUNC_ID pUsrFunc, + void * pArg); +IMPORT CACHE_ENTRY_ID ptCacheLookup (void * pCookie, struct sockaddr * pDstIpAddr, + BOOL fromPktSndPath); +IMPORT CACHE_ENTRY_ID ptCacheNmLookup (void * pCookie, + struct sockaddr * pDstIpAddr, + struct sockaddr * pNetmask, + BOOL fromPktSndPath); + +#endif /* __INCfastPathPatTreeh */ diff --git a/h/wrn/coreip/fastPath/fastPathUtil.h b/h/wrn/coreip/fastPath/fastPathUtil.h new file mode 100644 index 0000000..bf63723 --- /dev/null +++ b/h/wrn/coreip/fastPath/fastPathUtil.h @@ -0,0 +1,207 @@ +/* fastPathUtil.h - Definitions for the Fastpath utility routines */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01o,24feb05,spm performance updates and code cleanup (SPR #100995) +01n,18jan05,vvv osdep.h cleanup +01m,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE +01l,20nov03,niq Remove copyright_wrs.h file inclusion +01k,12nov03,rlm Removed includes of and +01j,04nov03,rlm Ran batch header path update for header re-org. +01i,12mar03,niq Turn FF_LOG_ADDR into a function and remove the addr family + arg +01h,06mar03,niq Add another logging category for fastpath monitor +01g,17feb03,deg FF_LOG_ROUTE() changed +01f,25jan03,deg IPADDR_ARE_SAME added +01e,23jan03,deg IPADDR_IS_MULTICAST() added +01d,14jan03,deg macro SIN6() added +01c,09dec02,deg IPADDR1_ARE_SAME(), GET_ADDR_LEN_FROM_AF() added +01b,02dec02,deg FF_ENTRY macros changed to FF_MEM macros +01a,07oct02,deg written +*/ + +/* +DESCRIPTION +This file contains utility definitions for the Fastpath library, the IPv4 & IPv6 +Fast Forwarder and the Fastpath RTM monitor. + +*/ + +#ifndef __INCfastPathUtil +#define __INCfastPathUtil + +/* includes */ + +/* defines */ + +#define SA(p) ((struct sockaddr *)(p)) +#define SIN(p) ((struct sockaddr_in *)(p)) +#define SIN6(p) ((struct sockaddr_in6 *)(p)) +#define SDL(p) ((struct sockaddr_dl *)(p)) + +#define MAYBE_OK (OK + 1) + +/* Determines if two IP addresses are same. Handles NULL arguments */ +#define IPADDR1_ARE_SAME(pAddr1, pAddr2, len) \ + ((pAddr1 == pAddr2) || \ + (pAddr1 != NULL && pAddr2 != NULL && \ + (bcmp ((char *) pAddr1, (char *) pAddr2, len) == 0))) + +/* This macro checks if the given IPv6 addrs are equal. Doesn't check scope */ +#define IP6_ARE_ADDR_SAME(d, a) ( \ + ((d).s6_addr32[0] == (a).s6_addr32[0]) && \ + ((d).s6_addr32[1] == (a).s6_addr32[1]) && \ + ((d).s6_addr32[2] == (a).s6_addr32[2]) && \ + ((d).s6_addr32[3] == (a).s6_addr32[3])) + +/* + * Given two sockaddr strutures this macro checks if their IP addresses match + * Handles NULL arguments + */ +#ifdef INET6 +#define IPADDR_ARE_SAME(pAddr1, pAddr2) \ + ((pAddr1 == pAddr2) || \ + (pAddr1 != NULL && pAddr2 != NULL && \ + ((pAddr1->sa_len == pAddr2->sa_len) && \ + ((pAddr1->sa_family == AF_INET) ? \ + (SOCKADDR_IN(pAddr1) == SOCKADDR_IN(pAddr2)) : \ + IP6_ARE_ADDR_SAME (SA6(pAddr1), SA6(pAddr2)))))) +#else +#define IPADDR_ARE_SAME(pAddr1, pAddr2) \ + ((pAddr1 == pAddr2) || \ + (pAddr1 != NULL && pAddr2 != NULL && \ + ((pAddr1->sa_len == pAddr2->sa_len) && \ + (SOCKADDR_IN(pAddr1) == SOCKADDR_IN(pAddr2))))) +#endif /* INET6 */ + +#ifdef INET6 +#define IPADDR_IS_LOOPBACK(x) (((x)->sa_family == AF_INET) ? \ + SOCKADDR_IN (x) == htonl (INADDR_LOOPBACK) : \ + ((x)->sa_family == AF_INET6) ? \ + IN6_IS_ADDR_LOOPBACK(&(SA6(x))) : \ + (panic ("BAD address family: %d @ %s:%d \n", \ + x, __FILE__, __LINE__), 0)) +#else +#define IPADDR_IS_LOOPBACK(x) (((x)->sa_family == AF_INET) ? \ + SOCKADDR_IN (x) == htonl (INADDR_LOOPBACK) : \ + (panic ("BAD address family: %d @ %s:%d \n", \ + x, __FILE__, __LINE__), 0)) +#endif /* INET6 */ + +#ifdef INET6 +#define IPADDR_IS_MULTICAST(x) (((x)->sa_family == AF_INET) ? \ + IN_MULTICAST (SOCKADDR_IN (x)) : \ + ((x)->sa_family == AF_INET6) ? \ + IN6_IS_ADDR_MULTICAST(&(SA6(x))) : \ + (panic ("BAD address family: %d @ %s:%d \n", \ + x, __FILE__, __LINE__), 0)) +#else +#define IPADDR_IS_MULTICAST(x) (((x)->sa_family == AF_INET) ? \ + IN_MULTICAST (SOCKADDR_IN (x)) : \ + (panic ("BAD address family: %d @ %s:%d \n", \ + x, __FILE__, __LINE__), 0)) +#endif /* INET6 */ + +#define FF_MEM_ALLOC(size) (malloc(size)) +#define FF_MEM_FREE(ref) (free((char *)(ref))) + +/* + * The Log level is a two byte value that is formed by ORing the following 2 + * bytes + * Upper byte (MSB) : Log path (FFL_PKT or FFL_RT) + * Lower byte (LSB) : logging level (FFL_INFO - FFL_PANIC) + */ + +#define FFL_VERBOSE 0x1 /* Log detailed messages */ +#define FFL_INFO 0x2 /* Log informational messages */ +#define FFL_WARN 0x3 /* Log warning messages */ +#define FFL_ERROR 0x4 /* Log error messages */ +#define FFL_NONCRIT 0x5 /* Log non critical messages */ +#define FFL_CRIT 0x8 /* Log critical messages */ +#define FFL_PANIC 0x9 /* Log panic messages */ +#define FFL_MAX_LEVEL 0x10 /* maximum log level */ + +/* Log area */ + +#define FFL_PKT 0x100 /* Log messages in packet forwarding path */ +#define FFL_RT 0x200 /* Log messages in FIB management path */ +#define FFL_MON 0x400 /* Log messages in Fastpath monitor */ + +#ifdef DEBUG + +#define FFL_LVL_MASK 0x000000FF +#define FFL_TYPE_MASK 0x0000FF00 +#define FFL_PRINTF_MASK 0x00FF0000 +#define FFL_SUSPEND_MASK 0xFF000000 + +#define FFL_LVL(x) (x & FFL_LVL_MASK) +#define FFL_TYPE(x) (x & FFL_TYPE_MASK) +#define FFL_PRINTF(x) (x & FFL_PRINTF_MASK) +#define FFL_SUSPEND(x) (x & FFL_SUSPEND_MASK) + + +#define FF_LOG_MSG0(lvl, fmt) \ + ffLogMsg(lvl, fmt, 0, 0, 0, 0, 0, 0) +#define FF_LOG_MSG1(lvl, fmt, a1) \ + ffLogMsg(lvl, fmt, (int)a1, 0, 0, 0, 0, 0) +#define FF_LOG_MSG2(lvl, fmt, a1, a2) \ + ffLogMsg(lvl, fmt, (int)a1, a2, 0, 0, 0, 0) +#define FF_LOG_MSG3(lvl, fmt, a1, a2, a3) \ + ffLogMsg(lvl, fmt, (int)a1, a2, a3, 0, 0, 0) +#define FF_LOG_MSG4(lvl, fmt, a1, a2, a3, a4) \ + ffLogMsg(lvl, fmt, (int)a1, a2, a3, a4, 0, 0) +#define FF_LOG_MSG5(lvl, fmt, a1, a2, a3, a4, a5) \ + ffLogMsg(lvl, fmt, (int)a1, a2, a3, a4, a5, 0) +#define FF_LOG_MSG6(lvl, fmt, a1, a2, a3, a4, a5, a6) \ + ffLogMsg(lvl, fmt, (int)a1, (int)a2, (int)a3, (int)a4, (int)a5, (int)a6) + +/* + * prints out the destination, netmask, gateway + * arguments pDstAddr, pNetmask, pGateway are from type sockaddr * + * pDstAddr should not be NULL + */ + +#define FF_LOG_ADDR ffLogAddr + +#define FF_LOG_ROUTE(lvl, pDstAddr, pRouteDstAddr, pNextHop) \ + do { \ + if (FFL_LVL (lvl) == FFL_CRIT || FFL_LVL (lvl) == FFL_PANIC || \ + FFL_LVL (lvl) == FFL_MAX_LEVEL || \ + ((FFL_TYPE (lvl) & FFL_TYPE (ffLibLogLevel)) && \ + (FFL_LVL (lvl) >= FFL_LVL (ffLibLogLevel)))) \ + { \ + ffLogRoute(pDstAddr, pRouteDstAddr, pNextHop); \ + } \ + } while (0) +#else + +#define FF_LOG_MSG0(lvl, fmt) +#define FF_LOG_MSG1(lvl, fmt, a1) +#define FF_LOG_MSG2(lvl, fmt, a1, a2) +#define FF_LOG_MSG3(lvl, fmt, a1, a2, a3) +#define FF_LOG_MSG4(lvl, fmt, a1, a2, a3, a4) +#define FF_LOG_MSG5(lvl, fmt, a1, a2, a3, a4, a5) +#define FF_LOG_MSG6(lvl, fmt, a1, a2, a3, a4, a5, a6) +#define FF_LOG_ADDR(lvl, pDstAddr, pGateway, pNetmask) +#define FF_LOG_ROUTE(lvl, pDstAddr, pRouteDstAddr, pNextHop) + +#endif /* DEBUG */ + +/* function declarations */ + +#ifdef DEBUG + +IMPORT VOID ffLogMsg (ULONG lvl, unsigned char *fmt, int a1, int a2, int a3, + int a4, int a5, int a6); +IMPORT VOID ffLogAddr (ULONG lvl, struct sockaddr *pDstAddr, + struct sockaddr *pNetmask, + struct sockaddr *pGateway); +IMPORT VOID ffLogRoute (struct sockaddr *pDstAddr, struct sockaddr *pRouteDstAddr, + struct sockaddr *pNextHop); + +#endif /* DEBUG */ + +#endif /* __INCfastPathUtil */ diff --git a/h/wrn/coreip/filio.h b/h/wrn/coreip/filio.h new file mode 100644 index 0000000..574b891 --- /dev/null +++ b/h/wrn/coreip/filio.h @@ -0,0 +1,90 @@ +/* filio.h - file-related ioctl definitions */ + +/* Copyright 2001-2003 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1982, 1986, 1990, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)filio.h 8.1 (Berkeley) 3/28/94 + * $FreeBSD: src/sys/sys/filio.h,v 1.7 1999/12/07 22:25:28 sos Exp $ + */ + +/* +modification history +-------------------- +01e,20nov03,niq Remove copyright_wrs.h file inclusion +01d,04nov03,rlm Ran batch header path update for header re-org. +01c,29apr03,syy Added #ifdef for __cplusplus +01b,17sep01,ann uncommenting the inclusion of ioccom.h +01a,15aug01,ann ported to clarinet from freeBSD 4.3 ver 1.7 + */ + +#ifndef _SYS_FILIO_H_ +#define _SYS_FILIO_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + + +#if 0 +/* Generic file-descriptor ioctl's. */ +#define FIOCLEX _IO('f', 1) /* set close on exec on fd */ +#define FIONCLEX _IO('f', 2) /* remove close on exec */ +#define FIONREAD _IOR('f', 127, int) /* get # bytes to read */ +#define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */ + +#endif /* #if 0 */ + +#define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */ + +#if 0 + +#define FIOSETOWN _IOW('f', 124, int) /* set owner */ +#define FIOGETOWN _IOR('f', 123, int) /* get owner */ +#define FIODTYPE _IOR('f', 122, int) /* get d_flags type part */ +#define FIOGETLBA _IOR('f', 121, int) /* get start blk # */ + +#endif /* #if 0 */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_SYS_FILIO_H_ */ diff --git a/h/wrn/coreip/ftp6Lib.h b/h/wrn/coreip/ftp6Lib.h new file mode 100644 index 0000000..78379b3 --- /dev/null +++ b/h/wrn/coreip/ftp6Lib.h @@ -0,0 +1,177 @@ +/* ftp6Lib.h -File Transfer Protocol Client library header */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +01k,20jun05,vvv added hostLib.h (SPR #110024) +01j,31jul04,kc Modified FTP6_CLIENT_DATA structure to use char array for + hostname. +01i,20nov03,niq Remove copyright_wrs.h file inclusion +01h,05nov03,cdw Removal of unnecessary _KERNEL guards. +01g,04nov03,rlm Ran batch header path update for header re-org. +01f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01e,06jun02,ant added ftp6LibInit () +01d,14feb02,ant added routines ftp6UserPassSet, ftp6UserPassPrint +01c,01feb02,ant FTP6_PASSIVEMODE changed to FTP6_PASSIVEOFF. Passive + mode is default. +01b,15jan02,ant sockunion moved to apps/common/sockunion.h +01a,14sep01,ant written + +*/ + +#ifndef __INCftp6Libh +#define __INCftp6Libh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include +#include +#include + +#ifdef _WRS_KERNEL +#include +#else +#include +#endif + +/* defines */ + +#define FTP6_AFAMILY4 0x1 +#define FTP6_AFAMILY6 0x2 +#define FTP6_PASSIVEOFF 0x4 +#define FTP6_RESTRICTEDDATAP 0x8 +#define FTP6_TRYEPSV 0x10 + +#ifndef __INCftpLibh + +/* For FTP specification see RFC-765 */ + +/* Reply codes. */ + +#define FTP_PRELIM 1 /* positive preliminary */ +#define FTP_COMPLETE 2 /* positive completion */ +#define FTP_CONTINUE 3 /* positive intermediate */ +#define FTP_TRANSIENT 4 /* transient negative completion */ +#define FTP_ERROR 5 /* permanent negative completion */ + +#define FTP_NOACTION 550 /* requested action not taken */ + +/* Type codes */ + +#define TYPE_A 1 /* ASCII */ +#define TYPE_E 2 /* EBCDIC */ +#define TYPE_I 3 /* image */ +#define TYPE_L 4 /* local byte size */ + +/* Form codes */ + +#define FORM_N 1 /* non-print */ +#define FORM_T 2 /* telnet format effectors */ +#define FORM_C 3 /* carriage control (ASA) */ + +/* Structure codes */ + +#define STRU_F 1 /* file (no record structure) */ +#define STRU_R 2 /* record structure */ +#define STRU_P 3 /* page structure */ + +/* Mode types */ + +#define MODE_S 1 /* stream */ +#define MODE_B 2 /* block */ +#define MODE_C 3 /* compressed */ + +/* Record Tokens */ + +#define REC_ESC '\377' /* Record-mode Escape */ +#define REC_EOR '\001' /* Record-mode End-of-Record */ +#define REC_EOF '\002' /* Record-mode End-of-File */ + +/* Block Header */ + +#define BLK_EOR 0x80 /* Block is End-of-Record */ +#define BLK_EOF 0x40 /* Block is End-of-File */ +#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */ +#define BLK_RESTART 0x10 /* Block is Restart Marker */ + +#define BLK_BYTECOUNT 2 /* Bytes in this block */ + +#endif /* __INCftpLibh */ + +/*typedef struct sockaddr_in SOCKADDR_IN;*/ + +/* typedefs */ + +typedef struct + { + union sockunion myctladdr; /* Client address */ + union sockunion hisctladdr; /* peer address */ + union sockunion data_addr; /* data connection address*/ + ulong_t options; + char hostname[MAXHOSTNAMELEN]; /* remote host name */ + int code; /* code of reply */ + char pasv[BUFSIZ]; /* reply string of PASV command*/ + char reply_string[BUFSIZ]; /* first line of previous reply */ + } FTP6_CLIENT_DATA; + +/* externals */ + +extern BOOL ftpErrorSupress; /* TRUE = don't print error messages */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS ftp6Login (int ctrlSock, FTP6_CLIENT_DATA *pData, char *user, char *passwd, + char *account); +extern STATUS ftp6Xfer (char *host, char *user, char *passwd, char *acct, + char *cmd, char *dirname, char *filename, + int *pCtrlSock, int *pDataSock, FTP6_CLIENT_DATA **pData, ulong_t options); +extern int ftp6Command (int ctrlSock, FTP6_CLIENT_DATA *pData, const char *fmt, ...); +extern int ftp6DataConnGet (int dataSock, FTP6_CLIENT_DATA *pData); +extern int ftp6DataConnInit (int, FTP6_CLIENT_DATA *pData); +extern int ftp6Hookup (char *host, FTP6_CLIENT_DATA *pData); +extern int ftp6ReplyGet (int ctrlSock, FTP6_CLIENT_DATA *pData, BOOL expecteof); + +extern STATUS ftp6Ls (char *dirName, ulong_t options); +extern STATUS ftp6FileGet (char *remDirName, char *locDirName, ulong_t options); +extern time_t ftp6RemoteModTime (int ctrlSock, FTP6_CLIENT_DATA *pData, const char *file); +extern STATUS ftp6FileSend (char *locDirName, char *remDirName, ulong_t options); +extern STATUS ftp6LibInit (long timeout); + +#else /* __STDC__ */ + +extern STATUS ftp6Login (); +extern STATUS ftp6Xfer (); +extern int ftp6Command (); +extern int ftp6DataConnGet (); +extern int ftp6DataConnInit (); +extern int ftp6Hookup (); +extern int ftp6ReplyGet (); +extern STATUS ftp6Ls (); +extern STATUS ftp6FileGet (); +extern time_t ftp6RemoteModTime (); +extern STATUS ftp6FileSend (); +extern STATUS ftp6LibInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCftp6Libh */ diff --git a/h/wrn/coreip/ftpLib.h b/h/wrn/coreip/ftpLib.h new file mode 100644 index 0000000..3ff460f --- /dev/null +++ b/h/wrn/coreip/ftpLib.h @@ -0,0 +1,202 @@ +/* ftpLib.h - arpa File Transfer Protocol library header */ + +/* Copyright 1986 - 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01t,20nov03,niq Remove copyright_wrs.h file inclusion +01s,05nov03,cdw Removal of unnecessary _KERNEL guards. +01r,04nov03,rlm Ran batch header path update for header re-org. +01q,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01p,10jun03,vvv include netVersion.h +01o,09may03,vvv included vxWorks.h and vwModNum.h +01n,06jun02,elr Change return for ftpTransientFatalInstall() +01m,23may02,elr added temporary global flag to bypass PASSIVE mode +01l,22may02,elr Changed API of ftpCommandEnhanced() and ftpReplyGetEnhanced() + for PASSIVE mode support + Added function ftpDataConnInitPassiveMode () + Added ftpLibDebugOptionsSet() +01k,12mar02,elr Added error return codes + Replaced ftpErrorSuppress with ftplDebug (SPR 71496) +01j,22sep92,rrr added support for c++ +01i,11sep92,jmm added external definition for ftpErrorSupress (for spr #1257) +01h,04jul92,jcf cleaned up. +01g,26may92,rrr the tree shuffle +01f,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01e,19oct90,shl changed ftpCommand() to use variable length argument list. +01d,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01c,07aug90,shl added INCftpLibh to #endif. +01b,20mar87,dnw prepended FTP_ to reply codes. +01a,07nov86,dnw written +*/ + +#ifndef __INCftpLibh +#define __INCftpLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +/* For debugging options */ + +#define FTPL_DEBUG_OFF 0 /* No debugging messages */ +#define FTPL_DEBUG_INCOMING 1 /* Show all incoming responses */ +#define FTPL_DEBUG_OUTGOING 2 /* Show all outgoing commands */ +#define FTPL_DEBUG_ERRORS 4 /* Display all errors and warnings that occur */ + +/* For FTP specification see RFC-765 */ + +/* Reply codes for ftpReplyGet(). (Major numbers 1xx-5xx) */ + +#define FTP_PRELIM 1 /* positive preliminary */ +#define FTP_COMPLETE 2 /* positive completion */ +#define FTP_CONTINUE 3 /* positive intermediate */ +#define FTP_TRANSIENT 4 /* transient negative completion */ +#define FTP_ERROR 5 /* permanent negative completion */ + +/* Detailed reply codes for ftpReplyGetEnhanced() */ + +#define FTP_PASSIVE_REPLY 227 /* Command not supported */ +#define FTP_COMMAND_NOT_SUPPORTED 502 /* Command not supported */ +#define FTP_NOACTION 550 /* requested action not taken */ + +/* Type codes */ + +#define TYPE_A 1 /* ASCII */ +#define TYPE_E 2 /* EBCDIC */ +#define TYPE_I 3 /* image */ +#define TYPE_L 4 /* local byte size */ + +/* Form codes */ + +#define FORM_N 1 /* non-print */ +#define FORM_T 2 /* telnet format effectors */ +#define FORM_C 3 /* carriage control (ASA) */ + +/* Structure codes */ + +#define STRU_F 1 /* file (no record structure) */ +#define STRU_R 2 /* record structure */ +#define STRU_P 3 /* page structure */ + +/* Mode types */ + +#define MODE_S 1 /* stream */ +#define MODE_B 2 /* block */ +#define MODE_C 3 /* compressed */ + +/* Record Tokens */ + +#define REC_ESC '\377' /* Record-mode Escape */ +#define REC_EOR '\001' /* Record-mode End-of-Record */ +#define REC_EOF '\002' /* Record-mode End-of-File */ + +/* Block Header */ + +#define BLK_EOR 0x80 /* Block is End-of-Record */ +#define BLK_EOF 0x40 /* Block is End-of-File */ +#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */ +#define BLK_RESTART 0x10 /* Block is Restart Marker */ + +#define BLK_BYTECOUNT 2 /* Bytes in this block */ + +/* error values */ + +/* + * Note that for unexpected responses, the low-order byte of the eror code + * contains the reponse code. + */ +#define S_ftpLib_ILLEGAL_VALUE (M_ftpLib | 1) +#define S_ftpLib_TRANSIENT_RETRY_LIMIT_EXCEEDED (M_ftpLib | 2) +#define S_ftpLib_FATAL_TRANSIENT_RESPONSE (M_ftpLib | 3) + +#define S_ftpLib_REMOTE_SERVER_STATUS_221 (M_ftpLib | 221) +#define S_ftpLib_REMOTE_SERVER_STATUS_226 (M_ftpLib | 226) +#define S_ftpLib_REMOTE_SERVER_STATUS_257 (M_ftpLib | 257) +#define S_ftpLib_REMOTE_SERVER_ERROR_422 (M_ftpLib | 422) +#define S_ftpLib_REMOTE_SERVER_ERROR_425 (M_ftpLib | 425) +#define S_ftpLib_REMOTE_SERVER_ERROR_450 (M_ftpLib | 450) +#define S_ftpLib_REMOTE_SERVER_ERROR_451 (M_ftpLib | 451) +#define S_ftpLib_REMOTE_SERVER_ERROR_452 (M_ftpLib | 452) +#define S_ftpLib_REMOTE_SERVER_ERROR_500 (M_ftpLib | 500) +#define S_ftpLib_REMOTE_SERVER_ERROR_501 (M_ftpLib | 501) +#define S_ftpLib_REMOTE_SERVER_ERROR_502 (M_ftpLib | 502) +#define S_ftpLib_REMOTE_SERVER_ERROR_503 (M_ftpLib | 503) +#define S_ftpLib_REMOTE_SERVER_ERROR_504 (M_ftpLib | 504) +#define S_ftpLib_REMOTE_SERVER_ERROR_520 (M_ftpLib | 520) +#define S_ftpLib_REMOTE_SERVER_ERROR_521 (M_ftpLib | 521) +#define S_ftpLib_REMOTE_SERVER_ERROR_530 (M_ftpLib | 530) +#define S_ftpLib_REMOTE_SERVER_ERROR_550 (M_ftpLib | 550) +#define S_ftpLib_REMOTE_SERVER_ERROR_551 (M_ftpLib | 551) +#define S_ftpLib_REMOTE_SERVER_ERROR_552 (M_ftpLib | 552) +#define S_ftpLib_REMOTE_SERVER_ERROR_553 (M_ftpLib | 553) +#define S_ftpLib_REMOTE_SERVER_ERROR_554 (M_ftpLib | 554) + +/* externals */ + +extern BOOL ftplDebug; /* print error message, defined in funcBind.c */ + +/* disable passive mode - XXX this will be removed in the next release XXX */ + +extern BOOL ftplPasvModeDisable; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS ftpLogin (int ctrlSock, char *user, char *passwd, char *account); +extern STATUS ftpXfer (char *host, char *user, char *passwd, char *acct, + char *cmd, char *dirname, char *filename, + int *pCtrlSock, int *pDataSock); +extern int ftpCommand (int ctrlSock, char *fmt, int arg1, int arg2, + int arg3, int arg4, int arg5, int arg6); +extern int ftpCommandEnhanced (int ctrlSock, char *fmt, int arg1, int arg2, + int arg3, int arg4, int arg5, int arg6, + char *replyString, + int replyStringLength); +extern int ftpDataConnGet (int dataSock); +extern int ftpDataConnInit (int ctrlSock); +extern int ftpDataConnInitPassiveMode (int ctrlSock); +extern int ftpHookup (char *host); +extern void ftpLibDebugOptionsSet (UINT32 options); +extern int ftpReplyGet (int ctrlSock, BOOL expecteof); +extern int ftpReplyGetEnhanced (int ctrlSock, BOOL expecteof, char *replyString, + int replyStringLength); +extern STATUS ftpTransientConfigSet (UINT32 maxRetryCount, UINT32 retryInterval); +extern STATUS ftpTransientConfigGet (UINT32 *maxRetryCount, UINT32 *retryInterval); +extern STATUS ftpTransientFatalInstall (FUNCPTR configlette); +#else /* __STDC__ */ + +extern STATUS ftpLogin (); +extern STATUS ftpXfer (); +extern int ftpCommand (); +extern int ftpCommandEnhanced (); +extern int ftpDataConnGet (); +extern int ftpDataConnInit (); +extern int ftpDataConnInitPassiveMode (); +extern int ftpHookup (); +extern void ftpLibDebugOptionsSet (); +extern int ftpReplyGet (); +extern int ftpReplyGetEnhanced (); +extern STATUS ftpPrelimConfigSet (); +extern STATUS ftpTransientConfigSet (); +extern STATUS ftpLogin (); +extern STATUS ftpXfer (); +extern STATUS ftpTransientFatalInstall (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCftpLibh */ diff --git a/h/wrn/coreip/ftpd6Lib.h b/h/wrn/coreip/ftpd6Lib.h new file mode 100644 index 0000000..ce2ee56 --- /dev/null +++ b/h/wrn/coreip/ftpd6Lib.h @@ -0,0 +1,60 @@ +/* ftpd6Lib.h - header file for ftpd6Lib.c */ + +/* Copyright 2001 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,15dec04,syy Fixed SPR#104035: add support for guest login +01i,20aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01h,12apr04,spm removed virtual stack #include (already in source code) +01g,15mar04,rp merged from orion +01f,20nov03,niq Remove copyright_wrs.h file inclusion +01e,05nov03,cdw Removal of unnecessary _KERNEL guards. +01d,04nov03,rlm Ran batch header path update for header re-org. +01c,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01b,10jun03,vvv include netVersion.h +01a,14sep01,ant written +*/ + +#ifndef __INCftpd6Libh +#define __INCftpd6Libh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +#ifdef VIRTUAL_STACK +extern STATUS ftpd6InstInit (void *noparams); +extern STATUS ftpd6Destructor (VSNUM vsnum); +#endif /*VIRTUAL_STACK*/ +extern STATUS ftpd6Init (char *, FUNCPTR, int stackSize); +extern STATUS ftpd6Delete (void); +extern void ftpd6EnableSecurity(void); +extern void ftpd6DisableSecurity(void); +extern STATUS ftpd6GuestIdSet (const char *, u_int); +extern STATUS ftpd6GuestAllow (const char *, const char *, BOOL); + +#else /* __STDC__ */ + +#ifdef VIRTUAL_STACK +extern STATUS ftpd6InstInit (); +extern STATUS ftpd6Destructor (); +#endif /*VIRTUAL_STACK*/ +extern STATUS ftpd6Init (); +extern void ftpd6Delete (); +extern void ftpd6EnableSecurity(); +extern void ftpd6DisableSecurity(); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCftpd6Libh */ diff --git a/h/wrn/coreip/ftpdLib.h b/h/wrn/coreip/ftpdLib.h new file mode 100644 index 0000000..9655162 --- /dev/null +++ b/h/wrn/coreip/ftpdLib.h @@ -0,0 +1,70 @@ +/* ftpdLib.h - header file for ftpdLib.c */ + +/* Copyright 1990-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01r,14feb05,dlk Restore this file, but deprecate the routines it defines. + Remove ftpdLingerSecondsSet() entirely. +01q,20aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01p,21jul04,spm removed extra initialization routine +01o,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01n,15mar04,rp merged from orion +01m,20nov03,niq Remove copyright_wrs.h file inclusion +01l,05nov03,cdw Removal of unnecessary _KERNEL guards. +01k,04nov03,rlm Ran batch header path update for header re-org. +01j,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01i,10jun03,vvv include netVersion.h +01h,22feb99,spm recovered version replaced by merge from vxw5_3_x branch; + removed duplicate history entry 01g describing existing change +01g,10dec97,spm changed prototype for ftpdInit to support configurable + password authentication (SPR #8602); removed unused + prototype for ftpdTask routine +01f,22sep92,rrr added support for c++ +01e,04jul92,jcf cleaned up. +01d,26may92,rrr the tree shuffle +01c,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01b,05oct90,dnw deleted ftpdWorkTask(). +01a,05oct90,shl created. +*/ + +#ifdef VIRTUAL_STACK +#include +#endif /*VIRTUAL_STACK*/ + +#ifndef __INCftpdLibh +#define __INCftpdLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) +IMPORT STATUS ftpdInit (FUNCPTR, int stackSize) \ + _WRS_DEPRECATED ("please use ftpd6Init instead."); +IMPORT STATUS ftpdDelete (void) \ + _WRS_DEPRECATED ("please use ftpd6Delete instead."); +IMPORT STATUS ftpdAnonymousAllow (const char * rootDir, + const char * uploadDir) \ + _WRS_DEPRECATED ("please use ftpd6GuestAllow instead."); +IMPORT void ftpdEnableSecurity (void) \ + _WRS_DEPRECATED ("please use ftpd6EnableSecurity instead."); +IMPORT void ftpdDisableSecurity (void) \ + _WRS_DEPRECATED ("please use ftpd6DisableSecurity instead."); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCftpdLibh */ diff --git a/h/wrn/coreip/hostLib.h b/h/wrn/coreip/hostLib.h new file mode 100644 index 0000000..6e7750c --- /dev/null +++ b/h/wrn/coreip/hostLib.h @@ -0,0 +1,251 @@ +/* hostLib.h - public header for hostLib files */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +02a,28jun05,vvv updated gethostbynameInit() prototype +01z,07feb05,vvv _KERNEL cleanup +01y,14jan05,vvv osdep.h cleanup +01x,22sep04,dlk Added declaration for hostTblSetup(). +01w,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01v,07dec03,vvv moved definition of struct hostArgs from hostLib.c; moved + definition of getnameinfoArgs from getnameinfo.c +01u,24nov03,vvv updated for RTP support +01t,20nov03,niq Remove copyright_wrs.h file inclusion +01s,05nov03,cdw Removal of unnecessary _KERNEL guards. +01r,04nov03,rlm Ran batch header path update for header re-org. +01q,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01p,23oct03,rlm updated #includes for header re-org +01o,06aug03,nee Accordion Base6 merge from ACCORDION_BASE6_MERGE_BASELINE + label +01n,09may03,vvv included vwModNum.h and in6.h +01m,20feb03,ann added prototypes for gethostbyaddrInit and gethostbynameInit +01l,06sep01,hgo modifications and extensions for IPv6 +01k,20aug97,jag added function declations for hostTblSearchByAddr(), + hostTblSearchByName() (SPR #9175) +01j,19may97,spm added S_hostLib_INVALID_PARAMETER error value +01i,22sep92,rrr added support for c++ +01h,27jul92,elh Moved hostShow to netShow. +01g,04jul92,jcf cleaned up. +01f,26may92,rrr the tree shuffle +01e,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01d,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01c,13apr89,shl added MAXHOSTNAMELEN. +01b,04jun88,gae changed S_remLib_* to S_hostLib_*. +01a,28may88,dnw extracted from remLib.h +*/ + +#ifndef __INChostLibh +#define __INChostLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include + +#ifdef INET6 +#include +#endif /* INET6 */ + + +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 64 /* XXX already defined in param.h */ +#endif + +/* status messages */ + +#define S_hostLib_UNKNOWN_HOST (M_hostLib | 1) +#define S_hostLib_HOST_ALREADY_ENTERED (M_hostLib | 2) +#define S_hostLib_INVALID_PARAMETER (M_hostLib | 3) +/* former h_errno values */ +#define S_hostLib_NETDB_INTERNAL (M_hostLib | 4) /* see errno */ +/* Authoritative Answer Host not found */ +#define S_hostLib_HOST_NOT_FOUND (M_hostLib | 5) +/* Non-Authoritative Host not found, or SERVERFAIL */ +#define S_hostLib_TRY_AGAIN (M_hostLib | 6) +/* Valid name, no data record of requested type */ +#define S_hostLib_NO_RECOVERY (M_hostLib | 7) + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* Definitions for sysctl nodes under CTL_NET */ + +#define HOSTLIB 3 +#define NAMEINFO 4 + +/* Options for the host library sysctl handler */ + +#define HOSTADD 1 +#define HOSTDELETE 2 +#define HOSTADDRSEARCH 3 +#define HOSTNAMESEARCH 4 +#define HOSTNAMESEARCH2 5 + +/* + * Structure shared by hostAdd, hostDelete and hostTblSearchByName2 + * for passing arguments to sysctl. + */ + +struct hostArgs + { + char * hostName; + int hostNameLen; + char * hostAddr; + int hostAddrLen; + const struct addrinfo * pHints; + }; + +/* + * This structure is used to pass the getnameinfo arguments from user-space + * to the kernel using sysctl. + */ + +struct nameinfoArgs + { + const struct sockaddr * sa; + socklen_t salen; + char * host; + size_t hostlen; + char * serv; + size_t servlen; + int flags; + }; + +#ifdef _WRS_KERNEL +/* typdef's for hosttable access */ + +typedef struct hostname_struct + { + struct hostname_struct *link; + char *name; + } HOSTNAME; + +typedef struct addr4_struct + { + struct in_addr addr; + } ADDR4; + +#ifdef INET6 +typedef struct addr6_struct + { + struct in6_addr addr; + uint32_t scopeId; + } ADDR6; +#endif + +typedef union addr_union + { + ADDR4 addr4; +#ifdef INET6 + ADDR6 addr6; +#endif + } ADDRU; + +typedef struct + { + NODE node; + HOSTNAME hostName; + int family; /* AF_INET or AF_INET6 */ + ADDRU netAddr; /* ADDR4 or ADDR6 */ + } HOSTENTRY; +#endif /* _WRS_KERNEL */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS hostAdd (char *hostName, char *hostAddr); +extern STATUS hostDelete (char *name, char *addr); +extern STATUS hostGetByAddr (int addr, char *name); +extern int hostGetByName (char *name); +extern int getnameinfo (const struct sockaddr *sa, socklen_t salen, char *host, + size_t hostlen, char *serv, size_t servlen, int flags); +extern struct hostent * hostentAlloc (void); +extern void hostentFree (struct hostent *); +extern struct hostent * gethostbyaddr (const char *addr, int len, int type); +extern struct hostent * gethostbyname (const char *name); +extern struct servent *getservbyname (const char *name, const char *proto); +extern struct servent *getservbyport (int port, const char *proto); +extern int getaddrinfo (const char *hostname, const char *servname, + const struct addrinfo *hints, struct addrinfo **result); +extern void freeaddrinfo (struct addrinfo *ai); +extern void freehostent (struct hostent *); +extern int gethostname (char *name, int nameLen); +extern int sethostname (char *name, int nameLen); +extern char *gai_strerror (int ecode); +extern struct hostent *_dns_ghbyaddr(const void *addr, int addrlen, int af, int *errp); + +#ifdef _WRS_KERNEL +extern STATUS hostTblInit (void); +extern STATUS hostTblSetup (char * pRemoteName, char * pRemoteAddr, + char * pLocalName, char * pLocalAddr); +extern int hostTblSearchByName (char *name); +extern STATUS hostTblSearchByAddr (int addr, char *name); +extern STATUS gethostbyaddrInit (void); +extern STATUS gethostbynameInit (BOOL); +#endif /* _WRS_KERNEL */ + +#else /* __STDC__ */ + +extern STATUS hostAdd (); +extern STATUS hostDelete (); +extern STATUS hostGetByAddr (); +extern int hostGetByName (); +extern int getnameinfo (); +extern struct hostent * hostentAlloc (); +extern void hostentFree (); +extern struct hostent * gethostbyaddr (); +extern struct hostent * gethostbyname (); +extern struct servent *getservbyname (); +extern struct servent *getservbyport (); +extern int getaddrinfo (); +extern void freeaddrinfo (); +extern void freehostent (); +extern int gethostname (); +extern int sethostname (); +extern char *gai_strerror (); +extern struct hostent *_dns_ghbyaddr(); + +#ifdef _WRS_KERNEL +extern STATUS hostTblInit (); +extern STATUS hostTblSetup (); +extern int hostTblSearchByName (); +extern STATUS hostTblSearchByAddr (); +extern STATUS gethostbyaddrInit (); +extern STATUS gethostbynameInit (); +#endif /* _WRS_KERNEL */ + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INChostLibh */ diff --git a/h/wrn/coreip/icmpLib.h b/h/wrn/coreip/icmpLib.h new file mode 100644 index 0000000..91c4fba --- /dev/null +++ b/h/wrn/coreip/icmpLib.h @@ -0,0 +1,80 @@ +/* icmpLib.h -- VxWorks ICMP Library header file */ + +/* Copyright 1990-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,18feb05,wap Allow sysctl init routines to be scaled out +01i,07feb05,vvv _KERNEL cleanup +01h,05nov03,cdw Removal of unnecessary _KERNEL guards. +01g,04nov03,rlm Ran batch header path update for header re-org. +01f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01e,15sep03,vvv updated path for new headers +01d,07aug03,vvv merged from ACCORDION_BASE6_MERGE_BASELINE +01c,09may03,vvv included if.h and ip.h +01b,12feb02,pas merged from automerge.vobadmin.tor3_x.ipv6.nashua +01a,14dec01,ppp ported from A.E. 1.1. +*/ + +#ifndef __INCicmpLibh +#define __INCicmpLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include +#include +#include +#include + +/* errors */ + +#define S_icmpLib_TIMEOUT (M_icmpLib | 1) +#define S_icmpLib_NO_BROADCAST (M_icmpLib | 2) +#define S_icmpLib_INVALID_INTERFACE (M_icmpLib | 3) +#define S_icmpLib_INVALID_ARGUMENT (M_icmpLib | 4) + +/* typedefs */ + +typedef struct icmp_config_params + { + CFG_DATA_HDR cfgh; + int cfg_priv_icmpmaskrepl; + int cfg_priv_drop_redirect; + int cfg_priv_log_redirect; + int cfg_priv_icmplim; + int cfg_priv_icmpbmcastecho; + int cfg_icmpErrorLen; + FUNCPTR cfg_privInitSysctl; + } ICMP_CONFIG_PARAMS; + +/* function prototypes */ + +#if defined(__STDC__) || defined(__cplusplus) + +STATUS icmpMaskGet (char *ifName, char *src, char *dst, int *pSubnet); +void ipHeaderCreate (int proto, struct in_addr *pSrcAddr, + struct in_addr *pDstAddr, struct ip *pih, + int length); +u_char * ipHeaderVerify (struct ip *pih, int length, int proto); +STATUS etherSend (struct ifnet *pIf, struct ip *pDatagram, int length); + + +#else /* __STDC__ */ + +STATUS icmpMaskGet (); +void ipHeaderCreate (); +u_char * ipHeaderVerify (); +STATUS etherSend (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCicmpLibh */ diff --git a/h/wrn/coreip/if6Lib.h b/h/wrn/coreip/if6Lib.h new file mode 100644 index 0000000..2e7a972 --- /dev/null +++ b/h/wrn/coreip/if6Lib.h @@ -0,0 +1,73 @@ +/* if6Lib.h - IPv6 interface address library header */ + +/* Copyright 2003 - 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,07feb05,vvv _KERNEL cleanup +01g,19jan05,vvv removed include of clarinet.h +01f,04nov03,rlm Ran batch header path update for header re-org. +01e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01d,10jun03,vvv include netVersion.h +01c,09may03,vvv included clarinet.h +01b,06may03,ijm changed if6AddrDel to if6AddrDelete +01a,01mar03,pas wrote +*/ + +#ifndef __INCif6Libh +#define __INCif6Libh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) +extern void if6LibInit(void); +extern STATUS if6AddrGet(char *interfaceName, char *interfaceAddress); +extern STATUS if6AddrAdd(char *interfaceName, char *interfaceAddress, + int prefixLen, int flags); +extern STATUS if6AddrDelete(char *interfaceName, char *interfaceAddress); +extern STATUS if6DstAddrGet(char *interfaceName, char *interfaceAddress, + char *dstAddress); +extern STATUS if6DstAddrSet(char *interfaceName, char *interfaceAddress, + char *dstAddress); +extern STATUS if6PrefixlenGet(char *interfaceName, char *interfaceAddress, + int *prefixLen); +extern STATUS if6PrefixlenSet(char *interfaceName, char *interfaceAddress, + int prefixLen); +extern STATUS if6FlagGet(char *interfaceName, char *interfaceAddress, + int *flags); +extern STATUS if6FlagSet(char *interfaceName, char *interfaceAddress, + int flags); +extern STATUS if6FlagChange(char *interfaceName, char *interfaceAddress, + int flags, BOOL on); +extern STATUS if6LifetimeGet(char *interfaceName, char *interfaceAddress, + u_int32_t *vltime, u_int32_t *pltime); +extern STATUS if6LifetimeSet(char *interfaceName, char *interfaceAddress, + u_int32_t vltime, u_int32_t pltime); +#else /* __STDC__ */ +extern void if6LibInit(); +extern STATUS if6AddrGet(); +extern STATUS if6AddrAdd(); +extern STATUS if6AddrDelete(); +extern STATUS if6DstAddrGet(); +extern STATUS if6DstAddrSet(); +extern STATUS if6PrefixlenGet(); +extern STATUS if6PrefixlenSet(); +extern STATUS if6FlagGet(); +extern STATUS if6FlagSet(); +extern STATUS if6FlagChange(); +extern STATUS if6LifetimeGet(); +extern STATUS if6LifetimeSet(); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif6Libh */ diff --git a/h/wrn/coreip/ifIndexLib.h b/h/wrn/coreip/ifIndexLib.h new file mode 100644 index 0000000..15a2090 --- /dev/null +++ b/h/wrn/coreip/ifIndexLib.h @@ -0,0 +1,37 @@ +/* ifIndexLib.h - interface index library header */ + +/* Copyright 2000 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,19apr04,rae update API, ifIndex is now UINT32 +01a,29mar01,spm file creation: copied from version 01c of tor2_0.open_stack + branch (wpwr VOB) for unified code base +*/ + +#ifndef __INCifIndexLibh +#define __INCifIndexLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "wrn/netVersion.h" +/* function declarations */ + +extern void ifIndexLibInit(void); +extern void ifIndexLibShutdown(void); +extern UINT32 ifIndexAlloc(void); +extern BOOL ifIndexTest(UINT32 ifIndex); +extern STATUS ifIndexLibInit2 (FUNCPTR, FUNCPTR, FUNCPTR, void *, + FUNCPTR, FUNCPTR, void *); +extern struct ifnet * ifIndexLookup (UINT32); +extern UINT32 ifIndexAlloc2 (struct ifnet *); +extern STATUS ifIndexFree (UINT32); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCifIndexLibh */ diff --git a/h/wrn/coreip/ifLib.h b/h/wrn/coreip/ifLib.h new file mode 100644 index 0000000..f4eff2f --- /dev/null +++ b/h/wrn/coreip/ifLib.h @@ -0,0 +1,61 @@ +/* ifLib.h - network interface library header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,14dec03,ijm merged SPR#85896, interface based proxy ARP services; + removed obsolete prototypes +01i,05nov03,cdw Removal of unnecessary _KERNEL guards. +01h,04nov03,rlm Ran batch header path update for header re-org. +01g,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01f,08sep03,vvv merged from ACCORDION_BASE6_MERGE_BASELINE +01e,10jun03,vvv include netVersion.h +01d,06may03,ijm added ifAddrDelete +01c,01feb03,pas fixed ifunit() to agree with dlink/if_var.h (from FreeBSD 4.7) +01b,06mar02,ham added ifLibInit. +01a,02feb02,ppp ported from A.E. 1.1. +*/ + +#ifndef __INCifLibh +#define __INCifLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* function declarations */ + +extern void ifLibInit (void); +extern STATUS ifAddrAdd (char *interfaceName, char *interfaceAddress, + char *broadcastAddress, int subnetMask); +extern STATUS ifAddrDelete (char *interfaceName, char *interfaceAddress); +extern STATUS ifAddrSet (char *interfaceName, char *interfaceAddress); +extern STATUS ifAddrGet (char *interfaceName, char *interfaceAddress); +extern STATUS ifBroadcastSet (char *interfaceName, char *broadcastAddress); +extern STATUS ifBroadcastGet (char *interfaceName, char *broadcastAddress); +extern STATUS ifDstAddrSet (char *interfaceName, char *dstAddress); +extern STATUS ifDstAddrGet (char *interfaceName, char *dstAddress); +extern STATUS ifMaskSet (char *interfaceName, int netMask); +extern STATUS ifMaskGet (char *interfaceName, int *netMask); +extern STATUS ifFlagChange (char *interfaceName, int flags, BOOL on); +extern STATUS ifFlagSet (char *interfaceName, int flags); +extern STATUS ifFlagGet (char *interfaceName, int *flags); +extern STATUS ifMetricSet (char *interfaceName, int metric); +extern STATUS ifMetricGet (char *interfaceName, int *pMetric); +extern int ifRouteDelete (char *ifName, int unit); +extern struct ifnet *ifunit (const char *ifname); +extern STATUS ifUnnumberedSet (char *, char *, char *, char *); +extern STATUS ifIndexToIfName (unsigned short ifIndex, char * ifname); +extern struct ifnet * ifIndexToIfp (int ifIndex); +extern unsigned short ifNameToIfIndex (char * ifname); +extern STATUS ifProxyArpDisable (int ifIndex); +extern STATUS ifProxyArpEnable (int ifIndex); +#ifdef __cplusplus +} +#endif + +#endif /* __INCifLibh */ diff --git a/h/wrn/coreip/in_cksum.h b/h/wrn/coreip/in_cksum.h new file mode 100644 index 0000000..7a168af --- /dev/null +++ b/h/wrn/coreip/in_cksum.h @@ -0,0 +1,54 @@ +/* Copyright 1984-2005 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" +/* +modification history +-------------------- +01e,14jan05,vvv osdep.h cleanup +01d,23sep04,kc Added coldfire arch support. +01c,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5-int/2) +01b,08dec03,dat fix CPU_FAMILY names +01a,04dec03,xli creation +*/ + +/* +DESCRIPTION +This file is a wrapper of in_cksum.h which include specific in_cksum.h +depend on the CPU_FAMILY +*/ + +#include + +/* The following includes are from target/h/arch */ + +#if(CPU_FAMILY==ARM) +#include + +#elif (CPU_FAMILY==MIPS) +#include + +#elif (CPU_FAMILY==I80X86) +#include + +#elif (CPU_FAMILY==PPC) +#include + +#elif (CPU_FAMILY==SH) +#include + +#elif (CPU_FAMILY==COLDFIRE) +#include + +#elif (CPU_FAMILY==SIMNT) +#include + +#elif (CPU_FAMILY==SIMLINUX) +#include + +#elif (CPU_FAMILY==SIMSPARCSOLARIS) +#include + +#endif + + diff --git a/h/wrn/coreip/inetLib.h b/h/wrn/coreip/inetLib.h new file mode 100644 index 0000000..263ee47 --- /dev/null +++ b/h/wrn/coreip/inetLib.h @@ -0,0 +1,109 @@ +/* inetLib.h - header for Internet address manipulation routines */ + +/* Copyright 1987-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01x,07feb05,vvv _KERNEL cleanup +01w,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01v,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01u,25nov03,ppp added a comment based on code review +01t,21nov03,ppp rtp work +01s,20nov03,niq Remove copyright_wrs.h file inclusion +01r,05nov03,cdw Removal of unnecessary _KERNEL guards. +01q,04nov03,rlm Ran batch header path update for header re-org. +01p,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01o,23oct03,rlm updated #includes for header re-org +01n,21apr03,ppp vwModNum.h should be picked up from target/h +01m,14sep01,hgo Added definition for inet_ntop and inet_pton + IPv6 support +01l,16dec93,jag Added definition for inet_aton. +01k,09aug93,elh removed definitions of inet_addr, inet_ntoa, + inet_makeaddr, and inet_network (SPR 2268). +01j,22sep92,rrr added support for c++ +01i,04jul92,jcf cleaned up. +01h,26may92,rrr the tree shuffle + -changed includes to have absolute path from h/ +01g,04oct91,rrr passed through the ansification filter + -changed includes to have absolute path from h/ + -changed VOID to void + -changed copyright notice +01f,19oct90,shl added #include . +01e,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01d,10aug90,dnw added declaration of inet_ntoa_b(). +01c,24mar88,ecs added include of types.h. +01b,15dec87,gae added INET_ADDR_LEN; used IMPORTs on function decl's. +01a,01nov87,llk written +*/ + +#ifndef __INCinetLibh +#define __INCinetLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include + +/* status codes */ + +#define S_inetLib_ILLEGAL_INTERNET_ADDRESS (M_inetLib | 1) +#define S_inetLib_ILLEGAL_NETWORK_NUMBER (M_inetLib | 2) + +/* length of ASCII represention of inet addresses, eg. "90.0.0.0" */ + +#define INET_ADDR_LEN 18 +#define INET6_ADDR_LEN 46 + +#define INETLIB 5 /* first available node */ + +/* function declarations */ + + +#if defined(__STDC__) || defined(__cplusplus) + +extern int inet_lnaof (int inetAddress); +extern int inet_netof (struct in_addr inetAddress); +extern void inet_makeaddr_b (int netAddr, int hostAddr, + struct in_addr *pInetAddr); +extern void inet_netof_string (char *inetString, char *netString); +extern void inet_ntoa_b (struct in_addr inetAddress, char *pString); +extern STATUS inet_aton (char * pString, struct in_addr * inetAddress); +extern const char *inet_ntop (int af, const void *src, char *dst, size_t size); +extern int inet_pton (int af, const char *src, void *dst); +extern u_long in_netof(struct in_addr in); + +#ifdef _WRS_KERNEL +extern STATUS inetLibSysctlInit (void); +#endif + +#else /* __STDC__ */ + +extern int inet_lnaof (); +extern int inet_netof (); +extern void inet_makeaddr_b (); +extern void inet_netof_string (); +extern void inet_ntoa_b (); +extern STATUS inet_aton (); +extern const char *inet_ntop (); +extern int inet_pton (); +extern u_long in_netof(); + +#ifdef _WRS_KERNEL +extern STATUS inetLibSysctlInit (); +#endif + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCinetLibh */ diff --git a/h/wrn/coreip/ioccom.h b/h/wrn/coreip/ioccom.h new file mode 100644 index 0000000..36e7283 --- /dev/null +++ b/h/wrn/coreip/ioccom.h @@ -0,0 +1,104 @@ +/* ioccom.h - common ioctl definitions */ + +/* Copyright 2001-2003 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1982, 1986, 1990, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ioccom.h 8.2 (Berkeley) 3/28/94 + * $FreeBSD: src/sys/sys/ioccom.h,v 1.9 1999/12/29 04:24:42 peter Exp $ + */ + +/* +modification history +-------------------- +01e,20feb05,dlk Move IOCGROUP() definition to sys/ioctl.h. +01d,20nov03,niq Remove copyright_wrs.h file inclusion +01c,04nov03,rlm Ran batch header path update for header re-org. +01b,29apr03,syy Added #ifdef for __cplusplus +01a,17sep01,ann removing some of the definitions that are already defined in + ioctl.h +*/ + +#ifndef _SYS_IOCCOM_H_ +#define _SYS_IOCCOM_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#if 0 /* Clarinet */ + +/* Most of these are obtained from ioctl.h */ + +/* + * Ioctl's have the command encoded in the lower word, and the size of + * any in or out parameters in the upper word. The high 3 bits of the + * upper word are used to encode the in/out status of the parameter. + */ +#define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */ +#define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK) +#define IOCBASECMD(x) ((x) & ~(IOCPARM_MASK << 16)) +#define IOCGROUP(x) (((x) >> 8) & 0xff) + +#define IOCPARM_MAX PAGE_SIZE /* max size of ioctl, mult. of PAGE_SIZE */ +#define IOC_VOID 0x20000000 /* no parameters */ +#define IOC_OUT 0x40000000 /* copy out parameters */ +#define IOC_IN 0x80000000 /* copy in parameters */ +#define IOC_INOUT (IOC_IN|IOC_OUT) +#define IOC_DIRMASK 0xe0000000 /* mask for IN/OUT/VOID */ + +#define _IOC(inout,group,num,len) \ + ((unsigned long)(inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))) +#define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0) +#define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t)) +#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t)) +/* this should be _IORW, but stdio got there first */ +#define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t)) + +#ifndef _KERNEL + +#include + +__BEGIN_DECLS +int ioctl __P((int, unsigned long, ...)); +__END_DECLS + +#endif + +#endif /* Clarinet */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_SYS_IOCCOM_H_ */ diff --git a/h/wrn/coreip/ip6Lib.h b/h/wrn/coreip/ip6Lib.h new file mode 100644 index 0000000..0f4d1ac --- /dev/null +++ b/h/wrn/coreip/ip6Lib.h @@ -0,0 +1,103 @@ +/* ip6Lib.h - header file for ip6Lib.c */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01k,25jun05,dlk Added cfg_ip6qmaxlen for loopback. +01j,11may05,kch Added cfg_ip6_prefer_tempaddr and cfg_ip6_mcast_pmtu to + IPV6_CONFIG_PARAMS. +01i,21apr05,rp added ip6_maxfrags +01h,07feb05,wap Allow sysctl init routines to be scaled out +01g,05nov03,cdw Removal of unnecessary _KERNEL guards. +01f,04nov03,rlm Ran batch header path update for header re-org. +01e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01d,15sep03,vvv updated path for new headers +01c,13aug03,niq Merging from Accordion label ACCORDION_BASE6_MERGE_BASELINE +01b,10jun03,vvv include netVersion.h +01a,10jun03,ann written. +*/ + +#ifndef __INCip6Libh +#define __INCip6Libh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +#include + +/* ip configuration parameters */ + +typedef struct ipv6cfgparams + { + CFG_DATA_HDR cfgh ; + int cfg_ip6_auto_linklocal ; + int cfg_ip6_forwarding ; /* act as router? 1 yes 0 no*/ + int cfg_ip6_sendredirects ; + int cfg_ip6_defhlim ; + int cfg_ip6_defmcasthlim ; + int cfg_ip6_accept_rtadv ; /* "IPV6FORWARDING ? 0 : 1" is dangerous */ + int cfg_ip6_maxfragpackets; /* initialized in frag6.c:frag6_init() */ + int cfg_ip6_maxfrags; /* initialized in frag6.c:frag6_init() */ + int cfg_ip6_log_interval ; + int cfg_ip6_hdrnestlimit ; + int cfg_ip6_dad_count ; /* DupAddrDetectionTransmits */ + int cfg_ip6_auto_flowlabel ; + int cfg_ip6_gif_hlim ; + int cfg_ip6_use_deprecated ; /* allow deprecated addr (RFC2462 5.5.4) */ + int cfg_ip6_rr_prune ; /* router renumbering prefix walk list every 5 sec. */ + int cfg_ip6_prefer_tempaddr; + int cfg_ip6_mcast_pmtu; + int cfg_ip6_v6only ; + int cfg_ip6_keepfaith ; + int cfg_rtq_reallyold ; /* one hour is ``really old'' */ + int cfg_rtq_minreallyold ; /* never automatically crank down to less */ + int cfg_rtq_toomany ; /* 128 cached routes is ``too many'' */ + int cfg_rtq_timeout ; + struct ipRouteDispatchTable * cfg_ipv6RtDispTable; /* v6 dispatch table */ + int cfg_if_index_limit; + FUNCPTR cfg_privInitSysctl; + int cfg_ip6qmaxlen; + } IPV6_CONFIG_PARAMS; + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + + +extern STATUS ipv6InstInit (void * ip6Cfg); +#ifdef VIRTUAL_STACK +extern STATUS ipv6Destructor (VSNUM vsnum); +#endif +extern void init_ip6round (); +extern void init_lastadjustedtimeout (); + + +#else /* __STDC__ */ + + +extern STATUS ipv6InstInit (); +#ifdef VIRTUAL_STACK +extern STATUS ipv6Destructor (); +#endif +extern void init_ip6round (); +extern void init_lastadjustedtimeout (); + + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCip6Libh */ + diff --git a/h/wrn/coreip/ipLib.h b/h/wrn/coreip/ipLib.h new file mode 100644 index 0000000..372b964 --- /dev/null +++ b/h/wrn/coreip/ipLib.h @@ -0,0 +1,116 @@ +/* ipLib.h - configuration data structute for IP */ + +/* Copyright 2000 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01r,20aug05,dlk Added cfg_priv_maxnipq and cfg_priv_maxfragsperpacket. +01q,07feb05,wap Allow sysctl init routines to be scaled out +01p,21jan05,sar Removal of divert, dummynet and fw code. +01o,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01n,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01m,05nov03,cdw Removal of unnecessary _KERNEL guards. +01l,04nov03,rlm Ran batch header path update for header re-org. +01k,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01j,23oct03,rlm updated #includes for header re-org +01i,15sep03,vvv updated path for new headers +01h,13aug03,niq Merging from Accordion label ACCORDION_BASE6_MERGE_BASELINE +01g,10jun03,vvv include netVersion.h +01f,15may03,ann removed all the non-clarinet references +*/ + +#ifndef __INCipLibh +#define __INCipLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* defines */ + +/* typedefs */ + +typedef struct ip_config_params + { + CFG_DATA_HDR cfgh; + /* definitions from in.c */ + int cfg_priv_subnetsarelocal; + + /* definitions from in_pcb.c */ + int cfg_ipport_lowfirstauto; + int cfg_ipport_lowlastauto; + int cfg_ipport_firstauto; + int cfg_ipport_lastauto; + int cfg_ipport_hifirstauto; + int cfg_ipport_hilastauto; + + /* definitions from in_rmx.c */ + int cfg_priv_rtq_reallyold; + int cfg_priv_rtq_minreallyold; + int cfg_priv_rtq_toomany; + int cfg_priv_rtq_timeout; + + /* definitions from in_flow.c */ + int cfg_priv_ipflow_active; + + /* definitions from ip_input.c */ + int cfg_priv_ipsendredirects; + int cfg_priv_ip_dosourceroute; + int cfg_priv_ip_acceptsourceroute; + int cfg_priv_ip_checkinterface; + int cfg_priv_maxnipq; + int cfg_priv_maxfragsperpacket; + + int cfg_priv_ipqmaxlen; + + /* cfg_priv_ipstealth was ifdef IPSTEALTH but not avail for configlettes */ + + int cfg_priv_ipstealth; + + int cfg_ipforwarding; + int cfg_ip_defttl; + + /* definitions from raw_in.c */ + u_long cfg_rip_sendspace; + u_long cfg_rip_recvspace; + + struct ipRouteDispatchTable * cfg_ipv4RtDispTable; /* v4 dispatch table */ + FUNCPTR cfg_privInitSysctl; + } IP_CONFIG_PARAMS; + +/* prototypes */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT STATUS ipInstInit (void * InitValues); + +#else /* __STDC__ */ + +IMPORT STATUS ipInstInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCipLibh */ diff --git a/h/wrn/coreip/ipProto.h b/h/wrn/coreip/ipProto.h new file mode 100644 index 0000000..c2dc5c1 --- /dev/null +++ b/h/wrn/coreip/ipProto.h @@ -0,0 +1,186 @@ +/* ipProto.h - defines for the bsd protocol pseudo-device driver */ + +/* Copyright 1996 - 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02d,07sep05,dlk Add ipBcastAddrGet() prototype. +02c,24jun05,wap Add ifmedia support +02b,07feb05,vvv _KERNEL cleanup +02a,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01z,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01y,24nov03,wap Merge changes from Snowflake +01x,20nov03,niq Remove copyright_wrs.h file inclusion +01w,04nov03,rlm Ran batch header path update for header re-org. +01v,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01u,27oct03,cdw update include statements post header re-org. +01t,08sep03,vvv merged from ACCORDION_BASE6_MERGE_BASELINE +01s,09may03,vvv added prototypes for ipDetach() and ip6Detach() +01r,29apr03,syy Added #ifdef for __cplusplus +01q,11jul02,ann added a new structure to hold the interface identifier info +01p,13jun02,ann making some changes for IPv4/IPv6 attach issue +01o,03feb02,ham changes for tornado build. +01n,25feb01,rae merged 01o tor2_0.barney (base 01m): + moved nptFlag from END_OBJ for T2 END compatibility +01m,19apr00,spm Merging NPT changes. +01l,05apr00,spm cleanup: removing unused fields from control structure +01k,02mar99,pul protoType for ipAttach(), SPR# 24253 +01j,08aug98,ann Included if_ether.h to reference idr +01i,08dec97,gnn END code review fixes. +01h,25sep97,gnn SENS beta feedback fixes +01g,19aug97,gnn changes due to new buffering scheme. +01f,12aug97,gnn changes necessitated by MUX/END update. +01e,02jun97,gnn Added added memWidth to structure. +01d,21mar97,map Added pRefCntHead, removed nLoan from BSD_DRV_CTRL. +01c,22jan97,gnn Added new private flags that is seperate from if flags. +01b,21jan97,gnn Removed buffer loaning stuff. + Added reference count information. + Added minFirstBuf for scatter/gather. +01a,17dec96,gnn written. + +*/ + +#ifndef __INCipProtoh +#define __INCipProtoh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include +#include +#include + +/* defines */ + +/* Define the length for EUI 64 id storage */ + +#define EUI_64_LEN 8 + + +/* + * The following defines are used to get the values of the various + * fields in the IP_DRV_CTRL structure. The "attached" field has + * deliberately been left out in the definition as the default case + * in the access routine is to get the "attached' field. + */ + +#define IPDRVCTRL_ARPCOOKIE 1 +#define IPDRVCTRL_IPV4COOKIE 2 +#define IPDRVCTRL_IPV6COOKIE 3 +#define IPDRVCTRL_NPTFLAG 4 +#define IPDRVCTRL_SRCADDR 5 +#define IPDRVCTRL_DSTADDR 6 +#define IPDRVCTRL_IFID 7 + + +/* + * Structure to hold the interface identifier information. This is used in + * the alloction of global and link/site local addresses. + */ + +typedef struct if_id_s + { + unsigned char interfaceId[EUI_64_LEN]; /* EUI 64 based id */ + unsigned long interfaceIdLen; /* Length of id */ + /* The following field could change later */ + unsigned long expireTimer; /* Reserved for future use */ + } IF_ID_T; + + +/* typedefs */ +typedef struct ip_drv_ctrl + { + struct arpcom idr; /* Interface Data Record */ + void* pArpCookie; /* Cookie returned from MUX for ARP */ + void* pIpCookie; /* Cookie returned from MUX for IPv4 */ + void* pIp6Cookie; /* Cookie returned from MUX for IPv6 */ + void* pEnd; /* Cached pointer to END_OBJ */ + ULONG attached; /* + * Used as a field with 2 status words, each + * containing 2 bytes. The presence of a non- + * zero value indicates atleast 1 "if" attached. + */ + BOOL nptFlag; /* Indicates type of interface: END or NPT. */ + M_BLK_ID pSrc; /* source address and type (for END device). */ + M_BLK_ID pDst; /* dest. address and type (for END device). */ + char * pDstAddr; /* cluster containing dest. address */ + IF_ID_T ifId; /* Interface identifier */ + struct ifmedia ifmedia; /* ifmedia info */ + } IP_DRV_CTRL; + +/* The following structure is used to get data using SIOCGIPDRVFIELDS ioctl */ + +struct ipdrvFields + { + void * pBuf; /* Pointer to be filled in by IOCTL */ + int cmd; /* element of the IP_DRV_CTRL structure */ + }; + +#define IP_COOKIE(pDrvCtrl) ((pDrvCtrl->pIpCookie != NULL) ? \ + pDrvCtrl->pIpCookie : pDrvCtrl->pIp6Cookie) + +/* + * The "attached" field in the IP_DRV_CTRL" structure is used for two reasons. + * The presence of a non-zero value in it implies that atleast one protocol + * has been bound to the driver. Moreover, this 4 byte field is virtually + * divided into 2 status words, each 2 bytes long. The value in the upper + * 2 bytes contains the current status of the interface and the lower 2 bytes + * is used to hold the change of status that is being requested. + * + * The following macros are used to access these words. + */ + +#define CMASK 0xffff0000 +#define NMASK 0x0000ffff + +#define SET_CURR_STATUS(pDrvCtrl, value) (pDrvCtrl->attached = \ + (pDrvCtrl->attached & NMASK) | \ + (value << 16)) +#define GET_CURR_STATUS(pDrvCtrl) ((pDrvCtrl->attached & CMASK) >> 16) +#define SET_NEW_STATUS(pDrvCtrl, value) (pDrvCtrl->attached = \ + (pDrvCtrl->attached & CMASK) | \ + value) +#define GET_NEW_STATUS(pDrvCtrl) (pDrvCtrl->attached & NMASK) + +#define IP_ATTACHED(pDrvCtrl) GET_CURR_STATUS(pDrvCtrl) + + +/* The array of driver control structures */ + +extern IP_DRV_CTRL * ipDrvCtrl; + +/* forward declarations */ + +/* globals */ +IMPORT int ipAttach (int unit, char * pDevice); + +IMPORT int ipDetach (int unit, char * pDevice); + +IMPORT int ip6Attach (int unit, char * pDevice); + +IMPORT int ip6Detach (int unit, char * pDevice); + +IMPORT int ipTxStartup (IP_DRV_CTRL* pDrvCtrl, + M_BLK_ID pMblk, + USHORT netType); +IMPORT void ipDrvCtrlFieldsGet (IP_DRV_CTRL * pDrvCtrl, void * pBuf, int cmd); +IMPORT STATUS ipDrvCtrlFieldsSet (IP_DRV_CTRL * pDrvCtrl, void * pBuf, int cmd); +IMPORT void * ipMuxCookieGet (unsigned short ifIndex); + +/* ipBcastAddrGet() is likely to change or go away... */ +IMPORT STATUS ipBcastAddrGet (IP_DRV_CTRL * pDrvCtrl, char * addrBuf); + +/* locals */ + +/* forward declarations */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCipProtoh */ diff --git a/h/wrn/coreip/jobQueueLib.h b/h/wrn/coreip/jobQueueLib.h new file mode 100644 index 0000000..a69dc30 --- /dev/null +++ b/h/wrn/coreip/jobQueueLib.h @@ -0,0 +1,141 @@ +/* jobQueueLib.h - header file for the prioritized job queueing library */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25aug05,dlk Add section tags. +01b,13jul05,dlk Added member_to_object() and QJOB_IS_BUSY() definitions. + Added 'extern' on prototypes, and jobQueueTask() prototype. +01a,14may05,dlk Written. +*/ + +#ifndef __INCjobQueueLibh +#define __INCjobQueueLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* macros */ + +#define member_to_object(pMember, type, memberName) \ + ((type *)((char *)(pMember) - offsetof (type, memberName))) + +#define JOBQ_PRI_MASKABLE /* enable priority masking */ + +/* + * The QJOB_BUSY bit in the priInfo member of a pre-allocated QJOB may be + * used for any purpose by the jobLib client. jobLib does not modify this + * bit, and is not affected by it. + */ + +#define QJOB_BUSY 0x20 /* managed by client */ + +#define QJOB_IS_BUSY(pJob) ((pJob)->priInfo & QJOB_BUSY) +#define QJOB_SET_BUSY(pJob) ((pJob)->priInfo |= QJOB_BUSY) +#define QJOB_CLEAR_BUSY(pJob) ((pJob)->priInfo &= ~QJOB_BUSY) + +#define QJOB_PRI_LOWEST 0 /* minimum, least urgent priority */ +#define QJOB_PRI_HIGHEST 31 /* maximum, most urgent priority */ +#define QJOB_NUM_PRI 32 /* Number of prioritiies */ +#define QJOB_PRI_MASK 0x1f /* Mask for priority bits */ + +#define QJOB_SET_PRI(pJob, pri) \ + ((pJob)->priInfo = ((pJob)->priInfo & ~QJOB_PRI_MASK) | \ + ((pri) & QJOB_PRI_MASK)) + +#define QJOB_GET_PRI(pJob) ((pJob)->priInfo & QJOB_PRI_MASK) + +/* types */ + +typedef void (* QJOB_FUNC) (void *); + + +/* + * A QJOB is typically a member of a larger structure with information + * used by the handler function 'func'. func() is passed a pointer to + * the QJOB as its only argument. + */ + +typedef struct _QJOB + { + struct _QJOB * pNext; + UINT32 priInfo; /* modify with QJOB_SET_PRI () */ + QJOB_FUNC func; /* function to execute */ + } QJOB; + +typedef struct _QJOB_STANDARD + { + QJOB job; + void * arg1; + void * arg2; + void * arg3; + void * arg4; + void * arg5; + } QJOB_STANDARD; + +struct _JOB_QUEUE; + +typedef struct _JOB_QUEUE * JOB_QUEUE_ID; + +struct _QJOB_STD_POOL; + +typedef struct _QJOB_STD_POOL * QJOB_STD_POOL_ID; + +/* + * Variant of jobQueueProcess() to use. By default this + * function pointer points at jobQueueProcess(), but if + * jobQueueAdvLib() is included, it may be + * point at jobQueueProcessWrapper(). + */ +extern int (* jobQueueProcessFunc) (JOB_QUEUE_ID pJobQ); + +/* function declarations */ + +_WRS_INITTEXT +extern void jobQueueLibInit (void); +_WRS_FASTTEXT +extern STATUS jobQueuePost (JOB_QUEUE_ID jobQueueId, QJOB * pJob); +_WRS_FASTTEXT +extern STATUS jobQueueStdPost (JOB_QUEUE_ID jobQueueId, int pri, + VOIDFUNCPTR pFunc, void * arg1, void * arg2, + void * arg3, void * arg4, void * arg5); + +extern JOB_QUEUE_ID jobQueueCreate (QJOB_STD_POOL_ID stdPoolId); +extern STATUS jobQueueInit (JOB_QUEUE_ID jobQueueId, + QJOB_STD_POOL_ID stdPoolId); + +_WRS_FASTTEXT +extern int jobQueueProcess (JOB_QUEUE_ID jobQId); +extern int jobQueueTask (JOB_QUEUE_ID jobQueueId); + + +#ifdef JOBQ_PRI_MASKABLE +extern UINT32 jobQueuePriorityMask (JOB_QUEUE_ID jobQId, UINT32 disablePri, + UINT32 enablePri); +#endif /* JOBQ_PRI_MASKABLE */ + +/* standard pools */ +extern STATUS jobQueueStdPoolInit (QJOB_STD_POOL_ID stdPoolId); +extern STATUS jobQueueStdJobsAlloc (QJOB_STD_POOL_ID stdPoolId, + int nStdJobs); + +/* in jobQueueUtilLib */ + +extern STATUS jobQueueQuit (JOB_QUEUE_ID jobQId, int pri, int quitValue, + VOIDFUNCPTR pFunc, void * arg1, void * arg2); +extern int jobQueueProcessWrapper (JOB_QUEUE_ID jobQId); + +extern STATUS jobQueueDelete (JOB_QUEUE_ID jobQId); +extern STATUS jobQueueTerminate (JOB_QUEUE_ID jobQId); + +extern STATUS jobQueueStdPoolJobsFree (QJOB_STD_POOL_ID pStdPool); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCjobQueueLibh */ diff --git a/h/wrn/coreip/logCategories.h b/h/wrn/coreip/logCategories.h new file mode 100644 index 0000000..0193cfd --- /dev/null +++ b/h/wrn/coreip/logCategories.h @@ -0,0 +1,62 @@ +/* logCategories.h */ + +/* + * Copyright (c) 2004-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + + +/* +modification history +-------------------- +01d,15jun05,tlu Add an entry for MIP6 +01c,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +01b,28oct04,ann changed default log level for FTP client to 0 (SPR# 103249) +01a,07sep04,dlk written +*/ + + +/* + * This header file forms the database of logging facilities used + * by applLogLib and syslog.h. It is meant to be included multiple + * times, with varying definitions of the LOG_DB() and LOG_DB_LAST() + * macros, so it is not protected against multiple inclusion. + * + * Default Default + * Facility Dest. FD Logging Decoration and Level + * -------- -------- ------------------------------ + */ + +LOG_DB (RIPNG, STD_OUT, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) +LOG_DB (PING_V4, STD_OUT, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) +LOG_DB (PING_V6, STD_OUT, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) +LOG_DB (TELNET, STD_OUT, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) +LOG_DB (TELNETD, STD_OUT, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) +LOG_DB (TFTP, STD_OUT, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) +LOG_DB (TFTPD, STD_OUT, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) +LOG_DB (FTP, STD_OUT, (_LOG_DEC_DFLT | 0 )) +LOG_DB (FTPD, STD_OUT, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) +LOG_DB (DHCP_V4, STD_OUT, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) +LOG_DB (DHCPD_V4, STD_OUT, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) +LOG_DB (DHCP_V6, STD_OUT, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) +LOG_DB (DHCPD_V6, STD_OUT, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) +LOG_DB (DNS, STD_OUT, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) +LOG_DB (SYSCTL, STD_OUT, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) +LOG_DB (RIP_V4, STD_OUT, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) +LOG_DB (RTADV, STD_OUT, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) +LOG_DB (RTSOL, STD_OUT, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) +LOG_DB (NATPT, STD_OUT, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) +LOG_DB (RDISC, STD_OUT, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) +LOG_DB (RLOGIN, STD_OUT, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) +LOG_DB (REMLIB, STD_OUT, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) +LOG_DB (KERN, KERN_LOG_FD, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) +LOG_DB (NETDRV, STD_OUT, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) +LOG_DB (MLD6R, STD_OUT, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) +LOG_DB (MIP6, STD_OUT, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) + +/* must be last */ +LOG_DB_LAST (GENERAL, STD_OUT, (_LOG_DEC_DFLT | _LOG_LVL_DFLT)) + diff --git a/h/wrn/coreip/m2IfLib.h b/h/wrn/coreip/m2IfLib.h new file mode 100644 index 0000000..ac8963c --- /dev/null +++ b/h/wrn/coreip/m2IfLib.h @@ -0,0 +1,42 @@ +/* m2IfLib.h - VxWorks MIB-II interface to SNMP Agent */ + +/* Copyright 1984 - 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02l,07feb05,vvv _KERNEL cleanup +02k,20nov03,niq Remove copyright_wrs.h file inclusion +02j,04nov03,rlm Ran batch header path update for header re-org. +02i,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +02h,24oct03,cdw update include statements post header re-org. +02g,30jul03,vvv backed out previous change +02f,24jul03,vvv modified include for endLib.h +02e,01may03,spm Tornado 2.2 CP1 merge (from ver 01h,27jan03,vvv: + TOR2_2-CP1-F label, tor2_2-patch branch, /wind/river VOB) +02d,21may02,ann changed the include of end.h to endLib.h +02c,28mar02,ppp modifying it as part of the cleanup for installation script +02b,03feb02,ham renamed dummyend.h to end.h +02a,12sep01,ann ported to clarinet +01a,29mar01,spm file creation: copied from version 01b of tor2_0.open_stack + branch (wpwr VOB) for unified code base +*/ + +#ifndef __INCm2IfLibh +#define __INCm2IfLibh + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include + +extern STATUS m2PollStatsIfPoll (END_IFDRVCONF *); +extern STATUS m2IfUsrCountersInstall (M2_ID *, void *); +extern STATUS m2IfUsrCountersRemove (M2_ID *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm2Libh */ diff --git a/h/wrn/coreip/m2Ipv6Lib.h b/h/wrn/coreip/m2Ipv6Lib.h new file mode 100644 index 0000000..74d9095 --- /dev/null +++ b/h/wrn/coreip/m2Ipv6Lib.h @@ -0,0 +1,454 @@ +/* m2Ipv6Lib.h - VxWorks IPv6 MIB-II interface to SNMP Agent */ + +/* Copyright 2002-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01l,07feb05,vvv _KERNEL cleanup +01k,19sep04,spm updated virtual stack startup: restored use of published + init routine and removed packing/unpacking parameters +01j,02feb04,pas finished Zoltan's changes for new avlLib API +01i,20nov03,niq Remove copyright_wrs.h file inclusion +01h,05nov03,cdw Removal of unnecessary _KERNEL guards. +01g,04nov03,rlm Ran batch header path update for header re-org. +01f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01e,22oct03,zl updated for new avlLib API +01d,15sep03,vvv updated path for new headers +01c,08sep03,vvv merged from ACCORDION_BASE6_MERGE_BASELINE +01b,14may03,vvv included m2Lib.h +01a,16apr02,ant written +*/ + +#ifndef __INCm2Ipv6Libh +#define __INCm2Ipv6Libh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include /* needed by sockaddr usage in if.h */ +#include +#include +#include + +#ifdef VIRTUAL_STACK +#include +#endif /* VIRTUAL_STACK */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* Convert IPv6 address from network format to host format (or vice versa). + * All parameters in m2Ipv6xxx functions that are of Ipv6 address type + * are expected in host format. + */ + +#define NTOHL_IPV6ADDR(in6Addr) \ + { \ + uint32_t * p32; \ +\ + p32 = (uint32_t *)in6Addr; \ + p32[0] = ntohl(p32[0]); \ + p32[1] = ntohl(p32[1]); \ + p32[2] = ntohl(p32[2]); \ + p32[3] = ntohl(p32[3]); \ + } + +#define HTONL_IPV6ADDR(in6Addr) \ + { \ + uint32_t * p32; \ +\ + p32 = (uint32_t *)in6Addr; \ + p32[0] = htonl(p32[0]); \ + p32[1] = htonl(p32[1]); \ + p32[2] = htonl(p32[2]); \ + p32[3] = htonl(p32[3]); \ + } + +/* possible values for ipv6Forwarding */ + +#define M2_ipv6Forwarding_forwarding 1 +#define M2_ipv6Forwarding_notForwarding 2 + +/* possible values for ipv6IfAdminStatus */ + +#define M2_ipv6IfAdminStatus_up 1 +#define M2_ipv6IfAdminStatus_down 2 + +/* possible values for ipv6IfOperStatus */ + +#define M2_ipv6IfOperStatus_up 1 +#define M2_ipv6IfOperStatus_down 2 +#define M2_ipv6IfOperStatus_noIfIdentifier 3 +#define M2_ipv6IfOperStatus_unknown 4 +#define M2_ipv6IfOperStatus_notPresent 5 + +/* possible values for ipv6TcpConnState */ + +#define M2_ipv6TcpConnState_closed 1 +#define M2_ipv6TcpConnState_listen 2 +#define M2_ipv6TcpConnState_synSent 3 +#define M2_ipv6TcpConnStatee_synReceived 4 +#define M2_ipv6TcpConnState_established 5 +#define M2_ipv6TcpConnState_finWait1 6 +#define M2_ipv6TcpConnState_finWait2 7 +#define M2_ipv6TcpConnState_closeWait 8 +#define M2_ipv6TcpConnState_lastAck 9 +#define M2_ipv6TcpConnState_closing 10 +#define M2_ipv6TcpConnState_timeWait 11 +#define M2_ipv6TcpConnState_deleteTCB 12 + +/* possible values for ipv6AddrType */ + +#define M2_ipv6AddrType_stateless 1 +#define M2_ipv6AddrType_stateful 2 +#define M2_ipv6AddrType_unknown 3 + +/* possible values for ipv6AddrStatus */ + +#define M2_ipv6AddrStatus_preferred 1 +#define M2_ipv6AddrStatus_deprecated 2 +#define M2_ipv6AddrStatus_invalid 3 +#define M2_ipv6AddrStatus_inaccessible 4 +#define M2_ipv6AddrStatus_unknown 5 + +/* possible values for ipv6RouteType */ + +#define M2_ipv6RouteType_other 1 +#define M2_ipv6RouteType_discard 2 +#define M2_ipv6RouteType_local 3 +#define M2_ipv6RouteType_remote 4 + +/* possible values for ipv6RouteProtocol */ + +#define M2_ipv6RouteProtocol_other 1 +#define M2_ipv6RouteProtocol_local 2 +#define M2_ipv6RouteProtocol_netmgmt 3 +#define M2_ipv6RouteProtocol_ndisc 4 +#define M2_ipv6RouteProtocol_rip 5 +#define M2_ipv6RouteProtocol_ospf 6 +#define M2_ipv6RouteProtocol_bgp 7 +#define M2_ipv6RouteProtocol_idrp 8 +#define M2_ipv6RouteProtocol_igrp 9 + +/* possible values for ipv6NetToMediaType */ + +#define M2_ipv6NetToMediaType_other 1 +#define M2_ipv6NetToMediaType_dynamic 2 +#define M2_ipv6NetToMediaType_static 3 +#define M2_ipv6NetToMediaType_local 4 + +/* possible values for ipv6NetToMediaState */ + +#define M2_ipv6NetToMediaState_reachable 1 +#define M2_ipv6NetToMediaState_stale 2 +#define M2_ipv6NetToMediaState_delay 3 +#define M2_ipv6NetToMediaState_probe 4 +#define M2_ipv6NetToMediaState_invalid 5 +#define M2_ipv6NetToMediaState_unknown 6 + +/* IPv6 General Group objects */ + +typedef struct m2Ipv6General + { + int ipv6Forwarding; + int ipv6DefaultHopLimit; + ULONG ipv6Interfaces; + ULONG ipv6IfTableLastChange; + } M2_IPV6_GENERAL; + +/* values for ipv6GeneralSetEntry varToSet */ + +#define M2_varId_ipv6Forwarding 1 +#define M2_varId_ipv6DefaultHopLimit 2 + +/* IPv6 General Group set operation structure */ + +typedef struct ipv6GeneralSetEntry + { + unsigned int varToSet; + int ipv6Forwarding; + int ipv6DefaultHopLimit; + } IPV6_GENERAL_SETENTRY; + +/* values for ipv6IfSetEntry varToSet */ + +#define M2_varId_ipv6IfDescr 1 +#define M2_varId_ipv6IfIdentifier 2 +#define M2_varId_ipv6IfIdentifierLength 4 +#define M2_varId_ipv6IfAdminStatus 8 + +/* IPv6 if table set operation structure */ + +typedef struct ipv6IfSetEntry + { + unsigned int varToSet; + int ipv6IfIndex; + char ipv6IfDescr[M2DISPLAYSTRSIZE]; +/* XXX Do we really want to be able to set the if identifier?? ism */ + u_int8_t ipv6IfIdentifier[8]; + int ipv6IfIdentifierLength; + int ipv6IfAdminStatus; + } IPV6_IF_SETENTRY; + +/* IPv6 TCP Connection Table Entry, RFC 2452 */ + +typedef struct + { + u_int8_t ipv6TcpConnLocalAddress [16]; + long ipv6TcpConnLocalPort; + u_int8_t ipv6TcpConnRemAddress [16]; + long ipv6TcpConnRemPort; + long ipv6TcpConnIfIndex; + long ipv6TcpConnState; + + } M2_IPV6TCPCONNTBL; + + +/* IPv6 UDP Table Entry, RFC 2454 */ + +typedef struct + { + u_int8_t ipv6UdpLocalAddress [16]; + long ipv6UdpLocalPort; + long ipv6UdpIfIndex; + + } M2_IPV6UDPTBL; + +/* IPV6 Address Prefix Table Entry, RFC 2464 */ + +typedef struct + { + u_int8_t ipv6AddrPrefixAddress [16]; + int ipv6AddrPrefixLength; + int ipv6AddrPrefixOnLinkFlag; + int ipv6AddrPrefixAutonomousFlag; + unsigned long ipv6AddrPrefixAdvPreferredLifetime; + unsigned long ipv6AddrPrefixAdvValidLifetime; + } M2_IPV6ADDRPFXTBL; + +/* IPV6 Address Table Entry, RFC 2464 */ + +typedef struct + { + u_int8_t ipv6AddrAddress [16]; + int ipv6AddrPfxLength; + int ipv6AddrType; + int ipv6AddrAnycastFlag; + int ipv6AddrStatus; + } M2_IPV6ADDRTBL; + +/* IPV6 Routing objects */ + +typedef struct + { + unsigned long ipv6RouteNumber; + unsigned long ipv6DiscardedRoutes; + } M2_IPV6ROUTE; + +/* IPV6 Routing Table Entry, RFC 2464 */ + +typedef struct + { + u_int8_t ipv6RouteDest [16]; + int ipv6RoutePfxLength; + unsigned long ipv6RouteIndex; + long ipv6RouteIfIndex; + u_int8_t ipv6RouteNextHop [16]; + int ipv6RouteType; + int ipv6RouteProtocol; + long ipv6RoutePolicy; + unsigned long ipv6RouteAge; + unsigned long ipv6RouteNextHopRDI; + unsigned long ipv6RouteMetric; + unsigned long ipv6RouteWeight; + M2_OBJECTID ipv6RouteInfo; + int ipv6RouteValid; + } M2_IPV6ROUTETBL; + +/* IPV6 Addres Translation Table Entry, RFC 2464 */ + +typedef struct + { + u_int8_t ipv6NetToMediaNetAddress [16]; + M2_PHYADDR ipv6NetToMediaPhysAddress; + int ipv6NetToMediaType; + int ipv6NetToMediaState; + unsigned long ipv6NetToMediaLastUpdated; + int ipv6NetToMediaValid; + } M2_IPV6ATRANSTBL; + +/* IPV6 ICMPv6 statistics table, RFC 2466 */ + +typedef struct + { + unsigned long ipv6IfIcmpInMsgs; + unsigned long ipv6IfIcmpInErrors; + unsigned long ipv6IfIcmpInDestUnreachs; + unsigned long ipv6IfIcmpInAdminProhibs; + unsigned long ipv6IfIcmpInTimeExcds; + unsigned long ipv6IfIcmpInParmProblems; + unsigned long ipv6IfIcmpInPktTooBigs; + unsigned long ipv6IfIcmpInEchos; + unsigned long ipv6IfIcmpInEchoReplies; + unsigned long ipv6IfIcmpInRouterSolicits; + unsigned long ipv6IfIcmpInRouterAdvertisements; + unsigned long ipv6IfIcmpInNeighborSolicits; + unsigned long ipv6IfIcmpInNeighborAdvertisements; + unsigned long ipv6IfIcmpInRedirects; + unsigned long ipv6IfIcmpInGroupMembQueries; + unsigned long ipv6IfIcmpInGroupMembResponses; + unsigned long ipv6IfIcmpInGroupMembReductions; + unsigned long ipv6IfIcmpOutMsgs; + unsigned long ipv6IfIcmpOutErrors; + unsigned long ipv6IfIcmpOutDestUnreachs; + unsigned long ipv6IfIcmpOutAdminProhibs; + unsigned long ipv6IfIcmpOutTimeExcds; + unsigned long ipv6IfIcmpOutParmProblems; + unsigned long ipv6IfIcmpOutPktTooBigs; + unsigned long ipv6IfIcmpOutEchos; + unsigned long ipv6IfIcmpOutEchoReplies; + unsigned long ipv6IfIcmpOutRouterSolicits; + unsigned long ipv6IfIcmpOutRouterAdvertisements; + unsigned long ipv6IfIcmpOutNeighborSolicits; + unsigned long ipv6IfIcmpOutNeighborAdvertisements; + unsigned long ipv6IfIcmpOutRedirects; + unsigned long ipv6IfIcmpOutGroupMembQueries; + unsigned long ipv6IfIcmpOutGroupMembResponses; + unsigned long ipv6IfIcmpOutGroupMembReductions; + } M2_IPV6IFICMPTBL; + +/* IPV6 MLD Interface Table Entry, RFC 3019 */ + +typedef struct + { + long mldInterfaceIfIndex; /* Host compliance */ + unsigned long mldInterfaceQueryInterval; + int mldInterfaceStatus; /* Host compliance */ + unsigned long mldInterfaceVersion; + u_int8_t mldInterfaceQuerier [16]; /* Host compliance */ + unsigned long mldInterfaceQueryMaxResponseDelay; + unsigned long mldInterfaceJoins; + unsigned long mldInterfaceGroups; + unsigned long mldInterfaceRobustness; + unsigned long mldInterfaceLastListenQueryIntvl; + long mldInterfaceProxyIfIndex; + unsigned long mldInterfaceQuerierUpTime; + unsigned long mldInterfaceQuerierExpiryTime; + } M2_MLDINTERFACETBL; + +/* IPV6 MLD Cache Table Entry, RFC 3019 */ + +typedef struct + { + u_int8_t mldCacheAddress [16]; /* Host compliance */ + long mldCacheIfIndex; /* Host compliance */ + int mldCacheSelf; /* Host compliance */ + u_int8_t mldCacheLastReporter [16]; + unsigned long mldCacheUpTime; + unsigned long mldCacheExpiryTime; + int mldCacheStatus; /* Host compliance */ + } M2_MLDCACHETBL; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS m2Ipv6Init(unsigned long maxRouteTableSize); +extern STATUS m2Ipv6Delete (void); + +extern STATUS m2Ipv6TcpInit (void); +extern STATUS m2Ipv6TcpConnEntryGet (int search, M2_IPV6TCPCONNTBL * pTcpConnEntry); +extern STATUS m2Ipv6TcpConnEntrySet (M2_IPV6TCPCONNTBL * pTcpConnEntry); +extern STATUS m2Ipv6TcpDelete (void); + +extern STATUS m2Ipv6UdpInit (void); +extern STATUS m2Ipv6UdpTblEntryGet (int search, M2_IPV6UDPTBL * pUdpEntry); +extern STATUS m2Ipv6UdpDelete (void); + +extern STATUS m2Ipv6IfInit (unsigned long maxRouteTableSize); +extern STATUS m2Ipv6IfGeneralGet(M2_IPV6_GENERAL * pIpv6Gen); +extern STATUS m2Ipv6IfGeneralSet(void * pIpv6IfReqEntry); +extern STATUS m2Ipv6IfTblEntryGet(int search,void * pIpv6IfReqEntry); +extern STATUS m2Ipv6IfTblEntrySet(void * pIpv6IfReqEntry); +extern STATUS m2Ipv6AddrTblEntryGet (int search, int * index, + M2_IPV6ADDRTBL * pIpAddrTblEntry); +extern STATUS m2Ipv6AddrPfxTblEntryGet (int search, int * index, + M2_IPV6ADDRPFXTBL * pIpAddrPfxTblEntry); +extern STATUS m2Ipv6RouteInfoGet (M2_IPV6ROUTE * pIpv6RouteInfo); +extern STATUS m2Ipv6RouteTblEntryGet (int search, M2_IPV6ROUTETBL * pIpRouteTblEntry); +extern STATUS m2Ipv6RouteTblEntrySet (M2_IPV6ROUTETBL * pIpRouteTblEntry); +extern STATUS m2Ipv6AtransTblEntryGet (int search, int * index, + M2_IPV6ATRANSTBL * pReqIpAtEntry); +extern STATUS m2Ipv6AtransTblEntrySet (int index, M2_IPV6ATRANSTBL * pReqIpAtEntry); +extern STATUS m2Ipv6IfDelete (void); + +extern STATUS m2Ipv6IfIcmpInit (void); +extern STATUS m2Ipv6IfIcmpTblGet (int search, int * index, M2_IPV6IFICMPTBL * pIcmpInfo); +extern STATUS m2Ipv6IfIcmpDelete (void); + +extern STATUS m2Ipv6MldInit (void); +extern STATUS m2Ipv6MldIfTblEntryGet (int search, M2_MLDINTERFACETBL * pMldIfEntry); +extern STATUS m2Ipv6MldCacheTblEntryGet (int search, M2_MLDCACHETBL * pMldCacheEntry); +extern STATUS m2Ipv6MldCacheTblEntrySet (M2_MLDCACHETBL * pMldCacheEntry); +extern STATUS m2Ipv6MldDelete (void); + +extern M2_IFINDEX * m2Ipv6AvlSearch (AVLU_TREE root, UINT key); +extern M2_IFINDEX * m2Ipv6AvlSuccessorGet (AVLU_TREE root, UINT key); + + +#else /* __STDC__ */ + +extern STATUS m2Ipv6Init(); +extern STATUS m2Ipv6Delete (); + +extern STATUS m2Ipv6TcpInit (void); +extern STATUS m2Ipv6TcpConnEntryGet (); +extern STATUS m2Ipv6TcpConnEntrySet (); +extern STATUS m2Ipv6TcpDelete (); + +extern STATUS m2Ipv6UdpInit (); +extern STATUS m2Ipv6UdpTblEntryGet (); +extern STATUS m2Ipv6UdpDelete (); + +extern STATUS m2Ipv6IfInit (); +extern STATUS m2Ipv6IfGeneralGet(); +extern STATUS m2Ipv6IfGeneralSet(); +extern STATUS m2Ipv6IfTblEntryGet(); +extern STATUS m2Ipv6IfTblEntrySet(); +extern STATUS m2Ipv6AddrTblEntryGet (); +extern STATUS m2Ipv6AddrPfxTblEntryGet (); +extern STATUS m2Ipv6RouteInfoGet (); +extern STATUS m2Ipv6RouteTblEntryGet (); +extern STATUS m2Ipv6RouteTblEntrySet (); +extern STATUS m2Ipv6AtransTblEntryGet (); +extern STATUS m2Ipv6AtransTblEntrySet (); +extern STATUS m2Ipv6IfDelete (); + +extern STATUS m2Ipv6IfIcmpInit (); +extern STATUS m2Ipv6IfIcmpTblGet (); +extern STATUS m2Ipv6IfIcmpDelete (); + +extern STATUS m2Ipv6MldInit (); +extern STATUS m2Ipv6MldIfTblEntryGet (); +extern STATUS m2Ipv6MldCacheTblEntryGet (); +extern STATUS m2Ipv6MldCacheTblEntrySet (); +extern STATUS m2Ipv6MldDelete (); + +extern void * m2Ipv6AvlSearch (); +extern void * m2Ipv6AvlSuccessorGet (); + +#endif /* __STDC__ */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm2Ipv6Libh */ diff --git a/h/wrn/coreip/m2Lib.h b/h/wrn/coreip/m2Lib.h new file mode 100644 index 0000000..d6a6ee0 --- /dev/null +++ b/h/wrn/coreip/m2Lib.h @@ -0,0 +1,1216 @@ +/* m2Lib.h - VxWorks MIB-II interface to SNMP Agent */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + + +/* +modification history +-------------------- +02d,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +02c,07feb05,vvv _KERNEL cleanup +02b,19sep04,spm updated virtual stack startup: restored use of published + init routines and removed packing/unpacking of parameters +02a,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01z,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01y,09feb04,niq define socket to remove rtp compile errors. +01x,02dec03,zl use avlUintLib instead of avlLib +01w,20nov03,niq Remove copyright_wrs.h file inclusion +01v,04nov03,rlm Ran batch header path update for header re-org. +01u,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01t,24oct03,cdw update include statements post header re-org. +01s,15sep03,vvv updated path for new headers +01r,08sep03,vvv merged from ACCORDION_BASE6_MERGE_BASELINE +01q,15may03,spm Tornado 2.2 FCS update (from ver 01i,22apr02,rae: + TOR2_2-FCS-COPY label, tor2 branch, /wind/river VOB) +01p,15may03,spm fixed IGMP prototypes missed in CP1 merge (SPR #70643) +01o,01may03,spm Tornado 2.2 CP1 merge (from ver 01k,27jan03,vvv: + TOR2_2-CP1-F label, tor2_2-patch branch, /wind/river VOB) +01n,11oct02,ham added m2LibInit(), m2Ipv6LibInit() (SPR 83041). +01m,01oct02,ham added m2IfMgtLibInit(). +01l,30sep02,vvv fixed MAXOIDLENGH typo (SPR #73303) +01k,06aug02,ann added the prototype for m2If8023PacketCount +01j,17jun02,ann adding some flags to accomplish IPv4/IPv6 separation +01i,16may02,ann added the changes described in the generic MIB interface + design document +01h,02feb02,ham changed for tornado build. +01g,13sep01,ann correcting the M2_ctrId_ifOutNUcastPkts counter +01f,25feb01,rae merged 01k tor2_0.barney (base 01e): +01e,24mar99,ead added m2SetIfLastChange() declaration (SPR #23290) +01d,10sep98,ann added doc to M2_INTERFACETBL fields spr# 21078 +01c,11apr97,rjc fixed bad value of error define +01b,05feb97,rjc added new error codes to support phase-2 ospf mib +01a,08dec93,jag written +*/ + +#ifndef __INCm2Libh +#define __INCm2Libh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include /* needed by sockaddr usage in if.h */ +#include +#include + +#ifdef _WRS_KERNEL /* Clairnet 01h */ +#ifdef INET6 +#include +#include +#endif /* INET6 */ +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* m2Lib.c Error Codes */ +struct ifnet; +struct socket; + +#define S_m2Lib_INVALID_PARAMETER (M_m2Lib | 1) +#define S_m2Lib_ENTRY_NOT_FOUND (M_m2Lib | 2) +#define S_m2Lib_TCPCONN_FD_NOT_FOUND (M_m2Lib | 3) +#define S_m2Lib_INVALID_VAR_TO_SET (M_m2Lib | 4) +#define S_m2Lib_CANT_CREATE_SYS_SEM (M_m2Lib | 5) +#define S_m2Lib_CANT_CREATE_IF_SEM (M_m2Lib | 6) +#define S_m2Lib_CANT_CREATE_ROUTE_SEM (M_m2Lib | 7) +#define S_m2Lib_ARP_PHYSADDR_NOT_SPECIFIED (M_m2Lib | 8) +#define S_m2Lib_IF_TBL_IS_EMPTY (M_m2Lib | 9) +#define S_m2Lib_IF_CNFG_CHANGED (M_m2Lib | 10) +#define S_m2Lib_TOO_BIG (M_m2Lib | 11) +#define S_m2Lib_BAD_VALUE (M_m2Lib | 12) +#define S_m2Lib_READ_ONLY (M_m2Lib | 13) +#define S_m2Lib_GEN_ERR (M_m2Lib | 14) + +#define ETHERADDRLEN 6 +#define M2DISPLAYSTRSIZE 256 +#define MAXOIDLENGTH 40 +#define MAXIFPHYADDR 16 + +/* defines for enumerated types as specified by RFC 1213 */ + +/* possible values for ifType (found in IANA-MIB) */ + +#define M2_ifType_other 1 /* none of the following */ +#define M2_ifType_regular1822 2 +#define M2_ifType_hdh1822 3 +#define M2_ifType_ddnX25 4 +#define M2_ifType_rfc877x25 5 +#define M2_ifType_ethernetCsmacd 6 +#define M2_ifType_ethernet_csmacd M2_ifType_ethernetCsmacd +#define M2_ifType_iso88023Csmacd 7 +#define M2_ifType_iso88023_csmacd M2_ifType_iso88023Csmacd +#define M2_ifType_iso88024TokenBus 8 +#define M2_ifType_iso88024_tokenBus M2_ifType_iso88024TokenBus +#define M2_ifType_iso88025TokenRing 9 +#define M2_ifType_iso88025_tokenRing M2_ifType_iso88025TokenRing +#define M2_ifType_iso88026Man 10 +#define M2_ifType_iso88026_man M2_ifType_iso88026Man +#define M2_ifType_starLan 11 +#define M2_ifType_proteon10Mbit 12 +#define M2_ifType_proteon80Mbit 13 +#define M2_ifType_hyperchannel 14 +#define M2_ifType_fddi 15 +#define M2_ifType_lapb 16 +#define M2_ifType_sdlc 17 +#define M2_ifType_ds1 18 /* DS1-MIB */ +#define M2_ifType_e1 19 /* Obsolete see DS1-MIB */ +#define M2_ifType_basicISDN 20 +#define M2_ifType_primaryISDN 21 +#define M2_ifType_propPointToPointSerial 22 /* proprietary serial */ +#define M2_ifType_ppp 23 +#define M2_ifType_softwareLoopback 24 +#define M2_ifType_eon 25 /* CLNP over IP */ +#define M2_ifType_ethernet3Mbit 26 +#define M2_ifType_nsip 27 /* XNS over IP */ +#define M2_ifType_slip 28 /* generic SLIP */ +#define M2_ifType_ultra 29 /* ULTRA technologies */ +#define M2_ifType_ds3 30 /* DS3-MIB */ +#define M2_ifType_sip 31 /* SMDS, coffee */ +#define M2_ifType_frameRelay 32 /* DTE only. */ +#define M2_ifType_rs232 33 +#define M2_ifType_para 34 /* parallel-port */ +#define M2_ifType_arcnet 35 /* arcnet */ +#define M2_ifType_arcnetPlus 36 /* arcnet plus */ +#define M2_ifType_atm 37 /* ATM cells */ +#define M2_ifType_miox25 38 +#define M2_ifType_sonet 39 /* SONET or SDH */ +#define M2_ifType_x25ple 40 +#define M2_ifType_iso88022llc 41 +#define M2_ifType_localTalk 42 +#define M2_ifType_smdsDxi 43 +#define M2_ifType_frameRelayService 44 /* FRNETSERV-MIB */ +#define M2_ifType_v35 45 +#define M2_ifType_hssi 46 +#define M2_ifType_hippi 47 +#define M2_ifType_modem 48 /* Generic modem */ +#define M2_ifType_aal5 49 /* AAL5 over ATM */ +#define M2_ifType_sonetPath 50 +#define M2_ifType_sonetVT 51 +#define M2_ifType_smdsIcip 52 /* SMDS InterCarrier Interface */ +#define M2_ifType_propVirtual 53 /* proprietary virtual/internal */ +#define M2_ifType_propMultiplexor 54 /* proprietary multiplexing */ +#define M2_ifType_ieee80212 55 /* 100BaseVG */ +#define M2_ifType_fibreChannel 56 /* Fibre Channel */ +#define M2_ifType_hippiInterface 57 /* HIPPI interfaces */ +#define M2_ifType_frameRelayInterconnect 58 /* Obsolete use either 32 or 44 */ +#define M2_ifType_aflane8023 59 /* ATM Emulated LAN for 802.3 */ +#define M2_ifType_aflane8025 60 /* ATM Emulated LAN for 802.5 */ +#define M2_ifType_cctEmul 61 /* ATM Emulated circuit */ +#define M2_ifType_fastEther 62 /* Fast Ethernet (100BaseT) */ +#define M2_ifType_isdn 63 /* ISDN and X.25 */ +#define M2_ifType_v11 64 /* CCITT V.11/X.21 */ +#define M2_ifType_v36 65 /* CCITT V.36 */ +#define M2_ifType_g703at64k 66 /* CCITT G703 at 64Kbps */ +#define M2_ifType_g703at2mb 67 /* Obsolete see DS1-MIB */ +#define M2_ifType_qllc 68 /* SNA QLLC */ +#define M2_ifType_fastEtherFX 69 /* Fast Ethernet (100BaseFX) */ +#define M2_ifType_channel 70 /* channel */ +#define M2_ifType_ieee80211 71 /* radio spread spectrum */ +#define M2_ifType_ibm370parChan 72 /* IBM 360/370 OEMI Channel */ +#define M2_ifType_escon 73 /* IBM Enterprise Systems Cnx */ +#define M2_ifType_dlsw 74 /* Data Link Switching */ +#define M2_ifType_isdns 75 /* ISDN S/T interface */ +#define M2_ifType_isdnu 76 /* ISDN U interface */ +#define M2_ifType_lapd 77 /* Link Access Protocol D */ +#define M2_ifType_ipSwitch 78 /* IP Switching Objects */ +#define M2_ifType_rsrb 79 /* Remote Source Route Bridging */ +#define M2_ifType_atmLogical 80 /* ATM Logical Port */ +#define M2_ifType_ds0 81 /* Digital Signal Level 0 */ +#define M2_ifType_ds0Bundle 82 /* ds0s on the same ds1 */ +#define M2_ifType_bsc 83 /* Bisynchronous Protocol */ +#define M2_ifType_async 84 /* Asynchronous Protocol */ +#define M2_ifType_cnr 85 /* Combat Net Radio */ +#define M2_ifType_iso88025Dtr 86 /* ISO 802.5r DTR */ +#define M2_ifType_eplrs 87 /* Ext Pos Loc Report Sys */ +#define M2_ifType_arap 88 /* Appletalk Remote Access Proto */ +#define M2_ifType_propCnls 89 /* Proprietary Cnx-less Proto */ +#define M2_ifType_hostPad 90 /* CCITT-ITU X.29 PAD Protocol */ +#define M2_ifType_termPad 91 /* CCITT-ITU X.3 PAD Facility */ +#define M2_ifType_frameRelayMPI 92 /* Multiproto Interconnect FR */ +#define M2_ifType_x213 93 /* CCITT-ITU X213 */ +#define M2_ifType_adsl 94 /* Asymmetric DSL */ +#define M2_ifType_radsl 95 /* Rate-Adapt. DSL */ +#define M2_ifType_sdsl 96 /* Symmetric DSL */ +#define M2_ifType_vdsl 97 /* Very H-Speed DSL */ +#define M2_ifType_iso88025CRFPInt 98 /* ISO 802.5 CRFP */ +#define M2_ifType_myrinet 99 /* Myricom Myrinet */ +#define M2_ifType_voiceEM 100 /* voice recEive and transMit */ +#define M2_ifType_voiceFXO 101 /* voice Foreign Exchg Office */ +#define M2_ifType_voiceFXS 102 /* voice Foreign Exchg Station */ +#define M2_ifType_voiceEncap 103 /* voice encapsulation */ +#define M2_ifType_voiceOverIp 104 /* voice over IP encapsulation */ +#define M2_ifType_atmDxi 105 /* ATM DXI */ +#define M2_ifType_atmFuni 106 /* ATM FUNI */ +#define M2_ifType_atmIma 107 /* ATM IMA */ +#define M2_ifType_pppMultilinkBundle 108 /* PPP Multilink Bundle */ +#define M2_ifType_ipOverCdlc 109 /* IBM ipOverCdlc */ +#define M2_ifType_ipOverClaw 110 /* IBM Common Link Access */ +#define M2_ifType_stackToStack 111 /* IBM stackToStack */ +#define M2_ifType_virtualIpAddress 112 /* IBM VIPA */ +#define M2_ifType_mpc 113 /* IBM multi-protocol channel */ +#define M2_ifType_ipOverAtm 114 /* IBM ipOverAtm */ +#define M2_ifType_iso88025Fiber 115 /* ISO 802.5j Fiber Token Ring */ +#define M2_ifType_tdlc 116 /* IBM twinaxial data link */ +#define M2_ifType_gigabitEthernet 117 /* Gigabit Ethernet */ +#define M2_ifType_hdlc 118 /* HDLC */ +#define M2_ifType_lapf 119 /* LAP F */ +#define M2_ifType_v37 120 /* V.37 */ +#define M2_ifType_x25mlp 121 /* Multi-Link Protocol */ +#define M2_ifType_x25huntGroup 122 /* X25 Hunt Group */ +#define M2_ifType_trasnpHdlc 123 /* Transp HDLC */ +#define M2_ifType_interleave 124 /* Interleave channel */ +#define M2_ifType_fast 125 /* Fast channel */ +#define M2_ifType_ip 126 /* IP (APPN HPR in IP networks) */ +#define M2_ifType_docsCableMaclayer 127 /* CATV Mac Layer */ +#define M2_ifType_docsCableDownstream 128 /* CATV Downstream interface */ +#define M2_ifType_docsCableUpstream 129 /* CATV Upstream interface */ +#define M2_ifType_a12MppSwitch 130 /* Avalon Parallel Processor */ +#define M2_ifType_tunnel 131 /* Encapsulation interface */ +#define M2_ifType_coffee 132 /* coffee pot */ +#define M2_ifType_ces 133 /* Circuit Emulation Service */ +#define M2_ifType_atmSubInterface 134 /* ATM Sub Interface */ +#define M2_ifType_l2vlan 135 /* Layer 2 V-LAN using 802.1Q */ +#define M2_ifType_l3ipvlan 136 /* Layer 3 V-LAN using IP */ +#define M2_ifType_l3ipxvlan 137 /* Layer 3 V-LAN using IPX */ +#define M2_ifType_digitalPowerline 138 /* IP over Power Lines */ +#define M2_ifType_mediaMailOverIp 139 /* Multimedia Mail over IP */ +#define M2_ifType_dtm 140 /* Dynamic sync Transfer Mode */ +#define M2_ifType_dcn 141 /* Data Communications Network */ +#define M2_ifType_ipForward 142 /* IP Forwarding Interface */ +#define M2_ifType_msdsl 143 /* Multi-rate Symmetric DSL */ +#define M2_ifType_ieee1394 144 /* IEEE1394 High Perf Serial Bus */ +#define M2_ifType_if_gsn 145 /* HIPPI-6400 */ +#define M2_ifType_dvbRccMacLayer 146 /* DVB-RCC MAC Layer */ +#define M2_ifType_dvbRccDownstream 147 /* DVB-RCC Downstream Channel */ +#define M2_ifType_dvbRccUpstream 148 /* DVB-RCC Upstream Channel */ +#define M2_ifType_atmVirtual 149 /* ATM Virtual Interface */ +#define M2_ifType_mplsTunnel 150 /* MPLS Tunnel Virtual Interface */ +#define M2_ifType_srp 151 /* Spatial Reuse Protocol */ +#define M2_ifType_voiceOverAtm 152 /* Voice Over ATM */ +#define M2_ifType_voiceOverFrameRelay 153 /* Voice Over Frame Relay */ +#define M2_ifType_idsl 154 /* DSL over ISDN */ +#define M2_ifType_compositeLink 155 /* Avici Composite Link */ +#define M2_ifType_ss7SigLink 156 /* SS7 Signaling Link */ +#define M2_ifType_pmp 157 /* Point to Multipoint */ + +/* interface attach/insert and detach/remove */ + +#define M2_IF_TABLE_INSERT 1 +#define M2_IF_TABLE_REMOVE 2 + +#define M2_STACK_TABLE_INSERT 1 +#define M2_STACK_TABLE_REMOVE 2 + +/* + * values for the mibStyle variable in M2_IFINDEX + * Do not use 0x10000 as this has been defined for END_MIB_2233 + * in end.h which is shared + */ + +#define IF_MIB_2233 0x1 +#define IF_MIB_IPV4 0x2 +#define IF_MIB_IPV6 0x4 + + +/* + * The following flag fields are used by the interfaces code protocol + * to keep track of the IPv4 - IPv6 attach detach issue. + */ + +#define IPV4_IF_ATTACHED 0x1 +#define IPV6_IF_ATTACHED 0x2 + +#if 0 +/* interface mib styles used by the MUX/drivers */ + +#define MIB_STYLE_1213 1 +#define MIB_STYLE_2233 2 + +#endif + +/* interface counter IDs */ + +#define M2_ctrId_ifInOctets 1 +#define M2_ctrId_ifInUcastPkts 2 +#define M2_ctrId_ifInNUcastPkts 3 +#define M2_ctrId_ifInDiscards 4 +#define M2_ctrId_ifInErrors 5 +#define M2_ctrId_ifInUnknownProtos 6 +#define M2_ctrId_ifOutOctets 7 +#define M2_ctrId_ifOutUcastPkts 8 +#define M2_ctrId_ifOutNUcastPkts 9 +#define M2_ctrId_ifOutDiscards 10 +#define M2_ctrId_ifOutErrors 11 +#define M2_ctrId_ifInMulticastPkts 12 +#define M2_ctrId_ifInBroadcastPkts 13 +#define M2_ctrId_ifOutMulticastPkts 14 +#define M2_ctrId_ifOutBroadcastPkts 15 +#define M2_ctrId_ifHCInOctets 16 +#define M2_ctrId_ifHCInUcastPkts 17 +#define M2_ctrId_ifHCInMulticastPkts 18 +#define M2_ctrId_ifHCInBroadcastPkts 19 +#define M2_ctrId_ifHCOutOctets 20 +#define M2_ctrId_ifHCOutUcastPkts 21 +#define M2_ctrId_ifHCOutMulticastPkts 22 +#define M2_ctrId_ifHCOutBroadcastPkts 23 +/* packet control used for stat counting routines (in or out) */ +#define M2_PACKET_IN 24 +#define M2_PACKET_OUT 25 +#define M2_PACKET_IN_ERROR 26 +#define M2_PACKET_OUT_ERROR 27 +#define M2_PACKET_IN_DISCARD 28 +#define M2_PACKET_OUT_DISCARD 29 + + +/* interface variable IDs */ + +#define M2_varId_ifAdminStatus 1 +#define M2_varId_ifLinkUpDownTrapEnable 2 +#define M2_varId_ifMtu 3 +#define M2_varId_ifPromiscuousMode 4 +#define M2_varId_ifPhysAddress 5 +#define M2_varId_ifDescr 6 +#define M2_varId_ifOperStatus 7 +#define M2_varId_ifAlias 8 +#define M2_varId_ifOutQLen 9 +#define M2_varId_ifSpecific 10 +#define M2_varId_ifName 11 +#define M2_varId_ifType 12 +#define M2_varId_ifHighSpeed 13 +#define M2_varId_ifSpeed 14 +#define M2_varId_ifConnectorPresent 15 +#define M2_varId_ifLastChange 16 + +/* possible values for ifAdminStatus */ + +#define M2_ifAdminStatus_up 1 +#define M2_ifAdminStatus_down 2 +#define M2_ifAdminStatus_testing 3 + +/* possible values for ifOperStatus */ + +#define M2_ifOperStatus_up 1 +#define M2_ifOperStatus_down 2 +#define M2_ifOperStatus_testing 3 + +/* possible values for ifPromiscuousMode */ + +#define M2_ifPromiscuousMode_on 1 +#define M2_ifPromiscuousMode_off 2 + +/* Row Status defines */ + +#define ROW_ACTIVE 1 +#define ROW_NOTINSERVICE 2 +#define ROW_NOTREADY 3 +#define ROW_CREATEANDGO 4 +#define ROW_CREATEANDWAIT 5 +#define ROW_DESTROY 6 + +/* Storage type defines */ + +#define STORAGE_OTHER 1 +#define STORAGE_VOLATILE 2 +#define STORAGE_NONVOLATILE 3 + +/* Boolean Values */ + +#define M2_TRUE 1 +#define M2_FALSE 2 + +/* defines for all the objects in the interface table */ + +#define M2_IFLASTCHANGE 1 +#define M2_IFINOCTETS 2 +#define M2_IFINUCASTPKTS 3 +#define M2_IFINNUCASTPKTS 4 +#define M2_IFINDISCARDS 5 +#define M2_IFINERRORS 6 +#define M2_IFINUNKNOWNPROTOS 7 +#define M2_IFOUTOCTETS 8 +#define M2_IFOUTUCASTPKTS 9 +#define M2_IFOUTNUCASTPKTS 10 +#define M2_IFOUTDISCARDS 11 +#define M2_IFOUTERRORS 12 +#define M2_IFOUTQLEN 13 +#define M2_IFINMULTICASTPKTS 14 +#define M2_IFINBROADCASTPKTS 15 +#define M2_IFOUTMULTICASTPKTS 16 +#define M2_IFOUTBROADCASTPKTS 17 +#define M2_IFHCINOCTETS 18 +#define M2_IFHCINUCASTPKTS 19 +#define M2_IFHCINMULTICASTPKTS 20 +#define M2_IFHCINBROADCASTPKTS 21 +#define M2_IFHCOUTOCTETS 22 +#define M2_IFHCOUTUCASTPKTS 23 +#define M2_IFHCOUTMULTICASTPKTS 24 +#define M2_IFHCOUTBROADCASTPKTS 25 +#define M2_IFLINKUPDOWNTRAPENABLE 26 +#define M2_IFHIGHSPEED 27 +#define M2_IFPROMISCUOUSMODE 28 +#define M2_IFCONNECTORPRESENT 29 + +/* defines for rcvAddr table entries */ +#define M2_IFRCVADDRSTATUS 1 +#define M2_IFRCVADDRTYPE 2 + +/* possible values for ipForwarding */ + +#define M2_ipForwarding_forwarding 1 +#define M2_ipForwarding_not_forwarding 2 + +/* possible values for ipRouteType */ + +#define M2_ipRouteType_other 1 +#define M2_ipRouteType_invalid 2 +#define M2_ipRouteType_direct 3 +#define M2_ipRouteType_indirect 4 + +/* possible values for ipRouteProto */ + +#define M2_ipRouteProto_other 1 +#define M2_ipRouteProto_local 2 +#define M2_ipRouteProto_netmgmt 3 +#define M2_ipRouteProto_icmp 4 +#define M2_ipRouteProto_egp 5 +#define M2_ipRouteProto_ggp 6 +#define M2_ipRouteProto_hello 7 +#define M2_ipRouteProto_rip 8 +#define M2_ipRouteProto_is_is 9 +#define M2_ipRouteProto_es_is 10 +#define M2_ipRouteProto_ciscoIgrp 11 +#define M2_ipRouteProto_bbnSpfIgp 12 +#define M2_ipRouteProto_ospf 13 +#define M2_ipRouteProto_bgp 14 + +/* possible values for ipNetToMediaType */ + +#define M2_ipNetToMediaType_other 1 +#define M2_ipNetToMediaType_invalid 2 +#define M2_ipNetToMediaType_dynamic 3 +#define M2_ipNetToMediaType_static 4 + +/* possible values for tcpRtoAlgorithm */ + +#define M2_tcpRtoAlgorithm_other 1 +#define M2_tcpRtoAlgorithm_constant 2 +#define M2_tcpRtoAlgorithm_rsre 3 +#define M2_tcpRtoAlgorithm_vanj 4 + +/* possible values for tcpConnState */ + +#define M2_tcpConnState_closed 1 +#define M2_tcpConnState_listen 2 +#define M2_tcpConnState_synSent 3 +#define M2_tcpConnState_synReceived 4 +#define M2_tcpConnState_established 5 +#define M2_tcpConnState_finWait1 6 +#define M2_tcpConnState_finWait2 7 +#define M2_tcpConnState_closeWait 8 +#define M2_tcpConnState_lastAck 9 +#define M2_tcpConnState_closing 10 +#define M2_tcpConnState_timeWait 11 +#define M2_tcpConnState_deleteTCB 12 + + +/* + * When using vxWorks SNMP this constants must have the same value as NEXT and + * EXACT + */ + +#define M2_EXACT_VALUE 0xA0 +#define M2_NEXT_VALUE 0xA1 + + + /* defines for IGMP varToSet */ +#define M2_var_igmpInterfaceQueryInterval 1 +#define M2_var_igmpInterfaceStatus 2 +#define M2_var_igmpInterfaceVersion 4 +#define M2_var_igmpInterfaceQueryMaxResponseTime 8 +#define M2_var_igmpInterfaceRobustness 16 +#define M2_var_igmpInterfaceLastMembQueryIntvl 32 + + + +/* IGMP defines from leaf.h generated file */ + +#define LEAF_igmpInterfaceIfIndex 1 +#define MIN_igmpInterfaceIfIndex 1L +#define MAX_igmpInterfaceIfIndex 2147483647L +#define LEAF_igmpInterfaceQueryInterval 2 +#define LEAF_igmpInterfaceStatus 3 +#define VAL_igmpInterfaceStatus_active 1L +#define VAL_igmpInterfaceStatus_notInService 2L +#define VAL_igmpInterfaceStatus_notReady 3L +#define VAL_igmpInterfaceStatus_createAndGo 4L +#define VAL_igmpInterfaceStatus_createAndWait 5L +#define VAL_igmpInterfaceStatus_destroy 6L +#define LEAF_igmpInterfaceVersion 4 +#define LEAF_igmpInterfaceQuerier 5 +#define LEAF_igmpInterfaceQueryMaxResponseTime 6 +#define MIN_igmpInterfaceQueryMaxResponseTime 0L +#define MAX_igmpInterfaceQueryMaxResponseTime 255L +#define LEAF_igmpInterfaceQuerierUpTime 7 +#define LEAF_igmpInterfaceQuerierExpiryTime 8 +#define LEAF_igmpInterfaceVersion1QuerierTimer 9 +#define LEAF_igmpInterfaceWrongVersionQueries 10 +#define LEAF_igmpInterfaceJoins 11 +#define LEAF_igmpInterfaceProxyIfIndex 12 +#define MIN_igmpInterfaceProxyIfIndex 0L +#define MAX_igmpInterfaceProxyIfIndex 2147483647L +#define LEAF_igmpInterfaceGroups 13 +#define LEAF_igmpInterfaceRobustness 14 +#define MIN_igmpInterfaceRobustness 1L +#define MAX_igmpInterfaceRobustness 255L +#define LEAF_igmpInterfaceLastMembQueryIntvl 15 +#define MIN_igmpInterfaceLastMembQueryIntvl 0L +#define MAX_igmpInterfaceLastMembQueryIntvl 255L +#define LEAF_igmpCacheAddress 1 +#define LEAF_igmpCacheIfIndex 2 +#define MIN_igmpCacheIfIndex 1L +#define MAX_igmpCacheIfIndex 2147483647L +#define LEAF_igmpCacheSelf 3 +#define VAL_igmpCacheSelf_true 1L +#define VAL_igmpCacheSelf_false 2L +#define LEAF_igmpCacheLastReporter 4 +#define LEAF_igmpCacheUpTime 5 +#define LEAF_igmpCacheExpiryTime 6 +#define LEAF_igmpCacheStatus 7 +#define VAL_igmpCacheStatus_active 1L +#define VAL_igmpCacheStatus_notInService 2L +#define VAL_igmpCacheStatus_notReady 3L +#define VAL_igmpCacheStatus_createAndGo 4L +#define VAL_igmpCacheStatus_createAndWait 5L +#define VAL_igmpCacheStatus_destroy 6L +#define LEAF_igmpCacheVersion1HostTimer 8 + + + +/* simple type used for imitating 64 bit integers */ + +typedef struct ui64 + { + UINT high; + UINT low; + } UI64; + +/* + * UI64_ZERO - Zero a UI64 struct + * + * PARAMETERS: UI64 * Pointer to the object to be zeroed. + */ +#define UI64_ZERO(N) (N)->high = (N)->low = 0L + +/* + * UI64_ADD32 - Add a UINT to a UI64 + * + * PARAMETERS: UI64 * pointer to the object to be updated + * UINT the quantity to add in. + * + * RESTRICTIONS: This routine will wrap the object if necessary and not give + * any warning about having done so. + */ +#define UI64_ADD32(N, I) (N)->low += I; if ((N)->low < I) (N)->high++ + +/* + * UI64_SUB64 - Subtract two UI64s + * + * PARAMETERS: UI64 * the result goes here + * UI64 * Subtract from this object + * UI64 * the object to subtract + * + * RESTRICTIONS: This routine will wrap the object if necessary and not give + * any warning about having done so. + */ +#define UI64_SUB64(X, Y, Z) (X)->low = (Y)->low - (Z)->low; \ + (X)->high = (Y)->high - (Z)->high; \ + if ((X)->low > (Y)->low) (X)->high-- + +/* + * UI64_COPY - Copy one UI64 to another + * + * PARAMETERS: UI64 * the result goes here + * UI64 * copy from this object + */ +#define UI64_COPY(X, Y) (X)->low = (Y)->low; (X)->high = (Y)->high + +/* + * UI64_COMP - Compare two UI64s + * + * PARAMETERS: UI64 * The two objects to compare + * UI64 * + * + * RETURNS: < 0 if the first is smaller than the second + * > 0 if the first is greater than the second + * 0 if they are equal. + */ +#define UI64_COMP(X, Y) \ + (((X)->high == (Y)->high) ? \ + (((X)->low == (Y)->low) ? (0) : (((X)->low > (Y)->low) ? (1) : (-1))) : \ + (((X)->high > (Y)->high) ? (1) : (-1))) + + +typedef struct + { + long idLength; /* Length of the object identifier */ + long idArray [MAXOIDLENGTH]; /* Object Id numbers */ + + } M2_OBJECTID; + +typedef struct + { + long addrLength; /* Length of address */ + unsigned char phyAddress [MAXIFPHYADDR]; /* physical address value */ + + } M2_PHYADDR; + +/* + * The only difference between M2_PHYADDR and the following structure is + * that the former has a static field for the physical address string, + * whereas the latter has a pointer that helps in a set opertaion. It + * prevents an un-necessary bcopy. + */ + +typedef struct + { + long addrLength; /* Length of address */ + unsigned char * pAddress; /* physical address pointer */ + } M2_PHYADDRSET; + + +/* + * The structures that follow are based on the MIB-II RFC-1213. Each field in + * each of the structures has the same name as the name specified in by the RFC. + * Please refer to the RFC for a complete description of the variable and its + * semantics. + */ + + +/* System Group bit fields that map to variables that can be set */ + +#define M2SYSNAME 0x01 +#define M2SYSCONTACT 0x02 +#define M2SYSLOCATION 0x04 + +typedef struct + { + unsigned char sysDescr [M2DISPLAYSTRSIZE]; + M2_OBJECTID sysObjectID; + unsigned long sysUpTime; + unsigned char sysContact [M2DISPLAYSTRSIZE]; + unsigned char sysName [M2DISPLAYSTRSIZE]; + unsigned char sysLocation [M2DISPLAYSTRSIZE]; + long sysServices; + + } M2_SYSTEM; + + +/* Interface group variables */ + +typedef struct + { + long ifNumber; /* Number of Interfaces in the System */ + ULONG ifTableLastChange; /* Time the ifTable was last changed */ + ULONG ifStackLastChange; /* Time the stackTable was last changed */ + } M2_INTERFACE; + + +/* values as per RFC 1215 */ + +#define M2_LINK_DOWN_TRAP 2 +#define M2_LINK_UP_TRAP 3 + +#define M2_LINK_UP_DOWN_TRAP_ENABLED 1 +#define M2_LINK_UP_DOWN_TRAP_DISABLED 2 + +#define M2_PROMISCUOUS_MODE_ON 1 +#define M2_PROMISCUOUS_MODE_OFF 2 + +#define M2_CONNECTOR_PRESENT 1 +#define M2_CONNECTOR_NOT_PRESENT 2 + +typedef struct + { + int ifIndex; /* Unique value for each interface */ + char ifDescr [M2DISPLAYSTRSIZE]; /* Information about the interface */ + long ifType; /* Type of interface */ + long ifMtu; /* Max size of datagram for the interface */ + unsigned long ifSpeed; /* Interface's current bandwidth in bits/sec */ + M2_PHYADDR ifPhysAddress; /* Mac layer address of the interface */ + long ifAdminStatus; /* Desired state for the interface */ + long ifOperStatus; /* Current operational status of the interface */ + unsigned long ifLastChange; /* Value of sysUpTime when interface entered + its current operational state */ + unsigned long ifInOctets; /* Number of octets received on the interface */ + unsigned long ifInUcastPkts; /* Number of subnetwork-unicast packets + delivered to a higher-layer protocol */ + unsigned long ifInNUcastPkts; /* Number of non-unicast packets delivered + to a higher layer protocol */ + unsigned long ifInDiscards; /* Number of inbound packets discarded */ + unsigned long ifInErrors; /* Inbound packets that contained errors */ + unsigned long ifInUnknownProtos; /* Inbound packets discarded due to unknown + or unsupported protocol */ + unsigned long ifOutOctets; /* Number of octets transmitted on the interface */ + unsigned long ifOutUcastPkts; /* Number of packets transmitted to subnet + unicast address */ + unsigned long ifOutNUcastPkts; /* Number of packets sent to non-unicast + address */ + unsigned long ifOutDiscards; /* Number of outbound packets discarded */ + unsigned long ifOutErrors; /* Number of outbound packets that could not + be transmitted due to errors */ + unsigned long ifOutQLen; /* Length of output packet queue */ + M2_OBJECTID ifSpecific; /* Reference to MIB definitions specific to + particular media being used */ + } M2_INTERFACETBL; + +/* The RFC 2233 additions to the ifTable */ + +typedef struct + { + char ifName [M2DISPLAYSTRSIZE]; + ULONG ifInMulticastPkts; + ULONG ifInBroadcastPkts; + ULONG ifOutMulticastPkts; + ULONG ifOutBroadcastPkts; + UI64 ifHCInOctets; + UI64 ifHCInUcastPkts; + UI64 ifHCInMulticastPkts; + UI64 ifHCInBroadcastPkts; + UI64 ifHCOutOctets; + UI64 ifHCOutUcastPkts; + UI64 ifHCOutMulticastPkts; + UI64 ifHCOutBroadcastPkts; + UINT ifLinkUpDownTrapEnable; + ULONG ifHighSpeed; + UINT ifPromiscuousMode; + UINT ifConnectorPresent; + char ifAlias [M2DISPLAYSTRSIZE]; + ULONG ifCounterDiscontinuityTime; + } M2_2233TBL; + +/* Update Routines */ + +typedef struct M2_ID_S M2_ID; +typedef struct M2_IFSTACKTBL_S M2_IFSTACKTBL; +typedef STATUS (* M2_PKT_COUNT_RTN) (M2_ID *, UINT, UCHAR *, ULONG); +typedef STATUS (* M2_CTR_UPDATE_RTN) (M2_ID *, UINT, ULONG); +typedef STATUS (* M2_VAR_UPDATE_RTN) (M2_ID *, UINT, caddr_t); + +/* Combination of the above interface structs */ + +typedef struct + { + M2_INTERFACETBL mibIfTbl; /* the RFC 1213 objects */ + M2_2233TBL mibXIfTbl; /* the RFC 2233 extension */ + } M2_DATA; + +/* The interface table struct for RFC 2233 compliance */ + +struct M2_ID_S + { + M2_DATA m2Data; /* the interface table */ + M2_PKT_COUNT_RTN m2PktCountRtn; /* packet counter function */ + M2_CTR_UPDATE_RTN m2CtrUpdateRtn; /* counter increment function */ + M2_VAR_UPDATE_RTN m2VarUpdateRtn; /* variable update routine */ + void * m2UsrCounter; /* pointer to additional counters */ + }; + +/* The structure for the ifStack table as described in RFC 2233 */ + +struct M2_IFSTACKTBL_S + { + int index; /* The ifIndex */ + int status; /* status of relationship */ + struct M2_IFSTACKTBL_S * pNextLower; /* Pointer to the next relation */ + }; + +/* The structure for the ifRcv address table as described in RFC 2233 */ + +typedef struct M2_IFRCVADDRTBL_S + { + M2_PHYADDR ifRcvAddrAddr;/* The physical address for which + * system will accept pkts/frames + */ + int ifRcvAddrStatus; /* The rowStatus */ + int ifRcvAddrType; /* The address type */ + struct M2_IFRCVADDRTBL_S * pNextEntry; /* Next pointer */ + } M2_IFRCVADDRTBL; + +/* The structure for the ifIndex value and corresponding ifnet pointer */ + +typedef struct M2_IFINDEX_S + { + AVLU_NODE ifNode; /* Node representing an if in AVL tree */ + int ifType; /* Interface type */ + int ifIndex; /* Unique value for each interface */ + M2_OBJECTID ifOid; /* I/F Object Id */ + void * pIfStats; /* Pointer to the driver specific + * structure + */ + M2_IFSTACKTBL * pNextLower; /* List of lower sub-layers */ + M2_IFRCVADDRTBL * pRcvAddr; /* rcvAddr list */ + + /* Ioctl to munge interface flags */ + /* Called from m2IfTblEntrySet to change the values in */ + /* the ifnet structure in a non-protocol-specific way. */ + /* Callbacks are bad for tor3 (so I've heard). */ + int (*ifIoctl) (struct socket*, u_long, caddr_t); + STATUS (*rcvAddrGet) (struct ifnet *, struct M2_IFINDEX_S *); + short mibStyle; /* MIBs supported */ + /* struct in6_ifdata *pIn6IfData; */ /* defunct ! */ + struct in6_ifinfo *pIn6IfInfo; /* IPv6 MIB data */ + } M2_IFINDEX; + +/* Structure to perform the set operation for if table */ + +typedef struct ifSetentry + { + unsigned int varToSet; + int ifIndex; + long ifAdminStatus; + UINT ifPromiscuousMode; + UINT ifLinkUpDownTrapEnable; + char ifAlias[M2DISPLAYSTRSIZE]; + } IF_SETENTRY; + +/* IP group bit fields that map to variables that can be set */ + +#define M2_IPFORWARDING 0x01 +#define M2_IPDEFAULTTTL 0x02 + +typedef struct + { + long ipForwarding; + long ipDefaultTTL; + unsigned long ipInReceives; + unsigned long ipInHdrErrors; + unsigned long ipInAddrErrors; + unsigned long ipForwDatagrams; + unsigned long ipInUnknownProtos; + unsigned long ipInDiscards; + unsigned long ipInDelivers; + unsigned long ipOutRequests; + unsigned long ipOutDiscards; + unsigned long ipOutNoRoutes; + long ipReasmTimeout; + unsigned long ipReasmReqds; + unsigned long ipReasmOKs; + unsigned long ipReasmFails; + unsigned long ipFragOKs; + unsigned long ipFragFails; + unsigned long ipFragCreates; + unsigned long ipRoutingDiscards; + + } M2_IP; + + +/* IP Address Table group */ + +typedef struct + { + unsigned long ipAdEntAddr; + long ipAdEntIfIndex; + unsigned long ipAdEntNetMask; + long ipAdEntBcastAddr; + long ipAdEntReasmMaxSize; + + } M2_IPADDRTBL; + +/* IP Routing Table group */ + +typedef struct + { + unsigned long ipRouteDest; + long ipRouteIfIndex; + long ipRouteMetric1; + long ipRouteMetric2; + long ipRouteMetric3; + long ipRouteMetric4; + unsigned long ipRouteNextHop; + long ipRouteType; + long ipRouteProto; + long ipRouteAge; + unsigned long ipRouteMask; + long ipRouteMetric5; + M2_OBJECTID ipRouteInfo; + + } M2_IPROUTETBL; + +/* IP route table entry bit fields that map to variables that can be set */ + +#define M2_IP_ROUTE_DEST 1 +#define M2_IP_ROUTE_NEXT_HOP 2 +#define M2_IP_ROUTE_TYPE 4 +#define M2_IP_ROUTE_MASK 8 + +/* IP Address Translation Table group */ + +typedef struct + { + long ipNetToMediaIfIndex; + M2_PHYADDR ipNetToMediaPhysAddress; + unsigned long ipNetToMediaNetAddress; + long ipNetToMediaType; + + } M2_IPATRANSTBL; + +/* ICMP group */ + +typedef struct + { + unsigned long icmpInMsgs; + unsigned long icmpInErrors; + unsigned long icmpInDestUnreachs; + unsigned long icmpInTimeExcds; + unsigned long icmpInParmProbs; + unsigned long icmpInSrcQuenchs; + unsigned long icmpInRedirects; + unsigned long icmpInEchos; + unsigned long icmpInEchoReps; + unsigned long icmpInTimestamps; + unsigned long icmpInTimestampReps; + unsigned long icmpInAddrMasks; + unsigned long icmpInAddrMaskReps; + unsigned long icmpOutMsgs; + unsigned long icmpOutErrors; + unsigned long icmpOutDestUnreachs; + unsigned long icmpOutTimeExcds; + unsigned long icmpOutParmProbs; + unsigned long icmpOutSrcQuenchs; + unsigned long icmpOutRedirects; + unsigned long icmpOutEchos; + unsigned long icmpOutEchoReps; + unsigned long icmpOutTimestamps; + unsigned long icmpOutTimestampReps; + unsigned long icmpOutAddrMasks; + unsigned long icmpOutAddrMaskReps; + + } M2_ICMP; + + +/* TCP Group */ + +typedef struct + { + long tcpRtoAlgorithm; + long tcpRtoMin; + long tcpRtoMax; + long tcpMaxConn; + unsigned long tcpActiveOpens; + unsigned long tcpPassiveOpens; + unsigned long tcpAttemptFails; + unsigned long tcpEstabResets; + unsigned long tcpCurrEstab; + unsigned long tcpInSegs; + unsigned long tcpOutSegs; + unsigned long tcpRetransSegs; + unsigned long tcpInErrs; + unsigned long tcpOutRsts; + + } M2_TCPINFO; + + +/* TCP Connection Table Entry */ + +typedef struct + { + long tcpConnState; + unsigned long tcpConnLocalAddress; + long tcpConnLocalPort; + unsigned long tcpConnRemAddress; + long tcpConnRemPort; + + } M2_TCPCONNTBL; + + +/* User Datagram Protocol Group */ + +typedef struct + { + unsigned long udpInDatagrams; + unsigned long udpNoPorts; + unsigned long udpInErrors; + unsigned long udpOutDatagrams; + + } M2_UDP; + +/* UDP Connection Table Entry */ + +typedef struct + { + unsigned long udpLocalAddress; + long udpLocalPort; + + } M2_UDPTBL; +/* IGMP */ +typedef struct + { + ULONG igmpInterfaceIfIndex; + ULONG igmpInterfaceQueryInterval; + ULONG igmpInterfaceStatus; + ULONG igmpInterfaceVersion; + ULONG igmpInterfaceQuerier; + ULONG igmpInterfaceQueryMaxResponseTime; + ULONG igmpInterfaceQuerierPresentTimeout; + ULONG igmpInterfaceLeaveEnabled; + ULONG igmpInterfaceVersion1QuerierTimer; + ULONG igmpInterfaceWrongVersionQueries; + ULONG igmpInterfaceJoins; + ULONG igmpInterfaceLeaves; + ULONG igmpInterfaceGroups; + ULONG igmpInterfaceRobustness; + ULONG igmpInterfaceQuerierUpTime; + ULONG igmpInterfaceLastMembQueryIntvl; + } M2_IGMP; + +typedef struct + { + ULONG igmpCacheAddress; + ULONG igmpCacheIfIndex; + ULONG igmpCacheSelf; /* was BOOLEAN */ + ULONG igmpCacheLastReporter; + ULONG igmpCacheUpTime; + ULONG igmpCacheExpiryTime; + ULONG igmpCacheStatus; + ULONG igmpCacheVersion1HostTimer; + } M2_IGMP_CACHE; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS m2SysInit (char * mib2SysDescr, char * mib2SysContact, + char * mib2SysLocation, M2_OBJECTID * pObjectId); + +extern STATUS m2SysGroupInfoGet (M2_SYSTEM * pSysInfo); +extern STATUS m2SysGroupInfoSet (unsigned int varToSet, M2_SYSTEM * pSysInfo); +extern STATUS m2SysDelete (void); + +extern STATUS mibIfAlloc (M2_ID **, ULONG, UCHAR *, ULONG, ULONG, + ULONG, char *, int); +extern M2_ID * m2IfAlloc (ULONG, UCHAR *, ULONG, ULONG, ULONG, char *, int); +extern STATUS m2IfFree (M2_ID *); +extern STATUS m2CounterUpdate (M2_ID *, UINT, ULONG, UCHAR *); +extern STATUS m2VariableUpdate (M2_ID *, UINT, caddr_t); +extern STATUS m2If8023PacketCount (M2_ID *, UINT, UCHAR *, ULONG); +extern STATUS m2IfPktCountRtnInstall (M2_ID *, M2_PKT_COUNT_RTN); +extern STATUS m2IfCtrUpdateRtnInstall (M2_ID *, M2_CTR_UPDATE_RTN); +extern STATUS m2IfVarUpdateRtnInstall (M2_ID *, M2_VAR_UPDATE_RTN); + +extern STATUS m2IfInit (FUNCPTR pTrapRtn, void * pTrapArg); + +extern STATUS m2IfTableUpdate (struct ifnet * pIfNet, UINT status, + int (*func) (struct socket*,u_long,caddr_t), + STATUS (func2) (struct ifnet*, M2_IFINDEX*), + UINT mibsSupported); +extern STATUS m2IfGroupInfoGet (M2_INTERFACE * pIfInfo); +extern STATUS m2IfTblEntryGet (int search, void * pIfTblEntry); +extern STATUS m2IfTblEntrySet (void *); +extern STATUS m2IfStackTblUpdate (UINT lowerIndex, UINT higherIndex, int action); +extern STATUS m2IfStackEntryGet (int, int *, M2_IFSTACKTBL *); +extern STATUS m2IfStackEntrySet (int, M2_IFSTACKTBL *); +extern STATUS m2IfRcvAddrEntryGet (int, int *, M2_IFRCVADDRTBL *); +extern STATUS m2IfRcvAddrEntrySet (int, int, M2_IFRCVADDRTBL *); +extern STATUS m2IfDelete (void); + +extern STATUS m2IpInit (int maxRouteTableSize); +extern STATUS m2IpGroupInfoGet (M2_IP * pIpInfo); +extern STATUS m2IpGroupInfoSet (unsigned int varToSet, M2_IP * pIpInfo); + +extern STATUS + m2IpAddrTblEntryGet (int search, M2_IPADDRTBL * pIpAddrTblEnry); + +extern STATUS +m2IpRouteTblEntryGet (int search, M2_IPROUTETBL * pIpRouteTblEntry); + +extern STATUS +m2IpRouteTblEntrySet (int varToSet, M2_IPROUTETBL * pIpRouteTblEntry); + +extern STATUS + m2IpAtransTblEntryGet (int search, M2_IPATRANSTBL * pIpAtEntry); +extern STATUS + m2IpAtransTblEntrySet (M2_IPATRANSTBL * pIpAtEntry); +extern STATUS m2IpDelete (void); + +extern STATUS m2IcmpInit (void); +extern STATUS m2IcmpGroupInfoGet (M2_ICMP * pIcmpInfo); + +extern STATUS m2TcpInit (void); +extern STATUS m2TcpGroupInfoGet (M2_TCPINFO * pTcpInfo); + +extern STATUS m2TcpConnEntryGet (int search, M2_TCPCONNTBL * pTcpConnEntry); +extern STATUS m2TcpConnEntrySet (M2_TCPCONNTBL * pTcpConnEntry); + +extern STATUS m2UdpInit (void); +extern STATUS m2UdpGroupInfoGet (M2_UDP * pUdpInfo); + +extern STATUS m2UdpTblEntryGet (int search, M2_UDPTBL * pUdpEntry); + +STATUS m2Init (char * pMib2SysDescr, char * pMib2SysContact, + char * pMib2SysLocation, + M2_OBJECTID * pMib2SysObjectId, FUNCPTR pTrapRtn, + void * pTrapArg, int maxRouteTableSize); + +extern STATUS m2Delete (void); +extern STATUS m2TcpDelete (void); +extern STATUS m2UdpDelete (void); +extern STATUS m2IcmpDelete (void); +extern STATUS m2SetIfLastChange (int ifIndex); +extern STATUS m2IgmpInit (); +extern STATUS m2IgmpInterfaceEntrySet(M2_IGMP *data, int varsToSet); +extern STATUS m2IgmpInterfaceEntryGet(M2_IGMP *data); +extern STATUS m2IgmpInterfaceEntryNextGet(M2_IGMP *data); +extern STATUS m2IgmpCacheEntryGet(M2_IGMP_CACHE *data); +extern STATUS m2IgmpCacheEntryNextGet(M2_IGMP_CACHE *data); +extern M2_IGMP_CACHE * igmpCacheEntry_first(void); +extern M2_IGMP_CACHE * igmpCacheEntry_next_inst(M2_IGMP_CACHE * data); +extern unsigned igmpCacheEntry_build_instance(M2_IGMP_CACHE * data, int * inst); +extern STATUS m2IgmpTreeAdd (); +extern STATUS m2IfMgtLibInit(void); +extern STATUS m2LibInit (void); +extern STATUS m2Ipv6LibInit (void); + +#else /* __STDC__ */ + +extern STATUS m2SysInit (); +extern STATUS m2SysGroupInfoGet (); +extern STATUS m2SysGroupInfoSet (); +extern STATUS m2SysDelete (); +extern M2_ID * m2IfAlloc (); +extern STATUS m2IfFree (); +extern STATUS m2IfGenericPacketCount (); +extern STATUS m2IfCounterUpdate (); +extern STATUS m2IfVariableUpdate (); +extern STATUS m2IfPktCountRtnInstall (); +extern STATUS m2IfCtrUpdateRtnInstall (); +extern STATUS m2IfVarUpdateRtnInstall (); +extern STATUS m2If8023PacketCount (); +extern STATUS m2IfInit (); +extern STATUS m2IfTableUpdate (); +extern STATUS m2IfGroupInfoGet (); +extern STATUS m2IfTblEntryGet (); +extern STATUS m2IfTblEntrySet (); +extern STATUS m2IfStackTblUpdate (); +extern STATUS m2IfStackEntryGet (); +extern STATUS m2IfStackEntrySet (); +extern STATUS m2IfRcvAddrEntryGet (); +extern STATUS m2IfRcvAddrEntrySet (); +extern STATUS m2IfDelete (); +extern STATUS m2IpInit (); +extern STATUS m2IpGroupInfoGet (); +extern STATUS m2IpGroupInfoSet (); +extern STATUS m2IpAddrTblEntryGet (); +extern STATUS m2IpRouteTblEntryGet (); +extern STATUS m2IpRouteTblEntrySet (); +extern STATUS m2IpAtransTblEntryGet (); +extern STATUS m2IpAtransTblEntrySet (); +extern STATUS m2IpDelete (); +extern STATUS m2IcmpInit (); +extern STATUS m2IcmpGroupInfoGet (); +extern STATUS m2TcpInit (); +extern STATUS m2TcpGroupInfoGet (); +extern STATUS m2TcpConnEntryGet (); +extern STATUS m2TcpConnEntrySet (); +extern STATUS m2UdpInit (); +extern STATUS m2UdpGroupInfoGet (); +extern STATUS m2UdpTblEntryGet (); +extern STATUS m2Init (); +extern STATUS m2Delete (); +extern STATUS m2TcpDelete (); +extern STATUS m2UdpDelete (); +extern STATUS m2IcmpDelete (); +extern STATUS m2SetIfLastChange (); +extern STATUS m2IgmpInit (); +extern STATUS m2IgmpInterfaceEntrySet(); +extern STATUS m2IgmpInterfaceEntryGet(); +extern STATUS m2IgmpInterfaceEntryNextGet(); +extern STATUS m2IgmpCacheEntryGet(); +extern STATUS m2IgmpCacheEntryNextGet(); +extern M2_IGMP_CACHE * igmpCacheEntry_first(); +extern M2_IGMP_CACHE * igmpCacheEntry_next_inst(); +extern unsigned igmpCacheEntry_build_instance(); +extern STATUS m2IgmpTreeAdd (); +extern STATUS m2IfMgtLibInit(); +extern STATUS m2LibInit(); +extern STATUS m2Ipv6LibInit(); +#endif /* __STDC__ */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm2Libh */ diff --git a/h/wrn/coreip/machdep.h b/h/wrn/coreip/machdep.h new file mode 100644 index 0000000..6f1e6e3 --- /dev/null +++ b/h/wrn/coreip/machdep.h @@ -0,0 +1,42 @@ +/* Copyright 1984-2005 Wind River Systems, Inc. */ +#include "copyright_wrs.h" +/* +modification history +-------------------- +01f,24jan05,vvv added deprecation message +01e,23sep04,kc Added coldfire arch support. +01d,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01c,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5-int/1) +01e,23mar03,dbt Added SIMPENTIUM support +01d,08dec03,dat cleanup CPU_FAMILY values +01c,08dec03,ann fixed the incorrect path for SH +01b,08dec03,xli correct the path for sh +01a,04dec03,xli creation +*/ + +/* +DESCRIPTION +This file is a wrapper of machdep.h which include specific machdep.h depend on the CPU_FAMILY +*/ + +#warning "The use of this file is deprecated. Use vxWorks.h instead." + +#if (CPU_FAMILY==PPC) +#include +#elif (CPU_FAMILY==MIPS) +#include +#elif (CPU_FAMILY==I80X86) +#include +#elif (CPU_FAMILY==ARM) +#include +#elif (CPU_FAMILY==SH) +#include +#elif (CPU_FAMILY==COLDFIRE) +#include +#elif ((CPU_FAMILY==SIMPENTIUM) || (CPU_FAMILY==SIMNT) || \ + (CPU_FAMILY==SIMLINUX)) +#include +#elif (CPU_FAMILY==SIMSPARCSOLARIS) +#include +#endif diff --git a/h/wrn/coreip/mbufLib.h b/h/wrn/coreip/mbufLib.h new file mode 100644 index 0000000..b104d87 --- /dev/null +++ b/h/wrn/coreip/mbufLib.h @@ -0,0 +1,171 @@ +/* mbufLib.h - mbuf interface library header */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,19jul04,vvv fixed warning +01b,04nov03,rlm Ran batch header path update for header re-org. +01a,19nov02,nee Ported to Accordion from "mbufLib.h@@/main/ from view tor3_x/tor3_x.synth". +*/ + + +#ifndef __INCmbufLibh +#define __INCmbufLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* typedefs */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* definition of mbuf ID */ + +typedef struct mbufId /* MBUF_ID */ + { + union + { + struct mbuf * head; /* head of mbuf chain */ + struct mbufId * idNext; /* next ID in free chain */ + } uId; + + u_char type; /* mbuf ID type */ + } *MBUF_ID; + +/* definition of mbuf desc */ + +typedef struct mbufDesc /* MBUF_DESC */ + { + caddr_t buf; /* user buffer address */ + union + { + u_char refCnt; /* share counter */ + struct mbufDesc * descNext; /* next desc in free chain */ + } uDesc; + } *MBUF_DESC; + +typedef struct mbuf * MBUF_SEG; + +extern struct mbufId * _mbufIdHead; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* defines */ + +#define mbufHead uId.head +#define mbufIdNext uId.idNext +#define mbufRefCnt uDesc.refCnt +#define mbufDescNext uDesc.descNext + +/* status codes */ + +#define S_mbufLib_ID_INVALID (M_mbufLib | 1) +#define S_mbufLib_ID_EMPTY (M_mbufLib | 2) +#define S_mbufLib_SEGMENT_NOT_FOUND (M_mbufLib | 3) +#define S_mbufLib_LENGTH_INVALID (M_mbufLib | 4) +#define S_mbufLib_OFFSET_INVALID (M_mbufLib | 5) + +#define MBUF_ID_INC 50 /* increment for ID alloc */ +#define MBUF_DESC_INC 50 /* increment for desc alloc */ +#define MBUF_BEGIN ZBUF_BEGIN /* start of chain */ +#define MBUF_END ZBUF_END /* end of chain */ +#define MBUF_NONE ((MBUF_SEG) NONE) /* cut past chain */ +#define MBUF_VALID 0x5e /* validate off magic number */ + +#define MBUF_ID_CREATE(mbufId) \ + { \ + int lockKey = intLock (); \ + if ((mbufId = _mbufIdHead) != NULL) \ + { \ + _mbufIdHead = mbufId->mbufIdNext; \ + intUnlock (lockKey); \ + mbufId->type = MBUF_VALID; \ + mbufId->mbufHead = NULL; \ + } \ + else \ + { \ + intUnlock (lockKey); \ + mbufId = _mbufCreate (); \ + } \ + } + +#define MBUF_ID_DELETE_EMPTY(mbufId) \ + { \ + int lockKey; \ + mbufId->type = MT_FREE; \ + lockKey = intLock (); \ + mbufId->mbufIdNext = _mbufIdHead; \ + _mbufIdHead = mbufId; \ + intUnlock (lockKey); \ + } + +#define MBUF_ID_DELETE(mbufId) \ + { \ + if (mbufId->mbufHead != NULL) \ + m_freem (mbufId->mbufHead); \ + MBUF_ID_DELETE_EMPTY(mbufId); \ + } + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void * _mbufLibInit (void); +extern MBUF_ID _mbufCreate (void); +extern STATUS _mbufDelete (MBUF_ID mbufId); +extern MBUF_SEG _mbufInsert (MBUF_ID mbufId1, MBUF_SEG mbufSeg, int offset, + MBUF_ID mbufId2); +extern MBUF_SEG _mbufInsertBuf (MBUF_ID mbufId, MBUF_SEG mbufSeg, int offset, + caddr_t buf, int len, VOIDFUNCPTR freeRtn, int freeArg); +extern MBUF_SEG _mbufInsertCopy (MBUF_ID mbufId, MBUF_SEG mbufSeg, + int offset, caddr_t buf, int len); +extern int _mbufExtractCopy (MBUF_ID mbufId, MBUF_SEG mbufSeg, + int offset, caddr_t buf, int len); +extern MBUF_SEG _mbufCut (MBUF_ID mbufId, MBUF_SEG mbufSeg, int offset, + int len); +extern MBUF_ID _mbufSplit (MBUF_ID mbufId, MBUF_SEG mbufSeg, int offset); +extern MBUF_ID _mbufDup (MBUF_ID mbufId, MBUF_SEG mbufSeg, int offset, + int len); +extern int _mbufLength (MBUF_ID mbufId); +extern MBUF_SEG _mbufSegFind (MBUF_ID mbufId, MBUF_SEG mbufSeg, int *pOffset); +extern MBUF_SEG _mbufSegNext (MBUF_ID mbufId, MBUF_SEG mbufSeg); +extern MBUF_SEG _mbufSegPrev (MBUF_ID mbufId, MBUF_SEG mbufSeg); +extern caddr_t _mbufSegData (MBUF_ID mbufId, MBUF_SEG mbufSeg); +extern int _mbufSegLength (MBUF_ID mbufId, MBUF_SEG mbufSeg); + +#else /* __STDC__ */ + +extern void * _mbufLibInit (); +extern MBUF_ID _mbufCreate (); +extern STATUS _mbufDelete (); +extern MBUF_SEG _mbufInsert (); +extern MBUF_SEG _mbufInsertBuf (); +extern MBUF_SEG _mbufInsertCopy (); +extern int _mbufExtractCopy (); +extern MBUF_SEG _mbufCut (); +extern MBUF_ID _mbufSplit (); +extern MBUF_ID _mbufDup (); +extern int _mbufLength (); +extern MBUF_SEG _mbufSegFind (); +extern MBUF_SEG _mbufSegNext (); +extern MBUF_SEG _mbufSegPrev (); +extern caddr_t _mbufSegData (); +extern int _mbufSegLength (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmbufLibh */ diff --git a/h/wrn/coreip/mbufSockLib.h b/h/wrn/coreip/mbufSockLib.h new file mode 100644 index 0000000..8111df3 --- /dev/null +++ b/h/wrn/coreip/mbufSockLib.h @@ -0,0 +1,57 @@ +/* mbufSockLib.h - mbuf socket interface library header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,04nov03,rlm Ran batch header path update for header re-org. +01b,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01a,19nov02,nee Ported to Accordion from ""mbufSockLib.h@@/main/1 from view tor3_x/tor3_x.synth". +*/ + +#ifndef __INCmbufSockLibh +#define __INCmbufSockLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void * _mbufSockLibInit (void); +extern int _mbufSockSend (int s, MBUF_ID mbufId, int mbufLen, int flags); +extern int _mbufSockSendto (int s, MBUF_ID mbufId, int mbufLen, int flags, + struct sockaddr *to, int tolen); +extern int _mbufSockBufSend (int s, char *buf, int bufLen, + VOIDFUNCPTR freeRtn, int freeArg, int flags); +extern int _mbufSockBufSendto (int s, char *buf, int bufLen, + VOIDFUNCPTR freeRtn, int freeArg, int flags, + struct sockaddr *to, int tolen); +extern MBUF_ID _mbufSockRecv (int s, int flags, int *pLen); +extern MBUF_ID _mbufSockRecvfrom (int s, int flags, int *pLen, + struct sockaddr *from, int *pFromLen); + +#else /* __STDC__ */ + +extern void * _mbufSockLibInit (); +extern int _mbufSockSend (); +extern int _mbufSockSendto (); +extern int _mbufSockBufSend (); +extern int _mbufSockBufSendto (); +extern MBUF_ID _mbufSockRecv (); +extern MBUF_ID _mbufSockRecvfrom (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmbufSockLibh */ diff --git a/h/wrn/coreip/md5.h b/h/wrn/coreip/md5.h new file mode 100644 index 0000000..458fddc --- /dev/null +++ b/h/wrn/coreip/md5.h @@ -0,0 +1,97 @@ +/* md5.h - md5 header file */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* MD5.H - header file for MD5C.C + * $FreeBSD: src/sys/sys/md5.h,v 1.14 2001/03/17 10:00:46 phk Exp $ + */ + +/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All +rights reserved. + +License to copy and use this software is granted provided that it +is identified as the "RSA Data Security, Inc. MD5 Message-Digest +Algorithm" in all material mentioning or referencing this software +or this function. + +License is also granted to make and use derivative works provided +that such works are identified as "derived from the RSA Data +Security, Inc. MD5 Message-Digest Algorithm" in all material +mentioning or referencing the derived work. + +RSA Data Security, Inc. makes no representations concerning either +the merchantability of this software or the suitability of this +software for any particular purpose. It is provided "as is" +without express or implied warranty of any kind. + +These notices must be retained in any copies of any part of this +documentation and/or software. + */ + +/* +modification history +-------------------- +01l,08mar05,vvv include cdefs.h only in kernel +01k,07feb05,vvv _KERNEL cleanup +01j,21nov03,rp added mdString required for PPP +01i,20nov03,niq Remove copyright_wrs.h file inclusion +01h,05nov03,cdw Removal of unnecessary _KERNEL guards. +01g,04nov03,rlm Ran batch header path update for header re-org. +01f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01e,10jun03,vvv include netVersion.h +01d,24apr03,pas changed API symbols to co-exist with WindManage SNMP +01c,06sep02,hsh add c++ protection +01b,28mar02,ppp making changes for the tornado build +01a,24sep01,hsh Created from BSD 4.3 +*/ + +#ifndef _SYS_MD5_H_ +#define _SYS_MD5_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define MD5Context _Clarinet_MD5Context +#define MD5_CTX _Clarinet_MD5_CTX +#define MD5Init _Clarinet_MD5Init +#define MD5Update _Clarinet_MD5Update +#define MD5Pad _Clarinet_MD5Pad +#define MD5Final _Clarinet_MD5Final +#define MD5Transform _Clarinet_MD5Transform +#define mdString _Clarinet_MDString + +/* MD5 context. */ +typedef struct MD5Context { + u_int32_t state[4]; /* state (ABCD) */ + u_int32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ +} MD5_CTX; + +/* Algorithms: MD4 or MD5 */ +typedef enum +{ + MD4 = 0x04, + MD5 = 0x05 +} MD_ALGORITHM; + +#ifdef _WRS_KERNEL +#include +#endif + +void MD5Init (MD5_CTX *); +void MD5Update (MD5_CTX *, const unsigned char *, unsigned int); +void MD5Final (unsigned char [16], MD5_CTX *); +void mdString ( unsigned char *, unsigned long, + unsigned char *, MD_ALGORITHM ); +#ifdef _WRS_KERNEL +void MD5Transform __P((u_int32_t [4], const unsigned char [64])); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_MD5_H_ */ diff --git a/h/wrn/coreip/mib/cidrLeaf.h b/h/wrn/coreip/mib/cidrLeaf.h new file mode 100644 index 0000000..f310ebf --- /dev/null +++ b/h/wrn/coreip/mib/cidrLeaf.h @@ -0,0 +1,86 @@ +/****************************************************************************** + ****************************************************************************** + **** This file was automatically generated by Wind River's + **** WindManage MIB Compiler, version 9.3. + **** This file was generated using the -leaf switch. + **** + **** This file #defines C preprocessor macros providing a variety of + **** information for the leaf objects in the MIB. + **** + **** The file includes a LEAF_xxx macro for each leaf object in the + **** MIB (xxx is replaced by the object's name). The value of the + **** LEAF_xxx macro is the final component of the object's object + **** identifier. + **** + **** If the object's SYNTAX clause included named INTEGER values, + **** then there is a VAL_xxx_yyy macro for each named value (xxx is + **** replaced by the object's name and yyy by the value's name). The + **** value of the VAL_xxx_yyy macro is the value associated with the + **** named value. + **** + **** If the object's SYNTAX clause specified a set of range limitations + **** for the value of the object, then there are one or more sets of + **** MIN_xxx and MAX_xxx macros specifying the lower and upper bound of + **** each range limitation. + **** + **** If the object's SYNTAX clause specified a set of size constraints + **** for the value of the object, then there are one or more sets of + **** MINSIZE_xxx and MAXSIZE_xxx macros specifying the lower and upper + **** bound of each size constraint. (If the size constraint is a single + **** value rather than a range then the MINSIZE_xxx and MAXSIZE_xxx + **** macros are replaced by a single SIZE_xxx macro.) + **** + **** DO NOT MODIFY THIS FILE BY HAND. + **** + **** Last build date: Fri Oct 04 17:21:16 2002 + **** from files: + **** C:\wind\T22_ACC\target\src\wrn\wm\snmp\std-mibs\rfc1213.mib, + **** C:\wind\T22_ACC\target\src\wrn\wm\snmp\std-mibs\rfc2096.mib + **** starting from node: ipForward + ****************************************************************************** + ****************************************************************************** + */ + +#define LEAF_ipCidrRouteNumber 3 +#define LEAF_ipCidrRouteDest 1 +#define LEAF_ipCidrRouteMask 2 +#define LEAF_ipCidrRouteTos 3 +#define LEAF_ipCidrRouteNextHop 4 +#define LEAF_ipCidrRouteIfIndex 5 +#define LEAF_ipCidrRouteType 6 +#define VAL_ipCidrRouteType_other 1L +#define VAL_ipCidrRouteType_reject 2L +#define VAL_ipCidrRouteType_local 3L +#define VAL_ipCidrRouteType_remote 4L +#define LEAF_ipCidrRouteProto 7 +#define VAL_ipCidrRouteProto_other 1L +#define VAL_ipCidrRouteProto_local 2L +#define VAL_ipCidrRouteProto_netmgmt 3L +#define VAL_ipCidrRouteProto_icmp 4L +#define VAL_ipCidrRouteProto_egp 5L +#define VAL_ipCidrRouteProto_ggp 6L +#define VAL_ipCidrRouteProto_hello 7L +#define VAL_ipCidrRouteProto_rip 8L +#define VAL_ipCidrRouteProto_isIs 9L +#define VAL_ipCidrRouteProto_esIs 10L +#define VAL_ipCidrRouteProto_ciscoIgrp 11L +#define VAL_ipCidrRouteProto_bbnSpfIgp 12L +#define VAL_ipCidrRouteProto_ospf 13L +#define VAL_ipCidrRouteProto_bgp 14L +#define VAL_ipCidrRouteProto_idpr 15L +#define VAL_ipCidrRouteProto_ciscoEigrp 16L +#define LEAF_ipCidrRouteAge 8 +#define LEAF_ipCidrRouteInfo 9 +#define LEAF_ipCidrRouteNextHopAS 10 +#define LEAF_ipCidrRouteMetric1 11 +#define LEAF_ipCidrRouteMetric2 12 +#define LEAF_ipCidrRouteMetric3 13 +#define LEAF_ipCidrRouteMetric4 14 +#define LEAF_ipCidrRouteMetric5 15 +#define LEAF_ipCidrRouteStatus 16 +#define VAL_ipCidrRouteStatus_active 1L +#define VAL_ipCidrRouteStatus_notInService 2L +#define VAL_ipCidrRouteStatus_notReady 3L +#define VAL_ipCidrRouteStatus_createAndGo 4L +#define VAL_ipCidrRouteStatus_createAndWait 5L +#define VAL_ipCidrRouteStatus_destroy 6L diff --git a/h/wrn/coreip/mib/cidrMapi.h b/h/wrn/coreip/mib/cidrMapi.h new file mode 100644 index 0000000..2c0116d --- /dev/null +++ b/h/wrn/coreip/mib/cidrMapi.h @@ -0,0 +1,78 @@ +/* + * cidrMapi.h + * + * This is a part of a WindManage SDK source code library. + * + * Copyright (C) 2002 WindRiver Systems. + * All rights reserved. + * Version 4.00 + * + */ + +/* WARNING: This file is generated by a WindManage Console + * Tool. Any changes made to this file may be overwritten by + * subsequent uses of the tool. */ + +#ifndef __WMMAPI_CIDR_HEADER__ +#define __WMMAPI_CIDR_HEADER__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Defines */ +/* %%BeginUserCode cidr_Defs */ +#define WMID_ipCidrRouteType_Other 1 +#define WMID_ipCidrRouteType_Reject 2 +#define WMID_ipCidrRouteType_Local 3 +#define WMID_ipCidrRouteType_Remote 4 + +#define WMID_ipCidrRouteStatus_Active 1 +#define WMID_ipCidrRouteStatus_NotInService 2 +#define WMID_ipCidrRouteStatus_NotReady 3 +#define WMID_ipCidrRouteStatus_CreateAndGo 4 +#define WMID_ipCidrRouteStatus_CreateAndWait 5 +#define WMID_ipCidrRouteStatus_Destroy 6 + +/* %%EndUserCode cidr_Defs */ + +/* %%BeginUserCode cidr_Enums */ +/* %%EndUserCode cidr_Enums */ + +/* Structures */ +/* %%BeginUserCode cidr_Structs */ +/* %%EndUserCode cidr_Structs */ + +/* Prototypes */ +/* %%BeginUserCode cidr_Protos */ +/* %%EndUserCode cidr_Protos */ + +enum { + WMID_ipCidrRouteAge, + WMID_ipCidrRouteDest, + WMID_ipCidrRouteIfIndex, + WMID_ipCidrRouteInfo, + WMID_ipCidrRouteMask, + WMID_ipCidrRouteMetric1, + WMID_ipCidrRouteMetric2, + WMID_ipCidrRouteMetric3, + WMID_ipCidrRouteMetric4, + WMID_ipCidrRouteMetric5, + WMID_ipCidrRouteNextHop, + WMID_ipCidrRouteNextHopAS, + WMID_ipCidrRouteNumber, + WMID_ipCidrRouteProto, + WMID_ipCidrRouteStatus, + WMID_ipCidrRouteTos, + WMID_ipCidrRouteType +}; + +STATUS cidrScalarMapi(mApiReqType_t command, mApiRequest_t *mapiRequest); +STATUS ipCidrRouteEntryMapi(mApiReqType_t command, mApiRequest_t *mapiRequest); + +#ifdef __cplusplus +} +#endif + +#endif /* __WMMAPI_CIDR_HEADER__*/ + diff --git a/h/wrn/coreip/mib/cidrSkel.h b/h/wrn/coreip/mib/cidrSkel.h new file mode 100644 index 0000000..537028a --- /dev/null +++ b/h/wrn/coreip/mib/cidrSkel.h @@ -0,0 +1,31 @@ +/****************************************************************************** + ****************************************************************************** + **** This file was automatically generated by Wind River's + **** WindManage MIB Compiler, version 9.3. + **** This file was generated using the -skel.h switch. + **** + **** This file contains declarations of stub functions to aid in building + **** the agent MIB interface. It declares all the MIB get, set, test and + **** next method routines that you will need to supply. You'll probably + **** want to FORCE-INCLUDE this file when using the -mib.c output mode. + **** + **** To generate the skeletal stub functions themselves, run the MIB compiler + **** with the -skel switch. + **** + **** YOU MAY MODIFY THIS FILE BUT BEWARE ACCIDENTALLY OVERWRITING IT + **** BY REGENERATING IT WITH THE MIB COMPILER. + **** + **** Last build date: Mon Oct 21 11:58:25 2002 + **** from files: + **** C:\wind\T22_ACC\target\src\wrn\wm\snmp\std-mibs\rfc1213.mib, + **** C:\wind\T22_ACC\target\src\wrn\wm\snmp\std-mibs\rfc2096.mib + ****************************************************************************** + ****************************************************************************** + */ + +void ipForward_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ipForward_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ipCidrRouteEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ipCidrRouteEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ipCidrRouteEntry_set(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ipCidrRouteEntry_test(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); diff --git a/h/wrn/coreip/mib/mibApi.h b/h/wrn/coreip/mib/mibApi.h new file mode 100644 index 0000000..69cfb2c --- /dev/null +++ b/h/wrn/coreip/mib/mibApi.h @@ -0,0 +1,213 @@ +/* mibApi.h - application neutral MIB API header file */ + +/* Copyright 2001-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +00d,24Apr02,tdi Updated per feedback from Kah C. +00c,08Mar02,tdi Updated per feedback from NAC, Kah C., David R., Margaret W. +00b,26Apr01,tdi Updated per feedback from NAC. +00a,19Apr01,tdi Created. +*/ + +/* +* DESCRIPTION: +* mibApi.h contains the common enumerations and data structures used to +* implement the "application neutral MIB API" (MIB API or MAPI). +*/ + +#ifndef __INCmibApih +#define __INCmibApih + +#ifdef __cplusplus +extern "C" { +#endif + +/* typedefs */ + +/****************************************************************************** +* mApiReqType_t -- MIB API Request Type typedef +* +* The 'mApiReqType_t' is used in conjunction with the MIB API function calls +* defined for each application protocol (e.g., OSPF). Note that a single SET +* request is not supported. The caller must make a series of requests to +* implement a "phased" SET. Shown below are ALL allowed request combinations +* for a single object SET. For brevity, the "MAPI_" is not included. +* - TEST, COMMIT, COMPLETE -- SET succeeds +* - TEST_FORCE, COMMIT, COMPLETE -- SET_FORCE read-only succeeds +* - COMMIT_NVM, COMPLETE -- SET_NVM succeeds +* - TEST, COMPLETE -- TEST failure +* - TEST_FORCE, COMPLETE -- TEST_FORCE failure +* - TEST, COMMIT, UNDO, COMPLETE -- COMMIT failure +* - TEST_FORCE, COMMIT, UNDO, COMPLETE -- COMMIT read-only failure +* - COMMIT_NVM, UNDO, COMPLETE -- COMMIT_NVM failure +* +* Note that a "COMPLETE" is ALWAYS required. +* +* The MAPI_GET_NVM enum provides a mechanism to obtain an object value that +* would normally be "invisible" when obtained with a MAPI_GET request. For +* example, when the standard RFC1850 'ospfIfAuthKey' object is read, the MIB +* states that an octet string of zero length must always be returned. This +* prevents any read access to this object (it is write-only). While this +* works OK for SNMP, it prevents the NVM save routine from getting the actual +* object value. This enum can be used to access any object that is normally +* hidden from the user such as passwords and authentication keys. +*/ + +typedef enum + { + MAPI_GET = 1, /* GET request */ + MAPI_GET_NEXT = 2, /* GET-NEXT request */ + MAPI_TEST = 3, /* TEST request -- for SET */ + MAPI_COMMIT = 4, /* COMMIT request -- for SET */ + MAPI_UNDO = 5, /* UNDO request -- for SET */ + MAPI_COMPLETE = 6, /* COMPLETE request -- for SET */ + MAPI_TEST_FORCE = 7, /* FORCE_SET read-only object -- for SET */ + MAPI_COMMIT_NVM = 8, /* NVM_SET w/o TEST/TEST_FORCE phase -- for SET */ + MAPI_GET_NVM = 9 /* GET "hidden" NVM value such as a password */ + } mApiReqType_t; + +/****************************************************************************** +* mApiException_t -- MIB API object 'exception' typedef +* +* Defines the 'exception' enumerations for the 'mApiObject_t' structure. +* +* Note that only GETs and GET-NEXTs support non-zero exceptions. SETs (i.e., +* TESTs, COMMITs, UNDOs and COMPLETEs) do not support non-zero exceptions. +*/ + +typedef enum + { + MAPI_NO_EXCEPTION = 0, /* no exception occurred */ + MAPI_NO_SUCH_OBJECT = 128, /* SNMPv2 noSuchObject exception */ + MAPI_NO_SUCH_INSTANCE = 129, /* SNMPv2 noSuchInstance exception */ + MAPI_END_OF_MIB_VIEW = 130, /* SNMPv2 endOfMibView exception */ + MAPI_BUFFER_TOO_SHORT = 1000 /* data buffer too short exception */ + } mApiException_t; + +/****************************************************************************** +* mApiError_t -- MIB API request 'error' typedef +* +* This typedef defines the SNMPv2 enumerations used with the MIB API for the +* 'error' value in the 'mApiRequest_t' structure. Note that the less specific +* SNMPv1 errors are explicitly absent and SHOULD NOT be used. +* +* The individual application protocol (e.g., OSPF) can also create its own +* enumerations to supply 'error' values for the 'mApiRequest_t' structure. +* It is recommended that these start at '100'. These should be added to the +* application protocol include file (not to this common MIB API header file). +*/ + +typedef enum + { + /* SNMPv2 specific errors */ + MAPI_NO_ERROR = 0, /* SNMPv2 noError(0) */ + MAPI_ERROR_TOO_BIG = 1, /* SNMPv2 errorTooBig(1) */ + /* do NOT use - SNMPv1 */ /* SNMPv1 noSuchName(2) */ + /* do NOT use - SNMPv1 */ /* SNMPv1 badValue(3) */ + /* do NOT use - SNMPv1 */ /* SNMPv1 readOnly(4) */ + MAPI_GEN_ERROR = 5, /* SNMPv2 genError(5) */ + MAPI_NO_ACCESS = 6, /* SNMPv2 noAccess(6) */ + MAPI_WRONG_TYPE = 7, /* SNMPv2 wrongType(7) */ + MAPI_WRONG_LENGTH = 8, /* SNMPv2 wrongLength(8) */ + MAPI_WRONG_ENCODING = 9, /* SNMPv2 wrongEncoding(9) */ + MAPI_WRONG_VALUE = 10, /* SNMPv2 wrongValue(10) */ + MAPI_NO_CREATION = 11, /* SNMPv2 noCreation(11) */ + MAPI_INCONSIST_VALUE = 12, /* SNMPv2 inconsistValue(12) */ + MAPI_RESOURCE_UNAVAILABLE = 13, /* SNMPv2 resourceUnavailable(13) */ + MAPI_COMMIT_FAILED = 14, /* SNMPv2 commitFailed(14) */ + MAPI_UNDO_FAILED = 15, /* SNMPv2 undoFailed(15) */ + MAPI_AUTHORIZATION_ERROR = 16, /* SNMPv2 authorizationError(16) */ + MAPI_NOT_WRITABLE = 17, /* SNMPv2 notWritable(17) */ + MAPI_INCONSIST_NAME = 18 /* SNMPv2 inconsistName(18) */ + } mApiError_t; + +/****************************************************************************** +* mApiObject_t -- MIB API Object typedef +* +* This structure contains information for a single MIB object and is used in +* conjunction with the 'mApiRequest_t' structure. When making the call, +* 'valueLen' contains the allocated byte length of the buffer. When returned, +* 'valueLen' contains the actual byte size of the data. The 'pValueBuf' void +* pointer is used to return the requested value. This reduces the stack +* requirements and eliminates the need for the calling routine to copy the +* data into its final location. Note that the data type is implied and is +* the value defined in the associated MIB for this object. +* +* The 'exception' contains one of the mApiException_t values. GETs and +* GET-NEXTs support non-zero exceptions; SETs do not support non-zero +* exceptions. If 'exception' contains MAPI_BUFFER_TOO_SHORT', then 'valueLen' +* contains the actual byte length of the data and no data is returned. The +* calling routine then has the option of making a new request using the proper +* size buffer. +* +* 'pObjCookie' points to object-level data defined by the MAPI handler and/or +* MAPI handler caller that can be a single variable or a structure. Unlike +* 'pReqCookie' in the mApiRequest_t structure, the 'pObjCookie' field can be +* set/used also by the MAPI handler caller. The use of this field must be +* clearly documented in specific header MAPI include file. +*/ + +typedef struct mApiObject_s + { + ulong_t oidPrefixEnum; /* enum for object OID Prefix */ + void * pValueBuf; /* pointer to value buffer */ + ulong_t valueLen; /* value byte length */ + mApiException_t exception; /* exception value for object */ + void * pObjCookie; /* pointer to MAPI object data */ + } mApiObject_t; + +/****************************************************************************** +* mApiRequest_t -- MIB API Request typedef +* +* This structure is used to make a request for a single MIB object or for +* multiple objects in a single SNMP table row. Consequently, only a single +* instance is required (and allowed) to process this request. +* +* 'pInstance' is a pointer to an array of unsigned long integers that contains +* the MIB object or table row instance information for a single object or row. +* It CANNOT be overloaded to contain index information for multiple rows. For +* GET-NEXT operations, the caller must use an instance array size that supports +* the expected instance length. 'instanceLen' contains the number of +* sub-identifiers in the instance. For a scalar, the instance is always '0' +* and the length is always '1'. For a GET-NEXT operation, the MIB API updates +* both the 'pInstance' and 'instanceLen' information. +* +* 'pObjectList' is a pointer to an array of 'mApiObject_t' structures that +* contains 'numObjects' elements. +* +* 'error' contains the error status for the entire request. It uses the +* 'mApiError_t' enumeration or an enumeration defined by the application +* protocol (e.g., OSPF). 'error' is zero (MAPI_NO_ERROR) if there is no error. +* If 'error' is non-zero, then the entire request has failed (i.e., no partial +* data is returned). The 'errorObjIndex' is a one-based index to the object +* that caused the error. For general errors not caused by any specific object, +* 'errorObjIndex' is '0'. Note that if this is a MAPI_UNDO request, and UNDO +* is not supported, 'error' will contain 'MAPI_UNDO_FAILED'. +* +* 'pReqCookie' points to request-level data defined by the MAPI handler that +* can be a single variable or a structure. This opaque "data", which is ONLY +* used by the MAPI handler, allows the handler to maintain (or remember) +* information between the various SET phases. The 'pReqCookie' SHOULD NOT be +* initialized or modified by the calling routine (that is, only the MAPI +* handler can modify this field). A typical use for this field is to point a +* structure that saves information from the TEST phase for use in the COMMIT +* phase. +*/ +typedef struct mApiRequest_s + { + ulong_t * pInstance; /* pointer to OID instance array */ + ushort_t instanceLen; /* number of sub-ids in instance */ + ushort_t numObjects; /* number of objects in request */ + mApiObject_t * pObjectList; /* pointer to array of object info */ + ushort_t error; /* error (non-zero) for entire request */ + ushort_t errorObjIndex; /* 1-based index to object causing error */ + void * pReqCookie; /* pointer to MAPI request opaque data */ + } mApiRequest_t; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCmibApih */ diff --git a/h/wrn/coreip/mip6/mip6.h b/h/wrn/coreip/mip6/mip6.h new file mode 100644 index 0000000..d41c657 --- /dev/null +++ b/h/wrn/coreip/mip6/mip6.h @@ -0,0 +1,56 @@ +/* mip6.h - MIP6 common data structure header file */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,28sep05,xli change parameter "mip6options" to "mip6CfgString" +01i,15aug05,xli added mipShutdownMn as a public api +01h,08aug05,tlu modify the public APIs +01g,03jul05,xli remove mip6InitializeMn() +01f,29jul05,xli changed the mip6CfgMnDaemon and mip6CfgMnMd prototypes +01e,19jul05,xli added configuration APIs +01d,23jun05,tlu move in public APIs and delete errno definition +01c,14jun05,tlu move errno definition to here and add _cplusplus condition +01b,31may05,tlu rename constants.h +01a,20feb05,tlu initial creation +*/ + + +#if !defined (_MIP6_H_) +#define _MIP6_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + + +typedef struct TASK_DESCRIPTOR +{ + int task_id; + int task_priority; + MIP6_TASK_STATES task_state; + int task_stack_size; + FUNCPTR task_start_func; + char task_name[11]; +} TASK_DESCRIPTOR; + + + +/* Public APIs */ +STATUS mnd(char* mip6CfgString); +STATUS mdd(char* mip6CfgString); +STATUS mip6MnDaemonShutdown(); +STATUS mip6MnMdShutdown(); +STATUS mip6MnShutdown(); + + +#ifdef __cplusplus +} +#endif + + +#endif /* _MIP6_H_ */ diff --git a/h/wrn/coreip/mip6/mip6_babymdd.h b/h/wrn/coreip/mip6/mip6_babymdd.h new file mode 100644 index 0000000..00b879c --- /dev/null +++ b/h/wrn/coreip/mip6/mip6_babymdd.h @@ -0,0 +1,136 @@ +/* mip6_babymdd.h - MIP6 movement detection header file */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* + * Copyright (C) 2004 WIDE Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* +modification history +-------------------- +01j,28sep05,xli change parameter "mip6options" to "mip6CfgString" +01i,01sep05,tlu rename mip6 file name +01h,03aug05,tlu add IAMUNKNOWN, fields wherewasi and hoa_info +01g,03jul05,xli remove mip6InitializeMd() +01f,29jul05,xli remove md_initialize_env() +01e,19jul05,xli move configruation API to mip6.h +01d,22jun05,tlu move out some public APIs +01c,14jun05,tlu add _cplusplus condition +01b,31may05,tlu rename constants.h +01a,04apr05,tlu 1st round of porting Kame MIP6 +*/ + + +#if !defined (_BABYMDD_H_) +#define _BABYMDD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define MD_BUFSIZE 8196 + +#define DEFAULT_CONFFILE "./mdd.conf" +#define DEFAULT_POLL 0 +#define DEFAULT_DEBUG 0 +#define DEFAULT_PRIORITY 0 +#define DEFAULT_LINKWIFIHIGH 30 +#define DEFAULT_LINKWIFILOW 15 +#define DEFAULT_LINKCHECK 10 + +#define DEBUG_NONE 0 +#define DEBUG_NORMAL 1 +#define DEBUG_HIGH 2 + +#define DEBUGHIGH (babyinfo.debug >= DEBUG_HIGH) +#define DEBUGNORM (babyinfo.debug >= DEBUG_NORMAL) +#define DEBUGNONE (babyinfo.debug == DEBUG_NONE) + +struct mdd_info { + int debug; + int linkpoll; + int dns; + int nondaemon; + + int rtsock; + int mipsock; + int linksock; + + int wherewasi; + int whereami; +#define IAMUNKNOWN 0 +#define IAMHOME 1 +#define IAMFOREIGN 2 + + struct if_info *coaif; + LIST_HEAD(, if_info) ifinfo_head; + + u_int16_t hoa_index; + LIST_HEAD(, hoa_info) hoainfo_head; + + struct if_info *hoa_info; /* interface for current HoA */ + +}; + +struct hoa_info { + LIST_ENTRY(hoa_info) hoainfo_entry; + + struct sockaddr_storage hoa;/* HoA */ +}; + + +struct if_info { + LIST_ENTRY(if_info) ifinfo_entry; + char ifname[IFNAMSIZ]; + u_int16_t ifindex; + + struct sockaddr_storage coa;/* Current CoA */ + struct sockaddr_storage pcoa;/* Previous CoA */ + + time_t lastsent; + + int priority; + int linkstatus; +}; + + +/* Private APIs */ +STATUS mn_create_md_task(); +STATUS mn_md_task_entry_ptr(); +STATUS md_initialize_default(); +STATUS mip6CfgMnMd(char* mip6CfgString); + + + +#ifdef __cplusplus +} +#endif + +#endif /* _BABYMDD_H_ */ diff --git a/h/wrn/coreip/mip6/mip6_command.h b/h/wrn/coreip/mip6/mip6_command.h new file mode 100644 index 0000000..5c5883f --- /dev/null +++ b/h/wrn/coreip/mip6/mip6_command.h @@ -0,0 +1,90 @@ +/* mip6_command.h - MIP6 user space program command header file */ +/* kept around to see whether to be reused for show routines */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* $KAME: command.h,v 1.1 2004/12/09 02:18:31 t-momose Exp $ */ + +/* + * Copyright (C) 2004 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* +modification history +-------------------- +01f,01spe05,tlu rename mip6 file name +01e,19aug05,xli change the show routine names +01d,27jul05,xli modified command show routine prototypes +01c,22jun05,tlu move in the show routines and debugging routines +01b,14jun05,tlu add _cplusplus condition +01a,22feb05,tlu 1st round of porting Kame MIP6 +*/ + + +#if !defined(_COMMAND_H_) +#define _COMMAND_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +struct command_table { + char *command; + void (*cmdfunc)(int, char *); + char *helpmsg; +}; + +int command_init(char *, struct command_table *, size_t, u_short); +*/ + +/* Show routines */ + +void mip6CommandInit(); +void mip6BindingCacheShow(); +void mip6KernelBindingCacheShow(); + +void mip6BindinfUpdateListShow(); +void mip6KernelBindinfUpdateListShow(); + +void mip6StatisticsShow(); + +void mip6StatusShow(char *); + +void imip6NoroShow(); + + +/* Debugging routines */ +void mip6DataEntryFlush(char *); + + +#ifdef __cplusplus +} +#endif + +#endif /* _COMMAND_H_ */ diff --git a/h/wrn/coreip/mip6/mip6_constants.h b/h/wrn/coreip/mip6/mip6_constants.h new file mode 100644 index 0000000..b9dfe72 --- /dev/null +++ b/h/wrn/coreip/mip6/mip6_constants.h @@ -0,0 +1,52 @@ +/* constants.h - MIP6 home agent routines */ + +/* Copyright 2005 Wind River Systems, Inc. */ + + +/* +modification history +-------------------- +01c,04jul05,tlu increase stack size +01b,14jun05,tlu add _cplusplus condition +01a,02mar05,tlu initial creation +*/ + + +#if !defined (_CONSTANTS_H_) +#define _CONSTANTS_H_ + + +#ifdef __cplusplus +extern "C" { +#endif + + +#define MN_TASK_DAEMON 0 +#define MN_TASK_MD 1 +#define HA_TASK_DAEMON 0 + +#define MN_DAEMON_TASK_PRIORITY 100 +#define MN_DAEMON_TASK_STACK_SIZE (50 * 1024) + +#define MN_MD_TASK_PRIORITY 100 +#define MN_MD_TASK_STACK_SIZE (50 * 1024) + +#define HA_DAEMON_TASK_PRIORITY 100 +#define HA_DAEMON_TASK_STACK_SIZE (50 * 1024) + +#define V6ADDRPRESZ 39 +#define IFNAMESZ 10 + + +typedef enum +{ + MIP6_TASK_STATE_CREATED = 1, + MIP6_TASK_STATE_INIT_COMPLETE +} MIP6_TASK_STATES; + + +#ifdef __cplusplus +} +#endif + +#endif /* _CONSTANTS_H_ */ diff --git a/h/wrn/coreip/mip6/mip6_had.h b/h/wrn/coreip/mip6/mip6_had.h new file mode 100644 index 0000000..f17914a --- /dev/null +++ b/h/wrn/coreip/mip6/mip6_had.h @@ -0,0 +1,62 @@ +/* mip6_had.c - MIP6 home agent header file */ + +/* Copyright 2005 Wind River Systems, Inc. */ + + +/* +modification history +-------------------- +01d,01sep05,tlu rename mip6 file name +01c,14jun05,tlu add _cplusplus condition +01b,31may05,tlu rename constants.h +01a,20apr05,tlu initial creation +*/ + + +#if !defined (_HAD_H_) +#define _HAD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include +#include + + +/* HA data structure */ +typedef struct HA_CLASS +{ + /* sockets for HA */ + int mipsock; /* an interface btw kernel/user and user/user space */ + int icmp6sock; /* to handle new ICMPv6 messages */ + int mhsock; /* to handle new mobile IPv6 messages */ + + /* lists */ + struct mip6stat mip6stat; + struct mip6_hpfx_list hpfx_head; + + /* home prefix */ + char homeprefix[V6ADDRPRESZ]; + int preference; + + /* task */ + TASK_DESCRIPTOR ha_tasks[1]; /* HA task */ + +} HA_CLASS; + + +STATUS ha_init(); +STATUS ha_cfg(); +STATUS ha_initialize_env(); +STATUS ha_create_tasks(); +STATUS ha_daemon_task_entry_ptr(); +STATUS ha_shutdown(); + + +#ifdef __cplusplus +} +#endif + +#endif /* _HAD_H_ */ diff --git a/h/wrn/coreip/mip6/mip6_mnd.h b/h/wrn/coreip/mip6/mip6_mnd.h new file mode 100644 index 0000000..137fd87 --- /dev/null +++ b/h/wrn/coreip/mip6/mip6_mnd.h @@ -0,0 +1,96 @@ +/* mip6_mnd.h - MIP6 mobile node header file */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* $KAME: mnd.h,v 1.1 2004/12/09 02:18:38 t-momose Exp $ */ +/* + * Copyright (C) 2004 WIDE Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* +modification history +-------------------- +01l,28sep05,xli change parameter "mip6options" to "mip6CfgString"` +01k,01sep05,tlu rename mip6 file name +01j,19aug05,tlu remove Kame defined global data structures +01i,09aug05,tlu add semaphore mn_data_mutex to protect MN's data structures +01h,08aug05,tlu modify the private APIs +01g,03jul05,xli remove mnInitializeDaemon +01f,21jul05,tlu add debug to configuration data +01e,19jul05,xli move mip6CfgMnDaemon() to mip6.h +01d,22jun05,tlu move out public APIs +01c,14jun05,tlu add _cplusplus condition +01b,31may05,tlu rename constants.h +01a,19feb05,tlu 1st round of porting Kame MIP6 +*/ + + +#if !defined (_MND_H_) +#define _MND_H_ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include +#include + + +/* MN meta structure */ +typedef struct MN_CLASS +{ + /* Configuration data */ + char homeagent[V6ADDRPRESZ]; + char hoa_ifname[IFNAMESZ]; + int debug; + + + /* semaphore used to protect global data structures */ + SEM_ID mn_data_mutex; + + + /* tasks */ + TASK_DESCRIPTOR mn_tasks[2]; /* MN tasks */ + +} MN_CLASS; + + +/* Private APIs */ +STATUS mn_create_daemon_task(); +STATUS mn_daemon_task_entry_ptr(); +STATUS mn_initialize_env(); +STATUS mn_initialize_default(); +STATUS mip6CfgMnDaemon(char* mip6CfgString); + + + +#ifdef __cplusplus +} +#endif + +#endif /* _MND_H_ */ diff --git a/h/wrn/coreip/mip6/mip6_shisad.h b/h/wrn/coreip/mip6/mip6_shisad.h new file mode 100644 index 0000000..f9e3f6f --- /dev/null +++ b/h/wrn/coreip/mip6/mip6_shisad.h @@ -0,0 +1,465 @@ +/* mip6_shisad.h - MIP6 basic data structure header file */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* $KAME: shisad.h,v 1.3 2004/12/27 10:50:33 t-momose Exp $ */ +/* + * Copyright (C) 2004 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* +modification history +-------------------- +01f,27sep05,tlu comment out debug and numerichost variables +01e,01sep05,tlu rename mip6 file name +01d,09aug05,tlu rename mip6stat to _mip6stat +01c,24jun05,tlu move out show routines and debugging routines +01b,14jun05,tlu add _cplusplus condition +01a,20feb05,tlu 1st round of porting Kame MIP6 +*/ + + +#ifndef _SHISAD_H_ +#define _SHISAD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Tong */ +#include + +extern struct mip6_mninfo mninfo; +extern int mipsock, mhsock, icmp6sock; +extern struct _mip6stat mip6stat; +extern struct mip6_hinfo_list hoa_head; + +/* protocol constants. */ +#define DHAAD_RETRIES 4 +#define MAX_BINDACK_TIMEOUT 32 +#define INITIAL_DHAAD_TIMEOUT 3 +#define INITIAL_BINDACK_TIMEOUT 1 + +#define MAX_DHAAD_TIMEOUT (INITIAL_DHAAD_TIMEOUT << DHAAD_RETRIES) +#define INITIAL_HOTI_COTI_TIMEOUT 1 +#define MAX_HOTI_COTI_TIMEOUT 32 + +/* protocol configuration variables. */ +extern int initial_bindack_timeout_first_reg_count; + +/* return routability parameters. */ +#define MIP6_MAX_TOKEN_LIFE 210 +#define MIP6_MAX_NONCE_LIFE 240 +#define MIP6_COOKIE_SIZE 8 +#define MIP6_TOKEN_SIZE 8 +#define MIP6_NONCE_SIZE 8 /* recommended by the spec (5.2.2) */ + /* must be multiple of size of u_short */ +#define MIP6_NODEKEY_SIZE 20 /* This size is specified at 5.2.1 in mip6 spec */ +#define MIP6_NONCE_HISTORY 10 +#define MIP6_NONCE_REFRESH 60 +#define MIP6_BRR_INTERVAL 3 +#define MIP6_KBM_SIZE 20 +#define MIP6_AUTHENTICATOR_SIZE 12 +#define MIP6_MAX_RR_BINDING_LIFE 420 +#define MIP6_DEFAULT_BINDING_LIFE 10 +#define MIP6_HOAOPT_PADLEN 4 /* length of Padding for HoA destination option */ + +typedef u_int8_t mip6_nonce_t[MIP6_NONCE_SIZE]; +typedef u_int8_t mip6_nodekey_t[MIP6_NODEKEY_SIZE]; +typedef u_int8_t mip6_cookie_t[MIP6_COOKIE_SIZE]; +typedef u_int8_t mip6_token_t[MIP6_TOKEN_SIZE]; +typedef u_int8_t mip6_kbm_t[MIP6_KBM_SIZE]; +typedef u_int8_t mip6_authenticator_t[MIP6_AUTHENTICATOR_SIZE]; + +/* Macro for modulo 2^^16 comparison */ +#define MIP6_LEQ(a,b) ((int16_t)((a)-(b)) <= 0) + +#define CND_PIDFILE "/var/run/cnd.pid" +#define MND_PIDFILE "/var/run/mnd.pid" +#define HAD_PIDFILE "/var/run/had.pid" + +#define MND_NORO_FILE "/etc/ro.deny" +#ifdef MIP_NEMO +#define NEMO_PTFILE "/etc/prefix_table.conf" +#endif /* MIP_NEMO */ + +#define _PATH_SHISADCONF "/usr/local/v6/etc/shisad.conf" + +/* + * homeprefix_info -> homeprefix_info -> ... + * | + * +-ha_list -> ha_list -> ... + */ +struct home_agent_list { + LIST_ENTRY(home_agent_list) hal_entry; + + /* common for mobile node and home agent */ + struct in6_addr hal_lladdr; /* Link-local address of HA */ + struct in6_addr hal_ip6addr; /* global IPv6 address of HA */ + + int hal_flag; +#define MIP6_HAL_OWN 0x01 +#define MIP6_HAL_STATIC 0x02 + + /* HA exclusive field: it is used when ha receives RA */ + struct mip6_halist_ha_exclusive { + u_int16_t halist_lifetime; /* Remaining lifetime */ + u_int16_t halist_preference; /* Preference for this HA */ + } hal_for_ha; +#define hal_lifetime hal_for_ha.halist_lifetime +#define hal_preference hal_for_ha.halist_preference + + CALLOUT_HANDLE hal_expire; /* callout handle for expiration */ +}; +LIST_HEAD(home_agent_list_head, home_agent_list); + +struct mip6_hpfxl { + LIST_ENTRY(mip6_hpfxl) hpfx_entry; + + /* common for mobile node and home agent */ + struct in6_addr hpfx_prefix; /* home prefix (may + contail full IPv6 + address) */ + u_int8_t hpfx_prefixlen; /* home prefix length */ + u_int8_t hpfx_flags; + struct home_agent_list_head hpfx_hal_head; /* home agent list head */ + + /* mn exclusive field: it is used when mn receives MPA */ + struct mip6_hpfx_mn_exclusive { + u_int32_t hpfxlist_vltime; + time_t hpfxlist_vlexpire; + u_int32_t hpfxlist_pltime; + time_t hpfxlist_plexpire; + time_t hpfxlist_timeout; /* expiration time */ + CALLOUT_HANDLE hpfxlist_retrans; /* callout handle for + retrans */ + } hpfx_for_mn; +#define hpfx_vltime hpfx_for_mn.hpfxlist_vltime +#define hpfx_vlexpire hpfx_for_mn.hpfxlist_vlexpire +#define hpfx_pltime hpfx_for_mn.hpfxlist_pltime +#define hpfx_plexpire hpfx_for_mn.hpfxlist_plexpire +#define hpfx_timeout hpfx_for_mn.hpfxlist_timeout +#define hpfx_retrans hpfx_for_mn.hpfxlist_retrans +}; +LIST_HEAD(mip6_hpfx_list, mip6_hpfxl); + +/* For Correspondent Node */ +struct mip6_nonces_info { + struct mip6_nonces_info *next, *prev; + u_int16_t nonce_index; + u_int8_t nonce[MIP6_NONCE_SIZE]; + u_int8_t node_key[MIP6_NODEKEY_SIZE]; + time_t nonce_lasttime; /* generated time */ +}; + +/* + * Per Home Address + * hoa_info: Home Address Information + * +- bul: Binding Update List + * + * Per Home Link + * mip_if: Virtual IF information + * +- hpfx: Home Prefix List + * +- hal: Home Agent List + * + * hoa_info ---> hoa_info -> hoa_info.. + * + + * +--bul -> bul -> bul.. + * | + * +--mpfx -> mpfx -> mpfx.. (NEMO only) + * + * mip_if -> mip_if -> mip_if.. + * + + * +-- hpfx -> hpfx -> hpfx.. + * +-- hal -> hal -> hal.. + */ +LIST_HEAD(binding_update_list_head, binding_update_list); +struct binding_update_list { + LIST_ENTRY(binding_update_list) bul_entry; + struct in6_addr bul_peeraddr; /* peer addr of this BU */ + struct in6_addr bul_coa; /* CoA */ + u_int16_t bul_lifetime; /* BU lifetime */ + u_int16_t bul_refresh; /* refresh frequency */ + u_int16_t bul_seqno; /* sequence number */ + u_int16_t bul_flags; /* BU flags */ + + /* The last time when mn sent the BU */ + time_t bul_bu_lastsent; + + mip6_cookie_t bul_home_cookie; + u_int16_t bul_home_nonce_index; + mip6_token_t bul_home_token; /* home keygen token */ + + mip6_cookie_t bul_careof_cookie; + u_int16_t bul_careof_nonce_index; + mip6_token_t bul_careof_token; /* careof keygen token */ + + struct mip6_hoainfo *bul_hoainfo; /* backpointer to hoa_info */ + int bul_home_ifindex; /* ifindex of home network */ + + u_int8_t bul_reg_fsm_state;/* registration state */ + u_int8_t bul_rr_fsm_state; /* rr state */ + + CALLOUT_HANDLE bul_retrans; /* callout handle for retrans */ + u_int8_t bul_retrans_time; + CALLOUT_HANDLE bul_expire; /* callout handle for failure */ + u_int8_t bul_state; /* local status */ + +#ifdef MIP_MCOA + u_int16_t bul_bid; /* Binding Unique Identifier */ + struct binding_update_list_head bul_mcoa_head; +#endif /* MIP_MCOA */ +}; + +#define MIP6_BUL_STATE_DISABLE 0x01 +/*#define MIP6_BUL_STATE_NEEDTUNNEL (MIP6_BUL_STATE_DISABLE)*/ + +/* + * it contains host information for which mnd does not run Route + * Opitimization (such as RR) + */ +struct noro_host_list { + LIST_ENTRY(noro_host_list) noro_entry; + struct in6_addr noro_host; + int prefixlen; /* currently not supported yet */ +}; +LIST_HEAD(no_ro_head, noro_host_list); + + +/* Home Address information (each HoA related info) */ +struct mip6_hoainfo { + LIST_ENTRY(mip6_hoainfo) hinfo_entry; + + struct in6_addr hinfo_hoa; /* Home Address */ + + /* if_index of mip virtual interface where HoA is assigned */ + u_int16_t hinfo_ifindex; + u_int8_t hinfo_location; /* Location where mn is located */ + + u_int16_t hinfo_dhaad_id; + time_t hinfo_dhaad_lastsent; + u_int16_t hinfo_mps_id; + time_t hinfo_mps_lastsent; + + struct binding_update_list_head hinfo_bul_head; /* Binding Update List */ +}; +LIST_HEAD(mip6_hinfo_list, mip6_hoainfo); + +#define MNINFO_MN_UNKNOWN 0x00 +#define MNINFO_MN_HOME 0x01 +#define MNINFO_MN_FOREIGN 0x02 + + +/* MIP Virtual Interface Information (each Home Link info) */ +struct mip6_mipif { + LIST_ENTRY(mip6_mipif) mipif_entry; + + struct mip6_hpfx_list mipif_hprefx_head; + + u_int16_t mipif_ifindex; + + /* will be added later */ +}; +LIST_HEAD(mip6_mipif_list, mip6_mipif); + +/* Parsing MH options */ +struct mip6_mobility_options { + struct ip6_mh_opt_refresh_advice *opt_refresh; + struct ip6_mh_opt_altcoa *opt_altcoa; + struct ip6_mh_opt_nonce_index *opt_nonce; + struct ip6_mh_opt_auth_data *opt_auth; + +#ifdef MIP_MCOA + struct ip6_mh_opt_bid *opt_bid; +#endif /* MIP_MCOA */ +}; + +/* Binding Cache */ +struct binding_cache { + LIST_ENTRY(binding_cache) bc_entry; + struct in6_addr bc_hoa; /* peer home address */ + struct in6_addr bc_coa; /* peer coa */ + struct in6_addr bc_myaddr; /* my addr (needed?) */ + u_int8_t bc_status; /* BA statue */ + u_int16_t bc_flags; /* recved BU flags */ + u_int16_t bc_seqno; /* recved BU seqno */ + u_int32_t bc_lifetime; /* recved BU lifetime */ + + time_t bc_expire; /* expiration time of this BC. */ + CALLOUT_HANDLE bc_refresh; /* callout handle for retrans */ + u_int8_t bc_refresh_count; + + + /* valid only when BUF_HOME */ + void *bc_dad; /* dad handler */ + time_t bc_mpa_exp; /* expiration time for MPA */ + struct binding_cache *bc_llmbc; + u_int32_t bc_refcnt; + u_int bc_brr_sent; +#ifdef MIP_MCOA + u_int16_t bc_bid; /* Binding Unique Identifier */ +#endif /* MIP_MCOA */ +}; +LIST_HEAD(binding_cache_head, binding_cache); + +/* +extern int debug, numerichost; +Tong: already defined in netinet6/in6_var.h +const char *ip6_sprintf(const struct in6_addr *addr); +*/ + +/* mh.c */ +STATUS mhsock_open(void); +void mhsock_close(void); +int mh_input_common(int); +int get_mobility_options(struct ip6_mh *, int, int, + struct mip6_mobility_options *); +int mip6_icmp6_create_haanyaddr(struct in6_addr *, struct in6_addr *, int); +int in6_mask2len(struct in6_addr *, u_char *); +struct home_agent_list *mip6_find_hal(struct mip6_hoainfo *); +int mh_input(struct in6_addr *, struct in6_addr *, + struct in6_addr *, struct in6_addr *, struct ip6_mh *, int); +#ifdef MIP_MCOA +int get_bid_option(struct ip6_mh *, int, int); +#endif /* MIP_MCOA */ +int send_brr(struct in6_addr *, struct in6_addr *); +int send_hoti(struct binding_update_list *); +int send_coti(struct binding_update_list *); +int send_bu(struct binding_update_list *); +int send_be(struct in6_addr *, struct in6_addr *, + struct in6_addr *, u_int8_t); +int send_hot(struct ip6_mh_home_test_init *, struct in6_addr *, + struct in6_addr *); +int send_cot(struct ip6_mh_careof_test_init *, struct in6_addr *, + struct in6_addr *); +int send_ba(struct in6_addr *, struct in6_addr *, struct in6_addr *, struct in6_addr *, + struct ip6_mh_binding_update *, mip6_kbm_t *, u_int8_t, u_int16_t, u_int16_t, int, u_int16_t); +void mip6_calculate_kbm(mip6_token_t *, mip6_token_t *, mip6_kbm_t *); +void mip6_calculate_authenticator(mip6_kbm_t *, struct in6_addr *, + struct in6_addr *, caddr_t, size_t, int, size_t, mip6_authenticator_t *); +struct mip6_nonces_info *get_nonces(u_int16_t); +struct mip6_nonces_info * generate_nonces(struct mip6_nonces_info *); +void init_nonces (void); +void create_keygentoken(struct in6_addr *, struct mip6_nonces_info *, + u_int8_t *, u_int8_t); + + +/* binding.c */ +struct binding_update_list *bul_get(struct in6_addr *, struct in6_addr *); +#ifndef MIP_MCOA +struct binding_update_list *bul_insert(struct mip6_hoainfo *, struct in6_addr *, + struct in6_addr *, u_int16_t); +#else /* MIP_MCOA */ +struct binding_update_list *bul_mcoa_get(struct in6_addr *, struct in6_addr *, u_int16_t); +struct binding_update_list *bul_insert(struct mip6_hoainfo *, struct in6_addr *, + struct in6_addr *, u_int16_t, u_int16_t); +#endif /* MIP_MCOA */ +void bul_remove(struct binding_update_list *); +struct binding_update_list *bul_get_nohoa(char *, struct in6_addr *, struct in6_addr *); +struct binding_update_list *bul_get_homeflag(struct in6_addr *); + +struct mip6_hoainfo *hoainfo_find_withhoa(struct in6_addr *); +struct mip6_hoainfo *hoainfo_insert(struct in6_addr *, u_int16_t); +int hoainfo_remove(struct in6_addr *); +struct mip6_hoainfo *hoainfo_get_withdhaadid (u_int16_t); +void mip6_bc_init(void); +void mip6_flush_kernel_bc(void); +void mip6_bc_delete(struct binding_cache *); +void mip6_bc_refresh_timer(void *); +void mipscok_bc_request(struct binding_cache *, u_char); + +struct binding_cache *mip6_bc_lookup(struct in6_addr *, struct in6_addr *, + u_int16_t); +struct binding_cache *mip6_bc_add(struct in6_addr *, struct in6_addr *, + struct in6_addr *, u_int32_t, u_int16_t, u_int16_t, u_int16_t); + +/* network.c */ +int set_ip6addr(char *, struct in6_addr *, int, int); +int delete_ip6addr(char *, struct in6_addr *, int); + +/* common.c */ +int mipsock_input_common(int); +STATUS mipsock_open(void); +int mipsock_nodetype_request(u_int8_t, u_int8_t); +int mipsock_behint_input(struct mip_msghdr *); +STATUS icmp6sock_open(void); +int icmp6_input_common(int); +void mip6_create_addr(struct in6_addr *, const struct in6_addr *, + struct in6_addr *, u_int8_t); +struct mip6_hpfxl *mip6_get_hpfxlist(struct in6_addr *, int, + struct mip6_hpfx_list *); +struct home_agent_list *mip6_get_hal(struct mip6_hpfxl *, struct in6_addr *); +void mip6_delete_hal(struct mip6_hpfxl *, struct in6_addr *); +int mip6_are_prefix_equal(struct in6_addr *, struct in6_addr *, int); +void mip6_flush_hal(struct mip6_hpfxl *, int); +void mip6_delete_hpfxlist(struct in6_addr *, u_int16_t, + struct mip6_hpfx_list *); +void hal_set_expire_timer(struct home_agent_list *, int); +void hal_stop_expire_timer(struct home_agent_list *); +void hal_expire_timer(void *); + +/* mnd.c */ +int mipsock_bul_request(struct binding_update_list *, u_char); +int mipsock_recv_mdinfo(struct mip_msghdr *); +#ifndef MIP_MCOA +int bul_update_by_mipsock_w_hoa(struct in6_addr *, struct in6_addr *); +#else +int bul_update_by_mipsock_w_hoa(struct in6_addr *, struct in6_addr *, + u_int16_t); +#endif /* MIP_MCOA */ +int mipsock_md_update_bul_byifindex(u_int16_t, struct in6_addr *); +int mipsock_md_dereg_bul(struct in6_addr *, struct in6_addr *, u_int16_t); +int send_haadreq(struct mip6_hoainfo *, int, struct in6_addr *); +struct home_agent_list *mnd_add_hal(struct mip6_hpfxl *, struct in6_addr *, int); +struct mip6_hpfxl *mnd_add_hpfxlist(struct in6_addr *, + u_int16_t, struct mip6_hpfx_mn_exclusive *, + struct mip6_hpfx_list *); +struct mip6_mipif *mnd_get_mipif(u_int16_t); +int send_na_home(struct in6_addr *, u_int16_t); +int set_default_bu_lifetime(struct mip6_hoainfo *); +struct noro_host_list *noro_get(struct in6_addr *); +void noro_add(struct in6_addr *); + +/* had.c */ +int mipsock_input(struct mip_msghdr *); +struct home_agent_list *had_add_hal(struct mip6_hpfxl *, struct in6_addr *, + struct in6_addr *, uint16_t, uint16_t, int); +struct mip6_hpfxl *had_add_hpfxlist(struct in6_addr *, u_int16_t); +int had_is_ha_if(u_int16_t); +struct mip6_hpfxl *had_is_myhomenet(struct in6_addr *); +int send_haadrep(struct in6_addr *, struct in6_addr *, + struct mip6_dhaad_req *, u_short); +int send_mpa(struct in6_addr *, u_int16_t, u_short); + + +#ifdef __cplusplus +} +#endif + +#endif /* _SHISAD_H_ */ diff --git a/h/wrn/coreip/mip6/mip6_stat.h b/h/wrn/coreip/mip6/mip6_stat.h new file mode 100644 index 0000000..f79c0e3 --- /dev/null +++ b/h/wrn/coreip/mip6/mip6_stat.h @@ -0,0 +1,109 @@ +/* mip6_stat.h - MIP6 statistics header file */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* $KAME: stat.h,v 1.1 2004/12/09 02:18:48 t-momose Exp $ */ +/* + * Copyright (C) 2004 WIDE Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* +modification history +-------------------- +01e,27sep05,tlu rename mip6stat variable +01d,01sep05,tlu rename mip6 file name +01c,09aug05,tlu rename mip6stat to _mip6stat +01b,14jun05,tlu add _cplusplus condition +01a,22feb05,tlu 1st round of porting Kame MIP6 +*/ + + +#if !defined(_STAT_H_) +#define _STAT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + + +struct _mip6stat { + u_quad_t mip6s_mobility; /* Mobility Header recieved */ + u_quad_t mip6s_omobility; /* Mobility Header sent */ + u_quad_t mip6s_hoti; /* HoTI recieved */ + u_quad_t mip6s_ohoti; /* HoTI sent */ + u_quad_t mip6s_coti; /* CoTI received */ + u_quad_t mip6s_ocoti; /* CoTI sent */ + u_quad_t mip6s_hot; /* HoT received */ + u_quad_t mip6s_ohot; /* HoT sent */ + u_quad_t mip6s_cot; /* CoT received */ + u_quad_t mip6s_ocot; /* CoT sent */ + u_quad_t mip6s_bu; /* BU received */ + u_quad_t mip6s_obu; /* BU sent */ + u_quad_t mip6s_ba; /* BA received */ + u_quad_t mip6s_ba_hist[256]; /* BA status input histgram */ + u_quad_t mip6s_oba; /* BA sent */ + u_quad_t mip6s_oba_hist[256]; /* BA status output histgram */ + u_quad_t mip6s_br; /* BR received */ + u_quad_t mip6s_obr; /* BR sent */ + u_quad_t mip6s_be; /* BE received */ + u_quad_t mip6s_be_hist[256]; /* BE status input histogram */ + u_quad_t mip6s_obe; /* BE sent */ + u_quad_t mip6s_obe_hist[256]; /* BE status output histogram */ + u_quad_t mip6s_hao; /* HAO received */ + u_quad_t mip6s_unverifiedhao; /* unverified HAO received */ + u_quad_t mip6s_ohao; /* HAO sent */ + u_quad_t mip6s_rthdr2; /* RTHDR2 received */ + u_quad_t mip6s_orthdr2; /* RTHDR2 sent */ + u_quad_t mip6s_revtunnel; /* reverse tunnel input */ + u_quad_t mip6s_orevtunnel; /* reverse tunnel output */ + u_quad_t mip6s_checksum; /* bad checksum */ + u_quad_t mip6s_payloadproto; /* payload proto != no nxt header */ + u_quad_t mip6s_unknowntype; /* unknown MH type value */ + u_quad_t mip6s_nohif; /* not my home address */ + u_quad_t mip6s_nobue; /* no related BUE */ + u_quad_t mip6s_hinitcookie; /* home init cookie mismatch */ + u_quad_t mip6s_cinitcookie; /* careof init cookie mismatch */ + u_quad_t mip6s_unprotected; /* not IPseced signaling */ + u_quad_t mip6s_haopolicy; /* BU is discarded due to bad HAO */ + u_quad_t mip6s_rrauthfail; /* RR authentication failed */ + u_quad_t mip6s_seqno; /* seqno mismatch */ + u_quad_t mip6s_paramprobhao; /* ICMP paramprob for HAO received */ + u_quad_t mip6s_paramprobmh; /* ICMP paramprob for MH received */ + u_quad_t mip6s_invalidcoa; /* Invalid Care-of address */ + u_quad_t mip6s_invalidopt; /* Invalid mobility options */ + u_quad_t mip6s_circularrefered; /* Circular reference */ + u_quad_t mip6s_mhtoosmall; /* MH too small */ +}; + +extern struct _mip6stat _mip6stat; + + +#ifdef __cplusplus +} +#endif + +#endif /* _STAT_H_ */ diff --git a/h/wrn/coreip/mountd.h b/h/wrn/coreip/mountd.h new file mode 100644 index 0000000..7117851 --- /dev/null +++ b/h/wrn/coreip/mountd.h @@ -0,0 +1,154 @@ +/* mountd.h - Mount protocol library header */ + +/* Copyright 2003 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,21jun04,vvv added virtual stack support +01a,22oct03,msc written +*/ + +#ifndef __INCmountdh +#define __INCmountdh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "wrn/netVersion.h" +#include "xdr_mnt3.h" +#include "xdr_mnt1.h" +#include "lstLib.h" + +/* mountLib defaults */ + +#define MAX_EXPORTED_FILESYSTEMS 30 +#define MOUNTD_PRIORITY_DEFAULT 55 +#define MOUNTD_STACKSIZE_DEFAULT 10240 + +/* mountLib status codes */ + +#define S_mountLib_ILLEGAL_MODE (M_mountLib | 1) + +/* DATA STRUCTURES */ + +typedef struct + { + char * next; /* next and prev are used by lstLib */ + char * prev; + char clientName [MAXHOSTNAMELEN + 1]; /* name of the host mounting this + * directory + */ + /* + * Mounted directory. Though it appears a single character, it is a char + * array. The array is allocated when a MOUNT_CLIENT struct is allocated. + * This change was required for adding configurable path length support. + */ + + char directory [1]; + } MOUNT_CLIENT; + +/* Exported file systems */ + +typedef struct + { + char * next; /* next and prev are used by lstLib */ + char * prev; + int dirFd; /* File descriptor for the exported directory */ + ULONG fsId; + int volumeId; /* Identifier for the file system */ + BOOL readOnly; + + /* + * This is a character array - memory is allocated when the struct is + * allocated. This change was required for adding configurable path + * length support. + */ + + char dirName [1]; + } NFS_EXPORT_ENTRY; + +/* MOUNT version 3 Argument */ +typedef union + { + dirpath mountproc_mnt_3_arg; + dirpath mountproc_umnt_3_arg; + } MOUNT3D_ARGUMENT; + +/* MOUNT version 1 argument */ +typedef union + { + dirpath mountproc_mnt_1_arg; + dirpath mountproc_umnt_1_arg; + } MOUNTD_ARGUMENT; + +/* Call back function pointers for MOUNT v1 and v3 */ +typedef void (*MOUNTCALLBACK)( struct svc_req *rqstp, register SVCXPRT *transp); + +/* Extern declarations */ +extern SEM_ID clientsSem; /* Sem controlling access to nfsClients */ +extern FUNCPTR mountdAuthHook; /* Hook to run to authorize packets */ +extern LIST * mountPoints; /* Linked list of exported mount points */ +extern SEM_ID mountSem; /* Sem controlling access to mountPoints */ +extern LIST * nfsClients; /* Linked list of clients mounting fs's */ +extern int fsIdNumber; /* ID number for exported file systems */ +extern int mountdNExports; /* max. num. exported FS's */ + +extern MOUNTCALLBACK mountv1CallBack; /* call back function for MOUNT v1 */ +extern MOUNTCALLBACK mountv3CallBack; /* call back function for MOUNT v3 */ + + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS mountdInit (int priority, int stackSize, FUNCPTR authHook, + int nExports, int options); + +#ifdef VIRTUAL_STACK +extern void mountd (int, int); +#else +extern void mountd (int); +#endif + +extern void mountdv1RequestProcess (struct svc_req *rqstp, + register SVCXPRT *transp); +extern void mount3dRequestProcess (struct svc_req *rqstp, + register SVCXPRT *transp); +extern void mount1dRequestProcess (struct svc_req *rqstp, + register SVCXPRT *transp); + +extern STATUS nfsExport (char * directory, int id, int mode, int options); +extern STATUS nfsUnexport (char * dirName); +extern NFS_EXPORT_ENTRY * nfsExportFindByName (char * dirName); +extern NFS_EXPORT_ENTRY * nfsExportFindById (int volumeId); + +extern MOUNT_CLIENT * mountListFind (struct svc_req * rqstp, dirpath * path); + +extern int fdToInode (int fd); +extern int nameToInode (int, char * fileName); +extern char * svc_reqToHostName (struct svc_req * rqstp, char * hostName); + + +#else + +extern STATUS mountdInit (); +extern void mountd (); +extern void mountdv1RequestProcess (); +extern void mount3dRequestProcess (); +extern void mount1dRequestProcess (); +extern STATUS nfsExport (); +extern STATUS nfsUnexport (); +extern NFS_EXPORT_ENTRY * nfsExportFindByName (); +extern NFS_EXPORT_ENTRY * nfsExportFindById (); +extern MOUNT_CLIENT * mountListFind (); +extern int fdToInode (); +extern int nameToInode (); +extern char * svc_reqToHostName (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmountdh */ diff --git a/h/wrn/coreip/muxL2Lib.h b/h/wrn/coreip/muxL2Lib.h new file mode 100644 index 0000000..92b66f9 --- /dev/null +++ b/h/wrn/coreip/muxL2Lib.h @@ -0,0 +1,285 @@ +/* muxL2Lib.h - definitions for the L2 MUX library */ + +/* + * Copyright (c) 1996-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01k,27sep05,kch Fixed documentation. Also removed the unsupported (unused) + MUXL2IOCSFLAGS and MUXL2IOCGFLAGS defines (SPR #112935). +01j,15sep05,kch Added MAX_VID, MIN_VID, MAX_VID, MIN_USER_PRIORITY, + MAX_USER_PRIORITY, IS_VALID_VID and IS_VALID_PRORITY macros + (SPR #112513). +01i,31aug05,kch Removed the non-standard global vlan id ioctl commands. Added + MUXL2IOCGPORTINFO ioctl command and MUX_L2_PORT_PARAMS + structure definition (SPR #112068). +01h,26aug05,kch Added EGRESS_FRAME_TYPE enum. Renamed MUX_L2_VLAN structure + to MUX_L2_PORT_VLAN. Replaced isEgressUntagged boolean with + etype EGRESS_FRAME_TYPE enumeration to handle the default + egress tagging state for pvid and other vids correctly. +01g,25aug05,kch Added prototypes muxL2PortAltAttach() and + muxL2PortTos2UpriorityRegister() for backward compatibility. +01f,24aug05,kch Added muxL2StatShow() and muxL2VlanStatShow() prototypes. +01e,23aug05,kch Added vlan tag related macros. +01d,18aug05,kch Added MUXL2IOCSGLOBALVIDJOIN and MUXL2IOCSGLOBALVIDLEAVE + commands. +01c,17aug05,kch Added muxL2VlanShow() prototype. Removed argument + 'verbose' from muxL2Show() prototype. +01b,17aug05,kch Added argument 'verbose' to muxL2Show() prototype. +01a,28jul05,kch written. +*/ + +/* +DESCRIPTION +This file includes function prototypes for the Layer 2 MUX. + +INCLUDE FILES: +*/ + +#ifndef __INCmuxL2Libh +#define __INCmuxL2Libh + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct mux_l2_config_params { + CFG_DATA_HDR cfgh; + + /* the number of ports that the device has */ + int cfg_priv_muxL2NumPorts; + + /* maximum number of 802.1Q VLANs that the device supports */ + int cfg_priv_muxL2MaxVlanSupport; + +} MUX_L2_CONFIG_PARAMS; + +/* + * The length of 802.1Q VAN encapsulation + */ +#define ETHER_VLAN_ENCAP_LEN 4 + +#define VLAN_ID_MASK 0x0fff /* 12 bits vlan id */ +#define PRIORITY_BITS 0xe000 /* bits 15..13 in the tag */ +#define PRIORITY_MASK 0x0007 /* 3 bit priority field */ + +#define GET_VLAN_ID(qTag) ((qTag) & VLAN_ID_MASK) +#define GET_VLAN_USER_PRIORITY(qTag) (((qTag) >> 13) & PRIORITY_MASK) + +/* + * 802.1Q VLAN definitions + */ +#define NULL_VID 0 /* for priority-tagged frame */ +#define MIN_VID 1 +#define MAX_VID 4094 + +/* + * The following defines defines the acceptable priority-level for 802.1Q + * priority-tagged frame + */ +#define MIN_USER_PRIORITY 0 +#define MAX_USER_PRIORITY 7 + +/* + * Macros for 802.1Q vlan-tag boundary checking + */ +#define IS_VALID_VID(pvid) ((pvid) >= MIN_VID && (pvid) <= MAX_VID) +#define IS_VALID_PRORITY(up) ((up) <= MAX_USER_PRIORITY) + +/* + * Ingress Acceptable Frame Type + */ +typedef enum { + ADMIT_ALL_FRAMES = 1, /* default */ + ADMIT_TAGGED_ONLY_FRAMES +} ACCEPT_FRAME_TYPE; + +/* + * Per 802.1Q 8.11.9 (note 2), the default tagging state for the pvid + * is untagged, and for all other vids are tagged, unless otherwise + * configured. + */ +typedef enum { + EGRESS_NOT_SPECIFIED = 0, /* not specified */ + EGRESS_TAGGED_FRAMES, /* send vlan-tagged frame for the given vlan */ + EGRESS_UNTAGGED_FRAMES /* send untagged frame for the given vlan */ +} EGRESS_FRAME_TYPE; + +/* + * sets to true if a port is attached to the layer 2, false + * if the port is detached from layer 2. If is true for END + * device, the interface's if_output routine is expected to use the + * pEnd->pFuncTable->formAddress to construct its ethernet header. For + * NPT-style device, the should be ignore for now (actual + * bahavior is currently not defined). + * + * indicates the mtu size upper layer protocols (e.g. IP) should + * apply to the interface. The value of the will be set to the + * existing hardware mtu size if one of the following applies: + * 1) hardware indicates it supports hardware VLAN tagging (e.g. the + * IFCAP_VLAN_HWTAGGING in if_capabilities is set), or + * 2) hardware doesn't support hardware VLAN tagging but capable of handling + * larger mtu that may include a software-appended VLAN header (e.g. the + * IFCAP_VLAN_MTU flag is set in if_capabilities) + * If none of the above is true, the existing hardware mtu size will be + * reduced by 4 bytes and reflects in . + */ +typedef struct mux_l2_port_params { + BOOL l2Attached; /* true if port is attached to layer 2, false if detach */ + unsigned long newMtu; +} MUX_L2_PORT_PARAMS; + +typedef struct mux_l2_port_vlan { + unsigned short vid; /* Valid Vid: 1..4094 */ + unsigned short upriority; /* User Priority, Valid Priority: 0..7 */ + EGRESS_FRAME_TYPE etype; /* default to untagged if not specified */ +} MUX_L2_PORT_VLAN; + +typedef struct mux_l2_port_vlan_membership { + unsigned short vid; /* VLAN to join/leave/modify */ + EGRESS_FRAME_TYPE etype; /* default to vlan-tagged if not specified */ +} MUX_L2_PORT_VLAN_MEMBERSHIP; + +typedef struct mux_l2_port_vlan_member_info { + unsigned short vid; + BOOL isMember; /* TRUE if port is a member of the vlan */ + EGRESS_FRAME_TYPE etype; /* egress frame type, tagged or untagged */ +} MUX_L2_PORT_VLAN_MEMBER_INFO; + +/* + * structure passed for SIOCMUXL2PASSTRHU ioctl. + * + * Required data field for MUX L2 SET ioctl commands: + * + * MUXL2IOCSPORTATTACH - none + * MUXL2IOCSPORTDETACH - none + * MUXL2IOCSPORTVLAN - portDefaultVlan.vid, portDefaultVlan.upriority, + * portDefaultVlan.etype (optional) + * MUXL2IOCSINGRESSFRAMETYPE - portIngressAcceptFrameType + * MUXL2IOCSINGRESSFILTER - portIngressFilter + * MUXL2IOCSEGRESSFRAMETYPE - portVlanMember.vid, portVlanMember.etype + * MUXL2IOCSVLANJOIN - portVlanMember.vid, portVlanMember.etype + * MUXL2IOCSVLANLEAVE - portVlanMember.vid, portVlanMember.etype not used + * + * The following data field(s) are required and will be filled in by the + * MUX L2 GET ioctl commands: + * + * MUXL2IOCGPORTINFO - portInfo.l2Attached portInfo.newMtu + * MUXL2IOCGPORTVLAN - portDefaultVlan.vid, portDefaultVlan.upriority, + * portDefaultVlan.etype + * MUXL2IOCGINGRESSFRAMETYPE - portIngressAcceptFrameType + * MUXL2IOCGINGRESSFILTER - portIngressFilter + * MUXL2IOCGVLANINFO - portVlanInfo.isMember, portVlanInfo.etype if port is + * a member of the specified vid (portVlanInfo.vid + * must be provided) + */ +typedef struct mux_l2_ioctl_req { + union { + /* layer 2 port parameters */ + MUX_L2_PORT_PARAMS portInfo; + + /* port-based vlan configuration */ + MUX_L2_PORT_VLAN portDefaultVlan; + + /* per-port Ingress Acceptable Frame Type */ + ACCEPT_FRAME_TYPE portIngressAcceptFrameType; + + /* per-port Ingress Rules */ + BOOL portIngressFilter; + + /* per-port per-VLAN membership configuration */ + MUX_L2_PORT_VLAN_MEMBERSHIP portVlanMember; + + /* per-port per-VLAN membership information */ + MUX_L2_PORT_VLAN_MEMBER_INFO portVlanInfo; + } data; +} MUX_L2_IOCTL_REQ; + +/* + * Supported MUX ioctl command for L2 on a per-port basis + * + * MUXL2IOCSPORTATTACH - create a binding between an END device and L2 MUX + * MUXL2IOCSPORTDETACH - detach the specified END device from L2 MUX + * MUXL2IOCGPORTINFO - get the device layer 2 port information + * MUXL2IOCSPORTVLAN - set the per-port default vid and user priority + * MUXL2IOCGPORTVID - get the per-port default vid and user priority + * MUXL2IOCSINGRESSFRAMETYPE - set the port Ingress Acceptable Frame Type + * MUXL2IOCGINGRESSFRAMETYPE - get the port Ingress Acceptable Frame Type + * MUXL2IOCSINGRESSFILTER - set the port Ingress Frame Filtering state + * MUXL2IOCGINGRESSFILTER - get the port Ingress Frame Filtering state + * MUXL2IOCSEGRESSFRAMETYPE - set Egress Acceptable Frame Type + * MUXL2IOCSVLANJOIN - join VLAN membership on a port + * MUXL2IOCSVLANLEAVE - leave VLAN membership on a port + * MUXL2IOCGVLANINFO - get VLAN membership for a port + */ + +#define MUXL2IOCSPORTATTACH _IOW('m', 1, MUX_L2_IOCTL_REQ) +#define MUXL2IOCSPORTDETACH _IOW('m', 2, MUX_L2_IOCTL_REQ) +#define MUXL2IOCGPORTINFO _IOR('m', 3, MUX_L2_IOCTL_REQ) + +/* port-based vlan get and set commands */ +#define MUXL2IOCSPORTVLAN _IOW('m', 4, MUX_L2_IOCTL_REQ) +#define MUXL2IOCGPORTVLAN _IOR('m', 5, MUX_L2_IOCTL_REQ) + +/* per-port ingress acceptable frame type get and set commands */ +#define MUXL2IOCSINGRESSFRAMETYPE _IOW('m', 6, MUX_L2_IOCTL_REQ) +#define MUXL2IOCGINGRESSFRAMETYPE _IOR('m', 7, MUX_L2_IOCTL_REQ) + +/* per-port ingress filter get and set commands */ +#define MUXL2IOCSINGRESSFILTER _IOW('m', 8, MUX_L2_IOCTL_REQ) +#define MUXL2IOCGINGRESSFILTER _IOR('m', 9, MUX_L2_IOCTL_REQ) + +#define MUXL2IOCSEGRESSFRAMETYPE _IOW('m', 10, MUX_L2_IOCTL_REQ) + +/* per-port vlan membership join/leave get and set commands */ +#define MUXL2IOCSVLANJOIN _IOW('m', 11, MUX_L2_IOCTL_REQ) +#define MUXL2IOCSVLANLEAVE _IOW('m', 12, MUX_L2_IOCTL_REQ) +#define MUXL2IOCGVLANINFO _IOR('m', 13, MUX_L2_IOCTL_REQ) + +#ifdef _WRS_KERNEL + +/* globals */ +IMPORT MUX_FUNCS _func_mux_l2; +IMPORT MUX_L2_CONFIG_PARAMS muxL2DefaultConfigParams; + + +/* prototypes */ + +IMPORT STATUS muxL2LibInit (void *muxL2InitValues); +IMPORT STATUS muxL2Ioctl (void* pCookie, int cmd, caddr_t data); +IMPORT void * muxL2EndTake (const char * pDevName, int unit); +IMPORT void muxL2EndGive (void * pCookie); +IMPORT STATUS muxL2PortAttach (char * pDevName, int unit); +IMPORT STATUS muxL2PortDetach (char * pDevName, int unit); +IMPORT void muxL2Show (char *pDevName, int unit); +IMPORT void muxL2VlanShow (unsigned short vid); +IMPORT void muxL2StatShow (char *pDevName, int unit); +IMPORT void muxL2VlanStatShow (unsigned short vid); + +/* the following prototypes are provided for backward compatibility */ +IMPORT STATUS muxL2PortAltAttach (char * pDevName, int unit, + BOOL updateNetFuncs, + M_BLK_ID (*formAddress)(), + STATUS (*packetDataGet)(), + STATUS (*ingressVlanTagCheck)()); +#ifdef VLAN_TAG +IMPORT STATUS muxL2PortTos2UpriorityRegister (char * pDevName, int unit, + unsigned char (*tos2UpriorityConvRtn) (unsigned char)); +#endif /* VLAN_TAG */ + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmuxL2Libh */ diff --git a/h/wrn/coreip/muxLib.h b/h/wrn/coreip/muxLib.h new file mode 100644 index 0000000..b0c70f0 --- /dev/null +++ b/h/wrn/coreip/muxLib.h @@ -0,0 +1,210 @@ +/* muxLib.h - definitions for the MUX library */ + +/* Copyright 1984 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +03p,25aug05,dlk Add section tags. +03o,28jul05,dlk Added muxErrorSkip() declaration. +03n,20feb05,dlk Added MUX_FUNCS, muxEndTake(), muxEndGive(), MUX_PASSTHRU. +03m,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +03l,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +03k,24nov03,wap Merge in changes from Snowflake +03j,20nov03,niq Remove copyright_wrs.h file inclusion +03i,04nov03,rlm Ran batch header path update for header re-org. +03h,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +03g,27oct03,cdw update include statements post header re-org. +03f,08sep03,vvv merged from ACCORDION_BASE6_MERGE_BASELINE +03e,06feb03,vvv merged from tor2_2-patch.alameda, ver02c (SPR #83258) +03d,03feb02,ham renamed dummyend.h to end.h. +03c,20feb02,ham changed for tornado build. +03b,09jan02,ann adding the field for the output function in MUX_ADDR_REC +03a,15may01,ann major changes as per MUX design doc for clarinet. + added some prototypes. code inherited from AE ver 02c. +*/ + +/* +DESCRIPTION +This file includes function prototypes for the MUX. + +INCLUDE FILES: +*/ + +#ifndef __INCmuxLibh +#define __INCmuxLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include + +#ifdef _WRS_KERNEL +#include +#else +#include +#endif /* _WRS_KERNEL */ + +/* defints */ + +/* MUX_MAX_IFTYPE associates with IFT_MAX_TYPE as default. If the user wants + * to add a resource function, verify it's smaller than MUX_MAX_IFTYPE. + */ + +#define MUX_MAX_IFTYPE M2_ifType_pmp + +/* Error defines. */ +#define S_muxLib_LOAD_FAILED (M_muxLib | 1) +#define S_muxLib_NO_DEVICE (M_muxLib | 2) +#define S_muxLib_INVALID_ARGS (M_muxLib | 3) +#define S_muxLib_ALLOC_FAILED (M_muxLib | 4) +#define S_muxLib_ALREADY_BOUND (M_muxLib | 5) +#define S_muxLib_UNLOAD_FAILED (M_muxLib | 6) +#define S_muxLib_NOT_A_TK_DEVICE (M_muxLib | 7) +#define S_muxLib_NO_TK_DEVICE (M_muxLib | 8) +#define S_muxLib_END_BIND_FAILED (M_muxLib | 9) + + +/* These are above all SAPs but still in the ethernet size range */ +/* so won't interfere with RFC 1700 */ +#define MUX_PROTO_PROMISC 0x100 +#define MUX_PROTO_SNARF 0x101 +#define MUX_PROTO_OUTPUT 0x102 + +/* + * The following defines are used for the various if-protocol functions + * that are maintained by the MUX function table. + */ + +#define ADDR_RES_FUNC 1 +#define IF_OUTPUT_FUNC 2 +#define MULTI_ADDR_RES_FUNC 4 + +/* typedefs */ + +/* structure passed for SIOCMUXPASSTRHU ioctl */ + +typedef struct _MUX_PASSTHRU + { + char name[END_NAME_MAX]; /* device name, without unit number */ + int unit; /* unit number. */ + u_int cmd; /* Tunnelled ioctl command. Must properly + encode size and IOC_IN/IOC_OUT/IOC_VOID, + and IOC_USER must be set if RTP access is + allowed. */ + void * pData; /* Tunnelled ioctl data argument */ + } MUX_PASSTHRU; + +#ifdef _WRS_KERNEL + +/* + * These data structures define the 2D list of address resolution + * functions. This list is ordered by ifType and the protocol. + */ +typedef struct mux_addr_rec + { + NODE node; + long protocol; + int setFuncs; + FUNCPTR addrResFunc; + FUNCPTR ifOutputFunc; + FUNCPTR multiAddrResFunc; + } MUX_ADDR_REC; + +/* function pointers for scalability */ + +typedef struct _MUX_FUNCS + { + void * (*endTake) (const char * pName, int unit); + void (*endGive) (void * pCookie); + int (*ioctl) (void* pCookie, int cmd, caddr_t data); + /* ADD MORE HERE AS NEEDED */ + } MUX_FUNCS; + +/* globals */ + +IMPORT MUX_FUNCS _func_mux; + +/* locals */ + +/* forward declarations */ + +_WRS_INITTEXT +IMPORT STATUS muxLibInit (); +IMPORT void * muxDevLoad(int unit, END_OBJ* (*endLoad) (char *, void*), + char *initString, + BOOL loaning, void*pBSP); +IMPORT STATUS muxDevStart(void* pCookie); +IMPORT STATUS muxDevStop(void* pCookie); +IMPORT void muxShow(char* pDevName, int unit); +IMPORT STATUS muxDevStopAll (int timeout); +IMPORT STATUS muxDevUnload(char* pName, int unit); +IMPORT void * muxBind (char * pName, int unit, + BOOL (*stackRcvRtn) (void*, long,M_BLK_ID, LL_HDR_INFO *, + void*), + STATUS (*stackShutdownRtn) (void*, void*), + STATUS (*stackTxRestartRtn) (void*, void*), + void (*stackErrorRtn) (END_OBJ*, END_ERR*, void*), + long type, char* pProtoName, void* pSpare); +IMPORT STATUS muxUnbind(void* pCookie, long type, FUNCPTR stackShutdownRtn); +_WRS_FASTTEXT +IMPORT STATUS muxSend(void* pCookie, M_BLK_ID pNBuff); +_WRS_FASTTEXT +IMPORT STATUS muxReceive(void* pCookie, M_BLK_ID pNBuff); +IMPORT STATUS muxPollSend(void* pCookie, M_BLK_ID pNBuff); +IMPORT STATUS muxPollReceive(void* pCookie, M_BLK_ID pNBuff); +IMPORT STATUS muxIoctl(void* pCookie, int cmd, caddr_t data); +IMPORT STATUS muxMCastAddrAdd(void* pCookie, char* pAddress); +IMPORT STATUS muxMCastAddrDel(void* pCookie, char* pAddress); +IMPORT STATUS muxMCastAddrGet(void* pCookie, MULTI_TABLE* pTable); +IMPORT char* muxLoanGet(void* pCookie); +IMPORT UINT8* muxRefCntGet(void* pCookie); +IMPORT void muxLoanRet(void* pCookie, char* pData, UINT8* pRef); +IMPORT M_BLK_ID muxLinkHeaderCreate(void* pCookie, M_BLK_ID pPacket, + M_BLK_ID pSrcAddr, M_BLK_ID pDstAddr, + BOOL bcastFlag); +IMPORT M_BLK_ID muxAddressForm(void* pCookie, M_BLK_ID pMblk, + M_BLK_ID pSrcAddr, M_BLK_ID pDstAddr); +IMPORT STATUS muxPacketDataGet(void* pCookie, M_BLK_ID pMblk, LL_HDR_INFO *); +IMPORT STATUS muxPacketAddrGet (void* pCookie, M_BLK_ID pMblk, + M_BLK_ID pSrc, + M_BLK_ID pDst, + M_BLK_ID pESrc, + M_BLK_ID pEDst); +_WRS_FASTTEXT +IMPORT void muxTxRestart(void* pCookie); + +IMPORT void muxError ( void* pCookie, END_ERR* pError ); +IMPORT void muxErrorSkip (void * pCookie, END_ERR * pError, + void * pSkipProtoCookie); + + +IMPORT END_OBJ* endFindByName(char* pName, int unit); +IMPORT END_OBJ* endFirstUnitFind (char* pDevName); +IMPORT STATUS muxAddrResFuncDel ( long ifType, long protocol ); +IMPORT FUNCPTR muxAddrResFuncGet ( long ifType, long protocol ); +IMPORT STATUS muxAddrResFuncAdd ( long ifType, long protocol, + FUNCPTR addrResFunc); +IMPORT STATUS muxIfFuncDel ( long ifType, long protocol, int funcType ); +IMPORT FUNCPTR muxIfFuncGet ( long ifType, long protocol, int funcType ); +IMPORT STATUS muxIfFuncAdd ( long ifType, long protocol, int funcType, + FUNCPTR ifFunc); + +IMPORT BOOL muxDevExists (char* pName, int unit); +IMPORT STATUS muxIterateByName (char * pName, FUNCPTR pCallbackRtn, + void * pCallbackArg); +IMPORT void * muxProtoPrivDataGet (END_OBJ * pEnd, int proto); + +IMPORT void * muxEndTake (const char * pName, int unit); +IMPORT void muxEndGive (void * pCookie); + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmuxLibh */ diff --git a/h/wrn/coreip/muxTkLib.h b/h/wrn/coreip/muxTkLib.h new file mode 100644 index 0000000..a199eb4 --- /dev/null +++ b/h/wrn/coreip/muxTkLib.h @@ -0,0 +1,94 @@ +/* muxTkLib.h - definitions for muxTkLib.c */ + +/* Copyright 1998 - 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02j,25aug05,dlk Add section tags. +02i,16may05,dlk Remove unsupported routine muxTkPktsReceive() unless + END_STYLE_MULTI_SUPPORT is defined. +02h,24nov03,wap Merge in changes from Snowflake +02g,20nov03,niq Remove copyright_wrs.h file inclusion +02f,04nov03,rlm Ran batch header path update for header re-org. +02e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +02d,22jul03,ann changed 6th argument of muxTkBind to VOIDFUNCPTR. +02c,01may03,spm Tornado 2.2 CP1 merge (from version 01k,14nov02,wap: + TOR2_2-CP1-F label, tor2_2-patch branch, /wind/river VOB) +02b,06feb03,vvv merged from tor2_2-patch.alameda, ver01k (SPR #83032) +02a,02may01,ann made major changes for Clarinet based on MUX design doc +01i,19apr00,ham merged TOR2_0-NPT-FCS(01h,29apr99,pul). +01h,29apr99,pul Upgraded NPT phase3 code to tor2.0.0 +01g,30mar99,pul removed all muxMCastMap and muxSvcFunc function declarations +01f,24feb99,sj added muxTkPollReceive +01e,23feb99,sj added spare data last argument for muxTkSend and muxTkPollSend +01d,06nov98,sj removed prototypes for muxTkReceive and nptHookRtn +01c,27oct98,pul changed nptHookRtn declaration to return STATUS. +01b,09oct98,sj fixed bad prototype for muxMCastMapFuncGet +01a,07oct98,pul written. +*/ + +/* +DESCRIPTION +This file includes function prototypes for the MUX. + +INCLUDE FILES: muxLib.h +*/ + +#ifndef __INCmuxTkLibh +#define __INCmuxTkLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include +/* defines */ + +/* typedefs */ + +/* locals */ + +/* globals */ +IMPORT int muxMaxBinds; + +/* forward declarations */ + +/* Toolkit functions */ +IMPORT STATUS muxTkLibInit (void); +IMPORT int muxTkDrvCheck (char * pDevName); + +IMPORT void * muxTkBind (char * pName, int unit, + FUNCPTR stackRcvRtn, + FUNCPTR stackShutdownRtn, + FUNCPTR stackTxRestartRtn, + VOIDFUNCPTR stackErrorRtn, + long type, char * pProtoName, void * pNetCallbackId, + void * pNetSvcInfo, void * pNetDrvInfo); + +_WRS_FASTTEXT +IMPORT STATUS muxTkSend (void * pCookie, M_BLK_ID pNBuff, char *, + USHORT, void *); +IMPORT STATUS muxTkPollSend (void * pCookie, M_BLK_ID pNBuff, char *, + USHORT, void *); +IMPORT STATUS muxTkPollReceive (void * pCookie, M_BLK_ID pNBuff, void *pSpare); +_WRS_FASTTEXT +STATUS muxTkReceive (void * pEndCookie, M_BLK_ID pMblk, long netSvcOffset, + long netSvcType, BOOL uniPromiscuous, void * pSpareData); + +IMPORT STATUS muxTkPollReceive2 (void *, M_BLK_ID pNBuff); + +IMPORT void * muxTkCookieGet (char *, int); + +#ifdef END_STYLE_MULTI_SUPPORT +_WRS_FASTTEXT +STATUS muxTkPktsReceive (void* pEndCookie, M_BLK_ID pMblk); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmuxTkLibh */ + diff --git a/h/wrn/coreip/net/af.h b/h/wrn/coreip/net/af.h new file mode 100644 index 0000000..41fb94f --- /dev/null +++ b/h/wrn/coreip/net/af.h @@ -0,0 +1,100 @@ +/* af.h - address family header file */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ +/* + * Copyright (c) 1980, 1986 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * @(#)af.h 7.3 (Berkeley) 6/27/88 + */ + + +/* +modification history +-------------------- +01l,05nov03,cdw Removal of unnecessary _KERNEL guards. +01k,04nov03,rlm Ran batch header path update for header re-org. +01j,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01i,10jun03,vvv include netVersion.h +01h,22sep92,rrr added support for c++ +01g,26may92,rrr the tree shuffle +01f,04oct91,rrr passed through the ansification filter + -changed copyright notice +01e,05oct90,shl added copyright notice. + made #endif ANSI style. +01d,16apr89,gae updated to new 4.3BSD. +01c,03apr87,ecs added header and copyright. +01b,22dec86,dnw added IMPORT to declaration of afswitch to satisfy + Intermetrics assembler. +*/ + +#ifndef __INCafh +#define __INCafh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * Address family routines, + * used in handling generic sockaddr structures. + * + * Hash routine is called + * af_hash(addr, h); + * struct sockaddr *addr; struct afhash *h; + * producing an afhash structure for addr. + * + * Netmatch routine is called + * af_netmatch(addr1, addr2); + * where addr1 and addr2 are sockaddr *. Returns 1 if network + * values match, 0 otherwise. + */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +struct afswitch { + int (*af_hash)(); + int (*af_netmatch)(); + int (*af_output)(); /* interprets address for sending */ + int (*af_portmatch)(); /* packet from some other router? */ + int (*af_portcheck)(); /* packet from privileged peer? */ + int (*af_checkhost)(); /* tells if address is valid */ + int (*af_rtflags)(); /* get flags for route (host or net) */ + int (*af_sendroute)(); /* check bounds of subnet broadcast */ + int (*af_canon)(); /* canonicalize address for compares */ + char *(*af_format)(); /* convert address to string */ +}; + +struct afhash { + u_int afh_hosthash; + u_int afh_nethash; +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +IMPORT struct afswitch afswitch[]; +extern int af_max; /* number of entries in table */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCafh */ diff --git a/h/wrn/coreip/net/bpf.h b/h/wrn/coreip/net/bpf.h new file mode 100644 index 0000000..79641c2 --- /dev/null +++ b/h/wrn/coreip/net/bpf.h @@ -0,0 +1,391 @@ +/* bpf.h - Berkeley Packet Filter (BPF) definitions and structures */ + +/* Copyright 1999-2003 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)bpf.h 7.1 (Berkeley) 5/7/91 + * + * $FreeBSD: src/sys/net/bpf.h,v 1.21.2.4 2002/07/05 14:40:00 fenner Exp $ + */ + +/* +modification history +-------------------- +01i,20nov03,niq Remove copyright_wrs.h file inclusion +01h,05nov03,cdw Removal of unnecessary _KERNEL guards. +01g,04nov03,rlm Ran batch header path update for header re-org. +01f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01e,10jun03,vvv include netVersion.h +01d,14may03,vvv included times.h +01c,01feb03,pas merge from FreeBSD 4.7 - added some DLT codes +01b,09sep02,hsh add c++ protection +01a,15oct01,nee created and ported from from bpf.h@@/main/tor3_x/tor3_x.windnet_ipv6/0 +*/ + +#ifndef BPF_MAJOR_VERSION + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* BSD style release date */ +#define BPF_RELEASE 199606 + +typedef int bpf_int32; +typedef u_int bpf_u_int32; + +/* + * Alignment macros. BPF_WORDALIGN rounds up to the next + * even multiple of BPF_ALIGNMENT. + */ +#define BPF_ALIGNMENT sizeof(bpf_int32) +#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1)) + +#define BPF_MAXINSNS 512 +#define BPF_MAXBUFSIZE 0x8000 +#define BPF_MINBUFSIZE 32 + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Structure for BIOCSETF. + */ +struct bpf_program { + u_int bf_len; + struct bpf_insn *bf_insns; +}; + +/* + * Struct returned by BIOCGSTATS. + */ +struct bpf_stat { + u_int bs_recv; /* number of packets received */ + u_int bs_drop; /* number of packets dropped */ +}; + +/* + * Struct return by BIOCVERSION. This represents the version number of + * the filter language described by the instruction encodings below. + * bpf understands a program iff kernel_major == filter_major && + * kernel_minor >= filter_minor, that is, if the value returned by the + * running kernel has the same major number and a minor number equal + * equal to or less than the filter being downloaded. Otherwise, the + * results are undefined, meaning an error may be returned or packets + * may be accepted haphazardly. + * It has nothing to do with the source code version. + */ +struct bpf_version { + u_short bv_major; + u_short bv_minor; +}; + +/* Current version number of filter architecture. */ +#define BPF_MAJOR_VERSION 1 +#define BPF_MINOR_VERSION 1 + +/* + * BPF ioctls + */ + +#define BIOCGBLEN _IOR('B',102, u_int) +#define BIOCSBLEN _IOWR('B',102, u_int) +#define BIOCSETF _IOW('B',103, struct bpf_program) +#define BIOCFLUSH _IO('B',104) +#define BIOCPROMISC _IO('B',105) +#define BIOCGDLT _IOR('B',106, u_int) +#define BIOCGETIF _IOR('B',107, struct ifreq) +#define BIOCSETIF _IOW('B',108, struct ifreq) +#define BIOCSRTIMEOUT _IOW('B',109, struct timeval) +#define BIOCGRTIMEOUT _IOR('B',110, struct timeval) +#define BIOCGSTATS _IOR('B',111, struct bpf_stat) +#define BIOCIMMEDIATE _IOW('B',112, u_int) +#define BIOCVERSION _IOR('B',113, struct bpf_version) +#define BIOCSTCPF _IOW('B',114, struct bpf_program) +#define BIOCSUDPF _IOW('B',115, struct bpf_program) + +/* + * Re-use (unsupported) BIOCSTCPF and BIOCSUDPF macro values + * for custom operations allowing BPF devices to pause and + * resume the filtering process (without closing the device). + */ + +#define BIOCSTOP _IO('B',114) +#define BIOCSTART _IOW('B',115, struct ifreq) + +/* + * Structure prepended to each packet. + */ +struct bpf_hdr { + struct timeval bh_tstamp; /* time stamp */ + bpf_u_int32 bh_caplen; /* length of captured portion */ + bpf_u_int32 bh_datalen; /* original length of packet */ + u_short bh_hdrlen; /* length of bpf header (this struct + plus alignment padding) */ + bpf_u_int32 bh_linklen; /* length of link level header */ +}; + +/* + * Data-link level type codes. + */ +#define DLT_NULL 0 /* no link-layer encapsulation */ +#define DLT_EN10MB 1 /* Ethernet (10Mb) */ +#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */ +#define DLT_AX25 3 /* Amateur Radio AX.25 */ +#define DLT_PRONET 4 /* Proteon ProNET Token Ring */ +#define DLT_CHAOS 5 /* Chaos */ +#define DLT_IEEE802 6 /* IEEE 802 Networks */ +#define DLT_ARCNET 7 /* ARCNET */ +#define DLT_SLIP 8 /* Serial Line IP */ +#define DLT_PPP 9 /* Point-to-point Protocol */ +#define DLT_FDDI 10 /* FDDI */ +#define DLT_ATM_RFC1483 11 /* LLC/SNAP encapsulated atm */ +#define DLT_RAW 12 /* raw IP */ + +/* + * These are values from BSD/OS's "bpf.h". + * These are not the same as the values from the traditional libpcap + * "bpf.h"; however, these values shouldn't be generated by any + * OS other than BSD/OS, so the correct values to use here are the + * BSD/OS values. + * + * Platforms that have already assigned these values to other + * DLT_ codes, however, should give these codes the values + * from that platform, so that programs that use these codes will + * continue to compile - even though they won't correctly read + * files of these types. + */ +#define DLT_SLIP_BSDOS 15 /* BSD/OS Serial Line IP */ +#define DLT_PPP_BSDOS 16 /* BSD/OS Point-to-point Protocol */ + +#define DLT_ATM_CLIP 19 /* Linux Classical-IP over ATM */ + +/* + * These values are defined by NetBSD; other platforms should refrain from + * using them for other purposes, so that NetBSD savefiles with link + * types of 50 or 51 can be read as this type on all platforms. + */ +#define DLT_PPP_SERIAL 50 /* PPP over serial with HDLC encapsulation */ +#define DLT_PPP_ETHER 51 /* PPP over Ethernet */ + +/* + * This value was defined by libpcap 0.5; platforms that have defined + * it with a different value should define it here with that value - + * a link type of 104 in a save file will be mapped to DLT_C_HDLC, + * whatever value that happens to be, so programs will correctly + * handle files with that link type regardless of the value of + * DLT_C_HDLC. + * + * The name DLT_C_HDLC was used by BSD/OS; we use that name for source + * compatibility with programs written for BSD/OS. + * + * libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well, + * for source compatibility with programs written for libpcap 0.5. + */ +#define DLT_C_HDLC 104 /* Cisco HDLC */ +#define DLT_CHDLC DLT_C_HDLC + +#define DLT_IEEE802_11 105 /* IEEE 802.11 wireless */ + +/* + * Values between 106 and 107 are used in capture file headers as + * link-layer types corresponding to DLT_ types that might differ + * between platforms; don't use those values for new DLT_ new types. + */ + +/* + * OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except + * that the AF_ type in the link-layer header is in network byte order. + * + * OpenBSD defines it as 12, but that collides with DLT_RAW, so we + * define it as 108 here. If OpenBSD picks up this file, it should + * define DLT_LOOP as 12 in its version, as per the comment above - + * and should not use 108 as a DLT_ value. + */ +#define DLT_LOOP 108 + +/* + * Values between 109 and 112 are used in capture file headers as + * link-layer types corresponding to DLT_ types that might differ + * between platforms; don't use those values for new DLT_ new types. + */ + +/* + * This is for Linux cooked sockets. + */ +#define DLT_LINUX_SLL 113 + +/* + * Apple LocalTalk hardware. + */ +#define DLT_LTALK 114 + +/* + * Acorn Econet. + */ +#define DLT_ECONET 115 + +/* + * Reserved for use with OpenBSD ipfilter. + */ +#define DLT_IPFILTER 116 + +/* + * Reserved for use in capture-file headers as a link-layer type + * corresponding to OpenBSD DLT_PFLOG; DLT_PFLOG is 17 in OpenBSD, + * but that's DLT_LANE8023 in SuSE 6.3, so we can't use 17 for it + * in capture-file headers. + */ +#define DLT_PFLOG 117 + +/* + * Registered for Cisco-internal use. + */ +#define DLT_CISCO_IOS 118 + +/* + * Reserved for 802.11 cards using the Prism II chips, with a link-layer + * header including Prism monitor mode information plus an 802.11 + * header. + */ +#define DLT_PRISM_HEADER 119 + +/* + * Reserved for Aironet 802.11 cards, with an Aironet link-layer header + * (see Doug Ambrisko's FreeBSD patches). + */ +#define DLT_AIRONET_HEADER 120 + +/* + * The instruction encodings. + */ +/* instruction classes */ +#define BPF_CLASS(code) ((code) & 0x07) +#define BPF_LD 0x00 +#define BPF_LDX 0x01 +#define BPF_ST 0x02 +#define BPF_STX 0x03 +#define BPF_ALU 0x04 +#define BPF_JMP 0x05 +#define BPF_RET 0x06 +#define BPF_MISC 0x07 + +/* ld/ldx fields */ +#define BPF_SIZE(code) ((code) & 0x18) +#define BPF_W 0x00 +#define BPF_H 0x08 +#define BPF_B 0x10 +#define BPF_MODE(code) ((code) & 0xe0) +#define BPF_IMM 0x00 +#define BPF_ABS 0x20 +#define BPF_IND 0x40 +#define BPF_MEM 0x60 +#define BPF_LEN 0x80 +#define BPF_MSH 0xa0 + +/* alu/jmp fields */ +#define BPF_OP(code) ((code) & 0xf0) +#define BPF_ADD 0x00 +#define BPF_SUB 0x10 +#define BPF_MUL 0x20 +#define BPF_DIV 0x30 +#define BPF_OR 0x40 +#define BPF_AND 0x50 +#define BPF_LSH 0x60 +#define BPF_RSH 0x70 +#define BPF_NEG 0x80 +#define BPF_JA 0x00 +#define BPF_JEQ 0x10 +#define BPF_JGT 0x20 +#define BPF_JGE 0x30 +#define BPF_JSET 0x40 +#define BPF_SRC(code) ((code) & 0x08) +#define BPF_K 0x00 +#define BPF_X 0x08 + +/* ret - BPF_K and BPF_X also apply */ +#define BPF_RVAL(code) ((code) & 0x18) +#define BPF_A 0x10 + +/* misc */ +#define BPF_MISCOP(code) ((code) & 0xf8) +#define BPF_TAX 0x00 +#define BPF_TXA 0x80 + +/* argument values for link-layer independence ((code) & 0x300) */ +#define BPF_TYPE 0x0100 /* MUX frame type value */ +#define BPF_HLEN 0x0200 /* Offset to start of frame data */ + +/* + * The instruction data structure. + */ +typedef struct bpf_insn { + u_short code; + u_char jt; + u_char jf; + bpf_int32 k; +} BPF_INSN; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Macros for insn array initializers. + */ +#define BPF_STMT(code, k) { (u_short)(code), 0, 0, k } +#define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k } + +extern u_int bpf_filter(); +extern int bpf_validate(); + +/* + * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST). + */ +#define BPF_MEMWORDS 16 + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/net/bpfdesc.h b/h/wrn/coreip/net/bpfdesc.h new file mode 100644 index 0000000..453eae7 --- /dev/null +++ b/h/wrn/coreip/net/bpfdesc.h @@ -0,0 +1,121 @@ +/* + * Copyright (c) 1990, 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)bpfdesc.h 8.1 (Berkeley) 6/10/93 + * + * $FreeBSD: src/sys/net/bpfdesc.h,v 1.14.2.2 2001/12/17 19:32:33 jdp Exp $ + */ + +#ifndef _NET_BPFDESC_H_ +#define _NET_BPFDESC_H_ + +#include +#include +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/* + * Descriptor associated with each open bpf file. + */ +struct bpf_d { + struct bpf_d *bd_next; /* Linked list of descriptors */ + /* + * Buffer slots: two mbuf clusters buffer the incoming packets. + * The model has three slots. Sbuf is always occupied. + * sbuf (store) - Receive interrupt puts packets here. + * hbuf (hold) - When sbuf is full, put cluster here and + * wakeup read (replace sbuf with fbuf). + * fbuf (free) - When read is done, put cluster here. + * On receiving, if sbuf is full and fbuf is 0, packet is dropped. + */ + caddr_t bd_sbuf; /* store slot */ + caddr_t bd_hbuf; /* hold slot */ + caddr_t bd_fbuf; /* free slot */ + int bd_slen; /* current length of store buffer */ + int bd_hlen; /* current length of hold buffer */ + + int bd_bufsize; /* absolute length of buffers */ + + struct bpf_if * bd_bif; /* interface descriptor */ + u_long bd_rtout; /* Read timeout in 'ticks' */ + struct bpf_insn *bd_filter; /* filter code */ + u_long bd_rcount; /* number of packets received */ + u_long bd_dcount; /* number of packets dropped */ + + u_char bd_promisc; /* true if listening promiscuously */ + u_char bd_state; /* idle, waiting, or timed out */ + u_char bd_immediate; /* true to return on packet arrival */ + int bd_hdrcmplt; /* false to fill in src lladdr automatically */ + int bd_seesent; /* true if bpf should see sent packets */ + int bd_async; /* non-zero if packet reception should generate signal */ + int bd_sig; /* signal to send upon packet reception */ + struct sigio * bd_sigio; /* information for async I/O */ +#if BSD < 199103 + u_char bd_selcoll; /* true if selects collide */ + int bd_timedout; + struct proc * bd_selproc; /* process that last selected us */ +#else + u_char bd_pad; /* explicit alignment */ + struct selinfo bd_sel; /* bsd select info */ +#endif + struct callout bd_callout; /* for BPF timeouts with select */ +}; + +/* Values for bd_state */ +#define BPF_IDLE 0 /* no select in progress */ +#define BPF_WAITING 1 /* waiting for read timeout in select */ +#define BPF_TIMED_OUT 2 /* read timeout has expired in select */ + +/* + * Descriptor associated with each attached hardware interface. + */ +struct bpf_if { + struct bpf_if *bif_next; /* list of all interfaces */ + struct bpf_d *bif_dlist; /* descriptor list */ + u_int bif_dlt; /* link layer type */ + u_int bif_hdrlen; /* length of header (with padding) */ + struct ifnet *bif_ifp; /* corresponding interface */ +}; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/net/domain.h b/h/wrn/coreip/net/domain.h new file mode 100644 index 0000000..63c87af --- /dev/null +++ b/h/wrn/coreip/net/domain.h @@ -0,0 +1,104 @@ +/* domain.h - communication domain structure and prototypes */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)domain.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/sys/sys/domain.h,v 1.14 1999/12/29 04:24:40 peter Exp $ + */ + +/* +modification history +-------------------- +01i,07feb05,vvv _KERNEL cleanup +01h,20nov03,niq Remove copyright_wrs.h file inclusion +01g,04nov03,rlm Ran batch header path update for header re-org. +01f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01e,06aug03,nee Accordion Base6 merge from ACCORDION_BASE6_MERGE_BASELINE + label +01d,03jan03,ann added the prototype for addDomain +01d,02dec02,spm merged from WINDNET_IPV6-1_0-FCS label (ver 01c,06sep02,hsh) +01c,26aug02,kal virtualised and moved to addDomain() +01b,03feb02,ham included cdefs.h for tornado build. +01a,15aug01,ann ported to clarinet from freeBSD 4.3 ver 1.14 + */ + +#ifndef _SYS_DOMAIN_H_ +#define _SYS_DOMAIN_H_ + +#ifdef _WRS_KERNEL +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/* + * Structure per communications domain. + */ + +/* + * Forward structure declarations for function prototypes [sic]. + */ +struct mbuf; + +struct domain { + int dom_family; /* AF_xxx */ + char *dom_name; + void (*dom_init) /* initialize domain data structures */ + __P((void)); + int (*dom_externalize) /* externalize access rights */ + __P((struct mbuf *)); + void (*dom_dispose) /* dispose of internalized rights */ + __P((struct mbuf *)); + struct protosw *dom_protosw, *dom_protoswNPROTOSW; + struct domain *dom_next; + int (*dom_rtattach) /* initialize routing table */ + __P((void **, int)); + int dom_rtoffset; /* an arg to rtattach, in bits */ + int dom_maxrtkey; /* for routing layer */ +}; + +#ifndef VIRTUAL_STACK +extern struct domain *domains; +#endif /* ! VIRTUAL_STACK */ +extern struct domain localdomain; +extern void net_add_domain(void *); +extern int addDomain (struct domain *); + +#ifdef __cplusplus +} +#endif +#endif /* _WRS_KERNEL */ +#endif /* _SYS_DOMAIN_H_ */ diff --git a/h/wrn/coreip/net/ethernet.h b/h/wrn/coreip/net/ethernet.h new file mode 100644 index 0000000..9076ac6 --- /dev/null +++ b/h/wrn/coreip/net/ethernet.h @@ -0,0 +1,137 @@ +/* ethernet.h - ethernet header file */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* + * Fundamental constants relating to ethernet. + * + * $FreeBSD: src/sys/net/ethernet.h,v 1.12.2.5 2000/07/19 21:43:52 archie Exp $ + * + */ + +/* +modification history +-------------------- +01j,07feb05,vvv _KERNEL cleanup +01i,20nov03,niq Remove copyright_wrs.h file inclusion +01h,05nov03,cdw Removal of unnecessary _KERNEL guards. +01g,04nov03,rlm Ran batch header path update for header re-org. +01f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01e,20aug03,niq Include cdefs.h for __BEGIN_DECLS definition (to correct + compilation issues +01d,10jun03,vvv include netVersion.h +01c,09sep02,hsh add c++ protection +01b,12sep01,ann adding a definition for ETHERSMALL +01a,07aug01,ham created from FreeBSD4.3-RELEASE(July-17-01). + */ + +#ifndef _NET_ETHERNET_H_ +#define _NET_ETHERNET_H_ + +#ifdef _WRS_KERNEL + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * The number of bytes in an ethernet (MAC) address. + */ +#define ETHER_ADDR_LEN 6 + +/* + * The number of bytes in the type field. + */ +#define ETHER_TYPE_LEN 2 + +/* + * The number of bytes in the trailing CRC field. + */ +#define ETHER_CRC_LEN 4 + +/* + * The length of the combined header. + */ +#define ETHER_HDR_LEN (ETHER_ADDR_LEN*2+ETHER_TYPE_LEN) + +/* + * The minimum packet length. + */ +#define ETHER_MIN_LEN 64 + +/* + * The maximum packet length. + */ +#define ETHER_MAX_LEN 1518 + +/* + * A macro to validate a length with + */ +#define ETHER_IS_VALID_LEN(foo) \ + ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN) + +/* + * Structure of a 10Mb/s Ethernet header. + */ +struct ether_header { + u_char ether_dhost[ETHER_ADDR_LEN]; + u_char ether_shost[ETHER_ADDR_LEN]; + u_short ether_type; +}; + +/* + * Structure of a 48-bit Ethernet address. + */ +struct ether_addr { + u_char octet[ETHER_ADDR_LEN]; +}; + +#define ETHERTYPE_PUP 0x0200 /* PUP protocol */ +#define ETHERTYPE_IP 0x0800 /* IP protocol */ +#define ETHERTYPE_ARP 0x0806 /* Addr. resolution protocol */ +#define ETHERTYPE_REVARP 0x8035 /* reverse Addr. resolution protocol */ +#define ETHERTYPE_VLAN 0x8100 /* IEEE 802.1Q VLAN tagging */ +#define ETHERTYPE_IPV6 0x86dd /* IPv6 */ +#define ETHERTYPE_LOOPBACK 0x9000 /* used to test interfaces */ +/* XXX - add more useful types here */ + +/* + * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have + * (type-ETHERTYPE_TRAIL)*512 bytes of data followed + * by an ETHER type (as given above) and then the (variable-length) header. + */ +#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */ +#define ETHERTYPE_NTRAILER 16 + +#define ETHERMTU (ETHER_MAX_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN) +#define ETHERMIN (ETHER_MIN_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN) + +/* Clarinet */ +#define ETHERSMALL 60 + +/* + * For device drivers to specify whether they support BPF or not + */ +#define ETHER_BPF_UNSUPPORTED 0 +#define ETHER_BPF_SUPPORTED 1 + +struct ifnet; +struct mbuf; + +/* + * Ethernet address conversion/parsing routines. + */ + +struct ether_addr *ether_aton __P((const char *)); +int ether_hostton __P((const char *, struct ether_addr *)); +int ether_line __P((const char *, struct ether_addr *, char *)); +char *ether_ntoa __P((const struct ether_addr *)); +int ether_ntohost __P((char *, const struct ether_addr *)); + +#ifdef __cplusplus +} +#endif +#endif /* _WRS_KERNEL */ +#endif /* !_NET_ETHERNET_H_ */ diff --git a/h/wrn/coreip/net/fastUdp6Lib.h b/h/wrn/coreip/net/fastUdp6Lib.h new file mode 100644 index 0000000..e04a2e9 --- /dev/null +++ b/h/wrn/coreip/net/fastUdp6Lib.h @@ -0,0 +1,115 @@ +/* fastUdp6Lib.h - defines for the Fast UDP library */ + +/* Copyright 2002 - 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,05nov03,cdw Removal of unnecessary _KERNEL guards. +01c,04nov03,rlm Ran batch header path update for header re-org. +01b,15sep03,vvv updated path for new headers +01a,10dec02,hgo copied from fastUdpLib.c +*/ + +#ifndef __INCfastudp6Libh +#define __INCfastudp6Libh + +/* includes */ + +#include +#include +#include +#include +#include +#include +#include + +/* defines */ + +/* Fast UDP error numbers */ + +#define S_fastUdp6Lib_INVALID_PORT (M_fastUdpLib | 1) +#define S_fastUdp6Lib_INVALID_COOKIE (M_fastUdpLib | 2) +#define S_fastUdp6Lib_INVALID_ARGS (M_fastUdpLib | 3) +#define S_fastUdp6Lib_MEM_ERROR (M_fastUdpLib | 4) +#define S_fastUdp6Lib_INVALID_OPTION (M_fastUdpLib | 5) +#define S_fastUdp6Lib_NOT_INITIALIZED (M_fastUdpLib | 6) +#define S_fastUdp6Lib_NO_IPV4MAPPED_SUPPORT (M_fastUdpLib | 7) + +/* Fast UDP options */ + +#define RCV_BUFSIZE 0x0001 /* size of receive buffer in bytes */ +#define RCV_LOWAT 0x0002 /* receive low-water mark */ +#define RCV_V6ONLY 0x0003 /* receiver doesn't allow IPv4-mapped IPv6 addresses */ + +/* Fast UDP cookie */ + +typedef struct fastUdp6 + { + struct fastUdp6 *next; + SEM_ID recvSem; /* synchronization sem for receive queue */ + M_BLK_ID recvData; /* head of receive queue */ + u_int recvDataLen; /* amount of data in receive queue */ + M_BLK_ID lastPkt; /* last packet in receive queue */ + struct udp6Options *options; /* Fast UDP options */ + u_short port; /* Fast UDP port */ + u_short error; /* error number */ + struct sockaddr_in6 errorAddr; /* address which sent error notification */ + int applTaskId; + } *FASTUDP6_ID; + +struct udp6Options + { + u_int rcvBuf; /* limit on receive buffer */ + u_int rcvLowat; /* receive buffer low-water mark */ + BOOL rcvV6Only; /* receiver doesn't allow IPv4-mapped IPv6 addresses */ + }; + +/* Entry in port configuration table */ + +typedef struct port6Tbl + { + u_short startPort; + u_short endPort; + } PORT6_TBL; + +typedef struct + { + NODE node; + u_short startPort; + u_short endPort; + } PORT6ENTRY; + +/* fastUdp configuration parameters */ + +typedef struct fastUdp6_config_params { + CFG_DATA_HDR cfgh; + + u_int cfg_priv_fastUdp6Debug; + PORT6_TBL *cfg_pPortCfgTbl; + u_int cfg_portCfgTblEntries; + } FASTUDP6_CONFIG_PARAMS; + +#ifdef __cplusplus +extern "C" { +#endif + +/* forward declarations */ + +STATUS fastUdp6LibInit (PORT6_TBL *tbl, int numEntries); +STATUS fastUdp6Add (u_short startPort, u_short endPort); +STATUS fastUdp6Del (u_short startPort, u_short endPort); +FASTUDP6_ID fastUdp6Bind (u_short port); +STATUS fastUdp6Unbind (FASTUDP6_ID pCookie); +STATUS fastUdp6Send (u_short port, ZBUF_ID data, int dataLen, + struct sockaddr_in6 * dstAddr, void * pDummy); +ZBUF_ID fastUdp6Recv (FASTUDP6_ID pCookie, int *dataLen, + struct sockaddr_in6 *srcAddr); +STATUS fastUdp6OptionSet (FASTUDP6_ID pCookie, u_short option, void *val); +void fastUdp6DebugSet (u_int debugStatus); + +#ifdef __cplusplus +} +#endif + +#endif __INCfastudp6Libh diff --git a/h/wrn/coreip/net/fastUdpLib.h b/h/wrn/coreip/net/fastUdpLib.h new file mode 100644 index 0000000..532cd59 --- /dev/null +++ b/h/wrn/coreip/net/fastUdpLib.h @@ -0,0 +1,117 @@ +/* fastUdpLib.h - defines for the Fast UDP library */ + +/* Copyright 2002 - 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,05nov03,cdw Removal of unnecessary _KERNEL guards. +01f,04nov03,rlm Ran batch header path update for header re-org. +01e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01d,15sep03,vvv updated path for new headers +01c,08nov02,hgo added configuration parameters, fastUdpInitialized +01b,01aug02,spm fixed modification history after automatic merge +01a,18jul02,wrs automatic merge from version 1 of Accordion Munich branch: + (copied from Router Stack release: 01a,04jun02,vvv) +*/ + +#ifndef __INCfastudpLibh +#define __INCfastudpLibh + +/* includes */ + +#include +#include +#include +#include +#include +#include +#include + +/* defines */ + +/* Fast UDP error numbers */ + +#define S_fastUdpLib_INVALID_PORT (M_fastUdpLib | 1) +#define S_fastUdpLib_INVALID_COOKIE (M_fastUdpLib | 2) +#define S_fastUdpLib_INVALID_ARGS (M_fastUdpLib | 3) +#define S_fastUdpLib_MEM_ERROR (M_fastUdpLib | 4) +#define S_fastUdpLib_INVALID_OPTION (M_fastUdpLib | 5) +#define S_fastUdpLib_NOT_INITIALIZED (M_fastUdpLib | 6) + + +/* Fast UDP options */ + +#define RCV_BUFSIZE 0x0001 /* size of receive buffer in bytes */ +#define RCV_LOWAT 0x0002 /* receive low-water mark */ + +/* Fast UDP cookie */ + +typedef struct fastUdp + { + struct fastUdp *next; + SEM_ID recvSem; /* synchronization sem for receive queue */ + M_BLK_ID recvData; /* head of receive queue */ + u_int recvDataLen; /* amount of data in receive queue */ + M_BLK_ID lastPkt; /* last packet in receive queue */ + struct udpOptions *options; /* Fast UDP options */ + u_short port; /* Fast UDP port */ + u_short error; /* error number */ + struct sockaddr_in errorAddr; /* address which sent error notification */ + int applTaskId; + } *FASTUDP_ID; + +struct udpOptions + { + u_int rcvBuf; /* limit on receive buffer */ + u_int rcvLowat; /* receive buffer low-water mark */ + }; + +/* Entry in port configuration table */ + +typedef struct portTbl + { + u_short startPort; + u_short endPort; + } PORT_TBL; + +typedef struct + { + NODE node; + u_short startPort; + u_short endPort; + } PORTENTRY; + +/* fastUdp configuration parameters */ + +typedef struct fastUdp_config_params { + CFG_DATA_HDR cfgh; + + u_int cfg_priv_fastUdpDebug; + PORT_TBL *cfg_pPortCfgTbl; + u_int cfg_portCfgTblEntries; + } FASTUDP_CONFIG_PARAMS; + +#ifdef __cplusplus +extern "C" { +#endif + +/* forward declarations */ + +STATUS fastUdpLibInit (PORT_TBL *tbl, int numEntries); +STATUS fastUdpAdd (u_short startPort, u_short endPort); +STATUS fastUdpDel (u_short startPort, u_short endPort); +FASTUDP_ID fastUdpBind (u_short port); +STATUS fastUdpUnbind (FASTUDP_ID pCookie); +STATUS fastUdpSend (u_short port, ZBUF_ID data, int dataLen, + struct sockaddr_in * dstAddr); +ZBUF_ID fastUdpRecv (FASTUDP_ID pCookie, int *dataLen, + struct sockaddr_in *srcAddr); +STATUS fastUdpOptionSet (FASTUDP_ID pCookie, u_short option, void *val); +void fastUdpDebugSet (u_int debugStatus); + +#ifdef __cplusplus +} +#endif + +#endif __INCfastudpLibh diff --git a/h/wrn/coreip/net/if.h b/h/wrn/coreip/net/if.h new file mode 100644 index 0000000..9b01ee6 --- /dev/null +++ b/h/wrn/coreip/net/if.h @@ -0,0 +1,457 @@ +/* if.h - network interface header file */ + +/* Copyright 2001 - 2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/if.h,v 1.58.2.9 2002/08/30 14:23:38 sobomax Exp $ + */ + +/* +modification history +-------------------- +02i,30aug05,kch Added ifdeladdrreq structure (moved from if.c) (SPR #112068). +02h,17aug05,mcm Including sys/time.h for struct timeval +02g,26jul05,kch Move if_clone structure definition to if_clone.h. +02f,30jun05,wap Move ifi_link_state for binary compatibility +02e,24jun05,wap Add link state support +02d,18feb05,wap Allow sysctl init routines to be scaled out +02c,07feb05,vvv _KERNEL cleanup +02b,14jan05,vvv osdep.h cleanup +02a,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01z,19jul04,niq Move sysctl initialization from configelette to the component + init routine +01y,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/2) +01x,09feb04,niq Include if_var.h only in kernel context +01w,14dec03,ijm added IFF_PROXY_ALL for spr#85896,for interface based proxy +01v,20nov03,niq osdep.h cleanup +01u,04nov03,rlm Ran batch header path update for header re-org. +01t,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01s,24oct03,rlm updated #includes for header re-org +01r,15sep03,vvv updated path for new headers +01q,18aug03,nee Merging from ACCORDION_BASE6_MERGE_BASELINE +01p,15may03,spm Tornado 2.2 FCS merge (SPR #69683; ver 01m,10oct01,rae: + TOR2_2-FCS-COPY label, tor2 branch, /wind/river VOB) +01o,09may03,vvv included socket.h +01n,08may03,vvv fixed value for IFF_PPROMISC (SPR #88237) +01m,01may03,spm Tornado 2.2 CP1 merge (from ver 01n,17jan03,vvv: + TOR2_2-CP1-F label, tor2_2-patch branch, /wind/river VOB) +01l,01feb03,pas merge from FreeBSD 4.7 - clone, announce interfaces +01k,17sep02,nee added admin control macros +01j,09sep02,hsh add c++ protection +01i,24aug02,nee extended ifnet for admin control;defined admin states for + boot/up/down +01h,12jul02,hsh fix head file for ppc +01g,03feb02,ham modified for tornado build. +01f,16dec01,ann temporarily moving the if_name* declerations out the _KERNEL + condition +01e,24sep01,ppp adding the prototype for if_name and the macro for IFAREF +01d,12sep01,ann adding some IFF flags +01c,11sep01,ann uncomment ifi_lastchange +01b,09sep01,ham changed header file's path, made ifi_lastchange obsolete. +01a,16jul01,ham created from FreeBSD4.3-RELEASE(July-17-01). +*/ + +#ifndef __INCifh +#define __INCifh + +#ifdef _WRS_KERNEL +#include +#include +#else +#include +#endif + +#include +#include + + + +#ifdef __cplusplus + extern "C" { +#endif + +typedef struct if_config_params { + CFG_DATA_HDR cfgh; + int if_index_limit; + int ifq_max_len; + FUNCPTR cfg_privInitSysctl; +} IF_CONFIG_PARAMS; + +struct ifnet; + +/* + * Length of interface external name, including terminating '\0'. + * Note: this is the same size as a generic device's external name. + */ +#define IFNAMSIZ 16 +#define IF_NAMESIZE IFNAMSIZ + +/* + * Structure used to query names of interface cloners. + */ + +struct if_clonereq { + int ifcr_total; /* total cloners (out) */ + int ifcr_count; /* room for this many in user buffer */ + char *ifcr_buffer; /* buffer for cloner names */ +}; + +/* + * Structure describing information about an interface + * which may be of interest to management entities. + */ +struct if_data { + /* generic interface information */ + u_char ifi_type; /* ethernet, tokenring, etc */ + u_char ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */ + u_char ifi_addrlen; /* media address length */ + u_char ifi_hdrlen; /* media header length */ + u_char ifi_recvquota; /* polling quota for receive intrs */ + u_char ifi_xmitquota; /* polling quota for xmit intrs */ + u_char ifi_link_state; /* current link state */ + u_long ifi_mtu; /* maximum transmission unit */ + u_long ifi_metric; /* routing metric (external only) */ + u_long ifi_baudrate; /* linespeed */ + /* volatile statistics */ + u_long ifi_ipackets; /* packets received on interface */ + u_long ifi_ierrors; /* input errors on interface */ + u_long ifi_opackets; /* packets sent on interface */ + u_long ifi_oerrors; /* output errors on interface */ + u_long ifi_collisions; /* collisions on csma interfaces */ + u_long ifi_ibytes; /* total number of octets received */ + u_long ifi_obytes; /* total number of octets sent */ + u_long ifi_imcasts; /* packets received via multicast */ + u_long ifi_omcasts; /* packets sent via multicast */ + u_long ifi_iqdrops; /* dropped on input, this interface */ + u_long ifi_noproto; /* destined for unsupported protocol */ + u_long ifi_hwassist; /* HW offload capabilities */ + u_long ifi_unused; /* XXX was ifi_xmittiming */ + struct timeval ifi_lastchange; /* time of last administrative change */ +}; + +#define IFF_UP 0x1 /* interface link is up */ +#define IFF_BROADCAST 0x2 /* broadcast address valid */ +#define IFF_DEBUG 0x4 /* turn on debugging */ +#define IFF_LOOPBACK 0x8 /* is a loopback net */ +#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */ +#define IFF_SMART 0x20 /* interface manages own routes */ +#define IFF_RUNNING 0x40 /* resources allocated */ +#define IFF_NOARP 0x80 /* no address resolution protocol */ +#define IFF_PROMISC 0x100 /* receive all packets */ +#define IFF_ALLMULTI 0x200 /* receive all multicast packets */ +#define IFF_OACTIVE 0x400 /* transmission in progress */ +#define IFF_SIMPLEX 0x800 /* can't hear own transmissions */ +#define IFF_LINK0 0x1000 /* forwarding disabled */ +#define IFF_LINK1 0x2000 /* per link layer defined bit */ +#define IFF_LINK2 0x4000 /* per link layer defined bit */ +#define IFF_ALTPHYS IFF_LINK2 /* use alternate physical connection */ +#define IFF_MULTICAST 0x8000 /* supports multicast */ +#define IFF_NOTRAILERS 0x20000 /* avoid use of trailers */ +#define IFF_INET_UP 0x40000 /* interface is up for ipv4 */ +#define IFF_INET6_UP 0x80000 /* interface is up for ipv6 */ +#define IFF_UNNUMBERED IFF_POINTOPOINT /* supports unnumbered interfaces */ + +#define IFF_FPV4_ENABLE 0x100000 /* supports V4 fast forwarding */ +#define IFF_FPV6_ENABLE 0x200000 /* supports V6 fast forwarding */ +#define IFF_PROXY_ALL 0x400000 /* enable Cisco style proxying */ + +#define IFF_DONT_FORWARD IFF_LINK0 /* forwarding disabled */ + +/* + * The following flag(s) ought to go in if_flags, but we cannot change + * struct ifnet because of binary compatibility, so we store them in + * if_ipending, which is not used so far. + * If possible, make sure the value is not conflicting with other + * IFF flags, so we have an easier time when we want to merge them. + */ +#define IFF_POLLING 0x10000 /* Interface is in polling mode. */ +#define IFF_PPROMISC 0x800000 /* user-requested promisc mode */ + +/* flags set internally only: */ +#define IFF_CANTCHANGE \ + (IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\ + IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI|IFF_SMART|IFF_POLLING) + +#define IFF_UP_FLAGS (IFF_UP | IFF_INET_UP | IFF_INET6_UP) + +/* + * Values for if_link_state. + */ +#define LINK_STATE_UNKNOWN 0 /* link invalid/unknown */ +#define LINK_STATE_DOWN 1 /* link is down */ +#define LINK_STATE_UP 2 /* link is up */ + +/* Capabilities that interfaces can advertise. */ +#define IFCAP_RXCSUM 0x0001 /* can offload checksum on RX */ +#define IFCAP_TXCSUM 0x0002 /* can offload checksum on TX */ +#define IFCAP_NETCONS 0x0004 /* can be a network console */ + +#define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM) + +#define IFQ_MAXLEN 50 +#define IFNET_SLOWHZ 1 /* granularity is 1 second */ + + +/* admin flags */ +#define ADMIN_BOOT 0 /* for future use */ +#define ADMIN_UP 1 /* for future use */ +#define ADMIN_DOWN 2 /* for future use */ + +/* + * + * If admin status(RFC 2465) is ADMIN_BOOT/ADMIN_UP set the + * corresponding(v4/v6) interface flag. + * Check for a valid ifa. For ipv6 should have + * atleast one (valid) ifa for which DAD has succeeded + */ + +#define IFF_INET_UPDATE(ifp) \ +if (ifp->admin_inet_status == ADMIN_UP || ifp->admin_inet_status == ADMIN_BOOT)\ + {if (in_ifexists_ifa(ifp)) \ + (ifp)->if_flags |= IFF_INET_UP;} \ +else \ + log(LOG_WARNING, "Admin status is down for IPv4 traffic on interface %s%d\n",ifp->if_name,ifp->if_unit); \ + +#define IFF_INET6_UPDATE(ifp) \ +if (ifp->admin_inet6_status == ADMIN_UP || ifp->admin_inet6_status == ADMIN_BOOT)\ + {if (in6_ifexists_ifa(ifp)) \ + (ifp)->if_flags |= IFF_INET6_UP;} \ +else \ + log(LOG_WARNING, "Admin status is down for IPv6 traffic on interface %s%d\n",ifp->if_name,ifp->if_unit); \ + +/* + * Message format for use in obtaining information about interfaces + * from getkerninfo and the routing socket + */ +struct if_msghdr { + u_short ifm_msglen; /* to skip over non-understood messages */ + u_char ifm_version; /* future binary compatability */ + u_char ifm_type; /* message type */ + int ifm_addrs; /* like rtm_addrs */ + int ifm_flags; /* value of if_flags */ + u_short ifm_index; /* index for associated ifp */ + struct if_data ifm_data;/* statistics and other data about if */ +}; + +/* + * Message format for use in obtaining information about interface addresses + * from getkerninfo and the routing socket + */ +struct ifa_msghdr { + u_short ifam_msglen; /* to skip over non-understood messages */ + u_char ifam_version; /* future binary compatability */ + u_char ifam_type; /* message type */ + int ifam_addrs; /* like rtm_addrs */ + int ifam_flags; /* value of ifa_flags */ + u_short ifam_index; /* index for associated ifp */ + int ifam_metric; /* value of ifa_metric */ +}; + +/* + * Message format for use in obtaining information about multicast addresses + * from the routing socket + */ +struct ifma_msghdr { + u_short ifmam_msglen; /* to skip over non-understood messages */ + u_char ifmam_version; /* future binary compatability */ + u_char ifmam_type; /* message type */ + int ifmam_addrs; /* like rtm_addrs */ + int ifmam_flags; /* value of ifa_flags */ + u_short ifmam_index; /* index for associated ifp */ +}; + +/* + * Message format announcing the arrival or departure of a network interface. + */ +struct if_announcemsghdr { + u_short ifan_msglen; /* to skip over non-understood messages */ + u_char ifan_version; /* future binary compatibility */ + u_char ifan_type; /* message type */ + u_short ifan_index; /* index for associated ifp */ + char ifan_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + u_short ifan_what; /* what type of announcement */ +}; + +#define IFAN_ARRIVAL 0 /* interface arrival */ +#define IFAN_DEPARTURE 1 /* interface departure */ + +/* + * Interface request structure used for socket + * ioctl's. All interface ioctl's must have parameter + * definitions which begin with ifr_name. The + * remainder may be interface specific. + */ +struct sockaddr; + +struct ifreq { + char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + union { + struct sockaddr ifru_addr; + struct sockaddr ifru_dstaddr; + struct sockaddr ifru_broadaddr; + long ifru_flags[2]; + int ifru_metric; + int ifru_mtu; + int ifru_phys; + int ifru_media; + caddr_t ifru_data; + int ifru_cap[2]; + } ifr_ifru; +#define ifr_addr ifr_ifru.ifru_addr /* address */ +#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ +#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ +#define ifr_flags ifr_ifru.ifru_flags[0] /* flags (low 16 bits) */ +#define ifr_flagshigh ifr_ifru.ifru_flags[1] /* flags (high 16 bits) */ +#define ifr_metric ifr_ifru.ifru_metric /* metric */ +#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ +#define ifr_phys ifr_ifru.ifru_phys /* physical wire */ +#define ifr_media ifr_ifru.ifru_media /* physical media */ +#define ifr_data ifr_ifru.ifru_data /* for use by interface */ +#define ifr_reqcap ifr_ifru.ifru_cap[0] /* requested capabilities */ +#define ifr_curcap ifr_ifru.ifru_cap[1] /* current capabilities */ +}; + +#define _SIZEOF_ADDR_IFREQ(ifr) \ + ((ifr).ifr_addr.sa_len > sizeof(struct sockaddr) ? \ + (sizeof(struct ifreq) - sizeof(struct sockaddr) + \ + (ifr).ifr_addr.sa_len) : sizeof(struct ifreq)) + +struct ifaliasreq { + char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + struct sockaddr ifra_addr; + struct sockaddr ifra_broadaddr; + struct sockaddr ifra_mask; +}; + +struct ifmediareq { + char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + int ifm_current; /* current media options */ + int ifm_mask; /* don't care mask */ + int ifm_status; /* media status */ + int ifm_active; /* active options */ + int ifm_count; /* # entries in ifm_ulist array */ + int *ifm_ulist; /* media words */ +}; + +/* + * This structure is used to pass the data to in_control() for an address + * delete request. The ifaliasreq structure has the address to be deleted + * and 'detachFlag' indicates whether the interface is being detached. + */ +struct ifdeladdrreq { + struct ifaliasreq ifr; + BOOL detachFlag; +}; + +/* + * Structure used to retrieve aux status data from interfaces. + * Kernel suppliers to this interface should respect the formatting + * needed by ifconfig(8): each line starts with a TAB and ends with + * a newline. The canonical example to copy and paste is in if_tun.c. + */ + +#define IFSTATMAX 800 /* 10 lines of text */ +struct ifstat { + char ifs_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + char ascii[IFSTATMAX + 1]; +}; + +/* + * Structure used in SIOCGIFCONF request. + * Used to retrieve interface configuration + * for machine (useful for programs which + * must know all networks accessible). + */ +struct ifconf { + int ifc_len; /* size of associated buffer */ + union { + caddr_t ifcu_buf; + struct ifreq *ifcu_req; + } ifc_ifcu; +#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ +#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ +}; + +/* + * Structure used in SIOCGMTU request. + * Used to retrieve the MTU for point-to-multipoint devices. + */ + +typedef struct mtuQuery_t + { + UCHAR family; + UINT32 dstIpAddr; + UINT32 mtu; + } MTU_QUERY; + +/* + * Structure for SIOC[AGD]LIFADDR + */ +struct if_laddrreq { + char iflr_name[IFNAMSIZ]; + u_int flags; +#define IFLR_PREFIX 0x8000 /* in: prefix given out: kernel fills id */ + u_int prefixlen; /* in/out */ + struct sockaddr_storage addr; /* in/out */ + struct sockaddr_storage dstaddr; /* out */ +}; + +struct if_nameindex { + u_int if_index; /* 1, 2, ... */ + char *if_name; /* null terminated name: "le0", ... */ +}; + +u_int if_nametoindex __P((const char *)); +char *if_indextoname __P((u_int, char *)); +struct if_nameindex *if_nameindex __P((void)); +void if_freenameindex __P((struct if_nameindex *)); + + +#ifdef _WRS_KERNEL +struct proc; +int prison_if __P((struct proc *p, struct sockaddr *sa)); + +#include + +extern const char *if_name __P((struct ifnet *)); +#define IFAREF(ifa) do { ++(ifa)->ifa_refcnt; } while (0) +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* !__INCifh */ diff --git a/h/wrn/coreip/net/if_arp.h b/h/wrn/coreip/net/if_arp.h new file mode 100644 index 0000000..4a62ee0 --- /dev/null +++ b/h/wrn/coreip/net/if_arp.h @@ -0,0 +1,177 @@ +/* if_arp.h - network interface address resolution protocol header file */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if_arp.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/if_arp.h,v 1.14.2.3 2002/02/20 23:34:09 fjoe Exp $ + */ + +/* +modification history +-------------------- +01o,07feb05,vvv _KERNEL cleanup +01n,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01m,20nov03,niq Remove copyright_wrs.h file inclusion +01l,05nov03,cdw Removal of unnecessary _KERNEL guards. +01k,04nov03,rlm Ran batch header path update for header re-org. +01j,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01i,27oct03,rlm update include statements post header re-org. +01h,06aug03,niq Merging from Accordion label ACCORDION_BASE6_MERGE_BASELINE +01g,09may03,vvv included socket.h and if.h +01h,07mar03,spm merged from CLARINET-1_1-KAME-UPDATE (ver 01f,01feb03,pas) +01g,02dec02,spm merged from WINDNET_IPV6-1_0-FCS label (ver 01e,09sep02,hsh) +01f,27aug02,kal inclusion of in.h for struct in_addr (in arpcom) +01e,23aug02,vlk added ac_ipaddr item into "arpcom" struct + and ATF_INCOMPLETE definition +01d,03feb02,ham changes for tornado build. +01c,09dec01,ppp adding ATF_PROXY flag +01b,20aug01,qli moving the element to protos/arp +01a,12aug01,ham created from FreeBSD4.3-RELEASE(July-17-01). +*/ + +#ifndef _NET_IF_ARP_H_ +#define _NET_IF_ARP_H_ + +/* includes */ + +#include +#include + +#ifdef __cplusplus + extern "C" { +#endif + +#include + +/* + * Address Resolution Protocol. + * + * See RFC 826 for protocol description. ARP packets are variable + * in size; the arphdr structure defines the fixed-length portion. + * Protocol type values are the same as those for 10 Mb/s Ethernet. + * It is followed by the variable-sized fields ar_sha, arp_spa, + * arp_tha and arp_tpa in that order, according to the lengths + * specified. Field names used correspond to RFC 826. + */ +struct arphdr { + u_short ar_hrd; /* format of hardware address */ +#define ARPHRD_ETHER 1 /* ethernet hardware format */ +#define ARPHRD_EETHER 2 /* experimental ethernet format */ +#define ARPHRD_AX25 3 /* AX.25 Level 2 */ +#define ARPHRD_PRONET 4 /* PROnet token ring */ +#define ARPHRD_CHAOS 5 /* Chaosnet */ +#define ARPHRD_IEEE802 6 /* token-ring hardware format */ +#define ARPHRD_ARCNET 7 /* arcnet hardware format */ +#define ARPHRD_HYPERCH 8 /* Hyper channel */ +#define ARPHRD_LANSTAR 9 /* LanStar */ +#define ARPHRD_ULTRALINK 13 /* UltraLink */ +#define ARPHRD_FRELAY 15 /* frame relay hardware format */ +#define ARPHRD_DLCI ARPHRD_FRELAY +#define ARPHRD_ATM 19 /* ATM */ +#define ARPHRD_METRICOM 23 /* Metricom STRIP (new IANA id) */ +#define ARPHRD_IEEE1394 24 /* IEEE 1394 IPv4 - RFC 2734 */ +#define ARPHRD_EUI64 27 /* EUI-64 */ + u_short ar_pro; /* format of protocol address */ + u_char ar_hln; /* length of hardware address */ + u_char ar_pln; /* length of protocol address */ + u_short ar_op; /* one of: */ +#define ARPOP_REQUEST 1 /* request to resolve address */ +#define ARPOP_REPLY 2 /* response to previous request */ +#define ARPOP_REVREQUEST 3 /* request protocol address given hardware */ +#define ARPOP_REVREPLY 4 /* response giving protocol address */ +#define ARPOP_INVREQUEST 8 /* request to identify peer */ +#define ARPOP_INVREPLY 9 /* response identifying peer */ +/* + * The remaining fields are variable in size, + * according to the sizes above. + */ +#ifdef COMMENT_ONLY + u_char ar_sha[]; /* sender hardware address */ + u_char ar_spa[]; /* sender protocol address */ + u_char ar_tha[]; /* target hardware address */ + u_char ar_tpa[]; /* target protocol address */ +#endif +}; + +#define ar_sha(ap) (((caddr_t)((ap)+1)) + 0) +#define ar_spa(ap) (((caddr_t)((ap)+1)) + (ap)->ar_hln) +#define ar_tha(ap) (((caddr_t)((ap)+1)) + (ap)->ar_hln + (ap)->ar_pln) +#define ar_tpa(ap) (((caddr_t)((ap)+1)) + 2*(ap)->ar_hln + (ap)->ar_pln) + +#define arphdr_len2(ar_hln, ar_pln) \ + (sizeof(struct arphdr) + 2*(ar_hln) + 2*(ar_pln)) +#define arphdr_len(ap) (arphdr_len2((ap)->ar_hln, (ap)->ar_pln)) + +/* + * ARP ioctl request + */ +struct arpreq { + struct sockaddr arp_pa; /* protocol address */ + struct sockaddr arp_ha; /* hardware address */ + int arp_flags; /* flags */ +}; +/* arp_flags and at_flags field values */ +#define ATF_INUSE 0x01 /* entry in use */ +#define ATF_COM 0x02 /* completed entry (enaddr valid) */ +#define ATF_PERM 0x04 /* permanent entry */ +#define ATF_PUBL 0x08 /* publish entry (respond for other host) */ +#define ATF_USETRAILERS 0x10 /* has requested trailers */ +#define ATF_PROXY 0x20 /* proxy server entry (wildcard h/w address) */ +#define ATF_INCOMPLETE 0x40 /* Complete a host entry */ + +/* + * Structure shared between the ethernet driver modules and + * the address resolution code. For example, each ec_softc or il_softc + * begins with this structure. + */ +struct arpcom { + /* + * The ifnet struct _must_ be at the head of this structure. + */ + struct ifnet ac_if; /* network-visible interface */ + u_char ac_enaddr[6]; /* ethernet hardware address */ + struct in_addr ac_ipaddr; /* copy of ip address- XXX */ + int ac_multicnt; /* length of ac_multiaddrs list */ + void *ac_netgraph; /* ng_ether(4) netgraph node info */ +}; + +extern u_char etherbroadcastaddr[6]; +extern u_char arcbroadcastaddr; + +#ifdef __cplusplus +} +#endif + +#endif /* !_NET_IF_ARP_H_ */ diff --git a/h/wrn/coreip/net/if_clone.h b/h/wrn/coreip/net/if_clone.h new file mode 100644 index 0000000..f4d6265 --- /dev/null +++ b/h/wrn/coreip/net/if_clone.h @@ -0,0 +1,93 @@ +/* Copyright 2005 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1982, 1986, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * From: @(#)if.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/if_clone.h,v 1.1.2.1 2005/01/31 23:26:22 imp Exp $ + */ + +/* +modification history +-------------------- +01b,21sep05,kch Partially merged FreeBSD 5.x if_clone.h,v 1.1.2.1 to support + the free-form interface naming style (SPR #112724). +01a,28jul05,kch Ported from FreeBSD. +*/ + +#ifndef _NET_IF_CLONE_H_ +#define _NET_IF_CLONE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _WRS_KERNEL + +#define IF_CLONE_INITIALIZER(name, maxunit, attach, match, create, destroy) \ + { { 0 }, name, sizeof(name) - 1, maxunit, NULL, 0, attach, \ + match, create, destroy } + + +/* + * Structure describing a `cloning' interface. + */ +struct if_clone { + LIST_ENTRY(if_clone) ifc_list; /* on list of cloners */ + char *ifc_name; /* name of device, e.g. `gif' */ + size_t ifc_namelen; /* length of name */ + int ifc_maxunit; /* (c) Maximum unit number */ + unsigned char *ifc_units; /* (i) Bitmap to handle units. */ + int ifc_bmlen; /* (c) Bitmap length. */ + + /* (c) Driver specific cloning functions. */ + void (*ifc_attach)(struct if_clone *); + int (*ifc_match)(struct if_clone *, const char *); + int (*ifc_create)(struct if_clone *, char *, int); + int (*ifc_destroy)(struct if_clone *, struct ifnet *); +}; + +void if_clone_init(void); +int if_clone_attach(struct if_clone *); +void if_clone_detach(struct if_clone *); + +int if_clone_create(char *, int); +int if_clone_destroy(const char *); +int if_clone_list(struct if_clonereq *); + +int ifc_name2unit(const char *name, int *unit); +int ifc_alloc_unit(struct if_clone *ifc, int *unit); +void ifc_free_unit(struct if_clone *ifc, int unit); + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* _NET_IF_CLONE_H_ */ diff --git a/h/wrn/coreip/net/if_dl.h b/h/wrn/coreip/net/if_dl.h new file mode 100644 index 0000000..de31bf3 --- /dev/null +++ b/h/wrn/coreip/net/if_dl.h @@ -0,0 +1,110 @@ +/* if_dl.h - data link level structure header file */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if_dl.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/if_dl.h,v 1.10 2000/03/01 02:46:25 archie Exp $ + */ + +/* +modification history +-------------------- +01h,07feb05,vvv _KERNEL cleanup +01g,20nov03,niq Remove copyright_wrs.h file inclusion +01f,05nov03,cdw Removal of unnecessary _KERNEL guards. +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01c,10jun03,vvv include netVersion.h +01b,09sep02,hsh add c++ protection +01a,12jul01,ham created from FreeBSD4.3-RELEASE(July-17-01). + */ + +#ifndef _NET_IF_DL_H_ +#define _NET_IF_DL_H_ + +#ifdef __cplusplus + extern "C" { +#endif + +#include + +/* + * A Link-Level Sockaddr may specify the interface in one of two + * ways: either by means of a system-provided index number (computed + * anew and possibly differently on every reboot), or by a human-readable + * string such as "il0" (for managerial convenience). + * + * Census taking actions, such as something akin to SIOCGCONF would return + * both the index and the human name. + * + * High volume transactions (such as giving a link-level ``from'' address + * in a recvfrom or recvmsg call) may be likely only to provide the indexed + * form, (which requires fewer copy operations and less space). + * + * The form and interpretation of the link-level address is purely a matter + * of convention between the device driver and its consumers; however, it is + * expected that all drivers for an interface of a given if_type will agree. + */ + +/* + * Structure of a Link-Level sockaddr: + */ +struct sockaddr_dl { + u_char sdl_len; /* Total length of sockaddr */ + u_char sdl_family; /* AF_LINK */ + u_short sdl_index; /* if != 0, system given index for interface */ + u_char sdl_type; /* interface type */ + u_char sdl_nlen; /* interface name length, no trailing 0 reqd. */ + u_char sdl_alen; /* link level address length */ + u_char sdl_slen; /* link layer selector length */ + char sdl_data[12]; /* minimum work area, can be larger; + contains both if name and ll address */ + u_short sdl_rcf; /* source routing control */ + u_short sdl_route[16]; /* source routing information */ +}; + +#define LLADDR(s) ((caddr_t)((s)->sdl_data + (s)->sdl_nlen)) + +#ifdef _WRS_KERNEL +void link_addr __P((const char *, struct sockaddr_dl *)); +char *link_ntoa __P((const struct sockaddr_dl *)); + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/net/if_llc.h b/h/wrn/coreip/net/if_llc.h new file mode 100644 index 0000000..317fe13 --- /dev/null +++ b/h/wrn/coreip/net/if_llc.h @@ -0,0 +1,172 @@ +/* if.h - network interface header file */ + +/* Copyright 2001-2004 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if_llc.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/if_llc.h,v 1.7 1999/08/28 00:48:18 peter Exp $ + */ + +/* +modification history +-------------------- +01h,10nov04,syy Fix SPR#103861 +01g,20nov03,niq Remove copyright_wrs.h file inclusion +01f,05nov03,cdw Removal of unnecessary _KERNEL guards. +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01c,10jun03,vvv include netVersion.h +01b,09sep02,hsh add c++ protection +01a,10aug01,ham created from FreeBSD4.3-RELEASE(July-17-01). + */ + +#ifndef _NET_IF_LLC_H_ +#define _NET_IF_LLC_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * IEEE 802.2 Link Level Control headers, for use in conjunction with + * 802.{3,4,5} media access control methods. + * + * Headers here do not use bit fields due to shortcomings in many + * compilers. + */ + +struct llc { + u_char llc_dsap; + u_char llc_ssap; + union { + struct { + u_char control; + u_char format_id; + u_char llc_class; + u_char window_x2; + } type_u; + struct { + u_char num_snd_x2; + u_char num_rcv_x2; + } type_i; + struct { + u_char control; + u_char num_rcv_x2; + } type_s; + struct { + u_char control; + struct frmrinfo { + u_char rej_pdu_0; + u_char rej_pdu_1; + u_char frmr_control; + u_char frmr_control_ext; + u_char frmr_cause; + } frmrinfo; + } type_frmr; + struct { + u_char control; + u_char org_code[3]; + u_short ether_type; + } type_snap; + struct { + u_char control; + u_char control_ext; + } type_raw; + } llc_un; +}; +#define llc_control llc_un.type_u.control +#define llc_control_ext llc_un.type_raw.control_ext +#define llc_fid llc_un.type_u.format_id +#define llc_class llc_un.type_u.llc_class +#define llc_window llc_un.type_u.window_x2 +#define llc_frmrinfo llc_un.type_frmr.frmrinfo +#define llc_frmr_pdu0 llc_un.type_frmr.frmrinfo.rej_pdu0 +#define llc_frmr_pdu1 llc_un.type_frmr.frmrinfo.rej_pdu1 +#define llc_frmr_control llc_un.type_frmr.frmrinfo.frmr_control +#define llc_frmr_control_ext llc_un.type_frmr.frmrinfo.frmr_control_ext +#define llc_frmr_cause llc_un.type_frmr.frmrinfo.frmr_control_ext + +/* + * Don't use sizeof(struct llc_un) for LLC header sizes + */ +#define LLC_ISFRAMELEN 4 +#define LLC_UFRAMELEN 3 +#define LLC_FRMRLEN 7 + +/* + * Unnumbered LLC format commands + */ +#define LLC_UI 0x3 +#define LLC_UI_P 0x13 +#define LLC_DISC 0x43 +#define LLC_DISC_P 0x53 +#define LLC_UA 0x63 +#define LLC_UA_P 0x73 +#define LLC_TEST 0xe3 +#define LLC_TEST_P 0xf3 +#define LLC_FRMR 0x87 +#define LLC_FRMR_P 0x97 +#define LLC_DM 0x0f +#define LLC_DM_P 0x1f +#define LLC_XID 0xaf +#define LLC_XID_P 0xbf +#define LLC_SABME 0x6f +#define LLC_SABME_P 0x7f + +/* + * Supervisory LLC commands + */ +#define LLC_RR 0x01 +#define LLC_RNR 0x05 +#define LLC_REJ 0x09 + +/* + * Info format - dummy only + */ +#define LLC_INFO 0x00 + +/* + * ISO PDTR 10178 contains among others + */ +#define LLC_X25_LSAP 0x7e +#define LLC_SNAP_LSAP 0xaa +#define LLC_ISO_LSAP 0xfe + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/net/if_media.h b/h/wrn/coreip/net/if_media.h new file mode 100644 index 0000000..cc67efa --- /dev/null +++ b/h/wrn/coreip/net/if_media.h @@ -0,0 +1,563 @@ +/* if_media.h - interface media selection */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* $NetBSD: if_media.h,v 1.3 1997/03/26 01:19:27 thorpej Exp $ */ +/* $FreeBSD: src/sys/net/if_media.h,v 1.27 2004/04/13 19:23:46 fjoe Exp $ */ + +/* + * Copyright (c) 1997 + * Jonathan Stone and Jason R. Thorpe. All rights reserved. + * + * This software is derived from information provided by Matt Thomas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jonathan Stone + * and Jason R. Thorpe for the NetBSD Project. + * 4. The names of the authors may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* +modification history +-------------------- +01g,24jun05,wap Sync with FreeBSD-current sources +01f,07feb05,vvv _KERNEL cleanup +01e,20nov03,niq Remove copyright_wrs.h file inclusion +01d,05nov03,rlm Ran batch header update for header re-org. +01c,29apr03,syy Added #ifdef for __cplusplus +01b,01feb03,pas merge from FreeBSD 4.7 - added some IEEE80211 codes +01a,30aug01,ann initial port into clarinet from FreeBSD 4.3 version 1.9.2.1 +*/ + +#ifndef _NET_IF_MEDIA_H_ +#define _NET_IF_MEDIA_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _WRS_KERNEL +/* + * Prototypes and definitions for BSD/OS-compatible network interface + * media selection. + * + * Where it is safe to do so, this code strays slightly from the BSD/OS + * design. Software which uses the API (device drivers, basically) + * shouldn't notice any difference. + * + * Many thanks to Matt Thomas for providing the information necessary + * to implement this interface. + */ + +/* Include files introduced by clarinet */ + +#include + +/* + * Driver callbacks for media status and change requests. + */ +typedef int (*ifm_change_cb_t)(struct ifnet *ifp); +typedef void (*ifm_stat_cb_t)(struct ifnet *ifp, struct ifmediareq *req); + +/* + * In-kernel representation of a single supported media type. + */ +struct ifmedia_entry { + LIST_ENTRY(ifmedia_entry) ifm_list; + int ifm_media; /* description of this media attachment */ + int ifm_data; /* for driver-specific use */ + void *ifm_aux; /* for driver-specific use */ +}; + +/* + * One of these goes into a network interface's softc structure. + * It is used to keep general media state. + */ +struct ifmedia { + int ifm_mask; /* mask of changes we don't care about */ + int ifm_media; /* current user-set media word */ + struct ifmedia_entry *ifm_cur; /* currently selected media */ + LIST_HEAD(, ifmedia_entry) ifm_list; /* list of all supported media */ + ifm_change_cb_t ifm_change; /* media change driver callback */ + ifm_stat_cb_t ifm_status; /* media status driver callback */ +}; + +/* Initialize an interface's struct if_media field. */ +void ifmedia_init(struct ifmedia *ifm, int dontcare_mask, + ifm_change_cb_t change_callback, ifm_stat_cb_t status_callback); + +/* Remove all mediums from a struct ifmedia. */ +void ifmedia_removeall( struct ifmedia *ifm); + +/* Add one supported medium to a struct ifmedia. */ +void ifmedia_add(struct ifmedia *ifm, int mword, int data, void *aux); + +/* Add an array (of ifmedia_entry) media to a struct ifmedia. */ +void ifmedia_list_add(struct ifmedia *mp, struct ifmedia_entry *lp, + int count); + +/* Set default media type on initialization. */ +void ifmedia_set(struct ifmedia *ifm, int mword); + +/* Common ioctl function for getting/setting media, called by driver. */ +int ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, + struct ifmedia *ifm, u_long cmd); + +IMPORT void ifmediaLibInit (void); + +#endif /* _WRS_KERNEL */ + + +/* + * if_media Options word: + * Bits Use + * ---- ------- + * 0-4 Media variant + * 5-7 Media type + * 8-15 Type specific options + * 16-18 Mode (for multi-mode devices) + * 19 RFU + * 20-27 Shared (global) options + * 28-31 Instance + */ + +/* + * Ethernet + */ +#define IFM_ETHER 0x00000020 +#define IFM_10_T 3 /* 10BaseT - RJ45 */ +#define IFM_10_2 4 /* 10Base2 - Thinnet */ +#define IFM_10_5 5 /* 10Base5 - AUI */ +#define IFM_100_TX 6 /* 100BaseTX - RJ45 */ +#define IFM_100_FX 7 /* 100BaseFX - Fiber */ +#define IFM_100_T4 8 /* 100BaseT4 - 4 pair cat 3 */ +#define IFM_100_VG 9 /* 100VG-AnyLAN */ +#define IFM_100_T2 10 /* 100BaseT2 */ +#define IFM_1000_SX 11 /* 1000BaseSX - multi-mode fiber */ +#define IFM_10_STP 12 /* 10BaseT over shielded TP */ +#define IFM_10_FL 13 /* 10BaseFL - Fiber */ +#define IFM_1000_LX 14 /* 1000baseLX - single-mode fiber */ +#define IFM_1000_CX 15 /* 1000baseCX - 150ohm STP */ +#define IFM_1000_T 16 /* 1000baseT - 4 pair cat 5 */ +#define IFM_HPNA_1 17 /* HomePNA 1.0 (1Mb/s) */ +/* note 31 is the max! */ + +#define IFM_ETH_MASTER 0x00000100 /* master mode (1000baseT) */ + +/* + * Token ring + */ +#define IFM_TOKEN 0x00000040 +#define IFM_TOK_STP4 3 /* Shielded twisted pair 4m - DB9 */ +#define IFM_TOK_STP16 4 /* Shielded twisted pair 16m - DB9 */ +#define IFM_TOK_UTP4 5 /* Unshielded twisted pair 4m - RJ45 */ +#define IFM_TOK_UTP16 6 /* Unshielded twisted pair 16m - RJ45 */ +#define IFM_TOK_STP100 7 /* Shielded twisted pair 100m - DB9 */ +#define IFM_TOK_UTP100 8 /* Unshielded twisted pair 100m - RJ45 */ +#define IFM_TOK_ETR 0x00000200 /* Early token release */ +#define IFM_TOK_SRCRT 0x00000400 /* Enable source routing features */ +#define IFM_TOK_ALLR 0x00000800 /* All routes / Single route bcast */ +#define IFM_TOK_DTR 0x00002000 /* Dedicated token ring */ +#define IFM_TOK_CLASSIC 0x00004000 /* Classic token ring */ +#define IFM_TOK_AUTO 0x00008000 /* Automatic Dedicate/Classic token ring */ + +/* + * FDDI + */ +#define IFM_FDDI 0x00000060 +#define IFM_FDDI_SMF 3 /* Single-mode fiber */ +#define IFM_FDDI_MMF 4 /* Multi-mode fiber */ +#define IFM_FDDI_UTP 5 /* CDDI / UTP */ +#define IFM_FDDI_DA 0x00000100 /* Dual attach / single attach */ + +/* + * IEEE 802.11 Wireless + */ +#define IFM_IEEE80211 0x00000080 +/* NB: 0,1,2 are auto, manual, none defined below */ +#define IFM_IEEE80211_FH1 3 /* Frequency Hopping 1Mbps */ +#define IFM_IEEE80211_FH2 4 /* Frequency Hopping 2Mbps */ +#define IFM_IEEE80211_DS1 5 /* Direct Sequence 1Mbps */ +#define IFM_IEEE80211_DS2 6 /* Direct Sequence 2Mbps */ +#define IFM_IEEE80211_DS5 7 /* Direct Sequence 5.5Mbps */ +#define IFM_IEEE80211_DS11 8 /* Direct Sequence 11Mbps */ +#define IFM_IEEE80211_DS22 9 /* Direct Sequence 22Mbps */ +#define IFM_IEEE80211_OFDM6 10 /* OFDM 6Mbps */ +#define IFM_IEEE80211_OFDM9 11 /* OFDM 9Mbps */ +#define IFM_IEEE80211_OFDM12 12 /* OFDM 12Mbps */ +#define IFM_IEEE80211_OFDM18 13 /* OFDM 18Mbps */ +#define IFM_IEEE80211_OFDM24 14 /* OFDM 24Mbps */ +#define IFM_IEEE80211_OFDM36 15 /* OFDM 36Mbps */ +#define IFM_IEEE80211_OFDM48 16 /* OFDM 48Mbps */ +#define IFM_IEEE80211_OFDM54 17 /* OFDM 54Mbps */ +#define IFM_IEEE80211_OFDM72 18 /* OFDM 72Mbps */ +#define IFM_IEEE80211_DS354k 19 /* Direct Sequence 354Kbps */ +#define IFM_IEEE80211_DS512k 20 /* Direct Sequence 512Kbps */ + +#define IFM_IEEE80211_ADHOC 0x00000100 /* Operate in Adhoc mode */ +#define IFM_IEEE80211_HOSTAP 0x00000200 /* Operate in Host AP mode */ +#define IFM_IEEE80211_IBSS 0x00000400 /* Operate in IBSS mode */ +#define IFM_IEEE80211_IBSSMASTER 0x00000800 /* Operate as an IBSS master */ +#define IFM_IEEE80211_TURBO 0x00001000 /* Operate in turbo mode */ +#define IFM_IEEE80211_MONITOR 0x00002000 /* Operate in monitor mode */ + +/* operating mode for multi-mode devices */ +#define IFM_IEEE80211_11A 0x00010000 /* 5Ghz, OFDM mode */ +#define IFM_IEEE80211_11B 0x00020000 /* Direct Sequence mode */ +#define IFM_IEEE80211_11G 0x00030000 /* 2Ghz, CCK mode */ +#define IFM_IEEE80211_FH 0x00040000 /* 2Ghz, GFSK mode */ + +/* + * ATM + */ +#define IFM_ATM 0x000000a0 +#define IFM_ATM_UNKNOWN 3 +#define IFM_ATM_UTP_25 4 +#define IFM_ATM_TAXI_100 5 +#define IFM_ATM_TAXI_140 6 +#define IFM_ATM_MM_155 7 +#define IFM_ATM_SM_155 8 +#define IFM_ATM_UTP_155 9 +#define IFM_ATM_MM_622 10 +#define IFM_ATM_SM_622 11 +#define IFM_ATM_VIRTUAL 12 +#define IFM_ATM_SDH 0x00000100 /* SDH instead of SONET */ +#define IFM_ATM_NOSCRAMB 0x00000200 /* no scrambling */ +#define IFM_ATM_UNASSIGNED 0x00000400 /* unassigned cells */ + +/* + * Shared media sub-types + */ +#define IFM_AUTO 0 /* Autoselect best media */ +#define IFM_MANUAL 1 /* Jumper/dipswitch selects media */ +#define IFM_NONE 2 /* Deselect all media */ + +/* + * Shared options + */ +#define IFM_FDX 0x00100000 /* Force full duplex */ +#define IFM_HDX 0x00200000 /* Force half duplex */ +#define IFM_FLAG0 0x01000000 /* Driver defined flag */ +#define IFM_FLAG1 0x02000000 /* Driver defined flag */ +#define IFM_FLAG2 0x04000000 /* Driver defined flag */ +#define IFM_LOOP 0x08000000 /* Put hardware in loopback */ + +/* + * Masks + */ +#define IFM_NMASK 0x000000e0 /* Network type */ +#define IFM_TMASK 0x0000001f /* Media sub-type */ +#define IFM_IMASK 0xf0000000 /* Instance */ +#define IFM_ISHIFT 28 /* Instance shift */ +#define IFM_OMASK 0x0000ff00 /* Type specific options */ +#define IFM_MMASK 0x00070000 /* Mode */ +#define IFM_MSHIFT 16 /* Mode shift */ +#define IFM_GMASK 0x0ff00000 /* Global options */ + +/* + * Status bits + */ +#define IFM_AVALID 0x00000001 /* Active bit valid */ +#define IFM_ACTIVE 0x00000002 /* Interface attached to working net */ + +/* + * Macros to extract various bits of information from the media word. + */ +#define IFM_TYPE(x) ((x) & IFM_NMASK) +#define IFM_SUBTYPE(x) ((x) & IFM_TMASK) +#define IFM_TYPE_OPTIONS(x) ((x) & IFM_OMASK) +#define IFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT) +#define IFM_OPTIONS(x) ((x) & (IFM_OMASK|IFM_GMASK)) +#define IFM_MODE(x) ((x) & IFM_MMASK) + +#define IFM_INST_MAX IFM_INST(IFM_IMASK) + +/* + * Macro to create a media word. + */ +#define IFM_MAKEWORD(type, subtype, options, instance) \ + ((type) | (subtype) | (options) | ((instance) << IFM_ISHIFT)) +#define IFM_MAKEMODE(mode) \ + (((mode) << IFM_MSHIFT) & IFM_MMASK) + +/* + * NetBSD extension not defined in the BSDI API. This is used in various + * places to get the canonical description for a given type/subtype. + * + * NOTE: all but the top-level type descriptions must contain NO whitespace! + * Otherwise, parsing these in ifconfig(8) would be a nightmare. + */ +struct ifmedia_description { + int ifmt_word; /* word value; may be masked */ + const char *ifmt_string; /* description */ +}; + +#define IFM_TYPE_DESCRIPTIONS { \ + { IFM_ETHER, "Ethernet" }, \ + { IFM_TOKEN, "Token ring" }, \ + { IFM_FDDI, "FDDI" }, \ + { IFM_IEEE80211, "IEEE 802.11 Wireless Ethernet" }, \ + { IFM_ATM, "ATM" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_ETHERNET_DESCRIPTIONS { \ + { IFM_10_T, "10baseT/UTP" }, \ + { IFM_10_2, "10base2/BNC" }, \ + { IFM_10_5, "10base5/AUI" }, \ + { IFM_100_TX, "100baseTX" }, \ + { IFM_100_FX, "100baseFX" }, \ + { IFM_100_T4, "100baseT4" }, \ + { IFM_100_VG, "100baseVG" }, \ + { IFM_100_T2, "100baseT2" }, \ + { IFM_10_STP, "10baseSTP" }, \ + { IFM_10_FL, "10baseFL" }, \ + { IFM_1000_SX, "1000baseSX" }, \ + { IFM_1000_LX, "1000baseLX" }, \ + { IFM_1000_CX, "1000baseCX" }, \ + { IFM_1000_T, "1000baseTX" }, \ + { IFM_1000_T, "1000baseT" }, \ + { IFM_HPNA_1, "homePNA" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_ETHERNET_ALIASES { \ + { IFM_10_T, "UTP" }, \ + { IFM_10_T, "10UTP" }, \ + { IFM_10_2, "BNC" }, \ + { IFM_10_2, "10BNC" }, \ + { IFM_10_5, "AUI" }, \ + { IFM_10_5, "10AUI" }, \ + { IFM_100_TX, "100TX" }, \ + { IFM_100_T4, "100T4" }, \ + { IFM_100_VG, "100VG" }, \ + { IFM_100_T2, "100T2" }, \ + { IFM_10_STP, "10STP" }, \ + { IFM_10_FL, "10FL" }, \ + { IFM_1000_SX, "1000SX" }, \ + { IFM_1000_LX, "1000LX" }, \ + { IFM_1000_CX, "1000CX" }, \ + { IFM_1000_T, "1000TX" }, \ + { IFM_1000_T, "1000T" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS { \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_TOKENRING_DESCRIPTIONS { \ + { IFM_TOK_STP4, "DB9/4Mbit" }, \ + { IFM_TOK_STP16, "DB9/16Mbit" }, \ + { IFM_TOK_UTP4, "UTP/4Mbit" }, \ + { IFM_TOK_UTP16, "UTP/16Mbit" }, \ + { IFM_TOK_STP100, "STP/100Mbit" }, \ + { IFM_TOK_UTP100, "UTP/100Mbit" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_TOKENRING_ALIASES { \ + { IFM_TOK_STP4, "4STP" }, \ + { IFM_TOK_STP16, "16STP" }, \ + { IFM_TOK_UTP4, "4UTP" }, \ + { IFM_TOK_UTP16, "16UTP" }, \ + { IFM_TOK_STP100, "100STP" }, \ + { IFM_TOK_UTP100, "100UTP" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS { \ + { IFM_TOK_ETR, "EarlyTokenRelease" }, \ + { IFM_TOK_SRCRT, "SourceRouting" }, \ + { IFM_TOK_ALLR, "AllRoutes" }, \ + { IFM_TOK_DTR, "Dedicated" }, \ + { IFM_TOK_CLASSIC,"Classic" }, \ + { IFM_TOK_AUTO, " " }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_FDDI_DESCRIPTIONS { \ + { IFM_FDDI_SMF, "Single-mode" }, \ + { IFM_FDDI_MMF, "Multi-mode" }, \ + { IFM_FDDI_UTP, "UTP" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_FDDI_ALIASES { \ + { IFM_FDDI_SMF, "SMF" }, \ + { IFM_FDDI_MMF, "MMF" }, \ + { IFM_FDDI_UTP, "CDDI" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS { \ + { IFM_FDDI_DA, "Dual-attach" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_IEEE80211_DESCRIPTIONS { \ + { IFM_IEEE80211_FH1, "FH/1Mbps" }, \ + { IFM_IEEE80211_FH2, "FH/2Mbps" }, \ + { IFM_IEEE80211_DS1, "DS/1Mbps" }, \ + { IFM_IEEE80211_DS2, "DS/2Mbps" }, \ + { IFM_IEEE80211_DS5, "DS/5.5Mbps" }, \ + { IFM_IEEE80211_DS11, "DS/11Mbps" }, \ + { IFM_IEEE80211_DS22, "DS/22Mbps" }, \ + { IFM_IEEE80211_OFDM6, "OFDM/6Mbps" }, \ + { IFM_IEEE80211_OFDM9, "OFDM/9Mbps" }, \ + { IFM_IEEE80211_OFDM12, "OFDM/12Mbps" }, \ + { IFM_IEEE80211_OFDM18, "OFDM/18Mbps" }, \ + { IFM_IEEE80211_OFDM24, "OFDM/24Mbps" }, \ + { IFM_IEEE80211_OFDM36, "OFDM/36Mbps" }, \ + { IFM_IEEE80211_OFDM48, "OFDM/48Mbps" }, \ + { IFM_IEEE80211_OFDM54, "OFDM/54Mbps" }, \ + { IFM_IEEE80211_OFDM72, "OFDM/72Mbps" }, \ + { IFM_IEEE80211_DS354k, "DS/354Kbps" }, \ + { IFM_IEEE80211_DS512k, "DS/512Kbps" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_IEEE80211_ALIASES { \ + { IFM_IEEE80211_FH1, "FH1" }, \ + { IFM_IEEE80211_FH2, "FH2" }, \ + { IFM_IEEE80211_FH1, "FrequencyHopping/1Mbps" }, \ + { IFM_IEEE80211_FH2, "FrequencyHopping/2Mbps" }, \ + { IFM_IEEE80211_DS1, "DS1" }, \ + { IFM_IEEE80211_DS2, "DS2" }, \ + { IFM_IEEE80211_DS5, "DS5.5" }, \ + { IFM_IEEE80211_DS11, "DS11" }, \ + { IFM_IEEE80211_DS22, "DS22" }, \ + { IFM_IEEE80211_DS1, "DirectSequence/1Mbps" }, \ + { IFM_IEEE80211_DS2, "DirectSequence/2Mbps" }, \ + { IFM_IEEE80211_DS5, "DirectSequence/5.5Mbps" }, \ + { IFM_IEEE80211_DS11, "DirectSequence/11Mbps" }, \ + { IFM_IEEE80211_DS22, "DirectSequence/22Mbps" }, \ + { IFM_IEEE80211_OFDM6, "OFDM6" }, \ + { IFM_IEEE80211_OFDM9, "OFDM9" }, \ + { IFM_IEEE80211_OFDM12, "OFDM12" }, \ + { IFM_IEEE80211_OFDM18, "OFDM18" }, \ + { IFM_IEEE80211_OFDM24, "OFDM24" }, \ + { IFM_IEEE80211_OFDM36, "OFDM36" }, \ + { IFM_IEEE80211_OFDM48, "OFDM48" }, \ + { IFM_IEEE80211_OFDM54, "OFDM54" }, \ + { IFM_IEEE80211_OFDM72, "OFDM72" }, \ + { IFM_IEEE80211_DS1, "CCK1" }, \ + { IFM_IEEE80211_DS2, "CCK2" }, \ + { IFM_IEEE80211_DS5, "CCK5.5" }, \ + { IFM_IEEE80211_DS11, "CCK11" }, \ + { IFM_IEEE80211_DS354k, "DS354K" }, \ + { IFM_IEEE80211_DS354k, "DirectSequence/354Kbps" }, \ + { IFM_IEEE80211_DS512k, "DS512K" }, \ + { IFM_IEEE80211_DS512k, "DirectSequence/512Kbps" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS { \ + { IFM_IEEE80211_ADHOC, "adhoc" }, \ + { IFM_IEEE80211_HOSTAP, "hostap" }, \ + { IFM_IEEE80211_IBSS, "ibss" }, \ + { IFM_IEEE80211_IBSSMASTER, "ibss-master" }, \ + { IFM_IEEE80211_TURBO, "turbo" }, \ + { IFM_IEEE80211_MONITOR, "monitor" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_IEEE80211_MODE_DESCRIPTIONS { \ + { IFM_AUTO, "autoselect" }, \ + { IFM_IEEE80211_11A, "11a" }, \ + { IFM_IEEE80211_11B, "11b" }, \ + { IFM_IEEE80211_11G, "11g" }, \ + { IFM_IEEE80211_FH, "fh" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_IEEE80211_MODE_ALIASES { \ + { IFM_AUTO, "auto" }, \ + { 0, NULL }, \ +} + +# define IFM_SUBTYPE_ATM_DESCRIPTIONS { \ + { IFM_ATM_UNKNOWN, "Unknown" }, \ + { IFM_ATM_UTP_25, "UTP/25.6MBit" }, \ + { IFM_ATM_TAXI_100, "Taxi/100MBit" }, \ + { IFM_ATM_TAXI_140, "Taxi/140MBit" }, \ + { IFM_ATM_MM_155, "Multi-mode/155MBit" }, \ + { IFM_ATM_SM_155, "Single-mode/155MBit" }, \ + { IFM_ATM_UTP_155, "UTP/155MBit" }, \ + { IFM_ATM_MM_622, "Multi-mode/622MBit" }, \ + { IFM_ATM_SM_622, "Single-mode/622MBit" }, \ + { IFM_ATM_VIRTUAL, "Virtual" }, \ + { 0, NULL }, \ +} + +# define IFM_SUBTYPE_ATM_ALIASES { \ + { IFM_ATM_UNKNOWN, "UNKNOWN" }, \ + { IFM_ATM_UTP_25, "UTP-25" }, \ + { IFM_ATM_TAXI_100, "TAXI-100" }, \ + { IFM_ATM_TAXI_140, "TAXI-140" }, \ + { IFM_ATM_MM_155, "MM-155" }, \ + { IFM_ATM_SM_155, "SM-155" }, \ + { IFM_ATM_UTP_155, "UTP-155" }, \ + { IFM_ATM_MM_622, "MM-622" }, \ + { IFM_ATM_SM_622, "SM-622" }, \ + { IFM_ATM_VIRTUAL, "VIRTUAL" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_ATM_OPTION_DESCRIPTIONS { \ + { IFM_ATM_SDH, "SDH" }, \ + { IFM_ATM_NOSCRAMB, "Noscramb" }, \ + { IFM_ATM_UNASSIGNED, "Unassigned" }, \ + { 0, NULL }, \ +} + + +#define IFM_SUBTYPE_SHARED_DESCRIPTIONS { \ + { IFM_AUTO, "autoselect" }, \ + { IFM_MANUAL, "manual" }, \ + { IFM_NONE, "none" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_SHARED_ALIASES { \ + { IFM_AUTO, "auto" }, \ + { 0, NULL }, \ +} + +#define IFM_SHARED_OPTION_DESCRIPTIONS { \ + { IFM_FDX, "full-duplex" }, \ + { IFM_HDX, "half-duplex" }, \ + { IFM_FLAG0, "flag0" }, \ + { IFM_FLAG1, "flag1" }, \ + { IFM_FLAG2, "flag2" }, \ + { IFM_LOOP, "hw-loopback" }, \ + { 0, NULL }, \ +} + +#ifdef __cplusplus +} +#endif + +#endif /* _NET_IF_MEDIA_H_ */ diff --git a/h/wrn/coreip/net/if_mip.h b/h/wrn/coreip/net/if_mip.h new file mode 100644 index 0000000..049a7da --- /dev/null +++ b/h/wrn/coreip/net/if_mip.h @@ -0,0 +1,90 @@ +/* $ID: $ */ + +/* Copyright (c) 2005 Wind River Systems, Inc. */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* +modification history +-------------------- +01a,09may05,rp ported from kame v1.1 +*/ + +#ifndef _NET_IF_MIP_H_ +#define _NET_IF_MIP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define MIP_MTU 1280 + +struct mip_softc { + struct ifnet mip_if; + LIST_ENTRY(mip_softc) mip_entry; +}; +LIST_HEAD(mip_softc_list, mip_softc); + +struct bul6info { + struct in6_addr bul_peeraddr; /* peer addr of this BU */ + struct in6_addr bul_hoa; /* HoA */ + struct in6_addr bul_coa; /* CoA */ + u_int16_t bul_flags; /* Flag Ack, LL, Key, Home flag */ + u_int16_t bul_ifindex; + u_int16_t bul_bid; /* Binding Unique Identifier */ +}; + +struct if_bulreq { + char ifbu_ifname[IFNAMSIZ]; + int ifbu_len; + int ifbu_count; + struct bul6info *ifbu_info; +}; + + +#ifdef _WRS_KERNEL + +#ifndef VIRTUAL_STACK +extern struct mip_softc_list _mip_softc_list; +#endif /* VIRTUAL_STACK */ + +int mip_ioctl(struct ifnet *, u_long, caddr_t); +int mip_output(struct ifnet *, struct mbuf *, struct sockaddr *, + struct rtentry *rt); + +int mip_is_mip_softc(struct ifnet *); + +#endif /* _WRS_KERNEL*/ + +#ifdef __cplusplus +} +#endif + +#endif /* !_NET_IF_MIP_H_ */ diff --git a/h/wrn/coreip/net/if_subr.h b/h/wrn/coreip/net/if_subr.h new file mode 100644 index 0000000..d8ab927 --- /dev/null +++ b/h/wrn/coreip/net/if_subr.h @@ -0,0 +1,61 @@ +/* if_subr.h - header for common routines for network interface drivers */ + +/* Copyright 1984 - 2003, 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02l,16may05,dlk Deprecate unused netTypeAdd/Delete/Init, and unimplemented + ether_addmulti()/ether_delmulti(). +02k,20nov03,niq Remove copyright_wrs.h file inclusion +02j,05nov03,cdw Removal of unnecessary _KERNEL guards. +02i,04nov03,rlm Ran batch header path update for header re-org. +02h,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +02g,23oct03,rlm updated #includes for header re-org +02f,09may03,vvv included lstLib.h +02e,01apr02,ham deleted do_protocol_with_type. +02d,28mar02,ppp modifying it to be backward compatible with A.E. 1.1 +02c,12sep01,ann removing the definition of ETHERMTU from here +02b,12sep01,ann adding some #defines +02a,15aug01,ann ported to clarinet from AE1.1 version 01n +*/ + +#ifndef __INCif_subrh +#define __INCif_subrh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include +#include +#include +#include +#include + +typedef struct net_type /* DEPRECATED */ + { + NODE node; + FUNCPTR inputRtn; + int etherType; + } NET_TYPE; + +/* function declarations */ + +extern STATUS netTypeAdd (int etherType, FUNCPTR inputRtn) + _WRS_DEPRECATED("has no useful effect"); +extern STATUS netTypeDelete (int etherType) + _WRS_DEPRECATED("has no useful effect"); +extern void netTypeInit () + _WRS_DEPRECATED("has no useful effect"); +extern int ether_addmulti (struct ifreq *, struct arpcom *) + _WRS_DEPRECATED("unimplemented"); +extern int ether_delmulti (struct ifreq *, struct arpcom *) + _WRS_DEPRECATED("unimplemented"); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_subrh */ diff --git a/h/wrn/coreip/net/if_types.h b/h/wrn/coreip/net/if_types.h new file mode 100644 index 0000000..5254c33 --- /dev/null +++ b/h/wrn/coreip/net/if_types.h @@ -0,0 +1,246 @@ +/* if_types.h - interface types header file */ + +/* Copyright 2001 - 2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1989, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if_types.h 8.3 (Berkeley) 4/28/95 + * $FreeBSD: src/sys/net/if_types.h,v 1.8.2.4 2002/12/23 23:02:21 kbyanc Exp $ + * $FreeBSD: src/sys/net/if_types.h,v 1.8.2.3 2001/07/03 11:01:41 ume Exp $ + */ + +/* +modification history +-------------------- +01l,24may05,kch Comment out IFT_IST define for now. +01k,13may05,kch Merged from FreeBSD v 1.8.2.4. +01j,20nov03,niq Remove copyright_wrs.h file inclusion +01i,05nov03,cdw Removal of unnecessary _KERNEL guards. +01h,04nov03,rlm Ran batch header path update for header re-org. +01g,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01f,08aug03,nee Merging from label ACCORDION_BASE6_MERGE_BASELINE in + accordion codeline to Base6 +01e,10jun03,vvv include netVersion.h +01d,15may03,spm Tornado 2.2 FCS merge (SPR #76443; ver 01d,16may02,vvv: + TOR2_2-FCS-COPY label, tor2 branch, /wind/river VOB) +01c,09may03,spm T2.2 FCS merge. +01b,09sep02,hsh add c++ protection +01a,16jul01,ham created from FreeBSD4.3-RELEASE(July-17-01). + */ + +#ifndef _NET_IF_TYPES_H_ +#define _NET_IF_TYPES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * Interface types for benefit of parsing media address headers. + * This list is derived from the SNMP list of ifTypes, originally + * documented in RFC1573, now maintained as: + * + * ftp.isi.edu/in-notes/iana/assignments/smi-numbers + */ + +#define IFT_OTHER 0x1 /* none of the following */ +#define IFT_1822 0x2 /* old-style arpanet imp */ +#define IFT_HDH1822 0x3 /* HDH arpanet imp */ +#define IFT_X25DDN 0x4 /* x25 to imp */ +#define IFT_X25 0x5 /* PDN X25 interface (RFC877) */ +#define IFT_ETHER 0x6 /* Ethernet CSMA/CD */ +#define IFT_ISO88023 0x7 /* CMSA/CD */ +#define IFT_ISO88024 0x8 /* Token Bus */ +#define IFT_ISO88025 0x9 /* Token Ring */ +#define IFT_ISO88026 0xa /* MAN */ +#define IFT_STARLAN 0xb +#define IFT_P10 0xc /* Proteon 10MBit ring */ +#define IFT_P80 0xd /* Proteon 80MBit ring */ +#define IFT_HY 0xe /* Hyperchannel */ +#define IFT_FDDI 0xf +#define IFT_LAPB 0x10 +#define IFT_SDLC 0x11 +#define IFT_T1 0x12 +#define IFT_CEPT 0x13 /* E1 - european T1 */ +#define IFT_ISDNBASIC 0x14 +#define IFT_ISDNPRIMARY 0x15 +#define IFT_PTPSERIAL 0x16 /* Proprietary PTP serial */ +#define IFT_PPP 0x17 /* RFC 1331 */ +#define IFT_LOOP 0x18 /* loopback */ +#define IFT_EON 0x19 /* ISO over IP */ +#define IFT_XETHER 0x1a /* obsolete 3MB experimental ethernet */ +#define IFT_NSIP 0x1b /* XNS over IP */ +#define IFT_SLIP 0x1c /* IP over generic TTY */ +#define IFT_ULTRA 0x1d /* Ultra Technologies */ +#define IFT_DS3 0x1e /* Generic T3 */ +#define IFT_SIP 0x1f /* SMDS */ +#define IFT_FRELAY 0x20 /* Frame Relay DTE only */ +#define IFT_RS232 0x21 +#define IFT_PARA 0x22 /* parallel-port */ +#define IFT_ARCNET 0x23 +#define IFT_ARCNETPLUS 0x24 +#define IFT_ATM 0x25 /* ATM cells */ +#define IFT_MIOX25 0x26 +#define IFT_SONET 0x27 /* SONET or SDH */ +#define IFT_X25PLE 0x28 +#define IFT_ISO88022LLC 0x29 +#define IFT_LOCALTALK 0x2a +#define IFT_SMDSDXI 0x2b +#define IFT_FRELAYDCE 0x2c /* Frame Relay DCE */ +#define IFT_V35 0x2d +#define IFT_HSSI 0x2e +#define IFT_HIPPI 0x2f +#define IFT_MODEM 0x30 /* Generic Modem */ +#define IFT_AAL5 0x31 /* AAL5 over ATM */ +#define IFT_SONETPATH 0x32 +#define IFT_SONETVT 0x33 +#define IFT_SMDSICIP 0x34 /* SMDS InterCarrier Interface */ +#define IFT_PROPVIRTUAL 0x35 /* Proprietary Virtual/internal */ +#define IFT_PROPMUX 0x36 /* Proprietary Multiplexing */ +#define IFT_IEEE80212 0x37 +#define IFT_FIBRE_CHANNEL 0x38 +#define IFT_HIPPI_INTERFACE 0x39 +#define IFT_FRAME_RELAY_INTERCONNECT 0x3a +#define IFT_AFLANE8023 0x3b +#define IFT_AFLANE8025 0x3c +#define IFT_CCT_EMUL 0x3d +#define IFT_FAST_ETHER 0x3e +#define IFT_ISDN 0x3f +#define IFT_V11 0x40 +#define IFT_V36 0x41 +#define IFT_G703AT64K 0x42 +#define IFT_G703AT2MB 0x43 +#define IFT_QLLC 0x44 +#define IFT_FAST_ETHER_FX 0x45 +#define IFT_CHANNEL 0x46 +#define IFT_IEEE80211 0x47 +#define IFT_IBM370PAR_CHAN 0x48 +#define IFT_ESCON 0x49 +#define IFT_DLSW 0x4a +#define IFT_ISDNS 0x4b +#define IFT_ISDNU 0x4c +#define IFT_LAPD 0x4d +#define IFT_IP_SWITCH 0x4e +#define IFT_RSRB 0x4f +#define IFT_ATM_LOGICAL 0x50 +#define IFT_DS0 0x51 +#define IFT_DS0_BUNDLE 0x52 +#define IFT_BSC 0x53 +#define IFT_ASYNC 0x54 +#define IFT_CNR 0x55 +#define IFT_ISO88025_DTR 0x56 +#define IFT_EPLRS 0x57 +#define IFT_ARAP 0x58 +#define IFT_PROP_CNLS 0x59 +#define IFT_HOST_PAD 0x5a +#define IFT_TERM_PAD 0x5b +#define IFT_FRAME_RELAY_MPI 0x5c +#define IFT_X213 0x5d +#define IFT_ADSL 0x5e +#define IFT_RADSL 0x5f +#define IFT_SDSL 0x60 +#define IFT_VDSL 0x61 +#define IFT_ISO88025_CRFP_INT 0x62 +#define IFT_MYRINET 0x63 +#define IFT_VOICE_EM 0x64 +#define IFT_VOICE_FXO 0x65 +#define IFT_VOICE_FXS 0x66 +#define IFT_VOICE_ENCAP 0x67 +#define IFT_VOICE_OVER_IP 0x68 +#define IFT_ATM_DXI 0x69 +#define IFT_ATM_FUNI 0x6a +#define IFT_ATM_IMA 0x6b +#define IFT_PPP_MULTILINK_BUNDLE 0x6c +#define IFT_IP_OVER_CDLC 0x6d +#define IFT_IP_OVER_CLAW 0x6e +#define IFT_STACK_TO_STACK 0x6f +#define IFT_VIRTUAL_IP_ADDRESS 0x70 +#define IFT_MPC 0x71 +#define IFT_IP_OVER_ATM 0x72 +#define IFT_ISO88025_FIBER 0x73 +#define IFT_TDLC 0x74 +#define IFT_GIGABIT_ETHERNET 0x75 +#define IFT_HDLC 0x76 +#define IFT_LAPF 0x77 +#define IFT_V37 0x78 +#define IFT_X25MLP 0x79 +#define IFT_X25HUNT_GROUP 0x7a +#define IFT_TRASNP_HDLC 0x7b +#define IFT_INTERLEAVE 0x7c +#define IFT_FAST 0x7d +#define IFT_IP 0x7e +#define IFT_DOCS_CABLE_MACLAYER 0x7f +#define IFT_DOCS_CABLE_DOWNSTREAM 0x80 +#define IFT_DOCS_CABLE_UPSTREAM 0x81 +#define IFT_A12_MPP_SWITCH 0x82 +#define IFT_TUNNEL 0x83 +#define IFT_COFFEE 0x84 +#define IFT_CES 0x85 +#define IFT_ATM_SUB_INTERFACE 0x86 +#define IFT_L2VLAN 0x87 /* 802.1Q Layer 2 Virtual LAN */ +#define IFT_L3IPVLAN 0x88 +#define IFT_L3IPXVLAN 0x89 +#define IFT_DIGITAL_POWERLINE 0x8a +#define IFT_MEDIA_MAIL_OVER_IP 0x8b +#define IFT_DTM 0x8c +#define IFT_DCN 0x8d +#define IFT_IP_FORWARD 0x8e +#define IFT_MSDSL 0x8f +#define IFT_IEEE1394 0x90 /* High Performance SerialBus */ +#define IFT_IF_GSN 0x91 +#define IFT_DVB_RCC_MAC_LAYER 0x92 +#define IFT_DVB_RCC_DOWNSTREAM 0x93 +#define IFT_DVB_RCC_UPSTREAM 0x94 +#define IFT_ATM_VIRTUAL 0x95 +#define IFT_MPLS_TUNNEL 0x96 +#define IFT_SRP 0x97 +#define IFT_VOICE_OVER_ATM 0x98 +#define IFT_VOICE_OVER_FRAME_RELAY 0x99 +#define IFT_IDSL 0x9a +#define IFT_COMPOSITE_LINK 0x9b +#define IFT_SS7_SIG_LINK 0x9c +#define IFT_PMP 0x9d /* Point to Multipoint */ +#define IFT_GIF 0x9e /*0xf0*/ +#define IFT_FAITH 0x9f /*0xf2*/ +#define IFT_STF 0xa0 /* 6to4 interface */ +#define IFT_MIP 0xa1 +/* #define IFT_IST 0xa2 */ +#define IFT_MAX_TYPE IFT_MIP /* the maximum ifType number */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCif_typesh */ diff --git a/h/wrn/coreip/net/if_var.h b/h/wrn/coreip/net/if_var.h new file mode 100644 index 0000000..43cacac --- /dev/null +++ b/h/wrn/coreip/net/if_var.h @@ -0,0 +1,564 @@ +/* if_var.h - network interface variable header file */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* + * Copyright (c) 1982, 1986, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * From: @(#)if.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/if_var.h,v 1.62 2003/11/12 03:14:29 rwatson Exp $ + * $FreeBSD: src/sys/net/if_var.h,v 1.18.2.15 2002/06/28 12:36:54 luigi Exp $ + */ +/* +modification history +-------------------- +02h,21sep05,kch Added if_xname[] to ifnet structure, introduced if_name() + macro to replace if_name() routine for backward compatibility. + Also added if_initname() prototype (merged from FreeBSD 5.x + if_var.h,v 1.84.2.6) (SPR #112724). +02g,29aug05,kch Added if_nvlans counter to ifnet structure (SPR #112068). +02f,26aug05,dlk Add section tags. +02e,26aug05,kch Removed pTagData pointer from ifnet structure. +02d,12aug05,kch Moved ifclone prototypes to if_clone.h. +02c,04aug05,vvv clarified comments for if_index and ifIndex (SPR #106657) +02b,16jul05,dlk Added intrqFlush() declaration for VIRTUAL_STACK case. +02a,25jun05,dlk Added INTRQ_QJOB definition. +01z,24jun05,wap Add link state support +01y,09may05,vvv added include for if.h +01x,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +01w,07feb05,vvv _KERNEL cleanup +01v,10sep04,kc Added VLAN_TAG define to protect pTagData in ifnet structure. +01u,12jul04,vvv fixed compiler warning +01t,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01s,14may04,kc Added pTagData to struct ifnet for L2 VLAN Tagging support. +01r,25feb04,nee Adding if6_resolve to ifnet +01q,24feb04,dlk Add closing brace if __cplusplus is defined. +01p,03feb04,wap Add extra structure fields for checksum offload support +01o,02feb04,dlk Restore interface output queues (repair IF_ENQUEUE()). +01n,20nov03,niq osdep.h cleanup +01m,04nov03,rlm Ran batch header path update for header re-org. +01l,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01k,23oct03,rlm updated #includes for header re-org +01j,24sep03,kkz Rebasing with BASE6_ITER2_FRZ7 - added IF_DEQUEUEIF macro +01i,08aug03,nee Merging from label ACCORDION_BASE6_MERGE_BASELINE in + accordion codeline to Base6 +01h,01feb03,pas merge from FreeBSD 4.7 - added clone support, polling; + changed if_queue_drop() to if_handoff() +01g,18sep02,nee removed ifr_type from ifreq structure +01f,09sep02,hsh add c++ protection +01e,24aug02,nee extended ifnet for admin control;defined admin states for + boot/up/down +01d,13feb02,ham changed for tornado build. +01c,06oct01,ann removing the prototypes for ether_output and + ether_output_frame +01b,11sep01,ann adding the if_resolve func pointer that is missing +01a,16jul01,ham created from FreeBSD4.3. +*/ + +#ifndef _NET_IF_VAR_H_ +#define _NET_IF_VAR_H_ + +/* + * Structures defining a network interface, providing a packet + * transport mechanism (ala level 0 of the PUP protocols). + * + * Each interface accepts output datagrams of a specified maximum + * length, and provides higher level routines with input datagrams + * received from its medium. + * + * Output occurs when the routine if_output is called, with three parameters: + * (*ifp->if_output)(ifp, m, dst, rt) + * Here m is the mbuf chain to be sent and dst is the destination address. + * The output routine encapsulates the supplied datagram if necessary, + * and then transmits it on its medium. + * + * On input, each interface unwraps the data received by it, and either + * places it on the input queue of an internetwork datagram routine + * and posts the associated software interrupt, or passes the datagram to a raw + * packet input routine. + * + * Routines exist for locating interfaces by their addresses + * or for locating an interface on a certain network, as well as more general + * routing and gateway routines maintaining information used to locate + * interfaces. These routines live in the files if.c and route.c + */ + +#ifdef __cplusplus + extern "C" { +#endif + +#ifdef __STDC__ +/* + * Forward structure declarations for function prototypes [sic]. + */ +struct mbuf; +struct proc; +struct rtentry; +struct socket; +struct ether_header; +#endif /* __STDC_ */ + +#include /* get TAILQ macros */ +#include +#include /* XXX */ +#ifdef VIRTUAL_STACK +#include +#endif /* VIRTUAL_STACK */ +#include +#include /* needed for struct if_data */ +#include + +TAILQ_HEAD(ifnethead, ifnet); /* we use TAILQs so that the order of */ +TAILQ_HEAD(ifaddrhead, ifaddr); /* instantiation is preserved in the list */ +TAILQ_HEAD(ifprefixhead, ifprefix); +LIST_HEAD(ifmultihead, ifmultiaddr); + +/* + * Structure defining a queue for a network interface. + */ +struct ifqueue { + struct mbuf *ifq_head; + struct mbuf *ifq_tail; + int ifq_len; + int ifq_maxlen; + int ifq_drops; +}; + +/* Job for dequeueing packets on protocol input queues (loopback only) */ + +typedef struct _INTRQ_QJOB +{ + QJOB job; + struct ifqueue * ifq; + void (* input) (struct mbuf *); +#ifdef VIRTUAL_STACK + int vsnum; +#endif +} INTRQ_QJOB; + + +/* + * Structure defining a network interface. + * + * (Would like to call this struct ``if'', but C isn't PL/1.) + */ + +/* + * NB: For FreeBSD, it is assumed that each NIC driver's softc starts with + * one of these structures, typically held within an arpcom structure. + * + * struct _softc { + * struct arpcom { + * struct ifnet ac_if; + * ... + * } ; + * ... + * }; + * + * The assumption is used in a number of places, including many + * files in sys/net, device drivers, and sys/dev/mii.c:miibus_attach(). + * + * Unfortunately devices' softc are opaque, so we depend on this layout + * to locate the struct ifnet from the softc in the generic code. + * + * Note that not all fields are used by drivers in the FreeBSD source + * tree. However, who knows what third party software does with fields + * marked as "unused", such as if_ipending, if_done, and if_poll*, + * so any attemt to redefine their meaning might end up in binary + * compatibility problems, even if the size of struct ifnet, and + * the size and position of its fields do not change. + * We just have to live with that. + */ +struct ifnet { + void *if_softc; /* pointer to driver state */ + char if_xname[IFNAMSIZ]; /* external name (name + unit) */ + char *if_name; /* name, e.g. ``en'' or ``lo'' */ + TAILQ_ENTRY(ifnet) if_link; /* all struct ifnets are chained */ + struct ifaddrhead if_addrhead; /* linked list of addresses per if */ + int if_pcount; /* number of promiscuous listeners */ + struct bpf_if *if_bpf; /* packet filter structure */ + UINT32 ifIndex; /* External index for this if. It */ + /* is the index used by the MIBs. */ + /* It was added specifically for */ + /* MIB compliance (monotonically */ + /* increasing index by default). */ + u_short if_index; /* Internal index for this if. It */ + /* is the index used by the stack. */ + /* An index can be re-used. */ + short if_unit; /* sub-unit for lower level driver */ + short if_timer; /* time 'til if_watchdog called */ + u_short if_nvlans; /* number of active vlans */ + long if_flags; /* up/down, broadcast, etc. */ + int if_ipending; /* interrupts pending */ + void *if_linkmib; /* link-type-specific MIB data */ + size_t if_linkmiblen; /* length of above data */ + struct if_data if_data; + struct ifmultihead if_multiaddrs; /* multicast addresses configured */ + int if_amcount; /* number of all-multicast requests */ +/* procedure handles */ + int (*if_output) /* output routine (enqueue) */ + (struct ifnet *, struct mbuf *, struct sockaddr *, + struct rtentry *); + void (*if_start) /* initiate output routine */ + (struct ifnet *); + union { + int (*if_done) /* output complete routine */ + (struct ifnet *); /* (XXX not used) */ + int uif_capabilities; /* interface capabilities */ + } _u1; + int (*if_ioctl) /* ioctl routine */ + (struct ifnet *, u_long, caddr_t); + void (*if_watchdog) /* timer routine */ + (struct ifnet *); + union { + int (*if_poll_recv) /* polled receive routine */ + (struct ifnet *, int *); + int uif_capenable; /* enabled features */ + } _u2; + int (*if_poll_xmit) /* polled transmit routine */ + (struct ifnet *, int *); + void (*if_poll_intren) /* polled interrupt reenable routine */ + (struct ifnet *); + void (*if_poll_slowinput) /* input routine for slow devices */ + (struct ifnet *, struct mbuf *); + void (*if_init) /* Init routine */ + (void *); +/* Clarinet - added this func pointer as it is used in the WRS code */ + int (*if_resolve)(); /* arp resolve at driver level */ + int (*if6_resolve)(); /* nd resolve at driver level */ + int (*if_resolvemulti) /* validate/resolve multicast */ + (struct ifnet *, struct sockaddr **, struct sockaddr *); + struct ifqueue if_snd; /* output queue */ + struct ifqueue *if_poll_slowq; /* input queue for slow devices */ + struct ifprefixhead if_prefixhead; /* list of prefixes per if */ +/* Clarinet - added this cookie that holds the drv_ctrl pointer */ + void * pCookie; /* data for IP over MUX attachment */ + int if_adminstatus; + int admin_inet_status; + int admin_inet6_status; /* RFC 2465, admin status control for IPv6 */ + uint32_t if_csum_flags_tx; + uint32_t if_csum_flags_rx; +#ifdef VIRTUAL_STACK + VSNUM vsNum; +#endif /* VIRTUAL_STACK */ + + /* for IPV6, if_afdata[AF_INET6] points to in6_ifextra data structure */ + void *if_afdata[AF_MAX]; + /* int if_afdata_initialized; */ +}; +typedef void if_init_f_t (void *); + +/* + * Binary compatability gunk for 4.x ONLY. + */ +#define if_capabilities _u1.uif_capabilities +#define if_capenable _u2.uif_capenable + +#define if_mtu if_data.ifi_mtu +#define if_type if_data.ifi_type +#define if_physical if_data.ifi_physical +#define if_addrlen if_data.ifi_addrlen +#define if_hdrlen if_data.ifi_hdrlen +#define if_link_state if_data.ifi_link_state +#define if_metric if_data.ifi_metric +#define if_baudrate if_data.ifi_baudrate +#define if_hwassist if_data.ifi_hwassist +#define if_ipackets if_data.ifi_ipackets +#define if_ierrors if_data.ifi_ierrors +#define if_opackets if_data.ifi_opackets +#define if_oerrors if_data.ifi_oerrors +#define if_collisions if_data.ifi_collisions +#define if_ibytes if_data.ifi_ibytes +#define if_obytes if_data.ifi_obytes +#define if_imcasts if_data.ifi_imcasts +#define if_omcasts if_data.ifi_omcasts +#define if_iqdrops if_data.ifi_iqdrops +#define if_noproto if_data.ifi_noproto +#define if_lastchange if_data.ifi_lastchange +#define if_recvquota if_data.ifi_recvquota +#define if_xmitquota if_data.ifi_xmitquota +#define if_rawoutput(if, m, sa) if_output(if, m, sa, (struct rtentry *)0) + +/* for compatibility with other BSDs */ +#define if_addrlist if_addrhead +#define if_list if_link + +#define if_name(ifp) ((ifp)->if_xname) + +/* + * Bit values in if_ipending + */ +#define IFI_RECV 1 /* I want to receive */ +#define IFI_XMIT 2 /* I want to transmit */ + +/* + * Output queues (ifp->if_snd) and slow device input queues (*ifp->if_slowq) + * are queues of messages stored on ifqueue structures + * (defined above). Entries are added to and deleted from these structures + * by these macros, which should be called with ipl raised to splimp(). + */ +#define IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen) +#define IF_DROP(ifq) ((ifq)->ifq_drops++) + +#define IF_ENQUEUE(ifq, m) \ + do { \ + (m)->m_nextpkt = 0; \ + if ((ifq)->ifq_tail == 0) \ + (ifq)->ifq_head = m; \ + else \ + (ifq)->ifq_tail->m_nextpkt = m; \ + (ifq)->ifq_tail = m; \ + (ifq)->ifq_len++; \ + } while (0) + +#define IF_PREPEND(ifq, m) { \ + (m)->m_nextpkt = (ifq)->ifq_head; \ + if ((ifq)->ifq_tail == 0) \ + (ifq)->ifq_tail = (m); \ + (ifq)->ifq_head = (m); \ + (ifq)->ifq_len++; \ +} +#if !defined IF_DEQUEUEIF +#define IF_DEQUEUEIF(ifq, m, ifp) { \ + (m) = (ifq)->ifq_head; \ + if (m) { \ + if (((ifq)->ifq_head = (m)->m_act) == 0) \ + (ifq)->ifq_tail = 0; \ + (m)->m_act = 0; \ + (ifq)->ifq_len--; \ + (ifp) = *(mtod((m), struct ifnet **)); \ + IF_ADJ(m); \ + } \ +} +#endif /* IF_DEQUEUEIF */ + +#define IF_DEQUEUE(ifq, m) { \ + (m) = (ifq)->ifq_head; \ + if (m) { \ + if (((ifq)->ifq_head = (m)->m_nextpkt) == 0) \ + (ifq)->ifq_tail = 0; \ + (m)->m_nextpkt = 0; \ + (ifq)->ifq_len--; \ + } \ +} + +#ifdef _WRS_KERNEL + +/* + * #define _IF_QFULL for compatibility with -current + */ +#define _IF_QFULL(ifq) IF_QFULL(ifq) + +/* + * IF_HANDOFF* and if_handoff are only used in ether_output() and only if + * NS is defined (undefined by default). Added NS protection to keep the + * compiler happy (for "if_handoff not used" warnings). + */ + +#ifdef NS +#define IF_HANDOFF(ifq, m, ifp) if_handoff(ifq, m, ifp, 0) +#define IF_HANDOFF_ADJ(ifq, m, ifp, adj) if_handoff(ifq, m, ifp, adj) + +static __inline int +if_handoff(struct ifqueue *ifq, struct mbuf *m, struct ifnet *ifp, int adjust) +{ + int need_if_start = 0; + int s = splimp(); + + if (IF_QFULL(ifq)) { + IF_DROP(ifq); + splx(s); + m_freem(m); + return (0); + } + if (ifp != NULL) { + ifp->if_obytes += m->m_pkthdr.len + adjust; + if (m->m_flags & M_MCAST) + ifp->if_omcasts++; + need_if_start = !(ifp->if_flags & IFF_OACTIVE); + } + IF_ENQUEUE(ifq, m); + if (need_if_start) + (*ifp->if_start)(ifp); + splx(s); + return (1); +} +#endif /* NS */ + +/* + * 72 was chosen below because it is the size of a TCP/IP + * header (40) + the minimum mss (32). + */ +#define IF_MINMTU 72 +#define IF_MAXMTU 65535 + +#endif /* _WRS_KERNEL */ + +/* + * The ifaddr structure contains information about one address + * of an interface. They are maintained by the different address families, + * are allocated and attached when an address is set, and are linked + * together so all addresses for an interface can be located. + */ +struct ifaddr { + struct sockaddr *ifa_addr; /* address of interface */ + struct sockaddr *ifa_dstaddr; /* other end of p-to-p link */ +#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ + struct sockaddr *ifa_netmask; /* used to determine subnet */ + struct if_data if_data; /* not all members are meaningful */ + struct ifnet *ifa_ifp; /* back-pointer to interface */ + TAILQ_ENTRY(ifaddr) ifa_link; /* queue macro glue */ + void (*ifa_rtrequest) /* check or clean routes (+ or -)'d */ + (int, struct rtentry *, struct sockaddr *); + u_short ifa_flags; /* mostly rt_flags for cloning */ + u_int ifa_refcnt; /* references to this structure */ + int ifa_metric; /* cost of going out this interface */ +#ifdef notdef + struct rtentry *ifa_rt; /* XXXX for ROUTETOIF ????? */ +#endif + int (*ifa_claim_addr) /* check if an addr goes to this if */ + (struct ifaddr *, struct sockaddr *); + +}; +#define IFA_ROUTE RTF_UP /* route installed */ + +/* for compatibility with other BSDs */ +#define ifa_list ifa_link + +/* + * The prefix structure contains information about one prefix + * of an interface. They are maintained by the different address families, + * are allocated and attached when an prefix or an address is set, + * and are linked together so all prefixes for an interface can be located. + */ +struct ifprefix { + struct sockaddr *ifpr_prefix; /* prefix of interface */ + struct ifnet *ifpr_ifp; /* back-pointer to interface */ + TAILQ_ENTRY(ifprefix) ifpr_list; /* queue macro glue */ + u_char ifpr_plen; /* prefix length in bits */ + u_char ifpr_type; /* protocol dependent prefix type */ +}; + +/* + * Multicast address structure. This is analogous to the ifaddr + * structure except that it keeps track of multicast addresses. + * Also, the reference count here is a count of requests for this + * address, not a count of pointers to this structure. + */ +struct ifmultiaddr { + LIST_ENTRY(ifmultiaddr) ifma_link; /* queue macro glue */ + struct sockaddr *ifma_addr; /* address this membership is for */ + struct sockaddr *ifma_lladdr; /* link-layer translation, if any */ + struct ifnet *ifma_ifp; /* back-pointer to interface */ + u_int ifma_refcount; /* reference count */ + void *ifma_protospec; /* protocol-specific state, if any */ +}; + +#ifdef _WRS_KERNEL +#define IFAFREE(ifa) \ + do { \ + if ((ifa)->ifa_refcnt <= 0) \ + ifafree(ifa); \ + else \ + (ifa)->ifa_refcnt--; \ + } while (0) + +#ifndef VIRTUAL_STACK +extern struct ifnethead ifnet_head; +extern struct ifnet **ifindex2ifnet; +extern int ifqmaxlen; +extern struct ifnet *loif; +extern int last_if_index; +extern struct ifaddr **ifnet_addrs; +#endif /* VIRTUAL_STACK */ + +_WRS_FASTTEXT +int ether_output(struct ifnet *, + struct mbuf *, struct sockaddr *, struct rtentry *); + +int if_addmulti(struct ifnet *, struct sockaddr *, struct ifmultiaddr **); +int if_allmulti(struct ifnet *, int); +int if_attach(struct ifnet *); +int if_delmulti(struct ifnet *, struct sockaddr *); +void if_detach(struct ifnet *); +void if_down(struct ifnet *, short); +void if_initname(struct ifnet *, char *, int); +void if_route(struct ifnet *, int flag, int fam); +int if_setlladdr(struct ifnet *, const u_char *, int); +void if_unroute(struct ifnet *, int flag, int fam); +void if_up(struct ifnet *, short); +/*void ifinit(void);*/ /* declared in systm.h for main() */ +int ifioctl(struct socket *, u_long, caddr_t, struct proc *); +int ifpromisc(struct ifnet *, int); +struct ifnet *ifunit(const char *); +struct ifnet *if_withname(struct sockaddr *); + +struct ifaddr *ifa_ifwithaddr(struct sockaddr *); +struct ifaddr *ifa_ifwithdstaddr(struct sockaddr *); +struct ifaddr *ifa_ifwithnet(struct sockaddr *); +struct ifaddr *ifa_ifwithroute(int, struct sockaddr *, struct sockaddr *); +struct ifaddr *ifaof_ifpforaddr(struct sockaddr *, struct ifnet *); +void ifafree(struct ifaddr *); + +struct ifmultiaddr *ifmaof_ifpforaddr(struct sockaddr *, struct ifnet *); +int if_simloop(struct ifnet *ifp, struct mbuf *m, int af, int hlen); + +extern void intrqJobHandler (INTRQ_QJOB * pJob); +#ifdef VIRTUAL_STACK +extern void intrqFlush (struct ifqueue * ifq); +#endif + +#define IF_LLADDR(ifp) \ + LLADDR((struct sockaddr_dl *) ifnet_addrs[ifp->if_index - 1]->ifa_addr) + +#ifdef DEVICE_POLLING +enum poll_cmd { POLL_ONLY, POLL_AND_CHECK_STATUS, POLL_DEREGISTER }; + +typedef void poll_handler_t (struct ifnet *ifp, + enum poll_cmd cmd, int count); +int ether_poll_register(poll_handler_t *h, struct ifnet *ifp); +int ether_poll_deregister(struct ifnet *ifp); +#endif /* DEVICE_POLLING */ +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_NET_IF_VAR_H_ */ diff --git a/h/wrn/coreip/net/if_vlan_var.h b/h/wrn/coreip/net/if_vlan_var.h new file mode 100644 index 0000000..edbfb10 --- /dev/null +++ b/h/wrn/coreip/net/if_vlan_var.h @@ -0,0 +1,79 @@ +/* Copyright 2005 Wind River Systems, Inc. */ + +/* + * Copyright 1998 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that both the above copyright notice and this + * permission notice appear in all copies, that both the above + * copyright notice and this permission notice appear in all + * supporting documentation, and that the name of M.I.T. not be used + * in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. M.I.T. makes + * no representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS + * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT + * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/net/if_vlan_var.h,v 1.5.2.4 2004/09/09 16:57:33 yar Exp $ + */ + +/* +modification history +-------------------- +01c,27aug05,kch Added vlr_upriority and vlr_flags to vlanreq structure. +01b,19aug05,kch Removed vlan tag macros. +01a,28jul05,kch Ported from FreeBSD. +*/ + +#ifndef _NET_IF_VLAN_VAR_H_ +#define _NET_IF_VLAN_VAR_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* sysctl(3) tags, for compatibility purposes */ +#define VLANCTL_PROTO 1 +#define VLANCTL_MAX 2 + +/* vlan request flags */ +#define VLAN_SET_VID 0x0001 +#define VLAN_SET_UPRIORITY 0x0002 + + +/* + * Configuration structure for SIOCSETVLAN and SIOCGETVLAN ioctls. + */ +struct vlanreq { + char vlr_parent[IFNAMSIZ]; + u_short vlr_tag; /* 12-bit vlan id, 1..4094, 0 for priority-tagged */ + u_short vlr_upriority; /* 3-bit user priority, 0..7 */ + u_short vlr_flags; /* vlanreq flag */ +}; + +#define SIOCSETVLAN SIOCSIFGENERIC +#define SIOCGETVLAN SIOCGIFGENERIC + +IMPORT STATUS vlanIfLibInit (void); + +#ifdef __cplusplus +} +#endif + +#endif /* _NET_IF_VLAN_VAR_H_ */ diff --git a/h/wrn/coreip/net/ifaddrs.h b/h/wrn/coreip/net/ifaddrs.h new file mode 100644 index 0000000..c7588e6 --- /dev/null +++ b/h/wrn/coreip/net/ifaddrs.h @@ -0,0 +1,73 @@ +/* ifaddrs.h - structure and routines for interface addresses */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* $KAME: ifaddrs.h,v 1.3 2001/01/26 08:14:55 itojun Exp $ */ + +/* + * Copyright (c) 1995, 1999 + * Berkeley Software Design, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL Berkeley Software Design, Inc. BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * BSDI ifaddrs.h,v 2.5 2000/02/23 14:51:59 dab Exp + */ + +/* +modification history +-------------------- +01d,24may05,vvv updated for user-side builds +01c,20nov03,niq Remove copyright_wrs.h file inclusion +01b,06nov03,rlm Ran batch header update for header re-org. +01a,29apr03,syy Added #ifdef for __cplusplus +*/ + +#ifndef __INCifaddrsh +#define __INCifaddrsh + +#ifdef __cplusplus +extern "C" { +#endif + +struct ifaddrs { + struct ifaddrs *ifa_next; + char *ifa_name; + u_int ifa_flags; + struct sockaddr *ifa_addr; + struct sockaddr *ifa_netmask; + struct sockaddr *ifa_dstaddr; + void *ifa_data; +}; + +/* + * This may have been defined in . Note that if is + * to be included it must be included before this header file. + */ +#ifndef ifa_broadaddr +#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ +#endif + +extern int getifaddrs __P((struct ifaddrs **)); +extern void freeifaddrs __P((struct ifaddrs *)); + +#ifdef __cplusplus +} +#endif + +#endif /* ! __INCifaddrsh */ diff --git a/h/wrn/coreip/net/inet.h b/h/wrn/coreip/net/inet.h new file mode 100644 index 0000000..fdc65e1 --- /dev/null +++ b/h/wrn/coreip/net/inet.h @@ -0,0 +1,88 @@ +/* inet.h - Internet header */ + +/* Copyright 1986 - 2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1983 Regents of the University of California. + + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * @(#)inet.h 5.2 (Berkeley) 6/27/88 + */ + +/* +modification history +-------------------- +01n,29jun05,vvv added inet_ntop() and inet_pton() for RFC3542 +01m,04mar04,ann Removed #ifndef _KERNEL protection for including in.h + as this file is required for defining struct in_addr. +01l,20nov03,niq Remove copyright_wrs.h file inclusion +01k,04nov03,rlm Ran batch header path update for header re-org. +01j,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01i,13jun03,syy Added prototype for inet_ntoa_b() (SPR#88384) +01h,09may03,vvv included in.h +01g,26jul99,spm added ansi/c++ prototypes for routines (SPR #5307) +01f,22sep92,rrr added support for c++ +01e,26may92,rrr the tree shuffle +01d,04oct91,rrr passed through the ansification filter + -changed copyright notice +01c,05oct90,shl added copyright notice. + added title. +01b,16apr89,gae updated to new 4.3BSD. +01a,22dec86,rdc created. +*/ + +#ifndef __INCineth +#define __INCineth + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * External definitions for + * functions in inet(3N) + */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern unsigned long inet_addr (char *); +extern void inet_ntoa_b (struct in_addr, char *); +extern char * inet_ntoa (struct in_addr); +extern struct in_addr inet_makeaddr (int, int); +extern unsigned long inet_network (char *); +extern const char * inet_ntop (int af, const void *src, char *dst, + size_t size); +extern int inet_pton (int af, const char *src, void *dst); + +#else + +unsigned long inet_addr(); +void inet_ntoa_b (); +char *inet_ntoa(); +struct in_addr inet_makeaddr(); +unsigned long inet_network(); +const char * inet_ntop (); +int inet_pton (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCafh */ diff --git a/h/wrn/coreip/net/mbuf.h b/h/wrn/coreip/net/mbuf.h new file mode 100644 index 0000000..1a68703 --- /dev/null +++ b/h/wrn/coreip/net/mbuf.h @@ -0,0 +1,568 @@ +/* mbuf.h - mbuf header file */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)mbuf.h 8.5 (Berkeley) 2/19/95 + * $FreeBSD: src/sys/sys/mbuf.h,v 1.44.2.26 2004/06/17 00:08:21 fjoe Exp $ + */ + +/* +modification history +-------------------- +02k,15sep05,kch Added CSUM_PTAGGED for 802.1P priority-tagged frame support + (SPR #112513). +02j,07sep05,kch Removed CSUM_NOVLAN (SPR #112068). +02i,01sep05,sar Add M_WRITEABLE check to M_LEADINGSPACE and + M_TRAILINGSPACE to ensure we don't overwrite + part of a buffer that we shouldn't. +02h,28jul05,dlk Added CSUM_VLAN and CSUM_NOVLAN. +02g,12jul05,vvv merged M_NOTIFICATION from kame-20050404-freebsd411 +02f,17jun05,dlk Make m_copym(), m_copypacket(), and m_copydata() macros also. +02e,16may05,dlk Make m_freem() and m_free() macros for better performance. +02d,22apr05,kch Fixed diab compilation error for MCLGET1() macro. +02c,07feb05,vvv _KERNEL cleanup +02b,24jan05,vvv osdep.h cleanup +02a,20jan05,sar Removal of unused m_dup routine. +01z,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01y,01jul04,vvv fixed warnings +01x,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01w,05feb04,wap Make M_COPY_PKTHDR() preserve extra fields in mBlkHdr +01v,06jan04,vvv removed dtom, modified allocation macros to not store mbuf + back-pointer (SPR #88742) +01u,20nov03,niq Remove copyright_wrs.h file inclusion +01t,04nov03,rlm Ran batch header path update for header re-org. +01s,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01r,27oct03,cdw update include statements post header re-org. +01q,18aug03,nee Merging from ACCORDION_BASE6_MERGE_BASELINE. Only + virtualixation related changes are being merged in. +01p,09jul03,syy Back out the previous fix to SPR#88742 +01o,06jun03,pas fix M_LEADINGSPACE to account for hidden back-ptr (SPR#88742) +01n,14may03,vvv make routines available when _KERNEL is not defined +01m,01may03,spm Tornado 2.2 CP1 merge (from ver 01n,21mar02,vvv: + TOR2_2-CP1-F label, tor2_2-patch branch, /wind/river VOB) +01l,15apr03,syy Fixed Diab compiler warnings +01k,01feb03,pas merge from FreeBSD 4.7 - added packet tags +01j,30sep02,sar Add M_SECURE_PKT to the list of mflags +01i,23aug02,ann extended MGETHDR1 and MGET1 to recognize bestfit and closefit +01h,20jun02,ann redefined MGET1/MGETHDR1/MCLGET1 +01g,07jun02,pas new version of MGET/MGETHDR/MCLGET takes size argument +01f,29apr02,deg back to old netBufLib +01e,22mar02,deg MFREE auxiliary chain freeing removed (moved to _mBlkFree()) +01d,06feb02,ham changed for tornado build. +01c,05feb02,deg bugfix in MCLGET() +01b,11dec01,ppp correcting m_pktdat +01a,08sep01,qli fixed mtod +01a,09aug01,deg written. +*/ + +#ifndef __INCNewMbufh +#define __INCNewMbufh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _WRS_KERNEL + +#include + +#ifdef VIRTUAL_STACK +#include +#endif /* VIRTUAL_STACK */ + +/* + * Note that any file which uses _pNetDpool or _pNetSysPool, either directly + * or via the macros (MGET1 etc) MUST include vsNetCore.h for Virtual Stack. + */ + +#ifndef VIRTUAL_STACK +extern NET_POOL_ID _pNetDpool; /* network data pool */ +extern NET_POOL_ID _pNetSysPool; /* network system pool */ +#endif /* ! VIRTUAL_STACK */ + +extern M_CL_CONFIG pktMblkClBlkDesc; /* mBlk, clBlk configuration */ +extern CL_DESC pktClDescTbl []; /* cluster configuration */ +extern UINT pktClDescTblNumEnt; /* no. elements in the table */ + +extern M_CL_CONFIG sysMblkClBlkDesc; /* mBlk, clBlk configuration */ +extern CL_DESC sysClDescTbl []; /* cluster configuration */ +extern UINT sysClDescTblNumEnt; /* no. elements in the table */ + + +/* + * Mbufs are of a single size, MSIZE (machine/param.h), which + * includes overhead. An mbuf may add a single "mbuf cluster" of size + * MCLBYTES (also in machine/param.h), which has no additional overhead + * and is used instead of the internal data area; this is done when + * at least MINCLSIZE of data must be stored. + */ + +#define SIMCLSIZE 128 /* cluster size to simulate mbuf data space */ + +#define MCLBYTES 2048 /* mbuf cluster size */ + + +#define MLEN SIMCLSIZE +#define MHLEN MLEN +#define MINCLSIZE (MHLEN + 1) /* smallest amount to put in cluster */ + +/* + * Macro for type conversion + * mtod(m, t) - convert mbuf pointer to data pointer of correct type + */ + +#define mtod(m, t) ((t)((m)->m_data)) + +/* Clarinet defs */ +#define mbuf mBlk +#define m_next mBlkHdr.mNext +#define m_len mBlkHdr.mLen +#define m_data mBlkHdr.mData +#define m_type mBlkHdr.mType +#define m_flags mBlkHdr.mFlags +#define m_nextpkt mBlkHdr.mNextPkt +#define m_act m_nextpkt +#define m_pkthdr mBlkPktHdr +#define m_ext pClBlk + +#define m_hdr mHdr +#define mh_next mNext +#define mh_nextpkt mNextPkt +#define mh_data mData +#define mh_len mLen +#define mh_type mType +#define mh_flags mFlags + +#define m_extBuf m_ext->clNode.pClBuf +#define m_extSize m_ext->clSize +#define m_extRefCnt m_ext->clRefCnt +#define m_extFreeRtn m_ext->pClFreeRtn +#define m_extArg1 m_ext->clFreeArg1 +#define m_extArg2 m_ext->clFreeArg2 +#define m_extArg3 m_ext->clFreeArg3 + + +/* + * It is not possible to port m_ext.ext_buf and m_ext.ext_free + * Change your code : + * m_ext.ext_buf to m_extBuf + * m_ext.ext_free to m_extFreeRtn + */ +#define m_pktdat m_ext->clNode.pClBuf +#define m_dat m_ext->clNode.pClBuf + +#define M_PROTO1 0x0008 /* protocol-specific */ +#define M_PROTO2 0x0010 /* protocol-specific */ +#define M_PROTO3 0x0020 /* protocol-specific */ +#define M_PROTO4 0x0040 /* protocol-specific */ + +/* The M_PROTO5 flag has been removed to allow the bit to be + * used as the SECURE_PKT bit. The define has been left in + * as part of the history of the file and should be removed + * in the future. + * sar + */ +#if 0 +#define M_PROTO5 0x0080 /* protocol-specific */ +#endif +#define M_SECURE_PKT 0x0080 /* For use by Wind River IPSec product */ + +#define M_FRAG 0x0400 /* packet is a fragment of a larger packet */ +#define M_FIRSTFRAG 0x0800 /* packet is first fragment */ +#define M_LASTFRAG 0x1000 /* packet is last fragment */ + +#define M_NOTIFICATION 0x8000 /* notification event */ + +/* flags copied when copying m_pkthdr */ +#define M_COPYFLAGS (M_PKTHDR|M_EOR|M_PROTO1|M_PROTO1|M_PROTO2|M_PROTO3 | \ + M_PROTO4|M_SECURE_PKT|M_BCAST|M_MCAST|M_FRAG) + +/* flags indicating hw checksum support and sw checksum requirements */ +#define CSUM_IP 0x0001 /* will csum IP */ +#define CSUM_TCP 0x0002 /* will csum TCP */ +#define CSUM_UDP 0x0004 /* will csum UDP */ +#define CSUM_IP_FRAGS 0x0008 /* will csum IP fragments */ +#define CSUM_FRAGMENT 0x0010 /* will do IP fragmentation */ +#define CSUM_TCP_SEG 0x0020 /* will segment TCP/IPv4 */ +#define CSUM_TCPv6 0x0040 /* will csum TCP/IPv6 */ +#define CSUM_UDPv6 0x0080 /* will csum UDP/IPv6 */ +#define CSUM_TCPv6_SEG 0x0100 /* will csum TCP/IPv6 */ +#define CSUM_VLAN 0x0200 /* insert or extracted VLAN */ +#define CSUM_PTAGGED 0x0400 /* send priority-tagged frame */ + +#define CSUM_IP_CHECKED 0x1000 /* did csum IP */ +#define CSUM_IP_VALID 0x2000 /* ... the csum is valid */ +#define CSUM_DATA_VALID 0x4000 /* csum_data field is valid */ +#define CSUM_PSEUDO_HDR 0x8000 /* csum_data has pseudo hdr */ + +#define CSUM_DELAY_DATA (CSUM_TCP | CSUM_UDP) +#define CSUM_DELAY_IP (CSUM_IP) /* XXX add ipv6 here too? */ +#define CSUM_DELAY_DATA6 (CSUM_TCPv6 | CSUM_UDPv6) + +#define CSUM_RESULTS (CSUM_IP_CHECKED | CSUM_IP_VALID | \ + CSUM_DATA_VALID | CSUM_PSEUDO_HDR) + +#define CSUM_IP_HDRLEN(pMblk) ((pMblk)->mBlkHdr.offset1) +#define CSUM_XPORT_HDRLEN(pMblk) \ + (((pMblk)->mBlkPktHdr.csum_data & 0xff00) >> 8) +#define CSUM_XPORT_CSUM_OFF(pMblk) ((pMblk)->mBlkPktHdr.csum_data & 0xff) + + +/* malloc flags (sys/malloc.h) */ +#define M_NOWAIT M_DONTWAIT +#define M_WAITOK M_WAIT +#define M_CLOSEFIT 0x02 + +/* + * mbuf allocation/deallocation macros: + * + * MGET(struct mbuf *m, int how, int type) + * allocates an mbuf and initializes it to contain internal data. + * + * MGETHDR(struct mbuf *m, int how, int type) + * allocates an mbuf and initializes it to contain a packet header + * and internal data. + */ + +/* Clarinet: This one gets an mbuf with attached cluster, to replace + * the MGET()/MCLGET() paired calls. This should save some time by + * avoiding allocating a 128-byte cluster, freeing it, allocating a + * larger cluster, and joining it to the clBlk. + */ +#define MGET1(m, size, how, type) \ + { \ + (m) = netTupleGet (_pNetDpool, size < SIMCLSIZE ? SIMCLSIZE : size, \ + (how & M_NOWAIT), (type), \ + ((how & M_CLOSEFIT) ? \ + FALSE : TRUE)); \ + } + +/* Following change is to eliminate Diab compiler warning 1606 */ + +#define MGET(m, how, type) \ + { \ + (m) = netTupleGet (_pNetDpool, SIMCLSIZE, \ + (how & M_NOWAIT), (type), \ + ((how & M_CLOSEFIT) ? \ + FALSE : TRUE)); \ + } + +#define MGETHDR1(m, size, how, type) \ + { \ + int i = size; \ + \ + (m) = netTupleGet(_pNetDpool, i < SIMCLSIZE ? SIMCLSIZE : i, \ + (how & M_NOWAIT), (type), \ + ((how & M_CLOSEFIT) ? FALSE : TRUE)); \ + if ((m) != NULL) \ + (m)->m_flags |= M_PKTHDR; \ + } + +/* Following change is to eliminate Diab compiler warning 1606 */ + +#define MGETHDR(m, how, type) \ + { \ + (m) = netTupleGet (_pNetDpool, SIMCLSIZE, \ + (how & M_NOWAIT), (type), \ + ((how & M_CLOSEFIT) ? FALSE : TRUE)); \ + if ((m) != NULL) \ + (m)->m_flags |= M_PKTHDR; \ + } + +#define MCLGET1(m, size, how) \ + { \ + char * pClBuf; \ + CL_POOL_ID pClPool; \ + \ + if ((m)->m_flags & M_EXT) \ + { \ + netClFree((m)->pClBlk->pNetPool, \ + (UCHAR *)(m)->pClBlk->clNode.pClBuf); \ + (m)->m_flags &= ~M_EXT; \ + } \ + \ + if ((pClPool = netClPoolIdGet(_pNetDpool, \ + (size), \ + TRUE)) != NULL) \ + { \ + if ((pClBuf = netClusterGet(_pNetDpool, \ + pClPool)) != NULL) \ + { \ + netClBlkJoin((m)->m_ext, \ + pClBuf, \ + (size), \ + 0,0,0,0); \ + netMblkClJoin((m), (m)->m_ext); \ + } \ + } \ + } + +#define MCLGET(m, how) MCLGET1(m, MCLBYTES, how) + +/* + * MFREE(struct mbuf *m, struct mbuf *n) + * Free a single mbuf and associated external storage. + * Place the successor, if any, in n. + * + * we do need to check non-first mbuf for m_aux, since some of existing + * code does not call M_PREPEND properly. + * (example: call to bpf_mtap from drivers) + */ +#define MFREE(m, n) (n) = netMblkClFree((m)) + +/* + * Copy mbuf pkthdr from "from" to "to". + * from must have M_PKTHDR set, and to must be empty. + * aux pointer will be moved to `to'. + */ +#define M_COPY_PKTHDR(to, from) \ + { \ + struct mbuf *_mfrom = (from); \ + struct mbuf *_mto = (to); \ + _mto->mBlkHdr.reserved = _mfrom->mBlkHdr.reserved;\ + _mto->mBlkHdr.offset1 = _mfrom->mBlkHdr.offset1; \ + _mto->m_flags = _mfrom->m_flags; \ + _mto->m_pkthdr = _mfrom->m_pkthdr; \ + _mfrom->m_pkthdr.aux = (struct mbuf *)NULL; \ + } + +/* + * Set the m_data pointer of a newly-allocated mbuf (m_get/MGET) to place + * an object of the specified size at the end of the mbuf, longword aligned. + */ +#define M_ALIGN(m, len) ((m)->m_data += \ + ((m)->m_extSize - (len)) &~ (sizeof(long) - 1)) + +/* + * As above, for mbufs allocated with m_gethdr/MGETHDR + * or initialized by M_COPY_PKTHDR. + */ +#define MH_ALIGN(m, len) (M_ALIGN((m),(len))) + +/* + * Check if we can write to an mbuf. + */ +#define M_WRITABLE(m) ((m)->m_extRefCnt == 1) + +/* For M_LEADINGSPACE and M_TRAILINGSPACE the + * M_WRITABLE() is a conservative safety measure. */ + +/* + * Compute the amount of space available + * before the current start of data in an mbuf. + */ +#define M_LEADINGSPACE(m) \ + (M_WRITABLE(m) ? ((m)->m_data - (m)->m_extBuf) : 0) +/* + * Compute the amount of space available + * after the end of data in an mbuf. + */ +#define M_TRAILINGSPACE(m) \ + (M_WRITABLE(m) ? ((m)->m_extBuf + (m)->m_extSize - \ + (m)->m_data - (m)->m_len) \ + : 0) + +/* + * Arrange to prepend space of size plen to mbuf m. + * If a new mbuf must be allocated, how specifies whether to wait. + * If how is M_DONTWAIT and allocation fails, the original mbuf chain + * is freed and m is set to NULL. + */ + +#ifndef STANDALONE_AGENT +#define M_PREPEND(m, plen, how) \ + { \ + if (M_LEADINGSPACE(m) >= (plen)) \ + { \ + (m)->m_data -= (plen); \ + (m)->m_len += (plen); \ + } \ + else \ + (m) = m_prepend((m), (plen), (how)); \ + if ((m) && (m)->m_flags & M_PKTHDR) \ + (m)->m_pkthdr.len += (plen); \ + } +#else /* STANDALONE_AGENT */ +/* + * for standalone agent, the M_PREPEND routine does no try to allocate + * a new buffer (there is no available). Anyway, this is not needed since + * all the WDB packets can be stored in one buffer. + */ + +#define M_PREPEND(m, plen, how) \ + { \ + if (M_LEADINGSPACE(m) >= (plen)) { \ + (m)->m_data -= (plen); \ + (m)->m_len += (plen); \ + } else \ + (m) = NULL; \ + if ((m) && (m)->m_flags & M_PKTHDR) \ + (m)->m_pkthdr.len += (plen); \ + } +#endif /* STANDALONE_AGENT */ + +/* change mbuf to new type */ +#define MCHTYPE(m, t) (_pNetDpool->mBlkStat.types[(m)->m_type]--; \ + _pNetDpool->mBlkStat.types[(t)]++; \ + (m)->m_type = (t)) + +/* compatibility with 4.3 */ + +/* + * pkthdr.aux type tags. + */ +struct mauxtag { + int af; + int type; + void* p; +}; + +/* + * Some packet tags to identify different mbuf annotations. + * + * Eventually, these annotations will end up in an appropriate chain + * (struct m_tag or similar, e.g. as in NetBSD) properly managed by + * the mbuf handling routines. + * + * As a temporary and low impact solution to replace the even uglier + * approach used so far in some parts of the network stack (which relies + * on global variables), these annotations are stored in MT_TAG + * mbufs (or lookalikes) prepended to the actual mbuf chain. + * + * m_type = MT_TAG + * m_flags = m_tag_id + * m_next = next buffer in chain. + * + * BE VERY CAREFUL not to pass these blocks to the mbuf handling routines. + * + */ + +#define m_tag_id m_flags + +/* Packet tag types -- first ones are from NetBSD */ + +#define PACKET_TAG_NONE 0 /* Nadda */ +#define PACKET_TAG_IPSEC_IN_DONE 1 /* IPsec applied, in */ +#define PACKET_TAG_IPSEC_OUT_DONE 2 /* IPsec applied, out */ +#define PACKET_TAG_IPSEC_IN_CRYPTO_DONE 3 /* NIC IPsec crypto done */ +#define PACKET_TAG_IPSEC_OUT_CRYPTO_NEEDED 4 /* NIC IPsec crypto req'ed */ +#define PACKET_TAG_IPSEC_IN_COULD_DO_CRYPTO 5 /* NIC notifies IPsec */ +#define PACKET_TAG_IPSEC_PENDING_TDB 6 /* Reminder to do IPsec */ +#define PACKET_TAG_BRIDGE 7 /* Bridge processing done */ +#define PACKET_TAG_GIF 8 /* GIF processing done */ +#define PACKET_TAG_GRE 9 /* GRE processing done */ +#define PACKET_TAG_IN_PACKET_CHECKSUM 10 /* NIC checksumming done */ +#define PACKET_TAG_ENCAP 11 /* Encap. processing */ +#define PACKET_TAG_IPSEC_SOCKET 12 /* IPSEC socket ref */ +#define PACKET_TAG_IPSEC_HISTORY 13 /* IPSEC history */ +#define PACKET_TAG_IPV6_INPUT 14 /* IPV6 input processing */ + +/* Packet tags used in the FreeBSD network stack + * We don't support dummynet or divert, they are included for consistency */ +#define PACKET_TAG_DUMMYNET 15 /* dummynet info */ +#define PACKET_TAG_IPFW 16 /* ipfw classification */ +#define PACKET_TAG_DIVERT 17 /* divert info */ +#define PACKET_TAG_IPFORWARD 18 /* ipforward info */ + +#define PACKET_TAG_MAX 19 + +#ifdef VIRTUAL_STACK +typedef struct memList + { + SLIST_ENTRY(memList) next; + char * allocatedMem; + } MEM_LIST; +#endif /* VIRTUAL_STACK */ + +#ifndef VIRTUAL_STACK + +extern int max_linkhdr; /* largest link-level header */ +extern int max_protohdr; /* largest protocol header */ +extern int max_hdr; /* largest link+protocol header */ +#endif /* ! VIRTUAL_STACK */ + +void m_adj (struct mbuf *, int); +void m_cat (struct mbuf *,struct mbuf *); + +void m_copyback (struct mbuf *, int, int, caddr_t); +void m_copydata (struct mbuf *,int,int,caddr_t); +struct mbuf *m_copypacket (struct mbuf *, int); +struct mbuf *m_devget (char *, int, int, struct ifnet *, + void (*copy)(char *, caddr_t, u_int)); +/* Removed m_dup as it wasn't being used */ +struct mbuf *m_free (struct mbuf *); +void m_freem (struct mbuf *); + +struct mbuf *m_get (int, int); +struct mbuf *m_getclr (int, int); +struct mbuf *m_gethdr (int, int); +struct mbuf *m_getm (struct mbuf *, int, int, int); + +struct mbuf *m_prepend (struct mbuf *,int,int); +struct mbuf *m_pulldown (struct mbuf *, int, int, int *); + +struct mbuf *m_pullup (struct mbuf *, int); + +struct mbuf *m_split (struct mbuf *,int,int); + +struct mbuf *m_aux_add2 (struct mbuf *, int, int, void *); +struct mbuf *m_aux_find2 (struct mbuf *, int, int, void *); +struct mbuf *m_aux_add (struct mbuf *, int, int); +struct mbuf *m_aux_find (struct mbuf *, int, int); +void m_aux_delete (struct mbuf *, struct mbuf *); + +struct mbuf *m_copym (struct mbuf *, int, int, int); + +/* Make m_freem() and m_free() macros for better performance */ +#define m_freem(m) (netMblkClChainFree (m)) +#define m_free(m) (netMblkClFree (m)) + +/* Make m_copydata(), m_copypacket(), and m_copym() macros also */ +#define m_copydata(m, off, len, cp) \ + ((void)(netMblkOffsetToBufCopy((m), (off), (cp), (len), 0))) +#define m_copym(m, off0, len, wait) \ + (netMblkChainDup(_pNetDpool, (m), (off0), (len), (wait))) +#define m_copypacket(m, how) \ + (netMblkChainDup(_pNetDpool, (m), 0, M_COPYALL, (how))) +#define m_copy(m, o, l) m_copym((m), (o), (l), M_DONTWAIT) + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCNewMbufh */ diff --git a/h/wrn/coreip/net/mipsock.h b/h/wrn/coreip/net/mipsock.h new file mode 100644 index 0000000..8facc01 --- /dev/null +++ b/h/wrn/coreip/net/mipsock.h @@ -0,0 +1,211 @@ +/* $Id: mipsock.h,v 1.4 2005/03/10 23:30:36 t-momose Exp $ */ + +/* Copyright (c) 2005 Wind River Systems, Inc. */ + +/* + * Copyright (C) 2004 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* +modification history +-------------------- +01a,09may05,rp ported from kame v1.4 +*/ + +#ifndef _NET_MIPSOCK_H_ +#define _NET_MIPSOCK_H_ + +#include + +struct mip_msghdr { + u_short miph_msglen; /* to skip over non-understood messages */ + u_char miph_version; /* future binary compatibility */ + u_char miph_type; /* message type */ + int miph_seq; /* for sender to identify action */ +}; + +struct mipm_bc_info { + u_short mipc_msglen; /* to skip over non-understood messages */ + u_char mipc_version; /* future binary compatibility */ + u_char mipc_type; /* message type */ + int mipc_seq; /* for sender to identify action */ + + int mipc_seqno; + int mipc_lifetime; + u_int16_t mipc_flags; + struct sockaddr mipc_addr[0]; +#define MIPC_HOA(mipc) (&(mipc)->mipc_addr[0]) +#define MIPC_COA(mipc) ((struct sockaddr *)((caddr_t)(MIPC_HOA(mipc)) \ + + (MIPC_HOA(mipc))->sa_len)) +#define MIPC_CNADDR(mipc) ((struct sockaddr *)((caddr_t)(MIPC_COA(mipc)) \ + + (MIPC_COA(mipc))->sa_len)) +}; + +struct mipm_bul_info { + u_short mipu_msglen; /* to skip over non-understood messages */ + u_char mipu_version; /* future binary compatibility */ + u_char mipu_type; /* message type */ + int mipu_seq; /* for sender to identify action */ + + u_int16_t mipu_flags; + u_short mipu_hoa_ifindex; + char mipu_coa_ifname[IFNAMSIZ]; + u_int8_t mipu_state; + struct sockaddr mipu_addr[0]; +#define MIPU_HOA(mipu) (&(mipu)->mipu_addr[0]) +#define MIPU_COA(mipu) ((struct sockaddr *)((caddr_t)(MIPU_HOA(mipu)) \ + + (MIPU_HOA(mipu))->sa_len)) +#define MIPU_PEERADDR(mipu) ((struct sockaddr *)((caddr_t)(MIPU_COA(mipu)) \ + + (MIPU_COA(mipu))->sa_len)) +}; + +struct mipm_nodetype_info { + struct mip_msghdr mipmni_hdr; + u_int8_t mipmni_nodetype; + u_int8_t mipmni_enable; /* set 1 to enable, 0 to disable */ +}; +#define mipmni_msglen mipmni_hdr.miph_msglen +#define mipmni_version mipmni_hdr.miph_version +#define mipmni_type mipmni_hdr.miph_type +#define mipmni_seq mipmni_hdr.miph_seq + +struct mipm_home_hint { + struct mip_msghdr mipmhh_hdr; + u_int16_t mipmhh_ifindex; /* ifindex of interface + which received RA */ + u_int16_t mipmhh_prefixlen; /* Prefix Length */ + struct sockaddr mipmhh_prefix[0]; /* received prefix */ +}; +#define mipmhh_msglen mipmhh_hdr.miph_msglen +#define mipmhh_version mipmhh_hdr.miph_version +#define mipmhh_type mipmhh_hdr.miph_type +#define mipmhh_seq mipmhh_hdr.miph_seq + +/* + * Usage: + * + * switch (command) { + * case MIPM_MD_REREG: + * + mandate field: + * 'mipm_md_newcoa' (MUST set to a care-of address(s) to send BU) + * + options field: + * 'mipm_md_ifindex or mipm_md_hoa' (if an option(s) is + * defined, the new coa is applied only to the specified + * target (i.e. either mip virtual interface or HoA, or both)) + * + * case MIPM_MD_DEREGHOME: + * + mandate fields: + * 'mipm_md_newcoa' (MUST set to the home address) + * 'mipm_md_ifindex or mipm_md_hoa' (MUST set either a mip + * virtual interface or a HoA (can be both) which is now + * returned to home) + * + * case MIPM_MD_DEREGFOREIGN: + * + mandate fields: + * 'mipm_md_newcoa' (MUST set to a CoA to send dereg BU) + * 'mipm_md_ifindex or mipm_md_hoa' (MUST set either a mip + * virtual interface or a HoA (can be both) which is now + * returned to home) + * } + */ +struct mipm_md_info { + struct mip_msghdr mipm_md_hdr; + u_char mipm_md_command; +#define MIPM_MD_REREG 0x01 +#define MIPM_MD_DEREGHOME 0x02 +#define MIPM_MD_DEREGFOREIGN 0x03 +#define MIPM_MD_SCAN 0x04 + + u_char mipm_md_hint; +#define MIPM_MD_INDEX 0x01 +#define MIPM_MD_ADDR 0x02 +#define MIPM_MD_HOME 0x03 + u_int16_t mipm_md_ifindex; + + struct sockaddr mipm_md_addr[0]; +#define MIPD_HOA(mipd) (&(mipd)->mipm_md_addr[0]) +#define MIPD_COA(mipd) ((struct sockaddr *)((caddr_t)(MIPD_HOA(mipd)) \ + + (MIPD_HOA(mipd))->sa_len)) +#define MIPD_COA2(mipd) ((struct sockaddr *)((caddr_t)(MIPD_COA(mipd)) \ + + (MIPD_COA(mipd))->sa_len)) +}; + +struct mipm_rr_hint { + struct mip_msghdr mipmrh_hdr; + struct sockaddr mipmrh_addr[0]; +}; +#define mipmrh_msglen mipmrh_hdr.miph_msglen +#define mipmrh_version mipmrh_hdr.miph_version +#define mipmrh_type mipmrh_hdr.miph_type +#define mipmrh_seq mipmrh_hdr.miph_seq +#define MIPMRH_HOA(mipmrh) ((mipmrh)->mipmrh_addr) +#define MIPMRH_PEERADDR(mipmrh) \ + ((struct sockaddr *)((caddr_t)(MIPMRH_HOA(mipmrh)) \ + + (MIPMRH_HOA(mipmrh))->sa_len)) + +struct mipm_be_hint { + struct mip_msghdr mipmbeh_hdr; + u_int8_t mipmbeh_status; + struct sockaddr mipmbeh_addr[0]; +}; +#define mipmbeh_msglen mipmbeh_hdr.miph_msglen +#define mipmbeh_version mipmbeh_hdr.miph_version +#define mipmbeh_type mipmbeh_hdr.miph_type +#define mipmbeh_seq mipmbeh_hdr.miph_seq +#define MIPMBEH_PEERADDR(mipmbeh) ((mipmbeh)->mipmbeh_addr) +#define MIPMBEH_COA(mipmbeh) \ + ((struct sockaddr *)((caddr_t)(MIPMBEH_PEERADDR(mipmbeh)) \ + + (MIPMBEH_PEERADDR(mipmbeh))->sa_len)) +#define MIPMBEH_HOA(mipmbeh) \ + ((struct sockaddr *)((caddr_t)(MIPMBEH_COA(mipmbeh)) \ + + (MIPMBEH_COA(mipmbeh))->sa_len)) + +#define MIP_VERSION 1 + +#define MIPM_NODETYPE_INFO 1 +#define MIPM_BC_ADD 2 +#define MIPM_BC_UPDATE 3 +#define MIPM_BC_REMOVE 4 +#define MIPM_BC_FLUSH 5 +#define MIPM_BUL_ADD 6 +#define MIPM_BUL_UPDATE 7 +#define MIPM_BUL_REMOVE 8 +#define MIPM_BUL_FLUSH 9 +#define MIPM_MD_INFO 10 +#define MIPM_HOME_HINT 11 +#define MIPM_RR_HINT 12 +#define MIPM_BE_HINT 13 + +void mips_notify_home_hint(u_int16_t, struct in6_addr *, u_int16_t); +void mips_notify_rr_hint(struct in6_addr *, struct in6_addr *); +void mips_notify_be_hint(struct in6_addr *, struct in6_addr *, + struct in6_addr *, u_int8_t); + +int mips_output(struct mbuf *, struct socket *); + +#endif /* !_NET_MIPSOCK_H_ */ diff --git a/h/wrn/coreip/net/protosw.h b/h/wrn/coreip/net/protosw.h new file mode 100644 index 0000000..98826c2 --- /dev/null +++ b/h/wrn/coreip/net/protosw.h @@ -0,0 +1,360 @@ +/* protosw.h - protocol switch table header file */ + +/* Copyright 2001 - 2005 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)protosw.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/sys/sys/protosw.h,v 1.28.2.2 2001/07/03 11:02:01 ume Exp $ + */ + +/* + modification history + -------------------- +01m,12jul05,vvv merged from kame-20050404-freebsd411 +01l,07feb05,vvv _KERNEL cleanup +01k,24jan05,vvv osdep.h cleanup +01j,19jan04,bwa added PRUS_EXP definition for COMP protocol +01i,20nov03,niq Remove copyright_wrs.h file inclusion +01h,04nov03,rlm Ran batch header path update for header re-org. +01g,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01f,07aug03,nee Merging to Base6 from ACCORDION_BASE6_MERGE_BASELINE label on + Accordion codeline +01e,15may03,spm Tornado 2.2 FCS merge (SPR #72213; from tcp_var.h + ver 01g,05jun02,vvv: TOR2_2-FCS-COPY label, tor2 branch, + /wind/river VOB) +01d,09sep02,hsh add c++ protection +01c,12jul02,hsh fix head file for ppc +01b,21sep01,hsh uncomment pru_sense_null function point + 01a,18sep01,ham made pf* routines extern. diabled pru_sense_null. +*/ + +#ifndef _SYS_PROTOSW_H_ +#define _SYS_PROTOSW_H_ + + +#ifdef __cplusplus + extern "C" { +#endif + +/* Forward declare these structures referenced from prototypes below. */ +struct mbuf; +struct proc; +struct sockaddr; +struct socket; +struct sockopt; + +#ifdef _WRS_KERNEL +/* + * Protocol switch table. + * + * Each protocol has a handle initializing one of these structures, + * which is used for protocol-protocol and system-protocol communication. + * + * A protocol is called through the pr_init entry before any other. + * Thereafter it is called every 200ms through the pr_fasttimo entry and + * every 500ms through the pr_slowtimo for timer based actions. + * The system will call the pr_drain entry if it is low on space and + * this should throw away any non-critical data. + * + * Protocols pass data between themselves as chains of mbufs using + * the pr_input and pr_output hooks. Pr_input passes data up (towards + * the users) and pr_output passes it down (towards the interfaces); control + * information passes up and down on pr_ctlinput and pr_ctloutput. + * The protocol is responsible for the space occupied by any the + * arguments to these entries and must dispose it. + * + * In retrospect, it would be a lot nicer to use an interface + * similar to the vnode VOP interface. + */ +struct protosw { + short pr_type; /* socket type used for */ + struct domain *pr_domain; /* domain protocol a member of */ + short pr_protocol; /* protocol number */ + short pr_flags; /* see below */ +/* protocol-protocol hooks */ + void (*pr_input) __P((struct mbuf *, int len)); + /* input to protocol (from below) */ + int (*pr_output) __P((struct mbuf *m, struct socket *so)); + /* output to protocol (from above) */ + void (*pr_ctlinput)__P((int, struct sockaddr *, void *)); + /* control input (from below) */ + int (*pr_ctloutput)__P((struct socket *, struct sockopt *)); + /* control output (from above) */ +/* user-protocol hook */ + void *pr_ousrreq; +/* utility hooks */ + void (*pr_init) __P((void)); /* initialization hook */ + void (*pr_fasttimo) __P((void)); + /* fast timeout (200ms) */ + void (*pr_slowtimo) __P((void)); + /* slow timeout (500ms) */ + void (*pr_drain) __P((void)); + /* flush any excess space possible */ + struct pr_usrreqs *pr_usrreqs; /* supersedes pr_usrreq() */ +}; +#endif /* _WRS_KERNEL */ + +#define PR_SLOWHZ 2 /* 2 slow timeouts per second */ +#define PR_FASTHZ 5 /* 5 fast timeouts per second */ + +/* + * Values for pr_flags. + * PR_ADDR requires PR_ATOMIC; + * PR_ADDR and PR_CONNREQUIRED are mutually exclusive. + * PR_IMPLOPCL means that the protocol allows sendto without prior connect, + * and the protocol understands the MSG_EOF flag. The first property is + * is only relevant if PR_CONNREQUIRED is set (otherwise sendto is allowed + * anyhow). + * PR_ADDR_OPT requires PR_ATOMIC (like PR_ADDR) + */ +#define PR_ATOMIC 0x01 /* exchange atomic messages only */ +#define PR_ADDR 0x02 /* addresses given with messages */ +#define PR_CONNREQUIRED 0x04 /* connection required by protocol */ +#define PR_WANTRCVD 0x08 /* want PRU_RCVD calls */ +#define PR_RIGHTS 0x10 /* passes capabilities */ +#define PR_IMPLOPCL 0x20 /* implied open/close */ +#define PR_LASTHDR 0x40 /* enforce ipsec policy; last header */ +#define PR_ADDR_OPT 0x80 /* allow addresses during delivery */ + +/* + * The arguments to usrreq are: + * (*protosw[].pr_usrreq)(up, req, m, nam, opt); + * where up is a (struct socket *), req is one of these requests, + * m is a optional mbuf chain containing a message, + * nam is an optional mbuf chain containing an address, + * and opt is a pointer to a socketopt structure or nil. + * The protocol is responsible for disposal of the mbuf chain m, + * the caller is responsible for any space held by nam and opt. + * A non-zero return from usrreq gives an + * UNIX error number which should be passed to higher level software. + */ +#define PRU_ATTACH 0 /* attach protocol to up */ +#define PRU_DETACH 1 /* detach protocol from up */ +#define PRU_BIND 2 /* bind socket to address */ +#define PRU_LISTEN 3 /* listen for connection */ +#define PRU_CONNECT 4 /* establish connection to peer */ +#define PRU_ACCEPT 5 /* accept connection from peer */ +#define PRU_DISCONNECT 6 /* disconnect from peer */ +#define PRU_SHUTDOWN 7 /* won't send any more data */ +#define PRU_RCVD 8 /* have taken data; more room now */ +#define PRU_SEND 9 /* send this data */ +#define PRU_ABORT 10 /* abort (fast DISCONNECT, DETATCH) */ +#define PRU_CONTROL 11 /* control operations on protocol */ +#define PRU_SENSE 12 /* return status into m */ +#define PRU_RCVOOB 13 /* retrieve out of band data */ +#define PRU_SENDOOB 14 /* send out of band data */ +#define PRU_SOCKADDR 15 /* fetch socket's address */ +#define PRU_PEERADDR 16 /* fetch peer's address */ +#define PRU_CONNECT2 17 /* connect two sockets */ +/* begin for protocols internal use */ +#define PRU_FASTTIMO 18 /* 200ms timeout */ +#define PRU_SLOWTIMO 19 /* 500ms timeout */ +#define PRU_PROTORCV 20 /* receive from below */ +#define PRU_PROTOSEND 21 /* send to below */ +/* end for protocol's internal use */ +#define PRU_SEND_EOF 22 /* send and close */ +#define PRU_NREQ 22 + +#ifdef PRUREQUESTS +char *prurequests[] = { + "ATTACH", "DETACH", "BIND", "LISTEN", + "CONNECT", "ACCEPT", "DISCONNECT", "SHUTDOWN", + "RCVD", "SEND", "ABORT", "CONTROL", + "SENSE", "RCVOOB", "SENDOOB", "SOCKADDR", + "PEERADDR", "CONNECT2", "FASTTIMO", "SLOWTIMO", + "PROTORCV", "PROTOSEND", + "SEND_EOF", +}; +#endif + +#ifdef _WRS_KERNEL /* users shouldn't see this decl */ + +struct ifnet; +struct stat; +struct ucred; +struct uio; + +/* + * If the ordering here looks odd, that's because it's alphabetical. + * Having this structure separated out from the main protoswitch is allegedly + * a big (12 cycles per call) lose on high-end CPUs. We will eventually + * migrate this stuff back into the main structure. + */ +struct pr_usrreqs { + int (*pru_abort) __P((struct socket *so)); + int (*pru_accept) __P((struct socket *so, struct sockaddr **nam)); + int (*pru_attach) __P((struct socket *so, int proto, + struct proc *p)); + int (*pru_bind) __P((struct socket *so, struct sockaddr *nam, + struct proc *p)); + int (*pru_connect) __P((struct socket *so, struct sockaddr *nam, + struct proc *p)); + int (*pru_connect2) __P((struct socket *so1, struct socket *so2)); + int (*pru_control) __P((struct socket *so, u_long cmd, caddr_t data, + struct ifnet *ifp, struct proc *p)); + int (*pru_detach) __P((struct socket *so)); + int (*pru_disconnect) __P((struct socket *so)); + int (*pru_listen) __P((struct socket *so, struct proc *p)); + int (*pru_peeraddr) __P((struct socket *so, + struct sockaddr **nam)); + int (*pru_rcvd) __P((struct socket *so, int flags)); + int (*pru_rcvoob) __P((struct socket *so, struct mbuf *m, + int flags)); + int (*pru_send) __P((struct socket *so, int flags, struct mbuf *m, + struct sockaddr *addr, struct mbuf *control, + struct proc *p)); +#define PRUS_OOB 0x01 +#define PRUS_EOF 0x02 +#define PRUS_MORETOCOME 0x04 +#define PRUS_EOB 0x08 +#define PRUS_EXP 0x10 + + int (*pru_sense) __P((struct socket *so, struct stat *sb)); + int (*pru_shutdown) __P((struct socket *so)); + int (*pru_sockaddr) __P((struct socket *so, + struct sockaddr **nam)); + + /* + * These three added later, so they are out of order. They are used + * for shortcutting (fast path input/output) in some protocols. + * XXX - that's a lie, they are not implemented yet + * Rather than calling sosend() etc. directly, calls are made + * through these entry points. For protocols which still use + * the generic code, these just point to those routines. + */ + int (*pru_sosend) __P((struct socket *so, struct sockaddr *addr, + struct uio *uio, struct mbuf *top, + struct mbuf *control, int flags, + struct proc *p)); + int (*pru_soreceive) __P((struct socket *so, + struct sockaddr **paddr, + struct uio *uio, struct mbuf **mp0, + struct mbuf **controlp, int *flagsp)); + int (*pru_sopoll) __P((struct socket *so, int events, + struct ucred *cred, struct proc *p)); +}; + +int pru_accept_notsupp __P((struct socket *so, struct sockaddr **nam)); +int pru_connect_notsupp __P((struct socket *so, struct sockaddr *nam, + struct proc *p)); +int pru_connect2_notsupp __P((struct socket *so1, struct socket *so2)); +int pru_control_notsupp __P((struct socket *so, u_long cmd, caddr_t data, + struct ifnet *ifp, struct proc *p)); +int pru_listen_notsupp __P((struct socket *so, struct proc *p)); +int pru_rcvd_notsupp __P((struct socket *so, int flags)); +int pru_rcvoob_notsupp __P((struct socket *so, struct mbuf *m, int flags)); +int pru_sense_null __P((struct socket *so, struct stat *sb)); +#endif /* _WRS_KERNEL */ + +/* + * The arguments to the ctlinput routine are + * (*protosw[].pr_ctlinput)(cmd, sa, arg); + * where cmd is one of the commands below, sa is a pointer to a sockaddr, + * and arg is a `void *' argument used within a protocol family. + */ +#define PRC_IFDOWN 0 /* interface transition */ +#define PRC_ROUTEDEAD 1 /* select new route if possible ??? */ +#define PRC_IFUP 2 /* interface has come back up */ +#define PRC_QUENCH2 3 /* DEC congestion bit says slow down */ +#define PRC_QUENCH 4 /* some one said to slow down */ +#define PRC_MSGSIZE 5 /* message size forced drop */ +#define PRC_HOSTDEAD 6 /* host appears to be down */ +#define PRC_HOSTUNREACH 7 /* deprecated (use PRC_UNREACH_HOST) */ +#define PRC_UNREACH_NET 8 /* no route to network */ +#define PRC_UNREACH_HOST 9 /* no route to host */ +#define PRC_UNREACH_PROTOCOL 10 /* dst says bad protocol */ +#define PRC_UNREACH_PORT 11 /* bad port # */ +/* was PRC_UNREACH_NEEDFRAG 12 (use PRC_MSGSIZE) */ +#define PRC_UNREACH_SRCFAIL 13 /* source route failed */ +#define PRC_REDIRECT_NET 14 /* net routing redirect */ +#define PRC_REDIRECT_HOST 15 /* host routing redirect */ +#define PRC_REDIRECT_TOSNET 16 /* redirect for type of service & net */ +#define PRC_REDIRECT_TOSHOST 17 /* redirect for tos & host */ +#define PRC_TIMXCEED_INTRANS 18 /* packet lifetime expired in transit */ +#define PRC_TIMXCEED_REASS 19 /* lifetime expired on reass q */ +#define PRC_PARAMPROB 20 /* header incorrect */ +#define PRC_UNREACH_ADMIN_PROHIB 21 /* packet administrativly prohibited */ + +#define PRC_NCMDS 22 + +#define PRC_IS_REDIRECT(cmd) \ + ((cmd) >= PRC_REDIRECT_NET && (cmd) <= PRC_REDIRECT_TOSHOST) + +#ifdef PRCREQUESTS +char *prcrequests[] = { + "IFDOWN", "ROUTEDEAD", "IFUP", "DEC-BIT-QUENCH2", + "QUENCH", "MSGSIZE", "HOSTDEAD", "#7", + "NET-UNREACH", "HOST-UNREACH", "PROTO-UNREACH", "PORT-UNREACH", + "#12", "SRCFAIL-UNREACH", "NET-REDIRECT", "HOST-REDIRECT", + "TOSNET-REDIRECT", "TOSHOST-REDIRECT", "TX-INTRANS", "TX-REASS", + "PARAMPROB", "ADMIN-UNREACH" +}; +#endif + +/* + * The arguments to ctloutput are: + * (*protosw[].pr_ctloutput)(req, so, level, optname, optval, p); + * req is one of the actions listed below, so is a (struct socket *), + * level is an indication of which protocol layer the option is intended. + * optname is a protocol dependent socket option request, + * optval is a pointer to a mbuf-chain pointer, for value-return results. + * The protocol is responsible for disposal of the mbuf chain *optval + * if supplied, + * the caller is responsible for any space held by *optval, when returned. + * A non-zero return from usrreq gives an + * UNIX error number which should be passed to higher level software. + */ +#define PRCO_GETOPT 0 +#define PRCO_SETOPT 1 + +#define PRCO_NCMDS 2 + +#ifdef PRCOREQUESTS +char *prcorequests[] = { + "GETOPT", "SETOPT", +}; +#endif + +#ifdef _WRS_KERNEL +extern void pfctlinput __P((int, struct sockaddr *)); +extern void pfctlinput2 __P((int, struct sockaddr *, void *)); +extern struct protosw *pffindproto __P((int family, int protocol, int type)); +extern struct protosw *pffindtype __P((int family, int type)); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/net/radix.h b/h/wrn/coreip/net/radix.h new file mode 100644 index 0000000..416b185 --- /dev/null +++ b/h/wrn/coreip/net/radix.h @@ -0,0 +1,213 @@ +/* radix.h - radix tree implementation for routing table */ + +/* Copyright 2001-2004 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1988, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)radix.h 8.2 (Berkeley) 10/31/94 + * $FreeBSD: src/sys/net/radix.h,v 1.16.2.1 2000/05/03 19:17:11 wollman Exp $ + */ + +/* +modification history +-------------------- +01l,07apr05,spm fixed memory leak from netmask storage (SPR #97721) +01k,02jul04,vvv fixed warning +01j,20nov03,niq Remove copyright_wrs.h file inclusion +01i,05nov03,cdw Removal of unnecessary _KERNEL guards. +01h,04nov03,rlm Ran batch header path update for header re-org. +01g,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01f,06aug03,niq Merge from Accordion into Base6 Iteration 1 branch +01e,10jun03,vvv include netVersion.h +01h,04mar03,niq Move rn_refines from radix.c to route.c to eliminate + dependency +01g,02dec02,spm merged from WINDNET_IPV6-1_0-FCS label (ver 01d,11oct02,ham) +01f,17oct02,spm replaced private globals to permit multiple tree instances +01e,09oct02,spm changed for Patricia tree RIB implementation: + updated node type and added fields for cleanup routine +01d,31jul02,spm merged from WINDNET_IPV6-2_0-BETA label +01c,29may02,spm updated from Router Stack 1.0: alternate multipath, skip + routes with disabled interface +01b,01feb02,nee changing prototype for rn_delete +01a,08sep01,qli 1st round of porting +*/ + +#ifndef _RADIX_H_ +#define _RADIX_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +struct ptRibHead; + +/* + * Radix search tree node layout. + */ + +struct radix_node { + struct radix_mask *rn_mklist; /* list of masks contained in subtree */ + struct radix_node *rn_parent; /* parent */ + short rn_bit; /* bit offset; -1-index(netmask) */ + char rn_bmask; /* node: mask for bit test*/ + u_char rn_flags; /* enumerated next */ +#define RNF_NORMAL 1 /* leaf contains normal route */ +#define RNF_ROOT 2 /* leaf is root leaf for tree */ +#define RNF_ACTIVE 4 /* This node is alive (for rtfree) */ +#define RNF_NONOP 16 /* This node is through an interface which is non-operational eg. down*/ + union { + struct { /* leaf only data: */ + caddr_t rn_Key; /* object of search */ + caddr_t rn_Mask; /* netmask, if present */ + struct radix_node *rn_Dupedkey; + } rn_leaf; + struct { /* node only data: */ + int rn_Off; /* where to start compare */ + struct radix_node *rn_L;/* progeny */ + struct radix_node *rn_R;/* progeny */ + } rn_node; + } rn_u; +#ifdef RN_DEBUG + int rn_info; + struct radix_node *rn_twin; + struct radix_node *rn_ybro; +#endif +}; + +#define rn_dupedkey rn_u.rn_leaf.rn_Dupedkey +#define rn_key rn_u.rn_leaf.rn_Key +#define rn_mask rn_u.rn_leaf.rn_Mask +#define rn_offset rn_u.rn_node.rn_Off +#define rn_left rn_u.rn_node.rn_L +#define rn_right rn_u.rn_node.rn_R + +/* + * Annotations to tree concerning potential routes applying to subtrees. + */ + +struct radix_mask { + short rm_bit; /* bit offset; -1-index(netmask) */ + char rm_unused; /* cf. rn_bmask */ + u_char rm_flags; /* cf. rn_flags */ + struct radix_mask *rm_mklist; /* more masks to try */ + union { + caddr_t rmu_mask; /* the mask */ + struct ptRouteNode *rmu_leaf; /* for normal routes */ + } rm_rmu; + int rm_refs; /* # of references to this struct */ +}; + +#define rm_mask rm_rmu.rmu_mask +#define rm_leaf rm_rmu.rmu_leaf /* extra field would make 32 bytes */ + +typedef int walktree_f_t __P((struct radix_node *, void *)); + +#ifdef v /* XXX workaround for SPR 81215 */ +#undef v +#endif + +struct radix_node_head { + struct radix_node *rnh_treetop; + int rnh_addrsize; /* permit, but not require fixed keys */ + int rnh_pktsize; /* permit, but not require fixed keys */ + struct radix_node *(*rnh_addaddr) /* add based on sockaddr */ + __P((void *v, void *mask, + struct radix_node_head *head, struct radix_node nodes[])); + struct radix_node *(*rnh_addpkt) /* add based on packet hdr */ + __P((void *v, void *mask, + struct radix_node_head *head, struct radix_node nodes[])); + struct radix_node *(*rnh_deladdr) /* remove based on sockaddr */ + __P((void *v, void *mask, struct radix_node_head *head,struct radix_node *)); + struct radix_node *(*rnh_delpkt) /* remove based on packet hdr */ + __P((void *v, void *mask, struct radix_node_head *head)); + struct radix_node *(*rnh_matchaddr) /* locate based on sockaddr */ + __P((void *v, struct radix_node_head *head)); + struct radix_node *(*rnh_lookup) /* locate based on sockaddr */ + __P((void *v, void *mask, struct radix_node_head *head)); + struct radix_node *(*rnh_matchpkt) /* locate based on packet hdr */ + __P((void *v, struct radix_node_head *head)); + int (*rnh_walktree) /* traverse tree */ + __P((struct radix_node_head *head, walktree_f_t *f, void *w)); + int (*rnh_walktree_from) /* traverse tree below a */ + __P((struct radix_node_head *head, void *a, void *m, + walktree_f_t *f, void *w)); + void (*rnh_close) /* do something when the last ref drops */ + __P((struct radix_node *rn, struct radix_node_head *head)); + struct radix_node rnh_nodes[3]; /* empty tree for common case */ + struct radix_node_head * pMaskHead; /* storage for public masks */ + struct radix_mask * pMaskList; /* storage for private masks */ + int trimSize; /* length of last netmask, without trailing zeroes */ + int max_keylen; /* size of address for protocol family */ +}; + +/* +Argument for rn_match for receiving implicit flags in "flags" and the dst sockaddr in "dst" +Replaces the use of the precious v_arg as the dst sockaddr only."flags" can be used to select +a function pointer that applies to a corresponding flag. +*/ +#ifdef RADIX_MPATH +typedef struct radix_node * (*radixFuncType)(struct radix_node *); +#endif + +struct radix_arg { + caddr_t dst; + u_char flags; +#ifdef RADIX_MPATH + radixFuncType radixFuncList[16]; +#endif +}; + +#ifdef VIRTUAL_STACK +STATUS radixInit __P((void)); +#endif +void rn_init __P((struct ptRibHead *)); + +int rn_inithead __P((void **, int, char *, char *)); +IMPORT int rn_refines __P((void *, void *)); +struct radix_node + *rn_addmask __P((struct radix_node_head *, void *, int, int, + int *, int)), + *rn_addroute __P((void *, void *, struct radix_node_head *, + struct radix_node [2])), + *rn_delete __P((void *, void *, struct radix_node_head *,struct radix_node *)), + *rn_lookup __P((void *v_arg, void *m_arg, + struct radix_node_head *head)), + *rn_match __P((void *, struct radix_node_head *)); + +#ifdef __cplusplus +} +#endif + +#endif /* _RADIX_H_ */ diff --git a/h/wrn/coreip/net/raw_cb.h b/h/wrn/coreip/net/raw_cb.h new file mode 100644 index 0000000..971b9cb --- /dev/null +++ b/h/wrn/coreip/net/raw_cb.h @@ -0,0 +1,113 @@ +/* raw_cb.h - raw control block structures */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1980, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)raw_cb.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/net/raw_cb.h,v 1.12 1999/12/29 04:38:37 peter Exp $ + */ + +/* +modification history +-------------------- +01j,16feb05,vvv changes for user-space builds +01i,07feb05,vvv _KERNEL cleanup +01h,20nov03,niq Remove copyright_wrs.h file inclusion +01g,04nov03,rlm Ran batch header path update for header re-org. +01f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01e,24oct03,cdw update include statements post header re-org. +01d,11aug03,nee Merging from label ACCORDION_BASE6_MERGE_BASELINE in + accordion codeline to Base6 +01c,10sep02,hsh add c++ protection +01b,28mar02,ppp made it backward compatible with A.E. 1.1 +01a,13sep01,nee Porting, first check in +*/ + + +#ifndef _NET_RAW_CB_H_ +#define _NET_RAW_CB_H_ + +#ifdef _WRS_KERNEL +#include +#include +#include +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +/* + * Nominal space allocated to a raw socket. + */ +#define RAWSNDQ 8192 +#define RAWRCVQ 8192 + +#ifdef _WRS_KERNEL +/* + * Raw protocol interface control block. Used + * to tie a socket to the generic raw interface. + */ +struct rawcb { + LIST_ENTRY(rawcb) list; + struct socket *rcb_socket; /* back pointer to socket */ + struct sockaddr *rcb_faddr; /* destination address */ + struct sockaddr *rcb_laddr; /* socket's address */ + struct sockproto rcb_proto; /* protocol family, protocol */ +}; + +#define sotorawcb(so) ((struct rawcb *)(so)->so_pcb) + +#ifndef VIRTUAL_STACK +extern LIST_HEAD(rawcb_list_head, rawcb) rawcb_list; +#else +LIST_HEAD(rawcb_list_head, rawcb); +#endif + +int raw_attach __P((struct socket *, int)); +void raw_ctlinput __P((int, struct sockaddr *, void *)); +void raw_detach __P((struct rawcb *)); +void raw_disconnect __P((struct rawcb *)); +void raw_init __P((void)); +void raw_input __P((struct mbuf *, + struct sockproto *, struct sockaddr *, struct sockaddr *)); + +extern struct pr_usrreqs raw_usrreqs; +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/net/route.h b/h/wrn/coreip/net/route.h new file mode 100644 index 0000000..1411c56 --- /dev/null +++ b/h/wrn/coreip/net/route.h @@ -0,0 +1,566 @@ +/* route.h - routing table */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1980, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)route.h 8.4 (Berkeley) 1/9/95 + * $FreeBSD: src/sys/net/route.h,v 1.36.2.5 2002/02/01 11:48:01 ru Exp $ + */ + +/* +modification history +-------------------- +01z,19may05,rp added RTM_ADDRINFO +01y,01mar05,niq Include in6.h +01x,24feb05,spm removed unneeded route format storage (SPR #100995) +01w,24feb05,spm performance updates and code cleanup (SPR #100995) +01v,08feb05,vvv _KERNEL cleanup +01u,17sep04,niq Scale out routing sockets +01t,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01s,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/2) +01r,06dec03,niq Add the RTF_PRIMARY flag +01q,24nov03,vvv updated for RTP support +01p,20nov03,niq Remove copyright_wrs.h file inclusion +01o,10nov03,cdw Rebase from base6 iteration 1 view +01n,04nov03,rlm Ran batch header path update for header re-org. +01m,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01l,27sep03,vvv moved RTFREE out of #ifdef _KERNEL +01k,23sep03,asr Moved the #include outside of #ifdef _KERNEL +01j,06aug03,niq Merge from Accordion into Base6 Iteration 1 branch +01i,10jun03,vvv include netVersion.h +01h,01feb03,pas merge from FreeBSD 4.7 - added rt_getifa(), + rt_ifannouncemsg(), rtrequest1() +01g,05sep02,hsh add cplusplus protection +01f,16may02,ant field rmx_filler[4] in the struct rt_metrics expand to + rmx_filler[5]. New definitions rt_mod and RTF_MGMT +01e,11mar02,ham reverted previous checkin 01d +01d,27feb02,nee extending the rt_metrics for rip +01c,02feb02,ham changed for tornado build. +01b,19dec01,nee Adding multipath capability +01a,08sep01,qli 1st round of porting +*/ + + +#ifndef _NET_ROUTE_H_ +#define _NET_ROUTE_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * Kernel resident routing tables. + * + * The routing tables are initialized when interface addresses + * are set by making entries for all directly connected interfaces. + */ + +/* + * We distinguish between routes to hosts and routes to networks, + * preferring the former if available. For each route we infer + * the interface to use from the gateway address supplied when + * the route was entered. Routes that forward packets through + * gateways are marked so that the output routines know to address the + * gateway rather than the ultimate destination. + */ + +/* + * Following structure necessary for 4.3 compatibility; + * We should eventually move it to a compat file. + */ +struct ortentry { + u_long ort_hash; /* to speed lookups */ + struct sockaddr ort_dst; /* key */ + struct sockaddr ort_gateway; /* value */ + short ort_flags; /* up/down?, host/net */ + short ort_refcnt; /* # held references */ + u_long ort_use; /* raw # packets forwarded */ + struct ifnet *ort_ifp; /* the answer: interface to use */ +}; + +/* + * These numbers are used by reliable protocols for determining + * retransmission behavior and are included in the routing structure. + */ +struct rt_metrics { + u_long rmx_locks; /* Kernel must leave these values alone */ + u_long rmx_mtu; /* MTU for this path */ + u_long rmx_hopcount; /* max hops expected */ + u_long rmx_expire; /* lifetime for route, e.g. redirect */ + u_long rmx_recvpipe; /* inbound delay-bandwidth product */ + u_long rmx_sendpipe; /* outbound delay-bandwidth product */ + u_long rmx_ssthresh; /* outbound gateway buffer limit */ + u_long rmx_rtt; /* estimated round trip time */ + u_long rmx_rttvar; /* estimated rtt variance */ + u_long rmx_pksent; /* packets sent using this route */ + u_long rmx_filler[5]; /* will be used for T/TCP later */ + /* the last field is used for storing + of the last modification of the route */ + + /* Additional WRN metrics for routing protocols */ + + long value1; + long value2; + long value3; + long value4; + long value5; + long routeTag; + u_long weight; +}; + +/* RTM entry header - pointed to by RIB node */ +struct routeHdr + { + struct sockaddr * pDstAddr; /* Route destination */ + struct sockaddr * pNetmask; /* Route netmask */ + struct rtentry * pFirstRoute; /* Initial route entry (weight) */ + struct rtentry * pFirstLexRoute; /* Initial route entry (SNMP) */ + unsigned short routeHdrFlags; /* Route header flags */ + UCHAR routeCount; /* Number of shared route entries */ + }; + +/* + * Generic route entry to store route information. + * The fields are layed out based on the cache locality consideration. + * Please do not move them around merely for aesthetic purposes. + */ + +struct mbuf; + +struct rtentry + { + struct routeHdr * pRtmHdr; /* RTM header */ + struct sockaddr * rt_gateway; /* Next-hop gateway */ + struct rtentry * rt_gwroute; /* Pointer to gateway entry */ + struct ifnet * rt_ifp; /* Which interface to use */ + ULONG rt_flags; /* Route flags: Uses RTF_ values: */ + long rt_refcnt; /* # of held references */ + caddr_t rt_llinfo; /* pointer to link level info cache */ + struct ifaddr * rt_ifa; /* Interface address */ + struct rtentry * rt_parent; /* cloning parent of this route */ + ULONG routeTos; /* Type-of-service information */ + struct rt_metrics rt_rmx; /* Route metrics */ + struct sockaddr * rt_genmask; /* For generation of cloned routes */ + int (*rt_output) (struct ifnet *, struct mbuf *, struct sockaddr *, + struct rtentry *); + /* output routine for this (rt,if) */ + void * rt_filler2; /* more filler */ + struct rtentry * pNextRoute; /* Additional route entry (weight) */ + struct rtentry * pNextLexRoute; /* Additional route entry (SNMP) */ + void * pRibNode; /* Pointer to RIB node */ + ULONG routeOwner; /* Route ownership information */ + ULONG rtmFlags; /* Proxy ARP entry or not. See below */ + /* for the values */ + }; +#define rt_use rt_rmx.rmx_pksent +#define rt_mod rt_rmx.rmx_filler[4] + +/* + * The following macros SHOULD be used to access the fields of the rtentry + * structures. Directly accessing fields might not be portable + */ + +#define rt_key(r) ((r)->pRtmHdr->pDstAddr) +#define rt_mask(r) ((r)->pRtmHdr->pNetmask) + +/* + * This constant defines the weight for every interface route installed by + * the system. This value should be the lowest possible weight so that the + * system interface route is always preferred over any other interface routes + * which a routing protocol may create. This priority is necessary since + * the system's interface route generates all ARP/ND entries through cloning, + * so it must be the first entry in the weighted list if duplicates exist. + * Without this value, the system route is often still the first entry in the + * list since the RIP interface routes (and any others) are added with the + * the default weight value. However, if any routing protocols install routes + * with a weight lower than the default, then the system's interface route + * would no longer be first, so it is assigned the lowest possible weight. + */ + +#define INTERFACE_ROUTE_WEIGHT 1 + +/* + * macros for getting and setting tos values in sockaddr_in + * structures. A new sockaddr structure is defined for this + * purpose as shown below. + */ +struct sockaddr_rt { + u_char srt_len; + u_char srt_family; + u_char srt_proto; + u_char srt_tos; + ULONG srt_addr; + char sin_zero[8]; + }; + +#define TOS_GET(pSockaddr) (((struct sockaddr_rt *)(pSockaddr))->srt_tos) + +#define TOS_SET(pSockaddr, tosVal) \ + (((struct sockaddr_rt *)(pSockaddr))->srt_tos = tosVal) + +#define RT_PROTO_GET(pSockaddr) (((struct sockaddr_rt *)(pSockaddr))->srt_proto) + +#define RT_PROTO_SET(pSockaddr, proto) \ + (((struct sockaddr_rt *)(pSockaddr))->srt_proto = proto) + +/* + * Set the route tos and proto from the route in the provided dst address + * Saves the original Tos and Proto value if pointers are provided + */ +#define SET_TOS_AND_PROTO(dst, rt) \ + do { \ + TOS_SET (dst, ROUTE_TOS (rt)); \ + RT_PROTO_SET (dst, ROUTE_PROTO (rt)); \ + } while (0) + +/* + * Reset the original route tos and proto values in the route's dst address + */ +#define RESET_TOS_AND_PROTO(dst) \ + do { \ + TOS_SET (dst, 0); \ + RT_PROTO_SET (dst, 0); \ + } while (0) + +/* + * A route consists of a destination address and a reference + * to a routing entry. These are often held by protocols + * in their control blocks, e.g. inpcb. + */ +struct route { + struct rtentry *ro_rt; + struct sockaddr ro_dst; +}; + + +#ifdef ROUTER_STACK +/* + * This expanded "gateway" structure contains the address of the next-hop + * router and all the new metrics for a route, as well as the protocol + * identifier which created it. The RTM_GETALL routing socket message + * contains a list of these structures. + * + * NOTE: don't change the position of the gate_addr field. It is designed to + * overlay the sockaddr_in(6) structures. + */ + +struct sockaddr_gate + { + u_char gate_len; + u_char gate_family; + u_char routeProto; + u_char weight; + u_long gate_addr; + long value1; + long value2; + long value3; + long value4; + long value5; + long routeTag; + long routeTos; + struct sockaddr * ifa; + struct sockaddr * ifp; + }; + +#ifdef INET6 +#include +#include /* For in6_addr */ + +struct sockaddr_gate6 + { + u_char gate_len; + u_char gate_family; + u_char routeProto; + u_char weight; + long value1; + struct in6_addr gate6_addr; + long value2; + long value3; + long value4; + long value5; + long routeTag; + long routeTos; + struct sockaddr * ifa; + struct sockaddr * ifp; + }; +#endif /* INET6 */ +#endif /* ROUTER_STACK */ + + + +/* + * rmx_rtt and rmx_rttvar are stored as microseconds; + * RTTTOPRHZ(rtt) converts to a value suitable for use + * by a protocol slowtimo counter. + */ +#define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */ +#define RTTTOPRHZ(r) ((r) / (RTM_RTTUNIT / PR_SLOWHZ)) + +/* + * XXX kernel function pointer `rt_output' is visible to applications. + */ + +/* Values for rt_flags */ +#define RTF_UP 0x1 /* route usable */ +#define RTF_GATEWAY 0x2 /* destination is a gateway */ +#define RTF_HOST 0x4 /* host entry (net otherwise) */ +#define RTF_REJECT 0x8 /* host or net unreachable */ + +#define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */ +#define RTF_MODIFIED 0x20 /* modified dynamically (by redirect)*/ +#define RTF_DONE 0x40 /* message confirmed */ +#define RTF_NO_MSGS RTF_DONE /* tells the RTM to not generate + * routing messages + */ +#define RTF_DELCLONE 0x80 /* delete cloned route */ +#define RTF_INTF_ROUTE RTF_DELCLONE /* Used to indicate to rtrequest that + * this is an interface route. */ + +#define RTF_CLONING 0x100 /* generate new routes on use */ +#define RTF_XRESOLVE 0x200 /* external daemon resolves name */ +#define RTF_LLINFO 0x400 /* generated by link layer (e.g. ARP)*/ +#define RTF_STATIC 0x800 /* manually added */ + +#define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates)*/ +#define RTF_MGMT 0x2000 /* modified by management proto */ +#define RTF_PROTO2 0x4000 /* protocol specific routing flag */ +#define RTF_PROTO1 0x8000 /* protocol specific routing flag */ + +#define RTF_PRCLONING 0x10000 /* protocol requires cloning */ +#define RTF_WASCLONED 0x20000 /* route generated through cloning */ +#define RTF_PROTO3 0x40000 /* protocol specific routing flag */ +#define RTPRF_OURS RTF_PROTO3 /* set on routes we manage */ +/* 0x80000 unused */ + +#define RTF_PINNED 0x100000 /* future use */ +#define RTF_LOCAL 0x200000 /* route represents a local address */ +#define RTF_BROADCAST 0x400000 /* route represents a bcast address */ +#define RTF_MULTICAST 0x800000 /* route represents a mcast address */ + /* 0x1000000 and up unassigned */ +#define RTF_LLNOTAVAIL 0x1000000 /* Link layer not available for eg. */ + /* if the interface is down */ +#define RTF_PRIMARY 0x2000000 /* Primary route -used for forwarding*/ + + +/* + * Routing statistics. + */ +struct rtstat { + short rts_badredirect; /* bogus redirect calls */ + short rts_dynamic; /* routes created by redirects */ + short rts_newgateway; /* routes modified by redirects */ + short rts_unreach; /* lookups which failed */ + short rts_wildcard; /* lookups satisfied by a wildcard */ +}; +/* + * Structures for routing messages. + */ +struct rt_msghdr { + u_short rtm_msglen; /* to skip over non-understood messages */ + u_char rtm_version; /* future binary compatibility */ + u_char rtm_type; /* message type */ + u_short rtm_index; /* index for associated ifp */ + int rtm_flags; /* flags, incl. kern & message, e.g. DONE */ + int rtm_addrs; /* bitmask identifying sockaddrs in msg */ + pid_t rtm_pid; /* identify sender */ + int rtm_seq; /* for sender to identify action */ + int rtm_errno; /* why failed */ + int rtm_use; /* from rtentry */ + u_long rtm_inits; /* which metrics we are initializing */ + struct rt_metrics rtm_rmx; /* metrics themselves */ +}; + +#define RTM_VERSION 5 /* Up the ante and ignore older versions */ + +/* + * Message types. The message numbers should be continous as their + * values are used as array indices + */ +#define RTM_ADD 0x1 /* Add Route */ +#define RTM_DELETE 0x2 /* Delete Route */ +#define RTM_CHANGE 0x3 /* Change Metrics or flags */ +#define RTM_GET 0x4 /* Report Metrics */ +#define RTM_LOSING 0x5 /* Kernel Suspects Partitioning */ +#define RTM_REDIRECT 0x6 /* Told to use different route */ +#define RTM_MISS 0x7 /* Lookup failed on this address */ +#define RTM_LOCK 0x8 /* fix specified metrics */ +#define RTM_OLDADD 0x9 /* caused by SIOCADDRT */ +#define RTM_OLDDEL 0xa /* caused by SIOCDELRT */ +#define RTM_RESOLVE 0xb /* req to resolve dst to LL addr */ +#define RTM_NEWADDR 0xc /* address being added to iface */ +#define RTM_DELADDR 0xd /* address being removed from iface */ +#define RTM_IFINFO 0xe /* iface going up/down etc. */ +#define RTM_NEWMADDR 0xf /* mcast group membership being added to if */ +#define RTM_DELMADDR 0x10 /* mcast group membership being deleted */ +#define RTM_IFANNOUNCE 0x11 /* iface arrival/departure */ + +#ifdef ROUTER_STACK + +/* New WRN messages */ + +#define RTM_NEWCHANGE 0x12 /* Change gateway of duplicate route */ +#define RTM_NEWGET 0x13 /* Find any route with gateway */ +#define RTM_GETALL 0x14 /* Get IP route to dst and any duplicates */ +#endif /* ROUTER_STACK */ + +#define RTM_NEWIPROUTE 0x15 /* Replacement for deleted primary IP route */ +#define RTM_OLDIPROUTE 0x16 /* Demoted IP route replaced with new entry */ + +#ifdef ROUTER_STACK +/* Backward compatibility messages. Will go away in the next release */ + +#define RTM_ADDEXTRA 0x17 /* Duplicate route added */ +#define RTM_DELEXTRA 0x18 /* Duplicate route deleted */ +#endif /* ROUTER_STACK */ + +#define RTM_ADDRINFO 0x19 /* change address flags */ +/* + * Bitmask values for rtm_inits and rmx_locks. + */ +#define RTV_MTU 0x1 /* init or lock _mtu */ +#define RTV_HOPCOUNT 0x2 /* init or lock _hopcount */ +#define RTV_EXPIRE 0x4 /* init or lock _expire */ +#define RTV_RPIPE 0x8 /* init or lock _recvpipe */ +#define RTV_SPIPE 0x10 /* init or lock _sendpipe */ +#define RTV_SSTHRESH 0x20 /* init or lock _ssthresh */ +#define RTV_RTT 0x40 /* init or lock _rtt */ +#define RTV_RTTVAR 0x80 /* init or lock _rttvar */ + +/* New flag values for additional metrics */ + +#define RTV_VALUE1 0x100 /* assign or lock first additional metric */ +#define RTV_VALUE2 0x200 /* assign or lock second additional metric */ +#define RTV_VALUE3 0x400 /* assign or lock third additional metric */ +#define RTV_VALUE4 0x800 /* assign or lock fourth additional metric */ +#define RTV_VALUE5 0x1000 /* assign or lock fifth additional metric */ +#define RTV_ROUTETAG 0x2000 /* assign or lock route tag value */ +#define RTV_WEIGHT 0x4000 /* assign or lock administrative weight */ + +/* + * Bitmask values for rtm_addrs. + */ +#define RTA_DST 0x1 /* destination sockaddr present */ +#define RTA_GATEWAY 0x2 /* gateway sockaddr present */ +#define RTA_NETMASK 0x4 /* netmask sockaddr present */ +#define RTA_GENMASK 0x8 /* cloning mask sockaddr present */ +#define RTA_IFP 0x10 /* interface name sockaddr present */ +#define RTA_IFA 0x20 /* interface addr sockaddr present */ +#define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */ +#define RTA_BRD 0x80 /* for NEWADDR, broadcast or p-p dest addr */ + +/* + * Index offsets for sockaddr array for alternate internal encoding. + */ +#define RTAX_DST 0 /* destination sockaddr present */ +#define RTAX_GATEWAY 1 /* gateway sockaddr present */ +#define RTAX_NETMASK 2 /* netmask sockaddr present */ +#define RTAX_GENMASK 3 /* cloning mask sockaddr present */ +#define RTAX_IFP 4 /* interface name sockaddr present */ +#define RTAX_IFA 5 /* interface addr sockaddr present */ +#define RTAX_AUTHOR 6 /* sockaddr for author of redirect */ +#define RTAX_BRD 7 /* for NEWADDR, broadcast or p-p dest addr */ +#define RTAX_MAX 8 /* size of array to allocate */ + +struct rt_addrinfo { + int rti_addrs; + struct sockaddr *rti_info[RTAX_MAX]; +}; + +struct route_cb { + int ip_count; + int ip6_count; + int ipx_count; + int ns_count; + int any_count; +}; + +/* + * This macro is called by users of RTM to release references to the + * route entry. + * this macro will be called as RTFREE (rt) + */ + +#ifdef FINEGRAIN_LOCKING_MODEL +#define RTFREE(rt) ipRouteUnlock (rt) +#else +#define RTFREE(rt) _RTFREE (rt) +#endif /* FINEGRAIN_LOCKING_MODEL */ + +#ifdef _WRS_KERNEL + +#ifdef FINEGRAIN_LOCKING_MODEL +#define RTLOCK(rt) ipRouteLock (rt) +#else +#define RTLOCK(rt) (RREFCNT (rt))++ +#endif /* FINEGRAIN_LOCKING_MODEL */ + +#ifndef VIRTUAL_STACK +extern struct route_cb _route_cb; +#endif /* VIRTUAL_STACK */ + +struct ifmultiaddr; +struct proc; +struct ifaddr; + +int route_init __P((void)); +void rtalloc __P((struct route *)); +void rtalloc_ign __P((struct route *, u_long)); +struct rtentry * + rtalloc1 __P((struct sockaddr *, int, u_long)); +int rtinit __P((struct ifaddr *, int, int)); +int rtioctl __P((u_long, caddr_t, struct proc *)); +int rtredirect __P((struct sockaddr *, struct sockaddr *, + struct sockaddr *, int, struct sockaddr *, struct rtentry **)); +int rtrequest __P((int, struct sockaddr *, + struct sockaddr *, struct sockaddr *, int, struct rtentry **)); +struct ifaddr *ifa_ifwithindex __P((int flags, int index, struct sockaddr *dst, + struct sockaddr *gate)); +struct ifaddr *ifa_ifaddrValidate __P((void *pIfAddr, int index)); +void rt_maskedcopy __P((struct sockaddr *src, struct sockaddr *dst, + struct sockaddr *netmask)); +void ipRouteFree __P((struct rtentry * pRoute, BOOL inTable)); + +#include +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* _NET_ROUTE_H_ */ diff --git a/h/wrn/coreip/net/socketvar.h b/h/wrn/coreip/net/socketvar.h new file mode 100644 index 0000000..2d669fb --- /dev/null +++ b/h/wrn/coreip/net/socketvar.h @@ -0,0 +1,534 @@ +/* socketvar.h - internal socket structures and definitions */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* + * Copyright (c) 1982, 1986, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)socketvar.h 8.3 (Berkeley) 2/19/95 + * $FreeBSD: src/sys/sys/socketvar.h,v 1.46.2.9 2002/08/14 22:23:10 dg Exp $ + */ + +/* +modification history +-------------------- +02e,15sep05,kch Added so_vlan_options to socket structure. Modified + SO_VLAN_ADD() macro to use the so_vlan_options (SPR #112513). +02d,23aug05,kch Keep the vlan in m_pkthdr in host byte order. +02c,09aug05,kch Added so_vlan to socket structure. +02b,27feb05,dlk Make so_linger an unsigned short; part of linger time-out + support. +02a,09feb05,dlk Embed socket semaphores in struct socket. Remove + excess semaphores. Added unixIoctlMemValidate() routine. +01z,07feb05,vvv _KERNEL cleanup +01y,02feb05,vvv replaced _WRS_KERNEL with _KERNEL to fix build error +01x,24jan05,dlk Remove sb_sel member of struct sockbuf; use SB_SEL flag + (SPR #105576). +01x,14jan05,vvv osdep.h cleanup +01w,19sep04,ann removed usage of the SELECT_LIST macro defined in osdep.h. +01v,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01u,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01t,07jan04,ann fixed sblock definition (SPR #92509) +01s,02jan04,vvv added pSoConnTimo field in socket structure +01r,08dec03,vvv updated based on inspection comments +01q,20nov03,niq Remove copyright_wrs.h file inclusion +01p,17nov03,nee Added socket backend table pointer +01o,05nov03,cdw Removal of unnecessary _KERNEL guards. +01n,04nov03,rlm Ran batch header path update for header re-org. +01m,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01l,24oct03,cdw update include statements post header re-org. +01k,06aug03,nee Accordion Base6 merge from ACCORDION_BASE6_MERGE_BASELINE + label +01j,09may03,vvv included semLib.h and selectLib.h +01i,01feb03,pas merge from FreeBSD 4.7 - added sf_buf functions +01h,06sep02,hsh add c++ protection +01g,02feb02,ham changed for tornado build. +01f,13dec01,ann enabling the xsockets for sysctl +01e,29oct01,ann fixing bugs from the test mode +01d,12sep01,ann changing the sbfree macro based on new buffer library +01c,24aug01,ann changing the path for protosw.h +01b,10aug01,ann more porting stuff +01a,02aug01,ann performed the WRS-port from FreeBSD 4.3 v 1.46.2.5 +*/ + + +#ifndef _SYS_SOCKETVAR_H_ +#define _SYS_SOCKETVAR_H_ + +#include +#include +#include +#include +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/* + * Kernel structure per socket. + * Contains send and receive buffer queues, + * handle on protocol and pointer to protocol + * private data and error information. + */ +typedef u_quad_t so_gen_t; + +/* + * WRS-port + * - if 0'd so_zone, and the accept filter members + */ + +#ifdef _WRS_KERNEL +struct socket { + struct sockFunc *pSockFuncTbl; /* socket backend function table */ + short so_type; /* generic type, see socket.h */ + short so_options; /* from socket call, see socket.h */ + u_short so_linger; /* time to linger while closing */ + short so_state; /* internal state flags SS_*, below */ + caddr_t so_pcb; /* protocol control block */ + struct protosw *so_proto; /* protocol handle */ + +/* + * Variables for connection queuing. + * Socket where accepts occur is so_head in all subsidiary sockets. + * If so_head is 0, socket is not related to an accept. + * For head socket so_incomp queues partially completed connections, + * while so_comp is a queue of connections ready to be accepted. + * If a connection is aborted and it has so_head set, then + * it has to be pulled out of either so_incomp or so_comp. + * We allow connections to queue up based on current queue lengths + * and limit on number of queued connections for this socket. + */ + struct socket *so_head; /* back pointer to accept socket */ + TAILQ_HEAD(, socket) so_incomp; /* queue of partial unaccepted connections */ + TAILQ_HEAD(, socket) so_comp; /* queue of complete unaccepted connections */ + TAILQ_ENTRY(socket) so_list; /* list of unaccepted connections */ + short so_qlen; /* number of unaccepted connections */ + short so_incqlen; /* number of unaccepted incomplete + connections */ + short so_qlimit; /* max number queued connections */ + short so_timeo; /* connection timeout */ + u_short so_error; /* error affecting connection */ + u_long so_oobmark; /* chars to oob mark */ + + short so_pgrp; /* WRS extension for ASYNC oper */ + int so_fd; /* WRS extension for storing FD */ + + SEL_WAKEUP_LIST so_selWakeupList; /* WRS extension for select */ + +/* + * Variables for socket buffering. + */ + struct sockbuf { + u_long sb_cc; /* actual chars in buffer */ + u_long sb_hiwat; /* max actual char count */ + u_long sb_mbcnt; /* chars of mbufs used */ + u_long sb_mbmax; /* max chars of mbufs to use */ + long sb_lowat; /* low water mark */ + struct mbuf *sb_mb; /* the mbuf chain */ + + short sb_flags; /* flags, see below */ + short sb_timeo; /* timeout for read/write */ + u_long sb_selCount; + + SEMAPHORE sb_Sem; /* WRS extension for sb semaphore */ + } so_rcv, so_snd; +#define SB_MAX (256*1024) /* default for max chars in sockbuf */ +#define SB_LOCK 0x01 /* lock on data queue */ +#define SB_WANT 0x02 /* someone is waiting to lock */ +#define SB_WAIT 0x04 /* someone is waiting for data/space */ +#define SB_SEL 0x08 /* someone is selecting */ +#define SB_ASYNC 0x10 /* ASYNC I/O, need signals */ +#define SB_UPCALL 0x20 /* someone wants an upcall */ +#define SB_NOINTR 0x40 /* operations not interruptible */ +#define SB_AIO 0x80 /* AIO operations queued */ +#define SB_KNOTE 0x100 /* kernel note attached */ + + void (*so_upcall) __P((struct socket *, void *, int)); + void *so_upcallarg; + + /* NB: generation count must not be first; easiest to make it last. */ + so_gen_t _so_gencnt; /* generation count */ + void *so_emuldata; /* private data for emulators */ + +#ifdef VIRTUAL_STACK + unsigned vsid; /* WRS extension for virtual stack ID */ + int vsCookie; /* cookie assigned during socket creation and + used during socket deletion */ +#endif + + int connTimeo; /* connection establishment timeout */ + +#ifdef SOCKET_VLAN + /* + * The two bytes vlan tag control information are broken into a 3-bit + * user priority (0-7), a canonical format indicator (CFI) field (0 for + * ethernet), and a 12-bit vlan identifier (VID) + */ + u_short so_vlan; /* 802.1Q vlan tag control information */ + + /* + * Two possible so_vlan_options currently supported: + * CSUM_VLAN - indicates the so_vlan contains valid vlan id and/or user + * priority information. Lower layers (i.e. subnet-based + * vlan and/or MUX-L2) shall apply the egress classification + * and assign the appropriate vlan id if so_vlan does not + * specifies a valid vlan id (i.e. vlan id is 0). + * tagged frame if the egress classification for the + * CSUM_PTAGGED - indicates the so_vlan contains the 802.1P User Priority + * information only. Lower layers (i.e. subnet-based vlan + * and/or MUX-L2) shall not apply any egress classification + * and must send the frame as priority-tagged frame only + */ + u_short so_vlan_options; +#endif /* SOCKET_VLAN */ + +}; +#endif /* _WRS_KERNEL */ + +/* + * Socket state bits. + */ +#define SS_NOFDREF 0x0001 /* no file table ref any more */ +#define SS_ISCONNECTED 0x0002 /* socket connected to a peer */ +#define SS_ISCONNECTING 0x0004 /* in process of connecting to peer */ +#define SS_ISDISCONNECTING 0x0008 /* in process of disconnecting */ +#define SS_CANTSENDMORE 0x0010 /* can't send more data to peer */ +#define SS_CANTRCVMORE 0x0020 /* can't receive more data from peer */ +#define SS_RCVATMARK 0x0040 /* at mark on input */ + +#define SS_PRIV 0x0080 /* privileged for broadcast, raw... */ + +#define SS_NBIO 0x0100 /* non-blocking ops */ +#define SS_ASYNC 0x0200 /* async i/o notify */ +#define SS_ISCONFIRMING 0x0400 /* deciding to accept connection req */ + +#define SS_INCOMP 0x0800 /* unaccepted, incomplete connection */ +#define SS_COMP 0x1000 /* unaccepted, complete connection */ +#define SS_ISDISCONNECTED 0x2000 /* socket disconnected from peer */ + + +/* + * Externalized form of struct socket used by the sysctl(3) interface. + */ +struct xsocket { + size_t xso_len; /* length of this structure */ + struct socket *xso_so; /* makes a convenient handle sometimes */ + short so_type; + short so_options; + u_short so_linger; + short so_state; + caddr_t so_pcb; /* another convenient handle */ + int xso_protocol; + int xso_family; + short so_qlen; + short so_incqlen; + short so_qlimit; + short so_timeo; + u_short so_error; + u_long so_oobmark; + struct xsockbuf { + u_long sb_cc; + u_long sb_hiwat; + u_long sb_mbcnt; + u_long sb_mbmax; + long sb_lowat; + short sb_flags; + short sb_timeo; + } so_rcv, so_snd; + uid_t so_uid; /* XXX */ +}; + +/* + * Macros for sockets and socket buffering. + */ + +/* + * Do we need to notify the other side when I/O is possible? + */ +#define sb_notify(sb) (((sb)->sb_flags & (SB_WAIT | SB_SEL | SB_ASYNC | \ + SB_UPCALL | SB_AIO | SB_KNOTE)) != 0) + +/* + * How much space is there in a socket buffer (so->so_snd or so->so_rcv)? + * This is problematical if the fields are unsigned, as the space might + * still be negative (cc > hiwat or mbcnt > mbmax). Should detect + * overflow and return 0. Should use "lmin" but it doesn't exist now. + */ +#define sbspace(sb) \ + ((long) imin((int)((sb)->sb_hiwat - (sb)->sb_cc), \ + (int)((sb)->sb_mbmax - (sb)->sb_mbcnt))) + +/* do we have to send all at once on a socket? */ +#define sosendallatonce(so) \ + ((so)->so_proto->pr_flags & PR_ATOMIC) + +/* can we read something from so? */ +#define soreadable(so) \ + ((so)->so_rcv.sb_cc >= (so)->so_rcv.sb_lowat || \ + ((so)->so_state & SS_CANTRCVMORE) || \ + (so)->so_comp.tqh_first || (so)->so_error) + +/* can we write something to so? */ +#define sowriteable(so) \ + ((sbspace(&(so)->so_snd) >= (so)->so_snd.sb_lowat && \ + (((so)->so_state&SS_ISCONNECTED) || \ + ((so)->so_proto->pr_flags&PR_CONNREQUIRED)==0)) || \ + ((so)->so_state & SS_CANTSENDMORE) || \ + (so)->so_error) + +/* adjust counters in sb reflecting allocation of m */ +#define sballoc(sb, m) { \ + (sb)->sb_cc += (m)->m_len; \ + (sb)->sb_mbcnt += MSIZE; \ + if ((m)->m_flags & M_EXT) \ + (sb)->sb_mbcnt += (m)->m_extSize; \ +} + +/* adjust counters in sb reflecting freeing of m */ +#define sbfree(sb, m) { \ + (sb)->sb_cc -= (m)->m_len; \ + (sb)->sb_mbcnt -= MSIZE; \ + if ((m)->m_flags & M_EXT) \ + (sb)->sb_mbcnt -= (m)->m_extSize; \ +} + +/* + * WRS-port + * - changed the parameter in wakeup to sb_Sem + */ + +/* + * Set lock on sockbuf sb; sleep if lock is already held. + * Unless SB_NOINTR is set on sockbuf, sleep is interruptible. + * Returns error without lock if sleep is interrupted. + * Note, atomicity of RMW accesses to sb_flags is guaranteed + * by splnet lock. + */ + +#define sblock(sb, wf) ((sb)->sb_flags & SB_LOCK ? \ + (((wf) == M_WAITOK) ? sb_lock(sb) : EWOULDBLOCK) : \ + (((sb)->sb_flags |= SB_LOCK), 0)) + +/* release lock on sockbuf sb */ +#define sbunlock(sb) { \ + (sb)->sb_flags &= ~SB_LOCK; \ + if ((sb)->sb_flags & SB_WANT) { \ + (sb)->sb_flags &= ~SB_WANT; \ + wakeup (&(sb)->sb_Sem); \ + } \ +} + +#define sorwakeup(so) do { \ + if (sb_notify(&(so)->so_rcv)) \ + sowakeup((so), &(so)->so_rcv, SELREAD); \ + } while (0) + +#define sowwakeup(so) do { \ + if (sb_notify(&(so)->so_snd)) \ + sowakeup((so), &(so)->so_snd, SELWRITE); \ + } while (0) + +#ifdef _WRS_KERNEL + +/* + * Macro to add the socket-based VLAN to the m_pkthdr. This is in the + * _WRS_KERNEL section because it will never be used by user code. + */ +#ifdef SOCKET_VLAN +/* + * Keep the vlan in the m_pkthdr in host byte order until it needs to be + * put into the packet (by the MUX-L2 egress code). + */ +#define SO_VLAN_ADD(m, so) \ + if ((so)->so_options & SO_VLAN) \ + { \ + (m)->m_pkthdr.vlan = (so)->so_vlan; \ + (m)->m_pkthdr.csum_flags |= (so)->so_vlan_options; \ + } +#endif /* SOCKET_VLAN */ + +/* + * Argument structure for sosetopt et seq. This is in the _WRS_KERNEL + * section because it will never be visible to user code. + */ + +enum sopt_dir { SOPT_GET, SOPT_SET }; +struct sockopt { + enum sopt_dir sopt_dir; /* is this a get or a set? */ + int sopt_level; /* second arg of [gs]etsockopt */ + int sopt_name; /* third arg of [gs]etsockopt */ + void *sopt_val; /* fourth arg of [gs]etsockopt */ + size_t sopt_valsize; /* (almost) fifth arg of [gs]etsockopt */ + struct proc *sopt_p; /* calling process or null if kernel */ +}; + +struct sf_buf { + SLIST_ENTRY(sf_buf) free_list; /* list of free buffer slots */ + int refcnt; /* reference count */ +}; + +#ifndef VIRTUAL_STACK +extern u_long sb_max; +extern so_gen_t so_gencnt; +#endif + +struct mbuf; +struct sockaddr; +struct stat; +struct uio; + +/* + * File operations on sockets. + */ + +/* WRS-port + * - The read, write, close, poll, stat and filter ops are not needed. + * These will be implemented in the front end sockLib library + * - Ioctl is the only one that we will retain. However, we change it's + * prototype to eliminate file struct and use a socket struct. + * - We also change the last argument to a void pointer instead of struct proc + */ + +int soo_ioctl __P((struct socket *so, u_long cmd, caddr_t data, + void *p)); +/* + * WRS-port + * WRS extensions + */ + +extern int soo_select (struct socket *so, SEL_WAKEUP_NODE *wakeupNode); +extern int soo_unselect (struct socket *so, SEL_WAKEUP_NODE *wakeupNode); +extern STATUS unixIoctlMemValidate (unsigned int cmd, const void * pData); + + +/* + * From uipc_socket and friends + */ +struct sockaddr *dup_sockaddr __P((struct sockaddr *sa, int canwait)); + +/* Clarinet */ +void getaddrfromsockbuf (struct sockaddr * saFromSock, + struct sockaddr * saFromApp); +int sockargs __P((struct mbuf **mp, caddr_t buf, int buflen, int type)); +int getsockaddr __P((struct sockaddr **namp, caddr_t uaddr, size_t len)); +void sbappend __P((struct sockbuf *sb, struct mbuf *m)); +int sbappendaddr __P((struct sockbuf *sb, struct sockaddr *asa, + struct mbuf *m0, struct mbuf *control)); +int sbappendcontrol __P((struct sockbuf *sb, struct mbuf *m0, + struct mbuf *control)); +void sbappendrecord __P((struct sockbuf *sb, struct mbuf *m0)); +void sbcheck __P((struct sockbuf *sb)); +void sbcompress __P((struct sockbuf *sb, struct mbuf *m, struct mbuf *n)); +struct mbuf * + sbcreatecontrol __P((caddr_t p, int size, int type, int level)); +void sbdrop __P((struct sockbuf *sb, int len)); +void sbdroprecord __P((struct sockbuf *sb)); +void sbflush __P((struct sockbuf *sb)); +void sbinsertoob __P((struct sockbuf *sb, struct mbuf *m0)); +void sbrelease __P((struct sockbuf *sb, struct socket *so)); +int sbreserve __P((struct sockbuf *sb, u_long cc, struct socket *so, + struct proc *p)); + +int sbwait __P((struct sockbuf *sb)); +int sb_lock __P((struct sockbuf *sb)); +struct sf_buf * + sf_buf_alloc(void); +void sf_buf_free(caddr_t addr, u_int size); +void sf_buf_ref(caddr_t addr, u_int size); +int soabort __P((struct socket *so)); +int soaccept __P((struct socket *so, struct sockaddr **nam)); +struct socket *soalloc __P((int waitok)); +int sobind __P((struct socket *so, struct sockaddr *nam, struct proc *p)); +void socantrcvmore __P((struct socket *so)); +void socantsendmore __P((struct socket *so)); +int soclose __P((struct socket *so)); +int soconnect __P((struct socket *so, struct sockaddr *nam, struct proc *p)); +int soconnect2 __P((struct socket *so1, struct socket *so2)); +int socreate __P((int dom, struct socket **aso, int type, int proto, + struct proc *p)); +void sodealloc __P((struct socket *so)); +int sodisconnect __P((struct socket *so)); +void sofree __P((struct socket *so)); +int sogetopt __P((struct socket *so, struct sockopt *sopt)); +void sohasoutofband __P((struct socket *so)); +void soisconnected __P((struct socket *so)); +void soisconnecting __P((struct socket *so)); +void soisdisconnected __P((struct socket *so)); +void soisdisconnecting __P((struct socket *so)); +int solisten __P((struct socket *so, int backlog, struct proc *p)); +struct socket * + sonewconn __P((struct socket *head, int connstatus)); +struct socket * + sonewconn3 __P((struct socket *head, int connstatus, struct proc *p)); +int sooptcopyin __P((struct sockopt *sopt, void *buf, size_t len, + size_t minlen)); +int sooptcopyout __P((struct sockopt *sopt, void *buf, size_t len)); + +/* XXX; prepare mbuf for (__FreeBSD__ < 3) routines. */ +int soopt_getm __P((struct sockopt *sopt, struct mbuf **mp)); +int soopt_mcopyin __P((struct sockopt *sopt, struct mbuf *m)); +int soopt_mcopyout __P((struct sockopt *sopt, struct mbuf *m)); + +int sopoll __P((struct socket *so, int events, struct ucred *cred, + struct proc *p)); +int soreceive __P((struct socket *so, struct sockaddr **paddr, + struct uio *uio, struct mbuf **mp0, + struct mbuf **controlp, int *flagsp)); +int soreserve __P((struct socket *so, u_long sndcc, u_long rcvcc)); +void sorflush __P((struct socket *so)); +int sosend __P((struct socket *so, struct sockaddr *addr, struct uio *uio, + struct mbuf *top, struct mbuf *control, int flags, + struct proc *p)); +int sosetopt __P((struct socket *so, struct sockopt *sopt)); +int soshutdown __P((struct socket *so, int how)); +void sotoxsocket __P((struct socket *so, struct xsocket *xso)); + +void sowakeup __P((struct socket *so, struct sockbuf *sb, + SELECT_TYPE wakeupType)); +void sbwakeup(struct socket *so, struct sockbuf *sb, + SELECT_TYPE wakeupType); + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_SYS_SOCKETVAR_H_ */ diff --git a/h/wrn/coreip/net/systm.h b/h/wrn/coreip/net/systm.h new file mode 100644 index 0000000..08cc559 --- /dev/null +++ b/h/wrn/coreip/net/systm.h @@ -0,0 +1,106 @@ +/* systm.h */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1982, 1988, 1991, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)systm.h 8.7 (Berkeley) 3/29/95 + * $FreeBSD: src/sys/sys/systm.h,v 1.111.2.5 2001/01/16 12:26:21 phk Exp $ + */ + +/* +modification history +-------------------- +01t,11apr05,sar Use gtfTimeout and gtfUntimeout directly instead of via + macros and replace global tm with gtfTimerMangaerCB + Removed timeout and untimeout. +01s,06apr05,vvv restored copyin/copyout to macros to fix warnings + (SPR #106982) +01r,09feb05,sar Move gtf include files per GTF code inspection of 10/26/2004 +01q,07feb05,vvv _KERNEL cleanup +01p,17mar04,rp updated to build for 5.5 +01o,20nov03,niq Remove copyright_wrs.h file inclusion +01n,05nov03,cdw Removal of unnecessary _KERNEL guards. +01m,04nov03,rlm Ran batch header path update for header re-org. +01l,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01k,27oct03,cdw update include statements post header re-org. +01j,02jul03,vvv added _KERNEL protection for copyin and copyout +01i,14may03,vvv included taskLib.h +01h,09may03,vvv included string.h +01g,24apr03,syy Make copyin() and copyout() static to avoid duplicated + symbols +01f,18apr03,syy Fixed compiler warnings +01e,10sep02,hsh add c++ protection +01d,28mar02,ppp changing it for tornado build environment +01c,17sep01,ppp adding the macro for lmin +01b,13sep01,ann un commenting certain defines that will be needed +01a,06jun01,deg ported. +*/ + + +#ifndef _SYS_SYSTM_H_ +#define _SYS_SYSTM_H_ + +#include +#include + +#ifdef __cplusplus + extern "C" { +#endif + +#include "taskLib.h" +#include "semLib.h" + +#ifdef _WRS_KERNEL +extern GTF_TIMER_MANAGER * gtfTimerManagerCB; + +#define ovbcopy bcopy /* overlapped buffer copy */ + +#define copyout(from, to, len) (bcopy (from, to, len), OK) +#define copyin(from, to, len) (bcopy (from, to, len), OK) + +#define imin(a,b) (((a) < (b)) ? (a) : (b)) /* interger min */ +#define lmin(a,b) ((a) < (b) ? (a) : (b)) /* long min */ + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_SYS_SYSTM_H_ */ diff --git a/h/wrn/coreip/net/uio.h b/h/wrn/coreip/net/uio.h new file mode 100644 index 0000000..35201be --- /dev/null +++ b/h/wrn/coreip/net/uio.h @@ -0,0 +1,119 @@ +/* uio.h - i/o vectors for reading and writing */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)uio.h 8.5 (Berkeley) 2/22/94 + * $FreeBSD: src/sys/sys/uio.h,v 1.11.2.1 2001/09/28 16:58:35 dillon Exp $ + */ + +/* +modification history +-------------------- +01k,15feb05,vvv include cdefs.h only in kernel +01j,24jan05,vvv osdep.h cleanup +01i,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01h,20nov03,niq Remove copyright_wrs.h file inclusion +01g,04nov03,rlm Ran batch header path update for header re-org. +01f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01e,27oct03,cdw update include statements post header re-org. +01d,01feb03,pas merge from FreeBSD 4.7 - added uio_yield() +01c,06sep02,hsh add c++ protection +01b,02feb02,ham changed for tornado build. +01a,15aug01,ann ported to clarinet from FreeBSD 4.3 ver 1.11 +*/ + +#ifndef _SYS_UIO_H_ +#define _SYS_UIO_H_ + + +#ifdef __cplusplus + extern "C" { +#endif + +#include + +/* + * XXX + * iov_base should be a void *. + */ +struct iovec { + char *iov_base; /* Base address. */ + size_t iov_len; /* Length. */ +}; + +/* + * Limits. Note, the maximum size of cluster in the network stack system + * buffer pool may impose a more stringent limit than UIO_MAXIOV. + */ +#define UIO_MAXIOV 1024 /* max 1K of iov's */ +#define UIO_SMALLIOV 8 /* 8 on stack, else malloc */ + +#ifdef _WRS_KERNEL +#include + +enum uio_rw { UIO_READ, UIO_WRITE }; + +/* Segment flag values. */ +enum uio_seg { + UIO_USERSPACE, /* from user data space */ + UIO_SYSSPACE, /* from system space */ + UIO_USERISPACE, /* from user I space */ + UIO_NOCOPY /* don't copy, already in object */ +}; + +struct uio { + struct iovec *uio_iov; + int uio_iovcnt; + off_t uio_offset; + int uio_resid; + enum uio_seg uio_segflg; + enum uio_rw uio_rw; + struct proc *uio_procp; +}; + +struct vm_object; + +void uio_yield __P((void)); +int uiomove __P((caddr_t, int, struct uio *)); +int uiomoveco __P((caddr_t, int, struct uio *, struct vm_object *)); +int uioread __P((int, struct uio *, struct vm_object *, int *)); + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_SYS_UIO_H_ */ diff --git a/h/wrn/coreip/net/unixLib.h b/h/wrn/coreip/net/unixLib.h new file mode 100644 index 0000000..9ea0ebf --- /dev/null +++ b/h/wrn/coreip/net/unixLib.h @@ -0,0 +1,123 @@ +/* unixLib.h - UNIX kernel compatability library header file */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01s,26aug05,dlk Add section tags. +01r,12jul05,kch Removed _netMalloc() and _netFree() prototypes. +01q,07jul05,dlk Balance parenthesis in wakeup_one(). +01p,18may05,rp moved ppsratecheck from icmp6.c to unixLib +01o,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +01n,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01m,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01l,03dec03,asr Fix compile errors after dinkum libc check-in +01k,20nov03,niq Remove copyright_wrs.h file inclusion +01j,05nov03,cdw Removal of unnecessary _KERNEL guards. +01i,04nov03,rlm Ran batch header path update for header re-org. +01h,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01g,10jun03,vvv include netVersion.h +01f,09may03,vvv included semLib.h and times.h +01e,09oct01,hsh add phashinit routine +01d,26sep01,qli chaning the prototype for "panic" +01c,18sep01,ann adding the prototype of tvToTicks +01b,05sep01,ham corrected microtime's prototype. +01a,01sep01,ann ported to clarinet from AE1.1 version 01f, + added the prototypes for microtime() +*/ + +#ifndef __INCunixLibh +#define __INCunixLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#ifdef _WRS_KERNEL +#include +#else +#include /* For RTP, it is sys/time.h */ +#endif +#include + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +#define MALLOC(space, cast, size, type, flags) { \ + (space) = (cast) netClusterGet (_pNetSysPool, \ + netClPoolIdGet (_pNetSysPool, \ + size, TRUE)); \ +} + +#define FREE(addr, type) { \ + netClFree (_pNetSysPool, (unsigned char *) addr); \ +} + +#define DATA_TO_MBLK(pBuf) \ + (*((struct mbuf **)((char *)(pBuf) - sizeof(struct mbuf **)))) + +/* Function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +_WRS_FASTTEXT +extern int splnet (void); +_WRS_FASTTEXT +extern int splimp (void); +_WRS_FASTTEXT +extern void splx (int x); +extern void panic(const char *, ...); +extern void wakeup (SEM_ID semId); +extern void ksleep (SEM_ID semId); +extern void * hashinit (int elements, int type, u_long * hashmask); +extern void * phashinit (int elements, int type, u_long * hashmask); +extern void microtime (struct timeval * pTv); +extern ULONG tvToTicks (struct timeval * pTv); +extern int ppsratecheck __P((struct timeval *, int *, int)); + +#else /* __STDC__ */ + +_WRS_FASTTEXT +extern int splnet (); +_WRS_FASTTEXT +extern int splimp (); +_WRS_FASTTEXT +extern void splx (); +extern void panic (); +extern void wakeup (); +extern void ksleep(); +extern void * hashinit (); +extern void microtime (); +extern ULONG tvToTicks (); +extern int ppsratecheck (); + +#endif /* __STDC__ */ + +/* + * BSD defines wakeup() to wake up all tasks sleeping on + * the specified channel. wakeup_one() wakes up a single process + * (more or less). VxWorks' tsleep() and ksleep() have been modified to + * give up splSemId and take the awaited semaphore atomically, which is + * necessary whether semFlush() or semGive() is used. + * Note, VxWorks has in the past incorrectly made wakeup() equivalent + * to semGive() rather than semFlush(). + */ + +#define wakeup(semId) ((void)semFlush((semId))) +#define wakeup_one(semId) ((void)semGive((semId))) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCunixLibh */ diff --git a/h/wrn/coreip/net/utils/ifconfig.h b/h/wrn/coreip/net/utils/ifconfig.h new file mode 100644 index 0000000..b221aa0 --- /dev/null +++ b/h/wrn/coreip/net/utils/ifconfig.h @@ -0,0 +1,77 @@ +/* ifconfig.h - interface configuation */ + +/* Copyright 2002 - 2003 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1997 Peter Wemm. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed for the FreeBSD Project + * by Peter Wemm. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * so there! + * + * $FreeBSD: src/sbin/ifconfig/ifconfig.h,v 1.5.2.2 2001/07/04 20:49:20 brooks Exp $ + */ + +/* +modification history +-------------------- +01l,07sep05,kch Removed prototypes for vlan pseudo interface. +01k,27aug05,kch Added setvlanpriority() prototype. +01j,23aug05,dlk Fix compiler warning. +01i,04aug05,kch Added ifconfig_vlan.c prototypes. +01h,20nov03,niq Remove copyright_wrs.h file inclusion +01g,05nov03,cdw Removal of unnecessary _KERNEL guards. +01f,04nov03,rlm Ran batch header path update for header re-org. +01e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01d,10jun03,vvv include netVersion.h +01c,14may03,vvv added ifconfig() +01b,29apr03,syy Added #ifdef's for inclusion and __cplusplus +01a,23jan02,deg ported from FreeBSD +*/ + +#ifndef __INCifconfigh +#define __INCifconfigh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +struct afswtch; + +extern int prefix(void *, int); +extern int ifconfig (char *); + +#ifdef __cplusplus +} +#endif + +#endif /* ! __INCifconfigh */ + diff --git a/h/wrn/coreip/net/utils/ip6addrctl.h b/h/wrn/coreip/net/utils/ip6addrctl.h new file mode 100644 index 0000000..7e561fd --- /dev/null +++ b/h/wrn/coreip/net/utils/ip6addrctl.h @@ -0,0 +1,38 @@ +/* ip6addrtcl.h - address selection policy for IPv6 */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,09jun05,rp written. +*/ + +#ifndef __INCIP6ADDRTCLH +#define __INCIP6ADDRTCLH + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* externs */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS ip6addrctl (char *); +extern STATUS ip6addrctlInit (); + +#else /* __STDC__ */ + +extern STATUS ip6addrctl (); +extern STATUS ip6addrctlInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCIP6ADDRTCLH */ diff --git a/h/wrn/coreip/net/utils/l2config.h b/h/wrn/coreip/net/utils/l2config.h new file mode 100644 index 0000000..7fdcbf4 --- /dev/null +++ b/h/wrn/coreip/net/utils/l2config.h @@ -0,0 +1,32 @@ +/* l2config.h - header file for l2config utility */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01b,26aug05,kch Added l2configInit() prototype. +01a,12aug05,kch written. +*/ + +#ifndef __INCl2configh +#define __INCl2configh + +#ifdef __cplusplus +extern "C" { +#endif + +IMPORT STATUS l2configInit (void); +IMPORT int l2config (char *); + +#ifdef __cplusplus +} +#endif + +#endif /* ! __INCl2configh */ diff --git a/h/wrn/coreip/net/utils/ndp.h b/h/wrn/coreip/net/utils/ndp.h new file mode 100644 index 0000000..9b1ad76 --- /dev/null +++ b/h/wrn/coreip/net/utils/ndp.h @@ -0,0 +1,56 @@ +/* ndp - neighbor discovery cache print for IPv6 */ + +/* Copyright 1992 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,15mar04,rp merged from orion +01e,05nov03,cdw Removal of unnecessary _KERNEL guards. +01d,04nov03,rlm Ran batch header path update for header re-org. +01c,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01b,20aug02,hgo added ndpInstInit() and ndpDestructor() +01c,06aug03,nee Accordion Base6 merge from ACCORDION_BASE6_MERGE_BASELINE + label +01b,10jun03,vvv include netVersion.h +01a,09apr02,ppp written. +*/ + +#ifndef __INCndph +#define __INCndph + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* externs */ + +#ifdef VIRTUAL_STACK +extern VS_REG_ID ndpRegistrationNum; +#endif /* VIRTUAL_STACK */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS ndpInstInit (void *); +#ifdef VIRTUAL_STACK +extern STATUS ndpDestructor (VSNUM); +#endif +extern int ndp (char *options); + +#else /* __STDC__ */ + +extern STATUS ndpInstInit (); +#ifdef VIRTUAL_STACK +extern STATUS ndpDestructor (); +#endif +extern int ndp (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCndph */ diff --git a/h/wrn/coreip/net/utils/netstat.h b/h/wrn/coreip/net/utils/netstat.h new file mode 100644 index 0000000..6b9da1a --- /dev/null +++ b/h/wrn/coreip/net/utils/netstat.h @@ -0,0 +1,174 @@ +/* netstat.h - network information display header file */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +01n,29jun05,kch Added sctp_protopr() and sctp_stats() prototypes. +01m,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +01l,25feb05,niq merge mroute changes from comp_wn_ipv6_multicast_interim-dev + branch (ver 1) +01k,07feb05,vvv _KERNEL cleanup +01j,20nov03,niq Remove copyright_wrs.h file inclusion +01i,05nov03,cdw Removal of unnecessary _KERNEL guards. +01h,04nov03,rlm Ran batch header path update for header re-org. +01g,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01f,10jun03,vvv include netVersion.h +01e,11apr03,ijm fixed diab compiler warnings +01d,03apr03,vvv modified for componentization (SPR #87352) +01c,26sep02,ppp changing the return type for routepr from void to int +01b,09apr02,ppp changing/ enabling a few prototypes; adding the prototype for + netstat +01a,02feb02,ppp ported from kame +*/ + +/* + * Copyright (c) 1992, 1993 + * Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)netstat.h 8.2 (Berkeley) 1/4/94 + * $FreeBSD: src/usr.bin/netstat/netstat.h,v 1.16.2.4 2001/08/10 09:07:09 ru Exp $ + */ + +#ifndef __INCnetstath +#define __INCnetstath + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _WRS_KERNEL + +#include + +struct protox { + u_char pr_index; /* index into nlist of cb head */ + u_char pr_sindex; /* index into nlist of stat block */ + u_char pr_wanted; /* 1 if wanted, 0 otherwise */ + void (*pr_cblocks)(u_long, char *, int); + /* control blocks printing routine */ + void (*pr_stats)(u_long, char *, int); + /* statistics printing routine */ + void (*pr_istats)(char *); /* per/if statistics printing routine */ + char *pr_name; /* well-known name */ + int pr_usesysctl; /* true if we use sysctl, not kvm */ +}; + +extern int Aflag; /* show addresses of protocol control block */ +extern int a1flag; /* show all sockets (including servers) */ +extern int bflag; /* show i/f total bytes in/out */ +extern int d1flag; /* show i/f dropped packets */ +extern int gflag; /* show group (multicast) routing or stats */ +extern int iflag; /* show interfaces */ +extern int l1flag; /* show routing table with use and ref */ +extern int Lflag; /* show size of listen queues */ +extern int mflag; /* show memory stats */ +extern int n1flag; /* show addresses numerically */ +extern int Rflag; /* show routing tables (or routing stats) */ +extern int s1flag; /* show protocol statistics */ +extern int tflag; /* show i/f watchdog timers */ +extern int Wflag; /* wide display */ + +extern int interval; /* repeat interval for i/f stats */ + +extern char *netstat_interface; /* desired i/f for stats, or NULL for all i/fs */ + +extern int af_netstat; /* address family */ + +char *plural (int); +char *plurales (int); + +void protopr (u_long,char *, int); +struct protox *name2protox (char *); +void tcp_stats (u_long,char *, int); +void udp_stats (u_long,char *, int); +void ip_stats (u_long,char *, int); +void icmp_stats (u_long,char *, int); +void igmp_stats (u_long,char *, int); +#ifdef PIM +void pim_stats (u_long, char *, int); +#endif /* PIM */ + +#ifdef INET6 +void inet6print (struct in6_addr *, int, char *, int); +void ip6_stats (u_long,char *, int); +void ip6_ifstats (char *); +void icmp6_stats (u_long,char *, int); +void icmp6_ifstats (char *); + +#ifdef WRS_PIM6 /* clarinet */ +void pim6_stats (u_long,char *, int); +#endif /* WRS_PIM6 */ + +void rip6_stats (u_long,char *, int); +void mroute6pr (void); +void mrt6_stats (void); +struct sockaddr_in6; +struct in6_addr; +char *routename6 (struct sockaddr_in6 *); +char *netname6 (struct sockaddr_in6 *, struct in6_addr *); + +#endif /*INET6*/ + +#ifdef SCTP +void sctp_protopr (u_long, char *, int); +void sctp_stats (u_long, char *, int); +#endif /* SCTP */ + +extern void intpr (int, void (*)(char *)); + +void pr_rthdr (int); +void pr_family (int); +void rt_stats (); + +char *routename (u_long); +char *netname (u_long, u_long); + +int routepr(void); +void mroutepr (void); +void mrt_stats (void); +extern int netstat (char * options); + +#endif /* _WRS_KERNEL*/ + +#ifdef __cplusplus +} +#endif +#endif /* __INCnetstath */ diff --git a/h/wrn/coreip/net/utils/prefixcmd.h b/h/wrn/coreip/net/utils/prefixcmd.h new file mode 100644 index 0000000..f694771 --- /dev/null +++ b/h/wrn/coreip/net/utils/prefixcmd.h @@ -0,0 +1,40 @@ +/* prefixcmd.h - Header file for the prefixcmd utility */ + +/* Copyright 1992-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,05nov03,cdw Removal of unnecessary _KERNEL guards. +01d,04nov03,rlm Ran batch header path update for header re-org. +01c,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01b,10jun03,vvv include netVersion.h +01a,06may03,ann written +*/ + +#ifndef __INCprefixcmdh +#define __INCprefixcmdh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#if defined(__STDC__) || defined(__cplusplus) + +extern int prefixcmd (char *params); +extern void prefixCmdInit (void); + +#else /* __STDC__ */ + +extern int prefixcmd (); +extern void prefixCmdInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCprefixcmdh */ diff --git a/h/wrn/coreip/net/utils/routeCmd.h b/h/wrn/coreip/net/utils/routeCmd.h new file mode 100644 index 0000000..b21535b --- /dev/null +++ b/h/wrn/coreip/net/utils/routeCmd.h @@ -0,0 +1,38 @@ +/* rtadvLib.h - Router Advertisement for IPv6 */ + +/* Copyright 1992-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,05nov03,cdw Removal of unnecessary _KERNEL guards. +01d,04nov03,rlm Ran batch header path update for header re-org. +01c,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01b,10jun03,vvv include netVersion.h +01a,09Apr02,nee written. +*/ + +#ifndef __INCrouteCmdh +#define __INCrouteCmdh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#if defined(__STDC__) || defined(__cplusplus) + +extern int routec (char *options); + +#else /* __STDC__ */ + +extern int routec (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrouteCmdh */ diff --git a/h/wrn/coreip/netBufLib.h b/h/wrn/coreip/netBufLib.h new file mode 100644 index 0000000..cacefa5 --- /dev/null +++ b/h/wrn/coreip/netBufLib.h @@ -0,0 +1,947 @@ +/* netBufLib.h - network buffers header file */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +02m,25aug05,dlk Add section tags. +02l,12aug05,dlk Added M_HEADER flag, overloading M_PROMISC. +02k,25jul05,dlk Move some routines from netBufLib to netBufAdvLib for better + scalability. Some previously LOCAL routines given external + linkage as a result. + Add vlan and qnum members to mBlkPktHdr. +02j,22jul05,vvv removed duplicate macro definitions (SPR #107343) +02i,01arp05,dlk Replace 'bestFit' with 'noSmaller'. +02h,07feb05,wap Allow sysctl init routines to be scaled out +02g,18oct04,dlk Added CL_ALIGN_MIN definition and pNetMemReq function + (SPRs #102569, #102771). +02f,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +02e,19jul04,niq Move sysctl initialization to the component init routine +02d,16jun04,wap Add support for netBufRelease +02c,24nov03,wap Merge in changes from Snowflake +02b,05nov03,cdw Removal of unnecessary _KERNEL guards. +02a,04nov03,rlm Ran batch header path update for header re-org. +01z,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01z,20nov03,rhe UBM Base 6 Itn 3 Merge from WRAMP branch +02a,17nov03,rhe Updated errno values. + Removed redundant MACROs TUP_MPOOL_GET & TUP_CPOOL_GET + Modified poolFunc table for plug in methods + netPoolDelete(), netPoolDestroy(), netPoolRelease(), + netTupleGet(), netTupleFree(), netTupleListGet(), + netTupleListFree() & netTupleMigrate() + Modified struct netPool to support attributes and binding. + Updated prototypes. +01z,23Oct03,rhe reintroduced linkbuf support. (M_LINK and M_LINKID) + Added external reference for _pNetPoolFuncTbl & + _pLinkPoolFuncTbl. +01y,24sep03,kkz Rebase with Base6 ITER2 FRZ7 (from ver 01q,05sep03,rhe) +01x,15sep03,vvv updated path for new headers +01w,08sep03,vvv merged from ACCORDION_BASE6_MERGE_BASELINE +01v,10jun03,vvv include netVersion.h +01u,01may03,spm Tornado 2.2 CP1 merge (from ver 01p,13jan03,rae: + TOR2_2-CP1-F label, tor2_2-patch branch, /wind/river VOB) +01t,08apr03,ann added the prototypes for the SHOW routines - SPR# 86899 +01s,26mar03,vvv conditionally define *_MIN parameters (SPR #87113) +01r,01feb03,pas added MT_TAG for FreeBSD 4.7 changes +01q,13jan03,ann merged Team-F1's ipsec changes + - changed the NUM_DAT for the larger clusters to zero + - added support for large clusters (4K to 64K) +01p,25jun02,pas conditionally re-enable MSIZE for old drivers +01o,12jun02,pas changed minimum cluster size to 16 + added stats for cluster min/max/avg size request +01n,04jun02,pas changed NUM_nn to NUM_DAT_nn +01m,14jan00,ham changed struct poolFunc.pInitRtn's API, poolInit()'s API + as well for PD support. +01s,27aug03,rae add large block sizes +01r,29jul03,wap add linkbuf support +01q,24jun03,rae add #include netVersion.h +01q,05sep03,rhe Base6 Iteration2 Merge from WRAMP sandbox +01q,28aug03,rhe Base 6, Iteration 2. Added Tuple MACROs and netPool attributes. + Also added prototypes for netPoolAttach(), netPoolCreate(), + netPoolDetach(), netTupleChainGet(), netTupleListGet(), + netTupleListFree(), netTuplePhysAddrMap(), netPoolIdGet() and + netPoolNameGet(). + Also modified netPool to support attributes and knowledge to + delete its memory should the netPool need to be destroyed. + Structures NETBUF_CL_DESC and NETBUF_CFG were added for + netPoolCreate() and structure BUF_VTOP is required for + netTuplePhysAddrMap(). +01p,13jan03,rae Merged from velocecp branch (SPR 73393) +01o,05jun02,vvv added M_EOB flag (SPR #72213) +01n,26mar02,vvv added M_PROXY flag (SPR #74518) +01m,10oct01,rae merge from truestack ver 01q base 01l +01l,24mar99,ann protected some #defines by #ifndefs due to conflicts + in project facility (all the ones defined in 00network.cdf) +01k,16mar99,spm recovered orphaned code from tor1_0_1.sens1_1 (SPR #25770) +01j,08oct98,gnn updated system network buffer allocations +01i,11dec97,vin added prototype for netMblkOffsetToBufCopy part of SPR 9563. +01h,08dec97,vin added prototype for netMblkChainDup SPR 9966. +01g,03dec97,vin added prototype for netTupleGet(), added NUM_SYS_xxx defines +01f,13nov97,vin added error codes and cleanup. +01e,08oct97,vin corrected clBlkFree() +01d,30sep96,vin added M_BLK_SZ. +01c,26sep97,vin added NUM_XXX_MIN macros for bootroms. +01b,19sep97,vin added cluster Blk typedef, optimized mBlk structure. + moved mExt structure out of the mBlk structure. +01a,08aug97,vin written. +*/ + +#ifndef __INCnetBufLibh +#define __INCnetBufLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* include cfgDefs for CFG_DATA_HDR */ +#include +#include + +#if CPU_FAMILY==I960 +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* includes */ +#include "memLib.h" +#include "private/memPartLibP.h" +#include "net/uio.h" + +/* defines */ + +/* status codes */ + +#define S_netBufLib_MEMSIZE_INVALID (M_netBufLib | 1) +#define S_netBufLib_CLSIZE_INVALID (M_netBufLib | 2) +#define S_netBufLib_NO_SYSTEM_MEMORY (M_netBufLib | 3) +#define S_netBufLib_MEM_UNALIGNED (M_netBufLib | 4) +#define S_netBufLib_MEMSIZE_UNALIGNED (M_netBufLib | 5) +#define S_netBufLib_MEMAREA_INVALID (M_netBufLib | 6) +#define S_netBufLib_MBLK_INVALID (M_netBufLib | 7) +#define S_netBufLib_NETPOOL_INVALID (M_netBufLib | 8) +#define S_netBufLib_INVALID_ARGUMENT (M_netBufLib | 9) +#define S_netBufLib_NO_POOL_MEMORY (M_netBufLib | 10) +#define S_netBufLib_LIB_NOT_INITIALIZED (M_netBufLib | 11) +#define S_netBufLib_POOL_FEATURE_NOT_SUPPORTED (M_netBufLib | 12) +#define S_netBufLib_DUPLICATE_POOL (M_netBufLib | 13) +#define S_netBufLib_POOL_RELEASED (M_netBufLib | 14) +#define S_netBufLib_POOL_RELEASE_IGNORE (M_netBufLib | 15) + +/* usage MACRO's */ +/* Tuple Length related MACROS */ + +#define TUP_LEN_GET(pMblk) ((int) (pMblk)->mBlkHdr.mLen) +#define TUP_LEN_SET(pMblk,length) ((pMblk)->mBlkHdr.mLen = (length)) +#define TUP_LEN_ZERO(pMblk) ((pMblk)->mBlkHdr.mLen = 0) +#define TUP_CL_LEN_GET(pMblk) ((int) (pMblk)->pClBlk->clSize) +#define TUP_CL_AVIL_LEN_GET(pMblk) ((int) (pMblk)->pClBlk->clSize - \ + ((int) (pMblk)->mBlkHdr.mLen) - \ + (((int) (pMblk)->mBlkHdr.mData) - \ + ((int)(pMblk)->pClBlk->clNode.pClBuf))) + +/* Next refers to the next Tuple in a Tuple chain */ + +#define TUP_NEXT_GET(pMblk) ((M_BLK_ID) (pMblk)->mBlkHdr.mNext) +#define TUP_NEXT_SET(pMblk,pNext) ((pMblk)->mBlkHdr.mNext = \ + (M_BLK_ID) (pNext)) +#define TUP_NEXT_NULL(pMblk) ((pMblk)->mBlkHdr.mNext = \ + (M_BLK_ID) NULL) + +/* Next Packet refers to the next Tuple (List of Tuples) */ + +#define TUP_NEXT_PK_GET(pMblk) ((M_BLK_ID) (pMblk)->mBlkHdr.mNextPkt) +#define TUP_NEXT_PK_SET(pMblk,pNext) ((pMblk)->mBlkHdr.mNextPkt = \ + (M_BLK_ID) (pNext)) +#define TUP_NEXT_PK_NULL(pMblk) ((pMblk)->mBlkHdr.mNextPkt = \ + (M_BLK_ID) NULL) + + +/* mBlk type */ + +#define TUP_TYPE_GET(pMblk) ((pMblk)->mBlkHdr.mType) +#define TUP_TYPE_SET(pMblk,type) ((pMblk)->mBlkHdr.mType = type) + +/* Cluster Buffer Address */ + +#define TUP_BUF_GET(pMblk) ((pMblk)->mBlkHdr.mData) +#define TUP_BUF_SET(pMblk,addr) ((pMblk)->mBlkHdr.mData = addr) + + + + + +#define NET_POOL_NAME_SZ (4 * sizeof(long)) /* Length of pool name */ + + +/* netBufLib Attributes required for buffer migration */ + +#define NB_ALIGN_OFFSET 0 /* Bits 0, 1 & 2 */ +#define NB_ALIGN_MASK (0x7 << NB_ALIGN_OFFSET) +#define NB_ALIGN_NONE (0x0 << NB_ALIGN_OFFSET) +#define NB_ALIGN_INT (0x1 << NB_ALIGN_OFFSET) +#define NB_ALIGN_CACHE (0x2 << NB_ALIGN_OFFSET) +#define NB_ALIGN_PAGE (0x3 << NB_ALIGN_OFFSET) + +#define NB_SHARABLE 0x0400 /* Bit 10 */ +#define NB_ISR_SAFE 0x0800 /* Bit 11 */ + +#define NB_MODE_OFFSET 12 /* Bits 12, 13 */ +#define NB_MODE_MASK (0x3 << NB_MODE_OFFSET) +#define NB_MODE_5_5BKWRDS (0x0 << NB_MODE_OFFSET) + +/* Flag bits used in pNetPool->flag */ + +#define NB_CREATE 0x01 /* netPool created via netPoolCreate */ +#define NB_RELEASE 0x02 /* netPool is in a release state */ +#define NB_RELEASE_START 0x04 /* started the release state */ +#define NB_DESTROY_START 0x08 /* started the delete process */ + +/* netPoolRlease() MACROs */ + +#define NET_REL_IN_TASK 0x00 /* Release netPool in task context */ +#define NET_REL_IN_CONTEXT 0x01 /* Release netPool in call context */ +#define NET_REL_NAME "tPoolRel" /* Task name */ +#define NET_REL_PRI netPoolRelPri /* see: netBufLib.c */ +#define NET_REL_OPT 0 /* task options */ +#define NET_REL_STACK 500 /* task stack */ + + + +/* Valid attribute combinations */ + +/* Int Aligned, Sharable, ISR Safe */ + +#define ATTR_AI_SH_ISR (NB_ALIGN_INT | NB_ISR_SAFE | NB_SHARABLE | \ + NB_MODE_5_5BKWRDS) + +#define ATTR_AC_SH_ISR (NB_ALIGN_CACHE | NB_ISR_SAFE | NB_SHARABLE | \ + NB_MODE_5_5BKWRDS) + +/* Int Aligned, Private, ISR Safe */ + +#define ATTR_AI_ISR (NB_ALIGN_INT | NB_ISR_SAFE | \ + NB_MODE_5_5BKWRDS) + +#define ATTR_AC_ISR (NB_ALIGN_CACHE | NB_ISR_SAFE | \ + NB_MODE_5_5BKWRDS) + +/* Buffer types for pMemReqRtn function */ + +#define NB_BUFTYPE_CLUSTER 0 /* clusters */ +#define NB_BUFTYPE_M_BLK 1 /* M_BLKs */ +#define NB_BUFTYPE_CL_BLK 2 /* CL_BLKs */ + +#define MAX_MBLK_TYPES 256 /* max number of mBlk types */ + +/* cluster defines */ + +#define CL_LOG2_16 4 +#define CL_LOG2_32 5 +#define CL_LOG2_64 6 +#define CL_LOG2_128 7 +#define CL_LOG2_256 8 +#define CL_LOG2_512 9 +#define CL_LOG2_1024 10 +#define CL_LOG2_2048 11 +#define CL_LOG2_4096 12 +#define CL_LOG2_8192 13 +#define CL_LOG2_16384 14 +#define CL_LOG2_32768 15 +#define CL_LOG2_65536 16 + +#define CL_SIZE_16 16 +#define CL_SIZE_32 32 +#define CL_SIZE_64 64 +#define CL_SIZE_128 128 +#define CL_SIZE_256 256 +#define CL_SIZE_512 512 +#define CL_SIZE_1024 1024 +#define CL_SIZE_2048 2048 +#define CL_SIZE_4096 4096 +#define CL_SIZE_8192 8192 +#define CL_SIZE_16384 16384 +#define CL_SIZE_32768 32768 +#define CL_SIZE_65536 65536 + +#define CL_LOG2_MIN CL_LOG2_16 +#define CL_LOG2_MAX CL_LOG2_65536 +#define CL_SIZE_MAX (1 << CL_LOG2_MAX) +#define CL_SIZE_MIN (1 << CL_LOG2_MIN) +#define CL_INDX_MIN 0 +#define CL_INDX_MAX (CL_LOG2_MAX - CL_LOG2_MIN) +#define CL_TBL_SIZE (CL_INDX_MAX + 1) + + +#define CL_LOG2_TO_CL_INDEX(x) ((x) - CL_LOG2_MIN) +#define CL_LOG2_TO_CL_SIZE(x) (1 << (x)) +#define SIZE_TO_LOG2(size) (ffsMsb((size)) - 1) +#define CL_SIZE_TO_CL_INDEX(clSize) (ffsMsb((clSize)) - (1 + CL_LOG2_MIN)) + +/* + * Minimum cluster alignment + * Some network data structures stored in clusters + * contain 8-byte members of types such as unsigned long long, + * which require 8-byte alignment on some architectures (SPR 102569). + * However, for backwards comptibilty, we only ensure 4-byte + * alignment by default. Clients needing the 8-byte alignment can + * use netPoolCreate(), or replace the default pool's memory requirements + * function (see uipc_mbuf.c for an example). + * This value must be a power of two. + */ + +#define CL_ALIGN_MIN 4 + +/* mBlk types */ +#define MT_FREE 0 /* should be on free list */ +#define MT_DATA 1 /* dynamic (data) allocation */ +#define MT_HEADER 2 /* packet header */ +#define MT_SOCKET 3 /* socket structure */ +#define MT_PCB 4 /* protocol control block */ +#define MT_RTABLE 5 /* routing tables */ +#define MT_HTABLE 6 /* IMP host tables */ +#define MT_ATABLE 7 /* address resolution tables */ +#define MT_SONAME 8 /* socket name */ +#define MT_ZOMBIE 9 /* zombie proc status */ +#define MT_SOOPTS 10 /* socket options */ +#define MT_FTABLE 11 /* fragment reassembly header */ +#define MT_RIGHTS 12 /* access rights */ +#define MT_IFADDR 13 /* interface address */ +#define MT_CONTROL 14 /* extra-data protocol message */ +#define MT_OOBDATA 15 /* expedited data */ +#define MT_IPMOPTS 16 /* internet multicast options */ +#define MT_IPMADDR 17 /* internet multicast address */ +#define MT_IFMADDR 18 /* link-level multicast address */ +#define MT_MRTABLE 19 /* multicast routing tables */ +#define MT_TAG 20 /* volatile metadata associated to pkts */ + +#define NUM_MBLK_TYPES 21 /* number of mBlk types defined */ + +/* mBlk flags */ + +#define M_EXT 0x0001 /* has an associated cluster */ +#define M_PKTHDR 0x0002 /* start of record */ +#define M_EOR 0x0004 /* end of record */ + +/* flags 0x0008 - 0x0080 are used in mbuf.h */ + +/* mBlk pkthdr flags, also in mFlags */ + +#define M_BCAST 0x0100 /* send/received as link-level broadcast */ +#define M_MCAST 0x0200 /* send/received as link-level multicast */ + +/* flags 0x0400 - 0x1000 are used in mbuf.h */ + +#define M_FORWARD 0x2000 /* to be fast forwarded */ +#define M_PROXY 0x4000 /* broadcast forwarded through proxy */ +#define M_PROMISC 0x8000 /* indicates unipromisc for multi receive */ +#define M_HEADER M_PROMISC /* NPT transmit, full header present */ + +/* + * M_EOB is set when the mblk contains the last part of a large block of + * data sent by an application using TCP (a large block of data is one + * which causes sosend to issue multiple protocol send requests). + * M_EOB and M_EOR can be used together since M_EOB is only used for TCP + * and M_EOR is only used for datagram protocols (UDP, raw IP). + */ + +#define M_EOB M_EOR + +/* flags to mClGet/mBlkGet */ + +#define M_DONTWAIT 1 /* don't wait if buffers not available */ +#define M_WAIT 0 /* wait if buffers not available */ + +/* length to copy to copy all data from the mBlk chain*/ + +#define M_COPYALL 1000000000 + +/* check to see if an mBlk is associated with a cluster */ + +#define M_HASCL(pMblk) ((pMblk)->mBlkHdr.mFlags & M_EXT) + +#define M_BLK_SZ sizeof(struct mBlk) /* size of an mBlk */ +#define M_BLK_SZ_ALIGNED 64 /* See linkBufPool */ + #ifndef MSIZE +#define MSIZE M_BLK_SZ /* size of an mBlk */ +#endif + +#define CL_BLK_SZ sizeof(struct clBlk) /* size of cluster block */ +#define CL_BLK_SZ_ALIGNED 64 /* See linkBufPool */ + +/* macro to get to the netPool pointer from the mBlk */ + +#define MBLK_TO_NET_POOL(pMblk) (*(NET_POOL_ID *)((int)pMblk - sizeof(int))) +#define CLBLK_TO_NET_POOL(pClBlk) (pClBlk->pNetPool) + +/* macro to get to the cluster pool ptr from the cluster buffer */ + +#define CL_BUF_TO_CL_POOL(pClBuf) (*(CL_POOL_ID *)((int)pClBuf - sizeof(int))) + +/* macro to get to the cluster reference count from the cluster buffer */ + +#define CL_BUF_TO_REFCNT(pClBuf) (UCHAR *)((int)pClBuf - (2 * sizeof(int))) + +/* macros for accessing the functions of net pool directly */ + +#define poolInit(poolId,pMclBlkConfig,pClDescTbl,tblNumEnt,fromKheap) \ + (*(((NET_POOL_ID)(poolId))->pFuncTbl->pInitRtn)) \ + ((poolId), (pMclBlkConfig), (pClDescTbl), (tblNumEnt), \ + (fromKheap)) + +#define mBlkFree(poolId,pMblk) \ + (*(((NET_POOL_ID)(poolId))->pFuncTbl->pMblkFreeRtn)) \ + ((poolId), (pMblk)) + +#define clFree(poolId,pClBuf) \ + (*(((NET_POOL_ID)(poolId))->pFuncTbl->pClFreeRtn)) \ + ((poolId), (pClBuf)) + +#define clBlkFree(poolId,pClBlk) \ + (*(((NET_POOL_ID)(poolId))->pFuncTbl->pClBlkFreeRtn)) \ + ((pClBlk)) + +#define mBlkClFree(poolId,pMblk) \ + (*(((NET_POOL_ID)(poolId))->pFuncTbl->pMblkClFreeRtn)) \ + ((poolId), (pMblk)) + +#define mBlkGet(poolId,canWait,type) \ + (*(((NET_POOL_ID)(poolId))->pFuncTbl->pMblkGetRtn)) \ + ((poolId), (canWait), (type)) + +#define clBlkGet(poolId,canWait) \ + (*(((NET_POOL_ID)(poolId))->pFuncTbl->pClBlkGetRtn)) \ + ((poolId), (canWait)) + +#define clusterGet(poolId,pClPool) \ + (*(((NET_POOL_ID)(poolId))->pFuncTbl->pClGetRtn)) \ + ((poolId), (pClPool)) + +#define mClGet(poolId,pMblk,bufSize,canWait,noSmaller) \ + (*(((NET_POOL_ID)(poolId))->pFuncTbl->pMblkClGetRtn)) \ + ((poolId), (pMblk), (bufSize), (canWait), (noSmaller)) + +#define clPoolIdGet(poolId,bufSize,noSmaller) \ + (*(((NET_POOL_ID)(poolId))->pFuncTbl->pClPoolIdGetRtn)) \ + ((poolId), (bufSize), (noSmaller)) + +#define netMemReq(poolId, type, num, size) \ + (((NET_POOL_ID)(poolId))->pFuncTbl->pMemReqRtn \ + ((type), (num), (size))) + +#define ML_SIZE \ + ROUND_UP(sizeof(M_BLK) + sizeof(CL_BLK) + sizeof(NET_POOL_ID), \ + NETBUF_ALIGN) +#define CL_SIZE(x) (ROUND_UP((x), NETBUF_ALIGN)) + +#ifndef NB_FULL_BKWARD_MODE +#define NB_FULL_BKWARD_MODE +#endif + +/* typedefs */ + +/* + * This structure is used to configure the number of mBlks and cluster blocks + * that are allocated in a netPool. Each cluster has a corresponding cluster + * block which manages it. An mBlk manages a cluster block and the cluster. + * When a netPool is configured there should as many cluster blocks as the + * cumulative number of clusters. The defaults are defined above, but the + * structure is defined and filled in usrConfig.c. For TCP applications it is + * good to have two mBlks for every cluster block. + */ + +typedef struct + { + int mBlkNum; /* number of mBlks */ + int clBlkNum; /* number of cluster Blocks */ + char * memArea; /* pre allocated memory area */ + int memSize; /* pre allocated memory size */ + } M_CL_CONFIG; + +/* + * This structure defines the way the networking code utilizes clusters. + * A table of type CL_DESC is filled in usrNetwork.c. + * Clusters are also used to hold network data structures other than the + * regular data. The network data structures are routing table entries, + * interface address structures, multicast address structures etc. + */ + +typedef struct clDesc + { + int clSize; /* cluster type */ + int clNum; /* number of clusters */ + char * memArea; /* pre allocated memory area */ + int memSize; /* pre allocated memory size */ + } CL_DESC; + +/* + * this structure is used to pass the config parameters to mbinit and is + * used to define the configuration of the system and data network memory + * pools. + */ + +typedef struct netPoolParams + { + CFG_DATA_HDR cfgh; /* standard cfg header */ + + M_CL_CONFIG * sysMblkClBlkConf; /* mblks and clblks for system pool */ + CL_DESC * sysClDesc; /* cluster info for system pool */ + unsigned int sysClDescNum; /* no. of clDesc for system pool */ + + M_CL_CONFIG * pktMblkClBlkConf; /* mblks and clblks for data pool */ + CL_DESC * pktClDesc; /* cluster info for data pool */ + unsigned int pktClDescNum; /* no. of clDesc for data pool */ + FUNCPTR cfg_privInitSysctl; /* Do sysctl initialization ? */ + } NET_POOL_CONFIG_PARAMS; + +/* this structure defines the cluster */ + +typedef struct clBuff + { + struct clBuff * pClNext; /* pointer to the next clBuff */ + } CL_BUF; + +typedef CL_BUF * CL_BUF_ID; + +/* This structure defines the each cluster pool */ + +typedef struct clPool + { + int clSize; /* cluster size */ + int clLg2; /* cluster log 2 size */ + int clNum; /* number of clusters */ + int clNumFree; /* number of clusters free */ + int clUsage; /* number of times used */ + int clMinAlloc; /* smallest block size requested */ + int clMaxAlloc; /* largest block size requested */ + unsigned long clTotAlloc; /* total allocation for this pool */ + CL_BUF_ID pClHead; /* pointer to the cluster head */ + struct netPool * pNetPool; /* pointer to the netPool */ + } CL_POOL; + +typedef CL_POOL * CL_POOL_ID; + +/* header at beginning of each mBlk */ + +typedef struct mHdr + { + struct mBlk * mNext; /* next buffer in chain */ + struct mBlk * mNextPkt; /* next chain in queue/record */ + char * mData; /* location of data */ + int mLen; /* amount of data in this mBlk */ + UINT16 mType; /* type of data in this mBlk */ + UINT16 mFlags; /* flags; see below */ + UINT16 reserved; + UINT16 offset1; /* network service offset */ + } M_BLK_HDR; + +/* record/packet header in first mBlk of chain; valid if M_PKTHDR set */ + +typedef struct mBlk M_BLK; +typedef M_BLK * M_BLK_ID; + +typedef struct pktHdr + { + struct ifnet * rcvif; /* rcv interface */ + int len; /* total packet length */ + VOID * header; /* pointer to packet header */ + UINT32 csum_flags; /* checksum flags */ + UINT32 csum_data; /* used by csum routines */ + M_BLK_ID aux; /* extra data buffer */ + + UINT16 qnum; /* priority queueing number */ + UINT16 vlan; /* vlan control information */ + } M_PKT_HDR; + +typedef union clBlkList + { + struct clBlk * pClBlkNext; /* pointer to the next clBlk */ + char * pClBuf; /* pointer to the buffer */ + } CL_BLK_LIST; + +/* description of external storage mapped into mBlk, valid if M_EXT set */ + +typedef struct clBlk + { + CL_BLK_LIST clNode; /* union of next clBlk, buffer ptr */ + UINT clSize; /* cluster size */ + int clRefCnt; /* reference count of the cluster */ + FUNCPTR pClFreeRtn; /* pointer to cluster free routine */ + int clFreeArg1; /* free routine arg 1 */ + int clFreeArg2; /* free routine arg 2 */ + int clFreeArg3; /* free routine arg 3 */ + struct netPool * pNetPool; /* pointer to the netPool */ + } CL_BLK; + +/* mBlk structure */ + +struct mBlk + { + M_BLK_HDR mBlkHdr; /* header */ + M_PKT_HDR mBlkPktHdr; /* pkthdr */ + CL_BLK * pClBlk; /* pointer to cluster blk */ + }; + +/* mBlk statistics used to show data pool by show routines */ + +typedef struct mbstat + { + ULONG mNum; /* mBlks obtained from page pool */ + ULONG mDrops; /* times failed to find space */ + ULONG mWait; /* times waited for space */ + ULONG mDrain; /* times drained protocols for space */ + ULONG mTypes[256]; /* type specific mBlk allocations */ + } M_STAT; + +typedef struct _M_LINK + { + M_BLK mBlk; + CL_BLK clBlk; + } M_LINK; + +#define CL_BLK_TO_M_LINK(pClBlk) \ + (M_LINK *) ((char *)(pClBlk) - OFFSET (M_LINK, clBlk)) + +#define NETBUF_ALIGN 64 + +typedef CL_BLK * CL_BLK_ID; /* Cluster Block ID */ +typedef struct netPool NET_POOL; /* Pool ID */ +typedef struct poolFunc POOL_FUNC; /* Pool Function Table */ +typedef NET_POOL * NET_POOL_ID; /* Pool ID (pointer) */ +typedef M_LINK * M_LINK_ID; /* mBlk Cluster Block set */ +typedef struct poolAttr * ATTR_ID; /* Pool Attribute ID */ +typedef struct iovec IOV; /* IOV structure (See uio.h) */ +typedef struct poolRel POOL_REL; /* netPoolRelease Support */ + + +typedef struct bufVirToPhy + { + M_BLK_ID pMBlk; /* Associated mBlk */ + char * pVAddr; /* Virtual Address */ + char * pPAddr; /* Physical Address */ + int length; /* length of segment */ + } BUF_VTOP; + + +struct poolFunc /* POOL_FUNC */ + { + /* pointer to the pool initialization routine */ + STATUS (*pInitRtn) (NET_POOL_ID pNetPool, M_CL_CONFIG * pMclBlkConfig, + CL_DESC * pClDescTbl, int clDescTblNumEnt, + BOOL fromKheap); + + /* pointer to mBlk free routine */ + void (*pMblkFreeRtn) (NET_POOL_ID pNetPool, M_BLK_ID pMblk); + + /* pointer to cluster Blk free routine */ + void (*pClBlkFreeRtn) (CL_BLK_ID pClBlk); + + /* pointer to cluster free routine */ + void (*pClFreeRtn) (NET_POOL_ID pNetPool, char * pClBuf); + + /* pointer to mBlk/cluster pair free routine */ + M_BLK_ID (*pMblkClFreeRtn) (NET_POOL_ID pNetPool, M_BLK_ID pMblk); + + /* pointer to mBlk get routine */ + M_BLK_ID (*pMblkGetRtn) (NET_POOL_ID pNetPool, int canWait, UCHAR type); + + /* pointer to cluster Blk get routine */ + CL_BLK_ID (*pClBlkGetRtn) (NET_POOL_ID pNetPool, int canWait); + + /* pointer to a cluster buffer get routine */ + char * (*pClGetRtn) (NET_POOL_ID pNetPool, CL_POOL_ID pClPool); + + /* pointer to mBlk/cluster pair get routine */ + STATUS (*pMblkClGetRtn) (NET_POOL_ID pNetPool, M_BLK_ID pMblk, + int bufSize, int canWait, BOOL noSmaller); + + /* pointer to cluster pool Id get routine */ + CL_POOL_ID (*pClPoolIdGetRtn) (NET_POOL_ID pNetPool, int bufSize, + BOOL noSmaller); + + /* netBuf 6.0 Pluggable API */ + + /* pointer to pool delete routine */ + STATUS (*pNetPoolDeleteRtn) (NET_POOL_ID pNetPool); + + /* pointer to pool destroy routine */ + STATUS (*pNetPoolDestroyRtn) (NET_POOL_ID pNetPool); + + + /* pointer to pool release routine */ + STATUS (*pNetPoolReleaseRtn) (NET_POOL_ID pNetPool); + + + /* pointer to Tuple get routine */ + M_BLK_ID (*pNetTupleGetRtn) (NET_POOL_ID pNetPool, + int bufSize, + int canWait, + UCHAR type, + BOOL noSmaller); + + /* pointer to Tuple get routine */ + M_BLK_ID (*pNetTupleFreeRtn) (M_BLK_ID pMblk); + + /* pointer to Tuple List Get routine */ + int (*pNetTupleListGetRtn) (NET_POOL_ID pNetPool, + CL_POOL_ID pClPool, + int count, + int type, + M_BLK_ID * pMblk); + + /* pointer to Tuple List Free routine */ + STATUS (*pNetTupleListFreeRtn) (M_BLK_ID pMblk); + + + /* pointer to Tuple Migrate routine */ + M_BLK_ID (*pNetTupleMigrateRtn) (NET_POOL_ID pDstNetPool, + M_BLK_ID pMblk); + + /* pointer to memory requirement function */ + int (*pMemReqRtn) (int type, int num, int size); + }; + +struct poolRel /* POOL_REL */ + { + SEM_ID releaseSemId; /* Release Semaphore ID */ + int releaseTaskId; /* Release task ID */ + + /* pointer to Tuple netPoolReleaseStart routine */ + STATUS (*pNetPoolReleaseStartRtn) (NET_POOL_ID pNetPool, + POOL_FUNC * pReleaseFunc); + + /* pointer to Tuple netPoolReleaseEnd routine */ + STATUS (*pNetPoolReleaseEndRtn) (NET_POOL_ID pNetPool); + + }; + +/* Attribute Set */ + +typedef struct poolAttr + { + UINT32 attribute; /* Attribute Bits */ + int refCount; /* Registered objects sharing this set */ + PART_ID ctrlPartId; /* Memory partition for control structures */ + PART_ID bMemPartId; /* Memory partition for clusters */ + void * pDomain; /* NULL = Kernel */ + int ctrlAlign; /* Alignment Control Structures */ + int clusterAlign; /* Alignment Clusters (Buffers) */ + struct poolAttr * pNext; /* Next in Link List */ + } POOL_ATTR; + + +struct netPool /* NET_POOL */ + { + M_BLK_ID pmBlkHead; /* head of mBlks */ + CL_BLK_ID pClBlkHead; /* head of cluster Blocks */ + int mBlkCnt; /* number of mblks */ + int mBlkFree; /* number of free mblks - + deprecated, use + pPoolStat->mTypes[MT_FREE] + instead */ + int clBlkOutstanding; /* Number of clBlks in use */ + int clMask; /* cluster availability mask */ + int clLg2Max; /* cluster log2 maximum size */ + int clSizeMax; /* maximum cluster size */ + int clLg2Min; /* cluster log2 minimum size */ + int clSizeMin; /* minimum cluster size */ + CL_POOL * clTbl [CL_TBL_SIZE]; /* pool table */ + M_STAT * pPoolStat; /* pool statistics */ + POOL_FUNC * pFuncTbl; /* ptr to function ptr table */ + int flag; /* Pool Flag */ + ATTR_ID pAttrSet; /* Attribute Reference */ + PART_ID poolPartId; /* Pool Struct Memory Partition */ + int attachRefCount; /* Attach Ref Count */ + int bindRefCount; /* Attach Ref Count */ + char * pControlMemArea; /* Memory Area for mClBlk */ + PART_ID controlMemPartId; /* memory partition for mClBlk */ + char * pClusterMemArea; /* Memory Area for clusters */ + PART_ID clusterMemPartId; /* memory partition for clusters */ + char poolName[NET_POOL_NAME_SZ]; /* Pool name */ + POOL_REL poolRelease; /* netPoolRelease Support */ + struct netPool * pParent; /* Parent netPool */ + struct netPool * pNext; /* next in link list */ + }; + +/* Cluster description structure for a buffer pool see netPoolCreate () */ + +typedef struct netBufClDesc + { + int clSize; /* Cluster Size */ + int clNum; /* Number of clusters in pool */ + } NETBUF_CL_DESC; + +/* Pool configuration structure see netPoolCreate () */ + +typedef struct netBufCfg + { + char * pName; /* Pool Name */ + UINT32 attributes; /* pool attributes */ + void * pDomain; /* RTP ID or NULL for kernel */ + int ctrlNumber; /* # of ctrl structures to pre-allocate */ + PART_ID ctrlPartId; /* Mem Partition for Control structures */ + /* NULL = use Kernel partition */ + int bMemExtraSize; /* Additional memory for runtime buffers */ + PART_ID bMemPartId; /* Mem Partition for buffers */ + /* NULL = default for kernel or RTP */ + NETBUF_CL_DESC * pClDescTbl; /* desired cluster sizes and count */ + int clDescTblNumEnt; /* num of entries in cluster table */ + } NETBUF_CFG; + +/* +* NET_POOL_CFG: +* Optimized allocation and freeing for netPool and function table +*/ + +typedef struct netPoolCfg + { + NET_POOL netPool; /* netPool - Must be 1st Entry */ + POOL_FUNC funcTbl; /* Function ptr table */ + } NET_POOL_CFG, *pNET_POOL_CFG; + +/* CLTAG: +* Cluster Prefix and appended tags +* NB_BUF_SANITY - Optional buffer corruption check +* NB_BUF_USRTAG - Used by drivers to associate a cluster +* address with an Tuple. +* +*/ + +typedef struct clPreTag + { +#ifdef NB_BUF_SANITY + uint32_t tag; /* Used to validate cluster */ +#endif /* NB_BUF_SANITY */ +#ifdef NB_BUF_USRTAG + uint32_t usrTag; /* User tag */ +#endif /* NB_BUF_USRTAG */ +#ifdef NB_FULL_BKWARD_MODE + NET_POOL_ID poolId; /* Pool ID. Req for 5.5 compatibility */ +#endif /* NB_BUF_USRTAG */ + } CL_PRE_TAG; + +typedef struct clPostTag + { + uint32_t tag; /* Used to validate cluster */ + } CL_POST_TAG; + + +/* external declarations */ + +_WRS_INITTEXT +IMPORT STATUS netBufLibInit (void); +_WRS_INITTEXT +IMPORT STATUS netBufPoolInit (void); +_WRS_INITTEXT +IMPORT STATUS linkBufPoolInit (void); +IMPORT STATUS netPoolInit (NET_POOL_ID pNetPool, + M_CL_CONFIG * pMclBlkConfig, + CL_DESC * pClDescTbl, int clDescTblNumEnt, + POOL_FUNC * pFuncTbl); +IMPORT STATUS netPoolDelete (NET_POOL_ID); +IMPORT void netMblkFree (NET_POOL_ID pNetPool, M_BLK_ID pMblk); +IMPORT void netClBlkFree (NET_POOL_ID pNetPool, CL_BLK_ID pClBlk); +IMPORT void netClFree (NET_POOL_ID pNetPool, UCHAR * pClBuf); +_WRS_FASTTEXT +IMPORT M_BLK_ID netMblkClFree (M_BLK_ID pMblk); +_WRS_FASTTEXT +IMPORT void netMblkClChainFree (M_BLK_ID pMblk); +IMPORT M_BLK_ID netMblkGet (NET_POOL_ID pNetPool, int canWait, + UCHAR type); +IMPORT CL_BLK_ID netClBlkGet (NET_POOL_ID pNetPool, int canWait); +IMPORT char * netClusterGet (NET_POOL_ID pNetPool, + CL_POOL_ID pClPool); +IMPORT STATUS netMblkClGet (NET_POOL_ID pNetPool, M_BLK_ID pMblk, + int bufSize, int canWait, + BOOL noSmaller); +_WRS_FASTTEXT +IMPORT M_BLK_ID netTupleGet (NET_POOL_ID pNetPool, int bufSize, + int canWait, UCHAR type, BOOL noSmaller); + +IMPORT M_BLK_ID netTupleGet2 (NET_POOL_ID, int, int); + +IMPORT CL_BLK_ID netClBlkJoin (CL_BLK_ID pClBlk, char * pClBuf, + int size, FUNCPTR pFreeRtn, int arg1, + int arg2, int arg3); +IMPORT M_BLK_ID netMblkClJoin (M_BLK_ID pMblk, CL_BLK_ID pClBlk); +IMPORT CL_POOL_ID netClPoolIdGet (NET_POOL_ID pNetPool, int bufSize, + BOOL noSmaller); + +IMPORT int netMblkToBufCopy (M_BLK_ID pMblk, char * pBuf, + FUNCPTR pCopyRtn); +IMPORT int netMblkOffsetToBufCopy (M_BLK_ID pMblk, int offset, + char * pBuf, int len, + FUNCPTR pCopyRtn); +IMPORT M_BLK_ID netMblkDup (M_BLK_ID pSrcMblk, M_BLK_ID pDestMblk); +IMPORT M_BLK_ID netMblkChainDup (NET_POOL_ID pNetPool, M_BLK_ID pMblk, + int offset, int len, int canWait); +IMPORT UINT32 netMblkFromBufCopy(M_BLK_ID pMblk, char* pBuf, + UINT32 offset, UINT32 len, + INT32 canWait, FUNCPTR pCopyRtn); +IMPORT VOID netPoolShow (NET_POOL_ID pNetPool); +IMPORT void mbufShow (void); +IMPORT void netStackSysPoolShow (void); +IMPORT void netStackDataPoolShow (void); + +/* NetBuf enhanced functions */ +IMPORT NET_POOL_ID netPoolCreate (NETBUF_CFG * pnetBufCfg, + POOL_FUNC * pFuncTbl); +IMPORT STATUS netBufAdvLibInit (void); +IMPORT NET_POOL_ID netPoolAttach (const char * pName); +IMPORT STATUS netPoolDetach (NET_POOL_ID pNetPool); +IMPORT STATUS netPoolBind (NET_POOL_ID pNetPoolChild, + const char *pParentName); +IMPORT STATUS netPoolUnbind (NET_POOL_ID pNetPool); +IMPORT STATUS netPoolRelease (NET_POOL_ID pNetPool, + int destroyContext); +IMPORT M_BLK_ID netTupleFree (M_BLK_ID pMblk); +IMPORT int netTupleListGet (NET_POOL_ID pNetPool, + CL_POOL_ID pClPool, + int count, + int type, + M_BLK_ID * pMblk); +IMPORT STATUS netTupleListFree (M_BLK_ID); +IMPORT M_BLK_ID netTupleMigrate (NET_POOL_ID pDstNetPool, + M_BLK_ID pMblk); +IMPORT STATUS netTuplePhysAddrMap (M_BLK_ID pMblk, + BUF_VTOP * pVtopTbl, + int * pElementCount); +IMPORT NET_POOL_ID netPoolIdGet (const char * pPoolName); +IMPORT char * netPoolNameGet (NET_POOL_ID pNetPool); +IMPORT int _netMemReqDefault (int type, int num, int size); + +extern POOL_FUNC * _pNetPoolFuncTbl; +extern POOL_FUNC * _pLinkPoolFuncTbl; + +extern void (*_func_netPoolShow) (NET_POOL_ID pNetPool); + +/* + * The following routines and variables are considered private and should + * not be used outside of the netBufLib/netBufAdvLib implementation. + */ +extern STATUS netPoolCreateValidate (NET_POOL_ID pNetPool); +extern POOL_ATTR * (*_func_netAttrReg) (UINT32 attribute, PART_ID ctrlPartId, + PART_ID bMemPartId, void * pDomain); +extern STATUS (*_func_netAttrDeReg) (POOL_ATTR * pBufAttr); +extern SEM_ID netBufLock; +extern NET_POOL_ID netPoolIdGetWork (const char * pPoolName); + +/* End private routines/variables */ + +#if CPU_FAMILY==I960 +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnetBufLibh */ + diff --git a/h/wrn/coreip/netCore.h b/h/wrn/coreip/netCore.h new file mode 100644 index 0000000..200d2bb --- /dev/null +++ b/h/wrn/coreip/netCore.h @@ -0,0 +1,40 @@ +/* netCore.h - core network initialization variables */ + +/* Copyright 2001-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,22sep04,dlk Add declaration for netCoreSetup(). +01h,20sep04,spm updated virtual stack startup: removed unused storage + for packing and unpacking configuration parameters; + removed obsolete __STDC__ support for old compilers +01g,20nov03,niq Remove copyright_wrs.h file inclusion +01f,05nov03,cdw Removal of unnecessary _KERNEL guards. +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01c,15sep03,vvv updated path for new headers +01b,08sep03,vvv merged from ACCORDION_BASE6_MERGE_BASELINE +01a,12dec02,ann ported from accordion but removed virtual + stack code. +*/ + +#ifndef __netcoreh +#define __netcoreh + +#ifdef __cplusplus +extern "C" { +#endif + +STATUS netCoreSetup (UINT maxLinkHdr, UINT maxProtoHdr, + UINT numClusters, UINT maxUnits); + +#ifdef VIRTUAL_STACK +extern STATUS netCoreDestructor (VSNUM vsnum); +#endif /* VIRTUAL_STACK */ + +#ifdef __cplusplus +} +#endif + +#endif /* __netcoreh */ diff --git a/h/wrn/coreip/netDrv.h b/h/wrn/coreip/netDrv.h new file mode 100644 index 0000000..6c0daa3 --- /dev/null +++ b/h/wrn/coreip/netDrv.h @@ -0,0 +1,74 @@ +/* netDrv.h - netDrv header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,05nov03,cdw Removal of unnecessary _KERNEL guards. +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01c,10jun03,vvv include netVersion.h +01b,19jul02,ppp merging from veloce version 01m +01a,06mar02,ann ported to clarinet from AE1.1 ver 01m +*/ + +#ifndef __INCnetDrvh +#define __INCnetDrvh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* netDrv status codes */ + +#define S_netDrv_INVALID_NUMBER_OF_BYTES (M_netDrv | 1) +#define S_netDrv_SEND_ERROR (M_netDrv | 2) +#define S_netDrv_RECV_ERROR (M_netDrv | 3) +#define S_netDrv_UNKNOWN_REQUEST (M_netDrv | 4) +#define S_netDrv_BAD_SEEK (M_netDrv | 5) +#define S_netDrv_SEEK_PAST_EOF_ERROR (M_netDrv | 6) +#define S_netDrv_BAD_EOF_POSITION (M_netDrv | 7) +#define S_netDrv_SEEK_FATAL_ERROR (M_netDrv | 8) +#define S_netDrv_WRITE_ONLY_CANNOT_READ (M_netDrv | 9) +#define S_netDrv_READ_ONLY_CANNOT_WRITE (M_netDrv | 10) +#define S_netDrv_READ_ERROR (M_netDrv | 11) +#define S_netDrv_WRITE_ERROR (M_netDrv | 12) +#define S_netDrv_NO_SUCH_FILE_OR_DIR (M_netDrv | 13) +#define S_netDrv_PERMISSION_DENIED (M_netDrv | 14) +#define S_netDrv_IS_A_DIRECTORY (M_netDrv | 15) +#define S_netDrv_UNIX_FILE_ERROR (M_netDrv | 16) +#define S_netDrv_ILLEGAL_VALUE (M_netDrv | 17) + +/* flags for debuging */ + +#define NETLIB_DEBUG_OFF 0 +#define NETLIB_DEBUG_ERRORS 1 +#define NETLIB_DEBUG_ALL 2 + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS netDrvDebugLevelSet (UINT32 debugLevel); +extern STATUS netDevCreate (char *devName, char *host, int protocol); +extern STATUS netDrv (void); +extern STATUS netLsByName (char *dirName); + +#else /* __STDC__ */ + +extern STATUS netDrvDebugLevelSet (); +extern STATUS netDevCreate (); +extern STATUS netDrv (); +extern STATUS netLsByName (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnetDrvh */ diff --git a/h/wrn/coreip/netLib.h b/h/wrn/coreip/netLib.h new file mode 100644 index 0000000..e3112fa --- /dev/null +++ b/h/wrn/coreip/netLib.h @@ -0,0 +1,274 @@ +/* netLib.h - header file for the tNetTask */ + +/* Copyright 2001 - 2003, 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01o,25aug05,dlk Added section tags. +01n,08jul05,dlk Implement netJobAdd() using jobQueueLib. +01m,25nov03,wap Merge in changes for Snowflake +01l,20nov03,niq Remove copyright_wrs.h file inclusion +01k,05nov03,cdw Removal of unnecessary _KERNEL guards. +01j,04nov03,rlm Ran batch header path update for header re-org. +01i,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01h,15aug03,nee Merging from ACCORDION_BASE6_MERGE_BASELINE +01g,10jun03,vvv include netVersion.h +01f,13may03,vvv deleted TCP_MSL_CFG to avoid duplicate definitions +01e,01may03,spm Tornado 2.2 CP1 merge (from ver 01p,22jan03,wap: + TOR2_2-CP1-F label, tor2_2-patch branch, /wind/river VOB) +01d,30dec02,ann changing the value of IP_PROTO_NUM_MAX to 16 +01c,26feb02,ham renamed to netLib.h +01b,23aug01,ann correcting the references to netlibh after the rename +01a,15aug01,ann ported to clarinet from AE1.1 version 01o. +*/ + +#ifndef __INCnetLibh +#define __INCnetLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include + +#define NET_TASK_QJOB_PRI 16 + +#ifndef HIDE_NET_JOB_INFO +extern struct _JOB_QUEUE netJobInfo; /* not really, but it starts with one */ +#endif + +/* For convenience only. Using &netJobInfo avoids a dereference. */ + +extern JOB_QUEUE_ID netJobQueueId; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* ip configuration parameters */ + +typedef struct ipcfgparams + { + int ipCfgFlags; /* ip configuration flags */ + int ipDefTtl; /* ip packet default time to live */ + int ipIntrQueueLen; /* ip interrupt queue length */ + int ipFragTtl; /* ip fragment time to live */ + } IP_CFG_PARAMS; + +/* icmp configuration parameters */ + +typedef struct icmpcfgparams + { + int icmpCfgFlags; /* icmp configuration flags */ + } ICMP_CFG_PARAMS; + +/* udp configuration parameters */ + +typedef struct udpcfgparams + { + int udpCfgFlags; /* udp configuration flags */ + int udpSndSpace; /* udp send space */ + int udpRcvSpace; /* udp receive space */ + } UDP_CFG_PARAMS; + +/* tcp configuration parameters */ + +typedef struct tcpcfgparams + { + int tcpCfgFlags; /* tcp configuration flags */ + int tcpSndSpace; /* tcp send space */ + int tcpRcvSpace; /* tcp receive space */ + int tcpConnectTime; /* tcp connect time out */ + int tcpReTxThresh; /* tcp no. dup ACK to trig fast reTx */ + int tcpMssDflt; /* tcp default maximum segment size */ + int tcpRttDflt; /* tcp default RTT if no data */ + int tcpKeepIdle; /* tcp idle time before first probe */ + int tcpKeepCnt; /* tcp max probes before dropping */ + FUNCPTR pTcpRandFunc; /* tcp random function for tcp_init */ + UINT32 tcpMsl; /* tcp max segment lifetime */ + } TCP_CFG_PARAMS; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#define IP_PROTO_NUM_MAX 16 /* maximum size of protocol switch */ +#define IP6_PROTO_NUM_MAX 16 /* maximum size of protocol switch */ + +/* ip configuration defines */ +#define IP_NO_FORWARDING 0x000000000 /* no ip forwarding of pkts */ +#define IP_DO_FORWARDING 0x000000001 /* do ip forwarding of pkts */ +#define IP_DO_REDIRECT 0x000000002 /* do ip redirecting of pkts */ +#define IP_DO_LARGE_BCAST 0x000000004 /* do broadcasting pkt > MTU */ +#define IP_DO_CHECKSUM_SND 0x000000008 /* calculate ip checksum */ +#define IP_DO_CHECKSUM_RCV 0x000000010 +#define IP_DO_ARP_ON_FLAGCHG 0x000000020 /* send gratuitous ARP whenever + * interface status changes + * (up/down) instead of just + * when address is configured. + */ +#define IP_DO_IF_STATUS_CHECK 0x000000040 /* check status of interface */ + /* associated with dest addr */ + /* for incoming packet */ + +/* default ip configurations */ +#ifndef IP_FLAGS_DFLT +#define IP_FLAGS_DFLT (IP_DO_FORWARDING | IP_DO_REDIRECT | \ + IP_DO_CHECKSUM_SND | IP_DO_CHECKSUM_RCV) +#endif /* IP_FLAGS_DFLT */ + +#ifndef IP_TTL_DFLT +#define IP_TTL_DFLT 64 /* default ip queue length */ +#endif /* IP_TTL_DFLT */ + +#ifndef IP_QLEN_DFLT +#define IP_QLEN_DFLT 50 +#endif /* IP_QLEN_DFLT */ + +#ifndef IP_FRAG_TTL_DFLT +#define IP_FRAG_TTL_DFLT 60 /* 60 slow time outs, 30secs */ +#endif /* IP_FRAG_TTL_DFLT */ + +/* udp configuration defines */ +#define UDP_DO_NO_CKSUM 0x00000000 +#define UDP_DO_CKSUM_SND 0x00000001 /* do check sum on sends */ +#define UDP_DO_CKSUM_RCV 0x00000002 /* do check sum on recvs */ + +/* default udp configurations */ + +#ifndef UDP_FLAGS_DFLT +#define UDP_FLAGS_DFLT (UDP_DO_CKSUM_SND | UDP_DO_CKSUM_RCV) +#endif /* UDP_FLAGS_DFLT */ + +#ifndef UDP_SND_SIZE_DFLT +#define UDP_SND_SIZE_DFLT 9216 /* default send buffer size */ +#endif /* UDP_SND_SIZE_DFLT */ + +#ifndef UDP_RCV_SIZE_DFLT +#define UDP_RCV_SIZE_DFLT 41600 /* default recv buffer size */ +#endif /* UDP_RCV_SIZE_DFLT */ + +/* tcp configuration defines */ + +#define TCP_NO_RFC1323 0x00000000 /* tcp no RFC 1323 support */ +#define TCP_DO_RFC1323 0x00000001 /* tcp RFC 1323 support*/ + +/* default tcp configurations */ + +#ifndef TCP_FLAGS_DFLT +#define TCP_FLAGS_DFLT (TCP_DO_RFC1323) +#endif /* TCP_FLAGS_DFLT */ + +#ifndef TCP_SND_SIZE_DFLT +#define TCP_SND_SIZE_DFLT 8192 /* default send buffer size */ +#endif /* TCP_SND_SIZE_DFLT */ + +#ifndef TCP_RCV_SIZE_DFLT +#define TCP_RCV_SIZE_DFLT 8192 /* default recv buffer size */ +#endif /* TCP_RCV_SIZE_DFLT */ + +#ifndef TCP_CON_TIMEO_DFLT +#define TCP_CON_TIMEO_DFLT 150 /* 75 secs */ +#endif /* TCP_CON_TIMEO_DFLT */ + +#ifndef TCP_REXMT_THLD_DFLT +#define TCP_REXMT_THLD_DFLT 3 /* 3 times */ +#endif /* TCP_REXMT_THLD_DFLT */ + +#ifndef TCP_MSS_DFLT +#define TCP_MSS_DFLT 512 /* default max segment size */ +#endif /* TCP_MSS_DFLT */ + +#ifndef TCP_RND_TRIP_DFLT +#define TCP_RND_TRIP_DFLT 3 /* 3 secs if no data avail */ +#endif /* TCP_RND_TRIP_DFLT */ + +#ifndef TCP_IDLE_TIMEO_DFLT +#define TCP_IDLE_TIMEO_DFLT 14400 /* idle timeouts, 2 hrs */ +#endif /* TCP_IDLE_TIMEO_DFLT */ + +#ifndef TCP_MAX_PROBE_DFLT +#define TCP_MAX_PROBE_DFLT 8 /* probes before dropping */ +#endif /* TCP_MAX_PROBE_DFLT */ + +#ifndef TCP_RAND_FUNC +#define TCP_RAND_FUNC (FUNCPTR)random /* TCP random function */ +#endif /* TCP_RAND_FUNC */ + +/* icmp configuration defines */ +#define ICMP_NO_MASK_REPLY 0x000000000 /* no mask reply support */ +#define ICMP_DO_MASK_REPLY 0x000000001 /* do icmp mask reply */ + +/* default icmp configurations */ + +#ifndef ICMP_FLAGS_DFLT +#define ICMP_FLAGS_DFLT (ICMP_NO_MASK_REPLY) +#endif /* ICMP_FLAGS_DFLT */ + +extern void * netGtfTickInformation; /* read only */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS netJobAdd (FUNCPTR routine, int param1, int param2, int param3, + int param4, int param5); +extern STATUS netLibInit (void); +extern void netErrnoSet (int status); +extern void netTask (void); +extern STATUS ipLibInit (IP_CFG_PARAMS * ipCfg); +extern STATUS rawIpLibInit (void); +extern STATUS rawLibInit (void); +extern STATUS udpLibInit (UDP_CFG_PARAMS * udpCfg); +extern STATUS tcpLibInit (TCP_CFG_PARAMS * tcpCfg); +extern STATUS icmpLibInit (ICMP_CFG_PARAMS * icmpCfg); +extern STATUS igmpLibInit (void); +extern void ipFilterLibInit (void); +extern STATUS routeSockLibInit (void); +_WRS_INITTEXT +extern void splSemInit (void); +extern void mbinit (void * pNetPoolCfg); +extern void domaininit (void *); +extern STATUS netJobAlloc (u_int numJobs); +_WRS_FASTTEXT +extern void netGtfTickFunc (void * pTm, void * arg); + +#else /* __STDC__ */ + +extern STATUS netJobAdd (); +extern STATUS netLibInit (); +extern void netErrnoSet (); +extern void netTask (); +extern STATUS ipLibInit (); +extern STATUS rawIpLibInit (); +extern STATUS rawLibInit (); +extern STATUS udpLibInit (); +extern STATUS tcpLibInit (); +extern STATUS icmpLibInit (); +extern STATUS igmpLibInit (); +extern void ipFilterLibInit (); +extern STATUS routeSockLibInit (); +_WRS_INITTEXT +extern void splSemInit (); +extern void mbinit (); +extern void domaininit (); +extern STATUS netJobAlloc (); +_WRS_FASTTEXT +extern void netGtfTickFunc (); + +#endif /* __STDC__ */ + +#define netJobAdd(f, a1, a2, a3, a4, a5) \ + (jobQueueStdPost (&netJobInfo, NET_TASK_QJOB_PRI, \ + (VOIDFUNCPTR)(f), (void *)(a1), (void *)(a2), \ + (void *)(a3), (void *)(a4), (void *)(a5))) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnetLibh */ + diff --git a/h/wrn/coreip/netShow.h b/h/wrn/coreip/netShow.h new file mode 100644 index 0000000..4e18e13 --- /dev/null +++ b/h/wrn/coreip/netShow.h @@ -0,0 +1,82 @@ +/* netShow.h - header file for netShow.c */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01m,20sep04,spm changed init routine prototypes to prevent build warnings; + removed obsolete __STDC__ support for old compilers +01l,19sep04,spm updated virtual stack startup and shutdown for TCP and UDP + show routines: restored use of published initialization + routines and removed unused destructors +01k,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01j,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01i,05nov03,cdw Removal of unnecessary _KERNEL guards. +01h,04nov03,rlm Ran batch header path update for header re-org. +01g,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01f,08sep03,vvv merged from ACCORDION_BASE6_MERGE_BASELINE +01e,10jun03,vvv include netVersion.h +01d,08apr03,ann moved netBufShow prototypes to netBufLib.h and + moved some definitions from netShow.c to here. SPR# 86899 +01c,18jan02,ppp adding INET6 protection to a routine +01b,09jan02,ppp adding support for ipv6 +01a,08dec01,ppp porting from A.E. 1.1 +*/ + +#ifndef __INCnetShowh +#define __INCnetShowh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* externs */ + +/* function declarations */ + +extern void arptabShow (void); +extern void arpShow (void); +extern void icmpstatShow (void); + +#ifdef INET6 +extern void icmp6statShow (void); +#endif + +extern void ifShow (char *ifName); +extern void inetstatShow (void); + +#ifdef INET6 +extern void inet6statShow (void); +#endif + +extern void ipstatShow (BOOL zero); + +#ifdef INET6 +extern void ip6statShow (BOOL zero); +#endif + +extern void netShowInit (void); +extern void netVersionShow (void); + +extern void igmpShowInit (void); +extern void icmpShowInit (void); +extern STATUS tcpShowInit (void); +extern void tcpstatShow (void); +extern STATUS udpShowInit (void); +extern void udpstatShow (void); +extern void routeShow (void); +extern void hostShow (void); +extern void routestatShow (void); +extern void routeShowInit (void); +extern void ifShowInit (void); +extern void hostShowInit (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnetShowh */ diff --git a/h/wrn/coreip/netVersion.h b/h/wrn/coreip/netVersion.h new file mode 100644 index 0000000..024b98c --- /dev/null +++ b/h/wrn/coreip/netVersion.h @@ -0,0 +1,40 @@ +/* netVersion.h - Network stack version information */ + +/* Copyright 2003 - 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,13jul05,vvv updated version to 3.0 +01e,24jun05,vvv updated version to 2.2 +01d,07apr05,vvv updated version +01c,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01b,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/IPV6_alameda/base6_itn5_networking-int/1) +01a,11jun03,vvv written +*/ + +#ifndef __INCnetVersionh +#define __INCnetVersionh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +#define STACK_NAME_V4 1 /* Classic IPv4 only stack */ +#define STACK_NAME_V4_V6 2 /* Dual IPv4, IPv6 stack */ + +#define STACK_NAME STACK_NAME_V4_V6 + +#define STACK_VERSION_MAJOR 3 +#define STACK_VERSION_MINOR 0 +#define STACK_VERSION_PATCH 0 +#define STACK_VERSION_PATCH_MINOR 0 + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnetVersionh */ diff --git a/h/wrn/coreip/netconf.h b/h/wrn/coreip/netconf.h new file mode 100644 index 0000000..50ef563 --- /dev/null +++ b/h/wrn/coreip/netconf.h @@ -0,0 +1,66 @@ +/* netconf.h - network component configuration file */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +01s,25feb05,niq merge from niqbal.tor3.mroute for IP router alert changes +01r,21jan05,sar Removal of divert, dummynet and fw code. +01q,20nov03,niq Remove copyright_wrs.h file inclusion +01p,06aug03,nee Accordion Base6 merge from ACCORDION_BASE6_MERGE_BASELINE + label +01o,29apr03,syy Added #ifdef for __cplusplus +01n,26feb03,vvv added RSVP definition to control inclusion of RSVP code +01m,16jan03,ann created a definition for IP flow and changed the way DUMMYNET + is defined +01l,10feb03,vvv removed INET6 definition +01k,25jul02,pas added TINY_LOMTU +01j,25feb02,nee setting COMPAT_RFC2292 +01i,01oct01,ppp linking in ipsec +01h,21sep01,pas added TCPDEBUG +01g,18sep01,ham reversed the mod 01f. +01f,18sep01,ham diabled INET6 temporary for build party. +01e,06sep01,ppp Removing the defination for INET , it is defines in vxWorks.h +01d,06sep01,qli adding more defintions +01c,28aug01,ppp adding two more definations for in_proto.c +01b,27aug01,ppp Adding a defination for ICMP +01a,23aug01,ppp Removed the definition of INET +*/ + +#ifndef _NETCONF_H_ +#define _NETCONF_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define COMPAT_RFC2292 1 +#define MROUTING 0 +#define MROUTE_LKM 0 + +#if 0 /* Clarinet */ +#define IPSEC 1 +#endif /* Clarinet */ + +#define ICMP_BANDLIM 1 + +#define TCPDEBUG 1 + +#undef IPFLOW /* IP Flow undefined by default */ + +#define TINY_LOMTU + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/netdb.h b/h/wrn/coreip/netdb.h new file mode 100644 index 0000000..26fc3d3 --- /dev/null +++ b/h/wrn/coreip/netdb.h @@ -0,0 +1,234 @@ +/* netdb.h - server entries and the like for routed/rip */ + +/* Copyright 1996-2005 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1980, 1983, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)netdb.h 8.1 (Berkeley) 6/2/93 + * From: Id: netdb.h,v 8.9 1996/11/19 08:39:29 vixie Exp $ + * $FreeBSD: src/include/netdb.h,v 1.14.2.5 2001/08/29 08:46:51 alfred Exp $ + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * --Copyright-- + */ + +/* +modification history +-------------------- +01p,06jul05,vvv fixed build errors +01o,29jun05,vvv added getaddrinfo(), getnameinfo(), freeaddrinfo() and + gai_strerror() for RFC3493 +01n,28jun05,vvv restored v4mapped +01m,13may05,vvv merged from kame-20050404-freebsd411 +01l,20nov03,niq Remove copyright_wrs.h file inclusion +01k,05nov03,cdw Removal of unnecessary _KERNEL guards. +01j,04nov03,rlm Ran batch header path update for header re-org. +01i,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01h,06aug03,nee Accordion Base6 merge from ACCORDION_BASE6_MERGE_BASELINE + label +01g,10jun03,vvv include netVersion.h +01f,12dec01,hgo add support of flag AI_V4MAPPED for getaddrinfo() +01e,20sep01,hgo extensions for IPv6 support +01d,19aug97,jag Added the field h_ttl to the structure hostent. +01c,29apr97,jag fixed include define and added C++ linkage. Changed field + names of struc netnet to avoid conflict with i960 macros. +01b,24feb97,jag changed comment. +01a,26nov96,gnn created from BSD4.4 routed +*/ + +#ifndef __INCnetdbh +#define __INCnetdbh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include /* for socklen_t */ + + +/* + * Structures returned by network data base library. All addresses are + * supplied in host order, and returned in network order (suitable for + * use in system calls). + */ +struct hostent { + char *h_name; /* official name of host */ + char **h_aliases; /* alias list */ + int h_addrtype; /* host address type */ + int h_length; /* length of address */ + char **h_addr_list; /* list of addresses from name server */ +#define h_addr h_addr_list[0] /* address, for backward compatiblity */ + unsigned int h_ttl; /* Time to Live in Seconds for this entry */ +}; + +/* + * Assumption here is that a network number + * fits in an unsigned long -- probably a poor one. + */ +struct netent { + char * nName; /* official name of net */ + char ** nAliases; /* alias list */ + int nAddrtype; /* net address type */ + unsigned long nNet; /* network # */ +}; + +struct servent { + char *s_name; /* official service name */ + char **s_aliases; /* alias list */ + int s_port; /* port # */ + char *s_proto; /* protocol to use */ +}; + +struct protoent { + char *p_name; /* official protocol name */ + char **p_aliases; /* alias list */ + int p_proto; /* protocol # */ +}; + +struct addrinfo + { + int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */ + int ai_family; /* PF_xxx */ + int ai_socktype; /* SOCK_xxx */ + int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ + size_t ai_addrlen; /* length of ai_addr */ + char *ai_canonname; /* canonical name for hostname */ + struct sockaddr *ai_addr; /* binary address */ + struct addrinfo *ai_next; /* next structure in linked list */ + }; + +/* + * Error return codes from getaddrinfo() + */ +/* #define EAI_ADDRFAMILY 1 (obsoleted) */ +#define EAI_AGAIN 2 /* temporary failure in name resolution */ +#define EAI_BADFLAGS 3 /* invalid value for ai_flags */ +#define EAI_FAIL 4 /* non-recoverable failure in name resolution */ +#define EAI_FAMILY 5 /* ai_family not supported */ +#define EAI_MEMORY 6 /* memory allocation failure */ +/* #define EAI_NODATA 7 (obsoleted) */ +#define EAI_NONAME 8 /* hostname nor servname provided, or not known */ +#define EAI_SERVICE 9 /* servname not supported for ai_socktype */ +#define EAI_SOCKTYPE 10 /* ai_socktype not supported */ +#define EAI_SYSTEM 11 /* system error returned in errno */ +#define EAI_BADHINTS 12 /* Invalid value for hints */ +#define EAI_PROTOCOL 13 /* Resolved protocol is unknown */ +#define EAI_OVERFLOW 14 /* Argument buffer overflow */ +#define EAI_MAX 15 + +/* + * Flag values for getaddrinfo() + */ +#define AI_PASSIVE 0x00000001 /* get address to use bind() */ +#define AI_CANONNAME 0x00000002 /* fill ai_canonname */ +#define AI_NUMERICHOST 0x00000004 /* prevent name resolution */ +#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */ +#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */ +#define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */ + +/* valid flags for getaddrinfo (not a standard def, apps should not use it) */ + +#define AI_MASK \ + (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | \ + AI_ADDRCONFIG | AI_ALL | AI_V4MAPPED_CFG | AI_V4MAPPED) + +#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */ +#define AI_NUMERICSERV 0x00001000 /* prevent service resolution */ + +/* special recommended flags for getipnodebyname */ +#define AI_DEFAULT AI_V4MAPPED_CFG | AI_ADDRCONFIG + +/* + * Constants for getnameinfo() + */ +#define NI_MAXHOST 1025 +#define NI_MAXSERV 32 + +/* + * Flag values for getnameinfo() + */ +#define NI_NOFQDN 0x00000001 +#define NI_NUMERICHOST 0x00000002 +#define NI_NAMEREQD 0x00000004 +#define NI_NUMERICSERV 0x00000008 +#define NI_DGRAM 0x00000010 +#if 0 /* obsolete */ +#define NI_WITHSCOPEID 0x00000020 +#endif +#define NI_NUMERICSCOPE 0x00000040 + +/* + * Scope delimit character + */ +#define SCOPE_DELIMITER '%' + +/* + * Error return codes from res_query.c + */ + +#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ +#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ +#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ +#define NO_DATA 4 /* Valid name, no data record of requested type */ +#define NO_ADDRESS NO_DATA /* no address, look for MX record */ + +extern int getnameinfo (const struct sockaddr *sa, socklen_t salen, char *host, + size_t hostlen, char *serv, size_t servlen, int flags); +extern int getaddrinfo (const char *hostname, const char *servname, + const struct addrinfo *hints, struct addrinfo **result); +extern void freeaddrinfo (struct addrinfo * ai); +extern char * gai_strerror (int ecode); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnetdbh */ diff --git a/h/wrn/coreip/netffs.h b/h/wrn/coreip/netffs.h new file mode 100644 index 0000000..767d4b8 --- /dev/null +++ b/h/wrn/coreip/netffs.h @@ -0,0 +1,193 @@ +/* netffs.h - structures for netffs.c */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +01a,09aug05 niq created. +*/ + +#ifndef __INCnetffsh +#define __INCnetffsh + +#ifdef __cplusplus +extern "C" { +#endif + +extern int ffsMsb (int); /* XXX - should be in a header! */ + +/* + * We want the fastest possible 'ffsMsb() - 1' for each architecture, + * ideally inlined assembly. + * Eventually, this stuff should be moved to architecture-specific + * headers. + */ + +#if !defined (__GNUC__) && !defined (_DIAB_TOOL) +#define USE_FFSMSB_PORTABLE +#endif + +#if defined (USE_FFSMSB_PORTABLE) + +#define FFS(x) (ffsMsb(x) - 1) + +#else /* !defined (USE_FFSMSB_PORTABLE) */ + +#if (CPU_FAMILY == I80X86) + +#define FFS(x) _firstBit(x) + +#if defined (__GNUC__) + +/* + * Return the index of the most significant bit on in x. + * We don't have to handle the x=0 case, this is only called + * when x != 0. Returns a value y in the range 31 >= y >= 0. + * 31 indicates the most significant bit. + */ + +static __inline__ UINT32 _firstBit + ( + UINT32 x + ) + { + UINT32 y; + + __asm__ ("bsrl %1, %0" + : "=r" (y) + : "r" (x) + : "cc"); + + return y; + } + +#else /* _DIAB_TOOL */ + +/* SPR #110427 is now fixed, restore inline assembly for I80X806/diab */ +#pragma pure_function _firstBit + +__asm UINT32 _firstBit + ( + UINT32 x + ) +{ +% mem x +! "ax" + bsrl x, %eax +} + +#endif /* _DIAB_TOOL */ + +#elif (CPU_FAMILY == PPC) + +#define FFS(x) (31 - _countLeadingZeroes(x)) + +#if defined (__GNUC__) + +/* + * Return the number of zero bits in bit positions more significant + * than the first set bit. + * We don't have to handle the x=0 case, this is only called + * when x != 0. Returns a value y in the range 31 >= y >= 0. + * 0 indicates the most significant bit. + */ + +static __inline__ UINT32 _countLeadingZeroes + ( + UINT32 x + ) + { + UINT32 y; + + __asm__ ("cntlzw %0, %1" + : "=r" (y) + : "r" (x) + ); + + return y; + } +#else /* _DIAB_TOOL */ + +#pragma pure_function _countLeadingZeroes + +__asm UINT32 _countLeadingZeroes + ( + UINT32 x + ) +{ +% reg x +! "r3" + cntlzw r3, x +} + +#endif /* _DIAB_TOOL */ + +#elif ((CPU == XSCALE) || (CPU == ARMARCH5) || (CPU == ARMARCH6)) + +#define FFS(x) (31 - _countLeadingZeroes(x)) + +#if defined (__GNUC__) + +/* + * Return the number of zero bits in bit positions more significant + * than the first set bit. + * We don't have to handle the x=0 case, this is only called + * when x != 0. Returns a value y in the range 31 >= y >= 0. + * 0 indicates the most significant bit. + */ + +static __inline__ UINT32 _countLeadingZeroes + ( + UINT32 x + ) + { + UINT32 y; + + __asm__ ("clz %0, %1" + : "=r" (y) + : "r" (x) + ); + + return y; + } +#elif defined (_DIAB_TOOL) + +#pragma pure_function _countLeadingZeroes + +__asm UINT32 _countLeadingZeroes + ( + UINT32 x + ) +{ +% reg x +! "r0" + clz r0, x +} + +#else /* !_DIAB_TOOL */ +#error Unsupported compiler. +#endif /* _DIAB_TOOL */ + +#else /* unknown or unsupported CPU_FAMILY */ + +#define FFS(x) (ffsMsb(x) - 1) + +#endif /* CPU / CPU_FAMILY */ + +#endif /* !defined (USE_FFSMSB_PORTABLE) */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnetffsh */ diff --git a/h/wrn/coreip/netinet/icmp6.h b/h/wrn/coreip/netinet/icmp6.h new file mode 100644 index 0000000..d54e070 --- /dev/null +++ b/h/wrn/coreip/netinet/icmp6.h @@ -0,0 +1,28 @@ +/* icmp6.h - ICMPv6 header file */ + +/* + * Copyright (c) -2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01a,29jun05,vvv written +*/ + +#ifndef __INCicmp6h +#define __INCicmp6h + +/* + * This file has been created to satisfy the requirement in RFC3542 that + * icmp6.h should be in netinet. The copy in netinet6 is retained for + * backward-compatbility. + */ + +#include + +#endif /* not __INCicmp6h */ diff --git a/h/wrn/coreip/netinet/icmp_var.h b/h/wrn/coreip/netinet/icmp_var.h new file mode 100644 index 0000000..bf1c5e1 --- /dev/null +++ b/h/wrn/coreip/netinet/icmp_var.h @@ -0,0 +1,128 @@ +/* icmp_var.h - internet control message protocol variable header file */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)icmp_var.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/icmp_var.h,v 1.15.2.2 2001/12/07 09:23:11 ru Exp $ + */ + +/* +modification history +-------------------- +01k,07feb05,vvv _KERNEL cleanup +01j,31jan05,niq virtual stack changes for sysctl +01i,20nov03,niq Remove copyright_wrs.h file inclusion +01h,05nov03,cdw Removal of unnecessary _KERNEL guards. +01g,04nov03,rlm Ran batch header path update for header re-org. +01f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01e,10jun03,vvv include netVersion.h +01d,01feb03,pas merge from FreeBSD 4.7 - added badaddr, noroute stats +01c,10sep02,hsh add c++ protection +01b,03dec01,niq Sysctl changes for Clarinet +01a,22aug01,ppp Created from FreeBSD 4.3 +*/ + + +#ifndef _NETINET_ICMP_VAR_H_ +#define _NETINET_ICMP_VAR_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * Variables related to this implementation + * of the internet control message protocol. + */ +struct icmpstat { +/* statistics related to icmp packets generated */ + u_long icps_error; /* # of calls to icmp_error */ + u_long icps_oldshort; /* no error 'cuz old ip too short */ + u_long icps_oldicmp; /* no error 'cuz old was icmp */ + u_long icps_outhist[ICMP_MAXTYPE + 1]; +/* statistics related to input messages processed */ + u_long icps_badcode; /* icmp_code out of range */ + u_long icps_tooshort; /* packet < ICMP_MINLEN */ + u_long icps_checksum; /* bad checksum */ + u_long icps_badlen; /* calculated bound mismatch */ + u_long icps_reflect; /* number of responses */ + u_long icps_inhist[ICMP_MAXTYPE + 1]; + u_long icps_bmcastecho; /* b/mcast echo requests dropped */ + u_long icps_bmcasttstamp; /* b/mcast tstamp requests dropped */ + u_long icps_badaddr; /* bad return address */ + u_long icps_noroute; /* no route back */ +}; + +/* + * Names for ICMP sysctl objects + */ +#define ICMPCTL_MASKREPL 1 /* allow replies to netmask requests */ +#define ICMPCTL_STATS 2 /* statistics (read-only) */ +#define ICMPCTL_ICMPLIM 3 +#define ICMPCTL_MAXID 4 + +#define ICMPCTL_NAMES { \ + { 0, 0 }, \ + { "maskrepl", CTLTYPE_INT }, \ + { "stats", CTLTYPE_STRUCT }, \ + { "icmplim", CTLTYPE_INT }, \ +} + +#ifdef _WRS_KERNEL +#include +#ifndef VIRTUAL_STACK +SYSCTL_DECL_NODE_EXT(icmp); +#endif /* VIRTUAL_STACK */ + +#ifdef ICMP_BANDLIM +extern int badport_bandlim __P((int)); +#endif +#define BANDLIM_UNLIMITED -1 +#define BANDLIM_ICMP_UNREACH 0 +#define BANDLIM_ICMP_ECHO 1 +#define BANDLIM_ICMP_TSTAMP 2 +#define BANDLIM_RST_CLOSEDPORT 3 /* No connection, and no listeners */ +#define BANDLIM_RST_OPENPORT 4 /* No connection, listener */ +#define BANDLIM_MAX 4 + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/netinet/if_ether.h b/h/wrn/coreip/netinet/if_ether.h new file mode 100644 index 0000000..32d2507 --- /dev/null +++ b/h/wrn/coreip/netinet/if_ether.h @@ -0,0 +1,237 @@ +/* if_ether.h - network interface Ethernet header file */ + +/* Copyright 2001 - 2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if_ether.h 8.3 (Berkeley) 5/2/95 + * $FreeBSD: src/sys/netinet/if_ether.h,v 1.24.2.1 2002/02/13 21:38:56 fjoe Exp $ + */ + +/* +modification history +-------------------- +01y,23feb05,vvv restored ether_tag_header definition for + backward-compatibility (SPR #102773) +01x,18feb05,wap Allow sysctl init routines to be scaled out +01w,08feb05,vvv _KERNEL cleanup +01v,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01u,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/2) +01t,24feb04,nee Adding the prototype for ipEtherResolvRtn +01s,20nov03,niq Remove copyright_wrs.h file inclusion +01r,04nov03,rlm Ran batch header path update for header re-org. +01q,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01p,23oct03,rlm updated #includes for header re-org +01o,15sep03,vvv updated path for new headers +01n,13aug03,niq Fix definition of la_rt (Part of Accordion Base6 merge) +01m,15may03,spm Tornado 2.2 FCS merge (SPR #63006; ver 01h,24may02,vvv: + TOR2_2-FCS-COPY label, tor2 branch, /wind/river VOB) +01l,09may03,vvv changed include order to fix build +01k,01may03,spm Tornado 2.2 CP1 merge (from ver 01i,13jan03,rae: + TOR2_2-CP1-F label, tor2_2-patch branch, /wind/river VOB) +01j,01feb03,pas merge from FreeBSD 4.7 - changed arp_rtrequest(), + arp_ifinit() calls +01i,09sep02,hsh add c++ protection +01h,13feb02,ham changed for tornado build +01g,09dec01,ppp adding llinfo_arp structure +01f,03oct01,ann commenting the prototype for arpintr +01e,17sep01,ppp Commenting out the static declaration of in_arpinput +01d,10sep01,ann adding some macros that could be helpful +01c,24aug01,ann moving the forward declaration of arpintr here from + if_ether.c +01b,14aug01,ppp Commenting out two definations. +01a,01aug01,ppp Created from FreeBSD 4.3 +*/ + +#ifndef _NETINET_IF_ETHER_H_ +#define _NETINET_IF_ETHER_H_ + + +#include +#include +#include +#include +#include + +#ifdef __cplusplus + extern "C" { +#endif + +typedef struct arp_config_params { + CFG_DATA_HDR cfgh; + int cfg_priv_arpt_prune; + int cfg_priv_arpt_keep; + int cfg_priv_arpt_down; + int cfg_priv_arpMaxEntries; + int cfg_priv_arp_maxtries; + int cfg_priv_useloopback; + int cfg_priv_arp_proxyall; + int cfg_priv_log_arp_wrong_iface; + FUNCPTR cfg_privInitSysctl; + int cfg_arp_gratuituous; +} ARP_CONFIG_PARAMS; + +/* Ether header for tagged frames */ + +struct ether_tag_header + { + u_char ether_dhost [6]; + u_char ether_shost [6]; + u_char etherTag [4]; + u_short ether_type; + }; + +/* + * Clarinet + * The following macros are required as they are used in all the + * driver header files which include if_ether.h + */ + +/* + * for compilers that have 4-bytes structure alignment rule, + * it is understood that sizeof (ether_header) is 0x10 + */ +#define SIZEOF_ETHERHEADER 0xe + + /* For tagged Ethernet headers */ +#define SIZEOF_TAG_ETHERHEADER 0x12 + + /* minimal size of an ethernet frame including the headers supported + * by most ethernet chips. + */ +#define ETHERSMALL 60 + +/* End of Clarinet introduced macros */ + +/* + * Macro to map an IP multicast address to an Ethernet multicast address. + * The high-order 25 bits of the Ethernet address are statically assigned, + * and the low-order 23 bits are taken from the low end of the IP address. + */ +#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \ + /* struct in_addr *ipaddr; */ \ + /* u_char enaddr[ETHER_ADDR_LEN]; */ \ +{ \ + (enaddr)[0] = 0x01; \ + (enaddr)[1] = 0x00; \ + (enaddr)[2] = 0x5e; \ + (enaddr)[3] = ((u_char *)ipaddr)[1] & 0x7f; \ + (enaddr)[4] = ((u_char *)ipaddr)[2]; \ + (enaddr)[5] = ((u_char *)ipaddr)[3]; \ +} +/* + * Macro to map an IP6 multicast address to an Ethernet multicast address. + * The high-order 16 bits of the Ethernet address are statically assigned, + * and the low-order 32 bits are taken from the low end of the IP6 address. + */ +#define ETHER_MAP_IPV6_MULTICAST(ip6addr, enaddr) \ +/* struct in6_addr *ip6addr; */ \ +/* u_char enaddr[ETHER_ADDR_LEN]; */ \ +{ \ + (enaddr)[0] = 0x33; \ + (enaddr)[1] = 0x33; \ + (enaddr)[2] = ((u_char *)ip6addr)[12]; \ + (enaddr)[3] = ((u_char *)ip6addr)[13]; \ + (enaddr)[4] = ((u_char *)ip6addr)[14]; \ + (enaddr)[5] = ((u_char *)ip6addr)[15]; \ +} + + #define ETHER_MULTICAST(enaddr) \ + ((enaddr)[0] == 0x1) && ((enaddr)[1] == 0x0) && ((enaddr)[2] == 0x5e) + + +/* + * Ethernet Address Resolution Protocol. + * + * See RFC 826 for protocol description. Structure below is adapted + * to resolving internet addresses. Field names used correspond to + * RFC 826. + */ +struct ether_arp { + struct arphdr ea_hdr; /* fixed-size header */ + u_char arp_sha[ETHER_ADDR_LEN]; /* sender hardware address */ + u_char arp_spa[4]; /* sender protocol address */ + u_char arp_tha[ETHER_ADDR_LEN]; /* target hardware address */ + u_char arp_tpa[4]; /* target protocol address */ +}; +#define arp_hrd ea_hdr.ar_hrd +#define arp_pro ea_hdr.ar_pro +#define arp_hln ea_hdr.ar_hln +#define arp_pln ea_hdr.ar_pln +#define arp_op ea_hdr.ar_op + +struct sockaddr_inarp { + u_char sin_len; + u_char sin_family; + u_short sin_port; + struct in_addr sin_addr; + struct in_addr sin_srcaddr; + u_short sin_tos; + u_short sin_other; +#define SIN_PROXY 1 +}; + + +struct llinfo_arp { + LIST_ENTRY(llinfo_arp) la_le; + struct rtentry *la_rt; + struct mbuf *la_hold; /* last packet until resolved/timeout */ + long la_asked; /* last time we QUERIED for this addr */ +}; + + +/* + * IP and ethernet specific routing flags + */ +#define RTF_USETRAILERS RTF_PROTO1 /* use trailers */ +#define RTF_ANNOUNCE RTF_PROTO2 /* announce new arp entry */ + +#ifdef _WRS_KERNEL +extern u_char ether_ipmulticast_min[ETHER_ADDR_LEN]; +extern u_char ether_ipmulticast_max[ETHER_ADDR_LEN]; +extern struct ifqueue arpintrq; + +int arpresolve __P((struct ifnet *, struct rtentry *, struct mbuf *, + struct sockaddr *, u_char *, struct rtentry *)); +int ipEtherResolvRtn __P((struct ifnet *, struct rtentry *, struct mbuf *, + struct sockaddr *, char *, struct rtentry *, FUNCPTR)); + +void arp_ifinit __P((struct ifnet *, struct ifaddr *)); +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* _NETINET_IF_ETHER_H_ */ diff --git a/h/wrn/coreip/netinet/igmp.h b/h/wrn/coreip/netinet/igmp.h new file mode 100644 index 0000000..6f89166 --- /dev/null +++ b/h/wrn/coreip/netinet/igmp.h @@ -0,0 +1,200 @@ +/* igmp.h - igmp header file */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1988 Stephen Deering. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Stephen Deering of Stanford University. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)igmp.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/igmp.h,v 1.10 1999/08/28 00:49:15 peter Exp $ + */ + +/* +modification history +-------------------- +01h,29jun05,spm updated for IGMPv3 support +01g,20nov03,niq Remove copyright_wrs.h file inclusion +01f,05nov03,cdw Removal of unnecessary _KERNEL guards. +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01c,10jun03,vvv include netVersion.h +01b,10sep02,hsh add c++ protection +01a,27aug01,hsh Created from BSD 4.3 +*/ + +#ifndef _NETINET_IGMP_H_ +#define _NETINET_IGMP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * Internet Group Management Protocol (IGMP) definitions. + * + * Written by Steve Deering, Stanford, May 1988. + * + * MULTICAST Revision: 3.5.1.2 + */ + +/* + * IGMPv1/v2 packet and v3 Query packet format. + */ +struct igmp { + u_char igmp_type; /* version & type of IGMP message */ + u_char igmp_code; /* subtype for routing msgs */ + +#define IGMP_EXP(x) (((x) >> 4) & 0x07) +#define IGMP_MANT(x) ((x) & 0x0f) + u_int16_t igmp_cksum; /* IP-style checksum */ + struct in_addr igmp_group; /* group address being specified */ + /* (zero for general query) */ + u_int8_t igmp_rtval; /* Reserved, S Flag and QRV */ +#define IGMP_QRESV(x) (((x) >> 4) & 0x0f) +#define IGMP_SFLAG(x) (((x) >> 3) & 0x01) +#define IGMP_QRV(x) ((x) & 0x07) /* querier's robustness variable */ + u_int8_t igmp_qqi; /* querier's query interval (QQI) */ + u_int16_t igmp_numsrc; /* number of sources (zero for general*/ + /* and group-specific queries) */ + struct in_addr src[1]; /* source address list */ +} __attribute__((__packed__)); + +/* + * IGMPv3 Membership Report Message header. + */ +struct igmp_report_hdr { + u_int8_t igmp_type; /* version & type of IGMP message */ + u_int8_t igmp_reserved1; /* reserved (set to zero) */ + u_int16_t igmp_cksum; /* IP-style checksum */ + u_int16_t igmp_reserved2; /* reserved (set to zero) */ + u_int16_t igmp_grpnum; /* number of group record */ +} __attribute__((__packed__)); + +/* + * IGMPv3 Group Record header. + */ +struct igmp_group_record_hdr { + u_int8_t record_type; /* record types for membership report */ + u_int8_t auxlen; /* aux data length (must be zero) */ + u_int16_t numsrc; /* number of sources */ + struct in_addr group; /* group address */ + struct in_addr src[1]; /* source address list */ +} __attribute__((__packed__)); + +#define IGMP_MINLEN 8 + +/* + * Message types, including version number. + */ +#define IGMP_MEMBERSHIP_QUERY 0x11 /* membership query */ +#define IGMP_V1_MEMBERSHIP_REPORT 0x12 /* Ver. 1 membership report */ +#define IGMP_V2_MEMBERSHIP_REPORT 0x16 /* Ver. 2 membership report */ +#define IGMP_V2_LEAVE_GROUP 0x17 /* Leave-group message */ + +#define IGMP_DVMRP 0x13 /* DVMRP routing message */ +#define IGMP_PIM 0x14 /* PIM routing message */ + +#define IGMP_MTRACE_RESP 0x1e /* traceroute resp.(to sender)*/ +#define IGMP_MTRACE 0x1f /* mcast traceroute messages */ + +#define IGMP_MAX_HOST_REPORT_DELAY 10 /* max delay for response to */ + /* query (in seconds) according */ + /* to RFC1112 */ + + +#define IGMP_TIMER_SCALE 10 /* denotes that the igmp code field */ + /* specifies time in 10th of seconds*/ + +/* + * The following four defininitions are for backwards compatibility. + * They should be removed as soon as all applications are updated to + * use the new constant names. + */ +#define IGMP_HOST_MEMBERSHIP_QUERY IGMP_MEMBERSHIP_QUERY +#define IGMP_HOST_MEMBERSHIP_REPORT IGMP_V1_MEMBERSHIP_REPORT +#define IGMP_HOST_NEW_MEMBERSHIP_REPORT IGMP_V2_MEMBERSHIP_REPORT +#define IGMP_HOST_LEAVE_MESSAGE IGMP_V2_LEAVE_GROUP + +#ifdef __cplusplus +} +#endif + +#define IGMP_v3_HOST_MEMBERSHIP_REPORT 0x22 /* v3 membership report */ + +#define IGMP_v3_GENERAL_QUERY 1 +#define IGMP_v3_GROUP_QUERY 2 +#define IGMP_v3_GROUP_SOURCE_QUERY 3 +#define IGMP_v3_QUERY_MINLEN 12 + +/* + * States for the IGMP state table. + */ +#define IGMP_DELAYING_MEMBER 1 +#define IGMP_IDLE_MEMBER 2 +#define IGMP_LAZY_MEMBER 3 +#define IGMP_SLEEPING_MEMBER 4 +#define IGMP_AWAKENING_MEMBER 5 +#define IGMP_QUERY_PENDING_MEMBER 6 /* pending General Query */ +#define IGMP_G_QUERY_PENDING_MEMBER 7 /* pending Grp-specific Query */ +#define IGMP_SG_QUERY_PENDING_MEMBER 8 /* pending Grp-Src-specific Q.*/ + +/* + * Group Record Types in the IGMP Membership Report + */ +#define MODE_IS_INCLUDE 1 +#define MODE_IS_EXCLUDE 2 +#define CHANGE_TO_INCLUDE_MODE 3 +#define CHANGE_TO_EXCLUDE_MODE 4 +#define ALLOW_NEW_SOURCES 5 +#define BLOCK_OLD_SOURCES 6 + +/* + * States for IGMP router version cache. + */ +#define IGMP_v1_ROUTER 1 +#define IGMP_v2_ROUTER 2 +#define IGMP_v3_ROUTER 3 + +/* + * IGMP Query version + */ +#define IGMP_v1_QUERY IGMP_v1_ROUTER +#define IGMP_v2_QUERY IGMP_v2_ROUTER +#define IGMP_v3_QUERY IGMP_v3_ROUTER + +#endif /* _NETINET_IGMP_H_ */ diff --git a/h/wrn/coreip/netinet/igmp_var.h b/h/wrn/coreip/netinet/igmp_var.h new file mode 100644 index 0000000..b5d0f40 --- /dev/null +++ b/h/wrn/coreip/netinet/igmp_var.h @@ -0,0 +1,212 @@ +/* igmp_var.h - igmp header file */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* + * Copyright (c) 1988 Stephen Deering. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Stephen Deering of Stanford University. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)igmp_var.h 8.1 (Berkeley) 7/19/93 + * $FreeBSD: src/sys/netinet/igmp_var.h,v 1.17 1999/12/29 04:40:59 peter Exp $ + */ + +/* +modification history +-------------------- +01r,11oct05,niq Fix bug in passing mblk (SPR: 113559) +01q,07oct05,vvv protected in_msf.h include for GPP build +01p,29jun05,spm updated for IGMPv3 support +01o,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +01n,07feb05,vvv _KERNEL cleanup +01m,31jan05,niq virtual stack changes for sysctl +01l,18jan05,vvv osdep.h cleanup +01k,23nov03,rp updated path for random.h +01j,20nov03,niq Remove copyright_wrs.h file inclusion +01i,05nov03,cdw Removal of unnecessary _KERNEL guards. +01h,04nov03,rlm Ran batch header path update for header re-org. +01g,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01f,23oct03,rlm updated #includes for header re-org +01e,10jun03,vvv include netVersion.h +01d,10sep02,hsh add c++ protection +01c,03dec01,niq Sysctl changes for Clarinet +01b,08oct01,pas include random.h +01a,27aug01,hsh Created from BSD 4.3 +*/ + +#ifndef _NETINET_IGMP_VAR_H_ +#define _NETINET_IGMP_VAR_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* + * Internet Group Management Protocol (IGMP), + * implementation-specific definitions. + * + * Written by Steve Deering, Stanford, May 1988. + * + * MULTICAST Revision: 3.5.1.3 + */ + +#include + +#if (defined (IGMPV3) || defined (MLDV2)) +#include +#endif + +struct igmpstat { + u_int igps_rcv_total; /* total IGMP messages received */ + u_int igps_rcv_tooshort; /* received with too few bytes */ + u_int igps_rcv_toolong; /* received messages over MTU size */ + u_int igps_rcv_badsum; /* received with bad checksum */ + u_int igps_rcv_badttl; /* received with bad TTL */ + u_int igps_rcv_nora; /* received with no Router Alert */ + u_int igps_rcv_v1_queries; /* received v1 membership queries */ + u_int igps_rcv_v2_queries; /* received v2 membership queries */ + u_int igps_rcv_v3_queries; /* received v3 membership queries */ + u_int igps_rcv_badqueries; /* received invalid queries */ + u_int igps_rcv_query_fails; /* receiving membership query fails */ + u_int igps_rcv_reports; /* received v1/v2 membership reports */ + u_int igps_rcv_badreports; /* received invalid v1/v2 reports */ + u_int igps_rcv_ourreports; /* received v1/v2 reports for our groups */ + u_int igps_snd_v1v2_reports; /* sent v1/v2 membership reports */ + u_int igps_snd_v3_reports; /* sent v3 membership reports */ + +}; + +#ifdef IGMPV3_DEBUG +#define igmplog(x) do { if (1) log x; } while (/*CONSTCOND*/ 0) +#else +#define igmplog(x) /* empty */ +#endif + +#ifdef _WRS_KERNEL +#include +#define IGMP_RANDOM_DELAY(X) (random() % (X) + 1) + +extern struct router_info * rti_head; + +/* + * States for IGMPv2's leave processing + */ +#define IGMP_OTHERMEMBER 0 +#define IGMP_IREPORTEDLAST 1 + +/* + * IGMPv3 default variables + */ +#define IGMP_DEF_RV 2 /* Default Robustness Variable */ +#define IGMP_DEF_QI 125 /* Query Interval (125 sec.) */ +#define IGMP_DEF_QRI 100 /* Query Response Interval (10 sec.) */ +#define IGMP_OQPI ((IGMP_DEF_RV * IGMP_DEF_QI) + IGMP_DEF_QRI/2) +#define IGMP_GMI ((IGMP_DEF_RV * IGMP_DEF_QI) + IGMP_DEF_QRI) +#define IGMP_START_INTVL IGMP_DEF_QI/4 +#define IGMP_START_CNT IGMP_DEF_RV +#define IGMP_LAST_INTVL 1 /* Last Member Query Interval (sec.) */ +#define IGMP_LAST_CNT IGMP_DEF_RV +#define IGMP_UNSOL_INTVL 1 /* Unsolicited Report Interval (sec.) */ +#define IGMP_DEF_QUERY 10 /* v1 Max. Response Time (sec.) */ + +/* + * We must remember what version the subnet's querier is. + * We conveniently use the IGMP message type for the proper + * membership report to keep this state. + */ +#define IGMP_V1_ROUTER IGMP_V1_MEMBERSHIP_REPORT +#define IGMP_V2_ROUTER IGMP_V2_MEMBERSHIP_REPORT + +/* + * Revert to new router if we haven't heard from an old router in + * this amount of time. + */ +#define IGMP_AGE_THRESHOLD 540 + +void igmp_init __P((void)); +struct router_info * rti_init(struct ifnet *); +void igmp_input __P((struct mbuf *, int, int)); +void igmp_joingroup __P((struct in_multi *)); +void igmp_leavegroup __P((struct in_multi *)); +void igmp_sendbuf(struct mbuf *, struct ifnet *); +void igmp_fasttimo __P((void)); +void igmp_slowtimo __P((void)); +int igmp_get_router_alert(struct mbuf **); +void igmp_send_state_change_report(struct mbuf **, int *, + struct in_multi *, u_int8_t, int); +int igmp_sysctl(int *, u_int, void *, size_t *, void *, size_t); + +#include +#ifndef VIRTUAL_STACK +SYSCTL_DECL_NODE_EXT(igmp); +#endif /* VIRTUAL_STACK */ + +#endif /* _WRS_KERNEL */ + +/* + * Names for IGMP sysctl objects + */ + +#define IGMPCTL_SENDWITHRA 1 /* kern sends IGMP with Router Alert */ +#define IGMPCTL_DROPWITHNORA 2 /* kern drops IGMP with no Rtr Alert */ +#define IGMPCTL_MAXSRCFILTER 3 /* max sources per group per interface*/ +#define IGMPCTL_SOMAXSRC 4 /* max sources per socket per group */ +#define IGMPCTL_ALWAYS_V3 5 +#define IGMPCTL_STATS 6 /* statistics (read-only) */ +#define IGMPCTL_MAXID 7 + +#define IGMPCTL_NAMES { \ + { 0, 0 }, \ + { "sendwithra", CTLTYPE_INT }, \ + { "dropwithnora", CTLTYPE_INT }, \ + { "maxsrcfilter", CTLTYPE_INT }, \ + { "somaxsrc", CTLTYPE_INT }, \ + { "always_v3", CTLTYPE_INT }, \ + { "stats", CTLTYPE_STRUCT }, \ +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/netinet/in.h b/h/wrn/coreip/netinet/in.h new file mode 100644 index 0000000..4901f51 --- /dev/null +++ b/h/wrn/coreip/netinet/in.h @@ -0,0 +1,738 @@ +/* in.h - internet header file */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* + * Copyright (c) 2002 INRIA. All rights reserved. + * + * Implementation of Internet Group Management Protocol, Version 3. + * Developed by Hitoshi Asaeda, INRIA, February 2002. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of INRIA nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Copyright (c) 1982, 1986, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)in.h 8.3 (Berkeley) 1/3/94 + * $FreeBSD: src/sys/netinet/in.h,v 1.48.2.12 2004/06/16 06:57:49 ru Exp $ + * $FreeBSD: src/sys/netinet/in.h,v 1.48.2.11 2003/09/09 19:09:22 bms Exp $ + */ + +/* +modification history +-------------------- +02d,25aug05,dlk Add section tags. +02c,18may05,kch Merged from FreeBSD v 1.48.2.12. +02b,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +02a,18apr05,vvv included in6.h for user-space +01z,03mar05,vvv removed reference to _KERNEL +01y,25feb05,niq merge from niqbal.tor3.mroute for IP router alert changes +01x,17feb05,dlk NTOHL() etc. only usable as statements, not expressions. +01w,07feb05,vvv _KERNEL cleanup +01v,24jan05,vvv osdep.h cleanup +01u,20jan05,sar Removal of divert, dummynet and fw code. +01t,14oct04,nee include osdep.h and machdep.h when _KERNEL is defined + (SPR #102593) +01s,31may04,nee Adding macro IN_ADDR_IS_LINKLOCAL +01r,25nov03,ppp added a comment before the inclusion of in6.h +01q,21nov03,ppp rtp work +01p,04nov03,rlm Ran batch header path update for header re-org. +01o,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01n,23oct03,rlm updated #includes for header re-org +01m,07aug03,niq Merging from Accordion label ACCORDION_BASE6_MERGE_BASELINE +01l,13jun03,syy Added declaration for inet_ntoa_b() (SPR#88384) +01k,15may03,vvv included mbuf.h +01j,09may03,vvv included vxWorks.h +01i,01feb03,pas merge from FreeBSD 4.7 - moved satosin() etc here +01h,09sep02,hsh add c++ protection +01g,15jul02,ann moved the early declaration of some structures to avoid + compilation warnings +01f,08feb02,nee making in_socktrim non static +01e,02oct01,ppp Removing the INET6 guard fot in6.h +01d,18sep01,qli fixed a header inclusion error +01c,18sep01,ppp guarding the inclusion of in6.h by INET6 for the link + temporarily +01b,23aug01,ppp Adding the WindRiver copyright +01a,08aug01,ppp Created from FreeBSD 4.3 +*/ + +#ifndef _NETINET_IN_H_ +#define _NETINET_IN_H_ + +#include + +#ifdef _WRS_KERNEL +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * Constants and structures defined by the internet system, + * Per RFC 790, September 1981, and numerous additions. + */ + +/* + * Protocols (RFC 1700) + */ +#define IPPROTO_IP 0 /* dummy for IP */ +#define IPPROTO_HOPOPTS 0 /* IP6 hop-by-hop options */ +#define IPPROTO_ICMP 1 /* control message protocol */ +#define IPPROTO_IGMP 2 /* group mgmt protocol */ +#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */ +#define IPPROTO_IPV4 4 /* IPv4 encapsulation */ +#define IPPROTO_IPIP IPPROTO_IPV4 /* for compatibility */ +#define IPPROTO_TCP 6 /* tcp */ +#define IPPROTO_ST 7 /* Stream protocol II */ +#define IPPROTO_EGP 8 /* exterior gateway protocol */ +#define IPPROTO_PIGP 9 /* private interior gateway */ +#define IPPROTO_RCCMON 10 /* BBN RCC Monitoring */ +#define IPPROTO_NVPII 11 /* network voice protocol*/ +#define IPPROTO_PUP 12 /* pup */ +#define IPPROTO_ARGUS 13 /* Argus */ +#define IPPROTO_EMCON 14 /* EMCON */ +#define IPPROTO_XNET 15 /* Cross Net Debugger */ +#define IPPROTO_CHAOS 16 /* Chaos*/ +#define IPPROTO_UDP 17 /* user datagram protocol */ +#define IPPROTO_MUX 18 /* Multiplexing */ +#define IPPROTO_MEAS 19 /* DCN Measurement Subsystems */ +#define IPPROTO_HMP 20 /* Host Monitoring */ +#define IPPROTO_PRM 21 /* Packet Radio Measurement */ +#define IPPROTO_IDP 22 /* xns idp */ +#define IPPROTO_TRUNK1 23 /* Trunk-1 */ +#define IPPROTO_TRUNK2 24 /* Trunk-2 */ +#define IPPROTO_LEAF1 25 /* Leaf-1 */ +#define IPPROTO_LEAF2 26 /* Leaf-2 */ +#define IPPROTO_RDP 27 /* Reliable Data */ +#define IPPROTO_IRTP 28 /* Reliable Transaction */ +#define IPPROTO_TP 29 /* tp-4 w/ class negotiation */ +#define IPPROTO_BLT 30 /* Bulk Data Transfer */ +#define IPPROTO_NSP 31 /* Network Services */ +#define IPPROTO_INP 32 /* Merit Internodal */ +#define IPPROTO_SEP 33 /* Sequential Exchange */ +#define IPPROTO_3PC 34 /* Third Party Connect */ +#define IPPROTO_IDPR 35 /* InterDomain Policy Routing */ +#define IPPROTO_XTP 36 /* XTP */ +#define IPPROTO_DDP 37 /* Datagram Delivery */ +#define IPPROTO_CMTP 38 /* Control Message Transport */ +#define IPPROTO_TPXX 39 /* TP++ Transport */ +#define IPPROTO_IL 40 /* IL transport protocol */ +#define IPPROTO_IPV6 41 /* IP6 header */ +#define IPPROTO_SDRP 42 /* Source Demand Routing */ +#define IPPROTO_ROUTING 43 /* IP6 routing header */ +#define IPPROTO_FRAGMENT 44 /* IP6 fragmentation header */ +#define IPPROTO_IDRP 45 /* InterDomain Routing*/ +#define IPPROTO_RSVP 46 /* resource reservation */ +#define IPPROTO_GRE 47 /* General Routing Encap. */ +#define IPPROTO_MHRP 48 /* Mobile Host Routing */ +#define IPPROTO_BHA 49 /* BHA */ +#define IPPROTO_ESP 50 /* IP6 Encap Sec. Payload */ +#define IPPROTO_AH 51 /* IP6 Auth Header */ +#define IPPROTO_INLSP 52 /* Integ. Net Layer Security */ +#define IPPROTO_SWIPE 53 /* IP with encryption */ +#define IPPROTO_NHRP 54 /* Next Hop Resolution */ +#define IPPROTO_MOBILE 55 /* IP Mobility */ +/* 56-57: Unassigned */ +#define IPPROTO_ICMPV6 58 /* ICMP6 */ +#define IPPROTO_NONE 59 /* IP6 no next header */ +#define IPPROTO_DSTOPTS 60 /* IP6 destination option */ +#define IPPROTO_AHIP 61 /* any host internal protocol */ +#define IPPROTO_CFTP 62 /* CFTP */ +#define IPPROTO_HELLO 63 /* "hello" routing protocol */ +#define IPPROTO_SATEXPAK 64 /* SATNET/Backroom EXPAK */ +#define IPPROTO_KRYPTOLAN 65 /* Kryptolan */ +#define IPPROTO_RVD 66 /* Remote Virtual Disk */ +#define IPPROTO_IPPC 67 /* Pluribus Packet Core */ +#define IPPROTO_ADFS 68 /* Any distributed FS */ +#define IPPROTO_SATMON 69 /* Satnet Monitoring */ +#define IPPROTO_VISA 70 /* VISA Protocol */ +#define IPPROTO_IPCV 71 /* Packet Core Utility */ +#define IPPROTO_CPNX 72 /* Comp. Prot. Net. Executive */ +#define IPPROTO_CPHB 73 /* Comp. Prot. HeartBeat */ +#define IPPROTO_WSN 74 /* Wang Span Network */ +#define IPPROTO_PVP 75 /* Packet Video Protocol */ +#define IPPROTO_BRSATMON 76 /* BackRoom SATNET Monitoring */ +#define IPPROTO_ND 77 /* Sun net disk proto (temp.) */ +#define IPPROTO_WBMON 78 /* WIDEBAND Monitoring */ +#define IPPROTO_WBEXPAK 79 /* WIDEBAND EXPAK */ +#define IPPROTO_EON 80 /* ISO cnlp */ +#define IPPROTO_VMTP 81 /* VMTP */ +#define IPPROTO_SVMTP 82 /* Secure VMTP */ +#define IPPROTO_VINES 83 /* Banyon VINES */ +#define IPPROTO_TTP 84 /* TTP */ +#define IPPROTO_IGP 85 /* NSFNET-IGP */ +#define IPPROTO_DGP 86 /* dissimilar gateway prot. */ +#define IPPROTO_TCF 87 /* TCF */ +#define IPPROTO_IGRP 88 /* Cisco/GXS IGRP */ +#define IPPROTO_OSPFIGP 89 /* OSPFIGP */ +#define IPPROTO_SRPC 90 /* Strite RPC protocol */ +#define IPPROTO_LARP 91 /* Locus Address Resoloution */ +#define IPPROTO_MTP 92 /* Multicast Transport */ +#define IPPROTO_AX25 93 /* AX.25 Frames */ +#define IPPROTO_IPEIP 94 /* IP encapsulated in IP */ +#define IPPROTO_MICP 95 /* Mobile Int.ing control */ +#define IPPROTO_SCCSP 96 /* Semaphore Comm. security */ +#define IPPROTO_ETHERIP 97 /* Ethernet IP encapsulation */ +#define IPPROTO_ENCAP 98 /* encapsulation header */ +#define IPPROTO_APES 99 /* any private encr. scheme */ +#define IPPROTO_GMTP 100 /* GMTP*/ +#define IPPROTO_IPCOMP 108 /* payload compression (IPComp) */ +#define IPPROTO_PIM 103 /* Protocol Independent Mcast */ +#define IPPROTO_PGM 113 /* PGM */ +#define IPPROTO_SCTP 132 /* SCTP (RFC2960) */ +/* 134-254: Partly Unassigned */ +#define IPPROTO_MH 135 /* IPv6 Mobility Header */ +/* 255: Reserved */ +/* BSD Private, local use, namespace incursion */ +#define IPPROTO_DIVERT 254 /* divert pseudo-protocol */ +#define IPPROTO_RAW 255 /* raw IP packet */ +#define IPPROTO_MAX 256 + +/* last return value of *_input(), meaning "all job for this pkt is done". */ +#define IPPROTO_DONE 257 + +/* + * Local port number conventions: + * + * When a user does a bind(2) or connect(2) with a port number of zero, + * a non-conflicting local port address is chosen. + * The default range is IPPORT_RESERVED through + * IPPORT_USERRESERVED, although that is settable by sysctl. + * + * A user may set the IPPROTO_IP option IP_PORTRANGE to change this + * default assignment range. + * + * The value IP_PORTRANGE_DEFAULT causes the default behavior. + * + * The value IP_PORTRANGE_HIGH changes the range of candidate port numbers + * into the "high" range. These are reserved for client outbound connections + * which do not want to be filtered by any firewalls. + * + * The value IP_PORTRANGE_LOW changes the range to the "low" are + * that is (by convention) restricted to privileged processes. This + * convention is based on "vouchsafe" principles only. It is only secure + * if you trust the remote host to restrict these ports. + * + * The default range of ports and the high range can be changed by + * sysctl(3). (net.inet.ip.port{hi,low}{first,last}_auto) + * + * Changing those values has bad security implications if you are + * using a a stateless firewall that is allowing packets outside of that + * range in order to allow transparent outgoing connections. + * + * Such a firewall configuration will generally depend on the use of these + * default values. If you change them, you may find your Security + * Administrator looking for you with a heavy object. + * + * For a slightly more orthodox text view on this: + * + * ftp://ftp.isi.edu/in-notes/iana/assignments/port-numbers + * + * port numbers are divided into three ranges: + * + * 0 - 1023 Well Known Ports + * 1024 - 49151 Registered Ports + * 49152 - 65535 Dynamic and/or Private Ports + * + */ + +/* + * Ports < IPPORT_RESERVED are reserved for + * privileged processes (e.g. root). (IP_PORTRANGE_LOW) + * Ports > IPPORT_USERRESERVED are reserved + * for servers, not necessarily privileged. (IP_PORTRANGE_DEFAULT) + */ +#define IPPORT_RESERVED 1024 +#define IPPORT_USERRESERVED 5000 + +/* + * Default local port range to use by setting IP_PORTRANGE_HIGH + */ +#define IPPORT_HIFIRSTAUTO 49152 +#define IPPORT_HILASTAUTO 65535 + +/* + * Scanning for a free reserved port return a value below IPPORT_RESERVED, + * but higher than IPPORT_RESERVEDSTART. Traditionally the start value was + * 512, but that conflicts with some well-known-services that firewalls may + * have a fit if we use. + */ +#define IPPORT_RESERVEDSTART 600 + +/* + * Internet address (a structure for historical reasons) + */ + +typedef u_int32_t in_addr_t; + +struct in_addr { + in_addr_t s_addr; +}; + +/* + * Definitions of bits in internet address integers. + * On subnets, the decomposition of addresses to host and net parts + * is done according to subnet mask, not the masks here. + */ +#define IN_CLASSA(i) (((u_int32_t)(i) & 0x80000000) == 0) +#define IN_CLASSA_NET 0xff000000 +#define IN_CLASSA_NSHIFT 24 +#define IN_CLASSA_HOST 0x00ffffff +#define IN_CLASSA_MAX 128 + +#define IN_CLASSB(i) (((u_int32_t)(i) & 0xc0000000) == 0x80000000) +#define IN_CLASSB_NET 0xffff0000 +#define IN_CLASSB_NSHIFT 16 +#define IN_CLASSB_HOST 0x0000ffff +#define IN_CLASSB_MAX 65536 + +#define IN_CLASSC(i) (((u_int32_t)(i) & 0xe0000000) == 0xc0000000) +#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST 0x000000ff + +#define IN_CLASSD(i) (((u_int32_t)(i) & 0xf0000000) == 0xe0000000) +#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */ +#define IN_CLASSD_NSHIFT 28 /* net and host fields, but */ +#define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */ +#define IN_MULTICAST(i) IN_CLASSD(i) + +#define IN_EXPERIMENTAL(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000) +#define IN_BADCLASS(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000) + +#define IN_LOCAL_GROUP(i) (((u_int32_t)(i) & 0xffffff00) == 0xe0000000) + +#define INADDR_ANY (u_int32_t)0x00000000 +#define INADDR_LOOPBACK (u_int32_t)0x7f000001 +#define INADDR_BROADCAST (u_int32_t)0xffffffff /* must be masked */ +#define INADDR_NONE 0xffffffff /* -1 return */ + +#define INADDR_UNSPEC_GROUP (u_int32_t)0xe0000000 /* 224.0.0.0 */ +#define INADDR_ALLHOSTS_GROUP (u_int32_t)0xe0000001 /* 224.0.0.1 */ +#define INADDR_ALLRTRS_GROUP (u_int32_t)0xe0000002 /* 224.0.0.2 */ +#define INADDR_NEW_ALLRTRS_GROUP (u_int32_t)0xe0000016 /* 224.0.0.22 */ +#define INADDR_MAX_LOCAL_GROUP (u_int32_t)0xe00000ff /* 224.0.0.255 */ + +#define IN_LOOPBACKNET 127 /* official! */ + +#define IN_ADDR_IS_LINKLOCAL(i) (((i)[0] == 169) && ((i)[1] == 254)) + +#if _BYTE_ORDER == _BIG_ENDIAN + +#define ntohl(x) (x) +#define ntohs(x) (x) +#define htonl(x) (x) +#define htons(x) (x) + +#define NTOHL(x) do {} while (FALSE) +#define NTOHS(x) do {} while (FALSE) +#define HTONL(x) do {} while (FALSE) +#define HTONS(x) do {} while (FALSE) + +#else + +#define ntohl(x) ((((x) & 0x000000ff) << 24) | \ + (((x) & 0x0000ff00) << 8) | \ + (((x) & 0x00ff0000) >> 8) | \ + (((x) & 0xff000000) >> 24)) + +#define htonl(x) ((((x) & 0x000000ff) << 24) | \ + (((x) & 0x0000ff00) << 8) | \ + (((x) & 0x00ff0000) >> 8) | \ + (((x) & 0xff000000) >> 24)) + +#define ntohs(x) ((((x) & 0x00ff) << 8) | \ + (((x) & 0xff00) >> 8)) + +#define htons(x) ((((x) & 0x00ff) << 8) | \ + (((x) & 0xff00) >> 8)) + +#define NTOHL(x) do {(x) = ntohl((u_long)(x)); } while (FALSE) +#define NTOHS(x) do {(x) = ntohs((u_short)(x)); } while (FALSE) +#define HTONL(x) do {(x) = htonl((u_long)(x)); } while (FALSE) +#define HTONS(x) do {(x) = htons((u_short)(x)); } while (FALSE) + +#endif /* _BYTE_ORDER */ + + +/* + * Socket address, internet style. + */ +struct sockaddr_in { + u_char sin_len; + u_char sin_family; + u_short sin_port; + struct in_addr sin_addr; + char sin_zero[8]; +}; + +#define INET_ADDRSTRLEN 16 + +/* + * Options for use with [gs]etsockopt at the IP level. + * First word of comment is data type; bool is stored in int. + */ +#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */ +#define IP_HDRINCL 2 /* int; header is included with data */ +#define IP_TOS 3 /* int; IP type of service and preced. */ +#define IP_TTL 4 /* int; IP time to live */ +#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */ +#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */ +#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */ +#define IP_RETOPTS 8 /* ip_opts; set/get IP options */ +#define IP_MULTICAST_IF 9 /* u_char; set/get IP multicast i/f */ +#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */ +#define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */ +#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */ +#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */ +#define IP_MULTICAST_VIF 14 /* set/get IP mcast virt. iface */ + +#define IP_RSVP_ON 15 /* enable RSVP in kernel */ +#define IP_RSVP_OFF 16 /* disable RSVP in kernel */ +/* + * Removed the IP_RSVP_VIF_ON/IP_RSVP_VIF_OFF as we support router alert + * through the IP_ROUTER_ALERT option (defined below) + */ + +#define IP_PORTRANGE 19 /* int; range to choose for unspec port */ +#define IP_RECVIF 20 /* bool; receive reception if w/dgram */ +/* for IPSEC */ +#define IP_IPSEC_POLICY 21 /* int; set/get security policy */ +#define IP_FAITH 22 /* bool; accept FAITH'ed connections */ +#define IP_BLOCK_SOURCE 23 /* ip_mreq_source; block data from a src */ +#define IP_UNBLOCK_SOURCE 24 /* ip_mreq_source; undo block filter */ +#define IP_ADD_SOURCE_MEMBERSHIP 25 /* ip_mreq_source; add a single source */ +#define IP_DROP_SOURCE_MEMBERSHIP 26 /* ip_mreq_source; drop a single source */ + +/* MCAST_* sockopts number should not be duplicated with IPv6-level sockopts */ +#define MCAST_JOIN_GROUP 70 /* group_req; */ +#define MCAST_BLOCK_SOURCE 71 /* group_source_req; */ +#define MCAST_UNBLOCK_SOURCE 72 /* group_source_req; */ +#define MCAST_LEAVE_GROUP 73 /* group_req; */ +#define MCAST_JOIN_SOURCE_GROUP 74 /* group_source_req; */ +#define MCAST_LEAVE_SOURCE_GROUP 75 /* group_source_req; */ + +#define IP_ONESBCAST 27 /* bool: send all-ones broadcast */ + +#define IP_ROUTER_ALERT 23 /* bool; accept router alert packets */ + +/* We currently don't support the ip_fw and ip_dummynet options. They are + * retained in this file for consistency with other systems + */ +#if 0 +#define IP_FW_ADD 50 /* add a firewall rule to chain */ +#define IP_FW_DEL 51 /* delete a firewall rule from chain */ +#define IP_FW_FLUSH 52 /* flush firewall rule chain */ +#define IP_FW_ZERO 53 /* clear single/all firewall counter(s) */ +#define IP_FW_GET 54 /* get entire firewall rule chain */ +#define IP_FW_RESETLOG 55 /* reset logging counters */ + +#define IP_DUMMYNET_CONFIGURE 60 /* add/configure a dummynet pipe */ +#define IP_DUMMYNET_DEL 61 /* delete a dummynet pipe from chain */ +#define IP_DUMMYNET_FLUSH 62 /* flush dummynet */ +#define IP_DUMMYNET_GET 64 /* get entire dummynet pipes */ +#endif /* #ifdef 0 */ + +/* + * Defaults and limits for options + */ +#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */ +#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */ +#define IP_MAX_MEMBERSHIPS 20 /* per socket */ +#define IP_MAX_SOURCE_FILTER 128 /* max number of MSF per group */ +#define SO_MAX_SOURCE_FILTER 64 /* max number of MSF per socket */ + +/* + * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. + */ +struct ip_mreq { + struct in_addr imr_multiaddr; /* IP multicast address of group */ + struct in_addr imr_interface; /* local IP address of interface */ +}; + +#define MCAST_INCLUDE 1 /* ip_msfilter's imsf_fmode value */ +#define MCAST_EXCLUDE 2 /* ip_msfilter's imsf_fmode value */ + +/* + * Argument structure for IP_{BLOCK|UNBLOCK}_SOURCE and + * IP_{ADD|DROP}_SOURCE_MEMBERSHIP. + */ +struct ip_mreq_source { + struct in_addr imr_multiaddr; /* IP multicast address of group */ + struct in_addr imr_sourceaddr; /* source address of group */ + struct in_addr imr_interface; /* local IP address of interface */ +}; + +/* + * Argument structure for SIOCSIPMSFILTER. + */ +struct ip_msfilter { + struct in_addr imsf_multiaddr; /* IP multicast address of group */ + struct in_addr imsf_interface; /* local IP address of interface */ + u_int32_t imsf_fmode; /* filter mode */ + u_int32_t imsf_numsrc; /* number of sources in src_list */ + struct in_addr imsf_slist[1]; /* start of source list */ +}; + +#define IP_MSFILTER_SIZE(numsrc) \ + (sizeof(struct ip_msfilter) - sizeof(struct in_addr) \ + + (numsrc) * sizeof(struct in_addr)) + +/* + * Protocol-Independent Multicast Source Filter APIs + */ +struct group_req { + u_int32_t gr_interface; /* interface index */ + struct sockaddr_storage gr_group; /* group address */ +}; + +struct group_source_req { + u_int32_t gsr_interface; /* interface index */ + struct sockaddr_storage gsr_group; /* group address */ + struct sockaddr_storage gsr_source; /* source address */ +}; + +struct group_filter { + u_int32_t gf_interface; /* interface index */ + struct sockaddr_storage gf_group; /* multicast address */ + u_int32_t gf_fmode; /* filter mode */ + u_int32_t gf_numsrc; /* number of sources */ + struct sockaddr_storage gf_slist[1]; /* source address */ +}; + +#define GROUP_FILTER_SIZE(numsrc) \ + (sizeof(struct group_filter) - sizeof(struct sockaddr_storage) \ + + (numsrc) * sizeof(struct sockaddr_storage)) + +/* + * Argument for IP_PORTRANGE: + * - which range to search when port is unspecified at bind() or connect() + */ +#define IP_PORTRANGE_DEFAULT 0 /* default range */ +#define IP_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */ +#define IP_PORTRANGE_LOW 2 /* "low" - vouchsafe security */ + +/* Packet reassembly stuff */ +#define IPREASS_NHASH_LOG2 6 +#define IPREASS_NHASH (1 << IPREASS_NHASH_LOG2) +#define IPREASS_HMASK (IPREASS_NHASH - 1) +#define IPREASS_HASH(x,y) \ + (((((x) & 0xF) | ((((x) >> 8) & 0xF) << 4)) ^ (y)) & IPREASS_HMASK) + +#define RTQ_TIMEOUT 60*10 /* run no less than once every ten minutes */ + +/* + * Definitions for inet sysctl operations. + * + * Third level is protocol number. + * Fourth level is desired variable within that protocol. + */ +#define IPPROTO_MAXID (IPPROTO_AH + 1) /* don't list to IPPROTO_MAX */ + +#define CTL_IPPROTO_NAMES { \ + { "ip", CTLTYPE_NODE }, \ + { "icmp", CTLTYPE_NODE }, \ + { "igmp", CTLTYPE_NODE }, \ + { "ggp", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "tcp", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { "egp", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "pup", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "udp", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "idp", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "ipsec", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "pim", CTLTYPE_NODE }, \ +} + +/* + * Names for IP sysctl objects + */ +#define IPCTL_FORWARDING 1 /* act as router */ +#define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */ +#define IPCTL_DEFTTL 3 /* default TTL */ +#ifdef notyet +#define IPCTL_DEFMTU 4 /* default MTU */ +#endif +#define IPCTL_RTEXPIRE 5 /* cloned route expiration time */ +#define IPCTL_RTMINEXPIRE 6 /* min value for expiration time */ +#define IPCTL_RTMAXCACHE 7 /* trigger level for dynamic expire */ +#define IPCTL_SOURCEROUTE 8 /* may perform source routes */ +#define IPCTL_DIRECTEDBROADCAST 9 /* may re-broadcast received packets */ +#define IPCTL_INTRQMAXLEN 10 /* max length of netisr queue */ +#define IPCTL_INTRQDROPS 11 /* number of netisr q drops */ +#define IPCTL_STATS 12 /* ipstat structure */ +#define IPCTL_ACCEPTSOURCEROUTE 13 /* may accept source routed packets */ +#define IPCTL_FASTFORWARDING 14 /* use fast IP forwarding code */ +#define IPCTL_KEEPFAITH 15 /* FAITH IPv4->IPv6 translater ctl */ +#define IPCTL_GIF_TTL 16 /* default TTL for gif encap packet */ +#define IPCTL_MAXID 17 + +#define IPCTL_NAMES { \ + { 0, 0 }, \ + { "forwarding", CTLTYPE_INT }, \ + { "redirect", CTLTYPE_INT }, \ + { "ttl", CTLTYPE_INT }, \ + { "mtu", CTLTYPE_INT }, \ + { "rtexpire", CTLTYPE_INT }, \ + { "rtminexpire", CTLTYPE_INT }, \ + { "rtmaxcache", CTLTYPE_INT }, \ + { "sourceroute", CTLTYPE_INT }, \ + { "directed-broadcast", CTLTYPE_INT }, \ + { "intr-queue-maxlen", CTLTYPE_INT }, \ + { "intr-queue-drops", CTLTYPE_INT }, \ + { "stats", CTLTYPE_STRUCT }, \ + { "accept_sourceroute", CTLTYPE_INT }, \ + { "fastforwarding", CTLTYPE_INT }, \ +} + +/* INET6 stuff, temporary workaround */ +#define __KAME_NETINET_IN_H_INCLUDED_ +#include +#undef __KAME_NETINET_IN_H_INCLUDED_ + +#ifdef _WRS_KERNEL +struct ifnet; /* forward declarations for Standard C */ + +int in_broadcast __P((struct in_addr, struct ifnet *)); +int in_canforward __P((struct in_addr)); +_WRS_FASTTEXT +int in_cksum __P((struct mbuf *, int)); +int in_localaddr __P((struct in_addr)); +void inet_ntoa_b __P((struct in_addr, char *)); +char *inet_ntoa __P((struct in_addr)); /* in libkern */ + +struct in_ifaddr *in_ifexists_ifa __P((struct ifnet *)); + +void in_socktrim __P((struct sockaddr_in *)); + +#define satosin(sa) ((struct sockaddr_in *)(sa)) +#define sintosa(sin) ((struct sockaddr *)(sin)) +#define ifatoia(ifa) ((struct in_ifaddr *)(ifa)) + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/netinet/in_msf.h b/h/wrn/coreip/netinet/in_msf.h new file mode 100644 index 0000000..ee3aca2 --- /dev/null +++ b/h/wrn/coreip/netinet/in_msf.h @@ -0,0 +1,303 @@ +/* $KAME: in_msf.h,v 1.15 2004/05/26 10:08:00 itojun Exp $ */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* + * Copyright (C) 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Copyright (c) 2002 INRIA. All rights reserved. + * + * Implementation of Internet Group Management Protocol, Version 3. + * Developed by Hitoshi Asaeda, INRIA, February 2002. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of INRIA nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +/* + * Implementation of Internet Group Management Protocol, Version 3. + * + * Developed by Hitoshi Asaeda, INRIA, February 2002. + */ + +/* +modification history +-------------------- +01c,25may05,kch Modified IMO_MSF_ALLOC() and IMO_MSF_FREE() to use + DS_MALLOC() and DS_FREE(). +01b,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +01a,24feb05,rp Added WR copyrights and mod history +*/ + +#ifndef _NETINET_INMSF_H_ +#define _NETINET_INMSF_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Multicast source filters list per group address. + */ +LIST_HEAD(ias_head, in_addr_source); + +#ifdef __FreeBSD__ +#ifdef MALLOC_DECLARE +MALLOC_DECLARE(M_MSFILTER); +MALLOC_DECLARE(M_IPMOPTS); +#endif /* MALLOC_DECLARE */ +#endif + + +struct in_addr_source { + struct sockaddr_in ias_addr; /* source address */ + LIST_ENTRY(in_addr_source) ias_list; /* list of source addresses */ + u_int ias_refcount; /* reference count of the source */ +}; + +struct in_addr_slist { + struct ias_head *head; /* head point of this list */ + u_int16_t numsrc; /* num of sources of this list */ +}; + +struct in_multi_source { + u_int ims_mode; /* current source filter mode */ + u_int ims_grpjoin; /* (*,G) join request bit */ + struct in_addr_slist *ims_cur; /* current filtered source list */ + struct in_addr_slist *ims_rec; /* recorded source address list */ + struct in_addr_slist *ims_in; /* include source address list */ + struct in_addr_slist *ims_ex; /* exclude source address list */ + u_int ims_excnt; /* max source count of EX list */ + struct in_addr_slist *ims_alw; /* pending ALLOW source address */ + struct in_addr_slist *ims_blk; /* pending BLOCK source address */ + struct in_addr_slist *ims_toin; /* pending TO_IN source address */ + struct in_addr_slist *ims_toex; /* pending TO_EX source address */ + u_int ims_timer; /* state-change report timer */ + u_int ims_robvar; /* robusutness var. of grp record */ +}; + +#ifdef _WRS_KERNEL + +/* + * Filter definition of State Change Report of IGMP/MLD, given from the state + * change of current filter mode and new filter mode. + */ +#define REPORT_FILTER1 1 /* INCLUDE(A) -> INCLUDE(B) */ +#define REPORT_FILTER2 2 /* EXCLUDE(A) -> EXCLUDE(B) */ +#define REPORT_FILTER3 3 /* INCLUDE(A) -> EXCLUDE(B) */ +#define REPORT_FILTER4 4 /* EXCLUDE(A) -> INCLUDE(B) */ + +#define IMS_ADD_SOURCE 1 /* request to add source to list */ +#define IMS_DELETE_SOURCE 2 /* request to delete source to list */ + +/* + * Filter definition of State Change Report, given from the state change of + * current filter mode and new filter mode. + */ +#define REPORT_FILTER1 1 /* INCLUDE(A) -> INCLUDE(B) */ +#define REPORT_FILTER2 2 /* EXCLUDE(A) -> EXCLUDE(B) */ +#define REPORT_FILTER3 3 /* INCLUDE(A) -> EXCLUDE(B) */ +#define REPORT_FILTER4 4 /* EXCLUDE(A) -> INCLUDE(B) */ + +#define IGMP_JOINLEAVE_OPS(optname) \ + (((optname) == IP_ADD_SOURCE_MEMBERSHIP) || \ + ((optname) == IP_DROP_SOURCE_MEMBERSHIP) || \ + ((optname) == MCAST_JOIN_SOURCE_GROUP) || \ + ((optname) == MCAST_LEAVE_SOURCE_GROUP)) + +#define IGMP_BLOCK_OPS(optname) \ + (((optname) == IP_BLOCK_SOURCE) || \ + ((optname) == IP_UNBLOCK_SOURCE) || \ + ((optname) == MCAST_BLOCK_SOURCE) || \ + ((optname) == MCAST_UNBLOCK_SOURCE)) + +#define IGMP_MSFON_OPS(optname) \ + (((optname) == IP_ADD_SOURCE_MEMBERSHIP) || \ + ((optname) == IP_BLOCK_SOURCE) || \ + ((optname) == MCAST_JOIN_SOURCE_GROUP) || \ + ((optname) == MCAST_BLOCK_SOURCE)) + +#define IGMP_MSFOFF_OPS(optname) \ + (((optname) == IP_DROP_SOURCE_MEMBERSHIP) || \ + ((optname) == IP_UNBLOCK_SOURCE) || \ + ((optname) == MCAST_LEAVE_SOURCE_GROUP) || \ + ((optname) == MCAST_UNBLOCK_SOURCE)) + +#define IMO_MSF_ALLOC(msf) do { \ + (msf) = (struct sock_msf *) \ + DS_MALLOC(SOCK_MSF_DS_SZ, SOCK_MSF_DS_ID); \ + if ((msf) == NULL) { \ + error = ENOBUFS; \ + break; \ + } \ + (msf)->msf_head = (struct msf_head *) \ + DS_MALLOC(MSF_HEAD_DS_SZ, MSF_HEAD_DS_ID); \ + if ((msf)->msf_head == NULL) { \ + IMO_MSF_FREE((msf)); \ + error = ENOBUFS; \ + break; \ + } \ + LIST_INIT((msf)->msf_head); \ + (msf)->msf_numsrc = 0; \ + (msf)->msf_blkhead = (struct msf_head *) \ + DS_MALLOC(MSF_HEAD_DS_SZ, MSF_HEAD_DS_ID); \ + if ((msf)->msf_blkhead == NULL) { \ + IMO_MSF_FREE((msf)); \ + error = ENOBUFS; \ + break; \ + } \ + LIST_INIT((msf)->msf_blkhead); \ + (msf)->msf_blknumsrc = 0; \ + (msf)->msf_grpjoin = 0; \ +} while (0) + +#define IMO_MSF_FREE(msf) { \ + if ((msf)->msf_head != NULL) \ + DS_FREE((msf)->msf_head, MSF_HEAD_DS_ID); \ + if ((msf)->msf_blkhead != NULL) \ + DS_FREE((msf)->msf_blkhead, MSF_HEAD_DS_ID); \ + if ((msf) != NULL) \ + DS_FREE ((msf), SOCK_MSF_DS_ID); \ +} + +/* + * Macros for Protocol-Independent programming + */ +#define SIN(x) ((struct sockaddr_in *)(x)) +#define SIN_ADDR(x) (SIN(x)->sin_addr.s_addr) +#define SIN6(x) ((struct sockaddr_in6 *)(x)) +#define SIN6_ADDR(x) (&(SIN6(x)->sin6_addr)) +#define SIN6_ADDR16(x, y) \ + (ntohs(*(const u_int16_t *)(const void *)(&(SIN6_ADDR(x)->s6_addr[y * 2])))) + +/* + * Compares two sockaddrs; + * Assuming both point to the same sockaddr_XX + */ +#define SS_IS_ADDR_MULTICAST(x) \ + (((struct sockaddr *)(x))->sa_family == AF_INET ? \ + (ntohl(SIN_ADDR(x)) >> 24) == 224 : \ + /* the endian of IN_MULTICAST() arg varies OS by OS */ \ + ((struct sockaddr *)(x))->sa_family == AF_INET6 ? \ + IN6_IS_ADDR_MULTICAST(SIN6_ADDR(x)) : \ + 0) + +#define SS_IS_ADDR_UNSPECIFIED(x) \ + (((struct sockaddr *)(x))->sa_family == AF_INET ? \ + (ntohl(SIN_ADDR(x)) == INADDR_ANY) : \ + ((struct sockaddr *)(x))->sa_family == AF_INET6 ? \ + IN6_IS_ADDR_UNSPECIFIED(SIN6_ADDR(x)) : \ + 0) + +#define IN_IS_LOCAL_GROUP(x) /* struct in_addr x */ \ + ((ntohl((x).sin_addr.s_addr) & 0xffffff00) == 0xe0000000) + +#define SS_CMP(a, op, b) \ + (sa_cmp((struct sockaddr *)(a), (struct sockaddr *)(b)) op 0) + + +int in_addmultisrc(struct in_multi *, u_int16_t, + struct sockaddr_storage *, u_int, int, struct ias_head **, + u_int *, u_int16_t *); +int in_delmultisrc(struct in_multi *, u_int16_t, + struct sockaddr_storage *, u_int, int, struct ias_head **, + u_int *, u_int16_t *); +int in_modmultisrc(struct in_multi *, u_int16_t, + struct sockaddr_storage *, u_int, u_int16_t, + struct sockaddr_storage *, u_int, u_int, struct ias_head **, + u_int *, u_int16_t *); +void in_undomultisrc(struct in_multi *, u_int16_t, + struct sockaddr_storage *, u_int, int); +int in_get_new_msf_state(struct in_multi *, struct ias_head **, + u_int *, u_int16_t *); +int in_merge_msf_state(struct in_multi *, struct ias_head *, + u_int, u_int16_t); +void in_free_all_msf_source_list(struct in_multi *); +void in_free_msf_source_list(struct ias_head *); +void in_free_msf_source_addr(struct in_addr_slist *, struct sockaddr_in *); +void in_clear_all_pending_report(struct in_multi *); +int in_merge_msf_source_addr(struct in_addr_slist *, struct sockaddr_in *, + int); +int ip_setmopt_srcfilter(struct socket *, struct ip_msfilter **); +int ip_getmopt_srcfilter(struct socket *, struct ip_msfilter **); +int sock_setmopt_srcfilter(struct socket *, struct group_filter **); +int sock_getmopt_srcfilter(struct socket *, struct group_filter **); +int in_getmopt_source_list(struct sock_msf *, u_int16_t *, + struct sockaddr_storage **, u_int *); +int in_setmopt_source_addr(struct sockaddr_storage *, struct sock_msf *, int); +int in_setmopt_source_list(struct sock_msf *, u_int16_t, + struct sockaddr_storage *, struct sockaddr_storage *, + u_int, u_int16_t *, u_int16_t *); +void in_freemopt_source_list(struct sock_msf *, struct msf_head *, + struct msf_head *); +void in_cleanmopt_source_addr(struct sock_msf *, int); +void in_undomopt_source_addr(struct sock_msf *, int); +void in_undomopt_source_list(struct sock_msf *, u_int); +int sa_cmp(struct sockaddr *, struct sockaddr *); +int match_msf4_per_if(struct in_multi *, struct in_addr *, + struct in_addr *); +int match_msf4_per_socket(struct inpcb *, struct in_addr *, + struct in_addr *); +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* _NETINET_INMSF_H_ */ diff --git a/h/wrn/coreip/netinet/in_pcb.h b/h/wrn/coreip/netinet/in_pcb.h new file mode 100644 index 0000000..c47132a --- /dev/null +++ b/h/wrn/coreip/netinet/in_pcb.h @@ -0,0 +1,401 @@ +/* in_pcb.h - internet protocol control block header file */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* + * Copyright (c) 1982, 1986, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)in_pcb.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/in_pcb.h,v 1.68 2003/11/26 01:40:43 sam Exp $ + * $FreeBSD: src/sys/netinet/in_pcb.h,v 1.32.2.6 2002/07/29 18:56:37 ume Exp $ + */ + +/* +modification history +-------------------- +01s,11jul05,dlk Added INP_NOFREE flag. +01r,16may05,dlk store copy of IP TOS in in_conninfo (SPR #109227) +01q,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +01p,07feb05,vvv _KERNEL cleanup +01o,20nov03,niq Remove copyright_wrs.h file inclusion +01n,05nov03,cdw Removal of unnecessary _KERNEL guards. +01m,04nov03,rlm Ran batch header path update for header re-org. +01l,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01k,23oct03,rlm updated #includes for header re-org +01j,07aug03,niq Merging from Accordion label ACCORDION_BASE6_MERGE_BASELINE +01i,09may03,vvv included socketvar.h +01h,01feb03,pas merge from FreeBSD 4.7 - added in_endpoints, in_conninfo +01g,09sep02,hsh add c++ protection +01f,28mar02,ppp making changes for backward compatibilty with AE. +01e,13dec01,ann enabling struct xinpgen for sysctl + changed malloc and free to KHEAP* for sysctl routines +01d,29oct01,ham included route.h. +01c,29oct01,nee adding ipi_zone and ipi_size to pcbinfo +01b,16aug01,ppp Removed un-wanted declaratons +01a,08aug01,ppp Created from FreeBSD 4.3 +*/ + +#ifndef _NETINET_IN_PCB_H_ +#define _NETINET_IN_PCB_H_ + +#include +#include +#include + +#ifdef __cplusplus + extern "C" { +#endif + +#define in6pcb inpcb /* for KAME src sync over BSD*'s */ +#define in6p_sp inp_sp /* for KAME src sync over BSD*'s */ + +/* + * Common structure pcb for internet protocol implementation. + * Here are stored pointers to local and foreign host table + * entries, local and foreign socket numbers, and pointers + * up (to a socket structure) and down (to a protocol-specific) + * control block. + */ +LIST_HEAD(inpcbhead, inpcb); +LIST_HEAD(inpcbporthead, inpcbport); +typedef u_quad_t inp_gen_t; + +/* + * PCB with AF_INET6 null bind'ed laddr can receive AF_INET input packet. + * So, AF_INET6 null laddr is also used as AF_INET null laddr, + * by utilize following structure. (At last, same as INRIA) + */ +struct in_addr_4in6 { + u_int32_t ia46_pad32[3]; + struct in_addr ia46_addr4; +}; + +/* + * NOTE: ipv6 addrs should be 64-bit aligned, per RFC 2553. + * in_conninfo has some extra padding to accomplish this. + */ +struct in_endpoints { + u_int16_t ie_fport; /* foreign port */ + u_int16_t ie_lport; /* local port */ + /* protocol dependent part, local and foreign addr */ + union { + /* foreign host table entry */ + struct in_addr_4in6 ie46_foreign; + struct in6_addr ie6_foreign; + } ie_dependfaddr; + union { + /* local host table entry */ + struct in_addr_4in6 ie46_local; + struct in6_addr ie6_local; + } ie_dependladdr; +#define ie_faddr ie_dependfaddr.ie46_foreign.ia46_addr4 +#define ie_laddr ie_dependladdr.ie46_local.ia46_addr4 +#define ie6_faddr ie_dependfaddr.ie6_foreign +#define ie6_laddr ie_dependladdr.ie6_local +}; + +/* + * XXX + * At some point struct route should possibly change to: + * struct rtentry *rt + * struct in_endpoints *ie; + */ +struct in_conninfo { + u_int8_t inc_flags; + u_int8_t inc_len; + u_int8_t inc_ip4tos; /* copy of IPv4 TOS */ + u_int8_t inc_pad1; /* XXX alignment for in_endpoints */ + /* protocol dependent part; cached route */ + struct in_endpoints inc_ie; + union { + /* placeholder for routing entry */ + struct route inc4_route; + struct route_in6 inc6_route; + } inc_dependroute; +}; +#define inc_isipv6 inc_flags /* temp compatability */ +#define inc_fport inc_ie.ie_fport +#define inc_lport inc_ie.ie_lport +#define inc_faddr inc_ie.ie_faddr +#define inc_laddr inc_ie.ie_laddr +#define inc6_faddr inc_ie.ie6_faddr +#define inc6_laddr inc_ie.ie6_laddr +#define inc_route inc_dependroute.inc4_route +#define inc6_route inc_dependroute.inc6_route + +/* + * NB: the zone allocator is type-stable EXCEPT FOR THE FIRST TWO LONGS + * of the structure. Therefore, it is important that the members in + * that position not contain any information which is required to be + * stable. + */ +struct icmp6_filter; + +struct inpcb { + LIST_ENTRY(inpcb) inp_hash; /* hash list */ + LIST_ENTRY(inpcb) inp_list; /* list for all PCBs of this proto */ + u_int32_t inp_flow; + + /* local and foreign ports, local and foreign addr */ + struct in_conninfo inp_inc; + + caddr_t inp_ppcb; /* pointer to per-protocol pcb */ + struct inpcbinfo *inp_pcbinfo; /* PCB list info */ + struct socket *inp_socket; /* back pointer to socket */ + /* list for this PCB's local port */ + int inp_flags; /* generic IP/datagram flags */ + + struct inpcbpolicy *inp_sp; /* for IPSEC */ + u_char inp_vflag; /* IP version flag (v4/v6) */ +#define INP_IPV4 0x1 +#define INP_IPV6 0x2 + u_char inp_ip_ttl; /* time to live proto */ + u_char inp_ip_p; /* protocol proto */ + + /* protocol dependent part; options */ + struct { + u_char inp4_ip_tos; /* type of service proto */ + struct mbuf *inp4_options; /* IP options */ + struct ip_moptions *inp4_moptions; /* IP multicast options */ + } inp_depend4; +#define inp_fport inp_inc.inc_fport +#define inp_lport inp_inc.inc_lport +#define inp_faddr inp_inc.inc_faddr +#define inp_laddr inp_inc.inc_laddr +#define inp_route inp_inc.inc_route +#define inp_ip_tos inp_depend4.inp4_ip_tos +#define inp_options inp_depend4.inp4_options +#define inp_moptions inp_depend4.inp4_moptions + struct { + /* IP options */ + struct mbuf *inp6_options; + /* IP6 options for outgoing packets */ + struct ip6_pktopts *inp6_outputopts; + /* IP multicast options */ + struct ip6_moptions *inp6_moptions; + /* ICMPv6 code type filter */ + struct icmp6_filter *inp6_icmp6filt; + /* IPV6_CHECKSUM setsockopt */ + int inp6_cksum; + u_short inp6_ifindex; + short inp6_hops; + u_int8_t inp6_hlim; + } inp_depend6; + LIST_ENTRY(inpcb) inp_portlist; + struct inpcbport *inp_phd; /* head of this list */ + inp_gen_t inp_gencnt; /* generation count of this instance */ +#define in6p_faddr inp_inc.inc6_faddr +#define in6p_laddr inp_inc.inc6_laddr +#define in6p_route inp_inc.inc6_route +#define in6p_ip6_hlim inp_depend6.inp6_hlim +#define in6p_hops inp_depend6.inp6_hops /* default hop limit */ +#define in6p_ip6_nxt inp_ip_p +#define in6p_flowinfo inp_flow +#define in6p_vflag inp_vflag +#define in6p_options inp_depend6.inp6_options +#define in6p_outputopts inp_depend6.inp6_outputopts +#define in6p_moptions inp_depend6.inp6_moptions +#define in6p_icmp6filt inp_depend6.inp6_icmp6filt +#define in6p_cksum inp_depend6.inp6_cksum +#define inp6_ifindex inp_depend6.inp6_ifindex +#define in6p_flags inp_flags /* for KAME src sync over BSD*'s */ +#define in6p_socket inp_socket /* for KAME src sync over BSD*'s */ +#define in6p_lport inp_lport /* for KAME src sync over BSD*'s */ +#define in6p_fport inp_fport /* for KAME src sync over BSD*'s */ +#define in6p_ppcb inp_ppcb /* for KAME src sync over BSD*'s */ +}; +/* + * The range of the generation count, as used in this implementation, + * is 9e19. We would have to create 300 billion connections per + * second for this number to roll over in a year. This seems sufficiently + * unlikely that we simply don't concern ourselves with that possibility. + */ +/* + * Interface exported to userland by various protocols which use + * inpcbs. Hack alert -- only define if struct xsocket is in scope. + */ +#ifdef _SYS_SOCKETVAR_H_ +struct xinpcb { + size_t xi_len; /* length of this structure */ + struct inpcb xi_inp; + struct xsocket xi_socket; + u_quad_t xi_alignment_hack; +}; + +struct xinpgen { + size_t xig_len; /* length of this structure */ + u_int xig_count; /* number of PCBs at this time */ + inp_gen_t xig_gen; /* generation count at this time */ + so_gen_t xig_sogen; /* socket generation count at this time */ +}; +#endif /* _SYS_SOCKETVAR_H_ */ + +struct inpcbport { + LIST_ENTRY(inpcbport) phd_hash; + struct inpcbhead phd_pcblist; + u_short phd_port; +}; + +struct inpcbinfo { /* XXX documentation, prefixes */ + struct inpcbhead *hashbase; + u_long hashmask; + struct inpcbporthead *porthashbase; + u_long porthashmask; + struct inpcbhead *listhead; + u_short lastport; + u_short lastlow; + u_short lasthi; + u_int ipi_count; /* number of pcbs in this list */ + u_quad_t ipi_gencnt; /* current generation count */ + u_short ipi_size; /* DS_SZ for UDP/TCP/RawIP*/ + u_short ipi_zone; /* DS_ID for UDP/TCP/RawIP*/ + +}; + +#define INP_PCBHASH(faddr, lport, fport, mask) \ + (((faddr) ^ ((faddr) >> 16) ^ ntohs((lport) ^ (fport))) & (mask)) +#define INP_PCBPORTHASH(lport, mask) \ + (ntohs((lport)) & (mask)) + +/* flags in inp_flags: */ +#define INP_RECVOPTS 0x01 /* receive incoming IP options */ +#define INP_RECVRETOPTS 0x02 /* receive IP options for reply */ +#define INP_RECVDSTADDR 0x04 /* receive IP dst address */ +#define INP_HDRINCL 0x08 /* user supplies entire IP header */ +#define INP_HIGHPORT 0x10 /* user wants "high" port binding */ +#define INP_LOWPORT 0x20 /* user wants "low" port binding */ +#define INP_ANONPORT 0x40 /* port chosen for user */ +#define INP_RECVIF 0x80 /* receive incoming interface */ +#define INP_MTUDISC 0x100 /* user can do MTU discovery */ +#define INP_FAITH 0x200 /* accept FAITH'ed connections */ +#define INP_RECVTTL 0x400 /* receive incoming IP TTL */ + +#define INP_NOFREE 0x004000 /* don't free PCB in in_pcbdetach() */ + +#define IN6P_IPV6_V6ONLY 0x008000 /* restrict AF_INET6 socket for v6 */ + +#define IN6P_PKTINFO 0x010000 /* receive IP6 dst and I/F */ +#define IN6P_HOPLIMIT 0x020000 /* receive hoplimit */ +#define IN6P_HOPOPTS 0x040000 /* receive hop-by-hop options */ +#define IN6P_DSTOPTS 0x080000 /* receive dst options after rthdr */ +#define IN6P_RTHDR 0x100000 /* receive routing header */ +#define IN6P_RTHDRDSTOPTS 0x200000 /* receive dstoptions before rthdr */ +#define IN6P_TCLASS 0x400000 /* receive traffic class value */ +#define IN6P_AUTOFLOWLABEL 0x800000 /* attach flowlabel automatically */ +#define IN6P_RFC2292 0x40000000 /* used RFC2292 API on the socket */ +#define IN6P_MTU 0x80000000 /* receive path MTU */ + +#define INP_CONTROLOPTS (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR|\ + INP_RECVIF|\ + IN6P_PKTINFO|IN6P_HOPLIMIT|IN6P_HOPOPTS|\ + IN6P_DSTOPTS|IN6P_RTHDR|IN6P_RTHDRDSTOPTS|\ + IN6P_AUTOFLOWLABEL) +#define INP_UNMAPPABLEOPTS (IN6P_HOPOPTS|IN6P_DSTOPTS|IN6P_RTHDR|\ + IN6P_AUTOFLOWLABEL) + + /* for KAME src sync over BSD*'s */ +#define IN6P_HIGHPORT INP_HIGHPORT +#define IN6P_LOWPORT INP_LOWPORT +#define IN6P_ANONPORT INP_ANONPORT +#define IN6P_RECVIF INP_RECVIF +#define IN6P_MTUDISC INP_MTUDISC +#define IN6P_FAITH INP_FAITH + +#define IN6P_CONTROLOPTS (IN6P_PKTINFO|IN6P_HOPLIMIT|IN6P_HOPOPTS|\ + IN6P_DSTOPTS|IN6P_RTHDR|IN6P_RTHDRDSTOPTS|\ + IN6P_TCLASS|IN6P_AUTOFLOWLABEL|IN6P_RFC2292|\ + IN6P_MTU) + + /* + * socket AF version is {newer than,or include} + * actual datagram AF version + */ + +#define INPLOOKUP_WILDCARD 1 +#define IN6PLOOKUP_SETLOCAL 2 + +#define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb) +#define sotoin6pcb(so) sotoinpcb(so) /* for KAME src sync over BSD*'s */ + +#define INP_SOCKAF(so) so->so_proto->pr_domain->dom_family + +#define INP_CHECK_SOCKAF(so, af) (INP_SOCKAF(so) == af) +#define INP_CHECK_VERSION(so) ((sotoinpcb(so))->inp_vflag) + +#ifdef _WRS_KERNEL +#ifndef VIRTUAL_STACK +extern int ipport_lowfirstauto; +extern int ipport_lowlastauto; +extern int ipport_firstauto; +extern int ipport_lastauto; +extern int ipport_hifirstauto; +extern int ipport_hilastauto; +#endif /* !VIRTUAL_STACK */ + +void in_pcbpurgeif0 __P((struct inpcb *, struct ifnet *)); +void in_losing __P((struct inpcb *)); +void in_rtchange __P((struct inpcb *, int)); +int in_pcballoc __P((struct socket *, struct inpcbinfo *, struct proc *)); +int in_pcbbind __P((struct inpcb *, struct sockaddr *, struct proc *)); +int in_pcbconnect __P((struct inpcb *, struct sockaddr *, struct proc *)); +void in_pcbdetach __P((struct inpcb *)); +void in_pcbdisconnect __P((struct inpcb *)); +int in_pcbinshash __P((struct inpcb *)); +int in_pcbladdr __P((struct inpcb *, struct sockaddr *, + struct sockaddr_in **)); +struct inpcb * + in_pcblookup_local __P((struct inpcbinfo *, + struct in_addr, u_int, int)); +struct inpcb * + in_pcblookup_hash __P((struct inpcbinfo *, + struct in_addr, u_int, struct in_addr, u_int, + int, struct ifnet *)); +void in_pcbnotifyall __P((struct inpcbhead *, struct in_addr, + int, void (*)(struct inpcb *, int))); +void in_pcbrehash __P((struct inpcb *)); +int in_setpeeraddr __P((struct socket *so, struct sockaddr **nam)); +int in_setsockaddr __P((struct socket *so, struct sockaddr **nam)); +void in_pcbremlists __P((struct inpcb *inp)); + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_NETINET_IN_PCB_H_ */ diff --git a/h/wrn/coreip/netinet/in_systm.h b/h/wrn/coreip/netinet/in_systm.h new file mode 100644 index 0000000..adfd6b7 --- /dev/null +++ b/h/wrn/coreip/netinet/in_systm.h @@ -0,0 +1,90 @@ +/* in_systm.h - miscellaneous internetwork definitions for kernel */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)in_systm.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/in_systm.h,v 1.9 1999/12/29 04:41:00 peter Exp $ + */ + +/* +modification history +-------------------- +01h,07feb05,vvv _KERNEL cleanup +01g,20nov03,niq Remove copyright_wrs.h file inclusion +01f,05nov03,cdw Removal of unnecessary _KERNEL guards. +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01c,10jun03,vvv include netVersion.h +01b,09sep02,hsh add c++ protection +01a,23aug01,ann ported to clarinet from freeBSD 4.3 version 1.9 +*/ + + +#ifndef _NETINET_IN_SYSTM_H_ +#define _NETINET_IN_SYSTM_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * Miscellaneous internetwork + * definitions for kernel. + */ + +/* + * Network types. + * + * Internally the system keeps counters in the headers with the bytes + * swapped so that VAX instructions will work on them. It reverses + * the bytes before transmission at each protocol level. The n_ types + * represent the types with the bytes in ``high-ender'' order. + */ +typedef u_int16_t n_short; /* short as received from the net */ +typedef u_int32_t n_long; /* long as received from the net */ + +typedef u_int32_t n_time; /* ms since 00:00 GMT, byte rev */ + +#ifdef _WRS_KERNEL +n_time iptime __P((void)); +#endif + +#ifdef __cplusplus + } +#endif + +#endif diff --git a/h/wrn/coreip/netinet/in_var.h b/h/wrn/coreip/netinet/in_var.h new file mode 100644 index 0000000..f11fcec --- /dev/null +++ b/h/wrn/coreip/netinet/in_var.h @@ -0,0 +1,396 @@ +/* in_var.h - in_var header file */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* + * Copyright (c) 1985, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)in_var.h 8.2 (Berkeley) 1/9/95 + * $FreeBSD: src/sys/netinet/in_var.h,v 1.33.2.3 2001/12/14 20:09:34 jlemon Exp $ + */ + +/* + * Copyright (c) 2002 INRIA. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by INRIA and its + * contributors. + * 4. Neither the name of INRIA nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +/* + * Implementation of Internet Group Management Protocol, Version 3. + * + * Developed by Hitoshi Asaeda, INRIA, February 2002. + */ + +/* +modification history +-------------------- +02a,25aug05,dlk Add section tags. +01z,13jul05,dlk Added ipintrqJob declaration. +01y,29jun05,spm updated for IGMPv3 support +01x,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +01w,02mar05,niq Make router alert support scalable +01v,25feb05,niq merge from niqbal.tor3.mroute for IP router alert changes +01u,07feb05,vvv _KERNEL cleanup +01t,31jan05,niq virtual stack changes for sysctl +01s,24jan05,vvv osdep.h cleanup +01r,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01q,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/2) +01p,25nov03,ppp added a comment around the inclusion of in6_var.h +01o,21nov03,ppp rtp work +01n,20nov03,niq Remove copyright_wrs.h file inclusion +01m,04nov03,rlm Ran batch header path update for header re-org. +01l,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01k,23oct03,rlm updated #includes for header re-org +01j,07aug03,niq Merging from Accordion label ACCORDION_BASE6_MERGE_BASELINE +01i,23jul03,vvv added _KERNEL protection to fix warnings (SPR #89813) +01h,09may03,vvv included if.h +01g,01feb03,pas merge from FreeBSD 4.7 - added hash table for IP addresses +01f,09sep02,hsh add c++ protection +01e,28mar02,ppp modified it for backward compatibilty with A.E. 1.1 +01d,03dec01,niq Sysctl changes for Clarinet +01c,02oct01,ppp removing the guaed for in6_var.h +01b,18sep01,ppp temporarily guarding in6_var.h by INET6 for the link process +01a,27aug01,hsh Created from FreeBSD 4.3 +*/ + + +#ifndef _NETINET_IN_VAR_H_ +#define _NETINET_IN_VAR_H_ + +#include + +#ifdef _WRS_KERNEL +#include +#endif + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +struct in_ifrtchange_arg { + int routeUsage; + struct ifnet *ifp; + int enable; + u_char flag;/* not used currently */ +}; + +/* + * Interface address, Internet version. One of these structures + * is allocated for each Internet address on an interface. + * The ifaddr structure contains the protocol-independent part + * of the structure and is assumed to be first. + */ +struct in_ifaddr { + struct ifaddr ia_ifa; /* protocol-independent info */ +#define ia_ifp ia_ifa.ifa_ifp +#define ia_flags ia_ifa.ifa_flags + /* ia_{,sub}net{,mask} in host order */ + u_long ia_net; /* network number of interface */ + u_long ia_netmask; /* mask of net part */ + u_long ia_subnet; /* subnet number, including net */ + u_long ia_subnetmask; /* mask of subnet part */ + struct in_addr ia_netbroadcast; /* to recognize net broadcasts */ + LIST_ENTRY(in_ifaddr) ia_hash; /* entry in bucket of inet addresses */ + TAILQ_ENTRY(in_ifaddr) ia_link; /* list of internet addresses */ + struct sockaddr_in ia_addr; /* reserve space for interface name */ + struct sockaddr_in ia_dstaddr; /* reserve space for broadcast addr */ +#define ia_broadaddr ia_dstaddr + struct sockaddr_in ia_sockmask; /* reserve space for general netmask */ +}; + +struct in_aliasreq { + char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + struct sockaddr_in ifra_addr; + struct sockaddr_in ifra_broadaddr; +#define ifra_dstaddr ifra_broadaddr + struct sockaddr_in ifra_mask; +}; +/* + * Given a pointer to an in_ifaddr (ifaddr), + * return a pointer to the addr as a sockaddr_in. + */ +#define IA_SIN(ia) (&(((struct in_ifaddr *)(ia))->ia_addr)) +#define IA_DSTSIN(ia) (&(((struct in_ifaddr *)(ia))->ia_dstaddr)) + +#define IN_LNAOF(in, ifa) \ + ((ntohl((in).s_addr) & ~((struct in_ifaddr *)(ifa)->ia_subnetmask)) + + +#ifdef _WRS_KERNEL +#ifndef VIRTUAL_STACK +extern TAILQ_HEAD(in_ifaddrhead, in_ifaddr) _in_ifaddrhead; +extern struct ifqueue ipintrq; /* ip packet input queue (loopback only) */ +extern INTRQ_QJOB ipintrqJob; +#endif /* !VIRTUAL_STACK */ +extern u_char inetctlerrmap[]; + +/* + * Hash table for IP addresses. + */ + +extern LIST_HEAD(in_ifaddrhashhead, in_ifaddr) *in_ifaddrhashtbl; + +#ifndef VIRTUAL_STACK +extern u_long in_ifaddrhmask; /* mask for hash table */ +#endif /* !VIRTUAL_STACK */ + +#define INADDR_NHASH_LOG2 9 +#define INADDR_NHASH (1 << INADDR_NHASH_LOG2) + +#define INADDR_HASHVAL(x) fnv_32_buf((&(x)), sizeof(x), FNV1_32_INIT) +#define INADDR_HASH(x) \ + (&in_ifaddrhashtbl[INADDR_HASHVAL(x) & in_ifaddrhmask]) + + +/* + * Macro for finding the interface (ifnet structure) corresponding to one + * of our IP addresses. + */ +#define INADDR_TO_IFP(addr, ifp) \ + /* struct in_addr addr; */ \ + /* struct ifnet *ifp; */ \ +{ \ + struct in_ifaddr *_ia_; \ +\ + LIST_FOREACH(_ia_, INADDR_HASH((addr).s_addr), ia_hash) \ + if (IA_SIN(_ia_)->sin_addr.s_addr == (addr).s_addr) \ + break; \ + (ifp) = (_ia_ == NULL) ? NULL : _ia_->ia_ifp; \ +} + +/* + * Macro for finding the internet address structure (in_ifaddr) corresponding + * to a given interface (ifnet structure). + */ +#define IFP_TO_IA(ifp, ia) \ + /* struct ifnet *ifp; */ \ + /* struct in_ifaddr *ia; */ \ +{ \ + for ((ia) = TAILQ_FIRST(&_in_ifaddrhead); \ + (ia) != NULL && (ia)->ia_ifp != (ifp); \ + (ia) = TAILQ_NEXT((ia), ia_link)) \ + continue; \ +} + +/* + * This information should be part of the ifnet structure but we don't wish + * to change that - as it might break a number of things + */ + +struct router_info { + struct ifnet *rti_ifp; + int rti_type; /* type of router which is querier on this interface */ + int rti_time; /* # of slow timeouts since last old query */ + struct router_info *rti_next; + u_int rti_timer1; /* IGMPv1 Querier Present timer */ + u_int rti_timer2; /* IGMPv2 Querier Present timer */ + u_int rti_timer3; /* IGMPv3 General Query (interface) timer */ + u_int rti_qrv; /* Querier Robustness Variable */ + u_int rti_qqi; /* Querier Interval Variable */ + u_int rti_qri; /* Querier Response Interval */ +}; + +/* + * Internet multicast address structure. There is one of these for each IP + * multicast group to which this host belongs on a given network interface. + * For every entry on the interface's if_multiaddrs list which represents + * an IP multicast group, there is one of these structures. They are also + * kept on a system-wide list to make it easier to keep our legacy IGMP code + * compatible with the rest of the world (see IN_FIRST_MULTI et al, below). + */ +struct in_multi { + LIST_ENTRY(in_multi) inm_link; /* queue macro glue */ + struct in_addr inm_addr; /* IP multicast address, convenience */ + struct ifnet *inm_ifp; /* back pointer to ifnet */ + struct ifmultiaddr *inm_ifma; /* back pointer to ifmultiaddr */ + u_int inm_timer; /* IGMP membership report timer */ + u_int inm_state; /* state of the membership */ + struct router_info *inm_rti; /* router info*/ + struct in_multi_source *inm_source; /* filtered source list */ +}; + + +#ifdef ROUTER_ALERT +/* Router alert socket list */ +struct ralcb { + LIST_ENTRY(ralcb) list; + struct socket *ral_socket; /* back pointer to socket */ + struct sockproto ral_proto; /* protocol family, protocol */ +}; +#endif /* ROUTER_ALERT */ + +#ifdef SYSCTL_DECL +SYSCTL_DECL(_net_inet_ip); +SYSCTL_DECL(_net_inet_raw); +#else +#include +#ifndef VIRTUAL_STACK +SYSCTL_DECL_NODE_EXT(ip); +SYSCTL_DECL_NODE_EXT(raw); +#endif /* VIRTUAL_STACK */ +#endif + +#ifndef VIRTUAL_STACK +extern LIST_HEAD(in_multihead, in_multi) _in_multihead; +#ifdef ROUTER_ALERT +extern LIST_HEAD(ralcb_list_head, ralcb) ralcb_list; +#endif /* ROUTER_ALERT */ +#else +#ifdef ROUTER_ALERT +LIST_HEAD(ralcb_list_head, ralcb); +#endif /* ROUTER_ALERT */ +#endif /* !VIRTUAL_STACK */ + +/* + * Structure used by macros below to remember position when stepping through + * all of the in_multi records. + */ +struct in_multistep { + struct in_multi *i_inm; +}; + +/* + * Macro for looking up the in_multi record for a given IP multicast address + * on a given interface. If no matching record is found, "inm" is set null. + */ +#define IN_LOOKUP_MULTI(addr, ifp, inm) \ + /* struct in_addr addr; */ \ + /* struct ifnet *ifp; */ \ + /* struct in_multi *inm; */ \ +do { \ + struct ifmultiaddr *ifma; \ +\ + LIST_FOREACH(ifma, &((ifp)->if_multiaddrs), ifma_link) { \ + if (ifma->ifma_addr->sa_family == AF_INET \ + && ((struct sockaddr_in *)ifma->ifma_addr)->sin_addr.s_addr == \ + (addr).s_addr) \ + break; \ + } \ + (inm) = ifma ? ifma->ifma_protospec : 0; \ +} while(0) + +/* + * Macro to step through all of the in_multi records, one at a time. + * The current position is remembered in "step", which the caller must + * provide. IN_FIRST_MULTI(), below, must be called to initialize "step" + * and get the first record. Both macros return a NULL "inm" when there + * are no remaining records. + */ +#define IN_NEXT_MULTI(step, inm) \ + /* struct in_multistep step; */ \ + /* struct in_multi *inm; */ \ +do { \ + if (((inm) = (step).i_inm) != NULL) \ + (step).i_inm = LIST_NEXT((step).i_inm, inm_link); \ +} while(0) + +#define IN_FIRST_MULTI(step, inm) \ + /* struct in_multistep step; */ \ + /* struct in_multi *inm; */ \ +do { \ + (step).i_inm = LIST_FIRST(&_in_multihead); \ + IN_NEXT_MULTI((step), (inm)); \ +} while(0) + +struct route; + +#ifdef IGMPV3 +struct in_multi *in_addmulti (struct in_addr *, struct ifnet *, u_int16_t, + struct sockaddr_storage *, u_int, int, int *); +void in_delmulti (struct in_multi *, u_int16_t, struct sockaddr_storage *, + u_int, int, int *); +#else +struct in_multi *in_addmulti __P((struct in_addr *, struct ifnet *)); +void in_delmulti __P((struct in_multi *)); +#endif /* IGMPV3 */ + +int in_control __P((struct socket *, u_long, caddr_t, struct ifnet *, + struct proc *)); +void in_rtqdrain __P((void)); +_WRS_FASTTEXT +void ip_input __P((struct mbuf *)); +int in_ifadown __P((struct ifaddr *ifa, int)); +int in_ifrtchange __P((struct ifnet *ifp, int )); +void in_changeblackholes __P((struct rtentry *rt, void *xap)); +BOOL in_ifscrub __P((struct ifnet *, struct in_ifaddr *)); +int ipflow_fastforward __P((struct mbuf *)); +void ipflow_create __P((const struct route *, struct mbuf *)); +void ipflow_slowtimo __P((void)); + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +/* INET6 stuff */ +#ifdef _WRS_KERNEL /* Temporary workaround */ +#include +#endif /* Temporary workaround */ + +#endif /* _NETINET_IN_VAR_H_ */ diff --git a/h/wrn/coreip/netinet/ip.h b/h/wrn/coreip/netinet/ip.h new file mode 100644 index 0000000..c4d2666 --- /dev/null +++ b/h/wrn/coreip/netinet/ip.h @@ -0,0 +1,243 @@ +/* ip.h - ip head file */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip.h 8.2 (Berkeley) 6/1/94 + * $FreeBSD: src/sys/netinet/ip.h,v 1.25 2003/10/29 15:07:03 ume Exp $ + * $FreeBSD: src/sys/netinet/ip.h,v 1.17 1999/12/22 19:13:20 shin Exp $ + */ + +/* +modification history +-------------------- +01k,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +01j,15feb05,vvv include in_systm.h only in kernel +01i,07feb05,vvv _KERNEL cleanup +01h,14jan05,vvv osdep.h cleanup +01g,20nov03,niq Remove copyright_wrs.h file inclusion +01f,04nov03,rlm Ran batch header path update for header re-org. +01e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01d,07aug03,niq Merging from Accordion label ACCORDION_BASE6_MERGE_BASELINE +01c,09may03,vvv included in.h and in_systm.h +01b,09sep02,hsh add c++ protection +01a,23aug01,ann ported to clarinet from freeBSD 4.3 version 1.17 + */ + +#ifndef _NETINET_IP_H_ +#define _NETINET_IP_H_ + +#ifdef __cplusplus + extern "C" { +#endif + +#include + +#ifdef _WRS_KERNEL +#include +#endif + +/* + * Definitions for internet protocol version 4. + * Per RFC 791, September 1981. + */ +#define IPVERSION 4 + +/* + * Structure of an internet header, naked of options. + */ +struct ip { +#ifdef _IP_VHL + u_char ip_vhl; /* version << 4 | header length >> 2 */ +#else +#if _BYTE_ORDER == _LITTLE_ENDIAN + u_int ip_hl:4, /* header length */ + ip_v:4; /* version */ +#endif +#if _BYTE_ORDER == _BIG_ENDIAN + u_int ip_v:4, /* version */ + ip_hl:4; /* header length */ +#endif +#endif /* not _IP_VHL */ + u_char ip_tos; /* type of service */ + u_short ip_len; /* total length */ + u_short ip_id; /* identification */ + u_short ip_off; /* fragment offset field */ +#define IP_RF 0x8000 /* reserved fragment flag */ +#define IP_DF 0x4000 /* dont fragment flag */ +#define IP_MF 0x2000 /* more fragments flag */ +#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ + u_char ip_ttl; /* time to live */ + u_char ip_p; /* protocol */ + u_short ip_sum; /* checksum */ + struct in_addr ip_src,ip_dst; /* source and dest address */ +}; + +#ifdef _IP_VHL +#define IP_MAKE_VHL(v, hl) ((v) << 4 | (hl)) +#define IP_VHL_HL(vhl) ((vhl) & 0x0f) +#define IP_VHL_V(vhl) ((vhl) >> 4) +#define IP_VHL_BORING 0x45 +#endif + +#define IP_MAXPACKET 65535 /* maximum packet size */ + +/* + * Definitions for IP type of service (ip_tos) + */ +#define IPTOS_LOWDELAY 0x10 +#define IPTOS_THROUGHPUT 0x08 +#define IPTOS_RELIABILITY 0x04 +#define IPTOS_MINCOST 0x02 +#if 1 +/* ECN RFC3168 obsoletes RFC2481, and these will be deprecated soon. */ +/* ECN bits proposed by Sally Floyd */ +#define IPTOS_CE 0x01 /* congestion experienced */ +#define IPTOS_ECT 0x02 /* ECN-capable transport */ +#endif + +/* + * Definitions for IP precedence (also in ip_tos) (hopefully unused) + */ +#define IPTOS_PREC_NETCONTROL 0xe0 +#define IPTOS_PREC_INTERNETCONTROL 0xc0 +#define IPTOS_PREC_CRITIC_ECP 0xa0 +#define IPTOS_PREC_FLASHOVERRIDE 0x80 +#define IPTOS_PREC_FLASH 0x60 +#define IPTOS_PREC_IMMEDIATE 0x40 +#define IPTOS_PREC_PRIORITY 0x20 +#define IPTOS_PREC_ROUTINE 0x00 + +/* + * ECN (Explicit Congestion Notification) codepoints in RFC3168 + * mapped to the lower 2 bits of the TOS field. + */ +#define IPTOS_ECN_NOTECT 0x00 /* not-ECT */ +#define IPTOS_ECN_ECT1 0x01 /* ECN-capable transport (1) */ +#define IPTOS_ECN_ECT0 0x02 /* ECN-capable transport (0) */ +#define IPTOS_ECN_CE 0x03 /* congestion experienced */ +#define IPTOS_ECN_MASK 0x03 /* ECN field mask */ + +/* + * Definitions for options. + */ +#define IPOPT_COPIED(o) ((o)&0x80) +#define IPOPT_CLASS(o) ((o)&0x60) +#define IPOPT_NUMBER(o) ((o)&0x1f) + +#define IPOPT_CONTROL 0x00 +#define IPOPT_RESERVED1 0x20 +#define IPOPT_DEBMEAS 0x40 +#define IPOPT_RESERVED2 0x60 + +#define IPOPT_EOL 0 /* end of option list */ +#define IPOPT_NOP 1 /* no operation */ + +#define IPOPT_RR 7 /* record packet route */ +#define IPOPT_TS 68 /* timestamp */ +#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */ +#define IPOPT_LSRR 131 /* loose source route */ +#define IPOPT_ESO 133 /* extended security */ +#define IPOPT_CIPSO 134 /* commerical security */ +#define IPOPT_SATID 136 /* satnet id */ +#define IPOPT_SSRR 137 /* strict source route */ +#define IPOPT_RA 148 /* router alert */ + +/* + * Offsets to fields in options other than EOL and NOP. + */ +#define IPOPT_OPTVAL 0 /* option ID */ +#define IPOPT_OLEN 1 /* option length */ +#define IPOPT_OFFSET 2 /* offset within option */ +#define IPOPT_MINOFF 4 /* min value of above */ + +/* + * Time stamp option structure. + */ +struct ip_timestamp { + u_char ipt_code; /* IPOPT_TS */ + u_char ipt_len; /* size of structure (variable) */ + u_char ipt_ptr; /* index of current entry */ +#if _BYTE_ORDER == _LITTLE_ENDIAN + u_int ipt_flg:4, /* flags, see below */ + ipt_oflw:4; /* overflow counter */ +#endif +#if _BYTE_ORDER == _BIG_ENDIAN + u_int ipt_oflw:4, /* overflow counter */ + ipt_flg:4; /* flags, see below */ +#endif + union ipt_timestamp { + u_long ipt_time[1]; + struct ipt_ta { + struct in_addr ipt_addr; + u_long ipt_time; + } ipt_ta[1]; + } ipt_timestamp; +}; + +/* flag bits for ipt_flg */ +#define IPOPT_TS_TSONLY 0 /* timestamps only */ +#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ +#define IPOPT_TS_PRESPEC 3 /* specified modules only */ + +/* bits for security (not byte swapped) */ +#define IPOPT_SECUR_UNCLASS 0x0000 +#define IPOPT_SECUR_CONFID 0xf135 +#define IPOPT_SECUR_EFTO 0x789a +#define IPOPT_SECUR_MMMM 0xbc4d +#define IPOPT_SECUR_RESTR 0xaf13 +#define IPOPT_SECUR_SECRET 0xd788 +#define IPOPT_SECUR_TOPSECRET 0x6bc5 + +/* + * Internet implementation parameters. + */ +#define MAXTTL 255 /* maximum time to live (seconds) */ +#define IPDEFTTL 64 /* default ttl, from RFC 1340 */ +#define IPFRAGTTL 60 /* time to live for frags, slowhz */ +#define IPTTLDEC 1 /* subtracted when forwarding */ + +#define IP_MSS 576 /* default maximum segment size */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/netinet/ip4_ext_in.h b/h/wrn/coreip/netinet/ip4_ext_in.h new file mode 100644 index 0000000..50423ce --- /dev/null +++ b/h/wrn/coreip/netinet/ip4_ext_in.h @@ -0,0 +1,121 @@ +/* ip4_ext_in.h - typedefs and externs for the external hooks + * used by the IPv4 stack on the input side + */ + +/* + * Copyright (c) 2002-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +01h,07jul05,kch Added _igmpGetRouterAlertHook function pointer. +01g,25feb05,niq merge mroute changes from comp_wn_ipv6_multicast_interim-dev + branch (ver 1) +01f,20sep04,rae fix prototype for MCAST_ROUTE_FWD_FUNCPTR +01e,13may04,sar Remove natpt hook and handle vs better +01d,20nov03,niq Remove copyright_wrs.h file inclusion +01c,07aug03,nee Merging to Base6 from ACCORDION_BASE6_MERGE_BASELINE label on + Accordion codeline +01b,26feb03,vvv added multicast hook +01a,11sep02,sar written +*/ + +#ifndef __INCip4ExtInh +#define __INCip4ExtInh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This file contains typedefs for some of the hooks used by the IPv4 stack. + * The similar hooks used by the IPv6 stack can be found in a different file. + * The functions are separated in order to minimize the include files required + * to use all one set of functions. + */ + +/* + * This is the general typedef for the input side for IPv4. + * It should be used by all hooks that don't require a more specific API, + * however due to pragmatic concerns about changing pre-existing APIs + * several older hooks use different APIs. + */ + +typedef BOOL (*INPUT_HOOK_IPV4_FUNCPTR) (struct ifnet * rcvif, + struct mbuf ** m, + struct ip ** ip, + int hlen); +/* + * Typedef used for proxy arp + */ +typedef void (*PROXY_BROADCAST_FUNCPTR) (struct mbuf * m, + struct ifnet * rcvif); + +/* + * The typedefs used by the WindRiver IP Security functions. + */ +typedef int (*IPSEC_FILTER_HOOK_FUNCPTR) (struct mbuf ** m, + struct ip ** ip, + int hlen); + +typedef int (*IPSEC_INPUT_FUNCPTR) (struct mbuf ** m, + int hlen, + struct ip ** ip); + +/* + * And the typedef used for multicast forwarding + */ +typedef int (*MCAST_ROUTE_FWD_FUNCPTR) (struct ip * ip, + struct ifnet * rcvif, + struct mbuf * m, + struct ip_moptions * imo); + +/* + * Externals and macros for the currently defined hooks + * If we are compiling for virtual stacks we specify them + * in the vs .h file instead of here. + */ + +#ifndef VIRTUAL_STACK + +/* general use */ +extern INPUT_HOOK_IPV4_FUNCPTR _ipFilterHook; +#define SET_IPFILTERHOOK(foo) (_ipFilterHook = foo) + +/* IP security */ +extern IPSEC_FILTER_HOOK_FUNCPTR _ipsecFilterHook; +extern IPSEC_INPUT_FUNCPTR _ipsecInput; + +#define SET_IPSECFILTERHOOK(foo) (_ipsecFilterHook = foo) +#define SET_IPSECINPUT(foo) (_ipsecInput = foo) + +/* for backwards compatibility */ +#define _func_ipsecFilterHook _ipsecFilterHook +#define _func_ipsecInput _ipsecInput + +/* Proxy broadcast */ +extern PROXY_BROADCAST_FUNCPTR proxyBroadcastHook; +#define SET_PROXYBROADCASTHOOK(foo) (proxyBroadcastHook = foo) + +/* Multicast separation */ +extern MCAST_ROUTE_FWD_FUNCPTR mCastRouteFwdHook; +extern FUNCPTR _mCastRouteCmdHook; +#define SET_MCASTROUTEFWDHOOK(foo) (mCastRouteFwdHook = foo) + +/* IGMP hooks */ +extern FUNCPTR _igmpGetRouterAlertHook; + +#endif /* #ifndef VIRTUAL_STACK */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCip4ExtInh */ diff --git a/h/wrn/coreip/netinet/ip4_ext_out.h b/h/wrn/coreip/netinet/ip4_ext_out.h new file mode 100644 index 0000000..d9e0c6c --- /dev/null +++ b/h/wrn/coreip/netinet/ip4_ext_out.h @@ -0,0 +1,75 @@ +/* ip4_ext_out.h - typedefs and externs for the external hooks + * used by the IPv4 stack on the output side */ + +/* Copyright 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,20nov03,niq Remove copyright_wrs.h file inclusion +01a,07aug03,nee Merging to Base6 from ACCORDION_BASE6_MERGE_BASELINE label on + Accordion codeline + +*/ + +#ifndef __INCip4ExtOuth +#define __INCip4ExtOuth + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This file contains typedefs for some of the hooks used by the IPv4 stack. + * as well as a general sizing function used in both cases. + * The similar hooks used by the IPv6 stack can be found in a different file. + * The functions are separated in order to minimize the include files required + * to use all one set of functions. + */ + +typedef int (*IPSEC_OUTPUT_FUNCPTR) (struct mbuf ** m, + struct mbuf * options, + struct route * ro, + int flags, + struct ip_moptions * imo, + struct sockaddr_in * dest, + struct in_ifaddr * ia); + +/* + * This is a generic function that may be used for either v4 or v6 packets. + */ +typedef size_t (*SIZING_ROUTINE_FUNCPTR) (struct mbuf * m, + struct ifnet * ifp); + +/* This routine is for applications to call to determine how much + space to reserve for other modules such as IPSec */ +extern size_t hdrSizeFunction (struct mbuf * m, struct ifnet * ifp); + + +#ifndef VIRTUAL_STACK +/* We only define the externals and macros here if we aren't supporting + * virtual stacks. If we are supporting them then the corresponding + * definitions are in vsIp.h + */ + +/* + * Externals for the currently defined hooks. + */ + +extern IPSEC_OUTPUT_FUNCPTR _ipsecOutput; +extern SIZING_ROUTINE_FUNCPTR _ipsecSizing; + +#define SET_IPSECOUTPUT(foo) (_ipsecOutput = foo) +#define SET_IPSECSIZING(foo) (_ipsecSizing = foo) + +/* for backwards compatibility */ +#define _func_ipsecOutput _ipsecOutput + +#endif /* #ifndef VIRTUAL_STACK */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCip4ExtOuth */ + diff --git a/h/wrn/coreip/netinet/ip6.h b/h/wrn/coreip/netinet/ip6.h new file mode 100644 index 0000000..1ac7055 --- /dev/null +++ b/h/wrn/coreip/netinet/ip6.h @@ -0,0 +1,28 @@ +/* ip6.h - IPv6 protocol definitions */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01a,29jun05,vvv written +*/ + +#ifndef __INCip6h +#define __INCip6h + +/* + * This file has been added to satisfy the requirement in RFC3542 + * that ip6.h should be in the netinet directory. The copy in netinet6 + * is retained for backward compatibility. + */ + +#include + +#endif /* not __INCip6h */ diff --git a/h/wrn/coreip/netinet/ip6mh.h b/h/wrn/coreip/netinet/ip6mh.h new file mode 100644 index 0000000..01a68b2 --- /dev/null +++ b/h/wrn/coreip/netinet/ip6mh.h @@ -0,0 +1,357 @@ +/* $KAME: ip6mh.h,v 1.2 2004/12/09 02:19:00 t-momose Exp $ */ + +/* Copyright (c) 2005 Wind River Systems, Inc. */ + +/* + * Copyright (C) 2004 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +/* +modification history +-------------------- +01a,06may05,rp ported from kame ip6mh.h,v 1.2 +*/ + +#ifndef _NETINET_IP6MH_H_ +#define _NETINET_IP6MH_H_ + +/* Mobility header */ +struct ip6_mh { + u_int8_t ip6mh_proto; /* following payload protocol (for PG) */ + u_int8_t ip6mh_len; /* length in units of 8 octets */ + u_int8_t ip6mh_type; /* message type */ + u_int8_t ip6mh_reserved; + u_int16_t ip6mh_cksum; /* sum of IPv6 pseudo-header and MH */ + /* followed by type specific data */ +}; +#ifdef _WRS_KERNEL +/* Mobility header minimum length */ +#define IP6M_MINLEN 8 +#endif /* _WRS_KERNEL */ + +/* Mobility header message types */ +#define IP6_MH_TYPE_BRR 0 +#define IP6_MH_TYPE_HOTI 1 +#define IP6_MH_TYPE_COTI 2 +#define IP6_MH_TYPE_HOT 3 +#define IP6_MH_TYPE_COT 4 +#define IP6_MH_TYPE_BU 5 +#define IP6_MH_TYPE_BACK 6 +#define IP6_MH_TYPE_BERROR 7 +#define IP6_MH_TYPE_MAX 7 + +/* Binding Refresh Request (BRR) message */ +struct ip6_mh_binding_request { + struct ip6_mh ip6mhbr_hdr; + u_int16_t ip6mhbr_reserved; + /* followed by mobility options */ +}; +#ifdef _WRS_KERNEL +#define ip6mhbr_proto ip6mhbr_hdr.ip6mh_proto +#define ip6mhbr_len ip6mhbr_hdr.ip6mh_len +#define ip6mhbr_type ip6mhbr_hdr.ip6mh_type +#define ip6mhbr_reserved0 ip6mhbr_hdr.ip6mh_reserved +#define ip6mhbr_cksum ip6mhbr_hdr.ip6mh_cksum +#endif /* _WRS_KERNEL */ + +/* Home Test Init (HoTI) message */ +struct ip6_mh_home_test_init { + struct ip6_mh ip6mhhti_hdr; + u_int16_t ip6mhhti_reserved; + union { + u_int8_t __cookie8[8]; + u_int32_t __cookie32[2]; + } __ip6mhhti_cookie; + /* followed by mobility options */ +}; +#ifdef _WRS_KERNEL +#define ip6mhhti_proto ip6mhhti_hdr.ip6mh_proto +#define ip6mhhti_len ip6mhhti_hdr.ip6mh_len +#define ip6mhhti_type ip6mhhti_hdr.ip6mh_type +#define ip6mhhti_reserved0 ip6mhhti_hdr.ip6mh_reserved +#define ip6mhhti_cksum ip6mhhti_hdr.ip6mh_cksum +#define ip6mhhti_cookie8 __ip6mhhti_cookie.__cookie8 +#endif /* _WRS_KERNEL */ +#define ip6mhhti_cookie __ip6mhhti_cookie.__cookie32 + +/* Care-of Test Init (CoTI) message */ +struct ip6_mh_careof_test_init { + struct ip6_mh ip6mhcti_hdr; + u_int16_t ip6mhcti_reserved; + union { + u_int8_t __cookie8[8]; + u_int32_t __cookie32[2]; + } __ip6mhcti_cookie; + /* followed by mobility options */ +}; +#ifdef _WRS_KERNEL +#define ip6mhcti_proto ip6mhcti_hdr.ip6mh_proto +#define ip6mhcti_len ip6mhcti_hdr.ip6mh_len +#define ip6mhcti_type ip6mhcti_hdr.ip6mh_type +#define ip6mhcti_reserved0 ip6mhcti_hdr.ip6mh_reserved +#define ip6mhcti_cksum ip6mhcti_hdr.ip6mh_cksum +#define ip6mhcti_cookie8 __ip6mhcti_cookie.__cookie8 +#endif /* _WRS_KERNEL */ +#define ip6mhcti_cookie __ip6mhcti_cookie.__cookie32 + +/* Home Test (HoT) message */ +struct ip6_mh_home_test { + struct ip6_mh ip6mhht_hdr; + u_int16_t ip6mhht_nonce_index; /* idx of the CN nonce list array */ + union { + u_int8_t __cookie8[8]; + u_int32_t __cookie32[2]; + } __ip6mhht_cookie; + union { + u_int8_t __keygen8[8]; + u_int32_t __keygen32[2]; + } __ip6mhht_keygen; + /* followed by mobility options */ +}; +#ifdef _WRS_KERNEL +#define ip6mhht_proto ip6mhht_hdr.ip6mh_proto +#define ip6mhht_len ip6mhht_hdr.ip6mh_len +#define ip6mhht_type ip6mhht_hdr.ip6mh_type +#define ip6mhht_reserved0 ip6mhht_hdr.ip6mh_reserved +#define ip6mhht_cksum ip6mhht_hdr.ip6mh_cksum +#define ip6mhht_cookie8 __ip6mhht_cookie.__cookie8 +#define ip6mhht_keygen8 __ip6mhht_keygen.__keygen8 +#endif /* _WRS_KERNEL */ +#define ip6mhht_cookie __ip6mhht_cookie.__cookie32 +#define ip6mhht_keygen __ip6mhht_keygen.__keygen32 + +/* Care-of Test (CoT) message */ +struct ip6_mh_careof_test { + struct ip6_mh ip6mhct_hdr; + u_int16_t ip6mhct_nonce_index; /* idx of the CN nonce list array */ + union { + u_int8_t __cookie8[8]; + u_int32_t __cookie32[2]; + } __ip6mhct_cookie; + union { + u_int8_t __keygen8[8]; + u_int32_t __keygen32[2]; + } __ip6mhct_keygen; + /* followed by mobility options */ +}; +#ifdef _WRS_KERNEL +#define ip6mhct_proto ip6mhct_hdr.ip6mh_proto +#define ip6mhct_len ip6mhct_hdr.ip6mh_len +#define ip6mhct_type ip6mhct_hdr.ip6mh_type +#define ip6mhct_reserved0 ip6mhct_hdr.ip6mh_reserved +#define ip6mhct_cksum ip6mhct_hdr.ip6mh_cksum +#define ip6mhct_cookie8 __ip6mhct_cookie.__cookie8 +#define ip6mhct_keygen8 __ip6mhct_keygen.__keygen8 +#endif /* _WRS_KERNEL */ +#define ip6mhct_cookie __ip6mhct_cookie.__cookie32 +#define ip6mhct_keygen __ip6mhct_keygen.__keygen32 + +/* Binding Update (BU) message */ +struct ip6_mh_binding_update { + struct ip6_mh ip6mhbu_hdr; + u_int16_t ip6mhbu_seqno; /* sequence number */ + u_int16_t ip6mhbu_flags; /* IP6MU_* flags */ + u_int16_t ip6mhbu_lifetime; /* in units of 4 seconds */ + /* followed by mobility options */ +}; +#ifdef _WRS_KERNEL +#define ip6mhbu_proto ip6mhbu_hdr.ip6mh_proto +#define ip6mhbu_len ip6mhbu_hdr.ip6mh_len +#define ip6mhbu_type ip6mhbu_hdr.ip6mh_type +#define ip6mhbu_reserved0 ip6mhbu_hdr.ip6mh_reserved +#define ip6mhbu_cksum ip6mhbu_hdr.ip6mh_cksum +#endif /* _WRS_KERNEL */ + +/* Binding Update flags */ +#if _BYTE_ORDER == _BIG_ENDIAN +#define IP6_MH_BU_ACK 0x8000 /* request a binding ack */ +#define IP6_MH_BU_HOME 0x4000 /* home registration */ +#define IP6_MH_BU_LLOCAL 0x2000 /* link-local address compatibility */ +#define IP6_MH_BU_KEYM 0x1000 /* key management mobility compatibility */ +#define IP6_MH_BU_ROUTER 0x0400 /* Prefix Registration (MIP6_NEMO) */ +#define IP6_MH_BU_MCOA 0x0200 /* Multiple CoA Registrations (MIP6_MCOA)*/ +#define IP6_MH_BU_CLONED 0x0100 /* KAME: internal use */ +#endif /* _BIG_ENDIAN */ +#if _BYTE_ORDER == _LITTLE_ENDIAN +#define IP6_MH_BU_ACK 0x0080 /* request a binding ack */ +#define IP6_MH_BU_HOME 0x0040 /* home registration */ +#define IP6_MH_BU_LLOCAL 0x0020 /* link-local address compatibility */ +#define IP6_MH_BU_KEYM 0x0010 /* key management mobility compatibility */ +#define IP6_MH_BU_ROUTER 0x0004 /* Prefix Registration (MIP6_NEMO) */ +#define IP6_MH_BU_MCOA 0x0002 /* Multiple CoA Registrations (MIP6_MCOA)*/ +#define IP6_MH_BU_CLONED 0x0001 /* KAME: internal use */ +#endif /* _LITTLE_ENDIAN */ + +/* Binding Acknowledgement (BA) message */ +struct ip6_mh_binding_ack { + struct ip6_mh ip6mhba_hdr; + u_int8_t ip6mhba_status; /* status code */ + u_int8_t ip6mhba_flags; + u_int16_t ip6mhba_seqno; /* sequence number */ + u_int16_t ip6mhba_lifetime; /* in units of 4 seconds */ + /* followed by mobility options */ +}; +#ifdef _WRS_KERNEL +#define ip6mhba_proto ip6mhba_hdr.ip6mh_proto +#define ip6mhba_len ip6mhba_hdr.ip6mh_len +#define ip6mhba_type ip6mhba_hdr.ip6mh_type +#define ip6mhba_reserved0 ip6mhba_hdr.ip6mh_reserved +#define ip6mhba_cksum ip6mhba_hdr.ip6mh_cksum +#endif /* _WRS_KERNEL */ + +/* Binding Acknowledgement Flags */ +#define IP6_MH_BA_KEYM 0x80 /* key management mobility */ +#define IP6_MH_BA_ROUTER 0x40 /* Mobile Router */ + +/* Binding Ack status codes */ +#define IP6_MH_BAS_ACCEPTED 0 /* Binding Update accepted */ +#define IP6_MH_BAS_PRFX_DISCOV 1 /* Accepted, but prefix discovery required */ +#define IP6_MH_BAS_ERRORBASE 128 /* ERROR BASE */ +#define IP6_MH_BAS_UNSPECIFIED 128 /* Reason unspecified */ +#define IP6_MH_BAS_PROHIBIT 129 /* Administratively prohibited */ +#define IP6_MH_BAS_INSUFFICIENT 130 /* Insufficient resources */ +#define IP6_MH_BAS_HA_NOT_SUPPORTED 131 /* Home registration not supported */ +#define IP6_MH_BAS_NOT_HOME_SUBNET 132 /* Not home subnet */ +#define IP6_MH_BAS_NOT_HA 133 /* Not home agent for this mobile node */ +#define IP6_MH_BAS_DAD_FAILED 134 /* Duplicate Address Detection failed */ +#define IP6_MH_BAS_SEQNO_BAD 135 /* Sequence number out of window */ +#define IP6_MH_BAS_HOME_NI_EXPIRED 136 /* Expired Home Nonce Index */ +#define IP6_MH_BAS_COA_NI_EXPIRED 137 /* Expired Care-of Nonce Index */ +#define IP6_MH_BAS_NI_EXPIRED 138 /* Expired Nonces */ +#define IP6_MH_BAS_REG_NOT_ALLOWED 139 /* Registration type change disallowed */ +#define IP6_MH_BAS_MR_NOT_PERMIT 140 /* Mobile Router Operation not permitted */ +#define IP6_MH_BAS_INVALID_PREFIX 141 /* Invalid Prefix */ +#define IP6_MH_BAS_NOT_AUTHORIZED 142 /* Not Authorized for Prefix */ +#define IP6_MH_BAS_NO_PREFIX_INFO 143 /* Mobile Network Prefix information unavailable */ + + +/* Binding Error (BE) message */ +struct ip6_mh_binding_error { + struct ip6_mh ip6mhbe_hdr; + u_int8_t ip6mhbe_status; /* status code */ + u_int8_t ip6mhbe_reserved; + struct in6_addr ip6mhbe_homeaddr; + /* followed by mobility options */ +}; +#ifdef _WRS_KERNEL +#define ip6mhbe_proto ip6mhbe_hdr.ip6mh_proto +#define ip6mhbe_len ip6mhbe_hdr.ip6mh_len +#define ip6mhbe_type ip6mhbe_hdr.ip6mh_type +#define ip6mhbe_reserved0 ip6mhbe_hdr.ip6mh_reserved +#define ip6mhbe_cksum ip6mhbe_hdr.ip6mh_cksum +#endif /* _WRS_KERNEL */ + +/* Binding Error status codes */ +#define IP6_MH_BES_UNKNOWN_HAO 1 +#define IP6_MH_BES_UNKNOWN_MH 2 + +/* Mobility options */ +struct ip6_mh_opt { + u_int8_t ip6mhopt_type; + u_int8_t ip6mhopt_len; + /* followed by option data */ +}; + +/* Mobility option type */ +#define IP6_MHOPT_PAD1 0 /* Pad1 */ +#define IP6_MHOPT_PADN 1 /* PadN */ +#define IP6_MHOPT_BREFRESH 2 /* Binding Refresh Advice */ +#define IP6_MHOPT_ALTCOA 3 /* Alternate Care-of Address */ +#define IP6_MHOPT_NONCEID 4 /* Nonce Indices */ +#define IP6_MHOPT_BAUTH 5 /* Binding Authorization Data */ +#define IP6_MHOPT_PREFIX 6 /* Mobile Network Prefix */ +#define IP6_MHOPT_BID 7 /* Binding Unique Identifier */ + +/* Binding Refresh Advice */ +struct ip6_mh_opt_refresh_advice { + u_int8_t ip6mora_type; + u_int8_t ip6mora_len; + u_int8_t ip6mora_interval[2]; /* Refresh Interval (units of 4 sec) */ +}; + +/* Alternate Care-of Address */ +struct ip6_mh_opt_altcoa { + u_int8_t ip6moa_type; + u_int8_t ip6moa_len; + u_int8_t ip6moa_addr[16]; /* Alternate Care-of Address */ +}; + +/* Nonce Indices */ +struct ip6_mh_opt_nonce_index { + u_int8_t ip6moni_type; + u_int8_t ip6moni_len; + union { + u_int8_t __nonce8[2]; + u_int16_t __nonce16; + } __ip6moni_home_nonce; + union { + u_int8_t __nonce8[2]; + u_int16_t __nonce16; + } __ip6moni_coa_nonce; +}; +#ifdef _WRS_KERNEL +#define ip6moni_home_nonce8 __ip6moni_home_nonce.__nonce8 +#define ip6moni_coa_nonce8 __ip6moni_coa_nonce.__nonce8 +#endif /* _WRS_KERNEL */ +#define ip6moni_home_nonce __ip6moni_home_nonce.__nonce16 +#define ip6moni_coa_nonce __ip6moni_coa_nonce.__nonce16 + +/* Binding Authorization Data */ +struct ip6_mh_opt_auth_data { + u_int8_t ip6moad_type; + u_int8_t ip6moad_len; + /* followed by authenticator data */ +}; +#ifdef _WRS_KERNEL +#define IP6MOPT_AUTHDATA_SIZE (sizeof(struct ip6_mh_opt_auth_data) + MIP6_AUTHENTICATOR_LEN) +#endif /* _WRS_KERNEL */ + +/* NEMO Basic Support: Mobile Network Prefix Option */ +struct ip6_mh_opt_prefix { + uint8_t ip6mopfx_type; + uint8_t ip6mopfx_len; + uint8_t ip6mopfx_reserved; + uint8_t ip6mopfx_pfxlen; + struct in6_addr ip6mopfx_pfx; +}; + +/* Multiple CoA Registrations (MIP6_MCOA) */ +struct ip6_mh_opt_bid { + uint8_t ip6mobid_type; + uint8_t ip6mobid_len; + uint16_t ip6mobid_bid; + uint16_t ip6mobid_reserved; +}; +/* Binding Unique Identifier flag */ +#if _BYTE_ORDER == _BIG_ENDIAN +#define IP6OPTBID_STOP 0x8000 /* stop proxy NA */ +#endif /* _BIG_ENDIAN */ +#if _BYTE_ORDER == _LITTLE_ENDIAN +#define IP6OPTBID_STOP 0x0080 /* stop proxy NA */ +#endif /* _LITTLE_ENDIAN */ + +#endif /* not _NETINET_IP6MH_H_ */ diff --git a/h/wrn/coreip/netinet/ip_flow.h b/h/wrn/coreip/netinet/ip_flow.h new file mode 100644 index 0000000..54ebc83 --- /dev/null +++ b/h/wrn/coreip/netinet/ip_flow.h @@ -0,0 +1,79 @@ +/* ip_flow.c - IP flow management */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1998 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by the 3am Software Foundry ("3am"). It was developed by Matt Thomas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD: src/sys/netinet/ip_flow.h,v 1.2 1999/08/28 00:49:22 peter Exp $ + */ + +/* +modification history +-------------------- +01e,07feb05,vvv _KERNEL cleanup +01d,20nov03,niq Remove copyright_wrs.h file inclusion +01c,04nov03,rlm Ran batch header path update for header re-org. +01b,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01a,07aug03,niq Merging from Accordion label ACCORDION_BASE6_MERGE_BASELINE +*/ + +#ifndef _NETINET_IP_FLOW_H +#define _NETINET_IP_FLOW_H + +#ifdef _WRS_KERNEL +#include + +#define IPFLOW_TIMER (5 * PR_SLOWHZ) +#define IPFLOW_HASHBITS 6 /* should not be a multiple of 8 */ +#define IPFLOW_HASHSIZE (1 << IPFLOW_HASHBITS) +#define IPFLOW_MAX 256 + +struct ipflow { + LIST_ENTRY(ipflow) ipf_next; /* next ipflow in bucket */ + struct in_addr ipf_dst; /* destination address */ + struct in_addr ipf_src; /* source address */ + + u_int8_t ipf_tos; /* type-of-service */ + struct route ipf_ro; /* associated route entry */ + u_long ipf_uses; /* number of uses in this period */ + + int ipf_timer; /* remaining lifetime of this entry */ + u_long ipf_dropped; /* ENOBUFS returned by if_output */ + u_long ipf_errors; /* other errors returned by if_output */ + u_long ipf_last_uses; /* number of uses in last period */ +}; +#endif /* _WRS_KERNEL */ +#endif diff --git a/h/wrn/coreip/netinet/ip_icmp.h b/h/wrn/coreip/netinet/ip_icmp.h new file mode 100644 index 0000000..96c84f3 --- /dev/null +++ b/h/wrn/coreip/netinet/ip_icmp.h @@ -0,0 +1,239 @@ +/* ip_icmp.h - interface control message protocol header file */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/ip_icmp.h,v 1.16 1999/12/29 04:41:01 peter Exp $ + */ + +/* +modification history +-------------------- +01j,04jul05,dlk Added result member to icmp_info structure (SPR #110450). +01i,07feb05,vvv _KERNEL cleanup +01h,20nov03,niq Remove copyright_wrs.h file inclusion +01g,04nov03,rlm Ran batch header path update for header re-org. +01f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01e,07aug03,niq Merging from Accordion label ACCORDION_BASE6_MERGE_BASELINE. +01d,09may03,vvv included in_systm.h and ip.h +01c,10sep02,hsh add c++ protection +01b,20jun02,ppp adding the structure for icmp_info +01a,22aug01,ppp Created from BSD 4.3 +*/ + + +#ifndef _NETINET_IP_ICMP_H_ +#define _NETINET_IP_ICMP_H_ + +#ifdef __cplusplus + extern "C" { +#endif + +#include +#include + +/* + * Interface Control Message Protocol Definitions. + * Per RFC 792, September 1981. + */ + +/* + * Internal of an ICMP Router Advertisement + */ +struct icmp_ra_addr { + u_int32_t ira_addr; + u_int32_t ira_preference; +}; + +/* + * Structure of an icmp header. + */ +struct icmp { + u_char icmp_type; /* type of message, see below */ + u_char icmp_code; /* type sub code */ + u_short icmp_cksum; /* ones complement cksum of struct */ + union { + u_char ih_pptr; /* ICMP_PARAMPROB */ + struct in_addr ih_gwaddr; /* ICMP_REDIRECT */ + struct ih_idseq { + n_short icd_id; + n_short icd_seq; + } ih_idseq; + int ih_void; + + /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */ + struct ih_pmtu { + n_short ipm_void; + n_short ipm_nextmtu; + } ih_pmtu; + + struct ih_rtradv { + u_char irt_num_addrs; + u_char irt_wpa; + u_int16_t irt_lifetime; + } ih_rtradv; + } icmp_hun; +#define icmp_pptr icmp_hun.ih_pptr +#define icmp_gwaddr icmp_hun.ih_gwaddr +#define icmp_id icmp_hun.ih_idseq.icd_id +#define icmp_seq icmp_hun.ih_idseq.icd_seq +#define icmp_void icmp_hun.ih_void +#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void +#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu +#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs +#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa +#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime + union { + struct id_ts { + n_time its_otime; + n_time its_rtime; + n_time its_ttime; + } id_ts; + struct id_ip { + struct ip idi_ip; + /* options and then 64 bits of data */ + } id_ip; + struct icmp_ra_addr id_radv; + u_int32_t id_mask; + char id_data[1]; + } icmp_dun; +#define icmp_otime icmp_dun.id_ts.its_otime +#define icmp_rtime icmp_dun.id_ts.its_rtime +#define icmp_ttime icmp_dun.id_ts.its_ttime +#define icmp_ip icmp_dun.id_ip.idi_ip +#define icmp_radv icmp_dun.id_radv +#define icmp_mask icmp_dun.id_mask +#define icmp_data icmp_dun.id_data +}; + + +/* + * Added this structure for passing additional information to ctl functions + * that may want to use it + */ + +struct icmp_info { + struct sockaddr_in sock; + u_short errorPktLen; + u_short result; +#define ICMP4_RESULT_ACCEPT 0 +#define ICMP4_RESULT_REJECT 1 +}; + + +/* + * Lower bounds on packet lengths for various types. + * For the error advice packets must first insure that the + * packet is large enough to contain the returned ip header. + * Only then can we do the check to see if 64 bits of packet + * data have been returned, since we need to check the returned + * ip header length. + */ +#define ICMP_MINLEN 8 /* abs minimum */ +#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */ +#define ICMP_MASKLEN 12 /* address mask */ +#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */ +#ifndef _IP_VHL +#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8) + /* N.B.: must separately check that ip_hl >= 5 */ +#else +#define ICMP_ADVLEN(p) (8 + (IP_VHL_HL((p)->icmp_ip.ip_vhl) << 2) + 8) + /* N.B.: must separately check that header length >= 5 */ +#endif + +/* + * Definition of type and code field values. + */ +#define ICMP_ECHOREPLY 0 /* echo reply */ +#define ICMP_UNREACH 3 /* dest unreachable, codes: */ +#define ICMP_UNREACH_NET 0 /* bad net */ +#define ICMP_UNREACH_HOST 1 /* bad host */ +#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */ +#define ICMP_UNREACH_PORT 3 /* bad port */ +#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */ +#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */ +#define ICMP_UNREACH_NET_UNKNOWN 6 /* unknown net */ +#define ICMP_UNREACH_HOST_UNKNOWN 7 /* unknown host */ +#define ICMP_UNREACH_ISOLATED 8 /* src host isolated */ +#define ICMP_UNREACH_NET_PROHIB 9 /* prohibited access */ +#define ICMP_UNREACH_HOST_PROHIB 10 /* ditto */ +#define ICMP_UNREACH_TOSNET 11 /* bad tos for net */ +#define ICMP_UNREACH_TOSHOST 12 /* bad tos for host */ +#define ICMP_UNREACH_FILTER_PROHIB 13 /* admin prohib */ +#define ICMP_UNREACH_HOST_PRECEDENCE 14 /* host prec vio. */ +#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 /* prec cutoff */ +#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */ +#define ICMP_REDIRECT 5 /* shorter route, codes: */ +#define ICMP_REDIRECT_NET 0 /* for network */ +#define ICMP_REDIRECT_HOST 1 /* for host */ +#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */ +#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */ +#define ICMP_ECHO 8 /* echo service */ +#define ICMP_ROUTERADVERT 9 /* router advertisement */ +#define ICMP_ROUTERSOLICIT 10 /* router solicitation */ +#define ICMP_TIMXCEED 11 /* time exceeded, code: */ +#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */ +#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */ +#define ICMP_PARAMPROB 12 /* ip header bad */ +#define ICMP_PARAMPROB_ERRATPTR 0 /* error at param ptr */ +#define ICMP_PARAMPROB_OPTABSENT 1 /* req. opt. absent */ +#define ICMP_PARAMPROB_LENGTH 2 /* bad length */ +#define ICMP_TSTAMP 13 /* timestamp request */ +#define ICMP_TSTAMPREPLY 14 /* timestamp reply */ +#define ICMP_IREQ 15 /* information request */ +#define ICMP_IREQREPLY 16 /* information reply */ +#define ICMP_MASKREQ 17 /* address mask request */ +#define ICMP_MASKREPLY 18 /* address mask reply */ + +#define ICMP_MAXTYPE 18 + +#define ICMP_INFOTYPE(type) \ + ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \ + (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \ + (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \ + (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \ + (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY) + +#ifdef _WRS_KERNEL +void icmp_init __P((void)); +void icmp_error __P((struct mbuf *, int, int, n_long, struct ifnet *)); +void icmp_input __P((struct mbuf *, int, int)); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/netinet/ip_mroute.h b/h/wrn/coreip/netinet/ip_mroute.h new file mode 100644 index 0000000..7317475 --- /dev/null +++ b/h/wrn/coreip/netinet/ip_mroute.h @@ -0,0 +1,443 @@ +/* ip_mroute.h - multicast forwarding header file */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* + * Copyright (c) 1989 Stephen Deering. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Stephen Deering of Stanford University. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip_mroute.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/ip_mroute.h,v 1.17 1999/12/29 04:41:01 peter Exp $ + */ + +/* +modification history +-------------------- +01h,16jul05,dlk Added tbf_timeo member to struct tbf for timer cancellation + when shutting down mrouter in virtual stack destructor. +01g,25feb05,niq add support for router alert +01f,31jan05,niq merge mroute changes from comp_wn_ipv6_multicast_interim-dev + branch (ver 1) +01e,20sep04,rae fix compiler warnings +01d,24jun03,rae add #include netVersion.h +01c,10oct01,rae merge from truestack ver 01k (v2 upgrade) +01b,08apr97,vin removed declarations for ip_mforward and ip_mrouter_done. + implemented ip_mforward as a hook for scalability. +01a,03mar96,vin created from BSD4.4lite2. +*/ + +#ifndef _NETINET_IP_MROUTE_H_ +#define _NETINET_IP_MROUTE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "sys/times.h" +#include +#include + + +/* + * Definitions for IP multicast forwarding. + * + * Written by David Waitzman, BBN Labs, August 1988. + * Modified by Steve Deering, Stanford, February 1989. + * Modified by Ajit Thyagarajan, PARC, August 1993. + * Modified by Ajit Thyagarajan, PARC, August 1994. + * Modified by Ahmed Helmy, SGI, June 1996. + * Modified by Pavlin Radoslavov, ICSI, October 2002. + * + * MROUTING Revision: 3.3.1.3 + * and PIM-SMv2 and PIM-DM support, advanced API support, + * bandwidth metering and signaling. + */ + + +/* + * Multicast Routing set/getsockopt commands. + */ +#define MRT_INIT 100 /* initialize forwarder */ +#define MRT_DONE 101 /* shut down forwarder */ +#define MRT_ADD_VIF 102 /* create virtual interface */ +#define MRT_DEL_VIF 103 /* delete virtual interface */ +#define MRT_ADD_MFC 104 /* insert forwarding cache entry */ +#define MRT_DEL_MFC 105 /* delete forwarding cache entry */ +#define MRT_VERSION 106 /* get kernel version number */ +#define MRT_ASSERT 107 /* enable assert processing */ +#define MRT_PIM MRT_ASSERT /* enable PIM processing */ +#define MRT_API_SUPPORT 109 /* supported MRT API */ +#define MRT_API_CONFIG 110 /* config MRT API */ +#define MRT_ADD_BW_UPCALL 111 /* create bandwidth monitor */ +#define MRT_DEL_BW_UPCALL 112 /* delete bandwidth monitor */ +#define MRT_DEBUG 120 /* enable debugging */ + + +#define GET_TIME(t) microtime(&t) + +/* + * Define common interface for timeval-related methods + */ + +/* + * Types and macros for handling bitmaps with one bit per virtual interface. + */ +#define MAXVIFS 32 +typedef u_long vifbitmap_t; +typedef u_short vifi_t; /* type of a vif index */ +#define ALL_VIFS (vifi_t)-1 + +#define VIFM_SET(n, m) ((m) |= (1 << (n))) +#define VIFM_CLR(n, m) ((m) &= ~(1 << (n))) +#define VIFM_ISSET(n, m) ((m) & (1 << (n))) +#define VIFM_CLRALL(m) ((m) = 0x00000000) +#define VIFM_COPY(mfrom, mto) ((mto) = (mfrom)) +#define VIFM_SAME(m1, m2) ((m1) == (m2)) + + +typedef struct ipm_config_params { + CFG_DATA_HDR cfgh; + FUNCPTR cfg_privInitSysctl; + } IPM_CONFIG_PARAMS; + +/* + * Argument structure for MRT_ADD_VIF. + * (MRT_DEL_VIF takes a single vifi_t argument.) + */ +struct vifctl { + vifi_t vifc_vifi; /* the index of the vif to be added */ + u_char vifc_flags; /* VIFF_ flags defined below */ + u_char vifc_threshold; /* min ttl required to forward on vif */ + u_int vifc_rate_limit; /* max rate */ + struct in_addr vifc_lcl_addr; /* local interface address */ + struct in_addr vifc_rmt_addr; /* remote address (tunnels only) */ +}; + +#define VIFF_TUNNEL 0x1 /* vif represents a tunnel end-point */ +#define VIFF_SRCRT 0x2 /* tunnel uses IP source routing */ +#define VIFF_REGISTER 0x4 /* used for PIM Register encap/decap */ + +/* + * Argument structure for MRT_ADD_MFC and MRT_DEL_MFC + * XXX if you change this, make sure to change struct mfcctl2 as well. + */ +struct mfcctl { + struct in_addr mfcc_origin; /* ip origin of mcasts */ + struct in_addr mfcc_mcastgrp; /* multicast group associated*/ + vifi_t mfcc_parent; /* incoming vif */ + u_char mfcc_ttls[MAXVIFS]; /* forwarding ttls on vifs */ +}; + +/* + * The new argument structure for MRT_ADD_MFC and MRT_DEL_MFC overlays + * and extends the old struct mfcctl. + */ +struct mfcctl2 { + /* the mfcctl fields */ + struct in_addr mfcc_origin; /* ip origin of mcasts */ + struct in_addr mfcc_mcastgrp; /* multicast group associated*/ + vifi_t mfcc_parent; /* incoming vif */ + u_char mfcc_ttls[MAXVIFS]; /* forwarding ttls on vifs */ + + /* extension fields */ + uint8_t mfcc_flags[MAXVIFS]; /* the MRT_MFC_FLAGS_* flags */ + struct in_addr mfcc_rp; /* the RP address */ +}; +/* + * The advanced-API flags. + * + * The MRT_MFC_FLAGS_XXX API flags are also used as flags + * for the mfcc_flags field. + */ +#define MRT_MFC_FLAGS_DISABLE_WRONGVIF (1 << 0) /* disable WRONGVIF signals */ +#define MRT_MFC_FLAGS_BORDER_VIF (1 << 1) /* border vif */ +#define MRT_MFC_RP (1 << 8) /* enable RP address */ +#define MRT_MFC_BW_UPCALL (1 << 9) /* enable bw upcalls */ +#define MRT_MFC_FLAGS_ALL (MRT_MFC_FLAGS_DISABLE_WRONGVIF | \ + MRT_MFC_FLAGS_BORDER_VIF) +#define MRT_API_FLAGS_ALL (MRT_MFC_FLAGS_ALL | \ + MRT_MFC_RP | \ + MRT_MFC_BW_UPCALL) + +/* + * Structure for installing or delivering an upcall if the + * measured bandwidth is above or below a threshold. + * + * User programs (e.g. daemons) may have a need to know when the + * bandwidth used by some data flow is above or below some threshold. + * This interface allows the userland to specify the threshold (in + * bytes and/or packets) and the measurement interval. Flows are + * all packet with the same source and destination IP address. + * At the moment the code is only used for multicast destinations + * but there is nothing that prevents its use for unicast. + * + * The measurement interval cannot be shorter than some Tmin (currently, 3s). + * The threshold is set in packets and/or bytes per_interval. + * + * Measurement works as follows: + * + * For >= measurements: + * The first packet marks the start of a measurement interval. + * During an interval we count packets and bytes, and when we + * pass the threshold we deliver an upcall and we are done. + * The first packet after the end of the interval resets the + * count and restarts the measurement. + * + * For <= measurement: + * We start a timer to fire at the end of the interval, and + * then for each incoming packet we count packets and bytes. + * When the timer fires, we compare the value with the threshold, + * schedule an upcall if we are below, and restart the measurement + * (reschedule timer and zero counters). + */ + + +struct bw_data { + struct timeval b_time; + uint64_t b_packets; + uint64_t b_bytes; +}; + +struct bw_upcall { + struct in_addr bu_src; /* source address */ + struct in_addr bu_dst; /* destination address */ + uint32_t bu_flags; /* misc flags (see below) */ +#define BW_UPCALL_UNIT_PACKETS (1 << 0) /* threshold (in packets) */ +#define BW_UPCALL_UNIT_BYTES (1 << 1) /* threshold (in bytes) */ +#define BW_UPCALL_GEQ (1 << 2) /* upcall if bw >= threshold */ +#define BW_UPCALL_LEQ (1 << 3) /* upcall if bw <= threshold */ +#define BW_UPCALL_DELETE_ALL (1 << 4) /* delete all upcalls for s,d*/ + struct bw_data bu_threshold; /* the bw threshold */ + struct bw_data bu_measured; /* the measured bw */ +}; + +/* max. number of upcalls to deliver together */ +#define BW_UPCALLS_MAX 128 +/* min. threshold time interval for bandwidth measurement */ +#define BW_UPCALL_THRESHOLD_INTERVAL_MIN_SEC 3 +#define BW_UPCALL_THRESHOLD_INTERVAL_MIN_USEC 0 + +/* + * Pending timeouts are stored in a hash table, the key being the + * expiration time. Periodically, the entries are analysed and processed. + */ +#define BW_METER_BUCKETS 1024 +#define BW_METER_PERIOD (hz) /* periodical handling of bw meters */ +#define BW_UPCALLS_PERIOD (hz) /* periodical flush of bw upcalls */ + +/* + * The kernel's multicast routing statistics. + */ +struct mrtstat { + u_long mrts_mfc_lookups; /* # forw. cache hash table hits */ + u_long mrts_mfc_misses; /* # forw. cache hash table misses */ + u_long mrts_upcalls; /* # calls to mrouted */ + u_long mrts_no_route; /* no route for packet's origin */ + u_long mrts_bad_tunnel; /* malformed tunnel options */ + u_long mrts_cant_tunnel; /* no room for tunnel options */ + u_long mrts_wrong_if; /* arrived on wrong interface */ + u_long mrts_upq_ovflw; /* upcall Q overflow */ + u_long mrts_cache_cleanups; /* # entries with no upcalls */ + u_long mrts_drop_sel; /* pkts dropped selectively */ + u_long mrts_q_overflow; /* pkts dropped - Q overflow */ + u_long mrts_pkt2large; /* pkts dropped - size > BKT SIZE */ + u_long mrts_upq_sockfull; /* upcalls dropped - socket full */ +}; + +/* + * Argument structure used by mrouted to get src-grp pkt counts + */ +struct sioc_sg_req { + struct in_addr src; + struct in_addr grp; + u_long pktcnt; + u_long bytecnt; + u_long wrong_if; +}; + +/* + * Argument structure used by mrouted to get vif pkt counts + */ +struct sioc_vif_req { + vifi_t vifi; /* vif number */ + u_long icount; /* Input packet count on vif */ + u_long ocount; /* Output packet count on vif */ + u_long ibytes; /* Input byte count on vif */ + u_long obytes; /* Output byte count on vif */ +}; + + +/* + * The kernel's virtual-interface structure. + */ +struct vif { + u_char v_flags; /* VIFF_ flags defined above */ + u_char v_threshold; /* min ttl required to forward on vif*/ + u_int v_rate_limit; /* max rate */ + struct tbf *v_tbf; /* token bucket structure at intf. */ + struct in_addr v_lcl_addr; /* local interface address */ + struct in_addr v_rmt_addr; /* remote address (tunnels only) */ + struct ifnet *v_ifp; /* pointer to interface */ + u_long v_pkt_in; /* # pkts in on interface */ + u_long v_pkt_out; /* # pkts out on interface */ + u_long v_bytes_in; /* # bytes in on interface */ + u_long v_bytes_out; /* # bytes out on interface */ + struct route v_route; /* cached route if this is a tunnel */ + /* + * Removed v_rsvp_on/v_rsvpd as we support RSVP through the + * IP_ROUTER_ALERT option + */ +}; + +/* + * The kernel's multicast forwarding cache entry structure + * (A field for the type of service (mfc_tos) is to be added + * at a future point) + */ +struct mfc { + struct in_addr mfc_origin; /* IP origin of mcasts */ + struct in_addr mfc_mcastgrp; /* multicast group associated*/ + vifi_t mfc_parent; /* incoming vif */ + u_char mfc_ttls[MAXVIFS]; /* forwarding ttls on vifs */ + u_long mfc_pkt_cnt; /* pkt count for src-grp */ + u_long mfc_byte_cnt; /* byte count for src-grp */ + u_long mfc_wrong_if; /* wrong if for src-grp */ + int mfc_expire; /* time to clean entry up */ + struct timeval mfc_last_assert; /* last time I sent an assert*/ + struct rtdetq *mfc_stall; /* q of packets awaiting mfc */ + struct mfc *mfc_next; /* next mfc entry */ + uint8_t mfc_flags[MAXVIFS]; /* the MRT_MFC_FLAGS_* flags */ + struct in_addr mfc_rp; /* the RP address */ + struct bw_meter *mfc_bw_meter; /* list of bandwidth meters */ +}; + +/* + * Struct used to communicate from kernel to multicast router + * note the convenient similarity to an IP packet + */ +struct igmpmsg { + u_long unused1; + u_long unused2; + u_char im_msgtype; /* what type of message */ +#define IGMPMSG_NOCACHE 1 /* no MFC in the kernel */ +#define IGMPMSG_WRONGVIF 2 /* packet came from wrong interface */ +#define IGMPMSG_WHOLEPKT 3 /* PIM pkt for user level encap. */ +#define IGMPMSG_BW_UPCALL 4 /* BW monitoring upcall */ + u_char im_mbz; /* must be zero */ + u_char im_vif; /* vif rec'd on */ + u_char unused3; + struct in_addr im_src, im_dst; +}; + +/* + * Argument structure used for pkt info. while upcall is made + */ +struct rtdetq { + struct mbuf *m; /* A copy of the packet */ + struct ifnet *ifp; /* Interface pkt came in on */ + vifi_t xmt_vif; /* Saved copy of imo_multicast_vif */ + struct rtdetq *next; /* Next in list of packets */ +}; + +#define MFCTBLSIZ 256 +#if (MFCTBLSIZ & (MFCTBLSIZ - 1)) == 0 /* from sys:route.h */ +#define MFCHASHMOD(h) ((h) & (MFCTBLSIZ - 1)) +#else +#define MFCHASHMOD(h) ((h) % MFCTBLSIZ) +#endif + +#define MAX_UPQ 4 /* max. no of pkts in upcall Q */ + +/* + * Token Bucket filter code + */ +#define MAX_BKT_SIZE 10000 /* 10K bytes size */ +#define MAXQSIZE 10 /* max # of pkts in queue */ + +/* + * the token bucket filter at each vif + */ +struct tbf +{ + struct timeval tbf_last_pkt_t; /* arr. time of last pkt */ + u_long tbf_n_tok; /* no of tokens in bucket */ + u_long tbf_q_len; /* length of queue at this vif */ + u_long tbf_max_q_len; /* max. queue length */ + struct mbuf *tbf_q; /* Packet queue */ + struct mbuf *tbf_t; /* tail-insertion pointer */ + void * tbf_timeo; /* gtfTimeout() handle */ +}; + +/* + * Structure for measuring the bandwidth and sending an upcall if the + * measured bandwidth is above or below a threshold. + */ +struct bw_meter { + struct bw_meter *bm_mfc_next; /* next bw meter (same mfc) */ + struct bw_meter *bm_time_next; /* next bw meter (same time) */ + uint32_t bm_time_hash; /* the time hash value */ + struct mfc *bm_mfc; /* the corresponding mfc */ + uint32_t bm_flags; /* misc flags (see below) */ +#define BW_METER_UNIT_PACKETS (1 << 0) /* threshold (in packets) */ +#define BW_METER_UNIT_BYTES (1 << 1) /* threshold (in bytes) */ +#define BW_METER_GEQ (1 << 2) /* upcall if bw >= threshold */ +#define BW_METER_LEQ (1 << 3) /* upcall if bw <= threshold */ +#define BW_METER_USER_FLAGS (BW_METER_UNIT_PACKETS | \ + BW_METER_UNIT_BYTES | \ + BW_METER_GEQ | \ + BW_METER_LEQ) + +#define BW_METER_UPCALL_DELIVERED (1 << 24) /* upcall was delivered */ + + struct bw_data bm_threshold; /* the upcall threshold */ + struct bw_data bm_measured; /* the measured bw */ + struct timeval bm_start_time; /* abs. time */ +}; + +IMPORT STATUS ipMrouteSysctlInit (void); + +#ifdef __cplusplus +} +#endif + +#endif /* _NETINET_IP_MROUTE_H_ */ diff --git a/h/wrn/coreip/netinet/ip_var.h b/h/wrn/coreip/netinet/ip_var.h new file mode 100644 index 0000000..bb76807 --- /dev/null +++ b/h/wrn/coreip/netinet/ip_var.h @@ -0,0 +1,318 @@ +/* ip_var.h - internet protocol protocol variable header file */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* + * Copyright (c) 2002 INRIA. All rights reserved. + * + * Implementation of Internet Group Management Protocol, Version 3. + * Developed by Hitoshi Asaeda, INRIA, February 2002. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of INRIA nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip_var.h 8.2 (Berkeley) 1/9/95 + * $FreeBSD: src/sys/netinet/ip_var.h,v 1.50.2.14 2003/09/09 19:09:22 bms Exp $ + */ + +/* +modification history +-------------------- +01z,25aug05,dlk Add section tags. +01y,20aug05,dlk Merge IPv4 reassembly improvements from Kame/FreeBSD. +01x,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +01w,25feb05,niq router alert changes +01v,31jan05,niq merge mroute changes from comp_wn_ipv6_multicast_interim-dev + branch (ver 1) +01u,07feb05,vvv _KERNEL cleanup +01t,28oct04,dlk Change ip_mrouter tentative definition to an extern + declaration (SPR #103234). +01s,13sep04,rae ip_mrouter is a UINT now +01r,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01q,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01p,06jan04,vvv modified ipq structure for reassembly changes (SPR #88742) +01o,20nov03,niq Remove copyright_wrs.h file inclusion +01n,05nov03,cdw Removal of unnecessary _KERNEL guards. +01m,04nov03,rlm Ran batch header path update for header re-org. +01l,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01k,07aug03,niq Merging from Accordion label ACCORDION_BASE6_MERGE_BASELINE +01j,09may03,vvv included in.h +01i,29apr03,syy Added #ifdef for __cplusplus +01h,01feb03,pas merge from FreeBSD 4.7 - added ip_rtaddr(), ip_randomid() +01g,03may02,hsh add mbuf* as parameter to ip_srcroute to avoid mbuf leaking +01f,08apr02,hsh change ip_stripoptions so it return number of bytes + it saved before stripping module can access it +01e,28mar02,ppp modified it for backward compatibility with AE 1.1 +01d,03oct01,ann commenting the prototype for ipintr +01c,18sep01,ham enabled rsvp_input. +01b,27aug01,ann adding the prototype for ipintr from ip_input.c +01a,23aug01,ppp Created from FreeBSD 4.3 +*/ + + +#ifndef _NETINET_IP_VAR_H_ +#define _NETINET_IP_VAR_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _WRS_KERNEL +#include +#include +#include + +/* + * Overlay for ip header used by other protocols (tcp, udp). + */ +struct ipovly { + u_char ih_x1[9]; /* (unused) */ + u_char ih_pr; /* protocol */ + u_short ih_len; /* protocol length */ + struct in_addr ih_src; /* source internet address */ + struct in_addr ih_dst; /* destination internet address */ +}; + +/* + * Ip reassembly queue structure. Each fragment + * being reassembled is attached to one of these structures. + * They are timed out after ipq_ttl drops to 0, and may also + * be reclaimed if memory becomes tight. + */ +struct ipq { + struct ipq *next,*prev; /* to other reass headers */ + u_char ipq_ttl; /* time for reass q to live */ + u_char ipq_p; /* protocol of this fragment */ + u_short ipq_id; /* sequence id for reassembly */ + struct mbuf *ipq_frags; /* to ip headers of fragments */ + struct in_addr ipq_src,ipq_dst; + u_short ipq_nfrags; /* # frags in this packet */ +}; + +/* + * Socket argument of multicast source filters. + */ +LIST_HEAD(msf_head, sock_msf_source); + +struct sock_msf_source { + struct sockaddr_storage src; /* source address */ + LIST_ENTRY(sock_msf_source) list; /* list of source addresses */ + u_int refcount; /* reference count of the source */ +}; + +struct sock_msf { +/* u_int32_t msf_mode; * source filter mode */ + u_int msf_grpjoin; /* number of (*,G) join requests */ + struct msf_head *msf_head; /* head of joined source list chain */ + struct msf_head *msf_blkhead;/* head of muted source list chain */ + u_int16_t msf_numsrc; /* no. of joined src on this socket */ + u_int16_t msf_blknumsrc; /* no. of muted src on this socket */ +}; + +/* + * Structure stored in mbuf in inpcb.ip_options + * and passed to ip_output when ip options are in use. + * The actual length of the options (including ipopt_dst) + * is in m_len. + */ +#define MAX_IPOPTLEN 40 + +struct ipoption { + struct in_addr ipopt_dst; /* first-hop dst if source routed */ + char ipopt_list[MAX_IPOPTLEN]; /* options proper */ +}; + +/* + * Structure attached to inpcb.ip_moptions and + * passed to ip_output when IP multicast options are in use. + */ +struct ip_moptions { + struct ifnet *imo_multicast_ifp; /* ifp for outgoing multicasts */ + struct in_addr imo_multicast_addr; /* ifindex/addr on MULTICAST_IF */ + u_char imo_multicast_ttl; /* TTL for outgoing multicasts */ + u_char imo_multicast_loop; /* 1 => hear sends if a member */ + u_short imo_num_memberships; /* no. memberships this socket */ + struct in_multi *imo_membership[IP_MAX_MEMBERSHIPS]; + u_long imo_multicast_vif; /* vif num outgoing multicasts */ + struct sock_msf *imo_msf [IP_MAX_MEMBERSHIPS]; +}; +#endif /* _WRS_KERNEL */ + +struct ipstat { + u_long ips_total; /* total packets received */ + u_long ips_badsum; /* checksum bad */ + u_long ips_tooshort; /* packet too short */ + u_long ips_toosmall; /* not enough data */ + u_long ips_badhlen; /* ip header length < data size */ + u_long ips_badlen; /* ip length < ip header length */ + u_long ips_fragments; /* fragments received */ + u_long ips_fragdropped; /* frags dropped (dups, out of space) */ + u_long ips_fragtimeout; /* fragments timed out */ + u_long ips_forward; /* packets forwarded */ + u_long ips_fastforward; /* packets fast forwarded */ + u_long ips_cantforward; /* packets rcvd for unreachable dest */ + u_long ips_redirectsent; /* packets forwarded on same net */ + u_long ips_noproto; /* unknown or unsupported protocol */ + u_long ips_delivered; /* datagrams delivered to upper level*/ + u_long ips_localout; /* total ip packets generated here */ + u_long ips_odropped; /* lost packets due to nobufs, etc. */ + u_long ips_reassembled; /* total packets reassembled ok */ + u_long ips_fragmented; /* datagrams successfully fragmented */ + u_long ips_ofragments; /* output fragments created */ + u_long ips_cantfrag; /* don't fragment flag was set, etc. */ + u_long ips_badoptions; /* error in option processing */ + u_long ips_noroute; /* packets discarded due to no route */ + u_long ips_badvers; /* ip version != 4 */ + u_long ips_rawout; /* total raw ip packets generated */ + u_long ips_toolong; /* ip length > max ip packet size */ + u_long ips_notmember; /* multicasts for unregistered grps */ + u_long ips_nogif; /* no match gif found */ + u_long ips_badaddr; /* invalid address on header */ +}; + +#ifdef _WRS_KERNEL + +/* flags passed to ip_output as last parameter */ +#define IP_FORWARDING 0x1 /* most of ip header exists */ +#define IP_RAWOUTPUT 0x2 /* raw ip header exists */ +#define IP_SENDONES 0x4 /* send all-ones broadcast */ +#define IP_ROUTETOIF SO_DONTROUTE /* bypass routing tables */ +#define IP_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */ + +struct ip; +struct inpcb; +struct route; +struct sockopt; + +#ifndef VIRTUAL_STACK +extern struct ipstat _ipstat; + +#ifndef RANDOM_IP_ID +extern u_short _ip_id; /* ip packet ctr, for ids */ +#endif /* !RANDOM_IP_ID */ + +extern int ip_defttl; /* default IP ttl */ +extern int ipforwarding; /* ip forwarding */ +extern struct route ipforward_rt; /* ip forwarding cached route */ +extern u_char ip_protox[]; + +extern int rsvp_on; +extern struct socket *ip_mrouter; /* multicast routing daemon */ +#endif /* !VIRTUAL_STACK */ + +extern int (*legal_vif_num)(int); +extern u_long (*ip_mcast_src)(int); + +extern struct pr_usrreqs rip_usrreqs; +extern int igmpmaxsrcfilter; /* maximum num .of msf per interface */ +extern int igmpsomaxsrc; /* maximum num .of msf per socket */ + +int ip_ctloutput(struct socket *, struct sockopt *sopt); +void ip_drain(void); +void ip_freemoptions(struct ip_moptions *); +_WRS_INITTEXT +void ip_init(void); +_WRS_FASTTEXT +int ip_output(struct mbuf *, + struct mbuf *, struct route *, int, struct ip_moptions *); +struct in_ifaddr * + ip_rtaddr(struct in_addr, struct route *); +void ip_savecontrol(struct inpcb *, struct mbuf **, struct ip *, + struct mbuf *); +void ip_slowtimo(void); +struct mbuf * + ip_srcroute(struct mbuf *); +int ip_chksrcroute (void); +int ip_stripoptions(struct mbuf *, struct mbuf *); +#ifdef RANDOM_IP_ID +u_int16_t + ip_randomid(void); +#endif +struct ifnet * + ip_multicast_if (struct in_addr *, int *); +int ip_check_router_alert (struct ip *); +int ip_getmopt_msflist (struct sock_msf *, u_int16_t *, + struct sockaddr_storage **, u_int *); +int rip_ctloutput(struct socket *, struct sockopt *); +void rip_ctlinput(int, struct sockaddr *, void *); +void rip_init(void); +void rip_input(struct mbuf *, int, int); +int rip_output(struct mbuf *, struct socket *, u_long); +/* void ipip_input(struct mbuf *, int, int); */ +void rsvp_input(struct mbuf *, int, int); +int ip_rsvp_init(struct socket *); +int ip_rsvp_done(void); + +_WRS_FASTTEXT +void in_delayed_cksum(struct mbuf *m); + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_NETINET_IP_VAR_H_ */ diff --git a/h/wrn/coreip/netinet/ipfw.h b/h/wrn/coreip/netinet/ipfw.h new file mode 100644 index 0000000..cbcb5af --- /dev/null +++ b/h/wrn/coreip/netinet/ipfw.h @@ -0,0 +1,374 @@ +/* ipfw.h - ipfw hook header file */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,12apr05,nee Replace _KERNEL with _WRS_KERNEL +01e,19jul04,vvv fixed warning +01d,15jul04,sar Remove some leftover code +01c,13jul04,sar Correct kernel define and update IPFW_HOOK to avoid + triggering errors from some compilers. +01b,22jun04,sar Update flags and cleanup unneeded stuff +01a,25may04,sar Created initial version +*/ + +/*- + * Copyright (c) 1996,1997 Berkeley Software Design, Inc. + * All rights reserved. + * The Berkeley Software Design Inc. software License Agreement specifies + * the terms and conditions for redistribution. + * + * BSDI $Id: ipfw.h,v 2.20 2002/12/20 16:10:30 prb Exp $ + */ + +/* + * Return values from ip filters using bpf + * + * Certain combinations do not make sense: + * IPFW_ICMP, IPFW_ACCEPT, and IPFW_CONTROL are mutually exclusive. + * When used as a return value back to IP, only IPFW_REJECT, IPFW_ACCEPT + * and IPFW_NEXT make sense. + * When IPFW_REJECT is sent to IP, the IPFW_SIZE bits contain the ICMP code + * (upper 8 bits) and type (lower 8 bits), if any. + * IPFW_CONTROL is only sent to user level daemons watching us. + * + * In the Wind River version we have changed the IP calling conventions. + * In our code we loop through the list of filters in the IP stack rather + * than having each filter call the next in the list. To handle this + * we include NEXT as a valid return value and use the previous value of + * SKIPPED for it. Currently we only use the REJECT, ACCEPT and NEXT bits + * the rest are included to allow us to use mostly the same bits if we + * expand our version in the future. + * + */ + +#ifndef __INCipfwh +#define __INCipfwh + +#define IPFW_REJECT 0x00000000 /* Packet was rejected */ +#define IPFW_ACCEPT 0x80000000 /* Packet was accepted */ +#define IPFW_REPORT 0x40000000 /* Reports this packet to user level */ +#define IPFW_CONTROL 0x20000000 /* A control message of sorts */ +#define IPFW_ICMP 0x20000000 /* Send back an ICMP message */ +#define IPFW_NEXT 0x10000000 /* Pass on to the next filter */ +#define IPFW_RETCODE 0xf0000000 /* valid bits in return code */ +#define IPFW_SIZE 0x0000ffff /* Number of bytes to send upward */ +#define IPFW_ICMPTYPE 0x0000ff00 /* ICMP type to return */ +#define IPFW_ICMPCODE 0x000000ff /* ICMP code to return */ +#define IPFW_USER 0x00ff0000 /* bits available to user */ +#define IPFW_FILTER 0x0f000000 /* Mask of the filter bits */ + +/* + * Filters 1 - 14 can be defined. + * 0 and 15 are magic + */ +#define IPFW_PREINPUT (1 << 24) +#define IPFW_INPUT (2 << 24) +#define IPFW_FORWARD (3 << 24) +#define IPFW_PREOUTPUT (4 << 24) /* not currently used */ +#define IPFW_OUTPUT (5 << 24) +#define IPFW_CALL (6 << 24) /* not currently used */ +#define IPFW_RATE (7 << 24) /* not currently used */ +#define IPFW_PREINPUT6 (8 << 24) +#define IPFW_INPUT6 (9 << 24) +#define IPFW_FORWARD6 (10 << 24) +#define IPFW_PREOUTPUT6 (11 << 24) /* not currently used */ +#define IPFW_OUTPUT6 (12 << 24) + +/* + * Our socket options + */ +#define IPFW_SELECT 0x01 /* Set/get the selection mask */ + +/* + * Several of the BPF memory locations are pre-loaded as follows: + */ +#define IPFWM_AUX 0 /* aux return value for errors */ +#define IPFWM_SRCIF 1 /* source interface index */ +#define IPFWM_DSTIF 2 /* destination interface index */ +#define IPFWM_SRCRT 3 /* interface to route back to source */ +#define IPFWM_MFLAGS 4 /* mbuf flags */ +#define IPFWM_EXTRA 5 /* extra headers in front of packet */ +#define IPFWM_POINT 6 /* what filter point we came from */ +#define IPFWM_DSTADDR 7 /* routing destination address */ + +#define IPFWM_MAX 8 + +/* + * sysctl values for NET.INET.IP.IPFW.which.command + * + * Not all of these values are currently used. They are included for + * potential compatibility with other versions of the IPFW code + */ +#define IPFWCTL_PUSH 1 /* push on BPF filters/checksums */ +#define IPFWCTL_FLAGS 2 /* return the flags */ +#define IPFWCTL_SECURE 3 /* dont allow filter to change */ +#define IPFWCTL_FORW 4 /* apply to forwarded packets too */ +#define IPFWCTL_STATS 5 /* gather filter statistics */ +#define IPFWCTL_POP 6 /* pop off specified filters */ +#define IPFWCTL_POPALL 7 /* pop off all filters here and below */ +#define IPFWCTL_SERIAL 8 /* get the next serial number */ +#define IPFWCTL_SYSCTL 9 /* call the filter specific sysctl */ +#define IPFWCTL_INSERT 10 /* insert into filter call list */ +#define IPFWCTL_RATEFILTER 11 /* apply a rate filter to an ifnet */ +#define IPFWCTL_MOVE 12 /* move filters in a chain */ +#define IPFWCTL_LIST 13 /* list all filters in a chain */ +#define IPFWCTL_CLEAN 14 /* clean a call filter entry */ +#define IPFWCTL_CALLFILTERS 15 /* list all filters in call chain */ + +/* + * Options for the list commands + */ + +#define IPFW_CONCISE 0 +#define IPFW_VERBOSE 1 + +/* + * Flags, see below + */ +#define IPFWF_MODIFY 0x0001 /* filter can modify the packet */ +#define IPFWF_DONTFREE 0x0002 /* do not free the packet on reject */ +#define IPFWF_CALL 0x0004 /* need to set up the call list */ +#define IPFWF_NEXTOK 0x0008 /* if we next off the chain, accept pkt*/ +#define IPFWF_ICMPOK 0x0010 /* filter can send icmp errors, not + yet implemented */ +#define IPFWF_FILTER1 0x1000 /* filter specific bit 1 */ +#define IPFWF_FILTER2 0x2000 /* filter specific bit 2 */ +#define IPFWF_FILTER3 0x4000 /* filter specific bit 3 */ +#define IPFWF_FILTER4 0x8000 /* filter specific bit 4 */ +#define IPFWF_FILTERM 0xf000 /* filter specific bits */ + +/* + * We define some macros here to include the optional flags passed in. + * They are passed along with the filter type. + */ +#define IPFW_PREINPUTv4 (IPFW_PREINPUT|IPFWF_MODIFY|IPFWF_NEXTOK|IPFWF_ICMPOK) +#define IPFW_INPUTv4 (IPFW_INPUT | IPFWF_ICMPOK) +#define IPFW_FORWARDv4 (IPFW_FORWARD | IPFWF_MODIFY | IPFWF_ICMPOK) +#define IPFW_OUTPUTv4 (IPFW_OUTPUT | IPFWF_MODIFY) + +#define IPFW_PREINPUTv6 (IPFW_PREINPUT6 | IPFWF_MODIFY | IPFWF_NEXTOK) +#define IPFW_INPUTv6 (IPFW_INPUT6) +#define IPFW_FORWARDv6 (IPFW_FORWARD6 | IPFWF_MODIFY) +#define IPFW_OUTPUTv6 (IPFW_OUTPUT6 | IPFWF_MODIFY) + +/* + * types of blocks we can send into sysctl + * + * Most of this list is inherited from previous versions of IPFW. They + * have been included for potential compatibility. + */ +#define IPFW_BPF 1 /* BPF based filter follows */ +#define IPFW_CISCO 2 /* Cisco based filter follows */ +#define IPFW_CHECKSUM 3 /* cryptographic checksum follows */ +#define IPFW_PASSWORD 4 /* password to checksum follows */ +#define IPFW_CIRCUIT 5 /* Circuit cache filter follows */ +#define IPFW_FLOW 6 /* Flow monitor filter follows */ +#define IPFW_NAT 7 /* NAT table */ +#define IPFW_THROTTLE 8 /* Throttle filter */ +#define IPFW_CACHE 9 /* Cache lookup (filter) */ +#define IPFW_ECHOCHK 10 /* ICMP echo (filter) */ +#define IPFW_REWRITE 11 /* IP Rewrite (filter) */ +#define IPFW_IPSEC 12 /* IP Security filter */ +#define IPFW_FIREWALL 13 /* Firewall Filter */ + +#define IPFW_TAGLEN 32 /* Allow 32 character ascii tag */ + +/* + * Header that preceeds any part of a filter + */ +typedef struct { + int type; /* Type of block (see above) */ + size_t hlength; /* Length of this header */ + size_t length; /* Length of data after header */ + int serial; /* Our serial number */ + int priority; /* Our priority */ + char tag[IPFW_TAGLEN]; +} ipfw_filter_t; + +#define IPFW_round(x) (((x) + sizeof(int) - 1) & ~(sizeof(int)-1)) +#define IPFW_len(s) IPFW_round((s)->length) +#define IPFW_next(s) (((u_char *)(s) + s->hlength) + IPFW_len(s)) + +typedef struct { + u_int mask; + u_int code; +} ipfw_data_t; + +typedef struct { + u_short version; /* version number */ + u_short hdrlen; /* length of header */ + u_long length; /* length of packet */ + u_int code; /* code word */ + struct timespec when; /* when the packet came in */ +} ipfw_hdr_t; + +#define IPFW_VER_1_0 0x0100 /* First version (with version numbers) */ + +typedef struct ipfw_opt_t { + u_long bits; + int extra; + struct mbuf *mbuf; + struct ifnet *dstifp; + u_int32_t dstaddr; +} ipfw_opt_t; + +#define IPFWB_EXTRA 0x0001 /* Extra value is included */ +#define IPFWB_DSTIF 0x0002 /* Destination IFP is included */ +#define IPFWB_MBUF 0x0004 /* Mbuf was replaced (return) */ +#define IPFWB_DSTADDR 0x0008 /* New routing destination (return) */ + +#define ioptchk(iopt,bit) ((iopt) && ((iopt)->bits) & bit) +#ifdef _WRS_KERNEL + +/* Forward reference */ +struct ipfw_anchor_t; + +/* The structure for holding information about a given instance + of a filter */ +typedef struct ipfw_t { + int type; + int serial; + int priority; + char tag[IPFW_TAGLEN]; + u_long (*filter) __P((struct ipfw_t *, struct mbuf **, + int *, ipfw_opt_t *)); + void (*free) __P((struct ipfw_t *)); + int (*get) __P((struct ipfw_t *, void *, size_t *, size_t *)); + int (*push) __P((struct ipfw_t *, void *, size_t)); + int (*sysctl) __P((struct ipfw_t *, int *, u_int, void *, + size_t *, void *, size_t)); + int len; /* length of filter + (for return on sysctl) */ + struct ipfw_anchor_t *parent; + struct ipfw_t *next; + struct ipfw_t *prev; + void *private; +} ipfw_t; + +typedef struct ipfw_t IPFW_T; + +typedef struct ipfw_stats_t { + quad_t dropped; /* packets dropped by filter */ + quad_t denied; /* packets dropped & reported by filter */ + quad_t accepted; /* packets accepted by filter */ + quad_t reported; /* packets accepted & reported by filter */ + quad_t reportfailed; /* packets where reported failed by filter */ + quad_t unknown; /* packets where reported failed by filter */ +} ipfw_stats_t; + +/* The structure for holding the anchor for a list of filters. + One of these is created for each point at which we want to + be able to invoke filters. */ +typedef struct ipfw_anchor_t { + ipfw_t *filter_list; /* pointer to list of filters */ + ipfw_stats_t stats; /* space for the statistics */ +} ipfw_anchor_t; + +/* The structure to map from a type to a routine to create a filter + of that type and install it into one of our lists. What information + each filter needs is up to that class of filter. */ +#define IPFW_MAX_PUSH_POINTS 32 +typedef int (*IPFW_PUSH_FUNCPTR) (struct ipfw_t *, void *, size_t); +typedef struct { + int type; + IPFW_PUSH_FUNCPTR push; +} ipfw_type_t; + +#ifndef VIRTUAL_STACK +extern int ipfw_serial; + +extern ipfw_anchor_t ipfw_input; +extern ipfw_anchor_t ipfw_forward; +extern ipfw_anchor_t ipfw_output; +extern ipfw_anchor_t ipfw_preinput; +extern ipfw_anchor_t ipfw_call; +extern ipfw_anchor_t ipfw_rate; +extern ipfw_type_t ipfw_types[]; + +#ifdef INET6 +extern ipfw_anchor_t ipfw_input6; +extern ipfw_anchor_t ipfw_forward6; +extern ipfw_anchor_t ipfw_output6; +extern ipfw_anchor_t ipfw_preinput6; +#endif + +#if 0 +/* These aren't currently implemented */ +extern ipfw_call_t *ipfw_filters; +extern int ipfw_nfilters; +#endif + +#endif /* VIRTUAL_STACK */ + +void ipfwInit __P((void)); + +#ifdef INET6 +void ipfw6Init __P((void)); +#endif + +int ipfwSysctl __P((int *, u_int, void *, size_t *, void *, size_t)); +int ipfwPushRegister __P((int, IPFW_PUSH_FUNCPTR)); + +#define NULL_DAP ((struct in_addr *)0) + +#define IPFW_HOOK(_ipf, _mp, _dir, _bits, _difp, _extra, _dap, _res, _iopt) \ +{ \ + int argBits = _bits; \ + \ + (_iopt)->bits = (argBits) & ~IPFWB_DSTADDR; \ + if ((argBits) & IPFWB_DSTIF) \ + {(_iopt)->dstifp = _difp; } \ + else \ + {(_iopt)->dstifp = 0; } \ + *_res = ((_ipf)->filter)(_ipf, _mp, _dir, _iopt) & IPFW_RETCODE; \ + if (((argBits) & IPFWB_DSTADDR) && \ + (((_iopt)->bits & IPFWB_DSTADDR) != 0)) \ + {(_dap)->s_addr = (_iopt)->dstaddr; } \ +} + +#endif + + +#if 0 +/* The following items haven't been ported or used yet */ + +/* + * Call the next filter in the chain, but only if we are not on the call chain. + */ +#define NEXTFILTER(filterp, m, dir, iopt) do { \ + if ((dir & IPFWF_CALL) == 0 && filterp->next) \ + return(filterp->next->filter(filterp->next, m, dir, iopt)); \ +} while (0) + + +/* + * The ipfw_call_t struct contains the list of filters on the + * call chain. There can be at most 64K at one time. + * The reference index is actually (index | (generation << 16)). + * This allows the calling filter to know if it is calling the + * correct filter or not. + * + * This structure is also used to report the call chain back to user + * level so that an association between tag and index number can be made. + */ +typedef struct { + u_short generation; /* what generation we are */ + u_short index; /* our index number for reporting */ + char tag[IPFW_TAGLEN]; /* last tag to hold this index */ +#ifdef KERNEL + ipfw_t *filter; /* current filter holding index */ +#else + void *filter; +#endif +} ipfw_call_t; + +void ipfw_log __P((struct mbuf *, u_int, struct ifnet *, ipfw_stats_t *)); + +#endif /* #if 0 */ +#endif /* __INCipfwh */ + + + diff --git a/h/wrn/coreip/netinet/ipprotosw.h b/h/wrn/coreip/netinet/ipprotosw.h new file mode 100644 index 0000000..d246429 --- /dev/null +++ b/h/wrn/coreip/netinet/ipprotosw.h @@ -0,0 +1,126 @@ +/* ipprotosw.h - ip protocol swith table difinition */ + +/* Copyright 2001-2003 Wind River Systems, Inc. */ + +/* + * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/*- + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)protosw.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/sys/netinet/ipprotosw.h,v 1.1 1999/12/22 19:13:23 shin Exp $ + */ + +/* +modification history +-------------------- +01e,20nov03,niq Remove copyright_wrs.h file inclusion +01d,04nov03,rlm Ran batch header path update for header re-org. +01c,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01b,29apr03,syy Added #ifdef for __cplusplus +01a,27aug01,hsh Created from BSD 4.3 +*/ + + +#ifndef _NETINET_IPPROTOSW_H_ +#define _NETINET_IPPROTOSW_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declare these structures referenced from prototypes below. */ +struct mbuf; +struct proc; +struct sockaddr; +struct socket; +struct sockopt; + +struct ipprotosw { + short pr_type; /* socket type used for */ + struct domain *pr_domain; /* domain protocol a member of */ + short pr_protocol; /* protocol number */ + short pr_flags; /* see below */ +/* protocol-protocol hooks */ + void (*pr_input) __P((struct mbuf *, int off, int proto)); + /* input to protocol (from below) */ + int (*pr_output) __P((struct mbuf *m, struct socket *so)); + /* output to protocol (from above) */ + void (*pr_ctlinput)__P((int, struct sockaddr *, void *)); + /* control input (from below) */ + int (*pr_ctloutput)__P((struct socket *, struct sockopt *)); + /* control output (from above) */ +/* user-protocol hook */ + void *pr_ousrreq; +/* utility hooks */ + void (*pr_init) __P((void)); /* initialization hook */ + void (*pr_fasttimo) __P((void)); + /* fast timeout (200ms) */ + void (*pr_slowtimo) __P((void)); + /* slow timeout (500ms) */ + void (*pr_drain) __P((void)); + /* flush any excess space possible */ + struct pr_usrreqs *pr_usrreqs; /* supersedes pr_usrreq() */ +}; + +#ifdef __cplusplus +} +#endif + +#endif /* !_NETINET_IPPROTOSW_H_ */ diff --git a/h/wrn/coreip/netinet/pim.h b/h/wrn/coreip/netinet/pim.h new file mode 100644 index 0000000..1dde215 --- /dev/null +++ b/h/wrn/coreip/netinet/pim.h @@ -0,0 +1,143 @@ +/* pim.h - PIM header file */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* + * Copyright (c) 1996-2000 + * University of Southern California/Information Sciences Institute. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: /repoman/r/ncvs/src/sys/netinet/pim.h,v 1.1.2.1 2003/08/24 17:04:44 hsu Exp $ + */ + +/* +modification history +-------------------- +01a,25feb05,niq Created +*/ + +#ifndef _NETINET_PIM_H_ +#define _NETINET_PIM_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Protocol Independent Multicast (PIM) definitions. + * RFC 2362, June 1998. + * + * Written by Ahmed Helmy, USC/SGI, July 1996. + * Modified by George Edmond Eddy (Rusty), ISI, February 1998. + * Modified by Pavlin Radoslavov, USC/ISI, May 1998, October 2000. + */ + +#ifndef _PIM_VT +#ifndef _BYTE_ORDER +# error _BYTE_ORDER is not defined! +#endif +#if (_BYTE_ORDER != _BIG_ENDIAN) && (_BYTE_ORDER != _LITTLE_ENDIAN) +# error _BYTE_ORDER must be defined to either _BIG_ENDIAN or _LITTLE_ENDIAN +#endif +#endif /* ! _PIM_VT */ + +/* + * PIM packet header + */ +struct pim { +#ifdef _PIM_VT + uint8_t pim_vt; /* PIM version and message type */ +#else /* ! _PIM_VT */ +#if _BYTE_ORDER == _BIG_ENDIAN + u_int pim_vers:4, /* PIM protocol version */ + pim_type:4; /* PIM message type */ +#endif +#if _BYTE_ORDER == _LITTLE_ENDIAN + u_int pim_type:4, /* PIM message type */ + pim_vers:4; /* PIM protocol version */ +#endif +#endif /* ! _PIM_VT */ + uint8_t pim_reserved; /* Reserved */ + uint16_t pim_cksum; /* IP-style checksum */ +}; +/* KAME-related name backward compatibility */ +#define pim_ver pim_vers +#define pim_rsv pim_reserved + +#ifdef _PIM_VT +#define PIM_MAKE_VT(v, t) (0xff & (((v) << 4) | (0x0f & (t)))) +#define PIM_VT_V(x) (((x) >> 4) & 0x0f) +#define PIM_VT_T(x) ((x) & 0x0f) +#endif /* _PIM_VT */ + +#define PIM_VERSION 2 +#define PIM_MINLEN 8 /* PIM message min. length */ +#define PIM_REG_MINLEN (PIM_MINLEN+20) /* PIM Register hdr + inner IPv4 hdr */ +#define PIM6_REG_MINLEN (PIM_MINLEN+40) /* PIM Register hdr + inner IPv6 hdr */ + +/* + * PIM message types + */ +#define PIM_HELLO 0x0 /* PIM-SM and PIM-DM */ +#define PIM_REGISTER 0x1 /* PIM-SM only */ +#define PIM_REGISTER_STOP 0x2 /* PIM-SM only */ +#define PIM_JOIN_PRUNE 0x3 /* PIM-SM and PIM-DM */ +#define PIM_BOOTSTRAP 0x4 /* PIM-SM only */ +#define PIM_ASSERT 0x5 /* PIM-SM and PIM-DM */ +#define PIM_GRAFT 0x6 /* PIM-DM only */ +#define PIM_GRAFT_ACK 0x7 /* PIM-DM only */ +#define PIM_CAND_RP_ADV 0x8 /* PIM-SM only */ +#define PIM_ALL_DF_ELECTION 0xa /* Bidir-PIM-SM only */ + +/* + * PIM-Register message flags + */ +#define PIM_BORDER_REGISTER 0x80000000U /* The Border bit (host-order) */ +#define PIM_NULL_REGISTER 0x40000000U /* The Null-Register bit (host-order)*/ + +/* + * All-PIM-Routers IPv4 and IPv6 multicast addresses + */ +#define INADDR_ALLPIM_ROUTERS_GROUP (uint32_t)0xe000000dU /* 224.0.0.13 */ +#define IN6ADDR_LINKLOCAL_ALLPIM_ROUTERS "ff02::d" +#define IN6ADDR_LINKLOCAL_ALLPIM_ROUTERS_INIT \ + {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d }}} + +#ifdef __cplusplus +} +#endif + +#endif /* _NETINET_PIM_H_ */ diff --git a/h/wrn/coreip/netinet/pim_var.h b/h/wrn/coreip/netinet/pim_var.h new file mode 100644 index 0000000..57899bd --- /dev/null +++ b/h/wrn/coreip/netinet/pim_var.h @@ -0,0 +1,108 @@ +/* pim_var.h - PIM variables header file */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* + * Copyright (c) 1998-2000 + * University of Southern California/Information Sciences Institute. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: /repoman/r/ncvs/src/sys/netinet/pim_var.h,v 1.1.2.1 2003/08/24 17:04:44 hsu Exp $ + */ + +/* +modification history +-------------------- +01a,25feb05,niq Created +*/ + +#ifndef _NETINET_PIM_VAR_H_ +#define _NETINET_PIM_VAR_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * Protocol Independent Multicast (PIM), + * kernel variables and implementation-specific definitions. + * + * Written by George Edmond Eddy (Rusty), ISI, February 1998. + * Modified by Pavlin Radoslavov, USC/ISI, May 1998, Aug 1999, October 2000. + * Modified by Hitoshi Asaeda, WIDE, August 1998. + */ + +/* + * PIM statistics kept in the kernel + */ +struct pimstat { + u_quad_t pims_rcv_total_msgs; /* total PIM messages received */ + u_quad_t pims_rcv_total_bytes; /* total PIM bytes received */ + u_quad_t pims_rcv_tooshort; /* rcvd with too few bytes */ + u_quad_t pims_rcv_badsum; /* rcvd with bad checksum */ + u_quad_t pims_rcv_badversion; /* rcvd bad PIM version */ + u_quad_t pims_rcv_registers_msgs; /* rcvd regs. msgs (data only) */ + u_quad_t pims_rcv_registers_bytes; /* rcvd regs. bytes (data only) */ + u_quad_t pims_rcv_registers_wrongiif; /* rcvd regs. on wrong iif */ + u_quad_t pims_rcv_badregisters; /* rcvd invalid registers */ + u_quad_t pims_snd_registers_msgs; /* sent regs. msgs (data only) */ + u_quad_t pims_snd_registers_bytes; /* sent regs. bytes (data only) */ +}; + +/* + * Names for PIM sysctl objects + */ +#define PIMCTL_STATS 1 /* statistics (read-only) */ +#define PIMCTL_MAXID 2 + +#define PIMCTL_NAMES { \ + { 0, 0 }, \ + { "stats", CTLTYPE_STRUCT }, \ +} + +#ifdef _WRS_KERNEL +extern struct pimstat pimstat; + +void pim_input(struct mbuf *, int, int); +SYSCTL_DECL(pim); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _NETINET_PIM_VAR_H_ */ diff --git a/h/wrn/coreip/netinet/sctp.h b/h/wrn/coreip/netinet/sctp.h new file mode 100644 index 0000000..c6bddc9 --- /dev/null +++ b/h/wrn/coreip/netinet/sctp.h @@ -0,0 +1,317 @@ +/* $KAME: sctp.h,v 1.18 2005/03/06 16:04:16 itojun Exp $ */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,29jul05,kch ported from Kame +*/ + +#ifndef _NETINET_SCTP_H_ +#define _NETINET_SCTP_H_ + +/* + * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Cisco Systems, Inc. + * 4. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY CISCO SYSTEMS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CISCO SYSTEMS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * SCTP protocol - RFC2960. + */ + +struct sctphdr { + u_int16_t src_port; /* source port */ + u_int16_t dest_port; /* destination port */ + u_int32_t v_tag; /* verification tag of packet */ + u_int32_t checksum; /* Adler32 C-Sum */ + /* chunks follow... */ +}; + +/* + * SCTP Chunks + */ +struct sctp_chunkhdr { + u_int8_t chunk_type; /* chunk type */ + u_int8_t chunk_flags; /* chunk flags */ + u_int16_t chunk_length; /* chunk length */ + /* optional params follow */ +}; + +/* + * SCTP chunk parameters + */ +struct sctp_paramhdr { + u_int16_t param_type; /* parameter type */ + u_int16_t param_length; /* parameter length */ +}; + +/* + * user socket options + */ +/* read-write options */ +#define SCTP_NODELAY 0x00000001 +#define SCTP_MAXSEG 0x00000002 +#define SCTP_ASSOCINFO 0x00000003 + +#define SCTP_INITMSG 0x00000004 +#define SCTP_AUTOCLOSE 0x00000005 +#define SCTP_SET_PEER_PRIMARY_ADDR 0x00000006 +#define SCTP_PRIMARY_ADDR 0x00000007 + +/* read-only options */ +#define SCTP_STATUS 0x00000008 +#define SCTP_PCB_STATUS 0x00000009 + +/* ancillary data/notification interest options */ +#define SCTP_EVENTS 0x0000000a +/* sctp_opt_info params */ +#define SCTP_PEER_ADDR_PARAMS 0x0000000b +#define SCTP_GET_PEER_ADDR_INFO 0x0000000c +/* Hidden socket option that gets the addresses */ +#define SCTP_GET_PEER_ADDRESSES 0x0000000d +#define SCTP_GET_LOCAL_ADDRESSES 0x0000000e +/* + * Blocking I/O is enabled on any TCP type socket by default. + * For the UDP model if this is turned on then the socket buffer is + * shared for send resources amongst all associations. The default + * for the UDP model is that is SS_NBIO is set. Which means all associations + * have a seperate send limit BUT they will NOT ever BLOCK instead + * you will get an error back EAGAIN if you try to send to much. If + * you want the blocking symantics you set this option at the cost + * of sharing one socket send buffer size amongst all associations. + * Peeled off sockets turn this option off and block... but since both TCP and + * peeled off sockets have only one assoc per socket this is fine. + * It probably does NOT make sense to set this on SS_NBIO on a TCP model OR + * peeled off UDP model, but we do allow you to do so. You just use + * the normal syscall to toggle SS_NBIO the way you want. + */ +/* Blocking I/O is controled by the SS_NBIO flag on the + * socket state so_state field. + */ +#define SCTP_GET_SNDBUF_USE 0x0000000f +/* latter added read/write */ +#define SCTP_ADAPTION_LAYER 0x00000010 +#define SCTP_DISABLE_FRAGMENTS 0x00000011 +/* sctp_bindx() flags as socket options */ +#define SCTP_BINDX_ADD_ADDR 0x00000012 +#define SCTP_BINDX_REM_ADDR 0x00000013 +/* return the total count in bytes needed to hold all local addresses bound */ +#define SCTP_GET_LOCAL_ADDR_SIZE 0x00000014 +/* Without this applied we will give V4 and V6 addresses on a V6 socket */ +#define SCTP_I_WANT_MAPPED_V4_ADDR 0x00000015 +/* Return the total count in bytes needed to hold the remote address */ +#define SCTP_GET_REMOTE_ADDR_SIZE 0x00000016 +#define SCTP_GET_PEGS 0x00000017 +#define SCTP_DEFAULT_SEND_PARAM 0x00000018 +#define SCTP_SET_DEBUG_LEVEL 0x00000019 +#define SCTP_RTOINFO 0x0000001a +#define SCTP_AUTO_ASCONF 0x0000001b +#define SCTP_MAXBURST 0x0000001c +#define SCTP_GET_STAT_LOG 0x0000001d +#define SCTP_CONNECT_X 0x0000001e /* hidden opt for connectx */ +#define SCTP_RESET_STREAMS 0x0000001f +#define SCTP_CONNECT_X_DELAYED 0x00000020 /* hidden opt for connectx_delayed + * part of sctp_sendx() + */ +#define SCTP_CONNECT_X_COMPLETE 0x00000021 +#define SCTP_GET_ASOC_ID_LIST 0x00000022 + +/* Other BSD items */ +#define SCTP_GET_NONCE_VALUES 0x00000023 +#define SCTP_DELAYED_ACK_TIME 0x00000024 + +/* Things for the AUTH draft possibly */ +#define SCTP_PEER_PUBLIC_KEY 0x00000100 /* get the peers public key */ +#define SCTP_MY_PUBLIC_KEY 0x00000101 /* get/set my endpoints public key */ +#define SCTP_SET_AUTH_SECRET 0x00000102 /* get/set my shared secret */ +#define SCTP_SET_AUTH_CHUNKS 0x00000103/* specify what chunks you want + * the system may have additional requirments + * as well. I.e. probably ASCONF/ASCONF-ACK no matter + * if you want it or not. + */ +/* Debug things that need to be purged */ +#define SCTP_SET_INITIAL_DBG_SEQ 0x00001f00 +#define SCTP_RESET_PEGS 0x00002000 +#define SCTP_CLR_STAT_LOG 0x00002100 + +/* + * user state values + */ +#define SCTP_CLOSED 0x0000 +#define SCTP_BOUND 0x1000 +#define SCTP_LISTEN 0x2000 +#define SCTP_COOKIE_WAIT 0x0002 +#define SCTP_COOKIE_ECHOED 0x0004 +#define SCTP_ESTABLISHED 0x0008 +#define SCTP_SHUTDOWN_SENT 0x0010 +#define SCTP_SHUTDOWN_RECEIVED 0x0020 +#define SCTP_SHUTDOWN_ACK_SENT 0x0040 +#define SCTP_SHUTDOWN_PENDING 0x0080 + +/* + * SCTP operational error codes (user visible) + */ +#define SCTP_ERROR_NO_ERROR 0x0000 +#define SCTP_ERROR_INVALID_STREAM 0x0001 +#define SCTP_ERROR_MISSING_PARAM 0x0002 +#define SCTP_ERROR_STALE_COOKIE 0x0003 +#define SCTP_ERROR_OUT_OF_RESOURCES 0x0004 +#define SCTP_ERROR_UNRESOLVABLE_ADDR 0x0005 +#define SCTP_ERROR_UNRECOG_CHUNK 0x0006 +#define SCTP_ERROR_INVALID_PARAM 0x0007 +#define SCTP_ERROR_UNRECOG_PARAM 0x0008 +#define SCTP_ERROR_NO_USER_DATA 0x0009 +#define SCTP_ERROR_COOKIE_IN_SHUTDOWN 0x000a +/* draft-ietf-tsvwg-sctpimpguide */ +#define SCTP_ERROR_RESTART_NEWADDRS 0x000b +/* draft-ietf-tsvwg-addip-sctp */ +#define SCTP_ERROR_DELETE_LAST_ADDR 0x0100 +#define SCTP_ERROR_RESOURCE_SHORTAGE 0x0101 +#define SCTP_ERROR_DELETE_SOURCE_ADDR 0x0102 +#define SCTP_ERROR_ILLEGAL_ASCONF_ACK 0x0103 + +/* + * error cause parameters (user visisble) + */ +struct sctp_error_cause { + u_int16_t code; + u_int16_t length; + /* optional cause-specific info may follow */ +}; + +struct sctp_error_invalid_stream { + struct sctp_error_cause cause; /* code=SCTP_ERROR_INVALID_STREAM */ + u_int16_t stream_id; /* stream id of the DATA in error */ + u_int16_t reserved; +}; + +struct sctp_error_missing_param { + struct sctp_error_cause cause; /* code=SCTP_ERROR_MISSING_PARAM */ + u_int32_t num_missing_params; /* number of missing parameters */ + /* u_int16_t param_type's follow */ +}; + +struct sctp_error_stale_cookie { + struct sctp_error_cause cause; /* code=SCTP_ERROR_STALE_COOKIE */ + u_int32_t stale_time; /* time in usec of staleness */ +}; + +struct sctp_error_out_of_resource { + struct sctp_error_cause cause; /* code=SCTP_ERROR_OUT_OF_RESOURCES */ +}; + +struct sctp_error_unresolv_addr { + struct sctp_error_cause cause; /* code=SCTP_ERROR_UNRESOLVABLE_ADDR */ + +}; + +struct sctp_error_unrecognized_chunk { + struct sctp_error_cause cause; /* code=SCTP_ERROR_UNRECOG_CHUNK */ + struct sctp_chunkhdr ch; /* header from chunk in error */ +}; + +#define HAVE_SCTP 1 +#define HAVE_KERNEL_SCTP 1 +#define HAVE_SCTP_PRSCTP 1 +#define HAVE_SCTP_ADDIP 1 +#define HAVE_SCTP_CANSET_PRIMARY 1 +#define HAVE_SCTP_SAT_NETWORK_CAPABILITY1 +#define HAVE_SCTP_MULTIBUF 1 +#define HAVE_SCTP_NOCONNECT 0 +#define HAVE_SCTP_ECN_NONCE 1 /* ECN Nonce option */ + +/* Main SCTP chunk types, we place + * these here since that way natd and f/w's + * in user land can find them. + */ +#define SCTP_DATA 0x00 +#define SCTP_INITIATION 0x01 +#define SCTP_INITIATION_ACK 0x02 +#define SCTP_SELECTIVE_ACK 0x03 +#define SCTP_HEARTBEAT_REQUEST 0x04 +#define SCTP_HEARTBEAT_ACK 0x05 +#define SCTP_ABORT_ASSOCIATION 0x06 +#define SCTP_SHUTDOWN 0x07 +#define SCTP_SHUTDOWN_ACK 0x08 +#define SCTP_OPERATION_ERROR 0x09 +#define SCTP_COOKIE_ECHO 0x0a +#define SCTP_COOKIE_ACK 0x0b +#define SCTP_ECN_ECHO 0x0c +#define SCTP_ECN_CWR 0x0d +#define SCTP_SHUTDOWN_COMPLETE 0x0e + +/* draft-ietf-tsvwg-addip-sctp */ +#define SCTP_ASCONF 0xc1 +#define SCTP_ASCONF_ACK 0x80 + +/* draft-ietf-stewart-prsctp */ +#define SCTP_FORWARD_CUM_TSN 0xc0 + +/* draft-ietf-stewart-pktdrpsctp */ +#define SCTP_PACKET_DROPPED 0x81 + +/* draft-ietf-stewart-strreset-xxx */ +#define SCTP_STREAM_RESET 0x82 + +/* ABORT and SHUTDOWN COMPLETE FLAG */ +#define SCTP_HAD_NO_TCB 0x01 + +/* Packet dropped flags */ +#define SCTP_FROM_MIDDLE_BOX SCTP_HAD_NO_TCB +#define SCTP_BADCRC 0x02 +#define SCTP_PACKET_TRUNCATED 0x04 + +#define SCTP_SAT_NETWORK_MIN 400 /* min ms for RTT to set satellite time */ +#define SCTP_SAT_NETWORK_BURST_INCR 2 /* how many times to multiply maxburst in sat */ +/* Data Chuck Specific Flags */ +#define SCTP_DATA_FRAG_MASK 0x03 +#define SCTP_DATA_MIDDLE_FRAG 0x00 +#define SCTP_DATA_LAST_FRAG 0x01 +#define SCTP_DATA_FIRST_FRAG 0x02 +#define SCTP_DATA_NOT_FRAG 0x03 +#define SCTP_DATA_UNORDERED 0x04 + +/* ECN Nonce: SACK Chunk Specific Flags */ +#define SCTP_SACK_NONCE_SUM 0x01 + +#ifdef __cplusplus +} +#endif + +#include + +#endif /* !_NETINET_SCTP_H_ */ diff --git a/h/wrn/coreip/netinet/sctp_constants.h b/h/wrn/coreip/netinet/sctp_constants.h new file mode 100644 index 0000000..6d72216 --- /dev/null +++ b/h/wrn/coreip/netinet/sctp_constants.h @@ -0,0 +1,854 @@ +/* $KAME: sctp_constants.h,v 1.17 2005/03/06 16:04:17 itojun Exp $ */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,30aug05,sar limit memory for timewait tags +01a,29jul05,kch ported from Kame +*/ + +#ifndef __sctp_constants_h__ +#define __sctp_constants_h__ + +/* + * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Cisco Systems, Inc. + * 4. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY CISCO SYSTEMS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CISCO SYSTEMS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* wrs: added */ +extern int hz; /* tick rate */ + +#define SCTP_VERSION_STRING "KAME-BSD 1.1" +/*#define SCTP_AUDITING_ENABLED 1 used for debug/auditing */ +#define SCTP_AUDIT_SIZE 256 +#define SCTP_STAT_LOG_SIZE 80000 + +/* Places that CWND log can happen from */ +#define SCTP_CWND_LOG_FROM_FR 1 +#define SCTP_CWND_LOG_FROM_RTX 2 +#define SCTP_CWND_LOG_FROM_BRST 3 +#define SCTP_CWND_LOG_FROM_SS 4 +#define SCTP_CWND_LOG_FROM_CA 5 +#define SCTP_CWND_LOG_FROM_SAT 6 +#define SCTP_BLOCK_LOG_INTO_BLK 7 +#define SCTP_BLOCK_LOG_OUTOF_BLK 8 +#define SCTP_BLOCK_LOG_CHECK 9 +#define SCTP_STR_LOG_FROM_INTO_STRD 10 +#define SCTP_STR_LOG_FROM_IMMED_DEL 11 +#define SCTP_STR_LOG_FROM_INSERT_HD 12 +#define SCTP_STR_LOG_FROM_INSERT_MD 13 +#define SCTP_STR_LOG_FROM_INSERT_TL 14 +#define SCTP_STR_LOG_FROM_MARK_TSN 15 +#define SCTP_STR_LOG_FROM_EXPRS_DEL 16 +#define SCTP_FR_LOG_BIGGEST_TSNS 17 +#define SCTP_FR_LOG_STRIKE_TEST 18 +#define SCTP_FR_LOG_STRIKE_CHUNK 19 +#define SCTP_FR_T3_TIMEOUT 20 +#define SCTP_MAP_PREPARE_SLIDE 21 +#define SCTP_MAP_SLIDE_FROM 22 +#define SCTP_MAP_SLIDE_RESULT 23 +#define SCTP_MAP_SLIDE_CLEARED 24 +#define SCTP_MAP_SLIDE_NONE 25 +#define SCTP_FR_T3_MARK_TIME 26 +#define SCTP_FR_T3_MARKED 27 +#define SCTP_FR_T3_STOPPED 28 +#define SCTP_FR_MARKED 30 +#define SCTP_CWND_LOG_NOADV_SS 31 +#define SCTP_CWND_LOG_NOADV_CA 32 +#define SCTP_MAX_BURST_APPLIED 33 +#define SCTP_MAX_IFP_APPLIED 34 +#define SCTP_MAX_BURST_ERROR_STOP 35 +#define SCTP_INCREASE_PEER_RWND 36 +#define SCTP_DECREASE_PEER_RWND 37 +#define SCTP_SET_PEER_RWND_VIA_SACK 38 +#define SCTP_LOG_MBCNT_INCREASE 39 +#define SCTP_LOG_MBCNT_DECREASE 40 +#define SCTP_LOG_MBCNT_CHKSET 41 +/* + * To turn on various logging, you must first define SCTP_STAT_LOGGING. + * Then to get something to log you define one of the logging defines i.e. + * + * SCTP_CWND_LOGGING + * SCTP_BLK_LOGGING + * SCTP_STR_LOGGING + * SCTP_FR_LOGGING + * + * Any one or a combination of the logging can be turned on. + */ +#define SCTP_LOG_EVENT_CWND 1 +#define SCTP_LOG_EVENT_BLOCK 2 +#define SCTP_LOG_EVENT_STRM 3 +#define SCTP_LOG_EVENT_FR 4 +#define SCTP_LOG_EVENT_MAP 5 +#define SCTP_LOG_EVENT_MAXBURST 6 +#define SCTP_LOG_EVENT_RWND 7 +#define SCTP_LOG_EVENT_MBCNT 8 + + +/* number of associations by default for zone allocation */ +#define SCTP_MAX_NUM_OF_ASOC 40000 +/* how many addresses per assoc remote and local */ +#define SCTP_SCALE_FOR_ADDR 2 + +/* default AUTO_ASCONF mode enable(1)/disable(0) value (sysctl) */ +#define SCTP_DEFAULT_AUTO_ASCONF 0 + +/* + * If you wish to use MD5 instead of SLA uncomment the line below. + * Why you would like to do this: + * a) There may be IPR on SHA-1, or so the FIP-180-1 page says, + * b) MD5 is 3 times faster (has coded here). + * + * The disadvantage is it is thought that MD5 has been cracked... see RFC2104. + */ +/*#define USE_MD5 1 */ +/* + * Note: I can't seem to get this to compile now for some reason- the + * kernel can't link in the md5 crypto + */ + +/* DEFINE HERE WHAT CRC YOU WANT TO USE */ +#define SCTP_USECRC_RFC2960 1 +/*#define SCTP_USECRC_FLETCHER 1*/ +/*#define SCTP_USECRC_SSHCRC32 1*/ +/*#define SCTP_USECRC_FASTCRC32 1*/ +/*#define SCTP_USECRC_CRC32 1*/ +/*#define SCTP_USECRC_TCP32 1*/ +/*#define SCTP_USECRC_CRC16SMAL 1*/ +/*#define SCTP_USECRC_CRC16 1 */ +/*#define SCTP_USECRC_MODADLER 1*/ + +#ifndef SCTP_ADLER32_BASE +#define SCTP_ADLER32_BASE 65521 +#endif + +#define SCTP_CWND_POSTS_LIST 256 +/* + * the SCTP protocol signature + * this includes the version number encoded in the last 4 bits + * of the signature. + */ +#define PROTO_SIGNATURE_A 0x30000000 +#define SCTP_VERSION_NUMBER 0x3 + +#define MAX_TSN 0xffffffff +#define MAX_SEQ 0xffff + +/* how many executions every N tick's */ +#define SCTP_MAX_ITERATOR_AT_ONCE 20 + +/* number of clock ticks between iterator executions */ +#define SCTP_ITERATOR_TICKS 1 + +/* option: + * If you comment out the following you will receive the old + * behavior of obeying cwnd for the fast retransmit algorithm. + * With this defined a FR happens right away with-out waiting + * for the flightsize to drop below the cwnd value (which is + * reduced by the FR to 1/2 the inflight packets). + */ +#define SCTP_IGNORE_CWND_ON_FR 1 + +/* + * Adds implementors guide behavior to only use newest highest + * update in SACK gap ack's to figure out if you need to stroke + * a chunk for FR. + */ +#define SCTP_NO_FR_UNLESS_SEGMENT_SMALLER 1 + +/* default max I can burst out after a fast retransmit */ +#define SCTP_DEF_MAX_BURST 8 + +/* Packet transmit states in the sent field */ +#define SCTP_DATAGRAM_UNSENT 0 +#define SCTP_DATAGRAM_SENT 1 +#define SCTP_DATAGRAM_RESEND1 2 /* not used (in code, but may hit this value) */ +#define SCTP_DATAGRAM_RESEND2 3 /* not used (in code, but may hit this value) */ +#define SCTP_DATAGRAM_RESEND3 4 /* not used (in code, but may hit this value) */ +#define SCTP_DATAGRAM_RESEND 5 +#define SCTP_DATAGRAM_ACKED 10010 +#define SCTP_DATAGRAM_INBOUND 10011 +#define SCTP_READY_TO_TRANSMIT 10012 +#define SCTP_DATAGRAM_MARKED 20010 +#define SCTP_FORWARD_TSN_SKIP 30010 + +/* SCTP chunk types */ +/* Moved to sctp.h so f/w and natd + * boxes can find the chunk types. + */ + +/* align to 32-bit sizes */ +#define SCTP_SIZE32(x) ((((x)+3) >> 2) << 2) + +#define IS_SCTP_CONTROL(a) ((a)->chunk_type != SCTP_DATA) +#define IS_SCTP_DATA(a) ((a)->chunk_type == SCTP_DATA) + +/* SCTP parameter types */ +#define SCTP_HEARTBEAT_INFO 0x0001 +#define SCTP_IPV4_ADDRESS 0x0005 +#define SCTP_IPV6_ADDRESS 0x0006 +#define SCTP_STATE_COOKIE 0x0007 +#define SCTP_UNRECOG_PARAM 0x0008 +#define SCTP_COOKIE_PRESERVE 0x0009 +#define SCTP_HOSTNAME_ADDRESS 0x000b +#define SCTP_SUPPORTED_ADDRTYPE 0x000c +#define SCTP_ECN_CAPABLE 0x8000 +/* draft-ietf-stewart-strreset-xxx */ +#define SCTP_STR_RESET_REQUEST 0x000d +#define SCTP_STR_RESET_RESPONSE 0x000e + +/* ECN Nonce: draft-ladha-sctp-ecn-nonce */ +#define SCTP_ECN_NONCE_SUPPORTED 0x8001 +/* + * draft-ietf-stewart-strreset-xxx + * param=0x8001 len=0xNNNN + * Byte | Byte | Byte | Byte + * Byte | Byte ... + * + * Where each Byte is a chunk type + * extension supported so for example + * to support all chunks one would have (in hex): + * + * 80 01 00 09 + * C0 C1 80 81 + * 82 00 00 00 + * + * Has the parameter. + * C0 = PR-SCTP (RFC3758) + * C1, 80 = ASCONF (addip draft) + * 81 = Packet Drop + * 82 = Stream Reset + */ + +/* draft-ietf-tsvwg-prsctp */ +#define SCTP_SUPPORTED_CHUNK_EXT 0x8008 + +/* number of extensions we support */ +#define SCTP_EXT_COUNT 5 /* num of extensions we support chunk wise */ +#define SCTP_PAD_EXT_COUNT 3 /* num of pad bytes needed to get to 32 bit boundary */ + + +#define SCTP_PRSCTP_SUPPORTED 0xc000 +/* draft-ietf-tsvwg-addip-sctp */ +#define SCTP_ADD_IP_ADDRESS 0xc001 +#define SCTP_DEL_IP_ADDRESS 0xc002 +#define SCTP_ERROR_CAUSE_IND 0xc003 +#define SCTP_SET_PRIM_ADDR 0xc004 +#define SCTP_SUCCESS_REPORT 0xc005 +#define SCTP_ULP_ADAPTION 0xc006 + +/* Notification error codes */ +#define SCTP_NOTIFY_DATAGRAM_UNSENT 0x0001 +#define SCTP_NOTIFY_DATAGRAM_SENT 0x0002 +#define SCTP_FAILED_THRESHOLD 0x0004 +#define SCTP_HEARTBEAT_SUCCESS 0x0008 +#define SCTP_RESPONSE_TO_USER_REQ 0x000f +#define SCTP_INTERNAL_ERROR 0x0010 +#define SCTP_SHUTDOWN_GUARD_EXPIRES 0x0020 +#define SCTP_RECEIVED_SACK 0x0040 +#define SCTP_PEER_FAULTY 0x0080 + +/* Error causes used in SCTP op-err's and aborts */ +#define SCTP_CAUSE_INV_STRM 0x001 +#define SCTP_CAUSE_MISS_PARAM 0x002 +#define SCTP_CAUSE_STALE_COOKIE 0x003 +#define SCTP_CAUSE_OUT_OF_RESC 0x004 +#define SCTP_CAUSE_UNRESOLV_ADDR 0x005 +#define SCTP_CAUSE_UNRECOG_CHUNK 0x006 +#define SCTP_CAUSE_INVALID_PARAM 0x007 +/* This one is also the same as SCTP_UNRECOG_PARAM above */ +#define SCTP_CAUSE_UNRECOG_PARAM 0x008 +#define SCTP_CAUSE_NOUSER_DATA 0x009 +#define SCTP_CAUSE_COOKIE_IN_SHUTDOWN 0x00a +#define SCTP_CAUSE_RESTART_W_NEWADDR 0x00b +#define SCTP_CAUSE_USER_INITIATED_ABT 0x00c +#define SCTP_CAUSE_PROTOCOL_VIOLATION 0x00d + +/* Error's from add ip */ +#define SCTP_CAUSE_DELETEING_LAST_ADDR 0x100 +#define SCTP_CAUSE_OPERATION_REFUSED 0x101 +#define SCTP_CAUSE_DELETING_SRC_ADDR 0x102 +#define SCTP_CAUSE_ILLEGAL_ASCONF 0x103 + +/* bits for TOS field */ +#define SCTP_ECT0_BIT 0x02 +#define SCTP_ECT1_BIT 0x01 +#define SCTP_CE_BITS 0x03 + +/* below turns off above */ +#define SCTP_FLEXIBLE_ADDRESS 0x20 +#define SCTP_NO_HEARTBEAT 0x40 + +/* mask to get sticky */ +#define SCTP_STICKY_OPTIONS_MASK 0x0c + +/* MTU discovery flags */ +#define SCTP_DONT_FRAGMENT 0x0100 +#define SCTP_FRAGMENT_OK 0x0200 +#define SCTP_PR_SCTP_ENABLED 0x0400 +#define SCTP_PR_SCTP_BUFFER 0x0800 + +/* Chunk flags */ +#define SCTP_WINDOW_PROBE 0x01 + +/* + * SCTP states for internal state machine + * XXX (should match "user" values) + */ +#define SCTP_STATE_EMPTY 0x0000 +#define SCTP_STATE_INUSE 0x0001 +#define SCTP_STATE_COOKIE_WAIT 0x0002 +#define SCTP_STATE_COOKIE_ECHOED 0x0004 +#define SCTP_STATE_OPEN 0x0008 +#define SCTP_STATE_SHUTDOWN_SENT 0x0010 +#define SCTP_STATE_SHUTDOWN_RECEIVED 0x0020 +#define SCTP_STATE_SHUTDOWN_ACK_SENT 0x0040 +#define SCTP_STATE_SHUTDOWN_PENDING 0x0080 +#define SCTP_STATE_CLOSED_SOCKET 0x0100 +#define SCTP_STATE_MASK 0x007f + +#define SCTP_GET_STATE(asoc) ((asoc)->state & SCTP_STATE_MASK) + +/* SCTP reachability state for each address */ +#define SCTP_ADDR_REACHABLE 0x001 +#define SCTP_ADDR_NOT_REACHABLE 0x002 +#define SCTP_ADDR_NOHB 0x004 +#define SCTP_ADDR_BEING_DELETED 0x008 +#define SCTP_ADDR_NOT_IN_ASSOC 0x010 +#define SCTP_ADDR_WAS_PRIMARY 0x020 +#define SCTP_ADDR_SWITCH_PRIMARY 0x040 +#define SCTP_ADDR_OUT_OF_SCOPE 0x080 +#define SCTP_ADDR_DOUBLE_SWITCH 0x100 +#define SCTP_ADDR_UNCONFIRMED 0x200 + +#define SCTP_REACHABLE_MASK 0x203 + +/* bound address types (e.g. valid address types to allow) */ +#define SCTP_BOUND_V6 0x01 +#define SCTP_BOUND_V4 0x02 + +/* How long a cookie lives in seconds */ +#define SCTP_DEFAULT_COOKIE_LIFE 60 + +/* resource limit of streams */ +#define MAX_SCTP_STREAMS 2048 + +/* Maximum the mapping array will grow to (TSN mapping array) */ +#define SCTP_MAPPING_ARRAY 512 + +/* size of the inital malloc on the mapping array */ +#define SCTP_INITIAL_MAPPING_ARRAY 16 +/* how much we grow the mapping array each call */ +#define SCTP_MAPPING_ARRAY_INCR 32 + +/* + * Here we define the timer types used by the implementation + * as arguments in the set/get timer type calls. + */ +#define SCTP_TIMER_INIT 0 +#define SCTP_TIMER_RECV 1 +#define SCTP_TIMER_SEND 2 +#define SCTP_TIMER_HEARTBEAT 3 +#define SCTP_TIMER_PMTU 4 +#define SCTP_TIMER_MAXSHUTDOWN 5 +#define SCTP_TIMER_SIGNATURE 6 +/* + * number of timer types in the base SCTP structure used in + * the set/get and has the base default. + */ +#define SCTP_NUM_TMRS 7 + +/* timer types */ +#define SCTP_TIMER_TYPE_NONE 0 +#define SCTP_TIMER_TYPE_SEND 1 +#define SCTP_TIMER_TYPE_INIT 2 +#define SCTP_TIMER_TYPE_RECV 3 +#define SCTP_TIMER_TYPE_SHUTDOWN 4 +#define SCTP_TIMER_TYPE_HEARTBEAT 5 +#define SCTP_TIMER_TYPE_COOKIE 6 +#define SCTP_TIMER_TYPE_NEWCOOKIE 7 +#define SCTP_TIMER_TYPE_PATHMTURAISE 8 +#define SCTP_TIMER_TYPE_SHUTDOWNACK 9 +#define SCTP_TIMER_TYPE_ASCONF 10 +#define SCTP_TIMER_TYPE_SHUTDOWNGUARD 11 +#define SCTP_TIMER_TYPE_AUTOCLOSE 12 +#define SCTP_TIMER_TYPE_EVENTWAKE 13 +#define SCTP_TIMER_TYPE_STRRESET 14 +#define SCTP_TIMER_TYPE_INPKILL 15 + +/* + * Number of ticks before the soxwakeup() event that + * is delayed is sent AFTER the accept() call + */ +#define SCTP_EVENTWAKEUP_WAIT_TICKS 3000 + +/* + * Of course we really don't collect stale cookies, being folks + * of discerning taste. However we do count them, if we get too + * many before the association comes up.. we give up. Below is + * the constant that dictates when we give it up...this is a + * implemenation dependent treatment. In ours we do not ask for + * a extension of time, but just retry this many times... + */ +#define SCTP_MAX_STALE_COOKIES_I_COLLECT 10 + +/* max number of TSN's dup'd that I will hold */ +#define SCTP_MAX_DUP_TSNS 20 + +#define SCTP_TIMER_TYPE_ITERATOR 16 +/* + * Here we define the types used when setting the retry amounts. + */ +/* constants for type of set */ +#define SCTP_MAXATTEMPT_INIT 2 +#define SCTP_MAXATTEMPT_SEND 3 + +/* Maximum TSN's we will summarize in a drop report */ + +#define SCTP_MAX_DROP_REPORT 16 + +/* How many drop re-attempts we make on INIT/COOKIE-ECHO */ +#define SCTP_RETRY_DROPPED_THRESH 4 + +/* And the max we will keep a history of in the tcb + * which MUST be lower than 256. + */ + +#define SCTP_MAX_DROP_SAVE_REPORT 16 + +/* + * Here we define the default timers and the default number + * of attemts we make for each respective side (send/init). + */ + +/* Maxmium number of chunks a single association can have + * on it. Note that this is a squishy number since + * the count can run over this if the user sends a large + * message down .. the fragmented chunks don't count until + * AFTER the message is on queue.. it would be the next + * send that blocks things. This number will get tuned + * up at boot in the sctp_init and use the number + * of clusters as a base. This way high bandwidth + * environments will not get impacted by the lower + * bandwidth sending a bunch of 1 byte chunks + */ +#define SCTP_ASOC_MAX_CHUNKS_ON_QUEUE 512 + +#define MSEC_TO_TICKS(x) (((x) * hz) / 1000) +#define TICKS_TO_MSEC(x) (((x) * 1000) / hz) +#define SEC_TO_TICKS(x) ((x) * hz) + +/* init timer def = 1 sec */ +#define SCTP_INIT_SEC 1 + +/* send timer def = 1 seconds */ +#define SCTP_SEND_SEC 1 + +/* recv timer def = 200ms */ +#define SCTP_RECV_MSEC 200 + +/* 30 seconds + RTO (in ms) */ +#define SCTP_HB_DEFAULT_MSEC 30000 + +/* Max time I will wait for Shutdown to complete */ +#define SCTP_DEF_MAX_SHUTDOWN_SEC 180 + + +/* This is how long a secret lives, NOT how long a cookie lives + * how many ticks the current secret will live. + */ +#define SCTP_DEFAULT_SECRET_LIFE_SEC 3600 + +#define SCTP_RTO_UPPER_BOUND (60000) /* 60 sec in ms */ +#define SCTP_RTO_UPPER_BOUND_SEC 60 /* for the init timer */ +#define SCTP_RTO_LOWER_BOUND (1000) /* 1 sec in ms */ +#define SCTP_RTO_INITIAL (3000) /* 3 sec in ms */ + + +#define SCTP_INP_KILL_TIMEOUT 1000 /* number of ms to retry kill of inpcb*/ + +#define SCTP_DEF_MAX_INIT 8 +#define SCTP_DEF_MAX_SEND 10 + +#define SCTP_DEF_PMTU_RAISE_SEC 600 /* 10 min between raise attempts */ +#define SCTP_DEF_PMTU_MIN 600 + +#define SCTP_MSEC_IN_A_SEC 1000 +#define SCTP_USEC_IN_A_SEC 1000000 +#define SCTP_NSEC_IN_A_SEC 1000000000 + +#define SCTP_MAX_OUTSTANDING_DG 10000 + +/* How many streams I request initally by default */ +#define SCTP_OSTREAM_INITIAL 10 + +#define SCTP_SEG_TO_RWND_UPD 32 /* How many smallest_mtu's need to increase before + * a window update sack is sent (should be a + * power of 2). + */ +#define SCTP_SCALE_OF_RWND_TO_UPD 4 /* Incr * this > hiwat, send + * window update. Should be a + * power of 2. + */ +#define SCTP_MINIMAL_RWND (4096) /* minimal rwnd */ + +#define SCTP_ADDRMAX 20 + + +/* SCTP DEBUG Switch parameters */ +#define SCTP_DEBUG_TIMER1 0x00000001 +#define SCTP_DEBUG_TIMER2 0x00000002 +#define SCTP_DEBUG_TIMER3 0x00000004 +#define SCTP_DEBUG_TIMER4 0x00000008 +#define SCTP_DEBUG_OUTPUT1 0x00000010 +#define SCTP_DEBUG_OUTPUT2 0x00000020 +#define SCTP_DEBUG_OUTPUT3 0x00000040 +#define SCTP_DEBUG_OUTPUT4 0x00000080 +#define SCTP_DEBUG_UTIL1 0x00000100 +#define SCTP_DEBUG_UTIL2 0x00000200 +#define SCTP_DEBUG_INPUT1 0x00001000 +#define SCTP_DEBUG_INPUT2 0x00002000 +#define SCTP_DEBUG_INPUT3 0x00004000 +#define SCTP_DEBUG_INPUT4 0x00008000 +#define SCTP_DEBUG_ASCONF1 0x00010000 +#define SCTP_DEBUG_ASCONF2 0x00020000 +#define SCTP_DEBUG_OUTPUT5 0x00040000 +#define SCTP_DEBUG_PCB1 0x00100000 +#define SCTP_DEBUG_PCB2 0x00200000 +#define SCTP_DEBUG_PCB3 0x00400000 +#define SCTP_DEBUG_PCB4 0x00800000 +#define SCTP_DEBUG_INDATA1 0x01000000 +#define SCTP_DEBUG_INDATA2 0x02000000 +#define SCTP_DEBUG_INDATA3 0x04000000 +#define SCTP_DEBUG_INDATA4 0x08000000 +#define SCTP_DEBUG_USRREQ1 0x10000000 +#define SCTP_DEBUG_USRREQ2 0x20000000 +#define SCTP_DEBUG_PEEL1 0x40000000 +#define SCTP_DEBUG_ALL 0x7ff3f3ff +#define SCTP_DEBUG_NOISY 0x00040000 + +/* What sender needs to see to avoid SWS or we consider peers rwnd 0 */ +#define SCTP_SWS_SENDER_DEF 1420 + +/* + * SWS is scaled to the sb_hiwat of the socket. + * A value of 2 is hiwat/4, 1 would be hiwat/2 etc. + */ +/* What receiver needs to see in sockbuf or we tell peer its 1 */ +#define SCTP_SWS_RECEIVER_DEF 3000 + + +#define SCTP_INITIAL_CWND 4380 + +/* amount peer is obligated to have in rwnd or I will abort */ +#define SCTP_MIN_RWND 1500 + +#define SCTP_WINDOW_MIN 1500 /* smallest rwnd can be */ +#define SCTP_WINDOW_MAX 1048576 /* biggest I can grow rwnd to + * My playing around suggests a + * value greater than 64k does not + * do much, I guess via the kernel + * limitations on the stream/socket. + */ + +#define SCTP_MAX_BUNDLE_UP 256 /* max number of chunks to bundle */ + +/* I can handle a 1meg re-assembly */ +#define SCTP_DEFAULT_MAXMSGREASM 1048576 + +#define SCTP_DEFAULT_MAXSEGMENT 65535 + +#define DEFAULT_CHUNK_BUFFER 2048 +#define DEFAULT_PARAM_BUFFER 512 + +#define SCTP_DEFAULT_MINSEGMENT 512 /* MTU size ... if no mtu disc */ +#define SCTP_HOW_MANY_SECRETS 2 /* how many secrets I keep */ + +#define SCTP_NUMBER_OF_SECRETS 8 /* or 8 * 4 = 32 octets */ +#define SCTP_SECRET_SIZE 32 /* number of octets in a 256 bits */ + +#ifdef USE_MD5 +#define SCTP_SIGNATURE_SIZE 16 /* size of a MD5 signature */ +#else +#define SCTP_SIGNATURE_SIZE 20 /* size of a SLA-1 signature */ +#endif /* USE_MD5 */ + +#define SCTP_SIGNATURE_ALOC_SIZE 20 + +/* + * SCTP upper layer notifications + */ +#define SCTP_NOTIFY_ASSOC_UP 1 +#define SCTP_NOTIFY_ASSOC_DOWN 2 +#define SCTP_NOTIFY_INTERFACE_DOWN 3 +#define SCTP_NOTIFY_INTERFACE_UP 4 +#define SCTP_NOTIFY_DG_FAIL 5 +#define SCTP_NOTIFY_STRDATA_ERR 6 +#define SCTP_NOTIFY_ASSOC_ABORTED 7 +#define SCTP_NOTIFY_PEER_OPENED_STREAM 8 +#define SCTP_NOTIFY_STREAM_OPENED_OK 9 +#define SCTP_NOTIFY_ASSOC_RESTART 10 +#define SCTP_NOTIFY_HB_RESP 11 +#define SCTP_NOTIFY_ASCONF_SUCCESS 12 +#define SCTP_NOTIFY_ASCONF_FAILED 13 +#define SCTP_NOTIFY_PEER_SHUTDOWN 14 +#define SCTP_NOTIFY_ASCONF_ADD_IP 15 +#define SCTP_NOTIFY_ASCONF_DELETE_IP 16 +#define SCTP_NOTIFY_ASCONF_SET_PRIMARY 17 +#define SCTP_NOTIFY_PARTIAL_DELVIERY_INDICATION 18 +#define SCTP_NOTIFY_ADAPTION_INDICATION 19 +#define SCTP_NOTIFY_INTERFACE_CONFIRMED 20 +#define SCTP_NOTIFY_STR_RESET_RECV 21 +#define SCTP_NOTIFY_STR_RESET_SEND 22 +#define SCTP_NOTIFY_MAX 22 + + + + + +/* clock variance is 10ms */ +#define SCTP_CLOCK_GRANULARITY 10 + +#define IP_HDR_SIZE 40 /* we use the size of a IP6 header here + * this detracts a small amount for ipv4 + * but it simplifies the ipv6 addition + */ + +#ifndef IPPROTO_SCTP +#define IPPROTO_SCTP 132 /* the Official IANA number :-) */ +#endif /* !IPPROTO_SCTP */ + +#define SCTP_MAX_DATA_BUNDLING 256 +#define SCTP_MAX_CONTROL_BUNDLING 20 + +/* modular comparison */ +/* True if a > b (mod = M) */ +#define compare_with_wrap(a, b, M) (((a > b) && ((a - b) < ((M >> 1) + 1))) || \ + ((b > a) && ((b - a) > ((M >> 1) + 1)))) + + +/* Mapping array manipulation routines */ +#define SCTP_IS_TSN_PRESENT(arry, gap) ((arry[(gap >> 3)] >> (gap & 0x07)) & 0x01) +#define SCTP_SET_TSN_PRESENT(arry, gap) (arry[(gap >> 3)] |= (0x01 << ((gap & 0x07)))) +#define SCTP_UNSET_TSN_PRESENT(arry, gap) (arry[(gap >> 3)] &= ((~(0x01 << ((gap & 0x07)))) & 0xff)) + +/* pegs */ +#define SCTP_NUMBER_OF_PEGS 96 +/* peg index's */ +#define SCTP_PEG_SACKS_SEEN 0 +#define SCTP_PEG_SACKS_SENT 1 +#define SCTP_PEG_TSNS_SENT 2 +#define SCTP_PEG_TSNS_RCVD 3 +#define SCTP_DATAGRAMS_SENT 4 +#define SCTP_DATAGRAMS_RCVD 5 +#define SCTP_RETRANTSN_SENT 6 +#define SCTP_DUPTSN_RECVD 7 +#define SCTP_HB_RECV 8 +#define SCTP_HB_ACK_RECV 9 +#define SCTP_HB_SENT 10 +#define SCTP_WINDOW_PROBES 11 +#define SCTP_DATA_DG_RECV 12 +#define SCTP_TMIT_TIMER 13 +#define SCTP_RECV_TIMER 14 +#define SCTP_HB_TIMER 15 +#define SCTP_FAST_RETRAN 16 +#define SCTP_TIMERS_EXP 17 +#define SCTP_FR_INAWINDOW 18 +#define SCTP_RWND_BLOCKED 19 +#define SCTP_CWND_BLOCKED 20 +#define SCTP_RWND_DROPS 21 +#define SCTP_BAD_STRMNO 22 +#define SCTP_BAD_SSN_WRAP 23 +#define SCTP_DROP_NOMEMORY 24 +#define SCTP_DROP_FRAG 25 +#define SCTP_BAD_VTAGS 26 +#define SCTP_BAD_CSUM 27 +#define SCTP_INPKTS 28 +#define SCTP_IN_MCAST 29 +#define SCTP_HDR_DROPS 30 +#define SCTP_NOPORTS 31 +#define SCTP_CWND_NOFILL 32 +#define SCTP_CALLS_TO_CO 33 +#define SCTP_CO_NODATASNT 34 +#define SCTP_CWND_NOUSE_SS 35 +#define SCTP_MAX_BURST_APL 36 +#define SCTP_EXPRESS_ROUTE 37 +#define SCTP_NO_COPY_IN 38 +#define SCTP_CACHED_SRC 39 +#define SCTP_CWND_NOCUM 40 +#define SCTP_CWND_SS 41 +#define SCTP_CWND_CA 42 +#define SCTP_CWND_SKIP 43 +#define SCTP_CWND_NOUSE_CA 44 +#define SCTP_MAX_CWND 45 +#define SCTP_CWND_DIFF_CA 46 +#define SCTP_CWND_DIFF_SA 47 +#define SCTP_OQS_AT_SS 48 +#define SCTP_SQQ_AT_SS 49 +#define SCTP_OQS_AT_CA 50 +#define SCTP_SQQ_AT_CA 51 +#define SCTP_MOVED_MTU 52 +#define SCTP_MOVED_QMAX 53 +#define SCTP_SQC_AT_SS 54 +#define SCTP_SQC_AT_CA 55 +#define SCTP_MOVED_MAX 56 +#define SCTP_MOVED_NLEF 57 +#define SCTP_NAGLE_NOQ 58 +#define SCTP_NAGLE_OFF 59 +#define SCTP_OUTPUT_FRM_SND 60 +#define SCTP_SOS_NOSNT 61 +#define SCTP_NOS_NOSNT 62 +#define SCTP_SOSE_NOSNT 63 +#define SCTP_NOSE_NOSNT 64 +#define SCTP_DATA_OUT_ERR 65 +#define SCTP_DUP_SSN_RCVD 66 +#define SCTP_DUP_FR 67 +#define SCTP_VTAG_EXPR 68 +#define SCTP_VTAG_BOGUS 69 +#define SCTP_T3_SAFEGRD 70 +#define SCTP_PDRP_FMBOX 71 +#define SCTP_PDRP_FEHOS 72 +#define SCTP_PDRP_MB_DA 73 +#define SCTP_PDRP_MB_CT 74 +#define SCTP_PDRP_BWRPT 75 +#define SCTP_PDRP_CRUPT 76 +#define SCTP_PDRP_NEDAT 77 +#define SCTP_PDRP_PDBRK 78 +#define SCTP_PDRP_TSNNF 79 +#define SCTP_PDRP_DNFND 80 +#define SCTP_PDRP_DIWNP 81 +#define SCTP_PDRP_DIZRW 82 +#define SCTP_PDRP_BADD 83 +#define SCTP_PDRP_MARK 84 +#define SCTP_ECNE_RCVD 85 +#define SCTP_CWR_PERFO 86 +#define SCTP_ECNE_SENT 87 +#define SCTP_MSGC_DROP 88 +#define SCTP_SEND_QUEUE_POP 89 +#define SCTP_ERROUT_FRM_USR 90 +#define SCTP_SENDTO_FULL_CWND 91 +#define SCTP_QUEONLY_BURSTLMT 92 +#define SCTP_IFP_QUEUE_FULL 93 +#define SCTP_RESV2 94 +#define SCTP_RESV3 95 + +/* + * This value defines the number of vtag block time wait entry's + * per list element. Each entry will take 2 4 byte ints (and of + * course the overhead of the next pointer as well). Using 15 as + * an example will yield * ((8 * 15) + 8) or 128 bytes of overhead + * for each timewait block that gets initialized. Increasing it to + * 31 would yeild 256 bytes per block. + */ +/* Undef the following turns on per EP behavior */ +#define SCTP_VTAG_TIMEWAIT_PER_STACK 1 +#ifdef SCTP_VTAG_TIMEWAIT_PER_STACK +#define SCTP_NUMBER_IN_VTAG_BLOCK 15 +#else +/* The hash list is smaller if we are on a ep basis */ +#define SCTP_NUMBER_IN_VTAG_BLOCK 3 +#endif +/* + * If we use the STACK option, we have an array of this size head + * pointers. This array is mod'd the with the size to find which + * bucket and then all entries must be searched to see if the tag + * is in timed wait. If so we reject it. + */ +#define SCTP_STACK_VTAG_HASH_SIZE 31 + +/* Limit the number of blocks we can chain onto each hash entry */ +#define SCTP_MAX_VTAG_TIMEWAIT_BLOCKS 2 + +/* + * If we use the per-endpoint model than we do not have a hash + * table of entries but instead have a single head pointer and + * we must crawl through the entire list. + */ + +/* + * Number of seconds of time wait, tied to MSL value (2 minutes), + * so 2 * MSL = 4 minutes or 480 seconds. + */ +#define SCTP_TIME_WAIT 480 + +#define IN4_ISPRIVATE_ADDRESS(a) \ + ((((u_char *)&(a)->s_addr)[0] == 10) || \ + ((((u_char *)&(a)->s_addr)[0] == 172) && \ + (((u_char *)&(a)->s_addr)[1] >= 16) && \ + (((u_char *)&(a)->s_addr)[1] <= 32)) || \ + ((((u_char *)&(a)->s_addr)[0] == 192) && \ + (((u_char *)&(a)->s_addr)[1] == 168))) + +#define IN4_ISLOOPBACK_ADDRESS(a) \ + ((((u_char *)&(a)->s_addr)[0] == 127) && \ + (((u_char *)&(a)->s_addr)[1] == 0) && \ + (((u_char *)&(a)->s_addr)[2] == 0) && \ + (((u_char *)&(a)->s_addr)[3] == 1)) + + +#if defined(_WRS_KERNEL) + +#define SCTP_GETTIME_TIMEVAL(x) (microtime(x)) + +#if 0 /* wrs unsupported, not used by sctp anyway */ +#define SCTP_GETTIME_TIMESPEC(x) (nanotime(x)) +#endif + +#define sctp_sowwakeup(inp, so) \ +do { \ + if (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { \ + inp->sctp_flags |= SCTP_PCB_FLAGS_WAKEOUTPUT; \ + } else { \ + sowwakeup(so); \ + } \ +} while (0) + +#define sctp_sorwakeup(inp, so) \ +do { \ + if (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { \ + inp->sctp_flags |= SCTP_PCB_FLAGS_WAKEINPUT; \ + } else { \ + sorwakeup(so); \ + } \ +} while (0) + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/netinet/sctp_header.h b/h/wrn/coreip/netinet/sctp_header.h new file mode 100644 index 0000000..ae40ac2 --- /dev/null +++ b/h/wrn/coreip/netinet/sctp_header.h @@ -0,0 +1,507 @@ +/* $KAME: sctp_header.h,v 1.14 2005/03/06 16:04:17 itojun Exp $ */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,29jul05,kch ported from Kame +*/ + +#ifndef __sctp_header_h__ +#define __sctp_header_h__ + +/* + * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Cisco Systems, Inc. + * 4. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY CISCO SYSTEMS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CISCO SYSTEMS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/* + * Parameter structures + */ +struct sctp_ipv4addr_param { + struct sctp_paramhdr ph; /* type=SCTP_IPV4_PARAM_TYPE, len=8 */ + u_int32_t addr; /* IPV4 address */ +}; + +struct sctp_ipv6addr_param { + struct sctp_paramhdr ph; /* type=SCTP_IPV6_PARAM_TYPE, len=20 */ + u_int8_t addr[16]; /* IPV6 address */ +}; + +/* Cookie Preservative */ +struct sctp_cookie_perserve_param { + struct sctp_paramhdr ph; /* type=SCTP_COOKIE_PRESERVE, len=8 */ + u_int32_t time; /* time in ms to extend cookie */ +}; + +/* Host Name Address */ +struct sctp_host_name_param { + struct sctp_paramhdr ph; /* type=SCTP_HOSTNAME_ADDRESS */ + char name[1]; /* host name */ +}; + +/* supported address type */ +struct sctp_supported_addr_param { + struct sctp_paramhdr ph; /* type=SCTP_SUPPORTED_ADDRTYPE */ + u_int16_t addr_type[1]; /* array of supported address types */ +}; + +/* ECN parameter */ +struct sctp_ecn_supported_param { + struct sctp_paramhdr ph; /* type=SCTP_ECN_CAPABLE */ +}; + + +/* heartbeat info parameter */ +struct sctp_heartbeat_info_param { + struct sctp_paramhdr ph; + u_int32_t time_value_1; + u_int32_t time_value_2; + u_int32_t random_value1; + u_int32_t random_value2; + u_int16_t user_req; + u_int8_t addr_family; + u_int8_t addr_len; + char address[SCTP_ADDRMAX]; +}; + + +/* draft-ietf-tsvwg-prsctp */ +/* PR-SCTP supported parameter */ +struct sctp_prsctp_supported_param { + struct sctp_paramhdr ph; +}; + + +/* draft-ietf-tsvwg-addip-sctp */ +struct sctp_asconf_paramhdr { /* an ASCONF "parameter" */ + struct sctp_paramhdr ph; /* a SCTP parameter header */ + u_int32_t correlation_id; /* correlation id for this param */ +}; + +struct sctp_asconf_addr_param { /* an ASCONF address parameter */ + struct sctp_asconf_paramhdr aph; /* asconf "parameter" */ + struct sctp_ipv6addr_param addrp; /* max storage size */ +}; + +struct sctp_asconf_addrv4_param { /* an ASCONF address (v4) parameter */ + struct sctp_asconf_paramhdr aph; /* asconf "parameter" */ + struct sctp_ipv4addr_param addrp; /* max storage size */ +}; + + +/* ECN Nonce: draft-ladha-sctp-ecn-nonce */ +struct sctp_ecn_nonce_supported_param { + struct sctp_paramhdr ph; /* type = 0x8001 len = 4 */ +}; + +struct sctp_supported_chunk_types_param { + struct sctp_paramhdr ph; /* type = 0x8002 len = x */ + u_int8_t chunk_types[0]; +}; + +/* + * Structures for DATA chunks + */ +struct sctp_data { + u_int32_t tsn; + u_int16_t stream_id; + u_int16_t stream_sequence; + u_int32_t protocol_id; + /* user data follows */ +}; + +struct sctp_data_chunk { + struct sctp_chunkhdr ch; + struct sctp_data dp; +}; + +/* + * Structures for the control chunks + */ + +/* Initiate (INIT)/Initiate Ack (INIT ACK) */ +struct sctp_init { + u_int32_t initiate_tag; /* initiate tag */ + u_int32_t a_rwnd; /* a_rwnd */ + u_int16_t num_outbound_streams; /* OS */ + u_int16_t num_inbound_streams; /* MIS */ + u_int32_t initial_tsn; /* I-TSN */ + /* optional param's follow */ +}; + +/* state cookie header */ +struct sctp_state_cookie { /* this is our definition... */ + u_int8_t identification[16]; /* id of who we are */ + u_int32_t cookie_life; /* life I will award this cookie */ + u_int32_t tie_tag_my_vtag; /* my tag in old association */ + u_int32_t tie_tag_peer_vtag; /* peers tag in old association */ + u_int32_t peers_vtag; /* peers tag in INIT (for quick ref) */ + u_int32_t my_vtag; /* my tag in INIT-ACK (for quick ref) */ + struct timeval time_entered; /* the time I built cookie */ + u_int32_t address[4]; /* 4 ints/128 bits */ + u_int32_t addr_type; /* address type */ + u_int32_t laddress[4]; /* my local from address */ + u_int32_t laddr_type; /* my local from address type */ + u_int32_t scope_id; /* v6 scope id for link-locals */ + u_int16_t peerport; /* port address of the peer in the INIT */ + u_int16_t myport; /* my port address used in the INIT */ + u_int8_t ipv4_addr_legal; /* Are V4 addr legal? */ + + u_int8_t ipv6_addr_legal; /* Are V6 addr legal? */ + u_int8_t local_scope; /* IPv6 local scope flag */ + u_int8_t site_scope; /* IPv6 site scope flag */ + + u_int8_t ipv4_scope; /* IPv4 private addr scope */ + u_int8_t loopback_scope; /* loopback scope information */ + u_int16_t reserved; + /* + * at the end is tacked on the INIT chunk and the + * INIT-ACK chunk (minus the cookie). + */ +}; + +struct sctp_inv_mandatory_param { + u_int16_t cause; + u_int16_t length; + u_int32_t num_param; + u_int16_t param; + /* + * We include this to 0 it since only a missing cookie + * will cause this error. + */ + u_int16_t resv; +}; + +struct sctp_unresolv_addr { + u_int16_t cause; + u_int16_t length; + u_int16_t addr_type; + u_int16_t reserved; /* Only one invalid addr type */ +}; + +/* state cookie parameter */ +struct sctp_state_cookie_param { + struct sctp_paramhdr ph; + struct sctp_state_cookie cookie; +}; + +struct sctp_init_chunk { + struct sctp_chunkhdr ch; + struct sctp_init init; +}; + +struct sctp_init_msg { + struct sctphdr sh; + struct sctp_init_chunk msg; +}; +/* ... used for both INIT and INIT ACK */ +#define sctp_init_ack sctp_init +#define sctp_init_ack_chunk sctp_init_chunk +#define sctp_init_ack_msg sctp_init_msg + + +/* Selective Ack (SACK) */ +struct sctp_gap_ack_block { + u_int16_t start; /* Gap Ack block start */ + u_int16_t end; /* Gap Ack block end */ +}; + +struct sctp_sack { + u_int32_t cum_tsn_ack; /* cumulative TSN Ack */ + u_int32_t a_rwnd; /* updated a_rwnd of sender */ + u_int16_t num_gap_ack_blks; /* number of Gap Ack blocks */ + u_int16_t num_dup_tsns; /* number of duplicate TSNs */ + /* struct sctp_gap_ack_block's follow */ + /* u_int32_t duplicate_tsn's follow */ +}; + +struct sctp_sack_chunk { + struct sctp_chunkhdr ch; + struct sctp_sack sack; +}; + + +/* Heartbeat Request (HEARTBEAT) */ +struct sctp_heartbeat { + struct sctp_heartbeat_info_param hb_info; +}; + +struct sctp_heartbeat_chunk { + struct sctp_chunkhdr ch; + struct sctp_heartbeat heartbeat; +}; +/* ... used for Heartbeat Ack (HEARTBEAT ACK) */ +#define sctp_heartbeat_ack sctp_heartbeat +#define sctp_heartbeat_ack_chunk sctp_heartbeat_chunk + + +/* Abort Asssociation (ABORT) */ +struct sctp_abort_chunk { + struct sctp_chunkhdr ch; + /* optional error cause may follow */ +}; + +struct sctp_abort_msg { + struct sctphdr sh; + struct sctp_abort_chunk msg; +}; + + +/* Shutdown Association (SHUTDOWN) */ +struct sctp_shutdown_chunk { + struct sctp_chunkhdr ch; + u_int32_t cumulative_tsn_ack; +}; + + +/* Shutdown Acknowledgment (SHUTDOWN ACK) */ +struct sctp_shutdown_ack_chunk { + struct sctp_chunkhdr ch; +}; + + +/* Operation Error (ERROR) */ +struct sctp_error_chunk { + struct sctp_chunkhdr ch; + /* optional error causes follow */ +}; + + +/* Cookie Echo (COOKIE ECHO) */ +struct sctp_cookie_echo_chunk { + struct sctp_chunkhdr ch; + struct sctp_state_cookie cookie; +}; + +/* Cookie Acknowledgment (COOKIE ACK) */ +struct sctp_cookie_ack_chunk { + struct sctp_chunkhdr ch; +}; + +/* Explicit Congestion Notification Echo (ECNE) */ +struct sctp_ecne_chunk { + struct sctp_chunkhdr ch; + u_int32_t tsn; +}; + +/* Congestion Window Reduced (CWR) */ +struct sctp_cwr_chunk { + struct sctp_chunkhdr ch; + u_int32_t tsn; +}; + +/* Shutdown Complete (SHUTDOWN COMPLETE) */ +struct sctp_shutdown_complete_chunk { + struct sctp_chunkhdr ch; +}; + +/* Oper error holding a stale cookie */ +struct sctp_stale_cookie_msg { + struct sctp_paramhdr ph; /* really an error cause */ + u_int32_t time_usec; +}; + +struct sctp_adaption_layer_indication { + struct sctp_paramhdr ph; + u_int32_t indication; +}; + +struct sctp_cookie_while_shutting_down { + struct sctphdr sh; + struct sctp_chunkhdr ch; + struct sctp_paramhdr ph; /* really an error cause */ +}; + +struct sctp_shutdown_complete_msg { + struct sctphdr sh; + struct sctp_shutdown_complete_chunk shut_cmp; +}; + +/* draft-ietf-tsvwg-addip-sctp */ +/* Address/Stream Configuration Change (ASCONF) */ +struct sctp_asconf_chunk { + struct sctp_chunkhdr ch; + u_int32_t serial_number; + /* lookup address parameter (mandatory) */ + /* asconf parameters follow */ +}; + +/* Address/Stream Configuration Acknowledge (ASCONF ACK) */ +struct sctp_asconf_ack_chunk { + struct sctp_chunkhdr ch; + u_int32_t serial_number; + /* asconf parameters follow */ +}; + +/* draft-ietf-tsvwg-prsctp */ +/* Forward Cumulative TSN (FORWARD TSN) */ +struct sctp_forward_tsn_chunk { + struct sctp_chunkhdr ch; + u_int32_t new_cumulative_tsn; + /* stream/sequence pairs (sctp_strseq) follow */ +}; + +struct sctp_strseq { + u_int16_t stream; + u_int16_t sequence; +}; + +struct sctp_forward_tsn_msg { + struct sctphdr sh; + struct sctp_forward_tsn_chunk msg; +}; + +/* should be a multiple of 4 - 1 aka 3/7/11 etc. */ + +#define SCTP_NUM_DB_TO_VERIFY 3 + +struct sctp_chunk_desc { + u_int8_t chunk_type; + u_int8_t data_bytes[SCTP_NUM_DB_TO_VERIFY]; + u_int32_t tsn_ifany; +}; + + +struct sctp_pktdrop_chunk { + struct sctp_chunkhdr ch; + u_int32_t bottle_bw; + u_int32_t current_onq; + u_int16_t trunc_len; + u_int16_t reserved; + u_int8_t data[0]; +}; + +#define SCTP_RESET_YOUR 0x01 /* reset your streams and send response */ +#define SCTP_RESET_ALL 0x02 /* reset all of your streams */ +#define SCTP_RECIPRICAL 0x04 /* reset my streams too */ + +struct sctp_stream_reset_request { + struct sctp_paramhdr ph; + u_int8_t reset_flags; /* actual request */ + u_int8_t reset_pad[3]; + u_int32_t reset_req_seq; /* monotonically increasing seq no */ + u_int16_t list_of_streams[0]; /* if not all list of streams */ +}; + +#define SCTP_RESET_PERFORMED 0x01 /* Peers sending str was reset */ +#define SCTP_RESET_DENIED 0x02 /* Asked for but refused */ + +struct sctp_stream_reset_response { + struct sctp_paramhdr ph; + u_int8_t reset_flags; /* actual request */ + u_int8_t reset_pad[3]; + u_int32_t reset_req_seq_resp; /* copied from reset_req reset_req_seq */ + u_int32_t reset_at_tsn; /* resetters next TSN to be assigned send wise */ + u_int32_t cumulative_tsn; /* resetters cum-ack point receive wise */ + u_int16_t list_of_streams[0]; /* if not all list of streams */ +}; + +/* convience structures, note that if you + * are making a request for specific streams + * then the request will need to be an overlay + * structure. + */ + +struct sctp_stream_reset_req { + struct sctp_chunkhdr ch; + struct sctp_stream_reset_request sr_req; +}; + +struct sctp_stream_reset_resp { + struct sctp_chunkhdr ch; + struct sctp_stream_reset_response sr_resp; +}; + + +/* + * we pre-reserve enough room for a ECNE or CWR AND a SACK with no + * missing pieces. If ENCE is missing we could have a couple of blocks. + * This way we optimize so we MOST likely can bundle a SACK/ECN with + * the smallest size data chunk I will split into. We could increase + * throughput slightly by taking out these two but the 24-sack/8-CWR + * i.e. 32 bytes I pre-reserve I feel is worth it for now. + */ +#ifndef SCTP_MAX_OVERHEAD +#ifdef INET6 /* was AF_INET6 */ +#define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \ + sizeof(struct sctphdr) + \ + sizeof(struct sctp_ecne_chunk) + \ + sizeof(struct sctp_sack_chunk) + \ + sizeof(struct ip6_hdr)) + +#define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \ + sizeof(struct sctphdr) + \ + sizeof(struct ip6_hdr)) + + +#define SCTP_MIN_OVERHEAD (sizeof(struct ip6_hdr) + \ + sizeof(struct sctphdr)) + +#else +#define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \ + sizeof(struct sctphdr) + \ + sizeof(struct sctp_ecne_chunk) + \ + sizeof(struct sctp_sack_chunk) + \ + sizeof(struct ip)) + +#define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \ + sizeof(struct sctphdr) + \ + sizeof(struct ip)) + + +#define SCTP_MIN_OVERHEAD (sizeof(struct ip) + \ + sizeof(struct sctphdr)) + +#endif /* AF_INET6 */ +#endif /* !SCTP_MAX_OVERHEAD */ + +#define SCTP_MED_V4_OVERHEAD (sizeof(struct sctp_data_chunk) + \ + sizeof(struct sctphdr) + \ + sizeof(struct ip)) + +#define SCTP_MIN_V4_OVERHEAD (sizeof(struct ip) + \ + sizeof(struct sctphdr)) + +#ifdef __cplusplus +} +#endif + +#endif /* !__sctp_header_h__ */ diff --git a/h/wrn/coreip/netinet/sctp_uio.h b/h/wrn/coreip/netinet/sctp_uio.h new file mode 100644 index 0000000..adffee4 --- /dev/null +++ b/h/wrn/coreip/netinet/sctp_uio.h @@ -0,0 +1,534 @@ +/* $KAME: sctp_uio.h,v 1.11 2005/03/06 16:04:18 itojun Exp $ */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,29jul05,kch ported from Kame. +*/ + +#ifndef __sctp_uio_h__ +#define __sctp_uio_h__ + +/* + * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Cisco Systems, Inc. + * 4. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY CISCO SYSTEMS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CISCO SYSTEMS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef caddr_t sctp_assoc_t; + +/* On/Off setup for subscription to events */ +struct sctp_event_subscribe { + u_int8_t sctp_data_io_event; + u_int8_t sctp_association_event; + u_int8_t sctp_address_event; + u_int8_t sctp_send_failure_event; + u_int8_t sctp_peer_error_event; + u_int8_t sctp_shutdown_event; + u_int8_t sctp_partial_delivery_event; + u_int8_t sctp_adaption_layer_event; + u_int8_t sctp_stream_reset_events; +}; + +/* ancillary data types */ +#define SCTP_INIT 0x0001 +#define SCTP_SNDRCV 0x0002 + +/* + * ancillary data structures + */ +struct sctp_initmsg { + u_int32_t sinit_num_ostreams; + u_int32_t sinit_max_instreams; + u_int16_t sinit_max_attempts; + u_int16_t sinit_max_init_timeo; +}; + +struct sctp_sndrcvinfo { + u_int16_t sinfo_stream; + u_int16_t sinfo_ssn; + u_int16_t sinfo_flags; + u_int32_t sinfo_ppid; + u_int32_t sinfo_context; + u_int32_t sinfo_timetolive; + u_int32_t sinfo_tsn; + u_int32_t sinfo_cumtsn; + sctp_assoc_t sinfo_assoc_id; +}; + +struct sctp_snd_all_completes { + u_int16_t sall_stream; + u_int16_t sall_flags; + u_int32_t sall_ppid; + u_int32_t sall_context; + u_int32_t sall_num_sent; + u_int32_t sall_num_failed; +}; + +/* send/recv flags */ +/* MSG_EOF (0x0100) is reused from sys/socket.h */ +#define MSG_SENDALL 0x0200 +#define MSG_PR_SCTP_TTL 0x0400 /* Partial Reliable on this msg */ +#define MSG_PR_SCTP_BUF 0x0800 /* Buffer based PR-SCTP */ +#ifndef MSG_EOF +#define MSG_EOF 0x1000 /* Start shutdown procedures */ +#endif +#define MSG_UNORDERED 0x2000 /* Message is un-ordered */ +#define MSG_ADDR_OVER 0x4000 /* Override the primary-address */ +#define MSG_ABORT 0x8000 /* Send an ABORT to peer */ + +/* Stat's */ +struct sctp_pcbinfo { + u_int32_t ep_count; + u_int32_t asoc_count; + u_int32_t laddr_count; + u_int32_t raddr_count; + u_int32_t chk_count; + u_int32_t sockq_count; + u_int32_t mbuf_track; +}; + +struct sctp_sockstat { + sctp_assoc_t ss_assoc_id; + u_int32_t ss_total_sndbuf; + u_int32_t ss_total_mbuf_sndbuf; + u_int32_t ss_total_recv_buf; +}; + +/* + * notification event structures + */ + + +/* association change events */ + +struct sctp_assoc_change { + u_int16_t sac_type; + u_int16_t sac_flags; + u_int32_t sac_length; + u_int16_t sac_state; + u_int16_t sac_error; + u_int16_t sac_outbound_streams; + u_int16_t sac_inbound_streams; + sctp_assoc_t sac_assoc_id; +}; +/* sac_state values */ + +#define SCTP_COMM_UP 0x0001 +#define SCTP_COMM_LOST 0x0002 +#define SCTP_RESTART 0x0003 +#define SCTP_SHUTDOWN_COMP 0x0004 +#define SCTP_CANT_STR_ASSOC 0x0005 + + +/* Address events */ +struct sctp_paddr_change { + u_int16_t spc_type; + u_int16_t spc_flags; + u_int32_t spc_length; + struct sockaddr_storage spc_aaddr; + u_int32_t spc_state; + u_int32_t spc_error; + sctp_assoc_t spc_assoc_id; +}; +/* paddr state values */ +#define SCTP_ADDR_AVAILABLE 0x0001 +#define SCTP_ADDR_UNREACHABLE 0x0002 +#define SCTP_ADDR_REMOVED 0x0003 +#define SCTP_ADDR_ADDED 0x0004 +#define SCTP_ADDR_MADE_PRIM 0x0005 +#define SCTP_ADDR_CONFIRMED 0x0006 + +/* + * CAUTION: these are user exposed SCTP addr reachability states + * must be compatible with SCTP_ADDR states in sctp_constants.h + */ +#ifdef SCTP_ACTIVE +#undef SCTP_ACTIVE +#endif +#define SCTP_ACTIVE 0x0001 /* SCTP_ADDR_REACHABLE */ + +#ifdef SCTP_INACTIVE +#undef SCTP_INACTIVE +#endif +#define SCTP_INACTIVE 0x0002 /* SCTP_ADDR_NOT_REACHABLE */ + + +#ifdef SCTP_UNCONFIRMED +#undef SCTP_UNCONFIRMED +#endif +#define SCTP_UNCONFIRMED 0x0200 /* SCTP_ADDR_UNCONFIRMED */ + +#ifdef SCTP_NOHEARTBEAT +#undef SCTP_NOHEARTBEAT +#endif +#define SCTP_NOHEARTBEAT 0x0040 /* SCTP_ADDR_NOHB */ + + + + +/* remote error events */ +struct sctp_remote_error { + u_int16_t sre_type; + u_int16_t sre_flags; + u_int32_t sre_length; + u_int16_t sre_error; + sctp_assoc_t sre_assoc_id; + u_int8_t sre_data[4]; +}; + +/* data send failure event */ +struct sctp_send_failed { + u_int16_t ssf_type; + u_int16_t ssf_flags; + u_int32_t ssf_length; + u_int32_t ssf_error; + struct sctp_sndrcvinfo ssf_info; + sctp_assoc_t ssf_assoc_id; + u_int8_t ssf_data[4]; +}; + +/* flag that indicates state of data */ +#define SCTP_DATA_UNSENT 0x0001 /* inqueue never on wire */ +#define SCTP_DATA_SENT 0x0002 /* on wire at failure */ + +/* shutdown event */ +struct sctp_shutdown_event { + u_int16_t sse_type; + u_int16_t sse_flags; + u_int32_t sse_length; + sctp_assoc_t sse_assoc_id; +}; + +/* Adaption layer indication stuff */ +struct sctp_adaption_event { + u_int16_t sai_type; + u_int16_t sai_flags; + u_int32_t sai_length; + u_int32_t sai_adaption_ind; + sctp_assoc_t sai_assoc_id; +}; + +struct sctp_setadaption { + u_int32_t ssb_adaption_ind; +}; + +/* pdapi indications */ +struct sctp_pdapi_event { + u_int16_t pdapi_type; + u_int16_t pdapi_flags; + u_int32_t pdapi_length; + u_int32_t pdapi_indication; + sctp_assoc_t pdapi_assoc_id; +}; + + +#define SCTP_PARTIAL_DELIVERY_ABORTED 0x0001 + +/* stream reset stuff */ + +struct sctp_stream_reset_event { + u_int16_t strreset_type; + u_int16_t strreset_flags; + u_int32_t strreset_length; + sctp_assoc_t strreset_assoc_id; + u_int16_t strreset_list[0]; +}; + +/* flags in strreset_flags filed */ +#define SCTP_STRRESET_INBOUND_STR 0x0001 +#define SCTP_STRRESET_OUTBOUND_STR 0x0002 +#define SCTP_STRRESET_ALL_STREAMS 0x0004 +#define SCTP_STRRESET_STREAM_LIST 0x0008 + +#define MAX_ASOC_IDS_RET 255 + +struct sctp_assoc_ids { + u_int16_t asls_assoc_start; /* array of index's start at 0 */ + u_int8_t asls_numb_present; + u_int8_t asls_more_to_get; + sctp_assoc_t asls_assoc_id[MAX_ASOC_IDS_RET]; +}; + +/* notification types */ +#define SCTP_ASSOC_CHANGE 0x0001 +#define SCTP_PEER_ADDR_CHANGE 0x0002 +#define SCTP_REMOTE_ERROR 0x0003 +#define SCTP_SEND_FAILED 0x0004 +#define SCTP_SHUTDOWN_EVENT 0x0005 +#define SCTP_ADAPTION_INDICATION 0x0006 +#define SCTP_PARTIAL_DELIVERY_EVENT 0x0007 +#define SCTP_STREAM_RESET_EVENT 0x0008 + + + +struct sctp_tlv { + u_int16_t sn_type; + u_int16_t sn_flags; + u_int32_t sn_length; +}; + + +/* notification event */ +union sctp_notification { + struct sctp_tlv sn_header; + struct sctp_assoc_change sn_assoc_change; + struct sctp_paddr_change sn_paddr_change; + struct sctp_remote_error sn_remote_error; + struct sctp_send_failed sn_send_failed; + struct sctp_shutdown_event sn_shutdown_event; + struct sctp_adaption_event sn_adaption_event; + struct sctp_pdapi_event sn_pdapi_event; + struct sctp_stream_reset_event sn_strreset_event; +}; + +/* + * socket option structs + */ +#define SCTP_ISSUE_HB 0xffffffff /* get a on-demand hb */ +#define SCTP_NO_HB 0x0 /* turn off hb's */ + +struct sctp_paddrparams { + sctp_assoc_t spp_assoc_id; + struct sockaddr_storage spp_address; + u_int32_t spp_hbinterval; + u_int16_t spp_pathmaxrxt; +}; + +struct sctp_paddrinfo { + sctp_assoc_t spinfo_assoc_id; + struct sockaddr_storage spinfo_address; + int32_t spinfo_state; + u_int32_t spinfo_cwnd; + u_int32_t spinfo_srtt; + u_int32_t spinfo_rto; + u_int32_t spinfo_mtu; +}; + +struct sctp_rtoinfo { + sctp_assoc_t srto_assoc_id; + u_int32_t srto_initial; + u_int32_t srto_max; + u_int32_t srto_min; +}; + +struct sctp_assocparams { + sctp_assoc_t sasoc_assoc_id; + u_int16_t sasoc_asocmaxrxt; + u_int16_t sasoc_number_peer_destinations; + u_int32_t sasoc_peer_rwnd; + u_int32_t sasoc_local_rwnd; + u_int32_t sasoc_cookie_life; +}; + +struct sctp_setprim { + sctp_assoc_t ssp_assoc_id; + struct sockaddr_storage ssp_addr; +}; + +struct sctp_setpeerprim { + sctp_assoc_t sspp_assoc_id; + struct sockaddr_storage sspp_addr; +}; + +struct sctp_getaddresses { + sctp_assoc_t sget_assoc_id; + /* addr is filled in for N * sockaddr_storage */ + struct sockaddr addr[1]; +}; + +struct sctp_setstrm_timeout { + sctp_assoc_t ssto_assoc_id; + u_int32_t ssto_timeout; + u_int32_t ssto_streamid_start; + u_int32_t ssto_streamid_end; +}; + +struct sctp_status { + sctp_assoc_t sstat_assoc_id; + int32_t sstat_state; + u_int32_t sstat_rwnd; + u_int16_t sstat_unackdata; + u_int16_t sstat_penddata; + u_int16_t sstat_instrms; + u_int16_t sstat_outstrms; + u_int32_t sstat_fragmentation_point; + struct sctp_paddrinfo sstat_primary; +}; + +struct sctp_cwnd_args { + struct sctp_nets *net; /* network to */ + u_int32_t cwnd_new_value; /* cwnd in k */ + u_int32_t inflight; /* flightsize in k */ + int cwnd_augment; /* increment to it */ +}; + +struct sctp_blk_args { + u_int32_t onmb; /* in 1k bytes */ + u_int32_t onsb; /* in 1k bytes */ + u_int16_t maxmb; /* in 1k bytes */ + u_int16_t maxsb; /* in 1k bytes */ + u_int16_t send_sent_qcnt; /* chnk cnt */ + u_int16_t stream_qcnt; /* chnk cnt */ +}; + +/* + * Max we can reset in one setting, note this is dictated not by the + * define but the size of a mbuf cluster so don't change this define + * and think you can specify more. You must do multiple resets if you + * want to reset more than SCTP_MAX_EXPLICIT_STR_RESET. + */ +#define SCTP_MAX_EXPLICT_STR_RESET 1000 + +#define SCTP_RESET_LOCAL_RECV 0x0001 +#define SCTP_RESET_LOCAL_SEND 0x0002 +#define SCTP_RESET_BOTH 0x0003 + +struct sctp_stream_reset { + sctp_assoc_t strrst_assoc_id; + u_int16_t strrst_flags; + u_int16_t strrst_num_streams; /* 0 == ALL */ + u_int16_t strrst_list[0]; /* list if strrst_num_streams is not 0*/ +}; + + +struct sctp_get_nonce_values { + sctp_assoc_t gn_assoc_id; + u_int32_t gn_peers_tag; + u_int32_t gn_local_tag; +}; + +/* Debugging logs */ +struct sctp_str_log{ + u_int32_t n_tsn; + u_int32_t e_tsn; + u_int16_t n_sseq; + u_int16_t e_sseq; +}; + +struct sctp_fr_log { + u_int32_t largest_tsn; + u_int32_t largest_new_tsn; + u_int32_t tsn; +}; + +struct sctp_fr_map { + u_int32_t base; + u_int32_t cum; + u_int32_t high; +}; + +struct sctp_rwnd_log { + u_int32_t rwnd; + u_int32_t send_size; + u_int32_t overhead; + u_int32_t new_rwnd; +}; + +struct sctp_mbcnt_log { + u_int32_t total_queue_size; + u_int32_t size_change; + u_int32_t total_queue_mb_size; + u_int32_t mbcnt_change; +}; + +struct sctp_cwnd_log{ + union { + struct sctp_blk_args blk; + struct sctp_cwnd_args cwnd; + struct sctp_str_log strlog; + struct sctp_fr_log fr; + struct sctp_fr_map map; + struct sctp_rwnd_log rwnd; + struct sctp_mbcnt_log mbcnt; + }x; + u_int8_t from; + u_int8_t event_type; + +}; + +struct sctp_cwnd_log_req{ + int num_in_log; /* Number in log */ + int num_ret; /* Number returned */ + int start_at; /* start at this one */ + int end_at; /* end at this one */ + struct sctp_cwnd_log log[0]; +}; + + + +/* + * API system calls + */ + +int sctp_peeloff __P((int, sctp_assoc_t)); +int sctp_bindx __P((int, struct sockaddr *, int, int)); +int sctp_connectx __P((int, struct sockaddr *, int)); +int sctp_getpaddrs __P((int, sctp_assoc_t, struct sockaddr **)); +void sctp_freepaddrs __P((struct sockaddr *)); +int sctp_getladdrs __P((int, sctp_assoc_t, struct sockaddr **)); +void sctp_freeladdrs __P((struct sockaddr *)); +int sctp_opt_info __P((int, sctp_assoc_t, int, void *, size_t *)); + +ssize_t sctp_sendmsg __P((int, const void *, size_t, + const struct sockaddr *, + socklen_t, u_int32_t, u_int32_t, u_int16_t, u_int32_t, u_int32_t)); + +ssize_t sctp_send __P((int sd, const void *msg, size_t len, + const struct sctp_sndrcvinfo *sinfo,int flags)); + +ssize_t +sctp_sendx __P((int sd, const void *msg, size_t len, + struct sockaddr *addrs, int addrcnt, + struct sctp_sndrcvinfo *sinfo, int flags)); +ssize_t +sctp_sendmsgx __P((int sd, const void *, size_t, + struct sockaddr *, int, + u_int32_t, u_int32_t, u_int16_t, u_int32_t, u_int32_t)); + +sctp_assoc_t +sctp_getassocid __P((int sd, struct sockaddr *sa)); + +ssize_t sctp_recvmsg __P((int, void *, size_t, struct sockaddr *, + socklen_t *, struct sctp_sndrcvinfo *, int *)); + +#ifdef __cplusplus +} +#endif + +#endif /* !__sctp_uio_h__ */ diff --git a/h/wrn/coreip/netinet/sl_compress.h b/h/wrn/coreip/netinet/sl_compress.h new file mode 100644 index 0000000..6756295 --- /dev/null +++ b/h/wrn/coreip/netinet/sl_compress.h @@ -0,0 +1,291 @@ +/* sl_compress.h - Definitions for tcp compression routines */ + +/* $NetBSD: slcompress.h,v 1.8 1994/06/29 06:36:51 cgd Exp $ */ + +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)slcompress.h 8.1 (Berkeley) 6/10/93 + */ + +/* + * Definitions for tcp compression routines. + * + * Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989: + * - Initial distribution. + */ + +/* +modification history +-------------------- +01f,26nov03,rp fixed compiler warnings +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,17nov96,bin removed MLEN replaced with CL_SIZE_128 +01c,01aug96,vin integrated with BSD4.4, moved to netinet made universal + for CSLIP as well as PPP. +01b,16jun95,dzb added necessary header file inclusions. +01a,16jan95,dzb WRS-ize. added prototype of ppp_sl_uncompress_tcp_part(). + prepended "ppp_" due to conflict with CSLIP's slcompress. +*/ + +#ifndef __INCsl_compressh +#define __INCsl_compressh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include +#include +#include + +#define SL_STATS /* define to include statistics counters */ + +#define MAX_STATES 16 /* must be > 2 and < 256 */ +#define MAX_HDR CL_SIZE_128 + +/* + * Compressed packet format: + * + * The first octet contains the packet type (top 3 bits), TCP + * 'push' bit, and flags that indicate which of the 4 TCP sequence + * numbers have changed (bottom 5 bits). The next octet is a + * conversation number that associates a saved IP/TCP header with + * the compressed packet. The next two octets are the TCP checksum + * from the original datagram. The next 0 to 15 octets are + * sequence number changes, one change per bit set in the header + * (there may be no changes and there are two special cases where + * the receiver implicitly knows what changed -- see below). + * + * There are 5 numbers which can change (they are always inserted + * in the following order): TCP urgent pointer, window, + * acknowlegement, sequence number and IP ID. (The urgent pointer + * is different from the others in that its value is sent, not the + * change in value.) Since typical use of SLIP links is biased + * toward small packets (see comments on MTU/MSS below), changes + * use a variable length coding with one octet for numbers in the + * range 1 - 255 and 3 octets (0, MSB, LSB) for numbers in the + * range 256 - 65535 or 0. (If the change in sequence number or + * ack is more than 65535, an uncompressed packet is sent.) + */ + +/* + * Packet types (must not conflict with IP protocol version) + * + * The top nibble of the first octet is the packet type. There are + * three possible types: IP (not proto TCP or tcp with one of the + * control flags set); uncompressed TCP (a normal IP/TCP packet but + * with the 8-bit protocol field replaced by an 8-bit connection id -- + * this type of packet syncs the sender & receiver); and compressed + * TCP (described above). + * + * LSB of 4-bit field is TCP "PUSH" bit (a worthless anachronism) and + * is logically part of the 4-bit "changes" field that follows. Top + * three bits are actual packet type. For backward compatibility + * and in the interest of conserving bits, numbers are chosen so the + * IP protocol version number (4) which normally appears in this nibble + * means "IP packet". + */ + +/* packet types */ +#define TYPE_IP 0x40 +#define TYPE_UNCOMPRESSED_TCP 0x70 +#define TYPE_COMPRESSED_TCP 0x80 +#define TYPE_ERROR 0x00 + +/* Bits in first octet of compressed packet */ +#define NEW_C 0x40 /* flag bits for what changed in a packet */ +#define NEW_I 0x20 +#define NEW_S 0x08 +#define NEW_A 0x04 +#define NEW_W 0x02 +#define NEW_U 0x01 + +/* reserved, special-case values of above */ +#define SPECIAL_I (NEW_S|NEW_W|NEW_U) /* echoed interactive traffic */ +#define SPECIAL_D (NEW_S|NEW_A|NEW_W|NEW_U) /* unidirectional data */ +#define SPECIALS_MASK (NEW_S|NEW_A|NEW_W|NEW_U) + +#define TCP_PUSH_BIT 0x10 + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * "state" data for each active tcp conversation on the wire. This is + * basically a copy of the entire IP/TCP header from the last packet + * we saw from the conversation together with a small identifier + * the transmit & receive ends of the line use to locate saved header. + */ +struct cstate { + struct cstate *cs_next; /* next most recently used cstate (xmit only) */ + u_short cs_hlen; /* size of hdr (receive only) */ + u_char cs_id; /* connection # associated with this state */ + u_char cs_filler; + union { + char csu_hdr[MAX_HDR]; + struct ip csu_ip; /* ip/tcp hdr from most recent packet */ + } slcs_u; +}; +#define cs_ip slcs_u.csu_ip +#define cs_hdr slcs_u.csu_hdr + +/* + * all the state data for one serial line (we need one of these + * per line). + */ +struct slcompress { + struct cstate *last_cs; /* most recently used tstate */ + u_char last_recv; /* last rcvd conn. id */ + u_char last_xmit; /* last sent conn. id */ + u_short flags; +#ifdef SL_STATS + u_int sls_packets; /* outbound packets */ + u_int sls_compressed; /* outbound compressed packets */ + u_int sls_searches; /* searches for connection state */ + u_int sls_misses; /* times couldn't find conn. state */ + u_int sls_uncompressedin; /* inbound uncompressed packets */ + u_int sls_compressedin; /* inbound compressed packets */ + u_int sls_errorin; /* inbound unknown type packets */ + u_int sls_tossed; /* inbound packets tossed because of error */ +#endif + struct cstate tstate[MAX_STATES]; /* xmit connection states */ + struct cstate rstate[MAX_STATES]; /* receive connection states */ +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* flag values */ +#define SLF_TOSS 1 /* tossing rcvd frames because of input err */ + +#ifdef SL_STATS +#define INCR(counter) ++comp->counter; +#else +#define INCR(counter) +#endif + +#ifndef BCMP +#define BCMP(p1, p2, n) bcmp((char *)(p1), (char *)(p2), (int)(n)) +#endif + +#ifdef BCOPY +#undef BCOPY +#endif /* BCOPY */ +#define BCOPY(s, d, l) bcopy((char *) s, (char *) d, (int) l) +#ifndef ovbcopy +#define ovbcopy bcopy +#endif + +/* ENCODE encodes a number that is known to be non-zero. ENCODEZ + * checks for zero (since zero has to be encoded in the long, 3 byte + * form). + */ +#define ENCODE(n) { \ + if ((u_short)(n) >= 256) { \ + *cp++ = 0; \ + cp[1] = (n); \ + cp[0] = (n) >> 8; \ + cp += 2; \ + } else { \ + *cp++ = (n); \ + } \ +} +#define ENCODEZ(n) { \ + if ((u_short)(n) >= 256 || (u_short)(n) == 0) { \ + *cp++ = 0; \ + cp[1] = (n); \ + cp[0] = (n) >> 8; \ + cp += 2; \ + } else { \ + *cp++ = (n); \ + } \ +} + +#define DECODEL(f) { \ + if (*cp == 0) {\ + (f) = htonl(ntohl(f) + ((cp[1] << 8) | cp[2])); \ + cp += 3; \ + } else { \ + (f) = htonl(ntohl(f) + (u_long)*cp); \ + cp++; \ + } \ +} + +#define DECODES(f) { \ + if (*cp == 0) {\ + (f) = htons(ntohs(f) + ((cp[1] << 8) | cp[2])); \ + cp += 3; \ + } else { \ + (f) = htons(ntohs(f) + (u_long)*cp); \ + cp++; \ + } \ +} + +#define DECODEU(f) { \ + if (*cp == 0) {\ + (f) = htons((cp[1] << 8) | cp[2]); \ + cp += 3; \ + } else { \ + (f) = htons((u_long)*cp); \ + cp++; \ + } \ +} + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void sl_compress_init (struct slcompress *comp); +extern u_int sl_compress_tcp (struct mbuf *m, struct ip *ip, + struct slcompress *comp, int compress_cid); +extern int sl_uncompress_tcp (u_char** bufp, int len, u_int type, + struct slcompress *comp); +#else /* __STDC__ */ + +extern void ppp_sl_compress_init (); +extern void ppp_sl_compress_setup (); +extern u_char ppp_sl_compress_tcp (); +extern int ppp_sl_uncompress_tcp (); +extern int ppp_sl_uncompress_tcp_part (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsl_compressh */ diff --git a/h/wrn/coreip/netinet/sockunion.h b/h/wrn/coreip/netinet/sockunion.h new file mode 100644 index 0000000..2dbebf2 --- /dev/null +++ b/h/wrn/coreip/netinet/sockunion.h @@ -0,0 +1,46 @@ +/* sockunion.h -File Transfer Protocol library header */ + +/* +modification history +-------------------- +01e,07jan05,syy Port to RTP +01d,05nov03,cdw Removal of unnecessary _KERNEL guards. +01c,04nov03,rlm Ran batch header path update for header re-org. +01b,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01a,15sep02,ant written + +*/ + +#ifndef __INCsockunionh +#define __INCsockunionh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include + +/* typedefs */ + +union sockunion { + struct sockinet { + u_char si_len; + u_char si_family; + u_short si_port; + } su_si; + struct sockaddr_in su_sin; +#ifdef INET6 + struct sockaddr_in6 su_sin6; +#endif +}; +#define su_len su_si.si_len +#define su_family su_si.si_family +#define su_port su_si.si_port + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsockunionh */ diff --git a/h/wrn/coreip/netinet/tcp.h b/h/wrn/coreip/netinet/tcp.h new file mode 100644 index 0000000..208dff3 --- /dev/null +++ b/h/wrn/coreip/netinet/tcp.h @@ -0,0 +1,165 @@ +/* tcp.h - TCP protocol definitions */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/tcp.h,v 1.13.2.3 2001/03/01 22:08:42 jlemon Exp $ + */ + +/* +modification history +-------------------- +01i,14jan05,vvv osdep.h cleanup +01h,20nov03,niq Remove copyright_wrs.h file inclusion +01g,05nov03,cdw Removal of unnecessary _KERNEL guards. +01f,04nov03,rlm Ran batch header path update for header re-org. +01e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01d,10jun03,vvv include netVersion.h +01c,10sep02,hsh add c++ protection +01b,08feb02,pas EAR code cleanup +01a,13aug01,pas Created from FreeBSD4.3-RELEASE(July-17-01). +*/ + +#ifndef _NETINET_TCP_H_ +#define _NETINET_TCP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +typedef u_int32_t tcp_seq; +typedef u_int32_t tcp_cc; /* connection count per rfc1644 */ + +#define tcp6_seq tcp_seq /* for KAME src sync over BSD*'s */ +#define tcp6hdr tcphdr /* for KAME src sync over BSD*'s */ + +/* + * TCP header. + * Per RFC 793, September, 1981. + */ +struct tcphdr { + u_short th_sport; /* source port */ + u_short th_dport; /* destination port */ + tcp_seq th_seq; /* sequence number */ + tcp_seq th_ack; /* acknowledgement number */ +#if _BYTE_ORDER == _LITTLE_ENDIAN + u_int th_x2:4, /* (unused) */ + th_off:4; /* data offset */ +#endif +#if _BYTE_ORDER == _BIG_ENDIAN + u_int th_off:4, /* data offset */ + th_x2:4; /* (unused) */ +#endif + u_char th_flags; +#define TH_FIN 0x01 +#define TH_SYN 0x02 +#define TH_RST 0x04 +#define TH_PUSH 0x08 +#define TH_ACK 0x10 +#define TH_URG 0x20 +#define TH_ECE 0x40 +#define TH_CWR 0x80 +#define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG|TH_ECE|TH_CWR) + + u_short th_win; /* window */ + u_short th_sum; /* checksum */ + u_short th_urp; /* urgent pointer */ +}; + +#define TCPOPT_EOL 0 +#define TCPOPT_NOP 1 +#define TCPOPT_MAXSEG 2 +#define TCPOLEN_MAXSEG 4 +#define TCPOPT_WINDOW 3 +#define TCPOLEN_WINDOW 3 +#define TCPOPT_SACK_PERMITTED 4 /* Experimental */ +#define TCPOLEN_SACK_PERMITTED 2 +#define TCPOPT_SACK 5 /* Experimental */ +#define TCPOPT_TIMESTAMP 8 +#define TCPOLEN_TIMESTAMP 10 +#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */ +#define TCPOPT_TSTAMP_HDR \ + (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP) + +#define TCPOPT_CC 11 /* CC options: RFC-1644 */ +#define TCPOPT_CCNEW 12 +#define TCPOPT_CCECHO 13 +#define TCPOLEN_CC 6 +#define TCPOLEN_CC_APPA (TCPOLEN_CC+2) +#define TCPOPT_CC_HDR(ccopt) \ + (TCPOPT_NOP<<24|TCPOPT_NOP<<16|(ccopt)<<8|TCPOLEN_CC) + +/* + * Default maximum segment size for TCP. + * With an IP MSS of 576, this is 536, + * but 512 is probably more convenient. + * This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)). + */ +#define TCP_MSS 512 + +/* + * Default maximum segment size for TCP6. + * With an IP6 MSS of 1280, this is 1220, + * but 1024 is probably more convenient. (xxx kazu in doubt) + * This should be defined as MIN(1024, IP6_MSS - sizeof (struct tcpip6hdr)) + */ +#define TCP6_MSS 1024 + +#define TCP_MAXWIN 65535 /* largest value for (unscaled) window */ +#define TTCP_CLIENT_SND_WND 4096 /* dflt send window for T/TCP client */ + +#define TCP_MAX_WINSHIFT 14 /* maximum window shift */ + +#define TCP_MAXBURST 4 /* maximum segments in a burst */ + +#define TCP_MAXHLEN (0xf<<2) /* max length of header in bytes */ +#define TCP_MAXOLEN (TCP_MAXHLEN - sizeof(struct tcphdr)) + /* max space left for options */ + +/* + * User-settable options (used with setsockopt). + */ +#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */ +#define TCP_MAXSEG 0x02 /* set maximum segment size */ +#define TCP_NOPUSH 0x04 /* don't push last block of write */ +#define TCP_NOOPT 0x08 /* don't use TCP options */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/netinet/tcp_debug.h b/h/wrn/coreip/netinet/tcp_debug.h new file mode 100644 index 0000000..875d09c --- /dev/null +++ b/h/wrn/coreip/netinet/tcp_debug.h @@ -0,0 +1,135 @@ +/* tcp_debug.c - TCP debugging definitions */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp_debug.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/tcp_debug.h,v 1.11 2000/01/29 11:49:05 shin Exp $ + */ + +/* +modification history +-------------------- +01m,08feb05,vvv _KERNEL cleanup +01l,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01k,08jun04,niq Include header file for correct compilation in project + facility +01j,20nov03,niq Remove copyright_wrs.h file inclusion +01i,05nov03,cdw Removal of unnecessary _KERNEL guards. +01h,04nov03,rlm Ran batch header path update for header re-org. +01g,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01f,08aug03,niq Merging from Accordion label ACCORDION_BASE6_MERGE_BASELINE +01e,10jun03,vvv include netVersion.h +01d,16sep02,pas merged changes from Veloce stack, added tcpDebugPrint() +01c,10sep02,hsh add c++ protection +01b,08feb02,pas EAR code cleanup +01a,13aug01,pas Created from FreeBSD4.3-RELEASE(July-17-01). +*/ + +#ifndef _NETINET_TCP_DEBUG_H_ +#define _NETINET_TCP_DEBUG_H_ + +#include +#include +#include +#ifdef INET6 +#include +#include +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +struct tcp_debug { + n_time td_time; + short td_act; + short td_ostate; + caddr_t td_tcb; + caddr_t td_iphdr; + caddr_t td_tcphdr; + int td_family; + /* + * Co-existense of td_ti and td_ti6 below is ugly, but it is necessary + * to achieve backword compatibility to some extent. + */ + struct tcpiphdr td_ti; + struct { + u_char ip6buf[40]; /* sizeof(struct ip6_hdr) */ + struct tcphdr th; + } td_ti6; +#define td_ip6buf td_ti6.ip6buf + short td_req; + struct tcpcb td_cb; +}; + +#define TA_INPUT 0 +#define TA_OUTPUT 1 +#define TA_USER 2 +#define TA_RESPOND 3 +#define TA_DROP 4 + +#ifdef TANAMES +static char *tanames[] = + { "input", "output", "user", "respond", "drop" }; +#endif + +#define TCP_NDEBUG 100 /* length of debug info array */ +#define TCP_DEBUG_NUM_DEFAULT 20 /* default display number */ + +IMPORT VOIDFUNCPTR tcpTraceRtn; +IMPORT VOIDFUNCPTR tcpReportRtn; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void tcpTraceInit (void); +extern STATUS tcp_debugInit (void); + +#else /* __STDC__ */ + +extern void tcpTraceInit (); +extern STATUS tcp_debugInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_NETINET_TCP_DEBUG_H_ */ diff --git a/h/wrn/coreip/netinet/tcp_fsm.h b/h/wrn/coreip/netinet/tcp_fsm.h new file mode 100644 index 0000000..d8d86fb --- /dev/null +++ b/h/wrn/coreip/netinet/tcp_fsm.h @@ -0,0 +1,118 @@ +/* tcp_fsm.h - TCP finite state machine */ + +/* Copyright 2001 - 2003 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp_fsm.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/tcp_fsm.h,v 1.14 1999/11/07 04:18:30 jlemon Exp $ + */ + +/* +modification history +-------------------- +01l,20nov03,niq Remove copyright_wrs.h file inclusion +01k,05nov03,cdw Removal of unnecessary _KERNEL guards. +01j,04nov03,rlm Ran batch header path update for header re-org. +01i,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01h,08aug03,niq Merging from Accordion label ACCORDION_BASE6_MERGE_BASELINE +01g,10jun03,vvv include netVersion.h +01f,15may03,spm Tornado 2.2 FCS merge (SPR #70380; ver 01c,07dec01,rae: + TOR2_2-FCS-COPY label, tor2 branch, /wind/river VOB) +01e,07mar03,pas moved tcp_outflags to tcp_output.c + moved tcpstates to tcp_usrreq.c, removed pTcpstates + removed tcp_acounts +01d,16sep02,pas merged changes from Veloce stack, added pTcpstates +01c,10sep02,hsh add c++ protection +01b,08feb02,pas EAR code cleanup +01a,13aug01,pas Created from FreeBSD4.3-RELEASE(July-17-01). +*/ + +#ifndef _NETINET_TCP_FSM_H_ +#define _NETINET_TCP_FSM_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * TCP FSM state definitions. + * Per RFC793, September, 1981. + */ + +#define TCP_NSTATES 11 + +#define TCPS_CLOSED 0 /* closed */ +#define TCPS_LISTEN 1 /* listening for connection */ +#define TCPS_SYN_SENT 2 /* active, have sent syn */ +#define TCPS_SYN_RECEIVED 3 /* have send and received syn */ +/* states < TCPS_ESTABLISHED are those where connections not established */ +#define TCPS_ESTABLISHED 4 /* established */ +#define TCPS_CLOSE_WAIT 5 /* rcvd fin, waiting for close */ +/* states > TCPS_CLOSE_WAIT are those where user has closed */ +#define TCPS_FIN_WAIT_1 6 /* have closed, sent fin */ +#define TCPS_CLOSING 7 /* closed xchd FIN; await FIN ACK */ +#define TCPS_LAST_ACK 8 /* had fin and close; await FIN ACK */ +/* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */ +#define TCPS_FIN_WAIT_2 9 /* have closed, fin is acked */ +#define TCPS_TIME_WAIT 10 /* in 2*msl quiet wait after close */ + +/* for KAME src sync over BSD*'s */ +#define TCP6_NSTATES TCP_NSTATES +#define TCP6S_CLOSED TCPS_CLOSED +#define TCP6S_LISTEN TCPS_LISTEN +#define TCP6S_SYN_SENT TCPS_SYN_SENT +#define TCP6S_SYN_RECEIVED TCPS_SYN_RECEIVED +#define TCP6S_ESTABLISHED TCPS_ESTABLISHED +#define TCP6S_CLOSE_WAIT TCPS_CLOSE_WAIT +#define TCP6S_FIN_WAIT_1 TCPS_FIN_WAIT_1 +#define TCP6S_CLOSING TCPS_CLOSING +#define TCP6S_LAST_ACK TCPS_LAST_ACK +#define TCP6S_FIN_WAIT_2 TCPS_FIN_WAIT_2 +#define TCP6S_TIME_WAIT TCPS_TIME_WAIT + +#define TCPS_HAVERCVDSYN(s) ((s) >= TCPS_SYN_RECEIVED) +#define TCPS_HAVEESTABLISHED(s) ((s) >= TCPS_ESTABLISHED) +#define TCPS_HAVERCVDFIN(s) ((s) > TCPS_ESTABLISHED && \ + (s) != TCPS_FIN_WAIT_1 && \ + (s) != TCPS_FIN_WAIT_2) + +extern char *tcpstates[]; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/netinet/tcp_seq.h b/h/wrn/coreip/netinet/tcp_seq.h new file mode 100644 index 0000000..5cb4975 --- /dev/null +++ b/h/wrn/coreip/netinet/tcp_seq.h @@ -0,0 +1,120 @@ +/* tcp_seq.h - TCP sequence number manipulation */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993, 1995 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp_seq.h 8.3 (Berkeley) 6/21/95 + * $FreeBSD: src/sys/netinet/tcp_seq.h,v 1.11.2.6 2001/12/14 20:16:59 jlemon Exp $ + */ + +/* +modification history +-------------------- +01m,07feb05,vvv _KERNEL cleanup +01l,20nov03,niq Remove copyright_wrs.h file inclusion +01k,05nov03,cdw Removal of unnecessary _KERNEL guards. +01j,04nov03,rlm Ran batch header path update for header re-org. +01i,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01h,08aug03,niq Merging from Accordion label ACCORDION_BASE6_MERGE_BASELINE +01g,10jun03,vvv include netVersion.h +01f,01feb03,pas merge from FreeBSD 4.7 - removed global tcp_iss +01e,10sep02,hsh add c++ protection +01d,08feb02,pas EAR code cleanup +01c,08oct01,pas include random.h +01b,18sep01,pas changed tcp_random18() to use RANDOM() instead of arc4random() +01a,13aug01,pas Created from FreeBSD4.3-RELEASE(July-17-01). +*/ + +#ifndef _NETINET_TCP_SEQ_H_ +#define _NETINET_TCP_SEQ_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _WRS_KERNEL +#include + + /* + * TCP sequence numbers are 32 bit integers operated + * on with modular arithmetic. These macros can be + * used to compare such integers. + */ +#define SEQ_LT(a,b) ((int)((a)-(b)) < 0) +#define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0) +#define SEQ_GT(a,b) ((int)((a)-(b)) > 0) +#define SEQ_GEQ(a,b) ((int)((a)-(b)) >= 0) + +/* for modulo comparisons of timestamps */ +#define TSTMP_LT(a,b) ((int)((a)-(b)) < 0) +#define TSTMP_GEQ(a,b) ((int)((a)-(b)) >= 0) + +/* + * TCP connection counts are 32 bit integers operated + * on with modular arithmetic. These macros can be + * used to compare such integers. + */ +#define CC_LT(a,b) ((int)((a)-(b)) < 0) +#define CC_LEQ(a,b) ((int)((a)-(b)) <= 0) +#define CC_GT(a,b) ((int)((a)-(b)) > 0) +#define CC_GEQ(a,b) ((int)((a)-(b)) >= 0) + +/* Macro to increment a CC: skip 0 which has a special meaning */ +#define CC_INC(c) (++(c) == 0 ? ++(c) : (c)) + +/* + * Macros to initialize tcp sequence numbers for + * send and receive from initial send and receive + * sequence numbers. + */ +#define tcp_rcvseqinit(tp) \ + (tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1 + +#define tcp_sendseqinit(tp) \ + (tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \ + (tp)->snd_recover = (tp)->iss + +#define TCP_PAWS_IDLE (24 * 24 * 60 * 60 * hz) + /* timestamp wrap-around time */ + +#ifndef VIRTUAL_STACK +extern tcp_cc tcp_ccgen; /* global connection count */ +#endif +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* _NETINET_TCP_SEQ_H_ */ diff --git a/h/wrn/coreip/netinet/tcp_timer.h b/h/wrn/coreip/netinet/tcp_timer.h new file mode 100644 index 0000000..45b0685 --- /dev/null +++ b/h/wrn/coreip/netinet/tcp_timer.h @@ -0,0 +1,183 @@ +/* tcp_timer.h - TCP timer definitions */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp_timer.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/tcp_timer.h,v 1.18.2.1 2002/08/16 22:16:39 dillon Exp $ + */ + +/* +modification history +-------------------- +01k,07feb05,vvv _KERNEL cleanup +01j,20nov03,niq Remove copyright_wrs.h file inclusion +01i,05nov03,cdw Removal of unnecessary _KERNEL guards. +01h,04nov03,rlm Ran batch header path update for header re-org. +01g,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01f,08aug03,niq Merging from Accordion label ACCORDION_BASE6_MERGE_BASELINE +01e,10jun03,vvv include netVersion.h +01d,01feb03,pas merge from FreeBSD 4.7 - added rexmit sysctls +01c,10sep02,hsh add c++ protection +01b,08feb02,pas EAR code cleanup +01a,13aug01,pas Created from FreeBSD4.3-RELEASE(July-17-01). +*/ + +#ifndef _NETINET_TCP_TIMER_H_ +#define _NETINET_TCP_TIMER_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _WRS_KERNEL +#include + +/* + * The TCPT_REXMT timer is used to force retransmissions. + * The TCP has the TCPT_REXMT timer set whenever segments + * have been sent for which ACKs are expected but not yet + * received. If an ACK is received which advances tp->snd_una, + * then the retransmit timer is cleared (if there are no more + * outstanding segments) or reset to the base value (if there + * are more ACKs expected). Whenever the retransmit timer goes off, + * we retransmit one unacknowledged segment, and do a backoff + * on the retransmit timer. + * + * The TCPT_PERSIST timer is used to keep window size information + * flowing even if the window goes shut. If all previous transmissions + * have been acknowledged (so that there are no retransmissions in progress), + * and the window is too small to bother sending anything, then we start + * the TCPT_PERSIST timer. When it expires, if the window is nonzero, + * we go to transmit state. Otherwise, at intervals send a single byte + * into the peer's window to force him to update our window information. + * We do this at most as often as TCPT_PERSMIN time intervals, + * but no more frequently than the current estimate of round-trip + * packet time. The TCPT_PERSIST timer is cleared whenever we receive + * a window update from the peer. + * + * The TCPT_KEEP timer is used to keep connections alive. If an + * connection is idle (no segments received) for TCPTV_KEEP_INIT amount of time, + * but not yet established, then we drop the connection. Once the connection + * is established, if the connection is idle for TCPTV_KEEP_IDLE time + * (and keepalives have been enabled on the socket), we begin to probe + * the connection. We force the peer to send us a segment by sending: + * + * This segment is (deliberately) outside the window, and should elicit + * an ack segment in response from the peer. If, despite the TCPT_KEEP + * initiated segments we cannot elicit a response from a peer in TCPT_MAXIDLE + * amount of time probing, then we drop the connection. + */ + +/* + * Time constants. + */ +#define TCPTV_MSL ( 30*hz) /* max seg lifetime (hah!) */ +#define TCPTV_SRTTBASE 0 /* base roundtrip time; + if 0, no idea yet */ +#define TCPTV_RTOBASE ( 3*hz) /* assumed RTO if no info */ +#define TCPTV_SRTTDFLT ( 3*hz) /* assumed RTT if no info */ + +#define TCPTV_PERSMIN ( 5*hz) /* retransmit persistence */ +#define TCPTV_PERSMAX ( 60*hz) /* maximum persist interval */ + +#define TCPTV_KEEP_INIT ( 75*hz) /* initial connect keepalive */ +#define TCPTV_KEEP_IDLE (120*60*hz) /* dflt time before probing */ +#define TCPTV_KEEPINTVL ( 75*hz) /* default probe interval */ +#define TCPTV_KEEPCNT 8 /* max probes before drop */ + +/* + * TCPTV_MIN represents the minimum allowed retransmit interval. It + * is currently one second but will ultimately be reduced to 3 ticks + * for algorithmic stability, leaving the 200ms variance to deal with + * delayed-acks, protocol overheads. A 1 second minimum badly breaks + * throughput on any network faster then a modem that has minor but + * continuous packet loss unrelated to congestion, such as on a wireless + * network. + */ +#define TCPTV_MIN ( hz ) /* minimum allowable value */ +#define TCPTV_CPU_VAR ( hz/5 ) /* cpu variance (200ms) */ +#define TCPTV_REXMTMAX ( 64*hz) /* max allowable REXMT value */ + +#define TCPTV_TWTRUNC 8 /* RTO factor to truncate TW */ + +#define TCP_LINGERTIME 120 /* linger at most 2 minutes */ + +#define TCP_MAXRXTSHIFT 12 /* maximum retransmits */ + +#define TCPTV_DELACK (hz / PR_FASTHZ / 2) /* 100ms timeout */ + +#ifdef TCPTIMERS +static char *tcptimers[] = + { "REXMT", "PERSIST", "KEEP", "2MSL" }; +#endif + +/* + * Force a time value to be in a certain range. + */ +#define TCPT_RANGESET(tv, value, tvmin, tvmax) do { \ + (tv) = (value) + tcp_rexmit_slop; \ + if ((u_long)(tv) < (u_long)(tvmin)) \ + (tv) = (tvmin); \ + else if ((u_long)(tv) > (u_long)(tvmax)) \ + (tv) = (tvmax); \ +} while(0) + +#ifndef VIRTUAL_STACK +extern int tcp_keepinit; /* time to establish connection */ +extern int tcp_keepidle; /* time before keepalive probes begin */ +extern int tcp_keepintvl; /* time between keepalive probes */ +extern int tcp_maxidle; /* time to drop after starting probes */ +extern int tcp_delacktime; /* time before sending a delayed ACK */ +extern int tcp_maxpersistidle; +extern int tcp_rexmit_min; +extern int tcp_rexmit_slop; +extern int tcp_msl; +extern int tcp_ttl; /* time to live for TCP segs */ +#endif +extern int tcp_backoff[]; + +void tcp_timer_2msl __P((void *xtp)); +void tcp_timer_keep __P((void *xtp)); +void tcp_timer_persist __P((void *xtp)); +void tcp_timer_rexmt __P((void *xtp)); +void tcp_timer_delack __P((void *xtp)); + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_NETINET_TCP_TIMER_H_ */ diff --git a/h/wrn/coreip/netinet/tcp_var.h b/h/wrn/coreip/netinet/tcp_var.h new file mode 100644 index 0000000..60ddeba --- /dev/null +++ b/h/wrn/coreip/netinet/tcp_var.h @@ -0,0 +1,680 @@ +/* tcp_var.h - TCP variables and data structures */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993, 1994, 1995 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp_var.h 8.4 (Berkeley) 5/24/95 + * $FreeBSD: src/sys/netinet/tcp_var.h,v 1.56.2.12 2002/08/24 18:40:26 dillon Exp $ + */ + +/* +modification history +-------------------- +01y,11aug05,dlk Disable TTCP support. +01x,27jul05,dlk Added t_phsum to struct tcpcb. +01w,16jul05,dlk Add syncache_cleanup() for virtual stack case. +01v,21jun05,dlk Modify syncache_unreach() to return a value indicating whether + a matching syncache entry was located. +01u,16may05,dlk revert last change (SPR #109227). IP TOS now available in + in_conninfo. +01t,09mar05,kc Changed tcp_rtlookup() and tcp_gettaocache() signature + from (struct in_conninfo *) to (struct inpcb *) (SPR#95067). +01s,23feb05,wap Add tcp_syncache structure (shared betweem tcp_syncache.c and + tcp_sysctl.c) +01r,07feb05,vvv _KERNEL cleanup +01q,31jan05,niq virtual stack changes for sysctl +01p,13sep04,vvv renamed path_mtu_discovery to fix Sysctl/virtual stack + incompatibility (SPR #91565) +01o,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01n,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01m,06jan04,vvv changed prototype for tcp_maketemplate (SPR #88742) +01l,20nov03,niq Remove copyright_wrs.h file inclusion +01k,04nov03,rlm Ran batch header path update for header re-org. +01j,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01i,24oct03,cdw update include statements post header re-org. +01h,08aug03,niq Merging from Accordion label ACCORDION_BASE6_MERGE_BASELINE +01g,01feb03,pas merge from FreeBSD 4.7 - added rfc1323, rfc1644 flags, + bandwidth limits, syncache +01f,11sep02,hsh add c++ protection +01e,11sep02,sar Add updateHeaderSize routine +01d,28mar02,ppp modifying it to be backward compatible with A.E. 1.1 +01c,08feb02,pas EAR code cleanup +01b,28jan02,ann uncommenting some code +01a,03dec01,niq Sysctl changes for Clarinet +01c.29oct01,ham included callout.h and in_pcb.h. +01b,29oct01,nee adding inp_tp structure from usrreq.c +01a,13aug01,pas Created from FreeBSD4.3-RELEASE(July-17-01). +*/ + +#ifndef _NETINET_TCP_VAR_H_ +#define _NETINET_TCP_VAR_H_ + +/* includes */ + +#ifdef __cplusplus +extern "C" { +#endif + +#undef TTCP + +#ifdef _WRS_KERNEL +#include +#include + +/* + * Kernel variables for tcp. + */ + +#ifndef VIRTUAL_STACK +extern int tcp_do_rfc1323; +#ifdef TTCP +extern int tcp_do_rfc1644; +#endif +#endif /* VIRTUAL_STACK */ + +/* TCP segment queue entry */ +struct tseg_qent { + LIST_ENTRY(tseg_qent) tqe_q; + int tqe_len; /* TCP segment data length */ + struct tcphdr *tqe_th; /* a pointer to tcp header */ + struct mbuf *tqe_m; /* mbuf contains packet */ +}; +LIST_HEAD(tsegqe_head, tseg_qent); + +/* + * TCP_REASS_SEG_MULTIPLIER is used to estimate the per-endpoint reassembly + * queue segment limit. The receive socket buffer size is rounded up to a + * multiple of the mss, then divided by the mss. That number of segments + * times TCP_REASS_SEG_MULTIPLIER is the per-endpoint segment limit, unless + * further restricted by the global limit. + */ + +#define TCP_REASS_SEG_MULTIPLIER 4 /* (rcv hiwat/mss) * this is limit */ + +#define TCP_REASS_COALESCE_MAX 128 /* max bytes to coalesce in reass. Q */ + +/* + * This one is problematic. It should be related to the + * numbers of clusters available in all the various network interface + * receive pools... + */ +#define TCP_REASS_GLOBAL_SEGMENTS_MAX 512 /* default max segments globally */ + +typedef struct _TCP_REASS_INFO + { + int qmax; /* maximum number of allowed segments in (all) queue(s) */ + int qsize; /* current number of segments in (all) queue(s) */ + NET_POOL_ID netPoolId; /* net pool for tseg_qent allocation */ + CL_POOL_ID clPoolId; /* cluster pool for tseg_qent allocation */ + int qmax_endpt; /* maximum number of allowed segments per endpoint or -1 */ + u_long drain_count; /* # of tcp_drain() calls. Move to tcpstat ? */ + } TCP_REASS_INFO; + +#define TCP_RQ_ALLOC(x) \ + do { \ + (x) = (struct tseg_qent *)clusterGet (tcp_reass_info.netPoolId, \ + tcp_reass_info.clPoolId); \ + } while (0) + +#define TCP_RQ_FREE(x) \ + do { \ + clFree (tcp_reass_info.netPoolId, (char *)(x)); \ + } while (0) + +struct tcptemp { + u_char tt_ipgen[40]; /* the size must be of max ip header, now IPv6 */ + struct tcphdr tt_t; +}; + +#define tcp6cb tcpcb /* for KAME src sync over BSD*'s */ + +#include +#include /* XXX included for in_pcb.h */ +#include +#include /* XXX included for in_pcb.h */ +#include + +/* + * Tcp control block, one per tcp; fields: + * Organized for 16 byte cacheline efficiency. + */ +struct tcpcb { + struct tsegqe_head t_segq; + int t_reass_qsize; + int t_reass_qmax; + + struct callout *tt_rexmt; /* retransmit timer */ + struct callout *tt_persist; /* retransmit persistence */ + struct callout *tt_keep; /* keepalive */ + struct callout *tt_2msl; /* 2*msl TIME_WAIT timer */ + struct callout *tt_delack; /* delayed ACK timer */ + + struct inpcb *t_inpcb; /* back pointer to internet pcb */ + int t_state; /* state of this connection */ + u_int t_flags; +#define TF_ACKNOW 0x00001 /* ack peer immediately */ +#define TF_DELACK 0x00002 /* ack, but try to delay it */ +#define TF_NODELAY 0x00004 /* don't delay packets to coalesce */ +#define TF_NOOPT 0x00008 /* don't use tcp options */ +#define TF_SENTFIN 0x00010 /* have sent FIN */ +#define TF_REQ_SCALE 0x00020 /* have/will request window scaling */ +#define TF_RCVD_SCALE 0x00040 /* other side has requested scaling */ +#define TF_REQ_TSTMP 0x00080 /* have/will request timestamps */ +#define TF_RCVD_TSTMP 0x00100 /* a timestamp was received in SYN */ +#define TF_SACK_PERMIT 0x00200 /* other side said I could SACK */ +#define TF_NEEDSYN 0x00400 /* send SYN (implicit state) */ +#define TF_NEEDFIN 0x00800 /* send FIN (implicit state) */ +#define TF_NOPUSH 0x01000 /* don't push */ +#define TF_REQ_CC 0x02000 /* have/will request CC */ +#define TF_RCVD_CC 0x04000 /* a CC was received in SYN */ +#define TF_SENDCCNEW 0x08000 /* send CCnew instead of CC in SYN */ +#define TF_MORETOCOME 0x10000 /* More data to be appended to sock */ +#define TF_LQ_OVERFLOW 0x20000 /* listen queue overflow */ +#define TF_NAGLE_CREDIT 0x40000 /* connection was previously idle */ +#define TF_RXWIN0SENT 0x80000 /* sent a receiver win 0 in response */ + int t_force; /* 1 if forcing out a byte */ + + tcp_seq snd_una; /* send unacknowledged */ + tcp_seq snd_max; /* highest sequence number sent; + * used to recognize retransmits + */ + tcp_seq snd_nxt; /* send next */ + tcp_seq snd_up; /* send urgent pointer */ + + tcp_seq snd_wl1; /* window update seg seq number */ + tcp_seq snd_wl2; /* window update seg ack number */ + tcp_seq iss; /* initial send sequence number */ + tcp_seq irs; /* initial receive sequence number */ + + tcp_seq rcv_nxt; /* receive next */ + tcp_seq rcv_adv; /* advertised window */ + u_long rcv_wnd; /* receive window */ + tcp_seq rcv_up; /* receive urgent pointer */ + + u_long snd_wnd; /* send window */ + u_long snd_cwnd; /* congestion-controlled window */ + u_long snd_bwnd; /* bandwidth-controlled window */ + u_long snd_ssthresh; /* snd_cwnd size threshold for + * for slow start exponential to + * linear switch + */ + u_long snd_bandwidth; /* calculated bandwidth or 0 */ + tcp_seq snd_recover; /* for use in fast recovery */ + + int t_dupacks; /* consecutive dup acks recd */ + + u_int t_maxopd; /* mss plus options */ + + u_long t_rcvtime; /* inactivity time */ + u_long t_starttime; /* time connection was established */ + int t_rtttime; /* round trip time */ + tcp_seq t_rtseq; /* sequence number being timed */ + + int t_bw_rtttime; /* used for bandwidth calculation */ + tcp_seq t_bw_rtseq; /* used for bandwidth calculation */ + + int t_rxtcur; /* current retransmit value (ticks) */ + u_int t_maxseg; /* maximum segment size */ + int t_srtt; /* smoothed round-trip time */ + int t_rttvar; /* variance in round-trip time */ + + int t_rxtshift; /* log(2) of rexmt exp. backoff */ + u_int t_rttmin; /* minimum rtt allowed */ + u_int t_rttbest; /* best rtt we've seen */ + u_long t_rttupdated; /* number of times rtt sampled */ + u_long max_sndwnd; /* largest window peer has offered */ + + int t_softerror; /* possible error not yet reported */ +/* out-of-band data */ + char t_oobflags; /* have some */ + char t_iobc; /* input character */ +#define TCPOOB_HAVEDATA 0x01 +#define TCPOOB_HADDATA 0x02 +/* RFC 1323 variables */ + u_char snd_scale; /* window scaling for send window */ + u_char rcv_scale; /* window scaling for recv window */ + u_char request_r_scale; /* pending window scaling */ + u_char requested_s_scale; + u_int16_t t_phsum; /* cached pseudo-header sum w/o len */ + u_long ts_recent; /* timestamp echo data */ + + u_long ts_recent_age; /* when last updated */ + tcp_seq last_ack_sent; + +#ifdef TTCP +/* RFC 1644 variables */ + tcp_cc cc_send; /* send connection count */ + tcp_cc cc_recv; /* receive connection count */ +#endif /* TTCP */ + +/* experimental */ + u_long snd_cwnd_prev; /* cwnd prior to retransmit */ + u_long snd_ssthresh_prev; /* ssthresh prior to retransmit */ + u_long t_badrxtwin; /* window for retransmit recovery */ +}; + +/* + * Structure to hold TCP options that are only used during segment + * processing (in tcp_input), but not held in the tcpcb. + * It's basically used to reduce the number of parameters + * to tcp_dooptions. + */ +struct tcpopt { + u_long to_flags; /* which options are present */ +#define TOF_TS 0x0001 /* timestamp */ +#define TOF_CC 0x0002 /* CC and CCnew are exclusive */ +#define TOF_CCNEW 0x0004 +#define TOF_CCECHO 0x0008 +#define TOF_MSS 0x0010 +#define TOF_SCALE 0x0020 + u_int32_t to_tsval; + u_int32_t to_tsecr; + tcp_cc to_cc; /* holds CC or CCnew */ + tcp_cc to_ccecho; + u_int16_t to_mss; + u_int8_t to_requested_s_scale; + u_int8_t to_pad; +}; + +struct syncache { + inp_gen_t sc_inp_gencnt; /* pointer check */ + struct tcpcb *sc_tp; /* tcb for listening socket */ + struct mbuf *sc_ipopts; /* source route */ + struct in_conninfo sc_inc; /* addresses */ +#define sc_route sc_inc.inc_route +#define sc_route6 sc_inc.inc6_route + u_int32_t sc_tsrecent; +#ifdef TTCP + tcp_cc sc_cc_send; /* holds CC or CCnew */ + tcp_cc sc_cc_recv; +#endif + tcp_seq sc_irs; /* seq from peer */ + tcp_seq sc_iss; /* our ISS */ + u_long sc_rxttime; /* retransmit time */ + u_int16_t sc_rxtslot; /* retransmit counter */ + u_int16_t sc_peer_mss; /* peer's MSS */ + u_int16_t sc_wnd; /* advertised window */ + u_int8_t sc_requested_s_scale:4, + sc_request_r_scale:4; + u_int8_t sc_flags; +#define SCF_NOOPT 0x01 /* no TCP options */ +#define SCF_WINSCALE 0x02 /* negotiated window scaling */ +#define SCF_TIMESTAMP 0x04 /* negotiated timestamps */ +#define SCF_CC 0x08 /* negotiated CC */ +#define SCF_UNREACH 0x10 /* icmp unreachable received */ +#define SCF_KEEPROUTE 0x20 /* keep cloned route */ + TAILQ_ENTRY(syncache) sc_hash; + TAILQ_ENTRY(syncache) sc_timerq; +}; + +struct syncache_head { + TAILQ_HEAD(, syncache) sch_bucket; + u_int sch_length; +}; + +/* + * Transmit the SYN,ACK fewer times than TCP_MAXRXTSHIFT specifies. + * 3 retransmits corresponds to a timeout of (1 + 2 + 4 + 8 == 15) seconds, + * the odds are that the user has given up attempting to connect by then. + */ +#define SYNCACHE_MAXREXMTS 3 + +struct tcp_syncache { + struct syncache_head *hashbase; +#if 0 /* clarinet */ + struct vm_zone *zone; +#endif + u_int hashsize; + u_int hashmask; + u_int bucket_limit; + u_int cache_count; + u_int cache_limit; + u_int rexmt_limit; + u_int hash_secret; + u_int next_reseed; + TAILQ_HEAD(, syncache) timerq[SYNCACHE_MAXREXMTS + 1]; + struct callout tt_timerq[SYNCACHE_MAXREXMTS + 1]; +}; + +/* + * The TAO cache entry which is stored in the protocol family specific + * portion of the route metrics. + */ +struct rmxp_tao { + tcp_cc tao_cc; /* latest CC in valid SYN */ + tcp_cc tao_ccsent; /* latest CC sent to peer */ + u_short tao_mssopt; /* peer's cached MSS */ +#ifdef notyet + u_short tao_flags; /* cache status flags */ +#define TAOF_DONT 0x0001 /* peer doesn't understand rfc1644 */ +#define TAOF_OK 0x0002 /* peer does understand rfc1644 */ +#define TAOF_UNDEF 0 /* we don't know yet */ +#endif /* notyet */ +}; +#define rmx_taop(r) ((struct rmxp_tao *)(r).rmx_filler) + +#define intotcpcb(ip) ((struct tcpcb *)(ip)->inp_ppcb) +#define sototcpcb(so) (intotcpcb(sotoinpcb(so))) + +/* + * The smoothed round-trip time and estimated variance + * are stored as fixed point numbers scaled by the values below. + * For convenience, these scales are also used in smoothing the average + * (smoothed = (1/scale)sample + ((scale-1)/scale)smoothed). + * With these scales, srtt has 3 bits to the right of the binary point, + * and thus an "ALPHA" of 0.875. rttvar has 2 bits to the right of the + * binary point, and is smoothed with an ALPHA of 0.75. + */ +#define TCP_RTT_SCALE 32 /* multiplier for srtt; 3 bits frac. */ +#define TCP_RTT_SHIFT 5 /* shift for srtt; 3 bits frac. */ +#define TCP_RTTVAR_SCALE 16 /* multiplier for rttvar; 2 bits */ +#define TCP_RTTVAR_SHIFT 4 /* shift for rttvar; 2 bits */ +#define TCP_DELTA_SHIFT 2 /* see tcp_input.c */ + +/* + * The initial retransmission should happen at rtt + 4 * rttvar. + * Because of the way we do the smoothing, srtt and rttvar + * will each average +1/2 tick of bias. When we compute + * the retransmit timer, we want 1/2 tick of rounding and + * 1 extra tick because of +-1/2 tick uncertainty in the + * firing of the timer. The bias will give us exactly the + * 1.5 tick we need. But, because the bias is + * statistical, we have to test that we don't drop below + * the minimum feasible timer (which is 2 ticks). + * This version of the macro adapted from a paper by Lawrence + * Brakmo and Larry Peterson which outlines a problem caused + * by insufficient precision in the original implementation, + * which results in inappropriately large RTO values for very + * fast networks. + */ +#define TCP_REXMTVAL(tp) \ + max((tp)->t_rttmin, (((tp)->t_srtt >> (TCP_RTT_SHIFT - TCP_DELTA_SHIFT)) \ + + (tp)->t_rttvar) >> TCP_DELTA_SHIFT) + +#endif /* _WRS_KERNEL */ + + +/* + * TCP statistics. + * Many of these should be kept per connection, + * but that's inconvenient at the moment. + */ +struct tcpstat { + u_long tcps_connattempt; /* connections initiated */ + u_long tcps_accepts; /* connections accepted */ + u_long tcps_connects; /* connections established */ + u_long tcps_drops; /* connections dropped */ + u_long tcps_conndrops; /* embryonic connections dropped */ + u_long tcps_closed; /* conn. closed (includes drops) */ + u_long tcps_segstimed; /* segs where we tried to get rtt */ + u_long tcps_rttupdated; /* times we succeeded */ + u_long tcps_delack; /* delayed acks sent */ + u_long tcps_timeoutdrop; /* conn. dropped in rxmt timeout */ + u_long tcps_rexmttimeo; /* retransmit timeouts */ + u_long tcps_persisttimeo; /* persist timeouts */ + u_long tcps_keeptimeo; /* keepalive timeouts */ + u_long tcps_keepprobe; /* keepalive probes sent */ + u_long tcps_keepdrops; /* connections dropped in keepalive */ + + u_long tcps_sndtotal; /* total packets sent */ + u_long tcps_sndpack; /* data packets sent */ + u_long tcps_sndbyte; /* data bytes sent */ + u_long tcps_sndrexmitpack; /* data packets retransmitted */ + u_long tcps_sndrexmitbyte; /* data bytes retransmitted */ + u_long tcps_sndacks; /* ack-only packets sent */ + u_long tcps_sndprobe; /* window probes sent */ + u_long tcps_sndurg; /* packets sent with URG only */ + u_long tcps_sndwinup; /* window update-only packets sent */ + u_long tcps_sndctrl; /* control (SYN|FIN|RST) packets sent */ + + u_long tcps_rcvtotal; /* total packets received */ + u_long tcps_rcvpack; /* packets received in sequence */ + u_long tcps_rcvbyte; /* bytes received in sequence */ + u_long tcps_rcvbadsum; /* packets received with ccksum errs */ + u_long tcps_rcvbadoff; /* packets received with bad offset */ + u_long tcps_rcvmemdrop; /* packets dropped for lack of memory */ + u_long tcps_rcvshort; /* packets received too short */ + u_long tcps_rcvduppack; /* duplicate-only packets received */ + u_long tcps_rcvdupbyte; /* duplicate-only bytes received */ + u_long tcps_rcvpartduppack; /* packets with some duplicate data */ + u_long tcps_rcvpartdupbyte; /* dup. bytes in part-dup. packets */ + u_long tcps_rcvoopack; /* out-of-order packets received */ + u_long tcps_rcvoobyte; /* out-of-order bytes received */ + u_long tcps_rcvpackafterwin; /* packets with data after window */ + u_long tcps_rcvbyteafterwin; /* bytes rcvd after window */ + u_long tcps_rcvafterclose; /* packets rcvd after "close" */ + u_long tcps_rcvwinprobe; /* rcvd window probe packets */ + u_long tcps_rcvdupack; /* rcvd duplicate acks */ + u_long tcps_rcvacktoomuch; /* rcvd acks for unsent data */ + u_long tcps_rcvackpack; /* rcvd ack packets */ + u_long tcps_rcvackbyte; /* bytes acked by rcvd acks */ + u_long tcps_rcvwinupd; /* rcvd window update packets */ + u_long tcps_pawsdrop; /* segments dropped due to PAWS */ + u_long tcps_predack; /* times hdr predict ok for acks */ + u_long tcps_preddat; /* times hdr predict ok for data pkts */ + u_long tcps_pcbcachemiss; + u_long tcps_cachedrtt; /* times cached RTT in route updated */ + u_long tcps_cachedrttvar; /* times cached rttvar updated */ + u_long tcps_cachedssthresh; /* times cached ssthresh updated */ + u_long tcps_usedrtt; /* times RTT initialized from route */ + u_long tcps_usedrttvar; /* times RTTVAR initialized from rt */ + u_long tcps_usedssthresh; /* times ssthresh initialized from rt*/ + u_long tcps_persistdrop; /* timeout in persist state */ + u_long tcps_badsyn; /* bogus SYN, e.g. premature ACK */ + u_long tcps_mturesent; /* resends due to MTU discovery */ + u_long tcps_listendrop; /* listen queue overflows */ + + u_long tcps_sc_added; /* entry added to syncache */ + u_long tcps_sc_retransmitted; /* syncache entry was retransmitted */ + u_long tcps_sc_dupsyn; /* duplicate SYN packet */ + u_long tcps_sc_dropped; /* could not reply to packet */ + u_long tcps_sc_completed; /* successful extraction of entry */ + u_long tcps_sc_bucketoverflow; /* syncache per-bucket limit hit */ + u_long tcps_sc_cacheoverflow; /* syncache cache limit hit */ + u_long tcps_sc_reset; /* RST removed entry from syncache */ + u_long tcps_sc_stale; /* timed out or listen socket gone */ + u_long tcps_sc_aborted; /* syncache entry aborted */ + u_long tcps_sc_badack; /* removed due to bad ACK */ + u_long tcps_sc_unreach; /* ICMP unreachable received */ + u_long tcps_sc_zonefail; /* zalloc() failed */ + u_long tcps_sc_sendcookie; /* SYN cookie sent */ + u_long tcps_sc_recvcookie; /* SYN cookie received */ + + u_long tcps_reassdrop; /* reassembly queue limit pkt drops */ +}; + +#ifdef _WRS_KERNEL +/* + * This is the actual shape of what we allocate using the zone + * allocator. Doing it this way allows us to protect both structures + * using the same generation count, and also eliminates the overhead + * of allocating tcpcbs separately. By hiding the structure here, + * we avoid changing most of the rest of the code (although it needs + * to be changed, eventually, for greater efficiency). + */ + +/* Added from tcp_usrreq.c so that it can be included in ds_conf*/ + +#undef ALIGNMENT +#undef ALIGNM1 +#define ALIGNMENT 32 +#define ALIGNM1 (ALIGNMENT - 1) +struct inp_tp { + union { + struct inpcb inp; + char align[(sizeof(struct inpcb) + ALIGNM1) & ~ALIGNM1]; + } inp_tp_u; + struct tcpcb _tcb; + struct callout inp_tp_rexmt, inp_tp_persist, inp_tp_keep, inp_tp_2msl; + struct callout inp_tp_delack; +}; +#undef ALIGNMENT +#undef ALIGNM1 +#endif /* _WRS_KERNEL */ +/* + * TCB structure exported to user-land via sysctl(3). + * Declare only if in_pcb.h and sys/socketvar.h have been + * included. Not all of our clients do. + */ +#if defined(_NETINET_IN_PCB_H_) && defined(_SYS_SOCKETVAR_H_) +struct xtcpcb { + size_t xt_len; + struct inpcb xt_inp; + struct tcpcb xt_tp; + struct xsocket xt_socket; + u_quad_t xt_alignment_hack; +}; +#endif + +/* + * Names for TCP sysctl objects + */ +#define TCPCTL_DO_RFC1323 1 /* use RFC-1323 extensions */ +#define TCPCTL_DO_RFC1644 2 /* use RFC-1644 extensions */ +#define TCPCTL_MSSDFLT 3 /* MSS default */ +#define TCPCTL_STATS 4 /* statistics (read-only) */ +#define TCPCTL_RTTDFLT 5 /* default RTT estimate */ +#define TCPCTL_KEEPIDLE 6 /* keepalive idle timer */ +#define TCPCTL_KEEPINTVL 7 /* interval to send keepalives */ +#define TCPCTL_SENDSPACE 8 /* send buffer space */ +#define TCPCTL_RECVSPACE 9 /* receive buffer space */ +#define TCPCTL_KEEPINIT 10 /* timeout for establishing syn */ +#define TCPCTL_PCBLIST 11 /* list of all outstanding PCBs */ +#define TCPCTL_DELACKTIME 12 /* time before sending delayed ACK */ +#define TCPCTL_V6MSSDFLT 13 /* MSS default for IPv6 */ +#define TCPCTL_MAXID 14 + +#define TCPCTL_NAMES { \ + { 0, 0 }, \ + { "rfc1323", CTLTYPE_INT }, \ + { "rfc1644", CTLTYPE_INT }, \ + { "mssdflt", CTLTYPE_INT }, \ + { "stats", CTLTYPE_STRUCT }, \ + { "rttdflt", CTLTYPE_INT }, \ + { "keepidle", CTLTYPE_INT }, \ + { "keepintvl", CTLTYPE_INT }, \ + { "sendspace", CTLTYPE_INT }, \ + { "recvspace", CTLTYPE_INT }, \ + { "keepinit", CTLTYPE_INT }, \ + { "pcblist", CTLTYPE_STRUCT }, \ + { "delacktime", CTLTYPE_INT }, \ + { "v6mssdflt", CTLTYPE_INT }, \ +} + +#ifdef _WRS_KERNEL +#include +#ifndef VIRTUAL_STACK +SYSCTL_DECL_NODE_EXT(tcp); +#endif /* VIRTUAL_STACK */ + +#ifndef VIRTUAL_STACK +extern struct inpcbhead tcb; /* head of queue of active tcpcb's */ +extern struct inpcbinfo tcbinfo; +extern struct tcpstat tcpStat; /* tcp statistics */ +extern int tcp_mssdflt; /* XXX */ +extern int tcp_delack_enabled; +extern int tcp_do_newreno; +extern int pmtu_discovery; +extern int ss_fltsz; +extern int ss_fltsz_local; +extern TCP_REASS_INFO tcp_reass_info; +#endif + +void tcp_canceltimers __P((struct tcpcb *)); +struct tcpcb * + tcp_close __P((struct tcpcb *)); +void tcp_ctlinput __P((int, struct sockaddr *, void *)); +int tcp_ctloutput __P((struct socket *, struct sockopt *)); +struct tcpcb * + tcp_drop __P((struct tcpcb *, int)); +void tcp_drain __P((void)); +void tcp_fasttimo __P((void)); +struct rmxp_tao * + tcp_gettaocache __P((struct in_conninfo *)); +void tcp_init __P((void)); +void tcp_input __P((struct mbuf *, int, int)); +void tcp_mss __P((struct tcpcb *, int)); +int tcp_mssopt __P((struct tcpcb *)); +void tcp_drop_syn_sent __P((struct inpcb *, int)); +void tcp_mtudisc __P((struct inpcb *, int)); +struct tcpcb * + tcp_newtcpcb __P((struct inpcb *)); +int tcp_output __P((struct tcpcb *)); +void tcp_quench __P((struct inpcb *, int)); +void tcp_respond __P((struct tcpcb *, void *, + struct tcphdr *, struct mbuf *, tcp_seq, tcp_seq, int)); +struct rtentry * + tcp_rtlookup __P((struct in_conninfo *)); +void tcp_setpersist __P((struct tcpcb *)); +void tcp_slowtimo __P((void)); +struct mbuf * tcp_maketemplate __P((struct tcpcb *)); +void tcp_fillheaders __P((struct tcpcb *, void *, void *)); +struct tcpcb * + tcp_timers __P((struct tcpcb *, int)); +void tcp_xmit_bandwidth_limit(struct tcpcb *tp, tcp_seq ack_seq); +void syncache_init(void); +int syncache_unreach(struct in_conninfo *, struct tcphdr *); +int syncache_expand(struct in_conninfo *, struct tcphdr *, + struct socket **, struct mbuf *); +int syncache_add(struct in_conninfo *, struct tcpopt *, + struct tcphdr *, struct socket **, struct mbuf *); +void syncache_chkrst(struct in_conninfo *, struct tcphdr *); +void syncache_badack(struct in_conninfo *); + +#ifdef VIRTUAL_STACK +int syncache_cleanup (void); +#endif + +extern struct pr_usrreqs tcp_usrreqs; +#ifndef VIRTUAL_STACK +extern u_long tcp_sendspace; +extern u_long tcp_recvspace; +#endif + +tcp_seq tcp_new_isn __P((struct tcpcb *)); + +/* added to allow TCP to determine space requirements of external hook + * routines (mostly IPSec) */ +size_t updateHeaderSize __P((struct tcpcb *, struct rtentry *)); + +extern STATUS tcpReassInit __P((int, NET_POOL_ID, int)); + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* _NETINET_TCP_VAR_H_ */ diff --git a/h/wrn/coreip/netinet/tcpip.h b/h/wrn/coreip/netinet/tcpip.h new file mode 100644 index 0000000..ebbbe71 --- /dev/null +++ b/h/wrn/coreip/netinet/tcpip.h @@ -0,0 +1,104 @@ +/* tcpip.h - TCP+IP header definitions */ + +/* Copyright 2001-2003 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcpip.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/tcpip.h,v 1.8 1999/08/28 00:49:34 peter Exp $ + */ + +/* +modification history +-------------------- +01i,20nov03,niq Remove copyright_wrs.h file inclusion +01h,05nov03,cdw Removal of unnecessary _KERNEL guards. +01g,04nov03,rlm Ran batch header path update for header re-org. +01f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01e,08aug03,niq Merging from Accordion label ACCORDION_BASE6_MERGE_BASELINE +01d,10jun03,vvv include netVersion.h +01c,10sep02,hsh add c++ protection +01b,08feb02,pas EAR code cleanup +01a,13aug01,pas Created from FreeBSD4.3-RELEASE(July-17-01). +*/ + +#ifndef _NETINET_TCPIP_H_ +#define _NETINET_TCPIP_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * Tcp+ip header, after ip options removed. + */ +struct tcpiphdr { + struct ipovly ti_i; /* overlaid ip structure */ + struct tcphdr ti_t; /* tcp header */ +}; +#ifdef notyet +/* + * Tcp+ip header, after ip options removed but including TCP options. + */ +struct full_tcpiphdr { + struct ipovly ti_i; /* overlaid ip structure */ + struct tcphdr ti_t; /* tcp header */ + char ti_o[TCP_MAXOLEN]; /* space for tcp options */ +}; +#endif /* notyet */ +#define ti_x1 ti_i.ih_x1 +#define ti_pr ti_i.ih_pr +#define ti_len ti_i.ih_len +#define ti_src ti_i.ih_src +#define ti_dst ti_i.ih_dst +#define ti_sport ti_t.th_sport +#define ti_dport ti_t.th_dport +#define ti_seq ti_t.th_seq +#define ti_ack ti_t.th_ack +#define ti_x2 ti_t.th_x2 +#define ti_off ti_t.th_off +#define ti_flags ti_t.th_flags +#define ti_win ti_t.th_win +#define ti_sum ti_t.th_sum +#define ti_urp ti_t.th_urp + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/netinet/udp.h b/h/wrn/coreip/netinet/udp.h new file mode 100644 index 0000000..0ac5ca2 --- /dev/null +++ b/h/wrn/coreip/netinet/udp.h @@ -0,0 +1,78 @@ +/* udp.h - udp header file */ + +/* Copyright 2001-2003 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)udp.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/udp.h,v 1.7 1999/08/28 00:49:34 peter Exp $ + */ + +/* +modification history +-------------------- +01g,20nov03,niq Remove copyright_wrs.h file inclusion +01f,05nov03,cdw Removal of unnecessary _KERNEL guards. +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01c,10jun03,vvv include netVersion.h +01b,10sep02,hsh add c++ protection +01a,24aug01,hsh Created from BSD 4.3 +*/ + + +#ifndef _NETINET_UDP_H_ +#define _NETINET_UDP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * Udp protocol header. + * Per RFC 768, September, 1981. + */ +struct udphdr { + u_short uh_sport; /* source port */ + u_short uh_dport; /* destination port */ + u_short uh_ulen; /* udp length */ + u_short uh_sum; /* udp checksum */ +}; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/netinet/udp_var.h b/h/wrn/coreip/netinet/udp_var.h new file mode 100644 index 0000000..6febc80 --- /dev/null +++ b/h/wrn/coreip/netinet/udp_var.h @@ -0,0 +1,175 @@ +/* udp_var.h - udp header file */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)udp_var.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/udp_var.h,v 1.22.2.1 2001/02/18 07:12:25 luigi Exp $ + */ + +/* +modification history +-------------------- +01k,07feb05,vvv _KERNEL cleanup +01j,31jan05,niq virtual stack changes for sysctl +01i,20nov03,niq osdep.h cleanup +01h,05nov03,cdw Removal of unnecessary _KERNEL guards. +01g,04nov03,rlm Ran batch header path update for header re-org. +01f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01e,08aug03,niq Merging from Accordion label ACCORDION_BASE6_MERGE_BASELINE +01d,10jun03,vvv include netVersion.h +01c,10sep02,hsh add c++ protection +01b,03dec01,niq Sysctl changes for Clarinet +01a,24aug01,hsh Created from BSD 4.3 +*/ + +#ifndef _NETINET_UDP_VAR_H_ +#define _NETINET_UDP_VAR_H_ + +#ifdef _WRS_KERNEL +#include /* XXX for ip_var.h */ +#endif + +#include +#include + +#ifdef INET6 +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * UDP kernel structures and variables. + */ +struct udpiphdr { + struct ipovly ui_i; /* overlaid ip structure */ + struct udphdr ui_u; /* udp header */ +}; +#define ui_x1 ui_i.ih_x1 +#define ui_pr ui_i.ih_pr +#define ui_len ui_i.ih_len +#define ui_src ui_i.ih_src +#define ui_dst ui_i.ih_dst +#define ui_sport ui_u.uh_sport +#define ui_dport ui_u.uh_dport +#define ui_ulen ui_u.uh_ulen +#define ui_sum ui_u.uh_sum + +struct udpstat { + /* input statistics: */ + u_long udps_ipackets; /* total input packets */ + u_long udps_hdrops; /* packet shorter than header */ + u_long udps_badsum; /* checksum error */ + u_long udps_nosum; /* no checksum */ + u_long udps_badlen; /* data length larger than packet */ + u_long udps_noport; /* no socket on port */ + u_long udps_noportbcast; /* of above, arrived as broadcast */ + u_long udps_fullsock; /* not delivered, input socket full */ + u_long udpps_pcbcachemiss; /* input packets missing pcb cache */ + u_long udpps_pcbhashmiss; /* input packets not for hashed pcb */ + /* output statistics: */ + u_long udps_opackets; /* total output packets */ + u_long udps_fastout; /* output packets on fast path */ + /* of no socket on port, arrived as multicast */ + u_long udps_noportmcast; +}; + +/* + * Names for UDP sysctl objects + */ +#define UDPCTL_CHECKSUM 1 /* checksum UDP packets */ +#define UDPCTL_STATS 2 /* statistics (read-only) */ +#define UDPCTL_MAXDGRAM 3 /* max datagram size */ +#define UDPCTL_RECVSPACE 4 /* default receive buffer space */ +#define UDPCTL_PCBLIST 5 /* list of PCBs for UDP sockets */ +#define UDPCTL_MAXID 6 + +#define UDPCTL_NAMES { \ + { 0, 0 }, \ + { "checksum", CTLTYPE_INT }, \ + { "stats", CTLTYPE_STRUCT }, \ + { "maxdgram", CTLTYPE_INT }, \ + { "recvspace", CTLTYPE_INT }, \ + { "pcblist", CTLTYPE_STRUCT }, \ +} + +#ifdef _WRS_KERNEL +#include +#ifndef VIRTUAL_STACK +SYSCTL_DECL_NODE_EXT(udp); +#endif /* VIRTUAL_STACK */ + +#ifdef INET6 /* XXX location? */ +struct udp_in6 { + struct sockaddr_in6 uin6_sin; + u_char uin6_init_done : 1; +}; +struct udp_ip6 { + struct ip6_hdr uip6_ip6; + u_char uip6_init_done : 1; +}; +#endif + +extern struct pr_usrreqs udp_usrreqs; +#ifndef VIRTUAL_STACK +extern struct inpcbhead udb; +extern struct inpcbinfo udbinfo; +extern u_long udp_sendspace; +extern u_long udp_recvspace; +extern struct udpstat udpStat; +#if 0 /* accordion */ +extern int log_in_vain; +#else +extern int udp_log_in_vain; +#endif +#endif + +void udp_ctlinput __P((int, struct sockaddr *, void *)); +void udp_init __P((void)); +void udp_input __P((struct mbuf *, int, int)); + +void udp_notify __P((struct inpcb *inp, int error)); +int udp_shutdown __P((struct socket *so)); +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/netinet/vsArp.h b/h/wrn/coreip/netinet/vsArp.h new file mode 100644 index 0000000..48d732e --- /dev/null +++ b/h/wrn/coreip/netinet/vsArp.h @@ -0,0 +1,86 @@ +/* vsArp.h - virtual stack data for ARP and RARP */ + +/* Copyright 2000 - 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,22jun05,spm fixed proxy ARP server for overlapping networks (SPR #109580) +01i,09feb05,sar Move gtf include files per GTF code inspection of 10/26/2004 +01h,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01g,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01f,05nov03,cdw Removal of unnecessary _KERNEL guards. +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01c,06sep02,hgo removed #ifdef from VS_ARP +01b,17sep02,syy Merge from version 2 of Accordion Munich branch: + (modifications for IPv4/6 design: 01b,19jun02,hgo ) +01a,11jul02,spm automatic merge from version 1 of Accordion Munich branch: + (copied from Router Stack release: 01b,26oct01,spm) +*/ + +#ifndef __INCvsArph +#define __INCvsArph + +/* + * + * 1) arpt_prune (specifies how often list is checked for outdated entries) + * 2) arpt_keep (specifies how long an entry is kept without refresh) + * 3) arpt_down (remaining time in the table when an entry is declared down) + * 4) arp_intrq + * 5) arp_maxtries (max tries to resolve Ethernet address) + * 6) arp_proxyall + * 7) useloopback (use loopbackinterface for local traffic) + * 8) log_arp_wrong_iface (enable resolution error logging) + * 9) arp_gratuituous (send gratuituous ARP when link/inet is enabled) + * + * static in arprtrequest()/if_ether.c + * + * 10) null_sdl (const -> not modified) + * 11) arpinitdone (only used for single instance) + * + */ + + +/* includes */ +#include +#include + +/* defines */ + +/* typedefs */ + +typedef struct vsArp + { + /* definitions from netinet/if_ether.c */ + FUNCPTR proxyArpHook; + int _priv_arpt_prune; + int _priv_arpt_keep; + int _priv_arpt_down; + LIST_HEAD(,llinfo_arp) _arp_llinfo; + int _priv_arp_inuse; + int _priv_arp_allocated; + int _priv_arpinit_done; + GTF_TIMER *_priv_pArpTimer; + int _priv_arpMaxEntries; + int _priv_arp_maxtries; + int _priv_useloopback; + int _priv_arp_proxyall; + int _priv_log_arp_wrong_iface; + int _arp_gratuituous; + struct rtentry * pProxyRoute; + } VS_ARP; + + +/* macros for "non-private" global variables */ + +#define VS_ARP_DATA ((VS_ARP *)vsTbl[myStackNum]->pArpGlobals) + +#define proxyArpHook VS_ARP_DATA->proxyArpHook +#define arp_llinfo VS_ARP_DATA->_arp_llinfo +#define arp_gratuituous VS_ARP_DATA->_arp_gratuituous +#define pProxyRoute VS_ARP_DATA->pProxyRoute + +#endif /* __INCvsArph */ + diff --git a/h/wrn/coreip/netinet/vsData.h b/h/wrn/coreip/netinet/vsData.h new file mode 100644 index 0000000..7fdfe08 --- /dev/null +++ b/h/wrn/coreip/netinet/vsData.h @@ -0,0 +1,240 @@ +/* vsData.h - virtual stack data */ + +/* + * Copyright (c) 2000-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +02q,20jul05,vvv added pSctpGlobals +02p,20may05,kch Added pMip6Globals for mobility support. +02o,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +02n,25feb05,niq comment cleanup +02m,19sep04,spm reverse checkin 02k: hostname cache still needed +02l,19sep04,rae mrouteGlobals is now void * pMrouteGlobals +02k,19sep04,spm cleanup hostname initialization: remove unused globals +02j,17sep04,niq Code cleanup +02i,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +02h,13aug04,vvv fixed build error +02g,12aug04,kc VS data structure reorganization for IPv6 MIB2 interface + global variables. +02f,11aug04,niq VS data structure reorganization +02e,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +02d,04nov03,rlm Ran batch header path update for header re-org. +02c,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +02b,24oct03,cdw update include statements post header re-org. +02a,04apr03,wie sections framed with ifdef 0 and jw_ removed +01z,15jan03,hgo added pIcmpUtilGlobals +01y,12dec02,hgo added FASTUDP(6) +01x,25nov02,ism removed pRtadvGlobals +01v,18nov02,hgo added pHostSetupGlobals +01u,04nov02,kal moved Router Discovery globals to its own table +01t,29aug02,hgo add pBsdSockGlobals, pRtadvGlobals, + removed pSockGlobals, pNdpGlobals, pRipGlobals, pripngGlobals +01s,27aug02,kal add pMldGlobals +01r,26aug02,kal took out _icmpErrorHook - not used +01q,26aug02,hgo added pRaw-,pSock-,pNd6-,Ndp-,pRipGlobals +01p,26aug02,vlk added pDnsGlobals, pRarpGlobals +01o,26aug02,kal took out splSem stuff +01n,26aug02,ant added pIcmpv6Globals, pDhcprGlobals, pDhcpCommonGlobals, + pMrouteGlobals +01c,11jul02,spm fixed modification history after automatic merge +01b,11jul02,wrs automatic merge from version 5 of Accordion Munich branch: + (xxjul02,wie design review changes and cleanup) +01a,24jun02,spm automatic merge from version 1 of Accordion Munich branch: + (initial version of file copied from ver. 13 of tor3_x.synth + branch in /wind/river VOB: modhist 01l,04jun02,vvv) +*/ + +#ifndef __INCvsDatah +#define __INCvsDatah + +#include /* always included */ +#include /* for NET_POOL and NET_POOL_ID */ +#include /* for SEM_ID structure */ +#include /* for WDOG_ID structure */ +#include /* for sockproto structure */ +#include /* for route_cb structure */ +#include /* always included */ +#include /* always included */ +#include /* always included */ + +/* defines */ + +#define NLOOP 1 + + +/* + * This code is directly imported from ip_input.c where it was once + * a static struct but will now be part of the global struct. + * We could have put it in a more "appropriate" place in an IP related + * include file but I don't want to muddy those waters in this release. + */ + +typedef struct bsd_global_data + { +/* VS Layer. Things the VS system needs. */ + void * pVsGlobalDataHdr; + +/* Common storage for access to protocols, domains, and socket interface */ + + void * pCoreGlobals; /* defined in vsNetCore.h */ + +/* if layer Globals */ + void * pIfGlobals; /* defined in vsIf.h */ + +/* sysctl */ + + void * pSysctlGlobals; /* defined in vsSysctl.h */ + +/* RTM */ + + void * pRouteGlobals; /* defined in vsIpRoute.h */ + +/* Radix routing storage */ + + void * pRadixGlobals; /* defined in vsRadix.h */ + +/* routing socket storage */ + + VS_RTSOCK rtsockGlobals; /* defined in vsIpRoute.h */ + +/* Proxy ARP Layer */ + void * pProxyArpGlobals; /* defined in vsProxyArp.h */ + +/* ARP Layer */ + void * pArpGlobals; /* defined in vsArp.h */ + +/* RARP Layer */ + void * pRarpGlobals; /* defined in vsRarp.h */ + +/* ICMP Layer */ + void * pIcmpGlobals; /* defined in vsIcmp.h */ + +/* ICMP Utilities */ + void * pIcmpUtilGlobals; /* defined in vsIcmpUtil.h */ + +/* ICMPv6 Layer */ + void * pIcmpv6Globals; /* defined in vsIcmpv6.h */ + +/* IP Layer */ + void * pIpGlobals; /* defined in vsIp.h */ + +/* IP6 Layer */ + void * pIp6Globals; /* defined in vsIp6.h */ + +#ifdef MIP6 +/* IP6 Layer */ + void * pMip6Globals; /* defined in vsMip6.h */ +#endif /* MIP6 */ + +/* Show Routine Globals */ + + VS_UDPSHOW udpShowGlobals; /* defined in vsShow.h */ + + VS_TCPSHOW tcpShowGlobals; /* defined in vsShow.h */ + +/* UDP Layer */ + void * pUdpGlobals; /* defined in vsUdp.h */ + +#ifdef FASTUDP +/* Fast UDP Layer */ + void * pFastUdpGlobals; /* defined in vsFastUdp.h */ + BOOL fastUdpInitialized; /* normally defined in hooksinit.c */ + +/* Fast UDP Layer */ + void * pFastUdp6Globals; /* defined in vsFastUdp6.h */ + BOOL fastUdp6Initialized; /* normally defined in hooksinit.c */ +#endif + +/* m2 Layer: defined in vsM2.h */ + void * pM2SysGlobals; + VS_M2_IF m2IfGlobals; + void * pM2IpGlobals; +#ifdef INET6 + VS_M2_IPV6_IF m2Ipv6IfGlobals; +#endif + +/* IGMPv2 Layer */ +/* Definitions from netinet/igmp.c */ + + void * pIgmpGlobals; /* defined in vsIgmp.h */ + +/* Router side IGMP globals */ + + void * pIgmpRGlobals; /* defined in vsIgmpR.h */ + +/* TCP Layer */ + void * pTcpGlobals; /* defined in vsTcp.h */ + +/* RAW_CB */ + void * pRawGlobals; /* defined in vsRaw.h */ + +/* BSDSOCKET Layer */ + void * pBsdSockGlobals; /* defined in vsBsdSock.h */ + +/* Neighbor Discovery */ + void * pNd6Globals; /* defined in vsNd6.h */ + +/* Local Hostname Cache */ + + void * pHostnameGlobals; /* defined in vsHost.h */ + +/* Host Table */ + void * pHostGlobals; /* defined in vsHost.h */ + +/* Domain Name System (DNS) */ + void * pDnsGlobals; /* defined in vsDns.h */ + +/* Fast Forward Globals */ + void * pFastFrwdGlobals; /* defined in vsFastPath.h */ + int ffIpv4State; /* normally defined in hooksinit.c */ + int ffIpv6State; /* normally defined in hooksinit.c */ + +/* DHCP SERVER Globals */ + void * pDhcpsGlobals; /* defined in vsDhcps.h */ + +/* DHCP RELAY AGENT Globals */ + void * pDhcprGlobals; /* defined in vsDhcpr.h */ + +/* DHCP Common Globals, common for SERVER and RELAY AGENT */ + void * pDhcpCommonGlobals; /* defined in vsDhcpCommon.h */ + +/* mroute Globals */ + void * pMrouteGlobals; /* defined in vsMcast.h */ + +/* mroute6 Globals */ + void * pMroute6Globals; /* defined in vsMroute6.h */ + +/* MLD Globals */ + void * pMldGlobals; /* defined in vsMld.h */ + +#ifdef SCTP +/* SCTP Globals */ + void * pSctpGlobals; /* defined in vsSctp.h */ +#endif + +} BSD_GLOBAL_DATA; + +IMPORT BSD_GLOBAL_DATA* vsTbl[]; + + +/* macros */ + +#ifdef FASTUDP +#define fastUdpInitialized vsTbl[myStackNum]->fastUdpInitialized +#endif + +#define ffIpv4State vsTbl[myStackNum]->ffIpv4State +#define ffIpv6State vsTbl[myStackNum]->ffIpv6State + + +#endif /* __INCvsDatah */ diff --git a/h/wrn/coreip/netinet/vsDhcps.h b/h/wrn/coreip/netinet/vsDhcps.h new file mode 100644 index 0000000..1ce41f0 --- /dev/null +++ b/h/wrn/coreip/netinet/vsDhcps.h @@ -0,0 +1,118 @@ +/* vsDhcps.h - virtual stack data for DHCP Server routines */ + +/* Copyright 2003 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,15mar04,rp merged from orion +01e,05nov03,cdw Removal of unnecessary _KERNEL guards. +01d,04nov03,rlm Ran batch header path update for header re-org. +01c,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01b,24mar03,ant added three priv_ variables to the VS_DHCPS struct (dhcps.c), + three priv_ variables removed from VS_DHCPS (dhcpsLib.c) +01a,17jul02,ant taken from synth +*/ + +#ifndef __INCvsdhcpsh +#define __INCvsdhcpsh + +#include +#include +#include +#include +#include +#include + +typedef struct vs_dhcps_global_data + { + /* Globals and locals in dhcpsLib.c */ + DHCPS_RELAY_DESC *pDhcpsRelaySourceTbl; /* Pointer to Relay Table */ + DHCPS_LEASE_DESC *pDhcpsLeasePool; /* Pointer to Lease Pool */ + long dhcps_dflt_lease; /* Default for default lease length */ + long dhcps_max_lease; /* Default maximum lease length */ + SEM_ID dhcpsMutexSem; /* Synchronization for lease entry adds. */ + FUNCPTR dhcpsLeaseHookRtn; /* Accesses storage for lease bindings. */ + FUNCPTR dhcpsAddressHookRtn; /* Preserves additional address entries. */ + int dhcpsMaxSize; /* Transmit buffer size & largest supported message. */ + int dhcpsBufSize; /* Size of buffer for BPF devices */ + struct if_info *dhcpsIntfaceList; + BOOL priv_dhcpsInitialized; + struct bpf_insn priv_dhcpfilter[MAX_DHCPFILTERS]; + struct bpf_program priv_dhcpread; + + /* Locals in dhcps.c */ + int nbind; /* Number of active or pending lease records. */ + struct msg dhcpsMsgIn; /* Pointers to components of incoming message. */ + struct msg dhcpsMsgOut; /* Pointers to outgoing message parts. */ + char *dhcpsSendBuf; /* Transmit buffer for outgoing messages. */ + char *dhcpsOverflowBuf; /* Extra space (for larger messages) starts here. */ + struct iovec sbufvec[2]; /* Socket access to outgoing message. + * sbufvec[0] is standard message. + * sbufvec[1] contains message extensions if + * client accepts longer messages. */ + unsigned char priv_dhcpCookie[MAGIC_LEN]; /* DHCP message indicator. */ + int priv_rdhcplen; /* Size of received DHCP message. */ + int priv_overload; /* Options in sname or file fields? */ + int priv_off_options; /* Index into options field. */ + int priv_off_extopt; /* Index into any options in sbufvec[1]. */ + int priv_maxoptlen; /* Space available for options. */ + int priv_off_file; /* Index into any options within file field. */ + int priv_off_sname; /* Index into any options in sname field. */ + char priv_resultHaddrtos [MAX_HLEN * 2 + 8];/* hardware address in cache format + * :0x */ + char priv_resultCidtos [MAXOPT * 2 + INET_ADDRSTRLEN + 3]; + /* client identifier in cache format + * :0x */ + time_t priv_prev_epoch; + + /* Globals in database.c */ + + struct hash_tbl cidhashtable; + struct hash_tbl iphashtable; + struct hash_tbl nmhashtable; + struct hash_tbl relayhashtable; + struct hash_tbl paramhashtable; + struct hash_member *bindlist; + struct hash_member *reslist; + + } VS_DHCPS; + + +/* Macro */ + +#define VS_DHCPS_DATA ((VS_DHCPS *)vsTbl[myStackNum]->pDhcpsGlobals) + +/* Defines for the dhcp routine globals */ + +/* Globals in dhcpsLib.c */ +#define pDhcpsRelaySourceTbl VS_DHCPS_DATA->pDhcpsRelaySourceTbl +#define pDhcpsLeasePool VS_DHCPS_DATA->pDhcpsLeasePool +#define dhcps_dflt_lease VS_DHCPS_DATA->dhcps_dflt_lease +#define dhcps_max_lease VS_DHCPS_DATA->dhcps_max_lease +#define dhcpsMutexSem VS_DHCPS_DATA->dhcpsMutexSem +#define dhcpsLeaseHookRtn VS_DHCPS_DATA->dhcpsLeaseHookRtn +#define dhcpsAddressHookRtn VS_DHCPS_DATA->dhcpsAddressHookRtn +#define dhcpsMaxSize VS_DHCPS_DATA->dhcpsMaxSize +#define dhcpsBufSize VS_DHCPS_DATA->dhcpsBufSize +#define dhcpsIntfaceList VS_DHCPS_DATA->dhcpsIntfaceList + +/* Globals in dhcps.c */ +#define nbind VS_DHCPS_DATA->nbind +#define dhcpsMsgIn VS_DHCPS_DATA->dhcpsMsgIn +#define dhcpsMsgOut VS_DHCPS_DATA->dhcpsMsgOut +#define dhcpsSendBuf VS_DHCPS_DATA->dhcpsSendBuf +#define dhcpsOverflowBuf VS_DHCPS_DATA->dhcpsOverflowBuf +#define sbufvec VS_DHCPS_DATA->sbufvec + +/* Globals in database.c */ +#define cidhashtable VS_DHCPS_DATA->cidhashtable +#define iphashtable VS_DHCPS_DATA->iphashtable +#define nmhashtable VS_DHCPS_DATA->nmhashtable +#define relayhashtable VS_DHCPS_DATA->relayhashtable +#define paramhashtable VS_DHCPS_DATA->paramhashtable +#define bindlist VS_DHCPS_DATA->bindlist +#define reslist VS_DHCPS_DATA->reslist + + +#endif /* __INCvsdhcpsh */ diff --git a/h/wrn/coreip/netinet/vsFastUdp.h b/h/wrn/coreip/netinet/vsFastUdp.h new file mode 100644 index 0000000..e4b3ce9 --- /dev/null +++ b/h/wrn/coreip/netinet/vsFastUdp.h @@ -0,0 +1,47 @@ +/* vsFastUdp.h - virtual stack data for Fast UDP */ + +/* Copyright 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,05nov03,cdw Removal of unnecessary _KERNEL guards. +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01c,26nov02,hgo modifications for accordion +01b,01aug02,spm fixed modification history after automatic merge +01a,18jul02,wrs automatic merge from version 1 of Accordion Munich branch: + (copied from Router Stack release: 01a,04jun02,vvv) +*/ + +#ifndef __INCvsfastudph +#define __INCvsfastudph + + +/* includes */ + +#include + +/* defines */ + +/* typedefs */ + +typedef struct vs_fastudp + { + /* locals from fastUdpLib.c */ + + FASTUDP_ID _priv_fastUdpHead; + u_int _priv_fastUdpDebug; + SEM_ID _priv_mutexSem; + LIST _priv_portList; + SEM_ID _priv_portListSem; + BOOL _priv_vsWaitingForFastUdp; + SEM_ID _priv_vsFastUdpListSync; + } VS_FASTUDP; + + +/* macros */ + +#define VS_FASTUDP_DATA ((VS_FASTUDP *) vsTbl[myStackNum]->pFastUdpGlobals) + +#endif /* __INCvsfastudph */ diff --git a/h/wrn/coreip/netinet/vsHost.h b/h/wrn/coreip/netinet/vsHost.h new file mode 100644 index 0000000..123256b --- /dev/null +++ b/h/wrn/coreip/netinet/vsHost.h @@ -0,0 +1,66 @@ +/* vsHost.h - virtual stack data for Host Library */ + +/* Copyright 2000 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,19sep04,spm cleanup for hostname initialization: move local + hostname storage from deleted vsHostSetup.h file +01h,04nov03,rlm Ran batch header path update for header re-org. +01g,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01f,01apr03,hgo removed h_errno +01e,18nov02,hgo moved _targetName to vsHostSetup.h +01d,22jul02,hgo global variables of new routines +01c,26oct01,spm isolated virtual stack data structures (SPR #71092) +01b,16apr01,jpf Fixing a naming problem with hostInitFlag +01a,29mar01,spm file creation: copied from version 01a of tor2_0.open_stack + branch (wpwr VOB) for unified code base; changed semaphore + type for protection domain restrictions +*/ + +#ifndef __INCvshosth +#define __INCvshosth + + +/* includes */ + +#include +#include +#include +#include + +/* defines */ + +#define HOSTNAME_LEN 128 + +/* typedefs */ + +typedef struct vs_host + { + /* definitions from hostLib.c */ + LIST hostList; + SEM_ID hostListSem; + BOOL hostInitFlag; /* FALSE = not done, TRUE = already initialized */ + char _priv_targetName [MAXHOSTNAMELEN]; /* local hostname */ + } VS_HOST; + +typedef struct vs_hostnameCache + { + char _priv_targetName [MAXHOSTNAMELEN]; /* name for this target machine */ + } VS_LOCALNAME; + +/* macros for hostname cache */ + +#define VS_HOSTNAME_DATA ((VS_LOCALNAME *)vsTbl[myStackNum]->pHostnameGlobals) + +/* macros for host table */ + +#define VS_HOST_DATA ((VS_HOST *)vsTbl[myStackNum]->pHostGlobals) + +/* Defines for the HOST TABLE globals */ +#define hostList VS_HOST_DATA->hostList +#define hostListSem VS_HOST_DATA->hostListSem +#define hostInitFlag VS_HOST_DATA->hostInitFlag + +#endif /* __INCvshosth */ diff --git a/h/wrn/coreip/netinet/vsIcmp.h b/h/wrn/coreip/netinet/vsIcmp.h new file mode 100644 index 0000000..5452bbe --- /dev/null +++ b/h/wrn/coreip/netinet/vsIcmp.h @@ -0,0 +1,65 @@ +/* vsIcmp.h - virtual stack data for ICMP */ + +/* Copyright 2000 - 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,05nov03,cdw Removal of unnecessary _KERNEL guards. +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01c,07mar03,spm fixed VS support after merge from CLARINET-1_1-KAME-UPDATE +01b,14jan03,hgo removed icmpUtilLib part +01a,18jun02,ant taken from from synth +*/ + +#ifndef __INCvsIcmph +#define __INCvsIcmph + + +/* includes */ + +#include +#include +#include + +/* defines */ + +/* typedefs */ + +typedef struct vs_icmp_global_data + { + /* definitions from ip_icmp.c */ + struct icmpstat _icmpstat; + int priv_icmpmaskrepl; + int priv_drop_redirect; + int priv_log_redirect; + int priv_ICMPMAXPAYLOAD_LEN; + int priv_icmplim; + int priv_icmplim_output; + int priv_icmpbmcastecho; +#ifdef ICMPPRINTFS + int icmpprintfs; +#endif + struct icmp_info priv_icmpsrc; + struct sockaddr_in priv_icmpdst; + struct sockaddr_in priv_icmpgw; + + /* definition from badport_bandlim() */ + int priv_lticks[BANDLIM_MAX + 1]; + int priv_lpackets[BANDLIM_MAX + 1]; + + } VS_ICMP; + + +/* macros */ + +#define VS_ICMP_DATA ((VS_ICMP *)vsTbl[myStackNum]->pIcmpGlobals) + +#define _icmpstat VS_ICMP_DATA->_icmpstat +#ifdef ICMPPRINTFS +#define icmpprintfs VS_ICMP_DATA->icmpprintfs +#endif + +#endif /* __INCvsIcmph */ + diff --git a/h/wrn/coreip/netinet/vsIgmp.h b/h/wrn/coreip/netinet/vsIgmp.h new file mode 100644 index 0000000..3672d19 --- /dev/null +++ b/h/wrn/coreip/netinet/vsIgmp.h @@ -0,0 +1,72 @@ +/* vsIgmp.h - virtual stack data for IGMP */ + +/* Copyright 2000 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,07jul05,kch Added _igmpGetRouterAlertHook. +01d,05nov03,cdw Removal of unnecessary _KERNEL guards. +01c,04nov03,rlm Ran batch header path update for header re-org. +01b,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01a,17jun02,ant taken from from synth +*/ + +#ifndef __INCvsIgmph +#define __INCvsIgmph + + +/* includes */ + +#include /* for mcastHashInfo structure */ + +/* defines */ + + +/* typedefs */ + +typedef struct vs_igmp_global_data + { + struct igmpstat _igmpstat; + int priv_igmp_timers_are_running; + u_long priv_igmp_all_hosts_group; + u_long priv_igmp_all_rtrs_group; + struct mbuf *priv_router_alert; + struct router_info *priv_Head; + struct route priv_igmprt; + VOIDFUNCPTR _igmpJoinAlertHook; + VOIDFUNCPTR _igmpLeaveAlertHook; + VOIDFUNCPTR _igmpQuerierTimeUpdateHook; + VOIDFUNCPTR _igmpMessageHook; + VOIDFUNCPTR _igmpJoinGrpHook; + VOIDFUNCPTR _igmpLeaveGrpHook; + FUNCPTR _igmpGetRouterAlertHook; + } VS_IGMP; + +/* macros */ + +/* + * IGMP is optional and in.c used to check for the _igmpJoinGrpHook + * and _igmpLeaveGrpHook being non-NULL before calling them. That is + * valid only when we have a valid VS_IGMP_DATA. If we don't, then + * we'll need the IS_INITIALIZED_* macros below to check if the + * hooks are valid + */ + +#define VS_IGMP_DATA ((VS_IGMP *)vsTbl[myStackNum]->pIgmpGlobals) + +#define _igmpstat VS_IGMP_DATA->_igmpstat +#define _igmpJoinAlertHook VS_IGMP_DATA->_igmpJoinAlertHook +#define _igmpLeaveAlertHook VS_IGMP_DATA->_igmpLeaveAlertHook +#define _igmpQuerierTimeUpdateHook VS_IGMP_DATA->_igmpQuerierTimeUpdateHook +#define _igmpMessageHook VS_IGMP_DATA->_igmpMessageHook +#define _igmpJoinGrpHook VS_IGMP_DATA->_igmpJoinGrpHook +#define _igmpLeaveGrpHook VS_IGMP_DATA->_igmpLeaveGrpHook +#define _igmpGetRouterAlertHook VS_IGMP_DATA->_igmpGetRouterAlertHook + +#define IS_INITIALIZED_JOIN_GRP_HOOK (VS_IGMP_DATA != NULL && \ + _igmpJoinGrpHook != NULL) +#define IS_INITIALIZED_LEAVE_GRP_HOOK (VS_IGMP_DATA != NULL && \ + _igmpLeaveGrpHook != NULL) + +#endif /* __INCvsIgmph */ diff --git a/h/wrn/coreip/netinet/vsIgmpR.h b/h/wrn/coreip/netinet/vsIgmpR.h new file mode 100644 index 0000000..33d41ac --- /dev/null +++ b/h/wrn/coreip/netinet/vsIgmpR.h @@ -0,0 +1,80 @@ +/* vsIgmpR.h - virtual stack Macros for IGMP routing */ + +/* Copyright 2000 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,11aug04,rae fix for Dual Stack +01b,04nov03,rlm Ran batch header path update for header re-org. +01a,29mar01,spm file creation: copied from version 01c of tor2_0.open_stack + branch (wpwr VOB) for unified code base +*/ + +#ifndef __INCvsIgmpRh +#define __INCvsIgmpRh + + +/* includes */ + +#include "vxWorks.h" +#include "avlUintLib.h" +#include "avlLib.h" +#include "lstLib.h" +#include "wdLib.h" +#include "msgQLib.h" +#include +#include +#include +#include +#include +#include +#include + + +/* defines */ + +#define VS_IGMPR_DATA ((VS_IGMP_R *)vsTbl[myStackNum]->pIgmpRGlobals) + +/* typedefs */ + +typedef struct vsIgmpRStruct + { + IGMP_CLASS vs_igmp; + SEM_ID igmpCacheSem; + AVL_TREE igmpCacheTree; + AVL_TREE * igmpCacheTreePtr; + SEM_ID igmpPortSem; + AVLU_TREE igmpPortTree; + AVLU_TREE * igmpPortTreePtr; + int igmpSocket; + WDOG_ID igmpWd; + MSG_Q_ID igmpMsgQ; + SEM_ID igmpMSem; + int igmpTaskId; + int numIgmpIfs; + IGMP_PORT_INFO portToIPArr[MAX_PORT_NUM]; + int freeVifs[MAXVIFS]; + LIST igmpNotifyHookList; + } VS_IGMP_R; + +/* macros */ + +#define vs_igmp VS_IGMPR_DATA->vs_igmp +#define freeVifs VS_IGMPR_DATA->freeVifs +#define portToIPArr VS_IGMPR_DATA->portToIPArr +#define numIgmpIfs VS_IGMPR_DATA->numIgmpIfs +#define igmpTaskId VS_IGMPR_DATA->igmpTaskId +#define igmpMsgQ VS_IGMPR_DATA->igmpMsgQ +#define igmpMSem VS_IGMPR_DATA->igmpMSem +#define igmpWd VS_IGMPR_DATA->igmpWd +#define igmpSocket VS_IGMPR_DATA->igmpSocket +#define igmpCacheTreePtr VS_IGMPR_DATA->igmpCacheTreePtr +#define igmpCacheTree VS_IGMPR_DATA->igmpCacheTree +#define igmpCacheSem VS_IGMPR_DATA->igmpCacheSem +#define igmpPortTreePtr VS_IGMPR_DATA->igmpPortTreePtr +#define igmpPortTree VS_IGMPR_DATA->igmpPortTree +#define igmpPortSem VS_IGMPR_DATA->igmpPortSem +#define igmpNotifyHookList VS_IGMPR_DATA->igmpNotifyHookList +#endif /* __INCvsIgmpRh */ + diff --git a/h/wrn/coreip/netinet/vsIp.h b/h/wrn/coreip/netinet/vsIp.h new file mode 100644 index 0000000..cb4c87e --- /dev/null +++ b/h/wrn/coreip/netinet/vsIp.h @@ -0,0 +1,296 @@ +/* vsIp.h - virtual stack data for IP */ + +/* + * Copyright (c) 2000-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +01w,15aug05,dlk Port reassembly improvements from FreeBSD/Kame. + Removed priv_ip_nfragpackets and priv_ip_maxfragpackets, + added priv_maxfragsperpacket; +01v,25jun05,dlk Added ipintrq, ipintrqJob for loopback. +01u,27apr05,kch Move ip_mrouter definition here from VS_IP_MROUTE. +01t,02mar05,niq Make router alert support scalable +01s,25feb05,niq Add support for router alert +01r,31jan05,niq merge mroute changes from comp_wn_ipv6_multicast_interim-dev + branch (ver 1) +01q,20jan05,sar Removal of divert, dummynet and fw code. +01p,13sep04,vvv renamed icmpErrorLen to fix sysctl/virtual stack + issue (SPR #91565) +01o,23jun04,sar Added rate filter for completeness +01n,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01m,11may04,sar Added fields for IPFW routines +01l,21feb04,dlk Rename _icmperr_mcopy to icmperr_mcopy. +01k,11feb04,dlk Added _icmperr_mcopy. +01j,11nov03,cdw Removal of unnecessary _KERNEL guards. +01i,10nov03,rlm 2nd pass of include update for header re-org. +01h,05nov03,cdw Removal of unnecessary _KERNEL guards. +01g,04nov03,rlm Ran batch header path update for header re-org. +01f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01e,07mar03,spm fixed VS support after merge from CLARINET-1_1-KAME-UPDATE +01d,11dec02,sar Virtualize the external hooks +01c,02sep02,vlk added proxyBroadcastHook variable +01b,26aug02,kal moved some to VS_NET_CORE +01a,20jun02,ant taken from from synth +*/ + +#ifndef __INCvsIph +#define __INCvsIph + + +/* includes */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +LIST_HEAD(in_multihead, in_multi); +TAILQ_HEAD(in_ifaddrhead, in_ifaddr); + +/* defines */ + +/* typedefs */ + +typedef struct vs_ip_global_data + { + /* definitions from in.c */ + int priv_subnetsarelocal; + struct in_multihead _in_multihead; + int priv_in_interfaces; + + /* definitions from in_pcb.c */ + int ipport_lowfirstauto; + int ipport_lowlastauto; + int ipport_firstauto; + int ipport_lastauto; + int ipport_hifirstauto; + int ipport_hilastauto; + + /* definitions from in_proto.c */ + struct domain inetdomain; + + /* definitions from in_rmx.c */ + int priv_rtq_reallyold; + int priv_rtq_minreallyold; + int priv_rtq_toomany; + int priv_rtq_timeout; + time_t priv_last_adjusted_timeout; /* in_rtqtimo() */ + void *priv_rtqTimerHandle; + + /* definitions from in_flow.c */ + LIST_HEAD(ipflowhead, ipflow) priv_ipflows[IPFLOW_HASHSIZE]; + int priv_ipflow_inuse; + int priv_ipflow_active; + + /* definitions from ip_input.c */ + int rsvp_on; + int priv_ip_rsvp_on; + /* + * Removed ip_rsvpd as we support RSVP through the IP_ROUTER_ALERT option + */ + FUNCPTR proxyBroadcastHook; + int ipforwarding; + int priv_ipsendredirects; + int ip_defttl; + int priv_ip_dosourceroute; + int priv_ip_acceptsourceroute; + struct mbuf * icmperr_mcopy; +#if 0 + int ip_keepfaith; +#endif + int icmpErrorLength; + int priv_ip_checkinterface; +#ifdef DIAGNOSTIC + int priv_ipprintfs; +#endif + u_char ip_protox[IPPROTO_MAX]; + struct in_ifaddrhashhead *in_ifaddrhashtbl; + u_long in_ifaddrhmask; + + int priv_ipqmaxlen; + struct in_ifaddrhead _in_ifaddrhead; + struct ipstat _ipstat; + struct ipq priv_ipq[IPREASS_NHASH]; + int priv_nipq; + int priv_maxnipq; + int priv_maxfragsperpacket; +#ifdef IPSTEALTH + int priv_ipstealth; +#endif + + /* from intrq.c */ + struct ifqueue ipintrq; + INTRQ_QJOB ipintrqJob; + + int priv_ip_nhops; + struct ip_srcrt { + struct in_addr dst; + char nop; + char srcopt[IPOPT_OFFSET + 1]; + struct in_addr route[MAX_IPOPTLEN/sizeof(struct in_addr)]; + } priv_ip_srcrt; + struct sockaddr_in priv_ipaddr; + struct route ipforward_rt; + + /* external hooks from ip_input.c */ + INPUT_HOOK_IPV4_FUNCPTR ipFilterHook; + IPSEC_FILTER_HOOK_FUNCPTR ipsecFilterHook; + IPSEC_INPUT_FUNCPTR ipsecInput; + /* PROXY_BROADCAST_FUNCPTR proxyBroadcastHook;*/ + MCAST_ROUTE_FWD_FUNCPTR mCastRouteFwdHook; + FUNCPTR _mCastRouteCmdHook; + + /* external hook from sizing.c */ + SIZING_ROUTINE_FUNCPTR ipsecSizing; + + /* definitions from ip_output.c */ + u_short _ip_id; + struct route priv_sro_fwd; /* ip_output() */ + + /* external hooks from ip_output.c */ + IPSEC_OUTPUT_FUNCPTR ipsecOutput; + + /* definitions from raw_ip.c */ + struct inpcbhead ripcb; + struct inpcbinfo ripcbinfo; + struct sockaddr_in priv_ripsrc; + u_long rip_sendspace; + u_long rip_recvspace; + +#ifdef ROUTER_ALERT + struct ralcb_list_head _ralcb_list; +#endif /* ROUTER_ALERT */ + +#ifdef INCLUDE_IPFW_HOOKS + /* external hooks from ipfw_var.c, these are for ip_input.c and + ip_output.c */ + int ipfw_serial; + + ipfw_anchor_t ipfw_preinput; + ipfw_anchor_t ipfw_input; + ipfw_anchor_t ipfw_forward; + ipfw_anchor_t ipfw_output; + ipfw_anchor_t ipfw_call; + ipfw_anchor_t ipfw_rate; + + /* push points for the ipfw code, from ipfw_var.c */ + ipfw_type_t ipfw_types[IPFW_MAX_PUSH_POINTS]; +#endif /* INCLUDE_IPFW_HOOKS */ + + /* multicast routing daemon */ + struct socket *ip_mrouter; + + } VS_IP; + +/* macros */ + +#define VS_IP_DATA ((VS_IP *)vsTbl[myStackNum]->pIpGlobals) + +/* definitions from in.c */ +#define _in_multihead VS_IP_DATA->_in_multihead + +/* definitions from in_pcb.c */ +#define ipport_lowfirstauto VS_IP_DATA->ipport_lowfirstauto +#define ipport_lowlastauto VS_IP_DATA->ipport_lowlastauto +#define ipport_firstauto VS_IP_DATA->ipport_firstauto +#define ipport_lastauto VS_IP_DATA->ipport_lastauto +#define ipport_hifirstauto VS_IP_DATA->ipport_hifirstauto +#define ipport_hilastauto VS_IP_DATA->ipport_hilastauto + +/* definitions from in_proto.c */ +#define inetdomain VS_IP_DATA->inetdomain + +/* definitions from in_rmx.c */ + +/* definitions from in_flow.c */ + +/* definitions from ip_input.c */ +#define ipforward_rt VS_IP_DATA->ipforward_rt +#define rsvp_on VS_IP_DATA->rsvp_on +#define ipforwarding VS_IP_DATA->ipforwarding +#define proxyBroadcastHook VS_IP_DATA->proxyBroadcastHook +#define ip_defttl VS_IP_DATA->ip_defttl +#define icmpErrorLength VS_IP_DATA->icmpErrorLength +#define ip_protox VS_IP_DATA->ip_protox +#define in_ifaddrhashtbl VS_IP_DATA->in_ifaddrhashtbl +#define in_ifaddrhmask VS_IP_DATA->in_ifaddrhmask +#define icmperr_mcopy VS_IP_DATA->icmperr_mcopy + +#define _in_ifaddrhead VS_IP_DATA->_in_ifaddrhead +#define _ipstat VS_IP_DATA->_ipstat +#define ip_mrouter VS_IP_DATA->ip_mrouter + +/* external hooks from ip_input.c */ +#define _ipFilterHook VS_IP_DATA->ipFilterHook +#define _ipsecFilterHook VS_IP_DATA->ipsecFilterHook +#define _ipsecInput VS_IP_DATA->ipsecInput +#define proxyBroadcastHook VS_IP_DATA->proxyBroadcastHook +#define mCastRouteFwdHook VS_IP_DATA->mCastRouteFwdHook +#define _mCastRouteCmdHook VS_IP_DATA->_mCastRouteCmdHook + +#define SET_IPFILTERHOOK(foo) (VS_IP_DATA->ipFilterHook = foo) +#define SET_IPSECFILTERHOOK(foo) (VS_IP_DATA->ipsecFilterHook = foo) +#define SET_IPSECINPUT(foo) (VS_IP_DATA->ipsecInput = foo) +#define SET_PROXYBROADCASTHOOK(foo)(VS_IP_DATA->proxyBroadcastHook = foo) +#define SET_MCASTROUTEFWDHOOK(foo) (mCastRouteFwdHook = foo) + +/* and for backwards compatibility in ip_input.c */ +#define _func_ipsecFilterHook VS_IP_DATA->ipsecFilterHook +#define _func_ipsecInput VS_IP_DATA->ipsecInput + +/* from intrq.c (loopback) */ +#define ipintrq VS_IP_DATA->ipintrq +#define ipintrqJob VS_IP_DATA->ipintrqJob + +/* external hook from sizing.c */ +#define _ipsecSizing VS_IP_DATA->ipsecSizing +#define SET_IPSECSIZING(foo) (VS_IP_DATA->ipsecSizing = foo) + +/* definitions from ip_output.c */ +#define _ip_id VS_IP_DATA->_ip_id + +/* external hooks from ip_output.c */ +#define _ipsecOutput VS_IP_DATA->ipsecOutput +#define SET_IPSECOUTPUT(foo) (VS_IP_DATA->ipsecOutput = foo) + +/* definitions from raw_ip.c */ +#define ripcb VS_IP_DATA->ripcb +#define ripcbinfo VS_IP_DATA->ripcbinfo +#define rip_sendspace VS_IP_DATA->rip_sendspace +#define rip_recvspace VS_IP_DATA->rip_recvspace +#ifdef ROUTER_ALERT +#define ralcb_list VS_IP_DATA->_ralcb_list +#endif /* ROUTER_ALERT */ + +/* definitions from ipfw_var.c */ +#define ipfw_serial VS_IP_DATA->ipfw_serial +#define ipfw_preinput VS_IP_DATA->ipfw_preinput +#define ipfw_input VS_IP_DATA->ipfw_input +#define ipfw_forward VS_IP_DATA->ipfw_forward +#define ipfw_output VS_IP_DATA->ipfw_output +#define ipfw_call VS_IP_DATA->ipfw_call +#define ipfw_rate VS_IP_DATA->ipfw_rate +#define ipfw_types VS_IP_DATA->ipfw_types + +#endif /* __INCvsIph */ diff --git a/h/wrn/coreip/netinet/vsLib.h b/h/wrn/coreip/netinet/vsLib.h new file mode 100644 index 0000000..331137c --- /dev/null +++ b/h/wrn/coreip/netinet/vsLib.h @@ -0,0 +1,564 @@ +/* vsLib.h - virtual stack routines */ + +/* Copyright 2000 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01y,13aug04,vvv added vsStart() +01x,06aug04,spm cleanup virtual stack routine names +01w,27jul04,kc removed warnings from application startup routines with no + parameters: disabled type checking. +01v,09jun04,spm removed VIRTUAL_STACK to enable contents whenever included +01u,04apr03,wie revision after code review - rearranged VIRTUAL_STACK +01t,17feb03,wie added vsMgrDestructor, vsMgrInfo prototypes and new error codes +01s,27jan03,wie better support for init-failures added, workaround for not + working unload function of end-drivers added +01r,10jan03,wie vsNonCoreComponentRegister prototype added +01q,18nov02,kal vsLibInit() for -DVIRTUAL_STACK only +01p,15nov02,wie prototype for vsSo... removed, added new parameters for + vsDownToSocketsSend +01o,21oct02,wie new error codes added +01n,10oct02,wie added new prototype for vsSocketList() +01m,13sep02,wie renaming vsIdCheck +01l,12sep02,wie added prototype for vsStatusSet() +01k,10sep02,wie new stack component type added (VS_COMP) +01j,14aug02,wie preliminary version including partial support for automatic + vs creation and stack deletetion on demand +01i,04jul02,wie modifications for ACCORDION (see Virtual IP Addr Space Design + document 1.0 for all the details) +01h,29jul02,wie changes for Accordion +01c,11jul02,spm fixed modification history after automatic merge +01b,11jul02,wrs automatic merge from version 3 of Accordion Munich branch: + (xxjul02,wie initial development and design review changes) +01a,24jun02,spm automatic merge from version 1 of Accordion Munich branch: + (initial version of file copied from ver. 7 of tor3_x.synth + branch in /wind/river VOB: modhist 01g,13jan02,spm) +*/ + + +#ifndef __INCvsLibh +#define __INCvsLibh + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + VS_OK = OK, + VS_NON_SPECIFIC_ERR = ERROR, + + VS_SPECIFIC_INFO_START = 100, + VS_INFO_NO_MORE_DEVICES, + + VS_SPECIFIC_ERR_START = 1000, + VS_ERR_SEM_CREATE_FAILED, + VS_ERR_VSNUM_EXCEEDED, + VS_ERR_DUPLICATED_STACK_NAME, + VS_ERR_MEM_ALLOC_FOR_GLOBAL_DATA_FAILED, + VS_ERR_MEM_ALLOC_FOR_CORE_GLOBALS_FAILED, + VS_ERR_SC_LIST_MEM_ALLOC_FAILED, + VS_ERR_VSLIB_NOT_INITIALIZED, + VS_ERR_INVALID_VSID, + VS_ERR_NO_MATCH, + VS_ERR_INVALID_VSNUM, + VS_ERR_VS_DOES_NOT_EXIST, + VS_ERR_INVALID_FCT_PARAM, + VS_ERR_ACCESSING_TASK_VAR, + VS_ERR_CALL_WITH_NO_FCT_PTR, + VS_ERR_INVALID_SC_TYPE, + VS_ERR_MEM_ALLOC_FOR_SC_FAILED, + VS_ERR_SC_NOT_FOUND, + VS_ERR_TASK_VAR_ALRDY_EXIST, + VS_ERR_REGISTRATION_NOT_POSSIBLE, + VS_ERR_INIT_ALREADY_DONE, + VS_ERR_NON_OPT_SC_CANT_BE_DISABLED, + VS_ERR_INVALID_CFG_PARAMS_LEN, + VS_ERR_NO_CFG_PARAMS_AVAILABLE, + VS_ERR_INIT_FAILED, + VS_ERR_ADD_NEW_SOCK_ENTRY_FAILED, + VS_ERR_MGR_INIT_FAILED, + VS_ERR_STACK_IS_DOWN, + VS_ERR_SOCKET_IN_INVALID_CONTEXT, + VS_ERR_CAN_NOT_CREATE_MSG_QUEUE, + VS_ERR_CAN_NOT_CREATE_MGR_TASK, + VS_ERR_CAN_NOT_CREATE_SUBMGR_TASK, + VS_ERR_CAN_NOT_DELETE_SUBMGR_TASK, + VS_ERR_COMM_WITH_MGR_TASK_FAILED, + VS_ERR_STACK_IS_ALREADY_GOING_DOWN, + VS_ERR_STACK_IS_ALREADY_DOWN, + VS_ERR_DESTRUCTOR_FAILED, + VS_ERR_SOCKET_OPEN, + VS_ERR_MGR_TASK_TIMEOUT, + VS_ERR_CAN_NOT_DELETE_MGR_TASK, + VS_ERR_MGR_NOT_INACTIVE, + + VS_ERR_MAX + } VS_STATUS; + +/* States of a virtual stack instance */ +typedef enum { + VS_NOT_AVAILABLE, + /* the stack number refers to an empty entry in the vsTbl - */ + /* i.e. the stack was never created or has been deleted */ + VS_STARTS_UP = 100, + /* the virtual stack is currently in the initialization phase, */ + /* i.e. vsCreate has been already performed but not all the */ + /* remaining initialization work is done. */ + VS_RUNNING, + /* the virtual stack instance has been successfully initialized */ + /* and is at least ready to run */ + VS_DOWN_REQUESTED, + /* stack deletion was requested (after failure or on user */ + /* request). In this state all sockets have to be terminated */ + /* etc. */ + VS_GOES_DOWN, + /* stack components are shut down now - stack is not operating */ + /* anymore */ + VS_INIT_INCOMPL, + /* the state indicates that the initialization of SCs failed */ + /* it is only a temporary state, the stack instance has to be */ + /* deleted afterwards */ + VS_DEL_INCOMPLETE + /* the state indicates that the shutdown failed, manual */ + /* intervention might be needed. This entry is in this state */ + /* not reusable */ + } VS_STATUS_INFO; + + +/* Indications for optional and non-optional stack components (needed + for component registration) */ +typedef enum { + VS_SC_OPTIONAL = 1, + VS_SC_NON_OPTIONAL + } VS_SC_OPT; + +/* Indications for optional stack components (needed for component + registration) if enabled for a particular stack instance or not */ +typedef enum { + VS_SC_ENABLED = 1, + VS_SC_DISABLED + } VS_SC_STATE; + +/* Types of stack components */ +typedef enum { + VS_COMP, + VS_NONOPT_COMP, + VS_OPT_COMP, + VS_APPL, + VS_NON_CORE + } VS_TYPE; + +/* Type of the "cookie" delivered back after component registration) */ +typedef int VS_REG_ID; + +/* The virtual stack number (actually an index to the vsTbl) */ +typedef int VSNUM; + +typedef unsigned VS_INSTANCE_FLAGS; + +#define VIRTUAL_STACK_DELETE + +/* A mask isolate the vsnum part from the VSID */ +#define VSNUMMASK 0xFFF +#define VSNUM_INVALID_MASK 0x800 + +/* The maximum virtual stack number (determines also the size of vsTbl) */ +#define VSNUM_MAX 64 /* actually max+1 value! */ +#define VSFLAGS_MAX \ +((VSNUM_MAX+(sizeof(VS_INSTANCE_FLAGS)*8)-1)/(sizeof(VS_INSTANCE_FLAGS)*8)) + +#define VSID_MAX VSNUM_MAX + +#define VS_MGMT_STACK 0 + +typedef unsigned VSID; + + +#define VS_NAME_MAX 32 + +/* VS Layer. Things the VS system needs. */ +typedef struct vs_global_data_hdr{ + char name[VS_NAME_MAX+1]; /* Name of this virtual stack. */ + char *pName; + VSID vsid; /* for easier conversion for the new vsid */ + void *pVsMgrGlobals; + } VS_GLOBAL_DATA_HDR; + + +typedef struct vsScListEntry_s { + /* general virtual stack component infos */ + char *pVsScName; + VS_TYPE vsScType; + VS_INSTANCE_FLAGS vsScEnabledFlgs[VSFLAGS_MAX]; + + /* instance initialization related fields */ + STATUS (*pVsInstInitRtn)(void *); + void *pVsDefaultCfgParams; + unsigned vsDefaultCfgParamsLen; + void *pVsIndividualTmpCfgParams; + unsigned vsIndividualTmpCfgParamsLen; + VS_INSTANCE_FLAGS vsScInitExecFlgs[VSFLAGS_MAX]; + VS_INSTANCE_FLAGS vsScInitCurrentlyExecFlgs[VSFLAGS_MAX]; + int vsInstInitErrorCode; + VSID vsInstInitErrorCodeRelatedVsid; + + /* instance deletion related fields */ + STATUS (*pVsScDestructorRtn)(VSNUM vsnum); + VS_INSTANCE_FLAGS vsScLateDestrRegistrationFlgs[VSFLAGS_MAX]; + VS_INSTANCE_FLAGS vsScDestrExecFlgs[VSFLAGS_MAX]; + VS_INSTANCE_FLAGS vsScDestrCurrentlyExecFlgs[VSFLAGS_MAX]; + int vsInstDeleteErrorCode; + VSID vsInstDeleteErrorCodeRelatedVsid; + + } vsScListEntry_t; + +typedef vsScListEntry_t VS_SC_DESCRIPTOR; + +typedef struct { + BOOL VsDebEnabled; + unsigned VsDeleteTimeo; + unsigned VsSocketTimeo; + unsigned VsApplTimeo; + } vsMgrCfgPar_t; + +typedef vsMgrCfgPar_t VS_MGR_CFG_DATA; + +typedef struct { + unsigned VsInUse; + unsigned VsnumMax; + unsigned vsInstancesCreated; + unsigned vsInstancesDeleted; + unsigned StackCreationsFailed; + unsigned StackDeletionsFailed; + BOOL CreateInProgress; + BOOL DeleteInProgress; + } vsMgrInf_t; + +typedef vsMgrInf_t VS_MGR_INFO; + +IMPORT const unsigned vsNumMax; + +IMPORT int myStackNum; + +IMPORT STATUS (*pMuxDevUnload)(char *pName, int unit); + + +/* The following prototypes are only provided for backward compatibility */ +IMPORT STATUS virtualStackLibInit(); +IMPORT STATUS virtualStackCreate(const char* pName, VSID* pVSID); +IMPORT STATUS virtualStackDelete(VSID vsid); +IMPORT STATUS virtualStackIdGet(const char* pName, VSID* pVSID); +IMPORT void virtualStackShow(VSID vsid); +IMPORT void virtualStackListShow(void); +STATUS virtualStackNameTaskIdSet(const char* pName); +STATUS virtualStackNumTaskIdSet(int vsNum); +STATUS virtualStackIdCheck(); +STATUS virtualStackNameGet (char *pName, int vsid); +STATUS virtualStackNameSet (const char *pName, int vsid); +STATUS vsMakeStack(const char * vsName, int maxUnits); +STATUS virtualStackNumGet (VSID, int *); + +/* new prototypes - beginning with vs... */ + +VS_STATUS vsCreate + ( + const char * pName, /* Unique stack name, or NULL for default */ + VSID * pVID /* Buffer for storing virtual stack identifier */ + ); + +VS_STATUS vsDelete( VSID vsid); + + +VS_STATUS vsIdGet + ( + const char * pName, /* Stack name from virtualStackCreate routine */ + VSID * pVSID /* Storage for VSID associated with stack name */ + ); + +VS_STATUS vsNameGet + ( + char * pName, /* Buffer for the stack name (32 characters + EOS) */ + const VSNUM vsnum /* Virtual stack number */ + ); + +VS_STATUS vsShow + ( + const VSNUM vsnum /* Virtual stack number */ + ); + +VSNUM vsMaxNumGet + ( + void + ); + +VS_STATUS vsNumGet + ( + const VSID vsid, /* Virtual stack identifier from virtualStackCreate */ + VSNUM *vsnum /* Storage for virtual stack number */ + ); + +VS_STATUS vsNumConvert + ( + const VSNUM vsnum, /* virtual stack number (0 to VSNUM_MAX) */ + VSID *vsid /* Storage for Virtual stack identifier from virtualStackCreate */ + ); + +VS_STATUS vsListShow (void); + +VS_STATUS vsNameContextSet + ( + const char * pName /* Stack name from vsCreate routine */ + ); + +VS_STATUS vsIdContextSet + ( + const VSID vsid /* vsid from vsCreate routine */ + ); + +VS_STATUS vsMyStackNumSet + ( + const VSNUM vsnum /* Virtual stack number */ + ); + +VS_STATUS vsQuickContextSet + ( + const VSID vsid /* vsid from vsCreate routine */ + ); + +VS_STATUS vsIndexGet + ( + VSNUM *vsnum /* mem space for Virtual stack number */ + ); + +VS_STATUS vsNameSet + ( + const char * pName, /* Name for virtual stack (max 32 bytes) */ + const VSNUM vsnum /* Virtual stack number */ + ); + +VS_STATUS vsIndexCreate (void); + + +int vsExec + ( + int vsnum, /* Virtual stack number */ + int (*pFunc)(), /* Function to call */ + int arg1, /* First of 10 arguments for supplied function */ + int arg2, + int arg3, + int arg4, + int arg5, + int arg6, + int arg7, + int arg8, + int arg9, + int arg10); + +VS_STATUS vsNameVsnumAppend + ( + const char* basename, + int stackNum, + char* destString, + int maxLen + ); + + + +VS_STATUS vsComponentRegister + ( + VS_REG_ID *registrationReference, + const char *ComponentName, + const VS_SC_STATE enabledIndication, + const VS_SC_OPT optionIndication, + STATUS (*initRtn)(), + const size_t ConfigParamLen, + void *cfgParams, + STATUS (*destructorRtn)(VSNUM vsnum) + ); + +VS_STATUS vsNonCoreComponentRegister + ( + VS_REG_ID *registrationReference, /* registration reference */ + const char *NonCoreCompName, /* name of the component */ + const VS_SC_STATE enabledIndication, /* enabled for vsnum 0 indication */ + STATUS (*initRtn)(), /* pointer to instInit function */ + const size_t ConfigParamLen, /* size of default cfg parameters */ + void *cfgParams, /* pointer to default cfg params */ + STATUS (*destructorRtn)(VSNUM vsnum) /* pointer to destructor function */ + ); + +VS_STATUS vsApplicationRegister + ( + VS_REG_ID *registrationReference, + const char *ApplicationName, + const VS_SC_STATE enabledIndication, + STATUS (*initRtn)(), + const size_t ConfigParamLen, + void *cfgParams, + STATUS (*destructorRtn)(VSNUM vsnum) + ); + +VS_STATUS vsComponentStatusSet + ( + const VSNUM vsnum, + const VS_REG_ID registrationReference, + const VS_SC_STATE enabledIndication, + void *cfgParams + ); + +BOOL vsComponentStatusGet + ( + const VSNUM vsnum, + const VS_REG_ID registrationReference + ); + +VS_STATUS vsComponentGet + ( + const VS_REG_ID registrationReference, + VS_SC_DESCRIPTOR *SCdescriptor + ); + +VS_STATUS vsComponentShow + ( + const VS_REG_ID registrationReference + ); + +VS_STATUS vsComponentErrorShow + ( + const VS_REG_ID registrationReference + ); + +VS_STATUS vsScShortShow + ( + VSNUM vsnum, + BOOL DisabledOnly + ); + +VS_STATUS vsParamsGet + ( + const VS_REG_ID registrationReference, + void *pCfgParams, + size_t paramsLength + ); + +VS_STATUS vsComponentIdGet + ( + const char *Name, + VS_REG_ID *registrationReference + ); + +VS_STATUS vsInitRtnsCall + ( + const VSNUM vsnum, + const VS_TYPE ComponentType + ); + +VS_STATUS_INFO vsStatusGet + ( + void + ); + +void vsStatusShow + ( + VSID vsid + ); + + +VS_STATUS vsStart + ( + const VSNUM vsnum, + const VS_TYPE ComponentType + ); + +VS_STATUS vsStop + ( + const VSNUM vsnum, + VS_TYPE ComponentType + ); + + +int vsNumOfOpenSocketsGet + ( + void + ); + + +int vsDownToSocketsSend + ( + int SocketTimeout + ); + + +VS_STATUS vsMgrStackInstanceCreate + ( + const char *StackName, + void (*pUsrScStateChange)(const char *StackName, const VSNUM vsnum), + void (*pUsrNetworkDevAttach)(const char *StackName), + VSID *vsid + ); + + +VS_STATUS vsMgrStackInstanceDelete + ( + VSID vsid + ); + + +VS_STATUS vsMgrDestructor + ( + BOOL forced + ); + + +VS_STATUS vsMgrInfoGet + ( + VS_MGR_INFO *pInfo + ); + + +VS_STATUS vsStatusSet + ( + VS_STATUS_INFO vsStatus + ); + + +VS_STATUS vsSocketList + ( + void + ); + +VS_STATUS vsDevRestart + ( + char * DevName, + int Unit + ); + +VS_STATUS vsIfDetach(void); + +VSNUM vsNextGet + ( + void + ); + +VS_STATUS vsRegistrationStopSet + ( + BOOL value /* value, if TRUE, then registration is stopped, wehen FALSE + it is enabled again */ + ); + + + + STATUS vsMgrInit(VS_MGR_CFG_DATA *cfgData); + STATUS vsExampleInit(void); + STATUS vsDebInit(void); + STATUS vsOldInit(void); + STATUS vsShowInit(void); + + VS_STATUS vsLibInit (VS_MGR_CFG_DATA *cfgData); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvsLibh */ diff --git a/h/wrn/coreip/netinet/vsM2.h b/h/wrn/coreip/netinet/vsM2.h new file mode 100644 index 0000000..9d44fd1 --- /dev/null +++ b/h/wrn/coreip/netinet/vsM2.h @@ -0,0 +1,161 @@ +/* vsM2.h - virtual stack data for m2 libraries */ + +/* Copyright 2000 - 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01p,25jan05,sar Modify sysuptime to be based on 64 bit ticks +01o,19sep04,spm fixed modification history after previous checkin +01n,19sep04,spm updated virtual stack startup: removed packing/unpacking of + configuration parameters +01m,12aug04,kc VS data structure reorganization for IPv6 MIB2 variables. + Also added m2Ipv6Initialized bool to VS_M2_IPV6_IF. +01l,11aug04,niq VS data structure reorganization +01k,02apr04,spm fixed virtual stack build: updated for change to avlUintLib +01j,15mar04,rp merged from orion +01i,04nov03,rlm Ran batch header path update for header re-org. +01h,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01g,09dec02,ant added two definitions for VS_M2_IF_DATA: locals changed to + globals +01f,30aug02,ant locals renamed to priv_xxx +01e,27aug02,ism added m2Ipv6RouteTableSaved global +01d,26aug02,ism added IPv6 M2 global components +01c,26oct01,spm isolated virtual stack data structures (SPR #71092) +01b,13jul01,ann removed the mibStyle flag from vs_m2_if as we now maintain + the RFC2233 flag in the END object. +01a,29mar01,spm file creation: copied from version 01d of tor2_0.open_stack + branch (wpwr VOB) for unified code base +*/ + +#ifndef __INCvsm2h +#define __INCvsm2h + + +/* includes */ + +#include +#include +#ifdef INET6 +#include +#endif + +/* defines */ + +/* typedefs */ + +typedef struct vs_m2_sys + { + /* + * The system group is supported by the structure defined below. + * All changes to the system group are reflected in this structure. + */ + + M2_SYSTEM priv_m2SystemVars; + + /* This semaphore protects the m2SystemVars from multiple readers + * and writers */ + + SEM_ID priv_m2SystemSem; + + /* 64 bit ticks at start */ + UINT64 priv_startTicks; + } VS_M2_SYS; + +typedef struct vs_m2_if + { + AVLU_TREE pM2IfRoot; + AVLU_TREE * pM2IfRootPtr; + + /* Network I/F table (Allocated Dynamically) */ + M2_IFINDEX * pm2IfTable; + + /* Number of network interfaces */ + int m2IfCount; + int ifsInList; + + /* Pointer to trap routine supplied by the user */ + FUNCPTR pM2TrapRtn; + + /* Pointer to trap routine argument supplied by */ + void * pM2TrapRtnArg; + + /* last time a row was added/removed from the ifTable/ifXTable */ + ULONG m2IfTableLastChange; + + /* + * last time a row was added/removed from the ifStackTable or when the + * ifStackStatus was last changed + */ + ULONG m2IfStackLastChange; + + /* Semaphore used to protect the Interface group */ + SEM_ID m2InterfaceSem; + + /* + * Global variable used to keep the group startup time in 64 bit ticks. + * The functionality here is the same as the functionality + * provided in the module m2SysLib.c. It is duplicated to allow for + * both modules to exist independently. + */ + UINT64 priv_startTicks; /* 64 bit ticks at start */ + + /* Allow 32-bit counters to roll-over or stop at maximum? */ + + BOOL m2IfCounterOverflowFlag; + + /* Use larger RFC 2233 counters if available? */ + + BOOL m2If64BitCounters; + } VS_M2_IF; + +#ifdef INET6 +typedef struct vs_m2_ipv6_if + { + BOOL m2Ipv6Initialized; + int m2Ipv6Interfaces; + ULONG m2Ipv6IfTableLastChange; + int priv_m2Ipv6RouteTableSaved; + unsigned long priv_m2Ipv6RouteTableSize; + unsigned long priv_m2Ipv6NumRouteEntries; + unsigned long priv_m2Ipv6DiscardedRoutes; + M2_IPV6ROUTETBL * priv_m2Ipv6RouteTable; + SEM_ID priv_m2Ipv6RouteSem; + } VS_M2_IPV6_IF; +#endif + +/* macros */ + +#define VS_M2_SYS_DATA ((VS_M2_SYS *)vsTbl[myStackNum]->pM2SysGlobals) +#define VS_M2_IF_DATA (&(vsTbl[myStackNum]->m2IfGlobals)) + +#ifdef INET6 +#define VS_M2_IPV6_IF_DATA (&(vsTbl[myStackNum]->m2Ipv6IfGlobals)) +#endif + +/* Defines for the m2 layer globals */ + +/* m2SysLib.c */ + +/* m2IfLib.c */ + +#define m2IfCount VS_M2_IF_DATA->m2IfCount +#define ifsInList VS_M2_IF_DATA->ifsInList +#define pM2IfRoot VS_M2_IF_DATA->pM2IfRoot +#define pM2IfRootPtr VS_M2_IF_DATA->pM2IfRootPtr +#define pm2IfTable VS_M2_IF_DATA->pm2IfTable +#define pM2TrapRtn VS_M2_IF_DATA->pM2TrapRtn +#define pM2TrapRtnArg VS_M2_IF_DATA->pM2TrapRtnArg +#define m2IfTableLastChange VS_M2_IF_DATA->m2IfTableLastChange +#define m2IfStackLastChange VS_M2_IF_DATA->m2IfStackLastChange +#define m2InterfaceSem VS_M2_IF_DATA->m2InterfaceSem + +#ifdef INET6 +/* m2Ipv6IfLib.c */ + +#define m2Ipv6Interfaces VS_M2_IPV6_IF_DATA->m2Ipv6Interfaces +#define m2Ipv6IfTableLastChange VS_M2_IPV6_IF_DATA->m2Ipv6IfTableLastChange +#define m2Ipv6Initialized VS_M2_IPV6_IF_DATA->m2Ipv6Initialized +#endif + +#endif /* __INCvsm2h */ diff --git a/h/wrn/coreip/netinet/vsMcast.h b/h/wrn/coreip/netinet/vsMcast.h new file mode 100644 index 0000000..5ea26d8 --- /dev/null +++ b/h/wrn/coreip/netinet/vsMcast.h @@ -0,0 +1,184 @@ +/* vsMcast.h - virtual stack data for IGMP */ + +/* + * Copyright (c) 2000-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +01j,16jul05,dlk Remove tbf_reprocess_qHandle; it must be vif-specific, and + is now a member of struct tbf. +01i,27apr05,kch Move ip_mrouter definition to VS_IP. +01h,25feb05,niq add support for router alert +01g,31jan05,niq merge mroute changes from comp_wn_ipv6_multicast_interim-dev + branch (ver 1) +01f,19sep04,rae fix up +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,14jun01,spm added modification history entries for automatic merges +01c,14jun01,wrs automatic merge from version 2 of tor3_x.synth.irvine remote + branch: updated to use new multicast routing support +01b,17may01,wrs automatic merge from version 1 of tor3_x.synth.irvine remote + branch: new implementation for PIM support from BSD 4.4 Net/3 +01a,29mar01,spm file creation: copied from version 01a of tor2_0.open_stack + branch (wpwr VOB) for unified code base +*/ + +#ifndef __INCvsMcasth +#define __INCvsMcasth + + +/* includes */ +#include "netinet/ip_mroute.h" +#include "sys/callout.h" +#ifdef PIM +#include +#include +#endif + + +/* defines */ + +#define VS_IP_MROUTE_DATA ((VS_IP_MROUTE *)vsTbl[myStackNum]->pMrouteGlobals) + +typedef struct vs_ip_mroute +{ +/* + * Globals. All but ip_mrouter and ip_mrtproto could be static, + * except for netstat or debugging purposes. + */ + +#ifdef RSVP + u_int rsvpdebug; +#endif /* RSVP */ + + struct mrtstat _mrtstat; + struct mfc * mfctable[MFCTBLSIZ]; + struct vif viftable[MAXVIFS]; + u_char nexpire[MFCTBLSIZ]; + u_int mrtdebug ; /*debug level */ + struct callout_handle expire_upcalls_ch; + +/* + * Define the token bucket filter structures + * tbftable -> each vif has one of these for storing info + */ + struct tbf tbftable[MAXVIFS]; + void * tbf_reprocess_qHandle; +/* + * 'Interfaces' associated with decapsulator (so we can tell + * packets that went through it from ones that get reflected + * by a broken gateway). These interfaces are never linked into + * the system ifnet list & no routes point to them. I.e., packets + * can't be sent this way. They only exist as a placeholder for + * multicast source verification. + */ + struct ifnet multicast_decap_if[MAXVIFS]; + +/* + * Bandwidth meter variables and constants + */ +/* + * Pending timeouts are stored in a hash table, the key being the + * expiration time. Periodically, the entries are analysed and processed. + */ + + struct bw_meter * bw_meter_timers[BW_METER_BUCKETS]; + struct callout_handle bw_meter_ch; + +/* + * Pending upcalls are stored in a vector which is flushed when + * full, or periodically + */ + struct bw_upcall bw_upcalls[BW_UPCALLS_MAX]; + u_int bw_upcalls_n; /*# of pending upcalls */ + struct callout_handle bw_upcalls_ch; + +#ifdef PIM + struct pimstat _pimstat; + struct ifnet multicast_register_if; + vifi_t reg_vif_num; +#endif /* VIRTUAL_STACK */ + +/* + * Private variables. + */ + vifi_t numvifs; + int have_encap_tunnel; + +/* + * one-back cache used by ipip_input to locate a tunnel's vif + * given a datagram's src ip address. + */ + u_long last_encap_src; + struct vif * last_encap_vif; +/* + * whether or not special PIM assert processing is enabled. + */ + int pim_assert; + + uint32_t mrt_api_config; + +/* + * Static stack variables + */ + + int ipm_last_log; + struct route ipm_ro; + uint32_t ipm_last_tv_sec; +} VS_IP_MROUTE; + + +/* typedefs */ + +/* macros */ + + + +#define _mrtstat VS_IP_MROUTE_DATA->_mrtstat +#define _mfctable VS_IP_MROUTE_DATA->mfctable +#define _viftable VS_IP_MROUTE_DATA->viftable +#define nexpire VS_IP_MROUTE_DATA->nexpire +#define mrtdebug VS_IP_MROUTE_DATA->mrtdebug +#define rsvpdebug VS_IP_MROUTE_DATA->rsvpdebug +#define expire_upcalls_ch VS_IP_MROUTE_DATA->expire_upcalls_ch +#define tbftable VS_IP_MROUTE_DATA->tbftable +#define tbf_reprocess_qHandle VS_IP_MROUTE_DATA->tbf_reprocess_qHandle +#define multicast_decap_if VS_IP_MROUTE_DATA->multicast_decap_if +#define bw_meter_timers VS_IP_MROUTE_DATA->bw_meter_timers +#define bw_meter_ch VS_IP_MROUTE_DATA->bw_meter_ch +#define bw_upcalls VS_IP_MROUTE_DATA->bw_upcalls +#define bw_upcalls_n VS_IP_MROUTE_DATA->bw_upcalls_n +#define bw_upcalls_ch VS_IP_MROUTE_DATA->bw_upcalls_ch +#define _pimstat VS_IP_MROUTE_DATA->_pimstat +#define multicast_register_if VS_IP_MROUTE_DATA->multicast_register_if +#define reg_vif_num VS_IP_MROUTE_DATA->reg_vif_num + +/* + * Private variables. + */ +#define numvifs VS_IP_MROUTE_DATA->numvifs +#define have_encap_tunnel VS_IP_MROUTE_DATA->have_encap_tunnel +/* + * one-back cache used by ipip_input to locate a tunnel's vif + * given a datagram's src ip address. + */ +#define last_encap_src VS_IP_MROUTE_DATA->last_encap_src +#define last_encap_vif VS_IP_MROUTE_DATA->last_encap_vif + +/* + * whether or not special PIM assert processing is enabled. + */ +#define pim_assert VS_IP_MROUTE_DATA->pim_assert +#define mrt_api_config VS_IP_MROUTE_DATA->mrt_api_config +#define ipm_last_log VS_IP_MROUTE_DATA->ipm_last_log +#define ipm_ro VS_IP_MROUTE_DATA->ipm_ro +#define ipm_last_tv_sec VS_IP_MROUTE_DATA->ipm_last_tv_sec + +#endif /* __INCvsMcasth */ diff --git a/h/wrn/coreip/netinet/vsNetCore.h b/h/wrn/coreip/netinet/vsNetCore.h new file mode 100644 index 0000000..bde99e3 --- /dev/null +++ b/h/wrn/coreip/netinet/vsNetCore.h @@ -0,0 +1,118 @@ +/* vsNetCore.h - virtual stack data for core network variables */ + +/* Copyright 2000 - 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01k,19jan05,wap Add DS_MALLOC pool array +01j,04nov03,rlm Ran batch header path update for header re-org. +01i,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01h,24oct03,cdw update include statements post header re-org. +01g,17mar03,spm renamed allocatedMemHead to fix SLIST_* embedded macros +01f,17oct02,ism added allocatedMemHead, used in uipc_mbuf.c +01e,27aug02,kal fixed tornado location of socket.h +01d,26aug02,kal build party +01c,22aug02,kal ported to Accordion +01b,26oct01,spm isolated virtual stack data structures (SPR #71092); + renamed file and changed description to accurate meaning +01a,30mar01,spm file creation: copied from version 01a of tor2_0.open_stack + branch (wpwr VOB) for unified code base +*/ + +#ifndef __INCvsNetCoreh +#define __INCvsNetCoreh + + +/* includes */ + +#include /* for struct domain */ +#include /* for IP[6]_PROTO_NUM_MAX */ +#include /* for if.h */ +#include /* for struct protosw */ +#include /* for struct ip6protosw */ +#include /* Needed before ipProto.h */ +#include /* Needed before ipProto.h */ +#include /* for IP_DRV_CTRL */ +#include /* for NET_POOL */ +#include /* for SLIST_HEAD */ +#include /* for MAX_NUM_POOLS */ + +/* defines */ + +/* typedefs */ + +typedef struct vs_net_core + { + + /* Domain List */ + + struct domain * domains; /* uipc_domain.c */ + + /* inet[6]sw and associated variables */ + + struct ipprotosw inetsw [IP_PROTO_NUM_MAX]; /* in_proto.c */ + struct ip6protosw inet6sw [IP6_PROTO_NUM_MAX]; /* in6_proto.c */ + + int _protoSwIndex; /* Configlette usrNetInit.c */ + int _proto6SwIndex; /* Configlette usrNetInit.c */ + + /* ipProto Stuff */ + + IP_DRV_CTRL * ipDrvCtrl; /* Configlette usrNetIpProto.c */ + unsigned int ipMaxUnits; /* Configlette usrNetIpProto.c */ + + /* Network Semaphore (per-stack) */ + + int splTid; /* unixLib.c */ + SEM_ID splSemId; /* unixLib.c */ + + /* Mem management */ + + NET_POOL _netDpool; /* uipc_mbuf.c */ + NET_POOL _netSysPool; /* uipc_mbuf.c */ + + NET_POOL_ID _pNetDpool; /* uipc_mbuf.c */ + NET_POOL_ID _pNetSysPool; /* uipc_mbuf.c */ + + int max_linkhdr; /* uipc_mbuf.c */ + int max_protohdr; /* uipc_mbuf.c */ + int max_hdr; /* uipc_mbuf.c */ + int nmbclusters; /* uipc_mbuf.c */ + + void * _dsMallocMap [MAX_NUM_POOLS]; /* uipc_mbuf.c */ + + SLIST_HEAD (memListHead, memList) _allocatedMemHead; + + void *priv_pffasttimoHandle; /* uipc_domain.c */ + void *priv_pfslowtimoHandle; /* uipc_domain.c */ + + } VS_NET_CORE; + +/* XXX Can we make IP6 stuff ifdef INCLUDE_IPV6 / INET6 only ? */ + +/* macros */ + +#define VS_CORE_DATA ((VS_NET_CORE *)vsTbl[myStackNum]->pCoreGlobals) + +#define domains VS_CORE_DATA->domains +#define inetsw VS_CORE_DATA->inetsw +#define inet6sw VS_CORE_DATA->inet6sw +#define _protoSwIndex VS_CORE_DATA->_protoSwIndex +#define _proto6SwIndex VS_CORE_DATA->_proto6SwIndex +#define ipDrvCtrl VS_CORE_DATA->ipDrvCtrl +#define ipMaxUnits VS_CORE_DATA->ipMaxUnits +#define splTid VS_CORE_DATA->splTid +#define splSemId VS_CORE_DATA->splSemId +#define _netDpool VS_CORE_DATA->_netDpool +#define _netSysPool VS_CORE_DATA->_netSysPool +#define _pNetDpool VS_CORE_DATA->_pNetDpool +#define _pNetSysPool VS_CORE_DATA->_pNetSysPool +#define max_linkhdr VS_CORE_DATA->max_linkhdr +#define max_protohdr VS_CORE_DATA->max_protohdr +#define max_hdr VS_CORE_DATA->max_hdr +#define nmbclusters VS_CORE_DATA->nmbclusters +#define _dsMallocMap VS_CORE_DATA->_dsMallocMap + +#endif /* __INCvsNetCoreh */ + diff --git a/h/wrn/coreip/netinet/vsProxyArp.h b/h/wrn/coreip/netinet/vsProxyArp.h new file mode 100644 index 0000000..f242318 --- /dev/null +++ b/h/wrn/coreip/netinet/vsProxyArp.h @@ -0,0 +1,74 @@ +/* vsProxyArp.h - virtual stack data for Proxy Arp */ + +/* Copyright 2000 - 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,04nov03,rlm Ran batch header path update for header re-org. +01b,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01a,26jul02,vlk ported from Synth(Router 1.1) +*/ + +#ifndef __INCvsprxArph +#define __INCvsprxArph + +/* include */ +#include + +/* typedefs */ +typedef struct vsProxyArp +{ + /* defined in proxyArpLib.c */ + BOOL arpDebug; + BOOL proxyArpVerbose; + BOOL proxyBroadcastVerbose; + BOOL proxyBroadcastFwd; + BOOL arpRegister; + int clientTblSizeDefault; + int portTblSizeDefault; + + SEMAPHORE priv_proxySem; + SEM_ID priv_proxySemId; + int proxySemOptions; + HASH_ID priv_clientTbl; + LIST priv_proxyNetList; + SEMAPHORE priv_portTblSem; + SEM_ID priv_portTblSemId; + int portTblSemOptions; + HASH_ID priv_portTbl; + BOOL priv_proxyLibInitialized; + int priv_hashKeyArg; + + int clnt_tbl_sz; + int port_tbl_sz; + + char * proxyd_proxy_addr; + char * proxyd_main_addr; + + char priv_etherbuf[18]; +} VS_PROXY_ARP; + +/* macros for "non-private" global variables */ + +#define VS_PROXYARP_DATA ((VS_PROXY_ARP *)vsTbl[myStackNum]->pProxyArpGlobals) + +#define arpDebug VS_PROXYARP_DATA->arpDebug +#define proxyArpVerbose VS_PROXYARP_DATA->proxyArpVerbose +#define proxyBroadcastVerbose VS_PROXYARP_DATA->proxyBroadcastVerbose +#define proxyBroadcastFwd VS_PROXYARP_DATA->proxyBroadcastFwd +#define arpRegister VS_PROXYARP_DATA->arpRegister +#define clientTblSizeDefault VS_PROXYARP_DATA->clientTblSizeDefault +#define portTblSizeDefault VS_PROXYARP_DATA->portTblSizeDefault + +#define proxySemOptions VS_PROXYARP_DATA->proxySemOptions +#define portTblSemOptions VS_PROXYARP_DATA->portTblSemOptions + +#define clnt_tbl_sz VS_PROXYARP_DATA->clnt_tbl_sz +#define port_tbl_sz VS_PROXYARP_DATA->port_tbl_sz + +#define proxyd_proxy_addr VS_PROXYARP_DATA->proxyd_proxy_addr +#define proxyd_main_addr VS_PROXYARP_DATA->proxyd_main_addr + +#endif /* __INCvsprxArph */ + diff --git a/h/wrn/coreip/netinet/vsRadix.h b/h/wrn/coreip/netinet/vsRadix.h new file mode 100644 index 0000000..81dee07 --- /dev/null +++ b/h/wrn/coreip/netinet/vsRadix.h @@ -0,0 +1,65 @@ +/* vsRadix.h - virtual stack data for radix/routing storage */ + +/* Copyright 2000-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,07apr05,spm fixed memory leak from netmask storage (SPR #97721) +01h,17sep04,niq Code cleanup +01g,05nov03,cdw Removal of unnecessary _KERNEL guards. +01f,04nov03,rlm Ran batch header path update for header re-org. +01e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01d,17oct02,spm replaced private globals to permit multiple tree instances +01c,23sep02,niq Changes for Accordion's RTM +01b,21aug02,ant taken from synth +01a,21apr00,spm written +*/ + +#ifndef __INCvsRadixh +#define __INCvsRadixh + +#include +#include + +/* + * Unresolved globals: (should these be part of structure?) + * + * 1) netLib.c: _rtMissMsgHook (constant function pointer) + * 2) radix.c: struct radix_mask *rn_mkfreelist; (unused?) + * 3) radix.c: static char normal_chars[]; (constant read-only array) + * 4) route.c: struct sockaddr wildcard; (unused?) + */ + +/* typedefs */ + + /* + * Encapsulated (former) globals for routing storage. Structure elements + * marked XXX might be left global if any sharing between virtual stacks + * is permitted. (Some are read-only globals, others are constant timers). + */ + +typedef struct vs_radix_global_data + { + /* definitions from radix.c */ + int priv_numRibsInstantiated; +#ifdef RN_DEBUG + int rn_nodenum; + struct radix_node * rn_clist; + int rn_saveinfo; + int rn_debug; +#endif + } VS_RADIX; + +#define VS_RADIX_DATA ((VS_RADIX *)vsTbl[myStackNum]->pRadixGlobals) + +/* definitions from radix.c */ + +#ifdef RN_DEBUG +#define rn_nodenum VS_RADIX_DATA->rn_nodenum +#define rn_clist VS_RADIX_DATA->rn_clist +#define rn_saveinfo VS_RADIX_DATA->rn_saveinfo +#define rn_debug VS_RADIX_DATA->rn_debug +#endif + +#endif /* __INCvsRadixh */ diff --git a/h/wrn/coreip/netinet/vsRdisc.h b/h/wrn/coreip/netinet/vsRdisc.h new file mode 100644 index 0000000..23c5953 --- /dev/null +++ b/h/wrn/coreip/netinet/vsRdisc.h @@ -0,0 +1,68 @@ +/* vsRdisc.h - virtual stack data for Router Discovery */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,04nov03,rlm Ran batch header path update for header re-org. +01f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01e,27mar03,kal Code review modifications - terminateFlag -> runningFlag +01d,13dec02,kal Added variables for exit sock and task opts +01c,04nov02,kal Ported from Router Stack 1.1 to Accordion stack +01b,26oct01,spm isolated virtual stack data structures (SPR #71092) +01a,29mar01,spm file creation: copied from version 01b of tor2_0.open_stack + branch (wpwr VOB) for unified code base +*/ + +#ifndef __INCvsrdisch +#define __INCvsrdisch + + +/* includes */ + +#include +#include + +/* defines */ + +/* typedefs */ + +typedef struct vsRdisc + { + WDOG_ID wdId; + int rdiscSock; + int rdiscExitSock; + int rdiscExitPort; + BOOL runningFlag; + BOOL debugFlag; + int rdiscNumInterfaces; + struct ifrd *pIfDisc; + int MaxAdvertInterval; + int MinAdvertInterval; + SEM_ID rdiscIfSem; + int rdiscTaskPri; + int rdiscTaskOpts; + int rdiscTaskStackSize; + } VS_RDISC; + +/* macros */ + +#define VS_RDISC_DATA (vsRdiscTbl[myStackNum]) + +#define wdId VS_RDISC_DATA->wdId +#define rdiscSock VS_RDISC_DATA->rdiscSock +#define rdiscExitSock VS_RDISC_DATA->rdiscExitSock +#define rdiscExitPort VS_RDISC_DATA->rdiscExitPort +#define runningFlag VS_RDISC_DATA->runningFlag +#define debugFlag VS_RDISC_DATA->debugFlag +#define rdiscNumInterfaces VS_RDISC_DATA->rdiscNumInterfaces +#define pIfDisc VS_RDISC_DATA->pIfDisc +#define MaxAdvertInterval VS_RDISC_DATA->MaxAdvertInterval +#define MinAdvertInterval VS_RDISC_DATA->MinAdvertInterval +#define rdiscIfSem VS_RDISC_DATA->rdiscIfSem +#define rdiscTaskPri VS_RDISC_DATA->rdiscTaskPri +#define rdiscTaskOpts VS_RDISC_DATA->rdiscTaskOpts +#define rdiscTaskStackSize VS_RDISC_DATA->rdiscTaskStackSize + +#endif /* __INCvsrdisch */ diff --git a/h/wrn/coreip/netinet/vsRip.h b/h/wrn/coreip/netinet/vsRip.h new file mode 100644 index 0000000..e476549 --- /dev/null +++ b/h/wrn/coreip/netinet/vsRip.h @@ -0,0 +1,111 @@ +/* vsRip.h - virtual stack data for RIP */ + +/* Copyright 2000 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01k,13aug04,niq Code cleanup +01j,11aug04,niq Add capability to use class based netmask for routes to + external networks - Cisco style +01i,15mar04,rp merged from orion +01h,05nov03,cdw Removal of unnecessary _KERNEL guards. +01g,04nov03,rlm Ran batch header path update for header re-org. +01f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01e,20mar03,hgo use IMPORT instead of extern, added priv_badfrom(2) +01d,05sep02,hgo own vsRipTbl +01c,17jul02,hgo copied from Router 1.1 and changed header file paths +01b,01aug02,spm fixed modification history after automatic merge +01a,18jul02,wrs automatic merge from version 1 of Accordion Munich branch: + (copied from Router Stack release: 01c,26oct01,spm) +*/ + +#ifndef __INCvsRiph +#define __INCvsRiph + +#include /* for MIB structure definitions */ +#include /* for rthash structure definition */ +#include /* for rip_globals structure definition */ + +/* + * NOTE: This include file (directly and indirectly) redefines commonly used + * structure elements (such as rt_flags) which will prevent source code + * outside the rip directory from compiling. Therefore it is excluded from the + * vsData.h include file and is not referenced outside of the rip directory. + */ + +#define MAXPACKETSIZE 512 /* From rip/ripLib.h */ + +/* + * Unresolved globals: (should these be part of structure?): + * 1) afswitch[] (constant list of AF_INET specific function pointers) + * 2) af_max (constant size of switch array) + * 3) inet_default (constant template for sockaddr_in structure) + */ + +/* typedefs */ + + /* + * Encapsulated (former) globals for RIP. + */ + +typedef struct vsRip + { + /* definitions from rip/ripLib.c */ + + int routedDebug; + struct rip_globals ripState; + SEM_ID ripLockSem; + BOOL ripFilterFlag; + LIST ripIfExcludeList; + int priv_ripTaskPriority; + int priv_ripTaskOptions; + int priv_ripTaskStackSize; + int priv_ripTimerTaskPriority; + int priv_ripTimerTaskOptions; + int priv_ripTimerTaskStackSize; + ULONG priv_ripTimeSeed; + BOOL priv_ripInitFlag; + BOOL ripUseClassBasedNetmask; + + /* definitions from rip/startup.c */ + + struct interface * ripIfNet; + struct interface ** ifnext; + int ripFoundloopback; + struct sockaddr priv_loopaddr; + struct rt_addrinfo priv_info; + + /* definitions from rip/tables.c */ + + struct sockaddr priv_wildcard; + + /* definitions from rip/input.c */ + + struct sockaddr priv_badfrom; + struct sockaddr priv_badfrom2; + + /* definitions from rip/table.h */ + + struct rthash nethash[ROUTEHASHSIZ]; + struct rthash hosthash[ROUTEHASHSIZ]; + } VS_RIP; + +IMPORT VS_RIP *vsRipTbl[]; + +/* macros */ + +#define VS_RIP_DATA (vsRipTbl[myStackNum]) + +#define routedDebug VS_RIP_DATA->routedDebug +#define ripState VS_RIP_DATA->ripState +#define ripLockSem VS_RIP_DATA->ripLockSem +#define ripFilterFlag VS_RIP_DATA->ripFilterFlag +#define ripIfExcludeList VS_RIP_DATA->ripIfExcludeList +#define ripIfNet VS_RIP_DATA->ripIfNet +#define ifnext VS_RIP_DATA->ifnext +#define ripFoundloopback VS_RIP_DATA->ripFoundloopback +#define nethash VS_RIP_DATA->nethash +#define hosthash VS_RIP_DATA->hosthash +#define ripUseClassBasedNetmask VS_RIP_DATA->ripUseClassBasedNetmask +#endif /* __INCvsRiph */ diff --git a/h/wrn/coreip/netinet/vsShow.h b/h/wrn/coreip/netinet/vsShow.h new file mode 100644 index 0000000..89c5122 --- /dev/null +++ b/h/wrn/coreip/netinet/vsShow.h @@ -0,0 +1,56 @@ +/* vsShow.h - virtual stack data for show routines */ + +/* Copyright 2000 - 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,11aug04,niq VS data structure reorganization +01f,05nov03,cdw Removal of unnecessary _KERNEL guards. +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01c,19sep02,spm automatic merge from version 3 of Accordion Munich branch: + (bookkeeping only: no changes). +01b,17sep02,syy Merge from version 2 of Accordion Munich branch: + (changes for stack component registration, 01b,04jul02,hgo) +01a,11jul02,spm automatic merge from version 1 of Accordion Munich branch: + (copied from Router Stack release: 01b,26oct01,spm) +*/ + +#ifndef __INCvsshowh +#define __INCvsshowh + + +/* includes */ + +#include + +/* Encapsulated (former) globals for UDP show. */ + +typedef struct vsUdpShow + { + struct inpcbhead *_pUdpPcbHead; + } VS_UDPSHOW; + + +/* Encapsulated (former) globals for TCP show. */ + +typedef struct vsTcpShow + { + struct inpcbhead *_pTcpPcbHead; + } VS_TCPSHOW; + +/* defines */ + +/* macros for "non-private" global variables */ + +#define VS_UDPSHOW_DATA (&(vsTbl[myStackNum]->udpShowGlobals)) + +#define _pUdpPcbHead VS_UDPSHOW_DATA->_pUdpPcbHead + + +#define VS_TCPSHOW_DATA (&(vsTbl[myStackNum]->tcpShowGlobals)) + +#define _pTcpPcbHead VS_TCPSHOW_DATA->_pTcpPcbHead + +#endif /* __INCvsshowh */ diff --git a/h/wrn/coreip/netinet/vsTcp.h b/h/wrn/coreip/netinet/vsTcp.h new file mode 100644 index 0000000..ba0e807 --- /dev/null +++ b/h/wrn/coreip/netinet/vsTcp.h @@ -0,0 +1,181 @@ +/* vsTcp.h - virtual stack data for TCP */ + +/* Copyright 2000 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,11aug05,dlk Disable TTCP. +01j,13sep04,vvv renamed path_mtu_discovery to fix Sysctl/virtual stack + incompatibility (SPR #91565) +01i,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01h,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01g,05nov03,cdw Removal of unnecessary _KERNEL guards. +01f,04nov03,rlm Ran batch header path update for header re-org. +01e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01d,07mar03,spm fixed VS support after merge from CLARINET-1_1-KAME-UPDATE +01c,19sep02,hgo removed #ifdef's from VS_TCP +01b,17sep02,syy Merge from version 2 of Accordion Munich branch: + (modifications for IPv4/6 design, 01b,21jun02,hgo) +01a,11jul02,spm automatic merge from version 1 of Accordion Munich branch: + (copied from Router Stack release: 01b,26oct01,spm) +*/ + +#ifndef __INCvsTcph +#define __INCvsTcph + +/* + * Remaining globals: shared between stacks (not part of virtual structure). + * + * 1) tcpstates (constant list of possible states) + * 2) tanames (constant list of names of log events for debugging) + * 3) tcptimers (constant list of names of TCP timers for debugging) + * 4) prurequests (constant list of names of socket events for debugging) + * 5) tcp_outflags (constant list of per-state flags for outgoing segments) + * 6) tcp_backoff (constant list of values for backoff retransmit intervals) + * 7) tcp_totbackoff (sum of values from tcp_backoff list) + * 8) tcp_syn_backoff + * 9) tcp_usrreqs + * 10) tcp6_usrreqs + * + */ + +/* includes */ + +#include /* for TCP_NDEBUG and tcp_debug structure */ + +/* typedefs */ + + /* Encapsulated (former) globals for TCP. */ + +typedef struct vsTcp + { + /* defined in tcp_debug.c */ + + int tcpDebugCons; /* Display TCP trace output? */ + BOOL tcpDebugConsVerbose; /* Use verbose form? */ + + struct tcp_debug _priv_tcp_debug[TCP_NDEBUG];/* Log of trace records */ + int _priv_tcp_debx; /* Count of trace records */ + int tcp_debug_valid; /* High water mark of trace records */ + /* defined in tcp_input.c */ + + u_char _tcp_saveipgen[40]; + struct tcphdr _tcp_savetcp; + int _priv_tcprexmtthresh; +#ifdef TTCP + tcp_cc _tcp_ccgen; +#endif + struct tcpstat _tcpStat; /* TCP statistics */ + int _priv_tcp_log_in_vain; /* log all incoming TCP connections */ + int _priv_tcp_blackhole; /* do not send RST when dropping refused + connections */ + int _tcp_delack_enabled; /* delay ACK to try and piggyback it onto + the packet */ + int _priv_drop_synfin; /* drop TCP packets with SYN+FIN set */ + long _tcpOutResets; /* MIB-II packet counter */ + struct inpcbhead _tcb; /* queue of active tcpcb's */ + struct inpcbinfo _tcbinfo; + TCP_REASS_INFO _tcp_reass_info; + + /* defined in tcp_output.c */ + + int pmtu_discovery; /* enable path MTU discovery */ + int _ss_fltsz; /* slow start flight size */ + int _ss_fltsz_local; /* slow start flight size for local + networks */ + int _tcp_do_newreno; /* enable NewReno Algorithms */ + + /* defined in tcp_subr.c */ + + int _tcp_mssdflt; /* default TCP maximum segment size */ + int _tcp_v6mssdflt; + int _priv_tcp_do_rfc1323; /* enable RFC1323 (high performance) TCP + extensions */ +#ifdef TTCP + int _priv_tcp_do_rfc1644; /* enable RFC1644 (TTCP) extensions */ +#endif /* TTCP */ + int _priv_tcp_tcbhashsize; /* size of TCP control-block hashtable */ + int _priv_do_tcpdrain; /* enable tcp_drain routine for extra help + when low on mbufs */ + int _priv_icmp_may_rst; /* certain ICMP unreachable message may abort + connections in SYN_SENT */ + int tcp_isn_reseed_interval; + + /* TCP bandwidth limiting values. */ + + int tcp_inflight_enable; + int tcp_inflight_debug; + int tcp_inflight_min; + int tcp_inflight_max; + + + /* defined in tcp_timer.c */ + + int _tcp_keepinit; + int _tcp_keepidle; + int _tcp_keepintvl; + int _tcp_delacktime; /* time before a delayed ACK is sent */ + int _tcp_msl; /* maximum segment life time */ + int tcp_rexmit_min; + int tcp_rexmit_slop; + int _priv_always_keepalive; /* assume SO_KEEPALIVE on all TCP connections */ + int _priv_tcp_keepcnt; + + int _tcp_maxpersistidle; + int _tcp_maxidle; + + /* defined in tcp_usrreq.c */ + + u_long _tcp_sendspace; /* maximum outgoing TCP datagram size */ + u_long _tcp_recvspace; /* maximum incoming TCP datagram size */ + + /* defined in hooksinit.c */ + + VOIDFUNCPTR __func_tcp_drain; + } VS_TCP; + +/* macros for "non-private" global variables */ + +#define VS_TCP_DATA ((VS_TCP *)vsTbl[myStackNum]->pTcpGlobals) + +#define tcp_saveipgen VS_TCP_DATA->_tcp_saveipgen +#define tcp_savetcp VS_TCP_DATA->_tcp_savetcp +#define tcpStat VS_TCP_DATA->_tcpStat +#define tcp_delack_enabled VS_TCP_DATA->_tcp_delack_enabled +#define tcpOutResets VS_TCP_DATA->_tcpOutResets +#ifdef TTCP +#define tcp_ccgen VS_TCP_DATA->_tcp_ccgen +#define tcp_do_rfc1644 VS_TCP_DATA->_priv_tcp_do_rfc1644 +#endif +#define tcp_do_rfc1323 VS_TCP_DATA->_priv_tcp_do_rfc1323 +#define tcb VS_TCP_DATA->_tcb +#define tcbinfo VS_TCP_DATA->_tcbinfo +#define tcp_reass_info VS_TCP_DATA->_tcp_reass_info + +#define ss_fltsz VS_TCP_DATA->_ss_fltsz +#define ss_fltsz_local VS_TCP_DATA->_ss_fltsz_local +#define pmtu_discovery VS_TCP_DATA->pmtu_discovery +#define tcp_do_newreno VS_TCP_DATA->_tcp_do_newreno + +#define tcp_mssdflt VS_TCP_DATA->_tcp_mssdflt +#define tcp_v6mssdflt VS_TCP_DATA->_tcp_v6mssdflt + +#define tcp_keepinit VS_TCP_DATA->_tcp_keepinit +#define tcp_keepidle VS_TCP_DATA->_tcp_keepidle +#define tcp_keepintvl VS_TCP_DATA->_tcp_keepintvl +#define tcp_delacktime VS_TCP_DATA->_tcp_delacktime +#define tcp_msl VS_TCP_DATA->_tcp_msl +#define tcp_rexmit_min VS_TCP_DATA->tcp_rexmit_min +#define tcp_rexmit_slop VS_TCP_DATA->tcp_rexmit_slop + +#define tcp_maxpersistidle VS_TCP_DATA->_tcp_maxpersistidle +#define tcp_maxidle VS_TCP_DATA->_tcp_maxidle + +#define tcp_sendspace VS_TCP_DATA->_tcp_sendspace +#define tcp_recvspace VS_TCP_DATA->_tcp_recvspace + +#define _func_tcp_drain VS_TCP_DATA->__func_tcp_drain + +#endif /* __INCvsTcph */ diff --git a/h/wrn/coreip/netinet/vsUdp.h b/h/wrn/coreip/netinet/vsUdp.h new file mode 100644 index 0000000..d3c6172 --- /dev/null +++ b/h/wrn/coreip/netinet/vsUdp.h @@ -0,0 +1,69 @@ +/* vsUdp.h - virtual stack data for UDP */ + +/* Copyright 2000 - 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,05nov03,cdw Removal of unnecessary _KERNEL guards. +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01c,19sep02,hgo removed #ifdef's from VS_UDP +01b,17sep02,syy Merge from version 2 of Accordion Munich branch: + (modifications for IPv4/6 design: 01b,21jun02,hgo) +01a,11jul02,spm automatic merge from version 1 of Accordion Munich branch: + (copied from Router Stack release: 01b,26oct01,spm) +*/ + +#ifndef __INCvsUdph +#define __INCvsUdph + +/* + * Remaining globals: shared between stacks (not part of virtual structure). + * + * 1) udp_usrreqs + * + */ + +/* includes */ +#include +#include +#include + +/* typedefs */ + + /* Encapsulated (former) globals for UDP. */ + +typedef struct vsUdp + { + /* defined in udp_usrreq.c */ + + int _udpcksum; /* UDP protocol implementation. + * Per RFC 768, August, 1980 */ + int _udp_log_in_vain; + int _priv_udp_blackhole; + struct inpcbhead _udb; + struct inpcbinfo _udbinfo; + struct udpstat _udpStat; + struct sockaddr_in _priv_udp_in; +#ifdef INET6 + struct udp_in6 _priv_udp_in6; + struct udp_ip6 _priv_udp_ip6; +#endif + u_long _udp_sendspace; + u_long _udp_recvspace; + } VS_UDP; + +/* macros for "non-private" global variables */ + +#define VS_UDP_DATA ((VS_UDP *)vsTbl[myStackNum]->pUdpGlobals) + +#define udpcksum VS_UDP_DATA->_udpcksum +#define udp_log_in_vain VS_UDP_DATA->_udp_log_in_vain +#define udb VS_UDP_DATA->_udb +#define udbinfo VS_UDP_DATA->_udbinfo +#define udpStat VS_UDP_DATA->_udpStat +#define udp_sendspace VS_UDP_DATA->_udp_sendspace +#define udp_recvspace VS_UDP_DATA->_udp_recvspace + +#endif /* __INCvsUdph */ diff --git a/h/wrn/coreip/netinet6/icmp6.h b/h/wrn/coreip/netinet6/icmp6.h new file mode 100644 index 0000000..319418b --- /dev/null +++ b/h/wrn/coreip/netinet6/icmp6.h @@ -0,0 +1,1011 @@ +/* icmp6.h - ICMPv6 header file */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* $KAME: icmp6.h,v 1.97 2005/04/01 07:31:01 suz Exp $ */ +/* $KAME: icmp6.h,v 1.94 2004/07/09 14:13:59 suz Exp $ */ +/* $FreeBSD: src/sys/netinet/icmp6.h,v 1.2.2.5 2002/06/29 18:31:11 ume Exp $ */ +/* $KAME: icmp6.h,v 1.46 2001/04/27 15:09:48 itojun Exp $ */ + +/* + * Copyright (c) 2002 INRIA. All rights reserved. + * + * Implementation of Multicast Listener Discovery, Version 2. + * Developed by Hitoshi Asaeda, INRIA, February 2002. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of INRIA nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93 + */ + +/* +modification history +-------------------- +01l,19jun05,dlk Modify prototype for icmp6_mtudisc_update() (SPR #110450). +01k,30may05,dlk Avoid compiler warnings and improve efficiency in kernel + versions of ICMP6_FILTER_SETBLOCKALL/SETPASSALL. +01j,09may05,rp merged from kame v1.97 +01i,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +01h,07feb05,vvv _KERNEL cleanup +01g,14jan05,vvv osdep.h cleanup +01f,20nov03,niq Remove copyright_wrs.h file inclusion +01e,07aug03,nee Merging from ACCORDION_BASE6_MERGE_BASELINE label in + Accordion to Base6 +01d,29apr03,syy Added #ifdef for __cplusplus +01c,01feb03,pas merge from FreeBSD 4.7 - changed MLD6* to MLD* +01b,23oct02,ppp removed __attribute__((__packed__)) from some of the + structures in order to fix alignment issues with some of + the architectures such as mips and sh +01a,06sep01,qli 1st round of porting and compiles +*/ + +#ifndef _NETINET_ICMP6_H_ +#define _NETINET_ICMP6_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define ICMPV6_PLD_MAXLEN 1232 /* IPV6_MMTU - sizeof(struct ip6_hdr) + - sizeof(struct icmp6_hdr) */ + +struct icmp6_hdr { + u_int8_t icmp6_type; /* type field */ + u_int8_t icmp6_code; /* code field */ + u_int16_t icmp6_cksum; /* checksum field */ + union { + u_int32_t icmp6_un_data32[1]; /* type-specific field */ + u_int16_t icmp6_un_data16[2]; /* type-specific field */ + u_int8_t icmp6_un_data8[4]; /* type-specific field */ + } icmp6_dataun; +}; + +#define icmp6_data32 icmp6_dataun.icmp6_un_data32 +#define icmp6_data16 icmp6_dataun.icmp6_un_data16 +#define icmp6_data8 icmp6_dataun.icmp6_un_data8 +#define icmp6_pptr icmp6_data32[0] /* parameter prob */ +#define icmp6_mtu icmp6_data32[0] /* packet too big */ +#define icmp6_id icmp6_data16[0] /* echo request/reply */ +#define icmp6_seq icmp6_data16[1] /* echo request/reply */ +#define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */ + +#define ICMP6_DST_UNREACH 1 /* dest unreachable, codes: */ +#define ICMP6_PACKET_TOO_BIG 2 /* packet too big */ +#define ICMP6_TIME_EXCEEDED 3 /* time exceeded, code: */ +#define ICMP6_PARAM_PROB 4 /* ip6 header bad */ + +#define ICMP6_ECHO_REQUEST 128 /* echo service */ +#define ICMP6_ECHO_REPLY 129 /* echo reply */ +#define MLD_LISTENER_QUERY 130 /* multicast listener query */ +#define MLD_LISTENER_REPORT 131 /* multicast listener report */ +#define MLD_LISTENER_DONE 132 /* multicast listener done */ +#define MLD_LISTENER_REDUCTION MLD_LISTENER_DONE /* RFC3542 definition */ + +/* RFC2292 decls */ +#define ICMP6_MEMBERSHIP_QUERY 130 /* group membership query */ +#define ICMP6_MEMBERSHIP_REPORT 131 /* group membership report */ +#define ICMP6_MEMBERSHIP_REDUCTION 132 /* group membership termination */ + +/* the followings are for backward compatibility to old KAME apps. */ + +#define MLD6_LISTENER_QUERY MLD_LISTENER_QUERY +#define MLD6_LISTENER_REPORT MLD_LISTENER_REPORT +#define MLD6_LISTENER_DONE MLD_LISTENER_DONE + +#define ND_ROUTER_SOLICIT 133 /* router solicitation */ +#define ND_ROUTER_ADVERT 134 /* router advertisement */ +#define ND_NEIGHBOR_SOLICIT 135 /* neighbor solicitation */ +#define ND_NEIGHBOR_ADVERT 136 /* neighbor advertisement */ +#define ND_REDIRECT 137 /* redirect */ + +#define ICMP6_ROUTER_RENUMBERING 138 /* router renumbering */ + +#define ICMP6_WRUREQUEST 139 /* who are you request */ +#define ICMP6_WRUREPLY 140 /* who are you reply */ +#define ICMP6_FQDN_QUERY 139 /* FQDN query */ +#define ICMP6_FQDN_REPLY 140 /* FQDN reply */ +#define ICMP6_NI_QUERY 139 /* node information request */ +#define ICMP6_NI_REPLY 140 /* node information reply */ + +/* The belows are not yet defined in 2292bis. They will be renamed */ +#define IND_SOLICIT 141 /* inverse neighbor solicitation */ +#define IND_ADVERT 142 /* inverse neighbor advertisement */ +#define MLDV2_LISTENER_REPORT 143 /* MLDv2 report */ + +/* Folloing numbers are defined in the mobile-ip draft. */ +#define MIP6_HA_DISCOVERY_REQUEST 144 /* home agent address discovery request */ +#define MIP6_HA_DISCOVERY_REPLY 145 /* home agent address discovery reply */ +#define MIP6_PREFIX_SOLICIT 146 /* mobile prefix solicitation */ +#define MIP6_PREFIX_ADVERT 147 /* mobile prefix advertisement */ + +/* The definitions below are experimental. TBA */ +#define MLD_MTRACE_RESP 200 /* mtrace resp (to sender) */ +#define MLD_MTRACE 201 /* mtrace messages */ + +/* backward compatibility for applications using old macro names */ +#define MLD6_MTRACE_RESP MLD_MTRACE_RESP +#define MLD6_MTRACE MLD_MTRACE +#define MLD6V2_LISTENER_REPORT MLDV2_LISTENER_REPORT + +#define ICMP6_MAXTYPE 201 + +#define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */ +#define ICMP6_DST_UNREACH_ADMIN 1 /* administratively prohibited */ +#define ICMP6_DST_UNREACH_NOTNEIGHBOR 2 /* not a neighbor(obsolete) */ +#define ICMP6_DST_UNREACH_BEYONDSCOPE 2 /* beyond scope of source address */ +#define ICMP6_DST_UNREACH_ADDR 3 /* address unreachable */ +#define ICMP6_DST_UNREACH_NOPORT 4 /* port unreachable */ + +#define ICMP6_TIME_EXCEED_TRANSIT 0 /* ttl==0 in transit */ +#define ICMP6_TIME_EXCEED_REASSEMBLY 1 /* ttl==0 in reass */ + +#define ICMP6_PARAMPROB_HEADER 0 /* erroneous header field */ +#define ICMP6_PARAMPROB_NEXTHEADER 1 /* unrecognized next header */ +#define ICMP6_PARAMPROB_OPTION 2 /* unrecognized option */ + +#define ICMP6_INFOMSG_MASK 0x80 /* all informational messages */ + +#define ICMP6_NI_SUBJ_IPV6 0 /* Query Subject is an IPv6 address */ +#define ICMP6_NI_SUBJ_FQDN 1 /* Query Subject is a Domain name */ +#define ICMP6_NI_SUBJ_IPV4 2 /* Query Subject is an IPv4 address */ + +#define ICMP6_NI_SUCCESS 0 /* node information successful reply */ +#define ICMP6_NI_REFUSED 1 /* node information request is refused */ +#define ICMP6_NI_UNKNOWN 2 /* unknown Qtype */ + +#define ICMP6_ROUTER_RENUMBERING_COMMAND 0 /* rr command */ +#define ICMP6_ROUTER_RENUMBERING_RESULT 1 /* rr result */ +#define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET 255 /* rr seq num reset */ + +/* Used in kernel only */ +#define ND_REDIRECT_ONLINK 0 /* redirect to an on-link node */ +#define ND_REDIRECT_ROUTER 1 /* redirect to a better router */ + +/* + * Multicast Listener Discovery + */ +struct mld_hdr { + struct icmp6_hdr mld_icmp6_hdr; + struct in6_addr mld_addr; /* multicast address */ +}; + +/* definitions to provide backward compatibility to old KAME applications */ + +#define mld6_hdr mld_hdr +#define mld6_type mld_type +#define mld6_code mld_code +#define mld6_cksum mld_cksum +#define mld6_maxdelay mld_maxdelay +#define mld6_reserved mld_reserved +#define mld6_addr mld_addr + +/* shortcut macro definitions */ +#define mld_type mld_icmp6_hdr.icmp6_type +#define mld_code mld_icmp6_hdr.icmp6_code +#define mld_cksum mld_icmp6_hdr.icmp6_cksum +#define mld_maxdelay mld_icmp6_hdr.icmp6_data16[0] +#define mld_reserved mld_icmp6_hdr.icmp6_data16[1] + +/* + * Multicast Listener Discovery Version 2 + */ +struct mldv2_hdr { + struct icmp6_hdr mld_icmp6_hdr; + struct in6_addr mld_addr; /* multicast address */ + u_int8_t mld_rtval; /* Reserved, S Flag and QRV */ + u_int8_t mld_qqi; /* querier's query interval (QQI) */ + u_int16_t mld_numsrc; /* number of sources (0 for general */ + /* and group-specific queries) */ + struct in6_addr mld_src[1]; /* source address list */ +}; + +#define MLD_MRC_EXP(x) ((ntohs(x) >> 12) & 0x0007) +#define MLD_MRC_MANT(x) (ntohs(x) & 0x0fff) +#define MLD_QQIC_EXP(x) (((x) >> 4) & 0x07) +#define MLD_QQIC_MANT(x) ((x) & 0x0f) +#define MLD_QRESV(x) (((x) >> 4) & 0x0f) +#define MLD_SFLAG(x) (((x) >> 3) & 0x01) +#define MLD_QRV(x) ((x) & 0x07) /* querier's robustness variable */ + +/* + * MLDv2 Membership Report Message header. + */ +struct mld_report_hdr { + struct icmp6_hdr mld_icmp6_hdr; /* version & type of MLD message */ +}; + +/* shortcut macro definition */ +#define mld_grpnum mld_icmp6_hdr.icmp6_data16[1] + +/* + * MLDv2 Group Record header. + */ +struct mld_group_record_hdr { + u_int8_t record_type; /* record types for membership report */ + u_int8_t auxlen; /* aux data length (must be zero) */ + u_int16_t numsrc; /* number of sources */ + struct in6_addr group; /* group address */ + struct in6_addr src[1]; /* source address list */ +}; + +#define MLD_V1_QUERY 0 +#define MLD_V2_GENERAL_QUERY 1 +#define MLD_V2_GROUP_QUERY 2 +#define MLD_V2_GROUP_SOURCE_QUERY 3 + +#define MLD_MINLEN 24 +#define MLD_V2_QUERY_MINLEN 28 + + +/* + * Group Record Types in the MLD Membership Report + */ +#define MODE_IS_INCLUDE 1 +#define MODE_IS_EXCLUDE 2 +#define CHANGE_TO_INCLUDE_MODE 3 +#define CHANGE_TO_EXCLUDE_MODE 4 +#define ALLOW_NEW_SOURCES 5 +#define BLOCK_OLD_SOURCES 6 + +/* + * Neighbor Discovery + */ + +struct nd_router_solicit { /* router solicitation */ + struct icmp6_hdr nd_rs_hdr; + /* could be followed by options */ +}; + +#define nd_rs_type nd_rs_hdr.icmp6_type +#define nd_rs_code nd_rs_hdr.icmp6_code +#define nd_rs_cksum nd_rs_hdr.icmp6_cksum +#define nd_rs_reserved nd_rs_hdr.icmp6_data32[0] + +struct nd_router_advert { /* router advertisement */ + struct icmp6_hdr nd_ra_hdr; + u_int32_t nd_ra_reachable; /* reachable time */ + u_int32_t nd_ra_retransmit; /* retransmit timer */ + /* could be followed by options */ +}; + +#define nd_ra_type nd_ra_hdr.icmp6_type +#define nd_ra_code nd_ra_hdr.icmp6_code +#define nd_ra_cksum nd_ra_hdr.icmp6_cksum +#define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0] +#define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1] +#define ND_RA_FLAG_MANAGED 0x80 +#define ND_RA_FLAG_OTHER 0x40 +#define ND_RA_FLAG_HOME_AGENT 0x20 + +/* + * Router preference values based on draft-draves-ipngwg-router-selection-01. + * These are non-standard definitions. + */ +#define ND_RA_FLAG_RTPREF_MASK 0x18 /* 00011000 */ + +#define ND_RA_FLAG_RTPREF_HIGH 0x08 /* 00001000 */ +#define ND_RA_FLAG_RTPREF_MEDIUM 0x00 /* 00000000 */ +#define ND_RA_FLAG_RTPREF_LOW 0x18 /* 00011000 */ +#define ND_RA_FLAG_RTPREF_RSV 0x10 /* 00010000 */ + +#define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1] + +struct nd_neighbor_solicit { /* neighbor solicitation */ + struct icmp6_hdr nd_ns_hdr; + struct in6_addr nd_ns_target; /*target address */ + /* could be followed by options */ +}; + +#define nd_ns_type nd_ns_hdr.icmp6_type +#define nd_ns_code nd_ns_hdr.icmp6_code +#define nd_ns_cksum nd_ns_hdr.icmp6_cksum +#define nd_ns_reserved nd_ns_hdr.icmp6_data32[0] + +struct nd_neighbor_advert { /* neighbor advertisement */ + struct icmp6_hdr nd_na_hdr; + struct in6_addr nd_na_target; /* target address */ + /* could be followed by options */ +}; + +#define nd_na_type nd_na_hdr.icmp6_type +#define nd_na_code nd_na_hdr.icmp6_code +#define nd_na_cksum nd_na_hdr.icmp6_cksum +#define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0] +#if _BYTE_ORDER == _BIG_ENDIAN +#define ND_NA_FLAG_ROUTER 0x80000000 +#define ND_NA_FLAG_SOLICITED 0x40000000 +#define ND_NA_FLAG_OVERRIDE 0x20000000 +#else +#if _BYTE_ORDER == _LITTLE_ENDIAN +#define ND_NA_FLAG_ROUTER 0x80 +#define ND_NA_FLAG_SOLICITED 0x40 +#define ND_NA_FLAG_OVERRIDE 0x20 +#endif +#endif + +struct nd_redirect { /* redirect */ + struct icmp6_hdr nd_rd_hdr; + struct in6_addr nd_rd_target; /* target address */ + struct in6_addr nd_rd_dst; /* destination address */ + /* could be followed by options */ +}; + +#define nd_rd_type nd_rd_hdr.icmp6_type +#define nd_rd_code nd_rd_hdr.icmp6_code +#define nd_rd_cksum nd_rd_hdr.icmp6_cksum +#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0] + +struct ind_neighbor_solicit { /* inverse neighbor solicitation */ + struct icmp6_hdr ind_ns_hdr; + /* could be followed by options */ +}; + +#define ind_ns_type ind_ns_hdr.icmp6_type +#define ind_ns_code ind_ns_hdr.icmp6_code +#define ind_ns_cksum ind_ns_hdr.icmp6_cksum +#define ind_ns_reserved ind_ns_hdr.icmp6_data32[0] + +struct ind_neighbor_advert { /* inverse neighbor advertisement */ + struct icmp6_hdr ind_na_hdr; + /* could be followed by options */ +}; + +#define ind_na_type ind_na_hdr.icmp6_type +#define ind_na_code ind_na_hdr.icmp6_code +#define ind_na_cksum ind_na_hdr.icmp6_cksum +#define ind_na_flags_reserved ind_na_hdr.icmp6_data32[0] + +struct mip6_dhaad_req { /* HA Address Discovery Request */ + struct icmp6_hdr mip6_dhreq_hdr; +}; + +#define mip6_dhreq_type mip6_dhreq_hdr.icmp6_type +#define mip6_dhreq_code mip6_dhreq_hdr.icmp6_code +#define mip6_dhreq_cksum mip6_dhreq_hdr.icmp6_cksum +#define mip6_dhreq_id mip6_dhreq_hdr.icmp6_data16[0] +#define mip6_dhreq_reserved mip6_dhreq_hdr.icmp6_data16[1] + +#if _BYTE_ORDER == _BIG_ENDIAN +#define MIP6_DHREQ_FLAG_MR 0x8000 +#endif /* _BIG_ENDIAN */ +#if _BYTE_ORDER == _LITTLE_ENDIAN +#define MIP6_DHREQ_FLAG_MR 0x0080 +#endif /* _LITTLE_ENDIAN */ + + +struct mip6_dhaad_rep { /* HA Address Discovery Reply */ + struct icmp6_hdr mip6_dhrep_hdr; + /* could be followed by home agent addresses */ +}; + +#define mip6_dhrep_type mip6_dhrep_hdr.icmp6_type +#define mip6_dhrep_code mip6_dhrep_hdr.icmp6_code +#define mip6_dhrep_cksum mip6_dhrep_hdr.icmp6_cksum +#define mip6_dhrep_id mip6_dhrep_hdr.icmp6_data16[0] +#define mip6_dhrep_reserved mip6_dhrep_hdr.icmp6_data16[1] + +#if _BYTE_ORDER == _BIG_ENDIAN +#define MIP6_DHREP_FLAG_MR 0x8000 +#endif /* _BIG_ENDIAN */ +#if _BYTE_ORDER == _LITTLE_ENDIAN +#define MIP6_DHREP_FLAG_MR 0x0080 +#endif /* _LITTLE_ENDIAN */ + +struct mip6_prefix_solicit { /* Mobile Prefix Solicitation */ + struct icmp6_hdr mip6_ps_hdr; +}; + +#define mip6_ps_type mip6_ps_hdr.icmp6_type +#define mip6_ps_code mip6_ps_hdr.icmp6_code +#define mip6_ps_cksum mip6_ps_hdr.icmp6_cksum +#define mip6_ps_id mip6_ps_hdr.icmp6_data16[0] +#define mip6_ps_reserved mip6_ps_hdr.icmp6_data16[1] + +struct mip6_prefix_advert { /* Mobile Prefix Advertisement */ + struct icmp6_hdr mip6_pa_hdr; + /* followed by options */ +}; + +#define mip6_pa_type mip6_pa_hdr.icmp6_type +#define mip6_pa_code mip6_pa_hdr.icmp6_code +#define mip6_pa_cksum mip6_pa_hdr.icmp6_cksum +#define mip6_pa_id mip6_pa_hdr.icmp6_data16[0] +#define mip6_pa_flags_reserved mip6_pa_hdr.icmp6_data16[1] +#if _BYTE_ORDER == _BIG_ENDIAN +#define MIP6_PA_FLAG_MANAGED 0x8000 +#define MIP6_PA_FLAG_OTHER 0x4000 +#endif /* _BIG_ENDIAN */ +#if _BYTE_ORDER == _LITTLE_ENDIAN +#define MIP6_PA_FLAG_MANAGED 0x0080 +#define MIP6_PA_FLAG_OTHER 0x0040 +#endif /* _LITTLE_ENDIAN */ + +struct nd_opt_hdr { /* Neighbor discovery option header */ + u_int8_t nd_opt_type; + u_int8_t nd_opt_len; + /* followed by option specific data*/ +}; + +#define ND_OPT_SOURCE_LINKADDR 1 +#define ND_OPT_TARGET_LINKADDR 2 +#define ND_OPT_PREFIX_INFORMATION 3 +#define ND_OPT_REDIRECTED_HEADER 4 +#define ND_OPT_MTU 5 +#define ND_OPT_ADV_INTERVAL 7 /* 2292bis-02 */ +#define ND_OPT_HA_INFORMATION 8 /* 2292bis-02 */ +#define ND_OPT_SOURCE_ADDRLIST 9 /* will be renamed */ +#define ND_OPT_TARGET_ADDRLIST 10 /* will be renamed */ + +#define ND_OPT_ROUTE_INFO 200 /* draft-ietf-ipngwg-router-preference, not officially assigned yet */ + +struct nd_opt_prefix_info { /* prefix information */ + u_int8_t nd_opt_pi_type; + u_int8_t nd_opt_pi_len; + u_int8_t nd_opt_pi_prefix_len; + u_int8_t nd_opt_pi_flags_reserved; + u_int32_t nd_opt_pi_valid_time; + u_int32_t nd_opt_pi_preferred_time; + u_int32_t nd_opt_pi_reserved2; + struct in6_addr nd_opt_pi_prefix; +}; + +#define ND_OPT_PI_FLAG_ONLINK 0x80 +#define ND_OPT_PI_FLAG_AUTO 0x40 +#define ND_OPT_PI_FLAG_ROUTER 0x20 /* 2292bis-02 */ + +struct nd_opt_rd_hdr { /* redirected header */ + u_int8_t nd_opt_rh_type; + u_int8_t nd_opt_rh_len; + u_int16_t nd_opt_rh_reserved1; + u_int32_t nd_opt_rh_reserved2; + /* followed by IP header and data */ +}; + +struct nd_opt_mtu { /* MTU option */ + u_int8_t nd_opt_mtu_type; + u_int8_t nd_opt_mtu_len; + u_int16_t nd_opt_mtu_reserved; + u_int32_t nd_opt_mtu_mtu; +}; + +struct nd_opt_adv_interval { /* Advertisement interval option */ + u_int8_t nd_opt_ai_type; + u_int8_t nd_opt_ai_len; + u_int16_t nd_opt_ai_reserved; + u_int32_t nd_opt_ai_interval; +}; + +struct nd_opt_homeagent_info { /* Home Agent info */ + u_int8_t nd_opt_hai_type; + u_int8_t nd_opt_hai_len; + u_int16_t nd_opt_hai_reserved; + u_int16_t nd_opt_hai_preference; + u_int16_t nd_opt_hai_lifetime; +}; + +#if _BYTE_ORDER == _BIG_ENDIAN +#define MIP6_HAINFO_FLAG_MR 0x8000 +#endif /* _BIG_ENDIAN */ +#if _BYTE_ORDER == _LITTLE_ENDIAN +#define MIP6_HAINFO_FLAG_MR 0x0080 +#endif /* _LITTLE_ENDIAN */ + +struct nd_opt_route_info { /* route info */ + u_int8_t nd_opt_rti_type; + u_int8_t nd_opt_rti_len; + u_int8_t nd_opt_rti_prefixlen; + u_int8_t nd_opt_rti_flags; + u_int32_t nd_opt_rti_lifetime; + /* prefix follows */ +}; + +/* + * icmp6 namelookup + */ + +struct icmp6_namelookup { + struct icmp6_hdr icmp6_nl_hdr; + u_int8_t icmp6_nl_nonce[8]; + int32_t icmp6_nl_ttl; +#if 0 + u_int8_t icmp6_nl_len; + u_int8_t icmp6_nl_name[3]; +#endif + /* could be followed by options */ +}; + +/* + * icmp6 node information + */ +struct icmp6_nodeinfo { + struct icmp6_hdr icmp6_ni_hdr; + u_int8_t icmp6_ni_nonce[8]; + /* could be followed by reply data */ +}; + +#define ni_type icmp6_ni_hdr.icmp6_type +#define ni_code icmp6_ni_hdr.icmp6_code +#define ni_cksum icmp6_ni_hdr.icmp6_cksum +#define ni_qtype icmp6_ni_hdr.icmp6_data16[0] +#define ni_flags icmp6_ni_hdr.icmp6_data16[1] + +#define NI_QTYPE_NOOP 0 /* NOOP */ +#define NI_QTYPE_SUPTYPES 1 /* Supported Qtypes */ +#define NI_QTYPE_FQDN 2 /* FQDN (draft 04) */ +#define NI_QTYPE_DNSNAME 2 /* DNS Name (draft 05-07) */ +#define NI_QTYPE_NODENAME 2 /* Node Name (draft 08) */ +#define NI_QTYPE_NODEADDR 3 /* Node Addresses */ +#define NI_QTYPE_IPV4ADDR 4 /* IPv4 Addresses */ + +#if _BYTE_ORDER == _BIG_ENDIAN +#define NI_SUPTYPE_FLAG_COMPRESS 0x1 +#define NI_FQDN_FLAG_VALIDTTL 0x1 +#define NI_NODENAME_FLAG_VALIDTTL 0x1 +#elif _BYTE_ORDER == _LITTLE_ENDIAN +#define NI_SUPTYPE_FLAG_COMPRESS 0x0100 +#define NI_FQDN_FLAG_VALIDTTL 0x0100 +#define NI_NODENAME_FLAG_VALIDTTL 0x0100 +#endif + +#ifdef NAME_LOOKUPS_04 +#if _BYTE_ORDER == _BIG_ENDIAN +#define NI_NODEADDR_FLAG_LINKLOCAL 0x1 +#define NI_NODEADDR_FLAG_SITELOCAL 0x2 +#define NI_NODEADDR_FLAG_GLOBAL 0x4 +#define NI_NODEADDR_FLAG_ALL 0x8 +#define NI_NODEADDR_FLAG_TRUNCATE 0x10 +#define NI_NODEADDR_FLAG_ANYCAST 0x20 /* just experimental. not in spec */ +#elif _BYTE_ORDER == _LITTLE_ENDIAN +#define NI_NODEADDR_FLAG_LINKLOCAL 0x0100 +#define NI_NODEADDR_FLAG_SITELOCAL 0x0200 +#define NI_NODEADDR_FLAG_GLOBAL 0x0400 +#define NI_NODEADDR_FLAG_ALL 0x0800 +#define NI_NODEADDR_FLAG_TRUNCATE 0x1000 +#define NI_NODEADDR_FLAG_ANYCAST 0x2000 /* just experimental. not in spec */ +#endif +#else /* draft-ietf-ipngwg-icmp-name-lookups-05 (and later?) */ +#if _BYTE_ORDER == _BIG_ENDIAN +#define NI_NODEADDR_FLAG_TRUNCATE 0x1 +#define NI_NODEADDR_FLAG_ALL 0x2 +#define NI_NODEADDR_FLAG_COMPAT 0x4 +#define NI_NODEADDR_FLAG_LINKLOCAL 0x8 +#define NI_NODEADDR_FLAG_SITELOCAL 0x10 +#define NI_NODEADDR_FLAG_GLOBAL 0x20 +#define NI_NODEADDR_FLAG_ANYCAST 0x40 /* just experimental. not in spec */ +#elif _BYTE_ORDER == _LITTLE_ENDIAN +#define NI_NODEADDR_FLAG_TRUNCATE 0x0100 +#define NI_NODEADDR_FLAG_ALL 0x0200 +#define NI_NODEADDR_FLAG_COMPAT 0x0400 +#define NI_NODEADDR_FLAG_LINKLOCAL 0x0800 +#define NI_NODEADDR_FLAG_SITELOCAL 0x1000 +#define NI_NODEADDR_FLAG_GLOBAL 0x2000 +#define NI_NODEADDR_FLAG_ANYCAST 0x4000 /* just experimental. not in spec */ +#endif +#endif + +struct ni_reply_fqdn { + u_int32_t ni_fqdn_ttl; /* TTL */ + u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */ + u_int8_t ni_fqdn_name[3]; /* XXX: alignment */ +}; +#define ni_reply_nodename ni_reply_fqdn +#define ni_nodename_ttl ni_fqdn_ttl +#define ni_nodename_namelen ni_fqdn_namelen +#define ni_nodename_name ni_fqdn_name + +/* + * Router Renumbering. as router-renum-08.txt + */ +struct icmp6_router_renum { /* router renumbering header */ + struct icmp6_hdr rr_hdr; + u_int8_t rr_segnum; + u_int8_t rr_flags; + u_int16_t rr_maxdelay; + u_int32_t rr_reserved; +}; + +#define ICMP6_RR_FLAGS_TEST 0x80 +#define ICMP6_RR_FLAGS_REQRESULT 0x40 +#define ICMP6_RR_FLAGS_FORCEAPPLY 0x20 +#define ICMP6_RR_FLAGS_SPECSITE 0x10 +#define ICMP6_RR_FLAGS_PREVDONE 0x08 + +#define rr_type rr_hdr.icmp6_type +#define rr_code rr_hdr.icmp6_code +#define rr_cksum rr_hdr.icmp6_cksum +#define rr_seqnum rr_hdr.icmp6_data32[0] + +struct rr_pco_match { /* match prefix part */ + u_int8_t rpm_code; + u_int8_t rpm_len; + u_int8_t rpm_ordinal; + u_int8_t rpm_matchlen; + u_int8_t rpm_minlen; + u_int8_t rpm_maxlen; + u_int16_t rpm_reserved; + struct in6_addr rpm_prefix; +}; + +#define RPM_PCO_ADD 1 +#define RPM_PCO_CHANGE 2 +#define RPM_PCO_SETGLOBAL 3 +#define RPM_PCO_MAX 4 + +struct rr_pco_use { /* use prefix part */ + u_int8_t rpu_uselen; + u_int8_t rpu_keeplen; + u_int8_t rpu_ramask; + u_int8_t rpu_raflags; + u_int32_t rpu_vltime; + u_int32_t rpu_pltime; + u_int32_t rpu_flags; + struct in6_addr rpu_prefix; +}; +#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x80 +#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x40 + +#if _BYTE_ORDER == _BIG_ENDIAN +#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000 +#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000 +#elif _BYTE_ORDER == _LITTLE_ENDIAN +#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80 +#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40 +#endif + +struct rr_result { /* router renumbering result message */ + u_int16_t rrr_flags; + u_int8_t rrr_ordinal; + u_int8_t rrr_matchedlen; + u_int32_t rrr_ifid; + struct in6_addr rrr_prefix; +}; +#if _BYTE_ORDER == _BIG_ENDIAN +#define ICMP6_RR_RESULT_FLAGS_OOB 0x0002 +#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001 +#elif _BYTE_ORDER == _LITTLE_ENDIAN +#define ICMP6_RR_RESULT_FLAGS_OOB 0x0200 +#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100 +#endif + +/* + * icmp6 filter structures. + */ + +struct icmp6_filter { + u_int32_t icmp6_filt[8]; +}; + +#ifdef _WRS_KERNEL +#define ICMP6_FILTER_SETPASSALL(filterp) \ +do { \ + int i; u_int32_t *p; \ + p = &(filterp)->icmp6_filt[0]; \ + for (i = 0; i < NELEMENTS((filterp)->icmp6_filt); i++) \ + p[i] = 0xffffffff; \ +} while (0) + +#define ICMP6_FILTER_SETBLOCKALL(filterp) \ + bzero ((char *)filterp, sizeof(struct icmp6_filter)) +#else /* _WRS_KERNEL */ +#define ICMP6_FILTER_SETPASSALL(filterp) \ + memset(filterp, 0xff, sizeof(struct icmp6_filter)) +#define ICMP6_FILTER_SETBLOCKALL(filterp) \ + memset(filterp, 0x00, sizeof(struct icmp6_filter)) +#endif /* _WRS_KERNEL */ + +#define ICMP6_FILTER_SETPASS(type, filterp) \ + (((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31))) +#define ICMP6_FILTER_SETBLOCK(type, filterp) \ + (((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31))) +#define ICMP6_FILTER_WILLPASS(type, filterp) \ + ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0) +#define ICMP6_FILTER_WILLBLOCK(type, filterp) \ + ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0) + +/* + * Variables related to this implementation + * of the internet control message protocol version 6. + */ +struct icmp6errstat { + u_quad_t icp6errs_dst_unreach_noroute; + u_quad_t icp6errs_dst_unreach_admin; + u_quad_t icp6errs_dst_unreach_beyondscope; + u_quad_t icp6errs_dst_unreach_addr; + u_quad_t icp6errs_dst_unreach_noport; + u_quad_t icp6errs_packet_too_big; + u_quad_t icp6errs_time_exceed_transit; + u_quad_t icp6errs_time_exceed_reassembly; + u_quad_t icp6errs_paramprob_header; + u_quad_t icp6errs_paramprob_nextheader; + u_quad_t icp6errs_paramprob_option; + u_quad_t icp6errs_redirect; /* we regard redirect as an error here */ + u_quad_t icp6errs_unknown; +}; + +struct icmp6stat { +/* statistics related to icmp6 packets generated */ + u_quad_t icp6s_error; /* # of calls to icmp6_error */ + u_quad_t icp6s_canterror; /* no error 'cuz old was icmp */ + u_quad_t icp6s_toofreq; /* no error 'cuz rate limitation */ + u_quad_t icp6s_outhist[256]; +/* statistics related to input message processed */ + u_quad_t icp6s_badcode; /* icmp6_code out of range */ + u_quad_t icp6s_tooshort; /* packet < sizeof(struct icmp6_hdr) */ + u_quad_t icp6s_checksum; /* bad checksum */ + u_quad_t icp6s_badlen; /* calculated bound mismatch */ + /* + * number of responses: this member is inherited from netinet code, but + * for netinet6 code, it is already available in icp6s_outhist[]. + */ + u_quad_t icp6s_reflect; + u_quad_t icp6s_inhist[256]; + u_quad_t icp6s_nd_toomanyopt; /* too many ND options */ + struct icmp6errstat icp6s_outerrhist; +#define icp6s_odst_unreach_noroute \ + icp6s_outerrhist.icp6errs_dst_unreach_noroute +#define icp6s_odst_unreach_admin icp6s_outerrhist.icp6errs_dst_unreach_admin +#define icp6s_odst_unreach_beyondscope \ + icp6s_outerrhist.icp6errs_dst_unreach_beyondscope +#define icp6s_odst_unreach_addr icp6s_outerrhist.icp6errs_dst_unreach_addr +#define icp6s_odst_unreach_noport icp6s_outerrhist.icp6errs_dst_unreach_noport +#define icp6s_opacket_too_big icp6s_outerrhist.icp6errs_packet_too_big +#define icp6s_otime_exceed_transit \ + icp6s_outerrhist.icp6errs_time_exceed_transit +#define icp6s_otime_exceed_reassembly \ + icp6s_outerrhist.icp6errs_time_exceed_reassembly +#define icp6s_oparamprob_header icp6s_outerrhist.icp6errs_paramprob_header +#define icp6s_oparamprob_nextheader \ + icp6s_outerrhist.icp6errs_paramprob_nextheader +#define icp6s_oparamprob_option icp6s_outerrhist.icp6errs_paramprob_option +#define icp6s_oredirect icp6s_outerrhist.icp6errs_redirect +#define icp6s_ounknown icp6s_outerrhist.icp6errs_unknown + u_quad_t icp6s_pmtuchg; /* path MTU changes */ + u_quad_t icp6s_nd_badopt; /* bad ND options */ + u_quad_t icp6s_badns; /* bad neighbor solicitation */ + u_quad_t icp6s_badna; /* bad neighbor advertisement */ + u_quad_t icp6s_badrs; /* bad router advertisement */ + u_quad_t icp6s_badra; /* bad router advertisement */ + u_quad_t icp6s_badredirect; /* bad redirect message */ +}; + +/* + * Names for ICMP sysctl objects + */ +#define ICMPV6CTL_STATS 1 +#define ICMPV6CTL_REDIRACCEPT 2 /* accept/process redirects */ +#define ICMPV6CTL_REDIRTIMEOUT 3 /* redirect cache time */ +#if 0 /*obsoleted*/ +#define ICMPV6CTL_ERRRATELIMIT 5 /* ICMPv6 error rate limitation */ +#endif +#define ICMPV6CTL_ND6_PRUNE 6 +#define ICMPV6CTL_ND6_DELAY 8 +#define ICMPV6CTL_ND6_UMAXTRIES 9 +#define ICMPV6CTL_ND6_MMAXTRIES 10 +#define ICMPV6CTL_ND6_USELOOPBACK 11 +/*#define ICMPV6CTL_ND6_PROXYALL 12 obsoleted, do not reuse here */ +#define ICMPV6CTL_NODEINFO 13 +#define ICMPV6CTL_ERRPPSLIMIT 14 /* ICMPv6 error pps limitation */ +#define ICMPV6CTL_ND6_MAXNUDHINT 15 +#define ICMPV6CTL_MTUDISC_HIWAT 16 +#define ICMPV6CTL_MTUDISC_LOWAT 17 +#define ICMPV6CTL_ND6_DEBUG 18 +#define ICMPV6CTL_ND6_DRLIST 19 +#define ICMPV6CTL_ND6_PRLIST 20 +#define ICMPV6CTL_MLD_MAXSRCFILTER 21 +#define ICMPV6CTL_MLD_SOMAXSRC 22 +#define ICMPV6CTL_MLD_VERSION 23 +#define ICMPV6CTL_ND6_MAXQLEN 24 +#define ICMPV6CTL_MAXID 25 + +#define ICMPV6CTL_NAMES { \ + { 0, 0 }, \ + { 0, 0 }, \ + { "rediraccept", CTLTYPE_INT }, \ + { "redirtimeout", CTLTYPE_INT }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "nd6_prune", CTLTYPE_INT }, \ + { 0, 0 }, \ + { "nd6_delay", CTLTYPE_INT }, \ + { "nd6_umaxtries", CTLTYPE_INT }, \ + { "nd6_mmaxtries", CTLTYPE_INT }, \ + { "nd6_useloopback", CTLTYPE_INT }, \ + { 0, 0 }, \ + { "nodeinfo", CTLTYPE_INT }, \ + { "errppslimit", CTLTYPE_INT }, \ + { "nd6_maxnudhint", CTLTYPE_INT }, \ + { "mtudisc_hiwat", CTLTYPE_INT }, \ + { "mtudisc_lowat", CTLTYPE_INT }, \ + { "nd6_debug", CTLTYPE_INT }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "mldmaxsrcfilter", CTLTYPE_INT }, \ + { "mldsomaxsrc", CTLTYPE_INT }, \ + { "mldalwaysv2", CTLTYPE_INT }, \ + { "nd6_maxqueuelen", CTLTYPE_INT }, \ +} + +#define RTF_PROBEMTU RTF_PROTO1 + +#ifdef _WRS_KERNEL +# ifdef __STDC__ +struct rtentry; +struct rttimer; +struct in6_multi; +# endif +void icmp6_init __P((void)); +void icmp6_paramerror __P((struct mbuf *, int)); +void icmp6_error __P((struct mbuf *, int, int, int)); +void icmp6_error2 __P((struct mbuf *, int, int, int, struct ifnet *)); +int icmp6_input __P((struct mbuf **, int *, int)); +void icmp6_fasttimo __P((void)); +void icmp6_slowtimo __P((void)); +void icmp6_reflect __P((struct mbuf *, size_t)); +void icmp6_prepare __P((struct mbuf *)); +void icmp6_redirect_input __P((struct mbuf *, int)); +void icmp6_redirect_output __P((struct mbuf *, struct rtentry *)); + +struct ip6ctlparam; +int icmp6_mtudisc_update __P((struct ip6ctlparam *, + struct sockaddr_in6 *)); + +/* XXX: is this the right place for these macros? */ +#define icmp6_ifstat_inc(ifp, tag) \ +do { \ + if (ifp) \ + ((struct in6_ifextra *)((ifp)->if_afdata[AF_INET6]))->icmp6_ifstat->tag++; \ +} while (0) + +#define icmp6_ifoutstat_inc(ifp, type, code) \ +do { \ + icmp6_ifstat_inc(ifp, ifs6_out_msg); \ + switch(type) { \ + case ICMP6_DST_UNREACH: \ + icmp6_ifstat_inc(ifp, ifs6_out_dstunreach); \ + if (code == ICMP6_DST_UNREACH_ADMIN) \ + icmp6_ifstat_inc(ifp, ifs6_out_adminprohib); \ + break; \ + case ICMP6_PACKET_TOO_BIG: \ + icmp6_ifstat_inc(ifp, ifs6_out_pkttoobig); \ + break; \ + case ICMP6_TIME_EXCEEDED: \ + icmp6_ifstat_inc(ifp, ifs6_out_timeexceed); \ + break; \ + case ICMP6_PARAM_PROB: \ + icmp6_ifstat_inc(ifp, ifs6_out_paramprob); \ + break; \ + case ICMP6_ECHO_REQUEST: \ + icmp6_ifstat_inc(ifp, ifs6_out_echo); \ + break; \ + case ICMP6_ECHO_REPLY: \ + icmp6_ifstat_inc(ifp, ifs6_out_echoreply); \ + break; \ + case MLD_LISTENER_QUERY: \ + icmp6_ifstat_inc(ifp, ifs6_out_mldquery); \ + break; \ + case MLD_LISTENER_REPORT: \ + case MLDV2_LISTENER_REPORT: \ + icmp6_ifstat_inc(ifp, ifs6_out_mldreport); \ + break; \ + case MLD_LISTENER_DONE: \ + icmp6_ifstat_inc(ifp, ifs6_out_mlddone); \ + break; \ + case ND_ROUTER_SOLICIT: \ + icmp6_ifstat_inc(ifp, ifs6_out_routersolicit); \ + break; \ + case ND_ROUTER_ADVERT: \ + icmp6_ifstat_inc(ifp, ifs6_out_routeradvert); \ + break; \ + case ND_NEIGHBOR_SOLICIT: \ + icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); \ + break; \ + case ND_NEIGHBOR_ADVERT: \ + icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); \ + break; \ + case ND_REDIRECT: \ + icmp6_ifstat_inc(ifp, ifs6_out_redirect); \ + break; \ + } \ +} while (0) + +#ifndef VIRTUAL_STACK +extern int icmp6_rediraccept; /* accept/process redirects */ +extern int icmp6_redirtimeout; /* cache time for redirect routes */ +#endif /* !VIRTUAL_STACK */ +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* not _NETINET_ICMP6_H_ */ diff --git a/h/wrn/coreip/netinet6/in6.h b/h/wrn/coreip/netinet6/in6.h new file mode 100644 index 0000000..1902fb9 --- /dev/null +++ b/h/wrn/coreip/netinet6/in6.h @@ -0,0 +1,821 @@ +/* in6.c - in6 header file */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* $KAME: in6.h,v 1.159 2005/03/19 07:28:59 suz Exp $ */ +/* $KAME: in6.h,v 1.155 2004/06/02 05:53:14 itojun Exp $ */ +/* $FreeBSD: src/sys/netinet6/in6.h,v 1.7.2.7 2002/08/01 19:38:50 ume Exp $ */ +/* $KAME: in6.h,v 1.89 2001/05/27 13:28:35 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Copyright (c) 1982, 1986, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)in.h 8.3 (Berkeley) 1/3/94 + */ + +/* +modification history +-------------------- +01u,06aug05,dlk Added in6_pseudo() declaration. +01t,04jun05,dlk Make inet6_opt* functions from RFCs 2292 and 3542 visible in + user space. +01s,31may05,tlu Added IN6_IS_ADDR_GLOBAL +01r,09may05,kch Merged from Kame v 1.159. +01q,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +01p,23feb05,dlk Make functions from rthdr.c visible in user space. +01o,07feb05,vvv _KERNEL cleanup +01n,24jan05,vvv osdep.h cleanup +01m,20jan05,sar Removal of divert, dummynet and fw code. +01l,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01k,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01j,20nov03,niq Remove copyright_wrs.h file inclusion +01i,04nov03,rlm Ran batch header path update for header re-org. +01h,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01g,27oct03,rlm update include statements post header re-org. +01f,11aug03,nee Merging from label ACCORDION_BASE6_MERGE_BASELINE in + accordion codeline to Base6 +01e,09may03,vvv fixed check for in.h +01d,30apr03,syy Added #ifdef for __cplusplus +01c,01feb03,pas merge from FreeBSD 4.7 - added faithprefix_p +01b,30sep02,sar IFDEF out the KAME IPsec mflags +01a,03feb02,ham changes for tornado. +*/ + +#ifndef _NETINET_IN_H_ +#error "do not include netinet6/in6.h directly, include netinet/in.h. see RFC2553" +#endif + +#ifndef _NETINET6_IN6_H_ +#define _NETINET6_IN6_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Identification of the network protocol stack + * for *BSD-current/release: http://www.kame.net/dev/cvsweb.cgi/kame/COVERAGE + * has the table of implementation/integration differences. + */ +#define __KAME__ +#define __KAME_VERSION "SNAP 20050404" + +/* + * Local port number conventions: + * + * Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root), + * unless a kernel is compiled with IPNOPRIVPORTS defined. + * + * When a user does a bind(2) or connect(2) with a port number of zero, + * a non-conflicting local port address is chosen. + * + * The default range is IPPORT_ANONMIN to IPPORT_ANONMAX, although + * that is settable by sysctl(3); net.inet.ip.anonportmin and + * net.inet.ip.anonportmax respectively. + * + * A user may set the IPPROTO_IP option IP_PORTRANGE to change this + * default assignment range. + * + * The value IP_PORTRANGE_DEFAULT causes the default behavior. + * + * The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT, + * and exists only for FreeBSD compatibility purposes. + * + * The value IP_PORTRANGE_LOW changes the range to the "low" are + * that is (by convention) restricted to privileged processes. + * This convention is based on "vouchsafe" principles only. + * It is only secure if you trust the remote host to restrict these ports. + * The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX. + */ + +#define IPV6PORT_RESERVED 1024 +#define IPV6PORT_ANONMIN 49152 +#define IPV6PORT_ANONMAX 65535 +#define IPV6PORT_RESERVEDMIN 600 +#define IPV6PORT_RESERVEDMAX (IPV6PORT_RESERVED-1) + +/* + * IPv6 address + */ +struct in6_addr { + union { + u_int8_t __u6_addr8[16]; + u_int16_t __u6_addr16[8]; + u_int32_t __u6_addr32[4]; + } __u6_addr; /* 128-bit IP6 address */ +}; + +#define s6_addr __u6_addr.__u6_addr8 +#ifdef _WRS_KERNEL /* XXX nonstandard */ +#define s6_addr8 __u6_addr.__u6_addr8 +#define s6_addr16 __u6_addr.__u6_addr16 +#define s6_addr32 __u6_addr.__u6_addr32 +#endif + +#define INET6_ADDRSTRLEN 46 + +/* + * Socket address for IPv6 + */ +#ifndef _XOPEN_SOURCE +#define SIN6_LEN +#endif +struct sockaddr_in6 { + u_int8_t sin6_len; /* length of this struct(sa_family_t)*/ + u_int8_t sin6_family; /* AF_INET6 (sa_family_t) */ + u_int16_t sin6_port; /* Transport layer port # (in_port_t)*/ + u_int32_t sin6_flowinfo; /* IP6 flow information */ + struct in6_addr sin6_addr; /* IP6 address */ + u_int32_t sin6_scope_id; /* scope zone index */ +}; + +/* + * Local definition for masks + */ +#ifdef _WRS_KERNEL /* XXX nonstandard */ +#define IN6MASK0 {{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}} +#define IN6MASK32 {{{ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}} +#define IN6MASK64 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}} +#define IN6MASK96 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}} +#define IN6MASK128 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}} + +extern const struct sockaddr_in6 sa6_any; + +extern const struct in6_addr in6mask0; +extern const struct in6_addr in6mask32; +extern const struct in6_addr in6mask64; +extern const struct in6_addr in6mask96; +extern const struct in6_addr in6mask128; + +/* + * Macros started with IPV6_ADDR is KAME local + */ + +#if _BYTE_ORDER == _BIG_ENDIAN +#define IPV6_ADDR_INT32_ONE 1 +#define IPV6_ADDR_INT32_TWO 2 +#define IPV6_ADDR_INT32_MNL 0xff010000 +#define IPV6_ADDR_INT32_MLL 0xff020000 +#define IPV6_ADDR_INT32_SMP 0x0000ffff +#define IPV6_ADDR_INT16_ULL 0xfe80 +#define IPV6_ADDR_INT16_USL 0xfec0 +#define IPV6_ADDR_INT16_MLL 0xff02 +#elif _BYTE_ORDER == _LITTLE_ENDIAN +#define IPV6_ADDR_INT32_ONE 0x01000000 +#define IPV6_ADDR_INT32_TWO 0x02000000 +#define IPV6_ADDR_INT32_MNL 0x000001ff +#define IPV6_ADDR_INT32_MLL 0x000002ff +#define IPV6_ADDR_INT32_SMP 0xffff0000 +#define IPV6_ADDR_INT16_ULL 0x80fe +#define IPV6_ADDR_INT16_USL 0xc0fe +#define IPV6_ADDR_INT16_MLL 0x02ff +#endif +#endif /* _WRS_KERNEL */ + +/* + * Definition of some useful macros to handle IP6 addresses + */ +#define IN6ADDR_ANY_INIT \ + {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}} +#define IN6ADDR_LOOPBACK_INIT \ + {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}} +#define IN6ADDR_NODELOCAL_ALLNODES_INIT \ + {{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}} +#define IN6ADDR_INTFACELOCAL_ALLNODES_INIT \ + {{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}} +#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \ + {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}} +#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \ + {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}} +#ifdef MLDV2 +#define IN6ADDR_LINKLOCAL_ALLV2ROUTERS_INIT \ + {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16 }}} +#endif + +extern const struct in6_addr in6addr_any; +extern const struct in6_addr in6addr_loopback; +extern const struct in6_addr in6addr_nodelocal_allnodes; +extern const struct in6_addr in6addr_linklocal_allnodes; +extern const struct in6_addr in6addr_linklocal_allrouters; +#ifdef MLDV2 +extern const struct in6_addr in6addr_linklocal_allv2routers; +#endif + +/* Equality */ + +#define IN6_ARE_ADDR_EQUAL(a, b) \ + (bcmp ((char *) &(a)->s6_addr[0], (char *) &(b)->s6_addr[0], \ + sizeof(struct in6_addr)) == 0) + +#ifdef _WRS_KERNEL /* non standard */ +#if 0 +/* see if two addresses are equal in a scope-conscious manner. */ +#define SA6_ARE_ADDR_EQUAL(a, b) \ + (((a)->sin6_scope_id == 0 || (b)->sin6_scope_id == 0 || \ + ((a)->sin6_scope_id == (b)->sin6_scope_id)) && \ + (bcmp ((char *) &(a)->sin6_addr, (char *) &(b)->sin6_addr, \ + sizeof (struct in6_addr)) == 0)) +#endif +#endif + +/* + * Unspecified + */ +#define IN6_IS_ADDR_UNSPECIFIED(a) \ + ((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \ + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) == 0)) + +/* + * Loopback + */ +#define IN6_IS_ADDR_LOOPBACK(a) \ + ((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \ + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) == ntohl(1))) + +/* + * IPv4 compatible + */ +#define IN6_IS_ADDR_V4COMPAT(a) \ + ((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \ + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) != 0) && \ + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) != ntohl(1))) + +/* + * Mapped + */ +#define IN6_IS_ADDR_V4MAPPED(a) \ + ((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ + (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff))) + +/* + * KAME Scope Values + */ + +#ifdef _WRS_KERNEL /* XXX nonstandard */ +#define IPV6_ADDR_SCOPE_NODELOCAL 0x01 +#define IPV6_ADDR_SCOPE_INTFACELOCAL 0x01 +#define IPV6_ADDR_SCOPE_LINKLOCAL 0x02 +#define IPV6_ADDR_SCOPE_SITELOCAL 0x05 +#define IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */ +#define IPV6_ADDR_SCOPE_GLOBAL 0x0e +#else +#define __IPV6_ADDR_SCOPE_NODELOCAL 0x01 +#define __IPV6_ADDR_SCOPE_INTFACELOCAL 0x01 +#define __IPV6_ADDR_SCOPE_LINKLOCAL 0x02 +#define __IPV6_ADDR_SCOPE_SITELOCAL 0x05 +#define __IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */ +#define __IPV6_ADDR_SCOPE_GLOBAL 0x0e +#endif + +/* + * Unicast Scope + * Note that we must check topmost 10 bits only, not 16 bits (see RFC2373). + */ +#define IN6_IS_ADDR_LINKLOCAL(a) \ + (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80)) +#define IN6_IS_ADDR_SITELOCAL(a) \ + (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0)) + +/* + * Multicast + */ +#define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff) + +/* + * Global Scope + */ +#define IN6_IS_ADDR_GLOBAL(adr) \ + ((!IN6_IS_ADDR_MULTICAST(adr)) && \ + (!IN6_IS_ADDR_LINKLOCAL(adr)) && \ + (!IN6_IS_ADDR_SITELOCAL(adr))) + +#ifdef _WRS_KERNEL /* XXX nonstandard */ +#define IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f) +#else +#define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f) +#endif + +/* + * Multicast Scope + */ +#ifdef _WRS_KERNEL /* refers nonstandard items */ +#define IN6_IS_ADDR_MC_NODELOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_NODELOCAL)) +#define IN6_IS_ADDR_MC_INTFACELOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_INTFACELOCAL)) +#define IN6_IS_ADDR_MC_LINKLOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_LINKLOCAL)) +#define IN6_IS_ADDR_MC_SITELOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_SITELOCAL)) +#define IN6_IS_ADDR_MC_ORGLOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_ORGLOCAL)) +#define IN6_IS_ADDR_MC_GLOBAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_GLOBAL)) +#else +#define IN6_IS_ADDR_MC_NODELOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL)) +#define IN6_IS_ADDR_MC_LINKLOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL)) +#define IN6_IS_ADDR_MC_SITELOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL)) +#define IN6_IS_ADDR_MC_ORGLOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL)) +#define IN6_IS_ADDR_MC_GLOBAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL)) +#endif + +#ifdef _WRS_KERNEL /* nonstandard */ +/* + * KAME Scope + */ +#define IN6_IS_SCOPE_LINKLOCAL(a) \ + ((IN6_IS_ADDR_LINKLOCAL(a)) || \ + (IN6_IS_ADDR_MC_LINKLOCAL(a))) + +#define IFA6_IS_DEPRECATED(a) \ + ((a)->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME && \ + (u_int32_t)((time_second - (a)->ia6_updatetime)) > \ + (a)->ia6_lifetime.ia6t_pltime) +#define IFA6_IS_INVALID(a) \ + ((a)->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME && \ + (u_int32_t)((time_second - (a)->ia6_updatetime)) > \ + (a)->ia6_lifetime.ia6t_vltime) +#endif /* _WRS_KERNEL */ + +/* + * IP6 route structure + */ +#ifndef _XOPEN_SOURCE +#include + +struct route_in6 { + struct rtentry *ro_rt; + struct sockaddr_in6 ro_dst; +}; +#endif + +/* + * Kame has the following define in the application's Makefile. + */ +#define USE_RFC2292BIS + +/* + * Options for use with [gs]etsockopt at the IPV6 level. + * First word of comment is data type; bool is stored in int. + */ +/* no hdrincl */ +#if 0 /* the followings are relic in IPv4 and hence are disabled */ +#define IPV6_OPTIONS 1 /* buf/ip6_opts; set/get IP6 options */ +#define IPV6_RECVOPTS 5 /* bool; receive all IP6 opts w/dgram */ +#define IPV6_RECVRETOPTS 6 /* bool; receive IP6 opts for response */ +#define IPV6_RECVDSTADDR 7 /* bool; receive IP6 dst addr w/dgram */ +#define IPV6_RETOPTS 8 /* ip6_opts; set/get IP6 options */ +#endif +#define IPV6_SOCKOPT_RESERVED1 3 /* reserved for future use */ +#define IPV6_UNICAST_HOPS 4 /* int; IP6 hops */ +#define IPV6_MULTICAST_IF 9 /* u_int; set/get IP6 multicast i/f */ +#define IPV6_MULTICAST_HOPS 10 /* int; set/get IP6 multicast hops */ +#define IPV6_MULTICAST_LOOP 11 /* u_int; set/get IP6 multicast loopback */ +#define IPV6_JOIN_GROUP 12 /* ip6_mreq; join a group membership */ +#define IPV6_LEAVE_GROUP 13 /* ip6_mreq; leave a group membership */ +#define IPV6_PORTRANGE 14 /* int; range to choose for unspec port */ +#define ICMP6_FILTER 18 /* icmp6_filter; icmp6 filter */ +/* RFC2292 options */ +#ifdef _WRS_KERNEL +#define IPV6_2292PKTINFO 19 /* bool; send/recv if, src/dst addr */ +#define IPV6_2292HOPLIMIT 20 /* bool; hop limit */ +#define IPV6_2292NEXTHOP 21 /* bool; next hop addr */ +#define IPV6_2292HOPOPTS 22 /* bool; hop-by-hop option */ +#define IPV6_2292DSTOPTS 23 /* bool; destinaion option */ +#define IPV6_2292RTHDR 24 /* bool; routing header */ +#define IPV6_2292PKTOPTIONS 25 /* buf/cmsghdr; set/get IPv6 options */ +#endif + +#define IPV6_CHECKSUM 26 /* int; checksum offset for raw socket */ +#define IPV6_V6ONLY 27 /* bool; make AF_INET6 sockets v6 only */ +#define IPV6_BINDV6ONLY IPV6_V6ONLY + +#if 1 /* IPSEC */ +#define IPV6_IPSEC_POLICY 28 /* struct; get/set security policy */ +#endif +#define IPV6_FAITH 29 /* bool; accept FAITH'ed connections */ + +/* We currently don't support the ipv6_fw options. They are + * retained in this file for consistency with other systems + */ +#if 0 /* IPV6FIREWALL */ +#define IPV6_FW_ADD 30 /* add a firewall rule to chain */ +#define IPV6_FW_DEL 31 /* delete a firewall rule from chain */ +#define IPV6_FW_FLUSH 32 /* flush firewall rule chain */ +#define IPV6_FW_ZERO 33 /* clear single/all firewall counter(s) */ +#define IPV6_FW_GET 34 /* get entire firewall rule chain */ +#endif + +/* new socket options introduced in RFC2292bis */ +#define IPV6_RTHDRDSTOPTS 35 /* ip6_dest; send dst option before rthdr */ + +#define IPV6_RECVPKTINFO 36 /* bool; recv if, dst addr */ +#define IPV6_RECVHOPLIMIT 37 /* bool; recv hop limit */ +#define IPV6_RECVRTHDR 38 /* bool; recv routing header */ +#define IPV6_RECVHOPOPTS 39 /* bool; recv hop-by-hop option */ +#define IPV6_RECVDSTOPTS 40 /* bool; recv dst option after rthdr */ +#ifdef _WRS_KERNEL +#define IPV6_RECVRTHDRDSTOPTS 41 /* bool; recv dst option before rthdr */ +#endif + +#define IPV6_USE_MIN_MTU 42 /* bool; send packets at the minimum MTU */ +#define IPV6_RECVPATHMTU 43 /* bool; notify an according MTU */ + +#define IPV6_PATHMTU 44 /* mtuinfo; get the current path MTU (sopt), + 4 bytes int; MTU notification (cmsg) */ +#if 0 /*obsoleted during 2292bis -> 3542*/ +#define IPV6_REACHCONF 45 /* no data; ND reachability confirm + (cmsg only/not in of RFC3542) */ +#endif + +/* more new socket options introduced in RFC2292bis */ +#define IPV6_PKTINFO 46 /* in6_pktinfo; send if, src addr */ +#define IPV6_HOPLIMIT 47 /* int; send hop limit */ +#define IPV6_NEXTHOP 48 /* sockaddr; next hop addr */ +#define IPV6_HOPOPTS 49 /* ip6_hbh; send hop-by-hop option */ +#define IPV6_DSTOPTS 50 /* ip6_dest; send dst option befor rthdr */ +#define IPV6_RTHDR 51 /* ip6_rthdr; send routing header */ +#if 0 +#define IPV6_PKTOPTIONS 52 /* buf/cmsghdr; set/get IPv6 options */ + /* obsoleted by 2292bis */ +#endif + +#define IPV6_RECVTCLASS 57 /* bool; recv traffic class values */ +#ifdef _WRS_KERNEL +#define IPV6_OTCLASS 58 /* u_int8_t; send traffic class value */ +#endif +#define IPV6_AUTOFLOWLABEL 59 /* bool; attach flowlabel automagically */ + +#define IPV6_TCLASS 61 /* int; send traffic class value */ +#define IPV6_DONTFRAG 62 /* bool; disable IPv6 fragmentation */ + +#define IPV6_PREFER_TEMPADDR 63 /* int; prefer temporary addresses as + * the source address. + */ + +/* to define items, should talk with KAME guys first, for *BSD compatibility */ + +#define IPV6_RTHDR_LOOSE 0 /* this hop need not be a neighbor. XXX old spec */ +#define IPV6_RTHDR_STRICT 1 /* this hop must be a neighbor. XXX old spec */ +#define IPV6_RTHDR_TYPE_0 0 /* IPv6 routing header type 0 */ +#define IPV6_RTHDR_TYPE_2 2 /* IPv6 routing header type 2 for Mobile IPv6 */ + +/* + * Defaults and limits for options + */ +#define IPV6_DEFAULT_MULTICAST_HOPS 1 /* normally limit m'casts to 1 hop */ +#define IPV6_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */ + +/* + * Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP. + */ +struct ipv6_mreq { + struct in6_addr ipv6mr_multiaddr; + unsigned int ipv6mr_interface; +}; + +/* + * IPV6_PKTINFO: Packet information(RFC2292 sec 5) + */ +struct in6_pktinfo { + struct in6_addr ipi6_addr; /* src/dst IPv6 address */ + unsigned int ipi6_ifindex; /* send/recv interface index */ +}; + +/* + * Control structure for IPV6_RECVPATHMTU socket option. + */ +struct ip6_mtuinfo { + struct sockaddr_in6 ip6m_addr; /* or sockaddr_storage? */ + u_int32_t ip6m_mtu; +}; + +/* + * Argument for IPV6_PORTRANGE: + * - which range to search when port is unspecified at bind() or connect() + */ +#define IPV6_PORTRANGE_DEFAULT 0 /* default range */ +#define IPV6_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */ +#define IPV6_PORTRANGE_LOW 2 /* "low" - vouchsafe security */ + +/* + * Definitions for inet6 sysctl operations. + * + * Third level is protocol number. + * Fourth level is desired variable within that protocol. + */ +#define IPV6PROTO_MAXID (IPPROTO_MH + 1) /* don't list to IPV6PROTO_MAX */ + +#define CTL_IPV6PROTO_NAMES { \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, \ + { "tcp6", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "udp6", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, \ + { "ip6", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, \ + { "ipsec6", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "icmp6", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "pim6", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },\ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },\ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },\ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },\ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },\ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },\ + { "mip6", CTLTYPE_NODE }, \ +} + +/* + * Names for IP sysctl objects + */ +#define IPV6CTL_FORWARDING 1 /* act as router */ +#define IPV6CTL_SENDREDIRECTS 2 /* may send redirects when forwarding*/ +#define IPV6CTL_DEFHLIM 3 /* default Hop-Limit */ +#ifdef notyet +#define IPV6CTL_DEFMTU 4 /* default MTU */ +#endif +#define IPV6CTL_FORWSRCRT 5 /* forward source-routed dgrams */ +#define IPV6CTL_STATS 6 /* stats */ +#define IPV6CTL_MRTSTATS 7 /* multicast forwarding stats */ +#define IPV6CTL_MRTPROTO 8 /* multicast routing protocol */ +#define IPV6CTL_MAXFRAGPACKETS 9 /* max packets reassembly queue */ +#define IPV6CTL_SOURCECHECK 10 /* verify source route and intf */ +#define IPV6CTL_SOURCECHECK_LOGINT 11 /* minimume logging interval */ +#define IPV6CTL_ACCEPT_RTADV 12 +#define IPV6CTL_KEEPFAITH 13 +#define IPV6CTL_LOG_INTERVAL 14 +#define IPV6CTL_HDRNESTLIMIT 15 +#define IPV6CTL_DAD_COUNT 16 +#define IPV6CTL_AUTO_FLOWLABEL 17 +#define IPV6CTL_DEFMCASTHLIM 18 +#define IPV6CTL_GIF_HLIM 19 /* default HLIM for gif encap packet */ +#define IPV6CTL_KAME_VERSION 20 +#define IPV6CTL_USE_DEPRECATED 21 /* use deprecated addr (RFC2462 5.5.4) */ +#define IPV6CTL_RR_PRUNE 22 /* walk timer for router renumbering */ +#if 0 /* obsolete */ +#define IPV6CTL_MAPPED_ADDR 23 +#endif +#define IPV6CTL_V6ONLY 24 +#define IPV6CTL_RTEXPIRE 25 /* cloned route expiration time */ +#define IPV6CTL_RTMINEXPIRE 26 /* min value for expiration time */ +#define IPV6CTL_RTMAXCACHE 27 /* trigger level for dynamic expire */ + +#define IPV6CTL_USETEMPADDR 32 /* use temporary addresses (RFC3041) */ +#define IPV6CTL_TEMPPLTIME 33 /* preferred lifetime for tmpaddrs */ +#define IPV6CTL_TEMPVLTIME 34 /* valid lifetime for tmpaddrs */ +#define IPV6CTL_AUTO_LINKLOCAL 35 /* automatic link-local addr assign */ +#define IPV6CTL_RIP6STATS 36 /* raw_ip6 stats */ +#define IPV6CTL_PREFER_TEMPADDR 37 /* prefer temporary addr as src */ +#define IPV6CTL_ADDRCTLPOLICY 38 /* get/set address selection policy */ +#define IPV6CTL_USE_DEFAULTZONE 39 /* use default scope zone */ +#define IPV6CTL_PMTU_EXPIRE 40 /* path MTU expiration timer */ +#define IPV6CTL_MAXFRAGS 41 /* max fragments */ +#define IPV6CTL_IFQ 42 /* ip6intrq node */ +#define IPV6CTL_ISATAPRTR 43 /* isatap router */ +#define IPV6CTL_MCAST_PMTU 44 /* enable pMTU discovery for multicast? */ + +#define IPV6CTL_RTTIMEOUT 45 /* timeout in seconds */ + +/* New entries should be added here from current IPV6CTL_MAXID value. */ +/* to define items, should talk with KAME guys first, for *BSD compatibility */ +#define IPV6CTL_MAXID 46 + +/* Remove the mbuf flags that are used by the KAME IPsec code. + * We don't use them and they may cause problems if defined. + * Eventually we should remove them completely, I've currently left + * them in as part of the history of the file. + * + * The M_LOOP flag is used in the main line code and so I've left + * it's definiton in. It should be moved to mbuf.h when convienent. + * sar + */ +#if 0 +/* + * Redefinition of mbuf flags + */ +#define M_AUTHIPHDR M_PROTO2 +#define M_DECRYPTED M_PROTO3 +#define M_AUTHIPDGM M_PROTO5 +#endif /* 0 */ + +#define M_LOOP M_PROTO4 + +#ifdef _WRS_KERNEL +struct cmsghdr; + +int in6_cksum __P((struct mbuf *, u_int8_t, u_int32_t, u_int32_t)); +int in6_pseudo __P((struct in6_addr *, struct in6_addr *, + u_int32_t, u_int8_t)); +int in6_localaddr __P((struct in6_addr *)); +int in6_addrscope __P((struct in6_addr *)); +struct in6_ifaddr *in6_ifawithscope __P((struct ifnet *, struct in6_addr *)); +struct in6_ifaddr *in6_ifawithifp __P((struct ifnet *, struct in6_addr *)); +struct in6_ifaddr *in6_ifexists_ifa __P((struct ifnet *)); +extern void in6_if_up __P((struct ifnet *)); +struct sockaddr; + +void in6_sin6_2_sin __P((struct sockaddr_in *sin, + struct sockaddr_in6 *sin6)); +void in6_sin_2_v4mapsin6 __P((struct sockaddr_in *sin, + struct sockaddr_in6 *sin6)); +void in6_sin6_2_sin_in_sock __P((struct sockaddr *nam)); +int in6_sin_2_v4mapsin6_in_sock __P((struct sockaddr **nam)); +extern void addrsel_policy_init __P((void)); + +#define satosin6(sa) ((struct sockaddr_in6 *)(sa)) +#define sin6tosa(sin6) ((struct sockaddr *)(sin6)) +#define ifatoia6(ifa) ((struct in6_ifaddr *)(ifa)) + +extern int (*faithprefix_p)(struct in6_addr *); + +#endif /* _WRS_KERNEL */ + +/* Hop-by-Hop/Destination options processing API from RFC 2292 */ + +extern int inet6_option_space __P((int)); +extern int inet6_option_init __P((void *, struct cmsghdr **, int)); +extern int inet6_option_append __P((struct cmsghdr *, const u_int8_t *, + int, int)); +extern u_int8_t *inet6_option_alloc __P((struct cmsghdr *, int, int, int)); +extern int inet6_option_next __P((const struct cmsghdr *, u_int8_t **)); +extern int inet6_option_find __P((const struct cmsghdr *, u_int8_t **, int)); + +/* Hop-by-Hop/Destination options processing API from RFC 3542 */ + +extern int inet6_opt_init __P((void *, socklen_t)); +extern int inet6_opt_append __P((void *, socklen_t, int, u_int8_t, + socklen_t, u_int8_t, void **)); +extern int inet6_opt_finish __P((void *, socklen_t, int)); +extern int inet6_opt_set_val __P((void *, int, void *, socklen_t)); + +extern int inet6_opt_next __P((void *, socklen_t, int, u_int8_t *, + socklen_t *, void **)); +extern int inet6_opt_find __P((void *, socklen_t, int, u_int8_t, + socklen_t *, void **)); +extern int inet6_opt_get_val __P((void *, int, void *, socklen_t)); + +/* Defined in rthdr.c, these are implemented in user space also */ + +extern size_t inet6_rthdr_space __P((int, int)); +extern struct cmsghdr *inet6_rthdr_init __P((void *, int)); +extern int inet6_rthdr_add __P((struct cmsghdr *, const struct in6_addr *, + unsigned int)); +extern int inet6_rthdr_lasthop __P((struct cmsghdr *, unsigned int)); +#if 0 /* not implemented yet */ +extern int inet6_rthdr_reverse __P((const struct cmsghdr *, struct cmsghdr *)); +#endif +extern int inet6_rthdr_segments __P((const struct cmsghdr *)); +extern struct in6_addr *inet6_rthdr_getaddr __P((struct cmsghdr *, int)); +extern int inet6_rthdr_getflags __P((const struct cmsghdr *, int)); + +extern socklen_t inet6_rth_space __P((int, int)); +extern void *inet6_rth_init __P((void *, socklen_t, int, int)); +extern int inet6_rth_add __P((void *, const struct in6_addr *)); +extern int inet6_rth_reverse __P((const void *, void *)); +extern int inet6_rth_segments __P((const void *)); +extern struct in6_addr *inet6_rth_getaddr __P((const void *, int)); + +/* end rthdr.c functions */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_NETINET6_IN6_H_ */ diff --git a/h/wrn/coreip/netinet6/in6_msf.h b/h/wrn/coreip/netinet6/in6_msf.h new file mode 100644 index 0000000..01c1320 --- /dev/null +++ b/h/wrn/coreip/netinet6/in6_msf.h @@ -0,0 +1,161 @@ +/* $KAME: in6_msf.h,v 1.9 2004/04/09 07:47:39 suz Exp $ */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* + * Copyright (c) 2002 INRIA. All rights reserved. + * + * Implementation of Multicast Listener Discovery, Version 2. + * Developed by Hitoshi Asaeda, INRIA, August 2002. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of INRIA nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Copyright (C) 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* +modification history +-------------------- +01b,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +01a,24feb05,rp added WR copyrights and mod history +*/ + +#ifndef _NETINET6_IN6MSF_H_ +#define _NETINET6_IN6MSF_H_ + +#include +#include +#include + +/* + * Multicast source filters list per group address. + */ +LIST_HEAD(i6as_head, in6_addr_source); + +struct in6_addr_source { + struct sockaddr_in6 i6as_addr; /* source address */ + LIST_ENTRY(in6_addr_source) i6as_list; /* list of source addresses */ + u_int i6as_refcount; /* reference count of the source */ +}; + +struct in6_addr_slist { + struct i6as_head *head; /* head point of this list */ + u_int16_t numsrc; /* num of sources of this list */ +}; + +struct in6_multi_source { + u_int i6ms_mode; /* current source filter mode */ + u_int i6ms_grpjoin; /* (*,G) join request bit */ + struct in6_addr_slist *i6ms_cur; /* current filtered source list */ + struct in6_addr_slist *i6ms_rec; /* recorded source address list */ + struct in6_addr_slist *i6ms_in; /* include source address list */ + struct in6_addr_slist *i6ms_ex; /* exclude source address list */ + struct in6_addr_slist *i6ms_alw; /* pending ALLOW source address */ + struct in6_addr_slist *i6ms_blk; /* pending BLOCK source address */ + struct in6_addr_slist *i6ms_toin; /* pending TO_IN source address */ + struct in6_addr_slist *i6ms_toex; /* pending TO_EX source address */ + u_int i6ms_timer; /* state-change report timer */ + u_int i6ms_robvar; /* robustness var. of grp record */ +}; + +#ifdef _WRS_KERNEL +int in6_addmultisrc(struct in6_multi *, u_int16_t, + struct sockaddr_storage *, u_int, int, struct i6as_head **, + u_int *, u_int16_t *); +int in6_delmultisrc(struct in6_multi *, u_int16_t, + struct sockaddr_storage *, u_int, int, struct i6as_head **, + u_int *, u_int16_t *); +int in6_modmultisrc(struct in6_multi *, u_int16_t, + struct sockaddr_storage *, u_int, u_int16_t, + struct sockaddr_storage *, u_int, u_int, struct i6as_head **, + u_int *, u_int16_t *); +void in6_undomultisrc(struct in6_multi *, u_int16_t, + struct sockaddr_storage *, u_int, int); +int in6_get_new_msf_state(struct in6_multi *, struct i6as_head **, + u_int *, u_int16_t *); +int in6_merge_msf_state(struct in6_multi *, struct i6as_head *, u_int, u_int16_t); +void in6_free_all_msf_source_list(struct in6_multi *); +void in6_free_msf_source_list(struct i6as_head *); +void in6_free_msf_source_addr(struct in6_addr_slist *, struct sockaddr_in6 *); +void in6_clear_all_pending_report(struct in6_multi *); +int in6_merge_msf_source_addr(struct in6_addr_slist *, struct sockaddr_in6 *, int); +int sock6_setmopt_srcfilter(struct socket *, struct group_filter **); +int sock6_getmopt_srcfilter(struct socket *, struct group_filter **); +int in6_getmopt_source_list(struct sock_msf *, u_int16_t *, + struct sockaddr_storage **, u_int *); +int in6_setmopt_source_addr(struct sockaddr_storage *, + struct sock_msf *, int); +int in6_setmopt_source_list(struct sock_msf *, u_int16_t, + struct sockaddr_storage *, u_int, u_int16_t *, + u_int16_t *, struct sockaddr_storage *); +void in6_freemopt_source_list(struct sock_msf *, struct msf_head *, struct msf_head *); +void in6_cleanmopt_source_addr(struct sock_msf *, int); +void in6_undomopt_source_addr(struct sock_msf *, int); +void in6_undomopt_source_list(struct sock_msf *, u_int); +int match_msf6_per_if(struct in6_multi *, struct in6_addr *, + struct in6_addr *); + +#ifdef HAVE_NRL_INPCB +int match_msf6_per_socket(struct inpcb *, struct in6_addr *, + struct in6_addr *); +#else +int match_msf6_per_socket(struct in6pcb *, struct in6_addr *, + struct in6_addr *); +#endif +#endif /* _WRS_KERNEL */ +#endif /* _NETINET6_IN6MSF_H_ */ diff --git a/h/wrn/coreip/netinet6/in6_pcb.h b/h/wrn/coreip/netinet6/in6_pcb.h new file mode 100644 index 0000000..7769742 --- /dev/null +++ b/h/wrn/coreip/netinet6/in6_pcb.h @@ -0,0 +1,135 @@ +/* in6_pcb.h - internet protocol version 6 control block header file */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* $KAME: in6_pcb.h,v 1.49 2001/07/26 06:53:16 jinmei Exp $ */ +/* $FreeBSD: src/sys/netinet6/in6_pcb.h,v 1.2.2.3 2001/08/13 16:26:17 ume Exp $ */ +/* $KAME: in6_pcb.h,v 1.13 2001/02/06 09:16:53 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +/* + * Copyright (c) 1982, 1986, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)in_pcb.h 8.1 (Berkeley) 6/10/93 + */ + +/* +modification history +-------------------- +01f,29jul05,vvv added include for in_pcb.h to fix build issue +01e,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +01d,07feb05,vvv _KERNEL cleanup +01c,20nov03,niq Remove copyright_wrs.h file inclusion +01b,01feb03,pas merge from FreeBSD 4.7 - added in_pcbpurgeif0() +01a,06sep01,ppp Created from FreeBSD 4.3 +*/ + +#ifndef _NETINET6_IN6_PCB_H_ +#define _NETINET6_IN6_PCB_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef _WRS_KERNEL +#define satosin6(sa) ((struct sockaddr_in6 *)(sa)) +#define sin6tosa(sin6) ((struct sockaddr *)(sin6)) +#define ifatoia6(ifa) ((struct in6_ifaddr *)(ifa)) + +void in6_pcbpurgeif0 __P((struct in6pcb *, struct ifnet *)); +void in6_losing __P((struct inpcb *)); +int in6_pcbbind __P((struct inpcb *, struct sockaddr *, struct proc *)); +int in6_pcbconnect __P((struct inpcb *, struct sockaddr *, struct proc *)); +void in6_pcbdetach __P((struct inpcb *)); +void in6_pcbdisconnect __P((struct inpcb *)); +int in6_pcbladdr __P((struct inpcb *, struct sockaddr *, + struct in6_addr **)); +struct inpcb *in6_pcblookup_local __P((struct inpcbinfo *, + struct in6_addr *, u_int, int)); +struct inpcb *in6_pcblookup_hash __P((struct inpcbinfo *, + struct in6_addr *, u_int, struct in6_addr *, + u_int, int, struct ifnet *)); +void in6_pcbnotify __P((struct inpcbhead *, struct sockaddr *, u_int, + struct sockaddr *, u_int, int, void *, + void (*)(struct inpcb *, int))); +void in6_rtchange __P((struct inpcb *, int)); +int in6_setpeeraddr __P((struct socket *so, struct sockaddr **nam)); +int in6_setsockaddr __P((struct socket *so, struct sockaddr **nam)); +int in6_mapped_sockaddr __P((struct socket *so, struct sockaddr **nam)); +int in6_mapped_peeraddr __P((struct socket *so, struct sockaddr **nam)); +int in6_selecthlim __P((struct in6pcb *, struct ifnet *)); +int in6_pcbsetport __P((struct in6_addr *, struct inpcb *, struct proc *)); +void init_sin6 __P((struct sockaddr_in6 *sin6, struct mbuf *m)); +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_NETINET6_IN6_PCB_H_ */ diff --git a/h/wrn/coreip/netinet6/in6_var.h b/h/wrn/coreip/netinet6/in6_var.h new file mode 100644 index 0000000..f06b865 --- /dev/null +++ b/h/wrn/coreip/netinet6/in6_var.h @@ -0,0 +1,843 @@ +/* in6_var.h - IPv6 interface definitions */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* $KAME: in6_var.h,v 1.107 2005/03/14 08:53:36 suz Exp $ */ +/* $KAME: in6_var.h,v 1.103 2004/08/17 10:18:58 jinmei Exp $ */ +/* $FreeBSD: src/sys/netinet6/in6_var.h,v 1.3.2.3 2002/04/28 05:40:27 suz Exp $ */ +/* $KAME: in6_var.h,v 1.56 2001/03/29 05:34:31 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Copyright (c) 1985, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)in_var.h 8.1 (Berkeley) 6/10/93 + */ + +/* +modification history +-------------------- +01p,25jun05,dlk Add ip6intrqJob declaration. +01o,20jun05,kch Do not guard IN6_IFF_HOME and IN6_IFF_DEREGISTERING defines + with MIP6 build flag. +01n,24may05,vvv updated for Kame merge +01m,13may05,nee Add a IPv6 address flag IN6_IFF_SUBNETANYCAST. +01o,10may05,kch Merged from Kame v 1.107. +01n,28apr05,kch Moved addrsel_policyent structure definition here from + in6_src.c. +01m,20apr05,kch Merged from comp_wn_ipv6_mld_interim-dev branch. +01l,16mar05,nee Add SIOCSIFINFO_IN6 +01k,07feb05,vvv _KERNEL cleanup +01j,25jan05,vvv fixed bitfield definitions (SPR #92171) +01i,21nov03,vvv protected in6_prflags and in6_rrenumreq structures with INET6 +01h,20nov03,niq Remove copyright_wrs.h file inclusion +01g,05nov03,cdw Removal of unnecessary _KERNEL guards. +01f,04nov03,rlm Ran batch header path update for header re-org. +01e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01d,12aug03,nee Merging from label ACCORDION_BASE6_MERGE_BASELINE in + accordion codeline to Base6 +01c,10jun03,vvv include netVersion.h +01b,30apr03,syy Added #ifdef for __cplusplus +01a,24jun02,ism created new structure to hold the IPv6 MIB information +*/ + +#ifndef _NETINET6_IN6_VAR_H_ +#define _NETINET6_IN6_VAR_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef _WRS_KERNEL +#include /* needed for struct ifaddr */ +#else +#include /* needed for IFNAMSIZ */ +#endif + +/* + * Interface address, Internet version. One of these structures + * is allocated for each interface with an Internet address. + * The ifaddr structure contains the protocol-independent part + * of the structure and is assumed to be first. + */ + +/* + * pltime/vltime are just for future reference (required to implements 2 + * hour rule for hosts). they should never be modified by nd6_timeout or + * anywhere else. + * userland -> kernel: accept pltime/vltime + * kernel -> userland: throw up everything + * in kernel: modify preferred/expire only + */ +struct in6_addrlifetime { + time_t ia6t_expire; /* valid lifetime expiration time */ + time_t ia6t_preferred; /* preferred lifetime expiration time */ + u_int32_t ia6t_vltime; /* valid lifetime */ + u_int32_t ia6t_pltime; /* prefix lifetime */ +}; + +struct nd_ifinfo; +struct scope6_id; +struct in6_ifextra { + struct in6_ifstat *in6_ifstat; + struct icmp6_ifstat *icmp6_ifstat; + struct nd_ifinfo *nd_ifinfo; + struct scope6_id *scope6_id; +}; + +#ifdef MIP6 +LIST_HEAD(mip6_bul_list, mip6_bul_internal); /* XXX */ +#endif /* MIPS6 */ + +#ifdef _WRS_KERNEL +struct in6_ifaddr { + struct ifaddr ia_ifa; /* protocol-independent info */ +#define ia_ifp ia_ifa.ifa_ifp +#define ia_flags ia_ifa.ifa_flags + struct sockaddr_in6 ia_addr; /* interface address */ + struct sockaddr_in6 ia_net; /* network number of interface */ + struct sockaddr_in6 ia_dstaddr; /* space for destination addr */ + struct sockaddr_in6 ia_prefixmask; /* prefix mask */ + u_int32_t ia_plen; /* prefix length */ + struct in6_ifaddr *ia_next; /* next in6 list of IP6 addresses */ + int ia6_flags; + + struct in6_addrlifetime ia6_lifetime; + time_t ia6_createtime; /* the creation time of this address, which is + * currently used for temporary addresses only. + */ + time_t ia6_updatetime; + + /* back pointer to the ND prefix (for autoconfigured addresses only) */ + struct nd_prefix *ia6_ndpr; + + /* multicast addresses joined from the kernel */ + LIST_HEAD(, in6_multi_mship) ia6_memberships; + +#ifdef MIP6 + /* binding update entreis for this address */ + struct mip6_bul_list ia6_mbul_list; +#endif /* MIP6 */ +}; +#endif + +/* control structure to manage address selection policy */ +struct in6_addrpolicy { + struct sockaddr_in6 addr; /* prefix address */ + struct sockaddr_in6 addrmask; /* prefix mask */ + int preced; /* precedence */ + int label; /* matching label */ + u_quad_t use; /* statistics */ +}; + +/* + * The followings are implementation of the policy table using a + * simple tail queue. + * XXX such details should be hidden. + * XXX implementation using binary tree should be more efficient. + * This structure definition is moved from in6_src.c for + * virtualization needs. + */ +TAILQ_HEAD(addrsel_policyhead, addrsel_policyent); +struct addrsel_policyent { + TAILQ_ENTRY(addrsel_policyent) ape_entry; + struct in6_addrpolicy ape_policy; +}; + +/* + * IPv6 interface statistics, as defined in RFC2465 Ipv6IfStatsEntry (p12). + */ +struct in6_ifstat { + u_quad_t ifs6_in_receive; /* # of total input datagram */ + u_quad_t ifs6_in_hdrerr; /* # of datagrams with invalid hdr */ + u_quad_t ifs6_in_toobig; /* # of datagrams exceeded MTU */ + u_quad_t ifs6_in_noroute; /* # of datagrams with no route */ + u_quad_t ifs6_in_addrerr; /* # of datagrams with invalid dst */ + u_quad_t ifs6_in_protounknown; /* # of datagrams with unknown proto */ + /* NOTE: increment on final dst if */ + u_quad_t ifs6_in_truncated; /* # of truncated datagrams */ + u_quad_t ifs6_in_discard; /* # of discarded datagrams */ + /* NOTE: fragment timeout is not here */ + u_quad_t ifs6_in_deliver; /* # of datagrams delivered to ULP */ + /* NOTE: increment on final dst if */ + u_quad_t ifs6_out_forward; /* # of datagrams forwarded */ + /* NOTE: increment on outgoing if */ + u_quad_t ifs6_out_request; /* # of outgoing datagrams from ULP */ + /* NOTE: does not include forwrads */ + u_quad_t ifs6_out_discard; /* # of discarded datagrams */ + u_quad_t ifs6_out_fragok; /* # of datagrams fragmented */ + u_quad_t ifs6_out_fragfail; /* # of datagrams failed on fragment */ + u_quad_t ifs6_out_fragcreat; /* # of fragment datagrams */ + /* NOTE: this is # after fragment */ + u_quad_t ifs6_reass_reqd; /* # of incoming fragmented packets */ + /* NOTE: increment on final dst if */ + u_quad_t ifs6_reass_ok; /* # of reassembled packets */ + /* NOTE: this is # after reass */ + /* NOTE: increment on final dst if */ + u_quad_t ifs6_reass_fail; /* # of reass failures */ + /* NOTE: may not be packet count */ + /* NOTE: increment on final dst if */ + u_quad_t ifs6_in_mcast; /* # of inbound multicast datagrams */ + u_quad_t ifs6_out_mcast; /* # of outbound multicast datagrams */ +}; + +/* +* IPv6 Interface table, as defined in RFC 2465 Ipv6IfEntry +*/ +#define DISPLAY_STR_SIZE 256 +#define MAX_OID_SIZE 40 +#define IF_IDENT_SIZE 8 +#define MAX_PHY_ADDR_SIZE 16 + +struct in6_ifinfo { + int ipv6IfIndex; + char ipv6IfDescr[DISPLAY_STR_SIZE]; + unsigned char ipv6IfLowerLayer[MAX_OID_SIZE] ; + int ipv6IfLowerLayerLength; + u_int32_t ipv6IfEffectiveMtu ; + u_int32_t ipv6IfReasmMaxSize ; + char ipv6IfIdentifier[IF_IDENT_SIZE]; + int ipv6IfIdentifierLength ; + unsigned char ipv6IfPhysicalAddress[MAX_PHY_ADDR_SIZE] ; + int ipv6IfPhysicalAddressLen; + int ipv6IfAdminStatus ; + int ipv6IfOperStatus ; + u_int ipv6IfLastChange ; +}; + +/* Note that the in6_ifdata data structure is used by m2Ipv6IfTblEntryGet() + * and m2Ipv6IfTblEntrySet() only and may be obsolete in the future. The + * global _in6_ifdata is defunct. + * + * Revisit: RFC2465 defines ipv6IfEntry and ipv6IfStatsEntry as two separate + * tables. One the other hand, the m2Ipv6IfTblEntryGet() and + * m2Ipv6IfTblEntrySet() routine are used to manage both tables. From SNMP + * operation point of view, the Stub routine always make two separate calls + * if, for example, it needs to retrieve information for a given entry in both + * the ipv6IfEntry and ipv6IfStatsEntry. The m2Ipv6IfTblEntryGet(), however, + * always returns informtion for both the ipv6IfEntry and ipv6IfStatsEntry. + * So we should re-examine the API and perhaps consider implementing two sets + * of GET/SET APIs - one for ipv6IfEntry and the other for ipv6IfStatsEntry. + */ +struct in6_ifdata { + struct in6_ifinfo ifInfo; + struct in6_ifstat ifStat; +}; + +/* + * ICMPv6 interface statistics, as defined in RFC2466 Ipv6IfIcmpEntry. + * XXX: I'm not sure if this file is the right place for this structure... + */ +struct icmp6_ifstat { + /* + * Input statistics + */ + /* ipv6IfIcmpInMsgs, total # of input messages */ + u_quad_t ifs6_in_msg; + /* ipv6IfIcmpInErrors, # of input error messages */ + u_quad_t ifs6_in_error; + /* ipv6IfIcmpInDestUnreachs, # of input dest unreach errors */ + u_quad_t ifs6_in_dstunreach; + /* ipv6IfIcmpInAdminProhibs, # of input administratively prohibited errs */ + u_quad_t ifs6_in_adminprohib; + /* ipv6IfIcmpInTimeExcds, # of input time exceeded errors */ + u_quad_t ifs6_in_timeexceed; + /* ipv6IfIcmpInParmProblems, # of input parameter problem errors */ + u_quad_t ifs6_in_paramprob; + /* ipv6IfIcmpInPktTooBigs, # of input packet too big errors */ + u_quad_t ifs6_in_pkttoobig; + /* ipv6IfIcmpInEchos, # of input echo requests */ + u_quad_t ifs6_in_echo; + /* ipv6IfIcmpInEchoReplies, # of input echo replies */ + u_quad_t ifs6_in_echoreply; + /* ipv6IfIcmpInRouterSolicits, # of input router solicitations */ + u_quad_t ifs6_in_routersolicit; + /* ipv6IfIcmpInRouterAdvertisements, # of input router advertisements */ + u_quad_t ifs6_in_routeradvert; + /* ipv6IfIcmpInNeighborSolicits, # of input neighbor solicitations */ + u_quad_t ifs6_in_neighborsolicit; + /* ipv6IfIcmpInNeighborAdvertisements, # of input neighbor advertisements */ + u_quad_t ifs6_in_neighboradvert; + /* ipv6IfIcmpInRedirects, # of input redirects */ + u_quad_t ifs6_in_redirect; + /* ipv6IfIcmpInGroupMembQueries, # of input MLD queries */ + u_quad_t ifs6_in_mldquery; + /* ipv6IfIcmpInGroupMembResponses, # of input MLD reports */ + u_quad_t ifs6_in_mldreport; + /* ipv6IfIcmpInGroupMembReductions, # of input MLD done */ + u_quad_t ifs6_in_mlddone; + + /* + * Output statistics. We should solve unresolved routing problem... + */ + /* ipv6IfIcmpOutMsgs, total # of output messages */ + u_quad_t ifs6_out_msg; + /* ipv6IfIcmpOutErrors, # of output error messages */ + u_quad_t ifs6_out_error; + /* ipv6IfIcmpOutDestUnreachs, # of output dest unreach errors */ + u_quad_t ifs6_out_dstunreach; + /* ipv6IfIcmpOutAdminProhibs, # of output administratively prohibited errs */ + u_quad_t ifs6_out_adminprohib; + /* ipv6IfIcmpOutTimeExcds, # of output time exceeded errors */ + u_quad_t ifs6_out_timeexceed; + /* ipv6IfIcmpOutParmProblems, # of output parameter problem errors */ + u_quad_t ifs6_out_paramprob; + /* ipv6IfIcmpOutPktTooBigs, # of output packet too big errors */ + u_quad_t ifs6_out_pkttoobig; + /* ipv6IfIcmpOutEchos, # of output echo requests */ + u_quad_t ifs6_out_echo; + /* ipv6IfIcmpOutEchoReplies, # of output echo replies */ + u_quad_t ifs6_out_echoreply; + /* ipv6IfIcmpOutRouterSolicits, # of output router solicitations */ + u_quad_t ifs6_out_routersolicit; + /* ipv6IfIcmpOutRouterAdvertisements, # of output router advertisements */ + u_quad_t ifs6_out_routeradvert; + /* ipv6IfIcmpOutNeighborSolicits, # of output neighbor solicitations */ + u_quad_t ifs6_out_neighborsolicit; + /* ipv6IfIcmpOutNeighborAdvertisements, # of output neighbor advertisements */ + u_quad_t ifs6_out_neighboradvert; + /* ipv6IfIcmpOutRedirects, # of output redirects */ + u_quad_t ifs6_out_redirect; + /* ipv6IfIcmpOutGroupMembQueries, # of output MLD queries */ + u_quad_t ifs6_out_mldquery; + /* ipv6IfIcmpOutGroupMembResponses, # of output MLD reports */ + u_quad_t ifs6_out_mldreport; + /* ipv6IfIcmpOutGroupMembReductions, # of output MLD done */ + u_quad_t ifs6_out_mlddone; +}; + +struct in6_ifreq { + char ifr_name[IFNAMSIZ]; + union { + struct sockaddr_in6 ifru_addr; + struct sockaddr_in6 ifru_dstaddr; + short ifru_flags; + int ifru_flags6; + int ifru_metric; + caddr_t ifru_data; + struct in6_addrlifetime ifru_lifetime; + struct in6_ifstat ifru_stat; + struct icmp6_ifstat ifru_icmp6stat; + u_int32_t ifru_scope_id[16]; + } ifr_ifru; +}; + +struct in6_aliasreq { + char ifra_name[IFNAMSIZ]; + struct sockaddr_in6 ifra_addr; + struct sockaddr_in6 ifra_dstaddr; + struct sockaddr_in6 ifra_prefixmask; + int ifra_flags; + struct in6_addrlifetime ifra_lifetime; +}; + +#ifdef _WRS_KERNEL +/* prefix type macro */ +#define IN6_PREFIX_ND 1 +#define IN6_PREFIX_RR 2 + +#ifdef INET6 +/* + * prefix related flags passed between kernel(NDP related part) and + * user land command(ifconfig) and daemon(rtadvd). + * Note: We originally intended to use prf_ra{} only within in6_prflags{}, but + * it was (probably unintentionally) used in nd6.h as well. Since C++ does + * not allow such a reference, prf_ra{} was then moved outside. In general, + * however, this structure should not be used directly. + * + * NOTE: All the bitfield definitions should be u_int, not u_char to make it + * ANSI compliant. Future versions of the Diab compiler will flag this as an + * error so it should be fixed. Therefore, the following prf_ra struct from + * Kame will not be used. + */ +#if 0 +struct prf_ra { + u_char onlink : 1; + u_char autonomous : 1; + u_char router : 1; + u_char reserved : 5; +}; +#endif + +struct in6_prflags { + u_char prf_ra; +#define PRF_RA_ONLINK 1 +#define PRF_RA_AUTONOMOUS 2 + u_char prf_reserved1; + u_short prf_reserved2; + + /* want to put this on 4byte offset */ + + u_char prf_rr; +#define PRF_RR_DECRVALID 1 +#define PRF_RR_DECRPREFD 2 + u_char prf_reserved3; + u_short prf_reserved4; +}; + +struct in6_prefixreq { + char ipr_name[IFNAMSIZ]; + u_char ipr_origin; + u_char ipr_plen; + u_int32_t ipr_vltime; + u_int32_t ipr_pltime; + struct in6_prflags ipr_flags; + struct sockaddr_in6 ipr_prefix; +}; +#endif /* INET6 */ + +#define PR_ORIG_RA 0 +#define PR_ORIG_RR 1 +#define PR_ORIG_STATIC 2 +#define PR_ORIG_KERNEL 3 + +#define ipr_raf ipr_flags.prf_ra + +#define ipr_statef_onlink ipr_flags.prf_state.onlink + +#define ipr_rrf ipr_flags.prf_rr + +#ifdef INET6 +struct in6_rrenumreq { + char irr_name[IFNAMSIZ]; + u_char irr_origin; + u_char irr_m_len; /* match len for matchprefix */ + u_char irr_m_minlen; /* minlen for matching prefix */ + u_char irr_m_maxlen; /* maxlen for matching prefix */ + u_char irr_u_uselen; /* uselen for adding prefix */ + u_char irr_u_keeplen; /* keeplen from matching prefix */ + u_char irr_raflagmask; +#define IRR_RAFLAGMASK_ONLINK PRF_RA_ONLINK +#define IRR_RAFLAGMASK_AUTONOMOUS PRF_RA_AUTONOMOUS + + u_int32_t irr_vltime; + u_int32_t irr_pltime; + struct in6_prflags irr_flags; + struct sockaddr_in6 irr_matchprefix; + struct sockaddr_in6 irr_useprefix; +}; +#endif /* INET6 */ + +#define irr_raf_mask irr_raflagmask + +#define irr_raf irr_flags.prf_ra + +#define irr_statef_onlink irr_flags.prf_state.onlink + +#define irr_rrf irr_flags.prf_rr + +/* + * Given a pointer to an in6_ifaddr (ifaddr), + * return a pointer to the addr as a sockaddr_in6 + */ +#define IA6_IN6(ia) (&((ia)->ia_addr.sin6_addr)) +#define IA6_DSTIN6(ia) (&((ia)->ia_dstaddr.sin6_addr)) +#define IA6_MASKIN6(ia) (&((ia)->ia_prefixmask.sin6_addr)) +#define IA6_SIN6(ia) (&((ia)->ia_addr)) +#define IA6_DSTSIN6(ia) (&((ia)->ia_dstaddr)) +#define IFA_IN6(x) (&((struct sockaddr_in6 *)((x)->ifa_addr))->sin6_addr) +#define IFA_DSTIN6(x) (&((struct sockaddr_in6 *)((x)->ifa_dstaddr))->sin6_addr) + +#define IN6_ARE_MASKED_ADDR_EQUAL(d, a, m) ( \ + (((d)->s6_addr32[0] ^ (a)->s6_addr32[0]) & (m)->s6_addr32[0]) == 0 && \ + (((d)->s6_addr32[1] ^ (a)->s6_addr32[1]) & (m)->s6_addr32[1]) == 0 && \ + (((d)->s6_addr32[2] ^ (a)->s6_addr32[2]) & (m)->s6_addr32[2]) == 0 && \ + (((d)->s6_addr32[3] ^ (a)->s6_addr32[3]) & (m)->s6_addr32[3]) == 0 ) +#endif /* _WRS_KERNEL */ + +#define SIOCSIFADDR_IN6 _IOW('i', 12, struct in6_ifreq) +#define SIOCGIFADDR_IN6 _IOWR('i', 33, struct in6_ifreq) + +#ifdef _WRS_KERNEL +/* + * SIOCSxxx ioctls should be unused (see comments in in6.c), but + * we do not shift numbers for binary compatibility. + */ +#define SIOCSIFDSTADDR_IN6 _IOW('i', 14, struct in6_ifreq) +#define SIOCSIFNETMASK_IN6 _IOW('i', 22, struct in6_ifreq) +#endif + +#define SIOCGIFDSTADDR_IN6 _IOWR('i', 34, struct in6_ifreq) +#define SIOCGIFNETMASK_IN6 _IOWR('i', 37, struct in6_ifreq) + +#define SIOCDIFADDR_IN6 _IOW('i', 25, struct in6_ifreq) +#define SIOCAIFADDR_IN6 _IOW('i', 26, struct in6_aliasreq) + +#define SIOCSIFPHYADDR_IN6 _IOW('i', 70, struct in6_aliasreq) +#define SIOCGIFPSRCADDR_IN6 _IOWR('i', 71, struct in6_ifreq) +#define SIOCGIFPDSTADDR_IN6 _IOWR('i', 72, struct in6_ifreq) +#define SIOCSIFPHYNEXTHOP_IN6 _IOW('i', 140, struct in6_ifreq) /* set gif addres */ +#define SIOCGIFPHYNEXTHOP_IN6 _IOWR('i', 141, struct in6_ifreq) /* get gif nexthop addres */ + + +#define SIOCGIFAFLAG_IN6 _IOWR('i', 73, struct in6_ifreq) + +#define SIOCGDRLST_IN6 _IOWR('i', 74, struct in6_drlist) +#define SIOCGPRLST_IN6 _IOWR('i', 75, struct in6_oprlist) + +#ifdef _WRS_KERNEL +#define OSIOCGIFINFO_IN6 _IOWR('i', 76, struct in6_ondireq) +#endif +#define SIOCGIFINFO_IN6 _IOWR('i', 108, struct in6_ndireq) +#define SIOCSIFINFO_IN6 _IOWR('i', 109, struct in6_ndireq) +#define SIOCSNDFLUSH_IN6 _IOWR('i', 77, struct in6_ifreq) +#define SIOCGNBRINFO_IN6 _IOWR('i', 78, struct in6_nbrinfo) +#define SIOCSPFXFLUSH_IN6 _IOWR('i', 79, struct in6_ifreq) +#define SIOCSRTRFLUSH_IN6 _IOWR('i', 80, struct in6_ifreq) + +#define SIOCGIFALIFETIME_IN6 _IOWR('i', 81, struct in6_ifreq) +#define SIOCSIFALIFETIME_IN6 _IOWR('i', 82, struct in6_ifreq) +#define SIOCGIFSTAT_IN6 _IOWR('i', 83, struct in6_ifreq) +#define SIOCGIFSTAT_ICMP6 _IOWR('i', 84, struct in6_ifreq) + +#define SIOCSDEFIFACE_IN6 _IOWR('i', 85, struct in6_ndifreq) +#define SIOCGDEFIFACE_IN6 _IOWR('i', 86, struct in6_ndifreq) + +#define SIOCSIFINFO_FLAGS _IOWR('i', 87, struct in6_ndireq) /* XXX */ + +#define SIOCSSCOPE6 _IOW('i', 88, struct in6_ifreq) +#define SIOCGSCOPE6 _IOWR('i', 89, struct in6_ifreq) +#define SIOCGSCOPE6DEF _IOWR('i', 90, struct in6_ifreq) + +#define SIOCSIFPREFIX_IN6 _IOW('i', 100, struct in6_prefixreq) /* set */ +#define SIOCGIFPREFIX_IN6 _IOWR('i', 101, struct in6_prefixreq) /* get */ +#define SIOCDIFPREFIX_IN6 _IOW('i', 102, struct in6_prefixreq) /* del */ +#define SIOCAIFPREFIX_IN6 _IOW('i', 103, struct in6_rrenumreq) /* add */ +#define SIOCCIFPREFIX_IN6 _IOW('i', 104, \ + struct in6_rrenumreq) /* change */ +#define SIOCSGIFPREFIX_IN6 _IOW('i', 105, \ + struct in6_rrenumreq) /* set global */ + +#define SIOCGETSGCNT_IN6 _IOWR('u', 106, \ + struct sioc_sg_req6) /* get s,g pkt cnt */ +#define SIOCGETMIFCNT_IN6 _IOWR('u', 107, \ + struct sioc_mif_req6) /* get pkt cnt per if */ + +#define SIOCAADDRCTL_POLICY _IOW('u', 108, struct in6_addrpolicy) +#define SIOCDADDRCTL_POLICY _IOW('u', 109, struct in6_addrpolicy) + +#define IN6_IFF_ANYCAST 0x01 /* anycast address */ +#define IN6_IFF_TENTATIVE 0x02 /* tentative address */ +#define IN6_IFF_DUPLICATED 0x04 /* DAD detected duplicate */ +#define IN6_IFF_DETACHED 0x08 /* may be detached from the link */ +#define IN6_IFF_DEPRECATED 0x10 /* deprecated address */ +#define IN6_IFF_NODAD 0x20 /* don't perform DAD on this address + * (used only at first SIOC* call) + */ +#define IN6_IFF_AUTOCONF 0x40 /* autoconfigurable address. */ +#define IN6_IFF_TEMPORARY 0x80 /* temporary (anonymous) address. */ + +#define IN6_IFF_HOME 0x100 /* MIP6:home address */ +#define IN6_IFF_DEREGISTERING 0x200 /* MIP6:deregistering address */ + +#define IN6_IFF_SUBNETANYCAST 0x4000 /* subnet anycast address */ + +/* do not input/output */ +#define IN6_IFF_NOTREADY (IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED) + +/* flags which cannot be changed by hand */ +#ifndef MIP6 +#define IN6_IFF_READONLY (IN6_IFF_DUPLICATED|IN6_IFF_DETACHED|\ + IN6_IFF_NODAD|IN6_IFF_TEMPORARY) +#else +/* Mobile IPv6 userland program requires to assign an address with NODAD. */ +#define IN6_IFF_READONLY (IN6_IFF_DUPLICATED|IN6_IFF_DETACHED|\ + IN6_IFF_TEMPORARY) +#endif /* !MIP6 */ + +#ifdef _WRS_KERNEL +#define IN6_ARE_SCOPE_CMP(a,b) ((a)-(b)) +#define IN6_ARE_SCOPE_EQUAL(a,b) ((a)==(b)) + +#ifndef VIRTUAL_STACK +extern struct in6_ifaddr *_in6_ifaddr; +extern struct icmp6stat _icmp6stat; +#endif /*VIRTUAL_STACK*/ +#define in6_ifstat_inc(ifp, tag) \ +do { \ + if (ifp) \ + ((struct in6_ifextra *)((ifp)->if_afdata[AF_INET6]))->in6_ifstat->tag++; \ +} while (0) + +extern struct ifqueue ip6intrq; /* IP6 packet input queue (loopback) */ +extern INTRQ_QJOB ip6intrqJob; +extern struct in6_addr zeroin6_addr; +extern u_char inet6ctlerrmap[]; +extern unsigned long in6_maxmtu; + +/* + * Macro for finding the internet address structure (in6_ifaddr) corresponding + * to a given interface (ifnet structure). + */ +#define IFP_TO_IA6(ifp, ia) \ +/* struct ifnet *ifp; */ \ +/* struct in6_ifaddr *ia; */ \ +do { \ + struct ifaddr *ifa; \ + for (ifa = (ifp)->if_addrlist.tqh_first; ifa; ifa = ifa->ifa_list.tqe_next) { \ + if (!ifa->ifa_addr) \ + continue; \ + if (ifa->ifa_addr->sa_family == AF_INET6) \ + break; \ + } \ + (ia) = (struct in6_ifaddr *)ifa; \ +} while (0) + + +/* + * Multi-cast membership entry. One for each group/ifp that a PCB + * belongs to. + */ +struct in6_multi_mship { + struct in6_multi *i6mm_maddr; /* Multicast address pointer */ + struct sock_msf *i6mm_msf; /* Multicast source filters */ + LIST_ENTRY(in6_multi_mship) i6mm_chain; /* multicast options chain */ +}; + +/* + * Per-interface router version information; referred to when MLDv1/v2 coexists. + */ + +struct router6_info { + struct ifnet *rt6i_ifp; + int rt6i_type; /* type of router which is querier on this interface */ + u_int rt6i_timer1; /* MLDv1 Querier Present timer */ + u_int rt6i_timer2; /* MLDv2 Querier Present timer */ + u_int rt6i_qrv; /* Querier Robustness Variable */ + u_int rt6i_qqi; /* Querier Interval Variable */ + u_int rt6i_qri; /* Querier Response Interval */ + struct router6_info *rt6i_next; +}; + +struct callout; +struct in6_multi { + LIST_ENTRY(in6_multi) in6m_entry; /* list glue */ + struct in6_addr in6m_addr; /* IP6 multicast address */ + struct ifnet *in6m_ifp; /* back pointer to ifnet */ + struct ifmultiaddr *in6m_ifma; /* back pointer to ifmultiaddr */ + u_int in6m_refcount; /* # membership claims by sockets */ + u_int in6m_state; /* state of the membership */ + struct router6_info *in6m_rti; /* router info */ + struct in6_multi_source *in6m_source; /* filtered source list */ + +#ifdef MLDv2 + u_int in6m_timer; /* MLD6 listener report timer */ +#else + int in6m_timer; /* delay to send the 1st report */ + struct timeval in6m_timer_expire; /* when the timer expires */ + struct callout *in6m_timer_ch; +#endif +}; + +#define IN6M_TIMER_UNDEF -1 + +/* flags to in6_update_ifa */ +#define IN6_IFAUPDATE_DADDELAY 0x1 /* first time to configure an address */ + +extern LIST_HEAD(in6_multihead, in6_multi) _in6_multihead; + +/* + * Structure used by macros below to remember position when stepping through + * all of the in6_multi records. + */ +struct in6_multistep { + struct in6_ifaddr *i_ia; + struct in6_multi *i_in6m; +}; + +/* + * Macros for looking up the in6_multi record for a given IP6 multicast + * address on a given interface. If no matching record is found, "in6m" + * returns NULL. + */ + +#define IN6_LOOKUP_MULTI(addr, ifp, in6m) \ +/* struct in6_addr addr; */ \ +/* struct ifnet *ifp; */ \ +/* struct in6_multi *in6m; */ \ +do { \ + struct ifmultiaddr *ifma; \ + for (ifma = (ifp)->if_multiaddrs.lh_first; ifma; \ + ifma = ifma->ifma_link.le_next) { \ + if (ifma->ifma_addr->sa_family == AF_INET6 \ + && IN6_ARE_ADDR_EQUAL(&((struct sockaddr_in6 *)ifma->ifma_addr)->sin6_addr, \ + &(addr))) \ + break; \ + } \ + (in6m) = (struct in6_multi *)(ifma ? ifma->ifma_protospec : 0); \ +} while(0) + +/* + * Macro to step through all of the in6_multi records, one at a time. + * The current position is remembered in "step", which the caller must + * provide. IN6_FIRST_MULTI(), below, must be called to initialize "step" + * and get the first record. Both macros return a NULL "in6m" when there + * are no remaining records. + */ +#define IN6_NEXT_MULTI(step, in6m) \ +/* struct in6_multistep step; */ \ +/* struct in6_multi *in6m; */ \ +do { \ + if (((in6m) = (step).i_in6m) != NULL) \ + (step).i_in6m = (step).i_in6m->in6m_entry.le_next; \ +} while(0) + +#define IN6_FIRST_MULTI(step, in6m) \ +/* struct in6_multistep step; */ \ +/* struct in6_multi *in6m */ \ +do { \ + (step).i_in6m = _in6_multihead.lh_first; \ + IN6_NEXT_MULTI((step), (in6m)); \ +} while(0) + +/* + * Macros for looking up the in6_multi_mship record for a given IP6 multicast + * address on a given interface. If no matching record is found, "imm" + * returns NULL. + */ +#define IN6_LOOKUP_MSHIP(addr, ifp, imop, imm) \ +/* struct in6_addr addr; */ \ +/* struct ifnet *ifp; */ \ +/* struct ip6_moptions *imop */ \ +/* struct in6_multi_mship *imm; */ \ +do { \ + for ((imm) = (imop)->im6o_memberships.lh_first; \ + (imm) != NULL; (imm) = (imm)->i6mm_chain.le_next) { \ + if ((imm)->i6mm_maddr->in6m_ifp != (ifp)) \ + continue; \ + if (!IN6_ARE_ADDR_EQUAL(&(imm)->i6mm_maddr->in6m_addr, \ + &(addr))) \ + continue; \ + break; \ + } \ +} while (/*CONSTCOND*/ 0) + + + + + + + + + +struct in6_multi *in6_addmulti __P((struct in6_addr *, + struct ifnet *, int *, int)); +void in6_delmulti __P((struct in6_multi *)); +struct in6_multi_mship *in6_joingroup __P((struct ifnet *, + struct in6_addr *, int *, int)); +int in6_leavegroup __P((struct in6_multi_mship *)); +#ifdef MLDV2 +struct in6_multi *in6_addmulti2(struct in6_addr *, struct ifnet *, + int *, u_int16_t, struct sockaddr_storage *, u_int, int); +void in6_delmulti2(struct in6_multi *, int *, u_int16_t, + struct sockaddr_storage *, u_int, int); +struct in6_multi *in6_modmulti2(struct in6_addr *, struct ifnet *, + int *, u_int16_t, struct sockaddr_storage *, u_int, u_int16_t, + struct sockaddr_storage *, u_int, int, u_int); +#endif + +int in6_mask2len __P((struct in6_addr *, u_char *)); +extern void in6_len2mask __P((struct in6_addr *, int)); +int in6_control __P((struct socket *, + u_long, caddr_t, struct ifnet *, struct proc *)); +int in6_update_ifa __P((struct ifnet *, struct in6_aliasreq *, + struct in6_ifaddr *, int)); +void in6_purgeaddr __P((struct ifaddr *)); +int in6if_do_dad __P((struct ifnet *)); +void in6_purgeif __P((struct ifnet *)); +void in6_savemkludge __P((struct in6_ifaddr *)); +void in6_setmaxmtu __P((void)); +int in6_if2idlen __P((struct ifnet *)); +void in6_restoremkludge __P((struct in6_ifaddr *, struct ifnet *)); +void in6_createmkludge __P((struct ifnet *)); +void in6_purgemkludge __P((struct ifnet *)); +struct in6_ifaddr *in6ifa_ifpforlinklocal __P((struct ifnet *, int)); +struct in6_ifaddr *in6ifa_ifpwithaddr __P((struct ifnet *, struct in6_addr *)); +char *ip6_sprintf __P((const struct in6_addr *)); +int in6_addr2zoneid __P((struct ifnet *, struct in6_addr *, u_int32_t *)); +int in6_matchlen __P((struct in6_addr *, struct in6_addr *)); +int in6_are_prefix_equal __P((struct in6_addr *, struct in6_addr *, int)); +void in6_prefixlen2mask __P((struct in6_addr *, int)); +void in6_purgeprefix __P((struct ifnet *)); + +int in6_embedscope __P((struct in6_addr *, const struct sockaddr_in6 *)); +int in6_recoverscope __P((struct sockaddr_in6 *, const struct in6_addr *, + struct ifnet *)); +void in6_clearscope __P((struct in6_addr *)); +int in6_src_ioctl __P((u_long, caddr_t)); + +void *in6_ifafdata_init(struct ifnet *); +void in6_ifafdata_delete(struct ifnet *); + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* _NETINET6_IN6_VAR_H_ */ diff --git a/h/wrn/coreip/netinet6/ip6.h b/h/wrn/coreip/netinet6/ip6.h new file mode 100644 index 0000000..d10230b --- /dev/null +++ b/h/wrn/coreip/netinet6/ip6.h @@ -0,0 +1,411 @@ +/* ip6.h - IPv6 protocol definitions */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* $FreeBSD: src/sys/netinet/ip6.h,v 1.2.2.2 2001/07/03 11:01:46 ume Exp $ */ +/* $KAME: ip6.h,v 1.18 2001/03/29 05:34:30 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip.h 8.1 (Berkeley) 6/10/93 + */ + +/* +modification history +-------------------- +01k,21jun05,dlk Improve IP6_EXTHDR_CHECK() macro. +01j,03may05,rp removed __attribute__((__packed__)) +01i,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +01h,07feb05,vvv _KERNEL cleanup +01g,14jan05,vvv osdep.h cleanup +01f,20nov03,niq Remove copyright_wrs.h file inclusion +01e,05nov03,cdw Removal of unnecessary _KERNEL guards. +01d,04nov03,rlm Ran batch header path update for header re-org. +01c,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01b,11aug03,nee Merging from label ACCORDION_BASE6_MERGE_BASELINE in + accordion codeline to Base6 +01b,17feb02,pas EAR code cleanup +01a,01sep01,qli created +*/ + +#ifndef _NETINET_IP6_H_ +#define _NETINET_IP6_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * Definition for internet protocol version 6. + * RFC 2460 + */ + +struct ip6_hdr { + union { + struct ip6_hdrctl { + u_int32_t ip6_un1_flow; /* 20 bits of flow-ID */ + u_int16_t ip6_un1_plen; /* payload length */ + u_int8_t ip6_un1_nxt; /* next header */ + u_int8_t ip6_un1_hlim; /* hop limit */ + } ip6_un1; + u_int8_t ip6_un2_vfc; /* 4 bits version, top 4 bits class */ + } ip6_ctlun; + struct in6_addr ip6_src; /* source address */ + struct in6_addr ip6_dst; /* destination address */ +}; + +#define ip6_vfc ip6_ctlun.ip6_un2_vfc +#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow +#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen +#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt +#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim +#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim + +#define IPV6_VERSION 0x60 +#define IPV6_VERSION_MASK 0xf0 + +#if _BYTE_ORDER == _BIG_ENDIAN +#define IPV6_FLOWINFO_MASK 0x0fffffff /* flow info (28 bits) */ +#define IPV6_FLOWLABEL_MASK 0x000fffff /* flow label (20 bits) */ +#else +#if _BYTE_ORDER == _LITTLE_ENDIAN +#define IPV6_FLOWINFO_MASK 0xffffff0f /* flow info (28 bits) */ +#define IPV6_FLOWLABEL_MASK 0xffff0f00 /* flow label (20 bits) */ +#endif /* LITTLE_ENDIAN */ +#endif +#if 1 +/* ECN bits proposed by Sally Floyd */ +#define IP6TOS_CE 0x01 /* congestion experienced */ +#define IP6TOS_ECT 0x02 /* ECN-capable transport */ +#endif + +#ifdef _WRS_KERNEL +/* + * for IPv6 pseudo header checksum + * XXX nonstandard + */ +struct ip6_hdr_pseudo { + struct in6_addr ip6ph_src; + struct in6_addr ip6ph_dst; + u_int32_t ip6ph_len; + u_int8_t ip6ph_zero[3]; + u_int8_t ip6ph_nxt; +}; +#endif + +/* + * Extension Headers + */ + +struct ip6_ext { + u_int8_t ip6e_nxt; + u_int8_t ip6e_len; +}; + +/* Hop-by-Hop options header */ +/* XXX should we pad it to force alignment on an 8-byte boundary? */ +struct ip6_hbh { + u_int8_t ip6h_nxt; /* next header */ + u_int8_t ip6h_len; /* length in units of 8 octets */ + /* followed by options */ +}; + +/* Destination options header */ +/* XXX should we pad it to force alignment on an 8-byte boundary? */ +struct ip6_dest { + u_int8_t ip6d_nxt; /* next header */ + u_int8_t ip6d_len; /* length in units of 8 octets */ + /* followed by options */ +}; + +/* Option types and related macros */ +#define IP6OPT_PAD1 0x00 /* 00 0 00000 */ +#define IP6OPT_PADN 0x01 /* 00 0 00001 */ +#define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */ +#define IP6OPT_NSAP_ADDR 0xC3 /* 11 0 00011 */ +#define IP6OPT_TUNNEL_LIMIT 0x04 /* 00 0 00100 */ +#ifndef _WRS_KERNEL +#define IP6OPT_RTALERT 0x05 /* 00 0 00101 (KAME definition) */ +#endif +#define IP6OPT_ROUTER_ALERT 0x05 /* 00 0 00101 (RFC3542, recommended) */ + +#define IP6OPT_RTALERT_LEN 4 +#define IP6OPT_RTALERT_MLD 0 /* Datagram contains an MLD message */ +#define IP6OPT_RTALERT_RSVP 1 /* Datagram contains an RSVP message */ +#define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */ +#define IP6OPT_MINLEN 2 + +#define IP6OPT_HOME_ADDRESS 0xc9 /* 11 0 01001 */ +#define IP6OPT_EID 0x8a /* 10 0 01010 */ + +#define IP6OPT_TYPE(o) ((o) & 0xC0) +#define IP6OPT_TYPE_SKIP 0x00 +#define IP6OPT_TYPE_DISCARD 0x40 +#define IP6OPT_TYPE_FORCEICMP 0x80 +#define IP6OPT_TYPE_ICMP 0xC0 + +#define IP6OPT_MUTABLE 0x20 + +/* IPv6 options: common part */ +struct ip6_opt { + u_int8_t ip6o_type; + u_int8_t ip6o_len; +}; + +/* Jumbo Payload Option */ +struct ip6_opt_jumbo { + u_int8_t ip6oj_type; + u_int8_t ip6oj_len; + u_int8_t ip6oj_jumbo_len[4]; +}; +#define IP6OPT_JUMBO_LEN 6 + +/* NSAP Address Option */ +struct ip6_opt_nsap { + u_int8_t ip6on_type; + u_int8_t ip6on_len; + u_int8_t ip6on_src_nsap_len; + u_int8_t ip6on_dst_nsap_len; + /* followed by source NSAP */ + /* followed by destination NSAP */ +}; + +/* Tunnel Limit Option */ +struct ip6_opt_tunnel { + u_int8_t ip6ot_type; + u_int8_t ip6ot_len; + u_int8_t ip6ot_encap_limit; +}; + +/* Router Alert Option */ +struct ip6_opt_router { + u_int8_t ip6or_type; + u_int8_t ip6or_len; + u_int8_t ip6or_value[2]; +}; +/* Router alert values (in network byte order) */ +#if _BYTE_ORDER == _BIG_ENDIAN +#define IP6_ALERT_MLD 0x0000 +#define IP6_ALERT_RSVP 0x0001 +#define IP6_ALERT_AN 0x0002 +#else +#if _BYTE_ORDER == _LITTLE_ENDIAN +#define IP6_ALERT_MLD 0x0000 +#define IP6_ALERT_RSVP 0x0100 +#define IP6_ALERT_AN 0x0200 +#endif /* LITTLE_ENDIAN */ +#endif + +/* Home Address Option */ +struct ip6_opt_home_address { + u_int8_t ip6oh_type; + u_int8_t ip6oh_len; + u_int8_t ip6oh_addr[16];/* Home Address */ + /* followed by sub-options */ +}; + +/* Routing header */ +struct ip6_rthdr { + u_int8_t ip6r_nxt; /* next header */ + u_int8_t ip6r_len; /* length in units of 8 octets */ + u_int8_t ip6r_type; /* routing type */ + u_int8_t ip6r_segleft; /* segments left */ + /* followed by routing type specific data */ +}; + +/* Type 0 Routing header */ +struct ip6_rthdr0 { + u_int8_t ip6r0_nxt; /* next header */ + u_int8_t ip6r0_len; /* length in units of 8 octets */ + u_int8_t ip6r0_type; /* always zero */ + u_int8_t ip6r0_segleft; /* segments left */ + u_int32_t ip6r0_reserved; /* reserved field */ + /* followed by up to 127 struct in6_addr */ +}; + +/* Type 2 Routing header for Mobile IPv6 */ +struct ip6_rthdr2 { + u_int8_t ip6r2_nxt; /* next header */ + u_int8_t ip6r2_len; /* always 2 */ + u_int8_t ip6r2_type; /* always 2 */ + u_int8_t ip6r2_segleft; /* 0 or 1 */ + u_int32_t ip6r2_reserved; /* reserved field */ + /* followed by one struct in6_addr */ +}; + +/* Fragment header */ +struct ip6_frag { + u_int8_t ip6f_nxt; /* next header */ + u_int8_t ip6f_reserved; /* reserved field */ + u_int16_t ip6f_offlg; /* offset, reserved, and flag */ + u_int32_t ip6f_ident; /* identification */ +}; + +#if _BYTE_ORDER == _BIG_ENDIAN +#define IP6F_OFF_MASK 0xfff8 /* mask out offset from _offlg */ +#define IP6F_RESERVED_MASK 0x0006 /* reserved bits in ip6f_offlg */ +#define IP6F_MORE_FRAG 0x0001 /* more-fragments flag */ +#else /* BYTE_ORDER == LITTLE_ENDIAN */ +#define IP6F_OFF_MASK 0xf8ff /* mask out offset from _offlg */ +#define IP6F_RESERVED_MASK 0x0600 /* reserved bits in ip6f_offlg */ +#define IP6F_MORE_FRAG 0x0100 /* more-fragments flag */ +#endif /* BYTE_ORDER == LITTLE_ENDIAN */ + +/* + * Internet implementation parameters. + */ +#define IPV6_MAXHLIM 255 /* maximum hoplimit */ +#define IPV6_DEFHLIM 64 /* default hlim */ +#define IPV6_FRAGTTL 120 /* ttl for fragment packets, in slowtimo tick */ +#define IPV6_HLIMDEC 1 /* subtracted when forwarding */ + +#define IPV6_MMTU 1280 /* minimal MTU and reassembly. 1024 + 256 */ +#define IPV6_MAXPACKET 65535 /* ip6 max packet size without Jumbo payload*/ +#define IPV6_MAXOPTHDR 2048 /* max option header size, 256 64-bit words */ + +#ifdef _WRS_KERNEL +/* + * IP6_EXTHDR_CHECK ensures that region between the IP6 header and the + * target header (including IPv6 itself, extension headers and + * TCP/UDP/ICMP6 headers) are continuous. KAME requires drivers + * to store incoming data into one internal mbuf or one or more external + * mbufs (never into two or more internal mbufs). + */ + +#define IP6_EXTHDR_CHECK(m, off, hlen, ret) \ +do { \ + if ((m)->m_len < (off) + (hlen)) { \ + if ((m)->m_next != NULL) { \ + if (((m)->m_flags & M_LOOP) && \ + ((m) = m_pullup ((m), (off) + (hlen))) != NULL) \ + break; \ + ++_ip6stat.ip6s_exthdrtoolong; \ + } else { \ + ++_ip6stat.ip6s_tooshort; \ + in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); \ + } \ + m_freem(m); \ + return ret; \ + } \ +} while ((0)) + +/* + * IP6_EXTHDR_GET ensures that intermediate protocol header (from "off" to + * "len") is located in single mbuf, on contiguous memory region. + * The pointer to the region will be returned to pointer variable "val", + * with type "typ". + * IP6_EXTHDR_GET0 does the same, except that it aligns the structure at the + * very top of mbuf. GET0 is likely to make memory copy than GET. + * + * XXX we're now testing this, needs m_pulldown() + */ +#define IP6_EXTHDR_GET(val, typ, m, off, len) \ +do { \ + struct mbuf *t; \ + int tmp; \ + if ((m)->m_len >= (off) + (len)) \ + (val) = (typ)(mtod((m), caddr_t) + (off)); \ + else { \ + t = m_pulldown((m), (off), (len), &tmp); \ + if (t) { \ + if (t->m_len < tmp + (len)) \ + panic("m_pulldown malfunction"); \ + (val) = (typ)(mtod(t, caddr_t) + tmp); \ + } else { \ + (val) = (typ)NULL; \ + (m) = NULL; \ + } \ + } \ +} while (0) + +#define IP6_EXTHDR_GET0(val, typ, m, off, len) \ +do { \ + struct mbuf *t; \ + if ((off) == 0) \ + (val) = (typ)mtod(m, caddr_t); \ + else { \ + t = m_pulldown((m), (off), (len), NULL); \ + if (t) { \ + if (t->m_len < (len)) \ + panic("m_pulldown malfunction"); \ + (val) = (typ)mtod(t, caddr_t); \ + } else { \ + (val) = (typ)NULL; \ + (m) = NULL; \ + } \ + } \ +} while (0) +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* not _NETINET_IP6_H_ */ diff --git a/h/wrn/coreip/netinet6/ip6_ext_in.h b/h/wrn/coreip/netinet6/ip6_ext_in.h new file mode 100644 index 0000000..cdc83e7 --- /dev/null +++ b/h/wrn/coreip/netinet6/ip6_ext_in.h @@ -0,0 +1,80 @@ +/* ip6_ext_in.h - typedefs and externs for the external hooks + * used by the IPv6 stack on the input side + */ + +/* Copyright 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,26apr05,kch Added ipv6 multicast router hooks. +01b,20nov03,niq Remove copyright_wrs.h file inclusion +01a,07aug03,nee Merging to Base6 from ACCORDION_BASE6_MERGE_BASELINE label on + Accordion codeline + +*/ + +#ifndef __INCip6ExtInh +#define __INCip6ExtInh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This file contains typedefs for some of the hooks used by the IPv6 stack. + * The similar hooks used by the IPv4 stack can be found in a different file. + * The functions are separated in order to minimize the include files required + * to use all one set of functions. + */ + +/* We don't do anything except if IP6 is installed */ +#ifdef INET6 + +/* + * This is the general typedef for the input side for IPv6. + * It should be used by all hooks that don't require a more specific API. + */ + +typedef BOOL (*INPUT_HOOK_IPV6_FUNCPTR) (struct ifnet * rcvif, + struct mbuf ** m, + struct ip6_hdr ** ip); + + +#ifndef VIRTUAL_STACK +/* We only define the externals and macros here if we aren't supporting + * virtual stacks. If we are supporting them then the corresponding + * definitions are in vsIp6.h + */ + +/* + * Externals for the currently defined hooks + */ + +extern INPUT_HOOK_IPV6_FUNCPTR _ipFilterHookIPv6; +#define SET_IPFILTERHOOKIPV6(foo) (_ipFilterHookIPv6 = foo) + +/* ipv6 multicast router hooks */ +extern FUNCPTR _mCastRouteCmdHookIPv6; +extern FUNCPTR _mCastRouterIoctlHookIPv6; +extern FUNCPTR _mCastRouterDoneHookIPv6; +extern VOIDFUNCPTR _mCastRouterDetachHookIPv6; + +/* + * The IPSec hooks. + */ +extern INPUT_HOOK_IPV6_FUNCPTR _ipsecFilterHookIPv6; +extern INPUT_HOOK_IPV6_FUNCPTR _ipsecInputIPv6; + +#define SET_IPSECFILTERHOOKIPV6(foo) (_ipsecFilterHookIPv6 = foo) +#define SET_IPSECINPUTIPV6(foo) (_ipsecInputIPv6 = foo) + +#endif /* #ifndef VIRTUAL_STACK */ + +#endif /* INET6 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCip6ExtInh */ diff --git a/h/wrn/coreip/netinet6/ip6_ext_out.h b/h/wrn/coreip/netinet6/ip6_ext_out.h new file mode 100644 index 0000000..ba27dce --- /dev/null +++ b/h/wrn/coreip/netinet6/ip6_ext_out.h @@ -0,0 +1,69 @@ +/* ip6_ext_out.h - typedefs and externs for the external hooks + * used by the IPv6 stack on the output side */ + +/* Copyright 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,26apr05,kch Added ipv6 multicast forwarding hook. +01b,20nov03,niq Remove copyright_wrs.h file inclusion +01a,07aug03,nee Merging to Base6 from ACCORDION_BASE6_MERGE_BASELINE label on + Accordion codeline + +*/ + +#ifndef __INCip6ExtOuth +#define __INCip6ExtOuth + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This file contains typedefs for some of the hooks used by the IPv6 stack. + * The similar hooks used by the IPv4 stack can be found in a different file. + * The functions are separated in order to minimize the include files required + * to use all one set of functions. + */ + +#ifdef INET6 +/* We don't do anything if IP6 isn't installed */ + +typedef int (*IPSEC_OUTPUT_IPV6_FUNCPTR) (struct mbuf ** m, + struct ip6_pktopts * options, + struct route_in6 * ro, + int flags, + struct ip6_moptions * imo, + struct sockaddr_in6 * dest, + struct ifnet * ifp); + + +#ifndef VIRTUAL_STACK +/* We only define the externals and macros here if we aren't supporting + * virtual stacks. If we are supporting them then the corresponding + * definitions are in vsIp6.h + */ + +/* ipv6 multicast forwarding hook */ +extern FUNCPTR _mCastRouteFwdHookIPv6; + +/* + * Externals for the currently defined hooks. + */ +extern IPSEC_OUTPUT_IPV6_FUNCPTR _ipsecOutputIPv6; +extern IPSEC_OUTPUT_IPV6_FUNCPTR _ipsecForwardIPv6; + +#define SET_IPSECOUTPUTIPV6(foo) (_ipsecOutputIPv6 = foo) +#define SET_IPSECFORWARDIPV6(foo) (_ipsecForwardIPv6 = foo) + +#endif /* #ifndef VIRTUAL_STACK */ + +#endif /* INET6 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCip6ExtOuth */ + diff --git a/h/wrn/coreip/netinet6/ip6_mroute.h b/h/wrn/coreip/netinet6/ip6_mroute.h new file mode 100644 index 0000000..04ec2ab --- /dev/null +++ b/h/wrn/coreip/netinet6/ip6_mroute.h @@ -0,0 +1,304 @@ +/* ip6_mroute.h - IPv6 mroute header file */ + +/* $KAME: ip6_mroute.h,v 1.29 2004/05/21 08:17:58 itojun Exp $ */ +/* $FreeBSD: src/sys/netinet6/ip6_mroute.h,v 1.2.2.3 2002/04/28 05:40:27 suz Exp $ */ +/* $KAME: ip6_mroute.h,v 1.19 2001/06/14 06:12:55 suz Exp $ */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* + * Copyright (C) 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* BSDI ip_mroute.h,v 2.5 1996/10/11 16:01:48 pjd Exp */ + +/* + * Definitions for IP multicast forwarding. + * + * Written by David Waitzman, BBN Labs, August 1988. + * Modified by Steve Deering, Stanford, February 1989. + * Modified by Ajit Thyagarajan, PARC, August 1993. + * Modified by Ajit Thyagarajan, PARC, August 1994. + * Modified by Ahmed Helmy, USC, September 1996. + * + * MROUTING Revision: 1.2 + */ + +/* +modification history +-------------------- +01g,20may05,kch Redefined cfg_privInitSysctl as function pointer. Moved + ip6MrouteSysctlInit() prototype to sysctlLib.h. +01f,26apr05,kch Allow ip6 mrouter to be scaled out. +01e,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +01d,28jan05,kc Redefined IF_COPY and IF_ZERO macros. +01c,28dec04,kc Added ipm6_config_params structure. Also added + ip6MrouteSysctlInit() prototype. +01b,23dec04,kc Added pim6_input() and ip6MrouterInstInit() prototypes. +01a,08dec04,kc Integrated Kame changes. +*/ + +#ifndef _NETINET6_IP6_MROUTE_H_ +#define _NETINET6_IP6_MROUTE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * Multicast Routing set/getsockopt commands. + */ +#ifdef _WRS_KERNEL +#define MRT6_OINIT 100 /* initialize forwarder (omrt6msg) */ +#endif +#define MRT6_DONE 101 /* shut down forwarder */ +#define MRT6_ADD_MIF 102 /* add multicast interface */ +#define MRT6_DEL_MIF 103 /* delete multicast interface */ +#define MRT6_ADD_MFC 104 /* insert forwarding cache entry */ +#define MRT6_DEL_MFC 105 /* delete forwarding cache entry */ +#define MRT6_PIM 107 /* enable pim code */ +#define MRT6_INIT 108 /* initialize forwarder (mrt6msg) */ + +#define GET_TIME(t) microtime(&t) + +/* + * Types and macros for handling bitmaps with one bit per multicast interface. + */ +typedef u_short mifi_t; /* type of a mif index */ +#define MAXMIFS 64 + +#ifndef IF_SETSIZE +#define IF_SETSIZE 256 +#endif + +typedef u_int32_t if_mask; +#define NIFBITS (sizeof(if_mask) * NBBY) /* bits per mask */ + +#ifndef howmany +#define howmany(x, y) (((x) + ((y) - 1)) / (y)) +#endif + +typedef struct if_set { + if_mask ifs_bits[howmany(IF_SETSIZE, NIFBITS)]; +} if_set; + +#define IF_SET(n, p) ((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS))) +#define IF_CLR(n, p) ((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS))) +#define IF_ISSET(n, p) ((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS))) +/* #define IF_COPY(f, t) bcopy(f, t, sizeof(*(f))) */ +#define IF_COPY(f, t) bcopy(f, t, sizeof(struct if_set)) +/* #define IF_ZERO(p) bzero(p, sizeof(*(p))) */ +#define IF_ZERO(p) bzero(p, sizeof(struct if_set)) + + +typedef struct ipm6_config_params { + CFG_DATA_HDR cfgh; + FUNCPTR cfg_privInitSysctl; + } IPM6_CONFIG_PARAMS; + +/* + * Argument structure for MRT6_ADD_IF. + */ +struct mif6ctl { + mifi_t mif6c_mifi; /* the index of the mif to be added */ + u_char mif6c_flags; /* MIFF_ flags defined below */ + u_short mif6c_pifi; /* the index of the physical IF */ +#ifdef notyet + u_int mif6c_rate_limit; /* max rate */ +#endif +}; + +#define MIFF_REGISTER 0x1 /* mif represents a register end-point */ + +/* + * Argument structure for MRT6_ADD_MFC and MRT6_DEL_MFC + */ +struct mf6cctl { + struct sockaddr_in6 mf6cc_origin; /* IPv6 origin of mcasts */ + struct sockaddr_in6 mf6cc_mcastgrp; /* multicast group associated */ + mifi_t mf6cc_parent; /* incoming ifindex */ + struct if_set mf6cc_ifset; /* set of forwarding ifs */ +}; + +/* + * The kernel's multicast routing statistics. + */ +struct mrt6stat { + u_quad_t mrt6s_mfc_lookups; /* # forw. cache hash table hits */ + u_quad_t mrt6s_mfc_misses; /* # forw. cache hash table misses */ + u_quad_t mrt6s_upcalls; /* # calls to mrouted */ + u_quad_t mrt6s_no_route; /* no route for packet's origin */ + u_quad_t mrt6s_bad_tunnel; /* malformed tunnel options */ + u_quad_t mrt6s_cant_tunnel; /* no room for tunnel options */ + u_quad_t mrt6s_wrong_if; /* arrived on wrong interface */ + u_quad_t mrt6s_upq_ovflw; /* upcall Q overflow */ + u_quad_t mrt6s_cache_cleanups; /* # entries with no upcalls */ + u_quad_t mrt6s_drop_sel; /* pkts dropped selectively */ + u_quad_t mrt6s_q_overflow; /* pkts dropped - Q overflow */ + u_quad_t mrt6s_pkt2large; /* pkts dropped - size > BKT SIZE */ + u_quad_t mrt6s_upq_sockfull; /* upcalls dropped - socket full */ +}; + +#ifdef MRT6_OINIT +/* + * Struct used to communicate from kernel to multicast router + * note the convenient similarity to an IPv6 header. + * XXX old version, superseded by mrt6msg. + */ +struct omrt6msg { + u_long unused1; + u_char im6_msgtype; /* what type of message */ +#if 0 +#define MRT6MSG_NOCACHE 1 +#define MRT6MSG_WRONGMIF 2 +#define MRT6MSG_WHOLEPKT 3 /* used for user level encap*/ +#endif + u_char im6_mbz; /* must be zero */ + u_char im6_mif; /* mif rec'd on */ + u_char unused2; + struct in6_addr im6_src, im6_dst; +}; +#endif + +/* + * Structure used to communicate from kernel to multicast router. + * We'll overlay the structure onto an MLD header (not an IPv6 header + * like igmpmsg{} used for IPv4 implementation). This is because this + * structure will be passed via an IPv6 raw socket, on which an application + * will only receive the payload i.e. the data after the IPv6 header and all + * the extension headers. (see Section 3 of RFC 3542) + */ +struct mrt6msg { +#define MRT6MSG_NOCACHE 1 +#define MRT6MSG_WRONGMIF 2 +#define MRT6MSG_WHOLEPKT 3 /* used for user level encap*/ + u_char im6_mbz; /* must be zero */ + u_char im6_msgtype; /* what type of message */ + u_int16_t im6_mif; /* mif rec'd on */ + u_int32_t im6_pad; /* padding for 64bit arch */ + struct in6_addr im6_src, im6_dst; +}; + +/* + * Argument structure used by multicast routing daemon to get src-grp + * packet counts + */ +struct sioc_sg_req6 { + struct sockaddr_in6 src; + struct sockaddr_in6 grp; + u_quad_t pktcnt; + u_quad_t bytecnt; + u_quad_t wrong_if; +}; + +/* + * Argument structure used by mrouted to get mif pkt counts + */ +struct sioc_mif_req6 { + mifi_t mifi; /* mif number */ + u_quad_t icount; /* Input packet count on mif */ + u_quad_t ocount; /* Output packet count on mif */ + u_quad_t ibytes; /* Input byte count on mif */ + u_quad_t obytes; /* Output byte count on mif */ +}; + +#ifdef _WRS_KERNEL +/* + * The kernel's multicast-interface structure. + */ +struct mif6 { + u_char m6_flags; /* MIFF_ flags defined above */ + u_int m6_rate_limit; /* max rate */ +#ifdef notyet + struct tbf *m6_tbf; /* token bucket structure at intf. */ +#endif + struct ifnet *m6_ifp; /* pointer to interface */ + u_quad_t m6_pkt_in; /* # pkts in on interface */ + u_quad_t m6_pkt_out; /* # pkts out on interface */ + u_quad_t m6_bytes_in; /* # bytes in on interface */ + u_quad_t m6_bytes_out; /* # bytes out on interface */ +#ifdef notyet + u_int m6_rsvp_on; /* RSVP listening on this vif */ + struct socket *m6_rsvpd; /* RSVP daemon socket */ +#endif +}; + +/* + * The kernel's multicast forwarding cache entry structure + */ +struct mf6c { + struct sockaddr_in6 mf6c_origin; /* IPv6 origin of mcasts */ + struct sockaddr_in6 mf6c_mcastgrp; /* multicast group associated*/ + mifi_t mf6c_parent; /* incoming IF */ + struct if_set mf6c_ifset; /* set of outgoing IFs */ + + u_quad_t mf6c_pkt_cnt; /* pkt count for src-grp */ + u_quad_t mf6c_byte_cnt; /* byte count for src-grp */ + u_quad_t mf6c_wrong_if; /* wrong if for src-grp */ + int mf6c_expire; /* time to clean entry up */ + struct timeval mf6c_last_assert; /* last time I sent an assert*/ + struct rtdetq *mf6c_stall; /* pkts waiting for route */ + struct mf6c *mf6c_next; /* hash table linkage */ +}; + +#define MF6C_INCOMPLETE_PARENT ((mifi_t)-1) + +#define MF6CTBLSIZ 256 +#if (MF6CTBLSIZ & (MF6CTBLSIZ - 1)) == 0 /* from sys:route.h */ +#define MF6CHASHMOD(h) ((h) & (MF6CTBLSIZ - 1)) +#else +#define MF6CHASHMOD(h) ((h) % MF6CTBLSIZ) +#endif + +#define MAX_UPQ6 4 /* max. no of pkts in upcall Q */ + +STATUS ip6MrouterCmd (struct socket *so, struct sockopt *sopt); + +#ifdef VIRTUAL_STACK +STATUS ip6MrouterInstInit (void); +#endif /* VIRTUAL_STACK */ + +#ifdef WRS_PIM6 +int pim6_input(struct mbuf **mp, int *offp, int proto); +#endif /* WRS_PIM6 */ + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_NETINET6_IP6_MROUTE_H_ */ diff --git a/h/wrn/coreip/netinet6/ip6_var.h b/h/wrn/coreip/netinet6/ip6_var.h new file mode 100644 index 0000000..71dd764 --- /dev/null +++ b/h/wrn/coreip/netinet6/ip6_var.h @@ -0,0 +1,477 @@ +/* ip6_var.h - IPv6 internal structures and definitions */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* $KAME: ip6_var.h,v 1.130 2005/03/18 10:23:05 suz Exp $ */ +/* $KAME: ip6_var.h,v 1.127 2004/06/02 05:53:15 itojun Exp $ */ +/* $FreeBSD: src/sys/netinet6/ip6_var.h,v 1.2.2.3 2002/08/08 16:44:57 ume Exp $ */ +/* $KAME: ip6_var.h,v 1.62 2001/05/03 14:51:48 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip_var.h 8.1 (Berkeley) 6/10/93 + */ +/* +modification history +-------------------- +01n,10may05,kch Merged from Kame v 1.130. +01m,28apr05,kch Virtualization changes. +01l,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +01k,07feb05,vvv _KERNEL cleanup +01j,31jan05,niq virtual stack changes +01i,02feb04,pas added queue.h for LIST_HEAD +01h,20nov03,niq Remove copyright_wrs.h file inclusion +01g,05nov03,cdw Removal of unnecessary _KERNEL guards. +01f,04nov03,rlm Ran batch header path update for header re-org. +01e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01d,13aug03,nee Merging from label ACCORDION_BASE6_MERGE_BASELINE in + accordion codeline to Base6 +01c,10jun03,vvv include netVersion.h +01b,01feb03,pas merge from FreeBSD 4.7 - removed ip6_mapped_addr_on +*/ + +#ifndef _NETINET6_IP6_VAR_H_ +#define _NETINET6_IP6_VAR_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +/* + * IP6 reassembly queue structure. Each fragment + * being reassembled is attached to one of these structures. + */ +struct ip6q { + u_int32_t ip6q_head; + u_int16_t ip6q_len; + u_int8_t ip6q_nxt; /* ip6f_nxt in first fragment */ + u_int8_t ip6q_hlim; + struct ip6asfrag *ip6q_down; + struct ip6asfrag *ip6q_up; + u_int32_t ip6q_ident; + u_int8_t ip6q_arrive; + u_int8_t ip6q_ttl; + struct in6_addr ip6q_src, ip6q_dst; + struct ip6q *ip6q_next; + struct ip6q *ip6q_prev; + int ip6q_unfrglen; /* len of unfragmentable part */ +#ifdef notyet + u_char *ip6q_nxtp; +#endif + int ip6q_nfrag; /* # of fragments */ +}; + +struct ip6asfrag { + u_int32_t ip6af_head; + u_int16_t ip6af_len; + u_int8_t ip6af_nxt; + u_int8_t ip6af_hlim; + /* must not override the above members during reassembling */ + struct ip6asfrag *ip6af_down; + struct ip6asfrag *ip6af_up; + struct mbuf *ip6af_m; + int ip6af_offset; /* offset in ip6af_m to next header */ + int ip6af_frglen; /* fragmentable part length */ + int ip6af_off; /* fragment offset */ + u_int16_t ip6af_mff; /* more fragment bit in frag off */ +}; + +#define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m)) + +struct ip6_moptions { + struct ifnet *im6o_multicast_ifp; /* ifp for outgoing multicasts */ + u_char im6o_multicast_hlim; /* hoplimit for outgoing multicasts */ + u_char im6o_multicast_loop; /* 1 >= hear sends if a member */ + LIST_HEAD(, in6_multi_mship) im6o_memberships; +}; + +/* + * Control options for outgoing packets + */ + +/* Routing header related info */ +struct ip6po_rhinfo { + struct ip6_rthdr *ip6po_rhi_rthdr; /* Routing header */ + struct route_in6 ip6po_rhi_route; /* Route to the 1st hop */ +}; +#define ip6po_rthdr ip6po_rhinfo.ip6po_rhi_rthdr +#define ip6po_route ip6po_rhinfo.ip6po_rhi_route +#define ip6po_rthdr2 ip6po_rhinfo2.ip6po_rhi_rthdr +#define ip6po_route2 ip6po_rhinfo2.ip6po_rhi_route + +/* Nexthop related info */ +struct ip6po_nhinfo { + struct sockaddr *ip6po_nhi_nexthop; + struct route_in6 ip6po_nhi_route; /* Route to the nexthop */ +}; +#define ip6po_nexthop ip6po_nhinfo.ip6po_nhi_nexthop +#define ip6po_nextroute ip6po_nhinfo.ip6po_nhi_route + +struct ip6_pktopts { + int ip6po_hlim; /* Hoplimit for outgoing packets */ + + /* Outgoing IF/address information */ + struct in6_pktinfo *ip6po_pktinfo; + + /* Next-hop address information */ + struct ip6po_nhinfo ip6po_nhinfo; + + struct ip6_hbh *ip6po_hbh; /* Hop-by-Hop options header */ + + /* Destination options header (before a routing header) */ + struct ip6_dest *ip6po_dest1; + + /* Routing header related info. */ + struct ip6po_rhinfo ip6po_rhinfo; + +#ifdef MIP6 + /* Mobile IPv6 type 2 Routing header. */ + struct ip6po_rhinfo ip6po_rhinfo2; + + /* Home Address Destination option */ + struct ip6_dest *ip6po_hoa; +#endif /* MIP6 */ + + /* Destination options header (after a routing header) */ + struct ip6_dest *ip6po_dest2; + + int ip6po_tclass; /* traffic class */ + + int ip6po_minmtu; /* fragment vs PMTU discovery policy */ +#define IP6PO_MINMTU_MCASTONLY -1 /* default; send at min MTU for multicast*/ +#define IP6PO_MINMTU_DISABLE 0 /* always perform pmtu disc */ +#define IP6PO_MINMTU_ALL 1 /* always send at min MTU */ + + int ip6po_prefer_tempaddr; /* whether temporary addresses are + preferred as source address */ +#define IP6PO_TEMPADDR_SYSTEM -1 /* follow the system default */ +#define IP6PO_TEMPADDR_NOTPREFER 0 /* not prefer temporary address */ +#define IP6PO_TEMPADDR_PREFER 1 /* prefer temporary address */ + + int ip6po_flags; +#if 0 /* parameters in this block is obsolete. do not reuse the values. */ +#define IP6PO_REACHCONF 0x01 /* upper-layer reachability confirmation. */ +#define IP6PO_MINMTU 0x02 /* use minimum MTU (IPV6_USE_MIN_MTU) */ +#endif +#define IP6PO_DONTFRAG 0x04 /* disable fragmentation (IPV6_DONTFRAG) */ +#define IP6PO_USECOA 0x08 /* use care of address */ +#define IP6PO_NOTUSEBCE 0x10 /* Don't use */ +}; + +/* + * Control options for incoming packets + */ + +struct ip6stat { + u_quad_t ip6s_total; /* total packets received */ + u_quad_t ip6s_tooshort; /* packet too short */ + u_quad_t ip6s_toosmall; /* not enough data */ + u_quad_t ip6s_fragments; /* fragments received */ + u_quad_t ip6s_fragdropped; /* frags dropped(dups, out of space) */ + u_quad_t ip6s_fragtimeout; /* fragments timed out */ + u_quad_t ip6s_fragoverflow; /* fragments that exceeded limit */ + u_quad_t ip6s_forward; /* packets forwarded */ + u_quad_t ip6s_cantforward; /* packets rcvd for unreachable dest */ + u_quad_t ip6s_redirectsent; /* packets forwarded on same net */ + u_quad_t ip6s_delivered; /* datagrams delivered to upper level*/ + u_quad_t ip6s_localout; /* total ip packets generated here */ + u_quad_t ip6s_odropped; /* lost packets due to nobufs, etc. */ + u_quad_t ip6s_reassembled; /* total packets reassembled ok */ + u_quad_t ip6s_fragmented; /* datagrams successfully fragmented */ + u_quad_t ip6s_ofragments; /* output fragments created */ + u_quad_t ip6s_cantfrag; /* don't fragment flag was set, etc. */ + u_quad_t ip6s_badoptions; /* error in option processing */ + u_quad_t ip6s_noroute; /* packets discarded due to no route */ + u_quad_t ip6s_badvers; /* ip6 version != 6 */ + u_quad_t ip6s_rawout; /* total raw ip packets generated */ + u_quad_t ip6s_badscope; /* scope error */ + u_quad_t ip6s_notmember; /* don't join this multicast group */ + u_quad_t ip6s_nxthist[256]; /* next header history */ + u_quad_t ip6s_m1; /* one mbuf */ + u_quad_t ip6s_m2m[32]; /* two or more mbuf */ + u_quad_t ip6s_mext1; /* one ext mbuf */ + u_quad_t ip6s_mext2m; /* two or more ext mbuf */ + u_quad_t ip6s_exthdrtoolong; /* ext hdr are not continuous */ + u_quad_t ip6s_nogif; /* no match gif found */ + u_quad_t ip6s_toomanyhdr; /* discarded due to too many headers */ + + /* + * statistics for improvement of the source address selection + * algorithm: + * XXX: hardcoded 16 = # of ip6 multicast scope types + 1 + */ + /* number of times that address selection fails */ + u_quad_t ip6s_sources_none; + /* number of times that an address on the outgoing I/F is chosen */ + u_quad_t ip6s_sources_sameif[16]; + /* number of times that an address on a non-outgoing I/F is chosen */ + u_quad_t ip6s_sources_otherif[16]; + /* + * number of times that an address that has the same scope + * from the destination is chosen. + */ + u_quad_t ip6s_sources_samescope[16]; + /* + * number of times that an address that has a different scope + * from the destination is chosen. + */ + u_quad_t ip6s_sources_otherscope[16]; + + /* number of times that a deprecated address is chosen */ + + u_quad_t ip6s_sources_deprecated[16]; + + u_quad_t ip6s_forward_cachehit; + u_quad_t ip6s_forward_cachemiss; + + /* number of times that each rule of source selection is applied. */ + u_quad_t ip6s_sources_rule[16]; +}; + +#ifdef _WRS_KERNEL +/* + * IPv6 onion peeling state. + * it will be initialized when we come into ip6_input(). + * XXX do not make it a kitchen sink! + */ +struct ip6aux { + u_int32_t ip6a_flags; +#define IP6A_SWAP 0x01 /* swapped home/care-of on packet */ +#define IP6A_HASEEN 0x02 /* HA was present */ +#define IP6A_BRUID 0x04 /* BR Unique Identifier was present */ +#define IP6A_RTALERTSEEN 0x08 /* rtalert present */ +#define IP6A_ROUTEOPTIMIZED 0x10 /* route optimized packet */ +#define IP6A_NOTUSEBC 0x20 /* do not requrie to lookup BC */ +#define IP6A_TEMP_PROXYND_DEL 0x40 /* Marking for resuming proxy nd entry after sending sepcial BA */ + + /* ip6.ip6_src */ + struct in6_addr ip6a_coa; /* care of address of the peer */ + + /* ip6.ip6_dst */ + struct in6_ifaddr *ip6a_dstia6; /* my ifaddr that matches ip6_dst */ + + /* rtalert */ + u_int16_t ip6a_rtalert; /* rtalert option value */ + + /* + * decapsulation history will be here. + * with IPsec it may not be accurate. + */ +}; + +/* flags passed to ip6_output as last parameter */ + +#define IPV6_UNSPECSRC 0x01 /* allow :: as the source address */ +#define IPV6_FORWARDING 0x02 /* most of IPv6 header exists */ +#define IPV6_MINMTU 0x04 /* use minimum MTU (IPV6_USE_MIN_MTU) */ +#define IPV6_MLDSEND 0x08 + +/* the following is no longer used. To set the don't fragment option, use + * the IP6PO_DONTFRAG + */ +#if 0 +#define IPV6_DONTFRAG 0x08 /* Dont fragment - for tunnelLib */ +#endif + +#ifndef VIRTUAL_STACK +extern struct ip6stat _ip6stat; /* statistics */ +extern u_int32_t ip6_id; /* fragment identifier */ +extern int ip6_defhlim; /* default hop limit */ +extern int ip6_defmcasthlim; /* default multicast hop limit */ +extern int ip6_forwarding; /* act as router? */ +extern int ip6_gif_hlim; /* Hop limit for gif encap packet */ +extern int ip6_sendredirect; /* send ICMPv6 redirect? */ +extern int ip6_forward_srcrt; /* forward src-routed? */ +extern int ip6_use_deprecated; /* allow deprecated addr as source */ +extern int ip6_rr_prune; /* router renumbering prefix + * walk list every 5 sec. */ +extern int ip6_mcast_pmtu; /* enable pMTU discovery for multicast? */ +extern int ip6_v6only; + +extern struct socket *ip6_mrouter; /* multicast routing daemon */ +extern int ip6_sendredirects; /* send IP redirects when forwarding? */ +extern int ip6_maxfragpackets; /* Maximum packets in reassembly queue */ +extern int ip6_maxfrags; /* Maximum fragments in reassembly queue */ +extern int ip6_sourcecheck; /* Verify source interface */ +extern int ip6_sourcecheck_interval; /* Interval between log messages */ +extern int ip6_accept_rtadv; /* Acts as a host not a router */ +extern int ip6_keepfaith; /* Firewall Aided Internet Translator */ +extern int ip6_log_interval; +extern time_t ip6_log_time; +extern int ip6_hdrnestlimit; /* upper limit of # of extension headers */ +extern int ip6_dad_count; /* DupAddrDetectionTransmits */ + +extern u_int32_t ip6_flow_seq; +extern int ip6_auto_flowlabel; +extern int ip6_auto_linklocal; +extern int ip6_use_tempaddr; /* whether to use temporary addresses. */ +extern int ip6_prefer_tempaddr; +extern int ip6_use_defzone; /* whether to use the default scope zone + when unspecified */ + +extern int mldmaxsrcfilter; /* maximum num .of msf per interface */ +extern int mldsomaxsrc; /* maximum num .of msf per socket */ +extern int mldversion; + +#endif /* VIRTUAL_STACK */ + +extern int ip6_anonportmin; /* minimum ephemeral port */ +extern int ip6_anonportmax; /* maximum ephemeral port */ +extern int ip6_lowportmin; /* minimum reserved port */ +extern int ip6_lowportmax; /* maximum reserved port */ + +extern struct pr_usrreqs rip6_usrreqs; +struct sockopt; + +struct inpcb; + +int icmp6_ctloutput __P((struct socket *, struct sockopt *sopt)); + +struct in6_ifaddr; +void ip6_init __P((void)); +void ip6intr __P((void)); +void ip6_input __P((struct mbuf *)); +struct in6_ifaddr *ip6_getdstifaddr __P((struct mbuf *)); +void ip6_freepcbopts __P((struct ip6_pktopts *)); +void ip6_freemoptions __P((struct ip6_moptions *)); +int ip6_unknown_opt __P((u_int8_t *, struct mbuf *, int)); +char * ip6_get_prevhdr __P((struct mbuf *, int)); +int ip6_nexthdr __P((struct mbuf *, int, int, int *)); +int ip6_lasthdr __P((struct mbuf *, int, int, int *)); + +struct mbuf *ip6_addaux __P((struct mbuf *)); +struct mbuf *ip6_findaux __P((struct mbuf *)); +void ip6_delaux __P((struct mbuf *)); + +int ip6_mforward __P((struct ip6_hdr *, struct ifnet *, struct mbuf *)); +int ip6_process_hopopts __P((struct mbuf *, u_int8_t *, int, u_int32_t *, + u_int32_t *)); +void ip6_savecontrol __P((struct inpcb *, struct mbuf *, + struct mbuf **)); +void ip6_notify_pmtu __P((struct inpcb *, struct sockaddr_in6 *, + u_int32_t *)); +int ip6_sysctl __P((int *, u_int, void *, size_t *, void *, size_t)); + +void ip6_forward __P((struct mbuf *, int)); + +void ip6_mloopback __P((struct ifnet *, struct mbuf *, struct sockaddr_in6 *)); +int ip6_output __P((struct mbuf *, struct ip6_pktopts *, + struct route_in6 *, + int, + struct ip6_moptions *, struct ifnet **)); +int ip6_ctloutput __P((struct socket *, struct sockopt *sopt)); + +int ip6_raw_ctloutput __P((struct socket *, struct sockopt *)); +void ip6_initpktopts __P((struct ip6_pktopts *)); +int ip6_setpktopts __P((struct mbuf *, struct ip6_pktopts *, + struct ip6_pktopts *, int, int)); +void ip6_clearpktopts __P((struct ip6_pktopts *, int)); +struct ip6_pktopts *ip6_copypktopts __P((struct ip6_pktopts *, int)); +int ip6_optlen __P((struct inpcb *)); + +int route6_input __P((struct mbuf **, int *, int)); + +void frag6_init __P((void)); +int frag6_input __P((struct mbuf **, int *, int)); +void frag6_slowtimo __P((void)); +void frag6_drain __P((void)); + +int rip6_input __P((struct mbuf **, int *, int)); +void rip6_ctlinput __P((int, struct sockaddr *, void *)); +int rip6_ctloutput __P((struct socket *, struct sockopt *)); +int rip6_output __P((struct mbuf *, ...)); +int rip6_usrreq __P((struct socket *, + int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *)); + +int dest6_input __P((struct mbuf **, int *, int)); + +#ifdef MIP6 +int dest6_mip6_hao __P((struct mbuf *, int, int)); +int mip6_input __P((struct mbuf **, int *, int)); +#endif + +struct in6_addr *in6_selectsrc __P((struct sockaddr_in6 *, + struct ip6_pktopts *, struct ip6_moptions *, struct route_in6 *, + struct in6_addr *, struct ifnet **, int *)); +int in6_selectroute __P((struct sockaddr_in6 *, struct ip6_pktopts *, + struct ip6_moptions *, struct route_in6 *, struct ifnet **, + struct rtentry **, int)); + +u_int32_t ip6_randomid __P((void)); +u_int32_t ip6_randomflowlabel __P((void)); +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_NETINET6_IP6_VAR_H_ */ diff --git a/h/wrn/coreip/netinet6/mip6.h b/h/wrn/coreip/netinet6/mip6.h new file mode 100644 index 0000000..e014286 --- /dev/null +++ b/h/wrn/coreip/netinet6/mip6.h @@ -0,0 +1,89 @@ +/* $Id: mip6.h,v 1.63 2004/12/09 02:19:10 t-momose Exp $ */ + +/* Copyright (c) 2005 Wind River Systems, Inc. */ + +/* + * Copyright (C) 2004 WIDE Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* +modification history +-------------------- +01a,11may05,kch ported from kame v1.63. +*/ + +#ifndef _NETINET6_MIP6_H_ +#define _NETINET6_MIP6_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* move from mip6.c */ +#ifndef MIP6_BC_HASH_SIZE +#define MIP6_BC_HASH_SIZE 35 /* XXX */ +#endif + +#define IP6OPT_HALEN 16 /* Length of home address option */ + +/* Mobile IPv6 nodetype definition and evaluation */ +#define MIP6_NODETYPE_NONE 0x00 +#define MIP6_NODETYPE_CORRESPONDENT_NODE 0x01 +#define MIP6_NODETYPE_HOME_AGENT 0x02 +#define MIP6_NODETYPE_MOBILE_NODE 0x04 +#define MIP6_NODETYPE_MOBILE_ROUTER 0x08 + +/* + * Names for Mobile IPv6 sysctl objects + */ +#define MIP6CTL_DEBUG 1 +#define MIP6CTL_USE_IPSEC 2 +#define MIP6CTL_RR_HINT_PPSLIM 3 +#define MIP6CTL_MAXID 4 + +#define MIP6CTL_NAMES { \ + { 0, 0 }, \ + { "debug", CTLTYPE_INT }, \ + { "use_ipsec", CTLTYPE_INT }, \ + { "rr_hint_ppslimit", CTLTYPE_INT }, \ +} + +#define MIP_PROTO_NUM_MAX 1 + +typedef struct mip6_config_params { + CFG_DATA_HDR cfgh; + int cfg_mip6ctl_debug; + int cfg_mip6ctl_use_ipsec; + int cfg_mip6ctl_rr_hint_ppslim; + FUNCPTR cfg_privInitSysctl; + } MIPV6_CONFIG_PARAMS; + +#ifdef __cplusplus +} +#endif + +#endif /* !_NETINET6_MIP6_H_ */ diff --git a/h/wrn/coreip/netinet6/mip6_var.h b/h/wrn/coreip/netinet6/mip6_var.h new file mode 100644 index 0000000..633de87 --- /dev/null +++ b/h/wrn/coreip/netinet6/mip6_var.h @@ -0,0 +1,235 @@ +/* $KAME: mip6_var.h,v 1.121 2005/01/31 09:42:57 t-momose Exp $ */ + +/* Copyright (c) 2005 Wind River Systems, Inc. */ + +/* + * Copyright (C) 2004 WIDE Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* +modification history +-------------------- +01c,14jul05,nee changes for integration with tunnelLib +01b,01jun05,kch mip_usrreqs shouldn't be guarded with virtual stack define. +01a,11may05,kch ported from kame v1.121. +*/ + +#ifndef _NETINET6_MIP6_VAR_H_ +#define _NETINET6_MIP6_VAR_H_ + +#include +#include +#include +#include +#include /* IP_DRV_CTRL */ +#include /* inet_ntop */ +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +/* the binding update list entry used in the kernel */ +struct mip6_bul_internal { + LIST_ENTRY(mip6_bul_internal) mbul_entry; + struct in6_addr mbul_peeraddr; /* peer addr of this BUL */ + struct in6_addr mbul_hoa; /* HoA */ + struct in6_addr mbul_coa; /* CoA */ + u_int16_t mbul_flags; /* Flags: Ack, LL, Key, Home */ + struct mip_softc *mbul_mip; /* back pointer to mip */ +#ifdef MIP6_MCOA + u_int16_t mbul_bid; /* Binding Unique Identifier */ +#endif /* MIP6_MCOA */ + TUNNEL_LIST_ELEMENT *mbul_encap; /* TunnelLib cookie */ + u_int8_t mbul_state; /* internal state */ +}; +/*LIST_HEAD(mip6_bul_list, mip6_bul_internal); defined in in6_var.h */ + +#define MIP6_BUL_STATE_NOT_SUPPORTED 0x01 +#define MIP6_BUL_STATE_NEEDTUNNEL (MIP6_BUL_STATE_NOT_SUPPORTED) + +/* the binding cache entry used in the kernel */ +struct mip6_bc_internal { + LIST_ENTRY(mip6_bc_internal) mbc_entry; + struct in6_addr mbc_cnaddr; /* my addr of this BC */ + struct in6_addr mbc_hoa; /* HoA */ + struct in6_addr mbc_coa; /* CoA */ + struct ifaddr *mbc_ifaddr; + u_int16_t mbc_flags; /* Flags: Ack, LL, Key, Home */ + int mbc_hash_cache; +#ifdef MIP6_MCOA + u_int16_t mbc_bid; /* Binding Unique Identifier */ +#endif /* MIP6_MCOA */ + TUNNEL_LIST_ELEMENT *mbc_encap; /* TunnelLib cookie */ +}; +LIST_HEAD(mip6_bc_list, mip6_bc_internal); + +/* + * Mobile IPv6 related statistics. + */ +struct mip6stat { + u_quad_t mip6s_mh; /* Mobility Header recieved */ + u_quad_t mip6s_omh; /* Mobility Header sent */ + u_quad_t mip6s_hoti; /* HoTI recieved */ + u_quad_t mip6s_ohoti; /* HoTI sent */ + u_quad_t mip6s_coti; /* CoTI received */ + u_quad_t mip6s_ocoti; /* CoTI sent */ + u_quad_t mip6s_hot; /* HoT received */ + u_quad_t mip6s_ohot; /* HoT sent */ + u_quad_t mip6s_cot; /* CoT received */ + u_quad_t mip6s_ocot; /* CoT sent */ + u_quad_t mip6s_bu; /* BU received */ + u_quad_t mip6s_obu; /* BU sent */ + u_quad_t mip6s_ba; /* BA received */ + u_quad_t mip6s_ba_hist[256]; /* BA status input histgram */ + u_quad_t mip6s_oba; /* BA sent */ + u_quad_t mip6s_oba_hist[256]; /* BA status output histgram */ + u_quad_t mip6s_br; /* BR received */ + u_quad_t mip6s_obr; /* BR sent */ + u_quad_t mip6s_be; /* BE received */ + u_quad_t mip6s_be_hist[256]; /* BE status input histogram */ + u_quad_t mip6s_obe; /* BE sent */ + u_quad_t mip6s_obe_hist[256]; /* BE status output histogram */ + u_quad_t mip6s_hao; /* HAO received */ + u_quad_t mip6s_unverifiedhao; /* unverified HAO received */ + u_quad_t mip6s_ohao; /* HAO sent */ + u_quad_t mip6s_rthdr2; /* RTHDR2 received */ + u_quad_t mip6s_orthdr2; /* RTHDR2 sent */ + u_quad_t mip6s_revtunnel; /* reverse tunnel input */ + u_quad_t mip6s_orevtunnel; /* reverse tunnel output */ + u_quad_t mip6s_checksum; /* bad checksum */ + u_quad_t mip6s_payloadproto; /* payload proto != no nxt header */ + u_quad_t mip6s_unknowntype; /* unknown MH type value */ + u_quad_t mip6s_nohif; /* not my home address */ + u_quad_t mip6s_nobue; /* no related BUE */ + u_quad_t mip6s_hinitcookie; /* home init cookie mismatch */ + u_quad_t mip6s_cinitcookie; /* careof init cookie mismatch */ + u_quad_t mip6s_unprotected; /* not IPseced signaling */ + u_quad_t mip6s_haopolicy; /* BU is discarded due to bad HAO */ + u_quad_t mip6s_rrauthfail; /* RR authentication failed */ + u_quad_t mip6s_seqno; /* seqno mismatch */ + u_quad_t mip6s_paramprobhao; /* ICMP paramprob for HAO received */ + u_quad_t mip6s_paramprobmh; /* ICMP paramprob for MH received */ + u_quad_t mip6s_invalidcoa; /* Invalid Care-of address */ + u_quad_t mip6s_invalidopt; /* Invalid mobility options */ + u_quad_t mip6s_circularrefered; /* Circular reference */ +}; + +#ifdef _WRS_KERNEL + + +#define mip6log(arg) do { \ + if (mip6ctl_debug) \ + log arg; \ +} while (0) + +/* macros for a nodetype check. */ +#define MIP6_IS_MN ((mip6_nodetype & MIP6_NODETYPE_MOBILE_NODE) || \ + (mip6_nodetype & MIP6_NODETYPE_MOBILE_ROUTER)) +#define MIP6_IS_MR ((mip6_nodetype & MIP6_NODETYPE_MOBILE_ROUTER)) +#define MIP6_IS_HA ((mip6_nodetype & MIP6_NODETYPE_HOME_AGENT)) +#define MIP6_IS_CN ((mip6_nodetype & MIP6_NODETYPE_CORRESPONDENT_NODE)) + +/* Calculation pad length to be appended */ +/* xn + y; x must be 2^m */ +#define MIP6_PADLEN(cur_offset, x, y) \ + ((x + y) - ((cur_offset) & (x - 1))) & (x - 1) +#define MIP6_FILL_PADDING(buf, padlen) \ + do { \ + bzero((buf), (padlen)); \ + if ((padlen) > 1) { \ + (buf)[0] = IP6OPT_PADN; \ + (buf)[1] = (padlen) - 2; \ + } \ + } while (/*CONSTCOND*/ 0) + + +/* defined in mipsock.c */ +extern struct pr_usrreqs mip_usrreqs; + +/* + * configuration knobs. defined in mip6.c. + */ +#ifndef VIRTUAL_STACK +extern u_int8_t mip6_nodetype; +extern int mip6ctl_debug; +extern int mip6ctl_use_ipsec; +extern int mip6ctl_rr_hint_ppslim; +#endif /* VIRTUAL_STACK */ + +/* function prototypes. */ +/* correspondent node functions. */ +int mip6_bce_update(struct sockaddr_in6 *, struct sockaddr_in6 *, + struct sockaddr_in6 *, u_int16_t, u_int16_t); +struct mip6_bc_internal *mip6_bce_get(struct in6_addr *, struct in6_addr *, + struct in6_addr *, u_int16_t); +int mip6_bce_remove_addr(struct sockaddr_in6 *, struct sockaddr_in6 *, + struct sockaddr_in6 *, u_int16_t, u_int16_t); +int mip6_bce_remove_bc(struct mip6_bc_internal *); +void mip6_bce_remove_all (void); +struct ip6_rthdr2 *mip6_create_rthdr2(struct in6_addr *); + +/* home agent functions. */ +int mip6_bc_proxy_control(struct in6_addr *, struct in6_addr *, int); + +/* mobile node functions. */ +int mip6_bul_add(const struct in6_addr *, const struct in6_addr *, + const struct in6_addr *, u_short, u_int16_t, u_int8_t, u_int16_t); +struct mip6_bul_internal *mip6_bul_get(const struct in6_addr *, + const struct in6_addr *, u_int16_t); +void mip6_bul_remove(struct mip6_bul_internal *); +void mip6_bul_remove_all(void); +struct mip6_bul_internal *mip6_bul_get_home_agent(const struct in6_addr *); +struct nd_prefixctl; +int mip6_are_homeprefix(struct nd_prefixctl *); +int mip6_ifa6_is_addr_valid_hoa(struct in6_ifaddr *); +u_int8_t *mip6_create_hoa_opt(struct in6_addr *); +struct ip6_opt_home_address *mip6_search_hoa_in_destopt(u_int8_t *); +void mip6_probe_routers(void); +int mip6_get_logical_src_dst(struct mbuf *, struct in6_addr *, + struct in6_addr *); +void mip6_md_scan(u_int16_t); + + +/* used by one or more kind of nodetypes. */ +struct in6_ifaddr *mip6_ifa_ifwithin6addr(const struct in6_addr *, + struct mip_softc *); +struct mbuf *mip6_append_ip6_hdr(struct mbuf **, struct in6_addr *, + struct in6_addr *); +int mip6_encapsulate(struct mbuf **, struct in6_addr *, struct in6_addr *); +int mip6_tunnel_input(struct mbuf **, int *, int proto); +void mip6_notify_rr_hint(struct in6_addr *, struct in6_addr *); + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_NETINET6_MIP6_VAR_H_ */ + diff --git a/h/wrn/coreip/netinet6/nd6.h b/h/wrn/coreip/netinet6/nd6.h new file mode 100644 index 0000000..fc13283 --- /dev/null +++ b/h/wrn/coreip/netinet6/nd6.h @@ -0,0 +1,572 @@ +/* nd6.h - IPv6 Neighbor Discovery structures and definitions */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* $KAME: nd6.h,v 1.116 2005/01/22 19:23:44 suz Exp $ */ +/* $KAME: nd6.h,v 1.113 2004/08/11 10:20:48 jinmei Exp $ */ +/* $FreeBSD: src/sys/netinet6/nd6.h,v 1.2.2.5 2002/04/28 05:40:27 suz Exp $ */ +/* $KAME: nd6.h,v 1.76 2001/12/18 02:10:31 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _NETINET6_ND6_H_ +#define _NETINET6_ND6_H_ + +/* +modification history +-------------------- +01x,10may05,rp merged from kame v1.116 +01w,03may05,kch Fixed sysctl variables virtualization (SPR#108823). +01v,29apr05,kch Fixed virtual stack build. +01u,20apr05,kch Merged from comp_wn_ipv6_mld_interim-dev branch. +01t,29mar05,sar Simplify ND_COMPUTE_RTIME calculation +01s,30mar05,nee Add prefix state flag NDPRF_SUBNETANYCAST +01r,19mar05,nee Add IN6_LINKMTU and ND6_IFINFO macros +01q,07feb05,vvv _KERNEL cleanup +01p,26jan05,vvv fixed bitfield definitions (SPR #92171) +01o,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01n,10aug04,ppp Put in a fix for ND_COMPUTE_RTIME macro to return lower bound to be + greater than 0.5x +01m,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01l,24feb04,nee Adding the prototype for ip6EtherResolvRtnwrapper +01k,21nov03,vvv added INET6 protection +01j,20nov03,niq Remove copyright_wrs.h file inclusion +01i,05nov03,cdw Removal of unnecessary _KERNEL guards. +01h,04nov03,rlm Ran batch header path update for header re-org. +01g,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01f,11aug03,nee Merging from label ACCORDION_BASE6_MERGE_BASELINE in + accordion codeline to Base6 +01e,14may03,vvv included in6_var.h +01d,01feb03,pas merge from FreeBSD 4.7 - changed nd6_rtrequest() arg +01c,23oct02,ppp removed __attribute__((__packed__)) from some of the + structures inorder to fix alignment issues with some of the + architectures such as mips and sh +01b,10sep02,hsh add c++ protection +01a,02feb02,ham changed for tornado build. +*/ + +#ifdef INET6 +/* see net/route.h, or net/if_inarp.h */ +#ifndef RTF_ANNOUNCE +#define RTF_ANNOUNCE RTF_PROTO2 +#endif + +#include +#include +#include /* XXX for sockaddr in if.h */ +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct llinfo_nd6 { + struct llinfo_nd6 *ln_next; + struct llinfo_nd6 *ln_prev; + struct rtentry *ln_rt; + struct mbuf *ln_hold; /* last packet until resolved/timeout */ + long ln_asked; /* number of queries already sent for this addr */ + u_long ln_expire; /* lifetime for NDP state transition */ + short ln_state; /* reachability state */ + short ln_router; /* 2^0: ND6 router bit */ + int ln_byhint; /* # of times we made it reachable by UL hint */ + long ln_ntick; + struct callout ln_timer_ch; +}; + +#define ND6_LLINFO_NOSTATE -2 +/* + * We don't need the WAITDELETE state any more, but we keep the definition + * in a comment line instead of removing it. This is necessary to avoid + * unintentionally reusing the value for another purpose, which might + * affect backward compatibility with old applications. + * (20000711 jinmei@kame.net) + */ +/* #define ND6_LLINFO_WAITDELETE -1 */ +#define ND6_LLINFO_INCOMPLETE 0 +#define ND6_LLINFO_REACHABLE 1 +#define ND6_LLINFO_STALE 2 +#define ND6_LLINFO_DELAY 3 +#define ND6_LLINFO_PROBE 4 + +#define ND6_IS_LLINFO_PROBREACH(n) ((n)->ln_state > ND6_LLINFO_INCOMPLETE) +#define ND6_LLINFO_PERMANENT(n) (((n)->ln_expire == 0) && ((n)->ln_state > ND6_LLINFO_INCOMPLETE)) + +struct nd_ifinfo { + u_int32_t linkmtu; /* LinkMTU */ + u_int32_t maxmtu; /* Upper bound of LinkMTU */ + u_int32_t basereachable; /* BaseReachableTime */ + u_int32_t reachable; /* Reachable Time */ + u_int32_t retrans; /* Retrans Timer */ + u_int32_t flags; /* Flags */ + int recalctm; /* BaseReacable re-calculation timer */ + u_int8_t chlim; /* CurHopLimit */ + u_int8_t initialized; /* Flag to see the entry is initialized */ + /* the following 3 members are for privacy extension for addrconf */ + u_int8_t randomseed0[8]; /* upper 64 bits of MD5 digest */ + u_int8_t randomseed1[8]; /* lower 64 bits (usually the EUI64 IFID) */ + u_int8_t randomid[8]; /* current random ID */ +}; + +#define ND6_IFF_PERFORMNUD 0x1 +#define ND6_IFF_ACCEPT_RTADV 0x2 +#define ND6_IFF_PREFER_SOURCE 0x4 /* XXX: not related to ND. */ +#define ND6_IFF_IFDISABLED 0x8 /* IPv6 operation is disabled due to + * DAD failure. (XXX: not ND-specific) + */ +#define ND6_IFF_DONT_SET_IFROUTE 0x10 + +#ifdef _WRS_KERNEL +#define ND_IFINFO(ifp) \ + (((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->nd_ifinfo) +#define IN6_LINKMTU(ifp) \ + ((ND_IFINFO(ifp)->linkmtu && ND_IFINFO(ifp)->linkmtu < (ifp)->if_mtu) \ + ? ND_IFINFO(ifp)->linkmtu \ + : ((ND_IFINFO(ifp)->maxmtu && ND_IFINFO(ifp)->maxmtu < (ifp)->if_mtu) \ + ? ND_IFINFO(ifp)->maxmtu : (ifp)->if_mtu)) +#endif + +struct in6_nbrinfo { + char ifname[IFNAMSIZ]; /* if name, e.g. "en0" */ + struct in6_addr addr; /* IPv6 address of the neighbor */ + long asked; /* number of queries already sent for this addr */ + int isrouter; /* if it acts as a router */ + int state; /* reachability state */ + int expire; /* lifetime for NDP state transition */ +}; + +#define DRLSTSIZ 10 +#define PRLSTSIZ 10 +struct in6_drlist { + char ifname[IFNAMSIZ]; + struct { + struct in6_addr rtaddr; + u_char flags; + u_short rtlifetime; + u_long expire; + u_short if_index; + } defrouter[DRLSTSIZ]; +}; + +struct in6_defrouter { + struct in6_addr rtaddr; + u_char flags; + u_short rtlifetime; + u_long expire; + u_short if_index; +}; + +#ifdef _WRS_KERNEL +struct in6_oprlist { + char ifname[IFNAMSIZ]; + struct { + struct in6_addr prefix; + u_char raflags; + u_char prefixlen; + u_char origin; + u_long vltime; + u_long pltime; + u_long expire; + u_short if_index; + u_short advrtrs; /* number of advertisement routers */ + struct in6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */ + } prefix[PRLSTSIZ]; +}; +#endif + +struct in6_prlist { + char ifname[IFNAMSIZ]; + struct { + struct in6_addr prefix; + u_char raflags; + u_char prefixlen; + u_char origin; + u_int32_t vltime; + u_int32_t pltime; + time_t expire; + u_short if_index; + u_short advrtrs; /* number of advertisement routers */ + struct in6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */ + } prefix[PRLSTSIZ]; +}; + +struct in6_prefix { + struct sockaddr_in6 prefix; + u_char raflags; + u_char prefixlen; + u_char origin; + u_int32_t vltime; + u_int32_t pltime; + time_t expire; + u_int32_t flags; + int refcnt; + u_short if_index; + u_short advrtrs; /* number of advertisement routers */ + /* struct in6_addr advrtr[] */ +}; + +#ifdef _WRS_KERNEL +struct in6_ondireq { + char ifname[IFNAMSIZ]; + struct { + u_int32_t linkmtu; /* LinkMTU */ + u_int32_t maxmtu; /* Upper bound of LinkMTU */ + u_int32_t basereachable; /* BaseReachableTime */ + u_int32_t reachable; /* Reachable Time */ + u_int32_t retrans; /* Retrans Timer */ + u_int32_t flags; /* Flags */ + int recalctm; /* BaseReacable re-calculation timer */ + u_int8_t chlim; /* CurHopLimit */ + u_int8_t receivedra; + } ndi; +}; +#endif + +struct in6_ndireq { + char ifname[IFNAMSIZ]; + struct nd_ifinfo ndi; +}; + +struct in6_ndifreq { + char ifname[IFNAMSIZ]; + u_long ifindex; +}; + +/* Prefix status */ +#define NDPRF_ONLINK 0x1 +#define NDPRF_DETACHED 0x2 +#define NDPRF_HOME 0x4 +#define NDPRF_SUBNETANYCAST 0x8 + +/* protocol constants */ +#define MAX_RTR_SOLICITATION_DELAY 1 /* 1sec */ +#define RTR_SOLICITATION_INTERVAL 4 /* 4sec */ +#define MAX_RTR_SOLICITATIONS 3 + +#define ND6_INFINITE_LIFETIME 0xffffffff + +#ifdef _WRS_KERNEL +/* node constants */ +#define MAX_REACHABLE_TIME 3600000 /* msec */ +#define REACHABLE_TIME 30000 /* msec */ +#define RETRANS_TIMER 1000 /* msec */ + +#if 0 +/* Removed as they aren't being used after the change to ND_COMPUTE_RTIME + * sar March 27 2005 */ +#define MIN_RANDOM_FACTOR 512 /* 1024 * 0.5 */ +#define MAX_RANDOM_FACTOR 1536 /* 1024 * 1.5 */ +#endif + +#define DEF_TEMP_VALID_LIFETIME 604800 /* 1 week */ +#define DEF_TEMP_PREFERRED_LIFETIME 86400 /* 1 day */ +#define TEMPADDR_REGEN_ADVANCE 5 /* sec */ +#define MAX_TEMP_DESYNC_FACTOR 600 /* 10 min */ + +/* This piece of code was simplified to avoid boundary conditions + * when performing mutliplies and divides with large numbers + * + * The original code was: + * #define ND_COMPUTE_RTIME(x) \ + * (((MIN_RANDOM_FACTOR * (x >> 10)) + (random() & \ + * ((MAX_RANDOM_FACTOR - MIN_RANDOM_FACTOR) * (x >> 10)))) /1000) + * Any remainder will be ignored in this and so we could end up with values + * less than expected in the first half of the expression. For example if + * x = 60000 we would have 512 * (60000>>10) = 512 * 58 = 29696 which is + * less than x/2. + * + * The next code was: + * #define ND_COMPUTE_RTIME(x) \ + * (((MIN_RANDOM_FACTOR * ((x + 1023) >> 10)) + (random() & \ + * ((MAX_RANDOM_FACTOR - MIN_RANDOM_FACTOR) * (x >> 10)))) /1000) + * This corrected the problem on the low side but could lead to other + * rounding type errors. As we don't many any real use of scale of the + * min and max random factor we can simplify this expression by removing + * the 1024 scale factor. + * + */ +#define ND_COMPUTE_RTIME(x) ((((x + 1) / 2) + (random() % (x - 1))) / 1000) + +TAILQ_HEAD(nd_drhead, nd_defrouter); +struct nd_defrouter { + TAILQ_ENTRY(nd_defrouter) dr_entry; + struct in6_addr rtaddr; + u_char flags; /* flags on RA message */ + u_short rtlifetime; + u_long expire; + u_long advint; /* Mobile IPv6 addition (milliseconds) */ + u_long advint_expire; /* Mobile IPv6 addition */ + int advints_lost; /* Mobile IPv6 addition */ + struct ifnet *ifp; + int installed; /* is installed into kernel routing table */ +}; + +struct nd_prefixctl { + struct ifnet *ndpr_ifp; + + /* prefix */ + struct sockaddr_in6 ndpr_prefix; + u_char ndpr_plen; + + u_int32_t ndpr_vltime; /* advertised valid lifetime */ + u_int32_t ndpr_pltime; /* advertised preferred lifetime */ + + u_char ndpr_flags; +}; + +struct nd_prefix { + struct ifnet *ndpr_ifp; + LIST_ENTRY(nd_prefix) ndpr_entry; + struct sockaddr_in6 ndpr_prefix; /* prefix */ + struct in6_addr ndpr_mask; /* netmask derived from the prefix */ + + u_int32_t ndpr_vltime; /* advertised valid lifetime */ + u_int32_t ndpr_pltime; /* advertised preferred lifetime */ + + time_t ndpr_expire; /* expiration time of the prefix */ + time_t ndpr_preferred; /* preferred time of the prefix */ + time_t ndpr_lastupdate; /* reception time of last advertisement */ + + u_char ndpr_flags; + u_int32_t ndpr_stateflags; /* actual state flags */ + /* list of routers that advertise the prefix: */ + LIST_HEAD(pr_rtrhead, nd_pfxrouter) ndpr_advrtrs; + u_char ndpr_plen; + int ndpr_refcnt; /* reference couter from addresses */ +}; + +#define ndpr_next ndpr_entry.le_next + +#define ndpr_raf ndpr_flags + +/* + * We keep expired prefix for certain amount of time, for validation purposes. + * 1800s = MaxRtrAdvInterval + */ +#define NDPR_KEEP_EXPIRED (1800 * 2) + +/* + * Message format for use in obtaining information about prefixes + * from inet6 sysctl function + */ +struct inet6_ndpr_msghdr { + u_short inpm_msglen; /* to skip over non-understood messages */ + u_char inpm_version; /* future binary compatibility */ + u_char inpm_type; /* message type */ + struct in6_addr inpm_prefix; + u_long prm_vltim; + u_long prm_pltime; + u_long prm_expire; + u_long prm_preferred; + struct in6_prflags prm_flags; + u_short prm_index; /* index for associated ifp */ + u_char prm_plen; /* length of prefix in bits */ +}; + +#define prm_raf_onlink prm_flags.prf_ra.onlink +#define prm_raf_auto prm_flags.prf_ra.autonomous + +#define prm_statef_onlink prm_flags.prf_state.onlink + +#define prm_rrf_decrvalid prm_flags.prf_rr.decrvalid +#define prm_rrf_decrprefd prm_flags.prf_rr.decrprefd + + +struct nd_pfxrouter { + LIST_ENTRY(nd_pfxrouter) pfr_entry; +#define pfr_next pfr_entry.le_next + struct nd_defrouter *router; +}; + +LIST_HEAD(nd_prhead, nd_prefix); + +#ifndef VIRTUAL_STACK +/* nd6.c */ +extern int _nd6_prune; +extern int _nd6_delay; +extern int _nd6_umaxtries; +extern int _nd6_mmaxtries; +extern int _nd6_useloopback; +extern int _nd6_maxnudhint; +extern int _nd6_maxqueuelen; +extern int nd6_gctimer; +extern int nd6_recalc_reachtm_interval; +extern struct llinfo_nd6 _llinfo_nd6; +extern struct nd_drhead _nd_defrouter; /* was nd6_defrouter */ +extern struct nd_prhead _nd_prefix; /* was nd6_prefix */ +extern int _nd6_debug; +#endif + +#if 1 /* accordion -> moved from nd6.c */ +#define ND6_SLOWTIMER_INTERVAL (60 * 60) /* 1 hour */ +#define ND6_RECALC_REACHTM_INTERVAL (60 * 120) /* 2 hours */ +#endif + +#define nd6log(x) do { if (_nd6_debug) log x; } while (0) + +#ifndef VIRTUAL_STACK +extern struct callout nd6_timer_ch; + +/* nd6_rtr.c */ +extern int nd6_defifindex; + +extern int ip6_desync_factor; /* seconds */ +extern u_int32_t ip6_temp_preferred_lifetime; /* seconds */ +extern u_int32_t ip6_temp_valid_lifetime; /* seconds */ +extern int ip6_temp_regen_advance; /* seconds */ +#endif /* VIRTUAL_STACK */ + +union nd_opts { + struct nd_opt_hdr *nd_opt_array[13]; /* max = target address list */ + struct { + struct nd_opt_hdr *zero; + struct nd_opt_hdr *src_lladdr; + struct nd_opt_hdr *tgt_lladdr; + struct nd_opt_prefix_info *pi_beg; /* multiple opts, start */ + struct nd_opt_rd_hdr *rh; + struct nd_opt_mtu *mtu; + struct nd_opt_hdr *six; + struct nd_opt_advinterval *adv; + struct nd_opt_homeagent_info *hai; + struct nd_opt_hdr *src_addrlist; + struct nd_opt_hdr *tgt_addrlist; + struct nd_opt_hdr *search; /* multiple opts */ + struct nd_opt_hdr *last; /* multiple opts */ + int done; + struct nd_opt_prefix_info *pi_end;/* multiple opts, end */ + } nd_opt_each; +}; +#define nd_opts_src_lladdr nd_opt_each.src_lladdr +#define nd_opts_tgt_lladdr nd_opt_each.tgt_lladdr +#define nd_opts_pi nd_opt_each.pi_beg +#define nd_opts_pi_end nd_opt_each.pi_end +#define nd_opts_rh nd_opt_each.rh +#define nd_opts_mtu nd_opt_each.mtu +#define nd_opts_adv nd_opt_each.adv +#define nd_opts_hai nd_opt_each.hai +#define nd_opts_src_addrlist nd_opt_each.src_addrlist +#define nd_opts_tgt_addrlist nd_opt_each.tgt_addrlist +#define nd_opts_search nd_opt_each.search +#define nd_opts_last nd_opt_each.last +#define nd_opts_done nd_opt_each.done + +TAILQ_HEAD(dadq_head, dadq); +struct dadq { + TAILQ_ENTRY(dadq) dad_list; + struct ifaddr *dad_ifa; + int dad_count; /* max NS to send */ + int dad_ns_tcount; /* # of trials to send NS */ + int dad_ns_ocount; /* NS sent so far */ + int dad_ns_icount; + int dad_na_icount; + struct callout dad_timer_ch; +}; + +/* XXX: need nd6_var.h?? */ +/* nd6.c */ +void nd6_init __P((void)); +struct nd_ifinfo *nd6_ifattach __P((struct ifnet *)); +void nd6_ifdetach __P((struct nd_ifinfo *)); +int nd6_is_addr_neighbor __P((struct sockaddr_in6 *, struct ifnet *)); +void nd6_option_init __P((void *, int, union nd_opts *)); +struct nd_opt_hdr *nd6_option __P((union nd_opts *)); +int nd6_options __P((union nd_opts *)); +struct rtentry *nd6_lookup __P((struct in6_addr *, int, struct ifnet *)); +void nd6_setmtu __P((struct ifnet *)); +void nd6_llinfo_settimer __P((struct llinfo_nd6 *, long)); +void nd6_timer __P((void *)); +void nd6_purge __P((struct ifnet *)); +void nd6_nud_hint __P((struct rtentry *, struct in6_addr *, int)); +int nd6_resolve __P((struct ifnet *, struct rtentry *, + struct mbuf *, struct sockaddr *, u_char *)); +void nd6_rtrequest __P((int, struct rtentry *, struct sockaddr *)); +int nd6_ioctl __P((u_long, caddr_t, struct ifnet *)); +struct rtentry *nd6_cache_lladdr __P((struct ifnet *, struct in6_addr *, + char *, int, int, int)); +int nd6_output __P((struct ifnet *, struct ifnet *, struct mbuf *, + struct sockaddr_in6 *, struct rtentry *)); +int nd6_need_cache __P((struct ifnet *)); +int nd6_storelladdr __P((struct ifnet *, struct rtentry *, struct mbuf *, + struct sockaddr *, u_char *)); +void nd6_drain __P((void)); +int nd6_need_cache __P((struct ifnet *)); +int ip6EtherResolvRtn __P((struct ifnet *, struct rtentry *, struct mbuf *, + struct sockaddr *, char *,FUNCPTR)); + +/* NOTE: m2Ipv6IfLib.c requires nd6_free() */ +struct llinfo_nd6 *nd6_free __P((struct rtentry *, int)); +/* nd6_nbr.c */ +void nd6_na_input __P((struct mbuf *, int, int)); +void nd6_na_output __P((struct ifnet *, const struct in6_addr *, + const struct in6_addr *, u_long, int, struct sockaddr *)); +void nd6_ns_input __P((struct mbuf *, int, int)); +void nd6_ns_output __P((struct ifnet *, const struct in6_addr *, + const struct in6_addr *, struct llinfo_nd6 *, int)); +caddr_t nd6_ifptomac __P((struct ifnet *)); +void nd6_dad_start __P((struct ifaddr *, int)); +void nd6_dad_stop __P((struct ifaddr *)); +void nd6_dad_duplicated __P((struct ifaddr *)); + +/* nd6_rtr.c */ +void nd6_rs_input __P((struct mbuf *, int, int)); +void nd6_ra_input __P((struct mbuf *, int, int)); +void prelist_del __P((struct nd_prefix *)); +void defrouter_addreq __P((struct nd_defrouter *)); +void defrouter_reset __P((void)); +void defrouter_select __P((void)); +void defrtrlist_del __P((struct nd_defrouter *)); +void prelist_remove __P((struct nd_prefix *)); +int nd6_prelist_add __P((struct nd_prefixctl *, struct nd_defrouter *, + struct nd_prefix **)); +int nd6_prefix_onlink __P((struct nd_prefix *)); +int nd6_prefix_offlink __P((struct nd_prefix *)); +void pfxlist_onlink_check __P((void)); +struct nd_defrouter *defrouter_lookup __P((struct in6_addr *, struct ifnet *)); +struct nd_prefix *nd6_prefix_lookup __P((struct nd_prefixctl *)); +void rt6_flush __P((struct in6_addr *, struct ifnet *)); +int nd6_setdefaultiface __P((int)); +int in6_tmpifadd __P((const struct in6_ifaddr *, int, int)); + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif +#endif /* INET6 */ +#endif /* _NETINET6_ND6_H_ */ diff --git a/h/wrn/coreip/netinet6/raw_ip6.h b/h/wrn/coreip/netinet6/raw_ip6.h new file mode 100644 index 0000000..5116b7e --- /dev/null +++ b/h/wrn/coreip/netinet6/raw_ip6.h @@ -0,0 +1,79 @@ +/* raw_ip6.h - Routines for raw sockets IPV6*/ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* $KAME: raw_ip6.h,v 1.2 2001/05/27 13:28:35 itojun Exp $ */ +/* $FreeBSD: src/sys/netinet6/raw_ip6.h,v 1.1.2.1 2001/07/03 11:01:55 ume Exp $ */ +/* $KAME: raw_ip6.h,v 1.2 2001/05/27 13:28:35 itojun Exp $ */ + +/* + * Copyright (C) 2001 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* +modification history +-------------------- +01e,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +01d,07feb05,vvv _KERNEL cleanup +01c,20nov03,niq Remove copyright_wrs.h file inclusion +01b,13aug03,nee Merging from label ACCORDION_BASE6_MERGE_BASELINE in + accordion codeline to Base6 +01a,18sep01,nee 1st round of porting +*/ + +#ifndef _NETINET6_RAW_IP6_H_ +#define _NETINET6_RAW_IP6_H_ + +/* + * ICMPv6 stat is counted separately. see netinet/icmp6.h + */ +struct rip6stat { + u_quad_t rip6s_ipackets; /* total input packets */ + u_quad_t rip6s_isum; /* input checksum computations */ + u_quad_t rip6s_badsum; /* of above, checksum error */ + u_quad_t rip6s_nosock; /* no matching socket */ + u_quad_t rip6s_nosockmcast; /* of above, arrived as multicast */ + u_quad_t rip6s_fullsock; /* not delivered, input socket full */ + + u_quad_t rip6s_opackets; /* total output packets */ +}; + +#ifdef _WRS_KERNEL +extern struct rip6stat _rip6stat; +#endif + +#endif + + + diff --git a/h/wrn/coreip/netinet6/scope6_var.h b/h/wrn/coreip/netinet6/scope6_var.h new file mode 100644 index 0000000..cfe7537 --- /dev/null +++ b/h/wrn/coreip/netinet6/scope6_var.h @@ -0,0 +1,88 @@ +/* scope6_var.h - Scope ID functions */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* $KAME: scope6_var.h,v 1.10 2002/06/09 14:44:02 itojun Exp $ */ +/* $FreeBSD: src/sys/netinet6/scope6_var.h,v 1.1.2.1 2000/07/15 07:14:38 kris Exp $ */ +/* $KAME: scope6_var.h,v 1.4 2000/05/18 15:03:27 jinmei Exp $ */ + +/* + * Copyright (C) 2000 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +/* +modification history +-------------------- +01d,19apr05,kch Merged from comp_wn_ipv6_mld_interim-dev branch. +01c,07feb05,vvv _KERNEL cleanup +01b,20nov03,niq Remove copyright_wrs.h file inclusion +01a,24sep01,nee ported to clarinet from freeBSD 4.3 ver 1.14 +*/ +#ifndef _NETINET6_SCOPE6_VAR_H_ +#define _NETINET6_SCOPE6_VAR_H_ + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef _WRS_KERNEL +struct scope6_id { + /* + * 16 is correspondent to 4bit multicast scope field. + * i.e. from node-local to global with some reserved/unassigned types. + */ + u_int32_t s6id_list[16]; +}; + +void scope6_init __P((void)); +struct scope6_id *scope6_ifattach __P((struct ifnet *)); +void scope6_ifdetach __P((struct scope6_id *)); +int scope6_set __P((struct ifnet *, struct scope6_id *)); +int scope6_get __P((struct ifnet *, struct scope6_id *)); +void scope6_setdefault __P((struct ifnet *)); +int scope6_get_default __P((struct scope6_id *)); +u_int32_t scope6_in6_addrscope __P((struct in6_addr *)); +u_int32_t scope6_addr2default __P((struct in6_addr *)); +int scope6_setzoneid __P((struct ifnet *, struct sockaddr_in6 *)); +int scope6_check_id __P((struct sockaddr_in6 *, int)); +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* _NETINET6_SCOPE6_VAR_H_ */ + + + diff --git a/h/wrn/coreip/netinet6/tcp6_var.h b/h/wrn/coreip/netinet6/tcp6_var.h new file mode 100644 index 0000000..80b8c8e --- /dev/null +++ b/h/wrn/coreip/netinet6/tcp6_var.h @@ -0,0 +1,123 @@ +/* tcp_var.h - TCP-over-IPv6 variables and data structures */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/netinet6/tcp6_var.h,v 1.3.2.2 2001/12/14 20:21:11 jlemon Exp $ + */ + +/* + * Copyright (c) 1982, 1986, 1993, 1994, 1995 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp_var.h 8.4 (Berkeley) 5/24/95 + * $FreeBSD: src/sys/netinet6/tcp6_var.h,v 1.3.2.2 2001/12/14 20:21:11 jlemon Exp $ + */ + +/* +modification history +-------------------- +01j,16may05,dlk revert last change. IPv4 TOS is now available in in_coninfo. + (SPR #109227). +01i,09mar05,kc Changed tcp_rtlookup6() signature from (struct in_conninfo *) + to (struct inpcb *) (SPR#95067). +01h,07feb05,vvv _KERNEL cleanup +01g,18jan05,niq virtual stack changes for sysctl +01f,20nov03,niq Remove copyright_wrs.h file inclusion +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01c,11aug03,nee Merging from label ACCORDION_BASE6_MERGE_BASELINE in + accordion codeline to Base6 +01b,10jun03,vvv include netVersion.h +01a,10sep02,hsh add c++ protection +*/ + +#ifndef _NETINET_TCP6_VAR_H_ +#define _NETINET_TCP6_VAR_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef _WRS_KERNEL +#include +#ifndef VIRTUAL_STACK +SYSCTL_DECL_NODE_EXT(tcp6); +#endif /* VIRTUAL_STACK */ + +#ifndef VIRTUAL_STACK +extern int tcp_v6mssdflt; /* XXX */ +#endif + +struct ip6_hdr; +void tcp6_ctlinput __P((int, struct sockaddr *, void *)); +void tcp6_init __P((void)); +int tcp6_input __P((struct mbuf **, int *, int)); +struct rtentry *tcp_rtlookup6(struct in_conninfo *); + +extern struct pr_usrreqs tcp6_usrreqs; + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* _NETINET_TCP6_VAR_H_ */ diff --git a/h/wrn/coreip/netinet6/udp6_var.h b/h/wrn/coreip/netinet6/udp6_var.h new file mode 100644 index 0000000..eb2e11f --- /dev/null +++ b/h/wrn/coreip/netinet6/udp6_var.h @@ -0,0 +1,113 @@ +/* udp6_var.h - udp6 private head file */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/netinet6/udp6_var.h,v 1.3.2.1 2000/07/15 07:14:38 kris Exp $ + */ + +/* + * Copyright (c) 1982, 1986, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)udp_var.h 8.1 (Berkeley) 6/10/93 + */ + +/* +modification history +-------------------- +01i,07feb05,vvv _KERNEL cleanup +01h,31jan05,niq virtual stack changes for sysctl +01g,20nov03,niq Remove copyright_wrs.h file inclusion +01f,04nov03,rlm Ran batch header path update for header re-org. +01e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01d,10jun03,vvv include netVersion.h +01c,10sep02,hsh add c++ protection +01b,03dec01,niq Sysctl changes for Clarinet +01a,21sep01,hsh Created from BSD 4.3 +*/ + + +#ifndef _NETINET6_UDP6_VAR_H_ +#define _NETINET6_UDP6_VAR_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef _WRS_KERNEL +#include +#ifndef VIRTUAL_STACK +SYSCTL_DECL_NODE_EXT(udp6); +#endif /* VIRTUAL_STACK */ +extern struct pr_usrreqs udp6_usrreqs; + +void udp6_ctlinput __P((int, struct sockaddr *, void *)); +int udp6_input __P((struct mbuf **, int *, int)); +int udp6_output __P((struct inpcb *inp, struct mbuf *m, + struct sockaddr *addr, struct mbuf *control, + struct proc *p)); +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /*_NETINET6_UDP6_VAR_H_*/ diff --git a/h/wrn/coreip/nfs2Drv.h b/h/wrn/coreip/nfs2Drv.h new file mode 100644 index 0000000..50fed2f --- /dev/null +++ b/h/wrn/coreip/nfs2Drv.h @@ -0,0 +1,48 @@ +/* nfs2Drv.h - nfs2Drv header */ + +/* Copyright 1984 - 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,10oct03,snd written. +*/ + +#ifndef __INCnfs2Drvh +#define __INCnfs2Drvh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "wrn/netVersion.h" +#include "vwModNum.h" +#include "limits.h" +#include "hostLib.h" +#include "xdr_nfs2.h" + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS nfs2Drv (void); +extern int nfs2DrvNumGet (void); +extern STATUS nfs2Mount (char *host, char *fileSystem, char *localName); +extern STATUS nfs2MountAll (char *host, char *clientName, BOOL quiet); +extern STATUS nfs2UnmountAll (char *host); +#else + +extern STATUS nfs2Drv (); +extern int nfs2DrvNumGet (); +extern STATUS nfs2Mount (); +extern STATUS nfs2MountAll (); +extern STATUS nfs2UnMountAll (); + +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnfs2Drvh */ diff --git a/h/wrn/coreip/nfs2Lib.h b/h/wrn/coreip/nfs2Lib.h new file mode 100644 index 0000000..9ac2e8c --- /dev/null +++ b/h/wrn/coreip/nfs2Lib.h @@ -0,0 +1,131 @@ +/* nfs2Lib.h - Network File System library header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01b,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01a,10oct03,snd written +*/ + +#ifndef __INCnfs2Libh +#define __INCnfs2Libh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "wrn/netVersion.h" +#include "vwModNum.h" +#include "dirent.h" +#include "sys/stat.h" +#include "nfsCommon.h" +#include "nfsDriver.h" +#include "iosLib.h" +#include "xdr_mnt1.h" + +/* nfs file descriptor */ + + +typedef struct /* NFS_FD - NFS file descriptor */ + { + NFS_DEV *nfsDev; /* pointer to this file's NFS device */ + char curFilename[NAME_MAX + 1];/* Current file name */ + nfs_fh2 fileHandle; /* file's file handle */ + nfs_fh2 dirHandle; /* file's directory file handle */ + fattr fileAttr; /* file's attributes */ + unsigned int mode; /* (O_RDONLY, O_WRONLY, O_RDWR) */ + unsigned int fileCurByte; /* number of current byte in file */ + SEM_ID nfsFdSem; /* accessing semaphore */ + BOOL cacheValid; /* TRUE: cache valid and remaining */ + /* fields in structure are valid. */ + /* FALSE: cache is empty or */ + /* cacheCurByte not the same as the */ + /* current byte in the file. */ + char *cacheBuf; /* pointer to file's read cache */ + char *cacheCurByte; /* pointer to current byte in cache */ + unsigned int cacheBytesLeft; /* number of bytes left in cache */ + /* between cacheCurByte and the end */ + /* of valid cache material. NOTE: */ + /* This number may be smaller than */ + /* the amount of room left in for */ + /* the cache writing. */ + BOOL cacheDirty; /* TRUE: cache is dirty, not flushed */ + readdirres *dirCache; /* cache of dir list entries */ + } NFS_FD; + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void nfs2ClientClose (void); +extern STATUS nfs2DirMount (char *hostName, dirpath dirname, + nfs_fh2 *pFileHandle); + +extern STATUS nfs2DirUnmount ( char * hostName, dirpath dirName); +extern STATUS nfs2DirReadOne (NFS_FD *pFd, DIR *pDir); +extern STATUS nfs2ExportRead (char *hostName, exports *pExports); +extern void nfs2FileAttrGet (fattr *pFattr, struct stat *pStat); + +extern STATUS nfs2FsAttrGet (char* pHostName,nfs_fh2* pDirHandle, + struct statfs* pArg ); + +extern int nfs2FileRead (char *hostName, nfs_fh2 *pHandle, + unsigned int offset, unsigned int count, + char *buf, fattr *pNewAttr); + +extern STATUS nfs2FileRemove (char *hostName, nfs_fh2 *pMountHandle, + char *fullFileName); + +extern int nfs2FileWrite (char *hostName, nfs_fh2 *pHandle, + unsigned int offset, unsigned int count, + char *data, fattr *pNewAttr); +extern int nfs2LookUpByName (char *hostName, char *fileName, + nfs_fh2 *pMountHandle, diropres *pDirOpRes, + nfs_fh2 *pDirHandle, BOOL removeFlag); +extern int nfs2ThingCreate (char *hostName, char *fullFileName, + nfs_fh2 *pMountHandle, diropres *pDirOpRes, + nfs_fh2 *pDirHandle, u_int mode); +extern STATUS nfs2MntUnmountAll (char *hostName); + +extern STATUS nfs2Rename (char * hostName, nfs_fh2 * pMntHndl, + char * oldName, nfs_fh2 * pOldDirHndl, + char * newName); + +extern STATUS nfs2DevInfoGet (unsigned long nfsDevHandle, + NFS_DEV_INFO * pnfsInfo); + +extern STATUS nfs2MntDump (char * hostName); +extern STATUS nfs2ExportRead (char * hostName, exports * pExports); + + +#else + +extern STATUS nfs2DirMount (); +extern STATUS nfs2DirUnmount (); +extern STATUS nfs2DirReadOne (); +extern STATUS nfsExportFree (); +extern STATUS nfs2ExportRead (); +extern void nfs2FileAttrGet (); +extern STATUS nfs2FsAttrGet (); +extern int nfs2FileRead (); +extern STATUS nfs2FileRemove (); +extern int nfs2FileWrite (); +extern int nfs2LookUpByName (); +extern int nfs2ThingCreate (); +extern STATUS nfs2MntUnmountAll (); +extern STATUS nfs2Rename(); +extern STATUS nfs2DevInfoGet(); +extern STATUS nfs2MntDump(); +extern STATUS nfs2ExportRead (); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnfs2Libh */ diff --git a/h/wrn/coreip/nfs2dLib.h b/h/wrn/coreip/nfs2dLib.h new file mode 100644 index 0000000..81d5382 --- /dev/null +++ b/h/wrn/coreip/nfs2dLib.h @@ -0,0 +1,94 @@ +/* nfs2dLib.h - Network File System Server library header */ + +/* Copyright 1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,08aug03,bmk added extern declaration for group_export (SPR #4220) +01c,21apr94,jmm more cleanup of prototypes; added NFSD_ARGUMENT +01b,20apr94,jmm added new prototypes +01a,31mar94,jmm written. +*/ + +#ifndef __INCnfsdLibh +#define __INCnfsdLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "limits.h" +#include "xdr_nfs2.h" + +/* Extern declaration for group_export */ + +extern int group_export; + +typedef struct + { + int volumeId; /* Volume identifier of the File System */ + ULONG fsId; /* Inode of the exported directory */ + ULONG inode; /* Inode of the file as returned from stat */ + INT8 reserved[20]; /* NFS v2 File Handle has 32 bytes */ + } NFS2_FILE_HANDLE; + +/* + * Structure to hold the statistics of + * number of NFS v2 RPC calls received from remote clients. + */ + +typedef struct + { + int nullCalls; /* Number of calls to NFSPROC_NULL */ + int getattrCalls; /* Number of calls to NFSPROC_GETATTR */ + int setattrCalls; /* Number of calls to NFSPROC_SETATTR */ + int rootCalls; /* Number of calls to NFSPROC_ROOT */ + int lookupCalls; /* Number of calls to NFSPROC_LOOKUP */ + int readlinkCalls; /* Number of calls to NFSPROC_READLINK */ + int readCalls; /* Number of calls to NFSPROC_READ */ + int writecacheCalls; /* Number of calls to NFSPROC_WRITECACHE */ + int writeCalls; /* Number of calls to NFSPROC_WRITE */ + int createCalls; /* Number of calls to NFSPROC_CREATE */ + int removeCalls; /* Number of calls to NFSPROC_REMOVE */ + int renameCalls; /* Number of calls to NFSPROC_RENAME */ + int linkCalls; /* Number of calls to NFSPROC_LINK */ + int symlinkCalls; /* Number of calls to NFSPROC_SYMLINK */ + int mkdirCalls; /* Number of calls to NFSPROC_MKDIR */ + int rmdirCalls; /* Number of calls to NFSPROC_RMDIR */ + int readdirCalls; /* Number of calls to NFSPROC_READDIR */ + int statfsCalls; /* Number of calls to NFSPROC_STATFS */ + } NFS2_SERVER_STATUS; + +/* + * Union of Expected Argument for NFS v2 procedure + * call (wherever applicable). + * Description against each argument not given as the member + * name is descriptive enough. + * The definitions of types are available in "xdr_nfs2.h" file + */ + +typedef union + { + nfs_fh2 nfsproc_getattr_2_arg; + sattrargs nfsproc_setattr_2_arg; + diropargs nfsproc_lookup_2_arg; + nfs_fh2 nfsproc_readlink_2_arg; + readargs nfsproc_read_2_arg; + writeargs nfsproc_write_2_arg; + createargs nfsproc_create_2_arg; + diropargs nfsproc_remove_2_arg; + renameargs nfsproc_rename_2_arg; + linkargs nfsproc_link_2_arg; + symlinkargs nfsproc_symlink_2_arg; + createargs nfsproc_mkdir_2_arg; + diropargs nfsproc_rmdir_2_arg; + readdirargs nfsproc_readdir_2_arg; + nfs_fh2 nfsproc_statfs_2_arg; + } NFS2D_ARGUMENT; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnfsdLibh */ diff --git a/h/wrn/coreip/nfs3Defines.h b/h/wrn/coreip/nfs3Defines.h new file mode 100644 index 0000000..8f3b1ce --- /dev/null +++ b/h/wrn/coreip/nfs3Defines.h @@ -0,0 +1,114 @@ +/* nfs3Defines.h - Network File System version 3 definitions header */ + +/* Copyright 1995-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,28jun04,dlk Added modification history. Removed commented-out + S_nfsLib_NFS3ERR_* defines, which interfere with makeStatTbl. +*/ + + +#ifndef __INCnfs3Definesh +#define __INCnfs3Definesh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" + +struct nfsinfo { + uint32 rtmax; + uint32 rtpref; + uint32 rtmult; + uint32 wtmax; + uint32 wtpref; + uint32 wtmult; + uint32 dtpref; + size3 maxfilesize; + nfstime3 time_delta; + uint32 properties; +}; + +typedef struct nfsinfo nfsinfo; + +#define NFS3_FHSIZE 64 +#define NFS3_COOKIEVERFSIZE 8 +#define NFS3_CREATEVERFSIZE 8 +#define NFS3_WRITEVERFSIZE 8 + +#define PA_ATTR post_op_attr_u.attributes +#define PA_TYPE post_op_attr_u.attributes.type +#define PA_MODE post_op_attr_u.attributes.mode +#define PA_SIZE post_op_attr_u.attributes.size +#define PA_UID post_op_attr_u.attributes.uid +#define PA_GID post_op_attr_u.attributes.gid +#define PA_ATIME post_op_attr_u.attributes.atime +#define PA_MTIME post_op_attr_u.attributes.mtime +#define PA_CTIME post_op_attr_u.attributes.ctime + +#define RLOK_ATTR READLINK3res_u.resok.symlink_attributes +#define RLOK_PATH READLINK3res_u.resok.data +#define RLFL_ATTR READLINK3res_u.resfail.symlink_attributes + +#define LUOK_FH LOOKUP3res_u.resok.object +#define LUOK_OBJATTR LOOKUP3res_u.resok.obj_attributes +#define LUOK_DIRATTR LOOKUP3res_u.resok.dir_attributes +#define LUFL_DIRATTR LOOKUP3res_u.resfail.dir_attributes + +#define CTAR_OBJATTR how.createhow3_u.obj_attributes +#define CTAR_VERF how.createhow3_u.verf +#define CTOK_FH CREATE3res_u.resok.obj +#define CTOK_OBJ CREATE3res_u.resok.obj +#define CTOK_OBJATTR CREATE3res_u.resok.obj_attributes +#define CTOK_WCC CREATE3res_u.resok.dir_wcc +#define CTFL_WCC CREATE3res_u.resfail.dir_wcc + +#define REOK_FILEATTR READ3res_u.resok.file_attributes +#define REOK_COUNT READ3res_u.resok.count +#define REOK_EOF READ3res_u.resok.eof +#define REOK_DATA READ3res_u.resok.data +#define REFL_FILEATTR READ3res_u.resfail.file_attributes + +#define WROK_FILEWCC WRITE3res_u.resok.file_wcc +#define WROK_COUNT WRITE3res_u.resok.count +#define WROK_COMMIT WRITE3res_u.resok.committed +#define WROK_VERF WRITE3res_u.resok.verf +#define WRFL_FILEWCC WRITE3res_u.resfail.file_wcc + +#define PE_SIZE pre_op_attr_u.attributes.size +#define PE_MTIME pre_op_attr_u.attributes.mtime +#define PE_CTIME pre_op_attr_u.attributes.ctime + +#define GAOK_ATTR GETATTR3res_u.resok.obj_attributes + +#define SATT_MODE mode.set_mode3_u.mode +#define SATT_UID uid.set_uid3_u.uid +#define SATT_GID gid.set_gid3_u.gid +#define SATT_SIZE size.set_size3_u.size +#define SATT_ATIME atime.set_atime_u.atime +#define SATT_MTIME atime.set_mtime_u.mtime + +#define RDOK_DIRATTR READDIR3res_u.resok.dir_attributes +#define RDOK_COOKIEVERF READDIR3res_u.resok.cookieverf +#define RDOK_REPLY READDIR3res_u.resok.reply + +#define FIOK_INFO_OFF FSINFO3res_u.resok.rtmax + +#define PF_FH post_op_fh3_u.handle + +#define FH_BUF data.data_val +#define COPY_FH(pf1, pf2) \ + bcopy ((char *) (pf1)->data.data_val, (char *) (pf2)->data.data_val, \ + (pf1)->data.data_len); \ + (pf2)->data.data_len = (pf1)->data.data_len; +#define ASSIGN_FH(pf1, pf2) \ + bcopy ((char *) pf1, (char *) pf2, sizeof(nfs_fh3)); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnfs3Definesh */ diff --git a/h/wrn/coreip/nfs3Drv.h b/h/wrn/coreip/nfs3Drv.h new file mode 100644 index 0000000..a54c9c3 --- /dev/null +++ b/h/wrn/coreip/nfs3Drv.h @@ -0,0 +1,53 @@ +/* nfs3Drv.h - nfs3Drv header */ + +/* Copyright 1984 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,05nov04,vvv added nfsDriver.h (SPR #103655) +01a,10oct03,snd written +*/ + +#ifndef __INCnfs3Drvh +#define __INCnfs3Drvh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "limits.h" +#include "hostLib.h" +#include "xdr_nfs3.h" +#include "nfsDriver.h" + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS nfs3Drv (void); +extern int nfs3DrvNumGet (void); +extern STATUS nfs3Mount (char *host, char *fileSystem, char *localName); +extern STATUS nfs3MountAll (char *host, char *clientName, BOOL quiet); +extern STATUS nfs3UnmountAll (char *host); +extern STATUS nfs3DevInfoGet (unsigned long nfsDevHandle,NFS_DEV_INFO * info); + +#else + +extern STATUS nfs3Drv (); +extern int nfs3DrvNumGet (); +extern STATUS nfs3Mount (); +extern STATUS nfs3MountAll (); +extern STATUS nfs3UnmountAll (); +extern NFS3_DEV * nfsDevFind (); +extern STATUS nfs3DevInfoGet (); + +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnfs3Drvh */ diff --git a/h/wrn/coreip/nfs3Lib.h b/h/wrn/coreip/nfs3Lib.h new file mode 100644 index 0000000..5405a6f --- /dev/null +++ b/h/wrn/coreip/nfs3Lib.h @@ -0,0 +1,137 @@ +/* nfs3Lib.h - Network File System library header */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,05nov04,vvv added nfsCommon.h (SPR #103655) +01c,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01b,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01a,10oct03,snd written +*/ + +#ifndef __INCnfs3Libh +#define __INCnfs3Libh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "dirent.h" +#include "iosLib.h" +#include "ioLib.h" +#include "sys/stat.h" +#include "xdr_mnt3.h" +#include "xdr_nfs3.h" +#include "nfs3Defines.h" +#include "nfsCommon.h" + +#define NAME3_MAX 255 +/* nfs file descriptor */ + +typedef struct /* NFS3_FD - NFS file descriptor */ + { + NFS3_DEV *nfsDev; /* pointer to this file's NFS device */ + char curFilename [NAME_MAX+1]; /* Current file name */ + nfs_fh3 fileHandle; /* file's file handle */ + nfs_fh3 dirHandle; /* file's directory file handle */ + fattr3 fileAttr; /* file's attributes */ + unsigned int mode; /* (O_RDONLY, O_WRONLY, O_RDWR) */ + unsigned int fileCurByte; /* number of current byte in file */ + SEM_ID nfsFdSem; /* accessing semaphore */ + BOOL cacheValid; /* TRUE: cache valid and remaining */ + /* fields in structure are valid. */ + /* FALSE: cache is empty or */ + /* cacheCurByte not the same as the */ + /* current byte in the file. */ + char *cacheBuf; /* pointer to file's read cache */ + char *cacheCurByte; /* pointer to current byte in cache */ + unsigned int cacheBytesLeft; /* number of bytes left in cache */ + /* between cacheCurByte and the end */ + /* of valid cache material. NOTE: */ + /* This number may be smaller than */ + /* the amount of room left in for */ + /* the cache writing. */ + BOOL cacheDirty; /* TRUE: cache is dirty, not flushed */ + cookie3 *pdir_cookie; /* This is the NFS3 directory cookie */ + cookieverf3 dir_cookieverf; /* The directory entry's cookie verifier */ + /* Stored here because there is no space */ + /* in the Directory entry DIR structure */ + READDIR3res *dirCache; /* cache of dir list entries */ + } NFS3_FD; + + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS nfs3DirMount (char *hostName, dirpath dirname, + nfs_fh3 *pFileHandle); + +extern STATUS nfs3DirUnmount (char * hostName, dirpath dirName); +extern STATUS nfs3ExportRead (char *hostName, exports *pExports); +extern void nfs3FileAttrGet (fattr3 *pFattr, struct stat *pStat); + +extern STATUS nfs3FsAttrGet (char* pHostName,nfs_fh3* pDirHandle, + struct statfs* pArg ); + +extern int nfs3FileRead (char *hostName, nfs_fh3 *pHandle, + unsigned int offset, unsigned int count, + char *buf, fattr3 *pNewAttr); +extern STATUS nfs3FileRemove (char *hostName, nfs_fh3 *pMountHandle, + char *fullFileName); +extern int nfs3FileWrite (char *hostName, nfs_fh3 *pHandle, + unsigned int offset, unsigned int count, + char *data, fattr3 *pNewAttr); +extern int nfs3LookUpByName (char *hostName, char *fileName, + nfs_fh3 *pMountHandle, LOOKUP3res *pDirOpRes, + nfs_fh3 *pDirHandle, BOOL removeFlag); +extern int nfs3ThingCreate (char *hostName, char * fullFileName, + nfs_fh3 *pMountHandle, CREATE3res *pDirOpRes, + nfs_fh3 *pDirHandle, u_int mode); + +extern STATUS nfs3DirReadOne ( NFS3_FD *pFd,DIR * pDir ); + +extern STATUS nfs3FsInfoGet (char * pHostName, nfs_fh3 * pMountHandle, + nfsinfo * pArg); +extern STATUS nfs3Rename ( char *hostName, nfs_fh3 *pMountHandle, + char *oldName, nfs_fh3 *pOldDirHandle, + char *newName); +extern STATUS nfs3MntUnmountAll ( char *hostName); + +extern STATUS nfs3MntDump (char *hostName); + +extern STATUS nfs3ExportRead (char *hostName, exports *pExports); + +#else + +extern STATUS nfs3DirMount (); +extern STATUS nfs3DirUnmount (); +extern STATUS nfs3DirReadOne (); +extern STATUS nfs3ExportFree (); +extern STATUS nfs3ExportRead (); +extern void nfs3FileAttrGet (); +extern STATUS nfs3FsAttrGet (); +extern int nfs3FileRead (); +extern STATUS nfs3FileRemove (); +extern int nfs3FileWrite (); +extern int nfs3LookUpByName (); +extern int nfs3ThingCreate (); +extern STATUS nfs3DirReadOne (); +extern STATUS nfs3FsInfoGet (); +extern STATUS nfs3MntUnmountAll (); +extern STATUS nfs3Rename(); +extern STATUS nfs3MntUnmountAll(); +extern STATUS nfs3MntDump(); +extern STATUS nfs3ExportRead (); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnfs3Libh */ diff --git a/h/wrn/coreip/nfs3dLib.h b/h/wrn/coreip/nfs3dLib.h new file mode 100644 index 0000000..95bb800 --- /dev/null +++ b/h/wrn/coreip/nfs3dLib.h @@ -0,0 +1,149 @@ +/* nfs3dLib.h - NFS v3 Server Library Header */ + +/* Copyright 1984 - 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,08aug03,smc written +*/ + +#ifndef __INCnfs3dLibh +#define __INCnfs3dLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "limits.h" +#include "xdr_nfs3.h" + +#define NFS3_MAXPATHLEN 1024 +#define NFS3_MAXNAMLEN 255 +#define NFS3_DEFAULT_STACK_SIZE 14000 +#define NFS3_DEFAULT_NFS_SERVERS 4 +#define NFS3_DEFAULT_PRIORITY 55 +#define NFS3_DEFAULT_FILE_SYSTEMS 10 + +/* NFS specific FS Info parameters */ +#define NFS3_MAXBLKSIZE 8192 +#define NFS3_PAGE_SIZE 1024 +#define NFS3_FSF_DEFAULT 0x0018 + +#define NFS3_FSF_LINK 0x0001 +#define NFS3_FSF_SYMLINK 0x0002 +#define NFS3_FSFHOMOGENEOUS 0x0008 +#define NFS3_FSF_CANSETTIME 0x0010 + +/* Max num of entries in the Queue */ +#define QLEN_PER_SRVR 10 + +/* #define OUTPUT_FMT "%15s %8d\n" */ + +/* + * NFS3_ACCESS_WRITE is defined as an OR of + * MODIFY | EXTEND | DELETE accesses. + * 0x0004 | 0x0008 | 0x0010 + */ + +#define NFS3_ACCESS_WRITE 0x001C +#define NFS3_ACCESS_RONLY 0x0023 +#define NFS3_ACCESS_RW 0x003F + +#define NFS3_DOS_WR_ACCESS 0x092 +#define NFS3_DOS_RW 0x01FF + +/* Macros to access the reply structure members of NFS v3 procedures */ +#define FILE_HANDLE_LEN data.data_len +#define FILE_HANDLE data.data_val + +#define POST_OP_HANDLE_LEN post_op_fh3_u.handle.FILE_HANDLE_LEN +#define POST_OP_HANDLE post_op_fh3_u.handle.FILE_HANDLE + +#define ATTR_FOL attributes_follow + +#define BEFORE_ATTR_FOL before.ATTR_FOL +#define AFTER_ATTR_FOL after.ATTR_FOL + +#define OBJ_ATTR_FOLLOW obj_attributes.attributes_follow +#define SYMLINK_ATTR_FOLLOW symlink_attributes.attributes_follow +#define FILE_ATTR_FOLLOW file_attributes.attributes_follow +#define DIR_ATTR_FOLLOW dir_attributes.attributes_follow + +/* File Handle Information as per DOS FS on VxWorks */ + +typedef struct + { + int volumeId; /* Volume identifier of the File System */ + ULONG fsId; /* Inode of the exported directory */ + ULONG inode; /* Inode of the file as returned from stat */ + INT8 reserved[52]; /* NFS v3 File Handle has 64 bytes */ + } NFS3_FILE_HANDLE; + +/* NFS v3 Procedure call statistics */ + +typedef struct + { + int nullCalls; /* Number of calls to NFSPROC_NULL */ + int getattrCalls; /* Number of calls to NFSPROC_GETATTR */ + int setattrCalls; /* Number of calls to NFSPROC_SETATTR */ + int lookupCalls; /* Number of calls to NFSPROC_LOOKUP */ + int accessCalls; /* Number of calls to NFSPROC_ACCESS */ + int readlinkCalls; /* Number of calls to NFSPROC_READLINK */ + int readCalls; /* Number of calls to NFSPROC_READ */ + int writeCalls; /* Number of calls to NFSPROC_WRITE */ + int createCalls; /* Number of calls to NFSPROC_CREATE */ + int mkdirCalls; /* Number of calls to NFSPROC_MKDIR */ + int symlinkCalls; /* Number of calls to NFSPROC_SYMLINK */ + int mknodCalls; /* Number of calls to NFSPROC_MKNOD */ + int removeCalls; /* Number of calls to NFSPROC_REMOVE */ + int rmdirCalls; /* Number of calls to NFSPROC_RMDIR */ + int renameCalls; /* Number of calls to NFSPROC_RENAME */ + int linkCalls; /* Number of calls to NFSPROC_LINK */ + int readdirCalls; /* Number of calls to NFSPROC_READDIR */ + int readdirplusCalls; /* Number of calls to NFSPROC_READDIRPLUS */ + int fsstatCalls; /* Number of calls to NFSPROC_FSSTAT */ + int fsinfoCalls; /* Number of calls to NFSPROC_FSINFO */ + int pathconfCalls; /* Number of calls to NFSPROC_PATHCONF */ + int commitCalls; /* Number of calls to NFSPROC_COMMIT */ + } NFS3_SERVER_STATUS; + +/* + * Union of Expected Argument for NFS v3 procedure + * call (wherever applicable). + * Description against each argument not given as the member + * name is descriptive enough + * The definitions of types are available in "xdr_nfs3.h" file + */ + +typedef union + { + GETATTR3args nfsproc_getattr_3_arg; + SETATTR3args nfsproc_setattr_3_arg; + LOOKUP3args nfsproc_lookup_3_arg; + ACCESS3args nfsproc_access_3_arg; + READLINK3args nfsproc_readlink_3_arg; + READ3args nfsproc_read_3_arg; + WRITE3args nfsproc_write_3_arg; + CREATE3args nfsproc_create_3_arg; + MKDIR3args nfsproc_mkdir_3_arg; + SYMLINK3args nfsproc_symlink_3_arg; + MKNOD3args nfsproc_mknod_3_arg; + REMOVE3args nfsproc_remove_3_arg; + RMDIR3args nfsproc_rmdir_3_arg; + RENAME3args nfsproc_rename_3_arg; + LINK3args nfsproc_link_3_arg; + READDIR3args nfsproc_readdir_3_arg; + READDIRPLUS3args nfsproc_readdirplus_3_arg; + FSSTAT3args nfsproc_fsstat_3_arg; + FSINFO3args nfsproc_fsinfo_3_arg; + PATHCONF3args nfsproc_pathconf_3_arg; + COMMIT3args nfsproc_commit_3_arg; + } NFS3D_ARGUMENT; + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnfs3dLibh */ diff --git a/h/wrn/coreip/nfsCommon.h b/h/wrn/coreip/nfsCommon.h new file mode 100644 index 0000000..f2e4fed --- /dev/null +++ b/h/wrn/coreip/nfsCommon.h @@ -0,0 +1,217 @@ +/* nfsCommon.h - nfsDrv header */ + +/* + * Copyright (c) 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01d,26may05,mwv SPR#109563 work around for to avoid closing socket FD from + incorrect RTP context. +01c,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01b,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01a,10oct03,snd Written +*/ + +#ifndef __INCnfsCommonh +#define __INCnfsCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "limits.h" +#include "hostLib.h" +#include "xdr_nfs_common.h" +#include "xdr_nfs2.h" +#include "xdr_nfs3.h" +#include "iosLib.h" +#include "rpcLib.h" +#include "sys/socket.h" +#include "nfsDriver.h" +#include "ctype.h" +#include "fioLib.h" + +/* defines */ + +/* file status types -- from the nfs protocol spec, if these change, + then the FSTAT values in ioLib.h should also be changed */ + +#define NFS_FSTAT_DIR 0040000 /* directory */ +#define NFS_FSTAT_CHR 0020000 /* character special file */ +#define NFS_FSTAT_BLK 0060000 /* block special file */ +#define NFS_FSTAT_REG 0100000 /* regular file */ +#define NFS_FSTAT_LNK 0120000 /* symbolic link file */ +#define NFS_FSTAT_NON 0140000 /* named socket */ + + +/* nfsLib status codes */ + +#define S_nfsLib_NFS_AUTH_UNIX_FAILED (M_nfsLib | 1) +#define S_nfsLib_NFS_INAPPLICABLE_FILE_TYPE (M_nfsLib | 2) + +#define S_nfsLib_NFS_OK (M_nfsStat | (int) NFS_OK) +#define S_nfsLib_NFSERR_PERM (M_nfsStat | (int) NFSERR_PERM) +#define S_nfsLib_NFSERR_NOENT (M_nfsStat | (int) NFSERR_NOENT) +#define S_nfsLib_NFSERR_IO (M_nfsStat | (int) NFSERR_IO) +#define S_nfsLib_NFSERR_NXIO (M_nfsStat | (int) NFSERR_NXIO) +#define S_nfsLib_NFSERR_ACCESS (M_nfsStat | (int) NFSERR_ACCESS) +#define S_nfsLib_NFSERR_EXIST (M_nfsStat | (int) NFSERR_EXIST) +#define S_nfsLib_NFSERR_NODEV (M_nfsStat | (int) NFSERR_NODEV) +#define S_nfsLib_NFSERR_NOTDIR (M_nfsStat | (int) NFSERR_NOTDIR) +#define S_nfsLib_NFSERR_ISDIR (M_nfsStat | (int) NFSERR_ISDIR) +#define S_nfsLib_NFSERR_INVAL (M_nfsStat | (int) NFSERR_INVAL) +#define S_nfsLib_NFSERR_FBIG (M_nfsStat | (int) NFSERR_FBIG) +#define S_nfsLib_NFSERR_NOSPC (M_nfsStat | (int) NFSERR_NOSPC) +#define S_nfsLib_NFSERR_ROFS (M_nfsStat | (int) NFSERR_ROFS) +#define S_nfsLib_NFSERR_NAMETOOLONG (M_nfsStat | (int) NFSERR_NAMETOOLONG) +#define S_nfsLib_NFSERR_NOTEMPTY (M_nfsStat | (int) NFSERR_NOTEMPTY) +#define S_nfsLib_NFSERR_DQUOT (M_nfsStat | (int) NFSERR_DQUOT) +#define S_nfsLib_NFSERR_STALE (M_nfsStat | (int) NFSERR_STALE) +#define S_nfsLib_NFSERR_WFLUSH (M_nfsStat | (int) NFSERR_WFLUSH) +#define S_nfsLib_NFSERR_REMOTE (M_nfsStat | (int) NFSERR_REMOTE) +#define S_nfsLib_NFSERR_BADHANDLE (M_nfsStat | (int) NFSERR_BADHANDLE) +#define S_nfsLib_NFSERR_NOT_SYNC (M_nfsStat | (int) NFSERR_NOT_SYNC) +#define S_nfsLib_NFSERR_BAD_COOKIE (M_nfsStat | (int) NFSERR_BAD_COOKIE) +#define S_nfsLib_NFSERR_NOTSUPP (M_nfsStat | (int) NFSERR_NOTSUPP) +#define S_nfsLib_NFSERR_TOOSMALL (M_nfsStat | (int) NFSERR_TOOSMALL) +#define S_nfsLib_NFSERR_SERVERFAULT (M_nfsStat | (int) NFSERR_SERVERFAULT) +#define S_nfsLib_NFSERR_BADTYPE (M_nfsStat | (int) NFSERR_BADTYPE) +#define S_nfsLib_NFSERR_JUKEBOX (M_nfsStat | (int) NFSERR_JUKEBOX) + +/* default NFS parameters */ + +#define NFS_TIMEOUT_SEC 25 +#define NFS_TIMEOUT_USEC 0 +#define NFS_SOCKOPTVAL 10000 +#define NFS_REXMIT_SEC 5 +#define NFS_REXMIT_USEC 0 + +#define AUTH_UNIX_FIELD_LEN 50 /* UNIX authentication info */ +#define MAX_GRPS 20 /* max. # of groups that user is in */ + + +/* Max number of versions supported for the MOUNT protocol */ +#define MAX_MNT_VERSIONS 4 +#define MAX_MNT_SUPPORTED_VERSIONS 2 + +#define WRITE_PERMISSION 2 + +/* +Static RPC information. +Set on initial NFS invocation and re-used during +subsequent calls on a per task basis. +*/ + +typedef struct moduleStatics + { + CLIENT *client; /* pointer to client structure */ + int socket; /* socket associated with this client */ + int oldprognum; /* last program number used with this client */ + int oldversnum; /* last version number used with this client */ + int authCount; /* auth count this client was built with */ + int valid; /* if TRUE, then this client information is valid */ + RTP_ID tempRtpId; /* SPR#109563 */ + char oldhost [MAXHOSTNAMELEN]; + /* last host name that was used with this client */ + } NFS_MODULE_STATICS; + +typedef struct /* NFS_AUTH_UNIX_TYPE - UNIX authentication structure */ + { + char machname [AUTH_UNIX_FIELD_LEN]; /* host name where client is */ + int uid; /* client's UNIX effective uid */ + int gid; /* client's current group ID */ + int len; /* element length of aup_gids */ + int aup_gids [MAX_GRPS]; /* array of groups user is in */ + } NFS_AUTH_UNIX_TYPE ; + +typedef struct /* NFS_DEV - nfs v2 device structure */ + { + DEV_HDR devHdr; /* nfs device header */ + char host[MAXHOSTNAMELEN]; /* host for this device */ + nfs_fh2 fileHandle; /* handle for mounted file system */ + + /* + * File system mounted on this dev - though it appears as a single + * character, it is really a character array - the memory for the array + * is allocated when an NFS_DEV struct is allocated. This change was + * required for configurable file path length support. + */ + + char fileSystem[1]; + } NFS_DEV; + +typedef struct /* NFS_DEV - nfs device structure */ + { + DEV_HDR devHdr; /* nfs device header */ + char host[MAXHOSTNAMELEN]; /* host for this device */ + nfs_fh3 fileHandle; /* handle for mounted file system */ + + /* + * File system mounted on this dev - though it appears as a single + * character, it is really a character array - the memory for the array + * is allocated when an NFS_DEV struct is allocated. This change was + * required for configurable file path length support. + */ + + char fileSystem[1]; + } NFS3_DEV; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + + +extern STATUS nfsExportShow (char *hostName); +extern void nfsAuthUnixGet (char *machname, int *pUid, int *pGid, + int *pNgids, int *gids); +extern void nfsAuthUnixSet (char *machname, int uid, int gid, + int ngids, int *aup_gids); +extern void nfsAuthUnixPrompt (void); +extern void nfsAuthUnixShow (void); +extern void nfsHelp (void); +extern void nfsIdSet (int uid); +extern void nfsClientClose (void); +extern STATUS nfsDevInfoGet(unsigned long nfsDevHandle, NFS_DEV_INFO * pnfsinfo); +extern int nfsDevListGet (unsigned long nfsDevList[], int listsize); +extern STATUS nfsExportFree(char * pExports); +extern STATUS nfsInit(void); +extern STATUS nfsClientCall(const char * host, u_int prognum, u_int versnum, + u_int procnum, xdrproc_t inproc, char * in, + xdrproc_t outproc, char * out); + +extern int nfsChkFilePerms (int nfsPerms, int ruid, int rgid, int perm); +extern void nfsErrnoSet (enum nfsstat status); + +#else + +extern STATUS nfsExportShow ( ); +extern void nfsAuthUnixGet ( ); +extern void nfsAuthUnixSet (); +extern void nfsAuthUnixPrompt (); +extern void nfsAuthUnixShow (); +extern void nfsHelp (); +extern void nfsIdSet (); +extern void nfsClientClose (); +extern STATUS nfsDevInfoGet(); +extern int nfsDevListGet (); +extern STATUS nfsExportFree(); +extern STATUS nfsInit(void); +extern STATUS nfsClientCall(); +extern int nfsChkFilePerms(); +extern void nfsErrnoSet (enum nfsstat status); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + + +#endif /* __INCnfsCommonh */ diff --git a/h/wrn/coreip/nfsDriver.h b/h/wrn/coreip/nfsDriver.h new file mode 100644 index 0000000..e07d967 --- /dev/null +++ b/h/wrn/coreip/nfsDriver.h @@ -0,0 +1,86 @@ +/* nfsDriver.h - nfsDrv header */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,10oct03,snd written. +*/ + +#ifndef __INCnfsDriverh +#define __INCnfsDriverh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vwModNum.h" +#include "limits.h" +#include "hostLib.h" +#include "xdr_mnt_common.h" +#include "xdr_nfs_common.h" + +/* globals */ +typedef struct + { + + char hostName [MAXHOSTNAMELEN]; /* Host of imported NFS */ + char *remFileSys; /* Remote File System Name */ + char *locFileSys; /* Local File System Name */ + + } NFS_DEV_INFO; + + +/* nfsDrv status codes */ + +#define S_nfsDrv_INVALID_NUMBER_OF_BYTES (M_nfsDrv | 1) +#define S_nfsDrv_BAD_FLAG_MODE (M_nfsDrv | 2) +#define S_nfsDrv_CREATE_NO_FILE_NAME (M_nfsDrv | 3) +#define S_nfsDrv_FATAL_ERR_FLUSH_INVALID_CACHE (M_nfsDrv | 4) +#define S_nfsDrv_WRITE_ONLY_CANNOT_READ (M_nfsDrv | 5) +#define S_nfsDrv_READ_ONLY_CANNOT_WRITE (M_nfsDrv | 6) +#define S_nfsDrv_NOT_AN_NFS_DEVICE (M_nfsDrv | 7) +#define S_nfsDrv_NO_HOST_NAME_SPECIFIED (M_nfsDrv | 8) +#define S_nfsDrv_PERMISSION_DENIED (M_nfsDrv | 9) +#define S_nfsDrv_NO_SUCH_FILE_OR_DIR (M_nfsDrv | 10) +#define S_nfsDrv_IS_A_DIRECTORY (M_nfsDrv | 11) + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS nfs2Drv (void); +extern STATUS nfs3Drv (void); +extern int nfsDrvNumGet (int version); +extern STATUS nfsMount (const char *host, const char *fileSystem, + const char *localName); +extern STATUS nfsMountAll (const char *host, const char *clientName, + BOOL quiet); +extern void nfsDevShow (void); +extern STATUS nfsUnmount (const char *localName); +extern int nfsDevListGet (unsigned long nfsDevList [], int listSize); +extern STATUS nfsDevInfoGet (unsigned long nfsDevHandle, + NFS_DEV_INFO * pnfsInfo); +extern STATUS nfsMntDump (const char * hostName); +#else + +extern STATUS nfs2Drv (); +extern STATUS nfs3Drv (); +extern int nfsDrvNumGet (); +extern STATUS nfsMount (); +extern STATUS nfsMountAll (); +extern void nfsDevShow (); +extern STATUS nfsUnmount (); +extern int nfsDevListGet (); +extern STATUS nfsDevInfoGet (); +extern STATUS nfsMntDump (); + +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnfsDriverh */ diff --git a/h/wrn/coreip/nfsd.h b/h/wrn/coreip/nfsd.h new file mode 100644 index 0000000..74cb9fa --- /dev/null +++ b/h/wrn/coreip/nfsd.h @@ -0,0 +1,115 @@ +/* nfsd.h - NFS Server Library Header */ + +/* Copyright 1984 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,21jun04,vvv added virtual stack support +01a,15sep03,msc written +*/ + +#ifndef __INCnfsdh +#define __INCnfsdh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "limits.h" +#include "nfs2dLib.h" +#include "nfs3dLib.h" + +/* Defines */ +#define NFS_VERSION_2 0x01 +#define NFS_VERSION_3 0x02 +#define NFS_VERSION_ALL 0x00 + +/* Data Structures */ + +/* Configuration structure for the initialization function nfsdInstInit() */ + +typedef struct nfsdCfgParams + { + CFG_DATA_HDR cfgh; + int cfg_nServer; + int cfg_nExportedFs; + int cfg_priority; + FUNCPTR cfg_authHook; + FUNCPTR cfg_mountAuthHook; + int cfg_options; + } NFSD_CFG_PARAMS; + +/* svcudp_data is copied directly from svc_udp.c - DO NOT MODIFY */ + +struct svcudp_data { + u_int su_iosz; /* byte size of send.recv buffer */ + u_long su_xid; /* transaction id */ + XDR su_xdrs; /* XDR handle */ + char su_verfbody[MAX_AUTH_BYTES]; /* verifier body */ + char *su_cache; /* cached data, NULL if no cache - 4.0 */ +}; + +typedef struct + { + int version; + union + { + NFS2D_ARGUMENT nfs2Arg; + NFS3D_ARGUMENT nfs3Arg; + }nfsArg_u; + } NFSD_ARGUMENT; + +typedef struct + { + FUNCPTR routine; /* nfsproc_*_2 routine to call */ + int procNum; /* NFS procedure number */ + NFSD_ARGUMENT * argument; /* argument to pass to nfsproc_*_2 */ + FUNCPTR xdrArg; /* XDR function pointer to convert argument */ + FUNCPTR xdrResult; /* XDR function pointer to convert result */ + struct sockaddr_in sockAddr; /* Address of the client socket */ + int xid; /* RPC XID of client request */ + int socket; /* Socket to use to send reply */ + void *nfsCache; /* Server reply cache member */ + } NFS_Q_REQUEST; + + +typedef void (*NFSDCALLBACK) (struct svc_req * rqstp, SVCXPRT *transp); + + +/* Globals */ + +extern int nfsServMaxPath; +extern int nfsMaxFileName; +extern NFS2_SERVER_STATUS *pnfs2ServerStat; + +extern int *pnfsdRebootTime; /* time to be used for write verf */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS nfsdInit (int nServers, int nExportedFs, int priority, + FUNCPTR nfsAuthHook, FUNCPTR mountAuthHook, + int options); + +#ifdef VIRTUAL_STACK +extern void nfsdRequestProcess (int); +extern void nfsd (int, int); +#else +extern void nfsdRequestProcess (void); +extern void nfsd (int); +#endif /* VIRTUAL_STACK */ + +#else + + +extern STATUS nfsdInit (); +extern void nfsdRequestProcess (); +extern void nfsd (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnfsdh */ diff --git a/h/wrn/coreip/nfsdCommon.h b/h/wrn/coreip/nfsdCommon.h new file mode 100644 index 0000000..0c32864 --- /dev/null +++ b/h/wrn/coreip/nfsdCommon.h @@ -0,0 +1,66 @@ +/* nfsdLib.h - NFS v3 Server Library Header */ + +/* Copyright 1984 - 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,15sep03,msc written +*/ + +#ifndef __INCnfsdCommonh +#define __INCnfsdCommonh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "limits.h" +#include "nfs2dLib.h" +#include "nfs3dLib.h" + +/* Data Structures */ + +/* Common data of file handle irrespective of v2 or v3 */ +typedef struct + { + int volumeId; /* Volume identifier of the File System */ + ULONG fsId; /* Inode of the exported directory */ + ULONG inode; /* Inode of the file as returned from stat */ + } NFS_FILE_HANDLE; + + +extern NFS3_SERVER_STATUS nfs3ServerStatus; +extern NFS2_SERVER_STATUS nfs2ServerStatus; + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS nfsdStatusGet (void * serverStats, int version); +extern STATUS nfsdStatusShow (int options); +extern STATUS nfsdFhCreate (NFS_FILE_HANDLE * parentDir, char * fileName, + NFS_FILE_HANDLE * fh); + +extern STATUS nfsdFhToName (NFS_FILE_HANDLE * fh, char * fileName); +extern nfsstat nfsdErrToNfs (int theErr); +extern void nfsdFhHton (NFS_FILE_HANDLE * fh); +extern void nfsdFhNtoh (NFS_FILE_HANDLE * fh); +extern int nfsdFsReadOnly (NFS_FILE_HANDLE * fh); + +#else + +extern STATUS nfsdStatusGet (); +extern STATUS nfsdStatusShow (); +extern STATUS nfsdFhCreate (); +extern STATUS nfsdFhToName (); +extern nfsstat nfsdErrToNfs (); +extern void nfsdFhHton (); +extern void nfsdFhNtoh (); +extern int nfsdFsReadOnly (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnfsdCommonh */ diff --git a/h/wrn/coreip/nlm4Lib.h b/h/wrn/coreip/nlm4Lib.h new file mode 100644 index 0000000..ac8f8f9 --- /dev/null +++ b/h/wrn/coreip/nlm4Lib.h @@ -0,0 +1,75 @@ +/* nlm4Lib.h - NLM protocol library header */ + +/* Copyright 2003 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,21jun04,vvv added virtual stack support +01a,21aug03,snd written. +*/ + + +#ifndef __INCnlm4Libh +#define __INCnlm4Libh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "xdr_nlm4.h" + +/* nlmLib defaults */ + +#define NLMD_PRIORITY_DEFAULT 55 +#define NLMD_STACKSIZE_DEFAULT 10240 + +/* IMPORTS */ + +/* DATA STRUCTURES */ + +typedef union + { + nlm4_testargs nlmproc4_test_4_arg; + nlm4_lockargs nlmproc4_lock_4_arg; + nlm4_cancargs nlmproc4_cancel_4_arg; + nlm4_unlockargs nlmproc4_unlock_4_arg; + nlm4_testargs nlmproc4_granted_4_arg; + nlm4_testargs nlmproc4_test_msg_4_arg; + nlm4_lockargs nlmproc4_lock_msg_4_arg; + nlm4_cancargs nlmproc4_cancel_msg_4_arg; + nlm4_unlockargs nlmproc4_unlock_msg_4_arg; + nlm4_testargs nlmproc4_granted_msg_4_arg; + nlm4_testres nlmproc4_test_res_4_arg; + nlm4_res nlmproc4_lock_res_4_arg; + nlm4_res nlmproc4_cancel_res_4_arg; + nlm4_res nlmproc4_unlock_res_4_arg; + nlm4_res nlmproc4_granted_res_4_arg; + nlm4_shareargs nlmproc4_share_4_arg; + nlm4_shareargs nlmproc4_unshare_4_arg; + nlm4_lockargs nlmproc4_nm_lock_4_arg; + nlm4_notify nlmproc4_free_all_4_arg; + } NLMD_ARGUMENT; + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS nlmdInit (int priority, int stackSize, + int options); +#ifdef VIRTUAL_STACK +extern void nlmd (int); +#else +extern void nlmd (void); +#endif + +#else + +extern STATUS nlmdInit (); +extern void nlmd (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnlm4Libh */ diff --git a/h/wrn/coreip/osdep.h b/h/wrn/coreip/osdep.h new file mode 100644 index 0000000..292c2f8 --- /dev/null +++ b/h/wrn/coreip/osdep.h @@ -0,0 +1,524 @@ +/* + * osdep.h -- vxWorks OS dependent include files + * all other files should include this header for + * OS related dependencies + */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02w,24jan05,vvv added deprecation message +02v,14oct04,nee Move snprintf in the double header inclusion protection + clause +02u,07sep04,sar Fix for time wrapping problem +02t,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +02s,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +02r,09feb04,niq Enable osdep.h to be included from RTPs +02q,20nov03,niq osdep.h cleanup +02p,05nov03,rlm Ran batch header update for header re-org. +02o,24oct03,cdw update include statements post header re-org. +02n,08sep03,vvv merged from ACCORDION_BASE6_MERGE_BASELINE +02m,01may03,spm removed incorrect bypass of header files +02l,13sep02,ppp adding #include +02k,13sep02,ham added stdio.h +02j,27jun02,ppp Merging TeamF1 changes for t22 (02i,10jun02,rvr port to tor22) +02i,10jun02,ann adding more include files for rlogin +02h,08may02,ppp merging the T202 changes from TeamF1 +02g,24apr02,ppp adding the macro for strspn and strchr +02f,11mar02,ann adding some lstLib macros +02e,06mar02,ann adding some more OS files for remLib and netDrv +02d,12feb02,ann adding a couple of macros +02c,08oct01,pas remove non-os header files +02b,27sep01,pas changed RANDOM() to used better PRNG +02a,26sep01,pas added stricmp, strnicmp, strcasecmp, strncasecmp, snprintf +01z,25sep01,ann changing the path for unixLib.h from utillib to utils +01y,21sep01,ann including stat.h from target/h/sys +01x,20sep01,nee including stdarg.h +01w,18sep01,ham added extern snprintf temporary for build party. +01v,18sep01,ann changing the path to unixLib.h +01u,18sep01,qli fixing ENABLE_INT +01t,18sep01,ham added MEMCMP. +01s,17sep01,ham added SPRINTF. +01r,12sep01,ppp undefining errno +01q,11sep01,ppp Adding iovec struct +01p,11sep01,ppp Removed _TYPE_int32_t and iovec definations from the file +01o,11sep01,ham removed errno, MCLBYTES. +01n,10sep01,deg added SLL macros. +01m,10sep01,ham disabled vxWorks headers, redefined errno. +01l,06sep01,qli adding definition for strncpy +01k,06sep01,ham added time.h for timeval. +01j,06sep01,ham corrected unixLib.h's path. +01i,06sep01,ham added ticks, time_second and SYSTEM_CLOCK_RATE. +01h,05sep01,ham added OS_MALLOC and DELAY. +01g,28aug01,ann adding the declaration for curproc and corrected macros +01f,27aug01,ann adding the prototype for structs that cause warnings +01e,27aug01,ham removed unnecessary inclusion. +01d,23aug01,ppp Adding a few definations in +01c,23aug01,ann adding includes and definitions for sockets and tNet +01a,06aug01,qli adding MACRO redefinitons + +*/ + + +#ifndef _VXWORKS_OSDEP_H_ +#define _VXWORKS_OSDEP_H_ + +#warning "The use of this file is deprecated. Include vxWorks.h instead." + +#ifdef _WRS_KERNEL +/* Disable the includes of certain vxWorks header files */ + +#define __INCmbufh 1 +#define __INCuioh 1 +#define __qlibh 1 +#define __INCif_llch 1 +#define __INCrouteh 1 + + +#undef errno + +#define _KERNEL 1 +#define KERNEL 1 + +/* time_second - elapse since GTF startup (seconds) */ +extern unsigned long netGtfSeconds; +#define time_second netGtfSeconds + +#endif /* _WRS_KERNEL */ + +#include +#include +#ifdef _WRS_VXWORKS_5_X +#ifndef PD_ID +#define PD_ID int +#endif + +#endif /* _WRS_VXWORKS_5_X */ + +#ifndef DISABLE_INTS +#define DISABLE_INTS() intLock() +#endif + +#ifndef ENABLE_INTS +#define ENABLE_INTS(levl) intUnlock(levl) +#endif + +#define BZERO(x, y) bzero((void *)(x), (size_t)(y)) + +#define curproc NULL + +#ifndef MSIZE +#define MSIZE 256 /* size of an mbuf */ +#endif + +#ifndef MCLSHIFT +#define MCLSHIFT 11 /* convert bytes to m_buf clusters */ +#endif + +#define CL_SIZE_128 128 /* size of the 128 byte cluster */ + +#define MSG_MBUF 1024 /* XXX ? */ + +#ifndef BCOPY +#define BCOPY(src, dst, nbytes) bcopy((const char *)(src), (char *)(dst), (int)(nbytes)) +#endif + +#ifndef BCMP +#define BCMP(buf1, buf2, nbytes) bcmp((char *)(buf1), (char *)(buf2), (int)(nbytes)) +#endif + +#ifndef BZERO +#define BZERO(buf, nbytes) bzero((char *)(buf), (int)(nbytes)) +#endif + +#ifndef STRLEN +#define STRLEN(s) strlen(s) +#endif + +#ifndef STRCMP +#define STRCMP(s1, s2) strcmp((s1), (s2)) +#endif + +#ifndef STRNCMP +#define STRNCMP(s1, s2, s3) strncmp((s1), (s2), (s3)) +#endif + +#ifndef STRICMP +#define STRICMP(s1, s2) stricmp((s1), (s2)) +#endif + +#ifndef STRNICMP +#define STRNICMP(s1, s2, sz) strnicmp((s1), (s2), (sz)) +#endif + +#ifndef STRCASECMP +#define STRCASECMP(s1, s2) stricmp((s1), (s2)) +#endif + +#ifndef STRNCASECMP +#define STRNCASECMP(s1, s2, sz) strnicmp((s1), (s2), (sz)) +#endif + +#ifndef STRCPY +#define STRCPY(s1, s2) strcpy((s1), (s2)) +#endif + +#ifndef STRNCPY +#define STRNCPY(src, dst, sz) strncpy(src, dst, sz) +#endif + +#ifndef SNPRINTF +#define SNPRINTF snprintf +#endif + +#ifndef STRSPN +#define STRSPN strspn +#endif + +#ifndef STRCHR +#define STRCHR strchr +#endif + +#ifndef SPRINTF +#define SPRINTF sprintf +#endif + +#ifndef VSPRINTF +#define VSPRINTF vsprintf +#endif + +#ifndef PRINTF +#define PRINTF printf +#endif + +#ifndef PRINTERR +#define PRINTERR printErr +#endif + +#ifndef MEMCPY +#define MEMCPY(x, y, z) memcpy((x), (y), (z)) +#endif + +#ifndef MEMCMP +#define MEMCMP(x, y, z) memcmp((x), (y), (z)) +#endif + +#ifndef MEMSET +#define MEMSET(x, y, z) memset((x), (y), (z)) +#endif + +#ifndef OVBCOPY +#define OVBCOPY(x, y, z) ovbcopy((x), (y), (z)) +#endif + +#ifndef RANDOM +#define RANDOM() random() +#endif + +#ifndef SRANDOM +#define SRANDOM(x) srandom(x) +#endif + +#ifndef MICROTIME +#define MICROTIME(x) microtime(x) +#endif + +/* The following macros define the semaphore calls */ + +/* Semaphore types */ + +#define BINARY_LOCK 1 +#define MUTEX_LOCK 2 + +/* Semaphore states */ + +#define STATE_FULL SEM_FULL +#define STATE_EMPTY SEM_EMPTY + +/* Semaphore options */ + +#define OPTS_PRIORITY SEM_Q_PRIORITY +#define OPTS_DELETION_SAFE SEM_DELETE_SAFE + +/* Semaphore macros for operations */ + +#define LOCK SEM_ID +#define LOCK_CREATE(type, opts, state) (type == BINARY_LOCK) ? \ + semBCreate(opts, state) : \ + semMCreate(opts) + +#define LOCK_DELETE(id) semDelete (id) + +#define OBTAIN_LOCK(id, options) semTake(id,options) +#define RELEASE_LOCK(id) semGive(id) + + +/* The following macros define the select calls */ + +#define SELECT_LIST SEL_WAKEUP_LIST +#define SELECT_WAKEUP_LIST_INIT(id) selWakeupListInit (id) + +#ifndef _WRS_VXWORKS_5_X +#define SELECT_WAKEUP_LIST_FREE(id) selWakeupListTerm (id) +#else +#define SELECT_WAKEUP_LIST_FREE(id) semTerminate(&((id)->listMutex)) +#endif /* _WRS_VXWORKS_5_X */ + +/* The following macros define the iosLib functions */ + +#define FD_TO_SOCK(x) iosFdValue(x) +#define SOCK_TO_FD(x,y,z) iosFdNew (x,y,z) +#define SOCK_BACKEND_INSTALL(a,b,c,d,e,f,g) iosDrvInstall(a,b,c,d,e,f,g) +#define FD_TO_OBJID(x) iosFdObjIdGet(x) +#define OBJ_OWNER_SET(x,y) objOwnerSet(x,y) + +#define DELAY(t) taskDelay((int)t) +#define OS_MALLOC(sz) KHEAP_ALLOC(sz) + +/* ticks - #of ticks since system startup */ + +#define TICKS (tickGet()) + +/* Timestamp comparison macros */ + +#define TICK_LT(x,y) ((long)((x) - (y)) < 0) +#define TICK_GT(x,y) ((long)((x) - (y)) > 0) +#define TICK_LEQ(x,y) ((long)((x) - (y)) <= 0) +#define TICK_GEQ(x,y) ((long)((x) - (y)) >= 0) + +#define SYSTEM_CLOCK_RATE (sysClkRateGet()) + + +/* lstLib macros */ + +#define LST_INIT(x) lstInit(x) +#define LST_FIRST(x) lstFirst(x) +#define LST_NEXT(x) lstNext(x) +#define LST_ADD(x,y) lstAdd(x,y) +#define LST_NTH(x,y) lstNth(x,y) +#define LST_COUNT(x) lstCount(x) +#define LST_INSERT(x,y,z) lstInsert(x,y,z) +#define LST_DELETE(x,y) lstDelete(x,y) + + +/******************************************************************************* +* +* SLL_INIT - initialize singly linked list head +* +* Initialize the specified list to an empty list. +*/ + +#define SLL_INIT(list) \ + { \ + ((SL_LIST *)(list))->head = NULL; \ + ((SL_LIST *)(list))->tail = NULL; \ + } + +/******************************************************************************* +* +* SLL_PUT_AT_HEAD - add node to beginning of list +* +* This macro adds the specified node to the end of the specified list. +* +*/ + +#define SLL_PUT_AT_HEAD(list, node) \ +{ \ + if ((((SL_NODE *)(node))->next = ((SL_LIST *)(list))->head) == NULL) \ + { \ + ((SL_LIST *)(list))->head = ((SL_NODE *)(node)); \ + ((SL_LIST *)(list))->tail = ((SL_NODE *)(node)); \ + } \ + else \ + ((SL_LIST *)(list))->head = (node); \ + } + +/******************************************************************************* +* +* SLL_PUT_AT_TAIL - add node to end of list +* +* This macro adds the specified node to the end of the specified singly +* linked list. +* +*/ + +#define SLL_PUT_AT_TAIL(list, node) \ + { \ + ((SL_NODE *)(node))->next = NULL; \ + if (((SL_LIST *)(list))->head == NULL) \ + { \ + ((SL_LIST *)(list))->head = (SL_NODE *)(node); \ + ((SL_LIST *)(list))->tail = (SL_NODE *)(node); \ + } \ + else \ + ((SL_LIST *)(list))->tail->next = (SL_NODE *)(node); \ + ((SL_LIST *)(list))->tail = (SL_NODE *)(node); \ + } + +/******************************************************************************* +* +* SLL_GET - get (delete and return) first node from list +* +* This macro gets the first node from the specified singly linked list, +* deletes the node from the list, and returns a pointer to the node gotten. +* +*/ + +#define SLL_GET(list, node) \ + { \ + if (((node) = (void *)((SL_LIST *)(list))->head) != NULL) \ + ((SL_LIST *)(list))->head = ((SL_NODE *)(node))->next; \ + } + +/******************************************************************************* +* +* SLL_REMOVE - remove specified node in list +* +* Remove the specified node in a singly linked list. +*/ + +#define SLL_REMOVE(list, deleteNode, previousNode) \ + { \ + if (((SL_NODE *)(previousNode)) == NULL) \ + { \ + ((SL_LIST *)(list))->head = ((SL_NODE *)(deleteNode))->next; \ + if (((SL_LIST *)(list))->tail == ((SL_NODE *)(deleteNode))) \ + ((SL_LIST *)(list))->tail = NULL; \ + } \ + else \ + { \ + ((SL_NODE *)(previousNode))->next = ((SL_NODE *)(deleteNode))->next; \ + if (((SL_LIST *)(list))->tail == ((SL_NODE *)(deleteNode))) \ + ((SL_LIST *)(list))->tail = ((SL_NODE *)(previousNode)); \ + } \ + } + +/******************************************************************************* +* +* SLL_PREVIOUS - find and return previous node in list +* +* Find and return the previous node in a singly linked list. +*/ + +#define SLL_PREVIOUS(list, node, previousNode) \ + { \ + SL_NODE *temp; \ + (SL_NODE *)(previousNode) = NULL; \ + temp = ((SL_LIST *)(list))->head; \ + if (temp != NULL) && (temp != (node)) \ + while (temp->next != NULL) \ + { \ + if (temp->next == (node)) \ + { \ + (SL_NODE *)(previousNode) = temp; \ + break; \ + } \ + temp = temp->next; \ + } \ + } + +/****************************************************************************** +* +* DLL_INIT - initialize doubly linked list descriptor +* +* Initialize the specified list to an empty list. +*/ + +#define DLL_INIT(list) \ + { \ + ((DL_LIST *)(list))->head = NULL; \ + ((DL_LIST *)(list))->tail = NULL; \ + } + +/****************************************************************************** +* +* DLL_INSERT - insert node in list after specified node +* +* This macro inserts the specified node in the specified list. +* The new node is placed following the specified 'previous' node in the list. +* If the specified previous node is NULL, the node is inserted at the head +* of the list. +*/ + +#define DLL_INSERT(list, previousNode, node) \ + { \ + DL_NODE *temp; \ + if ((previousNode) == NULL) \ + { \ + temp = ((DL_LIST *)(list))->head; \ + ((DL_LIST *)(list))->head = (DL_NODE *)(node); \ + } \ + else \ + { \ + temp = ((DL_NODE *)(previousNode))->next; \ + ((DL_NODE *)(previousNode))->next = (DL_NODE *)(node); \ + } \ + if (temp == NULL) \ + ((DL_LIST *)(list))->tail = (DL_NODE *)(node); \ + else \ + temp->previous = (DL_NODE *)(node); \ + ((DL_NODE *)(node))->next = temp; \ + ((DL_NODE *)(node))->previous = (DL_NODE *)(previousNode); \ + } + +/****************************************************************************** +* +* DLL_ADD - add node to end of list +* +* This macro adds the specified node to the end of the specified list. +*/ + +#define DLL_ADD(list, node) \ + { \ + DL_NODE *listTail = (list)->tail; \ + DLL_INSERT ((list), listTail, (node)); \ + } + +/****************************************************************************** +* +* DLL_REMOVE - remove specified node in list +* +* Remove the specified node in the doubly linked list. +*/ + +#define DLL_REMOVE(list, node) \ + { \ + if (((DL_NODE *)(node))->previous == NULL) \ + ((DL_LIST *)(list))->head = ((DL_NODE *)(node))->next; \ + else \ + ((DL_NODE *)(node))->previous->next = ((DL_NODE *)(node))->next; \ + if (((DL_NODE *)(node))->next == NULL) \ + ((DL_LIST *)(list))->tail = ((DL_NODE *)(node))->previous; \ + else \ + ((DL_NODE *)(node))->next->previous = ((DL_NODE *)(node))->previous; \ + } + +/****************************************************************************** +* +* DLL_GET - get (delete and return) first node from list +* +* This macro gets the first node from the specified list, deletes the node +* from the list, and returns a pointer to the node gotten. +* +*/ + +#define DLL_GET(list, node) \ + { \ + (node) = (void *)((DL_LIST *)(list))->head; \ + if ((node) != NULL) \ + { \ + ((DL_LIST *)(list))->head = ((DL_NODE *)(node))->next; \ + if (((DL_NODE *)(node))->next == NULL) \ + ((DL_LIST *)(list))->tail = NULL; \ + else \ + ((DL_NODE *)(node))->next->previous = NULL; \ + } \ + } +int snprintf (char *, size_t, const char *, ...); /* XXX temporary */ + +#endif + + diff --git a/h/wrn/coreip/pathUtilLib.h b/h/wrn/coreip/pathUtilLib.h new file mode 100644 index 0000000..bd028fa --- /dev/null +++ b/h/wrn/coreip/pathUtilLib.h @@ -0,0 +1,38 @@ +/* pathUtilLib.h - path utility library header file */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,07jan05,syy Fixed compile error for RTP +01a,14dec04,syy written. +*/ + +#ifndef __INCpathUtilLibh +#define __INCpathUtilLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include + +/* function declarations */ + +extern STATUS pathUtilBuild (const char ** nameArray, char ** nameArrayEnd, + char *destString); +extern STATUS pathUtilCat (const char *dirName, const char *fileName, + char *result); +extern void pathUtilCondense (char *pathName); +extern void pathUtilParse (const char *longName, char ** nameArray, + char *nameBuf); +extern void pathUtilArrayReduce (char **nameArray); +extern BOOL pathUtilIsSubDir (const char *s1, const char *s2); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpathUtilLibh */ diff --git a/h/wrn/coreip/ping6Lib.h b/h/wrn/coreip/ping6Lib.h new file mode 100644 index 0000000..63720c9 --- /dev/null +++ b/h/wrn/coreip/ping6Lib.h @@ -0,0 +1,44 @@ +/* ping6Lib.h - Packet InterNet Grouper (PING) library header */ + +/* + * Copyright (c) 2001-2003,2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01h,23feb05,dlk Added ping6Parse() function prototype. +01g,20nov03,niq Remove copyright_wrs.h file inclusion +01f,05nov03,cdw Removal of unnecessary _KERNEL guards. +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01c,10jun03,vvv include netVersion.h +01b,01mar02,ant added ping6LibInit +01a,14sep01,ant written + +*/ + +#ifndef __INCping6Libh +#define __INCping6Libh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* function declarations */ + +extern STATUS ping6LibInit (void); +extern STATUS ping6 (char *, int); +extern STATUS ping6Parse (int argc, char * argv []); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCping6Libh */ diff --git a/h/wrn/coreip/pingLib.h b/h/wrn/coreip/pingLib.h new file mode 100644 index 0000000..667e059 --- /dev/null +++ b/h/wrn/coreip/pingLib.h @@ -0,0 +1,107 @@ +/* pingLib.h - Packet InterNet Grouper (PING) library header */ + +/* Copyright 1994 - 2005 Wind River Systems, Inc. */ +#include + +/* +modification history +-------------------- +01k,07feb05,vvv _KERNEL cleanup +01j,20nov03,niq Remove copyright_wrs.h file inclusion +01j,T14ov03,asr Changes for porting ping to RTP +01i,05nov03,cdw Removal of unnecessary _KERNEL guards. +01h,04nov03,rlm Ran batch header path update for header re-org. +01g,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01f,15may03,spm Tornado 2.2 FCS merge (SPR #73570; ver 01d,12mar02,rae: + TOR2_2-FCS-COPY label, tor2 branch, /wind/river VOB) +01e,09may03,vvv included ip_icmp.h +01d,25jul02,ant definitions ICMP_PROTO and ICMP_TYPENUM removed +01c,03may02,ant u_char bufTx [PING_MAXPACKET] in the struct PING_STAT changed + to u_char *bufTx. It is allocated dynamically now. Receive + buffer u_char bufRx[PING_MAXPACKET] changed in the same way. + New member int timing defined in the struct PING_STAT. + PING_MAXPACKET increased to 65536. +01b,14jan00,ham changed PING_STAT for PD support. +01a,25oct94,dzb written. +*/ + +#ifndef __INCpingLibh +#define __INCpingLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include +#include +#include +#include + +#include + +/* defines */ + +#define PING_MAXPACKET 65536 /* max packet size */ +#define PING_INTERVAL 1 /* default packet interval in seconds */ +#define PING_TMO 5 /* default packet timeout in seconds */ +#define PING_TASK_NAME_LEN 20 /* max ping Tx task name length */ + +/* status codes */ + +#define S_pingLib_NOT_INITIALIZED (M_pingLib | 1) +#define S_pingLib_TIMEOUT (M_pingLib | 2) + +/* flags */ + +#define PING_OPT_SILENT 0x1 /* work silently */ +#define PING_OPT_DONTROUTE 0x2 /* dont route option */ +#define PING_OPT_DEBUG 0x4 /* print debugging messages */ +#define PING_OPT_NOHOST 0x8 /* suppress host lookup [ANT] */ + +/* typedefs */ + +typedef struct pingStat /* PING_STAT */ + { + struct pingStat * statNext; /* next struct in list */ + int pingFd; /* socket file descriptor */ + char toHostName [MAXHOSTNAMELEN + 2];/* name to ping - PAD */ + char toInetName [INET_ADDR_LEN];/* IP addr to ping */ + u_char *bufTx; /* transmit buffer */ + u_char *bufRx; /* receive buffer */ + struct icmp * pBufIcmp; /* ptr to icmp */ + ulong_t * pBufTime; /* ptr to time */ + int dataLen; /* size of data portion */ + int numPacket; /* total # of packets to send */ + int numTx; /* number of packets sent */ + int numRx; /* number of packets received */ + int idRx; /* id of Rx task */ + int clkTick; /* sys clock ticks per second */ + int tMin; /* min RT time (ms) */ + int tMax; /* max RT time (ms) */ + int tSum; /* sum of all times */ + int flags; /* option flags */ + int timing; /* flag to do timing */ + } PING_STAT; + + +/* forward declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS pingLibInit (void); +extern STATUS ping (char *host, int numPackets, ulong_t options); + +#else /* __STDC__ */ + +extern STATUS pingLibInit (); +extern STATUS ping (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCpingLibh */ diff --git a/h/wrn/coreip/poll.h b/h/wrn/coreip/poll.h new file mode 100644 index 0000000..adcc491 --- /dev/null +++ b/h/wrn/coreip/poll.h @@ -0,0 +1,121 @@ +/* poll.h - synchronous i/o multiplexing */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1997 Peter Wemm + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/sys/poll.h,v 1.6.2.1 2000/08/21 12:25:58 sheldonh Exp $ + */ + +/* +modification history +-------------------- +01d,07feb05,vvv _KERNEL cleanup +01c,20nov03,niq Remove copyright_wrs.h file inclusion +01b,29apr03,syy Added #ifdef for __cplusplus +01a,18sep01,ann ported from freeBSD 4.3 ver 1.6.2.1 to clarinet +*/ + +#ifndef _SYS_POLL_H_ +#define _SYS_POLL_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This file is intended to be compatable with the traditional poll.h. + */ + +/* + * This structure is passed as an array to poll(2). + */ +struct pollfd { + int fd; /* which file descriptor to poll */ + short events; /* events we are interested in */ + short revents; /* events found on return */ +}; + +/* + * Requestable events. If poll(2) finds any of these set, they are + * copied to revents on return. + * XXX Note that FreeBSD doesn't make much distinction between POLLPRI + * and POLLRDBAND since none of the file types have distinct priority + * bands - and only some have an urgent "mode". + * XXX Note POLLIN isn't really supported in true SVSV terms. Under SYSV + * POLLIN includes all of normal, band and urgent data. Most poll handlers + * on FreeBSD only treat it as "normal" data. + */ +#define POLLIN 0x0001 /* any readable data available */ +#define POLLPRI 0x0002 /* OOB/Urgent readable data */ +#define POLLOUT 0x0004 /* file descriptor is writeable */ +#define POLLRDNORM 0x0040 /* non-OOB/URG data available */ +#define POLLWRNORM POLLOUT /* no write type differentiation */ +#define POLLRDBAND 0x0080 /* OOB/Urgent readable data */ +#define POLLWRBAND 0x0100 /* OOB/Urgent data can be written */ + +/* + * FreeBSD extensions: polling on a regular file might return one + * of these events (currently only supported on UFS). + */ +#define POLLEXTEND 0x0200 /* file may have been extended */ +#define POLLATTRIB 0x0400 /* file attributes may have changed */ +#define POLLNLINK 0x0800 /* (un)link/rename may have happened */ +#define POLLWRITE 0x1000 /* file's contents may have changed */ + +/* + * These events are set if they occur regardless of whether they were + * requested. + */ +#define POLLERR 0x0008 /* some poll error occurred */ +#define POLLHUP 0x0010 /* file descriptor was "hung up" */ +#define POLLNVAL 0x0020 /* requested events "invalid" */ + +#define POLLSTANDARD (POLLIN|POLLPRI|POLLOUT|POLLRDNORM|POLLRDBAND|\ + POLLWRBAND|POLLERR|POLLHUP|POLLNVAL) + +/* + * Request that poll() wait forever. + * XXX in SYSV, this is defined in stropts.h, which is not included + * by poll.h. + */ +#define INFTIM (-1) + +/* + * XXX logically, poll() should be declared in , but SVR4 at + * least has it here in . + * XXX poll() has "unsigned long" nfds on SVR4, not unsigned as on the + * other BSDs. + */ +int poll __P((struct pollfd *_pfd, unsigned int _nfds, int _timeout)); + +#ifdef __cplusplus +} +#endif + +#endif /* !_SYS_POLL_H_ */ diff --git a/h/wrn/coreip/private/bpfLibP.h b/h/wrn/coreip/private/bpfLibP.h new file mode 100644 index 0000000..7a5097a --- /dev/null +++ b/h/wrn/coreip/private/bpfLibP.h @@ -0,0 +1,188 @@ +/* bpfLibP.h - Berkeley Packet Filter (BPF) private include file */ + +/* Copyright 1999-2003 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1990, 1991, 1992, 1994, 1995, 1996 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)bpfdesc.h 7.1 (Berkeley) 5/7/91 + * + * @(#) $Header: bpfdesc.h,v 1.14 96/06/16 22:28:07 leres Exp $ (LBL) + */ + +/* +modification history +-------------------- +01i,20nov03,niq Remove copyright_wrs.h file inclusion +01h,04nov03,rlm Ran batch header path update for header re-org. +01g,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01f,23oct03,rlm updated #includes for header re-org +01e,30jul03,vvv backed out previous change +01d,24jul03,vvv modified include for endLib.h +01c,01jul03,ann dummy check-in to update the time-stamp on this file +01b,02feb02,ham changed for tornado build. +01a,15oct01,nee Ported from from bpfLibP.h@@/main/tor3_x/tor3_x.windnet_ipv6/0 + +*/ + +#ifndef __INCbpfLibPh +#define __INCbpfLibPh + +#ifdef __cplusplus +extern "C" { +#endif + + +/* includes */ + +#include +#include + +/* typedefs */ + +/* Descriptor associated with each attached network interface. */ + +typedef struct bpf_proto_ctrl { /* BPF_PROTO_CTRL */ + NODE bpfProtoLstNode; /* list of interface attachments */ + void * pSnarfCookie; /* MUX cookie for snarf protocol */ + LIST bpfUnitList; /* list of attached BPF units */ + u_int numShared; /* number of shared BPF devices */ + LIST bpfDevList; /* shared BPF device attachments */ + u_int numPromisc; /* number of promiscuous listeners */ + BOOL bpfPromiscEnabled; /* TRUE if BPF turned on promisc */ + u_int endDlt; /* data link layer type */ + int endMtu; /* Max device frame size */ + u_int endHdrLen; /* length of header (with padding) */ + char endDevName [END_NAME_MAX + 1]; /* name of END interface */ + int endDevUnit; /* unit number of END */ +} BPF_PROTO_CTRL; + +/* Descriptor associated with each open bpf file. */ + +typedef struct bpf_dev_ctrl { /* BPF_DEV_CTRL */ + NODE bpfDevLstNode; /* node in list of devices attached to an interface */ + UINT32 bpfDevId; /* unique identifier for all units of BPF device */ + BOOL selectFlag; /* tasks pending on select for device? */ + + BPF_PROTO_CTRL * pNetIfCtrl; /* used for first attachment of BPF device */ + BPF_PROTO_CTRL * pNetDev; /* attachment for this unit, if any */ + + SEM_ID lockSem; /* provides mutual exclusion */ + /* + * Buffer slots: two character buffers buffer the incoming packets. + * The model has three slots. recvStoreBuf is always occupied. + * recvStoreBuf (store) - Receive interrupt puts packets here. + * readHoldBuf (hold) - When recvStoreBuf is full, put cluster here + * and wakeup read (replace recvStoreBuf with freeBuf). + * freeBuf (free) - When read is done, put cluster here. + * On receiving, if recvStoreBuf is full and freeBuf is NULL, + * packet is dropped. + */ + + caddr_t recvStoreBuf; /* store slot */ + caddr_t readHoldBuf; /* hold slot */ + caddr_t freeBuf; /* free slot */ + int recvStoreLen; /* current length of store buffer */ + int readHoldLen; /* current length of hold buffer */ + u_int bufSize; /* absolute length of buffers */ + u_long readTimeout; /* Read timeout in 'ticks' */ + BPF_INSN * pBpfInsnFilter; /* filter code */ + int filterLen; /* number of instructions in filter */ + u_long pktRecvCount; /* number of packets received */ + u_long pktDropCount; /* number of packets dropped */ + BOOL promiscMode; /* true if listening promiscuously */ + BOOL immediateMode; /* true to return on packet arrival */ + BOOL nonBlockMode; /* true if read is non-blocking */ + SEM_ID readWkupSem; /* pended read sem. */ + int usrFlags; /* file open flags */ + BOOL inUse; /* TRUE if being used by a file desc */ + SEL_WAKEUP_LIST selWkupList;/* select wakeup list */ +} BPF_DEV_CTRL; + +typedef struct { /* BPF_DEV_HDR */ + DEV_HDR devHdr; /* BPF device hdr */ + BPF_DEV_CTRL * pBpfDevTbl; /* Table of BPF device entries */ + BPF_PROTO_CTRL * pBpfNetIfTbl; /* Attachments to network interfaces */ + int numDevs; /* number of BPF devices */ + int bufSize; /* default BPF device buffer size */ + SEM_ID lockSem; /* provides mutual exclusion */ + } BPF_DEV_HDR; + +/* defines */ + +#define BPF_LOCK_KEY 1 /* Key to release BPF lock */ +#define BPF_DUMMY_KEY 0 /* dummy key will not release lock */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT int _bpfLock (); +IMPORT BOOL _bpfUnlock (int lockKey); +IMPORT void _bpfPacketTap (LIST * pListBpfDev, long type, M_BLK_ID pMBlk, + int netDataOffset); +IMPORT STATUS _bpfDevDetach (BPF_DEV_CTRL * pBpfDev); +IMPORT void _bpfProtoInit (void); +IMPORT STATUS _bpfProtoAttach (BPF_DEV_CTRL * pBpfDev, char *, int); +IMPORT STATUS _bpfProtoDetach (BPF_DEV_CTRL * pBpfDev); +IMPORT STATUS _bpfProtoPromisc (BPF_PROTO_CTRL * pBpfProto, BOOL on); +IMPORT void _bpfTimeStamp (struct timeval * pTimeval); +IMPORT STATUS _bpfProtoSend (BPF_PROTO_CTRL * pBpfProto, char * pBuf, + int nBytes, BOOL nbIo); +#else /* __STDC__ */ + +IMPORT int _bpfLock (); +IMPORT BOOL _bpfUnlock (); +IMPORT STATUS _bpfDevDetach (); +IMPORT void _bpfProtoInit (); +IMPORT BPF_PROTO_CTRL * _bpfProtoAttach (); +IMPORT BPF_PROTO_CTRL * _bpfProtoDetach (); +IMPORT STATUS _bpfProtoPromisc (); +IMPORT void _bpfTimeStamp (); +IMPORT STATUS _bpfProtoSend (); +IMPORT void _bpfPacketTap (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCbpfLibPh */ + + + diff --git a/h/wrn/coreip/private/clarinet.h b/h/wrn/coreip/private/clarinet.h new file mode 100644 index 0000000..01bcd3c --- /dev/null +++ b/h/wrn/coreip/private/clarinet.h @@ -0,0 +1,135 @@ +/* clarinet.h - misc definitions for Clarinet-Tornado integration */ + +/* Copyright 2002-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01m,27sep05,nee removed types and htons etc. +01l,24jan05,vvv added deprecation message +01k,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01j,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01i,09feb04,niq Add definitions for MEM* macros +01h,30sep03,rp merging from base6_networking_itn2-int +01g,05may03,ppp adding some type specific definations +01f,23apr03,pas removed ptr_t +01e,11jul02,ham removed int64_t +01d,06jun02,rvr changed typedef of int64_t to long long +01c,04mar02,ann adding the macro for select list +01b,03feb02,ham map BSD byte-order macros to vxWorks macros +01a,03feb02,ham wrote. +*/ + +#ifndef __INCclarineth +#define __INCclarineth + +#ifdef __cplusplus +extern "C" { +#endif + +#warning "The use of this file is deprecated." + +/* definitions from cdefs.h */ +#if defined(__STDC__) || defined(__cplusplus) +#define __P(protos) protos /* full-blown ANSI C */ +#else /* !(__STDC__ || __cplusplus) */ +#define __P(protos) () /* traditional C preprocessor */ +#endif + +#if defined(__cplusplus) +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS } +#else +#define __BEGIN_DECLS +#define __END_DECLS +#endif + +#define LOCK SEM_ID + +#define OBTAIN_LOCK(a,b) semTake((a),(b)) +#define RELEASE_LOCK(a) semGive(a) +#define SELECT_LIST SEL_WAKEUP_LIST + +#ifndef MEMCPY +#define MEMCPY(x, y, z) memcpy((x), (y), (z)) +#endif + +#ifndef MEMCMP +#define MEMCMP(x, y, z) memcmp((x), (y), (z)) +#endif + +#ifndef MEMSET +#define MEMSET(x, y, z) memset((x), (y), (z)) +#endif + +#ifndef BCOPY +#define BCOPY(src, dst, nbytes) bcopy((const char *)(src), (char *)(dst), (int)(nbytes)) +#endif + +#ifndef BCMP +#define BCMP(buf1, buf2, nbytes) bcmp((char *)(buf1), (char *)(buf2), (int)(nbytes)) +#endif + +#ifndef BZERO +#define BZERO(buf, nbytes) bzero((char *)(buf), (int)(nbytes)) +#endif + +#ifndef STRLEN +#define STRLEN(s) strlen(s) +#endif + +#ifndef STRCMP +#define STRCMP(s1, s2) strcmp((s1), (s2)) +#endif + +#ifndef STRNCMP +#define STRNCMP(s1, s2, s3) strncmp((s1), (s2), (s3)) +#endif + +#ifndef STRICMP +#define STRICMP(s1, s2) stricmp((s1), (s2)) +#endif + +#ifndef STRNICMP +#define STRNICMP(s1, s2, sz) strnicmp((s1), (s2), (sz)) +#endif + +#ifndef STRCASECMP +#define STRCASECMP(s1, s2) stricmp((s1), (s2)) +#endif + +#ifndef STRNCASECMP +#define STRNCASECMP(s1, s2, sz) strnicmp((s1), (s2), (sz)) +#endif + +#ifndef STRCPY +#define STRCPY(s1, s2) strcpy((s1), (s2)) +#endif + +#ifndef STRNCPY +#define STRNCPY(src, dst, sz) strncpy(src, dst, sz) +#endif + +/* + * Round p (pointer or byte index) up to a correctly-aligned value + * for all data types (int, long, ...). The result is unsigned int + * and must be cast to any desired pointer type. This definition is + * available in the different arch-specific copies of param.h but it + * is safe to have a common definition here since all the architectures + * define this the same way. + */ + +#ifndef _ALIGNBYTES +#define _ALIGNBYTES (sizeof (int) - 1) +#endif + +#ifndef _ALIGN +#define _ALIGN(p) (((unsigned) (p) + _ALIGNBYTES) & ~_ALIGNBYTES) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCclarineth */ diff --git a/h/wrn/coreip/private/fastPathIpP.h b/h/wrn/coreip/private/fastPathIpP.h new file mode 100644 index 0000000..373d0fb --- /dev/null +++ b/h/wrn/coreip/private/fastPathIpP.h @@ -0,0 +1,62 @@ +/* fastPathIpP.h - Private definitions for the IP Fast Forwarder module */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,02oct04,niq Performance changes +01f,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01e,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01d,20nov03,niq Remove copyright_wrs.h file inclusion +01c,11nov03,cdw Removal of unnecessary _KERNEL guards. +01b,06nov03,rlm Ran batch header update for header re-org. +01a,12mar03,niq written - consolidated v4/v6 files +*/ + +/* +DESCRIPTION +This file contains private definitions used only by the IP Fast Forwarder +module. + +*/ + +#ifndef __INCfastPathIpPh +#define __INCfastPathIpPh + +/* includes */ + +#include + +/* defines */ + +/* Access macros for the IP Fast Forwarder object */ + +#define IP_FF_FIB_COOKIE(pFFObj) \ + (((IP_FF_OBJ_ID)(pFFObj))->ipFFFibCookie) +#define IP_FF_ONE_LEVEL_CACHE(pFFObj) \ + (&(((IP_FF_OBJ_ID)(pFFObj))->ipFFOneLevelCache)) +#define IP_FF_FLUSH_ONE_LEVEL_CACHE(pFFObj) \ + IP_FF_ONE_LEVEL_CACHE(pFFObj)->pFFEntryGw = NULL + +/* typedefs */ + +/* IP Fast Forwarder object - contains the generic Fast Forwarder object */ + +typedef struct ipFFObj +{ + FF_OBJ ipFFObj; /* Generic Fast Forwarder object */ + void * ipFFFibCookie; /* FIB cookie */ + FF_CACHE_ENTRY ipFFOneLevelCache; /* One level cache */ +} IP_FF_OBJ; + +typedef struct ipFFObj *IP_FF_OBJ_ID; + +typedef struct userFuncArg +{ + FF_USER_WALK_FUNC_ID pUserFunc; + void *pUserArg; +} USER_FUNC_ARG; + +#endif /* __INCfastPathIpPh */ diff --git a/h/wrn/coreip/private/fastPathLibP.h b/h/wrn/coreip/private/fastPathLibP.h new file mode 100644 index 0000000..fd5e0f5 --- /dev/null +++ b/h/wrn/coreip/private/fastPathLibP.h @@ -0,0 +1,101 @@ +/* fastPathLibP.h - Private definitions for the Fastpath library */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,20nov03,niq Remove copyright_wrs.h file inclusion +01d,11nov03,cdw Removal of unnecessary _KERNEL guards. +01c,06nov03,rlm Ran batch header update for header re-org. +01b,03apr03,niq Add support for enabling Fastpath v4/v6 separately on an + interface +01a,07oct02,deg written +*/ + +/* +DESCRIPTION +This file contains private definitions used only by the Fastpath library. + +*/ + +#ifndef __INCfastPathLibPh +#define __INCfastPathLibPh + +/* includes */ + +#include /* acc_deg : For definition of IFF_FP_ENABLE */ + +/* defines */ + +#define FF_OBJ_SIZE sizeof(struct ffObj) +#define FF_NAME_MAX 80 /* Max name len of a Fast Forwarder */ + +/* Arguments to the FIB print command (What types of entries to print) */ + +#define FF_MAC 0x01 +#define FF_INDIRECT 0x02 + +/* Fastpath state definitions - bitwise OR values */ + +#define FF_STARTED 0x01 /* Fastpath module has been started */ +#define FF_ENABLED 0x02 /* Packet fastforwarding has been enabled */ +#define FF_IPFF_ENABLED 0x04 /* IP Packet forwarding has been enabled */ + +/* Macros to manipulate the state of a Fastpath module */ + +#define FF_MOD_START(pFFObj) pFFObj->ffState |= FF_STARTED +#define FF_MOD_STOP(pFFObj) pFFObj->ffState &= ~FF_STARTED +#define FF_MOD_ENABLE(pFFObj) pFFObj->ffState |= FF_ENABLED +#define FF_MOD_DISABLE(pFFObj) pFFObj->ffState &= ~FF_ENABLED +#define FF_MOD_IPFF_ENABLE(pFFObj) pFFObj->ffState |= FF_IPFF_ENABLED +#define FF_MOD_IPFF_DISABLE(pFFObj) pFFObj->ffState &= ~FF_IPFF_ENABLED + +/* Macros to query the state of a Fast Forwarder module */ + +#define FF_MOD_STARTED(pFFObj) (pFFObj->ffState & FF_STARTED) +#define FF_MOD_STOPPED(pFFObj) ((pFFObj->ffState & FF_STARTED) == 0) +#define FF_MOD_ENABLED(pFFObj) (pFFObj->ffState & FF_ENABLED) +#define FF_MOD_DISABLED(pFFObj) ((pFFObj->ffState & FF_ENABLED) == 0) +#define FF_MOD_IPFF_ENABLED(pFFObj) (pFFObj->ffState & FF_IPFF_ENABLED) +#define FF_MOD_IPFF_DISABLED(pFFObj) ((pFFObj->ffState & FF_IPFF_ENABLED) == 0) + +/* + * Macros to manipulate the state of an Interface - Whether fastpath + * is enabled on an interface + */ + +/* Macros to query the state of an Interface */ + +#define FF_INTF_ENABLED(pFFObj, pIfp) \ + ((pFFObj->ffProto == FF_PROTO_IPV4) ? \ + ((pIfp->if_flags & IFF_FPV4_ENABLE) == IFF_FPV4_ENABLE) : \ + ((pIfp->if_flags & IFF_FPV6_ENABLE) == IFF_FPV6_ENABLE)) + +#define FF_INTF_DISABLED(pFFObj, pIfp) (!(FF_INTF_DISABLED(pFFObj, pIfp))) + +/* + * Macros to manipulate the status of an Interface - Whether interface + * is up or down. + */ + +/* Macros to query the status of an Interface */ + +#define IS_FF_INTF_UP(pFFObj, pIfp) \ + ((pFFObj->ffProto == FF_PROTO_IPV4) ? \ + ((pIfp->if_flags & (IFF_INET_UP | IFF_UP)) == (IFF_INET_UP | IFF_UP)) : \ + ((pIfp->if_flags & (IFF_INET6_UP | IFF_UP)) == (IFF_INET6_UP | IFF_UP))) + +#define IS_FF_INTF_DOWN(pFFObj, pIfp) (!(IS_FF_INTF_UP(pFFObj, pIfp))) + +/* typedefs */ + +/* Argument passed to the FIB dump routine */ + +typedef struct ffDumpArg +{ + unsigned char *pMemPtr; + int memSize; +} FF_DUMP_ARG; + +#endif /* __INCffastPathLibPh */ diff --git a/h/wrn/coreip/private/fastPathPatTreeP.h b/h/wrn/coreip/private/fastPathPatTreeP.h new file mode 100644 index 0000000..2e53cbb --- /dev/null +++ b/h/wrn/coreip/private/fastPathPatTreeP.h @@ -0,0 +1,104 @@ +/* fastPathPatTreeP.h - Private definitions for the Fastpath cache */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,04nov03,rlm Ran batch header path update for header re-org. +01f,18dec02,vvv updated the rnh_matchaddr call to reflect the modified API +01e,07aug01,niq Replace Free with KHEAP_FREE +01d,02may01,niq Correcting mod history +01c,01may01,niq Copied over from tor2_0.open_stack branch +01b,20mar01,niq Adding comments +01a,29jan01,niq written +*/ + +/* +DESCRIPTION + +This include file contains private definitions used by the +Patricia tree Fastpath cache implementation (fastPathPatTree.c) + +INCLUDE FILES: +*/ + +#ifndef __INCfastPathPatTreePh +#define __INCfastPathPatTreePh + +/* includes */ + +#include +#include + + +/* typedefs */ + +typedef struct rtentry CACHE_ENTRY; +typedef CACHE_ENTRY * CACHE_ENTRY_ID; +typedef struct radix_node_head CACHE_COOKIE; +typedef CACHE_COOKIE * CACHE_COOKIE_ID; + + +/* defines */ + +/* Definitions for CACHE_ENTRY_ALLOC flags - bitwise OR values */ + +#define ZERO_IT 1 +#define ALLOC_DEST_ADDR 2 +#define ALLOC_GATE_ADDR 4 + +/* Definitions for Cache management */ + +#define CACHE_ENTRY_SIZE sizeof(CACHE_ENTRY) + +#define CACHE_TABLE_INIT(pCacheCookie, keyLength) \ + (pCacheCookie = NULL, rn_inithead (&pCacheCookie, keyLength)) + +#define CACHE_TABLE_DESTROY(pCacheCookie) \ + rn_destroyhead (pCacheCookie) + +#define CACHE_TABLE_ENTRY_ALLOC(pCacheEntry, flags) \ + (pCacheEntry = ptCacheEntryAlloc (flags)) + +#define CACHE_TABLE_ENTRY_FREE(pCacheEntry) \ + { \ + if (GET_CACHE_ENTRY_DEST_ADDR (pCacheEntry)) \ + KHEAP_FREE ((char *)GET_CACHE_ENTRY_DEST_ADDR (pCacheEntry)); \ + if (GET_CACHE_ENTRY_GATE_ADDR (pCacheEntry)) \ + KHEAP_FREE ((char *)GET_CACHE_ENTRY_GATE_ADDR (pCacheEntry)); \ + KHEAP_FREE ((char *)pCacheEntry); \ + } + +#define CACHE_TABLE_ENTRY_ADD(pCacheCookie, pCacheEntry, pDstAddr, pNetMask) \ + (pCacheCookie->rnh_addaddr ((caddr_t)pDstAddr, pNetMask, \ + pCacheCookie, pCacheEntry->rt_nodes)) + +#define CACHE_TABLE_ENTRY_DEL(pCacheCookie, pDstAddr, pNetMask) \ + (pCacheCookie->rnh_deladdr (pDstAddr, pNetMask, pCacheCookie)) + +#define CACHE_TABLE_ENTRY_MATCHADDR(pCacheEntry, pCacheCookie, pDstIpAddr) \ + { \ + pCacheEntry = (CACHE_ENTRY_ID)(pCacheCookie->rnh_matchaddr (\ + (caddr_t)pDstIpAddr, \ + pCacheCookie, 0)); \ + /* Make sure it is not the ROOT node */ \ + if (pCacheEntry && ((struct radix_node *)pCacheEntry)->rn_flags & RNF_ROOT)\ + pCacheEntry = NULL; \ + } + +#define CACHE_TABLE_ENTRY_LOOKUP(pCacheEntry, pCacheCookie, pDstIpAddr, pNetmask) \ + { \ + pCacheEntry = (CACHE_ENTRY_ID)(pCacheCookie->rnh_lookup (\ + (caddr_t)pDstIpAddr,\ + pNetmask, \ + pCacheCookie)); \ + /* Make sure it is not the ROOT node */ \ + if (pCacheEntry && ((struct radix_node *)pCacheEntry)->rn_flags & RNF_ROOT)\ + pCacheEntry = NULL; \ + } + +#define CACHE_TABLE_WALK(pCacheCookie, pUsrFunc, pArg) \ + rn_walktree (pCacheCookie, pUsrFunc, pArg) + +#endif /* __INCfastPathPatTreePh */ diff --git a/h/wrn/coreip/private/ftpLibP.h b/h/wrn/coreip/private/ftpLibP.h new file mode 100644 index 0000000..529fdc8 --- /dev/null +++ b/h/wrn/coreip/private/ftpLibP.h @@ -0,0 +1,39 @@ +/* ftpLibP.h - private header for ftpLib */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,05nov03,cdw Removal of unnecessary _KERNEL guards. +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01c,14feb02,ant added routines ftpUserPassSet, ftpUserPassPrint +01b,22sep92,rrr added support for c++ +01a,20sep92,kdl written. +*/ + +#ifndef __INCftpLibPh +#define __INCftpLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS ftpLs (char *dirName); + +#else + +extern STATUS ftpLs (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCftpLibPh */ diff --git a/h/wrn/coreip/private/gtf_core.h b/h/wrn/coreip/private/gtf_core.h new file mode 100644 index 0000000..4d03419 --- /dev/null +++ b/h/wrn/coreip/private/gtf_core.h @@ -0,0 +1,263 @@ +/* gtf_core.h - general timer facility - core */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01n,10jul05,dlk Optimizations. Use L_NODE lists rather than DLL_LIST lists + to avoid needing to reference the list head when removing + a timer from the expire list. Replace timerMutex with + intLock/intUnlock. +01m,31jan05,sar Fix defects found in GTF code inspection of 10/26/2004 + as described in SPRs 106685 - 105688 +01l,17jan05,vvv osdep.h cleanup +01k,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01j,02jul04,vvv changed vsnum from VSNUM to VSID +01i,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/2) +01h,25nov03,wap Merge changes from Snowflake +01g,20nov03,niq Remove copyright_wrs.h file inclusion +01f,04nov03,rlm Ran batch header path update for header re-org. +01e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01d,27oct03,rlm update include statements post header re-org. +01c,07aug03,nee Merging to Base6 from ACCORDION_BASE6_MERGE_BASELINE label on + Accordion codeline +01b,03feb02,ham changed for tornado build. +01a,06jun01,deg written. +*/ + +#ifndef __INCgtf_coreh +#define __INCgtf_coreh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include + +#ifdef VIRTUAL_STACK +#include +#endif /* VIRTUAL_STACK */ + + +/* + * For virtual stack, the source files that include this header must + * include vsNetCore.h to find splSemId and splTid + */ + +#ifndef VIRTUAL_STACK +IMPORT SEM_ID splSemId; /* spl mutex semaphore id */ +IMPORT INT32 splTid; /* task which currently owns splSemId */ +#endif /* ! VIRTUAL_STACK */ + +/* defines */ + +/* The LOCAL_ALLOC bit indicates if the GTF has allocated the memory for + * the timer. It is set if GTF did so. + * The ACTIVE bit indicates if the user has serviced this timer. It is cleared + * by GTF when initializing a timer structure and then set when a timer is + * activated (started or reset). It is cleared if the timer is stopped + * (cancel or delete). It is left for the user to clear when the timer + * expires. + * The PENDING bit indicates if the timer is queued in the GTF timer wheels. + * It is cleared by GTF when initializing a timer structure and then set when + * a timer is activated (started or reset). It is cleared when the timer is + * removed from the timer wheels (cancel, delete or expire). + */ + +#define TIMER_LOCAL_ALLOC 0x0001 /* true if GTF allocates timer memory */ +#define TIMER_ACTIVE 0x0002 /* true if timer has not been served */ +#define TIMER_PENDING 0x0004 /* true if timer is waiting for timeout */ + +#define TICKS tickGet() + +#define TICK_LT(x,y) ((long)((x) - (y)) < 0) +#define TICK_GT(x,y) ((long)((x) - (y)) > 0) +#define TICK_LEQ(x,y) ((long)((x) - (y)) <= 0) +#define TICK_GEQ(x,y) ((long)((x) - (y)) >= 0) + +#define time_second netGtfSeconds + + +/* typedefs */ + +struct gtfTimerManager; +struct gtfTimer; + +typedef int (*GTF_TIMER_HANDLER)(void*); +typedef void (*GTF_TICK_FUNC) (struct gtfTimerManager *, void *); + +/* + * This structure is used both for the head and for nodes within + * a circular list. We want to be able to remove a node without + * referencing the list head, and to add quickly to the tail end + * of a list, and fetch the first node quickly. When used as a + * list head, pNext indicates the first entry of the list and + * pPrev indicates the last entry. + */ +typedef struct L_NODE + { + struct L_NODE * pPrev; + struct L_NODE * pNext; + } L_NODE; + +#define L_EMPTY(h) ((h) == (h)->pNext) + +#define L_INIT(h) \ + do { \ + (h)->pPrev = (h); \ + (h)->pNext = (h); \ + } while ((0)) + +/* + * Be careful. After L_REMOVE/L_GET, a node is left with dangling + * references to the list it was in. + */ +#define L_REMOVE(n) \ + do { \ + L_NODE * _pPrev_ = (n)->pPrev; \ + L_NODE * _pNext_ = (n)->pNext; \ + _pPrev_->pNext = _pNext_; \ + _pNext_->pPrev = _pPrev_; \ + } while ((0)) + +#define L_GET(h, n) \ + do { \ + L_NODE * _pNext_; \ + (n) = (void *)((h)->pNext); \ + _pNext_ = ((L_NODE *)(n))->pNext; \ + (h)->pNext = _pNext_; \ + _pNext_->pPrev = (h); \ + } while ((0)) + +#define L_SPLICE(_prev, _next, n) \ + do { \ + (n)->pPrev = (_prev); \ + (n)->pNext = (_next); \ + (_prev)->pNext = (n); \ + (_next)->pPrev = (n); \ + } while ((0)) + +#define L_ADD(h, n) \ + do { \ + L_NODE * _pPrev_ = (h)->pPrev; \ + L_SPLICE (_pPrev_, (h), (n)); \ + } while ((0)) + +typedef struct gtfTimerUnitManager +{ + L_NODE *timerWheel; /* array of timer slots */ + unsigned int fuzzyMask; /* lsb bits (error range) */ + unsigned int shiftBits; /* # bits of fuzzy mask */ + unsigned long nbrFiredTimer; /* # fired timer */ + unsigned int nbrOutstandTimer; /* # outstanding timer */ +} GTF_TIMER_UNIT_MANAGER; + +typedef struct gtfTimerManager +{ + GTF_TIMER_UNIT_MANAGER *timerUnitManager; /* array of timer units */ + unsigned int nbrTimerUnit; /* # of timer units */ + unsigned int nbrTimerSlot; /* # of timer slots */ + unsigned int timerUnitMask; /* mask to realize wrap-around array */ + unsigned int binPowGranScale; /* binary power of gran. scaling factor */ + unsigned long currTicks; /* current GTF tick number */ + unsigned int relSysClkTicks; /* # system ticks per clock delay */ + unsigned int maxTimerTicks; /* max timer tick value */ + SL_LIST timerQueue; /* timer free queue */ + unsigned int maxAllocTimer; /* # of timer in free queue */ + unsigned int currAllocTimer; /* # of allocated timer in free queue */ + WDOG_ID clock; /* clock */ + SEM_ID mngrMutex; /* manager lock */ + SEM_ID count; /* counting semaphore */ + GTF_TICK_FUNC tickFunc; /* external tick function */ + void * tickArg; /* second arg to external tick function */ + SL_LIST timerBlocks; /* blocks of memory for allocated timers */ + L_NODE * timerListMemory; /* Memory allocated for the heads of the */ + /* timer lists, for use when deleting the */ + /* manager */ +} GTF_TIMER_MANAGER; + +typedef struct gtfTimer + { + union + { + L_NODE expNode; /* node of expire list */ + SL_NODE freeNode; /* node of free queue */ + } timerLinking; + unsigned int timerTicks; /* timer ticks */ + unsigned int timerUnit; /* timer unit */ + unsigned int timerFlags; /* timer flags */ + GTF_TIMER_HANDLER handler; /* timer handler */ + void* arg; /* argument to timer handler */ +#ifdef VIRTUAL_STACK + VSID vsnum; /* virtual stack number */ +#endif /* VIRTUAL_STACK */ +} GTF_TIMER; + +extern unsigned long netGtfSeconds; + +extern GTF_TIMER_MANAGER * + gtfTimerManagerCreate(unsigned int nbrTimerUnit, + unsigned int binPowTimerSlot, + unsigned int binPowGranScale, + unsigned int sizeTimerFreeQueue, + unsigned int hertz, + GTF_TICK_FUNC tickFunc, + void * tickArg + ); + +extern int gtfTimerManagerRun(GTF_TIMER_MANAGER *tm); + +extern int gtfBookkeeping(GTF_TIMER_MANAGER *tm); + +extern int gtfTimerManagerDelete(GTF_TIMER_MANAGER *tm); + +extern GTF_TIMER *gtfTimerCreate(GTF_TIMER_MANAGER *tm); + +extern int gtfTimerInit(GTF_TIMER_MANAGER* tm, + GTF_TIMER *t, + unsigned int toTicks, + GTF_TIMER_HANDLER th, + void* arg + ); + +extern int gtfTimerDelete(GTF_TIMER_MANAGER *tm, + GTF_TIMER *t); + +extern int gtfTimerStart(GTF_TIMER_MANAGER *tm, + GTF_TIMER *t + ); + +extern int gtfTimerReset(GTF_TIMER_MANAGER* tm, + GTF_TIMER *t, + unsigned int toTicks, + GTF_TIMER_HANDLER th, + void* arg + ); + +extern int gtfTimerCancel(GTF_TIMER_MANAGER *tm, + GTF_TIMER *t + ); + +extern int gtfShow(GTF_TIMER_MANAGER *tm); + +extern int gtfGetNbrFiredTimer(GTF_TIMER_MANAGER *tm, + unsigned int timerUnit + ); + +extern int gtfGetNbrOutstandTimer(GTF_TIMER_MANAGER *tm, + unsigned int timerUnit + ); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCgtf_coreh */ + diff --git a/h/wrn/coreip/private/gtf_util.h b/h/wrn/coreip/private/gtf_util.h new file mode 100644 index 0000000..04a1b5c --- /dev/null +++ b/h/wrn/coreip/private/gtf_util.h @@ -0,0 +1,85 @@ +/* gtf_util.h - general timer facility - utility */ + +/* Copyright 1984-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,31jan05,sar Fix defects found in GTF code inspection of 10/26/2004 + as described in SPRs 106685 - 105688 +01i,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01h,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01g,20nov03,niq Remove copyright_wrs.h file inclusion +01f,05nov03,cdw Removal of unnecessary _KERNEL guards. +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01c,10jun03,vvv include netVersion.h +01b,15jan02,pas GTF_REQUIRE[_2] should test the condition even if + it's not logging the errors +01a,06jun01,deg written. +*/ + +#ifndef __INCgtf_utilh +#define __INCgtf_utilh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* defines */ + +#ifdef GTF_WITH_DEBUG +#define GTF_PRINT(s1,s2) PRINTF("**** %s : %10ld\n",s1, (unsigned long) s2) +#else +#define GTF_PRINT(s1,s2) +#endif + +#if ! defined (_FREE_VERSION) + +#ifdef GTF_WITH_REQUIRE +#define GTF_REQUIRE(cond, func, diag, retVal) if(!(cond)) \ + { \ + GTF_ERROR_LOG(func, diag); \ + return (retVal); \ + } +#define GTF_REQUIRE_2(cond, func, diag) if(!(cond)) \ + { \ + GTF_ERROR_LOG(func, diag); \ + return; \ + } +#else /* GTF_WITH_REQUIRE */ +#define GTF_REQUIRE(cond, func, diag, retVal) if(!(cond)) \ + { \ + return (retVal); \ + } +#define GTF_REQUIRE_2(cond, func, diag) if(!(cond)) \ + { \ + return; \ + } +#endif /* GTF_WITH_REQUIRE */ + +#else /* defined (_FREE_VERSION) */ + +#define GTF_REQUIRE(cond, func, diag, retVal) do {} while (0) +#define GTF_REQUIRE_2(cond, func, diag) do {} while (0) + +#endif /* defined (_FREE_VERSION) */ + +#define GTF_ERROR_LOG(func, diag) gtfErrorLog(__FILE__, func,__LINE__, diag); + + + +extern void gtfErrorLog(char *file, + char *function, + int line, + char *diagnose + ); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCgtf_utilh */ diff --git a/h/wrn/coreip/private/gtf_wrapper.h b/h/wrn/coreip/private/gtf_wrapper.h new file mode 100644 index 0000000..e1b63f7 --- /dev/null +++ b/h/wrn/coreip/private/gtf_wrapper.h @@ -0,0 +1,57 @@ +/* gtf_wrapper.h - general timer facility - wrapper */ + +/* Copyright 2001-2003, 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,31jan05,sar Fix defects found in GTF code inspection of 10/26/2004 + as described in SPRs 106685 - 105688 +01g,20nov03,niq Remove copyright_wrs.h file inclusion +01f,04nov03,rlm Ran batch header path update for header re-org. +01e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01d,23oct03,rlm updated #includes for header re-org +01c,08sep03,vvv merged from ACCORDION_BASE6_MERGE_BASELINE +01b,02feb02,ham changed for tornado build +01a,06jun01,deg written. +*/ + +#ifndef __INCgtf_wrapperh +#define __INCgtf_wrapperh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +extern GTF_TIMER *gtfTimeout(GTF_TIMER_HANDLER th, + void* arg, + unsigned int toTicks, + GTF_TIMER_MANAGER *tm + ); + +extern void gtfUntimeout(GTF_TIMER_HANDLER th, + void* arg, + GTF_TIMER *t, + GTF_TIMER_MANAGER *tm + ); + +extern void gtfCalloutReset(GTF_TIMER *t, + unsigned int toTicks, + GTF_TIMER_HANDLER th, + void* arg, + GTF_TIMER_MANAGER *tm + ); + +extern void gtfCalloutStop(GTF_TIMER *t, + GTF_TIMER_MANAGER *tm + ); + +extern void gtfCalloutInit(GTF_TIMER *t); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCgtf_wrapperh */ diff --git a/h/wrn/coreip/private/hostLibInt.h b/h/wrn/coreip/private/hostLibInt.h new file mode 100644 index 0000000..f0dfa5d --- /dev/null +++ b/h/wrn/coreip/private/hostLibInt.h @@ -0,0 +1,79 @@ +/* hostLibInt.h - private header for hostLib files */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +01h,09may05,vvv updated ip6_str2scopeid() prototype +01g,05dec03,vvv moved HOST_LIST_* definitions from hostLib.c +01f,24nov03,vvv updated for RTP support +01e,20nov03,niq Remove copyright_wrs.h file inclusion +01d,08sep03,vvv merged from ACCORDION_BASE6_MERGE_BASELINE +01c,21mar03,ann moved the definition of _hostconf and MAXHOSTCONF from + name6.c +01b,21jan02,ann adding the prototypes for gethostbyname, gethostbyaddr, + hostentAlloc and hostentFree +01a,19sep01,hgo creation +*/ + +#ifndef __INChostLibInth +#define __INChostLibInth + +#ifdef __cplusplus +extern "C" { +#endif + +/* Structure definitions */ + +struct _hostconf { + FUNCPTR hostGetByAddr; + FUNCPTR dnsGetByAddr; +}; + +#define HOST_LIST_SIZE 1 +#define HOST_LIST_BUF 2 + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +/* external functions that are shared within hostLib */ + +extern struct addrinfo *hostTblSearchByName2 (char *name, const struct addrinfo *hints); +extern struct hostent *hostTblSearchByAddr2 (const void *addr, int af); +extern struct hostent *getipnodebyaddr (const void *src, size_t len, int af, int *errp); +#ifdef INET6 +extern int ip6_str2scopeid (char *scope, struct sockaddr_in6 *sin6, u_int32_t *); +#endif +extern struct hostent * _hpcopy (struct hostent * hp); + +extern struct netent *getnetbyname (const char *name); + +#else /* __STDC__ */ + +extern struct addrinfo *hostTblSearchByName2 (); +extern struct hostent *hostTblSearchByAddr2 (); +extern struct hostent *getipnodebyaddr (); +#ifdef INET6 +extern int ip6_str2scopeid (); +#endif +extern struct hostent *_hpcopy (); + +extern struct netent *getnetbyname (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INChostLibInth */ diff --git a/h/wrn/coreip/private/jobQueueLibP.h b/h/wrn/coreip/private/jobQueueLibP.h new file mode 100644 index 0000000..f21a38a --- /dev/null +++ b/h/wrn/coreip/private/jobQueueLibP.h @@ -0,0 +1,91 @@ +/* jobQueueLibP.h - private header file for jobQueueLib */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01b,13jul05,dlk Added taskId member to JOB_QUEUE. +01a,06may05,dlk Written. +*/ + +/* Note, jobQueueLib.h should be included before this private header */ + +#ifndef __INCjobQueueLibPh +#define __INCjobQueueLibPh + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define QJOB_ENQUEUED 0x100 +#define QJOB_POOL_ALLOC 0x200 + +typedef struct _QJOB_QUEUE_HEAD + { + QJOB * pHead; + QJOB ** ppTail; + } QJOB_QUEUE_HEAD; + +typedef struct _QJOB_FREE_HEAD + { + QJOB_STANDARD * pHead; + } QJOB_FREE_HEAD; + +typedef QJOB_FREE_HEAD QJOB_BLOCK_HEAD; /* [;^] */ + +typedef struct _QJOB_STD_POOL + { + QJOB_FREE_HEAD free; /* The free list of standard jobs */ + QJOB_BLOCK_HEAD blocks; /* The list of blocks of std. jobs */ + UINT32 refCount; /* How many attached job queues? */ + } QJOB_STD_POOL; + +typedef struct _QUIT_QJOB + { + QJOB job; + volatile int * pQuitValue; + jmp_buf * pJmpBuf; + VOIDFUNCPTR qFunc; + void * arg1; + void * arg2; + } QUIT_QJOB; + +typedef struct _JOB_QUEUE + { + QJOB_QUEUE_HEAD jobs [32]; /* The enqueued jobs */ + UINT32 activePri; /* which queues hold jobs? */ + QJOB_STD_POOL * pStdPool; /* pool for standard jobs */ +#ifdef JOBQ_PRI_MASKABLE + UINT32 priMask; /* which priorities are enabled? */ +#endif + SEMAPHORE sem; /* binary semaphore */ + QJOB_BLOCK_HEAD blocks; /* list of blocks of standard jobs */ + UINT32 flags; /* Is queue in use? */ +#define JOBQ_FLG_RUNNING 0x1 +#define JOBQ_FLG_CREATED 0x2 + int taskId; /* Task currently running */ + /* jobQueueProcess(). */ + + QUIT_QJOB quitJob; + void * userVal; /* reserved for queue creator */ + } JOB_QUEUE; + +#define QUIT_JOB_TO_JOB_QUEUE(q) \ + ((JOB_QUEUE *)((char *)(q) - offsetof (JOB_QUEUE, quitJob))) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCjobQueueLibPh */ diff --git a/h/wrn/coreip/private/m2LibP.h b/h/wrn/coreip/private/m2LibP.h new file mode 100644 index 0000000..d65c241 --- /dev/null +++ b/h/wrn/coreip/private/m2LibP.h @@ -0,0 +1,136 @@ +/* m2Lib.h - VxWorks MIB-II interface to SNMP Agent */ + +/* Copyright 1993-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01k,02dec03,zl use avlUintLib instead of avlLib. +01j,20nov03,niq Remove copyright_wrs.h file inclusion +01i,04nov03,rlm Ran batch header path update for header re-org. +01h,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01g,24oct03,cdw update include statements post header re-org. +01f,20oct03,zl changed for new avlLib without GENERIC_ARGUMENT +01e,08sep03,vvv merged from ACCORDION_BASE6_MERGE_BASELINE +01d,12jul02,ann added a new IOCTL to get the various fields of IP_DRV_CTRL +01c,28mar02,ppp changed to build with the tornado build environment +01b,25feb01,rae merged 01b tor2_0.barney (base 01a): + RFC2233, some cleanup +01a,08dec93,jag written +*/ + +#ifndef __INCm2LibPh +#define __INCm2LibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* This structure is used to keep track of the Network Interfaces */ + +typedef struct + { + int netIfIndex; /* I/F index returned to SNMP */ + long netIfType; /* I/F type from MIB-II specifications */ + unsigned long netIfSpeed; /* I/F Speed from MIB-II specifications */ + unsigned long netIfAdminStatus; /* I/F old status used for traps */ + unsigned long netIfLastChange; /* I/F Time of Interface last change */ + M2_OBJECTID netIfOid; /* I/F Object ID */ + struct arpcom * pNetIfDrv; /* Pointer to BSD Network Driver I/F */ + + } NET_IF_TBL; + +/* + * These IOCTL commands are used exclusively by the mib2Lib.c module to retrive + * MIB-II parameters from network drivers. + */ + +#define SIOCGMIB2CNFG _IOR('m', 0, int) /* Get Configuration */ +#define SIOCGMIB2CNTRS _IOR('m', 1, int) /* Get driver counters */ +#define SIOCGMIB2233 _IOR('m', 2, M2_ID **) /* Get rfc2233 data */ +#define SIOCSMIB2233 _IOW('m', 3, IF_SETENTRY) /* Set rfc2233 data */ +#define SIOCGMCASTLIST _IOR('m', 4, LIST **) /* Get mcast list */ +#define SIOCGMIPDRVCTRL _IOR('m', 5, struct ipdrvFields *) /* Get IP_DRV_CTRL */ +#define SIOCSMIPDRVCTRL _IOR('m', 6, struct ipdrvFields *) /* Set IP_DRV_CTRL */ + +/* + * This structure is used to obtain the configuration information from the + * network drivers. This information is static and does not change through the + * life time of the driver. + */ + +typedef struct + { + long ifType; + M2_OBJECTID ifSpecific; + + } M2_NETDRVCNFG; + +/* + * This structure is used to retrive counters from the network driver. The + * variable ifSpeed is included here to support devices that can compute the + * nominal bandwidth. + */ + +typedef struct + { + unsigned long ifSpeed; + unsigned long ifInOctets; + unsigned long ifInNUcastPkts; + unsigned long ifInDiscards; + unsigned long ifInUnknownProtos; + unsigned long ifOutOctets; + unsigned long ifOutNUcastPkts; + unsigned long ifOutDiscards; + + } M2_NETDRVCNTRS; + + + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Imported from if.c, this flag is used to notify the MIB-II I/F that a + * change in the network interface list has occured. The table will be read + * again. + */ +extern int ifAttachChange; + +/* extern NET_IF_TBL * pm2IfTable; Network I/F table (Allocated Dynamically) */ +extern int m2IfCount; +extern AVLU_TREE pM2IfRoot; /* The root node of the if tree */ +extern M2_IFINDEX * pm2IfTable; /* Network I/F table (Allocated Dynamically) */ +extern int m2IfCount; + +extern M2_OBJECTID zeroObjectId; + +#if defined(__STDC__) || defined(__cplusplus) + +extern int m2NetIfTableRead (void); +extern void ifWalk (int); +extern void testTree (void); + +#else /* __STDC__ */ + +extern int m2NetIfTableRead (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCm2LibPh */ diff --git a/h/wrn/coreip/private/muxL2VlanLibP.h b/h/wrn/coreip/private/muxL2VlanLibP.h new file mode 100644 index 0000000..66941ac --- /dev/null +++ b/h/wrn/coreip/private/muxL2VlanLibP.h @@ -0,0 +1,261 @@ +/* muxL2VlanLibP.h - private definitions for the L2 VLAN MUX library */ + +/* + * Copyright (c) 1996-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01g,15sep05,kch Moved MAX_VID, MIN_VID, MAX_VID, MIN_USER_PRIORITY, + MAX_USER_PRIORITY, IS_VALID_VID and IS_VALID_PRORITY macros + to muxL2Lib.h (SPR #112513). +01f,14sep05,kch Changed MUX_L2_VLAN_STATISTICS define to MUX_L2_VLAN_STAT. + Also renamed MUX_L2_VLAN_STAT structure tag to + MUX_L2_VLAN_PORT_STAT (SPR #112513). +01e,07sep05,kch Replaced vlanHwTaggingSupport and vlanMtuSupport booleans + with hwCaps that uses bit fields. +01d,27aug05,kch Renamed vlan id defines to reflect its actual usage. +01c,24aug05,kch Added MUX_L2_VLAN_STAT data structure and related macros. + Also added muxL2PortInDiscards and muxL2PortOutDiscards + to MUX_L2_PORT. +01b,23aug05,kch Added hwMtu as well as pointer to END_OBJ and NET_FUNCS + to MUX_L2_PORT. Moved vlan tag related macros to muxL2Lib.h. +01a,20jul05,kch written. +*/ + +#ifndef __INCmuxL2VlanLibPh +#define __INCmuxL2VlanLibPh + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _WRS_KERNEL + +/* possible ethernet frame format */ +typedef enum { + ETHER_TYPE2_FRAME_FORMAT = 0x01, + ETHER_8023_FRAME_FORMAT, + UNKNOWN_FRAME_FORMAT +} ETHER_FRAME_FORMAT; + +typedef enum { + VLAN_TAGGED_FRAME = 1, + PRIORITY_TAGGED_FRAME, + UNTAGGED_FRAME, + INVALID_TAGGED_FRAME +} ETHER_FRAME_TYPE; + +/* defines */ +#define LLC_SNAP_FRAME_LEN 8 + +/* + * LLC with DSAP and SSAP of 0x42 is reserved for IEEE 802.1 use. + * These 802.3 ethernet encapsulation is used by Layer 2 protocols + * such as STP, GVRP, and GMRP. + */ +#define LLC_SAP 0x42 + +#define RESERVED_VID 4095 /* for internal use */ + + +/* + * The following defines are the default port-base vlan setting maintained + * by the Layer 2 MUX. + */ +#define DEFAULT_PORT_VID 1 +#define DEFAULT_PORT_USER_PRIORITY 0 +#define DEFAULT_PORT_INGRESS_TYPE ADMIT_ALL_FRAMES +#define DEFAULT_PORT_INGRESS_FILTER FALSE +#define DEFAULT_PORT_EGRESS_TYPE UNTAGGED_FRAME + +/* + * Marco for Hardware L2 capabilities + */ +#define MUX_L2_HW_CAP (IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING) + +#ifdef MUX_L2_VLAN_STATS +typedef struct mux_l2_vlan_port_stat + { + /* + * The number of valid frames received by this port which were classified + * as belonging to this vlan. + * RFC2674 MIB object: dot1qTpVlanPortInFrames + */ + unsigned long muxL2VlanPortInFrames; + + /* + * The number of valid frames transmitted by this port for this vlan. + * RFC2674 MIB object: dot1qTpVlanPortOutFrames + */ + unsigned long muxL2VlanPortOutFrames; + + /* + * The number of valid frames received by this port which were classified + * as belonging to this vlan but were discarded due to vlan related + * reasons. Specifically, the IEEE 802.1Q counters for Discard Inbound. + * RFC2674 MIB object: dot1qTpVlanPortInDiscards + * The description for the MIB object specifies that this object also + * implements the IEEE 802.1Q counter for Discard Ingress Filtering. + * We don't keep track that here because if a frame is discarded by + * ingress filtering, the port is not a member of the vlan, hence, + * the MUX_L2_VLAN_STAT is not allocated for that vlan for the port. + */ + unsigned long muxL2VlanPortInDiscards; + + } MUX_L2_VLAN_PORT_STAT; + +#endif /* MUX_L2_VLAN_STATS */ + + +/* + * L2 per-port configuration + */ +typedef struct mux_l2_port + { + END_OBJ *pEnd; /* pointer back to the device's (END_OBJ *) */ + + /* + * The Port VLAN ID that is assigned to untagged frames or priority-tagged + * frames received on this port. Default: 1 + * RFC2674 MIB object: dot1qPvid + */ + unsigned short portVid; /* Valid Vid: 1..4094 */ + + /* + * The default ingress User Priority for this port (assuming Ethernet + * media). Default: 0 + * RFC2674 MIB object: dot1dPortDefaultUserPriority + */ + unsigned short portUpriority; /* Valid Priority: 0..7 */ + + /* + * When set to ADMIT_TAGGED_ONLY_FRAMES(2), the device will discard + * untagged frames or priority-tagged frames received on this port. + * When set to ADMIT_ALL_FRAMES(1), untagged frames or priority-tagged + * frames received on this port will be accepted and assigned to the + * portPvid for this port. + * The setting does not affect VLAN independent BPDU frames, such as + * GVRP and STP but it does affect VLAN dependent BPDU frames, such as + * GMRP. Default: ADMIT_ALL_FRAMES(1) + * RFC2674 MIB object: dot1qPortAcceptableFrameTypes + */ + ACCEPT_FRAME_TYPE portIngressAcceptFrameType; + + /* + * When this is true(1) the device will discard incoming frame for + * VLANs which do not include this Port in its Member set. When + * false(2), the port will accept all incoming frames. Default: false + * RFC2674 MIB object: dot1qPortIngressFiltering. + */ + BOOL portIngressFilter; + +#ifdef VLAN_TAG + /* Function pointer for user-defined conversion function to convert + * IP TOS field to the 3-bit 802.1Q user priority. The conversion + * routine takes the IP TOS value as its input and returns the vlan + * user priority value (0-7) that needs to be inserted to the outgoing + * vlan tag header. + */ + unsigned char (*portTos2UpConvRtn) (unsigned char); +#endif /* VLAN_TAG */ + + /* + * VLAN membership for this L2 port. Each array element is a bit map + * represents a set of 8 unique VLAN IDs, with the first octet specifies + * VID 1 through 8, the second octet specifying VID 9 through 16, etc. + * Within each octet, the most significant bit represents the highest + * numbered VID. Thus, each VID is represented by a single bit. If that + * bit has a value of 1, then this L2 port is the member for that VID; + * the port is not a member its bit has a value of 0. + */ + unsigned char portVidMemberMap[512]; + + unsigned int numVid; /* number of vids configured for this port */ + + /* hardware layer 2 capabilities flags */ + unsigned long hwCapabilities; + + /* original driver's NET_FUNCS table */ + NET_FUNCS *pEndNetFuncs; + + /* driver's address format - Ethernet Type 2 or 802.3 addressing */ + ETHER_FRAME_FORMAT endAddressFormat; + + int hwMtu; /* hardware mtu size */ + +#ifdef MUX_L2_VLAN_STATS + MUX_L2_VLAN_PORT_STAT **muxL2VlanStat; + + /* + * The number of valid frames received by this port which were discarded + * due to reasons such as vlan membership problem or invalid ingress + * frame type. Specifically, this implements the IEEE 802.1Q counter for + * Discard Ingress Filtering. + */ + unsigned long muxL2PortInDiscards; + + /* + * The number of valid frames transmitted by this port which were + * discarded due to reasons such as vlan membership problem or invalid + * egress frame type + */ + unsigned long muxL2PortOutDiscards; +#endif /* MUX_L2_VLAN_STATS */ + + } MUX_L2_PORT; + +#ifdef MUX_L2_VLAN_STATS + +/* + * Macros for MUX_L2_VLAN_STAT statistics that apply to the port/vlan pairing + */ +#define MUX_L2_VLAN_PORT_IN_FRAMES_COUNT(vlps) \ + { \ + if ((vlps) != NULL) \ + (vlps)->muxL2VlanPortInFrames++; \ + } + +#define MUX_L2_VLAN_PORT_OUT_FRAMES_COUNT(vlps) \ + { \ + if ((vlps) != NULL) \ + (vlps)->muxL2VlanPortOutFrames++; \ + } + +#define MUX_L2_VLAN_PORT_IN_DISCARDS_COUNT(vlps) \ + { \ + if ((vlps) != NULL) \ + (vlps)->muxL2VlanPortInDiscards++; \ + } + +/* + * Macro for MUX_L2_PORT statistics that apply to the port + */ +#define MUX_L2_PORT_IN_DISCARDS_COUNT(vlp) vlp->muxL2PortInDiscards++; +#define MUX_L2_PORT_OUT_DISCARDS_COUNT(vlp) vlp->muxL2PortOutDiscards++ + +#else /* MUX_L2_VLAN_STATS not defined */ + +#define MUX_L2_VLAN_PORT_IN_FRAMES_COUNT(vlps) +#define MUX_L2_VLAN_PORT_OUT_FRAMES_COUNT(vlps) +#define MUX_L2_VLAN_PORT_IN_DISCARDS_COUNT(vlps) +#define MUX_L2_PORT_IN_DISCARDS_COUNT(vlp) +#define MUX_L2_PORT_OUT_DISCARDS_COUNT(vlp) + +#endif /* MUX_L2_VLAN_STATS */ + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmuxL2VlanLibPh */ diff --git a/h/wrn/coreip/private/muxLibP.h b/h/wrn/coreip/private/muxLibP.h new file mode 100644 index 0000000..70bc31a --- /dev/null +++ b/h/wrn/coreip/private/muxLibP.h @@ -0,0 +1,204 @@ +/* muxLibP.h - private definitions for the MUX library */ + +/* Copyright 1998-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02i,25aug05,dlk Add section tags. +02h,27jul05,dlk Added muxEndRxJobQueue(). May be temporary. +02g,21nov03,wap Merge in changes from Snowflake +02f,20nov03,niq Remove copyright_wrs.h file inclusion +02e,04nov03,rlm Ran batch header path update for header re-org. +02d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +02c,01jul03,ann removed obsoleted code +02b,10sep01,ann correcting the directory paths +02a,15may01,ann major changes as per the MUX design doc for clarinet + - obsoleted the BIB and all its associated routines. +01r,25feb01,rae RFC2233 changes +01q,19apr00,ham merged TOR2_0-NPT-FCS (01a,06oct98,sj-01p,05oct99,pul). +01p,05oct99,pul removing rtRequest and mCastMap +01o,29apr99,pul Upgraded NPT phase3 code to tor2.0.0 +01n,24mar99,sj changed tkFlag field in muxBindEntry to flags; added defines +01m,24mar99,sj added defines for flags field of NET_PROTOCOL structure +01l,18mar99,sj cleaned up: completed the cleanup postponed in 01j,05mar99,sj +01k,08mar99,sj added place holder for stackrcv routine in BIB entry +01j,05mar99,sj eliminated hooks; not cleanly though. next version will do that +01i,24feb99,sj added netSvcType and netDrvType fields to the BIB entry +01h,26jan99,sj moved BIB entry definition from muxTkLib.c to here +01g,05nov98,sj PCOOKIE_TO_ENDOBJ must check if pCookie is NULL +01f,03nov98,pul modified IPPROTO_MCAST_MAP_GET +01e,03nov98,sj doc update +01d,20oct98,pul don't return ERROR if hook is not valid +01c,15oct98,pul added ipProto Hooks +01b,12oct98,sj changed MUX_TK_ADDR_RES_FUNC_UPDATE, added WRS_*_MODULE +01a,06oct98,sj written. + +*/ + +/* +DESCRIPTION +This file includes macros used by muxLib to avail features of the NPT +architecture if it is installed. + + +INCLUDE FILES: +*/ + +#ifndef __INCmuxLibPh +#define __INCmuxLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* we steal these defines from a END driver */ + +#define END_IOCTL(pEnd) \ + (pEnd->pFuncTable->ioctl) + +/* Alternate defines for the above till all drivers have been changed + * to follow rfc2233 implementation + */ +#define END_ALT_HADDR(pEnd) \ + ((pEnd)->pMib2Tbl->m2Data.mibIfTbl.ifPhysAddress.phyAddress) +#define END_ALT_HADDR_LEN(pEnd) \ + ((pEnd)->pMib2Tbl->m2Data.mibIfTbl.ifPhysAddress.addrLength) + + +/* + * The following three #defines will be OBSOLETED. Do not use. + * Use the RFC2233 #defines instead + */ + +#define END_HADDR(pEnd) \ + ((pEnd)->mib2Tbl.ifPhysAddress.phyAddress) + +#define END_HADDR_LEN(pEnd) \ + ((pEnd)->mib2Tbl.ifPhysAddress.addrLength) + +#define END_MIB2_TYPE(pEnd) \ + ((pEnd)->mib2Tbl.ifType) + +#define BIND_STYLE_MUXBIND 0 +#define BIND_STYLE_MUXTKBIND 1 + +typedef struct proto_entry PROTO_ENTRY; /* forward declaration typedef */ + +/* + * The PROTOCOL_BINDING structure represents the binding of a protocol to + * an END or NPT device. Additional or duplicate information, particularly + * that needed for receive, is stored in the PROTO_ENTRY structure in the + * interface's protocol table. The PROTO_ENTRY structure in turn contains + * a pointer back to this structure. + */ +typedef struct protocol_binding + { + END_OBJ * pEnd; /* Interface to which protocol is bound */ + PROTO_ENTRY * pEntry; /* information needed by receive */ + UINT16 netSvcType; /* Network service type */ + UINT8 flags; + UINT8 bindStyle; /* BIND_STYLE_{MUXBIND|MUXTKBIND} */ + void * netCallbackId; /* Callback ID passed to muxBind */ + BOOL (*stackRcvRtn) (); /* protocol's receive routine */ + STATUS (*stackTxRestartRtn) (); /* Callback for restarting blocked tx. */ + STATUS (*stackShutdownRtn) (); /* The routine to call to shutdown */ + /* the protocol stack. */ + void (*stackErrorRtn) (); /* Callback for device errors/events */ + long netIfType; /* Interface type */ + FUNCPTR addrResFunc; /* Address resolution function */ + char name[END_PROTO_NAME_MAX]; /* String name for this protocol. */ + } PROTOCOL_BINDING; + +/* + * Each device has a table of PROTO_ENTRY structures corresponding to + * the protocols bound to it. This structure contains information needed + * for receive, as well as a pointer to the corresponding PROTOCOL_BINDING + * structure. The caching of information needed for receive in the small + * PROTO_ENTRY structure is done purely for performance reasons. + * + * The protocol receive routine stored in the PROTO_ENTRY is in certain + * cases a wrapper function around the actual protocol receive routine. + */ + +struct proto_entry + { + UINT16 type; + UINT16 reserved; + + union /* protocol receive routine */ + { + BOOL (*endRcv) (void * pCookie, long type, M_BLK_ID pMblk, + LL_HDR_INFO * pLinkHdrInfo, void * pSpare); + BOOL (*nptRcv) (void * pCookie, long type, M_BLK_ID pMblk, + void * pSpareData); + } rr; + + void * recvRtnArg; + + PROTOCOL_BINDING * pBinding; + }; + +/* A little bit of backwards compatibility */ + +typedef PROTOCOL_BINDING * MUX_ID; + +/* + * Convert from a void * cookie (which is a PROTOCOL_BINDING) to an + * END_OBJ pointer: + */ + +#define PCOOKIE_TO_ENDOBJ(pCookie) ((pCookie) ? ((MUX_ID)pCookie)->pEnd : NULL) + +/* + * Note, a device cookie returned by muxDevLoad(), passed to muxDevStart(), + * etc., is not the same as a binding cookie returned by muxBind(). + * Presently, a device cookie is just a pointer to the END_OBJ. + */ + +#define PDEVCOOKIE_TO_ENDOBJ(pCookie) ((END_OBJ *)(pCookie)) + +/* + * These macros are used by muxAddrRecFuncXXX functions + */ + #define TK_ADDR_RES_GET 1 + #define TK_ADDR_RES_ADD 2 + #define TK_ADDR_RES_DEL 3 + +/* global variables */ /* XXX dlk - needed? */ + +extern SEM_ID muxLock; + +/* prototypes */ + +extern STATUS muxTkLibInit (void); +extern void * muxTkBindCommon (int bindStyle, char * pName, int unit, + BOOL (*stackRcvRtn) (), + STATUS (*stackShutdownRtn) (), + STATUS (*stackTxRestartRtn) (), + void (*stackErrorRtn) (), long type, + char * pProtoName, void * pNetCallbackId, + void * pNetSvcInfo, void * pNetDrvInfo); + +PROTO_ENTRY * muxEndProtoRegister (PROTOCOL_BINDING * pBinding, + BOOL (*recvWrapper) ()); +STATUS muxEndProtoFree (PROTOCOL_BINDING * pProto); +long muxIfTypeGet (END_OBJ * pEnd); + +_WRS_FASTTEXT +STATUS _muxTkSendEnd (END_OBJ * pEnd, M_BLK_ID pNBuff, char * dstMacAddr, + USHORT netType, void * pSpareData, FUNCPTR sendRtn); +_WRS_FASTTEXT +STATUS _muxTkSendNpt (END_OBJ * pEnd, M_BLK_ID pNBuff, char * dstMacAddr, + USHORT netType, void * pSpareData, FUNCPTR sendRtn); + +extern JOB_QUEUE_ID muxEndRxJobQueue (END_OBJ * pEnd); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmuxLibPh */ diff --git a/h/wrn/coreip/private/qosIngressLibP.h b/h/wrn/coreip/private/qosIngressLibP.h new file mode 100644 index 0000000..93bdea6 --- /dev/null +++ b/h/wrn/coreip/private/qosIngressLibP.h @@ -0,0 +1,133 @@ +/* qosIngressLibP.h - private definitions for qos support on ingress */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +01b,08sep05,niq Code review changes + enhanced statistics gathering +01a,09aug05 niq created. +*/ + +#ifndef __INCqosIngressLibPh +#define __INCqosIngressLibPh +#ifdef __cplusplus +extern "C" { +#endif + +#define QOS_MAX_PRI 31 /* Maximum QOS priority */ + +/* + * Structure defining a queue for queuing packets for qos processing + * Each queue contains packets having the same priority. + * We have a array of 32 qos queues that allow 32 different priority + * queues. + */ +struct qosqueue +{ + struct mbuf * qosq_head; + struct mbuf * qosq_tail; +#ifdef QOS_STATS + int qosq_len; /* Num packets in queue */ + int qosq_maxlen; /* Max qlen at any time */ + int qosq_total; /* Cumulative total of packets queued*/ + int qosq_maxlim; /* Not used. Queue max limit */ + int qosq_drops; /* Not used. Packets dropped */ +#endif /* QOS_STATS */ +}; + +struct qosqFlushJob +{ + QJOB flushJob; /* Job for flushing packets on the qosq */ + void * pEnd; /* Device whose pakcets have to be flushed*/ + BOOL done; + +}; + +typedef struct _qosqVars +{ + QJOB processJob;/* Job for processing packets on the qosq */ + UINT32 qosqActivePri; + JOB_QUEUE_ID pJobQueue; /* Job queue to use */ + int qosDefaultPri; /* Default pri for queuing packets */ + struct qosqueue qosqArr [QOS_MAX_PRI + 1]; +#ifdef QOS_STATS + UINT32 numPackets; + UINT32 discards; + UINT32 delivered; +#endif /* QOS_STATS */ +} QOSQ_VARS; + +#ifdef QOS_STATS +#define INC_QLEN(qosq) \ + do { \ + (qosq)->qosq_len++; \ + (qosq)->qosq_total++; \ + if ((qosq)->qosq_maxlen < (qosq)->qosq_len) \ + (qosq)->qosq_maxlen = (qosq)->qosq_len; \ + } while (0) + +#define DEC_QLEN(qosq) (qosq)->qosq_len-- +#else +#define INC_QLEN(qosq) +#define DEC_QLEN(qosq) +#endif /* QOS_STATS */ + + +/* These macros should be used to manipulate the qos queue */ +/* + * We currently manipulate the queues inline for better performance. Hence + * these macros are ununsed for now. + */ + +/* The following two macros are unused currently */ + +#define QOS_QFULL(qosq) ((qosq)->qosq_len >= (qosq)->qosq_maxlen) +#define QOS_DROP(qosq) ((qosq)->qosq_drops++) + +#define QOS_ENQUEUE(qosq, m) \ + do { \ + (m)->m_nextpkt = 0; \ + if ((qosq)->qosq_tail == 0) \ + (qosq)->qosq_head = m; \ + else \ + (qosq)->qosq_tail->m_nextpkt = m; \ + (qosq)->qosq_tail = m; \ + INC_QLEN(qosq); \ + } while (0) + +/* The following macro is unused currently */ +#define QOS_PREPEND(qosq, m) \ + do { \ + (m)->m_nextpkt = (qosq)->qosq_head; \ + if ((qosq)->qosq_tail == 0) \ + (qosq)->qosq_tail = (m); \ + (qosq)->qosq_head = (m); \ + INC_QLEN(qosq); \ + } while (0) + +#define QOS_DEQUEUE(qosq, m) \ + do { \ + (m) = (qosq)->qosq_head; \ + if (m) { \ + if (((qosq)->qosq_head = (m)->m_nextpkt) == 0) \ + (qosq)->qosq_tail = 0; \ + (m)->m_nextpkt = 0; \ + DEC_QLEN(qosq); \ + } \ + } while (0) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCqosIngressLibPh*/ + diff --git a/h/wrn/coreip/private/routeShowP.h b/h/wrn/coreip/private/routeShowP.h new file mode 100644 index 0000000..5960a7d --- /dev/null +++ b/h/wrn/coreip/private/routeShowP.h @@ -0,0 +1,58 @@ +/* routeShowP.h - private header for routeShow.c */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,24sep04,dlk Move name-polluting macros to routeShow.c, and + rename typedefs (SPR #102647). +01a,20sep04,dlk written. +*/ + +#ifndef __INCrouteShowPh +#define __INCrouteShowPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Route show buffering styles */ + +#define ROUTE_BUFFER_NONE 1 +#define ROUTE_BUFFER_SNPRINTF 2 +#define ROUTE_BUFFER_NBIO 3 + +/* typedefs */ + +typedef STATUS (*ROUTE_SHOW_BEGIN_FUNC) (void * pContext, int fd, int timeout); +typedef STATUS (*ROUTE_SHOW_END_FUNC) (void * pContext); +typedef int (*ROUTE_SHOW_APPEND_FUNC) (void * pContext, const char * fmt, + ...); +typedef STATUS (*ROUTE_SHOW_FLUSH_FUNC) (void * pContext); +typedef STATUS (*ROUTE_SHOW_SYNC_FUNC) (void * pContext); +typedef STATUS (*ROUTE_SHOW_DROP_FUNC) (void * pContext); +typedef void (*ROUTE_SHOW_FAIL_FUNC) (void * pContext); + +typedef struct _ROUTE_SHOW_CTX + { + int rtType; + void * pContext; + ROUTE_SHOW_BEGIN_FUNC begin; + ROUTE_SHOW_END_FUNC end; + ROUTE_SHOW_APPEND_FUNC append; + ROUTE_SHOW_FLUSH_FUNC flush; + ROUTE_SHOW_SYNC_FUNC sync; + ROUTE_SHOW_DROP_FUNC drop; + ROUTE_SHOW_FAIL_FUNC fail; + } ROUTE_SHOW_CTX; + +extern BOOL routeShowFail; + +extern ROUTE_SHOW_CTX routeShowCtx; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrouteShowPh */ diff --git a/h/wrn/coreip/private/wvNetDEventP.h b/h/wrn/coreip/private/wvNetDEventP.h new file mode 100644 index 0000000..b46f33f --- /dev/null +++ b/h/wrn/coreip/private/wvNetDEventP.h @@ -0,0 +1,806 @@ +/* wvNetDEventP.h - header file for WindView WindNet IPv6/IPv4 event ids */ + +/* Copyright 2003 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01l,07jul04,vvv fixed warnings (statement not reached) +01k,02apr04,spm fixed virtual stack build: enabled required values +01j,24feb04,syy Update wvNetDEventInfo structure +01i,23jan04,syy Added WV class check to macros +01h,17dec03,syy Remove evtLogOBinary() workaround +01g,16dec03,syy Fixed a typo that caused build problem +01f,11dec03,syy Code adjustment and clean up +01e,08dec03,syy Networking WindView instrumentation merge +01d,04nov03,syy WV Instrumentation changes +01c,20oct03,syy Added #ifdef WV_INSTRUMENTATION +01b,04sep03,tar Windview instrumentation codereview changes +01a,05aug03,tar written +*/ + +#ifndef __INCwvNetDEventPh +#define __INCwvNetDEventPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Routines for selecting events based on IP addresses/ or port numbers. */ + +IMPORT FUNCPTR _func_wvNetAddressFilterTest; +IMPORT FUNCPTR _func_wvNetPortFilterTest; + +#define MIN_WVNET_EVENTID 20000 +#define MAX_WVNET_EVENTID 24999 + +#define WVNET_EVENT(id) (MIN_WVNET_EVENTID + id) + +#define WVNET_MASKSIZE 8 /* Allows 57 to 64 events per level. */ + +/* + * The WV_BLOCK_START macro prevents wasted cycles by determining if + * WindView is running and if the given class has been selected. It + * provides initial screening for reporting network events to WindView. + * WV_CLASS_3 is for "Additional Instrumentation" selection. + * The classId is NETD_IP4_DATAPATH_EVENT, NETD_IP4_CTRLPATH_EVENT, + * NETD_IP6_DATAPATH_EVENT or NETD_IP6_CTRLPATH_EVENT. + */ + +#define WV_BLOCK_START(classId) \ + if (ACTION_IS_SET) \ + { \ + if (WV_EVTCLASS_IS_SET (WV_CLASS_3 | classId | WV_ON)) \ + { +/* + * The WV_NETD_EVENT_TEST macro evaluates to TRUE if the event is selected + * for inclusion in the WindView updates sent to the host. The event + * selection status is stored in a bitmap accessed by priority level. + * This macro is only valid within a test conditional after the + * WV_BLOCK_START macro verifies that the class is active. The eventLevel + * parameter has values determined by the constants defined below, and + * the offset indicates the ordinal number of the event for the given + * level (ranging from 0 upward). + */ + +#define WV_NETD_EVENT_TEST(eventLevel, offset) \ + pWvNetEventMap [eventLevel - 1].bitmap [WVNET_MASKSIZE - 1 - (offset / 8)] & \ + (1 << (offset % 8)) + +/* + * The WV_BLOCK_END provides a footer for all code which reports network + * events to WindView. It closes the open scopes caused by WV_BLOCK_START. + * The classId parameter is not used, but is included for symmetry. + */ + +#define WV_BLOCK_END(classId) \ + } \ + } + +#if defined (WV_INSTRUMENTATION) && defined (INCLUDE_WVNETD) + +/* Temp workaround for missing evtLogOString() in evtLogLib.c */ +#ifndef WVLOGAPI_NEEDED +#define WV_EVT_LOG_OBIN (* _func_evtLogOBinary) +#else +IMPORT void evtLogOBinary (event_t action, int nParam, int arg1, int arg2, int arg3, + int arg4, int arg5, int arg6, int payloadSize, + const char *payload); +#define WV_EVT_LOG_OBIN evtLogOBinary +#endif /* !WVLOGAPI_NEEDED */ + +LOCAL UINT32 wvNetDEventInfo; /* Event information: see wvNetDLib.h */ + +/* + * Event data binary block consists of three parts: the data format ID, + * two optional parameters, each can be either non IP address or IP address. + * The interpretation of the event data is governed by the format ID (the + * first byte). Various formats are defined in the section below. + * + * wvNetDEventBlob [0] - event data format + * wvNetDEventBlob [1-4] - first event data in UINT32 (optional) + * wvNetDEventBlob [5-8] - second event data in UINT32 (optional) + */ +LOCAL UCHAR wvNetDEventBlob[12]; + +/* + * Event data format indicator bit definitions + */ +#define WV_NETD_EVT_PARAM_ONE 0x01 +#define WV_NETD_EVT_PARAM_TWO 0x02 +#define WV_NETD_EVT_V4_ADDR 0x04 +#define WV_NETD_EVT_V6_ADDR 0x08 + +/* + * List of allowed event data formats: + * + * WV_NETD_EVT_FMT_1P: one non- IP address parameter; + * WV_NETD_EVT_FMT_2P: two that non- IP address parameters; + * WV_NETD_EVT_FMT_1P_V4: one non- IP address parameter and one IPv4 address; + * WV_NETD_EVT_FMT_1P_V6: one non- IP address parameter and one ptr to the + * IPv6 address structure; + * WV_NETD_EVT_FMT_V4: two IPv4 addresses; + * WV_NETD_EVT_FMT_V6: two ptr's to the IPv6 addresse structures; + */ +#define WV_NETD_EVT_FMT_1P WV_NETD_EVT_PARAM_ONE +#define WV_NETD_EVT_FMT_2P WV_NETD_EVT_PARAM_ONE | WV_NETD_EVT_PARAM_TWO +#define WV_NETD_EVT_FMT_1P_V4 WV_NETD_EVT_PARAM_ONE | WV_NETD_EVT_V4_ADDR +#define WV_NETD_EVT_FMT_1P_V6 WV_NETD_EVT_PARAM_ONE | WV_NETD_EVT_V6_ADDR +#define WV_NETD_EVT_FMT_V4 WV_NETD_EVT_V4_ADDR +#define WV_NETD_EVT_FMT_V6 WV_NETD_EVT_V6_ADDR + +/* + * The following macros accept an argument of struct sockaddr type and return the + * sockaddr_in for IPv4 and return the address of the struct for IPv6. + */ +#define WV_SOCKADDR_IN(s) (((struct sockaddr_in *)(s))->sin_addr.s_addr) + +#ifdef INET6 +#define WV_SOCKADDR_IN6(s) (((struct sockaddr_in6 *)(s))->sin6_addr) + +#define WV_ADDR_GET(pAddr) (pAddr == NULL ? 0 : \ + (((struct sockaddr *)pAddr)->sa_family == AF_INET ? \ + (ULONG *) &WV_SOCKADDR_IN(pAddr) : \ + (((struct sockaddr *)pAddr)->sa_family == AF_INET6 ? \ + (ULONG *) &WV_SOCKADDR_IN6(pAddr) : 0))) + +#define WV_ADDR_FAMILY_GET(pAddr) (pAddr == NULL ? 0: \ + (((struct sockaddr *)pAddr)->sa_family == AF_INET ? \ + WV_NETD_EVT_V4_ADDR : WV_NETD_EVT_V6_ADDR)) +#else +#define WV_ADDR_GET(pAddr) (pAddr == NULL ? 0 : \ + (((struct sockaddr *)pAddr)->sa_family == AF_INET ? \ + (((struct sockaddr_in *)pAddr)->sin_addr.s_addr) : 0)) + +#define WV_ADDR_FAMILY_GET(pAddr) (pAddr == NULL ? 0 : \ + (((struct sockaddr *)pAddr)->sa_family == AF_INET ? \ + WV_NETD_EVT_V4_ADDR : 0)) +#endif /* INET6 */ + +/* + * The WV_EVT_INFO_SET_ALL macro constructs the WindView event information + * field in the event data using the following structure: + * + * ::::: + * (2 bits) (2 bits) (4 bits) (8 bits) (8 bits) (8 bits) + * + * The component ID is a fixed value for all WindNet IPv6/IPv4 stack code, The + * values of other fields, except Event Tag, use the constants defined + * below. The packet filter type (Filter ID), Entity ID and Module ID are + * assigned using local #defin'se within each module. The final field (Event + * Tag) is a unique identifier for each event within a given module. + * + * Currently, the packet filter is not used. But it may be used for refined + * event filtering someday. + * + * The resulting event information is stored in the ULONG variable + * wvNetDEventInfo, local to the file module. + */ + +#define WV_EVT_INFO_SET_ALL(eventLevel, eventTag, status) \ + wvNetDEventInfo = (WV_NET_DUAL_ID << 30) | (status << 28) \ + | (wvNetDLocalFilter << 24) | (wvNetDEntityId << 16) \ + | (wvNetDModuleId << 8) | eventTag; + +/* Macro sets evenInfo fields, except "Status" */ +#define WV_EVT_INFO_SET(eventLevel, eventTag) \ + wvNetDEventInfo = (WV_NET_DUAL_ID << 30) | (wvNetDLocalFilter << 24) \ + | (wvNetDEntityId << 16) | (wvNetDModuleId << 8) \ + | eventTag; + +/* Store the 4 bytes of an UINT32 into blob */ +#define WV_ASSIGN_BLOB(blob, arg) \ + *(&(blob)) = ((((UINT32) arg) >> 24) & 0xff); \ + *(&(blob) + 1) = ((((UINT32) arg) >> 16) & 0xff); \ + *(&(blob) + 2) = ((((UINT32) arg) >> 8) & 0xff); \ + *(&(blob) + 3) = ((((UINT32) arg) >> 0) & 0xff); \ + *(&(blob) + 4) = '\n'; + +/* + * To minimize the size of the log, for V6 address, only the ptr to struct + * sockadd will be logged. + * + * format: 0x1 - one parameter; 0x3 - two parameters; + */ +#define WV_EVT_BLOB_SET0(format, arg1, arg2) \ + do { \ + wvNetDEventBlob[0] = (UCHAR) format; \ + if ((format) & WV_NETD_EVT_PARAM_ONE) \ + WV_ASSIGN_BLOB(wvNetDEventBlob[1], arg1) \ + if ((format) & WV_NETD_EVT_PARAM_TWO) \ + WV_ASSIGN_BLOB(wvNetDEventBlob[5], arg2) \ + } while (0); + +/* for one parameter + one address */ +#define WV_EVT_BLOB_SET1(twoArgs, format, arg1, arg2) \ + do { \ + wvNetDEventBlob [0] = (UCHAR) format; \ + WV_ASSIGN_BLOB(wvNetDEventBlob[1], arg1) \ + if (twoArgs) \ + WV_ASSIGN_BLOB(wvNetDEventBlob[5], arg2) \ + } while (0); + +/* + * This is same as WV_EVT_BLOB_SET1 except that it assumes twoArgs + * to be false. It is required to eliminate some compiler warnings. + */ + +#define WV_EVT_BLOB_SET1_FALSE(format, arg1, arg2) \ + do { \ + wvNetDEventBlob [0] = (UCHAR) format; \ + WV_ASSIGN_BLOB(wvNetDEventBlob[1], arg1) \ + } while (0); + +/* + * This macro is only used in places where the 2nd argument can be either v4 + * or v6 address. The address passed in must be in struct sockaddr type. + */ +#define WV_EVT_BLOB_SET2(twoArgs, arg1, arg2) \ + do { \ + wvNetDEventBlob [0] = (UCHAR) WV_NETD_EVT_FMT_1P; \ + WV_ASSIGN_BLOB(wvNetDEventBlob[1], arg1) \ + if (twoArgs) \ + { \ + wvNetDEventBlob [0] |= (UCHAR) WV_ADDR_FAMILY_GET(arg2); \ + WV_ASSIGN_BLOB(wvNetDEventBlob[5], WV_ADDR_GET(arg2)) \ + } \ + } while (0); + +/* + * This macro is only used in places where the both arguments can be either v4 + * or v6 addresses. Assume that the two arguments are of same address type and + * only the first can be "0" value. The address passed in must be in struct + * sockaddr type. + */ +#define WV_EVT_BLOB_SET3(twoArgs, arg1, arg2) \ + do { \ + wvNetDEventBlob [0] = (UCHAR) WV_ADDR_FAMILY_GET(arg1); \ + WV_ASSIGN_BLOB(wvNetDEventBlob[1], WV_ADDR_GET (arg1)) \ + if (twoArgs) \ + { \ + if (wvNetDEventBlob [0] == 0) \ + wvNetDEventBlob [0] = (UCHAR) WV_ADDR_FAMILY_GET(arg2);\ + WV_ASSIGN_BLOB(wvNetDEventBlob[5], WV_ADDR_GET(arg2)) \ + } \ + } while (0); + +/* + * This is same as WV_EVT_BLOB_SET3 except that it assumes twoArgs + * to be false. It is required to eliminate some compiler warnings. + */ + +#define WV_EVT_BLOB_SET3_FALSE(arg1, arg2) \ + do { \ + wvNetDEventBlob [0] = (UCHAR) WV_ADDR_FAMILY_GET(arg1); \ + WV_ASSIGN_BLOB(wvNetDEventBlob[1], WV_ADDR_GET (arg1)) \ + } while (0); + +/* + * The WindView for networking marker events handles cases which do not + * involve data transfer. The transmission direction (i.e. - status) field + * in the event identifier is always 0. Up to four additional parameters + * may be sent to the host. + */ + +#define WV_NET_MARKER_1(classId, eventLevel, eventOffset, eventTag, eventId, arg1) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset)) \ + { \ + WV_EVT_INFO_SET (eventLevel, eventTag) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, 0, 0, 0, 0, 0, NULL); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_MARKER_2(classId, eventLevel, eventOffset, eventTag, eventId, arg1, arg2) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset)) \ + { \ + WV_EVT_INFO_SET (eventLevel, eventTag) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, 0, NULL); \ + } \ + WV_BLOCK_END (classId) + +/* when the last argument is a parameter */ +#define WV_NET_MARKER_3(classId, eventLevel, eventOffset, eventTag, eventId, arg1, arg2, arg3) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset)) \ + { \ + int format = WV_NETD_EVT_FMT_1P; \ + WV_EVT_INFO_SET (eventLevel, eventTag) \ + WV_EVT_BLOB_SET0 (format, arg3, 0) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, \ + sizeof (wvNetDEventBlob), (char *)wvNetDEventBlob); \ + } \ + WV_BLOCK_END (classId) + +/* when the last argument is a V4 address */ +#define WV_NET_MARKER_3_4(classId, eventLevel, eventOffset, eventTag, eventId, arg1, arg2, arg3) \ + WV_NET_MARKER_30 (classId, eventLevel, eventOffset, eventTag, eventId, WV_NETD_EVT_FMT_V4, arg1, arg2, arg3) + +/* when the last argument is a V6 address */ +#define WV_NET_MARKER_3_6(classId, eventLevel, eventOffset, eventTag, eventId, arg1, arg2, arg3) \ + WV_NET_MARKER_30 (classId, eventLevel, eventOffset, eventTag, eventId, WV_NETD_EVT_FMT_V6, arg1, arg2, arg3) + +/* when the last argument is a V4 or a V6 address */ +#define WV_NET_MARKER_3_0(classId, eventLevel, eventOffset, eventTag, eventId, arg1, arg2, arg3) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset)) \ + { \ + WV_EVT_INFO_SET (eventLevel, eventTag) \ + WV_EVT_BLOB_SET3_FALSE (arg3, 0) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, \ + sizeof (wvNetDEventBlob), (char *)wvNetDEventBlob); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_MARKER_30(classId, eventLevel, eventOffset, eventTag, eventId, format, arg1, arg2, arg3) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset)) \ + { \ + WV_EVT_INFO_SET (eventLevel, eventTag) \ + WV_EVT_BLOB_SET1_FALSE (format, arg3, 0) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, \ + sizeof (wvNetDEventBlob), (char *)wvNetDEventBlob); \ + } \ + WV_BLOCK_END (classId) + +/* when the last two arguments are parameters */ +#define WV_NET_MARKER_4(classId, eventLevel, eventOffset, eventTag, eventId, arg1, arg2, arg3, arg4) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset)) \ + { \ + WV_EVT_INFO_SET (eventLevel, eventTag) \ + WV_EVT_BLOB_SET0 (WV_NETD_EVT_FMT_2P, arg3, arg4) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, \ + sizeof (wvNetDEventBlob), (char *)wvNetDEventBlob); \ + } \ + WV_BLOCK_END (classId) + +/* when the last two arguments consist of one parameter and one V4 address */ +#define WV_NET_MARKER_4_14(classId, eventLevel, eventOffset, eventTag, eventId, arg1, arg2, arg3, arg4) \ + WV_NET_MARKER_40(classId, eventLevel, eventOffset, eventTag, eventId, WV_NETD_EVT_FMT_1P_V4, arg1, arg2, arg3, arg4) + +/* when the last two arguments consist of one parameter and one V4 or V6 address */ +#define WV_NET_MARKER_4_21(classId, eventLevel, eventOffset, eventTag, eventId, arg1, arg2, arg3, arg4) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset)) \ + { \ + WV_EVT_INFO_SET (eventLevel, eventTag) \ + WV_EVT_BLOB_SET2 (TRUE, arg3, arg4) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, \ + sizeof (wvNetDEventBlob), (char *)wvNetDEventBlob); \ + } \ + WV_BLOCK_END (classId) + +/* when the last two arguments are V4 or V6 IP addresses */ +#define WV_NET_MARKER_4_22(classId, eventLevel, eventOffset, eventTag, eventId, arg1, arg2, arg3, arg4) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset)) \ + { \ + WV_EVT_INFO_SET (eventLevel, eventTag) \ + WV_EVT_BLOB_SET3 (TRUE, arg3, arg4) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, \ + sizeof (wvNetDEventBlob), (char *)wvNetDEventBlob); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_MARKER_40(classId, eventLevel, eventOffset, eventTag, eventId, format, arg1, arg2, arg3, arg4) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset)) \ + { \ + WV_EVT_INFO_SET (eventLevel, eventTag) \ + WV_EVT_BLOB_SET1 (TRUE, format, arg3, arg4) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, \ + sizeof (wvNetDEventBlob), (char *)wvNetDEventBlob); \ + } \ + WV_BLOCK_END (classId) + + /* + * These marker events use the filter which tests for a particular + * source and destination port for outgoing packets. If the filter is + * enabled, the event is not reported to the host unless the ports match + * the registered values. + */ + +#define WV_NET_PORTOUT_MARKER_3(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventId, arg1, arg2, arg3) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetPortFilterTest) (1, srcPort, dstPort)) \ + { \ + int format = WV_NETD_EVT_FMT_1P; \ + WV_EVT_INFO_SET (eventLevel, eventTag) \ + WV_EVT_BLOB_SET0 (format, arg3, 0) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, \ + sizeof (wvNetDEventBlob), (char *)wvNetDEventBlob); \ + } \ + WV_BLOCK_END (classId) + + /* + * This marker event uses the filter which tests for a particular + * destination address for outgoing packets. If the filter is + * enabled, the event is not reported to the host unless the address + * matches the registered value. + */ +#define WV_NET_DSTADDROUT_MARKER_3(classId, eventLevel, eventOffset, eventTag, dstAddr, eventId, arg1, arg2, arg3) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (1, 1, 0, dstAddr)) \ + { \ + int format = WV_NETD_EVT_FMT_1P; \ + WV_EVT_INFO_SET(eventLevel, eventTag) \ + WV_EVT_BLOB_SET0(format, arg3, 0) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, \ + sizeof (wvNetDEventBlob), (char *)wvNetDEventBlob); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_DSTADDROUT_MARKER_3_4(classId, eventLevel, eventOffset, eventTag, dstAddr, eventId, arg1, arg2, arg3) \ + WV_NET_DSTADDROUT_MARKER_30 (classId, eventLevel, eventOffset, eventTag, dstAddr, eventId, WV_NETD_EVT_FMT_V4, arg1, arg2, arg3) + +#define WV_NET_DSTADDROUT_MARKER_30(classId, eventLevel, eventOffset, eventTag, dstAddr, eventId, format, arg1, arg2, arg3) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (1, 1, 0, dstAddr)) \ + { \ + WV_EVT_INFO_SET(eventLevel, eventTag) \ + WV_EVT_BLOB_SET1_FALSE (format, arg3, 0) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, \ + sizeof (wvNetDEventBlob), (char *)wvNetDEventBlob); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_ADDRIN_MARKER_4_4(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventId, arg1, arg2, arg3, arg4) \ + WV_NET_ADDRIN_MARKER_40(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventId, WV_NETD_EVT_FMT_V4, arg1, arg2, arg3, arg4) + +#define WV_NET_ADDRIN_MARKER_40(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventId, format, arg1, arg2, arg3, arg4) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (0, 3, srcAddr, dstAddr)) \ + { \ + WV_EVT_INFO_SET (eventLevel, eventTag) \ + WV_EVT_BLOB_SET1 (TRUE, format, arg3, arg4) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, \ + sizeof (wvNetDEventBlob), (char *)wvNetDEventBlob); \ + } \ + WV_BLOCK_END (classId) + +/* + * The WindView for networking data transfer events store a transmission + * direction in the status field of the event identifier. Valid values are + * WV_NET_SEND and WV_NET_RECV. Up to four additional parameters may be sent + * to the host. + */ + +#define WV_NET_EVENT_1(classId, eventLevel, eventOffset, eventTag, eventId, status, arg1) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset)) \ + { \ + WV_EVT_INFO_SET_ALL (eventLevel, eventTag, status) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, 0, 0, 0, 0, 0, NULL); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_EVENT_2(classId, eventLevel, eventOffset, eventTag, eventId, status, arg1, arg2) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset)) \ + { \ + WV_EVT_INFO_SET_ALL (eventLevel, eventTag, status) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, 0, NULL); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_EVENT_3(classId, eventLevel, eventOffset, eventTag, eventId, status, arg1, arg2, arg3) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset)) \ + { \ + int format = WV_NETD_EVT_FMT_1P; \ + WV_EVT_INFO_SET_ALL (eventLevel, eventTag, status) \ + WV_EVT_BLOB_SET0 (format, arg3, 0) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, \ + sizeof (wvNetDEventBlob), (char *)wvNetDEventBlob); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_EVENT_3_4(classId, eventLevel, eventOffset, eventTag, eventId, status, arg1, arg2, arg3) \ + WV_NET_EVENT_30 (classId, eventLevel, eventOffset, eventTag, eventId, status, WV_NETD_EVT_FMT_V4, arg1, arg2, arg3) + +#define WV_NET_EVENT_30(classId, eventLevel, eventOffset, eventTag, eventId, status, format, arg1, arg2, arg3) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset)) \ + { \ + WV_EVT_INFO_SET_ALL (eventLevel, eventTag, status) \ + WV_EVT_BLOB_SET1_FALSE (format, arg3, 0) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, \ + sizeof (wvNetDEventBlob), (char *)wvNetDEventBlob); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_EVENT_4(classId, eventLevel, eventOffset, eventTag, eventId, status, arg1, arg2, arg3, arg4) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset)) \ + { \ + WV_EVT_INFO_SET_ALL (eventLevel, eventTag, status) \ + WV_EVT_BLOB_SET0 (WV_NETD_EVT_FMT_2P, arg3, arg4) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, \ + sizeof (wvNetDEventBlob), (char *)wvNetDEventBlob); \ + } \ + WV_BLOCK_END (classId) + + /* + * These data transfer events use the filter which tests for a particular + * source and destination port for outgoing packets. If the filter is + * enabled, the event is not reported to the host unless the ports match + * the registered values. + */ + +#define WV_NET_PORTOUT_EVENT_2(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventId, status, arg1, arg2) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetPortFilterTest) (1, srcPort, dstPort)) \ + { \ + WV_EVT_INFO_SET_ALL (eventLevel, eventTag, status) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, 0, NULL); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_PORTOUT_EVENT_3(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventId, status, arg1, arg2, arg3) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetPortFilterTest) (1, srcPort, dstPort)) \ + { \ + int format = WV_NETD_EVT_FMT_1P; \ + WV_EVT_INFO_SET_ALL (eventLevel, eventTag, status) \ + WV_EVT_BLOB_SET0 (format, arg3, 0) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, \ + sizeof (wvNetDEventBlob), (char *)wvNetDEventBlob); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_PORTOUT_EVENT_4(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventId, status, arg1, arg2, arg3, arg4) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetPortFilterTest) (1, srcPort, dstPort)) \ + { \ + WV_EVT_INFO_SET_ALL (eventLevel, eventTag, status) \ + WV_EVT_BLOB_SET0 (WV_NETD_EVT_FMT_2P, arg3, arg4) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, \ + sizeof (wvNetDEventBlob), (char *)wvNetDEventBlob); \ + } \ + WV_BLOCK_END (classId) + + /* + * These data transfer events use the filter which tests for a particular + * source and destination port for incoming packets. If the filter is + * enabled, the event is not reported to the host unless the ports match + * the registered values. + */ + +#define WV_NET_PORTIN_EVENT_2(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventId, status, arg1, arg2) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetPortFilterTest) (0, srcPort, dstPort)) \ + { \ + WV_EVT_INFO_SET_ALL (eventLevel, eventTag, status) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, 0, NULL); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_PORTIN_EVENT_3(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventId, status, arg1, arg2, arg3) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetPortFilterTest) (0, srcPort, dstPort)) \ + { \ + int format = WV_NETD_EVT_FMT_1P; \ + WV_EVT_INFO_SET_ALL (eventLevel, eventTag, status) \ + WV_EVT_BLOB_SET0 (format, arg3, 0) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, \ + sizeof (wvNetDEventBlob), (char *)wvNetDEventBlob); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_PORTIN_EVENT_4(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventId, status, arg1, arg2, arg3, arg4) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetPortFilterTest) (0, srcPort, dstPort)) \ + { \ + WV_EVT_INFO_SET_ALL (eventLevel, eventTag, status) \ + WV_EVT_BLOB_SET0 (WV_NETD_EVT_FMT_2P, arg3, arg4) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, \ + sizeof (wvNetDEventBlob), (char *)wvNetDEventBlob); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_PORTIN_EVENT_4_4(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventId, status, arg1, arg2, arg3, arg4) \ + WV_NET_PORTIN_EVENT_40(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventId, WV_NETD_EVT_FMT_V4, status, arg1, arg2, arg3, arg4) + +#define WV_NET_PORTIN_EVENT_40(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventId, format, status, arg1, arg2, arg3, arg4) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetPortFilterTest) (0, srcPort, dstPort)) \ + { \ + WV_EVT_INFO_SET_ALL (eventLevel, eventTag, status) \ + WV_EVT_BLOB_SET1 (TRUE, format, arg3, arg4) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, \ + sizeof (wvNetDEventBlob), (char *)wvNetDEventBlob); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_DSTADDROUT_EVENT_3(classId, eventLevel, eventOffset, eventTag, dstAddr, eventId, status, arg1, arg2, arg3) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (1, 1, 0, dstAddr)) \ + { \ + WV_EVT_INFO_SET_ALL (eventLevel, eventTag, status) \ + WV_EVT_BLOB_SET0 (WV_NETD_EVT_FMT_1P, arg3, 0) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, \ + sizeof (wvNetDEventBlob), (char *)wvNetDEventBlob); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_DSTADDROUT_EVENT_4_14(classId, eventLevel, eventOffset, eventTag, dstAddr, eventId, status, arg1, arg2, arg3, arg4) \ + WV_NET_DSTADDROUT_EVENT_40(classId, eventLevel, eventOffset, eventTag, dstAddr, eventId, WV_NETD_EVT_FMT_1P_V4, status, arg1, arg2, arg3, arg4) + +#define WV_NET_DSTADDROUT_EVENT_4_4(classId, eventLevel, eventOffset, eventTag, dstAddr, eventId, status, arg1, arg2, arg3, arg4) \ + WV_NET_DSTADDROUT_EVENT_40(classId, eventLevel, eventOffset, eventTag, dstAddr, eventId, WV_NETD_EVT_FMT_V4, status, arg1, arg2, arg3, arg4) + +#define WV_NET_DSTADDROUT_EVENT_40(classId, eventLevel, eventOffset, eventTag, dstAddr, eventId, format, status, arg1, arg2, arg3, arg4) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (1, 1, 0, dstAddr)) \ + { \ + WV_EVT_INFO_SET_ALL (eventLevel, eventTag, status) \ + WV_EVT_BLOB_SET1 (TRUE, format, arg3, arg4) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, \ + sizeof (wvNetDEventBlob), (char *)wvNetDEventBlob); \ + } \ + WV_BLOCK_END (classId) + /* + * This data transfer event uses the filter which tests for a particular + * destination address for incoming packets. If the filter is enabled, + * the event is not reported to the host unless the address matches the + * registered value. + */ + +#define WV_NET_DSTADDRIN_EVENT_4_14(classId, eventLevel, eventOffset, eventTag, dstAddr, eventId, status, arg1, arg2, arg3, arg4) \ + WV_NET_DSTADDRIN_EVENT_40(classId, eventLevel, eventOffset, eventTag, dstAddr, eventId, WV_NETD_EVT_FMT_1P_V4, status, arg1, arg2, arg3, arg4) + +#define WV_NET_DSTADDRIN_EVENT_4_4(classId, eventLevel, eventOffset, eventTag, dstAddr, eventId, status, arg1, arg2, arg3, arg4) \ + WV_NET_DSTADDRIN_EVENT_40(classId, eventLevel, eventOffset, eventTag, dstAddr, eventId, WV_NETD_EVT_FMT_V4, status, arg1, arg2, arg3, arg4) + +#define WV_NET_DSTADDRIN_EVENT_40(classId, eventLevel, eventOffset, eventTag, dstAddr, eventId, format, status, arg1, arg2, arg3, arg4) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (0, 1, 0, dstAddr)) \ + { \ + WV_EVT_INFO_SET_ALL (eventLevel, eventTag, status) \ + WV_EVT_BLOB_SET1 (TRUE, format, arg3, arg4) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, \ + sizeof (wvNetDEventBlob), (char *)wvNetDEventBlob); \ + } \ + WV_BLOCK_END (classId) + /* + * This data transfer event uses the filter which tests for a particular + * source and destination address for outgoing packets. If the filter is + * enabled, the event is not reported to the host unless the addresses + * match both registered values. + */ + +#define WV_NET_ADDROUT_EVENT_2(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventId, status, arg1, arg2) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (1, 3, srcAddr, dstAddr)) \ + { \ + WV_EVT_INFO_SET_ALL (eventLevel, eventTag, status) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, 0, NULL); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_ADDROUT_EVENT_4_14(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventId, status, arg1, arg2, arg3, arg4) \ + WV_NET_ADDROUT_EVENT_40(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventId, WV_NETD_EVT_FMT_1P_V4, status, arg1, arg2, arg3, arg4) + +#define WV_NET_ADDROUT_EVENT_4_4(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventId, status, arg1, arg2, arg3, arg4) \ + WV_NET_ADDROUT_EVENT_40(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventId, WV_NETD_EVT_FMT_V4, status, arg1, arg2, arg3, arg4) + +#define WV_NET_ADDROUT_EVENT_40(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventId, format, status, arg1, arg2, arg3, arg4) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (1, 3, srcAddr, dstAddr)) \ + { \ + WV_EVT_INFO_SET_ALL (eventLevel, eventTag, status) \ + WV_EVT_BLOB_SET1 (TRUE, format, arg3, arg4) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, \ + sizeof (wvNetDEventBlob), (char *)wvNetDEventBlob); \ + } \ + WV_BLOCK_END (classId) + + /* + * This data transfer event uses the filter which tests for a particular + * source and destination address for incoming packets. If the filter is + * enabled, the event is not reported to the host unless the addresses + * match both registered values. + */ + +#define WV_NET_ADDRIN_EVENT_2(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventId, status, arg1, arg2) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (0, 3, srcAddr, dstAddr)) \ + { \ + WV_EVT_INFO_SET_ALL (eventLevel, eventTag, status) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, 0, NULL); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_ADDRIN_EVENT_4(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventId, status, arg1, arg2, arg3, arg4) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (0, 3, srcAddr, dstAddr)) \ + { \ + WV_EVT_INFO_SET_ALL (eventLevel, eventTag, status) \ + WV_EVT_BLOB_SET0 (WV_NETD_EVT_FMT_2P, arg3, arg4) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, \ + sizeof (wvNetDEventBlob), (char *)wvNetDEventBlob); \ + } \ + WV_BLOCK_END (classId) + +#define WV_NET_ADDRIN_EVENT_4_4(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventId, status, arg1, arg2, arg3, arg4) \ + WV_NET_ADDRIN_EVENT_40(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventId, WV_NETD_EVT_FMT_V4, status, arg1, arg2, arg3, arg4) + +#define WV_NET_ADDRIN_EVENT_40(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventId, format, status, arg1, arg2, arg3, arg4) \ + WV_BLOCK_START (classId) \ + if (WV_NETD_EVENT_TEST (eventLevel, eventOffset) && \ + (* _func_wvNetAddressFilterTest) (0, 3, srcAddr, dstAddr)) \ + { \ + WV_EVT_INFO_SET_ALL (eventLevel, eventTag, status) \ + WV_EVT_BLOB_SET1(TRUE, format, arg3, arg4) \ + WV_EVT_LOG_OBIN (eventId, 3, wvNetDEventInfo, (int)arg1, (int)arg2, 0, 0, 0, \ + sizeof (wvNetDEventBlob), (char *)wvNetDEventBlob); \ + } \ + WV_BLOCK_END (classId) + +#else /* when WV is excluded */ + +#define WV_ADDR_GET(pAddr) {} +#define WV_NET_MARKER_1(classId, eventLevel, eventOffset, eventTag, eventId, arg1) {} +#define WV_NET_MARKER_2(classId, eventLevel, eventOffset, eventTag, eventId, arg1, arg2) {} +#define WV_NET_MARKER_3(classId, eventLevel, eventOffset, eventTag, eventId, arg1, arg2, arg3) {} +#define WV_NET_MARKER_3_4(classId, eventLevel, eventOffset, eventTag, eventId, arg1, arg2, arg3) {} +#define WV_NET_MARKER_3_6(classId, eventLevel, eventOffset, eventTag, eventId, arg1, arg2, arg3) {} +#define WV_NET_MARKER_3_0(classId, eventLevel, eventOffset, eventTag, eventId, arg1, arg2, arg3) {} +#define WV_NET_MARKER_4(classId, eventLevel, eventOffset, eventTag, eventId, arg1, arg2, arg3, arg4) {} +#define WV_NET_MARKER_4_14(classId, eventLevel, eventOffset, eventTag, eventId, arg1, arg2, arg3, arg4) {} +#define WV_NET_MARKER_4_21(classId, eventLevel, eventOffset, eventTag, eventId, arg1, arg2, arg3, arg4) {} +#define WV_NET_MARKER_4_22(classId, eventLevel, eventOffset, eventTag, eventId, arg1, arg2, arg3, arg4) {} +#define WV_NET_PORTOUT_MARKER_3(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventId, arg1, arg2, arg3) {} +#define WV_NET_DSTADDROUT_MARKER_3(classId, eventLevel, eventOffset, eventTag, dstAddr, eventId, arg1, arg2, arg3) {} +#define WV_NET_DSTADDROUT_MARKER_3_4(classId, eventLevel, eventOffset, eventTag, dstAddr, eventId, arg1, arg2, arg3) {} +#define WV_NET_ADDRIN_MARKER_4_4(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventId, arg1, arg2, arg3, arg4) {} +#define WV_NET_EVENT_1(classId, eventLevel, eventOffset, eventTag, eventId, status, arg1) {} +#define WV_NET_EVENT_2(classId, eventLevel, eventOffset, eventTag, eventId, status, arg1, arg2) {} +#define WV_NET_EVENT_3(classId, eventLevel, eventOffset, eventTag, eventId, status, arg1, arg2, arg3) {} +#define WV_NET_EVENT_3_4(classId, eventLevel, eventOffset, eventTag, eventId, status, arg1, arg2, arg3) {} +#define WV_NET_EVENT_4(classId, eventLevel, eventOffset, eventTag, eventId, status, arg1, arg2, arg3, arg4) {} +#define WV_NET_PORTOUT_EVENT_2(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventId, status, arg1, arg2) {} +#define WV_NET_PORTOUT_EVENT_3(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventId, status, arg1, arg2, arg3) {} +#define WV_NET_PORTOUT_EVENT_4(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventId, status, arg1, arg2, arg3, arg4) {} +#define WV_NET_PORTIN_EVENT_2(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventId, status, arg1, arg2) {} +#define WV_NET_PORTIN_EVENT_3(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventId, status, arg1, arg2, arg3) {} +#define WV_NET_PORTIN_EVENT_4(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventId, status, arg1, arg2, arg3, arg4) {} +#define WV_NET_PORTIN_EVENT_4_4(classId, eventLevel, eventOffset, eventTag, srcPort, dstPort, eventId, status, arg1, arg2, arg3, arg4) {} +#define WV_NET_DSTADDROUT_EVENT_3(classId, eventLevel, eventOffset, eventTag, dstAddr, eventId, status, arg1, arg2, arg3) {} +#define WV_NET_DSTADDROUT_EVENT_4_14(classId, eventLevel, eventOffset, eventTag, dstAddr, eventId, status, arg1, arg2, arg3, arg4) {} +#define WV_NET_DSTADDROUT_EVENT_4_4(classId, eventLevel, eventOffset, eventTag, dstAddr, eventId, status, arg1, arg2, arg3, arg4) {} +#define WV_NET_DSTADDRIN_EVENT_4_14(classId, eventLevel, eventOffset, eventTag, dstAddr, eventId, status, arg1, arg2, arg3, arg4) {} +#define WV_NET_DSTADDRIN_EVENT_4_4(classId, eventLevel, eventOffset, eventTag, dstAddr, eventId, status, arg1, arg2, arg3, arg4) {} +#define WV_NET_ADDROUT_EVENT_2(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventId, status, arg1, arg2) {} +#define WV_NET_ADDROUT_EVENT_4_14(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventId, status, arg1, arg2, arg3, arg4) {} +#define WV_NET_ADDROUT_EVENT_4_4(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventId, status, arg1, arg2, arg3, arg4) {} +#define WV_NET_ADDRIN_EVENT_2(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventId, status, arg1, arg2) {} +#define WV_NET_ADDRIN_EVENT_4(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventId, status, arg1, arg2, arg3, arg4) {} +#define WV_NET_ADDRIN_EVENT_4_4(classId, eventLevel, eventOffset, eventTag, srcAddr, dstAddr, eventId, status, arg1, arg2, arg3, arg4) {} +#endif /* WV_INSTRUMENTATION && INCLUDE_WVNETD */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwvNetDEventPh */ diff --git a/h/wrn/coreip/protos/icmpv6Lib.h b/h/wrn/coreip/protos/icmpv6Lib.h new file mode 100644 index 0000000..74ca61e --- /dev/null +++ b/h/wrn/coreip/protos/icmpv6Lib.h @@ -0,0 +1,49 @@ +/* icmpv6Lib.h - configuration data for ICMPv6 */ + +/* + * Copyright (c) 2000-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01h,29apr05,rp moved mld config variables to mldLib.h. +01g,21apr05,rp added mldv2 variables +01f,09feb05,wap Allow sysctl init routines to be scaled out +01e,05nov03,cdw Removal of unnecessary _KERNEL guards. +01d,04nov03,rlm Ran batch header path update for header re-org. +01c,15sep03,vvv updated path for new headers +01b,03sep02,ger removed cfg_priv_icmp6errpps_count from config params +01a,24jun02,ant written +*/ + +#ifndef __INCicmpv6Libh +#define __INCicmpv6Libh + +/* includes */ + + +#include + +/* defines */ + +/* typedefs */ + +typedef struct icmpv6_config_params + { + CFG_DATA_HDR cfgh; + /*int cfg_priv_icmp6errpps_count; not configurable*/ + int cfg_icmp6_rediraccept; + int cfg_icmp6_redirtimeout; + int cfg_icmp6errppslim; + int cfg_icmp6nodeinfo; + FUNCPTR cfg_privInitSysctl; + } ICMPV6_CONFIG_PARAMS; + +#endif /* __INCicmpv6Libh */ + + diff --git a/h/wrn/coreip/protos/igmpLib.h b/h/wrn/coreip/protos/igmpLib.h new file mode 100644 index 0000000..c0ce957 --- /dev/null +++ b/h/wrn/coreip/protos/igmpLib.h @@ -0,0 +1,53 @@ +/* igmpLib.h - configuration data structute for IGMP */ + +/* Copyright 2000 - 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,09feb05,wap Allow sysctl init routines to be scaled out +01d,05nov03,cdw Removal of unnecessary _KERNEL guards. +01c,04nov03,rlm Ran batch header path update for header re-org. +01b,15sep03,vvv updated path for new headers +01a,14aug03,niq Created +*/ + +#ifndef __INCigmpLibh +#define __INCigmpLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include +#include + +/* defines */ + +/* typedefs */ + +typedef struct igmp_config_params + { + CFG_DATA_HDR cfgh; + FUNCPTR cfg_privInitSysctl; + } IGMP_CONFIG_PARAMS; + +/* prototypes */ + +#if defined(__STDC__) || defined(__cplusplus) + +IMPORT STATUS igmpInstInit (void * InitValues); + +#else /* __STDC__ */ + +IMPORT STATUS igmpInstInit (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCigmpLibh */ diff --git a/h/wrn/coreip/protos/ip6protosw.h b/h/wrn/coreip/protos/ip6protosw.h new file mode 100644 index 0000000..8571834 --- /dev/null +++ b/h/wrn/coreip/protos/ip6protosw.h @@ -0,0 +1,186 @@ +/* ip6protosw.h - protocol switch table for IPv6 */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* $KAME: ip6protosw.h,v 1.31 2004/05/25 01:16:39 suz Exp $ */ +/* $FreeBSD: src/sys/netinet6/ip6protosw.h,v 1.2.2.4 2002/04/28 05:40:27 suz Exp $ */ +/* $KAME: ip6protosw.h,v 1.25 2001/09/26 06:13:03 keiichi Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +/* BSDI protosw.h,v 2.3 1996/10/11 16:02:40 pjd Exp */ + +/*- + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)protosw.h 8.1 (Berkeley) 6/2/93 + */ + +/* +modification history +-------------------- +01c,21jun05,dlk Added members to ip6ctlparam (SPR #110450). +01b,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +01a,10jan05,kc Merge from $KAME: ip6protosw.h,v 1.31. +*/ + +#ifndef _NETINET6_IP6PROTOSW_H_ +#define _NETINET6_IP6PROTOSW_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Protocol switch table for IPv6. + * All other definitions should refer to sys/protosw.h + */ + +struct mbuf; +struct sockaddr; +struct socket; +struct domain; +struct proc; +struct ip6_hdr; +struct icmp6_hdr; +struct in6_addr; +struct pr_usrreqs; + +/* + * argument type for the last arg of pr_ctlinput(). + * should be consulted only with AF_INET6 family. + * + * IPv6 ICMP IPv6 [exthdrs] finalhdr paylaod + * ^ ^ ^ ^ + * | | ip6c_ip6 ip6c_off + * | ip6c_icmp6 + * ip6c_m + * + * ip6c_src: ip6c_ip6->ip6_src + scope info + flowlabel in ip6c_ip6 + * (beware of flowlabel, if you try to compare it against others) + * + * when the inner packet contains a routing header, the final destination + * (which may be different from the ip6_dst of the inner packet) must be + * passed to pr_ctlinput(). + */ +struct ip6ctlparam { + struct mbuf *ip6c_m; /* start of mbuf chain */ + struct icmp6_hdr *ip6c_icmp6; /* icmp6 header of target packet */ + struct ip6_hdr *ip6c_ip6; /* ip6 header of target packet */ + int ip6c_off; /* offset of the target proto header */ + struct sockaddr_in6 *ip6c_src; /* srcaddr w/ additional info */ +#if 0 + struct sockaddr_in6 *ip6c_dst; /* (final) dstaddr w/ additional info */ + struct in6_addr *ip6c_finaldst; /* final destination address */ +#endif + void *ip6c_cmdarg; /* control command dependent data */ + u_int8_t ip6c_nxt; /* final next header field */ + int ip6c_result; /* ICMP protocol validation result */ +#define IP6C_RESULT_ACCEPT 0 +#define IP6C_RESULT_REJECT 1 + u_long ip6c_oldmtu; /* old MTU value */ + void * ip6c_privctx; /* private to ICMP6 implementation */ +}; + +struct ip6protosw { + short pr_type; /* socket type used for */ + struct domain *pr_domain; /* domain protocol a member of */ + short pr_protocol; /* protocol number */ + short pr_flags; /* see below */ + +/* protocol-protocol hooks */ + int (*pr_input) /* input to protocol (from below) */ + __P((struct mbuf **, int *, int)); + int (*pr_output) /* output to protocol (from above) */ + __P((struct mbuf *, ...)); + void (*pr_ctlinput) /* control input (from below) */ + __P((int, struct sockaddr *, void *)); + int (*pr_ctloutput) /* control output (from above) */ + __P((struct socket *, struct sockopt *)); + +/* user-protocol hook */ + int (*pr_usrreq) /* user request: see list below */ + __P((struct socket *, int, struct mbuf *, + struct mbuf *, struct mbuf *, struct proc *)); + +/* utility hooks */ + void (*pr_init) /* initialization hook */ + __P((void)); + + void (*pr_fasttimo) /* fast timeout (200ms) */ + __P((void)); + void (*pr_slowtimo) /* slow timeout (500ms) */ + __P((void)); + void (*pr_drain) /* flush any excess space possible */ + __P((void)); + struct pr_usrreqs *pr_usrreqs; /* supersedes pr_usrreq() */ +}; + +#ifdef __cplusplus +} +#endif + +#endif /* !_NETINET6_IP6PROTOSW_H_ */ diff --git a/h/wrn/coreip/protos/mld6_var.h b/h/wrn/coreip/protos/mld6_var.h new file mode 100644 index 0000000..cd39d69 --- /dev/null +++ b/h/wrn/coreip/protos/mld6_var.h @@ -0,0 +1,126 @@ +/* mld6_var.h - mld6 header file */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* $KAME: mld6_var.h,v 1.14 2004/07/05 04:43:28 jinmei Exp $ */ + +/* + * Copyright (C) 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* +modification history +-------------------- +01g,02may05,rp moved prototype to sysctlLib.h +01f,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +01e,07feb05,vvv _KERNEL cleanup +01d,18jan05,vvv osdep.h cleanup +01c,24feb05,rp fixed MLD_RANDOM_DELAY +01b,14feb05,kc Added mldv2SysctlInit() prototype. +01a,17jan04,rp ported from Kame +*/ + +#ifndef _NETINET6_MLD6_VAR_H_ +#define _NETINET6_MLD6_VAR_H_ + +#ifdef _WRS_KERNEL + +#define MLD_RANDOM_DELAY(X) (random() % (unsigned long)(X) + 1) + +/* + * States for MLD stop-listening processing + */ +#define MLD_OTHERLISTENER 0 +#define MLD_IREPORTEDLAST 1 +#define MLD_REPORTPENDING 2 /* implementation specific */ + +/* + * States for the MLDv2's state table. + */ +#define MLD_QUERY_PENDING_MEMBER 2 /* pending General Query */ +#define MLD_G_QUERY_PENDING_MEMBER 3 /* pending Grp-specific Query */ +#define MLD_SG_QUERY_PENDING_MEMBER 4 /* pending Grp-Src-specific Q.*/ + +/* + * We must remember what version the subnet's querier is. + * We conveniently use the MLD message type for the proper + * membership report to keep this state. + */ +#define MLD_V1_ROUTER MLD_LISTENER_REPORT +#define MLD_V2_ROUTER MLDV2_LISTENER_REPORT + +/* + * MLDv2 default variables + */ +#define MLD_TIMER_SCALE 1000 +#define MLD_DEF_RV 2 /* Default Robustness Variable */ +#define MLD_DEF_QI 125 /* Query Interval (125 sec.) */ +#define MLD_DEF_QRI 10000 /* Query Response Interval (10 sec.) */ +#define MLD_OQPT ((MLD_DEF_RV * MLD_DEF_QI) + MLD_DEF_QRI/MLD_TIMER_SCALE/2) + /* Other Querier Present Timer */ +#define MLD_MALI ((MLD_DEF_RV * MLD_DEF_QI) + MLD_DEF_QRI/MLD_TIMER_SCALE) + /* Multicast Address Listener Interval */ +#define MLD_START_INTVL MLD_DEF_QI/4 +#define MLD_START_CNT MLD_DEF_RV +#define MLD_LAST_INTVL 1000 /* Last Member Query Interval (1 sec) */ +#define MLD_LAST_CNT MLD_DEF_RV +#define MLD_UNSOL_INTVL 10 /* Unsolicited Report Interval (sec) */ +#define MLDV2_UNSOL_INTVL 1 /* Unsolicited Report Interval (sec) */ +#define MLD_DEF_QUERY 10 /* v1 Max. Response Time (sec.) */ + +extern struct router6_info *Head6; +extern int mld_debug; + +#define mldlog(x) do { if (mld_debug) log x; } while (/*CONSTCOND*/ 0) + +void mld_init(void); +struct router6_info * rt6i_init(struct ifnet *); +void mld_input(struct mbuf *, int); +#ifdef MLDV2 +void mld_start_listening(struct in6_multi *, u_int8_t type); +#endif +void mld_stop_listening(struct in6_multi *); +void mld_slowtimeo(void); +#ifdef MLDV2 +void mld_fasttimeo(void); +#endif +void mld_send_state_change_report(struct mbuf **, int *, + struct in6_multi *, u_int8_t, int); + +#ifdef MLDV2 +int in6_is_mld_target(struct in6_addr *); +#endif +#endif /* _WRS_KERNEL */ + +#endif /* _NETINET6_MLD6_VAR_H_ */ diff --git a/h/wrn/coreip/protos/mldLib.h b/h/wrn/coreip/protos/mldLib.h new file mode 100644 index 0000000..605c071 --- /dev/null +++ b/h/wrn/coreip/protos/mldLib.h @@ -0,0 +1,39 @@ +/* mldLib.h - configuration data for MLD */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01a,29apr05,rp written +*/ + +#ifndef __INCmldLibh +#define __INCmldLibh + +/* includes */ + + +#include + +/* defines */ + +/* typedefs */ + +typedef struct mld_config_params + { + CFG_DATA_HDR cfgh; + int cfg_mldmaxsrcfilter; + int cfg_mldsomaxsrc; + int cfg_mld_version; + FUNCPTR cfg_privInitSysctl; + } MLD_CONFIG_PARAMS; + +#endif /* __INCmldLibh */ + diff --git a/h/wrn/coreip/protos/mrouteLib.h b/h/wrn/coreip/protos/mrouteLib.h new file mode 100644 index 0000000..84717bb --- /dev/null +++ b/h/wrn/coreip/protos/mrouteLib.h @@ -0,0 +1,12 @@ +/* mrouteLib.h - configuration data for mroute */ + +/* Copyright 2000 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,04sep02,kal no longer used +01a,24jul02,ant written +*/ + +/* DEPRECATED */ diff --git a/h/wrn/coreip/protos/nd6Lib.h b/h/wrn/coreip/protos/nd6Lib.h new file mode 100644 index 0000000..fae0468 --- /dev/null +++ b/h/wrn/coreip/protos/nd6Lib.h @@ -0,0 +1,78 @@ +/* nd6Lib.h - VxWorks ND6 header file */ + +/* Copyright 2002-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01k,12may05,rp added _nd6_maxqueuelen +01j,09feb05,wap Allow sysctl init routines to be scaled out. +01i,20nov03,niq Remove copyright_wrs.h file inclusion +01h,05nov03,cdw Removal of unnecessary _KERNEL guards. +01g,04nov03,rlm Ran batch header path update for header re-org. +01f,15sep03,vvv updated path for new headers +01e,10mar03,nee consolidate nd6_ifinfo_indexlim and if_indexlim +01d,05sep02,hgo added use_tempaddr, temp_xxx_lifetime +01c,30aug02,ism added cfg_nd_ifinfo_indexlim +01b,28aug02,kal fixed location of cfgDefs.h +01a,08jul02,hgo creation +*/ + +#ifndef __INCnd6Libh +#define __INCnd6Libh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include + +#ifdef VIRTUAL_STACK +#include +#endif + +typedef struct nd6_config_params { + CFG_DATA_HDR cfgh; + + int cfg_nd6_prune; /* walk list every 1 seconds */ + int cfg_nd6_delay; /* delay first probe time 5 second */ + int cfg_nd6_umaxtries; /* maximum unicast query */ + int cfg_nd6_mmaxtries; /* maximum muliticast query */ + int cfg_nd6_useloopback; /* use loopback interface for local traffic */ + int cfg_nd6_maxnudhint; /* max # of subsequent upper layer hints */ + int cfg_nd6_maxqueuelen; /* max # of packets cac +hed in unresolved ND entries */ + int cfg_nd6_debug; + + int cfg_ip6_use_tempaddr; + u_int32_t cfg_ip6_temp_preferred_lifetime; + u_int32_t cfg_ip6_temp_valid_lifetime; + FUNCPTR cfg_privInitSysctl; + } ND6_CONFIG_PARAMS; + +#ifdef VIRTUAL_STACK +extern VS_REG_ID nd6RegistrationNum; +#endif /* VIRTUAL_STACK */ +extern ND6_CONFIG_PARAMS nd6DefaultConfigParams; + +#if defined(__STDC__) || defined(__cplusplus) +extern STATUS nd6InstInit (void *); +#ifdef VIRTUAL_STACK +extern STATUS nd6Destructor (VSNUM); +#endif + +#else /* __STDC__ */ +extern STATUS nd6InstInit (); +#ifdef VIRTUAL_STACK +extern STATUS nd6Destructor (); +#endif + +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnd6Libh */ diff --git a/h/wrn/coreip/protos/rarpLib.h b/h/wrn/coreip/protos/rarpLib.h new file mode 100644 index 0000000..dc80d46 --- /dev/null +++ b/h/wrn/coreip/protos/rarpLib.h @@ -0,0 +1,67 @@ +/* rarpLib.h - the default configuration parameter structure for RARP */ + +/* Copyright 2002 - 2003 Wind River Systems, Inc. */ +/* +modification history +-------------------- +01e,05nov03,cdw Removal of unnecessary _KERNEL guards. +01d,04nov03,rlm Ran batch header path update for header re-org. +01c,15sep03,vvv updated path for new headers +01b,28aug02,kal fixed location of cfgDefs.h +01a,16jul02,vlk created +*/ + +#ifndef __INCrarpLibh +#define __INCrarpLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include + +/* typedefs */ +typedef struct + { + BOOL ipAddrInitialized; + struct in_addr ipAddr; + END_OBJ *pEndId; + BOOL rarpDebug; + } RARPSTATE; + +typedef struct rarp_config_params { + + CFG_DATA_HDR cfgh; + + RARPSTATE cfg_rarpState; + + } RARP_CONFIG_PARAMS; + +#ifdef VIRTUAL_STACK +extern VS_REG_ID rarpRegistrationNum; +#endif /* VIRTUAL_STACK */ +extern RARP_CONFIG_PARAMS rarpDefaultConfigParams; + +#if defined(__STDC__) || defined(__cplusplus) +extern STATUS rarpInstInit (void *); +#ifdef VIRTUAL_STACK +extern STATUS rarpDestructor (VSNUM); +#endif + +#else /* __STDC__ */ +extern STATUS rarpInstInit (); +#ifdef VIRTUAL_STACK +extern STATUS rarpDestructor (); +#endif + +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif + + +#endif /* !INCrarpLibh */ + diff --git a/h/wrn/coreip/protos/sctpLib.h b/h/wrn/coreip/protos/sctpLib.h new file mode 100644 index 0000000..3a396ff --- /dev/null +++ b/h/wrn/coreip/protos/sctpLib.h @@ -0,0 +1,83 @@ +/* sctpLib.h - configuration data structure for SCTP */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +01a,29jul05,kch written +*/ + +#ifndef __INCsctpLibh +#define __INCsctpLibh + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct sctp_config_params + { + CFG_DATA_HDR cfgh; + + /* definitions from sctp_usrreq.c */ + int cfg_sctp_sendspace; + int cfg_sctp_recvspace; + int cfg_sctp_auto_asconf; + int cfg_sctp_ecn; + int cfg_sctp_ecn_nonce; + int cfg_sctp_strict_sacks; + int cfg_sctp_no_csum_on_loopback; + int cfg_sctp_strict_init; + int cfg_sctp_peer_chunk_oh; + int cfg_sctp_max_burst_default; + unsigned int cfg_sctp_max_chunks_on_queue; + unsigned int cfg_sctp_delayed_sack_time_default; + unsigned int cfg_sctp_heartbeat_interval_default; + unsigned int cfg_sctp_pmtu_raise_time_default; + unsigned int cfg_sctp_shutdown_guard_time_default; + unsigned int cfg_sctp_secret_lifetime_default; + unsigned int cfg_sctp_rto_max_default; + unsigned int cfg_sctp_rto_min_default; + unsigned int cfg_sctp_rto_initial_default; + unsigned int cfg_sctp_init_rto_max_default; + unsigned int cfg_sctp_valid_cookie_life_default; + unsigned int cfg_sctp_init_rtx_max_default; + unsigned int cfg_sctp_assoc_rtx_max_default; + unsigned int cfg_sctp_path_rtx_max_default; + unsigned int cfg_sctp_nr_outgoing_streams_default; + u_int32_t cfg_sctp_debug_on; + + FUNCPTR cfg_privInitSysctl; + } SCTP_CONFIG_PARAMS; + +typedef struct sctp6_config_params + { + CFG_DATA_HDR cfgh; + + FUNCPTR cfg_privInitSysctl; + } SCTP6_CONFIG_PARAMS; + +/* prototypes */ + +IMPORT STATUS sctpInstInit (void *InitValues); +IMPORT STATUS sctpv6InstInit (void *InitValues); + +#ifdef VIRTUAL_STACK +IMPORT STATUS sctpDestructor (int vsNum); +#endif /* VIRTUAL_STACK */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsctpLibh */ diff --git a/h/wrn/coreip/protos/tcpLib.h b/h/wrn/coreip/protos/tcpLib.h new file mode 100644 index 0000000..f607b2e --- /dev/null +++ b/h/wrn/coreip/protos/tcpLib.h @@ -0,0 +1,111 @@ +/* tcpLib.h - VxWorks TCP header file */ + +/* Copyright 2002-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01l,09feb05,wap Allow sysctl init routines to be scaled out +01k,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01j,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01i,20nov03,niq Remove copyright_wrs.h file inclusion +01h,05nov03,cdw Removal of unnecessary _KERNEL guards. +01g,04nov03,rlm Ran batch header path update for header re-org. +01f,15sep03,vvv updated path for new headers +01e,07mar03,spm changed parameters after merge from CLARINET-1_1-KAME-UPDATE +01d,06sep02,ger remove tcp_v6mssdflt from config-params (is in ipv6) +01c,04sep02,kal took out ifdef inclusions of elements for configlettes +01b,28aug02,kal fixed location of cfgDefs.h +01a,18jun02,hgo creation +*/ + +#ifndef __INCtcpLibh +#define __INCtcpLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +typedef struct tcp_config_params + { + CFG_DATA_HDR cfgh; + + /* defined in tcp_input.c */ + + int cfg_priv_tcp_log_in_vain; /* log all incoming TCP connections */ + int cfg_priv_tcp_blackhole; /* do not send RST when dropping + refused connections */ + int cfg_tcp_delack_enabled; /* delay ACK to try and piggyback it + onto the packet */ + + /* + * cfg_priv_drop_synfind was only included ifdef TCP_DROP_SYNFIN but this + * header is used by configlettes which wouldn't have that defined. + */ + + int cfg_priv_drop_synfin; /* drop TCP packets with SYN+FIN set */ + int cfg_tcp_reass_global_max; /* max total number of segments in + all TCP reassembly queues */ + int cfg_tcp_reass_endpt_max; /* max number of segments per + endpoint reassembly queue, or -1 */ + + /* defined in tcp_output.c */ + + int cfg_priv_path_mtu_discovery; /* enable path MTU discovery */ + int cfg_ss_fltsz; /* slow start flight size */ + int cfg_ss_fltsz_local; /* slow start flight size for local + networks */ + int cfg_tcp_do_newreno; /* enable NewReno Algorithms */ + + /* defined in tcp_subr.c */ + + int cfg_tcp_mssdflt; /* default TCP maximum segment size */ + + int cfg_priv_tcp_do_rfc1323; /* enable RFC1323 (high performance) + TCP extensions */ + int cfg_priv_tcp_do_rfc1644; /* enable RFC1644 (TTCP) extensions */ + int cfg_priv_do_tcpdrain; /* enable tcp_drain routine for extra + help when low on mbufs */ + int cfg_priv_icmp_may_rst; /* certain ICMP unreachable message + may abort connections in SYN_SENT */ + int cfg_tcp_isn_reseed_interval; + int cfg_tcp_inflight_enable; /* allow bandwidth limits */ + int cfg_tcp_inflight_debug; /* print inflight values */ + int cfg_tcp_inflight_min; /* minimum inflight window */ + int cfg_tcp_inflight_max; /* maximum inflight window */ + + /* defined in tcp_timer.c */ + + int cfg_tcp_keepinit; + int cfg_tcp_keepidle; + int cfg_tcp_keepintvl; + int cfg_tcp_delacktime; /* time before a delayed ACK is sent */ + int cfg_tcp_msl; /* maximum segment life time */ + int cfg_priv_always_keepalive; /* assume SO_KEEPALIVE on all TCP + connections */ + int cfg_priv_tcp_keepcnt; + + /* defined in tcp_usrreq.c */ + + u_long cfg_tcp_sendspace; /* default send socket buffer size */ + u_long cfg_tcp_recvspace; /* default receive socket buf. size */ + FUNCPTR cfg_privInitSysctl; + + } TCP_CONFIG_PARAMS; + +typedef struct tcp6_config_params + { + CFG_DATA_HDR cfgh; + int cfg_tcp_v6mssdflt; /* One TCP (v6) parameter */ + FUNCPTR cfg_privInitSysctl; + + } TCP6_CONFIG_PARAMS; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtcpLibh */ diff --git a/h/wrn/coreip/protos/udpLib.h b/h/wrn/coreip/protos/udpLib.h new file mode 100644 index 0000000..172db90 --- /dev/null +++ b/h/wrn/coreip/protos/udpLib.h @@ -0,0 +1,52 @@ +/* udpLib.h - VxWorks UDP header file */ + +/* Copyright 2002-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,09feb05,wap Allow sysctl init routines to be scaled out +01g,20nov03,niq Remove copyright_wrs.h file inclusion +01f,05nov03,cdw Removal of unnecessary _KERNEL guards. +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,15sep03,vvv updated path for new headers +01c,21nov02,hgo udpcksum not private anymore +01b,28aug02,kal fixed location of cfgDefs.h +01a,18jun02,hgo creation +*/ + +#ifndef __INCudpLibh +#define __INCudpLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include + +typedef struct udp_config_params { + CFG_DATA_HDR cfgh; + + /* defined in udp_usrreq.c */ + + int cfg_udpcksum; /* UDP protocol implementation. + * Per RFC 768, August, 1980 */ + int cfg_udp_log_in_vain; + int cfg_priv_udp_blackhole; + u_long cfg_udp_sendspace; + u_long cfg_udp_recvspace; + FUNCPTR cfg_privInitSysctl; + } UDP_CONFIG_PARAMS; + + +typedef struct udp6_config_params { + CFG_DATA_HDR cfgh; + FUNCPTR cfg_privInitSysctl; + } UDP6_CONFIG_PARAMS; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCudpLibh */ diff --git a/h/wrn/coreip/proxyArpLib.h b/h/wrn/coreip/proxyArpLib.h new file mode 100644 index 0000000..f523aa7 --- /dev/null +++ b/h/wrn/coreip/proxyArpLib.h @@ -0,0 +1,169 @@ +/* proxyArpLib.h - proxy ARP server include file */ + +/* Copyright 1984 - 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01o,04nov03,rlm Ran batch header path update for header re-org. +01n,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01m,24oct03,cdw update include statements post header re-org. +01l,15sep03,vvv updated path for new headers +01k,27sep02,vlk adjusted includes with _KERNEL switch +01j,31jul02,vlk ported from Synth; added PROXY_ARP_CONFIG_PARAMS +01i,16nov01,rae merged from tor2_x.veloce5, ver 01g, base 01d (minor cleanup) +01h,29mar01,spm merged changes from version 01f of tor2_0.open_stack + branch (wpwr VOB, base 01d) for unified code base +01g,25oct00,ham fixed compilation warnings. +01f,10aug00,spm updated prototypes to remove compiler warnings +01e,10aug00,spm merged proxy ARP updates from tor2_0_x branch +01d,22sep92,rrr added support for c++ +01c,04jul92,jcf cleaned up. +01b,26may92,rrr the tree shuffle + -changed includes to have absolute path from h/ +01a,20sep91,elh written. +*/ + +#ifndef __INCproxyArpLibh +#define __INCproxyArpLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include +#include +#include +#include + +#include +#include +#include +#include + + +/* defines */ + +/* errors */ + +#define S_proxyArpLib_INVALID_PARAMETER (M_proxyArpLib | 1) +#define S_proxyArpLib_INVALID_INTERFACE (M_proxyArpLib | 2) +#define S_proxyArpLib_INVALID_PROXY_NET (M_proxyArpLib | 3) +#define S_proxyArpLib_INVALID_CLIENT (M_proxyArpLib | 4) +#define S_proxyArpLib_INVALID_ADDRESS (M_proxyArpLib | 5) +#define S_proxyArpLib_TIMEOUT (M_proxyArpLib | 6) + + /* proxy message types */ + +#define PROXY_PROBE 0 /* probe */ +#define PROXY_REG 1 /* register */ +#define PROXY_UNREG 2 /* unregister */ +#define PROXY_ACK 50 /* ack */ +#define PROXY_TYPE 0x3000 /* doesn't leave backplane */ + +#define XMIT_MAX 5 +#define XMIT_DELAY 5 + +/* typedefs */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct proxy_net /* proxy network structure */ + { + NODE netNode; /* node for net list */ + struct in_addr proxyAddr; /* proxy interface address */ + struct in_addr mainAddr; /* main interface address */ + LIST clientList; /* list of clients */ + } PROXY_NET; + +typedef struct proxy_clnt /* proxy client structure */ + { + HASH_NODE hashNode; /* hash node */ + struct in_addr ipaddr; /* client ip address (key) */ + u_char hwaddr [6]; /* client hw address */ + PROXY_NET * pNet; /* proxy network information */ + NODE clientNode; /* client node on network list */ + } PROXY_CLNT; + +typedef struct port_node + { + HASH_NODE hashNode; /* hash node */ + int port; /* port number enabled */ + } PORT_NODE; + +typedef struct proxy_msg /* proxy message */ + { + int op; /* operation */ + struct in_addr clientAddr; /* client address */ + struct in_addr serverAddr; /* server ip address */ + u_char clientHwAddr [6]; /* client hw address */ + u_char serverHwAddr [6]; /* server hw address */ + } PROXY_MSG; + +/*the default configuration parameter structure*/ +typedef struct proxy_arp_config_params { + + CFG_DATA_HDR cfgh; + + BOOL cfg_arpDebug; + BOOL cfg_proxyArpVerbose; + BOOL cfg_proxyBroadcastVerbose; + BOOL cfg_proxyBroadcastFwd; + BOOL cfg_arpRegister; + + int cfg_clnt_tbl_sz; + int cfg_port_tbl_sz; + + char * cfg_proxyd_main_addr; + char * cfg_proxyd_proxy_addr; + + } PROXY_ARP_CONFIG_PARAMS; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef VIRTUAL_STACK +extern VS_REG_ID proxyArpRegistrationNum; +#endif /* VIRTUAL_STACK */ +extern PROXY_ARP_CONFIG_PARAMS proxy_arpDefaultConfigParams; + + +#if defined(__STDC__) || defined(__cplusplus) +extern STATUS proxy_arpInstInit (void *); +#ifdef VIRTUAL_STACK +extern STATUS proxy_arpDestructor (VSNUM); +#endif + +extern STATUS proxyArpLibInit (int clientSizeLog2, int portSizeLog2); +extern void proxyPortShow (void); +extern STATUS proxyPortFwdOn (int port); +extern STATUS proxyPortFwdOff (int port); +extern STATUS proxyNetCreate (char * proxyAddr, char * mainAddr); +extern STATUS proxyNetDelete (char * proxyAddr); + +#else /* __STDC__ */ +extern STATUS proxy_arpInstInit (); +#ifdef VIRTUAL_STACK +extern STATUS proxy_arpDestructor (); +#endif + +extern STATUS proxyArpLibInit (); +extern void proxyPortShow (); +extern STATUS proxyPortFwdOn (); +extern STATUS proxyPortFwdOff (); +extern STATUS proxyNetCreate (); +extern STATUS proxyNetDelete (); + +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCproxyArpLibh */ diff --git a/h/wrn/coreip/random.h b/h/wrn/coreip/random.h new file mode 100644 index 0000000..f2c4cbc --- /dev/null +++ b/h/wrn/coreip/random.h @@ -0,0 +1,101 @@ +/* random.h - a strong random number generator */ + +/* Copyright 2001-2004 Wind River Systems, Inc. */ + +/* + * random.h -- A strong random number generator + * + * $FreeBSD: src/sys/sys/random.h,v 1.19.2.1 2000/05/10 02:04:52 obrien Exp $ + * + * Version 0.95, last modified 18-Oct-95 + * + * Copyright Theodore Ts'o, 1994, 1995. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, and the entire permission notice in its entirety, + * including the disclaimer of warranties. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * ALTERNATIVELY, this product may be distributed under the terms of + * the GNU Public License, in which case the provisions of the GPL are + * required INSTEAD OF the above restrictions. (This clause is + * necessary due to a potential bad interaction between the GPL and + * the restrictions contained in a BSD-style copyright.) + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* +modification history +-------------------- +01g,20aug04,dlk Change return type of random() to u_long. +01f,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01e,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01d,20nov03,niq Remove copyright_wrs.h file inclusion +01c,29apr03,syy Added #ifdef for __cplusplus +01b,04oct01,pas added global random seed +01a,26sep01,pas created from FreeBSD4.3-RELEASE(July-17-01). +*/ + +/* + * Many kernel routines will have a use for good random numbers, + * for example, for truely random TCP sequence numbers, which prevent + * certain forms of TCP spoofing attacks. + * + */ + +#ifndef __INCrandomh +#define __INCrandomh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exported functions */ + +void rand_initialize(void); + +#ifdef notused +void get_random_bytes(void *buf, u_int nbytes); +u_int write_random(const char *buf, u_int nbytes); +#endif +u_int read_random(void *buf, u_int size); +u_int read_random_unlimited(void *buf, u_int size); +struct proc; +int random_poll(dev_t dev, int events, struct proc *p); + +/* Clarinet additions: ---------------------------------------------------- */ +/* random seed, fed by checksums */ +extern unsigned long clarinet_random_seed; + +/* replacements for random() and srandom(), found in more modern + * versions (4.2BSD+) of stdlib.h, but not in vxworks + */ +extern u_long random (void); +extern void srandom (unsigned long seed); + +#ifdef __cplusplus +} +#endif + +#endif /* !__INCrandomh */ diff --git a/h/wrn/coreip/rdiscLib.h b/h/wrn/coreip/rdiscLib.h new file mode 100644 index 0000000..8459631 --- /dev/null +++ b/h/wrn/coreip/rdiscLib.h @@ -0,0 +1,77 @@ +/* rdiscLib.h - support for router discovery RFC 1256 */ + +/* Copyright 2000 - 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,13dec02,kal Added rdiscStart() for restarting after rdCtl() stop. +01b,04nov02,kal Ported from Router Stack 1.1 to Accordion stack +01a,29mar01,spm file creation: copied from version 01b of tor2_0.open_stack + branch (wpwr VOB) for unified code base +*/ + +#ifndef __INCrdiscLibh +#define __INCrdiscLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Configuration structure for the initialisation function rdiscInstInit() */ + +/* + * Priority of router discovery task. + * Options to taskSpawn(1) for router discovery task. + * Stack size for router discovery task. + */ + +typedef struct rdisccfgparams + { + CFG_DATA_HDR cfgh ; + int cfg_rdisc_priority; + int cfg_rdisc_options; + int cfg_rdisc_stacksize; + } RDISC_CFG_PARAMS; + + +/* cmd-types for the rdCtl-function */ + +#define SET_ADVERT_LIFETIME 0 +#define SET_MIN_ADVERT_INT 1 +#define SET_MAX_ADVERT_INT 2 +#define SET_MODE 3 +#define SET_FLAG 4 +#define SET_ADVERT_PREF 5 +#define SET_ADVERT_ADDRESS 6 + +#define GET_FLAG 7 +#define GET_ADVERT_LIFETIME 8 +#define GET_ADVERT_PREF 9 +#define GET_ADVERT_ADDRESS 10 +#define GET_MIN_ADVERT_INT 11 +#define GET_MAX_ADVERT_INT 12 + +/* Modes for the rdCtl routine, valid if cmd=SET_MODE. */ +#define MODE_DEBUG_OFF 0 /* Turn debugging off. */ +#define MODE_DEBUG_ON 1 /* Turn debugging on. */ +#define MODE_STOP 2 /* Stop rdisc */ + +#ifdef VIRTUAL_STACK +extern STATUS rdiscLibInit (void); +extern STATUS rdiscDestructor (int vsnum); +#endif + +extern STATUS rdiscInstInit (void *initvalues); +extern void rdisc (); +extern STATUS rdiscIfReset (); +/* value may be an int (set-cmds) or an int* (get-cmds) */ +extern STATUS rdCtl (char *ifName, int cmd, void* value); +/* restart rdisc after it was stopped using rdCtl() */ +extern STATUS rdiscStart (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrdiscLibh */ diff --git a/h/wrn/coreip/remLib.h b/h/wrn/coreip/remLib.h new file mode 100644 index 0000000..a80713e --- /dev/null +++ b/h/wrn/coreip/remLib.h @@ -0,0 +1,114 @@ +/* remLib.h - structures for remLib.c */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +01b,24jun05,vvv added rcmd_af() +01a,22feb05,wap Allow sysctl init routines to be scaled out +o1g,23feb04,kkz added new functions for user-space +01f,04nov03,rlm Ran batch header path update for header re-org. +01e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01d,24oct03,cdw update include statements post header re-org. +01c,09may03,vvv included socket.h +01b,10jun02,ann forward declarations for rresvportCommon() and + bindresvportCommon() +01a,06mar02,ann ported to clarinet from AE1.1 ver 02d +*/ + +#ifndef __INCremLibh +#define __INCremLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#define MAX_IDENTITY_LEN 100 +#define MIN_RESV_PORT 512 +#define MAX_RESV_PORT 1023 + +/* status messages */ + +#define S_remLib_ALL_PORTS_IN_USE (M_remLib | 1) +#define S_remLib_RSH_ERROR (M_remLib | 2) +#define S_remLib_IDENTITY_TOO_BIG (M_remLib | 3) +#define S_remLib_RSH_STDERR_SETUP_FAILED (M_remLib | 4) +#define S_remLib_RCMD_INPUT_ERROR (M_remLib | 5) + +/* variable declarations */ + +extern int remLastResvPort; /* last port num used (from bootroms) */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) +extern void remLibInit (long timeout); +extern void remLibSysctlInit(void); +extern STATUS bindresvport (int sd, struct sockaddr_in *sin); +extern STATUS bindresvport_af (int sd, struct sockaddr *sin, int family); +extern int rcmd (char *host, int remotePort, char *localUser, + char *remoteUser, char *cmd, int *fd2p); +extern int rcmd_af (char *host, int remotePort, char *localUser, + char *remoteUser, char *cmd, int *fd2p, int family); +extern int rresvport (int *alport); +extern int rresvport_af (int *alport, int family); +extern void remCurIdGet (char *user, char *passwd); + +#ifdef _WRS_KERNEL +extern STATUS remCurIdSet (char *newUser, char *newPasswd); +extern STATUS iam (char *newUser, char *newPasswd); +extern void whoami (void); +#else +extern STATUS setlogin (char * login); +extern STATUS getlogin_r (char * login, size_t length); +extern STATUS setpassword(char * passwd); +extern STATUS getpassword_r(char * passwd, size_t length); +#endif + +/* deprecated functions - use rresvport_af and bindresvport_af instead */ +extern int rresvportCommon (int *alport, int family); +extern STATUS bindresvportCommon (int sd, struct sockaddr *sin, int family); +#else /* __STDC__ */ + +extern void remLibInit (); +extern void remLibSysctlInit(); +extern STATUS bindresvport (); +extern STATUS bindresvport_af (); +extern int rcmd (); +extern int rresvport (); +extern int rresvport_af (); +extern void remCurIdGet (); + +#ifdef _WRS_KERNEL +extern STATUS remCurIdSet (); +extern STATUS iam (); +extern void whoami (); +#else +extern STATUS setlogin (); +extern STATUS getlogin_r (); +extern STATUS setpassword (); +extern STATUS getpassword_r (); +#endif + +/* deprecated functions - use rresvport_af and bindresvport_af instead */ +extern STATUS bindresvportCommon (); +extern int rresvportCommon (); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCremLibh */ diff --git a/h/wrn/coreip/resolv/nameser.h b/h/wrn/coreip/resolv/nameser.h new file mode 100644 index 0000000..2df4800 --- /dev/null +++ b/h/wrn/coreip/resolv/nameser.h @@ -0,0 +1,300 @@ +/* nameser.h - Domain Name Server protocol header file */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* $NetBSD: nameser.h,v 1.7 1994/10/26 00:56:45 cgd Exp $ */ + +/* + * Copyright (c) 1983, 1989 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)nameser.h 5.25 (Berkeley) 4/3/91 + */ + +/* +modification history +-------------------- +01n,14jan05,vvv osdep.h cleanup +01m,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01l,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01k,20nov03,niq Remove copyright_wrs.h file inclusion +01j,05nov03,cdw Removal of unnecessary _KERNEL guards. +01i,04nov03,rlm Ran batch header path update for header re-org. +01h,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01g,06aug03,nee Accordion Base6 merge from ACCORDION_BASE6_MERGE_BASELINE + label +01f,10jun03,vvv include netVersion.h +01e,01aug02,hsh add diab support for ppc +01d,19sep01,vlk Added the definitions of type values for resources and queries, + added the definitions HFIXEDSZ and NS_MAXCDNAME +01c,29apr97,jag Changed T_NULL to T_NULL_RR to fix conflict with loadCoffLib.h +01b,02apr97,jag Change types from u_int*_t to uint*_t. +01a,11dec96,jag created from BSD4.4. Corrected bitfields to meet ANSI spec. + changed STATUS to DNS_STATUS. +*/ + +#ifndef __INCnameserh +#define __INCnameserh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * Define constants based on rfc883 + */ +#define PACKETSZ 512 /* maximum packet size */ +#define MAXDNAME 256 /* maximum domain name */ +#define MAXCDNAME 255 /* maximum compressed domain name */ +#define HFIXEDSZ 12 /* bytes of fixed data in header */ + +#define NS_MAXCDNAME 255 /* maximum domain name */ +#define NS_INADDRSZ 4 /* IPv4 T_A */ +#define NS_IN6ADDRSZ 16 /* IPv6 T_AAAA */ +#define NS_INT16SZ 2 /* bytes of data in a uint16_t */ +#define NS_INT32SZ 4 /* bytes of data in a uint32_t */ +#define MAXLABEL 63 /* maximum length of domain label */ +/* Number of bytes of fixed size data in query structure */ +#define QFIXEDSZ 4 +/* number of bytes of fixed size data in resource record */ +#define RRFIXEDSZ 10 +/* + * Internet nameserver port number + */ +#define NAMESERVER_PORT 53 +/* + * Currently defined opcodes + */ +#define QUERY 0x0 /* standard query */ +#define IQUERY 0x1 /* inverse query */ +#define DNS_STATUS 0x2 /* nameserver status query*/ +/* #define xxx 0x3 0x3 reserved */ + +/* non standard */ +#define UPDATEA 0x9 /* add resource record */ +#define UPDATED 0xa /* delete a specific resource record */ +#define UPDATEDA 0xb /* delete all named resource record */ +#define UPDATEM 0xc /* modify a specific resource record */ +#define UPDATEMA 0xd /* modify all named resource record */ + +#define ZONEINIT 0xe /* initial zone transfer */ +#define ZONEREF 0xf /* incremental zone referesh */ +/* + * Currently defined response codes + */ +#define NOERROR 0 /* no error */ +#define FORMERR 1 /* format error */ +#define SERVFAIL 2 /* server failure */ +#define NXDOMAIN 3 /* non existent domain */ +#define NOTIMP 4 /* not implemented */ +#define REFUSED 5 /* query refused */ +/* non standard */ +#define NOCHANGE 0xf /* update failed to change db */ +/* + * Type values for resources and queries + */ +#define T_A 1 /* host address */ +#define T_NS 2 /* authoritative server */ +#define T_MD 3 /* mail destination */ +#define T_MF 4 /* mail forwarder */ +#define T_CNAME 5 /* connonical name */ +#define T_SOA 6 /* start of authority zone */ +#define T_MB 7 /* mailbox domain name */ +#define T_MG 8 /* mail group member */ +#define T_MR 9 /* mail rename name */ +#define T_NULL_RR 10 /* null resource record */ +#define T_WKS 11 /* well known service */ +#define T_PTR 12 /* domain name pointer */ +#define T_HINFO 13 /* host information */ +#define T_MINFO 14 /* mailbox information */ +#define T_MX 15 /* mail routing information */ +#define T_TXT 16 /* text strings */ +#define T_RP 17 /* responsible person */ +#define T_AFSDB 18 /* AFS cell database */ +#define T_X25 19 /* X25 address */ +#define T_ISDN 20 /* ISDN address */ +#define T_RT 21 /* router */ +#define T_NSAP 22 /* NSAP address */ +#define T_NSAP_PTR 23 /* reverse lookup for NSAP */ +#define T_SIG 24 /* Security signature */ +#define T_KEY 25 /* Security key */ +#define T_PX 26 /* X 400 mail mapping information */ +#define T_GPOS 27 /* geographical position (withdrawn) */ +#define T_AAAA 28 /* IPv6 host address */ +#define T_LOC 29 /* location information */ +#define T_NXT 30 /* next valid name (next domain) */ +#define T_EID 31 /* endpoint identifier (unimplemented) */ +#define T_NIMLOC 32 /* NIMROD locator */ +#define T_SRV 33 /* server selection */ +#define T_ATMA 34 /* ATM address */ +#define T_NAPTR 35 /* URN Naming authority pointer */ +/* non standard */ +#define T_UINFO 100 /* user (finger) information */ +#define T_UID 101 /* user ID */ +#define T_GID 102 /* group ID */ +#define T_UNSPEC 103 /* Unspecified format (binary data) */ +#define T_SA 200 /* shuffle address */ +/* Query type values which do not appear in resource records */ +#define T_IXFR 251 /* incremental zone transfer */ +#define T_AXFR 252 /* transfer zone of authority */ +#define T_MAILB 253 /* transfer mailbox records */ +#define T_MAILA 254 /* transfer mail agent records */ +#define T_ANY 255 /* wildcard match */ +/* + * Values for class field + */ +#define C_IN 1 /* the arpa internet */ +#define C_CHAOS 3 /* for chaos net at MIT */ +#define C_HS 4 /* for Hesiod name server at MIT */ + /* Query class values which do not appear in resource records */ +#define C_ANY 255 /* wildcard match */ +/* + * Status return codes for T_UNSPEC conversion routines + */ +#define CONV_SUCCESS 0 +#define CONV_OVERFLOW -1 +#define CONV_BADFMT -2 +#define CONV_BADCKSUM -3 +#define CONV_BADBUFLEN -4 +/* + * Structure for query header, the order of the fields is machine and + * compiler dependent, in our case, the bits within a byte are assignd + * least significant first, while the order of transmition is most + * significant first. This requires a somewhat confusing rearrangement. + */ + typedef struct + { + u_int id:16; /* fields (Bytes 1-2) query identification number */ +#if _BYTE_ORDER == _BIG_ENDIAN + /* fields in third byte */ + u_int qr:1, /* response flag */ + opcode:4, /* purpose of message */ + aa:1, /* authoritive answer */ + tc:1, /* truncated message */ + rd:1, /* recursion desired */ + /* fields in fourth byte */ + ra:1, /* recursion available */ + pr:1, /* primary server required (non standard) */ + /*unused:0,*/ /* unused bits */ + ad:1, /* authentic data from named */ + cd:1, /* checking disabled by resolver */ + rcode:4; /* response code */ +#endif +#if _BYTE_ORDER == _LITTLE_ENDIAN + /* fields in third byte */ + u_int rd:1, /* recursion desired */ + tc:1, /* truncated message */ + aa:1, /* authoritive answer */ + opcode:4, /* purpose of message */ + qr:1, /* response flag */ + /* fields in fourth byte */ + rcode:4, /* response code */ + cd:1, /* authentic data from named */ + ad:1, /* checking disabled by resolver */ + /*unused:0,*/ /* unused bits */ + pr:1, /* primary server required (non standard) */ + ra:1; /* recursion available */ +#endif + /* remaining bytes */ + u_short qdcount; /* number of question entries */ + u_short ancount; /* number of answer entries */ + u_short nscount; /* number of authority entries */ + u_short arcount; /* number of resource entries */ + + } HEADER; +/* + * Defines for handling compressed domain names + */ +#define INDIR_MASK 0xc0 +/* + * Structure for passing resource records around. + */ + struct rrec + { + int16_t r_zone; /* zone number */ + int16_t r_class; /* class number */ + int16_t r_type; /* type number */ + uint32_t r_ttl; /* time to live */ + int r_size; /* size of data area */ + char *r_data; /* pointer to data */ + }; +IMPORT uint16_t _getshort(register const u_char *); +IMPORT uint32_t _getlong(register const u_char *); +/* + * Inline versions of get/put short/long. + * Pointer is advanced; we assume that both arguments + * are lvalues and will already be in registers. + * cp MUST be u_char *. + */ +#define GETSHORT(s, cp) { \ + register u_char *t_cp = (u_char *)(cp); \ + (s) = ((uint16_t)t_cp[0] << 8) \ + | ((uint16_t)t_cp[1]) ;\ + (cp) += sizeof(uint16_t); \ +} + +#define GETLONG(l, cp) { \ + register u_char *t_cp = (u_char *)(cp); \ + (l) = ((uint32_t)t_cp[0] << 24) \ + | ((uint32_t)t_cp[1] << 16) \ + | ((uint32_t)t_cp[2] << 8) \ + | ((uint32_t)t_cp[3]) ;\ + (cp) += sizeof(uint32_t); \ +} + +#define PUTSHORT(s, cp) { \ + register uint16_t t_s = (uint16_t)(s); \ + register u_char *t_cp = (u_char *)(cp); \ + *t_cp++ = t_s >> 8; \ + *t_cp = t_s; \ + (cp) += sizeof(uint16_t); \ +} +/* + * Warning: PUTLONG --no-longer-- destroys its first argument. + * if you were depending on this "feature", you will lose. + */ +#define PUTLONG(l, cp) { \ + register uint32_t t_l = (uint32_t)(l); \ + register u_char *t_cp = (u_char *)(cp); \ + *t_cp++ = t_l >> 24; \ + *t_cp++ = t_l >> 16; \ + *t_cp++ = t_l >> 8; \ + *t_cp = t_l; \ + (cp) += sizeof(uint32_t); \ +} +#ifdef __cplusplus +} +#endif + +#endif /* __INCnameserh */ diff --git a/h/wrn/coreip/resolv/resolv.h b/h/wrn/coreip/resolv/resolv.h new file mode 100644 index 0000000..4c44210 --- /dev/null +++ b/h/wrn/coreip/resolv/resolv.h @@ -0,0 +1,284 @@ +/* resolv.h - resolver internal data structures header file */ + +/* Copyright 1996 - 2004 Wind River Systems, Inc. */ + +/* $NetBSD: resolv.h,v 1.8 1994/10/26 00:56:16 cgd Exp $ */ +/* + * Copyright (c) 1983, 1987, 1989 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)resolv.h 5.15 (Berkeley) 4/3/91 + */ + +/* +modification history +-------------------- +01m,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01l,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/2) +01k,15mar04,rp merged from orion +01j,09feb04,xli add header to the include for base6 itn4 changes +01i,20nov03,niq Remove copyright_wrs.h file inclusion +01h,05nov03,cdw Removal of unnecessary _KERNEL guards. +01g,04nov03,rlm Ran batch header path update for header re-org. +01f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01e,06aug03,nee Accordion Base6 merge from ACCORDION_BASE6_MERGE_BASELINE + label +01d,21aug02,vlk Added second param into __p_time() function +01c,20sep01,vlk Added structure "__res_state_ext" and the declaration of routines: + resSearch(), resSearchN(), resolvQueryN(), res_dnok(), res_hnok() +01b,02apr97,jag Change types from u_int*_t to uint*_t. Added C++ and function + prototypes. +01a,11dec96,jag created from BSD4.4 release. Deleted constants that are not + used by vxWorks. Changed bit fields to meet ANSI specs. +*/ +#ifndef __INCresolvh +#define __INCresolvh + +#ifdef _WRS_KERNEL +#include +#endif +#include +#include +#include +#include + +#ifdef INET6 +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif +/* + * revision information. this is the release date in YYYYMMDD format. + * it can change every day so the right thing to do with it is use it + * in preprocessor commands such as "#if (__RES > 19931104)". do not + * compare for equality; rather, use it to determine whether your resolver + * is new enough to contain a certain feature. + */ +#define __RES 20040310 +/* + * Global defines and variables for resolver stub. + */ +#define MAXNS 3 /* max # name servers we'll track */ +#define MAXDFLSRCH 3 /* # default domain levels to try */ +#define MAXDNSRCH 6 /* max # domains in search path */ +#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */ +#define MAXDNSLUS 4 /* max # of host lookup types */ + +#define RES_TIMEOUT 5 /* min. seconds between retries */ +#define MAXRESOLVSORT 10 /* number of net to sort on */ +#define RES_MAXNDOTS 15 /* should reflect bit field size */ + + struct __res_state + { + int retrans; /* retransmition time interval */ + int retry; /* number of times to retransmit */ + long options; /* option flags - see below. */ + int nscount; /* number of name servers */ + struct sockaddr_in nsaddr_list[MAXNS]; /* address of name server */ +#define nsaddr nsaddr_list[0] /* for backward compatibility */ + u_short id; /* current packet id */ + char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ + char defdname[MAXDNAME]; /* default domain */ + long pfcode; /* RES_PRF_ flags - see below. */ + u_int ndots:4, /* threshold for initial abs. query */ + nsort:4, /* number of elements in sort_list[] */ + :0; /* ANSI padding field */ + struct + { + struct in_addr addr; + uint32_t mask; + } sort_list[MAXRESOLVSORT]; + char lookups[MAXDNSLUS]; + }; + + +/**********************from KAME *************************************/ +/* for INET6 */ +/* + * replacement of __res_state, separated to keep binary compatibility. + */ +#ifdef INET6 + struct __res_state_ext + { + + struct sockaddr_storage nsaddr_list[MAXNS]; + + struct + { + + int af; /* address family for addr, mask */ + + union + { + + struct in_addr ina; + + struct in6_addr in6a; + + } addr, mask; + + } sort_list[MAXRESOLVSORT]; + + }; +#endif /* INET6 */ +/* + * Resolver options + */ +#define RES_INIT 0x0001 /* address initialized */ +#define RES_DEBUG 0x0002 /* print debug messages */ +#define RES_AAONLY 0x0004 /* authoritative answers only */ +#define RES_USEVC 0x0008 /* use virtual circuit */ +#define RES_PRIMARY 0x0010 /* query primary server only */ +#define RES_IGNTC 0x0020 /* ignore trucation errors */ +#define RES_RECURSE 0x0040 /* recursion desired */ +#define RES_DEFNAMES 0x0080 /* use default domain name */ +#define RES_STAYOPEN 0x0100 /* Keep TCP socket open */ +#define RES_DNSRCH 0x0200 /* search up local domain tree */ +#define RES_INSECURE1 0x00000400 /* type 1 security disabled */ +#define RES_INSECURE2 0x00000800 /* type 2 security disabled */ +#define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */ +#define RES_USE_INET6 0x00002000 /* use/map IPv6 in gethostbyname() */ +#define RES_NOTLDQUERY 0x00004000 /* Don't query TLD names */ + +#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH) +/* + * Resolver "pfcode" values. Used by dig. + */ +#define RES_PRF_STATS 0x0001 +/* 0x0002 */ +#define RES_PRF_CLASS 0x0004 +#define RES_PRF_CMD 0x0008 +#define RES_PRF_QUES 0x0010 +#define RES_PRF_ANS 0x0020 +#define RES_PRF_AUTH 0x0040 +#define RES_PRF_ADD 0x0080 +#define RES_PRF_HEAD1 0x0100 +#define RES_PRF_HEAD2 0x0200 +#define RES_PRF_TTLID 0x0400 +#define RES_PRF_HEADX 0x0800 +#define RES_PRF_QUERY 0x1000 +#define RES_PRF_REPLY 0x2000 +#define RES_PRF_INIT 0x4000 +/* 0x8000 */ + + struct res_sym + { + int number; /* Identifying number, like T_MX */ + char * name; /* Its symbolic name, like "MX" */ + char * humanname; /* Its fun name, like "mail exchanger" */ + }; + + +/* this shouldn't be used by normal users */ + struct res_target + { + struct res_target *next; + const char *name; /* domain name */ + int qclass, qtype; /* class and type of query */ + u_char *answer; /* buffer to put answer */ + int anslen; /* size of answer buffer */ + int n; /* result length */ + }; + + IMPORT struct __res_state _res; + +/**************************from KAME***************************/ +/* for INET6 */ +#ifdef INET6 + struct __res_state_ext _res_ext; + + IMPORT const struct res_sym __p_class_syms[]; + IMPORT const struct res_sym __p_type_syms[]; +#endif +/***************************************************************/ + +/* Private routines shared between libc/net, named, nslookup and others. +#define res_hnok __res_hnok +#define res_ownok __res_ownok +#define res_mailok __res_mailok +#define res_dnok __res_dnok +#define sym_ston __sym_ston +#define sym_ntos __sym_ntos +#define sym_ntop __sym_ntop */ +#define dn_skipname __dn_skipname +#define fp_query __fp_query +#define hostalias __hostalias +#define putlong __putlong +#define putshort __putshort +#define p_class __p_class +#define p_time __p_time +#define p_type __p_type + +#if defined(__STDC__) || defined(__cplusplus) + +#define __P(protos) protos /* Use ANSI C proto for resolver */ + +#else /* __STDC__ */ + +#define __P(protos) + +#endif /* __STDC__ */ + +#ifdef _WRS_KERNEL + + int __dn_skipname __P((const u_char *, const u_char *)); + void __fp_query __P((const u_char *, FILE *)); + char *__hostalias __P((const char *)); + void __putlong __P((register uint32_t, u_char *)); + void __putshort __P((register uint16_t, u_char *)); + uint32_t _getlong __P((register const u_char *)); + const char *__p_class __P((int)); + const char *__p_time __P((uint32_t,char[])); + const char *__p_type __P((int)); + + int resolvQuery __P((char *, int, int, u_char *, int)); + int resSearch __P((const char *, int, int, u_char *, int)); + int resolvMkQuery __P((int, const char *, int, int, const char *, int, + const char *, char *, int)); + int resolvQueryN __P((const char *,struct res_target *)); + int resSearchN __P((const char *,struct res_target *)); + int resolvSend __P((const char *, int, char *, int)); + int res_dnok __P((const char *)); + +#endif /* _WRS_KERNEL */ + + uint16_t _getshort __P((register const u_char *)); + uint16_t res_getshort __P((register const u_char *)); + int res_hnok __P((const char *)); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCresolvh */ diff --git a/h/wrn/coreip/resolvLib.h b/h/wrn/coreip/resolvLib.h new file mode 100644 index 0000000..3038fc4 --- /dev/null +++ b/h/wrn/coreip/resolvLib.h @@ -0,0 +1,189 @@ +/* resolvLib.h - VxWorks DNS resolver facilities */ + +/* + * Copyright (c) 1996-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01r,10may05,vvv updated MAXPACKET definition +01q,21mar05,ijm corrected MAXIPADDRLEN for IPv6, SPR#106912 +01p,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01o,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/2) +01n,25feb04,xli add resolvInit prototype for non__STDC__ compilation +01m,28jan04,xli add the resolvInit() function for user land which is different + from the resolvInit(char* , char*, FUNCPTR) in kernel +01l,20nov03,niq Remove copyright_wrs.h file inclusion +01k,05nov03,cdw Removal of unnecessary _KERNEL guards. +01j,04nov03,rlm Ran batch header path update for header re-org. +01i,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01h,24oct03,cdw update include statements post header re-org. +01g,15sep03,vvv updated path for new headers +01f,06aug03,nee Accordion Base6 merge from ACCORDION_BASE6_MERGE_BASELINE + label +01e,15may03,spm Tornado 2.2 FCS merge (SPR #67238; ver 01e12oct01,rae: + TOR2_2-FCS-COPY label, tor2 branch, /wind/river VOB) +01d,20sep01,vlk removed declaration of routines: resolvQuery(), resMkQuery(), resSend() +01c,19may97,spm added S_resolvLib_INVALID_PARAMETER error value (SPR #8603), + corrected format of modification history +01b,02apr97,jag removed reference to header file resolv/param.h. +01a,29jul96,rjc written. +*/ +#ifndef __INCresolvLibh +#define __INCresolvLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef VIRTUAL_STACK +#include +#endif + +/* + * name server address length. For IPv6, it must be large enough to + * accomodate link layer address plus the interface name and unit number. + */ + +#ifdef INET6 +#define MAXIPADDRLEN 64 /* INET6_ADDR_LEN+%+IFNAMESIZE+unit*/ +#else +#define MAXIPADDRLEN 20 /* assuming decimal dot notation */ +#endif + +#define MAXALIASES 20 +#define MAXADDRS 20 + +#define QUERY_LOCAL_FIRST 1 /* Query static host table first */ +#define QUERY_DNS_FIRST 2 /* Query DNS first */ +#define QUERY_DNS_ONLY 3 /* Query DNS only */ + +#define S_resolvLib_NO_RECOVERY (M_resolvLib | 1) +#define S_resolvLib_TRY_AGAIN (M_resolvLib | 2) +#define S_resolvLib_HOST_NOT_FOUND (M_resolvLib | 3) +#define S_resolvLib_NO_DATA (M_resolvLib | 4) +#define S_resolvLib_BUFFER_2_SMALL (M_resolvLib | 5) +#define S_resolvLib_INVALID_PARAMETER (M_resolvLib | 6) +#define S_resolvLib_INVALID_ADDRESS (M_resolvLib | 7) + +#define MAXPACKET (64 * 1024) + +/* Resolver parameter configuration structures */ + +#ifdef _WRS_KERNEL + + typedef struct + { + /* order in which to query hostLib database and DNS */ + char queryOrder; + /* maximum domain name based on rfc883 */ + char domainName [MAXDNAME]; + /* IP address of name servers */ + char nameServersAddr [MAXNS][MAXIPADDRLEN]; + + } RESOLV_PARAMS_S; + +/* The default configuration parameter structure */ + typedef struct dns_config_params + { + + CFG_DATA_HDR cfgh; + + /* Resolver state settings structure */ + struct __res_state cfg_res; + + /* params from resolvInit() function */ + char * cfg_pNameServer; + char * cfg_pDefaultDomainName; + BOOL cfg_debugFlag; + + } DNS_CONFIG_PARAMS; + + +#ifdef VIRTUAL_STACK + IMPORT VS_REG_ID dnsRegistrationNum; +#endif /* VIRTUAL_STACK */ + + IMPORT DNS_CONFIG_PARAMS dnsDefaultConfigParams; + +#endif /* _WRS_KERNEL */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + + IMPORT STATUS dnsInstInit (void *); +#ifdef VIRTUAL_STACK + IMPORT STATUS dnsDestructor (VSNUM); +#endif + +#ifndef __P /* SIE:: workaround for TSR154508 */ +#define __P(protos) protos /* Use ANSI C proto for resolver */ +#endif /* SIE:: workaround for TSR154508 */ + +#ifdef _WRS_KERNEL + STATUS resolvInit (char *, char *, FUNCPTR); +#else + STATUS resolvInit(); +#endif + +#ifdef _WRS_KERNEL + struct hostent * resolvGetHostByName (char *, char *, int); + struct hostent * resolvGetHostByAddr (const char *, char *, int); + struct hostent * resolvGetHostByAnyAddr (const char *, char *, int); + STATUS resolvParamsSet (RESOLV_PARAMS_S *); + void resolvParamsGet (RESOLV_PARAMS_S *); +#endif + + int resolvDNExpand (const u_char *, const u_char *, + const u_char *, u_char *, int); + int resolvDNComp (const u_char *, u_char *, int, u_char **, + u_char **); + +#else /* __STDC__ */ + + STATUS resolvInit(); + IMPORT STATUS dnsInstInit (); +#ifdef VIRTUAL_STACK + IMPORT STATUS dnsDestructor (); +#endif + +#define __P(protos) + +#ifdef _WRS_KERNEL + struct hostent * resolvGetHostByName (); + struct hostent * resolvGetHostByAddr (); + struct hostent * resolvGetHostByAnyAddr (); + void resolvParamsSet (); + void resolvParamsGet (); +#endif + + int resolvDNExpand (); + int resolvDNComp (); + +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif + + +#endif /* __INCresolvLibh */ diff --git a/h/wrn/coreip/rip/defs.h b/h/wrn/coreip/rip/defs.h new file mode 100644 index 0000000..c3fc9dc --- /dev/null +++ b/h/wrn/coreip/rip/defs.h @@ -0,0 +1,242 @@ +/* defs.h - common definitions for routed/rip */ + +/* Copyright 1984 - 2004 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1983, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)defs.h 8.2 (Berkeley) 4/28/95 + */ + +/* +modification history +-------------------- +01z,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01y,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5-int/1) +01x,17mar04,spm merged from Orion for MSP 3.0 baseline. +01w,09feb04,niq Add storage for the routing socket message member +01v,06dec03,niq Merge from base6_itn3_networking-dev.al branch +01u,04nov03,rlm Ran batch header path update for header re-org. +01t,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01s,23oct03,rlm updated #includes for header re-org +01r,19aug03,vvv temporarily commenting out some macro definitions +01q,11jun03,ppp fixed spr # 88660 +01p,01may03,spm Tornado 2.2 CP1 merge (from ver 01o,13jan03,rae: + TOR2_2-CP1-F label, tor2_2-patch branch, /wind/river VOB) +01o,10sep02,hsh add c++ protection +01n,27feb02,hgo moved sockaddr_rt, RT_PROTO_GET/SET, TOS_GET/SET from in.h +01m,27nov01,hgo modifications for dual-stack +01l,27jul01,spm removed unused handle (WRN 1012 design, sec. 2.2.3) +01k,10jul01,niq Changes for the Routing socket messages +01j,16mar99,spm recovered orphaned code from tor1_0_1.sens1_1 (SPR #25770) +01i,05oct98,spm made task parameters adjustable (SPR #22422) +01h,11sep98,spm added support for expanded ripShutdown routine and provided + broader access to mutual exclusion semaphore to prevent + collisions between RIP tasks (SPR #22352); removed references + to bloated trace commands (SPR #22350); corrected value + of MIN_WAITTIME (SPR #22360) +01g,26jun98,spm changed prototypes to remove compiler warnings; added + prototype for ripClearInterfaces; changed RIP_MCAST_ADDR + constant from string to value +01f,06oct97,gnn added function prototypes and removed ripState +01e,17apr97,gnn changed the MIB-II variables to follow coding conventions. +01d,07apr97,gnn cleared up some of the more egregious warnings. + added MIB-II interfaces and options. +01c,12mar97,gnn added multicast support + added timer variables +01b,24feb97,gnn changed some variable names, added some fields to global + structure + changed location of netdb.h +01a,26nov96,gnn created from BSD4.4 routed +*/ + +#ifndef __INCdefsh +#define __INCdefsh + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Internal data structure definitions for + * user routing process. Based on Xerox NS + * protocol specs with mods relevant to more + * general addressing scheme. + */ + +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + + +#define equal(a1, a2) \ + (memcmp((a1), (a2), sizeof (struct sockaddr)) == 0) + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +#define S_ADDR(x) (((struct sockaddr_in *)(x))->sin_addr.s_addr) +#define INFO_DST(I) ((I)->rti_info[RTAX_DST]) +#define INFO_GATE(I) ((I)->rti_info[RTAX_GATEWAY]) +#define INFO_MASK(I) ((I)->rti_info[RTAX_NETMASK]) +#define INFO_IFA(I) ((I)->rti_info[RTAX_IFA]) +#define INFO_IFP(I) ((I)->rti_info[RTAX_IFP]) +#define INFO_AUTHOR(I) ((I)->rti_info[RTAX_AUTHOR]) +#define INFO_BRD(I) ((I)->rti_info[RTAX_BRD]) + +/* + * This global structure holds what used to be all the global + * variables in the rip program. + */ + +#if 1 /* accordion -> moved from ripLib.h because of hen/egg problem with rip_globals */ +#define MAXPACKETSIZE 512 /* max broadcast size */ +#endif + +typedef struct rip_globals + { + int version; /* What RIP version are we running? */ + struct sockaddr_in addr; /* address of daemon's socket */ + + int s; /* source and sink of all data */ + int routeSocket; /* source for routing messages */ + + int ripTaskId; /* Identifier for primary RIP task. */ + int ripTimerTaskId; /* Identifier for RIP timer task. */ + + int supplier; /* process should supply updates */ + BOOL lookforinterfaces; /* if 1 probe kernel for new 'up' */ + /* interfaces */ + int externalinterfaces; /* # of remote and local interfaces */ + int gateway; /* Are we a gateway? */ + BOOL multicast; /* Are we using multicast? */ + struct timeval now; /* current idea of time */ + struct timeval then; /* previous idea of time */ + struct timeval lastbcast; /* last time all/changes broadcast */ + struct timeval lastfullupdate; /* last time full table broadcast */ + struct timeval nextFullUpdate; /* Next time full table broadcast */ + struct timeval nextbcast; /* time to wait before changes */ + /* broadcast */ + int needupdate; /*true if we need update at nextbcast*/ + int timerRate; /* How often does the timer go off */ + int supplyInterval; /* How often do we supply routes? */ + int expire; /* How long until we expire a route? */ + int garbage; /* When is a route really thrown out?*/ + char packet[MAXPACKETSIZE+1];/* Storage for RIP update packet */ + struct rip_pkt *msg; /* Set to point to packet above */ + int port; /* RIP protocol port number: 520 */ + FUNCPTR pRouteHook; /* Route propagation hook */ + struct rt_msghdr * pRtmMsg; /* Ptr. to the routing socket message*/ + + /* + * Variables to store MIB-II data. + */ + + M2_RIP2_GLOBAL_GROUP ripGlobal; + + /* + * The ripConf element contains configuration settings + * copied for all available interfaces during initialization. + * Because the configuration may be changed on an interface-specific + * basis, this structure should not be consulted for the + * actual values after routedIfInit() has been called. + */ + + M2_RIP2_IFCONF_ENTRY ripConf; + } RIP; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +IMPORT SEM_ID ripLockSem; + +/* This is the global structure used by the routing daemon. */ + +struct in_addr inet_makeaddr(); +int inet_maskof(); +int sndmsg(); +STATUS supply(); +int cleanup(); + +int rtioctl(); +struct rt_entry * rtadd(struct sockaddr *dst, struct sockaddr *gate, int metric, + int state, struct sockaddr *netmask, int proto, + int tag, struct interface *ifp); +STATUS rtchange(struct rt_entry *rt, struct sockaddr *gate, short metric, + struct sockaddr *netmask, int tag, struct interface *ifp); +STATUS rtdelete(struct rt_entry *rt); + +void toall (int (*)(), int, struct interface *); + +void ripRouteToAddrs (struct rt_entry* pRoute, + struct sockaddr_in** ppDsin, + struct sockaddr_in** ppGsin, + struct sockaddr_in** ppNsin); +void ifRouteAdd (struct sockaddr * pAddr, int refCnt, int subnetsCnt, + BOOL internalFlag, u_long subnetMask); +void ripBuildPacket (RIP2PKT *, struct rt_entry*, struct interface *, int); +void ripSetInterfaces(INT32 sock, UINT32 mcastAddr); +void ripClearInterfaces(INT32 sock, UINT32 mcastAddr); +STATUS ripRequestSend (u_short ifIndex, struct sockaddr *pIfAddr); + +/* Defines created in the port to VxWorks. */ + +#define RIP_PORT 520 +#define NSEC_MAX 1000000000 +#define RIP_TASK "tRipTask" +#define RIP_TIMER "tRipTimerTask" +#define RIP_MAX_PACKET 512 /* The maximum packet size. */ +#define RIP_MIN_PACKET 24 /* A packet with 1 entry. */ + +#define RIP_MCAST_ADDR 0xe0000009 /* RIP group address is 224.0.0.9 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdefsh */ diff --git a/h/wrn/coreip/rip/interface.h b/h/wrn/coreip/rip/interface.h new file mode 100644 index 0000000..72d86c5 --- /dev/null +++ b/h/wrn/coreip/rip/interface.h @@ -0,0 +1,174 @@ +/* interface.h - common definitions for RIP interface routines */ + +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)interface.h 8.1 (Berkeley) 6/5/93 + */ + +/* +modification history +-------------------- +01p,05nov03,cdw Removal of unnecessary _KERNEL guards. +01o,04nov03,rlm Ran batch header path update for header re-org. +01n,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01m,01may03,spm Tornado 2.2 CP1 merge (from ver 01k,28apr02,rae: + TOR2_2-CP1-F label, tor2_2-patch branch, /wind/river VOB) +01l,09sep02,hsh add c++ protection +01k,12feb02,hgo modification of header files for dual-stack +01j,10jul01,niq Add the if_index field to the interface structure +01i,29mar01,spm merged changes from version 01i of tor2_0.open_stack + branch (wpwr VOB, base 01h) for unified code base +01h,11sep98,spm removed references to bloated trace commands (SPR #22350) +01g,06oct97,gnn added sendHook function pointer. +01f,16may97,gnn added leakHook function pointer. +01e,17apr97,gnn changed MIB-II names to follow conventions. +01d,14apr97,gnn added the pointer for the authentication hook. +01c,07apr97,gnn cleared up some of the more egregious warnings. + added MIB-II interfaces and options. +01b,24feb97,gnn removed multicast stuff + changed the routine names. +01a,26nov96,gnn created from BSD4.4 routed +*/ + +#ifndef __INCinterfaceh +#define __INCinterfaceh + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* defines */ + +#define AUTH_KEY_LEN 16 /* must be 20 if SHA-1 will be used */ +#define RIP_AUTH_PROTO_MD5 1 +#define RIP_AUTH_PROTO_SHA1 2 + + +/* + * Routing table management daemon. + */ + +struct interface; +typedef struct ripAuthKey RIP_AUTH_KEY; + +struct ripAuthKey + { + UINT16 keyId; /* the key id */ + UINT authProto; /* the authentication protocol */ + UCHAR pKey [AUTH_KEY_LEN]; /* the secret authentication key */ + ULONG timeStart; /* time key was entered */ + ULONG timeEnd; /* time when key expires */ + ULONG lastRcvSequence; /* last sequence number received */ + ULONG lastSntSequence; /* last sequence number sent */ + struct interface * ifp; /* interface where key is valid */ + RIP_AUTH_KEY * pNext; /* next auth key in the list */ + }; + +/* + * An ``interface'' is similar to an ifnet structure, + * except it doesn't contain q'ing info, and it also + * handles ``logical'' interfaces (remote gateways + * that we want to keep polling even if they go down). + * The list of interfaces which we maintain is used + * in supplying the gratuitous routing table updates. + */ +struct interface { + struct interface *int_next; + struct sockaddr int_addr; /* address on this host */ + union { + struct sockaddr intu_broadaddr; + struct sockaddr intu_dstaddr; + } int_intu; +#define int_broadaddr int_intu.intu_broadaddr /* broadcast address */ +#define int_dstaddr int_intu.intu_dstaddr /* other end of p-to-p link */ + int int_metric; /* init's routing entry */ + int int_flags; /* see below */ + + /* START INTERNET SPECIFIC */ + u_long int_net; /* network # */ + u_long int_netmask; /* net mask for addr */ + u_long int_subnet; /* subnet # */ + u_long int_subnetmask; /* subnet mask for addr */ + /* END INTERNET SPECIFIC */ + char *int_name; /* from kernel if structure */ + u_short int_index; /* from kernel if structure */ + u_short int_transitions; /* times gone up-down */ + + M2_RIP2_IFSTAT_ENTRY ifStat; /* MIB-II statistics. */ + M2_RIP2_IFCONF_ENTRY ifConf; /* MIB-II configuration. */ + + FUNCPTR authHook; /* per interface authentication */ + FUNCPTR leakHook; /* per interface leak hook. */ + BOOL (*sendHook) (); /* per interface validation hook */ + RIP_AUTH_KEY * pAuthKeys; /* list of valid authe keys */ +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* + * 0x1 to 0x10 are reused from the kernel's ifnet definitions, + * the others agree with the RTS_ flags defined elsewhere. + */ +#define IFF_UP 0x1 /* interface is up */ +#define IFF_BROADCAST 0x2 /* broadcast address valid */ +#define IFF_DEBUG 0x4 /* turn on debugging */ +#define IFF_LOOPBACK 0x8 /* software loopback net */ +#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */ + +#define IFF_SUBNET 0x100000 /* interface on subnetted network */ +#define IFF_PASSIVE 0x200000 /* can't tell if up/down */ +#define IFF_INTERFACE 0x400000 /* hardware interface */ +#define IFF_REMOTE 0x800000 /* interface isn't on this machine */ + +#define IFF_SHARED_ROUTES 0x10000000 /* shared routes may exist */ + +struct interface *ripIfWithAddr(); +struct interface *ripIfWithAddrAndIndex(); +struct interface *ripIfWithDstAddr(); +struct interface *ripIfWithDstAddrAndIndex(); +struct interface *ripIfWithNet(); +struct interface *ripIfLookup(); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCinterfaceh */ diff --git a/h/wrn/coreip/rip/m2RipLeaf.h b/h/wrn/coreip/rip/m2RipLeaf.h new file mode 100644 index 0000000..cd3bb37 --- /dev/null +++ b/h/wrn/coreip/rip/m2RipLeaf.h @@ -0,0 +1,84 @@ +/****************************************************************************** + ****************************************************************************** + **** This file was automatically generated by Wind River's + **** WindManage MIB Compiler, version 9.3. + **** This file was generated using the -leaf switch. + **** + **** This file #defines C preprocessor macros providing a variety of + **** information for the leaf objects in the MIB. + **** + **** The file includes a LEAF_xxx macro for each leaf object in the + **** MIB (xxx is replaced by the object's name). The value of the + **** LEAF_xxx macro is the final component of the object's object + **** identifier. + **** + **** If the object's SYNTAX clause included named INTEGER values, + **** then there is a VAL_xxx_yyy macro for each named value (xxx is + **** replaced by the object's name and yyy by the value's name). The + **** value of the VAL_xxx_yyy macro is the value associated with the + **** named value. + **** + **** If the object's SYNTAX clause specified a set of range limitations + **** for the value of the object, then there are one or more sets of + **** MIN_xxx and MAX_xxx macros specifying the lower and upper bound of + **** each range limitation. + **** + **** If the object's SYNTAX clause specified a set of size constraints + **** for the value of the object, then there are one or more sets of + **** MINSIZE_xxx and MAXSIZE_xxx macros specifying the lower and upper + **** bound of each size constraint. (If the size constraint is a single + **** value rather than a range then the MINSIZE_xxx and MAXSIZE_xxx + **** macros are replaced by a single SIZE_xxx macro.) + **** + **** DO NOT MODIFY THIS FILE BY HAND. + **** + **** Last build date: Wed Aug 14 10:50:14 2002 + **** from files: + **** rfc1213.mib, rfc1389.mib + **** starting from node: rip2 + ****************************************************************************** + ****************************************************************************** + */ + +#define LEAF_rip2GlobalRouteChanges 1 +#define LEAF_rip2GlobalQueries 2 +#define LEAF_rip2IfStatAddress 1 +#define LEAF_rip2IfStatRcvBadPackets 2 +#define LEAF_rip2IfStatRcvBadRoutes 3 +#define LEAF_rip2IfStatSentUpdates 4 +#define LEAF_rip2IfStatStatus 5 +#define VAL_rip2IfStatStatus_valid 1L +#define VAL_rip2IfStatStatus_invalid 2L +#define LEAF_rip2IfConfAddress 1 +#define LEAF_rip2IfConfDomain 2 +#define SIZE_rip2IfConfDomain 2L +#define LEAF_rip2IfConfAuthType 3 +#define VAL_rip2IfConfAuthType_noAuthentication 1L +#define VAL_rip2IfConfAuthType_simplePassword 2L +#define LEAF_rip2IfConfAuthKey 4 +#define MINSIZE_rip2IfConfAuthKey 0L +#define MAXSIZE_rip2IfConfAuthKey 16L +#define LEAF_rip2IfConfSend 5 +#define VAL_rip2IfConfSend_doNotSend 1L +#define VAL_rip2IfConfSend_ripVersion1 2L +#define VAL_rip2IfConfSend_rip1Compatible 3L +#define VAL_rip2IfConfSend_ripVersion2 4L +#define LEAF_rip2IfConfReceive 6 +#define VAL_rip2IfConfReceive_rip1 1L +#define VAL_rip2IfConfReceive_rip2 2L +#define VAL_rip2IfConfReceive_rip1OrRip2 3L +#define LEAF_rip2IfConfDefaultMetric 7 +#define MIN_rip2IfConfDefaultMetric 0L +#define MAX_rip2IfConfDefaultMetric 15L +#define LEAF_rip2IfConfStatus 8 +#define VAL_rip2IfConfStatus_valid 1L +#define VAL_rip2IfConfStatus_invalid 2L +#define LEAF_rip2PeerAddress 1 +#define LEAF_rip2PeerDomain 2 +#define SIZE_rip2PeerDomain 2L +#define LEAF_rip2PeerLastUpdate 3 +#define LEAF_rip2PeerVersion 4 +#define MIN_rip2PeerVersion 0L +#define MAX_rip2PeerVersion 255L +#define LEAF_rip2PeerRcvBadPackets 5 +#define LEAF_rip2PeerRcvBadRoutes 6 diff --git a/h/wrn/coreip/rip/m2RipLib.h b/h/wrn/coreip/rip/m2RipLib.h new file mode 100644 index 0000000..3a78949 --- /dev/null +++ b/h/wrn/coreip/rip/m2RipLib.h @@ -0,0 +1,157 @@ +/* m2RipLib.h - VxWorks MIB-II interface for RIP to SNMP Agent */ + +/* Copyright 1984 - 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,05nov03,cdw Removal of unnecessary _KERNEL guards. +01i,04nov03,rlm Ran batch header path update for header re-org. +01h,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01g,10jun03,vvv include netVersion.h +01f,01may03,spm Tornado 2.2 CP1 merge (from ver 01f,13jan03,rae: + TOR2_2-CP1-F label, tor2_2-patch branch, /wind/river VOB) +01e,09sep02,hsh add c++ protection +01d,29mar01,spm merged changes from version 01d of tor2_0.open_stack + branch (wpwr VOB, base 01c) for unified code base +01c,30jun98,spm corrected size of storage for authentication key +01b,17apr97,gnn changed variables to follow coding convention. + added varToSet defines. +01a,01apr97,gnn written. + +*/ + +#ifndef __INCm2RipLibh +#define __INCm2RipLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* defines for local structures */ +#define AUTHKEYLEN 16 + +/* defines for errors */ +#define S_m2RipLib_IFACE_NOT_FOUND (M_m2RipLib | 1) + +/* defines for enumerated types */ + +/* enumerated values for rip2IfStatStatus */ +#define M2_rip2IfStatStatus_valid 1 +#define M2_rip2IfStatStatus_invalid 2 + +/* enumerated values for rip2IfConfAuthType */ +#define M2_rip2IfConfAuthType_noAuthentication 1 +#define M2_rip2IfConfAuthType_simplePassword 2 +#define M2_rip2IfConfAuthType_md5 3 + +/* enumerated values for rip2IfConfSend */ +#define M2_rip2IfConfSend_doNotSend 1 +#define M2_rip2IfConfSend_ripVersion1 2 +#define M2_rip2IfConfSend_rip1Compatible 3 +#define M2_rip2IfConfSend_ripVersion2 4 + +/* enumerated values for rip2IfConfReceive */ +#define M2_rip2IfConfReceive_rip1 1 +#define M2_rip2IfConfReceive_rip2 2 +#define M2_rip2IfConfReceive_rip1OrRip2 3 +#define M2_rip2IfConfReceive_doNotReceive 4 + +/* enumerated values for rip2IfConfStatus */ +#define M2_rip2IfConfStatus_valid 1 +#define M2_rip2IfConfStatus_invalid 2 + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * The rip2GlobalGroup family. + */ + + +typedef struct + { + unsigned long rip2GlobalRouteChanges; + unsigned long rip2GlobalQueries; + } M2_RIP2_GLOBAL_GROUP; + +/* + * The rip2IfStatEntry family. + */ + + +typedef struct + { + unsigned long rip2IfStatAddress; + unsigned long rip2IfStatRcvBadPackets; + unsigned long rip2IfStatRcvBadRoutes; + unsigned long rip2IfStatSentUpdates; + long rip2IfStatStatus; + } M2_RIP2_IFSTAT_ENTRY; + +/* + * The rip2IfConfEntry family. + */ + + +/* Defines for the fields that can be set. */ + +#define M2_RIP2_IF_CONF_DOMAIN 0x1 +#define M2_RIP2_IF_CONF_AUTH_TYPE 0x2 +#define M2_RIP2_IF_CONF_AUTH_KEY 0x4 +#define M2_RIP2_IF_CONF_SEND 0x8 +#define M2_RIP2_IF_CONF_RECEIVE 0x10 +#define M2_RIP2_IF_CONF_DEFAULT_METRIC 0x20 +#define M2_RIP2_IF_CONF_STATUS 0x40 + +typedef struct + + { + unsigned long rip2IfConfAddress; + char rip2IfConfDomain[2]; + long rip2IfConfAuthType; + char rip2IfConfAuthKey[AUTHKEYLEN]; + long rip2IfConfSend; + long rip2IfConfReceive; + long rip2IfConfDefaultMetric; + long rip2IfConfStatus; + } M2_RIP2_IFCONF_ENTRY; + +/* + * The rip2PeerEntry family. + */ + + +typedef struct + { + unsigned long rip2PeerAddress; + char* rip2PeerDomain; + unsigned long rip2PeerLastUpdate; + long rip2PeerVersion; + unsigned long rip2PeerRcvBadPackets; + unsigned long rip2PeerRcvBadRoutes; + } M2_RIP2_PEER_ENTRY; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* function declarations */ + +STATUS m2RipInit (void); +STATUS m2RipDelete (void); +STATUS m2RipGlobalCountersGet(M2_RIP2_GLOBAL_GROUP* pRipGlobal); +STATUS m2RipIfStatEntryGet(int search, M2_RIP2_IFSTAT_ENTRY* pRipIfStat); +STATUS m2RipIfConfEntryGet(int search, M2_RIP2_IFCONF_ENTRY* pRipIfConf); +STATUS m2RipIfConfEntrySet(unsigned int varToSet, + M2_RIP2_IFCONF_ENTRY* pRipIfConf); +STATUS m2RipTreeAdd (void); + +#ifdef __cplusplus +} +#endif + +#endif /* INCm2RipLibh */ diff --git a/h/wrn/coreip/rip/rip2.h b/h/wrn/coreip/rip/rip2.h new file mode 100644 index 0000000..18f0a93 --- /dev/null +++ b/h/wrn/coreip/rip/rip2.h @@ -0,0 +1,94 @@ +/* rip2.h - Defines specifically for RIP version 2 */ + +/* Copyright 1984 - 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,05nov03,cdw Removal of unnecessary _KERNEL guards. +01i,04nov03,rlm Ran batch header path update for header re-org. +01h,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01g,10jun03,vvv include netVersion.h +01f,12sep02,hsh add c++ protection +01e,29mar01,spm merged changes from version 01e of tor2_0.open_stack + branch (wpwr VOB, base 01d) for unified code base +01d,15may97,gnn added another new define. +01c,08may97,gnn added a new define. +01b,24feb97,gnn made rip_2_pkt look more logical. +01a,14nov96,gnn written. + +*/ + +#ifndef __INCrip2h +#define __INCrip2h + +#ifdef __cplusplus +extern "C" { +#endif + +/* +DESCRIPTION + +INCLUDE FILES: +*/ + +/* includes */ + +#include + +/* defines */ +#define RIP2_AUTH_LEN 16 +#define RIP2_AUTH 0xffff +#define RIP2_DEST_OFFSET 2 +#define RIP2_GATE_OFFSET 10 +#define RIP2_MASK_OFFSET 6 + +/* typedefs */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct rip_2_pkt + { + UINT16 family; + UINT16 tag; + UINT32 dest; + UINT32 subnet; + UINT32 gateway; + UINT32 metric; + } RIP2PKT; + +typedef struct rip2AuthPktHdr + { + UINT16 authIdent; /* authentication identifier (always 0xff) */ + UINT16 authType; /* the authentication type */ + UINT16 packetLen; /* the offset (in bytes) to the digest */ + UINT8 keyId; /* key identifier used to compute digest */ + UINT8 authDataLen; /* length of the digest */ + UINT32 sequence; /* sequence number of the packet */ + UINT32 zero1; /* zeroed out */ + UINT32 zero2; /* zeroed out */ + } RIP2_AUTH_PKT_HDR; + +typedef struct rip2AuthPktTrl + { + UINT16 authIdent; /* authentication identifier (always 0xff) */ + UINT16 authTag; /* the authentication type/tag (always 0x01) */ + UINT8 authDigest [AUTH_KEY_LEN]; /* the computed packet digest */ + } RIP2_AUTH_PKT_TRL; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* globals */ + +/* locals */ + +/* forward declarations */ +#ifdef __cplusplus +} +#endif + +#endif /* __INCrip2h */ diff --git a/h/wrn/coreip/rip/ripLib.h b/h/wrn/coreip/rip/ripLib.h new file mode 100644 index 0000000..0aff5f2 --- /dev/null +++ b/h/wrn/coreip/rip/ripLib.h @@ -0,0 +1,239 @@ +/* ripLib.h - primary include file for Routing Information Protocol (RIP) */ + +/* Copyright 1996 - 2005 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1983, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)routed.h 8.1 (Berkeley) 6/2/93 + */ + +/* +modification history +-------------------- +01r,04mar05,vvv fixed warning +01q,07oct04,spm restored internal route classification; removed related SPR + #88035 changes [additional class-based routes] (SPR #102398) +01p,15mar04,rp merged from orion +01o,06dec03,niq Merge from base6_itn3_networking-dev.al branch +01n,20nov03,niq osdep.h cleanup +01m,04nov03,rlm Ran batch header path update for header re-org. +01l,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01k,24oct03,cdw update include statements post header re-org. +01j,01may03,spm Tornado 2.2 CP1 merge (from ver 01g,13jan03,rae: + TOR2_2-CP1-F label, tor2_2-patch branch, /wind/river VOB) +01i,20dec01,hgo modification of header files +01h,23oct01,niq Added interface exclusion list - SPR 71093 +01g,07aug01,niq Change ripRouteHook prototype +01f,10jul01,niq Changes for supporting the route hook. +01e,23mar01,spm merged changes from version 01f of tor2_0.open_stack + branch (wpwr VOB, base 01d) for unified code base; + added title and copyright +01d,11sep98,spm updated contents to prevent compilation problems (SPR #22352); + removed references to bloated trace commands (SPR #22350) +01c,12mar97,gnn added multicast support + added timer variables +01b,24feb97,gnn Changed include protection. + Added prototype for ripLibInit. + Put in WRS proper typedefs. +01a,26nov96,gnn created from BSD4.4 routed +*/ + + +#ifndef __INCripLibh +#define __INCripLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef VIRTUAL_STACK +#include +#endif +#include + +/* + * Routing Information Protocol + * + * Derived from Xerox NS Routing Information Protocol + * by changing 32-bit net numbers to sockaddr's and + * padding stuff to 32-bit boundaries. + */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct route_info + { + struct rt_msghdr rtm; /* Route message header */ + struct sockaddr addrs [RTAX_MAX]; /* Array of sockaddrs */ + } ROUTE_INFO; + + +typedef struct netinfo { + struct sockaddr rip_dst; /* destination net/host */ + int rip_metric; /* cost of route */ +} NETINFO; + +typedef struct rip_pkt { + u_char rip_cmd; /* request/response */ + u_char rip_vers; /* protocol version # */ + u_char rip_domain[2]; /* Version 2 routing domain. */ + union { + struct netinfo ru_nets[1]; /* variable length... */ + } ripun; +#define rip_nets ripun.ru_nets +} RIP_PKT; + +typedef struct rt_iflist + { + NODE node; + char rtif_name [IFNAMSIZ]; + u_long rtif_ipaddr; + u_long rtif_subnetmask; + } RT_IFLIST; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Packet types. + */ +#define RIPCMD_REQUEST 1 /* want info */ +#define RIPCMD_RESPONSE 2 /* responding to request */ +#define RIPCMD_TRACEON 3 /* obsolete: turn tracing on */ +#define RIPCMD_TRACEOFF 4 /* obsolete: turn tracing off */ + +#define RIPCMD_MAX 5 + +#define HOPCNT_INFINITY 16 /* per Xerox NS */ +#if 0 /* accordion -> moved to defs.h because of hen/egg problem with rip_globals */ +#define MAXPACKETSIZE 512 /* max broadcast size */ +#endif + +/* + * Flag values for the route hook routine + */ + +#define RIP_REDIRECT_RECD 0x1 /* Received redirect message */ +#define RIP_ROUTE_CHANGE_RECD 0x2 /* Received route change message */ + +/* +* Timer values used in managing the routing table. Complete tables are +* broadcast at periodic intervals (30 seconds by default). If changes occur +* between updates, triggered updates containing the changed entries may be +* sent to speed convergence of the routing tables. The MIN_WAITTIME and +* MAX_WAITTIME constants control the scheduling of these updates. No +* triggered update will occur within MAX_WAITTIME of a regular update. +* After the update is sent, further triggered updates will be supressed +* for a random interval between MIN_WAITTIME and MAX_WAITTIME to avoid +* flooding the network. +*/ + +#define MIN_WAITTIME 1 /* min. interval to broadcast changes */ +#define MAX_WAITTIME 5 /* max. time to delay changes */ + +typedef struct rip_config_params { + CFG_DATA_HDR cfgh; + + BOOL cfg_supplier; /* operate in silent mode? */ + BOOL cfg_gateway; /* act as gateway to the Internet? */ + BOOL cfg_multicast; /* use multicast or broadcast addresses? */ + int cfg_version; /* 1 or 2: selects format of outgoing messages */ + int cfg_timerRate; /* update frequency for internal routing table */ + int cfg_supplyInterval; /* update frequency for neighboring routers */ + int cfg_expire; /* maximum interval for renewing learned routes */ + int cfg_garbage; /* elapsed time before deleting stale route */ + int cfg_authType; /* default authentication type to use */ + } RIP_CONFIG_PARAMS; + +/* externs */ + +/* Forward declarations for user callable routines. */ + +STATUS ripLibInit (BOOL, BOOL, BOOL, int, int, int, int, int, int); +void ripRouteShow (void); +STATUS ripAuthHookAdd (char *, FUNCPTR); +IMPORT STATUS ripAuthHook (char *, RIP_PKT *); +STATUS ripAuthHookDelete (char *); +STATUS ripLeakHookAdd (char *, FUNCPTR); +STATUS ripLeakHookDelete (char *); +STATUS ripSendHookAdd (char *, BOOL (*sendHook) (struct rt_entry *)); +STATUS ripSendHookDelete (char *); +void ripIfSearch (void); +STATUS ripIfReset (char *); +STATUS ripIfAddrReset (char *, char *, u_long); +void ripFilterEnable (void); +void ripFilterDisable (void); +STATUS ripShutdown (void); +void ripDebugLevelSet (int); +void ripAuthKeyShow (UINT); +STATUS ripAuthKeyAdd (char *, UINT16, char *, UINT, UINT, ULONG); +STATUS ripAuthKeyDelete (char *, UINT16); +STATUS ripAuthKeyFind (struct interface *, UINT16, RIP_AUTH_KEY **); +STATUS ripAuthKeyFindFirst (struct interface *, RIP_AUTH_KEY **); +STATUS ripAuthKeyInMD5 (struct interface *, RIP_PKT *, UINT); +STATUS ripAuthKeyOut1MD5 (struct interface *, struct netinfo *, + RIP2_AUTH_PKT_HDR **, RIP_AUTH_KEY **); +void ripAuthKeyOut2MD5 (RIP_PKT *, UINT *, struct netinfo *, + RIP2_AUTH_PKT_HDR *, RIP_AUTH_KEY *); +STATUS ripRouteHookAdd (FUNCPTR); +STATUS ripRouteHookDelete (void); +STATUS ripRouteHook (ROUTE_INFO *, int, BOOL, int); +void ripAddrsXtract (ROUTE_INFO *, struct sockaddr **, struct sockaddr **, + struct sockaddr **, struct sockaddr **); +STATUS ripIfExcludeListAdd (char *); +STATUS ripIfExcludeListDelete (char *); +STATUS ripIfExcludeListCheck (char *, u_long, u_long); +void ripIfExcludeListShow (void); +STATUS ripIfAddrExcludeListAdd (char *, char *, u_long); +STATUS ripIfAddrExcludeListDelete (char *, u_long); +void ripRtEntryPrint(struct rt_entry *rt, BOOL verbose, char *pStr); +int inet_rtflags(struct sockaddr_in *sin); + + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCripLibh */ diff --git a/h/wrn/coreip/rip/table.h b/h/wrn/coreip/rip/table.h new file mode 100644 index 0000000..f7bbdc7 --- /dev/null +++ b/h/wrn/coreip/rip/table.h @@ -0,0 +1,187 @@ +/* table.h - definitions for managing RIP internal routing table */ + +/* Copyright 1984 - 2004 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)table.h 8.1 (Berkeley) 6/5/93 + */ + +/* +modification history +-------------------- +01q,07oct04,spm restored internal route classification; removed related SPR + #88035 changes [additional class-based routes] (SPR #102398) +01p,06dec03,niq Merge from base6_itn3_networking-dev.al branch +01o,04nov03,rlm Ran batch header path update for header re-org. +01n,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01m,27oct03,cdw update include statements post header re-org. +01l,01may03,spm Tornado 2.2 CP1 merge (from ver 01l,28mar03,rae: + TOR2_2-CP1-F label, tor2_2-patch branch, /wind/river VOB) +01k,09sep02,hsh add c++ protection +01j,16may02,ant hash definitions rt_xxx changed to rtu_xxx +01i,18dec01,hgo modification of header files +01h,07aug01,niq Add the RTS_PRIMARY flag definition +01g,10jul01,niq Changes to use published routing extension interfaces + rather than private ones and support for static and other + non-rip routes. +01f,29mar01,spm merged changes from version 01f of tor2_0.open_stack + branch (wpwr VOB, base 01e) for unified code base +01e,16mar99,spm recovered orphaned code from tor1_0_1.sens1_1 (SPR #25770) +01d,29sep98,spm added support for IP group MIB (SPR #9374); removed unused + entries from rt_entry structure (SPR #22535) +01c,11sep98,spm updated contents to prevent compilation problems (SPR #22352) +01b,24feb97,gnn Reworked the rt_entry structure. +01a,26nov96,gnn created from BSD4.4 routed +*/ + +#ifndef __INCtableh +#define __INCtableh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * Routing table management daemon. + */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* + * Routing table structure; differs a bit from kernel tables. + * + * Note: the union below must agree in the first 4 members + * so the ioctl's will work. + */ + +struct rthash { + struct rt_entry *rtu_forw; + struct rt_entry *rtu_back; +}; + +struct rt_entry + { + struct rt_entry *rtu_forw; + struct rt_entry *rtu_back; + + BOOL inKernel; /* Route has been added to the kernel*/ + int rtu_tag; /* Route tag - for RIP v2 only */ + short rtu_refcnt; /* How many additional interfaces */ + /* need this route */ + short rtu_subnets_cnt;/* How many subnetted interfaces */ + /* need an "internal" classful */ + /* network route. Set only for a */ + /* classful route (internal or */ + /* otherwise) when atleast two */ + /* subnetted interfaces or one */ + /* non-subnetted and atleast one */ + /* subnetted interface exists */ + /* for the network */ + int rtu_flags; + struct interface *rtu_ifp; /* Interface through which the */ + /* gateway is reachable */ + + struct rtuentry + { + u_long rtu_hash; + struct sockaddr rtu_dst; + struct sockaddr rtu_router; /* Route's gateway - route supplier */ + /* for V1 or V2 with unspecified next*/ + /* hop. Set to next hop value for */ + /* V2 if specified */ + + struct sockaddr rtu_netmask; + int rtu_state; + int rtu_timer; /* Route timer */ + int rtu_metric; /* Route metric */ + int rtu_proto; /* Protocol that owns the route */ + } rtu_entry; +}; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#define rtu_hash rtu_entry.rtu_hash /* for net or host */ +#define rtu_dst rtu_entry.rtu_dst /* match value */ +#define rtu_router rtu_entry.rtu_router /* who to forward to */ +#define rtu_netmask rtu_entry.rtu_netmask /* who to forward to */ +#define rtu_timer rtu_entry.rtu_timer /* for invalidation */ +#define rtu_state rtu_entry.rtu_state /* see below */ +#define rtu_metric rtu_entry.rtu_metric /* cost of route */ +#define rtu_proto rtu_entry.rtu_proto /* protocol that owns this */ + /* route */ + +#define ROUTEHASHSIZ 32 /* must be a power of 2 */ +#define ROUTEHASHMASK (ROUTEHASHSIZ - 1) + +/* + * "State" of routing table entry. + */ +#define RTS_CHANGED 0x1 /* route has been altered recently */ +#define RTS_EXTERNAL 0x2 /* extern info, not installed or sent */ +#define RTS_INTERNAL 0x4 /* internal route, not installed */ +#define RTS_PASSIVE IFF_PASSIVE /* don't time out route */ +#define RTS_INTERFACE IFF_INTERFACE /* route is for network interface */ +#define RTS_REMOTE IFF_REMOTE /* route is for ``remote'' entity */ +#define RTS_SUBNET IFF_SUBNET /* route is for network subnet */ +#define RTS_OTHER 0x1000000 /* route installed by another */ + /* protocol */ +#define RTS_PRIMARY 0x2000000 /* This is a primary route */ + +/* + * Flags are same as kernel, with this addition for af_rtflags + */ +#define RTF_SUBNET 0x80000 /* pseudo: route to subnet */ + +#ifndef VIRTUAL_STACK +struct rthash nethash[ROUTEHASHSIZ]; +struct rthash hosthash[ROUTEHASHSIZ]; +#endif + +struct rt_entry *rtlookup(); +struct rt_entry *rtfind(); + +IMPORT STATUS mPrivRouteEntryAdd (long, long, long, int, int, int, + struct rtentry **); +IMPORT STATUS mPrivRouteEntryDelete (long, long, long, int, int, int, + struct rtentry *); +#ifdef __cplusplus +} +#endif +#endif /* __INCtableh */ diff --git a/h/wrn/coreip/ripngLib.h b/h/wrn/coreip/ripngLib.h new file mode 100644 index 0000000..908bf11 --- /dev/null +++ b/h/wrn/coreip/ripngLib.h @@ -0,0 +1,69 @@ +/* ripngLib.h - header file for ripngLib.c */ + +/* Copyright 1992-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,05nov03,cdw Removal of unnecessary _KERNEL guards. +01f,04nov03,rlm Ran batch header path update for header re-org. +01e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01d,15sep03,vvv updated path for new headers +01c,06aug03,nee Accordion Base6 merge from ACCORDION_BASE6_MERGE_BASELINE + label +01b,10jun03,vvv include netVersion.h +01e,09oct02,kal added ripngStop(), removed variable initialiser +01d,10sep02,vlk removed unnecessary includes +01c,05sep02,hgo removed instInit and destructor +01b,05sep02,ger ifdeffed the function declaration for Instinit and destructor + removed ifdef in cfg_params +01a,27jun02,ger created. +*/ + +#ifndef __INCripngLibh +#define __INCripngLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef VIRTUAL_STACK +#include +#endif + + +/* ripng configuration parameters */ + +typedef struct ripngcfgparams + { + CFG_DATA_HDR cfgh ; + int cfg_ripng_priority ; + char *cfg_ripng_options ; + } RIPNG_CFG_PARAMS; + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void ripngStart (char *cmdString, int priority); +extern void ripngStop (void); + +#else /* __STDC__ */ + +extern void ripngStart (); +extern void ripngStop (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCripngLibh */ + diff --git a/h/wrn/coreip/rlogLib.h b/h/wrn/coreip/rlogLib.h new file mode 100644 index 0000000..496eb28 --- /dev/null +++ b/h/wrn/coreip/rlogLib.h @@ -0,0 +1,120 @@ +/* rlogLib.h - header file for rlogLib.c */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,25feb04,asr updates resulting from review comments +01h,06feb04,asr included lstlib.h +01g,30jan04,dlk Remove extra tokens at end of #ifndef directives. +01f,12dec03,rp support for multiple rlogin sessions +01e,05nov03,cdw Removal of unnecessary _KERNEL guards. +01d,04nov03,rlm Ran batch header path update for header re-org. +01c,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01b,02oct02,ant virtualization changes +01c,06aug03,nee Accordion Base6 merge from ACCORDION_BASE6_MERGE_BASELINE + label +01b,10jun03,vvv include netVersion.h +01a,10jun02,ann ported to clarinet from AE1.1 ver 02b +*/ + +#ifndef __INCrlogLibh +#define __INCrlogLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#ifndef PTY_DEVICE_NAME_MAX_LEN +#define PTY_DEVICE_NAME_MAX_LEN 128 /* The maximum string length of a pty device */ +#endif + +/* The maximum string length of pty i/o task name */ +#ifndef IO_TASK_NAME_MAX_LEN +#define IO_TASK_NAME_MAX_LEN 128 +#endif + +/* command interpreter control operations */ + +#ifndef REMOTE_START +#define REMOTE_START 0 +#endif +#ifndef REMOTE_STOP +#define REMOTE_STOP 1 +#endif + +#ifdef _WRS_KERNEL +/* rlogin server's session data */ +typedef struct + { + NODE node; /* for link-listing */ + char ptyRemoteName[PTY_DEVICE_NAME_MAX_LEN]; + /* name of the pty for this session */ + int socket; /* socket connection */ + int inputFd; /* input to command interpreter */ + int outputFd; /* output to command interpreter */ + int slaveFd; /* command interpreter side fd of pty */ + int outputTask; /* Task ID to send data to socket */ + int inputTask; /* Task ID to send data to socket */ + FUNCPTR parserControl; /* source of input/output files */ + BOOL busyFlag; /* input/output tasks in use? */ + BOOL loggedIn; /* Has a shell been started on this slot? */ + UINT32 userData; /* A storage for application developers */ + int shellTaskId; /* TaskID of shell associated with session */ + } RLOGIND_SESSION_DATA; + +/* rlogin server's task data */ +typedef struct + { + RLOGIND_SESSION_DATA *pSession; /* link to session data for tasks */ + } RLOGIND_TASK_DATA; + +#endif /* _WRS_KERNEL */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS rlogin (char *host); +#ifndef VIRTUAL_STACK + extern void rlogChildTask (void); +#else + extern void rlogChildTask (int stackNum); +#endif /* VIRTUAL_STACK */ + +#ifdef _WRS_KERNEL + #ifndef VIRTUAL_STACK + extern STATUS rlogInit (void); + extern void rlogind (void); + extern void rlogInTask (RLOGIND_SESSION_DATA *); + extern void rlogOutTask (RLOGIND_SESSION_DATA *); + #else + extern void rlogind (int stackNum); + extern void rlogInTask (RLOGIND_SESSION_DATA *, int stackNum); + extern void rlogOutTask (RLOGIND_SESSION_DATA *, int stackNum); + extern void rlogChildTask (int stackNum); + #endif /* VIRTUAL_STACK */ +#endif /* _WRS_KERNEL */ + +#else /* __STDC__ */ + +extern STATUS rlogin (); +extern void rlogChildTask (); +#ifdef _WRS_KERNEL + extern STATUS rlogInit (); + extern void rlogInTask (); + extern void rlogOutTask (); + extern void rlogind (); +#endif /* _WRS_KERNEL */ + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrlogLibh */ diff --git a/h/wrn/coreip/route/avlRouteNodeLib.h b/h/wrn/coreip/route/avlRouteNodeLib.h new file mode 100644 index 0000000..a39170b --- /dev/null +++ b/h/wrn/coreip/route/avlRouteNodeLib.h @@ -0,0 +1,56 @@ +/* avlLib.h - VxWorks AVL API definitions for the IP RIB */ + +/* Copyright 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,24oct02,syy Code cleanup. +01c,23oct02,niq Comment out definitions of NTOHL and use the ones in + endian.h +01b,17oct02,syy Added constants for IPv4. +01a,20sep02,syy written +*/ + +/* +DESCRIPTION + +*/ + +#ifndef _INCavlLibh +#define _INCavlLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Length of IPv4 address in 8-bit bytes */ +#define IPV4_ADDR_LEN 4 + +/* Length of IPv4 address in 32-bit unsigned long word */ +#define IPV4_ADDR_ULONG_LEN IPV6_ADDR_LEN / 4 + +/* Length of IPv4 address in bits */ +#define IPV4_ADDR_BITS_LEN IPV4_ADDR_LEN * 8 + +/* Length of IPv6 address in 8-bit bytes */ +#define IPV6_ADDR_LEN 16 + +/* Length of IPv6 address in 32-bit unsigned long word */ +#define IPV6_ADDR_ULONG_LEN IPV6_ADDR_LEN / 4 + +/* Length of IPv6 address in bits */ +#define IPV6_ADDR_BITS_LEN IPV6_ADDR_LEN * 8 + +/* + * Length of the longest printed form of an IPv6 address, in characters, + * including a trailing null character. + */ +#define IPV6_ADDR_STRING_LEN sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255") +#define NETMASK_STRING_LEN sizeof(ULONG)+1; + +#ifdef __cplusplus +} +#endif + +#endif /* _INCavlLibh */ diff --git a/h/wrn/coreip/route/avltree.h b/h/wrn/coreip/route/avltree.h new file mode 100644 index 0000000..bb601fd --- /dev/null +++ b/h/wrn/coreip/route/avltree.h @@ -0,0 +1,213 @@ +/* $Header: /usr/cvsroot/epilogue/attache/h/avltree.h,v 4.13 2001/01/19 22:20:28 paul Exp $ */ + +/**************************************************************************** + * + * *** Restricted Rights Legend *** + * + * The programs and information contained herein are licensed only + * pursuant to a license agreement that contains use, reverse + * engineering, disclosure, and other restrictions; accordingly, it + * is "Unpublished--all rights reserved under the applicable + * copyright laws". + * + * Use duplication, or disclosure by the Government is subject to + * restrictions as set forth in subparagraph (c)(1)(ii) of the Rights + * in Technical Data and Computer Licensed Programs clause of DFARS + * 52.227 7013. + * + * Copyright 2000-2002 Wind River Systems, Inc. + * Copyright 1996-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + * + * *** Government Use *** + * + * The Licensed Programs and their documentation were developed at + * private expense and no part of them is in the public domain. + * + * The Licensed Programs are "Restricted Computer Software" as that + * term is defined in Clause 52.227-19 of the Federal Acquisition + * Regulations (FAR) and are "Commercial Computer Software" as that + * term is defined in Subpart 227.401 of the Department of Defense + * Federal Acquisition Regulation Supplement (DFARS). + * + * (i) If the licensed Programs are supplied to the Department of + * Defense (DoD), the Licensed Programs are classified as + * "Commercial Computer Software" and the Government is acquiring + * only "restricted rights" in the Licensed Programs and their + * documentation as that term is defined in Clause 52.227 + * 7013(c)(1) of the DFARS, and + * + * (ii) If the Licensed Programs are supplied to any unit or agency + * of the United States Government other than DoD, the + * Government's rights in the Licensed Programs and their + * documentation will be as defined in Clause 52.227-19(c)(2) of + * the FAR. + ****************************************************************************/ + +/* +modification history +-------------------- +01m,24feb05,spm performance updates: add pointer redirection (SPR #100995) +01l,31jan05,dlk Disable BUG_ASSERT() checks by default. Make tree printing + routines conditional upon DEBUG definition. Remove 'pfx' + and 'avlNodeMask' members of avl_node_t; use 'prefix' + exclusively. +01k,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE +01j,10nov03,cdw Rebase from base6 iteration 1 view +01i,04nov03,rlm Ran batch header path update for header re-org. +01h,15sep03,vvv updated path for new headers +01g,16jan03,syy Temporary inclusion of assertion function by default +01f,14jan03,syy Make inclusion of debugging utility prototypes conditional +01e,02jan03,syy Exclude BUG_ASSERT when DEBUG is not defined +01d,20nov02,syy Remove unused component node_flags from avl_node_t. +01c,23oct02,syy Change maskToPfxLength() into a macro. +01b,16oct02,syy Enable support or IPv4. +01a,20sep02,syy modified from version 4.13 of the Attache code +*/ + +/* + * avltree.h -- + * + * This is the include file for AVL tree types and definitions. + * This is a generic datastructure which will be used by various + * portions of Attache and Courier, primarily in the routing/ + * forwarding table code. + * + * The code for routines to manipulate these structures can be + * found in attache/net/avltree.c. + * + * The code for this AVL implementation was loosely based on the + * public domain AVL-2.0 implementation by Paul Vixie. To quote + * from Vixie's readme.txt: + * + * "I cannot take credit for the algorithms. See "Algorithms & + * Data Structures," Niklaus Wirth, Prentice-Hall 1986, ISBN + * 0-13-022005-1...If you use or redistribute this code, please + * leave my name (and Wirth's) in the comments." + * + * So, I have... + * + * Sadly, as of September 1996, the book is not in print. + */ + +#ifndef _INCavltreeh +#define _INCavltreeh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "stdio.h" +#include "stdlib.h" +#include "string.h" +#include "memLib.h" +#include "logLib.h" +#include + +typedef short pool_id_t; +#define AVL_MALLOC(x) malloc(x) +#define AVL_FREE(x) free(x) + +IMPORT struct ipRouteDispatchTable avlRouteDispatchTable; + +/* Main node structure. Top (middle) node is pointed to by the + * avl_head_t (below). Each AVL node contains pointers to its + * corresponding entry and key(s), the actual storage for which + * is elsewhere, probably in the 'entry'.. + */ +typedef struct att_avl_node + { + struct ipRouteNode avlRibNode; /* new */ +#define avlNodeRtmEntry avlRibNode.pRtmEntry +#define avlNodeAddr avlRibNode.pAddress + int prefix; /* prefix length */ + struct att_avl_node *left; /* left/right children */ + struct att_avl_node *right; + struct att_avl_node *prev; /* ordered list of nodes */ + struct att_avl_node *next; + struct att_avl_node *less_specific; /* list of less specific matches */ + uchar_t balance; /* node balance state */ + } avl_node_t; + +/* Head of AVL tree. Points to top (middle) AVL node. Also keeps + * track of dispatch table and key details. Code using this AVL + * implementation should set up an AVL dispatch table (providing the + * required routines) and define a structure to use as the node + * entry. All other access should happen through the AVL primitives + * defined in avltree.c. + */ +typedef struct att_avl_head + { + struct ipRibHead avlIpRibHead; /* RIB head structure */ + ULONG routeFormat; /* supported route format */ + avl_node_t * tree; /* avl tree */ + avl_node_t * node_list; /* ordered list of all nodes */ + uchar_t head_flags; /* tree status flags */ + } avl_head_t; + +/* Macros for accessing the AVL nodes */ +#define ROUTE_ENTRY_ADDRESS(pRouteNode) \ + ( ((avl_node_t *) (pRouteNode))->avlNodeAddr) + +#define MASK2LEN(x, y) \ + ((x) == RIB_FORMAT_IPV4) ? \ + in_mask2len((struct in_addr *)&(y)) : (y) + +/* Note, enabling AVL_BUG_ASSERT severely degrades performance */ +#undef AVL_BUG_ASSERT /* If defined, enable BUG_ASSERT checks. */ + +#ifdef AVL_BUG_ASSERT +#define BUG_ASSERT(x) \ + if(!(x)) \ + printf("Assertion failed, file %s line %d\n",\ + __FILE__, __LINE__) +#else +#define BUG_ASSERT(x) +#endif /* AVL_BUG_ASSERT */ + +/* Flags for avl_head_t structure. */ +#define AVL_CLEAR 0x00 /* flags clear */ +#define AVL_CHECK_BALANCE 0x01 /* indicates balance should be checked */ +#define AVL_BEST_MATCH 0x02 /* maintain best-match pointers */ +#define AVL_CLOSING 0x04 /* tree is being closed down, not balanced */ + +/* Special 'flag' for calls to avl_create_tree() */ +#define AVL_EXACT_MATCH 0x00 + +/* Function return codes. */ +#define AVL_SUCCESS 0 +#define AVL_ERROR 1 +#define AVL_NODE_NOT_FOUND 2 + +/* Balance values */ +#define AVL_BALANCED 0x00 +#define AVL_RIGHT_HEAVY 0x01 +#define AVL_LEFT_HEAVY 0xFF + +/* function prototypes for avl routines. */ + +extern STATUS avl_destroy_tree(avl_head_t *head, pool_id_t headp, + pool_id_t nodep); +extern avl_node_t *avl_create_node(int); +extern void avl_destroy_node(avl_head_t *head, avl_node_t *node, pool_id_t); +extern int avl_add_node(avl_head_t *, avl_node_t *); +extern int avl_delete (avl_head_t *, void *, int, pool_id_t); +extern avl_node_t *avl_lookup(avl_head_t *, void *, int); +extern avl_node_t *avl_exact_lookup_in_tree(avl_head_t *, void *, int, int, + ULONG, avl_node_t *, avl_node_t *); +extern avl_node_t *avl_best_match(avl_head_t *, void *, int); +extern avl_node_t *avl_lex_next_match(avl_head_t *, void *, int, int, ULONG); + +#ifdef DEBUG +extern int avl_print(avl_head_t *); + +/* The following functions are temporary */ +extern void printIpAddr (const char *, const void *, ULONG, BOOL); +#endif /* DEBUG */ + +#ifdef __cplusplus +} +#endif + +#endif /* _INCavltreeh */ diff --git a/h/wrn/coreip/route/ipRouteLib.h b/h/wrn/coreip/route/ipRouteLib.h new file mode 100644 index 0000000..17d3eb1 --- /dev/null +++ b/h/wrn/coreip/route/ipRouteLib.h @@ -0,0 +1,421 @@ +/* ipRouteLib.h - definitions for the route interface library */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +02b,10may05,niq Changes to handle trimmed netmask +02a,24feb05,spm removed unneeded route format values and macros (SPR #100995) +01z,24feb05,spm performance updates and code cleanup (SPR #100995) +01y,28sep04,niq Fix netmask reported in routing socket messages: SPR 102094 +01x,17sep04,niq Scale out routing sockets +01w,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01v,09jun04,spm removed duplicate include file for virtual stacks +01u,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE +01t,24mar04,rp include vsLib.h +01s,06dec03,niq Move primary route indication from RTM flags to route flags +01r,20nov03,niq osdep.h cleanup +01q,10nov03,cdw Rebase from base6 iteration 1 view +01p,04nov03,rlm Ran batch header path update for header re-org. +01o,23oct03,rlm updated #includes for header re-org +01n,12mar03,niq Export some utility functions for use by Fastpath +01m,28jan03,niq Undo the previous change +01l,27jan03,niq Remove the incorrect check for RTF_LOCAL when checking for + interface route +01k,21jan03,niq Change the type of routeTos from ULONG to long +01j,17jan03,niq Don't allocate rentry for rt_gwroute +01i,08jan03,niq Return NULL genmsk for ARP entries +01h,19dec02,niq Changes for genmask support +01g,22nov02,niq Add support for Proxy ARP +01f,21nov02,niq Add a macro +01e,12nov02,niq Fix definition for interface route +01d,08nov02,niq Add a new error code +01c,29oct02,niq Eliminate the weight feature for host stack +01c,23oct02,spm fixed name for virtual stack registration number +01b,15oct02,niq Add some more prototypes +01a,02oct02,niq file creation +*/ + +/* +DESCRIPTION +This file includes function prototypes for the routing interface, as well +as the route entry structures. +*/ + +#ifndef _INCipRouteLibh +#define _INCipRouteLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include /* needed for route.h */ +#include /* RT_PROTO_SET and RT_PROTO_GET */ + +#include + +#ifdef VIRTUAL_STACK +#include +#endif /* VIRTUAL_STACK */ + +/* errnos */ + +#define S_ipRouteLib_INVALID_STATE (M_ipRouteLib | 1) +#define S_ipRouteLib_INVALID_PARAMS (M_ipRouteLib | 2) +#define S_ipRouteLib_BAD_GATEWAY (M_ipRouteLib | 3) + +#define MAX_ROUTE_PROTO 20 + +/* routeTag values understood by routing protocols */ +#define RFC1745_DEFAULT_ROUTE_TAG 0x0000 /* manual/default route */ +#define RFC1745_CONF_EXTERNAL_ROUTE_TAG 0x8000 /* configured external routes + * IP static to OSPF and BGP + */ +#define RFC1745_EGP_ORIGEGP_ROUTE_TAG 0x9000 /* BGP routes reached via OSPF + */ +#define RFC1745_STUB_ASBR_BGP_ROUTE_TAG 0xa000 /* BGP routes at ASBR to STUB + * AS + */ +#define RFC1745_IGP_TO_OSPF_ROUTE_TAG 0xc000 /* IGP dynamic routes */ +#define RFC1745_EGP_ORIGIGP_ROUTE_TAG_PER_AS 0xd000 /* BGP routes with orig IGP, + * next hop AS + */ +#define RFC1745_BGP_TO_OSPF_ROUTE_TAG 0xe000 /* BGP origin */ + +/* Definitions for route usage. A routing table can exist for each usage type*/ +#define ROUTE_USAGE_IPV4 0 +#define ROUTE_USAGE_IPV6 1 + +#ifdef INET6 +#define ROUTE_USAGES_MAX ROUTE_USAGE_IPV6 +#else +#define ROUTE_USAGES_MAX ROUTE_USAGE_IPV4 +#endif /* INET6 */ + +#define ROUTE_USAGE_IS_INVALID(x) ((ULONG)x > ROUTE_USAGES_MAX) + +/* + * Definitions for the routeFormat field. The higher 16 bits represent + * the route usage and the lower 16 bits the actual format + */ + +/* Definitions for route source. Used in the ipRouteCreate call */ +#define ROUTE_MIB 0 /* metrics only in pRouteData */ +#define ROUTE_KERNEL 1 /* static routes: additional data is NULL */ + /* cloned routes: metrics and parent route */ +#define ROUTE_SOCKET 2 /* route sockets: metrics and genmask */ + +#define RS_MAX 2 +#define RS_IS_INVALID(x) ((ULONG)x > RS_MAX) +#define RT_REDIRECT_SRC 1 /* Used only for ipRouteModify */ + +/* Configuration parameters for the route library */ +struct ipRouteConfigParams + { + CFG_DATA_HDR cfgh; + u_char routeDefaultWeight;/* Default route weight */ + }; +typedef struct ipRouteConfigParams IP_ROUTE_CONFIG_PARAMS_T; + +/* Definition for the route usage structure */ +typedef struct ipRouteUsage + { + ULONG routeUsage; /* IPv4, IPv6 etc. */ + struct ipRouteDispatchTable *pRibDispTbl; /* Pointer to dispatch table */ + void * pRibCookie; /* RIB cookie */ + long numRoutes; /* Number of routes */ + +#ifdef FINEGRAIN_LOCKING_MODEL + ULONG rdLockTid; /* Owner of Rd lock */ + ULONG walkLockTid; /* Owner of Walk lock */ + +#ifdef DEBUG + int rdlockCnt; + int walklockCnt; + int wrlockCnt; + char rdlockBuf[80]; + char rdunlockBuf[80]; + char walklockBuf[80]; + char walkunlockBuf[80]; + char wrlockBuf[80]; + char wrunlockBuf[80]; +#endif + +#endif /* FINEGRAIN_LOCKING_MODEL */ + + } IP_ROUTE_USAGE_T; +typedef IP_ROUTE_USAGE_T * IP_ROUTE_USAGE_ID; + + +/* Values for rtmFlags field of the struct rtentry structure */ +#define ROUTE_PROXY_ARP 0x01 + +/* + * The following macros are used to access fields within the rtentry + * structure. Using macros to access fields allows the freedom to rename + * or rearrange fields (across any sub-structures) + */ +#define ROUTE_GATEWAY(x) ((x)->rt_gateway) +#define ROUTE_AGE(x) ((x)->rt_mod) +#define ROUTE_PRIMARYFLAG(x) ((x)->rt_flags & RTF_PRIMARY) +#define CLR_ROUTE_PRIMARY_FLAG(x) ((x)->rt_flags &= ~RTF_PRIMARY) +#define SET_ROUTE_PRIMARY_FLAG(x) ((x)->rt_flags |= RTF_PRIMARY) +#define ROUTE_PROXY_ARP_FLAG(x) ((x)->rtmFlags & ROUTE_PROXY_ARP) +#define RREFCNT(x) ((x)->rt_refcnt) +#define RTM_FLAGS(x) ((x)->rtmFlags) +#define RFLAGS(x) ((x)->rt_flags) +#define ROUTE_IFA(x) ((x)->rt_ifa) +#define ROUTE_IFP(x) ((x)->rt_ifp) +#define ROUTE_METRICS(x) ((x)->rt_rmx) +#define ROUTE_PARENT(x) ((x)->rt_parent) +#define ROUTE_GWROUTE(x) ((x)->rt_gwroute) +#define ROUTE_GENMASK(x) ((x)->rt_genmask) +#define ROUTE_OUTPUT(x) ((x)->rt_output) + +#ifdef ROUTER_STACK +#define ROUTE_WEIGHT(x) ((x)->rt_rmx.weight) +#else +#define ROUTE_WEIGHT(x) 0 +#endif /* ROUTER_STACK */ + +#define ROUTE_TOS(x) ((x)->routeTos) +#define ROUTE_OWNER(x) ((x)->routeOwner) + +#define ROUTE_PROTO(x) ROUTE_OWNER(x) + +/* + * Macro for freeing the route entry. It checks if there is more than one + * active reference. If so, the reference count is decremented. If there + * are <= 1 active references, the entry is freed. The reference count + * on a newly created entry is zero. If anyone retrieves the entry, + * the reference count is bumped up. Note that the reference count + * is not expected to be negative. We catch that in the ipRouteFree + * routine. This routine is meant to be called only on entries that + * are (or were) in the route table. Also the caller is expected to hold + * the appropriate locks. + */ + +#define _RTFREE(x) \ + do \ + { \ + if (RREFCNT (x) <= 1) \ + ipRouteFree (x, TRUE); \ + else \ + --(RREFCNT (x)); \ + } while (0) + +/* Structure for specifying new metrics in the ipRouteModify call */ +struct changeMetrics + { + BOOL setMetrics; /* update metrics too or just update */ + /* the locks */ + u_long cm_inits; /* which metrics are we changing */ + struct rt_metrics cm_rmx; /* metrics themselves */ + }; + +#define ARP_ROUTE(pRoute) \ + ((pRoute)->rt_gateway->sa_family == AF_LINK && \ + (RFLAGS ((pRoute)) & RTF_LLINFO)) + +/* + * This macro is used to detect routes that had their gateway changed to + * an ARP template by the internal route processing. The RTF_LOCAL is used + * to detect loopback IPv6 routes which are added with a RTF_LINFO flag + */ + +#define INTERFACE_ROUTE(pRoute) \ + ((pRoute)->rt_gateway->sa_family == AF_LINK && \ + (!(RFLAGS ((pRoute)) & RTF_LLINFO) || \ + (RFLAGS ((pRoute)) & RTF_LOCAL))) + +#define GET_INTERFACE_ADDR(pRoute) ((ROUTE_IFA (pRoute))->ifa_addr) + +/* These macros return the protocol address for the given sockaddr */ +#define SOCKADDR_IN(s) (((struct sockaddr_in *)(s))->sin_addr.s_addr) +#define IP4ADDR(pAddr) ((ULONG *) &(SOCKADDR_IN(pAddr))) + +#ifdef INET6 +#define SOCKADDR_IN6(s) (((struct sockaddr_in6 *)(s))->sin6_addr) +#define SA6(s) (((struct sockaddr_in6 *)(s))->sin6_addr) +#define IP6ADDR(pAddr) ((ULONG *) &(SOCKADDR_IN6(pAddr))) + +/* This macro checks if the given IPv6 addr is all zeros */ + +#define IP6_ADDR_IS_ZERO(s) (SA6(s).s6_addr32[0] == 0 && \ + SA6(s).s6_addr32[1] == 0 && \ + SA6(s).s6_addr32[2] == 0 && \ + SA6(s).s6_addr32[3] == 0) +#define IPADDR_IS_ZERO(s) \ + ((s)->sa_family == AF_INET ? \ + ((s)->sa_len <= (u_char)IP4ADDR (0) || SOCKADDR_IN (s) == 0) : \ + ((s)->sa_len <= (u_char)IP6ADDR (0) || IP6_ADDR_IS_ZERO (s))) + +/* This macro checks if the given IPv6 addr is all ones */ + +#define IP6_ADDR_IS_ALLONES(s) (SA6(s).s6_addr32[0] == 0xffffffff && \ + SA6(s).s6_addr32[1] == 0xffffffff && \ + SA6(s).s6_addr32[2] == 0xffffffff && \ + SA6(s).s6_addr32[3] == 0xffffffff) +#define IPADDR_IS_ALLONES(s) \ + ((s)->sa_family == AF_INET ? SOCKADDR_IN (s) == 0xffffffff : \ + IP6_ADDR_IS_ALLONES (s)) +#else /* INET6 */ + +#define IPADDR_IS_ZERO(s) \ + ((s)->sa_len <= (u_char)IP4ADDR (0) || SOCKADDR_IN (s) == 0) +#define IPADDR_IS_ALLONES(s) (SOCKADDR_IN (s) == 0xffffffff) + + +#endif /* INET6 */ + +#ifdef DEBUG_CHECKS +#ifdef INET6 +/* + * The following macro returns a pointer to the start of the IP address + * given the sockaddr structure. For unrecognized address families + * it calls panic + */ +#define IPADDR(pAddr) (pAddr->sa_family == AF_INET ? IP4ADDR (pAddr) :\ + (pAddr->sa_family == AF_INET6 ? IP6ADDR (pAddr) : \ + (ULONG *) (panic("BAD address family: %d %x @ %s:%d\n", \ + pAddr->sa_family, pAddr, \ + __FILE__, __LINE__),\ + NULL))) + +#else /* INET6 */ +/* + * The following macro returns a pointer to the start of the IP address + * given the sockaddr structure. For unrecognized address families + * it calls panic + */ + +#define IPADDR(pAddr) (pAddr->sa_family == AF_INET ? IP4ADDR (pAddr) : \ + (ULONG *) (panic ("BAD address family: %d %x @ %s:%d\n", \ + pAddr->sa_family, pAddr, \ + __FILE__, __LINE__), \ + NULL)) + +#endif /* INET6 */ +#else /* DEBUG_CHECKS */ +#ifdef INET6 +/* + * The following macro returns a pointer to the start of the IPv4 or IPv6 + * address within a sockaddr structure. It silently ignores unrecognized + * address families, since debugging is not enabled. + */ +#define IPADDR(pAddr) ((pAddr)->sa_family == AF_INET ? \ + (ULONG *) &(SOCKADDR_IN((pAddr))) : \ + (ULONG *) &(SOCKADDR_IN6((pAddr)))) + +#else /* INET6 */ +/* + * The following macro returns a pointer to the start of the IPv4 address + * within a sockaddr structure. It silently ignores unrecognized address + * families, since debugging is not enabled. + */ + +#define IPADDR(pAddr) ((ULONG *) &(SOCKADDR_IN((pAddr)))) + +#endif /* INET6 */ +#endif /* DEBUG_CHECKS */ + +/* external function declarations */ +#ifdef VIRTUAL_STACK +extern VS_REG_ID ipRouteRegistrationNum; +#endif /* VIRTUAL_STACK */ +extern IP_ROUTE_CONFIG_PARAMS_T ipRouteDefaultConfigParams; + +struct ipRouteDispatchTable; + +/* Administrative functions */ +STATUS ipRouteLibInit __P ((void)); +STATUS ipRouteLibInstInit __P ((void *pRouteConfigParams)); +STATUS ipRouteLibShutdown __P (()); +#ifdef VIRTUAL_STACK +STATUS ipRouteLibDestructor __P ((VSNUM vsnum)); +#endif /* VIRTUAL_STACK */ +STATUS ipRouteTableSet __P ((ULONG routeUsage, + struct ipRouteDispatchTable * pRibOps)); +STATUS ipRouteTableCreate __P ((ULONG routeUsage)); +STATUS ipRouteTablesCreate __P ((void)); +STATUS ipRouteTableDestroy __P ((ULONG routeUsage)); +STATUS ipRouteTableShow __P ((int routeUsage)); + +/* Core functions - Route creation, deletion, modification, retrieval, free */ +STATUS ipRouteCreate __P ((struct sockaddr * pDstAddr, + struct sockaddr * pNetmask, + struct sockaddr * pGateway, ULONG routeIndex, + ULONG routeTos, ULONG routeOwner, ULONG routeSource, + ULONG routeFormat, UCHAR routeWeight, + ULONG routeFlags, void * pRouteData, + void * pCustomData, struct rtentry **ppRtEntry)); +STATUS ipRouteDelete __P ((struct sockaddr * pDstAddr, + struct sockaddr * pNetmask, + struct sockaddr * pGateway, long routeTos, + ULONG routeOwner, ULONG routeFormat)); +STATUS ipIntRouteDelete __P ((struct sockaddr * pDstAddr, + struct sockaddr * pNetmask, + struct sockaddr * pGateway, long routeTos, + ULONG routeOwner, ULONG routeFormat, + struct rt_msghdr *pRtm)); +struct rtentry * ipRouteGet __P ((struct sockaddr * pDstAddr, + struct sockaddr * pGateway, long routeTos, + ULONG routeOwner, ULONG routeFormat, + BOOL skipFlag)); +struct rtentry * ipRouteLookup __P ((struct sockaddr * pDstAddr, + struct sockaddr * pNetmask, + struct sockaddr * pGateway, long routeTos, + ULONG routeOwner, ULONG routeFormat)); +struct rtentry * ipRouteLexGet __P ((struct sockaddr * pDstAddr, + struct sockaddr * pNetmask, + struct sockaddr * pGateway, ULONG routeTos, + ULONG indexType, ULONG routeFormat)); +struct rtentry * ipRouteLexNextGet __P ((struct sockaddr * pDstAddr, + struct sockaddr * pNetmask, + struct sockaddr * pGateway, + ULONG * pTos, ULONG indexType, + ULONG routeFormat)); +STATUS ipRouteModify __P ((struct sockaddr * pDstAddr, + struct sockaddr * pNetmask, + struct sockaddr * pGateway, ULONG routeIndex, + long routeTos, ULONG routeOwner, ULONG routeSource, + ULONG routeFormat, struct sockaddr * pNewGateway, + UCHAR * pNewWeight, ULONG * pNewFlags, + void * pNewRouteData, void * pNewCustomData)); +STATUS ipIntRouteModify __P ((struct sockaddr * pDstAddr, + struct sockaddr * pNetmask, + struct sockaddr * pGateway, ULONG routeIndex, + long routeTos, ULONG routeOwner, + ULONG routeSource, ULONG routeFormat, + struct sockaddr * pNewGateway, + UCHAR * pNewWeight, ULONG * pNewFlags, + void * pNewRouteData, void * pNewCustomData, + struct rt_msghdr *pRtm)); +void ipRouteUnlock __P ((struct rtentry * pRoute)); +void ipRouteLock __P ((struct rtentry * pRoute)); +void ipRouteUnlockOrDelete __P ((struct rtentry * pRoute)); +STATUS ipRouteNumRoutesGet __P ((int routeUsage)); + +/* Support functions - needed by other parts of the code */ +STATUS ipRouteTableWalk __P ((ULONG routeUsage, + void (* pFunc )(struct rtentry * rt, void * pArg), + void * pArg)); +struct rtentry * ipRouteMatch __P ((struct rtentry * pRoute, + struct sockaddr * pGateway, long routeTos, + ULONG routeOwner)); +int rt_setgate __P ((struct rtentry *rt, struct sockaddr * pDstAddr, + struct sockaddr * pGate)); +void ipRouteNetmaskTrim (int routeFormat, struct sockaddr * pNetmask); +#ifdef __cplusplus +} +#endif + +#endif /* _INCrouteEnhLibh */ diff --git a/h/wrn/coreip/route/ipRouteNodeData.h b/h/wrn/coreip/route/ipRouteNodeData.h new file mode 100644 index 0000000..ff52dce --- /dev/null +++ b/h/wrn/coreip/route/ipRouteNodeData.h @@ -0,0 +1,52 @@ +/* ipRouteNodeData.h - data structures for the IP routing information base */ + +/* Copyright 1984 - 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,24feb05,spm performance updates and code cleanup (SPR #100995) +01c,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE +01b,09oct02,spm added field for private RIB data +01a,09aug02,spm written +*/ + +/* +DESCRIPTION +This file includes route entry structures for an implementation of +the Routing Information Base component that supports IP. The IP RIB +provides a generic interface for data structures that organize route +entries into RIB nodes according to the destination address and netmask +values. This file also defines macros to retrieve those values from +within the private data structures. + +All RIB implementations must use the common fields from the ribNode +structure defined in this include file at the start of every allocated +RIB node. +*/ + +#ifndef _INCipRouteNodeDatah +#define _INCipRouteNodeDatah + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ipRouteNode + { + struct sockaddr * pDest; /* "public" RTM address with family/length */ + struct sockaddr * pNetmask; /* "public" RTM netmask with family/length */ + + void * pRibEntry; /* Private RIB data: gets internal data structure */ + ULONG * pAddress; /* Pointer to IPv4 or IPv6 address bytes in pDest */ + ULONG prefix; /* IPv6 prefix length or full IPv4 netmask */ + void * pRtmEntry; /* Private data for RTM: provides list of entries */ + } IP_ROUTE_NODE; + +typedef struct ipRouteNode * IP_NODE_ID; + +#ifdef __cplusplus +} +#endif + +#endif /* _INCipRouteNodeDatah */ diff --git a/h/wrn/coreip/route/ipRouteNodeLib.h b/h/wrn/coreip/route/ipRouteNodeLib.h new file mode 100644 index 0000000..87dfcef --- /dev/null +++ b/h/wrn/coreip/route/ipRouteNodeLib.h @@ -0,0 +1,160 @@ +/* ipRouteNodeLib.h - public routines for the IP routing information base */ + +/* Copyright 1984 - 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,24feb05,spm performance updates and code cleanup (SPR #100995) +01f,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE +01e,10nov03,cdw Rebase from base6 iteration 1 view +01d,04nov03,rlm Ran batch header path update for header re-org. +01c,15sep03,vvv updated path for new headers +01b,15oct02,niq pass the Cookie argument to the lock/unlock calls +01a,09aug02,spm written +*/ + +/* +DESCRIPTION +This file defines the route entry dispatch table for an implementation +of the Routing Information Base component that supports IP. All RIB +implementations must use this dispatch table definition to supply the +required route operations. + +The IP RIB organizes route entries into RIB nodes according to the +destination address and netmask values. Each RIB node stores a common +copy of those two values for all attached routes. + +This file defines macros to use the routines in the dispatch table and +to retrieve the common data without introducing symbolic dependencies on +any internal data types. The IP Routing Table Manager is the only component +permitted to use the macros defined in this file. +*/ + +#ifndef _INCipRouteNodeLibh +#define _INCipRouteNodeLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "semLib.h" +#include +#include + +struct ipRouteDispatchTable + { + struct ipRibHead * (* ribCreate) (ULONG routeFormat); + STATUS (* ribDestroy) (struct ipRibHead * pRibHead); + struct ipRouteNode * (* ribNodeAdd) (struct ipRibHead * pRibHead, + struct sockaddr * pDstAddr, + struct sockaddr * pNetmask, + void * pRouteEntry, int * pNew); + STATUS (* ribNodeDelete) (struct ipRibHead * pRibHead, + struct ipRouteNode * pRibNode); + struct ipRouteNode * (* ribNodeBestMatch) (struct ipRibHead * pRibHead, + struct sockaddr * pDstAddr); + struct ipRouteNode * (* ribNodeExactMatch) (struct ipRibHead * pRibHead, + struct sockaddr * pDstAddr, + struct sockaddr * pNetmask); + struct ipRouteNode * (* ribNodeLessSpecGet) (struct ipRibHead * pRibHead, + struct ipRouteNode * pRibNode); + struct ipRouteNode * (* ribNodeLexNextGet) (struct ipRibHead * pRibHead, + struct sockaddr * pDstAddr, + struct sockaddr * pNetmask, + ULONG indexType); + struct ipRouteNode * (* ribNodeLexNextRepeat) + (struct ipRibHead * pRibHead, + struct ipRouteNode * pRibNode); + STATUS (* ribLock) (struct ipRibHead * pRibHead, int lockType); + STATUS (* ribUnlock) (struct ipRibHead * pRibHead, int lockType); + }; + +struct ipRibHead + { + struct ipRouteDispatchTable * pIpRouteDispatchTable; + SEM_ID readLock1; /* + * mutual exclusion for basic operations: + * add, delete, modify, and isolated lookup. + */ + + SEM_ID readLock2; /* mutual exclusion for table traversal */ + }; + +typedef struct ipRibHead * IP_RIB_ID; + +/* Macros for data items: see ipRouteNode structure */ + +#define RIB_IPADDR_GET(pRibNode) (pRibNode->pDest) + +#define RIB_NETMASK_GET(pRibNode) (pRibNode->pNetmask) + +#define RIB_RTM_ENTRY_GET(pRibNode) (pRibNode->pRtmEntry) + +#define RIB_RTM_ENTRY_SET(pRibNode, pRtEntry) \ + (pRibNode->pRtmEntry = pRtEntry) + +/* Macro for RIB creation/setup: sole use of different type for functions */ + +#define RIB_CREATE(pIpRouteDispatchTable, routeFormat) \ + (pIpRouteDispatchTable->ribCreate (routeFormat)) + +#define RIB_DESTROY(pRibCookie) \ + ( ((struct ipRibHead *) (pRibCookie))->pIpRouteDispatchTable-> \ + ribDestroy (pRibCookie)) + +/* Macros for route operations: see dispatch table */ + +#define RIB_NODE_ADD(pRibCookie, pDstAddr, pNetmask, pRouteEntry, pNew) \ + ( ((struct ipRibHead *) (pRibCookie))->pIpRouteDispatchTable-> \ + ribNodeAdd (pRibCookie, pDstAddr, pNetmask, pRouteEntry, pNew)) + +#define RIB_NODE_DELETE(pRibCookie, pIpRouteNode) \ + ( ((struct ipRibHead *) (pRibCookie))->pIpRouteDispatchTable-> \ + ribNodeDelete (pRibCookie, pIpRouteNode)) + +#define RIB_NODE_BEST_MATCH(pRibCookie, pDstAddr) \ + ( ((struct ipRibHead *) (pRibCookie))->pIpRouteDispatchTable-> \ + ribNodeBestMatch (pRibCookie, pDstAddr)) + +#define RIB_NODE_EXACT_MATCH(pRibCookie, pDstAddr, pNetmask) \ + ( ((struct ipRibHead *) (pRibCookie))->pIpRouteDispatchTable-> \ + ribNodeExactMatch (pRibCookie, pDstAddr, pNetmask)) + +#define RIB_NODE_LESS_SPEC_GET(pRibCookie, pIpRouteNode) \ + ( ((struct ipRibHead *) (pRibCookie))->pIpRouteDispatchTable-> \ + ribNodeLessSpecGet (pRibCookie, pIpRouteNode)) + +#define RIB_NODE_LEX_NEXT_GET(pRibCookie, pDstAddr, pNetmask, indexType) \ + ( ((struct ipRibHead *) (pRibCookie))->pIpRouteDispatchTable-> \ + ribNodeLexNextGet (pRibCookie, pDstAddr, pNetmask, indexType)) + +#define RIB_NODE_LEX_NEXT_REPEAT(pRibCookie, pIpRouteNode) \ + ( ((struct ipRibHead *) (pRibCookie))->pIpRouteDispatchTable-> \ + ribNodeLexNextRepeat (pRibCookie, pIpRouteNode)) + +#define RIB_LOCK(pRibCookie, lockType) \ + ( ((struct ipRibHead *) (pRibCookie))->pIpRouteDispatchTable-> \ + ribLock (pRibCookie, lockType)) + +#define RIB_UNLOCK(pRibCookie, lockType) \ + ( ((struct ipRibHead *) (pRibCookie))->pIpRouteDispatchTable-> \ + ribUnlock (pRibCookie, lockType)) + +/* Values for parameters of registered routines */ + +#define RIB_LOCK_1 1 /* First read lock: for "standard" searches */ +#define RIB_LOCK_2 2 /* Second read lock: for lexical searches */ +#define RIB_DUAL_LOCK 3 /* Obtain both locks for add/delete operations */ + +#define RIB_FORMAT_IPV4 4 /* IPv4 routes: 4 byte address/4 byte netmask */ +#define RIB_FORMAT_IPV6 6 /* IPv6 routes: 16 byte address/1 byte prefix */ + +#define ROUTE_MIB_1213 1 /* RFC 1213 MIB: address is only index value */ +#define ROUTE_MIB_2096 2 /* RFC 2096 MIB: netmask is available as index */ + +#ifdef __cplusplus +} +#endif + +#endif /* _INCipRouteNodeLibh */ diff --git a/h/wrn/coreip/route/llRouteNodeLib.h b/h/wrn/coreip/route/llRouteNodeLib.h new file mode 100644 index 0000000..5228c33 --- /dev/null +++ b/h/wrn/coreip/route/llRouteNodeLib.h @@ -0,0 +1,73 @@ +/* llRouteNodeLibh - VxWorks linked list definitions for the IP RIB */ + +/* Copyright 1984 - 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,07apr05,spm converted for actual usage from test case +01c,04nov03,rlm Ran batch header path update for header re-org. +01b,15sep03,vvv updated path for new headers +01a,09aug02,spm written +*/ + +/* +DESCRIPTION +This file includes the route entry structures for an implementation of +the IP Routing Information Base component that uses the native VxWorks +lstLib implementation of a linked list. +*/ + +#ifndef _INCllRouteNodeLibh +#define _INCllRouteNodeLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include /* for sockaddr_in definition */ + +#include "lstLib.h" + +struct llRouteNode + { + struct ipRouteNode ribNodeEntry; /* Required common header for RIB */ + NODE neighbors; /* Adjacent route entries, if any. */ + struct ipRouteNode * pNodeId; /* Public identifier for RIB node. */ + }; + +struct llRibHead + { + struct ipRibHead llRibHead; /* Required common structure */ + LIST ipRouteList; + }; + +/* + * This structure allows private access to the address and netmask in the + * llRouteNode structure. The add operation uses it to search for an existing + * node with a particular destination and netmask. This alternate definition + * avoids the impossible requirement of accessing the previous field in the + * llRouteNode structure when starting with the NODE member. + */ + +struct ipListRouteNode + { + NODE neighbors; + struct ipRouteNode * pNodeId; + }; + +#define ROUTE_ENTRY_NODE_ID(pIpListRouteNode) \ + ( ((struct ipListRouteNode *) (pIpListRouteNode))->pNodeId) + +#define ROUTE_ENTRY_ADDRESS(pIpListRouteNode) \ + ( *((struct ipListRouteNode *) (pIpListRouteNode))->pNodeId->pAddress) + +#define ROUTE_ENTRY_NETMASK(pIpListRouteNode) \ + ( ((struct ipListRouteNode *) (pIpListRouteNode))->pNodeId->prefix) + +#ifdef __cplusplus +} +#endif + +#endif /* _INCllRouteNodeLibh */ diff --git a/h/wrn/coreip/route/ptRouteNodeLib.h b/h/wrn/coreip/route/ptRouteNodeLib.h new file mode 100644 index 0000000..a28885f --- /dev/null +++ b/h/wrn/coreip/route/ptRouteNodeLib.h @@ -0,0 +1,100 @@ +/* ptRouteNodeLibh - Patricia tree definitions for the IP RIB */ + +/* Copyright 1984 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE +01f,10nov03,cdw Rebase from base6 iteration 1 view +01e,05nov03,cdw Removal of unnecessary _KERNEL guards. +01d,04nov03,rlm Ran batch header path update for header re-org. +01c,15sep03,vvv updated path for new headers +01b,17oct02,spm replaced private globals to permit multiple tree instances +01a,09oct02,spm written +*/ + +/* +DESCRIPTION +This file includes the route entry structures for an implementation of +the IP Routing Information Base component that uses the Patricia tree +algorithm. +*/ + +#ifndef _INCptRouteNodeLibh +#define _INCptRouteNodeLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +IMPORT struct ipRouteDispatchTable ptRibDispatchTable; + +struct ptRouteNode + { + struct radix_node rt_nodes [2]; /* Internal and leaf nodes for tree */ + ULONG netmask; /* netmask/prefix length */ + struct ipRouteNode ribNodeEntry; /* Required common header for RIB */ + }; + +struct ptRibHead + { + struct ipRibHead ribHead; /* Required common structure */ + struct radix_node_head * pRadixHead; /* Dispatch table and data for PT */ + struct radix_node_head * pMaskHead; /* Shared storage for netmasks */ + char * pPrivateData; /* Temporary mask and boundary keys */ + + ULONG routeFormat; /* supported route format, determines key size. */ + ULONG readLock1Id; /* task holding lock for basic operations */ + ULONG readLock2Id; /* task holding lock for table traversal */ + ULONG readLock1Count; /* number of active locks within task */ + ULONG readLock2Count; + }; + +/* Macros to access some Patricia tree routines and the root node. */ + +#define PT_RADIX_HEAD(pRibHead) \ + (( (struct ptRibHead *) (pRibHead))->pRadixHead) + +#define RADIX_NODE_ADD(pRibHead) \ + PT_RADIX_HEAD(pRibHead)->rnh_addaddr + +#define RADIX_NODE_DELETE(pRibHead) \ + PT_RADIX_HEAD(pRibHead)->rnh_deladdr + +#define RADIX_NODE_MATCH(pRibHead) \ + PT_RADIX_HEAD(pRibHead)->rnh_matchaddr + +#define RADIX_NODE_LOOKUP(pRibHead) \ + PT_RADIX_HEAD(pRibHead)->rnh_lookup + +#define PT_ROOT_NODE(pRibHead) \ + PT_RADIX_HEAD(pRibHead)->rnh_treetop + +/* Macros for some fields of the ptRouteNode structure */ + +#define PT_RADIX_DATA_NODE(pIpRouteNode) \ + ( ((struct ptRouteNode *) (pIpRouteNode))->rt_nodes[0]) + +#define ROUTE_ENTRY_KEY(pIpRouteNode) \ + (PT_RADIX_DATA_NODE(pIpRouteNode).rn_u.rn_leaf.rn_Key) + + /* + * The PT implementation uses nodes within a separate tree + * to store netmask values in a specific internal format. + * Any RIB implementation also stores netmask values in a + * predefined public format, accessible with the RIB_NETMASK_GET + * macro. + */ + +#define ROUTE_ENTRY_MASK_NODE(pIpRouteNode) \ + (PT_RADIX_DATA_NODE(pIpRouteNode).rn_u.rn_leaf.rn_Mask) + +#ifdef __cplusplus +} +#endif + +#endif /* _INCptRouteNodeLibh */ diff --git a/h/wrn/coreip/routeLib.h b/h/wrn/coreip/routeLib.h new file mode 100644 index 0000000..ccb97d2 --- /dev/null +++ b/h/wrn/coreip/routeLib.h @@ -0,0 +1,66 @@ +/* routeLib.h - header file for the network routing library */ + +/* Copyright 1987-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02m,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +02l,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +02k,20nov03,niq Remove copyright_wrs.h file inclusion +02j,05nov03,cdw Removal of unnecessary _KERNEL guards. +02i,04nov03,rlm Ran batch header path update for header re-org. +02h,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +02g,19dec01,hgo modification of header files +02f,26jun98,spm added mRouteEntryDelete prototype +02e,10jul97,rjc added flag param to mRouteDelete. +02d,11apr97,rjc changed interface of m2RouteEntryAdd +i02c,14feb97,rjc added mask versions of route add etc +02d,11jul94,dzb added prototype for routeNetAdd() (SPR #3395). +02c,22sep92,rrr added support for c++ +02b,27jul92,elh moved routeShow to netShow. +02a,04jul92,jcf cleaned up. +01g,26may92,rrr the tree shuffle +01f,02mar92,elh added routeCmd. +01e,04oct91,rrr passed through the ansification filter + -changed VOID to void + -changed copyright notice +01d,05oct90,shl added ANSI function prototypes. + added copyright notice. +01c,07aug90,shl added IMPORT type to function declarations. +01b,16nov87,llk documentation +01a,01nov87,llk written +*/ + +#ifndef __INCrouteLibh +#define __INCrouteLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* status codes */ + +#define S_routeLib_ILLEGAL_INTERNET_ADDRESS (M_routeLib | 1) +#define S_routeLib_ILLEGAL_NETWORK_NUMBER (M_routeLib | 2) + +/* function declarations */ + +extern STATUS routeAdd (char *destination, char *gateway); +extern STATUS routeDelete (char *destination, char *gateway); +extern STATUS routeNetAdd (char *destination, char *gateway); +extern STATUS routeCmd (int destInetAddr, int gateInetAddr, int ioctlCmd); +extern STATUS mRouteAdd (char *, char *, long, int, int); +extern STATUS mRouteEntryAdd (long , long, long, int, int, int); +extern STATUS mRouteEntryDelete (long , long, long, int, int, int); +extern STATUS mRouteDelete (char *, long, int, int); +extern void oldRouteLibInit(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrouteLibh */ diff --git a/h/wrn/coreip/rtadv/rtadvd.h b/h/wrn/coreip/rtadv/rtadvd.h new file mode 100644 index 0000000..579f236 --- /dev/null +++ b/h/wrn/coreip/rtadv/rtadvd.h @@ -0,0 +1,242 @@ +/* rtadvd.h - Router Advertisement */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* $KAME: rtadvd.h,v 1.29 2005/04/01 06:04:37 suz Exp $ */ + +/* + * Copyright (C) 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * $FreeBSD: src/usr.sbin/rtadvd/rtadvd.h,v x.x.x.x xxxx/xx/xx xx:xx:xx xxxx Exp $ + */ + +/* +modification history +-------------------- +01f,14jul05,niq Remove unneeded extern +01e,20jun05,niq Kame update +01d,09apr04,spm fixed build failure: added missing include file +01c,18mar04,spm merged from Orion for MSP 3.0 baseline +01b,22aug02,kal increased stack size for T2.2 +01a,07feb01,ism initial port from FreeBSD +*/ + +#ifndef __INCrtadvdh +#define __INCrtadvdh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include /* for struct timeval definition */ + +#define ALLNODES "ff02::1" +#define ALLROUTERS_LINK "ff02::2" +#define ALLROUTERS_SITE "ff05::2" +#define ANY "::" +#define RTSOLLEN 8 + +/* protocol constants and default values */ +#define DEF_MAXRTRADVINTERVAL 600 +#define DEF_ADVLINKMTU 0 +#define DEF_ADVREACHABLETIME 0 +#define DEF_ADVRETRANSTIMER 0 +#define DEF_ADVCURHOPLIMIT 64 +#define DEF_ADVVALIDLIFETIME 2592000 +#define DEF_ADVPREFERREDLIFETIME 604800 + +#define MAXROUTERLIFETIME 9000 +#ifdef MIP6 +#define MINROUTERLIFETIME 12 +#define MIN_MAXMINTERVAL 70 +#define MAX_MAXMINTERVAL 1800000 +#define MIN_MINMINTERVAL 30 +#else +#define MIN_MAXINTERVAL 4 +#define MAX_MAXINTERVAL 1800 +#define MIN_MININTERVAL 3 +#endif +#define MAXREACHABLETIME 3600000 + +#define MAX_INITIAL_RTR_ADVERT_INTERVAL 16 +#define MAX_INITIAL_RTR_ADVERTISEMENTS 3 +#define MAX_FINAL_RTR_ADVERTISEMENTS 3 +#define MIN_DELAY_BETWEEN_RAS 3 +#define MAX_RA_DELAY_TIME 500000 /* usec */ + +#define PREFIX_FROM_KERNEL 1 +#define PREFIX_FROM_CONFIG 2 +#define PREFIX_FROM_DYNAMIC 3 + +/* taskSpawn parameters, ism start */ +#define RTADV_TASK_NAME "tRtAdv" +#define RTADV_PRI 100 +#define RTADV_OPT 0 +#define RTADV_SIZE 10000 +/* ism end */ + +/* size of buffer passed to strerror_t */ +#define RTADV_ERR_MSG_LEN 150 + +struct prefix { + struct prefix *next; /* forward link */ + struct prefix *prev; /* previous link */ + + struct rainfo *rainfo; /* back pointer to the interface */ + + struct rtadvd_timer *timer; /* expiration timer. used when a prefix + * derived from the kernel is deleted. + */ + + u_int32_t validlifetime; /* AdvValidLifetime */ + long vltimeexpire; /* expiration of vltime; decrement case only */ + u_int32_t preflifetime; /* AdvPreferredLifetime */ + long pltimeexpire; /* expiration of pltime; decrement case only */ + u_int onlinkflg; /* bool: AdvOnLinkFlag */ + u_int autoconfflg; /* bool: AdvAutonomousFlag */ +#ifdef MIP6 + u_int routeraddr; /* bool: RouterAddress */ +#endif + int prefixlen; + int origin; /* from kernel or config */ + struct in6_addr prefix; +}; + +#ifdef ROUTEINFO +struct rtinfo { + struct rtinfo *prev; /* previous link */ + struct rtinfo *next; /* forward link */ + + u_int32_t ltime; /* route lifetime */ + u_int rtpref; /* route preference */ + int prefixlen; + struct in6_addr prefix; +}; +#endif + +struct soliciter { + struct soliciter *next; + struct sockaddr_in6 addr; +}; + +struct rainfo { + /* pointer for list */ + struct rainfo *next; + + /* timer related parameters */ + struct rtadvd_timer *timer; + int initcounter; /* counter for the first few advertisements */ + struct timeval lastsent; /* timestamp when the latest RA was sent */ + int waiting; /* number of RS waiting for RA */ + + /* interface information */ + int ifindex; + int advlinkopt; /* bool: whether include link-layer addr opt */ + struct sockaddr_dl *sdl; + char ifname[16]; + int phymtu; /* mtu of the physical interface */ + + /* original values of Host variables in kernel */ + u_int orig_chlim; /* CurHopLimit */ + u_int orig_retrans; /* RetransTimer (msec) */ + u_int orig_basereachable; /* BaseReachable (msec) */ + + /* Router configuration variables */ + u_short lifetime; /* AdvDefaultLifetime */ +#ifdef MIP6 + u_int maxminterval; /* MaxRtrAdvInterval (unit msec) */ + u_int minminterval; /* MinRtrAdvInterval (unit msec) */ + u_int delaybetweenras; +#else + u_int maxinterval; /* MaxRtrAdvInterval */ + u_int mininterval; /* MinRtrAdvInterval */ +#endif + int managedflg; /* AdvManagedFlag */ + int otherflg; /* AdvOtherConfigFlag */ + +#ifdef MIP6 + int haflg; /* HAFlag */ +#endif + int rtpref; /* router preference */ + u_int32_t linkmtu; /* AdvLinkMTU */ + u_int32_t reachabletime; /* AdvReachableTime */ + u_int32_t retranstimer; /* AdvRetransTimer */ + u_int hoplimit; /* AdvCurHopLimit */ + struct prefix prefix; /* AdvPrefixList(link head) */ + int pfxs; /* number of prefixes */ + long clockskew; /* used for consisitency check of lifetimes */ + +#ifdef MIP6 + u_short hapref; /* Home Agent Preference */ + u_short hatime; /* Home Agent Lifetime */ +#endif +#ifdef ROUTEINFO + struct rtinfo route; /* route information option (link head) */ + int routes; /* number of route information options */ +#endif + + /* actual RA packet data and its length */ + size_t ra_datalen; + u_char *ra_data; + + /* statistics */ + u_quad_t raoutput; /* number of RAs sent */ + u_quad_t rainput; /* number of RAs received */ + u_quad_t rainconsistent; /* number of RAs inconsistent with ours */ + u_quad_t rsinput; /* number of RSs received */ + + /* info about soliciter */ + struct soliciter *soliciter; /* recent solication source */ +}; + +/* Removed __P () from function declarations, ism */ +struct rtadvd_timer * ra_timeout (void *); +void ra_timer_update (void *, struct timeval *); +int prefix_match (struct in6_addr *, int, struct in6_addr *, int); +struct rainfo *if_indextorainfo (int); +struct prefix *find_prefix (struct rainfo *, struct in6_addr *, int); + + +#ifndef VIRTUAL_STACK +#ifdef MIP6 +extern int rtadv_mobileip6; +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrtadvdh */ diff --git a/h/wrn/coreip/rtadv/timer.h b/h/wrn/coreip/rtadv/timer.h new file mode 100644 index 0000000..8a52032 --- /dev/null +++ b/h/wrn/coreip/rtadv/timer.h @@ -0,0 +1,98 @@ +/* timer.h - Router Advertisement */ + +/* + * Copyright (c) 2002-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* $KAME: timer.h,v 1.5 2002/05/31 13:30:38 jinmei Exp $ */ + +/* + * Copyright (C) 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * $FreeBSD: src/usr.sbin/rtadvd/timer.h,v x.x.x.x xxxx/xx/xx xx:xx:xx xxxx Exp $ + */ + +/* +modification history +-------------------- +01c,20jun05,niq Kame update +01b,18mar04,spm merged from Orion for MSP 3.0 baseline +01a,07feb02,ism initial port from FreeBSD +*/ + +#ifndef __INCtimerh +#define __INCtimerh + +#ifdef __cplusplus +extern "C" { +#endif + +/* a < b */ +#define TIMEVAL_LT(a, b) (((a).tv_sec < (b).tv_sec) ||\ + (((a).tv_sec == (b).tv_sec) && \ + ((a).tv_usec < (b).tv_usec))) + +/* a <= b */ +#define TIMEVAL_LEQ(a, b) (((a).tv_sec < (b).tv_sec) ||\ + (((a).tv_sec == (b).tv_sec) &&\ + ((a).tv_usec <= (b).tv_usec))) + +/* Removed __P () from all function declarations, ism */ +struct rtadvd_timer { + struct rtadvd_timer *next; + struct rtadvd_timer *prev; + struct rainfo *rai; + struct timeval tm; + + struct rtadvd_timer *(*expire) (void *); /* expiration function */ + void *expire_data; + void (*update) (void *, struct timeval *); /* update function */ + void *update_data; +}; + +void rtadvd_timer_init (void); +struct rtadvd_timer *rtadvd_add_timer (struct rtadvd_timer *(*) (void *), + void (*) (void *, struct timeval *), void *, void *); +void rtadvd_set_timer (struct timeval *, struct rtadvd_timer *); +void rtadvd_remove_timer (struct rtadvd_timer **); +struct timeval * rtadvd_check_timer (void); +struct timeval * rtadvd_timer_rest (struct rtadvd_timer *); +void TIMEVAL_ADD (struct timeval *, struct timeval *, + struct timeval *); +void TIMEVAL_SUB (struct timeval *, struct timeval *, + struct timeval *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtimerh */ + diff --git a/h/wrn/coreip/rtadvLib.h b/h/wrn/coreip/rtadvLib.h new file mode 100644 index 0000000..1155ee5 --- /dev/null +++ b/h/wrn/coreip/rtadvLib.h @@ -0,0 +1,62 @@ +/* rtadvLib.h - Router Advertisement for IPv6 */ + +/* Copyright 1992 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,15mar04,rp merged from orion +01g,05nov03,cdw Removal of unnecessary _KERNEL guards. +01f,04nov03,rlm Ran batch header path update for header re-org. +01e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01d,06aug03,nee Accordion Base6 merge from ACCORDION_BASE6_MERGE_BASELINE + label +01c,10jun03,vvv include netVersion.h +01b,11Jul02,ism added dynamic configuration function prototypes +01a,02Apr02,kal written. +*/ + +#ifndef __INCrtadvLibh +#define __INCrtadvLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include + +typedef struct rtadv_config_params { + CFG_DATA_HDR cfgh; + + /* only used for parameter string */ + + char *cfg_pParameterStr; + } RTADV_CONFIG_PARAMS; + +#if defined(__STDC__) || defined(__cplusplus) + +extern int rtadv (char *options); +extern void rtadv_stop (void); +extern STATUS set_rtadv_conf(const char *capstr, int append); +extern void clr_rtadv_conf(void); +extern STATUS remove_rtadv_conf (char *ifname); +extern void print_rtadv_conf (char *ifname); + +#else /* __STDC__ */ + +extern int rtadv (); +extern void rtadv_stop (); +extern STATUS set_rtadv_conf(); +extern void clr_rtadv_conf(); +extern STATUS remove_rtadv_conf (); +extern void print_rtadv_conf (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrtadvLibh */ diff --git a/h/wrn/coreip/rtpAppCmdLib.h b/h/wrn/coreip/rtpAppCmdLib.h new file mode 100644 index 0000000..6e614bd --- /dev/null +++ b/h/wrn/coreip/rtpAppCmdLib.h @@ -0,0 +1,41 @@ +/* rtpAppCmdLib.h - definitions for the RTP applications command library */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01b,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/2) +01a,09feb04,niq file creation +*/ + +/* +DESCRIPTION +This file includes function prototypes and definitions for the RTP applications +command helper library. +*/ + +#ifndef _INCrtpAppCmdLibh +#define _INCrtpAppCmdLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include + +/* typedefs */ +typedef SAL_RTN_STATUS (*SAL_READ_FNPTR)(int sockfd, void *pData); + +/* external function declarations */ +void * rtpCommandHandlerSpawn (char *pAppId, SAL_READ_FNPTR pDispFunc); +STATUS rtpCommandHandlerStop (char *pAppId, void *pCookie); + +#ifdef __cplusplus +} +#endif + +#endif /* _INCrtpAppCmdLibh */ diff --git a/h/wrn/coreip/rtsolLib.h b/h/wrn/coreip/rtsolLib.h new file mode 100644 index 0000000..17a202c --- /dev/null +++ b/h/wrn/coreip/rtsolLib.h @@ -0,0 +1,54 @@ +/* rtsolLib.h - Router Solicitation for IPv6 */ + +/* Copyright 1992-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,18jun04,niq Virtualization changes +01g,05nov03,cdw Removal of unnecessary _KERNEL guards. +01f,04nov03,rlm Ran batch header path update for header re-org. +01e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01d,06aug03,nee Accordion Base6 merge from ACCORDION_BASE6_MERGE_BASELINE + label +01c,10jun03,vvv include netVersion.h +01b,16may02,kal added rtsolStop() +01a,13Feb02,kal written. +*/ + +#ifndef __INCrtsolLibh +#define __INCrtsolLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include + +typedef struct rtsol_config_params { + CFG_DATA_HDR cfgh; + + /* only used for parameter string */ + + char *cfg_pParameterStr; + } RTSOL_CONFIG_PARAMS; + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS rtsolStart (char *cmdString); +extern STATUS rtsolStop (void); + +#else /* __STDC__ */ + +extern STATUS rtsolStart (); +extern STATUS rtsolStop (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCrtsolLibh */ diff --git a/h/wrn/coreip/sntp.h b/h/wrn/coreip/sntp.h new file mode 100644 index 0000000..a64b3a1 --- /dev/null +++ b/h/wrn/coreip/sntp.h @@ -0,0 +1,144 @@ +/* sntp.h - Simple Network Time Protocol common include file */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01c,28apr02,rae added extern C jazz (SPR #76303) +01b,15jul97,spm code cleanup, documentation, and integration; entered in + source code control +01a,20apr97,kyc written + +*/ + +#ifndef __INCsntph +#define __INCsntph + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include + +/* defines */ + +/* constants used by the NTP packet. See RFC 1769 for details. */ + +/* 2 bit leap indicator field */ + +#define SNTP_LI_MASK 0xC0 +#define SNTP_LI_0 0x00 /* no warning */ +#define SNTP_LI_1 0x40 /* last minute has 61 seconds */ +#define SNTP_LI_2 0x80 /* last minute has 59 seconds */ +#define SNTP_LI_3 0xC0 /* alarm condition + (clock not synchronized) */ + +/* 3 bit version number field */ + +#define SNTP_VN_MASK 0x38 +#define SNTP_VN_0 0x00 /* not supported */ +#define SNTP_VN_1 0x08 /* the earliest version */ +#define SNTP_VN_2 0x10 +#define SNTP_VN_3 0x18 /* VxWorks implements this + version */ +#define SNTP_VN_4 0x20 /* the latest version, implemented if INET6 is defined */ +#define SNTP_VN_5 0x28 /* reserved */ +#define SNTP_VN_6 0x30 /* reserved */ +#define SNTP_VN_7 0x38 /* reserved */ + +/* 3 bit mode field */ + +#define SNTP_MODE_MASK 0x07 +#define SNTP_MODE_0 0x00 /* reserve */ +#define SNTP_MODE_1 0x01 /* symmetric active */ +#define SNTP_MODE_2 0x02 /* symmetric passive */ +#define SNTP_MODE_3 0x03 /* client */ +#define SNTP_MODE_4 0x04 /* server */ +#define SNTP_MODE_5 0x05 /* broadcast */ +#define SNTP_MODE_6 0x06 /* reserve for NTP control + message */ +#define SNTP_MODE_7 0x07 /* reserve for private use */ + + + +/* 8 bit stratum number. Only the first 2 are valid for SNTP. */ + +#define SNTP_STRATUM_0 0x00 /* unspecified or unavailable */ +#define SNTP_STRATUM_1 0x01 /* primary source */ + +/* + * No default constants are defined for poll, precision, root delay, + * root dispersion and reference identifier. Users are expected to supply + * values for the poll interval and the refererence identifier. SNTP ignores + * the precision, root delay and root dispersion fields. + */ + + +/* + * Time conversion constant. NTP timestamps are relative to + * 0h on 1 January 1900, Unix uses 0h GMT on 1 January 1970 as a base. + * The defined constant incorporates 53 standard years and 17 leap years, + * but omits all leap second adjustments, since these are applied to + * both timescales, keeping the offset constant. + */ + +#define SNTP_UNIX_OFFSET 0x83aa7e80 /* 1970 - 1900 in seconds */ + +/* the range of the struct timeval is 0 - 1000000 */ + +#define TIMEVAL_USEC_MAX 1000000 + + +/* + * SNTP_PACKET - Network Time Protocol message format (without authentication). + * See RFC1769 for details. + */ + +#if CPU_FAMILY==I960 +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct sntpPacket + { + unsigned char leapVerMode; + unsigned char stratum; + char poll; + char precision; + u_long rootDelay; + u_long rootDispersion; + u_long referenceIdentifier; + + /* latest available time, in 64-bit NTP timestamp format */ + + u_long referenceTimestampSec; + u_long referenceTimestampFrac; + + /* client transmission time, in 64-bit NTP timestamp format */ + + u_long originateTimestampSec; + u_long originateTimestampFrac; + + /* server reception time, in 64-bit NTP timestamp format */ + + u_long receiveTimestampSec; + u_long receiveTimestampFrac; + + /* server transmission time, in 64-bit NTP timestamp format */ + + u_long transmitTimestampSec; + u_long transmitTimestampFrac; + } SNTP_PACKET; + +#if CPU_FAMILY==I960 +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +} +#endif +#endif /* __INCsntph */ diff --git a/h/wrn/coreip/sntpcLib.h b/h/wrn/coreip/sntpcLib.h new file mode 100644 index 0000000..cfb8eab --- /dev/null +++ b/h/wrn/coreip/sntpcLib.h @@ -0,0 +1,61 @@ +/* sntpcLib.h - Simple Network Time Protocol client include file */ + +/* Copyright 1984-1997 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01f,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01c,25aug99,cno Add extern "C" definition (SPR21825) +01b,15jul97,spm code cleanup, documentation, and integration; entered in + source code control +01a,20apr97,kyc written + +*/ + +#ifndef __INCsntpch +#define __INCsntpch + +/* includes */ + +#include + +/* defines */ + +#define S_sntpcLib_INVALID_PARAMETER (M_sntpcLib | 1) +#define S_sntpcLib_INVALID_ADDRESS (M_sntpcLib | 2) +#define S_sntpcLib_TIMEOUT (M_sntpcLib | 3) +#define S_sntpcLib_VERSION_UNSUPPORTED (M_sntpcLib | 4) +#define S_sntpcLib_SERVER_UNSYNC (M_sntpcLib | 5) + +#define SNTP_CLIENT_REQUEST 0x0B /* standard SNTP client request */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef INET6 +/* SNTP data retrived from SNTP IPv4 protocol message in mSntpcTimeGet */ +typedef struct sntpData + { + unsigned char stratum; + char poll; + char precision; + } SNTP_DATA; + +IMPORT STATUS mSntpcTimeGet (char *, u_int, struct timespec *, char *, + SNTP_DATA *); + +#endif + +IMPORT STATUS sntpcInit (u_short, char *); +IMPORT STATUS sntpcTimeGet (char *, u_int, struct timespec *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsntpch */ + diff --git a/h/wrn/coreip/sntpsLib.h b/h/wrn/coreip/sntpsLib.h new file mode 100644 index 0000000..c61d017 --- /dev/null +++ b/h/wrn/coreip/sntpsLib.h @@ -0,0 +1,73 @@ +/* sntpsLib.h - Simple Network Time Protocol (SNTP) server include file */ + +/* Copyright 1984-2001 Wind River Systems, Inc. */ + +/* +Modification history +-------------------- +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01c,30aug01,vvv added extern "C" definition (SPR #21825) +01b,15jul97,spm code cleanup, documentation, and integration; entered in + source code control +01a,20apr97,kyc written + +*/ + +#ifndef __INCsntpsh +#define __INCsntpsh + +/* includes */ + +#include + +/* defines */ + +#define S_sntpsLib_INVALID_PARAMETER (M_sntpsLib | 1) +#define S_sntpsLib_INVALID_ADDRESS (M_sntpsLib | 2) + +/* Valid settings for SNTPS_MODE in configAll.h */ + +#define SNTP_ACTIVE 1 +#define SNTP_PASSIVE 2 + +/* Values for "request" parameter to clock hook routine. */ + +#define SNTPS_ID 1 +#define SNTPS_RESOLUTION 2 +#define SNTPS_TIME 3 + +/* Values for "setting" parameter to sntpsConfigSet() routine. */ + +#define SNTPS_ADDRESS 1 +#define SNTPS_DELAY 2 + +#if CPU_FAMILY==I960 +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct sntpsTimeData + { + ULONG seconds; + ULONG fraction; + } SNTP_TIMESTAMP; + +#if CPU_FAMILY==I960 +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifdef __cplusplus +extern "C" { +#endif + +IMPORT STATUS sntpsInit (char *, u_char, char *, short, u_short, FUNCPTR); +IMPORT STATUS sntpsClockSet (FUNCPTR); +IMPORT ULONG sntpsNsecToFraction (ULONG); +IMPORT STATUS sntpsConfigSet (int, void *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsntpsh */ + diff --git a/h/wrn/coreip/sockFunc.h b/h/wrn/coreip/sockFunc.h new file mode 100644 index 0000000..da4df1c --- /dev/null +++ b/h/wrn/coreip/sockFunc.h @@ -0,0 +1,108 @@ +/* sockFunc.h - socket function table header */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02l,14sep04,dlk Omit entire contents of this file unless _WRS_KERNEL is + defined. +02k,29jun04,dlk Merged from BASE6_ITER5_FRZ27. +02l,28may04,dlk Use single socket IO-system device driver with wrappers + calling back-end routines. +02k,24mar04,mcm Including time.h instead of sys/time.h. +02j,15mar04,bwa added multiple concurrent backends capabalities. +02j,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5-int/2) +02i,08dec03,vvv updated based on inspection comments +02h,03dec03,asr Fix compile errors after dinkum libc check-in +02g,14nov03,nee Adding closeRtn to SOCK_FUNC +02f,05nov03,cdw Removal of unnecessary _KERNEL guards. +02e,04nov03,rlm Ran batch header path update for header re-org. +02d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +02c,10jun03,vvv include netVersion.h +02b,02feb02,ham changed for tornado build +02a,15aug01,ann ported to clarinet from AE1.1 version 01f +*/ + +#ifndef __INCsockFunch +#define __INCsockFunch + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _WRS_KERNEL + +/* includes */ +#include +#include +#include + +#if defined (_WRS_VXWORKS_MAJOR) && (_WRS_VXWORKS_MAJOR >= 6) +#include /* For type DEV_HDR */ +#else +#include +#endif /* defined (_WRS_VXWORKS_MAJOR) && (_WRS_VXWORKS_MAJOR >= 6) */ + +/* HIDDEN */ + +/* typedefs */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct sockFunc /* SOCK_FUNC */ + { + FUNCPTR libInitRtn; /* sockLibInit() */ + FUNCPTR acceptRtn; /* accept() */ + FUNCPTR bindRtn; /* bind() */ + FUNCPTR connectRtn; /* connect() */ + FUNCPTR connectWithTimeoutRtn; /* connectWithTimeout() */ + FUNCPTR getpeernameRtn; /* getpeername() */ + FUNCPTR getsocknameRtn; /* getsockname() */ + FUNCPTR listenRtn; /* listen() */ + FUNCPTR recvRtn; /* recv() */ + FUNCPTR recvfromRtn; /* recvfrom() */ + FUNCPTR recvmsgRtn; /* recvmsg() */ + FUNCPTR sendRtn; /* send() */ + FUNCPTR sendtoRtn; /* sendto() */ + FUNCPTR sendmsgRtn; /* sendmsg() */ + FUNCPTR shutdownRtn; /* shutdown() */ + FUNCPTR socketRtn; /* socket() */ + FUNCPTR getsockoptRtn; /* getsockopt() */ + FUNCPTR setsockoptRtn; /* setsockopt() */ + FUNCPTR zbufRtn; /* ZBUF support */ + + /* + * The following IO-system handlers are called via wrappers in + * sockLib.c: + */ + FUNCPTR closeRtn; /* close() */ + FUNCPTR readRtn; /* read() */ + FUNCPTR writeRtn; /* write() */ + FUNCPTR ioctlRtn; /* ioctl() */ + } SOCK_FUNC; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +extern DEV_HDR socketDevHdr; /* I/O system device driver header */ + +/* END_HIDDEN */ + +/* Memory validation function pointers */ + +extern int (*pSockIoctlMemVal) (unsigned int cmd, void * data); +extern STATUS (*pUnixIoctlMemVal) (unsigned int cmd, const void * pData); + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsockFunch */ + diff --git a/h/wrn/coreip/sockLib.h b/h/wrn/coreip/sockLib.h new file mode 100644 index 0000000..bd1583c --- /dev/null +++ b/h/wrn/coreip/sockLib.h @@ -0,0 +1,127 @@ +/* sockLib.h - UNIX BSD 4.3 compatible socket library header */ + +/* +* Copyright (c) 1984-2005 Wind River Systems, Inc. +* +* The right to copy, distribute or otherwise make use of this software +* may be licensed only pursuant to the terms of an applicable Wind River +* license agreement. +*/ + +/* +modification history +-------------------- +03n,17aug05,mcm Using sys/time.h for RTP space. +03m,14sep04,dlk Omit kernel APIs when _WRS_KERNEL is not defined. +03n,28may04,dlk Make all socket back-ends share a single IO system device. + Remove fdMax parameter to sockLibInit(). +03m,24mar04,mcm Including time.h instead of sys/time.h. +03m,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5-int/1) +03l,18nov03,nee adding for RTPs +03k,05nov03,cdw Removal of unnecessary _KERNEL guards. +03j,04nov03,rlm Ran batch header path update for header re-org. +03i,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +03h,27oct03,cdw update include statements post header re-org. +03g,24oct03,cdw update include statements post header re-org. +03f,10jun03,vvv include netVersion.h +03e,27feb02,ann correcting the path to sockFunc.h after relocation +03d,02feb02,ham changed for tornado build. +03c,30oct01,ppp merging from munich +03b,28aug01,ann correcting the return value in the prototype for sockLibInit +03a,15aug01,ann ported to clarinet from AE1.1 version 02l. +*/ + +#ifndef __INCsockLibh +#define __INCsockLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _WRS_KERNEL +#include +#else +#include +#endif +#include +#include + +/* typedefs */ + +#ifdef _WRS_KERNEL +#include +typedef struct sockLibMap + { + int domainMap; /* mapping address family */ + int domainReal; /* real address family */ + SOCK_FUNC * pSockFunc; /* socket function table */ + struct sockLibMap * pNext; /* next socket lib mapping */ + } SOCK_LIB_MAP; +#endif /* _WRS_KERNEL */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +#ifdef _WRS_KERNEL +extern STATUS sockLibInit (void); +extern STATUS sockLibAdd (FUNCPTR sockLibInitRtn, int domainMap, + int domainReal); +#endif /* _WRS_KERNEL */ + +extern STATUS bind (int s, struct sockaddr *name, int namelen); +extern STATUS connect (int s, struct sockaddr *name, int namelen); +extern STATUS connectWithTimeout (int sock, struct sockaddr *adrs, + int adrsLen, struct timeval *timeVal); +extern STATUS getpeername (int s, struct sockaddr *name, int *namelen); +extern STATUS getsockname (int s, struct sockaddr *name, int *namelen); +extern STATUS getsockopt (int s, int level, int optname, char *optval, + int *optlen); +extern STATUS listen (int s, int backlog); +extern STATUS setsockopt (int s, int level, int optname, char *optval, + int optlen); +extern STATUS shutdown (int s, int how); +extern int accept (int s, struct sockaddr *addr, int *addrlen); +extern int recv (int s, char *buf, int bufLen, int flags); +extern int recvfrom (int s, char *buf, int bufLen, int flags, + struct sockaddr *from, int *pFromLen); +extern int recvmsg (int sd, struct msghdr *mp, int flags); +extern int send (int s, const char *buf, int bufLen, int flags); +extern int sendmsg (int sd, struct msghdr *mp, int flags); +extern int sendto (int s, caddr_t buf, int bufLen, int flags, + struct sockaddr *to, int tolen); +extern int socket (int domain, int type, int protocol); + +#else /* __STDC__ */ + +#ifdef _WRS_KERNEL +extern STATUS sockLibInit (); +extern STATUS sockLibAdd (); +#endif + +extern STATUS bind (); +extern STATUS connect (); +extern STATUS connectWithTimeout (); +extern STATUS getpeername (); +extern STATUS getsockname (); +extern STATUS getsockopt (); +extern STATUS listen (); +extern STATUS setsockopt (); +extern STATUS shutdown (); +extern int accept (); +extern int recv (); +extern int recvfrom (); +extern int recvmsg (); +extern int send (); +extern int sendmsg (); +extern int sendto (); +extern int socket (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsockLibh */ diff --git a/h/wrn/coreip/socket.h b/h/wrn/coreip/socket.h new file mode 100644 index 0000000..1632600 --- /dev/null +++ b/h/wrn/coreip/socket.h @@ -0,0 +1,11 @@ +/* socket.h - obsolete vxWorks 5.0 header file */ + +/* Copyright 1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,09feb93,rrr written for compatibility with 5.0 +*/ + +#include "sys/socket.h" diff --git a/h/wrn/coreip/sys/callout.h b/h/wrn/coreip/sys/callout.h new file mode 100644 index 0000000..a6cfc25 --- /dev/null +++ b/h/wrn/coreip/sys/callout.h @@ -0,0 +1,126 @@ +/* callout.h - BSD callout facility */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)callout.h 8.2 (Berkeley) 1/21/94 + * $FreeBSD: src/sys/sys/callout.h,v 1.15 1999/12/29 04:24:37 peter Exp $ + */ + +/* +modification history +-------------------- +01o,11jul05,dlk Added callout_ready() macro. +01n,11apr05,sar Replace global tm with gtfTimerManagerCB +01m,09feb05,sar Move gtf include files per GTF code inspection of 10/26/2004 +01l,07feb05,vvv _KERNEL cleanup +01k,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01j,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01i,25nov03,wap Merge changes from Snowflake +01h,20nov03,niq Remove copyright_wrs.h file inclusion +01g,04nov03,rlm Ran batch header path update for header re-org. +01f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01e,27oct03,rlm update include statements post header re-org. +01d,09sep02,hsh add c++ protection +01c,02feb02,ham changed for tornado build. +01b,29oct01,ham included gtf_core.h. +01a,06jun01,deg ported. +*/ + +#ifndef _SYS_CALLOUT_H_ +#define _SYS_CALLOUT_H_ + +#ifdef _WRS_KERNEL + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern GTF_TIMER_MANAGER * gtfTimerManagerCB; + + +#define callout gtfTimer + +#define CALLOUT_LOCAL_ALLOC TIMER_LOCAL_ALLOC /* was allocated from callfree */ +#define CALLOUT_ACTIVE TIMER_ACTIVE /* callout is currently active */ +#define CALLOUT_PENDING TIMER_PENDING /* callout is waiting for timeout */ + +#define callout_handle gtfTimer* + + +/* Note well: callout_deactive should be called by non-GTF code only in +the context of the timer's handler. This prevents a mutual exclusion issue +involving timerFlags that can occur between a call to callout_deactivate +and the clearing of TIMER_PENDING during a timer expiry. */ + +#define callout_active(c) (((GTF_TIMER *)(c))->timerFlags & TIMER_ACTIVE) +#define callout_deactivate(c) (((GTF_TIMER *)(c))->timerFlags &= ~TIMER_ACTIVE) +#define callout_init(c) gtfCalloutInit((GTF_TIMER *)(c)) +#define callout_pending(c) (((GTF_TIMER *)(c))->timerFlags & TIMER_PENDING) +#define callout_reset(c, ticks, func, arg) \ + gtfTimerReset (gtfTimerManagerCB, (c), (ticks), \ + (GTF_TIMER_HANDLER)(func), (arg)) +#define callout_stop(c) gtfTimerCancel (gtfTimerManagerCB, (GTF_TIMER *)(c)) + +#define callout_ready(c) \ + (((((GTF_TIMER *)(c))->timerFlags & (TIMER_PENDING|TIMER_ACTIVE)) == \ + TIMER_ACTIVE) ? (callout_deactivate (c), 1) : 0) + +/* +Use callout_ready() in callout handlers as follows: + +spl = splnet(); /@ or other application-specific mutual exclusion @/ +if (callout_ready (t)) + { + /@ do the application-specific handler stuff @/ + } +splx (spl); +*/ + +#ifdef __cplusplus +} +#endif + +#endif /* _WRS_KERNEL */ + +#endif /* _SYS_CALLOUT_H_ */ diff --git a/h/wrn/coreip/sys/cdefs.h b/h/wrn/coreip/sys/cdefs.h new file mode 100644 index 0000000..a38d1b6 --- /dev/null +++ b/h/wrn/coreip/sys/cdefs.h @@ -0,0 +1,371 @@ +/* cdefs.h - C definitions */ + +/* Copyright 2001-2003 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Berkeley Software Design, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + * $FreeBSD: src/sys/sys/cdefs.h,v 1.28.2.8 2002/09/18 04:05:13 mikeh Exp $ + */ + +/* +modification history +-------------------- +01h,20nov03,niq Remove copyright_wrs.h file inclusion +01g,05nov03,cdw Removal of unnecessary _KERNEL guards. +01f,04nov03,rlm Ran batch header path update for header re-org. +01e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01d,10jun03,vvv include netVersion.h +01c,08apr03,syy Fixed Diab compile warnings +01b,01feb03,pas merge from FreeBSD 4.7 - added POSIX stuff +*/ + + +#ifndef _SYS_CDEFS_H_ +#define _SYS_CDEFS_H_ + +#if defined(__cplusplus) +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS } +#else +#define __BEGIN_DECLS +#define __END_DECLS +#endif + +#include + +/* + * The __CONCAT macro is used to concatenate parts of symbol names, e.g. + * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. + * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI + * mode -- there must be no spaces between its arguments, and for nested + * __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also + * concatenate double-quoted strings produced by the __STRING macro, but + * this only works with ANSI C. + * + * __XSTRING is like __STRING, but it expands any macros in its argument + * first. It is only available with ANSI C. + */ +#if defined(__STDC__) || defined(__cplusplus) +#define __P(protos) protos /* full-blown ANSI C */ +#define __CONCAT1(x,y) x ## y +#define __CONCAT(x,y) __CONCAT1(x,y) +#define __STRING(x) #x /* stringify without expanding x */ +#define __XSTRING(x) __STRING(x) /* expand x, then stringify */ + +#define __const const /* define reserved names to standard */ +#define __signed signed +#define __volatile volatile +#if defined(__cplusplus) +#define __inline inline /* convert to C++ keyword */ +#else +#ifndef __GNUC__ +#define __inline /* delete GCC keyword */ +#endif /* !__GNUC__ */ +#endif /* !__cplusplus */ + +#else /* !(__STDC__ || __cplusplus) */ +#define __P(protos) () /* traditional C preprocessor */ +#define __CONCAT(x,y) x/**/y +#define __STRING(x) "x" + +#ifndef __GNUC__ +#define __const /* delete pseudo-ANSI C keywords */ +#define __inline +#define __signed +#define __volatile +/* + * In non-ANSI C environments, new programs will want ANSI-only C keywords + * deleted from the program and old programs will want them left alone. + * When using a compiler other than gcc, programs using the ANSI C keywords + * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS. + * When using "gcc -traditional", we assume that this is the intent; if + * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone. + */ +#ifndef NO_ANSI_KEYWORDS +#define const /* delete ANSI C keywords */ +#define inline +#define signed +#define volatile +#endif /* !NO_ANSI_KEYWORDS */ +#endif /* !__GNUC__ */ +#endif /* !(__STDC__ || __cplusplus) */ + +/* + * Compiler-dependent macros to help declare dead (non-returning) and + * pure (no side effects) functions, and unused variables. They are + * null except for versions of gcc that are known to support the features + * properly (old versions of gcc-2 supported the dead and pure features + * in a different (wrong) way). + */ +#if __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 5 +#define __dead2 +#define __pure2 +#define __unused +#endif +#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 +#define __dead2 __attribute__((__noreturn__)) +#define __pure2 __attribute__((__const__)) +#define __unused +#endif +#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3 +#define __dead2 __attribute__((__noreturn__)) +#define __pure2 __attribute__((__const__)) +#define __unused __attribute__((__unused__)) +#endif + +/* XXX: should use `#if __STDC_VERSION__ < 199901'. */ +#if !(__GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3) +#ifndef __func__ +#define __func__ NULL +#endif +#endif + +#if __GNUC__ >= 2 && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901 +#define __LONG_LONG_SUPPORTED +#endif + +/* + * GCC 2.95 provides `__restrict' as an extention to C90 to support the + * C99-specific `restrict' type qualifier. We happen to use `__restrict' as + * a way to define the `restrict' type qualifier without disturbing older + * software that is unaware of C99 keywords. + */ +#if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95) +#if __STDC_VERSION__ < 199901 +#define __restrict +#else +#define __restrict restrict +#endif +#endif + +/* + * Compiler-dependent macros to declare that functions take printf-like + * or scanf-like arguments. They are null except for versions of gcc + * that are known to support the features properly (old versions of gcc-2 + * didn't permit keeping the keywords out of the application namespace). + */ +#if __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 7 +#define __printflike(fmtarg, firstvararg) +#define __scanflike(fmtarg, firstvararg) +#else +#define __printflike(fmtarg, firstvararg) \ + __attribute__((__format__ (__printf__, fmtarg, firstvararg))) +#define __scanflike(fmtarg, firstvararg) \ + __attribute__((__format__ (__scanf__, fmtarg, firstvararg))) +#endif + +/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */ +#if __FreeBSD_cc_version >= 300001 +#define __printf0like(fmtarg, firstvararg) \ + __attribute__((__format__ (__printf0__, fmtarg, firstvararg))) +#else +#define __printf0like(fmtarg, firstvararg) +#endif + +#ifdef __GNUC__ +#define __strong_reference(sym,aliassym) \ + extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym))); +#ifdef __ELF__ +#ifdef __STDC__ +#define __weak_reference(sym,alias) \ + __asm__(".weak " #alias); \ + __asm__(".equ " #alias ", " #sym) +#define __warn_references(sym,msg) \ + __asm__(".section .gnu.warning." #sym); \ + __asm__(".asciz \"" msg "\""); \ + __asm__(".previous") +#else +#define __weak_reference(sym,alias) \ + __asm__(".weak alias"); \ + __asm__(".equ alias, sym") +#define __warn_references(sym,msg) \ + __asm__(".section .gnu.warning.sym"); \ + __asm__(".asciz \"msg\""); \ + __asm__(".previous") +#endif /* __STDC__ */ +#else /* !__ELF__ */ +#ifdef __STDC__ +#define __weak_reference(sym,alias) \ + __asm__(".stabs \"_" #alias "\",11,0,0,0"); \ + __asm__(".stabs \"_" #sym "\",1,0,0,0") +#define __warn_references(sym,msg) \ + __asm__(".stabs \"" msg "\",30,0,0,0"); \ + __asm__(".stabs \"_" #sym "\",1,0,0,0") +#else +#define __weak_reference(sym,alias) \ + __asm__(".stabs \"_/**/alias\",11,0,0,0"); \ + __asm__(".stabs \"_/**/sym\",1,0,0,0") +#define __warn_references(sym,msg) \ + __asm__(".stabs msg,30,0,0,0"); \ + __asm__(".stabs \"_/**/sym\",1,0,0,0") +#endif /* __STDC__ */ +#endif /* __ELF__ */ +#endif /* __GNUC__ */ + +#if defined(__GNUC__) && defined(__ELF__) +#define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"") +#else +#define __IDSTRING(name,string) static const char name[] __unused = string +#endif + +#ifndef __RCSID +#define __RCSID(s) __IDSTRING(rcsid,s) +#endif + +/* + * Embed the rcs id of a source file in the resulting library. Note that in + * more recent ELF binutils, we use .ident allowing the ID to be stripped. + * Usage: + * __FBSDID("$FreeBSD: src/sys/sys/cdefs.h,v 1.28.2.8 2002/09/18 04:05:13 mikeh Exp $"); + */ +#ifndef __FBSDID +#if !defined(lint) && !defined(STRIP_FBSDID) +#define __FBSDID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s) +#else +#define __FBSDID(s) struct __hack +#endif +#endif + +#ifndef __RCSID_SOURCE +#define __RCSID_SOURCE(s) __IDSTRING(rcsid_source,s) +#endif + +#ifndef __COPYRIGHT +#define __COPYRIGHT(s) __IDSTRING(copyright,s) +#endif + +/*- + * The following definitions are an extension of the behavior originally + * implemented in , but with a different level of granularity. + * POSIX.1 requires that the macros we test be defined before any standard + * header file is included. + * + * Here's a quick run-down of the versions: + * defined(_POSIX_SOURCE) 1003.1-1988 + * _POSIX_C_SOURCE == 1 1003.1-1990 + * _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option + * _POSIX_C_SOURCE == 199309 1003.1b-1993 + * _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, + * and the omnibus ISO/IEC 9945-1: 1996 + * _POSIX_C_SOURCE == 200112 1003.1-2001 + * + * In addition, the X/Open Portability Guide, which is now the Single UNIX + * Specification, defines a feature-test macro which indicates the version of + * that specification, and which subsumes _POSIX_C_SOURCE. + * + * Our macros begin with two underscores to avoid namespace screwage. + */ + +/* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */ +#if _POSIX_C_SOURCE == 1 +#undef _POSIX_C_SOURCE /* Probably illegal, but beyond caring now. */ +#define _POSIX_C_SOURCE 199009 +#endif + +/* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */ +#if _POSIX_C_SOURCE == 2 +#undef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 199209 +#endif + +/* Deal with various X/Open Portability Guides and Single UNIX Spec. */ +#ifdef _XOPEN_SOURCE +#if _XOPEN_SOURCE - 0 >= 600 +#define __XSI_VISIBLE 600 +#undef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 200112 +#elif _XOPEN_SOURCE - 0 >= 500 +#define __XSI_VISIBLE 500 +#undef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 199506 +#endif +#endif + +/* + * Deal with all versions of POSIX. The ordering relative to the tests above is + * important. + */ +#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) +#define _POSIX_C_SOURCE 198808 +#endif +#ifdef _POSIX_C_SOURCE +#if _POSIX_C_SOURCE >= 200112 +#define __POSIX_VISIBLE 200112 +#define __ISO_C_VISIBLE 1999 +#elif _POSIX_C_SOURCE >= 199506 +#define __POSIX_VISIBLE 199506 +#define __ISO_C_VISIBLE 1990 +#elif _POSIX_C_SOURCE >= 199309 +#define __POSIX_VISIBLE 199309 +#define __ISO_C_VISIBLE 1990 +#elif _POSIX_C_SOURCE >= 199209 +#define __POSIX_VISIBLE 199209 +#define __ISO_C_VISIBLE 1990 +#elif _POSIX_C_SOURCE >= 199009 +#define __POSIX_VISIBLE 199009 +#define __ISO_C_VISIBLE 1990 +#else +#define __POSIX_VISIBLE 198808 +#define __ISO_C_VISIBLE 0 +#endif /* _POSIX_C_SOURCE */ +#else +/*- + * Deal with _ANSI_SOURCE: + * If it is defined, and no other compilation environment is explicitly + * requested, then define our internal feature-test macros to zero. This + * makes no difference to the preprocessor (undefined symbols in preprocessing + * expressions are defined to have value zero), but makes it more convenient for + * a test program to print out the values. + * + * If a program mistakenly defines _ANSI_SOURCE and some other macro such as + * _POSIX_C_SOURCE, we will assume that it wants the broader compilation + * environment (and in fact we will never get here). + */ +#ifdef _ANSI_SOURCE /* Hide almost everything. */ +#define __POSIX_VISIBLE 0 +#define __XSI_VISIBLE 0 +#define __BSD_VISIBLE 0 +#define __ISO_C_VISIBLE 1990 +#else /* Default environment: show everything. */ +#define __POSIX_VISIBLE 200112 +#define __XSI_VISIBLE 600 +#define __BSD_VISIBLE 1 +#define __ISO_C_VISIBLE 1999 +#endif +#endif + +#endif /* !_SYS_CDEFS_H_ */ diff --git a/h/wrn/coreip/sys/ds_conf.h b/h/wrn/coreip/sys/ds_conf.h new file mode 100644 index 0000000..45f3435 --- /dev/null +++ b/h/wrn/coreip/sys/ds_conf.h @@ -0,0 +1,366 @@ +/* ds_conf.h -- data structure configuration definitions */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +02r,25aug05,kch Guarded MIP6 structure size definitions with MIP6 define. +02q,20aug05,dlk Replaced obsolete RR_PREFIX entries with entries for + struct ipq. +02r,20jul05,vvv added entries for SCTP +02q,06jul05,kch Added entries for ipv4/v6 msf and mobility. +02p,24jun05,wap Add IFMEDIA_ENTRY_DS_ID +02o,25apr05,kch Added entries for in6_ifextra and nd_ifinfo. +02n,25feb05,niq Add support for router alert +02m,31jan05,niq merge mroute changes from comp_wn_ipv6_multicast_interim-dev + branch (ver 1) +02l,19jan05,wap Add additional types +02k,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +02j,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +02i,20nov03,niq Remove copyright_wrs.h file inclusion +02h,05nov03,cdw Removal of unnecessary _KERNEL guards. +02g,04nov03,rlm Ran batch header path update for header re-org. +02f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +02e,06aug03,nee Accordion Base6 merge from ACCORDION_BASE6_MERGE_BASELINE + label +02d,23jul03,vvv added entries for scope6_id (SPR #88481) +02d,02dec02,spm merged from WINDNET_IPV6-1_0-FCS label (ver 02c,06sep02,hsh) +02c,15oct02,niq Changes for Accordion's RTM +02b,24jun02,ism changed in6_ifstat to in6_ifdata +02a,12jun02,pas changed DS_MALLOC() to a wrapper around netClusterGet() +01z,17may02,ann added the M2_IFINDEX data structure +01y,26apr02,ham removed IPSEC. +01x,22apr02,nee adding multicast forwarding data strutures +01w,02feb02,ham changed DS_NUM to variables to be configured by CDF. +01v,12dec01,ann removing the structures defined for sysctl +01u,31oct01,ham increased SOCKADDR_DS_NUM. +01t,30oct01,ann adding the sysctl data structs +01s,29oct01,nee adding inp_tp for tcpcb +01r,04oct01,ham added ds for struct ifnet. +01q,02oct01,hsh add in_hcentry struct into memory pool +01p,01oct01,ppp fixing a typo +01o,27sep01,ppp Adding some more structures in for security associations +01n,25sep01,hsh Adding data structures +01m,24sep01,ppp Adding two data structures +01l,20sep01,qli removing MAX_DS_POOL_ID +01k,18sep01,nee adding the ICMP6_FILTER entry +01j,18sep01,ann adding the ETHER_MULTI ds +01i,18sep01,qli removing the sizeof operator +01h,17sep01,qli adding more data structures +01g,13sep01,ann adding the Minterfaces MIB table DS +01f,11sep01,qli fix definition ogf RADIX_NODE_DS_SZ +01e,05sep01,qli adding route and radix related definitions +01d,21aug01,pas Added tcp structures. +01c,21aug01,ann adding the socket structures +01b,08aug01,ppp Adding some data structures in. +01a,07aug01,qli created +*/ + + +#ifndef _DS_CONF_H_ +#define _DS_CONF_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* We don't #include any of the header files for these structs, because the + * definitions aren't needed until the macros are expanded, which will be in a + * context where the appropriate header files should already be included. + */ + +/* + * If you add any new pools, be sure to add an entry to _dsMallocSizes + * in uipc_mbuf.c + */ + +#define IFADDR_DS_SZ sizeof(struct ifaddr) +#define IFADDR_DS_ID 0 + +#define IFMULTIADDR_DS_SZ sizeof(struct ifmultiaddr) +#define IFMULTIADDR_DS_ID 1 + +#define SOCKADDR_DS_SZ sizeof(struct sockaddr) +#define SOCKADDR_DS_ID 2 + +#define SOCKADDR_DL_DS_SZ sizeof(struct sockaddr_dl) +#define SOCKADDR_DL_DS_ID 3 + +#define INPCB_DS_SZ sizeof(struct inpcb) +#define INPCB_DS_ID 4 + +#define IN_MULTI_DS_SZ sizeof(struct in_multi) +#define IN_MULTI_DS_ID 5 + +#define IN_IFADDR_DS_SZ sizeof(struct in_ifaddr) +#define IN_IFADDR_DS_ID 6 + +#define SOCKADDR_IN_DS_SZ sizeof(struct sockaddr_in) +#define SOCKADDR_IN_DS_ID 7 + +#define INPCBPORT_DS_SZ sizeof(struct inpcbport) +#define INPCBPORT_DS_ID 8 + +#define SOCKET_DS_SZ sizeof(struct socket) +#define SOCKET_DS_ID 9 + +#define SOCK_LIB_MAP_BE_DS_SZ sizeof(struct sockLibMap) +#define SOCK_LIB_MAP_BE_DS_ID 10 + +#define SOCKADDR_IN6_DS_SZ sizeof(struct sockaddr_in6) +#define SOCKADDR_IN6_DS_ID 11 + +#define TSEG_QENT_DS_SZ sizeof(struct tseg_qent) +#define TSEG_QENT_DS_ID 12 + +#define IP_MOPTIONS_DS_SZ sizeof(struct ip_moptions) +#define IP_MOPTIONS_DS_ID 13 + +#define ROUTER_INFO_DS_SZ sizeof(struct router_info) +#define ROUTER_INFO_DS_ID 14 + +#define ND_DEFROUTER_DS_SZ sizeof(struct nd_defrouter) +#define ND_DEFROUTER_DS_ID 15 + +#define ND_PFXROUTER_DS_SZ sizeof(struct nd_pfxrouter) +#define ND_PFXROUTER_DS_ID 16 + +#define ND_PREFIX_DS_SZ sizeof(struct nd_prefix) +#define ND_PREFIX_DS_ID 17 + +#define LLINFO_ND6_DS_SZ sizeof(struct llinfo_nd6) +#define LLINFO_ND6_DS_ID 18 + +#define RADIX_NODE_HEAD_DS_SZ sizeof(struct radix_node_head) +#define RADIX_NODE_HEAD_DS_ID 19 + +#define RADIX_MASK_DS_SZ sizeof(struct radix_mask) +#define RADIX_MASK_DS_ID 20 + +#define RADIX_NODE_DS_SZ ((sizeof(struct radix_node) <<1) + sizeof(struct sockaddr_in6)) +#define RADIX_NODE_DS_ID 21 + +#define RTENTRY_DS_SZ sizeof(struct rtentry) +#define RTENTRY_DS_ID 22 + +#define IN6_IFADDR_DS_SZ sizeof(struct in6_ifaddr) +#define IN6_IFADDR_DS_ID 23 + +#define IN6_MULTI_DS_SZ sizeof(struct in6_multi) +#define IN6_MULTI_DS_ID 24 + +#define IP6_PKTOPTS_DS_SZ sizeof(struct ip6_pktopts) +#define IP6_PKTOPTS_DS_ID 25 + +#define IN6_PKTINFO_DS_SZ sizeof(struct in6_pktinfo) +#define IN6_PKTINFO_DS_ID 26 + +#define RAWCB_DS_SZ sizeof(struct rawcb) +#define RAWCB_DS_ID 27 + +#define M2ID_DS_SZ sizeof(struct M2_ID_S) +#define M2ID_DS_ID 28 + +#define IP6_MOPTIONS_DS_SZ sizeof(struct ip6_moptions) +#define IP6_MOPTIONS_DS_ID 29 + +#define IN6_MULTI_MSHIP_DS_SZ sizeof(struct in6_multi_mship) +#define IN6_MULTI_MSHIP_DS_ID 30 + +#define IPFLOW_DS_SZ sizeof(struct ipflow) +#define IPFLOW_DS_ID 31 + +#define ETHER_MULTI_DS_SZ sizeof(ETHER_MULTI) +#define ETHER_MULTI_DS_ID 32 + +#define ICMP6_FILTER_DS_SZ sizeof(struct icmp6_filter) +#define ICMP6_FILTER_DS_ID 33 + +#define IP6Q_DS_SZ sizeof(struct ip6q) +#define IP6Q_DS_ID 34 + +#define IP6ASFRAG_DS_SZ sizeof(struct ip6asfrag) +#define IP6ASFRAG_DS_ID 35 + +#define IPQ_DS_SZ sizeof(struct ipq) +#define IPQ_DS_ID 36 + +#define RP_ADDR_DS_SZ sizeof(struct rp_addr) +#define RP_ADDR_DS_ID 37 + +#define IN6_IFSTAT_DS_SZ sizeof(struct in6_ifstat) +#define IN6_IFSTAT_DS_ID 38 + +#define ICMP6_IFSTAT_DS_SZ sizeof(struct icmp6_ifstat) +#define ICMP6_IFSTAT_DS_ID 39 + +#define IN_HCENTRY_DS_SZ sizeof(struct in_hcentry) +#define IN_HCENTRY_DS_ID 40 + +#define IFNET_DS_SZ sizeof(struct ifnet) +#define IFNET_DS_ID 41 + +#define INP_TP_DS_SZ sizeof(struct inp_tp) +#define INP_TP_DS_ID 42 + +#define MFC_DS_SZ sizeof(struct mfc) +#define MFC_DS_ID 43 + +#define MF6C_DS_SZ sizeof(struct mf6c) +#define MF6C_DS_ID 44 + +#define RTDETQ_DS_SZ sizeof(struct rtdetq) +#define RTDETQ_DS_ID 45 + +#define M2IFINDEX_DS_SZ sizeof(M2_IFINDEX) +#define M2IFINDEX_DS_ID 46 + +#define RADIX_ARG_DS_SZ sizeof (struct radix_arg) +#define RADIX_ARG_DS_ID 47 + +#define RTHDR_DS_SZ sizeof(struct routeHdr) +#define RTHDR_DS_ID 48 + +#define RT_ENTRY_DS_SZ sizeof(struct rtentry) +#define RT_ENTRY_DS_ID 49 + +#define SCOPE6_ID_DS_SZ sizeof (struct scope6_id) +#define SCOPE6_ID_DS_ID 50 + +#define LLINFO_ARP_DS_SZ sizeof(struct llinfo_arp) +#define LLINFO_ARP_DS_ID 51 + +#define MFC_BW_DS_SZ sizeof(struct bw_meter) +#define MFC_BW_DS_ID 52 + +#define RALCB_DS_SZ sizeof(struct ralcb) +#define RALCB_DS_ID 53 + +#define IN6_IFEXTRA_DS_SZ sizeof(struct in6_ifextra) +#define IN6_IFEXTRA_DS_ID 54 + +#define ND6_IFINFO_DS_SZ sizeof(struct nd_ifinfo) +#define ND6_IFINFO_DS_ID 55 + +#define IFMEDIA_ENTRY_DS_SZ sizeof(struct ifmedia_entry) +#define IFMEDIA_ENTRY_DS_ID 56 + +#define SOCK_MSF_DS_SZ sizeof(struct sock_msf) +#define SOCK_MSF_DS_ID 57 + +#define MSF_HEAD_DS_SZ sizeof(struct msf_head) +#define MSF_HEAD_DS_ID 58 + +#define SOCK_MSF_SOURCE_DS_SZ sizeof(struct sock_msf_source) +#define SOCK_MSF_SOURCE_DS_ID 59 + +#define SOCKADDR_STORAGE_DS_SZ sizeof(struct sockaddr_storage) +#define SOCKADDR_STORAGE_DS_ID 60 + +#define IN_ADDR_SOURCE_DS_SZ sizeof(struct in_addr_source) +#define IN_ADDR_SOURCE_DS_ID 61 + +#define IAS_HEAD_DS_SZ sizeof(struct ias_head) +#define IAS_HEAD_DS_ID 62 + +#define IN_ADDR_SLIST_DS_SZ sizeof(struct in_addr_slist) +#define IN_ADDR_SLIST_DS_ID 63 + +#define IN_MULTI_SOURCE_DS_SZ sizeof(struct in_multi_source) +#define IN_MULTI_SOURCE_DS_ID 64 + +#define IN6_ADDR_SLIST_DS_SZ sizeof(struct in6_addr_slist) +#define IN6_ADDR_SLIST_DS_ID 65 + +#define IN6_AS_HEAD_DS_SZ sizeof(struct i6as_head) +#define IN6_AS_HEAD_DS_ID 66 + +#define IN6_ADDR_SOURCE_DS_SZ sizeof(struct in6_addr_source) +#define IN6_ADDR_SOURCE_DS_ID 67 + +#define IN6_MULTI_SOURCE_DS_SZ sizeof(struct in6_multi_source) +#define IN6_MULTI_SOURCE_DS_ID 68 + +#ifdef MIP6 +#define MIP6_BC_INTERNAL_DS_SZ sizeof(struct mip6_bc_internal) +#define MIP6_BC_INTERNAL_DS_ID 69 + +#define MIP6_BUL_INTERNAL_DS_SZ sizeof(struct mip6_bul_internal) +#define MIP6_BUL_INTERNAL_DS_ID 70 +#endif /* MIP6 */ + +#ifdef SCTP +#define SCTP_INPCB_DS_SZ sizeof (struct sctp_inpcb) +#define SCTP_INPCB_DS_ID 71 + +#define SCTP_TCB_DS_SZ sizeof (struct sctp_tcb) +#define SCTP_TCB_DS_ID 72 + +#define SCTP_LADDR_DS_SZ sizeof (struct sctp_laddr) +#define SCTP_LADDR_DS_ID 73 + +#define SCTP_NETS_DS_SZ sizeof (struct sctp_nets) +#define SCTP_NETS_DS_ID 74 + +#define SCTP_TMITCHUNK_DS_SZ sizeof (struct sctp_tmit_chunk) +#define SCTP_TMITCHUNK_DS_ID 75 + +#define SCTP_SOCKETQLIST_DS_SZ sizeof (struct sctp_socket_q_list) +#define SCTP_SOCKETQLIST_DS_ID 76 +#endif /* SCTP */ + +#ifdef IPSEC +#define SECPOLICY_DS_SZ sizeof(struct secpolicy) +#define SECPOLICY_DS_ID 77 + +#define SECASHEAD_DS_SZ sizeof(struct secashead) +#define SECASHEAD_DS_ID 78 + +#define SECASVAR_DS_SZ sizeof(struct secasvar) +#define SECASVAR_DS_ID 79 + +#define SECREPLAY_DS_SZ sizeof(struct secreplay) +#define SECREPLAY_DS_ID 80 + +#define SECREG_DS_SZ sizeof(struct secreg) +#define SECREG_DS_ID 81 + +#define KEYCB_DS_SZ sizeof(struct keycb) +#define KEYCB_DS_ID 82 + +#define INPCBPOLICY_DS_SZ sizeof(struct inpcbpolicy) +#define INPCBPOLICY_DS_ID 83 + +#define IPSECREQUEST_DS_SZ sizeof(struct ipsecrequest) +#define IPSECREQUEST_DS_ID 84 +#endif /* IPSEC */ + +#ifdef IPSEC +#define MAX_NUM_POOLS 85 +#else +#define MAX_NUM_POOLS 77 +#endif + +/* + * If you add any new pools, be sure to add an entry to _dsMallocSizes + * in uipc_mbuf.c. Don't (re)move this comment as it is a useful reminder. + */ + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/h/wrn/coreip/sys/fnv_hash.h b/h/wrn/coreip/sys/fnv_hash.h new file mode 100644 index 0000000..dbbccb5 --- /dev/null +++ b/h/wrn/coreip/sys/fnv_hash.h @@ -0,0 +1,70 @@ +/* fnv_hash.h */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* + * Fowler / Noll / Vo Hash (FNV Hash) + * http://www.isthe.com/chongo/tech/comp/fnv/ + * + * This is an implementation of the algorithms posted above. + * This file is placed in the public domain by Peter Wemm. + * + * $FreeBSD: src/sys/sys/fnv_hash.h,v 1.2.2.1 2001/03/21 10:50:59 peter Exp $ + */ + +/* +modification history +-------------------- +01m,07feb05,vvv _KERNEL cleanup +01l,17jan05,vvv osdep.h cleanup +01k,16jul04,vvv moved function definitions to fnvHash.c to fix compiler + warnings +01j,20nov03,niq Remove copyright_wrs.h file inclusion +01i,05nov03,cdw Removal of unnecessary _KERNEL guards. +01h,04nov03,rlm Ran batch header path update for header re-org. +01g,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01f,23jul03,vvv added _KERNEL protection to fix warnings (SPR #89813) +01e,10jun03,vvv include netVersion.h +01d,15may03,pas changed u_int64_t (from internal types.h) to uint64_t + (from Tornado types.h) +01c,05may03,ppp adding inclusion of clarinet.h for non-coreip build +01b,29apr03,syy Added #ifdef for __cplusplus +01a,01jan03,pas Ported from FreeBSD 4.7 +*/ + +#ifndef __INCfnv_hashh +#define __INCfnv_hashh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _WRS_KERNEL + +#include +#include +#include + +typedef uint32_t Fnv32_t; +typedef uint64_t Fnv64_t; + +#define FNV1_32_INIT ((Fnv32_t) 33554467UL) +#define FNV1_64_INIT ((Fnv64_t) 0xcbf29ce484222325ULL) + +#define FNV_32_PRIME ((Fnv32_t) 0x01000193UL) +#define FNV_64_PRIME ((Fnv64_t) 0x100000001b3ULL) + +extern __inline Fnv32_t fnv_32_buf(const void *buf, size_t len, Fnv32_t hval); + +extern __inline Fnv32_t fnv_32_str(const char *str, Fnv32_t hval); + +extern __inline Fnv64_t fnv_64_buf(const void *buf, size_t len, Fnv64_t hval); + +extern __inline Fnv64_t fnv_64_str(const char *str, Fnv64_t hval); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* ! __INCfnv_hashh */ diff --git a/h/wrn/coreip/sys/mem_stru.h b/h/wrn/coreip/sys/mem_stru.h new file mode 100644 index 0000000..01a6637 --- /dev/null +++ b/h/wrn/coreip/sys/mem_stru.h @@ -0,0 +1,63 @@ +/* mem_stru.c - support routines for allocating/de-allocating data structures */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02k,29mar05,spm fixed virtual stack build error +02j,28jan05,wap Fix cast for DS_FREE() +02i,18jan05,wap Update DS_MALLOC() to avoid use of netClPoolIdGet() +02h,20nov03,niq Remove copyright_wrs.h file inclusion +02g,04nov03,rlm Ran batch header path update for header re-org. +02f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +02e,24oct03,cdw update include statements post header re-org. +02d,06aug03,nee Accordion Base6 merge from ACCORDION_BASE6_MERGE_BASELINE + label +02c,23apr03,pas removed ptr_t +02b,02dec02,spm merged from WINDNET_IPV6-1_0-FCS label (ver 02b,06sep02,hsh) +02a,12jun02,pas changed DS_MALLOC() to a wrapper around netClusterGet() +01g,13nov01,pas added memory pool metrics +01f,21sep01,ppp Chanding the _DEBUG_ option to DEBUGGING +01e,20sep01,qli adding more data struct util functions +01d,06sep01,ppp Changing the first parameter of dstru_mem_free from u_char* to + void* +01c,23aug01,ppp Adding an include +01b,07aug01,qli changing a struct field name +01a,06aug01,qli created +*/ + + +#ifndef _MEM_STRU_H_ +#define _MEM_STRU_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef ALIGN_MEM +#define ALIGN_MEM(cp, n) cp = (u_char *)(((u_long)cp + n - 1) & (~(n - 1))) +#endif + +#ifndef ALIGN_SZ +#define ALIGN_SZ 4 +#endif + +#ifndef VIRTUAL_STACK +extern CL_POOL_ID _dsMallocMap[]; +#endif /* VIRTUAL_STACK */ + +#define DS_MALLOC(x, y) \ + (void *) clusterGet(_pNetSysPool, (CL_POOL_ID)_dsMallocMap[y]) + +#define DS_FREE(x, y) \ + clFree (_pNetSysPool, (char *)(x)) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/coreip/sys/queue.h b/h/wrn/coreip/sys/queue.h new file mode 100644 index 0000000..30db5f1 --- /dev/null +++ b/h/wrn/coreip/sys/queue.h @@ -0,0 +1,582 @@ +/* queue.h - linked-list and queue definitions */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)queue.h 8.5 (Berkeley) 8/20/94 + * $FreeBSD: src/sys/sys/queue.h,v 1.32.2.7 2002/04/17 14:21:02 des Exp $ + */ + +/* +modification history +-------------------- +01l,07feb05,vvv _KERNEL cleanup +01k,03oct04,dlk Fix some diab compiler warnings by using do {} while (FALSE) + instead of do {} while (0) (wierd, but it works). +01j,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01i,12jul04,vvv converted insque/remque to macros to fix compiler warnings +01h,20nov03,niq Remove copyright_wrs.h file inclusion +01g,05nov03,cdw Removal of unnecessary _KERNEL guards. +01f,04nov03,rlm Ran batch header path update for header re-org. +01e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01d,10jun03,vvv include netVersion.h +01c,01feb03,pas merge from FreeBSD 4.7 - use access macros internally +01b,06sep02,hsh add c++ protection +01a,15jul02,rvr inline function insque and remque function defies for + diab (teamf1) +*/ + +#ifndef _SYS_QUEUE_H_ +#define _SYS_QUEUE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * This file defines five types of data structures: singly-linked lists, + * singly-linked tail queues, lists, tail queues, and circular queues. + * + * A singly-linked list is headed by a single forward pointer. The elements + * are singly linked for minimum space and pointer manipulation overhead at + * the expense of O(n) removal for arbitrary elements. New elements can be + * added to the list after an existing element or at the head of the list. + * Elements being removed from the head of the list should use the explicit + * macro for this purpose for optimum efficiency. A singly-linked list may + * only be traversed in the forward direction. Singly-linked lists are ideal + * for applications with large datasets and few or no removals or for + * implementing a LIFO queue. + * + * A singly-linked tail queue is headed by a pair of pointers, one to the + * head of the list and the other to the tail of the list. The elements are + * singly linked for minimum space and pointer manipulation overhead at the + * expense of O(n) removal for arbitrary elements. New elements can be added + * to the list after an existing element, at the head of the list, or at the + * end of the list. Elements being removed from the head of the tail queue + * should use the explicit macro for this purpose for optimum efficiency. + * A singly-linked tail queue may only be traversed in the forward direction. + * Singly-linked tail queues are ideal for applications with large datasets + * and few or no removals or for implementing a FIFO queue. + * + * A list is headed by a single forward pointer (or an array of forward + * pointers for a hash table header). The elements are doubly linked + * so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before + * or after an existing element or at the head of the list. A list + * may only be traversed in the forward direction. + * + * A tail queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or + * after an existing element, at the head of the list, or at the end of + * the list. A tail queue may be traversed in either direction. + * + * A circle queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or after + * an existing element, at the head of the list, or at the end of the list. + * A circle queue may be traversed in either direction, but has a more + * complex end of list detection. + * + * For details on the use of these macros, see the queue(3) manual page. + * + * + * SLIST LIST STAILQ TAILQ CIRCLEQ + * _HEAD + + + + + + * _HEAD_INITIALIZER + + + + + + * _ENTRY + + + + + + * _INIT + + + + + + * _EMPTY + + + + + + * _FIRST + + + + + + * _NEXT + + + + + + * _PREV - - - + + + * _LAST - - + + + + * _FOREACH + + + + + + * _FOREACH_REVERSE - - - + + + * _INSERT_HEAD + + + + + + * _INSERT_BEFORE - + - + + + * _INSERT_AFTER + + + + + + * _INSERT_TAIL - - + + + + * _REMOVE_HEAD + - + - - + * _REMOVE + + + + + + * + */ + +/* + * Singly-linked List declarations. + */ +#define SLIST_HEAD(name, type) \ +struct name { \ + struct type *slh_first; /* first element */ \ +} + +#define SLIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define SLIST_ENTRY(type) \ +struct { \ + struct type *sle_next; /* next element */ \ +} + +/* + * Singly-linked List functions. + */ +#define SLIST_EMPTY(head) ((head)->slh_first == NULL) + +#define SLIST_FIRST(head) ((head)->slh_first) + +#define SLIST_FOREACH(var, head, field) \ + for ((var) = SLIST_FIRST((head)); \ + (var); \ + (var) = SLIST_NEXT((var), field)) + +#define SLIST_INIT(head) do { \ + SLIST_FIRST((head)) = NULL; \ +} while (FALSE) + +#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ + SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field); \ + SLIST_NEXT((slistelm), field) = (elm); \ +} while (FALSE) + +#define SLIST_INSERT_HEAD(head, elm, field) do { \ + SLIST_NEXT((elm), field) = SLIST_FIRST((head)); \ + SLIST_FIRST((head)) = (elm); \ +} while (FALSE) + +#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) + +#define SLIST_REMOVE(head, elm, type, field) do { \ + if (SLIST_FIRST((head)) == (elm)) { \ + SLIST_REMOVE_HEAD((head), field); \ + } \ + else { \ + struct type *curelm = SLIST_FIRST((head)); \ + while (SLIST_NEXT(curelm, field) != (elm)) \ + curelm = SLIST_NEXT(curelm, field); \ + SLIST_NEXT(curelm, field) = \ + SLIST_NEXT(SLIST_NEXT(curelm, field), field); \ + } \ +} while (FALSE) + +#define SLIST_REMOVE_HEAD(head, field) do { \ + SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \ +} while (FALSE) + +/* + * Singly-linked Tail queue declarations. + */ +#define STAILQ_HEAD(name, type) \ +struct name { \ + struct type *stqh_first;/* first element */ \ + struct type **stqh_last;/* addr of last next element */ \ +} + +#define STAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).stqh_first } + +#define STAILQ_ENTRY(type) \ +struct { \ + struct type *stqe_next; /* next element */ \ +} + +/* + * Singly-linked Tail queue functions. + */ +#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) + +#define STAILQ_FIRST(head) ((head)->stqh_first) + +#define STAILQ_FOREACH(var, head, field) \ + for((var) = STAILQ_FIRST((head)); \ + (var); \ + (var) = STAILQ_NEXT((var), field)) + +#define STAILQ_INIT(head) do { \ + STAILQ_FIRST((head)) = NULL; \ + (head)->stqh_last = &STAILQ_FIRST((head)); \ +} while (FALSE) + +#define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \ + if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\ + (head)->stqh_last = &STAILQ_NEXT((elm), field); \ + STAILQ_NEXT((tqelm), field) = (elm); \ +} while (FALSE) + +#define STAILQ_INSERT_HEAD(head, elm, field) do { \ + if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \ + (head)->stqh_last = &STAILQ_NEXT((elm), field); \ + STAILQ_FIRST((head)) = (elm); \ +} while (FALSE) + +#define STAILQ_INSERT_TAIL(head, elm, field) do { \ + STAILQ_NEXT((elm), field) = NULL; \ + *(head)->stqh_last = (elm); \ + (head)->stqh_last = &STAILQ_NEXT((elm), field); \ +} while (FALSE) + +#define STAILQ_LAST(head, type, field) \ + (STAILQ_EMPTY(head) ? \ + NULL : \ + ((struct type *) \ + ((char *)((head)->stqh_last) - __offsetof(struct type, field)))) + +#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) + +#define STAILQ_REMOVE(head, elm, type, field) do { \ + if (STAILQ_FIRST((head)) == (elm)) { \ + STAILQ_REMOVE_HEAD(head, field); \ + } \ + else { \ + struct type *curelm = STAILQ_FIRST((head)); \ + while (STAILQ_NEXT(curelm, field) != (elm)) \ + curelm = STAILQ_NEXT(curelm, field); \ + if ((STAILQ_NEXT(curelm, field) = \ + STAILQ_NEXT(STAILQ_NEXT(curelm, field), field)) == NULL)\ + (head)->stqh_last = &STAILQ_NEXT((curelm), field);\ + } \ +} while (FALSE) + +#define STAILQ_REMOVE_HEAD(head, field) do { \ + if ((STAILQ_FIRST((head)) = \ + STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \ + (head)->stqh_last = &STAILQ_FIRST((head)); \ +} while (FALSE) + +#define STAILQ_REMOVE_HEAD_UNTIL(head, elm, field) do { \ + if ((STAILQ_FIRST((head)) = STAILQ_NEXT((elm), field)) == NULL) \ + (head)->stqh_last = &STAILQ_FIRST((head)); \ +} while (FALSE) + +/* + * List declarations. + */ +#define LIST_HEAD(name, type) \ +struct name { \ + struct type *lh_first; /* first element */ \ +} + +#define LIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define LIST_ENTRY(type) \ +struct { \ + struct type *le_next; /* next element */ \ + struct type **le_prev; /* address of previous next element */ \ +} + +/* + * List functions. + */ + +#define LIST_EMPTY(head) ((head)->lh_first == NULL) + +#define LIST_FIRST(head) ((head)->lh_first) + +#define LIST_FOREACH(var, head, field) \ + for ((var) = LIST_FIRST((head)); \ + (var); \ + (var) = LIST_NEXT((var), field)) + +#define LIST_INIT(head) do { \ + LIST_FIRST((head)) = NULL; \ +} while (FALSE) + +#define LIST_INSERT_AFTER(listelm, elm, field) do { \ + if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\ + LIST_NEXT((listelm), field)->field.le_prev = \ + &LIST_NEXT((elm), field); \ + LIST_NEXT((listelm), field) = (elm); \ + (elm)->field.le_prev = &LIST_NEXT((listelm), field); \ +} while (FALSE) + +#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ + (elm)->field.le_prev = (listelm)->field.le_prev; \ + LIST_NEXT((elm), field) = (listelm); \ + *(listelm)->field.le_prev = (elm); \ + (listelm)->field.le_prev = &LIST_NEXT((elm), field); \ +} while (FALSE) + +#define LIST_INSERT_HEAD(head, elm, field) do { \ + if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \ + LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\ + LIST_FIRST((head)) = (elm); \ + (elm)->field.le_prev = &LIST_FIRST((head)); \ +} while (FALSE) + +#define LIST_NEXT(elm, field) ((elm)->field.le_next) + +#define LIST_REMOVE(elm, field) do { \ + if (LIST_NEXT((elm), field) != NULL) \ + LIST_NEXT((elm), field)->field.le_prev = \ + (elm)->field.le_prev; \ + *(elm)->field.le_prev = LIST_NEXT((elm), field); \ +} while (FALSE) + +/* + * Tail queue declarations. + */ +#define TAILQ_HEAD(name, type) \ +struct name { \ + struct type *tqh_first; /* first element */ \ + struct type **tqh_last; /* addr of last next element */ \ +} + +#define TAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).tqh_first } + +#define TAILQ_ENTRY(type) \ +struct { \ + struct type *tqe_next; /* next element */ \ + struct type **tqe_prev; /* address of previous next element */ \ +} + +/* + * Tail queue functions. + */ +#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) + +#define TAILQ_FIRST(head) ((head)->tqh_first) + +#define TAILQ_FOREACH(var, head, field) \ + for ((var) = TAILQ_FIRST((head)); \ + (var); \ + (var) = TAILQ_NEXT((var), field)) + +#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ + for ((var) = TAILQ_LAST((head), headname); \ + (var); \ + (var) = TAILQ_PREV((var), headname, field)) + +#define TAILQ_INIT(head) do { \ + TAILQ_FIRST((head)) = NULL; \ + (head)->tqh_last = &TAILQ_FIRST((head)); \ +} while (FALSE) + +#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ + if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\ + TAILQ_NEXT((elm), field)->field.tqe_prev = \ + &TAILQ_NEXT((elm), field); \ + else \ + (head)->tqh_last = &TAILQ_NEXT((elm), field); \ + TAILQ_NEXT((listelm), field) = (elm); \ + (elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \ +} while (FALSE) + +#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ + (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ + TAILQ_NEXT((elm), field) = (listelm); \ + *(listelm)->field.tqe_prev = (elm); \ + (listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \ +} while (FALSE) + +#define TAILQ_INSERT_HEAD(head, elm, field) do { \ + if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \ + TAILQ_FIRST((head))->field.tqe_prev = \ + &TAILQ_NEXT((elm), field); \ + else \ + (head)->tqh_last = &TAILQ_NEXT((elm), field); \ + TAILQ_FIRST((head)) = (elm); \ + (elm)->field.tqe_prev = &TAILQ_FIRST((head)); \ +} while (FALSE) + +#define TAILQ_INSERT_TAIL(head, elm, field) do { \ + TAILQ_NEXT((elm), field) = NULL; \ + (elm)->field.tqe_prev = (head)->tqh_last; \ + *(head)->tqh_last = (elm); \ + (head)->tqh_last = &TAILQ_NEXT((elm), field); \ +} while (FALSE) + +#define TAILQ_LAST(head, headname) \ + (*(((struct headname *)((head)->tqh_last))->tqh_last)) + +#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) + +#define TAILQ_PREV(elm, headname, field) \ + (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) + +#define TAILQ_REMOVE(head, elm, field) do { \ + if ((TAILQ_NEXT((elm), field)) != NULL) \ + TAILQ_NEXT((elm), field)->field.tqe_prev = \ + (elm)->field.tqe_prev; \ + else \ + (head)->tqh_last = (elm)->field.tqe_prev; \ + *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \ +} while (FALSE) + +/* + * Circular queue declarations. + */ +#define CIRCLEQ_HEAD(name, type) \ +struct name { \ + struct type *cqh_first; /* first element */ \ + struct type *cqh_last; /* last element */ \ +} + +#define CIRCLEQ_HEAD_INITIALIZER(head) \ + { (void *)&(head), (void *)&(head) } + +#define CIRCLEQ_ENTRY(type) \ +struct { \ + struct type *cqe_next; /* next element */ \ + struct type *cqe_prev; /* previous element */ \ +} + +/* + * Circular queue functions. + */ +#define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head)) + +#define CIRCLEQ_FIRST(head) ((head)->cqh_first) + +#define CIRCLEQ_FOREACH(var, head, field) \ + for ((var) = CIRCLEQ_FIRST((head)); \ + (var) != (void *)(head) || ((var) = NULL); \ + (var) = CIRCLEQ_NEXT((var), field)) + +#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ + for ((var) = CIRCLEQ_LAST((head)); \ + (var) != (void *)(head) || ((var) = NULL); \ + (var) = CIRCLEQ_PREV((var), field)) + +#define CIRCLEQ_INIT(head) do { \ + CIRCLEQ_FIRST((head)) = (void *)(head); \ + CIRCLEQ_LAST((head)) = (void *)(head); \ +} while (FALSE) + +#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ + CIRCLEQ_NEXT((elm), field) = CIRCLEQ_NEXT((listelm), field); \ + CIRCLEQ_PREV((elm), field) = (listelm); \ + if (CIRCLEQ_NEXT((listelm), field) == (void *)(head)) \ + CIRCLEQ_LAST((head)) = (elm); \ + else \ + CIRCLEQ_PREV(CIRCLEQ_NEXT((listelm), field), field) = (elm);\ + CIRCLEQ_NEXT((listelm), field) = (elm); \ +} while (FALSE) + +#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ + CIRCLEQ_NEXT((elm), field) = (listelm); \ + CIRCLEQ_PREV((elm), field) = CIRCLEQ_PREV((listelm), field); \ + if (CIRCLEQ_PREV((listelm), field) == (void *)(head)) \ + CIRCLEQ_FIRST((head)) = (elm); \ + else \ + CIRCLEQ_NEXT(CIRCLEQ_PREV((listelm), field), field) = (elm);\ + CIRCLEQ_PREV((listelm), field) = (elm); \ +} while (FALSE) + +#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ + CIRCLEQ_NEXT((elm), field) = CIRCLEQ_FIRST((head)); \ + CIRCLEQ_PREV((elm), field) = (void *)(head); \ + if (CIRCLEQ_LAST((head)) == (void *)(head)) \ + CIRCLEQ_LAST((head)) = (elm); \ + else \ + CIRCLEQ_PREV(CIRCLEQ_FIRST((head)), field) = (elm); \ + CIRCLEQ_FIRST((head)) = (elm); \ +} while (FALSE) + +#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ + CIRCLEQ_NEXT((elm), field) = (void *)(head); \ + CIRCLEQ_PREV((elm), field) = CIRCLEQ_LAST((head)); \ + if (CIRCLEQ_FIRST((head)) == (void *)(head)) \ + CIRCLEQ_FIRST((head)) = (elm); \ + else \ + CIRCLEQ_NEXT(CIRCLEQ_LAST((head)), field) = (elm); \ + CIRCLEQ_LAST((head)) = (elm); \ +} while (FALSE) + +#define CIRCLEQ_LAST(head) ((head)->cqh_last) + +#define CIRCLEQ_NEXT(elm,field) ((elm)->field.cqe_next) + +#define CIRCLEQ_PREV(elm,field) ((elm)->field.cqe_prev) + +#define CIRCLEQ_REMOVE(head, elm, field) do { \ + if (CIRCLEQ_NEXT((elm), field) == (void *)(head)) \ + CIRCLEQ_LAST((head)) = CIRCLEQ_PREV((elm), field); \ + else \ + CIRCLEQ_PREV(CIRCLEQ_NEXT((elm), field), field) = \ + CIRCLEQ_PREV((elm), field); \ + if (CIRCLEQ_PREV((elm), field) == (void *)(head)) \ + CIRCLEQ_FIRST((head)) = CIRCLEQ_NEXT((elm), field); \ + else \ + CIRCLEQ_NEXT(CIRCLEQ_PREV((elm), field), field) = \ + CIRCLEQ_NEXT((elm), field); \ +} while (FALSE) + +#ifdef _WRS_KERNEL + +/* + * XXX insque() and remque() are an old way of handling certain queues. + * They assume that all queue heads look alike. + * + * insque and remque are short and are not used much so it should be ok to + * implement them as macros rather than inline functions. + */ + +struct quehead { + struct quehead *qh_link; + struct quehead *qh_rlink; +}; + +#define insque(a, b) \ + { \ + struct quehead * element = (struct quehead *) (a); \ + struct quehead * head = (struct quehead *) (b); \ + \ + element->qh_link = head->qh_link; \ + element->qh_rlink = head; \ + head->qh_link = element; \ + element->qh_link->qh_rlink = element; \ + } + +#define remque(a) \ + { \ + struct quehead * element = (struct quehead *) (a); \ + \ + element->qh_link->qh_rlink = element->qh_rlink; \ + element->qh_rlink->qh_link = element->qh_link; \ + element->qh_rlink = 0; \ + } + +#endif /* _WRS_KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_SYS_QUEUE_H_ */ diff --git a/h/wrn/coreip/sys/socket.h b/h/wrn/coreip/sys/socket.h new file mode 100644 index 0000000..5a2bc4d --- /dev/null +++ b/h/wrn/coreip/sys/socket.h @@ -0,0 +1,554 @@ +/* socket.h - public socket structures and definitions */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* + * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)socket.h 8.4 (Berkeley) 2/21/94 + * $FreeBSD: src/sys/sys/socket.h,v 1.39.2.7 2001/07/03 11:02:01 ume Exp $ + */ + +/* +modification history +-------------------- +02b,15sep05,kch Added priority_tagged boolean to sovlan structure for + priority-tagged frames support (SPR #112513). +02a,29aug05,kch Added on/off option to sovlan structure. Corrected + SO_VLAN define to use value that falls in the range + for socket option that is kept in so_options (SPR #112068). +01z,09aug05,kch Added SO_VLAN socket level option and sovlan structure + definition for socket-based vlan support. +01y,12jul05,vvv merged MSG_NOTIFICATION from kame-20050404-freebsd411 +01x,16may05,kch Added MOBILITY address & protocol family. +01x,12may05,als Add AF_TIPC support +01w,05mar05,dlk Move SO_VSNUM and SO_VSID out of so_options flags. + Add SO_LINGERRESET option. +01v,07feb05,vvv _KERNEL cleanup +01u,12jan05,vvv osdep.h cleanup +01t,14oct04,nee include osdep.h and machdep.h when _KERNEL is defined + (SPR #102593) +01s,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01r,19jul04,spm enabled socket operations from different virtual stacks +01q,15jun04,nee adding the SOCKADDR typedef +01p,12jan04,bwa turned-on MSG_EXP option +01o,02jan04,vvv added socket option SO_CONNTIMEO +01n,21nov03,bwa added COMP protocol-specific socket flags and options +01m,20nov03,niq Remove copyright_wrs.h file inclusion +01l,05nov03,cdw Removal of unnecessary _KERNEL guards. +01k,04nov03,rlm Ran batch header path update for header re-org. +01j,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01i,27sep03,vvv made SOCKADDR_STORAGE_T definition consistent between + kernel and non-kernel builds +01h,06aug03,nee Accordion Base6 merge from ACCORDION_BASE6_MERGE_BASELINE + label +01g,10jun03,vvv include netVersion.h +01f,09may03,vvv included vxWorks.h +01e,06sep02,hsh add c++ protection +01d,03feb02,ham changes for tornado build. +01c,13sep01,ann enabling the cmsg defines +01b,14aug01,ann correcting the header file inclusions +01a,02aug01,ann performed the initial-port from FreeBSD 4.3 v 1.39.2.7 + */ + + +#ifndef _SYS_SOCKET_H_ +#define _SYS_SOCKET_H_ + +#ifdef __cplusplus + extern "C" { +#endif + +#include +#include + + +/* + * Definitions related to sockets: types, address families, options. + */ + +/* + * Data types. + */ +typedef u_char sa_family_t; + +typedef unsigned int socklen_t; + +/* + * Types + */ +#define SOCK_STREAM 1 /* stream socket */ +#define SOCK_DGRAM 2 /* datagram socket */ +#define SOCK_RAW 3 /* raw-protocol interface */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequenced packet stream */ + +/* + * Option flags per-socket. + */ +#define SO_DEBUG 0x0001 /* turn on debugging info recording */ +#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */ +#define SO_REUSEADDR 0x0004 /* allow local address reuse */ +#define SO_KEEPALIVE 0x0008 /* keep connections alive */ +#define SO_DONTROUTE 0x0010 /* just use interface addresses */ +#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */ +#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ +#define SO_LINGER 0x0080 /* linger on close if data present */ +#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ +#define SO_REUSEPORT 0x0200 /* allow local address & port reuse */ +#define SO_TIMESTAMP 0x0400 /* timestamp received dgram traffic */ + +#if 0 /* presently unsupported */ +#define SO_ACCEPTFILTER 0x1000 /* there is an accept filter */ +#endif +#define SO_LINGERRESET 0x2000 /* when linger fails, reset conn. */ +#define SO_VSLOCK 0x4000 /* restrict calls to creation stack */ +#define SO_VLAN 0x8000 /* get/set VLAN ID and user priority */ +#define SO_PRIVBUF 0x0 /* COMP-only: socket uses private pool*/ + + +/* + * Additional options, not kept in so_options. + */ +#define SO_SNDBUF 0x1001 /* send buffer size */ +#define SO_RCVBUF 0x1002 /* receive buffer size */ +#define SO_SNDLOWAT 0x1003 /* send low-water mark */ +#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ +#define SO_SNDTIMEO 0x1005 /* send timeout */ +#define SO_RCVTIMEO 0x1006 /* receive timeout */ +#define SO_ERROR 0x1007 /* get error status and clear */ +#define SO_TYPE 0x1008 /* get socket type */ +/*#define SO_PRIVSTATE 0x1009 get/deny privileged state */ +#define SO_CONNTIMEO 0x100a /* connection timeout for */ + /* connectWithTimeout in RTP space */ + +/* + * VxWorks-specific socket options not in so_options: use 0x0fff downward. + * Note that this convention, like the one above, avoids the single-bit + * option flags in so_options, and also hopefully avoids any new BSD options. + */ + +#define SO_VSNUM 0x0fff /* get only: virtual stack number */ +#define SO_VSID 0x0ffe /* get only: virtual stack ID */ + + +/* + * Structure used for manipulating linger option. + */ +struct linger { + int l_onoff; /* option on/off */ + int l_linger; /* linger time */ +}; + +/* + * VxWorks-specific socket structure for manipulating SO_VLAN option + */ +struct sovlan { + + /* + * If so_onff is set, the vlan id and/or user priority will be copied + * to the socket structure and SO_VLAN so_option will be set. If so_onff + * is not set, the SO_VLAN so_option for the given socket will be cleared. + */ + int vlan_onoff; /* option on/off */ + + /* + * The priority_tagged boolean must be set to true if application using + * socket-based vlan requires to egress 802.1P priority-tagged frame + * (i.e. the value of vid is zero). Defaults to false. If set to true, + * the value specified by the vid will be ignored. + */ + BOOL priority_tagged; + + unsigned short vid; /* VLAN ID, valid vid: 1..4094 */ + unsigned short upriority; /* User Priority, valid priority: 0..7 */ +}; + +#if 0 /* Clarinet */ +struct accept_filter_arg { + char af_name[16]; + char af_arg[256-16]; +}; +#endif /* # if 0 */ + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +#define SOL_SOCKET 0xffff /* options for socket level */ + +/* + * Address families. + */ +#define AF_UNSPEC 0 /* unspecified */ +#define AF_LOCAL 1 /* local to host (pipes, portals) */ +#define AF_UNIX AF_LOCAL /* backward compatibility */ +#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ +#define AF_IMPLINK 3 /* arpanet imp addresses */ +#define AF_PUP 4 /* pup protocols: e.g. BSP */ +#define AF_CHAOS 5 /* mit CHAOS protocols */ +#define AF_NS 6 /* XEROX NS protocols */ +#define AF_ISO 7 /* ISO protocols */ +#define AF_OSI AF_ISO +#define AF_ECMA 8 /* European computer manufacturers */ +#define AF_DATAKIT 9 /* datakit protocols */ +#define AF_CCITT 10 /* CCITT protocols, X.25 etc */ +#define AF_SNA 11 /* IBM SNA */ +#define AF_DECnet 12 /* DECnet */ +#define AF_DLI 13 /* DEC Direct data link interface */ +#define AF_LAT 14 /* LAT */ +#define AF_HYLINK 15 /* NSC Hyperchannel */ +#define AF_APPLETALK 16 /* Apple Talk */ +#define AF_ROUTE 17 /* Internal Routing Protocol */ +#define AF_LINK 18 /* Link layer interface */ +#define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */ +#define AF_COIP 20 /* connection-oriented IP, aka ST II */ +#define AF_CNT 21 /* Computer Network Technology */ +#define pseudo_AF_RTIP 22 /* Help Identify RTIP packets */ +#define AF_IPX 23 /* Novell Internet Protocol */ +#define AF_SIP 24 /* Simple Internet Protocol */ +#define pseudo_AF_PIP 25 /* Help Identify PIP packets */ +#define AF_ISDN 26 /* Integrated Services Digital Network*/ +#define AF_E164 AF_ISDN /* CCITT E.164 recommendation */ +#define pseudo_AF_KEY 27 /* Internal key-management function */ +#define AF_INET6 28 /* IPv6 */ +#define AF_NATM 29 /* native ATM access */ +#define AF_ATM 30 /* ATM */ +#define pseudo_AF_HDRCMPLT 31 /* Used by BPF to not rewrite headers + * in interface output routine + */ +#define AF_NETGRAPH 32 /* Netgraph sockets */ +#define AF_TIPC 33 /* Tranparent Inter-Process Communic. */ +#define AF_MOBILITY 34 + +#define AF_MAX 35 + +/* + * Structure used by kernel to store most + * addresses. + */ +struct sockaddr { + u_char sa_len; /* total length */ + sa_family_t sa_family; /* address family */ + char sa_data[14]; /* actually longer; address value */ +}; + +#define SOCK_MAXADDRLEN 255 /* longest possible addresses */ +typedef struct sockaddr SOCKADDR; + +/* + * Structure used by kernel to pass protocol + * information in raw sockets. + */ +struct sockproto { + u_short sp_family; /* address family */ + u_short sp_protocol; /* protocol */ +}; + +/* + * RFC 2553: protocol-independent placeholder for socket addresses + */ +#define _SS_MAXSIZE 28 +#define _SS_ALIGNSIZE (sizeof(int64_t)) +#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(u_char) - sizeof(sa_family_t)) +#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(u_char) - sizeof(sa_family_t) - \ + _SS_PAD1SIZE - _SS_ALIGNSIZE) + +struct sockaddr_storage { + u_char ss_len; /* address length */ + sa_family_t ss_family; /* address family */ + char __ss_pad1[_SS_PAD1SIZE]; + int64_t __ss_align; /* force desired structure storage alignment */ + char __ss_pad2[_SS_PAD2SIZE]; +}; + +#ifdef INET6 +typedef struct sockaddr_storage SOCKADDR_STORAGE_T; +#else +typedef struct sockaddr SOCKADDR_STORAGE_T; +#endif /* INET6 */ + +/* + * Protocol families, same as address families for now. + */ +#define PF_UNSPEC AF_UNSPEC +#define PF_LOCAL AF_LOCAL +#define PF_UNIX PF_LOCAL /* backward compatibility */ +#define PF_INET AF_INET +#define PF_IMPLINK AF_IMPLINK +#define PF_PUP AF_PUP +#define PF_CHAOS AF_CHAOS +#define PF_NS AF_NS +#define PF_ISO AF_ISO +#define PF_OSI AF_ISO +#define PF_ECMA AF_ECMA +#define PF_DATAKIT AF_DATAKIT +#define PF_CCITT AF_CCITT +#define PF_SNA AF_SNA +#define PF_DECnet AF_DECnet +#define PF_DLI AF_DLI +#define PF_LAT AF_LAT +#define PF_HYLINK AF_HYLINK +#define PF_APPLETALK AF_APPLETALK +#define PF_ROUTE AF_ROUTE +#define PF_LINK AF_LINK +#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */ +#define PF_COIP AF_COIP +#define PF_CNT AF_CNT +#define PF_SIP AF_SIP +#define PF_IPX AF_IPX /* same format as AF_NS */ +#define PF_RTIP pseudo_AF_RTIP /* same format as AF_INET */ +#define PF_PIP pseudo_AF_PIP +#define PF_ISDN AF_ISDN +#define PF_KEY pseudo_AF_KEY +#define PF_INET6 AF_INET6 +#define PF_NATM AF_NATM +#define PF_ATM AF_ATM +#define PF_NETGRAPH AF_NETGRAPH +#define PF_MOBILITY AF_MOBILITY + +#define PF_MAX AF_MAX + +/* + * Definitions for network related sysctl, CTL_NET. + * + * Second level is protocol family. + * Third level is protocol number. + * + * Further levels are defined by the individual families below. + */ +#define NET_MAXID AF_MAX + +#define CTL_NET_NAMES { \ + { 0, 0 }, \ + { "unix", CTLTYPE_NODE }, \ + { "inet", CTLTYPE_NODE }, \ + { "implink", CTLTYPE_NODE }, \ + { "pup", CTLTYPE_NODE }, \ + { "chaos", CTLTYPE_NODE }, \ + { "xerox_ns", CTLTYPE_NODE }, \ + { "iso", CTLTYPE_NODE }, \ + { "emca", CTLTYPE_NODE }, \ + { "datakit", CTLTYPE_NODE }, \ + { "ccitt", CTLTYPE_NODE }, \ + { "ibm_sna", CTLTYPE_NODE }, \ + { "decnet", CTLTYPE_NODE }, \ + { "dec_dli", CTLTYPE_NODE }, \ + { "lat", CTLTYPE_NODE }, \ + { "hylink", CTLTYPE_NODE }, \ + { "appletalk", CTLTYPE_NODE }, \ + { "route", CTLTYPE_NODE }, \ + { "link_layer", CTLTYPE_NODE }, \ + { "xtp", CTLTYPE_NODE }, \ + { "coip", CTLTYPE_NODE }, \ + { "cnt", CTLTYPE_NODE }, \ + { "rtip", CTLTYPE_NODE }, \ + { "ipx", CTLTYPE_NODE }, \ + { "sip", CTLTYPE_NODE }, \ + { "pip", CTLTYPE_NODE }, \ + { "isdn", CTLTYPE_NODE }, \ + { "key", CTLTYPE_NODE }, \ + { "inet6", CTLTYPE_NODE }, \ + { "natm", CTLTYPE_NODE }, \ + { "atm", CTLTYPE_NODE }, \ + { "hdrcomplete", CTLTYPE_NODE }, \ + { "netgraph", CTLTYPE_NODE }, \ +} + +/* + * PF_ROUTE - Routing table + * + * Three additional levels are defined: + * Fourth: address family, 0 is wildcard + * Fifth: type of info, defined below + * Sixth: flag(s) to mask with for NET_RT_FLAGS + */ +#define NET_RT_DUMP 1 /* dump; may limit to a.f. */ +#define NET_RT_FLAGS 2 /* by flags, e.g. RESOLVING */ +#define NET_RT_IFLIST 3 /* survey interface list */ +#define NET_RT_MAXID 4 + +#define CTL_NET_RT_NAMES { \ + { 0, 0 }, \ + { "dump", CTLTYPE_STRUCT }, \ + { "flags", CTLTYPE_STRUCT }, \ + { "iflist", CTLTYPE_STRUCT }, \ +} + +/* + * Maximum queue length specifiable by listen. + */ +#define SOMAXCONN 128 + +/* + * Message header for recvmsg and sendmsg calls. + * Used value-result for recvmsg, value only for sendmsg. + */ +struct msghdr { + void *msg_name; /* optional address */ + socklen_t msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + int msg_iovlen; /* # elements in msg_iov */ + void *msg_control; /* ancillary data, see below */ + socklen_t msg_controllen; /* ancillary data buffer len */ + int msg_flags; /* flags on received message */ +}; + +#define MSG_OOB 0x1 /* process out-of-band data */ +#define MSG_PEEK 0x2 /* peek at incoming message */ +#define MSG_DONTROUTE 0x4 /* send without using routing tables */ +#define MSG_EOR 0x8 /* data completes record */ +#define MSG_TRUNC 0x10 /* data discarded before delivery */ +#define MSG_CTRUNC 0x20 /* control data lost before delivery */ +#define MSG_WAITALL 0x40 /* wait for full request or error */ +#define MSG_DONTWAIT 0x80 /* this message should be nonblocking */ +#define MSG_EOF 0x100 /* data completes connection */ +#define MSG_EXP 0x200 /* COMP-only: send express message */ +#define MSG_MBUF 0x400 /* WRS extension */ +#define MSG_NOTIFICATION 0x800 /* notification message */ +#define MSG_COMPAT 0x8000 /* used in sendit() */ + + +/* + * Header for ancillary data objects in msg_control buffer. + * Used for additional information with/about a datagram + * not expressible by flags. The format is a sequence + * of message elements headed by cmsghdr structures. + */ +struct cmsghdr { + socklen_t cmsg_len; /* data byte count, including hdr */ + int cmsg_level; /* originating protocol */ + int cmsg_type; /* protocol-specific type */ +/* followed by u_char cmsg_data[]; */ +}; + +/* + * While we may have more groups than this, the cmsgcred struct must + * be able to fit in an mbuf, and NGROUPS_MAX is too large to allow + * this. +*/ +#define CMGROUP_MAX 16 + +/* + * Credentials structure, used to verify the identity of a peer + * process that has sent us a message. This is allocated by the + * peer process but filled in by the kernel. This prevents the + * peer from lying about its identity. (Note that cmcred_groups[0] + * is the effective GID.) + */ +struct cmsgcred { + pid_t cmcred_pid; /* PID of sending process */ + uid_t cmcred_uid; /* real UID of sending process */ + uid_t cmcred_euid; /* effective UID of sending process */ + gid_t cmcred_gid; /* real GID of sending process */ + short cmcred_ngroups; /* number or groups */ + gid_t cmcred_groups[CMGROUP_MAX]; /* groups */ +}; + +#define _ALIGNBYTES (sizeof (int) - 1) +#define _ALIGN(p) (((unsigned) (p) + _ALIGNBYTES) & ~_ALIGNBYTES) + +/* given pointer to struct cmsghdr, return pointer to data */ +#define CMSG_DATA(cmsg) ((u_char *)(cmsg) + \ + _ALIGN(sizeof(struct cmsghdr))) + +/* given pointer to struct cmsghdr, return pointer to next cmsghdr */ +#define CMSG_NXTHDR(mhdr, cmsg) \ + (((caddr_t)(cmsg) + _ALIGN((cmsg)->cmsg_len) + \ + _ALIGN(sizeof(struct cmsghdr)) > \ + (caddr_t)(mhdr)->msg_control + (mhdr)->msg_controllen) ? \ + (struct cmsghdr *)NULL : \ + (struct cmsghdr *)((caddr_t)(cmsg) + _ALIGN((cmsg)->cmsg_len))) + +#define CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control) + +/* RFC 2292 additions */ + +#define CMSG_SPACE(l) (_ALIGN(sizeof(struct cmsghdr)) + _ALIGN(l)) +#define CMSG_LEN(l) (_ALIGN(sizeof(struct cmsghdr)) + (l)) + +#ifdef _WRS_KERNEL +#define CMSG_ALIGN(n) _ALIGN(n) +#endif + +/* "Socket"-level control message types: */ +#define SCM_RIGHTS 0x01 /* access rights (array of int) */ +#define SCM_TIMESTAMP 0x02 /* timestamp (struct timeval) */ +#define SCM_CREDS 0x03 /* process creds (struct cmsgcred) */ + +/* + * 4.3 compat sockaddr, move to compat file later + */ +struct osockaddr { + u_short sa_family; /* address family */ + char sa_data[14]; /* up to 14 bytes of direct address */ +}; + +/* + * 4.3-compat message header (move to compat file later). + */ +struct omsghdr { + caddr_t msg_name; /* optional address */ + int msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + int msg_iovlen; /* # elements in msg_iov */ + caddr_t msg_accrights; /* access rights sent/received */ + int msg_accrightslen; +}; + +/* + * howto arguments for shutdown(2), specified by Posix.1g. + */ +#define SHUT_RD 0 /* shut down the reading side */ +#define SHUT_WR 1 /* shut down the writing side */ +#define SHUT_RDWR 2 /* shut down both sides */ + +/* + * sendfile(2) header/trailer struct + */ +struct sf_hdtr { + struct iovec *headers; /* pointer to an array of header struct iovec's */ + int hdr_cnt; /* number of header iovec's */ + struct iovec *trailers; /* pointer to an array of trailer struct iovec's */ + int trl_cnt; /* number of trailer iovec's */ +}; + +#ifdef __cplusplus +} +#endif + +#endif /* !_SYS_SOCKET_H_ */ diff --git a/h/wrn/coreip/sys/sockio.h b/h/wrn/coreip/sys/sockio.h new file mode 100644 index 0000000..d81a247 --- /dev/null +++ b/h/wrn/coreip/sys/sockio.h @@ -0,0 +1,186 @@ +/* sockio.h - Socket I/O header */ + +/* + * Copyright (c) 2001-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/*- + * Copyright (c) 1982, 1986, 1990, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)sockio.h 8.1 (Berkeley) 3/28/94 + * $FreeBSD: src/sys/sys/sockio.h,v 1.14.2.6 2002/02/07 15:12:37 ambrisko Exp $ + */ +/* + * Copyright (c) 2002 INRIA. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by INRIA and its + * contributors. + * 4. Neither the name of INRIA nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* +modification history +-------------------- +01l,29jun05,spm updated for IGMPv3 support +01k,16may05,kch Added SIOGBULIST for MIP6. +01j,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +01i,24feb04,dlk Add closing brace if __cplusplus is defined. +01h,20nov03,niq Remove copyright_wrs.h file inclusion +01g,04nov03,rlm Ran batch header path update for header re-org. +01f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01e,01feb03,pas merge from FreeBSD 4.7 - added ioctls for interface features, + interface clones, linux private +01d,09sep02,hsh add c++ protection +01c,24aug02,nee removing ioctl for admin status get +01b,27aug01,ann changing the path for ioccom.h +01a,23aug01,ppp Created from FreeBSD 4.3 +*/ + +#ifndef _SYS_SOCKIO_H_ +#define _SYS_SOCKIO_H_ + +#ifdef __cplusplus + extern "C" { +#endif + +/* Socket ioctl's. */ +#define SIOCSHIWAT _IOW('s', 0, int) /* set high watermark */ +#define SIOCGHIWAT _IOR('s', 1, int) /* get high watermark */ +#define SIOCSLOWAT _IOW('s', 2, int) /* set low watermark */ +#define SIOCGLOWAT _IOR('s', 3, int) /* get low watermark */ +#define SIOCATMARK _IOR('s', 7, int) /* at oob mark? */ +#define SIOCSPGRP _IOW('s', 8, int) /* set process group */ +#define SIOCGPGRP _IOR('s', 9, int) /* get process group */ + +#define SIOCADDRT _IOW('r', 10, struct ortentry) /* add route */ +#define SIOCDELRT _IOW('r', 11, struct ortentry) /* delete route */ +#define SIOCGETVIFCNT _IOWR('r', 15, struct sioc_vif_req)/* get vif pkt cnt */ +#define SIOCGETSGCNT _IOWR('r', 16, struct sioc_sg_req) /* get s,g pkt cnt */ + +#define SIOCSIFADDR _IOW('i', 12, struct ifreq) /* set ifnet address */ +#define OSIOCGIFADDR _IOWR('i', 13, struct ifreq) /* get ifnet address */ +#define SIOCGIFADDR _IOWR('i', 33, struct ifreq) /* get ifnet address */ +#define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) /* set p-p address */ +#define OSIOCGIFDSTADDR _IOWR('i', 15, struct ifreq) /* get p-p address */ +#define SIOCGIFDSTADDR _IOWR('i', 34, struct ifreq) /* get p-p address */ +#define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) /* set ifnet flags */ +#define SIOCGIFFLAGS _IOWR('i', 17, struct ifreq) /* get ifnet flags */ +#define OSIOCGIFBRDADDR _IOWR('i', 18, struct ifreq) /* get broadcast addr */ +#define SIOCGIFBRDADDR _IOWR('i', 35, struct ifreq) /* get broadcast addr */ +#define SIOCSIFBRDADDR _IOW('i', 19, struct ifreq) /* set broadcast addr */ +#define OSIOCGIFCONF _IOWR('i', 20, struct ifconf) /* get ifnet list */ +#define SIOCGIFCONF _IOWR('i', 36, struct ifconf) /* get ifnet list */ +#define OSIOCGIFNETMASK _IOWR('i', 21, struct ifreq) /* get net addr mask */ +#define SIOCGIFNETMASK _IOWR('i', 37, struct ifreq) /* get net addr mask */ +#define SIOCSIFNETMASK _IOW('i', 22, struct ifreq) /* set net addr mask */ +#define SIOCGIFMETRIC _IOWR('i', 23, struct ifreq) /* get IF metric */ +#define SIOCSIFMETRIC _IOW('i', 24, struct ifreq) /* set IF metric */ +#define SIOCDIFADDR _IOW('i', 25, struct ifreq) /* delete IF addr */ +#define SIOCAIFADDR _IOW('i', 26, struct ifaliasreq)/* add/chg IF alias */ + +#define SIOCALIFADDR _IOW('i', 27, struct if_laddrreq) /* add IF addr */ +#define SIOCGLIFADDR _IOWR('i', 28, struct if_laddrreq) /* get IF addr */ +#define SIOCDLIFADDR _IOW('i', 29, struct if_laddrreq) /* delete IF addr */ +#define SIOCSIFCAP _IOW('i', 30, struct ifreq) /* set IF features */ +#define SIOCGIFCAP _IOWR('i', 31, struct ifreq) /* get IF features */ + +#define SIOCADDMULTI _IOW('i', 49, struct ifreq) /* add m'cast addr */ +#define SIOCDELMULTI _IOW('i', 50, struct ifreq) /* del m'cast addr */ +#if 0 +#define SIOCGIFMTU _IOWR('i', 51, struct ifreq) /* get IF mtu */ +#define SIOCSIFMTU _IOW('i', 52, struct ifreq) /* set IF mtu */ +#endif /* #if 0 */ +#define SIOCGIFPHYS _IOWR('i', 53, struct ifreq) /* get IF wire */ +#define SIOCSIFPHYS _IOW('i', 54, struct ifreq) /* set IF wire */ +#define SIOCSIFMEDIA _IOWR('i', 55, struct ifreq) /* set net media */ +#define SIOCGIFMEDIA _IOWR('i', 56, struct ifmediareq) /* get net media */ + +#define SIOCSIFPHYADDR _IOW('i', 70, struct ifaliasreq) /* set gif addres */ +#define SIOCGIFPSRCADDR _IOWR('i', 71, struct ifreq) /* get gif psrc addr */ +#define SIOCGIFPDSTADDR _IOWR('i', 72, struct ifreq) /* get gif pdst addr */ +#define SIOCDIFPHYADDR _IOW('i', 73, struct ifreq) /* delete gif addrs */ +#define SIOCSLIFPHYADDR _IOW('i', 74, struct if_laddrreq) /* set gif addrs */ +#define SIOCGLIFPHYADDR _IOWR('i', 75, struct if_laddrreq) /* get gif addrs */ + +#define SIOCSIFGENERIC _IOW('i', 57, struct ifreq) /* generic IF set op */ +#define SIOCGIFGENERIC _IOWR('i', 58, struct ifreq) /* generic IF get op */ + +#define SIOCGIFSTATUS _IOWR('i', 59, struct ifstat) /* get IF status */ +#define SIOCSIFLLADDR _IOW('i', 60, struct ifreq) /* set linklevel addr */ + +#define SIOCGPRIVATE_0 _IOWR('i', 80, struct ifreq) /* Linux Private + 0 */ +#define SIOCGPRIVATE_1 _IOWR('i', 81, struct ifreq) /* Linux Private + 1 */ + +#define SIOCIFCREATE _IOWR('i', 122, struct ifreq) /* create clone if */ +#define SIOCIFDESTROY _IOW('i', 121, struct ifreq) /* destroy clone if */ +#define SIOCIFGCLONERS _IOWR('i', 120, struct if_clonereq) /* get cloners */ + +#define SIOGBULIST _IOWR('i', 123, struct if_bulreq) /* get BUL */ + +#define SIOCSIPMSFILTER _IO('s', 130) /* set src list */ +#define SIOCGIPMSFILTER _IO('s', 131) /* get src list */ +#define SIOCSMSFILTER _IO('s', 132) /* set src list */ +#define SIOCGMSFILTER _IO('s', 133) /* get src list */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_SYS_SOCKIO_H_ */ diff --git a/h/wrn/coreip/sysctlLib.h b/h/wrn/coreip/sysctlLib.h new file mode 100644 index 0000000..53814f1 --- /dev/null +++ b/h/wrn/coreip/sysctlLib.h @@ -0,0 +1,104 @@ +/* sysctlLib.h - Header file for the sysctl library */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01t,20jul05,vvv added sctpSysctlInit() and sctp6SysctlInit() prototypes +01s,20may05,kch Added mip6ProtoSysctlInit() and ip6MrouteSysctlInit() + prototypes. +01r,29apr05,kch Added mldSysctlInit(). +01q,21apr05,kch Removed in6RmxSysctlInit() prototype. +01p,07feb05,wap Allow sysctl init routines to be scaled out +01o,24jan05,vvv osdep.h cleanup +01n,20jan05,sar Removal of divert, dummynet and fw code. +01m,17sep04,niq Fix a typo +01l,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01k,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5-int/1) +01j,20nov03,niq Remove copyright_wrs.h file inclusion +01i,04nov03,rlm Ran batch header path update for header re-org. +01h,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01g,24oct03,cdw update include statements post header re-org. +01f,08sep03,vvv merged from ACCORDION_BASE6_MERGE_BASELINE +01e,17jul02,ppp adding an extern to the defination for sysctlLibInit +01d,03feb02,ham changes for tornado build. +01c,12dec01,ann Adding the changes from testing +01b,03dec01,niq Add prototypes for sysctlInit routines +01a,22oct01,ann written +*/ + +#ifndef __INCsysctllibh +#define __INCsysctllibh + +#ifdef __cplusplus +extern "C" { +#endif + +#define INCLUDE_SYSCTL + +#ifdef INCLUDE_SYSCTL + +#include + +/* Extern */ + +/* Prototypes */ + +STATUS sysctlInit (void); +IMPORT STATUS sysctlLibInit (void); + +IMPORT STATUS mbufSysctlInit (void); +IMPORT STATUS kernSysctlInit (void); +IMPORT STATUS ifSysctlInit (void); +IMPORT STATUS ifEtherSubrSysctlInit (void); +IMPORT STATUS ifMibSysctlInit (void); +IMPORT STATUS ifEtherSysctlInit (void); +IMPORT STATUS rtsockSysctlInit (void); +IMPORT STATUS socketSysctlInit (void); + + +#if 1 /* These will be called from configlettes. So we wouldn't need them */ +IMPORT STATUS archSysctlInit (void); +IMPORT STATUS icmpv4SysctlInit (void); +IMPORT STATUS igmpSysctlInit (void); +IMPORT STATUS inSysctlInit (void); +IMPORT STATUS inPcbSysctlInit (void); +IMPORT STATUS in4ProtoSysctlInit (void); +IMPORT STATUS ipInputSysctlInit (void); +IMPORT STATUS ipRawSysctlInit (void); +IMPORT STATUS inGifSysctlInit (void); +IMPORT STATUS inRmxSysctlInit (void); +IMPORT STATUS ipSysctlInit (void); +IMPORT STATUS ipFlowSysctlInit (void); +IMPORT STATUS in6ProtoSysctlInit (void); +IMPORT STATUS tcpv4SysctlInit (void); +IMPORT STATUS tcpv6SysctlInit (void); +IMPORT STATUS udpv4SysctlInit (void); +IMPORT STATUS udpv6SysctlInit (void); +IMPORT STATUS nd6SysctlInit (void); +IMPORT STATUS icmp6SysctlInit (void); +IMPORT STATUS mldSysctlInit (void); +IMPORT STATUS ip6MrouteSysctlInit (void); +IMPORT STATUS mip6ProtoSysctlInit (void); +IMPORT STATUS ipsecv4SysctlInit (void); +IMPORT STATUS ipsecv6SysctlInit (void); +IMPORT STATUS ipsecKeySysctlInit (void); +IMPORT STATUS usrHwSysctlInit (void); +IMPORT STATUS sctpSysctlInit (void); +IMPORT STATUS sctp6SysctlInit (void); +#endif + +#ifdef _WRS_KERNEL +void sysctl_sysctl_debug_dump_node (struct sysctl_oid_list *, int); +#endif + +#endif /* #ifdef SYSCTL */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCsysctllibh */ + diff --git a/h/wrn/coreip/syslog.h b/h/wrn/coreip/syslog.h new file mode 100644 index 0000000..1e3afea --- /dev/null +++ b/h/wrn/coreip/syslog.h @@ -0,0 +1,299 @@ +/* syslog.h - the system message logger header file */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1982, 1986, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)syslog.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/sys/sys/syslog.h,v 1.19.2.2 2001/05/29 13:15:08 dwmalone Exp $ + */ + +/* +modification history +-------------------- +01i,07feb05,vvv _KERNEL cleanup +01h,03sep04,dlk Reimplement in terms of applUtilLib. +01g,20nov03,niq Remove copyright_wrs.h file inclusion +01f,05nov03,cdw Removal of unnecessary _KERNEL guards. +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,29apr03,syy Added #ifdef for __cplusplus +01c,12oct01,ppp undef'd log temporarily for board bringup +01b,05sep01,ham renamed printf to PRINTF. +01a,05sep01,ham created from FreeBSD4.3-RELEASE(July-17-01). +*/ + +#ifndef _SYS_SYSLOG_H_ +#define _SYS_SYSLOG_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Note, Base 6 presently does not support syslog() or the + * related posix functions openlog(), closelog(), and setlogmask(). + * applUtilLib is the closest present match. + */ + +#define _PATH_LOG "/var/run/log" +#define _PATH_OLDLOG "/dev/log" /* backward compatibility */ + + +#define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */ + /* extract priority */ +#define LOG_PRI(p) ((p) & LOG_PRIMASK) +#define LOG_MAKEPRI(fac, pri) ((fac) | (pri)) + +#if 0 /* not for WRS */ + +#ifdef SYSLOG_NAMES +#define INTERNAL_NOPRI 0x10 /* the "no priority" priority */ + /* mark "facility" */ +#define INTERNAL_MARK LOG_MAKEPRI((LOG_NFACILITIES<<3), 0) + +typedef struct _code { + const char *c_name; + int c_val; +} CODE; + +CODE prioritynames[] = { + { "alert", LOG_ALERT, }, + { "crit", LOG_CRIT, }, + { "debug", LOG_DEBUG, }, + { "emerg", LOG_EMERG, }, + { "err", LOG_ERR, }, + { "error", LOG_ERR, }, /* DEPRECATED */ + { "info", LOG_INFO, }, + { "none", INTERNAL_NOPRI, }, /* INTERNAL */ + { "notice", LOG_NOTICE, }, + { "panic", LOG_EMERG, }, /* DEPRECATED */ + { "warn", LOG_WARNING, }, /* DEPRECATED */ + { "warning", LOG_WARNING, }, + { NULL, -1, } +}; +#endif /* SYSLOG_NAMES */ + +/* facility codes */ +#define LOG_KERN (0<<3) /* kernel messages */ +#define LOG_USER (1<<3) /* random user-level messages */ +#define LOG_MAIL (2<<3) /* mail system */ +#define LOG_DAEMON (3<<3) /* system daemons */ +#define LOG_AUTH (4<<3) /* authorization messages */ +#define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ +#define LOG_LPR (6<<3) /* line printer subsystem */ +#define LOG_NEWS (7<<3) /* network news subsystem */ +#define LOG_UUCP (8<<3) /* UUCP subsystem */ +#define LOG_CRON (9<<3) /* clock daemon */ +#define LOG_AUTHPRIV (10<<3) /* authorization messages (private) */ + /* Facility #10 clashes in DEC UNIX, where */ + /* it's defined as LOG_MEGASAFE for AdvFS */ + /* event logging. */ +#define LOG_FTP (11<<3) /* ftp daemon */ +#define LOG_NTP (12<<3) /* NTP subsystem */ +#define LOG_SECURITY (13<<3) /* security subsystems (firewalling, etc.) */ +#define LOG_CONSOLE (14<<3) /* /dev/console output */ + + /* other codes through 15 reserved for system use */ +#define LOG_LOCAL0 (16<<3) /* reserved for local use */ +#define LOG_LOCAL1 (17<<3) /* reserved for local use */ +#define LOG_LOCAL2 (18<<3) /* reserved for local use */ +#define LOG_LOCAL3 (19<<3) /* reserved for local use */ +#define LOG_LOCAL4 (20<<3) /* reserved for local use */ +#define LOG_LOCAL5 (21<<3) /* reserved for local use */ +#define LOG_LOCAL6 (22<<3) /* reserved for local use */ +#define LOG_LOCAL7 (23<<3) /* reserved for local use */ + +#ifdef SYSLOG_NAMES +CODE facilitynames[] = { + { "auth", LOG_AUTH, }, + { "authpriv", LOG_AUTHPRIV, }, + { "console", LOG_CONSOLE, }, + { "cron", LOG_CRON, }, + { "daemon", LOG_DAEMON, }, + { "ftp", LOG_FTP, }, + { "kern", LOG_KERN, }, + { "lpr", LOG_LPR, }, + { "mail", LOG_MAIL, }, + { "mark", INTERNAL_MARK, }, /* INTERNAL */ + { "news", LOG_NEWS, }, + { "ntp", LOG_NTP, }, + { "security", LOG_SECURITY, }, + { "syslog", LOG_SYSLOG, }, + { "user", LOG_USER, }, + { "uucp", LOG_UUCP, }, + { "local0", LOG_LOCAL0, }, + { "local1", LOG_LOCAL1, }, + { "local2", LOG_LOCAL2, }, + { "local3", LOG_LOCAL3, }, + { "local4", LOG_LOCAL4, }, + { "local5", LOG_LOCAL5, }, + { "local6", LOG_LOCAL6, }, + { "local7", LOG_LOCAL7, }, + { NULL, -1, } +}; +#endif + +#else /* WRS */ + +/* For now, we map all the unimplemented Posix facilities to GENERAL_LOG */ + +/* facility codes */ +#define LOG_KERN KERN_LOG /* kernel messages */ +#define LOG_USER GENERAL_LOG /* random user-level messages */ +#define LOG_MAIL GENERAL_LOG /* mail system */ +#define LOG_DAEMON GENERAL_LOG /* system daemons */ +#define LOG_AUTH GENERAL_LOG /* authorization messages */ +#define LOG_SYSLOG GENERAL_LOG /* generated internally by syslogd */ +#define LOG_LPR GENERAL_LOG /* line printer subsystem */ +#define LOG_NEWS GENERAL_LOG /* network news subsystem */ +#define LOG_UUCP GENERAL_LOG /* UUCP subsystem */ +#define LOG_CRON GENERAL_LOG /* clock daemon */ +#define LOG_AUTHPRIV GENERAL_LOG /* authorization messages (private) */ + /* Facility #10 clashes in DEC UNIX, where */ + /* it's defined as LOG_MEGASAFE for AdvFS */ + /* event logging. */ +#define LOG_FTP FTPD_LOG /* ftp daemon */ +#define LOG_NTP GENERAL_LOG /* NTP subsystem */ +#define LOG_SECURITY GENERAL_LOG /* security subsystems (firewalling, + etc.) */ +#define LOG_CONSOLE GENERAL_LOG /* /dev/console output */ + + /* other codes through 15 reserved for system use */ +#define LOG_LOCAL0 GENERAL_LOG /* reserved for local use */ +#define LOG_LOCAL1 GENERAL_LOG /* reserved for local use */ +#define LOG_LOCAL2 GENERAL_LOG /* reserved for local use */ +#define LOG_LOCAL3 GENERAL_LOG /* reserved for local use */ +#define LOG_LOCAL4 GENERAL_LOG /* reserved for local use */ +#define LOG_LOCAL5 GENERAL_LOG /* reserved for local use */ +#define LOG_LOCAL6 GENERAL_LOG /* reserved for local use */ +#define LOG_LOCAL7 GENERAL_LOG /* reserved for local use */ + +#endif /* WRS */ + +/* current number of facilities */ +#define LOG_NFACILITIES LOG_NUMCATS +#define LOG_FACMASK CAT_MASK /* mask to extract facility part */ + /* facility of pri */ +#define LOG_FAC(p) (((p) & LOG_FACMASK) >> CAT_SHIFT) + +/* + * arguments to setlogmask. + */ +#define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */ +/* LOG_UPTO() defined in applUtilLib.h */ + + +/* + * Option flags for openlog. + * + * LOG_ODELAY no longer does anything. + * LOG_NDELAY is the inverse of what it used to be. + */ +#define LOG_PID 0x01 /* log the pid with each message */ +#define LOG_CONS 0x02 /* log on the console if errors in sending */ +#define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */ +#define LOG_NDELAY 0x08 /* don't delay open */ +#define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */ +#define LOG_PERROR 0x20 /* log to stderr as well */ + +#ifdef C99_VARIADIC_MACROS + +#if (LOG_ENABLE_MASK & LOG_KERNEL_BIT) +#if LOG_ARGS +#define LOG(pri, ...) \ + do { \ + _applLog (((pri) | LOG_KERN), _LOG_LOCATION, \ + __VA_ARGS__); \ + } while (FALSE) + +#define log(pri, ...) \ + do { \ + _applLog (((pri) | LOG_KERN), _LOG_LOCATION, \ + __VA_ARGS__); \ + } while (FALSE) +#else +#define LOG(pri, ...) \ + do { \ + _applLog (((pri) | LOG_KERN), _LOG_LOCATION, \ + ""); \ + } while (FALSE) + +#define log(pri, ...) \ + do { \ + _applLog (((pri) | LOG_KERN), _LOG_LOCATION, \ + ""); \ + } while (FALSE) +#endif /* LOG_ARGS */ +#else +#define LOG(pri, ...) do {} while (FALSE) +#define log(pri, ...) do {} while (FALSE) +#endif + +#else /* !defined (C99_VARIADIC_MACROS) -> assume old GNU variadic syntax */ + +#if (LOG_ENABLE_MASK & LOG_KERNEL_BIT) +#if LOG_ARGS +#define LOG(pri, fmt...) \ + do { \ + _applLog (((pri) | LOG_KERN), _LOG_LOCATION, fmt); \ + } while (FALSE) + +#define log(pri, fmt...) \ + do { \ + _applLog (((pri) | LOG_KERN), _LOG_LOCATION, fmt); \ + } while (FALSE) +#else +#define LOG(pri, fmt...) \ + do { \ + _applLog (((pri) | LOG_KERN), _LOG_LOCATION, ""); \ + } while (FALSE) + +#define log(pri, fmt...) \ + do { \ + _applLog (((pri) | LOG_KERN), _LOG_LOCATION, ""); \ + } while (FALSE) +#endif /* LOG_ARGS */ +#else +#define LOG(pri, fmt...) do {} while (FALSE) +#define log(pri, fmt...) do {} while (FALSE) +#endif + +#endif /* ! C99_VARIADIC_MACROS */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_SYSLOG_H_ */ diff --git a/h/wrn/coreip/telnetLib.h b/h/wrn/coreip/telnetLib.h new file mode 100644 index 0000000..a702747 --- /dev/null +++ b/h/wrn/coreip/telnetLib.h @@ -0,0 +1,246 @@ +/* telnetLib.h - telnet library header */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +------------------- +02m,05apr05,vvv added per-session semaphore, removed parserControl + (SPR #106456) +02l,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +02k,15mar04,rp merged from orion +02j,17feb04,zhr Added function prototypes for telnet client +02i,05nov03,cdw Removal of unnecessary _KERNEL guards. +02h,04nov03,rlm Ran batch header path update for header re-org. +02g,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +02f,10jun03,vvv include netVersion.h +02e,15may02,elr Added more option definitions +02d,30apr02,elr Changed session data structure to include all allocated + resources for reliable cleanup during logout +02c,14feb01,spm merged from version 02c of tor2_0_x branch (base 02b): + general overhaul of telnet server (SPR #28675) +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01e,26may92,rrr the tree shuffle +01d,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01c,05oct90,shl added ANSI function prototypes. + made #endif ANSI style. + added copyright notice. +01b,08aug90,shl added INCtelnetLibh to #endif. +01a,10oct86,dnw written +*/ + +#ifdef VIRTUAL_STACK +#include +#endif /*VIRTUAL_STACK*/ + +#ifndef __INCtelnetLibh +#define __INCtelnetLibh + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +#if CPU_FAMILY==I960 +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +#define PTY_DEVICE_NAME_MAX_LEN 128 /* The maximum string length of a pty device */ +#define TELNET_BUF_SIZE 512 /* size of scratch buffer */ + + +typedef struct + { + NODE node; /* for link-listing */ + char ptyRemoteName[PTY_DEVICE_NAME_MAX_LEN]; /* name of the pty for this session */ + int socket; /* socket connection */ + int inputFd; /* input to command interpreter */ + int outputFd; /* output to command interpreter */ + int slaveFd; /* command interpreter side fd of pty */ + int outputTask; /* Task ID to send data to socket */ + int inputTask; /* Task ID to send data to socket */ + SEM_ID startInput; /* begin reading from socket connection */ + SEM_ID startOutput; /* begin writing to socket connection */ + BOOL busyFlag; /* input/output tasks in use? */ + BOOL loggedIn; /* Has a shell been started on this slot? */ + UINT32 userData; /* A storage for application developers */ + int shellTaskId; /* Task ID of the shell associated with this session */ + SEM_ID sessionMutex; /* guard session data */ + } TELNETD_SESSION_DATA; + +typedef struct + { + int state; +#define SCTD_EMPTY 1 +#define SCTD_USED 2 + int hostFd; /* remote host's socket */ + BOOL echoIsDone; /* TRUE when echo transaction complete */ + BOOL sgaIsDone; /* TRUE when SGA transaction complete */ + int hostStreamState; /* state of host input stream */ + char cmd; + int saveOpts; + char pBuf[TELNET_BUF_SIZE]; + } TELNETC_SESSION_DATA; + +typedef struct + { + TELNETD_SESSION_DATA *pSession; /* link to session data for tasks */ + } TELNETD_TASK_DATA; + +#if CPU_FAMILY==I960 +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* command interpreter control operations */ + +#define REMOTE_START 0 +#define REMOTE_STOP 1 +#define REMOTE_INIT 2 + +/* Definitions for the TELNET protocol. */ + +#define IAC 255 /* interpret as command: */ +#define DONT 254 /* you are not to use option */ +#define DO 253 /* please, you use option */ +#define WONT 252 /* I won't use option */ +#define WILL 251 /* I will use option */ +#define SB 250 /* interpret as subnegotiation */ +#define GA 249 /* you may reverse the line */ +#define EL 248 /* erase the current line */ +#define EC 247 /* erase the current character */ +#define AYT 246 /* are you there */ +#define AO 245 /* abort output--but let prog finish */ +#define IP 244 /* interrupt process--permanently */ +#define BREAK 243 /* break */ +#define DM 242 /* data mark--for connect. cleaning */ +#define NOP 241 /* nop */ +#define SE 240 /* end sub negotiation */ +#define EOR 239 /* end of record (transparent mode) */ + +#define SYNCH 242 /* for telfunc calls */ + + +/* telnet options - as defined by IANA */ + +#define TELOPT_BINARY 0 /* 8-bit data path */ +#define TELOPT_ECHO 1 /* echo RFC857 */ +#define TELOPT_RCP 2 /* prepare to reconnect */ +#define TELOPT_SGA 3 /* suppress go ahead */ +#define TELOPT_NAMS 4 /* approximate message size */ +#define TELOPT_STATUS 5 /* give status */ +#define TELOPT_TM 6 /* timing mark */ +#define TELOPT_RCTE 7 /* remote controlled transmission and echo */ +#define TELOPT_NAOL 8 /* negotiate about output line width */ +#define TELOPT_NAOP 9 /* negotiate about output page size */ +#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ +#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ +#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ +#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ +#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ +#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ +#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ +#define TELOPT_XASCII 17 /* extended ascic character set */ +#define TELOPT_LOGOUT 18 /* force logout */ +#define TELOPT_BM 19 /* byte macro */ +#define TELOPT_DET 20 /* data entry terminal */ +#define TELOPT_SUPDUP 21 /* supdup protocol */ +#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ +#define TELOPT_SNDLOC 23 /* send location */ +#define TELOPT_TTYPE 24 /* terminal type */ +#define TELOPT_EOR 25 /* end or record */ +#define TELOPT_TACACS 26 /* TACACS User Identification */ +#define TELOPT_OUTPUT_MARK 27 /* Output marking */ +#define TELOPT_TLN 28 /* Terminal location number RFC933 */ +#define TELOPT_3270 29 /* Telnet 3270 regime RFC1041 */ +#define TELOPT_X_3_PAD 30 +#define TELOPT_NAWS 31 /* Negotiate about window size */ +#define TELOPT_TERM_SPD 32 /* Terminal speed */ +#define TELOPT_RFC 33 /* Remote flow control RFC1372 */ +#define TELOPT_LINEMODE 34 /* Linemode RFC1184 */ +#define TELOPT_XDL 35 /* X display location */ +#define TELOPT_ENVIRON 36 /* Environment RFC1408 */ +#define TELOPT_AUTHENTION 37 /* authentication */ +#define TELOPT_ENCRYPTION 38 /* encryption */ +#define TELOPT_NEW_ENV 39 /* New environment RFC 1572 */ +#define TELOPT_TN3270E 40 /* RFC1647 */ +#define TELOPT_XAUTH 41 +#define TELOPT_CHARSET 42 /* RFC2066 */ +#define TELOPT_RSP 43 /* Remote serial port */ +#define TELOPT_CPC 44 /* Com port control RFC 2217 */ +#define TELOPT_SLE 45 /* Suppress local echo */ +#define TELOPT_STLS 46 /* Start TLS */ +#define TELOPT_KERMIT 47 /* RFC2840 */ +#define TELOPT_SEND_URL 48 +#define TELOPT_FORWARDX 49 + +#define TELOPT_PRAGMA_LOGON 138 +#define TELOPT_SSPI_LOGON 139 +#define TELOPT_PRAGMA_HEART 140 + +#define TELOPT_EXOPL 255 /* extended-options-list */ + +/* sub-option qualifiers */ + +#define TELQUAL_IS 0 /* option is... */ +#define TELQUAL_SEND 1 /* send option */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) +#ifdef VIRTUAL_STACK +extern STATUS telnetdInstInit (void *noparams); +extern STATUS telnetdDestructor (VSNUM vsnum); +extern void telnetInTask (TELNETD_SESSION_DATA *pSlot,int stackNum); +extern void telnetOutTask (TELNETD_SESSION_DATA *pSlot,int stackNum); +extern void telnetd (int stackNum); +#else +extern void telnetInTask (TELNETD_SESSION_DATA *pSlot); +extern void telnetOutTask (TELNETD_SESSION_DATA *pSlot); +extern void telnetd (void); +#endif /*VIRTUAL_STACK*/ +extern STATUS telnetdInit (int numClients, BOOL staticFlag); +extern STATUS telnetdStart (int port); +extern STATUS telnetdParserSet (FUNCPTR pParserCtrlRtn); +extern void telnetdExit (UINT32 sessionId); +extern BOOL telnetdStaticTaskInitializationGet(); +extern STATUS telnetcInit (); +extern STATUS telnet (char *pHostName, int port); + +#else /* __STDC__ */ +#ifdef VIRTUAL_STACK +extern STATUS telnetdInstInit (); +extern STATUS telnetdDestructor (); +#endif /*VIRTUAL_STACK*/ +extern void telnetInTask (); +extern STATUS telnetdInit (); +extern STATUS telnetdStart (); +extern void telnetOutTask (); +extern STATUS telnetdParserSet (); +extern void telnetd (); +extern void telnetdExit (); +extern BOOL telnetdStaticTaskInitializationGet(); +extern STATUS telnetcInit (); +extern STATUS telnet (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtelnetLibh */ diff --git a/h/wrn/coreip/tftpLib.h b/h/wrn/coreip/tftpLib.h new file mode 100644 index 0000000..b38c49b --- /dev/null +++ b/h/wrn/coreip/tftpLib.h @@ -0,0 +1,250 @@ +/* tftpLib.h - vxWorks Trival File Transfer protocol header file */ + +/* Copyright 1991 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01r,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01q,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/2) +01p,20nov03,niq Remove copyright_wrs.h file inclusion +01o,04nov03,rlm Ran batch header path update for header re-org. +01n,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01m,24oct03,cdw update include statements post header re-org. +01l,01may03,spm Tornado 2.2 CP1 merge (from ver 01k,13jan03,rae: + TOR2_2-CP1-F label, tor2_2-patch branch, /wind/river VOB) +01k,21apr03,ppp vwModNum.h should be picked up from target/h +01j,24oct01,hgo extension for IPv6 +01i,29nov00,ham dealt with ARM alignment issue (SPR 62202). +01h,09oct97,nbs modified TFTP_DESC to include the file name + in the request, spr # 9413 +01g,22sep92,rrr added support for c++ +01f,18sep92,jcf added include of netinet/in.h. +01e,04jul92,jcf cleaned up. +01d,15jun92,elh changed retransmission time. +01c,26may92,rrr the tree shuffle +01b,29feb92,elh ansified. + incorperated changes done by jmm for server. +01a,19Jul91,elh written. +*/ + +#ifndef __INCtftpLibh +#define __INCtftpLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#ifdef INET6 +#include +#endif + +/* defines */ + +/* TFTP constant values. */ + +#define TFTP_SEGSIZE 512 /* data segment size */ +#define TFTP_REQSIZE TFTP_SEGSIZE + 2 +#define TFTP_FILENAME_SIZE 128 /* max length of */ + /* filename */ +#define TFTP_ACK_SIZE 4 /* size of ack message */ +#define TFTP_DATA_HDR_SIZE 4 /* header size */ +#define TFTP_TIMEOUT 2 /* secs between rexmt's */ +#define TFTP_PORT 69 /* tftp default port */ + +#define TFTP_CLIENT 0 +#define TFTP_SERVER 1 + +/* TFTP Op Codes/packet types */ + +#define TFTP_RRQ 01 /* read request */ +#define TFTP_WRQ 02 /* write request */ +#define TFTP_DATA 03 /* data packet */ +#define TFTP_ACK 04 /* acknowledgement */ +#define TFTP_ERROR 05 /* error packet */ + +/* + TFTP message formats are: + + +Type Op # Format without header + + 2 bytes string 1 byte string 1 byte + ------------------------------------------ +TFTP_RRQ/ | [01|02]| filename | 0 | mode | 0 | +TFTP_WRQ ------------------------------------------ + + 2 bytes 2 bytes n bytes + --------------------------- +TFTP_DATA | 03 | block # | data | + --------------------------- + + 2 bytes 2 bytes + ------------------ +TFTP_ACK | 04 | block #| + ------------------ + + 2 bytes 2 bytes string 1 byte + ------------------------------------- +TFTP_ERROR | 05 | ErrorCode | ErrMsg | 0 | + ------------------------------------- +*/ + + +#ifdef _WRS_VXWORKS_5_X +#if (defined __arm__) +#define TFTP_PACKED _WRS_PACK_ALIGN(1) +#else +#define TFTP_PACKED +#endif /* __arm__ */ +#else +#if ((defined __arm__) && (defined __GNUC__)) +#define TFTP_PACKED __attribute__((packed)) +#else +#define TFTP_PACKED +#endif /* __arm__ */ +#endif /* _WRS_VXWORKS_5_X */ + +/* TFTP packet structure. */ + +struct tftpFormat + { + u_short blockOrError; + char data [TFTP_SEGSIZE]; + } TFTP_PACKED; + +typedef struct tftp_msg + { + u_short th_opcode; /* packet op code */ + union + { + char request [TFTP_REQSIZE]; /* request string */ + struct tftpFormat TFTP_PACKED misc; + } TFTP_PACKED th; + } TFTP_MSG; + + + +/* useful defines to access the TFTP packet */ + +#define th_request th.request /* request string */ +#define th_block th.misc.blockOrError /* block number */ +#define th_error th.misc.blockOrError /* error code */ +#define th_errMsg th.misc.data /* error message */ +#define th_data th.misc.data /* data */ + + +/* TFTP defined error codes. */ + +#define EUNDEF 0 /* not defined */ +#define ENOTFOUND 1 /* file not found */ +#define EACCESS 2 /* access violation */ +#define ENOSPACE 3 /* disk full */ +#define EBADOP 4 /* illegal operation */ +#define EBADID 5 /* unknown transfer ID */ +#define EEXISTS 6 /* file already exists */ +#define ENOUSER 7 /* no such user */ + +/* mode structure */ + +typedef struct tftp_mode + { + char *m_name; /* mode name */ + char *m_mode; /* mode type */ + } TFTP_MODE; + +/* error structure */ + +typedef struct tftp_errmsg + { + int e_code; /* error code */ + char *e_msg; /* error message */ + } TFTP_ERRMSG; + +/* TFTP descriptor */ + +typedef struct tftp_desc + { + char mode [32]; /* mode */ + BOOL connected; /* state */ + char serverName [128]; /* server ascii name */ +#ifndef INET6 + struct sockaddr_in serverAddr; /* server address */ +#else + struct sockaddr_in6 serverAddr; +#endif + int sock; /* socket */ + int sockFamily; /* AF_INET(6) */ + u_short serverPort; /* server port number */ + char fileName [TFTP_FILENAME_SIZE]; /* requested file name */ + } TFTP_DESC; + +/* TFTP task defaults */ + +#define TFTP_TASK_PRIORITY 70 /* TFTP task priority */ +#define TFTP_TASK_OPTIONS 0 /* TFTP task options */ +#define TFTP_TASK_STACKSIZE 8*BUFSIZ /* TFTP stack size */ + +/* tftpLib error values */ + +#define S_tftpLib_INVALID_ARGUMENT (M_tftpLib | 1) +#define S_tftpLib_INVALID_DESCRIPTOR (M_tftpLib | 2) +#define S_tftpLib_INVALID_COMMAND (M_tftpLib | 3) +#define S_tftpLib_INVALID_MODE (M_tftpLib | 4) +#define S_tftpLib_UNKNOWN_HOST (M_tftpLib | 5) +#define S_tftpLib_NOT_CONNECTED (M_tftpLib | 6) +#define S_tftpLib_TIMED_OUT (M_tftpLib | 7) +#define S_tftpLib_TFTP_ERROR (M_tftpLib | 8) + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS tftpXfer (char * pHost, int port, char * pFilename, + char * pCommand, char * pMode, int * pDataDesc, + int * pErrorDesc); +extern STATUS tftpCopy (char * pHost, int port, char * pFilename, + char * pCommand, char * pMode, int fd); +extern TFTP_DESC *tftpInit (void); +extern STATUS tftpModeSet (TFTP_DESC * pTftpDesc, char * pMode); +extern STATUS tftpPeerSet (TFTP_DESC * pTftpDesc, char * pHostname, + int port); +extern STATUS tftpPut (TFTP_DESC *pTftpDesc, char *pFilename, int fd, + int clientOrServer); +extern STATUS tftpGet (TFTP_DESC *pTftpDesc, char *pFilename, int fd, + int clientOrServer); +#ifdef _WRS_KERNEL +extern STATUS tftpInfoShow (TFTP_DESC * pTftpDesc); +#endif +extern STATUS tftpQuit (TFTP_DESC * pTftpDesc); +extern int tftpSend (TFTP_DESC *pTftpDesc, TFTP_MSG *pTftpMsg, int sizeMsg, + TFTP_MSG *pTftpReply, int opReply, int blockReply, + int *pPort); +extern int tftpErrorCreate (TFTP_MSG * pTftpMsg, int errorNum); + +#else /* __STDC__ */ + +extern STATUS tftpXfer (); +extern STATUS tftpCopy (); +extern TFTP_DESC *tftpInit (); +extern STATUS tftpModeSet (); +extern STATUS tftpPeerSet (); +extern STATUS tftpPut (); +extern STATUS tftpGet (); +#ifdef _WRS_KERNEL +extern STATUS tftpInfoShow (); +#endif +extern STATUS tftpQuit (); +extern int tftpSend (); +extern int tftpErrorCreate (); + +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtftpLibh */ diff --git a/h/wrn/coreip/tftpdLib.h b/h/wrn/coreip/tftpdLib.h new file mode 100644 index 0000000..62237a4 --- /dev/null +++ b/h/wrn/coreip/tftpdLib.h @@ -0,0 +1,87 @@ +/* tftpdLib.h - vxWorks Trival File Transfer protocol header file */ + +/* Copyright 1992 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02j,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +02i,15mar04,rp merged from orion +02h,20nov03,niq Remove copyright_wrs.h file inclusion +02g,04nov03,rlm Ran batch header path update for header re-org. +02f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +02e,24oct03,cdw update include statements post header re-org. +02d,21apr03,ppp vwModNum.h should be picked up from target/h +02c,11feb02,hgo modifications for IPv6 +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01b,26may92,rrr the tree shuffle + -changed includes to have absolute path from h/ +01a,06Feb92,jmm written. +*/ + +#ifndef __INCtftpdLibh +#define __INCtftpdLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef VIRTUAL_STACK +#include +#endif /*VIRTUAL_STACK*/ + +#include +#include +#include +#include +#include +#include + +typedef struct tftpd_dir + { + NODE node; + char dirName [MAX_FILENAME_LENGTH]; + } TFTPD_DIR; + + + +typedef struct tftpd_config_params { + CFG_DATA_HDR cfgh; + + int cfg_tftpdTaskStackSize; /* stack size for the tftpdTask */ + BOOL cfg_tftpdNoControl; /* TRUE if no access control required */ + int cfg_tftpdMaxConnections; /* max concurrent connections */ + char * cfg_tftpdDirectoryNames; /* TFTP server directories */ + } TFTPD_CONFIG_PARAMS; + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS tftpdInstInit (void *noparams); +#ifdef VIRTUAL_STACK +extern STATUS tftpdDestructor (VSNUM vsnum); +#endif /*VIRTUAL_STACK*/ +extern STATUS tftpdInit (int stackSize, int nDirectories, + char ** directoryNames, BOOL noControl, + int maxConnections); +extern STATUS tftpdDirectoryAdd (char *fileName); +extern STATUS tftpdDirectoryRemove (char *fileName); + +#else /* __STDC__ */ + +extern STATUS tftpdInstInit (); +#ifdef VIRTUAL_STACK +extern STATUS tftpdDestructor (); +#endif /*VIRTUAL_STACK*/ +extern STATUS tftpdInit (); +extern STATUS tftpdDirectoryAdd (); +extern STATUS tftpdDirectoryRemove (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCtftpdLibh */ diff --git a/h/wrn/coreip/vs/vsBsdSock.h b/h/wrn/coreip/vs/vsBsdSock.h new file mode 100644 index 0000000..792d41e --- /dev/null +++ b/h/wrn/coreip/vs/vsBsdSock.h @@ -0,0 +1,56 @@ +/* vsBsdSock.h - virtual stack data for Unix BSD 4.4 compatible sockets */ + +/* + * Copyright (c) 2002-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01g,21jul05,dlk Remove origStackNum (now stored on task execution stack). +01f,05mar05,dlk Added _priv_soLingerForever. +01e,21jul04,spm enabled socket operations from different virtual stacks +01d,05nov03,cdw Removal of unnecessary _KERNEL guards. +01c,04nov03,rlm Ran batch header path update for header re-org. +01b,03feb03,hgo removed maxsockets +01a,29aug02,hgo creation +*/ + +#ifndef __INCvsBsdSockh +#define __INCvsBsdSockh + +/* includes */ +#include + +/* typedefs */ + + /* Encapsulated (former) globals for SOCKET. */ + +typedef struct vsBsdSock + { + /* defined in uipc_sock.c */ + so_gen_t _so_gencnt; /* generation count for sockets */ + int _priv_somaxconn; + BOOL _priv_soLingerForever; + + /* defined in uipc_sock2.c */ + u_long _sb_max; + u_long _priv_sb_efficiency; /* parameter for sbreserve() */ + int _priv_rnd; + struct timeval _priv_old_runtime; + unsigned int _priv_cur_cnt; + unsigned int _priv_old_cnt; + } VS_BSDSOCK; + +/* macros for "non-private" global variables */ + +#define VS_BSDSOCK_DATA ((VS_BSDSOCK *)vsTbl[myStackNum]->pBsdSockGlobals) + +#define so_gencnt VS_BSDSOCK_DATA->_so_gencnt +#define sb_max VS_BSDSOCK_DATA->_sb_max + +#endif /* __INCvsBsdSockh */ diff --git a/h/wrn/coreip/vs/vsDhcpCommon.h b/h/wrn/coreip/vs/vsDhcpCommon.h new file mode 100644 index 0000000..291e774 --- /dev/null +++ b/h/wrn/coreip/vs/vsDhcpCommon.h @@ -0,0 +1,62 @@ +/* vsDhcpCommon.h - virtual stack data for DHCP Server and Relay Agent routines */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,05nov03,cdw Removal of unnecessary _KERNEL guards. +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,24mar03,ant added new variable, dhcp_started, into the VS_DHCPCOMMON +01c,13nov02,ant added dhcp_exit_sock field in the vs_dhcpcommon_global_data +01b,28aug02,kal must include dhcp.h before common.h for MAXOPT +01a,22jul02,ant created from vsDhcps.h +*/ + +#ifndef __INCvsdhcpcommonh +#define __INCvsdhcpcommonh + +#include +#include +#include + +typedef struct vs_dhcpcommon_global_data + { + /* Globals in dhcpRelay.c */ + + DHCP_TARGET_DESC *pDhcpRelayTargetTbl; + struct server *pDhcpTargetList; + int dhcpNumTargets; + struct msg dhcpMsgIn; + struct msg dhcprMsgOut; + u_short dhcps_port; /* Server port, in network byte order. */ + u_short dhcpc_port; /* Client port, in network byte order. */ + int dhcp_exit_sock; + + BOOL dhcp_started; + /* + * If TRUE Server or RAgent already started in a VS instance. Don't allow + * to start both in the same stack instance. + */ + + } VS_DHCPCOMMON; + + +/* Macro */ + +#define VS_DHCPCOMMON_DATA ((VS_DHCPCOMMON *)vsTbl[myStackNum]->pDhcpCommonGlobals) + +/* Defines for the dhcp routine globals */ + + /* Globals in dhcpRelay.c */ +#define pDhcpRelayTargetTbl VS_DHCPCOMMON_DATA->pDhcpRelayTargetTbl +#define pDhcpTargetList VS_DHCPCOMMON_DATA->pDhcpTargetList +#define dhcpNumTargets VS_DHCPCOMMON_DATA->dhcpNumTargets +#define dhcpMsgIn VS_DHCPCOMMON_DATA->dhcpMsgIn +#define dhcprMsgOut VS_DHCPCOMMON_DATA->dhcprMsgOut +#define dhcps_port VS_DHCPCOMMON_DATA->dhcps_port +#define dhcpc_port VS_DHCPCOMMON_DATA->dhcpc_port +#define dhcp_exit_sock VS_DHCPCOMMON_DATA->dhcp_exit_sock +#define dhcp_started VS_DHCPCOMMON_DATA->dhcp_started + +#endif /* __INCvsdhcpcommonh */ diff --git a/h/wrn/coreip/vs/vsDhcpr.h b/h/wrn/coreip/vs/vsDhcpr.h new file mode 100644 index 0000000..1705cc1 --- /dev/null +++ b/h/wrn/coreip/vs/vsDhcpr.h @@ -0,0 +1,57 @@ +/* vsDhcpr.h - virtual stack data for DHCP Relay Agent routines */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,05nov03,cdw Removal of unnecessary _KERNEL guards. +01d,04nov03,rlm Ran batch header path update for header re-org. +01c,24mar03,ant three priv_dhcprTaskXxx variables removed from VS_DHCPR +01b,13nov02,ant priv_dhcpfilter removed from vs_dhcpr_global_data +01a,18jul02,ant created from vsDhcps.h +*/ + +#ifndef __INCvsdhcprh +#define __INCvsdhcprh + +#include +#include + +typedef struct vs_dhcpr_global_data + { + /* Globals in dhcprLib.c */ + int dhcpSPort; /* Port used by DHCP servers */ + int dhcpCPort; /* Port used by DHCP clients */ + int dhcpMaxHops; /* Hop limit before message is discarded. */ + int dhcprBufSize; /* Size of buffer for BPF devices */ + char * pDhcprSendBuf; /* Buffer for transmitting messages */ + BOOL priv_dhcprInitialized; + struct if_info *dhcprIntfaceList; + struct bpf_program priv_dhcpread; + + /* Globals in dhcpr.c */ + struct msg dhcprMsgIn; + + } VS_DHCPR; + + +/* Macro */ + +#define VS_DHCPR_DATA ((VS_DHCPR *)vsTbl[myStackNum]->pDhcprGlobals) + +/* Defines for the dhcp routine globals */ + +/* Globals in dhcprLib.c */ +#define dhcpSPort VS_DHCPR_DATA->dhcpSPort +#define dhcpCPort VS_DHCPR_DATA->dhcpCPort +#define dhcpMaxHops VS_DHCPR_DATA->dhcpMaxHops +#define dhcprBufSize VS_DHCPR_DATA->dhcprBufSize +#define pDhcprSendBuf VS_DHCPR_DATA->pDhcprSendBuf +#define dhcprIntfaceList VS_DHCPR_DATA->dhcprIntfaceList + +/* Globals in dhcpr.c */ +#define dhcprMsgIn VS_DHCPR_DATA->dhcprMsgIn + +#endif /* __INCvsdhcprh */ + diff --git a/h/wrn/coreip/vs/vsDns.h b/h/wrn/coreip/vs/vsDns.h new file mode 100644 index 0000000..64e9309 --- /dev/null +++ b/h/wrn/coreip/vs/vsDns.h @@ -0,0 +1,55 @@ +/* vsDns.h - virtual stack data for DNS */ + +/* Copyright 2002 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,24aug04,vvv virtualize dnsMutexSem +01e,17mar04,spm removed obsolete variable for (deleted) ORG_RESOLVER code +01d,05nov03,cdw Removal of unnecessary _KERNEL guards. +01c,04nov03,rlm Ran batch header path update for header re-org. +01b,28aug02,kal fixed location of !_KERNEL headers +01a,03jul02,vlk created +*/ +#ifndef __INCvsDnsh +#define __INCvsDnsh + + +/* includes */ +#include /* for MAXDNAME definition */ +#include /* for __res_state structure */ +#include /* for RESOLV_PARAMS_S structure */ + +typedef struct vsDns { + + /* defined in res_debug.c */ + + char priv_ntos_unname[20]; + char priv_ntop_unname[20]; + + /* defined in resolvLib.c */ + + BOOL debugFlag; + + struct __res_state _res; + FUNCPTR pdnsDebugFunc; + RESOLV_PARAMS_S priv_resolvParams; + + SEM_ID dnsMutexSem; + + } VS_DNS; + + +/* macros for "non-private" global variables */ + +#define VS_DNS_DATA ((VS_DNS *)vsTbl[myStackNum]->pDnsGlobals) + +#define debugFlag VS_DNS_DATA->debugFlag +#define _res VS_DNS_DATA->_res +#define pdnsDebugFunc VS_DNS_DATA->pdnsDebugFunc +#define dnsMutexSem VS_DNS_DATA->dnsMutexSem + + + +#endif /* __INCvsDnsh */ diff --git a/h/wrn/coreip/vs/vsFastPath.h b/h/wrn/coreip/vs/vsFastPath.h new file mode 100644 index 0000000..3b5de36 --- /dev/null +++ b/h/wrn/coreip/vs/vsFastPath.h @@ -0,0 +1,48 @@ +/* vsFastPath.h - virtual stack data for Fastpath */ + +/* Copyright 1984 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01f,09jun04,spm fixed fastpath function pointers for virtual stacks +01e,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/1) +01d,20nov03,niq Remove copyright_wrs.h file inclusion +01c,05nov03,cdw Removal of unnecessary _KERNEL guards. +01b,04nov03,rlm Ran batch header path update for header re-org. +01a,07oct02,deg written +*/ + +/* +DESCRIPTION +This file contains virtual stack data definitions for Fastpath. + +*/ + +#ifndef __INCvsFastPathh +#define __INCvsFastPathh + +/* includes */ + +#include + +/* defines */ + +#define VS_FAST_PATH_DATA ((VS_FAST_PATH *)vsTbl[myStackNum]->pFastFrwdGlobals) + +#define ffIPv4Handle VS_FAST_PATH_DATA->_ffIPv4Handle +#define ffIPv6Handle VS_FAST_PATH_DATA->_ffIPv6Handle +#define ffLibLogLevel VS_FAST_PATH_DATA->_ffLibLogLevel + +/* typedefs */ + +typedef struct vsFastPath +{ + struct ffObj *_ffIPv4Handle; /* Handle of the IPv4 FF instance */ + struct ffObj *_ffIPv6Handle; /* Handle of the IPv6 FF instance */ + int _ffLibLogLevel; /* FF library log level */ +} VS_FAST_PATH; + +#endif /* __INCvsFastPathh */ diff --git a/h/wrn/coreip/vs/vsFastUdp6.h b/h/wrn/coreip/vs/vsFastUdp6.h new file mode 100644 index 0000000..fc923ab --- /dev/null +++ b/h/wrn/coreip/vs/vsFastUdp6.h @@ -0,0 +1,46 @@ +/* vsFastUdp6.h - virtual stack data for Fast UDP */ + +/* Copyright 2002 - 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,05nov03,cdw Removal of unnecessary _KERNEL guards. +01c,04nov03,rlm Ran batch header path update for header re-org. +01b,15sep03,vvv updated path for new headers +01a,10dec02,hgo copied from vsFastUdp.h +*/ + +#ifndef __INCvsfastudp6h +#define __INCvsfastudp6h + + +/* includes */ + +#include + +/* defines */ + +/* typedefs */ + +typedef struct vs_fastudp6 + { + /* locals from fastUdpLib.c */ + + FASTUDP6_ID _priv_fastUdp6Head; + u_int _priv_fastUdp6Debug; + SEM_ID _priv_mutexSem; + LIST _priv_portList; + SEM_ID _priv_portListSem; + BOOL _priv_vsWaitingForFastUdp6; + SEM_ID _priv_vsFastUdp6ListSync; + } VS_FASTUDP6; + + +/* macros */ + +#define VS_FASTUDP6_DATA ((VS_FASTUDP6 *) vsTbl[myStackNum]->pFastUdp6Globals) + +#define fastUdp6Initialized vsTbl[myStackNum]->fastUdp6Initialized + +#endif /* __INCvsfastudp6h */ diff --git a/h/wrn/coreip/vs/vsIcmpUtil.h b/h/wrn/coreip/vs/vsIcmpUtil.h new file mode 100644 index 0000000..648aad5 --- /dev/null +++ b/h/wrn/coreip/vs/vsIcmpUtil.h @@ -0,0 +1,44 @@ +/* vsIcmpUtil.h - virtual stack data for ICMP */ + +/* Copyright 2000 - 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05nov03,cdw Removal of unnecessary _KERNEL guards. +01b,04nov03,rlm Ran batch header path update for header re-org. +01a,15jan03,hgo created to seperate utilities from ICMP +*/ + +#ifndef __INCvsIcmpUtilh +#define __INCvsIcmpUtilh + + +/* includes */ + +#include +#include +#include + +/* defines */ + +/* typedefs */ + +typedef struct vs_icmp_util_global_data + { + /* definitions from icmpUtilLib.c */ + BOOL priv_maskReplyReceived; /* recv mask reply */ + int priv_icmpMask; /* replied icmp mask */ + struct + { + struct ip ih; /* IP header */ + struct icmp icmph; /* ICMP header */ + } priv_icmpMsg; + } VS_ICMPUTIL; + +/* macros */ + +#define VS_ICMPUTIL_DATA ((VS_ICMPUTIL *)vsTbl[myStackNum]->pIcmpUtilGlobals) + +#endif /* __INCvsIcmpUtilh */ + diff --git a/h/wrn/coreip/vs/vsIcmpv6.h b/h/wrn/coreip/vs/vsIcmpv6.h new file mode 100644 index 0000000..744554f --- /dev/null +++ b/h/wrn/coreip/vs/vsIcmpv6.h @@ -0,0 +1,57 @@ +/* vsIcmpv6.h - virtual stack data for ICMPv6 */ + +/* Copyright 2000 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,17may05,kch Removed unused priv_icmp6_reflect_rt. +01e,11nov03,cdw Removal of unnecessary _KERNEL guards. +01d,10nov03,rlm 2nd pass of include update for header re-org. +01c,04nov03,rlm Ran batch header path update for header re-org. +01b,28aug02,kal fixed location of icmp6.h +01a,18jun02,ant written +*/ + +#ifndef __INCvsIcmpv6h +#define __INCvsIcmpv6h + + +/* includes */ + +#include + +/* defines */ + +/* typedefs */ + +typedef struct vs_icmpv6_global_data + { + /* definitions from icmp6.c */ + struct icmp6stat _icmp6stat; + int priv_icmp6errpps_count; + struct timeval priv_icmp6errppslim_last; + + /* definitions from in6_proto.c */ + int icmp6_rediraccept; + int icmp6_redirtimeout; + int icmp6errppslim; + int icmp6nodeinfo; + + /* definition from icmp6_redirect_diag() */ + char priv_buf[1024]; + + } VS_ICMPV6; + + +/* macros */ + +#define VS_ICMPV6_DATA ((VS_ICMPV6 *)vsTbl[myStackNum]->pIcmpv6Globals) + +#define _icmp6stat VS_ICMPV6_DATA->_icmp6stat +#define icmp6_rediraccept VS_ICMPV6_DATA->icmp6_rediraccept +#define icmp6_redirtimeout VS_ICMPV6_DATA->icmp6_redirtimeout +#define icmp6errppslim VS_ICMPV6_DATA->icmp6errppslim +#define icmp6nodeinfo VS_ICMPV6_DATA->icmp6nodeinfo + +#endif /* __INCvsIcmpv6h */ diff --git a/h/wrn/coreip/vs/vsIf.h b/h/wrn/coreip/vs/vsIf.h new file mode 100644 index 0000000..909a8e3 --- /dev/null +++ b/h/wrn/coreip/vs/vsIf.h @@ -0,0 +1,61 @@ +/* vsIf.h - virtual stack data for interface layer */ + +/* Copyright 2001 - 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,26sep02,wie added timeout handle +01c,06sep02,kal took out if_init_done +01b,27aug02,ism added global function pointers +01a,26aug02,ism created +*/ + +#ifndef __INCvsIfh +#define __INCvsIfh + +typedef struct vs_if_global_data { + + /* from if.c */ + struct ifnethead ifnet_head; + int ifqmaxlen; + int if_indexlim; + int last_if_index; + struct ifaddr ** ifnet_addrs; + struct ifnet ** ifindex2ifnet; + FUNCPTR _protoBindStatusGet; + + /* from if_loop.c */ + struct ifnet * loif; + int nloop; + + /* from ifname.c */ + int ifxs; + + /* from ipProto.c */ + FUNCPTR _m2SetIfLastChange; + FUNCPTR _m2IfTableUpdate; + + void *priv_if_slowtimoHandle; + + } VS_IF; + +#define VS_IF_DATA ((VS_IF *)vsTbl[myStackNum]->pIfGlobals) + +#define ifnet_head VS_IF_DATA->ifnet_head +#define ifqmaxlen VS_IF_DATA->ifqmaxlen +#define if_indexlim VS_IF_DATA->if_indexlim +#define last_if_index VS_IF_DATA->last_if_index +#define ifnet_addrs VS_IF_DATA->ifnet_addrs +#define ifindex2ifnet VS_IF_DATA->ifindex2ifnet +#define _protoBindStatusGet VS_IF_DATA->_protoBindStatusGet + +#define loif VS_IF_DATA->loif +#define nloop VS_IF_DATA->nloop + +#define ifxs VS_IF_DATA->ifxs + +#define _m2SetIfLastChange VS_IF_DATA->_m2SetIfLastChange +#define _m2IfTableUpdate VS_IF_DATA->_m2IfTableUpdate + +#endif diff --git a/h/wrn/coreip/vs/vsIp6.h b/h/wrn/coreip/vs/vsIp6.h new file mode 100644 index 0000000..8fabf96 --- /dev/null +++ b/h/wrn/coreip/vs/vsIp6.h @@ -0,0 +1,292 @@ +/* vsIp6.h - virtual stack data for IP */ + +/* + * Copyright (c) 2000-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01t,11aug05,vvv fixed build error +01s,11aug05,vvv removed include for in6_prefix.h +01r,02aug05,dlk Kame merge of udp6_usrreq.c, removed udp6_last_in6pcb. +01q,25jul05,dlk Restore ip6qmaxlen, add ip6intrq, ip6intrqJob for loopback. +01p,10may05,kch Added ip6_mcast_pmtu. +01o,28apr05,kch Added ip6_use_defzone, sid_default, defaultaddrpolicy, + ip6_prefer_tempaddr, addrsel_policytab and udp6_last_in6pcb. +01m,26apr05,kch Move ip6_mrouter definition here from VS_IP_MROUTE6. Also + added IPv6 multicast router hooks and scope6_var.h include. +01l,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +01k,12may04,sar Added fields for IPFW routines. +01j,11nov03,cdw Removal of unnecessary _KERNEL guards. +01i,10nov03,rlm 2nd pass of include update for header re-org. +01h,04nov03,rlm Ran batch header path update for header re-org. +01g,11dec02,sar Virtualize the external hooks +01f,15oct02,niq Changes for Accordion's new RTM +01e,09oct02,spm updated for conversion to Patricia tree RIB interface: + moved rmx6 untimeout to cleanup routine +01d,26sep02,wie timeout handles for rmx6 +01c,05sep02,kal added ip6_mapped_addr_on +01b,04sep02,kal renamed rtq_xxx -> rmx6_rtq_xxx +01a,09jul02,ger file creation: based on IPv4 implementation +*/ + +#ifndef __INCvsIp6h +#define __INCvsIp6h + + +/* includes */ + +#include "vxWorks.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/* defines */ +#ifndef IPV6FORWARDING +#ifdef GATEWAY6 +#define IPV6FORWARDING 1 /* forward IP6 packets not for us */ +#else +#define IPV6FORWARDING 0 /* don't forward IP6 packets not for us */ +#endif /* GATEWAY6 */ +#endif /* !IPV6FORWARDING */ + +#ifndef IPV6_SENDREDIRECTS +#define IPV6_SENDREDIRECTS 1 +#endif + +/* typedefs */ + +/* + * We need to save the IP options in case a protocol wants to respond + * to an incoming packet over the same route if the packet got here + * using IP source routing. This allows connection establishment and + * maintenance when the remote end is on a network that is not known + * to us. + */ + + + +typedef struct vsIp6 + { + /* definitions from frag6.c */ + int frag6_doing_reass; + u_int frag6_nfragpackets; + u_int frag6_nfrags; + struct ip6q _ip6q; /* ip6 reassemble queue */ + struct route_in6 priv_ro; /*only used in frag6_input.c*/ + + /* definitions from in6.c */ + struct in6_multihead _in6_multihead; /* XXX BSS initialization */ + int priv_ip6round ; + char priv_ip6buf[8][48]; + + /* definitions from in6_ifattach.c */ + unsigned long in6_maxmtu ; + int ip6_auto_linklocal ; + struct callout in6_tmpaddrtimer_ch; + + /* definitions from in6_proto.c */ + struct domain inet6domain ; + int ip6_forwarding ; /* act as router? */ + int ip6_sendredirects ; + int ip6_defhlim ; + int ip6_defmcasthlim ; + int ip6_accept_rtadv ; /* "IPV6FORWARDING ? 0 : 1" is dangerous */ + int ip6_maxfragpackets; /* initialized in frag6.c:frag6_init() */ + int ip6_maxfrags; /* initialized in frag6.c:frag6_init() */ + int ip6_log_interval ; + int ip6_hdrnestlimit ; /* appropriate? */ + int ip6_dad_count ; /* DupAddrDetectionTransmits */ + u_int32_t ip6_flow_seq; + int ip6_auto_flowlabel ; + int ip6_gif_hlim ; + int ip6_use_deprecated ; /* allow deprecated addr (RFC2462 5.5.4) */ + int ip6_rr_prune ; /* router renumbering prefix walk list */ + int ip6_v6only ; + int ip6_mcast_pmtu; /* enable pMTU discovery for multicast? */ + u_int32_t ip6_id ; + int ip6_keepfaith ; + time_t ip6_log_time ; + u_long rip6_sendspace ; + u_long rip6_recvspace ; + /*will probably be moved to ICMP6 + int icmp6_rediraccept; accept and process redirects + int icmp6_redirtimeout ; + int icmp6errppslim ; + int icmp6_nodeinfo ; enable/disable NI response */ + /*will probably be moved to UDP6 + int udp6_sendspace ; really max datagram size + int udp6_recvspace ;*/ + /* definitions from in6_rmx.c */ + int rmx6_rtq_reallyold ; + /* one hour is ``really old'' */ + int rmx6_rtq_minreallyold ; + /* never automatically crank down to less */ + int rmx6_rtq_toomany ; + /* 128 cached routes is ``too many'' */ + int rmx6_rtq_timeout ; + time_t priv_last_adjusted_timeout ; + + void *in6_rtqtimoHandle; + void *in6_mtutimoHandle; + + /* definitions from ip6_forward.c */ + struct route_in6 ip6_forward_rt; + + /* external hooks from ip6_mroute.c */ + FUNCPTR _mCastRouteFwdHookIPv6; + FUNCPTR _mCastRouteCmdHookIPv6; + FUNCPTR _mCastRouterIoctlHookIPv6; + FUNCPTR _mCastRouterDoneHookIPv6; + VOIDFUNCPTR _mCastRouterDetachHookIPv6; + + /* external hooks from ip6_forward.c */ + IPSEC_OUTPUT_IPV6_FUNCPTR ipsecForwardIPv6; + + /* from intrq.c */ + struct ifqueue ip6intrq; + INTRQ_QJOB ip6intrqJob; + + /* definitions from netinet/ip6_input.c */ + u_char ip6_protox[IPPROTO_MAX]; + int ip6qmaxlen; + struct in6_ifaddr *_in6_ifaddr; /* first inet address */ + struct ip6stat _ip6stat; + struct socket *ip6_mrouter; + + /* external hooks from ip6_input.c */ + INPUT_HOOK_IPV6_FUNCPTR ipFilterHookIPv6; + INPUT_HOOK_IPV6_FUNCPTR ipsecFilterHookIPv6; + INPUT_HOOK_IPV6_FUNCPTR ipsecInputIPv6; + + /* external hooks from ip6_output.c */ + IPSEC_OUTPUT_IPV6_FUNCPTR ipsecOutputIPv6; + + /* definitions from raw_ip6.c */ + struct rip6stat _rip6stat; + + /* definitions from scope6.c */ + int ip6_use_defzone; + struct scope6_id sid_default; + + /* definitions from in6_src.c */ + int ip6_prefer_tempaddr; + struct in6_addrpolicy defaultaddrpolicy; + struct addrsel_policyhead addrsel_policytab; + +#ifdef INCLUDE_IPFW_HOOKS + /* external hooks from ipfw_var.c, these are for input, output and + forward files */ + ipfw_anchor_t ipfw_preinput6; + ipfw_anchor_t ipfw_input6; + ipfw_anchor_t ipfw_forward6; + ipfw_anchor_t ipfw_output6; +#endif /* INCLUDE_IPFW_HOOKS */ + + } VS_IP6; + +/* macros */ + +#define VS_IP6_DATA ((VS_IP6 *)vsTbl[myStackNum]->pIp6Globals) + +#define frag6_doing_reass VS_IP6_DATA->frag6_doing_reass +#define frag6_nfragpackets VS_IP6_DATA->frag6_nfragpackets +#define frag6_nfrags VS_IP6_DATA->frag6_nfrags +#define _ip6q VS_IP6_DATA->_ip6q +#define _in6_multihead VS_IP6_DATA->_in6_multihead +#define in6_maxmtu VS_IP6_DATA->in6_maxmtu +#define ip6_auto_linklocal VS_IP6_DATA->ip6_auto_linklocal +#define in6_tmpaddrtimer_ch VS_IP6_DATA->in6_tmpaddrtimer_ch +#define _rr_prefix VS_IP6_DATA->_rr_prefix +#define inet6domain VS_IP6_DATA->inet6domain +#define ip6_forwarding VS_IP6_DATA->ip6_forwarding +#define ip6_sendredirects VS_IP6_DATA->ip6_sendredirects +#define ip6_defhlim VS_IP6_DATA->ip6_defhlim +#define ip6_defmcasthlim VS_IP6_DATA->ip6_defmcasthlim +#define ip6_accept_rtadv VS_IP6_DATA->ip6_accept_rtadv +#define ip6_maxfragpackets VS_IP6_DATA->ip6_maxfragpackets +#define ip6_maxfrags VS_IP6_DATA->ip6_maxfrags +#define ip6_log_interval VS_IP6_DATA->ip6_log_interval +#define ip6_hdrnestlimit VS_IP6_DATA->ip6_hdrnestlimit +#define ip6_dad_count VS_IP6_DATA->ip6_dad_count +#define ip6_flow_seq VS_IP6_DATA->ip6_flow_seq +#define ip6_auto_flowlabel VS_IP6_DATA->ip6_auto_flowlabel +#define ip6_gif_hlim VS_IP6_DATA->ip6_gif_hlim +#define ip6_use_deprecated VS_IP6_DATA->ip6_use_deprecated +#define ip6_rr_prune VS_IP6_DATA->ip6_rr_prune +#define ip6_v6only VS_IP6_DATA->ip6_v6only +#define ip6_mcast_pmtu VS_IP6_DATA->ip6_mcast_pmtu +#define ip6_mapped_addr_on (!ip6_v6only) +#define ip6_id VS_IP6_DATA->ip6_id +#define ip6_keepfaith VS_IP6_DATA->ip6_keepfaith +#define ip6_log_time VS_IP6_DATA->ip6_log_time +#define rip6_sendspace VS_IP6_DATA->rip6_sendspace +#define rip6_recvspace VS_IP6_DATA->rip6_recvspace +#define rmx6_rtq_reallyold VS_IP6_DATA->rmx6_rtq_reallyold +#define rmx6_rtq_minreallyold VS_IP6_DATA->rmx6_rtq_minreallyold +#define rmx6_rtq_toomany VS_IP6_DATA->rmx6_rtq_toomany +#define rmx6_rtq_timeout VS_IP6_DATA->rmx6_rtq_timeout +#define ip6_forward_rt VS_IP6_DATA->ip6_forward_rt +#define ip6_protox VS_IP6_DATA->ip6_protox +#define _in6_ifaddr VS_IP6_DATA->_in6_ifaddr +#define _ip6stat VS_IP6_DATA->_ip6stat +#define ip6_mrouter VS_IP6_DATA->ip6_mrouter +#define _rip6stat VS_IP6_DATA->_rip6stat +#define in6_rtqtimoHandle VS_IP6_DATA->in6_rtqtimoHandle +#define in6_mtutimoHandle VS_IP6_DATA->in6_mtutimoHandle +#define ip6_use_defzone VS_IP6_DATA->ip6_use_defzone +#define sid_default VS_IP6_DATA->sid_default +#define ip6_prefer_tempaddr VS_IP6_DATA->ip6_prefer_tempaddr +#define defaultaddrpolicy VS_IP6_DATA->defaultaddrpolicy +#define addrsel_policytab VS_IP6_DATA->addrsel_policytab +#define ip6qmaxlen VS_IP6_DATA->ip6qmaxlen +#define ip6intrq VS_IP6_DATA->ip6intrq +#define ip6intrqJob VS_IP6_DATA->ip6intrqJob + +/* external hooks from ip6_mroute.c */ +#define _mCastRouteFwdHookIPv6 VS_IP6_DATA->_mCastRouteFwdHookIPv6 +#define _mCastRouteCmdHookIPv6 VS_IP6_DATA->_mCastRouteCmdHookIPv6 +#define _mCastRouterIoctlHookIPv6 VS_IP6_DATA->_mCastRouterIoctlHookIPv6 +#define _mCastRouterDoneHookIPv6 VS_IP6_DATA->_mCastRouterDoneHookIPv6 +#define _mCastRouterDetachHookIPv6 VS_IP6_DATA->_mCastRouterDetachHookIPv6 + +/* external hooks from ip6_forward.c */ +#define _ipsecForwardIPv6 VS_IP6_DATA->ipsecForwardIPv6 +#define SET_IPSECFORWARDIPV6(foo) (VS_IP6_DATA->ipsecForwardIPv6 = foo) + +/* external hooks from ip6_input.c */ +#define _ipFilterHookIPv6 VS_IP6_DATA->ipFilterHookIPv6 +#define _ipsecFilterHookIPv6 VS_IP6_DATA->ipsecFilterHookIPv6 +#define _ipsecInputIPv6 VS_IP6_DATA->ipsecInputIPv6 + +#define SET_IPFILTERHOOKIPV6(foo) (VS_IP6_DATA->ipFilterHookIPv6 = foo) +#define SET_IPSECFILTERHOOKIPV6(foo) (VS_IP6_DATA->ipsecFilterHookIPv6 = foo) +#define SET_IPSECINPUTIPV6(foo) (VS_IP6_DATA->ipsecInputIPv6 = foo) + +/* external hooks from ip6_output.c */ +#define _ipsecOutputIPv6 VS_IP6_DATA->ipsecOutputIPv6 +#define SET_IPSECOUTPUTIPV6(foo) (VS_IP6_DATA->ipsecOutputIPv6 = foo) + +/* external hooks from ipfw_var.c */ +#define ipfw_preinput6 VS_IP6_DATA->ipfw_preinput6 +#define ipfw_input6 VS_IP6_DATA->ipfw_input6 +#define ipfw_forward6 VS_IP6_DATA->ipfw_forward6 +#define ipfw_output6 VS_IP6_DATA->ipfw_output6 + +#endif /* __INCvsIph */ + + diff --git a/h/wrn/coreip/vs/vsIpRoute.h b/h/wrn/coreip/vs/vsIpRoute.h new file mode 100644 index 0000000..2b90e01 --- /dev/null +++ b/h/wrn/coreip/vs/vsIpRoute.h @@ -0,0 +1,140 @@ +/* vsIpRoute.h - virtual stack definitions for the route interface library */ + +/* + * Copyright (c) 1984-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01l,19may05,rp added pRtAddrInfoMsgHook +01k,10may05,niq Changes for debugging +01j,24feb05,spm performance updates and code cleanup (SPR #100995) +01i,05oct04,rae add _mrt_ioctl for route.c +01h,17sep04,niq Code cleanup +01g,28may04,niq Changes for VIRTUAL_STACK +01f,20nov03,niq Remove copyright_wrs.h file inclusion +01e,05nov03,cdw Removal of unnecessary _KERNEL guards. +01d,04nov03,rlm Ran batch header path update for header re-org. +01c,15sep03,vvv updated path for new headers +01b,08nov02,niq Don't generate routing messages upon stack destruction. +01a,15oct02,niq file creation +*/ + +/* +DESCRIPTION +This file includes virtual stack definitions for the RTM +*/ + +#ifndef _INCvsIpRouteH +#define _INCvsIpRouteH + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include /* needed for route.h */ +#include +#include +#include /* RT_PROTO_SET and RT_PROTO_GET */ +#include + +/* structure for the RTM global variables */ +struct ipRouteVars + { +#ifdef DEBUG + ULONG _ipRouteLibLogLevel; +#endif /* DEBUG */ + UCHAR _ipRouteDefaultWeight; + int _rtmodified; + int priv_rttrash; /* private to ipRouteLib.c */ + BOOL ipRouteStackGoingDown; + SEM_ID ipRouteLockSem; + IP_ROUTE_USAGE_T ipRouteUsageTbl [ROUTE_USAGES_MAX + 1]; + BOOL ipRouteWalkDeleteFlag; + + /* definitions from route.c */ + struct route_cb _route_cb; + struct rtstat _rtstat; + FUNCPTR _mrt_ioctl; + +#ifdef WV_INSTRUMENTATION +#ifdef INCLUDE_WVNET + UCHAR _rtWvNetLocalFilter; + ULONG _rtWvNetEventId; +#endif /* INCLUDE_WVNET */ +#endif /* WV_INSTRUMENTATION */ + }; +typedef struct ipRouteVars VS_IP_ROUTE_VARS_T; + +typedef struct vs_rtsock_global_data + { + /* definitions from rtsock.c */ + struct sockaddr priv_route_dst; + struct sockaddr priv_route_src; + struct sockaddr priv_sa_zero; + struct sockproto priv_route_proto; + struct protosw priv_routesw[IP_PROTO_NUM_MAX]; + struct domain routedomain; + FUNCPTR pRtIfAnnounceMsgHook; + FUNCPTR pRtIfMsgHook; + FUNCPTR pRtNewMaddrMsgHook; + FUNCPTR pRtNewAddrMsgHook; + FUNCPTR pRtMissMsgHook; + FUNCPTR pRtMsg1; + FUNCPTR pRtAddrInfoMsgHook; + } VS_RTSOCK; + +/* macros */ +#define pIpRouteVars \ + ((VS_IP_ROUTE_VARS_T *)(vsTbl [myStackNum]->pRouteGlobals)) +#define ipRouteDefaultWeight pIpRouteVars->_ipRouteDefaultWeight +#define rtmodified pIpRouteVars->_rtmodified +#define ipRouteWalkDeleteFlag pIpRouteVars->ipRouteWalkDeleteFlag +#define ipRouteUsageTbl pIpRouteVars->ipRouteUsageTbl +#define ipRouteLockSem pIpRouteVars->ipRouteLockSem +#define ipRouteStackGoingDown pIpRouteVars->ipRouteStackGoingDown + + + +#ifdef DEBUG +#define ipRouteLibLogLevel pIpRouteVars->_ipRouteLibLogLevel +#endif /* DEBUG */ + +#ifdef WV_INSTRUMENTATION +#ifdef INCLUDE_WVNET +#define rtWvNetLocalFilter pIpRouteVars->_rtWvNetLocalFilter +#define rtWvNetEventId pIpRouteVars->_rtWvNetEventId +#endif /* INCLUDE_WVNET */ +#endif /* WV_INSTRUMENTATION */ + + +/* definitions from route.c */ + +#define _route_cb pIpRouteVars->_route_cb +#define _rtstat pIpRouteVars->_rtstat +#define _mrt_ioctl pIpRouteVars->_mrt_ioctl +/* definitions from rtsock.c */ + +#define VS_RTSOCK_DATA (&(vsTbl[myStackNum]->rtsockGlobals)) + +#define routedomain VS_RTSOCK_DATA->routedomain +#define pRtIfAnnounceMsgHook VS_RTSOCK_DATA->pRtIfAnnounceMsgHook +#define pRtIfMsgHook VS_RTSOCK_DATA->pRtIfMsgHook +#define pRtNewMaddrMsgHook VS_RTSOCK_DATA->pRtNewMaddrMsgHook +#define pRtNewAddrMsgHook VS_RTSOCK_DATA->pRtNewAddrMsgHook +#define pRtMissMsgHook VS_RTSOCK_DATA->pRtMissMsgHook +#define pRtMsg1 VS_RTSOCK_DATA->pRtMsg1 +#define pRtAddrInfoMsgHook VS_RTSOCK_DATA->pRtAddrInfoMsgHook + +#ifdef __cplusplus +} +#endif + +#endif /* _INCvsIpRouteH */ diff --git a/h/wrn/coreip/vs/vsLog.h b/h/wrn/coreip/vs/vsLog.h new file mode 100644 index 0000000..7dec82a --- /dev/null +++ b/h/wrn/coreip/vs/vsLog.h @@ -0,0 +1,34 @@ +/* vsLog.h - virtual stack data for applUtilLib */ + +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,07sep04,dlk Written. +*/ + +#ifndef __INCvsLogh +#define __INCvsLogh + +#include + +/* defines */ + +typedef struct _VS_LOG + { + BOOL _loggerInitialized; + CATEGORY_INFO _catInfo [LOG_NUMCATS]; + } VS_LOG; + +extern VS_LOG * vsLogTbl[]; + +/* macros */ + +#define VS_LOG_DATA (vsLogTbl[myStackNum]) + +#define loggerInitialized VS_LOG_DATA->_loggerInitialized +#define catInfo VS_LOG_DATA->_catInfo + +#endif /* __INCvsLogh */ + diff --git a/h/wrn/coreip/vs/vsMcast6.h b/h/wrn/coreip/vs/vsMcast6.h new file mode 100644 index 0000000..6952d91 --- /dev/null +++ b/h/wrn/coreip/vs/vsMcast6.h @@ -0,0 +1,109 @@ +/* vsMroute6.h - virtual stack data for mroute6 */ + +/* + * Copyright (c) 2004-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + + +/* +modification history +-------------------- +01f,11jul05,dlk Added expire_upcalls_ch6. Mod history clean-up. +01e,28apr05,kch Fixed virtualization issues. +01d,27apr05,kch Move ip6_mrouter definition to VS_IP6. +01c,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +01b,28dec04,kc Renamed pim6 to _pim6. +01a,22dec04,kc written +*/ + +#ifndef __INCvsMcast6h +#define __INCvsMcast6h + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#ifdef WRS_PIM6 +#include +#endif /* WRS_PIM6 */ +#include + +#define VS_IP_MROUTE6_DATA ((VS_IP_MROUTE6 *)vsTbl[myStackNum]->pMroute6Globals) + +typedef struct vs_ip_mroute6 +{ +/* + * Globals. All but ip6_mrouter, ip6_mrtproto and mrt6stat could be static, + * except for netstat or debugging purposes. + */ + + int ip6_mrouter_ver; + int ip6_mrtproto; + struct mrt6stat _mrt6stat; + struct mf6c *_mf6ctable[MF6CTBLSIZ]; + u_char n6expire[MF6CTBLSIZ]; + struct mif6 _mif6table[MAXMIFS]; + + struct callout expire_upcalls_ch6; + +#ifdef MRT6DEBUG + u_int mrt6debug; /* debug level */ +#endif /* MRT6DEBUG */ + +/* + * 'Interfaces' associated with decapsulator (so we can tell + * packets that went through it from ones that get reflected + * by a broken gateway). These interfaces are never linked into + * the system ifnet list & no routes point to them. I.e., packets + * can't be sent this way. They only exist as a placeholder for + * multicast source verification. + */ + struct ifnet multicast_register_if; + + mifi_t nummifs; + mifi_t reg_mif_num; + +#ifdef WRS_PIM6 + struct pim6stat _pim6stat; + int _pim6; +#endif /* WRS_PIM6 */ + +#ifdef UPCALL_TIMING +#define UPCALL_MAX 50 + u_long upcall_data[UPCALL_MAX + 1]; +#endif /* UPCALL_TIMING */ + +} VS_IP_MROUTE6; + +#define ip6_mrouter_ver VS_IP_MROUTE6_DATA->ip6_mrouter_ver +#define ip6_mrtproto VS_IP_MROUTE6_DATA->ip6_mrtproto +#define _mrt6stat VS_IP_MROUTE6_DATA->_mrt6stat +#define _mf6ctable VS_IP_MROUTE6_DATA->_mf6ctable +#define n6expire VS_IP_MROUTE6_DATA->n6expire +#define _mif6table VS_IP_MROUTE6_DATA->_mif6table +#define expire_upcalls_ch6 VS_IP_MROUTE6_DATA->expire_upcalls_ch6 +#define mrt6debug VS_IP_MROUTE6_DATA->mrt6debug +#define multicast_register_if VS_IP_MROUTE6_DATA->multicast_register_if +#define nummifs VS_IP_MROUTE6_DATA->nummifs +#define reg_mif_num VS_IP_MROUTE6_DATA->reg_mif_num + +#ifdef WRS_PIM6 +#define _pim6stat VS_IP_MROUTE6_DATA->_pim6stat +#define _pim6 VS_IP_MROUTE6_DATA->_pim6 +#endif /* WRS_PIM6 */ + +#ifdef UPCALL_TIMING +#define upcall_data VS_IP_MROUTE6_DATA->upcall_data +#endif /* UPCALL_TIMING */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvsMcast6h */ + diff --git a/h/wrn/coreip/vs/vsMip6.h b/h/wrn/coreip/vs/vsMip6.h new file mode 100644 index 0000000..201d54a --- /dev/null +++ b/h/wrn/coreip/vs/vsMip6.h @@ -0,0 +1,82 @@ +/* vsMip6.h - virtual stack data for mobility */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01a,20may05,kch written. +*/ + +#ifndef __INCvsMip6h +#define __INCvsMip6h + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* includes */ + +typedef struct vsMip6 + { + /* definition from mip6Lib.c */ + struct domain mipdomain; + struct protosw mipsw[MIP_PROTO_NUM_MAX]; + + /* definitions from mip6.c */ + struct mip6_bc_internal *mip6_bc_hash[MIP6_BC_HASH_SIZE]; + struct mip6_bc_list mip6_bc_list; + struct mip6stat mip6stat; + u_int8_t mip6_nodetype; + int mip6ctl_use_ipsec; + int mip6ctl_debug; + int mip6ctl_rr_hint_ppslim; + +#if NMIP > 0 + /* definitions from mip6.c */ + int mip6_rr_hint_pps_count; + struct timeval mip6_rr_hint_ppslim_last; + + /* definitions from if_mip.c */ + struct mip_softc_list _mip_softc_list; +#endif /* NMIP > 0 */ + + } VS_MIP6; + +/* macros */ + +#define VS_MIP6_DATA ((VS_MIP6 *)vsTbl[myStackNum]->pMip6Globals) + +#define mipdomain VS_MIP6_DATA->mipdomain +#define mipsw VS_MIP6_DATA->mipsw + +#define mip6_bc_hash VS_MIP6_DATA->mip6_bc_hash +#define mip6_bc_list VS_MIP6_DATA->mip6_bc_list +#define mip6stat VS_MIP6_DATA->mip6stat +#define mip6_nodetype VS_MIP6_DATA->mip6_nodetype +#define mip6ctl_use_ipsec VS_MIP6_DATA->mip6ctl_use_ipsec +#define mip6ctl_debug VS_MIP6_DATA->mip6ctl_debug +#define mip6ctl_rr_hint_ppslim VS_MIP6_DATA->mip6ctl_rr_hint_ppslim + +#if NMIP > 0 +#define mip6_rr_hint_pps_count VS_MIP6_DATA->mip6_rr_hint_pps_count +#define mip6_rr_hint_ppslim_last VS_MIP6_DATA->mip6_rr_hint_ppslim_last +#define _mip_softc_list VS_MIP6_DATA->_mip_softc_list +#endif /* NMIP > 0 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCvsMip6h */ + + diff --git a/h/wrn/coreip/vs/vsMld.h b/h/wrn/coreip/vs/vsMld.h new file mode 100644 index 0000000..cc140fb --- /dev/null +++ b/h/wrn/coreip/vs/vsMld.h @@ -0,0 +1,94 @@ +/* vsMld.h - virtual stack data for MLD6 */ + +/* + * Copyright (c) 2000-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01f,27apr05,rp virtualization changes +01e,10nov03,rlm 2nd pass of include update for header re-org. +01d,05nov03,cdw Removal of unnecessary _KERNEL guards. +01c,04nov03,rlm Ran batch header path update for header re-org. +01b,28aug02,kal fixed ml6_var.h location +01a,27aug02,kal created +*/ + +#ifndef __INCvsMldh +#define __INCvsMldh + + +/* includes */ + +#include +#include +#include +#include +#include + +/* defines */ + +/* typedefs */ + +typedef struct vs_mld + { + + /* common from mld6.c and mldv2.c */ + + /*struct in6_multihead in6_multihead;*/ + struct router6_info *Head6; + struct ip6_pktopts ip6_opts; + struct sockaddr_in6 *all_nodes_linklocal; + struct sockaddr_in6 *all_routers_linklocal; + struct sockaddr_in6 all_nodes_linklocal0; + struct sockaddr_in6 all_routers_linklocal0; + u_int8_t hbh_buf[8]; + + /* mldv2.c only */ +#ifdef MLDV2 + int mldmaxsrcfilter; + int mldsomaxsrc; + int mldversion; + int mld_group_timers_are_running; + int mld_interface_timers_are_running; + int mld_state_change_timers_are_running; + struct sockaddr_in6 *all_v2routers_linklocal; + struct sockaddr_in6 all_v2routers_linklocal0; +#endif /* MLDV2 */ + + } VS_MLD; + +/* macros */ + +#define VS_MLD_DATA ((VS_MLD *)vsTbl[myStackNum]->pMldGlobals) + +#define Head6 VS_MLD_DATA->Head6 +#define ip6_opts VS_MLD_DATA->ip6_opts +#define all_nodes_linklocal VS_MLD_DATA->all_nodes_linklocal +#define all_routers_linklocal VS_MLD_DATA->all_routers_linklocal +#define all_nodes_linklocal0 VS_MLD_DATA->all_nodes_linklocal0 +#define all_routers_linklocal0 VS_MLD_DATA->all_routers_linklocal0 +#define hbh_buf VS_MLD_DATA->hbh_buf + +#ifdef MLDV2 +#define mldmaxsrcfilter VS_MLD_DATA->mldmaxsrcfilter +#define mldsomaxsrc VS_MLD_DATA->mldsomaxsrc +#define mldversion VS_MLD_DATA->mldversion +#define mld_group_timers_are_running \ + VS_MLD_DATA->mld_group_timers_are_running +#define mld_interface_timers_are_running \ + VS_MLD_DATA->mld_interface_timers_are_running +#define mld_state_change_timers_are_running \ + VS_MLD_DATA->mld_state_change_timers_are_running + +#define all_v2routers_linklocal VS_MLD_DATA->all_v2routers_linklocal +#define all_v2routers_linklocal0 VS_MLD_DATA->all_v2routers_linklocal0 +#endif /* MLDV2 */ + +#endif /* __INCvsMldh */ + diff --git a/h/wrn/coreip/vs/vsMroute.h b/h/wrn/coreip/vs/vsMroute.h new file mode 100644 index 0000000..c205178 --- /dev/null +++ b/h/wrn/coreip/vs/vsMroute.h @@ -0,0 +1,23 @@ +/* vsMroute.h - virtual stack data for mroute */ + +/* Copyright 2000 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,05nov04,rae Obsolete. Correct header is vsMcast.h (SPR #103780) +01d,11aug04,niq VS data structure reorganization +01c,05nov03,cdw Removal of unnecessary _KERNEL guards. +01b,04nov03,rlm Ran batch header path update for header re-org. +01a,01jul02,ant written +*/ + +/* This header is obsolete, and is liable to be removed. Do not use. */ + +#ifndef __INCvsMrouteh +#define __INCvsMrouteh + +#include "netinet/vsMcast.h" + +#endif /* __INCvsMrouteh */ + diff --git a/h/wrn/coreip/vs/vsNd6.h b/h/wrn/coreip/vs/vsNd6.h new file mode 100644 index 0000000..fcba639 --- /dev/null +++ b/h/wrn/coreip/vs/vsNd6.h @@ -0,0 +1,106 @@ +/* vsNd6.h - virtual stack data for Neighbor Discovery */ + +/* + * Copyright (c) 2000-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01j,12may05,rp added _nd6_maxqueuelen, removed nd6_defif_installed +01i,03may05,kch Fixed sysctl variables virtualization (SPR#108823). +01h,28apr05,kch Fixed build problem. Added nd6_defif_installed variable to + VS_ND6. +01g,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev +01f,05nov03,cdw Removal of unnecessary _KERNEL guards. +01e,04nov03,rlm Ran batch header path update for header re-org. +01d,10mar03,nee consolidate nd6_ifinfo_indexlim and if_indexlim +01c,28aug02,kal fixed typo in includes +01b,21jun02,hgo created +*/ + +#ifndef __INCvsNd6h +#define __INCvsNd6h + +#include +#include +#include +#include + +/* typedefs */ + + /* Encapsulated (former) globals for ND6 */ + +typedef struct vsNd6 + { + /* defined in nd6.c */ + + int _nd6_prune; /* walk list every 1 seconds */ + int _nd6_delay; /* delay first probe time 5 second */ + int _nd6_umaxtries; /* maximum unicast query */ + int _nd6_mmaxtries; /* maximum muliticast query */ + int _nd6_useloopback; /* use loopback interface for local traffic */ + int _nd6_gctimer; /* 1day: garbage collection timer */ + int _priv_nd6_maxndopt; /* max # of ND options allowed */ + int _nd6_maxnudhint; /* max # of subsequent upper layer hints */ + int _nd6_maxqueuelen; /* max # of packets cached in unresolved ND entries */ + int _nd6_debug; + int _priv_nd6_inuse; /* # of ND entries */ + struct llinfo_nd6 _llinfo_nd6; /* linked list ND entries */ + struct nd_drhead _nd_defrouter; + struct nd_prhead _nd_prefix; /* was _nd_prefix */ + int _nd6_recalc_reachtm_interval; + struct sockaddr_in6 _priv_all1_sa; + struct callout _nd6_slowtimo_ch; + struct callout _nd6_timer_ch; + int _priv_nd6_init_done; + + /* defined in nd6_nbr.c */ + + struct dadq_head _priv_dadq; + int _priv_dad_init; + + /* defined in nd6_rtr.c */ + + struct ifnet *_nd6_defifp; + int _nd6_defifindex; + int _ip6_use_tempaddr; + int _ip6_desync_factor; + u_int32_t _ip6_temp_preferred_lifetime; + u_int32_t _ip6_temp_valid_lifetime; + int _ip6_temp_regen_advance; + } VS_ND6; + +/* macros for "non-private" global variables */ + +#define VS_ND6_DATA ((VS_ND6 *)vsTbl[myStackNum]->pNd6Globals) + +#define _nd6_prune VS_ND6_DATA->_nd6_prune +#define _nd6_delay VS_ND6_DATA->_nd6_delay +#define _nd6_umaxtries VS_ND6_DATA->_nd6_umaxtries +#define _nd6_mmaxtries VS_ND6_DATA->_nd6_mmaxtries +#define _nd6_useloopback VS_ND6_DATA->_nd6_useloopback +#define nd6_gctimer VS_ND6_DATA->_nd6_gctimer +#define _nd6_maxnudhint VS_ND6_DATA->_nd6_maxnudhint +#define _nd6_maxqueuelen VS_ND6_DATA->_nd6_maxqueuelen +#define _nd6_debug VS_ND6_DATA->_nd6_debug +#define _llinfo_nd6 VS_ND6_DATA->_llinfo_nd6 +#define _nd_defrouter VS_ND6_DATA->_nd_defrouter +#define _nd_prefix VS_ND6_DATA->_nd_prefix +#define nd6_recalc_reachtm_interval VS_ND6_DATA->_nd6_recalc_reachtm_interval +#define nd6_slowtimo_ch VS_ND6_DATA->_nd6_slowtimo_ch +#define nd6_timer_ch VS_ND6_DATA->_nd6_timer_ch + +#define nd6_defifp VS_ND6_DATA->_nd6_defifp +#define nd6_defifindex VS_ND6_DATA->_nd6_defifindex +#define ip6_use_tempaddr VS_ND6_DATA->_ip6_use_tempaddr +#define ip6_desync_factor VS_ND6_DATA->_ip6_desync_factor +#define ip6_temp_preferred_lifetime VS_ND6_DATA->_ip6_temp_preferred_lifetime +#define ip6_temp_valid_lifetime VS_ND6_DATA->_ip6_temp_valid_lifetime +#define ip6_temp_regen_advance VS_ND6_DATA->_ip6_temp_regen_advance + +#endif /* __INCvsNd6h */ diff --git a/h/wrn/coreip/vs/vsNdp.h b/h/wrn/coreip/vs/vsNdp.h new file mode 100644 index 0000000..07f76f3 --- /dev/null +++ b/h/wrn/coreip/vs/vsNdp.h @@ -0,0 +1,41 @@ +/* vsNdp.h - virtual stack data for Neighbor Discovery Protocol */ + +/* Copyright 2000 - 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05nov03,cdw Removal of unnecessary _KERNEL guards. +01b,04nov03,rlm Ran batch header path update for header re-org. +01a,20aug02,hgo created +*/ + +#ifndef __INCvsNdph +#define __INCvsNdph + +#include +#include + +/* typedefs */ + + /* Encapsulated (former) globals for NDP */ + +typedef struct vsNdp + { + /* defined in ndp.c */ + + int _priv_c1flag; + int _priv_n1flag; + int _priv_t1flag; + int _priv_sock; + int _priv_repeat; + struct sockaddr_in6 _priv_sin_m; + struct sockaddr_dl _priv_sdl_m; + int _priv_flags; + int _priv_found_entry; + + } VS_NDP; + +#define VS_NDP_DATA ((VS_NDP *)vsTbl[myStackNum]->pNdpGlobals) + +#endif /* __INCvsNdph */ diff --git a/h/wrn/coreip/vs/vsRarp.h b/h/wrn/coreip/vs/vsRarp.h new file mode 100644 index 0000000..a709576 --- /dev/null +++ b/h/wrn/coreip/vs/vsRarp.h @@ -0,0 +1,33 @@ +/* vsRarp.h - virtual stack data for RARP */ + +/* Copyright 2002 - Wind River Systems, Inc. */ +/* +modification history +-------------------- +01a,16jul02,vlk created +*/ + +#ifndef __INCvsRarph +#define __INCvsRarph + + +/* defines */ + +/* typedefs */ + +typedef struct vsRarp + { + /* definitions from rarpLib.c */ + SEM_ID priv_revarpInProgress; + RARPSTATE priv_rarpState; + } VS_RARP; + + +/* macros for "non-private" global variables */ + +#define VS_RARP_DATA ((VS_RARP *)vsTbl[myStackNum]->pRarpGlobals) + + + +#endif /* __INCvsRarph */ + diff --git a/h/wrn/coreip/vs/vsRaw.h b/h/wrn/coreip/vs/vsRaw.h new file mode 100644 index 0000000..18d624b --- /dev/null +++ b/h/wrn/coreip/vs/vsRaw.h @@ -0,0 +1,55 @@ +/* vsUdp.h - virtual stack data for RAW_CB */ + +/* + * Copyright (c) 2002-2005 Wind River Systems, Inc. + * + * The right to copy, distribute or otherwise make use of this software + * may be licensed only pursuant to the terms of an applicable Wind River + * license agreement. No license to Wind River intellectual property rights + * is granted herein. All rights not licensed by Wind River are reserved + * by Wind River. + */ + +/* +modification history +-------------------- +01e,25feb05,niq merge from niqbal.tor3.mroute for IP router alert changes +01d,05nov03,cdw Removal of unnecessary _KERNEL guards. +01c,04nov03,rlm Ran batch header path update for header re-org. +01b,28aug02,kal fixed header location for !_KERNEL +01a,01jul02,hgo creation +*/ + +#ifndef __INCvsRawh +#define __INCvsRawh + +/* + * Remaining globals: shared between stacks (not part of virtual structure). + * + * 1) raw_usrreqs + * + */ + +/* includes */ +#include + +/* typedefs */ + + /* Encapsulated (former) globals for UDP. */ + +typedef struct vsRaw + { + /* defined in raw_cb.c */ + + struct rawcb_list_head _rawcb_list; + u_long _priv_raw_sendspace; + u_long _priv_raw_recvspace; + } VS_RAW; + +/* macros for "non-private" global variables */ + +#define VS_RAW_DATA ((VS_RAW *)vsTbl[myStackNum]->pRawGlobals) + +#define rawcb_list VS_RAW_DATA->_rawcb_list + +#endif /* __INCvsRawh */ diff --git a/h/wrn/coreip/vs/vsRipng.h b/h/wrn/coreip/vs/vsRipng.h new file mode 100644 index 0000000..549022e --- /dev/null +++ b/h/wrn/coreip/vs/vsRipng.h @@ -0,0 +1,161 @@ +/* vsRipng.h - Virtual stack data for RIPng */ + +/* + * Copyright (c) 2003-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01h,20jun05,niq Kame merge +01g,25mar03,kal code review modications - copyright and file header +01f,10jan03,kal add split horizon and restricted neighbor variables +01e,11nov02,kal added ripng_exit_sock and ripng_exit_port +01d,18oct02,kal added support for triggered update timer +01c,09oct02,kal add ripngStopFlag +01b,05sep02,hgo own vsRipTbl +01a,09juk02,ger file creation: based on IPv4 implementation +*/ + +#ifndef __INCvsRipngh +#define __INCvsRipngh + + +/* defines */ + +typedef struct vsripng + { + /* definitions from route6d.c */ + struct ifc *ripng_ifc; + int ripng_nifc; /* number of valid ifc's */ + struct ifc **ripng_index2ifc; + int ripng_nindex2ifc; + struct ifc *ripng_loopifcp; /* pointing to loopback */ + fd_set *ripng_sockvecp; /* vector to select() for receiving */ + fd_set *ripng_recvecp; + int ripng_fdmasks; + int ripng_maxfd; /* maximum fd for select() */ + int ripng_rtsock; /* the routing socket */ + int ripng_ripsock; /* socket to send/receive RIP datagram */ + int ripng_exit_sock; /* socket used by ripngStop() */ + int ripng_exit_port; /* port used by ripngStop() */ + + struct rip6 *ripngbuf; /* packet buffer for sending */ + struct riprt *ripng_riprt ; + + int ripng_dflag ; /* debug flag */ + int ripng_qflag ; /* quiet flag */ + int ripng_nflag ; /* don't update kernel routing table */ + int ripng_aflag ; /* age out even the statically defined routes */ + int ripng_pflag ; /* disable poison reverse for new interfaces */ + int ripng_hflag ; /* disable split horizon for new interfaces */ + int ripng_lflag ; /* exchange site local routes */ + int ripng_sflag ; /* announce static routes w/ split horizon */ + int ripng_Sflag ; /* announce static routes to every interface */ + int ripng_rflag ; /* restricted neighor list */ + unsigned long routetag ; /* route tag attached on originating case */ + + char *ripng_filter[MAXARGS]; + int ripng_filtertype[MAXARGS]; + int ripng_nfilter ; + + char *ripng_ifhoriz[MAXARGS]; + int ripng_ifhoriztype[MAXARGS]; + int ripng_nifhoriz; + + struct nb_list *ripng_nb_list_root; + + pid_t ripng_pid; + + struct sockaddr_storage ripngsin; + + int ripng_need_trigger; + time_t ripng_nexttrigger; + time_t ripng_nextupdate; + + int priv_ripng_seq ; + +/* Semaphore / Watchdog / Task system */ + SEM_ID ripngTimerSem, + ripngMutexSem; + WDOG_ID ripngTimerDog; + WDOG_ID ripngTriggerDog; + BOOL ripngTimerSemInit, + ripngMutexSemInit, + ripngTimerDogInit, + ripngTriggerDogInit; + int ripngDogTask, + ripngTask; + int priv_ripng_nrt; + struct netinfo6 *priv_ripng_np; + + BOOL ripngStopFlag; + + } VS_RIPNG; + +extern VS_RIPNG *vsRipngTbl[]; + +/* macros */ + +#define VS_RIPNG_DATA (vsRipngTbl[myStackNum]) + +#define ripng_ifc VS_RIPNG_DATA->ripng_ifc +#define ripng_nifc VS_RIPNG_DATA->ripng_nifc +#define ripng_index2ifc VS_RIPNG_DATA->ripng_index2ifc +#define ripng_nindex2ifc VS_RIPNG_DATA->ripng_nindex2ifc +#define ripng_loopifcp VS_RIPNG_DATA->ripng_loopifcp +#define ripng_ifc VS_RIPNG_DATA->ripng_ifc +#define ripng_sockvecp VS_RIPNG_DATA->ripng_sockvecp +#define ripng_recvecp VS_RIPNG_DATA->ripng_recvecp +#define ripng_fdmasks VS_RIPNG_DATA->ripng_fdmasks +#define ripng_maxfd VS_RIPNG_DATA->ripng_maxfd +#define ripng_rtsock VS_RIPNG_DATA->ripng_rtsock +#define ripng_ripsock VS_RIPNG_DATA->ripng_ripsock +#define ripng_exit_sock VS_RIPNG_DATA->ripng_exit_sock +#define ripng_exit_port VS_RIPNG_DATA->ripng_exit_port +#define ripngbuf VS_RIPNG_DATA->ripngbuf +#define ripng_riprt VS_RIPNG_DATA->ripng_riprt +#define ripng_dflag VS_RIPNG_DATA->ripng_dflag +#define ripng_qflag VS_RIPNG_DATA->ripng_qflag +#define ripng_nflag VS_RIPNG_DATA->ripng_nflag +#define ripng_aflag VS_RIPNG_DATA->ripng_aflag +#define ripng_pflag VS_RIPNG_DATA->ripng_pflag +#define ripng_hflag VS_RIPNG_DATA->ripng_hflag +#define ripng_lflag VS_RIPNG_DATA->ripng_lflag +#define ripng_sflag VS_RIPNG_DATA->ripng_sflag +#define ripng_Sflag VS_RIPNG_DATA->ripng_Sflag +#define ripng_rflag VS_RIPNG_DATA->ripng_rflag +#define routetag VS_RIPNG_DATA->routetag +#define ripng_filter VS_RIPNG_DATA->ripng_filter +#define ripng_filtertype VS_RIPNG_DATA->ripng_filtertype +#define ripng_nfilter VS_RIPNG_DATA->ripng_nfilter +#define ripng_ifhoriz VS_RIPNG_DATA->ripng_ifhoriz +#define ripng_ifhoriztype VS_RIPNG_DATA->ripng_ifhoriztype +#define ripng_nifhoriz VS_RIPNG_DATA->ripng_nifhoriz +#define ripng_nb_list_root VS_RIPNG_DATA->ripng_nb_list_root +#define ripng_pid VS_RIPNG_DATA->ripng_pid +#define ripngsin VS_RIPNG_DATA->ripngsin +#define ripng_need_trigger VS_RIPNG_DATA->ripng_need_trigger +#define ripng_nexttrigger VS_RIPNG_DATA->ripng_nexttrigger +#define ripng_nextupdate VS_RIPNG_DATA->ripng_nextupdate +#define ripng_seq VS_RIPNG_DATA->ripng_seq +#define ripngTimerSem VS_RIPNG_DATA->ripngTimerSem +#define ripngMutexSem VS_RIPNG_DATA->ripngMutexSem +#define ripngTimerDog VS_RIPNG_DATA->ripngTimerDog +#define ripngTriggerDog VS_RIPNG_DATA->ripngTriggerDog +#define ripngTimerSemInit VS_RIPNG_DATA->ripngTimerSemInit +#define ripngMutexSemInit VS_RIPNG_DATA->ripngMutexSemInit +#define ripngTimerDogInit VS_RIPNG_DATA->ripngTimerDogInit +#define ripngTriggerDogInit VS_RIPNG_DATA->ripngTriggerDogInit +#define ripngStopFlag VS_RIPNG_DATA->ripngStopFlag +#define ripngDogTask VS_RIPNG_DATA->ripngDogTask +#define ripngTask VS_RIPNG_DATA->ripngTask + + + +#endif /* __INCvsripngh */ + diff --git a/h/wrn/coreip/vs/vsRtadv.h b/h/wrn/coreip/vs/vsRtadv.h new file mode 100644 index 0000000..32b195a --- /dev/null +++ b/h/wrn/coreip/vs/vsRtadv.h @@ -0,0 +1,100 @@ +/* vsRtadv.h - virtual stack data for Router Advertisement */ + +/* + * Copyright (c) 2000-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01i,14jul05,niq added the rtadv_forwarding variable +01h,07oct04,vvv added rtadvSem (SPR #98895) +01g,11nov03,cdw Removal of unnecessary _KERNEL guards. +01f,10nov03,rlm 2nd pass of include update for header re-org. +01e,05nov03,cdw Removal of unnecessary _KERNEL guards. +01d,04nov03,rlm Ran batch header path update for header re-org. +01c,25nov02,ism moved rtadv global data to its own array + define new global data for normal shutdown socket +01b,06sep02,hgo removed #ifdef from VS_RTADV +01a,02sep02,hgo created +*/ + +#ifndef __INCvsRtadvh +#define __INCvsRtadvh + +#include +#include +#include +#include +#include +#include + +/* typedefs */ + + /* Encapsulated (former) globals for Rtadv */ + +typedef struct vsRtadv + { + /* defined in advcap.c */ + + char *_priv_tbuf; + int _priv_hopcount; /* detect infinite loops in termcap. init 0 */ + + /* defined in if_rtadv.c */ + + struct if_msghdr **_iflist; + size_t _priv_ifblock_size; + char *_priv_ifblock; + + /* defined in rtadv.c */ + + struct msghdr _priv_rcvmhdr; + u_char *_priv_rcvcmsgbuf; + size_t _priv_rcvcmsgbuflen; + u_char *_priv_sndcmsgbuf; + size_t _priv_sndcmsgbuflen; + int _rtadv_exit_flag; + struct msghdr _priv_sndmhdr; + struct iovec _priv_rcviov[2]; + struct iovec _priv_sndiov[2]; + struct sockaddr_in6 _priv_from; + struct sockaddr_in6 _priv_sin6_allnodes; + int _priv_sock; + int _priv_rtsock; + int _priv_exit_sock; + int _priv_exit_port; + int _rtadv_mobileip6; + int _priv_accept_rr; + int _priv_dflag_rtadv; + int _priv_sflag_rtadv; + struct rainfo *_ralist; + SEM_ID _rtadvSem; + u_char *_priv_answer; + int _rtadv_forwarding; + + /* defined in timer.c */ + + struct rtadvd_timer _priv_timer_head; + struct timeval _priv_returnval_check; + struct timeval _priv_returnval_rest; + + } VS_RTADV; + +IMPORT VS_RTADV* rtadvGlobalTbl[]; + +/* macros for "non-private" global variables */ + +#define VS_RTADV_DATA ((VS_RTADV *)rtadvGlobalTbl[myStackNum]) + +#define iflist VS_RTADV_DATA->_iflist +#define rtadv_exit_flag VS_RTADV_DATA->_rtadv_exit_flag +#define rtadv_mobileip6 VS_RTADV_DATA->_rtadv_mobileip6 +#define ralist VS_RTADV_DATA->_ralist +#define rtadvSem VS_RTADV_DATA->_rtadvSem +#define rtadv_forwarding VS_RTADV_DATA->_rtadv_forwarding + +#endif /* __INCvsRtadvh */ diff --git a/h/wrn/coreip/vs/vsSoSup.h b/h/wrn/coreip/vs/vsSoSup.h new file mode 100644 index 0000000..0764721 --- /dev/null +++ b/h/wrn/coreip/vs/vsSoSup.h @@ -0,0 +1,75 @@ +/* vsSoSup.h - virtual stack support for sockets */ + +/* Copyright 2000 - 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,21jul04,spm enabled socket operations from different virtual stacks +01b,15nov02,wie prototype for vsSoDelete changed +01a,29jul02,wie file creation + +*/ + +#ifndef __INCvsSoSuph +#define __INCvsSoSuph + + +#ifdef VIRTUAL_STACK + + +/* + * Prevent socket calls after a virtual stack is disabled, + * deleted, or replaced. Also prevent calls from a different + * virtual stack context if the socket is setup to reject them. + */ + +#define VS_SOCKET_CHECK(pSocket) \ + { \ + if (pSocket->vsid & VSNUM_INVALID_MASK) \ + { \ + errnoSet (ENOTSUP); \ + return (ERROR); \ + } \ + if ( (pSocket->vsid & VSNUMMASK) != myStackNum && \ + (pSocket->so_options & SO_VSLOCK)) \ + { \ + errnoSet (ENOTSUP); \ + return (ERROR); \ + } \ + } + +#define VS_STACK_CHECK(pSocket) \ + { \ + if (pSocket->vsid & VSNUM_INVALID_MASK) \ + { \ + if (vsErrAnalyse (pSocket) != VS_OK) \ + return (ERROR); \ + } \ + } + +VS_STATUS vsErrAnalyse + ( + struct socket *so + ); + + +VS_STATUS vsSoCreate + ( + void *so_l + ); + +VS_STATUS vsSoDelete + ( + VSID vsid, + int vsCookie + ); + + +#ifdef __cplusplus +} +#endif + +#endif /* VIRTUAL_STACK */ + +#endif /* __INCvsSoSuph */ diff --git a/h/wrn/coreip/vs/vsSysctl.h b/h/wrn/coreip/vs/vsSysctl.h new file mode 100644 index 0000000..8ebcd0f --- /dev/null +++ b/h/wrn/coreip/vs/vsSysctl.h @@ -0,0 +1,170 @@ +/* vsSysctl.h - virtual stack data for IP */ + +/* + * Copyright (c) 2002-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01j,20jul05,vvv added sctp_node macros +01i,20jul05,kch added sctp_node and sctp6_node. +01h,20may05,kch Added mip6_node for mobility support. +01g,29apr05,kch Added pim6_node and addrctlpolicy_node. +01f,31jan05,niq virtual stack changes for sysctl +01e,10nov03,rlm 2nd pass of include update for header re-org. +01d,05nov03,cdw Removal of unnecessary _KERNEL guards. +01c,04nov03,rlm Ran batch header path update for header re-org. +01b,05sep02,kal fixed capitalisation of pSysctlCtxList +01a,09juk02,ger file creation: +*/ + +#ifndef __INCvsSysctlh +#define __INCvsSysctlh + + +/* includes */ + +#include "vxWorks.h" +/*#include +#include +#include +#include */ +#include +#include + +/* defines */ + +/* typedefs */ + +typedef struct vsSysctl + { + /* definitions for networking sysctl variables */ + struct sysctl_ctx_list netSysctlCtxList; + struct sysctl_ctx_list * pNetSysctlCtxList; + struct sysctl_oid_list * net_node_children; + + /* definitions from various networking files */ + + struct sysctl_oid * net_node; + struct sysctl_oid * inet_node; + struct sysctl_oid * ip_node; + struct sysctl_oid * tcp_node; + struct sysctl_oid * syncache_node; + struct sysctl_oid * udp_node; + struct sysctl_oid * portrange_node; + struct sysctl_oid * icmp_node; + struct sysctl_oid * raw_node; + struct sysctl_oid * routetable_node; + struct sysctl_oid * ether_inet_node; + struct sysctl_oid * igmp_node; + struct sysctl_oid * nameinfo_node; + struct sysctl_oid * hostlib_node; + struct sysctl_oid * inetlib_node; + struct sysctl_oid * link_node; + struct sysctl_oid * generic_node; + struct sysctl_oid * system_node; + struct sysctl_oid * ifdata_node; + struct sysctl_oid * ether_node; + struct sysctl_oid * addrctlpolicy_node; + +#ifdef PIM + struct sysctl_oid * pim_node; +#endif /* PIM */ + +#ifdef SCTP + struct sysctl_oid * sctp_node; +#endif /* SCTP */ + +#ifdef INET6 + struct sysctl_oid * inet6_node; + struct sysctl_oid * ip6_node; + struct sysctl_oid * icmp6_node; + struct sysctl_oid * nd6_drlist_node; + struct sysctl_oid * tcp6_node; + struct sysctl_oid * nd6_prlist_node; + struct sysctl_oid * udp6_node; + +#ifdef WRS_PIM6 + struct sysctl_oid * pim6_node; +#endif /* WRS_PIM6 */ + +#ifdef SCTP + struct sysctl_oid * sctp6_node; +#endif /* SCTP */ + +#ifdef MIP6 + struct sysctl_oid * mip6_node; +#endif /* MIP6 */ + +#endif /* INET6 */ + } VS_SYSCTL; + +/* macros */ + +#define VS_SYSCTL_DATA ((VS_SYSCTL *)vsTbl[myStackNum]->pSysctlGlobals) + + +#define netSysctlCtxList VS_SYSCTL_DATA->netSysctlCtxList +#define pNetSysctlCtxList VS_SYSCTL_DATA->pNetSysctlCtxList +#define net_node_children VS_SYSCTL_DATA->net_node_children + +#define net_node VS_SYSCTL_DATA->net_node +#define inet_node VS_SYSCTL_DATA->inet_node +#define ip_node VS_SYSCTL_DATA->ip_node +#define tcp_node VS_SYSCTL_DATA->tcp_node +#define syncache_node VS_SYSCTL_DATA->syncache_node +#define udp_node VS_SYSCTL_DATA->udp_node +#define portrange_node VS_SYSCTL_DATA->portrange_node +#define icmp_node VS_SYSCTL_DATA->icmp_node +#define raw_node VS_SYSCTL_DATA->raw_node +#define routetable_node VS_SYSCTL_DATA->routetable_node +#define ether_inet_node VS_SYSCTL_DATA->ether_inet_node +#define igmp_node VS_SYSCTL_DATA->igmp_node +#define nameinfo_node VS_SYSCTL_DATA->nameinfo_node +#define hostlib_node VS_SYSCTL_DATA->hostlib_node +#define inetlib_node VS_SYSCTL_DATA->inetlib_node +#define link_node VS_SYSCTL_DATA->link_node +#define generic_node VS_SYSCTL_DATA->generic_node +#define system_node VS_SYSCTL_DATA->system_node +#define ifdata_node VS_SYSCTL_DATA->ifdata_node +#define ether_node VS_SYSCTL_DATA->ether_node +#define addrctlpolicy_node VS_SYSCTL_DATA->addrctlpolicy_node + +#ifdef PIM +#define pim_node VS_SYSCTL_DATA->pim_node +#endif /* PIM */ + +#ifdef SCTP +#define sctp_node VS_SYSCTL_DATA->sctp_node +#endif + +#ifdef INET6 +#define inet6_node VS_SYSCTL_DATA->inet6_node +#define ip6_node VS_SYSCTL_DATA->ip6_node +#define icmp6_node VS_SYSCTL_DATA->icmp6_node +#define tcp6_node VS_SYSCTL_DATA->tcp6_node +#define udp6_node VS_SYSCTL_DATA->udp6_node +#define nd6_drlist_node VS_SYSCTL_DATA->nd6_drlist_node +#define nd6_prlist_node VS_SYSCTL_DATA->nd6_prlist_node + +#ifdef WRS_PIM6 +#define pim6_node VS_SYSCTL_DATA->pim6_node +#endif /* WRS_PIM6 */ + +#ifdef SCTP +#define sctp6_node VS_SYSCTL_DATA->sctp6_node +#endif + +#ifdef MIP6 +#define mip6_node VS_SYSCTL_DATA->mip6_node +#endif /* MIP6 */ + +#endif /* INET6 */ + +#endif /* __INCvsSysctlh */ + diff --git a/h/wrn/coreip/vs/vsTunnelLib.h b/h/wrn/coreip/vs/vsTunnelLib.h new file mode 100644 index 0000000..a1ed6f2 --- /dev/null +++ b/h/wrn/coreip/vs/vsTunnelLib.h @@ -0,0 +1,53 @@ +/* vsTunnelLib.h - virtual stack data for tunnelLib */ + +/* Copyright 2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,30oct02,kal added virtualised MTU Refresh timeout +01a,02aug02,kal created +*/ + +#ifndef __INCvsTunnelLibh +#define __INCvsTunnelLibh + + +/* includes */ + +/* defines */ + +typedef struct vstunnellib + { + SEM_ID tunnelLibSem; + LIST tunnelIfList; + int mtuRefreshTimeout; + + AVL_TREE autoList4Root; + AVL_TREE autoList6Root; + AVL_TREE configList4Root; + AVL_TREE configList6Root; + AVL_TREE * pAutoList4Root; + AVL_TREE * pAutoList6Root; + AVL_TREE * pConfigList4Root; + AVL_TREE * pConfigList6Root; + } VS_TUNNELLIB; + +/* macros */ + +#define VS_TUNNELLIB_DATA ((VS_TUNNELLIB *)(vsTunnelLibTbl[myStackNum])) + +#define tunnelLibSem VS_TUNNELLIB_DATA->tunnelLibSem +#define tunnelIfList VS_TUNNELLIB_DATA->tunnelIfList +#define mtuRefreshTimeout VS_TUNNELLIB_DATA->mtuRefreshTimeout +#define autoList4Root VS_TUNNELLIB_DATA->autoList4Root +#define autoList6Root VS_TUNNELLIB_DATA->autoList6Root +#define configList4Root VS_TUNNELLIB_DATA->configList4Root +#define configList6Root VS_TUNNELLIB_DATA->configList6Root +#define pAutoList4Root VS_TUNNELLIB_DATA->pAutoList4Root +#define pAutoList6Root VS_TUNNELLIB_DATA->pAutoList6Root +#define pConfigList4Root VS_TUNNELLIB_DATA->pConfigList4Root +#define pConfigList6Root VS_TUNNELLIB_DATA->pConfigList6Root + +#endif /* __INCvsTunnelLibh */ + diff --git a/h/wrn/coreip/wvNetDLib.h b/h/wrn/coreip/wvNetDLib.h new file mode 100644 index 0000000..3cdb615 --- /dev/null +++ b/h/wrn/coreip/wvNetDLib.h @@ -0,0 +1,375 @@ +/* wvNetDLib.h - header file for WindView WindNet IPv6/IPv4 Dual stack events */ + +/* Copyright 2003-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01k,20jan05,sar Removal of divert, dummynet and fw code. +01j,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE +01i,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver + /main/vdt/base6_itn5_networking-int/2) +01h,25feb04,syy Change wvNetDConfigure() return value to int +01g,23jan04,syy Reduce the event ID span +01f,08jan04,syy Move the index of files to become "0" based. +01e,15dec03,syy Added some more def's for INFO subtype. +01d,08dec03,syy Networking WindView instrumentation merge +01c,10nov03,rlm 2nd pass of include update for header re-org. +01b,04sep03,tar windview instrumentation codereview changes +01a,06aug03,tar written +*/ + +#ifndef __INCwvNetDLibh +#define __INCwvNetDLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "private/eventP.h" /* Macros for testing WindView status. */ +#include /* Macros to generate networking events. */ + +typedef struct eventmask + { + UCHAR bitmap [8]; /* Map indicating selection status of events. */ + } +EVENT_MASK; + +IMPORT UCHAR wvNetDLevel; +IMPORT UCHAR wvNetDFilterId; +IMPORT EVENT_MASK * pWvNetEventMap; + +#define WV_NET_DUAL_ID 0x2 /* + * Arbitrary 2-bit prefix for + * WindNet IPv6/IPv4 Dual stack events. + */ + +/* + * Class definitions + */ + +#define WV_NETD_IP4_DATAPATH_CLASS 0x00000008 /* IPv4 Data Path Events */ +#define WV_NETD_IP6_DATAPATH_CLASS 0x00000010 /* IPv6 Data Path Events */ +#define WV_NETD_IP4_CTRLPATH_CLASS 0x00000018 /* IPv4 Control Path Events */ +#define WV_NETD_IP6_CTRLPATH_CLASS 0x00000020 /* IPv6 Control Path Events */ + +#define NETD_IP4_DATAPATH_EVENT WV_NETD_IP4_DATAPATH_CLASS +#define NETD_IP6_DATAPATH_EVENT WV_NETD_IP6_DATAPATH_CLASS +#define NETD_IP4_CTRLPATH_EVENT WV_NETD_IP4_CTRLPATH_CLASS +#define NETD_IP6_CTRLPATH_EVENT WV_NETD_IP6_CTRLPATH_CLASS + +/* + * The WV_NETD_ADDR_FILTER_TEST and WV_NETD_PORT_FILTER_TEST macros will check + * the given data against predefined address or port numbers by calling the + * appropriate routine. Each macro is only valid within a test conditional. + */ + +#define WV_NETD_ADDR_FILTER_TEST(filterType,targetType,srcAddr,dstAddr) \ + wvNetDAddressFilterTest (filterType, targetType, srcAddr, dstAddr) + +#define WV_NETD_PORT_FILTER_TEST(filterType, srcPort, dstPort) \ + wvNetDPortFilterTest (filterType, srcPort, dstPort) + +#define WV_NETD_NONE 0 /* Placeholder for any unused event fields. */ + +/* + * 4-bit level identifiers for event priority. The user can block + * all event reporting even if WindView is active and a network class + * is set by specifying the WV_NETD_NONE constant in a call to the + * wvNetDConfigure() routine. That "priority" is not used by any events. + */ + +#define WV_NETD_FATAL 1 +#define WV_NETD_CRITICAL 2 +#define WV_NETD_WARNING 3 +#define WV_NETD_INFO 4 +#define WV_NETD_VERBOSE 5 + + +/* + * Data transfer status. Represented by a 2-bit field in wvNetDEventInfo. + * WV_NETD_NONE is used if not applicable. + */ + +#define WV_NETD_SEND 1 +#define WV_NETD_RECV 2 + +/* + * Packet filter for event. Represented by a 4-bit field in wvNetDEventInfo. + * WV_NETD_NONE is used if unfiltered. + */ + +#define WV_NETD_SADDR_FILTER 1 /* Source address comparison */ +#define WV_NETD_DADDR_FILTER 2 /* Destination address comparison */ +#define WV_NETD_SPORT_FILTER 3 /* Source port comparison */ +#define WV_NETD_DPORT_FILTER 4 /* Destination port comparison */ +#define WV_NETD_SOCK_FILTER 5 /* Socket value comparison */ + +/* Entity. Represented by an 8-bit field in wvNetDEventInfo. */ + +#define WV_NETD_ARP 1 +#define WV_NETD_ICMP4 2 +#define WV_NETD_ICMP6 3 +#define WV_NETD_IP4 4 +#define WV_NETD_IP6 5 +#define WV_NETD_RAWIP 6 +#define WV_NETD_ROUTE 7 +#define WV_NETD_TCP4 8 +#define WV_NETD_TCP6 9 +#define WV_NETD_UDP4 10 +#define WV_NETD_UDP6 11 +#define WV_NETD_IF 12 +#define WV_NETD_SOCKET 13 +#define WV_NETD_IGMP 14 +#define WV_NETD_NETBUF 15 +#define WV_NETD_MEMBUF 16 +#define WV_NETD_PACKET 17 +#define WV_NETD_RAW_SOCKET 18 +#define WV_NETD_IP_REASSEMBLE 19 +#define WV_NETD_TCP_REASSMBLE 20 +#define WV_NETD_DLINK 21 +#define WV_NETD_ND 22 + +/* Module identifiers. Represented by an 8-bit field in wvNetDEventInfo. */ +/* We no longer include the divert, dummynet, ip_fw or ip6_fw modules but have + * retained these tags for consistency. + */ + +#define WV_NETD_UNKNOWN 0 /* Unknown (default) */ + +#define WV_NETD_IF_MODULE 1 /* if.c source file */ +#define WV_NETD_IF_ETHERSUBR_MODULE 2 /* if_ethersubr.c source file */ +#define WV_NETD_IF_FAITH_MODULE 3 /* if_faith.c source file */ +#define WV_NETD_IF_LOOP_MODULE 4 /* if_loop.c source file */ +#define WV_NETD_IF_MEDIA_MODULE 5 /* if_media.c source file */ + +#define WV_NETD_IP_ICMP_MODULE 6 /* ip_icmp.c source file */ + +#define WV_NETD_ICMP6_MODULE 7 /* icmp6.c source file */ + +#define WV_NETD_IN_MODULE 8 /* in.c source file */ +#define WV_NETD_IN_PCB_MODULE 9 /* in_pcb.c source file */ +#define WV_NETD_IN_RMX_MODULE 10 /* in_rmx.c source file */ +#define WV_NETD_IP_DIVERT_MODULE 11 /* ip_divert.c source file */ +#define WV_NETD_IP_DUMMYNET_MODULE 12 /* ip_dummynet.c source file */ +#define WV_NETD_IP_ECN_MODULE 13 /* ip_ecn.c source file */ +#define WV_NETD_IP_FW_MODULE 14 /* ip_fw.c source file */ +#define WV_NETD_IP_INPUT_MODULE 15 /* ip_input.c source file */ +#define WV_NETD_IP_OUTPUT_MODULE 16 /* ip_output.c source file */ +#define WV_NETD_RAW_IP_MODULE 17 /* raw_ip.c source file */ +#define WV_NETD_UIPC_DOMAIN_MODULE 18 /* uipc_domain.c source file */ + +#define WV_NETD_IP6_INPUT_MODULE 19 /* ip6_input.c source file */ +#define WV_NETD_RAW_IP6_MODULE 20 /* raw_ip6.c source file */ +#define WV_NETD_ROUTE6_MODULE 21 /* route6.c source file */ +#define WV_NETD_DEST6_MODULE 22 /* dest6.c source file */ +#define WV_NETD_FRAG6_MODULE 23 /* frag6.c source file */ +#define WV_NETD_IN6_MODULE 24 /* in6.c source file */ +#define WV_NETD_IN6_CKSUM_MODULE 25 /* in6_cksum.c source file */ +#define WV_NETD_IN6_IFATTACH_MODULE 26 /* in6_ifattach.c source file */ +#define WV_NETD_IN6_PCB_MODULE 27 /* in6_pcb.c source file */ +#define WV_NETD_IN6_PREFIX_MODULE 28 /* in6_prefix.c source file */ +#define WV_NETD_IN6_RMX_MODULE 29 /* in6_rmx.c source file */ +#define WV_NETD_IN6_SRC_MODULE 30 /* in6_src.c source file */ +#define WV_NETD_IP6_FORWARD_MODULE 31 /* ip6_forward.c source file */ +#define WV_NETD_IP6_FW_MODULE 32 /* ip6_fw.c source file */ +#define WV_NETD_IP6_OUTPUT_MODULE 33 /* ip6_output.c source file */ +#define WV_NETD_SCOPE6_MODULE 34 /* scope6.c source file */ +#define WV_NETD_RTHDR_MODULE 35 /* rthdr.c source file */ +#define WV_NETD_IP6OPT_MODULE 36 /* ip6opt.c source file */ + +#define WV_NETD_ND6_MODULE 37 /* nd6.c source file */ +#define WV_NETD_ND6_NBR_MODULE 38 /* nd6_nbr.c source file */ + +#define WV_NETD_UDP_USRREQ_MODULE 39 /* udp_usrreq.c source file */ + +#define WV_NETD_UDP6_OUTPUT_MODULE 40 /* udp6_output.c source file */ +#define WV_NETD_UDP6_USRREQ_MODULE 41 /* udp6_usrreq.c source file */ + +#define WV_NETD_TCP_INPUT_MODULE 42 /* tcp_input.c source file */ +#define WV_NETD_TCP_OUTPUT_MODULE 43 /* tcp_output.c source file */ +#define WV_NETD_TCP_SUBR_MODULE 44 /* tcp_subr.c source file */ +#define WV_NETD_TCP_TIMER_MODULE 45 /* tcp_timer.c source file */ +#define WV_NETD_TCP_USRREQ_MODULE 46 /* tcp_usrreq.c source file */ + +#define WV_NETD_RAW_CB_MODULE 47 /* raw_cb.c source file */ +#define WV_NETD_RAW_USRREQ_MODULE 48 /* raw_usrreq.c source file */ + +#define WV_NETD_IF_ETHER_MODULE 49 /* if_ether.c source file */ + +#define WV_NETD_IGMP_MODULE 50 /* igmp.c source file */ + +#define WV_NETD_IP_MROUTE_MODULE 51 /* ip_mroute.c source file */ + +#define WV_NETD_IP6_MROUTE_MODULE 52 /* ip6_mroute.c source file */ + +#define WV_NETD_RADIX_MODULE 53 /* radix.c source file */ +#define WV_NETD_ROUTE_MODULE 54 /* route.c source file */ +#define WV_NETD_RTSOCK_MODULE 55 /* rtsock.c source file */ +#define WV_NETD_IPROUTELIB_MODULE 56 /* ipRouteLib.c source file */ + +#define WV_NETD_IF_SUBR_MODULE 57 /* if_subr.c source file */ + +#define WV_NETD_UNIXLIB_MODULE 58 /* unixLib.c source file */ + +#define WV_NETD_SYS_SOCKET_MODULE 59 /* sys_socket.c source file */ +#define WV_NETD_UIPC_SOCKET_MODULE 60 /* uipc_socket.c source file */ +#define WV_NETD_UIPC_SOCKET2_MODULE 61 /* uipc_socket2.c source file */ + +#define WV_NETD_BPFDRV_MODULE 62 /* bpfDrv.c source file */ +#define WV_NETD_IF_ETHERPMP_MODULE 63 /* if_etherpmp.c source file */ +#define WV_NETD_DSI_MODULE 64 /* dsiSockLib.c source file */ +#define WV_NETD_UNCOMP_USRREQ_MODULE 65 /* uncomp_usrreq.c source file */ + +/* Qualifier. Represented by an Intereger type in event log API. */ + +#define WV_NETD_BADLEN 1 +#define WV_NETD_BADSUM 2 +#define WV_NETD_BADADDR 3 +#define WV_NETD_BADSOCK 4 +#define WV_NETD_BADSIZE 5 +#define WV_NETD_BADHLEN 6 +#define WV_NETD_BADWIDTH 7 +#define WV_NETD_BADOPT 8 +#define WV_NETD_BADVERS 9 +#define WV_NETD_BADMBLK 10 +#define WV_NETD_BADLEVEL 11 +#define WV_NETD_BADROUTE 12 +#define WV_NETD_BADREFCNT 13 +#define WV_NETD_BADSYNC 14 +#define WV_NETD_NOROUTEKEY 15 +#define WV_NETD_NOROUTE 16 +#define WV_NETD_NOPCB 17 +#define WV_NETD_NOPROTO 18 +#define WV_NETD_SHORTMSG 19 +#define WV_NETD_BADFLAGS 20 +#define WV_NETD_NOMEM 21 +#define WV_NETD_NOSOCK 22 +#define WV_NETD_BADBUF 23 +#define WV_NETD_SEMTKFAILED 24 +#define WV_NETD_NOFDREF 25 +#define WV_NETD_BADGATEWAY 26 +#define WV_NETD_UNREACH 27 +#define WV_NETD_BADTYPE 28 +#define WV_NETD_BADRULE 29 +#define WV_NETD_SHORTBUF 30 +#define WV_NETD_NOHDR 31 +#define WV_NETD_INVALIDPARENT 32 +#define WV_NETD_NOUSRREQS 33 +#define WV_NETD_BADARG 34 +#define WV_NETD_OUTOFDATA 35 +#define WV_NETD_BADCHAIN 36 +#define WV_NETD_INVAL 37 +#define WV_NETD_RETRANSMITPENDING 38 +#define WV_NETD_NOGATEWAY 39 +#define WV_NETD_NOBUFS 40 +#define WV_NETD_BADOFFSET 41 +#define WV_NETD_AFNOSUPPORT 42 +#define WV_NETD_ADDRNOTAVAIL 43 +#define WV_NETD_ADDRINUSE 44 +#define WV_NETD_NXIO 45 +#define WV_NETD_OPNOTSUPP 46 +#define WV_NETD_NETDOWN 47 +#define WV_NETD_HOSTUNREACH 48 +#define WV_NETD_NETUNREACH 49 +#define WV_NETD_ACCES 50 +#define WV_NETD_MSGSIZE 51 +#define WV_NETD_NOPROTOOPT 52 +#define WV_NETD_PKTLOST 53 +#define WV_NETD_NOPORT 54 +#define WV_NETD_FULLSOCK 55 +#define WV_NETD_RTCLONE 56 +#define WV_NETD_RTSEARCHGOOD 57 +#define WV_NETD_SEARCHFAILED 58 +#define WV_NETD_BADQUERY 59 +#define WV_NETD_BADREPORT 60 +#define WV_NETD_DUPLICATED 61 +#define WV_NETD_OPSFAILED 62 +#define WV_NETD_LOCKFAILED 63 +#define WV_NETD_UNLOCKFAILED 64 +#define WV_NETD_BADMASK 65 +#define WV_NETD_ADDFAILED 66 + +/* Info event subtypes. Represented by an Intereger type in event log API. */ +#define WV_NETD_INFO_UP 1 +#define WV_NETD_INFO_DOWN 2 +#define WV_NETD_INFO_OPEN 3 +#define WV_NETD_INFO_CLOSE 4 +#define WV_NETD_INFO_SEND 5 +#define WV_NETD_INFO_RECEIVE 6 +#define WV_NETD_INFO_ALLOC 7 +#define WV_NETD_INFO_FREE 8 +#define WV_NETD_INFO_CONNECT 9 +#define WV_NETD_INFO_DISCONNECT 10 +#define WV_NETD_INFO_CREATE 11 +#define WV_NETD_INFO_DELETE 12 +#define WV_NETD_INFO_DROPPED 13 +#define WV_NETD_INFO_RETRANSMIT 14 +#define WV_NETD_INFO_TIMEOUT 15 +#define WV_NETD_INFO_EXPIRED 16 +#define WV_NETD_INFO_UPDATED 17 +#define WV_NETD_INFO_QUEUE_FULL 18 +#define WV_NETD_INFO_PKT_SEND 19 +#define WV_NETD_INFO_PKT_RECV 20 +#define WV_NETD_INFO_RESET 21 +#define WV_NETD_INFO_WAIT 22 +#define WV_NETD_INFO_NODEADD 23 +#define WV_NETD_INFO_RTADDED 24 +#define WV_NETD_INFO_RTCLONE 25 +#define WV_NETD_INFO_RTALLOC 26 + +#define WV_NETD_INFO_CUSTOM_1 27 +#define WV_NETD_INFO_CUSTOM_2 28 +#define WV_NETD_INFO_CUSTOM_3 29 +#define WV_NETD_INFO_CUSTOM_4 30 +#define WV_NETD_INFO_CUSTOM_5 31 +#define WV_NETD_INFO_CUSTOM_6 32 + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void wvNetDInit (void); +extern int wvNetDConfigure (int, int, int); + +#else /* __STDC__ */ + +extern void wvNetDInit (); +extern int wvNetDConfigure (int, int, int); + +#endif /* __STDC__ */ + +/* + * Individual Events. All events contain the integer parameter + * wvNetDEventId as their first argument. Additional parameters, + * if any, are listed with each event. + */ + +/* Fatal Events */ + +#define WV_NETDEVENT_FATAL 20400 + +/* Critical Events */ + +#define WV_NETDEVENT_CRITICAL 20415 + +/* Warning Events */ + +#define WV_NETDEVENT_WARNING 20430 + +/* Information Events */ + +#define WV_NETDEVENT_INFO 20445 + +/* Verbose Events */ + +#define WV_NETDEVENT_START 20460 +#define WV_NETDEVENT_FINISH 20475 + + +/* end of VxWorks WindNet IPv6/IPv4 Dual Stack events */ + +#ifdef __cplusplus +} +#endif +#endif /* __INCwvNetDLibh */ diff --git a/h/wrn/coreip/xdr_mnt1.h b/h/wrn/coreip/xdr_mnt1.h new file mode 100644 index 0000000..9833642 --- /dev/null +++ b/h/wrn/coreip/xdr_mnt1.h @@ -0,0 +1,73 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _XDR_MNT1_H_RPCGEN +#define _XDR_MNT1_H_RPCGEN + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include "xdr_mnt_common.h" +#define FHSIZE 32 + +typedef char fhandle[FHSIZE]; + +struct fhstatus { + u_int fhs_status; + union { + fhandle fhs_fhandle; + } fhstatus_u; +}; +typedef struct fhstatus fhstatus; + +#define MOUNT_V1 1 + +/* + * MOUNT V1 procedure prototype declaration. The definitions of + * procedure numbers are available in xdr_mnt_common.h file + */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void * mountproc_null_1(void); +extern fhstatus * mountproc_mnt_1(dirpath *, struct svc_req *); +extern mountlist * mountproc_dump_1(void); +extern void * mountproc_umnt_1 (dirpath *, struct svc_req *); +extern void * mountproc_umntall_1(char *, struct svc_req *); +extern exports * mountproc_export_1(void); +extern int mountprog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* __STDC__ */ + +extern void * mountproc_null_1(); +extern fhstatus * mountproc_mnt_1(); +extern mountlist * mountproc_dump_1(); +extern void * mountproc_umnt_1(); +extern void * mountproc_umntall_1(); +extern exports * mountproc_export_1(); +extern int mountprog_1_freeresult(); + +#endif /* __STDC__ */ + +/* the xdr functions */ +#if defined(__STDC__) || defined(__cplusplus) + +extern bool_t xdr_fhandle (XDR *, fhandle); +extern bool_t xdr_fhstatus (XDR *, fhstatus*); + +#else /* __STDC__ */ + +extern bool_t xdr_fhandle(); +extern bool_t xdr_fhstatus(); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_XDR_MNT1_H_RPCGEN */ diff --git a/h/wrn/coreip/xdr_mnt3.h b/h/wrn/coreip/xdr_mnt3.h new file mode 100644 index 0000000..330f114 --- /dev/null +++ b/h/wrn/coreip/xdr_mnt3.h @@ -0,0 +1,101 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _XDR_MNT3_H_RPCGEN +#define _XDR_MNT3_H_RPCGEN + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include "xdr_mnt_common.h" +#define FHSIZE3 64 + +typedef struct { + u_int fhandle3_len; + char *fhandle3_val; +} fhandle3; + +enum mountstat3 { + MNT3_OK = 0, + MNT3ERR_PERM = 1, + MNT3ERR_NOENT = 2, + MNT3ERR_IO = 5, + MNT3ERR_ACCES = 13, + MNT3ERR_NOTDIR = 20, + MNT3ERR_INVAL = 22, + MNT3ERR_NAMETOOLONG = 63, + MNT3ERR_NOTSUPP = 10004, + MNT3ERR_SERVERFAULT = 10006 +}; +typedef enum mountstat3 mountstat3; + +struct mountres3_ok { + fhandle3 fhandle; + struct { + u_int auth_flavors_len; + int *auth_flavors_val; + } auth_flavors; +}; +typedef struct mountres3_ok mountres3_ok; + +struct mountres3 { + mountstat3 fhs_status; + union { + mountres3_ok mountinfo; + } mountres3_u; +}; +typedef struct mountres3 mountres3; + +#define MOUNT_V3 3 + +/* + * Mount (3) procedure prototypes. The procedure numbers + * are defined in xdr_mnt_common.h file + */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void * mountproc_null_3(void); +extern mountres3 * mountproc_mnt_3(dirpath *, struct svc_req *); +extern mountlist * mountproc_dump_3(void); +extern void * mountproc_umnt_3(dirpath *, struct svc_req *); +extern void * mountproc_umntall_3(char *, struct svc_req *); +extern exports * mountproc_export_3(void); +extern int mount_program_3_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* __STDC__ */ +extern void * mountproc_null_3(); +extern mountres3 * mountproc_mnt_3(); +extern mountlist * mountproc_dump_3(); +extern void * mountproc_umnt_3(); +extern void * mountproc_umntall_3(); +extern exports * mountproc_export_3(); +extern int mount_program_3_freeresult(); + +#endif /* __STDC__ */ + +/* the xdr functions */ + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t xdr_fhandle3 (XDR *, fhandle3*); +extern bool_t xdr_mountstat3 (XDR *, mountstat3*); +extern bool_t xdr_mountres3_ok (XDR *, mountres3_ok*); +extern bool_t xdr_mountres3 (XDR *, mountres3*); + +#else /* __STDC__ */ +extern bool_t xdr_fhandle3(); +extern bool_t xdr_mountstat3(); +extern bool_t xdr_mountres3_ok(); +extern bool_t xdr_mountres3(); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_XDR_MNT3_H_RPCGEN */ diff --git a/h/wrn/coreip/xdr_mnt_common.h b/h/wrn/coreip/xdr_mnt_common.h new file mode 100644 index 0000000..9a4ce80 --- /dev/null +++ b/h/wrn/coreip/xdr_mnt_common.h @@ -0,0 +1,88 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _XDR_MNT_COMMON_H_RPCGEN +#define _XDR_MNT_COMMON_H_RPCGEN + +#ifdef __cplusplus +extern "C" { +#endif + +#include + + +#define MNTPATHLEN 1024 +#define MNTNAMLEN 255 + +#define MOUNTPROG 100005 + +/* Mount procedure numbers */ +#define MOUNTPROC_NULL 0 +#define MOUNTPROC_MNT 1 +#define MOUNTPROC_DUMP 2 +#define MOUNTPROC_UMNT 3 +#define MOUNTPROC_UMNTALL 4 +#define MOUNTPROC_EXPORT 5 + +typedef char *dirpath; + +typedef char *name; + +typedef struct mountbody *mountlist; + +struct mountbody { + name ml_hostname; + dirpath ml_directory; + mountlist ml_next; +}; +typedef struct mountbody mountbody; + +typedef struct groupnode *groups; + +struct groupnode { + name gr_name; + groups gr_next; +}; +typedef struct groupnode groupnode; + +typedef struct exportnode *exports; + +struct exportnode { + dirpath ex_dir; + groups ex_groups; + exports ex_next; +}; +typedef struct exportnode exportnode; + +/* the xdr functions */ +#if defined(__STDC__) || defined(__cplusplus) + +extern bool_t xdr_dirpath (XDR *, dirpath*); +extern bool_t xdr_name (XDR *, name*); +extern bool_t xdr_mountlist (XDR *, mountlist*); +extern bool_t xdr_mountbody (XDR *, mountbody*); +extern bool_t xdr_groups (XDR *, groups*); +extern bool_t xdr_groupnode (XDR *, groupnode*); +extern bool_t xdr_exports (XDR *, exports*); +extern bool_t xdr_exportnode (XDR *, exportnode*); + +#else + +extern bool_t xdr_dirpath(); +extern bool_t xdr_name(); +extern bool_t xdr_mountlist(); +extern bool_t xdr_mountbody(); +extern bool_t xdr_groups(); +extern bool_t xdr_groupnode(); +extern bool_t xdr_exports(); +extern bool_t xdr_exportnode(); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_XDR_MNT_COMMON_H_RPCGEN */ diff --git a/h/wrn/coreip/xdr_nfs2.h b/h/wrn/coreip/xdr_nfs2.h new file mode 100644 index 0000000..72c29fe --- /dev/null +++ b/h/wrn/coreip/xdr_nfs2.h @@ -0,0 +1,385 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _XDR_NFS2_H_RPCGEN +#define _XDR_NFS2_H_RPCGEN + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include "xdr_nfs_common.h" + +#define NFS2_FHSIZE 32 +#define NFS_COOKIESIZE 4 +#define NFS_FIFO_DEV -1 +#define NFSMODE_FMT 0170000 +#define NFSMODE_DIR 0040000 +#define NFSMODE_CHR 0020000 +#define NFSMODE_BLK 0060000 +#define NFSMODE_REG 0100000 +#define NFSMODE_LNK 0120000 +#define NFSMODE_SOCK 0140000 +#define NFSMODE_FIFO 0010000 + + +enum ftype { + NFNON = 0, + NFREG = 1, + NFDIR = 2, + NFBLK = 3, + NFCHR = 4, + NFLNK = 5, + NFSOCK = 6, + NFBAD = 7, + NFFIFO = 8 +}; +typedef enum ftype ftype; + + +typedef char nfs_fh2[NFS2_FHSIZE]; + +typedef char nfscookie[NFS_COOKIESIZE]; + + +struct nfstime { + u_int seconds; + u_int useconds; +}; +typedef struct nfstime nfstime; + +struct fattr { + ftype type; + u_int mode; + u_int nlink; + u_int uid; + u_int gid; + u_int size; + u_int blocksize; + u_int rdev; + u_int blocks; + u_int fsid; + u_int fileid; + nfstime atime; + nfstime mtime; + nfstime ctime; +}; +typedef struct fattr fattr; + + +struct sattr { + u_int mode; + u_int uid; + u_int gid; + u_int size; + nfstime atime; + nfstime mtime; +}; +typedef struct sattr sattr; + + +struct attrstat { + nfsstat status; + union { + fattr attributes; + } attrstat_u; +}; +typedef struct attrstat attrstat; + + +struct diropargs { + nfs_fh2 dir; + filename name; +}; +typedef struct diropargs diropargs; + + +struct diropokres { + nfs_fh2 file; + fattr attributes; +}; +typedef struct diropokres diropokres; + +struct diropres { + nfsstat status; + union { + diropokres diropokres; + } diropres_u; +}; +typedef struct diropres diropres; + + +struct sattrargs { + nfs_fh2 file; + sattr attributes; +}; +typedef struct sattrargs sattrargs; + + +struct readlinkres { + nfsstat status; + union { + nfspath data; + } readlinkres_u; +}; +typedef struct readlinkres readlinkres; + + +struct readargs { + nfs_fh2 file; + u_int offset; + u_int count; + u_int totalcount; +}; +typedef struct readargs readargs; + + +typedef struct { + u_int data_len; + char *data_val; +} data; + +struct readokres { + fattr attributes; + data data; +}; +typedef struct readokres readokres; + +struct readres { + nfsstat status; + union { + readokres readokres; + } readres_u; +}; +typedef struct readres readres; + + +struct writeargs { + nfs_fh2 file; + u_int beginoffset; + u_int offset; + u_int totalcount; + data data; +}; +typedef struct writeargs writeargs; + + +struct createargs { + diropargs where; + sattr attributes; +}; +typedef struct createargs createargs; + + +struct renameargs { + diropargs from; + diropargs to; +}; +typedef struct renameargs renameargs; + + +struct linkargs { + nfs_fh2 from; + diropargs to; +}; +typedef struct linkargs linkargs; + + +struct symlinkargs { + diropargs from; + nfspath to; + sattr attributes; +}; +typedef struct symlinkargs symlinkargs; + + +struct readdirargs { + nfs_fh2 dir; + nfscookie cookie; + u_int count; +}; +typedef struct readdirargs readdirargs; + + +struct entry { + u_int fileid; + filename name; + nfscookie cookie; + struct entry *nextentry; +}; +typedef struct entry entry; + + +struct dirlist { + entry *entries; + bool_t eof; +}; +typedef struct dirlist dirlist; + + +struct readdirres { + nfsstat status; + union { + dirlist reply; + } readdirres_u; +}; +typedef struct readdirres readdirres; + + +struct statfsokres { + u_int tsize; + u_int bsize; + u_int blocks; + u_int bfree; + u_int bavail; +}; +typedef struct statfsokres statfsokres; + + +struct statfsres { + nfsstat status; + union { + statfsokres reply; + } statfsres_u; +}; +typedef struct statfsres statfsres; + +#define NFS_V2 2 +#define NFSPROC_NULL 0 +#define NFSPROC_GETATTR 1 +#define NFSPROC_SETATTR 2 +#define NFSPROC_ROOT 3 +#define NFSPROC_LOOKUP 4 +#define NFSPROC_READLINK 5 +#define NFSPROC_READ 6 +#define NFSPROC_WRITECACHE 7 +#define NFSPROC_WRITE 8 +#define NFSPROC_CREATE 9 +#define NFSPROC_REMOVE 10 +#define NFSPROC_RENAME 11 +#define NFSPROC_LINK 12 +#define NFSPROC_SYMLINK 13 +#define NFSPROC_MKDIR 14 +#define NFSPROC_RMDIR 15 +#define NFSPROC_READDIR 16 +#define NFSPROC_STATFS 17 + + +#if defined(__STDC__) || defined(__cplusplus) + +extern void * nfsproc_null_2(void); +extern attrstat * nfsproc_getattr_2(nfs_fh2 *); +extern attrstat * nfsproc_setattr_2(sattrargs *); +extern void * nfsproc_root_2(void); +extern diropres * nfsproc_lookup_2(diropargs *); +extern readlinkres * nfsproc_readlink_2(nfs_fh2 *); +extern readres * nfsproc_read_2(readargs *); +extern void * nfsproc_writecache_2(void); +extern attrstat * nfsproc_write_2(writeargs *); +extern diropres * nfsproc_create_2(createargs *); +extern nfsstat * nfsproc_remove_2(diropargs *); +extern nfsstat * nfsproc_rename_2(renameargs *); +extern nfsstat * nfsproc_link_2(void); +extern nfsstat * nfsproc_symlink_2(void); +extern diropres * nfsproc_mkdir_2(createargs *); +extern nfsstat * nfsproc_rmdir_2(diropargs *); +extern readdirres * nfsproc_readdir_2(readdirargs *); +extern statfsres * nfsproc_statfs_2(nfs_fh2 *); +extern int nfs_program_2_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* __STDC__ */ + +extern void * nfsproc_null_2(); +extern attrstat * nfsproc_getattr_2(); +extern attrstat * nfsproc_setattr_2(); +extern void * nfsproc_root_2(); +extern diropres * nfsproc_lookup_2(); +extern readlinkres * nfsproc_readlink_2(); +extern readres * nfsproc_read_2(); +extern void * nfsproc_writecache_2(); +extern attrstat * nfsproc_write_2(); +extern diropres * nfsproc_create_2(); +extern nfsstat * nfsproc_remove_2(); +extern nfsstat * nfsproc_rename_2(); +extern nfsstat * nfsproc_link_2(); +extern nfsstat * nfsproc_symlink_2(); +extern diropres * nfsproc_mkdir_2(); +extern nfsstat * nfsproc_rmdir_2(); +extern readdirres * nfsproc_readdir_2(); +extern statfsres * nfsproc_statfs_2(); +extern int nfs_program_2_freeresult(); + +#endif /* __STDC__ */ + +/* the xdr functions */ + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t xdr_ftype (XDR *, ftype*); +extern bool_t xdr_nfs_fh2 (XDR *, nfs_fh2); +extern bool_t xdr_nfscookie (XDR *, nfscookie); +extern bool_t xdr_nfstime (XDR *, nfstime*); +extern bool_t xdr_fattr (XDR *, fattr*); +extern bool_t xdr_sattr (XDR *, sattr*); +extern bool_t xdr_attrstat (XDR *, attrstat*); +extern bool_t xdr_diropargs (XDR *, diropargs*); +extern bool_t xdr_diropokres (XDR *, diropokres*); +extern bool_t xdr_diropres (XDR *, diropres*); +extern bool_t xdr_sattrargs (XDR *, sattrargs*); +extern bool_t xdr_readlinkres (XDR *, readlinkres*); +extern bool_t xdr_readargs (XDR *, readargs*); +extern bool_t xdr_data (XDR *, data*); +extern bool_t xdr_readokres (XDR *, readokres*); +extern bool_t xdr_readres (XDR *, readres*); +extern bool_t xdr_writeargs (XDR *, writeargs*); +extern bool_t xdr_createargs (XDR *, createargs*); +extern bool_t xdr_renameargs (XDR *, renameargs*); +extern bool_t xdr_linkargs (XDR *, linkargs*); +extern bool_t xdr_symlinkargs (XDR *, symlinkargs*); +extern bool_t xdr_readdirargs (XDR *, readdirargs*); +extern bool_t xdr_entry (XDR *, entry*); +extern bool_t xdr_dirlist (XDR *, dirlist*); +extern bool_t xdr_readdirres (XDR *, readdirres*); +extern bool_t xdr_statfsokres (XDR *, statfsokres*); +extern bool_t xdr_statfsres (XDR *, statfsres*); + +#else /* __STDC__ */ + +/* the xdr functions */ +extern bool_t xdr_ftype(); +extern bool_t xdr_nfs_fh2(); +extern bool_t xdr_nfscookie(); +extern bool_t xdr_nfstime(); +extern bool_t xdr_fattr(); +extern bool_t xdr_sattr(); +extern bool_t xdr_attrstat(); +extern bool_t xdr_diropargs(); +extern bool_t xdr_diropokres(); +extern bool_t xdr_diropres(); +extern bool_t xdr_sattrargs(); +extern bool_t xdr_readlinkres(); +extern bool_t xdr_readargs(); +extern bool_t xdr_data(); +extern bool_t xdr_readokres(); +extern bool_t xdr_readres(); +extern bool_t xdr_writeargs(); +extern bool_t xdr_createargs(); +extern bool_t xdr_renameargs(); +extern bool_t xdr_linkargs(); +extern bool_t xdr_symlinkargs(); +extern bool_t xdr_readdirargs(); +extern bool_t xdr_entry(); +extern bool_t xdr_dirlist(); +extern bool_t xdr_readdirres(); +extern bool_t xdr_statfsokres(); +extern bool_t xdr_statfsres(); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_XDR_NFS2_H_RPCGEN */ diff --git a/h/wrn/coreip/xdr_nfs3.h b/h/wrn/coreip/xdr_nfs3.h new file mode 100644 index 0000000..ee563a5 --- /dev/null +++ b/h/wrn/coreip/xdr_nfs3.h @@ -0,0 +1,1380 @@ +/* xdr_nfs3.h - rpcgen generated XDR header file for NFS v3 */ + +/* Copyright 1984 - 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,07jan04,ijm correct data types for xdr_u_longlong_t, SPR#92849 +*/ + +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef __INCxdr_nfs3h +#define __INCxdr_nfs3h + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include "xdr_nfs_common.h" + +#define NFS3_FHSIZE 64 +#define NFS3_COOKIEVERFSIZE 8 +#define NFS3_CREATEVERFSIZE 8 +#define NFS3_WRITEVERFSIZE 8 + +/* Following are the definitions for the arguments to NFS version + * 3 procedures. + */ +typedef unsigned long long u_longlong_t; +typedef long long longlong_t; + + +typedef u_longlong_t uint64; + +typedef u_long uint32; + +typedef longlong_t int64; + +typedef long int32; + +typedef uint64 fileid3; + +typedef uint64 cookie3; + +typedef uint32 uid3; + +typedef uint32 gid3; + +typedef uint64 size3; + +typedef uint64 offset3; + +typedef uint32 mode3; + +typedef uint32 count3; + + +typedef char cookieverf3[NFS3_COOKIEVERFSIZE]; + +typedef char createverf3[NFS3_CREATEVERFSIZE]; + +typedef char writeverf3[NFS3_WRITEVERFSIZE]; + + + +enum ftype3 { + NF3REG = 1, + NF3DIR = 2, + NF3BLK = 3, + NF3CHR = 4, + NF3LNK = 5, + NF3SOCK = 6, + NF3FIFO = 7 +}; +typedef enum ftype3 ftype3; + + +struct specdata3 { + uint32 specdata1; + uint32 specdata2; +}; +typedef struct specdata3 specdata3; +/* Argument for File Handle */ + +struct nfs_fh3 { + struct { + u_int data_len; + char *data_val; + } data; +}; +typedef struct nfs_fh3 nfs_fh3; + + +struct nfstime3 { + uint32 seconds; + uint32 nseconds; +}; +typedef struct nfstime3 nfstime3; + + +struct fattr3 { + ftype3 type; + mode3 mode; + uint32 nlink; + uid3 uid; + gid3 gid; + size3 size; + size3 used; + specdata3 rdev; + uint64 fsid; + fileid3 fileid; + nfstime3 atime; + nfstime3 mtime; + nfstime3 ctime; +}; +typedef struct fattr3 fattr3; + +#define SET_USR_ID 0x00800 +#define SET_GROUP_ID 0x00400 +#define SAVE_SWAPPED_TEXT 0x00200 +#define READ_PERM_OWNER 0x00100 +#define WRITE_PERM_OWNER 0x00080 +#define EXEC_PERM_OWNER 0x00040 +#define READ_PERM_GROUP 0x00020 +#define WRITE_PERM_GROUP 0x00010 +#define EXEC_PERM_GROUP 0x00008 +#define READ_PERM_OTHERS 0x00004 +#define WRITE_PERM_OTHERS 0x00002 +#define EXEC_PERM_OTHERS 0x00001 + + +struct post_op_attr { + bool_t attributes_follow; + union { + fattr3 attributes; + } post_op_attr_u; +}; +typedef struct post_op_attr post_op_attr; + + +struct wcc_attr { + size3 size; + nfstime3 mtime; + nfstime3 ctime; +}; +typedef struct wcc_attr wcc_attr; + + +struct pre_op_attr { + bool_t attributes_follow; + union { + wcc_attr attributes; + } pre_op_attr_u; +}; +typedef struct pre_op_attr pre_op_attr; + + +struct wcc_data { + pre_op_attr before; + post_op_attr after; +}; +typedef struct wcc_data wcc_data; + + +struct post_op_fh3 { + bool_t handle_follows; + union { + nfs_fh3 handle; + } post_op_fh3_u; +}; +typedef struct post_op_fh3 post_op_fh3; + + +enum time_how { + DONT_CHANGE = 0, + SET_TO_SERVER_TIME = 1, + SET_TO_CLIENT_TIME = 2 +}; +typedef enum time_how time_how; + + +struct set_mode3 { + bool_t set_it; + union { + mode3 mode; + } set_mode3_u; +}; +typedef struct set_mode3 set_mode3; + + +struct set_uid3 { + bool_t set_it; + union { + uid3 uid; + } set_uid3_u; +}; +typedef struct set_uid3 set_uid3; + + +struct set_gid3 { + bool_t set_it; + union { + gid3 gid; + } set_gid3_u; +}; +typedef struct set_gid3 set_gid3; + + +struct set_size3 { + bool_t set_it; + union { + size3 size; + } set_size3_u; +}; +typedef struct set_size3 set_size3; + + +struct set_atime { + time_how set_it; + union { + nfstime3 atime; + } set_atime_u; +}; +typedef struct set_atime set_atime; + + +struct set_mtime { + time_how set_it; + union { + nfstime3 mtime; + } set_mtime_u; +}; +typedef struct set_mtime set_mtime; + + +struct diropargs3 { + nfs_fh3 dir; + filename filename; +}; +typedef struct diropargs3 diropargs3; + + +struct GETATTR3args { + nfs_fh3 object; +}; +typedef struct GETATTR3args GETATTR3args; + + +struct GETATTR3resok { + fattr3 obj_attributes; +}; +typedef struct GETATTR3resok GETATTR3resok; + + +struct GETATTR3res { + nfsstat status; + union { + GETATTR3resok resok; + } GETATTR3res_u; +}; +typedef struct GETATTR3res GETATTR3res; + + + +struct sattr3 { + set_mode3 mode; + set_uid3 uid; + set_gid3 gid; + set_size3 size; + set_atime atime; + set_mtime mtime; +}; +typedef struct sattr3 sattr3; + + +struct sattrguard3 { + bool_t check; + union { + nfstime3 obj_ctime; + } sattrguard3_u; +}; +typedef struct sattrguard3 sattrguard3; + + +struct SETATTR3args { + nfs_fh3 object; + sattr3 new_attributes; + sattrguard3 guard; +}; +typedef struct SETATTR3args SETATTR3args; + + +struct SETATTR3resok { + wcc_data obj_wcc; +}; +typedef struct SETATTR3resok SETATTR3resok; + + +struct SETATTR3resfail { + wcc_data obj_wcc; +}; +typedef struct SETATTR3resfail SETATTR3resfail; + + +struct SETATTR3res { + nfsstat status; + union { + SETATTR3resok resok; + SETATTR3resfail resfail; + } SETATTR3res_u; +}; +typedef struct SETATTR3res SETATTR3res; + + +struct LOOKUP3args { + diropargs3 what; +}; +typedef struct LOOKUP3args LOOKUP3args; + + +struct LOOKUP3resok { + nfs_fh3 object; + post_op_attr obj_attributes; + post_op_attr dir_attributes; +}; +typedef struct LOOKUP3resok LOOKUP3resok; + + +struct LOOKUP3resfail { + post_op_attr dir_attributes; +}; +typedef struct LOOKUP3resfail LOOKUP3resfail; + + +struct LOOKUP3res { + nfsstat status; + union { + LOOKUP3resok resok; + LOOKUP3resfail resfail; + } LOOKUP3res_u; +}; +typedef struct LOOKUP3res LOOKUP3res; + +#define ACCESS3_READ 0x0001 +#define ACCESS3_LOOKUP 0x0002 +#define ACCESS3_MODIFY 0x0004 +#define ACCESS3_EXTEND 0x0008 +#define ACCESS3_DELETE 0x0010 +#define ACCESS3_EXECUTE 0x0020 + + +struct ACCESS3args { + nfs_fh3 object; + uint32 access; +}; +typedef struct ACCESS3args ACCESS3args; + + +struct ACCESS3resok { + post_op_attr obj_attributes; + uint32 access; +}; +typedef struct ACCESS3resok ACCESS3resok; + + +struct ACCESS3resfail { + post_op_attr obj_attributes; +}; +typedef struct ACCESS3resfail ACCESS3resfail; + + +struct ACCESS3res { + nfsstat status; + union { + ACCESS3resok resok; + ACCESS3resfail resfail; + } ACCESS3res_u; +}; +typedef struct ACCESS3res ACCESS3res; + + +struct READLINK3args { + nfs_fh3 symlink; +}; +typedef struct READLINK3args READLINK3args; + + +struct READLINK3resok { + post_op_attr symlink_attributes; + nfspath data; +}; +typedef struct READLINK3resok READLINK3resok; + + +struct READLINK3resfail { + post_op_attr symlink_attributes; +}; +typedef struct READLINK3resfail READLINK3resfail; + + +struct READLINK3res { + nfsstat status; + union { + READLINK3resok resok; + READLINK3resfail resfail; + } READLINK3res_u; +}; +typedef struct READLINK3res READLINK3res; + + + +struct READ3args { + nfs_fh3 file; + offset3 offset; + count3 count; +}; +typedef struct READ3args READ3args; + + +struct READ3resok { + post_op_attr file_attributes; + count3 count; + bool_t eof; + struct { + u_int data_len; + char *data_val; + } data; +}; +typedef struct READ3resok READ3resok; + +struct READ3resfail { + post_op_attr file_attributes; +}; +typedef struct READ3resfail READ3resfail; + + +struct READ3res { + nfsstat status; + union { + READ3resok resok; + READ3resfail resfail; + } READ3res_u; +}; +typedef struct READ3res READ3res; + + +enum stable_how { + UNSTABLE = 0, + DATA_SYNC = 1, + FILE_SYNC = 2 +}; +typedef enum stable_how stable_how; + + +struct WRITE3args { + nfs_fh3 file; + offset3 offset; + count3 count; + stable_how stable; + struct { + u_int data_len; + char *data_val; + } data; +}; +typedef struct WRITE3args WRITE3args; + + +struct WRITE3resok { + wcc_data file_wcc; + count3 count; + stable_how committed; + writeverf3 verf; +}; +typedef struct WRITE3resok WRITE3resok; + + +struct WRITE3resfail { + wcc_data file_wcc; +}; +typedef struct WRITE3resfail WRITE3resfail; + + +struct WRITE3res { + nfsstat status; + union { + WRITE3resok resok; + WRITE3resfail resfail; + } WRITE3res_u; +}; +typedef struct WRITE3res WRITE3res; + + +enum createmode3 { + UNCHECKED = 0, + GUARDED = 1, + EXCLUSIVE = 2 +}; +typedef enum createmode3 createmode3; + + +struct createhow3 { + createmode3 mode; + union { + sattr3 obj_attributes; + createverf3 verf; + } createhow3_u; +}; +typedef struct createhow3 createhow3; + + +struct CREATE3args { + diropargs3 where; + createhow3 how; +}; +typedef struct CREATE3args CREATE3args; + + +struct CREATE3resok { + post_op_fh3 obj; + post_op_attr obj_attributes; + wcc_data dir_wcc; +}; +typedef struct CREATE3resok CREATE3resok; + + +struct CREATE3resfail { + wcc_data dir_wcc; +}; +typedef struct CREATE3resfail CREATE3resfail; + + +struct CREATE3res { + nfsstat status; + union { + CREATE3resok resok; + CREATE3resfail resfail; + } CREATE3res_u; +}; +typedef struct CREATE3res CREATE3res; + + +struct MKDIR3args { + diropargs3 where; + sattr3 attributes; +}; +typedef struct MKDIR3args MKDIR3args; + + +struct MKDIR3resok { + post_op_fh3 obj; + post_op_attr obj_attributes; + wcc_data dir_wcc; +}; +typedef struct MKDIR3resok MKDIR3resok; + + +struct MKDIR3resfail { + wcc_data dir_wcc; +}; +typedef struct MKDIR3resfail MKDIR3resfail; + + +struct MKDIR3res { + nfsstat status; + union { + MKDIR3resok resok; + MKDIR3resfail resfail; + } MKDIR3res_u; +}; +typedef struct MKDIR3res MKDIR3res; + + +struct symlinkdata3 { + sattr3 symlink_attributes; + nfspath symlink_data; +}; +typedef struct symlinkdata3 symlinkdata3; + + +struct SYMLINK3args { + diropargs3 where; + symlinkdata3 symlink; +}; +typedef struct SYMLINK3args SYMLINK3args; + + +struct SYMLINK3resok { + post_op_fh3 obj; + post_op_attr obj_attributes; + wcc_data dir_wcc; +}; +typedef struct SYMLINK3resok SYMLINK3resok; + + +struct SYMLINK3resfail { + wcc_data dir_wcc; +}; +typedef struct SYMLINK3resfail SYMLINK3resfail; + + +struct SYMLINK3res { + nfsstat status; + union { + SYMLINK3resok resok; + SYMLINK3resfail resfail; + } SYMLINK3res_u; +}; +typedef struct SYMLINK3res SYMLINK3res; + + +struct devicedata3 { + sattr3 dev_attributes; + specdata3 spec; +}; +typedef struct devicedata3 devicedata3; + + +struct mknoddata3 { + ftype3 type; + union { + devicedata3 device; + sattr3 pipe_attributes; + } mknoddata3_u; +}; +typedef struct mknoddata3 mknoddata3; + + +struct MKNOD3args { + diropargs3 where; + mknoddata3 what; +}; +typedef struct MKNOD3args MKNOD3args; + + +struct MKNOD3resok { + post_op_fh3 obj; + post_op_attr obj_attributes; + wcc_data dir_wcc; +}; +typedef struct MKNOD3resok MKNOD3resok; + + +struct MKNOD3resfail { + wcc_data dir_wcc; +}; +typedef struct MKNOD3resfail MKNOD3resfail; + + +struct MKNOD3res { + nfsstat status; + union { + MKNOD3resok resok; + MKNOD3resfail resfail; + } MKNOD3res_u; +}; +typedef struct MKNOD3res MKNOD3res; + + +struct REMOVE3args { + diropargs3 object; +}; +typedef struct REMOVE3args REMOVE3args; + + +struct REMOVE3resok { + wcc_data dir_wcc; +}; +typedef struct REMOVE3resok REMOVE3resok; + + +struct REMOVE3resfail { + wcc_data dir_wcc; +}; +typedef struct REMOVE3resfail REMOVE3resfail; + + +struct REMOVE3res { + nfsstat status; + union { + REMOVE3resok resok; + REMOVE3resfail resfail; + } REMOVE3res_u; +}; +typedef struct REMOVE3res REMOVE3res; + + +struct RMDIR3args { + diropargs3 object; +}; +typedef struct RMDIR3args RMDIR3args; + + +struct RMDIR3resok { + wcc_data dir_wcc; +}; +typedef struct RMDIR3resok RMDIR3resok; + + +struct RMDIR3resfail { + wcc_data dir_wcc; +}; +typedef struct RMDIR3resfail RMDIR3resfail; + + +struct RMDIR3res { + nfsstat status; + union { + RMDIR3resok resok; + RMDIR3resfail resfail; + } RMDIR3res_u; +}; +typedef struct RMDIR3res RMDIR3res; + + +struct RENAME3args { + diropargs3 from; + diropargs3 to; +}; +typedef struct RENAME3args RENAME3args; + + +struct RENAME3resok { + wcc_data fromdir_wcc; + wcc_data todir_wcc; +}; +typedef struct RENAME3resok RENAME3resok; + + +struct RENAME3resfail { + wcc_data fromdir_wcc; + wcc_data todir_wcc; +}; +typedef struct RENAME3resfail RENAME3resfail; + + +struct RENAME3res { + nfsstat status; + union { + RENAME3resok resok; + RENAME3resfail resfail; + } RENAME3res_u; +}; +typedef struct RENAME3res RENAME3res; + + +struct LINK3args { + nfs_fh3 file; + diropargs3 link; +}; +typedef struct LINK3args LINK3args; + + +struct LINK3resok { + post_op_attr file_attributes; + wcc_data linkdir_wcc; +}; +typedef struct LINK3resok LINK3resok; + + +struct LINK3resfail { + post_op_attr file_attributes; + wcc_data linkdir_wcc; +}; +typedef struct LINK3resfail LINK3resfail; + + +struct LINK3res { + nfsstat status; + union { + LINK3resok resok; + LINK3resfail resfail; + } LINK3res_u; +}; +typedef struct LINK3res LINK3res; + + +struct READDIR3args { + nfs_fh3 dir; + cookie3 cookie; + cookieverf3 cookieverf; + count3 count; +}; +typedef struct READDIR3args READDIR3args; + + +struct entry3 { + fileid3 fileid; + filename name; + cookie3 cookie; + struct entry3 *nextentry; +}; +typedef struct entry3 entry3; + + +struct dirlist3 { + entry3 *entries; + bool_t eof; +}; +typedef struct dirlist3 dirlist3; + + +struct READDIR3resok { + post_op_attr dir_attributes; + cookieverf3 cookieverf; + dirlist3 reply; +}; +typedef struct READDIR3resok READDIR3resok; + + +struct READDIR3resfail { + post_op_attr dir_attributes; +}; +typedef struct READDIR3resfail READDIR3resfail; + + +struct READDIR3res { + nfsstat status; + union { + READDIR3resok resok; + READDIR3resfail resfail; + } READDIR3res_u; +}; +typedef struct READDIR3res READDIR3res; + + +struct READDIRPLUS3args { + nfs_fh3 dir; + cookie3 cookie; + cookieverf3 cookieverf; + count3 dircount; + count3 maxcount; +}; +typedef struct READDIRPLUS3args READDIRPLUS3args; + + +struct entryplus3 { + fileid3 fileid; + filename name; + cookie3 cookie; + post_op_attr name_attributes; + post_op_fh3 name_handle; + struct entryplus3 *nextentry; +}; +typedef struct entryplus3 entryplus3; + + +struct dirlistplus3 { + entryplus3 *entries; + bool_t eof; +}; +typedef struct dirlistplus3 dirlistplus3; + + +struct READDIRPLUS3resok { + post_op_attr dir_attributes; + cookieverf3 cookieverf; + dirlistplus3 reply; +}; +typedef struct READDIRPLUS3resok READDIRPLUS3resok; + + +struct READDIRPLUS3resfail { + post_op_attr dir_attributes; +}; +typedef struct READDIRPLUS3resfail READDIRPLUS3resfail; + + +struct READDIRPLUS3res { + nfsstat status; + union { + READDIRPLUS3resok resok; + READDIRPLUS3resfail resfail; + } READDIRPLUS3res_u; +}; +typedef struct READDIRPLUS3res READDIRPLUS3res; + + +struct FSSTAT3args { + nfs_fh3 fsroot; +}; +typedef struct FSSTAT3args FSSTAT3args; + + +struct FSSTAT3resok { + post_op_attr obj_attributes; + size3 tbytes; + size3 fbytes; + size3 abytes; + size3 tfiles; + size3 ffiles; + size3 afiles; + uint32 invarsec; +}; +typedef struct FSSTAT3resok FSSTAT3resok; + + +struct FSSTAT3resfail { + post_op_attr obj_attributes; +}; +typedef struct FSSTAT3resfail FSSTAT3resfail; + + +struct FSSTAT3res { + nfsstat status; + union { + FSSTAT3resok resok; + FSSTAT3resfail resfail; + } FSSTAT3res_u; +}; +typedef struct FSSTAT3res FSSTAT3res; + + +#define FSF3_LINK 0x0001 +#define FSF3_SYMLINK 0x0002 +#define FSF3_HOMOGENEOUS 0x0008 +#define FSF3_CANSETTIME 0x0010 + + +struct FSINFO3args { + nfs_fh3 fsroot; +}; +typedef struct FSINFO3args FSINFO3args; + + +struct FSINFO3resok { + post_op_attr obj_attributes; + uint32 rtmax; + uint32 rtpref; + uint32 rtmult; + uint32 wtmax; + uint32 wtpref; + uint32 wtmult; + uint32 dtpref; + size3 maxfilesize; + nfstime3 time_delta; + uint32 properties; +}; +typedef struct FSINFO3resok FSINFO3resok; + + +struct FSINFO3resfail { + post_op_attr obj_attributes; +}; +typedef struct FSINFO3resfail FSINFO3resfail; + + +struct FSINFO3res { + nfsstat status; + union { + FSINFO3resok resok; + FSINFO3resfail resfail; + } FSINFO3res_u; +}; +typedef struct FSINFO3res FSINFO3res; + + +struct PATHCONF3args { + nfs_fh3 object; +}; +typedef struct PATHCONF3args PATHCONF3args; + + +struct PATHCONF3resok { + post_op_attr obj_attributes; + uint32 linkmax; + uint32 name_max; + bool_t no_trunc; + bool_t chown_restricted; + bool_t case_insensitive; + bool_t case_preserving; +}; +typedef struct PATHCONF3resok PATHCONF3resok; + + +struct PATHCONF3resfail { + post_op_attr obj_attributes; +}; +typedef struct PATHCONF3resfail PATHCONF3resfail; + + +struct PATHCONF3res { + nfsstat status; + union { + PATHCONF3resok resok; + PATHCONF3resfail resfail; + } PATHCONF3res_u; +}; +typedef struct PATHCONF3res PATHCONF3res; + + +struct COMMIT3args { + nfs_fh3 file; + offset3 offset; + count3 count; +}; +typedef struct COMMIT3args COMMIT3args; + + +struct COMMIT3resok { + wcc_data file_wcc; + writeverf3 verf; +}; +typedef struct COMMIT3resok COMMIT3resok; + + +struct COMMIT3resfail { + wcc_data file_wcc; +}; +typedef struct COMMIT3resfail COMMIT3resfail; + + + +struct COMMIT3res { + nfsstat status; + union { + COMMIT3resok resok; + COMMIT3resfail resfail; + } COMMIT3res_u; +}; +typedef struct COMMIT3res COMMIT3res; + + +#define NFS_V3 3 +#define NFS3PROC_NULL 0 +#define NFS3PROC_GETATTR 1 +#define NFS3PROC_SETATTR 2 +#define NFS3PROC_LOOKUP 3 +#define NFS3PROC_ACCESS 4 +#define NFS3PROC_READLINK 5 +#define NFS3PROC_READ 6 +#define NFS3PROC_WRITE 7 +#define NFS3PROC_CREATE 8 +#define NFS3PROC_MKDIR 9 +#define NFS3PROC_SYMLINK 10 +#define NFS3PROC_MKNOD 11 +#define NFS3PROC_REMOVE 12 +#define NFS3PROC_RMDIR 13 +#define NFS3PROC_RENAME 14 +#define NFS3PROC_LINK 15 +#define NFS3PROC_READDIR 16 +#define NFS3PROC_READDIRPLUS 17 +#define NFS3PROC_FSSTAT 18 +#define NFS3PROC_FSINFO 19 +#define NFS3PROC_PATHCONF 20 +#define NFS3PROC_COMMIT 21 + + +#if defined(__STDC__) || defined(__cplusplus) + +extern void * nfsproc_null_3(void ); +extern GETATTR3res * nfsproc_getattr_3(GETATTR3args *); +extern SETATTR3res * nfsproc_setattr_3(SETATTR3args *); +extern LOOKUP3res * nfsproc_lookup_3(LOOKUP3args *); +extern ACCESS3res * nfsproc_access_3(ACCESS3args *); +extern READLINK3res * nfsproc_readlink_3(READLINK3args *); +extern READ3res * nfsproc_read_3(READ3args *); +extern WRITE3res * nfsproc_write_3(WRITE3args *); +extern CREATE3res * nfsproc_create_3(CREATE3args *); +extern MKDIR3res * nfsproc_mkdir_3(MKDIR3args *); +extern SYMLINK3res * nfsproc_symlink_3(SYMLINK3args *); +extern MKNOD3res * nfsproc_mknod_3(MKNOD3args *); +extern REMOVE3res * nfsproc_remove_3(REMOVE3args *); +extern RMDIR3res * nfsproc_rmdir_3(RMDIR3args *); +extern RENAME3res * nfsproc_rename_3(RENAME3args *); +extern LINK3res * nfsproc_link_3(LINK3args *); +extern READDIR3res * nfsproc_readdir_3(READDIR3args *); +extern READDIRPLUS3res * nfsproc_readdirplus_3(READDIRPLUS3args *); +extern FSSTAT3res * nfsproc_fsstat_3(FSSTAT3args *); +extern FSINFO3res * nfsproc_fsinfo_3(FSINFO3args *); +extern PATHCONF3res * nfsproc_pathconf_3(PATHCONF3args *); +extern COMMIT3res * nfsproc_commit_3(COMMIT3args *); +extern int nfs_program_3_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* __STDC__ */ + +extern void * nfsproc_null_3(); +extern GETATTR3res * nfsproc_getattr_3(); +extern SETATTR3res * nfsproc_setattr_3(); +extern LOOKUP3res * nfsproc_lookup_3(); +extern ACCESS3res * nfsproc_access_3(); +extern READLINK3res * nfsproc_readlink_3(); +extern READ3res * nfsproc_read_3(); +extern WRITE3res * nfsproc_write_3(); +extern CREATE3res * nfsproc_create_3(); +extern MKDIR3res * nfsproc_mkdir_3(); +extern SYMLINK3res * nfsproc_symlink_3(); +extern MKNOD3res * nfsproc_mknod_3(); +extern REMOVE3res * nfsproc_remove_3(); +extern RMDIR3res * nfsproc_rmdir_3(); +extern RENAME3res * nfsproc_rename_3(); +extern LINK3res * nfsproc_link_3(); +extern READDIR3res * nfsproc_readdir_3(); +extern READDIRPLUS3res * nfsproc_readdirplus_3(); +extern FSSTAT3res * nfsproc_fsstat_3(); +extern FSINFO3res * nfsproc_fsinfo_3(); +extern PATHCONF3res * nfsproc_pathconf_3(); +extern COMMIT3res * nfsproc_commit_3(); +extern int nfs_program_3_freeresult(); + +#endif /* __STDC__ */ + +/* the xdr functions */ + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t xdr_longlong_t(register XDR *, int64 *); +extern bool_t xdr_u_longlong_t(register XDR *, uint64 *); +extern bool_t xdr_uint64 (XDR *, uint64*); +extern bool_t xdr_uint32 (XDR *, uint32*); +extern bool_t xdr_int64 (XDR *, int64*); +extern bool_t xdr_int32 (XDR *, int32*); +extern bool_t xdr_fileid3 (XDR *, fileid3*); +extern bool_t xdr_cookie3 (XDR *, cookie3*); +extern bool_t xdr_uid3 (XDR *, uid3*); +extern bool_t xdr_gid3 (XDR *, gid3*); +extern bool_t xdr_size3 (XDR *, size3*); +extern bool_t xdr_offset3 (XDR *, offset3*); +extern bool_t xdr_mode3 (XDR *, mode3*); +extern bool_t xdr_count3 (XDR *, count3*); +extern bool_t xdr_cookieverf3 (XDR *, cookieverf3); +extern bool_t xdr_createverf3 (XDR *, createverf3); +extern bool_t xdr_writeverf3 (XDR *, writeverf3); +extern bool_t xdr_ftype3 (XDR *, ftype3*); +extern bool_t xdr_specdata3 (XDR *, specdata3*); +extern bool_t xdr_nfs_fh3 (XDR *, nfs_fh3*); +extern bool_t xdr_nfstime3 (XDR *, nfstime3*); +extern bool_t xdr_fattr3 (XDR *, fattr3*); +extern bool_t xdr_post_op_attr (XDR *, post_op_attr*); +extern bool_t xdr_wcc_attr (XDR *, wcc_attr*); +extern bool_t xdr_pre_op_attr (XDR *, pre_op_attr*); +extern bool_t xdr_wcc_data (XDR *, wcc_data*); +extern bool_t xdr_post_op_fh3 (XDR *, post_op_fh3*); +extern bool_t xdr_time_how (XDR *, time_how*); +extern bool_t xdr_set_mode3 (XDR *, set_mode3*); +extern bool_t xdr_set_uid3 (XDR *, set_uid3*); +extern bool_t xdr_set_gid3 (XDR *, set_gid3*); +extern bool_t xdr_set_size3 (XDR *, set_size3*); +extern bool_t xdr_set_atime (XDR *, set_atime*); +extern bool_t xdr_set_mtime (XDR *, set_mtime*); +extern bool_t xdr_diropargs3 (XDR *, diropargs3*); +extern bool_t xdr_GETATTR3args (XDR *, GETATTR3args*); +extern bool_t xdr_GETATTR3resok (XDR *, GETATTR3resok*); +extern bool_t xdr_GETATTR3res (XDR *, GETATTR3res*); +extern bool_t xdr_sattr3 (XDR *, sattr3*); +extern bool_t xdr_sattrguard3 (XDR *, sattrguard3*); +extern bool_t xdr_SETATTR3args (XDR *, SETATTR3args*); +extern bool_t xdr_SETATTR3resok (XDR *, SETATTR3resok*); +extern bool_t xdr_SETATTR3resfail (XDR *, SETATTR3resfail*); +extern bool_t xdr_SETATTR3res (XDR *, SETATTR3res*); +extern bool_t xdr_LOOKUP3args (XDR *, LOOKUP3args*); +extern bool_t xdr_LOOKUP3resok (XDR *, LOOKUP3resok*); +extern bool_t xdr_LOOKUP3resfail (XDR *, LOOKUP3resfail*); +extern bool_t xdr_LOOKUP3res (XDR *, LOOKUP3res*); +extern bool_t xdr_ACCESS3args (XDR *, ACCESS3args*); +extern bool_t xdr_ACCESS3resok (XDR *, ACCESS3resok*); +extern bool_t xdr_ACCESS3resfail (XDR *, ACCESS3resfail*); +extern bool_t xdr_ACCESS3res (XDR *, ACCESS3res*); +extern bool_t xdr_READLINK3args (XDR *, READLINK3args*); +extern bool_t xdr_READLINK3resok (XDR *, READLINK3resok*); +extern bool_t xdr_READLINK3resfail (XDR *, READLINK3resfail*); +extern bool_t xdr_READLINK3res (XDR *, READLINK3res*); +extern bool_t xdr_READ3args (XDR *, READ3args*); +extern bool_t xdr_READ3resok (XDR *, READ3resok*); +extern bool_t xdr_READ3resfail (XDR *, READ3resfail*); +extern bool_t xdr_READ3res (XDR *, READ3res*); +extern bool_t xdr_stable_how (XDR *, stable_how*); +extern bool_t xdr_WRITE3args (XDR *, WRITE3args*); +extern bool_t xdr_WRITE3resok (XDR *, WRITE3resok*); +extern bool_t xdr_WRITE3resfail (XDR *, WRITE3resfail*); +extern bool_t xdr_WRITE3res (XDR *, WRITE3res*); +extern bool_t xdr_createmode3 (XDR *, createmode3*); +extern bool_t xdr_createhow3 (XDR *, createhow3*); +extern bool_t xdr_CREATE3args (XDR *, CREATE3args*); +extern bool_t xdr_CREATE3resok (XDR *, CREATE3resok*); +extern bool_t xdr_CREATE3resfail (XDR *, CREATE3resfail*); +extern bool_t xdr_CREATE3res (XDR *, CREATE3res*); +extern bool_t xdr_MKDIR3args (XDR *, MKDIR3args*); +extern bool_t xdr_MKDIR3resok (XDR *, MKDIR3resok*); +extern bool_t xdr_MKDIR3resfail (XDR *, MKDIR3resfail*); +extern bool_t xdr_MKDIR3res (XDR *, MKDIR3res*); +extern bool_t xdr_symlinkdata3 (XDR *, symlinkdata3*); +extern bool_t xdr_SYMLINK3args (XDR *, SYMLINK3args*); +extern bool_t xdr_SYMLINK3resok (XDR *, SYMLINK3resok*); +extern bool_t xdr_SYMLINK3resfail (XDR *, SYMLINK3resfail*); +extern bool_t xdr_SYMLINK3res (XDR *, SYMLINK3res*); +extern bool_t xdr_devicedata3 (XDR *, devicedata3*); +extern bool_t xdr_mknoddata3 (XDR *, mknoddata3*); +extern bool_t xdr_MKNOD3args (XDR *, MKNOD3args*); +extern bool_t xdr_MKNOD3resok (XDR *, MKNOD3resok*); +extern bool_t xdr_MKNOD3resfail (XDR *, MKNOD3resfail*); +extern bool_t xdr_MKNOD3res (XDR *, MKNOD3res*); +extern bool_t xdr_REMOVE3args (XDR *, REMOVE3args*); +extern bool_t xdr_REMOVE3resok (XDR *, REMOVE3resok*); +extern bool_t xdr_REMOVE3resfail (XDR *, REMOVE3resfail*); +extern bool_t xdr_REMOVE3res (XDR *, REMOVE3res*); +extern bool_t xdr_RMDIR3args (XDR *, RMDIR3args*); +extern bool_t xdr_RMDIR3resok (XDR *, RMDIR3resok*); +extern bool_t xdr_RMDIR3resfail (XDR *, RMDIR3resfail*); +extern bool_t xdr_RMDIR3res (XDR *, RMDIR3res*); +extern bool_t xdr_RENAME3args (XDR *, RENAME3args*); +extern bool_t xdr_RENAME3resok (XDR *, RENAME3resok*); +extern bool_t xdr_RENAME3resfail (XDR *, RENAME3resfail*); +extern bool_t xdr_RENAME3res (XDR *, RENAME3res*); +extern bool_t xdr_LINK3args (XDR *, LINK3args*); +extern bool_t xdr_LINK3resok (XDR *, LINK3resok*); +extern bool_t xdr_LINK3resfail (XDR *, LINK3resfail*); +extern bool_t xdr_LINK3res (XDR *, LINK3res*); +extern bool_t xdr_READDIR3args (XDR *, READDIR3args*); +extern bool_t xdr_entry3 (XDR *, entry3*); +extern bool_t xdr_dirlist3 (XDR *, dirlist3*); +extern bool_t xdr_READDIR3resok (XDR *, READDIR3resok*); +extern bool_t xdr_READDIR3resfail (XDR *, READDIR3resfail*); +extern bool_t xdr_READDIR3res (XDR *, READDIR3res*); +extern bool_t xdr_READDIRPLUS3args (XDR *, READDIRPLUS3args*); +extern bool_t xdr_entryplus3 (XDR *, entryplus3*); +extern bool_t xdr_dirlistplus3 (XDR *, dirlistplus3*); +extern bool_t xdr_READDIRPLUS3resok (XDR *, READDIRPLUS3resok*); +extern bool_t xdr_READDIRPLUS3resfail (XDR *, READDIRPLUS3resfail*); +extern bool_t xdr_READDIRPLUS3res (XDR *, READDIRPLUS3res*); +extern bool_t xdr_FSSTAT3args (XDR *, FSSTAT3args*); +extern bool_t xdr_FSSTAT3resok (XDR *, FSSTAT3resok*); +extern bool_t xdr_FSSTAT3resfail (XDR *, FSSTAT3resfail*); +extern bool_t xdr_FSSTAT3res (XDR *, FSSTAT3res*); +extern bool_t xdr_FSINFO3args (XDR *, FSINFO3args*); +extern bool_t xdr_FSINFO3resok (XDR *, FSINFO3resok*); +extern bool_t xdr_FSINFO3resfail (XDR *, FSINFO3resfail*); +extern bool_t xdr_FSINFO3res (XDR *, FSINFO3res*); +extern bool_t xdr_PATHCONF3args (XDR *, PATHCONF3args*); +extern bool_t xdr_PATHCONF3resok (XDR *, PATHCONF3resok*); +extern bool_t xdr_PATHCONF3resfail (XDR *, PATHCONF3resfail*); +extern bool_t xdr_PATHCONF3res (XDR *, PATHCONF3res*); +extern bool_t xdr_COMMIT3args (XDR *, COMMIT3args*); +extern bool_t xdr_COMMIT3resok (XDR *, COMMIT3resok*); +extern bool_t xdr_COMMIT3resfail (XDR *, COMMIT3resfail*); +extern bool_t xdr_COMMIT3res (XDR *, COMMIT3res*); + +#else /* __STDC__ */ + +extern bool_t xdr_longlong_t(); +extern bool_t xdr_u_longlong_t(); +extern bool_t xdr_uint64(); +extern bool_t xdr_uint32(); +extern bool_t xdr_int64(); +extern bool_t xdr_int32(); +extern bool_t xdr_fileid3(); +extern bool_t xdr_cookie3(); +extern bool_t xdr_uid3(); +extern bool_t xdr_gid3(); +extern bool_t xdr_size3(); +extern bool_t xdr_offset3(); +extern bool_t xdr_mode3(); +extern bool_t xdr_count3(); +extern bool_t xdr_cookieverf3(); +extern bool_t xdr_createverf3(); +extern bool_t xdr_writeverf3(); +extern bool_t xdr_ftype3(); +extern bool_t xdr_specdata3(); +extern bool_t xdr_nfs_fh3(); +extern bool_t xdr_nfstime3(); +extern bool_t xdr_fattr3(); +extern bool_t xdr_post_op_attr(); +extern bool_t xdr_wcc_attr(); +extern bool_t xdr_pre_op_attr(); +extern bool_t xdr_wcc_data(); +extern bool_t xdr_post_op_fh3(); +extern bool_t xdr_time_how(); +extern bool_t xdr_set_mode3(); +extern bool_t xdr_set_uid3(); +extern bool_t xdr_set_gid3(); +extern bool_t xdr_set_size3(); +extern bool_t xdr_set_atime(); +extern bool_t xdr_set_mtime(); +extern bool_t xdr_diropargs3(); +extern bool_t xdr_GETATTR3args(); +extern bool_t xdr_GETATTR3resok(); +extern bool_t xdr_GETATTR3res(); +extern bool_t xdr_sattr3(); +extern bool_t xdr_sattrguard3(); +extern bool_t xdr_SETATTR3args(); +extern bool_t xdr_SETATTR3resok(); +extern bool_t xdr_SETATTR3resfail(); +extern bool_t xdr_SETATTR3res(); +extern bool_t xdr_LOOKUP3args(); +extern bool_t xdr_LOOKUP3resok(); +extern bool_t xdr_LOOKUP3resfail(); +extern bool_t xdr_LOOKUP3res(); +extern bool_t xdr_ACCESS3args(); +extern bool_t xdr_ACCESS3resok(); +extern bool_t xdr_ACCESS3resfail(); +extern bool_t xdr_ACCESS3res(); +extern bool_t xdr_READLINK3args(); +extern bool_t xdr_READLINK3resok(); +extern bool_t xdr_READLINK3resfail(); +extern bool_t xdr_READLINK3res(); +extern bool_t xdr_READ3args(); +extern bool_t xdr_READ3resok(); +extern bool_t xdr_READ3resfail(); +extern bool_t xdr_READ3res(); +extern bool_t xdr_stable_how(); +extern bool_t xdr_WRITE3args(); +extern bool_t xdr_WRITE3resok(); +extern bool_t xdr_WRITE3resfail(); +extern bool_t xdr_WRITE3res(); +extern bool_t xdr_createmode3(); +extern bool_t xdr_createhow3(); +extern bool_t xdr_CREATE3args(); +extern bool_t xdr_CREATE3resok(); +extern bool_t xdr_CREATE3resfail(); +extern bool_t xdr_CREATE3res(); +extern bool_t xdr_MKDIR3args(); +extern bool_t xdr_MKDIR3resok(); +extern bool_t xdr_MKDIR3resfail(); +extern bool_t xdr_MKDIR3res(); +extern bool_t xdr_symlinkdata3(); +extern bool_t xdr_SYMLINK3args(); +extern bool_t xdr_SYMLINK3resok(); +extern bool_t xdr_SYMLINK3resfail(); +extern bool_t xdr_SYMLINK3res(); +extern bool_t xdr_devicedata3(); +extern bool_t xdr_mknoddata3(); +extern bool_t xdr_MKNOD3args(); +extern bool_t xdr_MKNOD3resok(); +extern bool_t xdr_MKNOD3resfail(); +extern bool_t xdr_MKNOD3res(); +extern bool_t xdr_REMOVE3args(); +extern bool_t xdr_REMOVE3resok(); +extern bool_t xdr_REMOVE3resfail(); +extern bool_t xdr_REMOVE3res(); +extern bool_t xdr_RMDIR3args(); +extern bool_t xdr_RMDIR3resok(); +extern bool_t xdr_RMDIR3resfail(); +extern bool_t xdr_RMDIR3res(); +extern bool_t xdr_RENAME3args(); +extern bool_t xdr_RENAME3resok(); +extern bool_t xdr_RENAME3resfail(); +extern bool_t xdr_RENAME3res(); +extern bool_t xdr_LINK3args(); +extern bool_t xdr_LINK3resok(); +extern bool_t xdr_LINK3resfail(); +extern bool_t xdr_LINK3res(); +extern bool_t xdr_READDIR3args(); +extern bool_t xdr_entry3(); +extern bool_t xdr_dirlist3(); +extern bool_t xdr_READDIR3resok(); +extern bool_t xdr_READDIR3resfail(); +extern bool_t xdr_READDIR3res(); +extern bool_t xdr_READDIRPLUS3args(); +extern bool_t xdr_entryplus3(); +extern bool_t xdr_dirlistplus3(); +extern bool_t xdr_READDIRPLUS3resok(); +extern bool_t xdr_READDIRPLUS3resfail(); +extern bool_t xdr_READDIRPLUS3res(); +extern bool_t xdr_FSSTAT3args(); +extern bool_t xdr_FSSTAT3resok(); +extern bool_t xdr_FSSTAT3resfail(); +extern bool_t xdr_FSSTAT3res(); +extern bool_t xdr_FSINFO3args(); +extern bool_t xdr_FSINFO3resok(); +extern bool_t xdr_FSINFO3resfail(); +extern bool_t xdr_FSINFO3res(); +extern bool_t xdr_PATHCONF3args(); +extern bool_t xdr_PATHCONF3resok(); +extern bool_t xdr_PATHCONF3resfail(); +extern bool_t xdr_PATHCONF3res(); +extern bool_t xdr_COMMIT3args(); +extern bool_t xdr_COMMIT3resok(); +extern bool_t xdr_COMMIT3resfail(); +extern bool_t xdr_COMMIT3res(); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCxdr_nfs3h */ diff --git a/h/wrn/coreip/xdr_nfs_common.h b/h/wrn/coreip/xdr_nfs_common.h new file mode 100644 index 0000000..feeb3ca --- /dev/null +++ b/h/wrn/coreip/xdr_nfs_common.h @@ -0,0 +1,79 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _XDR_NFS_COMMON_H_RPCGEN +#define _XDR_NFS_COMMON_H_RPCGEN + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define NFS_PORT 2049 +#define NFS_MAXDATA 8192 +#define NFS_MAXPATHLEN 1024 +#define NFS_MAXNAMELEN 255 +#define NFS_PROGRAM 100003 + + +enum nfsstat { + NFS_OK = 0, + NFSERR_PERM = 1, + NFSERR_NOENT = 2, + NFSERR_IO = 5, + NFSERR_NXIO = 6, + NFSERR_ACCESS = 13, + NFSERR_EXIST = 17, + NFSERR_XDEV = 18, + NFSERR_NODEV = 19, + NFSERR_NOTDIR = 20, + NFSERR_ISDIR = 21, + NFSERR_INVAL = 22, + NFSERR_FBIG = 27, + NFSERR_NOSPC = 28, + NFSERR_ROFS = 30, + NFSERR_MLINK = 31, + NFSERR_NAMETOOLONG = 63, + NFSERR_NOTEMPTY = 66, + NFSERR_DQUOT = 69, + NFSERR_STALE = 70, + NFSERR_REMOTE = 71, + NFSERR_WFLUSH = 99, + NFSERR_BADHANDLE = 10001, + NFSERR_NOT_SYNC = 10002, + NFSERR_BAD_COOKIE = 10003, + NFSERR_NOTSUPP = 10004, + NFSERR_TOOSMALL = 10005, + NFSERR_SERVERFAULT = 10006, + NFSERR_BADTYPE = 10007, + NFSERR_JUKEBOX = 10008 +}; +typedef enum nfsstat nfsstat; + +typedef char *filename; + +typedef char *nfspath; + +/* the xdr functions */ + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t xdr_nfsstat (XDR *, nfsstat*); +extern bool_t xdr_filename (XDR *, filename*); +extern bool_t xdr_nfspath (XDR *, nfspath*); + +#else /* __STDC__ */ + +extern bool_t xdr_nfsstat(); +extern bool_t xdr_filename(); +extern bool_t xdr_nfspath(); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_XDR_NFS_COMMON_H_RPCGEN */ diff --git a/h/wrn/coreip/xdr_nlm4.h b/h/wrn/coreip/xdr_nlm4.h new file mode 100644 index 0000000..008816e --- /dev/null +++ b/h/wrn/coreip/xdr_nlm4.h @@ -0,0 +1,267 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef __INCxdrnlmh +#define __INCxdrnlmh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "xdr_nfs3.h" +#include + +#define LM_MAXSTRLEN 1024 +#define MAXNAMELEN LM_MAXSTRLEN+1 + +enum nlm4_stats { + NLM4_GRANTED = 0, + NLM4_DENIED = 1, + NLM4_DENIED_NOLOCKS = 2, + NLM4_BLOCKED = 3, + NLM4_DENIED_GRACE_PERIOD = 4, + NLM4_DEADLCK = 5, + NLM4_ROFS = 6, + NLM4_STALE_FH = 7, + NLM4_FBIG = 8, + NLM4_FAILED = 9 +}; +typedef enum nlm4_stats nlm4_stats; + +struct nlm4_holder { + bool_t exclusive; + int32 svid; + netobj oh; + uint64 l_offset; + uint64 l_len; +}; +typedef struct nlm4_holder nlm4_holder; + +struct nlm4_testrply { + nlm4_stats stat; + union { + struct nlm4_holder holder; + } nlm4_testrply_u; +}; +typedef struct nlm4_testrply nlm4_testrply; + +struct nlm4_stat { + nlm4_stats stat; +}; +typedef struct nlm4_stat nlm4_stat; + +struct nlm4_res { + netobj cookie; + nlm4_stat stat; +}; +typedef struct nlm4_res nlm4_res; + +struct nlm4_testres { + netobj cookie; + nlm4_testrply stat; +}; +typedef struct nlm4_testres nlm4_testres; + +struct nlm4_lock { + char *caller_name; + netobj fh; + netobj oh; + int32 svid; + uint64 l_offset; + uint64 l_len; +}; +typedef struct nlm4_lock nlm4_lock; + +struct nlm4_lockargs { + netobj cookie; + bool_t block; + bool_t exclusive; + struct nlm4_lock alock; + bool_t reclaim; + int state; +}; +typedef struct nlm4_lockargs nlm4_lockargs; + +struct nlm4_cancargs { + netobj cookie; + bool_t block; + bool_t exclusive; + struct nlm4_lock alock; +}; +typedef struct nlm4_cancargs nlm4_cancargs; + +struct nlm4_testargs { + netobj cookie; + bool_t exclusive; + struct nlm4_lock alock; +}; +typedef struct nlm4_testargs nlm4_testargs; + +struct nlm4_unlockargs { + netobj cookie; + struct nlm4_lock alock; +}; +typedef struct nlm4_unlockargs nlm4_unlockargs; +/* + * The following enums are actually bit encoded for efficient + * boolean algebra.... DON'T change them..... + */ + +enum fsh4_mode { + fsm_DN = 0, + fsm_DR = 1, + fsm_DW = 2, + fsm_DRW = 3 +}; +typedef enum fsh4_mode fsh4_mode; + +enum fsh4_access { + fsa_NONE = 0, + fsa_R = 1, + fsa_W = 2, + fsa_RW = 3 +}; +typedef enum fsh4_access fsh4_access; + +struct nlm4_share { + char *caller_name; + netobj fh; + netobj oh; + fsh4_mode mode; + fsh4_access access; +}; +typedef struct nlm4_share nlm4_share; + +struct nlm4_shareargs { + netobj cookie; + nlm4_share share; + bool_t reclaim; +}; +typedef struct nlm4_shareargs nlm4_shareargs; + +struct nlm4_shareres { + netobj cookie; + nlm4_stats stat; + int sequence; +}; +typedef struct nlm4_shareres nlm4_shareres; + +struct nlm4_notify { + char *name; + long state; +}; +typedef struct nlm4_notify nlm4_notify; + +#define NLM_PROG ((u_long)100021) +#define NLM4_VERS ((u_long)4) +#define NLMPROC4_NULL 0 +#define NLMPROC4_TEST 1 +#define NLMPROC4_LOCK 2 +#define NLMPROC4_CANCEL 3 +#define NLMPROC4_UNLOCK 4 +#define NLMPROC4_GRANTED 5 +#define NLMPROC4_TEST_MSG 6 +#define NLMPROC4_LOCK_MSG 7 +#define NLMPROC4_CANCEL_MSG 8 +#define NLMPROC4_UNLOCK_MSG 9 +#define NLMPROC4_GRANTED_MSG 10 +#define NLMPROC4_TEST_RES 11 +#define NLMPROC4_LOCK_RES 12 +#define NLMPROC4_CANCEL_RES 13 +#define NLMPROC4_UNLOCK_RES 14 +#define NLMPROC4_GRANTED_RES 15 +#define NLMPROC4_SHARE 20 +#define NLMPROC4_UNSHARE 21 +#define NLMPROC4_NM_LOCK 22 +#define NLMPROC4_FREE_ALL 23 + +#if defined(__STDC__) || defined(__cplusplus) +extern void * nlmproc4_null_4(void); +extern nlm4_testres * nlmproc4_test_4(nlm4_testargs *, struct svc_req *); +extern nlm4_res * nlmproc4_lock_4(nlm4_lockargs *, struct svc_req *); +extern nlm4_res * nlmproc4_cancel_4(nlm4_cancargs *, struct svc_req *); +extern nlm4_res * nlmproc4_unlock_4(nlm4_unlockargs *, struct svc_req *); +extern void * nlmproc4_test_msg_4(nlm4_testargs *, struct svc_req *); +extern void * nlmproc4_lock_msg_4(nlm4_lockargs *, struct svc_req *); +extern void * nlmproc4_cancel_msg_4(nlm4_cancargs *, struct svc_req *); +extern void * nlmproc4_unlock_msg_4(nlm4_unlockargs *, struct svc_req *); + +extern nlm4_shareres * nlmproc4_share_4(nlm4_shareargs *, struct svc_req *); +extern nlm4_shareres * nlmproc4_unshare_4(nlm4_shareargs *, struct svc_req *); +extern nlm4_res * nlmproc4_nm_lock_4(nlm4_lockargs *, struct svc_req *); +extern void * nlmproc4_free_all_4(nlm4_lockargs *, struct svc_req *); +extern int nlm_prog_4_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* __STDC__ */ + +extern void * nlmproc4_null_4(); +extern nlm4_testres * nlmproc4_test_4(); +extern nlm4_res * nlmproc4_lock_4(); +extern nlm4_res * nlmproc4_cancel_4(); +extern nlm4_res * nlmproc4_unlock_4(); +extern nlm4_res * nlmproc4_granted_4(); +extern void * nlmproc4_test_msg_4(); +extern void * nlmproc4_lock_msg_4(); +extern void * nlmproc4_cancel_msg_4(); +extern void * nlmproc4_unlock_msg_4(); +extern void * nlmproc4_granted_msg_4(); +extern void * nlmproc4_test_res_4(); +extern void * nlmproc4_lock_res_4(); +extern void * nlmproc4_cancel_res_4(); +extern void * nlmproc4_unlock_res_4(); +extern void * nlmproc4_granted_res_4(); +extern nlm4_shareres * nlmproc4_share_4(); +extern nlm4_shareres * nlmproc4_unshare_4(); +extern nlm4_res * nlmproc4_nm_lock_4(); +extern void * nlmproc4_free_all_4(); +extern int nlm_prog_4_freeresult(); +#endif /* __STDC__ */ + +/* the xdr functions */ +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t xdr_nlm4_stats (XDR *, nlm4_stats*); +extern bool_t xdr_nlm4_holder (XDR *, nlm4_holder*); +extern bool_t xdr_nlm4_testrply (XDR *, nlm4_testrply*); +extern bool_t xdr_nlm4_stat (XDR *, nlm4_stat*); +extern bool_t xdr_nlm4_res (XDR *, nlm4_res*); +extern bool_t xdr_nlm4_testres (XDR *, nlm4_testres*); +extern bool_t xdr_nlm4_lock (XDR *, nlm4_lock*); +extern bool_t xdr_nlm4_lockargs (XDR *, nlm4_lockargs*); +extern bool_t xdr_nlm4_cancargs (XDR *, nlm4_cancargs*); +extern bool_t xdr_nlm4_testargs (XDR *, nlm4_testargs*); +extern bool_t xdr_nlm4_unlockargs (XDR *, nlm4_unlockargs*); +extern bool_t xdr_fsh4_mode (XDR *, fsh4_mode*); +extern bool_t xdr_fsh4_access (XDR *, fsh4_access*); +extern bool_t xdr_nlm4_share (XDR *, nlm4_share*); +extern bool_t xdr_nlm4_shareargs (XDR *, nlm4_shareargs*); +extern bool_t xdr_nlm4_shareres (XDR *, nlm4_shareres*); +extern bool_t xdr_nlm4_notify (XDR *, nlm4_notify*); + +#else /* __STDC__ */ + +extern bool_t xdr_nlm4_stats(); +extern bool_t xdr_nlm4_holder(); +extern bool_t xdr_nlm4_testrply(); +extern bool_t xdr_nlm4_stat(); +extern bool_t xdr_nlm4_res(); +extern bool_t xdr_nlm4_testres(); +extern bool_t xdr_nlm4_lock(); +extern bool_t xdr_nlm4_lockargs(); +extern bool_t xdr_nlm4_cancargs(); +extern bool_t xdr_nlm4_testargs(); +extern bool_t xdr_nlm4_unlockargs(); +extern bool_t xdr_fsh4_mode(); +extern bool_t xdr_fsh4_access(); +extern bool_t xdr_nlm4_share(); +extern bool_t xdr_nlm4_shareargs(); +extern bool_t xdr_nlm4_shareres(); +extern bool_t xdr_nlm4_notify(); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCxdrnlmh */ diff --git a/h/wrn/coreip/zbufLib.h b/h/wrn/coreip/zbufLib.h new file mode 100644 index 0000000..9b4d659 --- /dev/null +++ b/h/wrn/coreip/zbufLib.h @@ -0,0 +1,131 @@ +/* zbufLib.h - zeroCopy buffer interface library header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,17mar04,rp updated to build for 5.5 +01a,19nov02,nee Ported to Accordion from ""zbufLib.h@@/main/1 from view tor3_x/tor3_x.synth". +*/ + +#ifndef __INCzbufLibh +#define __INCzbufLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* typedefs */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* HIDDEN */ + +typedef struct /* ZBUF_FUNC */ + { + FUNCPTR createRtn; /* zbufCreate() */ + FUNCPTR deleteRtn; /* zbufDelete() */ + FUNCPTR insertRtn; /* zbufInsert() */ + FUNCPTR insertBufRtn; /* zbufInsertBuf() */ + FUNCPTR insertCopyRtn; /* zbufInsertCopy() */ + FUNCPTR extractCopyRtn; /* zbufExtractCopy() */ + FUNCPTR cutRtn; /* zbufCut() */ + FUNCPTR splitRtn; /* zbufSplit() */ + FUNCPTR dupRtn; /* zbufDup() */ + FUNCPTR lengthRtn; /* zbufLength() */ + FUNCPTR segFindRtn; /* zbufSegFind() */ + FUNCPTR segNextRtn; /* zbufSegNext() */ + FUNCPTR segPrevRtn; /* zbufSegPrev() */ + FUNCPTR segDataRtn; /* zbufSegData() */ + FUNCPTR segLengthRtn; /* zbufSegLength() */ + } ZBUF_FUNC; + +/* Pools not used */ + +typedef struct zbufBlockId /* ZBUF_BLOCK_ID */ + { + int length; + void * segFree; + struct zbufPoolId * zbufPoolId; + struct zbufBlockId * blockNext; + } *ZBUF_BLOCK_ID; + +typedef struct zbufPoolId /* ZBUF_POOL_ID */ + { + int use; + SEM_ID poolSem; + SEM_ID waitSem; + struct zbufBlockId * blockHead; + } *ZBUF_POOL_ID; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +typedef void * ZBUF_ID; +typedef void * ZBUF_SEG; + +/* END_HIDDEN */ + +/* defines */ + +#define ZBUF_BEGIN -INT_MAX /* shortcut for prepending */ +#define ZBUF_END INT_MAX /* shortcut for appending */ +#define ZBUF_NONE ((ZBUF_SEG) NONE) /* cut past zbuf */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS zbufLibInit (FUNCPTR libInitRtn); +extern ZBUF_ID zbufCreate (void); +extern STATUS zbufDelete (ZBUF_ID zbufId); +extern ZBUF_SEG zbufInsert (ZBUF_ID zbufId1, ZBUF_SEG zbufSeg, int offset, + ZBUF_ID zbufId2); +extern ZBUF_SEG zbufInsertBuf (ZBUF_ID zbufId, ZBUF_SEG zbufSeg, int offset, + caddr_t buf, int len, VOIDFUNCPTR freeRtn, int freeArg); +extern ZBUF_SEG zbufInsertCopy (ZBUF_ID zbufId, ZBUF_SEG zbufSeg, + int offset, caddr_t buf, int len); +extern int zbufExtractCopy (ZBUF_ID zbufId, ZBUF_SEG zbufSeg, + int offset, caddr_t buf, int len); +extern ZBUF_SEG zbufCut (ZBUF_ID zbufId, ZBUF_SEG zbufSeg, int offset, int len); +extern ZBUF_ID zbufSplit (ZBUF_ID zbufId, ZBUF_SEG zbufSeg, int offset); +extern ZBUF_ID zbufDup (ZBUF_ID zbufId, ZBUF_SEG zbufSeg, int offset, int len); +extern int zbufLength (ZBUF_ID zbufId); +extern ZBUF_SEG zbufSegFind (ZBUF_ID zbufId, ZBUF_SEG zbufSeg, int *pOffset); +extern ZBUF_SEG zbufSegNext (ZBUF_ID zbufId, ZBUF_SEG zbufSeg); +extern ZBUF_SEG zbufSegPrev (ZBUF_ID zbufId, ZBUF_SEG zbufSeg); +extern caddr_t zbufSegData (ZBUF_ID zbufId, ZBUF_SEG zbufSeg); +extern int zbufSegLength (ZBUF_ID zbufId, ZBUF_SEG zbufSeg); + +#else /* __STDC__ */ + +extern STATUS zbufLibInit (); +extern ZBUF_ID zbufCreate (); +extern STATUS zbufDelete (); +extern ZBUF_SEG zbufInsert (); +extern ZBUF_SEG zbufInsertBuf (); +extern ZBUF_SEG zbufInsertCopy (); +extern int zbufExtractCopy (); +extern ZBUF_SEG zbufCut (); +extern ZBUF_ID zbufSplit (); +extern ZBUF_ID zbufDup (); +extern int zbufLength (); +extern ZBUF_SEG zbufSegFind (); +extern ZBUF_SEG zbufSegNext (); +extern ZBUF_SEG zbufSegPrev (); +extern caddr_t zbufSegData (); +extern int zbufSegLength (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCzbufLibh */ diff --git a/h/wrn/coreip/zbufSockLib.h b/h/wrn/coreip/zbufSockLib.h new file mode 100644 index 0000000..3d649b9 --- /dev/null +++ b/h/wrn/coreip/zbufSockLib.h @@ -0,0 +1,78 @@ +/* zbufSockLib.h - zeroCopy buffer socket interface library header */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,04nov03,rlm Ran batch header path update for header re-org. +01b,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org. +01a,19nov02,nee Ported to Accordion from ""zbufSockLib.h@@/main/1 from view tor3_x/tor3_x.synth". +*/ + +#ifndef __INCzbufSockLibh +#define __INCzbufSockLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include + + +/* typedefs */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct /* ZBUF_SOCK_FUNC */ + { + FUNCPTR libInitRtn; /* zbufLibInit() */ + FUNCPTR sendRtn; /* zbufSockSend() */ + FUNCPTR sendtoRtn; /* zbufSockSendto() */ + FUNCPTR bufSendRtn; /* zbufSockBufSend() */ + FUNCPTR bufSendtoRtn; /* zbufSockBufSend() */ + FUNCPTR recvRtn; /* zbufSockRecv() */ + FUNCPTR recvfromRtn; /* zbufSockRecvfrom() */ + } ZBUF_SOCK_FUNC; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS zbufSockLibInit (void); +extern int zbufSockSend (int s, ZBUF_ID zbufId, int zbufLen, int flags); +extern int zbufSockSendto (int s, ZBUF_ID zbufId, int zbufLen, int flags, + struct sockaddr *to, int tolen); +extern int zbufSockBufSend (int s, char *buf, int bufLen, + VOIDFUNCPTR freeRtn, int freeArg, int flags); +extern int zbufSockBufSendto (int s, char *buf, int bufLen, + VOIDFUNCPTR freeRtn, int freeArg, int flags, + struct sockaddr *to, int tolen); +extern ZBUF_ID zbufSockRecv (int s, int flags, int *pLen); +extern ZBUF_ID zbufSockRecvfrom (int s, int flags, int *pLen, + struct sockaddr *from, int *pFromLen); + +#else /* __STDC__ */ + +extern STATUS zbufSockLibInit (); +extern int zbufSockSend (); +extern int zbufSockSendto (); +extern int zbufSockBufSend (); +extern int zbufSockBufSendto (); +extern ZBUF_ID zbufSockRecv (); +extern ZBUF_ID zbufSockRecvfrom (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCzbufSockLibh */ diff --git a/h/wrn/dot1x/dot1xAuthLib.h b/h/wrn/dot1x/dot1xAuthLib.h new file mode 100644 index 0000000..76e01c6 --- /dev/null +++ b/h/wrn/dot1x/dot1xAuthLib.h @@ -0,0 +1,174 @@ +/* dot1xAuthLib.h - 802.1X Authenticator Definitions */ + +/* Copyright 2002-2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01p,23sep05,eja Break SNMP dependency +01o,05aug05,eja Version 2.1 update +01n,30may05,eja cleanup +01m,17may05,eja Clean up header dependencies +01l,04feb05,eja 80211i/WPA integration +01k,17jan05,eja Add mode element to PAE object +01j,03jan05,eja Cleanup +01i,30apr03,ss added version info +01h,21apr03,ggg File name, location change +01g,21feb03,ggg Update copyright dates +01f,22jan03,ggg Add key slots ifConfig members +01e,31oct02,ggg Remove warning +01d,13may02,mef to clean-up the code +01c,25mar02,mef to add more configure option to interface +01b,04mar02,mef to add interface configuration structure +01a,26Dec01,mef written. + +*/ + +/* +DESCRIPTION + +This file contains the definitions that are used by different +components of the system to interact with 802.1X Framework. + +*/ + +#ifndef __INCdot1xAuthLibh +#define __INCdot1xAuthLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define DOT1X_AUTH_VERSION "2.1" +IMPORT UCHAR *dot1xAuthVersion; + +/* typedefs */ + +/* Result code types used between 802.1X SNMP MIB + * support and 1X Framework. + */ +typedef enum + { + DOT1X_AUTH_MIB_SET_DONE, + DOT1X_AUTH_MIB_SET_WAIT, + DOT1X_AUTH_MIB_SET_ERROR + } DOT1X_AUTH_MIB_SET_STATUS; + +/* Physical Network Interface Type */ + +typedef enum + { + DOT1X_AUTH_WIRED_IF = 1, + DOT1X_AUTH_WIRELESS_IF + } DOT1X_AUTH_IF_TYPE; + +/* Interface Operation Type */ + +typedef enum + { + DOT1X_AUTH_WIRELESS = 1, + DOT1X_AUTH_MULTIPLE_HOST, + DOT1X_AUTH_SINGLE_HOST + } DOT1X_AUTH_IF_OPR_TYPE; + +/* WEP Key Types */ + +typedef enum + { + DOT1X_AUTH_40BIT_KEY = 1, + DOT1X_AUTH_128BIT_KEY + } DOT1X_AUTH_WEP_KEY_TYPE; + +/* UCAST Key Support Types */ + +typedef enum + { + DOT1X_AUTH_NO_UCAST_KEY = 1, + DOT1X_AUTH_FAKE_UCAST_KEY, + DOT1X_AUTH_REAL_UCAST_KEY + } DOT1X_AUTH_UCAST_SUPPORT; + +typedef struct + { + /* Interface Type */ + DOT1X_AUTH_IF_TYPE type; + + /* Interface operation type. If interface is "WIRELESS", it must be + * "WIRELESS". If interface is "WIRED", all three possible values can + * be used. */ + DOT1X_AUTH_IF_OPR_TYPE operationType; + + /* Inactivity Timeout for a port. (second) */ + int inactivityTimeout; + + /* Connectivity Timeout for a port.(second) */ + int connectivityTimeout; + + /* Following configuration fields are usable only for "WIRELESS" + * interfaces. */ + + /* WEP Key Length */ + DOT1X_AUTH_WEP_KEY_TYPE wepKeyType; + + /* Interface uses slot 0 as static WEP key. It may be used to support + * MD5 supplicants. In that case 1X AUTH will only renew MCAST key in + * slot 1. */ + BOOL staticWepKeySupport; + + /* If the static WEP key will be supported, the key info must be + *provided. */ + char *staticWepKey; + + /* Renewal Timeout for MCAST Key. (second) */ + int mcastKeyPeriod; + + /* UCAST Key support*/ + DOT1X_AUTH_UCAST_SUPPORT ucastKeySupportType; + + /* Use session key as UCAST key or generate UCAST key and deliver it. */ + BOOL ucastKeyIsSessionKey; + + /* Renewal Timeout in for UCAST Key. (second) */ + int ucastKeyPeriod; + + /* Slots used for uCast */ + UINT32 ucastKeySlots; + + /* Slots uses for mCast */ + UINT32 mcastKeySlots; + } DOT1X_AUTH_IF_CONFIG; + +typedef struct + { + UINT32 taskPriority; /* 1X AUTH Task Priority*/ + UINT32 nbrOfPorts; /* number of estimated active ports at a moment */ + FUNCPTR eapolAsfAlert; /* pointer to the EAPOL_ASF_ALERT messages */ + int replayCntType; /* Replay Cnt Type in EAPOL-Key message */ + int ntpExecMode; + char * ntpSvrIpAddr; /* NTP Sever IP Address */ + FUNCPTR ntpTimeGetFunc; + void * pMib; + } DOT1X_AUTH_SYS_CONFIG; + +/* definitions */ + +#define DOT1X_AUTH_INVALID_PORT_NBR 0 + +/* Function Prototypes */ + +IMPORT STATUS dot1xAuthInit (DOT1X_AUTH_SYS_CONFIG *); +STATUS dot1xAuthPortListShow(int); +IMPORT STATUS dot1xAuthShutdown(VOID); +IMPORT STATUS dot1xAuthAttach(INT32, UCHAR *, DOT1X_AUTH_IF_CONFIG *); +IMPORT STATUS dot1xAuthDetach(INT32, UCHAR *); +IMPORT STATUS dot1xAuthTimerTimeoutSend (UINT32, int, UINT8); +IMPORT DOT1X_AUTH_MIB_SET_STATUS dot1xAuthMibSet(UINT32, INT32, VOID *, + UINT32, FUNCPTR, INT32); +#ifdef __cplusplus +} +#endif + +#endif /* __INCdot1xAuthLibh */ diff --git a/h/wrn/dot1x/dot1xAuthSvrLib.h b/h/wrn/dot1x/dot1xAuthSvrLib.h new file mode 100644 index 0000000..28fad64 --- /dev/null +++ b/h/wrn/dot1x/dot1xAuthSvrLib.h @@ -0,0 +1,89 @@ +/* dot1xAuthSvrLib.h - IEEE 802.1X Authetication Server interface file*/ + +/* Copyright 2002-2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,21apr03,ggg File name, location change +01a,08Feb02,myz written +*/ + + +#ifndef __INCdot1xAuthSvrLibh +#define __INCdot1xAuthSvrLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#define DOT1X_AS_NORMAL_SHUTDOWN 0 /* Library shutdown type, normal shutdown*/ +#define DOT1X_AS_FORCE_SHUTDOWN 1 /* Library shutdown type, forced shutdown*/ +#define DOT1X_AS_STATION_ID_LEN 6 /* attribute station ID length */ + +#define DOT1X_AS_WIRELESS_PORT_TYPE 19 /* wireless port type */ +#define DOT1X_AS_ETHERNET_PORT_TYPE 15 /* ethernet port type */ + +#define DOT1X_AS_SESSION_SEND_KEY 1 /* key type, session send key */ +#define DOT1X_AS_SESSION_RCEV_KEY 2 /* key type, session receive key */ + +/* Result codes of the authentication server interface */ + +enum DOT1X_AS_CODE { + DOT1X_AS_ACCESS_ACCEPT = 1, /* access accept code */ + DOT1X_AS_ACCESS_REJECT, /* access reject code */ + DOT1X_AS_ACCOUNTING_RESPONSE, /* accounting response code */ + DOT1X_AS_ACCESS_CHALLENGE, /* access challenge code */ + DOT1X_AS_SESSION_KEY, /* session key received code */ + DOT1X_AS_GEN_ERROR, /* general error code */ + DOT1X_AS_RETRY_LIMIT_REACHED /* server retry limit reached code */ + }; + +/*** typedefs ***/ + +/* attribute header structure, attributes deliverd to user */ + +typedef struct { + UINT16 type; /* what type of attribute */ + UINT16 len; /* length of the attribute, excluding header */ + } DOT1X_AS_ATTR_HEADER_T; + +#define DOT1X_AS_ATTR_HEADER_LEN (sizeof(DOT1X_AS_ATTR_HEADER_T)) + +/* The required user supplied info for sending the EAP packet */ + +typedef struct { + FUNCPTR pUserCallback; /* routine called when reply comes back */ + int mtu; /* MTU Max Tranmission Unit */ + char * pId; /* User Identification */ + int len; /* length of the User Identification */ + char callingId[DOT1X_AS_STATION_ID_LEN]; /* source MAC address */ + char calledId [DOT1X_AS_STATION_ID_LEN]; /* Port MAC address */ + UINT8 * pState; /* State attribute if there is one */ + int sLen; /* length of the previous field */ + int portType; /* port type */ + } DOT1X_AS_REQUIRED_INFO; + + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS dot1xAuthServerEapMsgSend (UINT32 msgHandle, UINT8 * pMsg, + int len, + DOT1X_AS_REQUIRED_INFO * pInfo); +extern STATUS dot1xAuthServerLibInit (void); +extern STATUS dot1xAuthServerLibShutDown (int); + +#else + +extern STATUS dot1xAuthServerEapMsgSend(); +extern STATUS dot1xAuthServerLibInit (); +STATUS dot1xAuthServerLibShutDown (); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdot1xAuthSvrLibh */ diff --git a/h/wrn/dot1x/dot1xAuthTimerLib.h b/h/wrn/dot1x/dot1xAuthTimerLib.h new file mode 100644 index 0000000..1ec18de --- /dev/null +++ b/h/wrn/dot1x/dot1xAuthTimerLib.h @@ -0,0 +1,61 @@ +/* dot1xAuthTimerLib.h - 802.1X Authenticator Timer Manager Definitions */ + +/* Copyright 2002-2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01c,21apr03,ggg File name, location change +01b,13may02,mef to clean up the code. +01a,26Dec01,mef written. + +*/ + +/* +DESCRIPTION + +*/ + +#ifndef __INCdot1xAuthTimerLibh +#define __INCdot1xAuthTimerLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + +/* typedefs */ + +typedef enum /* DOT1X Timer Types */ + /* For detailed Information + check standard pg.34 + */ + { + DOT1X_AUTH_TIMER_AWHILE, /* aWhile Timer */ + DOT1X_AUTH_TIMER_QUIETWHILE, /* quietWhile Timer */ + DOT1X_AUTH_TIMER_REAUTHWHEN, /* reAuthWhen Timer */ + DOT1X_AUTH_TIMER_TXWHEN, /* txWhen Timer */ + DOT1X_AUTH_TIMER_INTERNAL /* 1x Auth Internal Timer */ + } DOT1X_AUTH_TIMER_TYPE; + +/* definitions */ + +#define DOT1X_AUTH_TIMER_NBR 5 /* # of timers */ + +/* Function Prototypes */ + +IMPORT int dot1xAuthTimerManagerInit (INT32); +IMPORT UINT32 dot1xAuthTimerTickGet (); +IMPORT STATUS dot1xAuthTimerManagerShutdown (); +IMPORT STATUS dot1xAuthTimerStart (UINT32, DOT1X_AUTH_TIMER_TYPE, UINT16, UINT8); +IMPORT STATUS dot1xAuthTimerStop (UINT32, DOT1X_AUTH_TIMER_TYPE, UINT8); +IMPORT STATUS dot1xAuthTimerStopAll (UINT32); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdot1xAuthTimerLibh */ + diff --git a/h/wrn/dot1x/dot1xCommonIoctls.h b/h/wrn/dot1x/dot1xCommonIoctls.h new file mode 100644 index 0000000..fe48ef2 --- /dev/null +++ b/h/wrn/dot1x/dot1xCommonIoctls.h @@ -0,0 +1,257 @@ +/* dot1xCommonIoctls.h - 802.1X required shadow ioctls */ + +/* Copyright 2002-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01j,31aug05,eja Fix for trace bug B0086 +01i,17may05,eja Add API +01h,10may05,eja Add user mode ioctls +01g,20apr05,eja Add Base6.1 ioctls +01f,01mar05,rb Modified definitions of WIOCSDOT1XPORTSTATUS and + WIOCSAUTHCALLBACK +01e,23feb05,rb Updated to new IOCTL scheme for WED 2.1 +01d,04feb05,eja 80211i/WPA integration +01c,18jan05,eja Add structure and enums for 802.11i integration +01b,11jan05,rb Pruned IOCTL list for new integration with wireless driver +01a,10jan05,rb Added new IOCTLs for 2.0 release +*/ + +/* +DESCRIPTION +*/ + +#ifndef __INCdot1xCommonIoctlsh +#define __INCdot1xCommonIoctlsh + +#ifdef __cplusplus +extern "C" { +#endif + +/***************************************************************************** +* Public DOT11 IOCTL Commands +*****************************************************************************/ +#include "sys/ioctl.h" + +/* For backwards compatability, define the "user mode" IOCTL macros manually +if they are not already defined. They should be defined in vxWorks 6.1 and +higher */ + +#ifndef IOC_USER +#define IOC_USER 0x8000 +#endif /* IOC_USER */ + +#ifndef _IOU +#define _IOU(x,y) (IOC_USER | _IO(x,y)) +#endif + +#ifndef _IORU +#define _IORU(x,y,t) (IOC_USER | _IOR(x,y,t)) +#endif + +#ifndef _IOWU +#define _IOWU(x,y,t) (IOC_USER | _IOW(x,y,t)) +#endif + +#ifndef _IOWRU +#define _IOWRU(x,y,t) (IOC_USER | _IOWR(x,y,t)) +#endif + +/* These are types used to define the access lengths in the "WIOC" IOCTLS */ +#define DOT11_ADDR_LEN 6 +typedef UINT8 DOT11_ADDR[DOT11_ADDR_LEN]; + +#define DOT11_PMK_LEN 32 +typedef UINT8 DOT11_PMK[DOT11_PMK_LEN]; + +/* 802.1X port status enumeration */ +typedef enum + { + DOT1X_PORTSTATUS_UNCONTROLLED = 0, + DOT1X_PORTSTATUS_CLOSED, + DOT1X_PORTSTATUS_OPEN + } DOT1X_PORT_STATUS; + +/* 802.1X port event type enumeration */ +typedef enum + { + DOT1X_PORTEVENT_ASSOCIATION = 1, + DOT1X_PORTEVENT_DISASSOCIATION + } DOT1X_PORT_EVENT; + +typedef struct + { + INT32 status; /* Port status */ + UINT8 macAddr[6]; /* mac address of the port */ + } _WRS_PACK_ALIGN(1) DOT1X_PORTSTATUS; + +typedef struct param_s + { + UINT32 callback; /* Callback event handler */ + UINT32 cookie; /* private data */ + } _WRS_PACK_ALIGN(1) DOT1X_PARAMS; + +/*************************************************************************** +* WIOCSCIPHPOL - Set the available cipher suites +****************************************************************************/ +typedef unsigned long int DOT11_KEY_TYPE; +#define DOT11_KEY_SEARCH (65536) +#define DOT11_CIPHPOL_NONE 0 +#define DOT11_CIPHPOL_WEP40 (0x01) +#define DOT11_CIPHPOL_WEP104 (0x02) +#define DOT11_CIPHPOL_TKIP (0x04) +#define DOT11_CIPHPOL_AES (0x08) +#define DOT11_KEY_TYPE_NONE 0 +#define DOT11_KEY_TYPE_WEP40 DOT11_CIPHPOL_WEP40 +#define DOT11_KEY_TYPE_WEP104 DOT11_CIPHPOL_WEP104 +#define DOT11_KEY_TYPE_TKIP DOT11_CIPHPOL_TKIP +#define DOT11_KEY_TYPE_AES DOT11_CIPHPOL_AES +#define DOT11_WEP40_KEY_SIZE 5 /* Bytes */ +#define DOT11_WEP104_KEY_SIZE 13 /* Bytes */ +#define DOT11_AES_KEY_SIZE 16 /* Bytes */ +#define DOT11_TKIP_KEY_SIZE 32 /* 16 Bytes key, 2x8 bytes MIC */ +typedef struct + { + DOT11_KEY_TYPE keyType; + INT32 keySlot; /* Keyslot key was installed to */ + UINT8 macAddr[DOT11_ADDR_LEN]; + union + { + UINT8 wep40[DOT11_WEP40_KEY_SIZE]; + UINT8 wep104[DOT11_WEP104_KEY_SIZE]; + UINT8 aes[DOT11_AES_KEY_SIZE]; + UINT8 tkip[DOT11_TKIP_KEY_SIZE]; + } type; + } DOT11_KEY; + +/* These parameters shadow the current wlan ioctls but are defined +here to reduce unneeded intermodule dependencies */ +#define EIOCGWEPSTATUS (0x20f) /* Get WEP status*/ +#define EIOCSWEP (0x210) /* Enable/disable WEP */ +#define EIOCSWEPKEY0 (0x211) /* Set WEP key 0*/ +#define EIOCSWEPKEY1 (0x212) /* Set WEP key 1*/ +#define EIOCSWEPKEY2 (0x213) /* Set WEP key 2*/ +#define EIOCSWEPKEY3 (0x214) /* Set WEP key 3*/ +#define EIOCSWEPDEFAULTKEY (0x215) /* Set default WEP key */ +#define EIOCSWEPTYPE (0x21d) /* Set WEP type - 64 bit or 128 bit */ +#define EIOCSUNICASTKEYNUM (0x22b) /* Set unicast key slot */ +#define EIOCSMULTICASTKEYNUM (0x22d) /* Set multicast key slot */ +#define EIOCGCONNECTEDBSSID (0x220) /* Get BSSID */ +#define EIOCSAUTHCALLBACK (0x24B) /* Register authentication callback */ +#define EIOCS802DOT1XMODE (0x24C) /* Set 802.1x mode */ +#define EIOCG802DOT1XMODE (0x24D) /* Get 802.1x mode status */ + +#define WIOCGCONNECTEDBSSID _IORU('w', 0x006, DOT11_ADDR) +#define WIOCGSECPOL _IORU('w', 0x051, UINT32) +#define WIOCSPMK _IOWU('x', 0x03, DOT11_PMK) +#define WIOCSAUTHCALLBACK _IOW('x', 0x02,DOT1X_PARAMS) +#define WIOCSDOT1XPORTSTATUS _IOW('x', 0x01,DOT1X_PORTSTATUS) +#define WIOCAPAIRWISEKEY _IOWU('w', 0x04f, DOT11_KEY) +#define WIOCDPAIRWISEKEY _IOWU('w', 0x62, DOT11_ADDR) +#define WIOCSENCRYPTTYPE _IOU('w', 0x016) +#define WIOCDPAIRWISEKEY _IOWU('w', 0x62, DOT11_ADDR) + +#define ONEX_MODE_ENABLED (1) +#define DOT11_40_BIT_KEY_SIZE (5) /* Num bytes in 40 bit key */ +#define DOT11_128_BIT_KEY_SIZE (13) /* Num bytes in 128 bit key */ +#define WLAN_WEP_ENABLED (TRUE) /* Use wep */ +#define WLAN_WEP_NUM_KEYS (4) /* Max number of static keys stored */ +#define WLAN_WEP_TYPE_64 (64) /* 40/64 bit encryption */ +#define WLAN_WEP_TYPE_128 (128) /* 104/128 bit encryption */ +#define DOT1X_80211_PMK_LEN (32) +#define DOT1X_80211_ADDR_LEN (6) +#define DOT1X_SECPOL_NONE (0) +#define DOT1X_SECPOL_TSN (1) +#define DOT1X_SECPOL_WPA (2) +#define DOT1X_SECPOL_11i (4) + +/* 802.1x user ioctls */ +typedef struct dot1x_rtp_args + { + void *arg0; /* The first argument is the device id */ + char arg1[256]; /* Each arg there after has 256 bytes allocated */ + char arg2[256]; + char arg3[256]; + char arg4[256]; + char arg5[256]; + char arg6[256]; + } DOT1X_RTP_ARGS; + +/* Ioctl defines */ + +/* dot1xSuppLibInit() - Create root task */ +#define EIOCSUPPLIBINIT _IORU('d', 0x000, DOT1X_RTP_ARGS) + +/* dot1xSuppCreate() - Create and add a supplicant to the root task list */ +#define EIOCSUPPCREATE _IORU('d', 0x001, DOT1X_RTP_ARGS) + +/* dot1xSuppDelete() - Destroy and delete a supplicant from root task list */ +#define EIOCSUPPDELETE _IORU('d', 0x002, DOT1X_RTP_ARGS) + +/* dot1xSuppLogonSet() - Set the username and password for a supplicant */ +#define EIOCSUPPLOGONSET _IOWU('d', 0x003, DOT1X_RTP_ARGS) + +/* dot1xSuppLogonGet() - Get the username and password for a supplicant */ +#define EIOCSUPPLOGONGET _IORU('d', 0x004, DOT1X_RTP_ARGS) + +/* dot1xSuppCertInfoSet() - Set information used by cert based authentication */ +#define EIOCSUPPCERTINFOSET _IOWU('d', 0x005, DOT1X_RTP_ARGS) + +/* dot1xSuppCertInfoGet() - Get information used by cert based authentication */ +#define EIOCSUPPCERTINFOGET _IORU('d', 0x006, DOT1X_RTP_ARGS) + +/* dot1xSuppPacketTrace() - Enable or Disable packet trace */ +#define EIOCSUPPPACKETTRACE _IORU('d', 0x007, DOT1X_RTP_ARGS) + +/* dot1xSuppEventLogFlush() - Flush supplicant event log */ +#define EIOCSUPPEVENTLOGFLUSH _IORU('d', 0x008, DOT1X_RTP_ARGS) + +/* dot1xSuppIdGet() - Get supplicant ID based on instance number */ +#define EIOCSUPPIDGET _IORU('d', 0x009, DOT1X_RTP_ARGS) + +/* dot1xSuppConnect() - Force supplicant to connect to NAS */ +#define EIOCSUPPCONNECT _IORU('d', 0x00A, DOT1X_RTP_ARGS) + +/* dot1xSuppShutdownAll() - Shutdown all supplicants and delete all tasks */ +#define EIOCSUPPSHUTDOWNALL _IORU('d', 0x00B, DOT1X_RTP_ARGS) + +/* dot1xSuppEapTypeEnable() - Enable EAP method - Kernel/User mode */ +#define EIOCSUPPEAPTYPEENABLE _IORU('d', 0x00C, DOT1X_RTP_ARGS) + +/* dot1xSuppEapTypeDisable() - Disable EAP method */ +#define EIOCSUPPEAPTYPEDISABLE _IORU('d', 0x00D, DOT1X_RTP_ARGS) + +/* dot1xSuppHandlerCacheInstall() - Install handler cache into supplicant */ +#define EIOCSUPPHDLRCACHEINSTALL _IORU('d', 0x00E, DOT1X_RTP_ARGS) + +/* dot1xAuthServerLibInit() - Init authentication server */ +#define EIOCAUTHSVRLIBINIT _IORU('d', 0x00F, DOT1X_RTP_ARGS) + +/* dot1xAuthServerLibShutDown() - Shutdown authentication server */ +#define EIOCAUTHSVRLIBSHUTDOWN _IORU('d', 0x010, DOT1X_RTP_ARGS) + +/* dot1xAuthInit() - Shutdown authentication server */ +#define EIOCAUTHINIT _IORU('d', 0x020, DOT1X_RTP_ARGS) + +/* dot1xAuthShutdown() - Shutdown authenticator */ +#define EIOCAUTHSHUTDOWN _IORU('d', 0x030, DOT1X_RTP_ARGS) + +/* dot1xAuthAttach() - Attach to authenticator */ +#define EIOCAUTHATTACH _IORU('d', 0x040, DOT1X_RTP_ARGS) + +/* dot1xAuthDetach() - Detach from authenticator */ +#define EIOCAUTHDETACH _IORU('d', 0x050, DOT1X_RTP_ARGS) + +/* dot1xAuthWlanConfig() - Configure wlan device on authenticator */ +#define EIOCAUTHWLANCONFIG _IORU('d', 0x060, DOT1X_RTP_ARGS) + +/* Virtual END driver init method - Base6.1 only */ +void *dot1xVirtEndDevInit(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdot1xCommonIoctlsh */ diff --git a/h/wrn/dot1x/dot1xDebugLib.h b/h/wrn/dot1x/dot1xDebugLib.h new file mode 100644 index 0000000..38e241b --- /dev/null +++ b/h/wrn/dot1x/dot1xDebugLib.h @@ -0,0 +1,69 @@ +/* dot1xDebugLibP.h - 802.1X debug header */ + +/* Copyright 2005-2006 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01c,28sep05,eja Change enum DOT1X_ERROR_NONE to 0 +01b,23sep05,eja Add support for mschapv2, gtc, and md5 debugging areas +01a,09sep05,eja Make debug call printf from logMsg +*/ + +/* +DESCRIPTION +*/ + +#ifndef __INCdot1xDebugLibh +#define __INCdot1xDebugLibh + +#include +#include + +/* Dot1x debug levels */ +typedef enum + { + DOT1X_DEBUG_NONE = 0, + DOT1X_DEBUG_FATAL, + DOT1X_DEBUG_ERROR, + DOT1X_DEBUG_INFO, + DOT1X_DEBUG_FLOOD + } DOT1X_DEBUG_LEVELS; + +/* Dot1x debug areas */ +typedef enum + { + DOT1X_AREA_ALL = 0, + DOT1X_AREA_INIT, + DOT1X_AREA_SUPP, + DOT1X_AREA_AUTH, + DOT1X_AREA_LEAP, + DOT1X_AREA_PEAP, + DOT1X_AREA_TLS, + DOT1X_AREA_TTLS, + DOT1X_AREA_MSCHAPV2, + DOT1X_AREA_MD5, + DOT1X_AREA_GTC, + DOT1X_AREA_EAPOL + } DOT1X_DEBUG_AREAS; +extern INT32 dot1xDebugArray[]; + +#define DOT1X_LOG(level, area, message) \ + if ((level) <= dot1xDebugArray[(area)]) printf message + +#ifdef __cplusplus +extern "C" { +#endif + +extern STATUS dot1xDebugLevelSet + ( + int area, /* Debug area to get level for */ + int level /* Debug level to set */ + ); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdot1xDebugLibh */ diff --git a/h/wrn/dot1x/dot1xDesLib.h b/h/wrn/dot1x/dot1xDesLib.h new file mode 100644 index 0000000..c4ecab3 --- /dev/null +++ b/h/wrn/dot1x/dot1xDesLib.h @@ -0,0 +1,51 @@ +/* dot1xDesLib.h - IEEE 802.1X DES interface file*/ + +/* Copyright 2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,21Apr03,ggg written +*/ + + +#ifndef __INCdot1xDesLibh +#define __INCdot1xDesLibh + +/* + * this DES implementation derived from Phil Karn's public domain DES. + */ + +#ifdef __cplusplus +extern"C" { +#endif + +#include "vxWorks.h" + +typedef ULONG DES_KS[16][2]; /* Single-key DES key schedule */ + +typedef struct + { + int decrypt; + DES_KS keysched; + UCHAR iv[8]; + } DES_CTX; + +#ifndef _EXCLUDE_PROTOTYPES_ + +void deskey (DES_KS, UCHAR *,int); +void des (DES_KS, UCHAR *, UCHAR *); + +#endif /* ifndef _EXCLUDE_PROTOTYPES_ */ + +IMPORT void dot1xDesKey(DES_KS , UCHAR *, int); +IMPORT void dot1xDes(DES_KS, UCHAR *, UCHAR *); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdot1xDesLibh */ + diff --git a/h/wrn/dot1x/dot1xEapLib.h b/h/wrn/dot1x/dot1xEapLib.h new file mode 100644 index 0000000..377961a --- /dev/null +++ b/h/wrn/dot1x/dot1xEapLib.h @@ -0,0 +1,81 @@ +/* dot1xEapLib.h - 802.1X EAP specific library header file */ + +/* Copyright 2002-2005 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01d,22sep05,eja API change +01c,09sep05,eja Add APIs +01b,05aug05,eja Version 2.1 update +01a,17may05,eja Remove dependencies on EAPOL lib +*/ + +#ifndef __INCdot1xEapLibh +#define __INCdot1xEapLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* Maximum amount of data an EAP_REQRSP_PACKET will hold */ +#define EAP_REQRSP_PACKET_MAX_DATA ETHERMTU + +/* The EAP types (methods), values are ID's from applicable RFC's */ +#define EAP_TYPE_IDENTITY 1 +#define EAP_TYPE_NOTIFY 2 +#define EAP_TYPE_NAK 3 +#define EAP_TYPE_MD5 4 +#define EAP_TYPE_OTP 5 +#define EAP_TYPE_GTC 6 +#define EAP_TYPE_TLS 13 +#define EAP_TYPE_LEAP 17 +#define EAP_TYPE_TTLS 21 +#define EAP_TYPE_PEAP 25 +#define EAP_TYPE_MSCHAPV2 26 +#define EAP_TYPE_TLV 33 +#define EAP_TYPE_VENDOR 255 + +/* EAP header */ +typedef struct eap_pkt_hdr + { + char code; /* kind of EAP packet, DOT1X_EAP_CODE */ + char ident; /* identifier of which request or response */ + UINT16 size; /* size of packet */ + char type; /* type of EAP, EAP_TYPE_XXX */ + } _WRS_PACK_ALIGN(1) EAP_PKT_HDR; + +typedef struct eap_hdr_s + { + char code; /* kind of EAP packet, DOT1X_EAP_CODE */ + char identifier; /* identifier of which request or response */ + UINT16 length; /* size of packet */ + } _WRS_PACK_ALIGN(1) EAP_HDR; + +/* EAP Packet codes */ +typedef enum + { + EAP_REQUEST = 1, + EAP_RESPONSE, + EAP_SUCCESS, + EAP_FAILURE + } DOT1X_EAP_PACKET_CODE; + +/* EAP and management */ +STATUS dot1xSuppEapPktReceive(int, char *, char, char, UINT16, void *); +STATUS dot1xSuppEapPktSend(int, void *); +STATUS dot1xSuppEapPktError(int, char *, UINT32); +void ** dot1xEapTypeToString(char, void **); +void dot1xEapCodeToString(char, void **); +int dot1xEapStringToType(void *); +void dot1xEapTypesShow(void); +void dot1xEapCodesShow(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdot1xEapLibh */ diff --git a/h/wrn/dot1x/dot1xEapolLib.h b/h/wrn/dot1x/dot1xEapolLib.h new file mode 100644 index 0000000..beb9376 --- /dev/null +++ b/h/wrn/dot1x/dot1xEapolLib.h @@ -0,0 +1,190 @@ +/* dot1xEapolLib.h - 802.1X EAPOL Definitions */ + +/* Copyright 2002-2005 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01j,18mar05,eja Added logging +01i,03mar05,eja Fix prototype misspelling +01h,01mar05,eja API change and file cleanup +01g,04feb05,eja 80211i/WPA integration +01f,12jan05,eja Add PAE MAC address for wireline mode +01e,21dec04,eja Add function prototype +01d,21apr03,ggg File name, location change +01c,25apr02,mef to clean up the code +01b,04mar02,mef to add EAPOL Header Len Macro +01a,26Dec01,mef written. + +*/ + +/* +DESCRIPTION + +This file contains the definitions and the function prototype +that is used by EAPOL (EAP Over LAN) protcol layer. + +*/ + +#ifndef __INCdot1xEapolLibh +#define __INCdot1xEapolLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* vxworks types */ +#include +#include +#include + +/* typedefs */ + +/* DOT1X EAPOL Msg Types - For detailed Information check standard +pg.15 7.5.4 */ +typedef enum + { + DOT1X_EAPOL_EAP_PACKET = 0, /* EAP Packet */ + DOT1X_EAPOL_START, /* EAPOL Start */ + DOT1X_EAPOL_LOGOFF, /* EAPOL Logoff */ + DOT1X_EAPOL_KEY, /* EAPOL Key */ + DOT1X_EAPOL_ASF_ALERT /* EAPOL Encapsulated ASF Alert */ + } DOT1X_EAPOL_PACKET_TYPE; + +/* definitions */ +#define SIOCGIFNDX _IOR('i', 130, struct ifreq) /* get ifnet index */ +#define SIOCGIFTYPE _IOR('i', 140, struct ifreq) /* get if type */ +#define SIOCGADDR EIOCGADDR /* get src MAC address */ + +/* dot1xEapol Receive Error Definitions */ +#define DOT1X_EAPOL_RCV_INVALID_FRAME_ERR ((UINT32)0) +#define DOT1X_EAPOL_RCV_FRAME_LEN_ERR ((UINT32)1) + +/* EAPOL Header Length */ +#define DOT1X_EAPOL_HEADER_LEN 4 +#define DOT1X_EAPOL_PROTOCOL_VERSION ((UCHAR)0x01) +#define DOT1X_EAPOL_PAE_MAC "\x01\x80\xC2\x00\x00\x03" + +/* EAPOL, especially key handling +(duplicated from dot1xEapolMuxAdapter.c) */ +#define DOT1X_EAPOL_ETHERNET_HEADER_SIZE 4 + +/* Length of initialization vector for decrypting keys */ +#define DOT1X_EAPOL_KEY_IV_SIZE 16 + +/* Length of timestamp in EAPOL Key messages */ +#define DOT1X_EAPOL_KEY_REPLAY_COUNTER_SIZE 8 + +/* EAPOL Key type */ +#define EAPOL_KEY_TYPE_WB4 1 + +/* Size of an EAPOL key descriptor without the key +1 + 2 + 8 + 16 + 1 + 16 */ +#define EAPOL_KEY_DESCRIPTOR_MIN_LENGTH 44 + +/* Biggest key to handle for 802.11 */ +#define EAPOL_KEY_MAX_SIZE DOT11_128_BIT_KEY_SIZE + +/* Unicast keys have the high bit set in the index */ +#define EAPOL_KEY_UNICAST_BIT 0x80 +#define EAPOL_KEY_INDEX_MASK 0x7F + +#define EAPOL_LOG_FATAL "(f) " __FILE__ " (s) FATAL (r) " +#define EAPOL_LOG_ERROR "(f) " __FILE__ " (s) ERROR (r) " +#define EAPOL_LOG_INFO "(f) " __FILE__ " (s) INFO (r) " +#define EAPOL_LOG_DEBUG "(f) " __FILE__ " (s) DEBUG (r) " + +/* EAPOL header */ +typedef struct + { + char version; /* EAPOL version */ + char type; /* DOT1X_EAPOL_PACKET_TYPE in dot1xEapolP.h */ + UINT16 length; /* EAPOL packet length */ + } _WRS_PACK_ALIGN(1) EAPOL_HDR; + +/* EAPOL Key message */ +typedef struct + { + EAPOL_HDR eapolHeader; /* EAPOL header needed for signature */ + char type; /* Type of key: WB4 = 0x01 */ + UINT16 length; /* Key size in bytes */ + char replay[DOT1X_EAPOL_KEY_REPLAY_COUNTER_SIZE]; /* Replay */ + char iv[DOT1X_EAPOL_KEY_IV_SIZE]; /* IV for decrypt of key */ + char index; /* Key slot. Bit 8 set for unicast */ + char signature[HMAC_MD5_RESULT_LENGTH]; /* Signature HMAC-MD5 */ + char keyStart; /* Start key data. none: use session key */ + } _WRS_PACK_ALIGN(1) EAPOL_KEY_DESCRIPTOR; + +/* Function Prototypes */ +IMPORT STATUS dot1xEapolSend + ( + VOID *cookie,/* EAPOL cookie of device */ + char *dstMacAddress, /* destination MAC address */ + UINT16 packetType, /* EAPOL packet type */ + UINT16 packetLen, /* length of packet body */ + char* packetBody /* packet body */ + ); +IMPORT VOID *dot1xEapolFindByDevice + ( + INT32 unit, /* unit number */ + char* name /* device name */ + ); +IMPORT STATUS dot1xEapolIoctl + ( + VOID *cookie, /* cookie indentifying the device */ + INT32 cmd, /* command to pass to ioctl */ + caddr_t data /* data needed for command in cmd */ + ); +IMPORT STATUS dot1xEapolLibInit + ( + VOID + ); +IMPORT STATUS dot1xEapolInit + ( + UINT32 eapolMaxUnits /* max bindings */ + ); +IMPORT STATUS dot1xEapolAttach + ( + INT32 unit, /* unit number */ + char *name /* device name */ + ); +IMPORT STATUS dot1xEapolDetach + ( + INT32 unit, /* unit number */ + char *name /* device name */ + ); +IMPORT STATUS dot1xEapolBind + ( + INT32 unit,/* unit number of interface */ + char *name, /* device name of interface */ + VOID *cookie, /* cookie of Binding PDU */ + VOID *rcvRtn, /* function ptr to receive routine of protocol */ + VOID *rcvErrRtn /* function ptr to received packet error routine */ + ); +IMPORT STATUS dot1xEapolUnbind + ( + INT32 unit, /* unit number */ + char *name, /* device name */ + VOID *rcvRtn /* pointer to receive routine of upper layer protocol */ + ); +IMPORT VOID *dot1xEapolIfNameGet + ( + VOID *pObj /* Device object */ + ); +IMPORT INT32 dot1xEapolIfNumGet + ( + VOID *pObj /* Device object */ + ); +STATUS dot1xEapolLogCallbackInstall + ( + VOID *cookie,/* EAPOL cookie of device */ + VOID *callback /* Device object */ + ); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdot1xEapolLibh */ + diff --git a/h/wrn/dot1x/dot1xKeyLib.h b/h/wrn/dot1x/dot1xKeyLib.h new file mode 100644 index 0000000..9ad5cf9 --- /dev/null +++ b/h/wrn/dot1x/dot1xKeyLib.h @@ -0,0 +1,78 @@ +/* dot1xKeyLib.h - IEEE 802.1X Key management interface header file*/ + +/* Copyright 2002-2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,21apr03,ggg File name, location change +01a,28Feb02,myz written +*/ + + +#ifndef __INCdot1xKeyLibh +#define __INCdot1xKeyLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/*** defines ***/ + +/* dot1xKeyLibInit argument values */ + +#define DOT1X_KEY_TIME_ASYNC_MODE 0 /* run in asynchronise mode */ +#define DOT1X_KEY_TIME_SYNC_MODE 1 /* run in synchronise mode */ + +/*** typedefs ***/ + +typedef enum { + DOT1X_AUTH_SNTP_COUNTER, /* Use NTP time value for the replay counter */ + DOT1X_AUTH_LOCAL_COUNTER /* Use local count value for the replay counter*/ + } DOT1X_AUTH_REPLAY_CNT_TYPE; + +typedef struct { + UINT8 * pKey; /* points to a key */ + int len; /* key length */ + } DOT1X_AUTH_GENERIC_KEY_DESC; + +typedef struct { + DOT1X_AUTH_GENERIC_KEY_DESC key; /* the key descriptor */ + UINT8 index; /* key index */ + } DOT1X_AUTH_WEP_KEY_DESC; + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS dot1xAuthWepKeyGenerate (DOT1X_AUTH_GENERIC_KEY_DESC *, + DOT1X_AUTH_GENERIC_KEY_DESC *); +extern STATUS dot1xAuthEapolKeyPacketBuild (char *, UINT8, + DOT1X_AUTH_GENERIC_KEY_DESC *, + DOT1X_AUTH_WEP_KEY_DESC *); +extern void dot1xKeyLibInit (DOT1X_AUTH_REPLAY_CNT_TYPE,int,char *, FUNCPTR); +extern void dot1xKeyNtpTimeServerSet (char *); +extern void dot1xKeyNtpTimeGetFuncSet (FUNCPTR); +extern void dot1xKeyRandomKeySet (UINT8 *); +extern void dot1xKeyRandomSeedSet (UINT8 *,int); +extern void dot1xKeyNtpTimeGetAsync (void); +extern void dot1xKeyNtpTimeGet (void); + +#else + +extern STATUS dot1xAuthWepKeyGenerate(); +extern STATUS dot1xAuthEapolKeyPacketBuild(); +extern void dot1xKeyLibInit(); +extern void dot1xKeyNtpTimeGetAsync (); +extern void dot1xKeyNtpTimeGet (); +extern void dot1xKeyNtpTimeServerSet(); +extern void dot1xKeyNtpTimeGetFuncSet(); +extern void dot1xKeyRandomSeedSet (); +extern void dot1xKeyRandomKeySet (); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* end #ifndef __INCdot1xKeyLibh */ diff --git a/h/wrn/dot1x/dot1xMdLib.h b/h/wrn/dot1x/dot1xMdLib.h new file mode 100644 index 0000000..10fddb3 --- /dev/null +++ b/h/wrn/dot1x/dot1xMdLib.h @@ -0,0 +1,38 @@ +/* dot1xMdLib.h - 802.1X supplicant message digest library header file */ + +/* Copyright 2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,21apr03,ggg written. +*/ + +#ifndef __INCdot1xMdLibh +#define __INCdot1xMdLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Algorithms: MD4 or MD5 */ +typedef enum +{ + MD4 = 0x04, + MD5 = 0x05 +} MD_ALGORITHM; + +#define HMAC_MD5_RESULT_LENGTH 16 /* HMAC-MD5 result length */ + +/* Prototypes */ +extern void dot1xMd(unsigned char *, unsigned long, unsigned char *, + MD_ALGORITHM); +extern void dot1xHmacMd5(unsigned char *, int, unsigned char *, int, + unsigned char *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdot1xMdLibh */ diff --git a/h/wrn/dot1x/dot1xMemPartLib.h b/h/wrn/dot1x/dot1xMemPartLib.h new file mode 100644 index 0000000..f4fc12b --- /dev/null +++ b/h/wrn/dot1x/dot1xMemPartLib.h @@ -0,0 +1,56 @@ +/* dot1xMemPartLib.h - 802.1X memory partition specific library header */ + +/* Copyright 2002-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01g,26jul05,eja Add malloc macro +01f,27jun05,eja Set released pointer to NULL. +01e,25apr05,eja Remove setting released pointer to NULL to fix DIAB error +01d,20apr05,eja Changes to DOT1X_FREE macro +01c,28mar05,eja Increase minimum memory partition to 512KB +01b,15dec04,eja Reduce the memory partition size from 1MB to 128KB +01a,08dec04,eja Fix for Trace bug B004 +*/ + +/* +DESCRIPTION +*/ + +#ifndef __INCdot1xMemPartLibh +#define __INCdot1xMemPartLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* Macros for memory partition access */ +#define DOT1X_CALLOC(n,s) dot1xMemBlockCalloc(n,s) +#define DOT1X_MALLOC(n,s) dot1xMemBlockMalloc(n,s) +#define DOT1X_FREE(m) \ +{ \ +dot1xMemBlockFree((void*)m); \ +m = NULL; \ +} + +/* Set the maximum memory size of the partition */ +#define DOT1X_MEM_PART_SZ_MAX (0x00080000) /* 512KB of memory max */ +#define DOT1X_MEM_PART_SZ_MIN (0x00010000) /* 64 KB memory min */ +#define DOT1X_MEM_PART_STATS_MODE (1) /* 1 - verbose partition stats */ + +STATUS dot1xMemPartLibInit(void); +void * dot1xMemBlockCalloc(size_t, size_t); +void * dot1xMemBlockMalloc(size_t, size_t); +STATUS dot1xMemBlockFree(void *); +STATUS dot1xMemPartShow(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdot1xSuppLibPh */ diff --git a/h/wrn/dot1x/dot1xMibLib.h b/h/wrn/dot1x/dot1xMibLib.h new file mode 100644 index 0000000..0e3e0fc --- /dev/null +++ b/h/wrn/dot1x/dot1xMibLib.h @@ -0,0 +1,365 @@ +/* dot1xMibLib.h - 802.1X MIB API to SNMP Agent header file */ + +/* Copyright 2002-2005 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01d,22sep05,eja Add new structure to allow for IDE based module binding +01c,05jul05,eja Add support for supplicant MIB +01b,06jun02,myz changed name UINT64 to UINT64_S +01a,15Jan02,myz written +*/ + +#ifndef __INCdot1xMibLibh +#define __INCdot1xMibLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/**** MIB variable IDs ****/ + +#define D1XM_VAR_PaeSystemAuth 0x10 + +/* Group IDs */ + +#define D1XM_VAR_PORT_ENTRY 0x100 +#define D1XM_VAR_AUTH_CFG_ENTRY 0x200 +#define D1XM_VAR_AUTH_STATS_ENTRY 0x300 +#define D1XM_VAR_AUTH_DIAG_ENTRY 0x400 +#define D1XM_VAR_AUTH_SESSION_ENTRY 0x500 +#define D1XM_VAR_SUPP_CFG_ENTRY 0x600 +#define D1XM_VAR_SUPP_STATS_ENTRY 0x700 + +/* PAE Port Variables */ + +#define D1XM_VAR_PaePortNumber 0x110 +#define D1XM_VAR_PaePortProtocolVersion 0x120 +#define D1XM_VAR_PaePortCapabilities 0x130 +#define D1XM_VAR_PaePortInitialize 0x140 +#define D1XM_VAR_PaePortReauthenticate 0x150 + +/* Authenticator Configuration variables */ + +#define D1XM_VAR_AuthPaeState 0x210 +#define D1XM_VAR_AuthBackendAuthState 0x220 +#define D1XM_VAR_AuthAdminControlledDirections 0x230 +#define D1XM_VAR_AuthOperControlledDirections 0x240 +#define D1XM_VAR_AuthAuthControlledPortStatus 0x250 +#define D1XM_VAR_AuthControlledPortControl 0x260 +#define D1XM_VAR_AuthQuietPeriod 0x270 +#define D1XM_VAR_AuthTxPeriod 0x280 +#define D1XM_VAR_AuthSuppTimeout 0x290 +#define D1XM_VAR_AuthServerTimeout 0x2A0 +#define D1XM_VAR_AuthMaxReq 0x2B0 +#define D1XM_VAR_AuthReauthPeriod 0x2C0 +#define D1XM_VAR_AuthReauthEnabled 0x2D0 +#define D1XM_VAR_AuthKeyTxEnabled 0x2E0 + +/* Authenticator Stats Variables */ + +#define D1XM_VAR_AuthEapolFramesRx 0x310 +#define D1XM_VAR_AuthEapolFramesTx 0x320 +#define D1XM_VAR_AuthEapolStartFramesRx 0x330 +#define D1XM_VAR_AuthEapolLogoffFramesRx 0x340 +#define D1XM_VAR_AuthEapolRespIdFramesRx 0x350 +#define D1XM_VAR_AuthEapolRespFramesRx 0x360 +#define D1XM_VAR_AuthEapolReqIdFramesTx 0x370 +#define D1XM_VAR_AuthEapolReqFramesTx 0x380 +#define D1XM_VAR_AuthInvalidEapolFramesRx 0x390 +#define D1XM_VAR_AuthEapLengthErrorFramesRx 0x3A0 +#define D1XM_VAR_AuthLastEapolFrameVersion 0x3B0 +#define D1XM_VAR_AuthLastEapolFrameSource 0x3C0 + +/* Authenticator Diagnostic Variables */ + +#define D1XM_VAR_AuthEntersConnecting 0x410 +#define D1XM_VAR_AuthEapLogoffsWhileConnecting 0x420 +#define D1XM_VAR_AuthEntersAuthenticating 0x430 +#define D1XM_VAR_AuthAuthSuccessWhileAuthenticating 0x440 +#define D1XM_VAR_AuthAuthTimeoutsWhileAuthenticating 0x450 +#define D1XM_VAR_AuthAuthFailWhileAuthenticating 0x460 +#define D1XM_VAR_AuthAuthReauthsWhileAuthenticating 0x470 +#define D1XM_VAR_AuthAuthEapStartsWhileAuthenticating 0x480 +#define D1XM_VAR_AuthAuthEapLogoffWhileAuthenticating 0x490 +#define D1XM_VAR_AuthAuthReauthsWhileAuthenticated 0x4A0 +#define D1XM_VAR_AuthAuthEapStartsWhileAuthenticated 0x4B0 +#define D1XM_VAR_AuthAuthEapLogoffWhileAuthenticated 0x4C0 +#define D1XM_VAR_AuthBackendResponses 0x4D0 +#define D1XM_VAR_AuthBackendAccessChallenges 0x4E0 +#define D1XM_VAR_AuthBackendOtherRequestsToSupplicant 0x4E2 +#define D1XM_VAR_AuthBackendNonNakResponsesFromSupplicant 0x4E4 +#define D1XM_VAR_AuthBackendAuthSuccesses 0x4E6 +#define D1XM_VAR_AuthBackendAuthFails 0x4E8 + +/* Authenticator Session Stats Variables */ + +#define D1XM_VAR_AuthSessionOctetsRx 0x510 +#define D1XM_VAR_AuthSessionOctetsTx 0x520 +#define D1XM_VAR_AuthSessionFramesRx 0x530 +#define D1XM_VAR_AuthSessionFramesTx 0x540 +#define D1XM_VAR_AuthSessionId 0x550 +#define D1XM_VAR_AuthSessionAuthenticMethod 0x560 +#define D1XM_VAR_AuthSessionTime 0x570 +#define D1XM_VAR_AuthSessionTerminateCause 0x580 +#define D1XM_VAR_AuthSessionUserName 0x590 + +/* Supplicant Configuration Varibles */ + +#define D1XM_VAR_SuppPaeState 0x610 +#define D1XM_VAR_SuppHeldPeriod 0x620 +#define D1XM_VAR_SuppAuthPeriod 0x630 +#define D1XM_VAR_SuppStartPeriod 0x640 +#define D1XM_VAR_SuppMaxStart 0x650 + +/* Supplicant Statistics Varibles */ + +#define D1XM_VAR_SuppEapolFramesRx 0x710 +#define D1XM_VAR_SuppEapolFramesTx 0x720 +#define D1XM_VAR_SuppEapolStartFramesTx 0x730 +#define D1XM_VAR_SuppEapolLogoffFramesTx 0x740 +#define D1XM_VAR_SuppEapolRespIdFramesTx 0x750 +#define D1XM_VAR_SuppEapolRespFramesTx 0x760 +#define D1XM_VAR_SuppEapolReqIdFramesRx 0x770 +#define D1XM_VAR_SuppEapolReqFramesRx 0x780 +#define D1XM_VAR_SuppInvalidEapolFramesRx 0x790 +#define D1XM_VAR_SuppEapLengthErrorFramesRx 0x7A0 +#define D1XM_VAR_SuppLastEapolFrameVersion 0x7B0 +#define D1XM_VAR_SuppLastEapolFrameSource 0x7C0 + +/* simple type used for imitating 64 bit integers */ + +typedef struct + { + UINT32 high; + UINT32 low; + } UINT64_S; + +/* SystemAuthControl */ + +typedef UINT32 D1XM_SYSTEM_AUTH_CONTROL; + +/* dot1xPaePortTable 9.6.1 System Configuration */ + +typedef enum { + D1XM_dot1xPaePortAuthCapable=0, + D1XM_dot1xPaePortSuppCapable + } D1XM_PORT_CAP_TYPE; + +typedef struct { + UINT32 paePortNumber; /* port number */ + UINT32 paePortProtocolVersion; /*Protocol version */ + UINT8 paePortCapabilities[1]; /*PAE capabilities */ + UINT8 padding[3]; + UINT32 paePortInitialize; /* Initialize Port */ + UINT32 paePortReauthenticate; + } D1XM_PAE_PORT_ENTRY; + +/* dot1xAuthConfigTable 9.4.1 Authenticator Configuration */ + +typedef struct { + UINT32 paePortNumber; /* port number */ + UINT32 authPaeState; /* Authenticator PAE State */ + UINT32 authBackendAuthState; /* Backend Authentication State */ + UINT32 authAdminControlledDirections; /* AdminControlledDirections */ + UINT32 authOperControlledDirections; /* OperControlledDirections */ + UINT32 authAuthControlledPortStatus; /* AuthControlledPortStatus */ + UINT32 authAuthControlledPortControl; /* AuthControlledPortControl */ + UINT32 authQuietPeriod; /* quietPeriod */ + UINT32 authTxPeriod; /* txPeriod */ + UINT32 authSuppTimeout; /* suppTimeout */ + UINT32 authServerTimeout; /* serverTimeout */ + UINT32 authMaxReq; /* maxReq */ + UINT32 authReAuthPeriod; /* reAuthPeriod */ + UINT32 authReAuthEnabled; /* reAuthEnabled */ + UINT32 authKeyTxEnabled; /* KeyTransmissionEnabled */ + UINT32 PaePortReauthenticate; /* Reauthenticate */ + } D1XM_AUTH_CONFIG_ENTRY; + +/* dot1xAuthStatsTable 9.4.2 Authenticator Statistics */ + +typedef struct { + UINT32 paePortNumber; /* port number */ + UINT32 authEapolFramesRx; /* EAPOL frames received */ + UINT32 authEapolFramesTx; /* EAPOL frames transmitted */ + UINT32 authEapolStartFramesRx; /* EAPOL Start frames received */ + UINT32 authEapolLogoffFramesRx; /* EAPOL Logoff frames received */ + UINT32 authEapolRespIdFramesRx; /* EAP Resp/Id frames received */ + UINT32 authEapolRespFramesRx; /* EAP Response frames received */ + UINT32 authEapolReqIdFramesTx; /* EAP Req/Id frames transmitted */ + UINT32 authEapolReqFramesTx; /* EAP Request frames transmitted */ + UINT32 authInvalidEapolFramesRx; /* Invalid EAPOL frames received */ + UINT32 authEapLengthErrorFramesRx; /* EAP length error frames received */ + UINT32 authLastEapolFrameVersion; /* Last EAPOL frame version */ + UINT8 authLastEapolFrameSource[6]; /* Last EAPOL frame source */ + } D1XM_AUTH_STATS_ENTRY; + +/* dot1xAuthDiagTable 9.4.3 Authenticator Diagnostics */ + +typedef struct { + UINT32 paePortNumber; /* port number */ + UINT32 authEntersConnecting; + UINT32 authEapLogoffsWhileConnecting; + UINT32 authEntersAuthenticating; + UINT32 authAuthSuccessWhileAuthenticating; + UINT32 authAuthTimeoutsWhileAuthenticating; + UINT32 authAuthFailWhileAuthenticating; + UINT32 authAuthReauthsWhileAuthenticating; + UINT32 authAuthEapStartsWhileAuthenticating; + UINT32 authAuthEapLogoffWhileAuthenticating; + UINT32 authAuthReauthsWhileAuthenticated; + UINT32 authAuthEapStartsWhileAuthenticated; + UINT32 authAuthEapLogoffWhileAuthenticated; + UINT32 authBackendResponses; + UINT32 authBackendAccessChallenges; + UINT32 authBackendOtherRequestsToSupplicant; + UINT32 authBackendNonNakResponsesFromSupplicant; + UINT32 authBackendAuthSuccesses; + UINT32 authBackendAuthFails; + } D1XM_AUTH_DIAG_ENTRY; + +/* dot1xAuthSessionStatsTable 9.4.4 Authenticator Session Statistics */ + +typedef struct { + UINT32 paePortNumber; /* port number */ + UINT64_S authSessionOctetsRx; /* Session Octets Received */ + UINT64_S authSessionOctetsTx; /* Session Octets Transmitted */ + UINT32 authSessionFramesRx; /* Session Frames Received */ + UINT32 authSessionFramesTx; /* Session Frames Transmitted */ + char * authSessionId; /* Session Identifier */ + UINT32 authSessionAuthenticMethod; /* Session Authentication Method */ + UINT32 authSessionTime; /* Session Time */ + UINT32 authSessionTerminateCause; /* Session Terminate Cause */ + char * authSessionUserName; /* Session User Name */ + } D1XM_AUTH_SESSION_STATS_ENTRY; + +/* dot1xSuppConfigTable 9.5.1 Supplicant Configuration */ + +typedef struct { + UINT32 paePortNumber; /* port number */ + UINT32 suppPaeState; /* Supplicant PAE State */ + UINT32 suppHeldPeriod; /* heldPeriod */ + UINT32 suppAuthPeriod; /* authPeriod */ + UINT32 suppStartPeriod; /* startPeriod */ + UINT32 suppMaxStart; /* maxStart */ + } D1XM_SUPP_CONFIG_ENTRY; + +/* dot1xSuppStatsTable 9.5.2 Supplicant Statistics */ + +typedef struct { + UINT32 paePortNumber; /* port number */ + UINT32 suppEapolFramesRx; /* EAPOL frames received */ + UINT32 suppEapolFramesTx; /* EAPOL frames transmitted */ + UINT32 suppEapolStartFramesTx; /* EAPOL Start frames transmitted */ + UINT32 suppEapolLogoffFramesTx; /* EAPOL Logoff frames transmitted */ + UINT32 suppEapolRespIdFramesTx; /* EAP Resp/Id frames transmitted */ + UINT32 suppEapolRespFramesTx; /* EAP Response frames transmitted */ + UINT32 suppEapolReqIdFramesRx; /* EAP Req/Id frames received */ + UINT32 suppEapolReqFramesRx; /* EAP Request frames received */ + UINT32 suppInvalidEapolFramesRx; /* Invalid EAPOL frames received */ + UINT32 suppEapLengthErrorFramesRx; /* EAP length error frames received */ + UINT32 suppLastEapolFrameVersion; /* Last EAPOL frame version */ + UINT8 suppLastEapolFrameSource[6]; /* Last EAPOL frame source */ + } D1XM_SUPP_STATS_ENTRY; + +/* dot1xPaeSystem group */ + +typedef struct { + D1XM_SYSTEM_AUTH_CONTROL authControl; + D1XM_PAE_PORT_ENTRY portTable; + } D1XM_PAE_SYSTEM_GROUP; + +/* dot1xPaeAuthenticator group */ + +typedef struct { + D1XM_AUTH_CONFIG_ENTRY cfgTbl; /* configuration table */ + D1XM_AUTH_STATS_ENTRY statsTbl; /* STATS table */ + D1XM_AUTH_DIAG_ENTRY diagTbl; /* diagnostics table */ + D1XM_AUTH_SESSION_STATS_ENTRY sessionTbl; /* authenticator session stats*/ + } D1XM_PAE_AUTHENTICATOR_GROUP; + +/* dot1xPaeSupplicant Group */ + +typedef struct { + D1XM_SUPP_CONFIG_ENTRY cfgTbl; /* supplicant configuration table */ + D1XM_SUPP_STATS_ENTRY statsTbl; /* supplicant stats table */ + } D1XM_PAE_SUPPLICANT_GROUP; + +typedef struct { + D1XM_PAE_PORT_ENTRY portGrp; + D1XM_PAE_AUTHENTICATOR_GROUP authGrp; + D1XM_PAE_SUPPLICANT_GROUP suppGrp; + } D1XM_PORT_ENTRY; + +/* MIB handler type */ +typedef enum + { + DOT1X_AUTH_BINDING = 0, /* authenticator MIB */ + DOT1X_SUPP_BINDING /* supplicant MIB */ + } DOT1X_MIB_BIND; + +/* MIB module attachment */ +typedef struct + { + STATUS (*pInstallHandler)(); + STATUS (*pRemoveHandler)(); + } DOT1X_MIB_MODULE_BINDING; + +/* MIB handler structure */ +typedef struct + { + int (*get)(); /* get method */ + int (*next)(); /* next method */ + int (*set)(); /* set method */ + } DOT1X_MIB_FUNC_TABLE; + +/* authenticator and supplicant MIB handlers */ +typedef struct + { + DOT1X_MIB_FUNC_TABLE *authHandler; /* authenticator table */ + DOT1X_MIB_FUNC_TABLE *suppHandler; /* supplicant table */ + } DOT1X_MIB_HANDLER; + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +STATUS dot1xMibVarGet (UINT32, int, void*, int); +STATUS dot1xMibVarSet (UINT32, int, void*, int); +STATUS dot1xMibNewPortAdded (UINT32,D1XM_AUTH_CONFIG_ENTRY *); +STATUS dot1xMibPortRemoved (UINT32); +STATUS dot1xMibSnmpEntryGet (UINT32, int, void*, int); +STATUS dot1xMibSnmpNextEntryGet (UINT32 *, int, void*, int); +STATUS dot1xMibSnmpVarSet (UINT32, UINT32, UINT32); +STATUS dot1xMibNextPortVarGet (UINT32*, int, void*, int); +STATUS dot1xMibLibInit(void); +STATUS dot1xMibHandlerInstall(void *, int); +STATUS dot1xMibHandlerRemove(void *, int); +STATUS dot1xMibAdd(void); + +#else /* __STDC__ */ + +STATUS dot1xMibVarGet (); +STATUS dot1xMibVarSet (); +STATUS dot1xMibNewPortAdded (); +STATUS dot1xMibPortRemoved (); +STATUS dot1xMibSnmpEntryGet (); +STATUS dot1xMibSnmpNextEntryGet (); +STATUS dot1xMibSnmpVarSet (); +STATUS dot1xMibNextPortVarGet (); +STATUS dot1xMibLibInit(); +STATUS dot1xMibHandlerInstall(); +STATUS dot1xMibHandlerRemove(); +STATUS dot1xMibAdd(); +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdot1xMibLibh */ + diff --git a/h/wrn/dot1x/dot1xSuppCommonLib.h b/h/wrn/dot1x/dot1xSuppCommonLib.h new file mode 100644 index 0000000..c373410 --- /dev/null +++ b/h/wrn/dot1x/dot1xSuppCommonLib.h @@ -0,0 +1,29 @@ +/* dot1xMdLib.h - 802.1X supplicant common routines header file */ + +/* Copyright 2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,26aug03,ggg written. +*/ + +#ifndef __INCdot1xSuppCommonLibh +#define __INCdot1xSuppCommonLibh + +#ifdef __cplusplus +extern "C" { +#endif + +extern void dot1xSuppUnicode(char *, char *); +extern void dot1xSuppNtPasswordHash(UINT8 *, int, UINT8 *); +extern void dot1xSuppDesKeyBitInsert(UINT8 *, UINT8 *); +extern void dot1xSuppChallengeResponse(UINT8 * , UINT8 * , UINT8 *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdot1xSuppCommonLibh */ + diff --git a/h/wrn/dot1x/dot1xSuppLib.h b/h/wrn/dot1x/dot1xSuppLib.h new file mode 100644 index 0000000..3d3d1cf --- /dev/null +++ b/h/wrn/dot1x/dot1xSuppLib.h @@ -0,0 +1,390 @@ +/* dot1xSuppLib.h - 802.1X supplicant non-EAP specific library header file */ + +/* Copyright 2002-2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +02q,05oct05,rb Further fix to B0223 +02p,04oct05,eja Fix for trace bug B0223 +02o,23sep05,eja add state variable to SUPP_DEV_OBJ +02n,22sep05,eja Major clean up on supplicant PAE data structure +02m,09sep05,eja API change +02l,31aug05,eja Add unicast key state variable to DOT1X_SUPP_PAE +02k,29aug05,eja API change for dot1xSuppIdGet +02j,05aug05,eja Version 2.1 update +02i,25jul05,eja API change and cleanup +02h,06jul05,eja Redefine supplicant state enumerations +02g,27jun05,eja Cleanup +02f,02jun05,eja Add statistics for physical port state and mac address +02e,30may05,eja change default log size to 10 entries from 200 +02d,12may05,eja Add members for wep key stats +02c,10may05,eja Add API dot1xSuppHandlerCacheInstall() +02b,09may05,eja Change dot1xSuppShutdownAll() API +02a,04may05,eja Add member to handler type to enable/disable eap type. +01z,20apr05,eja Remove extra includes for Base6.1 RTP compliance +01y,11apr05,eja Add new structure member +01x,24mar05,eja Add debug event counters +01w,23mar05,eja Add stats for debugging to PAE +01v,22mar05,eja Add reset timer member to PAE +01u,22mar05,eja Add reset flag member to PAE +01t,18mar05,eja Moved EAP types to separate file and added logging +01s,01mar05,eja Code cleanup +01r,18jan05,eja Add 802.1X 2001 rev MIB statistics +01q,05jan05,eja Add authWith element to DOT1X_SUPP_PAE +01p,21dec04,eja Add public API prototype and make DOT1X_MODE type mirror BOOL. +01o,08dec04,eja Fix trace bug B001 +01n,07dec04,eja Updated support +01m,19oct04,eja Added support for multiple supplicants +01l,03dec03,dxb Updated from code review +01k,21aug03,ggg Add separate sign key in addition to session key +01j,05may03,ggg Undefine debug macro by default +01i,30apr03,ss added version info +01h,21apr03,ggg File name, location change +01g,15apr03,ggg Update copyright date +01f,15apr03,ggg Further preparation for additional EAP types support +01e,08jul02,ggg Undef debug by default +01d,08jul02,ggg Update debug macro +01c,14jun02,ggg Diab sensitivities +01b,11jun02,ggg Add code review comments +01a,26mar02,ggg written. +*/ + +#ifndef __INCdot1xSuppLibh +#define __INCdot1xSuppLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* supplicant version info */ +#define DOT1X_SUPP_VERSION "2.1" +IMPORT char * dot1xSuppVersion; + +/* Flag to indicate special conditions between "base" supplicant layer +and the authentication protocol implementing a specific EAP method +above it. */ +#define DOT1X_SUPP_DESTROY (void*)(0xFFFFFFFF) /* Shutdown and free */ +#define DOT1X_SUPP_SUCCESS (void*)(0xFFFFFFFE) /* authentication success */ + +/* Maximum sizes for username and password. Must fit in a RADIUS +attribute */ +#define DOT1X_SUPP_MAX_USERNAME_LENGTH 256 +#define DOT1X_SUPP_MAX_PASSWORD_LENGTH 256 + +/* Maxium sizes for session key. Must fit in a RADIUS attribute */ +#define DOT1X_SUPP_MAX_SESSION_KEY_LENGTH 256 + +/* Maximum sizes for name. Must fit in a RADIUS attribute */ +#define DOT1X_MAX_NAME_SIZE DOT1X_SUPP_MAX_USERNAME_LENGTH + +/* Supplicant session/environment object */ +typedef struct supp_env_s + { + void * ingress; /* Incoming Packet */ + UINT32 ingressLen; /* Incoming Packet length */ + void * egress; /* Outgoing Packet */ + UINT32 egressLen; /* Outgoing Packet length */ + char * uid; /* User name */ + char * pwd; /* Password */ + STATUS status; /* Authentication status */ + INT32 authType; /* Authentication type */ + INT32 innerAuthType; /* Inner Authentication type */ + void * tunnel; /* ingress tunnel data */ + UINT32 tunnelLen; /* ingress tunnel data size */ + void * private; /* Private data */ + INT32 eapType; + } SUPP_ENV_OBJ; + +typedef STATUS (* SUPP_HANDLER_METHOD)(); +typedef void * (* SUPP_EAP_HANDLER_METHOD)(); +typedef void (* SUPP_DESTROY_METHOD)(); +typedef void (* SUPP_SHOW_METHOD)(); + +/* Supplicant session object */ +typedef struct + { + SUPP_HANDLER_METHOD handler; /* Authentication handler */ + SUPP_DESTROY_METHOD destroy; /* Used to tear down session - EJA */ + SUPP_SHOW_METHOD show; /* Authenticator show routine */ + void * session; /* Authentication session object */ + char * label; /* Session Key label used by PRF */ + } SUPP_SESSION_OBJ; + +/* Supplicant handler object */ +typedef struct + { + SUPP_EAP_HANDLER_METHOD routine; /* handler routine for this EAP type */ + int type; /* identifier assigned to EAP type */ + SUPP_SHOW_METHOD show; /* show routine */ + SUPP_DESTROY_METHOD destroy; /* destroy method */ + BOOL enabled; /* eap method enabled or disabled */ + int id; /* supplicant numeric id */ + } DOT1X_SUPP_HANDLER; + +/* Log defines */ +#define DOT1X_LOG_FATAL "(f) " __FILE__ " (s) FATAL (r) " +#define DOT1X_LOG_ERROR "(f) " __FILE__ " (s) ERROR (r) " +#define DOT1X_LOG_INFO "(f) " __FILE__ " (s) INFO (r) " +#define DOT1X_LOG_DEBUG "(f) " __FILE__ " (s) DEBUG (r) " +#define DOT1X_LOG_ENTRY_SZ (100) +#define DOT1X_LOG_ENTRYS (10) + +/* Supplicant State Machine states, IEEE 802.1X, 8.5.10 */ +typedef enum + { + SUPP_DISCONNECTED = 1, + SUPP_LOGOFF, + SUPP_CONNECTING, + SUPP_AUTHENTICATING, + SUPP_AUTHENTICATED, + SUPP_ACQUIRED, + SUPP_HELD, + SUPP_DOUBLY_AUTHENTICATED + } SUPP_STATE; + +/* Enumeration to define mode of operation */ +typedef enum + { + DOT1X_MODE_WIRELINE = 0,/* Defines mode for wireline operation */ + DOT1X_MODE_WIRELESS /* Defines mode for wireless operation */ + } DOT1X_SUPP_MODE; + +/* EAP handler and type node for singly linked list of them */ +typedef struct dot1x_eap_handler_s + { + DOT1X_SUPP_HANDLER * handler; /* EAP type handler */ + struct dot1x_eap_handler_s * next; /* Node for list processing */ + } DOT1X_EAP_HANDLER; + +#define MAC_ADDR_LEN (6) + +/* 802.1X supplicant MIB statistics */ +typedef struct dot1x_supp_stats_s + { + UINT32 portNumber; /* Supplicants port number */ + UINT32 eapolFramesRxd; /* EAPOL frames received */ + UINT32 eapolFramesTxd; /* EAPOL frames transmitted */ + UINT32 eapolStartFramesTxd; /* EAPOL start frames transmitted */ + UINT32 eapolLogoffFramesTxd; /* EAPOL logoff frames transmitted */ + UINT32 eapolRespIdFramesTxd; /* EAPOL RespId frames transmitted */ + UINT32 eapolRespFramesTxd; /* EAPOL Response frames transmitted */ + UINT32 eapolReqIdFramesRxd; /* EAPOL ReqId frames received */ + UINT32 eapolReqFramesRxd; /* EAPOL Request frames received */ + UINT32 eapolInvalidFramesRxd; /* EAPOL invalid frames received */ + UINT32 eapolLenErrFramesRxd; /* EAPOL length error frames received */ + UINT32 eapolLastFrameVerRxd; /* EAPOL last frame version received */ + char eapolLastFrameSrcRxd[MAC_ADDR_LEN]; /* EAPOL last frame source */ + } SUPP_MIB_STATS_OBJ; + +/* Supplicant runtime statistics */ +typedef struct + { + UINT32 sessionFailures; + UINT32 sessionStarts; + UINT32 sessionSuccess; + UINT32 associationEvents; + UINT32 disassociationEvents; + UINT32 aEvents; + UINT32 dEvents; + UINT32 rejectedEvents; + UINT32 wep40Keys; + UINT32 wep104Keys; + UINT32 physLayerPortState; + UINT32 averageAuthTime; + char physLayerPortMacAddr[MAC_ADDR_LEN]; + } SUPP_RUNTIME_STATS_OBJ; + +/* Supplicant statistics */ +typedef struct + { + SUPP_MIB_STATS_OBJ mib; /* MIB stats */ + SUPP_RUNTIME_STATS_OBJ runtime; /* Runtime stats */ + } SUPP_STATS_OBJ; + +/* Supplicant Variables, IEEE 802.1X, 8.5.10.1.1 */ +typedef struct + { + SUPP_STATE state; /* State of the Machine */ + BOOL userLogoff; /* Is user logged off? */ + BOOL logoffSent; /* Has logoff message been sent? */ + BOOL reqId; /* Got EAP-Request/Identity? */ + BOOL reqAuth; /* Got EAP-Request not Identity? */ + BOOL eapSuccess; /* Got EAP-Success? */ + BOOL eapFail; /* Got EAP-Failure? */ + INT32 startCount; /* How many EAPOL-Starts sent */ + INT32 previousId; /* Last request ID responded to */ + BOOL receivedId; /* Request ID most recently received */ + BOOL resetFlag; + } SUPP_SESS_OBJ; + +/* Timer Variables, IEEE 802.1X, 8.5.2.1 */ +typedef struct + { + INT32 authWhile; /* When to time out on Auth. resp. */ + INT32 heldWhile; /* How long to wait before acquiring */ + INT32 startWhen; /* When to send EAPOL-Start */ + INT32 resetTimer; + } SUPP_TMR_OBJ; + +/* "Global" (used by more than one SM) Variables, IEEE 802.1X, 8.5.2.2 */ +typedef struct + { + BOOL init; /* Forces all state machines to init */ + BOOL enabled; /* Is the MAC for the port up? */ + BOOL status; /* Authorized or Unauthorized */ + INT32 mode; /* Mode of operation */ + int id; /* Device ID */ + BOOL trace; /* Packet trace enabled */ + BOOL unicastKeySet; /* Unicast key set */ + int nextHandlerSel; /* Next handler to try */ + } SUPP_DEV_OBJ; + +/* Supplicant Constants, IEEE 802.1X, 8.5.10.1.2 */ +typedef struct + { + INT32 authPeriod; /* in secs, authWhile timer init value */ + INT32 heldPeriod; /* in secs, heldWhile timer init value */ + INT32 startPeriod; /* in secs, startWhen timer init value */ + INT32 maxStart; /* max # of EAPOL-Start messages */ + } SUPP_CFG_OBJ; + +/* Certificate names and location */ +typedef struct + { + char certDir[DOT1X_MAX_NAME_SIZE + 1]; + char keyFile[DOT1X_MAX_NAME_SIZE + 1]; + char keyPassword[DOT1X_SUPP_MAX_PASSWORD_LENGTH + 1]; + char caCertFile[DOT1X_MAX_NAME_SIZE + 1]; + char caCertPath[DOT1X_MAX_NAME_SIZE + 1]; + char randFile[DOT1X_MAX_NAME_SIZE + 1]; + char certFile[DOT1X_MAX_NAME_SIZE + 1]; + INT32 currentTime; + } SUPP_SSL_OBJ; + +/* Supplicant data logging */ +typedef struct + { + void (*pEvent)(); + UINT32 entries; + UINT32 currEntry; + char entry[DOT1X_LOG_ENTRYS][DOT1X_LOG_ENTRY_SZ]; + } SUPP_LOG_OBJ; + +/* Supplicant session key info */ +typedef struct + { + char * pSign; /* Signature key */ + char session[DOT1X_SUPP_MAX_SESSION_KEY_LENGTH]; /* Session key */ + INT32 sessionSize; /* Session key size in bytes */ + INT32 signSize; /* Signature key size in bytes */ + } SUPP_KEY_OBJ; + +/* Supplicant interface binding */ +typedef struct + { + void * pCookie; /* EAPOL on the port */ + char name[DOT1X_MAX_NAME_SIZE + 1]; /* Device name */ + INT32 unit; /* interface unit number */ + } SUPP_EAPOL_OBJ; + +/* EAP */ +typedef struct + { + DOT1X_EAP_HANDLER * pList; /* Supported handler list */ + DOT1X_SUPP_HANDLER * pNegotiated; /* Default handler */ + void * pPhase1; /* outer auth specific handler */ + void * pPhase2; /* inner auth specific handler */ + INT32 phase1; /* Last method used for phase1 */ + INT32 phase2; /* Last method used for phase2 */ + } SUPP_EAP_OBJ; + +/* Supplicant authentication info */ +typedef struct + { + char * pResp; /* Response from authentication handler */ + char macAddr[MAC_ADDR_LEN]; /* MAC address of authenticator */ + char user[DOT1X_SUPP_MAX_USERNAME_LENGTH]; /* username */ + char password[DOT1X_SUPP_MAX_PASSWORD_LENGTH]; /* password */ + SUPP_EAP_OBJ eap; + } SUPP_AUTH_OBJ; + +/* Supplicant interval variables */ +typedef struct + { + SUPP_SESS_OBJ sess; /* Session parameters */ + SUPP_TMR_OBJ tmr; /* Timer parameters */ + SUPP_DEV_OBJ dev; /* Global parameters - override locals */ + SUPP_CFG_OBJ cfg; /* Configuration parameters */ + SUPP_EAPOL_OBJ eapol; /* Network interface info */ + SUPP_AUTH_OBJ auth; /* Authentication info */ + SUPP_SSL_OBJ ssl; /* Certificate info */ + SUPP_KEY_OBJ key; /* Key info */ + SUPP_LOG_OBJ log; /* Log info */ + SUPP_STATS_OBJ stats; /* Stats */ + } SUPP_OBJ; + +/* PAE for supplicant */ +typedef struct supplicant_s + { + SUPP_OBJ obj; /* Supplicant object */ + struct supplicant_s * next; /* Next supplicant in the list */ + } DOT1X_SUPP_PAE; + +/* Public APIs */ + +/* Create root task - Kernel mode */ +STATUS dot1xSuppLibInit(void *); +/* Display Supplcant Info - Kernel mode */ +STATUS dot1xSuppShow(BOOL); +/* Create and add a supplicant to the root task list - Kernel/User mode */ +int dot1xSuppCreate(int, char *, int); +/* Destroy and delete a supplicant from root task list - Kernel/User mode */ +STATUS dot1xSuppDelete(int); +/* Bind an authentication handler to a supplicant - Kernel mode */ +STATUS dot1xSuppHandlerAdd(int, void *); +/* Unbind an authentication handler from a supplicant - Kernel mode */ +STATUS dot1xSuppHandlerRemove(int, void *); +/* Set the username and password for a supplicant - Kernel/User mode */ +STATUS dot1xSuppLogonSet(int, char *, char *); +/* Get the username and password for a supplicant - Kernel/User mode */ +STATUS dot1xSuppLogonGet(int, char *, char *); +/* Set information used by cert based authentication - Kernel/User mode */ +STATUS dot1xSuppCertInfoSet(int, char *, char *, char *, char *, char *, + char *); +/* Get information used by cert based authentication - Kernel/User mode */ +STATUS dot1xSuppCertInfoGet(int, char *, char *, char *, char *, char *, + char *); +/* Enable or Disable packet trace - Kernel/User mode */ +BOOL dot1xSuppPacketTrace(int, BOOL); +/* Flush supplicant event log - Kernel/User mode */ +STATUS dot1xSuppEventLogFlush(int); +/* Display contents of supplicant datalog - - Kernel mode */ +void dot1xSuppEventLogShow(int); +/* Get supplicant ID based on instance number - Kernel/User mode */ +int dot1xSuppIdGet(char *, int); +/* Force supplicant to connect to NAS - Kernel/User mode */ +STATUS dot1xSuppConnect(int); +/* Shutdown all supplicants and delete all tasks - Kernel mode */ +STATUS dot1xSuppShutdownAll(void); +/* Enable EAP method - Kernel/User mode */ +STATUS dot1xSuppEapTypeEnable(int, void *); +/* Disable EAP method - Kernel/User mode */ +STATUS dot1xSuppEapTypeDisable(int, void *); +STATUS dot1xSuppHandlerCacheInstall(int); +/* Validate EAP type */ +STATUS dot1xSuppPhase2HandlerValidate(void *, int, int *, int); +int dot1xSuppPhase2HandlerFind(void *, int); +/* utility function */ +char dot1xSuppReceivedPktIdGet(void *); +void dot1xSuppResponsePktIdSet(void *, char); +STATUS dot1xSuppCertStoreValidate(void *); +#ifdef __cplusplus +} +#endif + +#endif /* __INCdot1xSuppLibh */ diff --git a/h/wrn/dot1x/dot1xSuppLibP.h b/h/wrn/dot1x/dot1xSuppLibP.h new file mode 100644 index 0000000..9bc7489 --- /dev/null +++ b/h/wrn/dot1x/dot1xSuppLibP.h @@ -0,0 +1,104 @@ +/* dot1xSuppLibP.h - 802.1X supplicant private header */ + +/* Copyright 2002-2005 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01k,04may05,eja Add key event type +01j,11apr05,eja Add enums for assoc/disassoc events +01i,23mar05,eja Remove unused event types +01h,22mar05,eja Add macros for timer task +01g,18mar05,eja Add new timeout macro +01f,01mar05,eja Code cleanup +01e,04feb05,eja 80211i/WPA integration +01d,18jan05,eja Moved 802.11i defines to commonIoctl file +01c,12jan05,rb Added DOT1X_PORTSTATUS structure +01b,10jan05,rb Added definitions for 802.11 integration +01a,05jan05,eja Remove inclusion of wlanEnd.h +*/ + +/* +DESCRIPTION +*/ + +#ifndef __INCdot1xSuppLibPh +#define __INCdot1xSuppLibPh + +#ifdef __cplusplus +extern "C" { +#endif + +/* headers */ +#include +#include +#include +#include + +/* Task configuration */ +#define DOT1X_SUPP_TASK_NAME "tDot1xSupp" +#define DOT1X_SUPP_TASK_PRIORITY 100 +#define DOT1X_SUPP_TASK_STACK_SIZE 10000 +#define DOT1X_MSG_TIMEOUT 50 +#define DOT1X_SUPP_TMR_NAME "tDot1xTmr" +#define DOT1X_SUPP_TMR_PRIORITY 150 +#define DOT1X_SUPP_TMR_STACK_SIZE 10000 + +/* Default timer periods in seconds */ +#define DOT1X_SUPP_AUTH_PERIOD 30 +#define DOT1X_SUPP_HELD_PERIOD 60 +#define DOT1X_SUPP_START_PERIOD 30 +#define DOT1X_SUPP_ERROR_WAIT 10 + +/* Default number of EAPOL-Starts before giving up */ +#define DOT1X_SUPP_MAX_START 3 + +/* dot1xSuppStatus */ +#define DOT1X_SUPP_UNAUTHORIZED 0 +#define DOT1X_SUPP_AUTHORIZED 1 + +/* EAP request or response for identity type */ +#define EAP_RESPONSE_HEADER_LENGTH 5 + +/* EAP size of a NAK response */ +#define EAP_NAK_SIZE 6 + +/* Message handling */ +#define DOT1X_SUPP_MAX_MESSAGES 20 + +/* Timeouts if 1/2 second, 1 second period for timer */ +#define ONE_SECOND (sysClkRateGet()) +#define HALF_SECOND (ONE_SECOND>>1) +#define HALF_SECOND_SAFE (intContext() ? NO_WAIT : HALF_SECOND) + +/* Types of messages used internally by the supplicant to indicate events */ +typedef enum + { + SUPP_DATA_PACKET = 0, /* Incoming EAP packet event */ + SUPP_CONNECT_EVENT, /* Incoming event from driver */ + SUPP_DISCONNECT_EVENT, /* Incoming disconnect from driver */ + SUPP_KEY_SET_EVENT /* Incoming key packet */ + } DOT1X_SUPP_EVENT_TYPE; + +/* Message used for signalling supplicant events internally */ +typedef struct + { + INT32 type; /* Event Type */ + VOID *id; /* Event ID */ + VOID *data; /* Message data */ + } DOT1X_SUPP_EVENT; + +/* Application configuration */ +#define DOT1X_MODE_DEFAULT DOT1X_MODE_WIRELESS +#define DOT1X_UNICAST_SUPPORT FALSE + +/* For timing */ +IMPORT int sysClkRateGet (void); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdot1xSuppLibPh */ diff --git a/h/wrn/dot1x/dot1xSuppPeapLib.h b/h/wrn/dot1x/dot1xSuppPeapLib.h new file mode 100644 index 0000000..6c500fc --- /dev/null +++ b/h/wrn/dot1x/dot1xSuppPeapLib.h @@ -0,0 +1,88 @@ +/* dot1xSuppPeapLib.h - 802.1X PEAP Authentication header */ + +/* Copyright 2002-2005 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01f,09sep05,eja Add member to enum +01e,05aug05,eja Version 2.1 update +01d,25jul05,eja API change and cleanup +01c,18mar05,eja Reduced session count to 1 +01b,01mar05,eja Code cleanup +01a,15dec04,eja Remove show prototype +*/ + +/* +DESCRIPTION +*/ +#ifndef __INCdot1xSuppPeapLibh +#define __INCdot1xSuppPeapLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Library header dependencies */ +#include +#include + +/* Max peap sessions and password length */ +#define PEAP_MAX_SESSIONS (1) +#define PEAP_PASSWORD_MAX_LEN (sizeof(char)*16) /* 16 octets */ +#define PEAP_ENCRYPT_LABEL "client EAP encryption" + +/* Inner authentication handler init type */ +typedef SUPP_SESSION_OBJ * (*PEAP_AUTH_HDLR)(); + +/* PEAP inner authentication methods */ +typedef enum + { + PEAP_INNER_AUTH_MS_CHAP_V2 = 0, /* MS-CHAP-V2 authentication */ + PEAP_INNER_AUTH_UNSUPPORTED + } PEAP_INNER_AUTH_METHOD; + +/* PEAP authentication states */ +typedef enum + { + PEAP_AUTH_IDENTITY = 0, + PEAP_AUTH_CHALLENGE, + PEAP_AUTH_SUCCESS, + PEAP_AUTH_EXTENSIONS + } PEAP_AUTH_STATE; + +#define PEAP_AUTH_IDENTITY_CODE ((UCHAR)(0x01)) + +/* Defines a peap authentication object */ +typedef struct peap_auth_s + { + SUPP_SESSION_OBJ curr; /* Current Authentication object */ + SUPP_SESSION_OBJ next; /* Next Authentication object */ + SUPP_ENV_OBJ * env; /* Supplicant parameters */ + PEAP_AUTH_STATE state; /* PEAP authetication current state */ + } PEAP_SESSION_OBJ; + +/* Types of inner authentication packets packets */ +typedef enum + { + PEAP_INNER_AUTH_REQUEST = 1, /* Authentication request */ + PEAP_INNER_AUTH_ACK, /* Authentication success */ + PEAP_INNER_AUTH_NAK /* Authentication failure */ + } PEAP_INNER_AUTH_PKT_TYPE; + +/* This structure defines the PEAP control object */ +typedef struct peap_control_s + { + PEAP_SESSION_OBJ * session[PEAP_MAX_SESSIONS]; /* Allowed sessions */ + BOOL sessionActive; /* Session state */ + } PEAP_CONTROL_OBJ; + + +void * dot1xSuppPeapAuthInit(void *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdot1xSuppPeapLibh */ diff --git a/h/wrn/dot1x/dot1xSuppTlsLib.h b/h/wrn/dot1x/dot1xSuppTlsLib.h new file mode 100644 index 0000000..61a9488 --- /dev/null +++ b/h/wrn/dot1x/dot1xSuppTlsLib.h @@ -0,0 +1,180 @@ +/* dot1xSuppTlsLib.h - 802.1X EAP-TLS Authentication header */ + +/* Copyright 2002-2005 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01h,05aug05,eja Version 2.1 update +01g,25jul05,eja API change and cleanup +01f,27jun05,eja Cleanup +01e,07jun05,eja Fix for trace bug B0490 +01d,18mar05,eja Reduced session count to 1 +01c,01mar05,eja Code cleanup +01b,17feb05,eja Remove EAP_TLS time macros +01a,21dec04,eja Add public API prototype to header +*/ + +/* +DESCRIPTION +*/ +#ifndef __INCdot1xSuppTlsLibh +#define __INCdot1xSuppTlsLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Library header dependencies */ +#include +#include +#include +#include + +/* Max ttls sessions */ +#define EAP_TLS_MAX_SESSIONS (1) + +/* Inner authentication handler init type */ +typedef SUPP_SESSION_OBJ * (* EAP_TLS_AUTH_HDLR)(); + +/* IO handlers */ +typedef VOID (*EAP_TLS_TX_HDLR)(); +typedef VOID (*EAP_TLS_RX_HDLR)(); + +/* Defines an EAP-TLS packet */ +typedef struct eap_tls_pkt + { + EAP_HDR hdr; /* Eap Packet header */ + char type; /* Packet Type field */ + char flags; /* Flags L(0)Length M(1)More fragments S(2)Start */ + } _WRS_PACK_ALIGN(1) EAP_TLS_PKT_HDR; + +/* EAP-TLS flag bits */ +#define EAP_TLS_LENGTH_INCLUDED ((UCHAR)0x80) +#define EAP_TLS_FIRST_FRAGMENT EAP_TLS_LENGTH_INCLUDED +#define EAP_TLS_MORE_FRAGMENTS ((UCHAR)0x40) +#define EAP_TLS_START_SESSION ((UCHAR)0x20) +#define EAP_TLS_ACK_PACKET ((UCHAR)0x00) +#define EAP_TLS_MAX_FRAG_SZ (1300) +#define EAP_TLS_SESSION_KEY_SIZE (32) +#define EAP_TLS_MAX_ENCRYPT_LABEL_SIZE (256) + +/* EAP-TLS authentication states */ +typedef enum + { + EAP_TLS_WAIT_FOR_START = 0, /* Waiting to start */ + EAP_TLS_WAIT_FOR_ACK, /* Waiting for acknowledgement from server */ + EAP_TLS_WAIT_FOR_REQUEST, /* Waiting for request */ + EAP_TLS_WAIT_FOR_FRAG, /* Waiting on next packet fragment */ + EAP_TLS_WAIT_FOR_SUCCESS, /* Waiting for success */ + EAP_TLS_AUTHENTICATED, /* Authentication is complete */ + EAP_TLS_IDLE /* Idle state */ + } EAP_TLS_AUTH_STATE; + +/* EAP-TLS authentication protocols */ +typedef enum + { + EAP_TLS_AUTH_TTLS = 0, /* Used in TTLS context */ + EAP_TLS_AUTH_PEAP, /* Used in PEAP context */ + EAP_TLS_AUTH_TLS /* Used in EAP-TLS context */ + } EAP_TLS_AUTH_METHOD; + +/* EAP-TLS Packet types */ +typedef enum + { + EAP_TLS_RESPONSE, /* Resonse packet */ + EAP_TLS_REQUEST, /* Request packet */ + EAP_TLS_ACK, /* ACK packet */ + EAP_TLS_NAK, /* NAK packet */ + EAP_TLS_ERROR /* ERROR */ + } EAP_TLS_PKT_TYPE; + +/* EAP-TLS macros */ +#define EAP_TLS_MAX_SIZE (16384+sizeof(EAP_HDR)) /* Max packet 16388 */ +#define EAP_TLS_SESSION_KEY_SIZE (32) /* Size of session key */ +#define EAP_TLS_ENCRYPT_LABEL "client EAP encryption" /* Used in key PRF */ +#define EAP_TLS_HANDSHAKE_DONE (3) + +/* Stats structure */ +typedef struct eap_tls_ssl_stats_s + { + INT32 rxFragments; /* Total number of Rx TLS record fragments */ + INT32 txFragments; /* Total number of Tx TLS record fragments */ + INT32 rxRecords; /* Total number of Rx TLS records */ + INT32 txRecords; /* Total number of Tx TLS records */ + INT32 txErrors; /* Total number of Tx errors */ + INT32 rxErrors; /* Total number of Rx errors */ + INT32 rxBytes; /* Total number of Rx bytes */ + INT32 txBytes; /* Total number of Txx bytes */ + } EAP_TLS_SSL_STATS_OBJ; + +/* Defines SSL context */ +typedef struct eap_tls_ssl_s + { + SSL * object; /* Pointer to SSL info */ + BIO * source; /* SSL input BIO */ + BIO * sink; /* SSL output BIO */ + char outData[EAP_TLS_MAX_SIZE]; /* output buffer from SSL */ + UINT32 outSize; /* size of SSL output */ + char * outPtr; /* locaton in output buffer from SSL */ + UINT32 outSizeLeft; /* size of SSL output remaining */ + char inData[EAP_TLS_MAX_SIZE]; /* input buffer to SSL */ + UINT32 inSize; /* size of SSL input */ + char * inPtr; /* location in input buffer to SSL */ + struct timespec time; /* Unix style time structure */ + EAP_TLS_SSL_STATS_OBJ stats; + } EAP_TLS_SSL_OBJ; + +typedef struct eap_tls_ssl_ctx_s + { + SSL_CTX * ctx; /* ssl context */ + EAP_TLS_SSL_OBJ env; /* ssl session parameters */ + BOOL started; /* Flag indicates that a session is in progress */ + BOOL libInit; /* Flag to indicate context state */ + } EAP_TLS_SSL_CTX; + +/* Defines a EAP-TLS IO structure */ +typedef struct eap_tls_io_s + { + EAP_TLS_TX_HDLR send; /* Handles outgoing packets */ + EAP_TLS_PKT_TYPE sendType; /* Type of packet to create */ + UINT32 sendFlags; /* Special packet flags */ + EAP_TLS_RX_HDLR receive; /* Handles incoming packets */ + EAP_TLS_PKT_TYPE receiveType; /* Type of packet to create */ + UINT32 receiveFlags; /* Special packet flags */ + } EAP_TLS_IO_OBJ; + +/* Defines a EAP-TLS Handshake structure */ +typedef struct eap_tls_handshake_s + { + BOOL complete; /* Handshake completion state */ + INT32 count; /* Handshake count - TLS uses 3 way handshake */ + } EAP_TLS_HANDSHAKE_OBJ; + +/* Defines a EAP-TLS authentication object */ +typedef struct eap_tls_auth_s + { + SUPP_SESSION_OBJ curr; /* Current Authentication object */ + SUPP_SESSION_OBJ next; /* Next Authentication object */ + SUPP_ENV_OBJ * env; /* Supplicant parameter cache */ + EAP_TLS_AUTH_STATE state; /* TTLS authetication current state */ + EAP_TLS_SSL_CTX ssl; /* SSL session context */ + EAP_TLS_IO_OBJ io; /* IO mechanism */ + EAP_TLS_HANDSHAKE_OBJ handshake; /* Indicates TLS handshake state */ + } EAP_TLS_SESSION_OBJ; + +/* This structure defines the EAP-TLS control object */ +typedef struct eap_tls_control_s + { + EAP_TLS_SESSION_OBJ * session[EAP_TLS_MAX_SESSIONS]; /* Allowed sessions */ + BOOL sessionActive; + } EAP_TLS_CONTROL_OBJ; + +void * dot1xSuppTlsInit(void *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdot1xSuppTlsLibh */ diff --git a/h/wrn/dot1x/dot1xSuppTtlsLib.h b/h/wrn/dot1x/dot1xSuppTtlsLib.h new file mode 100644 index 0000000..7e0b5ff --- /dev/null +++ b/h/wrn/dot1x/dot1xSuppTtlsLib.h @@ -0,0 +1,137 @@ +/* dot1xSuppTtlsLib.h - 802.1X TTLS Authentication header */ + +/* Copyright 2002-2005 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01g,09sep05,eja Code cleanup +01f,01sep05,eja Add support for CHAP as an inner auth type +01e,05aug05,eja Version 2.1 update +01d,25jul05,eja API change and cleanup +01c,18mar05,eja Reduced session count to 1 +01b,01mar05,eja Code cleanup +01a,21dec04,eja Remove show routine prototype +*/ + +/* +DESCRIPTION +*/ +#ifndef __INCdot1xSuppTtlsLibh +#define __INCdot1xSuppTtlsLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Library header dependencies */ +#include +#include + +/* Max ttls sessions and password length */ +#define TTLS_MAX_SESSIONS (1) +#define TTLS_PAP_PASSWORD_MAX_LEN (sizeof(char) * 16) /* 16 octets */ +#define TTLS_CHAP_PASSWORD_MAX_LEN TTLS_PAP_PASSWORD_MAX_LEN +#define TTLS_CHAP_CHALLENGE_MAX_LEN TTLS_CHAP_PASSWORD_MAX_LEN +#define TTLS_ENCRYPT_LABEL "ttls keying material" +#define TTLS_CHALLENGE_MATERIAL "ttls challenge" + +/* AVP flag settings */ +#define TTLS_AVP_VENDOR_SPECIFIC ((UCHAR)(0x80)) +#define TTLS_AVP_MANDITORY_FLAG ((UCHAR)(0x40)) +#define TTLS_AVP_FLAGS_POS (24) + +/* AVP alignment macro */ +#define TTLS_AVP_PAD(out, in) (out) = ((((in & 0x03) ^ 0x03) + 1) & 0x03) + +/* Inner authentication handler init type */ +typedef SUPP_SESSION_OBJ * (* TTLS_AUTH_HDLR)(); + +/* This enumeration defines RADIUS attributes as per rfc2865 and rfc2869 +that are to be used for inner authentication */ +typedef enum + { + TTLS_RADIUS_ATTR_USER_NAME = 1, /* RADIUS user name attribute */ + TTLS_RADIUS_ATTR_USER_PASSWORD = 2, /* RADIUS password attribute */ + TTLS_RADIUS_ATTR_CHAP_PASSWORD = 3, /* RADIUS CHAP password attribute */ + TTLS_RADIUS_ATTR_CHAP_CHALLENGE = 60, /* RADIUS CHAP challenge attribute */ + TTLS_RADIUS_ATTR_EAP_MESSAGE = 79 /* RADIUS EAP message attribute */ + } TTLS_RADIUS_AVP_CODE; + +/* This structure defines the AVP (Attribute Value Pair) packet +header format used by TTLS (draft-ietf-pppext-eap-ttls-05.txt) for +passing data between the peer and authentiction server during the +inner authentication phase of a given TTLS session. */ +typedef struct ttls_avp_pkt_hdr_s + { + UINT32 code; /* 32 bits */ + UINT32 flagsLength; /* Flags [VMrrrrrr] r - 0 V - [0,1] M - length */ + } _WRS_PACK_ALIGN(1) TTLS_AVP_PKT_HDR; + +/* This structure defines the AVP (Attribute Value Pair) packet +format used by TTLS (draft-ietf-pppext-eap-ttls-05.txt) for +passing data between the peer and authentiction server during the +inner authentication phase of a given TTLS session when the +vendor specific bit is set within the flags field of the +packet header . */ +typedef struct ttls_avp_vendor_pkt_s + { + TTLS_AVP_PKT_HDR header; /* AVP packet header information */ + UINT32 vendorId; /* Vendor ID */ + char message; /* AVP message body */ + } _WRS_PACK_ALIGN(1) TTLS_AVP_VENDOR_PKT; + +/* This structure defines the AVP (Attribute Value Pair) packet +format used by TTLS (draft-ietf-pppext-eap-ttls-05.txt) for +passing data between the peer and authentiction server during the +inner authentication phase of a given TTLS session when the +vendor specific bit is cleared within the flags field of the +packet header. The message portion may contain inner authentication +packet data (i.e. PAP, CHAP packet) */ +typedef struct ttls_avp_pkt_s + { + TTLS_AVP_PKT_HDR header; /* AVP packet header information */ + char message; /* AVP message body */ + } _WRS_PACK_ALIGN(1) TTLS_AVP_PKT; + + +/* TTLS inner authentication methods */ +typedef enum + { + TTLS_INNER_AUTH_PAP = 0, /* PAP authentication */ + TTLS_INNER_AUTH_CHAP, /* CHAP authentication */ + TTLS_INNER_AUTH_MS_CHAP, /* MS-CHAP authentication */ + TTLS_INNER_AUTH_EAP /* EAP authentication */ + } TTLS_INNER_AUTH_METHOD; + +/* TTLS authentication states */ +typedef enum + { + TTLS_AUTH_REQUEST_STATE = 0, /* Waiting for a request */ + TTLS_AUTH_RESPONSE_STATE /* Waiting for a response */ + } TTLS_AUTH_STATE; + +/* Defines a ttls authentication object */ +typedef struct ttls_auth_s + { + SUPP_SESSION_OBJ curr; /* Current Authentication object */ + SUPP_SESSION_OBJ next; /* Next Authentication object */ + SUPP_ENV_OBJ * env; /* Supplicant parameters */ + int authType; /* TTLS inner auth type */ + } TTLS_SESSION_OBJ; + +/* This structure defines the PAP control object */ +typedef struct ttls_control_s + { + TTLS_SESSION_OBJ * session[TTLS_MAX_SESSIONS]; /* Allowed sessions */ + BOOL sessionActive; + } TTLS_CONTROL_OBJ; + +void * dot1xSuppTtlsAuthInit(void *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdot1xSuppTtlsLibh */ diff --git a/h/wrn/dot1x/dot1xVirtEndLib.h b/h/wrn/dot1x/dot1xVirtEndLib.h new file mode 100644 index 0000000..3d93f8f --- /dev/null +++ b/h/wrn/dot1x/dot1xVirtEndLib.h @@ -0,0 +1,42 @@ +/* dot1xVirtEndLib.h - Virtual End driver */ + +/* Copyright 2002-2005 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,26Jul05,eja Created +*/ + +#ifndef __INCdot1xVirtEndLibh +#define __INCdot1xVirtEndLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* typedefs */ +typedef int (*VIRT_END_CFG_HANDLER)(); + +/* defines */ +#define DOT1X_VIRT_END_DEV_NAME "dot1x" +#define DOT1X_VIRT_END_DEV_NAME_LEN (strlen(DOT1X_VIRT_END_DEV_NAME) + 1) + +/* enums */ +typedef enum + { + DOT1X_VIRT_END_SUPP_HDLR = 0, + DOT1X_VIRT_END_AUTH_HDLR + } DOT1X_VIRT_END_HDLR; + +void * dot1xVirtEndDevInit(void); +STATUS dot1xVirtEndDevHandlerInstall(void *, int, void *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdot1xVirtEndLibh */ diff --git a/h/wrn/dot1x/dot1xWb4Lib.h b/h/wrn/dot1x/dot1xWb4Lib.h new file mode 100644 index 0000000..1f2dcae --- /dev/null +++ b/h/wrn/dot1x/dot1xWb4Lib.h @@ -0,0 +1,37 @@ +/* dot1xWb4Lib.h - 802.1X supplicant stream cipher library header file */ + +/* Copyright 2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,21apr03,ggg written. +*/ + +#ifndef __INCdot1xWb4Libh +#define __INCdot1xWb4Libh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Stream cipher key format */ +typedef struct +{ + unsigned char state[256]; + unsigned char x; + unsigned char y; +} DOT1X_WB4_KEY; + +/* Prototypes */ +void dot1xWb4KeyGen(unsigned char *key_data_ptr, int key_data_len, + DOT1X_WB4_KEY *key); +void dot1xWb4(unsigned char *buffer_ptr, int buffer_len, DOT1X_WB4_KEY * key); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCdot1xWb4Libh */ + diff --git a/h/wrn/firewall/fwLib.h b/h/wrn/firewall/fwLib.h new file mode 100644 index 0000000..54084d7 --- /dev/null +++ b/h/wrn/firewall/fwLib.h @@ -0,0 +1,756 @@ +/* fwLib.h - Firewall Rule Engine header */ + +/* Copyright 2004-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01r,02sep05,zhu added per host rate limiting +01q,30aug05,myz added HTTP content filter +01p,04mar05,myz added FW_INET6 +01o,24feb05,svk Update version +01n,13dec04,myz added IPV6 support +01m,13sep04,svk Add fwLogLibInit, fwLogSyslocInstall, fwLogLibInit +01l,26jul04,svk Update version +01k,04mar04,svk Add default state entry timeouts, prototype for + fwFtpExtHandle +01j,24feb04,myz removed obsoleted APIs and added two new ones +01i,18feb04,myz added FW_FIELD_GROUPNAME +01h,09feb04,myz added fwRuleFieldSet/Get and fwRule(Group)Create changes +01g,30jan04,myz changed name of public APIs, typedefs, and others after review. +01f,29jan04,myz modified FW_RULE_ENTRY and FW_GROUP_ATTR +01e,26jan04,myz added fwRuleLoggingIfInstall() and fwMacLoggingIfInstall() +01c,22jan04,svk Add version number +01b,14jan04,svk Add public function fwStringSearch +01a,08jan04,myz created +*/ + + +#ifndef __INCfwRuleLibh +#define __INCfwRuleLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "lstLib.h" +#include "dllLib.h" +#include "endLib.h" +#include "netinet/in.h" +#include "netinet/ip.h" + +#include "netinet6/in6.h" +#include "netinet6/ip6.h" + +#if defined(INET6) || defined(INCLUDE_IPV6) +#define FW_INET6 +#endif + +/* + * Action codes + * + * Certain combinations do not make sense: + * FW_ICMP, FW_TCP_RESET, FW_ACCEPT, FW_FRAG_REASSEMBLE, FW_USER_ACTION + * and FW_NEXT_RULE/(GROUP) are mutually exclusive. FW_FRAG_REASSEMBLE + * reassembles all fragments when the fragment flag is set in the rule. This + * action is only for the rules at pre-input location. FW_USER_ACTION will take + * the return code of the user specified post processing function as the action + * code. The FW_NEXT_RULE/(GROUP) action code will evaluate + * the packet against the next rule or group. FW_ICMP and FW_TCP_RESET are only + * used with the FW_REJECT action code. + * When FW_REJECT and FW_ICMP is specified, the lower 16 bits + * contain the ICMP code (upper 8 bits) and type (lower 8 bits), if any. + * + * FW_LOCAL and FW_FILTER are for future use. + */ + +#define FW_REJECT 0x00000000 /* Reject the packet */ +#define FW_ACCEPT 0x80000000 /* Accept the packet */ +#define FW_LOG 0x40000000 /* Log the packet */ +#define FW_ICMP 0x20000000 /* Send back an ICMP message */ +#define FW_LOCAL 0x10000000 /* Force packet to be local */ +#define FW_USER_ACTION 0x00800000 /* Action code taken from usr function*/ +#define FW_FRAG_REASSEMBLE 0x00400000 /* Reassemble all fragments */ +#define FW_TCP_RESET 0x00200000 /* Send back an TCP RESET */ +#define FW_NEXT_RULE 0x00100000 /* Evaluate next rule */ +#define FW_NEXT_RULEGROUP 0x00080000 /* Evaluate next rule group */ +#define FW_RETCODE 0xf0e00000 /* valid bits in return code, mask */ +#define FW_ICMPTYPE 0x0000ff00 /* ICMP type to return */ +#define FW_ICMPCODE 0x000000ff /* ICMP code to return */ +#define FW_FILTER 0x0f000000 /* Mask of the filter bits */ + +/* rule field set/get field identification defines */ + +#define FW_FIELD_NETIF 1 /* source and dest network interface */ +#define FW_FIELD_IPADDR 2 /* source and dest IP address range */ +#define FW_FIELD_HDRLEN 3 /* IP header length */ +#define FW_FIELD_PROTO 4 /* protocol type */ +#define FW_FIELD_FRAG 5 /* IP fragment */ +#define FW_FIELD_PKTSIZE 6 /* packet size range */ +#define FW_FIELD_TCP 8 /* TCP parameters */ +#define FW_FIELD_UDP 9 /* UDP parameters */ +#define FW_FIELD_ICMP 10 /* ICMP parameters */ +#define FW_FIELD_TIME 11 /* time of day range */ +#define FW_FIELD_STATE 12 /* stateful inspection parameters */ +#define FW_FIELD_ACTION 13 /* action code */ +#define FW_FIELD_IPADDRSTR 14 /* IP address range in string format */ +#define FW_FIELD_GROUPNAME 15 /* name of rule group */ +#define FW_FIELD_EXTHDRS 16 /* extension header rules */ +#define FW_FIELD_ICMPV6 17 /* ICMPV6 parameters */ +#define FW_FIELD_FLOWLABEL 18 /* IPV6 flowlabel */ +#define FW_FIELD_RATELIMIT 19 /* rate limit */ +#define FW_FIELD_ALL 200 /* for internal use only */ + +/* Rule comparison operators, only apply to some rules */ + +#define FW_EQ_OP 0 /* equal operator */ +#define FW_LT_OP 1 /* less than operator */ +#define FW_GT_OP 2 /* greater than operator */ +#define FW_NONE_OP 0 /* operation field not used */ +#define FW_AND_OP 1 /* AND operator */ +#define FW_OR_OP 2 /* OR operator */ +#define FW_EXACT_OP 3 /* exact sequence and number operator */ +#define FW_RANGE_OP 4 /* extension header ranger operator */ + +/* Host tracking options */ + +#define FW_SRC_TRK_ON 1 /* host tracking based on source IP address*/ +#define FW_DST_TRK_ON 2 /* host tracking based on destination IP address*/ +#define FW_ALL_TRK_OFF 0 /* no host tracking*/ +#define FW_HOST_TRK_DFLT_SIZE 57 /* default host tracking table size*/ + + +/* Stateful inspection operation. + * This operation always works on a pair of firewall rules. Typically a + * rule with value FW_CONN_INITIATOR and FW_CONN_STATE_ALL in connTrack + * element creates a state tracking entry at either output, pre-output or + * forward location and another rule with value FW_CONN_RESPONDER and + * FW_CONN_STATE_NEW or FW_CONN_STATE_ESTABLISHED at pre-input, input + * or forward location checks the state of the connection to see if it + * matches the state in the given rule. When the rule specified in the + * forward location, use the source and destination interfaces to + * differentiate the two rules. + * FW_CONN_STATE_CREATE should be only used with FW_CONN_INITIATOR. + */ + +#define FW_CONN_INITIATOR 1 /* connection initiator */ +#define FW_CONN_RESPONDER 2 /* connection responder */ +#define FW_CONN_STATE_CREATE 1 /* create the tracking entry */ +#define FW_CONN_STATE_NEW 2 /* connection is in new state */ +#define FW_CONN_STATE_ESTABLISHED 4 /* connection is in established state */ +#define FW_CONN_STATE_ALL (FW_CONN_STATE_CREATE | FW_CONN_STATE_NEW | \ + FW_CONN_STATE_ESTABLISHED) + +/* State entry default timeout values (in seconds) */ + +#define FW_CONN_ICMP_TIMEOUT 120 /* ICMP state entry default timeout */ +#define FW_CONN_UDP_TIMEOUT 120 /* UDP state entry default timeout */ +#define FW_CONN_TCP_TIMEOUT 120 /* UDP state entry default timeout */ +#define FW_FTP_DC_TIMEOUT 30 /* FTP data channel creation default timeout*/ + +/* Rule/group rearrangement operation types */ + +#define FW_MOVE_TO_TAIL 1 /* move the rule/group to tail */ +#define FW_MOVE_TO_HEAD 2 /* move the rule/group to head */ +#define FW_MOVE_AFTER 3 /* move the rule/group after the specified one */ + +/* To match all types of ICMP packet, this value INVALID_ICMP_TYPE + * should be initialized in the icmp.type field + */ + +#define FW_INVALID_ICMP_TYPE 0xFF + +/* time of day defines */ + +#define FW_DAY_SUN 1 /* sunday */ +#define FW_DAY_MON (1 << 1) /* monday */ +#define FW_DAY_TUE (1 << 2) /* tuesday */ +#define FW_DAY_WED (1 << 3) /* wednesday */ +#define FW_DAY_THU (1 << 4) /* thursday */ +#define FW_DAY_FRI (1 << 5) /* friday */ +#define FW_DAY_SAT (1 << 6) /* saturday */ +#define FW_DAY_ALL (FW_DAY_SUN | FW_DAY_MON | FW_DAY_TUE | FW_DAY_WED | \ + FW_DAY_THU | FW_DAY_FRI | FW_DAY_SAT) + +#define FW_EVT_FUNC_NUM 3 /* max number of event function, internal use */ + +/* logging defines */ + +#define FW_LOG_TO_SYSLOG 1 /* send log messages to syslog server */ +#define FW_LOG_TO_CONSOLE 2 /* send log messages to console */ +#define FW_LOG_TO_NONE 0 /* don't send log messages anywhere */ + +/* MAC filter types, values are directly used as index, don't change */ + +#define FW_MAC_FILTER_RX 0 +#define FW_MAC_FILTER_TX 1 + +/* Firewall version number */ + +#define FIREWALL_VERSION "2.1" + +#define FW_RULE_TYPE_IPV4 0x1 +#define FW_RULE_TYPE_IPV6 0x2 + +#define FW_EXT_TYPE_NUM 5 + +/* content filter */ + +#define FW_URL_SPECIFIC_PATH 1 /* URL path match */ +#define FW_URL_KEYWORD 2 /* URL keyword match */ + +/* required return code using the generic service registration mechanism */ +#define FW_SVC_MATCH_DONE 1 /* match and done, don't go to next service */ +#define FW_SVC_MATCH_NEXT 2 /* match and go to next service */ +#define FW_SVC_NOT_MATCH 3 /* not match and go to next service */ + + + + +/* typedefs */ + +/* The four installing locations of the rule filter for either IPV4 or IPV6. + * Do not change the order of these enum values + */ + +typedef enum { + FW_PREIN_LOC = 0, + FW_IN_LOC, + FW_FORW_LOC, + FW_OUT_LOC, +#ifdef FW_INET6 + FW_PREIN_LOC_V6, + FW_IN_LOC_V6, + FW_FORW_LOC_V6, + FW_OUT_LOC_V6, +#endif + FW_END_LOC + } FW_LOC_TYPE; + +/* Individual fields of the rule entry */ + +/* Destination and source IP address. + * Specify a range of the IP addresses between start and end inclusive. + * If a single address, then start and end fields must be same. + * If start field is 0, then the match condition is <= end field + * If end field is 0, then the match condition is >= start field + */ + +typedef struct { + struct in_addr start; /* the start IP address */ + struct in_addr end; /* the end IP address */ + } FW_RULE_ADDR; + +/* TCP/UDP port and IP packet size. + * Specify a range as described above for IP addresses + */ + +typedef struct { + UINT16 start; + UINT16 end; + } FW_RULE_PORT, FW_RULE_PKTSIZE, FW_RULE_RANGE; + +/* interface, only name and unit must specified. index is derived */ + +typedef struct { + char name[END_NAME_MAX]; /* NULL terminated interface name string */ + UINT8 unit; /* unit number */ + UINT8 pad0; + UINT16 index; + } FW_RULE_IF; + +/* TCP flag rule */ + +typedef struct { + UINT8 flag; /* the TCP flag bits */ + UINT8 mask; /* the bits the rule wants to check */ + UINT16 operation; /* AND (flag==(packet flag) & mask) or + * OR (flag & mask & (packet flag)) operation */ + } FW_RULE_TCPFLAG; + +typedef void (*FW_EVT_FUNC_PTR)(void *); + +/* Specify an optional event function in the form of this structure to be called + * when a TCP session transits to a certain state. Used for state rule. + * Internal use Only. + */ + +typedef struct { + int state; /* defined above, only TCP_SYN_SENT, TCP_ESTABLISH_STATE and + * TCP_END_STATE are valid */ + FW_EVT_FUNC_PTR pEventFunc; /* the callback function */ + void * eventFuncArg; /* callback function argument */ + } FW_EVENT_FUNC_ENTRY; + + +typedef struct { + FW_RULE_PORT srcPort; + FW_RULE_PORT dstPort; + FW_RULE_TCPFLAG tcpFlag; + } FW_RULE_TCP; + +typedef struct { + FW_RULE_PORT srcPort; + FW_RULE_PORT dstPort; + } FW_RULE_UDP; + +typedef struct { + UINT8 type; + UINT8 code; + } FW_RULE_ICMP; + +/* Time of the day - specify a range. */ + +typedef struct { + UINT32 days; /* bit0: sunday, ..., bit6: saturday, 0x7f: whole week */ + UINT32 secStart; /* start time in second, for example 8am, 8 * 60 * 60 */ + UINT32 secEnd; /* end time in second, for example 6pm, 18 * 60 * 60 */ + } FW_RULE_TIMEOFDAY; + +/* connection tracking */ + +typedef struct { + UINT16 entity; /* connection end identification */ + UINT16 state; /* the connection state */ + } FW_RULE_CONN_TRACK; + +/* rate limit */ + +typedef struct { + UINT32 startTick; /*record the start time of each time duration in runtime*/ + UINT32 intPktNum; /* the number of intercepted packets in runtime */ + } FW_RATE_LIMIT_INFO; + +typedef struct { + UINT16 hostTrkMax; /* the max number of hosts for tracking */ + void * pHostTrkTbl; /* the IP track table */ + } FW_HOST_TRK_INFO; + +typedef struct { + UINT32 limit; /* the given packet limit */ + UINT16 duration; /* each time duration for the packet limit, in second */ + UINT8 op; /* operation type for the limit, great-than or less-than*/ + UINT8 trkSltor; /* select track method */ + union { + FW_RATE_LIMIT_INFO rateInfo; /* overall rate limit information */ + FW_HOST_TRK_INFO trkInfo; /* host tracking information */ + } u; /* overall or per host rate limiting information */ + } FW_RULE_RATE_LIMIT; + +#define rateStartTick u.rateInfo.startTick +#define rateIntPktNum u.rateInfo.intPktNum +#define trkMax u.trkInfo.hostTrkMax +#define pTrkTbl u.trkInfo.pHostTrkTbl + +typedef struct { + struct in_addr ipAddr; /* Source or destination IP address */ + UINT32 startTick; /*record the start time of each time duration in runtime*/ + UINT32 intPktNum; /* the number of intercepted packets in runtime */ + } FW_IP_TRK_ENTRY; + +#ifdef FW_INET6 +typedef struct { + struct in6_addr ipV6Addr; /* Source or destination IPV6 address */ + UINT32 startTick; /*record the start time of each time duration in runtime*/ + UINT32 intPktNum; /* the number of intercepted packets in runtime */ + } FW_IPV6_TRK_ENTRY; +#endif + +/* rule entry definition. */ + +typedef struct { + FW_RULE_ADDR srcAddr; /* source IP address range */ + FW_RULE_ADDR dstAddr; /* dest IP address range */ + UINT8 hdrLen; /* IP header length, the 2 LSBs specify EQ, LT and GT op */ + UINT8 proto; /* protocol type, only support TCP, UDP and ICMP types */ + UINT8 option; /* for future use */ + UINT8 frag; /* 1 match fragment, 0 don't care */ + FW_RULE_PKTSIZE pktSize; /* IP packet size range */ + } FW_RULE_IPV4; + +#ifdef FW_INET6 +typedef struct { + struct in6_addr start; /* the start IP address */ + struct in6_addr end; /* the end IP address */ + } FW_RULE_V6ADDR; + +typedef struct { + UINT8 num; + UINT8 types[FW_EXT_TYPE_NUM]; + } FW_V6EXT_TYPES; + +typedef struct { + UINT8 proto; + UINT8 opType; /* one of them, all of them, only them */ + union { + FW_V6EXT_TYPES hdr; + FW_RULE_RANGE range; /* number of ext header range */ + } u; + } FW_RULE_V6EXT_HDRS; + +typedef struct { + UINT32 start; + UINT32 end; + } FW_RULE_V6LABEL; + +typedef struct { + FW_RULE_V6ADDR srcAddr; /* source IP address range */ + FW_RULE_V6ADDR dstAddr; /* dest IP address range */ + FW_RULE_V6EXT_HDRS extList; /* ext header type rule */ + FW_RULE_V6LABEL flowLabel; + FW_RULE_PKTSIZE pktSize; /* IP packet size range */ + } FW_RULE_IPV6; +#endif + +typedef struct { + FW_RULE_IF srcIf; /* source IF rule, only for pre-input,input and forward*/ + FW_RULE_IF dstIf; /* dest IF rule, only for forward, pre-output and output*/ + union { +#ifdef FW_INET6 + FW_RULE_IPV6 ipv6; +#endif + FW_RULE_IPV4 ipv4; + } uip; + union { + FW_RULE_TCP tcp; /* TCP header rule */ + FW_RULE_UDP udp; /* UDP header rule */ + FW_RULE_ICMP icmp; /* ICMP header rule */ + } tport; /* transport layer */ + FW_RULE_TIMEOFDAY timeOfDay; /* time of day rule */ + FW_RULE_CONN_TRACK connTrack; /* connection tracking */ + FW_RULE_RATE_LIMIT rateLimit; + UINT32 actions; /* action to take when rule matches, such as FW_ACCEPT */ + } FW_RULE_ENTRY; + +#ifdef FW_INET6 +#define srcAddrRangeV6 uip.ipv6.srcAddr +#define dstAddrRangeV6 uip.ipv6.dstAddr +#define extListV6 uip.ipv6.extList +#define srcStartV6Addr8 uip.ipv6.srcAddr.start.s6_addr8 +#define srcEndV6Addr8 uip.ipv6.srcAddr.end.s6_addr8 +#define srcStartV6Addr uip.ipv6.srcAddr.start +#define srcEndV6Addr uip.ipv6.srcAddr.end +#define srcStartV6Addr32 uip.ipv6.srcAddr.start.s6_addr32 +#define srcEndV6Addr32 uip.ipv6.srcAddr.end.s6_addr32 +#define dstStartV6Addr8 uip.ipv6.dstAddr.start.s6_addr8 +#define dstEndV6Addr8 uip.ipv6.dstAddr.end.s6_addr8 +#define dstStartV6Addr32 uip.ipv6.dstAddr.start.s6_addr32 +#define dstEndV6Addr32 uip.ipv6.dstAddr.end.s6_addr32 +#define protoV6 uip.ipv6.extList.proto +#define pktSizeV6 uip.ipv6.pktSize +#define extListV6 uip.ipv6.extList +#define extRangeV6 extListV6.u.range +#define extHdrV6 extListV6.u.hdr +#define fLabelV6 uip.ipv6.flowLabel + +#endif + +#define srcStartV4Addr uip.ipv4.srcAddr.start.s_addr +#define srcEndV4Addr uip.ipv4.srcAddr.end.s_addr +#define srcAddrRangeV4 uip.ipv4.srcAddr +#define dstAddrRangeV4 uip.ipv4.dstAddr +#define dstStartV4Addr uip.ipv4.dstAddr.start.s_addr +#define dstEndV4Addr uip.ipv4.dstAddr.end.s_addr +#define hdrLenV4 uip.ipv4.hdrLen +#define protoV4 uip.ipv4.proto +#define fragV4 uip.ipv4.frag +#define pktSizeV4 uip.ipv4.pktSize + +#define tcpSrcPortStart tport.tcp.srcPort.start +#define tcpSrcPortEnd tport.tcp.srcPort.end +#define tcpDstPortStart tport.tcp.dstPort.start +#define tcpDstPortEnd tport.tcp.dstPort.end +#define udpSrcPortStart tport.udp.srcPort.start +#define udpSrcPortEnd tport.udp.srcPort.end +#define udpDstPortStart tport.udp.dstPort.start +#define udpDstPortEnd tport.udp.dstPort.end + +/* TCP/UDP service descriptor for registering an extension module */ + +typedef struct { + UINT16 srcPort; /* source port */ + UINT16 dstPort; /* destination port */ + UINT8 proto; /* protocol type: TCP or UDP */ + } FW_SERVICE_DESC; + +typedef UINT32 (*FW_EXT_FUNC_PTR)(FW_LOC_TYPE loc,void * groupId, + struct mbuf * pMblk, void * funcArg); + +/* descriptor for registering an extension module */ + +typedef struct { + FW_SERVICE_DESC service; /* the service to match */ + FW_EXT_FUNC_PTR pUserFunc; /* the user registered function */ + void * usrFuncArg; /* the user function argument */ + FW_EVENT_FUNC_ENTRY evtFuncs[FW_EVT_FUNC_NUM]; /* TCP event functions, this + is only for internal use. User should zero it out */ + } FW_EXT_HANDLING_DESC; + + +/* Rule entry node, user defined rule + extension handling + internal flag */ + +typedef struct { + NODE node; /* link to another same type entry */ + UINT32 fieldsFlag; /* rule entry fields set flag */ + void * ownerId; /* for future use */ + FW_EXT_HANDLING_DESC * pExtDesc; /* extension handling descriptor array */ + UINT16 eDescInx; /* the current index of pExtDesc array */ + UINT16 eDescMaxEntries; /* the max number of entries of pExtDesc */ + FW_RULE_ENTRY rule; /* the rule entry */ + } FW_RULE_ENTRY_NODE; + +/* rule group attributes */ + +typedef struct { + void * groupId; /* unique value to identify this group */ + char * pGrpName; /* name of the group */ + UINT16 logLen; /* logged len of the packet if FW_LOG specified */ + UINT16 type; /* a bitwise value to indicate the rule group type */ + } FW_GROUP_ATTR; + +/* a generic get string buffer */ + +typedef struct { + char * pBuf; /* point to the buffer to hold the string */ + int len; /* length of the buffer */ + } FW_STR_GET_BUF; + +/* Group head entry, rule group attributes + a head rule */ + +typedef struct { + NODE node; /* link to another same type entry */ + LIST ruleList; /* a list of rules in this group including head rule */ + FW_GROUP_ATTR attr; /* rule group attributes */ + FW_RULE_ENTRY_NODE ruleEntry; /* head rule node */ + } FW_GROUP_HEAD_ENTRY; + +/* Non-Volatile storage interface function typedefs */ + +typedef int (*FW_NV_GET_FUNC_PTR) + ( + char * pParamsId, /* the parameter block ID, 0 terminated less than or + * equal 8 byte(including 0 character) string */ + char * pParamsBuf, /* buffer to store the parameters */ + int len, /* the length of the buffer */ + int offset /* offset from the start of the storage */ + ); + +typedef int (*FW_NV_SET_FUNC_PTR) + ( + char * pParamsId, /* the parameter block ID, 0 terminated less than or + * equal 8 byte(including 0 character) string */ + char * pParams, /* parameter block for storing */ + int len, /* the length of the parameter block */ + int offset /* offset from the start of the storage */ + ); + +typedef int (*FW_NV_CLOSE_FUNC_PTR) + ( + char * pParamsId /* the parameter block ID, 0 terminated less than or + * equal 8 byte(including 0 character) string */ + ); + +/* logging interface function definition */ + +typedef void (*FW_LOG_FUNC_PTR)(struct mbuf *, UINT, FW_GROUP_ATTR *); + +/* MAC Filter typedefs */ + +/* MAC interface Identification */ + +typedef struct { + char name[END_NAME_MAX]; /* interface name string, NULL terminated */ + int unit; /* interface unit number */ + } FW_MAC_IF_ID; + +/* MAC address integer format representation, used for fast comparison */ + +typedef struct { + UINT32 first4; /* first 4 bytes of MAC address */ + UINT16 last2; /* last 2 bytes of MAC address */ + } FW_MAC_ADDR_INT_FORM; + +/* Use the addr field to initialize a MAC address. The addrInternal field is + * intended for internal use only + */ + +typedef union { + u_char addr[6]; + FW_MAC_ADDR_INT_FORM addrInternal; /* for internal use only */ + } FW_MAC_ADDR_TYPE; + +/* MAC header rule specification + * The mask will be used in the comparison equation as: + * (packet MAC address) & mask == (rule MAC address) & mask + */ + +typedef struct + { + FW_MAC_ADDR_TYPE src; /* source address */ + FW_MAC_ADDR_TYPE srcMask; /* source address mask */ + FW_MAC_ADDR_TYPE dst; /* destination address */ + FW_MAC_ADDR_TYPE dstMask; /* destination address mask */ + UINT16 type; /* the ethernet type */ + UINT32 actions; /* action codes (FW_REJECT, FW_ACCEPT and FW_LOG only) */ + } FW_MAC_USER_RULE; + +typedef UINT32 (*FW_MAC_EXT_FUNCPTR)(UINT32 type,struct mbuf * pMblk, + FW_MAC_USER_RULE *, void * callbackArg); + +/* content filter */ + +/* registered filtering service function prototype */ +typedef UINT32 (*FW_EXTSVC_FUNCPTR)(M_BLK_ID,void *); + + +/* function prototypes */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void * fwRuleGroupCreate (FW_LOC_TYPE,char *,UINT32); +extern void * fwRuleCreate (void *); +extern int fwRuleGroupDelete (FW_LOC_TYPE, void *); +extern int fwRuleDelete (void *, void *); +extern int fwRuleGroupMove (void *, void *, int); +extern int fwRuleMove (void *, void *, void *, int); +extern void * fwRuleGroupIdGet (FW_LOC_TYPE, int); +extern void * fwRuleIdGet (void *, int); +extern int fwRuleGroupCount (FW_LOC_TYPE); +extern STATUS fwRuleFieldGet (void *,UINT32,void *); +extern STATUS fwRuleFieldSet (void *,UINT32,UINT32, ...); +extern int fwExtHandlerInstall (void *, FW_SERVICE_DESC *, FW_EXT_FUNC_PTR, + void *, FW_EVENT_FUNC_ENTRY *); +extern UINT32 fwExtFtpHandler (FW_LOC_TYPE, void *, struct mbuf *, + void *); +extern BOOL fwRuleFilterIsInstalled (FW_LOC_TYPE); +extern UINT32 fwRuleFilterDftActionGet (FW_LOC_TYPE); +extern STATUS fwRuleLogInstall (FW_LOG_FUNC_PTR); + +extern STATUS fwRuleFilterRemove (FW_LOC_TYPE); +extern STATUS fwRuleFilterInstall (FW_LOC_TYPE, UINT32,FW_EXT_FUNC_PTR,void *, + char *, UINT32); +extern STATUS fwRuleListDelete (FW_LOC_TYPE); +extern int fwNvRuleLibInit (void); +extern STATUS fwNvRuleListSave (FW_LOC_TYPE); + +extern STATUS fwLogLibInit (int, char *, void *, void *); +extern void fwLogSyslogcInstall (FUNCPTR, FUNCPTR, FUNCPTR); +extern void fwLog (struct mbuf *, UINT, FW_GROUP_ATTR *); + +extern STATUS fwStateEntryTimeoutsSet (int,int,int); +extern void fwStateInit (void); +extern void fwStateCleanup (void); + +extern STATUS fwMacFilterInstall (int, FW_MAC_IF_ID *, UINT32, + FW_MAC_EXT_FUNCPTR, void *); + +extern STATUS fwMacFilterBind (int, char *, int); +extern STATUS fwMacFilterUnbind (int, char *, int); +extern STATUS fwMacFilterDefaultSet (int,UINT32,FW_MAC_EXT_FUNCPTR,void *); +extern UINT32 fwMacFilterRuleAdd (int,FW_MAC_USER_RULE *,FW_MAC_EXT_FUNCPTR, + void *); +extern STATUS fwMacCacheAdd (int,UINT8 *,BOOL); +extern STATUS fwMacCacheDelete (int,UINT8 *); +extern STATUS fwMacFilterRuleDelete (int type, UINT32); +extern void fwMacFilterShow (int); +extern STATUS fwMacLogInstall (FW_LOG_FUNC_PTR); + +extern void fwNvFuncsInstall (FW_NV_GET_FUNC_PTR, FW_NV_SET_FUNC_PTR, + FW_NV_CLOSE_FUNC_PTR); +extern int fwNvParamGet (char *, char *, int, int); +extern int fwNvParamSet (char *, char *, int, int); +extern int fwNvParamClose (char *); +extern BOOL fwNvInstalled (void); + +extern UINT32 fwUrlFilter (M_BLK_ID, void *); +extern UINT32 fwCookieFilter (M_BLK_ID, void *); +extern UINT32 fwJavaAppletFilter (M_BLK_ID, void *); +extern UINT32 fwActiveXFilter (M_BLK_ID, void *); +extern UINT32 fwProxyFilter (M_BLK_ID, void *); +extern BOOL fwExtSvcReg (void *,char *, FW_EXTSVC_FUNCPTR, void *, UINT32); +extern UINT32 fwExtSvcProcess (FW_LOC_TYPE, void *, struct mbuf *, void *); +extern void * fwExtSvcCreate (void); +extern BOOL fwExtSvcDelete (void *); +extern BOOL fwExtSvcUnreg (void *, char *, FW_EXTSVC_FUNCPTR); + +extern void * fwUrlListCreate (void); +extern BOOL fwUrlListDelete (void *); +extern BOOL fwUrlDelete (void *, void *); +extern BOOL fwUrlMoveAfter (void *, void *, void *); +extern void * fwUrlAdd (void *, char *, int); + + +#else /* __STDC__ */ + +extern void * fwRuleGroupCreate (); +extern void * fwRuleCreate (); +extern int fwRuleGroupDelete (); +extern int fwRuleDelete (); +extern int fwRuleGroupMove (); +extern int fwRuleMove (); +extern void * fwRuleGroupIdGet (); +extern void * fwRuleIdGet (); +extern int fwRuleGroupCount (); +extern STATUS fwRuleFieldGet (); +extern STATUS fwRuleFieldSet (); +extern int fwExtHandlerInstall (); +extern UINT32 fwExtFtpHandler (); +extern STATUS fwRuleFilterRemove (); +extern STATUS fwRuleFilterInstall (); +extern STATUS fwRuleListDelete (); +extern BOOL fwRuleFilterIsInstalled (); +extern UINT32 fwRuleFilterDftActionGet (); +extern int fwNvRuleLibInit (); +extern STATUS fwNvRuleListSave (); +extern STATUS fwRuleLogInstall (); + +extern STATUS fwLogLibInit (); +extern void fwLogSyslogcInstall (); +extern void fwLog (); + +extern STATUS fwStateEntryTimeoutsSet (); +extern void fwStateInit (); +extern void fwStateCleanup (); + +extern STATUS fwMacFilterInstall (); + +extern STATUS fwMacFilterBind (); +extern STATUS fwMacFilterUnbind (); +extern STATUS fwMacFilterDefaultSet (); +extern UINT32 fwMacFilterRuleAdd (); +extern STATUS fwMacCacheAdd (); +extern STATUS fwMacCacheDelete (); +extern STATUS fwMacFilterRuleDelete (); +extern void fwMacFilterShow (); +extern STATUS fwMacLogInstall (); + +extern void fwNvFuncsInstall (); +extern int fwNvParamGet (); +extern int fwNvParamSet (); +extern int fwNvParamClose (); +extern BOOL fwNvInstalled (); + +extern UINT32 fwUrlFilter (); +extern UINT32 fwCookieFilter (); +extern UINT32 fwJavaAppletFilter (); +extern UINT32 fwActiveXFilter (); +extern UINT32 fwProxyFilter (); +extern BOOL fwExtSvcReg (); +extern UINT32 fwExtSvcProcess (); +extern void * fwExtSvcCreate (); +extern BOOL fwExtSvcDelete (); +extern BOOL fwExtSvcUnreg (); + +extern void * fwUrlListCreate (); +extern BOOL fwUrlListDelete (); +extern BOOL fwUrlDelete (); +extern BOOL fwUrlMoveAfter (); +extern void * fwUrlAdd (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCfwRuleLibh */ diff --git a/h/wrn/firewall/syslogcLib.h b/h/wrn/firewall/syslogcLib.h new file mode 100644 index 0000000..e575021 --- /dev/null +++ b/h/wrn/firewall/syslogcLib.h @@ -0,0 +1,90 @@ +/* syslogcLib.h - syslog client interface header */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,27feb04,myz removed syslogcBinToAscStrConvert() +01b,21nov03,svk Fix copyright notice +01a,03sep03,myz written. +*/ + +#ifndef __INCslogClientLibh +#define __INCslogClientLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vxWorks.h" + +/* syslog port */ + +#define SYSLOGC_DEFAULT_PORT 514 + +/* syslog facility code */ + +#define SYSLOGC_KERNEL_MSG 0 +#define SYSLOGC_USER_LEVEL_MSG 1 +#define SYSLOGC_MAIL_SYSTEM 2 +#define SYSLOGC_SYSTEM_DAEMONS 3 +#define SYSLOGC_SECURITY_MSG 4 +#define SYSLOGC_MSG_FROM_SYSLOGD 5 +#define SYSLOGC_LINE_PRINTER 6 +#define SYSLOGC_NETWORK_NEWS 7 +#define SYSLOGC_UUCP_SUBSYS 8 +#define SYSLOGC_CLOCK_DAEMON 9 +#define SYSLOGC_FTP_DAEMON 11 +#define SYSLOGC_NTP_SUBSYSTEM 12 +#define SYSLOGC_LOG_AUDIT 13 +#define SYSLOGC_LOG_ALERT 14 +#define SYSLOGC_LOCAL0 16 +#define SYSLOGC_LOCAL1 17 +#define SYSLOGC_LOCAL2 18 +#define SYSLOGC_LOCAL3 19 +#define SYSLOGC_LOCAL4 20 +#define SYSLOGC_LOCAL5 21 +#define SYSLOGC_LOCAL6 22 +#define SYSLOGC_LOCAL7 23 + +/* syslog severity code */ + +#define SYSLOGC_SEVERITY_EMERGENCY 0 +#define SYSLOGC_SEVERITY_ALERT 1 +#define SYSLOGC_SEVERITY_CRITICAL 2 +#define SYSLOGC_SEVERITY_ERROR 3 +#define SYSLOGC_SEVERITY_WARNING 4 +#define SYSLOGC_SEVERITY_NOTICE 5 +#define SYSLOGC_SEVERITY_INFORMATIONAL 6 +#define SYSLOGC_SEVERITY_DEBUG 7 + +/* misc. */ + +#define SYSLOGC_CODE_DEFAULT (0xFFFF) + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern int syslogcLibInit (char *); +extern void syslogcShutdown (void); +extern STATUS syslogcMdataSend(M_BLK_ID,int,char *, UINT16,ULONG); +extern STATUS syslogcBinDataSend (UINT8 *, int, char *,UINT16,ULONG); +extern STATUS syslogcStringSend (char *, UINT16,ULONG); + +#else /* __STDC__ */ + +extern int syslogcLibInit (); +extern void syslogcShutdown (); +extern STATUS syslogcMdataSend(); +extern STATUS syslogcBinDataSend (); +extern STATUS syslogcStringSend (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCslogClientLibh */ diff --git a/h/wrn/global_data_types.h b/h/wrn/global_data_types.h new file mode 100644 index 0000000..1cf02f4 --- /dev/null +++ b/h/wrn/global_data_types.h @@ -0,0 +1,33 @@ +/************************************************************************/ +/* Copyright (C) 1990 RouterWare, Inc. */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Blvd. Suite 212, Newport Beach, CA */ +/************************************************************************/ +#if !defined (__GLOBAL_DATA_TYPES_H__) +#define __GLOBAL_DATA_TYPES_H__ + +#define INVALID_HANDLE ((UINT)NULL) +#define MAX_NUMBER_OF_BYTES_IN_MAC_ADDRESS 16 + +#define WAIT_FOREVER 0xffffffff + +typedef UINT LINK_DRIVER_INSTANCE; +typedef UINT LINK_DRIVER_INTERFACE_HANDLE; + +typedef UINT ARP_INSTANCE; +typedef UINT ARP_INTERFACE_HANDLE; + +typedef UINT IP_INSTANCE; +typedef UINT IP_INTERFACE_HANDLE; + +typedef UINT ROUTE_MANAGER_INSTANCE; + +typedef UINT UDP_INSTANCE; + +typedef UINT ECHO_AGENT_INSTANCE; + +#endif /* __GLOBAL_DATA_TYPES_H__ */ diff --git a/h/wrn/ike/ike.h b/h/wrn/ike/ike.h new file mode 100644 index 0000000..9a02458 --- /dev/null +++ b/h/wrn/ike/ike.h @@ -0,0 +1,167 @@ +/* ike.h - */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,11may05,djp Added COOKIE_LEN define +01d,06may05,djp Added ikeUsrAppInit() +01c,29apr05,rlm Added missing #include +01b,26apr05,rlm Moved to new header file ike.h +01a,21jun04,hms Created. +*/ + +#ifndef __IKE_H +#define __IKE_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + + +/* +DESCRIPTION + +INCLUDE FILES: +*/ + +/* includes */ +#include + +/* defines */ + +#define COOKIE_LEN (8) /* Length of cookie associated with IKE session */ + +/* typedefs */ + +/* public functions */ + +void ikeUsrAppInit(void); + +STATUS ikeSetXform + ( + char * configuration_string + ); + +STATUS ikeSetProp + ( + char * configuration_string + ); + +STATUS ikeSetPropAttrib + ( + char * configuration_string + ); + +STATUS ikeAddPeerAuth + ( + char * configuration_string + ); + +STATUS ikeSetIfAddr + ( + char * configuration_string + ); + +STATUS ikeSetRetransmissionTimeouts + ( + int n_retries, + int t_ms + ); + +/* ike_tsi_show.c */ +STATUS ikeShowXform + ( + char * argument_string + ); + +STATUS ikeShowProp + ( + char * argument_string + ); + +STATUS ikeShowPeerAuth + ( + char * argument_string + ); + +STATUS ikeShowPSAll (void); + +STATUS ikeShowPS + ( + char * argument_string + ); + +STATUS ikeShowSessionsAll (void); + +STATUS ikeShowSessions + ( + char * argument_string + ); + +STATUS ikePsShow (void); + +int ikeGetRetransmissionNumRetries (void); + +int ikeGetRetransmissionTime (void); + +/* ike_tsi_misc.c */ +int ikeMon + ( + char * action_string + ); + +int ikeDebug + ( + char * action_string + ); + +int ikeInitialContact + ( + char * action_string + ); + +STATUS ikeDeletePeerAuth + ( + char * argument_string + ); + +STATUS ikeOpenSession + ( + char * argument_string + ); + +STATUS ikeCloseSessions + ( + char * argument_string + ); + +STATUS ikeBuildPS + ( + char * argument_string + ); + +STATUS ikeTeardownPS + ( + char * argument_string + ); + +STATUS ikeRenewPS + ( + char * argument_string + ); + +void ikeTrafficInitiatedNegotiationSet + ( + BOOL enable + ); + +BOOL ikeTrafficInitiatedNegotiationGet(void); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif /* __cplusplus */ + +#endif /* __IKE_H */ + diff --git a/h/wrn/ike/ikeCerts.h b/h/wrn/ike/ikeCerts.h new file mode 100644 index 0000000..8c424eb --- /dev/null +++ b/h/wrn/ike/ikeCerts.h @@ -0,0 +1,38 @@ +/************************************************************************/ +/* Copyright 2000-2005 Wind River Systems, Inc. */ +/************************************************************************/ +/* +modification history +-------------------- +01a,01mar2005,hms created +*/ + +#if !defined (__IKECERTS_H__) +#define __IKECERTS_H__ + +#ifdef IKE_CERTIFICATE_SUPPORT + +#include +#include + +extern STATUS ikeCAListSet + ( + char * CAFilenames /* a comma-delimited list of CA filenames */ + ); + +extern STATUS ikeCRLListSet + ( + char * CRLFilenames /* a comma-delimited list of CRL filenames */ + ); + +extern STATUS ikeCertStoreVerifyFlagsSet + ( + unsigned long flags + ); + +extern STATUS ikeCertStoreRefresh(); + +#endif /* IKE_CERTIFICATE_SUPPORT */ + +#endif /* __IKECERTS_H__ */ + diff --git a/h/wrn/ike/ikeInit.h b/h/wrn/ike/ikeInit.h new file mode 100644 index 0000000..86b6502 --- /dev/null +++ b/h/wrn/ike/ikeInit.h @@ -0,0 +1,67 @@ +/************************************************************************/ +/* Copyright 2000-2005 Wind River Systems, Inc. */ +/************************************************************************/ + +/* ikeInit.h - header file for ike_init.c */ + +/* +modification history +-------------------- +01c,06may05,rlm Added prototype for usrIkeInit() configlette function. +01b,30nov04,jfb Beautified again +01a,29nov04,jfb Beautified + +01b,11june01,tkp pompeii enhancements. +01a,21june00,aos created. + +*/ + +#if !defined (__IKE_INIT_H__) +#define __IKE_INIT_H__ + +#ifdef __cplusplus +extern "C" + { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* ike configuration parameters */ +typedef struct ikecfgparams + { + unsigned int task_priority; + } IKE_CFG_PARAMS; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) + #pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifndef IKE_AUTO_START + #define IKE_AUTO_START 1 +#endif /* IKE_AUTO_START */ + +#ifndef IKE_TASK_PRIORITY + #define IKE_TASK_PRIORITY 75 +#endif /* IKE_TASK_PRIORITY */ + +/* function declarations */ + +extern STATUS ikeInit + ( + char * ikeCfg, + unsigned int task_priority + ); + +STATUS usrIkeInit + ( + int auto_start + ); + + +#ifdef __cplusplus + } +#endif + +#endif /* __IKE_INIT_H__ */ diff --git a/h/wrn/ike/ikeStats.h b/h/wrn/ike/ikeStats.h new file mode 100644 index 0000000..bae6251 --- /dev/null +++ b/h/wrn/ike/ikeStats.h @@ -0,0 +1,243 @@ +/* ikeStats.h - WindNet IPsec and IKE: IKE Statistics Public Header File */ + +/* Copyright 2000-2004 Wind River Systems, Inc. */ + +/* +modification history +------------------------------------- +01f,11may05,djp Removed COOKIE_LEN definitions (provided by ike.h) +01e,30nov04,jfb Beautified again +01d,29nov04,jfb Beautified +01c,28jul04,cdw Added initialized field to counts struct +01b,21may04,djp Revised IKE stats +01a,05may04,djp Initial version of IKE Statistics header file +*/ + +/* +DESCRIPTION + +INCLUDE FILES: vxWorks.h + +IPsec and IKE Statistics Header File. Provides structures and API's for +retrieving counts associated with IPsec and IKE. +*/ + +#if !defined (__IKESTATS_H__) +#define __IKESTATS_H__ + +#include +#include /* import BYTE */ +#include /* import COOKIE_LEN */ + +#ifdef INCLUDE_COUNTERS_IKE +#define COUNTS_STRUCT_INITIALIZED (0xfa11deed) + +#ifdef __cplusplus +extern "C" + { +#endif + /* IKE_DIRECTIONAL_COUNTS + * + * This structure maintains unidirectional (either inbound or outbound) byte + * and packet counts associated with the IKE statistics counters. The fields + * are defined as follows: + * + * preprocessedByteCount - Provides the accumulated preprocessed byte count + * of all packets that were successfully processed. + * For inbound traffic, this refers to the byte + * count for packets prior to processing. For + * encrypted packets, this number will refer to the + * encrypted packet size or more generally, the + * "byte count on the wire". For outbound traffic, + * this count refers to the byte count prior to + * final processing of the data. For encrypted + * packets, this number will refer to the packet + * size prior to encryption. + * postprocessedByteCount - Provides the accumulated postprocessed byte count + * of all packets that were successfully processed. + * For inbound traffic, this refers to the byte + * count for packets after processing. For + * encrypted packets, this number will refer to the + * decrypted packet size or more generally, the + * size of the "data payload". For outbound traffic, + * this count refers to the byte count after final + * processing of the data. For encrypted + * packets, this number will refer to the packet + * size after encryption or more generally the + * "byte count on the wire". + * failedProcessingByteCount - Provides the accumulated byte count for all + * packets that failed processing. This number will + * correspond to a "preprocessed" byte count. Thus, + * for inbound packets, this will be a "data on the + * wire" count, whereas for outbound traffic, this + * will be an internal byte count. + * packetCount - Provides the total number of packets processed + * in the direction of interest. + * + * Thus, for traffic between two nodes (A and B), the inbound and outbound byte + * counts should match as follows: + * A inbound preprocessedByteCount = B outbound postprocessedByteCount + * A outbound postprocessedByteCount = B inbound preprocessedByteCount + */ + + typedef struct ike_directional_counts + { + UINT64 preprocessedByteCount; /* preprocessed byte count of successfully processed packets */ + UINT64 postprocessedByteCount; /* postprocessed byte count of successfully processed packets*/ + UINT64 failedProcessingByteCount; /* byte count of unsuccessfully processed packets */ + UINT32 packetCount; /* No. of packets processed in negotiations */ + } IKE_DIRECTIONAL_COUNTS; + + /* IKE_COUNTS + * + * This structure maintains byte, packet, and error counts for both IKE peer + * and IKE SA statistics. All messages between the applicable + * peer/SA are maintained here including Phase 1 and Phase 2 messages. + * The additional fields are inbound counters only. + */ + typedef struct ike_counts + { + IKE_DIRECTIONAL_COUNTS inbound; /* inbound byte and packet counters */ + IKE_DIRECTIONAL_COUNTS outbound; /* outbound byte and packet counters */ + UINT32 decryptionErrors; /* No. of decryption errors (inbound) */ + UINT32 authErrors; /* No. of authentication errors (inbound) */ + UINT32 proposalErrors; /* No. of proposal related errors (inbound)*/ + UINT32 packetErrors; /* No. of packets rcvd with errors */ + UINT64 initialized; /* initialized counts structure */ + } IKE_COUNTS; + + /* The following definitions provide API's for retrieving statistics associated + * with IPsec and IKE + */ + + /* IKE_PEER_STATS + * + * This structure is used to retrieve statistics associated with an IKE peer. + * A peer is identified by it's IP address. All messages between the applicable + * peer are maintained here including Phase 1 and Phase 2 messages. + */ + + typedef struct ike_peer_stats + { + IKE_COUNTS ikeCounts; + UINT32 phase1SuccessCount; /* No. of successful Phase 1 negotiations */ + UINT32 phase1FailureCount; /* No. of failed Phase 1 negotiations */ + UINT32 phase2SuccessCount; /* No. of successful Phase 2 negotiations */ + UINT32 phase2FailureCount; /* No. of failed Phase 2 negotiations */ + UINT32 noIKEPolicyErrors; /* No. of IKE msg rx from Peer with no IKE Policy */ + } IKE_PEER_STATS; + + /* IKE_SA_STATS + * + * This structure is used to retrieve statistics associated with an IKE + * Security Association (or IKE Channel). An IKE SA is created once Phase 1 + * Negotiations are successfully completed. Statistics identified here refer + * to messages associated with Phase 2 negotiations only. Note that accumulated + * statistics will also be retrievable via the IKEPeerStats structure. + */ + + #define MAX_XFORM_NAME_LEN (256) + + typedef struct ike_sa_stats + { + IKE_COUNTS ikeCounts; + UINT32 phase2SuccessCount; /* No. of successful Phase 2 negotiations */ + UINT32 phase2FailureCount; /* No. of failed Phase 2 negotiations */ + UINT32 upTime; /* Time since SA was created (in seconds) */ + UINT32 timeToLive; /* Time until SA is destroyed (in seconds) */ + UINT32 ipsecPSTotalCount; /* No. of IPsec SA's during IKE SA lifetime */ + UINT32 ipsecPSCurrentCount; /* No. of currently active IPsec SA's */ + BYTE initiatorCookie[COOKIE_LEN]; /* Cookie associated with initiator */ + BYTE responderCookie[COOKIE_LEN]; /* Cookie associated with responder */ + char ikeTransform[MAX_XFORM_NAME_LEN]; /* Name of negotiated IKE Transform */ + } IKE_SA_STATS; + + /* function declarations */ + + #if defined(__STDC__) || defined(__cplusplus) + + /* The following API is used to retrieve or print IKE statistics associated + * with a single IKE Peer. + */ + + extern STATUS ikePeerAuthStatsGet + ( + char *peerAddress, + IKE_PEER_STATS *stats + ); + + extern void ikePeerAuthStatsPrint + ( + char *peerAddress, + IKE_PEER_STATS *stats + ); + + extern void ikePeerAuthStatsDump + ( + char *peerAddress + ); + + /* The following API is used to retrieve and/or print IKE statistics + * associated with an IKE Security Association or Channel using the Peer IP + * address as the means to identify the statistics of interest. + */ + + extern STATUS ikeSAStatisticsGet + ( + char *peerAddress, + IKE_SA_STATS *stats + ); + + extern void ikeSAStatisticsPrint + ( + char *peerAddress, + IKE_SA_STATS *stats + ); + + extern void ikeSAStatisticsDump + ( + char *peerAddress + ); + + /* The following prints both Peer and IKE SA statistics associated with + * a peer address. peerAddress is as described above. + */ + + extern void ikeStatisticsDump + ( + char *peerAddress + ); + + /* The following API is used to retrieve and/or print IKE statistics + * associated with an IKE Security Association or Channel using the negotiated + * cookies as the means to identify the statistics of interest. + */ + + extern STATUS ikeSAStatisticsGetByCookie + ( + BYTE *initiatorCookie, + BYTE *responderCookie, + IKE_SA_STATS *stats + ); + + extern void ikeSAStatisticsDumpByCookie + ( + BYTE *initiatorCookie, + BYTE *responderCookie + ); + #else /* __STDC__ */ + extern STATUS ikePeerAuthStatsGet (); + extern void ikePeerAuthStatsPrint (); + extern STATUS ikePeerAuthStatsDump (); + extern STATUS ikeSAStatisticsGet (); + extern void ikeSAStatisticsPrint (); + extern STATUS ikeSAStatisticsDump (); + extern void ikeStatisticsDump (); + extern STATUS ikeSAStatisticsGetByCookie (); + extern void ikeSAStatisticsDumpByCookie (); + #endif /* __STDC__ */ + #ifdef __cplusplus + } + #endif +#endif /* INCLUDE_COUNTERS_IKE */ +#endif /* __IKESTATS_H__*/ diff --git a/h/wrn/ike/ike_callbacks.h b/h/wrn/ike/ike_callbacks.h new file mode 100644 index 0000000..1f4b05e --- /dev/null +++ b/h/wrn/ike/ike_callbacks.h @@ -0,0 +1,126 @@ +/* ike_callbacks.h - definitions for IKE phase 1 and 2 callback hooks */ + +/* + * Copyright (c) 2004-2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01i,10may05,djp Modified to support RTPs +01h,13apr05,djp Fixed include paths +01g,30mar05,djp added ikeCallbacksInit and ikeCallbacksShutdown +01f,30nov04,jfb Beautified again +01e,29nov04,jfb Beautified +01d,24jun04,rlm Modified IKE_PS_CALLBACK_DATA to include ike_spi_group + sub-struct directly, rather than via a pointer. +01c,22jun04,hms added cookies to ike session callbacks and SPIs to PS + callbacks. created structs for passed in callback parms. +01b,27apr04,rlm Added support for PS renewal callback. +01a,16apr04,hms created +*/ + +#if !defined (__IKE_CALLBACKS_H) +#define __IKE_CALLBACKS_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" + { +#endif + +/* +DESCRIPTION + +This header contains definitions for the callback functions available to +catch significant events in IKE negotiation. IKE phase 1 and phase 2 +can optionally be configured to call user-specified callback functions upon +completion (either successfully or unsuccessfully). + +INCLUDE FILES: +*/ + +/* includes */ +#include +#include +#include + +/* defines */ + +/* typedefs */ + +#if (STACK_NAME == STACK_NAME_V4_V6) && defined (INET6) +#define IKE_CALLBACK_ADDR_LEN 16 +#else +#define IKE_CALLBACK_ADDR_LEN 4 +#endif + +/* SPI is useful for retrieving statistics associated with a Protection Suite */ + +typedef struct IKE_SPI_GROUP + { + ULONG inbound_ah_spi; + ULONG inbound_esp_spi; + ULONG outbound_ah_spi; + ULONG outbound_esp_spi; + } IKE_SPI_GROUP; + +/* Cookie information is useful for retrieving statistics associated with an IKE session */ +typedef struct IKE_SESSION_CALLBACK_DATA + { + u_char sa_family; + BYTE dest_address[IKE_CALLBACK_ADDR_LEN]; + BYTE source_address[IKE_CALLBACK_ADDR_LEN]; + BYTE initiator_cookie[8]; + BYTE responder_cookie[8]; + STATUS status; + } IKE_SESSION_CALLBACK_DATA; + +typedef struct IKE_PS_CALLBACK_DATA + { + u_char sa_family; + BYTE dest_address[IKE_CALLBACK_ADDR_LEN]; + BYTE source_address[IKE_CALLBACK_ADDR_LEN]; + unsigned short dest_port; + unsigned short source_port; + int protocol; + BOOL local_initiated; + int suite_handle; + IKE_SPI_GROUP spi_group; + STATUS status; + } IKE_PS_CALLBACK_DATA; + +typedef void (*FP_IKE_SESSION_EVENT) (IKE_SESSION_CALLBACK_DATA *callback_data); + +typedef void (*FP_IKE_PS_EVENT) (IKE_PS_CALLBACK_DATA *callback_data); + +/* public prototypes */ + +STATUS ikeCallbacksInit(void); +void ikeCallbacksShutdown(void); + +STATUS ikeSessionCallbacksSet + ( + FP_IKE_SESSION_EVENT fp_session_opened, + FP_IKE_SESSION_EVENT fp_session_closed + ); + +STATUS ikeSessionCallbacksClear (void); + +STATUS ikePSCallbacksSet + ( + FP_IKE_PS_EVENT fp_ps_built, + FP_IKE_PS_EVENT fp_ps_torndown, + FP_IKE_PS_EVENT fp_ps_renewed + ); + +STATUS ikePSCallbacksClear (void); + +#if defined(__cplusplus) || defined(c_plusplus) + } +#endif /* __cplusplus */ +#endif /* __IKE_CALLBACKS_H */ +/* EOF */ diff --git a/h/wrn/ip_if.h b/h/wrn/ip_if.h new file mode 100644 index 0000000..b92ad2f --- /dev/null +++ b/h/wrn/ip_if.h @@ -0,0 +1,99 @@ +/************************************************************************/ +/* Copyright (C) 1999 RouterWare, Inc. */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Blvd. Suite 212, Newport Beach, CA */ +/************************************************************************/ +#if !defined (__IP_IF_H__) +#define __IP_IF_H__ +#include /* IP_MESSAGE definition */ +/* ************************************************************************************************************************ */ +#define ANY_IP_IF ((UINT)-1) +#define MAX_OPTION_DATA_LENGTH 38 + +/*typedef UINT IP_TYPE_OF_SERVICE;*/ +/*typedef UINT IP_IF_HANDLE;*/ +typedef UINT ARP_INTERFACE_HANDLE; +/* ************************************************************************************************************************ */ +/* IP Lower Layer Interface */ +/* ************************************************************************************************************************ */ +typedef enum IP_LOWER_CALLBACK_IF_TYPE +{ + IP_LOWER_CALLBACK_IF_ETHERNET_TYPE, + IP_LOWER_CALLBACK_IF_PPP_TYPE +} IP_LOWER_CALLBACK_IF_TYPE; +/* ************************************************************************************************************************ */ +typedef struct IP_LOWER_CALLBACK_IF +{ + bool (*fp_ip_lower_if_send) (struct IP_LOWER_CALLBACK_IF*, IP_MESSAGE* p_ip_message, + IP_ADDRESS next_hop_ip_address); + + /* NOTE: the next_hop_ip_address parameter should be set to the IP address of the next hop, + * which could be: + * 1> either the IP address of the destination + * 2> or, the IP address of the next hop gateway + * If this parameter is 0, the function would fail. */ + +} IP_LOWER_CALLBACK_IF; +/* ************************************************************************************************************************ */ +typedef struct IP_LOWER_ETHERNET_CALLBACK_IF +{ + IP_LOWER_CALLBACK_IF parent; +} IP_LOWER_ETHERNET_CALLBACK_IF; +/* ************************************************************************************************************************ */ +typedef struct IP_LOWER_PPP_CALLBACK_IF +{ + IP_LOWER_CALLBACK_IF parent; +} IP_LOWER_PPP_CALLBACK_IF; +/* ************************************************************************************************************************ */ +typedef struct IP_LOWER_IF +{ + IP_IF_HANDLE (*fp_ip_lower_if_add_interface) (struct IP_LOWER_IF*, IP_LOWER_CALLBACK_IF*); + + bool (*fp_ip_lower_if_remove_interface) (struct IP_LOWER_IF*, IP_IF_HANDLE); + + bool (*fp_ip_lower_if_add_address) (struct IP_LOWER_IF*, IP_ADDRESS ip_address, IP_ADDRESS subnet_mask); + + bool (*fp_ip_lower_if_remove_address) (struct IP_LOWER_IF*, IP_ADDRESS ip_address); + + bool (*fp_ip_lower_if_receive) (struct IP_LOWER_IF*, IP_IF_HANDLE, struct IP_MESSAGE*); + + bool (*fp_ip_lower_if_set_default_route) (struct IP_LOWER_IF*, IP_ADDRESS next_hop_gateway); +} IP_LOWER_IF; +/* ************************************************************************************************************************ */ +/* IP Upper Layer Interface */ +/* ************************************************************************************************************************ */ +typedef struct IP_UPPER_CALLBACK_IF +{ + bool (*fp_ip_upper_callback_if_up) (struct IP_UPPER_CALLBACK_IF*, IP_IF_HANDLE); + + bool (*fp_ip_upper_callback_if_down) (struct IP_UPPER_CALLBACK_IF*, IP_IF_HANDLE); + + bool (*fp_ip_upper_callback_if_add_address) (struct IP_UPPER_CALLBACK_IF*, IP_IF_HANDLE, IP_ADDRESS ip_address, + IP_ADDRESS subnet_mask); + + bool (*fp_ip_upper_callback_if_remove_address) (struct IP_UPPER_CALLBACK_IF*, IP_IF_HANDLE, IP_ADDRESS ip_address); + + bool (*fp_ip_upper_callback_if_receive) (struct IP_UPPER_CALLBACK_IF*, IP_IF_HANDLE, + struct IP_MESSAGE* p_ip_message); +} IP_UPPER_CALLBACK_IF; +/* ************************************************************************************************************************ */ +typedef struct IP_UPPER_IF +{ + bool (*fp_ip_upper_if_register) (struct IP_UPPER_IF*, IP_TRANSPORT_PROTOCOL, + struct IP_UPPER_CALLBACK_IF* p_transport); + + bool (*fp_ip_upper_if_deregister) (struct IP_UPPER_IF*, IP_UPPER_CALLBACK_IF*); + + bool (*fp_ip_upper_if_send) (struct IP_UPPER_IF*, IP_IF_HANDLE, struct IP_MESSAGE*, + IP_ADDRESS next_hop_gateway); + + UINT (*fp_ip_upper_if_get_mtu) (struct IP_UPPER_IF*, IP_IF_HANDLE); + + IP_ADDRESS (*fp_ip_upper_if_get_first_ip_interface_address) (struct IP_UPPER_IF*, IP_IF_HANDLE); +} IP_UPPER_IF; +/* ************************************************************************************************************************ */ +#endif /* __IP_IF_H__ */ diff --git a/h/wrn/ip_message_if.h b/h/wrn/ip_message_if.h new file mode 100644 index 0000000..ae14724 --- /dev/null +++ b/h/wrn/ip_message_if.h @@ -0,0 +1,248 @@ +/************************************************************************/ +/* Copyright (C) 1999 RouterWare, Inc. */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Blvd. Suite 212, Newport Beach, CA */ +/************************************************************************/ +#if !defined (__IP_MESSAGE_IF_H__) +#define __IP_MESSAGE_IF_H__ +/****************************************************************************************************************************/ +#define NUMBER_OF_BITS_IN_BYTE 8 +#define MAX_OPTION_DATA_LENGTH 38 +#define PADDING_BETWEEN_OPTIONS 1 +#define PADDING_AT_THE_END_OF_OPTIONS 0 + +typedef UINT IP_TYPE_OF_SERVICE; +/****************************************************************************************************************************/ +/* class : IP_MESSAGE */ +typedef enum IP_TRANSPORT_PROTOCOL +{ + ICMP_PROTOCOL = 1, + IGMP_PROTOCOL = 2, + TCP_PROTOCOL = 6, + UDP_PROTOCOL = 17, + ESP_PROTOCOL = 50, + AH_PROTOCOL = 51, + OSPF_PROTOCOL = 89, + TRANSPORT_PROTOCOL_ANY = 0xffff +} IP_TRANSPORT_PROTOCOL; +/**********************************************************************************************/ +typedef enum IP_OPTION_TYPE +{ + IP_RECORD_ROUTE_TYPE = 7, + IP_INTERNET_TIMESTAMP_TYPE = 68, + IP_SECURITY_TYPE = 130, + IP_LOOSE_SOURCE_AND_RECORD_ROUTE_TYPE = 131, + IP_STREAM_IDENTIFIER_TYPE = 136, + IP_STRICT_SOURCE_AND_RECORD_ROUTE_TYPE = 137 +} IP_OPTION_TYPE; +/**********************************************************************************************/ +typedef struct IP_OPTION +{ + IP_OPTION_TYPE option_type; + UINT option_data_length; + BYTE option_data [MAX_OPTION_DATA_LENGTH]; +} IP_OPTION; +/* ************************************************************************************************************************ */ +typedef struct IP_MESSAGE +{ + UINT header_length; + IP_TYPE_OF_SERVICE type_of_service; + UINT total_length; + UINT datagram_identifier; + UINT dont_fragment_flag; + UINT more_fragment_flag; + UINT fragment_offset; + UINT time_to_live; + IP_TRANSPORT_PROTOCOL transport_protocol; + UINT checksum; + UINT source_address; + UINT destination_address; + RW_CONTAINER* p_ip_option_list; + + bool (*fp_serialize) (struct IP_MESSAGE* p_ip_message, RW_PACKET_HANDLE* p_payload); + /* ownership of packet_handle is passed to the caller */ + bool (*fp_is_fully_deserialized) (struct IP_MESSAGE* p_ip_message); + + RW_PACKET_HANDLE payload; +} IP_MESSAGE; + +IP_MESSAGE* ip_message_create (void); +bool ip_message_destroy (IP_MESSAGE* p_ip_message); +bool ip_message_copy (IP_MESSAGE* p_ip_new_message, IP_MESSAGE* p_ip_original_message); +bool ip_option_list_copy (RW_CONTAINER* p_new_ip_option_list, RW_CONTAINER* p_original_ip_option_list); +bool ip_message_deserialize (IP_MESSAGE* p_ip_message, RW_PACKET_HANDLE payload); + /* ownership of packet_handle is passed to this function */ +IP_MESSAGE* ip_message_fully_deserialize (IP_MESSAGE* p_ip_message); +UINT ip_message_get_max_serialized_header_size (IP_MESSAGE* p_ip_message); +UINT ip_message_get_max_serialized_packet_size (IP_MESSAGE* p_ip_message); +/****************************************************************************************************************************/ +#if 0 + +typedef struct TCP_MESSAGE +{ + IP_MESSAGE parent; + UINT source_port_number; + UINT destination_port_number; + UINT sequence_number; + UINT acknowledgement_number; + UINT data_offset; + bool urg_flag; + bool ack_flag; + bool psh_flag; + bool rst_flag; + bool syn_flag; + bool fin_flag; + UINT window; + UINT urgent_pointer; + + /* And some more message header fields */ +} TCP_MESSAGE; + +TCP_MESSAGE* tcp_message_create (void); +bool tcp_message_destroy (TCP_MESSAGE* p_tcp_message); +bool tcp_message_copy (TCP_MESSAGE* p_tcp_new_message, TCP_MESSAGE* p_tcp_original_message); +/************************************************************************************************************************* */ +typedef struct UDP_MESSAGE UDP_MESSAGE; +struct UDP_MESSAGE +{ + IP_MESSAGE parent; + /* And some more message header fields */ +}; +UDP_MESSAGE* udp_message_create (void); +bool udp_message_destroy (UDP_MESSAGE* p_udp_message); +bool udp_message_copy (UDP_MESSAGE* p_udp_new_message, UDP_MESSAGE* p_udp_original_message); + +#endif +/* ************************************************************************************************************************ */ +#define ICMP_MESSAGE_FIXED_HEADER_SIZE 4 + +typedef enum ICMP_MESSAGE_TYPE +{ + ICMP_ECHO_REPLY_TYPE = 0, + ICMP_DESTINATION_UNREACHABLE_TYPE = 3, + ICMP_SOURCE_QUENCH_TYPE = 4, + ICMP_REDIRECT_TYPE = 5, + ICMP_ECHO_REQUEST_TYPE = 8, + ICMP_TIME_EXCEEDED_TYPE = 11, + ICMP_PARAMETER_PROBLEM_TYPE = 12, + ICMP_TIMESTAMP_TYPE = 13, + ICMP_TIMESTAMP_REPLY_TYPE = 14, + ICMP_INFO_REQUEST_TYPE = 15, + ICMP_INFO_REPLY_TYPE = 16, + ICMP_INVALID_TYPE = 17 +} ICMP_MESSAGE_TYPE; + +typedef enum ICMP_MESSAGE_CODE +{ + ICMP_CODE_DEFAULT = 0, + ICMP_CODE_NET_UNREACHABLE = 0, + ICMP_CODE_HOST_UNREACHABLE = 1, + ICMP_CODE_PROTOCOL_UNREACHABLE = 2, + ICMP_CODE_PORT_UNREACHABLE = 3, + ICMP_CODE_FRAGMENTATION_NEEDED = 4, + ICMP_CODE_SOURCE_ROUTE_FAILED = 5, + ICMP_CODE_REDIRECT_FOR_NETWORK = 0, + ICMP_CODE_REDIRECT_FOR_HOST = 1, + ICMP_CODE_REDIRECT_FOR_TOS_AND_NETWORK = 2, + ICMP_CODE_REDIRECT_FOR_TOS_AND_HOST = 3, + ICMP_CODE_TTL_EXCEEDED = 0, + ICMP_CODE_FRAGMENT_REASSEMBLY_TIME_EXCEEXDED = 1 +} ICMP_MESSAGE_CODE; + +typedef struct ICMP_MESSAGE +{ + IP_MESSAGE parent; + ICMP_MESSAGE_TYPE type; + ICMP_MESSAGE_CODE code; +} ICMP_MESSAGE; + +ICMP_MESSAGE* icmp_message_create (void); +bool icmp_message_destroy (ICMP_MESSAGE* p_icmp_message); +bool icmp_message_copy (ICMP_MESSAGE* p_icmp_new_message, ICMP_MESSAGE* p_icmp_original_message); +/* ************************************************************************************************************************ */ +/*ICMP Code: DESTINATION_UNREACHABLE, TIME_EXCEEDED, */ +typedef struct ICMP_COMMON_MESSAGE +{ + ICMP_MESSAGE parent; + BYTE* p_ip_header; + UINT header_length; +} ICMP_COMMON_MESSAGE; + +ICMP_COMMON_MESSAGE* icmp_common_message_create (void); +bool icmp_common_message_destroy (ICMP_COMMON_MESSAGE* p_icmp_common_message); +bool icmp_common_message_copy (ICMP_COMMON_MESSAGE* p_icmp_common_new_message, ICMP_COMMON_MESSAGE* p_icmp_common_original_message); +/* ************************************************************************************************************************ */ +/*ICMP Code: REDIRECT*/ +typedef struct ICMP_REDIRECT_MESSAGE +{ + ICMP_MESSAGE parent; + UINT gateway_ip_address; + BYTE* p_ip_header; + UINT header_length; +} ICMP_REDIRECT_MESSAGE; + +ICMP_REDIRECT_MESSAGE* icmp_redirect_message_create (void); +bool icmp_redirect_message_destroy (ICMP_REDIRECT_MESSAGE* p_redirect_icmp_message); +bool icmp_redirect_message_copy (ICMP_REDIRECT_MESSAGE* p_icmp_redirect_new_message, ICMP_REDIRECT_MESSAGE* p_icmp_redirect_original_message); +/* ************************************************************************************************************************ */ +/*ICMP Code: PARAMETER PROBLEM*/ +typedef struct ICMP_PARAMETER_PROBLEM_MESSAGE +{ + ICMP_MESSAGE parent; + UINT pointer; + BYTE* p_ip_header; + UINT header_length; +} ICMP_PARAMETER_PROBLEM_MESSAGE; + +ICMP_PARAMETER_PROBLEM_MESSAGE* icmp_parameter_problem_message_create (void); +bool icmp_parameter_problem_message_destroy (ICMP_PARAMETER_PROBLEM_MESSAGE* p_parameter_problem_icmp_message); +bool icmp_parameter_problem_message_copy (ICMP_PARAMETER_PROBLEM_MESSAGE* p_parameter_problem_icmp_new_message, + ICMP_PARAMETER_PROBLEM_MESSAGE* p_parameter_problem_icmp_old_message); +/* ************************************************************************************************************************ */ +/*ICMP Code: ECHO AND ECHO REPLY*/ +typedef struct ICMP_ECHO_MESSAGE +{ + ICMP_MESSAGE parent; + UINT identifier; + UINT sequence_number; + BYTE* p_data; + UINT data_length; +} ICMP_ECHO_MESSAGE; + +ICMP_ECHO_MESSAGE* icmp_echo_message_create (void); +bool icmp_echo_message_destroy (ICMP_ECHO_MESSAGE* p_echo_icmp_message); +bool icmp_echo_message_copy (ICMP_ECHO_MESSAGE* p_icmp_echo_new_message, ICMP_ECHO_MESSAGE* p_icmp_echo_original_message); +/* ************************************************************************************************************************ */ +/*ICMP Code: TIMESTAMP AND TIMESTAMPE REPLY*/ +typedef struct ICMP_TIMESTAMP_MESSAGE +{ + ICMP_MESSAGE parent; + UINT identifier; + UINT sequence_number; + UINT originate_timestamp; + UINT receive_timestamp; + UINT transmit_timestamp; +} ICMP_TIMESTAMP_MESSAGE; + +ICMP_TIMESTAMP_MESSAGE* icmp_timestamp_message_create (void); +bool icmp_timestamp_message_destroy (ICMP_TIMESTAMP_MESSAGE* p_timestamp_icmp_message); +bool icmp_timestamp_message_copy (ICMP_TIMESTAMP_MESSAGE* p_icmp_timestamp_new_message, ICMP_TIMESTAMP_MESSAGE* p_icmp_timestamp_original_message); +/* ************************************************************************************************************************ */ +/*ICMP Code: INFORMATION REQUEST AND INFORMATION REPLY*/ +typedef struct ICMP_INFO_MESSAGE +{ + ICMP_MESSAGE parent; + UINT identifier; + UINT sequence_number; +} ICMP_INFO_MESSAGE; + +ICMP_INFO_MESSAGE* icmp_info_message_create (void); +bool icmp_info_message_destroy (ICMP_INFO_MESSAGE* p_info_icmp_message); +bool icmp_info_message_copy (ICMP_INFO_MESSAGE* p_icmp_info_new_message, ICMP_INFO_MESSAGE* p_icmp_info_original_message); +/* ************************************************************************************************************************ */ +#endif /* __IP_MESSAGE_IF_H__ */ + diff --git a/h/wrn/ip_structures.h b/h/wrn/ip_structures.h new file mode 100644 index 0000000..83bafca --- /dev/null +++ b/h/wrn/ip_structures.h @@ -0,0 +1,95 @@ +/************************************************************************/ +/* Copyright (C) 1999 RouterWare, Inc. */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Blvd. Suite 212, Newport Beach, CA */ +/************************************************************************/ +#if !defined (__IP_STRUCTURES_H__) +#define __IP_STRUCTURES_H__ + +typedef struct IP_LOOPBACK_QUEUE +{ + RW_CONTAINER* p_packets; + RWOS_DISPATCHER dispatcher; + RWOS_EVENT event; +} IP_LOOKBACK_QUEUE; + +typedef struct IP_CLASS +{ + IP_UPPER_IF parent; + RW_CONTAINER* p_interface_list; + RW_CONTAINER* p_transport_list; + RW_CONTAINER* p_reassembly_list; + IP_LOOKBACK_QUEUE loopback; + IP_LOWER_IF parent_ip_lower_if; + IP_LOWER_CALLBACK_IF* p_ip_lower_callback_if; +} IP_CLASS; + +bool ip_register_upper_layer_protocol (IP_UPPER_IF* p_ip_instance, IP_TRANSPORT_PROTOCOL transport_protocol_id, + IP_UPPER_CALLBACK_IF* p_transport_call_back_interface); + +bool ip_deregister_upper_layer_protocol (IP_UPPER_IF* p_ip_instance, IP_UPPER_CALLBACK_IF* p_transport_instance); + +bool ip_send_packet (IP_UPPER_IF* p_ip_instance, IP_IF_HANDLE ip_interface, IP_MESSAGE* p_ip_message, + IP_ADDRESS next_hop_ip_address); + +UINT ip_upper_if_get_mtu (struct IP_UPPER_IF* p_ip_upper_if, IP_IF_HANDLE); + +IP_ADDRESS ip_upper_if_get_first_ip_interface_address (IP_UPPER_IF* p_ip_upper_if, IP_IF_HANDLE ip_if_handle); + +/************************************************************************/ +typedef struct IP_INTERFACE_CLASS +{ + IP_ADDRESS address; + + IP_ADDRESS subnet_mask; + + IP_CLASS* p_ip; + + /*LINK_DRIVER_INTERFACE_HANDLE link_driver_interface;*/ +} IP_INTERFACE_CLASS; + +typedef struct IP_TRANSPORT_CLASS +{ + IP_UPPER_CALLBACK_IF parent; + + IP_UPPER_CALLBACK_IF* p_transport_instance; + + IP_TRANSPORT_PROTOCOL protocol; +} IP_TRANSPORT_CLASS; + +typedef struct IP_REASSEMBLY_BLOCK +{ + IP_TYPE_OF_SERVICE type_of_service; + UINT datagram_identifier; + bool dont_fragment_flag; + bool more_fragment_flag; + UINT fragment_offset; + UINT time_to_live; + IP_TRANSPORT_PROTOCOL transport_protocol; + UINT source_address; + UINT destination_address; + + RWOS_TIME_STAMP time_stamp; + + RW_CONTAINER* p_fragments; +} IP_REASSEMBLY_BLOCK; + +typedef struct IP_REASSEMBLY_FRAGMENT +{ + UINT fragment_offset; + + RW_PACKET_HANDLE payload; +} IP_REASSEMBLY_FRAGMENT; + +typedef struct IP_LOOPBACK_PACKET +{ + IP_INTERFACE_CLASS* p_ip_interface; + + IP_MESSAGE* p_ip_message; +} IP_LOOPBACK_PACKET; + +#endif /* __IP_STRUCTURES_H__ */ diff --git a/h/wrn/ipsec/ipsec.h b/h/wrn/ipsec/ipsec.h new file mode 100644 index 0000000..d54aa61 --- /dev/null +++ b/h/wrn/ipsec/ipsec.h @@ -0,0 +1,96 @@ +/* ipsec.h - Interface routines for IPsec configuration */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,06may05,djp Added ipsecUsrAppInit() +01b,05may05,rlm Moved proto for ipsecNetJobMaxSet() from private ipsecP.h to + here. (Needed by configlette usrNetIpsecInit.c) +01a,26apr05,rlm Creation. +*/ + +#ifndef __IPSEC_H +#define __IPSEC_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + + +/* +DESCRIPTION + +INCLUDE FILES: +*/ + +/* includes */ + +/* defines */ + +/* typedefs */ + +/* public functions */ + +void ipsecUsrAppInit(void); + +void ipsecShowVer + ( + void + ); + +STATUS ipsecAttachIf + ( + char *cptrAddrString /* IP address */ + ); + +STATUS ipsecDetachIf + ( + char *cptrAddrString /* IP address */ + ); + +STATUS ipsecDFBit + ( + char *cptrDFBitConfig /* parameter string */ + ); + +STATUS ipsecSetPMTUAge + ( + char *cptrPMTUAgeConfig /* parameter string */ + ); + +STATUS ipsecShow + ( + void + ); + +STATUS ipsecShowIf + ( + void + ); + +int ipsecMon + ( + char *cptr_action /* parameter string */ + ); + +int ipsecDebug + ( + char *cptr_action /* parameter string */ + ); + +/* NOTE: ipsecNetJobMaxSet() is NOT a public API. However the prototype is + * required to be here so that the usrNetIpsecInit.c configlette can access it. + */ +STATUS ipsecNetJobMaxSet + ( + int maxJobs + ); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif /* __cplusplus */ + +#endif /* __IPSEC_H */ + diff --git a/h/wrn/ipsec/ipsecInit.h b/h/wrn/ipsec/ipsecInit.h new file mode 100644 index 0000000..987d7c8 --- /dev/null +++ b/h/wrn/ipsec/ipsecInit.h @@ -0,0 +1,62 @@ +/* ipsecInit.h - IP Security Initialization header file */ + +/* Copyright 2000-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,06may05,rlm Added prototype for usrIpsecInit(). Removed legacy K&R C + prototype for ikeInit(). +01c,30nov04,jfb Beautified again +01b,29nov04,jfb Beautified +01a,24mar00,aos written. +*/ + +#ifndef __ipsecInit_h__ +#define __ipsecInit_h__ + +#ifdef __cplusplus +extern "C" + { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) + #pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* ipsec configuration parameters */ +typedef struct ipseccfgparams + { + unsigned int task_priority; + } IPSEC_CFG_PARAMS; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) + #pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifndef IPSEC_AUTO_START + #define IPSEC_AUTO_START 1 +#endif /* IPSEC_AUTO_START */ + +#ifndef IPSEC_TASK_PRIORITY + #define IPSEC_TASK_PRIORITY 49 +#endif /* IKE_TASK_PRIORITY */ + +/* function declarations */ + +extern STATUS ipsecInit + ( + char * ipsecCfg, + unsigned int task_priority + ); + +STATUS usrIpsecInit + ( + int auto_start + ); + +#ifdef __cplusplus + } +#endif + +#endif /* __ipsecInit_h__ */ diff --git a/h/wrn/ipsec/ipsecLogger.h b/h/wrn/ipsec/ipsecLogger.h new file mode 100644 index 0000000..de0d4dd --- /dev/null +++ b/h/wrn/ipsec/ipsecLogger.h @@ -0,0 +1,172 @@ +/************************************************************************/ +/* Copyright 2000-2004 Wind River Systems, Inc. */ +/************************************************************************/ +/* +modification history +-------------------- +01g,13apr05,djp Fixed include paths +01f,11apr05,djp added ipsecLoggerInit +01e,30nov04,jfb Beautified again +01d,29nov04,jfb Beautified +01c,26may04,djp Added additional reasons for IKE packet discards +01b,13may04,hms added sa_family parm to callback. added ipsecLoggerIsEnabled() +01a,05may04,djp Initial version of IPsec Logger Header File +*/ + +#if !defined (__IPSEC_LOGGER_H__) +#define __IPSEC_LOGGER_H__ + +#ifdef __cplusplus +extern "C" + { +#endif +#include +#include + +/* The following definitions provide compile time control over events that are + * enabled for callback purposes. + * To enable a specific event at compile time, the line of interest is written + * as: + * #define + * where refers to the event of interest. To disable a specific + * event at compile time, the line of interest is modified to be: + * #undef . + * + * NOTE: The following macro definitions correspond to the enums below for + * the purpose of clarity. For example, + * the macro definition SPD_PACKET_DISCARD_ON corresponds to the enum + * SPD_PACKET_DISCARD. + */ + +#ifdef INCLUDE_LOGGING_IPSEC + +/* enable/disable. Do a #undef or comment out to exclude a logging category. + */ +#define INCLUDE_LOGGING_SPD_PACKET_DISCARD +#define INCLUDE_LOGGING_IKE_PACKET_DISCARD +#define INCLUDE_LOGGING_IPSEC_PACKET_DISCARD +#define INCLUDE_LOGGING_IKE_PHASE_I_FAIL +#define INCLUDE_LOGGING_IKE_PHASE_I_SUCCESS +#define INCLUDE_LOGGING_IKE_PHASE_II_FAIL +#define INCLUDE_LOGGING_IKE_PHASE_II_SUCCESS +#define INCLUDE_LOGGING_SEQUENCE_NUM_OVERFLOW +#define INCLUDE_LOGGING_SOFT_LIFE_TIME_EXPIRED +#define INCLUDE_LOGGING_HARD_LIFE_TIME_EXPIRED +#define INCLUDE_LOGGING_SOFT_LIFE_SIZE_EXPIRED +#define INCLUDE_LOGGING_HARD_LIFE_SIZE_EXPIRED +#endif /* INCLUDE_LOGGING_IPSEC */ +#define UNDEFINED_SA ((u_char)0) +#define UNDEFINED_IP NULL +#define UNDEFINED_PORT 0X7FFFFFFF /*INT_MAX*/ /*TRACKSPR #99463: including limits.h causes doulbe decl'n of INT_MAX in target/h/wrn\cci\gmp-impl.h*/ +#define UNDEFINED_PROTOCOL TRANSPORT_PROTOCOL_ANY +#define UNDEFINED_SPI 0 +#define UNDEFINED_SUITE_HANDLE 0xFFFFFFFF /*UINT_MAX*/ /*TRACKSPR #99463: including limits.h causes dougle decl'n of UINT_MAX in target/h/wrn/gmp-impl.h*/ +/* The IPSEC_LOG_EVENT_ID enum identifies the event Id (for example, SPD Packet + * discard) associated with an auditable (logged) event. + */ + +typedef enum IPSEC_LOG_EVENT_ID + { + UNKNOWN_EVENT = 0, + SPD_PACKET_DISCARD, + IKE_PACKET_DISCARD, + IPSEC_PACKET_DISCARD, + IKE_PHASE_I_FAIL, + IKE_PHASE_I_SUCCESS, + IKE_PHASE_II_FAIL, + IKE_PHASE_II_SUCCESS, + SEQUENCE_NUM_OVERFLOW, + SOFT_LIFE_TIME_EXPIRED, + HARD_LIFE_TIME_EXPIRED, + SOFT_LIFE_SIZE_EXPIRED, + HARD_LIFE_SIZE_EXPIRED, + IPSEC_LOG_EVENT_ID_MAX = HARD_LIFE_SIZE_EXPIRED + } + +IPSEC_LOG_EVENT_ID; + +/* The IPSEC_LOG_REASON enum identifies a second level of detail for an event + * Id. For example, an IKE_PHASE_I_FAIL (IKE Phase 1 Failure) can occur due + * to a variety of reasons (preshared key mismatch, algorithm mismatches, etc. + */ + +typedef enum IPSEC_LOG_REASON + { + UNDEFINED_REASON = 0, + NO_POLICY, /* SPD events */ + NO_PROTECTION_SUITE, + EXPLICIT_DISCARD_POLICY, + NEGOTIATION_TIMEOUT, + AUTHENTICATION_ERROR, + ENCRYPTION_ERROR, + DECRYPTION_ERROR, + INVALID_SPI_ERROR, + REPLAY_ERROR, + POLICY_ERROR, + PSK_MISMATCH, /* IKE Phase I events */ + HASH_ALG_MISMATCH, + ENCRYPTION_ALG_MISMATCH, + AUTHENTICATION_METHOD_MISMATCH, + PROPOSAL_MISMATCH, /* Phase II events */ + NULL_ESP, + NULL_AH, + ISAKMP_PACKET_ERROR, + IPSEC_INTERNAL_ERROR, + IKE_INTERNAL_ERROR, + IPSEC_LOG_REASON_MAX = IKE_INTERNAL_ERROR + } + +IPSEC_LOG_REASON; + +/* Logger callback function pointer */ +typedef void (*FP_IPSEC_LOGGER_GLOBAL_CALLBACK) (u_char sa_family, +BYTE* srcIPAddr, +BYTE* dstIPAddr, +unsigned int srcPort, +unsigned int dstPort, +int protocol, /*enum IP_TRANSPORT_PROTOCOL. don't want to include ip_message_if.h which includes rwos files*/ +int spi, +void* eventData, +IPSEC_LOG_EVENT_ID eventId, +IPSEC_LOG_REASON reasonId); + +extern STATUS ipsecLoggerInit + ( + void + ); + +extern BOOL ipsecLoggerIsEnabled + ( + void + ); + +extern STATUS ipsecLoggerCallbackSet + ( + FP_IPSEC_LOGGER_GLOBAL_CALLBACK funcptr, + BOOL enable + ); + +extern FP_IPSEC_LOGGER_GLOBAL_CALLBACK ipsecLoggerCallbackGet + ( + void + ); + +extern STATUS ipsecLoggerCallbackClear + ( + void + ); + +extern STATUS ipsecLoggerLogEventEnabledSet + ( + IPSEC_LOG_EVENT_ID eventId, + BOOL enable + ); + +extern BOOL ipsecLoggerIsLogEventEnabled + ( + IPSEC_LOG_EVENT_ID eventId + ); +#ifdef __cplusplus +} +#endif +#endif /* __IPSEC_LOGGER_H__*/ diff --git a/h/wrn/ipsec/ipsecStats.h b/h/wrn/ipsec/ipsecStats.h new file mode 100644 index 0000000..de2abdb --- /dev/null +++ b/h/wrn/ipsec/ipsecStats.h @@ -0,0 +1,180 @@ +/* ipsecStats.h - WindNet IPsec: Statistics Operations API's */ + +/* Copyright 2000-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,30nov04,jfb Beautified again +01c,29nov04,jfb Beautified +01b,02jun04,swc Moved enum to ipsec_stats.h and add prototypes. +01a,05may04,jfb created +*/ + +/* +DESCRIPTION + +INCLUDE FILES: vxWorks.h + +IPsec Statistics Header File. Provides structures and API's for +retrieving counts associated with IPsec. +*/ + +#if !defined (__IPSEC_STATS_H__) +#define __IPSEC_STATS_H__ + +#ifdef __cplusplus +extern "C" + { +#endif +#ifdef INCLUDE_COUNTERS_IPSEC + +/* enable/disable. Do a #undef or comment out to exclude a counter category + */ +#define INCLUDE_COUNTERS_NETWORK_INTERFACE +#define INCLUDE_COUNTERS_POLICIES +#define INCLUDE_COUNTERS_PROTECTION_SUITES +#endif /* INCLUDE_COUNTERS_IPSEC */ +/* The following definitions provide API's for retrieving statistics associated + * with IPsec. + */ + +/* NETWORK_INTERFACE_COUNTS + (this is included by ipsec_network_interface.h) + */ + +typedef struct interface_counts + { + UINT64 byteCount; + UINT32 packetCount; + UINT32 noPSDiscardCount; + UINT32 noPolicyDiscardCount; + UINT32 explicitDiscardCount; + UINT32 explicitBypassCount; + UINT32 policyErrorCount; + } INTERFACE_COUNTS; + +/* PROTECTION_SUITE_COUNTS + */ +typedef struct network_interface_counts + { + INTERFACE_COUNTS inbound; + INTERFACE_COUNTS outbound; + } NETWORK_INTERFACE_COUNTS; + +/* IPSEC_COUNTS used for both Protection Suite and Policy counts + */ + + #define MAX_NAME_LENGTH 256 + +typedef struct ipsec_counts + { + UINT64 preProcessedByteCount; + UINT64 postProcessedByteCount; + UINT64 failedProcessingByteCount; + UINT32 packetCount; + UINT32 espDecryptionErrors; + UINT32 ahAuthenticationErrors; + UINT32 espAuthenticationErrors; + UINT32 ahSequenceErrors; + UINT32 espSequenceErrors; + UINT32 otherErrors; + UINT32 ahSpi; + UINT32 espSpi; + UINT32 upTime; + UINT32 remainingTimeHard; + UINT32 remainingTimeSoft; + } IPSEC_COUNTS; + +/* SECURITY_POLICY_COUNTS +*/ +typedef IPSEC_COUNTS SECURITY_POLICY_COUNTS; + +/* PROTECTION_SUITE_COUNTS + */ +typedef struct protection_suite_counts + { + UINT32 proposalNumber; + char proposalName[MAX_NAME_LENGTH]; + char transform[MAX_NAME_LENGTH]; + IPSEC_COUNTS inbound; + IPSEC_COUNTS outbound; + } PROTECTION_SUITE_COUNTS; + +/* function declarations */ + + #if defined(__STDC__) || defined(__cplusplus) + + /* populates a NETWORK_INTERFACE_COUNTS structure */ + extern STATUS ipsecIfStatsGet + ( + char *cptrAddrString, + NETWORK_INTERFACE_COUNTS *stats + ); + + extern void ipsecIfStatsPrint + ( + NETWORK_INTERFACE_COUNTS *stats + ); + + extern void ipsecIfStatsDump + ( + char *cptrAddrString + ); + + /* populates a SECURITY_POLICY_COUNTS structure */ + extern STATUS ipsecPolicyStatsGet + ( + char *p_configuration_string, + SECURITY_POLICY_COUNTS *inboundStats, + SECURITY_POLICY_COUNTS *outboundStats + ); + + extern void ipsecPolicyStatsPrint + ( + SECURITY_POLICY_COUNTS *inboundStats + ); + + extern void ipsecPolicyStatsDump + ( + char *p_configuration_string + ); + + /* populates a PROTECTION_SUITE_COUNTS structure */ + extern STATUS protectionSuiteStatsGet + ( + char *p_configuration_string, + PROTECTION_SUITE_COUNTS *stats + ); + + extern STATUS protectionSuiteStatsGetBySPI + ( + int spi, + PROTECTION_SUITE_COUNTS *stats + ); + + extern void protectionSuiteStatsPrint + ( + PROTECTION_SUITE_COUNTS *stats + ); + + extern void protectionSuiteStatsDump + ( + char *p_configuration_string + ); + #else /* __STDC__ */ + extern STATUS ipsecIfStatsGet (); + extern STATUS ipsecIfStatsPrint (); + extern STATUS ipsecIfStatsDump (); + extern STATUS ipsecPolicyStatsGet (); + extern STATUS ipsecPolicyStatsPrint (); + extern STATUS ipsecPolicyStatsDump (); + extern STATUS protectionSuiteStatsGet (); + extern STATUS protectionSuiteStatsGetBySPI (); + extern STATUS protectionSuiteStatsPrint (); + extern STATUS protectionSuiteStatsDump (); + #endif /* __STDC__ */ + #ifdef __cplusplus + } + #endif +#endif /* __IPSEC_STATS_H__*/ diff --git a/h/wrn/ipsec/ipsec_memory_routines.h b/h/wrn/ipsec/ipsec_memory_routines.h new file mode 100644 index 0000000..c7cf059 --- /dev/null +++ b/h/wrn/ipsec/ipsec_memory_routines.h @@ -0,0 +1,98 @@ +/* ipsec_memory_routines.h - Memory routines for IPsec */ +/* Copyright 2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,30nov04,jfb Beautified again +01c,29nov04,jfb Beautified +01b,28sep04,cdw Added configuration for IPsec memory pool. Added + documentation for IPsec memory pool configuration. +01a,17sep04,cdw created +*/ + +#ifndef __IPSEC_MEMORY_ROUTINES_H__ +#define __IPSEC_MEMORY_ROUTINES_H__ + +#ifdef __cplusplus +extern "C" + { +#endif +#include + +/* Use the netbufLib memory pools to allocate small buffers. Using + * this feature requires tuning of the data clusters used by the + * memory pool. The following is recommended as a starting point, but + * additional tuning may be required: + * + * 64 byte clusters - IPSEC_NUM_64 1500 + * 128 byte clusters - IPSEC_NUM_128 1500 + * 256 byte clusters - IPSEC_NUM_256 50 + * 512 byte clusters - IPSEC_NUM_512 50 + * 1024 byte clusters - IPSEC_NUM_1024 25 + * 2048 byte clusters - IPSEC_NUM_2048 10 + * + * Use ipsecMemoryPoolShow() to observe remaining free clusters. + */ +#define IPSEC_MEMORY_USE_MEMORY_POOL +#ifdef IPSEC_MEMORY_USE_MEMORY_POOL +void ipsecMemoryPoolShow (void); +#define IPSEC_NUM_64 1500 +#define IPSEC_NUM_128 1500 +#define IPSEC_NUM_256 50 +#define IPSEC_NUM_512 50 +#define IPSEC_NUM_1024 25 +#define IPSEC_NUM_2048 10 +#endif + +/* Enable IPsec memory usage statistics - Observe results with + * ipsec_memory_stats() */ +#define IPSEC_MEMORY_STATISTICS + +/* taskSuspend() on memory allocation in tNetTask context. Controlled + * at runtime by setting/clearing the global BOOL tNetTaskAllocationDebugging */ +#undef IPSEC_MEMORY_NETTASK_ALLOC_DEBUGGING + +/* taskSuspend() the calling task on memory allocation failure */ +#undef IPSEC_MEMORY_SUSPEND_ON_FAILURE + +/* Initialize all buffers to IPSEC_MEMORY_INITIALIZATION_FIELD after + * allocation and prior to freeing. This is meant as a debugging aid, + * it should normally be undefined for performance reasons. */ +#undef IPSEC_MEMORY_INITIALIZE +#define IPSEC_MEMORY_INITIALIZATION_FIELD ((unsigned char)0xfd) + +extern BOOL tNetTaskAllocationDebugging; +STATUS ipsecMemoryStats (void); +void *ipsecMemoryAllocate + ( + UINT elemSize + ); + +void *ipsecMemoryCalloc + ( + UINT elemNum, + UINT elemSize + ); + +void ipsecMemoryFree ( +void *p_object); + +/* IPSEC_MEMORY_ALLOCATED_MAGIC indicates that the buffer was + * allocated using the ipsecMemory allocation routines */ +#define IPSEC_MEMORY_ALLOCATED_MAGIC 0xadfacade + +typedef struct + { + UINT reserved; /* Set to IPSEC_MEMORY_ALLOCATED_MAGIC */ + UINT bufferType; /* May indicate type of buffer (use is optional) */ + UINT bufferLength; /* The allocated length of *buffer */ + } IPSEC_MEMORY_NODE; + +/* buffer types */ + #define IPSEC_MEMORY_MBLK_ALLOCATED 0x80000000 + + #ifdef __cplusplus + } + #endif +#endif /* __IPSEC_MEMORY_ROUTINES_H__ */ diff --git a/h/wrn/ipsec/ipsec_mkm.h b/h/wrn/ipsec/ipsec_mkm.h new file mode 100644 index 0000000..3e2c380 --- /dev/null +++ b/h/wrn/ipsec/ipsec_mkm.h @@ -0,0 +1,112 @@ +/* ipsec_mkm.h - API functions for IPsec MKM Configuration */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,26apr05,rlm Creation. +*/ + +#ifndef __IPSEC_MKM_H +#define __IPSEC_MKM_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + + +/* +DESCRIPTION + +INCLUDE FILES: +*/ + +/* includes */ + +/* defines */ + +/* typedefs */ + +/* public functions */ + +BOOL mkmInitialize + ( + void + ); + +void mkmShutdown + ( + void + ); + +STATUS mkmAddBypass + ( + char *cptr_mkm_sa + ); + +STATUS mkmAddDiscard + ( + char *cptr_mkm_sa + ); + +STATUS mkmAddTransport + ( + char *cptr_mkm_sa + ); + +STATUS mkmAddTunnel + ( + char *cptr_mkm_sa + ); + +STATUS mkmSetInboundAH + ( + char *cptr_value_string + ); + +STATUS mkmSetOutboundAH + ( + char *cptr_value_string + ); + +STATUS mkmSetInboundESP + ( + char *cptr_value_string + ); + +STATUS mkmSetOutboundESP + ( + char *cptr_value_string + ); + +STATUS mkmCommit + ( + char *cptr_mkm_sa + ); + +STATUS mkmCommitAll + ( + void + ); + +STATUS mkmAbortAdd + ( + char *cptr_mkm_sa + ); + +STATUS mkmDeleteSA + ( + char *cptr_mkm_sa + ); + +STATUS mkmShow + ( + void + ); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif /* __cplusplus */ + +#endif /* __IPSEC_MKM_H */ diff --git a/h/wrn/ipsec/mkmInit.h b/h/wrn/ipsec/mkmInit.h new file mode 100644 index 0000000..4c85a00 --- /dev/null +++ b/h/wrn/ipsec/mkmInit.h @@ -0,0 +1,35 @@ +/* mkmInit.h - header file for ipsec_mkm_init.c */ +/* Copyright 2000-2001 Wind River Systems, Inc. */ +/************************************************************************/ + +#if !defined (__MKM_INIT_H__) +#define __MKM_INIT_H__ + +#ifdef __cplusplus +extern "C"{ +#endif +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ +/* manual key manager configuration parameters */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ +#ifndef MKM_AUTO_START +#define MKM_AUTO_START 1 +#endif + +/* function declarations */ +#if defined(__STDC__) || defined(__cplusplus) +extern STATUS mkmInit + ( + char *mkmCfg + ); +#else /* __STDC__ */ +extern STATUS mkmInit (); +#endif /* __STDC__ */ +#ifdef __cplusplus +} +#endif +#endif /* __MKM_INIT_H__ */ diff --git a/h/wrn/lan_driver_if.h b/h/wrn/lan_driver_if.h new file mode 100644 index 0000000..c6058d6 --- /dev/null +++ b/h/wrn/lan_driver_if.h @@ -0,0 +1,32 @@ +/************************************************************************/ +/* Copyright (C) 1999 RouterWare, Inc. */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Blvd. Suite 212, Newport Beach, CA */ +/************************************************************************/ +#if !defined (_LAN_DRIVER_IF_H_) +#define _LAN_DRIVER_IF_H_ + + +/****************************************************************************/ +/* LAN_DRIVER */ +/****************************************************************************/ +typedef struct LAN_DRIVER_CALLBACK_IF +{ + + bool (*fp_send_frame) (void); + +}LAN_DRIVER_CALLBACK_IF; + + +typedef struct LAN_DRIVER_LOWER_IF +{ + bool (*fp_lan_if_receive) (UINT port_handle, BYTE *p_data, UINT packet_size); + bool (*fp_lan_if_send) (UINT port_handle, BYTE *p_data, UINT packet_size); + +}LAN_DRIVER_LOWER_IF; + +#endif /*_LAN_DRIVER_IF_H_*/ \ No newline at end of file diff --git a/h/wrn/nat/natAlgApi.h b/h/wrn/nat/natAlgApi.h new file mode 100644 index 0000000..b7b1f1e --- /dev/null +++ b/h/wrn/nat/natAlgApi.h @@ -0,0 +1,464 @@ +/* natAlgApi.h */ + +/* NAT Application Level Gateway (ALG) Application Programming Interface */ + +/* Copyright 2000-2005 Wind River Systems, Inc. */ + +/* @format.tab-size 4, @format.use-tabs true, @format.new-line lf */ + +/* +modification history +-------------------- +01b,16feb05,svk Remove old branding +01a,25apr03,zhu updated copyright +110403 vks added NODE element to NAT_BIND_INFO structure +092402 vvv added include for lstLib.h +092402 vvv added NODE element to NAT_AGENT_INFO structure +092101 tk Change the format of natGetTransportBind function. Add new data types + NAT_BIND_SESSION and NAT_BIND_CHECK. +082801 zhu Redefinition of NAT_DIRECTION to match nat snmp. +080701 tk Add NAT_AGENT_EVENT and NAT_EVENT_INFO structures. +070201 tk Add more parameters in NAT_BIND_INFO, and add name field in NAT_AGENT_INFO. + Change parameters in NAT_STATUS. +060401 tk Add natUnregisterAgent function declaration. +*/ + +#ifndef __INCnatAlgApih +#define __INCnatAlgApih + +#include +#include + +typedef enum { /* Valid return value for all AlgApi functions */ + NAT_OK /* No error */ + ,NAT_INVALID_NAT_ID /* Invalid NAT instance ID (NULL?) */ + ,NAT_INVALID_AGENT_ID /* Invalid NAT agent id (not registered) */ + ,NAT_INVALID_BIND_ID /* Invalid bind ID */ + ,NAT_INVALID_BIND_INFO /* One or all of the bind params is not valid */ + ,NAT_INVALID_SESSION_ID /* Invalid session ID */ + ,NAT_INVALID_SESSION_INFO /* One or all of the session params is not valid */ + ,NAT_INVALID_BUNDLE_ID /* Invalid bundle ID */ + ,NAT_INVALID_ARG_PTR /* Invalid pointer argument (NULL?) */ + ,NAT_BIND_MAKE_FAILED /* Unable to create BIND or set bind params */ + ,NAT_SESSION_MAKE_FAILED /* Unable to create session or set session params */ + ,NAT_BIND_NO_MATCH /* No bind matching the specified addresses */ + ,NAT_UNSUPPORTED_AGENT_TYPE /* unsupported agent type */ + ,NAT_UNSUPPORTED_TUNNEL_TYPE /* unsupported tunnel type */ + ,NAT_UNSUPPORTED_FEATURE /* unsupported feature */ + ,NAT_SYSTEM_ERROR /* e.g., malloc() failed */ + +} NAT_STATUS; + /* Valid bits for nat_id_info.type */ +#define NAT_TYPE_BASIC (1<<0) /* Basic NAT */ +#define NAT_TYPE_NAPT (1<<1) /* Network Address/Protocol Translator */ +#define NAT_TYPE_BI_DIR (1<<2) /* Bi-directional */ +#define NAT_TYPE_TWICE (1<<3) /* Twice-NAT */ +#define NAT_TYPE_RSA_IP_SERVER (1<<4) /* RSA-IP Server */ +#define NAT_TYPE_RSAP_IP_SERVER (1<<5) /* RSAP-IP Server */ + /* Used for query operations only */ +#define NAT_TYPE_ALL 0 /* Report all NAT instances */ + +#if 0 /* Valid bits for NAT_AGENT_INFO.events */ +#define NAT_EVENT_DOWN (1<<0) /* NAT terminated */ +#define NAT_EVENT_TIMER (1<<1) /* NAT timer */ +#endif + +#define NAT_FLAG_NO_XLAT (1<<0) /* NAT does no IP/TCP/UDP translations */ +#define NAT_FLAG_PRE_XLAT (1<<1) /* Agent gets packet before NAT translations */ +#define NAT_FLAG_POST_XLAT (1<<2) /* Agent gets packet after NAT translations */ + +#define NAT_AGENT_DESC_LEN 128 /* Max agent description length (w/terminator) */ + +#define NAT_AGENT_NAME_LEN 16 /* Max name of agent */ + +typedef enum { /* Valid values for NAT_AGENT_INFO.type */ + NAT_AGENT_TYPE_ALG /* Application Level Gateway */ + ,NAT_AGENT_TYPE_RSIP_CLIENT /* RSIP client */ + ,NAT_AGENT_TYPE_BACKUP_NAT /* Back-up NAT */ + ,NAT_AGENT_TYPE_MGMT_APP /* Management application */ + ,NAT_AGENT_TYPE_LAST /* Must be last element of enum */ + +} NAT_AGENT_TYPE; + +typedef enum { /* NAT bind type */ + NAT_BIND_BASIC /* Basic (address only) */ + ,NAT_BIND_NAPT /* Address and Transport ID */ + +} NAT_BIND_TYPE; + +typedef enum { /* NAT bind check */ + NAT_BIND_FULL /* check both remote address & port */ + ,NAT_BIND_PARTIAL /* check remote address only */ +} NAT_BIND_CHECK; + +typedef enum { /* Valid bits for NAT_AGENT_INFO.events */ + NAT_BIND_CREATION /* bind creation */ + ,NAT_BIND_TERMINATION /* bind termination */ + ,NAT_SESSION_CREATION /* session creation */ + ,NAT_SESSION_TERMINATION /* session termination */ + +} NAT_AGENT_EVENT; + +typedef enum { /* NAT session direction */ + NAT_OUTBOUND = 1 /* outbound (from private realm) */ + ,NAT_INBOUND /* inbound (from public realm) */ + ,NAT_BIDIR /* bi-directional */ + +} NAT_DIRECTION; + + +typedef struct { /* NAT instance information */ + u_long id; /* NAT_CLASS instance pointer */ + u_long type; /* bit-field of supported NAT_TYPEs */ + BOOL enabled; /* transalations enabled/disabled */ + +} NAT_ID_INFO; + +typedef struct { /* Session tag */ + u_short protocol; /* IP protocol (TCP, UDP, ICMP, etc) */ + u_short transport; /* Transport ID (TCP/UDP port or ICMP ID) */ + +} NAT_SESSION_TAG; + +typedef struct { /* Session parameters */ + u_long src_addr; /* Source IPv4 address */ + u_short src_transport; /* Source transport-id */ + u_long dest_addr; /* Destination IPv4 address */ + u_short dest_transport; /* Destination transport-id */ + +} NAT_SESSION_PARMS; + +typedef struct { /* Session parameters */ + u_short protocol; /* Session protocol (TCP/UDP) */ + u_long local_addr; /* Local IPv4 address */ + u_short local_transport; /* Local transport-id */ + u_long remote_addr; /* Remote IPv4 address */ + u_short remote_transport; /* Remote transport-id */ + u_long global_addr; /* Global IPv4 address */ + u_short global_transport; /* Global transport-id */ + +} NAT_BIND_SESSION; + +typedef struct { + NODE node; + u_long id; /* Unique identifier for this bind (see note 1 below) */ + u_long agent_id; /* Controlling agent (0 = NAT itself) */ + NAT_BIND_TYPE type; /* Basic (address only) or NAPT */ + NAT_DIRECTION direction; /* Inbound or Outbound direction (see note 2 below) */ + BOOL static_entry; /* Does not expire (see note 3 below) */ + BOOL use_local_port; /* Use local port as the global port (see note 4 below) */ + u_short protocol; /* TCP/UDP */ + u_long local_addr; /* Local IPv4 address */ + u_short local_transport; /* Local transport-ID (TCP/UDP port) */ + u_long global_addr; /* Global IPv4 address */ + u_short global_transport; /* Global transport-ID (TCP/UDP port) */ + u_long remote_addr; /* Remote (destination) address */ + u_short remote_transport; /* Remote (destination) port (see note 5 below) */ + u_long max_idle_time; /* max idle time of dynamic bind (see note 6 below) */ + u_long current_idle_time; /* current bind's idle time (see note 6 below) */ + u_long max_lease_time; /* relevant only to RSIP (see note 6 below) */ + u_long avail_lease_time; /* relevant only to RSIP (see note 6 below) */ + u_long nat_transport_entry;/* NAT TCP/UDP translation entry (see note 7 below) */ + u_long nat_address_entry; /* NAT ip translation entry (see note 8 below) */ + +} NAT_BIND_INFO; + +/************************** Note for NAT_BIND_INFO structure *********************************** + +1. If this id is set to 0, the caller requests NAT to create a new bind descriptor. The caller + is responsible for filling in the parameters defined in the above structure prior to calling + natSetBind. Upon successful creation of the bind, natSetBind will fill in the ID of the + bind in this field. If the id is set to a non-zero value, the caller requests NAT to set + some or all parameters in the existing bind. The latter feature is not supported in the + current implementation of natSetBind. + +2. Typically, the direction is set to OUTBOUND if the address bind is created as a result of + an outbound traffic. Conversely, it is set to INBOUND if the bind is created as a result + of an inbound traffic. Regardless of the direction, natSetBind will cause NAT to create a + bind descriptor. If the direction is OUTBOUND in NAPT, NAT will set the global port in this + bind to the local spoofed port unless the use_local_port field is set (see note 3). For + INBOUND direction, it is the responsibility of the NAT client to assign the global port + number in the bind as this is equivalent to creating a static entry but the duration of + the bind can be set by the static_entry field (see note 3). + +3. When static_entry is set to FALSE, the bind lives only for the duration of its timer. When + its timer expires, NAT will automatically deletes the bind. If it is set to TRUE, the bind + is kept alive even when its timer expires until it is specifically deleted by calling + natFreeBind or by commands from the shell (i.e. natTcpStaticDelete or natUdpStaticDelete). + The timer may show 0 when it expires in the static bind, but will be reset to its default + value again when the bind is reactivated (i.e. new packet whose address matches this bind is + received) + +4. When use_local_port is set to TRUE and direction is set to OUTBOUND, the global port in the + created bind will be set to the source (or local) port instead of the local spoofed port. + This feature is required in some ALGs (H.323 ALG is an example of this). + +5. The remote_transport (or TCP/UDP port of the remote host) field may not be known sometimes + at the time of the bind creation. This is particularly true when one creates an OUTBOUND + bind in preparation of future inbound session (some ALGs may require this). In such a case, + the remote_transport can be left unknown when calling natSetBind. NAT will later assign + the correct value of the remote_transport when the actual inbound session is started. + +6. Field is defined but not supported in the current implementation. + +7. nat_transport_entry provides the link between the bind descriptor and the actual TCP/UDP + translation entry managed internally by NAT. The value of this field can be set to 0 + before calling natSetBind. When natSetBind is called, a new translation entry is created + internally by NAT, and the pointer to this entry is stored in this field. For historical + reason, NAT internally creates and maintains different sets of translation lists apart from + the bind list. Having this field enables NAT to also call natSetBind to create a new + translation entry and to correlate between the bind descriptor and the translation entry it + has just created. It may also be useful for the ALG if it wishes to tap into NAT's internal + translation entry parameters; otherwise, the ALG may just ignore this field. + +8. nat_address_entry provides the link between the bind descriptor and the actual IP + translation entry managed internally by NAT. This field serves the same purpose as the + nat_transport_entry except it is used only for the IP translation. This field applies only + to Basic NAT. +*************************************************************************************************/ + +typedef struct { + u_long id; /* Unique identifier for this session */ + u_long agent_id; /* Controlling agent (0 = NAT agent) */ + u_long bundle_id; /* For ALG use, defaults to session id */ + NAT_DIRECTION direction; /* Inbound/Outbound/Bidir */ + u_long pri_bind_id; /* Primary bind id */ + u_long sec_bind_id; /* Secondary bind id (Twice-NAT) */ + NAT_SESSION_PARMS org_session; /* Original session parameters */ + NAT_SESSION_PARMS xlat_session; /* Translated session parameters */ + NAT_SESSION_TAG session_tag; /* Identifies type of packets to translate */ + +} NAT_SESSION_INFO; + +typedef struct { + NAT_BIND_INFO *bind_info; /* pointer to bind entry */ + NAT_SESSION_INFO *session_info; /* pointer to session entry */ + +} NAT_EVENT_INFO; + +typedef void(*NAT_EVENT_CALLBACK) + (u_long nat_id, u_long agent_id, NAT_AGENT_EVENT event, NAT_EVENT_INFO *event_info); + +typedef BOOL(*NAT_PACKET_CALLBACK) + (u_long nat_id, u_long agent_id, u_long session_id, NAT_DIRECTION dir, void* packet); + +typedef struct { + NODE node; + u_long id; /* Agent idenitfier, set by NAT */ + char desc[NAT_AGENT_DESC_LEN]; /* official description */ + char name[NAT_AGENT_NAME_LEN]; /* name of agent */ + NAT_AGENT_TYPE type; /* One of NAT_AGENT_TYPE */ + u_long flags; /* See NAT_FLAG_ */ + u_long events; /* bit-field of requested callback events */ + u_long timer_interval; /* timer event interval (in seconds) */ + NAT_EVENT_CALLBACK event_callback; /* agent callback function pointer */ + NAT_SESSION_TAG session_tag; /* Identifies type of packets to translate */ + NAT_PACKET_CALLBACK packet_callback; /* agent packet processing function */ + +} NAT_AGENT_INFO; + + +#ifdef __cplusplus +extern "C" { +#endif + +/***************************************************************************** +Function: natGetID + +Description: +This function is called by the external agent to obtain the NAT service +identifier and its type. The external agent is responsible +for allocating the NAT_ID_INFO data structure and pass its pointer as the +argument to this function. NAT fills in the structure including the NAT ID. +*****************************************************************************/ +NAT_STATUS natGetID + ( + NAT_ID_INFO* + ); + +/***************************************************************************** +Function: natRegisterAgent + +Description: +This function is called by the external agent to register with the NAT service. +The external agent allocates the NAT_AGENT_INFO storage and fill in the agent's +information before passing it to the function. Upon successful completion of +this function, NAT will assign and return the agent ID (i.e. handle) in the +NAT_AGENT_INFO data structure. +*****************************************************************************/ +NAT_STATUS natRegisterAgent + ( + u_long nat_id, + NAT_AGENT_INFO* + ); + +/***************************************************************************** +Function: natUnregisterAgent + +Description: +This function is called by the external agent to unregister itself from the +NAT service. +*****************************************************************************/ +NAT_STATUS natUnregisterAgent + ( + u_long nat_id, + u_long agent_id + ); + +/***************************************************************************** +Function: natSetBind + +Description: +This function is called by the external agent to create a new address bind or +set certain parameters of an existing bind. The bind can be an address bind +or transport bind. The caller is expected to fill in the NAT_BIND_INFO +structure. A new bind request is made by setting the bind ID (in NAT_BIND_INFO) +to 0. A non-zero bind ID would be interpreted to mean that the agent is +attempting to set some existing bind parameters. + +If the caller requests for a bind creation, and NAT is successful in creating +a new bind, the function will fill the NAT_BIND_INFO structure with the newly +assigned bind ID. If the request is for setting some bind parameters and the +bind ID is valid, it will replace the NAT bind information with the new one. + +NOTE: +Currently, only new bind creation is supported. For request to set existing +bind parameters, the input bind parameters will be copied to the existing bind +entry, but will have no effect on NAT. +*****************************************************************************/ +NAT_STATUS natSetBind + ( + u_long nat_id, + u_long agent_id, + NAT_BIND_INFO* + ); + +/***************************************************************************** +Function: natSetSession + +Description: +This function is called by the external agent to create a new session or set +certain parameters of an existing session. The caller supplies the specifics +of the parameters either for a new session or for updating an existing session. +A new session request is made by setting the session ID in the NAT_SESSION_INFO +to 0, and non-zero for setting the parameters of an existing session. + +If the caller requests for a session creation, and NAT is successful in creating +a new session, NAT will fill the NAT_SESSION_INFO structure with the newly +assigned session ID. If the request is for setting some session parameters and +the session ID is valid, it will replace the NAT session information with the +new one. + +NOTE: +This function in supported in the current release. It is only partially +implemented and has no impact on NAT. +*****************************************************************************/ +NAT_STATUS natSetSession + ( + u_long nat_id, + u_long agent_id, + NAT_SESSION_INFO* + ); + +/***************************************************************************** +Function: natFreeBind + +Description: +This function is called by the external agent to terminate the specified bind +and any sessions that are based on this bind. +*****************************************************************************/ +NAT_STATUS natFreeBind + ( + u_long nat_id, + u_long agent_id, + u_long bind_id + ); + +/***************************************************************************** +Function: natFreeSession + +Description: +This function is called by the external agent to terminate the specified session. + +NOTE: +This function in supported in the current release. It is only partially +implemented and has no impact on NAT. +*****************************************************************************/ +NAT_STATUS natFreeSession + ( + u_long nat_id, + u_long agent_id, + u_long session_id + ); + +/***************************************************************************** +Function: natFreeBundle + +Description: +This function is called by the external agent to terminate a bundle of sessions +identified by the same bundle ID. + +NOTE: +This function in supported in the current release. It is only partially +implemented and has no impact on NAT. +*****************************************************************************/ +NAT_STATUS natFreeBundle + ( + u_long nat_id, + u_long agent_id, + u_long bundle_id + ); + +/***************************************************************************** +Function: natGetAddrBind + +Description: +This function is called by the external agent to obtain address bind +information. The caller may specify both or just the local_addr or the +global_addr and set the other to zero. NAT will fill up the NAT_BIND_INFO +data structure with the address bind information unless it cannot find a match +for the addresses specified. +*****************************************************************************/ +NAT_STATUS natGetAddrBind + ( + u_long nat_id, + u_long local_addr, + u_long global_addr, + NAT_BIND_INFO* + ); + +/***************************************************************************** +Function: natGetTransportBind + +Description: +This function is called by the external agent to obtain the transport ID bind +information. The caller may specify both or just one of either local or global +(address and transport). The check flag is added give caller the option to +look for a match of remote address and port, or just the remote address only. +Once, the matching bind is found, NAT will fill up the NAT_BIND_INFO data +structure with the transport bind information unless it cannot find a match +for the addresses specified. +*****************************************************************************/ +NAT_STATUS natGetTransportBind + ( + u_long nat_id, + NAT_BIND_SESSION* session, + NAT_BIND_INFO* bind, + NAT_BIND_CHECK check + ); + +/***************************************************************************** +Function: natBindShow + +Description: +This function is provided for a human user to display all the bind descriptors +that are currently alive in the list. It is intended for informational +purpose only and not for the use by an external agent. +*****************************************************************************/ +void natBindShow (void); + +#ifdef __cplusplus +} +#endif + +#endif /* Dont' add anything after this line */ diff --git a/h/wrn/nat/natExtCalls.h b/h/wrn/nat/natExtCalls.h new file mode 100644 index 0000000..77a1bf4 --- /dev/null +++ b/h/wrn/nat/natExtCalls.h @@ -0,0 +1,107 @@ +/* natExtCalls.h */ + +/* NAT Application Programming Interface */ + +/* Copyright 2001-2005 Wind River Systems, Inc. */ + +/* @format.tab-size 4, @format.use-tabs true, @format.new-line lf */ + +/* +modification history +-------------------- +01g,10mar05,svk Add SIP ALG init function, move DMZ Host and port triggering + functions to nat_api.h +01f,04mar05,svk Add port trigger timer to config params +01e,02mar05,myz added configuration parameter structures +01d,14feb05,zhu added port triggering support +01c,17jan05,zhu Updated for DMZ host +01b,15may03,zhu added nat PPTP and IPSEC ALGs +01a,25apr03,zhu updated copyright +101901 tk Created to declare external calls from prjConfig.c to suppress + warning messages when building the VxWorks AE image. +*/ + +#ifndef natExtCallsh +#define natExtCallsh + +/* IP static entry configuration */ + +typedef struct { + char * pIpLocAddr; /* local address */ + char * pIpGlbAddr; /* global address */ + } NATCFG_IP_STATIC_ENTRY; + +/* TCP/UDP static entry configuration */ + +typedef struct { + char * pIpLocAddr; /* local address */ + USHORT locPort; /* local port */ + USHORT glbPort; /* global port */ + } NATCFG_PORT_STATIC_ENTRY; + +/* NAT configuration parameters */ + +typedef struct { + int numOfIfs; /*derived. number of network interfaces(locals + global)*/ + char * pGlbIf; /* global network interface name string */ + char * pLocIfs; /* a list of local interface name string */ + BOOL natEnabled; /* NAT global enable/disable flag */ + BOOL staticEntryEnabled; /* NAT static entry enable/disable flag */ + BOOL singleGlbAddrEnabled; /* NAPT or basic mode */ + ULONG glbIpAddr; /* NAT global IP address */ + ULONG glbIpMask; /* NAT global IP address mask */ + BOOL dynmicGlbAddr; /* TRUE/FALSE, dynamic global IP address */ + BOOL fltNonCorpAddr; /* TRUE/FALSE, filter non corp. addresses*/ + BOOL fltUnknownProtos; /* TRUE/FALSE, filter unknown protocols */ + + ULONG tcpDiscnntTimer; /* TCP disconnected timer */ + ULONG tcpCnntTimer; /* TCP connecting timer */ + ULONG tcpCnntedTimer; /* TCP connected timer */ + ULONG tcpClsTimer; /* TCP closing timer */ + ULONG ipTranEntryTimer; /* IP translation entry timer */ + ULONG udpTranEntryTimer; /* UDP translation entry timer */ + ULONG icmpTranEntryTimer; /* ICMP translation entry timer */ + ULONG seqEntryTimer; /* TCP sequence delta timer */ + ULONG portTriggerTimer; /* Port trigger entry timer */ + + /* NAT printf debug flags. TRUE: flag enabled, FALSE: flag disabled */ + + BOOL prtEnabled; /* use printf() to send debug messages */ + BOOL prtDebug; /* add source code file names/line to output*/ + BOOL prtInitEnabled; /* printing of initialization event info. */ + BOOL prtTraceEnabled; /* printing of trace info. */ + BOOL prtDataEnabled; /* printing of data packet */ + BOOL prtErrEnabled; /* printing of error info. */ + + /* + * NAT log debug flags. identical to NAT printf debug message + * except the debug messages are send through logMsg() instead of printf(). + */ + + BOOL logEnabled; /* use logMsg() to send debug messages */ + BOOL logInitEnabled; + BOOL logTraceEnabled; + BOOL logDataEnabled; + BOOL logErrEnabled; + + ULONG glbAddrPoolSize; /* global address pool size */ + ULONG glbAddrStart; /* global address start */ + ULONG icmpDftAddr; /* icmp default IP address */ + + NATCFG_IP_STATIC_ENTRY * pIpEntries; /* IP static entries */ + int numOfIpEntries; + NATCFG_PORT_STATIC_ENTRY * pTcpEntries; /* TCP static entries */ + int numOfTcpEntries; + NATCFG_PORT_STATIC_ENTRY * pUdpEntries; /* UDP static entries */ + int numOfUdpEntries; + + } NAT_CONFIG_PARAMS; + +extern STATUS natAgentInit (NAT_CONFIG_PARAMS *); /* NAT init function */ +extern STATUS natFtpInit(u_short ftpPort); /* FTP ALG agent init function */ +extern STATUS natH323Init(u_short h323Port); /* H.323 ALG agent init function */ +extern STATUS natPPTPPTInit(void); /* PPTP Pass-thru ALG agent init function */ +extern STATUS natIPSecPTInit(u_short); /* IPSec Pass-thru ALG agent init function */ +extern STATUS natSipInit(void); /* SIP ALG agent init function */ + +#endif /* Dont' add anything after this line */ diff --git a/h/wrn/nat/natMgmt.h b/h/wrn/nat/natMgmt.h new file mode 100644 index 0000000..deae639 --- /dev/null +++ b/h/wrn/nat/natMgmt.h @@ -0,0 +1,287 @@ +/* natMgmt.h - The definitions for remote management of NAT */ + +/* Copyright 2000-2005 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01j,12jun05,zhu fixed compiler warning +01i,08apr05,zhu fixed SPR#103072 +01h,28sep04,zhu added m2NatTreeAdd declaration +01g,14sep04,myz change DISPLAY_STR_SIZE to NAT_DISPLAY_STR_SIZE to avoid + conflict with the same definition in in6_var.h. +01f,25apr03,svk Implement version number +01f,25apr03,zhu updated copyright +01e,28aug01,zhu making bug fixes +01d,21apr01,zhu fixing basic NAT bugs +01c,12feb01,zhu add three LEN defines for NAT +01b,13nov00,ann adding another #define NAT_BIND_EXISTS +01a,14aug00,ann written +*/ + +/* + * This file contains all the definitions and declerations for + * the stub routines associated with the NAT MIB. + */ + +#ifndef __INCnatmgmth +#define __INCnatmgmth + +#ifdef __cplusplus +extern "C" { +#endif + +#include "semLib.h" +#include "avlLib.h" + +/* Defines for the scalar group */ + +#define NAT_NUM 1 +#define NAT_SW_VER 2 +#define NAT_SESSION_NUM 3 + +#define NAT_TBL_INDEX_LEN 1 +#define NAT_BINDTBL_INDEX_LEN 10 +#define NAT_SESSTBL_INDEX_LEN 10 + +#define NAT_DISPLAY_STR_SIZE 255 /* Max Length for display string */ + +/* + * Defines for the NAT Table group - Note that all the writeable objects + * have maskable values + */ + +#define NAT_SESS_MAX_IDLETIME 1 +#define NAT_UDP_SESS_MAX_IDLETIME 2 +#define NAT_INDEX 3 +#define NAT_ICMP_SESS_MAX_IDLETIME 4 +#define NAT_PR_REALM_TYPE 5 +#define NAT_EXT_REALM_TYPE 6 +#define NAT_TYPE_MASK 7 +#define NAT_TCPUP_SESS_MAX_IDLETIME 8 +#define NAT_TYPE 9 +#define NAT_TOTAL_BINDS 10 +#define NAT_MAX_STATIC_BINDS 11 +#define NAT_CURR_STATIC_BINDS 12 +#define NAT_MAX_STATIC_TCP_BINDS 13 +#define NAT_CURR_STATIC_TCP_BINDS 14 +#define NAT_MAX_STATIC_UDP_BINDS 15 +#define NAT_TCPDISC_SESS_MAX_IDLETIME 16 +#define NAT_CURR_STATIC_UDP_BINDS 17 +#define NAT_TCPCLOS_SESS_MAX_IDLETIME 32 +#define NAT_TCPSYNC_SESS_MAX_IDLETIME 64 +#define NAT_LOG_MASK 128 +#define NAT_ENABLE 256 +#define NAT_STATIC_BIND_ENABLE 512 +#define NAT_DEF_X_ENABLE 1028 +#define NAT_GLOBAL_ADDR_FILTER 2048 + +/* Defines for the bind table */ + +#define NAT_BIND_LOCADDR 1 +#define NAT_BIND_LOCPORT 2 +#define NAT_BIND_STATIC 3 +#define NAT_BIND_REMADDR 4 +#define NAT_BIND_KIND 5 +#define NAT_BIND_LEASE_LEFT 6 +#define NAT_BIND_MAX_IDLETIME 7 +#define NAT_BIND_REMPORT 8 +#define NAT_BIND_CURR_IDLETIME 9 +#define NAT_BIND_DIR 10 +#define NAT_BIND_LOC_IFNUM 11 +#define NAT_BIND_EXT_IFNUM 12 +#define NAT_BIND_LOC_IFNAME 13 +#define NAT_BIND_EXT_IFNAME 14 +#define NAT_BIND_CONTR_AGENT 15 +#define NAT_BIND_PROTO 16 +#define NAT_BIND_ACTION 32 + +/* Defines for the session table */ + +#define NAT_SESS_PROTO 3 +#define NAT_SESS_LOCADDR 5 +#define NAT_SESS_LOCPORT 6 +#define NAT_SESS_REMADDR 7 +#define NAT_SESS_REMPORT 9 +#define NAT_XSESS_LOCADDR 10 +#define NAT_XSESS_LOCPORT 11 +#define NAT_XSESS_REMADDR 12 +#define NAT_XSESS_REMPORT 13 +#define NAT_SESS_END 14 +#define NAT_SESS_IDLETIME_LEFT 15 +#define NAT_SESS_PKT_MOD 17 +#define NAT_SESS_DIR 18 +#define NAT_SESS_CONTR_AGENT 19 + +/* Modes of NAT */ + +#define NAT_BASIC 1 +#define NAT_NAPT 2 +#define NAT_BI_DIR 4 +#define NAT_TWICE 8 +#define NAT_RSA_IP 16 +#define NAT_RSAP_IP 32 + +/* Defines for NAT debug objects */ + +#define NAT_PRINT_ENABLED 1 +#define NAT_INIT_PRINT_ENABLED 2 +#define NAT_DATA_PRINT_ENABLED 4 +#define NAT_TRACE_PRINT_ENABLED 8 +#define NAT_ERROR_PRINT_ENABLED 16 + +/* Other defines */ + +#define NUM_NAT_DEVICES 1 /* Number of NAT devices */ +#define PR_REALM_TYPE "IPv4" +#define EXT_REALM_TYPE "IPv4" +#define NAT_TYPES_SUPPORTED NAT_BASIC | NAT_NAPT +#define GET_VALUE 1 +#define NEXT_VALUE 2 +#define TCP_TRANS_LIST 1 +#define UDP_TRANS_LIST 2 +#define ICMP_TRANS_LIST 3 +#define IP_TRANS_LIST 4 +#define STATIC_ENTRY 1 +#define DYNAMIC_ENTRY 2 +#define ADDRESS_BINDING 1 +#define TRANSPORT_BINDING 2 +#define NAT_UNIDIRECTIONAL 1 +#define NAT_BIDIRECTIONAL 2 +#define NAT_NOMODIFIER 1 +#define NAT_IPMODIFIER 2 + +#define NAT_BIND_ACTIVE 1 +#define NAT_BIND_CREATE 4 +#define NAT_BIND_DELETE 6 + +/* Defines for nat session end */ + +#define NAT_OTHER 1 +#define NAT_NO_HEURISTIC 2 +#define NAT_END_IDLETIME 3 +#define NAT_EXT_AGENT 4 + + +/* Structures */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* Tell gnu960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct nat_scalars + { + UINT16 natNumber; + unsigned char natSwVersion[NAT_DISPLAY_STR_SIZE]; + UINT16 natSessionNumber; + unsigned char natPrRealmType[NAT_DISPLAY_STR_SIZE]; + unsigned char natExtRealmType[NAT_DISPLAY_STR_SIZE]; + } NAT_SCALARS; + +typedef struct nat_tbl_entry + { + UINT16 natIndex; + UINT16 natTypeMask; + UINT16 natType; + INT16 natTotalBinds; + INT16 natMaxStaticBinds; + INT16 natCurrStaticBinds; + INT16 natCurrDynamicBinds; + INT16 natMaxStaticIpBinds; + INT16 natCurrStaticIpBinds; + INT16 natCurrDynamicIpBinds; + INT16 natMaxStaticTcpBinds; + INT16 natCurrStaticTcpBinds; + INT16 natCurrDynamicTcpBinds; + INT16 natMaxStaticUdpBinds; + INT16 natCurrStaticUdpBinds; + INT16 natCurrDynamicUdpBinds; + UINT32 natSessionMaxIdleTime; + UINT32 natUdpSessionMaxIdleTime; + UINT32 natIcmpSessionMaxIdleTime; + UINT32 natTcpUpSessionMaxIdleTime; + UINT32 natTcpDiscSessionMaxIdleTime; + UINT32 natTcpClosingSessionMaxIdleTime; + UINT32 natTcpSyncSessionMaxIdleTime; + UINT16 natLogMask; + BOOL natEnable; + BOOL natDefXEnable; + BOOL natGlobalAddrFilter; + BOOL natStaticBindEnable; + } NAT_TBL_ENTRY; + +typedef struct nat_bindtbl_entry { + BOOL natBindStatic; + UINT16 natBindType; + unsigned long natBindLocalAddress; + UINT16 natBindLocalPort; + unsigned long natBindRemAddress; + UINT16 natBindRemPort; + unsigned long natBindMaxLeaseTime; + unsigned long natBindLeaseLeft; + unsigned long natBindMaxIdle; + unsigned long natBindCurrIdle; + UINT16 natBindDirection; + int natBindLocalIfNumber; + int natBindExtIfNumber; + unsigned char natBindLocalIfName[NAT_DISPLAY_STR_SIZE]; + unsigned char natBindExtIfName[NAT_DISPLAY_STR_SIZE]; + UINT16 natBindProto; + UINT16 natBindAction; + UINT16 natBindContrAgent; +} NAT_BINDTBL_ENTRY; + +typedef struct nat_sesstbl_entry { + UINT16 natSessionProto; + unsigned long natSessionLocalAddress; + UINT16 natSessionLocalPort; + unsigned long natSessionRemAddress; + UINT16 natSessionRemPort; + unsigned long natXSessionLocalAddress; + UINT16 natXSessionLocalPort; + unsigned long natXSessionRemAddress; + UINT16 natXSessionRemPort; + UINT16 natSessionEnd; + unsigned long natSessionIdleTimeLeft; + UINT16 natSessionContrAgent; + UINT16 natSessionDirection; + UINT16 natSessionPacketModifier; +} NAT_SESSTBL_ENTRY; + +typedef struct nat_data { + NAT_SCALARS natScalars; + SEM_ID natMgmtSem; +} NAT_DATA; + +typedef struct nat_bind_node { + NAT_BINDTBL_ENTRY * pNatBindTbl; +} NAT_BIND_NODE; + + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* Turn off the alignment restriction */ +#endif /* CPU_FAMILY==I960 */ + +/* Forward Declarations */ + +STATUS natMgmtInit (void); +STATUS m2NatScalarsGet (NAT_SCALARS *); +STATUS m2NatScalarsSet (NAT_SCALARS *, int); +STATUS m2NatTblEntryGet (NAT_TBL_ENTRY *, int); +STATUS m2NatTblEntrySet (NAT_TBL_ENTRY *, int); +STATUS m2NatBindTblEntryGet (NAT_BINDTBL_ENTRY *, int); +STATUS m2NatBindTblEntrySet (NAT_BINDTBL_ENTRY *, int); +STATUS m2NatSessTblEntryGet (NAT_SESSTBL_ENTRY *, int); +void natRealmModify (NAT_SCALARS *, char *, char *); +void dumbInit (void); +STATUS m2NatTreeAdd (void); +STATUS natTcpStaticFind(u_long,u_short,u_short); +STATUS natUdpStaticFind(u_long,u_short,u_short); +int natTypeFind (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnatmgmth */ diff --git a/h/wrn/nat/natSnmpLeaf.h b/h/wrn/nat/natSnmpLeaf.h new file mode 100644 index 0000000..b83fab6 --- /dev/null +++ b/h/wrn/nat/natSnmpLeaf.h @@ -0,0 +1,182 @@ +/* natSnmpLeaf.h - SNMP leaf definitions for NAT */ + +/* Copyright 2002-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,25apr03,zhu updated copyright +01a,27sep02,vvv generated using mibcomp +*/ + +/****************************************************************************** + ****************************************************************************** + **** This file was automatically generated by Wind River's + **** WindManage MIB Compiler, version 9.3. + **** This file was generated using the -leaf switch. + **** + **** This file #defines C preprocessor macros providing a variety of + **** information for the leaf objects in the MIB. + **** + **** The file includes a LEAF_xxx macro for each leaf object in the + **** MIB (xxx is replaced by the object's name). The value of the + **** LEAF_xxx macro is the final component of the object's object + **** identifier. + **** + **** If the object's SYNTAX clause included named INTEGER values, + **** then there is a VAL_xxx_yyy macro for each named value (xxx is + **** replaced by the object's name and yyy by the value's name). The + **** value of the VAL_xxx_yyy macro is the value associated with the + **** named value. + **** + **** If the object's SYNTAX clause specified a set of range limitations + **** for the value of the object, then there are one or more sets of + **** MIN_xxx and MAX_xxx macros specifying the lower and upper bound of + **** each range limitation. + **** + **** If the object's SYNTAX clause specified a set of size constraints + **** for the value of the object, then there are one or more sets of + **** MINSIZE_xxx and MAXSIZE_xxx macros specifying the lower and upper + **** bound of each size constraint. (If the size constraint is a single + **** value rather than a range then the MINSIZE_xxx and MAXSIZE_xxx + **** macros are replaced by a single SIZE_xxx macro.) + **** + **** DO NOT MODIFY THIS FILE BY HAND. + **** + **** Last build date: Fri Sep 27 15:02:13 2002 + **** from files: + **** natMib.mib, natconv.mib + **** starting from node: natMib + ****************************************************************************** + ****************************************************************************** + */ + +#define LEAF_natNumber 1 +#define LEAF_natSessionNumber 2 +#define LEAF_natSwVersion 3 +#define MINSIZE_natSwVersion 0L +#define MAXSIZE_natSwVersion 255L +#define LEAF_natPrRealmType 4 +#define MINSIZE_natPrRealmType 0L +#define MAXSIZE_natPrRealmType 255L +#define LEAF_natExtRealmType 5 +#define MINSIZE_natExtRealmType 0L +#define MAXSIZE_natExtRealmType 255L +#define LEAF_natIndex 1 +#define LEAF_natTypeMask 2 +#define MIN_natTypeMask 0L +#define MAX_natTypeMask 2147483647L +#define LEAF_natType 3 +#define MIN_natType 0L +#define MAX_natType 2147483647L +#define LEAF_natTotalBinds 4 +#define LEAF_natMaxStaticBinds 5 +#define LEAF_natCurrStaticBinds 6 +#define LEAF_natCurrDynamicBinds 7 +#define LEAF_natMaxStaticIpBinds 8 +#define LEAF_natCurrStaticIpBinds 9 +#define LEAF_natCurrDynamicIpBinds 10 +#define LEAF_natMaxStaticTcpBinds 11 +#define LEAF_natCurrStaticTcpBinds 12 +#define LEAF_natCurrDynamicTcpBinds 13 +#define LEAF_natMaxStaticUdpBinds 14 +#define LEAF_natCurrStaticUdpBinds 15 +#define LEAF_natCurrDynamicUdpBinds 16 +#define LEAF_natSessionMaxIdleTime 17 +#define LEAF_natUdpSessionMaxIdleTime 18 +#define LEAF_natIcmpSessionMaxIdleTime 19 +#define LEAF_natTcpUpSessionMaxIdleTime 20 +#define LEAF_natTcpDiscSessionMaxIdleTime 21 +#define LEAF_natTcpClosingSessionMaxIdleTime 22 +#define LEAF_natTcpSyncSessionMaxIdleTime 23 +#define LEAF_natLogMask 24 +#define MIN_natLogMask 0L +#define MAX_natLogMask 2147483647L +#define LEAF_natEnable 25 +#define VAL_natEnable_true 1L +#define VAL_natEnable_false 2L +#define LEAF_natDefXEnable 26 +#define VAL_natDefXEnable_true 1L +#define VAL_natDefXEnable_false 2L +#define LEAF_natGlobalAddrFilter 27 +#define VAL_natGlobalAddrFilter_true 1L +#define VAL_natGlobalAddrFilter_false 2L +#define LEAF_natStaticBindEnable 28 +#define VAL_natStaticBindEnable_true 1L +#define VAL_natStaticBindEnable_false 2L +#define LEAF_natBindStatic 1 +#define VAL_natBindStatic_true 1L +#define VAL_natBindStatic_false 2L +#define LEAF_natBindType 2 +#define VAL_natBindType_address 1L +#define VAL_natBindType_transport 2L +#define LEAF_natBindLocalAddress 3 +#define LEAF_natBindLocalPort 4 +#define MIN_natBindLocalPort 0L +#define MAX_natBindLocalPort 65535L +#define LEAF_natBindRemAddress 5 +#define LEAF_natBindRemPort 6 +#define MIN_natBindRemPort 0L +#define MAX_natBindRemPort 65535L +#define LEAF_natBindMaxLeaseTime 7 +#define LEAF_natBindLeaseLeft 8 +#define LEAF_natBindMaxIdle 9 +#define LEAF_natBindCurrIdle 10 +#define LEAF_natBindDirection 11 +#define VAL_natBindDirection_unidirectional 1L +#define VAL_natBindDirection_bidirectional 2L +#define LEAF_natBindLocalIfNumber 12 +#define LEAF_natBindExtIfNumber 13 +#define LEAF_natBindLocalIfName 14 +#define MINSIZE_natBindLocalIfName 0L +#define MAXSIZE_natBindLocalIfName 255L +#define LEAF_natBindExtIfName 15 +#define MINSIZE_natBindExtIfName 0L +#define MAXSIZE_natBindExtIfName 255L +#define LEAF_natBindProto 16 +#define VAL_natBindProto_tcp 1L +#define VAL_natBindProto_udp 2L +#define VAL_natBindProto_icmp 3L +#define VAL_natBindProto_ip 4L +#define LEAF_natBindAction 17 +#define VAL_natBindAction_active 1L +#define VAL_natBindAction_notInService 2L +#define VAL_natBindAction_notReady 3L +#define VAL_natBindAction_createAndGo 4L +#define VAL_natBindAction_createAndWait 5L +#define VAL_natBindAction_destroy 6L +#define LEAF_natBindContrAgent 18 +#define LEAF_natSessionProto 1 +#define VAL_natSessionProto_tcp 1L +#define VAL_natSessionProto_udp 2L +#define VAL_natSessionProto_icmp 3L +#define VAL_natSessionProto_ip 4L +#define LEAF_natSessionLocalAddress 2 +#define LEAF_natSessionLocalPort 3 +#define MIN_natSessionLocalPort 0L +#define MAX_natSessionLocalPort 65535L +#define LEAF_natSessionRemAddress 4 +#define LEAF_natSessionRemPort 5 +#define MIN_natSessionRemPort 0L +#define MAX_natSessionRemPort 65535L +#define LEAF_natXSessionLocalAddress 6 +#define LEAF_natXSessionLocalPort 7 +#define MIN_natXSessionLocalPort 0L +#define MAX_natXSessionLocalPort 65535L +#define LEAF_natXSessionRemAddress 8 +#define LEAF_natXSessionRemPort 9 +#define MIN_natXSessionRemPort 0L +#define MAX_natXSessionRemPort 65535L +#define LEAF_natSessionEnd 10 +#define VAL_natSessionEnd_other 1L +#define VAL_natSessionEnd_noheuristic 2L +#define VAL_natSessionEnd_idletime 3L +#define VAL_natSessionEnd_extagent 4L +#define LEAF_natSessionIdleTimeLeft 11 +#define LEAF_natSessionPacketModifier 13 +#define VAL_natSessionPacketModifier_noModifier 1L +#define VAL_natSessionPacketModifier_ipModifier 2L +#define LEAF_natSessionDirection 14 +#define VAL_natSessionDirection_outbound 1L +#define VAL_natSessionDirection_inbound 2L +#define LEAF_natSessionContrAgent 15 diff --git a/h/wrn/nat/nat_api.h b/h/wrn/nat/nat_api.h new file mode 100644 index 0000000..1257dc1 --- /dev/null +++ b/h/wrn/nat/nat_api.h @@ -0,0 +1,215 @@ +/* nat_api.h */ + +/* NAT Application Programming Interface */ + +/* Copyright 2000-2005 Wind River Systems, Inc. */ + +/* @format.tab-size 4, @format.use-tabs true, @format.new-line lf */ + +/* +modification history +-------------------- +01c,10mar05,svk Add port trigger and DMZ host declarations +01b,16feb05,svk Remove old branding +01a,25apr03,zhu updated copyright +070201 tk Replace natXlatAdd and natXlatDelete with natIpXlatAdd and natIpXlatDelete. + Add comments. +051701 tk Add new functions declaration: natTcpStaticAdd, natUdpStaticAdd, + natTcpStaticDelete, natUdpStaticDelete, natPassThruListAdd, + natPassThruListDelete, natPassThruListShow. +*/ + +#ifndef nat_api_h +#define nat_api_h + +#include "vxWorks.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +The following API are intended to allow a human client to perform certain +functions that can affect the operations of the NAT core or just to display +certain information that can be useful to the client. These functions can +be invoked from the Tornado shell (i.e. WindShell) although they can also +be called by a software client. +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ + +/* Display all NAT operating characteristics */ +STATUS natShow(void); + +/* Enable/Disable NAT operations */ +STATUS natEnable(BOOL enable); + +/* Enable/Disable a specific NAT port (interface) */ +STATUS natPortEnable(int port, BOOL enable); + +/* Enable/Disable static TCP/UDP server translations */ +STATUS natStaticXlatEnable(BOOL enable); + +/* Display ICMP Translation List (NAPT mode only) */ +STATUS natIcmpXlatShow(void); + +/* Display all translation lists */ +STATUS natXlatShow(void); + +/* Display TCP translation list */ +STATUS natTcpXlatShow(void); + +/* Display UDP translation list (NAPT mode only) */ +STATUS natUdpXlatShow(void); + +/* Functions to add and delete TCP and UDP static port-based entries (NAPT mode only). + These functions allow user to expose designated private servers to global clients. +*/ +STATUS natTcpStaticAdd( + char *localAddr, + u_short localPort, + u_short globalPort + ); + +STATUS natUdpStaticAdd( + char *localAddr, + u_short localPort, + u_short globalPort + ); + +STATUS natTcpStaticDelete( + char *localAddr, + u_short localPort, + u_short globalPort + ); + +STATUS natUdpStaticDelete( + char *localAddr, + u_short localPort, + u_short globalPort + ); + +/* Retrieve the global IP address for the specified local address */ +STATUS natGetGlobalAddr(char *localAddr); + +/* Set DMZ Host */ +STATUS natDMZHostSet (char * hostAddr); + +/* Port Trigger entry action type */ +typedef enum + { + NAT_PORT_TRIGGER_ADD = 1, + NAT_PORT_TRIGGER_ENABLE, + NAT_PORT_TRIGGER_DISABLE, + NAT_PORT_TRIGGER_DELETE, + NAT_PORT_TRIGGER_ENABLE_ALL, + NAT_PORT_TRIGGER_DELETE_ALL, + NAT_PORT_TRIGGER_DISABLE_ALL, + NAT_PORT_TRIGGER_ACTION_END + } NAT_PORT_TRIGGER_ACTION_TYPE; + +/* Port Trigger modes */ +#define PORT_TRIGGER_STRICT 1 /* strict mode */ +#define PORT_TRIGGER_NONSTRICT 2 /* non-strict mode */ + +/* Perform Port Trigger entry action */ +STATUS natPortTriggerEntryAction ( + NAT_PORT_TRIGGER_ACTION_TYPE action, + USHORT mode, + USHORT triggerProtocol, + USHORT triggerPortStart, + USHORT triggerPortEnd, + USHORT incomingProtocol, + USHORT incomingPortStart, + USHORT incomingPortEnd + ); + +#ifdef NAT_PASS_THRU_ENABLE +/* Add/delete address/mask pair to pass-through list. The address/mask pair + refers to the destination host. Once added to the pass-through list, + all packets sent to this destination host/subnet will not get translated. + Customers should use this feature with discretion as doing so may expose + the identities of their private hosts to the global network. +*/ +STATUS natPassThruListAdd( + char * address, + char * mask + ); + +STATUS natPassThruListDelete( + char * address, + char * mask + ); + +STATUS natPassThruListShow(); +#endif + + +/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +The following API are intended for use by software clients only. Although +they are invocable from the shell, they won't serve much purpose to human +clients since they won't know in advance what the global port number will be +in the dynamic address translation. Currently, these API functions are called +by the ALG API functions to create address binds in the NAT core. They can +be called by any software client that interact with the NAT core to create or +delete an address bind, although it is recommended that the ALG API functions +natBindSet() and natBindFree() be used instead. +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ + +/* Function to add a TCP/UDP/IP control block (or entry) in the TCP translation + list maintained by the NAT core. Note that all entries in the list are dynamic + in that they get created when needed and deleted when their time stamps + expired. The boolean flag static_entry simply serves for informational + purpose that the entry is created as a result of the presence of the static + entry which may have been configured at initialization (i.e. by means of the + configuration file) or by means of API functions specified above in this + file. +*/ +/* TCP Translation Entry Add Routine (NAPT mode only) */ +u_long natTcpXlatAdd( + u_long localAddr, + u_short localPort, + u_long globalAddr, + u_short globalPort, + BOOL static_entry + ); + +/* TCP Translation Entry Delete Routine (NAPT mode only) */ +STATUS natTcpXlatDelete( + u_long localAddr, + u_short localPort, + u_long globalAddr, + u_short globalPort + ); + +/* UDP Translation Entry Add Routine (NAPT mode only) */ +u_long natUdpXlatAdd( + u_long localAddr, + u_short localPort, + u_long globalAddr, + u_short globalPort, + BOOL static_entry + ); + +/* UDP Translation Entry Delete Routine (NAPT mode only) */ +STATUS natUdpXlatDelete( + u_long localAddr, + u_short localPort, + u_long globalAddr, + u_short globalPort + ); + +/* IP Translation Entry Add Routine (Basic NAT mode only) */ +u_long natIpXlatAdd( + u_long localAddr, + BOOL static_entry + ); + +/* IP Translation Entry Delete Routine (Basic NAT mode only) */ +STATUS natIpXlatDelete( + u_long localAddr + ); + +#ifdef __cplusplus +} +#endif + +#endif /* Dont' add anything after this line */ diff --git a/h/wrn/netVersion.h b/h/wrn/netVersion.h new file mode 100644 index 0000000..ba263ea --- /dev/null +++ b/h/wrn/netVersion.h @@ -0,0 +1,12 @@ +/* netVersion.h - Network stack version information */ + +/* Copyright 2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,11aug03,asr initial creation +*/ + +#include + diff --git a/h/wrn/ospf/ospf.h b/h/wrn/ospf/ospf.h new file mode 100644 index 0000000..87c956f --- /dev/null +++ b/h/wrn/ospf/ospf.h @@ -0,0 +1,101 @@ +/* ospf.h - main OSPF header file */ + +/* Copyright 2001-2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +03i,16feb05,xli include m2Lib.h +03h,29nov04,tlu OSPF stack decoupling +03g,22apr04,ram AVL & Memory migration to shared library +03f,19apr04,zhr compile with the IP dual stack CD +03e,07apr04,ram OSPF v2/v3 coexistance compile +03d,12mar04,zhr changed #include mdLib.h to ospf_mdLib.h +03c,01dec03,agi added #include - merged from 20dev branch +03b,29sep03,agi removed #include "ospf_container.h" +03a,05aug03,agi ported to Accordion stack +02e,02jun03,agi removed #include "rwproto.h" +02d,02jun03,agi changed #include "rwos.h" to include "ospf_rwos.h" +02c,29may03,agi removed unused includes, added new includes +02c,08may03,asr Changes to make OSPF virtual stack compatible +02b,09may03,agi added #include , removed #include +02a,17feb02,ram SPR 81808 Added OSPF memory partition support +*/ + +#if !defined (_OSPF_H_) +#define _OSPF_H_ + +#if !defined (__VxWORKS__) +#define __VxWORKS__ +#endif /* __VxWORKS__ */ + +#if !defined (__RTM__) +#define __RTM__ +#endif /* __RTM__ */ + +#if !defined (__BIG_ENUMS__) +#define __BIG_ENUMS__ +#endif /* __BIG_ENUMS__ */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* Added for Task Spawn for the "tOspfRecv" task*/ +/* #include */ +#include +#include +#include +#include +#include +#include + +#if defined (__OSPF_FTP__) +#include +#include +#include +#endif /*__OSPF_FTP__*/ + +#include "ospf_constants.h" +#include +/* #include */ +#include "ospf_ip_structures.h" +#include "ospf_structures.h" +#include "ospf_globals.h" +#include "ospf_prototypes.h" +#include "ospf_invar.h" +#include "ospf_vnvram.h" +#include "ospf_memory.h" + +#if defined (__OSPF_MIB__) +#include "ospfCommonMibApi.h" +#include "ospf_mib_helper_update.h" +#endif /*__OSPF_MIB__*/ + +#if defined (VIRTUAL_STACK) + #include + #include + #include +#endif /* VIRTUAL_STACK */ + +#endif /* _OSPF_H_ */ diff --git a/h/wrn/ospf/ospfLib.h b/h/wrn/ospf/ospfLib.h new file mode 100644 index 0000000..6126722 --- /dev/null +++ b/h/wrn/ospf/ospfLib.h @@ -0,0 +1,22 @@ +/* ospfLib.h */ + +/* Copyright 2000 -2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,27jun05,xli Fix Workbench compilation warning +01c,29nov04,tlu OSPF stack decoupling +01b,18jun04,mwv update file for compatibility for new Tornado facility +01a,05dec02,mwv Fix tornado linker warning. SPR 82521. Modified the OSPF_CALLBACK_IF struct +*/ +#include +#include +#include +#include +#include + +int ospfInitialize (int vsNum); + + + diff --git a/h/wrn/ospf/ospf_configuration.h b/h/wrn/ospf/ospf_configuration.h new file mode 100644 index 0000000..ef6d057 --- /dev/null +++ b/h/wrn/ospf/ospf_configuration.h @@ -0,0 +1,896 @@ +/* ospf_configuration.h */ + +/* Copyright 2000-2004 Wind River Systems, Inc. */ + +/* +modification history +------------------- +02d,30apr04,mwv SPR#91272, added support for area_summary configuration in the area + configuration. +02c,29jan04,ram NBMA, PTMP, & Unnumbered modifications +02b,22jan04,ram Merge fixes +02a,29may03,agi Modified RWOS calls to OSPF calls as part of RWOS removal +01x,20feb03,kc Fixed SPR#86319 - rename inject_default_route_if_stub_area + to inject_summary_lsa_into_stub_area. Rename staic keyword + "OSPF Area Inject Default Route Into Stub Area" to + "OSPF Area Inject Summary LSA Into Stub Area". +01w,10apr02,bt added "OSPF Port NBMA or PTMP Neighbor Address =" +01v,24jul01,jkw Removed WINROUTER preproc +01u,23jul01,jkw Added new configuration variables for ignoring tos and demand circuit +01t,26sep00,res Added WindRiver CopyRight +01s,25sep00,res RFC-1587 implementation for OSPF NSSA Option, also tested against ANVL. +01r,20jul00,res Unix compatibility related changes. +01q,06jul00,res Removed unnecessary header files and defines. +01p,04apr00,res Added some MIB support (Read only). + Passed all important ANVL OSPF tests. +01o,23feb00,res Changes for ospf mib +01n,23dec99,res Compatibility with VxWorks-IP and VxWorks RTM-interface +01m,03jun99,jac Added missing config parameter inject_default_route_if_stub_area in + stub area case. +01l,17may99,jac Added new include file ospf_patricia_32_bits_key_prototypes.h +01k,28dec98,jac Compiled and added some comments +01j,13nov98,jac Changes related to introducing queuing in OSPF to RTM interface and bug + fix on the external route additions path (to RTM) +01i,11nov98,jac Config changes, linted and big endian changes +01h,30oct98,jac Incorporate changes for compilation on Vxworks +01g,23aug98,jac ANVL tested OSPF with PATRICIA tree route table and no recursion +01f,10aug98,jac PATRICIA Route Table Based OSPF Code Base +01e,04jun98,jac Integration with RTM and BGP +01d,10jul97,cin Pre-release v1.52b +01c,10feb97,cin Release Version 1.52 +01b,22oct97,cin Release Version 1.50 +01a,05jun96,cin First Beta Release +*/ + +#if !defined (_OSPF_CONFIGURATION_H_) +#define _OSPF_CONFIGURATION_H_ +#if defined (__OSPF_VIRTUAL_STACK__) +#include "ospf_vs_lib.h" +#endif /* __OSPF_VIRTUAL_STACK__ */ + +/********************************************************************************************************************************/ +#if !defined (__OSPF_VIRTUAL_STACK__) +OSPF_CONFIGURATION_TABLE ospf_configuration_table = +{ + 1, + { +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF =", + (ULONG) offsetof (OSPF_CLASS,protocol_enabled), + (ULONG ) &ospf, + (ULONG) NULL + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_default_values, + NULL, + "OSPF Use Default Values =" + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_ip_address, + NULL, + "OSPF Router ID =", + (ULONG) offsetof (OSPF_CLASS,router_id), + (ULONG) &ospf, + (ULONG) NULL + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF Type of Service Capability =", + (ULONG) offsetof (OSPF_CLASS,type_of_service_capability), + (ULONG ) &ospf, + (ULONG) NULL + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF Autonomous System Border Router =", + (ULONG) offsetof (OSPF_CLASS,autonomous_system_border_router), + (ULONG ) &ospf, + (ULONG) NULL + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF IP Multicast =", + (ULONG) offsetof (OSPF_CLASS,ip_multicast), + (ULONG ) &ospf, + (ULONG) NULL + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_ulong_decimal_value, + NULL, + "OSPF Number of Areas =", + (ULONG) offsetof (OSPF_CLASS, number_of_areas), + (ULONG) &ospf, + (ULONG) NULL + }, + + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_ip_address, + NULL, + "OSPF Area ID =", + (ULONG) offsetof (OSPF_CLASS, area[0].config.area_id), + (ULONG) &ospf, + sizeof (OSPF_AREA_CLASS) + }, + +/* RFC 2178 G.3 */ +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_ulong_decimal_value, + NULL, + "OSPF Total Number of Area Address Ranges =", + (ULONG) offsetof (OSPF_CLASS, number_of_area_address_ranges), + (ULONG) &ospf, + (ULONG) NULL + }, + +/* RFC 2178 G.3 Multiple Area Address ranges*/ +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_ip_address, + NULL, + "OSPF Area Address Range Address =", + (ULONG) offsetof (OSPF_CLASS, area_address_range[0].config.network), + (ULONG) &ospf, + sizeof (OSPF_AREA_ADDRESS_RANGE_CLASS) + }, +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_ip_address, + NULL, + "OSPF Area Address Range Mask =", + (ULONG) offsetof (OSPF_CLASS, area_address_range[0].config.mask), + (ULONG) &ospf, + sizeof (OSPF_AREA_ADDRESS_RANGE_CLASS) + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_enable, + NULL, + "OSPF Area Address Range Advertise =", + (ULONG) offsetof (OSPF_CLASS, area_address_range[0].config.advertise), + (ULONG) &ospf, + sizeof (OSPF_AREA_ADDRESS_RANGE_CLASS) + }, + + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_ip_address, + NULL, + "OSPF Area Address Range Area ID =", + (ULONG) offsetof (OSPF_CLASS, area_address_range[0].config.area_id), + (ULONG) &ospf, + sizeof (OSPF_AREA_ADDRESS_RANGE_CLASS) + }, + + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_enable, + NULL, + "OSPF Area External Routing Capability =", + (ULONG) offsetof (OSPF_CLASS, area[0].config.external_routing_capability_enabled), + (ULONG) &ospf, + sizeof (OSPF_AREA_CLASS) + }, +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_enable, + NULL, + "OSPF Area NSSA option =", + (ULONG) offsetof (OSPF_CLASS, area[0].config.nssa_enabled), + (ULONG) &ospf, + sizeof (OSPF_AREA_CLASS) + }, +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_enable, + NULL, + "OSPF Area Inject Default Route Into Stub Area =", + (ULONG) offsetof (OSPF_CLASS, area[0].config.inject_default_route_if_stub_area), + (ULONG) &ospf, + sizeof (OSPF_AREA_CLASS) + }, + +/* _____________________________________________________________________________________________ */ + /* SPR#91272 -begin */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_enable, + NULL, + "OSPF Area Area Summary =", + (ULONG) offsetof (OSPF_CLASS, area[0].config.area_summary), + (ULONG) &ospf, + sizeof (OSPF_AREA_CLASS) + }, + /* SPR#91272 -end */ + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_ulong_decimal_value, + NULL, + "OSPF Area Stub Default Cost =", + (ULONG) offsetof (OSPF_CLASS, area[0].config.stub_default_cost), + (ULONG) &ospf, + sizeof (OSPF_AREA_CLASS) + }, + + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_ulong_decimal_value, + NULL, + "OSPF Number of Ports =", + (ULONG) offsetof (OSPF_CLASS, number_of_ports), + (ULONG) &ospf, + (ULONG) NULL + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_port, + NULL, + "OSPF Port =", + (ULONG) offsetof (OSPF_CLASS, port[0].config.port_enabled), + (ULONG) &ospf, + sizeof (OSPF_PORT_CLASS) + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_ip_address, + NULL, + "OSPF Port Address =", + (ULONG) offsetof (OSPF_CLASS, port[0].config.ip_address), + (ULONG) &ospf, + sizeof (OSPF_PORT_CLASS) + }, + +/* __________________________________________________________ unnumbered dest ip */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_ip_address, + NULL, + "OSPF Port Unnumbered Dest IP =", + (ULONG) offsetof (OSPF_CLASS, port[0].config.unnumbered_dest_ip), + (ULONG) &ospf, + sizeof (OSPF_PORT_CLASS) + }, + +/* __________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_ip_address, + NULL, + "OSPF Port NBMA or PTMP Neighbor Address =", + (ULONG) offsetof (OSPF_CLASS, port[0].config.nbma_ptmp_neighbor_address), /* __NBMA_PTMP__ */ + (ULONG) &ospf, + sizeof (OSPF_PORT_CLASS) + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_ip_address, + NULL, + "OSPF Port Address Mask =", + (ULONG) offsetof (OSPF_CLASS, port[0].config.subnetmask), + (ULONG) &ospf, + sizeof (OSPF_PORT_CLASS) + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_ip_address, + NULL, + "OSPF Port Area ID =", + (ULONG) offsetof (OSPF_CLASS, port[0].config.area_id), + (ULONG) &ospf, + sizeof (OSPF_PORT_CLASS) + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_ushort_decimal_value, + NULL, + "OSPF Port Authentication Type =", + (ULONG) offsetof (OSPF_CLASS, port[0].config.authentication_type), + (ULONG) &ospf, + sizeof (OSPF_PORT_CLASS) + }, + +/* _____________________________________________________________________________________________ */ + + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_parse_port_plain_text_or_md5_password, + NULL, + "OSPF Port Plain Text Password =", + }, +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_parse_port_plain_text_or_md5_password, + NULL, + "OSPF Port MD5 Authentication Secret Key =", + }, +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_parse_port_plain_text_or_md5_password, + NULL, + "OSPF Port Authentication Secret =", + }, +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_ulong_decimal_value, + NULL, + "OSPF Port Type =", + (ULONG) offsetof (OSPF_CLASS, port[0].config.type), + (ULONG) &ospf, + sizeof (OSPF_PORT_CLASS) + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_ip_address, + NULL, + "OSPF Port Transit Area ID =", + (ULONG) offsetof (OSPF_CLASS, port[0].config.transit_area_id), + (ULONG) &ospf, + sizeof (OSPF_PORT_CLASS) + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_ip_address, + NULL, + "OSPF Port Source Area ID =", + (ULONG) offsetof (OSPF_CLASS, port[0].config.source_area_id_for_virtual_link), + (ULONG) &ospf, + sizeof (OSPF_PORT_CLASS) + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_ulong_decimal_value, + NULL, + "OSPF Port Router Dead Interval =", + (ULONG) offsetof (OSPF_CLASS, port[0].config.router_dead_interval), + (ULONG) &ospf, + sizeof (OSPF_PORT_CLASS) + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_ulong_decimal_value, + NULL, + "OSPF Port Transmit Delay =", + (ULONG) offsetof (OSPF_CLASS, port[0].config.transmit_delay), + (ULONG) &ospf, + sizeof (OSPF_PORT_CLASS) + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_ushort_decimal_value, + NULL, + "OSPF Port Priority =", + (ULONG) offsetof (OSPF_CLASS, port[0].config.priority), + (ULONG) &ospf, + sizeof (OSPF_PORT_CLASS) + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_ushort_decimal_value, + NULL, + "OSPF Port Cost =", + (ULONG) offsetof (OSPF_CLASS, port[0].config.cost), + (ULONG) &ospf, + sizeof (OSPF_PORT_CLASS) + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_ulong_decimal_value, + NULL, + "OSPF Port Hello Interval =", + (ULONG) offsetof (OSPF_CLASS, port[0].config.hello_interval), + (ULONG) &ospf, + sizeof (OSPF_PORT_CLASS) + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_ip_address, + NULL, + "OSPF Port Virtual Neighbor Router ID =", /* Will be deprecated eventually */ + (ULONG) offsetof (OSPF_CLASS, port[0].config.virtual_neighbor_rid), + (ULONG) &ospf, + sizeof (OSPF_PORT_CLASS) + }, +/* _____________________________________________________________________________________________ */ +{ + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_ip_address, + NULL, + "OSPF Port Neighbor Router ID =", + (ULONG) offsetof (OSPF_CLASS, port[0].config.virtual_neighbor_rid), + (ULONG) &ospf, + sizeof (OSPF_PORT_CLASS) + }, + +/* _____________________________________________________________________________________________ */ +{ + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_ulong_decimal_value, + NULL, + "OSPF Port Poll Interval =", + (ULONG) offsetof (OSPF_CLASS, port[0].config.poll_interval), + (ULONG) &ospf, + sizeof (OSPF_PORT_CLASS) + }, + +/* _____________________________________________________________________________________________ */ +{ + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_ulong_decimal_value, + NULL, + "OSPF Port Retransmit Interval =", + (ULONG) offsetof (OSPF_CLASS, port[0].config.retransmit_interval), + (ULONG) &ospf, + sizeof (OSPF_PORT_CLASS) + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF Initialization Breakpoint =", + (ULONG) offsetof (OSPF_CLASS, initialization_breakpoint), + (ULONG) &ospf, + (ULONG) NULL + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF Configuration Breakpoint =", + (ULONG) offsetof (OSPF_CLASS, configuration_breakpoint), + (ULONG) &ospf, + (ULONG) NULL + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF Run Time Breakpoint =", + (ULONG) offsetof (OSPF_CLASS, runtime_breakpoint), + (ULONG) &ospf, + (ULONG) NULL + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF Printf =", + (ULONG) offsetof (OSPF_CLASS, printing_enabled), + (ULONG) &ospf, + (ULONG) NULL + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF Printf INTERFACE =", + (ULONG) offsetof (OSPF_CLASS, interface_printing_enabled), + (ULONG) &ospf, + (ULONG) NULL + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF Printf NEIGHBOR =", + (ULONG) offsetof (OSPF_CLASS, neighbor_printing_enabled), + (ULONG) &ospf, + (ULONG) NULL + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF Printf Memory =", + (ULONG) offsetof (OSPF_CLASS, memory_printing_enabled), + (ULONG) &ospf, + (ULONG) NULL + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF Printf Alarm =", + (ULONG) offsetof (OSPF_CLASS, alarm_printing_enabled), + (ULONG) &ospf, + (ULONG) NULL + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF Printf SNMP =", + (ULONG) offsetof (OSPF_CLASS, snmp_printing_enabled), + (ULONG) &ospf, + (ULONG) NULL + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF Printf Packets =", + (ULONG) offsetof (OSPF_CLASS, packet_printing_enabled), + (ULONG) &ospf, + (ULONG) NULL + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF Printf Routing Table =", + (ULONG) offsetof (OSPF_CLASS, routing_table_printing_enabled), + (ULONG) &ospf, + (ULONG) NULL + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF Printf Debug =", + (ULONG) offsetof (OSPF_CLASS, debug_printing_enabled), + (ULONG) &ospf, + (ULONG) NULL + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF Printf Rtm =", + (ULONG) offsetof (OSPF_CLASS, rtm_printing_enabled), + (ULONG) &ospf, + (ULONG) NULL + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF Redistribute BGP =", + (ULONG) offsetof (OSPF_CLASS, ospf_redistribution_configuration.redistribute_all_bgp), + (ULONG ) &ospf, + sizeof (OSPF_REDISTRIBUTION_CONFIGURATION) + }, +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF Redistribute RIP =", + (ULONG) offsetof (OSPF_CLASS, ospf_redistribution_configuration.redistribute_all_rip), + (ULONG ) &ospf, + sizeof (OSPF_REDISTRIBUTION_CONFIGURATION) + }, +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF Redistribute Static =", + (ULONG) offsetof (OSPF_CLASS, ospf_redistribution_configuration.redistribute_all_static), + (ULONG ) &ospf, + sizeof (OSPF_REDISTRIBUTION_CONFIGURATION) + }, +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF Redistribute Default =", + (ULONG) offsetof (OSPF_CLASS, ospf_redistribution_configuration.redistribute_ip_default_route), + (ULONG ) &ospf, + sizeof (OSPF_REDISTRIBUTION_CONFIGURATION) + }, +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF Allow BGP Default =", + (ULONG) offsetof (OSPF_CLASS, ospf_redistribution_configuration.allow_bgp_default), + (ULONG ) &ospf, + sizeof (OSPF_REDISTRIBUTION_CONFIGURATION) + }, +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_bgp_subnets_to_redistribute, + NULL, + "OSPF Redistribute BGP Subnets =", + }, +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_static_subnets_to_redistribute, + NULL, + "OSPF Redistribute Static Subnets =", + }, +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_rip_subnets_to_redistribute, + NULL, + "OSPF Redistribute RIP Subnets =", + }, +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_ip_route_policy, + NULL, + "OSPF IP Route Policy =", + }, +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_neighbor_as_not_allowed, + NULL, + "OSPF Do Not Allow AS Neighbor =", + }, +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_origin_as_not_allowed, + NULL, + "OSPF Do Not Allow AS Origin =", + }, +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_ulong_decimal_value, + NULL, + "OSPF Route Queue Process Interval =", + (ULONG) offsetof (OSPF_CLASS, ospf_export_route_queue_process_interval), + (ULONG) &ospf, + (ULONG) NULL + }, +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_ulong_decimal_value, + NULL, + "OSPF Number of Routes Dequeued Per Run =", + (ULONG) offsetof (OSPF_CLASS, ospf_routes_dequeued_per_run), + (ULONG) &ospf, + (ULONG) NULL + }, + +/*opaque lsa configuration jkw*/ +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF Opaque Capability =", + (ULONG) offsetof (OSPF_CLASS,opaque_capability), + (ULONG ) &ospf, + (ULONG) NULL + }, + +/* RFC 2178 G.7 */ +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF RFC1583 Compatibility =", + (ULONG) offsetof (OSPF_CLASS,ospf_rfc1583_compatibility), + (ULONG ) &ospf, + (ULONG) NULL + }, + + +/* RFC 2178 G.6 */ +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_ulong_decimal_value, + NULL, + "OSPF Point to Point Router Lsa Option =", + (ULONG) offsetof (OSPF_CLASS, ospf_point_to_point_router_lsa_option), + (ULONG) &ospf, + (ULONG)NULL + }, + +/* _____________________________________________________________________________________________ */ +/* RFC 1765 */ +#if defined (__OSPF_DB_OVERFLOW_SUPPORT__) + + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_ulong_decimal_value, + NULL, + "OSPF External LSDB Limit =", + (ULONG) offsetof (OSPF_CLASS, ospf_external_lsdb_limit), + (ULONG) &ospf, + (ULONG) NULL + }, +/*____________________________________________________________________________________________________*/ + + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_ulong_decimal_value, + NULL, + "OSPF Exit Overflow Interval =", + (ULONG) offsetof (OSPF_CLASS, ospf_exit_overflow_interval), + (ULONG) &ospf, + (ULONG) NULL + }, + +#endif /* (__OSPF_DB_OVERFLOW_SUPPORT__)*/ + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_port_passive, + NULL, + "OSPF Port Passive-Interface =" + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_variable_port_and_enable, + NULL, + "OSPF Port Passive =", + (ULONG) offsetof (OSPF_CLASS, port[0].config.passive), + (ULONG) &ospf, + sizeof (OSPF_PORT_CLASS) + }, + +/*_____________________________________________________________________________________________________*/ +{ + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF Printf DB Overflow =", + (ULONG) offsetof (OSPF_CLASS, db_overflow_printing_enabled), + (ULONG) &ospf, + (ULONG) NULL + }, + +/*_____________________________________________________________________________________________________*/ +{ + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF Printf Search =", + (ULONG) offsetof (OSPF_CLASS, search_printing_enabled), + (ULONG) &ospf, + (ULONG) NULL + }, + +/*_____________________________________________________________________________________________________*/ +{ + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_enum_enable, + NULL, + "OSPF Printf Prologue =", + (ULONG) offsetof (OSPF_CLASS, prologue_printing_enabled), + (ULONG) &ospf, + (ULONG) NULL + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospf_set_ulong_decimal_value, + NULL, + "OSPF Number of Maximum age LSAs Deleted Per Second =", + (ULONG) offsetof (OSPF_CLASS, ospf_maxaged_lsas_removed_per_tick), + (ULONG) &ospf, + (ULONG) NULL + }, +/*_____________________________________________________________________________________________ */ + + + + { + NULL, + NULL, + "", + (ULONG) NULL, + (ULONG) NULL, + (ULONG) NULL + } + + } +}; +#endif /* __OSPF_VIRTUAL_STACK__ */ +#endif /* _OSPF_CONFIGURATION_H_ */ diff --git a/h/wrn/ospf/ospf_constants.h b/h/wrn/ospf/ospf_constants.h new file mode 100644 index 0000000..11392f9 --- /dev/null +++ b/h/wrn/ospf/ospf_constants.h @@ -0,0 +1,358 @@ +/* ospf_constants.h - ospf constants*/ + +/* Copyright 2000-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +04n,19oct05,xli doc build warnings clean up +04m,13may05,xli cleanup compiler warnings +02u,04may05,xli update OSPF_REV from 3.0 to 3.1 +02t,19apr05,xli cleanup gnu compiler warnings +02s,02sep04,ram Increase OSPF thread stack size +02r,29jul04,dsk update OSPF_REV from 2.4 to 3.0 +02q,10jun04,mwv update OSPF_REV +02p,12apr04,ram Cleanup unused macros +02o,12mar04,ram SPR#94944 OSPF performance modifications +02n,22aug03,agi Ported to Accordion +02m,03jul03,ram Backed out SPR#88600 workaround +02l,11jun03,ram SPR#88965 Separate route table and LSDB hash parameters and + increase LSDB hash parameters. +02k,28may03,agi Addedd code inspection changes +02g,26may03,agi Added OSPF_MAXIMUM_FILE_SIZE, OSPF_RAMDRIVE_VOLUME_NAME + OSPF_CONFIGURATION_FILE_NAME +02i,26may03,htm Stampede issue# 24 - Adding OSPF_MAX_PKT_SIZE to be used in + ospf_vx_ip_output() instead of the magic number 1000. +02h,26may03,dsk SPR 88600 fix for stuck in EXCHANGE_START (timer added + to restart if stuck in exchange start state too long) +02g,09may03,agi added ospf task related constants +02f,10apr03,mwv SPR 85906 update define for OSPF_MAXIMUM_IP_HEADER_SIZE +02e,21mar03,kc Fixed SPR#87023 - changed OSPF_INPUT_TASK_STACK_SIZE + from 6K to 8K. Removed unused OSPF_MAPI_TASK_STACK_SIZE + define. +02d,17feb03,mwv SPR 85906 define max ip header size +02c,14jan03,smr SPR 78250 Need to correct hash table size to accomodate 255. +02b,06jan03,ram SPR 85432 Changes to allow more OSPF external route processing +02a,09dec02,ram SPR 83418 Added support for OSPF external type 1 & 2 +01a,05jun96,cin First Beta Release +*/ + +#if !defined (_OSPF_CONSTANTS_H_) +#define _OSPF_CONSTANTS_H_ + +#define OSPF_PROTOCOL_ID_VALUE 89 +#define OSPF_VERSION 2 + +#define OSPF_REV "3.1" +#define OSPF_REV_TYPE "1" +#define OSPF_BUILD __DATE__ + +#if !defined (NUMBER_OF_IP_PORTS) + #define NUMBER_OF_IP_PORTS 16 +#endif /* NUMBER_OF_IP_PORTS */ + +#define MAXIMUM_IP_OPTION_LENGTH 40 /* Largest option field, bytes */ +#define NO_SUCH_PORT 0xffff + +#if !defined (PRINT_BUFFER_SIZE) + #define PRINT_BUFFER_SIZE 150 +#endif /* PRINT_BUFFER_SIZE */ + +/* SPR 85906 -- BEGIN */ +#define OSPF_MAXIMUM_IP_HEADER_SIZE ((ULONG) 60) /* largest size for IP header */ + +#define RFC1745_EGP_ORIGEGP_ROUTE_TAG 0x9000 /* BGP routes reached via OSPF, ext adv originated by some other ASBR */ /* 4.3.2 RFC 1745 */ +#define RFC1745_IGP_TO_OSPF_ROUTE_TAG 0xc000 /* IGP dynamic routes etc. */ /* IGP, local_AS */ /* 4.3.4 RFC 1745 */ +#define RFC1745_EGP_ORIGIGP_ROUTE_TAG_PER_AS 0xd000 /* BGP routes with orig IGP, next_hop AS */ /* IGP, Local_AS, Next_hop_as */ /* 4.3.5 RFC 1745 DO not use for now */ +#define RFC1745_BGP_TO_OSPF_ROUTE_TAG 0xe000 /* BGP origin */ +#define OSPF_INTERNAL 0xffff + +#define NUMBER_OF_OSPF_PORTS NUMBER_OF_IP_PORTS +#define NUMBER_OF_OSPF_AREAS NUMBER_OF_IP_PORTS +#define NUMBER_OF_OSPF_AREA_ADDRESS_RANGES 16 + +#define OSPF_NUMBER_OF_INTERFACE_STATES 7 +#define OSPF_NUMBER_OF_INTERFACE_EVENTS 7 + +#define OSPF_NUMBER_OF_NEIGHBOR_STATES 8 +#define OSPF_NUMBER_OF_NEIGHBOR_EVENTS 13 + +#define OSPF_BACKBONE 0x00000000L + +#define OSPF_NBMA_DEFAULT_HELLO 30 +#define OSPF_BROADCAST_DEFAULT_HELLO 10 +#define OSPF_POINT_TO_POINT_DEFAULT_HELLO 30 +#define OSPF_VIRTUAL_DEFAULT_HELLO 60 + +/* SPR#88965 */ +/* OSPF LSDB hash paramters */ +#define OSPF_HASH_TABLE_SIZE 512L +#define OSPF_HASH_MASK 0xFF800000 +#define OSPF_GET_HASH_INDEX(x) (((x) & OSPF_HASH_MASK) >> 23) + +/* SPR#88965 */ +/* OSPF routing table hash parameters + * These values cannot be changed*/ +#define OSPF_RT_HASH_TABLE_SIZE 256L +#define OSPF_RT_HASH_MASK 0xFF000000 +#define OSPF_GET_RT_HASH_INDEX(x) (((x) & OSPF_RT_HASH_MASK) >> 24) + + +#define OSPF_LSRefreshTime (1800) +#define OSPF_MinLSArrival ((ULONG) 0x00000001) +#define OSPF_MinLSInterval ((ULONG) 0x00000005) +#define OSPF_LSInfinity 0xFFFFFF + +#define OSPF_EXTERNAL_LSA_QUEUE_PROCESS_INTERVAL 10 /* Routerware Inc. Specific */ + +#define OSPF_CheckAge (300) + +#define OSPF_MAXIMUM_AGE_DIFFERENCE ((USHORT) 900) +#define OSPF_MAXIMUM_AGE ((USHORT) 3600) + +#define OSPF_ALL_UP_NEIGHBORS 0x00000001 +#define OSPF_ALL_ELIGIBLE_NEIGHBORS 0x00000002 +#define OSPF_ALL_EXCHANGE_NEIGHBORS 0x00000003 +#define OSPF_DESIGNATED_ROUTER_AND_BACKUP_DESIGNATED_ROUTER 0x00000004 + + +#define OSPF_ADDR_ALLSPF 0xe0000005 /* 224.0.0.5 */ +#define OSPF_ADDR_ALLDR 0xe0000006 /* 224.0.0.6 */ + +#define OSPF_IP_TTL_FOR_OSPF_PACKET 0x01 /* RFC 1583 Appendix A.1 */ +#define OSPF_IP_TTL_FOR_UNI_CAST_VLINK_OSPF_PACKET 0x80 /* VLINK: Virtual Link*/ + +#define OSPF_DefaultDestination 0x00000000L +#define OSPF_DefaultMask 0x00000000L + +#define OSPF_DEFAULT_TRANSMIT_DELAY 1 +#define OSPF_DEFAULT_COST 1 +#define OSPF_DEFAULT_ROUTER_DEAD_INTERVAL 40 +#define OSPF_DEFAULT_PRIORITY 1 +#define OSPF_DEFAULT_RETRANSMIT_INTERVAL 5 /* was 5 */ + +#define OSPF_DEFAULT_POLL_INTERVAL 120 + +#define OSPF_ACKNOWLEDGEMENT_INTERVAL 2 + +#define OSPF_ROUTING_TABLE_BUILD_INTERVAL 2 /* WAS 10 */ + +#define OSPF_MAXIMUM_PACKET_SIZE_FOR_VIRTUAL_LINK 512 /* does not include the IP header */ + +#define OSPF_PACKET_SIZE ((ULONG) 24) +#define OSPF_HELLO_HEADER_SIZE ((ULONG) 20) +#define OSPF_DATABASE_HEADER_SIZE ((ULONG) 8) +#define OSPF_LS_HEADER_SIZE ((ULONG) 20) +#define OSPF_LS_UPDATE_HEADER_SIZE ((ULONG) 4) + +#define OSPF_ROUTER_LINK_ADVERTISEMENT_HEADER_SIZE ((ULONG) 24) +#define OSPF_NETWORK_LINK_ADVERTISEMENT_HEADER_SIZE ((ULONG) 24) +#define OSPF_SUMMARY_LINK_ADVERTISEMENT_HEADER_SIZE ((ULONG) 28) +#define OSPF_EXTERNAL_LINK_ADVERTISEMENT_HEADER_SIZE ((ULONG) 36) + +/*opaque lsa header size jkw*/ +#define OSPF_TYPE_9_LINK_ADVERTISEMENT_HEADER_SIZE ((ULONG) 20) +#define OSPF_TYPE_10_LINK_ADVERTISEMENT_HEADER_SIZE ((ULONG) 20) +#define OSPF_TYPE_11_LINK_ADVERTISEMENT_HEADER_SIZE ((ULONG) 20) + +#define OSPF_DB_PIECE_SIZE ((ULONG) 20) +#define OSPF_LS_REQUESTED_ADVERTISEMENT_SIZE ((ULONG) 12) + +#define OSPF_ROUTER_LINK_PIECE_SIZE ((ULONG) 12) +#define OSPF_NETWORK_LINK_PIECE_SIZE ((ULONG) 4) + +#define OSPF_EXTERNAL_LINK_METRIC_PIECE_SIZE ((ULONG) 12) +#define OSPF_ROUTER_LINK_METRIC_PIECE_SIZE ((ULONG) 4) + +#define OSPF_HOST_NET_MASK 0xFFFFFFFF + +#define OSPF_ASE_bit_E 0x80000000 + +#define OSPF_AUTHENTICATION_NONE 0 /* No authentication */ +#define OSPF_AUTHENTICATION_SIMPLE 1 /* Simple password */ +#define OSPF_AUTHENTICATION_MD5 2 /* MD5 crypto checksum */ + +#define OSPF_AUTHENTICATION_SIMPLE_SIZE 8 +#define OSPF_AUTHENTICATION_MD5_SIZE 16 +#define OSPF_AUTHENTICATION_SIZE 16 + +#define OSPF_MD5_A_INIT 0x67452301 +#define OSPF_MD5_B_INIT 0xefcdab89 +#define OSPF_MD5_C_INIT 0x98badcfe +#define OSPF_MD5_D_INIT 0x10325476 + +#define OSPF_IF_MULTICAST_ALLSPF 0x100000 /* Joined All SPF group */ +#define OSPF_IF_MULTICAST_ALLDR 0x200000 /* Joined All DR group */ + +#define OSPF_NUMBER_OF_INLINE_COMPUTATIONS 8 +#define OSPF_MASK_FOR_UNEVEN_BITS (OSPF_NUMBER_OF_INLINE_COMPUTATIONS - 1) +#define OSPF_INLINED_SHIFT 3 +#define OSPF_FINAL_CHECKSUM_SHIFT 8 +#define OSPF_NUMBER_OF_ITERATIONS_BEFORE_MOD 4096 +#define OSPF_LOG2_OF_NUMBER_OF_ITERATIONS 12 +#define OSPF_MOD_MASK (OSPF_NUMBER_OF_ITERATIONS_BEFORE_MOD - 1) +#define OSPF_NUMBER_OF_INLINE_ITERATIONS (OSPF_NUMBER_OF_ITERATIONS_BEFORE_MOD/OSPF_NUMBER_OF_INLINE_COMPUTATIONS) +#define OSPF_MODULUS 255 + +#define OSPF_ENABLE_EXTERNAL_ROUTING 0x02 +#define OSPF_NOT_ENABLE_EXTERNAL_ROUTING 0x00 + +#define OSPF_STARTING_AREA_ID_FOR_VIRTUAL_INTERFACE 0xff000000 + +#define OSPF_CONVERT_IP_ADDRESS_TO_DOT_FORMAT_FOR_DEBUG ospf_convert_ip_address_to_dot_format + +#if defined __OSPF_DEBUG__ + #define OSPF_PRINTF_PACKET ospf_printf + #define OSPF_PRINTF_INTERFACE ospf_printf + #define OSPF_PRINTF_NEIGHBOR ospf_printf + #define OSPF_PRINTF_MEMORY ospf_printf + #define OSPF_PRINTF_DEBUG ospf_printf + #define OSPF_PRINTF_ROUTING_TABLE ospf_printf + #define OSPF_PRINTF_SNMP ospf_printf + #define OSPF_PRINTF_RTM ospf_printf + #define OSPF_PRINTF_DB_OVERFLOW ospf_printf + #define OSPF_PRINTF_PROLOGUE ospf_printf +#else + #define OSPF_PRINTF_PACKET(...) + #define OSPF_PRINTF_INTERFACE(...) + #define OSPF_PRINTF_NEIGHBOR(...) + #define OSPF_PRINTF_MEMORY(...) + #define OSPF_PRINTF_DEBUG(...) + #define OSPF_PRINTF_ROUTING_TABLE(...) + #define OSPF_PRINTF_SNMP(...) + #define OSPF_PRINTF_RTM(...) + #define OSPF_PRINTF_DB_OVERFLOW(...) + #define OSPF_PRINTF_PROLOGUE(...) +#endif /*__OSPF_DEBUG__*/ + +#define OSPF_PRINTF_ALARM ospf_printf + +#define OSPF_CONVERT_IP_ADDRESS_TO_DOT_FORMAT_FOR_ALARM ospf_convert_ip_address_to_dot_format +#define OSPF_CONVERT_IP_ADDRESS_TO_DOT_FORMAT_FOR_ROUTING_TABLE ospf_convert_ip_address_to_dot_format + +#define ROUTE_MATCH_WITH_ADDRESS_RANGE 1 +#define ROUTE_SUBSUMED_BY_ADDRESS_RANGE 2 +#define RANGE_STATUS_DO_NOT_ADVERTISE 3 + + +#if !defined (__BIT_FIELDS_CAN_BE_ENUMS__) + #if defined (_MSC_VER) + #define BIT_FIELD(enum_,enum_name) unsigned char + #else + #define BIT_FIELD(enum_,enum_name) UINT + #endif +#endif + +#if defined BIT_FIELD +#undef BIT_FIELD + #define BIT_FIELD(enum_,enum_name) unsigned char +#endif + +#define MAXIMUM_IP_OPTION_LENGTH 40 /* Largest option field, bytes */ +#define PRINT_BUFFER_SIZE 150 + +#define NUMBER_OF_IP_PORTS 16 /* Legacy Constant from old IP*/ +#define MAXIMUM_ETHERNET_DATA_SIZE 1500 /* Legacy Constant from old v8022str.h */ + +#define OSPF_RTM_HANDLE ULONG + +#if (_BYTE_ORDER == _LITTLE_ENDIAN ) /*#$-NOTE:note36-$#*/ + #define ospf_min min +#endif + +/*raw socket maximum receive ospf packet jkw*/ +#define MAX_BUFSIZE 8192 +/*raw socket end of change*/ + +#define MAXSIZE_OSPF_AUTH_KEY 256L +/* opaque lsa maximum opaque type lsas jkw */ +#define MAX_OPAQUE_NUM 3 +/* opaque lsa redefined for array index jkw */ +#define TYPE_9_LSA 1 +#define TYPE_10_LSA 2 +#define TYPE_11_LSA 3 +#define OSPF_OPAQUE_ALIGNMENT 4 +#define TYPE_7_LSA 7 +#define LS_EXTERNAL_LSA 1 +#define LS_TYPE_11_LSA 1 + + +/*RFC 1765*/ +#define OSPF_DEFAULT_EXTERNAL_LSDB_LIMIT -1; +#define OSPF_DEFAULT_EXIT_OVERFLOW_TIMER 0; + +/* Traffic Engineering Extension Constants */ +#define OSPF_TE_ROUTER_ADDRESS_TLV_TYPE 1 +#define OSPF_TE_LINK_TLV_TYPE 2 +#define OSPF_TE_SUB_LINK_TYPE 1 +#define OSPF_TE_SUB_LINK_ID 2 +#define OSPF_TE_SUB_LOCAL_ADDRESS 3 +#define OSPF_TE_SUB_REMOTE_ADDRESS 4 +#define OSPF_TE_SUB_METRIC 5 +#define OSPF_TE_SUB_MAXIMUM_BANDWIDTH 6 +#define OSPF_TE_SUB_MAXIMUM_RESERVABLE_BANDWIDTH 7 +#define OSPF_TE_SUB_UNRESERVED_BANDWIDTH 8 +#define OSPF_TE_SUB_RESOURCE_CLASS_COLOR 9 +#define OSPF_TE_LINK_TYPE_PADDING 3 + +#define OSPF_1K_BLOCKS 1024 + +#define OSPF_INPUT_TASK_STACK_SIZE (16 * OSPF_1K_BLOCKS) +#define OSPF_TIMER_TASK_STACK_SIZE (12 * OSPF_1K_BLOCKS) +#define OSPF_HELLO_TIMER_TASK_STACK_SIZE (8 * OSPF_1K_BLOCKS) +#define OSPF_RTM_TASK_STACK_SIZE (12 * OSPF_1K_BLOCKS) +#if defined __OSPF_MIB__ +#define OSPF_MAPI_TASK_STACK_SIZE (8 * OSPF_1K_BLOCKS) +#endif + +#define OSPF_TIMER_TASK_PRIORITY 100 +#define OSPF_HELLO_TIMER_TASK_PRIORITY 90 +#define OSPF_INPUT_TASK_PRIORITY 100 +#define OSPF_RTM_TASK_PRIORITY 90 +#if defined __OSPF_MIB__ +#define OSPF_MAPI_TASK_PRIORITY 150 +#endif + +#define OSPFV3_TASK_NAME_SIZE 11 /* 10 chars + null terminator */ + +/* SPR 83418 -- Begin */ +#define OSPF_EXTERNAL_METRIC_TYPE_1 1 +#define OSPF_EXTERNAL_METRIC_TYPE_2 2 +#define OSPF_EXTERNAL_DEFAULT_METRIC 20 +/* SPR 83418 -- End */ + +/* SPR 85432 -- Begin */ +#define OSPF_CLEANUP_INTERVAL (60 * 30) /* 30 minutes */ +#define MAX_EXTERNAL_ROUTES_PROCESSED 250 +/* SPR 85432 -- End */ + +/* Size of maximum ospf pkt to be sent by ospf_vx_ip_output(). + If you changed this const make sure the calling task has enough stack + size. */ +#define OSPF_MAX_PKT_SIZE MAXIMUM_ETHERNET_DATA_SIZE + +#ifdef INCLUDE_TMS_MODS +#define OSPF_MAXIMUM_FILE_SIZE 512 +#else +#define OSPF_MAXIMUM_FILE_SIZE 4000 +#endif /* INCLUDE_TMS_MODS */ + +#define OSPF_RAMDRIVE_VOLUME_NAME "DEV1:" +#define OSPF_CONFIGURATION_FILE_NAME "config" + +/* raw socket receive buffer size */ +#ifndef OSPF_RS_RCV_BUFFER +#define OSPF_RS_RCV_BUFFER (8 * 1024) +#endif + +/* routing socket receive buffer size */ +#ifndef OSPF_RAW_RCV_BUFFER +#define OSPF_RAW_RCV_BUFFER (64 * 1024) +#endif + +#define RTM_OSPF_ROUTE_WEIGHT 110 + +#define OSPF_TASK_NAME_SIZE 11 /* 10 chars + null terminator */ + +#endif /* _OSPF_CONSTANTS_H_ */ + diff --git a/h/wrn/ospf/ospf_enums.h b/h/wrn/ospf/ospf_enums.h new file mode 100644 index 0000000..95c0113 --- /dev/null +++ b/h/wrn/ospf/ospf_enums.h @@ -0,0 +1,370 @@ +/* ospf_enums.h - OSPF enums */ + +/* Copyright 2000-2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +03b,01dec03,agi removed declaration of MD4 and MD5 +03a,27sep03,agi ported to Accordion stack, added definitions from RTM, + updated copyright +02d,29may03,agi added OSPF_MD_ALGORITHM +02c,27may03,agi removed the SPF task, added code inspection changes +02b,09may03,agi added OSPF tasks related enums +02a,22apr03,ram SPR#76812 Modifications for OSPF performance enhancements +01a,05jun96,cin First Beta Release +*/ + +#if !defined (_OSPF_ENUMS_H_) +#define _OSPF_ENUMS_H_ + +enum OSPF_RETURN_FLAGS +{ + OSPF_NO_PROBLEM = 0x0, + OSPF_NO_BUFFERS = 0x1, + OSPF_BAD_REQUEST = 0x2 +}; + +enum OSPF_UNION_PACKET_TYPES +{ + OSPF_HELLO_PACKET = 0x01, + OSPF_DATABASE_DESCRIPTION_PACKET = 0x02, + OSPF_LINK_STATE_REQUEST_PACKET = 0x03, + OSPF_LINK_STATE_UPDATE_PACKET = 0x04, + OSPF_LINK_STATE_ACKNOWLEDGEMENT_PACKET = 0x05 +}; + +enum OSPF_PACKET_STATE +{ + GOOD_RECEIVE = 0x00, + OSPF_ERROR_ACKNOWLEDGEMENT_BAD = 0x01, + OSPF_ERROR_ACKNOWLEDGEMENT_DUPLICATE = 0x02, + OSPF_ERROR_ACKNOWLEDGEMENT_STATE = 0x03, + OSPF_ERROR_ACKNOWLEDGEMENT_TYPE = 0x04, + OSPF_ERROR_DATABASE_DESCRIPTION_E_BIT = 0x05, + OSPF_ERROR_DATABASE_DESCRIPTION_ROUTER_ID = 0x06, + OSPF_ERROR_DATABASE_DESCRIPTION_STATE = 0x07, + OSPF_ERROR_DATABASE_DESCRIPTION_TYPE = 0x08, + OSPF_ERROR_HELLO_E_BIT = 0x09, + OSPF_ERROR_HELLO_ID = 0x0a, + OSPF_ERROR_HELLO_MASK = 0x0b, + OSPF_ERROR_HELLO_ROUTER_DEAD_INTERVAL = 0x0c, + OSPF_ERROR_HELLO_TIMER = 0x0d, + OSPF_ERROR_HELLO_VIRTUAL = 0x0e, + OSPF_ERROR_OSPF_AUTHENTICATION_KEY = 0x0f, + OSPF_ERROR_OSPF_AUTHENTICATION_TYPE = 0x10, + OSPF_ERROR_OSPF_INTERFACE_DOWN = 0x11, + OSPF_ERROR_OSPF_PACKET_TYPE = 0x12, + OSPF_ERROR_REQUEST_BOGUS = 0x13, + OSPF_ERROR_REQUEST_EMPTY = 0x14, + OSPF_ERROR_UPDATE_STATE = 0x15, + STOP_PROCESSING_PACKET = 0x16, + /* nssa bit */ + OSPF_ERROR_HELLO_N_BIT = 0x17, + OSPF_ERROR_DATABASE_DESCRIPTION_N_BIT = 0x18, + /*opaque lsa error option jkw*/ + OSPF_ERROR_OPAQUE_OPTION = 0x19, + OSPF_ERROR_DATABASE_DESCRIPTION_MTU_MISMATCH = 0x1a + +}; + +enum OSPF_NEIGHBOR_EVENT +{ + OSPF_HELLO_RECEIVED = 0x0000, + OSPF_START = 0x01, + OSPF_TWO_WAY_RECEIVED = 0x02, + OSPF_NEGOTIATION_DONE = 0x03, + OSPF_EXCHANGE_DONE = 0x04, + OSPF_BAD_LINK_STATE_REQUEST = 0x05, + OSPF_LOADING_DONE = 0x06, + OSPF_ADJACENCY_OK = 0x07, + OSPF_SEQUENCE_NUMBER_MISMATCH = 0x08, + OSPF_ONE_WAY = 0x09, + OSPF_KILL_NEIGHBOR = 0x0a, + OSPF_INACTIVITY_TIMER = 0x0b, + OSPF_DOWN_INDICATION_FROM_LOWER_LEVEL_PROTOCOLS_RECEIVED = 0x0c +}; + +enum OSPF_NEIGHBOR_MODE +{ + OSPF_CLEAR_MODE = 0x00, + OSPF_SLAVE = 0x01, + OSPF_MASTER = 0x02, + OSPF_SLAVE_HOLD = 0x04 /* holding the last database summary delay */ +}; + +enum OSPF_NEIGHBOR_STATE +{ + OSPF_NEIGHBOR_DOWN = 0x00, + OSPF_NEIGHBOR_ATTEMPT = 0x01, + OSPF_NEIGHBOR_INITIALIZING = 0x02, + OSPF_NEIGHBOR_2_WAY = 0x03, + OSPF_NEIGHBOR_EXCHANGE_START = 0x04, + OSPF_NEIGHBOR_EXCHANGE = 0x05, + OSPF_NEIGHBOR_LOADING = 0x06, + OSPF_NEIGHBOR_FULL = 0x07 +}; + +enum OSPF_INTERFACE_EVENT +{ + OSPF_INTERFACE_UP = 0x00, + OSPF_WAIT_TIMER = 0x01, + OSPF_BACKUP_SEEN = 0x02, + OSPF_NEIGHBOR_CHANGE = 0x03, + OSPF_LOOP_INDICATION = 0x04, + OSPF_UNLOOP_INDICATION = 0x05, + OSPF_INTERFACE_DOWN = 0x06 +}; + +enum OSPF_INTERFACE_STATE +{ + OSPF_INTERFACE_IS_DOWN = 0x00, + OSPF_INTERFACE_LOOPBACK = 0x01, + OSPF_INTERFACE_WAITING = 0x02, + OSPF_INTERFACE_POINT_TO_POINT = 0x03, + OSPF_INTERFACE_DESIGNATED_ROUTER_OTHER = 0x04, + OSPF_INTERFACE_BACKUP_DESIGNATED_ROUTER = 0x05, + OSPF_INTERFACE_DESIGNATED_ROUTER = 0x06 +}; + +enum OSPF_INTERFACE_TYPE +{ + OSPF_POINT_TO_POINT = 0x01, + OSPF_BROADCAST = 0x02, + OSPF_NBMA = 0x03, + OSPF_POINT_TO_MULTIPOINT = 0x04, + OSPF_VIRTUAL_LINK = 0x05 +}; + +enum OSPF_SEQUENCE_STATE +{ + OSPF_NORMAL = 0x00, + OSPF_WAITING_FOR_MAXIMUM_SEQUENCE_INSTANCE_TO_BE_FLUSHED = 0x01, + OSPF_DONE_FLUSHING_MAXIMUM_SEQUENCE_INSTANCE = 0x02 +}; + +/* Link State Types */ + +enum OSPF_LS_TYPE +{ + OSPF_LS_ROUTER = 0x01, + OSPF_LS_NETWORK = 0x02, + OSPF_LS_SUMMARY_NETWORK = 0x03, + OSPF_LS_SUMMARY_AS_BOUNDARY_ROUTER = 0x04, + OSPF_LS_AS_EXTERNAL = 0x05, + /* Interpretation flags in LS_ROUTER for Routers convenience */ +#if defined (__NSSA__) + OSPF_LS_MULTICAST = 0x06, + OSPF_LS_TYPE_7 = 0x07, +#endif /* __NSSA__ */ + /*opaque lsa new lsa types jkw*/ +#if defined (__OPAQUE_LSA__) + OSPF_LS_TYPE_9 = 0x09, + OSPF_LS_TYPE_10 = 0x0a, + OSPF_LS_TYPE_11 = 0x0b, + OSPF_LS_MAX = 0x0c, +#else /* __OPAQUE_LSA__ */ + OSPF_LS_MAX = 0x08, +#endif /* __OPAQUE_LSA__ */ + OSPF_LS_ROUTER_ABR = 0x0d, + OSPF_LS_ROUTER_ASBR = 0x0e + + +}; + +enum OSPF_ROUTER_LINK_TYPE +{ + OSPF_ROUTER_LINK_TYPE_PPP = 0x1, + OSPF_ROUTER_LINK_TYPE_TRANSIT_NETWORK = 0x2, + OSPF_ROUTER_LINK_TYPE_STUB_NETWORK = 0x3, + OSPF_ROUTER_LINK_TYPE_VIRTUAL = 0x4 +}; + +enum OSPF_ACKNOWLEDGEMENT_RETURN_TYPE +{ + OSPF_NO_ACKNOWLEDGEMENTS_LEFT = 0x00, + OSPF_ACKNOWLEDGEMENTS_LEFT = 0x01 +}; + +enum OSPF_ROUTING_TABLE_UPDATE_ACTION +{ + OSPF_NO_ACTION = 0x00, + OSPF_CHANGE_PATH = 0x01, + OSPF_ADD_PATH = 0x02, + OSPF_DELETE_PATH = 0x03 /* RTM ### changes */ +}; + +enum OSPF_ROUTE_STATUS +{ + /* No new data under a routing table node or next_hop_block */ + OSPF_ROUTE_IS_NOT_NEW = 0x00, + /* + * New data under a routing table node or next_hop_block. + * can be a new next hop block under a routing table node or a new routing table node. + * or an old next hop block is not available any more. + */ + OSPF_ROUTE_IS_NEW = 0x01, + /* + * This routing table node or next block is no longer available + */ + OSPF_ROUTE_IS_NOT_AVAILABLE_NOW = 0x02, + /* + * doesn't matter + */ + OSPF_ROUTE_STATUS_DONT_CARE = 0x03 +}; + +enum OSPF_ROUTE_DESTINATION_TYPE +{ + OSPF_DESTINATION_TYPE_NETWORK = 0x00, + OSPF_DESTINATION_TYPE_ASBR = 0x01, /* autonomous system border router */ + OSPF_DESTINATION_TYPE_ABR = 0x02, /* area border router */ + OSPF_DESTINATION_TYPE_VIRTUAL = 0x03, + OSPF_DESTINATION_TYPE_ASE = 0x04, /* external to the autonomous system */ + OSPF_DESTINATION_TYPE_WILDCARD = 0xFF +}; + +enum OSPF_ROUTE_PATH_TYPE +{ + OSPF_ROUTE_PATH_TYPE_INTRA = 0x00, + OSPF_ROUTE_PATH_TYPE_INTER = 0x01, + OSPF_ROUTE_PATH_TYPE_1_EXTERNAL = 0x02, + OSPF_ROUTE_PATH_TYPE_2_EXTERNAL = 0x03, + OSPF_ROUTE_PATH_TYPE_WILDCARD = 0xFF +}; + +enum OSPF_COUNTER_ACTION_TYPE +{ + OSPF_INCREMENT_COUNTERS = 0x0, + OSPF_DECREMENT_COUNTERS = 0x1 +}; + +enum OSPF_PRINTF_GROUPS +{ + OSPF_INTERFACE_PRINTF = 0x0, + OSPF_NEIGHBOR_PRINTF = 0x1, + OSPF_MEMORY_PRINTF = 0x2, + OSPF_ALARM_PRINTF = 0x3, + OSPF_SNMP_PRINTF = 0x4, + OSPF_PACKET_PRINTF = 0x5, + OSPF_ROUTING_TABLE_PRINTF = 0x6, + OSPF_DEBUG_PRINTF = 0x7, + OSPF_RTM_PRINTF = 0x08, + OSPF_PATRICIA_DEBUG_PRINTF = 0x09, + OSPF_DB_OVERFLOW_PRINTF = 0x0A, + OSPF_SEARCH_PRINTF = 0x0B, + OSPF_PROLOGUE_PRINTF = 0x0C +}; + +enum OSPF_SEARCH_TYPE +{ + OSPF_SEARCH_LSA_TYPE = 0x01, + OSPF_SEARCH_LSA_ID = 0x02, + OSPF_SEARCH_ADVERTISING_ROUTER = 0x03 +}; + + +enum OSPF_MODE +{ + PASSIVE = 0x00, + ACTIVE = 0x01 +}; + +typedef signed long seq_t; /* signed 32 bit number */ + +typedef enum +{ + OSPFINVALDLSSEQ = 0x80000000L, /* Invalid LS sequence number (reserved or unused) */ + OSPFINITLSSEQ = 0x80000001L, /* Initial LS Sequence value */ + OSPFMAXLSSEQ = 0x7fffffffL, /* Maximum LS Sequence value */ + OSPFLSINVALID = 0x80000000L /* Invalid LS Sequence value */ +} SEQNO_T; + +/* SPR#76812 */ +/* used for routing table indexing*/ +enum OSPF_ROUTE_TABLE_TYPE +{ + OSPF_ROUTE_TABLE_NETWORK = 0x00, + OSPF_ROUTE_TABLE_ROUTER = 0x01, + OSPF_ROUTE_TABLE_MAX = 0x02 +}; + +typedef enum +{ + OSPF_TASK_STATE_NOT_CREATED = 0, + OSPF_TASK_STATE_CREATED, + OSPF_TASK_STATE_INIT_COMPLETE, + OSPF_TASK_STATE_RUNNING +} OSPF_TASK_STATES; + +typedef enum +{ + OSPF_TASK_TIMER, + OSPF_TASK_HELLO_TIMER, + OSPF_TASK_INPUT, + OSPF_TASK_RTM, + OSPF_NUM_TASKS +} OSPF_TASKS; + + +enum OSPF_RTM_ROUTE_PROTOCOL_FAMILY +{ + OSPF_RTM_IP = 0x01, + OSPF_RTM_IPX = 0x02 +}; + +enum OSPF_RTM_IP_ROUTE_TYPE + { + OSPF_RTM_OTHER_ROUTE_TYPE = 0x01, /* none of the following */ + OSPF_RTM_INVALID_ROUTE_TYPE = 0x02, /* an invalidated route */ + OSPF_RTM_DIRECT_ROUTE_TYPE = 0x03, /* route to directly connected (sub-)network */ + OSPF_RTM_INDIRECT_ROUTE_TYPE = 0x04 /* route to a non-local host/network/sub-network */ + }; + +enum OSPF_RTM_IP_PROTOCOL_VALUE + { + OSPF_RTM_RESERVED_PROTOCOL = 0, + OSPF_RTM_ICMP_PROTOCOL = 1, + OSPF_RTM_IGMP_PROTOCOL = 2, + OSPF_RTM_IP_PROTOCOL = 4, + OSPF_RTM_TCP_PROTOCOL = 6, + OSPF_RTM_IGP_PROTOCOL = 9, + OSPF_RTM_UDP_PROTOCOL = 17, + OSPF_RTM_IDRP_PROTOCOL = 45, + OSPF_RTM_RSVP_PROTOCOL = 46, + OSPF_RTM_GRE_PROTOCOL = 47, + OSPF_RTM_IPSEC_ESP_PROTOCOL = 50, + OSPF_RTM_IPSEC_AH_PROTOCOL = 51, + OSPF_RTM_IGRP_PROTOCOL = 88, + OSPF_RTM_OSPF_PROTOCOL = 89, + OSPF_RTM_IPIP_PROTOCOL = 94, + OSPF_RTM_ETHERIP_PROTOCOL = 97 + }; + +enum OSPF_RTM_IP_ROUTE_PROTOCOL_TYPE + { + OSPF_RTM_OTHER_ROUTING_PROTOCOL_TYPE = 0x01, + OSPF_RTM_IP_ROUTING_PROTOCOL_TYPE = 0x01, /* RTM_IP_ROUTING_PROTOCOL_TYPE in intentionally defined as 1 as well */ + OSPF_RTM_LOCALLY_CONFIGURED_TYPE = 0x02, + OSPF_RTM_NETWORK_MANAGEMENT_PROTOCOL_TYPE = 0x03, + OSPF_RTM_ICMP_PROTOCOL_TYPE = 0x04, + OSPF_RTM_EGP_PROTOCOL_TYPE = 0x05, + OSPF_RTM_GGP_PROTOCOL_TYPE = 0x06, + OSPF_RTM_HELLO_PROTOCOL_TYPE = 0x07, + OSPF_RTM_RIP_PROTOCOL_TYPE = 0x08, + OSPF_RTM_IS_IS_PROTOCOL_TYPE = 0x09, + OSPF_RTM_ES_IS_PROTOCOL_TYPE = 0x0a, + OSPF_RTM_CISCO_IGRP_TYPE = 0x0b, + OSPF_RTM_BBN_SPF_IGP_TYPE = 0x0c, + OSPF_RTM_OSPF_PROTOCOL_TYPE = 0x0d, + OSPF_RTM_BGP_PROTOCOL_TYPE = 0x0e + }; + +enum OSPF_RTM_IP_ROUTE_OPERATION + { + OSPF_RTM_ADD_IP_ROUTE = 0x01, + OSPF_RTM_DELETE_IP_ROUTE = 0x02 + }; + +#endif /* _OSPF_ENUMS_H_ */ diff --git a/h/wrn/ospf/ospf_globals.h b/h/wrn/ospf/ospf_globals.h new file mode 100644 index 0000000..0006677 --- /dev/null +++ b/h/wrn/ospf/ospf_globals.h @@ -0,0 +1,64 @@ +/* ospf_globals.h - OSPF globals */ + +/* Copyright 2000-2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +03b,08jun05,dsk changed declaration of global semaphores +03a,22aug03,agi ported to Accordion stack +02e,30may03,agi removed ospfRawInputTaskId +02d,26may03,agi Removed RWOS-specific references +02c,09may03,agi Added global OSPF semaphores +02b,17feb02,ram SPR 81808 Added OSPF memory partition support +02a,28jan03,ram SPR 85050 Added new mutex for external route queue +01a,05jun96,cindy First Beta Release +*/ + +/* the meta structure */ + +#if !defined (_OSPF_GLOBALS_H_) +#define _OSPF_GLOBALS_H_ +typedef int (*FP_OSPF_RECEIVE) (register struct mbuf *message_block); + +typedef int (*FP_OSPF_SEND) (register struct mbuf *message_block); + + +typedef struct OSPF_CALLBACK_IF +{ + int ospfEnabled; + FP_OSPF_RECEIVE pOSpfReceive; + FP_OSPF_SEND pOSpfSend; + +} OSPF_CALLBACK_IF; + +/* the following iterators needs to be defined regardless if __OSPF_VIRTUAL_STACK__ preproc + * is used. + */ + +#if !defined (__OSPF_VIRTUAL_STACK__) +extern OSPF_CLASS ospf; + +extern SEM_ID ospf_global_mutex; +extern SEM_ID ospf_config_mutex; +extern SEM_ID ospf_external_route_mutex; + +extern OSPF_CALLBACK_IF OspfRegistrationInfo; + +extern char ospf_configuration_text[OSPF_MAXIMUM_FILE_SIZE + 1]; + +extern UINT ten_seconds_counter; + +/* SPR 81808 -- Begin */ +extern ULONG ospfMemPartId; +/* SPR 81808 -- End */ + +#endif /* __OSPF_VIRTUAL_STACK__ */ +/*RFC 1765*/ +extern ULONG ospf_db_overflow_timer; + +#endif /* _OSPF_GLOBALS_H_ */ + + + diff --git a/h/wrn/ospf/ospf_interface_state_machine.h b/h/wrn/ospf/ospf_interface_state_machine.h new file mode 100644 index 0000000..c6876c1 --- /dev/null +++ b/h/wrn/ospf/ospf_interface_state_machine.h @@ -0,0 +1,129 @@ +/* ospf_interface_state_machine.h */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/*modification history +___________________ + 19,21may01,jkw Updated for point to point + 18,26september00,reshma Added WindRiver CopyRight + 17,25september00,reshma RFC-1587 implementation for OSPF NSSA Option, also tested against ANVL. + 16,20july00,reshma Unix compatibility related changes. + 15,06july00,reshma Removed unnecessary header files and defines. + 14,04april00,reshma Added some MIB support (Read only). + Passed all important ANVL OSPF tests. + 13,23december99,reshma Compatibility with VxWorks-IP and VxWorks RTM-interface + 12,19may99,jack redefined OSPF_PATRICIA_32_BITS_KEY_MAX_BIT_POSITION as per fixes in + patricia + 11,28december98,jack Compiled and added some comments + 10,11november98,jack Config changes, linted and big endian changes + 09,30october98,jack Incorporate changes for compilation on Vxworks + 08,23august98,jack ANVL tested OSPF with PATRICIA tree route table and no recursion + 07,10august98,jack PATRICIA Route Table Based OSPF Code Base + 06,08july98,jack Patricia RT table related changes - need to be tested + 05,04june98,jack Integration with RTM and BGP + 04,10july97,cindy Pre-release v1.52b + 03,10february97,cindy Release Version 1.52 + 02,22october97,cindy Release Version 1.50 + 01,05june96,cindy First Beta Release +*/ + +#if !defined (_OSPF_INTERFACE_STATE_MACHINE_H_) +#define _OSPF_INTERFACE_STATE_MACHINE_H_ + +typedef struct OSPF_INTERFACE_STATE_MACHINE +{ + void (*fptr_interface_transition_function) (OSPF_INTERFACE *sptr_interface); +} OSPF_INTERFACE_STATE_MACHINE; + +typedef void (*INTERFACE_TRANSITION_FUNCTION) (OSPF_INTERFACE *sptr_interface); + +OSPF_INTERFACE_STATE_MACHINE ospf_interface_event_processing_table[OSPF_NUMBER_OF_INTERFACE_EVENTS][OSPF_NUMBER_OF_INTERFACE_STATES] = +{ +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPF_INTERFACE_UP 0 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPF_INTERFACE_IS_DOWN */ {(INTERFACE_TRANSITION_FUNCTION) ospf_process_interface_up_event}, +/* OSPF_INTERFACE_LOOPBACK */ {NULL}, +/* OSPF_INTERFACE_WAITING */ {NULL}, +/* OSPF_INTERFACE_POINT_TO_POINT */ {NULL}, +/* OSPF_INTERFACE_DESIGNATED_ROUTER_OTHER */ {NULL}, +/* OSPF_INTERFACE_BACKUP_DESIGNATED_ROUTER */ {NULL}, +/* OSPF_INTERFACE_DESIGNATED_ROUTER */ {NULL} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPF_WAIT_TIMER 1 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPF_INTERFACE_IS_DOWN */ {NULL}, +/* OSPF_INTERFACE_LOOPBACK */ {NULL}, +/* OSPF_INTERFACE_WAITING */ {(INTERFACE_TRANSITION_FUNCTION) ospf_process_interface_wait_timer_event}, +/* OSPF_INTERFACE_POINT_TO_POINT */ {(INTERFACE_TRANSITION_FUNCTION) ospf_process_interface_wait_timer_event}, +/* OSPF_INTERFACE_DESIGNATED_ROUTER_OTHER */ {NULL}, +/* OSPF_INTERFACE_BACKUP_DESIGNATED_ROUTER */ {NULL}, +/* OSPF_INTERFACE_DESIGNATED_ROUTER */ {NULL} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPF_BACKUP_SEEN 2 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPF_INTERFACE_IS_DOWN */ {NULL}, +/* OSPF_INTERFACE_LOOPBACK */ {NULL}, +/* OSPF_INTERFACE_WAITING */ {(INTERFACE_TRANSITION_FUNCTION) ospf_process_interface_backup_seen_event}, +/* OSPF_INTERFACE_POINT_TO_POINT */ {NULL}, +/* OSPF_INTERFACE_DESIGNATED_ROUTER_OTHER */ {NULL}, +/* OSPF_INTERFACE_BACKUP_DESIGNATED_ROUTER */ {NULL}, +/* OSPF_INTERFACE_DESIGNATED_ROUTER */ {NULL} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPF_NEIGHBOR_CHANGE 3 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPF_INTERFACE_IS_DOWN */ {NULL}, +/* OSPF_INTERFACE_LOOPBACK */ {NULL}, +/* OSPF_INTERFACE_WAITING */ {NULL}, +/* OSPF_INTERFACE_POINT_TO_POINT */ {NULL}, +/* OSPF_INTERFACE_DESIGNATED_ROUTER_OTHER */ {(INTERFACE_TRANSITION_FUNCTION) ospf_process_interface_neighbor_change_event}, +/* OSPF_INTERFACE_BACKUP_DESIGNATED_ROUTER */ {(INTERFACE_TRANSITION_FUNCTION) ospf_process_interface_neighbor_change_event}, +/* OSPF_INTERFACE_DESIGNATED_ROUTER */ {(INTERFACE_TRANSITION_FUNCTION) ospf_process_interface_neighbor_change_event} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPF_LOOP_INDICATION 4 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPF_INTERFACE_IS_DOWN */ {(INTERFACE_TRANSITION_FUNCTION) ospf_process_interface_loop_indication_event}, +/* OSPF_INTERFACE_LOOPBACK */ {(INTERFACE_TRANSITION_FUNCTION) ospf_process_interface_loop_indication_event}, +/* OSPF_INTERFACE_WAITING */ {(INTERFACE_TRANSITION_FUNCTION) ospf_process_interface_loop_indication_event}, +/* OSPF_INTERFACE_POINT_TO_POINT */ {(INTERFACE_TRANSITION_FUNCTION) ospf_process_interface_loop_indication_event}, +/* OSPF_INTERFACE_DESIGNATED_ROUTER_OTHER */ {(INTERFACE_TRANSITION_FUNCTION) ospf_process_interface_loop_indication_event}, +/* OSPF_INTERFACE_BACKUP_DESIGNATED_ROUTER */ {(INTERFACE_TRANSITION_FUNCTION) ospf_process_interface_loop_indication_event}, +/* OSPF_INTERFACE_DESIGNATED_ROUTER */ {(INTERFACE_TRANSITION_FUNCTION) ospf_process_interface_loop_indication_event} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPF_UNLOOP_INDICATION 5 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPF_INTERFACE_IS_DOWN */ {NULL}, +/* OSPF_INTERFACE_LOOPBACK */ {(INTERFACE_TRANSITION_FUNCTION) ospf_process_interface_unloop_indication_event}, +/* OSPF_INTERFACE_WAITING */ {NULL}, +/* OSPF_INTERFACE_POINT_TO_POINT */ {NULL}, +/* OSPF_INTERFACE_DESIGNATED_ROUTER_OTHER */ {NULL}, +/* OSPF_INTERFACE_BACKUP_DESIGNATED_ROUTER */ {NULL}, +/* OSPF_INTERFACE_DESIGNATED_ROUTER */ {NULL} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPF_INTERFACE_DOWN 6 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPF_INTERFACE_IS_DOWN */ {NULL}, +/* OSPF_INTERFACE_LOOPBACK */ {(INTERFACE_TRANSITION_FUNCTION) ospf_process_interface_down_event}, +/* OSPF_INTERFACE_WAITING */ {(INTERFACE_TRANSITION_FUNCTION) ospf_process_interface_down_event}, +/* OSPF_INTERFACE_POINT_TO_POINT */ {(INTERFACE_TRANSITION_FUNCTION) ospf_process_interface_down_event}, +/* OSPF_INTERFACE_DESIGNATED_ROUTER_OTHER */ {(INTERFACE_TRANSITION_FUNCTION) ospf_process_interface_down_event}, +/* OSPF_INTERFACE_BACKUP_DESIGNATED_ROUTER */ {(INTERFACE_TRANSITION_FUNCTION) ospf_process_interface_down_event}, +/* OSPF_INTERFACE_DESIGNATED_ROUTER */ {(INTERFACE_TRANSITION_FUNCTION) ospf_process_interface_down_event} +} +}; + + +#endif /* _OSPF_INTERFACE_STATE_MACHINE_H_ */ diff --git a/h/wrn/ospf/ospf_invar.h b/h/wrn/ospf/ospf_invar.h new file mode 100644 index 0000000..96d7b4e --- /dev/null +++ b/h/wrn/ospf/ospf_invar.h @@ -0,0 +1,95 @@ +/* in_var.h - in_var header file */ + +/* Copyright 2001-2003 Wind River Systems, Inc. */ + +/* + * Copyright (c) 1985, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)in_var.h 8.2 (Berkeley) 1/9/95 + * $FreeBSD: src/sys/netinet/in_var.h,v 1.33.2.3 2001/12/14 20:09:34 jlemon Exp $ + */ + +/* +modification history +-------------------- +01e,13may05,xli remove the struct already defined in invar.h +01d,22mar05,xli remove some macro redefinition which already defined in netinet/in_var.h +01c,05oct04,tlu temporary fixing for compile errors when using both INCLUDE_IPFW_HOOKS + and VIRTUAL_STACK flags +01b,18aug04,jwl changed to work with VIRTUAL_STACK flag +01a,23mar04,zrh created from in_var.h for the ospf_30 +*/ + + +#ifndef _OSPF_IN_VAR_H_ +#define _OSPF_IN_VAR_H_ + +#include + +#include +#include + +extern __inline Fnv32_t fnv_32_buf(const void *buf, size_t len, Fnv32_t hval); +extern u_long in_ifaddrhmask; + +/* + * Interface address, Internet version. One of these structures + * is allocated for each Internet address on an interface. + * The ifaddr structure contains the protocol-independent part + * of the structure and is assumed to be first. + */ + +/* + * Given a pointer to an in_ifaddr (ifaddr), + * return a pointer to the addr as a sockaddr_in. + */ +#define IA_SIN(ia) (&(((struct in_ifaddr *)(ia))->ia_addr)) +#define IA_DSTSIN(ia) (&(((struct in_ifaddr *)(ia))->ia_dstaddr)) + +#define IN_LNAOF(in, ifa) \ + ((ntohl((in).s_addr) & ~((struct in_ifaddr *)(ifa)->ia_subnetmask)) + + +#ifndef VIRTUAL_STACK +extern struct ifqueue ipintrq; /* ip packet input queue */ +#endif /* !VIRTUAL_STACK */ + +/* + * Hash table for IP addresses. + */ + +#define INADDR_HASHVAL(x) fnv_32_buf((&(x)), sizeof(x), FNV1_32_INIT) +#define INADDR_HASH(x) \ + (&in_ifaddrhashtbl[INADDR_HASHVAL(x) & in_ifaddrhmask]) + + +#endif /* _NETINET_IN_VAR_H_ */ diff --git a/h/wrn/ospf/ospf_ip_structures.h b/h/wrn/ospf/ospf_ip_structures.h new file mode 100644 index 0000000..bd27432 --- /dev/null +++ b/h/wrn/ospf/ospf_ip_structures.h @@ -0,0 +1,257 @@ +/* ospf_ip_structures.h - OSPF IP structures */ + +/* Copyright 2000-2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +___________________ +03a,06aug03,agi ported to Accordion stack +02b,19nov02,mwv Merge TMS code SPR 84284 +02a,07oct02,agi Fixed compiler warnings +01b,10oct01,jkw Added port_number back to IP_ROUTE_ENTRY structure. +01a,22sep01,kc Removed port_number from IP_ROUTE_ENTRY structure. +*/ + +#if !defined (__OSPF_IP_STRUCTURES_H__) + #define __OSPF_IP_STRUCTURES_H__ + +#if __DCC__ +__packed__ enum IP_ROUTE_TYPE +#else +enum IP_ROUTE_TYPE +#endif +{ + OTHER_ROUTE_TYPE = 0x01, /* none of the following */ + INVALID_ROUTE_TYPE = 0x02, /* an invalidated route */ + DIRECT_ROUTE_TYPE = 0x03, /* route to directly connected (sub-)network */ + INDIRECT_ROUTE_TYPE = 0x04 /* route to a non-local host/(sub-)network */ +#if __DCC__ +}; +#else +} _pack; +#endif + + +#if __DCC__ +__packed__ enum IP_PROTOCOL_VALUE +#else +enum IP_PROTOCOL_VALUE +#endif +{ + RESERVED_PROTOCOL = 0, + ICMP_PROTOCOL = 1, + IGMP_PROTOCOL = 2, + VX_IP_PROTOCOL = 4, /* + * Original name IP_PROTOCOL changed due + * to variable name collision in + * rwutil.h- V2 version + */ + TCP_PROTOCOL = 6, + IGP_PROTOCOL = 9, + UDP_PROTOCOL = 17, + IDRP_PROTOCOL = 45, + RSVP_PROTOCOL = 46, + GRE_PROTOCOL = 47, + IPSEC_ESP_PROTOCOL = 50, + IPSEC_AH_PROTOCOL = 51, + IGRP_PROTOCOL = 88, + OSPF_PROTOCOL = 89, + IPIP_PROTOCOL = 94, + ETHERIP_PROTOCOL = 97 +#if __DCC__ +}; +#else +} _pack; +#endif + + +#if __DCC__ +__packed__ enum IP_ROUTE_PROTOCOL_TYPE +#else +enum IP_ROUTE_PROTOCOL_TYPE +#endif +{ + OTHER_ROUTING_PROTOCOL_TYPE = 0x01, + IP_ROUTING_PROTOCOL_TYPE = 0x01, /* + * IP_ROUTING_PROTOCOL_TYPE is + * intentionally defined as 1 + * as well + */ + LOCALLY_CONFIGURED_TYPE = 0x02, + NETWORK_MANAGEMENT_PROTOCOL_TYPE = 0x03, + ICMP_PROTOCOL_TYPE = 0x04, + EGP_PROTOCOL_TYPE = 0x05, + GGP_PROTOCOL_TYPE = 0x06, + HELLO_PROTOCOL_TYPE = 0x07, + RIP_PROTOCOL_TYPE = 0x08, + IS_IS_PROTOCOL_TYPE = 0x09, + ES_IS_PROTOCOL_TYPE = 0x0a, + CISCO_IGRP_TYPE = 0x0b, + BBN_SPF_IGP_TYPE = 0x0c, + OSPF_PROTOCOL_TYPE = 0x0d, + BGP_PROTOCOL_TYPE = 0x0e +#if __DCC__ +}; +#else +} _pack; +#endif + + +#if __DCC__ +__packed__ enum IP_ROUTE_OPERATION +#else +enum IP_ROUTE_OPERATION +#endif +{ + ADD_IP_ROUTE = 0x01, + DELETE_IP_ROUTE = 0x02 +#if __DCC__ +}; +#else +} _pack; +#endif + + +typedef _struct SERVICE_TYPE_BIT_STRUCTURE +{ +#if (_BYTE_ORDER == _LITTLE_ENDIAN ) + unsigned char unused:2; + unsigned char high_reliability:1; + unsigned char high_throughput:1; + unsigned char low_delay:1; + unsigned char precedence:3; +#else /* _BYTE_ORDER == _BIG_ENDIAN */ + unsigned char precedence:3; + unsigned char low_delay:1; + unsigned char high_throughput:1; + unsigned char high_reliability:1; + unsigned char unused:2; +#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ +} _pack SERVICE_TYPE_BIT_STRUCTURE; + +typedef _union UNION_SERVICE_TYPE_BIT_STRUCTURE +{ + SERVICE_TYPE_BIT_STRUCTURE _bit; + BYTE _byte; +} _pack UNION_SERVICE_TYPE_BIT_STRUCTURE; + + +typedef _union UNION_USER_OPTIONS +{ + BYTE char_options[MAXIMUM_IP_OPTION_LENGTH]; /* according to rfc791 format in network order */ + ULONG ulong_options[MAXIMUM_IP_OPTION_LENGTH / sizeof (ULONG)]; +} _pack UNION_USER_OPTIONS; + +typedef _struct IP_UPPER_LAYER_PARAMETERS +{ + ULONG source_address; + ULONG destination_address; + BYTE_ENUM (BOOLEAN) do_not_fragment_flag; + SERVICE_TYPE_BIT_STRUCTURE type_of_service; + USHORT sequence_id; + BYTE time_to_live; + BYTE protocol; + BYTE option_length; + UNION_USER_OPTIONS user_options; + void *vptr_cached_route; /* address of cached route stored in user's space */ + USHORT virtual_port_number; /* do not route, send out through this port if not NO_SUCH_PORT */ + ULONG gateway; +} _pack IP_UPPER_LAYER_PARAMETERS; + +typedef _struct VERSION_LENGTH_BIT_STRUCTURE +{ +#if (_BYTE_ORDER == _LITTLE_ENDIAN ) + unsigned char header_length:4; + unsigned char version:4; +#else /* _BYTE_ORDER == _BIG_ENDIAN */ + unsigned char version:4; + unsigned char header_length:4; +#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ +} _pack VERSION_LENGTH_BIT_STRUCTURE; + + +typedef _struct FLAG_FRAGMENT_OFFSET_BIT_STRUCTURE +{ +#if (_BYTE_ORDER == _LITTLE_ENDIAN ) + unsigned char fragment_offset_most_significant_part:5; + unsigned char more_fragment_flag:1; + unsigned char do_not_fragment_flag:1; + unsigned char unused_bit:1; +#else /* _BYTE_ORDER == _BIG_ENDIAN */ + unsigned char unused_bit:1; + unsigned char do_not_fragment_flag:1; + unsigned char more_fragment_flag:1; + unsigned char fragment_offset_most_significant_part:5; +#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ +} _pack FLAG_FRAGMENT_OFFSET_BIT_STRUCTURE; + +typedef _struct IP_HEADER +{ + VERSION_LENGTH_BIT_STRUCTURE version_header_length; + SERVICE_TYPE_BIT_STRUCTURE service_type; + USHORT total_length; + USHORT identifier; + FLAG_FRAGMENT_OFFSET_BIT_STRUCTURE flags_fragment_offset; + BYTE fragment_offset_least_significant_part; + BYTE time_to_live; + BYTE protocol; + USHORT header_checksum; + ULONG source_ip_address; + ULONG destination_ip_address; +} _pack IP_HEADER; + + +typedef struct IP_PARAMETERS +{ + USHORT header_length; + USHORT total_length; + ULONG source_address; + ULONG destination_address; + USHORT offset; + SERVICE_TYPE_BIT_STRUCTURE type_of_service; + USHORT id; + BYTE time_to_live; + BYTE_ENUM (IP_PROTOCOL_VALUE) protocol; + BYTE options_length; + BYTE_ENUM (BOOLEAN) do_not_fragment_flag; + BYTE_ENUM (BOOLEAN) more_fragment_flag; + BYTE version; + USHORT checksum; + USHORT rx_port_number; + ULONG gateway; + BYTE_ENUM (BOOLEAN) union_ip_packet_is_to_be_freed; + BYTE_ENUM (BOOLEAN) packet_forwarded_by_upper_layer; + BYTE_ENUM (BOOLEAN) packet_recognized_by_upper_layer; +} IP_PARAMETERS; + +typedef _union UNION_OPTIONS_OR_DATA +{ + BYTE data; + BYTE ip_options; +} _pack UNION_OPTIONS_OR_DATA; + + +typedef struct PSEUDO_IP_PARAMETERS +{ + ULONG source_address; + ULONG destination_address; + BYTE zero_field; + BYTE protocol; + USHORT length; +} PSEUDO_IP_PARAMETERS; + +#ifndef INVALID_SOCKET_DESCRIPTOR +#define INVALID_SOCKET_DESCRIPTOR 0 +#endif + + +#ifndef SOCKET_OPEN_MODE_WAIT_FOR_MULTIPLE_CONNECTION +#define SOCKET_OPEN_MODE_WAIT_FOR_MULTIPLE_CONNECTION 0xFFFF +#endif + +#ifndef WOULD_BLOCK_ERROR +#define WOULD_BLOCK_ERROR 0xFFFF +#endif + +#endif /* __OSPF_IP_STRUCTURES_H__ */ diff --git a/h/wrn/ospf/ospf_mdLib.h b/h/wrn/ospf/ospf_mdLib.h new file mode 100644 index 0000000..9b1c4f1 --- /dev/null +++ b/h/wrn/ospf/ospf_mdLib.h @@ -0,0 +1,39 @@ +/* mdLib.h - message digest library header file */ + +/* Copyright 2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,23mar04,zhr created from mdLib.h +*/ + +#ifndef __INCmdLibh +#define __INCmdLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* Algorithms: MD4 or MD5 */ +typedef enum +{ + MD4 = 0x04, + MD5 = 0x05 +} MD_ALGORITHM; + +#define HMAC_MD5_RESULT_LENGTH 16 /* HMAC-MD5 result length */ +#define MD5_DIGEST_LEN 16 + +/* Prototypes */ +extern void mdString(unsigned char *, unsigned long, unsigned char *, + MD_ALGORITHM); +extern void mdHmac5(unsigned char *, int, unsigned char *, int, + unsigned char *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCmdLibh */ diff --git a/h/wrn/ospf/ospf_memory.h b/h/wrn/ospf/ospf_memory.h new file mode 100644 index 0000000..11fc1cb --- /dev/null +++ b/h/wrn/ospf/ospf_memory.h @@ -0,0 +1,62 @@ +/* ospf_memory.h */ + +/* Copyright 2001-2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/*modification history +___________________ + 02a,17feb02,ram SPR 81808 Added OSPF memory partition support - initial creation +*/ + +#if !defined (_OSPF_MEMORY_H_) +#define _OSPF_MEMORY_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define OSPF_PARTMEM_LARGE_SIZE (2048 * 1024) /* 2M Preferred initial memory partition size * 2 Megs */ +#define OSPF_PARTMEM_SMALL_SIZE (128 * 1024) /* Alternate Initial memory partition size */ + +/* OSPF memory partition defintions */ +/* Undefine older memory macros */ + +#if defined (buffer_malloc) +#undef buffer_malloc +#endif +#if defined (buffer_free) +#undef buffer_free +#endif +#if defined (table_malloc) +#undef table_malloc +#endif +#if defined (table_free) +#undef table_free +#endif +#if defined (message_malloc) +#undef message_malloc +#endif +#if defined (message_free) +#undef message_free +#endif + +/* Define new memory macros */ +#define OSPF_PARTMEM_CREATE ospfMemPartCreate +#define OSPF_PARTMEM_DELETE ospfMemPartDelete(ospfMemPartId) +#define OSPF_PARTMEM_EXPAND(size) ospfMemPartExpand(ospfMemPartId,size) + +#define OSPF_PARTMEM_OPTION(option) ospfMemPartSetOptions(ospfMemPartId,option) +#define OSPF_PARTMEM_SHOW(option) ospfMemPartShow(ospfMemPartId,option) + +#define buffer_malloc(size) ospfMemPartAlloc(ospfMemPartId,size) +#define table_malloc(units,size) ospfMemPartAlloc(ospfMemPartId,size) +#define message_malloc(size) ospfMemPartAlloc(ospfMemPartId,size) +#define buffer_free(ptr) ospfMemPartFree(ospfMemPartId,(void*)ptr) +#define table_free(ptr) ospfMemPartFree(ospfMemPartId,(void*)ptr) +#define message_free(ptr) ospfMemPartFree(ospfMemPartId,(void*)ptr) + +#ifdef __cplusplus +} +#endif + +#endif /* _OSPF_MEMORY_H_ */ diff --git a/h/wrn/ospf/ospf_mib_api.h b/h/wrn/ospf/ospf_mib_api.h new file mode 100644 index 0000000..9732d00 --- /dev/null +++ b/h/wrn/ospf/ospf_mib_api.h @@ -0,0 +1,580 @@ +/* ospf_mib_api.h - public interface for managing OSPFv2 */ + +/* Copyright 1998-2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +04e,06may04,ram Fix for AVL memory corruption +04d,22apr04,ram AVL & Memory migration to shared library +04c,17dec03,agi propogated weighted routes fix +04b,16dec03,agi propogated latest MIB API fixes +04a,08dec03,agi merged fixes from OSPF 2.1 patch branch + added include WRS copyright +02y,29oct03,kc Fixed SPR#91541 - added wrnOspfToIpRouteTable configuration + support to mApiOspfClass_t. Also added ospfMapiGetWrnToIpRoute() + and ospfMapiGetWrnToIpRoute() prototypes. +03b,23sep03,kc Added nvmWrnOspfSaveRtn, nvmWrnOspfDelRtn and nvmWrnOspfRetrieveRtn + function callback to mApiOspfClass_t. Renamed nvramSaveRtn, + nvramDelRtn and nvramRetrieveRtn to nvmOspfSaveRtn, nvmOspfDelRtn + and nvmOspfRetrieveRtn. Added nvram callbacks for wrn-ospf mib to + ospfMapiInit() prototype. +03a,17jun03,kc Fixed SPR#85532 - added wrnOspfLocalIfTable configuration support + to mApiOspfClass_t. Also added ospfMapiGetWrnLocalIf() and + ospfMapiSetWrnLocalIf() prototypes. +02z,23may03,kc Fixed SPR#88863 - added wrnOspfRedistributionTable configuration + support to mApiOspfClass_t. Also added ospfMapiGetWrnRedistrib() + and ospfMapiSetWrnRedistrib() prototypes. +02y,25may03,kc Renamed the INCLUDE_OSPF_SHOW_ROUTINES define to + INCLUDE_OSPF_MIB_SHOW_ROUTINES. Added new + INCLUDE_OSPF_MIB_UTILITIES define. +02x,23may03,kc Fixed SPR#88863 - added wrnOspfRedistributionTable configuration + support to mApiOspfClass_t. Also added ospfMapiGetWrnRedistrib() + and ospfMapiSetWrnRedistrib() prototypes. +02w,28feb03,kc Fixed SPR#86502 - Added INCLUDE_OSPF_MIB_UTILITIES define. Also + renamed INCLUDE_OSPF_SHOW_ROUTINES to INCLUDE_OSPF_MIB_SHOW_ROUTINES. +02v,28feb03,kc Fixed SPR#86493 - changed the max number of concurrent rows that + can be configured for the Type-9 Opaque LSAs, Type-10 Opaque LSAs + and Type-11 Opaque LSAs to match the user's guide. +02u,31jan03,kc Fixed SPR#86007 - added ospfMapiSetHelper() prototype. +02t,19nov02,mwv Merge TMS code SPR 84284 +02s,12nov02,kc Changed returned type for ospfMapiDestroy prototype. Added + ospfMapiIsInited() prototype. +02r,17jun02,kc Added currObjInProcess to mApiOspfClass_t. +02q,10apr02,kc Remerged changes for unnumbered interface support. +02p,29mar02,kc Added ospfBackboneActive boolean flag to mApiOspfClass_t. +02o,26mar02,kc Added ospfMapiDebug and ospfMapiErrorDebug variables to the + mApiOspfPrintf and mApiOspfError debug macros. +02n,09mar02,kc Added ospfBackboneExist boolean flag to mApiOspfClass_t. +02m,22feb02,kc Renamed prototypes for all functions using WRS naming convention. +02l,13feb02,kc Added currMapiReqType to mApiOspfClass_t. +02k,07feb02,kc Added mApiNvmSetReqFailedCnt to mApiOspfClass_t. +02j,28dec01,kc Added ospfProtoType_t enumeration values. +02i,15dec02,kc Added argument for pObjInfo pointer to ospf_rs2mApi_errorGet(). +02h,14dec01,kc Removed ospf_mApi_avlTreeErase() prototype. +02g,06dec01,kc Added semTimeout to mApiOspfClass_t. +02f,09nov01,kc Redefine the DEFAULT_OSPF_MAPI_xxx_MAX system dependent + configuration parameters. +02e,25oct01,kc Always define INCLUDE_OSPF_SHOW_ROUTINES for now until Project + Facility supports it. +02d,21oct01,kc Added ospf_mApi_avlTreeErase() prototype. +02c,21oct01,kc Added ospfProtoInit, ospfDbOverflow, ospfNssaEnabled and + ospfOpaqueEnable boolean variables to mApiOspfClass_t. +02b,20oct01,kc Added Area Aggregation support to mApiOspfClass_t. +02a,18oct01,kc Redefine arguments for ospf_mApi_init() prototype. +01z,17oct01,kc Added ospfRfcProto ospfProtoType_t enum value to mApiOspfClass_t. +01y,16oct01,kc Removed __WRN_OSPF_MIB__ preproc. +01x,16oct01,kc Added wrnOspf_mApi_getXXX() prototypes. +01w,16oct01,kc Fixed OSPF_MIB_BUFLEN_CHECK macro. Exception is not error. +01v,15oct01,kc Removed pOspfFreePool pointer from mApiOspfAvlClass_t. No longer + preallocated all memory pool at init time. +01u,15oct01,kc Changed DEFAULT_OSPF_MAPI_EXT_LSDB_MAX value to use the default + value for external lsdb. Removed the mApiMaxOspfReqBuf argument + from ospf_mApi_init(). +01t,13oct01,kc Added various operational error statistics to mApiOspfClass_t. +01s,10oct01,kc Added ospf_mApi_setNbr() prototype. +01r,10oct01,kc Moved mApiOspfClientType_t and mApiOspfClient_t declaration to + ospf_rfc1850_mApiHelper.h. +01q,10oct01,kc Added ospfNbrTable Row Status handler. +01p,08oct01,kc Added wrn-ospf mib specific stuffs. +01o.07oct01,kc Moved NVRAM_SAVE_FUNCPTR and NVRAM_RETRIEVE_FUNCPTR typedefs + to ospf_mApi_helper.h. +01n,21sep01,kc Renamed all mApiOspfAvlClass_t instances for clarification, +01m,20sep01,kc Added DEFAULT_OSPF_REQUEST_BUFFER_CNT define. +01l,18sep01,kc Added system configuration parameters for ospf enterprise mib. +01k,18sep01,kc Modified ospf_mApi_init() prototype. +01j,15sep01,kc Added function pointers for user supplied nvram save/retrieve + callbacks. Save callback function pointers to mApiOspfClass_t. +01i,12sep01,kc Added mApiOspfClient_t structure and mApiOspfClientType_t enums. +01h,12sep01,kc Added INCLUDE_OSPF_SHOW_ROUTINES for command line build. +01g,11sep01,kc Removed all show routines prototypes (after moved all show routines + to ospf_mApi_show.c) +01f,04sep01,kc Added prototypes for show routines. +01e,24aug01,kc Added SET related function pointers to support the implementation of + the ospf_mApi_processSetReq() routine. +01d,24aug01,kc Added prototypes for MIB API compliant SET routines. +01c,21aug01,kc Added GET related function pointers to support the implementation of + the ospf_mApi_processGetReq() routine. +01b,16aug01,kc Added prototypes for MIB API compliant GET routines. +01a,14aug01,kc Initial file creation. +*/ + +/* +DESCRIPTION: + +This file contains the definitions for constants, data structures and function prototypes +used to implement the OSPF Management Interface. + +*/ + +#ifndef __INCospf_mib_apih +#define __INCospf_mib_apih + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "ospfCommonRowStatusLib.h" + +/* initially turn off all the debug switch */ +IMPORT int ospfMapiDebug; +IMPORT int ospfMapiErrorDebug; + +/* mib api debug macro. */ +#undef mApiOspfDbgEnabled +#ifdef mApiOspfDbgEnabled +#define mApiOspfPrintf( _x ) { if (ospfMapiDebug) {printf _x;} } +#else +#define mApiOspfPrintf( _x ) +#endif /* mApiOspfDbgEnabled */ + +#undef mApiOspfErrorEnabled +#ifdef mApiOspfErrorEnabled +#define mApiOspfError( _x ) { if (ospfMapiErrorDebug) {printf _x;} } +#else +#define mApiOspfError( _x ) +#endif /* mApiOspfErrorEnabled */ + +/* always include mib api show routines and mib api command line utilities */ +#define INCLUDE_OSPF_MIB_SHOW_ROUTINES +#define INCLUDE_OSPF_MIB_UTILITIES + + +/* OSPF specific MIB API application defined error */ +#define MAPI_INVALID_INSTANCE 10000 + + +/* pointer to function for MIB API GET request */ +typedef STATUS (* MAPI_GET_RTN)( mApiRequest_t *pRequest, mApiReqType_t reqType ); + +/* pointer to function for MIB API SET request */ +typedef STATUS (* MAPI_SET_RTN)( mApiRequest_t *pRequest, mApiReqType_t reqType ); + +/* pointer to function for processing the SET request */ +typedef STATUS (* MAPI_HELPER_SET_RTN)( mApiRequest_t *pRequest, mApiReqType_t reqType ); + +/* pointer to function for dynamically configuring the OSPF protocol */ +typedef STATUS (* MAPI_HELPER_CONFIG_RTN)( mApiRequest_t *pRequest ); + +/* pointer to function for processing the GET/GET NEXT request */ +typedef STATUS (* MAPI_HELPER_GET_RTN)( void *pRow, mApiRequest_t *pRequest, + mApiObject_t *pReqObject ); + +/* pointer to function for setting the next index value for the GET NEXT request */ +typedef void (* MAPI_INDEX_SET_RTN)( void *pRow, mApiRequest_t *pRequest ); + +/* pointer to function that is used by AVL to compare two instances */ +typedef int (* MAPI_AVL_COMPARE_RTN)(AVL_NODE * node, void* key); + + +/* system dependenet configuration parameters. These parameters determine the number + * of concurrent instances that can be configured for each table in the OSPF-MIB. + */ +#define DEFAULT_OSPF_MAPI_AREA_MAX 8 +#define DEFAULT_OSPF_MAPI_STUB_MAX 4 +#define DEFAULT_OSPF_MAPI_HOST_MAX 4 +#define DEFAULT_OSPF_MAPI_INTF_MAX 16 +#define DEFAULT_OSPF_MAPI_VIRT_INTF_MAX 8 +#define DEFAULT_OSPF_MAPI_NBR_MAX 24 +#define DEFAULT_OSPF_MAPI_LSDB_MAX 512 +#define DEFAULT_OSPF_MAPI_EXT_LSDB_MAX 1024 +#define DEFAULT_OSPF_MAPI_REDISTRIB_MAX 24 +#define DEFAULT_OSPF_MAPI_AREA_AG_MAX 12 + +/* SPR#86493 - changed the max number of concurrent rows that can be configured for + * the Type-9 Opaque LSAs, Type-10 Opaque LSAs and Type-11 Opaque LSAs + */ +#define DEFAULT_OSPF_MAPI_TYPE9_LSA_MAX 12 /* for wrnOspfLocalLsdbTable */ +#define DEFAULT_OSPF_MAPI_TYPE10_LSA_MAX 32 /* for wrnOpsfLsdbTable */ +#define DEFAULT_OSPF_MAPI_TYPE11_LSA_MAX 12 /* for wrnOspfExtLsdbTable */ +#define DEFAULT_OSPF_MAPI_REDISTRIB_MAX 24 +#define DEFAULT_OSPF_MAPI_LOCAL_RT_MAX 24 +/* the following define is for unnumbered interface support in wrnOspfIfTable. Set the + * maximum number of instances allowed to be one entry less than the maximum number of + * instances in ospfIfTable. This is done this way because it may be possible that all + * but one instances in the ospfIfTable are created as unnumbered interface. In that + * case there must be at least one interface with IP Address so that those unnumbered + * interfaces can be initialized. + */ +#define DEFAULT_OSPF_MAPI_WRN_INTF_MAX DEFAULT_OSPF_MAPI_INTF_MAX-1 + +/* OSPF_REQUEST_BUFFER_CNT is the number of request buffers that will be allocated. + * These request buffers are used by ospf to provide operational status and stastitical + * update to the MIB API asynchronous. Although this number is arbitrary picked and + * can be tuned according to the system needs, the number of buffers allocated must + * be able to handle the maximum number of external link state advertisement updates + * from ospf during the flooding. + */ +#define DEFAULT_OSPF_REQUEST_BUFFER_CNT DEFAULT_OSPF_MAPI_EXT_LSDB_MAX + +/* system dependent application callback functions */ +/* The following typedefs have been moved to ospf_mib_helper_update.h. The definitions + * for these typedefs solely remain here for clarification purposes only. + * + * 1) NVRAM_SAVE_FUNCPTR is the function pointer pointed to a system dependent save + * routine for saving the given object to the nvram. + * + * typedef STATUS (* NVRAM_SAVE_FUNCPTR)( ulong_t *pInstance, ushort_t instanceLen, + * ulong_t oidPrefixEnum, void *pValueBuf, + * ulong_t valueLen ); + * + * 2) NVRAM_DELETE_FUNCPTR is the function pointer pointed to a system dependent delete + * routine for deleting a table row from the nvram. + * + * typedef STATUS (* NVRAM_DELETE_FUNCPTR)( ulong_t *pInstance, ushort_t instanceLen ); + * + * 3) NVRAM_RETRIEVE_FUNCPTR is the function pointer pointed to a system dependent + * retrieve routine for retrieving all prevously saved OSPF configuration from nvram. + * The retrieve routine must invoke the MIB API for read-create objects in each ospf + * table with the mApiRequest_t set to MAPI_NVM_SET request type so that MIB API can + * repopulate its management database at system startup. + * + * typedef STATUS (* NVRAM_RETRIEVE_FUNCPTR)( void ); + */ + +/* define the OSPF RFC that is currently using */ +typedef enum { + EospfProtoType_rfc1583 = 1, /* RFC1583 OSPFv2 */ + EospfProtoType_rfc2178, /* RFC2178 OSPFv2 */ + EospfProtoType_rfc2328 /* RFC2328 OSPFv2 */ +} ospfProtoType_t; + + +typedef struct mApiOspfAvlClass +{ + LIST ospfFreePoolList; /* free memory list */ + AVL_NODE *pOspfAvlRoot; /* AVL tree root */ + int memReqFailedCnt; /* memory request from pool failed */ + MAPI_AVL_COMPARE_RTN ospfAvlCompareRtn; /* AVL compare routine */ +} mApiOspfAvlClass_t; + + +/*************************************************************************************** + * Management Interface Data Structure. + */ +typedef struct mApiOspfClass +{ + /* OSPF Protocol Information */ + ospfProtoType_t ospfRfcProto; /* version of OSPFv2 RFC that is using */ + BOOL ospfProtoInit; /* if true, OSPF protocol is up */ + BOOL ospfOpaqueEnable; /* if true, support Opaque LSA */ + BOOL ospfDbOverflow; /* if true, support OSPF database overflow */ + BOOL ospfNssaEnabled; /* if true, support NSSA */ + BOOL ospfBackboneExist; /* if true, OSPF backbone area exists */ + BOOL ospfBackboneActive; /* if true, one more interfaces are active */ + + SEM_ID semMapiMutex; /* mutex semaphore */ + int semTimeout; /* semaphore wait time, used by ospf2Mapi task */ + BOOL rebootRouter; /* restart router if true, destroyed MIB API */ + BOOL dynamicConfig; /* true if dynamic configuration is required */ + BOOL dynamicDelete; /* true if dynamic deletion from nvram required */ + + /* system dependent callback functions for saving/retrieving ospf configuration + * to/from nvram + */ + NVRAM_SAVE_FUNCPTR nvmOspfSaveRtn; /* to save configuration to nvram */ + NVRAM_DELETE_FUNCPTR nvmOspfDelRtn; /* to delete a table row from nvram */ + NVRAM_RETRIEVE_FUNCPTR nvmOspfRetrieveRtn; /* to retrieve config from nvram */ + + /* system dependent callback functions for saving/retrieving wrn-ospf enterprise + * mib configuration to/from nvram + */ + NVRAM_SAVE_FUNCPTR nvmWrnOspfSaveRtn; /* to save configuration to nvram */ + NVRAM_DELETE_FUNCPTR nvmWrnOspfDelRtn; /* to delete a table row from nvram */ + NVRAM_RETRIEVE_FUNCPTR nvmWrnOspfRetrieveRtn; /* to retrieve config from nvram */ + + /* system dependent configuration parameters for standard OSPF-MIB */ + int mApiOspfMaxArea; /* max number of instances for ospfAreaTable */ + int mApiOspfMaxStub; /* max number of instances for ospfStubTable */ + int mApiOspfMaxLsdb; /* max number of instances for ospfLsdbTable */ + int mApiOspfMaxHost; /* max number of instances for ospfHostTable */ + int mApiOspfMaxIf; /* max number of instances for ospfIfTable */ + int mApiOspfMaxIfMetric; /* max number of instances for ospfIfMetricTable */ + int mApiOspfMaxVirtIf; /* max number of instances for ospfVirtIfTable */ + int mApiOspfMaxNbr; /* max number of instances for ospfNbrTable */ + int mApiOspfMaxVirtNbr; /* max numbr of instances for ospfVirtNbrTable */ + int mApiOspfMaxExtLsdb; /* max number of instances for ospfExtLsdbTable */ + int mApiOspfMaxAreaAg; /* max number of instances for ospfAreaAggregateTable */ + + /* current system capacities */ + int mApiOspfCurrAreaCnt; /* current number of instances in ospfAreaTable */ + int mApiOspfCurrStubCnt; /* current number of instances in ospfStubTable */ + int mApiOspfCurrLsdbCnt; /* current number of instances in ospfLsdbTable */ + int mApiOspfCurrHostCnt; /* current number of instances in ospfHostTable */ + int mApiOspfCurrIfCnt; /* current number of instances in ospfIfTable */ + int mApiOspfCurrIfMetricCnt; /* current number of instances in ospfIfTable */ + int mApiOspfCurrVirtIfCnt; /* current number of isntances in ospfVirtIfTable */ + int mApiOspfCurrNbrCnt; /* current number of instances in ospfNbrTable */ + int mApiOspfCurrVirtNbrCnt; /* current number of instances in ospfVirtNbrTable */ + int mApiOspfCurrExtLsdbCnt; /* current number of instances in ospfExtLsdbTable */ + int mApiOspfCurrAreaAgCnt; /* current number of instances in ospfAreaAggregateTable */ + + /* interanal operational erros statistics due to max capacity reached */ + int mApiOspfAreaMaxReached; /* max capacility for ospfAreaTable reached */ + int mApiOspfStubMaxReached; /* max capacility for ospfStubTable reached */ + int mApiOspfLsdbMaxReached; /* max capacility for ospfLsdbTable reached */ + int mApiOspfHostMaxReached; /* max capacility for ospfHostTable reached */ + int mApiOspfIfMaxReached; /* max capacility for ospfIfTable reached */ + int mApiOspfIfMetricMaxReached; /* max capacility for ospfIfMetricTable reached */ + int mApiOspfVirtIfMaxReached; /* max capacility for ospfVirtIfTable reached */ + int mApiOspfNbrMaxReached; /* max capacility for ospfNbrTable reached */ + int mApiOspfVirtNbrMaxReached; /* max capacility for ospfVirtNbrTable reached */ + int mApiOspfExtLsdbMaxReached; /* max capacility for ospfExtLsdbTable reached */ + int mApiOspfAreaAgMaxReached; /* max capacility for ospfAreaAggregateTable reached */ + + /* internal operational error statistics due to reasons other than max capacity + * problem (resulted in instance not being created) + */ + int mApiOspfAreaFailedCnt; /* number of creation failure for ospfAreaTable */ + int mApiOspfStubFailedCnt; /* number of creation failure for ospfStubTable */ + int mApiOspfLsdbFailedCnt; /* number of creation failure for ospfLsdbTable */ + int mApiOspfHostFailedCnt; /* number of creation failure for ospfHostTable */ + int mApiOspfIfFailedCnt; /* number of creation failure for ospfIfTable */ + int mApiOspfIfMetricFailedCnt; /* number of creation failure for ospfIfMetricTable */ + int mApiOspfVirtIfFailedCnt; /* number of creation failure for ospfVirtIfTable */ + int mApiOspfNbrFailedCnt; /* number of creation failure for ospfNbrTable */ + int mApiOspfVirtNbrFailedCnt; /* number of creation failure for ospfVirtNbrTable */ + int mApiOspfExtLsdbFailedCnt; /* number of creation failure for ospfExtLsdbTable */ + int mApiOspfAreaAgFailedCnt; /* num of creation failure for ospfAreaAggregateTable */ + + /* OSPF-MIB data strctures */ + void *pMapiOspfGenGroup; /* ospf general group scalar objects */ + + mApiOspfAvlClass_t ospfAreaAvl; /* AVL tree for ospfAreaTable */ + mApiOspfAvlClass_t ospfStubAvl; /* AVL tree for ospfStubTable */ + mApiOspfAvlClass_t ospfLsdbAvl; /* AVL tree for ospfLsdbTable */ + mApiOspfAvlClass_t ospfHostAvl; /* AVL tree for ospfHostTable */ + mApiOspfAvlClass_t ospfIfAvl; /* AVL tree for ospfIfTable */ + mApiOspfAvlClass_t ospfIfMetricAvl; /* AVL tree for ospfIfMetric */ + mApiOspfAvlClass_t ospfVirtIfAvl; /* AVL tree for ospfVirtIfTable */ + mApiOspfAvlClass_t ospfNbrAvl; /* AVL tree for ospfNbrTable */ + mApiOspfAvlClass_t ospfVirtNbrAvl; /* AVL tree for ospfVirtNbrTable */ + mApiOspfAvlClass_t ospfExtLsdbAvl; /* AVL tree for ospfExtLsdbTable */ + mApiOspfAvlClass_t ospfAreaAgAvl; /* AVL tree for ospfAreaAggregateTable */ + + + /* rowStatus library handlers */ + rsParams_t *pMapiOspfAreaRs; /* ospfAreaTable Row Status handler */ + rsParams_t *pMapiOspfStubRs; /* ospfStubTable Row Status handler */ + rsParams_t *pMapiOspfHostRs; /* ospfHostTable Row Status handler */ + rsParams_t *pMapiOspfIfRs; /* ospfIfTable Row Status handler */ + rsParams_t *pMapiOspfIfmRs; /* ospfIfMetricTable Row Status handler */ + rsParams_t *pMapiOspfVirtIfRs; /* ospfVirtIfTable Row Status handler */ + rsParams_t *pMapiOspfNbrRs; /* ospfNbrTable Row Status handler */ + rsParams_t *pMapiOspfAreaAgRs; /* ospfAreaAggregateTable Row Status handler */ + + ulong_t currObjInProcess; /* current varbind to process */ + mApiObject_t *pMapiCurrObj; /* current varbind to process */ + mApiReqType_t currMapiReqType; /* current mApi request type to process */ + + /* system dependent configuration parameters for WRN OSPF Enterprise MIB */ + int mApiWrnOspfMaxArea; /* max number of instances for wrnOspfAreaTable */ + int mApiWrnOspfMaxLsdb; /* max number of instances for wrnOspfLsdbTable */ + int mApiWrnOspfMaxLocalLsdb; /* max number of instances for wrnOspfLocalLsdbTable */ + int mApiWrnOspfMaxExtLsdb; /* max number of instances for wrnOspfExtLsdbTable */ + int mApiWrnOspfMaxIf; /* max number of instances for wrnOspfIfTable */ + int mApiWrnOspfMaxRedistrib; /* max num of instances for wrnOspfRedistributionTable */ + + int mApiWrnOspfMaxOspf2IpRoute; /* max number of instance for wrnOspfToIpRouteTable */ + /* current system capacities */ + int mApiWrnOspfCurrAreaCnt; /* curr. num of instances in wrnOspfAreaTable */ + int mApiWrnOspfCurrLsdbCnt; /* curr. num of instances in wrnOspfLsdbTable */ + int mApiWrnOspfCurrLocalLsdbCnt; /* curr. num of instances in wrnOspfLocalLsdbTable */ + int mApiWrnOspfCurrExtLsdbCnt; /* cur. num of instances in wrnOspfExtLsdbTable */ + int mApiWrnOspfCurrIfCnt; /* curr. number of instances in wrnOspfIfTable */ + int mApiWrnOspfCurrRedistribCnt; /* curr num of instances in wrnOspfRedistributionTable */ + + int mApiWrnOspfCurrOspf2IpRouteCnt; /* curr num of instance in wrnOspfToIpRouteTable */ + /* interanl operational erros statistics due to max capacity reached */ + int mApiWrnOspfAreaMaxReached; /* max for wrnOspfAreaTable reached */ + int mApiWrnOspfLsdbMaxReached; /* max for wrnOspfLsdbTable reached */ + int mApiWrnOspfLocalLsdbMaxReached; /* max for wrnOspfLocalLsdbTable reached */ + int mApiWrnOspfExtLsdMaxReached; /* max for wrnOspfExtTable reached */ + int mApiWrnOspfIfMaxReached; /* max for wrnOspfIfTable reached */ + + int mApiWrnOspfRedistribMaxReached; /* max for wrnOspfRedistributionTable reached */ + int mApiWrnOspf2IpRouteMaxReached; /* max for wrnOspfToIpRouteTable reached */ + /* internal operational error statistics due to reasons other than max capacity + * problem (resulted in instance not being created) + */ + int mApiWrnOspfAreaFailedCnt; /* num of failure for wrnOspfAreaTable */ + int mApiWrnOspfLsdbFailedCnt; /* num of failure for wrnOspfLsdbTable */ + int mApiWrnOspfLocalLsdbFailedCnt; /* num of failure for wrnOspfLocalLsdbTable */ + int mApiWrnOspfExtLsdbFailedCnt; /* number of failure for wrnOspfExtLsdbTable */ + int mApiWrnOspfIfFailedCnt; /* number of failure for wrnOspfIfTable */ + int mApiWrnOspfRedistribFailedCnt; /* num of failure for wrnOspfRedistributionTable */ + int mApiWrnOspf2IpRouteFailedCnt; /* num of failure for wrnOspfToIpRouteTable */ + + void *pMapiWrnOspfGenGroup; /* wrn ospf general group scalar objects */ + + mApiOspfAvlClass_t wrnOspfAreaAvl; /* AVL tree for ospfAreaTable */ + mApiOspfAvlClass_t wrnOspfLsdbAvl; /* AVL tree for ospfLsdbTable */ + mApiOspfAvlClass_t wrnOspfLocalLsdbAvl; /* AVL tree for wrnOspfLocLsdbTable */ + mApiOspfAvlClass_t wrnOspfExtLsdbAvl; /* AVL tree for wrnOspfExtLsdbTable */ + mApiOspfAvlClass_t wrnOspfIfAvl; /* AVL tree for wrnOspfIfTable */ + + mApiOspfAvlClass_t wrnOspfRedistribAvl; /* AVL tree for wrnOspfRedistributionTable */ + mApiOspfAvlClass_t wrnOspf2IpRouteAvl; /* AVL tree for wrnOspfToIpRouteTable */ + /* rowStatus library handlers for wrn-ospf enterprise mib */ + rsParams_t *pMapiWrnOspfIfRs; /* wrnOspfIfTable Row Status handler */ + rsParams_t *pMapiWrnOspfRedistribRs; /* wrnOspfRedistributionTable Row Status handler */ + rsParams_t *pMapiWrnOspfLocalIfRs; /* wrnOspfLocalIfTable Row Status handler */ + rsParams_t *pMapiWrnOspf2IpRouteRs; /* wrnOspfToIpRouteTable Row Status handler */ + + /* number of active area. An area is said to be active if there is at least one + * operational interfaces belonging to the area. If the value is greater than + * one, the router is an area border router + */ + ushort_t numActiveArea; + + /* SNMP TEST/COMMIT/UNDO/COMPLETE counters, for state transition monitoring */ + int mApiTestReqCnt; /* number of SNMP TEST requests processed */ + int mApiCommitReqCnt; /* number of SNMP COMMIT requests processed */ + int mApiUndoReqCnt; /* number of SNMP UNDO requests processed */ + int mApiCompleteReqCnt; /* number of SNMP COMMIT succeed, for debugging */ + int mApiBogusReqCnt; /* number of incorrect SNMP requests, for debugging */ + int mApiTestReqFailedCnt; /* number of SNMP TEST failed, for debugging */ + int mApiCommitReqFailedCnt; /* number of SNMP COMMIT failed, for debugging */ + int mApiNvmSetReqFailedCnt; /* number of MAPI NVM SET failed, for debugging */ + int mApiGetReqFailedCnt; /* number of SNMP GET failed, for debugging */ + int mApiGetNextReqFailedCnt; /* number of SNMP GET_NEXT failed, for debugging */ + int mApiDynConfigReqFailedCnt; /* number of dynamic reconfig failed, for debugging */ + +} mApiOspfClass_t; + +/* global variables */ +mApiOspfClass_t *thisMapi; /* the mib api object */ + +/*************************************************************************************** + * Management Interface Public Macro + */ +#define OSPF_MIB_BUFLEN_CHECK(pRequest, pObject, actualLen) \ + if ( ((pObject)->valueLen < actualLen) || \ + ((pObject)->pValueBuf == NULL) ) \ + { \ + (pObject)->valueLen = actualLen; \ + (pObject)->exception = MAPI_BUFFER_TOO_SHORT; \ + (pRequest)->errorObjIndex = (ushort_t)(pObject)->oidPrefixEnum; \ + (pRequest)->error = (int)0; \ + return OK; \ + } + + +#define OSPF_MIB_ERROR_SET(pRequest, mApiError, oidPrefixEnum) \ + (pRequest)->error = (int)mApiError; \ + (pRequest)->errorObjIndex = (ushort_t)oidPrefixEnum; + +#define OSPF_MIB_EXCEPTION_SET( pObject, mApiException ) \ + (pObject)->exception = mApiException; + + +/**************************************************************************************** +* Management Interface Public Function Prototypes +*/ + +/* OSPF MIB API init/destroy routines */ +IMPORT STATUS ospfMapiInit( NVRAM_SAVE_FUNCPTR nvmOspfSaveRtn, + NVRAM_DELETE_FUNCPTR nvmOspfDelRtn, + NVRAM_RETRIEVE_FUNCPTR nvmOspfRetrieveRtn, + NVRAM_SAVE_FUNCPTR nvmWrnOspfSaveRtn, + NVRAM_DELETE_FUNCPTR nvmWrnOspfDelRtn, + NVRAM_RETRIEVE_FUNCPTR nvmWrnOspfRetrieveRtn + ); + +IMPORT STATUS ospfMapiDestroy( void ); +IMPORT BOOL ospfMapiIsInited( void ); + +/* prototype for retrieving an instance of columnar object from the OSPF-MIB */ + +/* ospfGeneralGroup GET/GET_NEXT and TEST/COMMIT routines */ +IMPORT STATUS ospfMapiGetGenGroup(mApiRequest_t *pRequest, mApiReqType_t reqType); +IMPORT STATUS ospfMapiSetGenGroup(mApiRequest_t *pRequest, mApiReqType_t reqType); + +/* ospfAreaTable GET/GET_NEXT and TEST/COMMIT routines */ +IMPORT STATUS ospfMapiGetArea(mApiRequest_t *pRequest, mApiReqType_t reqType); +IMPORT STATUS ospfMapiSetArea(mApiRequest_t *pRequest, mApiReqType_t reqType); + +/* ospfStubTable GET/GET_NEXT and TEST/COMMIT routines */ +IMPORT STATUS ospfMapiGetStub( mApiRequest_t *pRequest, mApiReqType_t reqType ); +IMPORT STATUS ospfMapiSetStub( mApiRequest_t *pRequest, mApiReqType_t reqType ); + +/* ospfLsdbTable GET/GET_NEXT routine */ +IMPORT STATUS ospfMapiGetLsdb(mApiRequest_t *pRequest, mApiReqType_t reqType); + +/* ospfHostTable GET/GET_NEXT and TEST/COMMIT routines */ +IMPORT STATUS ospfMapiGetHost( mApiRequest_t *pRequest, mApiReqType_t reqType ); +IMPORT STATUS ospfMapiSetHost( mApiRequest_t *pRequest, mApiReqType_t reqType ); + +/* ospfIfTable GET/GET_NEXT and TEST/COMMIT routines */ +IMPORT STATUS ospfMapiGetIf(mApiRequest_t *pRequest, mApiReqType_t reqType); +IMPORT STATUS ospfMapiSetIf( mApiRequest_t *pRequest, mApiReqType_t reqType ); + +/* ospfIfMetricTable GET/GET_NEXT and TEST/COMMIT routines */ +IMPORT STATUS ospfMapiGetIfMetric( mApiRequest_t *pRequest, mApiReqType_t reqType ); +IMPORT STATUS ospfMapiSetIfMetric( mApiRequest_t *pRequest, mApiReqType_t reqType ); + +/* ospfVirtIfTable GET/GET_NEXT and TEST/COMMIT routines */ +IMPORT STATUS ospfMapiGetVirtIf(mApiRequest_t *pRequest, mApiReqType_t reqType); +IMPORT STATUS ospfMapiSetVirtIf( mApiRequest_t *pRequest, mApiReqType_t reqType ); + +/* ospfNbrTable GET/GET_NEXT and TEST/COMMIT routines */ +IMPORT STATUS ospfMapiGetNbr(mApiRequest_t *pRequest, mApiReqType_t reqType); +IMPORT STATUS ospfMapiSetNbr( mApiRequest_t *pRequest, mApiReqType_t reqType ); + +/* ospfVirtNbrTable GET/GET_NEXT routine */ +IMPORT STATUS ospfMapiGetVirtNbr( mApiRequest_t *pRequest, mApiReqType_t reqType ); + +/* ospfExtLsdbTable GET/GET_NEXT routine */ +IMPORT STATUS ospfMapiGetExtLsdb(mApiRequest_t *pRequest, mApiReqType_t reqType); + +/* ospfAreaAggregateTable GET/GET_NEXT and TEST/COMMIT routines */ +IMPORT STATUS ospfMapiGetAreaAggregate( mApiRequest_t *pRequest, mApiReqType_t reqType); +IMPORT STATUS ospfMapiSetAreaAggregate( mApiRequest_t *pRequest, mApiReqType_t reqType); + +/* wrnOspfGeneralGroup GET/GET_NEXT and TEST/COMMIT routines */ +IMPORT STATUS ospfMapiGetWrnGenGroup( mApiRequest_t *pRequest, mApiReqType_t reqType ); +IMPORT STATUS ospfMapiSetWrnGenGroup( mApiRequest_t *pRequest, mApiReqType_t reqType ); + +/* wrnOspfAreaTable GET/GET_NEXT routine */ +IMPORT STATUS ospfMapiGetWrnArea( mApiRequest_t *pRequest, mApiReqType_t reqType ); + +/* wrnOspfLsdbTable GET/GET_NEXT routine */ +IMPORT STATUS ospfMapiGetWrnLsdb(mApiRequest_t *pRequest, mApiReqType_t reqType); + +/* wrnOspfLocalLsdbTable GET/GET_NEXT routine */ +IMPORT STATUS ospfMapiGetWrnLocalLsdb( mApiRequest_t *pRequest, mApiReqType_t reqType ); + +/* wrnOspfExtLsdbTable GET/GET_NEXT routine */ +IMPORT STATUS ospfMapiGetWrnExtLsdb( mApiRequest_t *pRequest, mApiReqType_t reqType ); + +/* wrnOspfIFTable GET/GET_NEXT and TEST/COMMIT routines */ +IMPORT STATUS ospfMapiGetWrnIf( mApiRequest_t *pRequest, mApiReqType_t reqType ); +IMPORT STATUS ospfMapiSetWrnIf( mApiRequest_t *pRequest, mApiReqType_t reqType ); + +/* wrnOspfRedistributionTable GET/GET_NEXT and TEST/COMMIT routines */ +IMPORT STATUS ospfMapiGetWrnRedistrib( mApiRequest_t *pRequest, mApiReqType_t reqType ); +IMPORT STATUS ospfMapiSetWrnRedistrib( mApiRequest_t *pRequest, mApiReqType_t reqType ); + +/* wrnOspfLocalIfTable GET/GET_NEXT and TEST/COMMIT routines */ +IMPORT STATUS ospfMapiGetWrnLocalIf( mApiRequest_t *pRequest, mApiReqType_t reqType ); +IMPORT STATUS ospfMapiSetWrnLocalIf( mApiRequest_t *pRequest, mApiReqType_t reqType ); +IMPORT STATUS ospfMapiGetWrnToIpRoute( mApiRequest_t *pRequest, mApiReqType_t reqType ); +IMPORT STATUS ospfMapiSetWrnToIpRoute( mApiRequest_t *pRequest, mApiReqType_t reqType ); +/* misc conversions routines */ +IMPORT STATUS ospf_rs2mApi_errorGet( void *pObjInfo, int rsError ); +IMPORT STATUS ospf_rs2mApi_reqTypeGet( int rsRequest, mApiReqType_t *mApiReqType); +IMPORT void ospf_mApi_ipAddr2OctetString( ulong_t ipAddr, uchar_t *octetString ); +IMPORT ulong_t ospf_mApi_octetString2IpAddr( uchar_t *octetString ); +IMPORT void ospf_mApi_ipAddr2IpIndex( ulong_t ulIpAddr, ulong_t *pIndex ); +IMPORT ulong_t ospf_mApi_ipIndex2IpAddr( ulong_t *pIndex ); + +/* prototype for OSPF MIB API helper wrapper routine to handle the SET operation */ +IMPORT STATUS ospfMapiSetHelper(); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __INCospf_mib_apih */ diff --git a/h/wrn/ospf/ospf_mib_envoy_api.h b/h/wrn/ospf/ospf_mib_envoy_api.h new file mode 100644 index 0000000..0b65d87 --- /dev/null +++ b/h/wrn/ospf/ospf_mib_envoy_api.h @@ -0,0 +1,137 @@ +/* ospf_mib_envoy_api.h */ + +/* Copyright 1998-2002 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* + * Modification history + * -------------------- + * 01f,07apr04,ram OSPF v2/v3 coexistance compile + * 01e,21may02,kc Added pointer to pObjCookie to envoyRequest_t. + * 01d,24oct01,kc Added mApiOidOffset argument to ospf_envoy_buildSetReq(), + * ospf_envoy_buildGetReq() and ospf_envoy_buildGetResp(). + * 01c,23oct01,kc Changed octetBufLen in envoyRequest_t from ushort_t to ulong_t. + * 01b,22oct01,kc Added ospf_envoy_snmpdTreeAdd() and ospf_envoy_snmpdTreeRemove() + * prototypes. + * 01a,12oct01,kc Initial file creation. + */ + +/* +DESCRIPTION + +This file contains the definitions for constants, data structures and function prototypes +that can be used by the application that need to integrate Envoy SNMP to Manamgenet +Interface implemented the Neutral MIB API +*/ + + +#ifndef __INCospf_mib_envoy_apih +#define __INCospf_mib_envoy_apih + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* OSPF-Envoy debug macro. */ +#undef ospfEnvoyDbgEnabled +#ifdef ospfEnvoyDbgEnabled +#define ospfEnvoyPrintf( _x ) { printf _x; } +#else +#define ospfEnvoyPrintf( _x ) +#endif + +/* OSPF specific MIB API application defined error */ +#define MAPI_INVALID_INSTANCE 10000 + +/* envoyRequest_t structure is data structure that is necessary to manipulate the + * envoy snmp varbinds and the mApiRequest_t data structure. The pValueBuf is a + * pointer to an array of ulong_t. The size of array must be large enough to + * accomodate the getproc, nextproc, testproc, setproc and undoproc requests for + * retrieving all objects from a tabular row in multiple varbinds.. Envoy snmp will + * serialize all the transactions, subsequent getproc, nextproc, testproc, setproc + * and/or undoproc will not be called until the current one is completed. Therefore, + * the pValueBuf pointer can be reused each time a new getproc, nextproc, testproc, + * setproc and/or undoproc is started. The pOctetBuf is a pointer to buffer allocated + * specifically for octet string. For getproc and nextproc, the memory pointed to by the + * pOctetBuf must be either statically or dynamically allocated and the boolean + * flag must be set to TRUE if memory is dynamically allocated. If dynamic memory + * allocation is used, Envoy snmp requires that the memory is allocated using + * SNMP_memory_alloc() and must be marked as dynamic when the getproc_got_string() is + * called so that Envoy SNMP will free the memory using SNMP_memory_free() when the + * packet gets encoded. For that reason, the pOctetBuf pointer can be reused for the next + * transaction after the getproc_got_string() is called. For testproc, setproc and/or + * undoproc, there is no restriction to how the memory must be allocated. However, the + * boolean flag must still be set accordingly. If SNMP_memory_alloc() is used + * to allocated the memory, application must free the memory using SNMP_memory_free() + * when the testproc, setproc and/or undoproc is completed (envoy snmp will not free the + * memory in this case). + */ +typedef struct envoyRequest { + SEM_ID envoyBSem; /* binary semaphore for synchronization into Envoy */ + ulong_t *pValueBuf; /* pointer to array of ulong_t */ + ushort_t numValueBuf; /* number of valueBuf allocated */ + ushort_t bufUsedCnt; /* number of valueBuf used */ + char *pOctetBuf; /* pointer to buffer for octet string */ + ulong_t octetBufLen; /* sizeof data pointed to by pOctetBuf */ + BOOL dynamic; /* is pOctetBuf dynamically allocated? */ + mApiObject_t *pObjectList; /* pointer to array of MIB API objec info */ + ulong_t *pObjCookie; /* pointer to array of ulong_t for object cookie */ +} envoyRequest_t; + + +/* misc covertion routines */ +void ospf_copy_oids( OIDC_T *best_inst, OIDC_T *tlist, int tcount ); +IMPORT ushort_t mApi2EnvoyErrorGet( ushort_t mApiError ); + +/* prototype for adding/removing subtree to SNMP agent MIB tree */ +STATUS ospf_envoy_snmpdTreeAdd( char *pTreeOidStr, MIBNODE_T *pTreeAddr, + SEM_ID ospf_envoyBSem ); +void ospf_envoy_snmpdTreeRemove( char *pTreeOidStr, SEM_ID ospf_envoyBSem ); + + /* prototype for routine to build MIB API TEST/SET/UNDO request message */ +IMPORT int ospf_envoy_buildSetReq( int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp, + envoyRequest_t *pEnvoyReq, mApiRequest_t *pRequest, + mApiReqType_t reqType, int mApiOidOffset ); + +/* prototype for routine to mark a varbind (used by testproc, setproc and undoproc) */ +IMPORT void ospf_envoy_markVarbind( VB_T *vbp, SNMP_PKT_T *pktp, mApiRequest_t *pRequest, + mApiReqType_t reqType ); + +/* prototype for routine to build MIB API GET/GET NEXT request message */ +IMPORT STATUS ospf_envoy_buildGetReq( int tcount, OIDC_T *tlist, VB_T *vbp, + envoyRequest_t *pEnvoyReq, + mApiRequest_t *pRequest, int mApiOidOffset ); + +/* prototype for routine to process MIB API GET/GET NEXT response */ +IMPORT void ospf_envoy_processGetResp( VB_T *vbp, SNMP_PKT_T *pktp, + envoyRequest_t *pEnvoyReq, + mApiRequest_t *pRequest, mApiReqType_t reqType, + int mApiOidOffset ); + +/* prototype for routine to process MIB API GET/GET NEXT response for scalar objects */ +IMPORT void ospf_envoy_processScalarGetResp( VB_T *vbp, SNMP_PKT_T *pktp, + envoyRequest_t *pEnvoyReq, + mApiRequest_t *pRequest, + mApiReqType_t reqType, int mApiOidOffset ); + +/* prototype for misc method routines related to this Envoy Management Facility */ +IMPORT void ospfEnvoy_undo( OIDC_T lastmatch, int tcount, OIDC_T *tlist, + SNMP_PKT_T *pktp, VB_T *vbp ); +IMPORT void ospf_envoy_clearBuffer( envoyRequest_t *pEnvoyReq ); +IMPORT void ospf_envoy_mApiDestroy( envoyRequest_t *pEnvoyReq ); +IMPORT envoyRequest_t *ospf_envoy_mApiInit( int numBuf ); + +/* porototypes for setting snmp errors */ +IMPORT void ospf_envoy_setGenError( SNMP_PKT_T *pktp, VB_T *vbp, mApiReqType_t reqType ); +IMPORT void ospf_envoy_setNoSuchNameError( SNMP_PKT_T *pktp, VB_T *vbp, + mApiReqType_t reqType ); +IMPORT void ospf_envoy_processGetRespError( SNMP_PKT_T *pktp, VB_T *vbp, + mApiReqType_t reqType, int mApiErr ); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __INCospf_mib_envoy_apih */ diff --git a/h/wrn/ospf/ospf_mib_helper.h b/h/wrn/ospf/ospf_mib_helper.h new file mode 100644 index 0000000..11877bd --- /dev/null +++ b/h/wrn/ospf/ospf_mib_helper.h @@ -0,0 +1,807 @@ +/* ospf_mib_helper.h - header file for OSPF-MIB Helper Module */ + +/* Copyright 1998-2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +03d,15dec03,agi propogated latest MIB API fixes +03c,08dec03,agi merged fixes from OSPF 2.1 patch branch +03b,01dec03,agi fixed compile issue +03a,12aug03,agi updated include file list, updated copyright +02m,28may03,kc All defines should appear after the enumerations. +02l,09may03,kc Fixed SPR#88389 - added ospfExtLsdbProtoId to mApiOspfExtLsdb_t. +02k,07feb03,kc Fixed SPR#86144 - removed the mApiReqType_t argument from all the + ospf_mApi_xxxHelperCreate() prototypes. +02j,19nov02,mwv Merge TMS code SPR 84284 +02i,12nov02,kc Added ospf_mApi_nbrHelperDeregister() prototype. +02h,14apr02,kc Renamed EmapiOspfAuthType_simplePasswd mApiOspfAuthType_t to + EmApiOspfAuthType_simplePasswd. +02g,11apr02,kc Added ospf_mApi_ifHelperDelete() and ospf_mApi_areaHelperRegisterIf() + prototypes. +02f,10apr02,kc Added ospf_mApi_avlTreeWalk() prototype and AVL_WALK_FUNC typdedef. +02e,06apr02,kc Added sysIfName, sysIfIndex and sysIfFlags members to mApiOspfIf_t + structure. +02d,28mar02,kc Added oldStatus member to mApiOspfClient_t structure. Also added + numIfAttached, numVirtIfAttached and numHostAttached members to + mApiOspfArea_t structure. +02c,27mar02,kc Changed the createdAs variable type from mApiOspfRowStatus_t to + rsAction_t. +02b,22mar02,kc Removed ospf_mApi_initBackbone() prototype. +02a,09jan02,kc Added host netmask define. +01y,12dec01,kc Added defaultStubMetric to mApiOspfArea_t and defined WindNet OSPF + specific DEFVAL_mApiOspfMetric. +01x,03dec01,kc Redefined ospfVirtNbrTable OID instance length. +01w,29nov01,kc For consistency, renamed OSPF_AREA_AGGREGATE_TABLE_LEN define to + OSPF_AREA_AGGREGATE_INSTANCE_LEN. +01v,28nov01,kc Changed ospfLsdbAdvertisement and ospfExtLsdbAdvertisement from + uchar_t to char. +01u,23oct01,kc Changed ospfLsdbAge, ospfLsdbChecksum, ospfExtLsdbAge, and + ospfExtLsdbChecksum from ushort_t to ulong_t. +01t,21oct01,kc Added ospf_mApi_configurationGet() prototype. +01s,20oct01,kc Added Area Aggregation related prototypes and mApiOspfClient_t. +01r,18oct01,kc Modified arguments for ospfMapiOidCompare() prototype. +01q,14oct01,kc Added createdAs member to mApiOspfArea_t, mApiOspfStub_t, mApiOspfIf_t, + mApiOspfIfMetric_t, mApiOspfVirtIf_t and mApiOspfNbr_t to remove the + chicken and egg problem. +01p,14oct01,kc Added ospf_mApi_nbrHelperRegister() prototype. +01o,13oct01,kc Added defaultMtu, defaultNetmask and defaultMetric to mApiOspfHost_t. +01n,13oct01,kc Added pointer to Type-10 Opaque LSA Area to mApiOspfArea_t. +01m,11oct01,kc Added mApiOspfClientType_t and mApiOspfClient_t (moved from + ospf_mib_api.h). +01l,11oct01,kc Changed isTransitArea in mApiOspfArea_t from BOOL to TrueValue type. +01k,10oct01,kc Added ospf_mApi_nbrHelperSet() prototype. +01j,08oct01,kc Added ospfMapiOidCompare() prototype. +01i,06oct01,kc Added netmask, mtu and default metric to mApiOspfIf_t structure. +01h,05oct01,kc Added ospf_mApi_hostHelperCreate prototype. +01g,04oct01,kc Added ospf_mApi_xxxHelperCreate() prototypes for area, stub area, + interface and virtual interface. +01f,18sep01,kc Changed ospfVirtIfRetransInterval, ospfNbrPriority to ulong_t. +01e,14sep01,kc Added default mtu, netmask and metric to mApiOspfIf_t structure. +01d,12sep01,kc Added listIfAttached to mApiOspfArea_t structure. Also added + listNbrAttached to mApiOspfIf_t structure. +01c,28aug01,kc Added prototypes for TEST/SET routines. +01b,22aug01,kc Added prototypes for GET routines. +01a,16aug01,kc Initial file creation. +*/ + +/* +DESCRIPTION: + +This file defines the RFC1850 MIB specific Manamgenet Interface Local ID enumerations, +the MIB object enumerations, the MIB object sizes and some MIB API helper function +prototypes. + +*/ + +#ifndef __INCospf_mib_helperh +#define __INCospf_mib_helperh + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include + +/**************************************************************************************** +* Management Interface 1-based local ID enumerations for RFC1850 MIB. +*/ +typedef enum { + mApiOspfRouterId = 1, + mApiOspfAdminStat, + mApiOspfVersionNumber, + mApiOspfAreaBdrRtrStatus, + mApiOspfASBdrRtrStatus, + mApiOspfExternLsaCount, + mApiOspfExternLsaCksumSum, + mApiOspfTOSSupport, + mApiOspfOriginateNewLsas, + mApiOspfRxNewLsas, + mApiOspfExtLsdbLimit, + mApiOspfMulticastExtensions, + mApiOspfExitOverflowInterval, + mApiOspfDemandExtensions, + mApiOspfAreaId, /* mApiOspf_t enumeration value = 15 */ + mApiOspfAuthType, + mApiOspfImportAsExtern, + mApiOspfSpfRuns, + mApiOspfAreaBdrRtrCount, + mApiOspfAsBdrRtrCount, + mApiOspfAreaLsaCount, + mApiOspfAreaLsaCksumSum, + mApiOspfAreaSummary, + mApiOspfAreaStatus, + mApiOspfStubAreaId, /* mApiOspf_t enumeration value = 25 */ + mApiOspfStubTOS, + mApiOspfStubMetric, + mApiOspfStubStatus, + mApiOspfStubMetricType, + mApiOspfLsdbAreaId, /* mApiOspf_t enumeration value = 30 */ + mApiOspfLsdbType, + mApiOspfLsdbLsid, + mApiOspfLsdbRouterId, + mApiOspfLsdbSequence, + mApiOspfLsdbAge, + mApiOspfLsdbChecksum, + mApiOspfLsdbAdvertisement, + mApiOspfAreaRangeAreaId, /* mApiOspf_t enumeration value = 38 */ + mApiOspfAreaRangeNet, + mApiOspfAreaRangeMask, + mApiOspfAreaRangeStatus, + mApiOspfAreaRangeEffect, + mApiOspfHostIpAddress, /* mApiOspf_t enumeration value = 43 */ + mApiOspfHostTOS, + mApiOspfHostMetric, + mApiOspfHostStatus, + mApiOspfHostAreaID, + mApiOspfIfIpAddress, /* mApiOspf_t enumeration value = 48 */ + mApiOspfAddressLessIf, + mApiOspfIfAreaId, + mApiOspfIfType, + mApiOspfIfAdminStat, + mApiOspfIfRtrPriority, + mApiOspfIfTransitDelay, + mApiOspfIfRetransInterval, + mApiOspfIfHelloInterval, + mApiOspfIfRtrDeadInterval, + mApiOspfIfPollInterval, + mApiOspfIfState, + mApiOspfIfDesignatedRouter, + mApiOspfIfBackupDesignatedRouter, + mApiOspfIfEvents, + mApiOspfIfAuthKey, + mApiOspfIfStatus, + mApiOspfIfMulticastForwarding, + mApiOspfIfDemand, + mApiOspfIfAuthType, + mApiOspfIfMetricIpAddress, /* mApiOspf_t enumeration value =68 */ + mApiOspfIfMetricAddressLessIf, + mApiOspfIfMetricTOS, + mApiOspfIfMetricValue, + mApiOspfIfMetricStatus, + mApiOspfVirtIfAreaId, /* mApiOspf_t enumeration value = 73 */ + mApiOspfVirtIfNeighbor, + mApiOspfVirtIfTransitDelay, + mApiOspfVirtIfRetransInterval, + mApiOspfVirtIfHelloInterval, + mApiOspfVirtIfRtrDeadInterval, + mApiOspfVirtIfState, + mApiOspfVirtIfEvents, + mApiOspfVirtIfAuthKey, + mApiOspfVirtIfStatus, + mApiOspfVirtIfAuthType, + mApiOspfNbrIpAddr, /* mApiOspf_t enumeration value = 84 */ + mApiOspfNbrAddressLessIndex, + mApiOspfNbrRtrId, + mApiOspfNbrOptions, + mApiOspfNbrPriority, + mApiOspfNbrState, + mApiOspfNbrEvents, + mApiOspfNbrLsRetransQLen, + mApiOspfNbmaNbrStatus, + mApiOspfNbmaNbrPermanence, + mApiOspfNbrHelloSuppressed, + mApiOspfVirtNbrArea, /* mApiOspf_t enumeration value = 95 */ + mApiOspfVirtNbrRtrId, + mApiOspfVirtNbrIpAddr, + mApiOspfVirtNbrOptions, + mApiOspfVirtNbrState, + mApiOspfVirtNbrEvents, + mApiOspfVirtNbrLsRetransQLen, + mApiOspfVirtNbrHelloSuppressed, + mApiOspfExtLsdbType, /* mApiOspf_t enumeration value = 103 */ + mApiOspfExtLsdbLsid, + mApiOspfExtLsdbRouterId, + mApiOspfExtLsdbSequence, + mApiOspfExtLsdbAge, + mApiOspfExtLsdbChecksum, + mApiOspfExtLsdbAdvertisement, + mApiOspfAreaAggregateAreaID, /* mApiOspf_t enumeration value = 110 */ + mApiOspfAreaAggregateLsdbType, + mApiOspfAreaAggregateNet, + mApiOspfAreaAggregateMask, + mApiOspfAreaAggregateStatus, + mApiOspfAreaAggregateEffect, + mApiRfc1850MaxLocalIds /* 115 - Number of objects in rfc1850 */ +} mApiOspf_t; + +/**************************************************************************************** +* Manamgenet Interface RFC1850 MIB object enumerations +*/ +typedef enum { + EmApiOspf_true = 1, + EmApiOspf_false = 2 +} mApiOspfTrueValue_t; + +typedef enum { + EmApiOspf_enabled = 1, + EmApiOspf_disabled = 2 +} mApiOspfStatus_t; + +/* Row Status enumerations. This is the same for all tables with the rowStatus object */ +typedef enum { + EmApiOspfRowStatus_active = 1, + EmApiOspfRowStatus_notInService = 2, + EmApiOspfRowStatus_notReady = 3, + EmApiOspfRowStatus_createAndGo = 4, + EmApiOspfRowStatus_createAndWait = 5, + EmApiOspfRowStatus_destroy = 6 +} mApiOspfRowStatus_t; + +typedef enum { + EmApiOspfImportAsExtern_importExternal = 1, + EmApiOspfImportAsExtern_importNoExternal = 2, + EmApiOspfImportAsExtern_importNssa = 3 +} mApiOspfAreaImportAsType_t; + +typedef enum { + EmApiOspfAreaSummary_noAreaSummary = 1, + EmApiOspfAreaSummary_sendAreaSummary = 2 +} mApiOspfAreaSummary_t; + +typedef enum { + EmApiOspfStubMetricType_mApiOspfMetric = 1, + EmApiOspfStubMetricType_comparableCost = 2, + EmApiOspfStubMetricType_nonComparable = 3 +} mApiOspfStubMetricType_t; + +typedef enum { + EmApiOspfIfState_down = 1, + EmApiOspfIfState_loopback = 2, + EmApiOspfIfState_waiting = 3, + EmApiOspfIfState_pointToPoint = 4, + EmApiOspfIfState_designatedRouter = 5, + EmApiOspfIfState_backupDesignatedRouter = 6, + EmApiOspfIfState_otherDesignatedRouter = 7 +} mApiOspfIfState_t; + +typedef enum { + EmApiOspfIfType_broadcast = 1, + EmApiOspfIfType_nbma = 2, + EmApiOspfIfType_pointToPoint = 3, + EmApiOspfIfType_pointToMultipoint = 5 +} mApiOspfIfType_t; + +typedef enum { + EmApiOspfIfMulticastForwarding_blocked = 1, + EmApiOspfIfMulticastForwarding_multicast = 2, + EmApiOspfIfMulticastForwarding_unicast = 3 +} mApiOspfIfMcastType_t; + +typedef enum { + EmApiOspfVirtIfState_down = 1, + EmApiOspfVirtIfState_pointToPoint = 4 +} mApiOspfVirtIfState_t; + +typedef enum { + EmApiOspfLsdbType_routerLink = 1, + EmApiOspfLsdbType_networkLink = 2, + EmApiOspfLsdbType_summaryLink = 3, + EmApiOspfLsdbType_asSummaryLink = 4, + EmApiOspfLsdbType_asExternalLink = 5, + EmApiOspfLsdbType_multicastLink = 6, + EmApiOspfLsdbType_nssaExternalLink = 7, + EmApiOspfLsdbType_type9 = 9, + EmApiOspfLsdbType_type10 = 10, + EmApiOspfLsdbType_type11 = 11 +} mApiOspfLsdbType_t; + +typedef enum { + EmApiOspfExtLsdbType_asExternalLink = 5 +} mApiOspfExtLsdbType_t; + +typedef enum { + EmApiOspfNbrState_down = 1, + EmApiOspfNbrState_attempt = 2, + EmApiOspfNbrState_init = 3, + EmApiOspfNbrState_twoWay = 4, + EmApiOspfNbrState_exchangeStart = 5, + EmApiOspfNbrState_exchange = 6, + EmApiOspfNbrState_loading = 7, + EmApiOspfNbrState_full = 8 +} mApiOspfNbrState_t; + +typedef enum { + EmApiOspfNbmaNbrPermanence_dynamic = 1, + EmApiOspfNbmaNbrPermanence_permanent = 2 +} mApiOspfNbmaNbrPermanence_t; + +/* supported Authentication Type */ +typedef enum { + EmApiOspfAuthType_none = 0, + EmApiOspfAuthType_simplePasswd = 1, + EmApiOspfAuthType_md5 = 2 +} mApiOspfAuthType_t; + +typedef enum { + EmApiOspfAggregateLsdbType_summaryLink = 3, + EmApiOspfAggregateLsdbType_nssaExternalLink = 7 +} mApiOspfAggregateLsdbType_t; + +typedef enum { + EmApiOspfAggregateEffect_advertiseMatching = 1, + EmApiOspfAggregateEffect_doNotAdvertiseMatching = 2 +} mApiOspfAggregateEffect_t; + + +/* mApiOspfClientType_t enumeration type is used to identify the type of client + * that attaches to the mApiOspfArea_t or mApiOspfIf_t. It is used when + * creating an mApiOspfClient_t node + */ +typedef enum { + EmApiOspfClientType_intf = 1, /* client is physical interface */ + EmApiOspfClientType_vintf = 2, /* client is virtual interface */ + EmApiOspfClientType_host = 3, /* client is host interface */ + EmApiOspfClientType_nbr = 4, /* client is neighbor */ + EmApiOspfClientType_ag /* client is area aggregation */ + +} mApiOspfClientType_t; + + +/*************************************************************************************** + * Management Interface RFC1850 MIB Definitions + */ + +/* OSPF Version Number */ +#define OSPF_VERSION 2 + +/* OSPF Area Backbone, ospfAreaId = 0.0.0.0 */ +#define OSPF_BACKBONE_AREA 00000000L + +/* NOTE: This is an internal define for Virtual Interface, shall not be used by + * application utilizing the MIB API + */ +#define OSPF_VIRTUAL_IF_TYPE 100 + + +#define MIN_OSPF_EXT_LSDB_LIMIT -1L +#define MAX_OSPF_EXT_LSDB_LIMIT 2147483647L +#define MAX_OSPF_EXIT_OVERFLOW_INTERVAL 2147483647L +#define MAX_OSPF_STUB_METRIC 16777215L +#define MIN_OSPF_LSDB_SIZE 1L +#define MAX_OSPF_LSDB_SIZE 65535L +#define MAX_OSPF_PRIORITY 255L +#define MAX_OSPF_POLL_INTERVAL 2147483647L +#define MAX_OSPF_AGE 3600L +#define MIN_OSPF_HELLO_INTERVAL 1L +#define MAX_OSPF_HELLO_INTERVAL 65535L +#define MAX_OSPF_DEAD_INTERVAL 2147483647L +#define MAX_OSPF_AUTH_KEY 256L +#define MAX_OSPF_METRIC_VALUE 65535L +#define MAX_EXTERNAL_LSDB_SIZE 36L + +#define OSPF_AUTH_SIMPLE_SIZE 8 +#define OSPF_AUTH_MD5_SIZE 16 + +/* the following defines provides the number of sub-identifier (the instance length) + * of each table in RFC1850 MIB + */ +#define OSPF_AREA_INSTANCE_LEN 4 +#define OSPF_STUB_INSTANCE_LEN 5 +#define OSPF_LSDB_INSTANCE_LEN 13 +#define OSPF_HOST_INSTANCE_LEN 5 +#define OSPF_INTF_INSTANCE_LEN 5 +#define OSPF_METRIC_INSTANCE_LEN 6 +#define OSPF_VIRT_INTF_INSTANCE_LEN 8 +#define OSPF_NBR_INSTANCE_LEN 5 +#define OSPF_VIRT_NBR_INSTANCE_LEN 8 +#define OSPF_EXT_LSDB_INSTANCE_LEN 9 +#define OSPF_AREA_AGGREGATE_INSTANCE_LEN 13 + +/* RFC1850 MIB default value */ +#define DEFVAL_mApiOspfExtLsdbLimit -1L +#define DEFVAL_mApiOspfExitOverflowInterval 0 + +#define DEFVAL_mApiOspfIfRtrPriority 1 +#define DEFVAL_mApiOspfIfTransitDelay 1 +#define DEFVAL_mApiOspfIfRetransInterval 5 +#define DEFVAL_mApiOspfIfHelloInterval 10 +#define DEFVAL_mApiOspfIfRtrDeadInterval 40 +#define DEFVAL_mApiOspfIfPollInterval 120 + +#define DEFVAL_mApiOspfVirtIfTransitDelay 1 +#define DEFVAL_mApiOspfVirtIfRetransInterval 5 +#define DEFVAL_mApiOspfVirtIfHelloInterval 10 +#define DEFVAL_mApiOspfVirtIfRtrDeadInterval 60 + +#define DEFVAL_mApiHostNetMask 0xFFFFFFFF + +/* WindNet OSPF default value */ +#define DEFVAL_mApiOspfIfType EmApiOspfIfType_broadcast +#define DEFVAL_mApiOspfMetric 1 + + +/**************************************************************************************** + * Mamagement Interface RFC1850 Data Structure. + */ + +/* mApiOspfClient_t is used by mApiOspfArea_t to track instances of interface, + * virtual interface and host interface that are attached to this area. It is also + * used by mApiOspfIf_t to track instances of neighbor that are associated + * with the interface. The mApiOspfRowStatus_t enumeration type is + * only used by mApiOspfArea_t to remember the existing rowStatus of the clients + * before it forces the client to make the rowStatus state transition due to the + * rowStatus changes occur in the mApiOspfArea_t itself + */ +typedef struct mApiOspfClient +{ + NODE node; /* linked list node */ + void *pClient; /* pointer to client data structure */ + int oldStatus; /* previous row stauts of the attached client */ + mApiOspfClientType_t clientType; /* the type of client */ +} mApiOspfClient_t; + + +/* OSPF General Group variables + * NOTE: + * - RFC2178 only supports TOS 0. Thus the ospfTOSSupport scalar object is implemented + * as read-only and its value is always set to TRUE + * - ospfExitOverflowInterval and ospfExtLsdbLimit scalar objects are implemented as + * read-write if and only if the __DBASE_OVERFLOW_SUPPORT__ compiler preprocessor + * is turned on. Otherwise, these scalars will be implemented as read-only + */ +typedef struct mApiOspfGenGroup +{ + ulong_t ospfRouterId; /* read-write */ + mApiOspfStatus_t ospfAdminStat; /* read-write */ + ulong_t ospfVersionNumber; /* read-only */ + mApiOspfTrueValue_t ospfAreaBdrRtrStatus; /* read-only */ + mApiOspfTrueValue_t ospfASBdrRtrStatus; /* read-write */ + ulong_t ospfExternLsaCount; /* read-only */ + ulong_t ospfExternLsaCksumSum; /* read-only */ + mApiOspfTrueValue_t ospfTOSSupport; /* read-write, implemented as read-only */ + ulong_t ospfOriginateNewLsas; /* read-only */ + ulong_t ospfRxNewLsas; /* read-only */ + long ospfExtLsdbLimit; /* read-write */ + ulong_t ospfExitOverflowInterval; /* read-write */ + + /* the following read-write objects are implemented as read-only */ + ulong_t ospfMulticastExtensions; + mApiOspfTrueValue_t ospfDemandExtensions; +} mApiOspfGenGroup_t; + +/* an instance of mApiOspfAreaClass_t object will always be created each time a new + * OSPF Area is added to the Management Database. + */ +typedef struct mApiOspfArea +{ + AVL_NODE node; /* AVL Tree node */ + void *pSpfStub; /* pointer to the stub associate with this area */ + LIST listIfAttached; /* If clients attached, unsorted */ + LIST listAreaAggregate; /* Area Aggregate instances */ + + ulong_t defaultStubMetric; /* default stub metric */ + ushort_t numActiveIf; /* number of active interface attached */ + ushort_t numActiveVirtIf; /* number of active virtual interface attached */ + ushort_t numPassiveIf; /* numbe of passive interfaces */ + ushort_t numActiveHost; /* number of active host interface attached */ + ushort_t numIfAttached; /* number of interface instances attached */ + ushort_t numVirtIfAttached; /* number of virtual interface instances attached */ + ushort_t numHostAttached; /* number of host interface instances attached */ + ushort_t numAgAttached; /* number of area aggregate instances attached */ + rsAction_t createdAs; /* the method this row is created */ + mApiOspfTrueValue_t isTransitArea; /* TRUE if this is a transit area */ + void *pOpaqueArea; /* Type-10 Opaque LSA Area */ + + /* objects associate with the ospfAreaTable */ + /* NOTE: ospfAuthType has been obsolete, thus not implemented */ + ulong_t ospfAreaId; /* index object, read-only */ + ulong_t ospfSpfRuns; /* read-only */ + ulong_t ospfAreaBdrRtrCount; /* read-only */ + ulong_t ospfAsBdrRtrCount; /* read-only */ + ulong_t ospfAreaLsaCount; /* read-only */ + ulong_t ospfAreaLsaCksumSum; /* read-only */ + mApiOspfAreaImportAsType_t ospfImportAsExtern; /* read-create */ + mApiOspfAreaSummary_t ospfAreaSummary; /* read-create */ + mApiOspfRowStatus_t ospfAreaStatus; /* read-create */ +} mApiOspfArea_t; + +/* objects associate with the ospfStubTable */ +typedef struct mApiOspfStub +{ + AVL_NODE node; /* AVL Tree node */ + void *pArea; /* pointer to area associated with this stub */ + rsAction_t createdAs; /* the method this row is created */ + + ulong_t ospfStubAreaId; /* index object, read-only */ + ulong_t ospfStubTOS; /* index object, read-only */ + ulong_t ospfStubMetric; /* read-create */ + mApiOspfRowStatus_t ospfStubStatus; /* read-create */ + mApiOspfStubMetricType_t ospfStubMetricType; /* read-create */ +} mApiOspfStub_t; + +/* objects associate with the ospfLsdbTable */ +typedef struct mApiOspfLsdb +{ + AVL_NODE node; /* AVL Tree node */ + ulong_t ospfLsdbAreaId; /* index object, read-only */ + mApiOspfLsdbType_t ospfLsdbType; /* index object, read-only */ + ulong_t ospfLsdbLsid; /* index object, read-only */ + ulong_t ospfLsdbRouterId; /* index object, read-only */ + long ospfLsdbSequence; /* read-only */ + ulong_t ospfLsdbAge; /* read-only */ + ulong_t ospfLsdbChecksum; /* read-only */ + char *ospfLsdbAdvertisement; /* read-only */ + ushort_t lsdbLen; /* advertisement length, not a MIB object */ +} mApiOspfLsdb_t; + +/* objects associate with the ospfHostTable */ +typedef struct mApiOspfHost +{ + AVL_NODE node; /* AVL Tree node */ + ulong_t defaultMtu; /* default mtu from in_ifaddr structure */ + ulong_t defaultNetmask; /* default netmask from in_ifaddr structure */ + ulong_t defaultMetric; /* default metric from in_ifaddr structure */ + rsAction_t createdAs; /* the method this row is created */ + void *pArea; /* area associated with this interface */ + + ulong_t ospfHostIpAddress; /* index object, read-only */ + ulong_t ospfHostTOS; /* index object, read-only */ + ulong_t ospfHostMetric; /* read-create */ + mApiOspfRowStatus_t ospfHostStatus; /* read-create */ + ulong_t ospfHostAreaId; /* read-only */ +} mApiOspfHost_t; + +/* objects associate with the ospfIfMetricTable */ +typedef struct mApiOspfIfMetric +{ + AVL_NODE node; /* AVL Tree node */ + void *pIf; /* interface associated with this metric */ + rsAction_t createdAs; /* the method this row is created */ + + ulong_t ospfIfMetricIpAddress; /* index object, read-only */ + ulong_t ospfIfMetricAddressLessIf; /* index object, read-only */ + ulong_t ospfIfMetricTOS; /* index object, read-only */ + ulong_t ospfIfMetricValue; /* read-create */ + mApiOspfRowStatus_t ospfIfMetricStatus; /* read-create */ +} mApiOspfIfMetric_t; + +typedef struct mApiOspfCryptKey +{ + uchar_t authKeyId; + uchar_t authKey[OSPF_AUTH_MD5_SIZE+1]; + uchar_t authLen; /* md5 authKey length, not including the key id */ +} mApiOspfCryptKey_t; + + +/* objects associate with the ospfIfTable */ +typedef struct mApiOspfIf +{ + AVL_NODE node; /* AVL Tree node */ + LIST listNbrAttached; /* neighbors attached to this interface, unsorted */ + ushort_t numNbrAttached; /* number of neighbors attached to this interface */ + ulong_t defaultMtu; /* default mtu from in_ifaddr structure */ + ulong_t defaultNetmask; /* default netmask from in_ifaddr structure */ + ulong_t defaultMetric; /* default metric from in_ifaddr structure */ + rsAction_t createdAs; /* the method this row is created */ + + void *pIfMetric; /* metric associate with this interface */ + void *pArea; /* pointer to area this interface connects */ + char sysIfName[IFNAMSIZ]; /* interface name, e.g. `en'' or ``lo'' */ + ushort_t sysIfIndex; /* numeric abbreviation for this interface */ + int sysIfFlags; /* interface flags */ + + ulong_t ospfIfIpAddress; /* index object, read-only */ + ulong_t ospfAddressLessIf; /* index object, read-only */ + ulong_t ospfIfAreaId; /* read-create */ + mApiOspfIfType_t ospfIfType; /* read-create */ + mApiOspfStatus_t ospfIfAdminStat; /* read-create */ + ulong_t ospfIfRtrPriority; /* read-create */ + ulong_t ospfIfTransitDelay; /* read-create */ + ulong_t ospfIfRetransInterval; /* read-create */ + ulong_t ospfIfHelloInterval; /* read-create */ + ulong_t ospfIfRtrDeadInterval; /* read-create */ + ulong_t ospfIfPollInterval; /* read-create */ + mApiOspfIfState_t ospfIfState; /* read-only */ + ulong_t ospfIfDesignatedRouter; /* read-only */ + ulong_t ospfIfBackupDesignatedRouter; /* read-only */ + ulong_t ospfIfEvents; /* read-only */ + mApiOspfAuthType_t ospfIfAuthType; /* read-create */ + mApiOspfRowStatus_t ospfIfStatus; /* read-create */ + mApiOspfTrueValue_t wrnOspfLocalIfPassive; + + /* read-create ospfIfAuthKey */ + uchar_t ospfIfSimpleAuthKey[OSPF_AUTH_SIMPLE_SIZE +1]; + mApiOspfCryptKey_t ospfIfMd5AuthKey; + ulong_t authKeyLen; /* simple authKey length, not a MIB object */ + + /* the following read-create objects are implemented as read-only */ + mApiOspfIfMcastType_t ospfIfMulticastForwarding; + mApiOspfTrueValue_t ospfIfDemand; +} mApiOspfIf_t; + +/* objects associate with the ospfVirtIfTable */ +typedef struct mApiOspfVirtIf +{ + AVL_NODE node; /* AVL Tree node */ + void *pArea; /* pointer to transit area */ + rsAction_t createdAs; /* the method this row is created */ + + ulong_t ospfVirtIfAreaId; /* index object, read-only */ + ulong_t ospfVirtIfNeighbor; /* index object, read-only */ + ulong_t ospfVirtIfTransitDelay; /* read-create */ + ulong_t ospfVirtIfRetransInterval; /* read-create */ + ulong_t ospfVirtIfHelloInterval; /* read-create */ + ulong_t ospfVirtIfRtrDeadInterval; /* read-create */ + mApiOspfVirtIfState_t ospfVirtIfState; /* read-only */ + ulong_t ospfVirtIfEvents; /* read-only */ + mApiOspfAuthType_t ospfVirtIfAuthType; /* read-create */ + mApiOspfRowStatus_t ospfVirtIfStatus; /* read-create */ + + /* read-create ospfVirtIfAuthKey */ + uchar_t ospfVirtIfSimpleAuthKey[OSPF_AUTH_SIMPLE_SIZE+1]; + mApiOspfCryptKey_t ospfVirtIfMd5AuthKey; + ulong_t authKeyLen; /* simple authKey length, not a MIB object */ +} mApiOspfVirtIf_t; + + +/* objects associate with the ospfNbrTable */ +typedef struct mApiOspfNbr +{ + AVL_NODE node; /* AVL Tree node */ + void *pIf; /* interface associated with */ + rsAction_t createdAs; /* the method this row is created */ + + ulong_t ospfNbrIpAddr; /* index object, read-only */ + ulong_t ospfNbrAddressLessIndex; /* index object, read-only */ + ulong_t ospfNbrRtrId; /* read-only */ + ulong_t ospfNbrOptions; /* read-only */ + ulong_t ospfNbrPriority; /* read-create */ + mApiOspfNbrState_t ospfNbrState; /* read-only */ + ulong_t ospfNbrEvents; /* read-only */ + ulong_t ospfNbrLsRetransQLen; /* read-only */ + mApiOspfRowStatus_t ospfNbmaNbrStatus; /* read-create */ + mApiOspfNbmaNbrPermanence_t ospfNbmaNbrPermanence; /* read-only */ + mApiOspfTrueValue_t ospfNbrHelloSuppressed; /* read-only */ +} mApiOspfNbr_t; + +/* objects associate with the ospfVirtNbrTable */ +typedef struct mApiOspfVirtNbr +{ + AVL_NODE node; /* AVL Tree node */ + ulong_t ospfVirtNbrArea; /* index object, read-only */ + ulong_t ospfVirtNbrRtrId; /* index object, read-only */ + ulong_t ospfVirtNbrIpAddr; /* read-only */ + ulong_t ospfVirtNbrOptions; /* read-only */ + mApiOspfNbrState_t ospfVirtNbrState; /* read-only */ + ulong_t ospfVirtNbrEvents; /* read-only */ + ulong_t ospfVirtNbrLsRetransQLen; /* read-only */ + mApiOspfTrueValue_t ospfVirtNbrHelloSuppressed; /* read-only */ +} mApiOspfVirtNbr_t; + +/* objects associate with the ospfExtLsdbTable */ +typedef struct mApiOspfExtLsdb +{ + AVL_NODE node; /* AVL Tree node */ + mApiOspfExtLsdbType_t ospfExtLsdbType; /* index object, read-only */ + ulong_t ospfExtLsdbLsid; /* index object, read-only */ + ulong_t ospfExtLsdbRouterId; /* index object, read-only */ + ulong_t ospfExtLsdbSequence; /* read-only */ + ulong_t ospfExtLsdbAge; /* read-only */ + ulong_t ospfExtLsdbChecksum; /* read-only */ + ulong_t ospfExtLsdbProtoId; /* route protocol ID, interanl use */ + char ospfExtLsdbAdvertisement[MAX_EXTERNAL_LSDB_SIZE]; /* read-only */ + ushort_t lsdbLen; /* length of ospfExtLsdbAdvertisement */ +} mApiOspfExtLsdb_t; + +/* objects associate with the ospfAreaAggregateTable */ +typedef struct mApiOspfAreaAggregate +{ + AVL_NODE node; /* AVL Tree node */ + void *pArea; /* area associated with */ + rsAction_t createdAs; /* the method this row is created */ + + ulong_t ospfAreaAggregateAreaID; /* index object, read-only */ + mApiOspfAggregateLsdbType_t ospfAreaAggregateLsdbType; /* index object, read-only */ + ulong_t ospfAreaAggregateNet; /* index object, read-only */ + ulong_t ospfAreaAggregateMask; /* index object, read-only */ + mApiOspfRowStatus_t ospfAreaAggregateStatus; /* read-create */ + mApiOspfAggregateEffect_t ospfAreaAggregateEffect; /* read-create */ +} mApiOspfAreaAggregate_t; + + +/* function pointer requires by ospf_mApi_avlTreeWalk() routine */ +typedef STATUS (* AVL_WALK_FUNC)(void *pNode, void *arg); + +/*************************************************************************************** + * Public Function Prototypes for Management Interface + */ + +/* ospfGeneralGroup helper routines */ +IMPORT STATUS ospf_mApi_globalParmGet(mApiOspfGenGroup_t *thisGenGroup, + mApiRequest_t *pRequest, mApiObject_t *pObject); +IMPORT STATUS ospf_mApi_globalParmSet(mApiRequest_t *pRequest, mApiObject_t *pObject, + mApiReqType_t reqType); + +/* ospfAreaTable helper routines */ +IMPORT STATUS ospf_mApi_areaHelperGet( void *pRow, mApiRequest_t *pRequest, + mApiObject_t *pObject ); +IMPORT STATUS ospf_mApi_areaHelperSet(mApiRequest_t *pRequest, rsRequest_t rsReqType ); +IMPORT STATUS ospf_mApi_areaHelperRegisterIf( mApiOspfIf_t *pIf, int oldStatus ); + +/* ospfStubTable helper routines */ +IMPORT STATUS ospf_mApi_stubHelperGet( void *pRow, mApiRequest_t *pRequest, + mApiObject_t *pObject ); +IMPORT STATUS ospf_mApi_stubHelperSet( mApiRequest_t *pRequest, rsRequest_t rsReqType ); + +/* ospfLasbTable helper routine */ +IMPORT STATUS ospf_mApi_lsdbHelperGet( void *pRow, mApiRequest_t *pRequest, + mApiObject_t *pObject ); + +/* ospfHostTable helper functions */ +IMPORT STATUS ospf_mApi_hostHelperGet( void *pRow, mApiRequest_t *pRequest, + mApiObject_t *pObject ); +IMPORT STATUS ospf_mApi_hostHelperSet( mApiRequest_t *pRequest, rsRequest_t rsReqType ); + +/* ospfIfTable helper routines */ +IMPORT STATUS ospf_mApi_ifHelperGet( void *pRow, mApiRequest_t *pRequest, + mApiObject_t *pObject ); +IMPORT STATUS ospf_mApi_ifHelperSet(mApiRequest_t *pRequest, rsRequest_t rsReqType ); +IMPORT void ospf_mApi_ifHelperDelete( ulong_t ospfIfIpAddr, ulong_t ospfAddrLessIf ); + +/* ospfIfMetricTable helper functions */ +IMPORT STATUS ospf_mApi_ifMetricHelperGet( void *pRow, mApiRequest_t *pRequest, + mApiObject_t *pObject ); +IMPORT STATUS ospf_mApi_ifMetricHelperSet( mApiRequest_t *pRequest, rsRequest_t rsReqType ); + +/* ospfVirtIfTable helper routines */ +IMPORT STATUS ospf_mApi_virtIfHelperGet( void *pRow, mApiRequest_t *pRequest, + mApiObject_t *pObject ); +IMPORT STATUS ospf_mApi_virtIfHelperSet( mApiRequest_t *pRequest, rsRequest_t rsReqType ); + +/* ospfNbrTable helper routines */ +IMPORT STATUS ospf_mApi_nbrHelperGet( void *pRow, mApiRequest_t *pRequest, + mApiObject_t *pObject ); +IMPORT STATUS ospf_mApi_nbrHelperSet( mApiRequest_t *pRequest, rsRequest_t rsReqType ); +IMPORT STATUS ospf_mApi_nbrHelperRegister( mApiOspfNbr_t *pNbr, ulong_t ifIpAddress, + ulong_t ifIndex ); +IMPORT void ospf_mApi_nbrHelperDeregister( mApiOspfNbr_t *pNbr, ulong_t ifIpAddress, + ulong_t ifIndex ); + +/* ospfVirtNbrTable helper routines */ +IMPORT STATUS ospf_mApi_virtNbrHelperGet( void *pRow, mApiRequest_t *pRequest, + mApiObject_t *pObject ); + +/* ospfExtLsdbTable helper routines */ +IMPORT STATUS ospf_mApi_extLsdbHelperGet(void *pRow, mApiRequest_t *pRequest, + mApiObject_t *pObject); + +/* ospfAreaAggregateTable helper routines */ +IMPORT STATUS ospf_mApi_areaAggregateHelperGet( void *pRow, mApiRequest_t *pRequest, + mApiObject_t *pObject ); +IMPORT STATUS ospf_mApi_areaAggregateHelperSet( mApiRequest_t *pRequest, + rsRequest_t rsReqType ); + +/* common AVL compare routine */ +IMPORT int ospfMapiOidCompare( int oidLength, ulong_t *pOid1, ulong_t *pOid2 ); + +/* misc AVL routines */ +IMPORT STATUS ospf_mApi_avlTreeWalk( AVL_TREE * pRoot, AVL_WALK_FUNC ospfMapiTreeWalk, + void *arg ); + +/* rfc1850-specific helper initialization routine */ +IMPORT STATUS ospf_mApi_configurationGet( void ); +IMPORT void ospf_mApi_reset( void ); +IMPORT void ospf_mApi_initGeneralGroup( BOOL resetAllToDefault ); +IMPORT STATUS ospf_mApi_initRsLib(void); +IMPORT STATUS ospf_mApi_initAvlTree(void); + +/*************************************************************************************** + * Function Prototypes for Management Interface for Public Routines that will + * eventually be obsoleted. Third party applications that needs to integrate to + * MIB API must not use the following routines. + */ +IMPORT void ospf_mApi_areaHelperCreate( mApiOspfArea_t *pStaticArea ); +IMPORT void ospf_mApi_stubHelperCreate( mApiOspfStub_t *pStaticStub ); +IMPORT void ospf_mApi_hostHelperCreate( mApiOspfHost_t *pStaticHost ); +IMPORT void ospf_mApi_ifHelperCreate( mApiOspfIf_t *pStaticIf ); +IMPORT void ospf_mApi_ifMetricHelperCreate( mApiOspfIfMetric_t *pStaticIfm ); +IMPORT void ospf_mApi_virtIfHelperCreate( mApiOspfVirtIf_t *pStaticVirtIf ); +IMPORT void ospf_mApi_areaAggregateHelperCreate( mApiOspfAreaAggregate_t *pStaticAreaAg ); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCospf_mib_helperh */ diff --git a/h/wrn/ospf/ospf_mib_helper_show.h b/h/wrn/ospf/ospf_mib_helper_show.h new file mode 100644 index 0000000..0d3412c --- /dev/null +++ b/h/wrn/ospf/ospf_mib_helper_show.h @@ -0,0 +1,182 @@ +/* ospf_mib_helper_show.h - header file for OSPF MIB API show facility */ + +/* Copyright 1998-2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +02d,07jul04,kc SPR 99485, Renamed the "status" display string to "adminStatus. +02c,17dec03,agi propogated weighted routes fixes +02b,10dec03,agi added missing imports +02a,10dec03,agi merged fixes from OSPF 2.1 patch branch + added WRS copyright +01g,27oct03,kc Fixed SPR#91541 - added wrnOspfToIpRouteTable support. +01f,13jun03,kc Fixed SPR#85532 - added wrnOspfLocalIfTable support. +01e,06may03,mwv Fixed SPR#88210 - moved all mib display strings to + ospf_mib_helper_show.c and added import statements for those + display string here to resolve linker errors when including + ospf_mib_helper_show.h from multiple files. +01e,23may03,kc SPR#88863 - added wrnOspfRedistributionTable support. +01d,06may03,mwv Fixed SPR#88210 - moved all mib display strings to + ospf_mib_helper_show.c and added import statements for those + display string here to resolve linker errors when including + ospf_mib_helper_show.h from multiple files. +01c,05feb03,kc Fixed SPR#85806 - added prototypes for mib api show routines. +01b,12nov02,mwv Fixed SPR 83797 - correct the display string for OSPF LSDB type +01a,01dec01,kc Initial file created +*/ + +/* +DESCRIPTION + +This file contains the dispaly string used by ospf_mib_mapi_show.c when +formatting the output. +*/ + +#ifndef _INCospf_mib_helper_showh +#define _INCospf_mib_helper_showh + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* row status display strings */ +IMPORT char *rowStatus[]; + +/* true value display strings */ +IMPORT char *trueValue[]; + +/* status display strings */ +IMPORT char *adminStatus[]; + +/* display strings for authentication type */ +IMPORT char *authType[]; + +/* display strings for interface state type */ +IMPORT char *ifState[]; + +/* display strings for OSPF interface type */ +IMPORT char *ifType[]; + +/* display strings for OSPF LSDB type */ +IMPORT char *lsdbType[]; + +/* display strings for OSPF Neighbor state */ +IMPORT char *nbrState[]; + +/* display strings for OSPF AS Type state */ +IMPORT char *asType[]; + +/* display strings for OSPF Area Summary option */ +IMPORT char *summaryType[]; + +/* display strings for OSPF Stub Metric Type */ +IMPORT char *stubMetricType[]; + +/* display strings for OSPF Interface multicast option */ +IMPORT char *mcastType[]; + +/* display strings for OSPF Neighbor Discovery method */ +IMPORT char *permanence[]; + +/* display strings for OSPF AS-External LSA */ +IMPORT char *extType; + +/* display strings for OSPF Address Aggregate type */ +IMPORT char *agType[]; + +/* display strings for OSPF Area Aggregate Effect */ +IMPORT char *agEffect[]; + +/* display string for Opque LSA type */ +IMPORT char *opaqueLsa[]; + +/* display string for M2 route proto type */ +IMPORT char *extLsdbM2ProtoId[]; + +/* display string for OSPF Redistribution route type */ +IMPORT char *redistribRouteType[]; + +/* display string for OSPF Redistribution metric type */ +IMPORT char *redistribType[]; + + +/* prototypes for mib api show routines (for debugging and diagnostic purposes) */ + +/* display configurations and statistics for Management Interface */ +IMPORT STATUS ospfMapiShow( void ); + +/* displays operational error statistics for Management Interface */ +IMPORT STATUS ospfMapiErrorShow( void ); + +/* display the OSPF MIB General Group Parameters */ +IMPORT STATUS ospfMapiGenGroupShow( void ); + +/* displays all area instance */ +IMPORT STATUS ospfMapiAreaShow( void ); + +/* displays all stub area instances */ +IMPORT STATUS ospfMapiStubShow( void ); + +/* displays all link state database instances (except external link state database) */ +IMPORT STATUS ospfMapiLsdbShow( void ); + +/* displays all host interface instances */ +IMPORT STATUS ospfMapiHostShow( void ); + +/* displays all interface instance */ +IMPORT STATUS ospfMapiIfShow( void ); + +/* displays all interface metric instances */ +IMPORT STATUS ospfMapiIfMetricShow( void ); + +/* displays all virtual interfaces instances */ +IMPORT STATUS ospfMapiVirtIfShow( void ); + +/* displays all neighbor instances */ +IMPORT STATUS ospfMapiNbrShow( void ); + +/* displays all virtual neighbor instances */ +IMPORT STATUS ospfMapiVirtNbrShow( void ); + +/* displays all external link state database instances */ +IMPORT STATUS ospfMapiExtLsdbShow( void ); + +/* displays all area aggregate instances */ +IMPORT STATUS ospfMapiAreaAggregateShow( void ); + +/* displays the WRN-OSPF Enterprise MIB General Group Parameters */ +IMPORT STATUS ospfMapiWrnGenGroupShow( void ); + +/* displays information for Type-10 Opaque link state database for area */ +IMPORT STATUS ospfMapiWrnAreaShow( void ); + +/* displays all Type-10 Opaque link state database instances */ +IMPORT STATUS ospfMapiType10LsaShow( void ); +IMPORT STATUS ospfMapiWrnLsdbShow( void ); + +/* displays all Type-9 Opaque link state database instances */ +IMPORT STATUS ospfMapiType9LsaShow( void ); +IMPORT STATUS ospfMapiWrnLocalLsdbShow( void ); + +/* displays all Type-11 Opaque link state database instances */ +IMPORT STATUS ospfMapiType11LsaShow( void ); +IMPORT STATUS ospfMapiWrnExtLsdbShow( void ); + +/* displays all interfaces connected to an area */ +IMPORT STATUS ospfMapiAreaIfShow( void ); + +/* displays the interface information maintained by OSPF MIB API */ +IMPORT STATUS ospfMapiIfConfigShow( void ); + +/* display all the OSPF redistribution configuration */ +IMPORT STATUS ospfMapiWrnRedistributionShow( void ); + +IMPORT STATUS ospfMapiWrnToIpRouteShow( void ); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _INCospf_mib_helper_showh */ diff --git a/h/wrn/ospf/ospf_mib_helper_update.h b/h/wrn/ospf/ospf_mib_helper_update.h new file mode 100644 index 0000000..48d9f3c --- /dev/null +++ b/h/wrn/ospf/ospf_mib_helper_update.h @@ -0,0 +1,640 @@ +/* ospf_mib_helper_update.h - helper routines for OSPF MIB API */ + +/* Copyright 1998-2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +03l,07jan05,xli porting external route redistribution feature from ospf2.3.1 +03a,08dec03,agi merged fixes from OSPF 2.1 patch branch +02l,31oct03,kc Fixed SPR#91541 - added wrnOspf2IpRoutePolicyCreateReqType to + support wrnOspfToIpRouteTable configuration. +02k,16jun03,kc Fixed SPR#85532 - modified valueBuf 12-14 for ospfIfCreateReqType. + Obsolete ospfIfStatus and added wrnOspfLocalIfPassive to valueBuf. +02j,12jun03,kc Fixed SPR#88863 - added wrnOspfRedistribXxxCreateReqType, + mApi2Ospf_configRedistrib() and mApi2Ospf_deleteRedistrib() + prototypes to support wrnOspfRedistributionTable configuration. +02l,17jul03,kc Fixed SPR#88975 - added ospf2Mapi_shutdown() prototype. +02k,12jun03,kc Fixed SPR#88863 - added wrnOspfRedistribXxxCreateReqType, + mApi2Ospf_configRedistrib() and mApi2Ospf_deleteRedistrib() + prototypes to support wrnOspfRedistributionTable configuration. +02j,12jun03,kc Fixed SPR#88975 - added ospf2Mapi_shutdown() prototype. +02i,26may03,kc Fixed SPR#87790 - removed ospfShutdownReqType ospf2MapiReqType_t. +02h,25may02,kc Fixed PR #2700 - Added ospfIfDeleteReqType ospf2MapiReqType_t. +02g.25may02.kc Fixed PR #2767- Added ospfIfChangeReqType ospf2MapiReqType_t. Also + added ospf2MapiSysCtl_t data structure. +02f,09may03,kc Fixed SPR#88389 - modified doc for ospfExtLsdbCreateReqType - + added route protocol ID. +02e,25apr03,kc Fixed SPR#87790 - removed ospfShutdownReqType ospf2MapiReqType_t. +02d,18apr02,kc Removed ospf2Mapi_destroy() prototype. +02c,04apr02,kc Modified doc for ospfGenGroupUpdateReqType request type - no longer + include the ABR status. +02b,24mar02,kc Changed ospf2Mapi_proto_register() return type from void to STATUS. +02a,15feb02,kc Added wrnOspfIfCreateReqType ospf2MapiReqType_t. +01z,04feb02,kc Update doc for ospfGenGroupCreateReqType request type. +01y,16jan02,kc Added ospfLsdbCreateReqType,ospfExtLsdbCreateReqType, + wrnOspfLsdbCreateReqType, wrnOspfLocalLsdbCreateReqType, and + wrnOspfExtLsdbCreateReqType ospf2MapiReqType_t. +01x,26dec01,kc Update doc for ospfNbrUpdateReqType request type. +01w,19dec01,kc Redefined ospf2Mapi_proto_register() prototype. Moved ospfProtoType_t + enums to ospf_mib_api.h. +01v,28nov01,kc Changed pValueBuf poiner type from uchar_t to char. +01u,21oct01,kc Added ospfShutdownReqType ospf2MapiReqType_t. +01t,21oct01,kc Modified NVRAM_DELETE_FUNCPTR arguments. +01s,21oct01,kc Modified arguments for ospf2Mapi_proto_register() prototype. Added + ospf2Mapi_proto_deregister() prototype. +01r,20oct01,kc Added Area Aggregation relation prototypes and ospf2MapiReqType_t. +01q,19oct01,kc Added __OPAQUE_LSA__ preproc. +01p,17oct01,kc Added ospfProtoType_t enumeration values. +01o,16oct01,kc Removed __WRN_OSPF_MIB__ preproc. +01n,13oct01,kc Added more valueBuf[] explanations for ospfHostCreateReqType. +01m,13oct01,kc Added ospf2MapiReqBuf_t structure def. (moved from ospf_mApi_helper.c) +01l,10oct01,kc Added mApi2Ospf_configNbr() and mApi2Ospf_deletexxx() prototypes. +01k,08oct01,kc Removed *arg argument from ospf2Mapi_request() prototype. +01j,07oct01,kc Added support for WRN-OSPF MIB enumeration types. +01i,07oct01,kc Added NVRAM_SAVE_FUNCPTR and NVRAM_RETRIEVE_FUNCPTR typedefs. +01h,07oct01,kc Added ospf2Mapi_destroy() prototype. +01g,06oct01,kc Removed ospfHostUpdateReqType ospf2MapiReqType_t since there is + nothing to update for ospfHostTable. +01f,04oct01,kc Added protypes for ospf2Mapi_xxx_create() +01e,20sep01,kc Added numOspfReqBufCnt argument to ospf2Mapi_init(). +01d,18sep01,kc Added ospfStubReqType and ospfIfMetricReqType ospf2MapiReqType_t. +01c,15sep01,kc Added prototypes for ospf2Mapi_xxx() routines. +01b,12sep01,kc Added prototypes for mApi2Ospf_xxx() routines. +01a,07sep01,kc Initial file creation. +*/ + +/* +DESCRIPTION: + +This file contains the functional prototypes for OSPF MIB helper routines. + +*/ + +#ifndef __INCospf_mib_helper_updateh +#define __INCospf_mib_helper_updateh + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* NOTE: Ideally, the following system dependent function pointers typedefs should + * be defined in ospf_mib_api.h. However, that requires OSPF core code to + * also include a laundary list of header files that it doesn't need to + * know (such as ospf_mib_avl_lib.h). Since ospf_mib_utils.h and this header file + * are the only two header files that are included by OSPF code code, this header + * file becomes the logical place for the following typedefs. + */ + +/* this is the function pointer pointed to a system dependent save routine for saving + * the given object to the nvram. + */ +typedef STATUS (* NVRAM_SAVE_FUNCPTR) + ( + ulong_t *pInstance, /* pointer to OID instance array */ + ushort_t instanceLen, /* number of sub-ids in instance */ + ulong_t oidPrefixEnum, /* enum value for object OID Prefix */ + void *pValueBuf, /* pointer to value buffer */ + ulong_t valueLen /* value byte length */ + ); + +/* this is the function pointer pointed to a system dependent delete routine for + * deleting a table row from nvram. + */ +typedef STATUS (* NVRAM_DELETE_FUNCPTR) + ( + ulong_t *pInstance, /* pointer to OID instance array */ + ushort_t instanceLen /* number of sub-ids in instance */ + ); + +/* this is the function pointer pointed to a system dependent retrieve routine for + * retrieving all prevously saved OSPF configuration from nvram. The retrieve routine + * must invoke the MIB API for read-create objects in each ospf table with the + * mApiRequest_t set to MAPI_NVM_SET request type so that MIB API can repopulate its + * management database at system startup. + */ +typedef STATUS (* NVRAM_RETRIEVE_FUNCPTR) (void ); + +/* define the configuration type uses by the underlying OSPF protocol */ +typedef enum { + + /* the following enumeration types are used by OSPF to update the statistical + * and operational status + */ + ospfGenGroupUpdateReqType = 1, /* update General Group read-only variables */ + ospfAreaUpdateReqType, /* update an ospf area instance */ + ospfLsdbUpdateReqType, /* update an ospf lsdb instance */ + ospfIfUpdateReqType, /* update an ospf interface instance */ + ospfVirtIfUpdateReqType, /* update an ospf virtual interface instance */ + ospfNbrUpdateReqType, /* update an ospf neighbor instance */ + ospfVirtNbrUpdateReqType, /* update an ospf virtual neighbor instance */ + ospfExtLsdbUpdateReqType, /* update an ospf external lsdb instance */ + + /* the following enumeration types are used by OSPF to create new instance of link + * state database (including Opaques Lsa types) + */ + ospfLsdbCreateReqType, /* create an instance of lsdb */ + ospfExtLsdbCreateReqType, /* create an ospf external lsdb instance */ + + /* the following enumeration types are used by OSPF to delete an instance of a + * particular table from MIB API + */ + ospfLsdbDeleteReqType, /* delete an ospf lsdb instance */ + ospfNbrDeleteReqType, /* delete an ospf nbr instance */ + ospfVirtNbrDeleteReqType, /* delete an ospf virtual neighbor instance */ + ospfExtLsdbDeleteReqType, /* delete an ospf external lsdb instance */ + + /* the following enumeration types are used by OSPF to create an instance of + * ospf area, stub, interface, interface metric or virtual interface in MIB API + * during startup. These enumeration types are for backward compatibility to + * support the static configuration methodology. It shall not be used by any aother + * applications. These enumeration types will eventually be obsolote + */ + ospfGenGroupCreateReqType, /* setup ospf General Group scalar objects */ + ospfAreaCreateReqType, /* create an instance of ospf area */ + ospfStubCreateReqType, /* create an instance of ospf stub */ + ospfHostCreateReqType, /* create an instance of ospf host interface */ + ospfIfCreateReqType, /* create an instance of ospf interface */ + ospfIfMetricCreateReqType, /* create an instance of ospf interface metric */ + ospfVirtIfCreateReq, /* create an instance of ospf virtual interface */ + ospfAreaAggregateCreateReq, /* create an instance of ospf area aggregate */ + + ospfIfChangeReqType, /* interface flag change event */ + ospfIfDeleteReqType, /* interface address deleted event */ + + /* the following enumeration types are for the wrn-ospf enterprise mib. + * wrnOspfLsdbTable is for Type-10 Opaque LSA, wrnOspfLocalLsdbTable + * is for Type-9 Opaque LSA and wrnOspfExtLsdbTable is for Type-11 + * Opaque LSA support + */ +#if defined(__OPAQUE_LSA__) + wrnOspfGenGroupUpdateReqType, /* update wrnOspf General Group */ + wrnOspfAreaUpdateReqType, /* update an instance of wrnOspfAreaTable */ + wrnOspfLsdbUpdateReqType, /* update an instance of wrnOspfLsdbTable */ + wrnOspfLocalLsdbUpdateReqType, /* update an instance of wrnOspfLocalLsdbTable */ + wrnOspfExtLsdbUpdateReqType, /* update an instance of wrnOspfExtLsdbTable */ + + wrnOspfLsdbCreateReqType, /* create an instance of wrnOspfLsdbTable */ + wrnOspfLocalLsdbCreateReqType, /* create an instance of wrnOspfLocalLsdbTable */ + wrnOspfExtLsdbCreateReqType, /* create an instance of wrnOspfExtLsdbTable */ + + wrnOspfLsdbDeleteReqType, /* delete an wrnOspfLsdbTable instance */ + wrnOspfLocalLsdbDeleteReqType, /* delete an wrnOspfLocalLsdbTable instance, Type-9 */ + wrnOspfExtLsdbDeleteReqType, /* delete an wrnOspfExtLsdbTable instance */ +#endif /* __OPAQUE_LSA__ */ + + /* the following enumeration types are used by OSPF to create an instance of + * wrn-ospf interface at startup. These enumeration types are for backward + * compatibility to support the static configuration methodology. It shall not + * be used by any aother applications. These enumeration types will eventually + * be obsolote + */ + wrnOspfIfCreateReqType, /* update an wrnOsfIfTable instance */ + + /* the following enumeration types are used by OSPF to create an instance of + * redistribution in the wrnOspfRedistributionTable at startup. These enumeration + * types are for backward compatibility to support static configuration + * methodology and shall not be used by any other applications. These + * enumeration types will eventually be obsolete. + */ + wrnOspfRedistribStaticCreateReqType, /* for static and default route type */ + wrnOspfRedistribRipCreateReqType, /* for rip route type */ + wrnOspfRedistribBgpCreateReqType, /* for bgp route type */ + wrnOspfRedistribLocalCreateReqType, /* for local route type */ + /* SPR#88863 end */ + + /* SPR#91541 begin */ + wrnOspf2IpRoutePolicyCreateReqType /* create an instance of wrnOspfToIpRouteTable */ + /* SPR#91541 end */ +} ospf2MapiReqType_t; + + +/* ospf2MapiReqBuf_t structure is a generic data structure used internally by OSPF + * protocol to provide operational status and statistics updates to the MIB API. + * In order to maintain backward compatibility with the existing static configuration + * methodology, this data structure is also used by OSPF protocol at init time to update + * Management Database for any configuration that are statically created. This involves + * creating the ospf area, stub area, interface, interface metric, and virtual interface + * instances in the Management Database. The ospf2MapiReqBuf_t data structure is + * initialized in the ospf2Mapi_request() function (invoked by the OSPF protocol). + * Using this data strcuture, the OSPF protocol can provide the necessary updates to the + * OSPF MIB API asynchronously, thus, minimize the disruption to the overall OSPF + * operation. Due to the multi-usage of the ospf2MapiReqBuf_t data structure, the + * representation of the data structure is highly depending on the type of request + * (defined as ospf2MapiReqType_t enumeration type). The following is the + * representation of the ospf2MapiReqBuf_t data structure for each ospf2MapiReqType_t + * request type: + * + * ospfGeneralGroup (reqType = ospfGenGroupCreateReqType) + * valueBuf[0] = the value of ospfRouterId read-write object + * valueBuf[1] = the value of ospfAdminStat read-write object + * valueBuf[2] = the value of ospfASBdrRtrStatus read-write object + * valueBuf[3] = the value of ospfTOSSupport read-write object + * valueBuf[4] = the value of ospfExtLsdbLimit read-write object + * valueBuf[5] = the value of ospfExitOverflowInterval read-write object + * valueBuf[6] = the value of wrnOspfRFC1583Compatibility read-write object + * valueBuf[7] = the value of wrnOspfOpaqueLsaSupport read-write object + * valueBuf[8] = the value of wrnOspfRedistributeDefaultRoutes read-write object + * valueBuf[9] = the value of wrnOspfRedistributeStaticRoutes read-write object + * valueBuf[10] = the value of wrnOspfRedistributeRIPRoutes read-write object + * valueBuf[11] = the value of wrnOspfRedistributeBGPRoutes read-write object + * + * ospfGeneralGroup (reqType = ospfGenGroupUpdateReqType ) + * valueBuf[0] = the value of ospfExternLsaCount read-only object + * valueBuf[1] = the value of ospfExternLsaCksumSum read-only object + * valueBuf[2] = the value of ospfOriginateNewLsas read-only object + * valueBuf[3] = the value of ospfRxNewLsas read-only object + * valueBuf[4] to valueBuf[14] = not used + * pValueBuf = not use + * + * ospfAreaTable (reqType = ospfAreaUpdateReqType): + * valueBuf[0] = the value of ospfAreaId index object + * valueBuf[1] = the value of ospfSpfRuns read-only object + * valueBuf[2] = the value of ospfAreaBdrRtrCount read-only object + * valueBuf[3] = the value of ospfAsBdrRtrCount read-only object + * valueBuf[4] = the value of ospfAreaLsaCount read-only object + * valueBuf[5] = the value of ospfAreaLsaCksumSum read-only objects + * valueBuf[6] to valueBuf[14] = not used + * pValueBuf = not use + * + * ospfAreaTable (reqType = ospfAreaCreateReqType): + * valueBuf[0] = the value of ospfAreaId index object + * valueBuf[1] = the value of ospfImportAsExtern read-create object + * valueBuf[2] = the value of ospfAreaSummary read-create object + * valueBuf[3] to valueBuf[14] = not used + * pValueBuf = not use + * + * ospfStubTable (reqType = ospfStubCreateReqType): + * valueBuf[0] = the value of ospfStubAreaId index object + * valueBuf[1] = the value of ospfStubTOS index object + * valueBuf[2] = the value of ospfStubMetric read-create object + * valueBuf[3] = the value of ospfStubMetricType read-create object + * valueBuf[4] = the value of ospfStubStatus read-create object + * valueBuf[4] to valueBuf[14] = not used + * pValueBuf = not use + * + * ospfLsdbTable (reqType = ospfLsdbUpdateReqType): + * valueBuf[0] = the value of ospfLsdbAreaId index object + * valueBuf[1] = the value of ospfLsdbType index object + * valueBuf[2] = the value of ospfLsdbLsid index object + * valueBuf[3] = the value of ospfLsdbRouterId index object + * valueBuf[4] = the value of ospfLsdbSequence read-only object + * valueBuf[5] = the value of ospfLsdbAge read-only object + * + * ospfLsdbTable (reqType = ospfLsdbCreateReqType): + * valueBuf[0] = the value of ospfLsdbAreaId index object + * valueBuf[1] = the value of ospfLsdbType index object + * valueBuf[2] = the value of ospfLsdbLsid index object + * valueBuf[3] = the value of ospfLsdbRouterId index object + * valueBuf[4] = the value of ospfLsdbSequence read-only object + * valueBuf[5] = the value of ospfLsdbAge read-only object + * valueBuf[6]= the value of ospfLsdbChecksum read-only object + * valueBuf[7] = the value of lsdbLen (not a MIB object) + * valueBuf[8] and valueBuf[14] = not used + * pValueBuf = pointer to the ospfLsdbAdvertisement read-only object + * + * ospfLsdbTable (reqType = ospfLsdbDeleteReqType) + * valueBuf[0] = the value of ospfLsdbAreaId index object + * valueBuf[1] = the value of ospfLsdbType index object + * valueBuf[2] = the value of ospfLsdbLsid index object + * valueBuf[3] = the value of ospfLsdbRouterId index object + * valueBuf[4] and valueBuf[14] = not used + * pValueBuf = not use + * + * ospfHostTable (reqType = ospfHostCreateReqType): + * valueBuf[0] = the value of ospfHostIpAddress index object + * valueBuf[1] = the value of ospfHostTOS index object + * valueBuf[2] = the value of ospfHostMetric read-create object + * valueBuf[3] = the value of ospfHostAreaId read-only object + * valueBuf[4] = the value of ospfHostStatus read-create object + * valueBuf[5] = interface netmask as defined by ospf protocol + * valueBuf[6] = interface mtu as defined by ospf protocol + * valueBuf[7] to valueBuf[14] = not used + * pValueBuf = not use + * + * ospfIfTable (reqType = ospfIfUpdateReqType): + * valueBuf[0] = the value of ospfIfIpAddress index object + * valueBuf[1] = the value of ospfAddressLessIf index object + * valueBuf[2] = the value of ospfIfState read-only object + * valueBuf[3] = the value of ospfIfDesignatedRouter read-only object + * valueBuf[4] = the value of ospfIfBackupDesignatedRouter read-only object + * valueBuf[5] = the value of ospfIfEvents read-only object + * valueBuf[6] to valueBuf[14] = not used + * pValueBuf = not use + * + * ospfIfTable (reqType = ospfIfCreateReqType) + * valueBuf[0] = the value of ospfIfIpAddress index object + * valueBuf[1] = the value of ospfAddressLessIf index object + * valieBuf[2] = the value of ospfIfAreaId read-create object + * valueBuf[3] = the value of ospfIfType read-create object + * valueBuf[4] = the value of ospfIfAdminStat read-create object + * valueBuf[5] = the value of ospfIfRtrPriority read-create object + * valueBuf[6] = the value of ospfIfTransitDelay read-create object + * valueBuf[7] = the value of ospfIfRetransInterval read-create object + * valueBuf[8] = the value of ospfIfHelloInterval read-create object + * valueBuf[9] = the value of ospfIfRtrDeadInterval read-create object + * valueBuf[10] = the value of ospfIfPollInterval read-create object + * valueBuf[11] = the value of ospfIfAuthType read-create object + * valueBuf[12] = the value of ospfIfStatus read-create object + * valueBuf[13] = the value of the interface subnet mask + * valueBuf[14] = the value of the interface mtu size + * pValueBuf = pointer to the ospfIfAuthKey read-create object + * + * ospfIfMetricTable (reqType = ospfIfMetricCreateReqType ) + * valueBuf[0] = the value of ospfIfMetricIpAddress index object + * valueBuf[1] = the value of ospfIfMetricAddressLessIf index object + * valueBuf[2] = the value of ospfIfMetricTOS index object + * valueBuf[3] = the value of ospfIfMetricValue read-create object + * valueBuf[4] = the value of ospfIfMetricStatus read-create object + * valueBuf[5] to valueBuf[14] = not used + * pValueBuf = not use + * + * ospfVirtIfTable (reqType = ospfVirtIfUpdateReqType): + * valueBuf[0] = the value of ospfVirtIfAreaId index object + * valueBuf[1] = the value of ospfVirtIfNeighbor index object + * valueBuf[2] = the value of ospfVirtIfState read-only object + * valueBuf[3] = the value of ospfVirtIfEvents read-only object + * valueBuf[4] to valueBuf[14] = not used + * pValueBuf = not use + * + * ospfVirtIfTable (reqType = ospfVirtIfCreateReq) + * valueBuf[0] = the value of ospfVirtIfAreaId index object + * valueBuf[1] = the value of ospfVirtIfNeighbor index object + * valieBuf[2] = the value of ospfVirtIfTransitDelay read-create object + * valueBuf[3] = the value of ospfVirtIfRetransInterval read-create object + * valueBuf[4] = the value of ospfVirtIfHelloInterval read-create object + * valueBuf[5] = the value of ospfVirtIfRtrDeadInterval read-create object + * valueBuf[6] = the value of ospfVirtIfAuthType read-create object + * valueBuf[7] = the value of ospfVirtIfStatus read-create object + * valueBuf[8] to valueBuf[14] = not used + * pValueBuf = pointer to ospfVirtIfAuthKey read-create object + * + * ospfNbrTable (reqType = ospfNbrUpdateReqType): + * valueBuf[0] = the value of ospfNbrIpAddr index object + * valueBuf[1] = the value of ospfNbrAddressLessIndex index object + * valueBuf[2] = the value of ospfNbrRtrId read-only object + * valueBuf[3] = the value of ospfNbrOptions read-only object + * valueBuf[4] = the value of ospfNbrState read-only object + * valueBuf[5] = the value of ospfNbrEvents read-only object + * valueBuf[6] = the value of ospfNbrLsRetransQLen read-only object + * valueBuf[7] = the value of ospfNbmaNbrStatus read-only object + * valueBuf[8] = the value of ospfNbmaNbrPermanence read-only object + * valueBuf[9] = the value of ospfNbrHelloSuppressed read-only object + * valueBuf[10] = the value of ospfNbrPriority read-only object + * valueBuf[11] = Interface IP Address associated with this neighbor + * valueBuf[12] = Interface IfIndex associated with this neighbor + * valueBuf[13] and valueBuf[14] = not used + * pValueBuf = not use + * + * ospfNbrTable (reqType = ospfNbrDeleteReqType) + * valueBuf[0] = the value of ospfNbrIpAddr index object + * valueBuf[1] = the value of ospfNbrAddressLessIndex index object + * valueBuf[2] to valueBuf[14] = not used + * pValueBuf = not use + * + * ospfVirtNbrTable (reqType = ospfVirtNbrUpdateReqType): + * valueBuf[0] = the value of ospfVirtNbrArea index object + * valueBuf[1] = the value of ospfVirtNbrRtrId index object + * valueBuf[2] = the value of ospfVirtNbrIpAddr read-only object + * valueBuf[3] = the value of ospfVirtNbrOptions read-only object + * valueBuf[4] = the value of ospfVirtNbrState read-only object + * valueBuf[5] = the value of ospfVirtNbrEvents read-only object + * valueBuf[6] = the value of ospfVirtNbrLSRetransQLen read-only object + * valueBuf[7] = the value of ospfVirtNbrHelloSuppressed read-only object + * valueBuf[8] and valueBuf[14] = not used + * pValueBuf = not use + * + * ospfVirtNbrTable (reqType = ospfVirtNbrDeleteReqType) + * valueBuf[0] = the value of ospfVirtNbrArea index object + * valueBuf[1] = the value of ospfVirtNbrRtrId index object + * valueBuf[2] and valueBuf[14] = not used + * pValueBuf = not use + * + * ospfExtLsdbTable (reqType = ospfExtLsdbUpdateReqType) + * valueBuf[0] = the value of ospfExtLsdbType index object + * valueBuf[1] = the value of ospfExtLsdbLsid index object + * valueBuf[2] = the value of ospfExtLsdbRouterId index object + * valueBuf[3] = the value of ospfExtLsdbSequence read-only object + * valueBuf[4] = the value of ospfExtLsdbAge read-only object + * + * ospfExtLsdbTable (reqType = ospfExtLsdbCreateReqType) + * valueBuf[0] = the value of ospfExtLsdbType index object + * valueBuf[1] = the value of ospfExtLsdbLsid index object + * valueBuf[2] = the value of ospfExtLsdbRouterId index object + * valueBuf[3] = the value of ospfExtLsdbSequence read-only object + * valueBuf[4] = the value of ospfExtLsdbAge read-only object + * valueBuf[5] = the value of ospfExtLsdbChecksum read-only object + * valueBuf[6] = the value of lsdbLen (not a MIB object) + * valueBuf[7] = the protocol ID for the external route (if applicable). + * valueBuf[8] and valueBuf[14] = not used + * pValueBuf = pointer to the ospfExtLsdbAdvertisement read-only object + * + * ospfExtLsdbTable (reqType = ospfExtLsdbDeleteReqType) + * valueBuf[0] = the value of ospfExtLsdbType index object + * valueBuf[1] = the value of ospfExtLsdbLsid index object + * valueBuf[2] = the value of ospfExtLsdbRouterId index object + * valueBuf[3] to valueBuf[14] = not used + * pValueBuf = not use + * + * ospfAreaAggregateTable (reqType = ospfAreaAggregateCreateReq ) + * valueBuf[0] = the value of ospfAreaAggregateAreaID index object + * valueBuf[1] = the value of ospfAreaAggregateLsdbType index object + * valueBuf[2] = the value of ospfAreaAggregateNet index object + * valueBuf[3] = the value of ospfAreaAggregateMask index object + * valueBuf[4] = the value of ospfAreaAggregateEffect read-only object + * valueBuf[5] = the value of ospfAreaAggregateStatus read-only object + * valueBuf[6] and valueBuf[14] = not used + * pValueBuf = pointer to the ospfExtLsdbAdvertisement read-only object + * + * interface flag change notification from ospf (reqType = ospfIfChangeReqType) + * valueBuf[0] = the value of ospfIfIpAddress index object + * valueBuf[1] = the value of ospfAddressLessIf index object + * valueBuf[2] = interface index value (from struct ifnet) + * valueBuf[3] = interface flags (from struct ifnet) + * valueBuf[4] to valueBuf[14] = not use + * pValueBuf = not use + * + * interface address deleted notification from ospf (reqType = ospfIfDeleteReqType) + * valueBuf[0] = the value of ospfIfIpAddress index object + * valueBuf[1] = the value of ospfAddressLessIf index object + * valueBuf[2] = interface index value (from struct ifnet) + * valueBuf[3] to valueBuf[14] = not use + * pValueBuf = not use + * + ***************** WRN OSPF Enterprise MIB *************** + * wrnOspfGeneralGroup (reqType = wrnOspfGenGroupUpdateReqType ) + * valueBuf[0] = the value of wrnOspfOriginateNewOpaqueLsas read-only object + * valueBuf[1] = the value of wrnOspfRxNewOpaqueLsas read-only object + * valueBuf[2] = the value of wrnOspfType9LsaCount read-only object + * valueBuf[3] = the value of wrnOspfType9LsaCksumSum read-only object + * valueBuf[4] = the value of wrnOspfType11LsaCount read-only object + * valueBuf[5] = the value of wrnOspfType11LsaCksumSum read-only object + * valueBuf[6] to valueBuf[14] = not used + * pValueBuf = not use + * + * wrnOspfAreaTable (reqType = wrnOspfAreaUpdateReqType) + * valueBuf[0] = the value of wrnOspfAreaId index object + * valueBuf[1] = the value of wrnOspfAreaType10LsaCount read-only object + * valueBuf[2] = the value of wrnOspfAreaType10LsaCksumSum read-only object + * valueBuf[3] to valueBuf[14] = not used + * pValueBuf = not use + * + * wrnOspfLsdbTable:Type-10 Opaque LSA (reqType = wrnOspfLsdbUpdateReqType): + * valueBuf[0] = the value of wrnOspfLsdbAreaId index object + * valueBuf[1] = the value of wrnOspfLsdbType index object + * valueBuf[2] = the value of wrnOspfLsdbLsid index object + * valueBuf[3] = the value of wrnOspfLsdbRouterId index object + * valueBuf[4] = the value of wrnOspfLsdbSequence read-only object + * valueBuf[5] = the value of wrnOspfLsdbAge read-only object + * + * wrnOspfLsdbTable:Type-10 Opaque LSA (reqType = wrnOspfLsdbCreateReqType): + * valueBuf[0] = the value of wrnOspfLsdbAreaId index object + * valueBuf[1] = the value of wrnOspfLsdbType index object + * valueBuf[2] = the value of wrnOspfLsdbLsid index object + * valueBuf[3] = the value of wrnOspfLsdbRouterId index object + * valueBuf[4] = the value of wrnOspfLsdbSequence read-only object + * valueBuf[5] = the value of wrnOspfLsdbAge read-only object + * valueBuf[6] = the value of wrnOspfLsdbChecksum read-only object + * valueBuf[7] = the value of lsdbLen (not a MIB object) + * valueBuf[8] and valueBuf[14] = not used + * pValueBuf = pointer to the wrnOspfLsdbAdvertisement read-only object + * + * wrnOspfLsdbTable:Type-10 Opaque LSA (reqType = wrnOspfLsdbDeleteReqType) + * valueBuf[0] = the value of wrnOspfLsdbAreaId index object + * valueBuf[1] = the value of wrnOspfLsdbType index object + * valueBuf[2] = the value of wrnOspfLsdbLsid index object + * valueBuf[3] = the value of wrnOspfLsdbRouterId index object + * valueBuf[4] and valueBuf[14] = not used + * pValueBuf = not use + * + * wrnOspfLocalLsdbTable:Type-9 Opaque LSA (reqType = wrnOspfLocalLsdbUpdateReqType) + * valueBuf[0] = the value of wrnOspfLocalLsdbAreaId index object + * valueBuf[1] = the value of wrnOspfLocalLsdbIpAddress index object + * valueBuf[2] = the value of wrnOspfLocalLsdbType index object + * valueBuf[3] = the value of wrnOspfLocalLsdbLsid index object + * valueBuf[4] = the value of wrnOspfLocalLsdbRouterId index object + * valueBuf[5] = the value of wrnOspfLocalLsdbSequence read-only object + * valueBuf[6] = the value of wrnOspfLocalLsdbAge read-only object + * + * wrnOspfLocalLsdbTable:Type-9 Opaque LSA (reqType = wrnOspfLocalLsdbCreateReqType) + * valueBuf[0] = the value of wrnOspfLocalLsdbAreaId index object + * valueBuf[1] = the value of wrnOspfLocalLsdbIpAddress index object + * valueBuf[2] = the value of wrnOspfLocalLsdbType index object + * valueBuf[3] = the value of wrnOspfLocalLsdbLsid index object + * valueBuf[4] = the value of wrnOspfLocalLsdbRouterId index object + * valueBuf[5] = the value of wrnOspfLocalLsdbSequence read-only object + * valueBuf[6] = the value of wrnOspfLocalLsdbAge read-only object + * valueBuf[7] = the value of wrnOspfLocalLsdbChecksum read-only object + * valueBuf[8] = the value of lsdbLen (not a MIB object) + * valueBuf[9] and valueBuf[14] = not used + * pValueBuf = pointer to the wrnOspfLocalLsdbAdvertisement read-only object + * + * wrnOspfLocalLsdbTable:Type-9 Opaque LSA (reqType = wrnOspfLocalLsdbDeleteReqType) + * valueBuf[0] = the value of wrnOspfLocalLsdbAreaId index object + * valueBuf[1] = the value of wrnOspfLocalLsdbIpAddress index object + * valueBuf[2] = the value of wrnOspfLocalLsdbType index object + * valueBuf[3] = the value of wrnOspfLocalLsdbLsid index object + * valueBuf[4] = the value of wrnOspfLocalLsdbRouterId index object + * valueBuf[5] and valueBuf[14] = not used + * pValueBuf = not use + * + * wrnOspfExtLsdbTable:Type-11 Opaque LSA (reqType = wrnOspfExtLsdbUpdateReqType) + * valueBuf[0] = the value of wrnOspfExtLsdbType index object + * valueBuf[1] = the value of wrnOspfExtLsdbLsid index object + * valueBuf[2] = the value of wrnOspfExtLsdbRouterId index object + * valueBuf[3] = the value of wrnOspfExtLsdbSequence read-only object + * valueBuf[4] = the value of wrnOspfExtLsdbAge read-only object + * + * wrnOspfExtLsdbTable:Type-11 Opaque LSA (reqType = wrnOspfExtLsdbCreateReqType) + * valueBuf[0] = the value of wrnOspfExtLsdbType index object + * valueBuf[1] = the value of wrnOspfExtLsdbLsid index object + * valueBuf[2] = the value of wrnOspfExtLsdbRouterId index object + * valueBuf[3] = the value of wrnOspfExtLsdbSequence read-only object + * valueBuf[4] = the value of wrnOspfExtLsdbAge read-only object + * valueBuf[5] = the value of wrnOspfExtLsdbChecksum read-only object + * valueBuf[6] = the value of lsdbLen (not a MIB object) + * valueBuf[7] and valueBuf[14] = not used + * pValueBuf = pointer to the wrnOspfExtLsdbAdvertisement read-only object + * + * wrnOspfExtLsdbTable:Type-11 Opaque LSA (reqType = wrnOspfExtLsdbDeleteReqType) + * valueBuf[0] = the value of wrnOspfExtLsdbType index object + * valueBuf[1] = the value of wrnOspfExtLsdbLsid index object + * valueBuf[2] = the value of wrnOspfExtLsdbRouterId index object + * valueBuf[3] and valueBuf[14] = not used + * pValueBuf = not use + * + * wrnOspfIfTable (reqType = wrnOspfIfCreateReqType): + * valueBuf[0] = the value of wrnOspfIfDstIpAddress index object + * valueBuf[1] = the value of wrnOspfIfIndex index object + * valueBuf[3] to valueBuf[14] = not used + * pValueBuf = not use + * wrnOspfRedistributionTable (reqType = wrnOspfRedistribStaticCreateReqType, + * wrnOspfRedistribRipCreateReqType and/or wrnOspfRedistribBgpCreateReqType): + * valueBuf[0] = the value of wrnOspfRedistribRouteType index object + * valueBuf[1] = the value of wrnOspfRedistribSubnet index object + * valueBuf[2] = the value of wrnOspfRedistribMask index object + * valueBuf[3] = the value of wrnOspfRedistribType read-create object + * valueBuf[4] = the value of wrnOspfRedistribMetric read-create object + * valueBuf[5] and valueBuf[14] = not used + * pValueBuf = not use + */ +typedef struct ospf2MapiReqBuf +{ + NODE node; /* linked list node */ + ospf2MapiReqType_t reqType; /* request type issued by ospf protocol */ + ulong_t valueBuf[15]; /* value buffer */ + char *pValueBuf; /* pointer to data larger than sizeof(ulong_t) */ +} ospf2MapiReqBuf_t; + +typedef struct ospf2MapiSysCtl +{ + ushort_t if_index; /* interface index (from struct ifnet) */ + void *pCtlData; /* control data, specific to the request message */ +} ospf2MapiSysCtl_t; + +/* prototypes for functions used by MIB API to dynamically reconfigure OSPF */ +IMPORT STATUS mApi2Ospf_configGenGroup( void *pGenParams ); +IMPORT STATUS mApi2Ospf_configArea( mApiRequest_t *pRequest ); +IMPORT STATUS mApi2Ospf_configStub( mApiRequest_t *pRequest ); +IMPORT STATUS mApi2Ospf_configHost( mApiRequest_t *pRequest ); +IMPORT STATUS mApi2Ospf_configIf( mApiRequest_t *pRequest ); +IMPORT STATUS mApi2Ospf_configIfMetric( mApiRequest_t *pRequest ); +IMPORT STATUS mApi2Ospf_configVirtIf( mApiRequest_t *pRequest ); +IMPORT STATUS mApi2Ospf_configNbr( mApiRequest_t *pRequest ); +IMPORT STATUS mApi2Ospf_configAreaAggregate( mApiRequest_t *pRequest ); +IMPORT STATUS mApi2Ospf_configRedistrib( mApiRequest_t *pRequest ); +IMPORT STATUS mApi2Ospf_configOspf2IpRoute( mApiRequest_t *pRequest ); +IMPORT STATUS mApi2Ospf_deleteArea( void *pRow ); +IMPORT STATUS mApi2Ospf_deleteHost( void *pRow ); +IMPORT STATUS mApi2Ospf_deleteIf( void *pRow ); +IMPORT STATUS mApi2Ospf_deleteIfMetric( void *pRow ); +IMPORT STATUS mApi2Ospf_deleteVirtIf( void *pRow ); +IMPORT STATUS mApi2Ospf_deleteNbr( void *pRow ); +IMPORT STATUS mApi2Ospf_deleteAreaAggregate( void *pRow ); +IMPORT STATUS mApi2Ospf_deleteRedistrib( void *pRow ); +IMPORT STATUS mApi2Ospf_deleteOspf2IpRoute( void *pRow ); + +/* prototypes for functions used by OSPF for operational status statistic updates */ +IMPORT void ospf2Mapi_request( void *pObjInfo, ospf2MapiReqType_t reqType ); + +/* prototypes for functions used by OSPF for registration and de-registration */ +IMPORT STATUS ospf2Mapi_proto_register( void ); +IMPORT void ospf2Mapi_proto_deregister( void ); + +/* prototype for function used by OSPF to retrieve ospf configuration from MIB API */ +IMPORT STATUS ospf2Mapi_query_config( BOOL *readStaticConfig ); + +/* misc prototypes used by MIB API only */ +IMPORT STATUS ospf2Mapi_init( int numOspfReqBufCnt ); +IMPORT void ospf2Mapi_shutdown( void ); + +/* Show routine */ +IMPORT STATUS ospf2Mapi_show( void ); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __INCospf_mib_helper_updateh */ diff --git a/h/wrn/ospf/ospf_mib_leaf.h b/h/wrn/ospf/ospf_mib_leaf.h new file mode 100644 index 0000000..60911db --- /dev/null +++ b/h/wrn/ospf/ospf_mib_leaf.h @@ -0,0 +1,321 @@ +/****************************************************************************** + ****************************************************************************** + **** This file was automatically generated by Epilogue Technology's + **** Emissary SNMP MIB Compiler, version 9.1. + **** This file was generated using the -leaf switch. + **** + **** This file #defines C preprocessor macros providing a variety of + **** information for the leaf objects in the MIB. + **** + **** The file includes a LEAF_xxx macro for each leaf object in the + **** MIB (xxx is replaced by the object's name). The value of the + **** LEAF_xxx macro is the final component of the object's object + **** identifier. + **** + **** If the object's SYNTAX clause included named INTEGER values, + **** then there is a VAL_xxx_yyy macro for each named value (xxx is + **** replaced by the object's name and yyy by the value's name). The + **** value of the VAL_xxx_yyy macro is the value associated with the + **** named value. + **** + **** If the object's SYNTAX clause specified a set of range limitations + **** for the value of the object, then there are one or more sets of + **** MIN_xxx and MAX_xxx macros specifying the lower and upper bound of + **** each range limitation. + **** + **** If the object's SYNTAX clause specified a set of size constraints + **** for the value of the object, then there are one or more sets of + **** MINSIZE_xxx and MAXSIZE_xxx macros specifying the lower and upper + **** bound of each size constraint. (If the size constraint is a single + **** value rather than a range then the MINSIZE_xxx and MAXSIZE_xxx + **** macros are replaced by a single SIZE_xxx macro.) + **** + **** DO NOT MODIFY THIS FILE BY HAND. + **** + **** Last build date: Tue Oct 16 11:22:00 2001 + **** from files: + **** rfc1213.mib, rfc1850.mi2, rfc1850.ctl + ****************************************************************************** + ****************************************************************************** + */ + +#define LEAF_ospfRouterId 1 +#define LEAF_ospfAdminStat 2 +#define VAL_ospfAdminStat_enabled 1L +#define VAL_ospfAdminStat_disabled 2L +#define LEAF_ospfVersionNumber 3 +#define VAL_ospfVersionNumber_version2 2L +#define LEAF_ospfAreaBdrRtrStatus 4 +#define VAL_ospfAreaBdrRtrStatus_true 1L +#define VAL_ospfAreaBdrRtrStatus_false 2L +#define LEAF_ospfASBdrRtrStatus 5 +#define VAL_ospfASBdrRtrStatus_true 1L +#define VAL_ospfASBdrRtrStatus_false 2L +#define LEAF_ospfExternLsaCount 6 +#define LEAF_ospfExternLsaCksumSum 7 +#define LEAF_ospfTOSSupport 8 +#define VAL_ospfTOSSupport_true 1L +#define VAL_ospfTOSSupport_false 2L +#define LEAF_ospfOriginateNewLsas 9 +#define LEAF_ospfRxNewLsas 10 +#define LEAF_ospfExtLsdbLimit 11 +#define MIN_ospfExtLsdbLimit -1L +#define MAX_ospfExtLsdbLimit 2147483647L +#define LEAF_ospfMulticastExtensions 12 +#define LEAF_ospfExitOverflowInterval 13 +#define MIN_ospfExitOverflowInterval 0L +#define MAX_ospfExitOverflowInterval 2147483647L +#define LEAF_ospfDemandExtensions 14 +#define VAL_ospfDemandExtensions_true 1L +#define VAL_ospfDemandExtensions_false 2L +#define LEAF_ospfAreaId 1 +#define LEAF_ospfAuthType 2 +#define LEAF_ospfImportAsExtern 3 +#define VAL_ospfImportAsExtern_importExternal 1L +#define VAL_ospfImportAsExtern_importNoExternal 2L +#define VAL_ospfImportAsExtern_importNssa 3L +#define LEAF_ospfSpfRuns 4 +#define LEAF_ospfAreaBdrRtrCount 5 +#define LEAF_ospfAsBdrRtrCount 6 +#define LEAF_ospfAreaLsaCount 7 +#define LEAF_ospfAreaLsaCksumSum 8 +#define LEAF_ospfAreaSummary 9 +#define VAL_ospfAreaSummary_noAreaSummary 1L +#define VAL_ospfAreaSummary_sendAreaSummary 2L +#define LEAF_ospfAreaStatus 10 +#define VAL_ospfAreaStatus_active 1L +#define VAL_ospfAreaStatus_notInService 2L +#define VAL_ospfAreaStatus_notReady 3L +#define VAL_ospfAreaStatus_createAndGo 4L +#define VAL_ospfAreaStatus_createAndWait 5L +#define VAL_ospfAreaStatus_destroy 6L +#define LEAF_ospfStubAreaId 1 +#define LEAF_ospfStubTOS 2 +#define MIN_ospfStubTOS 0L +#define MAX_ospfStubTOS 30L +#define LEAF_ospfStubMetric 3 +#define MIN_ospfStubMetric 0L +#define MAX_ospfStubMetric 16777215L +#define LEAF_ospfStubStatus 4 +#define VAL_ospfStubStatus_active 1L +#define VAL_ospfStubStatus_notInService 2L +#define VAL_ospfStubStatus_notReady 3L +#define VAL_ospfStubStatus_createAndGo 4L +#define VAL_ospfStubStatus_createAndWait 5L +#define VAL_ospfStubStatus_destroy 6L +#define LEAF_ospfStubMetricType 5 +#define VAL_ospfStubMetricType_ospfMetric 1L +#define VAL_ospfStubMetricType_comparableCost 2L +#define VAL_ospfStubMetricType_nonComparable 3L +#define LEAF_ospfLsdbAreaId 1 +#define LEAF_ospfLsdbType 2 +#define VAL_ospfLsdbType_routerLink 1L +#define VAL_ospfLsdbType_networkLink 2L +#define VAL_ospfLsdbType_summaryLink 3L +#define VAL_ospfLsdbType_asSummaryLink 4L +#define VAL_ospfLsdbType_asExternalLink 5L +#define VAL_ospfLsdbType_multicastLink 6L +#define VAL_ospfLsdbType_nssaExternalLink 7L +#define LEAF_ospfLsdbLsid 3 +#define LEAF_ospfLsdbRouterId 4 +#define LEAF_ospfLsdbSequence 5 +#define LEAF_ospfLsdbAge 6 +#define LEAF_ospfLsdbChecksum 7 +#define LEAF_ospfLsdbAdvertisement 8 +#define MINSIZE_ospfLsdbAdvertisement 1L +#define MAXSIZE_ospfLsdbAdvertisement 65535L +#define LEAF_ospfHostIpAddress 1 +#define LEAF_ospfHostTOS 2 +#define MIN_ospfHostTOS 0L +#define MAX_ospfHostTOS 30L +#define LEAF_ospfHostMetric 3 +#define MIN_ospfHostMetric 0L +#define MAX_ospfHostMetric 65535L +#define LEAF_ospfHostStatus 4 +#define VAL_ospfHostStatus_active 1L +#define VAL_ospfHostStatus_notInService 2L +#define VAL_ospfHostStatus_notReady 3L +#define VAL_ospfHostStatus_createAndGo 4L +#define VAL_ospfHostStatus_createAndWait 5L +#define VAL_ospfHostStatus_destroy 6L +#define LEAF_ospfHostAreaID 5 +#define LEAF_ospfIfIpAddress 1 +#define LEAF_ospfAddressLessIf 2 +#define LEAF_ospfIfAreaId 3 +#define LEAF_ospfIfType 4 +#define VAL_ospfIfType_broadcast 1L +#define VAL_ospfIfType_nbma 2L +#define VAL_ospfIfType_pointToPoint 3L +#define VAL_ospfIfType_pointToMultipoint 5L +#define LEAF_ospfIfAdminStat 5 +#define VAL_ospfIfAdminStat_enabled 1L +#define VAL_ospfIfAdminStat_disabled 2L +#define LEAF_ospfIfRtrPriority 6 +#define MIN_ospfIfRtrPriority 0L +#define MAX_ospfIfRtrPriority 255L +#define LEAF_ospfIfTransitDelay 7 +#define MIN_ospfIfTransitDelay 0L +#define MAX_ospfIfTransitDelay 3600L +#define LEAF_ospfIfRetransInterval 8 +#define MIN_ospfIfRetransInterval 0L +#define MAX_ospfIfRetransInterval 3600L +#define LEAF_ospfIfHelloInterval 9 +#define MIN_ospfIfHelloInterval 1L +#define MAX_ospfIfHelloInterval 65535L +#define LEAF_ospfIfRtrDeadInterval 10 +#define MIN_ospfIfRtrDeadInterval 0L +#define MAX_ospfIfRtrDeadInterval 2147483647L +#define LEAF_ospfIfPollInterval 11 +#define MIN_ospfIfPollInterval 0L +#define MAX_ospfIfPollInterval 2147483647L +#define LEAF_ospfIfState 12 +#define VAL_ospfIfState_down 1L +#define VAL_ospfIfState_loopback 2L +#define VAL_ospfIfState_waiting 3L +#define VAL_ospfIfState_pointToPoint 4L +#define VAL_ospfIfState_designatedRouter 5L +#define VAL_ospfIfState_backupDesignatedRouter 6L +#define VAL_ospfIfState_otherDesignatedRouter 7L +#define LEAF_ospfIfDesignatedRouter 13 +#define LEAF_ospfIfBackupDesignatedRouter 14 +#define LEAF_ospfIfEvents 15 +#define LEAF_ospfIfAuthKey 16 +#define MINSIZE_ospfIfAuthKey 0L +#define MAXSIZE_ospfIfAuthKey 256L +#define LEAF_ospfIfStatus 17 +#define VAL_ospfIfStatus_active 1L +#define VAL_ospfIfStatus_notInService 2L +#define VAL_ospfIfStatus_notReady 3L +#define VAL_ospfIfStatus_createAndGo 4L +#define VAL_ospfIfStatus_createAndWait 5L +#define VAL_ospfIfStatus_destroy 6L +#define LEAF_ospfIfMulticastForwarding 18 +#define VAL_ospfIfMulticastForwarding_blocked 1L +#define VAL_ospfIfMulticastForwarding_multicast 2L +#define VAL_ospfIfMulticastForwarding_unicast 3L +#define LEAF_ospfIfDemand 19 +#define VAL_ospfIfDemand_true 1L +#define VAL_ospfIfDemand_false 2L +#define LEAF_ospfIfAuthType 20 +#define MIN_ospfIfAuthType 0L +#define MAX_ospfIfAuthType 255L +#define LEAF_ospfIfMetricIpAddress 1 +#define LEAF_ospfIfMetricAddressLessIf 2 +#define LEAF_ospfIfMetricTOS 3 +#define MIN_ospfIfMetricTOS 0L +#define MAX_ospfIfMetricTOS 30L +#define LEAF_ospfIfMetricValue 4 +#define MIN_ospfIfMetricValue 0L +#define MAX_ospfIfMetricValue 65535L +#define LEAF_ospfIfMetricStatus 5 +#define VAL_ospfIfMetricStatus_active 1L +#define VAL_ospfIfMetricStatus_notInService 2L +#define VAL_ospfIfMetricStatus_notReady 3L +#define VAL_ospfIfMetricStatus_createAndGo 4L +#define VAL_ospfIfMetricStatus_createAndWait 5L +#define VAL_ospfIfMetricStatus_destroy 6L +#define LEAF_ospfVirtIfAreaId 1 +#define LEAF_ospfVirtIfNeighbor 2 +#define LEAF_ospfVirtIfTransitDelay 3 +#define MIN_ospfVirtIfTransitDelay 0L +#define MAX_ospfVirtIfTransitDelay 3600L +#define LEAF_ospfVirtIfRetransInterval 4 +#define MIN_ospfVirtIfRetransInterval 0L +#define MAX_ospfVirtIfRetransInterval 3600L +#define LEAF_ospfVirtIfHelloInterval 5 +#define MIN_ospfVirtIfHelloInterval 1L +#define MAX_ospfVirtIfHelloInterval 65535L +#define LEAF_ospfVirtIfRtrDeadInterval 6 +#define MIN_ospfVirtIfRtrDeadInterval 0L +#define MAX_ospfVirtIfRtrDeadInterval 2147483647L +#define LEAF_ospfVirtIfState 7 +#define VAL_ospfVirtIfState_down 1L +#define VAL_ospfVirtIfState_pointToPoint 4L +#define LEAF_ospfVirtIfEvents 8 +#define LEAF_ospfVirtIfAuthKey 9 +#define MINSIZE_ospfVirtIfAuthKey 0L +#define MAXSIZE_ospfVirtIfAuthKey 256L +#define LEAF_ospfVirtIfStatus 10 +#define VAL_ospfVirtIfStatus_active 1L +#define VAL_ospfVirtIfStatus_notInService 2L +#define VAL_ospfVirtIfStatus_notReady 3L +#define VAL_ospfVirtIfStatus_createAndGo 4L +#define VAL_ospfVirtIfStatus_createAndWait 5L +#define VAL_ospfVirtIfStatus_destroy 6L +#define LEAF_ospfVirtIfAuthType 11 +#define MIN_ospfVirtIfAuthType 0L +#define MAX_ospfVirtIfAuthType 255L +#define LEAF_ospfNbrIpAddr 1 +#define LEAF_ospfNbrAddressLessIndex 2 +#define LEAF_ospfNbrRtrId 3 +#define LEAF_ospfNbrOptions 4 +#define LEAF_ospfNbrPriority 5 +#define MIN_ospfNbrPriority 0L +#define MAX_ospfNbrPriority 255L +#define LEAF_ospfNbrState 6 +#define VAL_ospfNbrState_down 1L +#define VAL_ospfNbrState_attempt 2L +#define VAL_ospfNbrState_init 3L +#define VAL_ospfNbrState_twoWay 4L +#define VAL_ospfNbrState_exchangeStart 5L +#define VAL_ospfNbrState_exchange 6L +#define VAL_ospfNbrState_loading 7L +#define VAL_ospfNbrState_full 8L +#define LEAF_ospfNbrEvents 7 +#define LEAF_ospfNbrLsRetransQLen 8 +#define LEAF_ospfNbmaNbrStatus 9 +#define VAL_ospfNbmaNbrStatus_active 1L +#define VAL_ospfNbmaNbrStatus_notInService 2L +#define VAL_ospfNbmaNbrStatus_notReady 3L +#define VAL_ospfNbmaNbrStatus_createAndGo 4L +#define VAL_ospfNbmaNbrStatus_createAndWait 5L +#define VAL_ospfNbmaNbrStatus_destroy 6L +#define LEAF_ospfNbmaNbrPermanence 10 +#define VAL_ospfNbmaNbrPermanence_dynamic 1L +#define VAL_ospfNbmaNbrPermanence_permanent 2L +#define LEAF_ospfNbrHelloSuppressed 11 +#define VAL_ospfNbrHelloSuppressed_true 1L +#define VAL_ospfNbrHelloSuppressed_false 2L +#define LEAF_ospfVirtNbrArea 1 +#define LEAF_ospfVirtNbrRtrId 2 +#define LEAF_ospfVirtNbrIpAddr 3 +#define LEAF_ospfVirtNbrOptions 4 +#define LEAF_ospfVirtNbrState 5 +#define VAL_ospfVirtNbrState_down 1L +#define VAL_ospfVirtNbrState_attempt 2L +#define VAL_ospfVirtNbrState_init 3L +#define VAL_ospfVirtNbrState_twoWay 4L +#define VAL_ospfVirtNbrState_exchangeStart 5L +#define VAL_ospfVirtNbrState_exchange 6L +#define VAL_ospfVirtNbrState_loading 7L +#define VAL_ospfVirtNbrState_full 8L +#define LEAF_ospfVirtNbrEvents 6 +#define LEAF_ospfVirtNbrLsRetransQLen 7 +#define LEAF_ospfVirtNbrHelloSuppressed 8 +#define VAL_ospfVirtNbrHelloSuppressed_true 1L +#define VAL_ospfVirtNbrHelloSuppressed_false 2L +#define LEAF_ospfExtLsdbType 1 +#define VAL_ospfExtLsdbType_asExternalLink 5L +#define LEAF_ospfExtLsdbLsid 2 +#define LEAF_ospfExtLsdbRouterId 3 +#define LEAF_ospfExtLsdbSequence 4 +#define LEAF_ospfExtLsdbAge 5 +#define LEAF_ospfExtLsdbChecksum 6 +#define LEAF_ospfExtLsdbAdvertisement 7 +#define SIZE_ospfExtLsdbAdvertisement 36L +#define LEAF_ospfAreaAggregateAreaID 1 +#define LEAF_ospfAreaAggregateLsdbType 2 +#define VAL_ospfAreaAggregateLsdbType_summaryLink 3L +#define VAL_ospfAreaAggregateLsdbType_nssaExternalLink 7L +#define LEAF_ospfAreaAggregateNet 3 +#define LEAF_ospfAreaAggregateMask 4 +#define LEAF_ospfAreaAggregateStatus 5 +#define VAL_ospfAreaAggregateStatus_active 1L +#define VAL_ospfAreaAggregateStatus_notInService 2L +#define VAL_ospfAreaAggregateStatus_notReady 3L +#define VAL_ospfAreaAggregateStatus_createAndGo 4L +#define VAL_ospfAreaAggregateStatus_createAndWait 5L +#define VAL_ospfAreaAggregateStatus_destroy 6L +#define LEAF_ospfAreaAggregateEffect 6 +#define VAL_ospfAreaAggregateEffect_advertiseMatching 1L +#define VAL_ospfAreaAggregateEffect_doNotAdvertiseMatching 2L diff --git a/h/wrn/ospf/ospf_mib_skel.h b/h/wrn/ospf/ospf_mib_skel.h new file mode 100644 index 0000000..c326629 --- /dev/null +++ b/h/wrn/ospf/ospf_mib_skel.h @@ -0,0 +1,67 @@ +/****************************************************************************** + ****************************************************************************** + **** This file was automatically generated by Epilogue Technology's + **** Emissary SNMP MIB Compiler, version 9.1. + **** This file was generated using the -skel.h switch. + **** + **** This file contains declarations of stub functions to aid in building + **** the agent MIB interface. It declares all the MIB get, set, test and + **** next method routines that you will need to supply. You'll probably + **** want to FORCE-INCLUDE this file when using the -mib.c output mode. + **** + **** To generate the skeletal stub functions themselves, run Emissary + **** with the -skel switch. + **** + **** YOU MAY MODIFY THIS FILE BUT BEWARE ACCIDENTALLY OVERWRITING IT + **** BY REGENERATING IT WITH THE MIB COMPILER. + **** + **** Last build date: Tue Oct 16 11:22:24 2001 + **** from files: + **** rfc1213.mib, rfc1850.mi2, rfc1850.ctl + ****************************************************************************** + ****************************************************************************** + */ + +void ospfGeneralGroup_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfGeneralGroup_set(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfGeneralGroup_test(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfGeneralGroup_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void null_test_async(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfAreaEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfAreaEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfAreaEntry_set(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfAreaEntry_test(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfStubAreaEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfStubAreaEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfStubAreaEntry_set(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfStubAreaEntry_test(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfLsdbEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfLsdbEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfHostEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfHostEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfHostEntry_set(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfHostEntry_test(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfIfEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfIfEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfIfEntry_set(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfIfEntry_test(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfIfMetricEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfIfMetricEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfIfMetricEntry_set(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfIfMetricEntry_test(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfVirtIfEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfVirtIfEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfVirtIfEntry_set(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfVirtIfEntry_test(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfNbrEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfNbrEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfNbrEntry_set(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfNbrEntry_test(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfVirtNbrEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfVirtNbrEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfExtLsdbEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfExtLsdbEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfAreaAggregateEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfAreaAggregateEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfAreaAggregateEntry_set(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfAreaAggregateEntry_test(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); diff --git a/h/wrn/ospf/ospf_mib_wrn_helper.h b/h/wrn/ospf/ospf_mib_wrn_helper.h new file mode 100644 index 0000000..241a9df --- /dev/null +++ b/h/wrn/ospf/ospf_mib_wrn_helper.h @@ -0,0 +1,357 @@ +/* ospf_mib_wrn_helper.h - header file for WindNet OSPF Enterprise MIB */ + +/* Copyright 1998-2003 Wind River, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +03l,07jan05,xli porting external route redistribution feature from ospf2.3.1 +01v,29jan04,ram NBMA, PTMP, & Unnumbered modifications +01u,08dec03,agi merged fixes from OSPF 2.1 patch branch, updated copyright + +01t,28may03,kc Fixed SPR#88863 - Added wrnOspfRedistributionTable support. +01s,27may03,kc Fixed wrnOspf2Mapi_if_create() prototype. All defines should + appear after the enumerations. +01r,27may03,kc Fixed SPR#88309 - added asBdrStatusChanged argument to the + mApi2Ospf_configRedistributeOpts() prototype. +01q,19nov02,mwv Merge TMS code SPR 84284 +01p,09aug02,kc Added createdAs member to mApiWrnOspfIf_t structure. +01o,08may03,kc Fixed SPR#88309 - added asBdrStatusChanged argument to the + mApi2Ospf_configRedistributeOpts() prototype. +01n,18apr02,kc Fixed SPR #74432 - Added mApi2Ospf_configRedistributeOpts() prototype. +01m,15feb02,kc Merged changes for wrnOspfIfTable support for unnumbered interface. +01l,04feb02,kc Added wrnOspfRedistributeDefaultRoutes, wrnOspfRedistributeStaticRoutes, + wrnOspfRedistributeRIPRoutes and wrnOspfRedistributeBGPRoutes scalar + objects enumeration values and definitions. +01k,16jan02,kc Added prototypes for wrnOspf2Mapi_lsdb_create(), + wrnOspf2Mapi_localLsdb_create() and wrnOspf2Mapi_extLsdb_create(). +01j,17dec01,kc Added wrnOspf_mApi_flushAllLsas() prototype. +01i,14dec01,kc Added wrnOspf_mApi_areaDelete() prototype. +01h,14dec01,kc Added resetAllToDefault boolean flag argument to + wrnOspf_mApi_initGeneralGroup(). +01g,28nov01,kc Changed wrnOspfLsdbAdvertisement, wrnOspfLocalLsdbAdvertisement and + wrnOspfExtLsdbAdvertisement from uchar_t to char. +01f,23oct01,kc Changed wrnOspfLsdbAge, wrnOspfLsdbChecksum, wrnOspfLocalLsdbAge, + wrnOspfLocalLsdbChecksum, wrnOspfExtLsdbAge and wrnOspfExtLsdbChecksum + from ushort_t to ulong_t. +01e,21oct01,kc Added mApi2Ospf_configWrnGenGroup() prototype. +01d,16oct01,kc Added the missing AVL_NODE member to each mApiWrnOspfXXX_t. +01c,13oct01,kc Added various wrnOspf2Mapi_xxx_delete() prototypes. +01b,13oct01,kc Added various wrnOspf2Mapi_xxx_update() prototypes. +01a,15aug01,kc Initial file creation. +*/ + +/* +DESCRIPTION +This file defines the WindNet OSPF Enterprise MIB specific Management Interface +Local ID enumerations, the MIB object enumerations, the MIB object sizes and +some function prototypes. + +INCLUDE FILES: N/A +*/ + +#ifndef __INCospf_mib_wrn_helperh +#define __INCospf_mib_wrn_helperh + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Defines */ + +/***************************************************************************** +* Management Interface Local ID enumerations for WindNet OSPF Enterprise MIB. +*/ +typedef enum { + mApiWrnOspfRFC1583Compatibility = 1, + mApiWrnOspfOpaqueLsaSupport, + mApiWrnOspfOriginateNewOpaqueLsas, + mApiWrnOspfRxNewOpaqueLsas, + mApiWrnOspfType9LsaCount, + mApiWrnOspfType9LsaCksumSum, + mApiWrnOspfType11LsaCount, + mApiWrnOspfType11LsaCksumSum, + mApiWrnOspfRedistributeDefaultRoutes, + mApiWrnOspfRedistributeStaticRoutes, + mApiWrnOspfRedistributeRIPRoutes, + mApiWrnOspfRedistributeBGPRoutes, + mApiWrnOspfRedistributeLocalRoutes, + mApiWrnOspfPtpRouterLsaOption, + mApiWrnOspfAreaId, /* mApiWrnOspf_t enumeration value = 15 */ + mApiWrnOspfAreaType10LsaCount, + mApiWrnOspfAreaType10LsaCksumSum, + mApiWrnOspfLsdbAreaId, /* mApiWrnOspf_t enumeration value = 18 */ + mApiWrnOspfLsdbType, + mApiWrnOspfLsdbLsid, + mApiWrnOspfLsdbRouterId, + mApiWrnOspfLsdbSequence, + mApiWrnOspfLsdbAge, + mApiWrnOspfLsdbChecksum, + mApiWrnOspfLsdbAdvertisement, + mApiWrnOspfLocalLsdbAreaId, /* mApiWrnOspf_t enumeration value = 26 */ + mApiWrnOspfLocalLsdbIpAddress, + mApiWrnOspfLocalLsdbType, + mApiWrnOspfLocalLsdbLsid, + mApiWrnOspfLocalLsdbRouterId, + mApiWrnOspfLocalLsdbSequence, + mApiWrnOspfLocalLsdbAge, + mApiWrnOspfLocalLsdbChecksum, + mApiWrnOspfLocalLsdbAdvertisement, + mApiWrnOspfExtLsdbType, /* mApiWrnOspf_t enumeration value = 35 */ + mApiWrnOspfExtLsdbLsid, + mApiWrnOspfExtLsdbRouterId, + mApiWrnOspfExtLsdbSequence, + mApiWrnOspfExtLsdbAge, + mApiWrnOspfExtLsdbChecksum, + mApiWrnOspfExtLsdbAdvertisement, + mApiWrnOspfIfDstIpAddress, /* mApiWrnOspf_t enumeration value = 42 */ + mApiWrnOspfIfIndex, + mApiWrnOspfIfStatus, + mApiWrnOspfRedistributionRouteType, /* mApiWrnOSPF_t enumeration value = 45 */ + mApiWrnOspfRedistributionSubnet, + mApiWrnOspfRedistributionMask, + mApiWrnOspfRedistributionType, + mApiWrnOspfRedistributionMetric, + mApiWrnOspfRedistributionStatus, + mApiWrnOspfLocalIfPassive, /* mApiWrnOSPF_t enumeration value = 51 */ + mApiWrnOspfToIpRouteSubnet, /* mApiWrnOspf_t enumberation value = 52 */ + mApiWrnOspfToIpRouteMask, + mApiWrnOspfToIpRouteWeight, + mApiWrnOspfToIpRouteStatus, + mApiWrnOspfMaxLocalIds /* 56 - Number of objects in wrnOspf */ +} mApiWrnOspf_t; + +/**************************************************************************** +* Management Interface WindNet OSPF Enterprise MIB object enumerations. +*/ + +typedef enum { + EmApiWrnOspfLsdbType_areaOpaqueLink = 10, + EmApiWrnOspfLocalLsdbType_localOpaqueLink = 9, + EmApiWrnOspfExtLsdbType_asOpaqueLink = 11 +} mApiWrnOspfOpaqueType_t; + +typedef enum { + EmApiWrnOspfPtpRouterLsaOption_1 = 1, + EmApiWrnOspfPtpRouterLsaOption_2 = 2 + +} mApiWrnOspfPtpRouterLsaOption_t; + +typedef enum { + EwrnOspfRedistribRouteType_default = 1, + EwrnOspfRedistribRouteType_static = 2, + EwrnOspfRedistribRouteType_rip = 3, + EwrnOspfRedistribRouteType_bgp = 4, + EwrnOspfRedistribRouteType_local = 5 +} mApiWrnOspfRedistribRouteType_t; + +typedef enum { + EwrnOspfRedistribType_externalType1 = 1, + EwrnOspfRedistribType_externalType2 = 2 +} mApiWrnOspfRedistribType_t; + +/**************************************************************************** +* Management Interface WindNet OSPF Enterprise MIB Definitions. +*/ +/* the following defines provides the number of sub-identifier (the instance length) + * of each table in the WRN OSPF Enterprise MIB. + */ +#define MAX_OSPF_WEIGHT_VALUE 255L +#define OSPF_LOCAL_LSDB_INSTANCE_LEN 17 +#define OSPF_WRN_INTF_INSTANCE_LEN 4 +#define OSPF_WRN_REDISTRIBUTION_INSTANCE_LEN 9 + +#define OSPF_WRN_TO_IP_ROUTE_INSTACE_LEN 8 +/* WRN-OSPF Enterprise MIB default values */ +#define DEFVAL_mApiWrnOspfRedistribType EwrnOspfRedistribType_externalType2 +#define DEFVAL_mApiWrnOspfRedistribMetric 20 +#define DEFVAL_mApiWrnOspfToIpRouteWeight 110 + +/**************************************************************************** +* Management Interface WindNet OSPF Enterprise MIB Data Structure. +*/ +typedef struct mApiWrnOspfGenGroup +{ + mApiOspfTrueValue_t wrnOspfRFC1583Compatibility; /* read-write */ + mApiOspfTrueValue_t wrnOspfOpaqueLsaSupport; /* read-write */ + ulong_t wrnOspfOriginateNewOpaqueLsas; /* read-only */ + ulong_t wrnOspfRxNewOpaqueLsas; /* read-only */ + ulong_t wrnOspfType9LsaCount; /* read-only */ + ulong_t wrnOspfType9LsaCksumSum; /* read-only */ + ulong_t wrnOspfType11LsaCount; /* read-only */ + ulong_t wrnOspfType11LsaCksumSum; /* read-only */ + mApiOspfTrueValue_t wrnOspfRedistributeDefaultRoutes; /* read-write */ + mApiOspfTrueValue_t wrnOspfRedistributeStaticRoutes; /* read-write */ + mApiOspfTrueValue_t wrnOspfRedistributeRIPRoutes; /* read-write */ + mApiOspfTrueValue_t wrnOspfRedistributeBGPRoutes; /* read-write */ + mApiOspfTrueValue_t wrnOspfRedistributeLocalRoutes; /* read-write */ + ushort_t wrnOspfPtpRouterLsaOption; /* read-write */ +} mApiWrnOspfGenGroup_t; + +/* Type-10 Opaque LSA cumulative statistics contained in an Area */ +typedef struct mApiWrnOspfArea +{ + AVL_NODE node; /* AVL Tree node */ + ulong_t wrnOspfAreaId; /* index object, read-only */ + ulong_t wrnOspfAreaType10LsaCount; /* read-only */ + ulong_t wrnOspfAreaType10LsaCksumSum; /* read-only */ +} mApiWrnOspfArea_t; + +/* Type-10 Opaque LSA, have an area-local scope */ +typedef struct mApiWrnOspfLsdb +{ + AVL_NODE node; /* AVL Tree node */ + ulong_t wrnOspfLsdbAreaId; /* index object, read-only */ + mApiWrnOspfOpaqueType_t wrnOspfLsdbType; /* index object, read-only */ + ulong_t wrnOspfLsdbLsid; /* index object, read-only */ + ulong_t wrnOspfLsdbRouterId; /* index object, read-only */ + long wrnOspfLsdbSequence; /* read-only */ + ulong_t wrnOspfLsdbAge; /* read-only */ + ulong_t wrnOspfLsdbChecksum; /* read-only */ + char *wrnOspfLsdbAdvertisement; /* read-only */ + ushort_t lsdbLen; /* length of wrnOspfLsdbAdvertisement */ + +} mApiWrnOspfLsdb_t; + +/* Type-9 Opaque LSA, have a link-local scope */ +typedef struct mApiWrnOspfLocalLsdb +{ + AVL_NODE node; /* AVL Tree node */ + ulong_t wrnOspfLocalLsdbAreaId; /* index object, read-only */ + ulong_t wrnOspfLocalLsdbIpAddress; /* index object, read-only */ + mApiWrnOspfOpaqueType_t wrnOspfLocalLsdbType; /* index object, read-only */ + ulong_t wrnOspfLocalLsdbLsid; /* index object, read-only */ + ulong_t wrnOspfLocalLsdbRouterId; /* index object, read-only */ + long wrnOspfLocalLsdbSequence; /* read-only */ + ulong_t wrnOspfLocalLsdbAge; /* read-only */ + ulong_t wrnOspfLocalLsdbChecksum; /* read-only */ + char *wrnOspfLocalLsdbAdvertisement; /* read-only */ + ushort_t lsdbLen; /* length of wrnOspfLocalLsdbAdvertisement */ +} mApiWrnOspfLocalLsdb_t; + +/* Type-11 Opaque LSA, have an Autonomous system-wide scope */ +typedef struct mApiWrnOspfExtLsdb +{ + AVL_NODE node; /* AVL Tree node */ + mApiWrnOspfOpaqueType_t wrnOspfExtLsdbType; /* index object, read-only */ + ulong_t wrnOspfExtLsdbLsid; /* index object, read-only */ + ulong_t wrnOspfExtLsdbRouterId; /* index object, read-only */ + long wrnOspfExtLsdbSequence; /* read-only */ + ulong_t wrnOspfExtLsdbAge; /* read-only */ + ulong_t wrnOspfExtLsdbChecksum; /* read-only */ + char *wrnOspfExtLsdbAdvertisement; /* read-only */ + ushort_t lsdbLen; /* length of wrnOspfExtLsdbAdvertisement */ +} mApiWrnOspfExtLsdb_t; + +/* objects associated with wrnOspfIfTable */ +typedef struct mApiWrnOspfIf +{ + AVL_NODE node; /* AVL Tree node */ + rsAction_t createdAs; /* the method this row is created */ + ulong_t wrnOspfIfDstIpAddress; /* index object, read-only */ + ulong_t wrnOspfIfIndex; /* read-only */ + mApiOspfRowStatus_t wrnOspfIfStatus; /* read-create */ +} mApiWrnOspfIf_t; + +/* objects associated with wrnOspfRedistributionTable */ +typedef struct mApiWrnOspfRedistribution +{ + AVL_NODE node; /* AVL Tree node */ + rsAction_t createdAs; /* the method this row is created */ + mApiWrnOspfRedistribRouteType_t wrnOspfRedistribRouteType; /* index object, read-only */ + ulong_t wrnOspfRedistribSubnet; /* index object, read-only */ + ulong_t wrnOspfRedistribMask; /* index object, read-only */ + mApiWrnOspfRedistribType_t wrnOspfRedistribType; /* read-create */ + ulong_t wrnOspfRedistribMetric; /* read-create */ + mApiOspfRowStatus_t wrnOspfRedistribStatus; /* read-create */ +} mApiWrnOspfRedistrib_t; +typedef struct mApiWrnOspf2IpRoute +{ + AVL_NODE node; /* AVL Tree node */ + rsAction_t createdAs; /* the method this row is created */ + ulong_t wrnOspfToIpRouteSubnet; /* index object, read-only */ + ulong_t wrnOspfToIpRouteMask; /* index object, read-only */ + ulong_t wrnOspfToIpRouteWeight; /* read-create */ + mApiOspfRowStatus_t wrnOspfToIpRouteStatus; /* read-create */ + BOOL searchIpRouteTbl; /* if set, search IP Routing Table */ +} mApiWrnOspf2IpRoute_t; + +/**************************************************************************** +* Management Interface WindNet OSPF Enterprise MIB Function Prototypes. +*/ + +/* wrnOspfGeneralGroup helper routines */ +IMPORT STATUS wrnOspf_mApi_globalParmGet( mApiWrnOspfGenGroup_t *thisGenGroup, + mApiRequest_t *pRequest, + mApiObject_t *pObject ); +IMPORT STATUS wrnOspf_mApi_globalParmSet( mApiRequest_t *pRequest, mApiObject_t *pObject, + mApiReqType_t reqType ); +IMPORT STATUS mApi2Ospf_configWrnGenGroup( void *pGenParams ); +IMPORT void mApi2Ospf_configRedistributeOpts( void *pGenParams, BOOL asBdrStatusChanged ); + +/* wrnOspfAreaTable helper routines */ +IMPORT STATUS wrnOspf_mApi_areaHelperGet( void *pRow, mApiRequest_t *pRequest, + mApiObject_t *pObject ); +IMPORT void wrnOspf2Mapi_area_update( void *pOspfReqBuf ); + +IMPORT void wrnOspf_mApi_areaDelete( ulong_t wrnOspfAreaId ); + +/* clean up routines for wrn-ospf enterprise mib */ +IMPORT void wrnOspf_mApi_flushAllLsas( BOOL resetAllToDefault ); + +/* wrnOspfLasbTable helper routine */ +IMPORT STATUS wrnOspf_mApi_lsdbHelperGet( void *pRow, mApiRequest_t *pRequest, + mApiObject_t *pObject ); +IMPORT void wrnOspf2Mapi_lsdb_update( void *pOspf2MapiReqBuf ); +IMPORT void wrnOspf2Mapi_lsdb_create( void *pOspf2MapiReqBuf ); +IMPORT void wrnOspf2Mapi_lsdb_delete( void *pOspf2MapiReqBuf ); + +/* wrnOspfLocalLasbTable helper routine */ +IMPORT STATUS wrnOspf_mApi_localLsdbHelperGet( void *pRow, mApiRequest_t *pRequest, + mApiObject_t *pObject ); +IMPORT void wrnOspf2Mapi_localLsdb_update( void *pOspf2MapiReqBuf ); +IMPORT void wrnOspf2Mapi_localLsdb_create( void *pOspf2MapiReqBuf ); +IMPORT void wrnOspf2Mapi_localLsdb_delete( void *pOspf2MapiReqBuf ); + +/* wrnOspfExtLsdbTable helper routines */ +IMPORT STATUS wrnOspf_mApi_extLsdbHelperGet( void *pRow, mApiRequest_t *pRequest, + mApiObject_t *pObject ); +IMPORT void wrnOspf2Mapi_extLsdb_update( void *pOspf2MapiReqBuf ); +IMPORT void wrnOspf2Mapi_extLsdb_create( void *pOspf2MapiReqBuf ); +IMPORT void wrnOspf2Mapi_extLsdb_delete( void *pOspf2MapiReqBuf ); + +/* wrnOspfIfTable helper routines */ +IMPORT STATUS wrnOspf_mApi_ifHelperGet( void *pRow, mApiRequest_t *pRequest, + mApiObject_t *pObject ); +IMPORT STATUS wrnOspf_mApi_ifHelperSet( mApiRequest_t *pRequest, + rsRequest_t rsReqType ); +IMPORT void wrnOspf2Mapi_if_create( void *pOspf2MapiReqBuf ); + +/* wrnOspfRedistributionTable helper routines */ +IMPORT STATUS wrnOspf_mApi_redistribHelperGet( void *pRow, mApiRequest_t *pRequest, + mApiObject_t *pObject ); +IMPORT STATUS wrnOspf_mApi_redistribHelperSet( mApiRequest_t *pRequest, + rsRequest_t rsReqType ); +IMPORT void wrnOspf2Mapi_redistrib_create( void *pOspf2MapiReqBuf ); + +IMPORT STATUS wrnOspf_mApi_ospf2IpRouteHelperGet( void *pRow, mApiRequest_t *pRequest, + mApiObject_t *pObject ); +IMPORT STATUS wrnOspf_mApi_ospf2IpRouteHelperSet( mApiRequest_t *pRequest, + rsRequest_t rsReqType ); +IMPORT void wrnOspf2Mapi_ospf2IpRoute_create( void *pOspf2MapiReqBuf ); +/* wrn-ospf mib specific initialization routines */ +IMPORT STATUS wrnOspf_mApi_initAvlTree( void ); +IMPORT void wrnOspf_mApi_initGeneralGroup( BOOL resetAllToDefault ); +IMPORT STATUS wrnOspf_mApi_initRsLib( void ); +IMPORT STATUS wrnOspf_mApi_configurationGet( void ); +IMPORT STATUS wrnOspf_mApi_localIfHelperSet ( + mApiRequest_t *pRequest, rsRequest_t rsReqType ); +IMPORT STATUS wrnOspf_mApi_localIfHelperGet ( + void *pRow, mApiRequest_t *pRequest, mApiObject_t *pObject ); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCospf_mib_wrn_helperh */ diff --git a/h/wrn/ospf/ospf_mib_wrn_leaf.h b/h/wrn/ospf/ospf_mib_wrn_leaf.h new file mode 100644 index 0000000..2e31706 --- /dev/null +++ b/h/wrn/ospf/ospf_mib_wrn_leaf.h @@ -0,0 +1,145 @@ +/****************************************************************************** + **** This file was automatically generated by Epilogue Technology's + **** Emissary SNMP MIB Compiler, version 9.1. + **** This file was generated using the -leaf switch. + **** + **** This file #defines C preprocessor macros providing a variety of + **** information for the leaf objects in the MIB. + **** + **** The file includes a LEAF_xxx macro for each leaf object in the + **** MIB (xxx is replaced by the object's name). The value of the + **** LEAF_xxx macro is the final component of the object's object + **** identifier. + **** + **** If the object's SYNTAX clause included named INTEGER values, + **** then there is a VAL_xxx_yyy macro for each named value (xxx is + **** replaced by the object's name and yyy by the value's name). The + **** value of the VAL_xxx_yyy macro is the value associated with the + **** named value. + **** + **** If the object's SYNTAX clause specified a set of range limitations + **** for the value of the object, then there are one or more sets of + **** MIN_xxx and MAX_xxx macros specifying the lower and upper bound of + **** each range limitation. + **** + **** If the object's SYNTAX clause specified a set of size constraints + **** for the value of the object, then there are one or more sets of + **** MINSIZE_xxx and MAXSIZE_xxx macros specifying the lower and upper + **** bound of each size constraint. (If the size constraint is a single + **** value rather than a range then the MINSIZE_xxx and MAXSIZE_xxx + **** macros are replaced by a single SIZE_xxx macro.) + **** + **** Last build date: Tue Dec 17 15:08:41 2003 + **** from files: + **** rfc1213.mib, rfc1850.mi2, wrsMasterMib.mi2, ospf_mib_wrnospf.mi2, + **** wrnOspf.ctl + ****************************************************************************** + */ + +#define LEAF_wrnOspfRFC1583Compatibility 1 +#define VAL_wrnOspfRFC1583Compatibility_true 1L +#define VAL_wrnOspfRFC1583Compatibility_false 2L +#define LEAF_wrnOspfOpaqueLsaSupport 2 +#define VAL_wrnOspfOpaqueLsaSupport_true 1L +#define VAL_wrnOspfOpaqueLsaSupport_false 2L +#define LEAF_wrnOspfOriginateNewOpaqueLsas 3 +#define LEAF_wrnOspfRxNewOpaqueLsas 4 +#define LEAF_wrnOspfType9LsaCount 5 +#define LEAF_wrnOspfType9LsaCksumSum 6 +#define LEAF_wrnOspfType11LsaCount 7 +#define LEAF_wrnOspfType11LsaCksumSum 8 +#define LEAF_wrnOspfRedistributeDefaultRoutes 9 +#define VAL_wrnOspfRedistributeDefaultRoutes_true 1L +#define VAL_wrnOspfRedistributeDefaultRoutes_false 2L +#define LEAF_wrnOspfRedistributeStaticRoutes 10 +#define VAL_wrnOspfRedistributeStaticRoutes_true 1L +#define VAL_wrnOspfRedistributeStaticRoutes_false 2L +#define LEAF_wrnOspfRedistributeRIPRoutes 11 +#define VAL_wrnOspfRedistributeRIPRoutes_true 1L +#define VAL_wrnOspfRedistributeRIPRoutes_false 2L +#define LEAF_wrnOspfRedistributeBGPRoutes 12 +#define VAL_wrnOspfRedistributeBGPRoutes_true 1L +#define VAL_wrnOspfRedistributeBGPRoutes_false 2L +#define LEAF_wrnOspfRedistributeLocalRoutes 13 +#define VAL_wrnOspfRedistributeLocalRoutes_true 1L +#define VAL_wrnOspfRedistributeLocalRoutes_false 2L +#define LEAF_wrnOspfAreaId 1 +#define LEAF_wrnOspfAreaType10LsaCount 2 +#define LEAF_wrnOspfAreaType10LsaCksumSum 3 +#define LEAF_wrnOspfLsdbAreaId 1 +#define LEAF_wrnOspfLsdbType 2 +#define VAL_wrnOspfLsdbType_areaOpaqueLink 10L +#define LEAF_wrnOspfLsdbLsid 3 +#define LEAF_wrnOspfLsdbRouterId 4 +#define LEAF_wrnOspfLsdbSequence 5 +#define LEAF_wrnOspfLsdbAge 6 +#define LEAF_wrnOspfLsdbChecksum 7 +#define LEAF_wrnOspfLsdbAdvertisement 8 +#define SIZE_wrnOspfLsdbAdvertisement 36L +#define LEAF_wrnOspfLocalLsdbAreaId 1 +#define LEAF_wrnOspfLocalLsdbIpAddress 2 +#define LEAF_wrnOspfLocalLsdbType 3 +#define VAL_wrnOspfLocalLsdbType_localOpaqueLink 9L +#define LEAF_wrnOspfLocalLsdbLsid 4 +#define LEAF_wrnOspfLocalLsdbRouterId 5 +#define LEAF_wrnOspfLocalLsdbSequence 6 +#define LEAF_wrnOspfLocalLsdbAge 7 +#define LEAF_wrnOspfLocalLsdbChecksum 8 +#define LEAF_wrnOspfLocalLsdbAdvertisement 9 +#define MINSIZE_wrnOspfLocalLsdbAdvertisement 1L +#define MAXSIZE_wrnOspfLocalLsdbAdvertisement 65535L +#define LEAF_wrnOspfExtLsdbType 1 +#define VAL_wrnOspfExtLsdbType_asOpaqueLink 11L +#define LEAF_wrnOspfExtLsdbLsid 2 +#define LEAF_wrnOspfExtLsdbRouterId 3 +#define LEAF_wrnOspfExtLsdbSequence 4 +#define LEAF_wrnOspfExtLsdbAge 5 +#define LEAF_wrnOspfExtLsdbChecksum 6 +#define LEAF_wrnOspfExtLsdbAdvertisement 7 +#define SIZE_wrnOspfExtLsdbAdvertisement 36L +#define LEAF_wrnOspfIfDstIpAddress 1 +#define LEAF_wrnOspfIfIndex 2 +#define LEAF_wrnOspfIfStatus 3 +#define VAL_wrnOspfIfStatus_active 1L +#define VAL_wrnOspfIfStatus_notInService 2L +#define VAL_wrnOspfIfStatus_notReady 3L +#define VAL_wrnOspfIfStatus_createAndGo 4L +#define VAL_wrnOspfIfStatus_createAndWait 5L +#define VAL_wrnOspfIfStatus_destroy 6L +#define LEAF_wrnOspfRedistributionRouteType 1 +#define VAL_wrnOspfRedistributionRouteType_default 1L +#define VAL_wrnOspfRedistributionRouteType_static 2L +#define VAL_wrnOspfRedistributionRouteType_rip 3L +#define VAL_wrnOspfRedistributionRouteType_bgp 4L +#define VAL_wrnOspfRedistributionRouteType_local 5L +#define LEAF_wrnOspfRedistributionSubnet 2 +#define LEAF_wrnOspfRedistributionMask 3 +#define LEAF_wrnOspfRedistributionType 4 +#define VAL_wrnOspfRedistributionType_externalType1 1L +#define VAL_wrnOspfRedistributionType_externalType2 2L +#define LEAF_wrnOspfRedistributionMetric 5 +#define MIN_wrnOspfRedistributionMetric 0L +#define MAX_wrnOspfRedistributionMetric 65535L +#define LEAF_wrnOspfRedistributionStatus 6 +#define VAL_wrnOspfRedistributionStatus_active 1L +#define VAL_wrnOspfRedistributionStatus_notInService 2L +#define VAL_wrnOspfRedistributionStatus_notReady 3L +#define VAL_wrnOspfRedistributionStatus_createAndGo 4L +#define VAL_wrnOspfRedistributionStatus_createAndWait 5L +#define VAL_wrnOspfRedistributionStatus_destroy 6L +#define LEAF_wrnOspfLocalIfPassive 1 +#define VAL_wrnOspfLocalIfPassive_true 1L +#define VAL_wrnOspfLocalIfPassive_false 2L +#define LEAF_wrnOspfToIpRouteSubnet 1 +#define LEAF_wrnOspfToIpRouteMask 2 +#define LEAF_wrnOspfToIpRouteWeight 3 +#define MIN_wrnOspfToIpRouteWeight 1L +#define MAX_wrnOspfToIpRouteWeight 255L +#define LEAF_wrnOspfToIpRouteStatus 4 +#define VAL_wrnOspfToIpRouteStatus_active 1L +#define VAL_wrnOspfToIpRouteStatus_notInService 2L +#define VAL_wrnOspfToIpRouteStatus_notReady 3L +#define VAL_wrnOspfToIpRouteStatus_createAndGo 4L +#define VAL_wrnOspfToIpRouteStatus_createAndWait 5L +#define VAL_wrnOspfToIpRouteStatus_destroy 6L + diff --git a/h/wrn/ospf/ospf_mib_wrn_skel.h b/h/wrn/ospf/ospf_mib_wrn_skel.h new file mode 100644 index 0000000..d51faf1 --- /dev/null +++ b/h/wrn/ospf/ospf_mib_wrn_skel.h @@ -0,0 +1,54 @@ +/****************************************************************************** + ****************************************************************************** + **** This file was automatically generated by Epilogue Technology's + **** Emissary SNMP MIB Compiler, version 9.1. + **** This file was generated using the -skel.h switch. + **** + **** This file contains declarations of stub functions to aid in building + **** the agent MIB interface. It declares all the MIB get, set, test and + **** next method routines that you will need to supply. You'll probably + **** want to FORCE-INCLUDE this file when using the -mib.c output mode. + **** + **** To generate the skeletal stub functions themselves, run Emissary + **** with the -skel switch. + **** + **** YOU MAY MODIFY THIS FILE BUT BEWARE ACCIDENTALLY OVERWRITING IT + **** BY REGENERATING IT WITH THE MIB COMPILER. + **** + **** Last build date: Tue Dec 17 15:08:34 2003 + **** from files: + **** rfc1213.mib, rfc1850.mi2, wrsMasterMib.mi2, ospf_mib_wrnospf.mi2, + **** wrnOspf.ctl + ****************************************************************************** + ****************************************************************************** + */ + +void wrnOspfGeneralGroup_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfGeneralGroup_set(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfGeneralGroup_test(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfGeneralGroup_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void null_test_async(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfAreaEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfAreaEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfLsdbEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfLsdbEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfLocalLsdbEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfLocalLsdbEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfExtLsdbEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfExtLsdbEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfUnnumberedIfEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfUnnumberedIfEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfUnnumberedIfEntry_set(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfUnnumberedIfEntry_test(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfRedistributionEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfRedistributionEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfRedistributionEntry_set(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfRedistributionEntry_test(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfLocalIfEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfLocalIfEntry_set(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfLocalIfEntry_test(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfLocalIfEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfToIpRouteEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfToIpRouteEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfToIpRouteEntry_set(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfToIpRouteEntry_test(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); diff --git a/h/wrn/ospf/ospf_neighbor_state_machine.h b/h/wrn/ospf/ospf_neighbor_state_machine.h new file mode 100644 index 0000000..e24e8bf --- /dev/null +++ b/h/wrn/ospf/ospf_neighbor_state_machine.h @@ -0,0 +1,213 @@ +/* ospf_neighbor_state_machine.h */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/*modification history +___________________ + 18,26september00,reshma Added WindRiver CopyRight + 17,25september00,reshma RFC-1587 implementation for OSPF NSSA Option, also tested against ANVL. + 16,20july00,reshma Unix compatibility related changes. + 15,06july00,reshma Removed unnecessary header files and defines. + 14,04april00,reshma Added some MIB support (Read only). + Passed all important ANVL OSPF tests. + 13,23december99,reshma Compatibility with VxWorks-IP and VxWorks RTM-interface + 12,19may99,jack redefined OSPF_PATRICIA_32_BITS_KEY_MAX_BIT_POSITION as per fixes in + patricia + 11,28december98,jack Compiled and added some comments + 10,11november98,jack Config changes, linted and big endian changes + 09,30october98,jack Incorporate changes for compilation on Vxworks + 08,23august98,jack ANVL tested OSPF with PATRICIA tree route table and no recursion + 07,10august98,jack PATRICIA Route Table Based OSPF Code Base + 06,08july98,jack Patricia RT table related changes - need to be tested + 05,04june98,jack Integration with RTM and BGP + 04,10july97,cindy Pre-release v1.52b + 03,10february97,cindy Release Version 1.52 + 02,22october97,cindy Release Version 1.50 + 01,05june96,cindy First Beta Release +*/ + +#if !defined (_OSPF_NEIGHBOR_STATE_MACHINE_H_) +#define _OSPF_NEIGHBOR_STATE_MACHINE_H_ + +typedef struct OSPF_NEIGHBOR_STATE_MACHINE +{ + void (*fptr_neighbor_transition_function) (OSPF_INTERFACE *sptr_interface,OSPF_NEIGHBOR *sptr_neighbor,enum OSPF_NEIGHBOR_EVENT event); +} OSPF_NEIGHBOR_STATE_MACHINE; + +typedef void (*NEIGHBOR_TRANSITION_FUNCTION) (OSPF_INTERFACE *sptr_interface,OSPF_NEIGHBOR *sptr_neighbor,enum OSPF_NEIGHBOR_EVENT event); + +OSPF_NEIGHBOR_STATE_MACHINE ospf_neighbor_event_processing_table[OSPF_NUMBER_OF_NEIGHBOR_EVENTS][OSPF_NUMBER_OF_NEIGHBOR_STATES] = +{ +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPF_HELLO_RECEIVED 0 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPF_NEIGHBOR_DOWN */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_hello_received_event}, +/* OSPF_NEIGHBOR_ATTEMPT */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_hello_received_event}, +/* OSPF_NEIGHBOR_INITIALIZING */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_hello_received_event}, +/* OSPF_NEIGHBOR_2_WAY */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_hello_received_event}, +/* OSPF_NEIGHBOR_EXCHANGE_START */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_hello_received_event}, +/* OSPF_NEIGHBOR_EXCHANGE */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_hello_received_event}, +/* OSPF_NEIGHBOR_LOADING */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_hello_received_event}, +/* OSPF_NEIGHBOR_FULL */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_hello_received_event} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPF_START 1 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPF_NEIGHBOR_DOWN */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_start_event}, +/* OSPF_NEIGHBOR_ATTEMPT */ {NULL}, +/* OSPF_NEIGHBOR_INITIALIZING */ {NULL}, +/* OSPF_NEIGHBOR_2_WAY */ {NULL}, +/* OSPF_NEIGHBOR_EXCHANGE_START */ {NULL}, +/* OSPF_NEIGHBOR_EXCHANGE */ {NULL}, +/* OSPF_NEIGHBOR_LOADING */ {NULL}, +/* OSPF_NEIGHBOR_FULL */ {NULL} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPF_TWO_WAY_RECEIVED 2 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPF_NEIGHBOR_DOWN */ {NULL}, +/* OSPF_NEIGHBOR_ATTEMPT */ {NULL}, +/* OSPF_NEIGHBOR_INITIALIZING */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_2_way_received_event}, +/* OSPF_NEIGHBOR_2_WAY */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_2_way_received_event} /* ### */, +/* OSPF_NEIGHBOR_EXCHANGE_START */ {NULL}, +/* OSPF_NEIGHBOR_EXCHANGE */ {NULL}, +/* OSPF_NEIGHBOR_LOADING */ {NULL}, +/* OSPF_NEIGHBOR_FULL */ {NULL} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPF_NEGOTIATION_DONE 3 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPF_NEIGHBOR_DOWN */ {NULL}, +/* OSPF_NEIGHBOR_ATTEMPT */ {NULL}, +/* OSPF_NEIGHBOR_INITIALIZING */ {NULL}, +/* OSPF_NEIGHBOR_2_WAY */ {NULL}, +/* OSPF_NEIGHBOR_EXCHANGE_START */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_negotiation_done_event}, +/* OSPF_NEIGHBOR_EXCHANGE */ {NULL}, +/* OSPF_NEIGHBOR_LOADING */ {NULL}, +/* OSPF_NEIGHBOR_FULL */ {NULL} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPF_EXCHANGE_DONE 4 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPF_NEIGHBOR_DOWN */ {NULL}, +/* OSPF_NEIGHBOR_ATTEMPT */ {NULL}, +/* OSPF_NEIGHBOR_INITIALIZING */ {NULL}, +/* OSPF_NEIGHBOR_2_WAY */ {NULL}, +/* OSPF_NEIGHBOR_EXCHANGE_START */ {NULL}, +/* OSPF_NEIGHBOR_EXCHANGE */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_exchange_done_event}, +/* OSPF_NEIGHBOR_LOADING */ {NULL}, +/* OSPF_NEIGHBOR_FULL */ {NULL} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPF_BAD_LINK_STATE_REQUEST 5 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPF_NEIGHBOR_DOWN */ {NULL}, +/* OSPF_NEIGHBOR_ATTEMPT */ {NULL}, +/* OSPF_NEIGHBOR_INITIALIZING */ {NULL}, +/* OSPF_NEIGHBOR_2_WAY */ {NULL}, +/* OSPF_NEIGHBOR_EXCHANGE_START */ {NULL}, +/* OSPF_NEIGHBOR_EXCHANGE */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_tear_down_and_reestablish_adjacency}, +/* OSPF_NEIGHBOR_LOADING */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_tear_down_and_reestablish_adjacency}, +/* OSPF_NEIGHBOR_FULL */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_tear_down_and_reestablish_adjacency} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPF_LOADING_DONE 6 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPF_NEIGHBOR_DOWN */ {NULL}, +/* OSPF_NEIGHBOR_ATTEMPT */ {NULL}, +/* OSPF_NEIGHBOR_INITIALIZING */ {NULL}, +/* OSPF_NEIGHBOR_2_WAY */ {NULL}, +/* OSPF_NEIGHBOR_EXCHANGE_START */ {NULL}, +/* OSPF_NEIGHBOR_EXCHANGE */ {NULL}, +/* OSPF_NEIGHBOR_LOADING */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_loading_done_event}, +/* OSPF_NEIGHBOR_FULL */ {NULL} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPF_ADJACENCY_OK 7 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPF_NEIGHBOR_DOWN */ {NULL}, +/* OSPF_NEIGHBOR_ATTEMPT */ {NULL}, +/* OSPF_NEIGHBOR_INITIALIZING */ {NULL}, +/* OSPF_NEIGHBOR_2_WAY */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_start_forming_an_adjacency_with_the_neighbor}, +/* OSPF_NEIGHBOR_EXCHANGE_START */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_maintain_or_destroy_existing_adjacency}, +/* OSPF_NEIGHBOR_EXCHANGE */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_maintain_or_destroy_existing_adjacency}, +/* OSPF_NEIGHBOR_LOADING */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_maintain_or_destroy_existing_adjacency}, +/* OSPF_NEIGHBOR_FULL */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_maintain_or_destroy_existing_adjacency} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPF_SEQUENCE_NUMBER_MISMATCH 8 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPF_NEIGHBOR_DOWN */ {NULL}, +/* OSPF_NEIGHBOR_ATTEMPT */ {NULL}, +/* OSPF_NEIGHBOR_INITIALIZING */ {NULL}, +/* OSPF_NEIGHBOR_2_WAY */ {NULL}, +/* OSPF_NEIGHBOR_EXCHANGE_START */ {NULL}, +/* OSPF_NEIGHBOR_EXCHANGE */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_tear_down_and_reestablish_adjacency}, +/* OSPF_NEIGHBOR_LOADING */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_tear_down_and_reestablish_adjacency}, +/* OSPF_NEIGHBOR_FULL */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_tear_down_and_reestablish_adjacency} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPF_ONE_WAY 9 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPF_NEIGHBOR_DOWN */ {NULL}, +/* OSPF_NEIGHBOR_ATTEMPT */ {NULL}, +/* OSPF_NEIGHBOR_INITIALIZING */ {NULL}, +/* OSPF_NEIGHBOR_2_WAY */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_1_way_received_event}, +/* OSPF_NEIGHBOR_EXCHANGE_START */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_1_way_received_event}, +/* OSPF_NEIGHBOR_EXCHANGE */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_1_way_received_event}, +/* OSPF_NEIGHBOR_LOADING */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_1_way_received_event}, +/* OSPF_NEIGHBOR_FULL */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_1_way_received_event} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPF_KILL_NEIGHBOR 10 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPF_NEIGHBOR_DOWN */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_down_event}, +/* OSPF_NEIGHBOR_ATTEMPT */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_down_event}, +/* OSPF_NEIGHBOR_INITIALIZING */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_down_event}, +/* OSPF_NEIGHBOR_2_WAY */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_down_event}, +/* OSPF_NEIGHBOR_EXCHANGE_START */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_down_event}, +/* OSPF_NEIGHBOR_EXCHANGE */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_down_event}, +/* OSPF_NEIGHBOR_LOADING */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_down_event}, +/* OSPF_NEIGHBOR_FULL */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_down_event} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPF_INACTIVITY_TIMER 11 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPF_NEIGHBOR_DOWN */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_down_event}, +/* OSPF_NEIGHBOR_ATTEMPT */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_down_event}, +/* OSPF_NEIGHBOR_INITIALIZING */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_down_event}, +/* OSPF_NEIGHBOR_2_WAY */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_down_event}, +/* OSPF_NEIGHBOR_EXCHANGE_START */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_down_event}, +/* OSPF_NEIGHBOR_EXCHANGE */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_down_event}, +/* OSPF_NEIGHBOR_LOADING */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_down_event}, +/* OSPF_NEIGHBOR_FULL */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_down_event} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPF_DOWN_INDICATION_FROM_LOWER_LEVEL_PROTOCOLS_RECEIVED 12 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPF_NEIGHBOR_DOWN */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_down_event}, +/* OSPF_NEIGHBOR_ATTEMPT */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_down_event}, +/* OSPF_NEIGHBOR_INITIALIZING */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_down_event}, +/* OSPF_NEIGHBOR_2_WAY */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_down_event}, +/* OSPF_NEIGHBOR_EXCHANGE_START */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_down_event}, +/* OSPF_NEIGHBOR_EXCHANGE */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_down_event}, +/* OSPF_NEIGHBOR_LOADING */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_down_event}, +/* OSPF_NEIGHBOR_FULL */ {(NEIGHBOR_TRANSITION_FUNCTION) ospf_process_neighbor_down_event} +} +}; + + +#endif /* _OSPF_NEIGHBOR_STATE_MACHINE_H_ */ diff --git a/h/wrn/ospf/ospf_prototypes.h b/h/wrn/ospf/ospf_prototypes.h new file mode 100644 index 0000000..1d07279 --- /dev/null +++ b/h/wrn/ospf/ospf_prototypes.h @@ -0,0 +1,1118 @@ +/* ospf_prototypes.h - OSPF prototypes */ + +/* Copyright 2000-2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +04u,25feb05,xli added ospfShowAreas(),ospfShowInterface()and ospfShowNeighbor() prototypes + used by ospf_show_routines.c +04t,31jan05,mwv SPR#106007 change the prototype for + ospf_add_database_entry_to_neighbor_retransmit_list + ospf_add_neighbor_to_database_retransmit_list +05u,24jan05,mwv SPR#105819 modify ospf_calculate_routes_to_external_destinations () +05t,03nov04,dsk trace B0456 +05s,07oct04,mwv SPR#100658: added + ospf_process_old_ls_summary_summaryASBR_and_external_advertisements () + to prototypes list +05r,11aug04,mwv SPR#100246 correct dangling pointer in + ospf_print_memory_error_message_and_free_buffer_if_necessary () +05q,23sep04,tlu Fix for ANVL 27.27 and 31.2 - add advertising router parameter to + ospf_find_network_LSA +05p,02sep04,ram Fix function prototypes +05o,04aug04,dsk get_port_number_and_string (multiple definition if INCLUDE_NVRAM) +05n,06may04,ram Fix for AVL memory corruption +05m,30apr04,mwv SPR#91272 added ospf_originate_summary_link_into_stub_area () + added ospf_dynamic_send_summary_lsa_for_stub_area () +05l,22apr04,ram AVL & Memory migration to shared library +05k,16apr04,zhr compile with the IP dual stack CD +05j,06apr04,ram OSPF v2/v3 coexistance changes +05i,15mar04,zhr changed prototype of ospf_dynamic_config_redistribution +05h,12mar04,mwv SPR#94408 - modify redistribution API to support route tag +05g,12mar04,ram SPR#94944 OSPF performance modifications +05f,04mar04,mwv SPR#93561 added ospf_long_swap to do byte order swapping + for BIG ENDIAN +05e,29jan04,ram NBMA, PTMP, & Unnumbered modifications +05d,16dec03,agi propogated weighted routes fixes +05c,08dec03,agi merged fixes from OSPF 2.1 patch branch +05b,01dec03,agi MD_ALGORITHM mods, ported to merged stack +05a,06aug03,agi ported to Accordion stack +04y,01nov03,kc SPR#91541 - added ospf_set_ip_route_policy(), ospf_ip_route_policy_get(), + ospf_dynamic_config_ip_route_policy(), ospf_dynamic_destroy_ip_route_policy(), + and ospf_sysctl_routeModify() prototypes. +04x,28jul03,ram SPR#89908 Added ability to check for unreachable routing table + routes in ospf_sysctl_rtableWalk and delete them from OSPF. +04w,18aug03,agi Removed ospf_MD_string(), OSPF now used common mdString() +04v,30jul03,agi Renamed MD_string() to ospf_MD_string() to avoid name + collision +04u,28jul03,ram SPR#89908 Added ability to check for unreachable routing table routes + in ospf_sysctl_rtableWalk and delete them from OSPF. +04t,28jul03,mwv SPR#88854 - add the capability to send a LSA that is larger than + the MTU size. It will cause IP fragmentation as there is no way to fragment + the large LSA. Added function ospf_transmit_update_packets_for_large_lsa () +04s,17jul03,agi Added ospf_delete_entry_from_list() +04r,30jun03,agi Fixed SPR#88879, OSPF does not clean up external LSDB when + an interface is brought down +04q,11jun03,ram SPR#88965 Separate route table and LSDB hash parameters +04p,11jun03,agi SPR#8858, added bool ospfPartMemInitialize() prototype +04l,17jul03,agi Added ospf_delete_entry_from_list() +04o,02jun03,ram Removed obsolete memory allocation function prototypes +04k,30jun03,agi Fixed SPR#88879, OSPF does not clean up external LSDB when + an interface is brought down +04j,11jun03,ram SPR#88965 Separate route table and LSDB hash parameters +04i,11jun03,agi SPR#8858, added bool ospfPartMemInitialize() prototype +04h,06jun03,mwv SPR#88905 SPR#88863 Added functionality to configure the redistribution policy + added functions ospf_delete_redistribution_bgp, () ospf_delete_redistribution_rip + ospf_delete_redistribution_static (), + ospf_configure_redistribution_rip, ospf_configure_redistribution_bgp (), + ospf_configure_redistribution_static +04g,06jun03,kc SPR#88905 added ospf_dynamic_config_redistribution () and + ospf_dynamic_destroy_redistrib () +04f,02jun03,ram Removed obsolete memory allocation function prototypes +04e,02jun03,asr Renamed route_proto to route_protocol +04d,09may03,kc Fixed SPR#88389 - Added route_proto and is_default_route + arguments to ospf_dynamic_flush_external_routes() and + ospf_flush_the_link_state_database_of_self_originated_external_lsa() +04c,15may03,mwv Fixed SPR#87784 - added ospf_process_export_route_queue_all () + prototype. +04b,15may03,kkz SPR 86134 - Added new function to get cost of address range +04a,12may03,asr Changes to make OSPF virtual stack compatible + ospf_originate_default_summary_link_into_the_area(). +03z,26may03,dsk Fixed SPR 88619, LSAearly retransmission +03y,26may03,agi Added ospf_get_system_elapsed_time_second(), OSPF memory + and OSPF utilities prototypes +03x,22may03,kc Added ospf_is_address_range_active() and + ospf_get_metric_cost_of_address_range() prototypes to remove warnings. +03w,09may03,kc Fixed SPR#88389 - Added route_proto and is_default_route + arguments to ospf_dynamic_flush_external_routes() and + ospf_flush_the_link_state_database_of_self_originated_external_lsa(). +03v,24apr03,kc Fixed SPR#86625 - added + ospf_dynamic_send_default_summary_lsa() prototype. Also +03u,24apr03,kc Fixed SPR#86625 - added ospf_dynamic_send_default_summary_lsa() + prototype. Also added prematurely_age_advertisement argument to + ospf_originate_default_summary_link_into_the_area(). +03t,27may03,mwv Fixed SPR#87784 - added + ospf_process_export_route_queue_all () prototype. +03s,22may03,kkz SPR#88613 - Added new functions for area address range + feature +03r,22may03,dsk SPR#88619 Fix early LSA retransmission +03q,22apr03,ram SPR#76812 Modifications for OSPF performance enhancements +03p,17feb02,ram SPR#81808 Added OSPF memory partition support +03o,17feb03,ram SPR#85893 Removed ospf_find_all_lsa proto +03n,29jan03,mwv SPR#85893 add proto for ospf_find_all_lsa () +03m,28jan03,ram SPR#85050 Added support for external route redistribution + based on OSPF external metric values +03l,06jan03,ram SPR#85432 Added new hello timer function prototype +03k,09dec02,ram SPR#83418 Added support for OSPF metric type and value + configuration +03j,22nov02,htm Added ospf_find_router_or_network_routing_table_node() + prototype +03i,19nov02,kc Added prototypes for ospf_notify_areas_for_abr_change() and + ospf_flush_network_link_advertisement(). SPR#84478,84485, + 84486 +03h,19nov02,mwv Merge TMS code SPR 84284 +03g,08oct02,agi Added ospf_is_if_unnumbered_up() prototype +03f,24jun02,kc Changed check_if_status() prototype to return boolean. +03e,13may02,ark Added new function ospf_find_network_LSA for SPR 75793 +03d,30may02,kc Added ospf_sysctl_rtableWalk() prototype. +03c,24may02,kc Added ospf_sysctl_input() prototype. +03b,18apr02,kc Fixed SPR #74432 - Added prototypes for + ospf_dynamic_export_external_routes() and + ospf_dynamic_flush_external_routes(). +03a,25apr02,jkw Additional ospfShowRoutingTable routine. +02z,18apr02,jkw External 1583compatibility flooding. +02y,16apr02,jkw One copy of external and type 11 lsa +02x,24mar02,kc Changed ospf_startup() return type from void to STATUS. +02w,09apr02,jkw Sequence number wrap. +02v,15feb02,kc Added ospf_dynamic_init_unnumbered_interface() prototype. +02u,09jan02,jkw Add new function for processing external route queue. +02t,20dec01,jkw Removed sptr_area->sptr_interfaces structure. +02s,13dec01,kc Added prototype for ospf_dynamic_calculate_spf(). +02r,07dec01,kc Added ospf_dynamic_reset_interface() and + ospf_dynamic_reinit_interface() prototypes. +02q,23oct01,kc Added the prototypes ospf_dynamic_create_area_range(), + ospf_dynamic_destroy_area_range(), ospf_dynamic_config_overflow() + and ospf_dynamic_flush_opaque_lsa() +02p,13oct01,kc Dynamic configuration changes. +02o,12oct01,kc Added dynamic BOOL argument to ospf_add_entry_to_hosts_list() + and ospf_add_entry_to_virtual_link_list(). +02n,06oct01,kc Added ospf_init_setup() prototype. +02m,28sep01,kc Added ospf_add_entry_to_hosts_list() and + ospf_add_entry_to_virtual_link_list() prototypes. +02l,26sep01,kc Added ospf_put_an_interface_on_areas_interface_list(), + ospf_clear_advertisements_from_lists() prototypes. +02k,22sep01,kc Added prototypes for ospf_multicast_group_request() and + ospf_validate_interface(). Obsolete ospf_router_rx_packet(), + and ospf_get_port_number() prototypes. Modified function + arguments for ospf_router_rx_packet(). +02j,17sep01,kc Added prototypes for ospf_show_xxx() routines. +02i,13aug01,kc Added ospf_register_with_ip() and ospf_deregister_with_ip() + prototypes. +02h,26jul01,jkw Added opaque lsa APIs +02g,24jul01,jkw Removed WINROUTER preproc +02f,23jul01,jkw Added routine to delete all items in the container and the container. +02e,26jun01,jkw Added updates for multiple path destination. +02d,26sep00,res Added WindRiver CopyRight +02c,25sep00,res RFC-1587 implementation for OSPF NSSA Option, also tested against + ANVL. +02b,20jul00,res Unix compatibility related changes. +02a,06jul00,res Removed unnecessary header files and defines. +01z,04apr00,res Added some MIB support (Read only). Passed all important ANVL OSPF + tests. +01y,23dec99,res Compatibility with VxWorks-IP and VxWorks RTM-interface +01x,16aug99,jac Folded the fix in RTM patricia - always return most specific route - + Sue case into ospf patricia tree. +01w,19may99,jac redefined OSPF_PATRICIA_32_BITS_KEY_MAX_BIT_POSITION as per fixes in + patricia +01v,19may99,jac Fixes in patricia on insertion +01u,12may99,jac Changes related to equal cost multi path and + ospf_set_patricia_route_change_status_on_ospf_rt_node +01t,12may99,jac changed the name of ospf_get_new_next_hop_blocks to + ospf_get_new_next_hop_blocks_and_mark_ospf_rt_node_new +01s,12may99,jac Change in proto type of ospf_get_new_next_hop_blocks +01r,10may99,jac Changes in prototypes and call and declaration of + ospf_get_new_next_hop_blocks +01q,10may99,jac syntax error fix +01p,10may99,jac Changes related to ospf_get_new_next_hop_blocks +01o,28dec98,jac Compiled and added some comments +01n,01dec98,jac Changes to get rid of vxworks warnings +01m,13nov98,jac Changes related to introducing queuing in OSPF to RTM interface and + bug fix on the external route additions path (to RTM) +01l,11nov98,jac Config changes, linted and big endian changes +01k,30oct98,jac Incorporate changes for compilation on Vxworks +01j,23aug98,jac ANVL tested OSPF with PATRICIA tree route table and no recursion +01i,10aug98,jac PATRICIA Route Table Based OSPF Code Base +01h,08jul98,jac Patricia RT table related changes - need to be tested +01g,19jun98,jac listroutine changes. OSPF add and delete list routines, eventually + call the rwutils list routines. +01f,16jun98,jac Changes related to external_routes queuing and the queue processing +01e,04jun98,jac Integration with RTM and BGP +01d,10jul97,cin Pre-release v1.52b +01c,10feb97,cin Release Version 1.52 +01b,22oct97,cin Release Version 1.50 +01a,05jun96,cin First Beta Release +*/ + +#include +#include +#include + +/************************************************************************/ + +#if !defined (_OSPF_PROTOTYPES_H_) +#define _OSPF_PROTOTYPES_H_ + +/*******************/ +/* ospf_checksum.c */ +/*******************/ +USHORT ospf_generate_LS_checksum (void *vptr_data, + USHORT length_of_data, + BYTE *bptr_checksum); +enum TEST ospf_verify_LS_checksum (void *vptr_data, + USHORT length_of_data /* in network order */, + USHORT checksum); + +/************************/ +/* ospf_configuration.c */ +/************************/ + +void ospf_configuration (enum PROTOCOL_CONTROL_OPERATION command, + ULONG parameter_0, + ULONG parameter_1); +ULONG ospf_get_configuration_table_address (void); +enum TEST ospf_set_default_values (char *cptr_value_string); +ULONG ospf_special_configuration_function_processing (ULONG parameter[]); + +enum TEST ospf_set_bgp_subnets_to_redistribute (char *cptr_value_string); +enum TEST ospf_set_rip_subnets_to_redistribute (char *cptr_value_string); +enum TEST ospf_set_static_subnets_to_redistribute (char *cptr_value_string); +enum TEST ospf_set_local_subnets_to_redistribute (char *cptr_value_string); +enum TEST ospf_set_ip_route_policy( char *cptr_value_string ); +enum TEST ospf_set_neighbor_as_not_allowed (char *cptr_value_string); +enum TEST ospf_set_origin_as_not_allowed (char *cptr_value_string); +ULONG ospf_get_router_id(); +ULONG ospf_get_number_of_areas(); +ULONG ospf_get_number_of_virtual_links(); +enum TEST ospf_set_port_passive (char *cptr_value_string); + +STATUS ospf_configure_redistribution_static(ULONG subnet_address, + ULONG subnet_mask, + ULONG metric_type, + ULONG metric_value, + ULONG route_tag, + BYTE options); +void ospf_set_port (char * cptr_value_string); +/* SPR#88905 -- Begin */ +STATUS ospf_configure_redistribution_rip(ULONG subnet_address, + ULONG subnet_mask, + ULONG metric_type, + ULONG metric_value, + ULONG route_tag, BYTE options); +STATUS ospf_configure_redistribution_bgp(ULONG subnet_address, + ULONG subnet_mask, + ULONG metric_type, + ULONG metric_value, + ULONG route_tag, + BYTE options); +STATUS ospf_configure_redistribution_local(ULONG subnet_address, + ULONG subnet_mask, + ULONG metric_type, + ULONG metric_value, + ULONG route_tag, + BYTE options); + +STATUS ospf_delete_redistribution_static(ULONG subnet_address, ULONG subnet_mask); +STATUS ospf_delete_redistribution_rip (ULONG subnet_address, ULONG subnet_mask); +STATUS ospf_delete_redistribution_bgp (ULONG subnet_address, ULONG subnet_mask); +STATUS ospf_delete_redistribution_local (ULONG subnet_address, ULONG subnet_mask); +/* SPR#88905 -- End */ +USHORT ospf_get_port_number_and_string (char *cptr_port_number_and_value, char *return_string); + +/******************/ +/* ospf_control.c */ +/******************/ +void ospf_halt_ospf_router (void); +enum TEST ospf_control (enum PROTOCOL_CONTROL_OPERATION command,ULONG parameter_0,ULONG parameter_1); + +void ospf_shut_down_ospf_router (void); +/***************************/ +/* ospf_database_summary.c */ +/***************************/ + +enum OSPF_RETURN_FLAGS ospf_build_ls_database_summary (OSPF_INTERFACE *sptr_interface, + OSPF_NEIGHBOR *sptr_neighbor); +OSPF_LS_DATABASE_SUMMARY *ospf_allocate_ls_database_summary (OSPF_INTERFACE *sptr_interface); +void ospf_free_ls_database_summary (OSPF_LS_DATABASE_SUMMARY *sptr_database_summary); + + +/******************/ +/* ospf_vx_main.c */ +/******************/ +/*Added change as per TMS PR # 1569. + Changed the return type from void to STATUS*/ +/* void ospf_task_initialize (const char *p_configuration_file);*/ + +STATUS ospf_task_initialize (const char *p_configuration_file); + + +/*************************************/ +/* ospf_designated_router_election.c */ +/*************************************/ + +void ospf_run_designated_router_election (OSPF_INTERFACE *sptr_interface); + +/*******************/ +/* ospf_dijkstra.c */ +/*******************/ + +void ospf_run_dijkstra (OSPF_AREA_ENTRY *sptr_area); +void ospf_bring_up_virtual_links_if_necessary (OSPF_AREA_ENTRY *sptr_area); +void ospf_set_intervening_router (OSPF_SHORTEST_PATH_NODE *sptr_vertex_V, + OSPF_SHORTEST_PATH_NODE *sptr_vertex_W, + OSPF_AREA_ENTRY* sptr_area, + OSPF_ROUTER_LINK_PIECE *sptr_link ); + +/*************************************/ +/* ospf_external_routes.c */ +/*************************************/ + +void ospf_process_external_route_to_ospf (); + +OSPF_EXTERNAL_ROUTE* ospf_find_originated_external_route ( + OSPF_EXTERNAL_ROUTE *sptr_originated_external_routes, + OSPF_EXTERNAL_ROUTE *sptr_external_route); + +void ospf_add_exported_route_to_ospf ( + ULONG destination_network, ULONG network_mask, ULONG metric, + ULONG forwarding_address, ULONG tag, ULONG proto); + +void ospf_delete_exported_route_from_ospf ( + ULONG destination_network, ULONG network_mask, ULONG metric, + ULONG forwarding_address, ULONG tag, ULONG proto); + + +/*************************************/ +/* ospf_external_route_calculation.c */ +/*************************************/ + +void ospf_calculate_routes_to_external_destinations (BOOLEAN new_summary_lsa_received); +#if defined (__NSSA__) +void ospf_calculate_type_7_as_external_routes (void); +#endif /*__NSSA__*/ + +void ospf_calculate_routes_to_a_single_external_destination ( + UNION_OSPF_LINK_STATE_ADVERTISEMENT *advertisement, + enum BOOLEAN on_new_external_lsa_received_path); + +#if defined (__NSSA__) +void ospf_calculate_type_7_routes_to_a_single_external_destination ( + UNION_OSPF_LINK_STATE_ADVERTISEMENT *advertisement, + enum BOOLEAN on_new_external_lsa_received_path); +void ospf_translate_type_7_routes_into_type_5_lsa (void); +void ospf_invalidate_type_7_route_entry (OSPF_TYPE_7_LINK_ADVERTISEMENT_HEADER *sptr_type_7); +#endif + +/* SPR 85050 -- Begin */ +enum BOOLEAN ospf_compare_costs_of_external_lsdb_entries (ULONG new_metric, ULONG metric); +/* SPR 85050 -- End */ + +/****************/ +/* ospf_flood.c */ +/****************/ + +enum BOOLEAN ospf_flood_advertisement_out_some_subset_of_the_routers_interfaces ( + OSPF_ROUTER_LINK_ADVERTISEMENT_HEADER *sptr_advertisement, + OSPF_AREA_ENTRY *sptr_area, + OSPF_INTERFACE *sptr_interface_advertisement_received_on, + OSPF_NEIGHBOR *sptr_neighbor_advertisement_received_from, + enum BOOLEAN advertisement_installed); + +/****************/ +/* ospf_hello.c */ +/****************/ + +void ospf_send_hello (OSPF_INTERFACE *sptr_interface,OSPF_NEIGHBOR *sptr_neighbor,enum BOOLEAN goingdown); +enum OSPF_PACKET_STATE ospf_hello_packet_received (OSPF_HELLO_HEADER *sptr_hello, + OSPF_NEIGHBOR *sptr_new_neighbor, + OSPF_INTERFACE *sptr_interface, + ULONG source_address, + ULONG router_id, + ULONG size_of_packet, + ULONG cryptographic_sequence_number); +void ospf_set_neighbor_fields (OSPF_NEIGHBOR *sptr_neighbor, + ULONG router_id, + ULONG address, + ULONG cryptographic_sequence_number, + OSPF_INTERFACE *sptr_interface, + USHORT priority, + BYTE options, + enum OSPF_NEIGHBOR_STATE state); +/* SPR#76812 */ +void ospf_hello_timer_initialize (void); + + +/*************************/ +/* ospf_initialization.c */ +/*************************/ + +enum TEST ospf_initialize_router (ULONG clock_ticks_per_second); + +void ospf_put_an_interface_on_areas_interface_list(OSPF_AREA_ENTRY *sptr_area, OSPF_INTERFACE *sptr_interface); + +/* Wrapped it with __RAW_SOCKET define */ +void ospf_multicast_group_request( ULONG ipAddr, ULONG multicastAddr, int request ); + + +/* NOTE: changed from void returned type to TEST */ +enum TEST ospf_add_entry_to_hosts_list (OSPF_INTERFACE *sptr_interface, BOOL dynamic); +enum TEST ospf_add_entry_to_virtual_link_list (OSPF_INTERFACE *sptr_interface, BOOL dynamic); + +OSPF_AREA_ENTRY* ospf_create_pseudo_area_for_virtual_link (OSPF_INTERFACE *sptr_interface); + +void ospfShutdown (void); + +/*************************/ +/* ospf_vx_ip_adaptation.c */ +/*************************/ +/*raw socket - New socket interface function jkw*/ +int ospf_vx_ip_receive_socket_input (void); +void ospf_vx_ip_output (OSPF_HEADER *sptr_packet, + ULONG source_address, + bool flag_multicast, + ULONG destination_address, + ULONG length /* in host order */, + enum BOOLEAN free_packet); +struct mbuf * ospf_get_an_ip_get_packet (void); +/*raw socket - End of changes*/ +int ospf_vx_ip_user_request_processing (struct socket *socket_handle, + int type_of_request, + struct mbuf *message_block, + struct mbuf *name, + struct mbuf *control); +int ospf_vx_ip_receive_input(OSPF_PACKET *ospf_packet, ULONG rcvif_handle); +int ospf_ctloutput (int option, + struct socket *socket_handle, + int level, + int option_name, + struct mbuf **p_message_block); +void ospf_vx_ip_output (OSPF_HEADER *sptr_packet, + ULONG source_address, + bool flag_multicast, + ULONG destination_address, + ULONG length /* in host order */, + enum BOOLEAN free_packet); +enum TEST ospf_vx_ip_attach (struct socket *socket_handle); +enum TEST ospf_vx_ip_detach ( ULONG source_address); +void ospf_indicate_lower_level_interface_state_change (OSPF_INTERFACE* sptr_ospf_interface, bool new_state); + +/* for tOspfRecv task*/ +/* Added change as per TMS PR # 1652 */ +int ospfReceive( void ); + +/***************************************/ +/* ospf_inter_area_route_calculation.c */ +/***************************************/ + +void ospf_calculate_inter_area_routes (OSPF_AREA_ENTRY *sptr_area); +enum BOOLEAN ospf_calculate_inter_area_routes_for_a_single_summary_advertisement ( + OSPF_ADVERTISEMENT_NODE *sptr_advertisement_node, + OSPF_AREA_ENTRY *sptr_area, + enum BOOLEAN new_summary_lsa_received); +void ospf_invalidate_inter_area_route_entry (OSPF_SUMMARY_LINK_ADVERTISEMENT_HEADER *sptr_advertisement_node, + OSPF_AREA_ENTRY *sptr_area); + +/********************/ +/* ospf_interface.c */ +/********************/ + +void ospf_bring_up_interface (OSPF_INTERFACE *sptr_interface); +void ospf_initialize_interface (OSPF_INTERFACE *sptr_interface, BOOL dynamic); +enum BOOLEAN check_if_status( unsigned short if_index ); +enum BOOLEAN ospf_is_if_unnumbered_up(OSPF_INTERFACE *sptr_interface); + + +/********************************/ +/* ospf_raw_socket_interface.c */ +/********************************/ +enum TEST ospf_send_to_raw_ip_packet (void *vptr_packet, UINT packet_length, UINT destination_address); +enum TEST ospf_read_and_process_packet_from_sockets (void); +void ospf_poll_for_packets_on_raw_sockets (void); + + +/********************************/ +/* legacy ip functions to be deleted later */ +/********************************/ + +USHORT calculate_ip_checksum (PSEUDO_IP_PARAMETERS *sptr_pseudo_header, BYTE *bptr_start_from, USHORT length); + + +/***************************/ +/* ospf_interface_events.c */ +/***************************/ + +void ospf_process_interface_up_event (OSPF_INTERFACE *sptr_interface); +void ospf_process_interface_wait_timer_event (OSPF_INTERFACE *sptr_interface); +void ospf_process_interface_backup_seen_event (OSPF_INTERFACE *sptr_interface); +void ospf_process_interface_neighbor_change_event (OSPF_INTERFACE *sptr_interface); +void ospf_process_interface_loop_indication_event (OSPF_INTERFACE *sptr_interface); +void ospf_process_interface_unloop_indication_event (OSPF_INTERFACE *sptr_interface); +void ospf_process_interface_down_event (OSPF_INTERFACE *sptr_interface); + +void ospf_reset_interface_variables_and_timers_and_destroy_all_associated_neighbor_connections ( + OSPF_INTERFACE *sptr_interface, + enum OSPF_INTERFACE_EVENT event, + enum OSPF_INTERFACE_STATE new_state); +void ospf_interface_address_delete (USHORT if_index, struct in_addr * if_addr); +void ospf_interface_flag_change ( USHORT interface_index, ULONG interface_flags); + +/**********************************/ +/* ospf_interface_state_machine.c */ +/**********************************/ + +void ospf_execute_interface_state_machine (enum OSPF_INTERFACE_EVENT event, + enum OSPF_INTERFACE_STATE state, + OSPF_INTERFACE *sptr_interface); + +/************************************/ +/* ospf_link_state_advertisements.c */ +/************************************/ + +void ospf_originate_new_instance_of_the_link_state_advertisement ( + OSPF_LS_DATABASE_ENTRY *sptr_database_entry, + OSPF_AREA_ENTRY *sptr_area); +void ospf_originate_router_links_advertisement (OSPF_AREA_ENTRY *sptr_area); +void ospf_originate_network_links_advertisement (OSPF_INTERFACE *sptr_interface); +void ospf_originate_summary_links_advertisement (OSPF_AREA_ENTRY *sptr_area); +void ospf_originate_a_single_summary_links_advertisement ( + OSPF_ROUTING_TABLE_ENTRY *sptr_routing_table_entry, + OSPF_AREA_ENTRY *sptr_area, + enum BOOLEAN prematurely_age_advertisement); +void ospf_originate_default_summary_link_into_the_area (OSPF_AREA_ENTRY *sptr_area, + enum BOOLEAN prematurely_age_advertisement); +void ospf_originate_summary_link_into_stub_area (OSPF_AREA_ENTRY *sptr_area, enum BOOLEAN prematurely_age_advertisement); +void ospf_originate_external_links_advertisement (OSPF_EXTERNAL_ROUTE *sptr_external_route); +#if defined (__NSSA__) +OSPF_EXTERNAL_ROUTE *ospf_translate_routing_table_entry_to_external_route ( + OSPF_ROUTING_TABLE_ENTRY *sptr_routing_table_entry, + enum BOOLEAN set_forwarding_address); +void ospf_originate_external_links_advertisement_from_type_7_route (OSPF_EXTERNAL_ROUTE *sptr_external_route); +void ospf_originate_type_7_links_advertisement (OSPF_EXTERNAL_ROUTE *sptr_external_route); +#endif /*__NSSA__*/ +/*opaque lsa prototypes for originating opaque lsas jkw*/ +#if defined (__OPAQUE_LSA__) +void ospf_originate_type_9_links_advertisement (OSPF_INTERFACE *sptr_interface, + BYTE lsa_type, ULONG opaque_lsid, void *data, USHORT data_size, USHORT age); +void ospf_originate_type_10_links_advertisement (OSPF_AREA_ENTRY *sptr_area, + BYTE lsa_type, ULONG opaque_lsid, void *data, USHORT data_size, USHORT age); +void ospf_originate_type_11_links_advertisement (OSPF_INTERFACE *sptr_interface, + BYTE lsa_type, + ULONG opaque_lsid, + void *data, + USHORT data_size, + USHORT age); +#endif /* __OPAQUE_LSA__ */ +ULONG ospf_get_metric_cost_of_address_range ( + OSPF_ADDRESS_RANGE_LIST_ENTRY *sptr_address_range); +ULONG ospf_get_metric_cost_of_address_range_with_head ( + OSPF_ADDRESS_RANGE_LIST_ENTRY *sptr_address_range, + OSPF_ROUTING_TABLE_NODE * sptr_routing_table_node[OSPF_ROUTE_TABLE_MAX][OSPF_RT_HASH_TABLE_SIZE]); +BOOLEAN ospf_is_address_range_active ( + OSPF_ADDRESS_RANGE_LIST_ENTRY *sptr_address_range); +void ospf_generate_summary_lsa_for_address_range ( + OSPF_ADDRESS_RANGE_LIST_ENTRY *addr_range, + enum BOOLEAN prematurely_age); +void ospf_advertise_lsas_contained_in_address_range ( + OSPF_ADDRESS_RANGE_LIST_ENTRY *sptr_address_range, + BOOLEAN prematurely_age); + + +/******************************/ +/* ospf_link_state_database.c */ +/******************************/ + +/* SPR 85050 */ +OSPF_LS_DATABASE_ENTRY *ospf_install_a_new_advertisement_in_the_link_state_database ( + OSPF_LS_DATABASE_ENTRY *sptr_old_instance, + UNION_OSPF_LINK_STATE_ADVERTISEMENT *sptr_advertisement, + OSPF_AREA_ENTRY *sptr_area, + enum TEST* different_lsa, + int route_protocol); +OSPF_LS_DATABASE_ENTRY *ospf_find_LSA (OSPF_AREA_ENTRY *sptr_area,ULONG id,ULONG advertising_router,BYTE_ENUM (OSPF_LS_TYPE) type); +OSPF_LS_DATABASE_ENTRY *ospf_find_network_LSA (OSPF_AREA_ENTRY *sptr_area,ULONG id,ULONG advertising_router); +OSPF_LS_DATABASE_ENTRY *ospf_free_database_entry (OSPF_LS_DATABASE_ENTRY *sptr_database_entry); +int ospfAvlLsdbCompare (AVL_NODE *node, void* key); +enum TEST ospf_check_if_previous_instance_exists (OSPF_LS_DATABASE_ENTRY *sptr_old_instance); +enum TEST ospf_check_if_new_advertisement_is_different_from_its_previous_instance ( + UNION_OSPF_LINK_STATE_ADVERTISEMENT *sptr_advertisement, + OSPF_LS_DATABASE_ENTRY *sptr_old_instance); +void ospf_flush_the_link_state_database_of_router_lsa (); +void ospf_flush_the_link_state_database_of_network_lsa (); +void ospf_flush_the_link_state_database_of_network_summary_lsa (); +void ospf_flush_the_link_state_database_of_asbr_summary_lsa (); +#if defined (__NSSA__) +void ospf_flush_the_link_state_database_of_type_7_lsa (); +#endif /* __NSSA__ */ + +void ospf_flush_the_link_state_database_of_external_lsa (); +void ospf_flush_the_link_state_database_of_self_originated_external_lsa ( + ULONG route_protocol, enum BOOLEAN is_default_route); +void ospf_flush_lsdb_of_external_lsas_associated_with_neighbor ( + OSPF_NEIGHBOR * sptr_neighbor); +OSPF_LS_DATABASE_ENTRY *ospf_process_old_ls_summary_summaryASBR_and_external_advertisements ( + OSPF_LS_DATABASE_ENTRY *sptr_old_instance, + OSPF_AREA_ENTRY *sptr_area); + +/**************************/ +/* ospf_neighbor_events.c */ +/**************************/ + +void ospf_process_neighbor_hello_received_event (OSPF_INTERFACE *sptr_interface,OSPF_NEIGHBOR *sptr_neighbor,enum OSPF_NEIGHBOR_EVENT event); +void ospf_process_neighbor_start_event (OSPF_INTERFACE *sptr_interface, OSPF_NEIGHBOR *sptr_neighbor,enum OSPF_NEIGHBOR_EVENT event); +void ospf_process_neighbor_2_way_received_event (OSPF_INTERFACE *sptr_interface,OSPF_NEIGHBOR *sptr_neighbor,enum OSPF_NEIGHBOR_EVENT event); +void ospf_process_neighbor_negotiation_done_event (OSPF_INTERFACE *sptr_interface,OSPF_NEIGHBOR *sptr_neighbor,enum OSPF_NEIGHBOR_EVENT event); +void ospf_process_neighbor_exchange_done_event (OSPF_INTERFACE *sptr_interface,OSPF_NEIGHBOR *sptr_neighbor,enum OSPF_NEIGHBOR_EVENT event); +void ospf_process_neighbor_loading_done_event (OSPF_INTERFACE *sptr_interface,OSPF_NEIGHBOR *sptr_neighbor,enum OSPF_NEIGHBOR_EVENT event); +void ospf_start_forming_an_adjacency_with_the_neighbor (OSPF_INTERFACE *sptr_interface,OSPF_NEIGHBOR *sptr_neighbor,enum OSPF_NEIGHBOR_EVENT event); +void ospf_maintain_or_destroy_existing_adjacency (OSPF_INTERFACE *sptr_interface,OSPF_NEIGHBOR *sptr_neighbor,enum OSPF_NEIGHBOR_EVENT event); +void ospf_tear_down_and_reestablish_adjacency (OSPF_INTERFACE *sptr_interface,OSPF_NEIGHBOR *sptr_neighbor,enum OSPF_NEIGHBOR_EVENT event); +void ospf_process_neighbor_1_way_received_event (OSPF_INTERFACE *sptr_interface,OSPF_NEIGHBOR *sptr_neighbor,enum OSPF_NEIGHBOR_EVENT event); +void ospf_process_neighbor_down_event (OSPF_INTERFACE *sptr_interface,OSPF_NEIGHBOR *sptr_neighbor,enum OSPF_NEIGHBOR_EVENT event); + +void ospf_clear_advertisements_from_lists (OSPF_INTERFACE *sptr_interface,OSPF_NEIGHBOR *sptr_neighbor); +/*********************************/ +/* ospf_neighbor_state_machine.c */ +/*********************************/ + +void ospf_execute_neighbor_state_machine (enum OSPF_NEIGHBOR_EVENT event,enum OSPF_NEIGHBOR_STATE state,OSPF_INTERFACE *sptr_interface, + OSPF_NEIGHBOR *sptr_neighbor); + +/*************************/ +/* ospf_list_utilities.c */ +/*************************/ + +void ospf_insert_node_in_list (OSPF_GENERIC_NODE *sptr_node,OSPF_GENERIC_NODE *sptr_previous_node); +void ospf_add_node_to_end_of_list (OSPF_GENERIC_NODE *sptr_node,OSPF_GENERIC_NODE *sptr_first_node_in_list); +OSPF_GENERIC_NODE *ospf_free_entire_list (OSPF_GENERIC_NODE *sptr_first_node_in_list); +void ospf_remove_node_from_list (OSPF_GENERIC_NODE **ptr_sptr_first_node, OSPF_GENERIC_NODE *sptr_node); +void ospf_add_neighbor (OSPF_INTERFACE *sptr_interface,OSPF_NEIGHBOR *sptr_neighbor_to_add); +OSPF_LS_DATABASE_NODE *ospf_find_advertisement_on_neighbors_retransmit_list (OSPF_NEIGHBOR *sptr_neighbor,OSPF_LS_DATABASE_ENTRY *sptr_advertisement); +void ospf_remove_node_from_neighbors_retransmit_queue (OSPF_NEIGHBOR *sptr_neighbor,OSPF_LS_DATABASE_NODE *sptr_retransmission_node); +void ospf_remove_neighbor_from_advertisements_retransmit_list (OSPF_LS_DATABASE_ENTRY *sptr_advertisement,OSPF_NEIGHBOR *sptr_neighbor); +STATUS ospf_add_database_entry_to_neighbor_retransmit_list (OSPF_NEIGHBOR *sptr_neighbor,OSPF_LS_DATABASE_ENTRY *sptr_database_entry); +STATUS ospf_add_neighbor_to_database_retransmit_list (OSPF_LS_DATABASE_ENTRY *sptr_database_entry,OSPF_NEIGHBOR *sptr_neighbor); +void ospf_clean_up_retransmit_lists_affiliated_with_this_advertisement (OSPF_LS_DATABASE_ENTRY *sptr_advertisement); +void ospf_remove_all_database_pointers_from_neighbor_retransmit_list (OSPF_NEIGHBOR *sptr_neighbor); +void ospf_free_neighbor_database_summary_list (OSPF_NEIGHBOR *sptr_neighbor); +OSPF_LS_REQUEST *ospf_find_advertisement_on_neighbors_ls_request_list (OSPF_NEIGHBOR *sptr_neighbor,OSPF_LS_DATABASE_ENTRY *sptr_advertisement); +void ospf_free_neighbor_ls_request_list (OSPF_NEIGHBOR *sptr_neighbor); +void ospf_free_interface_acknowledgement_list (OSPF_INTERFACE *sptr_interface,enum BOOLEAN check_number_of_neighbors_in_init_state); +/* This fn added to this file (Deleted from ospf_receive_update.c) */ +void ospf_remove_current_database_copy_from_all_neighbors_retransmission_lists (OSPF_LS_DATABASE_ENTRY *sptr_database_entry, + OSPF_INTERFACE *sptr_interface); +void ospf_free_ospf_classes_area_lists (void); +void ospf_free_all_the_associated_area_pointers(OSPF_AREA_ENTRY* sptr_area); +/* trace B0456 */ +void ospf_free_routing_table_nodes (OSPF_ROUTING_TABLE_NODE **sptr_routing_table_hashbin, + OSPF_ROUTING_TABLE_NODE *sptr_first_discarded_or_valid_routing_table_node); +void ospf_free_areas_shortest_path_tree_nodes (OSPF_SHORTEST_PATH_NODE* sptr_first_shortest_path_candidate); +void ospf_free_areas_link_state_database(OSPF_AREA_ENTRY *sptr_area); +void ospf_free_interfaces(); +void ospf_free_neighbor (OSPF_NEIGHBOR *sptr_neighbor); +void ospf_search_ls_database_and_remove_neighbor_from_that_lsas_neighbor_retx_list_on_event_neighbor_down (OSPF_NEIGHBOR* sptr_neighbor); +enum TEST ospf_check_if_out_going_interface_belongs_to_the_passed_area (ULONG out_going_interfaces_address, OSPF_AREA_ENTRY* sptr_area); +USHORT ospf_host_to_net_short (USHORT host_order_short_value); +USHORT ospf_net_to_host_short (USHORT net_order_short_value); +ULONG ospf_host_to_net_long (ULONG host_order_long_value); +ULONG ospf_net_to_host_long (ULONG net_order_long_value); +ULONG ospf_long_swap (ULONG ulong_to_swap_bytes_with); + + +/**************************/ +/* ospf_print_utilities.c */ +/**************************/ +#if defined __OSPF_DEBUG__ +void ospf_display_packet (OSPF_PACKET *sptr_packet,enum BOOLEAN receive); +void ospf_display_ospf_header (OSPF_HEADER *sptr_packet,enum BOOLEAN receive); +void ospf_display_routing_table (void); +#endif /*__OSPF_DEBUG__*/ + +void ospf_print_memory_error_message_and_free_buffer_if_necessary (void **vptr_buffer,const char *cptr_string); +void ospf_printf (enum OSPF_PRINTF_GROUPS printf_group,const char *cptr_format, ...); + +/**********************************/ +/* ospf_receive_acknowledgement.c */ +/**********************************/ + +enum OSPF_PACKET_STATE ospf_ls_acknowledgement_packet_received (OSPF_LS_ACKNOWLEDGEMENT_HEADER *sptr_acknowledgement_packet, + OSPF_NEIGHBOR *sptr_neighbor,OSPF_INTERFACE *sptr_interface,ULONG size_of_packet); + +/***************************/ +/* ospf_receive_database.c */ +/***************************/ + +enum OSPF_PACKET_STATE ospf_database_packet_received (OSPF_DATABASE_HEADER *sptr_database_packet_header, + OSPF_NEIGHBOR *sptr_neighbor, + OSPF_INTERFACE *sptr_interface, + ULONG size_of_packet); +/***************************/ +/* ospf_receive_packet.c */ +/***************************/ +void ospf_router_rx_packet(OSPF_INTERFACE *sptr_interface, OSPF_PACKET *sptr_ospf_packet, + USHORT packet_size, ULONG source_ip_address, + ULONG destination_ip_address); + +/**************************/ +/* ospf_receive_request.c */ +/**************************/ + +enum OSPF_PACKET_STATE ospf_ls_request_packet_received (OSPF_LS_REQUEST_HEADER *sptr_ls_request_header,OSPF_NEIGHBOR *sptr_neighbor, + OSPF_INTERFACE *sptr_interface,ULONG size_of_packet); + +/*************************/ +/* ospf_receive_update.c */ +/*************************/ + +enum OSPF_PACKET_STATE ospf_ls_update_packet_received (OSPF_LS_UPDATE_HEADER *sptr_ls_update_header,OSPF_NEIGHBOR *sptr_neighbor, + OSPF_INTERFACE *sptr_interface_packet_received_on,ULONG source_address,ULONG destination_address); + +/****************************/ +/* ospf_receive_utilities.c */ +/****************************/ + +enum TEST ospf_check_if_advertisements_link_state_id_is_equal_to_one_of_the_routers_own_IP_interface_addresses ( + OSPF_ROUTER_LINK_ADVERTISEMENT_HEADER *sptr_advertisement); + +/************************/ +/* ospf_routing_table.c */ +/************************/ + +void ospf_schedule_routing_table_build (void); +void ospf_build_routing_table (void); +void ospf_examine_a_single_destination_for_a_better_path (OSPF_ADVERTISEMENT_NODE *sptr_advertisement_node,OSPF_AREA_ENTRY *sptr_area); +enum BOOLEAN ospf_add_new_path_to_routing_table_entry_and_update_rtm (OSPF_ROUTING_TABLE_NODE *sptr_routing_table_entry_for_N, + ULONG next_hop_router, OSPF_ROUTING_TABLE_ENTRY *sptr_routing_table_entry); +enum BOOLEAN ospf_next_hop_block_changed (OSPF_ROUTING_TABLE_NODE *sptr_old_routing_table_node, + OSPF_ROUTING_TABLE_NODE *sptr_routing_table_node); +enum BOOLEAN ospf_get_new_next_hop_blocks_and_mark_ospf_rt_node_new (OSPF_ROUTING_TABLE_NODE *sptr_routing_table_node, + OSPF_NEXT_HOP_BLOCK *sptr_new_next_hop_block, OSPF_NEXT_HOP_BLOCK **ptr_sptr_new_next_hops_copy); + +/********************************/ +/* ospf_routing_table_lookups.c */ +/********************************/ +OSPF_ROUTING_TABLE_ENTRY *ospf_find_routing_table_entry (ULONG neighbor_id,enum OSPF_ROUTE_DESTINATION_TYPE destination_type, + enum OSPF_ROUTE_PATH_TYPE path_type,OSPF_AREA_ENTRY *sptr_area); +/* SPR#76812 */ +OSPF_ROUTING_TABLE_ENTRY *ospf_find_routing_table_entry_1583_asbr (ULONG neighbor_id); +OSPF_ROUTING_TABLE_ENTRY *ospf_routing_table_lookup (ULONG destination_ip_address,ULONG type_of_service, + OSPF_ROUTING_TABLE_NODE *sptr_routing_table_node); +OSPF_ROUTING_TABLE_NODE *ospf_find_routing_table_node (ULONG neighbor_id, enum OSPF_LS_TYPE lsa_header_type, + enum OSPF_ROUTE_PATH_TYPE path_type, OSPF_AREA_ENTRY *sptr_area); +OSPF_ROUTING_TABLE_NODE *ospf_find_router_or_network_routing_table_node (ULONG destination_id_to_look, enum OSPF_LS_TYPE lsa_header_type, + enum OSPF_ROUTE_PATH_TYPE path_type,OSPF_AREA_ENTRY *sptr_area); +OSPF_ROUTING_TABLE_ENTRY* ospf_find_routing_table_entry_for_ABR(ULONG destination_id_to_look, ULONG area_id); + +/********************************/ +/* ospf_routing_table_updates.c */ +/********************************/ +void ospf_update_routing_table_due_to_receipt_of_a_new_summary_link_advertisement (OSPF_SUMMARY_LINK_ADVERTISEMENT_HEADER *sptr_summary, + OSPF_AREA_ENTRY *sptr_area_A); +#if defined (__NSSA__) +void ospf_update_routing_table_due_to_receipt_of_a_new_type_7_external_link_advertisement (OSPF_TYPE_7_LINK_ADVERTISEMENT_HEADER *sptr_type_7, + OSPF_AREA_ENTRY *sptr_area_A); +#endif /*__NSSA__*/ +void ospf_invalidate_routing_table_entry (OSPF_ROUTING_TABLE_NODE *sptr_routing_table_node_for_N,ULONG network_mask, + ULONG destination_N,OSPF_AREA_ENTRY *sptr_area_A); +/* SPR#76812 */ +void ospf_add_routing_table_node (OSPF_ROUTING_TABLE_NODE* sptr_routing_table_node); +void ospf_delete_routing_table_node (OSPF_ROUTING_TABLE_NODE* sptr_routing_table_node); + +/************************************/ +/* ospf_shortest_path_calculation.c */ +/************************************/ + +void ospf_calculate_shortest_path_tree (OSPF_AREA_ENTRY *sptr_area); +enum TEST ospf_check_if_link_exists (UNION_OSPF_LINK_STATE_ADVERTISEMENT *sptr_advertisement,ULONG vertex,OSPF_AREA_ENTRY *sptr_area); +OSPF_NEXT_HOP_BLOCK *ospf_calculate_the_set_of_next_hops (OSPF_SHORTEST_PATH_NODE *sptr_destination,OSPF_SHORTEST_PATH_NODE *sptr_parent, + OSPF_ROUTER_LINK_PIECE *sptr_link, OSPF_AREA_ENTRY *sptr_area); +OSPF_NEXT_HOP_BLOCK *ospf_inherit_the_set_of_next_hops_from_node_X (OSPF_NEXT_HOP_BLOCK *sptr_node_X_next_hops); +void ospf_schedule_shortest_path_first_job (OSPF_AREA_ENTRY *sptr_area); + + +/*****************/ +/* ospf_system.c */ +/*****************/ +void ospf_init_stub(); + + +/****************/ +/* ospf_timer.c */ +/****************/ + +void ospf_router_timer (void); +/* SPR 85432 -- Begin */ +void ospf_hello_timer (void); +/* SPR 85432 -- End */ + +/*******************/ +/* ospf_transmit.c */ +/*******************/ + +void ospf_tx_packet (OSPF_HEADER *sptr_packet,OSPF_INTERFACE *sptr_interface,enum OSPF_UNION_PACKET_TYPES type,ULONG length, + ULONG destination,enum BOOLEAN free_packet); +void ospf_send_completion_packet (USHORT port_number,void *vptr_txed_packet); + +/***********************************/ +/* ospf_transmit_acknowledgement.c */ +/***********************************/ + +enum OSPF_ACKNOWLEDGEMENT_RETURN_TYPE ospf_send_acknowledgement (OSPF_INTERFACE *sptr_interface, OSPF_NEIGHBOR *sptr_neighbor, + OSPF_LS_HEADER_QUEUE **ptr_to_sptr_header_queue); + +/****************************/ +/* ospf_transmit_database.c */ +/****************************/ + +void ospf_send_an_empty_database_description_packet (OSPF_INTERFACE *sptr_interface,OSPF_NEIGHBOR *sptr_neighbor); +void ospf_send_database_summary (OSPF_INTERFACE *sptr_interface,OSPF_NEIGHBOR *sptr_neighbor); + +/***************************/ +/* ospf_transmit_request.c */ +/***************************/ + +void ospf_send_ls_request_packet (OSPF_INTERFACE *sptr_interface,OSPF_NEIGHBOR *sptr_neighbor); + +/**************************/ +/* ospf_transmit_update.c */ +/**************************/ + +void ospf_send_ls_update (OSPF_LS_DATABASE_NODE *sptr_database_list,OSPF_NEIGHBOR *sptr_neighbor,OSPF_INTERFACE *sptr_interface, +enum BOOLEAN retransmit_flag, enum BOOLEAN advertisement_installed); +void ospf_free_timestamps_for_lsdb_entry(OSPF_LS_DATABASE_ENTRY *sptr_database_entry); +enum TEST ospf_send_ls_update_for_large_lsa (ULONG destination, + OSPF_INTERFACE *sptr_interface, + OSPF_LS_DATABASE_ENTRY *sptr_database); + + +/*****************************/ +/* ospf_transmit_utilities.c */ +/*****************************/ + +OSPF_HEADER *ospf_get_an_ospf_send_packet (ULONG size_of_packet); +void ospf_free_an_ospf_send_packet (OSPF_HEADER *sptr_tx_packet); +ULONG ospf_determine_packet_destination (OSPF_INTERFACE *sptr_interface,OSPF_NEIGHBOR *sptr_neighbor); +ULONG ospf_determine_destination (OSPF_INTERFACE *sptr_interface,OSPF_NEIGHBOR *sptr_neighbor); + + +/********************/ +/* ospf_utilities.c */ +/********************/ + +enum BOOLEAN ospf_check_if_addresses_match (ULONG address_1,ULONG address_2); +enum BOOLEAN ospf_check_for_transit_areas (void); +void ospf_generate_network_and_router_link_state_advertisements (OSPF_INTERFACE *sptr_interface); +ULONG ospf_get_authentication_size (OSPF_INTERFACE *sptr_interface); +ULONG ospf_get_interface_mtu (OSPF_INTERFACE *sptr_interface); +enum BOOLEAN ospf_validate_interface(ULONG interface_address); +enum BOOLEAN ospf_check_if_area_border_router (void); +enum TEST ospf_check_if_more_recent (OSPF_LS_HEADER *sptr_new_ls_header,OSPF_LS_HEADER *sptr_current_ls_header,ULONG elapsed_time); +enum TEST ospf_check_if_same_instance (OSPF_LS_HEADER *sptr_new_ls_header,OSPF_LS_HEADER *sptr_current_ls_header,ULONG elapsed_time); +seq_t ospf_increment_sequence_number (seq_t sequence_number); +void ospf_add_entry_to_interfaces_delayed_acknowledgement_list (OSPF_INTERFACE *sptr_interface,OSPF_LS_DATABASE_ENTRY *sptr_database_entry); +enum TEST ospf_check_for_valid_ls_type (OSPF_INTERFACE *sptr_interface,OSPF_LS_HEADER *sptr_ls_header, enum OSPF_UNION_PACKET_TYPES packet_type); +OSPF_HEADER *ospf_new_link_state_update (UNION_OSPF_ADVERTISEMENT_HEADER **ptr_to_uptr_acknowledgement_header,OSPF_INTERFACE *sptr_interface); +enum TEST ospf_check_if_ip_destination_falls_into_address_range (ULONG destination_ip_address,ULONG destination_id,ULONG address_mask); +void ospf_transfer_fields_from_ls_request_structure_to_ls_header_structure (OSPF_LS_REQUEST *sptr_ls_request,OSPF_LS_HEADER *sptr_ls_header); +enum TEST ospf_parse_port_plain_text_or_md5_password (char *cptr_port_password_string); +void ospf_process_export_route_queue (void); +void ospf_process_export_route_queue_all (void); +void ospf_notify_areas_for_abr_change( ulong_t area_id_to_skip ); +void ospf_flush_network_link_advertisement( OSPF_INTERFACE *sptr_interface ); +UINT ospf_get_system_elapsed_time_second (); +ULONG ospf_get_destination_address_of_PPP_link (ULONG ppp_src_addr); +ULONG ospf_get_mask_length (const struct in_addr *mask); + +#if (_BYTE_ORDER == _BIG_ENDIAN ) +ULONG ospf_min ( ULONG arg1, ULONG arg2); +#endif /* _BYTE_ORDER == _BIG_ENDIAN */ +struct ifnet* dstaddr_to_ifp(struct in_addr addr); + +/********************/ +/* ospf_to_rtm.c */ +/********************/ + +enum TEST ospf_export_route_to_other_protocols (enum OSPF_ROUTING_TABLE_UPDATE_ACTION action, + OSPF_ROUTING_TABLE_ENTRY *sptr_ospf_route_entry_to_export); + +extern void ospf_ctlinput(unsigned long intf, unsigned short intf_index, int intf_flags); + +STATUS ospf_is_protocol_redistributed (OSPF_IP_ROUTE_ENTRY *sptr_ip_route); + +STATUS ospf_add_route(OSPF_IP_ROUTE_ENTRY * sptr_route_entry); +STATUS ospf_delete_route(OSPF_IP_ROUTE_ENTRY * sptr_route_entry); +STATUS ospf_change_route(OSPF_IP_ROUTE_ENTRY * sptr_route_entry); +void ospf_receive_rtm_socket_input (); + +STATUS ospf_routing_table_walk ( + enum BOOLEAN asCapable, enum BOOLEAN redistStatic, enum BOOLEAN redistRIP, + enum BOOLEAN redistBGP, enum BOOLEAN redistDefault, enum BOOLEAN reachable); + +void ospf_ip_route_get ( + OSPF_EXTERNAL_ROUTE * p_external_route, + OSPF_IP_ROUTE_ENTRY * p_ip_route_entry); + +void ospf_protocol_rtm_terminate (OSPF_RTM_HANDLE protoRtmHandle); + +enum TEST ospf_send_ls_update_for_large_lsa (ULONG destination, + OSPF_INTERFACE *sptr_interface, + OSPF_LS_DATABASE_ENTRY *sptr_database); + +enum TEST ospf_lookup_redistribution_policy ( + ULONG network_address, ULONG route_proto); + + + +/********************/ +/* ospf_init.c */ +/********************/ + +void ospf_register_with_ip (FP_OSPF_RECEIVE pospfReceive, FP_OSPF_SEND pospfSend); +void ospf_deregister_with_ip (FP_OSPF_RECEIVE pospfReceive, FP_OSPF_SEND pospfSend); +bool ospfPartMemInitialize (); +STATUS ospf_startup( void ); + + +/*******************************/ +/* ospf_opaque_lsa.c */ +/*******************************/ +/*opaque lsa prototypes for setting opaque lsa data jkw*/ +#if defined (__OPAQUE_LSA__) +int ospfSetOrigOpaqueLsa(ULONG ip_address, ULONG netmask, BYTE lsa_type, + BYTE opaque_type); +int ospfRemoveType9(ULONG opaque_lsid, ULONG opaque_advertising_router); +int ospfRemoveType10(ULONG opaque_lsid, ULONG opaque_advertising_router); +int ospfRemoveType11(ULONG opaque_lsid, ULONG opaque_advertising_router); +int ospfRefreshOpaqueLsa(ULONG ip_address, ULONG netmask, BYTE lsa_type, + ULONG opaque_lsid, ULONG opaque_advertising_router); +ULONG ospfRetrieveNumOpaqueLsa(BYTE lsa_flooding_type); +OSPF_TYPE_9_LSA_LINK *ospfRetrieveType9(enum OSPF_SEARCH_TYPE key, ULONG key_value, ULONG area_id); +OSPF_TYPE_10_LSA_LINK *ospfRetrieveType10(enum OSPF_SEARCH_TYPE key, ULONG key_value, ULONG area_id); +OSPF_TYPE_11_LSA_LINK *ospfRetrieveType11(enum OSPF_SEARCH_TYPE key, ULONG key_value); +int ospfRemoveAllType9(); +int ospfRemoveAllType10(); +int ospfRemoveAllType11(); +int ospfRemoveAllTypes(); + +int ospfRegisterOpaqueCallback(BYTE lsa_type, + BYTE opaque_type, + int (* new_interface_hook)(struct OSPF_INTERFACE *interface), + int (* delete_interface_hook)(struct OSPF_INTERFACE *interface), + void (* interface_state_machine_change_hook)(enum OSPF_INTERFACE_EVENT event, + enum OSPF_INTERFACE_STATE state, + struct OSPF_INTERFACE *interface), + void (* neighbor_state_machine_change_hook)(enum OSPF_NEIGHBOR_EVENT event, + enum OSPF_NEIGHBOR_STATE state, + struct OSPF_INTERFACE *sptr_interface, + struct OSPF_NEIGHBOR *neighbor), + int (* opaque_lsa_originate_hook)(void *arg, + BYTE lsa_type, + BYTE opaque_type, + USHORT age), + void (* opaque_lsa_refresh_hook)(void *arg, BYTE lsa_type, ULONG opaque_lsid, USHORT age), + void (* opaque_lsa_received_hook)(UNION_OSPF_LINK_STATE_ADVERTISEMENT *sptr_advertisement)); +int ospfDeregisterOpaqueCallback(BYTE lsa_type, BYTE opaque_type); +OSPF_OPAQUE_CALLBACK *ospfRetrieveOpaqueCallback(BYTE lsa_type, BYTE opaque_type); +int ospfDeregAllOpqCallback(); +void ospf_opaque_stub(); +#endif /* __OPAQUE_LSA__ */ +OSPF_TE_PARAMETERS *ospfTeDecodeTlv(USHORT tlvlen, int TElsatype, struct OSPF_TE_TLV_DATA *pTLV); +int ospfTeEncodeTlv (void *arg, OSPF_TE_PARAMETERS *pTLVparms,char **pOpaqueDataBody,USHORT *pOpaqueDataLen); +void ospf_te_build_tlv_header (char **new_lsa, USHORT *length, OSPF_TE_TLV_HEADER *tlv_header); +void ospf_te_build_tlv_link_header (char **new_lsa, USHORT *length, OSPF_TE_PARAMETERS *pTLVparms); + +/********************/ +/* ospf_show_lsdb.c */ +/********************/ +void ospf_show_stub(); +STATUS ospfShowLsdb(); +STATUS ospfShowLsdbSummary(); +STATUS ospfShowRouterLsdb(); +STATUS ospfShowNetworkLsdb(); +STATUS ospfShowSummaryLsdb(); +STATUS ospfShowAsbrSummaryLsdb(); +STATUS ospfShowExternalLsdb(); +#if defined (__NSSA__) +STATUS ospfShowType7Lsdb(); +#endif /* __NSSA__ */ + +#if defined (__OPAQUE_LSA__) +void ospf_print_type_9(OSPF_AREA_ENTRY *sptr_area,OSPF_LS_DATABASE_ENTRY *sptr_database_entry); +void ospf_print_type_10(OSPF_AREA_ENTRY *sptr_area,OSPF_LS_DATABASE_ENTRY *sptr_database_entry); +void ospf_print_type_11(OSPF_LS_DATABASE_ENTRY *sptr_database_entry); +void ospfShowOpaqueLsdb(enum OSPF_SEARCH_TYPE key, ULONG key_value); +#endif /* __OPAQUE_LSA__ */ + +/********************/ +/* ospf_show_lsdb.c */ +/********************/ +void ospf_show_routing_stub(); +STATUS ospfShowRoutingTable(); + +/********************************************/ +/* prototypes for ospf_dynamic_config.c */ +/********************************************/ +enum BOOLEAN ospf_dynamic_validate_area( ULONG area_id ); +STATUS ospf_dynamic_create_nbma_ptmp_neighbor( OSPF_NEIGHBOR *sptr_neighbor, + ULONG intfAddr, ULONG intfAddrLess ); +void ospf_dynamic_destroy_nbma_ptmp_neighbor( OSPF_INTERFACE *sptr_interface, + OSPF_NEIGHBOR *sptr_neighbor ); +STATUS ospf_dynamic_config_metric( OSPF_INTERFACE *sptr_interface ); +void ospf_dynamic_step_intfSm( enum OSPF_INTERFACE_EVENT event, + enum OSPF_INTERFACE_STATE state, + OSPF_INTERFACE *sptr_interface ); +STATUS ospf_dynamic_create_area( OSPF_AREA_ENTRY *sptr_area ); +STATUS ospf_dynamic_reinit_area( OSPF_AREA_ENTRY *sptr_area, enum BOOLEAN delete_stub ); +STATUS ospf_dynamic_destroy_area( OSPF_AREA_ENTRY *sptr_area ); +void ospf_dynamic_reset_interface( OSPF_INTERFACE *sptr_interface ); +STATUS ospf_dynamic_init_unnumbered_interface( OSPF_INTERFACE *sptr_interface ); +STATUS ospf_dynamic_reinit_interface( OSPF_AREA_ENTRY *sptr_new_area, + OSPF_INTERFACE *sptr_interface, + enum BOOLEAN reset_interface ); +STATUS ospf_dynamic_create_interface( OSPF_INTERFACE *sptr_interface ); +STATUS ospf_dynamic_destroy_interface(OSPF_INTERFACE *sptr_interface, + OSPF_AREA_ENTRY *sptr_area ); +STATUS ospf_dynamic_create_virtIf( OSPF_INTERFACE *sptr_interface, + OSPF_AREA_ENTRY *sptr_area ); +STATUS ospf_dynamic_destory_virtIf( OSPF_INTERFACE *sptr_interface ); +void ospf_dynamic_send_default_summary_lsa( OSPF_AREA_ENTRY *sptr_area, + enum BOOLEAN send_max_age ); +void ospf_dynamic_send_summary_lsa_for_stub_area( OSPF_AREA_ENTRY *sptr_area, + enum BOOLEAN send_max_age); +void ospf_dynamic_create_area_range( OSPF_AREA_ENTRY *sptr_area, + OSPF_ADDRESS_RANGE_LIST_ENTRY *addr_ranges ); +void ospf_dynamic_destroy_area_range( OSPF_AREA_ENTRY *sptr_area, + OSPF_ADDRESS_RANGE_LIST_ENTRY *addr_range ); +enum BOOLEAN ospf_dynamic_config_overflow( ULONG new_extLsdb_limit, + ULONG new_overflow_interval ); +void ospf_dynamic_flush_opaque_lsa( OSPF_AREA_ENTRY *sptr_area ); +void ospf_dynamic_flush_external_routes( ULONG route_protocol, enum BOOLEAN is_default_route ); +void ospf_dynamic_export_external_routes( void ); +STATUS ospf_dynamic_config_redistribution( LINK *sptr_address_mask_list_head, + ULONG network_address, + ULONG network_mask, + ULONG metric_type, + ULONG metric_value, + ULONG route_type, + ULONG route_tag, + BYTE options); + +void ospf_dynamic_destroy_redistrib ( + LINK *sptr_address_mask_list_head, + OSPF_ADDRESS_MASK_PAIRS *sptr_address_mask_pair, + ULONG route_typ); + +STATUS ospf_dynamic_config_ip_route_policy(ULONG network_address, ULONG network_mask, + UCHAR route_weight ); +void ospf_dynamic_destroy_ip_route_policy( ULONG network_address, ULONG network_mask, + UCHAR route_weight ); + +/************************/ +/* ospf_show_routines.c */ +/************************/ +STATUS ospfEnableDebug(char*); +STATUS ospfDisableDebug(char*); +STATUS ospfShowDebug(); +/* SPR 81808 */ +STATUS ospfShowMemPartition(int options); +/* SPR 88613 */ +STATUS ospfShowAreaAddressRange(); +void ospf_show_routines_stub(); + +/************************/ +/* ospf_cfg_routines.c */ +/************************/ +STATUS ospfSetPassiveMode (char *commands); +STATUS ospfSetPassivePort (char *cptr_ip_address_string, enum OSPF_MODE mode); +STATUS ospfSetOpaqueEnable(); +STATUS ospfSetOpaqueDisable(); +STATUS ospfSetTotalAreaAddressRange(ULONG total_number_area_ranges); +void ospf_cfg_routines_stub(); + + +/************************/ +/* ospf_ky_driver.c */ +/************************/ +#if defined (__KY_DRIVER__) +void ospf_ky_driver(); +void ospf_ky_stub(); +#endif /* __KY_DRIVER__ */ + +/************************/ +/* ospf_sysctl.c */ +/************************/ + +void ospf_sysctl_input ( + int rsock_message, ushort_t interface_index, void *sptr_ctl_data ); + +STATUS ospf_sysctl_rtableWalk + ( + enum BOOLEAN asCapable, + enum BOOLEAN redistributeLocal, + enum BOOLEAN redistributeStatic, + enum BOOLEAN redistributeRIP, + enum BOOLEAN redistributeBGP, + enum BOOLEAN redistributeDefault, + enum BOOLEAN reachable + ); + +STATUS ospf_sysctl_routeModify( ulong_t destIpAddr, ulong_t netMask ); + +/***************************************/ +/* ospf_ospf_show_routing_table.c */ +/***************************************/ + +STATUS ospfShowAreas(void); +void ospfShowInterface(void); +void ospfShowNeighbor(void); + +#endif /* _OSPF_PROTOTYPES_H_ */ + diff --git a/h/wrn/ospf/ospf_snmp.h b/h/wrn/ospf/ospf_snmp.h new file mode 100644 index 0000000..0e728f7 --- /dev/null +++ b/h/wrn/ospf/ospf_snmp.h @@ -0,0 +1,1559 @@ +/* ospf_snmp.h */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/*modification history +___________________ + 18,26september00,reshma Added WindRiver CopyRight + 17,25september00,reshma RFC-1587 implementation for OSPF NSSA Option, also tested against ANVL. + 16,20july00,reshma Unix compatibility related changes. + 15,06july00,reshma Removed unnecessary header files and defines. + 14,04april00,reshma Added some MIB support (Read only). + Passed all important ANVL OSPF tests. + 13,23december99,reshma Compatibility with VxWorks-IP and VxWorks RTM-interface + 12,19may99,jack redefined OSPF_PATRICIA_32_BITS_KEY_MAX_BIT_POSITION as per fixes in + patricia + 11,28december98,jack Compiled and added some comments + 10,11november98,jack Config changes, linted and big endian changes + 09,30october98,jack Incorporate changes for compilation on Vxworks + 08,23august98,jack ANVL tested OSPF with PATRICIA tree route table and no recursion + 07,10august98,jack PATRICIA Route Table Based OSPF Code Base + 06,08july98,jack Patricia RT table related changes - need to be tested + 05,04june98,jack Integration with RTM and BGP + 04,10july97,cindy Pre-release v1.52b + 03,10february97,cindy Release Version 1.52 + 02,22october97,cindy Release Version 1.50 + 01,05june96,cindy First Beta Release +*/ + +#if !defined (_OSPF_SNMP_H_) +#define _OSPF_SNMP_H_ + + +SNMP_TABLE_ENTRY_PARAMETERS ospf_snmp_table_parameters[] = +{ + {(ULONG) &ospf.ospfGeneralGroupEntry, /* address of structure containing mib variable */ + FALSE /* is a table entry */ + }, + + {(ULONG) NULL, + TRUE, + 0x01, /* number of indices */ + {{ + SNMP_IP_ADDRESS_TYPE, /* index type */ + sizeof (ULONG), /* size of index */ + offsetof (OSPF_AREA_ENTRY, area_id), /* offset to index */ + FALSE, /* need to increment */ + NULL, /* vptr_index_value */ + FALSE, /* need to swap */ + NULL, /* vptr_maximum_value_of_index */ + FALSE /* should be used to get pointer to next array element */ + }}, + MIB_TABLE_AS_A_LINKED_LIST, /* table type */ + &ospf.sptr_area_list /* vptr_first_row_in_mib_table */ + }, + + {(ULONG) NULL, + TRUE, + 0x02, + {{ + SNMP_IP_ADDRESS_TYPE, + sizeof (ULONG), + offsetof (OSPF_AREA_ENTRY, area_id), + FALSE, + NULL, + FALSE, + NULL, + FALSE + },{ + SNMP_SCALAR_TYPE, + sizeof (ULONG), + offsetof (OSPF_AREA_ENTRY, mib_stub_type_of_service), + FALSE, + NULL, + FALSE, + NULL, + FALSE + }}, + MIB_TABLE_AS_A_LINKED_LIST, + &ospf.sptr_stub_area_list + + }, + + {(ULONG) NULL, + TRUE, + 0x04, + {{ + SNMP_IP_ADDRESS_TYPE, + sizeof (ULONG), + offsetof (OSPF_MIB_LS_DATABASE_ENTRY, area_id), + FALSE, + NULL, + FALSE, + NULL, + FALSE + },{ + SNMP_SCALAR_TYPE, + sizeof (BYTE), + offsetof (OSPF_MIB_LS_DATABASE_ENTRY, link_state_type), + FALSE, + NULL, + FALSE, + NULL, + FALSE + },{ + SNMP_IP_ADDRESS_TYPE, + sizeof (ULONG), + offsetof (OSPF_MIB_LS_DATABASE_ENTRY, link_state_id), + FALSE, + NULL, + FALSE, + NULL, + FALSE + },{ + SNMP_IP_ADDRESS_TYPE, + sizeof (ULONG), + offsetof (OSPF_MIB_LS_DATABASE_ENTRY, router_id), + FALSE, + NULL, + FALSE, + NULL, + FALSE + }}, + MIB_TABLE_AS_A_LINKED_LIST, + &ospf.sptr_mib_ls_database_list + }, + + {(ULONG) NULL, + TRUE, + 0x02, + {{ + SNMP_IP_ADDRESS_TYPE, + sizeof (ULONG), + offsetof (OSPF_HOSTS, interface_address), + FALSE, + NULL, + FALSE, + NULL, + FALSE + },{ + SNMP_SCALAR_TYPE, + sizeof (ULONG), + offsetof (OSPF_HOSTS, type_of_service), + FALSE, + NULL, + FALSE, + NULL, + FALSE + }}, + MIB_TABLE_AS_A_LINKED_LIST, + &ospf.sptr_host_list + }, + + {(ULONG) NULL, + TRUE, + 0x02, + {{ + SNMP_IP_ADDRESS_TYPE, + sizeof (ULONG), + offsetof (OSPF_INTERFACE, address), + FALSE, + NULL, + FALSE, + NULL, + FALSE + },{ + SNMP_SCALAR_TYPE, + sizeof (ULONG), + offsetof (OSPF_INTERFACE, mib_address_less_if), + TRUE, + NULL, + FALSE, + NULL, + TRUE + }}, + MIB_TABLE_AS_AN_ARRAY, + &ospf.port[0].sptr_interface, + sizeof (OSPF_PORT_CLASS), + NUMBER_OF_OSPF_PORTS + }, + + {(ULONG) NULL, + TRUE, + 0x03, + {{ + SNMP_IP_ADDRESS_TYPE, + sizeof (ULONG), + offsetof (OSPF_INTERFACE, address), + FALSE, + NULL, + FALSE, + NULL, + FALSE + },{ + SNMP_SCALAR_TYPE, + sizeof (ULONG), + offsetof (OSPF_INTERFACE, mib_address_less_if), + TRUE, + NULL, + FALSE, + NULL, + TRUE + },{ + SNMP_SCALAR_TYPE, + sizeof (ULONG), + offsetof (OSPF_INTERFACE, metric_type_of_service), + TRUE, + NULL, + FALSE, + NULL, + TRUE + }}, + MIB_TABLE_AS_AN_ARRAY, + &ospf.port[0].sptr_interface, + sizeof (OSPF_PORT_CLASS), + NUMBER_OF_OSPF_PORTS + }, + + {(ULONG) NULL, + TRUE, + 0x02, + {{ + SNMP_IP_ADDRESS_TYPE, + sizeof (ULONG), + offsetof (OSPF_NEIGHBOR, address), + FALSE, + NULL, + FALSE, + NULL, + FALSE + },{ + SNMP_SCALAR_TYPE, + sizeof (ULONG), + offsetof (OSPF_NEIGHBOR, mib_address_less_index), + FALSE, + NULL, + FALSE, + NULL, + FALSE + }}, + MIB_TABLE_AS_A_LINKED_LIST, + &ospf.sptr_neighbor_list + }, + + {(ULONG) NULL, + TRUE, + 0x02, + {{ + SNMP_IP_ADDRESS_TYPE, + sizeof (ULONG), + offsetof (OSPF_NEIGHBOR, mib_area_id), + FALSE, + NULL, + FALSE, + NULL, + FALSE + },{ + SNMP_IP_ADDRESS_TYPE, + sizeof (ULONG), + offsetof (OSPF_NEIGHBOR, id), + FALSE, + NULL, + FALSE, + NULL, + FALSE + }}, + MIB_TABLE_AS_A_LINKED_LIST, + &ospf.sptr_virtual_neighbor_list + }, + + {(ULONG) NULL, + TRUE, + 0x03, + {{ + SNMP_SCALAR_TYPE, + sizeof (BYTE), + offsetof (OSPF_ADVERTISEMENT_NODE, mib_ls_header.type), + FALSE, + NULL, + FALSE, + NULL, + FALSE + },{ + SNMP_IP_ADDRESS_TYPE, + sizeof (ULONG), + offsetof (OSPF_ADVERTISEMENT_NODE, mib_ls_header.id), + FALSE, + NULL, + FALSE, + NULL, + FALSE + },{ + SNMP_IP_ADDRESS_TYPE, + sizeof (ULONG), + offsetof (OSPF_ADVERTISEMENT_NODE, mib_ls_header.advertising_router), + FALSE, + NULL, + FALSE, + NULL, + FALSE + }}, + MIB_TABLE_AS_A_LINKED_LIST, + &ospf.sptr_external_advertisement_list_head + } +}; + +SNMP_TABLE_ENTRY ospf_snmp_table[] = +{ + {"ospfRouterId",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, /* need to increment mib value for get operation */ + FALSE, /* need to swap */ + (ULONG) offsetof (OSPF_MIB_GENERAL_ENTRY,ospfRouterId), + &ospf_snmp_table_parameters[0] + }, + + {"ospfAdminStat",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_boolean_plus_one, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_GENERAL_ENTRY,ospfAdminStat), + &ospf_snmp_table_parameters[0] + }, + + {"ospfVersionNumber",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_GENERAL_ENTRY,ospfVersionNumber), + &ospf_snmp_table_parameters[0] + }, + + {"ospfAreaBdrRtrStatus",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_boolean_plus_one, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_GENERAL_ENTRY,ospfAreaBdrRtrStatus), + &ospf_snmp_table_parameters[0] + }, + + {"ospfASBdrRtrStatus",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_boolean_plus_one, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_GENERAL_ENTRY,ospfASBdrRtrStatus), + &ospf_snmp_table_parameters[0] + }, + + {"ospfExternLsaCount",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_GENERAL_ENTRY,ospfExternLsaCount), + &ospf_snmp_table_parameters[0] + }, + + {"ospfExternLsaCksumSum",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_GENERAL_ENTRY,ospfExternLsaCksumSum), + &ospf_snmp_table_parameters[0] + }, + + {"ospfTOSSupport",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_boolean_plus_one, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_GENERAL_ENTRY,ospfTOSSupport), + &ospf_snmp_table_parameters[0] + }, + + {"ospfOriginateNewLsas",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_GENERAL_ENTRY,ospfOriginateNewLsas), + &ospf_snmp_table_parameters[0] + }, + + {"ospfRxNewLsas",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_GENERAL_ENTRY,ospfRxNewLsas), + &ospf_snmp_table_parameters[0] + }, + + {"ospfExtLsdbLimit",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_GENERAL_ENTRY,ospfExtLsdbLimit), + &ospf_snmp_table_parameters[0] + }, + + {"ospfMulticastExtensions",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_GENERAL_ENTRY,ospfMulticastExtensions), + &ospf_snmp_table_parameters[0] + }, + + {"ospfExitOverflowInterval",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_GENERAL_ENTRY,ospfExitOverflowInterval), + &ospf_snmp_table_parameters[0] + }, + + {"ospfDemandExtensions",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_boolean_plus_one, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_GENERAL_ENTRY,ospfDemandExtensions), + &ospf_snmp_table_parameters[0] + }, + + {"ospfAreaId",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_AREA_ENTRY,area_id), + &ospf_snmp_table_parameters[1] + }, + + {"ospfImportAsExtern",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_AREA_ENTRY,mib_import_as_external), + &ospf_snmp_table_parameters[1] + }, + + {"ospfSpfRuns",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_AREA_ENTRY,shortest_path_first_run_count), + &ospf_snmp_table_parameters[1] + }, + + {"ospfAreaBdrRtrCount",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_AREA_ENTRY,number_of_area_border_routers), + &ospf_snmp_table_parameters[1] + }, + + {"ospfAsBdrRtrCount",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_AREA_ENTRY,number_of_autonomous_system_boundary_routers), + &ospf_snmp_table_parameters[1] + }, + + {"ospfAreaLsaCount",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_AREA_ENTRY,mib_number_of_link_state_advertisements), + &ospf_snmp_table_parameters[1] + }, + + {"ospfAreaLsaCksumSum",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_AREA_ENTRY,mib_checksum_sum), + &ospf_snmp_table_parameters[1] + }, + + {"ospfAreaSummary",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_AREA_ENTRY,mib_area_summary), + &ospf_snmp_table_parameters[1] + }, + + {"ospfAreaStatus",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_boolean_plus_one, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_AREA_ENTRY,mib_area_status), + &ospf_snmp_table_parameters[1] + }, + + {"ospfStubAreaId",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_AREA_ENTRY,area_id), + &ospf_snmp_table_parameters[2] + }, + + {"ospfStubTOS",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_AREA_ENTRY,mib_stub_type_of_service), + &ospf_snmp_table_parameters[2] + }, + + {"ospfStubMetric",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_AREA_ENTRY,stub_default_cost), + &ospf_snmp_table_parameters[2] + }, + + {"ospfStubStatus",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_boolean_plus_one, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_AREA_ENTRY,mib_area_status), + &ospf_snmp_table_parameters[2] + }, + + {"ospfStubMetricType",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_AREA_ENTRY,mib_stub_metric_type), + &ospf_snmp_table_parameters[2] + }, + + {"ospfLsdbAreaId",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_LS_DATABASE_ENTRY,area_id), + &ospf_snmp_table_parameters[3] + }, + + {"ospfLsdbType",sizeof (BYTE), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_byte, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_LS_DATABASE_ENTRY,link_state_type), + &ospf_snmp_table_parameters[3] + }, + + {"ospfLsdbLsid",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_LS_DATABASE_ENTRY,link_state_id), + &ospf_snmp_table_parameters[3] + }, + + {"ospfLsdbRouterId",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_LS_DATABASE_ENTRY,router_id), + &ospf_snmp_table_parameters[3] + }, + + {"ospfLsdbSequence",sizeof (long), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_8_byte_object, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_LS_DATABASE_ENTRY,sequence), + &ospf_snmp_table_parameters[3] + }, + + {"ospfLsdbAge",sizeof (long), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_LS_DATABASE_ENTRY,age), + &ospf_snmp_table_parameters[3] + }, + + {"ospfLsdbChecksum",sizeof (long), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_LS_DATABASE_ENTRY,checksum), + &ospf_snmp_table_parameters[3] + }, + + {"ospfLsdbAdvertisement", MAXIMUM_ETHERNET_DATA_SIZE, + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_string, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_LS_DATABASE_ENTRY,advertisement), + &ospf_snmp_table_parameters[3] + }, + + {"ospfAreaRangeAreaId", sizeof (long), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_AREA_ENTRY,area_id), + &ospf_snmp_table_parameters[2] + }, + +/* {"ospfAreaRangeNet", sizeof (long), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_AREA_ENTRY,mib_area_range_net), + &ospf_snmp_table_parameters[1] + }, + + {"ospfAreaRangeMask", sizeof (long), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_AREA_ENTRY,mib_area_range_mask), + &ospf_snmp_table_parameters[1] + }, + + {"ospfAreaRangeStatus", sizeof (long), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_AREA_ENTRY,mib_area_range_status), + &ospf_snmp_table_parameters[1] + }, +*/ + {"ospfHostIpAddress",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_HOSTS,interface_address), + &ospf_snmp_table_parameters[4] + }, + + {"ospfHostTOS",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_HOSTS,type_of_service), + &ospf_snmp_table_parameters[4] + }, + + {"ospfHostMetric",sizeof (USHORT), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ushort, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_HOSTS,cost), + &ospf_snmp_table_parameters[4] + }, + + {"ospfHostStatus",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_boolean_plus_one, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_HOSTS,status), + &ospf_snmp_table_parameters[4] + }, + + {"ospfHostAreaID",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_HOSTS,area_id), + &ospf_snmp_table_parameters[4] + }, + + {"ospfIfIpAddress",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,address), + &ospf_snmp_table_parameters[5] + }, + + {"ospfAddressLessIf",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,mib_address_less_if), + &ospf_snmp_table_parameters[5] + }, + + {"ospfIfAreaId",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,mib_area_id), + &ospf_snmp_table_parameters[5] + }, + + {"ospfIfType",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,type), + &ospf_snmp_table_parameters[5] + }, + + {"ospfIfAdminStat",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_boolean_plus_one, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,mib_admin_status), + &ospf_snmp_table_parameters[5] + }, + + {"ospfIfRtrPriority",sizeof (USHORT), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ushort, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,priority), + &ospf_snmp_table_parameters[5] + }, + + {"ospfIfTransitDelay",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,transmit_delay), + &ospf_snmp_table_parameters[5] + }, + + {"ospfIfRetransInterval",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,retransmit_interval), + &ospf_snmp_table_parameters[5] + }, + + {"ospfIfHelloInterval",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,hello_interval), + &ospf_snmp_table_parameters[5] + }, + + {"ospfIfRtrDeadInterval",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,router_dead_interval), + &ospf_snmp_table_parameters[5] + }, + + {"ospfIfPollInterval",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,poll_interval), + &ospf_snmp_table_parameters[5] + }, + + {"ospfIfState",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,state), + &ospf_snmp_table_parameters[5] + }, + + {"ospfIfDesignatedRouter",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,designated_router.id), + &ospf_snmp_table_parameters[5] + }, + + {"ospfIfBackupDesignatedRouter",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,backup_designated_router.id), + &ospf_snmp_table_parameters[5] + }, + + {"ospfIfEvents",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,events), + &ospf_snmp_table_parameters[5] + }, + + {"ospfIfAuthKey",sizeof (BYTE), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_byte, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,authentication.key_or_plain_text_passwd ), + &ospf_snmp_table_parameters[5] + }, + + {"ospfIfStatus",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_boolean_plus_one, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,mib_status), + &ospf_snmp_table_parameters[5] + }, + + {"ospfIfMulticastForwarding",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,mib_multicast_forwarding), + &ospf_snmp_table_parameters[5] + }, + + {"ospfIfDemand",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_boolean_plus_one, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,mib_demand), + &ospf_snmp_table_parameters[5] + }, + + {"ospfIfAuthType",sizeof (USHORT), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ushort, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,authentication.type), + &ospf_snmp_table_parameters[5] + }, + + {"ospfIfMetricIpAddress",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,address), + &ospf_snmp_table_parameters[6] + }, + + {"ospfIfMetricAddressLessIf",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,mib_address_less_if), + &ospf_snmp_table_parameters[6] + }, + + {"ospfIfMetricTOS",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,metric_type_of_service), + &ospf_snmp_table_parameters[6] + }, + + {"ospfIfMetricValue",sizeof (USHORT), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ushort, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,cost), + &ospf_snmp_table_parameters[6] + }, + + {"ospfIfMetricStatus",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_boolean_plus_one, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,metric_status), + &ospf_snmp_table_parameters[6] + }, + + {"ospfVirtIfAreaId",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,mib_area_id), + &ospf_snmp_table_parameters[7] + }, + + {"ospfVirtIfNeighbor",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,virtual_neighbor_rid), + &ospf_snmp_table_parameters[7] + }, + + {"ospfVirtIfTransitDelay",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,transmit_delay), + &ospf_snmp_table_parameters[7] + }, + + {"ospfVirtIfRetransInterval",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,retransmit_interval), + &ospf_snmp_table_parameters[7] + }, + + {"ospfVirtIfHelloInterval",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,hello_interval), + &ospf_snmp_table_parameters[7] + }, + + {"ospfVirtIfRtrDeadInterval",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,router_dead_interval), + &ospf_snmp_table_parameters[7] + }, + + {"ospfVirtIfState",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,state), + &ospf_snmp_table_parameters[7] + }, + + {"ospfVirtIfEvents",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,events), + &ospf_snmp_table_parameters[7] + }, + + {"ospfVirtIfAuthType",sizeof (USHORT), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ushort, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,authentication.type), + &ospf_snmp_table_parameters[7] + }, + + {"ospfVirtIfAuthKey",sizeof (BYTE), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_byte, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,authentication.key_or_plain_text_passwd), + &ospf_snmp_table_parameters[7] + }, + + {"ospfVirtIfStatus",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_INTERFACE,mib_status), + &ospf_snmp_table_parameters[7] + }, + + {"ospfNbrIpAddr",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_NEIGHBOR,address), + &ospf_snmp_table_parameters[8] + }, + + {"ospfNbrAddressLessIndex",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_NEIGHBOR,mib_address_less_index), + &ospf_snmp_table_parameters[8] + }, + + {"ospfNbrRtrId",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_NEIGHBOR,id), + &ospf_snmp_table_parameters[8] + }, + + {"ospfNbrOptions",sizeof (BYTE), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_byte, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_NEIGHBOR,options), + &ospf_snmp_table_parameters[8] + }, + + {"ospfNbrPriority",sizeof (USHORT), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ushort, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_NEIGHBOR,priority), + &ospf_snmp_table_parameters[8] + }, + + {"ospfNbrState",sizeof (BYTE), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_byte, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_NEIGHBOR,state), + &ospf_snmp_table_parameters[8] + }, + + {"ospfNbrEvents",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_NEIGHBOR,events), + &ospf_snmp_table_parameters[8] + }, + + {"ospfNbrLsRetransQLen",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_NEIGHBOR,retransmit_queue_count), + &ospf_snmp_table_parameters[8] + }, + + {"ospfNbmaNbrStatus",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_boolean_plus_one, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_NEIGHBOR,mib_nbma_status), + &ospf_snmp_table_parameters[8] + }, + + {"ospfNbmaNbrPermanence",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_boolean_plus_one, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_NEIGHBOR,mib_nbma_permanence), + &ospf_snmp_table_parameters[8] + }, + + {"ospfNbrHelloSuppressed",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_boolean_plus_one, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_NEIGHBOR,mib_hello_suppressed), + &ospf_snmp_table_parameters[8] + }, + + {"ospfVirtNbrArea",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_NEIGHBOR,mib_area_id), + &ospf_snmp_table_parameters[9] + }, + + {"ospfVirtNbrRtrId",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_NEIGHBOR,id), + &ospf_snmp_table_parameters[9] + }, + + {"ospfVirtNbrIpAddr",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_NEIGHBOR,address), + &ospf_snmp_table_parameters[9] + }, + + {"ospfVirtNbrOptions",sizeof (BYTE), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_byte, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_NEIGHBOR,options), + &ospf_snmp_table_parameters[9] + }, + + {"ospfVirtNbrState",sizeof (BYTE), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_byte, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_NEIGHBOR,state), + &ospf_snmp_table_parameters[9] + }, + + {"ospfVirtNbrEvents",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_NEIGHBOR,events), + &ospf_snmp_table_parameters[9] + }, + + {"ospfVirtNbrLsRetransQLen",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_NEIGHBOR,retransmit_queue_count), + &ospf_snmp_table_parameters[9] + }, + + {"ospfVirtNbrHelloSuppressed",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_boolean_plus_one, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_NEIGHBOR,mib_hello_suppressed), + &ospf_snmp_table_parameters[9] + }, + + {"ospfExtLsdbType",sizeof (BYTE), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_byte, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_ADVERTISEMENT_NODE,mib_ls_header.type), + &ospf_snmp_table_parameters[10] + }, + + {"ospfExtLsdbLsid",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_ADVERTISEMENT_NODE,mib_ls_header.id), + &ospf_snmp_table_parameters[10] + }, + + {"ospfExtLsdbRouterId",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_ADVERTISEMENT_NODE,mib_ls_header.advertising_router), + &ospf_snmp_table_parameters[10] + }, + + {"ospfExtLsdbSequence",sizeof (long), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_8_byte_object, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_ADVERTISEMENT_NODE,mib_ls_header.sequence_number), + &ospf_snmp_table_parameters[10] + }, + + {"ospfExtLsdbAge",sizeof (long), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_ADVERTISEMENT_NODE,mib_ls_header.age), + &ospf_snmp_table_parameters[10] + }, + + {"ospfExtLsdbChecksum",sizeof (long), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_ADVERTISEMENT_NODE,mib_ls_header.checksum), + &ospf_snmp_table_parameters[10] + }, + + {"ospfExtLsdbAdvertisement", MAXIMUM_ETHERNET_DATA_SIZE, + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_string, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_ADVERTISEMENT_NODE,mib_advertisement), + &ospf_snmp_table_parameters[10] + }, + + /*opaque lsa new snmp opaque variables jkw*/ + {"ospfLsa9AreaId",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_LSA9_DATABASE_ENTRY,area_id), + &ospf_snmp_table_parameters[3] + }, + + {"ospfLsa9Type",sizeof (BYTE), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_byte, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_LSA9_DATABASE_ENTRY,link_state_type), + &ospf_snmp_table_parameters[3] + }, + + {"ospfLsa9Lsid",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_LSA9_DATABASE_ENTRY,link_state_id), + &ospf_snmp_table_parameters[3] + }, + + {"ospfLsa9RouterId",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_LSA9_DATABASE_ENTRY,router_id), + &ospf_snmp_table_parameters[3] + }, + + {"ospfLsa9Sequence",sizeof (long), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_8_byte_object, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_LSA9_DATABASE_ENTRY,sequence), + &ospf_snmp_table_parameters[3] + }, + + {"ospfLsa9Age",sizeof (long), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_LSA9_DATABASE_ENTRY,age), + &ospf_snmp_table_parameters[3] + }, + + {"ospfLsa9Checksum",sizeof (long), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_LSA9_DATABASE_ENTRY,checksum), + &ospf_snmp_table_parameters[3] + }, + + {"ospfLsa9Advertisement", MAXIMUM_ETHERNET_DATA_SIZE, + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_string, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_LSA9_DATABASE_ENTRY,advertisement), + &ospf_snmp_table_parameters[3] + }, + + {"ospfType9LsaCount",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_GENERAL_ENTRY,ospfType9LsaCount), + &ospf_snmp_table_parameters[0] + }, + + {"ospfType9LsaCksumSum",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_GENERAL_ENTRY,ospfType9LsaCksumSum), + &ospf_snmp_table_parameters[0] + }, + + {"ospfLsa11Type",sizeof (BYTE), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_byte, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_LSA11_DATABASE_ENTRY,link_state_type), + &ospf_snmp_table_parameters[3] + }, + + {"ospfLsa11Lsid",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_LSA11_DATABASE_ENTRY,link_state_id), + &ospf_snmp_table_parameters[3] + }, + + {"ospfLsa11RouterId",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_LSA11_DATABASE_ENTRY,router_id), + &ospf_snmp_table_parameters[3] + }, + + {"ospfLsa11Checksum",sizeof (long), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_LSA11_DATABASE_ENTRY,checksum), + &ospf_snmp_table_parameters[3] + }, + + {"ospfLsa11Advertisement", MAXIMUM_ETHERNET_DATA_SIZE, + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_string, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_LSA11_DATABASE_ENTRY,advertisement), + &ospf_snmp_table_parameters[3] + }, + + {"ospfType11LsaCount",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_GENERAL_ENTRY,ospfType11LsaCount), + &ospf_snmp_table_parameters[0] + }, + + {"ospfType11LsaCksumSum",sizeof (ULONG), + (enum TEST (*) (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset_into_class, ULONG class_address, + ULONG size_of_port_class, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained)) + snmp_get_or_set_ulong, + FALSE, + FALSE, + (ULONG) offsetof (OSPF_MIB_GENERAL_ENTRY,ospfType11LsaCksumSum), + &ospf_snmp_table_parameters[0] + }, + + + + {"",0x0000,NULL, + (ULONG) NULL, + (ULONG) NULL, + (ULONG) NULL + } +}; + +#endif /* _OSPF_SNMP_H_ */ +GLOBAL diff --git a/h/wrn/ospf/ospf_structures.h b/h/wrn/ospf/ospf_structures.h new file mode 100644 index 0000000..8f40a3f --- /dev/null +++ b/h/wrn/ospf/ospf_structures.h @@ -0,0 +1,1771 @@ +/* ospf_structures.h - ospf structures*/ + +/* Copyright 2000-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +03l,07jan05,xli porting external route redistribution feature from ospf2.3.1 +03o,29nov04,tlu OSPF stack decoupling +03n,28oct04,dsk trace B0442 +03m,12may04,ram remove usless field, ospf.sptr_lsdb_print_queue +03m,30apr04,mwv SPR#91272 replace inject_default_route_if_stub_area with + the area_summary flag for stub areas +03l,07apr04,ram OSPF v2/v3 coexistance compile +03k,23mar04,zhr Added ls_database_freeme for the build issue. +03j,12mar04,mwv SPR#94408: modify route redistribuition API to support + route tag +03i,12mar04,ram SPR#94944 OSPF performance modifications +03h,29jan04,ram NBMA, PTMP, & Unnumbered modifications +04f,16dec03,agi propogated weighted routes fixes +04e,14dec03,agi fixed compile error +04d,08dec03,agi merged fixes from OSPF 2.1 patch branch +04c,31oct03,kc Fixed SPR#91541 - added new OSPF_ROUTE_POLICY_PAIRS structure defs. + Also added route_policy_list OSPF_ROUTE_POLICY_PAIRS linked list to + the OSPF_CLASS. +04b,29sep03,agi removed #include "ospf_container.h" +04a,27sep03,agi ported to Accordion stack +03i,22oct03,mwv SPR#91511 added ls_database_freeme_age to calculate ls age + beyond the maxage. This age is use for the cleanup + interval. + Removed ls_database_pending_delete boolean. +03h,03jul03,ram Backed out SPR#88600 workaround +03g,11jun03,ram SPR#88965 Separate route table and LSDB hash parameters +03f,10jun03,dsk SPR 88600 fix for stuck in EXCHANGE_START (timer added + to restart if stuck in exchange start state too long) +03e,06jun03,kkz Unpacked HELLO_HEADER structure (makes no difference - struct is naturally + packed) and OSPF_ROUTER_LINK_ADVERTISEMENT_HEADER +03d,26may03,dsk SPR#88619 Fix early LSA retransmission +03c,26may03,agi Removed RWOS-specific references +03b,26may03,dsk SPR 88600 fix for stuck in EXCHANGE_START (timer added + to restart if stuck in exchange start state too long) +03a,23may03,agi Renamed OSPF watchdog, semaphores +02z,22may03,dsk SPR#88619 Fix early LSA retransmission +02y,09may03,agi Added OSPF tasks structures +02y,08may03,asr Changes to make OSPF virtual stack compatible +02x,22apr03,ram SPR#76812 Modifications for OSPF performance enhancements +02w,29jan03,mwv SPR 85893 added member ls_database_pending_delete to OSPF_LS_DATABASE_ENTRY +02v,28jan03,ram SPR 85050 Added support for external route redistribution based on + OSPF external metric values +02u,06jan03,ram SPR 85432 Changes to allow more OSPF external route processing +02t,09dec02,ram SPR 83418 Added support for OSPF metric type and value configuration +02s,24dec02,dsk SPR#75194, ANVL 27.15 - added sptr_old_routing_table + pointer to the ospf datastructure +02s,20feb03,kc Fixed SPR#86319 - rename inject_default_route_if_stub_area to + inject_summary_lsa_into_stub_area in OSPF_AREA_ENTRY and + OSPF_AREA_CONFIGURATION_CLASS structures. +02q,09dec02,hme Fixed SPR#75796 ANVL 37.1 +02p,19nov02,mwv Merge TMS code SPR 84284 +02o,05aug02,jkw Fix TSR 288030 +02n,28jun02,kc Fixed SPR 78381 - Added inject_default_route_if_stub_area to + OSPF_AREA_ENTRY structure. +02m,24may02,kc Added ifnet_index and ifnet_flags to OSPF_INTERFACE structure. +02l,23apr02,kc Added number_of_stub_areas and number_of_nssa_areas counters + to OSPF_CLASS. Removed unused bufPtr array from OSPF_CLASS. +02k,13feb02,jkw Remove preproc around structures. Possible alignment problems. +02j,20dec01,jkw Removed sptr_area->sptr_interfaces structure. +02i,13dec01,kc Removed unused mib_import_as_external from OSPF_AREA_ENTRY + structure. +02h,13nov01,jkw Change number of address ranges to ULONG +02g,25oct01,kc Added area_id to OSPF_ADDRESS_RANGE_LIST_ENTRY. +02f,13oct01,kc Dynamic configuration changes. +02e,29sep01,kc Added interface_index in OSPF_INTERFACE structure. +02d,29sep01,kc Defined separate M_BLK_ID for OSPF_ADDR_ALLSPF and + OSPF_ADDR_ALLDR in OSPF_INTERFACE structure. +02c,22sep01,kc Made sptr_interface linked list visible in OSPF_CLASS. +02b,22aug01,jkw Added opaque lsa structure changes. +02a,13aug01,aos Added new tid member to OSPF class +01z,23jul01,jkw Added in changes for new UNION_OSPF_LS_ID structure +01y,20jun01,jkw Added unnumbered link support +01x,21may01,jkw Updated for point to point +01w,11may01,aos Added new ls_database_last_originated_time_stamp member to + OSPF_LS_DATABASE_ENTRY +01v,26sep00,res Added WindRiver CopyRight +01u,25sep00,res RFC-1587 implementation for OSPF NSSA Option, also tested + against ANVL. +01t,20jul00,res Unix compatibility related changes. +01s,06jul00,res Removed unnecessary header files and defines. +01r,04apr00,res Added some MIB support (Read only). Passed all important + ANVL OSPF tests. +01q,23dec99,res Compatibility with VxWorks-IP and VxWorks RTM-interface +01p,19may99,jac redefined OSPF_PATRICIA_32_BITS_KEY_MAX_BIT_POSITION as per + fixes in patricia +01o,22jan99,jac unpacked structs that shouldnt be packed +01n,22jan99,jac removed pack on three structures +01m,28dec98,jac Compiled and added some comments +01l,03dec98,jac Structure unpacking +01k,13nov98,jac Changes related to introducing queuing in OSPF to RTM interface + and bug fix on the external route additions path (to RTM) +01j,11nov98,jac Config changes, linted and big endian changes +01i,30oct98,jac Incorporate changes for compilation on Vxworks +01h,23aug98,jac ANVL tested OSPF with PATRICIA tree route table and no recursion +01g,10aug98,jac PATRICIA Route Table Based OSPF Code Base +01f,08jul98,jac Patricia RT table related changes - need to be tested +01e,04jun98,jac Integration with RTM and BGP +01d,10jul97,cin Pre-release v1.52b +01c,10feb97,cin Release Version 1.52 +01b,22oct97,cin Release Version 1.50 +01a,05jun96,cin First Beta Release +*/ + + +#if !defined (_OSPF_STRUCTURES_H_) +#define _OSPF_STRUCTURES_H_ + +/* includes */ +#include +#include +#include +#include + +enum PROTOCOL_STACK_TYPE +{ + IP_PROTOCOL_STACK, + IPX_PROTOCOL_STACK, + SPANNING_TREE_STACK, + SOURCE_ROUTING_STACK, + NLSP_PROTOCOL_STACK, + DLSW_PROTOCOL_STACK, + OSPF_PROTOCOL_STACK, + APPLETALK_PROTOCOL_STACK, + NETBIOS_PROTOCOL_STACK, + VINES_PROTOCOL_STACK, + CONSOLE_PROTOCOL_STACK, + L2TP_PROTOCOL_STACK, + RTM_PROTOCOL_STACK, + PPTP_DATA_TUNNEL, + PPP_OVER_ETHERNET_PROTOCOL_STACK, + VPN_INTERFACE_VIRTUAL_PROTOCOL_STACK +}; + +enum PROTOCOL_CONTROL_OPERATION +{ + OPEN_PROTOCOL_STACK, + CLOSE_PROTOCOL_STACK, + GET_IP_ADDRESS_FOR_PORT, + + IS_PROTOCOL_STACK_ENABLED = 0x0100, + GET_NUMBER_OF_PROTOCOL_STACKS_VIRTUAL_PORTS, + GET_PROTOCOL_STACK_TYPE, + GET_PROTOCOL_STACK_PROTOCOL_ID, + GET_PROTOCOL_STACK_SSAP, + GET_PROTOCOL_STACK_DSAP, + GET_PROTOCOL_STACK_VIRTUAL_PORT_PACKET_TYPE, + GET_PROTOCOL_STACK_REAL_PORT_NUMBER_USING_VIRTUAL_PORT_NUMBER, + + INITIALIZE_SOCKET_PROTOCOL_STACK_INTERFACE, + + IS_TOKEN_RING_FRAME_SOURCE_ROUTED, + IS_TOKEN_RING_FRAME_A_MAC, + GET_LENGTH_OF_TOKEN_RING_RIF, + CLEAR_SOURCE_ROUTED_BIT, + MOVE_RIF_INTO_PACKET, + IS_MAC_ADDRESS_SOURCE_ROUTED, + REGISTER_TO_IP_FROM_UPPER_LAYER, + + INITIALIZE_STACK_FUNCTION_POINTERS, + INITIALIZE_PROTOCOL_FUNCTION_POINTERS, + GET_PROTOCOL_ADDRESS, + CLEAR_CACHED_ROUTE, + REINITIALIZE_PROTOCOL_STACK, + PROTOCOL_STACK_ROUTERWARE_CONTROL, + UNINITIALIZE_PROTOCOL_STACK, + PROTOCOL_ROUTE_ADDED, + PROTOCOL_ROUTE_DELETED, + PROTOCOL_ROUTE_CHANGED, + LLC_PROTOCOL_STACK, + REGISTER_NAT_FILTER = 200, + DEREGISTER_NAT_FILTER, + OPEN_PROTOCOL_STACK_PORT, + CLOSE_PROTOCOL_STACK_PORT, + ADD_IP_ADDRESS_AND_NETWORK_MASK_FOR_PORT, + ADD_REMOTE_IP_ADDRESS_FOR_PORT, + + OPEN_VIRTUAL_PORT, + CLOSE_VIRTUAL_PORT, + REINITIALIZE_VIRTUAL_PORT, + UNINITIALIZE_VIRTUAL_PORT +}; + +enum LSL_PACKET_TYPE +{ + RAW_8023, + ETHERNET_TYPE_II, + LLC_PACKET, + SNAP_PACKET, + WAN_PACKET, + SAME_TYPE_AS_RX_PACKET_, + + __ENUM_USHORT_FILLER_ = 0x1000 +}; + + +typedef struct OSPF_RETURN_TYPE +{ + enum OSPF_PACKET_STATE packet_state; + BYTE_ENUM (BOOLEAN) exit_routine; +} OSPF_RETURN_TYPE; + +/* used for pointer manipulation when inserting and removing nodes in a list */ +typedef struct OSPF_GENERIC_NODE +{ + struct OSPF_GENERIC_NODE *sptr_forward_link; + struct OSPF_GENERIC_NODE *sptr_backward_link; +} OSPF_GENERIC_NODE; + +/* used for pointer manipulation when inserting and removing nodes in a list */ +typedef struct OSPF_STACK_NODE +{ + struct OSPF_STACK_NODE *sptr_forward_link; + struct OSPF_STACK_NODE *sptr_backward_link; + void *vptr_data; +} OSPF_STACK_NODE; + +#if (_BYTE_ORDER == _LITTLE_ENDIAN ) +typedef _struct OSPF_OPTIONS +{ + BIT_FIELD (enum,BOOLEAN) tos:1; + BIT_FIELD (enum,BOOLEAN) externals:1; + BIT_FIELD (enum,BOOLEAN) multicast:1; + BIT_FIELD (enum,BOOLEAN) nssa:1; + BIT_FIELD (enum,BOOLEAN) dont_propagate:1; + /*opaque lsa new opaque option bit jkw*/ + BIT_FIELD (enum,BOOLEAN) demand_circuit:1; + BIT_FIELD (enum,BOOLEAN) opaque:1; + BIT_FIELD (enum,BOOLEAN) not_used:1; +} _pack OSPF_OPTIONS; +#else /* _BYTE_ORDER == _BIG_ENDIAN */ +typedef _struct OSPF_OPTIONS +{ + /*opaque lsa new opaque option bit jkw*/ + BIT_FIELD (enum,BOOLEAN) not_used:1; + BIT_FIELD (enum,BOOLEAN) opaque:1; + BIT_FIELD (enum,BOOLEAN) demand_circuit:1; + BIT_FIELD (enum,BOOLEAN) dont_propagate:1; + BIT_FIELD (enum,BOOLEAN) nssa:1; + BIT_FIELD (enum,BOOLEAN) multicast:1; + BIT_FIELD (enum,BOOLEAN) externals:1; + BIT_FIELD (enum,BOOLEAN) tos:1; +} _pack OSPF_OPTIONS; +#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ + +typedef _union UNION_OSPF_OPTIONS +{ + OSPF_OPTIONS _bit; + BYTE _byte; +} _pack UNION_OSPF_OPTIONS; + +#if (_BYTE_ORDER == _LITTLE_ENDIAN ) +typedef _struct OSPF_FLAGS +{ + BIT_FIELD (enum,BOOLEAN) master:1; + BIT_FIELD (enum,BOOLEAN) more:1; + BIT_FIELD (enum,BOOLEAN) initialize:1; + BIT_FIELD (enum,BOOLEAN) not_used:5; +} _pack OSPF_FLAGS; +#else /* _BYTE_ORDER == _BIG_ENDIAN */ +typedef _struct OSPF_FLAGS +{ + BIT_FIELD (enum,BOOLEAN) not_used:5; + BIT_FIELD (enum,BOOLEAN) initialize:1; + BIT_FIELD (enum,BOOLEAN) more:1; + BIT_FIELD (enum,BOOLEAN) master:1; +} _pack OSPF_FLAGS; +#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ + +typedef _union UNION_OSPF_FLAGS +{ + OSPF_FLAGS _bit; + BYTE _byte; +} _pack UNION_OSPF_FLAGS; + +typedef _struct OSPF_MD5_AUTHENTICATION +{ + USHORT offset; + BYTE key_ID; + BYTE authentication_data_length; + ULONG cryptographic_sequence_number; +} _pack OSPF_MD5_AUTHENTICATION; + +typedef _union UNION_OSPF_AUTHENTICATION_FIELD +{ + BYTE key_or_plain_text_passwd[OSPF_AUTHENTICATION_SIMPLE_SIZE]; + OSPF_MD5_AUTHENTICATION md5; +} _pack UNION_OSPF_AUTHENTICATION_FIELD; + +/*opaque lsa new opaque lsa header jkw*/ +typedef _struct OSPF_LS_ID +{ + BYTE opaque_type; + BYTE opaque_reserved; + USHORT opaque_instance; +} _pack OSPF_LS_ID; + +typedef _union UNION_OSPF_LS_ID +{ + OSPF_LS_ID opaque_lsid; + ULONG lsid; +} _pack UNION_OSPF_LS_ID; + +typedef _struct OSPF_LS_OPAQUE_HEADER +{ + USHORT age; + UNION_OSPF_OPTIONS options; + BYTE_ENUM (OSPF_LS_TYPE) type; /* Type of advertisement */ + UNION_OSPF_LS_ID id; /* Link State Id */ + ULONG advertising_router; + seq_t sequence_number; + USHORT checksum; + USHORT length; /* length of advertisement*/ +} OSPF_LS_OPAQUE_HEADER; + +typedef _struct OSPF_LS_HEADER +{ + USHORT age; + UNION_OSPF_OPTIONS options; + BYTE_ENUM (OSPF_LS_TYPE) type; /* Type of advertisement */ + ULONG id; /* Link State Id */ + ULONG advertising_router; + seq_t sequence_number; + USHORT checksum; + USHORT length; /* length of advertisement*/ +} OSPF_LS_HEADER; + +typedef _struct OSPF_HELLO_HEADER +{ + ULONG network_mask; /* network mask associated with this interface */ + USHORT hello_interval; /* number of seconds between this router's Hello + packets */ + UNION_OSPF_OPTIONS options; /* optional capabilities supported by this router */ + BYTE router_priority; /* if set to 0, this router is not eligible to + become designated router */ + ULONG router_dead_interval; /* number of seconds before declaring a + silent router down */ + ULONG designated_router; /* identity of the designated router for + this network */ + ULONG backup_designated_router; /* identity of the backup designated + router for this network */ + ULONG neighbor; /* IDs of each router from whom valid Hello packets + have been seen recently on this network */ +} OSPF_HELLO_HEADER; + +typedef _struct OSPF_DATABASE_HEADER +{ + /* RFC 2178 G.9 */ + USHORT interface_mtu; + UNION_OSPF_OPTIONS options; + UNION_OSPF_FLAGS flags; + ULONG sequence; + OSPF_LS_HEADER link_state_advertisement_header; +} _pack OSPF_DATABASE_HEADER; + +typedef _struct OSPF_LS_REQUESTED_ADVERTISEMENT +{ + BYTE reserved_bytes[3]; + BYTE type; /* Type of advertisement */ + ULONG id; /* Link State Id */ + ULONG advertising_router; +} _pack OSPF_LS_REQUESTED_ADVERTISEMENT; + +typedef _struct OSPF_LS_REQUEST_HEADER +{ + OSPF_LS_REQUESTED_ADVERTISEMENT requested_advertisement; +} _pack OSPF_LS_REQUEST_HEADER; + +#if (_BYTE_ORDER == _LITTLE_ENDIAN ) +typedef _struct OSPF_ROUTER_LINK_BIT_OPTIONS +{ + BIT_FIELD (enum,BOOLEAN) bit_B:1; + BIT_FIELD (enum,BOOLEAN) bit_E:1; + BIT_FIELD (enum,BOOLEAN) bit_V:1; + BIT_FIELD (enum,BOOLEAN) not_used:5; +} _pack OSPF_ROUTER_LINK_BIT_OPTIONS; +#else /* _BYTE_ORDER == _BIG_ENDIAN */ +typedef _struct OSPF_ROUTER_LINK_BIT_OPTIONS +{ + BIT_FIELD (enum,BOOLEAN) not_used:5; + BIT_FIELD (enum,BOOLEAN) bit_V:1; + BIT_FIELD (enum,BOOLEAN) bit_E:1; + BIT_FIELD (enum,BOOLEAN) bit_B:1; +} _pack OSPF_ROUTER_LINK_BIT_OPTIONS; +#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ + +typedef _union UNION_OSPF_ROUTER_LINK_BIT_OPTIONS +{ + OSPF_ROUTER_LINK_BIT_OPTIONS _bit; + USHORT _ushort; +} _pack UNION_OSPF_ROUTER_LINK_BIT_OPTIONS; + +typedef _struct OSPF_ROUTER_LINK_METRIC_PIECE +{ + USHORT tos; + USHORT metric; +} _pack OSPF_ROUTER_LINK_METRIC_PIECE; + +typedef _struct OSPF_ROUTER_LINK_PIECE +{ + ULONG link_id; + ULONG link_data; + BYTE_ENUM (OSPF_ROUTER_LINK_TYPE) type; + BYTE number_of_metrics; + USHORT tos0_metric; +} _pack OSPF_ROUTER_LINK_PIECE; + +typedef _struct OSPF_ROUTER_LINK_ADVERTISEMENT_HEADER +{ + OSPF_LS_HEADER ls_header; + UNION_OSPF_ROUTER_LINK_BIT_OPTIONS bit_options; + USHORT number_of_links; + OSPF_ROUTER_LINK_PIECE link; +} OSPF_ROUTER_LINK_ADVERTISEMENT_HEADER; + +typedef _struct OSPF_ROUTER_LSA_LINK +{ + _struct OSPF_ROUTER_LSA_LINK *sptr_forward_link; + _struct OSPF_ROUTER_LSA_LINK *sptr_backward_link; + OSPF_LS_HEADER ls_header; + UNION_OSPF_ROUTER_LINK_BIT_OPTIONS bit_options; + USHORT number_of_links; + OSPF_ROUTER_LINK_PIECE link; +} _pack OSPF_ROUTER_LSA_LINK; + +typedef _struct OSPF_NETWORK_LINK_PIECE +{ + ULONG link_id; +} _pack OSPF_NETWORK_LINK_PIECE; + +typedef _struct OSPF_NETWORK_LINK_ADVERTISEMENT_HEADER +{ + OSPF_LS_HEADER ls_header; + ULONG network_mask; + OSPF_NETWORK_LINK_PIECE attached_router; +} _pack OSPF_NETWORK_LINK_ADVERTISEMENT_HEADER; + +typedef _struct OSPF_NETWORK_LSA_LINK +{ + _struct OSPF_NETWORK_LSA_LINK *sptr_forward_link; + _struct OSPF_NETWORK_LSA_LINK *sptr_backward_link; + OSPF_LS_HEADER ls_header; + ULONG network_mask; + OSPF_NETWORK_LINK_PIECE attached_router; +} _pack OSPF_NETWORK_LSA_LINK; + + +typedef _struct OSPF_SUMMARY_LINK_ADVERTISEMENT_HEADER +{ + OSPF_LS_HEADER ls_header; + ULONG network_mask; + ULONG tos0_metric; +} _pack OSPF_SUMMARY_LINK_ADVERTISEMENT_HEADER; + +typedef _struct OSPF_SUMMARY_LSA_LINK +{ + _struct OSPF_SUMMARY_LSA_LINK *sptr_forward_link; + _struct OSPF_SUMMARY_LSA_LINK *sptr_backward_link; + OSPF_LS_HEADER ls_header; + ULONG network_mask; + ULONG tos0_metric; +} _pack OSPF_SUMMARY_LSA_LINK; + + +typedef _struct OSPF_EXTERNAL_LINK_METRIC_PIECE +{ + USHORT tos; + USHORT metric; + ULONG forwarding_address; + ULONG external_route_tag; +} _pack OSPF_EXTERNAL_LINK_METRIC_PIECE; + + +typedef _struct OSPF_EXTERNAL_LINK_ADVERTISEMENT_HEADER +{ + OSPF_LS_HEADER ls_header; + ULONG network_mask; + ULONG tos0_metric; + ULONG tos0_forwarding_address; + ULONG tos0_external_route_tag; +} _pack OSPF_EXTERNAL_LINK_ADVERTISEMENT_HEADER; + +typedef _struct OSPF_EXTERNAL_LSA_LINK +{ + _struct OSPF_EXTERNAL_LSA_LINK *sptr_forward_link; + _struct OSPF_EXTERNAL_LSA_LINK *sptr_backward_link; + OSPF_LS_HEADER ls_header; + ULONG network_mask; + ULONG tos0_metric; + ULONG tos0_forwarding_address; + ULONG tos0_external_route_tag; +} _pack OSPF_EXTERNAL_LSA_LINK; + + +typedef _struct OSPF_TYPE_7_LINK_ADVERTISEMENT_HEADER +{ + OSPF_LS_HEADER ls_header; + ULONG network_mask; + ULONG tos0_metric; + ULONG tos0_forwarding_address; + ULONG tos0_external_route_tag; +} _pack OSPF_TYPE_7_LINK_ADVERTISEMENT_HEADER; + +typedef _struct OSPF_TYPE_7_LSA_LINK +{ + _struct OSPF_TYPE_7_LSA_LINK *sptr_forward_link; + _struct OSPF_TYPE_7_LSA_LINK *sptr_backward_link; + OSPF_LS_HEADER ls_header; + ULONG network_mask; + ULONG tos0_metric; + ULONG tos0_forwarding_address; + ULONG tos0_external_route_tag; +} _pack OSPF_TYPE_7_LSA_LINK; + + +/*opaque lsa type 9, 10, 11 lsa jkw*/ +typedef _struct OSPF_OPAQUE_LSA +{ + OSPF_LS_OPAQUE_HEADER ls_header; + void *data; +} _pack OSPF_OPAQUE_LSA; + +typedef _struct OSPF_TYPE_9_LINK_ADVERTISEMENT_HEADER +{ + OSPF_LS_OPAQUE_HEADER ls_header; + void *data; + struct OSPF_INTERFACE *opaque_interface; +} _pack OSPF_TYPE_9_LINK_ADVERTISEMENT_HEADER; + +typedef _struct OSPF_TYPE_9_LSA_LINK +{ + _struct OSPF_TYPE_9_LSA_LINK *sptr_forward_link; + _struct OSPF_TYPE_9_LSA_LINK *sptr_backward_link; + OSPF_LS_OPAQUE_HEADER ls_header; + void *data; + struct OSPF_INTERFACE *opaque_interface; +} _pack OSPF_TYPE_9_LSA_LINK; + +typedef _struct OSPF_TYPE_10_LINK_ADVERTISEMENT_HEADER +{ + OSPF_LS_OPAQUE_HEADER ls_header; + void *data; + struct OSPF_AREA_ENTRY *opaque_area; +} _pack OSPF_TYPE_10_LINK_ADVERTISEMENT_HEADER; + +typedef _struct OSPF_TYPE_10_LSA_LINK +{ + _struct OSPF_TYPE_10_LSA_LINK *sptr_forward_link; + _struct OSPF_TYPE_10_LSA_LINK *sptr_backward_link; + OSPF_LS_OPAQUE_HEADER ls_header; + void *data; + struct OSPF_AREA_ENTRY *opaque_area; +} _pack OSPF_TYPE_10_LSA_LINK; + +typedef _struct OSPF_TYPE_11_LINK_ADVERTISEMENT_HEADER +{ + OSPF_LS_OPAQUE_HEADER ls_header; + void *data; +} _pack OSPF_TYPE_11_LINK_ADVERTISEMENT_HEADER; + +typedef _struct OSPF_TYPE_11_LSA_LINK +{ + OSPF_LS_OPAQUE_HEADER ls_header; + void *data; + _struct OSPF_TYPE_11_LSA_LINK *sptr_forward_link; + _struct OSPF_TYPE_11_LSA_LINK *sptr_backward_link; +} _pack OSPF_TYPE_11_LSA_LINK; + + +typedef _union UNION_OSPF_ADVERTISEMENT_HEADER +{ + OSPF_ROUTER_LINK_ADVERTISEMENT_HEADER router; + OSPF_NETWORK_LINK_ADVERTISEMENT_HEADER network; + OSPF_SUMMARY_LINK_ADVERTISEMENT_HEADER summary; + OSPF_EXTERNAL_LINK_ADVERTISEMENT_HEADER external; + OSPF_TYPE_7_LINK_ADVERTISEMENT_HEADER type_7; + /*opaque lsa add new opaque lsa types to union jkw*/ + OSPF_TYPE_9_LINK_ADVERTISEMENT_HEADER type_9; + OSPF_TYPE_10_LINK_ADVERTISEMENT_HEADER type_10; + OSPF_TYPE_11_LINK_ADVERTISEMENT_HEADER type_11; +} _pack UNION_OSPF_ADVERTISEMENT_HEADER; + +typedef _struct OSPF_LS_UPDATE_HEADER +{ + ULONG number_of_advertisements; + UNION_OSPF_ADVERTISEMENT_HEADER advertisement_header; +} _pack OSPF_LS_UPDATE_HEADER; + +typedef _struct OSPF_LS_ACKNOWLEDGEMENT_HEADER +{ + OSPF_LS_HEADER ls_advertisement_header; +} _pack OSPF_LS_ACKNOWLEDGEMENT_HEADER; + +typedef _union UNION_OSPF_PACKET_TYPES +{ + OSPF_HELLO_HEADER hello; + OSPF_DATABASE_HEADER database; + OSPF_LS_REQUEST_HEADER ls_request; + OSPF_LS_UPDATE_HEADER ls_update; + OSPF_LS_ACKNOWLEDGEMENT_HEADER ls_acknowledgement; +} _pack UNION_OSPF_PACKET_TYPES; + +typedef _struct OSPF_HEADER /* the standard 24 byte header for OSPF (page 178) */ +{ + BYTE version; /* set to 2 for this implementation */ + BYTE_ENUM(OSPF_UNION_PACKET_TYPES) type; + + /* length of entire OSPF protocol packet in bytes, including the standard OSPF + * header + */ + USHORT length; + + /* identity of the router originating the packet */ + ULONG router_id; + + /* a 32 bit number identifying the area this packet belongs to */ + ULONG area_id; + + /* checksum of the entire contents of the packet starting with the OSPF packet header + * but excluding the 64 bit authentication field + */ + USHORT checksum; + USHORT authentication_type; + UNION_OSPF_AUTHENTICATION_FIELD authentication_field; /* a 64 bit field for use by the authentication scheme */ + UNION_OSPF_PACKET_TYPES rest_of_packet; +} _pack OSPF_HEADER; + + +typedef _struct OSPF_PACKET +{ + struct ip ip_header; + OSPF_HEADER header; +} _pack OSPF_PACKET; + +typedef struct OSPF_LS_DATABASE_SUMMARY +{ + struct OSPF_LS_DATABASE_SUMMARY *sptr_forward_link; + struct OSPF_LS_DATABASE_SUMMARY *sptr_backward_link; + OSPF_HEADER *sptr_ospf_header; + USHORT size_of_packet; /* length of this packet including ospf header size */ + USHORT number_of_database_entries; +} OSPF_LS_DATABASE_SUMMARY; + + +typedef struct OSPF_LS_REQUEST +{ + struct OSPF_LS_REQUEST *sptr_forward_link; + struct OSPF_LS_REQUEST *sptr_backward_link; + + ULONG id; + ULONG advertising_router; + seq_t sequence_number; + USHORT checksum; + USHORT age; +} OSPF_LS_REQUEST; + +typedef union UNION_OSPF_LINK_STATE_ADVERTISEMENT +{ + struct OSPF_ROUTER_LINK_ADVERTISEMENT_HEADER *sptr_router; + struct OSPF_NETWORK_LINK_ADVERTISEMENT_HEADER *sptr_network; + struct OSPF_SUMMARY_LINK_ADVERTISEMENT_HEADER *sptr_summary; + struct OSPF_EXTERNAL_LINK_ADVERTISEMENT_HEADER *sptr_external; + struct OSPF_TYPE_7_LINK_ADVERTISEMENT_HEADER *sptr_type_7; + /*opaque lsa structure for opaque lsas jkw*/ + struct OSPF_TYPE_9_LINK_ADVERTISEMENT_HEADER *sptr_type_9; + struct OSPF_TYPE_10_LINK_ADVERTISEMENT_HEADER *sptr_type_10; + struct OSPF_TYPE_11_LINK_ADVERTISEMENT_HEADER *sptr_type_11; + +} UNION_OSPF_LINK_STATE_ADVERTISEMENT; + +/****************************/ +/* Routing Table Structures */ +/****************************/ + +typedef struct OSPF_NEXT_HOP_BLOCK +{ + struct OSPF_NEXT_HOP_BLOCK *sptr_forward_link; + struct OSPF_NEXT_HOP_BLOCK *sptr_backward_link; + ULONG outgoing_router_interface; + ULONG next_hop_router; + enum OSPF_ROUTE_STATUS route_status; + +} OSPF_NEXT_HOP_BLOCK; + +typedef struct OSPF_ROUTING_TABLE_ENTRY +{ + enum OSPF_ROUTE_DESTINATION_TYPE destination_type; + ULONG destination_id; + ULONG address_mask; + BYTE_ENUM (BOOLEAN) type_5_route_originated; + UNION_OSPF_OPTIONS optional_capabilities; + UNION_SERVICE_TYPE_BIT_STRUCTURE type_of_service; + struct OSPF_AREA_ENTRY *sptr_area; + enum OSPF_ROUTE_PATH_TYPE path_type; + ULONG path_cost; + ULONG type2_cost; + ULONG link_state_id; + ULONG cached_ip_address; + BYTE_ENUM (OSPF_LS_TYPE) link_type; + UNION_OSPF_LINK_STATE_ADVERTISEMENT *sptr_link_state_origin; + OSPF_NEXT_HOP_BLOCK *sptr_next_hop; + ULONG advertising_router; + ULONG abr; + enum OSPF_ROUTING_TABLE_UPDATE_ACTION action_history; + +} OSPF_ROUTING_TABLE_ENTRY; + +typedef struct OSPF_ROUTING_TABLE_NODE +{ + struct OSPF_ROUTING_TABLE_NODE *sptr_forward_link; + struct OSPF_ROUTING_TABLE_NODE *sptr_backward_link; + BYTE_ENUM (BOOLEAN) active_areas_discarded_entry; /* discard_entry */ + enum OSPF_ROUTE_STATUS route_node_status; + OSPF_ROUTING_TABLE_ENTRY *sptr_routing_table_entry; +} OSPF_ROUTING_TABLE_NODE; + +typedef union UNION_OSPF_VIRTUAL_ROUTE +{ + OSPF_ROUTING_TABLE_ENTRY *sptr_ospf_route; +} UNION_OSPF_VIRTUAL_ROUTE; + +typedef struct OSPF_LSA_TIMESTAMP_PER_INTERFACE_LIST +{ + struct OSPF_LSA_TIMESTAMP_PER_INTERFACE_LIST *sptr_forward_link; + struct OSPF_LSA_TIMESTAMP_PER_INTERFACE_LIST *sptr_backward_link; + ULONG if_index; + ULONG neighbor_id; + ULONG timestamp; +} OSPF_LSA_TIMESTAMP_PER_INTERFACE_LIST; + +typedef struct OSPF_LS_DATABASE_ENTRY +{ + struct OSPF_LS_DATABASE_ENTRY *sptr_forward_link; + struct OSPF_LS_DATABASE_ENTRY *sptr_backward_link; + UNION_OSPF_LINK_STATE_ADVERTISEMENT advertisement; + UNION_OSPF_VIRTUAL_ROUTE *vptr_route; /* may point to a routing table entry or an + * area boarder router */ + OSPF_ROUTING_TABLE_ENTRY *sptr_database_autonomous_system_border_router; /* if it is ASB Router */ + struct OSPF_LS_DATABASE_ENTRY *sptr_database_border_router; /* sum or ase - ls_database of border rtr */ + struct OSPF_AREA_ENTRY *sptr_ls_database_area; /* for keeping count of db's in each area */ + USHORT ls_database_hash; /* this db's hash */ + enum OSPF_LS_TYPE ls_database_type; + OSPF_NEXT_HOP_BLOCK *sptr_next_hop; + ULONG ls_database_time_stamp; /* for keeping age - stamped when arrived */ + ULONG ls_database_last_originated_time_stamp; /* for sending database copy back */ + + ULONG lock_time_MinLSInterval; /* amount of delay or loc-time required before the advertisement can be flood out of eligible interfaces */ + + struct OSPF_NEIGHBOR_LIST *sptr_ls_database_retrans; /* neighbors pointing to this ls_database */ + enum OSPF_SEQUENCE_STATE ls_database_sequence_state; + BYTE_ENUM (BOOLEAN) ls_database_freeme; + ULONG route_protocol; /* Used for external route */ + ULONG ls_database_freeme_age; /* age of LS entry beyond MAXAGE */ + OSPF_LSA_TIMESTAMP_PER_INTERFACE_LIST *sptr_lsa_retransmit_timestamps_per_neighbor; +} OSPF_LS_DATABASE_ENTRY; + +typedef struct OSPF_LS_DATABASE_NODE +{ + struct OSPF_LS_DATABASE_NODE *sptr_forward_link; + struct OSPF_LS_DATABASE_NODE *sptr_backward_link; + + OSPF_LS_DATABASE_ENTRY *sptr_ls_database_entry; + ULONG periodic_retransmit_time_counter; + BYTE_ENUM (BOOLEAN) flood; /* true if flooding this one */ +} OSPF_LS_DATABASE_NODE; + +typedef struct OSPF_DATABASE_INFORMATION_STRUCTURE /* used in ospf_flood.c */ +{ + BYTE_ENUM (BOOLEAN) found_link_state_advertisement_in_database; + OSPF_LS_DATABASE_ENTRY *sptr_database_entry; + struct OSPF_INTERFACE *sptr_interface; + struct OSPF_NEIGHBOR *sptr_neighbor; + UNION_OSPF_LINK_STATE_ADVERTISEMENT new_advertisement; + ULONG time_difference; + ULONG source_address; + ULONG destination_address; +} OSPF_DATABASE_INFORMATION_STRUCTURE; + +typedef struct OSPF_NEIGHBOR +{ + struct OSPF_NEIGHBOR *sptr_forward_link; + struct OSPF_NEIGHBOR *sptr_backward_link; + struct OSPF_INTERFACE *sptr_interface; + enum OSPF_NEIGHBOR_STATE state; + ULONG events; /* Number of state changes */ + ULONG last_hello; /* Time last hello was received from this neighbor */ + ULONG periodic_inactivity_time_counter; + BYTE_ENUM (BOOLEAN) inactivity_timer_enabled; + enum OSPF_NEIGHBOR_MODE mode; /* Master or slave mode */ + UNION_OSPF_FLAGS flags; /* For passing initialize, more and master/slave bits */ + UNION_OSPF_OPTIONS options; + seq_t database_description_sequence_number; + ULONG cryptographic_sequence_number; /* Used when Cryptographic Authentication is employed */ + ULONG last_exchange; /* Time last exchange was received from this neighbor - hold timer */ + ULONG periodic_slave_hold_time_counter; + ULONG id; + USHORT priority; /* 0 means not eligible to become the Designated Router */ + ULONG address; + + ULONG designated_router; + ULONG backup_designated_router; + OSPF_LS_DATABASE_NODE *sptr_retransmit; /* Link state advertisements waiting for acknowledgements */ + OSPF_LS_DATABASE_SUMMARY *sptr_database_summary; /* Database summary packets that make up area database */ + + OSPF_LS_REQUEST *sptr_ls_request[OSPF_LS_MAX]; /*SPR 81628: Should not use a hardcoded number */ + + USHORT retransmit_queue_count; + USHORT database_summary_queue_count; + USHORT ls_request_queue_count; + + BYTE_ENUM (BOOLEAN) ls_request_list_has_changed; + + ULONG mib_address_less_index; + BYTE_ENUM (BOOLEAN) mib_nbma_status; + BYTE_ENUM (BOOLEAN) mib_nbma_permanence; + BYTE_ENUM (BOOLEAN) mib_hello_suppressed; + ULONG mib_area_id; + enum BOOLEAN opaque_capability; +} OSPF_NEIGHBOR; + +typedef struct OSPF_DESIGNATED_ROUTER_NODE +{ + ULONG id; + ULONG address; + enum OSPF_NEIGHBOR_STATE state; + USHORT priority; /* 0 means not eligible to become the Designated Router */ +} OSPF_DESIGNATED_ROUTER_NODE; + +typedef _struct OSPF_AUTHENTICATION +{ + USHORT type; /* Type of authentication */ + BYTE key_or_plain_text_passwd[OSPF_AUTHENTICATION_SIZE]; /* Authentication */ + +} _pack OSPF_AUTHENTICATION; + +typedef struct OSPF_AUTHENTICATION_KEY +{ + struct OSPF_AUTHENTICATION_KEY *sptr_forward_link; + struct OSPF_AUTHENTICATION_KEY *sptr_backward_link; + + BYTE key_ID; + BYTE md5_16byte_password[OSPF_AUTHENTICATION_MD5_SIZE]; + + ULONG key_start_accept; /* time router will start accepting packets created with given key */ + ULONG key_start_generate; /* time router will start using key for packet generation */ + ULONG key_stop_generate; /* time router will stop using key for packet generation */ + ULONG key_stop_accept; /* time router will stop accepting packets created with given key */ +} OSPF_AUTHENTICATION_KEY; + +#if (_BYTE_ORDER == _LITTLE_ENDIAN ) +typedef _struct OSPF_INTERFACE_FLAGS +{ + BIT_FIELD (enum, BOOLEAN) network_scheduled:1; /* When designated router: semaphore for generating link state advertisements */ + BIT_FIELD (enum, BOOLEAN) enable:1; /* Interface is enabled */ + BIT_FIELD (enum, BOOLEAN) build_network:1; /* Flag to build_net_lsa */ + BIT_FIELD (enum, BOOLEAN) neighbor_change:1; /* Schedule neighbor change */ + BIT_FIELD (enum, BOOLEAN) multicast:1; /* Interface is multicast capable */ + BIT_FIELD (enum, BOOLEAN) cost_set:1; /* Cost was manually configured */ + BIT_FIELD (enum, BOOLEAN) secondary_authentication:1; /* Secondary authentication key */ + BIT_FIELD (enum,BOOLEAN) not_used:1; +} _pack OSPF_INTERFACE_FLAGS; +#else /* _BYTE_ORDER == _BIG_ENDIAN */ +typedef _struct OSPF_INTERFACE_FLAGS +{ + BIT_FIELD (enum,BOOLEAN) not_used:1; + BIT_FIELD (enum, BOOLEAN) secondary_authentication:1; /* Secondary authentication key */ + BIT_FIELD (enum, BOOLEAN) cost_set:1; /* Cost was manually configured */ + BIT_FIELD (enum, BOOLEAN) multicast:1; /* Interface is multicast capable */ + BIT_FIELD (enum, BOOLEAN) neighbor_change:1; /* Schedule neighbor change */ + BIT_FIELD (enum, BOOLEAN) build_network:1; /* Flag to build_net_lsa */ + BIT_FIELD (enum, BOOLEAN) enable:1; /* Interface is enabled */ + BIT_FIELD (enum, BOOLEAN) network_scheduled:1; /* When designated router: semaphore for generating link state advertisements */ +} _pack OSPF_INTERFACE_FLAGS; +#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ + +typedef _union UNION_OSPF_INTERFACE_FLAGS +{ + OSPF_INTERFACE_FLAGS _bit; + BYTE _byte; +} _pack UNION_OSPF_INTERFACE_FLAGS; + +typedef struct OSPF_LS_HEADER_QUEUE +{ + struct OSPF_LS_HEADER_QUEUE *sptr_forward_link; + struct OSPF_LS_HEADER_QUEUE *sptr_backward_link; + OSPF_LS_HEADER ls_header; +} OSPF_LS_HEADER_QUEUE; + +typedef struct OSPF_INTERFACE +{ + struct OSPF_INTERFACE *sptr_forward_link; + struct OSPF_INTERFACE *sptr_backward_link; + + struct ifnet *vx_ospf_interface; + + USHORT ifnet_index; /* if_index from struct ifnet */ + USHORT ifnet_flags; + ULONG interface_index; + ULONG area_id; + BYTE_ENUM (BOOLEAN) port_enabled; + + enum OSPF_INTERFACE_TYPE type; + enum OSPF_INTERFACE_STATE state; + ULONG events; /* Number of state changes */ + ULONG address; + ULONG netmask; + ULONG mtu; + struct OSPF_AREA_ENTRY *sptr_area; /* The area this interface is in */ + struct OSPF_AREA_ENTRY *sptr_transit_area; + ULONG source_area_id_for_virtual_link; + + ULONG router_dead_interval; /* Number of seconds before the router's sptr_neighbors will declare it down */ + ULONG transmit_delay; /* Estimated number of seconds it takes to transmit a link state update packet over this interface */ + USHORT priority; /* If set to 0, this router is not eligible to become designated router on the attached network */ + + OSPF_NEIGHBOR *sptr_neighbor; + OSPF_NEIGHBOR potential_neighbor; + ULONG virtual_neighbor_rid; + + USHORT number_of_neighbors_in_init_state; + USHORT number_of_neighbors_in_exchange_state; + USHORT number_of_neighbors_in_full_state; + + OSPF_DESIGNATED_ROUTER_NODE designated_router; + OSPF_DESIGNATED_ROUTER_NODE backup_designated_router; + USHORT cost; /* One for each type of service */ + + ULONG hello_interval; /* Length of time, in seconds, between Hello packets sent on this interface */ + ULONG poll_interval; /* the default poll interval is 4 * the hello interval */ + ULONG periodic_hello_time_counter; + ULONG periodic_poll_time_counter; + BYTE_ENUM (BOOLEAN) hello_timer_enabled; + /* SPR 85432 -- Begin */ + ULONG last_hello_time; + /* SPR 85432 -- End */ + + ULONG retransmit_interval; + ULONG periodic_retransmit_time_counter; + BYTE_ENUM (BOOLEAN) retransmit_timer_enabled; + ULONG periodic_wait_time_counter; /* single shot timer */ + BYTE_ENUM (BOOLEAN) wait_timer_enabled; + + ULONG periodic_delayed_acknowledgement_time_counter; /* single shot timer - sort of */ + BYTE_ENUM (BOOLEAN) delayed_acknowledgement_timer_enabled; + + OSPF_AUTHENTICATION authentication; + OSPF_AUTHENTICATION authentication2; /* Alternate authentication */ + OSPF_AUTHENTICATION_KEY *sptr_authentication_key; + + UNION_OSPF_INTERFACE_FLAGS flags; + OSPF_LS_HEADER_QUEUE *sptr_head_of_delayed_acknowledgement_list; + ULONG number_of_acknowledgements_on_delayed_acknowledgement_list; + + ULONG lock_time; + ULONG up_time; /* Time interface came up */ + + BYTE_ENUM (BOOLEAN) point_timer_enabled; + + BYTE_ENUM (BOOLEAN) passive; + ULONG unnumbered_dest_ip; /* unnumbered link dest ip */ + ULONG unnumbered_router_id; /* unnumbered link router id */ + + BYTE_ENUM (BOOLEAN) unnumbered_nbma; + +} OSPF_INTERFACE; + +typedef struct OSPF_INTERFACE_NODE +{ + struct OSPF_INTERFACE_NODE *sptr_forward_link; + struct OSPF_INTERFACE_NODE *sptr_backward_link; + OSPF_INTERFACE *sptr_interface; +} OSPF_INTERFACE_NODE ; + +typedef struct OSPF_HOSTS +{ + struct OSPF_HOSTS *sptr_forward_link; + struct OSPF_HOSTS *sptr_backward_link; + ULONG interface_address; + ULONG type_of_service; + USHORT cost; + BYTE_ENUM (BOOLEAN) status; + ULONG area_id; +} OSPF_HOSTS; + +typedef struct OSPF_SHORTEST_PATH_NODE +{ + struct OSPF_SHORTEST_PATH_NODE *sptr_forward_link; + struct OSPF_SHORTEST_PATH_NODE *sptr_backward_link; + ULONG vertex; + BYTE_ENUM (OSPF_LS_TYPE) vertex_type; + OSPF_LS_DATABASE_ENTRY *sptr_database_entry; + ULONG cost; + ULONG intervening_router; + OSPF_NEXT_HOP_BLOCK *sptr_next_hop; +} OSPF_SHORTEST_PATH_NODE; + +#if (_BYTE_ORDER == _LITTLE_ENDIAN ) +typedef _struct + +{ + BIT_FIELD (enum, BOOLEAN) transit:1; /* This is a transit area */ + BIT_FIELD (enum, BOOLEAN) virtual_up:1; /* One or more virtual links in this area are up */ + BIT_FIELD (enum, BOOLEAN) stub:1; /* This is a area (no external routes) */ + BIT_FIELD (enum, BOOLEAN) nssa:1; /* This is a not so stubby area */ + BIT_FIELD (enum, BOOLEAN) stub_default:1; /* Inject default into this stub area */ + BIT_FIELD (enum,BOOLEAN) not_used:3; +} _pack OSPF_AREA_FLAGS; +#else /* _BYTE_ORDER == _BIG_ENDIAN */ +typedef _struct OSPF_AREA_FLAGS +{ + BIT_FIELD (enum,BOOLEAN) not_used:3; + BIT_FIELD (enum, BOOLEAN) stub_default:1; /* Inject default into this stub area */ + BIT_FIELD (enum, BOOLEAN) nssa:1; /* This is a not so stubby area */ + BIT_FIELD (enum, BOOLEAN) stub:1; /* This is a area (no external routes) */ + BIT_FIELD (enum, BOOLEAN) virtual_up:1; /* One or more virtual links in this area are up */ + BIT_FIELD (enum, BOOLEAN) transit:1; /* This is a transit area */ +} _pack OSPF_AREA_FLAGS; +#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ + +typedef _union UNION_OSPF_AREA_FLAGS +{ + OSPF_AREA_FLAGS _bit; + BYTE _byte; +} _pack UNION_OSPF_AREA_FLAGS; + +typedef struct OSPF_LS_DATABASE_HEAD + { + AVL_NODE * sptr_avl_database_entry; + OSPF_LS_DATABASE_ENTRY * sptr_linear_database_entry; + BYTE_ENUM (BOOLEAN) rerun; /* rerun this row - partial update */ + } OSPF_LS_DATABASE_HEAD; + +typedef struct OSPF_ADDRESS_RANGE_LIST_ENTRY /* list of networks associated with an area (section 6 of OSPF Version 2 specification, dated June 1995) */ +{ + struct OSPF_ADDRESS_RANGE_LIST_ENTRY *sptr_forward_link; + struct OSPF_ADDRESS_RANGE_LIST_ENTRY *sptr_backward_link; + ULONG area_id; + + ULONG network; + ULONG mask; + BYTE_ENUM (BOOLEAN) advertise; + BYTE_ENUM (BOOLEAN) active; + ULONG cost; + struct OSPF_ROUTING_TABLE_NODE *sptr_discard_entries; +} OSPF_ADDRESS_RANGE_LIST_ENTRY; + + +typedef struct OSPF_AREA_ENTRY +{ + struct OSPF_AREA_ENTRY *sptr_forward_link; + struct OSPF_AREA_ENTRY *sptr_backward_link; + ULONG area_id; + + /* area address ranges */ + ULONG number_of_address_ranges; /* for this area */ + OSPF_ADDRESS_RANGE_LIST_ENTRY *sptr_address_ranges; + + /* associated router interfaces */ + OSPF_INTERFACE *sptr_interfaces; /* this is setup at configuration time */ + + /* summary links advertisements */ + struct OSPF_ADVERTISEMENT_NODE *sptr_summary_advertisement_list_head; + + UNION_OSPF_AREA_FLAGS flags; /* Various state bits */ + ULONG stub_default_cost; + + /* shortest-path tree */ + OSPF_SHORTEST_PATH_NODE shortest_path_first_tree; /* area's shortest path first tree; head is this router */ + ULONG shortest_path_first_run_count; /* # times spf has been run for this area */ + BYTE_ENUM (BOOLEAN) run_shortest_path_calculation; + ULONG shortest_path_calculation_time_counter; + OSPF_SHORTEST_PATH_NODE *sptr_candidate; /* area's candidate list for dijkstra */ + + OSPF_LS_DATABASE_HEAD ls_database_hash_table[TYPE_7_LSA + 1][OSPF_HASH_TABLE_SIZE]; + /* opaque lsa new lsdb for opaque lsa jkw*/ + OSPF_LS_DATABASE_HEAD opaque_ls_database_hash_table[MAX_OPAQUE_NUM + 1][OSPF_HASH_TABLE_SIZE]; + USHORT number_of_autonomous_system_boundary_routers; + OSPF_ROUTING_TABLE_ENTRY autonomous_system_boundary_routers; + + USHORT number_of_area_border_routers; + OSPF_ROUTING_TABLE_ENTRY area_border_routers; + + USHORT number_of_neighbors_in_init_state; + USHORT number_of_neighbors_in_exchange_state; + USHORT number_of_neighbors_in_full_state; + + USHORT number_of_interfaces_in_up_state; + + ULONG lock_time; + BYTE build_router; + BYTE_ENUM (BOOLEAN) bring_up_virtual_links; + ULONG periodic_MinLSInterval_time_counter; + BYTE_ENUM (BOOLEAN) MinLSInterval_timer_enabled; + /* SPR#91272*/ + BYTE_ENUM (BOOLEAN) area_summary; /* area summary for stub area */ + + USHORT mib_number_of_link_state_advertisements; + ULONG mib_checksum_sum; + + ULONG mib_stub_metric_type; /* 1 = ospf metric, 2 = comparable cost, 3 = non comparable */ + + USHORT mib_number_of_type10_lsa; + ULONG mib_type10_checksum_sum; + ULONG nssa_abr_to_convert_type_7_to_type_5; + + +} OSPF_AREA_ENTRY; + +typedef struct OSPF_STUB_AREA_ENTRY +{ + struct OSPF_STUB_AREA_ENTRY *sptr_forward_link; + struct OSPF_STUB_AREA_ENTRY *sptr_backward_link; + struct OSPF_AREA_ENTRY *sptr_area; +} OSPF_STUB_AREA_ENTRY; + +typedef struct OSPF_NSSA_AREA_ENTRY +{ + struct OSPF_NSSA_AREA_ENTRY *sptr_forward_link; + struct OSPF_NSSA_AREA_ENTRY *sptr_backward_link; + struct OSPF_AREA_ENTRY *sptr_area; +} OSPF_NSSA_AREA_ENTRY; + + + +typedef struct OSPF_TRANSIT_AREA_ENTRY +{ + struct OSPF_TRANSIT_AREA_ENTRY *sptr_forward_link; + struct OSPF_TRANSIT_AREA_ENTRY *sptr_backward_link; + struct OSPF_AREA_ENTRY *sptr_area; +} OSPF_TRANSIT_AREA_ENTRY; + +/**********************************/ +/* Link State Database Structures */ +/**********************************/ + +typedef struct OSPF_ADVERTISEMENT_NODE +{ + struct OSPF_ADVERTISEMENT_NODE *sptr_forward_link; + struct OSPF_ADVERTISEMENT_NODE *sptr_backward_link; + UNION_OSPF_LINK_STATE_ADVERTISEMENT advertisement; +} OSPF_ADVERTISEMENT_NODE; + +typedef struct OSPF_NEIGHBOR_LIST +{ + struct OSPF_NEIGHBOR_LIST *sptr_forward_link; + struct OSPF_NEIGHBOR_LIST *sptr_backward_link; + struct OSPF_NEIGHBOR *sptr_neighbor; +} OSPF_NEIGHBOR_LIST; + +typedef struct OSPF_PORT_CONFIGURATION_CLASS +{ + BYTE_ENUM (BOOLEAN) port_enabled; + USHORT virtual_port_number; + ULONG ip_address; + ULONG subnetmask; + ULONG area_id; + ULONG transit_area_id; + ULONG source_area_id_for_virtual_link; /* The area to which VLink belongs */ + ULONG type; + + USHORT authentication_type; + + USHORT md5_authentication_key_ID; + BYTE simple_plain_text_or_md5_password[OSPF_AUTHENTICATION_SIZE]; + + ULONG router_dead_interval; + ULONG transmit_delay; + USHORT priority; + USHORT cost; + ULONG hello_interval; + + ULONG virtual_neighbor_rid; /* Router ID */ + OSPF_AUTHENTICATION_KEY *sptr_authentication_key; + BYTE_ENUM (BOOLEAN) passive; + ULONG unnumbered_dest_ip; /* unnumbered dest ip*/ + ULONG poll_interval; + ULONG retransmit_interval; + ULONG nbma_ptmp_neighbor_address; /* __NBMA_PTMP__ */ + +} OSPF_PORT_CONFIGURATION_CLASS; + +typedef struct OSPF_PORT_CLASS +{ + OSPF_PORT_CONFIGURATION_CLASS config; /* this portion is configured by NVRAM */ +} OSPF_PORT_CLASS; + +typedef struct OSPF_AREA_CONFIGURATION_CLASS +{ + ULONG area_id; + BYTE_ENUM (BOOLEAN) address_range_active; + BYTE_ENUM (BOOLEAN) advertise_address_range; + ULONG address_range_cost; + BYTE_ENUM (BOOLEAN) external_routing_capability_enabled; + BYTE_ENUM (BOOLEAN) nssa_enabled; + BYTE_ENUM (BOOLEAN) inject_default_route_if_stub_area; + BYTE_ENUM (BOOLEAN) area_summary; + ULONG stub_default_cost; + ULONG number_of_area_address_ranges; /* number of areas, 0 will always be the backbone */ + +} OSPF_AREA_CONFIGURATION_CLASS; + +typedef struct OSPF_AREA_CLASS +{ + OSPF_AREA_CONFIGURATION_CLASS config; /* this portion is configured by NVRAM */ +} OSPF_AREA_CLASS; + +/* RFC 2178 G.3 */ +typedef struct OSPF_AREA_ADDRESS_RANGE_CONFIGURATION_CLASS +{ + ULONG network; + ULONG mask; + BYTE_ENUM (BOOLEAN) advertise; + BYTE_ENUM (BOOLEAN) active; + ULONG cost; + ULONG area_id; +} OSPF_AREA_ADDRESS_RANGE_CONFIGURATION_CLASS; + +/* RFC 2178 G.3 */ +typedef struct OSPF_AREA_ADDRESS_RANGE_CLASS +{ + OSPF_AREA_ADDRESS_RANGE_CONFIGURATION_CLASS config; +} OSPF_AREA_ADDRESS_RANGE_CLASS; + +typedef struct OSPF_EXTERNAL_ROUTE + { + struct OSPF_EXTERNAL_ROUTE * sptr_forward_link; + struct OSPF_EXTERNAL_ROUTE * sptr_backward_link; + ULONG destination_network; + ULONG destination_mask; + ULONG metric; + ULONG forwarding_address; + ULONG tag; + ULONG time_stamp; + ULONG advertising_router; + ULONG route_protocol; + } OSPF_EXTERNAL_ROUTE; + +typedef struct OSPF_MIB_GENERAL_ENTRY +{ + ULONG ospfVersionNumber; + BYTE_ENUM (BOOLEAN) ospfAreaBdrRtrStatus; + ULONG ospfExternLsaCount; + ULONG ospfExternLsaCksumSum; + ULONG ospfOriginateNewLsas; + ULONG ospfRxNewLsas; +} OSPF_MIB_GENERAL_ENTRY; + +typedef struct WRN_OSPF_MIB_GENERAL_ENTRY +{ + BYTE_ENUM (BOOLEAN) wrnOspfRFC1583Compatibility; + BYTE_ENUM (BOOLEAN) wrnOspfOpaqueLsaSupport; + ULONG wrnOspfOriginateNewOpaqueLsas; + ULONG wrnOspfRxNewOpaqueLsas; + ULONG wrnOspfType9LsaCount; + ULONG wrnOspfType9LsaCksumSum; + ULONG wrnOspfType11LsaCount; + ULONG wrnOspfType11LsaCksumSum; +} WRN_OSPF_MIB_GENERAL_ENTRY; + + +#if (_BYTE_ORDER == _LITTLE_ENDIAN ) +typedef _struct OSPF_REDISTRIBUTION_BIT_OPTIONS +{ + BIT_FIELD (enum,BOOLEAN) metric:1; + BIT_FIELD (enum,BOOLEAN) route_tag:1; + BIT_FIELD (enum,BOOLEAN) not_used:6; +} _pack OSPF_REDISTRIBUTION_OPTIONS; +#else /* _BYTE_ORDER == _BIG_ENDIAN */ +typedef _struct OSPF_REDISTRIBUTION__BIT_OPTIONS +{ + BIT_FIELD (enum,BOOLEAN) not_used:6; + BIT_FIELD (enum,BOOLEAN) route_tag:1; + BIT_FIELD (enum,BOOLEAN) metric:1; +} _pack OSPF_REDISTRIBUTION_OPTIONS; +#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ +typedef _union UNION_OSPF_REDISTRIBUTION_BIT_OPTIONS +{ + OSPF_REDISTRIBUTION_OPTIONS _bit; + BYTE _byte; +} _pack UNION_OSPF_REDISTRIBUTION_BIT_OPTIONS; + +typedef struct OSPF_ADDRESS_MASK_PAIRS +{ + struct OSPF_ADDRESS_MASK_PAIRS *sptr_forward_link; + struct OSPF_ADDRESS_MASK_PAIRS *sptr_backward_link; + ULONG network_address; + ULONG network_mask; + ULONG metric_type; + ULONG metric_value; + ULONG route_tag; + UNION_OSPF_REDISTRIBUTION_BIT_OPTIONS bit_options; +} OSPF_ADDRESS_MASK_PAIRS; + +typedef struct OSPF_REDISTRIBUTION_CONFIGURATION +{ + enum BOOLEAN redistribute_all_bgp; + enum BOOLEAN redistribute_all_rip; + enum BOOLEAN redistribute_all_static; + enum BOOLEAN redistribute_all_local; + enum BOOLEAN redistribute_ip_default_route; + + enum BOOLEAN allow_bgp_default; + + OSPF_GENERIC_NODE ospf_imported_rip_subnets; + OSPF_GENERIC_NODE ospf_imported_static_subnets; + OSPF_GENERIC_NODE ospf_imported_local_subnets; + OSPF_GENERIC_NODE ospf_imported_bgp_subnets; + + USHORT number_of_do_not_allow_neighbors; + USHORT do_not_allow_neighbor_as[0xff]; + + USHORT number_of_do_not_allow_origins; + USHORT do_not_allow_origin_as[0xff]; + +} OSPF_REDISTRIBUTION_CONFIGURATION; + +typedef struct ROUTE_FLAGS + { + unsigned char local_interface_route:1; /* route is for local network interface */ + unsigned char route_down:1; /* local net/subnet route is down due to local port down */ + unsigned char private_route:1; + unsigned char overriding_allowed:1; /* this flag is applicable only to static routes + * i.e. to a remote end of a p-to-p link or a loopback */ + unsigned char route_to_myself:1; + unsigned char do_no_aging:1; /* do not apply aging timer */ + unsigned char route_changed:1; /* route changed and wait for RIP Update message to send */ + unsigned char no_subnet_mask:1; /* route is awaiting icmp address mask reply from destination */ + } ROUTE_FLAGS; + + +typedef struct OSPF_IP_ROUTE_ENTRY_LINK + { + struct OSPF_IP_ROUTE_ENTRY * sptr_forward_link; + struct OSPF_IP_ROUTE_ENTRY * sptr_backward_link; + } OSPF_IP_ROUTE_ENTRY_LINK; + +/* IP routing table entry */ + +typedef struct OSPF_IP_ROUTE_ENTRY + { + OSPF_IP_ROUTE_ENTRY_LINK links; +#if defined (__LEXICOGRAPHICAL_ORDERING__) + IP_ROUTE_ENTRY_LINK mib_links; +#endif /* (__LEXICOGRAPHICAL_ORDERING__) */ + ULONG target; /* net, subnet or full host ip address */ + ULONG mask; + ULONG gateway; /* 0: local attached subnet, or point-to-point link */ + ULONG forwarding_address; + USHORT port_number; + ULONG use_count; + BYTE number_of_subnet_mask_bits; + ULONG metric; /* primary metric */ + ULONG metric_2; /* alternative metric 2 */ + ULONG metric_3; /* alternative metric 3 */ + ULONG metric_4; /* alternative metric 4 */ + ULONG metric_5; /* alternative metric 5 */ + ROUTE_FLAGS flags; + BYTE weight; + USHORT aging_timer; /* aging timeout value in seconds */ + BYTE_ENUM (OSPF_RTM_IP_ROUTE_TYPE) ipRouteType; + BYTE_ENUM (OSPF_RTM_IP_ROUTE_PROTOCOL_TYPE) ipRouteProto; + ULONG ipRouteInfo[2]; + struct OSFP_IP_ROUTE_CACHE_ENTRY * sptr_cache_entry; + USHORT route_tag; + ULONG sender_ip_address; + void* p_ifnet; + } OSPF_IP_ROUTE_ENTRY; + + +typedef struct OSPF_ROUTE_QUEUE_ENTRY + { + struct OSPF_ROUTE_QUEUE_ENTRY *sptr_forward_link; + struct OSPF_ROUTE_QUEUE_ENTRY *sptr_backward_link; + enum OSPF_ROUTING_TABLE_UPDATE_ACTION action; + OSPF_IP_ROUTE_ENTRY ip_route_entry; + } OSPF_ROUTE_QUEUE_ENTRY; + +typedef struct OSPF_ROUTE_POLICY_PAIRS +{ + struct OSPF_ROUTE_POLICY_PAIRS *sptr_forward_link; + struct OSPF_ROUTE_POLICY_PAIRS *sptr_backward_link; + + ULONG network_address; + ULONG network_mask; + UCHAR route_weight; + UCHAR reserved[3]; /* for long word align */ +} OSPF_ROUTE_POLICY_PAIRS; + +typedef struct OSPF_OPAQUE_CALLBACK +{ + struct OSPF_OPAQUE_CALLBACK *sptr_forward_link; + struct OSPF_OPAQUE_CALLBACK *sptr_backward_link; + BYTE lsa_type; + BYTE opaque_type; + int (* new_interface_hook)(struct OSPF_INTERFACE *interface); + int (* delete_interface_hook)(struct OSPF_INTERFACE *interface); + void (* interface_state_machine_change_hook)(enum OSPF_INTERFACE_EVENT event,enum OSPF_INTERFACE_STATE state,struct OSPF_INTERFACE *interface); + void (* neighbor_state_machine_change_hook)(enum OSPF_NEIGHBOR_EVENT event,enum OSPF_NEIGHBOR_STATE state,struct OSPF_INTERFACE *sptr_interface, struct OSPF_NEIGHBOR *neighbor); + int (* opaque_lsa_originate_hook)(void *arg, BYTE lsa_type, BYTE opaque_type, USHORT age); + void (* opaque_lsa_refresh_hook)(void *arg, BYTE lsa_type, ULONG opaque_lsid, USHORT age); + void (* opaque_lsa_received_hook)(UNION_OSPF_LINK_STATE_ADVERTISEMENT *opaque_advertisement); +} OSPF_OPAQUE_CALLBACK; + + +typedef struct OSPF_PROTOCOL_RTM_HANDLE + { + char * pBuf; /* Socket Message Buffer */ + int taskId; /* Rtm Task Id */ + int sockfd; /* Routing Socket Descriptor */ + } OSPF_PROTOCOL_RTM_HANDLE; + + +typedef struct OSPF_TASK_DESCRIPTOR +{ + int task_id; + int task_priority; + int task_stack_size; + FUNCPTR task_start_func; + OSPF_TASK_STATES task_state; + char task_name[OSPF_TASK_NAME_SIZE]; + +} OSPF_TASK_DESCRIPTOR; + +typedef struct OSPF_NBMA_PTMP_NBR_ENTRY +{ + struct OSPF_NBMA_PTMP_NBR_ENTRY *sptr_forward_link; + struct OSPF_NBMA_PTMP_NBR_ENTRY *sptr_backward_link; + + OSPF_NEIGHBOR *sptr_nbma_ptmp_nbr; +}OSPF_NBMA_PTMP_NBR_ENTRY; + + +/*********************OSPF Meta STRUCTURE ***********************************/ +typedef struct OSPF_CLASS +{ + enum BOOLEAN protocol_enabled; + /* asr: added to ensure that if ospf_init is called twice, + we dont' go through initialization sequence again + */ + enum BOOLEAN protocol_initialized; + ULONG tid; /* ospf task ID */ + ULONG ospf_vsid; /* ID for virtual stack on which OSPF will run */ + ULONG router_id; /* uniquely identifies this router in the Autonomous System */ + enum BOOLEAN type_of_service_capability; /* TRUE means this router will calculate separate routes based on type of service */ + enum BOOLEAN autonomous_system_border_router; + enum BOOLEAN ip_multicast; + + /* NOTE: port[] shall only be used during startup for processing configuration + * read from ospf_cfg() + */ + OSPF_PORT_CLASS port[NUMBER_OF_OSPF_PORTS]; + + /* make sptr_interface linked list visible here. Was in OSPF_PORT_CLASS */ + OSPF_INTERFACE *sptr_interface_list; + + ULONG number_of_ports; + ULONG starting_port_number; + ULONG number_of_interfaces; + + /* areas */ + ULONG number_of_areas; /* number of areas */ + ULONG number_of_area_address_ranges; /* total number of area address ranges for all areas */ + ULONG number_of_stub_areas; + ULONG number_of_nssa_areas; + ULONG number_of_redistribution_entry; + /* NOTE: area[] shall only be used during startup for processing configuration + * read from ospf_cfg() + */ + OSPF_AREA_CLASS area[NUMBER_OF_OSPF_AREAS]; + struct OSPF_AREA_ENTRY *sptr_area_list; /* an array of areas connected to this router which will be + * allocated at initialization time, area 0 is the backbone */ + /* RFC 2178 G.3 */ + OSPF_AREA_ADDRESS_RANGE_CLASS area_address_range[NUMBER_OF_OSPF_AREA_ADDRESS_RANGES]; /* area address ranges for a particular area */ + + struct OSPF_AREA_ENTRY *sptr_backbone_area; + struct OSPF_STUB_AREA_ENTRY *sptr_stub_area_list; + + struct OSPF_NSSA_AREA_ENTRY *sptr_nssa_area_list; + + /* virtual links */ + ULONG number_of_virtual_links; + ULONG number_of_virtual_links_in_Up_state; + OSPF_INTERFACE_NODE *sptr_configured_virtual_links; + + + enum BOOLEAN nssa_enabled; + OSPF_OPAQUE_CALLBACK *sptr_type_9_callback_list_head; + OSPF_OPAQUE_CALLBACK *sptr_type_10_callback_list_head; + OSPF_OPAQUE_CALLBACK *sptr_type_11_callback_list_head; + + OSPF_EXTERNAL_ROUTE *sptr_configured_external_routes; + OSPF_EXTERNAL_ROUTE *sptr_originated_external_routes; + OSPF_EXTERNAL_ROUTE *sptr_external_route_queue; + + ULONG external_lsa_queue_process_interval; + ULONG external_route_queue_counter; + ULONG ospf_rtm_sequence; + + /* neighbors */ + ULONG number_of_neighbors; /* number of neighbors known to this router */ + ULONG number_of_neighbors_in_init_state; + ULONG number_of_neighbors_in_exchange_state; + ULONG number_of_neighbors_in_full_state; + + OSPF_ROUTING_TABLE_NODE * sptr_routing_table_head[OSPF_ROUTE_TABLE_MAX][OSPF_RT_HASH_TABLE_SIZE]; + + enum BOOLEAN build_routing_table; + ULONG routing_table_build_time_counter; + + enum BOOLEAN initialization_breakpoint; + enum BOOLEAN configuration_breakpoint; + enum BOOLEAN runtime_breakpoint; + + enum BOOLEAN timer_enabled; + ULONG _1_second_counter; + ULONG clock_ticks_per_second; + + OSPF_MIB_GENERAL_ENTRY ospfGeneralGroupEntry; + + WRN_OSPF_MIB_GENERAL_ENTRY wrnOspfGeneralGroupEntry; + OSPF_HOSTS *sptr_host_list; + + enum BOOLEAN printing_enabled; + enum BOOLEAN interface_printing_enabled; + enum BOOLEAN neighbor_printing_enabled; + enum BOOLEAN memory_printing_enabled; + enum BOOLEAN alarm_printing_enabled; + enum BOOLEAN snmp_printing_enabled; + enum BOOLEAN packet_printing_enabled; + enum BOOLEAN routing_table_printing_enabled; + enum BOOLEAN debug_printing_enabled; + enum BOOLEAN rtm_printing_enabled; /* ### RTM */ + enum BOOLEAN db_overflow_printing_enabled; + enum BOOLEAN search_printing_enabled; + enum BOOLEAN prologue_printing_enabled; + + + ULONG routing_table_revision_number; + OSPF_RTM_HANDLE ospf_rtm_handle; /* rtm addition */ + + OSPF_ROUTE_QUEUE_ENTRY *sptr_ospf_export_route_queue; + ULONG ospf_export_route_queue_process_interval; + ULONG ospf_queue_interval_counter; + ULONG ospf_routes_dequeued_per_run; + + ULONG ospf_maxaged_lsas_removed_per_tick; + ULONG ospf_maxaged_lsas_removed_this_tick; + + OSPF_REDISTRIBUTION_CONFIGURATION ospf_redistribution_configuration; + + OSPF_ROUTE_POLICY_PAIRS *route_policy_list; + /* opaque lsa neighbor opaque enabled jkw + RFC 2370 Section 4.0 item 1*/ + enum BOOLEAN opaque_capability; /* TRUE means this router will be opaque-capable for opaque lsas */ + int ospf_multicast_extensions; + enum BOOLEAN ospf_demand_extensions; + /* RFC 2178 G.7 */ + enum BOOLEAN ospf_rfc1583_compatibility; + /* RFC 2178 G.6 */ + ULONG ospf_point_to_point_router_lsa_option; + /* RFC 1765 */ + ULONG ospf_external_lsdb_limit; + ULONG ospf_exit_overflow_interval; + ULONG ospf_external_lsa_count; + enum BOOLEAN in_overflow_state; + enum BOOLEAN force_out_of_overflow_state; + enum BOOLEAN reset_ospf_exit_overflow_interval; + + /* SPR 85432 -- Begin */ + ULONG hello_1_second_counter; + + /* OSPF display */ + OSPF_LS_DATABASE_ENTRY *sptr_external_lsdb_print_queue; + OSPF_ROUTING_TABLE_NODE *sptr_table_route_print_queue; + /* SPR 85432 -- End */ + + const char *ftp_configuration_file; + const char *ftp_server_address; + const char *ftp_dir; + const char *ftp_user; + const char *ftp_pwd; + OSPF_LS_DATABASE_HEAD external_database_hash_table[2][OSPF_HASH_TABLE_SIZE]; + OSPF_LS_DATABASE_HEAD type_11_database_hash_table[2][OSPF_HASH_TABLE_SIZE]; + + /* ANVL 27.15 start */ + OSPF_ROUTING_TABLE_NODE *sptr_old_routing_table[OSPF_ROUTE_TABLE_MAX][OSPF_RT_HASH_TABLE_SIZE]; + /* pointer to old routing table, + valid during SPF computation, NULL otherwise, + Inter-area SPF computation can be invoked: + from receive task at reception of type 3 or type 4 LSA + from timer task (or SPF task) during regular SPF computation. + This "sptr_old_routing_table" is used during inter-area SPF + to prevent flooding of type 3 and 4 LSAs from receive task + and enable flooding of type 3 LSAs from timer task depending + on result of SPF computation. + Reason: RFC 2328 specifies that type 3 LSAs should only + be issued based on routing table entries. */ + /* ANVL 27.15 end */ + + /* + * OSPF 1 second watchdog: runs every second. + * Gives timer_task_sem_id and hello_task_sem_id to tOspfTimer task + * and tOspfHello task respectively. + */ + WDOG_ID watchdog; + + /* + * tOspfTimer task pends on this semaphore, the watchdog timer gives this + * semaphore every second. + */ + SEM_ID timer_task_sem_id; + + /* + * tOspfHello task pends on this semaphore, the watchdog timer gives this + * semaphore every second. + */ + SEM_ID hello_task_sem_id; + + /* + * Semaphore to synchronize startup of OSPF tasks. Taken by every OSPF task + * after finishing own initialization. Given synchronously via semFlush to + * all ospf tasks pending on it when task state of all tasks is + * OSPFV3_TASK_STATE_INIT_COMPLETE + */ + + OSPF_TASK_DESCRIPTOR ospf_tasks[OSPF_NUM_TASKS]; /* ospf tasks */ + + OSPF_NBMA_PTMP_NBR_ENTRY *ospf_nbma_ptmp_nbr_list; + + int rtmSocket; /* routing table socket */ + int ipSocket; /* raw ip socket */ + ULONG exchange_state_timers_active; +} OSPF_CLASS; + +/* OSPF Traffic Engineering Extension Structure */ +typedef struct OSPF_TE_TLV_HEADER +{ + USHORT type; + USHORT length; +} OSPF_TE_TLV_HEADER; + +typedef struct OSPF_TE_TLV_DATA +{ + struct OSPF_TE_TLV_DATA *sptr_forward_link; + struct OSPF_TE_TLV_DATA *sptr_backward_link; + void *data; + ULONG data_length; + int TElsatype; +} OSPF_TE_TLV_DATA; + +typedef struct OSPF_TE_PARAMETERS +{ + struct OSPF_TE_PARAMETERS *sptr_forward_link; + struct OSPF_TE_PARAMETERS *sptr_backward_link; + ULONG ospf_te_router_address; + OSPF_TE_TLV_HEADER ospf_te_link_header; + unsigned char ospf_te_link_type; + ULONG ospf_te_link_id; + ULONG ospf_te_local_address[1]; + ULONG ospf_te_remote_address[1]; + ULONG ospf_te_metric; + ULONG ospf_te_maximum_bandwidth; + ULONG ospf_te_maximum_reservable_bandwidth; + ULONG ospf_te_unreserved_bandwidth[8]; + ULONG ospf_te_resource_class_color; +} OSPF_TE_PARAMETERS; + +/* Router Address TLV */ +typedef struct OSPF_TE_ROUTER_ADDRESS_TLV +{ + struct OSPF_TE_TLV_HEADER header; + ULONG value; +} OSPF_TE_ROUTER_ADDRESS_TLV; + +/* Link TLV */ +typedef struct OSPF_TE_LINK_TLV +{ + struct OSPF_TE_TLV_HEADER header; +} OSPF_TE_LINK_TLV; + +/* Link Type */ +typedef struct OSPF_TE_LINK_TYPE +{ + struct OSPF_TE_TLV_HEADER header; + struct { + #define POINT_TO_POINT_LINK_TYPE 1 + #define MULTIACCESS_LINK_TYPE 2 + unsigned char value; + unsigned char padding[3]; + } link_type; +} OSPF_TE_LINK_TYPE; + +/* Link ID */ +typedef struct OSPF_TE_LINK_ID +{ + struct OSPF_TE_TLV_HEADER header; + ULONG value; +} OSPF_TE_LINK_ID; + +/* Local Interface IP Address */ +typedef struct OSPF_TE_LOCAL_ADDRESS +{ + struct OSPF_TE_TLV_HEADER header; + ULONG value[1]; +} OSPF_TE_LOCAL_ADDRESS; + +/* Remote Interface IP Address */ +typedef struct OSPF_TE_REMOTE_ADDRESS +{ + struct OSPF_TE_TLV_HEADER header; + ULONG value[1]; +} OSPF_TE_REMOTE_ADDRESS; + +/* Traffic Engineering Metric */ +typedef struct OSPF_TE_TRAFFIC_ENGINEERING_METRIC +{ + struct OSPF_TE_TLV_HEADER header; + ULONG value; +} OSPF_TE_TRAFFIC_ENGINEERING_METRIC; + +/* Maximum Bandwidth */ +typedef struct OSPF_TE_MAXIMUM_BANDWIDTH +{ + struct OSPF_TE_TLV_HEADER header; + ULONG value; +} OSPF_TE_MAXIMUM_BANDWIDTH; + +/* Maximum Reservable Bandwidth */ +typedef struct OSPF_TE_MAXIMUM_RESERVABLE_BANDWIDTH +{ + struct OSPF_TE_TLV_HEADER header; + ULONG value; +} OSPF_TE_MAXIMUM_RESERVABLE_BANDWIDTH; + +/* Unreserved Bandwidth */ +typedef struct OSPF_TE_UNRESERVED_BANDWIDTH +{ + struct OSPF_TE_TLV_HEADER header; + ULONG value[8]; +} OSPF_TE_UNRESERVED_BANDWIDTH; + +/* Resource Class/Color */ +typedef struct OSPF_TE_RESOURCE_CLASS_COLOR +{ + struct OSPF_TE_TLV_HEADER header; + ULONG value; +} OSPF_TE_RESOURCE_CLASS_COLOR; + + +typedef struct OSPF_AVL_LSDB_NODE +{ + AVL_NODE node; + OSPF_LS_DATABASE_ENTRY *sptr_database_entry; +} OSPF_AVL_LSDB_NODE; + + +typedef struct OSPF_AVL_LSDB_KEY +{ + ULONG id; + ULONG router; + BYTE_ENUM (OSPF_LS_TYPE) type; +} OSPF_AVL_LSDB_KEY; + +#endif /* _OSPF_STRUCTURES_H_ */ + diff --git a/h/wrn/ospf/ospf_vnvram.h b/h/wrn/ospf/ospf_vnvram.h new file mode 100644 index 0000000..7bcef7f --- /dev/null +++ b/h/wrn/ospf/ospf_vnvram.h @@ -0,0 +1,70 @@ +/* vnvram.h */ + +/* Copyright 2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01e,06apr04,ram OSPF v2/v3 coexistance changes +01d,06aug03,agi fixed compiler error +01c,14aug03,kkz Changed nvram to ospf_nvram to prevent conflicts +01b,12jun03,agi added copyright notice, removed unused tables +01a,29may03,agi created (ported from RWOS) +*/ + +#ifndef __INCospfv3Vnvramh +#define __INCospfv3Vnvramh + +#ifdef __cplusplus +extern "C" { +#endif + +OSPF_NVRAM_CLASS ospf_nvram; + +void nvram_printf (const char *cptr_format, ...); + +void ospf_set_ulong_decimal_value + (char *cptr_value_string, + ULONG offset, + ULONG ulptr_base); + +void ospf_set_variable_port_and_enable + (char *cptr_start_of_configuration_string, + ULONG vptr_parameter_1, + ULONG ulptr_parameter_2, + ULONG size_of_parameter); + +void ospf_set_enum_enable + (char *cptr_value_string, + ULONG offset, + ULONG ulptr_base); + +void ospf_set_variable_port_and_ushort_decimal_value + (char *cptr_start_of_configuration_string, + ULONG vptr_parameter_1, + ULONG ulptr_parameter_2, + ULONG size_of_parameter); + +void ospf_set_variable_port_and_ulong_decimal_value + (char *cptr_value_string, + ULONG vptr_parameter_1, + ULONG ulptr_parameter_2, + ULONG size_of_parameter); + +void ospf_set_variable_port_and_ip_address + (char *cptr_ip_address_string, + ULONG vptr_parameter_1, + ULONG ulptr_parameter_2, + ULONG size_of_parameter); + +void ospf_set_ip_address + (char *cptr_ip_address_string, + ULONG offset, + ULONG ulptr_base); + +#ifdef __cplusplus +} +#endif + +#endif /*__INCospfv3Vnvramh*/ diff --git a/h/wrn/ospf/ospf_vs.h b/h/wrn/ospf/ospf_vs.h new file mode 100644 index 0000000..592459d --- /dev/null +++ b/h/wrn/ospf/ospf_vs.h @@ -0,0 +1,72 @@ +/* ospf_vs.h - ospf virtual stack data */ + +/* Copyright 2001-2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +02a,22aug03,agi ported to Accordion, updated copyright +01c,12may03,asr Changes to make OSPF virtual stack compatible. +01b,13aug01,kc Removed FP_OSPF_RECEIVE, FP_OSPF_SEND and OSPF_CALLBACK_IF. +01a,7mar01,jkw written +*/ + +#ifndef __INCospf_vsh +#define __INCospf_vsh + + +/* includes */ + +#include "vxWorks.h" +#include "ospf.h" + +/* defines */ + +/* typedefs */ +/* definitions from ospf_init.c */ +#if defined (__OSPF_VIRTUAL_STACK__) + +typedef struct ospfVs + { + /* definitions from ospf_init.c */ + OSPF_CALLBACK_IF _OspfRegistrationInfo; + + /* definitions from ospf_system.c */ + char _ospf_configuration_text[RWOS_MAXIMUM_FILE_SIZE + 1]; + + /* definitions from ospf_timer.c */ + UINT _ten_seconds_counter; + + /* definitions from configuration.h */ + CONFIGURATION_TABLE _ospf_configuration_table; + + /* definitions from ospf_globals.h */ + OSPF_CLASS _ospf; + RWOS_MUTEX _rwos_ospf_mutex; + int _ospfRawInputTaskId; + ULONG _ospf_db_overflow_timer; + + } OSPF_VS; + +/* macros */ + +#define OspfRegistrationInfo ospfVsTbl[myStackNum]->ospfGlobals._OspfRegistrationInfo +#define ospf_configuration_text ospfVsTbl[myStackNum]->ospfGlobals._ospf_configuration_text +#define ten_seconds_counter ospfVsTbl[myStackNum]->ospfGlobals._ten_seconds_counter +#define ospf_configuration_table ospfVsTbl[myStackNum]->ospfGlobals._ospf_configuration_table +#define ospf ospfVsTbl[myStackNum]->ospfGlobals._ospf + + +#define ospf_vs_id ospf.ospf_vs_id + +#define rwos_ospf_mutex ospfVsTbl[myStackNum]->ospfGlobals._rwos_ospf_mutex +#define ospfRawInputTaskId ospfVsTbl[myStackNum]->ospfGlobals._ospfRawInputTaskId +#define ospf_db_overflow_timer ospfVsTbl[myStackNum]->ospfGlobals._ospf_db_overflow_timer + + +#endif /* __OSPF_VIRTUAL_STACK__ */ + + +#endif /* __INCospf_vsh */ + diff --git a/h/wrn/ospf/ospf_vs_data.h b/h/wrn/ospf/ospf_vs_data.h new file mode 100644 index 0000000..6d9c9b9 --- /dev/null +++ b/h/wrn/ospf/ospf_vs_data.h @@ -0,0 +1,36 @@ +/* ospf_vs_data.h - ospf virtual stack data */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,07mar01,jkw written + +*/ + +#ifndef __INCospf_vs_datah +#define __INCospf_vs_datah + +#include "vxWorks.h" +#include "ospf_vs.h" + +/* defines */ + +#define OSPF_VS_NAME_MAX 32 + + +typedef struct ospf_global_data +{ + /* OSPF VS Layer. Things the OSPF VS system needs. */ + /* Name of this virtual ospf stack. */ + char name[OSPF_VS_NAME_MAX + 1]; + char *pName; + + OSPF_VS ospfGlobals; +} OSPF_GLOBAL_DATA; + +/* macros */ + + +#endif /* __INCospf_vs_datah */ diff --git a/h/wrn/ospf/ospf_vs_lib.h b/h/wrn/ospf/ospf_vs_lib.h new file mode 100644 index 0000000..a6cbd8f --- /dev/null +++ b/h/wrn/ospf/ospf_vs_lib.h @@ -0,0 +1,52 @@ +/* vsOspfLib.h - virtual stack routines */ + +/* Copyright 2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02,17sep01,kc Added ospfConfigurationTableInit prototype. +01,07mar01,jkw written + +*/ + +#ifndef __INCospf_vs_libh +#define __INCospf_vs_libh + +#include "vxWorks.h" +#include "ospf_vs_data.h" + +/* This is used for conditional compilation during development. */ + +#ifndef __OSPF_VIRTUAL_STACK__ +#define __OSPF_VIRTUAL_STACK__ +#endif + +#define OSPF_VSID_MAX 32 +#define OSPF_VS_MGMT_STACK 0 + +typedef OSPF_GLOBAL_DATA* OSPF_VSID; + +IMPORT SEM_ID ospfVsTblLock; +IMPORT OSPF_GLOBAL_DATA* ospfVsTbl[]; +IMPORT int myStackNum; +IMPORT OSPF_VSID mgmtStackId; + + +#ifdef __cplusplus +extern "C" { +#endif + +IMPORT STATUS ospfVirtualStackLibInit(); +IMPORT STATUS ospfVirtualStackCreate(OSPF_VSID* pOSPF_VSID); +IMPORT STATUS ospfVirtualStackInit(OSPF_VSID ospfVsId); +IMPORT STATUS ospfVirtualStackDelete(OSPF_VSID ospfVsId); +IMPORT STATUS ospfVirtualStackIdGet(char* pName, OSPF_VSID* pOSPF_VSID); +IMPORT void ospfVirtualStackInfo(OSPF_VSID ospfVsId); +IMPORT void ospfVirtualStackShow(void); +IMPORT void ospfConfigurationTableInit(CONFIGURATION_TABLE *configuration_table); +#ifdef __cplusplus +} +#endif + +#endif /* __INCospf_vs_libh */ diff --git a/h/wrn/ospfCommon/ospfCommonLib.h b/h/wrn/ospfCommon/ospfCommonLib.h new file mode 100644 index 0000000..5c8b477 --- /dev/null +++ b/h/wrn/ospfCommon/ospfCommonLib.h @@ -0,0 +1,60 @@ +/* ospfCommonLib.h - OSPF commmon header file */ + +/* Copyright 2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01f,22apr04,ram AVL & Memory migration to shared library +01e,07apr04,ram OSPF v2/v3 coexistance compile +01d,06apr04,ram OSPF v2/v3 coexistance changes +01c,12aug03,agi ported to Accordion stack +01b,05aug03,agi changed include file list + updated copyright +01a,28jul03,agi created (ported from OSPFv2) +*/ + +#ifndef __INCospfCommonLibh +#define __INCospfCommonLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined (WIN32) +#define OSPF_EXPORT __declspec(dllexport) +#else +#define OSPF_EXPORT +#endif + +#define MINIMUM_UINT(a,b) ((a)<(b)?(a):(b)) + +#include /* VxWorks standard typedefs */ + +#if defined (__VXWORKS__) + #if !defined (WIN32) + #define _pack __attribute__ ((packed)) /* gnu cc pack attribute */ + #endif +#else + #define _pack +#endif + +#if! defined bool + typedef enum bool + { + true = 1, + false = 0 + } bool; +#endif /* bool */ + +#include +#include +#include +#include + +#ifdef __cplusplus +} +#endif + +#endif /* __INCospfCommonLibh */ diff --git a/h/wrn/ospfCommon/ospfCommonMemPart.h b/h/wrn/ospfCommon/ospfCommonMemPart.h new file mode 100644 index 0000000..0bb8bf2 --- /dev/null +++ b/h/wrn/ospfCommon/ospfCommonMemPart.h @@ -0,0 +1,41 @@ +/* ospfCommonUsrMemPartLib.h - OSPF memory partition manipulation header file */ + +/* Copyright 2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01d,22apr04,ram AVL & Memory migration to shared library +01c,22apr04,ram AVL & Memory migration to shared library +01b,25sep03,ram Second general modifications submission +01a,05aug03,agi created (ported from OSPFv2) +*/ + +#ifndef __INCospfCommonMemParth +#define __INCospfCommonMemParth + +#include "vxWorks.h" +#include "errno.h" +#include "memPartLib.h" + +/* type definitions */ +typedef ulong_t OSPF_MEM_PART_ID; + +extern OSPF_MEM_PART_ID ospfMemPartCreate( size_t memSize ); + +extern STATUS ospfMemPartExpand( OSPF_MEM_PART_ID memPartId, size_t memSize ); + +extern STATUS ospfMemPartDelete( OSPF_MEM_PART_ID memPartId ); + +extern void *ospfMemPartAlloc( OSPF_MEM_PART_ID memPartId, size_t numBytes ); + +extern STATUS ospfMemPartFree( OSPF_MEM_PART_ID memPartId, void *ptr ); + +extern void ospfMemPartSetOptions( OSPF_MEM_PART_ID memPartId, size_t options); + +extern STATUS ospfMemPartShow( OSPF_MEM_PART_ID memPartId, int type ); + + +#endif /* __INCospfCommonMemParth */ + diff --git a/h/wrn/ospfCommon/ospfCommonMibApi.h b/h/wrn/ospfCommon/ospfCommonMibApi.h new file mode 100644 index 0000000..42c6281 --- /dev/null +++ b/h/wrn/ospfCommon/ospfCommonMibApi.h @@ -0,0 +1,202 @@ +/* ospfCommonMibApi.h - application neutral MIB API header file */ + +/* Copyright 2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,06aug03,agi added MAPI_COMMIT_FORCE, MAPI_GET_FORCE +01a,30jul03,agi created (ported from OSPFv2) +*/ + +/* +DESCRIPTION + +ospfCommonibApi.h contains the common enumerations and data structures used to +implement the "application neutral MIB API" (MIB API or MAPI). +*/ + +#ifndef __INCospfCommonMibApih +#define __INCospfCommonMibApih + +#ifdef __cplusplus +extern "C" { +#endif + +/* typedefs */ + +/****************************************************************************** +* mApiReqType_t -- MIB API Request Type typedef +* +* The 'mApiReqType_t' is used in conjunction with the MIB API function calls +* defined for each application protocol (e.g., OSPF). Note that a single SET +* request is not supported. The caller must make a series of requests to +* implement a "phased" SET. Shown below are ALL allowed request combinations +* for a single object SET. For brevity, the "MAPI_" is not included. +* - TEST, COMMIT, COMPLETE -- SET succeeds +* - TEST_FORCE, COMMIT, COMPLETE -- SET_FORCE read-only succeeds +* - COMMIT_NVM, COMPLETE -- SET_NVM succeeds +* - TEST, COMPLETE -- TEST failure +* - TEST_FORCE, COMPLETE -- TEST_FORCE failure +* - TEST, COMMIT, UNDO, COMPLETE -- COMMIT failure +* - TEST_FORCE, COMMIT, UNDO, COMPLETE -- COMMIT read-only failure +* - COMMIT_NVM, UNDO, COMPLETE -- COMMIT_NVM failure +* +* Note that a "COMPLETE" is ALWAYS required. +*/ +typedef enum + { + MAPI_GET = 1, /* GET request */ + MAPI_GET_NEXT = 2, /* GET-NEXT request */ + MAPI_TEST = 3, /* TEST request -- for SET */ + MAPI_COMMIT = 4, /* COMMIT request -- for SET */ + MAPI_UNDO = 5, /* UNDO request -- for SET */ + MAPI_COMPLETE = 6, /* COMPLETE request -- for SET */ + MAPI_TEST_FORCE = 7, /* FORCE_SET read-only object -- for SET */ + MAPI_COMMIT_NVM = 8, /* NVM_SET w/o TEST/TEST_FORCE phase -- for SET */ + MAPI_COMMIT_FORCE = 8, /* NVM_SET w/o TEST/TEST_FORCE phase -- for SET */ + MAPI_GET_NVM = 9, /* NVM_GET request */ + MAPI_GET_FORCE = 9 /* NVM_GET request */ + } mApiReqType_t; + +/****************************************************************************** +* mApiException_t -- MIB API object 'exception' typedef +* +* Defines the 'exception' enumerations for the 'mApiObject_t' structure. +* +* Note that only GETs and GET-NEXTs support non-zero exceptions. SETs (i.e., +* TESTs, COMMITs, UNDOs and COMPLETEs) do not support non-zero exceptions. +*/ +typedef enum + { + MAPI_NO_EXCEPTION = 0, /* no exception occurred */ + MAPI_NO_SUCH_OBJECT = 128, /* SNMPv2 noSuchObject exception */ + MAPI_NO_SUCH_INSTANCE = 129, /* SNMPv2 noSuchInstance exception */ + MAPI_END_OF_MIB_VIEW = 130, /* SNMPv2 endOfMibView exception */ + MAPI_BUFFER_TOO_SHORT = 1000 /* data buffer too short exception */ + } mApiException_t; + +/****************************************************************************** +* mApiError_t -- MIB API request 'error' typedef +* +* This typedef defines the SNMPv2 enumerations used with the MIB API for the +* 'error' value in the 'mApiRequest_t' structure. Note that the less specific +* SNMPv1 errors are explicitly absent and SHOULD NOT be used. +* +* The individual application protocol (e.g., OSPF) can also create its own +* enumerations to supply 'error' values for the 'mApiRequest_t' structure. +* It is recommended that these start at '100'. These should be added to the +* application protocol include file (not to this common MIB API header file). +*/ +typedef enum + { + /* SNMPv2 specific errors */ + MAPI_NO_ERROR = 0, /* SNMPv2 noError(0) */ + MAPI_ERROR_TOO_BIG = 1, /* SNMPv2 errorTooBig(1) */ + /* do NOT use - SNMPv1 */ /* SNMPv1 noSuchName(2) */ + /* do NOT use - SNMPv1 */ /* SNMPv1 badValue(3) */ + /* do NOT use - SNMPv1 */ /* SNMPv1 readOnly(4) */ + MAPI_GEN_ERROR = 5, /* SNMPv2 genError(5) */ + MAPI_NO_ACCESS = 6, /* SNMPv2 noAccess(6) */ + MAPI_WRONG_TYPE = 7, /* SNMPv2 wrongType(7) */ + MAPI_WRONG_LENGTH = 8, /* SNMPv2 wrongLength(8) */ + MAPI_WRONG_ENCODING = 9, /* SNMPv2 wrongEncoding(9) */ + MAPI_WRONG_VALUE = 10, /* SNMPv2 wrongValue(10) */ + MAPI_NO_CREATION = 11, /* SNMPv2 noCreation(11) */ + MAPI_INCONSIST_VALUE = 12, /* SNMPv2 inconsistValue(12) */ + MAPI_RESOURCE_UNAVAILABLE = 13, /* SNMPv2 resourceUnavailable(13) */ + MAPI_COMMIT_FAILED = 14, /* SNMPv2 commitFailed(14) */ + MAPI_UNDO_FAILED = 15, /* SNMPv2 undoFailed(15) */ + MAPI_AUTHORIZATION_ERROR = 16, /* SNMPv2 authorizationError(16) */ + MAPI_NOT_WRITABLE = 17, /* SNMPv2 notWritable(17) */ + MAPI_INCONSIST_NAME = 18 /* SNMPv2 inconsistName(18) */ + } mApiError_t; + +/****************************************************************************** +* mApiObject_t -- MIB API Object typedef +* +* This structure contains information for a single MIB object and is used in +* conjunction with the 'mApiRequest_t' structure. When making the call, +* 'valueLen' contains the allocated byte length of the buffer. When returned, +* 'valueLen' contains the actual byte size of the data. The 'pValueBuf' void +* pointer is used to return the requested value. This reduces the stack +* requirements and eliminates the need for the calling routine to copy the +* data into its final location. Note that the data type is implied and is +* the value defined in the associated MIB for this object. +* +* The 'exception' contains one of the mApiException_t values. GETs and +* GET-NEXTs support non-zero exceptions; SETs do not support non-zero +* exceptions. If 'exception' contains MAPI_BUFFER_TOO_SHORT', then 'valueLen' +* contains the actual byte length of the data and no data is returned. The +* calling routine then has the option of making a new request using the proper +* size buffer. +* +* 'pObjCookie' points to object-level data defined by the MAPI handler and/or +* MAPI handler caller that can be a single variable or a structure. Unlike +* 'pReqCookie' in the mApiRequest_t structure, the 'pObjCookie' field can be +* set/used also by the MAPI handler caller. The use of this field must be +* clearly documented in specific header MAPI include file. +*/ +typedef struct mApiObject_s + { + ulong_t oidPrefixEnum; /* enum for object OID Prefix */ + void * pValueBuf; /* pointer to value buffer */ + ulong_t valueLen; /* value byte length */ + mApiException_t exception; /* exception value for object */ + void * pObjCookie; /* pointer to MAPI object data */ + } mApiObject_t; + +/****************************************************************************** +* mApiRequest_t -- MIB API Request typedef +* +* This structure is used to make a request for a single MIB object or for +* multiple objects in a single SNMP table row. Consequently, only a single +* instance is required (and allowed) to process this request. +* +* 'pInstance' is a pointer to an array of unsigned long integers that contains +* the MIB object or table row instance information for a single object or row. +* It CANNOT be overloaded to contain index information for multiple rows. For +* GET-NEXT operations, the caller must use an instance array size that supports +* the expected instance length. 'instanceLen' contains the number of +* sub-identifiers in the instance. For a scalar, the instance is always '0' +* and the length is always '1'. For a GET-NEXT operation, the MIB API updates +* both the 'pInstance' and 'instanceLen' information. +* +* 'pObjectList' is a pointer to an array of 'mApiObject_t' structures that +* contains 'numObjects' elements. +* +* 'error' contains the error status for the entire request. It uses the +* 'mApiError_t' enumeration or an enumeration defined by the application +* protocol (e.g., OSPF). 'error' is zero (MAPI_NO_ERROR) if there is no error. +* If 'error' is non-zero, then the entire request has failed (i.e., no partial +* data is returned). The 'errorObjIndex' is a one-based index to the object +* that caused the error. For general errors not caused by any specific object, +* 'errorObjIndex' is '0'. Note that if this is a MAPI_UNDO request, and UNDO +* is not supported, 'error' will contain 'MAPI_UNDO_FAILED'. +* +* 'pReqCookie' points to request-level data defined by the MAPI handler that +* can be a single variable or a structure. This opaque "data", which is ONLY +* used by the MAPI handler, allows the handler to maintain (or remember) +* information between the various SET phases. The 'pReqCookie' SHOULD NOT be +* initialized or modified by the calling routine (that is, only the MAPI +* handler can modify this field). A typical use for this field is to point a +* structure that saves information from the TEST phase for use in the COMMIT +* phase. +*/ +typedef struct mApiRequest_s + { + ulong_t * pInstance; /* pointer to OID instance array */ + ushort_t instanceLen; /* number of sub-ids in instance */ + ushort_t numObjects; /* number of objects in request */ + mApiObject_t * pObjectList; /* pointer to array of object info */ + ushort_t error; /* error (non-zero) for entire request */ + ushort_t errorObjIndex; /* 1-based index to object causing error */ + void * pReqCookie; /* pointer to MAPI request opaque data */ + } mApiRequest_t; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCospfCommonMibApih */ diff --git a/h/wrn/ospfCommon/ospfCommonPrototypes.h b/h/wrn/ospfCommon/ospfCommonPrototypes.h new file mode 100644 index 0000000..d7f5870 --- /dev/null +++ b/h/wrn/ospfCommon/ospfCommonPrototypes.h @@ -0,0 +1,51 @@ +/* ospfCommonRowStatusLib.h - OSPF common row status header file. */ + +/* Copyright 2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01e,29apr04,ram Fix mapi AVL, compile, and warnings +01d,06apr04,ram OSPF v2/v3 coexistance changes +01c,08sep03,agi ported to Accordion stack +01b,12aug03,agi added ospf_convert_ip_address_to_dot_format() +01a,06aug03,agi created (ported from OSPFv2) +*/ + +/* +DESCRIPTION +This file defines the types and function prototypes for rowStatusLib +*/ + +#ifndef __INCospfCommonPrototypesh +#define __INCospfCommonPrototypesh + +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +char * ospf_strlwr (char *cptr_string_to_lower_case); + +char * ospf_convert_ip_address_to_dot_format + (char *cptr_array_to_store_dot_format_address, ULONG ip_address); + +BOOLEAN ospf_is_parameter_enabled (char *cptr_parameter_string); + +void ospf_add_entry_to_list (LINK *sptr_link, LINK *sptr_link_to_add); + +void ospf_delete_entry_from_list ( + LINK *sptr_list_link, LINK *sptr_link_to_delete); + +void ospfAvlWalkAndExecute(AVL_TREE* root, void walkExec(void * node)); +void ospfAvlExecuteAndWalk(AVL_TREE* root, void walkExec(void * node)); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCospfCommonPrototypesh */ + diff --git a/h/wrn/ospfCommon/ospfCommonRowStatusLib.h b/h/wrn/ospfCommon/ospfCommonRowStatusLib.h new file mode 100644 index 0000000..ae5764e --- /dev/null +++ b/h/wrn/ospfCommon/ospfCommonRowStatusLib.h @@ -0,0 +1,143 @@ +/* ospfCommonRowStatusLib.h - OSPF common row status header file. */ + +/* Copyright 2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,06aug03,agi created (ported from OSPFv2) +*/ + +/* +DESCRIPTION +This file defines the types and function prototypes for rowStatusLib +*/ + +#ifndef __INCospfCommonRowStatush +#define __INCospfCommonRowStatush + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* defines */ + + +/* enums */ + +/* Action/state enum type */ +typedef enum +{ + RS_undefined = 0, /* row does not exist */ + RS_active, /* active */ + RS_notInService, /* not in service */ + RS_notReady, /* not ready */ + RS_createAndGo, /* create and go */ + RS_createAndWait, /* create and wait */ + RS_destroy, /* destroy */ + RS_setOtherObject, /* set a non-RowStatus object */ + /* all others are errors */ + RS_inconsistValue, /* inconsistent */ + RS_wrongValue, /* wrongValue */ + RS_genError, /* Generic ERROR */ + RS_noCreation /* could not create row */ +} rsState_t; + +typedef rsState_t rsAction_t; + +#define RS_noError RS_undefined +#define RS_stateMax RS_notReady +#define RS_actionMax RS_setOtherObject + +/* condition type */ +typedef enum +{ + RS_NO_CONDITION = 0, /* unconditional */ + RS_CONDITION1, /* notInService is supported */ + RS_CONDITION2, /* all columns are valid */ + RS_CONDITION3, /* notInService supported and all columns are valid */ + RS_CONDITION4, /* creation allowed when modifying a non-existing row */ + RS_CONDITION5 /* modifying a column of an active row is supported */ +} rsCondition_t; + +typedef enum +{ + RS_ACCESS_NONE = 0, + RS_ACCESS_RS_GET, /* row status value get */ + RS_ACCESS_RS_SET, /* row status value set */ + RS_ACCESS_RS_VALID, /* validate row status value */ + RS_ACCESS_COL_SET, /* column set */ + RS_ACCESS_COL_VALID, /* validate column */ + RS_ACCESS_ROW_VALID, /* validate row */ + RS_ACCESS_ROW_DELETE /* delete row */ +} rsRowAccessCode_t; + +typedef enum +{ + RS_GET_REQUEST = 1, + RS_SET_NVM_REQUEST, + RS_VALIDATE_REQUEST, + RS_COMMIT_REQUEST, + RS_ERROR_REQUEST +} rsRequest_t; + +/* typedefs */ + +typedef STATUS (* RS_CREATE_FUNC) (void * pRequest, void ** pEntry, + rsAction_t action, rsRequest_t rsRequest); + +typedef STATUS (* RS_ACCESS_FUNC) (void * pEntry, void * pObjInfo, + rsRowAccessCode_t accessFlag); + +typedef STATUS (* RS_STATUS_FUNC) (void *pEntry, rsState_t *rsState, + rsRowAccessCode_t accessFlag); + +typedef STATUS (* RS_ERROR_FUNC) ( void * pObjInfo, int rsError); + +typedef struct +{ + rsState_t state1; /* next state 1 if there was no error */ + rsState_t state2; /* next state 2 if there was no error */ + rsCondition_t cond; /* if non-zero, state is conditional */ + rsState_t error; /* error code if error occured */ +} rsRowStatus_t; + +typedef struct +{ + BOOL notInService; /* is notInService supported ? */ + BOOL modifyActive; /* is modifying an active row supported ? */ + BOOL createAndGo; /* is createAndGo supported ? */ + BOOL createWhileValidate; /* is createWhileValidate supported? */ + RS_CREATE_FUNC rowCreateRtn; /* row manipulation routine */ + RS_ACCESS_FUNC rowAccessRtn; /* row manipulation routine */ + RS_STATUS_FUNC rowStatusAccessRtn; /* status object manipulation routine */ + RS_ERROR_FUNC errorConvertRtn; /* error conversion routine */ + rsAction_t rsShadow; /* shadow value for the next rowStatus action + * state for handling the createAndWait and + * createAndGo row operations + */ + +} rsParams_t; + +/* externs */ + +IMPORT STATUS rsRowStatusSet (rsParams_t * pParams, void * pRequest, + rsAction_t action, rsRequest_t rsRequest, + BOOL lastCol); +IMPORT STATUS rsParamsInit (rsParams_t ** ppParams, + RS_CREATE_FUNC rowCreateRtn, + RS_ACCESS_FUNC rowAccessRtn, + RS_STATUS_FUNC rowStatusAccessRtn, + RS_ERROR_FUNC errorConvertRtn); +IMPORT void rsParamsDelete (rsParams_t * pParams); +IMPORT STATUS rsParamsNotInServiceSet (void * pParams, BOOL notInService); +IMPORT STATUS rsParamsModifyActiveSet (void * pParams, BOOL notInService); +IMPORT STATUS rsParamsCreateAndGoSet (void * pParams, BOOL createAndGo); +IMPORT STATUS rsParamsCreateWhileValidateSet (void * pParams, BOOL createWhileValidate); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCospfCommonRowStatush */ diff --git a/h/wrn/ospfCommon/ospfCommonUtils.h b/h/wrn/ospfCommon/ospfCommonUtils.h new file mode 100644 index 0000000..08c0420 --- /dev/null +++ b/h/wrn/ospfCommon/ospfCommonUtils.h @@ -0,0 +1,120 @@ +/* ospfCommonUtils.h - OSPF common utilities header file */ + +/* Copyright 2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,05aug03,agi created (ported from OSPFv2) +*/ + +#ifndef __INCospfCommonUtilsh +#define __INCospfCommonUtilsh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include + +/* Internet address class. Note the IP address is in host order. */ + +/* +#if !defined (__VxWORKS__) +#if !defined (WAIT_FOREVER) +#define WAIT_FOREVER 0xffffffff +#endif +#endif +*/ + +#define PARAMETER_NOT_USED(parameter_one) (parameter_one = parameter_one) + +/******************************************************************************/ + +#if !defined BOOLEAN +typedef enum BOOLEAN +{ + _FALSE = 0 /* FALSE and TRUE are already defined here */ + ,_TRUE = 1 +} BOOLEAN; +#endif + +#if !defined _struct +#define _struct struct +#endif + +#if !defined _union +#define _union union +#endif + +#if !defined _enum +#define _enum enum +#endif + +#if !defined _pack +#define _pack +#endif + +#define INVALID_HANDLE ((UINT)NULL) + +#ifndef _BYTE_ +#define _BYTE_ +typedef unsigned char BYTE; +#endif + +#if !defined (__BIG_ENUMS__) + #define BYTE_ENUM(enum_name) enum enum_name +#else + #define BYTE_ENUM(enum_name) BYTE +#endif + +typedef enum TEST +{ + PASS = 1, + FAIL = 0 +} TEST; + +#if !defined STRINGS_MATCH +#define STRINGS_MATCH ((int) NULL) +#endif + +typedef struct LINK +{ + struct LINK *sptr_forward_link; + struct LINK *sptr_backward_link; +} LINK; + +#define MAXIMUM_ETHERNET_DATA_SIZE 1500 +#define MINIMUM_ETHERNET_DATA_SIZE 46 + +typedef _struct MAC_ADDRESS +{ + ULONG _ulong; + USHORT _ushort; +} _pack MAC_ADDRESS; + +/* High byte of word double_word. */ +#define high_byte_of_dword(double_word) (((double_word) >> 24) & 0x000000ff) +/* High byte of word double_word. */ +#define high_low_byte_of_dword(double_word) (((double_word) >> 16) & 0x000000ff) +/* High byte of word double_word. */ +#define low_high_of_dword(double_word) (((double_word) >> 8) & 0x000000ff) +/* Low byte of word double_word. */ +#define low_byte_of_dword(double_word) ((double_word) & 0x000000ff) +/* High byte of ushort ushort. */ +#define high_byte_of_ushort(ushort) (((ushort)>>8)&0x00ff) +/* Low byte of ushort ushort. */ +#define low_byte_of_ushort(ushort) ((ushort)&0x00ff) +/* High byte of ushort double_ushort. */ +#define low_ushort_of_ulong(double_ushort) (WORD)(((double_ushort) >> 16) & 0x0000ffff) +/* Low byte of ushort double_ushort. */ +#define high_ushort_of_ulong(double_ushort) (WORD)((double_ushort) & 0x0000ffff) +#define two_bytes_to_ushort(high_byte,low_byte) ((((high_byte)&0x00ff)<<8)|((low_byte)&0x00ff)) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCospfCommonUtilsh */ diff --git a/h/wrn/ospfCommon/ospfCommonVnvramStr.h b/h/wrn/ospfCommon/ospfCommonVnvramStr.h new file mode 100644 index 0000000..21fc30b --- /dev/null +++ b/h/wrn/ospfCommon/ospfCommonVnvramStr.h @@ -0,0 +1,57 @@ +/* ospfCommonVnvramStr.h - OSPF common NVRAM header file */ + +/* Copyright 2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,06apr04,ram OSPF v2/v3 coexistance changes +01a,29may03,agi created (ported from OSPFv2) +*/ + +#ifndef __INCospfCommonVnvramStrh +#define __INCospfCommonVnvramStrh + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OSPF_CONFIGURATION_FUNCTION + { + void (*fptr_parameter_function) ( + char *cptr_start_of_configuration_string, + ULONG parameter_1, + ULONG ulptr_parameter_2, + ULONG parameter_3); + + BOOLEAN *eptr_enable_string; + char *cptr_parameter_string; + ULONG parameter_1; + ULONG ulptr_parameter_2; + ULONG parameter_3; + ULONG minimum_value; + ULONG maximum_value; + } OSPF_CONFIGURATION_FUNCTION; + +typedef struct OSPF_CONFIGURATION_TABLE + { + BOOLEAN valid; + OSPF_CONFIGURATION_FUNCTION function[200]; + } OSPF_CONFIGURATION_TABLE; + +typedef struct OSPF_NVRAM_CLASS + { + BOOLEAN display_configuration_file; + BYTE current_configuration_section_index; + OSPF_CONFIGURATION_TABLE * sptr_current_configuration_table; + BYTE value[12]; + BYTE number_of_configurations; + } OSPF_NVRAM_CLASS; + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCospfCommonVnvramStrh */ diff --git a/h/wrn/ospfv3/ospfv3Configuration.h b/h/wrn/ospfv3/ospfv3Configuration.h new file mode 100644 index 0000000..5432978 --- /dev/null +++ b/h/wrn/ospfv3/ospfv3Configuration.h @@ -0,0 +1,524 @@ +/* ospfv3Configuration.h - OSPFv3 configuration header file */ + +/* Copyright 2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01i,14apr04,ram Performance optimization changes +01h,06apr04,ram OSPF v2/v3 coexistance changes +01g,16dec03,ram Mods per type 3 & 4 testing +01f,10oct03,ram Modifications for LSDB, dynamic config, & NSSA cleanup +01e,25sep03,ram Second general modifications submission +01d,30jul03,ram Changes for sockets, external routes, and cleanup +01c,23jul03,agi added RWOS removal changes + updated copyright +01c,18feb03,dsk ported from OSPFv2 to OSPFv3 structures +01b,14nov02,agi first pass at clean-up +01a,23oct02,agi written +*/ + +#ifndef __INCospfv3Configurationh +#define __INCospfv3Configurationh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __OSPF_VIRTUAL_STACK__ +#include "ospf_vs_lib.h" +#endif /* __OSPF_VIRTUAL_STACK__ */ + +/******************************************************************************/ +#ifndef __OSPFV3_VIRTUAL_STACK__ +OSPF_CONFIGURATION_TABLE ospfv3_configuration_table = +{ + 1, + { +/*___________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_default_values, + NULL, + "OSPFV3 Use Default Values =" + }, + +/*___________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_router_id, + NULL, + "OSPFV3 Router ID =", + }, + +/* __________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_tos_capability, + NULL, + "OSPFV3 Type of Service Capability =", + }, +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_asbr, + NULL, + "OSPFV3 Autonomous System Border Router =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_multicast, + NULL, + "OSPFV3 IP Multicast =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_number_of_areas, + NULL, + "OSPFV3 Number of Areas =", + }, + + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_area_id, + NULL, + "OSPFV3 Area ID =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_number_of_area_address_range, + NULL, + "OSPFV3 Total Number of Area Address Ranges =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_area_address_range_address, + NULL, + "OSPFV3 Area Address Range Address =", + }, +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_area_address_range_length, + NULL, + "OSPFV3 Area Address Range Address Length =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_area_address_range_enable, + NULL, + "OSPFV3 Area Address Range Advertise =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_area_address_range_area_id, + NULL, + "OSPFV3 Area Address Range Area ID =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_area_external_routing_capability, + NULL, + "OSPFV3 Area External Routing Capability =", + }, +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_area_stub_inject_default_route, + NULL, + "OSPFV3 Area Inject Default Route Into Stub Area =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_area_stub_cost, + NULL, + "OSPFV3 Area Stub Default Cost =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_number_of_ports, + NULL, + "OSPFV3 Number of Ports =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_port_enable, + NULL, + "OSPFV3 Port =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_port_index, + NULL, + "OSPFV3 Port Interface Index =", + }, + +#ifdef __UNNUMBERED_LINK__ /* -bt- */ +/* __________________________________________________________ unnumbered dest ip */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_unnumbered_dest_ip, + NULL, + "OSPFV3 Port Unnumbered Dest IP =", + }, +#endif /* __UNNUMBERED_LINK__ -bt- */ + +/* __________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_port_nbma_neighbor_address, + NULL, + "OSPFV3 Port NBMA or PTMP Neighbor Address =", + }, +/* __________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_port_nbma_neighbor_id, + NULL, + "OSPFV3 Port NBMA or PTMP Neighbor ID =", + }, +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_port_area_id, + NULL, + "OSPFV3 Port Area ID =", + }, +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_port_type, + NULL, + "OSPFV3 Port Type =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_port_transit_area_id, + NULL, + "OSPFV3 Port Transit Area ID =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_port_source_area_id, + NULL, + "OSPFV3 Port Source Area ID =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_port_router_dead_interval, + NULL, + "OSPFV3 Port Router Dead Interval =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_port_transmit_delay, + NULL, + "OSPFV3 Port Transmit Delay =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_port_priority, + NULL, + "OSPFV3 Port Priority =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_port_cost, + NULL, + "OSPFV3 Port Cost =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_port_hello_interval, + NULL, + "OSPFV3 Port Hello Interval =", + }, + +/* __________________________________________________________________________ */ +{ + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_port_neighbor_router_id, + NULL, + "OSPFV3 Port Neighbor Router ID =", + }, + +/* __________________________________________________________________________ */ +{ + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_port_poll_interval, + NULL, + "OSPFV3 Port Poll Interval =", + }, + +/* __________________________________________________________________________ */ +{ + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_port_retxmt_interval, + NULL, + "OSPFV3 Port Retransmit Interval =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_port_passive, + NULL, + "OSPFV3 Port Passive =", + }, + +/* __________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_port_passive_all, + NULL, + "OSPFV3 Port Passive-Interface =" + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_printf, + NULL, + "OSPFV3 Printf =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_printf_interface, + NULL, + "OSPFV3 Printf Interface =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_printf_neighbor, + NULL, + "OSPFV3 Printf Neighbor =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_printf_memory, + NULL, + "OSPFV3 Printf Memory =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_printf_alarm, + NULL, + "OSPFV3 Printf Alarm =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_printf_snmp, + NULL, + "OSPFV3 Printf SNMP =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_printf_packet, + NULL, + "OSPFV3 Printf Packets =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_printf_routing_table, + NULL, + "OSPFV3 Printf Routing Table =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_printf_debug, + NULL, + "OSPFV3 Printf Debug =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_printf_rtm, + NULL, + "OSPFV3 Printf Rtm =", + }, + +/* __________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_printf_prologue, + NULL, + "OSPFV3 Printf Prologue =", + }, + +/*_____________________________________________________________________________________________________*/ +{ + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_printf_db_overflow, + NULL, + "OSPFV3 Printf DB Overflow =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_bgp_redistribute_all, + NULL, + "OSPFV3 Redistribute BGP =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_rip_redistribute_all, + NULL, + "OSPFV3 Redistribute RIP =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_static_redistribute_all, + NULL, + "OSPFV3 Redistribute Static =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_default_redistribute, + NULL, + "OSPFV3 Redistribute Default =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_bgp_subnets_to_redistribute, + NULL, + "OSPFV3 Redistribute BGP Subnets =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_static_subnets_to_redistribute, + NULL, + "OSPFV3 Redistribute Static Subnets =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_rip_subnets_to_redistribute, + NULL, + "OSPFV3 Redistribute RIP Subnets =", + }, + +/* _____________________________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_point_to_point_lsa_option, + NULL, + "OSPFV3 Point to Point Router Lsa Option =", + }, + +/* __________________________________________________________________________ */ +/* RFC 1765 */ +#ifdef __OSPFV3_DB_OVERFLOW_SUPPORT__ + + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_external_lsdb_limit, + NULL, + "OSPFV3 External LSDB Limit =", + }, +/*____________________________________________________________________________*/ + + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_exit_overflow_interval, + NULL, + "OSPFV3 Exit Overflow Interval =", + }, + +#endif /* __OSPFV3_DB_OVERFLOW_SUPPORT__ */ + +/* __________________________________________________________________________ */ + { + (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) + ospfv3_set_max_lsa_deleted, + NULL, + "OSPFV3 Maximum LSAs Deleted Per Second =", + }, + +/*___________________________________________________________________________ */ + { + NULL, + NULL, + "", + (ULONG) NULL, + (ULONG) NULL, + (ULONG) NULL + } + + } +}; +#endif /* __OSPFV3_VIRTUAL_STACK__ */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCospfv3Configurationh */ diff --git a/h/wrn/ospfv3/ospfv3Constants.h b/h/wrn/ospfv3/ospfv3Constants.h new file mode 100644 index 0000000..72a28c2 --- /dev/null +++ b/h/wrn/ospfv3/ospfv3Constants.h @@ -0,0 +1,383 @@ +/* ospfv3Constants.h - OSPFv3 constants */ + +/* Copyright 2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +02f,19oct05,xli updated version number to 3.1 from 3.1.1 +02e,29jul04,dsk updated version number to 3.0 from 1.0 +02d,14apr04,ram Performance optimization changes +02c,13apr04,ram OSPFv3 Routing Table Hash Modifications +02b,15mar04,dsk Mods according to OSPFv3 ANVL conformance testing +02a,16dec03,ram Mods per type 3 & 4 testing +01z,06nov03,agi fixed merge error +01y,06nov03,ram Modifications for external routes +01x,03nov03,agi fixed #ifndef to #ifdef around OSPFV3TOMAPI_TASK_PRIORITY +01w,28oct03,ram Modifications for traffic, aging, LSAs, & cleanup +01v,22oct03,ram Modifications for LS request & separating performance +01u,21oct03,ram Modifications for adjacency establishment +01t,17oct03,ram Modifications for memory corruption, traffic, & debug output +01s,10oct03,ram Modifications for LSDB, dynamic config, & NSSA cleanup +01r,07oct03,agi changed OSPFV3_INTER_AREA_PREFIX_LINK_ADVERTISEMENT_HEADER_SIZE + to OSPFV3_INTER_AREA_PREFIX_LSA_HEADER_SIZE +01p,07oct03,agi removed conditional flag for debug output +01o,30sep03,ram OSPF datapath changes +01n,25sep03,ram Second general modifications submission +01m,29jul03,ram Added sockets, processing, and external route changes +01i,29jul03,dsk added defines for LSAaggregate offest link, removed opaque defs +01l,29may03,dsk definitions for prioritized hello processing, for + link availability PDU processing, + definitions for task creation via vxWorks instead of rwos + definitions for prefixes and multiple prefixes per link +01k,07mar03,dsk hash table indexes defined as enum +01j,18feb03,dsk byte_order changes (store in host byte order) +01i,18feb03,dsk ported from OSPFv2 to OSPFv3 structures +01h,24jan03,htm added OSPFV3_ADDR6_ALLSPF,OSPFV3_ADDR6_ALLDR +01g,23jan03,agi propogated SPR#78250 fix from OSPFv2 +01f,10jan03,agi propogated SPR#85432, 83418 fixes from OSPFv2 + changed definition of BIT_FIELD_16 from int to unsigned short +01e,09jan03,agi added BIT_FIELD_8, BIT_FIELD_16 and BIT_FIELD_32 +01d,06jan03,hme added new constants for OSPFv3 External Flag +01c,18dec02,agi corrected value of OSPFV3_VERSION from 2 to 3 +01b,14nov02,agi first pass at clean-up +01a,23oct02,agi written +*/ + +#ifndef __INCospfv3Constantsh +#define __INCospfv3Constantsh + +#ifdef __cplusplus +extern "C" { +#endif + +#define OSPFV3_LINK_AVAILABLE_PDU +#ifdef OSPFV3_LINK_AVAILABLE_PDU +/* number of link availability PDUs per second */ +#define OSPFV3_NUM_LINK_AVAIL_PDU_PER_SECOND 10 /* upto 60 per second, + as we can only get 60 ticks per second */ +#define OSPFV3_CLOCK_TICKS_PER_SECOND OSPFV3_NUM_LINK_AVAIL_PDU_PER_SECOND +#else +#define OSPFV3_CLOCK_TICKS_PER_SECOND 1 +#endif + +/* hello prioritized handling start */ +#define OSPFV3_BACKLOG_PDU_MAX 100 /* number of non-hello PDUs queued for handling */ +#define OSPFV3_BACKLOG_PDU_CONGESTION_THRESHOLD 40 /* number of non-hello PDUs queued beyond which + we are in congested mode and apply + surrogate hello treatment to prevent + timing out adjacencies */ +/* hello prioritized handling end */ + + +/* TODO: replace this with the define from RS*/ +#define OSPFV3_SIZE_OF_IPV6_ADDRESS 16 +#define OSPFV3_SIZE_OF_IPV6_ADDRESS_32BITWORDS 4 + +#define OSPFV3_OPTIONS_SIZE_BYTES 3 /* sizeof options field in OSPF PDUs */ +#define OSPFV3_PROTOCOL_ID_VALUE 89 +#define OSPFV3_VERSION 3 + +#define OSPFV3_REV "3.1" +#define OSPFV3_REV_TYPE "1" +#define OSPFV3_BUILD __DATE__ + +#if !defined (NUMBER_OF_IP_PORTS) + #define NUMBER_OF_IP_PORTS 16 +#endif /* NUMBER_OF_IP_PORTS */ + +#define MAXIMUM_IP_OPTION_LENGTH 40 /* Largest option field, bytes */ +#define NO_SUCH_PORT 0xffff + +#if !defined (PRINT_BUFFER_SIZE) + #define PRINT_BUFFER_SIZE 150 +#endif /* PRINT_BUFFER_SIZE */ + + +#define RFC1745_EGP_ORIGEGP_ROUTE_TAG 0x9000 /* BGP routes reached via OSPF, ext adv originated by some other ASBR */ /* 4.3.2 RFC 1745 */ +#define RFC1745_IGP_TO_OSPFV3_ROUTE_TAG 0xc000 /* IGP dynamic routes etc. */ /* IGP, local_AS */ /* 4.3.4 RFC 1745 */ +#define RFC1745_EGP_ORIGIGP_ROUTE_TAG_PER_AS 0xd000 /* BGP routes with orig IGP, next_hop AS */ /* IGP, Local_AS, Next_hop_as */ /* 4.3.5 RFC 1745 DO not use for now */ +#define RFC1745_BGP_TO_OSPFV3_ROUTE_TAG 0xe000 /* BGP origin */ +#define OSPFV3_INTERNAL 0xffff + +#define NUMBER_OF_OSPFV3_PORTS NUMBER_OF_IP_PORTS +#define NUMBER_OF_OSPFV3_AREAS NUMBER_OF_IP_PORTS +#define NUMBER_OF_OSPFV3_AREA_ADDRESS_RANGES 16 + +#define OSPFV3_NUMBER_OF_INTERFACE_STATES 7 +#define OSPFV3_NUMBER_OF_INTERFACE_EVENTS 7 + +#define OSPFV3_NUMBER_OF_NEIGHBOR_STATES 8 +#define OSPFV3_NUMBER_OF_NEIGHBOR_EVENTS 13 + +#define OSPFV3_BACKBONE 0x00000000L + +#define OSPFV3_NBMA_DEFAULT_HELLO 30 +#define OSPFV3_BROADCAST_DEFAULT_HELLO 10 +#define OSPFV3_POINT_TO_POINT_DEFAULT_HELLO 30 +#define OSPFV3_VIRTUAL_DEFAULT_HELLO 60 + +/* LSDB hash constants */ +#define OSPFV3_HASH_TABLE_SIZE 512 +#define OSPFV3_HASH_MASK 511 + +/* Routing table hash constants */ +#define OSPFV3_RT_HASH_TABLE_SIZE 256 +#define OSPFV3_RT_HASH_MASK 255 + +#define OSPFV3_LSRefreshTime (1800) +#define OSPFV3_MinLSArrival ((ULONG) 0x00000001) +#define OSPFV3_MinLSInterval ((ULONG) 0x00000005) +#define OSPFV3_LSInfinity 0xFFFF/* was 0xFFFFFF +dsk:TODO: TBD metrics are either 3 bytes or 2 bytes depending on LSA types, +all must be comparable, so all of them should be short */ + +#define OSPFV3_AS_EXTERNAL_INFINITY 0x00FFFFFF + +#define NET_TO_HOST TRUE /* to be used as argument for ospfv3_byte_order_lsa */ +#define HOST_TO_NET FALSE /* to be used as argument for ospfv3_byte_order_lsa */ + +#define OSPFV3_EXTERNAL_LSA_QUEUE_PROCESS_INTERVAL 10 /* Routerware Inc. Specific */ + +#define OSPFV3_CheckAge (300) + +#define OSPFV3_MAXIMUM_AGE_DIFFERENCE ((USHORT) 900) +#define OSPFV3_MAXIMUM_AGE ((USHORT) 3600) + +#define OSPFV3_ALL_UP_NEIGHBORS 0x00000001 +#define OSPFV3_ALL_ELIGIBLE_NEIGHBORS 0x00000002 +#define OSPFV3_ALL_EXCHANGE_NEIGHBORS 0x00000003 +#define OSPFV3_DESIGNATED_ROUTER_AND_BACKUP_DESIGNATED_ROUTER 0x00000004 +#define OSPFV3_UNNUMBERED 0x00000005 +#define OSPFV3_ADDR_ALLSPF 0x00000006 +#define OSPFV3_ADDR_ALLDR 0x00000007 + + +/* AllSPFRouters, and AllDRRouters, as per RFC 2740, section A1, page 46, +in address string format and in in6_addr format (to avoid repetitive conversion) */ +#define OSPFV3_ADDR6_ALLSPF "FF02::5" +#define OSPFV3_ADDR6_ALLDR "FF02::6" +#define OSPFV3_ADDR6_ALLSPF_BYTES ospfv3_addr6_allspf /* "FF02::5" in in6_addr format */ +#define OSPFV3_ADDR6_ALLDR_BYTES ospfv3_addr6_alldr /* "FF02::6" in in6_addr format */ + + +/* TODO: determine what are the IPv6 equivalent addresses of multicast allspf and alldr, +their definitions in IPv4 was: ALL_SPF = bit 20 set, ALL_DR = bit 21 set: +#define OSPF_IF_MULTICAST_ALLSPF 0x100000 +#define OSPF_IF_MULTICAST_ALLDR 0x200000 +For now, define them same as the general ALLSPF and ALLDR IPv6 addresses + */ +#define OSPFV3_IF_MULTICAST_ALLSPF OSPFV3_ADDR6_ALLSPF /* Joined All SPF group */ +#define OSPFV3_IF_MULTICAST_ALLDR OSPFV3_ADDR6_ALLDR /* Joined All DR group */ +#define OSPFV3_IF_MULTICAST_ALLSPF_BYTES OSPFV3_ADDR6_ALLSPF_BYTES /* Joined All SPF group */ +#define OSPFV3_IF_MULTICAST_ALLDR_BYTES OSPFV3_ADDR6_ALLDR_BYTES /* Joined All DR group */ + +#define OSPFV3_IP_TTL_FOR_OSPFV3_PACKET 0x01 /* RFC 1583 Appendix A.1 */ +#define OSPFV3_IP_TTL_FOR_UNI_CAST_VLINK_OSPFV3_PACKET 0x80 /* VLINK: Virtual Link*/ + +#define OSPFV3_DefaultDestination 0x00000000L +#define OSPFV3_DefaultMask 0x00000000L + +#define OSPFV3_DEFAULT_TRANSMIT_DELAY 1 +#define OSPFV3_DEFAULT_COST 1 +#define OSPFV3_DEFAULT_ROUTER_DEAD_INTERVAL 40 +#define OSPFV3_DEFAULT_PRIORITY 1 +#define OSPFV3_DEFAULT_RETRANSMIT_INTERVAL 5 /* was 5 */ + +#define OSPFV3_DEFAULT_POLL_INTERVAL 120 + +#define OSPFV3_ACKNOWLEDGEMENT_INTERVAL 2 + +#define OSPFV3_ROUTING_TABLE_BUILD_INTERVAL 2 /* WAS 10 */ + +#define OSPFV3_MAXIMUM_PACKET_SIZE_FOR_VIRTUAL_LINK 512 /* does not include the IP header */ + +#define OSPFV3_PSEUDO_HEADER_SIZE 40 /* size of upper layer protocol IPv6 pseudo-header, + as per RFC 2740, page 49 and + as per RFC 2640 "IPv6 Specification", chapter 8.1 */ +#define OSPFV3_ID_SIZE ((ULONG) 4) /* size of an ID: router ID, interface ID, etc, in OSPFv2 = 4 bytes */ +#define OSPFV3_PACKET_SIZE ((ULONG) 16) /* sizeof OSPF packet header (RFC 2740, annex A.3.1, page 48) = 16 bytes */ +#define OSPFV3_HELLO_HEADER_SIZE ((ULONG) 20) /* sizeof OSPF hello packet between PDU header and variable list part = 20 bytes*/ +#define OSPFV3_DATABASE_HEADER_SIZE ((ULONG) 12)/* sizeof OSPF DD packet, between PDU header and variable list part = 12 bytes */ +#define OSPFV3_LS_HEADER_SIZE ((ULONG) 20) /* sizeof OSPF LSA header, RFC 2740, annex A.4.2, page 58 = 20 bytes */ +#define OSPFV3_LS_UPDATE_HEADER_SIZE ((ULONG) 4)/* sizeof OSPF LSU packet, between PDU header and variable list part = 4 bytes */ + +#define OSPFV3_ROUTER_LINK_ADVERTISEMENT_HEADER_SIZE ((ULONG) 24) +#define OSPFV3_NETWORK_LINK_ADVERTISEMENT_HEADER_SIZE ((ULONG) 24) +#define OSPFV3_SUMMARY_LINK_ADVERTISEMENT_HEADER_SIZE ((ULONG) 28) +#define OSPFV3_INTER_AREA_PREFIX_LSA_HEADER_SIZE ((ULONG) 44) +#define OSPFV3_INTER_AREA_PREFIX_LSA_FIXED_HEADER_SIZE ((ULONG) 28) +#define OSPFV3_INTER_AREA_ROUTER_LSA_HEADER_SIZE ((ULONG) 32) +#define OSPFV3_EXTERNAL_LINK_ADVERTISEMENT_FIXED_HEADER_SIZE ((ULONG) 28) +#define OSPFV3_EXTERNAL_LINK_ADVERTISEMENT_HEADER_SIZE ((ULONG) 68) +#define OSPFV3_LOCAL_LINK_ADVERTISEMENT_FIXED_HEADER_SIZE ((ULONG) 44) +#define OSPFV3_INTRA_AREA_LINK_ADVERTISEMENT_FIXED_HEADER_SIZE ((ULONG) 32) + +#define OSPFV3_DB_PIECE_SIZE ((ULONG) 20) +#define OSPFV3_LS_REQUESTED_ADVERTISEMENT_SIZE ((ULONG) 12) + +#define OSPFV3_ROUTER_LINK_PIECE_SIZE ((ULONG) 16) /* was 12 in OSPFv2 */ +#define OSPFV3_NETWORK_LINK_PIECE_SIZE ((ULONG) 4) + +#define OSPFV3_EXTERNAL_LINK_METRIC_PIECE_SIZE ((ULONG) 12) +#define OSPFV3_ROUTER_LINK_METRIC_PIECE_SIZE ((ULONG) 4) + +#define OSPFV3_HOST_NET_MASK 0xFFFFFFFFL +#define OSPFV3_HOST_NET_MASK_LENGTH 128 +#define OSPFV3_PREFIX_METRIC_MASK 0x0000FFFFL + +#define OSPFV3_ASE_bit_E 0x04000000 +#define OSPFV3_ASE_bit_F 0x02000000 +#define OSPFV3_ASE_bit_T 0x01000000 + +#define OSPFV3_NUMBER_OF_INLINE_COMPUTATIONS 8 +#define OSPFV3_MASK_FOR_UNEVEN_BITS (OSPFV3_NUMBER_OF_INLINE_COMPUTATIONS - 1) +#define OSPFV3_INLINED_SHIFT 3 +#define OSPFV3_FINAL_CHECKSUM_SHIFT 8 +#define OSPFV3_NUMBER_OF_ITERATIONS_BEFORE_MOD 4096 +#define OSPFV3_LOG2_OF_NUMBER_OF_ITERATIONS 12 +#define OSPFV3_MOD_MASK (OSPFV3_NUMBER_OF_ITERATIONS_BEFORE_MOD - 1) +#define OSPFV3_NUMBER_OF_INLINE_ITERATIONS (OSPFV3_NUMBER_OF_ITERATIONS_BEFORE_MOD/OSPFV3_NUMBER_OF_INLINE_COMPUTATIONS) +#define OSPFV3_MODULUS 255 + +/* masks for Options bits as defined in Annex A.2, RFC 2740 */ +#define OSPFV3_ENABLE_EXTERNAL_ROUTING 0x02 +#define OSPFV3_NOT_ENABLE_EXTERNAL_ROUTING 0x00 + +#define OSPFV3_STARTING_AREA_ID_FOR_VIRTUAL_INTERFACE 0xff000000 + + +#define OSPFV3_PRINTF_PACKET ospfv3_printf +#define OSPFV3_PRINTF_INTERFACE ospfv3_printf +#define OSPFV3_PRINTF_NEIGHBOR ospfv3_printf +#define OSPFV3_PRINTF_MEMORY ospfv3_printf +#define OSPFV3_PRINTF_DEBUG ospfv3_printf +#define OSPFV3_PRINTF_ROUTING_TABLE ospfv3_printf +#define OSPFV3_PRINTF_ALARM ospfv3_printf +#define OSPFV3_PRINTF_SNMP ospfv3_printf +#define OSPFV3_PRINTF_RTM ospfv3_printf +#define OSPFV3_PRINTF_DB_OVERFLOW ospfv3_printf +#define OSPFV3_PRINTF_PROLOGUE ospfv3_printf + + +/* TODO: obsolete rwos function convert_ip_address_to_dot_format not ported to IPv6 and dupplicated by router stack's inet_ntop */ + /* for printing 32 bit IDs in IPv4 dot format, use convert_ip_address_to_dot_format */ +#define OSPFV3_CONVERT_IP_ADDRESS_TO_DOT_FORMAT_FOR_DEBUG ospfv3_convert_ipv6_address_to_dot_format +#define OSPFV3_CONVERT_IP_ADDRESS_TO_DOT_FORMAT_FOR_ALARM ospfv3_convert_ipv6_address_to_dot_format +#define OSPFV3_CONVERT_IP_ADDRESS_TO_DOT_FORMAT_FOR_ROUTING_TABLE ospfv3_convert_ipv6_address_to_dot_format + +#define ROUTE_MATCH_WITH_ADDRESS_RANGE 1 +#define ROUTE_SUBSUMED_BY_ADDRESS_RANGE 2 +#define RANGE_STATUS_DO_NOT_ADVERTISE 3 + + +/* XXX - BIT_FIELD is now obsolete and should be removed */ +#define BIT_FIELD(enum_,enum_name) unsigned char + +#define BIT_FIELD_8(enum_,enum_name) unsigned char +#define BIT_FIELD_16(enum_,enum_name) unsigned short +#define BIT_FIELD_32(enum_,enum_name) unsigned int + + +#define MAXIMUM_IP_OPTION_LENGTH 40 /* Largest option field, bytes */ + +#define NUMBER_OF_IP_PORTS 16 /* Legacy Constant from old IP*/ +#define MAXIMUM_ETHERNET_DATA_SIZE 1500 /* Legacy Constant from old v8022str.h */ + +#define RTM_HANDLE ULONG + + + +#if (_BYTE_ORDER == _LITTLE_ENDIAN ) + #define ospfv3_min min +#else + #define ospfv3_min(arg1,arg2) (arg1 < arg2 ? arg1 : arg2) +#endif + +/*raw socket maximum receive ospf packet jkw*/ +#define MAX_BUFSIZE 8192 +/*raw socket end of change*/ + +/*RFC 1765*/ +#define OSPFV3_DEFAULT_EXTERNAL_LSDB_LIMIT -1; +#define OSPFV3_DEFAULT_EXIT_OVERFLOW_TIMER 0; + +#define OSPFV3_1K_BLOCKS 1024 + +#define OSPFV3_TIMER_TASK_STACK_SIZE (8 * OSPFV3_1K_BLOCKS) +#define OSPFV3_SPF_TASK_STACK_SIZE (10 * OSPFV3_1K_BLOCKS) +#define OSPFV3_INPUT_TASK_STACK_SIZE (12 * OSPFV3_1K_BLOCKS) +#define OSPFV3_RTM_TASK_STACK_SIZE (6 * OSPFV3_1K_BLOCKS) +#define OSPFV3_MAPI_TASK_STACK_SIZE (4 * OSPFV3_1K_BLOCKS) + +#define OSPFV3_TIMER_TASK_PRIORITY 100 +#define OSPFV3_SPF_TASK_PRIORITY 110 /* lower priority than timer task */ +#define OSPFV3_INPUT_TASK_PRIORITY 90 /* high priority, almost same as tNetTask (50), just drain socket, no processing */ +#define OSPFV3_RTM_TASK_PRIORITY 90 /* high priority, almost same as tNetTask (50), just drain socket, no processing */ +#define OSPFV3TOMAPI_TASK_PRIORITY 150 /* 150, lower priority, human speed not machine speed */ + +#define OSPFV3_AS_EXTERNAL_FLAG_T 0x01 +#define OSPFV3_AS_EXTERNAL_FLAG_F 0x02 +#define OSPFV3_AS_EXTERNAL_FLAG_E 0x04 + +#define OSPFV3_EXTERNAL_METRIC_TYPE_1 1 +#define OSPFV3_EXTERNAL_METRIC_TYPE_2 2 +#define OSPFV3_EXTERNAL_DEFAULT_METRIC 20 + +#define MAX_EXTERNAL_ROUTES_PROCESSED 250 + + /* used to be RWOS_MAXIMUM_FILE_SIZE */ +#ifdef INCLUDE_TMS_MODS +#define OSPFV3_MAXIMUM_FILE_SIZE 512 +#else +#define OSPFV3_MAXIMUM_FILE_SIZE 4000 +#endif /* INCLUDE_TMS_MODS */ + +/* maximum number of PDUs handled by SPF task + before we verify if SPF needs to be built */ +#define OSPFV3_MAX_NUM_PDUS_PROCESSED_ONCE 20 +#define OSPFV3_RT_PREFIX_BLOCK_SIZE 256 /* routing table prefix block size, + space for at least 15 prefixes per link, 4 + 20 bytes per uncompressed prefix */ +#define OSPFV3_RT_MAX_NUM_PREFIXES_PER_LINK 10 +#define OSPFV3_PREFIX_INFO_SIZE 4 /*1 byte prefix length, 1 byte prefix options, 2 bytes metric */ +#define OSPFV3_ANY_LINK_ID 0xFFFFFFFFL /* used for LSA link ID search, means any link ID */ + + +#define OSPFV3_LS_TYPE_MASK 0x00FF /* ushort mask to extract LSA type + excluding flooding scope bits from LSA type field */ + +#define OSPFV3_U_BIT_MASK 0x80 + +#define OSPFV3_AGGREGATE_LINKS_OFFSET 8 /* sizeof(OSPFV3_GENERIC_NODE) + This constant defines offset of "links_lsa_aggregate" field in + "OSPFV3_LS_DATABASE_ENTRY" structure */ + +/* OSPFv3 route weight in routing table */ +#define OSPFV3_ROUTE_WEIGHT 110 + +/* Raw & routing socket receive buffer size */ +#ifndef OSPFV3_RS_RCV_BUFFER +#define OSPFV3_RS_RCV_BUFFER (8 * 1024) +#endif + +#ifndef OSPFV3_RAW_RCV_BUFFER +#define OSPFV3_RAW_RCV_BUFFER (8 * 1024) +#endif + +/* OSPFv3 Performance enhancing code - not test/needed for early release*/ +#undef OSPFV3_LINK_AVAILABLE_PDU +#undef OSPFV3_PRIORITY_QUEUE_PROCESSING +#undef OSPFV3_SURROGATE_HELLO_ENABLED + +#define OSPFV3_CLEANUP_INTERVAL (30 * 60) /* 30 minutes*/ + + +#ifdef __cplusplus +} +#endif + + + + +#endif /* __INCospfv3Constantsh */ diff --git a/h/wrn/ospfv3/ospfv3Enums.h b/h/wrn/ospfv3/ospfv3Enums.h new file mode 100644 index 0000000..cf5a717 --- /dev/null +++ b/h/wrn/ospfv3/ospfv3Enums.h @@ -0,0 +1,367 @@ +/* ospfv3Enums.h - OSPFv3 enums header file */ + +/* Copyright 2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01j,21oct03,ram Modifications for adjacency establishment +01i,10oct03,ram Modifications for LSDB, dynamic config, & NSSA cleanup +01h,25sep03,ram Second general modifications submission +01g,29may03,dsk add enums for ospf task names (used as index in ospf tasks array) and + enum of task states for task synchronization at initialization +01f,07mar03,dsk NSSA hash table moved to area structure from main ospf structure +01e,18feb03,dsk ported from OSPFv2 to OSPFv3 structures +01d,06Jan03,hme deleted some OSPFv2 specific data structures and added new data structures for OSPFv3 +01c,23dec02,agi propogated TMS code merge for SPR#84284 +01b,14nov02,agi first pass at clean-up +01a,23oct02,agi written +*/ + +#ifndef __INCospfv3Enumsh +#define __INCospfv3Enumsh + +#ifdef __cplusplus +extern "C" { +#endif + +enum OSPFV3_RETURN_FLAGS +{ + OSPFV3_NO_PROBLEM = 0x0, + OSPFV3_NO_BUFFERS = 0x1, + OSPFV3_BAD_REQUEST = 0x2 +}; + +enum OSPFV3_UNION_PACKET_TYPES +{ + OSPFV3_HELLO_PACKET = 0x01, + OSPFV3_DATABASE_DESCRIPTION_PACKET = 0x02, + OSPFV3_LINK_STATE_REQUEST_PACKET = 0x03, + OSPFV3_LINK_STATE_UPDATE_PACKET = 0x04, + OSPFV3_LINK_STATE_ACKNOWLEDGEMENT_PACKET = 0x05 +}; + +enum OSPFV3_PACKET_STATE +{ + GOOD_RECEIVE = 0x00, + OSPFV3_ERROR_ACKNOWLEDGEMENT_BAD = 0x01, + OSPFV3_ERROR_ACKNOWLEDGEMENT_DUPLICATE = 0x02, + OSPFV3_ERROR_ACKNOWLEDGEMENT_STATE = 0x03, + OSPFV3_ERROR_ACKNOWLEDGEMENT_TYPE = 0x04, + OSPFV3_ERROR_DATABASE_DESCRIPTION_E_BIT = 0x05, + OSPFV3_ERROR_DATABASE_DESCRIPTION_ROUTER_ID = 0x06, + OSPFV3_ERROR_DATABASE_DESCRIPTION_STATE = 0x07, + OSPFV3_ERROR_DATABASE_DESCRIPTION_TYPE = 0x08, + OSPFV3_ERROR_HELLO_E_BIT = 0x09, + OSPFV3_ERROR_HELLO_ID = 0x0a, + OSPFV3_ERROR_HELLO_MASK = 0x0b, + OSPFV3_ERROR_HELLO_ROUTER_DEAD_INTERVAL = 0x0c, + OSPFV3_ERROR_HELLO_TIMER = 0x0d, + OSPFV3_ERROR_HELLO_VIRTUAL = 0x0e, + OSPFV3_ERROR_OSPFV3_AUTHENTICATION_KEY = 0x0f, + OSPFV3_ERROR_OSPFV3_AUTHENTICATION_TYPE = 0x10, + OSPFV3_ERROR_OSPFV3_INTERFACE_DOWN = 0x11, + OSPFV3_ERROR_OSPFV3_PACKET_TYPE = 0x12, + OSPFV3_ERROR_REQUEST_BOGUS = 0x13, + OSPFV3_ERROR_REQUEST_EMPTY = 0x14, + OSPFV3_ERROR_UPDATE_STATE = 0x15, + STOP_PROCESSING_PACKET = 0x16, + /* nssa bit */ + OSPFV3_ERROR_HELLO_N_BIT = 0x17, + OSPFV3_ERROR_DATABASE_DESCRIPTION_N_BIT = 0x18, + /*opaque lsa error option jkw*/ + OSPFV3_ERROR_OPAQUE_OPTION = 0x19, + OSPFV3_ERROR_DATABASE_DESCRIPTION_MTU_MISMATCH = 0x1a + +}; + +enum OSPFV3_NEIGHBOR_EVENT +{ + OSPFV3_HELLO_RECEIVED = 0x0000, + OSPFV3_START = 0x01, + OSPFV3_TWO_WAY_RECEIVED = 0x02, + OSPFV3_NEGOTIATION_DONE = 0x03, + OSPFV3_EXCHANGE_DONE = 0x04, + OSPFV3_BAD_LINK_STATE_REQUEST = 0x05, + OSPFV3_LOADING_DONE = 0x06, + OSPFV3_ADJACENCY_OK = 0x07, + OSPFV3_SEQUENCE_NUMBER_MISMATCH = 0x08, + OSPFV3_ONE_WAY = 0x09, + OSPFV3_KILL_NEIGHBOR = 0x0a, + OSPFV3_INACTIVITY_TIMER = 0x0b, + OSPFV3_DOWN_INDICATION_FROM_LOWER_LEVEL_PROTOCOLS_RECEIVED = 0x0c +}; + +enum OSPFV3_NEIGHBOR_MODE +{ + OSPFV3_CLEAR_MODE = 0x00, + OSPFV3_SLAVE = 0x01, + OSPFV3_MASTER = 0x02, + OSPFV3_SLAVE_HOLD = 0x04 /* holding the last database summary delay */ +}; + +enum OSPFV3_NEIGHBOR_STATE +{ + OSPFV3_NEIGHBOR_DOWN = 0x00, + OSPFV3_NEIGHBOR_ATTEMPT = 0x01, + OSPFV3_NEIGHBOR_INITIALIZING = 0x02, + OSPFV3_NEIGHBOR_2_WAY = 0x03, + OSPFV3_NEIGHBOR_EXCHANGE_START = 0x04, + OSPFV3_NEIGHBOR_EXCHANGE = 0x05, + OSPFV3_NEIGHBOR_LOADING = 0x06, + OSPFV3_NEIGHBOR_FULL = 0x07 +}; + +enum OSPFV3_INTERFACE_EVENT +{ + OSPFV3_INTERFACE_UP = 0x00, + OSPFV3_WAIT_TIMER = 0x01, + OSPFV3_BACKUP_SEEN = 0x02, + OSPFV3_NEIGHBOR_CHANGE = 0x03, + OSPFV3_LOOP_INDICATION = 0x04, + OSPFV3_UNLOOP_INDICATION = 0x05, + OSPFV3_INTERFACE_DOWN = 0x06 +}; + +enum OSPFV3_INTERFACE_STATE +{ + OSPFV3_INTERFACE_IS_DOWN = 0x00, + OSPFV3_INTERFACE_LOOPBACK = 0x01, + OSPFV3_INTERFACE_WAITING = 0x02, + OSPFV3_INTERFACE_POINT_TO_POINT = 0x03, + OSPFV3_INTERFACE_DESIGNATED_ROUTER_OTHER = 0x04, + OSPFV3_INTERFACE_BACKUP_DESIGNATED_ROUTER = 0x05, + OSPFV3_INTERFACE_DESIGNATED_ROUTER = 0x06 +}; + +enum OSPFV3_INTERFACE_TYPE +{ + OSPFV3_POINT_TO_POINT = 0x01, + OSPFV3_BROADCAST = 0x02, + OSPFV3_NBMA = 0x03, + OSPFV3_POINT_TO_MULTIPOINT = 0x04, + OSPFV3_VIRTUAL_LINK = 0x05 +}; + +enum OSPFV3_SEQUENCE_STATE +{ + OSPFV3_NORMAL = 0x00, + OSPFV3_WAITING_FOR_MAXIMUM_SEQUENCE_INSTANCE_TO_BE_FLUSHED = 0x01, + OSPFV3_DONE_FLUSHING_MAXIMUM_SEQUENCE_INSTANCE = 0x02 +}; + + +/* Link State Types */ + +enum OSPFV3_LS_FLOODING_SCOPE +{ + OSPFV3_LINK_LOCAL_FLOOD = 0x00, + OSPFV3_AREA_FLOOD = 0x20, + OSPFV3_AS_FLOOD = 0x40, + OSPFV3_RESERVERD_FLOOD = 0x60, + OSPFV3_UBIT_ON_LINK_LOCAL_FLOOD = 0x80, + OSPFV3_UBIT_ON_AREA_FLOOD = 0xA0, + OSPFV3_UBIT_ON_AS_FLOOD = 0xC0, + OSPFV3_UBIT_ON_RESERVERD_FLOOD = 0xE0 +}; + +enum OSPFV3_LS_TYPE + { + OSPFV3_LS_UNKNOWN = 0x00, + OSPFV3_LS_ROUTER = 0x01, + OSPFV3_LS_NETWORK = 0x02, + OSPFV3_LS_INTER_AREA_PREFIX = 0x03, + OSPFV3_LS_INTER_AREA_ROUTER = 0x04, + OSPFV3_LS_AS_EXTERNAL = 0x05, + OSPFV3_LS_GROUP_MEMBERSHIP = 0x06, + OSPFV3_LS_UNUSED = 0x07, + OSPFV3_LS_LINK = 0x08, + OSPFV3_LS_INTRA_AREA_PREFIX = 0x09, + OSPFV3_LS_MAX = 0x0a +}; + +/* Use these indexes for hashes of LSAs instead of LSA type, to +avoid holes in the hash table, as an empty hash with 256 bins occupies 256 * 8 = 2K memory */ +typedef enum OSPFV3_INTERFACE_LSA_HASH +{ + OSPFV3_INTERFACE_UNKNOWN_LSA_HASH = 0x00, + OSPFV3_LINK_LSA_HASH = 0x01, + OSPFV3_NUM_INTERFACE_LSA_HASHES = 0x02 +} OSPFV3_INTERFACE_LSA_HASH; + +/* Use these indexes for hashes of LSAs instead of LSA type, to +avoid holes in the hash table, as an empty hash with 256 bins occupies 256 * 8 = 2K memory */ +typedef enum OSPFV3_AREA_LSA_HASH +{ + OSPFV3_AREA_UNKNOWN_LSA_HASH = 0x00, + OSPFV3_ROUTER_LSA_HASH = OSPFV3_LS_ROUTER, + OSPFV3_NETWORK_LSA_HASH = OSPFV3_LS_NETWORK, + OSPFV3_INTER_AREA_PREFIX_LSA_HASH = OSPFV3_LS_INTER_AREA_PREFIX, + OSPFV3_INTER_AREA_ROUTER_LSA_HASH = OSPFV3_LS_INTER_AREA_ROUTER, + OSPFV3_INTRA_AREA_PREFIX_LSA_HASH = 0x05, + OSPFV3_NUM_AREA_LSA_HASHES = 0x06 + +} OSPFV3_AREA_LSA_HASH; + +/* Use these indexes for hashes of LSAs instead of LSA type, to +avoid holes in the hash table, as an empty hash with 256 bins occupies 256 * 8 = 2K memory */ +typedef enum OSPFV3_AS_LSA_HASH +{ + OSPFV3_AS_UNKNOWN_LSA_HASH = 0x00, + OSPFV3_EXTERNAL_LSA_HASH = 0x01, + OSPFV3_NUM_AS_LSA_HASHES = 0x02 +} OSPFV3_AS_LSA_HASH; + +typedef enum OSPFV3_LSA_REQUEST_INDEX +{ + OSPFV3_ROUTER_LSA_REQUEST_INDEX = 0x00, + OSPFV3_NETWORK_LSA_REQUEST_INDEX = 0x01, + OSPFV3_INTER_AREA_PREFIX_LSA_REQUEST_INDEX = 0x02, + OSPFV3_INTER_AREA_ROUTER_LSA_REQUEST_INDEX = 0x03, + OSPFV3_INTRA_AREA_PREFIX_LSA_REQUEST_INDEX = 0x04, + OSPFV3_EXTERNAL_LSA_REQUEST_INDEX = 0x05, + OSPFV3_LINK_LSA_REQUEST_INDEX = 0x06, + OSPFV3_LINK_SCOPE_UNKNOWN_LSA_INDEX = 0x07, + OSPFV3_AREA_SCOPE_UNKNOWN_LSA_INDEX = 0x08, + OSPFV3_AS_SCOPE_UNKNOWN_LSA_INDEX = 0x09, + OSPFV3_NUM_LSA_REQUEST_INDEX = 0x0A + +} OSPFV3_LSA_REQUEST_INDEX; + + +enum OSPFV3_ROUTER_LINK_TYPE +{ + OSPFV3_ROUTER_LINK_TYPE_PPP = 0x1, + OSPFV3_ROUTER_LINK_TYPE_TRANSIT_NETWORK = 0x2, + OSPFV3_ROUTER_LINK_TYPE_RESERVED = 0x3, + OSPFV3_ROUTER_LINK_TYPE_VIRTUAL = 0x4 +}; + + +enum OSPFV3_ACKNOWLEDGEMENT_RETURN_TYPE +{ + OSPFV3_NO_ACKNOWLEDGEMENTS_LEFT = 0x00, + OSPFV3_ACKNOWLEDGEMENTS_LEFT = 0x01 +}; + +enum OSPFV3_ROUTING_TABLE_UPDATE_ACTION +{ + OSPFV3_NO_ACTION = 0x00, + OSPFV3_REPLACE_PATH = 0x01, + OSPFV3_ADD_PATH = 0x02, + OSPFV3_DELETE_PATH = 0x03 /* RTM ### changes */ +}; + +enum OSPFV3_ROUTE_STATUS +{ + /* No new data under a routing table node or next_hop_block */ + OSPFV3_ROUTE_IS_NOT_NEW = 0x00, + /* + * New data under a routing table node or next_hop_block. + * can be a new next hop block under a routing table node or a new routing table node. + * or an old next hop block is not available any more. + */ + OSPFV3_ROUTE_IS_NEW = 0x01, + /* + * This routing table node or next block is no longer available + */ + OSPFV3_ROUTE_IS_NOT_AVAILABLE_NOW = 0x02, + /* + * doesn't matter + */ + OSPFV3_ROUTE_STATUS_DONT_CARE = 0x03 +}; + +typedef enum OSPFV3_ROUTE_DESTINATION_TYPE +{ + OSPFV3_DESTINATION_TYPE_NETWORK = 0x00, + OSPFV3_DESTINATION_TYPE_ASBR = 0x01, /* autonomous system border router */ + OSPFV3_DESTINATION_TYPE_ABR = 0x02, /* area border router */ + OSPFV3_DESTINATION_TYPE_VIRTUAL = 0x03, + OSPFV3_DESTINATION_TYPE_ASE = 0x04, /* external to the autonomous system */ + OSPFV3_DESTINATION_TYPE_ROUTER = 0x05, /* intra-area router */ + /* generic, any type of routing table entry */ + OSPFV3_DESTINATION_TYPE_WILDCARD = 0xFF +} OSPFV3_ROUTE_DESTINATION_TYPE; + +enum OSPFV3_ROUTE_PATH_TYPE +{ + OSPFV3_ROUTE_PATH_TYPE_INTRA = 0x00, + OSPFV3_ROUTE_PATH_TYPE_INTER = 0x01, + OSPFV3_ROUTE_PATH_TYPE_1_EXTERNAL = 0x02, + OSPFV3_ROUTE_PATH_TYPE_2_EXTERNAL = 0x03, + OSPFV3_ROUTE_PATH_TYPE_WILDCARD = 0xFF +}; + +enum OSPFV3_COUNTER_ACTION_TYPE +{ + OSPFV3_INCREMENT_COUNTERS = 0x0, + OSPFV3_DECREMENT_COUNTERS = 0x1 +}; + +enum OSPFV3_PRINTF_GROUPS +{ + OSPFV3_INTERFACE_PRINTF = 0x0, + OSPFV3_NEIGHBOR_PRINTF = 0x1, + OSPFV3_MEMORY_PRINTF = 0x2, + OSPFV3_ALARM_PRINTF = 0x3, + OSPFV3_SNMP_PRINTF = 0x4, + OSPFV3_PACKET_PRINTF = 0x5, + OSPFV3_ROUTING_TABLE_PRINTF = 0x6, + OSPFV3_DEBUG_PRINTF = 0x7, + OSPFV3_RTM_PRINTF = 0x08, + OSPFV3_PATRICIA_DEBUG_PRINTF = 0x09, + OSPFV3_DB_OVERFLOW_PRINTF = 0x0A, + OSPFV3_SEARCH_PRINTF = 0x0B, + OSPFV3_PROLOGUE_PRINTF = 0x0C +}; + +enum OSPFV3_SEARCH_TYPE +{ + OSPFV3_SEARCH_LSA_TYPE = 0x01, + OSPFV3_SEARCH_LSA_ID = 0x02, + OSPFV3_SEARCH_ADVERTISING_ROUTER = 0x03 +}; + + +enum OSPFV3_MODE +{ + PASSIVE = 0x00, + ACTIVE = 0x01 +}; + +typedef signed long seq_t; /* signed 32 bit number */ + +typedef enum +{ + OSPFINVALDLSSEQ = 0x80000000L, /* Invalid LS sequence number (reserved or unused) */ + OSPFINITLSSEQ = 0x80000001L, /* Initial LS Sequence value */ + OSPFMAXLSSEQ = 0x7fffffffL, /* Maximum LS Sequence value */ + OSPFLSINVALID = 0x80000000L /* Invalid LS Sequence value */ +} SEQNO_T; + +typedef enum +{ + OSPFV3_TASK_STATE_NOT_CREATED = 0x00, + OSPFV3_TASK_STATE_CREATED, + OSPFV3_TASK_STATE_INIT_COMPLETE, + OSPFV3_TASK_STATE_RUNNING, + OSPFV3_TASK_STATE_ERROR +} OSPFV3_TASK_STATES; + +typedef enum +{ + OSPFV3_TASK_TIMER, + OSPFV3_TASK_SPF, + OSPFV3_TASK_INPUT, + OSPFV3_TASK_RTM, + OSPFV3_TASK_MAPI, + OSPFV3_NUM_TASKS +} OSPFV3_TASKS; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCospfv3Enumsh */ diff --git a/h/wrn/ospfv3/ospfv3EnvoySnmpApi.h b/h/wrn/ospfv3/ospfv3EnvoySnmpApi.h new file mode 100644 index 0000000..35b1b0e --- /dev/null +++ b/h/wrn/ospfv3/ospfv3EnvoySnmpApi.h @@ -0,0 +1,170 @@ +/* ospfv3EnvoySnmpApi.h */ + +/* Copyright 2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01c,07apr04,ram OSPF v2/v3 coexistance compile +01b,30sep03,ram Fix for linker error +01a,12nov02,xli Initial file creation. +*/ + +/* +DESCRIPTION + +This file contains the definitions for constants, data structures and function prototypes +that can be used by the application that need to integrate Envoy SNMP to Manamgenet +Interface implemented the Neutral MIB API +*/ + + +#ifndef __INCospfv3EnvoySnmpApi_h +#define __INCospfv3EnvoySnmpApi_h + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* OSPFv3-Envoy debug macro. */ +#undef ospfv3EnvoyDbgEnabled +#ifdef ospfv3EnvoyDbgEnabled +#define ospfv3EnvoyPrintf( _x ) { printf _x; } +#else +#define ospfv3EnvoyPrintf( _x ) +#endif + +/* OSPFv3 specific MIB API application defined error */ +#define OSPFV3_MAPI_INVALID_INSTANCE 1000 + +/* envoyOspfv3Request_t structure is data structure that is necessary to manipulate the + * envoy snmp varbinds and the mApiRequest_t data structure. The pValueBuf is a + * pointer to an array of ulong_t. The size of array must be large enough to + * accomodate the getproc, nextproc, testproc, setproc and undoproc requests for + * retrieving all objects from a tabular row in multiple varbinds.. Envoy snmp will + * serialize all the transactions, subsequent getproc, nextproc, testproc, setproc + * and/or undoproc will not be called until the current one is completed. Therefore, + * the pValueBuf pointer can be reused each time a new getproc, nextproc, testproc, + * setproc and/or undoproc is started. The pOctetBuf is a pointer to buffer allocated + * specifically for octet string. For getproc and nextproc, the memory pointed to by the + * pOctetBuf must be either statically or dynamically allocated and the boolean + * flag must be set to TRUE if memory is dynamically allocated. If dynamic memory + * allocation is used, Envoy snmp requires that the memory is allocated using + * SNMP_memory_alloc() and must be marked as dynamic when the getproc_got_string() is + * called so that Envoy SNMP will free the memory using SNMP_memory_free() when the + * packet gets encoded. For that reason, the pOctetBuf pointer can be reused for the next + * transaction after the getproc_got_string() is called. For testproc, setproc and/or + * undoproc, there is no restriction to how the memory must be allocated. However, the + * boolean flag must still be set accordingly. If SNMP_memory_alloc() is used + * to allocated the memory, application must free the memory using SNMP_memory_free() + * when the testproc, setproc and/or undoproc is completed (Envoy snmp will not free the + * memory in this case). + */ +typedef struct envoyOspfv3Request { + SEM_ID envoyBSem; /* binary semaphore for synchronization into Envoy */ + ulong_t *pValueBuf; /* pointer to array of ulong_t */ + ushort_t numValueBuf; /* number of valueBuf allocated */ + ushort_t bufUsedCnt; /* number of valueBuf used */ + char *pOctetBuf; /* pointer to buffer for octet string */ + ulong_t octetBufLen; /* sizeof data pointed to by pOctetBuf */ + BOOL dynamic; /* is pOctetBuf dynamically allocated? */ + mApiObject_t *pObjectList; /* pointer to array of MIB API objec info */ + ulong_t *pObjCookie; /* pointer to array of ulong_t for object cookie */ +} envoyOspfv3Request_t; + + +/* misc covertion routines */ + +void ospfv3_copy_oids( OIDC_T *best_inst, OIDC_T *tlist, int tcount ); + +IMPORT ushort_t ospfv3_mApi2EnvoyErrorGet( ushort_t mApiError ); + +/* prototype for adding/removing subtree to SNMP agent MIB tree */ + +STATUS ospfv3_envoy_snmpdTreeAdd( char *pTreeOidStr, + MIBNODE_T *pTreeAddr, + SEM_ID ospfv3_envoyBSem ); + +void ospfv3_envoy_snmpdTreeRemove( char *pTreeOidStr, + SEM_ID ospfv3_envoyBSem ); + +/* routine to build MAPI TEST/SET/UNDO request message */ + +IMPORT int ospfv3_envoy_buildSetReq( int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp, + envoyOspfv3Request_t *pEnvoyOspfv3Req, + mApiRequest_t *pRequest, + mApiReqType_t reqType, + int mApiOidOffset ); + +/* routine to mark a varbind (used by testproc, setproc and undoproc) */ +IMPORT void ospfv3_envoy_markVarbind( VB_T *vbp, + SNMP_PKT_T *pktp, + mApiRequest_t *pRequest, + mApiReqType_t reqType ); + +/* routine to build MAPI GET/GET NEXT request message */ + +IMPORT STATUS ospfv3_envoy_buildGetReq( int tcount, + OIDC_T *tlist, + VB_T *vbp, + envoyOspfv3Request_t *pEnvoyOspfv3Req, + mApiRequest_t *pRequest, + int mApiOidOffset ); + +/* routine to process MIB API GET/GET NEXT response */ + +IMPORT void ospfv3_envoy_processGetResp( VB_T *vbp, + SNMP_PKT_T *pktp, + envoyOspfv3Request_t *pEnvoyOspfv3Req, + mApiRequest_t *pRequest, + mApiReqType_t reqType, + int mApiOidOffset ); + +/* routine to process MIB API GET/GET NEXT response for scalar objects */ + +IMPORT void ospfv3_envoy_processScalarGetResp( VB_T *vbp, + SNMP_PKT_T *pktp, + envoyOspfv3Request_t *pEnvoyOspfv3Req, + mApiRequest_t *pRequest, + mApiReqType_t reqType, + int mApiOidOffset ); + +/* misc method routines related to this Envoy Management Facility */ + +IMPORT void ospfv3Envoy_undo( OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp ); +IMPORT void ospfv3_envoy_clearBuffer( envoyOspfv3Request_t *pEnvoyOspfv3Req ); + +IMPORT void ospfv3_envoy_mApiDestroy( envoyOspfv3Request_t *pEnvoyOspfv3Req ); + +IMPORT envoyOspfv3Request_t *ospfv3_envoy_mApiInit( int numBuf ); + +/* routines for setting snmp errors */ + +IMPORT void ospfv3_envoy_setGenError( SNMP_PKT_T *pktp, + VB_T *vbp, + mApiReqType_t reqType ); + +IMPORT void ospfv3_envoy_setNoSuchNameError( SNMP_PKT_T *pktp, + VB_T *vbp, + mApiReqType_t reqType ); + +IMPORT void ospfv3_envoy_processGetRespError( SNMP_PKT_T *pktp, + VB_T *vbp, + mApiReqType_t reqType, + int mApiErr ); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __INCospfv3EnvoySnmpApi_h */ diff --git a/h/wrn/ospfv3/ospfv3EnvoySnmpLeaf.h b/h/wrn/ospfv3/ospfv3EnvoySnmpLeaf.h new file mode 100644 index 0000000..7f533f0 --- /dev/null +++ b/h/wrn/ospfv3/ospfv3EnvoySnmpLeaf.h @@ -0,0 +1,383 @@ +/****************************************************************************** + ****************************************************************************** + **** This file was automatically generated by Epilogue Technology's + **** Emissary SNMP MIB Compiler, version 9.1. + **** This file was generated using the -leaf switch. + **** + **** This file #defines C preprocessor macros providing a variety of + **** information for the leaf objects in the MIB. + **** + **** The file includes a LEAF_xxx macro for each leaf object in the + **** MIB (xxx is replaced by the object's name). The value of the + **** LEAF_xxx macro is the final component of the object's object + **** identifier. + **** + **** If the object's SYNTAX clause included named INTEGER values, + **** then there is a VAL_xxx_yyy macro for each named value (xxx is + **** replaced by the object's name and yyy by the value's name). The + **** value of the VAL_xxx_yyy macro is the value associated with the + **** named value. + **** + **** If the object's SYNTAX clause specified a set of range limitations + **** for the value of the object, then there are one or more sets of + **** MIN_xxx and MAX_xxx macros specifying the lower and upper bound of + **** each range limitation. + **** + **** If the object's SYNTAX clause specified a set of size constraints + **** for the value of the object, then there are one or more sets of + **** MINSIZE_xxx and MAXSIZE_xxx macros specifying the lower and upper + **** bound of each size constraint. (If the size constraint is a single + **** value rather than a range then the MINSIZE_xxx and MAXSIZE_xxx + **** macros are replaced by a single SIZE_xxx macro.) + **** + **** DO NOT MODIFY THIS FILE BY HAND. + **** + **** Last build date: Thu Jan 30 16:24:53 2003 + **** from files: + **** ospfv3.mib.ctl, IANA-ADDRESS-FAMILY-NUMBERS-MIB.txt, iftype.mib, + **** rfc1907.mib, rfc2233.mib, rfc3291.txt, rfc1213.mib, rfc1850.txt, + **** ospfv3.mib + ****************************************************************************** + ****************************************************************************** + */ + +#define LEAF_ospfv3RouterId2 1 +#define LEAF_ospfv3AdminStat2 2 +#define VAL_ospfv3AdminStat2_enabled 1L +#define VAL_ospfv3AdminStat_disabled 2L +#define LEAF_ospfv3VersionNumber 3 +#define VAL_ospfv3VersionNumber_version3 3L +#define LEAF_ospfv3AreaBdrRtrStatus 4 +#define VAL_ospfv3AreaBdrRtrStatus_true 1L +#define VAL_ospfv3AreaBdrRtrStatus_false 2L +#define LEAF_ospfv3ASBdrRtrStatus 5 +#define VAL_ospfv3ASBdrRtrStatus_true 1L +#define VAL_ospfv3ASBdrRtrStatus_false 2L +#define LEAF_ospfv3AsScopeLsaCount 6 +#define LEAF_ospfv3AsScopeLsaCksumSum 7 +#define LEAF_ospfv3OriginateNewLsas 8 +#define LEAF_ospfv3RxNewLsas 9 +#define LEAF_ospfv3ExtAreaLsdbLimit 10 +#define MIN_ospfv3ExtAreaLsdbLimit -1L +#define MAX_ospfv3ExtAreaLsdbLimit 2147483647L +#define LEAF_ospfv3MulticastExtensions 11 +#define VAL_ospfv3MulticastExtensions_intraAreaMulticast 0L +#define VAL_ospfv3MulticastExtensions_interAreaMulticast 1L +#define VAL_ospfv3MulticastExtensions_interAsMulticast 2L +#define LEAF_ospfv3ExitOverflowInterval 12 +#define LEAF_ospfv3DemandExtensions 13 +#define VAL_ospfv3DemandExtensions_true 1L +#define VAL_ospfv3DemandExtensions_false 2L +#define LEAF_ospfv3TrafficEngineeringSupport 14 +#define VAL_ospfv3TrafficEngineeringSupport_true 1L +#define VAL_ospfv3TrafficEngineeringSupport_false 2L +#define LEAF_ospfv3AreaId 1 +#define LEAF_ospfv3ImportAsExtern 2 +#define VAL_ospfv3ImportAsExtern_importExternal 1L +#define VAL_ospfv3ImportAsExtern_importNoExternal 2L +#define VAL_ospfv3ImportAsExtern_importNssa 3L +#define LEAF_ospfv3SpfRuns 3 +#define LEAF_ospfv3AreaBdrRtrCount 4 +#define LEAF_ospfv3AsBdrRtrCount 5 +#define LEAF_ospfv3AreaScopeLsaCount 6 +#define LEAF_ospfv3AreaScopeLsaCksumSum 7 +#define LEAF_ospfv3AreaSummary 8 +#define VAL_ospfv3AreaSummary_noAreaSummary 1L +#define VAL_ospfv3AreaSummary_sendAreaSummary 2L +#define LEAF_ospfv3AreaStatus 9 +#define VAL_ospfv3AreaStatus_active 1L +#define VAL_ospfv3AreaStatus_notInService 2L +#define VAL_ospfv3AreaStatus_notReady 3L +#define VAL_ospfv3AreaStatus_createAndGo 4L +#define VAL_ospfv3AreaStatus_createAndWait 5L +#define VAL_ospfv3AreaStatus_destroy 6L +#define LEAF_ospfv3StubMetric 10 +#define MIN_ospfv3StubMetric 0L +#define MAX_ospfv3StubMetric 16777215L +#define LEAF_ospfv3AreaNssaTranslatorRole 11 +#define VAL_ospfv3AreaNssaTranslatorRole_always 1L +#define VAL_ospfv3AreaNssaTranslatorRole_candidate 2L +#define LEAF_ospfv3AreaNssaTranslatorState 12 +#define VAL_ospfv3AreaNssaTranslatorState_enabled 1L +#define VAL_ospfv3AreaNssaTranslatorState_elected 2L +#define VAL_ospfv3AreaNssaTranslatorState_disabled 3L +#define LEAF_ospfv3AreaNssaTranslatorStabilityInterval 13 +#define LEAF_ospfv3AreaNssaTranslatorEvents 14 +#define LEAF_ospfv3AsLsdbType 1 +#define VAL_ospfv3AsLsdbType_asExternalLink 16389L +#define LEAF_ospfv3AsLsdbRouterId 2 +#define LEAF_ospfv3AsLsdbLsid 3 +#define LEAF_ospfv3AsLsdbSequence 4 +#define LEAF_ospfv3AsLsdbAge 5 +#define LEAF_ospfv3AsLsdbChecksum 6 +#define LEAF_ospfv3AsLsdbAdvertisement 7 +#define MINSIZE_ospfv3AsLsdbAdvertisement 1L +#define MAXSIZE_ospfv3AsLsdbAdvertisement 65535L +#define LEAF_ospfv3AreaLsdbAreaId 1 +#define LEAF_ospfv3AreaLsdbType 2 +#define VAL_ospfv3AreaLsdbType_routerLsa 8193L +#define VAL_ospfv3AreaLsdbType_networkLsa 8194L +#define VAL_ospfv3AreaLsdbType_interAreaPrefixLsa 8195L +#define VAL_ospfv3AreaLsdbType_interAreaRouterLsa 8196L +#define VAL_ospfv3AreaLsdbType_groupMembershipLsa 8198L +#define VAL_ospfv3AreaLsdbType_nssaExternalLsa 8199L +#define VAL_ospfv3AreaLsdbType_intraAreaPrefixLsa 8201L +#define LEAF_ospfv3AreaLsdbRouterId 3 +#define LEAF_ospfv3AreaLsdbLsid 4 +#define LEAF_ospfv3AreaLsdbSequence 5 +#define LEAF_ospfv3AreaLsdbAge 6 +#define LEAF_ospfv3AreaLsdbChecksum 7 +#define LEAF_ospfv3AreaLsdbAdvertisement 8 +#define MINSIZE_ospfv3AreaLsdbAdvertisement 1L +#define MAXSIZE_ospfv3AreaLsdbAdvertisement 65535L +#define LEAF_ospfv3LinkLsdbIfIndex 1 +#define MIN_ospfv3LinkLsdbIfIndex 1L +#define MAX_ospfv3LinkLsdbIfIndex 2147483647L +#define LEAF_ospfv3LinkLsdbType 2 +#define VAL_ospfv3LinkLsdbType_linkLsa 8L +#define LEAF_ospfv3LinkLsdbRouterId 3 +#define LEAF_ospfv3LinkLsdbLsid 4 +#define LEAF_ospfv3LinkLsdbSequence 5 +#define LEAF_ospfv3LinkLsdbAge 6 +#define LEAF_ospfv3LinkLsdbChecksum 7 +#define LEAF_ospfv3LinkLsdbAdvertisement 8 +#define MINSIZE_ospfv3LinkLsdbAdvertisement 1L +#define MAXSIZE_ospfv3LinkLsdbAdvertisement 65535L +#define LEAF_ospfv3HostAddressType 1 +#define VAL_ospfv3HostAddressType_unknown 0L +#define VAL_ospfv3HostAddressType_ipv4 1L +#define VAL_ospfv3HostAddressType_ipv6 2L +#define VAL_ospfv3HostAddressType_ipv4z 3L +#define VAL_ospfv3HostAddressType_ipv6z 4L +#define VAL_ospfv3HostAddressType_dns 16L +#define LEAF_ospfv3HostAddress 2 +#define SIZE_ospfv3HostAddress 16L +#define LEAF_ospfv3HostMetric 3 +#define MIN_ospfv3HostMetric 0L +#define MAX_ospfv3HostMetric 65535L +#define LEAF_ospfv3HostStatus 4 +#define VAL_ospfv3HostStatus_active 1L +#define VAL_ospfv3HostStatus_notInService 2L +#define VAL_ospfv3HostStatus_notReady 3L +#define VAL_ospfv3HostStatus_createAndGo 4L +#define VAL_ospfv3HostStatus_createAndWait 5L +#define VAL_ospfv3HostStatus_destroy 6L +#define LEAF_ospfv3HostAreaID 5 +#define LEAF_ospfv3IfIndex 1 +#define MIN_ospfv3IfIndex 1L +#define MAX_ospfv3IfIndex 2147483647L +#define LEAF_ospfv3IfAreaId 2 +#define LEAF_ospfv3IfType 3 +#define VAL_ospfv3IfType_broadcast 1L +#define VAL_ospfv3IfType_nbma 2L +#define VAL_ospfv3IfType_pointToPoint 3L +#define VAL_ospfv3IfType_pointToMultipoint 5L +#define LEAF_ospfv3IfAdminStat 4 +#define VAL_ospfv3IfAdminStat_enabled 1L +#define VAL_ospfv3IfAdminStat_disabled 2L +#define LEAF_ospfv3IfRtrPriority 5 +#define MIN_ospfv3IfRtrPriority 0L +#define MAX_ospfv3IfRtrPriority 255L +#define LEAF_ospfv3IfTransitDelay 6 +#define MIN_ospfv3IfTransitDelay 0L +#define MAX_ospfv3IfTransitDelay 3600L +#define LEAF_ospfv3IfRetransInterval 7 +#define MIN_ospfv3IfRetransInterval 0L +#define MAX_ospfv3IfRetransInterval 3600L +#define LEAF_ospfv3IfHelloInterval 8 +#define MIN_ospfv3IfHelloInterval 1L +#define MAX_ospfv3IfHelloInterval 65535L +#define LEAF_ospfv3IfRtrDeadInterval 9 +#define LEAF_ospfv3IfPollInterval 10 +#define LEAF_ospfv3IfState 11 +#define VAL_ospfv3IfState_down 1L +#define VAL_ospfv3IfState_loopback 2L +#define VAL_ospfv3IfState_waiting 3L +#define VAL_ospfv3IfState_pointToPoint 4L +#define VAL_ospfv3IfState_designatedRouter 5L +#define VAL_ospfv3IfState_backupDesignatedRouter 6L +#define VAL_ospfv3IfState_otherDesignatedRouter 7L +#define LEAF_ospfv3IfDesignatedRouter 12 +#define LEAF_ospfv3IfBackupDesignatedRouter 14 +#define LEAF_ospfv3IfEvents 15 +#define LEAF_ospfv3IfStatus 17 +#define VAL_ospfv3IfStatus_active 1L +#define VAL_ospfv3IfStatus_notInService 2L +#define VAL_ospfv3IfStatus_notReady 3L +#define VAL_ospfv3IfStatus_createAndGo 4L +#define VAL_ospfv3IfStatus_createAndWait 5L +#define VAL_ospfv3IfStatus_destroy 6L +#define LEAF_ospfv3IfMulticastForwarding 18 +#define VAL_ospfv3IfMulticastForwarding_blocked 1L +#define VAL_ospfv3IfMulticastForwarding_multicast 2L +#define VAL_ospfv3IfMulticastForwarding_unicast 3L +#define LEAF_ospfv3IfDemand 19 +#define VAL_ospfv3IfDemand_true 1L +#define VAL_ospfv3IfDemand_false 2L +#define LEAF_ospfv3IfMetricValue 20 +#define MIN_ospfv3IfMetricValue 0L +#define MAX_ospfv3IfMetricValue 65535L +#define LEAF_ospfv3IfLinkScopeLsaCount 21 +#define LEAF_ospfv3IfLinkLsaCksumSum 22 +#define LEAF_ospfv3IfInstId 23 +#define LEAF_ospfv3VirtIfAreaId 1 +#define LEAF_ospfv3VirtIfNeighbor 2 +#define LEAF_ospfv3VirtIfIndex 3 +#define MIN_ospfv3VirtIfIndex 1L +#define MAX_ospfv3VirtIfIndex 2147483647L +#define LEAF_ospfv3VirtIfTransitDelay 4 +#define MIN_ospfv3VirtIfTransitDelay 0L +#define MAX_ospfv3VirtIfTransitDelay 3600L +#define LEAF_ospfv3VirtIfRetransInterval 5 +#define MIN_ospfv3VirtIfRetransInterval 0L +#define MAX_ospfv3VirtIfRetransInterval 3600L +#define LEAF_ospfv3VirtIfHelloInterval 6 +#define MIN_ospfv3VirtIfHelloInterval 1L +#define MAX_ospfv3VirtIfHelloInterval 65535L +#define LEAF_ospfv3VirtIfRtrDeadInterval 7 +#define LEAF_ospfv3VirtIfState 8 +#define VAL_ospfv3VirtIfState_down 1L +#define VAL_ospfv3VirtIfState_pointToPoint 4L +#define LEAF_ospfv3VirtIfEvents 9 +#define LEAF_ospfv3VirtIfStatus 10 +#define VAL_ospfv3VirtIfStatus_active 1L +#define VAL_ospfv3VirtIfStatus_notInService 2L +#define VAL_ospfv3VirtIfStatus_notReady 3L +#define VAL_ospfv3VirtIfStatus_createAndGo 4L +#define VAL_ospfv3VirtIfStatus_createAndWait 5L +#define VAL_ospfv3VirtIfStatus_destroy 6L +#define LEAF_ospfv3VirtIfLinkScopeLsaCount 11 +#define LEAF_ospfv3VirtIfLinkLsaCksumSum 12 +#define LEAF_ospfv3NbrIfIndex 1 +#define MIN_ospfv3NbrIfIndex 1L +#define MAX_ospfv3NbrIfIndex 2147483647L +#define LEAF_ospfv3NbrRtrId 2 +#define LEAF_ospfv3NbrAddressType 3 +#define VAL_ospfv3NbrAddressType_unknown 0L +#define VAL_ospfv3NbrAddressType_ipv4 1L +#define VAL_ospfv3NbrAddressType_ipv6 2L +#define VAL_ospfv3NbrAddressType_ipv4z 3L +#define VAL_ospfv3NbrAddressType_ipv6z 4L +#define VAL_ospfv3NbrAddressType_dns 16L +#define LEAF_ospfv3NbrAddress 4 +#define SIZE_ospfv3NbrAddress 16L +#define LEAF_ospfv3NbrOptions 5 +#define LEAF_ospfv3NbrPriority 6 +#define MIN_ospfv3NbrPriority 0L +#define MAX_ospfv3NbrPriority 255L +#define LEAF_ospfv3NbrState 7 +#define VAL_ospfv3NbrState_down 1L +#define VAL_ospfv3NbrState_attempt 2L +#define VAL_ospfv3NbrState_init 3L +#define VAL_ospfv3NbrState_twoWay 4L +#define VAL_ospfv3NbrState_exchangeStart 5L +#define VAL_ospfv3NbrState_exchange 6L +#define VAL_ospfv3NbrState_loading 7L +#define VAL_ospfv3NbrState_full 8L +#define LEAF_ospfv3NbrEvents 8 +#define LEAF_ospfv3NbrLsRetransQLen 9 +#define LEAF_ospfv3NbrHelloSuppressed 10 +#define VAL_ospfv3NbrHelloSuppressed_true 1L +#define VAL_ospfv3NbrHelloSuppressed_false 2L +#define LEAF_ospfv3NbrIfId 11 +#define MIN_ospfv3NbrIfId 1L +#define MAX_ospfv3NbrIfId 2147483647L +#define LEAF_ospfv3NbmaNbrIfIndex 1 +#define MIN_ospfv3NbmaNbrIfIndex 1L +#define MAX_ospfv3NbmaNbrIfIndex 2147483647L +#define LEAF_ospfv3NbmaNbrAddressType 2 +#define VAL_ospfv3NbmaNbrAddressType_unknown 0L +#define VAL_ospfv3NbmaNbrAddressType_ipv4 1L +#define VAL_ospfv3NbmaNbrAddressType_ipv6 2L +#define VAL_ospfv3NbmaNbrAddressType_ipv4z 3L +#define VAL_ospfv3NbmaNbrAddressType_ipv6z 4L +#define VAL_ospfv3NbmaNbrAddressType_dns 16L +#define LEAF_ospfv3NbmaNbrAddress 3 +#define SIZE_ospfv3NbmaNbrAddress 16L +#define LEAF_ospfv3NbmaNbrPriority 4 +#define MIN_ospfv3NbmaNbrPriority 0L +#define MAX_ospfv3NbmaNbrPriority 255L +#define LEAF_ospfv3NbmaNbrRtrId 5 +#define LEAF_ospfv3NbmaNbrState 6 +#define VAL_ospfv3NbmaNbrState_down 1L +#define VAL_ospfv3NbmaNbrState_attempt 2L +#define VAL_ospfv3NbmaNbrState_init 3L +#define VAL_ospfv3NbmaNbrState_twoWay 4L +#define VAL_ospfv3NbmaNbrState_exchangeStart 5L +#define VAL_ospfv3NbmaNbrState_exchange 6L +#define VAL_ospfv3NbmaNbrState_loading 7L +#define VAL_ospfv3NbmaNbrState_full 8L +#define LEAF_ospfv3NbmaNbrStorageType 7 +#define VAL_ospfv3NbmaNbrStorageType_other 1L +#define VAL_ospfv3NbmaNbrStorageType_volatile 2L +#define VAL_ospfv3NbmaNbrStorageType_nonVolatile 3L +#define VAL_ospfv3NbmaNbrStorageType_permanent 4L +#define VAL_ospfv3NbmaNbrStorageType_readOnly 5L +#define LEAF_ospfv3NbmaNbrStatus 8 +#define VAL_ospfv3NbmaNbrStatus_active 1L +#define VAL_ospfv3NbmaNbrStatus_notInService 2L +#define VAL_ospfv3NbmaNbrStatus_notReady 3L +#define VAL_ospfv3NbmaNbrStatus_createAndGo 4L +#define VAL_ospfv3NbmaNbrStatus_createAndWait 5L +#define VAL_ospfv3NbmaNbrStatus_destroy 6L +#define LEAF_ospfv3VirtNbrArea 1 +#define LEAF_ospfv3VirtNbrRtrId 2 +#define LEAF_ospfv3VirtNbrIfIndex 3 +#define MIN_ospfv3VirtNbrIfIndex 1L +#define MAX_ospfv3VirtNbrIfIndex 2147483647L +#define LEAF_ospfv3VirtNbrAddressType 4 +#define VAL_ospfv3VirtNbrAddressType_unknown 0L +#define VAL_ospfv3VirtNbrAddressType_ipv4 1L +#define VAL_ospfv3VirtNbrAddressType_ipv6 2L +#define VAL_ospfv3VirtNbrAddressType_ipv4z 3L +#define VAL_ospfv3VirtNbrAddressType_ipv6z 4L +#define VAL_ospfv3VirtNbrAddressType_dns 16L +#define LEAF_ospfv3VirtNbrAddress 5 +#define SIZE_ospfv3VirtNbrAddress 16L +#define LEAF_ospfv3VirtNbrOptions 6 +#define LEAF_ospfv3VirtNbrState 7 +#define VAL_ospfv3VirtNbrState_down 1L +#define VAL_ospfv3VirtNbrState_attempt 2L +#define VAL_ospfv3VirtNbrState_init 3L +#define VAL_ospfv3VirtNbrState_twoWay 4L +#define VAL_ospfv3VirtNbrState_exchangeStart 5L +#define VAL_ospfv3VirtNbrState_exchange 6L +#define VAL_ospfv3VirtNbrState_loading 7L +#define VAL_ospfv3VirtNbrState_full 8L +#define LEAF_ospfv3VirtNbrEvents 8 +#define LEAF_ospfv3VirtNbrLsRetransQLen 9 +#define LEAF_ospfv3VirtNbrHelloSuppressed 10 +#define VAL_ospfv3VirtNbrHelloSuppressed_true 1L +#define VAL_ospfv3VirtNbrHelloSuppressed_false 2L +#define LEAF_ospfv3VirtNbrIfId 11 +#define MIN_ospfv3VirtNbrIfId 1L +#define MAX_ospfv3VirtNbrIfId 2147483647L +#define LEAF_ospfv3AreaAggregateAreaID 1 +#define LEAF_ospfv3AreaAggregateAreaLsdbType 2 +#define VAL_ospfv3AreaAggregateAreaLsdbType_interAreaPrefixLsa 8195L +#define VAL_ospfv3AreaAggregateAreaLsdbType_nssaExternalLsa 8199L +#define LEAF_ospfv3AreaAggregatePrefixType 4 +#define VAL_ospfv3AreaAggregatePrefixType_unknown 0L +#define VAL_ospfv3AreaAggregatePrefixType_ipv4 1L +#define VAL_ospfv3AreaAggregatePrefixType_ipv6 2L +#define VAL_ospfv3AreaAggregatePrefixType_ipv4z 3L +#define VAL_ospfv3AreaAggregatePrefixType_ipv6z 4L +#define VAL_ospfv3AreaAggregatePrefixType_dns 16L +#define LEAF_ospfv3AreaAggregatePrefix 5 +#define MINSIZE_ospfv3AreaAggregatePrefix 0L +#define MAXSIZE_ospfv3AreaAggregatePrefix 16L +#define LEAF_ospfv3AreaAggregatePrefixLength 6 +#define MIN_ospfv3AreaAggregatePrefixLength 3L +#define MAX_ospfv3AreaAggregatePrefixLength 128L +#define LEAF_ospfv3AreaAggregateStatus 7 +#define VAL_ospfv3AreaAggregateStatus_active 1L +#define VAL_ospfv3AreaAggregateStatus_notInService 2L +#define VAL_ospfv3AreaAggregateStatus_notReady 3L +#define VAL_ospfv3AreaAggregateStatus_createAndGo 4L +#define VAL_ospfv3AreaAggregateStatus_createAndWait 5L +#define VAL_ospfv3AreaAggregateStatus_destroy 6L +#define LEAF_ospfv3AreaAggregateEffect 8 +#define VAL_ospfv3AreaAggregateEffect_advertiseMatching 1L +#define VAL_ospfv3AreaAggregateEffect_doNotAdvertiseMatching 2L +#define LEAF_snmpTrapOID 1 +#define LEAF_snmpTrapEnterprise 3 diff --git a/h/wrn/ospfv3/ospfv3EnvoySnmpSkel.h b/h/wrn/ospfv3/ospfv3EnvoySnmpSkel.h new file mode 100644 index 0000000..dd46ec8 --- /dev/null +++ b/h/wrn/ospfv3/ospfv3EnvoySnmpSkel.h @@ -0,0 +1,76 @@ +/****************************************************************************** + ****************************************************************************** + **** This file was automatically generated by Epilogue Technology's + **** Emissary SNMP MIB Compiler, version 9.1. + **** This file was generated using the -skel.h switch. + **** + **** This file contains declarations of stub functions to aid in building + **** the agent MIB interface. It declares all the MIB get, set, test and + **** next method routines that you will need to supply. You'll probably + **** want to FORCE-INCLUDE this file when using the -mib.c output mode. + **** + **** To generate the skeletal stub functions themselves, run Emissary + **** with the -skel switch. + **** + **** YOU MAY MODIFY THIS FILE BUT BEWARE ACCIDENTALLY OVERWRITING IT + **** BY REGENERATING IT WITH THE MIB COMPILER. + **** + **** Last build date: Tue Oct 16 11:22:24 2001 + **** from files: + **** rfc1213.mib, ft-ietf-ospf-ospfv3-mib-05 + ****************************************************************************** + ****************************************************************************** + */ + +void ospfv3GeneralGroup_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfv3GeneralGroup_set(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfv3GeneralGroup_test(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfv3GeneralGroup_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void null_test_async(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); + +void ospfv3AreaEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfv3AreaEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfv3AreaEntry_set(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfv3AreaEntry_test(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); + +void ospfv3AsLsdbEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfv3AsLsdbEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); + +void ospfv3AreaLsdbEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfv3AreaLsdbEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); + +void ospfv3LinkLsdbEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfv3LinkLsdbEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); + +void ospfv3HostEntry_get( OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfv3HostEntry_next( OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T* ); +void ospfv3HostEntry_test( OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfv3HostEntry_set( OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); + +void ospfv3IfEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfv3IfEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfv3IfEntry_set(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfv3IfEntry_test(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); + +void ospfv3VirtIfEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfv3VirtIfEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfv3VirtIfEntry_test(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfv3VirtIfEntry_set(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); + + +void ospfv3NbrEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfv3NbrEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); + +void ospfv3NbmaNbrEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfv3NbmaNbrEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfv3NbmaNbrEntry_test(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfv3NbmaNbrEntry_set(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); + +void ospfv3VirtNbrEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfv3VirtNbrEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); + +void ospfv3AreaAggregateEntry_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfv3AreaAggregateEntry_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfv3AreaAggregateEntry_test(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void ospfv3AreaAggregateEntry_set(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); + diff --git a/h/wrn/ospfv3/ospfv3EnvoySnmpWrnLeaf.h b/h/wrn/ospfv3/ospfv3EnvoySnmpWrnLeaf.h new file mode 100644 index 0000000..3158aa0 --- /dev/null +++ b/h/wrn/ospfv3/ospfv3EnvoySnmpWrnLeaf.h @@ -0,0 +1,53 @@ +/****************************************************************************** + ****************************************************************************** + **** This file was automatically generated by Epilogue Technology's + **** Emissary SNMP MIB Compiler, version 9.1. + **** This file was generated using the -leaf switch. + **** + **** This file #defines C preprocessor macros providing a variety of + **** information for the leaf objects in the MIB. + **** + **** The file includes a LEAF_xxx macro for each leaf object in the + **** MIB (xxx is replaced by the object's name). The value of the + **** LEAF_xxx macro is the final component of the object's object + **** identifier. + **** + **** If the object's SYNTAX clause included named INTEGER values, + **** then there is a VAL_xxx_yyy macro for each named value (xxx is + **** replaced by the object's name and yyy by the value's name). The + **** value of the VAL_xxx_yyy macro is the value associated with the + **** named value. + **** + **** If the object's SYNTAX clause specified a set of range limitations + **** for the value of the object, then there are one or more sets of + **** MIN_xxx and MAX_xxx macros specifying the lower and upper bound of + **** each range limitation. + **** + **** If the object's SYNTAX clause specified a set of size constraints + **** for the value of the object, then there are one or more sets of + **** MINSIZE_xxx and MAXSIZE_xxx macros specifying the lower and upper + **** bound of each size constraint. (If the size constraint is a single + **** value rather than a range then the MINSIZE_xxx and MAXSIZE_xxx + **** macros are replaced by a single SIZE_xxx macro.) + **** + **** DO NOT MODIFY THIS FILE BY HAND. + **** + **** Last build date: Tue Feb 05 13:33:29 2002 + **** from files: + **** rfc1213.mib, rfc1850.mi2, wrsMasterMib.mi2, wrnOspfv3.mi2, wrnOspfv3.ctl + ****************************************************************************** + ****************************************************************************** + */ + +#define LEAF_wrnOspfv3RedistributeDefaultRoutes 1 +#define VAL_wrnOspfv3RedistributeDefaultRoutes_true 1L +#define VAL_wrnOspfv3RedistributeDefaultRoutes_false 2L +#define LEAF_wrnOspfv3RedistributeStaticRoutes 2 +#define VAL_wrnOspfv3RedistributeStaticRoutes_true 1L +#define VAL_wrnOspfv3RedistributeStaticRoutes_false 2L +#define LEAF_wrnOspfv3RedistributeRIPRoutes 3 +#define VAL_wrnOspfv3RedistributeRIPRoutes_true 1L +#define VAL_wrnOspfv3RedistributeRIPRoutes_false 2L +#define LEAF_wrnOspfv3RedistributeBGPRoutes 4 +#define VAL_wrnOspfv3RedistributeBGPRoutes_true 1L +#define VAL_wrnOspfv3RedistributeBGPRoutes_false 2L diff --git a/h/wrn/ospfv3/ospfv3EnvoySnmpWrnSkel.h b/h/wrn/ospfv3/ospfv3EnvoySnmpWrnSkel.h new file mode 100644 index 0000000..e7dc080 --- /dev/null +++ b/h/wrn/ospfv3/ospfv3EnvoySnmpWrnSkel.h @@ -0,0 +1,28 @@ +/****************************************************************************** + ****************************************************************************** + **** This file was automatically generated by Epilogue Technology's + **** Emissary SNMP MIB Compiler, version 9.1. + **** This file was generated using the -skel.h switch. + **** + **** This file contains declarations of stub functions to aid in building + **** the agent MIB interface. It declares all the MIB get, set, test and + **** next method routines that you will need to supply. You'll probably + **** want to FORCE-INCLUDE this file when using the -mib.c output mode. + **** + **** To generate the skeletal stub functions themselves, run Emissary + **** with the -skel switch. + **** + **** YOU MAY MODIFY THIS FILE BUT BEWARE ACCIDENTALLY OVERWRITING IT + **** BY REGENERATING IT WITH THE MIB COMPILER. + **** + **** Last build date: Tue Oct 16 18:48:02 2001 + **** from files: + **** rfc1213.mib, rfc1850.mi2, wrsMasterMib.mi2, wrnOspfv3.mi2, wrnOspfv3.ctl + ****************************************************************************** + ****************************************************************************** + */ + +void wrnOspfv3GeneralGroup_get(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfv3GeneralGroup_set(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfv3GeneralGroup_test(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); +void wrnOspfv3GeneralGroup_next(OIDC_T, int, OIDC_T*, SNMP_PKT_T*, VB_T*); diff --git a/h/wrn/ospfv3/ospfv3Globals.h b/h/wrn/ospfv3/ospfv3Globals.h new file mode 100644 index 0000000..bf0842c --- /dev/null +++ b/h/wrn/ospfv3/ospfv3Globals.h @@ -0,0 +1,75 @@ +/* ospfv3Globals.h - OSPFv3 global variables header file */ + +/* Copyright 2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01n,08jun05,dsk changed declaration of global semaphores and global structures +01m,12apr04,ram Memory and AVL modifications +01l,08apr04,ram OSPF v2/v3 coexistance compile +01k,15mar04,dsk Mods according to OSPFv3 ANVL conformance testing +01j,17oct03,ram Modifications for memory corruption, traffic, & debug output +01i,25sep03,ram Second general modifications submission +01h,29jul03,ram Added sockets, processing, and external route changes +01g,29may03,dsk added definition for OSPF global semaphore to replace rwos + added definition of socket for route updates from OSPF to RS +01f,18feb03,dsk ported from OSPFv2 to OSPFv3 structures +01e,24jan03,htm removed unused OSPFV3_CALLBACK_IF, Ospfv3RegistrationInfo +01d,06jan02,agi removed unused variable ospfv3_ten_seconds_counter +01c,23dec02,agi propogated TMS code merge for SPR#84284 +01b,14nov02,agi first pass at clean-up +01a,23oct02,agi written +*/ + +#ifndef __INCospfv3Globalsh +#define __INCospfv3Globalsh + +#ifdef __cplusplus +extern "C" { +#endif + +typedef int (*FP_OSPFV3_RECEIVE) (register struct mbuf *message_block); + +typedef int (*FP_OSPFV3_SEND) (register struct mbuf *message_block); + +#if !defined (__OSPFV3_VIRTUAL_STACK__) + +/* the global variable "ospfv3" is defined in file ospfv3System.c */ +extern OSPFV3_CLASS ospfv3; +/* Initialize special OSPFv3 addresses as per RFC 2740, section A1, page 46: +AllSPFRouters = "FF02::5", AllDRRouters = "FF02::6" +*/ +extern struct in6_addr ospfv3_addr6_allspf; +extern struct in6_addr ospfv3_addr6_alldr; + +extern SEM_ID ospfv3_global_mutex; +/* SPR 85050 -- Begin */ +extern SEM_ID ospfv3_external_route_mutex; +/* SPR 85050 -- End */ + +int ospfv3RTPrototypeTaskId; + +char ospfv3_configuration_text[OSPFV3_MAXIMUM_FILE_SIZE + 1]; + +#if defined (__OSPFV3_FTP__) +char ospfv3_configuration_data[OSPFV3_MAXIMUM_FILE_SIZE + 1]; +#endif /*__OSPFV3_FTP__*/ + +BOOL ospfv3ReadStaticConfig; + +#endif /* __OSPFV3_VIRTUAL_STACK__ */ + +/*RFC 1765*/ +ULONG ospfv3_db_overflow_timer; + +extern OSPF_NVRAM_CLASS ospfv3_nvram; + +extern ULONG ospfv3MemPartId; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCospfv3Globalsh */ diff --git a/h/wrn/ospfv3/ospfv3Initialize.h b/h/wrn/ospfv3/ospfv3Initialize.h new file mode 100644 index 0000000..383789e --- /dev/null +++ b/h/wrn/ospfv3/ospfv3Initialize.h @@ -0,0 +1,36 @@ +/* ospfv3Lib.h - OSPFv3 library */ + +/* Copyright 2002-2003 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01l,05may04,dsk fix build issue with clarinet.h +01k,06apr04,ram OSPF v2/v3 coexistance changes +01j,23oct03,agi updated include file paths +01i,25sep03,ram Second general modifications submission +01h,30jun03,agi changed inlude file names +01g,29jul03,ram Added sockets, processing, and external route changes +01f,23jun03,agi added RWOS removal changes + updated copyright +01e,23jan03,htm added changes for IPv6 and some cleanup +01d,23dec02,agi removed include of ospfv3SearchUtils.h +01c,18dec02,agi corrected path to rtm.h +01b,14nov02,agi first pass at clean-up +01a,23oct02,agi written +*/ + +/* +DESCRIPTION + +Include this library to get all the necessary OSPFv3 header files. +*/ + +#ifndef __INCospfv3Initializeh +#define __INCospfv3Initializeh + +int ospfv3Initialize (void); + +#endif /* __INCospfv3Initializeh */ + diff --git a/h/wrn/ospfv3/ospfv3InterfaceStateMachine.h b/h/wrn/ospfv3/ospfv3InterfaceStateMachine.h new file mode 100644 index 0000000..0abedf5 --- /dev/null +++ b/h/wrn/ospfv3/ospfv3InterfaceStateMachine.h @@ -0,0 +1,176 @@ +/* ospfv3InterfaceStateMachine.h - OSPFv3 interface state machine header file */ + +/* Copyright 2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,23oct02,agi written +*/ + +#ifndef __INCospfv3InterfaceStateMachineh +#define __INCospfv3InterfaceStateMachineh + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*INTERFACE_TRANSITION_FUNCTION) + (OSPFV3_INTERFACE *sptr_interface); + +typedef struct OSPFV3_INTERFACE_STATE_MACHINE +{ + INTERFACE_TRANSITION_FUNCTION fptr_interface_transition_function; +} OSPFV3_INTERFACE_STATE_MACHINE; + + +OSPFV3_INTERFACE_STATE_MACHINE ospfv3_interface_event_processing_table + [OSPFV3_NUMBER_OF_INTERFACE_EVENTS][OSPFV3_NUMBER_OF_INTERFACE_STATES] = +{ +/* -------------------------------------------------------------------------- */ +/* OSPFV3_INTERFACE_UP 0 */ +/* -------------------------------------------------------------------------- */ +{ +/* OSPFV3_INTERFACE_IS_DOWN */ +{(INTERFACE_TRANSITION_FUNCTION) ospfv3_process_interface_up_event}, +/* OSPFV3_INTERFACE_LOOPBACK */ +{NULL}, +/* OSPFV3_INTERFACE_WAITING */ +{NULL}, +/* OSPFV3_INTERFACE_POINT_TO_POINT */ +{NULL}, +/* OSPFV3_INTERFACE_DESIGNATED_ROUTER_OTHER */ +{NULL}, +/* OSPFV3_INTERFACE_BACKUP_DESIGNATED_ROUTER */ +{NULL}, +/* OSPFV3_INTERFACE_DESIGNATED_ROUTER */ +{NULL} +}, + +/* -------------------------------------------------------------------------- */ +/* OSPFV3_WAIT_TIMER 1 */ +/* -------------------------------------------------------------------------- */ +{ +/* OSPFV3_INTERFACE_IS_DOWN */ +{NULL}, +/* OSPFV3_INTERFACE_LOOPBACK */ +{NULL}, +/* OSPFV3_INTERFACE_WAITING */ +{(INTERFACE_TRANSITION_FUNCTION) ospfv3_process_interface_wait_timer_event}, +/* OSPFV3_INTERFACE_POINT_TO_POINT */ +{(INTERFACE_TRANSITION_FUNCTION) ospfv3_process_interface_wait_timer_event}, +/* OSPFV3_INTERFACE_DESIGNATED_ROUTER_OTHER */ +{NULL}, +/* OSPFV3_INTERFACE_BACKUP_DESIGNATED_ROUTER */ +{NULL}, +/* OSPFV3_INTERFACE_DESIGNATED_ROUTER */ +{NULL} +}, + +/* -------------------------------------------------------------------------- */ +/* OSPFV3_BACKUP_SEEN 2 */ +/* -------------------------------------------------------------------------- */ +{ +/* OSPFV3_INTERFACE_IS_DOWN */ +{NULL}, +/* OSPFV3_INTERFACE_LOOPBACK */ +{NULL}, +/* OSPFV3_INTERFACE_WAITING */ +{(INTERFACE_TRANSITION_FUNCTION) ospfv3_process_interface_backup_seen_event}, +/* OSPFV3_INTERFACE_POINT_TO_POINT */ +{NULL}, +/* OSPFV3_INTERFACE_DESIGNATED_ROUTER_OTHER */ +{NULL}, +/* OSPFV3_INTERFACE_BACKUP_DESIGNATED_ROUTER */ +{NULL}, +/* OSPFV3_INTERFACE_DESIGNATED_ROUTER */ +{NULL} +}, + +/* -------------------------------------------------------------------------- */ +/* OSPFV3_NEIGHBOR_CHANGE 3 */ +/* -------------------------------------------------------------------------- */ +{ +/* OSPFV3_INTERFACE_IS_DOWN */ +{NULL}, +/* OSPFV3_INTERFACE_LOOPBACK */ +{NULL}, +/* OSPFV3_INTERFACE_WAITING */ +{NULL}, +/* OSPFV3_INTERFACE_POINT_TO_POINT */ +{NULL}, +/* OSPFV3_INTERFACE_DESIGNATED_ROUTER_OTHER */ +{(INTERFACE_TRANSITION_FUNCTION) ospfv3_process_interface_neighbor_change_event}, +/* OSPFV3_INTERFACE_BACKUP_DESIGNATED_ROUTER */ +{(INTERFACE_TRANSITION_FUNCTION) ospfv3_process_interface_neighbor_change_event}, +/* OSPFV3_INTERFACE_DESIGNATED_ROUTER */ +{(INTERFACE_TRANSITION_FUNCTION) ospfv3_process_interface_neighbor_change_event} +}, + +/* -------------------------------------------------------------------------- */ +/* OSPFV3_LOOP_INDICATION 4 */ +/* -------------------------------------------------------------------------- */ +{ +/* OSPFV3_INTERFACE_IS_DOWN */ +{(INTERFACE_TRANSITION_FUNCTION) ospfv3_process_interface_loop_indication_event}, +/* OSPFV3_INTERFACE_LOOPBACK */ +{(INTERFACE_TRANSITION_FUNCTION) ospfv3_process_interface_loop_indication_event}, +/* OSPFV3_INTERFACE_WAITING */ +{(INTERFACE_TRANSITION_FUNCTION) ospfv3_process_interface_loop_indication_event}, +/* OSPFV3_INTERFACE_POINT_TO_POINT */ +{(INTERFACE_TRANSITION_FUNCTION) ospfv3_process_interface_loop_indication_event}, +/* OSPFV3_INTERFACE_DESIGNATED_ROUTER_OTHER */ +{(INTERFACE_TRANSITION_FUNCTION) ospfv3_process_interface_loop_indication_event}, +/* OSPFV3_INTERFACE_BACKUP_DESIGNATED_ROUTER */ +{(INTERFACE_TRANSITION_FUNCTION) ospfv3_process_interface_loop_indication_event}, +/* OSPFV3_INTERFACE_DESIGNATED_ROUTER */ +{(INTERFACE_TRANSITION_FUNCTION) ospfv3_process_interface_loop_indication_event} +}, + +/* -------------------------------------------------------------------------- */ +/* OSPFV3_UNLOOP_INDICATION 5 */ +/* -------------------------------------------------------------------------- */ +{ +/* OSPFV3_INTERFACE_IS_DOWN */ +{NULL}, +/* OSPFV3_INTERFACE_LOOPBACK */ +{(INTERFACE_TRANSITION_FUNCTION) ospfv3_process_interface_unloop_indication_event}, +/* OSPFV3_INTERFACE_WAITING */ +{NULL}, +/* OSPFV3_INTERFACE_POINT_TO_POINT */ +{NULL}, +/* OSPFV3_INTERFACE_DESIGNATED_ROUTER_OTHER */ +{NULL}, +/* OSPFV3_INTERFACE_BACKUP_DESIGNATED_ROUTER */ +{NULL}, +/* OSPFV3_INTERFACE_DESIGNATED_ROUTER */ +{NULL} +}, + +/* -------------------------------------------------------------------------- */ +/* OSPFV3_INTERFACE_DOWN 6 */ +/* -------------------------------------------------------------------------- */ +{ +/* OSPFV3_INTERFACE_IS_DOWN */ +{NULL}, +/* OSPFV3_INTERFACE_LOOPBACK */ +{(INTERFACE_TRANSITION_FUNCTION) ospfv3_process_interface_down_event}, +/* OSPFV3_INTERFACE_WAITING */ +{(INTERFACE_TRANSITION_FUNCTION) ospfv3_process_interface_down_event}, +/* OSPFV3_INTERFACE_POINT_TO_POINT */ +{(INTERFACE_TRANSITION_FUNCTION) ospfv3_process_interface_down_event}, +/* OSPFV3_INTERFACE_DESIGNATED_ROUTER_OTHER */ +{(INTERFACE_TRANSITION_FUNCTION) ospfv3_process_interface_down_event}, +/* OSPFV3_INTERFACE_BACKUP_DESIGNATED_ROUTER */ +{(INTERFACE_TRANSITION_FUNCTION) ospfv3_process_interface_down_event}, +/* OSPFV3_INTERFACE_DESIGNATED_ROUTER */ +{(INTERFACE_TRANSITION_FUNCTION) ospfv3_process_interface_down_event} +} +}; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCospfv3InterfaceStateMachineh */ diff --git a/h/wrn/ospfv3/ospfv3IpStructures.h b/h/wrn/ospfv3/ospfv3IpStructures.h new file mode 100644 index 0000000..9261f24 --- /dev/null +++ b/h/wrn/ospfv3/ospfv3IpStructures.h @@ -0,0 +1,267 @@ +/* ospfv3IpStructures.h - OSPFv3 IP structures header file */ + +/* Copyright 2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01d,15mar04,dsk Mods according to OSPFv3 ANVL conformance testing +01c,05aug03,agi removed IP_PACKET structure + updated copyright +01b,14nov02,agi first pass at clean-up +01a,23oct02,agi written +*/ + +#ifndef __INCospfv3IpStructuresh +#define __INCospfv3IpStructuresh + +#ifdef __cplusplus +extern "C" { +#endif + +#if __DCC__ /* if using DIAB compiler */ +__packed__ enum IP_ROUTE_TYPE +#else +enum IP_ROUTE_TYPE +#endif +{ + OTHER_ROUTE_TYPE = 0x01, /* none of the following */ + INVALID_ROUTE_TYPE = 0x02, /* an invalidated route */ + DIRECT_ROUTE_TYPE = 0x03, /* route to directly connected (sub-)network */ + INDIRECT_ROUTE_TYPE = 0x04 /* route to a non-local host/(sub-)network */ +#if __DCC__ +}; +#else /* using GNU compiler */ +} _pack; +#endif + + +#if __DCC__ /* if using DIAB compiler */ +__packed__ enum IP_PROTOCOL_VALUE +#else +enum IP_PROTOCOL_VALUE +#endif +{ + RESERVED_PROTOCOL = 0, + ICMP_PROTOCOL = 1, + IGMP_PROTOCOL = 2, + VX_IP_PROTOCOL = 4, /* + * Original name IP_PROTOCOL changed due + * to variable name collision in + * rwutil.h- V2 version + */ + TCP_PROTOCOL = 6, + IGP_PROTOCOL = 9, + UDP_PROTOCOL = 17, + IDRP_PROTOCOL = 45, + RSVP_PROTOCOL = 46, + GRE_PROTOCOL = 47, + IPSEC_ESP_PROTOCOL = 50, + IPSEC_AH_PROTOCOL = 51, + IGRP_PROTOCOL = 88, + OSPF_PROTOCOL = 89, + IPIP_PROTOCOL = 94, + ETHERIP_PROTOCOL = 97 +#if __DCC__ +}; +#else /* using GNU compiler */ +} _pack; +#endif + + +#if __DCC__ /* if using DIAB compiler */ +__packed__ enum IP_ROUTE_PROTOCOL_TYPE +#else +enum IP_ROUTE_PROTOCOL_TYPE +#endif +{ + OTHER_ROUTING_PROTOCOL_TYPE = 0x01, + IP_ROUTING_PROTOCOL_TYPE = 0x01, /* + * IP_ROUTING_PROTOCOL_TYPE is + * intentionally defined as 1 + * as well + */ + LOCALLY_CONFIGURED_TYPE = 0x02, + NETWORK_MANAGEMENT_PROTOCOL_TYPE = 0x03, + ICMP_PROTOCOL_TYPE = 0x04, + EGP_PROTOCOL_TYPE = 0x05, + GGP_PROTOCOL_TYPE = 0x06, + HELLO_PROTOCOL_TYPE = 0x07, + RIP_PROTOCOL_TYPE = 0x08, + IS_IS_PROTOCOL_TYPE = 0x09, + ES_IS_PROTOCOL_TYPE = 0x0a, + CISCO_IGRP_TYPE = 0x0b, + BBN_SPF_IGP_TYPE = 0x0c, + OSPFV3_PROTOCOL_TYPE = 0x0d, + BGP_PROTOCOL_TYPE = 0x0e +#if __DCC__ +}; +#else /* using GNU compiler */ +} _pack; +#endif + + +#if __DCC__ /* if using DIAB compiler */ +__packed__ enum IP_ROUTE_OPERATION +#else +enum IP_ROUTE_OPERATION +#endif +{ + ADD_IP_ROUTE = 0x01, + DELETE_IP_ROUTE = 0x02 +#if __DCC__ +}; +#else /* using GNU compiler */ +} _pack; +#endif + + +typedef _struct SERVICE_TYPE_BIT_STRUCTURE +{ +#if (_BYTE_ORDER == _LITTLE_ENDIAN ) + unsigned char unused:2; + unsigned char high_reliability:1; + unsigned char high_throughput:1; + unsigned char low_delay:1; + unsigned char precedence:3; +#else /* _BYTE_ORDER == _BIG_ENDIAN */ + unsigned char precedence:3; + unsigned char low_delay:1; + unsigned char high_throughput:1; + unsigned char high_reliability:1; + unsigned char unused:2; +#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ +} _pack SERVICE_TYPE_BIT_STRUCTURE; + +typedef _union UNION_SERVICE_TYPE_BIT_STRUCTURE +{ + SERVICE_TYPE_BIT_STRUCTURE _bit; + BYTE _byte; +} _pack UNION_SERVICE_TYPE_BIT_STRUCTURE; + + +typedef _union UNION_USER_OPTIONS +{ + BYTE char_options[MAXIMUM_IP_OPTION_LENGTH]; /* according to rfc791 format in network order */ + ULONG ulong_options[MAXIMUM_IP_OPTION_LENGTH / sizeof (ULONG)]; +} _pack UNION_USER_OPTIONS; + +typedef _struct IP_UPPER_LAYER_PARAMETERS +{ + ULONG source_address; + ULONG destination_address; + BYTE_ENUM (BOOLEAN) do_not_fragment_flag; + SERVICE_TYPE_BIT_STRUCTURE type_of_service; + USHORT sequence_id; + BYTE time_to_live; + BYTE protocol; + BYTE option_length; + UNION_USER_OPTIONS user_options; + void *vptr_cached_route; /* address of cached route stored in user's space */ + USHORT virtual_port_number; /* do not route, send out through this port if not NO_SUCH_PORT */ + ULONG gateway; +} _pack IP_UPPER_LAYER_PARAMETERS; + +typedef _struct VERSION_LENGTH_BIT_STRUCTURE +{ +#if (_BYTE_ORDER == _LITTLE_ENDIAN ) + unsigned char header_length:4; + unsigned char version:4; +#else /* _BYTE_ORDER == _BIG_ENDIAN */ + unsigned char version:4; + unsigned char header_length:4; +#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ +} _pack VERSION_LENGTH_BIT_STRUCTURE; + + +typedef _struct FLAG_FRAGMENT_OFFSET_BIT_STRUCTURE +{ +#if (_BYTE_ORDER == _LITTLE_ENDIAN ) + unsigned char fragment_offset_most_significant_part:5; + unsigned char more_fragment_flag:1; + unsigned char do_not_fragment_flag:1; + unsigned char unused_bit:1; +#else /* _BYTE_ORDER == _BIG_ENDIAN */ + unsigned char unused_bit:1; + unsigned char do_not_fragment_flag:1; + unsigned char more_fragment_flag:1; + unsigned char fragment_offset_most_significant_part:5; +#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ +} _pack FLAG_FRAGMENT_OFFSET_BIT_STRUCTURE; + +typedef _struct IP_HEADER +{ + VERSION_LENGTH_BIT_STRUCTURE version_header_length; + SERVICE_TYPE_BIT_STRUCTURE service_type; + USHORT total_length; + USHORT identifier; + FLAG_FRAGMENT_OFFSET_BIT_STRUCTURE flags_fragment_offset; + BYTE fragment_offset_least_significant_part; + BYTE time_to_live; + BYTE protocol; + USHORT header_checksum; + ULONG source_ip_address; + ULONG destination_ip_address; +} _pack IP_HEADER; + + +typedef struct IP_PARAMETERS +{ + USHORT header_length; + USHORT total_length; + ULONG source_address; + ULONG destination_address; + USHORT offset; + SERVICE_TYPE_BIT_STRUCTURE type_of_service; + USHORT id; + BYTE time_to_live; + BYTE_ENUM (IP_PROTOCOL_VALUE) protocol; + BYTE options_length; + BYTE_ENUM (BOOLEAN) do_not_fragment_flag; + BYTE_ENUM (BOOLEAN) more_fragment_flag; + BYTE version; + USHORT checksum; + USHORT rx_port_number; + ULONG gateway; + BYTE_ENUM (BOOLEAN) union_ip_packet_is_to_be_freed; + BYTE_ENUM (BOOLEAN) packet_forwarded_by_upper_layer; + BYTE_ENUM (BOOLEAN) packet_recognized_by_upper_layer; +} IP_PARAMETERS; + +typedef _union UNION_OPTIONS_OR_DATA +{ + BYTE data; + BYTE ip_options; +} _pack UNION_OPTIONS_OR_DATA; + + +/* pseudo IP header used to compute upper layer protocol IPv6 checksum +as per RFC 2640, chapter 8.1 (applicable to OSPFv3, TCP, etc) */ +typedef struct PSEUDO_IP_PARAMETERS +{ + struct in6_addr src_addr; + struct in6_addr dst_addr; + ULONG length; + ULONG protocol; +} PSEUDO_IP_PARAMETERS; + +#ifndef INVALID_SOCKET_DESCRIPTOR +#define INVALID_SOCKET_DESCRIPTOR 0 +#endif + + +#ifndef SOCKET_OPEN_MODE_WAIT_FOR_MULTIPLE_CONNECTION +#define SOCKET_OPEN_MODE_WAIT_FOR_MULTIPLE_CONNECTION 0xFFFF +#endif + +#ifndef WOULD_BLOCK_ERROR +#define WOULD_BLOCK_ERROR 0xFFFF +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCospfv3IpStructuresh */ diff --git a/h/wrn/ospfv3/ospfv3Ipv6Dependencies.h b/h/wrn/ospfv3/ospfv3Ipv6Dependencies.h new file mode 100644 index 0000000..5934e5e --- /dev/null +++ b/h/wrn/ospfv3/ospfv3Ipv6Dependencies.h @@ -0,0 +1,119 @@ +/* ospfv3Ipv6Dependencies.h - OSPFv3 list of Macros, externs, etc... used from IPv6 stack*/ + +/* Copyright 2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01g,22mar05,xli remove redeclaration of "_in_ifaddrhead" +01f,22apr04,ram New branch compile +01e,29sep03,agi added IFP_TO_IA macro +01d,25sep03,ram Second general modifications submission +01c, jul1603,xli replace ifp with sptr_ifnet in "OSPFV3_IA6_TO_IFP" macro + to fix the initialize crash issue +01b,16jun03,agi changes to move from Clarinet stack to Accordion stack +01a,14jan03,htm written +*/ + +#ifndef __INCospfv3Ipv6Dependenciesh +#define __INCospfv3Ipv6Dependenciesh + +#ifdef __cplusplus +extern "C" { +#endif + +/*#include */ + +IMPORT struct ifnethead ifnet_head; + +#define OSPFV3_IA6_TO_IFP(ia, ifp) \ +/* struct in6_addr *ia; */ \ +/* struct ifnet *ifp; */ \ +do { \ + struct ifnet *sptr_ifnet; \ + struct ifaddr *ifa; \ + for (sptr_ifnet = ifnet_head.tqh_first; sptr_ifnet; sptr_ifnet = sptr_ifnet->if_link.tqe_next) { \ + for (ifa = (sptr_ifnet)->if_addrlist.tqh_first; ifa; ifa = ifa->ifa_list.tqe_next) { \ + if (!ifa->ifa_addr) \ + continue; \ + if ((ifa->ifa_addr->sa_family == AF_INET6) && \ + IN6_ARE_ADDR_EQUAL(&((struct in6_ifaddr *)ifa)->ia_addr.sin6_addr, (struct in6_addr *)ia))\ + break; \ + } \ + if (sptr_ifnet != NULL) \ + break; \ + } \ + (ifp) = (struct ifnet *)sptr_ifnet; \ +} while (0) + +#ifndef INADDR_TO_IFP +#define INADDR_TO_IFP(addr, ifp) \ + /* struct in_addr addr; */ \ + /* struct ifnet *ifp; */ \ +{ \ + register struct in_ifaddr *ia; \ +\ + for (ia = _in_ifaddrhead.tqh_first; \ + ia != NULL && ((ia->ia_ifp->if_flags & IFF_POINTOPOINT)? \ + IA_DSTSIN(ia):IA_SIN(ia))->sin_addr.s_addr != (addr).s_addr; \ + ia = ia->ia_link.tqe_next) \ + continue; \ + if (ia == NULL) \ + for (ia = _in_ifaddrhead.tqh_first; \ + ia != NULL; \ + ia = ia->ia_link.tqe_next) \ + if (ia->ia_ifp->if_flags & IFF_POINTOPOINT && \ + IA_SIN(ia)->sin_addr.s_addr == (addr).s_addr) \ + break; \ + (ifp) = (ia == NULL) ? NULL : ia->ia_ifp; \ +} +#endif + +#ifndef IFP_TO_IA6 +#define IFP_TO_IA6(ifp, ia) \ +/* struct ifnet *ifp; */ \ +/* struct in6_ifaddr *ia; */ \ +do { \ + struct ifaddr *ifa; \ + for (ifa = (ifp)->if_addrlist.tqh_first; ifa; ifa = ifa->ifa_list.tqe_next) { \ + if (!ifa->ifa_addr) \ + continue; \ + if (ifa->ifa_addr->sa_family == AF_INET6) \ + break; \ + } \ + (ia) = (struct in6_ifaddr *)ifa; \ +} while (0) +#endif + +#define OSPFV3_FIND_IN6_LINKLOCAL_IFINDEX(addr) \ + ((addr).s6_addr[2] << 8 | (addr).s6_addr[3]) + +#define OSPFV3_SET_IN6_LINKLOCAL_IFINDEX(addr, value) \ + do { \ + (addr).s6_addr[2] = ((value) >> 8) & 0xff; \ + (addr).s6_addr[3] = (value) & 0xff; \ + } while (0) + + +#ifndef IFP_TO_IA +#define IFP_TO_IA(ifp, ia) \ + /* struct ifnet *ifp; */ \ + /* struct in_ifaddr *ia; */ \ +{ \ + for ((ia) = TAILQ_FIRST(&_in_ifaddrhead); \ + (ia) != NULL && (ia)->ia_ifp != (ifp); \ + (ia) = TAILQ_NEXT((ia), ia_link)) \ + continue; \ +} +#endif +IMPORT struct ifaddr *ifa_ifwithaddr __P((struct sockaddr *)); +IMPORT struct ifaddr *ifa_ifwithdstaddr __P((struct sockaddr *)); +IMPORT struct ifaddr *ifa_ifwithnet __P((struct sockaddr *)); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCospfv3Ipv6Dependenciesh */ diff --git a/h/wrn/ospfv3/ospfv3Lib.h b/h/wrn/ospfv3/ospfv3Lib.h new file mode 100644 index 0000000..5fc28a1 --- /dev/null +++ b/h/wrn/ospfv3/ospfv3Lib.h @@ -0,0 +1,125 @@ +/* ospfv3Lib.h - OSPFv3 library */ + +/* Copyright 2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01t,07mar05,xli added sockLib.h +01s,17feb05,xli include m2Ipv6Lib.h +01r,16feb05,xli include sys/sysctl.h, m2Lib.h and remove adv_net.h, routeEnhLib.h +01q,03feb05,xli remove clarinet.h +01p,10dec04,tlu OSPF stack decoupling (interface) +01o,29nov04,tlu OSPF stack decoupling (header files) +01n,16sep04,dsk fix for trace B0189, allow build with VIRTUAL_STACK defined +01m,10jun04,dsk spcify full path to ospfCommonLib.h for build from Project facility +01l,05may04,dsk fix build issue with clarinet.h +01k,06apr04,ram OSPF v2/v3 coexistance changes +01j,23oct03,agi updated include file paths +01i,25sep03,ram Second general modifications submission +01h,30jun03,agi changed inlude file names +01g,29jul03,ram Added sockets, processing, and external route changes +01f,23jun03,agi added RWOS removal changes + updated copyright +01e,23jan03,htm added changes for IPv6 and some cleanup +01d,23dec02,agi removed include of ospfv3SearchUtils.h +01c,18dec02,agi corrected path to rtm.h +01b,14nov02,agi first pass at clean-up +01a,23oct02,agi written +*/ + +/* +DESCRIPTION + +Include this library to get all the necessary OSPFv3 header files. +*/ + +#ifndef __INCospfv3Libh +#define __INCospfv3Libh + +#if !defined (__VxWORKS__) +#define __VxWORKS__ +#endif /* __VxWORKS__ */ + +#if !defined (__RTM__) +#define __RTM__ +#endif /* __RTM__ */ + +#if !defined (__BIG_ENUMS__) +#define __BIG_ENUMS__ +#endif /* __BIG_ENUMS__ */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Rabih */ +/*#include */ + +#include +#include +#include +#include +#include +#include + +#if defined (__OSPFV3_FTP__) +#include +#include +#include +#endif /*__OSPFV3_FTP__*/ + +#include + +#if defined (__OSPFV3_MAPI__) +#include "ospfCommonMibApi.h" +#include "ospfv3MapiHelperUpdate.h" +#endif /*__OSPFV3_MAPI__*/ + +/* fix for trace B0189 */ +#if 0 +#if defined (VIRTUAL_STACK) /* Mistral added for Synth compatibility */ +#include +#include +#include +#include +#endif /* VIRTUAL_STACK */ +#endif + +#include "ospfv3Constants.h" +#include "ospfv3Enums.h" +#include "ospfv3IpStructures.h" +#include "ospfv3Structures.h" +#include "ospfv3Globals.h" +#include "ospfv3Prototypes.h" +#include "ospfv3Memory.h" + +#define ROUNDUP(a) \ + ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long)) +#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len)) + +#endif /* __INCospfv3Libh */ + diff --git a/h/wrn/ospfv3/ospfv3Mapi.h b/h/wrn/ospfv3/ospfv3Mapi.h new file mode 100644 index 0000000..eaafb20 --- /dev/null +++ b/h/wrn/ospfv3/ospfv3Mapi.h @@ -0,0 +1,370 @@ +/* ospfv3Mapi.h - public interface for managing OSPFv3 */ + +/* Copyright 2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* + * Modification history + * -------------------- + 01h,07mar05,xli correct parameter data type in ospfv3_mApi_ipv6Addr2OctetString + 01g,12may04,xli Modified the ospfv3MApiInit function prototype + 01f,06may04,ram Fix for AVL memory corruption + 01e,29apr04,ram Fix mapi AVL, compile, and warnings + 01d,22apr04,ram AVL & Memory migration to shared library + 01c,29may03,xli included Xinzhi's changes from integration with Xinzhi + mapi counters are unsigned int instead of int + 01b,05jan03,xli Modified the data structures to reflect OSPFv3 + MIB definition and OSPFv3 Mapi layer method routine + declaration + 01a,14novo2,xli Initial file creation. + */ + +/* +DESCRIPTION: +This file contains the definitions for constants, data structures and +function prototypes used to implement the OSPFv3 Management Interface. + +*/ + +#ifndef __INCospfv3Mapi_h +#define __INCospfv3Mapi_h + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* initially turn off all the debug switch */ +IMPORT int ospfv3MapiDebug; +IMPORT int ospfv3MapiErrorDebug; + +/* mib api debug macro. */ +#define mApiOspfv3DbgEnabled TRUE +#ifdef mApiOspfv3DbgEnabled +#define mApiOspfv3Printf( _x ) { if (ospfv3MapiDebug) {printf _x;} } +#else +#define mApiOspfv3Printf( _x ) +#endif /* mApiOspfv3DbgEnabled */ + +/* #undef mApiOspfv3ErrorEnabled */ +#define mApiOspfv3ErrorEnabled TRUE +#ifdef mApiOspfv3ErrorEnabled +#define mApiOspfv3Error( _x ) { if (ospfv3MapiErrorDebug) {printf _x;} } +#else +#define mApiOspfv3Error( _x ) +#endif /* mApiOspfv3ErrorEnabled */ + + +/* the following only apply if not using the Tornado Project Facility. If using + * Tornado Project Facility, select INCLUDE_OSPFV3_SHOW (for now, always include + * show routines since Project Facility is not configured to support this yet) + */ + +/* OSPFv3 specific MIB API application defined error */ +#define OSPFV3_MAPI_INVALID_INSTANCE 1000 + + +/* pointer to function for MIB API GET request */ +typedef STATUS (* OSPFV3_MAPI_GET_RTN)( mApiRequest_t *pRequest, mApiReqType_t reqType ); + +/* pointer to function for MIB API SET request */ +typedef STATUS (* OSPFV3_MAPI_SET_RTN)( mApiRequest_t *pRequest, mApiReqType_t reqType ); + +/* pointer to function for processing the SET request */ +typedef STATUS (* OSPFV3_MAPI_HELPER_SET_RTN)( mApiRequest_t *pRequest, mApiReqType_t reqType ); + +/* pointer to function for dynamically configuring the OSPFv3 protocol */ +typedef STATUS (* OSPFV3_MAPI_HELPER_CONFIG_RTN)( mApiRequest_t *pRequest ); + +/* pointer to function for processing the GET/GET NEXT request */ + +typedef STATUS (* OSPFV3_MAPI_HELPER_GET_RTN)( void *pRow, mApiRequest_t *pRequest, + mApiObject_t *pReqObject ); + +/* pointer to function for setting the next index value for the GET NEXT request */ +typedef void (* OSPFV3_MAPI_INDEX_SET_RTN)( void *pRow, mApiRequest_t *pRequest ); + +/* pointer to function that is used by AVL to compare two instances */ +typedef int (* OSPFV3_MAPI_AVL_COMPARE_RTN)(AVL_NODE * node, void* key); + + +/* system dependenet configuration parameters. These parameters determine the number + * of concurrent instances that can be configured for each table in the OSPFv3-MIB. + */ +#define DEFAULT_OSPFV3_MAPI_AREA_MAX 8 +#define DEFAULT_OSPFV3_MAPI_AS_LSDB_MAX 1024 +#define DEFAULT_OSPFV3_MAPI_AREA_LSDB_MAX 1024 +#define DEFAULT_OSPFV3_MAPI_LINK_LSDB_MAX 1024 +#define DEFAULT_OSPFV3_MAPI_HOST_MAX 4 +#define DEFAULT_OSPFV3_MAPI_INTF_MAX 16 +#define DEFAULT_OSPFV3_MAPI_VIRT_INTF_MAX 8 +#define DEFAULT_OSPFV3_MAPI_NBR_MAX 24 +#define DEFAULT_OSPFV3_MAPI_NBMA_NBR_MAX 24 +#define DEFAULT_OSPFV3_MAPI_VIRT_NBR_MAX 24 +#define DEFAULT_OSPFV3_MAPI_AREA_AG_MAX 12 + + +/* the following define is for unnumbered interface support in + * wrnOspfv3IfTable. Set the maximum number of instances allowed + * to be one entry less than the maximum number of instances in + * ospfv3IfTable. This is done this way because it may be possible + * that all but one instances in the ospfv3IfTable are created as + * unnumbered interface. In that case there must be at least one + * interface with IP Address so that those unnumbered interfaces + * can be initialized. + */ +#define DEFAULT_OSPFV3_MAPI_WRN_INTF_MAX DEFAULT_OSPFV3_MAPI_INTF_MAX-1 + +/* OSPFV3_REQUEST_BUFFER_CNT is the number of request buffers that + * will be allocated. These request buffers are used by ospfv3 to + * provide operational status and stastitical update to the MIB API + * asynchronous. Although this number is arbitrary picked and can be + * tuned according to the system needs, the number of buffers allocated + * must be able to handle the maximum number of external link state + * advertisement updates from ospfv3 during the flooding. + */ +#define DEFAULT_OSPFV3_REQUEST_BUFFER_CNT DEFAULT_OSPFV3_MAPI_AS_LSDB_MAX + + +/* define the OSPFv3 RFC that is currently using */ +typedef enum { + Eospfv3ProtoType_rfc2740 = 1 /* RFC2740 OSPFv3 */ +} ospfv3ProtoType_t; + + +typedef struct mApiOspfv3AvlClass +{ + LIST ospfv3FreePoolList; /* free memory list */ + AVL_NODE *pOspfv3AvlRoot; /* AVL tree root */ + int memReqFailedCnt; /* memory request from pool failed */ + OSPFV3_MAPI_AVL_COMPARE_RTN + ospfv3AvlCompareRtn; /* AVL compare routine */ +} mApiOspfv3AvlClass_t; + + +/*************************************************************************** + * Management Interface Data Structure. + */ +typedef struct mApiOspfv3Class +{ + /* OSPFv3 Protocol Information */ + ospfv3ProtoType_t ospfv3RfcProto; /* version of OSPFv3 RFC that is using */ + BOOL ospfv3ProtoInit; /* if true, OSPFv3 protocol is up */ + BOOL ospfv3OpaqueEnable; /* if true, support Opaque LSA */ + BOOL ospfv3DbOverflow; /* if true, support OSPFv3 database overflow */ + BOOL ospfv3NssaEnabled; /* if true, support NSSA */ + BOOL ospfv3BackboneExist; /* if true, OSPFv3 backbone area exists */ + BOOL ospfv3BackboneActive; /* if true, one more interfaces are active */ + + SEM_ID semMapiMutex; /* mutex semaphore */ + int semTimeout; /* semaphore wait time, used by ospfv3ToMapi task */ + BOOL rebootRouter; /* restart router if true, destroyed MIB API */ + BOOL dynamicConfig; /* true if dynamic configuration is required */ + BOOL dynamicDelete; /* true if dynamic deletion from nvram required */ + + /* system dependent callback functions for saving/retrieving ospfv3 configuration + * to/from nvram + */ + OSPFV3_NVRAM_SAVE_FUNCPTR nvramSaveRtn; /* to save configuration to nvram */ + OSPFV3_NVRAM_DELETE_FUNCPTR nvramDelRtn; /* to delete a table row from nvram */ + OSPFV3_NVRAM_RETRIEVE_FUNCPTR nvramRetrieveRtn; /* to retrieve configuration from nvram */ + + /* system dependent configuration parameters for standard OSPFv3-MIB */ + int mApiOspfv3MaxArea; /* max number of instances for ospfv3AreaTable */ + int mApiOspfv3MaxAsLsdb; /* max number of instances for ospfv3AsLsdbTable */ + int mApiOspfv3MaxAreaLsdb; /* max number of instances for ospfv3AreaLsdbTable */ + int mApiOspfv3MaxLinkLsdb; /* max number of instances for ospfv3LinkLsdbTable */ + int mApiOspfv3MaxHost; /* max number of instances for ospfv3HostTable */ + int mApiOspfv3MaxIf; /* max number of instances for ospfv3IfTable */ + int mApiOspfv3MaxVirtIf; /* max number of instances for ospfv3VirtIfTable */ + int mApiOspfv3MaxNbr; /* max number of instances for ospfv3NbrTable */ + int mApiOspfv3MaxNBMANbr; /* max number of instances for ospfv3NBMANbrTable */ + int mApiOspfv3MaxVirtNbr; /* max numbr of instances for ospfv3VirtNbrTable */ + int mApiOspfv3MaxAreaAg; /* max number of instances for ospfv3AreaAggregateTable */ + + /* current system capacities */ + int mApiOspfv3CurrAreaCnt; /* current number of instances in ospfv3AreaTable */ + int mApiOspfv3CurrAsLsdbCnt; /* current number of instances in ospfv3AsLsdbTable */ + int mApiOspfv3CurrAreaLsdbCnt; /* current number of instances in ospfv3AreaLsdbTable */ + int mApiOspfv3CurrLinkLsdbCnt; /* current number of instances in ospfv3LinkLsdbTable */ + int mApiOspfv3CurrHostCnt; /* current number of instances in ospfv3HostTable */ + int mApiOspfv3CurrIfCnt; /* current number of instances in ospfv3IfTable */ + int mApiOspfv3CurrVirtIfCnt; /* current number of isntances in ospfv3VirtIfTable */ + int mApiOspfv3CurrNbrCnt; /* current number of instances in ospfv3NbrTable */ + int mApiOspfv3CurrNBMANbrCnt; /* current number of instances in ospfv3NBMANbrTable */ + int mApiOspfv3CurrVirtNbrCnt; /* current number of instances in ospfv3VirtNbrTable */ + int mApiOspfv3CurrAreaAgCnt; /* current number of instances in ospfv3AreaAggregateTable */ + + /* interanl operational erros statistics due to max capacity reached */ + int mApiOspfv3AreaMaxReached; /* max capacility for ospfv3AreaTable reached */ + int mApiOspfv3AsLsdbMaxReached; /* max capacility for ospfv3AsLsdbTable reached */ + int mApiOspfv3AreaLsdbMaxReached; /* max capacility for ospfv3AreaLsdbTable reached */ + int mApiOspfv3LinkLsdbMaxReached; /* max capacility for ospfv3LinkLsdbTable reached */ + int mApiOspfv3HostMaxReached; /* max capacility for ospfv3HostTable reached */ + int mApiOspfv3IfMaxReached; /* max capacility for ospfv3IfTable reached */ + int mApiOspfv3VirtIfMaxReached; /* max capacility for ospfv3VirtIfTable reached */ + int mApiOspfv3NbrMaxReached; /* max capacility for ospfv3NbrTable reached */ + int mApiOspfv3NBMANbrMaxReached; /* max capacility for ospfv3NBMANbrTable reached */ + int mApiOspfv3VirtNbrMaxReached; /* max capacility for ospfv3VirtNbrTable reached */ + int mApiOspfv3AreaAgMaxReached; /* max capacility for ospfv3AreaAggregateTable reached */ + + /* internal operational error statistics due to reasons other than max capacity + * problem (resulted in instance not being created) + */ + unsigned int mApiOspfv3AreaFailedCnt; /* number of creation failure for ospfv3AreaTable */ + unsigned int mApiOspfv3AsLsdbFailedCnt; /* number of creation failure for ospfv3AsLsdbTable */ + unsigned int mApiOspfv3AreaLsdbFailedCnt; /* number of creation failure for ospfv3AreaLsdbTable */ + unsigned int mApiOspfv3LinkLsdbFailedCnt; /* number of creation failure for ospfv3LinkLsdbTable */ + unsigned int mApiOspfv3HostFailedCnt; /* number of creation failure for ospfv3HostTable */ + unsigned int mApiOspfv3IfFailedCnt; /* number of creation failure for ospfv3IfTable */ + unsigned int mApiOspfv3VirtIfFailedCnt; /* number of creation failure for ospfv3VirtIfTable */ + unsigned int mApiOspfv3NbrFailedCnt; /* number of creation failure for ospfv3NbrTable */ + unsigned int mApiOspfv3NBMANbrFailedCnt; /* number of creation failure for ospfv3NBMANbrTable */ + unsigned int mApiOspfv3VirtNbrFailedCnt; /* number of creation failure for ospfv3VirtNbrTable */ + unsigned int mApiOspfv3AreaAgFailedCnt; /* num of creation failure for ospfv3AreaAggregateTable */ + + /* OSPFv3-MIB data strctures */ + void *pMapiOspfv3GenGroup; /* ospfv3 general group scalar objects */ + + mApiOspfv3AvlClass_t ospfv3AreaAvl; /* AVL tree for ospfv3AreaTable */ + mApiOspfv3AvlClass_t ospfv3AsLsdbAvl; /* AVL tree for ospfv3AsLsdbTable */ + mApiOspfv3AvlClass_t ospfv3AreaLsdbAvl; /* AVL tree for ospfv3AreaLsdbTable */ + mApiOspfv3AvlClass_t ospfv3LinkLsdbAvl; /* AVL tree for ospfv3LinkLsdbTable */ + mApiOspfv3AvlClass_t ospfv3HostAvl; /* AVL tree for ospfv3HostTable */ + mApiOspfv3AvlClass_t ospfv3IfAvl; /* AVL tree for ospfv3IfTable */ + mApiOspfv3AvlClass_t ospfv3VirtIfAvl; /* AVL tree for ospfv3VirtIfTable */ + mApiOspfv3AvlClass_t ospfv3NbrAvl; /* AVL tree for ospfv3NbrTable */ + mApiOspfv3AvlClass_t ospfv3NbmaNbrAvl; /* AVL tree for ospfv3NBMANbrTable */ + mApiOspfv3AvlClass_t ospfv3VirtNbrAvl; /* AVL tree for ospfv3VirtNbrTable */ + mApiOspfv3AvlClass_t ospfv3AreaAgAvl; /* AVL tree for ospfv3AreaAggregateTable */ + + /* rowStatus library handlers */ + rsParams_t *pMapiOspfv3AreaRs; /* ospfv3AreaTable Row Status handler */ + rsParams_t *pMapiOspfv3HostRs; /* ospfv3HostTable Row Status handler */ + rsParams_t *pMapiOspfv3IfRs; /* ospfv3IfTable Row Status handler */ + rsParams_t *pMapiOspfv3VirtIfRs; /* ospfv3VirtIfTable Row Status handler */ + rsParams_t *pMapiOspfv3NBMANbrRs; /* ospfv3NBMANbrTable Row Status handler */ + rsParams_t *pMapiOspfv3AreaAgRs; /* ospfv3AreaAggregateTable Row Status handler */ + + ulong_t currObjInProcess; /* current varbind to process */ + mApiObject_t *pMapiCurrObj; /* current varbind to process */ + mApiReqType_t currMapiReqType; /* current mApi request type to process */ + + void *pMapiWrnOspfv3GenGroup; /* wrn ospfv3 general group scalar objects */ + + /* number of active area. An area is said to be active if there is at least one + * operational interfaces belonging to the area. If the value is greater than + * one, the router is an area border router + */ + ushort_t numActiveArea; + + /* SNMP TEST/COMMIT/UNDO/COMPLETE counters, for state transition monitoring */ + unsigned int mApiTestReqCnt; /* number of SNMP TEST requests processed */ + unsigned int mApiCommitReqCnt; /* number of SNMP COMMIT requests processed */ + unsigned int mApiUndoReqCnt; /* number of SNMP UNDO requests processed */ + unsigned int mApiCompleteReqCnt; /* number of SNMP COMMIT succeed, for debugging */ + unsigned int mApiBogusReqCnt; /* number of incorrect SNMP requests, for debugging */ + unsigned int mApiTestReqFailedCnt; /* number of SNMP TEST failed, for debugging */ + unsigned int mApiCommitReqFailedCnt; /* number of SNMP COMMIT failed, for debugging */ + unsigned int mApiNvmSetReqFailedCnt; /* number of MAPI NVM SET failed, for debugging */ + unsigned int mApiGetReqFailedCnt; /* number of SNMP GET failed, for debugging */ + unsigned int mApiGetNextReqFailedCnt; /* number of SNMP GET_NEXT failed, for debugging */ + unsigned int mApiDynConfigReqFailedCnt; /* number of dynamic reconfig failed, for debugging */ + +} mApiOspfv3Class_t; + +/* global variables */ +mApiOspfv3Class_t *thisOspfv3Mapi; /* the OSPFV3 mib api object */ + +/******************************************************************************** + * Management Interface Public Macro + */ +#define OSPFV3_MIB_BUFLEN_CHECK(pRequest, pObject, actualLen) \ + if ( ((pObject)->valueLen < actualLen) || \ + ((pObject)->pValueBuf == NULL) ) \ + { \ + (pObject)->valueLen = actualLen; \ + (pObject)->exception = MAPI_BUFFER_TOO_SHORT; \ + (pRequest)->errorObjIndex = (ushort_t)(pObject)->oidPrefixEnum; \ + (pRequest)->error = (int)0; \ + return OK; \ + } + +#define OSPFV3_MIB_ERROR_SET(pRequest, mApiError, oidPrefixEnum) \ + (pRequest)->error = (int)mApiError; \ + (pRequest)->errorObjIndex = (ushort_t)oidPrefixEnum; + +#define OSPFV3_MIB_EXCEPTION_SET( pObject, mApiException ) \ + (pObject)->exception = mApiException; + +/****************************************************************************** +* Management Interface Public Function Prototypes +*/ + +/* OSPFv3 MIB API init/destroy routines */ + +IMPORT STATUS ospfv3MapiInit ( void ); +IMPORT STATUS ospfv3MapiDestroy ( void ); +IMPORT BOOL ospfv3MapiIsInited ( void ); + + +/* prototype for retrieving an instance of columnar object from the OSPFv3-MIB */ + +/* ospfv3GeneralGroup GET/GET_NEXT and TEST/COMMIT routines */ + +IMPORT STATUS ospfv3MapiGetGenGroup(mApiRequest_t *pRequest, mApiReqType_t reqType); + +IMPORT STATUS ospfv3MapiSetGenGroup(mApiRequest_t *pRequest, mApiReqType_t reqType); + +/* ospfv3AreaTable GET/GET_NEXT and TEST/COMMIT routines */ + +IMPORT STATUS ospfv3MapiGetArea(mApiRequest_t *pRequest, mApiReqType_t reqType); + +IMPORT STATUS ospfv3MapiSetArea(mApiRequest_t *pRequest, mApiReqType_t reqType); + +/* ospfv3AsLsdbTable GET/GET_NEXT routine */ + +IMPORT STATUS ospfv3MapiGetAsLsdb(mApiRequest_t *pRequest, mApiReqType_t reqType); + +/* ospfv3AreaLsdbTable GET/GET/_NEXT routine */ + +IMPORT STATUS ospfv3MapiGetAreaLsdb(mApiRequest_t *pRequest, mApiReqType_t reqType); + +/* ospfv3LinkLsdbTable GET/GET_NEXT routine */ + +IMPORT STATUS ospfv3MapiGetLinkLsdb(mApiRequest_t *pRequest, mApiReqType_t reqType); + +/* ospfv3IfTable GET/GET_NEXT and TEST/COMMIT routines */ + +IMPORT STATUS ospfv3MapiGetIf(mApiRequest_t *pRequest, mApiReqType_t reqType); + +IMPORT STATUS ospfv3MapiSetIf( mApiRequest_t *pRequest, mApiReqType_t reqType ); + +/* ospfv3NbrTable GET/GET_NEXT */ + +IMPORT STATUS ospfv3MapiGetNbr(mApiRequest_t *pRequest, mApiReqType_t reqType); + + +/* misc conversions routines */ + +IMPORT STATUS ospfv3_rs2mApi_errorGet( void *pObjInfo, int rsError ); + +IMPORT STATUS ospfv3_rs2mApi_reqTypeGet( int rsRequest, mApiReqType_t *mApiReqType); + +IMPORT void ospfv3_mApi_ipAddr2OctetString( ulong_t ipAddr, uchar_t *octetString ); + +IMPORT void ospfv3_mApi_ipv6Addr2OctetString( struct in6_addr ipv6Addr, u_int8_t *octetString); + +IMPORT ulong_t ospfv3_mApi_octetString2IpAddr( uchar_t *octetString ); + +IMPORT void ospfv3_mApi_ipAddr2IpIndex( ulong_t ulIpAddr, ulong_t *pIndex ); + +IMPORT void ospfv3_mApi_ipv6Addr2Index( struct in6_addr* ipv6Addr, ulong_t *pIndex ); + +IMPORT ulong_t ospfv3_mApi_ipIndex2IpAddr( ulong_t *pIndex ); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCospfv3Mapi_h */ diff --git a/h/wrn/ospfv3/ospfv3MapiHelper.h b/h/wrn/ospfv3/ospfv3MapiHelper.h new file mode 100644 index 0000000..10733f3 --- /dev/null +++ b/h/wrn/ospfv3/ospfv3MapiHelper.h @@ -0,0 +1,770 @@ +/* ospfv3MapiHelper.h - header file for OSPFv3-MIB Helper Module */ + +/* Copyright 2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* + * Modification history + * -------------------- +01f,27oct04,xli add ospf multicast extension struct +01e,25jun04,xli change the commits for oid enum +01d,30may03,xli change the ospfv3MulticastExtension data type from + integer to char* +01c,29may03,dsk included Xinzhi's changes from integration with Xinzhi +01b,10jan03,xli Add OSPFv3 specific enum value, data structures + and method routines +01a,16nov02,xli Initial file creation. + */ + +/* +DESCRIPTION: + +This file defines the draft-ietf-ospf-ospfv3-mib-05 MIB specific +Manamgenet Interface Local ID enumerations, the MIB object enumerations, +the MIB object sizes and some MIB API helper function prototypes. +*/ + +#ifndef __INCospfv3MapiHelper_h +#define __INCospfv3MapiHelper_h + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/*********************************************************************** + * Management Interface draft-ietf-ospf-ospfv3-mib-05 Definitions + */ + +/* OSPFv3 Version Number */ +#define OSPFV3_VERSION 3 + +/* OSPFv3 Area Backbone, ospfv3AreaId = 0.0.0.0 */ +#define OSPFV3_BACKBONE_AREA 00000000L + +#define MIN_OSPFV3_EXT_LSDB_LIMIT -1L +#define MAX_OSPFV3_EXT_LSDB_LIMIT 2147483647L +#define MAX_OSPFV3_EXIT_OVERFLOW_INTERVAL 2147483647L +#define MAX_OSPFV3_PRIORITY 255L +#define MAX_OSPFV3_POLL_INTERVAL 2147483647L +#define MAX_OSPFV3_AGE 3600L +#define MIN_OSPFV3_HELLO_INTERVAL 1L +#define MAX_OSPFV3_HELLO_INTERVAL 65535L +#define MAX_OSPFV3_DEAD_INTERVAL 2147483647L +#define MAX_EXTERNAL_LSDB_SIZE 36L + +/* draft-ietf-ospf-ospfv3-mib-05 MIB default value */ +#define DEFVAL_mApiOspfv3ExtAreaLsdbLimit -1L +#define DEFVAL_mApiOspfv3ExitOverflowInterval 0 + +#define DEFVAL_mApiOspfv3ImportAsExtern 1 +#define DEFVAL_mApiOspfv3AreaSummary 1 +#define DEFVAL_mApiOspfv3AreaNssaTranslatorRole 2 +#define DEFVAL_mApiOspfv3AreaNssaTranslatorStabilityInterval 40 +#define DEFVAL_mApiOspfv3IfAreaId 00000000L +#define DEFVAL_mApiOspfv3IfAdminStat 1 +#define DEFVAL_mApiOspfv3IfRtrPriority 1 +#define DEFVAL_mApiOspfv3IfTransitDelay 1 +#define DEFVAL_mApiOspfv3IfRetransInterval 5 +#define DEFVAL_mApiOspfv3IfHelloInterval 10 +#define DEFVAL_mApiOspfv3IfRtrDeadInterval 40 +#define DEFVAL_mApiOspfv3IfPollInterval 120 +#define DEFVAL_mApiOspfv3IfMulticastForwarding 1 +#define DEFVAL_mApiOspfv3IfDemand 2 +#define DEFVAL_mApiOspfv3VirtIfTransitDelay 1 +#define DEFVAL_mApiOspfv3VirtIfRetransInterval 5 +#define DEFVAL_mApiOspfv3VirtIfHelloInterval 10 +#define DEFVAL_mApiOspfv3VirtIfHelloInterval 10 +#define DEFVAL_mApiOspfv3VirtIfRtrDeadInterval 60 +#define DEFVAL_mApiOspfv3NbmaNbrPriority 1 +#define DEFVAL_mApiOspfv3NbmaNbaStorageType 3 + +#define DEFVAL_mApiHostNetMask 0xFFFFFFFF + +/* WindNet OSPFv3 default value */ +#define DEFVAL_mApiOspfv3IfType EmApiOspfv3IfType_broadcast + + +/* the following defines provides the number of sub-identifier + *(the instance length) of each table in draft-ietf-ospf-ospfv3-mib-05 MIB + */ +#define OSPFV3_AREA_INSTANCE_LEN 4 +#define OSPFV3_AS_LSDB_INSTANCE_LEN 9 +#define OSPFV3_AREA_LSDB_INSTANCE_LEN 13 +#define OSPFV3_LINK_LSDB_INSTANCE_LEN 10 +#define OSPFV3_HOST_INSTANCE_LEN 17 +#define OSPFV3_INTF_INSTANCE_LEN 1 +#define OSPFV3_VIRT_INTF_INSTANCE_LEN 8 +#define OSPFV3_NBR_INSTANCE_LEN 5 +#define OSPFV3_NBMA_NBR_INSTANCE_LEN 18 +#define OSPFV3_VIRT_NBR_INSTANCE_LEN 8 +#define OSPFV3_AREA_AGGREGATE_INSTANCE_LEN 23 + +/************************************************************************* +* Management Interface 1-based local ID enumerations for +* draft-ietf-ospf-ospfv3-mib-05 MIB. +*/ +typedef enum { + + mApiOspfv3RouterId = 1, + mApiOspfv3AdminStat, + mApiOspfv3VersionNumber, + mApiOspfv3AreaBdrRtrStatus, + mApiOspfv3ASBdrRtrStatus, + mApiOspfv3AsScopeLsaCount, + mApiOspfv3AsScopeLsaCksumSum, + mApiOspfv3OriginateNewLsas, + mApiOspfv3RxNewLsas, + mApiOspfv3ExtAreaLsdbLimit, + mApiOspfv3MulticastExtensions, + mApiOspfv3ExitOverflowInterval, + mApiOspfv3DemandExtensions, + mApiOspfv3TrafficEngineeringSupport, + + mApiOspfv3AreaId, /* mApiOspfv3_t enumeration value = 15 */ + mApiOspfv3ImportAsExtern, + mApiOspfv3SpfRuns, + mApiOspfv3AreaBdrRtrCount, + mApiOspfv3AsBdrRtrCount, + mApiOspfv3AreaScopeLsaCount, + mApiOspfv3AreaScopeLsaCksumSum, + mApiOspfv3AreaSummary, + mApiOspfv3AreaStatus, + mApiOspfv3StubMetric, + mApiOspfv3AreaNssaTranslatorRole, + mApiOspfv3AreaNssaTranslatorState, + mApiOspfv3AreaNssaTranslatorStabilityInterval, + mApiOspfv3AreaNssaTranslatorEvents, + + mApiOspfv3AsLsdbType, /* mApiOspfv3_t enumeration value = 29 */ + mApiOspfv3AsLsdbRouterId, + mApiOspfv3AsLsdbLsid, + mApiOspfv3AsLsdbSequence, + mApiOspfv3AsLsdbAge, + mApiOspfv3AsLsdbChecksum, + mApiOspfv3AsLsdbAdvertisement, + + mApiOspfv3AreaLsdbAreaId, /* mApiOspfv3_t enumeration value = 36 */ + mApiOspfv3AreaLsdbType, + mApiOspfv3AreaLsdbRouterId, + mApiOspfv3AreaLsdbLsid, + mApiOspfv3AreaLsdbSequence, + mApiOspfv3AreaLsdbAge, + mApiOspfv3AreaLsdbChecksum, + mApiOspfv3AreaLsdbAdvertisement, + + mApiOspfv3LinkLsdbIfIndex, /* mApiOspfv3_t enumeration value = 44 */ + mApiOspfv3LinkLsdbType, + mApiOspfv3LinkLsdbRouterId, + mApiOspfv3LinkLsdbLsid, + mApiOspfv3LinkLsdbSequence, + mApiOspfv3LinkLsdbAge, + mApiOspfv3LinkLsdbChecksum, + mApiOspfv3LinkLsdbAdvertisement, + + mApiOspfv3HostAddressType, /* mApiOspfv3_t enumeration value = 52 */ + mApiOspfv3HostAddress, + mApiOspfv3HostMetric, + mApiOspfv3HostStatus, + mApiOspfv3HostAreaID, + + mApiOspfv3IfIndex, /* mApiOspfv3_t enumeration value = 57 */ + mApiOspfv3IfAreaId, + mApiOspfv3IfType, + mApiOspfv3IfAdminStat, + mApiOspfv3IfRtrPriority, + mApiOspfv3IfTransitDelay, + mApiOspfv3IfRetransInterval, + mApiOspfv3IfHelloInterval, + mApiOspfv3IfRtrDeadInterval, + mApiOspfv3IfPollInterval, + mApiOspfv3IfState, + mApiOspfv3IfDesignatedRouter, + mApiOspfv3IfBackupDesignatedRouter, + mApiOspfv3IfEvents, + mApiOspfv3IfStatus, + mApiOspfv3IfMulticastForwarding, + mApiOspfv3IfDemand, + mApiOspfv3IfMetricValue, + mApiOspfv3IfLinkScopeLsaCount, + mApiOspfv3IfLinkLsaCksumSum, + mApiOspfv3IfInstId, + + mApiOspfv3VirtIfAreaId, /* mApiOspfv3_t enumeration value = 78 */ + mApiOspfv3VirtIfNeighbor, + mApiOspfv3VirtIfIndex, + mApiOspfv3VirtIfTransitDelay, + mApiOspfv3VirtIfRetransInterval, + mApiOspfv3VirtIfHelloInterval, + mApiOspfv3VirtIfRtrDeadInterval, + mApiOspfv3VirtIfState, + mApiOspfv3VirtIfEvents, + mApiOspfv3VirtIfStatus, + mApiOspfv3VirtIfLinkScopeLsaCount, + mApiOspfv3VirtIfLinkLsaCksumSum, + + mApiOspfv3NbrIfIndex, /* mApiOspfv3_t enumeration value = 90 */ + mApiOspfv3NbrRtrId, + mApiOspfv3NbrAddressType, + mApiOspfv3NbrAddress, + mApiOspfv3NbrOptions, + mApiOspfv3NbrPriority, + mApiOspfv3NbrState, + mApiOspfv3NbrEvents, + mApiOspfv3NbrLsRetransQLen, + mApiOspfv3NbrHelloSuppressed, + mApiOspfv3NbrIfId, + + mApiOspfv3NbmaNbrIfIndex, /* mApiOspfv3_t enumeration value = 101 */ + mApiOspfv3NbmaNbrAddressType, + mApiOspfv3NbmaNbrAddress, + mApiOspfv3NbmaNbrPriority, + mApiOspfv3NbmaNbrRtrId, + mApiOspfv3NbmaNbrState, + mApiOspfv3NbmaNbrStorageType, + mApiOspfv3NbmaNbrStatus, + + mApiOspfv3VirtNbrArea, /* mApiOspfv3_t enumeration value = 109 */ + mApiOspfv3VirtNbrRtrId, + mApiOspfv3VirtNbrIfIndex, + mApiOspfv3VirtNbrAddressType, + mApiOspfv3VirtNbrAddress, + mApiOspfv3VirtNbrOptions, + mApiOspfv3VirtNbrState, + mApiOspfv3VirtNbrEvents, + mApiOspfv3VirtNbrLsRetransQLen, + mApiOspfv3VirtNbrHelloSuppressed, + mApiOspfv3VirtNbrIfId, + + mApiOspfv3AreaAggregateAreaID, /* mApiOspfv3_t enumeration value = 120 */ + mApiOspfv3AreaAggregateAreaLsdbType, + mApiOspfv3AreaAggregatePrefixType, + mApiOspfv3AreaAggregatePrefix, + mApiOspfv3AreaAggregatePrefixLength, + mApiOspfv3AreaAggregateStatus, + mApiOspfv3AreaAggregateEffect + +} mApiOspfv3_t; + +/**************************************************************************** +* Manamgenet Interface draft-ietf-ospf-ospfv3-mib-05 MIB object enumerations +*/ +typedef enum { + unknown = 0, + ipv4 = 1, + ipv6 = 2, + ipv4z = 3, + ipv6z = 4, + dns = 16 +} inetAddressType_t; + + +typedef enum { + EmApiOspfv3_true = 1, + EmApiOspfv3_false = 2 +} mApiOspfv3TrueValue_t; + +typedef enum { + EmApiOspfv3_enabled = 1, + EmApiOspfv3_disabled = 2 +} mApiOspfv3Status_t; + +/* Row Status enumerations. This is the same for all tables with the + * rowStatus object + */ +typedef enum { + EmApiOspfv3RowStatus_active = 1, + EmApiOspfv3RowStatus_notInService = 2, + EmApiOspfv3RowStatus_notReady = 3, + EmApiOspfv3RowStatus_createAndGo = 4, + EmApiOspfv3RowStatus_createAndWait = 5, + EmApiOspfv3RowStatus_destroy = 6 +} mApiOspfv3RowStatus_t; + +typedef enum { + EmApiOspfv3ImportAsExtern_importExternal = 1, + EmApiOspfv3ImportAsExtern_importNoExternal = 2, + EmApiOspfv3ImportAsExtern_importNssa = 3 +} mApiOspfv3AreaImportAsType_t; + +typedef enum { + EmApiOspfv3AreaSummary_noAreaSummary = 1, + EmApiOspfv3AreaSummary_sendAreaSummary = 2 +} mApiOspfv3AreaSummary_t; + +typedef enum { +EmApiOspfv3AreaNssaTranslatorState_enable = 1, +EmApiOspfv3AreaNssaTranslatorState_elected = 2, +EmApiOspfv3AreaNssaTranslatorState_disable = 3 +} EmApiOspfv3AreaNssaTranslatorState_t; + +typedef enum { + EmApiOspfv3LinkLsdbType_linkLsa = 8, + EmApiOspfv3AreaLsdbType_routerLsa = 8193, + EmApiOspfv3AreaLsdbType_networkLsa = 8194, + EmApiOspfv3AreaLsdbType_interAreaPrefixLsa = 8195, + EmApiOspfv3AreaLsdbType_interAreaRouterLsa = 8196, + EmApiOspfv3AreaLsdbType_groupMembershipLsa = 8198, + EmApiOspfv3AreaLsdbType_nssaExternalLsa = 8199, + EmApiOspfv3AreaLsdbType_intraAreaPrefixLsa = 8201, + EmApiOspfv3AsLsdbType_asExternalLink = 16389 +} mApiOspfv3LsdbType_t; + +typedef enum { + EmApiOspfv3IfType_broadcast = 1, + EmApiOspfv3IfType_nbma = 2, + EmApiOspfv3IfType_pointToPoint = 3, + EmApiOspfv3IfType_pointToMultipoint = 5 +} mApiOspfv3IfType_t; + + +typedef enum { + EmApiOspfv3IfState_down = 1, + EmApiOspfv3IfState_loopback = 2, + EmApiOspfv3IfState_waiting = 3, + EmApiOspfv3IfState_pointToPoint = 4, + EmApiOspfv3IfState_designatedRouter = 5, + EmApiOspfv3IfState_backupDesignatedRouter = 6, + EmApiOspfv3IfState_otherDesignatedRouter = 7 +} mApiOspfv3IfState_t; + + +typedef enum { + EmApiOspfv3IfMulticastForwarding_blocked = 1, + EmApiOspfv3IfMulticastForwarding_multicast = 2, + EmApiOspfv3IfMulticastForwarding_unicast = 3 +} mApiOspfv3IfMcastType_t; + +typedef enum { + EmApiOspfv3VirtIfState_down = 1, + EmApiOspfv3VirtIfState_pointToPoint = 4 +} mApiOspfv3VirtIfState_t; + +typedef enum { + EmApiOspfv3NbrState_down = 1, + EmApiOspfv3NbrState_attempt = 2, + EmApiOspfv3NbrState_init = 3, + EmApiOspfv3NbrState_twoWay = 4, + EmApiOspfv3NbrState_exchangeStart = 5, + EmApiOspfv3NbrState_exchange = 6, + EmApiOspfv3NbrState_loading = 7, + EmApiOspfv3NbrState_full = 8 +} mApiOspfv3NbrState_t; + +typedef enum { + EmApiOspfv3NbrStorageType_other = 1, + EmApiOspfv3NbrStorageType_volatile = 2, + EmApiOspfv3NbrStorageType_nonVolatile = 3, + EmApiOspfv3NbrStorageType_permanent = 4, + EmApiOspfv3NbrStorageType_readOnly = 5 +} mApiOspfv3NbrStorageType_t; + + +typedef enum { + EmApiOspfv3AreaAggregateEffect_advertiseMatching = 1, + EmApiOspfv3AreaAggregateEffect_doNotAdvertiseMatching = 2 +} mApiOspfv3AreaAggregateEffect_t; + +/* mApiOspfv3ClientType_t enumeration type is used to identify the + * type of client that attaches to the mApiOspfv3Area_t or mApiOspfv3If_t. + * It is used when creating an mApiOspfv3Client_t node + */ +typedef enum { + EmApiOspfv3ClientType_intf = 1, /* client is physical interface */ + EmApiOspfv3ClientType_vintf = 2, /* client is virtual interface */ + EmApiOspfv3ClientType_host = 3, /* client is host interface */ + EmApiOspfv3ClientType_nbr = 4, /* client is neighbor */ + EmApiOspfv3ClientType_ag /* client is area aggregation */ + +} mApiOspfv3ClientType_t; + + +/*********************************************************************** + * Mamagement Interface draft-ietf-ospf-ospfv3-mib-05 Data Structure. + */ + +/* mApiOspfv3Client_t is used by mApiOspfv3Area_t to track instances of + * interface, virtual interface and host interface that are attached to + * this area. It is also used by mApiOspfv3If_t to track instances of + * neighbor that are associated with the interface. The + * mApiOspfv3RowStatus_t enumeration type is only used by mApiOspfv3Area_t + * to remember the existing rowStatus of the clients before it forces the + * client to make the rowStatus state transition due to the rowStatus + * changes occur in the mApiOspfv3Area_t itself + */ +typedef struct mApiOspfv3Client +{ + NODE node; /* linked list node */ + void *pClient; /* pointer to client data structure */ + int oldStatus; /* previous row stauts of the attached client */ + mApiOspfv3ClientType_t + clientType; /* the type of client */ +} mApiOspfv3Client_t; + + +/* OSPFv3 General Group variables + */ +typedef struct mApiospfv3MulticastExtensions +{ + ulong_t intraAreaMulticast:1; + ulong_t interAreaMulticast:1; + ulong_t interAsMulticast:1; + ulong_t unsued:5; + +} mApiospfv3MulticastExtensions_t; + +typedef struct mApiOspfv3GenGroup +{ + ulong_t ospfv3RouterId; /* read-write */ + mApiOspfv3Status_t ospfv3AdminStat; /* read-write */ + ulong_t ospfv3VersionNumber; /* read-only */ + mApiOspfv3TrueValue_t ospfv3AreaBdrRtrStatus; /* read-only */ + mApiOspfv3TrueValue_t ospfv3ASBdrRtrStatus; /* read-write */ + ulong_t ospfv3AsScopeLsaCount; /* read-only */ + ulong_t ospfv3AsScopeLsaCksumSum; /* read-only */ + ulong_t ospfv3OriginateNewLsas; /* read-only */ + ulong_t ospfv3RxNewLsas; /* read-only */ + long ospfv3ExtAreaLsdbLimit; /* read-write */ + mApiospfv3MulticastExtensions_t + ospfv3MulticastExtensions; /* read-only */ + ulong_t ospfv3ExitOverflowInterval; /* read-write */ + ushort ospfv3MulticastExtensionsLen; + /* the following read-write objects are implemented as read-only */ + + mApiOspfv3TrueValue_t ospfv3DemandExtensions; /* read-only */ + mApiOspfv3TrueValue_t ospfv3TrafficEngineeringSupport; /* read-only */ + + +} mApiOspfv3GenGroup_t; + +/* an instance of mApiOspfv3AreaClass_t object will always be created each time a new + * OSPFv3 Area is added to the Management Database. + */ +typedef struct mApiOspfv3Area +{ + AVL_NODE node; /* AVL Tree node */ + void *pSpfStub; /* pointer to the stub associate with this area */ + LIST listIfAttached; /* Interface clients attached, unsorted */ + LIST listAreaAggregate; /* Area Aggregate instances */ + + ulong_t defaultStubMetric; /* default stub metric */ + ushort_t numActiveIf; /* number of active interface attached */ + ushort_t numActiveVirtIf; /* number of active virtual interface attached */ + ushort_t numActiveHost; /* number of active host interface attached */ + ushort_t numIfAttached; /* number of interface instances attached */ + ushort_t numVirtIfAttached; /* number of virtual interface instances attached */ + ushort_t numHostAttached; /* number of host interface instances attached */ + ushort_t numAgAttached; /* number of area aggregate instances attached */ + rsAction_t createdAs; /* the method this row is created */ + mApiOspfv3TrueValue_t isTransitArea; + /* TRUE if this is a transit area */ + + /* objects associate with the ospfv3AreaTable */ + ulong_t ospfv3AreaId; /* index object */ + ulong_t ospfv3ImportAsExtern; /* read-create */ + ulong_t ospfv3SpfRuns; /* read-only */ + ulong_t ospfv3AreaBdrRtrCount; /* read-only */ + ulong_t ospfv3AsBdrRtrCount; /* read-only */ + ulong_t ospfv3AreaScopeLsaCount; /* read-only */ + ulong_t ospfv3AreaScopeLsaCksumSum; /* read-only */ + mApiOspfv3AreaSummary_t ospfv3AreaSummary; /* read-create */ + mApiOspfv3RowStatus_t ospfv3AreaStatus; /* read-create */ + ulong_t ospfv3StubMetric; /* read-create */ + ushort_t ospfv3AreaNssaTranslatorRole; /* read-create */ + ushort_t ospfv3AreaNssaTranslatorState; /* read-only */ + ulong_t ospfv3AreaNssaTranslatorStabilityInterval; + /* read-create */ + ulong_t ospfv3AreaNssaTranslatorEvents; /* read-only */ +} mApiOspfv3Area_t; + + +/* objects associate with the ospfv3AsLsdbTable */ +typedef struct mApiOspfv3AsLsdb +{ + AVL_NODE node; /* AVL Tree node */ + mApiOspfv3LsdbType_t ospfv3AsLsdbType; /* index object */ + ulong_t ospfv3AsLsdbRouterId; /* index object */ + ulong_t ospfv3AsLsdbLsid; /* index object */ + long ospfv3AsLsdbSequence; /* read-only */ + ulong_t ospfv3AsLsdbAge; /* read-only */ + ulong_t ospfv3AsLsdbChecksum; /* read-only */ + char* ospfv3AsLsdbAdvertisement; /* read-only */ + ushort_t asLsdbLen; /* advertisement length, not MIB object */ +} mApiOspfv3AsLsdb_t; + +/* objects associate with the ospfv3AreaLsdbTable */ +typedef struct mApiOspfv3AreaLsdb +{ + AVL_NODE node; /* AVL Tree node */ + ulong_t ospfv3AreaLsdbAreaId; /* index object */ + mApiOspfv3LsdbType_t ospfv3AreaLsdbType; /* index object */ + ulong_t ospfv3AreaLsdbRouterId; /* index object */ + ulong_t ospfv3AreaLsdbLsid; /* index object */ + long ospfv3AreaLsdbSequence; /* read-only */ + ulong_t ospfv3AreaLsdbAge; /* read-only */ + ulong_t ospfv3AreaLsdbChecksum; /* read-only */ + char* ospfv3AreaLsdbAdvertisement; /* read-only */ + ushort_t ospfv3AreaLsdbLen; /* advertisement length, not MIB object */ +} mApiOspfv3AreaLsdb_t; + +/* objects associate with the ospfv3LinkLsdbTable */ +typedef struct mApiOspfv3LinkLsdb +{ + AVL_NODE node; /* AVL Tree node */ + ushort_t ospfv3LinkLsdbIfIndex; /* index object */ + mApiOspfv3LsdbType_t ospfv3LinkLsdbType; /* index object */ + ulong_t ospfv3LinkLsdbRouterId; /* index object */ + ulong_t ospfv3LinkLsdbLsid; /* index object */ + long ospfv3LinkLsdbSequence; /* read-only */ + ulong_t ospfv3LinkLsdbAge; /* read-only */ + ulong_t ospfv3LinkLsdbChecksum; /* read-only */ + char* ospfv3LinkLsdbAdvertisement; + /* read-only */ + ushort_t ospfv3LinkLsdbLen; /* advertisement length, not MIB object */ +} mApiOspfv3LinkLsdb_t; + +/* objects associate with the ospfv3HostTable */ +typedef struct mApiOspfv3Host +{ + AVL_NODE node; /* AVL Tree node */ + ulong_t defaultMtu; /* default mtu from in_ifaddr structure */ + ulong_t defaultNetmask; /* default netmask from in_ifaddr structure */ + ulong_t defaultMetric; /* default metric from in_ifaddr structure */ + rsAction_t createdAs; /* the method this row is created */ + void *pArea; /* area associated with this host */ + inetAddressType_t ospfv3HostAddressType; /* index object */ + struct in6_addr ospfv3HostAddress; /* index object */ + ulong_t ospfv3HostMetric; /* read-create */ + mApiOspfv3RowStatus_t ospfv3HostStatus; /* read-create */ + ulong_t ospfv3HostAreaId; /* read-create */ +} mApiOspfv3Host_t; + +/* objects associate with the ospfv3IfTable */ +typedef struct mApiOspfv3If +{ + AVL_NODE node; /* AVL Tree node */ + LIST listNbrAttached; /* neighbors attached to this interface, unsorted */ + ushort_t numNbrAttached; /* number of neighbors attached to this interface */ + LIST listNbmaNbrAttached; /* NBMA neighbors attached to this interface, unsorted */ + ushort_t numNbmaNbrAttached; /* number of NBMA neighbors attached to this interface */ + ulong_t defaultMtu; /* default mtu from in_ifaddr structure */ + ulong_t defaultNetmask; /* default netmask from in_ifaddr structure */ + ulong_t defaultMetric; /* default metric from in_ifaddr structure */ + rsAction_t createdAs; /* the method this row is created */ + + void *pIfMetric; /* metric associate with this interface */ + void *pArea; /* pointer to area this interface connects */ + char sysIfName[IFNAMSIZ]; /* interface name, e.g. `en'' or ``lo'' */ + ushort_t sysIfIndex; /* numeric abbreviation for this interface */ + int sysIfFlags; /* interface flags */ + + ulong_t ospfv3IfIndex; /* index object */ + ulong_t ospfv3IfAreaId; /* read-create */ + mApiOspfv3IfType_t ospfv3IfType; /* read-create */ + mApiOspfv3Status_t ospfv3IfAdminStat; /* read-create */ + ulong_t ospfv3IfRtrPriority; /* read-create */ + ulong_t ospfv3IfTransitDelay; /* read-create */ + ulong_t ospfv3IfRetransInterval; /* read-create */ + ulong_t ospfv3IfHelloInterval; /* read-create */ + ulong_t ospfv3IfRtrDeadInterval; /* read-create */ + ulong_t ospfv3IfPollInterval; /* read-create */ + mApiOspfv3IfState_t ospfv3IfState; /* read-only */ + ulong_t ospfv3IfDesignatedRouter; /* read-only */ + ulong_t ospfv3IfBackupDesignatedRouter; /* read-only */ + ulong_t ospfv3IfEvents; /* read-only */ + mApiOspfv3RowStatus_t ospfv3IfStatus; /* read-create */ + ulong_t ospfv3IfMetricValue; /* read-create */ + ulong_t ospfv3IfLinkScopeLsaCount; /* read-only */ + ulong_t ospfv3IfLinkLsaCksumSum; /* read-only */ + ulong_t ospfv3IfInstId; /* read-create */ + + /* the following read-create objects are implemented as read-only */ + mApiOspfv3IfMcastType_t ospfv3IfMulticastForwarding; + mApiOspfv3TrueValue_t ospfv3IfDemand; +} mApiOspfv3If_t; + +/* objects associate with the ospfv3VirtIfTable */ +typedef struct mApiOspfv3VirtIf +{ + AVL_NODE node; /* AVL Tree node */ + void *pArea; /* pointer to transit area */ + rsAction_t createdAs; /* the method this row is created */ + + ulong_t ospfv3VirtIfAreaId; /* index object */ + ulong_t ospfv3VirtIfNeighbor; /* index object */ + ushort_t ospfv3VirtIfIndex; /* read-create */ + ulong_t ospfv3VirtIfTransitDelay; /* read-create */ + ulong_t ospfv3VirtIfRetransInterval; /* read-create */ + ulong_t ospfv3VirtIfHelloInterval; /* read-create */ + ulong_t ospfv3VirtIfRtrDeadInterval; /* read-create */ + mApiOspfv3VirtIfState_t ospfv3VirtIfState; /* read-only */ + ulong_t ospfv3VirtIfEvents; /* read-only */ + mApiOspfv3RowStatus_t ospfv3VirtIfStatus; /* read-create */ + ulong_t ospfv3VirtIfLinkScopeLsaCount; /* read-create */ + ulong_t ospfv3VirtIfLinkLsaksumSum; /* read-only */ + +} mApiOspfv3VirtIf_t; + + +/* objects associate with the ospfv3NbrTable */ +typedef struct mApiOspfv3Nbr +{ + AVL_NODE node; /* AVL Tree node */ + void *pIf; /* interface associated with */ + ushort_t ospfv3NbrIfIndex; /* index object */ + ulong_t ospfv3NbrRtrId; /* index object */ + inetAddressType_t ospfv3NbrAddressType; /* read-only */ + struct in6_addr ospfv3NbrAddress; /* read-only */ + ulong_t ospfv3NbrOptions; /* read-only */ + ulong_t ospfv3NbrPriority; /* read-create */ + mApiOspfv3NbrState_t ospfv3NbrState; /* read-only */ + ulong_t ospfv3NbrEvents; /* read-only */ + ulong_t ospfv3NbrLsRetransQLen; /* read-only */ + mApiOspfv3TrueValue_t ospfv3NbrHelloSuppressed; /* read-only */ + ulong_t ospfv3NbrIfId; /* read-only */ +} mApiOspfv3Nbr_t; + +/* objects associate with the ospfv3NbmaNbrTable */ +typedef struct mApiOspfv3NbmaNbr +{ + AVL_NODE node; /* AVL Tree node */ + void *pIf; /* interface associated with */ + rsAction_t createdAs; /* the method this row is created */ + + ushort_t ospfv3NbmaNbrIfIndex; /* index object */ + inetAddressType_t ospfv3NbmaNbrAddressType; /* index object */ + struct in6_addr ospfv3NbmaNbrAddress; /* index object */ + ulong_t ospfv3NbmaNbrPriority; /* read-create */ + ulong_t ospfv3NbmaNbrRtrId; /* read-only */ + mApiOspfv3NbrState_t ospfv3NbmaNbrState; /* read-only */ + mApiOspfv3NbrStorageType_t ospfv3NbmaNbrStorageType; /* read-create */ + mApiOspfv3RowStatus_t ospfv3NbmaNbrStatus; /* read-create */ +} mApiOspfv3NbmaNbr_t; + + +/* objects associate with the ospfv3VirtNbrTable */ +typedef struct mApiOspfv3VirtNbr +{ + AVL_NODE node; /* AVL Tree node */ + ulong_t ospfv3VirtNbrArea; /* index object */ + ulong_t ospfv3VirtNbrRtrId; /* index object */ + inetAddressType_t ospfv3VirtNbrAddressType; /* read-only */ + struct in6_addr ospfv3VirtNbrAddress; /* read-only */ + ulong_t ospfv3VirtNbrOptions; /* read-only */ + mApiOspfv3NbrState_t ospfv3VirtNbrState; /* read-only */ + ulong_t ospfv3VirtNbrEvents; /* read-only */ + ulong_t ospfv3VirtNbrLsRetransQLen; /* read-only */ + mApiOspfv3TrueValue_t ospfv3VirtNbrHelloSuppressed; /* read-only */ + ushort_t ospfv3VirtNbrIfId; /* read-only */ +} mApiOspfv3VirtNbr_t; + +/* objects associate with the ospfv3AreaAggregateTable */ +typedef struct mApiOspfv3AreaAggregate +{ + AVL_NODE node; /* AVL Tree node */ + void *pArea; /* area associated with */ + rsAction_t createdAs; /* the method this row is created */ + ulong_t ospfv3AreaAggregateAreaID; /* index object */ + mApiOspfv3LsdbType_t ospfv3AreaAggregateAreaLsdbType; /* index object */ + inetAddressType_t ospfv3AreaAggregatePrefixType; /* index object */ + struct in6_addr ospfv3AreaAggregatePrefix; /* index object */ + ulong_t ospfv3AreaAggregatePrefixLength; /* index object */ + mApiOspfv3RowStatus_t ospfv3AreaAggregateStatus; /* read-create */ + mApiOspfv3AreaAggregateEffect_t ospfv3AreaAggregateEffect; /* read-create */ +} mApiOspfv3AreaAggregate_t; + + +/* function pointer requires by ospfv3_mApi_avlTreeWalk() routine */ +typedef STATUS (* AVL_WALK_FUNC)(void *pNode, void *arg); + +/*************************************************************************************** + * Public Function Prototypes for Management Interface + */ + +/* ospfv3GeneralGroup helper routines */ + +IMPORT STATUS ospfv3_mApi_globalParmGet(mApiOspfv3GenGroup_t *thisGenGroup, + mApiRequest_t *pRequest, + mApiObject_t *pObject); + +IMPORT STATUS ospfv3_mApi_globalParmSet(mApiRequest_t *pRequest, + mApiObject_t *pObject, + mApiReqType_t reqType); + +/* ospfv3AreaTable helper routines */ + +IMPORT STATUS ospfv3_mApi_areaHelperGet( void *pRow, + mApiRequest_t *pRequest, + mApiObject_t *pObject ); + +IMPORT STATUS ospfv3_mApi_areaHelperSet(mApiRequest_t *pRequest, + rsRequest_t rsReqType ); + +IMPORT void ospfv3_mApi_areaHelperCreate( mApiOspfv3Area_t *pStaticArea ); + +IMPORT STATUS ospfv3_mApi_areaHelperRegisterIf( mApiOspfv3If_t *pIf, + int oldStatus ); +/* ospfv3AsLasbTable helper routine */ + +IMPORT STATUS ospfv3_mApi_as_lsdbHelperGet( void *pRow, + mApiRequest_t *pRequest, + mApiObject_t *pObject ); + +IMPORT STATUS ospfv3_mApi_area_lsdbHelperGet( void *pRow, + mApiRequest_t *pRequest, + mApiObject_t *pObject ); + +IMPORT STATUS ospfv3_mApi_link_lsdbHelperGet( void *pRow, + mApiRequest_t *pRequest, + mApiObject_t *pObject ); + +/* ospfv3IfTable helper routines */ + +IMPORT STATUS ospfv3_mApi_ifHelperGet( void *pRow, + mApiRequest_t *pRequest, + mApiObject_t *pObject ); + +IMPORT STATUS ospfv3_mApi_ifHelperSet(mApiRequest_t *pRequest, + rsRequest_t rsReqType ); + +IMPORT void ospfv3_mApi_ifHelperCreate( mApiOspfv3If_t *pStaticIf); + +IMPORT void ospfv3_mApi_ifHelperDelete( ulong_t ospfv3IfIpAddr ); + +/* ospfv3NbrTable helper routines */ + +IMPORT STATUS ospfv3_mApi_nbrHelperGet( void *pRow, + mApiRequest_t *pRequest, + mApiObject_t *pObject ); + +IMPORT STATUS ospfv3_mApi_nbrHelperRegister( mApiOspfv3Nbr_t *pNbr, ulong_t ospfv3IfIndex); +IMPORT void ospfv3_mApi_nbrHelperDeregister( mApiOspfv3Nbr_t *pNbr, ulong_t ospfv3IfIndex ); + + +/* common AVL compare routine */ + +IMPORT int ospfv3MapiOidCompare( int oidLength, + ulong_t *pOid1, + ulong_t *pOid2 ); + +int ospfv3Ipv6AddressCompare(struct in6_addr address1, struct in6_addr address2); + +/* misc AVL routines */ + +IMPORT STATUS ospfv3_mApi_avlTreeWalk( AVL_TREE * pRoot, + AVL_WALK_FUNC ospfv3MapiTreeWalk, + void *arg ); + +/* draft-ietf-ospf-ospfv3-mib-05 specific helper initialization routine */ + +IMPORT STATUS ospfv3_mApi_configurationGet( void ); +IMPORT void ospfv3_mApi_reset( void ); +IMPORT void ospfv3_mApi_initGeneralGroup( BOOL resetAllToDefault ); +IMPORT STATUS ospfv3_mApi_initRsLib(void); +IMPORT STATUS ospfv3_mApi_initAvlTree(void); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCospfv3MapiHelper_h */ diff --git a/h/wrn/ospfv3/ospfv3MapiHelperShow.h b/h/wrn/ospfv3/ospfv3MapiHelperShow.h new file mode 100644 index 0000000..881b7b2 --- /dev/null +++ b/h/wrn/ospfv3/ospfv3MapiHelperShow.h @@ -0,0 +1,85 @@ +/* ospfv3MapiHelperShow.h */ + +/* Copyright 2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,21aug03,agi ported to Accordion stack +01a,01nov02,xli Initial file created +*/ + +/* +DESCRIPTION + +This file contains the dispaly string used by ospfv3MapiHelperShow.c when +formatting the output. +*/ + +#ifndef _INCospfv3MapiHelperShow_h +#define _INCospfv3MapiHelperShow_h + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* row status display strings */ +char *ospfv3_rowStatus[] = { + "unknown", "active", "notInService", "notReady", "createAndGo", "createAndWait", + "destroy" +}; + +/* true value display strings */ +char *ospfv3_trueValue[] = { "unknown", "true", "false" }; + +/* status display strings */ +char *ospfv3_status[] = { "unknown", "enabled", "disabled" }; + +char *ospfv3_ifState[] = { + "unknown", "down", "loopback", "waiting", "pointToPoint", "DR", "backupDR", + "otherDR" +}; + +/* display strings for OSPFv3 interface type */ +char *ospfv3_ifType[] = { + "unknown", "broadcast", "nbma", "pointToPoint", "unknown", "pointToMultipoint" +}; + +/* display strings for OSPFv3 LSDB type */ +char *ospfv3_lsdbType[] = { + "unknown", "routerLink", "networkLink", "summaryLink", "asSummaryLink", + "asSummaryLink", "asExternalLink", "multicastLink", "nssaExternalLink" +}; + +/* display strings for OSPFv3 Neighbor state */ +char *ospfv3_nbrState[] = { + "unknown", "down", "attempt", "init", "twoWay", "exchangeStart", "exchange", + "loading", "full" +}; + + +char *ospfv3_asType[] = { + "unknown", "importExternal", "importNoExternal", "importNssa" +}; + +char *ospfv3_summaryType[] = { "unknown", "noAreaSummary", "sendAreaSummary" }; + +char *ospfv3_stubMetricType[] = { "unknown", "ospfv3Metric", "comparableCost", "nonComparable"}; + +char *ospfv3_mcastType[] = { "unknown", "blocked", "multicast", "unicast" }; + +char *ospfv3_permanence[] = { "unknown", "dynamic", "permanent" }; + +char *ospfv3_extType = "asExternalLink"; + +char *ospfv3_agType[] = { "unknown", "summaryLink", "nssaExternalLink" }; + +char *ospfv3_agEffect[] = { "unknown", "advertiseMatching", "doNotAdvertiseMatching"}; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _INCospfv3MapiHelperShow_h */ diff --git a/h/wrn/ospfv3/ospfv3MapiHelperUpdate.h b/h/wrn/ospfv3/ospfv3MapiHelperUpdate.h new file mode 100644 index 0000000..d4fe465 --- /dev/null +++ b/h/wrn/ospfv3/ospfv3MapiHelperUpdate.h @@ -0,0 +1,463 @@ +/* ospfv3MapiHelperUpdate.h - helper routines for OSPFv3 MIB API */ + +/* Copyright 2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01e,25jun04,xli added the ospfv3ToMapiReceive( void ) prototype + added global variable ospfv3_mapi_task_id +01d,28oct03,agi removed OSPFV3TOMAPI_TASK_PRIORITY +01d,28oct03,ram Modifications for traffic, aging, LSAs, & cleanup +01c,02jul03,agi Fixed compiler warning - comma at end of enumerator list + Fixed copyright +01b,20jan03,xli Add OSPFv3 specific update request types + valueBuf[] usage explanation and MibHelperUpdate + routine declaration +01a,07nov02,xli Initial file creation. +*/ + +/* +DESCRIPTION: + +This file contains the functional prototypes for OSPFv3 MIB helper routines. +*/ + +#ifndef __INCospfv3MibHelperUpdate_h +#define __INCospfv3MibHelperUpdate_h + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +int ospfv3_mapi_task_id; + +/* this is the function pointer pointed to a system dependent save routine for saving + * the given object to the nvram. + */ +typedef STATUS (* OSPFV3_NVRAM_SAVE_FUNCPTR) + ( + ulong_t *pInstance, /* pointer to OID instance array */ + ushort_t instanceLen, /* number of sub-ids in instance */ + ulong_t oidPrefixEnum, /* enum value for object OID Prefix */ + void *pValueBuf, /* pointer to value buffer */ + ulong_t valueLen /* value byte length */ + ); + +/* this is the function pointer pointed to a system dependent delete routine for + * deleting a table row from nvram. + */ +typedef STATUS (* OSPFV3_NVRAM_DELETE_FUNCPTR) + ( + ulong_t *pInstance, /* pointer to OID instance array */ + ushort_t instanceLen /* number of sub-ids in instance */ + ); + +/* this is the function pointer pointed to a system dependent retrieve routine for + * retrieving all prevously saved OSPFv3 configuration from nvram. The retrieve routine + * must invoke the MIB API for read-create objects in each ospfv3 table with the + * mApiRequest_t set to MAPI_NVM_SET request type so that MIB API can repopulate its + * management database at system startup. + */ + +typedef STATUS (* OSPFV3_NVRAM_RETRIEVE_FUNCPTR) (void ); + +/* define the configuration type uses by the underlying OSPFv3 protocol */ +typedef enum { + + /* the following enumeration types are used by OSPFv3 to update the statistical + * and operational status + */ + ospfv3GenGroupUpdateReqType = 1, /* update General Group read-only variables */ + ospfv3AreaUpdateReqType, /* update an ospfv3 area instance */ + ospfv3AsLsdbUpdateReqType, /* update an ospfv3 as_lsdb instance */ + ospfv3AreaLsdbUpdateReqType, /* update an ospfv3 area_lsdb instance */ + ospfv3LinkLsdbUpdateReqType, /* update an ospfv3 link_lsdb instance */ + ospfv3HostUpdateReqType, /* update an ospfv3 host instance */ + ospfv3IfUpdateReqType, /* update an ospfv3 interface instance */ + ospfv3VirtIfUpdateReqType, /* update an ospfv3 virtual interface instance */ + ospfv3NbrUpdateReqType, /* update an ospfv3 neighbor instance */ + ospfv3NbmaNbrUpdateReqType, /* update an ospfv3 Nbma neighbor instance */ + ospfv3VirtNbrUpdateReqType, /* update an ospfv3 virtual neighbor instance */ + ospfv3AreaAggregateUpdateReqType, /* update an ospfv3 Area Aggregate instance */ + + /* the following enumeration types are used by OSPFv3 to create new instance of link + * state database + */ + ospfv3AsLsdbCreateReqType, /* create an instance of as_lsdb */ + ospfv3AreaLsdbCreateReqType, /* create an instance of area_lsdb */ + ospfv3LinkLsdbCreateReqType, /* create an instance of link_lsdb */ + + /* the following enumeration types are used by OSPFv3 to delete an instance of a + * particular table from MIB API + */ + ospfv3AsLsdbDeleteReqType, /* delete an ospfv3 as_lsdb instance */ + ospfv3AreaLsdbDeleteReqType, /* delete an ospfv3 area_lsdb instance */ + ospfv3LinkLsdbDeleteReqType, /* delete an ospfv3 link_lsdb instance */ + ospfv3NbrDeleteReqType, /* delete an ospfv3 nbr instance */ + ospfv3NbmaNbrDeleteReqType, /* delete an ospfv3 Nbma nbr instance */ + ospfv3VirtNbrDeleteReqType, /* delete an ospfv3 virtual neighbor instance */ + + /* the following enumeration types are used by OSPFv3 to create an instance of + * ospfv3 area, host,interface, or virtual interface in MIB API during startup. + * These enumeration types are for backward compatibility to support the static + * configuration methodology. It shall not be used by any aother applications. + */ + + ospfv3GenGroupCreateReqType, /* setup ospfv3 General Group scalar objects */ + ospfv3AreaCreateReqType, /* create an instance of ospfv3 area */ + ospfv3HostCreateReqType, /* create an instance of ospfv3 host interface */ + ospfv3IfCreateReqType, /* create an instance of ospfv3 interface */ + ospfv3VirtIfCreateReq, /* create an instance of ospfv3 virtual interface */ + ospfv3AreaAggregateCreateReq, /* create an instance of ospfv3 area aggregate */ + + /* this is a special request type from ospfv3 to notify MIB API that OSPFv3 is halted */ + ospfv3ShutdownReqType, + + ospfv3IfChangeReqType, /* interface flag change event */ + ospfv3IfDeleteReqType /* interface address deleted event */ + + /* the following enumeration types are used by OSPFv3 to create an instance of + * wrn-ospfv3 interface during startup. These enumeration types are for backward + * compatibility to support the static configuration methodology. It shall not + * be used by any aother applications. These enumeration types will eventually + * be obsolote + */ +} ospfv3ToMapiReqType_t; + + +/* ospfv3ToMapiReqBuf_t structure is a generic data structure used internally by + * OSPFv3 protocol to provide operational status and statistics updates to the + * MIB API. In order to maintain backward compatibility with the existing static + * configuration methodology, this data structure is also used by OSPFv3 protocol + * at init time to update the Management Database for any configuration that are + * statically created. This involves creating the ospfv3 area, host, interface, + * virtual interface, etc. instances in the Management Database. The + * ospfv3ToMapiReqBuf_t data structure is initialized in the ospfv3ToMapi_request() + * function (invoked by the OSPFv3 protocol). Using this data strcuture, the OSPFv3 + * protocol can provide the necessary updates to the OSPFv3 MIB API asynchronously, + * thus, minimize the disruption to the overall OSPFv3 operation. Due to the multi-usage + * of the ospfv3ToMapiReqBuf_t data structure, the representation of the data structure + * is highly depending on the type of request (defined as ospfv3ToMapiReqType_t + * enumeration type). The following is the representation of the ospfv3ToMapiReqBuf_t + * data structure for each ospfv3ToMapiReqType_t request type: + * + * ospfv3GeneralGroup (reqType = ospfv3GenGroupCreateReqType) + * valueBuf[0] = the value of ospfv3RouterId read-write object + * valueBuf[1] = the value of ospfv3AdminStat read-write object + * valueBuf[2] = the value of ospfv3ASBdrRtrStatus read-write object + * valueBuf[3] = the value of ospfv3ExtAreaLsdbLimit read-write object + * valueBuf[4] = the value of ospfv3ExitOverflowInterval read-write object + * valueBuf[5] = the value of ospfv3DemandExtensions read-write object + * valueBuf[6] = the value of ospfv3TrafficEngineeringSupport read-write object + * wrnospfv3GeneralGroup (reqType = ospfv3GenGroupCreateReqType) + * valueBuf[7] = the value of wrnOspfv3RedistributeDefaultRoutes read-write object + * valueBuf[8] = the value of wrnOspfv3RedistributeStaticRoutes read-write object + * valueBuf[9] = the value of wrnOspfv3RedistributeRIPRoutes read-write object + * valueBuf[10] = the value of wrnOspfv3RedistributeBGPRoutes read-write object + * + * ospfv3GeneralGroup (reqType = ospfv3GenGroupUpdateReqType ) + * valueBuf[0] = the value of ospfv3ExternLsaCount read-only object + * valueBuf[1] = the value of ospfv3ExternLsaCksumSum read-only object + * valueBuf[2] = the value of ospfv3OriginateNewLsas read-only object + * valueBuf[3] = the value of ospfv3RxNewLsas read-only object + * valueBuf[4] to valueBuf[14] = not used + * pValueBuf = the value of ospfv3MulticastExtension read-write object + * + + * ospfv3AreaTable (reqType = ospfv3AreaCreateReqType): + * valueBuf[0] = the value of ospfv3AreaId index object + * valueBuf[1] = the value of ospfv3ImportAsExtern read-create object + * valueBuf[2] = the value of ospfv3AreaSummary read-create object + * valueBuf[3] = the value of ospfv3StubMetric read-create object + * valueBuf[4] = the value of ospfv3AreaNssaTranslatorRole read-create object + * valueBuf[5] = the value of ospfv3AreaNssaTranslatorState read-create object + * valueBuf[6] = the value of ospfv3AreaNssaTranslatorStabilityInterval read-create object + * valueBuf[7] to valueBuf[14] = not used + * pValueBuf = not use + * + * ospfv3AreaTable (reqType = ospfv3AreaUpdateReqType) + * valueBuf[0] = the value of ospfv3AreaId index object + * valueBuf[1] = the value of ospfv3SpfRuns read-only object + * valueBuf[2] = the value of ospfv3AreaBdrRtrCount read-only object + * valueBuf[3] = the value of ospfv3AsBdrRtrCount read-only object + * valueBuf[4] = the value of ospfv3AreaScopeLsaCount read-only object + * valueBuf[5] = the value of ospfv3AreaScopeLsaCksumSum read-only object + * valueBuf[6] = the value of ospfv3AreaNssaTranslatorState read-only object + * valueBuf[7] = the value of ospfv3AreaNssaTranslatorEvents read-only object + * valueBuf[8] to valueBuf[14] = not used + * pValueBuf = not use + * + * ospfv3AsLsdbTable (reqType = ospfv3AsLsdbUpdateReqType): + * valueBuf[0] = the value of ospfv3AsLsdbType index object + * valueBuf[1] = the value of ospfv3AsLsdbRouterId index object + * valueBuf[2] = the value of ospfv3AsLsdbLsid index object + * valueBuf[3] = the value of ospfv3AsLsdbSequence read-only object + * valueBuf[4] = the value of ospfv3AsLsdbAge read-only object + * + * ospfv3AsLsdbTable (reqType = ospfv3AsLsdbCreateReqType): + * valueBuf[0] = the value of ospfv3AsLsdbType index object + * valueBuf[1] = the value of ospfv3AsLsdbRouterId index object + * valueBuf[2] = the value of ospfv3AsLsdbLsid index object + * valueBuf[3] = the value of ospfv3AsLsdbSequence read-only object + * valueBuf[4] = the value of ospfv3AsLsdbAge read-only object + * valueBuf[5] = the value of ospfv3AsLsdbChecksum read-only object + * valueBuf[6] = the value of AsLsdbLen (not a MIB object) + * valueBuf[7] and valueBuf[14] = not used + * pValueBuf = pointer to the ospfv3AsLsdbAdvertisement read-only object + * + * ospfv3AsLsdbTable (reqType = ospfv3AsLsdbDeleteReqType) + * valueBuf[0] = the value of ospfv3AsLsdbType index object + * valueBuf[1] = the value of ospfv3AsLsdbRouterId index object + * valueBuf[2] = the value of ospfv3AsLsdbLsid index object + * valueBuf[3] and valueBuf[14] = not used + * pValueBuf = not use + + * ospfv3AreaLsdbTable (reqType = ospfv3AreaLsdbUpdateReqType) + * valueBuf[0] = the value of ospfv3AreaLsdbAreaId index object + * valueBuf[1] = the value of ospfv3AreaLsdbType index object + * valueBuf[2] = the value of ospfv3AreaLsdbRouterId index object + * valueBuf[3] = the value of ospfv3AreaLsdbLsid index object + * valueBuf[4] = the value of ospfv3AreaLsdbSequence read-only object + * valueBuf[5] = the value of ospfv3AreaLsdbAge read-only object + * + * ospfv3AreaLsdbTable (reqType = ospfv3AreaLsdbCreateReqType) + * valueBuf[0] = the value of ospfv3AreaLsdbAreaId index object + * valueBuf[1] = the value of ospfv3AreaLsdbType index object + * valueBuf[2] = the value of ospfv3AreaLsdbRouterId index object + * valueBuf[3] = the value of ospfv3AreaLsdbLsid index object + * valueBuf[4] = the value of ospfv3AreaLsdbSequence read-only object + * valueBuf[5] = the value of ospfv3AreaLsdbAge read-only object + * valueBuf[6] = the value of ospfv3AreaLsdbChecksum read-only object + * valueBuf[7] = the value of areaLsdbLen (not a MIB object) + * valueBuf[8] and valueBuf[14] = not used + * pValueBuf = pointer to the ospfv3AreaLsdbAdvertisement read-only object + * + * ospfv3AreaLsdbTable (reqType = ospfv3AreaLsdbDeleteReqType) + * valueBuf[0] = the value of ospfv3AreaLsdbType index object + * valueBuf[1] = the value of ospfv3AreaLsdbRouterId index object + * valueBuf[2] = the value of ospfv3AreaLsdbLsid index object + * valueBuf[3] and valueBuf[14] = not used + * pValueBuf = not use + + * ospfv3LinkLsdbTable (reqType = ospfv3LinkLsdbUpdateReqType) + * valueBuf[0] = the value of ospfv3LinkLsdbIfIndex index object + * valueBuf[1] = the value of ospfv3LinkLsdbType index object + * valueBuf[2] = the value of ospfv3LinkLsdbRouterId index object + * valueBuf[3] = the value of ospfv3LsdbLinkLsid index object + * valueBuf[4] = the value of ospfv3LinkLsdbSequence read-only object + * valueBuf[5] = the value of ospfv3LinkLsdbAge read-only object + * + * ospfv3LinkLsdbTable (reqType = ospfv3LinkLsdbCreateReqType) + * valueBuf[0] = the value of ospfv3LinkLsdbIfIndex index object + * valueBuf[1] = the value of ospfv3LinkLsdbType index object + * valueBuf[2] = the value of ospfv3LinkLsdbRouterId index object + * valueBuf[3] = the value of ospfv3LinkLsdbLsid index object + * valueBuf[4] = the value of ospfv3LinkLsdbSequence read-only object + * valueBuf[5] = the value of ospfv3LinkLsdbAge read-only object + * valueBuf[6] = the value of ospfv3LinkLsdbChecksum read-only object + * valueBuf[7] = the value of linkLsdbLen (not a MIB object) + * valueBuf[8] and valueBuf[14] = not used + * pValueBuf = pointer to the ospfv3LinkLsdbAdvertisement read-only object + * + * ospfv3LinkLsdbTable (reqType = ospfv3LinkLsdbDeleteReqType) + * valueBuf[0] = the value of ospfv3LinkLsdbIfIndex index object + * valueBuf[1] = the value of ospfv3LinkLsdbType index object + * valueBuf[2] = the value of ospfv3LinkLsdbRouterId index object + * valueBuf[3] = the value of ospfv3LinkLsdbLsid index object + * valueBuf[4] and valueBuf[14] = not used + * pValueBuf = not use + + * ospfv3HostTable (reqType = ospfv3HostCreateReqType): + * valueBuf[0] = the value of ospfv3HostAddressType index object + * valueBuf[1] = the value of ospfv3HostAddress index object + * valueBuf[2] = the value of ospfv3HostMetric read-create object + * valueBuf[3] = the value of ospfv3HostStatus read-create object + * valueBuf[4] = the value of ospfv3HostAreaId read-only object + * valueBuf[5] = interface netmask as defined by ospfv3 protocol + * valueBuf[6] = interface mtu as defined by ospfv3 protocol + * valueBuf[7] to valueBuf[14] = not used + * pValueBuf = not use + * + * ospfv3IfTable (reqType = ospfv3IfUpdateReqType): + * valueBuf[0] = the value of ospfv3IfIndex index object + * valueBuf[1] = the value of ospfv3IfState read-only object + * valueBuf[2] = the value of ospfv3IfDesignatedRouter read-only object + * valueBuf[3] = the value of ospfv3IfBackupDesignatedRouter read-only object + * valueBuf[4] = the value of ospfv3IfEvents read-only object + * valueBuf[5] = the value of ospfv3IfLinkScopeLsaCount read-only object + * valueBuf[6] = the value of ospfv3IfLinkLsaCksumSum read-only object + * valueBuf[7] to valueBuf[14] = not used + * pValueBuf = not use + * + * ospfv3IfTable (reqType = ospfv3IfCreateReqType) + * valueBuf[0] = the value of ospfv3IfIndex index object + * valieBuf[1] = the value of ospfv3IfAreaId read-create object + * valueBuf[2] = the value of ospfv3IfType read-create object + * valueBuf[3] = the value of ospfv3IfAdminStat read-create object + * valueBuf[4] = the value of ospfv3IfRtrPriority read-create object + * valueBuf[5] = the value of ospfv3IfTransitDelay read-create object + * valueBuf[6] = the value of ospfv3IfRetransInterval read-create object + * valueBuf[7] = the value of ospfv3IfHelloInterval read-create object + * valueBuf[8] = the value of ospfv3IfRtrDeadInterval read-create object + * valueBuf[9] = the value of ospfv3IfPollInterval read-create object + * valueBuf[10] = the value of ospfv3IfStatus read-create object + * valueBuf[11] = the value of ospfv3IfMulticastForwarding read-create object + * valueBuf[12] = the value of ospfv3IfDemand read-create object + * valueBuf[13] = the value of ospfv3IfMetricValue read-create object + * valueBuf[14] = the value of ospfv3IfInstId read-create object + * valueBuf[15] = the value of the interface mtu size + * pValueBuf = the value of the interface subnet mask + * + * ospfv3VirtIfTable (reqType = ospfv3VirtIfUpdateReqType): + * valueBuf[0] = the value of ospfv3VirtIfAreaId index object + * valueBuf[1] = the value of ospfv3VirtIfNeighbor index object + * valueBuf[2] = the value of ospfv3VirtIfState read-only object + * valueBuf[3] = the value of ospfv3VirtIfEvents read-only object + * valueBuf[4] = the value of ospfv3VirtIfLinkScopeLsaCount read-only object + * valueBuf[5] = the value of ospfv3VirtIfLinkLsaCksumSum read-only object + * valueBuf[6] to valueBuf[14] = not used + * pValueBuf = not use + * + * ospfv3VirtIfTable (reqType = ospfv3VirtIfCreateReq) + * valueBuf[0] = the value of ospfv3VirtIfAreaId index object + * valueBuf[1] = the value of ospfv3VirtIfNeighbor index object + * valieBuf[2] = the value of ospfv3VirtIfTransitDelay read-create object + * valueBuf[3] = the value of ospfv3VirtIfRetransInterval read-create object + * valueBuf[4] = the value of ospfv3VirtIfHelloInterval read-create object + * valueBuf[5] = the value of ospfv3VirtIfRtrDeadInterval read-create object + * valueBuf[7] = the value of ospfv3VirtIfStatus read-create object + * valueBuf[8] to valueBuf[14] = not used + * pValueBuf = not use + * + * ospfv3NbrTable (reqType = ospfv3NbrUpdateReqType): + * valueBuf[0] = the value of ospfv3NbrIfIndex index object + * valueBuf[1] = the value of ospfv3NbrRtrId read-only object + * valueBuf[2] = the value of ospfv3NbrAddressType read-only objecta + * pValueBuf = the value of ospfv3NbrAddress read-only objecta + * valueBuf[3] = the value of ospfv3NbrOptions read-only object + * valueBuf[4] = the value of ospfv3NbrPriority read-only object + * valueBuf[5] = the value of ospfv3NbrState read-only object + * valueBuf[6] = the value of ospfv3NbrEvents read-only object + * valueBuf[7] = the value of ospfv3NbrLsRetransQLen read-only object + * valueBuf[8] = the value of ospfv3NbrHelloSuppressed read-only object + * valueBuf[9] = the value of ospfv3NbrIfId read-only object + * valueBuf[10] and valueBuf[14] = not used + * pValueBuf = the value of the ospfv3NbrAddress + * + * ospfv3NbrTable (reqType = ospfv3NbrDeleteReqType) + * valueBuf[0] = the value of ospfv3NbrIfIndex index object + * valueBuf[1] = the value of ospfv3NbrRtrId index object + * valueBuf[2] to valueBuf[14] = not used + * pValueBuf = not use + * + * ospfv3NbmaNbrTable (reqType = ospfv3NbmaNbrUpdateReqType): + * valueBuf[0] = the value of ospfv3NbmaNbrIfIndex index object + * valueBuf[1] = the value of ospfv3NbmaNbrAddressType index object + * valueBuf[2] = the value of ospfv3NbmaNbrRtrId read-only object + * valueBuf[3] = the value of ospfv3NbmaNbrState read-only object + * valueBuf[4] and valueBuf[14] = not used + * pValueBuf = the value of the ospfv3NbmaNbrAddress + * + * ospfv3NbrTable (reqType = ospfv3NbrDeleteReqType) + * valueBuf[0] = the value of ospfv3NbrIfIndex index object + * valueBuf[1] = the value of ospfv3NbrAddressType index object + * valueBuf[2] to valueBuf[14] = not used + * pValueBuf = the value of the ospfv3NbmaNbrAddress + * + * ospfv3VirtNbrTable (reqType = ospfv3VirtNbrUpdateReqType): + * valueBuf[0] = the value of ospfv3VirtNbrArea index object + * valueBuf[1] = the value of ospfv3VirtNbrRtrId index object + * valueBuf[2] = the value of ospfv3VirtNbIfIndex read-only object + * valueBuf[3] = the value of ospfv3VirtNbrAddressType read-only object + * valueBuf[4] = the value of ospfv3VirtNbrOptions read-only object + * valueBuf[5] = the value of ospfv3VirtNbrState read-only object + * valueBuf[6] = the value of ospfv3VirtNbrEvents read-only object + * valueBuf[7] = the value of ospfv3VirtNbrLSRetransQLen read-only object + * valueBuf[8] = the value of ospfv3VirtNbrHelloSuppressed read-only object + * valueBuf[9] = the value of ospfv3VirtNbrIfId read-only object + * valueBuf[10] and valueBuf[14] = not used + * pValueBuf = the value of the ospfv3VirtNbrAddress + * + * ospfv3VirtNbrTable (reqType = ospfv3VirtNbrDeleteReqType) + * valueBuf[0] = the value of ospfv3VirtNbrArea index object + * valueBuf[1] = the value of ospfv3VirtNbrRtrId index object + * valueBuf[2] and valueBuf[14] = not used + * pValueBuf = not use + * + * ospfv3AreaAggregateTable (reqType = ospfv3AreaAggregateCreateReq ) + * valueBuf[0] = the value of ospfv3AreaAggregateAreaID index object + * valueBuf[1] = the value of ospfv3AreaAggregateAreaLsdbType index object + * valueBuf[2] = the value of ospfv3AreaAggregatePrefixType index object + * valueBuf[3] = the value of ospfv3AreaAggregatePrefixLength index object + * valueBuf[4] = the value of ospfv3AreaAggregateEffect read-create object + * valueBuf[5] = the value of ospfv3AreaAggregateStatus read-create object + * valueBuf[6] and valueBuf[14] = not used + * pValueBuf = pointer to the ospfv3AreaAggregatePrefix + * + * shutdown notification from ospfv3 (reqType = ospfv3ShutdownReqType) + * valueBuf[0] = EmApiOspfv3_disabled + * valueBuf[1] to valueBuf[14] = not use + * pValueBuf = not use + * + * interface flag change notification from ospfv3 (reqType = ospfv3IfChangeReqType) + * valueBuf[0] = the value of ospfv3IfIndex index object + * valueBuf[1] = interface index value (from struct ifnet) + * valueBuf[2] = interface flags (from struct ifnet) + * valueBuf[3] to valueBuf[14] = not use + * pValueBuf = not use + * + * interface address deleted notification from ospfv3 (reqType = ospfv3IfDeleteReqType) + * valueBuf[0] = the value of ospfv3IfIndex index object + * valueBuf[1] = interface index value (from struct ifnet) + * valueBuf[2] to valueBuf[14] = not use + * pValueBuf = not use + * + */ +typedef struct ospfv3ToMapiReqBuf +{ + NODE node; /* linked list node */ + ospfv3ToMapiReqType_t reqType; /* request type issued by ospfv3 protocol */ + ulong_t valueBuf[15]; /* value buffer */ + char *pValueBuf; /* pointer to data larger than sizeof(ulong_t) */ +} ospfv3ToMapiReqBuf_t; + +typedef struct ospfv3ToMapiSysCtl +{ + ushort_t if_index; /* interface index (from struct ifnet) */ + void *pCtlData; /* control data, specific to the request message */ +} ospfv3ToMapiSysCtl_t; + +void ospfv3ToMapiReceive( void ); + +/* prototypes for functions used by MIB API to dynamically reconfigure OSPFv3 */ +IMPORT STATUS mApi2Ospfv3_configGenGroup( void *pGenParams ); +IMPORT STATUS mApi2Ospfv3_configArea( mApiRequest_t *pRequest ); +IMPORT STATUS mApi2Ospfv3_configIf( mApiRequest_t *pRequest ); + +IMPORT STATUS mApi2Ospfv3_deleteArea( void *pRow ); +IMPORT STATUS mApi2Ospfv3_deleteIf( void *pRow ); + +/* prototypes for functions used by OSPFv3 for operational status statistic updates */ +IMPORT void ospfv3ToMapi_request( void *pObjInfo, ospfv3ToMapiReqType_t reqType ); + +/* prototypes for functions used by OSPFv3 for registration and de-registration */ +IMPORT STATUS ospfv3ToMapi_proto_register( void ); +IMPORT void ospfv3ToMapi_proto_deregister( void ); + +/* prototype for function used by OSPFv3 to retrieve ospfv3 configuration from MIB API */ +IMPORT STATUS ospfv3ToMapi_query_config( BOOL *readStaticConfig ); + +/* misc prototypes used by MIB API only */ +IMPORT STATUS ospfv3ToMapi_init( int numOspfv3ReqBufCnt ); + +/* Show routine */ +IMPORT STATUS ospfv3ToMapi_show( void ); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __INCospfv3MibHelperUpdate_h */ diff --git a/h/wrn/ospfv3/ospfv3MapiWrnHelper.h b/h/wrn/ospfv3/ospfv3MapiWrnHelper.h new file mode 100644 index 0000000..0b439a2 --- /dev/null +++ b/h/wrn/ospfv3/ospfv3MapiWrnHelper.h @@ -0,0 +1,88 @@ +/* ospfv3MapiWrnHelper.h - header file for WindNet OSPFv3 Enterprise MIB */ + +/* Copyright 2004 Wind River, Inc. */ +#include "copyright_wrs.h" + +/* + * modification history + * -------------------- + * 01b,25jan03,xli Add WRN OSPFv3 interprise MIB specific changes + * 01a,15nov02,xli Initial file creation. + */ + +/* +DESCRIPTION +This file defines the WindNet OSPFv3 Enterprise MIB specific +Management Interface local ID enumerations, the MIB object +enumerations, the MIB object sizes and some function prototypes. + +INCLUDE FILES: N/A +*/ + +#ifndef __INCospfv3MapiWrnHelper_h +#define __INCospfv3MapiWrnHelper_h + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Defines */ + +/* the following defines provides the number of sub-identifier + * (the instance length) of each table in the WRN OSPFv3 Enterprise MIB. + */ +#define OSPFV3_LOCAL_LSDB_INSTANCE_LEN 17 +#define OSPFV3_WRN_INTF_INSTANCE_LEN 4 + +/***************************************************************************** +* Management Interface Local ID enumerations for WindNet OSPFv3 Enterprise MIB. +*/ +typedef enum { + mApiWrnOspfv3RedistributeDefaultRoutes = 1, + mApiWrnOspfv3RedistributeStaticRoutes, + mApiWrnOspfv3RedistributeRIPRoutes, + mApiWrnOspfv3RedistributeBGPRoutes + +} mApiWrnOspfv3_t; + +/**************************************************************************** +* Management Interface WindNet OSPFv3 Enterprise MIB Data Structure. +*/ +typedef struct mApiWrnOspfv3GenGroup +{ + mApiOspfv3TrueValue_t wrnOspfv3RedistributeDefaultRoutes; /* read-write */ + mApiOspfv3TrueValue_t wrnOspfv3RedistributeStaticRoutes; /* read-write */ + mApiOspfv3TrueValue_t wrnOspfv3RedistributeRIPRoutes; /* read-write */ + mApiOspfv3TrueValue_t wrnOspfv3RedistributeBGPRoutes; /* read-write */ + +} mApiWrnOspfv3GenGroup_t; + +/**************************************************************************** +* Management Interface WindNet OSPFv3 Enterprise MIB Function Prototypes. +*/ + +/* wrnOspfv3GeneralGroup helper routines */ +IMPORT STATUS wrnOspfv3_mApi_globalParmGet( + mApiWrnOspfv3GenGroup_t *thisGenGroup, + mApiRequest_t *pRequest, + mApiObject_t *pObject ); + +IMPORT STATUS wrnOspfv3_mApi_globalParmSet( mApiRequest_t *pRequest, + mApiObject_t *pObject, + mApiReqType_t reqType ); +IMPORT STATUS mApi2Ospfv3_configWrnGenGroup( void *pGenParams ); + +IMPORT void mApi2Ospfv3_configRedistributeOpts( void *pGenParams ); + +/* wrn-ospfv3 mib specific initialization routines */ +IMPORT STATUS wrnOspfv3_mApi_initAvlTree( void ); + +IMPORT void wrnOspfv3_mApi_initGeneralGroup( BOOL resetAllToDefault ); + +IMPORT STATUS wrnOspfv3_mApi_initRsLib( void ); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCospfv3MapiWrnHelper_h */ diff --git a/h/wrn/ospfv3/ospfv3Memory.h b/h/wrn/ospfv3/ospfv3Memory.h new file mode 100644 index 0000000..e60e29e --- /dev/null +++ b/h/wrn/ospfv3/ospfv3Memory.h @@ -0,0 +1,49 @@ +/* ospfv3Memory.h - OSPFv3 memory header file */ + +/* Copyright 2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,08apr04,ram OSPF v2/v3 coexistance compile +01a,06apr04,ram Initial cration +*/ + +#ifndef __INCospfv3Memoryh +#define __INCospfv3Memoryh + +#ifdef __cplusplus +extern "C" { +#endif + +#define OSPFV3_PARTMEM_LARGE_SIZE (2048 * 1024) /* 2M Preferred initial memory partition size * 2 Megs */ +#define OSPFV3_PARTMEM_SMALL_SIZE (128 * 1024) /* Alternate Initial memory partition size */ + +/* OSPF memory partition defintions */ +/* Undefine older memory macros */ + +#if defined (table_malloc) +#undef table_malloc +#endif +#if defined (table_free) +#undef table_free +#endif + + +/* Define new memory macros */ +#define OSPFV3_PARTMEM_CREATE ospfMemPartCreate +#define OSPFV3_PARTMEM_DELETE ospfMemPartDelete(ospfv3MemPartId) +#define OSPFV3_PARTMEM_EXPAND(size) ospfMemPartExpand(ospfv3MemPartId,size) + +#define OSPFV3_PARTMEM_OPTION(option) ospfMemPartSetOptions(ospfv3MemPartId,option) +#define OSPFV3_PARTMEM_SHOW(option) ospfMemPartShow(ospfv3MemPartId,option) + +#define table_malloc(units,size) ospfMemPartAlloc(ospfv3MemPartId,size) +#define table_free(ptr) ospfMemPartFree(ospfv3MemPartId,(void*)ptr) + +#ifdef __cplusplus +} +#endif + +#endif /* __INCospfv3Memoryh */ diff --git a/h/wrn/ospfv3/ospfv3NeighborStateMachine.h b/h/wrn/ospfv3/ospfv3NeighborStateMachine.h new file mode 100644 index 0000000..30990b9 --- /dev/null +++ b/h/wrn/ospfv3/ospfv3NeighborStateMachine.h @@ -0,0 +1,239 @@ +/* ospfv3NeighborStateMachine.h - OSPFv3 neighbor state machine header file */ + +/* Copyright 2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01b,14nov02,agi first pass at clean-up +01a,23oct02,agi written +*/ + +#ifndef __INCospfv3NeighborStateMachineh +#define __INCospfv3NeighborStateMachineh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include + +/* typedefs */ + +typedef void (*NEIGHBOR_TRANSITION_FUNCTION) + ( + OSPFV3_INTERFACE *sptr_interface, + OSPFV3_NEIGHBOR *sptr_neighbor, + enum OSPFV3_NEIGHBOR_EVENT event + ); + +typedef struct +{ + NEIGHBOR_TRANSITION_FUNCTION fptr_neighbor_transition_function; +} OSPFV3_NEIGHBOR_STATE_MACHINE; + +/* OSPFv3 neighbor state machine */ + +OSPFV3_NEIGHBOR_STATE_MACHINE ospfv3_neighbor_event_processing_table + [OSPFV3_NUMBER_OF_NEIGHBOR_EVENTS][OSPFV3_NUMBER_OF_NEIGHBOR_STATES] = +{ +/* -------------------------------------------------------------------------- */ +/* OSPFV3_HELLO_RECEIVED 0 */ +/* -------------------------------------------------------------------------- */ +{ +/* OSPFV3_NEIGHBOR_DOWN */ +{(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_hello_received_event}, +/* OSPFV3_NEIGHBOR_ATTEMPT */ +{(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_hello_received_event}, +/* OSPFV3_NEIGHBOR_INITIALIZING */ +{(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_hello_received_event}, +/* OSPFV3_NEIGHBOR_2_WAY */ +{(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_hello_received_event}, +/* OSPFV3_NEIGHBOR_EXCHANGE_START */ +{(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_hello_received_event}, +/* OSPFV3_NEIGHBOR_EXCHANGE */ +{(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_hello_received_event}, +/* OSPFV3_NEIGHBOR_LOADING */ +{(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_hello_received_event}, +/* OSPFV3_NEIGHBOR_FULL */ +{(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_hello_received_event} +}, + +/* -------------------------------------------------------------------------- */ +/* OSPFV3_START 1 */ +/* -------------------------------------------------------------------------- */ +{ +/* OSPFV3_NEIGHBOR_DOWN */ +{(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_start_event}, +/* OSPFV3_NEIGHBOR_ATTEMPT */ +{NULL}, +/* OSPFV3_NEIGHBOR_INITIALIZING */ +{NULL}, +/* OSPFV3_NEIGHBOR_2_WAY */ +{NULL}, +/* OSPFV3_NEIGHBOR_EXCHANGE_START */ +{NULL}, +/* OSPFV3_NEIGHBOR_EXCHANGE */ +{NULL}, +/* OSPFV3_NEIGHBOR_LOADING */ +{NULL}, +/* OSPFV3_NEIGHBOR_FULL */ +{NULL} +}, + +/* -------------------------------------------------------------------------- */ +/* OSPFV3_TWO_WAY_RECEIVED 2 */ +/* -------------------------------------------------------------------------- */ +{ +/* OSPFV3_NEIGHBOR_DOWN */ +{NULL}, +/* OSPFV3_NEIGHBOR_ATTEMPT */ +{NULL}, +/* OSPFV3_NEIGHBOR_INITIALIZING */ +{(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_2_way_received_event}, +/* OSPFV3_NEIGHBOR_2_WAY */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_2_way_received_event} /* ### */, +/* OSPFV3_NEIGHBOR_EXCHANGE_START */ {NULL}, +/* OSPFV3_NEIGHBOR_EXCHANGE */ {NULL}, +/* OSPFV3_NEIGHBOR_LOADING */ {NULL}, +/* OSPFV3_NEIGHBOR_FULL */ {NULL} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPFV3_NEGOTIATION_DONE 3 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPFV3_NEIGHBOR_DOWN */ {NULL}, +/* OSPFV3_NEIGHBOR_ATTEMPT */ {NULL}, +/* OSPFV3_NEIGHBOR_INITIALIZING */ {NULL}, +/* OSPFV3_NEIGHBOR_2_WAY */ {NULL}, +/* OSPFV3_NEIGHBOR_EXCHANGE_START */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_negotiation_done_event}, +/* OSPFV3_NEIGHBOR_EXCHANGE */ {NULL}, +/* OSPFV3_NEIGHBOR_LOADING */ {NULL}, +/* OSPFV3_NEIGHBOR_FULL */ {NULL} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPFV3_EXCHANGE_DONE 4 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPFV3_NEIGHBOR_DOWN */ {NULL}, +/* OSPFV3_NEIGHBOR_ATTEMPT */ {NULL}, +/* OSPFV3_NEIGHBOR_INITIALIZING */ {NULL}, +/* OSPFV3_NEIGHBOR_2_WAY */ {NULL}, +/* OSPFV3_NEIGHBOR_EXCHANGE_START */ {NULL}, +/* OSPFV3_NEIGHBOR_EXCHANGE */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_exchange_done_event}, +/* OSPFV3_NEIGHBOR_LOADING */ {NULL}, +/* OSPFV3_NEIGHBOR_FULL */ {NULL} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPFV3_BAD_LINK_STATE_REQUEST 5 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPFV3_NEIGHBOR_DOWN */ {NULL}, +/* OSPFV3_NEIGHBOR_ATTEMPT */ {NULL}, +/* OSPFV3_NEIGHBOR_INITIALIZING */ {NULL}, +/* OSPFV3_NEIGHBOR_2_WAY */ {NULL}, +/* OSPFV3_NEIGHBOR_EXCHANGE_START */ {NULL}, +/* OSPFV3_NEIGHBOR_EXCHANGE */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_tear_down_and_reestablish_adjacency}, +/* OSPFV3_NEIGHBOR_LOADING */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_tear_down_and_reestablish_adjacency}, +/* OSPFV3_NEIGHBOR_FULL */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_tear_down_and_reestablish_adjacency} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPFV3_LOADING_DONE 6 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPFV3_NEIGHBOR_DOWN */ {NULL}, +/* OSPFV3_NEIGHBOR_ATTEMPT */ {NULL}, +/* OSPFV3_NEIGHBOR_INITIALIZING */ {NULL}, +/* OSPFV3_NEIGHBOR_2_WAY */ {NULL}, +/* OSPFV3_NEIGHBOR_EXCHANGE_START */ {NULL}, +/* OSPFV3_NEIGHBOR_EXCHANGE */ {NULL}, +/* OSPFV3_NEIGHBOR_LOADING */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_loading_done_event}, +/* OSPFV3_NEIGHBOR_FULL */ {NULL} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPFV3_ADJACENCY_OK 7 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPFV3_NEIGHBOR_DOWN */ {NULL}, +/* OSPFV3_NEIGHBOR_ATTEMPT */ {NULL}, +/* OSPFV3_NEIGHBOR_INITIALIZING */ {NULL}, +/* OSPFV3_NEIGHBOR_2_WAY */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_start_forming_an_adjacency_with_the_neighbor}, +/* OSPFV3_NEIGHBOR_EXCHANGE_START */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_maintain_or_destroy_existing_adjacency}, +/* OSPFV3_NEIGHBOR_EXCHANGE */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_maintain_or_destroy_existing_adjacency}, +/* OSPFV3_NEIGHBOR_LOADING */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_maintain_or_destroy_existing_adjacency}, +/* OSPFV3_NEIGHBOR_FULL */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_maintain_or_destroy_existing_adjacency} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPFV3_SEQUENCE_NUMBER_MISMATCH 8 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPFV3_NEIGHBOR_DOWN */ {NULL}, +/* OSPFV3_NEIGHBOR_ATTEMPT */ {NULL}, +/* OSPFV3_NEIGHBOR_INITIALIZING */ {NULL}, +/* OSPFV3_NEIGHBOR_2_WAY */ {NULL}, +/* OSPFV3_NEIGHBOR_EXCHANGE_START */ {NULL}, +/* OSPFV3_NEIGHBOR_EXCHANGE */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_tear_down_and_reestablish_adjacency}, +/* OSPFV3_NEIGHBOR_LOADING */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_tear_down_and_reestablish_adjacency}, +/* OSPFV3_NEIGHBOR_FULL */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_tear_down_and_reestablish_adjacency} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPFV3_ONE_WAY 9 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPFV3_NEIGHBOR_DOWN */ {NULL}, +/* OSPFV3_NEIGHBOR_ATTEMPT */ {NULL}, +/* OSPFV3_NEIGHBOR_INITIALIZING */ {NULL}, +/* OSPFV3_NEIGHBOR_2_WAY */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_1_way_received_event}, +/* OSPFV3_NEIGHBOR_EXCHANGE_START */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_1_way_received_event}, +/* OSPFV3_NEIGHBOR_EXCHANGE */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_1_way_received_event}, +/* OSPFV3_NEIGHBOR_LOADING */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_1_way_received_event}, +/* OSPFV3_NEIGHBOR_FULL */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_1_way_received_event} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPFV3_KILL_NEIGHBOR 10 */ +/* -------------------------------------------------------------------------- */ +{ +/* OSPFV3_NEIGHBOR_DOWN */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_down_event}, +/* OSPFV3_NEIGHBOR_ATTEMPT */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_down_event}, +/* OSPFV3_NEIGHBOR_INITIALIZING */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_down_event}, +/* OSPFV3_NEIGHBOR_2_WAY */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_down_event}, +/* OSPFV3_NEIGHBOR_EXCHANGE_START */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_down_event}, +/* OSPFV3_NEIGHBOR_EXCHANGE */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_down_event}, +/* OSPFV3_NEIGHBOR_LOADING */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_down_event}, +/* OSPFV3_NEIGHBOR_FULL */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_down_event} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPFV3_INACTIVITY_TIMER 11 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPFV3_NEIGHBOR_DOWN */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_down_event}, +/* OSPFV3_NEIGHBOR_ATTEMPT */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_down_event}, +/* OSPFV3_NEIGHBOR_INITIALIZING */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_down_event}, +/* OSPFV3_NEIGHBOR_2_WAY */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_down_event}, +/* OSPFV3_NEIGHBOR_EXCHANGE_START */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_down_event}, +/* OSPFV3_NEIGHBOR_EXCHANGE */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_down_event}, +/* OSPFV3_NEIGHBOR_LOADING */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_down_event}, +/* OSPFV3_NEIGHBOR_FULL */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_down_event} +}, +/* ------------------------------------------------------------------------------------------------------------------ */ +/* OSPFV3_DOWN_INDICATION_FROM_LOWER_LEVEL_PROTOCOLS_RECEIVED 12 */ +/* ------------------------------------------------------------------------------------------------------------------ */ +{ +/* OSPFV3_NEIGHBOR_DOWN */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_down_event}, +/* OSPFV3_NEIGHBOR_ATTEMPT */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_down_event}, +/* OSPFV3_NEIGHBOR_INITIALIZING */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_down_event}, +/* OSPFV3_NEIGHBOR_2_WAY */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_down_event}, +/* OSPFV3_NEIGHBOR_EXCHANGE_START */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_down_event}, +/* OSPFV3_NEIGHBOR_EXCHANGE */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_down_event}, +/* OSPFV3_NEIGHBOR_LOADING */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_down_event}, +/* OSPFV3_NEIGHBOR_FULL */ {(NEIGHBOR_TRANSITION_FUNCTION) ospfv3_process_neighbor_down_event} +} +}; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCospfv3NeighborStateMachineh */ diff --git a/h/wrn/ospfv3/ospfv3Prototypes.h b/h/wrn/ospfv3/ospfv3Prototypes.h new file mode 100644 index 0000000..1514942 --- /dev/null +++ b/h/wrn/ospfv3/ospfv3Prototypes.h @@ -0,0 +1,1393 @@ +/* ospfv3Prototypes.h - OSPFv3 prototypes header file */ + +/* Copyright 2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +02v,10dec04,tlu OSPF stack decoupling (interface) +02u,06may04,xli ospfv3_init has no params for non FTP +02t,06may04,ram Fix for AVL memory corruption +02s,29apr04,ram Fix compile warnings +02r,22apr04,ram AVL & Memory migration to shared library +02q,14apr04,ram Performance optimization changes +02p,13apr04,ram OSPFv3 Routing Table Hash Modifications +02o,13apr04,ram LSDB AVL modifications +02n,12apr04,ram Memory and AVL modifications +02m,08apr04,ram OSPF v2/v3 coexistance compile +02l,31mar04,dsk Modifications for OSPFv3 ANVL conformance +02k,11mar04,dsk Modifications for OSPFv3 ANVL conformance +02j,16dec03,ram Mods per type 3 & 4 testing +02i,04dec03,ram Mods for LSA type 3 & 4, general modification, and show commands +02h,27nov03,dsk Mods according to integration testing +02g,21nov03,dsk Mods for type 9 LSAs +02f,18nov03,agi fixed compiler warning +02e,18nov03,agi added ospfv3_get_prefix_length_in_bytes() prototype +02d,17nov03,dsk Mods according to integr testing +02c,08nov03,dsk Mods according to integr testing +02b,06nov03,ram Modifications for external routes +02a,06nov03,dsk Mods for type 5 lsas with var length address prefix +01z,04nov03,dsk Modifications for type 8 and type 9 LSAs +01y,31oct03,ram Modifications for mapi, traffic, & show +01x,28oct03,agi updated ospfv3LsdbShow.c prototypes +01w,21oct03,ram Modifications for adjacency establishment +01v,17oct03,ram Modifications for memory corruption, traffic, & debug output +01u,16oct03,dsk added prototypes for new OSPFv3 LSAs origination +01t,10oct03,ram Modifications for LSDB, dynamic config, & NSSA cleanup +01s,07oct03,agi changed ospfv3OriginateASingleSummaryLsa() to + ospfv3OriginateSummaryLsaForASingleRoutingTableEntry() +01r,07oct03,agi changed ospfv3_get_next_prefix() to + ospfv3_get_next_prefix_in_prefix_list() +01p,25sep03,ram Second general modifications submission +01o,16sep03,dsk added ospfv3_print_prefix +01n,29jul03,ram Added sockets, processing, and external route changes +01n,29jul03,dsk added prototypes for LSA aggregation +01m,16jul03,dsk added function ospfv3_get_lsdb_index to map hash tables to lsa types +01l,03jun03,agi updated parameter changes in database entry related functions +01k,29may03,dsk added prototypes for new functions: + for comparing LSAs, routes, prefixes, prefix lists, prefixes, subnets, + for walking LSA mixed aggregate, for building prefix list of routing table entry, + for utilities related to routing table computation and lookup, + for prioritized hello processing (processing of backlog queue) + for LSA early retransmission filter mechanism (SPR 88619) + for lookup of IPv6 address within range of prefix, + for replacing rwos get elapsed time function with vxWorks functions, + for route updates transmission OSPF to RS via socket + for generating unique link IDs of LSAs in aggregates, + cleanup (removed unused functions) +01j,07mar03,dsk added prototypes for find and show functions, also for routing table prototype +01i,21feb03,dsk byte_order changes (store in host byte order) +01h,18feb03,dsk ported from OSPFv2 to OSPFv3 structures +01g,28jan03,agi updated ospfv3_set_intervening_router() prototype +01i,27jan03,agi added ospfv3IPv6AddrToDotFormat() prototype +01h,24jan03,htm added changes for IPv6 +01g,23jan03,agi fixed previous submission of older file version +01f,16jan03,agi updated more prototypes, + removed ospfv3_find_network_LSA() prototype +01e,14jan03,agi changed ospfv3Utils.c prototypes +01d,13jan03,agi propogated SPR#85432, 83418 fixes from OSPFv2 +01c,23dec02,agi propogated TMS code merge for SPR#84284 + added ospf_find_router_or_network_routing_table_node() + added prototypes for ospf_notify_areas_for_abr_change() + ospf_flush_network_link_advertisement() SPR#84478, 84485, 84486 +01b,14nov02,agi first pass at clean-up +01a,23oct02,agi written +*/ + +#ifndef __INCospfv3Prototypesh +#define __INCospfv3Prototypesh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include +#include + + +/* function prototypes */ + +/**********************************/ +/* ospfv3AcknowledgementReceive.c */ +/**********************************/ + +enum OSPFV3_PACKET_STATE ospfv3_ls_acknowledgement_packet_received + ( OSPFV3_LS_ACKNOWLEDGEMENT_HEADER *sptr_acknowledgement_packet, + OSPFV3_NEIGHBOR *sptr_neighbor, + OSPFV3_INTERFACE *sptr_interface, + ULONG size_of_packet ); + + + +/*******************/ +/* ospfv3_checksum.c */ +/*******************/ + +USHORT ospfv3_generate_LS_checksum + ( void * vptr_data, + USHORT length_of_data, + BYTE * bptr_checksum); + +STATUS ospfv3_verify_LS_checksum + ( void * vptr_data, + USHORT length_of_data /* in network order */, + USHORT checksum); + + +/************************/ +/* ospfv3Cfg.c */ +/************************/ + +void ospfv3_cfg (void); + + +/************************/ +/* ospfv3CfgRoutines.c */ +/************************/ + +#if defined (__OSPFV3_PASSIVE_INTERFACE__) + +STATUS ospfv3SetPassiveMode ( char *commands ); + +STATUS ospfv3SetPassivePort + ( char *cptr_ip_address_string, enum OSPFV3_MODE mode ); +#endif /* (__OSPFV3_PASSIVE_INTERFACE__) */ + +STATUS ospfv3SetTotalAreaAddressRange ( ULONG total_number_area_ranges ); + +void ospfv3_cfg_routines_stub (); + + +/**************************/ +/* ospfv3_configuration.c */ +/*************************/ + +STATUS ospfv3_set_default_values (char *cptr_value_string); + +STATUS ospfv3_set_router_id (char *cptr_value_string); + +STATUS ospfv3_set_tos_capability (char *cptr_value_string); + +STATUS ospfv3_set_asbr (char *cptr_value_string); + +STATUS ospfv3_set_multicast (char *cptr_value_string); + +STATUS ospfv3_set_number_of_areas (char *cptr_value_string); + +STATUS ospfv3_set_area_id (char *cptr_value_string); + +STATUS ospfv3_set_number_of_area_address_range (char *cptr_value_string); + +STATUS ospfv3_set_area_address_range_address (char *cptr_value_string); + +STATUS ospfv3_set_area_address_range_length (char *cptr_value_string); + +STATUS ospfv3_set_area_address_range_enable (char *cptr_value_string); + +STATUS ospfv3_set_area_address_range_area_id (char *cptr_value_string); + +STATUS ospfv3_set_area_external_routing_capability (char *cptr_value_string); + +STATUS ospfv3_set_area_stub_inject_default_route (char *cptr_value_string); + +STATUS ospfv3_set_area_stub_cost (char *cptr_value_string); + +STATUS ospfv3_set_number_of_ports (char *cptr_value_string); + +STATUS ospfv3_set_port_enable (char *cptr_value_string); + +STATUS ospfv3_set_port_index (char *cptr_value_string); + +STATUS ospfv3_set_port_nbma_neighbor_address (char *cptr_value_string); + +STATUS ospfv3_set_port_nbma_neighbor_id (char *cptr_value_string); + +STATUS ospfv3_set_port_area_id (char *cptr_value_string); + +STATUS ospfv3_set_port_type (char *cptr_value_string); + +STATUS ospfv3_set_port_transit_area_id (char *cptr_value_string); + +STATUS ospfv3_set_port_source_area_id (char *cptr_value_string); + +STATUS ospfv3_set_port_router_dead_interval (char *cptr_value_string); + +STATUS ospfv3_set_port_transmit_delay (char *cptr_value_string); + +STATUS ospfv3_set_port_priority (char *cptr_value_string); + +STATUS ospfv3_set_port_cost (char *cptr_value_string); + +STATUS ospfv3_set_port_hello_interval (char *cptr_value_string); + +STATUS ospfv3_set_port_neighbor_router_id (char *cptr_value_string); + +STATUS ospfv3_set_port_poll_interval (char *cptr_value_string); + +STATUS ospfv3_set_port_retxmt_interval (char *cptr_value_string); + +STATUS ospfv3_set_port_passive (char *cptr_value_string); + +STATUS ospfv3_set_port_passive_all (char *cptr_value_string); + +STATUS ospfv3_set_printf (char *cptr_value_string); + +STATUS ospfv3_set_printf_interface (char *cptr_value_string); + +STATUS ospfv3_set_printf_neighbor (char *cptr_value_string); + +STATUS ospfv3_set_printf_memory (char *cptr_value_string); + +STATUS ospfv3_set_printf_alarm (char *cptr_value_string); + +STATUS ospfv3_set_printf_snmp (char *cptr_value_string); + +STATUS ospfv3_set_printf_packet (char *cptr_value_string); + +STATUS ospfv3_set_printf_hello_packet (char *cptr_value_string); + +STATUS ospfv3_set_printf_dd_packet (char *cptr_value_string); + +STATUS ospfv3_set_printf_ls_request_packet (char *cptr_value_string); + +STATUS ospfv3_set_printf_ls_update_packet (char *cptr_value_string); + +STATUS ospfv3_set_printf_ls_ack_packet (char *cptr_value_string); + +STATUS ospfv3_set_printf_routing_table (char *cptr_value_string); + +STATUS ospfv3_set_printf_debug (char *cptr_value_string); + +STATUS ospfv3_set_printf_rtm (char *cptr_value_string); + +STATUS ospfv3_set_printf_prologue (char *cptr_value_string); + +STATUS ospfv3_set_printf_db_overflow (char *cptr_value_string); + +STATUS ospfv3_set_bgp_redistribute_all (char *cptr_value_string); + +STATUS ospfv3_set_rip_redistribute_all (char *cptr_value_string); + +STATUS ospfv3_set_static_redistribute_all (char *cptr_value_string); + +STATUS ospfv3_set_default_redistribute (char *cptr_value_string); + +STATUS ospfv3_set_bgp_subnets_to_redistribute (char *cptr_value_string); + +STATUS ospfv3_set_rip_subnets_to_redistribute (char *cptr_value_string); + +STATUS ospfv3_set_static_subnets_to_redistribute (char *cptr_value_string); + +STATUS ospfv3_set_point_to_point_lsa_option (char *cptr_value_string); + +#ifdef __OSPFV3_DB_OVERFLOW_SUPPORT__ +STATUS ospfv3_set_external_lsdb_limit (char *cptr_value_string); + +STATUS ospfv3_set_exit_overflow_interval (char *cptr_value_string); +#endif /*__OSPFV3_DB_OVERFLOW_SUPPORT__*/ + +STATUS ospfv3_set_max_lsa_deleted (char *cptr_value_string); + +#ifdef __UNNUMBERED_LINK__ /* -bt- */ +STATUS ospfv3_set_unnumbered_dest_ip(char *cptr_value_string); +#endif /* __UNNUMBERED_LINK__ -bt- */ + + +/******************/ +/* ospfv3_control.c */ +/******************/ + +void ospfv3_halt_ospfv3_router (void); + +STATUS ospfv3_control + ( enum PROTOCOL_CONTROL_OPERATION command, + ULONG parameter_0,ULONG parameter_1 ); + +void ospfv3_shut_down_ospfv3_router (void); + + +/***************************/ +/* ospfv3_database_summary.c */ +/***************************/ + +enum OSPFV3_RETURN_FLAGS ospfv3_build_ls_database_summary + ( OSPFV3_INTERFACE *sptr_interface,OSPFV3_NEIGHBOR *sptr_neighbor); + +OSPFV3_LS_DATABASE_SUMMARY *ospfv3_allocate_ls_database_summary + (OSPFV3_INTERFACE *sptr_interface); + +void ospfv3_free_ls_database_summary + (OSPFV3_LS_DATABASE_SUMMARY *sptr_database_summary); + + +/*************************************/ +/* ospfv3_designated_router_election.c */ +/*************************************/ + +void ospfv3_run_designated_router_election (OSPFV3_INTERFACE *sptr_interface); + +/*******************/ +/* ospfv3_dijkstra.c */ +/*******************/ + +void ospfv3_run_dijkstra (OSPFV3_AREA_ENTRY *sptr_area); + +void ospfv3_bring_up_virtual_links_if_necessary (OSPFV3_AREA_ENTRY *sptr_area); + +void ospfv3_set_intervening_router + ( OSPFV3_SHORTEST_PATH_NODE *sptr_vertex_V, + OSPFV3_SHORTEST_PATH_NODE *sptr_vertex_W, + OSPFV3_AREA_ENTRY* sptr_area ); + + +/***************************/ +/* ospfv3EntryInitialize.c */ +/***************************/ + +STATUS ospfv3_task_initialize (const char *p_configuration_file); + + +/*************************************/ +/* ospfv3_external_routes.c */ +/*************************************/ + +void ospfv3_process_external_route_to_ospf (); + +void ospfv3_add_exported_route_to_ospf + ( struct in6_addr * destination_network, + ULONG network_mask, + ULONG metric, + struct in6_addr * forwarding_address, + ULONG tag, + ULONG proto); + +void ospfv3_delete_exported_route_from_ospf + ( struct in6_addr *destination_network, + ULONG network_mask, + ULONG metric, + struct in6_addr *forwarding_address, + ULONG tag, + ULONG proto); + +/***********************************/ +/* ospfv3ExternalRoutesCalculate.c */ +/***********************************/ + +void ospfv3_calculate_routes_to_external_destinations (void); + +void ospfv3_calculate_routes_to_a_single_external_destination + ( UNION_OSPFV3_LINK_STATE_ADVERTISEMENT *advertisement, + enum BOOLEAN on_new_external_lsa_received_path ); + +void ospfv3_invalidate_external_route_entry + ( OSPFV3_EXTERNAL_LINK_ADVERTISEMENT_HEADER *sptr_external ); + +/*****************/ +/* ospfv3Flood.c */ +/*****************/ + +enum BOOLEAN ospfv3_flood_advertisement_out_some_subset_of_the_routers_interfaces + (OSPFV3_ROUTER_LINK_ADVERTISEMENT_HEADER *sptr_advertisement, + OSPFV3_AREA_ENTRY *sptr_area, + OSPFV3_INTERFACE *sptr_interface, + OSPFV3_INTERFACE *sptr_interface_advertisement_received_on, + OSPFV3_NEIGHBOR *sptr_neighbor_advertisement_received_from, + enum BOOLEAN advertisement_installed ); + +enum BOOLEAN ospfv3_update_ls_request_list_for_this_adjacency( + OSPFV3_ROUTER_LINK_ADVERTISEMENT_HEADER *sptr_advertisement, + OSPFV3_NEIGHBOR *sptr_neighbor); + +/*****************/ +/* ospfv3Hello.c */ +/*****************/ + +void ospfv3_send_hello + ( OSPFV3_INTERFACE *sptr_interface, + OSPFV3_NEIGHBOR *sptr_neighbor, + enum BOOLEAN goingdown ); + +enum OSPFV3_PACKET_STATE ospfv3_hello_packet_received + ( OSPFV3_HELLO_HEADER *sptr_hello, + OSPFV3_NEIGHBOR *sptr_new_neighbor, + OSPFV3_INTERFACE *sptr_interface, + struct in6_addr *source_address, + ULONG router_id, + ULONG size_of_packet, + ULONG cryptographic_sequence_number); + +void ospfv3_set_neighbor_fields + ( OSPFV3_NEIGHBOR *sptr_neighbor, + ULONG router_id, + struct in6_addr *address, + ULONG cryptographic_sequence_number, + OSPFV3_INTERFACE *sptr_interface, + USHORT priority, + UNION_OSPFV3_OPTIONS options, + enum OSPFV3_NEIGHBOR_STATE state, + ULONG neighbor_intf_id); + + +/**************************/ +/* ospfv3Initialize.c */ +/**************************/ + +STATUS ospfv3_initialize_router ( ULONG clock_ticks_per_second ); + +void ospfv3_put_an_interface_on_areas_interface_list + ( OSPFV3_AREA_ENTRY *sptr_area, OSPFV3_INTERFACE *sptr_interface ); + +void ospfv3_multicast_group_request + ( int ifIndex, struct in6_addr *multicastAddr, int request ); + +STATUS ospfv3_add_entry_to_hosts_list + ( OSPFV3_INTERFACE *sptr_interface, OSPFV3_IPV6_ADDR_PREFIX_LINKS *sptr_prefix, BOOL dynamic ); + +STATUS ospfv3_add_entry_to_virtual_link_list + ( OSPFV3_INTERFACE *sptr_interface, BOOL dynamic ); + +OSPFV3_AREA_ENTRY* ospfv3_create_pseudo_area_for_virtual_link + ( OSPFV3_INTERFACE *sptr_interface ); + +void ospfv3Shutdown (); +void ospfv3Restart (); +void ospfShowOspfTid (); + +void ospfv3_initialize_interfaces (void); + +/***********************************/ +/* ospfv3InterAreaRouteCalculate.c */ +/***********************************/ + +void ospfv3_calculate_inter_area_routes (OSPFV3_AREA_ENTRY *sptr_area); + +enum BOOLEAN ospfv3_calculate_inter_area_routes_for_a_single_summary_advertisement + (OSPFV3_ADVERTISEMENT_NODE *sptr_advertisement_node, + OSPFV3_AREA_ENTRY *sptr_area, + enum BOOLEAN new_summary_lsa_received); + +void ospfv3_invalidate_inter_area_route_entry + ( OSPFV3_INTER_AREA_PREFIX_LSA_HEADER *sptr_advertisement_node, + OSPFV3_AREA_ENTRY *sptr_area ); + + +/********************/ +/* ospfv3Interface.c */ +/********************/ + +void ospfv3_bring_up_interface (OSPFV3_INTERFACE *sptr_interface); + +void ospfv3_initialize_interface + ( OSPFV3_INTERFACE *sptr_interface, BOOL dynamic ); + +STATUS ospfv3_check_if_status ( unsigned short if_index ); +STATUS ospfv3_is_if_unnumbered_up ( OSPFV3_INTERFACE *sptr_interface ); + + +/***************************/ +/* ospfv3InterfaceEvents.c */ +/***************************/ + +void ospfv3_process_interface_up_event ( OSPFV3_INTERFACE *sptr_interface ); + +void ospfv3_process_interface_wait_timer_event + ( OSPFV3_INTERFACE *sptr_interface ); + +void ospfv3_process_interface_backup_seen_event + ( OSPFV3_INTERFACE *sptr_interface ); + +void ospfv3_process_interface_neighbor_change_event + ( OSPFV3_INTERFACE *sptr_interface ); + +void ospfv3_process_interface_loop_indication_event + ( OSPFV3_INTERFACE *sptr_interface ); + +void ospfv3_process_interface_unloop_indication_event + ( OSPFV3_INTERFACE *sptr_interface ); + +void ospfv3_process_interface_down_event (OSPFV3_INTERFACE *sptr_interface); + +void ospfv3_reset_interface_variables_and_timers_and_destroy_all_associated_neighbor_connections + ( OSPFV3_INTERFACE *sptr_interface, + enum OSPFV3_INTERFACE_EVENT event, + enum OSPFV3_INTERFACE_STATE new_state ); + +void ospfv3_interface_address_delete(USHORT if_index, struct in6_addr *if_addr, + BOOL linkLocal); +void ospfv3_interface_address_add(USHORT if_index, struct in6_addr *if_addr, + ULONG if_mask, BOOL linkLocal); +void ospfv3_interface_flag_change(USHORT if_index, ULONG if_flags); + +/**********************************/ +/* ospfv3InterfaceStateMachine.c */ +/**********************************/ + +void ospfv3_execute_interface_state_machine + ( enum OSPFV3_INTERFACE_EVENT event, + enum OSPFV3_INTERFACE_STATE state, + OSPFV3_INTERFACE *sptr_interface ); + + +/***********************************/ +/* ospfv3LinkStateAdvertisements.c */ +/***********************************/ + +void ospfv3_originate_new_instance_of_the_link_state_advertisement + (OSPFV3_LS_DATABASE_ENTRY *sptr_database_entry, + OSPFV3_AREA_ENTRY *sptr_area, + OSPFV3_INTERFACE *sptr_interface, + enum BOOLEAN first_pass_external); +void ospfv3OriginateRouterLsa (OSPFV3_AREA_ENTRY *sptr_area); +STATUS ospfv3OriginateNetworkLsa (OSPFV3_INTERFACE *sptr_interface); +void ospfv3OriginateSummaryLsa (OSPFV3_AREA_ENTRY *sptr_area); +void ospfv3OriginateSummaryLsaForASingleRoutingTableEntry ( + OSPFV3_ROUTING_TABLE_ENTRY * sptr_routing_table_entry, + OSPFV3_AREA_ENTRY * sptr_area, + enum BOOLEAN prematurely_age_advertisement); +void ospfv3OriginateDefaultSummaryLinkIntoArea (OSPFV3_AREA_ENTRY *sptr_area); +void ospfv3OriginateExternalLsa (OSPFV3_EXTERNAL_ROUTE *sptr_external_route); +OSPFV3_ROUTER_LSA_LINK * ospfv3RetrieveRouterLsaInternal ( + enum OSPFV3_SEARCH_TYPE key, ULONG key_value, ULONG area_id); +STATUS ospfv3OriginateLinkLsa (OSPFV3_INTERFACE * sptr_interface); +STATUS ospfv3OriginateIntraAreaPrefixLsa (OSPFV3_INTERFACE * sptr_interface); +BOOLEAN ospfv3_verify_if_type9_already_originated( + OSPFV3_INTRA_AREA_PREFIX_LSA_HEADER * sptr_type9_lsa, + OSPFV3_AREA_ENTRY *sptr_area, + OSPFV3_INTERFACE *sptr_interface); +BOOLEAN ospfv3_compare_prefixes(UNION_OSPFV3_ADVERTISEMENT_HEADER * sptr_lsa1, + UNION_OSPFV3_ADVERTISEMENT_HEADER * sptr_lsa2); + + + +/*****************************/ +/* ospfv3LinkStateDatabase.c */ +/*****************************/ + +OSPFV3_LS_DATABASE_ENTRY *ospfv3_install_a_new_advertisement_in_the_link_state_database + (OSPFV3_LS_DATABASE_ENTRY *sptr_old_instance, + UNION_OSPFV3_LINK_STATE_ADVERTISEMENT *sptr_advertisement, + OSPFV3_AREA_ENTRY * sptr_area, + OSPFV3_INTERFACE *sptr_interface, + STATUS* different_lsa); + +OSPFV3_LS_DATABASE_ENTRY * ospfv3_find_originated_lsa + ( + OSPFV3_AREA_ENTRY *sptr_area, + OSPFV3_INTERFACE *sptr_interface, + ULONG id, + ULONG destination_router_id, + struct in6_addr *sptr_prefix, + ULONG prefix_length, + BYTE_ENUM (OSPFV3_LS_TYPE) type); + +OSPFV3_LS_DATABASE_ENTRY * ospfv3_find_lsa + (OSPFV3_AREA_ENTRY *sptr_area, + OSPFV3_INTERFACE *sptr_interface, + ULONG id, ULONG advertising_router, + BYTE_ENUM(OSPFV3_LS_TYPE) type); + +void ospfv3_free_database_entry (OSPFV3_LS_DATABASE_ENTRY *sptr_database_entry); + +STATUS ospfv3_check_if_previous_instance_exists + (OSPFV3_LS_DATABASE_ENTRY *sptr_old_instance); + +STATUS ospfv3_check_if_new_advertisement_is_different_from_its_previous_instance ( + UNION_OSPFV3_LINK_STATE_ADVERTISEMENT *sptr_advertisement, + OSPFV3_LS_DATABASE_ENTRY *sptr_old_instance); + +void ospfv3_flush_link_scope_link_state_database (void); + +void ospfv3_flush_as_scope_link_state_database (void); + +void ospfv3_flush_area_scope_link_state_database (void); + +void ospfv3_flush_the_link_state_database_of_self_originated_external_lsa (); + +OSPFV3_LS_DATABASE_HEAD * ospfv3FindLsaDatabaseHead ( + OSPFV3_ROUTER_LINK_ADVERTISEMENT_HEADER * sptr_advertisement, + OSPFV3_AREA_ENTRY * sptr_area, + OSPFV3_INTERFACE *sptr_interface); + +void ospfv3AggregateLsa ( + OSPFV3_LS_DATABASE_ENTRY * sptr_database_entry); + +void ospfv3DeaggregateLsa ( + OSPFV3_LS_DATABASE_ENTRY * sptr_database_entry); + + +OSPFV3_LS_DATABASE_ENTRY * ospfv3_get_first_router_lsa_of_aggregate ( + OSPFV3_AREA_ENTRY *sptr_area, ULONG advertising_router); + +OSPFV3_LS_DATABASE_ENTRY * ospfv3_get_first_intra_area_prefix_lsa_of_aggregate ( + OSPFV3_LS_DATABASE_ENTRY *sptr_net_or_rtr_lsa, + OSPFV3_AREA_ENTRY * sptr_area); + +OSPFV3_LS_DATABASE_ENTRY * ospfv3_find_first_intra_area_prefix_lsa( + OSPFV3_AREA_ENTRY *sptr_area, + USHORT referenced_ls_type, + ULONG referenced_link_state_id, + ULONG referenced_adv_router); + +OSPFV3_LS_DATABASE_ENTRY * ospfv3_find_first_router_lsa( + OSPFV3_AREA_ENTRY *sptr_area, ULONG advertising_router); + +OSPFV3_LS_DATABASE_ENTRY * ospfv3_find_next_intra_area_prefix_lsa( + OSPFV3_LS_DATABASE_ENTRY * sptr_database_entry); + +OSPFV3_LS_DATABASE_ENTRY * ospfv3_find_next_router_lsa( + OSPFV3_LS_DATABASE_ENTRY * sptr_lsa); + + +OSPFV3_LS_DATABASE_ENTRY* ospfv3_get_next_lsa_of_aggregate ( + OSPFV3_LS_DATABASE_ENTRY *sptr_lsa); + +OSPFV3_LS_DATABASE_ENTRY * ospfv3_get_first_lsa_of_aggregate( + OSPFV3_LS_DATABASE_ENTRY *sptr_lsa); + +void ospfv3_verify_aggregate(OSPFV3_LS_DATABASE_ENTRY* sptr_lsa); + +OSPFV3_LS_DATABASE_ENTRY * ospfv3_find_next_intra_area_prefix_lsa( + OSPFV3_LS_DATABASE_ENTRY * sptr_lsa); + +OSPFV3_LS_DATABASE_ENTRY * ospfv3_find_next_router_lsa( + OSPFV3_LS_DATABASE_ENTRY * sptr_lsa); + +int ospfv3AvlLsdbCompare(AVL_NODE *node,void* key); + +/**************************/ +/* ospfv3_neighbor_events.c */ +/**************************/ + +void ospfv3_process_neighbor_hello_received_event + (OSPFV3_INTERFACE *sptr_interface, + OSPFV3_NEIGHBOR *sptr_neighbor, + enum OSPFV3_NEIGHBOR_EVENT event); + +void ospfv3_process_neighbor_start_event + (OSPFV3_INTERFACE *sptr_interface, + OSPFV3_NEIGHBOR *sptr_neighbor, + enum OSPFV3_NEIGHBOR_EVENT event); + +void ospfv3_process_neighbor_2_way_received_event (OSPFV3_INTERFACE *sptr_interface,OSPFV3_NEIGHBOR *sptr_neighbor,enum OSPFV3_NEIGHBOR_EVENT event); +void ospfv3_process_neighbor_negotiation_done_event (OSPFV3_INTERFACE *sptr_interface,OSPFV3_NEIGHBOR *sptr_neighbor,enum OSPFV3_NEIGHBOR_EVENT event); +void ospfv3_process_neighbor_exchange_done_event (OSPFV3_INTERFACE *sptr_interface,OSPFV3_NEIGHBOR *sptr_neighbor,enum OSPFV3_NEIGHBOR_EVENT event); +void ospfv3_process_neighbor_loading_done_event (OSPFV3_INTERFACE *sptr_interface,OSPFV3_NEIGHBOR *sptr_neighbor,enum OSPFV3_NEIGHBOR_EVENT event); +void ospfv3_start_forming_an_adjacency_with_the_neighbor (OSPFV3_INTERFACE *sptr_interface,OSPFV3_NEIGHBOR *sptr_neighbor,enum OSPFV3_NEIGHBOR_EVENT event); +void ospfv3_maintain_or_destroy_existing_adjacency (OSPFV3_INTERFACE *sptr_interface,OSPFV3_NEIGHBOR *sptr_neighbor,enum OSPFV3_NEIGHBOR_EVENT event); +void ospfv3_tear_down_and_reestablish_adjacency (OSPFV3_INTERFACE *sptr_interface,OSPFV3_NEIGHBOR *sptr_neighbor,enum OSPFV3_NEIGHBOR_EVENT event); +void ospfv3_process_neighbor_1_way_received_event (OSPFV3_INTERFACE *sptr_interface,OSPFV3_NEIGHBOR *sptr_neighbor,enum OSPFV3_NEIGHBOR_EVENT event); +void ospfv3_process_neighbor_down_event (OSPFV3_INTERFACE *sptr_interface,OSPFV3_NEIGHBOR *sptr_neighbor,enum OSPFV3_NEIGHBOR_EVENT event); +void ospfv3_clear_advertisements_from_lists (OSPFV3_INTERFACE *sptr_interface,OSPFV3_NEIGHBOR *sptr_neighbor); + + +/*********************************/ +/* ospfv3_neighbor_state_machine.c */ +/*********************************/ + +void ospfv3_execute_neighbor_state_machine (enum OSPFV3_NEIGHBOR_EVENT event,enum OSPFV3_NEIGHBOR_STATE state,OSPFV3_INTERFACE *sptr_interface, + OSPFV3_NEIGHBOR *sptr_neighbor); + +/*************************/ +/* ospfv3_list_utilities.c */ +/*************************/ + +OSPFV3_GENERIC_NODE * ospfv3_find_first_node_in_list ( + OSPFV3_GENERIC_NODE * sptr_node); + +void ospfv3_insert_node_in_list( + OSPFV3_GENERIC_NODE * sptr_node, + OSPFV3_GENERIC_NODE * sptr_previous_node); + +void ospfv3_add_node_to_end_of_list( + OSPFV3_GENERIC_NODE * sptr_node, + OSPFV3_GENERIC_NODE * sptr_first_node_in_list); + +void ospfv3_free_entire_list (OSPFV3_GENERIC_NODE *sptr_first_node_in_list); + +void ospfv3_remove_node_from_list + (OSPFV3_GENERIC_NODE ** ptr_sptr_first_node, + OSPFV3_GENERIC_NODE * sptr_node); + +void ospfv3_add_neighbor + (OSPFV3_INTERFACE *sptr_interface,OSPFV3_NEIGHBOR *sptr_neighbor_to_add); +OSPFV3_LS_DATABASE_NODE *ospfv3_find_advertisement_on_neighbors_retransmit_list + (OSPFV3_NEIGHBOR *sptr_neighbor, + OSPFV3_LS_DATABASE_ENTRY *sptr_advertisement); + +void ospfv3_remove_node_from_neighbors_retransmit_queue + (OSPFV3_NEIGHBOR *sptr_neighbor, + OSPFV3_LS_DATABASE_NODE *sptr_retransmission_node); + +void ospfv3_remove_neighbor_from_advertisements_retransmit_list + (OSPFV3_LS_DATABASE_ENTRY *sptr_advertisement, + OSPFV3_NEIGHBOR *sptr_neighbor); + +void ospfv3_add_database_entry_to_neighbor_retransmit_list + (OSPFV3_NEIGHBOR *sptr_neighbor, + OSPFV3_LS_DATABASE_ENTRY *sptr_database_entry); + +void ospfv3_add_neighbor_to_database_retransmit_list + (OSPFV3_LS_DATABASE_ENTRY *sptr_database_entry, + OSPFV3_NEIGHBOR *sptr_neighbor); + +void ospfv3_clean_up_retransmit_lists_affiliated_with_this_advertisement + (OSPFV3_LS_DATABASE_ENTRY *sptr_advertisement); + +void ospfv3_remove_all_database_pointers_from_neighbor_retransmit_list + (OSPFV3_NEIGHBOR *sptr_neighbor); + +void ospfv3_free_neighbor_database_summary_list + (OSPFV3_NEIGHBOR *sptr_neighbor); + +OSPFV3_LS_REQUEST * ospfv3_find_advertisement_on_neighbors_ls_request_list + (OSPFV3_NEIGHBOR *sptr_neighbor, + OSPFV3_LS_DATABASE_ENTRY *sptr_advertisement); + +void ospfv3_free_neighbor_ls_request_list (OSPFV3_NEIGHBOR *sptr_neighbor); + +void ospfv3_free_interface_acknowledgement_list + (OSPFV3_INTERFACE *sptr_interface, + enum BOOLEAN check_number_of_neighbors_in_init_state); + +void ospfv3_remove_current_database_copy_from_all_neighbors_retransmission_lists + (OSPFV3_LS_DATABASE_ENTRY *sptr_database_entry, + OSPFV3_INTERFACE *sptr_interface); + +void ospfv3_free_ospfv3_classes_area_lists (void); + +void ospfv3_free_all_the_associated_area_pointers(OSPFV3_AREA_ENTRY* sptr_area); + +void ospfv3_free_routing_table_nodes + (OSPFV3_ROUTING_TABLE_NODE *sptr_first_discarded_or_valid_routing_table_node); + +void ospfv3_free_areas_shortest_path_tree_nodes + (OSPFV3_SHORTEST_PATH_NODE* sptr_first_shortest_path_candidate); + +void ospfv3_free_areas_link_state_database (OSPFV3_AREA_ENTRY *sptr_area); + +void ospfv3_free_interfaces(); + +void ospfv3_free_neighbor (OSPFV3_NEIGHBOR *sptr_neighbor); + +STATUS ospfv3_check_if_out_going_interface_belongs_to_the_passed_area + (ULONG out_going_interfaces_address, OSPFV3_AREA_ENTRY* sptr_area); + + +/*****************************/ +/* ospfv3OldIpDependancies.c */ +/*****************************/ + +USHORT ospfv3_calculate_ip_checksum + ( PSEUDO_IP_PARAMETERS *sptr_pseudo_header, + BYTE *bptr_start_from, USHORT length ); + + + +/***************************/ +/* ospfv3_receive_database.c */ +/***************************/ + +enum OSPFV3_PACKET_STATE ospfv3_database_packet_received (OSPFV3_DATABASE_HEADER *sptr_database_packet_header,OSPFV3_NEIGHBOR *sptr_neighbor, + OSPFV3_INTERFACE *sptr_interface,ULONG size_of_packet); + + +/*******************/ +/* ospfv3Receive.c */ +/*******************/ + +void ospfv3_router_rx_packet + ( OSPFV3_INTERFACE *sptr_interface, + OSPFV3_PACKET *sptr_ospfv3_packet, + USHORT packet_size, + struct in6_addr *source_ip_address, + struct in6_addr *destination_ip_address ); + +void ospfv3_build_pseudo_ip_params(PSEUDO_IP_PARAMETERS *sptr_pseudo_params, + USHORT packet_size, + struct in6_addr * sptr_src_addr, + struct in6_addr * sptr_dst_addr); + +/**************************/ +/* ospfv3_receive_request.c */ +/**************************/ + +enum OSPFV3_PACKET_STATE ospfv3_ls_request_packet_received (OSPFV3_LS_REQUEST_HEADER *sptr_ls_request_header,OSPFV3_NEIGHBOR *sptr_neighbor, + OSPFV3_INTERFACE *sptr_interface,ULONG size_of_packet); + +/*************************/ +/* ospfv3_receive_update.c */ +/*************************/ + +enum OSPFV3_PACKET_STATE ospfv3_ls_update_packet_received (OSPFV3_LS_UPDATE_HEADER *sptr_ls_update_header,OSPFV3_NEIGHBOR *sptr_neighbor, + OSPFV3_INTERFACE *sptr_interface_packet_received_on,struct in6_addr *source_address,struct in6_addr *destination_address); + +/************************/ +/* ospfv3RoutingTable.c */ +/************************/ + +void ospfv3_schedule_routing_table_build (void); + +void ospfv3_build_routing_table (void); + +void ospfv3_examine_a_single_destination_for_a_better_path + (OSPFV3_ADVERTISEMENT_NODE *sptr_advertisement_node, + OSPFV3_AREA_ENTRY *sptr_area); + +enum BOOLEAN ospfv3_add_new_path_to_routing_table_entry_and_update_rtm + (OSPFV3_ROUTING_TABLE_NODE *sptr_routing_table_entry_for_N, + ULONG next_hop_router, + OSPFV3_ROUTING_TABLE_ENTRY *sptr_routing_table_entry); + +enum BOOLEAN ospfv3_next_hop_block_changed + (OSPFV3_ROUTING_TABLE_NODE *sptr_old_routing_table_node, + OSPFV3_ROUTING_TABLE_NODE *sptr_routing_table_node); + +enum BOOLEAN ospfv3_get_new_next_hop_blocks_and_mark_ospfv3_rt_node_new + (OSPFV3_ROUTING_TABLE_NODE *sptr_routing_table_node, + OSPFV3_NEXT_HOP_BLOCK *sptr_new_next_hop_block, + OSPFV3_NEXT_HOP_BLOCK **ptr_sptr_new_next_hops_copy); + +BOOLEAN ospfv3_verify_if_route_is_old + (OSPFV3_ROUTING_TABLE_ENTRY *sptr_routing_table_entry); + +BOOLEAN ospfv3_same_prefixes(OSPFV3_ROUTING_TABLE_ENTRY *sptr_lsdb_entry1, + OSPFV3_ROUTING_TABLE_ENTRY *sptr_lsdb_entry2); + +BOOLEAN ospfv3_same_route( OSPFV3_ROUTING_TABLE_ENTRY *sptr_routing_table_entry1, + OSPFV3_ROUTING_TABLE_ENTRY *sptr_routing_table_entry2); + +int ospfv3_uncompressed_subnet_compare(BYTE *sptr_prefix1, + BYTE length1, + BYTE *sptr_prefix2, + BYTE length2); + +int ospfv3_compare_rt_prefix_subnets(OSPFV3_ROUTING_TABLE_ADDR_PREFIX* sptr_prefix1, + OSPFV3_ROUTING_TABLE_ADDR_PREFIX* sptr_prefix2); + + +STATUS ospfv3_build_prefix_list_for_routing_table_entry(OSPFV3_ROUTING_TABLE_ENTRY *sptr_routing_table_entry); + +STATUS ospfv3_export_changed_route_to_other_protocols ( + OSPFV3_ROUTING_TABLE_ENTRY *sptr_new_routing_table_entry, /* new route */ + OSPFV3_ROUTING_TABLE_ENTRY *sptr_old_routing_table_entry /* old route */ ); +OSPFV3_ROUTING_TABLE_ENTRY* ospfv3_find_routing_table_entry_for_ABR(ULONG destintation_id, + ULONG area_id ); +STATUS ospfv3_build_prefix_list_for_rte(OSPFV3_ROUTING_TABLE_ENTRY *sptr_routing_table_entry); + +STATUS ospfv3_include_prefixes(OSPFV3_LS_DATABASE_ENTRY *sptr_lsa, OSPFV3_ROUTING_TABLE_ENTRY *sptr_routing_table_entry); + +/********************************/ +/* ospfv3_routing_table_lookups.c */ +/********************************/ + +OSPFV3_ROUTING_TABLE_NODE *ospfv3_find_routing_table_node ( + struct in6_addr *destination_address, /* can be NULL if only router ID given (second param) */ + ULONG destination_id_to_look, /* can be 0 if only destination IPv6 address is given (first param) */ + enum OSPFV3_ROUTE_DESTINATION_TYPE destination_type, + enum OSPFV3_ROUTE_PATH_TYPE path_type,OSPFV3_AREA_ENTRY *sptr_area); /* NEWRT LOOKUP */ + +OSPFV3_ROUTING_TABLE_NODE * ospfv3_find_router_or_network_routing_table_node( + struct in6_addr *destination_address, /* can be NULL if only router ID given (second param) */ + ULONG destination_id_to_look, /* can be 0 if only destination IPv6 address is given (first param) */ + enum OSPFV3_LS_TYPE lsa_header_type, + enum OSPFV3_ROUTE_PATH_TYPE path_type,OSPFV3_AREA_ENTRY *sptr_area); + +OSPFV3_ROUTING_TABLE_ENTRY *ospfv3_find_routing_table_entry ( + struct in6_addr *destination_address, /* can be NULL if only router ID given (second param) */ + ULONG destination_id_to_look, /* can be 0 if only destination IPv6 address is given (first param) */ + enum OSPFV3_ROUTE_DESTINATION_TYPE destination_type, + enum OSPFV3_ROUTE_PATH_TYPE path_type,OSPFV3_AREA_ENTRY *sptr_area); + +void ospfv3_select_complete_set_of_matching_entries_from_the_routing_table (struct in6_addr * destination_ip_address, + OSPFV3_ROUTING_TABLE_LOOKUP_TEMP_NODE **ptr_to_sptr_first_matching_node,USHORT *usptr_number_of_entries); + + +/********************************/ +/* ospfv3RoutingTableUpdates.c */ +/********************************/ + +void ospfv3_update_routing_table_due_to_receipt_of_a_inter_area_prefix_lsa + (OSPFV3_INTER_AREA_PREFIX_LSA_HEADER *sptr_inter_area_prefix, + OSPFV3_AREA_ENTRY * sptr_area_A); + +void ospfv3_update_routing_table_due_to_receipt_of_a_inter_area_router_lsa + (OSPFV3_INTER_AREA_ROUTER_LSA_HEADER *sptr_inter_area_router, + OSPFV3_AREA_ENTRY * sptr_area_A); + +void ospfv3_invalidate_routing_table_entry + (OSPFV3_ROUTING_TABLE_NODE *sptr_routing_table_node_for_N,ULONG network_mask, + struct in6_addr * destination_N,OSPFV3_AREA_ENTRY *sptr_area_A); + + +/************************************/ +/* ospfv3_shortest_path_calculation.c */ +/************************************/ + +void ospfv3_calculate_shortest_path_tree (OSPFV3_AREA_ENTRY *sptr_area); + +STATUS ospfv3_check_if_link_exists (UNION_OSPFV3_LINK_STATE_ADVERTISEMENT *sptr_advertisement,ULONG vertex,OSPFV3_AREA_ENTRY *sptr_area); + +OSPFV3_NEXT_HOP_BLOCK *ospfv3_calculate_the_set_of_next_hops (OSPFV3_SHORTEST_PATH_NODE *sptr_destination,OSPFV3_SHORTEST_PATH_NODE *sptr_parent, + OSPFV3_ROUTER_LINK_PIECE *sptr_link, OSPFV3_AREA_ENTRY *sptr_area); + +OSPFV3_NEXT_HOP_BLOCK *ospfv3_inherit_the_set_of_next_hops_from_node_X (OSPFV3_NEXT_HOP_BLOCK *sptr_node_X_next_hops); + +void ospfv3_schedule_shortest_path_first_job (OSPFV3_AREA_ENTRY *sptr_area); + +/***************/ +/* ospfv3_snmp.c */ +/***************/ + +/* +STATUS ospfv3_get_mib_variable (enum MIB_OPERATION mib_operation, char *cptr_mib_string, + BYTE* bptr_variable_value , USHORT *usptr_size_of_variable_value, USHORT *usptr_size_of_table_indices, + ULONG *ulptr_table_indices, enum BOOLEAN *eptr_end_of_table, char **ptr_to_cptr_next_variable_name); +*/ + +/******************/ +/* ospfv3System.c */ +/******************/ + +void ospfv3_init_stub(); + +#if defined (__OSPFV3_FTP__) +STATUS ospfv3_init + (const char* p_configuration_file, + const char* p_ftp_server_address, + const char* p_directory, const char* p_user, const char* p_password); +#else +STATUS ospfv3_init (void); +#endif + +STATUS ospfv3_startup( void ); + +STATUS ospfv3PartMemInitialize (void); + +void ospfv3_objects_reclamation(void); + +STATUS ospfv3_init_proto (); +void ospfv3_spf(void); + +/*****************/ +/* ospfv3Timer.c */ +/*****************/ + +void ospfv3_router_timer (void); + +/*******************/ +/* ospfv3_send.c */ +/*******************/ + +void ospfv3_tx_packet (OSPFV3_HEADER *sptr_packet,OSPFV3_INTERFACE *sptr_interface,enum OSPFV3_UNION_PACKET_TYPES type,ULONG length, + ULONG destination_type, enum BOOLEAN free_packet, OSPFV3_NEIGHBOR *sptr_neighbor); + +void ospfv3_send_packet_to_all_neighbors_in_up_state(OSPFV3_HEADER *sptr_packet,ULONG length /* in host order */, + OSPFV3_INTERFACE *sptr_interface,enum BOOLEAN free_packet); + + +void ospfv3_send_completion_packet (USHORT port_number,void *vptr_txed_packet); + + +/***********************************/ +/* ospfv3_transmit_acknowledgement.c */ +/***********************************/ + +enum OSPFV3_ACKNOWLEDGEMENT_RETURN_TYPE ospfv3_send_acknowledgement (OSPFV3_INTERFACE *sptr_interface, OSPFV3_NEIGHBOR *sptr_neighbor, + OSPFV3_LS_HEADER_QUEUE **ptr_to_sptr_header_queue); + +/****************************/ +/* ospfv3_transmit_database.c */ +/****************************/ + +void ospfv3_send_an_empty_database_description_packet (OSPFV3_INTERFACE *sptr_interface,OSPFV3_NEIGHBOR *sptr_neighbor); + +void ospfv3_send_database_summary (OSPFV3_INTERFACE *sptr_interface,OSPFV3_NEIGHBOR *sptr_neighbor); + +/***************************/ +/* ospfv3_transmit_request.c */ +/***************************/ + +void ospfv3_send_ls_request_packet (OSPFV3_INTERFACE *sptr_interface,OSPFV3_NEIGHBOR *sptr_neighbor); + +/**************************/ +/* ospfv3_transmit_update.c */ +/**************************/ + +void ospfv3_send_ls_update (OSPFV3_LS_DATABASE_NODE *sptr_database_list,OSPFV3_NEIGHBOR *sptr_neighbor,OSPFV3_INTERFACE *sptr_interface, + enum BOOLEAN retransmit_flag, enum BOOLEAN advertisement_installed); +void ospfv3_free_timestamps_for_lsdb_entry(OSPFV3_LS_DATABASE_ENTRY *sptr_database_entry); + +/******************/ +/* ospfv3Utils.c */ +/*****************/ + +struct ifnet* ospfv3_dstaddr_to_ifp (struct in_addr *addr); /* TBD: should this be replaced by OSPFV3_IA6_TO_IFP */ + +const char *ospfv3_convert_ipv6_address_to_dot_format(char *cptr_array_to_store_dot_format_address, struct in6_addr *ip_address); + +void ospfv3_ipv6address_and_mask(struct in6_addr *subnet, struct in6_addr *address, ULONG mask_length); + +BOOLEAN ospfv3_is_same_ipv6_subnet(struct in6_addr *address1, ULONG mask_length1, struct in6_addr *address2, ULONG mask_length2); + +BOOLEAN ospfv3_is_same_ipv6_address(struct in6_addr *address1, struct in6_addr *address2); +/* use IPADDR1_ARE_SAME instead of this */ + +BOOLEAN ospfv3_is_same_prefix(OSPFV3_IPV6_ADDR_PREFIX* prefix1, OSPFV3_IPV6_ADDR_PREFIX* prefix2); + +/* TODO: make this macro or find and use macro from RS for this */ +BOOLEAN ospfv3_is_ipv6_address_null(struct in6_addr *address1); + +/* TODO: convert to macro after debug */ +void ospfv3_set_metric(ULONG* metric_in_its_ulong, USHORT metric_value); + +/* TODO: convert to macro after debug */ +ULONG ospfv3_get_number_of_links_in_router_lsa(OSPFV3_ROUTER_LINK_ADVERTISEMENT_HEADER *sptr_router); + +/* TODO: convert to macro after debug */ +ULONG ospfv3_get_number_of_routers_in_network_lsa(OSPFV3_NETWORK_LINK_ADVERTISEMENT_HEADER *sptr_network); + +/* TODO: convert to macro after debug */ +USHORT ospfv3_get_metric(ULONG* metric_in_its_ulong); + +ULONG ospfv3_get_prefix_length_in_ulongs(BYTE prefix_length); + +void ospfv3_ntoh_ipv6address(struct in6_addr *sptr_host_order_ipv6_address, + struct in6_addr *sptr_net_order_ipv6_address); + +void ospfv3_hton_ipv6address(struct in6_addr *sptr_host_order_ipv6_address, + struct in6_addr *sptr_net_order_ipv6_address); + +/* hton or ntoh for an OSPFv3 PDU: */ +void ospfv3_byte_order_pdu( OSPFV3_HEADER *sptr_pdu, BOOLEAN net_to_host); + +const struct in6_addr * ospfv3_get_mask_for_mask_length(ULONG mask_length); + +ULONG ospfv3_get_mask_length_for_mask(const struct in6_addr *mask); + +STATUS ospfv3_check_if_interface_in_area + (ULONG interfaces_address, OSPFV3_AREA_ENTRY * sptr_area); + +enum BOOLEAN ospfv3_check_for_transit_areas (void); + +void ospfv3_generate_network_and_router_link_state_advertisements + (OSPFV3_INTERFACE *sptr_interface); + + +STATUS ospfv3_get_interface_info (OSPFV3_INTERFACE *sptr_interface); + +USHORT ospfv3_get_interface_mtu (OSPFV3_INTERFACE *sptr_interface); + +enum BOOLEAN ospfv3_validate_interface(ULONG interface_id); + +enum BOOLEAN ospfv3_check_if_area_border_router (void); + +STATUS ospfv3_check_if_more_recent + (OSPFV3_LS_HEADER *sptr_new_ls_header, + OSPFV3_LS_HEADER *sptr_current_ls_header,ULONG elapsed_time); + +STATUS ospfv3_check_if_same_instance + (OSPFV3_LS_HEADER *sptr_new_ls_header, + OSPFV3_LS_HEADER *sptr_current_ls_header,ULONG elapsed_time); + +seq_t ospfv3_increment_sequence_number (seq_t sequence_number); + +void ospfv3_add_entry_to_interfaces_delayed_acknowledgement_list + (OSPFV3_INTERFACE *sptr_interface, + OSPFV3_LS_DATABASE_ENTRY *sptr_database_entry); + +STATUS ospfv3_check_for_valid_ls_type (OSPFV3_INTERFACE *sptr_interface,OSPFV3_LS_HEADER *sptr_ls_header, enum OSPFV3_UNION_PACKET_TYPES packet_type); + +OSPFV3_HEADER *ospfv3_new_link_state_update (UNION_OSPFV3_ADVERTISEMENT_HEADER **ptr_to_uptr_acknowledgement_header,OSPFV3_INTERFACE *sptr_interface); + +STATUS ospfv3_check_if_ip_destination_falls_into_address_range ( + struct in6_addr * destination_ip_address,struct in6_addr *destination_id,ULONG address_mask); + +STATUS ospfv3_check_if_ip_destination_falls_into_address_range_of_prefixes (struct in6_addr *destination_ip_address, + OSPFV3_ROUTING_TABLE_ENTRY *sptr_routing_table_entry, + BYTE *most_specific_mask, + OSPFV3_ROUTING_TABLE_ADDR_PREFIX **sptr_most_specific_prefix); +void ospfv3_transfer_fields_from_ls_request_structure_to_ls_header_structure (OSPFV3_LS_REQUEST *sptr_ls_request,OSPFV3_LS_HEADER *sptr_ls_header); + +void ospfv3_notify_areas_for_abr_change( ulong_t area_id_to_skip ); + +void ospfv3_flush_network_link_advertisement( OSPFV3_INTERFACE *sptr_interface ); + +OSPFV3_AREA_ENTRY* ospfv3_find_area_from_area_id(ULONG area_id); + +OSPFV3_INTERFACE* ospfv3_find_interface_based_on_id_and_neighbor(OSPFV3_NEIGHBOR *sptr_neighbor, ULONG link_id); + +OSPFV3_NEIGHBOR * ospfv3_find_neighbor_based_on_id_and_interface(OSPFV3_INTERFACE *sptr_interface, ULONG id); + +UINT get_system_elapsed_time_in_seconds (void); + +STATUS ospfv3_export_route_to_other_protocols + (enum OSPFV3_ROUTING_TABLE_UPDATE_ACTION action, + OSPFV3_ROUTING_TABLE_ENTRY *sptr_ospfv3_route_entry_to_export); + +STATUS ospfv3_export_route_prefix_to_other_protocols ( + enum OSPFV3_ROUTING_TABLE_UPDATE_ACTION action, + OSPFV3_ROUTING_TABLE_ENTRY *sptr_ospfv3_route_entry_to_export, + OSPFV3_ROUTING_TABLE_ADDR_PREFIX *sptr_prefix); + +ULONG ospfv3_get_lsdb_index (BYTE_ENUM (OSPFV3_LS_TYPE) type); + +ULONG ospfv3_get_ls_request_index(BYTE_ENUM(OSPFV3_LS_TYPE) type, BYTE_ENUM(OSPFV3_LS_FLOODING_SCOPE) flood); + +ULONG ospfv3_get_full_type_with_scope (BYTE_ENUM (OSPFV3_LS_TYPE) type); + +OSPFV3_ROUTING_TABLE_ADDR_PREFIX * ospfv3_get_next_prefix_in_prefix_list ( + OSPFV3_ROUTING_TABLE_ADDR_PREFIX * sptr_prefix); + +ULONG ospfv3_get_next_link_id_for_self_originated_lsa ( + enum OSPFV3_LS_TYPE lsa_type); + +OSPFV3_IPV6_ADDR_PREFIX *ospfv3_get_next_var_length_prefix ( + OSPFV3_IPV6_ADDR_PREFIX *); + +struct in6_addr * ospfv3_get_opt_forwarding_address_ptr ( + OSPFV3_EXTERNAL_LINK_ADVERTISEMENT_HEADER *sptr_lsa); + +ULONG* ospfv3_get_opt_forwarding_ext_route_tag_ptr ( + OSPFV3_EXTERNAL_LINK_ADVERTISEMENT_HEADER *sptr_lsa); + +ULONG* ospfv3_get_opt_ref_link_id_ptr ( + OSPFV3_EXTERNAL_LINK_ADVERTISEMENT_HEADER *sptr_lsa); + +ULONG ospfv3_get_prefix_length_in_bytes ( + BYTE prefix_length); + +/********************/ +/* ospfv3ToRtm.c */ +/********************/ + +void ospfv3_receive_rtm_socket_input (void); + +STATUS ospfv3_routing_table_walk (enum BOOLEAN asCapable, enum BOOLEAN redistStatic, + enum BOOLEAN redistRIP, enum BOOLEAN redistBGP, + enum BOOLEAN redistDefault, enum BOOLEAN reachable); + +void ospfv3_add_route (OSPFV3_IP6_ROUTE_ENTRY *sptr_route_entry); + +void ospfv3_delete_route (OSPFV3_IP6_ROUTE_ENTRY *sptr_route_entry); + +void ospfv3_change_route (OSPFV3_IP6_ROUTE_ENTRY *sptr_route_entry); + +BOOLEAN ospfv3_is_protocol_redistributed (OSPFV3_IP6_ROUTE_ENTRY *sptr_ip_route); + +/********************/ +/* ospfv3LsdbShow.c */ +/********************/ + +void ospfv3_show_stub (); + +void ospfv3ShowLsdbSummary (); + +void ospfv3ShowLsdb (); + +void ospfv3ShowRouterLsdb (); + +void ospfv3ShowNetworkLsdb (); + +void ospfv3ShowSummaryLsdb (); + +void ospfv3ShowExternalLsdb (); + +void ospfv3ShowInterAreaRouterLsdb(void); + +void ospfv3ShowInterAreaPrefixLsdb(void); + +void ospfv3ShowLinkLsdb(void); + +void ospfShowIntraAreaPrefixLsdb(void); + +/****************************/ +/* ospfv3RoutingTableShow.c */ +/****************************/ +void ospfv3_show_routing_stub(); + +STATUS ospfv3RoutingTableShow(); +void ospfv3_print_destination_addresses(OSPFV3_ROUTING_TABLE_ENTRY *sptr_routing_table_entry, BOOLEAN print_always); +void ospfv3_print_prefix(OSPFV3_IPV6_ADDR_PREFIX *sptr_address_prefix); +void ospfv3_print_routing_table_entry(OSPFV3_ROUTING_TABLE_ENTRY *sptr_routing_table_entry); + + +/*****************************/ +/* ospfv3DynamicConfig.c */ +/*****************************/ + +enum BOOLEAN ospfv3_dynamic_validate_area( ULONG area_id ); + +void ospfv3_dynamic_tear_down_neighbors(OSPFV3_INTERFACE *sptr_interface); + +void ospfv3_dynamic_destroy_neighbor( OSPFV3_INTERFACE *sptr_interface, + OSPFV3_NEIGHBOR *sptr_neighbor ); + +STATUS ospfv3_dynamic_config_metric( OSPFV3_INTERFACE *sptr_interface ); + +void ospfv3_dynamic_step_intfSm( enum OSPFV3_INTERFACE_EVENT event, + enum OSPFV3_INTERFACE_STATE state, + OSPFV3_INTERFACE *sptr_interface ); + +STATUS ospfv3_dynamic_create_area( OSPFV3_AREA_ENTRY *sptr_area ); + +STATUS ospfv3_dynamic_reinit_area( OSPFV3_AREA_ENTRY *sptr_area, enum BOOLEAN delete_stub ); + +STATUS ospfv3_dynamic_destroy_area( OSPFV3_AREA_ENTRY *sptr_area ); + +void ospfv3_dynamic_reset_interface( OSPFV3_INTERFACE *sptr_interface ); + +STATUS ospfv3_dynamic_init_unnumbered_interface( OSPFV3_INTERFACE *sptr_interface ); + +STATUS ospfv3_dynamic_reinit_interface( OSPFV3_AREA_ENTRY *sptr_new_area, + OSPFV3_INTERFACE *sptr_interface, + enum BOOLEAN reset_interface ); + +STATUS ospfv3_dynamic_create_interface( OSPFV3_INTERFACE *sptr_interface ); + +STATUS ospfv3_dynamic_destroy_interface(OSPFV3_INTERFACE *sptr_interface, + OSPFV3_AREA_ENTRY *sptr_area ); + +STATUS ospfv3_dynamic_create_virtIf( OSPFV3_INTERFACE *sptr_interface, + OSPFV3_AREA_ENTRY *sptr_area ); + +STATUS ospfv3_dynamic_destory_virtIf( OSPFV3_INTERFACE *sptr_interface ); + +void ospfv3_dynamic_calculate_spf( OSPFV3_AREA_ENTRY *sptr_area ); + +void ospfv3_dynamic_create_area_range( OSPFV3_AREA_ENTRY *sptr_area, + OSPFV3_ADDRESS_RANGE_LIST_ENTRY *addr_ranges ); + +void ospfv3_dynamic_destroy_area_range( OSPFV3_AREA_ENTRY *sptr_area, + OSPFV3_ADDRESS_RANGE_LIST_ENTRY *addr_range ); + +enum BOOLEAN ospfv3_dynamic_config_overflow( ULONG new_extLsdb_limit, + ULONG new_overflow_interval ); + +void ospfv3_dynamic_flush_opaque_lsa( OSPFV3_AREA_ENTRY *sptr_area ); + +void ospfv3_dynamic_flush_external_routes( void ); + +void ospfv3_dynamic_export_external_routes( void ); + +/************************/ +/* ospfv3Show.c */ +/************************/ + +STATUS ospfv3EnableDebug ( char * ); + +STATUS ospfv3DisableDebug ( char * ); + +STATUS ospfv3ShowDebug (); + +void ospfv3ShowVersion (); + +void ospfv3_show_routines_stub (); + +void ospfv3_display_packet (OSPFV3_HEADER *sptr_packet,enum BOOLEAN receive); + +void ospfv3_display_ospfv3_header (OSPFV3_HEADER *sptr_packet,enum BOOLEAN receive); + +void ospfv3_print_memory_error_message_and_free_buffer_if_necessary (void *vptr_buffer,const char *cptr_string); + +void ospfv3_printf (enum OSPFV3_PRINTF_GROUPS printf_group,const char *cptr_format, ...); + +void ospfv3_printf_stub(enum OSPFV3_PRINTF_GROUPS printf_group,const char *cptr_format, ...);/*added for the case when the debug option is turned off*/ + +void ospfv3_display_routing_table (void); + +void ospfv3_print_next_hops (OSPFV3_NEXT_HOP_BLOCK* sptr_next_hop); + +void ospfv3_display_hello_packet (OSPFV3_HELLO_HEADER *sptr_hello_packet,USHORT length_of_packet); + +void ospfv3_display_database_description_packet (OSPFV3_DATABASE_HEADER *sptr_database_packet,USHORT length_of_packet); + +void ospfv3_display_ls_request_packet (OSPFV3_LS_REQUEST_HEADER *sptr_ls_request_packet,USHORT length_of_packet); + +void ospfv3_display_ls_update_packet (OSPFV3_LS_UPDATE_HEADER *sptr_ls_update_packet); + +void ospfv3_display_ls_header (OSPFV3_LS_HEADER *sptr_ls_header); + +void ospfv3_display_router_links_advertisement (OSPFV3_ROUTER_LINK_ADVERTISEMENT_HEADER *sptr_router_links_advertisement_header); + +void ospfv3_display_network_links_advertisement (OSPFV3_NETWORK_LINK_ADVERTISEMENT_HEADER *sptr_network_links_advertisement_header); + +void ospfv3_display_inter_area_prefix_links_advertisement (OSPFV3_INTER_AREA_PREFIX_LSA_HEADER *sptr_inter_area_prefix_lsa); + +void ospfv3_display_inter_area_router_links_advertisement (OSPFV3_INTER_AREA_ROUTER_LSA_HEADER *sptr_inter_area_router_lsa); + +void ospfv3_display_links_lsa(OSPFV3_LINK_LSA_HEADER *sptr_links_lsa); + +void ospfv3_display_intra_area_prefix_lsa(OSPFV3_INTRA_AREA_PREFIX_LSA_HEADER *sptr_intra_area_prefix_lsa); + +void ospfv3_display_external_links_advertisement (OSPFV3_EXTERNAL_LINK_ADVERTISEMENT_HEADER *sptr_external_links_advertisement_header); + +void ospfv3_display_ls_acknowledgement_packet (OSPFV3_LS_ACKNOWLEDGEMENT_HEADER *sptr_ls_acknowledgement_packet,USHORT length_of_packet); + +void ospfv3ShowInterface (); + +void ospfv3ShowNeighbor (); + +void ospfv3ShowInterfaceSummary (); + +void ospfv3ShowNeighborSummary (); + +void ospfv3ShowSummary (); + +void ospfv3ShowAreas(); + +STATUS ospfv3ShowMemPartition(int option); + +/*********************/ +/* ospfv3SendUtils.c */ +/*********************/ + +OSPFV3_HEADER *ospfv3_get_an_ospfv3_send_packet (ULONG size_of_packet); + +void ospfv3_free_an_ospfv3_send_packet (OSPFV3_HEADER *sptr_tx_packet); + +ULONG ospfv3_determine_packet_destination (OSPFV3_INTERFACE *sptr_interface,OSPFV3_NEIGHBOR *sptr_neighbor); + + +/****************************/ +/* ospfv3ToIp.c */ +/****************************/ + +void ospfv3_receive_ip_socket_input (void); + +void ospfv3_ip_output + ( OSPFV3_HEADER *sptr_packet, + struct in6_addr *source_address, + unsigned int src_if_ndx, + struct in6_addr *destination_address, + ULONG length, + enum BOOLEAN free_packet, + enum BOOLEAN convert); + +STATUS ospfv3_ip_register(void); + +/**************************/ +/* ospfv3Nvram.c */ +/**************************/ + +enum TEST ospfv3_initialize_nvram (char *cptr_file_name,ULONG location_of_ini_file,char *cptr_section_name, + void *vptr_location_of_configuration_table); + + +/**************************/ +/* ospfv3BacklogProcess.c */ +/**************************/ + +STATUS ospfv3_backlog_queue_create(void); + +STATUS ospfv3_backlog_queue_delete(void); + +void ospfv3_backlog_queue_process(void); + +int ospfv3_get_backlog_queue_size(void); + +STATUS ospfv3_backlog_queue_write( + OSPFV3_INTERFACE *sptr_interface, + OSPFV3_PACKET *sptr_ospfv3_packet, + USHORT packet_size, + struct in6_addr *source_ip_address, + struct in6_addr *destination_ip_address); + +STATUS ospfv3_backlog_queue_read(OSPFV3_BACKLOG_NON_HELLO_PDU *sptr_first_queued_pdu); + +/**************************************/ +/* ospfv3PrototypeRoutingTableBuild.c */ +/**************************************/ + +void ospfv3InitializeForRTPrototype(void); + +int ospfv3RoutingTablePrototype(void); + +void ospfv3ShowRoutingTable(void); +#ifdef __cplusplus +} +#endif + +#endif /* __INCospfv3Prototypesh */ diff --git a/h/wrn/ospfv3/ospfv3Structures.h b/h/wrn/ospfv3/ospfv3Structures.h new file mode 100644 index 0000000..de9a214 --- /dev/null +++ b/h/wrn/ospfv3/ospfv3Structures.h @@ -0,0 +1,1788 @@ +/* ospfv3Structures.h - OSPFv3 structures header file */ + +/* Copyright 2004 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +02k,10dec04,tlu Clean up compile warning on #endif (line 1751) +02j,29nov04,tlu OSPF stack decoupling +02i,31jul04,dsk code insepction fixes +02h,28apr04,dsk Interop with dual stack routing table +02g,14apr04,ram Performance optimization changes +02f,13apr04,ram OSPFv3 Routing Table Hash Modifications +02e,13apr04,ram LSDB AVL modifications +02d,07apr04,ram OSPF v2/v3 coexistance compile +02c,31mar04,dsk Modifications for OSPFv3 ANVL conformance +02b,31mar04,dsk Modifications for OSPFv3 ANVL conformance +02a,11mar04,dsk Modifications for OSPFv3 ANVL conformance +01z,16dec03,ram Mods per type 3 & 4 testing +01y,27nov03,dsk Mods according to integration testing +01x,06nov03,ram Modifications for external routes +01w,06nov03,dsk mods to type 5 LSAs due to var length address prefix +01v,22oct03,ram Modifications for LS request & separating performance +01u,21oct03,ram Modifications for adjacency establishment +01t,17oct03,ram Modifications for memory corruption, traffic, & debug output +01s,10oct03,ram Modifications for LSDB, dynamic config, & NSSA cleanup +01r,07oct03,agi added inter_area_prefix_lsa_id, inter_area_router_lsa_id to + OSPFV3_CLASS +01q,30sep03,ram OSPF datapath changes +01p,25sep03,ram Second general modifications submission +01r,05aug03,agi code clean-up +01p,29jul03,ram Added sockets, processing, and external route changes +01o,23jul03,agi added RWOS removal changes + updated copyright +01n,03jun03,agi fixed structure declaration order for diab compilation, added + number_of_prefixes to the interface structures +01m,22may03,dsk added definition for surrogate hello processing + definitions for prioritized hello processing + definitions for routing table entry prefix list + removed redundant fields of routing table and of LSDB + changes for routing table lookup due to multiple prefixes per entry + added LSA counts needed by MIB + added advertising router for unique identification of SPF nodes + added definitions for replacing rwos objects with vxWorks objects + (removed rwos dispatchers, added task descriptors, timer and semaphores) + definitions for generating unique IDs for LSAs in aggregates + fix early LSA retransmission filter (SPR 88619) +01l,04feb02,dsk added list of address prefixes for interface and hash table changes +01k,18feb03,dsk ported from OSPFv2 to OSPFv3 structures +01j,04feb02,dsk added usage of in6_addr (from IPv6 router stack) for IPv6 address +01i,23jan03,htm added changes for IPv6 +01h,21jan03,agi updated LSA datastructures +01g,10jan03,agi propogated SPR#85432, 83418 fixes from OSPFv2 +01f,10jan03,agi initial changes to the LSA datastructures + removed unused TE datastructures +01e,06jan03,agi propogated SPR#75194, ANVL 27.15 fix from OSPFv2 + fixed compilation +01d,06jan03,hme changed all OSPFv3 data structures as per RFC 2740 +01c,23dec02,agi propogated TMS code merge for SPR#84284 + propogated SPR#75796 ANVL 37.1 fix from OSPFv2 + propogated fix for SPR#81628 ANVL 13.6 to pass on MIPS board +01b,25oct02,agi added initial structures + first pass at clean-up +01a,23oct02,agi written +*/ + +#ifndef __INCospfv3Structuresh +#define __INCospfv3Structuresh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +/*#include */ /* for struct ip6_hdr, TODO: TBD include path */ +#include +#include + +#define OSPFV3_SURROGATE_HELLO_ENABLED + +enum PROTOCOL_STACK_TYPE +{ + IP_PROTOCOL_STACK, + IPX_PROTOCOL_STACK, + SPANNING_TREE_STACK, + SOURCE_ROUTING_STACK, + NLSP_PROTOCOL_STACK, + DLSW_PROTOCOL_STACK, + OSPFV3_PROTOCOL_STACK, + APPLETALK_PROTOCOL_STACK, + NETBIOS_PROTOCOL_STACK, + VINES_PROTOCOL_STACK, + CONSOLE_PROTOCOL_STACK, + L2TP_PROTOCOL_STACK, + RTM_PROTOCOL_STACK, + PPTP_DATA_TUNNEL, + PPP_OVER_ETHERNET_PROTOCOL_STACK, + VPN_INTERFACE_VIRTUAL_PROTOCOL_STACK +}; + +enum PROTOCOL_CONTROL_OPERATION +{ + OPEN_PROTOCOL_STACK, + CLOSE_PROTOCOL_STACK, + GET_IP_ADDRESS_FOR_PORT, + + IS_PROTOCOL_STACK_ENABLED = 0x0100, + GET_NUMBER_OF_PROTOCOL_STACKS_VIRTUAL_PORTS, + GET_PROTOCOL_STACK_TYPE, + GET_PROTOCOL_STACK_PROTOCOL_ID, + GET_PROTOCOL_STACK_SSAP, + GET_PROTOCOL_STACK_DSAP, + GET_PROTOCOL_STACK_VIRTUAL_PORT_PACKET_TYPE, + GET_PROTOCOL_STACK_REAL_PORT_NUMBER_USING_VIRTUAL_PORT_NUMBER, + + INITIALIZE_SOCKET_PROTOCOL_STACK_INTERFACE, + + IS_TOKEN_RING_FRAME_SOURCE_ROUTED, + IS_TOKEN_RING_FRAME_A_MAC, + GET_LENGTH_OF_TOKEN_RING_RIF, + CLEAR_SOURCE_ROUTED_BIT, + MOVE_RIF_INTO_PACKET, + IS_MAC_ADDRESS_SOURCE_ROUTED, + REGISTER_TO_IP_FROM_UPPER_LAYER, + + INITIALIZE_STACK_FUNCTION_POINTERS, + INITIALIZE_PROTOCOL_FUNCTION_POINTERS, + GET_PROTOCOL_ADDRESS, + CLEAR_CACHED_ROUTE, + REINITIALIZE_PROTOCOL_STACK, + PROTOCOL_STACK_ROUTERWARE_CONTROL, + UNINITIALIZE_PROTOCOL_STACK, + PROTOCOL_ROUTE_ADDED, + PROTOCOL_ROUTE_DELETED, + PROTOCOL_ROUTE_CHANGED, + LLC_PROTOCOL_STACK, + REGISTER_NAT_FILTER = 200, + DEREGISTER_NAT_FILTER, + OPEN_PROTOCOL_STACK_PORT, + CLOSE_PROTOCOL_STACK_PORT, + ADD_IP_ADDRESS_AND_NETWORK_MASK_FOR_PORT, + ADD_REMOTE_IP_ADDRESS_FOR_PORT, + + OPEN_VIRTUAL_PORT, + CLOSE_VIRTUAL_PORT, + REINITIALIZE_VIRTUAL_PORT, + UNINITIALIZE_VIRTUAL_PORT +}; + +typedef struct OSPFV3_RETURN_TYPE +{ + enum OSPFV3_PACKET_STATE packet_state; + BYTE_ENUM (BOOLEAN) exit_routine; +} OSPFV3_RETURN_TYPE; + +/**************************************************************************************/ + +/* Definition of the generic node structure for database containers like LSDB and routing table. +Links LSAs into their container (DLL or AVL), +links routing table entries into their container (DLL or AVL) */ +/* used for pointer manipulation when inserting and removing nodes in a list */ +typedef struct OSPFV3_GENERIC_NODE +{ + struct OSPFV3_GENERIC_NODE *sptr_forward_link; + struct OSPFV3_GENERIC_NODE *sptr_backward_link; +} OSPFV3_GENERIC_NODE; + + +/**************************************************************************************/ + +/* RFC 2740 definition of options, annex A.2 */ +#if (_BYTE_ORDER == _LITTLE_ENDIAN ) +typedef _struct OSPFV3_OPTIONS + { + BIT_FIELD_8 (enum,BOOLEAN) V6:1; + BIT_FIELD_8 (enum,BOOLEAN) externals:1; + BIT_FIELD_8 (enum,BOOLEAN) multicast:1; + BIT_FIELD_8 (enum,BOOLEAN) nssa:1; + BIT_FIELD_8 (enum,BOOLEAN) R:1; + BIT_FIELD_8 (enum,BOOLEAN) demand_circuit:1; /* not supported, RFC 1793 */ + BIT_FIELD_8 (enum,BOOLEAN) not_used_1:2; /* should be set to zero */ + BIT_FIELD_8 (enum,BOOLEAN) not_used_2:8; /* should be set to zero */ + BIT_FIELD_8 (enum,BOOLEAN) not_used_3:8; /* should be set to zero */ + } _pack OSPFV3_OPTIONS; +#else /* _BYTE_ORDER == _BIG_ENDIAN */ +typedef _struct OSPFV3_OPTIONS + { + BIT_FIELD_8 (enum,BOOLEAN) not_used_3:8; /* should be set to zero */ + BIT_FIELD_8 (enum,BOOLEAN) not_used_2:8; /* should be set to zero */ + BIT_FIELD_8 (enum,BOOLEAN) not_used_1:2; /* should be set to zero */ + BIT_FIELD_8 (enum,BOOLEAN) demand_circuit:1; /* not supported */ + BIT_FIELD_8 (enum,BOOLEAN) R:1; + BIT_FIELD_8 (enum,BOOLEAN) nssa:1; + BIT_FIELD_8 (enum,BOOLEAN) multicast:1; + BIT_FIELD_8 (enum,BOOLEAN) externals:1; + BIT_FIELD_8 (enum,BOOLEAN) V6:1; + } _pack OSPFV3_OPTIONS; +#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ + +typedef _union UNION_OSPFV3_OPTIONS + { + OSPFV3_OPTIONS _bit; + /*BYTE _byte[3];*/ + } _pack UNION_OSPFV3_OPTIONS; + +/**************************************************************************************/ + +/* DD packets flags */ +#if (_BYTE_ORDER == _LITTLE_ENDIAN ) +typedef _struct OSPFV3_FLAGS +{ + BIT_FIELD (enum,BOOLEAN) master:1; + BIT_FIELD (enum,BOOLEAN) more:1; + BIT_FIELD (enum,BOOLEAN) initialize:1; + BIT_FIELD (enum,BOOLEAN) not_used:5; +} _pack OSPFV3_FLAGS; +#else /* _BYTE_ORDER == _BIG_ENDIAN */ +typedef _struct OSPFV3_FLAGS +{ + BIT_FIELD (enum,BOOLEAN) not_used:5; + BIT_FIELD (enum,BOOLEAN) initialize:1; + BIT_FIELD (enum,BOOLEAN) more:1; + BIT_FIELD (enum,BOOLEAN) master:1; +} _pack OSPFV3_FLAGS; +#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ + +typedef _union UNION_OSPFV3_FLAGS +{ + OSPFV3_FLAGS _bit; + BYTE _byte; +} _pack UNION_OSPFV3_FLAGS; + + +/**************************************************************************************/ + +/* RFC 2740 definition of LS_type, RFC 2740, annex A.4.2.1, page 59 +This field combines flooding scope and type. Is to be used ONLY by ntoh at LSA receival + and by hton at LSA sending. + For all computation purpose, please use the distinct fields flood and type defined in + structure OSPFV3_LS_HEADER below, + Reason: type preserves its index properties that it had in OSPFv2 (contiguous range, start at 0) so + type can be and is extensively used as index in LSDB. + Presenting the 2 fields flood and type combined into one field only affect order of endianness, + should only be taken in consideration at receiving / sending the LSA */ + +#if (_BYTE_ORDER == _LITTLE_ENDIAN ) +typedef _struct OSPFV3_LS_TYPE_AND_FLOOD_FIELD + { + BIT_FIELD_8 (enum,BOOLEAN) U:1; + BIT_FIELD_8 (enum,BOOLEAN) S1:1; + BIT_FIELD_8 (enum,BOOLEAN) S2:1; + BIT_FIELD_8 (enum,BOOLEAN) unused:5; + BIT_FIELD_8 (enum,BOOLEAN) lsa_function_code:8; + } _pack OSPFV3_LS_TYPE_AND_FLOOD_FIELD; +#else /* _BYTE_ORDER == _BIG_ENDIAN */ +typedef _struct OSPFV3_LS_TYPE_AND_FLOOD_FIELD + { + BIT_FIELD_8 (enum,BOOLEAN) lsa_function_code:8; + BIT_FIELD_8 (enum,BOOLEAN) unused:5; + BIT_FIELD_8 (enum,BOOLEAN) S2:1; + BIT_FIELD_8 (enum,BOOLEAN) S1:1; + BIT_FIELD_8 (enum,BOOLEAN) U:1; + } _pack OSPFV3_LS_TYPE_AND_FLOOD_FIELD; +#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ + +typedef _union UNION_OSPFV3_LS_TYPE +{ + OSPFV3_LS_TYPE_AND_FLOOD_FIELD _bit; + USHORT _ushort; +} _pack UNION_OSPFV3_LS_TYPE; + + +/**************************************************************************************/ + +/* definition of LSA header, as per RFC 2740, annex A.4.2, page 58 */ +typedef _struct OSPFV3_LS_HEADER +{ + USHORT age; + BYTE_ENUM (OSPFV3_LS_FLOODING_SCOPE) flood; /* OSPFv3 flooding scope, + first byte of LS type, RFC 2740 section A.4.2 */ + BYTE_ENUM (OSPFV3_LS_TYPE) type; /* Type of advertisement */ + ULONG id; /* Link State Id */ + ULONG advertising_router; + seq_t sequence_number; + USHORT checksum; + USHORT length; /* length of advertisement*/ +} _pack OSPFV3_LS_HEADER; + +/**************************************************************************************/ + +/* definition of OSPF HELLO PDU, as per RFC 2740, annex A.3.2, page 50 */ +typedef _struct OSPFV3_HELLO_HEADER +{ + ULONG interface_id; + BYTE router_priority; /* if set to 0, this router is not eligible to + become designated router */ + UNION_OSPFV3_OPTIONS options; + USHORT hello_interval; /* number of seconds between this router's Hello packets */ + USHORT router_dead_interval; /* number of seconds before declaring a silent router down */ + + ULONG designated_router; /* identity of the designated router for + this network */ + ULONG backup_designated_router; /* identity of the backup designated + router for this network */ + ULONG neighbor; /* IDs of each router from whom valid Hello packets + have been seen recently on this network */ +} _pack OSPFV3_HELLO_HEADER; + + +/**************************************************************************************/ + +/* definition of OSPF Database Description PDU, as per RFC 2740, annex A.3.3, page 51 */ +typedef _struct OSPFV3_DATABASE_HEADER +{ + /* RFC 2178 G.9 */ + + BYTE zero_field_1; + UNION_OSPFV3_OPTIONS options; + USHORT interface_mtu; + BYTE zero_field_2; + UNION_OSPFV3_FLAGS flags; + ULONG sequence; + OSPFV3_LS_HEADER link_state_advertisement_header; +} _pack OSPFV3_DATABASE_HEADER; + +/**************************************************************************************/ + +/* definition of OSPF Link State Request PDU, as per RFC 2740, annex A.3.4, page 53 */ +typedef _struct OSPFV3_LS_REQUESTED_ADVERTISEMENT +{ + BYTE reserved_bytes[2]; + BYTE_ENUM (OSPFV3_LS_FLOODING_SCOPE) flood; + BYTE_ENUM(OSPFV3_LS_TYPE) type; /* type of advertisement */ + ULONG id; /* Link State Id */ + ULONG advertising_router; +} _pack OSPFV3_LS_REQUESTED_ADVERTISEMENT; + +typedef _struct OSPFV3_LS_REQUEST_HEADER +{ + OSPFV3_LS_REQUESTED_ADVERTISEMENT requested_advertisement; +} _pack OSPFV3_LS_REQUEST_HEADER; + +/* Definition of OSPFv3 Link State Request PDU, as defined by RFC 2740, annex A.3.4, page 53 */ + +typedef struct OSPFV3_LS_REQUEST +{ + struct OSPFV3_LS_REQUEST *sptr_forward_link; + struct OSPFV3_LS_REQUEST *sptr_backward_link; + OSPFV3_LS_REQUESTED_ADVERTISEMENT lsr; /* link state requst PDU contents */ + seq_t sequence_number; + USHORT checksum; + USHORT age; + +} OSPFV3_LS_REQUEST; + + +/**************************************************************************************/ + +/* definition of OSPF Type 1 Lsa = Router LSA, as per RFC 2740, annex A.4.3, page 60 */ +#if (_BYTE_ORDER == _LITTLE_ENDIAN ) +typedef _struct OSPFV3_ROUTER_LINK_BIT_OPTIONS +{ + BIT_FIELD (enum,BOOLEAN) bit_B:1; + BIT_FIELD (enum,BOOLEAN) bit_E:1; + BIT_FIELD (enum,BOOLEAN) bit_V:1; + BIT_FIELD (enum,BOOLEAN) bit_W:1; + BIT_FIELD (enum,BOOLEAN) not_used:4; +} _pack OSPFV3_ROUTER_LINK_BIT_OPTIONS; +#else /* _BYTE_ORDER == _BIG_ENDIAN */ +typedef _struct OSPFV3_ROUTER_LINK_BIT_OPTIONS +{ + BIT_FIELD (enum,BOOLEAN) not_used:4; + BIT_FIELD (enum,BOOLEAN) bit_W:1; + BIT_FIELD (enum,BOOLEAN) bit_V:1; + BIT_FIELD (enum,BOOLEAN) bit_E:1; + BIT_FIELD (enum,BOOLEAN) bit_B:1; +} _pack OSPFV3_ROUTER_LINK_BIT_OPTIONS; +#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ + +typedef _union UNION_OSPFV3_ROUTER_LINK_BIT_OPTIONS +{ + OSPFV3_ROUTER_LINK_BIT_OPTIONS _bit; + BYTE _byte; /* was _ushort in OSPFv2 */ +} _pack UNION_OSPFV3_ROUTER_LINK_BIT_OPTIONS; + + +typedef _struct OSPFV3_ROUTER_LINK_PIECE +{ + BYTE_ENUM (OSPFV3_ROUTER_LINK_TYPE) type; + BYTE zero_filed; + USHORT metric; + ULONG interface_id; + ULONG neighbor_interface_id; + ULONG neighbor_router_id; +} _pack OSPFV3_ROUTER_LINK_PIECE; + + +typedef _struct OSPFV3_ROUTER_LINK_ADVERTISEMENT_HEADER +{ + OSPFV3_LS_HEADER ls_header; + UNION_OSPFV3_ROUTER_LINK_BIT_OPTIONS bit_options; + UNION_OSPFV3_OPTIONS options; + OSPFV3_ROUTER_LINK_PIECE link; +} _pack OSPFV3_ROUTER_LINK_ADVERTISEMENT_HEADER; + +typedef _struct OSPFV3_ROUTER_LSA_LINK +{ + OSPFV3_GENERIC_NODE links; + OSPFV3_ROUTER_LINK_ADVERTISEMENT_HEADER lsa; +} _pack OSPFV3_ROUTER_LSA_LINK; + + +/**************************************************************************************/ + +/* definition of OSPF type 2 LSA = Network LSAs, as per RFC 2740, annex A.4.4, page 63 */ +typedef _struct OSPFV3_NETWORK_LINK_PIECE +{ + ULONG link_id; +} _pack OSPFV3_NETWORK_LINK_PIECE; + +typedef _struct OSPFV3_NETWORK_LINK_ADVERTISEMENT_HEADER +{ + OSPFV3_LS_HEADER ls_header; + BYTE zero_field; + UNION_OSPFV3_OPTIONS options; /* three bytes */ + OSPFV3_NETWORK_LINK_PIECE attached_router; +} _pack OSPFV3_NETWORK_LINK_ADVERTISEMENT_HEADER; + +typedef _struct OSPFV3_NETWORK_LSA_LINK +{ + OSPFV3_GENERIC_NODE links; + OSPFV3_NETWORK_LINK_ADVERTISEMENT_HEADER lsa; + +} _pack OSPFV3_NETWORK_LSA_LINK; + + +/**************************************************************************************/ + +/* definition of OSPFv3 address prefix, as defined by RFC 2740, annex A.4.1, page 57, +for all LSAs including address prefix lists */ + +#if (_BYTE_ORDER == _LITTLE_ENDIAN ) +typedef _struct OSPFV3_IPV6_ADDR_PREFIX_BIT_OPTIONS + { + BIT_FIELD_8 (enum,BOOLEAN) NU:1; + BIT_FIELD_8 (enum,BOOLEAN) LA:1; + BIT_FIELD_8 (enum,BOOLEAN) MC:1; + BIT_FIELD_8 (enum,BOOLEAN) P:1; + BIT_FIELD_8 (enum,BOOLEAN) not_used:4; + } _pack OSPFV3_IPV6_ADDR_PREFIX_BIT_OPTIONS; +#else /* _BYTE_ORDER == _BIG_ENDIAN */ +typedef _struct PREFIX_BIT_OPTIONS + { + BIT_FIELD_8 (enum,BOOLEAN) not_used:4; + BIT_FIELD_8 (enum,BOOLEAN) P:1; + BIT_FIELD_8 (enum,BOOLEAN) MC:1; + BIT_FIELD_8 (enum,BOOLEAN) LA:1; + BIT_FIELD_8 (enum,BOOLEAN) NU:1; + } _pack OSPFV3_IPV6_ADDR_PREFIX_BIT_OPTIONS; +#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ + + +typedef _union UNION_OSPFV3_IPV6_ADDR_PREFIX_BIT_OPTIONS + { + OSPFV3_IPV6_ADDR_PREFIX_BIT_OPTIONS _bit; + BYTE _byte; + } _pack UNION_OSPFV3_IPV6_ADDR_PREFIX_BIT_OPTIONS; + +typedef _struct OSPFV3_IPV6_ADDR_PREFIX + { + BYTE prefix_length; + UNION_OSPFV3_IPV6_ADDR_PREFIX_BIT_OPTIONS prefix_options; + USHORT null_or_referenced_type_or_metric; /* this + 2 byte field always exists + between prefix_options and address_prefix in all prefix LSAs. Its value is: + null, unused in inter-area prefix LSAs and link-lsas, + metric for intra-area prefix LSAs, + referenced_ls_type for external LSAs */ + + struct in6_addr address_prefix; /* dsk changed to use definition of IPv6 address + from target/h/netinet6/in6.h */ + } _pack OSPFV3_IPV6_ADDR_PREFIX; + +typedef _struct OSPFV3_IPV6_ADDR_PREFIX_LINKS +{ + OSPFV3_GENERIC_NODE links; + OSPFV3_IPV6_ADDR_PREFIX prefix; +} _pack OSPFV3_IPV6_ADDR_PREFIX_LINKS; + +/* RFC 2740, section A.4.1: +Within OSPF, IPv6 address prefixes are always represented by a + combination of three fields: PrefixLength, PrefixOptions, and Address + Prefix. PrefixLength is the length in bits of the prefix. + PrefixOptions is an 8-bit field describing various capabilities + associated with the prefix (see Section A.4.2). Address Prefix is an + encoding of the prefix itself as an even multiple of 32-bit words, + padding with zero bits as necessary; this encoding consumes + (PrefixLength + 31) / 32) 32-bit words. + +*/ + +typedef _struct OSPFV3_IPV6_ADDR_PREFIX_RECEIVED + { + BYTE prefix_length; + UNION_OSPFV3_IPV6_ADDR_PREFIX_BIT_OPTIONS prefix_options; + USHORT null_or_referencedLSType_or_metric; /* this 2 byte field always exists + between prefix_options and address_prefix in all prefix LSAs. Its value is: + null, unused in inter-area prefix LSAs and link-lsas, + metric for intra-area prefix LSAs, + referenced_ls_type for external LSAs */ + ULONG address_prefix[OSPFV3_SIZE_OF_IPV6_ADDRESS_32BITWORDS]; + /* address prefix received is an even multiple of + 32 bit words = 0, 2 or 4 LWORDs */ + } _pack OSPFV3_IPV6_ADDR_PREFIX_RECEIVED; + + +/* these are used for storing prefixes associated with a routing table entry */ +typedef _struct OSPFV3_ROUTING_TABLE_ADDR_PREFIX + { + BYTE prefix_length; /* mask length */ + UNION_OSPFV3_IPV6_ADDR_PREFIX_BIT_OPTIONS prefix_options; + USHORT prefix_metric; + BYTE prefix_address; /* at least 1 byte in compressed format */ + } _pack OSPFV3_ROUTING_TABLE_ADDR_PREFIX; + +typedef _struct OSPFV3_ROUTING_TABLE_PREFIXES_AREA + { + short length; + short num_prefixes; + OSPFV3_ROUTING_TABLE_ADDR_PREFIX prefixes; + } _pack OSPFV3_ROUTING_TABLE_PREFIXES_AREA; + +/**************************************************************************************/ + + /* Definition of OPSFv3 type 3 LSA = Inter-area Prefix LSA, as defined by + RFC 2740, annex A.4.5, page 64 */ + +typedef _struct OSPFV3_INTER_AREA_PREFIX_LSA_HEADER + { + OSPFV3_LS_HEADER ls_header; + ULONG metric; + OSPFV3_IPV6_ADDR_PREFIX address_prefix; + } _pack OSPFV3_INTER_AREA_PREFIX_LSA_HEADER; + + +typedef _struct OSPFV3_INTER_AREA_PREFIX_LSA_LINK + { + OSPFV3_GENERIC_NODE links; + OSPFV3_INTER_AREA_PREFIX_LSA_HEADER lsa; + } _pack OSPFV3_INTER_AREA_PREFIX_LSA_LINK; + +/**************************************************************************************/ + + /* Definition of OSPFv3 type 4 LSAs = Inter-Area Router LSAs, as defined by + RFC 2740, annex A.4.6, page 65 */ + +typedef _struct OSPFV3_INTER_AREA_ROUTER_LSA_HEADER + { + OSPFV3_LS_HEADER ls_header; + BYTE zero_field; + UNION_OSPFV3_OPTIONS options; + ULONG metric; + ULONG destination_router_id; + } _pack OSPFV3_INTER_AREA_ROUTER_LSA_HEADER; + +typedef _struct OSPFV3_INTER_AREA_ROUTER_LSA_LINK + { + OSPFV3_GENERIC_NODE links; + OSPFV3_INTER_AREA_ROUTER_LSA_HEADER lsa; + } _pack OSPFV3_INTER_AREA_ROUTER_LSA_LINK; + + +/**************************************************************************************/ + +/* Definition of OSPFv3 type 5 LSAs = AS-external LSAs, as defined by + RFC 2740, annex A.4.7, page 66 */ + +typedef _struct OSPF_EXTERNAL_LINK_METRIC_PIECE + { + USHORT tos; + USHORT metric; + ULONG forwarding_address; + ULONG external_route_tag; + } _pack OSPFV3_EXTERNAL_LSA_LINK_METRIC_PIECE; + + +#if (_BYTE_ORDER == _LITTLE_ENDIAN ) +typedef _struct OSPFV3_AS_EXTERNAL_LSA_FLAGS_AND_METRIC +{ + BIT_FIELD_32 (enum,BOOLEAN) metric:24; + BIT_FIELD_8 (enum,BOOLEAN) T:1; + BIT_FIELD_8 (enum,BOOLEAN) F:1; + BIT_FIELD_8 (enum,BOOLEAN) E:1; + BIT_FIELD_8 (enum,BOOLEAN) not_used:5; +} _pack OSPFV3_AS_EXTERNAL_LSA_FLAGS_AND_METRIC; +#else /* _BYTE_ORDER == _BIG_ENDIAN */ +typedef _struct OSPFV3_AS_EXTERNAL_LSA_FLAGS_AND_METRIC +{ + BIT_FIELD_8 (enum,BOOLEAN) not_used:5; + BIT_FIELD_8 (enum,BOOLEAN) E:1; + BIT_FIELD_8 (enum,BOOLEAN) F:1; + BIT_FIELD_8 (enum,BOOLEAN) T:1; + BIT_FIELD_32 (enum,BOOLEAN) metric:24; +} _pack OSPFV3_AS_EXTERNAL_LSA_FLAGS_AND_METRIC; +#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ + +typedef _union UNION_OSPFV3_AS_EXTERNAL_LSA_FLAGS_AND_METRIC +{ + OSPFV3_AS_EXTERNAL_LSA_FLAGS_AND_METRIC _bit; + ULONG _ulong; +} _pack UNION_OSPFV3_AS_EXTERNAL_LSA_FLAGS_AND_METRIC; + + +typedef _struct OSPFV3_EXTERNAL_LINK_ADVERTISEMENT_HEADER { + OSPFV3_LS_HEADER ls_header; + UNION_OSPFV3_AS_EXTERNAL_LSA_FLAGS_AND_METRIC union_external_flags_metric; + OSPFV3_IPV6_ADDR_PREFIX address_prefix; + struct in6_addr template_forwarding_address; + ULONG template_external_route_tag; + ULONG template_referenced_link_state_id; +} _pack OSPFV3_EXTERNAL_LINK_ADVERTISEMENT_HEADER; + + +typedef _struct OSPFV3_EXTERNAL_LSA_LINK +{ + OSPFV3_GENERIC_NODE links; + OSPFV3_EXTERNAL_LINK_ADVERTISEMENT_HEADER lsa; +} _pack OSPFV3_EXTERNAL_LSA_LINK; + + +/**************************************************************************************/ + +/* Definition of OSPFv3 type 7 LSAs = NSSA (Not-so-stubby-area) LSAs */ + +/* dsk: port type 7 (NSSA) to IPv6 when specified (not part of RFC 2740, +it only specifies they are supported, not their format) OSPFV3_TYPE_7_LINK_ADVERTISEMENT_HEADER +*/ +#define OSPFV3_TYPE_7_LINK_ADVERTISEMENT_HEADER OSPFV3_EXTERNAL_LINK_ADVERTISEMENT_HEADER + +typedef _struct OSPFV3_TYPE_7_LSA_LINK +{ + OSPFV3_GENERIC_NODE links; + OSPFV3_TYPE_7_LINK_ADVERTISEMENT_HEADER lsa; +} _pack OSPFV3_TYPE_7_LSA_LINK; + + +/**************************************************************************************/ + +/* Definition of OSPFv3 type 8 LSA = Link LSA, as defined by RFC 2740, annex A.4.8, page 68 */ + +typedef _struct OSPFV3_LINK_LSA_HEADER + { + OSPFV3_LS_HEADER ls_header; + BYTE rtr_priority; + UNION_OSPFV3_OPTIONS options; + struct in6_addr link_local_interface_address; + ULONG number_prefixes; + OSPFV3_IPV6_ADDR_PREFIX address_prefix; + } _pack OSPFV3_LINK_LSA_HEADER; + +typedef _struct OSPFV3_LINK_LSA_LINK + { + OSPFV3_GENERIC_NODE links; + OSPFV3_LINK_LSA_HEADER lsa; + } _pack OSPFV3_LINK_LSA_LINK; + + +/**************************************************************************************/ + +/* Definition of OPSFv3 type 9 LSA = intra-area prefix LSA, as defined by + RFC 2740, annex A.4.9, page 70 */ + +typedef _struct OSPFV3_INTRA_AREA_PREFIX_LSA_HEADER + { + OSPFV3_LS_HEADER ls_header; + USHORT number_prefixes; + USHORT referenced_ls_type; + ULONG referenced_link_state_id; + ULONG referenced_adv_router; + OSPFV3_IPV6_ADDR_PREFIX address_prefix; + } _pack OSPFV3_INTRA_AREA_PREFIX_LSA_HEADER; + +typedef _struct OSPFV3_INTRA_AREA_PREFIX_LSA_LINK + { + OSPFV3_GENERIC_NODE links; + OSPFV3_INTRA_AREA_PREFIX_LSA_HEADER lsa; + } _pack OSPFV3_INTRA_AREA_PREFIX_LSA_LINK; + + +/**************************************************************************************/ + +/* Definition of union of all LSAs + +UNION_OSPFV3_ADVERTISEMENT_HEADER is union of LSAs of all types, used for definition of + link state update +UNION_OSPFV3_LINK_STATE_ADVERTISEMENT is union of pointers to LSAs of all types, + used for LSDB traversal + */ + +typedef _union UNION_OSPFV3_ADVERTISEMENT_HEADER +{ + OSPFV3_ROUTER_LINK_ADVERTISEMENT_HEADER router; + OSPFV3_NETWORK_LINK_ADVERTISEMENT_HEADER network; + OSPFV3_INTER_AREA_PREFIX_LSA_HEADER inter_area_prefix; + OSPFV3_INTER_AREA_ROUTER_LSA_HEADER inter_area_router; + OSPFV3_EXTERNAL_LINK_ADVERTISEMENT_HEADER external; + OSPFV3_EXTERNAL_LINK_ADVERTISEMENT_HEADER type_7; + + OSPFV3_LINK_LSA_HEADER link_lsa; + OSPFV3_INTRA_AREA_PREFIX_LSA_HEADER intra_area_prefix; +} _pack UNION_OSPFV3_ADVERTISEMENT_HEADER; + + +/* Definition of union of LSA pointers for all LSA types */ + +typedef union UNION_OSPFV3_LINK_STATE_ADVERTISEMENT + { + struct OSPFV3_ROUTER_LINK_ADVERTISEMENT_HEADER *sptr_router; + struct OSPFV3_NETWORK_LINK_ADVERTISEMENT_HEADER *sptr_network; + struct OSPFV3_INTER_AREA_PREFIX_LSA_HEADER *sptr_inter_area_prefix; + struct OSPFV3_INTER_AREA_ROUTER_LSA_HEADER *sptr_inter_area_router; + struct OSPFV3_EXTERNAL_LINK_ADVERTISEMENT_HEADER *sptr_external; + struct OSPFV3_TYPE_7_LINK_ADVERTISEMENT_HEADER *sptr_type_7; + struct OSPFV3_LINK_LSA_HEADER *sptr_link_lsa; + struct OSPFV3_INTRA_AREA_PREFIX_LSA_HEADER *sptr_intra_area_prefix; + +} UNION_OSPFV3_LINK_STATE_ADVERTISEMENT; + +/**************************************************************************************/ + +/* Definition of OSPFv3 Link State Update PDU, as defined by RFC 2740, annex A.3.5, page 54 */ + +typedef _struct OSPFV3_LS_UPDATE_HEADER +{ + ULONG number_of_advertisements; + UNION_OSPFV3_ADVERTISEMENT_HEADER advertisement_header; +} _pack OSPFV3_LS_UPDATE_HEADER; + + +/**************************************************************************************/ + +/* Definition of OSPFv3 Link State Acknowledge PDU, as defined by RFC 2740, annex A.3.6, page 55 */ + +typedef _struct OSPFV3_LS_ACKNOWLEDGEMENT_HEADER +{ + OSPFV3_LS_HEADER ls_advertisement_header; +} _pack OSPFV3_LS_ACKNOWLEDGEMENT_HEADER; + + +/**************************************************************************************/ + +/* Definition of union of OSPFv3 PDUs */ + +typedef _union UNION_OSPFV3_PACKET_TYPES +{ + OSPFV3_HELLO_HEADER hello; + OSPFV3_DATABASE_HEADER database; + OSPFV3_LS_REQUEST_HEADER ls_request; + OSPFV3_LS_UPDATE_HEADER ls_update; + OSPFV3_LS_ACKNOWLEDGEMENT_HEADER ls_acknowledgement; +} _pack UNION_OSPFV3_PACKET_TYPES; + + +/**************************************************************************************/ + +/* Definition of OSPFv3 PDU header as defined by RFC 2740, annex A.3.1, page 48 */ + +typedef _struct OSPFV3_HEADER /* the standard 24 byte header for OSPF (page 178) */ +{ + BYTE version; /* set to 2 for this implementation */ + BYTE_ENUM(OSPFV3_UNION_PACKET_TYPES) type; + USHORT length; /* length of entire OSPF protocol packet + in bytes, including the standard OSPF header */ + + ULONG router_id; /* identity of the router originating the packet */ + ULONG area_id; /* a 32 bit number identifying the area + this packet belongs to */ + + + USHORT checksum; /* checksum of the entire contents of the packet + starting with the OSPF packet header + but excluding the 64 bit authentication field */ + BYTE instance_id; + BYTE zero_field; + UNION_OSPFV3_PACKET_TYPES rest_of_packet; +} _pack OSPFV3_HEADER; + +/**************************************************************************************/ + +/* Definition of OSPFv3 PDU including IPv6 header, ip6_hdr, defined in wrn/coreip/protos/ipv6/ipv6.h */ + +typedef _struct OSPFV3_PACKET +{ + OSPFV3_HEADER header; +} _pack OSPFV3_PACKET; + +/**************************************************************************************/ + +typedef struct OSPFV3_LS_DATABASE_SUMMARY +{ + + struct OSPFV3_GENERIC_NODE links; + OSPFV3_HEADER *sptr_ospfv3_header; + USHORT size_of_packet; /* length of this packet including ospf header size */ + USHORT number_of_database_entries; +} OSPFV3_LS_DATABASE_SUMMARY; + +/**************************************************************************************/ + + + +/**************************************************************************************/ +/****************************/ +/* Routing Table Structures */ +/****************************/ + +typedef struct OSPFV3_NEXT_HOP_BLOCK +{ + struct OSPFV3_NEXT_HOP_BLOCK *sptr_forward_link; + struct OSPFV3_NEXT_HOP_BLOCK *sptr_backward_link; + ULONG outgoing_router_interface; + ULONG next_hop_router; + enum OSPFV3_ROUTE_STATUS route_status; + +} OSPFV3_NEXT_HOP_BLOCK; + +/**************************************************************************************/ +/* SPR 88619 start */ +typedef struct OSPFV3_LSA_TIMESTAMP_PER_INTERFACE_LIST +{ + struct OSPFV3_LSA_TIMESTAMP_PER_INTERFACE_LIST *sptr_forward_link; + struct OSPFV3_LSA_TIMESTAMP_PER_INTERFACE_LIST *sptr_backward_link; + ULONG if_index; + ULONG neighbor_id; + ULONG timestamp; +} OSPFV3_LSA_TIMESTAMP_PER_INTERFACE_LIST; + + +typedef struct OSPFV3_LS_DATABASE_ENTRY + { + OSPFV3_GENERIC_NODE links; +#ifdef OSPFV3_AGGREGATE_OPTIMIZE + OSPFV3_GENERIC_NODE links_lsa_aggregate; /* links the chain LSAs that + are pieces of an aggregate LSA together: + Type 1 LSA: chain multiple router LSAs of same router + chain last type 1 LSA of aggregate to + type 9 LSA describing the router + Type 2 LSA: chain to type 9 LSA describing the link + Type 9 LSA: chain multiple type 9 LSAs describing + same link (for type 9 LSA describing + a router, only 1 LSA per router, + RFC 2740, page 32) */ +#endif + UNION_OSPFV3_LINK_STATE_ADVERTISEMENT advertisement; + + struct OSPFV3_AREA_ENTRY *sptr_ls_database_area; /* for keeping count of db's in each area */ + + struct OSPFV3_INTERFACE *sptr_ls_database_interface; /* This is necessary for local scope lsas to associate + them to the interface received or originated on.*/ + + ULONG ls_database_time_stamp; /* for keeping age - stamped when arrived */ + + struct OSPFV3_NEIGHBOR_LIST *sptr_ls_database_retrans; /* neighbors pointing to this ls_database */ + enum OSPFV3_SEQUENCE_STATE ls_database_sequence_state; + +/* SPR 88619 start */ + OSPFV3_LSA_TIMESTAMP_PER_INTERFACE_LIST * sptr_lsa_retransmit_timestamps_per_neighbor; +/* SPR 88619 end */ + + enum OSPFV3_LS_TYPE ls_database_type; + + ULONG lsa_age_after_maxage; /* counts age of LSA after maxage */ + +} OSPFV3_LS_DATABASE_ENTRY; + + +typedef struct OSPFV3_ROUTING_TABLE_ENTRY +{ + + enum OSPFV3_ROUTE_DESTINATION_TYPE destination_type; + ULONG destination_id; + OSPFV3_ROUTING_TABLE_PREFIXES_AREA *sptr_prefixes; /* area with all prefixes defined for this network entity (router or network link) */ + BYTE_ENUM (BOOLEAN) type_5_route_originated; + UNION_OSPFV3_OPTIONS optional_capabilities; + struct OSPFV3_AREA_ENTRY *sptr_area; + enum OSPFV3_ROUTE_PATH_TYPE path_type; + ULONG path_cost; + ULONG type2_cost; + ULONG link_state_id; + BYTE_ENUM (OSPFV3_LS_TYPE) link_type; + ULONG advertising_router; + OSPFV3_LS_DATABASE_ENTRY *sptr_link_state_origin; + OSPFV3_NEXT_HOP_BLOCK *sptr_next_hop; + struct in6_addr forwarding_address; + +} OSPFV3_ROUTING_TABLE_ENTRY; + +typedef struct OSPFV3_ROUTING_TABLE_NODE +{ + struct OSPFV3_ROUTING_TABLE_NODE *sptr_forward_link; + struct OSPFV3_ROUTING_TABLE_NODE *sptr_backward_link; + BYTE_ENUM (BOOLEAN) active_areas_discarded_entry; /* discard_entry */ + enum OSPFV3_ROUTE_STATUS route_node_status; + OSPFV3_ROUTING_TABLE_ENTRY *sptr_routing_table_entry; +} OSPFV3_ROUTING_TABLE_NODE; + +/* this is used during routing table lookup, to avoid 2 passes through the +list of prefixes of a routing table entry, +one to find a match, one to find best match, +maintain best match from first pass. +This has exactly same fields of OSPFV3_ROUTING_TABLE_NODE plus the most specific mask */ +typedef struct OSPFV3_ROUTING_TABLE_LOOKUP_TEMP_NODE +{ + struct OSPFV3_ROUTING_TABLE_LOOKUP_TEMP_NODE *sptr_forward_link; + struct OSPFV3_ROUTING_TABLE_LOOKUP_TEMP_NODE *sptr_backward_link; + BYTE_ENUM (BOOLEAN) active_areas_discarded_entry; /* discard_entry */ + enum OSPFV3_ROUTE_STATUS route_node_status; + OSPFV3_ROUTING_TABLE_ENTRY *sptr_routing_table_entry; + BYTE most_specific_mask; +} OSPFV3_ROUTING_TABLE_LOOKUP_TEMP_NODE; + +/**************************************************************************************/ + +typedef union UNION_OSPFV3_VIRTUAL_ROUTE +{ + OSPFV3_ROUTING_TABLE_ENTRY *sptr_ospfv3_route; +} UNION_OSPFV3_VIRTUAL_ROUTE; + + +typedef struct OSPFV3_LS_DATABASE_NODE +{ + struct OSPFV3_LS_DATABASE_NODE *sptr_forward_link; + struct OSPFV3_LS_DATABASE_NODE *sptr_backward_link; + + OSPFV3_LS_DATABASE_ENTRY *sptr_ls_database_entry; + ULONG periodic_retransmit_time_counter; + BYTE_ENUM (BOOLEAN) flood; /* true if flooding this one */ +} OSPFV3_LS_DATABASE_NODE; + +typedef struct OSPFV3_DATABASE_INFORMATION_STRUCTURE /* used in ospfv3_flood.c */ +{ + BYTE_ENUM (BOOLEAN) found_link_state_advertisement_in_database; + OSPFV3_LS_DATABASE_ENTRY *sptr_database_entry; + struct OSPFV3_INTERFACE *sptr_interface; + struct OSPFV3_NEIGHBOR *sptr_neighbor; + UNION_OSPFV3_LINK_STATE_ADVERTISEMENT new_advertisement; + ULONG time_difference; + struct in6_addr source_address; + struct in6_addr destination_address; +} OSPFV3_DATABASE_INFORMATION_STRUCTURE; + + +/**************************************************************************************/ + +/* Definition of OSPFV3_NEIGHBOR */ + +typedef struct OSPFV3_NEIGHBOR +{ + struct OSPFV3_NEIGHBOR *sptr_forward_link; + struct OSPFV3_NEIGHBOR *sptr_backward_link; + struct OSPFV3_INTERFACE *sptr_interface; + enum OSPFV3_NEIGHBOR_STATE state; + + ULONG events; /* Number of state changes */ + ULONG last_hello; /* Time last hello was received from this neighbor */ + ULONG periodic_inactivity_time_counter; + BYTE_ENUM (BOOLEAN) inactivity_timer_enabled; + enum OSPFV3_NEIGHBOR_MODE mode; /* Master or slave mode */ + UNION_OSPFV3_FLAGS flags; /* For passing initialize, more and master/slave bits */ + /* ANVL 43.2 */ + UNION_OSPFV3_FLAGS last_dd_flags; /* For recording values received in last DD packet from neighbor + for initialize, more and master/slave bits */ + UNION_OSPFV3_OPTIONS options; + seq_t database_description_sequence_number; + seq_t last_received_dd_sequence_number; + ULONG last_exchange; /* Time last exchange was received from this neighbor - hold timer */ + ULONG periodic_slave_hold_time_counter; + USHORT priority; /* 0 means not eligible to become the Designated Router */ + ULONG id; /* neighbor ID = its router ID */ + + /* Neighbor's Interface ID. RFC 2740, section 3.1.3 + The interface ID that the neighbor advertises in its Hello packets + */ + ULONG neighbor_interface_id; + + /* Neighbor IP address. RFC 2740, section 3.1.3 */ + struct in6_addr address; + + /* In OSPFv3 Neighbor's designated and backup designated routers are encoded as + Router IDs, instead of IP addresses. See RFC 2740, section 3.1.3 + HME kept the structures as ULONG + */ + ULONG designated_router; + ULONG backup_designated_router; + + OSPFV3_LS_DATABASE_NODE *sptr_retransmit; /* Link state advertisements waiting for acknowledgements */ + OSPFV3_LS_DATABASE_SUMMARY *sptr_database_summary; /* Database summary packets that make up area database */ + + OSPFV3_LS_REQUEST *sptr_ls_request[OSPFV3_NUM_LSA_REQUEST_INDEX]; + + USHORT retransmit_queue_count; + USHORT database_summary_queue_count; + USHORT ls_request_queue_count; + + BYTE_ENUM (BOOLEAN) ls_request_list_has_changed; + + ULONG mib_address_less_index; + BYTE_ENUM (BOOLEAN) mib_nbma_status; + BYTE_ENUM (BOOLEAN) mib_nbma_permanence; + BYTE_ENUM (BOOLEAN) mib_hello_suppressed; + ULONG mib_area_id; + +} OSPFV3_NEIGHBOR; + +/**************************************************************************************/ + +typedef struct OSPFV3_DESIGNATED_ROUTER_NODE +{ + ULONG id; + struct in6_addr address; + enum OSPFV3_NEIGHBOR_STATE state; + USHORT priority; /* 0 means not eligible to become the Designated Router */ +} OSPFV3_DESIGNATED_ROUTER_NODE; + +/**************************************************************************************/ + +/* Definition of OSPFv3 interface */ + +#if (_BYTE_ORDER == _LITTLE_ENDIAN ) +typedef _struct OSPFV3_INTERFACE_FLAGS +{ + BIT_FIELD (enum, BOOLEAN) network_scheduled:1; /* When designated router: semaphore for generating link state advertisements */ + BIT_FIELD (enum, BOOLEAN) enable:1; /* Interface is enabled */ + BIT_FIELD (enum, BOOLEAN) build_network:1; /* Flag to build_net_lsa */ + BIT_FIELD (enum, BOOLEAN) neighbor_change:1; /* Schedule neighbor change */ + BIT_FIELD (enum, BOOLEAN) multicast:1; /* Interface is multicast capable */ + BIT_FIELD (enum, BOOLEAN) cost_set:1; /* Cost was manually configured */ + BIT_FIELD (enum, BOOLEAN) unused:1; /* Secondary authentication key */ + BIT_FIELD (enum,BOOLEAN) build_type9:1; +} _pack OSPFV3_INTERFACE_FLAGS; +#else /* _BYTE_ORDER == _BIG_ENDIAN */ +typedef _struct OSPFV3_INTERFACE_FLAGS +{ + BIT_FIELD (enum, BOOLEAN) build_type9:1; /* Type 8 LSA received, must build type 9 LSA if designated router */ + BIT_FIELD (enum, BOOLEAN) unused:1; /* Secondary authentication key */ + BIT_FIELD (enum, BOOLEAN) cost_set:1; /* Cost was manually configured */ + BIT_FIELD (enum, BOOLEAN) multicast:1; /* Interface is multicast capable */ + BIT_FIELD (enum, BOOLEAN) neighbor_change:1; /* Schedule neighbor change */ + BIT_FIELD (enum, BOOLEAN) build_network:1; /* Flag to build_net_lsa */ + BIT_FIELD (enum, BOOLEAN) enable:1; /* Interface is enabled */ + BIT_FIELD (enum, BOOLEAN) network_scheduled:1; /* When designated router: semaphore for generating link state advertisements */ +} _pack OSPFV3_INTERFACE_FLAGS; +#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ + +typedef _union UNION_OSPFV3_INTERFACE_FLAGS +{ + OSPFV3_INTERFACE_FLAGS _bit; + BYTE _byte; +} _pack UNION_OSPFV3_INTERFACE_FLAGS; + + +typedef struct OSPFV3_LS_HEADER_QUEUE +{ + struct OSPFV3_LS_HEADER_QUEUE *sptr_forward_link; + struct OSPFV3_LS_HEADER_QUEUE *sptr_backward_link; + OSPFV3_LS_HEADER ls_header; +} OSPFV3_LS_HEADER_QUEUE; + + +typedef struct OSPFV3_LS_DATABASE_HEAD + { + OSPFV3_LS_DATABASE_ENTRY *sptr_database_entry; + AVL_NODE * sptr_avl_database_entry; /* AVL LSA tree */ + } OSPFV3_LS_DATABASE_HEAD; + + +/* OSPFv3 interface datastructure */ + +typedef struct OSPFV3_INTERFACE + { + struct OSPFV3_INTERFACE *sptr_forward_link; + struct OSPFV3_INTERFACE *sptr_backward_link; + struct ifnet *vx_ospfv3_interface; + /* HME add new structures for OSPFv3 as per RFC 2740, section 3.1.2. */ + + ULONG interface_id; + + /* Instance ID enables multiple instances of OSPF to be run over a single link. */ + BYTE instance_id; + + /* A new data structure for LSAs with Link-Local flooding scope. + link_local_database_hash_table[1] contains all LSAs with UNKNOWN LS types and Link-Local flooding scope. + link_local_database_hash_table[0] contains all LSAs with KNOWN LS types and Link-Local flooding scope + */ + OSPFV3_LS_DATABASE_HEAD ls_database_hash_table[OSPFV3_NUM_INTERFACE_LSA_HASHES][OSPFV3_HASH_TABLE_SIZE]; + /* number of interface link LSAs in the interface LSDB */ + ULONG interface_lsa_count; + /* sum of checksums of all link LSAs for fast comparison of LSDB of 2 routers */ + ULONG interface_lsa_checksum; + + /* The list of IPv6 prefixes configured for the attached link*/ + OSPFV3_IPV6_ADDR_PREFIX_LINKS *sptr_list_of_prefixes; + + /* IP interface address. */ + struct in6_addr address; /* a link_local address */ + BYTE netmask; /* link local address length */ + USHORT ifnet_flags; + ULONG area_id; + BYTE_ENUM (BOOLEAN) port_enabled; + + enum OSPFV3_INTERFACE_TYPE type; + enum OSPFV3_INTERFACE_STATE state; + ULONG events; /* Number of state changes */ + ULONG mtu; + struct OSPFV3_AREA_ENTRY *sptr_area; /* The area this interface is in */ + struct OSPFV3_AREA_ENTRY *sptr_transit_area; + ULONG source_area_id_for_virtual_link; + + ULONG router_dead_interval; /* Number of seconds before the router's sptr_neighbors will declare it down */ + ULONG transmit_delay; /* Estimated number of seconds it takes to transmit a link state update packet over this interface */ + USHORT priority; /* If set to 0, this router is not eligible to become designated router on the attached network */ + + OSPFV3_NEIGHBOR *sptr_neighbor; + OSPFV3_NEIGHBOR potential_neighbor; + ULONG virtual_neighbor_rid; + ULONG virtual_neighbor_intf_id; + + USHORT number_of_neighbors_in_init_state; + USHORT number_of_neighbors_in_exchange_state; + USHORT number_of_neighbors_in_full_state; + + OSPFV3_DESIGNATED_ROUTER_NODE designated_router; + OSPFV3_DESIGNATED_ROUTER_NODE backup_designated_router; + USHORT cost; /* One for each type of service */ + + ULONG hello_interval; /* Length of time, in seconds, between Hello packets sent on this interface */ + ULONG poll_interval; /* the default poll interval is 4 * the hello interval */ + ULONG periodic_hello_time_counter; + BYTE_ENUM (BOOLEAN) hello_timer_enabled; + ULONG last_hello_time; + ULONG retransmit_interval; + ULONG periodic_retransmit_time_counter; + BYTE_ENUM (BOOLEAN) retransmit_timer_enabled; + ULONG periodic_wait_time_counter; /* single shot timer */ + BYTE_ENUM (BOOLEAN) wait_timer_enabled; + + ULONG periodic_delayed_acknowledgement_time_counter; /* single shot timer - sort of */ + BYTE_ENUM (BOOLEAN) delayed_acknowledgement_timer_enabled; + + UNION_OSPFV3_INTERFACE_FLAGS flags; + OSPFV3_LS_HEADER_QUEUE *sptr_head_of_delayed_acknowledgement_list; + ULONG number_of_acknowledgements_on_delayed_acknowledgement_list; + + ULONG lock_time; + ULONG up_time; /* Time interface came up */ + + BYTE_ENUM (BOOLEAN) point_timer_enabled; + ULONG port_number; /* Unnumbered link support jkw */ + + BYTE_ENUM (BOOLEAN) passive; + /* TBD: for unnumbered interfaces, should this interface be of type in6_addr or ULONG */ + ULONG unnumbered_dest_ip; /* unnumbered link dest ip */ + ULONG unnumbered_router_id; /* unnumbered link router id */ + ULONG nbma_ptmp_neighbor_id; /* __NBMA_PTMP__ */ + struct in6_addr nbma_ptmp_neighbor_address; /* __NBMA_PTMP__ */ + ULONG nbma_ptmp_neighbor_intf_id; + ULONG number_of_prefixes; + OSPFV3_IPV6_ADDR_PREFIX_LINKS * sptr_site_local_or_global_addresses; + } OSPFV3_INTERFACE; + + +typedef struct OSPFV3_INTERFACE_NODE +{ + struct OSPFV3_INTERFACE_NODE *sptr_forward_link; + struct OSPFV3_INTERFACE_NODE *sptr_backward_link; + OSPFV3_INTERFACE *sptr_interface; +} OSPFV3_INTERFACE_NODE ; + +/**************************************************************************************/ + +typedef struct OSPFV3_HOSTS +{ + struct OSPFV3_HOSTS *sptr_forward_link; + struct OSPFV3_HOSTS *sptr_backward_link; + struct in6_addr interface_address; + ULONG type_of_service; + USHORT cost; + BYTE_ENUM (BOOLEAN) status; + ULONG area_id; +} OSPFV3_HOSTS; + + +/**************************************************************************************/ + +typedef struct OSPFV3_SHORTEST_PATH_NODE +{ + struct OSPFV3_SHORTEST_PATH_NODE *sptr_forward_link; + struct OSPFV3_SHORTEST_PATH_NODE *sptr_backward_link; +/* unique identification for a vertex (or any entity) in OSPFv3: + ID and advertising router, not just ID */ + /*ULONG vertex;*/ /* temporary + comment out vertex to locate via compiler all places where + identification via vertex + should be replaced with identification via (vertex and adv. router) */ + ULONG vertexv3; + ULONG adv_router; + + BYTE_ENUM (OSPFV3_LS_TYPE) vertex_type; + OSPFV3_LS_DATABASE_ENTRY *sptr_database_entry; + ULONG cost; + ULONG intervening_router; + OSPFV3_NEXT_HOP_BLOCK *sptr_next_hop; +} OSPFV3_SHORTEST_PATH_NODE; + +/**************************************************************************************/ + +/* definition of Area and address range */ + +#if (_BYTE_ORDER == _LITTLE_ENDIAN ) +typedef _struct OSPFV3_AREA_FLAGS +{ + BIT_FIELD (enum, BOOLEAN) transit:1; /* This is a transit area */ + BIT_FIELD (enum, BOOLEAN) virtual_up:1; /* One or more virtual links in this area are up */ + BIT_FIELD (enum, BOOLEAN) stub:1; /* This is a area (no external routes) */ + BIT_FIELD (enum, BOOLEAN) nssa:1; /* This is a not so stubby area */ + BIT_FIELD (enum, BOOLEAN) stub_default:1; /* Inject default into this stub area */ + BIT_FIELD (enum,BOOLEAN) not_used:3; +} _pack OSPFV3_AREA_FLAGS; +#else /* _BYTE_ORDER == _BIG_ENDIAN */ +typedef _struct OSPFV3_AREA_FLAGS +{ + BIT_FIELD (enum,BOOLEAN) not_used:3; + BIT_FIELD (enum, BOOLEAN) stub_default:1; /* Inject default into this stub area */ + BIT_FIELD (enum, BOOLEAN) nssa:1; /* This is a not so stubby area */ + BIT_FIELD (enum, BOOLEAN) stub:1; /* This is a area (no external routes) */ + BIT_FIELD (enum, BOOLEAN) virtual_up:1; /* One or more virtual links in this area are up */ + BIT_FIELD (enum, BOOLEAN) transit:1; /* This is a transit area */ +} _pack OSPFV3_AREA_FLAGS; +#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ + +typedef _union UNION_OSPFV3_AREA_FLAGS +{ + OSPFV3_AREA_FLAGS _bit; + BYTE _byte; +} _pack UNION_OSPFV3_AREA_FLAGS; + + +typedef struct OSPFV3_ADDRESS_RANGE_LIST_ENTRY /* list of networks associated with an area (section 6 of OSPF Version 2 specification, dated June 1995) */ +{ + struct OSPFV3_ADDRESS_RANGE_LIST_ENTRY *sptr_forward_link; + struct OSPFV3_ADDRESS_RANGE_LIST_ENTRY *sptr_backward_link; + ULONG area_id; + + struct in6_addr network; + ULONG mask; + BYTE_ENUM (BOOLEAN) advertise; + BYTE_ENUM (BOOLEAN) active; + ULONG cost; + struct OSPFV3_ROUTING_TABLE_NODE *sptr_discard_entries; +} OSPFV3_ADDRESS_RANGE_LIST_ENTRY; + + +/* OSPFv3 area datastructure */ + +typedef struct OSPFV3_AREA_ENTRY + { + struct OSPFV3_AREA_ENTRY *sptr_forward_link; + struct OSPFV3_AREA_ENTRY *sptr_backward_link; + ULONG area_id; + + /* area address ranges */ + ULONG number_of_address_ranges; /* for this area */ + OSPFV3_ADDRESS_RANGE_LIST_ENTRY *sptr_address_ranges; + + /* associated router interfaces */ + OSPFV3_INTERFACE *sptr_interfaces; /* this is setup at configuration time */ + + /* summary links advertisements */ + /*TODO!!!!!!: convert this to OSPFV3_LS_DATABASE_NODE or move it to ls_database_hash_table*/ + struct OSPFV3_ADVERTISEMENT_NODE *sptr_summary_advertisement_list_head; + + UNION_OSPFV3_AREA_FLAGS flags; /* Various state bits */ + ULONG stub_default_cost; + + /* shortest-path tree */ + OSPFV3_SHORTEST_PATH_NODE shortest_path_first_tree; /* area's shortest path first tree; head is this router */ + ULONG shortest_path_first_run_count; /* # times spf has been run for this area */ + BYTE_ENUM (BOOLEAN) run_shortest_path_calculation; + ULONG shortest_path_calculation_time_counter; + OSPFV3_SHORTEST_PATH_NODE *sptr_candidate; /* area's candidate list for dijkstra */ + + OSPFV3_LS_DATABASE_HEAD ls_database_hash_table[OSPFV3_NUM_AREA_LSA_HASHES][OSPFV3_HASH_TABLE_SIZE]; + + /* number of LSAs in the area LSDB */ + ULONG area_lsa_count; + /* sum of checksums of all LSAs of an area for fast comparison of LSDB of 2 routers */ + ULONG area_lsa_checksum; + + USHORT number_of_autonomous_system_boundary_routers; + + USHORT number_of_area_border_routers; + + USHORT number_of_neighbors_in_init_state; + USHORT number_of_neighbors_in_exchange_state; + USHORT number_of_neighbors_in_full_state; + + USHORT number_of_interfaces_in_up_state; + ULONG lock_time; + BYTE build_router; + BYTE_ENUM (BOOLEAN) bring_up_virtual_links; + ULONG periodic_MinLSInterval_time_counter; + BYTE_ENUM (BOOLEAN) MinLSInterval_timer_enabled; + BYTE_ENUM (BOOLEAN) inject_default_route_if_stub_area; + + USHORT mib_number_of_link_state_advertisements; + ULONG mib_checksum_sum; + + ULONG mib_stub_metric_type; /* 1 = ospf metric, 2 = comparable cost, 3 = non comparable */ + + USHORT mib_number_of_type10_lsa; + ULONG mib_type10_checksum_sum; + ULONG nssa_abr_to_convert_type_7_to_type_5; + /* RFC 2740 page 19, a routing table for wach area holding + intermediate results during routing table build for area. + It contains: + one entry for every router in the area + one entry for every transit link traversing the area */ + OSPFV3_ROUTING_TABLE_NODE *sptr_routing_table_for_area; + + } OSPFV3_AREA_ENTRY; + +typedef struct OSPFV3_STUB_AREA_ENTRY + { + struct OSPFV3_STUB_AREA_ENTRY *sptr_forward_link; + struct OSPFV3_STUB_AREA_ENTRY *sptr_backward_link; + struct OSPFV3_AREA_ENTRY *sptr_area; + } OSPFV3_STUB_AREA_ENTRY; + + +typedef struct OSPFV3_TRANSIT_AREA_ENTRY +{ + struct OSPFV3_TRANSIT_AREA_ENTRY *sptr_forward_link; + struct OSPFV3_TRANSIT_AREA_ENTRY *sptr_backward_link; + struct OSPFV3_AREA_ENTRY *sptr_area; +} OSPFV3_TRANSIT_AREA_ENTRY; + + +/**************************************************************************************/ + +/**********************************/ +/* Link State Database Structures */ +/**********************************/ + +typedef struct OSPFV3_ADVERTISEMENT_NODE +{ + struct OSPFV3_ADVERTISEMENT_NODE *sptr_forward_link; + struct OSPFV3_ADVERTISEMENT_NODE *sptr_backward_link; + UNION_OSPFV3_LINK_STATE_ADVERTISEMENT advertisement; +} OSPFV3_ADVERTISEMENT_NODE; + +/**************************************************************************************/ + +typedef struct OSPFV3_NEIGHBOR_LIST +{ + struct OSPFV3_NEIGHBOR_LIST *sptr_forward_link; + struct OSPFV3_NEIGHBOR_LIST *sptr_backward_link; + struct OSPFV3_NEIGHBOR *sptr_neighbor; +} OSPFV3_NEIGHBOR_LIST; + +/**************************************************************************************/ + +/* definition of port structures */ + +typedef struct OSPFV3_PORT_CONFIGURATION_CLASS +{ + BYTE_ENUM (BOOLEAN) port_enabled; + USHORT virtual_port_number; + ULONG if_index; + ULONG area_id; + ULONG transit_area_id; + ULONG source_area_id_for_virtual_link; /* The area to which VLink belongs */ + ULONG type; + ULONG router_dead_interval; + ULONG transmit_delay; + USHORT priority; + USHORT cost; + ULONG hello_interval; + ULONG virtual_neighbor_rid; /* Router ID */ + ULONG virtual_neighbor_intf_id; + BYTE_ENUM (BOOLEAN) passive; + +/* dsk: TODO: figure out functionality of unnumbered interfaces (unnumbered = do not have IPv6 address, only some ID, keep it at ULONG size */ + ULONG unnumbered_dest_ip; /* unnumbered dest ip*/ + + ULONG poll_interval; + ULONG retransmit_interval; + struct in6_addr nbma_ptmp_neighbor_address; /* __NBMA_PTMP__ */ + ULONG nbma_ptmp_neighbor_id; /* __NBMA_PTMP__ */ + ULONG nbma_ptmp_neighbor_intf_id; + +} OSPFV3_PORT_CONFIGURATION_CLASS; + +typedef struct OSPFV3_PORT_CLASS +{ + OSPFV3_PORT_CONFIGURATION_CLASS config; /* this portion is configured by NVRAM */ + +} OSPFV3_PORT_CLASS; + +/**************************************************************************************/ + +typedef struct OSPFV3_AREA_CONFIGURATION_CLASS +{ + ULONG area_id; + BYTE_ENUM (BOOLEAN) advertise_address_range; + ULONG address_range_cost; + BYTE_ENUM (BOOLEAN) external_routing_capability_enabled; + BYTE_ENUM (BOOLEAN) inject_default_route_if_stub_area; + ULONG stub_default_cost; + ULONG number_of_area_address_ranges; /* number of areas, 0 will always be the backbone */ + +} OSPFV3_AREA_CONFIGURATION_CLASS; + +typedef struct OSPFV3_AREA_CLASS +{ + OSPFV3_AREA_CONFIGURATION_CLASS config; /* this portion is configured by NVRAM */ +} OSPFV3_AREA_CLASS; + +/**************************************************************************************/ +/* RFC 2178 G.3 */ +typedef struct OSPFV3_AREA_ADDRESS_RANGE_CONFIGURATION_CLASS +{ + + + struct in6_addr network; + ULONG mask_length; + BYTE_ENUM (BOOLEAN) advertise; + BYTE_ENUM (BOOLEAN) active; + ULONG cost; + ULONG area_id; +} OSPFV3_AREA_ADDRESS_RANGE_CONFIGURATION_CLASS; + +/* RFC 2178 G.3 */ +typedef struct OSPFV3_AREA_ADDRESS_RANGE_CLASS +{ + OSPFV3_AREA_ADDRESS_RANGE_CONFIGURATION_CLASS config; +} OSPFV3_AREA_ADDRESS_RANGE_CLASS; + +/**************************************************************************************/ + +typedef struct OSPFV3_EXTERNAL_ROUTE +{ + struct OSPFV3_EXTERNAL_ROUTE *sptr_forward_link; + struct OSPFV3_EXTERNAL_ROUTE *sptr_backward_link; + ULONG destination_id; + struct in6_addr destination_network; + ULONG destination_mask; + ULONG metric; + + struct in6_addr forwarding_address; + ULONG tag; + ULONG time_stamp; + ULONG advertising_router; + /* SPR 85050 */ + ULONG route_protocol; + +} OSPFV3_EXTERNAL_ROUTE; + +/**************************************************************************************/ + +typedef struct OSPFV3_MIB_GENERAL_ENTRY +{ + ULONG ospfv3VersionNumber; + BYTE_ENUM (BOOLEAN) ospfv3AreaBdrRtrStatus; + ULONG ospfv3ExternLsaCount; + ULONG ospfv3ExternLsaCksumSum; + ULONG ospfv3OriginateNewLsas; + ULONG ospfv3RxNewLsas; +} OSPFV3_MIB_GENERAL_ENTRY; + + + +typedef struct WRN_OSPFV3_MIB_GENERAL_ENTRY +{ + int dummy; +} WRN_OSPFV3_MIB_GENERAL_ENTRY; + + + +typedef struct OSPFV3_ADDRESS_MASK_PAIRS +{ + struct OSPFV3_ADDRESS_MASK_PAIRS *sptr_forward_link; + struct OSPFV3_ADDRESS_MASK_PAIRS *sptr_backward_link; + + struct in6_addr network_address; + ULONG network_mask; + ULONG metric_type; + ULONG metric_value; + +} OSPFV3_ADDRESS_MASK_PAIRS; + +typedef struct OSPFV3_REDISTRIBUTION_CONFIGURATION +{ + enum BOOLEAN redistribute_all_bgp; + enum BOOLEAN redistribute_all_rip; + enum BOOLEAN redistribute_all_static; + enum BOOLEAN redistribute_ip_default_route; + + OSPFV3_GENERIC_NODE ospfv3_imported_rip_subnets; + OSPFV3_GENERIC_NODE ospfv3_imported_static_subnets; + OSPFV3_GENERIC_NODE ospfv3_imported_bgp_subnets; + +} OSPFV3_REDISTRIBUTION_CONFIGURATION; + +/**************************************************************************************/ + +typedef struct OSPFV3_IP6_ROUTE_ENTRY +{ + struct in6_addr target; /* network address */ + ULONG mask; /* network address prefix length */ + struct in6_addr forwarding_address; /* forwarding address when redistributing routes from other protocols into OSPF: local attached subnet, or point-to-point link */ + ULONG gateway;/* next hop router for redistributing OSPF routes to other protocols. 0: local attached subnet, or point-to-point link */ + ULONG metric; /* primary metric */ + ULONG metric_2; /* alternative metric 2 */ + ULONG metric_3; /* alternative metric 3 */ + ULONG metric_4; /* alternative metric 4 */ + ULONG metric_5; /* alternative metric 5 */ + ULONG flags; + BYTE weight; + ULONG protocol; + USHORT route_tag; + ULONG advertising_router; + void* p_ifnet; +} OSPFV3_IP6_ROUTE_ENTRY; + + +/**************************************************************************************/ + + +#define OSPFV3_TASK_NAME_SIZE 11 /* 10 chars + null terminator */ +typedef struct OSPFV3_TASK_DESCRIPTOR +{ + int task_id; + int task_priority; + int task_stack_size; + FUNCPTR task_start_func; + OSPFV3_TASK_STATES task_state; + char task_name[OSPFV3_TASK_NAME_SIZE]; + +} OSPFV3_TASK_DESCRIPTOR; + +/* hello prioritized handling start */ + +typedef struct OSPFV3_BACKLOG_NON_HELLO_PDU +{ + /* 50 bytes overhead per queued PDU, up to OSPFV3_BACKLOG_PDU_MAX */ + OSPFV3_INTERFACE *sptr_interface; + OSPFV3_PACKET *sptr_ospfv3_packet; + USHORT packet_size; + struct in6_addr source_ip_address; + struct in6_addr destination_ip_address; + +} OSPFV3_BACKLOG_NON_HELLO_PDU; + +/* OSPFV3_BACKLOG_NON_HELLO_PDU_QUEUE Used to be (without LIST from lstLib.h): +typedef struct OSPFV3_BACKLOG_NON_HELLO_PDU_QUEUE +{ + ULONG number_of_pdus_queued; + OSPFV3_BACKLOG_NON_HELLO_PDU *sptr_non_hello_pdu_queue; + SEM_ID backlog_queue_semaphore_id; + +} OSPFV3_BACKLOG_NON_HELLO_PDU_QUEUE; +*/ +typedef struct OSPFV3_BACKLOG_NON_HELLO_PDU_QUEUE +{ + int read_index; + int write_index; + int num_pdus_in_queue; + OSPFV3_BACKLOG_NON_HELLO_PDU *sptr_pdu; + SEM_ID pdu_queue_sem_id; /* semaphore guarding concurrent LIST operations from multiple tasks */ + +} OSPFV3_BACKLOG_NON_HELLO_PDU_QUEUE; +/* hello prioritized handling end */ + +/* Definition of main OSPF structure */ +/* OSPFv3 meta-structure */ +typedef struct OSPFV3_CLASS + { + enum BOOLEAN protocol_enabled; + /*ULONG tid;*/ /* ospf task ID */ + ULONG stack_id; + ULONG router_id; /* uniquely identifies this router in the Autonomous System */ + enum BOOLEAN type_of_service_capability; /* TRUE means this router will calculate separate routes based on type of service */ + enum BOOLEAN autonomous_system_border_router; + enum BOOLEAN ip_multicast; + + OSPFV3_PORT_CLASS port[NUMBER_OF_OSPFV3_PORTS]; + + /* make sptr_interface linked list visible here. Was in OSPFV3_PORT_CLASS */ + OSPFV3_INTERFACE *sptr_interface_list; + + ULONG number_of_ports; + ULONG starting_port_number; + + ULONG number_of_interfaces; + + /* areas */ + ULONG number_of_areas; /* number of areas */ + ULONG number_of_area_address_ranges; /* total number of area address ranges for all areas */ + + ULONG number_of_stub_areas; + + /* NOTE: areat[] shall only be used during startup for processing configuration + * read from ospfv3_cfg() + */ + OSPFV3_AREA_CLASS area[NUMBER_OF_OSPFV3_AREAS]; + struct OSPFV3_AREA_ENTRY *sptr_area_list; /* an array of areas connected to this router which will be + * allocated at initialization time, area 0 is the backbone */ + /* RFC 2178 G.3 */ + OSPFV3_AREA_ADDRESS_RANGE_CLASS area_address_range[NUMBER_OF_OSPFV3_AREA_ADDRESS_RANGES]; /* area address ranges for a particular area */ + + struct OSPFV3_AREA_ENTRY *sptr_backbone_area; + struct OSPFV3_STUB_AREA_ENTRY *sptr_stub_area_list; + + /* virtual links */ + ULONG number_of_virtual_links; + ULONG number_of_virtual_links_in_Up_state; + OSPFV3_INTERFACE_NODE *sptr_configured_virtual_links; + + OSPFV3_EXTERNAL_ROUTE *sptr_external_route_queue; + ULONG external_lsa_queue_process_interval; + ULONG ospfv3_rtm_sequence; + ULONG ospfv3_rtm_pid; + + /* ip and routing socket */ + int ospfv3_ip_socket; + int ospfv3_rtm_socket; + + /* neighbors */ + ULONG number_of_neighbors; /* number of neighbors known to this router */ + ULONG number_of_neighbors_in_init_state; + ULONG number_of_neighbors_in_exchange_state; + ULONG number_of_neighbors_in_full_state; + + OSPFV3_ROUTING_TABLE_NODE *sptr_routing_table_head[OSPFV3_RT_HASH_TABLE_SIZE]; + + enum BOOLEAN build_routing_table; + ULONG routing_table_build_time_counter; + + OSPFV3_LS_DATABASE_ENTRY *sptr_free_database_entry_list; /* list of LSAs to be freed */ + + enum BOOLEAN timer_enabled; + ULONG _1_second_counter; + ULONG clock_ticks_per_second; + + OSPFV3_MIB_GENERAL_ENTRY ospfv3GeneralGroupEntry; + + /* only contains RFC 1583 compatibility and opaque LSA support, obsoleted by RFC 2740 */ + WRN_OSPFV3_MIB_GENERAL_ENTRY wrnOspfv3GeneralGroupEntry; + OSPFV3_HOSTS *sptr_host_list; + + /* various debug flags */ + enum BOOLEAN printing_enabled; + enum BOOLEAN interface_printing_enabled; + enum BOOLEAN neighbor_printing_enabled; + enum BOOLEAN memory_printing_enabled; + enum BOOLEAN alarm_printing_enabled; + enum BOOLEAN snmp_printing_enabled; + enum BOOLEAN packet_printing_enabled; + enum BOOLEAN hello_packet_printing_enabled; + enum BOOLEAN dd_packet_printing_enabled; + enum BOOLEAN ls_request_packet_printing_enabled; + enum BOOLEAN ls_update_packet_printing_enabled; + enum BOOLEAN ls_ack_packet_printing_enabled; + enum BOOLEAN routing_table_printing_enabled; + enum BOOLEAN debug_printing_enabled; + enum BOOLEAN rtm_printing_enabled; /* ### RTM */ + enum BOOLEAN db_overflow_printing_enabled; + enum BOOLEAN search_printing_enabled; + enum BOOLEAN prologue_printing_enabled; + + + ULONG routing_table_revision_number; + ULONG ospfv3_maxaged_lsas_removed_per_tick; + ULONG ospfv3_maxaged_lsas_removed_this_tick; + + OSPFV3_REDISTRIBUTION_CONFIGURATION ospfv3_redistribution_configuration; + + int ospfv3_multicast_extensions; + enum BOOLEAN ospfv3_demand_extensions; + ULONG ospfv3_point_to_point_router_lsa_option; + /* RFC 1765 */ + ULONG ospfv3_external_lsdb_limit; + ULONG ospfv3_exit_overflow_interval; + ULONG ospfv3_external_lsa_count; + enum BOOLEAN in_overflow_state; + enum BOOLEAN force_out_of_overflow_state; + enum BOOLEAN reset_ospfv3_exit_overflow_interval; + + +#if defined (__OSPFV3_FTP__) + const char * ftp_configuration_file; + const char * ftp_server_address; + const char * ftp_dir; + const char * ftp_user; + const char * ftp_pwd; +#endif + + OSPFV3_LS_DATABASE_HEAD external_database_hash_table[OSPFV3_NUM_AS_LSA_HASHES][OSPFV3_HASH_TABLE_SIZE]; + /* HME add new structure for LSAs with unknown LS types and AS flooding scope. RFC 2740, section 3.1*/ + /* number of LSAs in the AS LSDB */ + ULONG as_lsa_count; + /* sum of checksums of all LSAs in main structure for fast comparison of LSDB of 2 routers */ + ULONG as_lsa_checksum; + + /* + * Pointer to old routing table, valid during SPF computation, NULL + * otherwise, Inter-area SPF computation can be invoked: from receive + * task at reception of type 3 or type 4 LSA from timer task (or SPF + * task) during regular SPF computation. This "sptr_old_routing_table" + * is used during inter-area SPF to prevent flooding of type 3 and 4 + * LSAs from receive task and enable flooding of type 3 LSAs from timer + * task depending on result of SPF computation. Reason: RFC 2328 + * specifies that type 3 LSAs should only be issued based on routing + * table entries. + */ + OSPFV3_ROUTING_TABLE_NODE * sptr_old_routing_table[OSPFV3_RT_HASH_TABLE_SIZE]; + + /* watchdog timer: runs every second in the system timer interrupt. + All it does is give the semaphore timer_semaphore_id. + OSPF timer task is blocked on this semaphore and wakes up executing + the 1 second OSPF timer activities at task level when awaken by the watchdog */ + WDOG_ID watchdog_timer; + + /* semaphore to trigger 1 second timer interrupt activities: + taken by timer task, given by watchdog timer */ + SEM_ID timer_semaphore_id; + + /* semaphore to synchronize startup of OSPF tasks. Taken by every OSPF task + after finishing own initialization. Given synchronously via semFlush to all ospf + tasks pending on it when task state of all tasks is OSPFV3_TASK_STATE_INIT_COMPLETE */ + SEM_ID startup_sem_id; + + OSPFV3_TASK_DESCRIPTOR ospfv3_tasks[OSPFV3_NUM_TASKS]; + + /* hello prioritized handling start */ + OSPFV3_BACKLOG_NON_HELLO_PDU_QUEUE backlog_pdus_queue; + ULONG num_discarded_pdus; +#ifdef OSPFV3_SURROGATE_HELLO_ENABLED + BOOLEAN surrogate_hello_processing_enabled; +#endif + + /* hello prioritized handling end */ + + /* these are used by the algorithm to generate unique link state IDs for individual + LSAs that participate in an aggregate LSA originated by this router */ + ULONG router_lsa_id; + ULONG inter_area_prefix_lsa_id; + ULONG inter_area_router_lsa_id; + ULONG intra_area_prefix_lsa_id; + ULONG external_lsa_id; + + } OSPFV3_CLASS; + +/* OSPFv3 AVL LSDB node */ +typedef struct OSPFV3_AVL_LSDB_NODE +{ + AVL_NODE node; + OSPFV3_LS_DATABASE_ENTRY *sptr_database_entry; +} OSPFV3_AVL_LSDB_NODE; + +typedef struct OSPFV3_AVL_LSDB_KEY +{ + ULONG id; + ULONG router; + BYTE_ENUM (OSPF_LS_TYPE) type; +} OSPFV3_AVL_LSDB_KEY; + + +/**************************************************************************************/ + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCospfv3Structuresh */ diff --git a/h/wrn/pppauth_if.h b/h/wrn/pppauth_if.h new file mode 100644 index 0000000..a58ce23 --- /dev/null +++ b/h/wrn/pppauth_if.h @@ -0,0 +1,65 @@ +/************************************************************************/ +/* Copyright (C) 1999 RouterWare, Inc. */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Blvd. Suite 212, Newport Beach, CA */ +/************************************************************************/ + +/* pppauth_if.h */ + +/* C Header file, use 3 space tab stops */ + +#ifndef __PPPAUTH_IF_H__ +#define __PPPAUTH_IF_H__ + +#include /* bool and UINT definitions */ + +typedef ULONG PPPCTRL_SESSION_HANDLE; + +struct PPPAUTH_CALLBACK_IF; /* eliminate warnings */ + +typedef bool(*PPPAUTH_VERIFICATION_CALLBACK)(struct PPPAUTH_CALLBACK_IF*, PPPCTRL_SESSION_HANDLE, UINT id, bool result, + BYTE* p_message, UINT message_length); + +typedef struct PPPAUTH_CALLBACK_IF +{ + bool (*fp_chap_get_challenge_complete) (struct PPPAUTH_CALLBACK_IF*, PPPCTRL_SESSION_HANDLE, + BYTE* p_challenge, UINT challenge_length, + BYTE* p_name, UINT name_length); + bool (*fp_chap_get_response_complete) (struct PPPAUTH_CALLBACK_IF*, PPPCTRL_SESSION_HANDLE, UINT id, + BYTE* p_response, UINT response_length, + BYTE* p_name, UINT name_length); + bool (*fp_pap_get_user_name_password_complete) (struct PPPAUTH_CALLBACK_IF*, PPPCTRL_SESSION_HANDLE, + BYTE* p_user_name, UINT user_name_length, + BYTE* p_password, UINT password_length); + PPPAUTH_VERIFICATION_CALLBACK fp_chap_verification_complete; + PPPAUTH_VERIFICATION_CALLBACK fp_pap_verification_complete; + +} PPPAUTH_CALLBACK_IF; + +typedef struct PPPAUTH_IF +{ + bool (*fp_register) (struct PPPAUTH_IF*, PPPAUTH_CALLBACK_IF*); + bool (*fp_unregister) (struct PPPAUTH_IF*); + bool (*fp_chap_get_challenge) (struct PPPAUTH_IF*, PPPCTRL_SESSION_HANDLE); + bool (*fp_chap_get_response) (struct PPPAUTH_IF*, PPPCTRL_SESSION_HANDLE, UINT id, + BYTE* p_challenge, UINT challenge_length, + BYTE* p_user_name, UINT user_name_length); + bool (*fp_chap_verify_response) (struct PPPAUTH_IF*, PPPCTRL_SESSION_HANDLE, UINT id, + BYTE* p_challenge, UINT challenge_length, + BYTE* p_response, UINT response_length, + BYTE* p_name, UINT name_length); + bool (*fp_pap_get_user_name_password) (struct PPPAUTH_IF*, PPPCTRL_SESSION_HANDLE); + bool (*fp_pap_verify_user_name_password) (struct PPPAUTH_IF*, PPPCTRL_SESSION_HANDLE, UINT id, + BYTE* p_user_name, UINT name_length, + BYTE* p_password, UINT password_length); +} PPPAUTH_IF; + +/* Temporary Kludge until Module Manager is done */ +PPPAUTH_IF* pppauth_create (void); +bool pppauth_destroy (PPPAUTH_IF* pp_if); + +#endif /* Don't add anything after this line */ \ No newline at end of file diff --git a/h/wrn/pppctrl_if.h b/h/wrn/pppctrl_if.h new file mode 100644 index 0000000..1b7a416 --- /dev/null +++ b/h/wrn/pppctrl_if.h @@ -0,0 +1,119 @@ +/************************************************************************/ +/* Copyright (C) 1999 RouterWare, Inc. */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Blvd. Suite 212, Newport Beach, CA */ +/************************************************************************/ + +/* pppctrl_if.h */ + +/* C Header file, use 3 space tab stops */ + +#ifndef __PPPCTRL_IF_H__ +#define __PPPCTRL_IF_H__ + +#include /* bool, BYTE, UINT, and ULONG definitions */ +#include /* RW_PORT_BINDING_HANDLE */ + +typedef enum +{ + PPP_ILLEGAL_PROTOCOL_TYPE = 0x0000, + PPP_IP_PROTOCOL = 0x0021, + PPP_IPX_PROTOCOL = 0x002b, + PPP_APPLETALK_PROTOCOL = 0x0029, + PPP_VAN_JACOBSON_COMPRESSED_PROTOCOL = 0x002d, + PPP_VAN_JACOBSON_UNCOMPRESSED_PROTOCOL = 0x002f, + PPP_BRIDGING_PROTOCOL = 0x0031, + PPP_NETBIOS_PROTOCOL = 0x003f, + + PPP_8021D_SPANNING_TREE_BPDU = 0x0201, + PPP_SOURCE_ROUTING_BPDU = 0x0203, + PPP_DEC_LAN_BRIDGE_100 = 0x0205, + + PPP_IPCP_PROTOCOL = 0x8021, + PPP_IPXCP_PROTOCOL = 0x802b, + PPP_ATCP_PROTOCOL = 0x8029, + PPP_BCP_PROTOCOL = 0x8031, + PPP_NBFCP_PROTOCOL = 0x803f, + + PPP_LCP_PROTOCOL = 0xc021, + PPP_PAP_PROTOCOL = 0xc023, + PPP_CHAP_PROTOCOL = 0xc223, + PPP_LINK_QUALITY_REPORT_PROTOCOL = 0xc025 + +} PPP_PROTOCOL_TYPE; + +typedef struct +{ + PPP_PROTOCOL_TYPE protocol_type; + RW_PACKET_HANDLE payload; + UINT header_length; + RW_PORT_BINDING_HANDLE port_binding_handle; + +} PPP_MESSAGE; + +typedef enum +{ + PPP_FCS_NULL = 1, + PPP_FCS_16BIT = 2, + PPP_FCS_32BIT = 4 + +} PPP_FCS_OPTION_FLAG; + +typedef BYTE PPP_FCS_OPTION; + +#define PPP_DEFAULT_MRU 1500 /* RFC1661 section 6.1 */ +#define PPP_DEFAULT_SYNC_ACCM 0 /* RFC1662 section 7.1 */ +#define PPP_DEFAULT_ASYNC_ACCM 0xffffffff /* RFC1662 section 7.1 */ +#define PPP_DEFAULT_PFC false /* RFC1661 section 6.5 */ +#define PPP_DEFAULT_ACFC false /* RFC1661 section 6.6 */ +#define PPP_DEFAULT_FCS PPP_FCS_16BIT /* RFC1570 section 2.1 */ +#define PPP_DEFAULT_ASYNC true + +typedef struct PPPCTRL_CALLBACK_IF +{ + bool (*fp_bring_upper_layer_up) (struct PPPCTRL_CALLBACK_IF*, UINT port_number, PPP_PROTOCOL_TYPE protocol); + void (*fp_bring_upper_layer_down) (struct PPPCTRL_CALLBACK_IF*, UINT port_number, PPP_PROTOCOL_TYPE protocol); + + bool (*fp_send) (struct PPPCTRL_CALLBACK_IF*, UINT port_number, PPP_MESSAGE* p_message); + + bool (*fp_set_my_ip_address) (struct PPPCTRL_CALLBACK_IF*, UINT port_number, IP_ADDRESS); + + /* Set My Data Link Settings */ + bool (*fp_set_my_mru) (struct PPPCTRL_CALLBACK_IF*, UINT port_number, UINT value); + bool (*fp_set_my_accm) (struct PPPCTRL_CALLBACK_IF*, UINT port_number, ULONG value); + bool (*fp_set_my_pfc) (struct PPPCTRL_CALLBACK_IF*, UINT port_number, bool); + bool (*fp_set_my_acfc) (struct PPPCTRL_CALLBACK_IF*, UINT port_number, bool); + bool (*fp_set_my_fcs) (struct PPPCTRL_CALLBACK_IF*, UINT port_number, PPP_FCS_OPTION); + bool (*fp_set_my_async) (struct PPPCTRL_CALLBACK_IF*, UINT port_number, bool); + + /* Set Peer Data Link Settings */ + bool (*fp_set_peer_mru) (struct PPPCTRL_CALLBACK_IF*, UINT port_number, UINT value); + bool (*fp_set_peer_accm) (struct PPPCTRL_CALLBACK_IF*, UINT port_number, ULONG value); + bool (*fp_set_peer_pfc) (struct PPPCTRL_CALLBACK_IF*, UINT port_number, bool); + bool (*fp_set_peer_acfc) (struct PPPCTRL_CALLBACK_IF*, UINT port_number, bool); + bool (*fp_set_peer_fcs) (struct PPPCTRL_CALLBACK_IF*, UINT port_number, PPP_FCS_OPTION); + bool (*fp_set_peer_async) (struct PPPCTRL_CALLBACK_IF*, UINT port_number, bool); + +} PPPCTRL_CALLBACK_IF; + +typedef struct PPPCTRL_IF +{ + bool (*fp_register) (struct PPPCTRL_IF*, PPPCTRL_CALLBACK_IF*); + bool (*fp_unregister) (struct PPPCTRL_IF*); + + bool (*fp_port_up) (struct PPPCTRL_IF* p_if, UINT port_number); + void (*fp_port_down) (struct PPPCTRL_IF* p_if, UINT port_number); + + bool (*fp_packet_received) (struct PPPCTRL_IF* p_if, UINT port_number, PPP_MESSAGE* p_message); + +} PPPCTRL_IF; + +/* Temporary Kludge until Module Manager is done */ +PPPCTRL_IF* pppctrl_create (void); +bool pppctrl_destroy (PPPCTRL_IF* pp_if); + +#endif /* Don't add anything after this line */ \ No newline at end of file diff --git a/h/wrn/radius/radiusCfg.h b/h/wrn/radius/radiusCfg.h new file mode 100644 index 0000000..64c0915 --- /dev/null +++ b/h/wrn/radius/radiusCfg.h @@ -0,0 +1,26 @@ +/* radiusCfg.h */ + +/* Copyright 1999 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01a,03oct01,md created for Tornado III +*/ + +#ifndef __INCradiusCfgh +#define __INCradiusCfgh + +#ifdef __cplusplus +extern "C" { +#endif + +void radiusCfg(); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCradiusCfgh */ diff --git a/h/wrn/radius/radiusLib.h b/h/wrn/radius/radiusLib.h new file mode 100644 index 0000000..23a1bd0 --- /dev/null +++ b/h/wrn/radius/radiusLib.h @@ -0,0 +1,19 @@ +/* radiusLib.h */ + +/* Declarations ofRADIUS module entry point prototype */ + +/* Copyright 1984 - 2000 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +____________________ +01a,19dec00,md merged from visual source safe +*/ + + +#ifndef __INCradiuslibh +#define __INCradiuslibh + +STATUS radiusLibInit (); +#endif /* __INCradiuslibh */ diff --git a/h/wrn/radius/radius_interface.h b/h/wrn/radius/radius_interface.h new file mode 100644 index 0000000..d8bfe84 --- /dev/null +++ b/h/wrn/radius/radius_interface.h @@ -0,0 +1,466 @@ +/* radius_interface.h */ + +/* Declarations of RADIUS APIs */ + +/* Copyright 1984 - 2005 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +____________________ +01k,22oct05,snd Changed fwd declaration of radius_ipv6_server_create() +01j,10jul05,dps Added code for IPv6 Support +01i,07jan05,snd Fix for SPR 105482, added new declaration for function + radius_add_concatenated_attribute_to_list +01h,25jun03,snd add support for new defines for NAS-port-type for EAP +01g,13mar02,md add support for EAP +01f,27feb02,md add a new function declaration radius_remove_attribute +01e,16feb01,tk add a new function declaration radius_any_server_request +01d,08feb01,tk add a new callback error code and #define for ANY_RADIUS_SERVER +01c,26jan01,tk ifdef out radius_get_server_index_in_mib_table() with __RADIUS_MIB__ +01b,19dec00,md added radius_get_server_index_in_mib_table() +01a,19dec00,md merged from visual source safe +*/ + +/************************************************************************/ +/* Copyright (C) 1993 - 2000 RouterWare, Inc. */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Suite 212 Newport Beach, CA 92660 */ +/************************************************************************/ +#ifndef __INCradius_interfaceh +#define __INCradius_interfaceh + +typedef UINT RADIUS_SERVER_HANDLE; +typedef UINT RADIUS_REQUEST_HANDLE; +typedef UINT RADIUS_ATTRIBUTE_LIST_HANDLE; + +#define ANY_RADIUS_SERVER NULL + +enum RADIUS_CODE +{ + RADIUS_ACCESS_REQUEST = 1, + RADIUS_ACCESS_ACCEPT = 2, + RADIUS_ACCESS_REJECT = 3, + RADIUS_ACCOUNTING_REQUEST = 4, + RADIUS_ACCOUNTING_RESPONSE = 5, + RADIUS_ACCESS_CHALLENGE = 11, + RADIUS_STATUS_SERVER = 12, + RADIUS_STATUS_CLIENT = 13, + RADIUS_RESERVED = 255 +}; + +enum RADIUS_ERROR_CALLBACK_CODE +{ + RADIUS_ILLEGAL_ATTRIBUTE_LIST, + RADIUS_UDP_SEND_ERROR, + RADIUS_MAXIMUM_NUMBER_OF_OUTSTANDING_REQUEST_REACHED, + RADIUS_RETRY_LIMIT_REACHED, + RADIUS_INVALID_SERVER_SPECIFIED, + RADIUS_SERVER_NOT_FOUND +}; + +enum RADIUS_ATTRIBUTE_TYPE +{ + RADIUS_USER_NAME = 1, + RADIUS_USER_PASSWORD = 2, + RADIUS_CHAP_PASSWORD = 3, + RADIUS_NAS_IP_ADDRESS = 4, + RADIUS_NAS_PORT = 5, + RADIUS_SERVICE_TYPE = 6, + RADIUS_FRAMED_PROTOCOL = 7, + RADIUS_FRAMED_IP_ADDRESS = 8, + RADIUS_FRAMED_IP_NETMASK = 9, + RADIUS_FRAMED_ROUTING = 10, + RADIUS_FILTER_ID = 11, + RADIUS_FRAMED_MTU = 12, + RADIUS_FRAMED_COMPRESSION = 13, + RADIUS_LOGIN_IP_HOST = 14, + RADIUS_LOGIN_SERVICE = 15, + RADIUS_LOGIN_TCP_PORT = 16, + RADIUS_UNASSIGNED_17 = 17, + RADIUS_REPLY_MESSAGE = 18, + RADIUS_CALLBACK_NUMBER = 19, + RADIUS_CALLBACK_ID = 20, + RADIUS_UNASSIGNED_21 = 21, + RADIUS_FRAMED_ROUTE = 22, + RADIUS_FRAMED_IPX_NETWORK = 23, + RADIUS_STATE = 24, + RADIUS_CLASS_ATTRIBUTE = 25, + RADIUS_VENDOR_SPECIFIC = 26, + RADIUS_SESSION_TIMEOUT = 27, + RADIUS_IDLE_TIMEOUT = 28, + RADIUS_TERMINATION_ACTION = 29, + RADIUS_CALLED_STATION_ID = 30, + RADIUS_CALLING_STATION_ID = 31, + RADIUS_NAS_IDENTIFIER = 32, + RADIUS_PROXY_STATE = 33, + RADIUS_LOGIN_LAT_SERVICE = 34, + RADIUS_LOGIN_LAT_NODE = 35, + RADIUS_LOGIN_LAT_GROUP = 36, + RADIUS_FRAMED_APPLETALK_LINK = 37, + RADIUS_FRAMED_APPLETALK_NETWORK = 38, + RADIUS_FRAMED_APPLETALK_ZONE = 39, + + /* ACCOUNTING 40 - 59*/ + RADIUS_ACCT_STATUS_TYPE = 40, + RADIUS_ACCT_DELAY_TIME = 41, + RADIUS_ACCT_INPUT_OCTETS = 42, + RADIUS_ACCT_OUTPUT_OCTETS = 43, + RADIUS_ACCT_SESSION_ID = 44, + RADIUS_ACCT_AUTHENTIC = 45, + RADIUS_ACCT_SESSION_TIME = 46, + RADIUS_ACCT_INPUT_PACKETS = 47, + RADIUS_ACCT_OUTPUT_PACKETS = 48, + RADIUS_ACCT_TERMINATE_CAUSE = 49, + RADIUS_ACCT_MULTI_SESSION_ID = 50, + RADIUS_ACCT_LINK_COUNT = 51, + + RADIUS_CHAP_CHALLENGE = 60, + RADIUS_NAS_PORT_TYPE = 61, + RADIUS_PORT_LIMIT = 62, + RADIUS_LOGIN_LAT_PORT = 63, + RADIUS_TUNNEL_TYPE = 64, + RADIUS_TUNNEL_MEDIUM_TYPE = 65, + RADIUS_TUNNEL_CLIENT_ENDPOINT = 66, + RADIUS_TUNNEL_SERVER_ENDPOINT = 67, + RADIUS_ACCT_TUNNEL_CONNECTION = 68, + RADIUS_TUNNEL_PASSWORD = 69, +#ifdef __EAP__ + RADIUS_EAP_MESSAGE = 79, + RADIUS_MESSAGE_AUTHENTICATOR = 80, +#endif /* __EAP__ */ + RADIUS_TUNNEL_PRIVATE_GROUP_ID = 81, + RADIUS_TUNNEL_ASSIGNMENT_ID = 82, + RADIUS_TUNNEL_PREFERENCE = 83, + RADIUS_ACCT_TUNNEL_PACKETS_LOST = 86, + RADIUS_TUNNEL_CLIENT_AUTH_ID = 90, + RADIUS_TUNNEL_SERVER_AUTH_ID = 91, + + RADIUS_NAS_IPV6_ADDRESS = 95, + RADIUS_FRAMED_INTERFACE_ID = 96, + RADIUS_FRAMED_IPV6_PREFIX = 97, + RADIUS_LOGIN_IPV6_HOST = 98, + RADIUS_FRAMED_IPV6_ROUTE = 99, + RADIUS_FRAMED_IPV6_POOL = 100, + + MAXIMUM_RADIUS_ATTRIBUTE_TYPE +}; + +enum RADIUS_SERVICE_TYPES +{ + RADIUS_LOGIN_SERVICE_TYPE = 1, + RADIUS_FRAMED_SERVICE_TYPE = 2, + RADIUS_CALLBACK_LOGIN_SERVICE_TYPE = 3, + RADIUS_CALLBACK_FRAMED_SERVICE_TYPE = 4, + RADIUS_OUTBOUND_SERVICE_TYPE = 5, + RADIUS_ADMINISTRATIVE_SERVICE_TYPE = 6, + RADIUS_NAS_PROMPT_SERVICE_TYPE = 7, + RADIUS_AUTNENTICATE_ONLY_SERVICE_TYPE = 8, + RADIUS_CALLBACK_NAS_PROMPT_SERVICE_TYPE = 9, + + MAXIMUM_RADIUS_SERVICE_TYPE +}; + +enum RADIUS_FRAMED_PROTOCOLS +{ + RADIUS_PPP_PROTOCOL = 1, + RADIUS_SLIP_PROTOCOL = 2, + RADIUS_ARAP_PROTOCOL = 3, + RADIUS_GANDALF_PROPRIETARY_PROTOCOL = 4, + RADIUS_XYLOGICS_PROPRIETARY_PROTOCOL = 5, + + MAXIMUM_RADIUS_FRAMED_PROTOCOL_TYPE +}; + +enum RADIUS_FRAMED_ROUTING_METHODS +{ + RADIUS_NONE_ROUTING, + RADIUS_SEND_ROUTING_PACKETS, + RADIUS_LISTEN_FOR_ROUTING_PACKETS, + RADIUS_SEND_AND_LISTEN, + + MAXIMUM_RADIUS_FRAMED_ROUTING_METHOD_TYPE +}; + +enum RADIUS_FRAMED_COMPRESSION_METHODS +{ + RADIUS_NONE_COMPRESSION, + RADIUS_VJ_TCPIP_HEADER_COMPRESSION, + RADIUS_IPX_HEADER_COMPRESSION, + RADIUS_STAC_LZS_COMPRESSION, + + MAXIMUM_RADIUS_FRAMED_COMPRESSION_METHOD_TYPE +}; + +enum RADIUS_TERMINATION_ACTIONS +{ + RADIUS_DEFAULT_TERMINATION_ACTION, + RADIUS_REQUEST_TERMINATION_ACTION, + + MAXIMUM_RADIUS_TERMINATION_ACTION_TYPE +}; + +enum RADIUS_LOGIN_SERVICE_TYPES +{ + RADIUS_TELNET_LOGIN_SERVICE, + RADIUS_RLOGIN_LOGIN_SERVICE, + RADIUS_TCP_CLEAR_LOGIN_SERVICE, + RADIUS_PORTMASTER_LOGIN_SERVICE, + RADIUS_LAT_LOGIN_SERVICE, + + MAXIMUM_RADIUS_LOGIN_SERVICE_TYPE +}; + +enum RADIUS_ACCOUNTING_STATUS_TYPES +{ + RADIUS_ACCOUNTING_START = 1, + RADIUS_ACCOUNTING_STOP = 2, + RADIUS_ACCOUNTING_ON = 7, + RADIUS_ACCOUNTING_OFF = 8, + RADIUS_TUNNEL_START = 9, + RADIUS_TUNNEL_STOP = 10, + RADIUS_TUNNEL_REJECT = 11, + RADIUS_LINK_START = 12, + RADIUS_LINK_STOP = 13, + RADIUS_LINK_REJECT = 14, + + MAXIMUM_RADIUS_ACCOUNTING_STATUS_TYPE +}; + +enum RADIUS_ACCOUNTING_AUTHENTIC_TYPES +{ + RADIUS_ACCOUNTING_RADIUS_AUTHENTICATION = 1, + RADIUS_ACCOUNTING_LOCAL_AUTHENTICATION = 2, + RADIUS_ACCOUNTING_REMOTE_AUTHENTICATION = 3, + + MAXIMUM_RADIUS_ACCOUNTING_AUTHENTIC_TYPE +}; + +enum RADIUS_ACCOUNTING_TERMINATE_CAUSE +{ + RADIUS_ACCOUNTING_TERMINATION_USER_REQUEST = 1, + RADIUS_ACCOUNTING_TERMINATION_LOST_CARRIER = 2, + RADIUS_ACCOUNTING_TERMINATION_LOST_SERVICE = 3, + RADIUS_ACCOUNTING_TERMINATION_IDLE_TIMEOUT = 4, + RADIUS_ACCOUNTING_TERMINATION_SESSION_TIMEOUT = 5, + RADIUS_ACCOUNTING_TERMINATION_ADMIN_RESET = 6, + RADIUS_ACCOUNTING_TERMINATION_ADMIN_REBOOT = 7, + RADIUS_ACCOUNTING_TERMINATION_PORT_ERROR = 8, + RADIUS_ACCOUNTING_TERMINATION_NAS_ERROR = 9, + RADIUS_ACCOUNTING_TERMINATION_NAS_REQUEST = 10, + RADIUS_ACCOUNTING_TERMINATION_NAS_REBOOT = 11, + RADIUS_ACCOUNTING_TERMINATION_PORT_UNNEEDED = 12, + RADIUS_ACCOUNTING_TERMINATION_PORT_PREEMPTED = 13, + RADIUS_ACCOUNTING_TERMINATION_PORT_SUSPENDED = 14, + RADIUS_ACCOUNTING_TERMINATION_SERVICE_UNAVAILABLE = 15, + RADIUS_ACCOUNTING_TERMINATION_CALLBACK = 16, + RADIUS_ACCOUNTING_TERMINATION_USER_ERROR = 17, + RADIUS_ACCOUNTING_TERMINATION_HOST_REQUEST = 18, + + MAXIMUM_RADIUS_ACCOUNTING_TERMINATE_CAUSE_TYPE +}; + +enum RADIUS_NAS_PORT_TYPES +{ + RADIUS_ASYNC_PORT_TYPE, + RADIUS_SYNC_PORT_TYPE, + RADIUS_ISDN_SYNC_PORT_TYPE, + RADIUS_ISDN_ASYNCV120_PORT_TYPE, + RADIUS_ISDN_ASYNCV110_PORT_TYPE, + RADIUS_VIRTUAL_PORT_TYPE, + +#ifdef __EAP__ + RADIUS_PIAFS_PORT_TYPE, + RADIUS_HDLC_CLEARCHANNEL_PORT_TYPE, + RADIUS_X25_PORT_TYPE, + RADIUS_X75_PORT_TYPE, + RADIUS_G3FAX_PORT_TYPE, + RADIUS_SDSL_PORT_TYPE, + RADIUS_ADSL_CAP_PORT_TYPE, + RADIUS_ADSL_DMT_PORT_TYPE, + RADIUS_IDSL_PORT_TYPE, + RADIUS_ETHERNET_PORT_TYPE, + RADIUS_XDSL_PORT_TYPE, + RADIUS_CABLE_PORT_TYPE, + RADIUS_WIRELESS_OTHER_PORT_TYPE, + RADIUS_WIRELESS_IEEE80211_PORT_TYPE, + +#endif /* __EAP__ */ + + MAXIMUM_RADIUS_NAS_PORT_TYPE +}; + +enum RADIUS_TUNNEL_TYPES +{ + RADIUS_TUNNEL_PPTP = 1, + RADIUS_TUNNEL_L2F = 2, + RADIUS_TUNNEL_L2TP = 3, + RADIUS_TUNNEL_ATMP = 4, + RADIUS_TUNNEL_VTP = 5, + RADIUS_TUNNEL_AH = 6, + RADIUS_TUNNEL_IP_IP = 7, + RADIUS_TUNNEL_MIN_IP_IP = 8, + RADIUS_TUNNEL_ESP = 9, + RADIUS_TUNNEL_GRE = 10, + RADIUS_TUNNEL_DVS = 11, + RADIUS_TUNNEL_IP_IP_TUNNELING = 12, + + MAXIMUM_RADIUS_TUNNEL_TYPE +}; + +enum RADIUS_TUNNEL_MEDIUM_TYPES +{ + RADIUS_TUNNEL_MEDIUM_IPV4 = 1, + RADIUS_TUNNEL_MEDIUM_IPV6 = 2, + RADIUS_TUNNEL_MEDIUM_NSAP = 3, + RADIUS_TUNNEL_MEDIUM_HDLC = 4, + RADIUS_TUNNEL_MEDIUM_BBN1822 = 5, + RADIUS_TUNNEL_MEDIUM_802 = 6, + RADIUS_TUNNEL_MEDIUM_E163 = 7, + RADIUS_TUNNEL_MEDIUM_E164 = 8, + RADIUS_TUNNEL_MEDIUM_F69 = 9, + RADIUS_TUNNEL_MEDIUM_X121 = 10, + RADIUS_TUNNEL_MEDIUM_IPX = 11, + RADIUS_TUNNEL_MEDIUM_APPLETALK = 12, + RADIUS_TUNNEL_MEDIUM_DECNETIV = 13, + RADIUS_TUNNEL_MEDIUM_BANYAN_VINES = 14, + RADIUS_TUNNEL_MEDIUM_E164_WITH_NSAP = 15, + + MAXIMUM_RADIUS_TUNNEL_MEDIUM_TYPE +}; + +enum RADIUS_SERVER_TYPE +{ + RADIUS_AUTHENTICATION_SERVER_TYPE, + RADIUS_ACCOUNTING_SERVER_TYPE, + RADIUS_AUTHENTICATION_AND_ACCOUNTING_SERVER_TYPE, + RADIUS_TOTAL_TYPES_OF_SERVERS +}; + +/* following will be used by the RADIUS client to perform a call-back on the RADIUS user when a response is received from the RADIUS + server, or a timeout occured */ + +typedef struct RADIUS_REQUEST_CALLBACKS +{ + void (*fptr_radius_normal_callback) (RADIUS_REQUEST_HANDLE radius_request_handle, + enum RADIUS_CODE code, RADIUS_ATTRIBUTE_LIST_HANDLE attribute_list_handle); + void (*fptr_radius_error_callback) (RADIUS_REQUEST_HANDLE radius_request_handle, + enum RADIUS_ERROR_CALLBACK_CODE error_code); +} RADIUS_REQUEST_CALLBACKS; + + /* gets the server index based on the server handle */ +#ifdef __RADIUS_MIB__ +UINT radius_get_server_index_in_mib_table (RADIUS_SERVER_HANDLE server_handle); +#endif + + /* gets the handle to the first server of the type specified - returns INVALID_HANDLE if fails to do so */ +RADIUS_SERVER_HANDLE radius_get_first_server (enum RADIUS_SERVER_TYPE type); + + /* gets the handle to the server next to the one the input handle currently points to - returns INVALID_HANDLE if fails to do so */ +RADIUS_SERVER_HANDLE radius_get_next_server (RADIUS_SERVER_HANDLE server_handle, enum RADIUS_SERVER_TYPE type); + + /* gets the handle to the server with specified IP address, port and type - returns INVALID_HANDLE if fails to do so */ +RADIUS_SERVER_HANDLE radius_find_server_with_specified_parameters (char* cp_ip_address, + UINT port, enum RADIUS_SERVER_TYPE type); + +/* frees the server handle */ +void radius_free_server_handle (RADIUS_SERVER_HANDLE handle); + +/* end server access routines */ + + +/* it is the RADIUS client user's responsibility to ensure that the server does not already exist */ +RADIUS_SERVER_HANDLE radius_server_create (enum RADIUS_SERVER_TYPE type, + IP_ADDRESS ip_address, UINT port, + UINT max_retransmit_count, + UINT retransmission_interval, + char* cp_secret); + +/* adds a type to an existing server - the handle must point to an existing server using one of the server access routines above */ +bool radius_server_add_type (RADIUS_SERVER_HANDLE server_handle, enum RADIUS_SERVER_TYPE type); + +/* modifies the secret of an existing server - the handle must point to an existing server using one of the server access routines above */ +bool radius_server_change_secret (RADIUS_SERVER_HANDLE server_handle, char* cp_secret); + +/* it is the RADIUS client user's responsibility to ensure that the server already exists */ +bool radius_server_destroy (RADIUS_SERVER_HANDLE server_handle); + +/* end server editing routines*/ + +/* create a new attribute list*/ +RADIUS_ATTRIBUTE_LIST_HANDLE radius_create_attribute_list(void); + +/* adds an attribute to list*/ +bool radius_add_attribute_to_list (RADIUS_ATTRIBUTE_LIST_HANDLE attribute_list_handle, + enum RADIUS_ATTRIBUTE_TYPE attribute_type, + UINT value_length, BYTE *bptr_value); + +/* adds an attribute which could be possibly be concatenated to list */ +bool radius_add_concatenated_attribute_to_list (RADIUS_ATTRIBUTE_LIST_HANDLE attribute_list_handle, enum RADIUS_ATTRIBUTE_TYPE attribute_type, UINT value_length, BYTE *bptr_value); + +/* remove an atrribute represented by attribute_list_handle from the attribute list*/ +bool radius_remove_attribute_from_list (RADIUS_ATTRIBUTE_LIST_HANDLE attribute_list_handle); + +/* remove an attribute of choice from the attribute list */ +bool radius_remove_attribute (RADIUS_ATTRIBUTE_LIST_HANDLE attribute_list_handle, enum RADIUS_ATTRIBUTE_TYPE attribute_type); + +/* delete entire attribute list */ +bool radius_delete_attribute_list (RADIUS_ATTRIBUTE_LIST_HANDLE attribute_list_handle); + +/* end /attribute list editing routines*/ + +/* attribute list iteration routines*/ +bool radius_attribute_list_goto_first_attribute (RADIUS_ATTRIBUTE_LIST_HANDLE attribute_list_handle); +bool radius_attribute_list_goto_next_attribute (RADIUS_ATTRIBUTE_LIST_HANDLE attribute_list_handle); + +/* the user have to make sure that the attribute_iterator is pointing to a valid entry*/ +enum RADIUS_ATTRIBUTE_TYPE radius_attribute_list_get_attribute_type + (RADIUS_ATTRIBUTE_LIST_HANDLE attribute_list_handle); +UINT radius_attribute_list_get_attribute_length + (RADIUS_ATTRIBUTE_LIST_HANDLE attribute_list_handle); +bool radius_attribute_list_get_attribute_value + (RADIUS_ATTRIBUTE_LIST_HANDLE attribute_list_handle, + BYTE* p_buffer, UINT buffer_length); + +/* end attribute access routines*/ + +/* following will be used by the RADIUS user to make the RADIUS client send an Access Request; the server_handle should not be used by the user till a normal/error callback is made by the Client */ +bool radius_server_request (RADIUS_SERVER_HANDLE server_handle, + RADIUS_REQUEST_HANDLE radius_request_handle, + RADIUS_REQUEST_CALLBACKS *p_callbacks, + enum RADIUS_CODE code, + RADIUS_ATTRIBUTE_LIST_HANDLE attribute_list_handle); + +bool radius_any_server_request (RADIUS_SERVER_HANDLE server_handle, + RADIUS_REQUEST_HANDLE radius_request_handle, + RADIUS_REQUEST_CALLBACKS *p_callbacks, + enum RADIUS_CODE code, + RADIUS_ATTRIBUTE_LIST_HANDLE attribute_list_handle); + +#ifdef INET6 +RADIUS_SERVER_HANDLE radius_ipv6_server_create (enum RADIUS_SERVER_TYPE type, +char * ipv6_address, UINT port, UINT max_retransmit_count, + UINT retransmission_interval, char* cp_secret); + +RADIUS_SERVER_HANDLE radius_find_ipv6_server_with_specified_parameters (char* cp_ipv6_address, + UINT port, enum RADIUS_SERVER_TYPE type); + +#endif + +#endif /*__INCradius_interfaceh*/ + + + + + + + + + + + + diff --git a/h/wrn/radius/radius_utils.h b/h/wrn/radius/radius_utils.h new file mode 100644 index 0000000..09ec1e0 --- /dev/null +++ b/h/wrn/radius/radius_utils.h @@ -0,0 +1,25 @@ +/* radius_utils.h */ + +/* Declarations of RADIUS utility functions. */ + +/* Copyright 1984 - 2000 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +____________________ +01a,19dec00,md merged from visual source safe +*/ + +#ifndef __INCradius_utilsh +#define __INCradius_utilsh + +void radius_utils_load (); + +bool radius_util_serialize_ulong (UINT ulong_to_be_converted, BYTE* buffer); +bool radius_util_serialize_ushort (USHORT ushort_to_be_converted, BYTE* buffer); + +bool radius_util_deserialize_ulong (BYTE* buffer, ULONG *p_converted_ulong); +bool radius_util_deserialize_ushort (BYTE* buffer, USHORT *p_converted_ushort); + +#endif /* __INCradius_utilsh */ diff --git a/h/wrn/radius/usrBasicRadiusBSPBuildCfg.h b/h/wrn/radius/usrBasicRadiusBSPBuildCfg.h new file mode 100644 index 0000000..0eb7fdc --- /dev/null +++ b/h/wrn/radius/usrBasicRadiusBSPBuildCfg.h @@ -0,0 +1,125 @@ +/* usrBasicRadiusBSPBuildCfg.h - header file for WindNet RADIUS demo + * configuration through project and command-line build + */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +#include "copyright_wrs.h" + +/* +modification history +-------------------- +20aug05,dps added new declaration RADIUS_STACK_VERSION for ipv6 support +08aug05,dps added ipv6_address in RADIUS_PROJ_CONFIG_SERVER_INFO +01b,03feb05,snd Changed copyright to 2005 +01a,30dec04,snd created, as fix for SPR 100161. This file is + header file for WindNet RADIUS demo configuration + through project and command-line build +*/ + +/* +DESCRIPTION +This file contains structure definitions, typedefs, forward declarations +required for WindNet RADIUS demo configuration through project +and command-line build. + +\NOMANUAL +*/ + + +#ifndef __INCusrBasicRadiusBSPBuildCfgh +#define __INCusrBasicRadiusBSPBuildCfgh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +/* #ifndef INCLUDE_INETLIB */ +#define INCLUDE_INETLIB + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + + +/* RADIUS_PROJ_CLASS stores RADIUS debug flags, authentication port, +* accounting port, max recv packet size, set default values and +* set disable response authenticator flags. +* These variables are stored with values set by the user during +* project build or command-line build +* +* +* RADIUS_PROJ_CONFIG_SERVER_INFO[] stores settings of +* primary and secondary RADIUS servers configured +*/ + +typedef struct RADIUS_PROJ_CONFIG_SERVER_INFO /* used for storing config info */ + { + ULONG ip_address; /* IP address of RADIUS server */ + char *str_ipv6_address; /* IPV6 address of RADIUS server */ + char *secret; /* Shared secret of RADIUS servers */ + UINT max_retransmit_count; /* Max no of retrans for RADIUS server */ + UINT retransmission_interval; /* Timeout for Retransmission */ + UINT type; /* Type of server, + 0 - both, 1- accounting, + 2 - authentication + */ + } RADIUS_PROJ_CONFIG_SERVER_INFO; + +typedef struct RADIUS_PROJ_CLASS /* RADIUS debug flags and other settings */ + { + BOOL proj_configuration_enabled; + BOOL enabled; + UINT authentication_client_port; + UINT accounting_client_port; + UINT maximum_rx_packet_size; + BOOL set_default_values; + BOOL printing_enabled; + BOOL alarm_printing_enabled; + BOOL initialization_printing_enabled; + BOOL socket_printing_enabled; + BOOL data_printing_enabled; + BOOL trace_printing_enabled; + BOOL disable_verify_response_authenticator; + } RADIUS_PROJ_CLASS; + +/* globals */ + +/* enum declaration for radius stack version */ +typedef enum RADIUS_STACK_VERSION +{ + IPV4_ONLY = 1, + IPV6_ONLY, + IPV4_IPV6 +}RADIUS_STACK_VERSION; + +IMPORT RADIUS_PROJ_CLASS radius_config_data; +IMPORT RADIUS_PROJ_CONFIG_SERVER_INFO radius_config_primary_server; +IMPORT RADIUS_PROJ_CONFIG_SERVER_INFO radius_config_secondary_server; +IMPORT BOOL radius_config_primary_server_enabled; +IMPORT BOOL radius_config_secondary_server_enabled; +IMPORT RADIUS_STACK_VERSION radius_ip_version; + +/* forward declarations */ +void radius_populate_client_data (void); +void radius_populate_secondary_server_data (void); +void radius_populate_primary_server_data (void); +void radius_populate_ip_version (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCusrBasicRadiusBSPBuildCfgh */ + diff --git a/h/wrn/route_manager_if.h b/h/wrn/route_manager_if.h new file mode 100644 index 0000000..a9cae5d --- /dev/null +++ b/h/wrn/route_manager_if.h @@ -0,0 +1,111 @@ +/************************************************************************/ +/* Copyright (C) 1999 RouterWare, Inc. */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Blvd. Suite 212, Newport Beach, CA */ +/************************************************************************/ +#if !defined (__ROUTE_MANAGER_IF_H__) +#define __ROUTE_MANAGER_IF_H__ + +#define LOOPBACK_INTERFACE 0xffffffff + +typedef int ROUTE_MANAGER_CONTAINER_ITERATOR; + +typedef enum IP_ROUTE_PROTOCOL +{ + IP_ROUTE_PROTOCOL_OTHER=1, + IP_ROUTE_PROTOCOL_LOCAL=2, + IP_ROUTE_PROTOCOL_NETMGMT=3, + IP_ROUTE_PROTOCOL_ICMP=4, + IP_ROUTE_PROTOCOL_EGP=5, + IP_ROUTE_PROTOCOL_GGP=6, + IP_ROUTE_PROTOCOL_HELLO=7, + IP_ROUTE_PROTOCOL_RIP=8, + IP_ROUTE_PROTOCOL_IS_IS=9, + IP_ROUTE_PROTOCOL_ES_IS=10, + IP_ROUTE_PROTOCOL_CISCO_IGRP=11, + IP_ROUTE_PROTOCOL_BBNSPFIGP=12, + IP_ROUTE_PROTOCOL_OSPF=13, + IP_ROUTE_PROTOCOL_BGP=14 +} IP_ROUTE_PROTOCOL; + +typedef struct IP_ROUTE_ENTRY +{ + IP_ADDRESS ipRouteDest; + IP_ADDRESS ipRouteMask; + IP_INTERFACE_HANDLE ip_if_handle; + UINT ipRouteIfIndex; + IP_ADDRESS ipRouteNextHop; + IP_ROUTE_PROTOCOL ipRouteProto; + UINT ipRouteMetric1; +} IP_ROUTE_ENTRY; + +/* This structure specifies the mask that is used for searching entry(s) in the Routing Table. + * The ipRouteDest specifies that the ipRouteDest and ipRouteMask are (also) used for searching for + * a match. + */ + +typedef struct IP_ROUTE_ENTRY_MASK +{ + bool ipRouteDestMask; + bool ip_if_handle; + bool ipRouteProto; +} IP_ROUTE_ENTRY_MASK; + +/************************************************************************/ + +typedef struct ROUTE_MANAGER +{ + /* IP to RouteManager Interface */ + bool (*fp_route_manager_if_up) (struct ROUTE_MANAGER* p_route_manager_instance, IP_INTERFACE_HANDLE ip_if_handle); + + bool (*fp_route_manager_if_down) (struct ROUTE_MANAGER* p_route_manager_instance, IP_INTERFACE_HANDLE ip_if_handle); + + bool (*fp_route_manager_add_ip_address) (struct ROUTE_MANAGER* p_route_manager_instance, IP_INTERFACE_HANDLE ip_if_handle, + IP_ADDRESS ip_address, IP_ADDRESS subnet_mask); + + bool (*fp_route_manager_remove_address) (struct ROUTE_MANAGER* p_route_manager_instance, IP_INTERFACE_HANDLE ip_if_handle, + IP_ADDRESS ip_address, IP_ADDRESS subnet_mask); + + /* Interface to add/remove entries from RouteManager */ + bool (*fp_route_manager_add_route) (struct ROUTE_MANAGER* p_route_manager_instance, IP_ROUTE_ENTRY* p_route_entry); + + ROUTE_MANAGER_CONTAINER_ITERATOR (*fp_route_manager_create_iterator) (struct ROUTE_MANAGER* p_route_manager_instance); + + bool (*fp_route_manager_table_find) (ROUTE_MANAGER_CONTAINER_ITERATOR* p_iterator_matched_item, + IP_ROUTE_ENTRY* p_route_entry_criteria, IP_ROUTE_ENTRY_MASK* p_route_entry_mask); + + /* This function will return the first route if this is the first time we are making a call to this function + * otherwise returns the route being pointed to by this iterator. + * This function will either return the pointer to IP_ROUTE_ENTRY structure or return NULL. + */ + IP_ROUTE_ENTRY* (*fp_route_manager_get_route) (ROUTE_MANAGER_CONTAINER_ITERATOR iterator); + + /* + * This function will return the iterator to the first route if this is the first time we are calling this function, + * otherwise it advances the iterator to the next route. + * This function will return true if there are more routes entries otherwise return false. + */ + bool (*fp_route_manager_goto_next_route) (ROUTE_MANAGER_CONTAINER_ITERATOR* p_iterator_matched_item); + + bool (*fp_route_manager_remove_route) (ROUTE_MANAGER_CONTAINER_ITERATOR* p_iterator_matched_item); + + bool (*fp_route_manager_free_iterator) (ROUTE_MANAGER_CONTAINER_ITERATOR iterator_matched_item); + + /* route and source address lookup interface */ + bool (*fp_route_manager_get_source_address) (struct ROUTE_MANAGER* p_route_manager_instance, IP_ADDRESS destination, + IP_ADDRESS* p_source_ip_address); + + bool (*fp_route_manager_resolve_destination) (struct ROUTE_MANAGER* p_route_manager_instance, IP_ADDRESS destination, + IP_INTERFACE_HANDLE* p_out_interface, IP_ADDRESS* p_source_ip_address, IP_ADDRESS* p_gateway); + +} ROUTE_MANAGER; + +ROUTE_MANAGER* route_manager_create_instance (void); + +bool route_manager_destroy_instance (ROUTE_MANAGER* p_route_manager_instance); + +#endif /* __ROUTE_MANAGER_IF_H__ */ diff --git a/h/wrn/rw_driver_manager_if.h b/h/wrn/rw_driver_manager_if.h new file mode 100644 index 0000000..5c8774c --- /dev/null +++ b/h/wrn/rw_driver_manager_if.h @@ -0,0 +1,137 @@ +/************************************************************************/ +/* Copyright (C) 1999 RouterWare, Inc. */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Blvd. Suite 212, Newport Beach, CA */ +/************************************************************************/ +#if !defined (__RW_DRIVER_MANAGER_IF_H__) +#define __RW_DRIVER_MANAGER_IF_H__ +/****************************************************************************************************************************/ + +typedef UINT RW_PORT_HANDLE; +typedef void* RW_PORT_BINDING_HANDLE; +typedef void* RW_DRIVER_RECEIVE_INDICATE_HANDLE; + +#define RW_INVALID_PORT_BINDING_HANDLE NULL + +/****************************************************************************************************************************/ +typedef enum RW_DEVICE_DRIVER_TYPE +{ + RW_ETHERNET_DRIVER = 1, + RW_PPP_DRIVER = 2 +} RW_DEVICE_DRIVER_TYPE; +/****************************************************************************************************************************/ +typedef struct RW_DEVICE_DRIVER_IF +{ + RW_DEVICE_DRIVER_TYPE rw_device_driver_type; + + UINT (*fp_device_driver_get_mtu)(struct RW_DEVICE_DRIVER_IF* p_rw_device_driver_if, + RW_PORT_HANDLE port_handle); + UINT (*fp_device_driver_get_speed)(struct RW_DEVICE_DRIVER_IF* p_rw_device_driver_if, + RW_PORT_HANDLE port_handle); + /* This function has a *pointer* to the port handle as one of its parameters */ + struct RW_DEVICE_MESSAGE* (*fp_device_driver_receive)(struct RW_DEVICE_DRIVER_IF* p_rw_device_driver_if, + RW_PORT_BINDING_HANDLE* p_rw_port_binding_handle); + bool (*fp_device_driver_send)(struct RW_DEVICE_DRIVER_IF* p_rw_device_driver_if, + RW_PORT_HANDLE port_handle, + struct RW_DEVICE_MESSAGE* p_rw_device_message); +} RW_DEVICE_DRIVER_IF; +/****************************************************************************************************************************/ +typedef struct RW_DRIVER_MANAGER_IF +{ + RW_DRIVER_RECEIVE_INDICATE_HANDLE (*fp_rw_driver_manager_if_register_device_driver) + (struct RW_DRIVER_MANAGER_IF* p_rw_driver_manager_if, + struct RW_DEVICE_DRIVER_IF* p_rw_device_driver_if, + const char* p_device_driver_name); + bool (*fp_rw_driver_manager_if_deregister_device_driver) + (struct RW_DRIVER_MANAGER_IF* p_rw_driver_manager_if, + struct RW_DEVICE_DRIVER_IF* p_rw_device_driver_if); + + bool (*fp_rw_driver_manager_if_device_driver_receive_indicate) + (struct RW_DRIVER_MANAGER_IF* p_rw_driver_manager_if, + RW_DRIVER_RECEIVE_INDICATE_HANDLE rw_driver_receive_indicate_handle); + + RW_PORT_BINDING_HANDLE (*fp_rw_driver_manager_if_device_driver_port_up) + (struct RW_DRIVER_MANAGER_IF* p_rw_driver_manager_if, + struct RW_DEVICE_DRIVER_IF* p_rw_device_driver_if, + RW_PORT_HANDLE port_handle); + bool (*fp_rw_driver_manager_if_device_driver_port_down) + (struct RW_DRIVER_MANAGER_IF* p_rw_driver_manager_if, + struct RW_DEVICE_DRIVER_IF* p_rw_device_driver_if, + RW_PORT_HANDLE port_handle); +} RW_DRIVER_MANAGER_IF; +/****************************************************************************************************************************/ +typedef struct RW_ETHERNET_DRIVER_IF +{ + RW_DEVICE_DRIVER_IF parent; + + bool (*fp_get_mac_address) (struct RW_DEVICE_DRIVER_IF* p_rw_device_driver_if, RW_PORT_HANDLE port_handle, + BYTE* p_buffer, UINT buffer_size); +} RW_ETHERNET_DRIVER_IF; +/****************************************************************************************************************************/ +typedef struct RW_PPP_DRIVER_IF +{ + RW_DEVICE_DRIVER_IF parent; + + bool (*fp_get_local_address) (struct RW_PPP_DRIVER_IF* p_rw_ppp_driver_if, RW_PORT_HANDLE port_handle, IP_ADDRESS*); +} RW_PPP_DRIVER_IF; +/****************************************************************************************************************************/ +typedef enum RW_DEVICE_MESSAGE_TYPE +{ + ETHERNET_MESSAGE_TYPE = 1, + PPP_MESSAGE_TYPE = 2 +} RW_DEVICE_MESSAGE_TYPE; +/****************************************************************************************************************************/ +typedef enum RW_ENCAPSULATION_TYPE +{ + TYPE2 = 1, + SNAP = 2 +} RW_ENCAPSULATION_TYPE; +/****************************************************************************************************************************/ +typedef struct RW_DEVICE_MESSAGE +{ + RW_DEVICE_MESSAGE_TYPE type; + RW_PACKET_HANDLE payload; +} RW_DEVICE_MESSAGE; +/****************************************************************************************************************************/ +void rw_device_message_construct (RW_DEVICE_MESSAGE* p_rw_device_message); +void rw_device_message_destruct (RW_DEVICE_MESSAGE* p_rw_device_message); +/****************************************************************************************************************************/ +typedef struct RW_ETHERNET_MESSAGE +{ + RW_DEVICE_MESSAGE parent; + ETHERNET_PROTOCOL_TYPE protocol_id; + UINT port_number; + BYTE source_mac_address[ETHERNET_MAC_ADDRESS_LENGTH]; + BYTE destination_mac_address[ETHERNET_MAC_ADDRESS_LENGTH]; + RW_ENCAPSULATION_TYPE encapsulation_type; +} RW_ETHERNET_MESSAGE; +/****************************************************************************************************************************/ +void rw_ethernet_message_construct (RW_ETHERNET_MESSAGE* p_rw_ethernet_message); +void rw_ethernet_message_destruct (RW_ETHERNET_MESSAGE* p_rw_ethernet_message); + +RW_ETHERNET_MESSAGE* rw_ethernet_message_create (void); +bool rw_ethernet_message_destroy (RW_ETHERNET_MESSAGE* p_rw_ethernet_message); + +bool rw_ethernet_message_serialize (RW_ETHERNET_MESSAGE* p_rw_ethernet_message, RW_PACKET_HANDLE* payload); +bool rw_ethernet_message_deserialize (RW_ETHERNET_MESSAGE* p_rw_ethernet_message, RW_PACKET_HANDLE payload); +/* ************************************************************************************************************************ */ +typedef struct RW_PPP_MESSAGE +{ + RW_DEVICE_MESSAGE parent; + /* And some more message header fields */ +} RW_PPP_MESSAGE; +/****************************************************************************************************************************/ +void rw_ppp_message_construct (RW_PPP_MESSAGE* p_rw_ppp_message); +void rw_ppp_message_destruct (RW_PPP_MESSAGE* p_rw_ppp_message); + +RW_PPP_MESSAGE* rw_ppp_message_create (void); +bool rw_ppp_message_destroy (RW_PPP_MESSAGE* p_rw_ppp_message); + +bool rw_ppp_message_serialize (RW_PPP_MESSAGE* p_rw_ppp_message, RW_PACKET_HANDLE* payload); +bool rw_ppp_message_deserialize (RW_PPP_MESSAGE* p_rw_ppp_message, RW_PACKET_HANDLE payload); +/* ************************************************************************************************************************ */ +#endif /* __RW_DRIVER_MANAGER_IF_H__ */ diff --git a/h/wrn/rwos.h b/h/wrn/rwos.h new file mode 100644 index 0000000..75732b2 --- /dev/null +++ b/h/wrn/rwos.h @@ -0,0 +1,57 @@ +/************************************************************************/ +/* Copyright (C) 1999 RouterWare, Inc. */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Blvd. Suite 212, Newport Beach, CA */ +/************************************************************************/ +#if !defined (_RWOS_H_) +#define _RWOS_H_ + +#if defined (WIN32) +#define RW_EXPORT __declspec(dllexport) +#else +#define RW_EXPORT +#endif +#define RWOS_VERSION "1.0" +#define RWOS_REV "/1" /* 0 for first revision */ +#define RWOS_BUILD __DATE__ + +#define MINIMUM_UINT(a,b) ((a)<(b)?(a):(b)) + +#include /* VxWorks standard typedefs */ + +#if defined (__VXWORKS__) + #if !defined (WIN32) + #define _pack __attribute__ ((packed)) /* gnu cc pack attribute */ + #endif +#else + #define _pack +#endif + +#if! defined bool + typedef enum bool + { + true = 1, + false = 0 + } bool; +#endif /* bool */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef __SNMP_FWD_DECL__ +#include +#endif +#include +#endif /*_RWOS_H_*/ + diff --git a/h/wrn/rwos/module_prototype.h b/h/wrn/rwos/module_prototype.h new file mode 100644 index 0000000..71bde15 --- /dev/null +++ b/h/wrn/rwos/module_prototype.h @@ -0,0 +1,27 @@ +#if !defined (_MODULE_PROTOTYPE_H_) +#define _MODULE_PROTOTYPE_H_ + +/***************************************************************************/ +/* Function Prototypes */ +/***************************************************************************/ +void bgp4_task_initialize (const char*p_configuration_file); + +void initialize_ipsec_modules (const char* p_configuration_data); + +void pns_task_initialize (const char*p_configuration_file); + +void pns_task_cleanup (void); + +void pptp_task_initialize (const char*p_configuration_file); + +void pptp_task_cleanup (void); + +void nat_task_initialize(const char* p_configuration_data); /* nat_task_init.c */ +void nat_cleanup(void); /* nat_cleanup.c */ + +void l2tp_task_initialize (const char*p_configuration_file); +void l2tp_task_cleanup (void); + +void radius_task_initialize (const char*p_configuration_file); + +#endif /*_MODULE_PROTOTYPE_H_*/ diff --git a/h/wrn/rwos/rw_host_os_interface.h b/h/wrn/rwos/rw_host_os_interface.h new file mode 100644 index 0000000..f4935ef --- /dev/null +++ b/h/wrn/rwos/rw_host_os_interface.h @@ -0,0 +1,77 @@ +/* Copyright 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01 Aug1301,aos Added TID as a parameter to rwos_send_close_signal () function +*/ + +/************************************************************************/ +/* Copyright (C) 1998 RouterWare, Inc. */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Blvd. Suite 212, Newport Beach, CA */ +/************************************************************************/ +#if !defined (_RW_HOST_OS_INTERFACE_H_) +#define _RW_HOST_OS_INTERFACE_H_ + +typedef UINT RWOS_HANDLE; +typedef UINT HOST_OS_EVENT_HANDLE; +typedef UINT HOST_OS_MUTEX_HANDLE; + +typedef bool(*FP_HOST_OS_EVENT_SET) (HOST_OS_EVENT_HANDLE); +typedef bool(*FP_HOST_OS_EVENT_RESET) (HOST_OS_EVENT_HANDLE); +typedef HOST_OS_EVENT_HANDLE (*FP_HOST_OS_EVENT_CREATE) (void); +typedef void (*FP_HOST_OS_EVENT_DESTROY)(HOST_OS_EVENT_HANDLE); +typedef HOST_OS_MUTEX_HANDLE (*FP_HOST_OS_MUTEX_CREATE) (const char *p_mutex_name); +typedef bool(*FP_HOST_OS_MUTEX_DESTROY) (HOST_OS_MUTEX_HANDLE); +typedef bool(*FP_HOST_OS_MUTEX_ACQUIRE) (HOST_OS_MUTEX_HANDLE, UINT max_wait_time); +typedef bool(*FP_HOST_OS_MUTEX_RELEASE) (HOST_OS_MUTEX_HANDLE); + +/****************************************************************************/ +typedef struct HOST_OS_CALLBACK_IF +{ + FP_HOST_OS_EVENT_SET fp_host_os_event_set; + + FP_HOST_OS_EVENT_RESET fp_host_os_event_reset; + + FP_HOST_OS_EVENT_CREATE fp_host_os_event_create; + + FP_HOST_OS_EVENT_DESTROY fp_host_os_event_destroy; + + FP_HOST_OS_MUTEX_CREATE fp_host_os_mutex_create; + + FP_HOST_OS_MUTEX_DESTROY fp_host_os_mutex_destroy; + + FP_HOST_OS_MUTEX_ACQUIRE fp_host_os_mutex_acquire; + + FP_HOST_OS_MUTEX_RELEASE fp_host_os_mutex_release; + +}HOST_OS_CALLBACK_IF; + + +/****************************************************************************/ +/* rwos interface */ +/****************************************************************************/ +RW_EXPORT bool rwos_initialize (HOST_OS_CALLBACK_IF* p_host_os_call_back_interface, UINT clock_ticks_per_second, void** pp_rwos_handle); +RW_EXPORT void rwos_request_to_shutdown (void); +RW_EXPORT void rwos_exit (void); +RW_EXPORT bool rwos_scheduler_dispatch_active_objects (void); +RW_EXPORT UINT rwos_scheduler_dispatch_idle_objects (void); +RW_EXPORT bool rwos_process_driver_manager_events (void); +RW_EXPORT void rwos_dispatch_loop (void); +RW_EXPORT void rwos_send_close_signal (UINT TID); +RW_EXPORT bool rwos_wait_for_close_event (void); + +/****************************************************************************/ +/* Set methods for rwos event handles */ +/****************************************************************************/ +RW_EXPORT void rwos_set_event_handle (HOST_OS_EVENT_HANDLE event); +RW_EXPORT void rwos_set_close_event_handle (HOST_OS_EVENT_HANDLE close_event); +RW_EXPORT void rwos_set_driver_manager_event_handle (HOST_OS_EVENT_HANDLE driver_manager_event); + + +#endif /* _RW_HOST_OS_INTERFACE_H_ */ diff --git a/h/wrn/rwos/rw_task_functions.h b/h/wrn/rwos/rw_task_functions.h new file mode 100644 index 0000000..99f23ab --- /dev/null +++ b/h/wrn/rwos/rw_task_functions.h @@ -0,0 +1,22 @@ +/* + * Modification History + * -------------------- + */ + +#if !defined (_RW_TASK_FUNCTIONS_H_) +#define _RW_TASK_FUNCTIONS_H_ + +/****************************************************************************/ +/* System functions */ +/****************************************************************************/ +int rw_create_system_task (const char* p_task_name, void* p_task_entry_point, UINT task_priority, UINT task_stack_size,UINT task_options,...); + + +/****************************************************************************/ +/* RW Task OS Entry point */ +/****************************************************************************/ +UINT rw_task_main (FP_RWOS_MODULE_STARTUP system_module_table[], + const char* p_configuration_file_contents, char* p_task_name, + UINT task_priority, UINT task_options ); + +#endif /*_RW_TASK_FUNCTIONS_H_*/ diff --git a/h/wrn/rwos/rw_util.h b/h/wrn/rwos/rw_util.h new file mode 100644 index 0000000..093c6fd --- /dev/null +++ b/h/wrn/rwos/rw_util.h @@ -0,0 +1,307 @@ +/* Copyright 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02d,22aug05,djp Removed _pack reference to eliminate compiler warning +02c,07sep04,djp Merged nortel modifications +02b,13sep04,cdw Added defines for INCLUDE_IPSEC_MEMORY_ROUTINES +02a,09may02,ark Added in fix for SPR 70535 +01a,13aug01,aos Redirecting all memory call to RWOS memory manager +*/ + + +/************************************************************************/ +/* Copyright (C) 1999 RouterWare, Inc. */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Blvd. Suite 212, Newport Beach, CA */ +/************************************************************************/ +#if !defined (__RW_UTIL_H__) +#define __RW_UTIL_H__ +/* ************************************************************************************************************************ */ +#include + +#if defined (INCLUDE_IPSEC_MEMORY_ROUTINES) +#include +#endif + +/* ************************************************************************************************************************ */ +/*#include "rw_system_configuration.h" */ +/* ************************************************************************************************************************ */ +#define MAXIMUM_NUMBER_OF_BYTES_IN_MAC_ADDRESS 16 +#define ETHERNET_MAC_ADDRESS_LENGTH 6 +#define NUMBER_OF_BITS_IN_BYTE 8 + +#define BROADCAST_IP_ADDRESS 0xffffffff +#define MULTICAST_IP_ADDRESS 0xf0000000 +#define NULL_IP_ADDRESS ((IP_ADDRESS)(0)) + + +/* Internet address class. Note the IP address is in host order. */ +#define IN_CLASS_A(ip_address) (((ULONG) (ip_address) & 0x80000000L) == 0) +#define IN_CLASS_A_NET 0xff000000L +#define IN_CLASS_A_HOST 0x00ffffffL + +#define IN_CLASS_B(ip_address) (((ULONG) (ip_address) & 0xc0000000L) == 0x80000000L) +#define IN_CLASS_B_NET 0xffff0000L +#define IN_CLASS_B_HOST 0x0000ffffL + +#define IN_CLASS_C(ip_address) (((ULONG) (ip_address) & 0xe0000000L) == 0xc0000000L) +#define IN_CLASS_C_NET 0xffffff00L +#define IN_CLASS_C_HOST 0x000000ffL + +#define IN_CLASS_D(ip_address) (((ULONG) (ip_address) & 0xf0000000L) == 0xe0000000L) + +#if !defined (IN_MULTICAST_CLASS) + #define IN_MULTICAST_CLASS(ip_address) IN_CLASS_D (ip_address) +#endif + + +#if 0 /* These conflict with coreip/in.h definitions! -rlm 2004-08-09 */ +#if !defined (IN_EXPERIMENTAL) + #define IN_EXPERIMENTAL(ip_address) (((ULONG) (ip_address) & 0xe0000000L) == 0xe0000000L) +#endif + +#if !defined (IN_BADCLASS) + #define IN_BADCLASS(ip_address) (((ULONG) (ip_address) & 0xf0000000L) == 0xf0000000L) +#endif +#endif /* -rlm 2004-08-09 */ + + +#if !defined (INTERNET_ADDRESS_ANY) + #define INTERNET_ADDRESS_ANY (ULONG) 0x00000000L +#endif + +#if !defined (INTERNET_ADDRESS_LOOPBACK) + #define INTERNET_ADDRESS_LOOPBACK (ULONG) 0x7F000000L +#endif + +#define INTERNET_ADDRESS_LOOPBACK_MASK (ULONG) 0x00FFFFFFL + +#if !defined (INTERNET_ADDRESS_BROADCAST) + #define INTERNET_ADDRESS_BROADCAST (ULONG) 0xffffffffL +#endif + + +#define IN_LOOPBACK_ADDRESS(ip_address) (((ULONG) (ip_address) | INTERNET_ADDRESS_LOOPBACK_MASK) == INTERNET_ADDRESS_LOOPBACK) +#define IN_BROADCAST(ip_address) (((ULONG)(ip_address) == INTERNET_ADDRESS_BROADCAST)) + +#define IN_LOOPBACK_NET 127 + + + +#define F_BROADCAST_IP_ADDRESS(ip_address) ((ip_address) == ((IP_ADDRESS) (0xffffffff))) +#define F_MULTICAST_IP_ADDRESS(ip_address) (((ip_address) & 0xf0000000) == 0xf0000000) +#define F_NULL_IP_ADDRESS(ip_address) ((ip_address) == ((IP_ADDRESS)(0))) + + +#define IP_VERSION_4 4 +#define IP_WORD_SIZE 4 +#define IP_PACKET_HEADER_MINIMUM_LENGTH 20 +#define IPV6_PACKET_HEADER_MINIMUM_LENGTH 40 +#define IP_PACKET_HEADER_MAXIMUM_LENGTH 60 +#define IP_PACKET_MAXIMUM_SIZE 65535 +#define IP_FRAGMENT_OFFSET_MASK 0x1fff +#define IP_DEFAULT_TIME_TO_LIVE 32 +#define IP_BYTES_PER_FRAGMENT_BLOCK 8 + +#define LOOPBACK_IP_ADDRESS 0x7f000001 +#define SUBNET_MASK_ALL_ONES 0xffffffff + +#define IP_REASSEMBLY_DURATION 60000 /* in milliseconds == 60 seconds */ + +#define ICMP_ECHO_REQUEST 8 +#define ICMP_ECHO_REPLY 0 +#define ECHO_AGENT_MESSAGE_HEADER_SIZE 8 + +#if !defined (__VxWORKS__) +#if !defined (WAIT_FOREVER) +#define WAIT_FOREVER 0xffffffff +#endif +#endif + +#define PARAMETER_NOT_USED(parameter_one) (parameter_one = parameter_one) +/* ************************************************************************************************************************ */ + +#if defined (__WRN_DEFAULT_HEAP_MANAGER__) +#define buffer_malloc malloc +#define buffer_free free + +#define table_malloc calloc +#define table_free free + +#define message_malloc malloc +#define message_free free + +#elif defined (INCLUDE_IPSEC_MEMORY_ROUTINES) +#define buffer_malloc ipsecMemoryAllocate +#define buffer_free(ptr) do { ipsecMemoryFree(ptr); ptr = NULL; } while(0) + +#define table_malloc ipsecMemoryCalloc +#define table_free(ptr) do { ipsecMemoryFree(ptr); ptr = NULL; } while(0) + +#define message_malloc ipsecMemoryAllocate +#define message_free(ptr) do { ipsecMemoryFree(ptr); ptr = NULL; } while(0) + +#else + +#define buffer_malloc rw_memory_allocate +#define buffer_free(ptr) do { rw_memory_free(ptr); ptr = NULL; } while(0) + +#define table_malloc rw_memory_calloc +#define table_free(ptr) do { rw_memory_free(ptr); ptr = NULL; } while(0) + +#define message_malloc rw_memory_allocate +#define message_free(ptr) do { rw_memory_free(ptr); ptr = NULL; } while(0) + +#endif /*__WRN_DEFAULT_HEAP_MANAGER__*/ + +/* ************************************************************************************************************************ */ +#define high_byte_of_dword(double_word) (((double_word) >> 24) & 0x000000ff) /* High byte of word double_word. */ +#define high_low_byte_of_dword(double_word) (((double_word) >> 16) & 0x000000ff) /* High byte of word double_word. */ +#define low_high_of_dword(double_word) (((double_word) >> 8) & 0x000000ff) /* High byte of word double_word. */ +#define low_byte_of_dword(double_word) ((double_word) & 0x000000ff) /* Low byte of word double_word. */ + +#if !defined (_WRS_V2__) +/* ************************************************************************************************************************ */ +#define high_byte_of_ulong(double_word) (((double_word) >> 24) & 0x000000ff) /* High byte of word double_word. */ +#define high_low_byte_of_ulong(double_word) (((double_word) >> 16) & 0x000000ff) /* High byte of word double_word. */ +#define low_high_of_ulong(double_word) (((double_word) >> 8) & 0x000000ff) /* High byte of word double_word. */ +#define low_byte_of_ulong(double_word) ((double_word) & 0x000000ff) /* Low byte of word double_word. */ +/* ************************************************************************************************************************ */ +#define high_byte_of_ushort(ushort) (((ushort)>>8)&0x00ff) /* High byte of ushort ushort. */ +#define low_byte_of_ushort(ushort) ((ushort)&0x00ff) /* Low byte of ushort ushort. */ +#define low_ushort_of_ulong(double_ushort) (WORD)(((double_ushort) >> 16) & 0x0000ffff) /* High byte of ushort double_ushort. */ +#define high_ushort_of_ulong(double_ushort) (WORD)((double_ushort) & 0x0000ffff) /* Low byte of ushort double_ushort. */ +#define two_bytes_to_ushort(high_byte,low_byte) ((((high_byte)&0x00ff)<<8)|((low_byte)&0x00ff)) +#endif +/* ************************************************************************************************************************ */ + +#if !defined BYTE +typedef unsigned char BYTE; +#endif + +#if !defined BOOLEAN +typedef enum BOOLEAN +{ + _FALSE = 0 /* FALSE and TRUE are already defined here */ + ,_TRUE = 1 +} BOOLEAN; +#endif + +#if !defined _struct +#define _struct struct +#endif + +#if !defined _union +#define _union union +#endif + +#if !defined _enum +#define _enum enum +#endif + +#if !defined STRINGS_MATCH +#define STRINGS_MATCH ((int) NULL) +#endif + +#if !defined PSTR +typedef char* PSTR; +#endif + +#if defined (GLOBAL_FILE) + #define GLOBAL +#else + #define GLOBAL extern +#endif + +#if defined (__RW_SYSTEM__) + extern CONFIGURATION_TABLE rw_system_configuration_table; +#endif + + +/* ************************************************************************************************************************ */ +typedef UINT DRIVER_MANAGER_INSTANCE; +typedef UINT ROUTE_MANAGER_INSTANCE; +typedef UINT LINK_DRIVER_INSTANCE; +typedef UINT LINK_DRIVER_MANAGER_INSTANCE; +typedef UINT ARP_INSTANCE; +typedef UINT IP_INSTANCE; +typedef UINT IPSEC_INSTANCE; +typedef UINT ECHO_AGENT_INSTANCE; +typedef UINT DRIVER_MANAGER_HANDLE; +typedef UINT IP_INTERFACE_HANDLE; + +typedef UINT LINK_DRIVER_INTERFACE_HANDLE; +typedef UINT ARP_USER_HANDLE; +typedef UINT IP_IF_HANDLE; +typedef UINT ARP_IF_HANDLE; +typedef UINT INTERFACE_HANDLE; +typedef ULONG IP_ADDRESS; + +#define INVALID_HANDLE ((UINT)NULL) +/* ************************************************************************************************************************ */ +typedef enum ETHERNET_PROTOCOL_TYPE +{ + IP_PROTOCOL = 0x0800, + ARP_PROTOCOL = 0x0806 +} ETHERNET_PROTOCOL_TYPE; + +typedef enum ARP_RESULT +{ + ARP_FAIL = 0, + ARP_SUCCESS = 1, + ARP_PENDING = 2 +} ARP_RESULT; + +typedef enum ECHO_TEST +{ + ECHO_FAIL =0, + ECHO_PASS = 1 +} ECHO_TEST; + + +typedef enum TEST +{ + PASS = 1, + FAIL = 0 +} TEST; + +#if !defined (__BIG_ENUMS__) + #define ULONG_ENUM(enum_name) enum enum_name + #define USHORT_ENUM(enum_name) enum enum_name + #define BYTE_ENUM(enum_name) enum enum_name +#else + #define ULONG_ENUM(enum_name) ULONG + #define USHORT_ENUM(enum_name) USHORT + #define BYTE_ENUM(enum_name) BYTE +#endif + +/* ************************************************************************************************************************ */ +UINT deserialize_byte (BYTE** ptr_to_bptr_location); +UINT deserialize_ushort (BYTE** ptr_to_usptr_location); +ULONG deserialize_ulong (BYTE** ptr_to_ulptr_location); +void deserialize_short_bit_field (UINT size, USHORT *usptr_start, ...); + +void serialize_byte (UINT source, BYTE** ptr_to_bptr_destination); +void serialize_ushort (UINT source, BYTE** ptr_to_usptr_destination); +void serialize_ulong (ULONG source, BYTE** ptr_to_ulptr_destination); +enum TEST serialize_short_bit_field (UINT size, USHORT *usptr_destination, ...); + +/* Misc prototypes */ +ULONG host_to_net_long (ULONG host_order_long_value); +char *convert_ip_address_to_dot_format (char *cptr_array_to_store_dot_format_address, ULONG ip_address); + +USHORT host_to_net_short (USHORT host_order_short_value); +USHORT net_to_host_short (USHORT net_order_short_value); + +ULONG host_to_net_long (ULONG host_order_long_value); +ULONG net_to_host_long (ULONG net_order_long_value); + +/* ************************************************************************************************************************ */ +#endif /* __RW_UTIL_H__ */ + diff --git a/h/wrn/rwos/rwbufferpool.h b/h/wrn/rwos/rwbufferpool.h new file mode 100644 index 0000000..6cc6e2d --- /dev/null +++ b/h/wrn/rwos/rwbufferpool.h @@ -0,0 +1,12 @@ +#if !defined (__RWBUFFERPOOL_H__) +#define __RWBUFFERPOOL_H__ + +typedef UINT RW_BUFFER_POOL_HANDLE; + +RW_BUFFER_POOL_HANDLE rw_buffer_pool_create (UINT buffer_size, char* p_pool_memory_segment, UINT pool_memory_segment_size); + +bool rw_buffer_pool_destroy (RW_BUFFER_POOL_HANDLE buffer_pool, char** p_pool_memory_segment, UINT* p_pool_memory_segment_size); + +RW_PACKET_HANDLE rw_buffer_pool_get_rw_packet (RW_BUFFER_POOL_HANDLE buffer_pool, UINT reserved_header_size); + +#endif /* __RWBUFFERPOOL_H__ */ diff --git a/h/wrn/rwos/rwcontainer.h b/h/wrn/rwos/rwcontainer.h new file mode 100644 index 0000000..b861bed --- /dev/null +++ b/h/wrn/rwos/rwcontainer.h @@ -0,0 +1,159 @@ +/* + * $Log:: /Tornado/target/h/NB/rwos/rwcontainer.h $ + * + * 1 2/09/00 4:44p Admin + * + * 1 8/27/99 1:00p Alex + * + * 3 8/17/99 7:23p Rob + * Created rw_container_free_items(), used to remove and free all items in a container. The items in + * the container must be single-buffer items (single malloc) for this function to work without + * leaking memory. + * + * 2 7/01/99 3:39p Rajive + * Made changes for CIDR tree. + * + * 1 5/20/99 11:46a Alex + * + * 1 4/14/99 5:10p Rajive + * Initial vesrion of Next Gen RouterWare Source code + * + * 1 1/18/99 5:10p Mahesh + * + * 1 1/18/99 4:25p Mahesh + * + * 5 11/13/98 9:20p Mahesh + * + * 4 9/18/98 4:31p Mahesh + * Changed C++ style comments to C style comments + * + * 3 8/24/98 7:47p Mahesh + * Added copyright notice. + * + * 2 8/20/98 3:44p Mahesh + * Changed iterator pointers to be JUST iterators. + * + * 1 8/18/98 2:29p Mahesh + * Initial Check In + */ +/************************************************************************/ +/* Copyright (C) 1998 RouterWare, Inc. */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Blvd. Suite 212, Newport Beach, CA */ +/************************************************************************/ +#if !defined RwContainer_h +#define RwContainer_h + +typedef void RW_CONTAINER_ITEM; +typedef int (*FP_RW_CONTAINER_ITEM_COMPARE) (const RW_CONTAINER_ITEM* p_first_item, const RW_CONTAINER_ITEM* p_second_item); + /* returns 0 if the two items are equal, > 0 if first_item > second_item, and < 0 if otherwise. */ + +typedef void RW_CONTAINER_CRITERIA; +typedef bool (*FP_RW_CONTAINER_ITEM_CRITERIA_MATCHER) (const RW_CONTAINER_ITEM* p_item, RW_CONTAINER_CRITERIA* p_criteria); + /* returns true if *itertor matches p_criteria */ + + +/* class RW_CONTAINER:: */ + +typedef void RW_CONTAINER; +typedef int RW_CONTAINER_ITERATOR; + +RW_EXPORT RW_CONTAINER_ITERATOR rw_container_create_iterator (RW_CONTAINER* p_rw_container); +RW_EXPORT void rw_container_free_iterator (RW_CONTAINER_ITERATOR iterator); + +RW_EXPORT RW_CONTAINER_ITERATOR rw_container_create_copy_of_iterator (RW_CONTAINER_ITERATOR iterator); + +RW_EXPORT void rw_container_free (RW_CONTAINER* p_rw_container); + +RW_EXPORT void rw_container_free_items (RW_CONTAINER* p_rw_container); /* Use only for single buffer items */ + +RW_EXPORT bool rw_container_add_front (RW_CONTAINER* p_rw_container, const RW_CONTAINER_ITEM* p_item); +RW_EXPORT void rw_container_remove_front (RW_CONTAINER* p_rw_container); +RW_EXPORT bool rw_container_add_back (RW_CONTAINER* p_rw_container, const RW_CONTAINER_ITEM* p_item); +RW_EXPORT void rw_container_remove_back (RW_CONTAINER* p_rw_container); +RW_EXPORT bool rw_container_insert (RW_CONTAINER_ITERATOR iterator, const RW_CONTAINER_ITEM* p_item); +RW_EXPORT bool rw_container_remove (RW_CONTAINER_ITERATOR iterator); + +RW_EXPORT UINT rw_container_size (const RW_CONTAINER* p_rw_container); + +RW_EXPORT RW_CONTAINER_ITEM* rw_container_front (const RW_CONTAINER* p_rw_container); +RW_EXPORT RW_CONTAINER_ITEM* rw_container_back (const RW_CONTAINER* p_rw_container); + +RW_EXPORT bool rw_container_is_at_front (RW_CONTAINER_ITERATOR iterator); +RW_EXPORT bool rw_container_is_at_end (RW_CONTAINER_ITERATOR iterator); + +RW_EXPORT void rw_container_goto_front (RW_CONTAINER_ITERATOR iterator); +RW_EXPORT void rw_container_goto_end (RW_CONTAINER_ITERATOR iterator); /* end == last + 1 */ + +RW_EXPORT bool rw_container_find_by_content (RW_CONTAINER_ITEM* p_item, RW_CONTAINER_ITERATOR iterator_matched_item); +RW_EXPORT bool rw_container_find (FP_RW_CONTAINER_ITEM_CRITERIA_MATCHER fp_criteria_matcher, RW_CONTAINER_CRITERIA* p_criteria, + RW_CONTAINER_ITERATOR iterator_matched_item); +RW_EXPORT bool rw_container_find_in_range (RW_CONTAINER_ITERATOR iterator_first, RW_CONTAINER_ITERATOR iterator_last, + FP_RW_CONTAINER_ITEM_CRITERIA_MATCHER fp_criteria_matcher, RW_CONTAINER_CRITERIA* p_criteria, + RW_CONTAINER_ITERATOR iterator_matched_item); + +RW_EXPORT bool rw_container_next (RW_CONTAINER_ITERATOR iterator); /* return false if reaches the back. */ +RW_EXPORT bool rw_container_previous (RW_CONTAINER_ITERATOR iterator); /* return false if reaches the front */ +RW_EXPORT RW_CONTAINER_ITEM* rw_container_at (RW_CONTAINER_ITERATOR iterator); +RW_EXPORT bool rw_container_set_at (RW_CONTAINER_ITERATOR iterator, const RW_CONTAINER_ITEM* p_item); + + +/* class RW_LIST:: */ + +RW_EXPORT RW_CONTAINER* rw_list_create (FP_RW_CONTAINER_ITEM_COMPARE fp_compare); + /* If fp_compare == NULL, the list is unsorted. */ + + +/* class RW_ARRAY:: */ +RW_EXPORT RW_CONTAINER* rw_array_create (UINT max_number_of_items); + +RW_EXPORT bool rw_array_offset (RW_CONTAINER_ITERATOR iterator, int offset); +RW_EXPORT int rw_array_difference (RW_CONTAINER_ITERATOR iterator_1, RW_CONTAINER_ITERATOR iterator_2); + + +/* class RW_HASH_TABLE:: */ + +typedef void RW_HASH_KEY; +typedef UINT (*FP_RW_HASHER) (const RW_HASH_KEY* p_hash_key); +typedef UINT (*FP_RW_ITEM_HASHER) (const RW_CONTAINER_ITEM* p_item); + +RW_EXPORT RW_CONTAINER* rw_hash_table_create (UINT max_hash_value, FP_RW_HASHER fp_hasher, FP_RW_ITEM_HASHER fp_item_hasher, + FP_RW_CONTAINER_ITEM_CRITERIA_MATCHER fp_rw_item_matcher); + +RW_EXPORT bool rw_hash_table_find (const RW_HASH_KEY* p_hash_key, RW_CONTAINER_ITERATOR iterator_matched_item); + /* hash table will use RW_HASH_KEY as match criteria during the search. */ + +/* class RW_MAP:: */ + +typedef void RW_MAP_KEY; +typedef int (*FP_RW_MAP_KEY_AND_ITEM_COMPARE) (const RW_MAP_KEY* p_map_key, const RW_CONTAINER_ITEM* p_item); + +RW_EXPORT RW_CONTAINER* rw_map_create (FP_RW_MAP_KEY_AND_ITEM_COMPARE fp_map_key_and_item_compare, FP_RW_CONTAINER_ITEM_COMPARE fp_item_compare); + +RW_EXPORT bool rw_map_find (const RW_MAP_KEY* p_map_key, RW_CONTAINER_ITERATOR iterator_matched_item); + +/* class RW_CIDR_TREE: */ + +typedef struct RW_CIDR_KEY +{ + ULONG key; + ULONG mask_size_in_bits; +} RW_CIDR_KEY; + +RW_EXPORT RW_CONTAINER* rw_cidr_tree_create (void); +RW_EXPORT bool rw_cidr_tree_insert (RW_CONTAINER* p_cidr_tree, const RW_CIDR_KEY* p_cidr_key, const RW_CONTAINER_ITEM* p_item); +RW_EXPORT bool rw_cidr_tree_find (const RW_CONTAINER* p_cidr_tree, const RW_CIDR_KEY* p_cidr_key, RW_CONTAINER_ITERATOR cidr_iterator); + +RW_EXPORT bool rw_cidr_subtree_find (RW_CONTAINER_ITERATOR cidr_iterator, const RW_CIDR_KEY* p_cidr_key); + +RW_EXPORT bool rw_cidr_tree_is_orphan (const RW_CONTAINER_ITERATOR cidr_iterator); + +RW_EXPORT bool rw_cidr_tree_parent (RW_CONTAINER_ITERATOR cidr_iterator); + +RW_EXPORT bool rw_cidr_tree_get_key (RW_CONTAINER_ITERATOR cidr_iterator, RW_CIDR_KEY* p_cidr_key); + +#endif /* RwContainer_h */ diff --git a/h/wrn/rwos/rwdispatcher.h b/h/wrn/rwos/rwdispatcher.h new file mode 100644 index 0000000..441f2f7 --- /dev/null +++ b/h/wrn/rwos/rwdispatcher.h @@ -0,0 +1,191 @@ + +/* Copyright 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +03a,19Feb03,teamf1 added function protoype for seconds version of + rwos_time_stamp routines for IPSEC. +02a,20nov02,ram SPR 84312 added function prototype of system time in seconds +01 Aug1301,aos Added RWOS show routine for version number +*/ + + + + +/* + * $Log: rwdispatcher.h,v $ + * Revision 1.5 2003/02/19 06:49:09 rajendra + * ipsec now uses second version of rwos_time_stamp routines + * + * Revision 1.4 2003/01/07 07:51:54 bindu + * 1. Merged 2nd Jan IPSEC code from WRS. + * + * + * 1 2/09/00 4:44p Admin + * + * 2 9/15/99 5:14p Alex + * + * 1 8/27/99 1:00p Alex + * + * 1 5/20/99 11:46a Alex + * + * 1 4/14/99 5:10p Rajive + * Initial vesrion of Next Gen RouterWare Source code + * + * 2 2/04/99 10:21p Mahesh + * Added mutex functions and related definitions. + * + * 1 1/18/99 5:10p Mahesh + * + * 1 1/18/99 4:25p Mahesh + * + * 3 11/13/98 9:20p Mahesh + * + * 2 9/18/98 4:35p Mahesh + * Changed C++ style comments to C style comments + * + * 1 9/03/98 7:38p Mahesh + * initial check in + */ +/************************************************************************/ +/* Copyright (C) 1998 RouterWare, Inc. */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Blvd. Suite 212, Newport Beach, CA */ +/************************************************************************/ +#if !defined (__RWDISPATCHER_H__) +#define __RWDISPATCHER_H__ + +#define RWOS_TIMESTAMP_INFINITE_DURATION 0xffffffffL +#define RWOS_DEFAULT_MUTEX 0xffffffffL + +typedef UINT RWOS_EVENT; + +typedef UINT RWOS_DISPATCHER; + +typedef UINT RWOS_DISPATCH_QUEUE; + +typedef UINT RWOS_CRITICAL_SECTION; + +typedef UINT RWOS_MUTEX; + +/* Note: All time are in milliseconds. */ +typedef struct RWOS_TIME_STAMP +{ + /* Do not access the following members directly */ + UINT last_imprint; + + UINT duration; +} RWOS_TIME_STAMP; + +typedef void (*FPTR_DISPATCH_QUEUE_ITEM_HANDLER) (void* p_user, RW_CONTAINER_ITEM* p_item); + +typedef void (*FPTR_DISPATCHER_HANDLER) (void* p_user); + +typedef enum RWOS_DISPATCHER_PRIORITY +{ + RWOS_DISPATCHER_PRIORITY_LOWEST, + + RWOS_DISPATCHER_PRIORITY_LOW, + + RWOS_DISPATCHER_PRIORITY_NORMAL, + + RWOS_DISPATCHER_PRIORITY_HIGH, + + RWOS_DISPATCHER_PRIORITY_HIGHEST, + + /* ensure that the following is always the last element of this enum. */ + NUMBER_OF_DISPATCHER_PRIORITIES +} RWOS_DISPATCHER_PRIORITY; + +/***************************************************************************/ +RW_EXPORT RWOS_EVENT rwos_event_create (void); + +RW_EXPORT bool rwos_event_set (RWOS_EVENT); + +RW_EXPORT bool rwos_event_reset (RWOS_EVENT); + +RW_EXPORT void rwos_event_destroy (RWOS_EVENT); + +RW_EXPORT bool rwos_time_stamp_imprint (RWOS_TIME_STAMP*); + +RW_EXPORT bool rwos_time_stamp_set_duration (RWOS_TIME_STAMP*, UINT duration); + +RW_EXPORT UINT rwos_time_stamp_get_remaining_time (RWOS_TIME_STAMP); + +RW_EXPORT bool rwos_time_stamp_imprint_second (RWOS_TIME_STAMP*); + +RW_EXPORT bool rwos_time_stamp_set_duration_second (RWOS_TIME_STAMP*, UINT duration); + +RW_EXPORT UINT rwos_time_stamp_get_remaining_time_second (RWOS_TIME_STAMP); + +RW_EXPORT UINT rwos_time_stamp_calculate_remaining_time (RWOS_TIME_STAMP, UINT system_elapsed_time); + +RW_EXPORT bool rwos_time_stamp_expire_now (RWOS_TIME_STAMP*); + +/* GENERAL SYSTEM FUNCTION */ +RW_EXPORT UINT rwos_get_system_elapsed_time (void); /* in milliseconds */ +/* SPR 84312 -- Begin */ +RW_EXPORT UINT rwos_get_system_elapsed_time_second (void); /* in seconds */ +/* SPR 84312 -- End */ + +/* Dispatcher functions. */ +RW_EXPORT RWOS_DISPATCHER rwos_dispatcher_create (RWOS_DISPATCHER_PRIORITY); + +RW_EXPORT void rwos_dispatcher_destroy (RWOS_DISPATCHER); + +RW_EXPORT bool rwos_dispatcher_register_user (RWOS_DISPATCHER, void* p_user); + +RW_EXPORT bool rwos_dispatcher_register_event_handler (RWOS_DISPATCHER, RWOS_EVENT, FPTR_DISPATCHER_HANDLER p_event_handler); + +RW_EXPORT bool rwos_dispatcher_register_idle_timer_handler (RWOS_DISPATCHER, FPTR_DISPATCHER_HANDLER p_idle_timer_handler); + +RW_EXPORT bool rwos_dispatcher_set_sleep_duration (RWOS_DISPATCHER, UINT sleep_duration); + +RW_EXPORT bool rwos_dispatcher_wakeup (RWOS_DISPATCHER); + +/* critical section functions */ +RW_EXPORT bool rwos_critical_section_create (RWOS_CRITICAL_SECTION* p_critical_section); + +RW_EXPORT void rwos_critical_section_destroy (RWOS_CRITICAL_SECTION* p_critical_section); + +RW_EXPORT bool rwos_critical_section_enter (RWOS_CRITICAL_SECTION* p_critical_section); + +RW_EXPORT bool rwos_critical_section_leave (RWOS_CRITICAL_SECTION* p_critical_section); + +/* mutex functions */ +RW_EXPORT RWOS_MUTEX rwos_mutex_create (const char* p_name); + +RW_EXPORT void rwos_mutex_destroy (RWOS_MUTEX mutex); + +RW_EXPORT bool rwos_mutex_acquire (RWOS_MUTEX mutex, UINT max_wait_time); + +RW_EXPORT bool rwos_mutex_release (RWOS_MUTEX mutex); + +RW_EXPORT RWOS_MUTEX rwos_get_global_mutex (void); + +/* dispatch queue functions */ +RW_EXPORT RWOS_DISPATCH_QUEUE rwos_dispatch_queue_create (RWOS_DISPATCHER_PRIORITY priority); + +RW_EXPORT bool rwos_dispatch_queue_register_user (RWOS_DISPATCH_QUEUE, void* p_user); + +RW_EXPORT bool rwos_dispatch_queue_register_item_handler (RWOS_DISPATCH_QUEUE, FPTR_DISPATCH_QUEUE_ITEM_HANDLER); + +RW_EXPORT bool rwos_dispatch_queue_register_idle_timer_handler (RWOS_DISPATCH_QUEUE, FPTR_DISPATCHER_HANDLER p_idle_timer_handler); + +RW_EXPORT bool rwos_dispatcher_set_sleep_duration (RWOS_DISPATCH_QUEUE, UINT sleep_duration); + +RW_EXPORT bool rwos_dispatcher_wakeup (RWOS_DISPATCH_QUEUE); + +RW_EXPORT bool rwos_dispatch_queue_add_item (RWOS_DISPATCH_QUEUE, RW_CONTAINER_ITEM* p_item); + +RW_EXPORT void rwos_dispatch_queue_destroy (RWOS_DISPATCH_QUEUE); + +RW_EXPORT void rwosShowVersion (void); + + +#endif /* __RWDISPATCHER_H__ */ diff --git a/h/wrn/rwos/rwmemory.h b/h/wrn/rwos/rwmemory.h new file mode 100644 index 0000000..ece753c --- /dev/null +++ b/h/wrn/rwos/rwmemory.h @@ -0,0 +1,57 @@ +/* Copyright 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02 May0902,ark Added in fix for SPR 70535 +01 Aug1301,aos Added new RWOS heap manager interface functions +*/ + + + +/* + * $Log:: /Tornado/target/h/NB/rwos/rwmemory.h $ + * + * 1 2/09/00 4:44p Admin + * + * 1 8/27/99 1:00p Alex + * + * 1 5/20/99 11:46a Alex + * + * 1 4/14/99 5:10p Rajive + * Initial vesrion of Next Gen RouterWare Source code + * + * 1 1/18/99 5:10p Mahesh + * + * 1 1/18/99 4:25p Mahesh + * + * 2 11/13/98 9:20p Mahesh + * + * 1 11/13/98 9:14p Mahesh + * initial check in + * + */ +/************************************************************************/ +/* Copyright (C) 1998 RouterWare, Inc. */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Blvd. Suite 212, Newport Beach, CA */ +/************************************************************************/ +#if !defined (__RWMEMORY_H__) +#define __RWMEMORY_H__ + +/* memory management functions */ +RW_EXPORT UINT rw_memory_initialize (UINT memSize); + +RW_EXPORT UINT rw_memory_delete (void); + +RW_EXPORT void* rw_memory_allocate (UINT size_of_object); + +RW_EXPORT void rw_memory_free (void* p_object); + +RW_EXPORT void* rw_memory_calloc (UINT elemNum, UINT elemSize); +#endif /* __RWMEMORY_H__ */ + diff --git a/h/wrn/rwos/rwpacket.h b/h/wrn/rwos/rwpacket.h new file mode 100644 index 0000000..09c8e0d --- /dev/null +++ b/h/wrn/rwos/rwpacket.h @@ -0,0 +1,81 @@ +/* +modification history +-------------------- +02a,20Sep02 rks(teamf1): added rw_packet_get_ipsec_reserved_size. +01 May0902,ark Added in fix for SPR 70535 +*/ +/************************************************************************/ +/* Copyright (C) 1999 RouterWare, Inc. */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Blvd. Suite 212, Newport Beach, CA */ +/************************************************************************/ +#if !defined (__RW_PACKET_INTERFACE_H__) +#define __RW_PACKET_INTERFACE_H__ + +typedef UINT RW_PACKET_HANDLE; +typedef UINT RW_PACKET_MBUF_HANDLE; + +RW_PACKET_HANDLE rw_packet_create (UINT buffer_size, UINT reserved_header_size); + +bool rw_packet_destroy (RW_PACKET_HANDLE); + +BYTE* rw_packet_get_writable_header (RW_PACKET_HANDLE, UINT header_size); +BYTE* rw_packet_get_writable_trailer (RW_PACKET_HANDLE, UINT trailer_size); + +bool rw_packet_extend_data_front (RW_PACKET_HANDLE, UINT extension); +bool rw_packet_reduce_data_front (RW_PACKET_HANDLE, UINT reduction); + +bool rw_packet_extend_data_back (RW_PACKET_HANDLE, UINT extension); +bool rw_packet_reduce_data_back (RW_PACKET_HANDLE, UINT reduction); + +BYTE* rw_packet_get_data (RW_PACKET_HANDLE); +UINT rw_packet_get_data_size (RW_PACKET_HANDLE); +UINT rw_packet_get_buffer_size (RW_PACKET_HANDLE); +UINT rw_packet_get_max_writable_header_size (RW_PACKET_HANDLE packet); + +bool rw_packet_clone (RW_PACKET_HANDLE* p_new_packet_handle, RW_PACKET_HANDLE original_packet_handle); + +bool rw_packet_is_built_from_mbuf (RW_PACKET_HANDLE packet); + +/*******************************************************************************/ +/* MBUF Methods */ +/*******************************************************************************/ +RW_PACKET_HANDLE rw_packet_create_from_mbuf(RW_PACKET_MBUF_HANDLE mbuf_handle ); +RW_PACKET_MBUF_HANDLE rw_packet_extract_mbuf_and_destroy_packet(RW_PACKET_HANDLE packet); +UINT rw_packet_get_ipsec_reserved_size(); +/*******************************************************************************/ +/* Serialize Methods */ +/*******************************************************************************/ + +void rw_packet_serialize_byte_at_front (BYTE source, RW_PACKET_HANDLE packet); +void rw_packet_serialize_ushort_at_front(USHORT source, RW_PACKET_HANDLE packet); +void rw_packet_serialize_ulong_at_front (ULONG source, RW_PACKET_HANDLE packet); + +void rw_packet_serialize_uint_at_front (UINT source, UINT size_of_var, RW_PACKET_HANDLE packet); +void rw_packet_serialize_uint_at_back (UINT source, UINT size_of_var, RW_PACKET_HANDLE packet); + +void rw_packet_serialize_byte_at_back (BYTE source, RW_PACKET_HANDLE packet); +void rw_packet_serialize_ushort_at_back (USHORT source, RW_PACKET_HANDLE packet); +void rw_packet_serialize_ulong_at_back (ULONG source, RW_PACKET_HANDLE packet); +void rw_packet_serialize_bit_field (UINT size, RW_PACKET_HANDLE packet, ... ); + +/*******************************************************************************/ +/* Deserialize Methods */ +/*******************************************************************************/ +BYTE rw_packet_deserialize_byte_at_front (RW_PACKET_HANDLE packet); +USHORT rw_packet_deserialize_ushort_at_front (RW_PACKET_HANDLE packet); +ULONG rw_packet_deserialize_ulong_at_front (RW_PACKET_HANDLE packet); + +UINT rw_packet_deserialize_uint_at_front (UINT size_of_var, RW_PACKET_HANDLE packet); +UINT rw_packet_deserialize_uint_at_back (UINT size_of_var, RW_PACKET_HANDLE packet); + +BYTE rw_packet_deserialize_byte_at_back (RW_PACKET_HANDLE packet); +USHORT rw_packet_deserialize_ushort_at_back (RW_PACKET_HANDLE packet); +ULONG rw_packet_deserialize_ulong_at_back (RW_PACKET_HANDLE packet); +void rw_packet_deserialize_bit_field (UINT size, RW_PACKET_HANDLE packet, ...); + +#endif /* __RW_PACKET_INTERFACE_H__ */ diff --git a/h/wrn/rwos/system.h b/h/wrn/rwos/system.h new file mode 100644 index 0000000..5b043d6 --- /dev/null +++ b/h/wrn/rwos/system.h @@ -0,0 +1,120 @@ +/* +modification history +-------------------- +01c,07may02,kc Added TMS-specific modification - change RWOS_MAXIMUM_FILE_SIZE to 512. +01b,06mar02,kc Fixed incorrect TRACE macro defines. +01a,09may02,ark Added in fix for SPR 70535 +*/ +#if !defined (_SYSTEM_H_) +#define _SYSTEM_H_ + +/*#if !defined (__VxWORKS__) + +#error VxWorks OS is not defined + +#endif +*/ + +/****************************************************************************/ +/* System types */ +/****************************************************************************/ +typedef int RWOS_TASK_ARG_TYPE_HANDLE; + +/****************************************************************************/ +/* Global variables */ +/****************************************************************************/ +UINT rwos_task_reference_counter; + + +/****************************************************************************/ +/* System constants */ +/****************************************************************************/ +#define RWOS_PRIORITY_SAFE_QUEUING_MODE SEM_Q_PRIORITY | SEM_INVERSION_SAFE | SEM_DELETE_SAFE +#define RWOS_FIFO_SAFE_QUEUING_MODE SEM_Q_FIFO | SEM_DELETE_SAFE +#define RWOS_MUTEX_SEMAPHORE RWOS_PRIORITY_SAFE_QUEUING_MODE +#define VXWORKS_MAXIMUM_TASK_ARGS 0xA +#define RWOS_TASK_BASE_PRIORITY 0x64 +#define RWOS_TASK_DEBUG_OPTIONS VX_PRIVATE_ENV +#define RWOS_TASK_NODEBUG_OPTIONS VX_PRIVATE_ENV | VX_UNBREAKABLE +#define RWOS_TASK_STACK_SIZE 0x7D0 /*2K*/ +#define RWOS_MAXIMUM_STRING_SIZE 0x32 +#define RWOS_TASK_CLOCK_RATE 0x12 +#define RWOS_RUNNING_TASK 0x1 +#define RWOS_TASK_NAME "tRWOS" +#define RWOS_TASK_DELAY 0xA +#define RWOS_TASK_TIMEOUT 0x5 /*timeout in ticks */ +#define RWOS_ACTIVE_TASK_ID 0x00 +#define RWOS_RAMDRIVE_ADDRESS 0 +#define RWOS_RAMDRIVE_BYTES_PER_BLOCK 512 +#define RWOS_RAMDRIVE_BLOCK_PER_TRACK 400 +#define RWOS_RAMDRIVE_NUMBER_OF_BLOCKS 400 +#define RWOS_RAMDRIVE_BLOCK_OFFSET 0 +#define RWOS_RAMDRIVE_VOLUME_NAME "DEV1:" +#define RWOS_CONFIGURATION_FILE_NAME "config" +#ifdef INCLUDE_TMS_MODS +#define RWOS_MAXIMUM_FILE_SIZE 512 +#else +#define RWOS_MAXIMUM_FILE_SIZE 4000 +#endif /* INCLUDE_TMS_MODS */ +#define MILLISECONDS 1000 + +#if defined (__VxDEBUG__) + #define RWOS_TASK_OPTIONS RWOS_TASK_DEBUG_OPTIONS + + #define TRACE printf + + #define LOG logMsg + +#else + #define RWOS_TASK_OPTIONS RWOS_TASK_NODEBUG_OPTIONS + + #define TRACE + + #define LOG + +#endif /*__VxDEBUG__*/ + + +/****************************************************************************/ +/* RwOS Task variables */ +/****************************************************************************/ +void* p_rwos_intance_handle; + +/****************************************************************************/ +/* RwOS Package function */ +/****************************************************************************/ +typedef void (*FP_RWOS_MODULE_STARTUP) (const char*p_configuration_file); + + +/****************************************************************************/ +/* Package Template Entry function */ +/* */ +/****************************************************************************/ +int rwos_xxxxx_package_entry_template (const char* p_configuratioin_file, const char* p_ftp_server_address, const char* p_directory, const char* p_user, const char* p_password); + +void rwos_xxxxx_package_exit (void); + +int rwos_ike_package_entry (const char* p_configuration_file, const char* p_ftp_server_address, const char* p_directory, const char* p_user, const char* p_password); +/****************************************************************************/ +/* System functions */ +/****************************************************************************/ +int create_system_task (const char* p_task_name, void* p_task_entry_point, UINT task_priority, UINT task_stack_size /*=2k*/,...); + +HOST_OS_MUTEX_HANDLE system_create_mutex_semaphore (const char *p_mutex_name); +bool system_destroy_mutex_semaphore (HOST_OS_MUTEX_HANDLE mutex_semaphore_handle); +bool system_acquire_mutex_semaphore (HOST_OS_MUTEX_HANDLE mutex_semaphore_handle, UINT timeout); +bool system_release_mutex_semaphore (HOST_OS_MUTEX_HANDLE mutex_semaphore_handle); +bool system_event_set (HOST_OS_EVENT_HANDLE event_handle); +bool system_event_reset (HOST_OS_EVENT_HANDLE event_handle); +HOST_OS_EVENT_HANDLE system_event_create (void); +void system_event_destroy (HOST_OS_EVENT_HANDLE event); + + +/****************************************************************************/ +/* RwOS Entry point */ +/****************************************************************************/ +UINT rwos_main (FP_RWOS_MODULE_STARTUP system_module_table[], const char* p_configuration_file_contents ); +UINT rwos_task_main (FP_RWOS_MODULE_STARTUP system_module_table[], const char* p_configuration_file_contents, char* p_task_name, UINT task_priority ); + +#endif /*_SYSTEM_H_*/ + diff --git a/h/wrn/rwos_driver_manager_if.h b/h/wrn/rwos_driver_manager_if.h new file mode 100644 index 0000000..53b3eec --- /dev/null +++ b/h/wrn/rwos_driver_manager_if.h @@ -0,0 +1,41 @@ +/************************************************************************/ +/* Copyright (C) 1999 RouterWare, Inc. */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Blvd. Suite 212, Newport Beach, CA */ +/* ************************************************************************************************************************ */ +#if !defined (_RWOS_DRIVER_MANAGER_IF_H_) +#define _RWOS_DRIVER_MANAGER_IF_H_ +/* ************************************************************************************************************************ */ +/*typedef UINT DRIVER_MANAGER_HANDLE;*/ +/* ************************************************************************************************************************ */ + + +typedef struct RWOS_DRIVER_MANAGER_CALLBACK_IF +{ + /* Lower layer callback methods */ + /* return : */ + /* true = Continue processing receive indicate events. */ + /* false = All receive indicate events are process. */ + bool (*fp_process_driver_manager_receive_indicate_event) ( + struct RWOS_DRIVER_MANAGER_CALLBACK_IF* p_rwos_driver_manager_callback_if); + +}RWOS_DRIVER_MANAGER_CALLBACK_IF; + +/* ************************************************************************************************************************ */ +/* Rwos driver interface */ +bool rwos_register_driver_manager (DRIVER_MANAGER_HANDLE driver_manager_instance, + struct RWOS_DRIVER_MANAGER_CALLBACK_IF *p_driver_callback_if ); +bool rwos_deregister_driver_manager (DRIVER_MANAGER_HANDLE driver_manager_instance, + struct RWOS_DRIVER_MANAGER_CALLBACK_IF *p_driver_callback_if); +/* ************************************************************************************************************************ */ +/* Rwos driver event methods */ +/* return : */ +/* true = Rwos receive indicate event was set. */ +/* false = Rwos failed to set the receive indicate event */ +bool rwos_signal_driver_manager_receive_indicate_event (RWOS_DRIVER_MANAGER_CALLBACK_IF*); +/* ************************************************************************************************************************ */ +#endif /*_RWOS_LOWER_LAYER_IF_H_*/ diff --git a/h/wrn/rwos_lower_layer_if.h b/h/wrn/rwos_lower_layer_if.h new file mode 100644 index 0000000..80524cc --- /dev/null +++ b/h/wrn/rwos_lower_layer_if.h @@ -0,0 +1,47 @@ +/************************************************************************/ +/* Copyright (C) 1999 RouterWare, Inc. */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Blvd. Suite 212, Newport Beach, CA */ +/************************************************************************/ +#if !defined (_RWOS_LOWER_LAYER_IF_H_) +#define _RWOS_LOWER_LAYER_IF_H_ + +typedef UINT DRIVER_INSTANCE_HANDLE; + +/*****************************************************************/ +/* Lower layer callback methods */ +/*****************************************************************/ +typedef struct RWOS_LOWER_LAYER_CALLBACK_IF +{ + /*************************************************************/ + /* return */ + /* true = Continue processing receive indicate events. */ + /* false = All receive indicate events are process. */ + /*************************************************************/ + bool (*fp_process_driver_receive_indicate_event) (void); + +}RWOS_LOWER_LAYER_CALLBACK_IF; + +/*****************************************************************/ +/* Rwos driver interface */ +/*****************************************************************/ +bool rwos_register_driver (DRIVER_INSTANCE_HANDLE driver_instance, struct RWOS_LOWER_LAYER_CALLBACK_IF *p_driver_callback_if ); +bool rwos_deregister_driver (DRIVER_INSTANCE_HANDLE driver_instance, struct RWOS_LOWER_LAYER_CALLBACK_IF *p_driver_callback_if); + +/*****************************************************************/ +/* Rwos driver event methods */ +/*****************************************************************/ + +/*****************************************************************/ +/* return */ +/* true = Rwos receive indicate event was set. */ +/* false = Rwos failed to set the receive indicate event */ +/*****************************************************************/ +bool rwos_signal_driver_receive_indicate_event (void); + + +#endif /*_RWOS_LOWER_LAYER_IF_H_*/ \ No newline at end of file diff --git a/h/wrn/rwproto.h b/h/wrn/rwproto.h new file mode 100644 index 0000000..83463f7 --- /dev/null +++ b/h/wrn/rwproto.h @@ -0,0 +1,212 @@ +/* + * $Log:: /Tornado/target/h/NB/rwproto.h $ + * + * 1 2/09/00 4:42p Admin + * + * 2 8/26/99 7:42p Alex + * + * 1 8/25/99 7:01p Alex + * + * 1 5/26/99 9:53a Alex + * + * 2 4/21/99 12:04p Rajive + * Added prototype for closing udp + * + * 1 4/14/99 5:09p Rajive + * Initial vesrion of Next Gen RouterWare Source code + * + * 3 1/22/99 7:31p Mahesh + * Added function prototype for new function to set the close event. + * + * 2 1/21/99 10:38p Mahesh + * Changes for the unified RWOS interface. + * + * 1 1/18/99 5:10p Mahesh + * + * 1 1/18/99 4:24p Mahesh + * + * 24 1/06/99 2:57p Nishit + * Added prototypes for BOOTP Client and Relay Agent, DHCP Client and Server, TFTP Client, and Telnet Server + * + * 23 12/23/98 3:39p Nishit + * Since PPPOE init function name changed... + * + * 22 12/02/98 7:54p Jack + * Added __WINROUTER__ ifdef in the enum LSL_CONTROL_OPERATION around LSL_ROUTERWARE_CONTROL - potential bug identified while + * testing TCP on big_endian + * + * 21 12/01/98 11:43a Rajive + * Uncommented the prototypes for OPEN_VIRTUAL_PORT, CLOSE_VIRTUAL_PORT, REINITIALIZE_VIRTUAL_PORT and UNINITIALIZE_VIRTUAL_PORT + * + * 20 11/30/98 4:03p Nishit + * Added prototypes for init and close for PPPoE and RADIUS + * + * 19 11/24/98 12:46p Nishit + * Added support for NAT + * + * 18 11/20/98 11:37a Nishit + * Added init and shutdown prototypes for single build + * + * 17 11/18/98 5:53p Rajive + * Fixed syntax error + * + * 16 11/18/98 5:50p Rajive + * Added and delted new enums from the enum PROTOCOL_CONTROL_OPERATION. + * + * 15 11/06/98 6:19p Nishit + * Added prototypes for RTM, L2TP, Socket... initialize + * + * 14 10/30/98 10:06a Alex + * New prototype declaration for the initialization of the internal network. + * + * 13 9/11/98 10:11a Nishit + * Added SET_IP_ADDRESS_AND_MASK_FOR_PORT in enum PROTOCOL_CONTROL_OPERATION + * + * 12 9/03/98 4:11p Nishit + * Added VPN Interface Virtual Protocol Stack + * + * 11 8/01/98 6:48p Ross + * Added PPP_OVER_ETHERNET protocol stack type. + * + * 10 7/05/98 4:12p Ross + * Had to add __KERNEL__ in dll function if defined...a must to build the .vxd's + * + * 9 6/01/98 10:55a Nishit + * Added values for PAC + * + * 8 5/14/98 1:56p Nishit + * Added PPTP_GRE_V2_TRANSPORT in enum TRANSPORT_TYPE and PPTP_TUNNEL_CONTROL in enum APPLICATION_TYPE - for PNS + * + * 7 4/30/98 1:16p Rajive + * Overwrote with INCLUDE v4.2.1 + * + * 3 4/27/98 11:42a Release Engineer + * Additions into include for L2TP and RTM modules. + * INCLUDE v4.2.1 + * + * 1 2/13/98 12:18a Release Engineer + * code cleanup, code style changes, linted, system level test + * INCLUDE v4.2.0 + * + * 6 9/25/96 7:01p Ross + * Added transport control changes + * + * 5 9/09/96 5:10p Ross + * Changes for spanning tree and token ring + * + * 4 5/21/96 7:32p Ross + * Fixes for token ring header files + * + * 3 4/11/96 6:44p Ross + * SNMP changes. + * + * 2 3/27/96 7:08p Ross + * Initial check-in with source safe. +*/ +/* $Modname: lslproto.h$ $version: 1.5$ $date: 02/02/94$ */ +/* +* $lgb$ +1.0 10/11/93 ross adding version control. +1.1 10/11/93 ross added some prototypes. +1.2 10/18/93 ross added lsl frame type and ip header. +1.3 12/03/93 ross fixes for lsl version 3.0 +1.4 01/08/94 ross More LSL version 3 changes +1.5 02/02/94 ross +* $lge$ +*/ +/************************************************************************/ +/* Copyright (C) 1989 - 1998 RouterWare, Inc */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Blvd. Suite 212, Newport Beach Ca */ +/************************************************************************/ +#ifndef _LSLPROTO_H_ +#define _LSLPROTO_H_ + +#define ILLEGAL_DEVICE_ID 0xffffffffL + +#define VIRTUAL_PORT_TYPE (USHORT) 0x8000 + +#if !defined (LINK_TYPEDEF_DEFINED) + + #define LINK_TYPEDEF_DEFINED + +typedef struct LINK +{ + struct LINK *sptr_forward_link; + struct LINK *sptr_backward_link; +} LINK; + +typedef struct SINGLE_LINK +{ + struct SINGLE_LINK *sptr_forward_link; +} SINGLE_LINK; + +#endif + +enum LINKED_LIST_COMPARISON_RESULT +{ + LESS_THAN_CURRENT_ELEMENT, + GREATER_THAN_CURRENT_ELEMENT, + SAME_AS_CURRENT_ELEMENT, + ERROR_IN_COMPARISON +}; + +typedef struct LINKED_LIST_INDEX +{ + USHORT offset; + USHORT size; + BOOLEAN _swap; +} LINKED_LIST_INDEX; + +typedef struct LINKED_LIST_SORT_PARAMETERS +{ + LINK *sptr_list; + LINK *sptr_entry_to_add; + + LINKED_LIST_INDEX index[5]; + +} LINKED_LIST_SORT_PARAMETERS; + + + +typedef struct LSL_MESSAGE_LINK +{ + struct LSL_MESSAGE_LINK *sptr_forward_link; + struct LSL_MESSAGE_LINK *sptr_backward_link; +} LSL_MESSAGE_LINK; + + +enum SNMP_BOOLEAN +{ + SNMP_BOOLEAN_ENABLED = 0x01, + SNMP_BOOLEAN_DISABLED = 0x02 +}; + +enum SORT_RETURN +{ + LESS_THAN = -1, + EQUAL_TO = 0, + GREATER_THAN = 1 +}; + + + +#if !defined (__MIB_OPERATION_DEFINED__) + #define __MIB_OPERATION_DEFINED__ + + enum MIB_OPERATION + { + GET_OPERATION, + GET_NEXT_OPERATION, + SET_OPERATION, + VERIFY_OPERATION + }; +#endif + + + +#endif /* _LSLPROTO_H_ */ diff --git a/h/wrn/rwutils.h b/h/wrn/rwutils.h new file mode 100644 index 0000000..604ab96 --- /dev/null +++ b/h/wrn/rwutils.h @@ -0,0 +1,197 @@ +/* + * $Log:: /Tornado/target/h/wrn/rwutils.h $ + * + * 6 9/20/00 4:31p Rob + * Created stristr (case-insensitive sub-string compare) function. + * Removed prototype for non-existent x86_normalize function. + * + * 3 3/23/00 6:06p Rob + * Now uses Tornado _BYTE_ORDER predefined macro for endian-specific code. + * + * 2 3/13/00 7:55p Rob + * Now defines big-endian empty macros for swap, swap_long, etc. + * Now declares strlwr() always (no longer dependant on __VxWORKS__). + * + * 1 2/09/00 4:42p Admin + * + * 2 8/26/99 7:42p Alex + * + * 1 8/25/99 7:01p Alex + * + * 1 5/26/99 9:53a Alex + * + * 1 4/14/99 5:10p Rajive + * Initial vesrion of Next Gen RouterWare Source code + * + * 1 1/18/99 5:10p Mahesh + * + * 1 1/18/99 4:24p Mahesh + * + * 11 12/28/98 9:03a Nishit + * Removed functions (de)serialize_ulong/short + * + * 10 12/15/98 6:04p Mahesh + * Added prototypes/definitions for new serialize/deserialize byte functions. + * + * 9 12/03/98 6:35p Rajive + * Changed __SNMP__ to __SNMP_FWD_DECL__ + * + * 7 4/30/98 1:16p Rajive + * Overwrote with INCLUDE v4.2.1 + * + * 3 4/27/98 11:42a Release Engineer + * Additions into include for L2TP and RTM modules. + * INCLUDE v4.2.1 + * + * 1 2/13/98 12:18a Release Engineer + * code cleanup, code style changes, linted, system level test + * INCLUDE v4.2.0 + * + * 2 3/27/96 7:08p Ross + * Initial check-in with source safe. +*/ +/************************************************************************/ +/* Copyright (C) 1989 - 1998 RouterWare, Inc */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Blvd. Suite 212, Newport Beach Ca */ +/************************************************************************/ +#ifndef _ROUTILS_H_ +#define _ROUTILS_H_ + +#define USE_RWOS_MESSAGE_DIGEST + +#ifdef USE_RWOS_MESSAGE_DIGEST +enum MD_ALGORITHM +{ + MD4 = 0x04, + MD5 = 0x05 +}; +#endif + +/* convutls.c */ + +#if (_BYTE_ORDER == _LITTLE_ENDIAN) + USHORT host_to_net_short (USHORT host_order_short_value); + USHORT net_to_host_short (USHORT net_order_short_value); + ULONG host_to_net_long (ULONG host_order_long_value); + ULONG net_to_host_long (ULONG net_order_long_value); + USHORT swap (USHORT ushort_to_swap_bytes_with); + ULONG swap_long (ULONG ulong_to_swap_bytes_with); +#else + #define BIG_ENDIAN_CONSTANT(ushort) ushort + #define host_to_net_short(a) (a) + #define net_to_host_short(a) (a) + #define host_to_net_long(a) (a) + #define net_to_host_long(a) (a) + #define swap(a) (a) + #define swap_long(a) (a) +#endif + +/* miscutls.c */ + +enum SORT_RETURN compare_mac_addresses (void *sptr_address_1,void *sptr_address_2); + +char *convert_ip_address_to_dot_format (char *cptr_array_to_store_dot_format_address, ULONG ip_address); + +char *strlwr (char *cptr_string_to_lower_case); + +char *stristr (char *str, char *find); + +/* listutls.c */ + +void add_entry_to_list (LINK *sptr_link, LINK *sptr_link_to_add); +void *get_entry_from_list (LINK *sptr_link); +void delete_entry_from_list (LINK *sptr_list_link, LINK *sptr_link_to_delete); +void add_entry_to_front_of_list (LINK *sptr_link, LINK *sptr_link_to_add); +void insert_entry_in_list (LINK *sptr_link, LINK *sptr_link_to_add, LINK *sptr_link_after_which_to_add); +void *get_pointer_to_first_entry_in_list (LINK *sptr_link); +void *get_pointer_to_next_entry_in_list (LINK *sptr_current_entry); +void *get_pointer_to_last_entry_in_list (LINK *sptr_link); +void *get_pointer_to_previous_entry_in_list (LINK *sptr_current_entry); +void free_list (LINK *sptr_list, void (*fptr_free) (void *vptr_data_to_free)); +void *get_entry_from_list_using_index (LINK *sptr_list,USHORT element_index_to_find); +/* + * The following functions have not been implemented yet + * + * void *get_last_entry_from_list (LINK *sptr_link); + * + * void add_entry_to_single_list (LINK *sptr_link,SINGLE_LINK *sptr_link_to_add); + * void add_entry_to_front_of_single_list (LINK *sptr_link,SINGLE_LINK *sptr_link_to_add); + * void *get_entry_from_single_list (LINK *sptr_link); + * void delete_entry_from_single_list (LINK *sptr_list_link,SINGLE_LINK *sptr_link_to_delete); + * void *get_last_entry_from_single_list (LINK *sptr_link); + */ + + +/* sortlist.c */ + +enum TEST add_entry_to_sorted_linked_list (LINKED_LIST_SORT_PARAMETERS *sptr_linked_list_sort_parameters); + +/* snmpglbl.c */ +#if defined (__SNMP_FWD_DECL__) + enum TEST process_mib_variable (enum MIB_OPERATION mib_operation, char *cptr_mib_string, + BYTE *bptr_variable_value, USHORT *usptr_size_of_variable_value, USHORT *usptr_size_of_table_indices, + ULONG *ulptr_table_indices, BOOLEAN *eptr_end_of_table, char **ptr_to_cptr_next_variable_name, + SNMP_TABLE_ENTRY *sptr_first_table_entry); +#else + enum TEST process_mib_variable (enum MIB_OPERATION mib_operation, char *cptr_mib_string, + BYTE *bptr_variable_value, USHORT *usptr_size_of_variable_value, USHORT *usptr_size_of_table_indices, + ULONG *ulptr_table_indices, BOOLEAN *eptr_end_of_table, char **ptr_to_cptr_next_variable_name, + void *sptr_first_table_entry); +#endif + +/* accesnmp.c */ + +enum TEST snmp_get_or_set_ulong (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset, ULONG _class, ULONG size, + void *vptr_mib_value_obtained, USHORT *usptr_length_of_mib_obtained); +enum TEST snmp_get_or_set_ushort (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset, ULONG _class, ULONG size, + void *vptr_mib_value_obtained, USHORT *usptr_length_of_mib_obtained); +enum TEST snmp_get_or_set_boolean_plus_one (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset, ULONG _class, + ULONG size, void *vptr_mib_value_obtained, USHORT *usptr_length_of_mib_obtained); +enum TEST snmp_get_or_set_byte (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset, ULONG _class, ULONG size, + void *vptr_mib_value_obtained, USHORT *usptr_length_of_mib_obtained); +enum TEST snmp_get_or_set_string (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset, ULONG _class, ULONG size, + void *vptr_mib_value_obtained, USHORT *usptr_length_of_mib_obtained); +enum TEST snmp_get_or_set_mac_address (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset, ULONG _class, + ULONG size, void *vptr_mib_value_obtained, USHORT *usptr_length_of_mib_obtained); +enum TEST snmp_get_or_set_8_byte_object (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset, ULONG _class, + ULONG size, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained); +enum TEST snmp_get_or_set_2_byte_object (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset, ULONG _class, + ULONG size, void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained); +enum TEST snmp_get_port_number (USHORT port_number, enum MIB_OPERATION mib_operation, ULONG offset, ULONG _class, ULONG size, + void *vptr_mib_value, USHORT *usptr_length_of_mib_obtained); + +/* snmpncfg.c */ + +void *get_mib_access_function (enum TEST (*fptr_mib_access_function) (USHORT port_number, enum MIB_OPERATION mib_operation, + ULONG offset_into_class, ULONG class_address, ULONG size_of_port_class, void *vptr_mib_value, + USHORT *usptr_length_of_mib_obtained)); + +/* serialization_utilities.c */ + +UINT deserialize_byte_contents (BYTE **ptr_to_bptr_location); +UINT deserialize_ushort_contents (USHORT **ptr_to_usptr_location); +ULONG deserialize_ulong_contents (ULONG **ptr_to_ulptr_location); + +void deserialize_bit_field (UINT size, UINT *uiptr_start, ...); +void deserialize_short_bit_field (UINT size, USHORT *usptr_start, ...); + +void serialize_byte_contents (UINT source, BYTE **ptr_to_bptr_destination); +void serialize_ushort_contents (UINT source, USHORT **ptr_to_usptr_destination); +void serialize_ulong_contents (ULONG source, ULONG **ptr_to_ulptr_destination); + +enum TEST serialize_long_bit_field (UINT size, ULONG *ulptr_destination, ...); +enum TEST serialize_short_bit_field (UINT size, USHORT *usptr_destination, ...); +enum TEST serialize_byte_bit_field (UINT size, BYTE *bptr_destination, ...); + +/* message_digest.c */ + +#ifdef USE_RWOS_MESSAGE_DIGEST +void MD_string (BYTE *cptr_string, ULONG length, BYTE *bptr_digest, enum MD_ALGORITHM md_algorithm); +#endif + +#endif /* _ROUTILS_H_ */ diff --git a/h/wrn/sadb/sadb.h b/h/wrn/sadb/sadb.h new file mode 100644 index 0000000..a0850cb --- /dev/null +++ b/h/wrn/sadb/sadb.h @@ -0,0 +1,90 @@ +/* sadb.h - API routines for Security Association Database */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,26apr05,rlm Creation. +*/ + +#ifndef __SADB_H +#define __SADB_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + + +/* +DESCRIPTION +This file contains API routines for accessing the security association +database (SADB) + +INCLUDE FILES: +*/ + +/* includes */ + +/* defines */ + +/* typedefs */ + +/* public functions */ + +void sadbMsgCClientInit + ( + void + ); + +int sadbDebug + ( + char *p_action /* configuration string */ + ); + +STATUS sadbDump + ( + void + ); + +int sadbMon + ( + char *p_action /* configuration string */ + ); + +STATUS sadbShow + ( + void + ); + +STATUS sadbShowSA + ( + char *pConfStr /* configuration string */ + ); + +STATUS sadbPSKeepAlive + ( + char *pConfStr /* configuration string */ + ); + +void sadbPSSetGlobalKeepAlive + ( + BOOL keep_alive /* TRUE to enable, FALSE to disable */ + ); + +BOOL sadbPSGetGlobalKeepAlive + ( + void + ); + +STATUS sadbPSGlobalKeepAlive + ( + char *p_action /* "enable", "disable", or "status" */ + ); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif /* __cplusplus */ + +#endif /* __SADB_H */ + diff --git a/h/wrn/sadb/sadbInit.h b/h/wrn/sadb/sadbInit.h new file mode 100644 index 0000000..f34d7de --- /dev/null +++ b/h/wrn/sadb/sadbInit.h @@ -0,0 +1,47 @@ +/* sadbInit.h - header file for sadb_init.c */ +/* Copyright 2000-2005 Wind River Systems, Inc. */ +/************************************************************************/ + +#if !defined (__SADB_INIT_H__) +#define __SADB_INIT_H__ + +#ifdef __cplusplus +extern "C"{ +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) + #pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* sadb configuration parameters */ + +typedef struct sadbcfgparams + { + unsigned int task_priority; + } SADB_CFG_PARAMS; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) + #pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +#ifndef SADB_TASK_PRIORITY + #define SADB_TASK_PRIORITY 100 +#endif /* SADB_TASK_PRIORITY */ + +/* function declarations */ +extern STATUS sadbInit + ( + char * sadbCfg, + unsigned int task_priority + ); + +STATUS usrSadbInit + ( + void + ); + +#ifdef __cplusplus +} +#endif + +#endif /* __SADB_INIT_H__ */ diff --git a/h/wrn/spd/spd.h b/h/wrn/spd/spd.h new file mode 100644 index 0000000..c11f38f --- /dev/null +++ b/h/wrn/spd/spd.h @@ -0,0 +1,143 @@ +/* spd.h - API routines for IPsec Security Policy Database */ + +/* Copyright 2005 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,26apr05,rlm Creation. +*/ + +#ifndef __SPD_H +#define __SPD_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + + +/* +DESCRIPTION + +INCLUDE FILES: +*/ + +/* includes */ + +/* defines */ + +/* typedefs */ + +/* public functions */ + +STATUS spdSetAHXform + ( + char *pConfStr /* configuration string */ + ); + +STATUS spdSetDefault + ( + char *pConfStr + ); + +STATUS spdSetESPXform + ( + char *pConfStr /* parameter string */ + ); + +STATUS spdSetProp + ( + char *pConfStr /* parameter string */ + ); + +STATUS spdClrProp + ( + char *pConfStr /* parameter string */ + ); + +STATUS spdSetPropAttrib + ( + char *pConfStr + ); + +STATUS spdSetSA + ( + char *pConfStr /* parameter string */ + ); + +STATUS spdAddTunnel + ( + char *pConfStr /* parameter string */ + ); + +STATUS spdAddBypass + ( + char *pConfStr /* parameter string */ + ); + +STATUS spdAddDiscard + ( + char *pConfStr /* parameter string */ + ); + +STATUS spdDeletePolicy + ( + char *pConfStr /* parameter string */ + ); + +STATUS spdAddTransport + ( + char *pConfStr /* parameter string */ + ); + +STATUS spdShowAHXform + ( + char *pConfStr /* parameter string */ + ); + +STATUS spdShowESPXform + ( + char *pConfStr /* parameter string */ + ); + +STATUS spdShowProp + ( + char *pConfStr /* parameter string */ + ); + +STATUS spdShowSA + ( + char *pConfStr /* parameter string */ + ); + +STATUS spdShowPolicy + ( + char *pConfStr /* parameter string */ + ); + +STATUS spdShow + ( + void + ); + +void spdDump + ( + void + ); + +int spdMon + ( + char *cptr_action /* parameter string */ + ); + +int spdDebug + ( + char *cptr_action /* parameter string */ + ); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif /* __cplusplus */ + +#endif /* __SPD_H */ + diff --git a/h/wrn/spd/spdInit.h b/h/wrn/spd/spdInit.h new file mode 100644 index 0000000..b4cde54 --- /dev/null +++ b/h/wrn/spd/spdInit.h @@ -0,0 +1,49 @@ +/* spdInit.h - header file for spd_init.c */ +/************************************************************************/ +/* Copyright 2000-2005 Wind River Systems, Inc. */ +/************************************************************************/ + +/* +modification history +-------------------- +01e,06may05,rlm Added prototype for usrSpdInit(). Removed legacy K&R + prototypes. +01d,30nov04,jfb Beautified again +01c,29nov04,jfb Beautified +01b,11jun01,tkp pompeii enhancements. +01a,19jun00,aos created. + +*/ + +#if !defined (__SPD_INIT_H__) +#define __SPD_INIT_H__ + +#ifdef __cplusplus +extern "C" + { +#endif + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) + #pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) + #pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* function declarations */ +extern STATUS spdInit + ( + char *spdCfg + ); + +STATUS usrSpdInit + ( + void + ); + +#ifdef __cplusplus + } +#endif + +#endif /* __SPD_INIT_H__ */ diff --git a/h/wrn/udp_if.h b/h/wrn/udp_if.h new file mode 100644 index 0000000..885d1eb --- /dev/null +++ b/h/wrn/udp_if.h @@ -0,0 +1,51 @@ +/************************************************************************/ +/* Copyright (C) 1999 RouterWare, Inc. */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Blvd. Suite 212, Newport Beach, CA */ +/************************************************************************/ +#if !defined (__UDP_IF_H__) +#define __UDP_IF_H__ + +typedef UINT LOWER_LAYER_IF_HANDLE; + +typedef struct UDP_MESSAGE +{ + IP_ADDRESS source_address; + IP_ADDRESS destination_address; + UINT type_of_service; /*ip parameter*/ + UINT time_to_live; /*ip parameter*/ + UINT sequence_identifier; /*ip parameter*/ + UINT do_not_fragment_flag; /*ip parameter*/ + UINT source_port_number; + UINT destination_port_number; + RW_PACKET_HANDLE payload; +} UDP_MESSAGE; + + + +/****************************************************************************/ +typedef struct UDP_CALLBACK_IF +{ + bool (*fn_udp_callback_if_receive) (struct UDP_CALLBACK_IF* p_callback_if, UDP_MESSAGE* p_udp_message, LOWER_LAYER_IF_HANDLE lower_layer_if_handle); + +} UDP_CALLBACK_IF; + +/****************************************************************************/ +typedef struct UDP_IF +{ + bool (*fn_udp_if_open_port) (struct UDP_IF *p_udp_if, UDP_CALLBACK_IF *p_callback_if, UINT port_number); + + bool (*fn_udp_if_close_port) (struct UDP_IF *p_udp_if, UDP_CALLBACK_IF *p_callback_if, UINT port_number); + + bool (*fn_udp_if_send) (struct UDP_IF *p_udp_if, UDP_MESSAGE *p_udp_message, LOWER_LAYER_IF_HANDLE lower_layer_if_handle); + + bool (*fn_udp_if_send_next_hop) (struct UDP_IF *p_udp_if, UDP_MESSAGE *p_udp_message, IP_ADDRESS *p_next_hop, LOWER_LAYER_IF_HANDLE lower_layer_if_handle); + +}UDP_IF; + + +#endif /*__UDP_IF_H__*/ diff --git a/h/wrn/v8022str.h b/h/wrn/v8022str.h new file mode 100644 index 0000000..91f736b --- /dev/null +++ b/h/wrn/v8022str.h @@ -0,0 +1,313 @@ +/* + * $Log:: /Tornado/target/h/WRN/v8022str.h $ + * + * 2 3/23/00 6:06p Rob + * Now uses Tornado _BYTE_ORDER predefined macro for endian-specific code. + * + * 1 2/09/00 4:42p Admin + * + * 2 8/26/99 7:42p Alex + * + * 1 8/26/99 2:14p Alex + * + * 1 5/26/99 9:53a Alex + * + * 1 4/14/99 5:11p Rajive + * Initial vesrion of Next Gen RouterWare Source code + * + * 1 1/18/99 5:10p Mahesh + * + * 1 1/18/99 4:24p Mahesh + * + * 7 11/09/98 2:58p Rajive + * Changed SNAP_IP_RARP_PACKET to 0x8035 from 0x0835 + * + * 6 8/14/98 2:18p Nishit + * Added ETHERNET_TYPE for PPP over Ethernet + * + * 5 4/30/98 1:16p Rajive + * Overwrote with INCLUDE v4.2.1 + * + * 3 4/27/98 11:42a Release Engineer + * Additions into include for L2TP and RTM modules. + * INCLUDE v4.2.1 + * + * 1 2/13/98 12:18a Release Engineer + * code cleanup, code style changes, linted, system level test + * INCLUDE v4.2.0 + * + * 2 3/27/96 7:08p Ross + * Initial check-in with source safe. +*/ +/* $Modname: v8022str.h$ $version: 1.9$ $date: 02/02/94$ */ +/* +* $lgb$ +1.0 08/05/92 ross +1.1 08/05/92 ross +1.2 09/03/92 ross +1.3 01/17/93 ross +1.4 01/23/93 ross added CISCO snap ids. +1.5 01/31/93 ross added some more SAP types. +1.6 10/11/93 ross added more pack pragmas. +1.7 10/11/93 ross changed 92 to 93. +1.8 12/03/93 ross fixes for lsl version 3.0 +1.9 02/02/94 ross +* $lge$ +*/ +/************************************************************************/ +/* Copyright (C) 1989 - 1998 RouterWare, Inc */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Blvd. Suite 212, Newport Beach Ca */ +/************************************************************************/ +#ifndef _V8022STR_H_ +#define _V8022STR_H_ + +#define MAC_HEADER_FILE + +#if (_BYTE_ORDER == _BIG_ENDIAN) + #define BIG_ENDIAN_CONSTANT(ushort) ushort + #define host_to_net_short(a) (a) + #define net_to_host_short(a) (a) + #define host_to_net_long(a) (a) + #define net_to_host_long(a) (a) + #define swap(a) (a) + #define swap_long(a) (a) +#else + #define BIG_ENDIAN_CONSTANT(ushort) (((0x00ff & ushort) << 8) | (ushort >> 8)) +#endif + +#define MAXIMUM_ETHERNET_DATA_SIZE 1500 +#define MINIMUM_ETHERNET_DATA_SIZE 46 + +#if !defined (RX_PACKET_STATE_DEFINED) + + #define RX_PACKET_STATE_DEFINED + + enum RX_PACKET_STATE + { + PACKET_NOT_RECOGNIZED, + PACKET_RECOGNIZED_BUT_NOT_FORWARDED, + PACKET_RECOGNIZED_AND_FORWARDED + }; + +#endif + +enum SNAP_PROTOCOL_ID +{ + SNAP_IPX_PROTOCOL_ID = BIG_ENDIAN_CONSTANT (0x8137), + + SNAP_STP_BPDU_PACKET = BIG_ENDIAN_CONSTANT (0x000e), + SNAP_8023_BRIDGED_PACKET_WITH_CRC = BIG_ENDIAN_CONSTANT (0x0001), + SNAP_8023_BRIDGED_PACKET_WITHOUT_CRC = BIG_ENDIAN_CONSTANT (0x0007), + SNAP_8025_BRIDGED_PACKET_WITH_CRC = BIG_ENDIAN_CONSTANT (0x0003), + SNAP_8025_BRIDGED_PACKET_WITHOUT_CRC = BIG_ENDIAN_CONSTANT (0x0009), + + SNAP_IP_ARP_PACKET = BIG_ENDIAN_CONSTANT (0x0806), + SNAP_IP_RARP_PACKET = BIG_ENDIAN_CONSTANT (0x8035), + SNAP_IP_PACKET = BIG_ENDIAN_CONSTANT (0x0800), + SNAP_IP_FRAGMENT_PACKET = BIG_ENDIAN_CONSTANT (0x000d), + + SNAP_XNS_PROTOCOL_ID = BIG_ENDIAN_CONSTANT (0x0600), + SNAP_APPLETALK_PROTOCOL_ID = BIG_ENDIAN_CONSTANT (0x809b), + SNAP_APPLETALK_AARP_PROTOCOL_ID = BIG_ENDIAN_CONSTANT (0x80f3), + SNAP_CISCO_BPDU_PROTOCOL_ID = BIG_ENDIAN_CONSTANT (0x4242), + SNAP_CISCO_BRIDGED_DATA = BIG_ENDIAN_CONSTANT (0x6558), + SNAP_DECNET = BIG_ENDIAN_CONSTANT (0x6003), + SNAP_ISO = BIG_ENDIAN_CONSTANT (0xfefe), + + SNAP_VINES_IP_PACKET = BIG_ENDIAN_CONSTANT (0x0bad), + SNAP_VINES_ECHO_PACKET = BIG_ENDIAN_CONSTANT (0x0baf) +}; + +enum LLC_FRAME_TYPE +{ + INFORMATION_FRAME, + UNNUMBERED_INFORMATION = 3, + RECEIVER_READY, + DISCONNECT, + RECEIVER_NOT_READY, + UNNUMBERED_ACKNOWLEDGE, + REJECT, + FRAME_REJECT, + SET_ASYNCHRONOUS_BALANCE_MODE, + DISCONNECT_MODE, + EXCHANGE_IDENTIFICATION, + LINK_TEST_FRAME +}; + +enum LLC_SUBLAYER_MANAGEMENT +{ + INDIVIDUAL_LLC_SUBLAYER_MANAGEMENT = 2, + GROUP_LLC_SUBLAYER_MANAGEMENT = 3 +}; + +enum SAP_TYPES +{ + LSAP_SNAP_LLC = 0xaa, + LSAP_BRIDGE_SPANNING_TREE_PROTOCOL = 0x42, + NOVELL_SAP_FOR_IPX = 0xe0, + SNA_SAP = 0x04, + SNA_SAP_1 = 0x08, + SNA_SAP_2 = 0x0c, + NETBIOS_SAP = 0xf0 +}; + +enum ETHERNET_TYPE +{ + IP_TYPE = 0x0800, /* 2048 */ + ARP_TYPE = 0x0806, /* 2054 */ + VINES_IP_TYPE = 0x0bad, + VINES_ECHO_TYPE = 0x0baf, + APPLETALK_PHASE_1_DDP_TYPE = 0x809b, + APPLETALK_PHASE_1_ARP_TYPE = 0x80f3, + IPX_SPX_TYPE = 0x8137, + PPP_OVER_ETHERNET_DISCOVERY_TYPE = 0x8863, + PPP_OVER_ETHERNET_DATA_TYPE = 0x8864 +}; + +typedef struct HDLC_CONTROL +{ +#if (_BYTE_ORDER == _BIG_ENDIAN) + unsigned zero_or_one:1; + unsigned tx_sequence_or_function:3; + unsigned poll_or_final:1; + unsigned rx_sequence_or_function:3; +#else + unsigned rx_sequence_or_function:3; + unsigned poll_or_final:1; + unsigned tx_sequence_or_function:3; + unsigned zero_or_one:1; +#endif +} HDLC_CONTROL; + +typedef _struct LLC_HEADER +{ + BYTE_ENUM (SAP_TYPES) destination_address_DSAP; + BYTE_ENUM (SAP_TYPES) source_address_SSAP; + BYTE_ENUM (LLC_FRAME_TYPE) llc_frame_type; +} _pack LLC_HEADER; + +typedef _struct SNAP_HEADER +{ + BYTE destination_address_DSAP; /* 0xaa */ + BYTE source_address_SSAP; /* 0xaa */ + + BYTE_ENUM (LLC_FRAME_TYPE) llc_frame_type; /* 0x03 UNNUMBERED_INFORMATION */ + + BYTE protocol_id_filler[3]; + USHORT_ENUM (SNAP_PROTOCOL_ID) protocol_id; +} _pack SNAP_HEADER; + +typedef union UNION_SNAP_OR_LLC_HEADER +{ + SNAP_HEADER snap; + LLC_HEADER llc; +} UNION_SNAP_OR_LLC_HEADER; + +typedef _struct MAC_ADDRESS +{ + ULONG _ulong; + USHORT _ushort; +} _pack MAC_ADDRESS; + +#if (_BYTE_ORDER == _BIG_ENDIAN) + typedef _struct ETHERNET_BIT_MAC_ADDRESS + { + unsigned int ls_address:6; + unsigned int local_address:1; + unsigned int group_address:1; + + BYTE ms_address[5]; + } _pack ETHERNET_BIT_MAC_ADDRESS; + + typedef _struct TOKEN_RING_BIT_MAC_ADDRESS + { + unsigned int group_address:1; + unsigned int local_address:1; + unsigned int ls_address:6; + + BYTE ms_address[5]; + } _pack TOKEN_RING_BIT_MAC_ADDRESS; +#else + typedef _struct ETHERNET_BIT_MAC_ADDRESS + { + unsigned int group_address:1; + unsigned int local_address:1; + unsigned int ls_address:6; + + BYTE ms_address[5]; + } _pack ETHERNET_BIT_MAC_ADDRESS; + + typedef _struct TOKEN_RING_BIT_MAC_ADDRESS + { + unsigned int ls_address:6; + unsigned int local_address:1; + unsigned int group_address:1; + + BYTE ms_address[5]; + } _pack TOKEN_RING_BIT_MAC_ADDRESS; +#endif + +typedef union UNION_BIT_MAC_ADDRESS +{ + MAC_ADDRESS mac_address; + TOKEN_RING_BIT_MAC_ADDRESS token_ring_bit; + ETHERNET_BIT_MAC_ADDRESS ethernet_bit; +} UNION_BIT_MAC_ADDRESS; + +#if !defined (ETHERNET_HEADER_FILE) + + typedef union UNION_ETHERNET_LENGTH_OR_TYPE_FIELD + { + USHORT length; + USHORT type; + } UNION_ETHERNET_LENGTH_OR_TYPE_FIELD; + + typedef _struct ETHERNET_MAC_HEADER + { + MAC_ADDRESS destination_address; + MAC_ADDRESS source_address; + UNION_ETHERNET_LENGTH_OR_TYPE_FIELD length_or_type; + } _pack ETHERNET_MAC_HEADER; + +#endif + +#if !defined (TOKEN_RING_HEADER_FILE) + typedef _struct TOKEN_RING_MAC_HEADER + { + BYTE access_control; + BYTE frame_control; + + MAC_ADDRESS destination_address; + MAC_ADDRESS source_address; + } _pack TOKEN_RING_MAC_HEADER; +#endif + +typedef union UNION_MAC_HEADER +{ + ETHERNET_MAC_HEADER ethernet; + TOKEN_RING_MAC_HEADER token_ring; +} UNION_MAC_HEADER; + +typedef _struct FRAME +{ + UNION_MAC_HEADER mac_header; + UNION_SNAP_OR_LLC_HEADER snap_or_llc_header; + + BYTE data[1]; +} _pack FRAME; + +typedef _struct MAC_HEADER +{ + MAC_ADDRESS destination_address; + MAC_ADDRESS source_address; + + USHORT length; +} _pack MAC_HEADER; + + +#endif /* _V8022STR_H_ */ diff --git a/h/wrn/visnpstr.h b/h/wrn/visnpstr.h new file mode 100644 index 0000000..a1f4c5f --- /dev/null +++ b/h/wrn/visnpstr.h @@ -0,0 +1,152 @@ +/* + * $Log:: /Tornado/target/h/NB/visnpstr.h $ + * + * 1 2/09/00 4:42p Admin + * + * 1 8/26/99 7:46p Alex + * + * 1 5/26/99 9:53a Alex + * + * 1 4/14/99 5:11p Rajive + * Initial vesrion of Next Gen RouterWare Source code + * + * 1 1/18/99 5:10p Mahesh + * + * 1 1/18/99 4:24p Mahesh + * + * 4 4/30/98 1:16p Rajive + * Overwrote with INCLUDE v4.2.1 + * + * 3 4/27/98 11:42a Release Engineer + * Additions into include for L2TP and RTM modules. + * INCLUDE v4.2.1 + * + * 1 2/13/98 12:18a Release Engineer + * code cleanup, code style changes, linted, system level test + * INCLUDE v4.2.0 + * + * 4 5/21/96 7:32p Ross + * Fixes for token ring header files + * + * 3 3/27/96 7:08p Ross + * Initial check-in with source safe. +*/ +/* +modification history +-------------------- +02 May0902,ark Added fix for SPR 70535 +*/ +/************************************************************************/ +/* Copyright (C) 1993 - 1998 RouterWare, Inc. */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Blvd. Suite 212, Newport Beach Ca */ +/************************************************************************/ +#if !defined (_VISNPSTR_H_) +#define _VISNPSTR_H_ + +#define NO_PORT_NEEDED 0xffff + +#if !defined (__MIB_OPERATION_DEFINED__) + #define __MIB_OPERATION_DEFINED__ + + enum MIB_OPERATION + { + GET_OPERATION, + GET_NEXT_OPERATION, + SET_OPERATION, + VERIFY_OPERATION + }; +#endif + +enum MIB_TABLE_TYPE +{ + MIB_TABLE_AS_AN_ARRAY = 1, + MIB_TABLE_AS_AN_ARRAY_OF_LINKED_LISTS = 2, + MIB_TABLE_AS_A_LINKED_LIST = 3, + MIB_TABLE_AS_A_LINKED_LIST_OF_ARRAYS = 4, + MIB_TABLE_AS_A_LINKED_LIST_OF_LINKED_LISTS = 5 +}; + + +enum SNMP_LEXICAL_TYPE +{ + SNMP_INVALID_TYPE = 1, + SNMP_IP_ADDRESS_TYPE = 2, + SNMP_IPX_ADDRESS_TYPE = 3, + SNMP_SCALAR_TYPE = 4, + SNMP_STRING_TYPE = 5 +}; + + +typedef struct TABLE_ENTRY_INDEX +{ + BYTE_ENUM (SNMP_LEXICAL_TYPE) index_type; + ULONG size_of_index; + ULONG offset_to_index; + BOOLEAN need_to_increment; + void *vptr_index_value; + BOOLEAN need_to_swap; + void *vptr_maximum_value_of_index; + BOOLEAN should_be_used_to_get_pointer_to_next_array_element; +} TABLE_ENTRY_INDEX; + + +typedef struct SNMP_TABLE_ENTRY_PARAMETERS +{ + ULONG address_of_structure_containing_mib_variable; + + BOOLEAN is_a_table_entry; + BYTE number_of_indices; + TABLE_ENTRY_INDEX table_indices[6]; + + BYTE_ENUM (MIB_TABLE_TYPE) table_type; + void *vptr_first_row_in_mib_table; + ULONG size_of_array_element; + ULONG number_of_array_elements; + ULONG offset_of_first_linked_list_pointer; + ULONG offset_of_second_linked_list_pointer; +} SNMP_TABLE_ENTRY_PARAMETERS; + + +typedef struct SNMP_TABLE_ENTRY +{ + char *mib_name; + USHORT size_of_mib_variable; + + enum TEST (*fptr_mib_access_function) (USHORT port_number, + enum MIB_OPERATION mib_operation, ULONG offset_into_class, + ULONG class_address, ULONG size_of_port_class, void *vptr_mib_value, + USHORT *usptr_length_of_mib_obtained); + + BOOLEAN need_to_increment_mib_value_for_get_operation; + BOOLEAN need_to_swap; + ULONG offset_of_mib_variable; + SNMP_TABLE_ENTRY_PARAMETERS *sptr_parameters; /* This should never be NULL except for the terminal table entry */ +} SNMP_TABLE_ENTRY; + + +typedef struct MIB_ACCESS_PARAMETERS +{ + enum MIB_OPERATION mib_operation; + char *cptr_mib_string; + BYTE *bptr_variable_value; + USHORT *usptr_size_of_variable_value; + USHORT *usptr_size_of_table_indices; + ULONG *ulptr_table_indices; + BOOLEAN *eptr_end_of_table; + char **ptr_to_cptr_next_variable_name; +} MIB_ACCESS_PARAMETERS; + +typedef enum TEST (*SNMP_ACCESS_FUNCTION) (USHORT port_number, + enum MIB_OPERATION mib_operation, ULONG offset_into_class, + ULONG class_address, ULONG size_of_port_class, void *vptr_mib_value, + USHORT *usptr_length_of_mib_obtained); + +#endif /* _VISNPSTR_H_*/ + + + diff --git a/h/wrn/vnvrmstr.h b/h/wrn/vnvrmstr.h new file mode 100644 index 0000000..5936c71 --- /dev/null +++ b/h/wrn/vnvrmstr.h @@ -0,0 +1,140 @@ +/* + * $Log:: /Tornado/target/h/NB/vnvrmstr.h $ + * + * 1 2/09/00 4:42p Admin + * + * 2 8/26/99 7:42p Alex + * + * 1 8/25/99 7:01p Alex + * + * 1 5/26/99 9:53a Alex + * + * 1 4/14/99 5:12p Rajive + * Initial vesrion of Next Gen RouterWare Source code + * + * 1 1/18/99 5:10p Mahesh + * + * 1 1/18/99 4:24p Mahesh + * + * 6 11/05/98 12:15p Alex + * + * 5 10/29/98 1:38p Alex + * Added new function prototype for NVRAM module. + * + * 4 4/30/98 1:16p Rajive + * Overwrote with INCLUDE v4.2.1 + * + * 3 4/27/98 11:42a Release Engineer + * Additions into include for L2TP and RTM modules. + * INCLUDE v4.2.1 + * + * 2 3/27/96 7:08p Ross + * Initial check-in with source safe. +*/ +/* $Modname: vnvrmstr.h$ $version: 1.7$ $date: 02/11/94$ */ +/* +* $lgb$ +1.0 10/21/93 ross +1.1 10/21/93 ross +1.2 10/21/93 ross +1.3 11/01/93 ross ipx certification version +1.4 12/01/93 ross lsl version 3 additions. +1.5 01/08/94 ross More LSL version 3 changes +1.6 02/02/94 ross fixed lslsnap bugs, and added ipx protocol detection, support for dlsx and nlsp +1.7 02/11/94 ross added stuff for dlsw and nlsp. +* $lge$ +*/ +/************************************************************************/ +/* Copyright (C) 1989 - 1998 RouterWare, Inc. */ +/* Unpublished - rights reserved under the Copyright Laws of the */ +/* United States. Use, duplication, or disclosure by the */ +/* Government is subject to restrictions as set forth in */ +/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */ +/* Computer Software clause at 252.227-7013. */ +/* RouterWare, Inc., 3961 MacArthur Blvd. Suite 212, Newport Beach Ca */ +/************************************************************************/ +#if !defined (_VNMRMSTR_H_) +#define _VNMRMSTR_H_ + +typedef struct CONFIGURATION_FUNCTION +{ + void (*fptr_parameter_function) (char *cptr_start_of_configuration_string,ULONG parameter_1, + ULONG ulptr_parameter_2,ULONG parameter_3); + BOOLEAN *eptr_enable_string; + char *cptr_parameter_string; + ULONG parameter_1; + ULONG ulptr_parameter_2; + ULONG parameter_3; + ULONG minimum_value; + ULONG maximum_value; +} CONFIGURATION_FUNCTION; + +typedef struct CONFIGURATION_TABLE +{ + BOOLEAN valid; + + CONFIGURATION_FUNCTION function[200]; + +} CONFIGURATION_TABLE; + +typedef struct NVRAM_CLASS +{ + BOOLEAN display_configuration_file; + + BYTE current_configuration_section_index; + + CONFIGURATION_TABLE *sptr_current_configuration_table; + + BYTE value[12]; + BYTE number_of_configurations; +} NVRAM_CLASS; + +void set_variable_port_and_enable (char *cptr_start_of_configuration_string,ULONG vptr_parameter_1, + ULONG ulptr_parameter_2,ULONG size_of_parameter); +void set_variable_port_less_one_and_enable (char *cptr_start_of_configuration_string,ULONG vptr_parameter_1, + ULONG ulptr_parameter_2,ULONG size_of_parameter); +void set_variable_port_and_ushort_decimal_value (char *cptr_start_of_configuration_string,ULONG vptr_parameter_1, + ULONG ulptr_parameter_2,ULONG size_of_parameter); +void set_variable_port_and_ushort_hex_value (char *cptr_value_string,ULONG vptr_parameter_1, + ULONG ulptr_parameter_2,ULONG size_of_parameter); +void set_variable_port_and_swapped_ushort_hex_value (char *cptr_value_string,ULONG vptr_parameter_1, + ULONG ulptr_parameter_2,ULONG size_of_parameter); +void set_ushort_swapped_hex_value (char *cptr_start_of_configuration_string,ULONG offset,ULONG ulptr_base); +void set_ushort_decimal_value (char *cptr_start_of_configuration_string,ULONG offset,ULONG ulptr_base); +void set_byte_decimal_value (char *cptr_start_of_configuration_string,ULONG offset,ULONG ulptr_base); +void set_variable_string (char *cptr_start_of_configuration_string,ULONG offset,ULONG ulptr_base); +void set_variable_port_and_string (char *cptr_value_string,ULONG offset,ULONG ulptr_base,ULONG size_of_entry); +void set_ulong_swapped_hex_value (char *cptr_start_of_configuration_string,ULONG offset,ULONG ulptr_base); +void nvram_memcpy (void *vptr_destination,void *vptr_source,USHORT number_of_bytes); +BOOLEAN is_parameter_enabled (char *cptr_parameter_string); +USHORT get_port_number_and_string (char *cptr_port_number_and_value,char *return_string); +ULONG get_port_number_and_value (char *cptr_port_number_and_value,USHORT *usptr_port_number); +ULONG get_port_number_and_hex_value (char *cptr_port_number_and_value,USHORT *usptr_port_number); +ULONG get_ulong_hex_value (char *cptr_port_number_and_value); +ULONG get_decimal_value (char *cptr_value); +void set_variable_port_and_ulong_decimal_value (char *cptr_value_string,ULONG vptr_parameter_1, + ULONG ulptr_parameter_2,ULONG size_of_parameter); +void set_ulong_decimal_value (char *cptr_value_string,ULONG offset,ULONG ulptr_base); +void set_ulong_value (char *cptr_value_string,ULONG offset,ULONG ulptr_base); +void set_variable_port_and_byte_decimal_value (char *cptr_value_string,ULONG vptr_parameter_1, + ULONG ulptr_parameter_2,ULONG size_of_parameter); +void set_variable_port_and_swapped_ulong_hex_value (char *cptr_value_string,ULONG vptr_parameter_1, + ULONG ulptr_parameter_2,ULONG size_of_parameter); +void set_variable_port_and_mac_address (char *cptr_ethernet_string,ULONG vptr_parameter_1, + ULONG ulptr_parameter_2,ULONG size_of_parameter); +void set_mac_address (char *cptr_mac_address_string,ULONG offset,ULONG ulptr_base); +ULONG convert_4_bytes_to_ulong (BYTE byte_1,BYTE byte_2,BYTE byte_3,BYTE byte_4); +void add_section_name_and_configuration_table_pointer (char *cptr_section_name, + CONFIGURATION_TABLE *sptr_configuration_table_to_add); +void set_variable_port_and_ip_address (char *cptr_ip_address_string,ULONG vptr_parameter_1, + ULONG ulptr_parameter_2,ULONG size_of_parameter); +void set_ip_address (char *cptr_ip_address_string,ULONG offset,ULONG ulptr_base); +void set_variable_port_and_enum_enable (char *cptr_start_of_configuration_string,ULONG vptr_parameter_1, + ULONG ulptr_parameter_2,ULONG size_of_parameter); +void set_uint_decimal_value (char *cptr_value_string,ULONG offset,ULONG ulptr_base); +void set_enum_enable (char *cptr_value_string,ULONG offset,ULONG ulptr_base); +void set_variable_port_and_ulong_enable (char *cptr_start_of_configuration_string,ULONG vptr_parameter_1, + ULONG ulptr_parameter_2,ULONG size_of_parameter); + + +#endif /*_VNMRMSTR_H_ */ diff --git a/h/wrn/wm/common/backstop/common.h b/h/wrn/wm/common/backstop/common.h new file mode 100644 index 0000000..a498f07 --- /dev/null +++ b/h/wrn/wm/common/backstop/common.h @@ -0,0 +1,56 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/common/backstop/common.h,v 1.1.1.1 2001/11/05 17:47:18 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: common.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:18 tneale + * Tornado shuffle + * + * Revision 1.5 2001/01/19 22:21:24 paul + * Update copyright. + * + * Revision 1.4 2000/03/17 00:16:12 meister + * Update copyright message + * + * Revision 1.3 1998/02/25 04:43:22 sra + * Update copyrights. + * + * Revision 1.2 1998/02/05 22:01:27 josh + * moved top-level backstop include files into common/backstop + * + * Revision 1.1 1997/08/21 17:23:40 sra + * Begin moving configuration stuff that's common to all products to common.h + * Minor cleanups to common/lib/prng.c. Add pnrg seed function to snarkbsd. + * + */ + +/* + * Backstop common.h. + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + +#ifdef CONFIG_PREAMBLE + +#else /* CONFIG_PREAMBLE */ + +#endif /* CONFIG_PREAMBLE */ diff --git a/h/wrn/wm/common/backstop/oemtypes.h b/h/wrn/wm/common/backstop/oemtypes.h new file mode 100644 index 0000000..37454fd --- /dev/null +++ b/h/wrn/wm/common/backstop/oemtypes.h @@ -0,0 +1,68 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/common/backstop/oemtypes.h,v 1.1.1.1 2001/11/05 17:47:19 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * Backstop type definitions file. Just gets size_t from the standard place. + */ + +/* + * $Log: oemtypes.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:19 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:21:24 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:16:12 meister + * Update copyright message + * + * Revision 1.2 1998/02/25 04:43:23 sra + * Update copyrights. + * + * Revision 1.1 1998/02/05 22:01:28 josh + * moved top-level backstop include files into common/backstop + * + * Revision 1.3 1997/03/20 06:58:18 sra + * DFARS-safe copyright text. Zap! + * + * Revision 1.2 1997/02/25 10:57:29 sra + * Update copyright notice, dust under the bed. + * + * Revision 1.1 1993/06/17 16:21:50 dab + * Initial revision + * + */ + + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +/* + * The now standard place to find size_t's definition. + */ + +#include + + + + + + diff --git a/h/wrn/wm/common/bug.h b/h/wrn/wm/common/bug.h new file mode 100644 index 0000000..a84b1a7 --- /dev/null +++ b/h/wrn/wm/common/bug.h @@ -0,0 +1,302 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/common/bug.h,v 1.3 2003/01/16 18:20:10 josh Exp $ */ + + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1995-1997 Epilogue Technology Corporation. + * Copyright 1998-1999 Integrated Systems, Inc. + * All rights reserved. +*****************************************************************************/ + +/* + * $Log: bug.h,v $ + * Revision 1.3 2003/01/16 18:20:10 josh + * directory structure shifting + * + * Revision 1.2 2001/11/07 00:07:08 meister + * Rework pathnames again + * + * Revision 1.1.1.1 2001/11/05 17:47:17 tneale + * Tornado shuffle + * + * Revision 1.7 2001/01/19 22:21:26 paul + * Update copyright. + * + * Revision 1.6 2000/03/17 00:16:33 meister + * Update copyright message + * + * Revision 1.5 2000/03/09 17:15:38 tneale + * Added #idef C++ to declare extern C if needed + * + * Revision 1.4 1999/03/08 22:12:52 paul + * added BUG_TRACE + * + * Revision 1.3 1998/02/25 04:43:23 sra + * Update copyrights. + * + * Revision 1.2 1998/02/05 22:34:41 josh + * have to make sure bug.h includes common/h/bugdef.h + * + * Revision 1.1 1998/02/05 22:19:27 josh + * moving commonly used include files into common/h from top-level directory + * + * Revision 3.11 1997/05/30 16:58:59 lowell + * spelling nit that's been bothering me for months + * + * Revision 3.10 1997/03/20 06:58:17 sra + * DFARS-safe copyright text. Zap! + * + * Revision 3.9 1997/03/19 04:11:35 sra + * BUG() now common to all products, so move the associated .h files. + * + * Revision 3.8 1996/03/22 10:04:12 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 3.7 1996/03/14 20:16:39 sra + * Get rid of default definition of BUG_OUT, I had it right the first + * time.... + * + * Revision 3.6 1996/03/11 20:07:33 sra + * Add default definition of BUG_OUT to avoid preprocessor problems. + * + * Revision 3.5 1995/11/24 23:21:04 sra + * Add BUG_OUT token to BUG() macros. + * + * Revision 3.4 1995/06/28 19:43:16 sra + * Add cookie argument to BUG() macro. + * + * Revision 3.3 1995/06/27 06:20:23 sra + * Add some debugging code to catch botched packet buffer allocs/frees. + * + * Revision 3.2 1995/06/26 21:50:52 sra + * Soup up a few of the macros. Change the include-protection macro name + * to ATTACHE_BUG_H (this file never had anything to do with a certain + * DOS network software package, but my fingers slipped and the old macro + * name might have confused people...). + * + * Revision 3.1 1995/06/26 05:12:25 sra + * Invert test in BUG_ASSERT(). + * + * Revision 3.0 1995/05/10 22:36:18 sra + * Release 3.0. + * + * Revision 2.2 1995/04/26 01:05:13 sra + * Move bug definitions themselves to separate file bugdef.h. + * + * Revision 2.1 1995/04/10 23:40:30 sra + * Initial revision. + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef EPILOGUE_BUG_H +#define EPILOGUE_BUG_H + +#ifdef __cplusplus +extern"C" { +#endif + +/* + * This file defines the framework of the BUG() macro mechanism. + * + * This is intended to be an extremely general way of handling code + * tracing, exception processing, and debugging code, with support + * both for arbitrary documentation strings and for making the entire + * business go away if you want to save space in production code. The + * format is a little strange, mostly because of the relative + * weaknesses of C (in particular, of its macro processor). + * + * There are some sample BUG() macro definitions at the end of this file. + * + * The general form of an invocation of the BUG() macro is + * + * BUG( , , , ( BUG_OUT, )); + * + * (enum bug_codes) indicates the bug that occurred + * + * (enum bug_actions) indicates "fatal" errors + * + * (void *) is for bug-specific useful data, if any + * + * is a parenthesised list of arguments suitable + * for passing to a printf()-like function if you want a debugging log. + * + * In general, bug codes should be unique. The only case where it makes + * sense to use the same bug code in multiple places is if both the failure + * and any recovery action are identical among the multiple invocations. + * The bug codes themselves are defined in a separate file, bugdef.h. + * + * "fatal" errors means errors serious enough that Attache's attempts + * to clean up after the problem may not be sufficent. Attache will + * always -try- to continue operation, but you may want to consider + * just restarting your system if a "fatal" error occurs. + * + * The is to allow particular BUG() invocations to pass + * useful information up to your bug handler code. Most BUG() + * invocations will probably just pass a zero (null pointer). + * NB: We make no promises whatsoever about consistancy of data passed + * in this pointer between releases unless explictly documented in our + * manuals. So, in most cases, you should just ignore this field. + * + * has to be handled by in-line code if it's handled at all, + * due to limitations of the C macro preprocessor. It should probably + * be ignored in a production system, it's just there to ease debugging. + * + * BUG_OUT is sort of a macro-level cookie; all invocations of BUG() + * include this token, you can define it as a macro or an automatic + * variable or whatever's convenient. If you're just trying to get + * basic output to work in a normal C environment, defining BUG_OUT + * as a macro that expands to "stderr" might be a good choice. + */ + +/* + * values. + */ +enum bug_actions { + BUG_FATAL, /* serious bug, consider rebooting now */ + BUG_CONTINUABLE, /* normal operation can continue, we think */ + BUG_TRACE /* not a bug, execution trace information */ +}; + +/* + * values. Check these with a switch() or if() statement, + * don't depend on specific numeric values. + */ + +enum bug_codes { + +#define BUGDEF(x) x , +#include +#undef BUGDEF + + BUG_MAX /* Number of bugs currently defined */ +}; + +/* + * I haven't figured out yet whether BUG() should be under a makmak + * installation option or not. This will do the right thing for now. + */ +#ifndef INSTALL_BUG +#ifdef BUG +#define INSTALL_BUG 1 +#else +#define INSTALL_BUG 0 +#endif +#endif + +/* + * Variant on BUG() which includes a test condition. + */ +#ifndef BUG_IF +#if INSTALL_BUG +#define BUG_IF(v,w,x,y,z) \ + do { if (v) BUG(w,x,y,z); } while (0) +#else +#define BUG_IF(v,w,x,y,z) +#endif +#endif + +/* + * Variant on standard C "assert()" mechanism. + */ +#ifndef BUG_ASSERT +#if INSTALL_BUG +#define BUG_ASSERT(x) \ + BUG_IF((!(x)), BUG_ASSERTION_FAILED, BUG_FATAL, 0,\ + (BUG_OUT, "Assertion \"%s\" failed, file %s line %d",\ + #x, __FILE__, __LINE__)) +#else +#define BUG_ASSERT(x) +#endif +#endif + +/* + * Wrapper for support code for things like BUG_ASSERT(). + * Useful for declaring variables or adding code that is not itself + * a BUG() statement but that will only be used when debugging is enabled. + * + * Eg: + * + * void foo_init(void) + * { + * BUG_SUPPORT(static count = 0); + * BUG_IF(count++, BUG_HORRIBLE_BOTCH_IN_FOO_INIT, BUG_FATAL, 0, + * (BUG_OUT, "Arg, you called foo_init() again!")); + * ... + * } + */ +#ifndef BUG_SUPPORT +#if INSTALL_BUG +#define BUG_SUPPORT(x) x +#else +#define BUG_SUPPORT(x) +#endif +#endif + +/* + * Default definition of BUG() if customer doesn't provide one. + * Does nothing at all. + */ +#ifndef BUG +#define BUG(w,x,y,z) +#endif + +/* + * The rest of this file is a couple of sample definitions of the BUG() + * macro that might be useful in your environment. + */ +#if 0 + +/* + * Sample BUG() that just passes error indication to customer code. + */ +#define BUG(w,x,y,z) \ + glue_bug(w,x) + +/* + * Sample BUG() that logs errors and handles the fatal flag. + * Logging depends on some POSIX-like features that are available on + * many but not all systems. + * Something like this might be useful in a debugging environment. + * + * NB: "fprintf z;" is not a typo. + */ +#define BUG_OUT stderr +#define BUG(w,x,y,z) \ + do {\ + char now_[30];\ + time_t now_time_ = time(0);\ + struct tm *now_tm_ = localtime(&now_time_);\ + strftime(now_, sizeof(now_), "%H:%M:%S", now_tm_);\ + fprintf(BUG_OUT, "%s: ", now_);\ + fprintf z ;\ + fputc('\n', BUG_OUT);\ + if ((x) == BUG_FATAL)\ + fprintf(BUG_OUT, "%s: Fatal error, cannot continue\n", now_);\ + fflush(BUG_OUT);\ + if ((x) == BUG_FATAL)\ + abort();\ + } while (0) + +#endif /* 0 */ + +#ifdef __cplusplus +} +#endif + +#endif /* EPILOGUE_BUG_H */ diff --git a/h/wrn/wm/common/bugdef.h b/h/wrn/wm/common/bugdef.h new file mode 100644 index 0000000..0ec3f08 --- /dev/null +++ b/h/wrn/wm/common/bugdef.h @@ -0,0 +1,417 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/common/bugdef.h,v 1.2 2003/01/16 18:20:10 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1995-1997 Epilogue Technology Corporation. + * Copyright 1998-1999 Integrated Systems, Inc. + * All rights reserved. +*****************************************************************************/ + +/* + * $Log: bugdef.h,v $ + * Revision 1.2 2003/01/16 18:20:10 josh + * directory structure shifting + * + * Revision 1.1.1.1 2001/11/05 17:47:17 tneale + * Tornado shuffle + * + * Revision 1.32 2001/06/12 08:06:02 paul + * Added BUG_SOCKET_UPCALL_BAD_CV, BUG_SOCKET_UPCALL_CLOSING. + * + * Revision 1.31 2001/06/08 19:11:48 paul + * Added BUG_ATTACHE_PSOS_THREAD_INFO. + * + * Revision 1.30 2001/05/31 17:12:18 paul + * Added BUG_MEMPOOL_TRACE. + * + * Revision 1.29 2001/01/19 22:21:27 paul + * Update copyright. + * + * Revision 1.28 2000/12/02 20:23:56 sar + * Added a series of bugdefs for v6 stuff + * Added bug_pkt_dup_alloc_failed as it got lost somewhere + * + * Revision 1.27 2000/10/16 19:21:43 paul + * Restore sockets and mempool code. + * + * Revision 1.26 2000/03/17 07:13:38 paul + * Roll IPv6 back to the last released state. + * + * Revision 1.25 2000/03/17 00:16:34 meister + * Update copyright message + * + * Revision 1.24 2000/03/13 21:21:44 paul + * Removed some code that we are no longer working on. + * + * Revision 1.23 2000/02/01 22:01:14 tneale + * Added BUG_SNMP_RCV_TRACE + * + * Revision 1.22 1999/11/10 21:57:09 paul + * Added BUG_IF_SEND_TRACE + * + * Revision 1.14 1999/03/08 22:12:58 paul + * added a bunch of socket bugdefs + * + * Revision 1.13 1999/02/18 04:41:22 wes + * Sockets merge: Everything Else + * - memory pools + * - thread support + * - port-specific headers + * + * Revision 1.12 1998/11/23 20:52:59 wes + * Make MEDIA_CTL_CHECK_ADDRESS succeed rather than die. + * Die using BUG instead of abort() for unknown media_ctl ops. + * + * Revision 1.11.2.4 1998/10/21 20:22:41 wes + * Correct comments to reflect new usage of SOCKET_{TRACE,INFO} + * + * Revision 1.11.2.3 1998/10/01 22:43:46 wes + * May the Fleas of a Thousand Camels infest the Nether Regions of + * Whoever thought of Trigraphs. + * + * Revision 1.11.2.2 1998/10/01 21:52:05 wes + * Use the BUG macro closer to how it was intended to be used + * + * Revision 1.11.2.1 1998/09/30 22:05:56 wes + * Add THREAD_TRACE bugdef + * + * Revision 1.11 1998/09/06 08:11:05 sra + * Packet filtering hooks in Attache, rudimentary firewall + * implementation in Snark. + * + * Revision 1.10 1998/08/07 23:56:47 meister + * added BUG_ARP_SEND_REQUEST BUG_ARP_SEND BUG_ET_ARP_SEND_TRACE + * BUG_ARP_RCV_TRACE + * + * Revision 1.9 1998/07/30 22:11:49 meister + * added BUG_SNARK_PSOSTTY_INFO + * + * Revision 1.8 1998/07/24 16:53:02 meister + * Added BUG_ATTACHE_PSOS_NIDRV_INFO + * + * Revision 1.7 1998/07/03 18:37:32 sra + * Add trace calls to route_host_lookup(). + * + * Revision 1.6 1998/06/29 22:25:56 sra + * More trace symbols. + * + * Revision 1.5 1998/06/29 03:07:46 sra + * Add tracing code to et_rcv(). + * + * Revision 1.4 1998/04/24 18:42:37 wes + * Two new bug codes for DHCP + * + * Revision 1.3 1998/04/16 15:57:46 josh + * two new bug definitions for Envoy + * + * Revision 1.2 1998/02/25 04:43:24 sra + * Update copyrights. + * + * Revision 1.1 1998/02/05 22:19:28 josh + * moving commonly used include files into common/h from top-level directory + * + * Revision 3.26 1997/11/20 17:33:15 sra + * Clear out a bunch of unused PAP and CHAP bug codes. + * + * Revision 3.25 1997/11/19 21:14:42 josh + * Liaison bug definitions + * + * Revision 3.24 1997/11/18 03:18:24 sra + * Brand new PAP and CHAP code for PPP. + * + * Revision 3.23 1997/10/28 00:51:48 sra + * Convert PPP code to use BUG() macro. + * Bang on CHAP and PAP code some more. + * Create test driver for PPP under Snark/BSD. + * + * Revision 3.22 1997/10/15 19:49:36 sra + * Preliminary cleanup of PPP PAP and CHAP modules. + * + * Revision 3.21 1997/08/15 22:14:57 lowell + * PAP/CHAP polishing + * + * Revision 3.20 1997/08/14 16:04:33 lowell + * boilerplate + * + * Revision 3.19 1997/07/29 00:18:41 lowell + * PAP/CHAP messages for logging already in file + * + * Revision 3.18 1997/07/17 02:15:56 alan + * New errors for a new Decorum + * + * Revision 3.17 1997/06/17 19:00:20 lowell + * more extensive TFTP debugging + * + * Revision 3.16 1997/05/30 17:00:18 lowell + * TFTP (got rid of old TFTP_DEBUG) + * + * Revision 3.15 1997/05/23 04:13:32 sra + * Add BUG_IPADDR_TEST_UNKNOWN_CODE. + * + * Revision 3.14 1997/05/22 03:35:25 sra + * Get rid of struct udp_hdr. Change pkt_rcv_info into an array, convert + * receive path to use it instead of passing pointer arguments in upcalls. + * + * Revision 3.13 1997/05/17 07:39:02 sra + * Change IP protocol dispatch to use ip_listener table. + * + * Revision 3.12 1997/03/20 06:58:16 sra + * DFARS-safe copyright text. Zap! + * + * Revision 3.11 1997/03/19 04:11:35 sra + * BUG() now common to all products, so move the associated .h files. + * + * Revision 3.10 1997/02/24 14:43:18 josh + * new bug definitions for Courier RIP and Attache Plus TCP + * + * Revision 3.9 1996/10/28 18:19:01 lowell + * Decorum messages + * Looks like this needs to be freed of its ownership by Attache... + * + * Revision 3.8 1996/03/22 10:04:12 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 3.7 1996/03/14 17:51:55 lowell + * DHCP packet dumper code + * + * Revision 3.6 1995/12/02 09:15:04 sra + * Add a bunch of Courier stuff. + * + * Revision 3.5 1995/09/28 23:06:59 sra + * Fix Courier identifiers and copyrights for release packaging. + * + * Revision 3.4 1995/06/30 23:24:10 sra + * Back out hairy interface to RCI TRACE() to a simpler scheme. + * + * Revision 3.3 1995/06/30 22:44:00 sra + * Add RCI trace bug codes. + * + * Revision 3.2 1995/06/30 16:10:40 lowell + * first few ARP and DHCP bug definitions (more to come) + * + * Revision 3.1 1995/06/27 06:20:23 sra + * Add some debugging code to catch botched packet buffer allocs/frees. + * + * Revision 3.0 1995/05/10 22:36:18 sra + * Release 3.0. + * + * Revision 1.1 1995/04/25 21:39:43 sra + * Initial revision + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +/* + * BUGDEF() table (see bug.h) + * + * NB: This file intentionally does NOT protect against multiple inclusion. + * + * Bug symbol definitions. This file is included by bug.h, + * and may be included by other modules as necessary. It's a separate + * file to make it easy to build a translation tables, bitvectors, and + * so forth. + * + * There should not be anything in this file except comments and + * invocations of the BUGDEF() macro. + * + * We'll probably add more of these in every release. Check these + * with a switch() or if() statement, don't depend on specific numeric + * values. + */ + +BUGDEF(BUG_ASSERTION_FAILED) /* bug.h */ +BUGDEF(BUG_RIP_MBZ_WASNT) /* attache/net/rip.c */ +BUGDEF(BUG_RIP_BAD_ENTRY) /* attache/net/rip.c */ +BUGDEF(BUG_RIP_COULDNT_CREATE_ROUTE) /* attache/net/rip.c */ +BUGDEF(BUG_RIP_COULDNT_CREATE_ROUTE_EXT) /* attache/net/rip.c */ +BUGDEF(BUG_RIP_DURCV) /* attache/net/rip.c */ +BUGDEF(BUG_RIP_NO_BUFFERS) /* attache/net/rip.c */ +BUGDEF(BUG_RIP_SKIPPING_ADDRESS) /* attache/net/rip.c */ +BUGDEF(BUG_RIP_SKIPPING_BROADCAST_ADDRESS) /* attache/net/rip.c */ +BUGDEF(BUG_RIP_ROUTE_CHANGE) /* attache/net/rip.c */ +BUGDEF(BUG_RIP_CLEAR_ROUTE_CACHE) /* attache/net/rip.c */ +BUGDEF(BUG_RIP_BAD_BROADCAST_ADDRESS) /* attache/net/rip.c */ +BUGDEF(BUG_IPOPT_TOO_LONG) /* attache/net/ip_opt.c */ +BUGDEF(BUG_PKT_INIT_NO_MEMORY) /* attache/net/packet.c */ +BUGDEF(BUG_PKT_ALLOC_ALREADY) /* attache/net/packet.c */ +BUGDEF(BUG_PKT_FREE_ALREADY) /* attache/net/packet.c */ +BUGDEF(BUG_IP_SEND_FREED) /* attache/net/ip_send.c */ +BUGDEF(BUG_ARP_NULL_POINTER) /* attache/net/arp.c */ +BUGDEF(BUG_DHCP_BAD_PACKET) /* (unused?) */ +BUGDEF(BUG_DHCP_PACKET_DUMP) /* attache/net/dhcp.c */ +BUGDEF(BUG_COURIER_TRACE) /* courier/common/trace_ut.h */ +BUGDEF(BUG_COURIER_IPI_ENABLE_FAILED) /* courier/common/epilogue.c */ +BUGDEF(BUG_COURIER_IPI_INIT_FAILED) /* courier/common/epilogue.c */ +BUGDEF(BUG_COURIER_IPI_REENABLE_FAILED) /* courier/common/epilogue.c */ +BUGDEF(BUG_COURIER_OSPF_INIT_FAILED) /* courier/common/epilogue.c */ +BUGDEF(BUG_COURIER_OSPF_RCV_NO_IFB) /* courier/common/epilogue.c */ +BUGDEF(BUG_COURIER_OSPF_RCV_IFB_DOWN) /* courier/common/epilogue.c */ +BUGDEF(BUG_COURIER_RIP_RCV_NO_IFB) /* courier/common/udp_ut.c */ +BUGDEF(BUG_COURIER_RIP_RCV_IFB_DOWN) /* courier/common/udp_ut.c */ +BUGDEF(BUG_IF_ATTACH_IFB_CREATE_FAILED) /* attache/net/if.c */ +BUGDEF(BUG_COURIER_TCP_CANT_ALLOCATE_TCB) /* courier/common/tcp_ut.c */ +BUGDEF(BUG_COURIER_TCP_CANT_BIND_HOST_PASSIVE) /* courier/common/tcp_ut.c */ +BUGDEF(BUG_COURIER_TCP_MULTIPLE_LISTENS) /* courier/common/tcp_ut.c */ +BUGDEF(BUG_COURIER_TCP_START_FAILED) /* courier/common/tcp_ut.c */ +BUGDEF(BUG_COURIER_FATAL_ERROR) /* courier/sys_incl.h */ +BUGDEF(BUG_DECORUM_BAD_DATE_TYPE) /* decorum/http/date.c */ +BUGDEF(BUG_DECORUM_BAD_VERSION) /* (unused) */ +BUGDEF(BUG_DECORUM_CLIENT_ERROR) /* decorum/http/http.c */ +BUGDEF(BUG_DECORUM_ENV_DUPLICATE_NAME) /* decorum/http/envcfg.c */ +BUGDEF(BUG_DECORUM_INFO) /* decorum/http/xxx.c */ +BUGDEF(BUG_DECORUM_MISSING_INBUF) /* (unused) */ +BUGDEF(BUG_DECORUM_NO_DATE) /* decorum/http/date.c */ +BUGDEF(BUG_DECORUM_UNEXPECTED_ERR) /* decorum/http/xxx.c */ +BUGDEF(BUG_DECORUM_XATTACHE_ERROR) /* decorum/http/xattache.c */ +BUGDEF(BUG_DECORUM_XATTACHE_INFO) /* decorum/http/xattache.c */ +BUGDEF(BUG_LIAISON_CANT_BIND_OBJECT) /* liaison/xrmon/xsnmp.c */ +BUGDEF(BUG_LIAISON_UNKNOWN_OBJECT) /* liaison/xrmon/xsnmp.c */ +BUGDEF(BUG_LIAISON_CANT_ENCODE_TRAP) /* liaison/xrmon/xsnmp.c */ +BUGDEF(BUG_SNARK_UNEXPECTED_EOF) /* snark/test/main.c */ +BUGDEF(BUG_TCP_ACK_DATA_FREEING) /* attache/net/tcp_rcv.c */ +BUGDEF(BUG_TCP_ACK_DATA_HUSHING) /* attache/net/tcp_rcv.c */ +BUGDEF(BUG_TCP_ACK_DATA_SQUEEZING) /* attache/net/tcp_rcv.c */ +BUGDEF(BUG_TCP_ACK_DATA_FAST_RETRANSMIT_DONE) /* attache/net/tcp_rcv.c */ +BUGDEF(BUG_TCP_CLOSE_INVALID_CONNECTION) /* attache/net/tcp.c */ +BUGDEF(BUG_TCP_CLOSE_INVALID_STATE) /* attache/net/tcp.c */ +BUGDEF(BUG_TCP_ENTER_FUNC) /* attache/net/tcpintnl.h */ +BUGDEF(BUG_TCP_GET_SND_MSS) /* attache/net/tcp_rcv.c */ +BUGDEF(BUG_TCP_HANDLE_ACK_DALLY) /* attache/net/tcp.c */ +BUGDEF(BUG_TCP_HANDLE_SWS_DALLY) /* attache/net/tcp.c */ +BUGDEF(BUG_TCP_POST_DATA_AHEAD) /* attache/net/tcp_rcv.c */ +BUGDEF(BUG_TCP_POST_DATA_OBSOLETE) /* attache/net/tcp_rcv.c */ +BUGDEF(BUG_TCP_POST_DATA_POSTING) /* attache/net/tcp_rcv.c */ +BUGDEF(BUG_TCP_PRINT_PKTHDR) /* attache/net/tcpintnl.h */ +BUGDEF(BUG_TCP_RCV_ACKED_UNSENT_DATA) /* attache/net/tcp_rcv.c */ +BUGDEF(BUG_TCP_RCV_ACKING_UNACCEPTABLE) /* attache/net/tcp_rcv.c */ +BUGDEF(BUG_TCP_RCV_LOG_PKT) /* attache/net/tcp_rcv.c */ +BUGDEF(BUG_TCP_RCV_REUSING_SAVED_PKT) /* attache/net/tcp_rcv.c */ +BUGDEF(BUG_TCP_RCV_SAVING_EARLY_PKT) /* attache/net/tcp_rcv.c */ +BUGDEF(BUG_TCP_RCV_SCHEDULING_ZERO_WINDOW_PROBE) /* attache/net/tcp_rcv.c */ +BUGDEF(BUG_TCP_RCV_FAST_RETRANSMIT_EQUAL) /* attache/net/tcp_rcv.c */ +BUGDEF(BUG_TCP_RCV_FAST_RETRANSMIT_GREATER) /* attache/net/tcp_rcv.c */ +BUGDEF(BUG_TCP_RETRANSMIT_HANDLER) /* attache/net/tcp_send.c */ +BUGDEF(BUG_TCP_RTT_LOG_1) /* attache/net/tcp_rcv.c */ +BUGDEF(BUG_TCP_RTT_LOG_2) /* attache/net/tcp_rcv.c */ +BUGDEF(BUG_TCP_SEND_COPYING) /* attache/net/tcp_send.c */ +BUGDEF(BUG_TCP_SEND_DECIDED_TO_SEND) /* attache/net/tcp_send.c */ +BUGDEF(BUG_TCP_SEND_ENTRY_LOG) /* attache/net/tcp_send.c */ +BUGDEF(BUG_TCP_SEND_FORBIDDEN_BY_SWS) /* attache/net/tcp_send.c */ +BUGDEF(BUG_TCP_SEND_LOG_PKT) /* attache/net/tcp_send.c */ +BUGDEF(BUG_TCP_SEND_NEW_DATA_BEYOND_WINDOW) /* attache/net/tcp_send.c */ +BUGDEF(BUG_TCP_SEND_NOTHING_TO_DO) /* attache/net/tcp_send.c */ +BUGDEF(BUG_TCP_SEND_PKTALLOC_FAILED) /* attache/net/tcp_send.c */ +BUGDEF(BUG_TCP_SEND_SCHEDULING_RETRANSMISSION) /* attache/net/tcp_send.c */ +BUGDEF(BUG_TCP_SET_ACK_DALLY) /* attache/net/tcp.c */ +BUGDEF(BUG_TCP_SET_RCV_MSS) /* attache/net/tcp_send.c */ +BUGDEF(BUG_TCP_SET_SWS_DALLY) /* attache/net/tcp.c */ +BUGDEF(BUG_TCP_SET_TIME_WAIT) /* attache/net/tcp.c */ +BUGDEF(BUG_TFTP_BAD_PORT) /* attache/net/tftpc.c */ +BUGDEF(BUG_TFTP_CNXN_NOTFOUND) /* attache/net/tftpc.c */ +BUGDEF(BUG_TFTP_ALLOC_PKT_FAIL) /* attache/net/tftpc.c */ +BUGDEF(BUG_TFTP_ALLOC_MEM_FAIL) /* attache/net/tftpc.c */ +BUGDEF(BUG_TFTP_TIMEOUT) /* attache/net/tftpc.c */ +BUGDEF(BUG_TFTP_WRONG_ACK) /* attache/net/tftpc.c */ +BUGDEF(BUG_TFTP_WRONG_BLOCK) /* attache/net/tftpc.c */ +BUGDEF(BUG_IP_RCV_UNRECOGNIZED_IP_VERSION) /* attache/net/ip_rcv.c */ +BUGDEF(BUG_PKT_APPEND_OVERFLOW) /* attache/h/packet.h */ +BUGDEF(BUG_IPADDR_TEST_UNKNOWN_CODE) /* attache/net/ipaddr.c */ +BUGDEF(BUG_PPP_CHAP_PKT_ALLOC_FAILED) /* attache/net/pppchap.c */ +BUGDEF(BUG_ATTACHE_PPP_LCP_BAD_TIMEOUT) /* attache/net/ppp.c */ +BUGDEF(BUG_ATTACHE_PPP_IPCP_BAD_TIMEOUT) /* attache/net/ppp.c */ +BUGDEF(BUG_ATTACHE_PPP_LCP_EVENT) /* attache/net/ppp.c */ +BUGDEF(BUG_ATTACHE_PPP_IPCP_EVENT) /* attache/net/ppp.c */ +BUGDEF(BUG_SNARK_PPP_AUTH_STATUS) /* snark/lib/netconf.c */ +BUGDEF(BUG_PPP_CHAP_CHALLENGE_TIMEOUT) /* attache/net/pppchap.c */ +BUGDEF(BUG_PPP_CHAP_SERVER_UNEXPECTED_STATE) /* attache/net/pppchap.c */ +BUGDEF(BUG_PPP_CHAP_CLIENT_UNEXPECTED_STATE) /* attache/net/pppchap.c */ +BUGDEF(BUG_PPP_AUTH_ALLOC_FAILED) /* attache/net/pppauth.c */ +BUGDEF(BUG_PPP_AUTH_BAD_FLAGS) /* attache/net/pppauth.c */ +BUGDEF(BUG_PPP_CHAP_SERVER_ENABLED) /* attache/net/ppplcp.c */ +BUGDEF(BUG_PPP_PAP_SERVER_ENABLED) /* attache/net/ppplcp.c */ +BUGDEF(BUG_PPP_NEGOTIATING_CHAP) /* attache/net/ppplcp.c */ +BUGDEF(BUG_PPP_NEGOTIATING_PAP) /* attache/net/ppplcp.c */ +BUGDEF(BUG_PPP_LCP_UNKNOWN_NAK) /* attache/net/ppplcp.c */ +BUGDEF(BUG_PPP_LCP_UNKNOWN_REQ) /* attache/net/ppplcp.c */ +BUGDEF(BUG_PPP_LCP_RCV) /* attache/net/ppplcp.c */ +BUGDEF(BUG_PPP_PAP_CLIENT_UNEXPECTED_STATE) /* attache/net/ppppap.c */ +BUGDEF(BUG_PPP_PAP_PKT_ALLOC_FAILED) /* attache/net/ppppap.c */ +BUGDEF(BUG_PPP_PAP_REQUEST_TIMEOUT) /* attache/net/ppppap.c */ +BUGDEF(BUG_PPP_PAP_SERVER_UNEXPECTED_STATE) /* attache/net/ppppap.c */ +BUGDEF(BUG_ENVOY_LOCKING) /* envoy/snmp */ +BUGDEF(BUG_ENVOY_INSUFFICIENT_MEMORY) /* envoy/snmp */ +BUGDEF(BUG_DHCP_STATE_TRACE) /* attache/net/dhcp.c */ +BUGDEF(BUG_DHCP_TIMER_TRACE) /* attache/net/dhcp.c */ +BUGDEF(BUG_ET_RCV_TRACE) /* attache/net/et_rcv.c */ +BUGDEF(BUG_ET_SEND_TRACE) /* attache/net/et_send.c */ +BUGDEF(BUG_IF_SEND_TRACE) /* attache/net/if.c */ +BUGDEF(BUG_IP_RCV_TRACE) /* attache/net/ip_rcv.c */ +BUGDEF(BUG_IP_SEND_TRACE) /* attache/net/ip_send.c */ +BUGDEF(BUG_ICMP_RCV_TRACE) /* attache/net/icmp.c */ +BUGDEF(BUG_ICMP_SEND_TRACE) /* attache/net/icmp.c */ +BUGDEF(BUG_IP_RTE_TRACE) /* attache/net/ip_rte.c */ +BUGDEF(BUG_ATTACHE_PSOS_NIDRV_INFO) /* attache/psos support */ +BUGDEF(BUG_SNARK_PSOSTTY_INFO) /* snark/psostty.c */ +BUGDEF(BUG_ARP_SEND_REQUEST) /* attache/net/arp.c */ +BUGDEF(BUG_ARP_SEND) /* attache/net/arp.c */ +BUGDEF(BUG_ET_ARP_SEND_TRACE) /* attache/net/et_send.c*/ +BUGDEF(BUG_ARP_RCV_TRACE) /* attache/net/arp.c */ +BUGDEF(BUG_SNARK_FIREWALL_CONFIG_ALLOC_FAILED) /* snark/lib/firewall.c */ +BUGDEF(BUG_SNARK_FIREWALL_CONFIG_PARSE_ERROR) /* snark/lib/firewall.c */ +BUGDEF(BUG_SNARK_FIREWALL_ALLOW_PKT) /* snark/lib/firewall.c */ +BUGDEF(BUG_SNARK_FIREWALL_DROP_PKT) /* snark/lib/firewall.c */ +BUGDEF(BUG_SNARK_FIREWALL_RESET_PKT) /* snark/lib/firewall.c */ +BUGDEF(BUG_SNARK_TUN_ERROR) /* snark/lib/tun.c */ +BUGDEF(BUG_THREAD_TRACE) /* common/lib/thread_debug.c */ +BUGDEF(BUG_SOCKET_ENTER_FUNC) /* attache/sockets/sockintl.h */ +BUGDEF(BUG_SOCKET_TRACE) /* attache/sockets/sockintl.h */ +BUGDEF(BUG_SOCKET_ACCEPT_EMFILE) /* attache/sockets/socktcp.c */ +BUGDEF(BUG_SOCKET_ALLOC) /* attache/sockets/socktcp.c */ +BUGDEF(BUG_SOCKET_LISTEN_BACKLOG) /* attache/sockets/socktcp.c */ +BUGDEF(BUG_SOCKET_RCVQ_EMPTY) /* attache/sockets/socktcp.c */ +BUGDEF(BUG_SOCKET_UPCALL_BAD_SOCKET) /* attache/sockets/socktcp.c */ +BUGDEF(BUG_SOCKET_UPCALL_BAD_STATE) /* attache/sockets/socktcp.c */ +BUGDEF(BUG_SOCKET_UPCALL_BAD_CV) /* attache/sockets/socktcp.c */ +BUGDEF(BUG_SOCKET_UPCALL_DFQ_FULL) /* attache/sockets/socktcp.c */ +BUGDEF(BUG_SOCKET_UPCALL_RCVQ_FULL) /* attache/sockets/socktcp.c */ +BUGDEF(BUG_SOCKET_UPCALL_SHUTDOWN) /* attache/sockets/socktcp.c */ +BUGDEF(BUG_SOCKET_UPCALL_CLOSING) /* attache/sockets/socktcp.c */ +BUGDEF(BUG_SOCKET_IOCTL_ADD_ROUTE) /* attache/sockets/sockif.c */ +BUGDEF(BUG_SOCKET_IOCTL_DEL_ROUTE) /* attache/sockets/sockif.c */ +BUGDEF(BUG_SNMP_RCV_TRACE) /* attache/net/snmpfunc.c */ +BUGDEF(BUG_IPV6_SEND_TRACE) /* attache/net/ip6_send.c */ +BUGDEF(BUG_IPV6_SEND_ERROR) /* attache/net/ip6_send.c */ +BUGDEF(BUG_IPV6_RCV_TRACE) /* attache/net/ip6_rcv.c */ +BUGDEF(BUG_IPV6_RCV_ERROR) /* attache/net/ip6_rcv.c */ +BUGDEF(BUG_IPV6_CKSUM_TRACE) /* attache/net/ip6_cksum.c */ +BUGDEF(BUG_IPV6_ICMP_TRACE) /* attache/net/icmpv6.c */ +BUGDEF(BUG_IPV6_ICMP_ERROR) /* attache/net/icmpv6.c */ +BUGDEF(BUG_IPV6_DAD_TRACE) /* attache/net/ip6_cfg.c */ +BUGDEF(BUG_IPV6_DAD_ERROR) /* attache/net/ip6_cfg.c */ +BUGDEF(BUG_IPV6_ND_TRACE) /* attache/net/ip6_nd.c */ +BUGDEF(BUG_IPV6_ND_ERROR) /* attache/net/ip6_nd.c */ +BUGDEF(BUG_IPV6_RD_TRACE) /* attache/net/ip6_rd.c */ +BUGDEF(BUG_IPV6_RD_ERROR) /* attache/net/ip6_rd.c */ +BUGDEF(BUG_IPV6_RDRT_TRACE) /* attache/net/ip6_rdrt.c */ +BUGDEF(BUG_IPV6_RDRT_ERROR) /* attache/net/ip6_rdrt.c */ +BUGDEF(BUG_IPV6_FRAG_TRACE) /* attache/net/ip6_frag.c */ +BUGDEF(BUG_IPV6_FRAG_ERROR) /* attache/net/ip6_frag.c */ +BUGDEF(BUG_PKT_DUP_ALLOC_FAILED) /* attache/net/ip_rcv.c */ +BUGDEF(BUG_MEMPOOL_TRACE) /* snark/lib/pool.c */ +BUGDEF(BUG_ATTACHE_PSOS_THREAD_INFO) /* attache/psos/thread.c */ +/* End of bugdef.h */ diff --git a/h/wrn/wm/common/cmn_init.h b/h/wrn/wm/common/cmn_init.h new file mode 100644 index 0000000..0a47421 --- /dev/null +++ b/h/wrn/wm/common/cmn_init.h @@ -0,0 +1,118 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/common/cmn_init.h,v 1.3 2003/01/16 18:20:11 josh Exp $ */ + + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: cmn_init.h,v $ + * Revision 1.3 2003/01/16 18:20:11 josh + * directory structure shifting + * + * Revision 1.2 2001/11/07 00:07:09 meister + * Rework pathnames again + * + * Revision 1.1.1.1 2001/11/05 17:47:18 tneale + * Tornado shuffle + * + * Revision 1.10 2001/01/19 22:21:27 paul + * Update copyright. + * + * Revision 1.9 2000/03/17 00:16:35 meister + * Update copyright message + * + * Revision 1.8 2000/03/09 19:09:22 josh + * changes so we don't shoot ourselves in the foot if we're building + * Emissary or Liaison + * + * Revision 1.7 1998/09/11 16:30:40 paul + * Auto-initialize common library. + * + * Revision 1.6 1998/06/19 20:46:29 sra + * Minor cleanups to crypto code installation options. + * + * Revision 1.5 1998/02/25 04:43:25 sra + * Update copyrights. + * + * Revision 1.4 1997/10/30 16:44:29 sra + * Fix copyright date. + * + * Revision 1.3 1997/10/15 19:45:14 sra + * Cleanup. + * + * Revision 1.2 1997/08/14 16:04:37 lowell + * boilerplate + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef EPILOGUE_INSTALL_H +#include +#endif + +extern void etc_common_init(void); /* init the common library */ + +/* + * The purpose of the following incantations is to make sure that exactly + * one Epilogue product initializes the common library. The decision of + * which product should do the initialization is made at compile time, + * according to the following if/else-if/else chain. The intent is to + * keep all of the control of how this happens localized in one place. + */ + +#if defined(INSTALL_ATTACHE) && INSTALL_ATTACHE +#define COMMON_INIT_FROM_ATTACHE() etc_common_init() +#elif defined(INSTALL_ENVOY) && INSTALL_ENVOY +#define COMMON_INIT_FROM_ENVOY() etc_common_init() +#elif defined(INSTALL_COURIER) && INSTALL_COURIER +#define COMMON_INIT_FROM_COURIER() etc_common_init() +#elif defined(INSTALL_DECORUM) && INSTALL_DECORUM +#define COMMON_INIT_FROM_DECORUM() etc_common_init() +#elif defined(INSTALL_LIAISON) && INSTALL_LIAISON +#define COMMON_INIT_FROM_LIAISON() etc_common_init() +#elif defined(INSTALL_EMISSARY) && INSTALL_EMISSARY +/* We don't care in this case... */ +#else +#error Internal error! Nobody calls etc_common_init()! +#endif + +#ifndef COMMON_INIT_FROM_ATTACHE +#define COMMON_INIT_FROM_ATTACHE() +#endif + +#ifndef COMMON_INIT_FROM_ENVOY +#define COMMON_INIT_FROM_ENVOY() +#endif + +#ifndef COMMON_INIT_FROM_COURIER +#define COMMON_INIT_FROM_COURIER() +#endif + +#ifndef COMMON_INIT_FROM_DECORUM +#define COMMON_INIT_FROM_DECORUM() +#endif + +#ifndef COMMON_INIT_FROM_LIAISON +#define COMMON_INIT_FROM_LIAISON() +#endif + + diff --git a/h/wrn/wm/common/config.h b/h/wrn/wm/common/config.h new file mode 100644 index 0000000..aa0c741 --- /dev/null +++ b/h/wrn/wm/common/config.h @@ -0,0 +1,82 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/common/config.h,v 1.3 2003/01/16 18:20:11 josh Exp $ */ + + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: config.h,v $ + * Revision 1.3 2003/01/16 18:20:11 josh + * directory structure shifting + * + * Revision 1.2 2001/11/07 00:07:09 meister + * Rework pathnames again + * + * Revision 1.1.1.1 2001/11/05 17:47:18 tneale + * Tornado shuffle + * + * Revision 1.9 2001/01/19 22:21:27 paul + * Update copyright. + * + * Revision 1.8 2000/03/17 00:16:35 meister + * Update copyright message + * + * Revision 1.7 1998/02/25 04:43:25 sra + * Update copyrights. + * + * Revision 1.6 1998/02/05 22:37:35 josh + * Changing references to types.h so we include common/h/types.h instead + * + * Revision 1.5 1997/08/21 17:23:42 sra + * Begin moving configuration stuff that's common to all products to common.h + * Minor cleanups to common/lib/prng.c. Add pnrg seed function to snarkbsd. + * + * Revision 1.4 1997/08/14 16:04:38 lowell + * boilerplate + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef COMMON_CONFIG_H +#define COMMON_CONFIG_H + +/* + * Grab the standard top-level includes. + */ + +#ifndef EPILOGUE_INSTALL_H +#include +#endif + +#ifndef EPILOGUE_TYPES_H +#include +#endif + +/* + * Load the preamble portion of the customer's common.h file. + */ + +#define CONFIG_PREAMBLE 1 +#include +#undef CONFIG_PREAMBLE + +#endif /* COMMON_CONFIG_H */ diff --git a/h/wrn/wm/common/des.h b/h/wrn/wm/common/des.h new file mode 100644 index 0000000..97c28e0 --- /dev/null +++ b/h/wrn/wm/common/des.h @@ -0,0 +1,93 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/common/des.h,v 1.3 2003/01/16 18:20:11 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1988-1997 Epilogue Technology Corporation. + * All rights reserved. + ****************************************************************************/ + +/* + * this DES implementation derived from Phil Karns public domain DES. + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef EPILOGUE_DES_H +#define EPILOGUE_DES_H + +#ifdef __cplusplus +extern"C" { +#endif + +#ifndef EPILOGUE_TYPES_H +#include +#endif +#ifndef EPILOGUE_INSTALL_H +#include +#endif + +typedef bits32_t DES_KS[16][2]; /* Single-key DES key schedule */ +typedef bits32_t DES3_KS[48][2]; /* Triple-DES key schedule */ + +typedef struct +{ int decrypt; + DES_KS keysched; + bits8_t iv [8]; +} DES_CTX; + +#if INSTALL_COMMON_3DES + +typedef struct +{ int decrypt; + DES3_KS keysched; + bits8_t iv [8]; +} DES3_CTX; + +#endif /* INSTALL_COMMON_3DES */ + +#ifndef _EXCLUDE_PROTOTYPES_ + +int des_is_real(void); +void deskey (DES_KS, bits8_t *,int); +void des (DES_KS, bits8_t *, bits8_t *); +void desecb_block_encrypt (DES_CTX *ctx, bits8_t *in, bits8_t *out); +void descbc_block_decrypt (DES_CTX *ctx, bits8_t *in, bits8_t *out); +void descbc_block_encrypt (DES_CTX *ctx, bits8_t *in, bits8_t *out); +void descbc_init_context (void *ctx, bits8_t *key, int decrypt); +void descbc_iv_context (void *ctx, bits8_t *iv); +void descbc_crypt (void *ctx, bits8_t *in, bits8_t *out, bits32_t n); + +#if INSTALL_COMMON_3DES +void des3key (DES3_KS, bits8_t *,int); +void des3 (DES3_KS, bits8_t *, bits8_t *); +void des3cbc_block_decrypt (DES3_CTX *ctx, bits8_t *in, bits8_t *out); +void des3cbc_block_encrypt (DES3_CTX *ctx, bits8_t *in, bits8_t *out); +void des3cbc_init_context (void *ctx, bits8_t *key, int decrypt); +void des3cbc_iv_context (void *ctx, bits8_t *iv); +void des3cbc_crypt (void *ctx, bits8_t *in, bits8_t *out, bits32_t n); +#endif /* INSTALL_COMMON_3DES */ + +#endif /* ifndef _EXCLUDE_PROTOTYPES_ */ + +#ifdef __cplusplus +} +#endif + +#endif /* EPILOGUE_DES_H */ + + + diff --git a/h/wrn/wm/common/dyncfg.h b/h/wrn/wm/common/dyncfg.h new file mode 100644 index 0000000..51df6d4 --- /dev/null +++ b/h/wrn/wm/common/dyncfg.h @@ -0,0 +1,333 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/common/dyncfg.h,v 1.2 2003/01/16 18:20:11 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1988-1997 Epilogue Technology Corporation. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: dyncfg.h,v $ + * Revision 1.2 2003/01/16 18:20:11 josh + * directory structure shifting + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef COMMON_DYNCFG_H +# define COMMON_DYNCFG_H 1 + +/* + * see example of usage at end of file + */ + +#if INSTALL_COMMON_DYNAMIC_COMP_CONFIG + +/* + * macros for declaring the function pointers which will be used by + * the dynamic component code. Each is of the form + * DYNCFG_FUNCPTR(,,,...) + * + * Variants for declaring it to be global, static to file, or extern. + * Current code which references a function which may be in a component which + * may not be loaded, must be changed to call the function via a pointer + * dereference, the pointer having been declared via one of these macros. + * + * These macros evaluate to nothing if INSTALL_COMMON_DYNAMIC_COMP_CONFIG + * is turned off. + */ + +#define DYNCFG_FUNCPTR0(X,rval) \ + rval (*DYN_PTR_##X) (); +#define DYNCFG_STATIC_FUNCPTR0(X,rval) \ + static rval (*DYN_PTR_##X) (); +#define DYNCFG_EXTERN_FUNCPTR0(X,rval) \ + extern rval (*DYN_PTR_##X) (); + +#define DYNCFG_FUNCPTR1(X,rval,a1) \ + rval (*DYN_PTR_##X) (a1); +#define DYNCFG_STATIC_FUNCPTR1(X,rval,a1) \ + static rval (*DYN_PTR_##X) (a1); +#define DYNCFG_EXTERN_FUNCPTR1(X,rval,a1) \ + extern rval (*DYN_PTR_##X) (a1); + +#define DYNCFG_FUNCPTR2(X,rval,a1,a2) \ + rval (*DYN_PTR_##X) (a1, a2); +#define DYNCFG_STATIC_FUNCPTR2(X,rval,a1,a2) \ + static rval (*DYN_PTR_##X) (a1, a2); +#define DYNCFG_EXTERN_FUNCPTR2(X,rval,a1,a2) \ + extern rval (*DYN_PTR_##X) (a1, a2); + +#define DYNCFG_FUNCPTR3(X,rval,a1,a2,a3) \ + rval (*DYN_PTR_##X) (a1, a2, a3); +#define DYNCFG_STATIC_FUNCPTR3(X,rval,a1,a2,a3) \ + static rval (*DYN_PTR_##X) (a1, a2, a3); +#define DYNCFG_EXTERN_FUNCPTR3(X,rval,a1,a2,a3) \ + extern rval (*DYN_PTR_##X) (a1, a2, a3); + +#define DYNCFG_FUNCPTR4(X,rval,a1,a2,a3, a4) \ + rval (*DYN_PTR_##X) (a1, a2, a3, a4); +#define DYNCFG_STATIC_FUNCPTR4(X,rval,a1,a2,a3,a4) \ + static rval (*DYN_PTR_##X) (a1, a2, a3, a4); +#define DYNCFG_EXTERN_FUNCPTR4(X,rval,a1,a2,a3,a4) \ + extern rval (*DYN_PTR_##X) (a1, a2, a3, a4); + +#define DYNCFG_FUNCPTR5(X,rval,a1,a2,a3,a4,a5) \ + rval (*DYN_PTR_##X) (a1, a2, a3, a4, a5); +#define DYNCFG_STATIC_FUNCPTR5(X,rval,a1,a2,a3,a4,a5) \ + static rval (*DYN_PTR_##X) (a1, a2, a3, a4, a5); +#define DYNCFG_EXTERN_FUNCPTR5(X,rval,a1,a2,a3,a4,a5) \ + extern rval (*DYN_PTR_##X) (a1, a2, a3, a4, a5); + +#define DYNCFG_FUNCPTR6(X,rval,a1,a2,a3,a4,a5,a6) \ + rval (*DYN_PTR_##X) (a1, a2, a3, a4, a5, a6); +#define DYNCFG_STATIC_FUNCPTR6(X,rval,a1,a2,a3,a4,a5,a6) \ + static rval (*DYN_PTR_##X) (a1, a2, a3, a4, a5, a6); +#define DYNCFG_EXTERN_FUNCPTR6(X,rval,a1,a2,a3,a4,a5,a6) \ + extern rval (*DYN_PTR_##X) (a1, a2, a3, a4, a5, a6); + +#define DYNCFG_FUNCPTR7(X,rval,a1,a2,a3,a4,a5,a6,a7) \ + rval (*DYN_PTR_##X) (a1, a2, a3, a4, a5, a6, a7); +#define DYNCFG_STATIC_FUNCPTR7(X,rval,a1,a2,a3,a4,a5,a6,a7) \ + static rval (*DYN_PTR_##X) (a1, a2, a3, a4, a5, a6, a7); +#define DYNCFG_EXTERN_FUNCPTR7(X,rval,a1,a2,a3,a4,a5,a6,a7) \ + extern rval (*DYN_PTR_##X) (a1, a2, a3, a4, a5, a6, a7); + +#define DYNCFG_FUNCPTR8(X,rval,a1,a2,a3,a4,a5,a6,a7,a8) \ + rval (*DYN_PTR_##X) (a1, a2, a3, a4, a5, a6, a7, a8); +#define DYNCFG_STATIC_FUNCPTR8(X,rval,a1,a2,a3,a4,a5,a6,a7,a8) \ + static rval (*DYN_PTR_##X) (a1, a2, a3, a4, a5, a6, a7, a8); +#define DYNCFG_EXTERN_FUNCPTR8(X,rval,a1,a2,a3,a4,a5,a6,a7,a8) \ + extern rval (*DYN_PTR_##X) (a1, a2, a3, a4, a5, a6, a7, a8); + +#define DYNCFG_FUNCPTR9(X,rval,a1,a2,a3,a4,a5,a6,a7,a8,a9) \ + rval (*DYN_PTR_##X) (a1, a2, a3, a4, a5, a6, a7, a8, a9); +#define DYNCFG_STATIC_FUNCPTR9(X,rval,a1,a2,a3,a4,a5,a6,a7,a8,a9) \ + static rval (*DYN_PTR_##X) (a1, a2, a3, a4, a5, a6, a7, a8, a9); +#define DYNCFG_EXTERN_FUNCPTR9(X,rval,a1,a2,a3,a4,a5,a6,a7,a8,a9) \ + extern rval (*DYN_PTR_##X) (a1, a2, a3, a4, a5, a6, a7, a8, a9); + +#define DYNCFG_FUNCPTR10(X, rval, a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) \ + rval (*DYN_PTR_##X) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); +#define DYNCFG_STATIC_FUNCPTR10(X,rval,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) \ + static rval (*DYN_PTR_##X) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); +#define DYNCFG_EXTERN_FUNCPTR10(X,rval,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) \ + extern rval (*DYN_PTR_##X) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + +/* + * This macro provides the mechanism for calling a function which may be in a + * non-installed component. If INSTALL_COMMON_DYNAMIC_COMP_CONFIG is not + * installed, it evaluates to a normal function call, calling X in the usual + * way. + */ + +#define DYNCFG_FUNCALL(X) (*DYN_PTR_##X) + +/* + * This macro returns the actual function pointer itself. + */ + +#define DYNCFG_FUNCPTR(X) DYN_PTR_##X + +/* + * this macro sets a previously declared (by DYNCFG_*_FUNCPTR?()) to its + * most likely default, the name of the function we named it after. + */ + +#define DYNCFG_FUNCPTR_SET_DEFAULT(X) DYN_PTR_##X = X + +/* + * this macro sets a previously declared (by DYNCFG_*_FUNCPTR?()) to + * something other than the probable default + */ + +#define DYNCFG_FUNCPTR_SET(X,Y) DYN_PTR_##X = Y + + +/* + * these macros are for declaring variable pointers which will be used by + * dynamic component code, which may need to reference a variable which will + * only exist if a specific component is included. + * + * Variants for declaring it to be global, static to file, or extern. + * Current code which references a variable which may be in a component which + * may not be loaded, must be changed to reference the variable via a pointer + * dereference, the pointer having been declared via one of these macros. + * + * These macros evaluate to nothing if INSTALL_COMMON_DYNAMIC_COMP_CONFIG + * is turned off. + */ + +#define DYNCFG_VBLPTR(X,type) type *DYNCFG_VPTR_##X; +#define DYNCFG_VBLPTR_STATIC(X,type) static type *DYNCFG_VPTR_##X; +#define DYNCFG_VBLPTR_EXTERN(X,type) extern type *DYNCFG_VPTR_##X; + +/* + * This macro provides the mechanism for referring to a variable which may be + * in a non-installed component. + * If INSTALL_COMMON_DYNAMIC_COMP_CONFIG is not + * installed, it evaluates to a normal variable reference. + */ + +#define DYNCFG_VREF(X) (*DYNCFG_VPTR_##X) + +/* + * these macros are for delimiting blocks of code which are currently delimited + * by #if directives. They arrange for the block of code to + * be enclosed by a if (DYNCFG_VBL_label) { } construct. You then compile the + * code for the dynamic component case by turning on both the + * and INSTALL_COMMON_DYNAMIC_COMP_CONFIG. + * These macros evaluate to nothing if INSTALL_COMMON_DYNAMIC_COMP_CONFIG is + * turned off. + * + * DYNCFG_IFCFGVBL_END(X) and DYNCFG_IFNOTCFGVBL_END(X) both take an argument + * solely to make the code more readable. + */ + +#define DYNCFG_IFCFGVBL_BEGIN(X) if (DYNCFG_VBL_##X) { +#define DYNCFG_IFNOTCFGVBL_BEGIN(X) if (!DYNCFG_VBL_##X) { +#define DYNCFG_IFCFGVBL_ELSE(X) } else { +#define DYNCFG_IFNOTCFGVBL_ELSE(X) } else { +#define DYNCFG_IFCFGVBL_ELSEDEFAULT(X) } else { goto default; } +#define DYNCFG_IFCFGVBL_END(X) } +#define DYNCFG_IFNOTCFGVBL_END(X) } + +/* + * These macros provide the mechanism to declare the variables which are + * used in the above code enclusure macros. They evaluate to nothing if + * INSTALL_COMMON_DYNAMIC_COMP_CONFIG is turned off. + */ + +#define DYNCFG_VBL_DECLARE_EXTERN(X) extern int DYNCFG_VBL_##X; +#define DYNCFG_VBL_DECLARE_GLOBAL(X) int DYNCFG_VBL_##X; +#define DYNCFG_VBL_DECLARE_STATIC(X) static int DYNCFG_VBL_##X; + +/* + * Use this macro to set one of these config variables to some value "val" + */ + +#define DYNCFG_VBL_SET(X,val) DYNCFG_VBL_##X = val + +/* + * this macro returns the actual variable itself + */ + +#define DYNCFG_VBL(X) DYNCFG_VBL_##X + +#else + +#define DYNCFG_FUNCPTR0(X,rval) +#define DYNCFG_STATIC_FUNCPTR0(X,rval) +#define DYNCFG_EXTERN_FUNCPTR0(X,rval) + +#define DYNCFG_FUNCPTR1(X,rval,a1) +#define DYNCFG_STATIC_FUNCPTR1(X,rval,a1) +#define DYNCFG_EXTERN_FUNCPTR1(X,rval,a1) + +#define DYNCFG_FUNCPTR2(X,rval,a1,a2) +#define DYNCFG_STATIC_FUNCPTR2(X,rval,a1,a2) +#define DYNCFG_EXTERN_FUNCPTR2(X,rval,a1,a2) + +#define DYNCFG_FUNCPTR3(X,rval,a1,a2,a3) +#define DYNCFG_STATIC_FUNCPTR3(X,rval,a1,a2,a3) +#define DYNCFG_EXTERN_FUNCPTR3(X,rval,a1,a2,a3) + +#define DYNCFG_FUNCPTR4(X,rval,a1,a2,a3, a4) +#define DYNCFG_STATIC_FUNCPTR4(X,rval,a1,a2,a3, a4) +#define DYNCFG_EXTERN_FUNCPTR4(X,rval,a1,a2,a3, a4) + +#define DYNCFG_FUNCPTR5(X,rval,a1,a2,a3, a4, a5) +#define DYNCFG_STATIC_FUNCPTR5(X,rval,a1,a2,a3, a4, a5) +#define DYNCFG_EXTERN_FUNCPTR5(X,rval,a1,a2,a3, a4, a5) + +#define DYNCFG_FUNCPTR6(X,rval,a1,a2,a3, a4, a5, a6) +#define DYNCFG_STATIC_FUNCPTR6(X,rval,a1,a2,a3, a4, a5, a6) +#define DYNCFG_EXTERN_FUNCPTR6(X,rval,a1,a2,a3, a4, a5, a6) + +#define DYNCFG_FUNCPTR7(X,rval,a1,a2,a3, a4, a5, a6, a7) +#define DYNCFG_STATIC_FUNCPTR7(X,rval,a1,a2,a3, a4, a5, a6, a7) +#define DYNCFG_EXTERN_FUNCPTR7(X,rval,a1,a2,a3, a4, a5, a6, a7) + +#define DYNCFG_FUNCPTR8(X,rval,a1,a2,a3, a4, a5, a6, a7, a8) +#define DYNCFG_STATIC_FUNCPTR8(X,rval,a1,a2,a3, a4, a5, a6, a7, a8) +#define DYNCFG_EXTERN_FUNCPTR8(X,rval,a1,a2,a3, a4, a5, a6, a7, a8) + +#define DYNCFG_FUNCPTR9(X,rval,a1,a2,a3, a4, a5, a6, a7, a8, a9) +#define DYNCFG_STATIC_FUNCPTR9(X,rval,a1,a2,a3, a4, a5, a6, a7, a8, a9) +#define DYNCFG_EXTERN_FUNCPTR9(X,rval,a1,a2,a3, a4, a5, a6, a7, a8, a9) + +#define DYNCFG_FUNCPTR10(X,rval,a1,a2,a3, a4, a5, a6, a7, a8, a9, a10) +#define DYNCFG_STATIC_FUNCPTR10(X,rval,a1,a2,a3, a4, a5, a6, a7, a8, a9, a10) +#define DYNCFG_EXTERN_FUNCPTR10(X,rval,a1,a2,a3, a4, a5, a6, a7, a8, a9, a10) + +#define DYNCFG_FUNCALL(X) X + +#define DYNCFG_VBLPTR(X,type) +#define DYNCFG_VBLPTR_STATIC(X,type) +#define DYNCFG_VBLPTR_EXTERN(X,type) + +#define DYNCFG_VREF(X) X + +#define DYNCFG_IFCFGVBL_BEGIN(X) +#define DYNCFG_IFNOTCFGVBL_BEGIN(X) +#define DYNCFG_IFCFGVBL_ELSE(X) +#define DYNCFG_IFNOTCFGVBL_ELSE(X) +#define DYNCFG_IFCFGVBL_ELSEDEFAULT(X) +#define DYNCFG_IFCFGVBL_END(X) +#define DYNCFG_IFNOTCFGVBL_END(X) + +#define DYNCFG_VBL_DECLARE_EXTERN(X) +#define DYNCFG_VBL_DECLARE_GLOBAL(X) +#define DYNCFG_VBL_DECLARE_STATIC(X) + +#endif + +#endif /* COMMON_DYNCFG_H */ + +/* + * Example of usage: code which looked like: + * #if INSTALL_ENVOY_SNMP_VERSION_3 + * case SNMP_VERSION_3: + * Call_Func_In_V3_Component (a, b); + * break; + * #endif + * becomes: + * #if INSTALL_ENVOY_SNMP_VERSION_3 + * DYNCFG_IFCFGVBL_BEGIN(snmpv3_component) + * case SNMP_VERSION_3: + * DYN_FUNCALL(Call_Func_In_V3_Component) (a, b); + * break; + * DYNCFG_IFCFGVBL_BEGIN(snmpv3_component) + * #endif + * + * In order for the above to work, earlier in the same file we must have + * declarations for the test variables and function pointers. If + * + * If Call_Function_In_SNMPV3_Component () took 2 args, say, an (SNMP_PKT_T *) + * and an integer, and returns void: + * + * DYNCFG_EXTERN_FUNCPTR2(Call_Func_In_V3_Component,void,SNMP_PKT_T *, int) + * DYNCFG_VBL_DECLARE_EXTERN(snmpv3_component) + * + * Elsewhere in some other module, these must be declared with the non-EXTERN + * form of the macro, and initialized at startup by come component init + * routine. + */ + + + diff --git a/h/wrn/wm/common/fixed64.h b/h/wrn/wm/common/fixed64.h new file mode 100644 index 0000000..e2054b0 --- /dev/null +++ b/h/wrn/wm/common/fixed64.h @@ -0,0 +1,77 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/common/fixed64.h,v 1.3 2003/01/16 18:20:11 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + +/**************************************************************************** + * Copyright 1999 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * Fixed-point 64-bit math routines, intended primarily for time conversion + * between Attache milliseconds and pSOSystem "ticks". These routines + * are in the common library because they may be useful for other + * applications, but these functions are not a full-fleged 64-bit math + * library. + */ + +/* + * $Log: fixed64.h,v $ + * Revision 1.3 2003/01/16 18:20:11 josh + * directory structure shifting + * + * Revision 1.2 2001/11/07 00:07:09 meister + * Rework pathnames again + * + * Revision 1.1.1.1 2001/11/05 17:47:18 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:21:27 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:16:36 meister + * Update copyright message + * + * Revision 1.2 2000/03/09 17:15:39 tneale + * Added #idef C++ to declare extern C if needed + * + * Revision 1.1 1999/03/01 20:08:56 sra + * Add fixed-point 64-bit math routines; these are primarily intended for + * converting between Attache and pSOSystem clock values, but the + * functions themselves aren't specific to that. + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef COMMON_FIXED64_H +#define COMMON_FIXED64_H + +#ifdef __cplusplus +extern"C" { +#endif + +#ifndef EPILOGUE_TYPES_H +#include +#endif + +extern bits32_t fixed64_mul(bits32_t, bits32_t, bits32_t, bits32_t); +extern void fixed64_div(bits32_t, bits32_t, bits32_t *, bits32_t *); + +#ifdef __cplusplus +} +#endif + +#endif /* COMMON_FIXED64_H */ diff --git a/h/wrn/wm/common/fldmacro.h b/h/wrn/wm/common/fldmacro.h new file mode 100644 index 0000000..9bdfd4c --- /dev/null +++ b/h/wrn/wm/common/fldmacro.h @@ -0,0 +1,95 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/common/fldmacro.h,v 1.2 2003/01/16 18:20:12 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 2000-2001 Wind River Systems, Inc. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: fldmacro.h,v $ + * Revision 1.2 2003/01/16 18:20:12 josh + * directory structure shifting + * + * Revision 1.1.1.1 2001/11/05 17:47:18 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:21:27 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:16:37 meister + * Update copyright message + * + * Revision 1.2 1998/12/15 05:45:58 sra + * Get new NI interface code working on pSOS/X86. + * + * Revision 1.1 1998/12/09 21:48:44 sra + * Initial revision. + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef COMMON_FLDMACRO_H +#define COMMON_FLDMACRO_H + +/* + * Primative macros to get and set bitfields in an array of integers. + * Should work for either signed or unsigned integers, which means that + * these macros have to be very careful about right-shift operations. + * + * Parameters: + * + * _a_: "array" (name of array) + * _i_: "index" (offset into array) + * _w_: "width" (width in bits of the field) + * _p_: "position" (bit offset of field) + * _n_: "new_value" (replacement value, for sets) + * + * Macros: + * + * FLD_MSK() Construct mask _w_ bits wide, left shifted _p_ bits + * FLD_GET() Extract field to right justified value + * FLD_SET() Replace field content with right-justified value + * + * I would have preferred the index-and-mask mechanism we used back + * when all real programmers rode dinosaurs (bareback), because the + * masks are easier to sight-read than this position-and-width values, + * but the mask stuff is just too horrid when coded for the ANSI C + * preprocessor. I miss MIDAS.... + * + * These macros are intended primarily for use with IPC mechanisms like + * pSOS message queues. For network packets, see the layout directory. + */ + +#define FLD_MAX_WIDTH 32 + +#define FLD_MSK(_w_, _p_) ((~((~0UL) << (_w_))) << (_p_)) + +#define FLD_GET(_m_, _i_, _w_, _p_) \ + (((_w_) == FLD_MAX_WIDTH) \ + ? ((_m_)[_i_]) \ + : ((((_m_)[_i_]) >> (_p_)) & FLD_MSK(_w_, 0))) + +#define FLD_SET(_m_, _i_, _w_, _p_, _n_) \ + (((_m_)[_i_]) = (((_w_) == FLD_MAX_WIDTH) \ + ? (_n_) \ + : ((((_m_)[_i_]) & ~FLD_MSK(_w_, _p_)) | \ + (((_n_) & FLD_MSK(_w_, 0)) << (_p_))))) + +#endif /* COMMON_FLDMACRO_H */ diff --git a/h/wrn/wm/common/glue.h b/h/wrn/wm/common/glue.h new file mode 100644 index 0000000..71d47d0 --- /dev/null +++ b/h/wrn/wm/common/glue.h @@ -0,0 +1,194 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/common/glue.h,v 1.3 2003/01/16 18:20:12 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: glue.h,v $ + * Revision 1.3 2003/01/16 18:20:12 josh + * directory structure shifting + * + * Revision 1.2 2001/11/07 00:07:09 meister + * Rework pathnames again + * + * Revision 1.1.1.1 2001/11/05 17:47:18 tneale + * Tornado shuffle + * + * Revision 1.11 2001/01/19 22:21:28 paul + * Update copyright. + * + * Revision 1.10 2000/03/17 00:16:37 meister + * Update copyright message + * + * Revision 1.9 2000/03/09 19:09:22 josh + * changes so we don't shoot ourselves in the foot if we're building + * Emissary or Liaison + * + * Revision 1.8 1999/05/21 16:28:06 sra + * Fix snprintf() installation test. + * + * Revision 1.7 1999/05/20 22:14:50 wes + * If we're using the common snprintf, include its declaration here + * + * Revision 1.6 1999/05/20 21:05:54 sra + * Add SNPRINTF and VSNPRINTF. + * + * Revision 1.5 1998/07/03 20:19:22 sra + * Add etc_memcmp(). + * + * Revision 1.4 1998/06/05 17:14:11 meister + * STRNICMP takes 3 args, not two. + * + * Revision 1.3 1998/06/03 20:10:33 sar + * Added some common string functions. stdf.h has the externs for them + * while glue.h will use them if the user installs them and doesn't + * specify other functions to use. + * + * Revision 1.2 1998/02/25 04:43:25 sra + * Update copyrights. + * + * Revision 1.1 1997/08/21 17:23:43 sra + * Begin moving configuration stuff that's common to all products to common.h + * Minor cleanups to common/lib/prng.c. Add pnrg seed function to snarkbsd. + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef COMMON_GLUE_H +#define COMMON_GLUE_H + +/* + * Load the postamble portion of the customer's common.h file. + */ + +#include +#include + +#if INSTALL_COMMON_SNPRINTF +#include +#endif + +/* + * Default definitions for macros that stand in for ANSI functions. + * These may need to be fine-tuned after we've run some compilation tests. + */ + +#ifndef MEMCHR +#define MEMCHR(x,y,z) memchr(x,y,z) +#endif + +#ifndef MEMCMP +#if INSTALL_COMMON_MEMCMP +#define MEMCMP(x,y,z) etc_memcmp(x,y,z) +#else +#define MEMCMP(x,y,z) memcmp(x,y,z) +#endif +#endif + +#ifndef MEMCPY +#define MEMCPY(x,y,z) memcpy(x,y,z) +#endif + +#ifndef MEMSET +#define MEMSET(x,y,z) memset(x,y,z) +#endif + +#ifndef STRCMP +#define STRCMP(x,y) strcmp(x,y) +#endif + +#ifndef STRCPY +#define STRCPY(x,y) strcpy(x,y) +#endif + +#ifndef STRLEN +#define STRLEN(x) strlen(x) +#endif + +#ifndef STRNCMP +#define STRNCMP(x,y,z) strncmp(x,y,z) +#endif + +#ifndef STRTOL +#if (INSTALL_COMMON_STRTOL) +#define STRTOL(S, E, R) etc_strtol(S, E, R) +#else +#define STRTOL(S, E, R) strtol(S, E, R) +#endif +#endif + +#ifndef STRTOUL +#if (INSTALL_COMMON_STRTOUL) +#define STRTOUL(S, E, R) etc_strtoul(S, E, R) +#else +#define STRTOUL(S, E, R) strtoul(S, E, R) +#endif +#endif + +/* + * These two aren't ANSI functions, but their ANSI equivilents have a + * serious design flaw: there's no way to specify the length of the + * output buffer, so careless use of the ANSI function can ruin your + * whole day. Get a clue, ANSI. + * + * We provide implementations of these in the common library. + */ + +#ifndef SNPRINTF +#if INSTALL_COMMON_SNPRINTF +#define SNPRINTF etc_snprintf +#else +#define SNPRINTF snprintf +#endif +#endif + +#ifndef VSNPRINTF +#if INSTALL_COMMON_SNPRINTF +#define VSNPRINTF etc_vsnprintf +#else +#define VSNPRINTF vsnprintf +#endif +#endif + +/* + * These two aren't ANSI functions, but most systems have equivilents. + * They're case-insensitive versions of the corresponding ANSI functions. + * We provide implementations of these in the common library. */ + +#ifndef STRICMP +#if (INSTALL_COMMON_STRICMP) +#define STRICMP(x, y) etc_stricmp(x, y) +#else +#define STRICMP(x, y) strcasecmp(x, y) +#endif +#endif + +#ifndef STRNICMP +#if (INSTALL_COMMON_STRNICMP) +#define STRNICMP(x, y, z) etc_strnicmp(x, y, z) +#else +#define STRNICMP(x, y, z) strncasecmp(x, y, z) +#endif +#endif + +#endif /* COMMON_GLUE_H */ + diff --git a/h/wrn/wm/common/hmac.h b/h/wrn/wm/common/hmac.h new file mode 100644 index 0000000..6ef8114 --- /dev/null +++ b/h/wrn/wm/common/hmac.h @@ -0,0 +1,109 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/common/hmac.h,v 1.3 2003/01/16 18:20:12 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: hmac.h,v $ + * Revision 1.3 2003/01/16 18:20:12 josh + * directory structure shifting + * + * Revision 1.2 2001/11/07 00:07:10 meister + * Rework pathnames again + * + * Revision 1.1.1.1 2001/11/05 17:47:18 tneale + * Tornado shuffle + * + * Revision 1.5 2001/01/19 22:21:28 paul + * Update copyright. + * + * Revision 1.4 2000/03/17 00:16:37 meister + * Update copyright message + * + * Revision 1.3 2000/03/09 17:15:39 tneale + * Added #idef C++ to declare extern C if needed + * + * Revision 1.2 1998/06/18 04:11:24 sar + * clean up some type info, make the lengths be bits32_t + * + * Revision 1.1 1998/05/22 17:59:58 sar + * Adding include files for hmac and sha + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef HMAC_H +#define HMAC_H 1 + +#ifdef __cplusplus +extern"C" { +#endif + +/* get the installation options */ +#ifndef EPILOGUE_INSTALL_H +#include +#endif /* EPILOGUE_INSTALL_H */ + +/* get the Epilogue types */ +#ifndef EPILOGUE_TYPES_H +#include +#endif /* EPILOGUE_TYPES_H */ + +/* Data structure for HMAC computation */ + +#define HMAC_STATESIZ_MAX 128 +#define HMAC_HASHSIZ_MAX 24 /* keep them 64-bit aligned */ + +typedef void (*hashfcn_init_t)(void *state); +typedef void (*hashfcn_update_t)(void *state, bits8_t *data, bits32_t datalen); +typedef void (*hashfcn_final_t)(void *state, bits8_t *output); + +typedef struct { + bits8_t hmac_state [HMAC_STATESIZ_MAX]; + bits8_t hmac_tmp [HMAC_HASHSIZ_MAX]; + hashfcn_init_t hmac_hashinit; + hashfcn_update_t hmac_hashupdate; + hashfcn_final_t hmac_hashfinal; + bits32_t hmac_hashlen; +} HMAC_CTX; + +/* Initialize an HMAC context. Needs the three hash function interface calls, + the size of the output hash, and the size of the state block needed by the + underlying hash function. */ + +void InitHmacCTX __((HMAC_CTX *ctx, + hashfcn_init_t init, + hashfcn_update_t update, + hashfcn_final_t final, + bits32_t hashsiz)); + +void hmac_init __((HMAC_CTX *ctx, bits8_t *key, bits32_t keylen)); +void hmac_update __((HMAC_CTX *ctx, bits8_t *data, bits32_t datalen)); +void hmac_final __((HMAC_CTX *ctx, bits8_t *key, bits32_t keylen, + bits8_t *output)); + +#ifdef __cplusplus +} +#endif + +#endif /* HMAC_H */ + diff --git a/h/wrn/wm/common/md4.h b/h/wrn/wm/common/md4.h new file mode 100644 index 0000000..cd33188 --- /dev/null +++ b/h/wrn/wm/common/md4.h @@ -0,0 +1,99 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/common/md4.h,v 1.3 2003/01/16 18:20:12 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: md4.h,v $ + * Revision 1.3 2003/01/16 18:20:12 josh + * directory structure shifting + * + * Revision 1.2 2001/11/07 00:07:10 meister + * Rework pathnames again + * + * Revision 1.1.1.1 2001/11/05 17:47:18 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:21:28 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:16:38 meister + * Update copyright message + * + * Revision 1.2 2000/03/09 17:15:40 tneale + * Added #idef C++ to declare extern C if needed + * + * Revision 1.1 1999/08/11 21:16:57 bala + * MD4 functions + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + +/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All + rights reserved. + + License to copy and use this software is granted provided that it + is identified as the "RSA Data Security, Inc. MD4 Message-Digest + Algorithm" in all material mentioning or referencing this software + or this function. + + License is also granted to make and use derivative works provided + that such works are identified as "derived from the RSA Data + Security, Inc. MD4 Message-Digest Algorithm" in all material + mentioning or referencing the derived work. + + RSA Data Security, Inc. makes no representations concerning either + the merchantability of this software or the suitability of this + software for any particular purpose. It is provided "as is" + without express or implied warranty of any kind. + + These notices must be retained in any copies of any part of this + documentation and/or software. + +*/ + +#ifndef __MD4_INCLUDE__ +#define __MD4_INCLUDE__ + +#ifdef __cplusplus +extern"C" { +#endif + +/* get the Epilogue types */ +#ifndef EPILOGUE_TYPES_H +#include +#endif /* EPILOGUE_TYPES_H */ + +/* MD4 context. */ +typedef struct { + bits32_t state[4]; /* state (ABCD) */ + bits32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */ + bits8_t buffer[64]; /* input buffer */ +} MD4_CTX; + +void MD4Init __((MD4_CTX *)); +void MD4Update __((MD4_CTX *, bits8_t *, bits32_t)); +void MD4Final __((bits8_t *, MD4_CTX *)); + +#ifdef __cplusplus +} +#endif + +#endif /* __MD4_INCLUDE__ */ diff --git a/h/wrn/wm/common/md5.h b/h/wrn/wm/common/md5.h new file mode 100644 index 0000000..bc575b1 --- /dev/null +++ b/h/wrn/wm/common/md5.h @@ -0,0 +1,127 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/common/md5.h,v 1.3 2003/01/16 18:20:13 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 2000-2001 Wind River Systems, Inc. + * Copyright 1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: md5.h,v $ + * Revision 1.3 2003/01/16 18:20:13 josh + * directory structure shifting + * + * Revision 1.2 2001/11/07 00:07:10 meister + * Rework pathnames again + * + * Revision 1.1.1.1 2001/11/05 17:47:18 tneale + * Tornado shuffle + * + * Revision 1.8 2001/01/19 22:21:28 paul + * Update copyright. + * + * Revision 1.7 2000/03/17 00:16:38 meister + * Update copyright message + * + * Revision 1.6 2000/03/09 17:15:40 tneale + * Added #idef C++ to declare extern C if needed + * + * Revision 1.5 1998/02/25 04:43:26 sra + * Update copyrights. + * + * Revision 1.4 1998/02/05 22:37:35 josh + * Changing references to types.h so we include common/h/types.h instead + * + * Revision 1.3 1997/10/30 16:44:29 sra + * Fix copyright date. + * + * Revision 1.2 1997/08/14 16:04:38 lowell + * boilerplate + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + +/* + *********************************************************************** + ** md5.h -- header file for implementation of MD5 ** + ** RSA Data Security, Inc. MD5 Message-Digest Algorithm ** + ** Created: 2/17/90 RLR ** + ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version ** + ** Revised (for MD5): RLR 4/27/91 ** + ** -- G modified to have y&~z instead of y&z ** + ** -- FF, GG, HH modified to add in last register done ** + ** -- Access pattern: round 2 works mod 5, round 3 works mod 3 ** + ** -- distinct additive constant for each step ** + ** -- round 4 added, working mod 7 ** + *********************************************************************** + */ + +/* + *********************************************************************** + ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. ** + ** ** + ** License to copy and use this software is granted provided that ** + ** it is identified as the "RSA Data Security, Inc. MD5 Message- ** + ** Digest Algorithm" in all material mentioning or referencing this ** + ** software or this function. ** + ** ** + ** License is also granted to make and use derivative works ** + ** provided that such works are identified as "derived from the RSA ** + ** Data Security, Inc. MD5 Message-Digest Algorithm" in all ** + ** material mentioning or referencing the derived work. ** + ** ** + ** RSA Data Security, Inc. makes no representations concerning ** + ** either the merchantability of this software or the suitability ** + ** of this software for any particular purpose. It is provided "as ** + ** is" without express or implied warranty of any kind. ** + ** ** + ** These notices must be retained in any copies of any part of this ** + ** documentation and/or software. ** + *********************************************************************** + */ + +#ifndef __MD5_INCLUDE__ + +#ifdef __cplusplus +extern"C" { +#endif + +/* get the Epilogue types */ +#ifndef EPILOGUE_TYPES_H +#include +#endif /* EPILOGUE_TYPES_H */ + +/* Data structure for MD5 (Message-Digest) computation */ +typedef struct { + bits32_t i[2]; /* number of _bits_ handled mod 2^64 */ + bits32_t buf[4]; /* scratch buffer */ + bits8_t in[64]; /* input buffer */ + bits8_t digest[16]; /* actual digest after MD5Final call */ +} MD5_CTX; + +void MD5Init __((MD5_CTX *)); +void MD5Update __((MD5_CTX *, bits8_t *, bits32_t)); +void MD5Final __((MD5_CTX *)); + +#ifdef __cplusplus +} +#endif + +#define __MD5_INCLUDE__ +#endif /* __MD5_INCLUDE__ */ diff --git a/h/wrn/wm/common/prng.h b/h/wrn/wm/common/prng.h new file mode 100644 index 0000000..ea2e625 --- /dev/null +++ b/h/wrn/wm/common/prng.h @@ -0,0 +1,80 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/common/prng.h,v 1.3 2003/01/16 18:20:13 josh Exp $ */ + + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + +/**************************************************************************** + * Copyright 1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: prng.h,v $ + * Revision 1.3 2003/01/16 18:20:13 josh + * directory structure shifting + * + * Revision 1.2 2001/11/07 00:07:10 meister + * Rework pathnames again + * + * Revision 1.1.1.1 2001/11/05 17:47:18 tneale + * Tornado shuffle + * + * Revision 1.9 2001/01/19 22:21:28 paul + * Update copyright. + * + * Revision 1.8 2000/03/17 00:16:39 meister + * Update copyright message + * + * Revision 1.7 2000/03/09 17:15:41 tneale + * Added #idef C++ to declare extern C if needed + * + * Revision 1.6 1998/02/25 04:43:26 sra + * Update copyrights. + * + * Revision 1.5 1998/02/05 22:37:35 josh + * Changing references to types.h so we include common/h/types.h instead + * + * Revision 1.4 1997/10/30 16:44:29 sra + * Fix copyright date. + * + * Revision 1.3 1997/08/14 16:04:38 lowell + * boilerplate + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + +#ifndef COMMON_PRNG_H +#define COMMON_PRNG_H + +#ifdef __cplusplus +extern"C" { +#endif + +#ifndef EPILOGUE_TYPES_H +#include +#endif /* EPILOGUE_TYPES_H */ + +void prng_get_seed(bits8_t **buffer, int * bufsize); +void prng_random(bits8_t *buffer, int length); +void prng_inject_random8(bits8_t newdata ); +bits8_t prng_random8(void ); +void prng_init(void ); + +#ifdef __cplusplus +} +#endif + +#endif /* COMMON_PRNG_H */ diff --git a/h/wrn/wm/common/sha.h b/h/wrn/wm/common/sha.h new file mode 100644 index 0000000..e9ddfea --- /dev/null +++ b/h/wrn/wm/common/sha.h @@ -0,0 +1,97 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/common/sha.h,v 1.3 2003/01/16 18:20:13 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 2000-2001 Wind River Systems, Inc. + * Copyright 1998 Integrated Systems Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: sha.h,v $ + * Revision 1.3 2003/01/16 18:20:13 josh + * directory structure shifting + * + * Revision 1.2 2001/11/07 00:07:11 meister + * Rework pathnames again + * + * Revision 1.1.1.1 2001/11/05 17:47:18 tneale + * Tornado shuffle + * + * Revision 1.5 2001/01/19 22:21:29 paul + * Update copyright. + * + * Revision 1.4 2000/03/17 00:16:40 meister + * Update copyright message + * + * Revision 1.3 2000/03/09 17:15:41 tneale + * Added #idef C++ to declare extern C if needed + * + * Revision 1.2 1998/06/16 05:12:27 sar + * Clean up some type questions + * + * Revision 1.1 1998/05/22 17:59:58 sar + * Adding include files for hamc and sha + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + +/* NIST Secure Hash Algorithm */ +/* heavily modified by Uwe Hollerbach */ +/* from Peter C. Gutmann's implementation as found in */ +/* Applied Cryptography by Bruce Schneier */ + +/* This code is in the public domain */ + +#ifndef EPILOGUE_SHA_H +#define EPILOGUE_SHA_H + +#ifdef __cplusplus +extern"C" { +#endif + +/* get the installation options */ +#ifndef EPILOGUE_INSTALL_H +#include +#endif /* EPILOGUE_INSTALL_H */ + +/* get the Epilogue types */ +#ifndef EPILOGUE_TYPES_H +#include +#endif /* EPILOGUE_TYPES_H */ + +#define SHA_BLOCKSIZE 64 +#define SHA_DIGESTSIZE 20 + +typedef struct { + bits32_t count_lo, count_hi; /* 64-bit bit count */ + bits32_t buf[5]; /* scratch buffer */ + bits8_t data[SHA_BLOCKSIZE]; /* SHA data (input) buffer */ + bits8_t digest[20]; /* message digest after sha_final call */ + size_t local; /* unprocessed amount in data */ +} SHA_CTX; + +void sha_init __((SHA_CTX *)); +void sha_update __((SHA_CTX *, bits8_t *, bits32_t)); +void sha_final __((SHA_CTX *)); + +#ifdef __cplusplus +} +#endif + +#endif /* EPILOGUE_SHA_H */ + diff --git a/h/wrn/wm/common/snprintf.h b/h/wrn/wm/common/snprintf.h new file mode 100644 index 0000000..d3df20b --- /dev/null +++ b/h/wrn/wm/common/snprintf.h @@ -0,0 +1,77 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/common/snprintf.h,v 1.3 2003/01/16 18:20:13 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1988-1997 Epilogue Technology Corporation. + * Copyright 1999 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: snprintf.h,v $ + * Revision 1.3 2003/01/16 18:20:13 josh + * directory structure shifting + * + * Revision 1.2 2001/11/07 00:07:11 meister + * Rework pathnames again + * + * Revision 1.1.1.1 2001/11/05 17:47:18 tneale + * Tornado shuffle + * + * Revision 1.5 2001/01/19 22:21:29 paul + * Update copyright. + * + * Revision 1.4 2000/03/17 00:16:40 meister + * Update copyright message + * + * Revision 1.3 2000/03/09 17:15:42 tneale + * Added #idef C++ to declare extern C if needed + * + * Revision 1.2 1999/05/21 14:46:33 sra + * Include . + * + * Revision 1.1 1999/05/20 20:28:14 sra + * Add etc_snprintf() and etc_vsnprintf(). + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + +#ifndef COMMON_SNPRINTF_H + +#ifndef EPILOGUE_TYPES_H +#ifdef __cplusplus +extern"C" { +#endif + +#include +#endif + +/* + * If va_arg exists, it's a macro (can't be a function). + */ +#ifndef va_arg +#include +#endif + +int etc_snprintf (char *str, size_t count, const char *fmt, ...); +int etc_vsnprintf (char *str, size_t count, const char *fmt, va_list arg); + +#ifdef __cplusplus +} +#endif + +#endif /* COMMON_SNPRINTF_H */ diff --git a/h/wrn/wm/common/stdf.h b/h/wrn/wm/common/stdf.h new file mode 100644 index 0000000..217e393 --- /dev/null +++ b/h/wrn/wm/common/stdf.h @@ -0,0 +1,87 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/common/stdf.h,v 1.3 2003/01/16 18:20:13 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 2000-2001 Wind River Systems, Inc. + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: stdf.h,v $ + * Revision 1.3 2003/01/16 18:20:13 josh + * directory structure shifting + * + * Revision 1.2 2001/11/07 00:13:33 meister + * rework pathnames + * + * Revision 1.1.1.1 2001/11/05 17:47:18 tneale + * Tornado shuffle + * + * Revision 1.7 2001/02/09 20:13:33 paul + * Added our own version of strncpy(), just in case the user doesn't have one. + * + * Revision 1.6 2001/01/19 22:21:29 paul + * Update copyright. + * + * Revision 1.5 2000/03/17 00:16:41 meister + * Update copyright message + * + * Revision 1.4 2000/03/09 17:15:42 tneale + * Added #idef C++ to declare extern C if needed + * + * Revision 1.3 1999/04/09 20:33:47 wes + * re-constify. let's see what, if anything, blows up + * + * Revision 1.2 1998/07/03 20:19:20 sra + * Add etc_memcmp(). + * + * Revision 1.1 1998/06/03 20:10:34 sar + * Added some common string functions. stdf.h has the externs for them + * while glue.h will use them if the user installs them and doesn't + * specify other functions to use. + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef COMMON_STDF_H +#define COMMON_STDF_H + +#ifdef __cplusplus +extern"C" { +#endif + +/* pick up size_t (via oemtypes.h and sttdef.h) */ + +#ifndef EPILOGUE_TYPES_H +#include +#endif + +long etc_strtol (char *string, char **endptr, int radix); +unsigned long etc_strtoul (char *string, char **endptr, int radix); +int etc_stricmp (const char *s, const char *t); +int etc_strnicmp (const char *s, const char *t, size_t len); +int etc_memcmp (const void *x, const void *y, size_t len); +char * etc_strncpy (char *dst, const char *src, size_t n); + +#ifdef __cplusplus +} +#endif + +#endif /* COMMON_STDF_H */ diff --git a/h/wrn/wm/common/thread.h b/h/wrn/wm/common/thread.h new file mode 100644 index 0000000..1c62c86 --- /dev/null +++ b/h/wrn/wm/common/thread.h @@ -0,0 +1,258 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/common/thread.h,v 1.2 2003/01/16 18:20:14 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + +/**************************************************************************** + * Copyright 2000-2001 Wind River Systems, Inc. + * Copyright 1998-1999 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: thread.h,v $ + * Revision 1.2 2003/01/16 18:20:14 josh + * directory structure shifting + * + * Revision 1.1.1.1 2001/11/05 17:47:18 tneale + * Tornado shuffle + * + * Revision 1.13 2001/06/12 08:06:07 paul + * Mutex priorities are unsigned. + * Added debugging to condition variable routines. + * + * Revision 1.12 2001/03/22 20:29:38 paul + * The diab compiler is pickier than gcc. + * + * Revision 1.11 2001/03/22 16:54:08 paul + * Mutex and condition variable functions now return errors. + * + * Revision 1.10 2001/03/20 17:11:14 paul + * Removed unused timeout macros. + * + * Revision 1.9 2001/01/19 22:21:29 paul + * Update copyright. + * + * Revision 1.8 2000/10/16 19:21:43 paul + * Restore sockets and mempool code. + * + * Revision 1.6 2000/03/17 00:16:41 meister + * Update copyright message + * + * Revision 1.5 2000/03/09 17:15:43 tneale + * Added #idef C++ to declare extern C if needed + * + * Revision 1.4 1999/12/20 23:21:33 qli + * added ETC_GET_SEL_CONDVAR and ETC_REL_SEL_CONDVAR + * + * Revision 1.3 1999/04/28 23:53:24 sra + * Clean up various minor installation option glitches. + * + * Revision 1.2 1999/02/18 04:41:22 wes + * Sockets merge: Everything Else + * - memory pools + * - thread support + * - port-specific headers + * + * Revision 1.1.6.12 1999/01/25 21:08:01 paul + * added the first half of the copyright notice (oops) + * + * Revision 1.1.6.11 1999/01/22 19:48:50 paul + * Added this_thread(), copyright notice. + * + */ + + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + +#ifndef COMMON_THREAD_H +#define COMMON_THREAD_H + +#ifdef __cplusplus +extern"C" { +#endif + +#include + +#define ETC_MUTEX_PRIO_MIN GLUE_MUTEX_PRIO_MIN +#define ETC_MUTEX_PRIO_LOW GLUE_MUTEX_PRIO_LOW +#define ETC_MUTEX_PRIO_MID GLUE_MUTEX_PRIO_MID +#define ETC_MUTEX_PRIO_HIGH GLUE_MUTEX_PRIO_HIGH +#define ETC_MUTEX_PRIO_MAX GLUE_MUTEX_PRIO_MAX + +#if defined(INSTALL_THREAD_DEBUG) && INSTALL_THREAD_DEBUG + +/* + * See the non-debug side of this #ifdef of this for documentation on + * what the various functions do. + */ + +/* + * other things to consider.. + * mutex names. __FILE__, __LINE__; last-lock/last-unlock info + * thread names, cond names. + * yield before/after lock/unlock, signal, cond wait, + * per thread storage for current lock prio, chain of held locks.. + * How the heck do we deal with META_LOCK/UNLOCK() after cond_wait? + * (release user lock, take meta_lock, retake user lock?) + */ + +typedef struct etc_mutex_t +{ + int magic; + glue_mutex_t m; + char *lock_name; + void *lock_owner; + unsigned lock_prio; + struct etc_mutex_t *next_lock; + char *last_lock_file; + int last_lock_line; + char *last_unlock_file; + int last_unlock_line; +} etc_mutex_t; + +typedef struct +{ + glue_cond_t c; + etc_mutex_t *m; +} etc_cond_t; + +extern glue_mutex_t etc_meta_mutex; + +int etc_mutex_init(etc_mutex_t *lock, unsigned prio, char *name); +int etc_mutex_lock(etc_mutex_t *lock, unsigned prio, char *file, int line); +int etc_mutex_unlock(etc_mutex_t *lock, unsigned prio, char *file, int line); +void etc_mutex_lock_assert (etc_mutex_t *lock, unsigned prio, char *file, int line); +int etc_mutex_destroy (etc_mutex_t *lock, char *file, int line); + +int etc_cond_init(etc_cond_t *cond, etc_mutex_t *mutex, char *file, int line); +int etc_cond_wait(etc_cond_t *cond, etc_mutex_t *mutex, char *file, int line); +int etc_cond_wakeup(etc_cond_t *cond, etc_mutex_t *mutex, char *file, int line); +int etc_cond_broadcast(etc_cond_t *cond, etc_mutex_t *mutex, char *file, int line); +int etc_cond_destroy(etc_cond_t *cond, char *file, int line); + +#define ETC_LOCK_MAGIC 0x19661008 + +#define ETC_META_LOCK() \ + GLUE_MUTEX_LOCK(&etc_meta_mutex, GLUE_MUTEX_PRIO_MIN); + +#define ETC_META_UNLOCK() \ + GLUE_MUTEX_UNLOCK(&etc_meta_mutex, GLUE_MUTEX_PRIO_MIN); + +#define ETC_MUTEX_INIT(lock, prio, name) \ + etc_mutex_init(lock, prio, name) + +#define ETC_MUTEX_LOCK(lock, prio) \ + etc_mutex_lock(lock, prio, __FILE__, __LINE__) + +#define ETC_MUTEX_UNLOCK(lock, prio) \ + etc_mutex_unlock(lock, prio, __FILE__, __LINE__) + +#define ETC_MUTEX_LOCK_ASSERT(lock, prio) \ + etc_mutex_lock_assert(lock, prio, __FILE__, __LINE__) + +#define ETC_MUTEX_DESTROY(lock) \ + etc_mutex_destroy(lock, __FILE__, __LINE__) + +#define ETC_COND_INIT(cond, mutex) \ + etc_cond_init(cond, mutex, __FILE__, __LINE__) + +#define ETC_COND_WAIT(cond, mutex) \ + etc_cond_wait(cond, mutex, __FILE__, __LINE__) + +#define ETC_COND_WAKEUP(cond, mutex) \ + etc_cond_wakeup(cond, mutex, __FILE__, __LINE__) + +#define ETC_COND_BROADCAST(cond, mutex) \ + etc_cond_broadcast(cond, mutex, __FILE__, __LINE__) + +#define ETC_COND_DESTROY(cond) \ + etc_cond_destroy(cond, __FILE__, __LINE__) + +/* Initialize thread system (if necessary) */ +extern void common_thread_init(void); + +#define ETC_THREAD_INIT() common_thread_init() + +void *this_thread(void); + +#else /* INSTALL_THREAD_DEBUG */ + +/* Initialize thread system (if necessary) */ +#define ETC_THREAD_INIT() GLUE_THREAD_INIT() + +/* + * Mutex locks. + */ + +typedef glue_mutex_t etc_mutex_t; + +/* Initialize mutex */ +#define ETC_MUTEX_INIT(lock, prio, name) GLUE_MUTEX_INIT(lock, prio) + +/* Lock, unlock mutex */ +#define ETC_MUTEX_LOCK(lock, prio) GLUE_MUTEX_LOCK(lock, prio) +#define ETC_MUTEX_UNLOCK(lock, prio) GLUE_MUTEX_UNLOCK(lock, prio) +/* Destroy mutex */ +#define ETC_MUTEX_DESTROY(lock) GLUE_MUTEX_DESTROY(lock) + +/* Try to lock a mutex; return 1 if successful, 0 if not (already locked) */ +#define ETC_MUTEX_TRYLOCK(lock, prio) GLUE_MUTEX_TRYLOCK(lock) + +/* Bug-check if we don't hold the mutex */ +#define ETC_MUTEX_LOCK_ASSERT(lock, prio) + +/* + * Condition variables: + */ + +typedef glue_cond_t etc_cond_t; + +/* initialize condition variable */ +#define ETC_COND_INIT(cond, mutex) GLUE_COND_INIT(cond, mutex) + +/* wait for condition to happen */ +#define ETC_COND_WAIT(cond, mutex) GLUE_COND_WAIT(cond, mutex) +#define ETC_COND_DESTROY(cond) GLUE_COND_DESTROY(cond) + +#define ETC_COND_WAKEUP(cond, mutex) GLUE_COND_WAKEUP(cond, mutex) +#define ETC_COND_BROADCAST(cond, mutex) GLUE_COND_BROADCAST(cond, mutex) + +#endif + +typedef glue_thread_t etc_thread_t; + +/* Return a per-thread cookie */ +#define ETC_THD_SELF() GLUE_THD_SELF() +/* Yield the processor */ +#define ETC_THD_YIELD() GLUE_THD_YIELD() + +/* + * the following are mostly for the benefit of snark and similar test code. + */ + +/* Create a thread */ +#define ETC_THD_CREATE(thread, func, arg) GLUE_THD_CREATE(thread, func, arg) +#define ETC_THD_WAIT(thread) GLUE_THD_WAIT(thread) + +/* Cause the current thread to go poof */ +#define ETC_THD_EXIT() GLUE_THD_EXIT() + +#define ETC_GET_SEL_CONDVAR(cookie) (etc_cond_t *)GLUE_GET_SEL_CONDVAR(cookie) +#define ETC_REL_SEL_CONDVAR(cond, cookie) GLUE_REL_SEL_CONDVAR(cond, cookie) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/wm/common/types.h b/h/wrn/wm/common/types.h new file mode 100644 index 0000000..b01e47d --- /dev/null +++ b/h/wrn/wm/common/types.h @@ -0,0 +1,174 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/common/types.h,v 1.2 2003/01/16 18:20:14 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + +/**************************************************************************** + * Copyright 1988-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: types.h,v $ + * Revision 1.2 2003/01/16 18:20:14 josh + * directory structure shifting + * + * Revision 1.1.1.1 2001/11/05 17:47:18 tneale + * Tornado shuffle + * + * Revision 1.9 2001/01/19 22:21:29 paul + * Update copyright. + * + * Revision 1.8 2000/03/17 00:16:42 meister + * Update copyright message + * + * Revision 1.7 2000/03/13 21:21:46 paul + * Removed some code that we are no longer working on. + * + * Revision 1.4 1999/05/12 21:41:33 niqbal + * Changes for Redefinition protection + * + * Revision 1.3 1998/03/11 22:40:02 josh + * epilogue_char_t is now a char instead of bits8_t + * + * Revision 1.2 1998/02/25 04:43:27 sra + * Update copyrights. + * + * Revision 1.1 1998/02/05 22:19:28 josh + * moving commonly used include files into common/h from top-level directory + * + * Revision 1.9 1997/04/20 01:32:00 alan + * Add ldb_int{8,16,32}_t types for the benefit of layout/ldbglue.h. + * + * Revision 1.8 1997/03/20 06:58:18 sra + * DFARS-safe copyright text. Zap! + * + * Revision 1.7 1997/02/25 10:57:03 sra + * Update copyright notice, dust under the bed. + * + * Revision 1.6 1996/10/28 22:52:57 sar + * correction added epilogue_size_t and epilogue_char_t + * + * Revision 1.5 1996/10/28 22:51:08 sar + * Added epilogue_types_h epilogue_char_h + * + * Revision 1.4 1993/04/21 15:39:23 dab + * No longer have cookie_t and renamed cardinal_t to fastint_t. + * + * Revision 1.3 1993/03/20 19:09:52 dab + * changed pvoid_t to ptr_t + * + * Revision 1.2 1993/02/26 16:54:21 dab + * Changed htypes.h to porttype.h + * + * Revision 1.1 1993/02/19 22:28:01 dab + * Initial revision + * + */ + + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef EPILOGUE_TYPES_H +#define EPILOGUE_TYPES_H + +/* is defined in the hardware specific part of the port. + * It must supply a typedef for size_t since we can't do that one + * portably. It can override any typedef here by defining + * __TYPES_HAVE__t_. + */ +#include + +/* Internal data types + */ +#ifndef __TYPES_HAVE_bits8_t_ +#define __TYPES_HAVE_bits8_t_ 1 +typedef unsigned char bits8_t; /* 8 bits */ +#endif +#ifndef __TYPES_HAVE_bits16_t_ +#define __TYPES_HAVE_bits16_t_ 1 +typedef unsigned short bits16_t; /* 16 bits */ +#endif +#ifndef __TYPES_HAVE_bits32_t_ +#define __TYPES_HAVE_bits32_t_ 1 +typedef unsigned long bits32_t; /* 32 bits */ +#endif + +#ifndef __TYPES_HAVE_sbits8_t_ +#define __TYPES_HAVE_sbits8_t_ 1 +typedef signed char sbits8_t; /* signed 8 bits */ +#endif +#ifndef __TYPES_HAVE_sbits16_t_ +#define __TYPES_HAVE_sbits16_t_ 1 +typedef signed short sbits16_t; /* signed 16 bits */ +#endif +#ifndef __TYPES_HAVE_sbits32_t_ +#define __TYPES_HAVE_sbits32_t_ 1 +typedef signed long sbits32_t; /* signed 32 bits */ +#endif + +#ifndef __TYPES_HAVE_inaddr_t_ +#define __TYPES_HAVE_inaddr_t_ 1 +typedef bits32_t inaddr_t; /* IP address */ +#endif + +#ifndef __TYPES_HAVE_ptr_t_ +#define __TYPES_HAVE_ptr_t_ 1 +typedef void * ptr_t; /* generic pointer */ +#endif + +#ifndef __TYPES_HAVE_fastint_t_ +#define __TYPES_HAVE_fastint_t_ 1 +typedef int fastint_t; /* a loop counter (should be at least 15 bits) */ +#endif +#ifndef __TYPES_HAVE_boolean_t_ +#define __TYPES_HAVE_boolean_t_ 1 +typedef int boolean_t; /* an efficient boolean variable */ +#endif + +/* These next three types are needed by the layout glue macros. + * These are the unsigned integer types that your C implementation + * normally converts 8, 16 and 32 bit quantities into in expressions. + * The following typedefs are correct for most C implementations + * (with 16 or 32 bit integers), but may need to be changed in sufficiently + * unusual environments. + */ +#ifndef __TYPES_HAVE_ldb_int8_t_ +typedef unsigned int ldb_int8_t; /* 8 bits */ +#endif +#ifndef __TYPES_HAVE_ldb_int16_t_ +typedef unsigned int ldb_int16_t; /* 16 bits */ +#endif +#ifndef __TYPES_HAVE_ldb_int32_t_ +typedef unsigned long ldb_int32_t; /* 32 bits */ +#endif + +/* yes, we know these two types are not what they should be + they are here to make some of the code happy and will be + updated when that code is fixed. */ +#ifndef __TYPES_HAVE_epilogue_size_t_ +typedef sbits16_t epilogue_size_t; +#endif +#ifndef __TYPES_HAVE_epilogue_char_t_ +typedef char epilogue_char_t; +#endif + +#if !defined(NO_PP) +#define __(x) x +#else +#define __(x) () +#endif + +#endif /* EPILOGUE_TYPES_H */ diff --git a/h/wrn/wm/common/weakprng.h b/h/wrn/wm/common/weakprng.h new file mode 100644 index 0000000..6490a33 --- /dev/null +++ b/h/wrn/wm/common/weakprng.h @@ -0,0 +1,87 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/common/weakprng.h,v 1.3 2003/01/16 18:20:14 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + +/**************************************************************************** + * Copyright 1988-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: weakprng.h,v $ + * Revision 1.3 2003/01/16 18:20:14 josh + * directory structure shifting + * + * Revision 1.2 2001/11/07 00:07:11 meister + * Rework pathnames again + * + * Revision 1.1.1.1 2001/11/05 17:47:18 tneale + * Tornado shuffle + * + * Revision 1.7 2001/01/19 22:21:29 paul + * Update copyright. + * + * Revision 1.6 2000/03/17 00:16:42 meister + * Update copyright message + * + * Revision 1.5 2000/03/09 17:15:43 tneale + * Added #idef C++ to declare extern C if needed + * + * Revision 1.4 1998/02/25 22:08:28 mrf + * Correct copyright dates. + * + * Revision 1.3 1998/02/25 04:43:27 sra + * Update copyrights. + * + * Revision 1.2 1998/02/21 23:38:33 sra + * Minor changes to WeakPRNG module. + * + * Revision 1.1 1998/02/21 22:05:35 mrf + * Added weak random number generator. + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + +#ifdef __cplusplus +extern"C" { +#endif + +#ifndef EPILOGUE_INSTALL_H +#include +#endif + +#ifndef COMMON_CONFIG_H +#include +#endif + +#ifndef COMMON_GLUE_H +#include +#endif + +/* + * Include file for cryptographically weak random number generator + * found in common/lib/weakprng.c. + */ +/* Function prototypes */ +void ep_seed_weak_prng(bits8_t *, size_t); +bits32_t ep_weak_prng(bits32_t); + + +#ifdef __cplusplus +} +#endif + + diff --git a/h/wrn/wm/demo/bpf.h b/h/wrn/wm/demo/bpf.h new file mode 100644 index 0000000..c9ec3fa --- /dev/null +++ b/h/wrn/wm/demo/bpf.h @@ -0,0 +1,81 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/bpf.h,v 1.1 2001/11/08 16:00:56 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: bpf.h,v $ + * Revision 1.1 2001/11/08 16:00:56 tneale + * Adding header files originally from snark/lib + * + * Revision 2.7 2001/01/19 22:23:39 paul + * Update copyright. + * + * Revision 2.6 2000/03/17 00:12:36 meister + * Update copyright message + * + * Revision 2.5 1998/02/25 04:57:21 sra + * Update copyrights. + * + * Revision 2.4 1997/04/25 01:02:26 sra + * Fix code to set explicit MAC addresses for BPF, allow non-promiscuous mode. + * + * Revision 2.3 1997/03/20 06:52:51 sra + * DFARS-safe copyright text. Zap! + * + * Revision 2.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 2.1 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 2.0 1995/05/10 22:38:15 sra + * Attache release 3.0. + * + * Revision 1.3 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 1.2 1994/09/04 23:55:50 sra + * Get rid of most of the ancient NO_PP cruft. + * + * Revision 1.1 1993/07/05 21:53:30 sra + * Initial revision + * + */ + +/* + * BPF interface to ethernet for attache testing under 386BSD/NetBSD/FreeBSD. + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef _BPF_H_ +#define _BPF_H_ + +extern int bpf_open (char *, unsigned, unsigned char *, int); +extern int bpf_write (int, unsigned char *, unsigned); +extern void bpf_close (int); +extern void bpf_find (void (*)(char *, void *), void *); +extern int bpf_read (int, unsigned, + void (*)(unsigned char *, unsigned, unsigned, void *), + void *); + +#endif /* _BPF_H_ */ diff --git a/h/wrn/wm/demo/bpfdrive.h b/h/wrn/wm/demo/bpfdrive.h new file mode 100644 index 0000000..5fa0db8 --- /dev/null +++ b/h/wrn/wm/demo/bpfdrive.h @@ -0,0 +1,78 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/bpfdrive.h,v 1.1 2001/11/08 16:00:56 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1994-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: bpfdrive.h,v $ + * Revision 1.1 2001/11/08 16:00:56 tneale + * Adding header files originally from snark/lib + * + * Revision 2.6 2001/01/19 22:23:39 paul + * Update copyright. + * + * Revision 2.5 2000/03/17 00:12:37 meister + * Update copyright message + * + * Revision 2.4 1998/02/25 04:57:22 sra + * Update copyrights. + * + * Revision 2.3 1997/03/20 06:52:53 sra + * DFARS-safe copyright text. Zap! + * + * Revision 2.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 2.1 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 2.0 1995/05/10 22:38:15 sra + * Attache release 3.0. + * + * Revision 1.3 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 1.2 1994/09/04 06:13:38 sra + * Clean up antique type names and install macros. + * + * Revision 1.1 1994/01/09 23:57:29 sra + * Add support for NIT under SunOS 4.1.2. + * + */ + +/* + * Berkeley Packet Filter (BPF) network interface for snark package. + * + * This has only been tested on NetBSD 0.8, it will probably work on other + * BSD-Net2-derived systems, and may work with minor modifications on other + * BSD-related systems with BPF (eg, SunOS with the BPF additions supplied + * with the tcpdump program distributed by LBL). + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef _BPFDRIVE_H_ +#define _BPFDRIVE_H_ + +extern void bpf_driver_find + (void (*config)(char *, struct driver *, int, bits16_t, unsigned, bits32_t)); + +#endif /* _BPFDRIVE_H_ */ diff --git a/h/wrn/wm/demo/bsdif.h b/h/wrn/wm/demo/bsdif.h new file mode 100644 index 0000000..236ab06 --- /dev/null +++ b/h/wrn/wm/demo/bsdif.h @@ -0,0 +1,85 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/bsdif.h,v 1.1 2001/11/08 16:00:57 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: bsdif.h,v $ + * Revision 1.1 2001/11/08 16:00:57 tneale + * Adding header files originally from snark/lib + * + * Revision 2.7 2001/01/19 22:23:39 paul + * Update copyright. + * + * Revision 2.6 2000/03/17 00:12:37 meister + * Update copyright message + * + * Revision 2.5 1998/02/25 04:57:22 sra + * Update copyrights. + * + * Revision 2.4 1997/03/20 06:52:53 sra + * DFARS-safe copyright text. Zap! + * + * Revision 2.3 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 2.2 1997/02/19 08:10:29 sra + * More fun merging snmptalk into snark, general snark cleanup. + * + * Revision 2.1 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 2.0 1995/05/10 22:38:15 sra + * Attache release 3.0. + * + * Revision 1.3 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 1.2 1994/01/09 23:57:29 sra + * Add support for NIT under SunOS 4.1.2. + * + * Revision 1.1 1993/07/05 21:53:30 sra + * Initial revision + * + */ + +/* + * File descriptor based network interfaces for snark under BSD. + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef _BSDIF_H_ +#define _BSDIF_H_ + +struct bsdif { + struct bsdif *next; + void *net; + int fd; + unsigned flags; + void (*handler) __((int, void *, unsigned)); + void *private; +}; + +#define BSDIF_READ 0x1 +#define BSDIF_WRITE 0x2 + +#endif /* _BSDIF_H_ */ diff --git a/h/wrn/wm/demo/bug_conf.h b/h/wrn/wm/demo/bug_conf.h new file mode 100644 index 0000000..8024462 --- /dev/null +++ b/h/wrn/wm/demo/bug_conf.h @@ -0,0 +1,147 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/bug_conf.h,v 1.3 2003/01/15 13:58:29 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* Run-time configuration of the BUG() macro and friends. */ + +/* + * $Log: bug_conf.h,v $ + * Revision 1.3 2003/01/15 13:58:29 josh + * directory structure shifting + * + * Revision 1.2 2001/11/07 14:27:43 tneale + * Added wm to include path + * + * Revision 1.1.1.1 2001/11/05 17:47:32 tneale + * Tornado shuffle + * + * Revision 1.12 2001/01/19 22:23:34 paul + * Update copyright. + * + * Revision 1.11 2000/10/16 19:21:48 paul + * Restore sockets and mempool code. + * + * Revision 1.10 2000/03/17 00:12:11 meister + * Update copyright message + * + * Revision 1.9 2000/03/13 21:21:59 paul + * Removed some code that we are no longer working on. + * + * Revision 1.8 1999/02/18 04:41:30 wes + * Sockets merge: Everything Else + * - memory pools + * - thread support + * - port-specific headers + * + * Revision 1.7.12.1 1998/10/01 21:45:19 wes + * sockets port: add new configurable bug action: yield the processor + * + * Revision 1.7 1998/02/25 15:21:44 sra + * Finish moving types.h, bug.h, and bugdef.h to common/h/. + * + * Revision 1.6 1998/02/25 04:57:14 sra + * Update copyrights. + * + * Revision 1.5 1997/05/15 07:54:05 sra + * Add IDENT option. + * + * Revision 1.4 1997/03/20 06:53:19 sra + * DFARS-safe copyright text. Zap! + * + * Revision 1.3 1997/03/19 04:11:35 sra + * BUG() now common to all products, so move the associated .h files. + * + * Revision 1.2 1997/02/24 00:56:59 sra + * Support for run-time configuration of BUG() macros. + * + * Revision 1.1 1997/02/23 21:58:43 sra + * Initial revision + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef SNARK_BUG_CONF_H +#define SNARK_BUG_CONF_H + +/* + * Notes on the following weirdness: + * + * If we're going to define BUG(), we have to + * do it before bug.h is included. + * + * "sty_printf z ;" is not a typo. + */ + +#if INSTALL_SNARK_BUG_CONF + +#ifndef BUG_OUT +#define BUG_OUT cty +#endif + +#define BUG(_code_, _continuable_, _cookie_, _format_) \ + do {\ + unsigned _flags_ = bug_flags[(int)(_code_)];\ + int _fatal_ = ((_continuable_) == BUG_FATAL);\ + if ((_flags_ & BUG_FLAG_PRINT) != 0) {\ + bug_timestamp(BUG_OUT);\ + if ((_flags_ & BUG_FLAG_IDENT) != 0)\ + sty_printf(BUG_OUT, "%s:%d: ", __FILE__, __LINE__);\ + sty_printf _format_ ;\ + sty_putc(BUG_OUT, '\n');\ + }\ + if ((_flags_ & BUG_FLAG_FATAL) != 0)\ + _fatal_ = !_fatal_;\ + if ((_flags_ & BUG_FLAG_BREAK) != 0)\ + _fatal_ = bug_breakpoint((_code_), (_cookie_), _fatal_);\ + if ((_flags_ & BUG_FLAG_YIELD) != 0)\ + bug_yield((_code_), __FILE__, __LINE__); \ + if (_fatal_) {\ + sty_puts(BUG_OUT, "Fatal error, aborting.\n");\ + abort();\ + }\ + } while (0) + +#endif /* INSTALL_SNARK_BUG_CONF */ + +#ifndef EPILOGUE_BUG_H +#include +#endif + +#ifndef _SNARK_STY_H_ +#include +#endif + +#define BUG_FLAG_PRINT 0x01 +#define BUG_FLAG_BREAK 0x02 +#define BUG_FLAG_SYSLOG 0x04 +#define BUG_FLAG_FATAL 0x08 +#define BUG_FLAG_IDENT 0x10 +#define BUG_FLAG_YIELD 0x20 + +extern unsigned bug_flags[]; +extern int bug_breakpoint(enum bug_codes, void *, int); +extern void bug_config(void); +extern void bug_timestamp(struct sty *); +extern void bug_yield(enum bug_codes, char *, int); + +#endif /* SNARK_BUG_CONF_H */ diff --git a/h/wrn/wm/demo/dlpi.h b/h/wrn/wm/demo/dlpi.h new file mode 100644 index 0000000..1c417b2 --- /dev/null +++ b/h/wrn/wm/demo/dlpi.h @@ -0,0 +1,61 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/dlpi.h,v 1.1 2001/11/08 16:00:57 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: dlpi.h,v $ + * Revision 1.1 2001/11/08 16:00:57 tneale + * Adding header files originally from snark/lib + * + * Revision 2.3 2001/01/19 22:23:40 paul + * Update copyright. + * + * Revision 2.2 2000/03/17 00:12:38 meister + * Update copyright message + * + * Revision 2.1 1998/07/29 20:54:51 wes + * First cut of the Solaris port. + * (DLPI support, termios, minor tweaks to libraries and port header files) + * + * Revision 1.1.2.1 1998/07/24 21:45:43 wes + * Initial implementation + * + * + */ + +/* + * DLPI interface to ethernet for Attache testing under Solaris 2.x + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef _DLPI_H_ +#define _DLPI_H_ + +extern int dlpi_open (char *, unsigned, unsigned char *); +extern int dlpi_write (int, unsigned char *, unsigned); +extern void dlpi_close (int); +extern void dlpi_find (void (*)(char *, void *), void *); +extern int dlpi_read (int, unsigned, + void (*)(unsigned char *, unsigned, unsigned, void *), + void *); + +#endif /* _DLPI_H_ */ diff --git a/h/wrn/wm/demo/dlpidrv.h b/h/wrn/wm/demo/dlpidrv.h new file mode 100644 index 0000000..54b1842 --- /dev/null +++ b/h/wrn/wm/demo/dlpidrv.h @@ -0,0 +1,59 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/dlpidrv.h,v 1.1 2001/11/08 16:00:57 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: dlpidrv.h,v $ + * Revision 1.1 2001/11/08 16:00:57 tneale + * Adding header files originally from snark/lib + * + * Revision 2.4 2001/01/19 22:23:41 paul + * Update copyright. + * + * Revision 2.3 2000/03/17 00:12:38 meister + * Update copyright message + * + * Revision 2.2 1998/09/14 20:13:43 wes + * make DLPI driver filenames 8.3 safe.. + * + * Revision 2.1 1998/07/29 20:54:52 wes + * First cut of the Solaris port. + * (DLPI support, termios, minor tweaks to libraries and port header files) + * + * Revision 1.1.2.1 1998/07/24 21:45:46 wes + * Initial implementation + * + */ + +/* + * Attache code for interfacing to ethernet via the Data Link Protocol Interface + * on Solaris 2.x + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef _DLPIDRV_H_ +#define _DLPIDRV_H_ + +extern void dlpi_driver_find + (void (*config)(char *, struct driver *, int, bits16_t, unsigned, bits32_t)); + +#endif /* _DLPIDRV_H_ */ diff --git a/h/wrn/wm/demo/dsmemcfg.h b/h/wrn/wm/demo/dsmemcfg.h new file mode 100644 index 0000000..cc6be3e --- /dev/null +++ b/h/wrn/wm/demo/dsmemcfg.h @@ -0,0 +1,142 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/dsmemcfg.h,v 1.2 2001/11/07 14:27:44 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: dsmemcfg.h,v $ + * Revision 1.2 2001/11/07 14:27:44 tneale + * Added wm to include path + * + * Revision 1.1.1.1 2001/11/05 17:47:32 tneale + * Tornado shuffle + * + * Revision 2.4.4.1 2001/10/31 20:04:57 paul + * Removed unneeded udptable.h + * + * Revision 2.4 2001/01/19 22:23:34 paul + * Update copyright. + * + * Revision 2.3 2000/03/17 00:12:12 meister + * Update copyright message + * + * Revision 2.2 1999/04/05 23:03:41 qli + * updated to use the new memory pool identifier names + * + * Revision 2.1 1999/02/18 04:41:31 wes + * Sockets merge: Everything Else + * - memory pools + * - thread support + * - port-specific headers + * + * Revision 1.1.2.1 1998/12/02 20:47:35 qli + * data structure memory pools configuration options + * should be included by sys_conf.h file since it is application specific in + * the case of pSOS + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef _NC_DSMEMCFG_H +#define _NC_DSMEMCFG_H + +#include +#include +#include +#include +#include +#include + +#define NC_IF_ARP_INSTANCE 5 +#define NC_IF_ARP_ENTRIES 5 /* each entry contains (MAX_ARP_ENTRIES * size) */ +#define NC_IF_ARP_IPADDRESS 20 + +#define NC_RTE_TABLE_DISPATCH 20 +#define NC_RTE_TABLE_HEAD 20 +#define NC_RTE_TABLE_AVLNODE 20 +#define NC_RTE_TABLE_ROUTEHEAD 20 +#define NC_RTE_TABLE_RTENTRY_NHGATEWAY 20 /* each entry is (route_entry_t + nh_gateway_t) */ +#define NC_RTE_TABLE_FIXEDEXT 20 +#define NC_RTE_TABLE_ADDREXT 20 +#define NC_RTE_TABLE_OWNER 20 + +#define NC_RTE_DISC_DISPATCH 20 +#define NC_RTE_DISC_HEAD 20 +#define NC_IF_RD_ROUTERCONF 20 +#define NC_IF_RD_HOSTCONF 20 +#define NC_RTE_DISC_AVLNODE 20 +#define NC_RTE_DISC_RDCENTRY 20 +#define NC_RTE_DISC_NHBLOCK 20 + +#define NC_SNMP_TMP_ENTRY 20 +#define NC_SNMP_ROUTEEXT 20 +#define NC_SNMP_RTENTRY_NHGATEWAY 20 + +#define NC_TCP_TCB 10 + +#define NC_UDP_TABENT 10 + + +/* + * size of each configured data structure + */ +#define SZ_NC_IF_ARP_INSTANCE sizeof(struct arp_instance) +#define SZ_NC_IF_ARP_ENTRIES (sizeof(struct arp_entry) + MAX_HW_ADDR_LENGTH + MAX_ARP_MISC_SIZE) * MAX_ARP_ENTRIES +#define SZ_NC_IF_ARP_IPADDRESS sizeof(struct arp_ip_addr) + +#define SZ_NC_RTE_TABLE_DISPATCH sizeof(avl_dispatch_t) +#define SZ_NC_RTE_TABLE_HEAD sizeof(avl_head_t) +#define SZ_NC_RTE_TABLE_AVLNODE sizeof(avl_node_t) +#define SZ_NC_RTE_TABLE_ROUTEHEAD sizeof(route_head_t) +#define SZ_NC_RTE_TABLE_RTENTRY_NHGATEWAY sizeof(route_entry_t) + sizeof(nh_gateway_t) +#define SZ_NC_RTE_TABLE_FIXEDEXT sizeof(fixed_route_ext_t) +#define SZ_NC_RTE_TABLE_ADDREXT sizeof(addr_route_ext_t) +#define SZ_NC_RTE_TABLE_OWNER sizeof(route_owner_t) + +#define SZ_NC_RTE_DISC_DISPATCH sizeof(avl_dispatch_t) +#define SZ_NC_RTE_DISC_HEAD sizeof(avl_head_t) +#if INSTALL_ATTACHE_IP_FORWARDING +#define SZ_NC_IF_RD_ROUTERCONF sizeof(rd_router_conf_t) +#else +#define SZ_NC_IF_RD_ROUTERCONF 0 +#endif +#if ((!INSTALL_ATTACHE_IP_FORWARDING) || INSTALL_ATTACHE_KEEP_RD_CACHE_ON_ROUTER) +#define SZ_NC_IF_RD_HOSTCONF sizeof(rd_host_conf_t) +#else +#define SZ_NC_IF_RD_HOSTCONF 0 +#endif +#define SZ_NC_RTE_DISC_AVLNODE sizeof(avl_node_t) +#define SZ_NC_RTE_DISC_RDCENTRY sizeof(rdc_entry_t) +#define SZ_NC_RTE_DISC_NHBLOCK sizeof(nh_block_t) + +extern tmp_route_entry_t; +#define SZ_NC_SNMP_TMP_ENTRY sizeof(tmp_route_entry_t) /* snmpcidr.c */ + +#define SZ_NC_SNMP_ROUTEEXT sizeof(route_ext_t) +#define SZ_NC_SNMP_RTENTRY_NHGATEWAY sizeof(route_entry_t) + sizeof(nh_gateway_t) + +#define SZ_NC_TCP_TCB sizeof(struct tcb) + +#define SZ_NC_UDP_TABENT sizeof(udp_handle_t) + + +#endif diff --git a/h/wrn/wm/demo/firewall.h b/h/wrn/wm/demo/firewall.h new file mode 100644 index 0000000..f07d328 --- /dev/null +++ b/h/wrn/wm/demo/firewall.h @@ -0,0 +1,76 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/firewall.h,v 1.2 2001/11/07 14:27:44 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * Rudimentary firewall built on top of Attache. + * This is a work in progress, I need the basic functionality to solve + * a short term problem but the code will need more work to make + * it as general as it should be. + */ + +/* + * $Log: firewall.h,v $ + * Revision 1.2 2001/11/07 14:27:44 tneale + * Added wm to include path + * + * Revision 1.1.1.1 2001/11/05 17:47:32 tneale + * Tornado shuffle + * + * Revision 1.3 2001/01/19 22:23:34 paul + * Update copyright. + * + * Revision 1.2 2000/03/17 00:12:12 meister + * Update copyright message + * + * Revision 1.1 1998/09/06 08:11:07 sra + * Packet filtering hooks in Attache, rudimentary firewall + * implementation in Snark. + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef SNARK_FIREWALL_H +#define SNARK_FIREWALL_H + +#include +#include + +extern int snark_firewall_inbound_filter (packet *); +extern int snark_firewall_forward_filter (packet *); +extern int snark_firewall_outbound_filter(packet *); + +extern void snark_firewall_init(void); + +#if INSTALL_SNARK_FIREWALL_INBOUND +#define GLUE_IP_RCV_PKT_FILTER(_P_) snark_firewall_inbound_filter(_P_) +#endif + +#if INSTALL_SNARK_FIREWALL_FORWARD +#define GLUE_IP_FWD_PKT_FILTER(_P_) snark_firewall_forward_filter(_P_) +#endif + +#if INSTALL_SNARK_FIREWALL_OUTBOUND +#define GLUE_IP_SEND_PKT_FILTER(_P_) snark_firewall_outbound_filter(_P_) +#endif + +#endif /* SNARK_FIREWALL_H */ diff --git a/h/wrn/wm/demo/if_ether.h b/h/wrn/wm/demo/if_ether.h new file mode 100644 index 0000000..718289c --- /dev/null +++ b/h/wrn/wm/demo/if_ether.h @@ -0,0 +1,57 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/if_ether.h,v 1.3 2003/01/15 13:58:30 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: if_ether.h,v $ + * Revision 1.3 2003/01/15 13:58:30 josh + * directory structure shifting + * + * Revision 1.2 2001/11/07 14:27:44 tneale + * Added wm to include path + * + * Revision 1.1.1.1 2001/11/05 17:47:32 tneale + * Tornado shuffle + * + * Revision 1.2 2001/01/19 22:23:34 paul + * Update copyright. + * + * Revision 1.1 2000/07/10 15:55:15 mrf + * Add configuration for Cygnus NT environment with associated changes. + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +/* Include file to include netinet/if_ether.h on machines that + * have it, not on machines that don't. + */ + +#include + +#if (!INSTALL_on_ntgcc) +#include +#endif + + + + diff --git a/h/wrn/wm/demo/keyboard.h b/h/wrn/wm/demo/keyboard.h new file mode 100644 index 0000000..dfddc6a --- /dev/null +++ b/h/wrn/wm/demo/keyboard.h @@ -0,0 +1,77 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/keyboard.h,v 1.1.1.1 2001/11/05 17:47:32 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * Declarations for system-independent low-level keyboard handler + * and associated output device (ie, the local console, if any). + */ + +/* + * $Log: keyboard.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:32 tneale + * Tornado shuffle + * + * Revision 2.6 2001/01/19 22:23:35 paul + * Update copyright. + * + * Revision 2.5 2000/03/17 00:12:12 meister + * Update copyright message + * + * Revision 2.4 1998/02/25 04:57:14 sra + * Update copyrights. + * + * Revision 2.3 1997/03/20 06:53:20 sra + * DFARS-safe copyright text. Zap! + * + * Revision 2.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 2.1 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 2.0 1995/05/10 22:38:15 sra + * Attache release 3.0. + * + * Revision 1.4 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 1.3 1994/09/04 23:55:50 sra + * Get rid of most of the ancient NO_PP cruft. + * + * Revision 1.2 1993/07/31 23:25:22 sra + * Add keyboard_write(). + * + * Revision 1.1 1993/07/05 21:53:06 sra + * Initial revision + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef _SNARK_KEYBOARD_H_ +#define _SNARK_KEYBOARD_H_ + +extern void keyboard_handler (void (*)(unsigned char *, size_t)); +extern void keyboard_write (unsigned char *, size_t); + +#endif diff --git a/h/wrn/wm/demo/keyword.h b/h/wrn/wm/demo/keyword.h new file mode 100644 index 0000000..1b14cad --- /dev/null +++ b/h/wrn/wm/demo/keyword.h @@ -0,0 +1,84 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/keyword.h,v 1.1.1.1 2001/11/05 17:47:32 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: keyword.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:32 tneale + * Tornado shuffle + * + * Revision 1.7 2001/01/19 22:23:35 paul + * Update copyright. + * + * Revision 1.6 2000/03/17 00:12:12 meister + * Update copyright message + * + * Revision 1.5 1998/02/25 04:57:15 sra + * Update copyrights. + * + * Revision 1.4 1997/03/20 06:53:20 sra + * DFARS-safe copyright text. Zap! + * + * Revision 1.3 1997/03/09 18:39:25 sra + * Fix some compiler warnings, change from compile-time to run-time init + * macros for keyword tables. + * + * Revision 1.2 1997/02/24 00:56:59 sra + * Support for run-time configuration of BUG() macros. + * + * Revision 1.1 1997/02/19 08:13:05 sra + * Initial revision + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef SNARK_KEYWORD_H +#define SNARK_KEYWORD_H + +enum keyword_error { + KEYWORD_ERROR_OK, + KEYWORD_ERROR_NOT_FOUND, + KEYWORD_ERROR_AMBIGUOUS +}; + +struct keyword_table { + void *table; + size_t table_length; + size_t entry_size; + enum keyword_error error; + void *result; + unsigned flags; +}; + +#define KEYWORD_ERROR(_table_) \ + ((_table_)->error) + +#define KEYWORD_INIT(_table_, _array_) \ + keyword_init((_table_), (_array_), \ + sizeof(_array_)/sizeof(*(_array_)), \ + sizeof(*(_array_))) + +extern void keyword_init(struct keyword_table *, void *, size_t, size_t); +extern void *keyword_find(struct keyword_table *, const char *); + +#endif /* SNARK_KEYWORD_H */ diff --git a/h/wrn/wm/demo/main.h b/h/wrn/wm/demo/main.h new file mode 100644 index 0000000..1103855 --- /dev/null +++ b/h/wrn/wm/demo/main.h @@ -0,0 +1,88 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/main.h,v 1.1.1.1 2001/11/05 17:47:32 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: main.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:32 tneale + * Tornado shuffle + * + * Revision 1.6 2001/01/19 22:23:35 paul + * Update copyright. + * + * Revision 1.5 2000/03/17 00:12:12 meister + * Update copyright message + * + * Revision 1.4 1998/02/25 04:57:15 sra + * Update copyrights. + * + * Revision 1.3 1997/03/20 06:53:21 sra + * DFARS-safe copyright text. Zap! + * + * Revision 1.2 1997/02/24 00:56:59 sra + * Support for run-time configuration of BUG() macros. + * + * Revision 1.1 1997/02/19 08:13:05 sra + * Initial revision + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef SNARK_MAIN_H +#define SNARK_MAIN_H + +/* + * snark_main() is Snark's equivilent to the C main() function: + * once the snark universe has been initialized, snark calls + * a function by this name, which must exist, and assumes that + * this function is the starting point of the real application. + */ + +extern void snark_main(struct task *initial_task, void *cookie); + +/* + * snark_exit() is like exit() but it first does a clean shutdown + * of all the Snark stuff, which might matter if you're running under Purify + * and care about memory leaks, or if you're running under DOS and ever want + * to use your machine again without rebooting it first. + */ + +extern void snark_exit(int value); + +/* + * Default argblock format for snark_main(). You can override this + * by defining one of the user-exits SNARK_PRE_INIT_HOOK() or + * SNARK_POST_INIT_HOOK(). + */ + +struct snark_main_args { + int argc; + char **argv; +}; + +/* + * Internal variables used by snark_exit() and tasks_run(). + */ +extern int snark_exit_flag, snark_exit_value; + +#endif /* SNARK_MAIN_H */ diff --git a/h/wrn/wm/demo/netconf.h b/h/wrn/wm/demo/netconf.h new file mode 100644 index 0000000..4ea49b0 --- /dev/null +++ b/h/wrn/wm/demo/netconf.h @@ -0,0 +1,114 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/netconf.h,v 1.2 2002/02/27 21:42:08 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: netconf.h,v $ + * Revision 1.2 2002/02/27 21:42:08 josh + * fix include path + * + * Revision 1.1 2001/11/08 16:00:57 tneale + * Adding header files originally from snark/lib + * + * Revision 2.10 2001/01/19 22:23:46 paul + * Update copyright. + * + * Revision 2.9 2000/03/17 00:12:40 meister + * Update copyright message + * + * Revision 2.8 1998/02/25 04:57:27 sra + * Update copyrights. + * + * Revision 2.7 1997/05/20 02:08:06 mrf + * ipaddr_t, ldb macro and routing api conversion of media layer and arp code + * + * Revision 2.6 1997/03/20 06:52:58 sra + * DFARS-safe copyright text. Zap! + * + * Revision 2.5 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 2.4 1996/05/08 18:18:09 lowell + * "gratuitous ARP" shouldn't break non-ARP nets now + * + * Revision 2.3 1996/04/30 20:29:33 josh + * Damage control -- forcing SNARK_GRATUITOUS_ARPt to 0 + * + * Revision 2.2 1996/04/23 22:05:58 lowell + * added ARP-for-my-own-address on startup + * (to solve problems associated with making up ethernet addresses + * out of thin air) + * + * Revision 2.1 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 2.0 1995/05/10 22:38:15 sra + * Attache release 3.0. + * + * Revision 1.4 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 1.3 1994/09/04 23:55:50 sra + * Get rid of most of the ancient NO_PP cruft. + * + * Revision 1.2 1994/01/09 23:57:29 sra + * Add support for NIT under SunOS 4.1.2. + * + * Revision 1.1 1993/07/05 21:53:30 sra + * Initial revision + * + */ + +/* + * Generic network initialization routines for snark. + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef _NETCONF_H_ +#define _NETCONF_H_ + +/* + * Stuff provided by generic snark code. + */ +extern void netconfig (void); +extern boolean_t netconfig_if (struct net *); + +/* + * Each port of snark has to provide this routine. + */ +extern void netconfig_find (void); + +/* + * The BPF code needs to send out ARPs because it gets a new hardware + * address every time it starts up. If any other systems need to do + * this too, they can be added here. + */ +#if INSTALL_SNARK_BSD_BPF +#define SNARK_GRATUITOUS_ARP 1 +void snark_gratuitous_arp(net_if *, ipaddr_t *); +#include +#else +#define SNARK_GRATUITOUS_ARP 0 +#endif /* INSTALL_SNARK_BSD_BPF */ + +#endif /* _NETCONF_H_ */ diff --git a/h/wrn/wm/demo/nit.h b/h/wrn/wm/demo/nit.h new file mode 100644 index 0000000..52bab54 --- /dev/null +++ b/h/wrn/wm/demo/nit.h @@ -0,0 +1,84 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/nit.h,v 1.1 2001/11/08 16:00:57 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1994-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: nit.h,v $ + * Revision 1.1 2001/11/08 16:00:57 tneale + * Adding header files originally from snark/lib + * + * Revision 2.8 2001/01/19 22:23:46 paul + * Update copyright. + * + * Revision 2.7 2000/03/17 00:12:40 meister + * Update copyright message + * + * Revision 2.6 1998/07/31 19:45:46 wes + * Put packet filtering into NIT driver... + * + * Revision 2.5 1998/02/25 04:57:28 sra + * Update copyrights. + * + * Revision 2.4 1997/05/02 02:45:50 sra + * Support NIT in promiscuous mode, for IPv6 multicast. + * + * Revision 2.3 1997/03/20 06:52:59 sra + * DFARS-safe copyright text. Zap! + * + * Revision 2.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 2.1 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 2.0 1995/05/10 22:38:15 sra + * Attache release 3.0. + * + * Revision 1.3 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 1.2 1994/09/04 23:55:50 sra + * Get rid of most of the ancient NO_PP cruft. + * + * Revision 1.1 1994/01/09 23:57:29 sra + * Add support for NIT under SunOS 4.1.2. + * + */ + +/* + * NIT interface to ethernet for Attache testing under SunOS 4.1.2. + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef _NIT_H_ +#define _NIT_H_ + +extern int nit_open (char *, unsigned, unsigned char *); +extern int nit_write (int, unsigned char *, unsigned); +extern void nit_close (int); +extern void nit_find (void (*)(char *, void *), void *); +extern int nit_read (int, unsigned, + void (*)(unsigned char *, unsigned, unsigned, void *), + void *); + +#endif /* _NIT_H_ */ diff --git a/h/wrn/wm/demo/nitdrive.h b/h/wrn/wm/demo/nitdrive.h new file mode 100644 index 0000000..93556b5 --- /dev/null +++ b/h/wrn/wm/demo/nitdrive.h @@ -0,0 +1,74 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/nitdrive.h,v 1.1 2001/11/08 16:00:58 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1994-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: nitdrive.h,v $ + * Revision 1.1 2001/11/08 16:00:58 tneale + * Adding header files originally from snark/lib + * + * Revision 2.6 2001/01/19 22:23:47 paul + * Update copyright. + * + * Revision 2.5 2000/03/17 00:12:41 meister + * Update copyright message + * + * Revision 2.4 1998/02/25 04:57:29 sra + * Update copyrights. + * + * Revision 2.3 1997/03/20 06:53:01 sra + * DFARS-safe copyright text. Zap! + * + * Revision 2.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 2.1 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 2.0 1995/05/10 22:38:15 sra + * Attache release 3.0. + * + * Revision 1.3 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 1.2 1994/09/04 06:13:38 sra + * Clean up antique type names and install macros. + * + * Revision 1.1 1994/01/09 23:57:29 sra + * Add support for NIT under SunOS 4.1.2. + * + */ + +/* + * Attache code for interfacing to ethernet via the Network Interface Tap + * on SunOS 4.1.2. + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef _NITDRIVE_H_ +#define _NITDRIVE_H_ + +extern void nit_driver_find + (void (*config)(char *, struct driver *, int, bits16_t, unsigned, bits32_t)); + +#endif /* _NITDRIVE_H_ */ diff --git a/h/wrn/wm/demo/nvutils.h b/h/wrn/wm/demo/nvutils.h new file mode 100644 index 0000000..68cd9b9 --- /dev/null +++ b/h/wrn/wm/demo/nvutils.h @@ -0,0 +1,604 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/nvutils.h,v 1.3 2002/05/23 18:51:11 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: nvutils.h,v $ + * Revision 1.3 2002/05/23 18:51:11 josh + * code modifications to support the entity MIB + * + * Revision 1.2 2001/11/07 14:27:44 tneale + * Added wm to include path + * + * Revision 1.1.1.1 2001/11/05 17:47:36 tneale + * Tornado shuffle + * + * Revision 7.16.4.3 2001/09/18 19:07:55 josh + * base-level support for proxy and coexistence nvram routines + * + * Revision 7.16.4.2 2001/07/20 20:36:58 josh + * nvutils support for community objects + * + * Revision 7.16.4.1 2001/06/28 18:24:11 josh + * Seeding the Cormorant branch with the code from the old + * cormorant branch + * + * Revision 7.16 2001/04/13 19:52:04 josh + * overwriting the trunk version of this file with the one from + * the kingfisher branch + * + * Revision 7.15 2001/01/19 22:23:35 paul + * Update copyright. + * + * Revision 7.14 2000/06/09 15:00:28 josh + * updated for new proxy code and new installation options + * + * Revision 7.13.4.1 2001/04/13 19:50:33 josh + * preserving special proxy-related changes to this file + * on the cormorant branch + * + * Revision 7.13.2.3 2001/03/12 22:09:28 tneale + * Updated copyright + * + * Revision 7.13.2.2 2001/01/19 21:38:28 josh + * a new mechanism for hardcoding traps with arbitrary varbind lists + * into an agent. useful for testing purposes + * + * Revision 7.13.2.1 2000/09/20 19:05:40 josh + * bringing branch into line with root tree + * + * Revision 7.13 2000/03/17 00:12:12 meister + * Update copyright message + * + * Revision 7.12 1999/10/19 15:16:31 josh + * adding support for new sections: target_addr, target_params, notify, + * notify_filter_profile, and notify_filter. + * + * Revision 7.11 1998/09/16 19:56:46 sar + * Added some user exits for the v3 method routines to use in the binary code + * + * Revision 7.10 1998/06/28 00:21:58 sar + * Corrected type signature for nv_view_add_mod + * + * Revision 7.9 1998/06/23 20:46:18 sar + * Update the calling arguments for the config routine + * + * Revision 7.8 1998/06/16 05:34:53 sar + * clean up some type info + * return the 1445 routines to their previous state + * return the proper errors for v3 routines + * + * Revision 7.7 1998/06/09 22:14:08 sar + * Added TV3CONTEXT and TV3CNAME + * + * Revision 7.6 1998/06/07 02:10:34 sar + * Move the global configuration arguments here and renamed them + * (NV_Config_Static et al). + * + * Revision 7.5 1998/05/23 19:11:33 sar + * Modified the view routines to include rfc2275 and added other + * routines to deal with v3 mibs (access, groups, users, engineids etc). + * + * Revision 7.4 1998/02/25 04:57:59 sra + * Update copyrights. + * + * Revision 7.3 1997/03/20 06:53:51 sra + * DFARS-safe copyright text. Zap! + * + * Revision 7.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 7.1 1997/01/08 01:58:11 sar + * Removed no_pp stuff and updated copyrights + * + * Revision 7.0 1996/03/18 20:19:20 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 6.2 1996/01/10 16:41:40 sar + * Usec updates - added a new set of options to the config file + * for use with the usec agentid, access, context and user info. + * + * Revision 6.1 1995/10/20 22:39:59 sar + * Cut nvutils down to only have the routines for dealing with views. + * + * Revision 6.0 1995/05/31 21:50:18 sra + * Release 6.0. + * + * Revision 5.2 1994/11/01 17:54:49 sar + * Added a flag to the mod list entry to allow us to determine if the + * entry was being deleted and therefore shouldn't be written out. + * + * Revision 5.1 1994/09/23 19:29:50 sar + * Removed the old non volatile scheme and added a new one that is hopefully + * easier to use and allows for some new options such as a read only + * flag to prohibit creating a new config file. The config stuff will + * only be included if needed. + * In snmptalk and snmpint added a next function. + * + * Revision 5.0 1994/05/16 15:57:40 sar + * Updated revision to 5.0 and copyright to include 1994 + * + * Revision 4.0 1993/06/24 17:14:56 sar + * Updated rev to 4.0 and copyright to 93 + * + * Revision 1.4 1993/06/02 23:23:10 dab + * since this file gets included by other things, it needs to include + * envoy files with not just + * + * Revision 1.3 1993/05/31 19:07:48 sar + * changed to use a text rather than binary format for non volatile + * storage, this allows me to use an editor to change the config files. + * + * Revision 1.2 1993/05/13 22:00:33 sar + * changed stat to statflg to avoid conflicts elsewhere. + * + * Revision 1.1 1993/05/13 19:08:06 sar + * Initial revision + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +/***************************************************************************** + ***************************************************************************** + + Note well: some of these definitions are used in the pSOS examples as part of + the api. Don't make changes without understanding which parts are in use. + + ***************************************************************************** + ****************************************************************************/ + +#include +#include +#include +#include +#include + +#if !defined(nvutils_inc) +#define nvutils_inc + +#define NV_VIEW_MAXNAMELEN 32 + +typedef struct TB_S + { + int token_tag; /* Tag for this token */ + char *token_string; /* String representation for this token */ + } TB_T; + +typedef struct MODS_S + { + struct MODS_S *next; /* The next entry in the linked list */ + PTR_T data; /* The structure for the entity */ + PTR_T newdata; /* new info for the entry */ + INT_32_T flags; /* Flags to describe what to do with + this entity. Currently only + destroy is defined */ +#if (INSTALL_ENVOY_SNMP_RFC2275_VIEWS) + bits8_t name[NV_VIEW_MAXNAMELEN]; /* the name of the view */ + ALENGTH_T namelen; /* length of the name */ +#endif + } MODS_T; + +#define NV_MOD_DESTROY 1 + +#define TVERSION 1 + +#define TCOMMENT 1 +#define TPREAMBLE 2 +#define TVIEW 3 +#define TMYAGENT 4 +#define TAGENT 5 +#define TACCESS 6 +#define TCONTEXT 7 +#define TUSER 8 +#define TV3MYENGINE 9 +#define TV3ENGINE 10 +#define TV3USER 11 +#define TV3GROUP 12 +#define TV3ACCESS 13 +#define TV3CONTEXT 14 +#define TV3TADDR 15 +#define TV3TPARM 16 +#define TV3NTFY 17 +#define TV3NPROF 18 +#define TV3NFILT 19 +#define TV3TRAP 20 +#define TV3PROXY 21 +#define TCOMMUNITY 22 +#define TENTLOGIC 23 + +#define TVID 1 +#define TVSTATUS 2 +#define TVSTORAGE 3 +#define TVMASK 4 +#define TVTYPE 5 + +#define TAGID 1 +#define TAGBOOTS 2 + +#define TACID 1 +#define TACUNAME 2 +#define TACCNAME 3 +#define TACQOS 4 +#define TACPRIV 5 +#define TACRIND 6 +#define TACWIND 7 + +#define TCID 1 +#define TCCNAME 2 +#define TCFLAGS 3 + +#define TUID 1 +#define TUUNAME 2 +#define TUAUTHPROT 3 +#define TUAUTHKEY 4 + +#define TENGID 1 +#define TENGBOOTS 2 +#define TENGTADDR 3 + +#define TV3UID 1 +#define TV3UUNAME 2 +#define TV3UAUTHPROT 3 +#define TV3UAUTHKEY 4 +#define TV3UPRIVPROT 5 +#define TV3UPRIVKEY 6 +#define TV3USTATUS 7 +#define TV3USTORAGE 8 + +#define TV3GUSER 1 +#define TV3GMODEL 2 +#define TV3GGROUP 3 +#define TV3GSTATUS 4 +#define TV3GSTORAGE 5 + +#define TV3ACGROUP 1 +#define TV3ACPREFIX 2 +#define TV3ACMATCH 3 +#define TV3ACMODEL 4 +#define TV3ACLEVEL 5 +#define TV3ACREAD 6 +#define TV3ACWRITE 7 +#define TV3ACNOTIFY 8 +#define TV3ACSTATUS 9 +#define TV3ACSTORAGE 10 + +#define TV3CNAME 1 + +#define TV3TADDRNAME 1 +#define TV3TADDRTDOM 2 +#define TV3TADDRTADDR 3 +#define TV3TADDRTMASK 4 +#define TV3TADDRTMOUT 5 +#define TV3TADDRRETRY 6 +#define TV3TADDRTLIST 7 +#define TV3TADDRTMMS 8 +#define TV3TADDRPARMS 9 +#define TV3TADDRSTORAGE 10 +#define TV3TADDRSTATUS 11 + +#define TV3TPARMNAME 1 +#define TV3TPARMMPMOD 2 +#define TV3TPARMSECMOD 3 +#define TV3TPARMSECNAM 4 +#define TV3TPARMSECLVL 5 +#define TV3TPARMSTORAGE 6 +#define TV3TPARMSTATUS 7 + +#define TV3NTFYNAME 1 +#define TV3NTFYTAG 2 +#define TV3NTFYTYPE 3 +#define TV3NTFYSTORAGE 4 +#define TV3NTFYSTATUS 5 + +#define TV3NPROFPARM 1 +#define TV3NPROFNAME 2 +#define TV3NPROFSTORAGE 3 +#define TV3NPROFSTATUS 4 + +#define TV3NFILTPNAME 1 +#define TV3NFILTSTREE 2 +#define TV3NFILTMASK 3 +#define TV3NFILTTYPE 4 +#define TV3NFILTSTORAGE 5 +#define TV3NFILTSTATUS 6 + +#define TV3TRAPNAME 1 +#define TV3TRAPOID 2 +#define TV3TRAPTYPE 3 +#define TV3TRAPVALUE 4 +#define TV3TRAPCOUNT 5 + +#define TV3PROXYNAME 1 +#define TV3PROXYTYPE 2 +#define TV3PROXYCONID 3 +#define TV3PROXYCONNAME 4 +#define TV3PROXYPARAMSIN 5 +#define TV3PROXYSINGLE 6 +#define TV3PROXYMULTIPLE 7 +#define TV3PROXYSTORAGE 8 +#define TV3PROXYSTATUS 9 + +#define TCOMMINDEX 1 +#define TCOMMNAME 2 +#define TCOMMSECNAME 3 +#define TCOMMCONID 4 +#define TCOMMCONNAME 5 +#define TCOMMTAG 6 +#define TCOMMSTORAGE 7 +#define TCOMMSTATUS 8 + +#define TENTLOGICINDEX 1 +#define TENTLOGICDESCR 2 +#define TENTLOGICTYPE 3 +#define TENTLOGICCOMMUNITY 4 +#define TENTLOGICTADDRESS 5 +#define TENTLOGICTDOMAIN 6 +#define TENTLOGICCONID 7 +#define TENTLOGICCONNAME 8 + +extern int SNMP_NV_Config (char *); +extern void SNMP_NV_Clean (void); +extern int SNMP_NV_Write (int); +extern void SNMP_NV_Doit (void); + +struct SNMP_PKT_S; +struct VB_S; + +#if (INSTALL_ENVOY_SNMP_V3_TARGET) && (INSTALL_ENVOY_SNMP_V3_NOTIFY) +typedef struct SNMPV3_TRAP_S + { + struct SNMPV3_TRAP_S *next; + EBUFFER_T trap_name; + VBL_T *vblp; + } SNMPV3_TRAP_T; + +extern SNMPV3_TRAP_T *trap_root; +#endif + +#if (INSTALL_ENVOY_SNMP_RFC1445_VIEWS) +struct VIEWLEAF_S; +extern int SNMP_NV_View_Add_Mod (struct VIEWLEAF_S *, INT_32_T); +#endif + +#if (INSTALL_ENVOY_SNMP_RFC2275_VIEWS) +struct VIEWLEAF_S; +extern sbits32_t SNMP_NV_View_2275_Add_Mod (struct VIEWLEAF_S *, + struct VIEWLEAF_S *, + sbits32_t); +extern sbits32_t snmp_view_2275_test (struct SNMP_PKT_S *, struct VB_S *, + struct VIEWLEAF_S *, + struct VIEWLEAF_S *); +extern void snmp_view_2275_set (struct SNMP_PKT_S *, struct VB_S *, + struct VIEWLEAF_S *, + struct VIEWLEAF_S *); +extern void snmp_view_2275_backout (struct VIEWLEAF_S *, + struct VIEWLEAF_S *); +extern int snmp_view_2275_undo (struct SNMP_PKT_S *, struct VB_S *, + struct VIEWLEAF_S *, + struct VIEWLEAF_S *); +extern void snmp_view_2275_finished (void); + +#endif + +#if (INSTALL_ENVOY_SNMP_VERSION_3) +struct SNMP_GROUP_S; +extern sbits32_t SNMP_NV_V3_Group_Add_Mod (struct SNMP_GROUP_S *, + struct SNMP_GROUP_S *, + sbits32_t); +extern sbits32_t snmp_v3_group_test (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_GROUP_S *, + struct SNMP_GROUP_S *); +extern void snmp_v3_group_set (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_GROUP_S *, + struct SNMP_GROUP_S *); +extern void snmp_v3_group_backout (struct SNMP_GROUP_S *, + struct SNMP_GROUP_S *); +extern int snmp_v3_group_undo (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_GROUP_S *, + struct SNMP_GROUP_S *); +extern void snmp_v3_group_finished (void); + + +struct SNMP_ACCESS_S; +extern sbits32_t SNMP_NV_V3_Access_Add_Mod (struct SNMP_ACCESS_S *, + struct SNMP_ACCESS_S *, + sbits32_t); +extern sbits32_t snmp_v3_access_test (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_ACCESS_S *, + struct SNMP_ACCESS_S *); +extern void snmp_v3_access_set (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_ACCESS_S *, + struct SNMP_ACCESS_S *); +extern void snmp_v3_access_backout (struct SNMP_ACCESS_S *, + struct SNMP_ACCESS_S *); +extern int snmp_v3_access_undo (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_ACCESS_S *, + struct SNMP_ACCESS_S *); +extern void snmp_v3_access_finished (void); + + +struct SNMP_USER_S; +extern sbits32_t SNMP_NV_V3_User_Add_Mod (struct SNMP_USER_S *, + struct SNMP_USER_S *, + sbits32_t); +extern sbits32_t snmp_v3_user_test (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_USER_S *, + struct SNMP_USER_S *); +extern void snmp_v3_user_set (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_USER_S *, + struct SNMP_USER_S *); +extern void snmp_v3_user_backout (struct SNMP_USER_S *, + struct SNMP_USER_S *); +extern int snmp_v3_user_undo (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_USER_S *, + struct SNMP_USER_S *); +extern void snmp_v3_user_finished (void); + +#if (INSTALL_ENVOY_SNMP_V3_TARGET) + +struct SNMP_TARGET_ADDR_S; +extern sbits32_t SNMP_NV_V3_TAddr_Add_Mod (struct SNMP_TARGET_ADDR_S *, + struct SNMP_TARGET_ADDR_S *, + sbits32_t); +extern sbits32_t snmp_v3_taddr_test (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_TARGET_ADDR_S *, + struct SNMP_TARGET_ADDR_S *); +extern void snmp_v3_taddr_set (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_TARGET_ADDR_S *, + struct SNMP_TARGET_ADDR_S *); +extern void snmp_v3_taddr_backout (struct SNMP_TARGET_ADDR_S *, + struct SNMP_TARGET_ADDR_S *); +extern int snmp_v3_taddr_undo (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_TARGET_ADDR_S *, + struct SNMP_TARGET_ADDR_S *); +extern void snmp_v3_taddr_finished (void); + +struct SNMP_TARGET_PARAMS_S; +extern sbits32_t SNMP_NV_V3_TParam_Add_Mod (struct SNMP_TARGET_PARAMS_S *, + struct SNMP_TARGET_PARAMS_S *, + sbits32_t); +extern sbits32_t snmp_v3_tparam_test (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_TARGET_PARAMS_S *, + struct SNMP_TARGET_PARAMS_S *); +extern void snmp_v3_tparam_set (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_TARGET_PARAMS_S *, + struct SNMP_TARGET_PARAMS_S *); +extern void snmp_v3_tparam_backout (struct SNMP_TARGET_PARAMS_S *, + struct SNMP_TARGET_PARAMS_S *); +extern int snmp_v3_tparam_undo (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_TARGET_PARAMS_S *, + struct SNMP_TARGET_PARAMS_S *); +extern void snmp_v3_tparam_finished (void); + +#if (INSTALL_ENVOY_SNMP_V3_NOTIFY) + +struct SNMP_NOTIFY_S; +extern sbits32_t SNMP_NV_V3_Notify_Add_Mod (struct SNMP_NOTIFY_S *, + struct SNMP_NOTIFY_S *, + sbits32_t); +extern sbits32_t snmp_v3_notify_test (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_NOTIFY_S *, + struct SNMP_NOTIFY_S *); +extern void snmp_v3_notify_set (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_NOTIFY_S *, + struct SNMP_NOTIFY_S *); +extern void snmp_v3_notify_backout (struct SNMP_NOTIFY_S *, + struct SNMP_NOTIFY_S *); +extern int snmp_v3_notify_undo (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_NOTIFY_S *, + struct SNMP_NOTIFY_S *); +extern void snmp_v3_notify_finished (void); + +struct SNMP_NOTIFY_FILTER_PROFILE_S; +extern sbits32_t SNMP_NV_V3_NProf_Add_Mod (struct SNMP_NOTIFY_FILTER_PROFILE_S *, + struct SNMP_NOTIFY_FILTER_PROFILE_S *, + sbits32_t); +extern sbits32_t snmp_v3_nprof_test (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_NOTIFY_FILTER_PROFILE_S *, + struct SNMP_NOTIFY_FILTER_PROFILE_S *); +extern void snmp_v3_nprof_set (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_NOTIFY_FILTER_PROFILE_S *, + struct SNMP_NOTIFY_FILTER_PROFILE_S *); +extern void snmp_v3_nprof_backout (struct SNMP_NOTIFY_FILTER_PROFILE_S *, + struct SNMP_NOTIFY_FILTER_PROFILE_S *); +extern int snmp_v3_nprof_undo (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_NOTIFY_FILTER_PROFILE_S *, + struct SNMP_NOTIFY_FILTER_PROFILE_S *); +extern void snmp_v3_nprof_finished (void); + +struct SNMP_NOTIFY_FILTER_S; +extern sbits32_t SNMP_NV_V3_NFilt_Add_Mod (struct SNMP_NOTIFY_FILTER_S *, + struct SNMP_NOTIFY_FILTER_S *, + sbits32_t); +extern sbits32_t snmp_v3_nfilt_test (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_NOTIFY_FILTER_S *, + struct SNMP_NOTIFY_FILTER_S *); +extern void snmp_v3_nfilt_set (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_NOTIFY_FILTER_S *, + struct SNMP_NOTIFY_FILTER_S *); +extern void snmp_v3_nfilt_backout (struct SNMP_NOTIFY_FILTER_S *, + struct SNMP_NOTIFY_FILTER_S *); +extern int snmp_v3_nfilt_undo (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_NOTIFY_FILTER_S *, + struct SNMP_NOTIFY_FILTER_S *); +extern void snmp_v3_nfilt_finished (void); + +#endif /* #if (INSTALL_ENVOY_SNMP_V3_NOTIFY) */ + +#if (INSTALL_ENVOY_SNMP_V3_PROXY) + +struct SNMP_PROXY_S; +extern sbits32_t SNMP_NV_V3_Proxy_Add_Mod (struct SNMP_PROXY_S *, + struct SNMP_PROXY_S *, + sbits32_t); +extern sbits32_t snmp_v3_proxy_test (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_PROXY_S *, + struct SNMP_PROXY_S *); +extern void snmp_v3_proxy_set (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_PROXY_S *, + struct SNMP_PROXY_S *); +extern void snmp_v3_proxy_backout (struct SNMP_PROXY_S *, + struct SNMP_PROXY_S *); +extern int snmp_v3_proxy_undo (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_PROXY_S *, + struct SNMP_PROXY_S *); +extern void snmp_v3_proxy_finished (void); + +#endif /* #if (INSTALL_ENVOY_SNMP_V3_PROXY) */ +#if (INSTALL_ENVOY_SNMP_COEXISTENCE) + +struct SNMP_COMMUNITY_S; +extern sbits32_t SNMP_NV_Community_Add_Mod (struct SNMP_COMMUNITY_S *, + struct SNMP_COMMUNITY_S *, + sbits32_t); +extern sbits32_t snmp_community_test (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_COMMUNITY_S *, + struct SNMP_COMMUNITY_S *); +extern void snmp_community_set (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_COMMUNITY_S *, + struct SNMP_COMMUNITY_S *); +extern void snmp_community_backout (struct SNMP_COMMUNITY_S *, + struct SNMP_COMMUNITY_S *); +extern int snmp_community_undo (struct SNMP_PKT_S *, struct VB_S *, + struct SNMP_COMMUNITY_S *, + struct SNMP_COMMUNITY_S *); +extern void snmp_community_finished (void); + + +#endif /* #if (INSTALL_ENVOY_SNMP_COEXISTENCE */ +#endif /* #if (INSTALL_ENVOY_SNMP_V3_TARGET) */ +#endif /* #if (INSTALL_ENVOY_SNMP_VERSION_3) */ + +#define MAX_NVF 128 +extern char NV_Config_Static[]; +extern char NV_Old_Config_Static[]; +extern char NV_Temp_Config_Static[]; + +extern char *NV_Config_File; +extern char *NV_Old_Config_File; +extern char *NV_Temp_Config_File; + +extern int NV_Read_Only; +extern int NV_Views_From_Config; + +#endif diff --git a/h/wrn/wm/demo/parse.h b/h/wrn/wm/demo/parse.h new file mode 100644 index 0000000..9882ce7 --- /dev/null +++ b/h/wrn/wm/demo/parse.h @@ -0,0 +1,65 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/parse.h,v 1.1.1.1 2001/11/05 17:47:36 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: parse.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:36 tneale + * Tornado shuffle + * + * Revision 2.6 2001/01/19 22:23:36 paul + * Update copyright. + * + * Revision 2.5 2000/03/17 00:12:13 meister + * Update copyright message + * + * Revision 2.4 1998/02/25 04:57:16 sra + * Update copyrights. + * + * Revision 2.3 1997/03/20 06:53:22 sra + * DFARS-safe copyright text. Zap! + * + * Revision 2.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 2.1 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 2.0 1995/05/10 22:38:15 sra + * Attache release 3.0. + * + * Revision 1.2 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 1.1 1993/07/05 21:53:06 sra + * Initial revision + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef _SNARK_PARSE_H_ +#define _SNARK_PARSE_H_ + +extern int parse_line(char *, char *[], int); + +#endif diff --git a/h/wrn/wm/demo/pktd.h b/h/wrn/wm/demo/pktd.h new file mode 100644 index 0000000..bbd58b8 --- /dev/null +++ b/h/wrn/wm/demo/pktd.h @@ -0,0 +1,309 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/pktd.h,v 1.1 2001/11/08 16:00:58 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1992-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + *****************************************************************************/ + +/* + * $Log: pktd.h,v $ + * Revision 1.1 2001/11/08 16:00:58 tneale + * Adding header files originally from snark/lib + * + * Revision 2.9 2001/01/19 22:23:48 paul + * Update copyright. + * + * Revision 2.8 2000/03/17 00:12:42 meister + * Update copyright message + * + * Revision 2.7 1998/02/25 04:57:30 sra + * Update copyrights. + * + * Revision 2.6 1998/02/20 23:07:23 sra + * Add multicast and IPv6 support. + * + * Revision 2.5 1998/02/19 07:46:10 sra + * Preliminary multicast support. + * + * Revision 2.4 1997/07/22 20:33:47 mrf + * put constants in correct include file + * + * Revision 2.3 1997/03/20 06:53:05 sra + * DFARS-safe copyright text. Zap! + * + * Revision 2.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 2.1 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 2.0 1995/05/10 22:38:15 sra + * Attache release 3.0. + * + * Revision 1.3 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 1.2 1993/07/31 02:00:54 sra + * Flush boolean_t from this file. + * + * Revision 1.1 1993/07/30 02:41:24 sra + * Initial revision + * + * + * Revision 1.3 1992/12/10 19:32:36 dab + * Added fake PPP stuff for compatibility with FTP's router. + * + * Revision 1.2 1992/10/13 15:59:35 dab + * Fixes for SLIP + * + * Revision 1.1 92/09/18 15:54:43 dab + * Initial revision + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef _PKTD_H_ +#define _PKTD_H_ + +/* + * The following definitions are from the FTP Software Packet Driver + * specification. + */ + +/* + * Range in which the packet driver interrupt may lie + */ +#define PKTDRVR_MIN_INT 0x60 +#define PKTDRVR_MAX_INT 0x7F + +/* + * The interface classes + */ +#define IC_ETHERNET 1 +#define IC_PRONET10 2 +#define IC_TOKENRING 3 +#define IC_OMNINET 4 +#define IC_APPLETALK 5 +#define IC_SERIAL_LINE 6 +#define IC_STARLAN 7 +#define IC_ARCNET 8 +#define IC_AX25 9 +#define IC_KISS 10 +#define IC_8023 11 +#define IC_FDDI 12 +#define IC_X25 13 +#define IC_LANSTAR 14 +#define IC_FPPP 16 /* "Fake" PPP (Niwot card) */ + +/* packet driver code still needs types byte-swapped */ +#define PD_ET_IP 0x0008 +#define PD_ET_ARP 0x0608 +#define PD_ET_IP6 0xDD86 + +/* + * Packet driver error codes. + */ +#define PDE_NO_ERROR 0 /* Added */ +#define PDE_BAD_HANDLE 1 +#define PDE_NO_CLASS 2 +#define PDE_NO_TYPE 3 +#define PDE_NO_NUMBER 4 +#define PDE_BAD_TYPE 5 +#define PDE_NO_MULTICAST 6 +#define PDE_CANT_TERMINATE 7 +#define PDE_BAD_MODE 8 +#define PDE_NO_SPACE 9 /* Added */ +#define PDE_TYPE_INUSE 10 /* Added */ +#define PDE_BAD_COMMAND 11 /* Added */ +#define PDE_CANT_SEND 12 /* Added */ +#define PDE_NO_PKT_DRVR 128 /* Added */ + +/* + * Interface types (within each class) + */ +#define IT_ANY 0xFFFF + +/* + * Devices in the Ethernet class + */ +#define _3COM_3C501 1 +#define _3COM_3C505 2 +#define INTERLAN_NI5010 3 +#define BICC_4110 4 +#define BICC_4117 5 +#define INTERLAN_NP600 6 +#define UB_NIC 8 +#define UNIVATION 9 +#define TRW_PC2000 10 +#define INTERLAN_NI5210 11 +#define _3COM_3C503 12 +#define _3COM_3C523 13 +#define WESTERN_DIGITAL_WD8003 14 + +/* + * ProNET-10 + */ +#define PROTEON_P1300 1 + +/* + * IEEE 802.5 & IBM Token Ring + */ +#define IBM_TOKEN_RING 1 +#define PROTEON_P1340 2 +#define PROTEON_P1344 2 + +/* + * Driver Functionality Codes (bit-mapped, sort of) + */ +#define PDFC_BASIC 1 /* this one isn't bit-mapped */ +#define PDFC_EXTENDED 2 +#define PDFC_HIGH_PERFORMANCE 4 + +/* + * Extended driver receive modes + */ +#define PKT_RCVR_OFF 1 +#define PKT_RCVR_UNICAST 2 /* unicast only */ +#define PKT_RCVR_BCAST 3 /* unicast + b'cast */ +#define PKT_RCVR_LIM_MCAST 4 /* unicast + b'cast + some m-cast */ +#define PKT_RCVR_ALL_MCAST 5 /* unicast + b'cast + all m-cast */ +#define PKT_RCVR_PROMISCUOUS 6 /* everything */ + +/* + * Define the pkt driver function codes + */ +#define PF_DRIVER_INFO 1 +#define PF_ACCESS_TYPE 2 +#define PF_RELEASE_TYPE 3 +#define PF_SEND_PKT 4 +#define PF_TERMINATE 5 +#define PF_GET_ADDRESS 6 +#define PF_RESET_INTERFACE 7 +#define PF_SET_RCV_MODE 20 +#define PF_GET_RCV_MODE 21 +#define PF_SET_MULTICAST_LIST 22 +#define PF_GET_MULTICAST_LIST 23 +#define PF_GET_STATISTICS 24 + +typedef struct { + int version; + int pdtype; + unsigned char class; + unsigned char number; + char far *name; + char basic_flag; +} pkt_driver_info_t; + +typedef struct { + long int pkts_in; + long int pkts_out; + long int bytes_in; + long int bytes_out; + long int errors_in; + long int errors_out; + long int packets_dropped; + long int pad[4]; /* Space for FTP Software to add new items. */ + + /* + * The remaining fields are TRW PC-2000 extensions + */ + long int ints; /* Interrupts */ + + /* + * XMIT errors... + */ + long int cd_lost; /* Lost Carrier Detect on XMIT */ + long int cts_lost; /* Lost Clear-to-send on XMIT */ + long int xmit_dma_under; /* XMIT DMA underrun */ + long int deferred; /* XMITs deferred */ + long int sqe_lost; /* SQE failed to follow XMIT */ + long int collisions; /* Collisions during XMIT */ + long int ex_collisions; /* XMITs terminated due to excess collisions */ + long int toobig; /* User packet too big to XMIT */ + long int refused; /* User packet refused, no XMIT resources */ + int max_send_pend; /* High water mark of pending transmissions. */ + int place_holder_0; /* Place holder for future use */ + + /* + * RCV errors ... + */ + long int shorts; /* RCVD packets < min length */ + long int longs; /* RCVD packets > max length */ + long int skipped; /* RCVD packets discarded by software. */ + long int crcerrs; /* RCVD packets with CRC errors */ + long int alnerrs; /* RCVD pkts w/ alignment errors*/ + long int rscerrs; /* RCVD pkts but no 82586 rcv resources */ + long int ovrnerrs; /* RCVD pkts lost due to rcv DMA overruns + /* (occurs often using 82586 in loopback) */ + long int unwanted; /* RCVD packets skipped by software because */ + /* no user wants that type. */ + long int user_drops; /* RCVD packets skipped by software because */ + /* user would not provide a buffer. */ +} pkt_driver_statistics_t; + +struct pd_net { + int pd_int; + int handle; + PD_UPCALL_RTN_T *device_receive_rtn; + pkt_driver_info_t drvr_info; +}; + +/* + * Packet driver routines. + */ + +extern int pd_check_int + (int pd_int); + +extern int pd_driver_info + (int handle, + struct pd_net *pd_net); + +extern int pd_access_type + (struct pd_net *pd_net, + int *handle, + unsigned char far *type, + int type_length); + +extern int pd_release_type + (struct pd_net *pd_net, + int handle); + +extern int pd_get_address + (struct pd_net *pdnet, + unsigned char far *address_buffer, + int buffer_length); + +extern int pd_send_pkt + (struct pd_net *pd_net, + unsigned char far *buffer, + unsigned int buffer_length); + +extern char *pd_perror + (int error_code); + +extern int pd_get_rcv_mode + (struct pd_net *pdn, + int *mode); + +extern int pd_set_rcv_mode + (struct pd_net *pdn, + int mode); + +#endif /* _PKTD_H_ */ diff --git a/h/wrn/wm/demo/pktd_bcc.h b/h/wrn/wm/demo/pktd_bcc.h new file mode 100644 index 0000000..2ef093b --- /dev/null +++ b/h/wrn/wm/demo/pktd_bcc.h @@ -0,0 +1,114 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/pktd_bcc.h,v 1.1 2001/11/08 16:00:58 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1992-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + *****************************************************************************/ + +/* + * $Log: pktd_bcc.h,v $ + * Revision 1.1 2001/11/08 16:00:58 tneale + * Adding header files originally from snark/lib + * + * Revision 2.6 2001/01/19 22:23:48 paul + * Update copyright. + * + * Revision 2.5 2000/03/17 00:12:42 meister + * Update copyright message + * + * Revision 2.4 1998/02/25 04:57:31 sra + * Update copyrights. + * + * Revision 2.3 1997/03/20 06:53:06 sra + * DFARS-safe copyright text. Zap! + * + * Revision 2.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 2.1 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 2.0 1995/05/10 22:38:15 sra + * Attache release 3.0. + * + * Revision 1.2 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 1.1 1993/07/30 02:41:24 sra + * Initial revision + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + +/* + * This file contains system and compiler specific information so that the + * source doesn't have to be ifdef'd for all the various compilers + * we try and support. + * + * This file is for Borland C++ version 3.1. + */ + +/* + * Compiler include files - these are development-system dependent + */ +#include +#include +#include + +/* + * Each compiler defines what its saveregs structure looks like. + * The packet driver code requires that it have fields named like below. + */ +struct saveregs { + unsigned int es; + unsigned int ds; + unsigned int di; + unsigned int si; + unsigned int bp; + unsigned int sp; + unsigned int bx; + unsigned int dx; + unsigned int cx; + unsigned int ax; +}; + +/* + * This macro expands into a routine which can be the upcalled routine from + * a packet driver. It should save all its registers on entry into a structure + * and pass that structure, along with a handle argument up to an upcall + * routine argument. + */ +#define PD_UPCALL(routine_name, handle, upcall) \ + void far _saveregs _loadds routine_name(struct saveregs r) \ +{ \ + struct saveregs far *rp; \ + unsigned char far *ret; \ +\ + rp = (struct saveregs far *) \ + ((char *)(&r) - (sizeof(struct saveregs) + 4)); \ + ret = upcall(rp, handle); \ + rp->es = FP_SEG(ret); \ + rp->di = FP_OFF(ret); \ +} + +/* + * This typedef must define PD_UPCALL_RTN_T to be a routine of the same type + * as the PD_UPCALL macro generates. + */ +typedef void far _saveregs _loadds PD_UPCALL_RTN_T(struct saveregs r); diff --git a/h/wrn/wm/demo/pktd_msc.h b/h/wrn/wm/demo/pktd_msc.h new file mode 100644 index 0000000..1b21c8f --- /dev/null +++ b/h/wrn/wm/demo/pktd_msc.h @@ -0,0 +1,124 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/pktd_msc.h,v 1.1 2001/11/08 16:00:58 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + *****************************************************************************/ + +/* + * $Log: pktd_msc.h,v $ + * Revision 1.1 2001/11/08 16:00:58 tneale + * Adding header files originally from snark/lib + * + * Revision 2.7 2001/01/19 22:23:49 paul + * Update copyright. + * + * Revision 2.6 2000/03/17 00:12:42 meister + * Update copyright message + * + * Revision 2.5 1998/02/25 04:57:31 sra + * Update copyrights. + * + * Revision 2.4 1997/03/20 06:53:06 sra + * DFARS-safe copyright text. Zap! + * + * Revision 2.3 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 2.2 1996/10/30 16:29:13 sra + * Conditionalize definition of MK_FP. I no longer remember why we were + * defining this ourselves in the first place. + * + * Revision 2.1 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 2.0 1995/05/10 22:38:15 sra + * Attache release 3.0. + * + * Revision 1.2 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 1.1 1993/07/30 02:41:24 sra + * Initial revision + * + */ + +/* + * This file contains system and compiler specific information so that the + * source doesn't have to be ifdef'd for all the various compilers + * we try and support. + * + * This file is for Microsoft C++. + */ + +/* + * Compiler include files - these are development-system dependent + */ +#include +#include +#include + +/* + * Each compiler defines what its saveregs structure looks like. The packet + * driver code requires that it have fields named like below. + */ +struct saveregs { + unsigned int es; + unsigned int ds; + unsigned int di; + unsigned int si; + unsigned int bp; + unsigned int sp; + unsigned int bx; + unsigned int dx; + unsigned int cx; + unsigned int ax; +}; + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef MK_FP +#define MK_FP(seg,ofs) \ + ((void far *)( (((unsigned long)seg) << 16) + (unsigned long)ofs)) +#endif + +/* + * This macro expands into a routine which can be the upcalled routine from + * a packet driver. It should save all its registers on entry into a structure + * and pass that structure, along with a handle argument up to an upcall + * routine argument. + */ +#define PD_UPCALL(routine_name, handle, upcall) \ + void far _saveregs _loadds routine_name(struct saveregs r) \ +{ \ + struct saveregs far *rp; \ + unsigned char far *ret; \ +\ + rp = (struct saveregs far *) \ + ((char *)(&r) - (sizeof(struct saveregs) + 4)); \ + ret = upcall(rp, handle); \ + rp->es = FP_SEG(ret); \ + rp->di = FP_OFF(ret); \ +} + +/* + * This typedef must define PD_UPCALL_RTN_T to be a routine of the same type + * as the PD_UPCALL macro generates. + */ +typedef void far _saveregs _loadds PD_UPCALL_RTN_T(struct saveregs r); diff --git a/h/wrn/wm/demo/pktdrive.h b/h/wrn/wm/demo/pktdrive.h new file mode 100644 index 0000000..2604a08 --- /dev/null +++ b/h/wrn/wm/demo/pktdrive.h @@ -0,0 +1,74 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/pktdrive.h,v 1.1 2001/11/08 16:00:58 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + *****************************************************************************/ + +/* + * $Log: pktdrive.h,v $ + * Revision 1.1 2001/11/08 16:00:58 tneale + * Adding header files originally from snark/lib + * + * Revision 2.9 2001/01/19 22:23:49 paul + * Update copyright. + * + * Revision 2.8 2000/03/17 00:12:43 meister + * Update copyright message + * + * Revision 2.7 1998/02/25 04:57:34 sra + * Update copyrights. + * + * Revision 2.6 1997/07/23 01:42:34 mrf + * remove redundant constants + * + * Revision 2.5 1997/07/22 20:33:47 mrf + * put constants in correct include file + * + * Revision 2.4 1997/07/01 02:23:00 mrf + * packet drivers still need packet types byteswapped. + * + * Revision 2.3 1997/03/20 06:53:08 sra + * DFARS-safe copyright text. Zap! + * + * Revision 2.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 2.1 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 2.0 1995/05/10 22:38:15 sra + * Attache release 3.0. + * + * Revision 1.2 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 1.1 1993/07/30 02:41:24 sra + * Initial revision + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef _PKTDRIVE_H_ +#define _PKTDRIVE_H_ + +extern void pktd_driver_find(boolean_t (*config)(struct net *)); + +#endif /* _PKTDRIVE_H_ */ diff --git a/h/wrn/wm/demo/pppbsd.h b/h/wrn/wm/demo/pppbsd.h new file mode 100644 index 0000000..5a22d55 --- /dev/null +++ b/h/wrn/wm/demo/pppbsd.h @@ -0,0 +1,60 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/pppbsd.h,v 1.1 2001/11/08 16:00:59 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1994-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: pppbsd.h,v $ + * Revision 1.1 2001/11/08 16:00:59 tneale + * Adding header files originally from snark/lib + * + * Revision 2.4 2001/01/19 22:23:50 paul + * Update copyright. + * + * Revision 2.3 2000/03/17 00:12:43 meister + * Update copyright message + * + * Revision 2.2 1998/02/25 04:57:35 sra + * Update copyrights. + * + * Revision 2.1 1997/10/28 00:51:55 sra + * Convert PPP code to use BUG() macro. + * Bang on CHAP and PAP code some more. + * Create test driver for PPP under Snark/BSD. + * + */ + +/* + * Point-to-Point Protocol (PPP) interface for snark under BSD-derived systems. + * + * This code has only been tested under FreeBSD 2.x. It should work on + * any BSD-derived system with minor modifications. + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef _PPPBSD_H_ +#define _PPPBSD_H_ + +extern void ppp_driver_find + (void (*config)(char *, struct driver *, int, bits16_t, unsigned, bits32_t)); + +#endif /* _PPPBSD_H_ */ diff --git a/h/wrn/wm/demo/read_ini.h b/h/wrn/wm/demo/read_ini.h new file mode 100644 index 0000000..ee26829 --- /dev/null +++ b/h/wrn/wm/demo/read_ini.h @@ -0,0 +1,128 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/read_ini.h,v 1.3 2003/01/15 13:58:30 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 2000-2001 Wind River Systems, Inc. + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: read_ini.h,v $ + * Revision 1.3 2003/01/15 13:58:30 josh + * directory structure shifting + * + * Revision 1.2 2001/11/07 14:27:44 tneale + * Added wm to include path + * + * Revision 1.1.1.1 2001/11/05 17:47:36 tneale + * Tornado shuffle + * + * Revision 2.8 2001/01/19 22:23:36 paul + * Update copyright. + * + * Revision 2.7 2000/03/17 00:12:13 meister + * Update copyright message + * + * Revision 2.6 1998/06/28 20:09:37 sra + * Add support for SNARK_READ_INI_FROM_MEMORY. + * + * Revision 2.5 1998/02/25 04:57:16 sra + * Update copyrights. + * + * Revision 2.4 1997/03/20 06:53:22 sra + * DFARS-safe copyright text. Zap! + * + * Revision 2.3 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 2.2 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 2.1 1995/07/31 13:54:55 sra + * OSPF now working well enough to let somebody else test it. + * + * Revision 2.0 1995/05/10 22:38:15 sra + * Attache release 3.0. + * + * Revision 1.3 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 1.2 1994/09/04 23:55:50 sra + * Get rid of most of the ancient NO_PP cruft. + * + * Revision 1.1 1993/07/05 21:53:06 sra + * Initial revision + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef _READ_INI_H_ +#define _READ_INI_H_ + +#ifndef EPILOGUE_INSTALL_H +#include +#endif + +struct ini_handle { +#if INSTALL_SNARK_READ_INI_FROM_MEMORY + unsigned long current_pos; +#else + FILE *file; +#endif + char *section_name; + unsigned long section_start; + char *iter_variable; + char *buffer; + size_t buflen; +}; + +struct ini_handle_saved { + char *section_name; + unsigned long section_start; + char *iter_variable; + unsigned long current_pos; +}; + +#if INSTALL_SNARK_READ_INI_FROM_MEMORY + +/* + * In-memory configuration table is an array of tag-value pairs. + * A null value indicates that the tag is a section label. + * A null tag indicates the end of the array. + */ + +struct ini_table { + char *tag; + char *value; +}; + +extern struct ini_table etc_ini_table[]; + +#endif + +extern struct ini_handle *ini_open (size_t); +extern void ini_close (struct ini_handle *); +extern char *ini_lookup (struct ini_handle *, char *, char *); +extern char *ini_iter_start (struct ini_handle *, char *, char *); +extern char *ini_iter_next (struct ini_handle *); +extern void ini_save (struct ini_handle *, struct ini_handle_saved *); +extern void ini_restore (struct ini_handle *, struct ini_handle_saved *); + +#endif diff --git a/h/wrn/wm/demo/relay.h b/h/wrn/wm/demo/relay.h new file mode 100644 index 0000000..7b1535e --- /dev/null +++ b/h/wrn/wm/demo/relay.h @@ -0,0 +1,66 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/relay.h,v 1.3 2003/01/15 13:58:30 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 2000-2001 Wind River Systems, Inc. + * Copyright 1990-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: relay.h,v $ + * Revision 1.3 2003/01/15 13:58:30 josh + * directory structure shifting + * + * Revision 1.2 2001/11/07 14:27:45 tneale + * Added wm to include path + * + * Revision 1.1.1.1 2001/11/05 17:47:36 tneale + * Tornado shuffle + * + * Revision 1.5 2001/01/19 22:23:36 paul + * Update copyright. + * + * Revision 1.4 2000/03/17 00:12:13 meister + * Update copyright message + * + * Revision 1.3 1998/02/25 15:21:44 sra + * Finish moving types.h, bug.h, and bugdef.h to common/h/. + * + * Revision 1.2 1998/02/25 04:57:17 sra + * Update copyrights. + * + * Revision 1.1 1997/04/25 05:43:21 sra + * Still hacking PCL-725 relay boards after all these years. + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef _SNARK_RELAY_H_ +#define _SNARK_RELAY_H_ + +#ifndef EPILOGUE_TYPES_H +#include +#endif + +extern bits8_t relay_read (void); +extern void relay_write (bits8_t bits); +extern void relay_start (bits8_t state1, bits32_t delay, bits8_t state2); + +#endif diff --git a/h/wrn/wm/demo/slipbsd.h b/h/wrn/wm/demo/slipbsd.h new file mode 100644 index 0000000..7d170c4 --- /dev/null +++ b/h/wrn/wm/demo/slipbsd.h @@ -0,0 +1,77 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/slipbsd.h,v 1.1 2001/11/08 16:00:59 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 2000-2001 Wind River Systems, Inc. + * Copyright 1994-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: slipbsd.h,v $ + * Revision 1.1 2001/11/08 16:00:59 tneale + * Adding header files originally from snark/lib + * + * Revision 2.6 2001/01/19 22:23:51 paul + * Update copyright. + * + * Revision 2.5 2000/03/17 00:12:44 meister + * Update copyright message + * + * Revision 2.4 1998/02/25 04:57:38 sra + * Update copyrights. + * + * Revision 2.3 1997/03/20 06:53:10 sra + * DFARS-safe copyright text. Zap! + * + * Revision 2.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 2.1 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 2.0 1995/05/10 22:38:15 sra + * Attache release 3.0. + * + * Revision 1.3 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 1.2 1994/09/04 06:13:38 sra + * Clean up antique type names and install macros. + * + * Revision 1.1 1994/01/09 23:57:29 sra + * Add support for NIT under SunOS 4.1.2. + * + */ + +/* + * Serial Line IP (SLIP) interface for snark under BSD-derived systems. + * + * This code has only been tested under NetBSD 0.8. It should work on + * any BSD-derived system with minor modifications. + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef _SLIPBSD_H_ +#define _SLIPBSD_H_ + +extern void slip_driver_find + (void (*config)(char *, struct driver *, int, bits16_t, unsigned, bits32_t)); + +#endif /* _SLIPBSD_H_ */ diff --git a/h/wrn/wm/demo/snarklib.h b/h/wrn/wm/demo/snarklib.h new file mode 100644 index 0000000..8e51f37 --- /dev/null +++ b/h/wrn/wm/demo/snarklib.h @@ -0,0 +1,203 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/snarklib.h,v 1.3 2003/01/15 13:58:30 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 2000-2001 Wind River Systems, Inc. + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: snarklib.h,v $ + * Revision 1.3 2003/01/15 13:58:30 josh + * directory structure shifting + * + * Revision 1.2 2001/11/07 14:27:45 tneale + * Added wm to include path + * + * Revision 1.1.1.1 2001/11/05 17:47:37 tneale + * Tornado shuffle + * + * Revision 2.17 2001/01/19 22:23:36 paul + * Update copyright. + * + * Revision 2.16 2000/10/16 19:21:48 paul + * Restore sockets and mempool code. + * + * Revision 2.15 2000/03/17 00:12:13 meister + * Update copyright message + * + * Revision 2.14 2000/03/13 21:22:00 paul + * Removed some code that we are no longer working on. + * + * Revision 2.13 1999/02/18 04:41:31 wes + * Sockets merge: Everything Else + * - memory pools + * - thread support + * - port-specific headers + * + * Revision 2.12 1998/10/28 18:50:50 josh + * marging in courier-sep98 branch + * + * Revision 2.11.6.1 1998/09/12 19:27:32 sra + * Minor kludges to make this development snapshot of snark compile with + * the released versions of the Attache, Envoy, and Emissary products. + * These changes will need to be un-done when this branch is merged back + * into the main code base. + * + * Revision 2.11.10.2 1998/11/13 18:17:22 wes + * Make SNARK_*LOCK*() calls into the "real" attache global lock + * ATTACHE_*LOCK*() and make it live in attache-land, not snark-land. + * + * Revision 2.11.10.1 1998/09/23 19:17:12 wes + * Merge socket-branch-1 changes to socket-branch-2 + * + * Revision 2.11.8.2 1998/09/11 21:32:02 wes + * Rename EPI_ prefix thread primitives to ETC_ prefix + * + * Revision 2.11.8.1 1998/08/19 13:26:14 wes + * Merge sockets-pthreads work to shared branch + * + * Revision 2.11.2.2 1998/08/12 21:02:46 wes + * alternate spelling of SNARK_ASSERT_LOCK() because i'm lame.. + * + * Revision 2.11.2.1 1998/07/28 18:30:41 wes + * pthreads goop + * + * Revision 2.11 1998/06/11 21:40:31 wes + * Track dhcp invocations + * + * Revision 2.10 1998/02/25 04:57:17 sra + * Update copyrights. + * + * Revision 2.9 1997/08/21 17:23:47 sra + * Begin moving configuration stuff that's common to all products to common.h + * Minor cleanups to common/lib/prng.c. Add pnrg seed function to snarkbsd. + * + * Revision 2.8 1997/07/17 03:38:31 alan + * Add: snark_reset_read_fdproc & snark_reset_write_fdproc. Like + * snark_set_fdprocs, but only makes you mess with the procedure you're + * interested in. + * + * Revision 2.7 1997/05/21 00:18:09 alan + * Expose declaration of snark_set_fdprocs in all environments. + * + * Revision 2.6 1997/05/19 04:26:50 alan + * Let others have access to the basic file descriptor + * select() loop in the task dispatcher. + * + * Revision 2.5 1997/03/20 06:53:23 sra + * DFARS-safe copyright text. Zap! + * + * Revision 2.4 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 2.3 1997/02/24 00:56:59 sra + * Support for run-time configuration of BUG() macros. + * + * Revision 2.2 1997/02/19 08:10:29 sra + * More fun merging snmptalk into snark, general snark cleanup. + * + * Revision 2.1 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 2.0 1995/05/10 22:38:15 sra + * Attache release 3.0. + * + * Revision 1.4 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 1.3 1994/09/04 23:55:50 sra + * Get rid of most of the ancient NO_PP cruft. + * + * Revision 1.2 1993/07/29 04:24:47 sra + * PTCP_DNS_H changed to ATTACHE_DNS_H for release 2.0. + * + * Revision 1.1 1993/07/05 21:53:06 sra + * Initial revision + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef _SNARK_H_ +#define _SNARK_H_ + +#ifndef COMMON_CONFIG_H +#include +#endif + +#include + +#include +#include +#include +#include +#include +#include + +#ifndef COMMON_GLUE_H +#include +#endif + +#if INSTALL_SNARK_BUG_CONF +#include +#endif + +#ifdef INSTALL_SNARK_THREADS +extern void task_kick(void); +#endif + +extern void snark_init (void); +extern void snark_shutdown (void); + +/* Not all Snark ports support this feature. */ +typedef void (*fdproc_t)(int, void *); +extern int snark_set_fdprocs(int, void *, fdproc_t, fdproc_t); +extern int snark_reset_read_fdproc(int, fdproc_t); +extern int snark_reset_write_fdproc(int, fdproc_t); + +/* + * netconfig() sets this up from the config file, it's available + * for use by applications. + */ +#if INSTALL_ATTACHE_DNS +#include +extern struct dns_config domain_config; +#endif + +#if INSTALL_ATTACHE_DHCP +#include + +extern dhcp_stateblk_t *snark_dhcp_find(net_if *net); + +typedef int (*snark_dhcpwalk_fn_t)(void *, dhcp_stateblk_t *, net_if *); + +extern int snark_dhcp_walk(snark_dhcpwalk_fn_t callback, void *cookie); + +extern void snark_dhcp_add (net_if *net, dhcp_stateblk_t *); + +extern int snark_dhcp_set_punt (dhcp_stateblk_t *, int); + +extern int snark_dhcp_get_punt (dhcp_stateblk_t *); + +extern void snark_dhcp_remove (dhcp_stateblk_t *); + +#endif + +#endif /* _SNARK_H_ */ diff --git a/h/wrn/wm/demo/snmpconf.h b/h/wrn/wm/demo/snmpconf.h new file mode 100644 index 0000000..a88a655 --- /dev/null +++ b/h/wrn/wm/demo/snmpconf.h @@ -0,0 +1,204 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/snmpconf.h,v 1.2 2002/03/11 19:23:36 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1991-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* declarations for routines in parse.c */ + +/* + * $Log: snmpconf.h,v $ + * Revision 1.2 2002/03/11 19:23:36 josh + * change dest_addr to an ipaddr_t, and add definitions for ipaddr_t if + * Attache isn't installed + * + * Revision 1.1.1.1 2001/11/05 17:47:37 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:23:37 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:12:13 meister + * Update copyright message + * + * Revision 1.2 1998/11/25 03:38:17 sra + * "timeout" => "snmp_timeout" to fix OpEN symbol conflict. + * + * Revision 1.1 1998/06/23 20:45:04 sar + * The gneral snmp configuration information, moved here from snmptalk/parse.h + * + * Revision 7.8 1998/06/07 02:52:55 sar + * Move the global configuration arguments to snark library + * + * Revision 7.7 1998/05/23 18:19:25 sar + * Added global arguments for v3 along with their defaults + * + * Revision 7.6 1998/02/25 04:58:01 sra + * Update copyrights. + * + * Revision 7.5 1997/03/20 06:53:54 sra + * DFARS-safe copyright text. Zap! + * + * Revision 7.4 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 7.3 1997/02/19 08:10:29 sra + * More fun merging snmptalk into snark, general snark cleanup. + * + * Revision 7.2 1997/01/10 20:32:24 sra + * Punt this copy of parse_line(), since there's a better one snark/lib. + * + * Revision 7.1 1997/01/08 01:58:11 sar + * Removed no_pp stuff and updated copyrights + * + * Revision 7.0 1996/03/18 20:19:20 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 6.3 1996/01/10 16:41:40 sar + * Usec updates + * + * Revision 6.2 1995/11/11 00:09:41 sar + * Added a new command option to decide where the rfc1445 viewtree + * comes from - the config.txt file or nvviews.c + * + * Revision 6.1 1995/10/20 22:39:59 sar + * remvoed dparty, sparty and context info + * + * Revision 6.0 1995/05/31 21:50:19 sra + * Release 6.0. + * + * Revision 5.4 1995/03/21 00:50:48 sar + * Added a packet_dump option to snmptalk, this allows the user to trun + * packet dumping on & off while snmptalk is running. + * + * Revision 5.3 1994/11/09 01:43:52 sar + * Read the nv config file if/when we need to. If the master_agent or + * v2_view options are installed we always read it, if they aren't vut + * v2 is installed we check the snmptalk_version flag if it is 2 we read + * the file if it is 1 we don't. The first time we switch to v2 we + * try and read the file and complain if one doesn't exist. If we only + * have v1 installed we never read the config file. + * + * Revision 5.2 1994/09/23 19:29:50 sar + * Removed the old non volatile scheme and added a new one that is hopefully + * easier to use and allows for some new options such as a read only + * flag to prohibit creating a new config file. The config stuff will + * only be included if needed. + * In snmptalk and snmpint added a next function. + * + * Revision 5.1 1994/07/24 15:41:03 dab + * Added ability to set UDP port used by manager and the set command can + * now specify enumerated integer values by symbolic name. + * + * Revision 5.0 1994/05/16 15:57:40 sar + * Updated revision to 5.0 and copyright to include 1994 + * + * Revision 4.0 1993/06/24 17:14:56 sar + * Updated rev to 4.0 and copyright to 93 + * + * Revision 3.6 1993/05/13 19:08:06 sar + * Added code to use a file implementation of nv memory + * + * Revision 3.5 1993/03/03 20:03:22 dab + * don't undef __(), might need it + * + * Revision 3.4 1993/03/02 18:18:59 dab + * Added read_config_defaults() + * + * Revision 3.3 1993/02/19 19:29:35 dab + * Added mib_filename. + * + * Revision 3.2 1993/02/17 21:20:58 sar + * Extern definition for spoid, dpoid, cpoid, spoidlen, dpoidlen and cpoidlen + * Used to hold parties to send the packet to. + * + * Revision 3.1 92/06/16 16:05:42 dab + * Added batch mode + * + * Revision 3.0 92/04/03 19:53:14 dab + * Release 3.0 + * + * Revision 2.100 91/08/09 14:05:22 dab + * Update version number. This is just before the work to upgrade to + * release 3.0. + * + * Revision 1.1 91/07/11 18:13:37 romkey + * Initial revision + * + */ + + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#if !INSTALL_ATTACHE +#if INSTALL_SNMP_DEMO_AGENT_IPV6 +#define MAX_IP_ADDR_LEN 16 +#else +#define MAX_IP_ADDR_LEN 4 +#endif + +enum ipaddr_type { IPNONE = 0, IPV4 = 4, IPV6 = 6 }; + +typedef bits8_t ipaddr_bits_t; + +typedef struct ipaddr { + enum ipaddr_type type; + ipaddr_bits_t addr[MAX_IP_ADDR_LEN]; +} ipaddr_t; +#endif + +#define ETC_ENV_VARIABLE "ETC_SNMP_CONF" + +extern char *read_community; +extern char *write_community; +extern char *destination; +extern char *mib_filename; +extern ipaddr_t dest_addr; +#if INSTALL_SNMP_DEMO_AGENT_IPV6 +extern int v6_scope; +#endif +extern unsigned udp_port; +extern int snmp_timeout; +extern int retry_count; +extern int batch_mode; +extern int packet_dump; +extern int SNMPTalk_NV_Read; +extern int SNMPTalk_SNMP_Version; + +extern int SNMP_Parse_Opts (int, char **, char *); +extern int SNMP_Config (void); + +/* defaults for version 3 stuff */ +#if INSTALL_ENVOY_SNMP_VERSION_3 +extern char v3_tos_flags; +extern char *v3_con_name; +extern bits8_t v3_con_id[]; +extern ALENGTH_T v3_con_id_len; +extern char *v3_sec_name; +extern bits8_t v3_sec_id[]; +extern ALENGTH_T v3_sec_id_len; +#endif + + +#if INSTALL_ENVOY_SNMP_VERSION_USEC +extern OCTET_T *usec_agentid; +extern OCTET_T *usec_context; +extern OCTET_T usec_qos; +#endif diff --git a/h/wrn/wm/demo/snmpfunc.h b/h/wrn/wm/demo/snmpfunc.h new file mode 100644 index 0000000..bb52713 --- /dev/null +++ b/h/wrn/wm/demo/snmpfunc.h @@ -0,0 +1,89 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/snmpfunc.h,v 1.3 2003/01/15 13:58:30 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: snmpfunc.h,v $ + * Revision 1.3 2003/01/15 13:58:30 josh + * directory structure shifting + * + * Revision 1.2 2001/11/07 14:27:45 tneale + * Added wm to include path + * + * Revision 1.1.1.1 2001/11/05 17:47:37 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:23:37 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:12:13 meister + * Update copyright message + * + * Revision 1.2 1998/06/07 02:29:36 sar + * Add trap community + * + * Revision 1.1 1998/06/07 02:12:01 sar + * Gather a group of common snmp functions in snark/lib so + * we don't have to rewrite them for each new demo. + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef snark_snmpfunc_ins +#define snark_snmpfunc_ins + +#ifndef EPILOGUE_INSTALL_H +#include +#endif + +#ifndef EPILOGUE_TYPES_H +#include +#endif + +#include +#include +#include + +#define SNMP_COMM_MAX 32 + +#if (INSTALL_ENVOY_SNMP_PROXY) +typedef struct TRANS_STUFF_S { + PROXY_BLOCK_T pblockp; + bits16_t port; + bits8_t *addr_str; + ptr_t *pkt; + } TRANS_STUFF_T; +#endif + +extern int validate_SNMP_community __((SNMP_PKT_T *, SNMPADDR_T *, + SNMPADDR_T *)); + +extern int validate_SNMP_V3_Address __((SNMP_PKT_T *, SNMPADDR_T *, + SNMPADDR_T *)); + +extern sbits32_t attache_proxy_send_rtn __((EBUFFER_T *, ptr_t)); + +extern char snmp_get_request_community[]; +extern char snmp_set_request_community[]; +extern char snmp_trap_community[]; + +#endif diff --git a/h/wrn/wm/demo/snoop.h b/h/wrn/wm/demo/snoop.h new file mode 100644 index 0000000..981ab7f --- /dev/null +++ b/h/wrn/wm/demo/snoop.h @@ -0,0 +1,85 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/snoop.h,v 1.1 2001/11/08 16:00:59 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 2000-2001 Wind River Systems, Inc. + * Copyright 1994-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: snoop.h,v $ + * Revision 1.1 2001/11/08 16:00:59 tneale + * Adding header files originally from snark/lib + * + * Revision 1.7 2001/01/19 22:23:53 paul + * Update copyright. + * + * Revision 1.6 2000/03/17 00:12:46 meister + * Update copyright message + * + * Revision 1.5 1998/02/25 04:57:40 sra + * Update copyrights. + * + * Revision 1.4 1997/03/20 06:53:12 sra + * DFARS-safe copyright text. Zap! + * + * Revision 1.3 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 1.2 1997/02/19 08:10:29 sra + * More fun merging snmptalk into snark, general snark cleanup. + * + * Revision 1.1 1996/11/13 15:06:46 mrf + * Initial revision + * + * Revision 2.1 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 2.0 1995/05/10 22:38:15 sra + * Attache release 3.0. + * + * Revision 1.3 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 1.2 1994/09/04 23:55:50 sra + * Get rid of most of the ancient NO_PP cruft. + * + * Revision 1.1 1994/01/09 23:57:29 sra + * Add support for NIT under SunOS 4.1.2. + * + */ + +/* + * Snoop interface to ethernet for Attache testing under Irix. + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef _SNOOP_H_ +#define _SNOOP_H_ + +extern int snoop_open (char *, unsigned, unsigned char *); +extern int snoop_write (int, unsigned char *, unsigned); +extern void snoop_close (int); +extern void snoop_find (void (*)(char *, void *), void *); +extern int snoop_read (int, unsigned, + void (*)(unsigned char *, unsigned, unsigned, void *), + void *); + +#endif /* _SNOOP_H_ */ diff --git a/h/wrn/wm/demo/snoopdrv.h b/h/wrn/wm/demo/snoopdrv.h new file mode 100644 index 0000000..5af15f9 --- /dev/null +++ b/h/wrn/wm/demo/snoopdrv.h @@ -0,0 +1,77 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/snoopdrv.h,v 1.1 2001/11/08 16:00:59 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 2000-2001 Wind River Systems, Inc. + * Copyright 1994-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: snoopdrv.h,v $ + * Revision 1.1 2001/11/08 16:00:59 tneale + * Adding header files originally from snark/lib + * + * Revision 1.6 2001/01/19 22:23:53 paul + * Update copyright. + * + * Revision 1.5 2000/03/17 00:12:46 meister + * Update copyright message + * + * Revision 1.4 1998/02/25 04:57:41 sra + * Update copyrights. + * + * Revision 1.3 1997/03/20 06:53:13 sra + * DFARS-safe copyright text. Zap! + * + * Revision 1.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 1.1 1996/11/13 15:06:46 mrf + * Initial revision + * + * Revision 2.1 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 2.0 1995/05/10 22:38:15 sra + * Attache release 3.0. + * + * Revision 1.3 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 1.2 1994/09/04 06:13:38 sra + * Clean up antique type names and install macros. + * + * Revision 1.1 1994/01/09 23:57:29 sra + * Add support for NIT under SunOS 4.1.2. + * + */ + +/* + * Attache code for interfacing to ethernet via SNOOP on Irix. + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef _SNOOPDRV_H_ +#define _SNOOPDRV_H_ + +extern void snoop_driver_find + (void (*config)(char *, struct driver *, int, bits16_t, unsigned, bits32_t)); + +#endif /* _SNOOPDRV_H_ */ diff --git a/h/wrn/wm/demo/strdup.h b/h/wrn/wm/demo/strdup.h new file mode 100644 index 0000000..e5a235c --- /dev/null +++ b/h/wrn/wm/demo/strdup.h @@ -0,0 +1,52 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/strdup.h,v 1.1.1.1 2001/11/05 17:47:37 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: strdup.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:37 tneale + * Tornado shuffle + * + * Revision 1.3 2001/01/19 22:23:37 paul + * Update copyright. + * + * Revision 1.2 2000/03/17 00:12:14 meister + * Update copyright message + * + * Revision 1.1 1998/06/03 20:28:47 sar + * Local version of the strdup function so we don't have to + * depend on the system for it. + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +/* This used to be part of snmptalk/stdf.h it has been moved to + the snark library so other demo code can use it. The other + stdf functions were moved to the common library. */ + +char *etc_strdup (char *str); +void etc_strdup_free (char *str); + + + + diff --git a/h/wrn/wm/demo/sty.h b/h/wrn/wm/demo/sty.h new file mode 100644 index 0000000..9a8531a --- /dev/null +++ b/h/wrn/wm/demo/sty.h @@ -0,0 +1,218 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/sty.h,v 1.1.1.1 2001/11/05 17:47:37 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 2000-2001 Wind River Systems, Inc. + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: sty.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:37 tneale + * Tornado shuffle + * + * Revision 2.8 2001/01/19 22:23:37 paul + * Update copyright. + * + * Revision 2.7 2000/03/17 00:12:14 meister + * Update copyright message + * + * Revision 2.6 1998/11/23 20:47:29 wes + * If building with GCC, use a gcc extension to declare sty_printf() as + * being printf-like so sty_printf args can be sanity-checked at build + * time. Most visible with stuff relating to the BUG macro.. + * + * Revision 2.5 1998/02/25 04:57:18 sra + * Update copyrights. + * + * Revision 2.4 1997/03/20 06:53:24 sra + * DFARS-safe copyright text. Zap! + * + * Revision 2.3 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 2.2 1997/02/19 08:10:29 sra + * More fun merging snmptalk into snark, general snark cleanup. + * + * Revision 2.1 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 2.0 1995/05/10 22:38:15 sra + * Attache release 3.0. + * + * Revision 1.3 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 1.2 1994/09/04 23:55:50 sra + * Get rid of most of the ancient NO_PP cruft. + * + * Revision 1.1 1993/07/05 21:53:06 sra + * Initial revision + * + */ + +/* + * Software terminal definitions for Snark. + * Based on ideas in Bridgham's doskbd code. + * Keymaps not implemented yet, maybe some day. + */ + +/* [clearcase] +modification history +------------------- +01b,10may05,job increase maximum input line size +01a,20apr05,job update copyright notices +*/ + + +#ifndef _SNARK_STY_H_ +#define _SNARK_STY_H_ + +/* + * GCC has a mode which lets it catch a number of common errors + * made involving printf-like format strings. + * It also has a language extension which lets you declare a function as + * taking a printf-like format string. + * If we're using a suitably new version of GCC (2.5 or newer), use + * this extension. + */ + +#if !defined(__GNUC__) || __GNUC__ < 2 || \ + (__GNUC__ == 2 && __GNUC_MINOR__ < 5) +#define STY_ATTRIBUTE(x) /* delete __attribute__ if non-gcc or gcc1 */ +#else +#define STY_ATTRIBUTE(x) __attribute__(x) +#endif + +#define STY_RING_SIZE 1024 +#define STY_LINE_SIZE 2048 +#define STY_HISTORY_SIZE 20 + +struct sty; +struct sty_driver; + +struct sty { + unsigned flags; /* state flags */ + unsigned char ring_buf[STY_RING_SIZE]; /* input character ring buffer */ + unsigned ring_start, ring_end; /* portion of ring buffer in use */ + char line_buf[STY_LINE_SIZE]; /* input line buffer */ + unsigned line_len; /* length of current line */ + char *history[STY_HISTORY_SIZE]; /* command line history */ + fastint_t history_ptr; /* current command history line */ + struct sty_driver *driver; /* device driver */ + void *driver_cookie; /* cookie for driver code */ + void *app_cookie; /* cookie for application */ + void (*app_receiver)(struct sty *, char *, void *); + char *prompt; /* prompt string, null ok if none */ +}; + +#define STY_FLAG_ECHOING 0x1 +#define STY_FLAG_BLOCKED 0x2 +#define STY_FLAG_ABORTED 0x4 +#define STY_FLAG_INTERRUPTED 0x8 +#define STY_FLAG_RAWMODE 0x10 + +struct sty_driver { + void (*write)(struct sty *, unsigned char *, size_t, void *); + void (*close)(struct sty *, void *); +}; + + + +/* + * The "console", which might be a keyboard/display pair, a log file, + * a null sty driver, a telnet session, a serial line, or something weirder. + * + * In general, it is NOT a good idea to just assume that the cty is the + * right sty to use for interactive commands. The cty is primarily for + * use by code which has no sty context (eg, the BUG() macros), and for + * the initial startup code. + * + * By default, the cty is a keyboard/display pair. + */ +extern struct sty *cty; + +#ifndef CTY_SETUP +#define CTY_SETUP() stykb_open() +#endif + + + +/* + * Declare listener to catch newly opened stys. + * Returns old listener. + */ +typedef void (*sty_listener_t)(struct sty *); +extern sty_listener_t sty_listen(sty_listener_t); + +/* + * Open an sty. Caller provides memory. + * Installs driver, flags, and cookie, then calls sty listener, if any. + */ +extern void sty_open(struct sty *, struct sty_driver *, unsigned, void *); + +/* + * Close an sty. Calls driver close routine, clears driver. + */ +extern void sty_close(struct sty *); + +/* + * Initialize sty system. + */ +extern void sty_init(void); + +/* + * Request a "line" of text from the sty. At the moment a "line" + * really is a line, because EOL is the only break sequence. + * This could change if/when keymaps are implemented. + */ +extern void sty_read + (struct sty *, void (*)(struct sty *, char *, void *), char *, void *); + +/* + * Output routines. + */ +extern void sty_write (struct sty *, char *, size_t); +extern void sty_putc (struct sty *, int); +extern void sty_puts (struct sty *, char *); +extern int sty_printf (struct sty *, char *, ...) + STY_ATTRIBUTE((__format__(__printf__, 2, 3))); + + +/* + * Hand some text from driver to low-level sty code. + */ +extern void sty_receive (struct sty *, unsigned char *, unsigned); + +/* + * Ask how much buffer space this sty has left (for TELNET, mostly). + */ +extern unsigned sty_window (struct sty *); + +/* + * Clear sty input buffer. + */ +extern void sty_discard (struct sty *); + +/* + * Install a new cty. + */ +extern void cty_set(struct sty *sty); + +/* + * This should really go somewhere else, no good place for it though. + */ +extern void stykb_open (void); + +#endif /* _SNARK_STY_H_ */ diff --git a/h/wrn/wm/demo/tasks.h b/h/wrn/wm/demo/tasks.h new file mode 100644 index 0000000..7d64f05 --- /dev/null +++ b/h/wrn/wm/demo/tasks.h @@ -0,0 +1,114 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/tasks.h,v 1.1.1.1 2001/11/05 17:47:37 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: tasks.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:37 tneale + * Tornado shuffle + * + * Revision 2.8 2001/01/19 22:23:37 paul + * Update copyright. + * + * Revision 2.7 2000/03/17 00:12:14 meister + * Update copyright message + * + * Revision 2.6 1998/07/02 06:55:34 sra + * Make Snark restartable under pSOS, and other minor cleanups. + * + * Revision 2.5 1998/02/25 04:57:18 sra + * Update copyrights. + * + * Revision 2.4 1997/03/20 06:53:24 sra + * DFARS-safe copyright text. Zap! + * + * Revision 2.3 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 2.2 1997/02/19 08:10:29 sra + * More fun merging snmptalk into snark, general snark cleanup. + * + * Revision 2.1 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 2.0 1995/05/10 22:38:15 sra + * Attache release 3.0. + * + * Revision 1.3 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 1.2 1994/09/04 23:55:50 sra + * Get rid of most of the ancient NO_PP cruft. + * + * Revision 1.1 1993/07/05 21:53:06 sra + * Initial revision + * + */ + +/* + * Definitions for snark's tasking package. + * + * This is based in large part on Romkey's simtask package, with + * some changes suggested by Bridgham and different modularization + * to fit into snark properly. + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + + +#ifndef _SNARK_TASKS_H_ +#define _SNARK_TASKS_H_ + +/* + * The task structure. + */ +struct task { + char *name; + void (*func) __((struct task *, void *)); + void *cookie; + struct task *next; +}; + +/* + * Tasking functions common to all implementations. + * These handle all the locking crud via glue_intlock(). + */ +extern void task_ini (struct task *); +extern void task_enq (struct task *); +extern struct task *task_deq (void); +extern void task_delq (struct task *); +extern void task_add (struct task *, char *, + void (*)(struct task *, void *), void *); +extern int task_idle (void); + +/* + * The task scheduler itself, provided by each port of snark. + * It should get tasks to run by calling task_deq(). + * If it ever returns, main() will exit with the same value. + */ +extern int tasks_run (void); + +/* + * Initialize static variables for the tasking package. + */ +extern void tasks_init (void); + +#endif /* _SNARK_TASKS_H_ */ diff --git a/h/wrn/wm/demo/tundrive.h b/h/wrn/wm/demo/tundrive.h new file mode 100644 index 0000000..b9c99eb --- /dev/null +++ b/h/wrn/wm/demo/tundrive.h @@ -0,0 +1,25 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/tundrive.h,v 1.1 2001/11/08 16:01:00 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + +extern void tun_driver_find + (void (*config)(char *, struct driver *, int, bits16_t, unsigned, bits32_t)); diff --git a/h/wrn/wm/demo/vapornet.h b/h/wrn/wm/demo/vapornet.h new file mode 100644 index 0000000..d49176b --- /dev/null +++ b/h/wrn/wm/demo/vapornet.h @@ -0,0 +1,69 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/demo/vapornet.h,v 1.1 2001/11/08 16:01:00 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 2000-2001 Wind River Systems, Inc. + * Copyright 1995-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: vapornet.h,v $ + * Revision 1.1 2001/11/08 16:01:00 tneale + * Adding header files originally from snark/lib + * + * Revision 2.6 2001/01/19 22:23:56 paul + * Update copyright. + * + * Revision 2.5 2000/03/17 00:12:49 meister + * Update copyright message + * + * Revision 2.4 1998/02/25 04:57:45 sra + * Update copyrights. + * + * Revision 2.3 1997/03/20 06:53:18 sra + * DFARS-safe copyright text. Zap! + * + * Revision 2.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 2.1 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 2.0 1995/05/10 22:38:15 sra + * Attache release 3.0. + * + * Revision 1.1 1995/03/26 02:29:19 sra + * Initial revision + * + */ + +/* [clearcase] +modification history +------------------- +01a,20apr05,job update copyright notices +*/ + +/* + * Fake network built on BSD "unix domain" sockets. Intended primarily + * to allow building a complex enough network to do some testing of router + * code in a relatively sane debugging environment. + */ + +#ifndef _VAPORNET_H_ +#define _VAPORNET_H_ + +extern void vp_driver_find + (void (*config)(char *, struct driver *, int, bits16_t, unsigned, bits32_t)); + +#endif /* _VAPORNET_H_ */ diff --git a/h/wrn/wm/snmp/engine/agentx.h b/h/wrn/wm/snmp/engine/agentx.h new file mode 100644 index 0000000..f94b255 --- /dev/null +++ b/h/wrn/wm/snmp/engine/agentx.h @@ -0,0 +1,599 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/agentx.h,v 1.9 2002/05/30 17:24:54 andre Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1994-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: agentx.h,v $ + * Revision 1.9 2002/05/30 17:24:54 andre + * Add placeholder definition for AX_RESPONSE_PREPROCESS + * + * Revision 1.8 2002/04/09 14:18:35 tneale + * REGLIST changes to handle list-based registration + * + * Revision 1.7 2002/03/28 14:37:07 tneale + * Removed externs of old mib variables + * + * Revision 1.6 2002/03/20 20:20:41 tneale + * Fixed multiple definition of ENVOY_AX_PARSE_ERROR + * + * Revision 1.5 2002/03/19 21:47:01 tneale + * Changed Agentx protocol error codes per RFC2741 + * + * Revision 1.4 2002/03/18 16:05:43 tneale + * Added cmonnect_id member to Session structure + * + * Revision 1.3 2002/03/12 15:54:39 tneale + * Added structure definition for the registration list + * + * Revision 1.2 2001/11/06 21:35:00 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:22 tneale + * Tornado shuffle + * + * Revision 9.6.4.1 2001/08/17 20:38:43 meister + * Added prototypes for some agentx helper functions which were previously + * declared statically. Added prototypes for agentx and v3 dynamic config init + * functions. + * + * Revision 9.6 2001/01/19 22:22:02 paul + * Update copyright. + * + * Revision 9.5 2000/03/17 19:48:27 meister + * Update copyright notice + * + * Revision 9.4 2000/03/09 20:58:32 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.3 2000/03/09 16:53:16 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.2 1999/12/23 14:47:26 josh + * cleaning up code per Shawn's comments -- removing extraneous + * comments and doing proxy check before notify check + * + * Revision 9.1 1999/03/30 15:20:13 josh + * feature to allow customer-driven context conversion into AgentX + * + * Revision 9.0 1998/10/16 22:10:03 sar + * Update version stamp to match release + * + * Revision 8.2 1998/08/12 04:52:15 sar + * revamp the initialization routines to limit the amount of + * code that might get pulled in. + * + * Revision 8.1 1998/02/25 04:50:19 sra + * Update copyrights. + * + * Revision 8.0 1997/11/18 00:56:19 sar + * Updated revision to 8.0 + * + * Revision 7.4 1997/10/30 04:23:16 sar + * Update type information mostly convert bits16_ts to ALENGTH_Ts + * also add MAX_ALENGTH + * + * Revision 7.3 1997/10/29 04:11:40 sar + * Cleaned up some type mismatches to keep compilers happy + * + * Revision 7.2 1997/10/21 02:53:37 sar + * Added defines for transport types and index allocate and deallocate macros + * and removed leaf decrement function + * + * Revision 7.1 1997/10/16 00:25:16 sar + * Primarily this set of modifications is for the agentx protocol. + * Most of the work was in the agentx.h and ax_mth.h files. Most + * other files (snmpdefs.h, vbdefs.h and mib.h) received updates + * to their structures and snmp got some new lock macros. + * + * One other change of note was the modification of continue + * processing. Previously we called a specific continue routine + * directly, now we store a pointer to the corret continue + * function in the snmp packet structure and call that. We include + * macros for backwards compatibility. + * + */ + +/* [clearcase] +modification history +------------------- +01b,19apr05,job update copyright notices +01a,04aug04,job dropped connection handling +*/ + + +#if (!defined(envoy_agentx_inc)) +#define envoy_agentx_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#include +#include +#include +#include +#include +#include + +/*extern struct ENVOY_AX_PKT_S; +extern struct SNMP_PKT_S;*/ + +typedef void ENVOY_AX_ADMIN_T (ptr_t, ptr_t); +typedef int ENVOY_AX_SEND_T (ptr_t, ptr_t, ptr_t, ALENGTH_T); +typedef void ENVOY_AX_ERROR_T (ptr_t, int); +typedef void ENVOY_AX_ADD_T (ptr_t); + +#define ENVOY_AX_MASTER_PORT 705 + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +/* Define a chunk block for agentx, this is used by the byte_handler + code to save and build a packet when it arrives in chunks rather + than all at once */ +typedef struct ENVOY_AX_CHUNK_S + { + EBUFFER_T chunk; + } ENVOY_AX_CHUNK_T; + +/* Define a state block for the sub agent, primarily this will + be useful if you want to have multiple sub agents in the same + process space */ +typedef struct ENVOY_AX_SA_SB_S + { + struct ENVOY_AX_PKT_S *set_list; /* list of outstanding set requests */ + struct ENVOY_AX_PKT_S *gnb_list; /* list of deferred gnb requests */ + bits32_t readers; /* number of outstanding gnb reqs */ + + ENVOY_TIMER_T ager; /* timer block for aging pkts */ + ENVOY_TIMER_T defer; /* timer block for deferring pkts */ + bits32_t flags; /* currently only if the timer has + been set */ +#if INSTALL_ENVOY_SNMP_LOCK + ENVOY_LOCK_T list_lock; /* lock for manipulating this struct + and the structs on the two lists */ + ENVOY_LOCK_T coarse_lock; /* lock for manipulating the mib db */ +#endif + } ENVOY_AX_SA_SB_T; + +/* Define the agentx structure */ +typedef struct ENVOY_AX_PKT_S + { + bits8_t version; /* The agentx protocol version */ + bits8_t type; /* The agentx pdu type, see below */ + bits8_t flags; /* Agentx flags, also see below */ + bits32_t session_id; /* session id between mast & sub */ + bits32_t transaction_id; /* groups agentx pkts to snmp pkts */ + bits32_t packet_id; /* associates response pkts to reqs */ + + EBUFFER_T context; /* context, optional, see flags */ + + ENVOY_AX_SEND_T *send; /* io completion routine */ + ENVOY_AX_ERROR_T *error; /* error completion routine */ + ptr_t cookie; /* cookie for comp routines */ + + struct SNMP_PKT_S *pktp; /* snmp packet we've turned this agentx + request into for processing */ + ENVOY_AX_SA_SB_T *sasb; /* pointer to the state block for + this sub agent */ + struct ENVOY_AX_PKT_S *next; /* next pointer for lists */ + + bits32_t ts; /* timestamp for aging pkts */ + + bits32_t sysuptime; /* these 3 are only used in */ + bits16_t error_stat; /* responses */ + bits16_t error_index; + + union { /* pdu data, one of the following */ + + bits8_t reason; /* enum for reason for closing */ + + struct { /* used for opens, add caps and */ + bits8_t timeout; /* remove caps */ + bits8_t prefix; + OBJ_ID_T sub_id; + EBUFFER_T descr; + } open_data; + + struct { /* used for (un)registers */ + bits8_t timeout; + bits8_t priority; + bits8_t range; + OBJ_ID_T region; + OIDC_T bound; + } reg_data; + + struct { /* gets, nexts, bulks, test sets, */ + bits16_t non_reps; /* responses, notifies and index */ + bits16_t max_reps; /* (de)allocates */ + VBL_T vbl_str; + bits8_t cur_phase; /* current phase of set processing */ + /* same as vb flags */ + + bits32_t next_pid; /* info for the next phase */ + bits8_t next_phase; /* of set processing, what */ + ENVOY_AX_SEND_T *next_send; /* to do, and any comp info */ + ENVOY_AX_ERROR_T *next_error; + ptr_t *next_cookie; + } proc_data; + } data; + } ENVOY_AX_PKT_T; + +/* AgentX pdu types */ +#define ENVOY_AX_OPEN 1 +#define ENVOY_AX_CLOSE 2 +#define ENVOY_AX_REGISTER 3 +#define ENVOY_AX_UNREGISTER 4 +#define ENVOY_AX_GET 5 +#define ENVOY_AX_NEXT 6 +#define ENVOY_AX_BULK 7 +#define ENVOY_AX_TEST 8 +#define ENVOY_AX_COMMIT 9 +#define ENVOY_AX_UNDO 10 +#define ENVOY_AX_CLEANUP 11 +#define ENVOY_AX_NOTIFY 12 +#define ENVOY_AX_PING 13 +#define ENVOY_AX_INDEX_ALLOCATE 14 +#define ENVOY_AX_INDEX_DEALLOCATE 15 +#define ENVOY_AX_ADD_AC 16 +#define ENVOY_AX_REMOVE_AC 17 +#define ENVOY_AX_RESPONSE 18 + +/* AgentX flag bits */ +#define ENVOY_AX_BIT_INSTANCE 1 +#define ENVOY_AX_BIT_NEW_INDEX 2 +#define ENVOY_AX_BIT_ANY_INDEX 4 +#define ENVOY_AX_BIT_NDC 8 /* non-default context bit, when set + optional context field is used */ +#define ENVOY_AX_BIT_BYTE_ORDER 16 /* when set, network byte order used */ + +/* reasons for closing a connection */ +#define ENVOY_AX_CLOSE_OTHER 1 +#define ENVOY_AX_CLOSE_PARSE 2 +#define ENVOY_AX_CLOSE_PROTO 3 +#define ENVOY_AX_CLOSE_TIMEOUTS 4 +#define ENVOY_AX_CLOSE_SHUTDOWN 5 +#define ENVOY_AX_CLOSE_MANAGER 6 + +/* AgentX codes for the next phase of sets */ +#define ENVOY_AX_NEXT_CLEANUP_START 1 +#define ENVOY_AX_NEXT_UNDO_START 2 + +/* AgentX Protocol error codes */ +#define ENVOY_AX_OPEN_FAILED 256 +#define ENVOY_AX_NOT_OPEN 257 +#define ENVOY_AX_INDEX_WRONG_TYPE 258 +#define ENVOY_AX_INDEX_ALREADY_ALLOCATED 259 +#define ENVOY_AX_INDEX_NONE_AVAILABLE 260 +#define ENVOY_AX_INDEX_NOT_ALLOCATED 261 +#define ENVOY_AX_UNSUPPORTED_CONTEXT 262 +#define ENVOY_AX_DUPLICATE_REGISTRATION 263 +#define ENVOY_AX_UNKNOWN_REGISTRATION 264 +#define ENVOY_AX_UNKNOWN_AGENT_CAPS 265 +#define ENVOY_AX_PROTOCOL_PARSE_ERROR 266 +#define ENVOY_AX_REQUEST_DENIED 267 +#define ENVOY_AX_PROCESSING_ERROR 268 + +#define ENVOY_AX_OTHER 0xffff + +/* AgentX error codes */ +#define ENVOY_AX_ALLOCATION_FAILURE 1 +#define ENVOY_AX_BAD_VALUE 2 +#define ENVOY_AX_TOO_SMALL 3 +#define ENVOY_AX_BAD_SIZE 4 +#define ENVOY_AX_WRONG_VERSION 5 +#define ENVOY_AX_PARSE_ERROR 6 +#define ENVOY_AX_BAD_OPERATION 7 +#define ENVOY_AX_SESS_LOSS 8 +#define ENVOY_AX_TOO_BIG 9 + +/* AgentX packet access macros */ +#define ax_pkt_get_context(PKTP) (&(PKTP)->context) + +/* AgentX version stamps */ +#define ENVOY_AX_VERSION_1 1 +#define ENVOY_AX_VERSION_MAXIMUM 1 + +/* AgentX session admin status codes */ +#define ENVOY_AX_SESSION_UP 1 +#define ENVOY_AX_SESSION_DOWN 2 + +/* globals variables for subagents */ +#ifndef ENVOY_AX_SA_TIMEOUT +#define ENVOY_AX_SA_TIMEOUT 1000 +#endif +extern bits32_t envoy_ax_sa_timeout; + +extern void envoy_ax_sa_init (void); + + +extern void envoy_ax_pkt_init (ENVOY_AX_PKT_T *); +extern ENVOY_AX_PKT_T *envoy_ax_pkt_allocate (void); +extern ALENGTH_T envoy_ax_pkt_size (ENVOY_AX_PKT_T *, VB_T *); +extern void envoy_ax_pkt_clean (ENVOY_AX_PKT_T *); +extern void envoy_ax_pkt_free (ENVOY_AX_PKT_T *); + +extern int envoy_ax_pkt_encode (ENVOY_AX_PKT_T *, VB_T *, + EBUFFER_T *, ALENGTH_T); +extern ENVOY_AX_PKT_T *envoy_ax_pkt_decode (bits8_t *, ALENGTH_T, int *); + + + +extern ENVOY_AX_PKT_T *envoy_ax_pkt_create_all(int *, bits8_t, bits8_t, + bits8_t, bits32_t, bits32_t, + bits8_t, bits32_t, bits8_t *, + int, OBJ_ID_T *, bits8_t, + bits8_t, bits8_t, OIDC_T, + bits32_t, bits8_t *, int, + bits8_t); + +extern int envoy_ax_pkt_create_open (EBUFFER_T *, bits8_t, bits8_t, + bits32_t, bits8_t, bits32_t, + bits8_t *, OBJ_ID_T *); + +extern int envoy_ax_pkt_create_close (EBUFFER_T *, bits8_t, bits8_t, + bits32_t, bits32_t, bits8_t); + +extern int envoy_ax_pkt_create_registrations(EBUFFER_T *, bits8_t, bits8_t, + bits8_t, bits32_t, bits32_t, + bits8_t, bits8_t, bits8_t, + OBJ_ID_T *, OIDC_T, bits32_t, + bits8_t *); + +extern int envoy_ax_pkt_create_ping (EBUFFER_T *, bits8_t, bits8_t, + bits32_t, bits32_t, bits32_t, + bits8_t *); + +extern int envoy_ax_pkt_create_agent_caps(EBUFFER_T *, bits8_t, bits8_t, + bits8_t, bits32_t, bits32_t, + bits32_t, bits8_t *, bits32_t, + bits8_t *, OBJ_ID_T *); + +extern ENVOY_AX_PKT_T *envoy_ax_pkt_create_variables(int *, bits8_t, + bits8_t, bits8_t, + bits32_t, bits32_t, + bits32_t, bits8_t *, + int, int); + +extern int envoy_ax_bind_integer (ENVOY_AX_PKT_T *, int, int, OIDC_T *, + sbits32_t); +extern int envoy_ax_bind_ip_address(ENVOY_AX_PKT_T *, int, int, OIDC_T *, + bits8_t *); +extern int envoy_ax_bind_null (ENVOY_AX_PKT_T *, int, int, OIDC_T *); +extern int envoy_ax_bind_object_id (ENVOY_AX_PKT_T *, int, int, OIDC_T *, + int, OIDC_T *); +extern int envoy_ax_bind_string (ENVOY_AX_PKT_T *, int, int, OIDC_T *, + bits8_t, int, bits8_t *, int); +extern int envoy_ax_bind_uint_64 (ENVOY_AX_PKT_T *, int, int, OIDC_T *, + bits8_t, bits32_t, bits32_t); +extern int envoy_ax_bind_uint (ENVOY_AX_PKT_T *, int, int, OIDC_T *, + bits8_t, bits32_t); + +extern void envoy_ax_sa_handler(bits8_t *, ALENGTH_T, ENVOY_AX_SA_SB_T *, + ENVOY_AX_ADMIN_T *, ENVOY_AX_SEND_T *, + ENVOY_AX_ERROR_T *, ptr_t); + +extern int _snmp_find_next_helper_ax(MIBNODE_T *, int, + OIDC_T*, OBJ_ID_T *, int, VB_T *, + SNMP_PKT_T *, int); + +extern int _snmp_find_next_bound(MIBNODE_T *, VB_T *); + +#if INSTALL_COMMON_DYNAMIC_COMP_CONFIG +extern void ax_dyncfg_init(void); +#endif + +extern ENVOY_AX_SA_SB_T *envoy_ax_sa_state_create(void); +extern void envoy_ax_sa_state_init (ENVOY_AX_SA_SB_T *); +extern int envoy_ax_sa_session_loss(ENVOY_AX_SA_SB_T *, ptr_t, + int, bits32_t); + +typedef struct ENVOY_AX_SESSION_S + { + struct ENVOY_AX_SESSION_S *next;/* next session in the list */ + bits32_t session_id; /* id for this session */ + bits32_t connection_id; /* id for this connection */ + bits8_t version; /* protocol version for this session */ + bits8_t timeout; /* default timeout period */ + bits8_t flags; /* flags, currently byte order */ + + ENVOY_AX_SEND_T *send; /* routine to send to sub agent */ + ENVOY_AX_ERROR_T *error; /* routine to free the cookie */ + ptr_t cookie; /* cookie for use with send rtn */ + + OBJ_ID_T sub_id; /* tag for sub agent */ + EBUFFER_T descr; /* string for sub agent */ + bits32_t timestamp; /* when this session started */ + bits32_t timeout_count; /* number of consecutive timeouts */ + } ENVOY_AX_SESSION_T; + +typedef struct ENVOY_AX_MA_REG_S + { + bits32_t reg_index; /* index for use in agentx mib */ + bits32_t context_id; /* index of context for this object */ + bits8_t priority; /* priority for this object */ + MIBLEAF_T *leaf; /* leaf for use in the mib tree + also contains session, priority + and timeout information */ + struct ENVOY_AX_MA_REG_S *next; + struct ENVOY_AX_MA_REG_S *mib_next; + } ENVOY_AX_MA_REG_T; + +typedef struct ENVOY_AX_MA_REGLIST_S + { + struct ENVOY_AX_MA_REGLIST_S *next; /* next registration in the list */ + bits32_t reg_index; /* index for use in agentx mib */ + bits32_t session_id; /* id for this session */ + bits32_t connection_id; /* id for this connection */ + bits8_t range_id; /* subid which has range, if any */ + OIDC_T bound; /* upper bound of range, if any */ + bits8_t flags; /* non-zero if this is an instance */ + MIBLEAF_T *mibleaf; /* MIB leaf that has more info on this reg. */ + struct ENVOY_AX_MA_REGLIST_S *match; /* For list of registrations w/same OID */ + bits32_t context_id; /* id for this context */ + bits8_t priority; /* priority of this registration */ + OBJ_ID_T start_oid; /* registered subtree, or start if range */ + } ENVOY_AX_MA_REGLIST_T; + +typedef struct ENVOY_AX_CONTEXT_S + { + bits32_t id; /* this context's index in the list */ + struct ENVOY_AX_CONTEXT_S *next; /* ptr to next element in list */ + EBUFFER_T context; /* string for the context */ + MIBNODE_T *mibroot; /* mib root node the user gave us */ + TREENODE_T *indexroot; /* root for possible indexes */ + } ENVOY_AX_CONTEXT_T; + +/* control structure for outstanding agentx requests */ +typedef struct AX_CB_S + { + struct AX_CB_S *next; + bits32_t reqid; + SNMP_PKT_T *pktp; + VB_T *vbp; + int count; + } AX_CB_T; + +/* global variables used by an agentx master to keep state */ +#ifndef ENVOY_AX_DEFAULT_TIMEOUT +#define ENVOY_AX_DEFAULT_TIMEOUT 1 +#endif + +#ifndef SNMP_AX_TIMEOUT_COUNT +#define SNMP_AX_TIMEOUT_COUNT 3 +#endif + +/* General sub-agent response packet pre-processing. */ +#ifndef AX_RESPONSE_PREPROCESS +#define AX_RESPONSE_PREPROCESS(PKT) +#endif + +extern bits32_t agentxDefaultTimeout; + +extern AX_CB_T *first_axcb; +extern bits32_t ax_reqid; + +extern bits32_t ax_registration_id; +extern TREENODE_T *registration_root; + +extern bits32_t agentxRegisterDuplicate; + +extern bits32_t envoy_ax_session_id; +extern ENVOY_AX_SESSION_T *envoy_ax_session_list; +extern ENVOY_AX_MA_REGLIST_T *envoy_ax_registration_list; + +extern bits32_t context_list_id; +extern ENVOY_AX_CONTEXT_T *context_list; + +extern sbits32_t agentxMasterAgentXVer; + +extern void envoy_ax_ma_init (void); + +extern void envoy_ax_ma_handler(bits8_t *, ALENGTH_T, ENVOY_AX_SA_SB_T *, + ENVOY_AX_ADMIN_T *, ENVOY_AX_SEND_T *, + ENVOY_AX_ERROR_T *, ptr_t); + +extern int envoy_ax_ma_cleanup_sessions(ptr_t, bits8_t); + +typedef void ENVOY_AX_HANDLER_T (bits8_t *, ALENGTH_T, ENVOY_AX_SA_SB_T *, + ENVOY_AX_ADMIN_T *, ENVOY_AX_SEND_T *, + ENVOY_AX_ERROR_T *, ptr_t); + +extern void envoy_ax_chunk_init (ENVOY_AX_CHUNK_T *); +extern int envoy_ax_chunk_clean (ENVOY_AX_CHUNK_T *); +extern int envoy_ax_chunk_handler(bits8_t *, ALENGTH_T, ENVOY_AX_HANDLER_T *, + ENVOY_AX_CHUNK_T *, ENVOY_AX_SA_SB_T *, + ENVOY_AX_ADMIN_T *, ENVOY_AX_SEND_T *, + ENVOY_AX_ERROR_T *, ENVOY_AX_ADD_T *, + ptr_t); + +#if (!defined(ENVOY_AX_COOKIE_CMP)) +#define ENVOY_AX_COOKIE_CMP(HAND, COOKIE) (HAND == COOKIE) +#endif + +typedef struct ENVOY_AX_INDEX_STR_S + { + ALENGTH_T length; + bits8_t *buffer; + } ENVOY_AX_INDEX_STR_T; + +typedef struct ENVOY_AX_INDEX_DATA_S + { + struct ENVOY_AX_INDEX_DATA_S *next; + bits32_t session_id; /* 0 for no session */ + union { + OBJ_ID_T objid; + bits32_t bits32; + ENVOY_AX_INDEX_STR_T string; + bits8_t ipaddr[4]; + } data; + } ENVOY_AX_INDEX_DATA_T; + +typedef struct ENVOY_AX_INDEX_HDR_S + { + bits8_t type; + ENVOY_AX_INDEX_DATA_T *data; + } ENVOY_AX_INDEX_HDR_T; + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + +extern ENVOY_AX_SESSION_T *ax_session_find_index(bits32_t, int *); +extern void ax_session_release (ENVOY_AX_SESSION_T *); +extern ENVOY_AX_SESSION_T *ax_session_next (bits32_t, int *); +extern int envoy_ax_ma_cleanup_session_mth(bits32_t, bits8_t); + +extern ENVOY_AX_CONTEXT_T *ax_context_index(bits32_t); +extern ENVOY_AX_CONTEXT_T *ax_context_next (ENVOY_AX_CONTEXT_T *); + +extern ENVOY_AX_MA_REG_T *find_reg_leaf(OBJ_ID_T *, bits8_t, bits32_t); + +extern sbits32_t Find_Leaf_From_Root(MIBNODE_T *, OBJ_ID_T *, MIBLEAF_T **); +extern int AX_Add_Leaf_From_Root(MIBNODE_T *, OBJ_ID_T *, MIBLEAF_T *, + MIBLEAF_T **); +extern MIBLEAF_T * AX_Remove_Leaf_From_Root(MIBNODE_T *, OBJ_ID_T *); + +#define ENVOY_AX_TRANSPORT_TYPE_UNIX 1 +#define ENVOY_AX_TRANSPORT_TYPE_TCP 2 +#define ENVOY_AX_TRANSPORT_TYPE_UDP 3 +#define ENVOY_AX_TRANSPORT_TYPE_MEM 4 +#define ENVOY_AX_TRANSPORT_TYPE_OTHER 5 + +extern void ax_ma_index_allocate (ENVOY_AX_PKT_T *, ENVOY_AX_PKT_T *, + ENVOY_AX_CONTEXT_T *); +extern void ax_ma_index_deallocate(ENVOY_AX_PKT_T *, ENVOY_AX_PKT_T *, + ENVOY_AX_CONTEXT_T *); +extern void ax_ma_cleanup_indexes (bits32_t); + +#if INSTALL_ENVOY_AGENTX_INDEX +#define AX_MA_RTN_IND_ALLOC(AX, RP, CON) ax_ma_index_allocate(AX, RP, CON) +#define AX_MA_RTN_IND_DEALLOC(AX, RP, CON) ax_ma_index_deallocate(AX, RP, CON) +#else +#define AX_MA_RTN_IND_ALLOC(AX, RP, CON) ((RP)->error_stat = GEN_ERR) +#define AX_MA_RTN_IND_DEALLOC(AX, RP, CON) ((RP)->error_stat = GEN_ERR) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* envoy_agentx_inc */ diff --git a/h/wrn/wm/snmp/engine/asn1.h b/h/wrn/wm/snmp/engine/asn1.h new file mode 100644 index 0000000..c779a71 --- /dev/null +++ b/h/wrn/wm/snmp/engine/asn1.h @@ -0,0 +1,257 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/asn1.h,v 1.2 2001/11/06 21:35:00 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1986-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: asn1.h,v $ + * Revision 1.2 2001/11/06 21:35:00 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:22 tneale + * Tornado shuffle + * + * Revision 9.4 2001/01/19 22:22:02 paul + * Update copyright. + * + * Revision 9.3 2000/03/17 19:48:27 meister + * Update copyright notice + * + * Revision 9.2 2000/03/09 20:58:32 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.1 2000/03/09 16:53:49 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.0 1998/10/16 22:10:03 sar + * Update version stamp to match release + * + * Revision 8.1 1998/02/25 04:50:21 sra + * Update copyrights. + * + * Revision 8.0 1997/11/18 00:56:20 sar + * Updated revision to 8.0 + * + * Revision 7.2 1997/03/20 06:47:58 sra + * DFARS-safe copyright text. Zap! + * + * Revision 7.1 1997/02/25 10:49:26 sra + * Update copyright notice, dust under the bed. + * + * Revision 7.0 1996/03/18 20:17:33 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 6.0 1995/05/31 21:46:28 sra + * Release 6.0. + * + * Revision 5.0 1994/05/16 15:49:04 sar + * Updated revision to 5.0 and copyright to include 1994 + * + * Revision 4.0 1993/06/24 16:05:41 sar + * Updated rev to 4.0 and coypright to 93 + * + * Revision 3.4 1993/05/03 17:54:14 sar + * Modified #include to be #include where it was correct. + * + * Revision 3.3 1993/04/28 22:00:38 sar + * Moved the definition of UINT_64_T to ui64.h and update others + * + * Revision 3.2 1993/04/26 20:33:14 sar + * Added bitstrings, and have deletion of parties or contexts delete acls. + * + * Revision 3.1 1993/03/25 21:15:21 sar + * Added types for uint 64 (counter64) and nsapaddress (translates to string) + * + * Revision 3.0 1992/04/03 19:52:27 dab + * Release 3.0 + * + * Revision 2.104 91/10/30 20:53:14 dab + * Include asn1conf.h only if it's not already been included. + * + * Revision 2.103 91/08/15 15:41:45 dab + * Pulled configuration from asn1.h and snmp.h and put in + * snmpconf.h and asn1conf.h. + * + * Revision 2.102 91/08/14 10:55:24 dab + * Removed type declarations to snmpconf.h and includes that file. + * + * Revision 2.101 91/08/12 12:48:00 dab + * Added typedef of PTR_T. + * + * Revision 2.100 91/08/09 14:09:44 dab + * Update version. + * + * Revision 1.1 91/07/30 02:24:19 romkey + * Initial revision + * + * + * Rev 2.0 31 Mar 1990 15:11:26 + * Release 2.00 + * + * Rev 1.1 14 Dec 1989 16:01:16 + * Added support for Borland Turbo C compiler + * + * Rev 1.0 12 Sep 1988 10:46:12 + * Initial revision. +*/ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(asn1_inc)) +#define asn1_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1conf_inc)) +#include +#endif + +/* ASN.1 FLAGS (form and class), adjusted for position within an octet */ +#define A_IDCF_MASK 0xE0 /* Mask for ID CLASS and FORM bits */ +#define A_IDC_MASK 0xC0 /* Mask for ID CLASS bits */ +#define A_IDF_MASK 0x20 /* Mask for ID FORM bit */ +#define A_FLAG_MASK 0xE0 +#define A_UNIVERSAL 0x00 +#define A_APPLICATION 0x40 +#define A_CONTEXT 0x80 +#define A_PRIVATE 0xC0 +#define A_PRIMITIVE 0x00 +#define A_CONSTRUCTOR 0x20 + +#define A_DEFAULT_SCOPE A_CONTEXT + +/* ASN.1 basic types, all in UNIVERSAL scope */ +#define A_NO_ID 0x00 +#define A_BOOLEAN 0x01 +#define A_INTEGER 0x02 +#define A_BITSTRING 0x03 +#define A_OCTETSTRING 0x04 +#define A_NULL 0x05 +#define A_OBJECTID 0x06 +#define A_SEQUENCE 0x10 +#define A_SET 0x11 + +/* ASN.1 defined types, all based on OCTETSTRING */ +#define A_NUMERICSTRING 0x12 +#define A_PRINTABLESTRING 0x13 +#define A_T61STRING 0x14 +#define A_TELETEXSTRING A_T61STRING +#define A_VIDEOTEXSTRING 0x15 +#define A_IA5STRING 0x16 +#define A_GRAPHICSTRING 0x19 +#define A_VISIBLESTRING 0x1A +#define A_GENERALSTRING 0x1B + +/* Other ASN.1 defined universal types */ +#define A_GENERALIZEDTIME 0x18 +#define A_UTCTIME 0x17 +#define A_OBJECTDESCRIPTOR 0x07 + +/**************************************************************************** + +NAME: A_SizeOfLength + +PURPOSE: Compute the number of octets needed to hold an ASN.1 length field. + +PARAMETERS: + ALENGTH_T The proposed length + +RETURNS: ALENGTH_T The number of octets needed + +RESTRICTIONS: + +BUGS: +****************************************************************************/ +#define A_SizeOfLength(S) ((ALENGTH_T)((S) <= 127 ? 1 : ((S) <= 255 ? 2 : 3))) + +/**************************************************************************** + +NAME: A_SizeOfType + +PURPOSE: Compute the number of octets needed to hold an ASN.1 type field + +PARAMETERS: + ATVALUE_T The proposed type (without CLASS & FORM bits) + +RETURNS: unsigned int The number of octets needed + +RESTRICTIONS: + +BUGS: +****************************************************************************/ +#define A_SizeOfType(V) ((unsigned int) ((V) <= 30 ? 1 : \ + ((V) <= 127 ? 2 : ((V) <= 16383 ? 3 : 4)))) + + +/**************************************************************************** +A_SizeOfOctetString -- Return total size that an octet string would + occupy when ASN.1 encoded (tag and length fields + are NOT included) + +Parameters: + ALENGTH_T The size of the string + +Returns: ALENGTH_T Number of octets the octet string would occupy if + in ASN.1 encoding, NOT including the type/length fields + of the outermost wrapper. Since these routines only + generate non-constructor encodings, the length is + exactly that given. +****************************************************************************/ +#define A_SizeOfOctetString(L) ((ALENGTH_T)(L)) + + +/**************************************************************************** +OBJECT IDENTIFIER +****************************************************************************/ + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +/* The following structure is used to internally hold an object identifier */ +/* Each component is limited in range from 0 to 64K-1. */ + +typedef struct OBJ_ID_S + { + int num_components; /* # of object id components */ + /* Note: this is the number of */ + /* components in the object id, */ + /* which is one more than the # */ + /* of subidentifiers in an */ + /* encoded object id. */ + OIDC_T *component_list; + } OBJ_ID_T; + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* asn1_inc */ + diff --git a/h/wrn/wm/snmp/engine/asn1conf.h b/h/wrn/wm/snmp/engine/asn1conf.h new file mode 100644 index 0000000..3a38b18 --- /dev/null +++ b/h/wrn/wm/snmp/engine/asn1conf.h @@ -0,0 +1,403 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/asn1conf.h,v 1.3 2003/01/15 13:58:56 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: asn1conf.h,v $ + * Revision 1.3 2003/01/15 13:58:56 josh + * directory structure shifting + * + * Revision 1.2 2001/11/06 21:50:40 josh + * second (and hopefully final) pass of new path hacking + * + * Revision 1.1.1.1 2001/11/05 17:47:22 tneale + * Tornado shuffle + * + * Revision 9.9.4.3 2001/09/21 19:14:28 josh + * an extra check: can't install coexistence if neither SNMPv1 + * nor SNMPv2 are installed + * + * Revision 9.9.4.2 2001/08/24 14:32:10 josh + * a variety of option checks to make sure we don't have conflicting + * options installed + * + * Revision 9.9.4.1 2001/06/28 18:22:56 josh + * Seeding the Cormorant branch with the code from the old + * cormorant branch + * + * Revision 9.9 2001/04/11 20:58:32 josh + * we are overwriting the trunk's copy of this file with + * the file from the kingfisher branch + * + * Revision 9.8 2001/01/19 22:22:02 paul + * Update copyright. + * + * Revision 9.7 2000/07/10 15:55:13 mrf + * Add configuration for Cygnus NT environment with associated changes. + * + * Revision 9.6 2000/06/09 14:54:12 josh + * modifications due to new installation options, new proxy code + * moved some definitions from sendntfy.h into v3_trgt.h so they'd + * be built with the target code + * + * Revision 9.5.4.1 2001/04/11 20:48:29 josh + * moving cormorant-specific changes off to the cormorant + * branch + * + * Revision 9.5.2.2 2001/03/12 22:07:50 tneale + * Updated copyright + * + * Revision 9.5.2.1 2000/09/21 21:14:52 josh + * bringing branch include files in line with root + * + * Revision 9.5 2000/03/17 19:48:28 meister + * Update copyright notice + * + * Revision 9.4 2000/03/09 20:58:32 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.3 2000/03/09 16:54:09 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.2 1999/06/01 15:46:14 josh + * Moving some installation option checking. + * + * Revision 9.1 1999/04/09 20:36:59 josh + * Obsoleting ENVOY_SNMP_VERSON_USEC and ENVOY_40_VB_FREE_COMPAT + * + * Revision 9.0 1998/10/16 22:10:04 sar + * Update version stamp to match release + * + * Revision 8.8 1998/08/04 02:02:17 sar + * Added some macros for use with longer term storage, if the user + * hasn't defined them they default to the standard ones. + * + * Revision 8.7 1998/06/23 20:28:23 sar + * Added requirement for view2275 if v3 is installed + * + * Revision 8.6 1998/06/09 21:34:56 sar + * Added MEMCMP_NULLOK + * + * Revision 8.5 1998/06/08 19:42:10 sar + * Create a define to tell us if we need the stats group in general + * + * Revision 8.4 1998/05/29 03:53:54 sar + * Add and use defines for v2 types and v2 protocol pieces. This allows + * us to include the types and pieces for other versions, such as v3, + * without having to touch all of the seperate files that use the + * types or pieces. + * + * Revision 8.3 1998/05/23 19:55:38 sar + * As part of adding rfc2275 made a switch to mesh 2275 and 1445. + * + * Revision 8.2 1998/02/25 15:21:23 sra + * Finish moving types.h, bug.h, and bugdef.h to common/h/. + * + * Revision 8.1 1998/02/25 04:50:22 sra + * Update copyrights. + * + * Revision 8.0 1997/11/18 00:56:20 sar + * Updated revision to 8.0 + * + * Revision 7.5 1997/10/30 04:23:16 sar + * Update type information mostly convert bits16_ts to ALENGTH_Ts + * also add MAX_ALENGTH + * + * Revision 7.4 1997/10/22 03:07:28 sar + * Mofied the agentx and older subagent schemes install options + * + * Revision 7.3 1997/08/21 17:23:44 sra + * Begin moving configuration stuff that's common to all products to common.h + * Minor cleanups to common/lib/prng.c. Add pnrg seed function to snarkbsd. + * + * Revision 7.2 1997/03/20 06:47:59 sra + * DFARS-safe copyright text. Zap! + * + * Revision 7.1 1997/02/25 10:49:26 sra + * Update copyright notice, dust under the bed. + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if !defined(asn1conf_inc) +#define asn1conf_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if !defined(EPILOGUE_INSTALL_H) +#include +#endif + +/* Get the standard types and the install defines */ +#if !defined(EPILOGUE_TYPES_H) +#include +#endif + +/* !!! These are here for backwards compatibility only while we're switching + * over to the new configuration system. */ +#if (INSTALL_ENVOY_SNMP_GROUP_V1 || INSTALL_ENVOY_SNMP_GROUP_V2) +#define SGRP 1 +#endif + +/* This is to provide compatibility for windnet users because the + * windnet version of envoy had all struct declarations bracketted + * with an alignment pragma based on this test. We will follow + * suit but put the test in a single place (here). */ +#if INSTALL_ENVOY_ALIGN_STRUCTURES +#define WINDNET_STRUCT_ALIGN +#endif + +/***************************************************************** + * Portable types definitions for backwards compatibility. These + * are now defined in terms of things defined by and + * therefore so any changes should be made in + * . + *****************************************************************/ + /* various sizes of integers */ +typedef sbits32_t INT_32_T; +typedef bits32_t UINT_32_T; +typedef sbits16_t INT_16_T; +typedef bits16_t UINT_16_T; +typedef bits8_t UINT_8_T; +typedef bits8_t OCTET_T ; + /* A generic pointer type. Use void * if your compiler can hack + * it, otherwise char * is probably the right thing. */ +typedef ptr_t PTR_T; + /* SNMP ASN.1 tags and lengths can always fit into 16 bits... */ +typedef bits16_t ATVALUE_T; /* ASN.1 type values */ +typedef bits16_t ALENGTH_T; /* ASN.1 contents field lengths */ + /* this is used as both a maximum and a mask */ +#define MAX_ALENGTH 0xFFFF + +#define OCTETS_PER_INT32 (sizeof(INT_32_T)/sizeof(OCTET_T)) +#define OCTETS_PER_INT16 (sizeof(INT_16_T)/sizeof(OCTET_T)) + + +/* + * get the common system configuration + */ +#include + +/* + * get the system configuration for envoy + */ +#define CONFIG_PREAMBLE 1 +#include +#undef CONFIG_PREAMBLE + + +/* Long lived dynamic storage. If the user doesn't define + them explicitly we use the shorter term ones */ +#ifndef SNMP_memory_alloc_lt +#define SNMP_memory_alloc_lt(need) SNMP_memory_alloc(need) +#endif + +#ifndef SNMP_memory_free_lt +#define SNMP_memory_free_lt(buf) SNMP_memory_free(buf) +#endif + +/***************************************************************** + * Set the size of object identifier components. 32 bits is recommended + * but 16 bits may work and may save a little space. + * This may be overridden in by defining __TYPES_HAVE_OIDC_T_ + *****************************************************************/ +#ifndef __TYPES_HAVE_OIDC_T_ +typedef bits32_t OIDC_T; +#endif + +/* min and max macros if not provided by the system */ +#if (!defined(max)) +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif +#if (!defined(min)) +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif + +/* These are the standard C functions that we use in Envoy. If the + * customer's compiler supplies these correctly then nothing more need be + * done. If not, then can override. The most common case is + * that the system provides them but with the wrong type arguments (char * + * instead of void *). The macros can then fix this with casts. */ +#ifndef MEMCPY +#define MEMCPY(dst, src, n) memcpy(dst, src, n) +#endif +#ifndef MEMSET +#define MEMSET(dst, val, n) memset(dst, val, n) +#endif +#ifndef MEMCMP +#define MEMCMP(s1, s2, n) memcmp(s1, s2, n) +#endif +#ifndef STRLEN +#define STRLEN(s) strlen(s) +#endif + +#ifndef MEMCMP_NULLOK +#define MEMCMP_NULLOK(s1, s2, n) (n ? MEMCMP(s1, s2, n) : 0) +#endif + +/* Error checking, Look for inconsistencies or necessary configuration + that hasn't been done */ + +/* Do we need any of the stats. For v1 & v2 there is a seperate + installation option for the stats groups, for v3 the stats + are required for reports so installing v3 installs the groups */ +#if (INSTALL_ENVOY_SNMP_GROUP_V1 || INSTALL_ENVOY_SNMP_GROUP_V2 || \ + INSTALL_ENVOY_SNMP_VERSION_3) +#define ENVOY_NEED_STATS 1 +#else +#define ENVOY_NEED_STATS 0 +#endif + +/* See if we need either v2 types or protocols, we do this + to avoid needing to add new install option whenever a new + version is defined */ +#if (INSTALL_ENVOY_SNMP_USE_V2_TYPES || INSTALL_ENVOY_SNMP_VERSION_2 || \ + INSTALL_ENVOY_SNMP_VERSION_3) +#define ENVOY_USE_V2_TYPES 1 +#else +#define ENVOY_USE_V2_TYPES 0 +#endif + +#if (INSTALL_ENVOY_SNMP_VERSION_2 || INSTALL_ENVOY_SNMP_VERSION_3) +#define ENVOY_USE_V2_PROTOS 1 +#else +#define ENVOY_USE_V2_PROTOS 0 +#endif + +/* If version 3 is installed we must have 2275 views */ +#if ((INSTALL_ENVOY_SNMP_VERSION_3) && !(INSTALL_ENVOY_SNMP_RFC2275_VIEWS)) +#error If you are installing version 3 you must also install rfc2275 +#error views using _ENVOY_SNMP_RFC2275_VIEWS. +#endif + +/* check that only one of the view schemes is turned on, + if one is turned on turn on the flex view option for use + elsewhere */ +#if (INSTALL_ENVOY_SNMP_RFC1445_VIEWS && INSTALL_ENVOY_SNMP_RFC2275_VIEWS) +#error Must not have both the rfc1445 and rfc2275 view schemes installed. +#error You should modify the configuration file and remove either the +#error ENVOY_SNMP_RFC1445_VIEWS or ENVOY_SNMP_RFC2275_VIEWS option +#endif + +#if (INSTALL_ENVOY_SNMP_RFC1445_VIEWS || INSTALL_ENVOY_SNMP_RFC2275_VIEWS) +#define INSTALL_ENVOY_SNMP_DYNAMIC_VIEWS 1 +#else +#define INSTALL_ENVOY_SNMP_DYNAMIC_VIEWS 0 +#endif + +/* Check that that the lock & serialization options are consistent */ +#if (INSTALL_ENVOY_SNMP_LOCK && INSTALL_ENVOY_SNMP_SERIALIZE) +#error Must not have both the lock code and the serialization code installed. +#error You should modify the configuration file and remove either +#error the ENVOY_SNMP_LOCK or the ENVOY_SNMP_SERIALIZE option +#endif + +#if (INSTALL_ENVOY_CONTINUE_REENTRANT && !INSTALL_ENVOY_SNMP_LOCK) +#error Must have locks installed to use reentrant continues. +#error You should modify the configuration file and install +#error the ENVOY_SNMP_LOCK option. +#endif + +/* check that the options for the agentx scheme are consistent */ +#if ((INSTALL_ENVOY_AGENTX_MASTER || INSTALL_ENVOY_AGENTX_SUB) && \ + !(INSTALL_ENVOY_AGENTX)) +#error You must install ENVOY_AGENTX with ENVOY_AGENTX_MASTER +#error and ENVOY_AGENTX_SUB +#endif + + +#if (INSTALL_ENVOY_AGENTX_MASTER) +#if (INSTALL_ENVOY_MAIN_AGENT && !(INSTALL_ENVOY_SNMP_DYNAMIC_VIEWS)) +#error You must install ENVOY_SNMP_RFC1445_VIEWS or +#error ENVOY_SNMP_RFC2275_VIEWS for use with a master agent +#endif + +#if (!INSTALL_ENVOY_SNMP_LOCK && !INSTALL_ENVOY_SNMP_SERIALIZE) +#error Must have either the locking scheme or the serialization scheme +#error installed. You should modify the configuration file and install +#error either the ENVOY_SNMP_LOCK or ENVOY_SNMP_SERIALIZE option +#endif +#endif + +/* Check that the various SNMPv3 components are consistent */ +#if ((INSTALL_ENVOY_SNMP_V3_TARGET) && !(INSTALL_ENVOY_SNMP_VERSION_3)) +#error The target code (ENVOY_SNMP_V3_TARGET) requires SNMPv3 support. +#error Either uninstall ENVOY_SNMP_V3_TARGET or install ENVOY_SNMP_VERSION_3. +#endif + +#if !(INSTALL_ENVOY_SNMP_VERSION_1 || INSTALL_ENVOY_SNMP_VERSION_2) && \ + INSTALL_ENVOY_SNMP_COEXISTENCE +#error If coexistence is installed, either SNMPv1 or SNMPv2 must also +#error be installed. +#endif + +#if ((INSTALL_ENVOY_SNMP_V3_NOTIFY || INSTALL_ENVOY_SNMP_V3_PROXY || \ + INSTALL_ENVOY_SNMP_COEXISTENCE) && !(INSTALL_ENVOY_SNMP_V3_TARGET)) +#error The use of notifies, proxies, or coexistence requires that +#error ENVOY_SNMP_V3_TARGET be installed. +#endif + +#if ((INSTALL_ENVOY_SNMP_V3_PROXY) && (INSTALL_ENVOY_SNMP_PROXY)) +#error ENVOY_SNMP_V3_PROXY and ENVOY_SNMP_PROXY cannot both be installed. +#endif + +#if ((INSTALL_ENVOY_SNMP_V3_PROXY) || (INSTALL_ENVOY_SNMP_PROXY)) +#define INSTALL_ENVOY_USE_SNMP_PROXY 1 +#else +#define INSTALL_ENVOY_USE_SNMP_PROXY 0 +#endif + +/* If we don't have a main agent we shouldn't be counting stats */ +#if ((INSTALL_ENVOY_SNMP_GROUP_V1 || INSTALL_ENVOY_SNMP_GROUP_V2) && \ + !(INSTALL_ENVOY_MAIN_AGENT)) +#error Must not have the stats groups installed if building only a +#error sub agent. You should modify the configuration file +#error for the makmak program and either uninstall the SNMP_GROUP +#error options, add the MASTER agent option or remove the SUB agent option +#endif + +#if INSTALL_ENVOY_SNMP_VERSION_USEC +#error Envoy no longer supports USEC. Please uninstall +#error ENVOY_SNMP_VERSION_USEC and recompile. +#endif + +#if INSTALL_ENVOY_40_VB_FREE_COMPAT +#error ENVOY_40_VB_FREE_COMPAT is no longer a valid option. +#error Please uninstall it and recompile. +#endif + +#if (INSTALL_SNMP_VXWORKS_VIRTUAL_STACK && \ + INSTALL_SNMP_VXWORKS_VS_ENTITY && \ + !(INSTALL_ENVOY_ENTITY_MIB)) +#error You must install ENVOY_ENTITY_MIB for use with SNMP_VXWORKS_VS_ENTITY +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* asn1conf_inc */ diff --git a/h/wrn/wm/snmp/engine/auxfuncs.h b/h/wrn/wm/snmp/engine/auxfuncs.h new file mode 100644 index 0000000..15ff411 --- /dev/null +++ b/h/wrn/wm/snmp/engine/auxfuncs.h @@ -0,0 +1,297 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/auxfuncs.h,v 1.2 2001/11/06 21:35:01 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1991-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: auxfuncs.h,v $ + * Revision 1.2 2001/11/06 21:35:01 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:22 tneale + * Tornado shuffle + * + * Revision 9.5 2001/01/19 22:22:03 paul + * Update copyright. + * + * Revision 9.4 2000/03/17 19:48:29 meister + * Update copyright notice + * + * Revision 9.3 2000/03/09 20:58:32 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.2 2000/03/09 16:54:24 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.1 1999/05/24 20:12:10 josh + * 'compc' and 'compl' have been replaced by 'tcount' and 'tlist' + * to avoid C++ compiler errors. + * + * Revision 9.0 1998/10/16 22:10:05 sar + * Update version stamp to match release + * + * Revision 8.2 1998/05/23 19:58:52 sar + * Added string to oid (and back) translation routines + * + * Revision 8.1 1998/02/25 04:50:24 sra + * Update copyrights. + * + * Revision 8.0 1997/11/18 00:56:21 sar + * Updated revision to 8.0 + * + * Revision 7.2 1997/03/20 06:48:00 sra + * DFARS-safe copyright text. Zap! + * + * Revision 7.1 1997/02/25 10:49:26 sra + * Update copyright notice, dust under the bed. + * + * Revision 7.0 1996/03/18 20:17:33 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 6.2 1996/01/05 19:09:34 sar + * added group_by_getproc_and_instance + * + * Revision 6.1 1995/10/20 22:53:35 sar + * removed bitstring & uinteger32 options + * + * Revision 6.0 1995/05/31 21:46:31 sra + * Release 6.0. + * + * Revision 5.4 1995/05/06 01:39:54 sar + * moved the defs for method routines in auxi into auxmth.h + * + * Revision 5.3 1995/03/20 23:11:33 sar + * Added declarations of the get__async functions + * Updated scan_vb_forLeaf & scan_for_leaf_and_match to use vb pointers + * instead of indexes. + * + * Revision 5.2 1994/10/03 21:20:27 sar + * Added the defs for SNMP_Create_And_Send_Traps and + * SNMP_Create_Encode_And_Send_Traps. + * + * Revision 5.1 1994/09/29 18:31:12 sar + * Rearrange some items to deal with removing v2 types from v1 settings if + * they aren't installed. + * + * Revision 5.0 1994/05/16 15:49:04 sar + * Updated revision to 5.0 and copyright to include 1994 + * + * Revision 4.3 1994/05/04 22:43:48 sar + * added def for null_set_proc + * + * Revision 4.2 1994/04/15 21:38:04 sar + * added the dynmaic flag to get_ui64. + * + * Revision 4.1 1994/03/08 18:00:01 dab + * Added oidcmp2 + * + * Revision 4.0 1993/06/24 16:05:41 sar + * Updated rev to 4.0 and coypright to 93 + * + * Revision 3.9 1993/06/07 18:31:09 sar + * Added the get and set functions for ui64s and the get function for + * bit strings. + * + * Revision 3.8 1993/05/14 15:13:29 sar + * removed scan_vb_and_reset as it was no longer being used. + * + * Revision 3.7 1993/05/03 17:54:14 sar + * Modified #include to be #include where it was correct. + * + * Revision 3.6 1993/04/27 21:06:48 sar + * Removed index_to_vbp it is now in buildpkt.h + * + * Revision 3.5 1993/04/17 00:58:20 sar + * added the def for vb_extract_row_loose + * + * Revision 3.4 1993/03/05 03:56:25 dab + * fixed up types + * + * Revision 3.3 1993/03/03 16:12:39 dab + * Protect against multiple inclusion and remove __() definition. + * + * Revision 3.2 1993/03/02 19:04:38 sar + * added definition of vb_scan_and_reset. + * + * Revision 3.1 1993/02/26 17:28:25 sar + * added scan_for_leaf_and_match and scan_vb_for_leaf so they can be use + * by outside routines. + * + * Revision 3.0 1992/04/03 19:52:27 dab + * Release 3.0 + * + * Revision 1.13 92/03/31 12:23:54 dab + * Changed flags in the create_row structure again. + * + * Revision 1.12 92/03/31 11:16:56 dab + * Changed flags in create_row structure. + * + * Revision 1.11 92/03/30 18:43:17 dab + * Changed arguments to oid_to_ip(). + * + * Revision 1.10 92/03/26 10:47:08 dab + * removed get_cookie(). + * + * Revision 1.9 92/02/27 16:47:39 dab + * Changed the create_row structure to hold a MIBLEAF_T pointer instead + * of a locator. + * + * Revision 1.7 92/02/04 10:49:00 dab + * Added oidcmp(). + * + * Revision 1.6 91/11/06 14:39:44 dab + * Added vb_extract_row and the create_row structure. + * + * Revision 1.5 91/11/04 15:25:56 dab + * Renamed index parameter in function declarations so it doesn't + * conflict with system routine index(). + * + * Revision 1.4 91/11/04 15:10:31 dab + * Added oidorder(). + * + * Revision 1.3 91/10/31 13:08:41 dab + * Changed args to ip_to_llist so llist is a signed long *. + * Also added llist_cmp. + * + * Revision 1.2 91/10/30 09:43:32 dab + * New functions ip_to_rlist(), ip_to_llist(), and oid_to_ip(). + * + * Revision 1.1 91/10/24 10:59:34 dab + * Initial revision + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#ifndef auxfuncs_inc +#define auxfuncs_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(buildpkt_inc)) +#include +#endif + +#if (!defined(auxmth_inc)) +#include +#endif + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +/* A structure used for looking up all the pieces of a row create of an + * SNMP packet. */ +struct create_row { + MIBLEAF_T *leaf; + OCTET_T flags; +}; + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + +#define ROW_FLAG_NEEDED 0x01 +#define ROW_FLAG_CALL_SET 0x02 + +/* various other housekeeping functions */ +extern int ip_to_llist __((UINT_32_T ip, + INT_32_T *llist)); + +extern int ip_to_rlist __((UINT_32_T ip, + OIDC_T *rlist)); + +extern int llist_cmp __((INT_32_T *list1, + INT_32_T *list2, + int len)); + +extern int oid_to_ip __((int tcount, + OIDC_T *tlist, + UINT_32_T *addr)); + +extern int oidcmp __((int tcount_1, + OIDC_T *tlist_1, + int tcount_2, + OIDC_T *tlist_2)); + +extern int oidcmp2 __((int tcount_1, + OIDC_T *tlist_1, + int tcount_2, + OIDC_T *tlist_2)); + +extern int oidorder __((OIDC_T *idp1, + OIDC_T *idp2, + int n)); + +extern int scan_vb_for_locator __((SNMP_PKT_T * pktp, + int vb_index, + UINT_16_T loc)); + +extern VB_T *vb_extract_row __((SNMP_PKT_T *pkt, + int start_indx, + int tcount, + OIDC_T *tlist, + int row_len, + struct create_row *row)); + +extern VB_T *scan_for_leaf_and_match __((SNMP_PKT_T *pkt, + VB_T *vbp, + MIBLEAF_T *leaf, + int tcount, + OIDC_T *tlist)); + +extern VB_T *scan_vb_for_leaf __((SNMP_PKT_T *pktp, + VB_T *vbp, + MIBLEAF_T *leaf)); + +extern VB_T *vb_extract_row_loose __((SNMP_PKT_T *pktp, + int indx, + MIBLEAF_T **leaves, + int tcount, + OIDC_T *tlist)); + +extern void group_by_getproc_and_instance __((SNMP_PKT_T *pktp, + VB_T *first_vbp, + int tcount, + OIDC_T *tlist)); + +extern int oid_to_string __((int tcount, + OIDC_T *tlist, + ALENGTH_T *blen, + bits8_t *buffp, + int iflag)); + +extern int string_to_oid __((ALENGTH_T blen, + bits8_t *buffp, + int tcount, + OIDC_T *tlist, + int iflag)); + +#ifdef __cplusplus +} +#endif + +#endif /* auxfuncs_inc */ diff --git a/h/wrn/wm/snmp/engine/auxmth.h b/h/wrn/wm/snmp/engine/auxmth.h new file mode 100644 index 0000000..b03165b --- /dev/null +++ b/h/wrn/wm/snmp/engine/auxmth.h @@ -0,0 +1,409 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/auxmth.h,v 1.2 2001/11/06 21:35:01 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1995-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: auxmth.h,v $ + * Revision 1.2 2001/11/06 21:35:01 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:22 tneale + * Tornado shuffle + * + * Revision 9.6 2001/04/11 20:12:00 josh + * merging changes from the kingfisher branch back onto + * the trunk + * + * Revision 9.5 2001/01/19 22:22:03 paul + * Update copyright. + * + * Revision 9.4.2.2 2001/03/12 22:07:51 tneale + * Updated copyright + * + * Revision 9.4.2.1 2000/09/21 21:14:53 josh + * bringing branch include files in line with root + * + * Revision 9.4 2000/03/17 19:48:29 meister + * Update copyright notice + * + * Revision 9.3 2000/03/09 16:54:40 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.2 2000/02/04 21:54:14 josh + * prototyping functions that may need to be called by other modules + * this is done primarily to make the vxWorks compiler happy. + * Warning: the prototypes added may be duplicated by a mib_hand.h + * file generated by Emissary. + * + * Revision 9.1 1999/05/24 20:12:11 josh + * 'compc' and 'compl' have been replaced by 'tcount' and 'tlist' + * to avoid C++ compiler errors. + * + * Revision 9.0 1998/10/16 22:10:05 sar + * Update version stamp to match release + * + * Revision 8.2 1998/05/29 03:53:54 sar + * Add and use defines for v2 types and v2 protocol pieces. This allows + * us to include the types and pieces for other versions, such as v3, + * without having to touch all of the seperate files that use the + * types or pieces. + * + * Revision 8.1 1998/02/25 04:50:25 sra + * Update copyrights. + * + * Revision 8.0 1997/11/18 00:56:21 sar + * Updated revision to 8.0 + * + * Revision 7.2 1997/03/20 06:48:01 sra + * DFARS-safe copyright text. Zap! + * + * Revision 7.1 1997/02/25 10:49:26 sra + * Update copyright notice, dust under the bed. + * + * Revision 7.0 1996/03/18 20:17:33 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 6.3 1996/01/05 19:09:34 sar + * Added null_next and null_test functions for use with the mibcompiler + * + * Revision 6.2 1995/11/11 00:05:52 sar + * added *_TestAndIncr_async functions. + * + * Revision 6.1 1995/10/20 22:53:35 sar + * removed bitstring & uinteger32 options + * + * Revision 6.0 1995/05/31 21:46:32 sra + * Release 6.0. + * + * Revision 1.1 1995/05/06 01:39:54 sar + * Initial revision + * + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +/* Defs for all of the method routines written in auxi */ + +#ifndef auxmth_inc +#define auxmth_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1conf_inc)) +#include +#endif + +#if (!defined(buildpkt_inc)) +#include +#endif + +/* null test functions */ +extern int null_test_proc __((int form, + OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + char *cookie, + SNMP_PKT_T *pktp, + int indx)); + +extern void null_test_async __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); + + +/* generic test function (for non-settable scalars) */ +extern int it_exists __((int form, + OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + char *cookie, + SNMP_PKT_T *pktp, + int vb_index)); + +extern void it_exists_async __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); + +/* Test function for test and increment type variables */ +extern void test_TestAndIncr_async __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); + +#if (ENVOY_USE_V2_TYPES) +/* Test and cleanup functions for UInteger64 */ +extern void ui64_async_test __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); + +extern void ui64_async_cleanup __((PTR_T value)); + +#endif + +/* various get functions */ + +extern INT_32_T null_get_proc __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + char *cookie, + SNMP_PKT_T *pktp)); + +extern void null_get_async __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); + + +extern INT_32_T get_int __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + char *cookie, + SNMP_PKT_T *pktp)); + + +extern unsigned char *get_ip_address __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + char *cookie, + SNMP_PKT_T *pktp, + UINT_32_T *addr)); + +extern OBJ_ID_T *get_object_identifier __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + char *cookie, + SNMP_PKT_T *pktp, + int *dynamic)); + +extern unsigned char *get_string __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + char *cookie, + int *lengthp, + SNMP_PKT_T *pktp, + int *dynamic)); + +extern UINT_32_T get_uint __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + char *cookie, + SNMP_PKT_T *pktp)); + +extern UINT_32_T get_ulong __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + char *cookie, + SNMP_PKT_T *pktp)); + +/* We only include these two functions if v2 types are in use */ +#if (ENVOY_USE_V2_TYPES) +extern UINT_64_T *get_ui64 __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + char *cookie, + SNMP_PKT_T *pktp, + int *dynamic)); +#endif + + +extern void get_int_async __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); + +extern void get_ip_address_async __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); + +extern void get_object_identifier_async __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); + +extern void get_string_async __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); + +extern void get_uint_async __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); + +extern void get_ulong_async __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); + +extern void get_TestAndIncr_async __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); + +/* We only include these two functions if v2 types are in use */ +#if (ENVOY_USE_V2_TYPES) +extern void get_ui64_async __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); +#endif + +/* null next functions */ +extern int null_next_proc __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + OIDC_T *rlist, + char *cookie, + SNMP_PKT_T *pktp)); + +extern void null_next_async __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); + +/* various undo procedures */ +extern void undo_int_async __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); + +extern void undo_uint_async __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); + +extern void undo_TestAndIncr_async __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); + +#if (ENVOY_USE_V2_TYPES) +extern void ui64_async_undo __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); +#endif + +/* various set procedures */ +extern void null_set_proc __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + char *cookie, + INT_32_T value, + SNMP_PKT_T *pktp, + int vb_index)); + +extern void null_set_async __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); + + +extern void set_int __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + char *cookie, + INT_32_T value, + SNMP_PKT_T *pktp, + int vb_index)); + +extern void set_uint __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + char *cookie, + UINT_32_T value, + SNMP_PKT_T *pktp, + int vb_index)); + +/* We only include this function if v2 types are in use */ +#if (ENVOY_USE_V2_TYPES) +extern void set_ui64 __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + char *cookie, + UINT_32_T high, + UINT_32_T low, + SNMP_PKT_T *pktp, + int vb_index)); +#endif + +extern void set_int_async __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); + + +extern void set_uint_async __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); + + +extern void set_TestAndIncr_async __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); + +/* We only include this function if v2 types are in use */ +#if (ENVOY_USE_V2_TYPES) +extern void ui64_async_set __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/wm/snmp/engine/axapi.h b/h/wrn/wm/snmp/engine/axapi.h new file mode 100644 index 0000000..897cabf --- /dev/null +++ b/h/wrn/wm/snmp/engine/axapi.h @@ -0,0 +1,215 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/axapi.h,v 1.5 2002/04/04 15:20:35 andre Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1994-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: axapi.h,v $ + * Revision 1.5 2002/04/04 15:20:35 andre + * Change enums to #defines; add default user-exit + * + * Revision 1.3 2002/03/18 20:20:04 tneale + * Changed type of argument tcount to conform to correct type + * + * Revision 1.2 2002/02/26 18:41:49 josh + * update and nits + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if !defined(_RFC2742API_H_) +#define _RFC2742API_H_ + +/* Macros / symbolic constant definitions */ + +#if !defined(TRUE) +#define TRUE 1 +#endif + +#if !defined(FALSE) +#define FALSE 0 +#endif + +#if !defined(ENVOY_AX_CONN_ENTRY) +/* Define ENVOY_AX_CONN_ENTRY for non-VxWorks builds */ +#define ENVOY_AX_CONN_ENTRY(INDEX, MATCH_TYPE, P_CONNENT) 0 +#endif + +#if !defined(ENVOY_AX_GET_CONNID) +/* Define ENVOY_AX_GET_CONNID for non-VxWorks builds */ +#define ENVOY_AX_GET_CONNID(PCE) 1 +#endif + +#define agentxConnectionEntry_INSTANCE_LEN 1 +#define agentxSessionEntry_INSTANCE_LEN 2 +#define agentxRegistrationEntry_INSTANCE_LEN 3 + +/* Internal data retrieval definitions, typedefs and structures */ + +#define AX_MATCH_GET 1 +#define AX_MATCH_NEXT 2 + +#define AX_GEN_DEFTO 1 +#define AX_GEN_VER 2 +#define AX_CONN_LASTCHG 3 +#define AX_SESS_LASTCHG 4 +#define AX_REG_LASTCHG 5 + +/* GENERAL, CONNECTION, SESSION and REGISTRATION group structures */ + +typedef struct AX_GEN_S +{ + bits32_t agentxDefaultTimeout; + bits32_t agentxMasterAgentXVer; +} AX_GEN_T; + +typedef struct AX_CONNENT_S +{ + bits32_t agentxConnIndex; + bits32_t agentxConnTransportTime; + OBJ_ID_T agentxConnTransportDomain; + EBUFFER_T agentxConnTransportAddress; +} AX_CONNENT_T; + +typedef struct AX_SESSENT_S +{ + bits32_t agentxConnIndex; + bits32_t agentxSessIndex; + OBJ_ID_T agentxSessObjectID; + EBUFFER_T agentxSessDescr; + bits32_t agentxSessAdminStatus; + bits32_t agentxSessOpenTime; + bits32_t agentxSessAgentXVer; + bits32_t agentxSessTimeout; +} AX_SESSENT_T; + +typedef struct AX_REGENT_S +{ + bits32_t agentxConnIndex; + bits32_t agentxSessIndex; + bits32_t agentxRegIndex; + EBUFFER_T agentxRegContext; + OBJ_ID_T agentxRegStart; + bits32_t agentxRegRangeSubId; + bits32_t agentxRegUpperBound; + bits32_t agentxRegPriority; + bits32_t agentxRegTimeout; + bits32_t agentxRegInstance; +} AX_REGENT_T; + +/* API prototypes */ + +boolean_t AxGetScalar (int scalarCode, bits32_t *value); + +AX_CONNENT_T *AxConnGetEntry (int tcount, OIDC_T *tlist); +AX_CONNENT_T *AxConnGetNext (int tcount, OIDC_T *tlist); + +AX_SESSENT_T *AxSessGetEntry (int tcount, OIDC_T *tlist); +AX_SESSENT_T *AxSessGetNext (int tcount, OIDC_T *tlist); + +AX_REGENT_T *AxRegGetEntry (int tcount, OIDC_T *tlist); +AX_REGENT_T *AxRegGetNext (int tcount, OIDC_T *tlist); + +/* axmth.c prototypes: GENERAL group */ + +void agentxGeneral_get (OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp); +void agentxGeneral_next (OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp); + +/* axmth.c prototypes: CONNECTION group */ + +void agentxConnectionEntry_get (OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp); +AX_CONNENT_T *agentxConnectionEntry_first (void); +void agentxConnectionEntry_next (OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp); +bits32_t agentxConnectionEntry_build_instance (AX_CONNENT_T *axConnEntry, OIDC_T *tempInst); +void agentxConnection_get (OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp); +void agentxConnection_next (OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp); +void setAxConnTblLastChg (bits32_t timeStamp); +void agentxFreeConnEntry (ptr_t pConnEntry); + +/* axmth.c prototypes: SESSION group */ + +void agentxSessionEntry_get (OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp); +void agentxSessionEntry_next (OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp); +void agentxSessionEntry_test (OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp); +void agentxSessionEntry_set (OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp); + +void agentxSession_get (OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp); +void agentxSession_next (OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp); + +/* axmth.c prototypes: REGISTRATION group */ + +void agentxRegistrationEntry_get (OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp); +void agentxRegistrationEntry_next (OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp); +void agentxRegistration_get (OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp); +void agentxRegistration_next (OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp); + +/* mibLeaf.h definitions moved here for convenience */ + +#define LEAF_agentxDefaultTimeout 1 +#define MIN_agentxDefaultTimeout 0L +#define MAX__agentxDefaultTimeout 255L +#define LEAF_agentxMasterAgentXVer 2 +#define MIN_agentxMasterAgentXVer 1L +#define MAX__agentxMasterAgentXVer 255L +#define LEAF_agentxConnTableLastChange 1 +#define LEAF_agentxConnIndex 1 +#define MIN_agentxConnIndex 1L +#define MAX__agentxConnIndex 4294967295L +#define LEAF_agentxConnTransportTime 2 +#define LEAF_agentxConnTransportDomain 3 +#define LEAF_agentxConnTransportAddress 4 +#define MINSIZE_agentxConnTransportAddress 0L +#define MAX_SIZE_agentxConnTransportAddress 255L +#define LEAF_agentxSessionTableLastChange 1 +#define LEAF_agentxSessionIndex 1 +#define MIN_agentxSessionIndex 0L +#define MAX__agentxSessionIndex 4294967295L +#define LEAF_agentxSessionObjectID 2 +#define LEAF_agentxSessionDescr 3 +#define MINSIZE_agentxSessionDescr 0L +#define MAX_SIZE_agentxSessionDescr 255L +#define LEAF_agentxSessionAdminStatus 4 +#define VAL_agentxSessionAdminStatus_up 1L +#define VAL_agentxSessionAdminStatus_down 2L +#define LEAF_agentxSessionOpenTime 5 +#define LEAF_agentxSessionAgentXVer 6 +#define MIN_agentxSessionAgentXVer 1L +#define MAX__agentxSessionAgentXVer 255L +#define LEAF_agentxSessionTimeout 7 +#define MIN_agentxSessionTimeout 0L +#define MAX__agentxSessionTimeout 255L +#define LEAF_agentxRegistrationTableLastChange 1 +#define LEAF_agentxRegIndex 1 +#define MIN_agentxRegIndex 1L +#define MAX__agentxRegIndex 4294967295L +#define LEAF_agentxRegContext 2 +#define LEAF_agentxRegStart 3 +#define LEAF_agentxRegRangeSubId 4 +#define LEAF_agentxRegUpperBound 5 +#define LEAF_agentxRegPriority 6 +#define LEAF_agentxRegTimeout 7 +#define MIN_agentxRegTimeout 0L +#define MAX__agentxRegTimeout 255L +#define LEAF_agentxRegInstance 8 +#define VAL_agentxRegInstance_true 1L +#define VAL_agentxRegInstance_false 2L + +#endif /* _RFC2742API_H_ */ diff --git a/h/wrn/wm/snmp/engine/bstring.h b/h/wrn/wm/snmp/engine/bstring.h new file mode 100644 index 0000000..44134e9 --- /dev/null +++ b/h/wrn/wm/snmp/engine/bstring.h @@ -0,0 +1,62 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/bstring.h,v 1.1.1.1 2001/11/05 17:47:22 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + +/**************************************************************************** + * Copyright 1996-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: bstring.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:22 tneale + * Tornado shuffle + * + * Revision 9.2 2001/01/19 22:22:03 paul + * Update copyright. + * + * Revision 9.1 2000/03/17 19:48:31 meister + * Update copyright notice + * + * Revision 9.0 1998/10/16 22:10:07 sar + * Update version stamp to match release + * + * Revision 8.1 1998/02/25 04:50:27 sra + * Update copyrights. + * + * Revision 8.0 1997/11/18 00:56:22 sar + * Updated revision to 8.0 + * + * Revision 7.2 1997/03/20 06:48:02 sra + * DFARS-safe copyright text. Zap! + * + * Revision 7.1 1997/02/25 10:49:26 sra + * Update copyright notice, dust under the bed. + * + * Revision 7.0 1996/03/18 20:17:33 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 1.1 1996/01/22 20:58:52 sar + * Initial revision + * + * + */ + + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + +/* This is a placeholder file for use with older makefiles that require + it for dependency reasons. */ + diff --git a/h/wrn/wm/snmp/engine/buffer.h b/h/wrn/wm/snmp/engine/buffer.h new file mode 100644 index 0000000..ac1fc00 --- /dev/null +++ b/h/wrn/wm/snmp/engine/buffer.h @@ -0,0 +1,338 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/buffer.h,v 1.2 2001/11/06 21:35:01 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1988-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: buffer.h,v $ + * Revision 1.2 2001/11/06 21:35:01 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:22 tneale + * Tornado shuffle + * + * Revision 9.4 2001/01/19 22:22:04 paul + * Update copyright. + * + * Revision 9.3 2000/03/17 19:48:31 meister + * Update copyright notice + * + * Revision 9.2 2000/03/09 20:58:33 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.1 2000/03/09 16:55:08 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.0 1998/10/16 22:10:07 sar + * Update version stamp to match release + * + * Revision 8.3 1998/06/18 04:42:00 sar + * Modified bflags in ebuffer to be unsigned ints and updated + * calling routines accordingly + * + * Revision 8.2 1998/05/23 20:01:13 sar + * Added EBufferAllocateLoad and updated some types + * + * Revision 8.1 1998/02/25 04:50:28 sra + * Update copyrights. + * + * Revision 8.0 1997/11/18 00:56:23 sar + * Updated revision to 8.0 + * + * Revision 7.2 1997/03/20 06:48:05 sra + * DFARS-safe copyright text. Zap! + * + * Revision 7.1 1997/02/25 10:49:26 sra + * Update copyright notice, dust under the bed. + * + * Revision 7.0 1996/03/18 20:17:33 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 6.0 1995/05/31 21:46:34 sra + * Release 6.0. + * + * Revision 5.0 1994/05/16 15:49:04 sar + * Updated revision to 5.0 and copyright to include 1994 + * + * Revision 4.0 1993/06/24 16:05:41 sar + * Updated rev to 4.0 and coypright to 93 + * + * Revision 3.6 1993/05/03 17:54:14 sar + * Modified #include to be #include where it was correct. + * + * Revision 3.5 1993/04/22 20:14:13 sar + * Updating of macros and defines to use new naming scheme and get the + * names to be more useful in general. (use INSTALL_ENVOY_SNMP_VERSION_1 + * for example). + * + * Revision 3.4 1993/03/20 00:21:50 sar + * Replaced EBufferAdd with EBufferAdjust which takes a length and if + * necessary extends the buffer. + * Added EBufferReplace which puts the given string into the buffer + * extending the buffer if necessary. + * + * Revision 3.3 1993/03/05 03:56:25 dab + * fixed up types + * + * Revision 3.2 1993/03/02 19:04:38 sar + * added definition of EBuffer_add which extends the string in a buffer. + * + * Revision 3.1 1993/02/17 20:46:41 sar + * Added EBufferStart - macro: obtain address of first byte in a buffer. + * Added EBufferSeek - definition: move the pointer in a buffer. + * + * Revision 3.0 92/04/03 19:52:27 dab + * Release 3.0 + * + * Revision 2.102 1992/03/31 14:04:08 dab + * Fixed EBufferReset to fixup the remaining field too. + * + * Revision 2.101 92/02/04 11:04:37 dab + * Changed the EBufferReset macro to return void. + * + * Revision 2.100 91/08/09 14:09:44 dab + * Update version. + * + * Revision 1.1 91/07/30 02:24:21 romkey + * Initial revision + * + * + * Revision 2.0 31-Mar-1990 15:11:22 dab + * Release 2.00 + * + * Rev 1.1 19 Sep 1988 17:27:04 + * Made changes to make the Sun C compiler happy. + * + * Rev 1.0 12 Sep 1988 10:46:12 + * Initial revision. +*/ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(buffer_inc)) +#define buffer_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1_inc)) +#include +#endif + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +/* The EBUFFER_T structure is used to control encoding into a buffer */ +typedef struct EBUFFER_S + { + unsigned int bflags; + bits8_t *start_bp; /* Start of the buffer. */ + bits8_t *next_bp; /* Next location in buffer to be filled */ + ALENGTH_T remaining; /* Number of empty spots remaining in buffer*/ + } EBUFFER_T; + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + +/* Values for bflags */ +#define BFL_IS_ALLOC 0x0002 /* Buffer must be obtained */ +#define BFL_IS_DYNAMIC 0x0001 /* Buffer was obtained by malloc */ +#define BFL_IS_STATIC 0x0000 /* Buffer is statically allocated */ + +/**************************************************************************** + +NAME: EBufferInitialize + +PURPOSE: Initialize a buffer to a know, but not usable state + EBufferSetup must be used to make the buffer ready for use. + +PARAMETERS: + EBUFFER_T * Buffer descriptor + +RETURNS: Nothing + +RESTRICTIONS: + +BUGS: +****************************************************************************/ +#define EBufferInitialize(E) (((EBUFFER_T *)(E))->bflags=0, \ + ((EBUFFER_T *)(E))->next_bp=(bits8_t *)0, \ + ((EBUFFER_T *)(E))->start_bp=(bits8_t *)0, \ + ((EBUFFER_T *)(E))->remaining=(ALENGTH_T)0) + +/**************************************************************************** + +NAME: EBufferSetup + +PURPOSE: Setup a buffer to receive ASN.1 encoded data + +PARAMETERS: + unsigned int BFL_xxx flags from buffer.h + EBUFFER_T * Buffer descriptor + bits8_t * Address of the buffer + ALENGTH_T Length of the buffer + +RETURNS: Nothing + +RESTRICTIONS: + +BUGS: +****************************************************************************/ +#define EBufferSetup(F,E,B,L) (((EBUFFER_T *)(E))->bflags=(F), \ + ((EBUFFER_T *)(E))->start_bp=(bits8_t *)(B), \ + ((EBUFFER_T *)(E))->next_bp=(bits8_t *)(B), \ + ((EBUFFER_T *)(E))->remaining=(ALENGTH_T)(L)) + +/**************************************************************************** + +NAME: EBufferPreLoad + +PURPOSE: Pre-load data into a buffer + +PARAMETERS: + unsigned int BFL_xxx flags from buffer.h + EBUFFER_T * Buffer descriptor + bits8_t * Address of the buffer containing the data + ALENGTH_T Length of the data + +RETURNS: Nothing + +RESTRICTIONS: + +BUGS: +****************************************************************************/ +#define EBufferPreLoad(F,E,B,L) ( \ + ((EBUFFER_T *)(E))->bflags=(F), \ + ((EBUFFER_T *)(E))->start_bp=(bits8_t *)(B), \ + ((EBUFFER_T *)(E))->next_bp=((bits8_t *)(B)+(ALENGTH_T)(L)), \ + ((EBUFFER_T *)(E))->remaining=(ALENGTH_T)0) + +/**************************************************************************** + +NAME: EBufferNext + +PURPOSE: Obtain address of next free byte in a buffer + +PARAMETERS: + EBUFFER_T * Buffer descriptor + +RETURNS: bits8_t * Buffer descriptor + +RESTRICTIONS: + +BUGS: +****************************************************************************/ +#define EBufferNext(E) (((EBUFFER_T *)(E))->next_bp) + +/**************************************************************************** + +NAME: EBufferStart + +PURPOSE: Obtain address of first byte in a buffer + +PARAMETERS: + EBUFFER_T * Buffer descriptor + +RETURNS: bits8_t * Buffer descriptor + +RESTRICTIONS: + +BUGS: +****************************************************************************/ +#define EBufferStart(E) (((EBUFFER_T *)(E))->start_bp) + +/**************************************************************************** + +NAME: EBufferUsed + +PURPOSE: Indicate how many octets are currently in the buffer. + +PARAMETERS: + EBUFFER_T * Buffer descriptor + +RETURNS: ALENGTH_T Number of octets used. + +RESTRICTIONS: + +BUGS: +****************************************************************************/ +#define EBufferUsed(E) ((ALENGTH_T)((((EBUFFER_T *)(E))->next_bp) - \ + (((EBUFFER_T *)(E))->start_bp))) + +/**************************************************************************** + +NAME: EBufferRemaining + +PURPOSE: Indicate how many octets are currently unused in the buffer. + +PARAMETERS: + EBUFFER_T * Buffer descriptor + +RETURNS: ALENGTH_T Number of octets unused. + +RESTRICTIONS: + +BUGS: +****************************************************************************/ +#define EBufferRemaining(E) (((EBUFFER_T *)(E))->remaining) + +/**************************************************************************** + +NAME: EBufferReset + +PURPOSE: Reset the buffer to an empty state, just like after EBufferSetup + +PARAMETERS: + EBUFFER_T * Buffer descriptor + +RETURNS: Nothing + +RESTRICTIONS: + +BUGS: +****************************************************************************/ +#define EBufferReset(E) ( \ + (((EBUFFER_T *)(E))->remaining += \ + ((EBUFFER_T *)(E))->next_bp - \ + ((EBUFFER_T *)(E))->start_bp), \ + ((void)(((EBUFFER_T *)(E))->next_bp = \ + ((EBUFFER_T *)(E))->start_bp))) + +extern int EBufferClone __((EBUFFER_T *, EBUFFER_T *)); +extern void EBufferClean __((EBUFFER_T *)); +extern void EBufferAppend __((EBUFFER_T *, EBUFFER_T *)); +extern int EBufferSeek __((EBUFFER_T *, ALENGTH_T, int)); +extern int EBufferAdjust __((EBUFFER_T *, ALENGTH_T)); +extern int EBufferReplace __((EBUFFER_T *, bits8_t *, ALENGTH_T)); +extern int EBufferAllocateLoad __((unsigned int, EBUFFER_T *, + bits8_t *, ALENGTH_T)); + +#ifdef __cplusplus +} +#endif + +#endif /* buffer_inc */ diff --git a/h/wrn/wm/snmp/engine/buildpkt.h b/h/wrn/wm/snmp/engine/buildpkt.h new file mode 100644 index 0000000..27ac2c7 --- /dev/null +++ b/h/wrn/wm/snmp/engine/buildpkt.h @@ -0,0 +1,310 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/buildpkt.h,v 1.2 2001/11/06 21:35:02 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1988-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: buildpkt.h,v $ + * Revision 1.2 2001/11/06 21:35:02 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:22 tneale + * Tornado shuffle + * + * Revision 9.7 2001/01/19 22:22:04 paul + * Update copyright. + * + * Revision 9.6 2000/03/17 19:48:32 meister + * Update copyright notice + * + * Revision 9.5 2000/03/09 16:55:22 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.4 2000/03/09 13:51:30 josh + * a shell function has been created to allow SNMPv3 requests + * to be created while we're holding the coarse lock. + * + * Revision 9.3 1999/09/21 21:30:20 josh + * correcting VBL_Bind_* macros + * + * Revision 9.2 1999/09/14 19:44:11 josh + * prototypes and macros for VBL_Bind_*() functions/macros + * + * Revision 9.1 1999/04/09 20:37:00 josh + * Obsoleting ENVOY_SNMP_VERSON_USEC and ENVOY_40_VB_FREE_COMPAT + * + * Revision 9.0 1998/10/16 22:10:08 sar + * Update version stamp to match release + * + * Revision 8.5 1998/07/20 02:01:23 sar + * Removed dynamic/static tags from v3 packet creation routine + * + * Revision 8.4 1998/06/18 04:42:02 sar + * Modified bflags in ebuffer to be unsigned ints and updated + * calling routines accordingly + * + * Revision 8.3 1998/05/29 03:53:54 sar + * Add and use defines for v2 types and v2 protocol pieces. This allows + * us to include the types and pieces for other versions, such as v3, + * without having to touch all of the seperate files that use the + * types or pieces. + * + * Revision 8.2 1998/05/23 20:04:07 sar + * Added creation function for v3 requests + * + * Revision 8.1 1998/02/25 04:50:30 sra + * Update copyrights. + * + * Revision 8.0 1997/11/18 00:56:23 sar + * Updated revision to 8.0 + * + * Revision 7.4 1997/03/20 06:48:06 sra + * DFARS-safe copyright text. Zap! + * + * Revision 7.3 1997/02/25 10:49:26 sra + * Update copyright notice, dust under the bed. + * + * Revision 7.2 1996/12/04 18:42:08 sar + * Added a definition for SNMP_Bind_OBJECT_ID to make older versions + * of Emissary happy. + * + * Revision 7.1 1996/10/15 14:28:01 sar + * Added create_internal_request + * + * Revision 7.0 1996/03/18 20:17:33 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 6.2 1996/01/10 16:23:25 sar + * USEC updates + * + * Revision 6.1 1995/10/20 22:53:35 sar + * remvoed nsapaddress function + * removed create functions for party system + * remvoed bitstring function + * + * Revision 6.0 1995/05/31 21:46:38 sra + * Release 6.0. + * + * Revision 5.3 1995/03/20 23:11:33 sar + * Moved index_to_vbp to snmpdefs.h and included snmpdefs.h for backward + * compatibility. + * + * Revision 5.2 1994/10/03 21:20:27 sar + * Added the def for SNMP_Create_V2_Half_Trap + * + * Revision 5.1 1994/09/29 18:31:12 sar + * Rearrange some items to deal with removing v2 types from v1 settings if + * they aren't installed. + * + * Revision 5.0 1994/05/16 15:49:04 sar + * Updated revision to 5.0 and copyright to include 1994 + * + * Revision 4.0 1993/06/24 16:05:41 sar + * Updated rev to 4.0 and coypright to 93 + * + * Revision 3.6 1993/05/17 14:04:13 sar + * changed SNMP_Create_Party_Request to be SNMP_Create_V2_Request + * + * Revision 3.5 1993/05/03 17:54:14 sar + * Modified #include to be #include where it was correct. + * + * Revision 3.4 1993/04/27 21:06:48 sar + * Removed index_to_vbp it is now in buildpkt.h + * + * Revision 3.3 1993/04/26 20:33:14 sar + * Added bitstrings, and have deletion of parties or contexts delete acls. + * + * Revision 3.2 1993/03/25 21:15:21 sar + * Added types for uint 64 (counter64) and nsapaddress (translates to string) + * + * Revision 3.1 1993/02/17 20:47:28 sar + * Added SNMP_Create_Party_Request - definition: create a v2 packet. + * + * Revision 3.0 92/04/03 19:52:27 dab + * Release 3.0 + * + * Revision 2.100 91/08/09 14:09:45 dab + * Update version. + * + * Revision 1.1 91/07/30 02:24:22 romkey + * Initial revision + * + * + * Rev 2.0 31 Mar 1990 15:11:20 + * Release 2.00 + * + * Rev 1.4 25 Jan 1989 11:55:50 + * Corrected definitions of macros SNMP_Bind_Counter, SNMP_Bind_Gauge, and + * SNMP_Bind_Timeticks -- each of these had the type mis-defined. + * Also added a new macro -- SNMP_Bind_Opaque. + * + * Rev 1.3 11 Jan 1989 12:10:10 + * Buildpkt.c split into multiple files to prevent linker from picking up + * unused routines. + * + * Rev 1.2 22 Sep 1988 18:38:14 + * Added definitions for SNMP_Bind_Null(). + * + * Rev 1.1 19 Sep 1988 17:27:04 + * Made changes to make the Sun C compiler happy. + * + * Rev 1.0 12 Sep 1988 10:46:14 + * Initial revision. +*/ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(buildpkt_inc)) +#define buildpkt_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1conf_inc)) +#include +#endif + +#if (!defined(asn1_inc)) +#include +#endif + +#if (!defined(snmp_inc)) +#include +#endif + +#if (!defined(snmpdefs_inc)) +#include +#endif + +#define SNMP_Bind_Counter(P,I,C,L,V) SNMP_Bind_Unsigned_Integer(P, I, C, \ + L, VT_COUNTER, V) + +#define SNMP_Bind_Gauge(P,I,C,L,V) SNMP_Bind_Unsigned_Integer(P, I, C, \ + L, VT_GAUGE, V) + +#define SNMP_Bind_Timeticks(P,I,C,L,V) SNMP_Bind_Unsigned_Integer(P, I, C, \ + L, VT_TIMETICKS, V) + +#define SNMP_Bind_Opaque(P,I,C,L,W,S,D) SNMP_Bind_String(P, I, C, L, \ + VT_OPAQUE, W, S, D) + +#define VBL_Bind_Counter(P,I,C,L,V) VBL_Bind_Unsigned_Integer(P, I, C, \ + L, VT_COUNTER, V) + +#define VBL_Bind_Gauge(P,I,C,L,V) VBL_Bind_Unsigned_Integer(P, I, C, \ + L, VT_GAUGE, V) + +#define VBL_Bind_Timeticks(P,I,C,L,V) VBL_Bind_Unsigned_Integer(P, I, C, \ + L, VT_TIMETICKS, V) + +#define VBL_Bind_Opaque(P,I,C,L,W,S,D) VBL_Bind_String(P, I, C, L, \ + VT_OPAQUE, W, S, D) + +/* Defined to clean up an error in some versions of Emissary */ +#define SNMP_Bind_OBJECT_ID SNMP_Bind_Object_ID + + +/* We only install some functions if their types are installed */ +#if (ENVOY_USE_V2_TYPES) +#define SNMP_Bind_Counter64(P,I,C,L,H,LO) SNMP_Bind_64_Unsigned_Integer(P, I,\ + C, L, VT_COUNTER64, H, LO) +#define VBL_Bind_Counter64(P,I,C,L,H,LO) VBL_Bind_64_Unsigned_Integer(P, I,\ + C, L, VT_COUNTER64, H, LO) +#endif + +#if (INSTALL_ENVOY_SNMP_VERSION_3) +extern SNMP_PKT_T * SNMP_Create_Request_V3_Lockable __((int, int, bits32_t, + bits32_t, bits8_t, + bits32_t, bits8_t *, + ALENGTH_T, bits8_t *, + ALENGTH_T, bits8_t *, + ALENGTH_T, bits8_t *, + ALENGTH_T, sbits32_t, + int, int, int, int)); +extern SNMP_PKT_T * SNMP_Create_Request_V3 __((int, int, bits32_t, + bits32_t, bits8_t, bits32_t, + bits8_t *, ALENGTH_T, + bits8_t *, ALENGTH_T, + bits8_t *, ALENGTH_T, + bits8_t *, ALENGTH_T, + sbits32_t, int, int, int)); +#endif + +extern SNMP_PKT_T * SNMP_Create_Request2 __((int, int, int, char *, + INT_32_T, int, int, int)); +#define SNMP_Create_Request(PDU, VER, CLEN, CSTR, RID, VBS) \ + SNMP_Create_Request2(PDU, VER, CLEN, CSTR, RID, VBS, 0, 0) + +extern SNMP_PKT_T *SNMP_Create_Internal_Request __((int, int, int, sbits8_t *, + unsigned short int, + INT_32_T, int, int, int, + ALENGTH_T, IO_COMPLETE_T *, + ERR_COMPLETE_T *, PTR_T)); + +extern SNMP_PKT_T * SNMP_Create_Trap __((int, int, char *, int, + OIDC_T *, OCTET_T *, int, + INT_32_T, UINT_32_T, int)); + +extern int SNMP_Bind_Integer __((SNMP_PKT_T *, int, int, + OIDC_T *, INT_32_T)); +extern int SNMP_Bind_Unsigned_Integer __((SNMP_PKT_T *, int, int, + OIDC_T *, OCTET_T, UINT_32_T)); +extern int SNMP_Bind_IP_Address __((SNMP_PKT_T *, int, int, + OIDC_T *, OCTET_T *)); +extern int SNMP_Bind_Object_ID __((SNMP_PKT_T *, int, int, + OIDC_T *, int, OIDC_T *)); +extern int SNMP_Bind_String __((SNMP_PKT_T *, int, int, + OIDC_T *, OCTET_T, + int, OCTET_T *, int)); +extern int SNMP_Bind_Null __((SNMP_PKT_T *, int, int, OIDC_T *)); + +extern int VBL_Bind_Integer __((VBL_T *, int, int, + OIDC_T *, INT_32_T)); +extern int VBL_Bind_Unsigned_Integer __((VBL_T *, int, int, + OIDC_T *, OCTET_T, UINT_32_T)); +extern int VBL_Bind_IP_Address __((VBL_T *, int, int, + OIDC_T *, OCTET_T *)); +extern int VBL_Bind_Object_ID __((VBL_T *, int, int, + OIDC_T *, int, OIDC_T *)); +extern int VBL_Bind_String __((VBL_T *, int, int, + OIDC_T *, OCTET_T, + int, OCTET_T *, int)); +extern int VBL_Bind_Null __((VBL_T *, int, int, OIDC_T *)); + +/* We only install some functions if their types are installed */ +#if (ENVOY_USE_V2_TYPES) +extern int SNMP_Bind_64_Unsigned_Integer __((SNMP_PKT_T *, int, int, + OIDC_T *, OCTET_T, + UINT_32_T, UINT_32_T)); + +extern int VBL_Bind_64_Unsigned_Integer __((VBL_T *, int, int, + OIDC_T *, OCTET_T, + UINT_32_T, UINT_32_T)); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* buildpkt_inc */ + diff --git a/h/wrn/wm/snmp/engine/decode.h b/h/wrn/wm/snmp/engine/decode.h new file mode 100644 index 0000000..e42932c --- /dev/null +++ b/h/wrn/wm/snmp/engine/decode.h @@ -0,0 +1,230 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/decode.h,v 1.2 2001/11/06 21:35:02 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1986-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: decode.h,v $ + * Revision 1.2 2001/11/06 21:35:02 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:22 tneale + * Tornado shuffle + * + * Revision 9.3 2001/01/19 22:22:04 paul + * Update copyright. + * + * Revision 9.2 2000/03/17 19:48:33 meister + * Update copyright notice + * + * Revision 9.1 2000/03/09 16:55:35 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.0 1998/10/16 22:10:09 sar + * Update version stamp to match release + * + * Revision 8.3 1998/05/29 03:53:55 sar + * Add and use defines for v2 types and v2 protocol pieces. This allows + * us to include the types and pieces for other versions, such as v3, + * without having to touch all of the seperate files that use the + * types or pieces. + * + * Revision 8.2 1998/05/23 20:02:36 sar + * Added A_DecodeOctetWTC + * + * Revision 8.1 1998/02/25 04:50:32 sra + * Update copyrights. + * + * Revision 8.0 1997/11/18 00:56:24 sar + * Updated revision to 8.0 + * + * Revision 7.2 1997/03/20 06:48:08 sra + * DFARS-safe copyright text. Zap! + * + * Revision 7.1 1997/02/25 10:49:26 sra + * Update copyright notice, dust under the bed. + * + * Revision 7.0 1996/03/18 20:17:33 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 6.1 1995/10/20 22:53:35 sar + * removed bitstring & uinteger32 options + * + * Revision 6.0 1995/05/31 21:46:40 sra + * Release 6.0. + * + * Revision 5.1 1994/09/29 18:31:12 sar + * Rearrange some items to deal with removing v2 types from v1 settings if + * they aren't installed. + * + * Revision 5.0 1994/05/16 15:49:04 sar + * Updated revision to 5.0 and copyright to include 1994 + * + * Revision 4.1 1994/05/02 17:03:55 sar + * Added a new decode error (AE_WRONG_TYPE) for use with some new routines + * that do type checking while pulling a value out. + * + * Revision 4.0 1993/06/24 16:05:41 sar + * Updated rev to 4.0 and coypright to 93 + * + * Revision 3.5 1993/06/17 23:30:45 sar + * Modifed decode of bit strings as it was wrong. + * + * Revision 3.4 1993/05/03 17:54:14 sar + * Modified #include to be #include where it was correct. + * + * Revision 3.3 1993/04/28 22:00:38 sar + * Moved the definition of UINT_64_T to ui64.h and update others + * + * Revision 3.2 1993/04/26 20:33:14 sar + * Added bitstrings, and have deletion of parties or contexts delete acls. + * + * Revision 3.1 1993/03/25 21:15:21 sar + * Added types for uint 64 (counter64) and nsapaddress (translates to string) + * + * Revision 3.0 1992/04/03 19:52:27 dab + * Release 3.0 + * + * Revision 2.101 92/02/05 18:49:08 dab + * Fixed up casting in A_DecodeTypeClass for MSC. + * + * Revision 2.100 91/08/09 14:09:45 dab + * Update version. + * + * Revision 1.1 91/07/30 02:24:23 romkey + * Initial revision + * + * + * Rev 2.0 31 Mar 1990 15:11:26 + * Release 2.00 + * + * Rev 1.3 23 Mar 1989 11:55:58 + * Merged the decode helper into the one routine that used it. + * + * Rev 1.2 18 Mar 1989 11:57:26 + * Revised prototypes for A_DecodeOctetStringData and A_DecodeOctetString + * + * Rev 1.1 19 Sep 1988 17:27:04 + * Made changes to make the Sun C compiler happy. + * + * Rev 1.0 12 Sep 1988 10:46:14 + * Initial revision. +*/ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(decode_inc)) +#define decode_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1conf_inc)) +#include +#endif + +#if (!defined(asn1_inc)) +#include +#endif + +#if (!defined(localio_inc)) +#include +#endif + +#if (!defined(buffer_inc)) +#include +#endif + +#if (!defined(ui64_inc)) +#include +#endif + +/**************************************************************************** +NAME: A_DecodeTypeClass + +PURPOSE: Decode the Class and Form bits from an ASN.1 type field. + The data stream is read using the local I/O package. + The stream pointer is NOT advanced, leaving it pointing to the + start of the type field, ready for a subsequent call to + A_DecodeTypeValue. + +CAVEAT: The user should call this return *BEFORE* calling + A_DecodeTypeValue. + +PARAMETERS: LCL_FILE * A stream descriptor (already open) + +RETURNS: OCTET_T The Class and Form bits + +RESTRICTIONS: It is assumed that the stream is not at EOF. +****************************************************************************/ + +#define A_DecodeTypeClass(L) ((OCTET_T) (Lcl_Peekc((LCL_FILE *)(L)) & \ + A_IDCF_MASK)) + +/**************************************************************************** +Decoding errors +****************************************************************************/ +#define AE_PREMATURE_END 1 +#define AE_INDEFINITE_LENGTH 2 +#define AE_WRONG_VALUE 3 +#define AE_WRONG_TYPE 4 +#define AE_WRONG_LENGTH 5 +#define AE_ALLOC_FAILURE 6 + +extern ATVALUE_T A_DecodeTypeValue __((LCL_FILE *, int *)); +extern ALENGTH_T A_DecodeLength __((LCL_FILE *, int *)); +extern void A_DecodeOctetStringData __((LCL_FILE *, ALENGTH_T, + EBUFFER_T *, int *)); +extern void A_DecodeOctetString __((LCL_FILE *, EBUFFER_T *, + int *)); +extern void A_DecodeOctetStringWTC __((LCL_FILE *, EBUFFER_T *, + int *, ATVALUE_T, + OCTET_T)); +extern bits8_t A_DecodeOctetWTC __((LCL_FILE *, int *, + ATVALUE_T, bits8_t)); +extern INT_32_T A_DecodeIntegerData __((LCL_FILE *, ALENGTH_T, + int *)); +extern INT_32_T A_DecodeInteger __((LCL_FILE *, int *)); +extern INT_32_T A_DecodeIntegerWTC __((LCL_FILE *, int *, + ATVALUE_T, OCTET_T)); +extern void A_DecodeObjectIdData __((LCL_FILE *, ALENGTH_T, + OBJ_ID_T *, int *)); +extern void A_DecodeObjectId __((LCL_FILE *, OBJ_ID_T *, + int *)); +extern void A_DecodeObjectIdWTC __((LCL_FILE *, OBJ_ID_T *, + int *, ATVALUE_T, + OCTET_T)); + +/* We only install some functions if their types are installed */ +#if (ENVOY_USE_V2_TYPES) +extern void A_DecodeInteger64Data __((LCL_FILE *, ALENGTH_T, + UINT_64_T *, int *)); +extern void A_DecodeInteger64 __((LCL_FILE *, UINT_64_T *, + int *)); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* decode_inc */ diff --git a/h/wrn/wm/snmp/engine/encode.h b/h/wrn/wm/snmp/engine/encode.h new file mode 100644 index 0000000..5ea3634 --- /dev/null +++ b/h/wrn/wm/snmp/engine/encode.h @@ -0,0 +1,183 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/encode.h,v 1.2 2001/11/06 21:35:02 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1986-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: encode.h,v $ + * Revision 1.2 2001/11/06 21:35:02 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:22 tneale + * Tornado shuffle + * + * Revision 9.3 2001/01/19 22:22:04 paul + * Update copyright. + * + * Revision 9.2 2000/03/17 19:48:33 meister + * Update copyright notice + * + * Revision 9.1 2000/03/09 16:55:43 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.0 1998/10/16 22:10:10 sar + * Update version stamp to match release + * + * Revision 8.2 1998/05/29 03:53:55 sar + * Add and use defines for v2 types and v2 protocol pieces. This allows + * us to include the types and pieces for other versions, such as v3, + * without having to touch all of the seperate files that use the + * types or pieces. + * + * Revision 8.1 1998/02/25 04:50:33 sra + * Update copyrights. + * + * Revision 8.0 1997/11/18 00:56:24 sar + * Updated revision to 8.0 + * + * Revision 7.2 1997/03/20 06:48:09 sra + * DFARS-safe copyright text. Zap! + * + * Revision 7.1 1997/02/25 10:49:26 sra + * Update copyright notice, dust under the bed. + * + * Revision 7.0 1996/03/18 20:17:33 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 6.1 1995/10/20 22:53:35 sar + * removed bitstring & uinteger32 options + * + * Revision 6.0 1995/05/31 21:46:41 sra + * Release 6.0. + * + * Revision 5.1 1994/09/29 18:31:12 sar + * Rearrange some items to deal with removing v2 types from v1 settings if + * they aren't installed. + * + * Revision 5.0 1994/05/16 15:49:04 sar + * Updated revision to 5.0 and copyright to include 1994 + * + * Revision 4.0 1993/06/24 16:05:41 sar + * Updated rev to 4.0 and coypright to 93 + * + * Revision 3.4 1993/05/03 17:54:14 sar + * Modified #include to be #include where it was correct. + * + * Revision 3.3 1993/04/28 22:00:38 sar + * Moved the definition of UINT_64_T to ui64.h and update others + * + * Revision 3.2 1993/04/26 20:33:14 sar + * Added bitstrings, and have deletion of parties or contexts delete acls. + * + * Revision 3.1 1993/03/25 21:15:21 sar + * Added types for uint 64 (counter64) and nsapaddress (translates to string) + * + * Revision 3.0 1992/04/03 19:52:27 dab + * Release 3.0 + * + * Revision 2.101 91/08/12 12:53:01 dab + * Added EHELPER_T so as to declare the arguments to the helper function. + * + * Revision 2.100 91/08/09 14:09:46 dab + * Update version. + * + * Revision 1.1 91/07/30 02:24:24 romkey + * Initial revision + * + * + * Rev 2.0 31 Mar 1990 15:11:24 + * Release 2.00 + * + * Rev 1.1 19 Sep 1988 17:27:06 + * Made changes to make the Sun C compiler happy. + * + * Rev 1.0 12 Sep 1988 10:46:16 + * Initial revision. +*/ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(encode_inc)) +#define encode_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1conf_inc)) +#include +#endif + +#if (!defined(asn1_inc)) +#include +#endif + +#if (!defined(buffer_inc)) +#include +#endif + +#if (!defined(ui64_inc)) +#include +#endif + +typedef ALENGTH_T (EHELPER_T) __((PTR_T, OCTET_T *, ALENGTH_T)); +extern ALENGTH_T A_SizeOfInt __((INT_32_T)); +extern ALENGTH_T A_SizeOfUnsignedInt __((UINT_32_T)); +extern ALENGTH_T A_SizeOfObjectId __((OBJ_ID_T *)); + +/* We only install some functions if their types are installed */ +#if (ENVOY_USE_V2_TYPES) +extern ALENGTH_T A_SizeOfUnsignedInt64 __((UINT_64_T *)); +#endif + +extern void A_EncodeType __((ATVALUE_T, OCTET_T, + EHELPER_T *, OCTET_T *)); +extern void A_EncodeLength __((ALENGTH_T, EHELPER_T *, + OCTET_T *)); +extern void A_EncodeInt __((ATVALUE_T, OCTET_T, + INT_32_T, EHELPER_T *, + OCTET_T *)); +extern void A_EncodeUnsignedInt __((ATVALUE_T, OCTET_T, + UINT_32_T, EHELPER_T *, + OCTET_T *)); +extern void A_EncodeOctetString __((ATVALUE_T, OCTET_T, + OCTET_T *, ALENGTH_T, + EHELPER_T *, OCTET_T *)); +extern void A_EncodeObjectId __((ATVALUE_T, OCTET_T, + OBJ_ID_T *, EHELPER_T *, + OCTET_T *)); + +/* We only install some functions if their types are installed */ +#if (ENVOY_USE_V2_TYPES) +extern void A_EncodeUnsignedInt64 __((ATVALUE_T, OCTET_T, + UINT_64_T *, EHELPER_T *, + OCTET_T *)); +#endif + +extern EHELPER_T A_EncodeHelper; + +#ifdef __cplusplus +} +#endif + +#endif /* encode_inc */ + diff --git a/h/wrn/wm/snmp/engine/entlogic.h b/h/wrn/wm/snmp/engine/entlogic.h new file mode 100644 index 0000000..bb88b14 --- /dev/null +++ b/h/wrn/wm/snmp/engine/entlogic.h @@ -0,0 +1,202 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/entlogic.h,v 1.1 2002/05/23 18:47:30 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: entlogic.h,v $ + * Revision 1.1 2002/05/23 18:47:30 josh + * support for the entLogicalTable from RFC 2737 + * + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(ent_logical_inc)) +#define ent_logical_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1_inc)) +#include +#endif + +#if (!defined(buffer_inc)) +#include +#endif + +#if (!defined(smi_inc)) +#include +#endif + +#define ETC_ENT_LOGICAL_MAX_INDEX 0x7fffffff +#define ETC_ENT_LOGICAL_MAX 255 + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +typedef struct ENT_LOGICAL_S + { + struct ENT_LOGICAL_S *next; + bits32_t entLogicalIndex; + EBUFFER_T entLogicalDescr; + OBJ_ID_T entLogicalType; + EBUFFER_T entLogicalCommunity; + EBUFFER_T entLogicalTAddress; + OBJ_ID_T entLogicalTDomain; + EBUFFER_T entLogicalContextEngineID; + EBUFFER_T entLogicalContextName; + bits16_t flags; + } ENT_LOGICAL_T; + +/* global root pointer for target params list */ +extern ENT_LOGICAL_T *root_ent_logical; + +#define Ent_Logical_Set_Defaults(L) \ + (MEMSET((L), 0, sizeof(ENT_LOGICAL_T)), \ + EBufferInitialize(&((L)->entLogicalDescr)), \ + EBufferInitialize(&((L)->entLogicalCommunity)), \ + EBufferInitialize(&((L)->entLogicalTAddress)), \ + EBufferInitialize(&((L)->entLogicalContextEngineID)), \ + EBufferInitialize(&((L)->entLogicalContextName)), \ + (L)->flags = 0) + +extern ENT_LOGICAL_T * Ent_Logical_Create __((void)); +extern void Ent_Logical_Destroy __((ENT_LOGICAL_T *)); +extern int Ent_Logical_Install __((ENT_LOGICAL_T *, bits32_t)); +extern void Ent_Logical_Deinstall __((ENT_LOGICAL_T *)); +extern ENT_LOGICAL_T * Ent_Logical_Lookup __((bits32_t)); +extern ENT_LOGICAL_T * Ent_Logical_Next __((int, OIDC_T *)); +extern ENT_LOGICAL_T * Ent_Logical_Next_Ent __((ENT_LOGICAL_T *)); + +#define Ent_Logical_Get_Index(L) ((L)->entLogicalIndex) +#define Ent_Logical_Set_Index(L, V) ((L)->entLogicalIndex = (V)) + +#define Ent_Logical_Get_Descr(L) (EBufferStart(&((L)->entLogicalDescr))) +#define Ent_Logical_Get_Descr_Len(L) (EBufferUsed(&((L)->entLogicalDescr))) +#define Ent_Logical_Set_Descr(L, S, N, F) \ + (EBufferAllocateLoad((F), &((L)->entLogicalDescr), (S), (N))) + +#define Ent_Logical_Get_Type(L) (&((L)->entLogicalType)) +#define Ent_Logical_Set_Type(L, D, N) \ + (build_object_id((N), (D), (&((L)->entLogicalType)))) + +#define Ent_Logical_Get_Community(L) \ + (EBufferStart(&((L)->entLogicalCommunity))) +#define Ent_Logical_Get_Community_Len(L) \ + (EBufferUsed(&((L)->entLogicalCommunity))) +#define Ent_Logical_Set_Community(L, S, N, F) \ + (EBufferAllocateLoad((F), &((L)->entLogicalCommunity), (S), (N))) + +#define Ent_Logical_Get_TAddress(L) \ + (EBufferStart(&((L)->entLogicalTAddress))) +#define Ent_Logical_Get_TAddress_Len(L) \ + (EBufferUsed(&((L)->entLogicalTAddress))) +#define Ent_Logical_Set_TAddress(L, S, N, F) \ + (EBufferAllocateLoad((F), &((L)->entLogicalTAddress), (S), (N))) + +#define Ent_Logical_Get_TDomain(L) (&((L)->entLogicalTDomain)) +#define Ent_Logical_Set_TDomain(L, D, N) \ + (build_object_id((N), (D), (&((L)->entLogicalTDomain)))) + +#define Ent_Logical_Get_Context_Engine_ID(L) \ + (EBufferStart(&((L)->entLogicalContextEngineID))) +#define Ent_Logical_Get_Context_Engine_ID_Len(L) \ + (EBufferUsed(&((L)->entLogicalContextEngineID))) +#define Ent_Logical_Set_Context_Engine_ID(L, S, N, F) \ + (EBufferAllocateLoad((F), &((L)->entLogicalContextEngineID), (S), (N))) + +#define Ent_Logical_Get_Context_Name(L) \ + (EBufferStart(&((L)->entLogicalContextName))) +#define Ent_Logical_Get_Context_Name_Len(L) \ + (EBufferUsed(&((L)->entLogicalContextName))) +#define Ent_Logical_Set_Context_Name(L, S, N, F) \ + (EBufferAllocateLoad((F), &((L)->entLogicalContextName), (S), (N))) + +#define Ent_Logical_Get_Flags(L) ((L)->flags) +#define Ent_Logical_Set_Flags(L, V) ((L)->flags = (bits16_t)(V)) + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +typedef struct ENT_GENERAL_S + { + bits32_t entLastChangeTime; + } ENT_GENERAL_T; + + +/* Global pointer for the entityGeneral group */ +extern ENT_GENERAL_T root_ent_general; + +#define Ent_General_Set_Defaults(G) \ + (MEMSET((G), 0, sizeof(ENT_GENERAL_T))) + +#define Ent_General_Group_Lookup() (&root_ent_general) + +#define Ent_General_Get_Last_Change_Time(G) ((G)->entLastChangeTime) +#define Ent_General_Set_Last_Change_Time(G, V) \ + ((G)->entLastChangeTime = (bits32_t) V) + +/* Constants for entLogicalTable */ +#define LEAF_entLogicalIndex 1 +#define MIN_entLogicalIndex 1L +#define MAX_entLogicalIndex 2147483647L +#define LEAF_entLogicalDescr 2 +#define MINSIZE_entLogicalDescr 0L +#define MAXSIZE_entLogicalDescr 255L +#define LEAF_entLogicalType 3 +#define LEAF_entLogicalCommunity 4 +#define MINSIZE_entLogicalCommunity 0L +#define MAXSIZE_entLogicalCommunity 255L +#define LEAF_entLogicalTAddress 5 +#define MINSIZE_entLogicalTAddress 1L +#define MAXSIZE_entLogicalTAddress 255L +#define LEAF_entLogicalTDomain 6 +#define LEAF_entLogicalContextEngineID 7 +#define MINSIZE_entLogicalContextEngineID 0L +#define MAXSIZE_entLogicalContextEngineID 32L +#define LEAF_entLogicalContextName 8 +#define MINSIZE_entLogicalContextName 0L +#define MAXSIZE_entLogicalContextName 255L + +/* Constants for entGeneral group */ +#define LEAF_entLastChangeTime 1 + +extern void entLogicalEntry_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void entLogicalEntry_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void entityGeneral_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void entityGeneral_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +#ifdef __cplusplus +} +#endif + +#endif /* #if (!defined(ent_logical_inc))*/ diff --git a/h/wrn/wm/snmp/engine/etimer.h b/h/wrn/wm/snmp/engine/etimer.h new file mode 100644 index 0000000..1da120e --- /dev/null +++ b/h/wrn/wm/snmp/engine/etimer.h @@ -0,0 +1,147 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/etimer.h,v 1.2 2001/11/06 21:35:02 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1995-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: etimer.h,v $ + * Revision 1.2 2001/11/06 21:35:02 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:22 tneale + * Tornado shuffle + * + * Revision 9.5 2001/01/19 22:22:04 paul + * Update copyright. + * + * Revision 9.4 2000/03/17 19:48:34 meister + * Update copyright notice + * + * Revision 9.3 2000/03/09 20:58:33 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.2 2000/03/09 16:55:57 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.1 2000/02/29 20:40:48 josh + * #ifdefs so we don't have semicolons sitting on lines alone in include + * files (the ARM compiler hates that). + * + * Revision 9.0 1998/10/16 22:10:10 sar + * Update version stamp to match release + * + * Revision 8.3 1998/08/12 04:52:15 sar + * revamp the initialization routines to limit the amount of + * code that might get pulled in. + * + * Revision 8.2 1998/06/28 21:48:54 sar + * Added ENVOY_TIMER_32_T for functions that want 32 bit cookies + * and need to allocate space on the fly. + * + * Revision 8.1 1998/02/25 04:50:34 sra + * Update copyrights. + * + * Revision 8.0 1997/11/18 00:56:25 sar + * Updated revision to 8.0 + * + * Revision 7.2 1997/03/20 06:48:10 sra + * DFARS-safe copyright text. Zap! + * + * Revision 7.1 1997/02/25 10:49:26 sra + * Update copyright notice, dust under the bed. + * + * Revision 7.0 1996/03/18 20:17:33 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 6.0 1995/05/31 21:46:42 sra + * Release 6.0. + * + * Revision 1.1 1995/03/20 23:07:47 sar + * Initial revision + * + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(etimer_inc)) +#define etimer_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined snmp_inc) +#include +#endif + +/* timer structure. Timer memory allocation is expected to be managed by + * code which calls into the timer system. + * + * Software using timers must call tm_init() on any timer before calling + * any other tm_ functions on it. + */ + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +typedef struct ENVOY_TIMER_S { + struct ENVOY_TIMER_S *link; /* list link */ + bits32_t expire; /* relative expiration time in ms */ + void (*handler) __((struct ENVOY_TIMER_S *, void *)); + /* expiration handler */ + void *cookie; /* handler cookie */ + } ENVOY_TIMER_T; + +/* structure that contains a 32 bit id so the memory can be allocated + as a block, done here so that multiple routines can use it */ +typedef struct ENVOY_TIMER_32_S { + struct ENVOY_TIMER_S timer; + bits32_t id; + } ENVOY_TIMER_32_T; + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + +/* timer calls + */ + +void envoy_tm_init __((ENVOY_TIMER_T *)); /* init timer */ +int envoy_tm_set __((ENVOY_TIMER_T *, bits32_t));/* set timer */ +int envoy_tm_cancel __((ENVOY_TIMER_T *)); /* cancel timer */ + +/* global root pointer and init routine */ +#if INSTALL_ENVOY_SNMP_LOCK +ENVOY_SNMP_LOCK_EXTERN(SNMP_TimerLock); +#endif +extern ENVOY_TIMER_T *envoy_timer_list; +void envoy_timer_init __((void)); + +#ifdef __cplusplus +} +#endif + +#endif /* etimer_inc */ diff --git a/h/wrn/wm/snmp/engine/localio.h b/h/wrn/wm/snmp/engine/localio.h new file mode 100644 index 0000000..d2f5c78 --- /dev/null +++ b/h/wrn/wm/snmp/engine/localio.h @@ -0,0 +1,196 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/localio.h,v 1.3 2003/01/15 13:58:56 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/***************************************************************************** + * Copyright 1986-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: localio.h,v $ + * Revision 1.3 2003/01/15 13:58:56 josh + * directory structure shifting + * + * Revision 1.2 2001/11/06 21:50:40 josh + * second (and hopefully final) pass of new path hacking + * + * Revision 1.1.1.1 2001/11/05 17:47:22 tneale + * Tornado shuffle + * + * Revision 9.4 2001/01/19 22:22:05 paul + * Update copyright. + * + * Revision 9.3 2000/03/17 19:48:34 meister + * Update copyright notice + * + * Revision 9.2 2000/03/09 20:58:33 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.1 2000/03/09 16:56:08 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.0 1998/10/16 22:10:14 sar + * Update version stamp to match release + * + * Revision 8.3 1998/06/22 03:11:10 sar + * Changed the type used for lengths in localio. We now use ALENGTH_Ts + * to make it match the rest of the code and keep compilers happy + * + * Revision 8.2 1998/02/25 15:21:23 sra + * Finish moving types.h, bug.h, and bugdef.h to common/h/. + * + * Revision 8.1 1998/02/25 04:50:36 sra + * Update copyrights. + * + * Revision 8.0 1997/11/18 00:56:25 sar + * Updated revision to 8.0 + * + * Revision 7.3 1997/03/20 06:48:11 sra + * DFARS-safe copyright text. Zap! + * + * Revision 7.2 1997/02/25 10:49:26 sra + * Update copyright notice, dust under the bed. + * + * Revision 7.1 1997/01/16 20:46:35 sar + * changed uchar to bits8_t + * + * Revision 7.0 1996/03/18 20:17:33 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 6.1 1996/01/10 16:23:25 sar + * Removed some no_pp stuff + * Added the start of buffer macro + * + * Revision 6.0 1995/05/31 21:46:43 sra + * Release 6.0. + * + * Revision 5.0 1994/05/16 15:49:04 sar + * Updated revision to 5.0 and copyright to include 1994 + * + * Revision 4.0 1993/06/24 16:05:41 sar + * Updated rev to 4.0 and coypright to 93 + * + * Revision 3.3 1993/05/19 20:07:52 sar + * tiding up types to make compilers happy, (timestamps to UINT_32_T, + * sizes to ALENGTH_T). + * + * Revision 3.2 1993/02/17 20:48:03 sar + * Added Lcl_Next - macro: get current position in buffer. + * Added Lcl_Dup - defin: duplicate a lcl_file. + * Changed Lcl_Size - macro: corrected lbuf->next to lbuf_next. + * + * Revision 3.1 92/07/31 11:54:43 dab + * Added Lcl_Size(). + * + * Revision 3.0 92/04/03 19:52:27 dab + * Release 3.0 + * + * Revision 2.101 92/02/05 18:49:59 dab + * In lcl_* macros don't cast L as (LCL_FILE *) because it already + * should be. + * Made sure all returns of Lcl_Getc() were the same type. + * + * Revision 2.100 91/08/09 14:09:46 dab + * Update version. + * + * Revision 1.1 91/07/30 02:24:26 romkey + * Initial revision + * + * + * Rev 2.0 31 Mar 1990 15:11:26 + * Release 2.00 + * + * Rev 1.2 19 Sep 1988 17:48:36 + * Added header and version identification lines. No code changes. +*/ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(localio_inc)) +#define localio_inc + +#ifdef __cplusplus +extern"C" { +#endif + +/* Get the standard types */ +#if !defined(EPILOGUE_TYPES_H) +#include +#endif + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +typedef struct LCL_FILE_S + { + bits8_t lcl_flags; + bits8_t *lbuf_start; + bits8_t *lbuf_next; + bits8_t *lbuf_end; /* Address AFTER last byte */ + } LCL_FILE; + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + +#define LCL_MALLOC 0x01 /* LCL_FILE was malloc-ed at open */ +#define LCL_EOF 0x80 /* EOF encountered */ + +/* Start of buffer */ +#define Lcl_Start(L) (L)->lbuf_start + +#define Lcl_Eof(L) (((L)->lcl_flags&LCL_EOF)?-1:0) + +/* Current position in stream. */ +#define Lcl_Tell(L) (ALENGTH_T)((L)->lbuf_next - (L)->lbuf_start) + +/* Address of current positon in buffer */ +#define Lcl_Next(L) (L)->lbuf_next + +/* Amount of data left in stream. */ +#define Lcl_Size(L) (ALENGTH_T)((L)->lbuf_end - (L)->lbuf_next) + +#define GETC_MACRO +#if defined(GETC_MACRO) +/* The following is an macro version of this routine Lcl_Getc */ +#define Lcl_Getc(L) ( (((L)->lcl_flags & LCL_EOF) ? -1 : \ + (((L)->lbuf_next < (L)->lbuf_end) ? \ + (int)(*((L)->lbuf_next++)) : \ + (((L)->lcl_flags |= LCL_EOF), -1)))) +#endif /* GETC_MACRO */ + +extern LCL_FILE *Lcl_Open (LCL_FILE *, bits8_t *, ALENGTH_T); +extern void Lcl_Close (LCL_FILE *); +#if !defined(GETC_MACRO) +extern int Lcl_Getc (LCL_FILE *); +#endif /* GETC_MACRO */ +extern int Lcl_Peekc (LCL_FILE *); +extern ALENGTH_T Lcl_Read (LCL_FILE *, bits8_t *, ALENGTH_T); +extern int Lcl_Seek (LCL_FILE *, ALENGTH_T, int); +extern ALENGTH_T Lcl_Resize (LCL_FILE *, ALENGTH_T, int); +extern LCL_FILE *Lcl_Dup (LCL_FILE *, LCL_FILE *); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/h/wrn/wm/snmp/engine/mib.h b/h/wrn/wm/snmp/engine/mib.h new file mode 100644 index 0000000..692eab7 --- /dev/null +++ b/h/wrn/wm/snmp/engine/mib.h @@ -0,0 +1,567 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/mib.h,v 1.2 2001/11/06 21:35:02 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1988-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: mib.h,v $ + * Revision 1.2 2001/11/06 21:35:02 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:22 tneale + * Tornado shuffle + * + * Revision 9.9.4.1 2001/08/24 14:11:25 josh + * make sure that standard declaration of NODE_NT zeroes all fields + * + * Revision 9.9 2001/04/11 20:12:00 josh + * merging changes from the kingfisher branch back onto + * the trunk + * + * Revision 9.8 2001/01/19 22:22:05 paul + * Update copyright. + * + * Revision 9.7.2.2 2001/03/12 22:07:54 tneale + * Updated copyright + * + * Revision 9.7.2.1 2000/10/13 21:17:33 josh + * function prototypes and static declarations to eliminate warnings + * from the Tornado compiler + * + * Revision 9.7 2000/03/17 19:48:35 meister + * Update copyright notice + * + * Revision 9.6 2000/03/09 20:58:33 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.5 2000/03/09 16:56:42 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.4 1999/12/23 14:47:26 josh + * cleaning up code per Shawn's comments -- removing extraneous + * comments and doing proxy check before notify check + * + * Revision 9.3 1999/11/12 23:20:28 josh + * fixing synchronous function prototypes + * + * Revision 9.2 1999/10/26 20:07:33 josh + * fix indeterminate function prototyping with forward declarations + * + * Revision 9.1 1999/05/24 20:12:11 josh + * 'compc' and 'compl' have been replaced by 'tcount' and 'tlist' + * to avoid C++ compiler errors. + * + * Revision 9.0 1998/10/16 22:10:15 sar + * Update version stamp to match release + * + * Revision 8.1 1998/02/25 04:50:40 sra + * Update copyrights. + * + * Revision 8.0 1997/11/18 00:56:26 sar + * Updated revision to 8.0 + * + * Revision 7.6 1997/10/29 01:33:28 sar + * Only define the two character macros ("NO", "RW" etc) if the user + * asks for them via an installation option. + * + * Revision 7.5 1997/10/22 03:07:29 sar + * Mofied the agentx and older subagent schemes install options + * + * Revision 7.4 1997/10/16 00:25:17 sar + * Primarily this set of modifications is for the agentx protocol. + * Most of the work was in the agentx.h and ax_mth.h files. Most + * other files (snmpdefs.h, vbdefs.h and mib.h) received updates + * to their structures and snmp got some new lock macros. + * + * One other change of note was the modification of continue + * processing. Previously we called a specific continue routine + * directly, now we store a pointer to the corret continue + * function in the snmp packet structure and call that. We include + * macros for backwards compatibility. + * + * Revision 7.3 1997/09/16 19:19:23 sar + * Added the NT macros for leaves and nodes, these add a flag + * word to allow the mib compiler to set some flags in the mib + * tree structure. Emissary 7.0 can make use of these macros. + * + * Revision 7.2 1997/03/20 06:48:13 sra + * DFARS-safe copyright text. Zap! + * + * Revision 7.1 1997/02/25 10:49:26 sra + * Update copyright notice, dust under the bed. + * + * Revision 7.0 1996/03/18 20:17:33 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 6.0 1995/05/31 21:46:58 sra + * Release 6.0. + * + * Revision 5.4 1995/05/03 21:01:22 sar + * Added CREATE_ACCESS & NOTIFY_ACCESS + * + * Revision 5.3 1995/03/24 17:35:34 sar + * Added scalar/tabular arg to the leaf_asy and leaf_com macros, currently + * we just throw it away. + * + * Revision 5.2 1995/03/20 23:11:33 sar + * Added the ASY_*PROC_T method routines + * Updated the MIBLEAF_T structure to use the async method routine typedefs + * Added a compatibility structure for backwards compatibility + * Added a new series of macros to populate the mibleaf and compat structure. + * + * Revision 5.1 1994/08/04 22:05:29 sar + * Added multiple mib tree capability, including macros to translate the + * old apis into the new api's + * + * Revision 5.0 1994/05/16 15:49:04 sar + * Updated revision to 5.0 and copyright to include 1994 + * + * Revision 4.3 1994/04/29 20:06:04 sar + * Added LEAF_INACTIVE flag and modified calling sequence for Find_Node. + * + * Revision 4.2 1994/02/01 23:37:07 sar + * Added flags for use with the Find, Add and Remove_Node routines. + * + * Revision 4.1 1993/09/30 19:32:16 sar + * Added a definition for TEST_CREATE in the list of defines for + * the form parameter to the testproc routine. TEST_CREATE specified + * that this call is to check if the given object can be created. + * + * Revision 4.0 1993/06/24 16:05:41 sar + * Updated rev to 4.0 and coypright to 93 + * + * Revision 3.2 1993/05/03 17:54:14 sar + * Modified #include to be #include where it was correct. + * + * Revision 3.1 1993/03/02 18:16:06 dab + * Removed __() macro since this is defined in + * + * Revision 3.0 1992/04/03 19:52:27 dab + * Release 3.0 + * + * Revision 2.103 92/01/30 14:00:17 dab + * Added function parameter prototypes for the test, get, set, and next + * functions. Also added casts inthe LEAF and LEAFM macros to cast the + * routines to those prototypes. + * + * Revision 2.102 91/12/05 15:02:59 dab + * LEAF macro initializes mib view masks to 0xFFFFFFFF instead of just 0xFF. + * + * Revision 2.101 91/11/07 09:37:23 dab + * Made the view and write masks be 32 bits. + * + * Revision 2.100 91/08/09 14:09:47 dab + * Update version. + * + * Revision 1.1 91/07/30 02:24:28 romkey + * Initial revision + * + * + * Rev 2.0 31 Mar 1990 15:11:24 + * Release 2.00 + * + * Rev 1.8 24 Sep 1989 22:06:34 + * Renamed mib_root to mib_root_node to support the MIB compiler. + * + * Rev 1.7 11 Jan 1989 11:59:48 + * Updated copyright dates. + * + * Rev 1.6 11 Jan 1989 11:09:20 + * Added definitions of find_object_node() and find_next_object() for non- + * ANSI compilers. + * + * Rev 1.5 10 Oct 1988 21:47:00 + * Reorganized source modules + * + * Rev 1.4 21 Sep 1988 16:34:00 + * Revised spelling to conform to the usage "MGMT" in the MIB. + * + * Rev 1.3 20 Sep 1988 15:50:10 + * Revised END_OF_ARC macro to avoid an improper type cast. + * + * Rev 1.2 19 Sep 1988 19:56:06 + * Revised MIBARC structure and ARC macro to avoid casting structure + * pointers to a (char *) which, on machines like the Cray, could + * destroy the meaning of the pointer. + * + * Rev 1.1 19 Sep 1988 17:27:06 + * Made changes to make the Sun C compiler happy. + * + * Rev 1.0 12 Sep 1988 10:46:18 + * Initial revision. +*/ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(mib_inc)) +#define mib_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1_inc)) +#include +#endif + +/* Definitions for "form" parameter to the "testproc" found in leaf nodes */ +#define TEST_GET 0 +#define TEST_SET 1 +#define TEST_CREATE 2 + +/* Definitions for node_type in MIBNODE_T and MIBLEAF_T */ +#define NODE_TYPE 0x01 +#define INNER_NODE 0x00 +#define LEAF_NODE 0x01 +#define REMOVABLE 0x02 +#define REPLACEABLE 0x04 +#define SYSTEM_OWNED 0x08 +#define NODE_DYNAMIC 0x10 +#define LEAF_DYNAMIC 0x10 +#define ARC_DYNAMIC 0x20 +#define COOKIE_DYNAMIC 0x20 +#define LEAF_INACTIVE 0x40 +#define AGENTX_LEAF 0x80 + +struct SNMP_PKT_S; +struct VB_S; +typedef void ASY_TESTPROC_T __((OIDC_T lastmatch, int tcount, OIDC_T *tlist, + struct SNMP_PKT_S *pktp, struct VB_S *vbp)); +typedef void ASY_GETPROC_T __((OIDC_T lastmatch, int tcount, OIDC_T *tlist, + struct SNMP_PKT_S *pktp, struct VB_S *vbp)); +typedef void ASY_SETPROC_T __((OIDC_T lastmatch, int tcount, OIDC_T *tlist, + struct SNMP_PKT_S *pktp, struct VB_S *vbp)); +typedef void ASY_NEXTPROC_T __((OIDC_T lastmatch, int tcount, OIDC_T *tlist, + struct SNMP_PKT_S *pktp, struct VB_S *vbp)); + +typedef int TESTPROC_T __((int form, OIDC_T lastmatch, int tcount, + OIDC_T *tlist, char *cookie, + struct SNMP_PKT_S *pktp, int indx)); +typedef INT_32_T GETPROC_T __((OIDC_T lastmatch, int tcount, OIDC_T *tlist, + char *cookie, + struct SNMP_PKT_S *pktp)); +typedef void SETPROC_T __((OIDC_T lastmatch, int tcount, OIDC_T *tlist, + char *cookie, INT_32_T value, + struct SNMP_PKT_S *pktp, int vb_index)); +typedef int NEXTPROC_T __((OIDC_T lastmatch, int tcount, OIDC_T *tlist, + OIDC_T *rlist, char *cookie, + struct SNMP_PKT_S *pktp)); + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +/* Define a MIB leaf node */ +typedef struct MIBLEAF_S + { + unsigned short node_type; /* See above */ + OCTET_T expected_tag; /* VT_xxx from snmp.h */ + OCTET_T access_type; /* See below */ + + ASY_TESTPROC_T *testproc; /* Routine to check whether the */ + /* indicated data object exists */ + ASY_GETPROC_T *getproc; /* Routine to get the data */ + ASY_SETPROC_T *setproc; /* Routine to set the data */ + ASY_NEXTPROC_T *nextproc; /* Routine to locate "next" obj id */ + char * user_cookie; /* Value to pass to unchanged */ + UINT_16_T locator; /* The user can define any value for*/ + /* this field. It is useful to */ + /* give easy to handle names to */ + /* leaves. */ + UINT_32_T view_mask; /* A mask of the views of which this*/ + /* leaf is a part. */ + UINT_32_T write_mask; /* That subset of view_mask in which*/ + /* is potentially writable. */ +#if INSTALL_ENVOY_AGENTX_MASTER + bits32_t session_id; /* session for this object */ + bits16_t ref_count; /* reference count */ + bits8_t timeout; /* timeout period */ +#endif + +#if defined(DEBUG) + char * object_name; /* FOR DEBUGGING */ +#endif + } MIBLEAF_T; + +/* Bit values for access_type */ +#define READ_ACCESS 0x01 +#define WRITE_ACCESS 0x02 +#define CREATE_ACCESS 0x04 +#define NOTIFY_ACCESS 0x08 +#define READ_WRITE_ACCESS (READ_ACCESS | WRITE_ACCESS) +#define READ_CREATE_ACCESS (READ_ACCESS | WRITE_ACCESS | CREATE_ACCESS) + +#if INSTALL_ENVOY_TWO_CHAR_MACROS +#define RO READ_ACCESS /* READ ONLY ACCESS */ +#define WO WRITE_ACCESS /* WRITE ONLY ACCESS */ +#define RW (READ_ACCESS | WRITE_ACCESS) /* READ/WRITE ACCESS */ +#define RC (READ_ACCESS | WRITE_ACCESS | CREATE_ACCESS) /* READ/CREATE */ +#define NO NOTIFY_ACCESS /* NOTIFY ONLY ACCESS */ +#endif + +/* Bit values for scalar vs tabular type */ +#define SCALAR 0x80 +#define TABULAR 0x00 + +/* maximum size for a reference count */ +#define AX_MAX_REF_COUNT 0xFFFF + +/* Define an MIB internal (or root) node */ +typedef struct MIBNODE_S + { + unsigned short node_type; /* See above */ + struct MIBARC_S *arcs; /* Descendents from this node */ +#if INSTALL_ENVOY_AGENTX_MASTER + MIBLEAF_T *leaf; /* leaf for this node */ +#endif + } MIBNODE_T; + +/* Define a pointer from a node to subsidiary node or a leaf */ +/* These structures are aggregated into an array. */ +/* THE LAST ELEMENT IN SUCH AN ARRAY MUST HAVE A NULL POINTER. */ +typedef struct MIBARC_S + { + OIDC_T id; /* Object identifier component */ + struct MIBARC_S *nodep; /* The descendent node/leaf */ + } MIBARC_T; + +/* Define a cookie structure to hold old style method routines for use with + the backwards compatibility method routines */ +typedef struct COMPAT_ROUTINES_S + { + TESTPROC_T * testproc; + NEXTPROC_T * nextproc; + GETPROC_T * getproc; + SETPROC_T * setproc; + char * cookie; + } COMPAT_ROUTINES_T; + +#define MIB_ISO 1 /* Level 0 - ISO *IS* #1 by fiat (!!) */ +#define MIB_CCITT 2 /* Level 0 */ +#define MIB_JOINT_ISO_CCITT 3 /* Level 0 */ +#define MIB_ORG 3 /* Level 1 - {ISO 3} */ +#define MIB_DOD 6 /* Level 2 - {ORG 6} */ +#define MIB_INTERNET 1 /* Level 3 - {DOD 1} */ + + +#define MIB_DIRECTORY 1 /* Level 4 - {INTERNET 1} */ +#define MIB_MGMT 2 /* Level 4 - {INTERNET 2} */ +#define MIB_MIB2 1 /* Level 5 - {MGMT 1} */ +#define MIB_MIB1 1 /* Level 5 - {MGMT 1} */ +#define MIB_SYSTEM 1 /* Level 6 - {MIB 1} */ +#define MIB_INTERFACES 2 /* Level 6 - {MIB 2} */ +#define MIB_AT 3 /* Level 6 - {MIB 3} */ +#define MIB_IP 4 /* Level 6 - {MIB 4} */ +#define MIB_ICMP 5 /* Level 6 - {MIB 5} */ +#define MIB_TCP 6 /* Level 6 - {MIB 6} */ +#define MIB_UDP 7 /* Level 6 - {MIB 7} */ +#define MIB_EGP 8 /* Level 6 - {MIB 8} */ + +#define MIB_EXPERIMENTAL 3 /* Level 4 - {INTERNET 3} */ +#define MIB_IETF 1 /* Level 5 - {EXPERIMENTAL 1} */ +#define MIB_PRIVATE 4 /* Level 4 - {INTERNET 4} */ +#define MIB_ENTERPRISE 1 /* Level 5 - {PRIVATE 1} */ + + +#define ARC(ID,NODE) {ID, (struct MIBARC_S *)&NODE} +#define END_OF_ARC_LIST {0, (struct MIBARC_S *)0} +#define NODE(NAME, ARCLIST) {INNER_NODE, ARCLIST} +#if INSTALL_ENVOY_AGENTX_MASTER +#define NODE_NT(NAME, NT, ARCLIST) {(INNER_NODE | NT), ARCLIST, 0} +#else +#define NODE_NT(NAME, NT, ARCLIST) {(INNER_NODE | NT), ARCLIST} +#endif +#define SNMP_NULLPROC (int (*)())0 + +/* The LEAF macro is for release 1 mib.c and MIB Compiler */ +#define LEAF(NAME, VT, ACCESS, TESTP, GETP, SETP, NXTP, COOKIE) \ + {LEAF_NODE, VT, ACCESS, \ + (TESTPROC_T *)TESTP, (GETPROC_T *)GETP, \ + (SETPROC_T *)SETP, (NEXTPROC_T *)NXTP, \ + (char *)COOKIE, 0, 0xFFFFFFFFL, 0xFFFFFFFFL} + +/* The LEAFM macro is for release 2 mib.c and MIB Compiler */ +#define LEAFM(NM, VT, ACC, TSTP, GETP, SETP, NXTP, CKE, LOC, VMSK, WMSK) \ + {LEAF_NODE, VT, ACC, \ + (TESTPROC_T *)TSTP, (GETPROC_T *)GETP, \ + (SETPROC_T *)SETP, (NEXTPROC_T *)NXTP, \ + (char *)CKE, LOC, VMSK, WMSK } + +/* The LEAF_ASYS macro is for release envoy release 6 and is for use with + the async routines, it tags the leaf as static */ +#define LEAF_ASYS(LN, NM, VT, AC, TB, TST, GET, SET, NEX, CKE, LOC, VMK, WMK) \ +STATIC MIBLEAF_T LN = {LEAF_NODE, VT, AC, \ + (ASY_TESTPROC_T *)TST, (ASY_GETPROC_T *)GET, \ + (ASY_SETPROC_T *)SET, (ASY_NEXTPROC_T *)NEX, \ + (char *)CKE, LOC, VMK, WMK } + +/* The LEAF_ASY macro is for release envoy release 6 and is for use with + the async routines */ +#define LEAF_ASY(LN, NM, VT, AC, TB, TST, GET, SET, NEX, CKE, LOC, VMK, WMK) \ +MIBLEAF_T LN = {LEAF_NODE, VT, AC, \ + (ASY_TESTPROC_T *)TST, (ASY_GETPROC_T *)GET, \ + (ASY_SETPROC_T *)SET, (ASY_NEXTPROC_T *)NEX, \ + (char *)CKE, LOC, VMK, WMK } + +/* The LEAFCOMS macro is for envoy release 6 and is for use with the async + compatibility routines. The compat routines allow older non-async method + routines to be run from a newer async engine */ +#define LEAF_COMS(LN, CN, NM, VT, AC, TB, TS, GT, ST, NX, CKE, LOC, VMK, WMK) \ +STATIC COMPAT_ROUTINES_T CN = {(TESTPROC_T *)TS, (NEXTPROC_T *)NX, \ + (GETPROC_T *)GT, (SETPROC_T *)ST, \ + (char *)CKE }; \ +STATIC MIBLEAF_T LN = {LEAF_NODE, VT, AC, \ + (ASY_TESTPROC_T *)async_compat_test, \ + (ASY_GETPROC_T *)async_compat_get, \ + (ASY_SETPROC_T *)async_compat_set, \ + (ASY_NEXTPROC_T *)async_compat_next, \ + (char *)&CN, LOC, VMK, WMK } + +#define LEAF_COM(LN, CN, NM, VT, AC, TB, TS, GT, ST, NX, CKE, LOC, VMK, WMK) \ +STATIC COMPAT_ROUTINES_T CN = {(TESTPROC_T *)TS, (NEXTPROC_T *)NX, \ + (GETPROC_T *)GT, (SETPROC_T *)ST, \ + (char *)CKE }; \ +MIBLEAF_T LN = {LEAF_NODE, VT, AC, \ + (ASY_TESTPROC_T *)async_compat_test, \ + (ASY_GETPROC_T *)async_compat_get, \ + (ASY_SETPROC_T *)async_compat_set, \ + (ASY_NEXTPROC_T *)async_compat_next, \ + (char *)&CN, LOC, VMK, WMK } + +/* The LEAF NT macros are for emissary release 7 and include a flag + argument to allow setting of the removable class flags */ +#define LEAF_NT_ASYS(LN, NT, NM, VT, AC, TB, TS, GT, ST, NX, CK, LC, VM, WM) \ +STATIC MIBLEAF_T LN = {(LEAF_NODE | NT), VT, AC, \ + (ASY_TESTPROC_T *)TS, (ASY_GETPROC_T *)GT, \ + (ASY_SETPROC_T *)ST, (ASY_NEXTPROC_T *)NX, \ + (char *)CK, LC, VM, WM } + +#define LEAF_NT_ASY(LN, NT, NM, VT, AC, TB, TS, GT, ST, NX, CK, LC, VM, WM) \ +MIBLEAF_T LN = {(LEAF_NODE | NT), VT, AC, \ + (ASY_TESTPROC_T *)TS, (ASY_GETPROC_T *)GT, \ + (ASY_SETPROC_T *)ST, (ASY_NEXTPROC_T *)NX, \ + (char *)CK, LC, VM, WM } + +/* The COM macros are for use with the async compatibility routines. + The compat routines allow older non-async method routines to + be run from a newer async engine */ +#define LEAF_NT_COMS(LN, CN, NT, NM, VT, AC, TB, TS, GT, ST, NX, CK, LC, VM, WM) \ +STATIC COMPAT_ROUTINES_T CN = {(TESTPROC_T *)TS, (NEXTPROC_T *)NX, \ + (GETPROC_T *)GT, (SETPROC_T *)ST, \ + (char *)CK }; \ +STATIC MIBLEAF_T LN = {(LEAF_NODE | NT), VT, AC, \ + (ASY_TESTPROC_T *)async_compat_test, \ + (ASY_GETPROC_T *)async_compat_get, \ + (ASY_SETPROC_T *)async_compat_set, \ + (ASY_NEXTPROC_T *)async_compat_next, \ + (char *)&CN, LC, VM, WM } + +#define LEAF_NT_COM(LN, CN, NT, NM, VT, AC, TB, TS, GT, ST, NX, CK, LC, VM, WM) \ +STATIC COMPAT_ROUTINES_T CN = {(TESTPROC_T *)TS, (NEXTPROC_T *)NX, \ + (GETPROC_T *)GT, (SETPROC_T *)ST, \ + (char *)CK }; \ +MIBLEAF_T LN = {(LEAF_NODE | NT), VT, AC, \ + (ASY_TESTPROC_T *)async_compat_test, \ + (ASY_GETPROC_T *)async_compat_get, \ + (ASY_SETPROC_T *)async_compat_set, \ + (ASY_NEXTPROC_T *)async_compat_next, \ + (char *)&CN, LC, VM, WM } + + + +typedef struct MIBLOC_S + { + UINT_16_T ml_flags; + OIDC_T ml_last_match; + /* The following item splits out the "instance" part of the */ + /* full object identifier. The number of components in the */ + /* "base" part (i.e. the path to the leaf may be derived by */ + /* vb_obj_id.num_components - ml_base_objid.num_components and */ + /* the list of components being taken directly from */ + /* vb_obj_id.component_list. */ + OBJ_ID_T ml_remaining_objid; + union { + MIBLEAF_T *mlleaf_u; + MIBNODE_T *mlnode_u; + } mbl_u; + } MIBLOC_T; +#define ml_leaf mbl_u.mlleaf_u +#define ml_node mbl_u.mlnode_u + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + +/* Values for ml_flags */ +#define ML_IS_LEAF 0x01 + +/* Determine what the default root node will be */ +#ifdef ENVOY_DEFAULT_MIB_ROOT_NODE +#define ENVOY_MIB_ROOT_NODE ENVOY_DEFAULT_MIB_ROOT_NODE +extern MIBNODE_T ENVOY_DEFAULT_MIB_ROOT_NODE; +#else +#define ENVOY_MIB_ROOT_NODE mib_root_node +extern MIBNODE_T mib_root_node; +#endif + +extern INT_32_T Find_Node_From_Root __((MIBNODE_T *root, + OBJ_ID_T *objp, + MIBNODE_T **npp)); + +extern int Add_Node_From_Root __((MIBNODE_T *root, + OBJ_ID_T *objp, + MIBNODE_T *anode, + MIBNODE_T **rnode)); + +extern MIBNODE_T * Remove_Node_From_Root __((MIBNODE_T *root, + OBJ_ID_T *objp)); + +#if (INSTALL_ENVOY_AGENTX_MASTER) +extern sbits32_t Find_Leaf_From_Root __((MIBNODE_T *mibroot, + OBJ_ID_T *objid, + MIBLEAF_T **mibleaf)); + +extern int AX_Add_Leaf_From_Root __((MIBNODE_T *mibroot, + OBJ_ID_T *objp, + MIBLEAF_T *add_leaf, + MIBLEAF_T **rem_leaf)); + +extern MIBLEAF_T * AX_Remove_Leaf_From_Root __((MIBNODE_T *mibroot, + OBJ_ID_T *objid)); + +#endif /* #if (INSTALL_ENVOY_AGENTX_MASTER) */ + +#define Find_Node(O, N) Find_Node_From_Root (0, O, N) + +#define Add_Node(O, A, R) Add_Node_From_Root (0, O, A, R) + +#define Remove_Node(O) Remove_Node_From_Root (0, O) + +#ifdef __cplusplus +} +#endif + +#endif /* mib_inc */ + + diff --git a/h/wrn/wm/snmp/engine/ntfy_chk.h b/h/wrn/wm/snmp/engine/ntfy_chk.h new file mode 100644 index 0000000..ad9b8ff --- /dev/null +++ b/h/wrn/wm/snmp/engine/ntfy_chk.h @@ -0,0 +1,178 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/ntfy_chk.h,v 1.2 2001/11/06 21:35:03 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: ntfy_chk.h,v $ + * Revision 1.2 2001/11/06 21:35:03 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:22 tneale + * Tornado shuffle + * + * Revision 9.6.4.2 2001/08/07 18:33:56 josh + * adding support for SNMPv1/v2c/v3 coexistence to SNMP Notify code + * + * Revision 9.6.4.1 2001/06/28 18:22:56 josh + * Seeding the Cormorant branch with the code from the old + * cormorant branch + * + * Revision 9.6 2001/04/11 21:01:49 josh + * we are overwriting the trunk's copy of this file with + * the file from the kingfisher branch + * + * Revision 9.5 2001/01/19 22:22:05 paul + * Update copyright. + * + * Revision 9.4 2000/07/12 18:36:41 josh + * additional flags and prototypes + * + * Revision 9.3.4.1 2001/04/11 20:48:30 josh + * moving cormorant-specific changes off to the cormorant + * branch + * + * Revision 9.3.2.3 2001/03/12 22:07:55 tneale + * Updated copyright + * + * Revision 9.3.2.2 2000/12/13 20:51:07 josh + * SNMP_Send_Notify_Name() now obsoletes SNMP_Send_Notify() + * logic of SNMP_Send_Notify_Name() is improved to help prevent nesting of + * locks and generally smooth out flow of data + * + * Revision 9.3.2.1 2000/09/21 21:14:53 josh + * bringing branch include files in line with root + * + * Revision 9.3 2000/03/17 19:48:35 meister + * Update copyright notice + * + * Revision 9.2 2000/03/09 20:58:34 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.1 2000/03/09 16:57:00 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.0 1999/10/21 20:43:34 josh + * updating version stamps + * + * Revision 1.5 1999/10/18 22:49:52 josh + * patches to method routines and related code + * + * Revision 1.4 1999/09/30 22:07:57 josh + * cleaning up and changing prototypes to match new cookie scheme + * + * Revision 1.3 1999/09/27 21:11:44 josh + * fixing nits, rewriting engine id <--> address code, adding installation + * option + * + * Revision 1.2 1999/09/14 19:41:02 josh + * completed code for sending v3 notifies + * + * Revision 1.1 1999/09/08 18:10:51 josh + * functions to build a target list for a given notify + * + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(ntfy_chk_inc)) +#define ntfy_chk_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1_inc)) +#include +#endif + +#if (!defined(buffer_inc)) +#include +#endif + +#if (!defined(smi_inc)) +#include +#endif + +#if (!defined(v3_trgt_inc)) +#include +#endif + +#if (!defined(v3_ntfy_inc)) +#include +#endif + +#define tag_whitespace(TL) \ + ((((TL) == ' ') || ((TL) == '\x9') || \ + ((TL) == '\xd') || ((TL) == '\xb')) ? 1 : 0) + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +typedef struct TARGET_LIST_S + { + struct TARGET_LIST_S *next; + SNMP_TARGET_ADDR_T *target; + /* information passed in by the caller */ + SNMP_PKT_T *pktp; + VBL_T *vblp; + EBUFFER_T context; + /* destination address */ + SNMPADDR_T for_addr; + /* information pulled out of the target_addr object */ + OBJ_ID_T tdomain; + EBUFFER_T taddress; + bits32_t timeout; + bits16_t retry_count; + bits32_t mms; + /* information pulled out of the target_params object */ + int ptype; + int mp_model; + int sec_model; + EBUFFER_T sec_name; + int sec_level; + bits16_t flags; +#define SNMP_TARGET_LIST_SEND_NOTIFY 0x0001 +#define SNMP_TARGET_LIST_SEND_PROBE 0x0002 +#define SNMP_TARGET_LIST_SEND_INFORM 0x0004 +#define SNMP_TARGET_LIST_SEND_PROXY_PROBE 0x0008 +#define SNMP_TARGET_LIST_INFOK 0x0010 + } TARGET_LIST_T; + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + +extern void init_target_list __((TARGET_LIST_T *)); +extern void clean_target_list __((TARGET_LIST_T *)); +extern TARGET_LIST_T *build_target_list __((SNMP_NOTIFY_T *, VBL_T *)); +extern int taglist_check __((EBUFFER_T *, EBUFFER_T *)); + +#ifdef __cplusplus +} +#endif + +#endif /* #if (!defined(ntfy_chk_inc))*/ + diff --git a/h/wrn/wm/snmp/engine/objectid.h b/h/wrn/wm/snmp/engine/objectid.h new file mode 100644 index 0000000..fcd51e6 --- /dev/null +++ b/h/wrn/wm/snmp/engine/objectid.h @@ -0,0 +1,142 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/objectid.h,v 1.2 2001/11/06 21:35:03 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1988-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: objectid.h,v $ + * Revision 1.2 2001/11/06 21:35:03 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:23 tneale + * Tornado shuffle + * + * Revision 9.3 2001/01/19 22:22:05 paul + * Update copyright. + * + * Revision 9.2 2000/03/17 19:48:36 meister + * Update copyright notice + * + * Revision 9.1 2000/03/09 16:57:20 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.0 1998/10/16 22:10:16 sar + * Update version stamp to match release + * + * Revision 8.1 1998/02/25 04:50:42 sra + * Update copyrights. + * + * Revision 8.0 1997/11/18 00:56:27 sar + * Updated revision to 8.0 + * + * Revision 7.2 1997/03/20 06:48:14 sra + * DFARS-safe copyright text. Zap! + * + * Revision 7.1 1997/02/25 10:49:26 sra + * Update copyright notice, dust under the bed. + * + * Revision 7.0 1996/03/18 20:17:33 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 6.0 1995/05/31 21:46:48 sra + * Release 6.0. + * + * Revision 5.1 1995/03/20 23:11:33 sar + * Minor cleanup. + * + * Revision 5.0 1994/05/16 15:49:04 sar + * Updated revision to 5.0 and copyright to include 1994 + * + * Revision 4.0 1993/06/24 16:05:41 sar + * Updated rev to 4.0 and coypright to 93 + * + * Revision 3.4 1993/05/03 17:54:14 sar + * Modified #include to be #include where it was correct. + * + * Revision 3.3 1993/04/27 21:06:48 sar + * added copy_object_id which does a straight copy, beware free one copy + * while using the other. + * + * Revision 3.2 1993/04/22 20:14:13 sar + * Updating of macros and defines to use new naming scheme and get the + * names to be more useful in general. (use INSTALL_ENVOY_SNMP_VERSION_1 + * for example). + * + * Revision 3.1 1993/02/17 20:49:21 sar + * Added no_pp definition (#define __(x) x stuff) + * Added init_object_id - macro: init an OBJ_ID_T to 0 components and 0 list. + * + * Revision 3.0 92/04/03 19:52:27 dab + * Release 3.0 + * + * Revision 2.100 91/08/09 14:09:47 dab + * Update version. + * + * Revision 1.1 91/07/30 02:24:29 romkey + * Initial revision + * + * + * Rev 2.0 31 Mar 1990 15:11:20 + * Release 2.00 + * + * Rev 1.2 11 Jan 1989 12:46:46 + * Moved Clean_Obj_ID() to objectid.c + * + * Rev 1.1 19 Sep 1988 17:27:08 + * Made changes to make the Sun C compiler happy. + * + * Rev 1.0 12 Sep 1988 10:46:20 + * Initial revision. +*/ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(objectid_inc)) +#define objectid_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1_inc)) +#include +#endif + +#define clone_object_id(O, N) build_object_id( \ + ((OBJ_ID_T *)(O))->num_components, \ + ((OBJ_ID_T *)(O))->component_list, N) + +#define init_object_id(O) ((OBJ_ID_T *)(O))->num_components = 0; \ + ((OBJ_ID_T *)(O))->component_list = 0; + +#define copy_object_id(O, N) \ +(((OBJ_ID_T *)(N))->num_components = ((OBJ_ID_T *)(O))->num_components, \ + ((OBJ_ID_T *)(N))->component_list = ((OBJ_ID_T *)(O))->component_list) + +extern int build_object_id __((int, OIDC_T *, OBJ_ID_T *)); +extern void Clean_Obj_ID __((OBJ_ID_T *)); + +#ifdef __cplusplus +} +#endif + +#endif /* objectid_inc */ diff --git a/h/wrn/wm/snmp/engine/proxy.h b/h/wrn/wm/snmp/engine/proxy.h new file mode 100644 index 0000000..4c24b59 --- /dev/null +++ b/h/wrn/wm/snmp/engine/proxy.h @@ -0,0 +1,118 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/proxy.h,v 1.3 2001/11/06 21:50:40 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: proxy.h,v $ + * Revision 1.3 2001/11/06 21:50:40 josh + * second (and hopefully final) pass of new path hacking + * + * Revision 1.2 2001/11/06 21:35:03 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:23 tneale + * Tornado shuffle + * + * Revision 9.6 2001/01/19 22:22:05 paul + * Update copyright. + * + * Revision 9.5 2000/03/17 19:48:37 meister + * Update copyright notice + * + * Revision 9.4 2000/03/09 20:58:34 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.3 2000/03/09 16:57:34 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.2 2000/02/29 20:40:49 josh + * #ifdefs so we don't have semicolons sitting on lines alone in include + * files (the ARM compiler hates that). + * + * Revision 9.1 1999/11/01 19:56:52 josh + * cleaning up initializations to keep extra files out of code when not + * in use + * + * Revision 9.0 1998/10/16 22:10:16 sar + * Update version stamp to match release + * + * Revision 8.1 1998/08/12 04:52:14 sar + * revamp the initialization routines to limit the amount of + * code that might get pulled in. + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(proxy_ini_inc)) +#define proxy_ini_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1conf_inc)) +#include +#endif + +#if (!defined(snmp_inc)) +#include +#endif + +#if INSTALL_ENVOY_SNMP_LOCK +ENVOY_SNMP_LOCK_EXTERN(SNMP_ProxyLock); +#endif + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +typedef struct PROXY_CB_S + { + struct PROXY_CB_S *next; + UINT_32_T indx; + UINT_32_T reqid; + EBUFFER_T community; + SNMPADDR_T loc_addr; + SNMPADDR_T for_addr; + IO_COMPLETE_T *io_comp; + ERR_COMPLETE_T *err_comp; + PTR_T async_cookie; + ALENGTH_T maxpkt; + ATVALUE_T pdu_type; + INT_32_T original_version; + } PROXY_CB_T; + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + +extern void envoy_proxy_init __((void)); + +#ifdef __cplusplus +} +#endif + +#endif /* #if (!defined(proxy_ini_inc)) */ + diff --git a/h/wrn/wm/snmp/engine/proxy_tr.h b/h/wrn/wm/snmp/engine/proxy_tr.h new file mode 100644 index 0000000..ac67df3 --- /dev/null +++ b/h/wrn/wm/snmp/engine/proxy_tr.h @@ -0,0 +1,121 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/proxy_tr.h,v 1.2 2001/11/06 21:35:03 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1995-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: proxy_tr.h,v $ + * Revision 1.2 2001/11/06 21:35:03 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:23 tneale + * Tornado shuffle + * + * Revision 9.4 2001/01/19 22:22:06 paul + * Update copyright. + * + * Revision 9.3 2000/03/17 19:48:37 meister + * Update copyright notice + * + * Revision 9.2 2000/03/09 20:58:34 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.1 2000/03/09 16:57:46 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.0 1998/10/16 22:10:17 sar + * Update version stamp to match release + * + * Revision 8.1 1998/02/25 04:50:43 sra + * Update copyrights. + * + * Revision 8.0 1997/11/18 00:56:27 sar + * Updated revision to 8.0 + * + * Revision 7.2 1997/03/20 06:48:15 sra + * DFARS-safe copyright text. Zap! + * + * Revision 7.1 1997/02/25 10:49:26 sra + * Update copyright notice, dust under the bed. + * + * Revision 7.0 1996/03/18 20:17:33 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 1.1 1995/11/14 22:41:44 sar + * Initial revision + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(proxy_tr_inc)) +#define proxy_tr_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1conf_inc)) +#include +#endif + +#if (!defined(snmpdefs_inc)) +#include +#endif + +#if (!defined(buffer_inc)) +#include +#endif + +#if (INSTALL_ENVOY_SNMP_PROXY) +typedef INT_32_T TRANSPORT_ROUTINE_T __((EBUFFER_T *, PTR_T)); + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +typedef struct PROXY_BLOCK_S + { + EBUFFER_T community; + TRANSPORT_ROUTINE_T *transport_routine; + PTR_T transport_block; + } PROXY_BLOCK_T; + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + +extern INT_32_T SNMP_Proxy_V1_Translation __((SNMP_PKT_T *)); + +extern INT_32_T SNMP_Proxy_Trap_V1_To_V2 __((SNMP_PKT_T *)); +extern INT_32_T SNMP_Proxy_V2_Translation __((SNMP_PKT_T *)); + +#endif /* #if (INSTALL_ENVOY_SNMP_PROXY) */ + +#ifdef __cplusplus +} +#endif + +#endif /* #if (!defined(proxy_tr_inc)) */ + diff --git a/h/wrn/wm/snmp/engine/sendntfy.h b/h/wrn/wm/snmp/engine/sendntfy.h new file mode 100644 index 0000000..d050b7d --- /dev/null +++ b/h/wrn/wm/snmp/engine/sendntfy.h @@ -0,0 +1,236 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/sendntfy.h,v 1.2 2001/11/06 21:35:03 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: sendntfy.h,v $ + * Revision 1.2 2001/11/06 21:35:03 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:23 tneale + * Tornado shuffle + * + * Revision 9.9 2001/04/11 20:42:56 josh + * merge from the kingfisher branch + * + * Revision 9.8 2001/01/19 22:22:06 paul + * Update copyright. + * + * Revision 9.7 2000/07/12 18:39:31 josh + * moving SNMP_Find_Matching_Engine_ID() to v3_eng.c -- appropriately + * updating headers to correspond + * + * Revision 9.6 2000/06/09 14:54:12 josh + * modifications due to new installation options, new proxy code + * moved some definitions from sendntfy.h into v3_trgt.h so they'd + * be built with the target code + * + * Revision 9.5.2.3 2001/03/12 22:07:56 tneale + * Updated copyright + * + * Revision 9.5.2.2 2001/01/19 21:32:24 josh + * prototype for SNMP_Send_Notify_Name(). retrans_timer_exp() redefined + * to static + * + * Revision 9.5.2.1 2000/09/21 21:14:53 josh + * bringing branch include files in line with root + * + * Revision 9.5 2000/03/17 19:48:38 meister + * Update copyright notice + * + * Revision 9.4 2000/03/09 20:58:34 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.3 2000/03/09 16:58:01 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.2 2000/02/04 21:54:16 josh + * prototyping functions that may need to be called by other modules + * this is done primarily to make the vxWorks compiler happy. + * Warning: the prototypes added may be duplicated by a mib_hand.h + * file generated by Emissary. + * + * Revision 9.1 2000/01/05 21:15:28 josh + * moving code around to make sure probe checks occur as long as an + * engine ID is found + * + * Revision 9.0 1999/10/21 20:43:35 josh + * updating version stamps + * + * Revision 1.8 1999/10/07 23:38:24 josh + * added definition for snmpaddr to taddress conversion routine + * + * Revision 1.7 1999/10/03 00:18:08 josh + * fixing retramit timer code -- setting handler correctly, + * cleaning up some double-free situations, and putting locking in + * where needed + * + * Revision 1.6 1999/09/30 22:07:58 josh + * cleaning up and changing prototypes to match new cookie scheme + * + * Revision 1.5 1999/09/27 21:11:44 josh + * fixing nits, rewriting engine id <--> address code, adding installation + * option + * + * Revision 1.4 1999/09/15 16:17:39 josh + * Linking the Retransmit Lock to the Retransmit list turns out to + * be a lot more trouble than it's worth. We'll just refer to + * it directly, a la SNMP_CoarseLock. + * + * Revision 1.3 1999/09/14 19:41:02 josh + * completed code for sending v3 notifies + * + * Revision 1.2 1999/09/11 02:14:06 josh + * updating header file -- created retrans block structures + * + * Revision 1.1 1999/09/01 21:56:04 josh + * Code to do actual sending of Notifies + * + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(sendntfy_inc)) +#define sendntfy_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1_inc)) +#include +#endif + +#if (!defined(snmpdefs_inc)) +#include +#endif + +#if (!defined(buffer_inc)) +#include +#endif + +#if (!defined(smi_inc)) +#include +#endif + +#if (!defined(etimer_inc)) +#include +#endif + +#if (!defined(v3_trgt_inc)) +#include +#endif + +#if (!defined(v3_ntfy_inc)) +#include +#endif + +#if (!defined(ntfy_chk_inc)) +#include +#endif + +#ifndef ENVOY_RETRANS_CLEANUP_INTERVAL +#define ENVOY_RETRANS_CLEANUP_INTERVAL 500 +#endif + +#ifndef ENVOY_SET_RETRANS_ID +#define ENVOY_SET_RETRANS_ID(RET) \ + (RET)->retrans_id = root_retrans_block.next_retrans_id++ +#endif + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +typedef struct RETRANS_COOKIE_S + { + struct RETRANS_COOKIE_S *next; + int ref_cnt; + RETRANS_CLEANUP_T *cleanup_rtn; + PTR_T cookie; + } RETRANS_COOKIE_T; + +typedef struct SNMP_RETRANS_S + { + struct SNMP_RETRANS_S *next; + SNMP_PKT_T *pktp; + SNMPADDR_T for_addr; + SNMPADDR_T loc_addr; + bits16_t retry_count; + bits32_t timeout; + IO_COMPLETE_T *io_complete; + ERR_COMPLETE_T *error_complete; + RETRANS_COOKIE_T *cookie; + bits32_t retrans_id; + bits32_t time_sent; + bits16_t flags; +#define SNMP_RETRANS_FLAGS_EXPIRED 0x01 +#define SNMP_RETRANS_FLAGS_ACKNOWLEDGED 0x02 +#define SNMP_RETRANS_FLAGS_SENDING_PROBE 0x04 + bits16_t ref_cnt; + TARGET_LIST_T *tlp; + } SNMP_RETRANS_T; + +typedef struct SNMP_RETRANS_ROOT_S + { + SNMP_RETRANS_T *retrans; + bits32_t next_retrans_id; + ENVOY_TIMER_T timer; + } SNMP_RETRANS_ROOT_T; + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + + +extern RETRANS_COOKIE_T *root_retrans_cookie; +extern SNMP_RETRANS_ROOT_T root_retrans_block; + +extern int SNMP_Probe_Check __((SNMP_RETRANS_T *)); +extern void SNMP_Check_Retrans_List __((SNMP_PKT_T *)); +extern void SNMP_Send_Packet_Retransmit __((SNMP_PKT_T *, SNMPADDR_T *, + SNMPADDR_T *, bits16_t, + bits32_t, IO_COMPLETE_T *, + ERR_COMPLETE_T *, + RETRANS_COOKIE_T *)); +extern void SNMP_Send_Packet_Probe __((TARGET_LIST_T *, + SNMPADDR_T *, + IO_COMPLETE_T *, + ERR_COMPLETE_T *, + RETRANS_COOKIE_T *)); +extern void SNMP_Send_Notify __((SNMP_NOTIFY_T *, VBL_T *, SNMPADDR_T *, + bits8_t *, ALENGTH_T, IO_COMPLETE_T *, + ERR_COMPLETE_T *, RETRANS_CLEANUP_T *, + PTR_T)); +extern void SNMP_Send_Notify_Name __((bits8_t *, ALENGTH_T, VBL_T *, + SNMPADDR_T *, bits8_t *, ALENGTH_T, + IO_COMPLETE_T *, ERR_COMPLETE_T *, + RETRANS_CLEANUP_T *, PTR_T)); + +#ifdef __cplusplus +} +#endif + +#endif /* #if (!defined(sendntfy_inc))*/ diff --git a/h/wrn/wm/snmp/engine/smi.h b/h/wrn/wm/snmp/engine/smi.h new file mode 100644 index 0000000..97430aa --- /dev/null +++ b/h/wrn/wm/snmp/engine/smi.h @@ -0,0 +1,63 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/smi.h,v 1.1.1.1 2001/11/05 17:47:23 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: smi.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:23 tneale + * Tornado shuffle + * + * Revision 9.2 2001/01/19 22:22:06 paul + * Update copyright. + * + * Revision 9.1 2000/03/17 19:48:38 meister + * Update copyright notice + * + * Revision 9.0 1998/10/16 22:10:18 sar + * Update version stamp to match release + * + * Revision 1.1 1998/05/23 19:51:56 sar + * Defines for various items that are in the standard smi + * and might be used by our code. For example row status + * and storage tags. + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(smi_inc)) +#define smi_inc + +#define ETC_STO_OTHER 1 +#define ETC_STO_VOL 2 +#define ETC_STO_NONVOL 3 +#define ETC_STO_PERM 4 +#define ETC_STO_RONLY 5 + +#define ETC_RS_RSNE 0 +#define ETC_RS_ACTIVE 1 +#define ETC_RS_NIS 2 +#define ETC_RS_NREADY 3 +#define ETC_RS_CAGO 4 +#define ETC_RS_CAWAIT 5 +#define ETC_RS_DESTROY 6 + +#endif diff --git a/h/wrn/wm/snmp/engine/snmp.h b/h/wrn/wm/snmp/engine/snmp.h new file mode 100644 index 0000000..6db0062 --- /dev/null +++ b/h/wrn/wm/snmp/engine/snmp.h @@ -0,0 +1,270 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/snmp.h,v 1.4 2003/01/15 13:58:56 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: snmp.h,v $ + * Revision 1.4 2003/01/15 13:58:56 josh + * directory structure shifting + * + * Revision 1.3 2001/11/06 21:50:40 josh + * second (and hopefully final) pass of new path hacking + * + * Revision 1.2 2001/11/06 21:35:04 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:23 tneale + * Tornado shuffle + * + * Revision 9.5 2001/01/19 22:22:06 paul + * Update copyright. + * + * Revision 9.4 2000/03/17 19:48:39 meister + * Update copyright notice + * + * Revision 9.3 1999/10/29 21:05:42 josh + * The infrastructure lock tag is needed by Epilogue subagents as well + * + * Revision 9.2 1999/10/18 22:35:52 sar + * Add free_lock + * add init_lock to the block used if locks aren't defined + * + * Revision 9.1 1999/09/14 19:45:12 josh + * added a new lock -- SNMP_V3_Retrans_Lock + * + * Revision 9.0 1998/10/16 22:10:18 sar + * Update version stamp to match release + * + * Revision 8.5 1998/05/29 17:12:34 josh + * a few ifdefs for cleanliness + * + * Revision 8.4 1998/05/29 17:10:02 josh + * new locking macros added. + * + * Revision 8.3 1998/05/28 03:41:35 sar + * Added extern for boots lock + * + * Revision 8.2 1998/04/16 15:45:07 josh + * Declaring a separate lock if necessary + * + * Revision 8.1 1998/02/25 04:50:44 sra + * Update copyrights. + * + * Revision 8.0 1997/11/18 00:56:27 sar + * Updated revision to 8.0 + * + * Revision 7.5 1997/10/22 03:07:30 sar + * Mofied the agentx and older subagent schemes install options + * + * Revision 7.4 1997/10/16 00:25:18 sar + * Primarily this set of modifications is for the agentx protocol. + * Most of the work was in the agentx.h and ax_mth.h files. Most + * other files (snmpdefs.h, vbdefs.h and mib.h) received updates + * to their structures and snmp got some new lock macros. + * + * One other change of note was the modification of continue + * processing. Previously we called a specific continue routine + * directly, now we store a pointer to the corret continue + * function in the snmp packet structure and call that. We include + * macros for backwards compatibility. + * + * Revision 7.3 1997/08/21 17:23:44 sra + * Begin moving configuration stuff that's common to all products to common.h + * Minor cleanups to common/lib/prng.c. Add pnrg seed function to snarkbsd. + * + * Revision 7.2 1997/03/20 06:48:16 sra + * DFARS-safe copyright text. Zap! + * + * Revision 7.1 1997/02/25 10:49:26 sra + * Update copyright notice, dust under the bed. + * + * Revision 7.0 1996/03/18 20:17:33 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 6.0 1995/05/31 21:59:45 sra + * Release 6.0. + * + * Revision 5.4 1995/05/02 23:29:47 sar + * added some semi-colons in the lock macros. + * + * Revision 5.3 1995/04/18 20:41:28 sar + * Added some new macros and modified the old macros so we don't require + * ifdefs in all of the mainline code. Instead we use the new macros + * which will be defined to nothgin if locks aren't installed. + * + * Revision 5.2 1995/03/20 23:11:33 sar + * Redo the defaults for the lock scheme. They macros are now + * defined to look like "good" returns so the main line code does not + * have to deal with if defs. Some places that have large blocks of + * lock code may still choose to use if defs. + * + * Revision 5.1 1994/10/12 20:11:47 sar + * Added an ifdef around the def for the coarse lock + * + * Revision 5.0 1994/05/16 15:49:04 sar + * Updated revision to 5.0 and copyright to include 1994 + * + * Revision 4.0 1993/06/24 16:05:41 sar + * Updated rev to 4.0 and coypright to 93 + * + * Revision 1.6 1993/05/28 18:01:05 sar + * added the define as nothing macros for snmp_trace_input and output. + * + * Revision 1.5 1993/05/03 17:54:14 sar + * Modified #include to be #include where it was correct. + * + * Revision 1.4 1993/04/30 22:58:26 sar + * Added mechanism for minimal proxies and coarse grained locks. + * + * Revision 1.3 1993/04/26 20:33:14 sar + * Added bitstrings, and have deletion of parties or contexts delete acls. + * + * Revision 1.2 1993/03/03 20:06:55 dab + * If the config file doesn't set SNMP_SILLY_MARKETING_MACRO + * then set it to something that wan't make a mess here. + * + * Revision 1.1 1993/02/26 17:08:46 dab + * Initial revision + * + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(snmp_inc)) +#define snmp_inc + +#if (!defined(snmpdefs_inc)) +#include +#endif + +#include +#include + +/* Define some macros as nothing if the user hasn't defined them */ +#if !defined(SNMP_TRACE_INPUT) +#define SNMP_TRACE_INPUT(pkt) +#endif + +#if !defined(SNMP_TRACE_OUTPUT) +#define SNMP_TRACE_OUTPUT(pkt) +#endif + +/* If we are using the lock code specify coarse lock for everybody to use. + We also specify a larger macro that gets a lock and if it can't + executes it's other arguments */ +#if INSTALL_ENVOY_SNMP_LOCK + +#ifndef ENVOY_SNMP_INIT_LOCK_TAG +#define ENVOY_SNMP_INIT_LOCK_TAG(name, tag) ENVOY_SNMP_INIT_LOCK((name)) +#endif + +#ifndef ENVOY_SNMP_FREE_LOCK_TAG +#define ENVOY_SNMP_FREE_LOCK_TAG(lock, tag) +#endif + +#ifndef SNMP_COARSELOCK_TAG +#define SNMP_COARSELOCK_TAG "COAR" +#endif + +#ifndef SNMP_TIMERLOCK_TAG +#define SNMP_TIMERLOCK_TAG "TIMR" +#endif + +#ifndef SNMP_INFRASTRUCTURELOCK_TAG +#define SNMP_INFRASTRUCTURELOCK_TAG "INFR" +#endif + +#if INSTALL_ENVOY_SNMP_PROXY +#ifndef SNMP_PROXYLOCK_TAG +#define SNMP_PROXYLOCK_TAG "PROX" +#endif +#endif + +#if INSTALL_ENVOY_CONTINUE_REENTRANT +#ifndef ENVOY_CONTINUELOCK_TAG +#define ENVOY_CONTINUELOCK_TAG "CONT" +#endif +#endif + +#if INSTALL_ENVOY_AGENTX +#ifndef ENVOY_AXLISTLOCK_TAG +#define ENVOY_AXLISTLOCK_TAG "AXLS" +#endif + +#ifndef ENVOY_AXCOARSELOCK_TAG +#define ENVOY_AXCOARSELOCK_TAG "AXCO" +#endif +#endif + +#if INSTALL_ENVOY_SNMP_VERSION_3 +#ifndef ENVOY_V3RETRANSLOCK_TAG +#define ENVOY_V3RETRANSLOCK_TAG "RETR" +#endif +#ifndef ENVOY_V3BOOTSLOCK_TAG +#define ENVOY_V3BOOTSLOCK_TAG "V3BT" +#endif +#endif + +ENVOY_SNMP_LOCK_EXTERN(SNMP_CoarseLock); +ENVOY_SNMP_LOCK_EXTERN(SNMP_infrastructure_lock); + +#if INSTALL_ENVOY_SNMP_VERSION_3 +ENVOY_SNMP_LOCK_EXTERN(SNMP_V3_Retrans_Lock); +ENVOY_SNMP_LOCK_EXTERN(SNMP_V3_Boots_Lock); +#endif + +#define ENVOY_SNMP_LOCK_AND_1ARGS(get, lock, com1) \ + if (get(lock)) { com1; } +#define ENVOY_SNMP_LOCK_AND_2ARGS(get, lock, com1, com2) \ + if (get(lock)) { com1; com2; } +#define ENVOY_SNMP_LOCK_AND_3ARGS(get, lock, com1, com2, com3) \ + if (get(lock)) { com1; com2; com3; } +#define ENVOY_SNMP_LOCK_AND_4ARGS(get, lock, com1, com2, com3, com4) \ + if (get(lock)) { com1; com2; com3; com4; } +#else /* INSTALL_ENVOY_SNMP_LOCK */ +/* Don't use the lock stuff if the user doesn't define it */ +#define ENVOY_SNMP_LOCK(name) +#define ENVOY_SNMP_LOCK_EXTERN(name); +#define ENVOY_SNMP_INIT_LOCK(name) +#define ENVOY_SNMP_INIT_LOCK_TAG(name, tag) +#define ENVOY_SNMP_FREE_LOCK_TAG(lock, tag) +#define ENVOY_SNMP_GET_READ_LOCK(name) 0 +#define ENVOY_SNMP_RELEASE_READ_LOCK(name) +#define ENVOY_SNMP_GET_WRITE_LOCK(name) 0 +#define ENVOY_SNMP_RELEASE_WRITE_LOCK(name) +#define ENVOY_SNMP_LOCK_AND_1ARGS(get, lock, com1) +#define ENVOY_SNMP_LOCK_AND_2ARGS(get, lock, com1, com2) +#define ENVOY_SNMP_LOCK_AND_3ARGS(get, lock, com1, com2, com3) +#define ENVOY_SNMP_LOCK_AND_4ARGS(get, lock, com1, com2, com3, com4) +#endif /* INSTALL_ENVOY_SNMP_LOCK */ + +#if (INSTALL_ENVOY_AGENTX_MASTER && INSTALL_ENVOY_SNMP_LOCK) +#define ENVOY_AX_MA_RELEASE_READ_LOCK(name) ENVOY_SNMP_RELEASE_READ_LOCK(name) +#define ENVOY_AX_MA_RELEASE_WRITE_LOCK(name) ENVOY_SNMP_RELEASE_WRITE_LOCK(name) +#else +#define ENVOY_AX_MA_RELEASE_READ_LOCK(name) +#define ENVOY_AX_MA_RELEASE_WRITE_LOCK(name) +#endif + +#endif /* snmp_inc */ diff --git a/h/wrn/wm/snmp/engine/snmpdefs.h b/h/wrn/wm/snmp/engine/snmpdefs.h new file mode 100644 index 0000000..94b536c --- /dev/null +++ b/h/wrn/wm/snmp/engine/snmpdefs.h @@ -0,0 +1,1232 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/snmpdefs.h,v 1.7 2002/07/09 19:14:26 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1988-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: snmpdefs.h,v $ + * Revision 1.7 2002/07/09 19:14:26 josh + * remove a namespace collision by renaming SNMP_community_lookup() + * to SNMP_community_coexistence_lookup() + * + * Revision 1.6 2002/05/17 18:45:05 josh + * add ENVOY_ERR_TOO_BIG to envoy_err_t enumeration + * + * Revision 1.5 2002/05/13 20:46:18 josh + * encoding process now checks for 16-bit overflows in + * calculating packet sizes + * + * Revision 1.4 2002/03/06 20:04:24 josh + * make the default size of the SNMPADDR_T as large as a sockaddr_in6 + * + * Revision 1.3 2001/11/09 17:57:18 josh + * updated SNMPADDR_T structure to allow more room for storing + * IPv6 information + * + * Revision 1.2 2001/11/06 21:35:04 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:23 tneale + * Tornado shuffle + * + * Revision 9.20.4.9 2001/10/16 18:34:26 meister + * Added some prototypes + * + * Revision 9.20.4.8 2001/09/21 19:16:06 josh + * updating and expanding structures for use with coexistence + * + * Revision 9.20.4.7 2001/08/29 15:47:06 meister + * declarations for vxworks snmpd component initialation functions + * and task priorities + * + * Revision 9.20.4.6 2001/08/24 14:32:44 josh + * we'll use the proxy_routine field in SNMP_PKT_T for V3 Proxies + * as well + * + * Revision 9.20.4.5 2001/08/17 20:38:43 meister + * Added prototypes for some agentx helper functions which were previously + * declared statically. Added prototypes for agentx and v3 dynamic config init + * functions. + * + * Revision 9.20.4.4 2001/08/07 18:33:57 josh + * adding support for SNMPv1/v2c/v3 coexistence to SNMP Notify code + * + * Revision 9.20.4.3 2001/07/20 20:34:35 josh + * a community table based validation routine that can + * supercede existing community validation routines + * + * Revision 9.20.4.2 2001/07/16 18:02:12 josh + * a first-round commit adding infrastructure support + * for the SNMPv3 Coexistence RFC (2576) + * + * Revision 9.20.4.1 2001/06/28 18:22:57 josh + * Seeding the Cormorant branch with the code from the old + * cormorant branch + * + * Revision 9.20 2001/04/19 18:21:40 josh + * changes to do bounds-checking on maxMsgSize, snmpVersion, + * msgID, and snmpSecurityModel + * + * Revision 9.19 2001/04/11 21:01:49 josh + * we are overwriting the trunk's copy of this file with + * the file from the kingfisher branch + * + * Revision 9.18 2001/01/19 22:22:09 paul + * Update copyright. + * + * Revision 9.17 2000/07/12 18:40:53 josh + * adding a few new error codes to the envoy_err_t definition + * + * Revision 9.16 2000/06/09 14:54:12 josh + * modifications due to new installation options, new proxy code + * moved some definitions from sendntfy.h into v3_trgt.h so they'd + * be built with the target code + * + * Revision 9.15.4.1 2001/04/11 20:48:31 josh + * moving cormorant-specific changes off to the cormorant + * branch + * + * Revision 9.15.2.2 2001/03/12 22:07:57 tneale + * Updated copyright + * + * Revision 9.15.2.1 2000/09/21 21:14:53 josh + * bringing branch include files in line with root + * + * Revision 9.15 2000/03/17 19:48:40 meister + * Update copyright notice + * + * Revision 9.14 2000/03/17 00:03:01 josh + * adding functions to Envoy that replace getproc_got_*() macros + * + * Revision 9.13 2000/03/09 20:58:34 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.12 2000/03/09 16:58:18 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.11 2000/02/04 21:54:17 josh + * prototyping functions that may need to be called by other modules + * this is done primarily to make the vxWorks compiler happy. + * Warning: the prototypes added may be duplicated by a mib_hand.h + * file generated by Emissary. + * + * Revision 9.10 1999/12/23 14:47:27 josh + * cleaning up code per Shawn's comments -- removing extraneous + * comments and doing proxy check before notify check + * + * Revision 9.9 1999/11/05 20:59:34 josh + * fixing an unaligned access problem with SNMPADDR_Ts + * + * Revision 9.8 1999/10/02 01:41:52 sar + * Update the vbp to index code to handle the get bulk error case + * + * Revision 9.7 1999/09/30 21:57:24 josh + * RETRANS_CLEANUP_T function data type + * + * Revision 9.6 1999/09/14 19:46:13 josh + * prototype for vblp_index_to_vbp() + * + * Revision 9.5 1999/09/09 19:31:22 sar + * Update the error macros to set the error index + * + * Revision 9.4 1999/06/01 15:46:15 josh + * Moving some installation option checking. + * + * Revision 9.3 1999/05/24 20:12:12 josh + * 'compc' and 'compl' have been replaced by 'tcount' and 'tlist' + * to avoid C++ compiler errors. + * + * Revision 9.2 1999/04/09 20:37:01 josh + * Obsoleting ENVOY_SNMP_VERSON_USEC and ENVOY_40_VB_FREE_COMPAT + * + * Revision 9.1 1999/03/30 15:20:15 josh + * feature to allow customer-driven context conversion into AgentX + * + * Revision 9.0 1998/10/16 22:10:19 sar + * Update version stamp to match release + * + * Revision 8.8 1998/06/09 20:50:39 sar + * Added unknown context error + * + * Revision 8.7 1998/06/01 20:38:00 sar + * Removed the msg_con_name field from SNMP_PKT_T, we can use the + * community field instead. + * + * Revision 8.6 1998/05/24 06:04:05 sar + * Modified PTR_IP_ADDR call as it probably got stepped on when + * doing my previous changes. + * + * Revision 8.5 1998/05/23 20:18:17 sar + * Added fields and defines for v3 stuff, updated typee info and rearranged + * some of the fields to be clearer. + * + * Revision 8.4 1998/03/09 23:11:06 paul + * getproc_got_ipaddr now takes a pointer to the ipaddr struct + * + * Revision 8.3 1998/02/25 04:50:46 sra + * Update copyrights. + * + * Revision 8.2 1997/12/17 21:13:22 paul + * Removed unnecessary #define/#undef PTR_IPADDR_BITS from around + * getproc_got_ipaddr. + * + * Revision 8.1 1997/12/13 00:08:00 paul + * Added getproc_got_ipaddr macro. + * + * Revision 8.0 1997/11/18 00:56:28 sar + * Updated revision to 8.0 + * + * Revision 7.6 1997/10/22 03:07:29 sar + * Mofied the agentx and older subagent schemes install options + * + * Revision 7.5 1997/10/16 23:52:54 sar + * We need to document that using constant strings in the getproc_got_string + * macro could lead to unhappiness. + * + * We added a macro to allow customers to define what SNMPADDR_T should be, + * and increased the length of the string to 16 bytes in the default case. + * + * changed testproc_error to be a routine + * + * Revision 7.4 1997/10/16 00:25:18 sar + * Primarily this set of modifications is for the agentx protocol. + * Most of the work was in the agentx.h and ax_mth.h files. Most + * other files (snmpdefs.h, vbdefs.h and mib.h) received updates + * to their structures and snmp got some new lock macros. + * + * One other change of note was the modification of continue + * processing. Previously we called a specific continue routine + * directly, now we store a pointer to the corret continue + * function in the snmp packet structure and call that. We include + * macros for backwards compatibility. + * + * Revision 7.3 1997/03/20 06:48:17 sra + * DFARS-safe copyright text. Zap! + * + * Revision 7.2 1997/02/25 10:49:26 sra + * Update copyright notice, dust under the bed. + * + * Revision 7.1 1996/10/15 14:40:22 sar + * Added process_internal_snmp_packet + * + * Revision 7.0 1996/03/18 20:17:33 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 6.5 1996/01/23 16:26:19 sar + * Changed usec_report flag from 0x40 to 0x04 + * + * Revision 6.4 1996/01/10 16:23:25 sar + * USEC updates + * + * Revision 6.3 1995/11/14 22:42:26 sar + * Replaced proxy_trap_{v1 v2} with proxy_traps_and_reports + * + * Revision 6.2 1995/11/04 01:52:03 sar + * Added the proxy routine type and a proxy_routine field in + * the snmp_pkt_t structure if proxy is installed. + * + * Revision 6.1 1995/10/20 22:53:35 sar + * removed bitstring include file & macro + * removed party info from snmp_pkt structure + * added report pdu tag + * + * Revision 6.0 1995/05/31 21:46:51 sra + * Release 6.0. + * + * Revision 5.10 1995/05/22 19:41:18 sar + * Added error check to make sure that the lock option is installed + * if the continue_reentrant option is installed. + * + * Revision 5.9 1995/05/08 20:31:09 sar + * changed the args to nextproc_next_instance & getproc_got_object_id + * to make compilers happier. + * + * Revision 5.8 1995/05/06 01:39:54 sar + * We now include auxmth.h and some other method routine defs so that the + * mib compiler won't need to generate defs for routines included in auxi. + * + * Revision 5.7 1995/05/05 23:26:09 sar + * Set the vb_data_n_type flag for getproc_got_bitstring. + * + * Revision 5.6 1995/04/28 22:42:16 sar + * Added definitions for use with the serialization (gatekeeper) code. + * + * Revision 5.5 1995/03/20 23:11:33 sar + * Moved the vb specific information to vbdefs.h and included that file here. + * Added declarations for the routines & macros that are used in the + * new async scheme. This included adding several variables to the + * snmp_pkt structure and the std_pdu structure. + * Modified the party names to be "for" and "loc" instead of "src" and "dest". + * + * Revision 5.4 1994/10/12 20:12:36 sar + * made the trap_time_ticks a uint_32 instead of int_32 + * + * Revision 5.3 1994/09/29 18:31:12 sar + * Rearrange some items to deal with removing v2 types from v1 settings if + * they aren't installed. + * + * Revision 5.2 1994/07/29 18:08:12 sar + * Added MAX_V1_PDU for use in type checking v1 pdus. + * + * Revision 5.1 1994/07/28 23:29:12 sar + * Added a field in the SNMP_PKT_T structure for holding a pointer to + * the mib tree to use for this packet. + * + * Revision 5.0 1994/05/16 15:49:04 sar + * Updated revision to 5.0 and copyright to include 1994 + * + * Revision 4.7 1994/05/09 21:02:30 sar + * Added sub_agent option to #if clause in deciding to include sa_flags and + * vb_access. + * + * Revision 4.6 1994/05/06 20:29:54 sar + * Took out the ifdef v1 for community string as we know use if to hold + * the v2 localentity string. + * + * Revision 4.5 1994/05/04 23:47:31 sar + * made VBPRIVPROC's always take a PTR_T as argument (SA_freeproc for one). + * + * Revision 4.4 1994/05/04 22:43:48 sar + * modified the call_the_set_routine calling sequence. + * + * Revision 4.3 1994/05/02 21:19:26 sar + * Added a localtimeobj in snmp_pkt_t for use with sub agent type stuff. + * + * Revision 4.2 1994/04/29 20:00:21 sar + * Mostly sub agent stuff, added new fields to snmp_pkt structure + * added externs for several routines, modified the vbprivproc definition + * for use with the VB_FREE_COMPAT option. + * + * Revision 4.1 1993/10/06 19:47:11 sar + * added the TPROC_READ_ONLY and TPROC_TOO_BIG flags for use with error_response + * modified tproc_set_error to use vb_to_index + 1 to get the index's to + * be 1 based (what snmp uses) rather than 0 based (what envoy internals use). + * + * Revision 4.0 1993/06/24 16:05:41 sar + * Updated rev to 4.0 and coypright to 93 + * + * Revision 3.20 1993/06/07 18:31:09 sar + * Made SNMP_Decode_Packet a macro calling SNMP_Decode_Packet_WER + * which is newly defined. + * + * Revision 3.19 1993/06/02 23:05:55 dab + * Changed #ifdef's to #if's for things from install.h + * + * Revision 3.18 1993/05/31 17:45:26 sar + * fixed a typo con_notloal to con_notlocal + * + * Revision 3.17 1993/05/19 20:07:52 sar + * tiding up types to make compilers happy, (timestamps to UINT_32_T, + * sizes to ALENGTH_T). + * + * Revision 3.16 1993/05/14 15:13:29 sar + * renamed private field in packet structure to be user_private + * + * Revision 3.15 1993/05/03 17:14:17 sar + * Modified context local time to allow it to be set and got rid of party and + * context oids in the packet structure which leads to asn1len in the + * party and context structure. + * + * Revision 3.14 1993/04/30 22:58:26 sar + * Added mechanism for minimal proxies and coarse grained locks. + * + * Revision 3.13 1993/04/28 22:00:38 sar + * Moved the definition of UINT_64_T to ui64.h and update others + * + * Revision 3.12 1993/04/27 21:06:48 sar + * Removed index_to_vbp it is now in buildpkt.h + * used qualifier for the include names (envoy/h/...) + * + * Revision 3.11 1993/04/26 20:33:14 sar + * Added bitstrings, and have deletion of parties or contexts delete acls. + * + * Revision 3.10 1993/04/22 20:14:13 sar + * Updating of macros and defines to use new naming scheme and get the + * names to be more useful in general. (use INSTALL_ENVOY_SNMP_VERSION_1 + * for example). + * + * Revision 3.9 1993/04/21 15:31:44 dab + * removed define __() macro since everyone should get this from + * + * Revision 3.8 1993/04/17 01:03:30 sar + * changes for shadow area row creation and updating of some error codes. + * + * Revision 3.7 1993/03/25 21:15:21 sar + * Added types for uint 64 (counter64) and nsapaddress (translates to string) + * + * Revision 3.6 1993/02/26 22:36:17 sar + * Changed INCONISTENT_VALUE to INCONSISTENT_VALUE + * + * Revision 3.5 1993/02/26 20:27:30 sar + * added inconsistent name to the list of pdu errors. + * + * Revision 3.4 1993/02/26 17:29:49 sar + * added defines for MAX_PDU and ALL_CLASS to allow writing code that + * won't have to change if we add new pdu types. + * + * Revision 3.3 1993/02/24 00:59:50 sar + * Removed the name objid from the partyleaf and put a copy of it in the + * pkt. Also Updated many of the SNMP_(Party, Context, ACL)_* files + * to use a OIDC_T/length instead of a OBJ_ID_T so we don't have to + * allocate an OBJ_ID_T when we don't have one. + * + * Revision 3.2 1993/02/17 20:52:52 sar + * Added no_pp definition (#define _(x) x stuff) + * Added more tags (nsapaddress, counter64, uinteger32 and the exception + * tags nosuchobj, nosuchins, and endofmib). + * Added a VBL_S pointer to the VBL_S structure for get bulk chaining. + * Added new defines for new classes and errors + * Added SNMP_Encode_Auth_Msg - definition for encoding auth messages. + * Updated SNMP_PKT_S to contain version 2 options. + * + * Revision 3.1 92/07/31 11:55:02 dab + * Started changes for parties for Secure SNMP. + * + * Revision 3.0 92/04/03 19:52:27 dab + * Release 3.0 + * + * Revision 2.106 92/02/27 16:47:00 dab + * Added return code #define's for the TESTPROC. + * + * Revision 2.105 91/11/07 09:37:45 dab + * Changed the view mask to be 32 bits. + * + * Revision 2.104 91/11/05 17:32:12 dab + * Added VB_TO_INDEX() macro. + * + * Revision 2.103 91/10/30 20:45:46 dab + * Used to be snmp.h. Now the config file is snmp.h and all the + * SNMP definitions are here. + * + * Revision 2.102 91/09/12 13:50:51 dab + * Re-ordered so SNMP_STATS_T is defined after snmpconf.h is included + * so it gets the proper definition for SGRP. + * + * Revision 2.101 91/08/15 15:41:46 dab + * Pulled configuration from asn1.h and snmp.h and put in + * snmpconf.h and asn1conf.h. + * + * Revision 2.100 91/08/09 14:09:48 dab + * Update version. + * + * Revision 1.1 91/07/30 02:24:31 romkey + * Initial revision + * + * + * Rev 2.3 17 Jun 1990 10:39:42 + * Corrected erroneous definition of inc_gauge and dec_gauge macros. + * + * Rev 2.2 06 Jun 1990 5:32:40 + * Added definition of RFC1157. + * + * Rev 2.1 24 May 1990 16:40:52 + * Changed the authentication enable flag in snmp_stats from a long to a short. + * + * Rev 2.0 31 Mar 1990 15:11:24 + * Release 2.00 + * + * Rev 1.9 24 Apr 1989 18:42:00 + * Added definition of VERSION_RFC1098 as a synonym for VERSION_RFC1067. + * + * Rev 1.8 24 Mar 1989 17:25:30 + * Removed reference to the variable named "etc_copyright". The in-core + * copyright notice now comes in via module "snmp_d.c". + * + * Rev 1.7 17 Mar 1989 21:42:02 + * Calls to memcpy/memset protected against zero lengths + * + * Rev 1.6 11 Jan 1989 13:23:32 + * Added a reference to the copyright string to force it into memory. + * + * Rev 1.5 11 Jan 1989 12:46:44 + * Moved Clean_Obj_ID() to objectid.c + * + * Rev 1.4 19 Sep 1988 17:27:12 + * Made changes to make the Sun C compiler happy. + * + * Rev 1.3 17 Sep 1988 14:40:56 + * Corrected the SNMP version number -- the format in RFC1067 is poorly + * done!!!!!!! + * + * Rev 1.2 15 Sep 1988 20:04:22 + * Added macro to convert VBL offset into an error index. + * + * Rev 1.1 14 Sep 1988 19:23:30 + * Added definitions for the UDP port numbers assigned to SNMP. + * + * Rev 1.0 12 Sep 1988 10:46:22 + * Initial revision. +*/ + +/* [clearcase] +modification history +------------------- +01b,19apr05,job update copyright notices +01a,02jul04,job add getproc_got_octet_string() function +*/ + + +#if (!defined(snmpdefs_inc)) +#define snmpdefs_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1_inc)) +#include +#endif + +#if (!defined(buffer_inc)) +#include +#endif + +#if (!defined(mib_inc)) +#include +#endif + +#if (!defined(ui64_inc)) +#include +#endif + +#if (!defined(vb_inc)) +#include +#endif + +#if INSTALL_ENVOY_SNMP_VERSION_3 +#if (!defined(v3_auth_inc)) +#include +#endif + +#if (!defined(v3_priv_inc)) +#include +#endif +#endif /* #if INSTALL_ENVOY_SNMP_VERSION_3 */ + +#define SNMP_VERSION_MIN 0 /* Lower bound for SNMP version */ +#define VERSION_RFC1067 0 /* Classic SNMP */ +/* RFC1067, RFC1098, and RFC1157 are equivalent */ +#define VERSION_RFC1098 0 +#define VERSION_RFC1157 0 +#define SNMP_VERSION_1 0 /* now being tagged as version 1 */ +#define SNMP_VERSION_2 1 /* SNMPV2 */ +#define SNMP_VERSION_USEC 2 /* User Security option */ +#define SNMP_VERSION_3 3 /* SNMPv3 */ +#define SNMP_VERSION_MAX 0x7fffffff /* Upper bound for SNMP version */ + +/* Define the ports assigned to SNMP for the reception of various types */ +/* of packets. */ +#define SNMP_REQUEST_PORT 161 +#define SNMP_TRAP_PORT 162 + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +/* The following represents a source or destination address in + a generalized form (which happens to be isomorphic to the + familiar sockaddr structure found with the socket interface.) + It is the default Envoy will use for an address structure, + however it may be overridden by defining ENVOY_SNMPADDR_T. */ +struct SNMPADDR_S + { + unsigned short snmp_family; + unsigned char snmp_data[20]; + bits16_t snmp_port; + bits32_t snmp_scope_id; + }; + +#ifdef ENVOY_SNMPADDR_T +typedef ENVOY_SNMPADDR_T SNMPADDR_T; +#else +typedef struct SNMPADDR_S SNMPADDR_T; +#endif + + +/* We need to replace the community validation routine macro in such + a way that it can still be redefined if desired, yet it doesn't + interfere with people not using coexistence. */ +#if (INSTALL_ENVOY_SNMP_VERSION_3) && (INSTALL_ENVOY_SNMP_COEXISTENCE) +#ifndef SNMP_community_coexistence_lookup +extern int lookup_SNMP_community __((struct SNMP_PKT_S *, + SNMPADDR_T *, + SNMPADDR_T *)); + +#define SNMP_community_coexistence_lookup(p, s, d) \ +lookup_SNMP_community(p, s, d) +#endif +#else +#define SNMP_community_coexistence_lookup(p, s, d) \ +SNMP_validate_community(p, s, d) +#endif + +/* Typedefs for io and error completion routines */ +typedef void IO_COMPLETE_T __((SNMPADDR_T *for_addr, SNMPADDR_T *loc_addr, + ptr_t pktp, ALENGTH_T need, ptr_t cookie)); +typedef void ERR_COMPLETE_T __((SNMPADDR_T *for_addr, SNMPADDR_T *loc_addr, + int error_code, ptr_t cookie)); +typedef void RETRANS_CLEANUP_T __((ptr_t cookie)); + +/* The proxy routine really takes an argument of SNMP_PKT_T * + but we can't use it as we haven't defined it */ +typedef sbits32_t PROXY_ROUTINE_T __(( )); + +typedef void AUTH_ROUTINE_T __((OCTET_T *, UINT_16_T, OCTET_T *, + UINT_16_T, OCTET_T *)); + +/* Define the internal representation of an SNMP packet */ +typedef struct SNMP_PKT_S + { + sbits32_t snmp_version; + bits16_t lcl_ident; /* Local transaction identifer */ + + char * user_private; /* Anything one wants -- but */ + /* remember, if you attach */ + /* something here, you got to */ + /* free it in release_private!! */ + + ptr_t async_cookie; /* cookie for use with completions */ + IO_COMPLETE_T *io_complete; /* Routines to call when processing */ + ERR_COMPLETE_T *error_complete; /* is complete */ + void (*cont)(struct SNMP_PKT_S *); /* routine to call continue proc */ + + SNMPADDR_T pkt_src; /* Where this packet came from. */ + SNMPADDR_T pkt_dst; /* Where this packet came to. */ + + MIBNODE_T *mib_root; + + bits32_t mib_view; /* Set of mib views which this */ + /* request can see. Use 0xFFFFFFFF */ + /* to participate in all views. */ + +#if (INSTALL_ENVOY_SNMP_RFC1445_VIEWS) + bits16_t view_index; /* view index for use with rfc1445 */ +#endif + +#if (INSTALL_ENVOY_SNMP_RFC2275_VIEWS) + EBUFFER_T view_name; /* view name for use with rfc2275 */ +#endif + +#if (INSTALL_ENVOY_SNMP_DYNAMIC_VIEWS) + struct VIEWINDEX_S *view_family; /* pointer to view family to use */ +#endif + + EBUFFER_T community; /* used for the community string + or context name for v3 */ + + bits8_t flags; /* See below. */ + bits8_t phase; /* what phase we are running, should + be the same size as vb_flags */ + ALENGTH_T maxpkt; /* the maximum packet we can build */ + ALENGTH_T buffer_needed; /* Size of buffer needed */ + ALENGTH_T overall_length; /* Message Sequence length */ + ATVALUE_T pdu_type; + ALENGTH_T pdu_length; + union { + /* For GetRequest, GetNextRequest, */ + /* GetResponse, SetRequest, */ + /* GetBulkRequest, InformRequest, */ + /* and Trap2 PDUs. */ + + struct { + sbits32_t request_id; + sbits32_t error_status; + sbits32_t error_index; + VBL_T std_vbl; + VBL_T saved_vbl; + sbits32_t max_reps; + int non_reps; + } std_pdu; + +#if INSTALL_ENVOY_SNMP_VERSION_1 + /* For Trap PDU */ + struct { + OBJ_ID_T enterprise_objid; + unsigned char net_address[4]; + sbits32_t generic_trap; + sbits32_t specific_trap; + bits32_t trap_time_ticks; + VBL_T trap_vbl; + } trap_pdu; +#endif + } pdu; + + bits8_t lockflags; + bits8_t gate_decr; + +#if INSTALL_ENVOY_SNMP_VERSION_3 + sbits32_t msg_id; + sbits32_t msg_max_size; + bits8_t msg_flags; + sbits32_t msg_sec_model; + EBUFFER_T msg_con_id; + + EBUFFER_T msg_sec_id; + EBUFFER_T msg_sec_name; + sbits32_t msg_sec_boots; + sbits32_t msg_sec_time; + bits8_t msg_sec_auth[20]; + bits8_t msg_sec_priv[20]; + + ALENGTH_T scoped_pdu_length; + ALENGTH_T encrypted_pdu_length; + ALENGTH_T security_length; + ALENGTH_T security_length_2; + ALENGTH_T global_length; + + SNMP_AUTH_T *auth; + SNMP_PRIV_T *priv; +#endif + +#if INSTALL_ENVOY_SNMP_COEXISTENCE + EBUFFER_T comm_entry; +#endif + +#if INSTALL_ENVOY_SNMP_LOCK + ENVOY_LOCK_T *coarse_lock; +#endif + +#if INSTALL_ENVOY_AGENTX + struct ENVOY_AX_PKT_S *ax_pkt; + bits32_t ax_trans_id; +#endif + +#if INSTALL_ENVOY_CONTINUE_REENTRANT + ENVOY_LOCK_T continue_lock; +#endif + +#if INSTALL_ENVOY_USE_SNMP_PROXY + PROXY_ROUTINE_T *proxy_routine; +#endif + } SNMP_PKT_T; + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + + +/* Values for pdu_type (class and form bits are not included) */ +#define GET_REQUEST_PDU 0 +#define GET_NEXT_REQUEST_PDU 1 +#define GET_RESPONSE_PDU 2 +#define SET_REQUEST_PDU 3 +#define TRAP_PDU 4 +#define GET_BULK_REQUEST_PDU 5 +#define INFORM_REQUEST_PDU 6 +#define TRAP2_PDU 7 +#define REPORT_PDU 8 +#define MAX_V1_PDU 4 +#define MAX_PDU 8 +#define NO_PDU 0xFF + +/* values for pdu classes in mgt communication class, this is equal + to 2 to the value of the context tag for the pdu */ +#define GET_REQUEST_CLASS 1 +#define GET_NEXT_REQUEST_CLASS 2 +#define GET_RESPONSE_CLASS 4 +#define SET_REQUEST_CLASS 8 +#define TRAP_CLASS 16 +#define GET_BULK_REQUEST_CLASS 32 +#define INFORM_REQUEST_CLASS 64 +#define TRAP2_CLASS 128 +#define REPORT_CLASS 256 +#define ALL_CLASS 511 + +/* Values for error_status */ +#define NO_ERROR 0 +#define TOO_BIG 1 +#define NO_SUCH_NAME 2 +#define BAD_VALUE 3 +#define READ_ONLY 4 +#define GEN_ERR 5 +#define NO_ACCESS 6 +#define WRONG_TYPE 7 +#define WRONG_LENGTH 8 +#define WRONG_ENCODING 9 +#define WRONG_VALUE 10 +#define NO_CREATION 11 +#define INCONSISTENT_VALUE 12 +#define RESOURCE_UNAVAILABLE 13 +#define COMMIT_FAILED 14 +#define UNDO_FAILED 15 +#define AUTHORIZATION_ERROR 16 +#define NOT_WRITABLE 17 +#define INCONSISTENT_NAME 18 +#define LAST_ERROR 19 + +/* Values for generic_trap */ +#define COLD_START 0 +#define WARM_START 1 +#define LINK_DOWN 2 +#define LINK_UP 3 +#define AUTH_FAILURE 4 +#define EGP_NEIGHBOR_LOSS 5 +#define ENTERPRISE_SPECIFIC 6 + +/* For lock flags in the packet structre */ +#define LOCK_NOLOCK 0x00 +#define LOCK_READ 0x01 +#define LOCK_WRITE 0x02 + +/* Value for message flags in version 3 */ +#define ETC_V3_AUTH 0x01 +#define ETC_V3_PRIV 0x02 +#define ETC_V3_REPORT 0x04 + +#define ETC_SEC_LEVEL_NONE 0x01 +#define ETC_SEC_LEVEL_AUTH 0x02 +#define ETC_SEC_LEVEL_PRIV 0x03 + +/* values for security models */ +#define ETC_SEC_MODEL_ANY 0x00 +#define ETC_SEC_MODEL_V1 0x01 +#define ETC_SEC_MODEL_V2 0x02 +#define ETC_SEC_MODEL_USM 0x03 +#define ETC_SEC_MODEL_MAX 0x7fffffff + +/* values for msgid */ +#define ETC_MSGID_MIN 0x00 +#define ETC_MSGID_MAX 0x7fffffff + +/* values for mms */ +#define ETC_MMS_MIN 0x01e4 +#define ETC_MMS_MAX 0x7fffffff + +/* macros for getting values out of SNMP_PKT_T structure */ +#define SNMP_pkt_get_SNMP_version(PKTP) ((PKTP)->snmp_version) +#define SNMP_pkt_get_SNMP_community(PKTP) (&(PKTP)->community) + +/* macro to translate a vbp into an index, this is included for + backwards compatibility, the preferred method is to call + vbp_to_index directly */ +#define VB_TO_INDEX(pkt, vbp) vbp_to_index(pkt, vbp) +/* Macro to translate a vbp into an index, this is the + preferred method for customers to do this. Internally + Envoy should use the vbp_to_index_error() routine directly. */ +#define vbp_to_index(pkt, vbp) vbp_to_index_error(pkt, vbp, 0) + +/* various vb utility routines */ +extern int vbp_to_index_error __((SNMP_PKT_T *, VB_T *, int)); +extern VB_T * index_to_vbp __((SNMP_PKT_T *, int)); +extern VB_T * vblp_index_to_vbp __((VBL_T *, int)); + +/* Return values from TEST routine */ +#define TPROC_GOOD 0 +#define TPROC_NOSUCH -1 +#define TPROC_GENERR -2 +#define TPROC_BADVALUE -3 +#define TPROC_READ_ONLY -4 +#define TPROC_TOO_BIG -5 + +#define TPROC_NO_ACCESS -NO_ACCESS +#define TPROC_WRONG_TYPE -WRONG_TYPE +#define TPROC_WRONG_LENGTH -WRONG_LENGTH +#define TPROC_WRONG_ENCODING -WRONG_ENCODING +#define TPROC_WRONG_VALUE -WRONG_VALUE +#define TPROC_NO_CREATION -NO_CREATION +#define TPROC_INCONSISTENT_VALUE -INCONSISTENT_VALUE +#define TPROC_RESOURCE_UNAVAILABLE -RESOURCE_UNAVAILABLE +#define TPROC_COMMIT_FAILED -COMMIT_FAILED +#define TPROC_UNDO_FAILED -UNDO_FAILED +#define TPROC_AUTHORIZATION_ERROR -AUTHORIZATION_ERROR +#define TPROC_NOT_WRITABLE -NOT_WRITABLE +#define TPROC_INCONSISTENT_NAME -INCONSISTENT_NAME +#define TPROC_LAST_ERROR -LAST_ERROR + +#define TPROC_BADVALUE_INDEX(I) (I + 1) +#define TPROC_SET_ERROR(P, V, E) ((P)->pdu.std_pdu.error_index = \ + (vbp_to_index_error(P, V, 1)),\ + (P)->pdu.std_pdu.error_status = (sbits32_t)(E),\ + TPROC_LAST_ERROR) +#define SNMP_ERROR_INDEX(I) (I + 1) + +/* Defines for the security violations in the decode and auth code */ +/* Decode first */ +#define SNMP_DEC_VIO_UNKNOWN_DST 1 +#define SNMP_DEC_VIO_DST_NOTLOCAL 2 +#define SNMP_DEC_VIO_UNKNOWN_SRC 3 +#define SNMP_DEC_VIO_FAILED_VFY 4 +#define SNMP_DEC_VIO_UNKNOWN_CON 5 +#define SNMP_DEC_VIO_CON_NOTLOCAL 6 +#define SNMP_DEC_VIO_BAD_OPR1 7 +#define SNMP_DEC_VIO_BAD_OPR2 8 +#define SNMP_DEC_VIO_MAX 8 + +/* auth next */ +#define SNMP_AUTH_VIO_LIFETIME 1 +#define SNMP_AUTH_VIO_FAILED_VFY 2 + +/* Macros to manipulate Integers, Counters, and Gauges. */ +/* These assume that these are held as longs. */ +/* Integers are signed, counters and gauges are not. */ +#define inc_integer(I) ((I)++) +#define dec_integer(I) ((I)--) +#define add_integer(I,V) ((I) += (V)) +#define sub_integer(I,V) ((I) -= (V)) + +/* Counter's can't be decremented */ +#define inc_counter(C) (C++) +#define add_counter(C,V) (C += (V)) + +/* Gauges latch at the maximum value */ +#define GGMAX ((bits32_t)0xFFFFFFFF) +#define inc_gauge(G) ((bits32_t)(G) != GGMAX ? G++ : G) +#define dec_gauge(G) ((bits32_t)(G) != GGMAX ? G-- : G) +#define add_gauge(G,V) (G = \ + (bits32_t)(V) > (GGMAX - (bits32_t)(G)) ? \ + GGMAX : \ + (bits32_t)(G) + (bits32_t)(V)) +#define sub_gauge(G,V) (G -= ((bits32_t)(G) != GGMAX ? (bits32_t)(V) : 0)) + +/* error codes for certain decode routines, other return codes are + in use by some of the routines so take care when adding to this + list. (positive numbers are used by one routine) */ +#define DECODE_ASN_PARSE_ERROR -1 +#define DECODE_ALLOCATION_FAILURE -2 +#define DECODE_UNKNOWN_PDU_HANDLERS -3 +#define DECODE_UNKNOWN_CONTEXTS -4 + + +/* a definition of error returns, for more informative and useful + functions. */ + +enum envoy_err_e { + ENVOY_ERR_INSUFFICIENT_MEMORY = -1, + ENVOY_ERR_NOERR = 0, + ENVOY_ERR_BAD_INSTANCE, + ENVOY_ERR_EXISTS, + ENVOY_ERR_LOCK_FAILED, + ENVOY_ERR_NO_TARGET, + ENVOY_ERR_UNKNOWN, + ENVOY_ERR_NO_FORWARD, + ENVOY_ERR_TOO_BIG, + ENVOY_ERR_last_error + }; +typedef enum envoy_err_e envoy_err_t; + +/* new abstract data types for use with MIB-based structures. + currently, they're just wrappers, but this could change. */ + +typedef bits16_t ETC_STORAGE_T; +typedef bits16_t ETC_STATUS_T; + +#define SNMP_Decode_Packet(buf, len, saddr, daddr) \ + SNMP_Decode_Packet_WER(buf, len, saddr, daddr, 0) + +extern void envoy_init __((void)); + +extern void SNMP_Continue_function __((SNMP_PKT_T *pktp)); + +extern void process_packet_two __((PTR_T dptr)); + +extern int Process_Received_SNMP_Packet __((unsigned char *, int, + SNMPADDR_T *, SNMPADDR_T *, + EBUFFER_T *)); +extern void Process_Rcvd_SNMP_Packet_Async __((size_t, bits8_t *, + SNMPADDR_T *, SNMPADDR_T *, + ALENGTH_T, IO_COMPLETE_T *, + ERR_COMPLETE_T *, ptr_t)); +#define SNMP_Continue(PKTP) ((PKTP)->cont(PKTP)) + +extern void Process_Internal_SNMP_Packet __((SNMP_PKT_T *)); + +struct LCL_FILE_S; +extern int SNMP_Decode_PDU __((SNMP_PKT_T *, struct LCL_FILE_S *)); + +extern SNMP_PKT_T * SNMP_Decode_Packet_WER __((unsigned char *, int, + SNMPADDR_T *, SNMPADDR_T *, + int *)); +extern SNMP_PKT_T * SNMP_Allocate __((void)); +extern void SNMP_Free __((SNMP_PKT_T *)); +extern void Initialize_Pkt __((SNMP_PKT_T *)); + +extern bits32_t set_pdu_size __((SNMP_PKT_T *)); +extern void encode_snmp_normal_pdu __((SNMP_PKT_T *, + EBUFFER_T *)); +extern ALENGTH_T SNMP_Bufsize_For_Packet __((SNMP_PKT_T *)); +extern int SNMP_Encode_Pkt_With_Siz __((SNMP_PKT_T *, + EBUFFER_T *, + ALENGTH_T)); +extern int SNMP_Encode_Packet __((SNMP_PKT_T *, EBUFFER_T *)); +extern int SNMP_Encode_Auth_Msg __((SNMP_PKT_T *, EBUFFER_T *)); + +extern SNMP_PKT_T * _snmp_create_request(int); +extern void branch_free(MIBNODE_T *, MIBNODE_T *); +extern int _snmp_leaf_check(SNMP_PKT_T *, VB_T *, MIBLEAF_T *, + OBJ_ID_T *, int rcount, int); + +#if (INSTALL_ENVOY_SNMP_VERSION_3) +extern ALENGTH_T bufsize_for_v3_pkt __((SNMP_PKT_T *)); +extern void encode_snmp_scoped_pdu __((SNMP_PKT_T *, + EBUFFER_T *)); +extern int encode_snmp_v3 __((SNMP_PKT_T *, + EBUFFER_T *)); +extern SNMP_PKT_T * Send_Report_PDU __((SNMP_PKT_T *, struct LCL_FILE_S *, + bits8_t, OIDC_T *, int, + bits32_t, int *, + SNMPADDR_T *, SNMPADDR_T *)); +struct SNMP_USER_S; +extern int decode_scoped_pdu __((SNMP_PKT_T *, + struct LCL_FILE_S *, + SNMPADDR_T *, SNMPADDR_T *, + ALENGTH_T, + struct SNMP_USER_S *)); + +extern SNMP_PKT_T * SNMP_Decode_V3_Packet __((SNMP_PKT_T *, + struct LCL_FILE_S *, + SNMPADDR_T *, SNMPADDR_T *, + ALENGTH_T, int *)); + +#if (INSTALL_ENVOY_SNMP_V3_TARGET) +extern int envoy_add_engine_address __((SNMP_PKT_T *, + SNMPADDR_T *, int)); +#endif /* INSTALL_ENVOY_SNMP_V3_TARGET */ +#endif /* INSTALL_ENVOY_SNMP_VERSION_3 */ + +extern void SNMP_Proxy_Request __((SNMP_PKT_T *)); +extern int SNMP_Proxy_Response __((SNMP_PKT_T *)); +extern void SNMP_Proxy_Traps_And_Reports __((SNMP_PKT_T *)); + +extern int SNMP_Process_Get_PDU __((SNMP_PKT_T *)); + +extern int SNMP_Process_Test_PDU __((SNMP_PKT_T *)); +extern int SNMP_Process_Set_PDU __((SNMP_PKT_T *)); + +extern int SNMP_Process_Next_PDU __((SNMP_PKT_T *)); +extern int SNMP_Process_Next_Redo __((SNMP_PKT_T *)); +extern int SNMP_Process_Bulk_Redo __((SNMP_PKT_T *)); + +extern int SNMP_Process_Finish __((SNMP_PKT_T *, EBUFFER_T *, + ALENGTH_T)); + +extern void ENVOY_Send_SNMP_Packet __((SNMP_PKT_T *)); +extern void ENVOY_Send_SNMP_Error_Packet __((SNMP_PKT_T *, + sbits32_t, + sbits32_t)); + +extern int scan_vb_for_locator __((SNMP_PKT_T *, int, bits16_t)); +extern int oidcmp __((int, OIDC_T *, int, OIDC_T *)); +extern int find_object_node __((VB_T *, SNMP_PKT_T *, int)); +extern int find_next_object __((VB_T *, OBJ_ID_T *, + SNMP_PKT_T *, int)); + +#if (INSTALL_COMMON_DYNAMIC_COMP_CONFIG) +extern void v3_dyncfg_init(void); +extern void envoy_dyncfg_init(void); +#endif + +#if (INSTALL_ENVOY_SNMP_LOCK) +/* definitions for use with the locking functions */ +#define SNMP_READ_LOCK LOCK_READ +#define SNMP_WRITE_LOCK LOCK_WRITE + +/* function prototypes for locking functions */ +extern envoy_err_t SNMP_Get_System_Lock __((bits8_t which)); +extern void SNMP_Release_System_Lock __((bits8_t which)); +#endif /* #if (INSTALL_ENVOY_SNMP_LOCK) */ + +#if INSTALL_ENVOY_SNMP_UTIL_MACROS +#define getproc_started(P, V) ((V)->vb_flags |= VFLAG_GET_STARTED) +#define getproc_good(P, V) ((V)->vb_flags |= VFLAG_GET_DONE) +#define getproc_error(P, V, E) ((P)->pdu.std_pdu.error_status = E, \ + (P)->pdu.std_pdu.error_index = \ + (vbp_to_index_error(P, V, 1)),\ + (V)->vb_flags |= VFLAG_GET_DONE) + +#define nextproc_started(P, V) ((V)->vb_flags |= VFLAG_NEXT_STARTED) +#define nextproc_good(P, V) ((V)->vb_flags |= VFLAG_NEXT_DONE) +#define nextproc_no_next(P, V) ((V)->vb_flags |= VFLAG_NEXT_DONE | \ + VFLAG_NEXT_REDO) +#define nextproc_error(P, V, E) ((P)->pdu.std_pdu.error_status = E, \ + (P)->pdu.std_pdu.error_index = \ + (vbp_to_index_error(P, V, 1)),\ + (V)->vb_flags |= VFLAG_NEXT_DONE) + +#define getproc_got_int32(P, V, D) ((V)->vb_data_flags_n_type = VT_NUMBER, \ + (V)->value_u.v_number = D, \ + (V)->vb_flags |= VFLAG_GET_DONE) +#define getproc_got_uint32(P, V, D, T) ((V)->vb_data_flags_n_type = T,\ + (V)->value_u.v_counter = D, \ + (V)->vb_flags |= VFLAG_GET_DONE) +#define getproc_got_uint64(P, V, D) \ + ((V)->vb_data_flags_n_type = VT_COUNTER64, \ + (V)->value_u.v_counter64.high = (D)->high, \ + (V)->value_u.v_counter64.low = (D)->low, \ + (V)->vb_flags |= VFLAG_GET_DONE) +#define getproc_got_uint64_high_low(P, V, H, L) \ + ((V)->vb_data_flags_n_type = VT_COUNTER64, \ + (V)->value_u.v_counter64.high = H, \ + (V)->value_u.v_counter64.low = L, \ + (V)->vb_flags |= VFLAG_GET_DONE) +#define getproc_got_ip_address(P, V, D) \ + ((V)->vb_data_flags_n_type = VT_IPADDRESS, \ + MEMCPY(&((V)->value_u.v_network_address), \ + &(D), 4), \ + (V)->vb_flags |= VFLAG_GET_DONE) +#define getproc_got_empty(P, V) ((V)->vb_data_flags_n_type = VT_EMPTY, \ + (V)->vb_flags |= VFLAG_GET_DONE) +#define getproc_got_string(P, V, S, D, F, T) \ + ((V)->vb_data_flags_n_type = T, \ + (V)->vb_flags |= VFLAG_GET_DONE, \ + EBufferPreLoad((F) ? BFL_IS_DYNAMIC : BFL_IS_STATIC,\ + &((V)->value_u.v_string), D, S)) +#define getproc_got_octet_string(P, V, S, D, T) \ + ((V)->vb_data_flags_n_type = T, \ + (V)->vb_flags |= VFLAG_GET_DONE, \ + EBufferPreLoad(BFL_IS_ALLOC,\ + &((V)->value_u.v_string), D, S)) +#define testproc_started(P, V) ((V)->vb_flags |= VFLAG_TEST_STARTED) +#define testproc_good(P, V) ((V)->vb_flags |= VFLAG_TEST_DONE) +#define setproc_started(P, V) ((V)->vb_flags |= VFLAG_SET_STARTED) +#define setproc_good(P, V) ((V)->vb_flags |= VFLAG_SET_DONE) +#define setproc_error(P, V, E) ((P)->pdu.std_pdu.error_status = E, \ + (P)->pdu.std_pdu.error_index = \ + (vbp_to_index_error(P, V, 1)),\ + (V)->vb_flags |= VFLAG_SET_DONE) +#define undoproc_started(P, V) ((V)->vb_flags |= VFLAG_UNDO_STARTED) +#define undoproc_good(P, V) ((V)->vb_flags |= VFLAG_UNDO_DONE) +#define undoproc_error(P, V, E) ((P)->pdu.std_pdu.error_status = E, \ + (P)->pdu.std_pdu.error_index = \ + (vbp_to_index_error(P, V, 1)),\ + (V)->vb_flags |= VFLAG_UNDO_DONE) +#else /* INSTALL_ENVOY_SNMP_UTIL_MACROS */ +void getproc_started __((SNMP_PKT_T *, VB_T *)); +void getproc_good __((SNMP_PKT_T *, VB_T *)); +void getproc_error __((SNMP_PKT_T *, VB_T *, INT_32_T)); +void nextproc_started __((SNMP_PKT_T *, VB_T *)); +void nextproc_good __((SNMP_PKT_T *, VB_T *)); +void nextproc_no_next __((SNMP_PKT_T *, VB_T *)); +void nextproc_error __((SNMP_PKT_T *, VB_T *, INT_32_T)); +void testproc_started __((SNMP_PKT_T *, VB_T *)); +void testproc_good __((SNMP_PKT_T *, VB_T *)); +void setproc_started __((SNMP_PKT_T *, VB_T *)); +void setproc_good __((SNMP_PKT_T *, VB_T *)); +void setproc_error __((SNMP_PKT_T *, VB_T *, INT_32_T)); +void undoproc_started __((SNMP_PKT_T *, VB_T *)); +void undoproc_good __((SNMP_PKT_T *, VB_T *)); +void undoproc_error __((SNMP_PKT_T *, VB_T *, INT_32_T)); + +void getproc_got_int32 __((SNMP_PKT_T *, VB_T *, INT_32_T)); +void getproc_got_uint32 __((SNMP_PKT_T *, VB_T *, UINT_32_T, OCTET_T)); +void getproc_got_ip_address __((SNMP_PKT_T *, VB_T *, UINT_32_T)); +void getproc_got_empty __((SNMP_PKT_T *, VB_T *)); +void getproc_got_string __((SNMP_PKT_T *, VB_T *, ALENGTH_T, + OCTET_T *, int, OCTET_T)); +void getproc_got_octet_string __((SNMP_PKT_T *, VB_T *, ALENGTH_T, + OCTET_T *, OCTET_T)); +void getproc_got_uint64 __((SNMP_PKT_T *, VB_T *, UINT_64_T *)); +void getproc_got_uint64_high_low __((SNMP_PKT_T *, VB_T *, UINT_32_T, + UINT_32_T)); + +#endif /* INSTALL_ENVOY_SNMP_UTIL_MACROS */ + +#define getproc_got_ipaddr(P, V, D) \ + ((V)->vb_data_flags_n_type = VT_IPADDRESS, \ + MEMCPY(&((V)->value_u.v_network_address), \ + PTR_IPADDR_BITS(D), 4), \ + (V)->vb_flags |= VFLAG_GET_DONE) +#define setproc_all_bits(P, V) ((V)->vb_flags |= VFLAG_TEST_STARTED | \ + VFLAG_TEST_DONE | \ + VFLAG_SET_STARTED | \ + VFLAG_SET_DONE | \ + VFLAG_UNDO_STARTED | \ + VFLAG_UNDO_DONE) +#define undoproc_set(P, V, R) ((V)->undoproc = (UNDOPROC_T *)(R)) +extern void getproc_nosuchins __((SNMP_PKT_T *, VB_T *)); +extern void getproc_got_object_id __((SNMP_PKT_T *, VB_T *, int, + OIDC_T *, int)); +extern void nextproc_next_instance __((SNMP_PKT_T *, VB_T *, int, + OIDC_T *)); +extern void nextproc_next_instance_string __((SNMP_PKT_T *, VB_T *, + ALENGTH_T, bits8_t *, int)); +extern void testproc_tproc_error __((SNMP_PKT_T *, VB_T *, int)); +extern void testproc_error __((SNMP_PKT_T *, VB_T *, sbits32_t)); + + +#if (INSTALL_ENVOY_SNMP_SERIALIZE) +typedef void GATE_CONTINUE_T __((ptr_t)); + +extern int GateKeeper_Test __((void)); +extern int GateKeeper_Add __((sbits16_t, ptr_t, GATE_CONTINUE_T *)); +extern void GateRunDeferreds __((void)); +extern void GateDecrement __((SNMP_PKT_T *)); + +#define GATE_SNMP 1 +#define GATE_SUBAGENT 2 + +#endif + +#if (!defined(auxmth_inc)) +#include +#endif + +extern int std_next __((OIDC_T lastmastch, + int tcount, + OIDC_T *tlist, + OIDC_T *rlist, + char *cookie, + SNMP_PKT_T *pktp)); + +extern void std_next_async __((OIDC_T lastmastch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); + +/* We define the following functions for use with the compatibility routines */ +extern void async_compat_test __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); + +extern void async_compat_get __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); + +extern void async_compat_set __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); + +extern void async_compat_next __((OIDC_T lastmatch, + int tcount, + OIDC_T *tlist, + SNMP_PKT_T *pktp, + VB_T *vbp)); + +extern void async_compat_error __((SNMPADDR_T *for_addr, + SNMPADDR_T *loc_addr, + int ecode, + PTR_T cookie)); + +extern void async_compat_io __((SNMPADDR_T *for_addr, + SNMPADDR_T *loc_addr, + PTR_T pktp, + ALENGTH_T need, + PTR_T cookie)); + +#ifdef __cplusplus +} +#endif + +#endif /* snmpdefs_inc */ diff --git a/h/wrn/wm/snmp/engine/snmpstat.h b/h/wrn/wm/snmp/engine/snmpstat.h new file mode 100644 index 0000000..fe4b893 --- /dev/null +++ b/h/wrn/wm/snmp/engine/snmpstat.h @@ -0,0 +1,245 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/snmpstat.h,v 1.2 2001/11/06 21:35:04 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1991-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: snmpstat.h,v $ + * Revision 1.2 2001/11/06 21:35:04 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:23 tneale + * Tornado shuffle + * + * Revision 9.5 2001/01/19 22:22:10 paul + * Update copyright. + * + * Revision 9.4 2000/03/17 19:48:41 meister + * Update copyright notice + * + * Revision 9.3 2000/03/09 20:58:34 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.2 2000/03/09 16:58:33 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.1 1999/04/09 20:37:02 josh + * Obsoleting ENVOY_SNMP_VERSON_USEC and ENVOY_40_VB_FREE_COMPAT + * + * Revision 9.0 1998/10/16 22:10:20 sar + * Update version stamp to match release + * + * Revision 8.3 1998/06/08 19:42:11 sar + * Create a define to tell us if we need the stats group in general + * + * Revision 8.2 1998/05/23 20:06:17 sar + * Added some stats variables for SNMPv3 + * + * Revision 8.1 1998/02/25 04:50:48 sra + * Update copyrights. + * + * Revision 8.0 1997/11/18 00:56:28 sar + * Updated revision to 8.0 + * + * Revision 7.2 1997/03/20 06:48:19 sra + * DFARS-safe copyright text. Zap! + * + * Revision 7.1 1997/02/25 10:49:26 sra + * Update copyright notice, dust under the bed. + * + * Revision 7.0 1996/03/18 20:17:33 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 6.3 1996/01/10 16:23:25 sar + * USEC updates + * + * Revision 6.2 1995/11/14 22:42:26 sar + * renamed proxydrops & silentdrops to match the mib definitions. + * + * Revision 6.1 1995/10/20 22:53:35 sar + * moved some stats into and out of the ifdef blocks + * removed the v2 classic stats + * added some v2 community stats + * + * Revision 6.0 1995/05/31 21:46:53 sra + * Release 6.0. + * + * Revision 5.1 1995/03/20 23:11:33 sar + * Moved the deinition of the statistics macros here so there is one + * central point for them. + * + * Revision 5.0 1994/05/16 15:49:04 sar + * Updated revision to 5.0 and copyright to include 1994 + * + * Revision 4.0 1993/06/24 16:05:41 sar + * Updated rev to 4.0 and coypright to 93 + * + * Revision 3.5 1993/06/02 23:05:55 dab + * Changed #ifdef's to #if's for things from install.h + * + * Revision 3.4 1993/05/03 17:54:14 sar + * Modified #include to be #include where it was correct. + * + * Revision 3.3 1993/04/22 20:14:13 sar + * Updating of macros and defines to use new naming scheme and get the + * names to be more useful in general. (use INSTALL_ENVOY_SNMP_VERSION_1 + * for example). + * + * Revision 3.2 1993/02/18 20:43:26 sar + * Added DestPartyMismatches and UnknownContexts to the v2 snmpstat group. + * + * Revision 3.1 1993/02/17 20:55:10 sar + * Updated stats to deal with v1 and v2 options. + * + * Revision 3.0 92/04/03 19:52:27 dab + * Release 3.0 + * + * Revision 1.1 91/10/30 20:45:25 dab + * Initial revision + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(snmpstat_inc)) +#define snmpstat_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1conf_inc)) +#include +#endif + +#if (!defined(snmpdefs_inc)) +#include +#endif + +#if (!defined(snmp_inc)) +#include +#endif + +#if (ENVOY_NEED_STATS) + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +typedef struct SNMP_STATS_S + { + unsigned long snmpInPkts; + unsigned long snmpInBadVersions; + unsigned long snmpInBadCommunityNames; + unsigned long snmpInBadCommunityUses; + unsigned long snmpInASNParseErrs; + unsigned short snmpEnableAuthTraps; +#if INSTALL_ENVOY_SNMP_GROUP_V1 + unsigned long snmpOutPkts; + unsigned long snmpInBadTypes; + unsigned long snmpInTooBigs; + unsigned long snmpInNoSuchNames; + unsigned long snmpInBadValues; + unsigned long snmpInReadOnlys; + unsigned long snmpInGenErrs; + unsigned long snmpInTotalReqVars; + unsigned long snmpInTotalSetVars; + unsigned long snmpInGetRequests; + unsigned long snmpInGetNexts; + unsigned long snmpInSetRequests; + unsigned long snmpInGetResponses; + unsigned long snmpInTraps; + unsigned long snmpOutTooBigs; + unsigned long snmpOutNoSuchNames; + unsigned long snmpOutBadValues; + unsigned long snmpOutReadOnlys; + unsigned long snmpOutGenErrs; + unsigned long snmpOutGetRequests; + unsigned long snmpOutGetNexts; + unsigned long snmpOutSetRequests; + unsigned long snmpOutGetResponses; + unsigned long snmpOutTraps; +#endif /* INSTALL_ENVOY_SNMP_GROUP_V1 */ +#if INSTALL_ENVOY_SNMP_GROUP_V2 + unsigned long snmpSilentDrops; + unsigned long snmpProxyDrops; +#endif /* INSTALL_ENVOY_SNMP_GROUP_V2 */ +#if INSTALL_ENVOY_SNMP_VERSION_3 + unsigned long snmpUnknownSecurityModels; + unsigned long snmpInvalidMsgs; + unsigned long snmpUnknownPDUHandlers; + unsigned long snmpUnavailableContexts; + unsigned long snmpUnknownContexts; + unsigned long usmStatsUnsupportedSecLevels; + unsigned long usmStatsNotInTimeWindows; + unsigned long usmStatsUnknownUserNames; + unsigned long usmStatsUnknownEngineIDs; + unsigned long usmStatsWrongDigests; + unsigned long usmStatsDecryptionErrors; +#endif /* INSTALL_ENVOY_SNMP_VERSION_3 */ + } SNMP_STATS_T; + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + + +extern SNMP_STATS_T snmp_stats; + +#endif /* ENVOY_NEED_STATS */ + + +/* Some macros to make the mainline code a little cleaner to read */ +#if (INSTALL_ENVOY_SNMP_GROUP_V1) +#define SGRPv1_INC_COUNTER(x) inc_counter(x) +#define SGRPv1_ADD_COUNTER(x, y) add_counter(x, y) +#else +#define SGRPv1_INC_COUNTER(x) +#define SGRPv1_ADD_COUNTER(x, y) +#endif + +#if (INSTALL_ENVOY_SNMP_GROUP_V2) +#define SGRPv2_INC_COUNTER(x) inc_counter(x) +#else +#define SGRPv2_INC_COUNTER(x) +#endif + +#if (INSTALL_ENVOY_SNMP_GROUP_V1 || INSTALL_ENVOY_SNMP_GROUP_V2) +#define SGRPv1v2_INC_COUNTER(x) inc_counter(x) +#else +#define SGRPv1v2_INC_COUNTER(x) +#endif + +#if (INSTALL_ENVOY_SNMP_VERSION_3) +#define SGRPv3_INC_COUNTER(x) inc_counter(x) +#else +#define SGRPv3_INC_COUNTER(x) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* snmpstat_inc */ + diff --git a/h/wrn/wm/snmp/engine/tree.h b/h/wrn/wm/snmp/engine/tree.h new file mode 100644 index 0000000..6529cd9 --- /dev/null +++ b/h/wrn/wm/snmp/engine/tree.h @@ -0,0 +1,165 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/tree.h,v 1.2 2001/11/06 21:35:04 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: tree.h,v $ + * Revision 1.2 2001/11/06 21:35:04 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:23 tneale + * Tornado shuffle + * + * Revision 9.4 2001/01/19 22:22:10 paul + * Update copyright. + * + * Revision 9.3 2000/03/17 19:48:42 meister + * Update copyright notice + * + * Revision 9.2 2000/03/09 20:58:35 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.1 2000/03/09 16:59:00 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.0 1998/10/16 22:10:21 sar + * Update version stamp to match release + * + * Revision 8.1 1998/02/25 04:50:51 sra + * Update copyrights. + * + * Revision 8.0 1997/11/18 00:56:31 sar + * Updated revision to 8.0 + * + * Revision 7.2 1997/03/20 06:48:21 sra + * DFARS-safe copyright text. Zap! + * + * Revision 7.1 1997/02/25 10:49:26 sra + * Update copyright notice, dust under the bed. + * + * Revision 7.0 1996/03/18 20:17:33 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 6.0 1995/05/31 21:46:55 sra + * Release 6.0. + * + * Revision 5.1 1994/09/29 18:31:12 sar + * Minor cleanup, adding other include files. + * + * Revision 5.0 1994/05/16 15:49:04 sar + * Updated revision to 5.0 and copyright to include 1994 + * + * Revision 4.1 1994/05/10 20:17:19 sar + * Removed the #if that restricted it for use with v2 only + * + * Revision 4.0 1993/06/24 16:05:41 sar + * Updated rev to 4.0 and coypright to 93 + * + * Revision 1.8 1993/06/02 23:05:55 dab + * Changed #ifdef's to #if's for things from install.h + * + * Revision 1.7 1993/05/03 17:54:14 sar + * Modified #include to be #include where it was correct. + * + * Revision 1.6 1993/04/30 22:58:26 sar + * Added mechanism for minimal proxies and coarse grained locks. + * + * Revision 1.5 1993/04/22 20:14:13 sar + * Updating of macros and defines to use new naming scheme and get the + * names to be more useful in general. (use INSTALL_ENVOY_SNMP_VERSION_1 + * for example). + * + * Revision 1.4 1993/04/17 00:58:50 sar + * changed def of TREE_Add to allow the user to determine what node the leaf + * was attatched to. + * + * Revision 1.3 1993/03/05 03:56:25 dab + * fixed up types + * + * Revision 1.2 1993/02/24 00:59:50 sar + * Removed the name objid from the partyleaf and put a copy of it in the + * pkt. Also Updated many of the SNMP_(Party, Context, ACL)_* files + * to use a OIDC_T/length instead of a OBJ_ID_T so we don't have to + * allocate an OBJ_ID_T when we don't have one. + * + * Revision 1.1 1993/02/17 20:55:28 sar + * Initial revision + * + * Revision 3.0 92/09/09 sar +*/ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#include + +#if (!defined(tree_inc)) +#define tree_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +/* Define a generic tree structure */ +typedef struct TREENODE_S + { + INT_32_T status; /* flag and status word */ + OIDC_T name; /* subid for this level */ + struct TREENODE_S * parent; /* ptr to one level up */ + struct TREENODE_S * sibling; /* ptr to this level */ + PTR_T child; /* ptr to one level down */ + /* or to the data block */ + } TREENODE_T; + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + +#define TREESTATIC 0x1 /* Node may not be deleted, ptrs may change */ +#define TREETWIN 0x2 /* Next node contains a leaf pointer */ +#define TREECHILD 0x4 /* Node contains a child pointer */ +#define TREELEAF 0x8 /* Node contains a leaf pointer */ + +extern int TREE_Add __((TREENODE_T **root, OIDC_T *oidc, + int oidclen, PTR_T leaf, + TREENODE_T **retnode)); +extern int TREE_Delete __((TREENODE_T **root, TREENODE_T *node)); +extern TREENODE_T *TREE_Get __((TREENODE_T *root, OIDC_T *oidc, + int oidclen, int *length)); +extern TREENODE_T *TREE_GetPrev __((TREENODE_T *root, OIDC_T *oidc, + int oidclen)); +extern TREENODE_T *TREE_GetNext __((TREENODE_T *root, TREENODE_T *node)); +extern int TREE_Extract __((TREENODE_T *node, PTR_T *leaf)); +extern int TREE_Install __((TREENODE_T *node, PTR_T leaf)); +extern int TREE_Name __((TREENODE_T *node, OIDC_T *oidc, int len)); + +#ifdef __cplusplus +} +#endif + +#endif /* tree_inc */ diff --git a/h/wrn/wm/snmp/engine/ui64.h b/h/wrn/wm/snmp/engine/ui64.h new file mode 100644 index 0000000..576c49d --- /dev/null +++ b/h/wrn/wm/snmp/engine/ui64.h @@ -0,0 +1,318 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/ui64.h,v 1.2 2001/11/06 21:35:05 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: ui64.h,v $ + * Revision 1.2 2001/11/06 21:35:05 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:23 tneale + * Tornado shuffle + * + * Revision 9.4 2001/01/19 22:22:10 paul + * Update copyright. + * + * Revision 9.3 2000/03/17 19:48:42 meister + * Update copyright notice + * + * Revision 9.2 2000/03/09 20:58:35 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.1 2000/03/09 16:59:11 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.0 1998/10/16 22:10:21 sar + * Update version stamp to match release + * + * Revision 8.1 1998/02/25 04:50:52 sra + * Update copyrights. + * + * Revision 8.0 1997/11/18 00:56:32 sar + * Updated revision to 8.0 + * + * Revision 7.3 1997/10/26 01:44:43 sar + * Always define the 64 bit counter and include it in the vb defintion + * instead of forgetting about it if we don't have v2 or v2 types installed. + * + * Revision 7.2 1997/03/20 06:48:23 sra + * DFARS-safe copyright text. Zap! + * + * Revision 7.1 1997/02/25 10:49:26 sra + * Update copyright notice, dust under the bed. + * + * Revision 7.0 1996/03/18 20:17:33 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 6.0 1995/05/31 21:46:56 sra + * Release 6.0. + * + * Revision 5.2 1994/11/29 21:58:53 sar + * Added a missing : to UI64_Compare. + * + * Revision 5.1 1994/09/29 18:31:12 sar + * Rearrange some items to deal with removing v2 types from v1 settings if + * they aren't installed. + * + * Revision 5.0 1994/05/16 15:49:04 sar + * Updated revision to 5.0 and copyright to include 1994 + * + * Revision 4.0 1993/06/24 16:05:41 sar + * Updated rev to 4.0 and coypright to 93 + * + * Revision 1.4 1993/06/17 23:30:45 sar + * remvoed the ENVOY_ from UI64 routines and macros. + * + * Revision 1.3 1993/06/07 18:31:09 sar + * Added a set macro to set a 64 bitter from two 32 bitters. + * + * Revision 1.2 1993/04/28 22:00:38 sar + * Moved the definition of UINT_64_T to ui64.h and update others + * + * Revision 1.1 1993/04/22 20:14:13 sar + * Initial revision + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +/* define some macros for manipulating unsinged 64 bit quantities */ +#if !defined(ui64_inc) +#define ui64_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1_inc)) +#include +#endif + +/**************************************************************************** +UINT_64_T +****************************************************************************/ + +/* The following structure is used to hold 64 bit unsigned int. It is + targeted for COUNTER64 but for generality it is called UINT_64_T. */ + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +typedef struct UINT_64_S + { + UINT_32_T high; /* the high (msb) 4 bytes of the uint */ + UINT_32_T low; /* the low (lsb) 4 bytes of the uint */ + } UINT_64_T; + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + +/**************************************************************************** + +NAME: UI64_Set + +PURPOSE: Set a UINT_64_T from two UINT_32_Ts + +PARAMETERS: UINT_64_T * the structure to use + UINT_32_T the high bits + UINT_32_T the low bits + +RETURNS: nothing + +RESTRICTIONS: + +BUGS: +****************************************************************************/ +#define UI64_Set(N, H, L) ((N)->high = (H), (N)->low = (L)) + +/**************************************************************************** + +NAME: UI64_High + +PURPOSE: Get the high order 32 bits + +PARAMETERS: UINT_64_T * the structure to use + +RETURNS: UINT_32_T + +RESTRICTIONS: + +BUGS: +****************************************************************************/ +#define UI64_High(N) (N)->high + +/**************************************************************************** + +NAME: UI64_Low + +PURPOSE: Get the low order 32 bits + +PARAMETERS: UINT_64_T * Pointer to the object + +RETURNS: UINT_32_T + +RESTRICTIONS: + +BUGS: +****************************************************************************/ +#define UI64_Low(N) (N)->low + +/**************************************************************************** + +NAME: UI64_Zero + +PURPOSE: Zero a UINT_64_T object + +PARAMETERS: UINT_64_T * Pointer to the object to be zeroed. + +RETURNS: + +RESTRICTIONS: + +BUGS: +****************************************************************************/ +#define UI64_Zero(N) (N)->high = (N)->low = 0L + +/**************************************************************************** + +NAME: UI64_Increment + +PURPOSE: Increment (by one) a UINT_64_T object + +PARAMETERS: UINT_64_T * Pointer to the object to be incremented. + +RETURNS: + +RESTRICTIONS: This routine will wrap the object if necessary and not give + any warning about having done so. + +BUGS: +****************************************************************************/ +#define UI64_Increment(N) if (++((N)->low) == 0) (N)->high++ + +/**************************************************************************** + +NAME: UI64_Add32 + +PURPOSE: Add a UINT_32_T to a UINT_64_T + +PARAMETERS: UINT_64_T * pointer to the object to be updated + UINT_32_T the quantity to add in. + +RETURNS: + +RESTRICTIONS: This routine will wrap the object if necessary and not give + any warning about having done so. + +BUGS: +****************************************************************************/ +#define UI64_Add32(N, I) (N)->low += I; if ((N)->low < I) (N)->high++ + +/**************************************************************************** + +NAME: UI64_Add64 + +PURPOSE: Add two UINT_64_Ts + +PARAMETERS: UINT_64_T * The object to update + UINT_64_T * The object to add in + +RETURNS: Doesn't return anything but the first UINT_64_T is updated. + +RESTRICTIONS: This routine will wrap the object if necessary and not give + any warning about having done so. + +BUGS: +****************************************************************************/ +#define UI64_Add64(N, M) (N)->low += (M)->low; (N)->high += (M)->high; \ + if ((N)->low < (M)->low) (N)->high++ + +/**************************************************************************** + +NAME: UI64_Sub64 + +PURPOSE: Subtract two UINT_64_Ts + +PARAMETERS: UINT_64_T * the result goes here + UINT_64_T * Subtract from this object + UINT_64_T * the object to subtract + +RETURNS: Doesn't return anything but the first UINT_64_T is filled in. + +RESTRICTIONS: This routine will wrap the object if necessary and not give + any warning about having done so. + +BUGS: +****************************************************************************/ +#define UI64_Sub64(X, Y, Z) (X)->low = (Y)->low - (Z)->low; \ + (X)->high = (Y)->high - (Z)->high; \ + if ((X)->low > (Y)->low) (X)->high-- + +/**************************************************************************** + +NAME: UI64_Copy + +PURPOSE: Copy one UINT_64_T to another + +PARAMETERS: UINT_64_T * the result goes here + UINT_64_T * copy from this object + +RETURNS: Doesn't return anything but the first UINT_64_T is filled in. + +RESTRICTIONS: + +BUGS: +****************************************************************************/ +#define UI64_Copy(X, Y) (X)->low = (Y)->low; (X)->high = (Y)->high + +/**************************************************************************** + +NAME: UI64_Compare + +PURPOSE: Compare two UINT_64_Ts + +PARAMETERS: UINT_64_T * The two objects to compare + UINT_64_T * + +RETURNS: < 0 if the first is smaller than the second + > 0 if the first is greater than the second + 0 if they are equal. + +RESTRICTIONS: + +BUGS: +****************************************************************************/ +#define UI64_Compare(X, Y) \ +(((X)->high == (Y)->high) ? \ + (((X)->low == (Y)->low) ? (0) : (((X)->low > (Y)->low) ? (1) : (-1))) : \ + (((X)->high > (Y)->high) ? (1) : (-1))) + +#ifdef __cplusplus +} +#endif + +#endif /* ui64.h defined */ diff --git a/h/wrn/wm/snmp/engine/v3_acc.h b/h/wrn/wm/snmp/engine/v3_acc.h new file mode 100644 index 0000000..594b4ae --- /dev/null +++ b/h/wrn/wm/snmp/engine/v3_acc.h @@ -0,0 +1,285 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/v3_acc.h,v 1.2 2001/11/06 21:35:05 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: v3_acc.h,v $ + * Revision 1.2 2001/11/06 21:35:05 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:23 tneale + * Tornado shuffle + * + * Revision 9.6 2001/04/25 16:52:23 josh + * the SNMP_ACCESS_T object is now initialized with a default + * status of ETC_RS_NIS instead of ETC_RS_NREADY + * + * Revision 9.5 2001/01/19 22:22:11 paul + * Update copyright. + * + * Revision 9.4 2000/03/17 19:48:43 meister + * Update copyright notice + * + * Revision 9.3 2000/03/09 20:58:35 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.2 2000/03/09 16:59:22 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.1 2000/02/04 21:54:19 josh + * prototyping functions that may need to be called by other modules + * this is done primarily to make the vxWorks compiler happy. + * Warning: the prototypes added may be duplicated by a mib_hand.h + * file generated by Emissary. + * + * Revision 9.0 1998/10/16 22:10:23 sar + * Update version stamp to match release + * + * Revision 1.7 1998/08/12 04:52:16 sar + * revamp the initialization routines to limit the amount of + * code that might get pulled in. + * + * Revision 1.6 1998/07/06 01:01:21 sar + * Update type of security level field to make compilers happy + * + * Revision 1.5 1998/07/01 01:48:18 sar + * As part of the set_defaults macro do a memset to zero the memory + * + * Revision 1.4 1998/06/18 04:42:03 sar + * Modified bflags in ebuffer to be unsigned ints and updated + * calling routines accordingly + * + * Revision 1.3 1998/06/16 05:29:56 sar + * clean up some type info + * modify the api for the next routine + * + * Revision 1.2 1998/05/30 02:52:08 sar + * Modifed the names used for max string length + * Updated user lookup + * + * Revision 1.1 1998/05/23 19:49:39 sar + * Include files for use with v3 code. They define the structures + * and entry points for the various pieces. + * acc: access and group information + * auth & priv: authentication and privacy + * con: context + * eng: engine ids, both this agents and any others it knows + * mth: method routines, for use with mib control files + * user: user info + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(v3_acc_inc)) +#define v3_acc_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1_inc)) +#include +#endif + +#if (!defined(buffer_inc)) +#include +#endif + +#if (!defined(smi_inc)) +#include +#endif + +#define ETC_ACCESS_VIEW_MAX 32 +#define ETC_ACCESS_GROUP_MAX 32 +#define ETC_ACCESS_ACCESS_MAX 32 + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +typedef struct SNMP_GROUP_S + { + struct SNMP_GROUP_S *next; + sbits32_t model; /* security model, an index */ + bits8_t *uname; /* security name, other index */ + ALENGTH_T uname_len; /* length of security name */ + EBUFFER_T grp_name; /* group name */ + bits16_t status; + bits16_t storage; + } SNMP_GROUP_T; + +/* global root pointer for group list */ +extern SNMP_GROUP_T *root_group; + +#define SNMP_Group_Set_Defaults(G) (MEMSET((G), 0, sizeof(SNMP_GROUP_T)), \ + EBufferInitialize(&((G)->grp_name)), \ + (G)->storage = ETC_STO_NONVOL, \ + (G)->status = ETC_RS_NREADY) + +extern SNMP_GROUP_T * SNMP_Group_Create __((void)); +extern void SNMP_Group_Destroy __((SNMP_GROUP_T *)); +extern int SNMP_Group_Install __((SNMP_GROUP_T *, sbits32_t, + bits8_t *, ALENGTH_T)); +extern void SNMP_Group_Deinstall __((SNMP_GROUP_T *)); +extern SNMP_GROUP_T * SNMP_Group_Lookup __((sbits32_t, bits8_t *, + ALENGTH_T)); +extern SNMP_GROUP_T * SNMP_Group_Next __((int, OIDC_T *)); +extern SNMP_GROUP_T * SNMP_Group_Next_Group __((SNMP_GROUP_T *)); +extern void SNMP_Group_Name __((SNMP_GROUP_T *, sbits32_t *, + bits8_t *, ALENGTH_T *)); + +#define SNMP_Group_Set_Group(G, S, L, F) \ + (EBufferAllocateLoad((F), &((G)->grp_name), (S), (L))) + +#define SNMP_Group_Compare_Names(G1, G2) ((G1 == G2) ? 0 : 1) + +#define SNMP_Group_Get_Group(G) (EBufferStart(&((G)->grp_name))) +#define SNMP_Group_Get_Group_Len(G) (EBufferUsed(&((G)->grp_name))) + +#define SNMP_Group_Get_Status(G) ((G)->status) +#define SNMP_Group_Set_Status(G, V) ((G)->status = (bits16_t)(V)) +#define SNMP_Group_Get_Storage(G) ((G)->storage) +#define SNMP_Group_Set_Storage(G, V) ((G)->storage = (bits16_t)(V)) + +typedef struct SNMP_ACC_GRP_S + { + struct SNMP_ACC_GRP_S *next; + bits8_t *grp_name; /* group name, an index */ + ALENGTH_T grp_len; + struct SNMP_ACCESS_S *access; + } SNMP_ACC_GRP_T; + +typedef struct SNMP_ACCESS_S + { + struct SNMP_ACC_GRP_S *group; + struct SNMP_ACCESS_S *next; + bits8_t *prefix; /* context prefix, an index */ + ALENGTH_T prefix_len; + int prefix_match; /* prefix match, exact - 1, prefix - 2 */ + sbits32_t model; /* security model, an index */ + sbits16_t level; /* security level, an index */ + EBUFFER_T readview; /* name of view for reading */ + EBUFFER_T writeview; /* name of view for writing */ + EBUFFER_T notifyview; /* name of view for notifies */ + int status; + int storage; + } SNMP_ACCESS_T; + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + +#define ETC_ACCESS_EXACT 1 +#define ETC_ACCESS_PREFIX 2 + +/* global root pointer for access list */ +extern SNMP_ACC_GRP_T *root_access; + +#define SNMP_V3_Access_Set_Defaults(A) (MEMSET((A), 0, sizeof(SNMP_ACCESS_T)),\ + (A)->prefix_match = ETC_ACCESS_EXACT, \ + EBufferInitialize(&((A)->readview)), \ + EBufferInitialize(&((A)->writeview)), \ + EBufferInitialize(&((A)->notifyview)),\ + (A)->storage = ETC_STO_NONVOL, \ + (A)->status = ETC_RS_NIS) + +extern SNMP_ACCESS_T * SNMP_V3_Access_Create __((void)); +extern void SNMP_V3_Access_Destroy __((SNMP_ACCESS_T *)); +extern int SNMP_V3_Access_Install __((SNMP_ACCESS_T *, + bits8_t *, ALENGTH_T, + bits8_t *, ALENGTH_T, + sbits32_t, sbits32_t)); +extern void SNMP_V3_Access_Deinstall __((SNMP_ACCESS_T *)); +extern SNMP_ACCESS_T * SNMP_V3_Access_Lookup __((bits8_t *, ALENGTH_T, + bits8_t *, ALENGTH_T, + sbits32_t, sbits32_t)); +extern SNMP_ACCESS_T * SNMP_V3_Access_Next __((int, OIDC_T *)); +extern SNMP_ACCESS_T * SNMP_V3_Access_Next_Access __((SNMP_ACCESS_T *)); + +extern void SNMP_V3_Access_Name __((SNMP_ACCESS_T *, + bits8_t *, ALENGTH_T *, + bits8_t *, ALENGTH_T *, + sbits32_t *, sbits32_t *)); + +extern SNMP_ACCESS_T * SNMP_V3_Access_Find __((bits8_t *, ALENGTH_T, + bits8_t *, ALENGTH_T, + sbits32_t, sbits32_t)); +extern int SNMP_V3_Access_Set_View __((SNMP_ACCESS_T *, + EBUFFER_T *, bits8_t *, + ALENGTH_T, unsigned int)); + +#define SNMP_V3_Access_Compare_Names(A1, A2) ((A1 == A2) ? 0 : 1) + +#define SNMP_V3_Access_Get_Read(A) EBufferStart(&((A)->readview)) +#define SNMP_V3_Access_Get_Read_Len(A) EBufferUsed(&((A)->readview)) +#define SNMP_V3_Access_Set_Read(A,S,L,F) \ + SNMP_V3_Access_Set_View(A, &((A)->readview), S, L, F) +#define SNMP_V3_Access_Get_Write(A) EBufferStart(&((A)->writeview)) +#define SNMP_V3_Access_Get_Write_Len(A) EBufferUsed(&((A)->writeview)) +#define SNMP_V3_Access_Set_Write(A,S,L,F) \ + SNMP_V3_Access_Set_View(A, &((A)->writeview), S, L, F) +#define SNMP_V3_Access_Get_Notify(A) EBufferStart(&((A)->notifyview)) +#define SNMP_V3_Access_Get_Notify_Len(A) EBufferUsed(&((A)->notifyview)) +#define SNMP_V3_Access_Set_Notify(A,S,L,F) \ + SNMP_V3_Access_Set_View(A, &((A)->notifyview), S, L, F) + + +#define SNMP_V3_Access_Get_Prefix_Match(A) ((A)->prefix_match) +#define SNMP_V3_Access_Set_Prefix_Match(A, B) (((A)->prefix_match) = (B)) + +#define SNMP_V3_Access_Get_Status(A) ((A)->status) +#define SNMP_V3_Access_Set_Status(A, V) ((A)->status = (bits16_t)(V)) +#define SNMP_V3_Access_Get_Storage(A) ((A)->storage) +#define SNMP_V3_Access_Set_Storage(A, V) ((A)->storage = (bits16_t)(V)) + +extern void grouptable_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void grouptable_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void grouptable_test __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void grouptable_set __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void accesstable_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void accesstable_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void accesstable_test __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void accesstable_set __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +#ifdef __cplusplus +} +#endif + +#endif /* #if (!defined(v3_acc_inc))*/ diff --git a/h/wrn/wm/snmp/engine/v3_auth.h b/h/wrn/wm/snmp/engine/v3_auth.h new file mode 100644 index 0000000..3762c67 --- /dev/null +++ b/h/wrn/wm/snmp/engine/v3_auth.h @@ -0,0 +1,239 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/v3_auth.h,v 1.4 2003/01/15 13:58:56 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: v3_auth.h,v $ + * Revision 1.4 2003/01/15 13:58:56 josh + * directory structure shifting + * + * Revision 1.3 2001/11/06 21:50:41 josh + * second (and hopefully final) pass of new path hacking + * + * Revision 1.2 2001/11/06 21:35:05 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:23 tneale + * Tornado shuffle + * + * Revision 9.5 2001/01/19 22:22:11 paul + * Update copyright. + * + * Revision 9.4 2000/03/17 19:48:43 meister + * Update copyright notice + * + * Revision 9.3 2000/03/09 20:58:35 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.2 2000/03/09 16:59:34 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.1 2000/02/04 21:54:20 josh + * prototyping functions that may need to be called by other modules + * this is done primarily to make the vxWorks compiler happy. + * Warning: the prototypes added may be duplicated by a mib_hand.h + * file generated by Emissary. + * + * Revision 9.0 1998/10/16 22:10:23 sar + * Update version stamp to match release + * + * Revision 1.4 1998/08/12 04:52:17 sar + * revamp the initialization routines to limit the amount of + * code that might get pulled in. + * + * Revision 1.3 1998/06/16 05:29:19 sar + * Add a long tag ("L") to a long constant + * + * Revision 1.2 1998/05/27 22:53:53 sar + * Add routines to manipulate the auth and priv lists (add and find), + * as well as some specifics adds (md5, sha) + * + * Revision 1.1 1998/05/23 19:49:39 sar + * Include files for use with v3 code. They define the structures + * and entry points for the various pieces. + * acc: access and group information + * auth & priv: authentication and privacy + * con: context + * eng: engine ids, both this agents and any others it knows + * mth: method routines, for use with mib control files + * user: user info + * + */ + +/* [clearcase] +modification history +------------------- +01c,17may05,job fix up the DH code +01b,05may05,asl Diffie-Hellman work +01a,15apr05,AJS Diffie-Hellman work +01a,13apr05,AJS Diffie-Hellman work +*/ + + +#if (!defined(v3_auth_inc)) +#define v3_auth_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1_inc)) +#include +#endif + +#if (!defined(HMAC_H)) +#include +#endif + + +#if INSTALL_SNMP_V3_DIFFIE_HELLMAN +#include +#include +#endif /* INSTALL_SNMP_V3_DIFFIE_HELLMAN */ + +/* For password to key purposes, this is the length to expand a password to */ +#define V3_AUTH_MEGABYTE 1048576L + +/* Needs is what is the length needed in the packet, + digest is the length of the acutal digest + keysize is the length of the keysize */ +#define V3_HMAC_MD5_NEEDS 12 +#define V3_HMAC_MD5_DIGEST 16 +#define V3_HMAC_MD5_KEYSIZE 16 + +#define V3_HMAC_SHA_NEEDS 12 +#define V3_HMAC_SHA_DIGEST 20 +#define V3_HMAC_SHA_KEYSIZE 20 + +#define V3_HMAC_MAX_NEEDS 12 +#define V3_HMAC_MAX_DIGEST 20 + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +typedef struct SNMP_AUTH_S + { + struct SNMP_AUTH_S *next; + OBJ_ID_T name; /* name of the auth protocol */ + + /* routines to perform the hashing, the first inits the context + block, the second updates the context block with the new data + and the third finalizes things and writes the digest */ + hashfcn_init_t hashinit; + hashfcn_update_t hashupdate; + hashfcn_final_t hashfinal; + + /* the digest and verifciation routine */ + int (*authenticate)(struct SNMP_AUTH_S *, bits8_t *, ALENGTH_T, + bits8_t *, ALENGTH_T, bits8_t *, int); + + /* sizes of various items */ + ALENGTH_T need; /* digest carried in snmp message */ + ALENGTH_T digestsize; /* full digest */ + ALENGTH_T keysize; /* key */ + ALENGTH_T ctxsize; /* context block for the hash rtns */ + } SNMP_AUTH_T; + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + +/* global root pointer for the auth list */ +extern SNMP_AUTH_T *v3_auth_root; + +extern SNMP_AUTH_T * SNMP_Auth_Find __((int, OIDC_T *)); +extern int SNMP_Auth_Add __((SNMP_AUTH_T *)); +extern int SNMP_Auth_Add_MD5 __((void)); +extern int SNMP_Auth_Add_SHA __((void)); + +#define SNMP_Auth_Digest(A, K, KL, B, BL, O) \ + ((A)->authenticate(A, K, KL, B, BL, O, 0)) +#define SNMP_Auth_Verify(A, K, KL, B, BL, O) \ + ((A)->authenticate(A, K, KL, B, BL, O, 1)) + +#define SNMP_Auth_Get_KeySize(A) ((A)->keysize) +#define SNMP_Auth_Get_Need(A) ((A)->need) + +#define SNMP_Auth_Get_Name(A) (&((A)->name)) + + +extern int SNMP_V3_Pass2Key __((SNMP_AUTH_T *, bits8_t *, ALENGTH_T, + bits8_t *, ALENGTH_T key_len, + bits8_t *, ALENGTH_T engineid_len, int)); +extern int SNMP_V3_KeyChange __((SNMP_AUTH_T *, bits8_t *, ALENGTH_T, + bits8_t *, ALENGTH_T key_len)); + +#if INSTALL_SNMP_V3_DIFFIE_HELLMAN +int SNMP_V3_DHKeyChange (DH *DHvalues, BIGNUM *pubKey, + bits8_t **sk, int *skLen); +#endif /* INSTALL_SNMP_V3_DIFFIE_HELLMAN */ + +/* Macros to get/set an Auth/Priv key */ + +#define SNMP_Get_DHauthKey(USER) \ + (EBufferStart (&(USER->DH_keys.DHpubAuthKey))) + +#define SNMP_Get_DHauthKey_len(USER) \ + (EBufferUsed (&(USER->DH_keys.DHpubAuthKey))) + +#define SNMP_Set_DHauthKey(USER,FLAGS,KEY,LENGTH) \ + (EBufferPreload(FLAGS,((SNMP_DH_T *)(USER)->DH_keys).DHpubAuthKey,KEY,LENGTH) + +/* Macros to get/set a Priv key */ + +#define SNMP_Get_DHprivKey(USER) \ + (EBufferStart (&(USER->DH_keys.DHpubPrivKey))) + +#define SNMP_Get_DHprivKey_len(USER) \ + (EBufferUsed (&(USER->DH_keys.DHpubPrivKey))) + +#define SNMP_Set_DHprivKey(USER,FLAGS,KEY,LENGTH) \ + (EBufferPreload(FLAGS,((SNMP_DH_T *)(USER)->DH_keys).DHpubPrivKey,KEY,LENGTH) + +/* Get the auth/priv random numbers; returns a pointer to BIGNUM */ + +#define SNMP_Get_DHauthRand(USER) (((SNMP_DH_T *)(USER)->DH_keys).DHauthRand) +#define SNMP_Get_DHprivhRand(USER) (((SNMP_DH_T *)(USER)->DH_keys).DHprivRand) + +/* Set the BIGNUM pointer for auth/priv random numbers */ + +#define SNMP_Set_DHauthRand(USER,BN) \ + (((SNMP_DH_T *)(USER)->DH_keys).DHauthRand = BN) +#define SNMP_Set_DHprivRand(USER,BN) \ + (((SNMP_DH_T *)(USER)->DH_keys).DHprivRand = BN) + +/* Other declarations */ + +extern OIDC_T v3_auth_noauth[]; +extern int v3_auth_noauth_size; + +extern int v3_auth_authenticate __((SNMP_AUTH_T *, bits8_t *, ALENGTH_T, + bits8_t *, ALENGTH_T, bits8_t *, int)); + + +extern SNMP_AUTH_T v3_auth_md5; +extern SNMP_AUTH_T v3_auth_sha; + +#ifdef __cplusplus +} +#endif + +#endif /* #if (!defined(v3_auth_inc)) */ + diff --git a/h/wrn/wm/snmp/engine/v3_comm.h b/h/wrn/wm/snmp/engine/v3_comm.h new file mode 100644 index 0000000..aeb4cf1 --- /dev/null +++ b/h/wrn/wm/snmp/engine/v3_comm.h @@ -0,0 +1,234 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/v3_comm.h,v 1.2 2001/11/06 21:35:05 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: v3_comm.h,v $ + * Revision 1.2 2001/11/06 21:35:05 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:23 tneale + * Tornado shuffle + * + * Revision 1.1.2.3 2001/09/21 19:16:07 josh + * updating and expanding structures for use with coexistence + * + * Revision 1.1.2.2 2001/08/07 18:33:57 josh + * adding support for SNMPv1/v2c/v3 coexistence to SNMP Notify code + * + * Revision 1.1.2.1 2001/07/16 18:02:12 josh + * a first-round commit adding infrastructure support + * for the SNMPv3 Coexistence RFC (2576) + * + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(v3_comm_inc)) +#define v3_comm_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1_inc)) +#include +#endif + +#if (!defined(buffer_inc)) +#include +#endif + +#if (!defined(smi_inc)) +#include +#endif + +#define ETC_COMMUNITY_MAX 32 + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +typedef struct SNMP_COMMUNITY_S + { + struct SNMP_COMMUNITY_S *next; + EBUFFER_T comm_index; /* the name of this entry */ + EBUFFER_T comm_name; /* the community name */ + EBUFFER_T comm_sec_name; /* security name */ + EBUFFER_T comm_con_id; /* context engine id */ + EBUFFER_T comm_con_name; /* context name */ + EBUFFER_T comm_tag; /* transport tag */ + bits16_t storage; + bits16_t status; + bits16_t flags; + } SNMP_COMMUNITY_T; + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + +#define ETC_COMM_NAME 0x01 +#define ETC_COMM_SEC_NAME 0x02 +#define ETC_COMM_ALL_FLAGS 0x03 + +/* global root pointer for target params list */ +extern SNMP_COMMUNITY_T *root_community; + +#define SNMP_Community_Set_Defaults(C) \ + (MEMSET((C), 0, sizeof(SNMP_COMMUNITY_T)), \ + EBufferInitialize(&((C)->comm_index)), \ + EBufferInitialize(&((C)->comm_name)), \ + EBufferInitialize(&((C)->comm_sec_name)), \ + EBufferInitialize(&((C)->comm_con_id)), \ + EBufferAllocateLoad(BFL_IS_ALLOC, &((C)->comm_con_id), \ + v3_my_engine->id, v3_my_engine->id_len), \ + EBufferInitialize(&((C)->comm_con_name)), \ + EBufferInitialize(&((C)->comm_tag)), \ + (C)->storage = ETC_STO_NONVOL, \ + (C)->status = ETC_RS_NREADY, \ + (C)->flags = 0) + +extern SNMP_COMMUNITY_T * SNMP_Community_Create __((void)); +extern void SNMP_Community_Destroy __((SNMP_COMMUNITY_T *)); +extern envoy_err_t SNMP_Community_Install __((SNMP_COMMUNITY_T *, bits8_t *, + ALENGTH_T)); +extern void SNMP_Community_Deinstall __((SNMP_COMMUNITY_T *)); +extern SNMP_COMMUNITY_T * SNMP_Community_Lookup __((bits8_t *, ALENGTH_T)); +extern SNMP_COMMUNITY_T * SNMP_Community_Next __((int, OIDC_T *)); +extern SNMP_COMMUNITY_T * SNMP_Community_Next_Community + __((SNMP_COMMUNITY_T *)); +extern void SNMP_Community_Index __((SNMP_COMMUNITY_T *, bits8_t *, + ALENGTH_T *)); + +#define SNMP_Community_Get_Index(C) (EBufferStart(&((C)->comm_index))) +#define SNMP_Community_Get_Index_Len(C) (EBufferUsed(&((C)->comm_index))) + +#define SNMP_Community_Get_Name(C) (EBufferStart(&((C)->comm_name))) +#define SNMP_Community_Get_Name_Len(C) (EBufferUsed(&((C)->comm_name))) +#define SNMP_Community_Set_Name(C, S, L, F) \ + (EBufferAllocateLoad((F), &((C)->comm_name), (S), (L))) + +#define SNMP_Community_Get_Sec_Name(C) (EBufferStart(&((C)->comm_sec_name))) +#define SNMP_Community_Get_Sec_Name_Len(C) (EBufferUsed(&((C)->comm_sec_name))) +#define SNMP_Community_Set_Sec_Name(C, S, L, F) \ + (EBufferAllocateLoad((F), &((C)->comm_sec_name), (S), (L))) + +#define SNMP_Community_Get_Con_ID(C) (EBufferStart(&((C)->comm_con_id))) +#define SNMP_Community_Get_Con_ID_Len(C) (EBufferUsed(&((C)->comm_con_id))) +#define SNMP_Community_Set_Con_ID(C, S, L, F) \ + (EBufferAllocateLoad((F), &((C)->comm_con_id), (S), (L))) + +#define SNMP_Community_Get_Con_Name(C) (EBufferStart(&((C)->comm_con_name))) +#define SNMP_Community_Get_Con_Name_Len(C) (EBufferUsed(&((C)->comm_con_name))) +#define SNMP_Community_Set_Con_Name(C, S, L, F) \ + (EBufferAllocateLoad((F), &((C)->comm_con_name), (S), (L))) + +#define SNMP_Community_Get_Tag(C) (EBufferStart(&((C)->comm_tag))) +#define SNMP_Community_Get_Tag_Len(C) (EBufferUsed(&((C)->comm_tag))) +#define SNMP_Community_Set_Tag(C, S, L, F) \ + (EBufferAllocateLoad((F), &((C)->comm_tag), (S), (L))) + +#define SNMP_Community_Get_Storage(C) ((C)->storage) +#define SNMP_Community_Set_Storage(C, V) ((C)->storage = (bits16_t)(V)) + +#define SNMP_Community_Get_Status(C) ((C)->status) +#define SNMP_Community_Set_Status(C, V) ((C)->status = (bits16_t)(V)) + +#define SNMP_Community_Get_Flags(C) ((C)->flags) +#define SNMP_Community_Set_Flags(C, V) ((C)->flags = (bits16_t)(V)) + +extern void snmpCommunityEntry_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void snmpCommunityEntry_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void snmpCommunityEntry_test __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void snmpCommunityEntry_set __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern struct SNMP_TARGET_ADDR_S *find_target_by_community __((EBUFFER_T *, + OBJ_ID_T *, + EBUFFER_T *)); + +#if (INSTALL_ENVOY_SNMP_V3_NOTIFY) || (INSTALL_ENVOY_SNMP_V3_PROXY) +/* Some well-known OIDs that will be necessary to deal with traps + * and proxies + */ +extern OIDC_T COEX_SNMPTRAPOID[]; +extern OIDC_T COEX_TRAPENTERPRISE[]; +extern OIDC_T COEX_SNMPTRAPS[]; +extern OIDC_T COEX_COLDSTART[]; +extern OIDC_T COEX_WARMSTART[]; +extern OIDC_T COEX_LINKDOWN[]; +extern OIDC_T COEX_LINKUP[]; +extern OIDC_T COEX_AUTHFAILURE[]; +extern OIDC_T COEX_NEIGHBORLOSS[]; +#endif + +/* The leaf definitions for the method routines */ +#define LEAF_snmpCommunityIndex 1 +#define MINSIZE_snmpCommunityIndex 1L +#define MAXSIZE_snmpCommunityIndex 32L +#define LEAF_snmpCommunityName 2 +#define LEAF_snmpCommunitySecurityName 3 +#define MINSIZE_snmpCommunitySecurityName 1L +#define MAXSIZE_snmpCommunitySecurityName 32L +#define LEAF_snmpCommunityContextEngineID 4 +#define MINSIZE_snmpCommunityContextEngineID 5L +#define MAXSIZE_snmpCommunityContextEngineID 32L +#define LEAF_snmpCommunityContextName 5 +#define MINSIZE_snmpCommunityContextName 0L +#define MAXSIZE_snmpCommunityContextName 32L +#define LEAF_snmpCommunityTransportTag 6 +#define MINSIZE_snmpCommunityTransportTag 0L +#define MAXSIZE_snmpCommunityTransportTag 255L +#define LEAF_snmpCommunityStorageType 7 +#define VAL_snmpCommunityStorageType_other 1L +#define VAL_snmpCommunityStorageType_volatile 2L +#define VAL_snmpCommunityStorageType_nonVolatile 3L +#define VAL_snmpCommunityStorageType_permanent 4L +#define VAL_snmpCommunityStorageType_readOnly 5L +#define LEAF_snmpCommunityStatus 8 +#define VAL_snmpCommunityStatus_active 1L +#define VAL_snmpCommunityStatus_notInService 2L +#define VAL_snmpCommunityStatus_notReady 3L +#define VAL_snmpCommunityStatus_createAndGo 4L +#define VAL_snmpCommunityStatus_createAndWait 5L +#define VAL_snmpCommunityStatus_destroy 6L +#define LEAF_snmpTargetAddrTMask 1 +#define MINSIZE_snmpTargetAddrTMask 0L +#define MAXSIZE_snmpTargetAddrTMask 255L +#define LEAF_snmpTargetAddrMMS 2 +#define MIN_snmpTargetAddrMMS 484L +#define MAX_snmpTargetAddrMMS 2147483647L +#define LEAF_snmpTrapAddress 3 +#define LEAF_snmpTrapCommunity 4 + +#ifdef __cplusplus +} +#endif + +#endif /* #if (!defined(v3_comm_inc))*/ diff --git a/h/wrn/wm/snmp/engine/v3_con.h b/h/wrn/wm/snmp/engine/v3_con.h new file mode 100644 index 0000000..2c9b07c --- /dev/null +++ b/h/wrn/wm/snmp/engine/v3_con.h @@ -0,0 +1,128 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/v3_con.h,v 1.2 2001/11/06 21:35:05 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: v3_con.h,v $ + * Revision 1.2 2001/11/06 21:35:05 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:23 tneale + * Tornado shuffle + * + * Revision 9.5 2001/01/19 22:22:11 paul + * Update copyright. + * + * Revision 9.4 2000/03/17 19:48:44 meister + * Update copyright notice + * + * Revision 9.3 2000/03/09 20:58:36 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.2 2000/03/09 16:59:47 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.1 2000/02/04 21:54:21 josh + * prototyping functions that may need to be called by other modules + * this is done primarily to make the vxWorks compiler happy. + * Warning: the prototypes added may be duplicated by a mib_hand.h + * file generated by Emissary. + * + * Revision 9.0 1998/10/16 22:10:24 sar + * Update version stamp to match release + * + * Revision 1.4 1998/08/01 17:29:05 sar + * Add argument to context length function + * + * Revision 1.3 1998/06/09 16:43:54 sar + * Moved some context routines to snmp so that they are in the core code + * and can be used by the rest of the core. Also renamed the routines + * to keep them separate from usec. + * + * Revision 1.2 1998/05/30 02:52:07 sar + * Modifed the names used for max string length + * Updated user lookup + * + * Revision 1.1 1998/05/23 19:49:40 sar + * Include files for use with v3 code. They define the structures + * and entry points for the various pieces. + * acc: access and group information + * auth & priv: authentication and privacy + * con: context + * eng: engine ids, both this agents and any others it knows + * mth: method routines, for use with mib control files + * user: user info + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(v3_context_inc)) +#define v3_context_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1_inc)) +#include +#endif + +#define ETC_CONTEXT_MAX 32 + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +typedef struct SNMP_CONTEXT_S + { + struct SNMP_CONTEXT_S *next; + bits8_t *name; + ALENGTH_T length; + } SNMP_CONTEXT_T; + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + +extern SNMP_CONTEXT_T *v3_context_root; + +extern int SNMP_V3_Context_Add __((bits8_t *, ALENGTH_T)); +extern int SNMP_V3_Context_Remove __((bits8_t *, ALENGTH_T)); +extern SNMP_CONTEXT_T *SNMP_V3_Context_Find __((bits8_t *, ALENGTH_T)); + +#define SNMP_V3_Context_Name(C) ((C)->name) +#define SNMP_V3_Context_Name_Length(C) ((C)->length) + +extern void contexttable_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void contexttable_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +#ifdef __cplusplus +} +#endif + +#endif /* v3_context_inc */ diff --git a/h/wrn/wm/snmp/engine/v3_dh.h b/h/wrn/wm/snmp/engine/v3_dh.h new file mode 100644 index 0000000..d67c2ab --- /dev/null +++ b/h/wrn/wm/snmp/engine/v3_dh.h @@ -0,0 +1,62 @@ + +/* v3_dh.h - v3_dh.h routines */ + +/* + * Copyright (C) 2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + +/* [clearcase] +modification history +------------------- +01c,04may05,asl Diffie-Hellman work +01b,02may05,job fix superfluous definitions +01a,28apr05,job remove extraneous prototype +*/ + +#if (!defined(v3_dh_inc)) +#define v3_dh_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if INSTALL_SNMP_V3_DIFFIE_HELLMAN + +#include + +#define DH_MAX_FIELD_LEN 2 +#define DH_LONG_FORM 2 +#define DH_MIN_PARAMS_LEN 256 +#define DH_SEQID 0x30 +#define DH_MINKEYCHG 4 + +#define DH_SEED_PRIME 211 +#define DH_MAX_SEED_BYTES 256 + +#ifndef SNMP_DH_RAND +#define SNMP_DH_RAND() +#endif + +#define DH_PRIMELEN BN_num_bytes (SNMP_DH_params.prime) + +extern BN_CTX *SNMP_DH_bnCtx; +extern SNMP_DH_PARAMS_T SNMP_DH_params; + +int SNMP_DH_encodeParams (BIGNUM *prime, int base, int pvl, EBUFFER_T *result); +int SNMP_DH_decodeParams (EBUFFER_T *BUFFER, BIGNUM *prime, int *base, int *pvl); +int SNMP_set_DH_params (int primeLen, bits8_t *prime, int base, int pvl); +int SNMP_get_DH_params (int *primeLen, bits8_t **prime, int *base, int *pvl); +int SNMP_bn2bin (BIGNUM *bignum, bits8_t **binVal); + +#endif /* INSTALL_SNMP_V3_DIFFIE_HELLMAN */ + +#ifdef __cplusplus +} +#endif + +#endif /* v3_dh_inc */ diff --git a/h/wrn/wm/snmp/engine/v3_eng.h b/h/wrn/wm/snmp/engine/v3_eng.h new file mode 100644 index 0000000..73562bb --- /dev/null +++ b/h/wrn/wm/snmp/engine/v3_eng.h @@ -0,0 +1,218 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/v3_eng.h,v 1.3 2002/04/01 21:33:27 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: v3_eng.h,v $ + * Revision 1.3 2002/04/01 21:33:27 josh + * make sure that engine ids conform to restricted lengths + * (minimum of 5, maximum of 32) + * + * Revision 1.2 2001/11/06 21:35:06 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:23 tneale + * Tornado shuffle + * + * Revision 9.11 2001/04/11 20:42:56 josh + * merge from the kingfisher branch + * + * Revision 9.10 2001/01/19 22:22:11 paul + * Update copyright. + * + * Revision 9.9 2000/07/12 18:39:30 josh + * moving SNMP_Find_Matching_Engine_ID() to v3_eng.c -- appropriately + * updating headers to correspond + * + * Revision 9.8 2000/06/09 14:54:12 josh + * modifications due to new installation options, new proxy code + * moved some definitions from sendntfy.h into v3_trgt.h so they'd + * be built with the target code + * + * Revision 9.7.2.2 2001/03/12 22:08:00 tneale + * Updated copyright + * + * Revision 9.7.2.1 2000/09/21 21:14:54 josh + * bringing branch include files in line with root + * + * Revision 9.7 2000/03/17 19:48:44 meister + * Update copyright notice + * + * Revision 9.6 2000/03/09 20:58:36 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.5 2000/03/09 17:00:01 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.4 2000/02/04 21:54:22 josh + * prototyping functions that may need to be called by other modules + * this is done primarily to make the vxWorks compiler happy. + * Warning: the prototypes added may be duplicated by a mib_hand.h + * file generated by Emissary. + * + * Revision 9.3 1999/10/29 21:47:24 josh + * better control over how and when ENVOY_ADD_ENGINE_ADDRESS and + * ENVOY_ADD_ENGINE_ID are defined. + * + * Revision 9.2 1999/10/07 23:39:56 josh + * default definitions for ENVOY_ADD_ENGINE_ID and + * ENVOY_ADD_ENGINE_ADDRESS + * + * Revision 9.1 1999/09/27 21:11:44 josh + * fixing nits, rewriting engine id <--> address code, adding installation + * option + * + * Revision 9.0 1998/10/16 22:10:24 sar + * Update version stamp to match release + * + * Revision 1.6 1998/08/12 04:52:16 sar + * revamp the initialization routines to limit the amount of + * code that might get pulled in. + * + * Revision 1.5 1998/07/20 01:59:57 sar + * Add () to SNMP_Engine_Get_My_* and ENVOY_TIME calls + * Modify the timestamp installs so they are all the same, + * installing ENVOY_TIME() - timestamp + * + * Revision 1.4 1998/07/03 16:54:53 sar + * Remove many engine install option, moved this engine's information + * into an engine structure + * + * Revision 1.3 1998/06/18 04:42:04 sar + * Modified bflags in ebuffer to be unsigned ints and updated + * calling routines accordingly + * + * Revision 1.2 1998/05/30 02:52:08 sar + * Modifed the names used for max string length + * Updated user lookup + * + * Revision 1.1 1998/05/23 19:49:40 sar + * Include files for use with v3 code. They define the structures + * and entry points for the various pieces. + * acc: access and group information + * auth & priv: authentication and privacy + * con: context + * eng: engine ids, both this agents and any others it knows + * mth: method routines, for use with mib control files + * user: user info + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(v3_eng_inc)) +#define v3_eng_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1_inc)) +#include +#endif + +#if (!defined(buffer_inc)) +#include +#endif + +#define ETC_ENGINE_ENGINE_MIN 5 +#define ETC_ENGINE_ENGINE_MAX 32 + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +typedef struct ENGINE_LEAF_S + { + struct ENGINE_LEAF_S *next; + bits8_t *id; + ALENGTH_T id_len; + bits32_t boots; + sbits32_t offset; + sbits32_t lasttime; +#if INSTALL_ENVOY_SNMP_V3_TARGET + OBJ_ID_T tdomain; /* information to allow us to find */ + EBUFFER_T taddress; /* a remote engineid for informs */ +#endif + } ENGINE_LEAF_T; + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + +#ifndef ENVOY_ADD_ENGINE_ADDRESS +#if (INSTALL_ENVOY_SNMP_V3_TARGET) +extern int envoy_add_engine_address __((SNMP_PKT_T *, SNMPADDR_T *, int)); + +#define ENVOY_ADD_ENGINE_ADDRESS(P, A, C) \ + envoy_add_engine_address((P), (A), (C)) +#elif defined(ENVOY_ADD_ENGINE_ID) +#define ENVOY_ADD_ENGINE_ADDRESS(P, A, C) (ENVOY_ADD_ENGINE_ID(P), 1) +#endif +#endif + +/* global variables */ +extern sbits32_t v3_snmpEngineMaxMessageSize; +extern ENGINE_LEAF_T *v3_my_engine; +extern ENGINE_LEAF_T *root_engine; + +extern int SNMP_Engine_Set_My_Info __((bits8_t *, ALENGTH_T, + bits32_t, sbits32_t)); +#define SNMP_Engine_Get_My_ID() (v3_my_engine ? v3_my_engine->id : 0) +#define SNMP_Engine_Get_My_ID_Length() (v3_my_engine ? v3_my_engine->id_len : 0) +#define SNMP_Engine_Get_My_Boots() (v3_my_engine ? v3_my_engine->boots : 0) +#define SNMP_Engine_Get_My_Time() (v3_my_engine ? \ + (ENVOY_TIME()) - v3_my_engine->offset : 0) + +#define SNMP_Engine_Get_Boots(E) ((E)->boots) +#define SNMP_Engine_Get_Time(E) ((ENVOY_TIME()) - (E)->offset) +#define SNMP_Engine_Get_LastTime(E) ((E)->lasttime) + +#define SNMP_Engine_Set_Info(E, B, T) ((E)->boots = (B), \ + (E)->offset = (ENVOY_TIME()) - (T),\ + (E)->lasttime = (T)) + +extern void SNMP_Find_Matching_Engine_ID __((OBJ_ID_T *, EBUFFER_T *, + bits8_t **, ALENGTH_T *)); +extern int SNMP_Engine_Set_Address __((bits8_t *, ALENGTH_T, + OIDC_T *, int, + bits8_t *, ALENGTH_T)); +extern ENGINE_LEAF_T * SNMP_Engine_Lookup __((bits8_t *, ALENGTH_T)); +extern int SNMP_Engine_Install __((bits8_t *, ALENGTH_T, + bits32_t, sbits32_t)); + +extern void get_snmpEngineID __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void get_snmpEngineBoots __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void get_snmpEngineTime __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +#ifdef __cplusplus +} +#endif + +#endif /* (!defined(v3_eng_inc)) */ + + diff --git a/h/wrn/wm/snmp/engine/v3_ini.h b/h/wrn/wm/snmp/engine/v3_ini.h new file mode 100644 index 0000000..92db344 --- /dev/null +++ b/h/wrn/wm/snmp/engine/v3_ini.h @@ -0,0 +1,79 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/v3_ini.h,v 1.3 2001/11/06 21:50:41 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: v3_ini.h,v $ + * Revision 1.3 2001/11/06 21:50:41 josh + * second (and hopefully final) pass of new path hacking + * + * Revision 1.2 2001/11/06 21:35:06 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:24 tneale + * Tornado shuffle + * + * Revision 9.3 2001/01/19 22:22:11 paul + * Update copyright. + * + * Revision 9.2 2000/03/17 19:48:45 meister + * Update copyright notice + * + * Revision 9.1 2000/03/09 17:00:12 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.0 1998/10/16 22:10:25 sar + * Update version stamp to match release + * + * Revision 8.1 1998/08/12 04:52:16 sar + * revamp the initialization routines to limit the amount of + * code that might get pulled in. + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(v3_ini_inc)) +#define v3_ini_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1conf_inc)) +#include +#endif + +#if (!defined(snmp_inc)) +#include +#endif + +extern void envoy_v3_init __((void)); + +#ifdef __cplusplus +} +#endif + +#endif /* #if (!defined(v3_ini_inc)) */ + + + diff --git a/h/wrn/wm/snmp/engine/v3_mth.h b/h/wrn/wm/snmp/engine/v3_mth.h new file mode 100644 index 0000000..eebd3ce --- /dev/null +++ b/h/wrn/wm/snmp/engine/v3_mth.h @@ -0,0 +1,216 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/v3_mth.h,v 1.2 2001/11/06 21:35:06 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: v3_mth.h,v $ + * Revision 1.2 2001/11/06 21:35:06 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:24 tneale + * Tornado shuffle + * + * Revision 9.4.4.1 2001/07/16 18:02:13 josh + * a first-round commit adding infrastructure support + * for the SNMPv3 Coexistence RFC (2576) + * + * Revision 9.4 2001/01/19 22:22:12 paul + * Update copyright. + * + * Revision 9.3 2000/03/17 19:48:45 meister + * Update copyright notice + * + * Revision 9.2 2000/03/09 17:00:24 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.1 1999/10/15 17:44:50 josh + * added prototypes for method routines for target and notify MIBs + * + * Revision 9.0 1998/10/16 22:10:25 sar + * Update version stamp to match release + * + * Revision 1.2 1998/07/03 16:54:53 sar + * Remove many engine install option, moved this engine's information + * into an engine structure + * + * Revision 1.1 1998/05/23 19:49:40 sar + * Include files for use with v3 code. They define the structures + * and entry points for the various pieces. + * acc: access and group information + * auth & priv: authentication and privacy + * con: context + * eng: engine ids, both this agents and any others it knows + * mth: method routines, for use with mib control files + * user: user info + * + */ + +/* [clearcase] +modification history +------------------- +01b,21apr05,AJS Diffie-Hellman work +01a,19apr05,job update copyright notices +01a,13apr05,AJS Diffie-Hellman work +*/ + + +#if (!defined(v3_mth_inc)) +#define v3_mth_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1_inc)) +#include +#endif + +#if (!defined(snmpdefs_inc)) +#include +#endif + +#if (!defined(vb_inc)) +#include +#endif + +/* for our engine information */ +extern void get_snmpEngineID __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void get_snmpEngineBoots __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void get_snmpEngineTime __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +/* for the targetaddr table */ +extern void snmpTargetAddrEntry_test __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void snmpTargetAddrEntry_set __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void snmpTargetAddrEntry_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void snmpTargetAddrEntry_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +/* for the targetparams table */ +extern void snmpTargetParamsEntry_test __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void snmpTargetParamsEntry_set __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void snmpTargetParamsEntry_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void snmpTargetParamsEntry_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +/* for the notify table */ +extern void snmpNotifyEntry_test __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void snmpNotifyEntry_set __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void snmpNotifyEntry_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void snmpNotifyEntry_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +/* for the notifyfilterprofile table */ +extern void snmpNotifyFilterProfileEntry_test __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void snmpNotifyFilterProfileEntry_set __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void snmpNotifyFilterProfileEntry_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void snmpNotifyFilterProfileEntry_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +/* for the notifyfilter table */ +extern void snmpNotifyFilterEntry_test __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void snmpNotifyFilterEntry_set __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void snmpNotifyFilterEntry_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void snmpNotifyFilterEntry_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +/* for the proxy table */ +extern void snmpProxyEntry_test __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void snmpProxyEntry_set __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void snmpProxyEntry_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void snmpProxyEntry_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +/* for the user table */ +extern void usertable_test __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void usertable_set __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void usertable_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void usertable_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +/* Diffie-Hellman usmDHParameters object */ + +extern void usmDHPublicObjects_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void usmDHPublicObjects_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void usmDHPublicObjects_test __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void usmDHPublicObjects_set __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +/* for the context table, read only so don't have test or set */ +extern void contexttable_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void contexttable_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + + +/* for the security to group and access tables */ +extern void grouptable_test __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void grouptable_set __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void grouptable_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void grouptable_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void accesstable_test __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void accesstable_set __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void accesstable_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void accesstable_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +/* for the community table */ +extern void snmpCommunityEntry_test __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void snmpCommunityEntry_set __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void snmpCommunityEntry_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); +extern void snmpCommunityEntry_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/h/wrn/wm/snmp/engine/v3_ntfy.h b/h/wrn/wm/snmp/engine/v3_ntfy.h new file mode 100644 index 0000000..accd727 --- /dev/null +++ b/h/wrn/wm/snmp/engine/v3_ntfy.h @@ -0,0 +1,402 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/v3_ntfy.h,v 1.2 2001/11/06 21:35:06 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: v3_ntfy.h,v $ + * Revision 1.2 2001/11/06 21:35:06 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:24 tneale + * Tornado shuffle + * + * Revision 9.6 2001/01/19 22:22:12 paul + * Update copyright. + * + * Revision 9.5 2000/03/17 19:48:46 meister + * Update copyright notice + * + * Revision 9.4 2000/03/09 20:58:36 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.3 2000/03/09 17:06:27 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.2 2000/02/04 21:54:24 josh + * prototyping functions that may need to be called by other modules + * this is done primarily to make the vxWorks compiler happy. + * Warning: the prototypes added may be duplicated by a mib_hand.h + * file generated by Emissary. + * + * Revision 9.1 2000/01/02 22:55:56 josh + * patching up a memory leak here, a broken compare there...per + * sar's comments + * + * Revision 9.0 1999/10/21 20:43:36 josh + * updating version stamps + * + * Revision 1.7 1999/10/21 19:13:08 josh + * adding flags for flags fields in various objects to help with row + * creation + * + * Revision 1.6 1999/10/15 17:47:27 josh + * included MIB leaf definitions and cleaned up useless macros + * + * Revision 1.5 1999/09/21 21:31:26 josh + * Adding a limit constant for the NotifyFilterMask + * + * Revision 1.4 1999/09/14 19:35:26 josh + * updating default initialization per RFC 2573 + * + * Revision 1.3 1999/09/11 02:15:19 josh + * added definitions for filter excluded and included + * + * Revision 1.2 1999/09/01 20:50:02 josh + * updates to reach consistency with v3_ntfy.c + * + * Revision 1.1 1999/06/16 17:04:22 josh + * First step of adding RFC2573 Notify support. + * + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(v3_ntfy_inc)) +#define v3_ntfy_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1_inc)) +#include +#endif + +#if (!defined(buffer_inc)) +#include +#endif + +#if (!defined(smi_inc)) +#include +#endif + +#define ETC_NOTIFY_MAX 32 +#define ETC_NOTIFY_FILTER_PROFILE_MAX 32 +#define ETC_NOTIFY_FILTER_MAX 32 +#define ETC_NOTIFY_FILTER_MASK_MAX 16 + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +typedef struct SNMP_NOTIFY_S + { + struct SNMP_NOTIFY_S *next; + EBUFFER_T notify_name; /* Name of the notify */ + EBUFFER_T notify_tag; /* Tag notify is associated with */ + bits16_t notify_type; /* Trap or Inform? */ +#define SNMP_NOTIFY_TRAP 1 +#define SNMP_NOTIFY_INFORM 2 + bits16_t storage; + bits16_t status; + bits16_t flags; + } SNMP_NOTIFY_T; + +/* global root pointer for notify list */ +extern SNMP_NOTIFY_T *root_notify; + +#define SNMP_Notify_Set_Defaults(T) \ + (MEMSET((T), 0, sizeof(SNMP_NOTIFY_T)), \ + EBufferInitialize(&((T)->notify_name)), \ + EBufferInitialize(&((T)->notify_tag)), \ + (T)->notify_type = SNMP_NOTIFY_TRAP, \ + (T)->storage = ETC_STO_NONVOL, \ + (T)->status = ETC_RS_NREADY, \ + (T)->flags = 0) + +extern SNMP_NOTIFY_T * SNMP_Notify_Create __((void)); +extern void SNMP_Notify_Destroy __((SNMP_NOTIFY_T *)); +extern int SNMP_Notify_Install __((SNMP_NOTIFY_T *, bits8_t *, + ALENGTH_T)); +extern void SNMP_Notify_Deinstall __((SNMP_NOTIFY_T *)); +extern SNMP_NOTIFY_T * SNMP_Notify_Lookup __((bits8_t *, ALENGTH_T)); +extern SNMP_NOTIFY_T * SNMP_Notify_Next __((int, OIDC_T *)); +extern SNMP_NOTIFY_T * SNMP_Notify_Next_Notify __((SNMP_NOTIFY_T *)); +extern void SNMP_Notify_Name __((SNMP_NOTIFY_T *, bits8_t *, + ALENGTH_T *)); + +#define SNMP_Notify_Get_Name(N) (EBufferStart(&((N)->notify_name))) +#define SNMP_Notify_Get_Name_Len(N) (EBufferUsed(&((N)->notify_name))) + +#define SNMP_Notify_Get_Tag(N) (EBufferStart(&((N)->notify_tag))) +#define SNMP_Notify_Get_Tag_Len(N) (EBufferUsed(&((N)->notify_tag))) +#define SNMP_Notify_Set_Tag(N, S, L, F) \ + (EBufferAllocateLoad((F), &((N)->notify_tag), (S), (L))) + +#define SNMP_Notify_Get_Type(N) ((N)->notify_type) +#define SNMP_Notify_Set_Type(N, V) ((N)->notify_type = (bits16_t)(V)) + +#define SNMP_Notify_Get_Storage(N) ((N)->storage) +#define SNMP_Notify_Set_Storage(N, V) ((N)->storage = (bits16_t)(V)) + +#define SNMP_Notify_Get_Status(N) ((N)->status) +#define SNMP_Notify_Set_Status(N, V) ((N)->status = (bits16_t)(V)) + +#define SNMP_Notify_Get_Flags(N) ((N)->flags) +#define SNMP_Notify_Set_Flags(N, V) ((N)->flags = (bits16_t)(V)) + +typedef struct SNMP_NOTIFY_FILTER_PROFILE_S + { + struct SNMP_NOTIFY_FILTER_PROFILE_S *next; + EBUFFER_T params_name; /* From snmpTargetParamsTable */ + EBUFFER_T profile_name; /* Name of filter profile */ + bits16_t storage; + bits16_t status; + bits16_t flags; + } SNMP_NOTIFY_FILTER_PROFILE_T; + +#define ETC_NPROF_PROFILE 0x01 +#define ETC_NPROF_ALL_FLAGS 0x01 + +/* global root pointer for notify filter profile list */ +extern SNMP_NOTIFY_FILTER_PROFILE_T *root_notify_filter_profile; + +#define SNMP_Notify_Profile_Set_Defaults(T) \ + (MEMSET((T), 0, sizeof(SNMP_NOTIFY_FILTER_PROFILE_T)), \ + EBufferInitialize(&((T)->params_name)), \ + EBufferInitialize(&((T)->profile_name)), \ + (T)->storage = ETC_STO_NONVOL, \ + (T)->status = ETC_RS_NREADY, \ + (T)->flags = 0) + +extern SNMP_NOTIFY_FILTER_PROFILE_T * SNMP_Notify_Profile_Create + __((void)); +extern void SNMP_Notify_Profile_Destroy + __((SNMP_NOTIFY_FILTER_PROFILE_T *)); +extern int SNMP_Notify_Profile_Install + __((SNMP_NOTIFY_FILTER_PROFILE_T *, bits8_t *, ALENGTH_T)); +extern void SNMP_Notify_Profile_Deinstall + __((SNMP_NOTIFY_FILTER_PROFILE_T *)); +extern SNMP_NOTIFY_FILTER_PROFILE_T * SNMP_Notify_Profile_Lookup + __((bits8_t *, ALENGTH_T)); +extern SNMP_NOTIFY_FILTER_PROFILE_T * SNMP_Notify_Profile_Next + __((int, OIDC_T *)); +extern SNMP_NOTIFY_FILTER_PROFILE_T * SNMP_Notify_Profile_Next_Profile + __((SNMP_NOTIFY_FILTER_PROFILE_T *)); +extern void SNMP_Notify_Profile_Name + __((SNMP_NOTIFY_FILTER_PROFILE_T *, bits8_t *, ALENGTH_T *)); + +#define SNMP_Notify_Profile_Get_Params(N) \ + (EBufferStart(&((N)->params_name))) +#define SNMP_Notify_Profile_Get_Params_Len(N) \ + (EBufferUsed(&((N)->params_name))) + +#define SNMP_Notify_Profile_Get_Profile(N) \ + (EBufferStart(&((N)->profile_name))) +#define SNMP_Notify_Profile_Get_Profile_Len(N) \ + (EBufferUsed(&((N)->profile_name))) +#define SNMP_Notify_Profile_Set_Profile(N, S, L, F) \ + (EBufferAllocateLoad((F), &((N)->profile_name), (S), (L))) + +#define SNMP_Notify_Profile_Get_Storage(N) ((N)->storage) +#define SNMP_Notify_Profile_Set_Storage(N, V) ((N)->storage = (bits16_t)(V)) + +#define SNMP_Notify_Profile_Get_Status(N) ((N)->status) +#define SNMP_Notify_Profile_Set_Status(N, V) ((N)->status = (bits16_t)(V)) + +#define SNMP_Notify_Profile_Get_Flags(N) ((N)->flags) +#define SNMP_Notify_Profile_Set_Flags(N, V) ((N)->flags = (bits16_t)(V)) + +typedef struct SNMP_NOTIFY_FILTER_S + { + struct SNMP_NOTIFY_FILTER_S *next; + EBUFFER_T profile_name; /* From snmpNotifyFilterProfileTable */ + OBJ_ID_T subtree; /* MIB subtree for this filter */ + EBUFFER_T filter_mask; /* Mask for subtree */ + bits16_t filter_type; /* include or exclude filter */ +#define SNMP_NOTIFY_FILTER_INCLUDED 1 +#define SNMP_NOTIFY_FILTER_EXCLUDED 2 + bits16_t storage; + bits16_t status; + bits16_t flags; + } SNMP_NOTIFY_FILTER_T; + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + +/* global root pointer for notify filter list */ +extern SNMP_NOTIFY_FILTER_T *root_notify_filter; + +#define SNMP_Notify_Filter_Set_Defaults(T) \ + (MEMSET((T), 0, sizeof(SNMP_NOTIFY_FILTER_T)), \ + EBufferInitialize(&((T)->profile_name)) , \ + EBufferInitialize(&((T)->filter_mask)), \ + (T)->filter_type = SNMP_NOTIFY_FILTER_INCLUDED, \ + (T)->storage = ETC_STO_NONVOL, \ + (T)->status = ETC_RS_NREADY, \ + (T)->flags = 0) + +extern SNMP_NOTIFY_FILTER_T * SNMP_Notify_Filter_Create __((void)); +extern void SNMP_Notify_Filter_Destroy __((SNMP_NOTIFY_FILTER_T *)); +extern int SNMP_Notify_Filter_Install __((SNMP_NOTIFY_FILTER_T *, bits8_t *, + ALENGTH_T, OBJ_ID_T *)); +extern void SNMP_Notify_Filter_Deinstall __((SNMP_NOTIFY_FILTER_T *)); +extern SNMP_NOTIFY_FILTER_T * SNMP_Notify_Filter_Lookup + __((bits8_t *, ALENGTH_T, OBJ_ID_T *)); +extern SNMP_NOTIFY_FILTER_T * SNMP_Notify_Filter_Next __((int, OIDC_T *)); +extern SNMP_NOTIFY_FILTER_T * SNMP_Notify_Filter_Next_Filter + __((SNMP_NOTIFY_FILTER_T *)); +extern void SNMP_Notify_Filter_Name __((SNMP_NOTIFY_FILTER_T *, + bits8_t *, ALENGTH_T *, + OIDC_T **, int *)); + +#define SNMP_Notify_Filter_Get_Profile(N) \ + (EBufferStart(&((N)->profile_name))) +#define SNMP_Notify_Filter_Get_Profile_Len(N) \ + (EBufferUsed(&((N)->profile_name))) + +#define SNMP_Notify_Filter_Get_Subtree(N) (&((N)->subtree)) + +#define SNMP_Notify_Filter_Get_Mask(N) \ + (EBufferStart(&((N)->filter_mask))) +#define SNMP_Notify_Filter_Get_Mask_Len(N) \ + (EBufferUsed(&((N)->filter_mask))) +#define SNMP_Notify_Filter_Set_Mask(N, S, L, F) \ + (EBufferAllocateLoad((F), &((N)->filter_mask), (S), (L))) + +#define SNMP_Notify_Filter_Get_Type(N) ((N)->filter_type) +#define SNMP_Notify_Filter_Set_Type(N, V) ((N)->filter_type = (bits16_t)(V)) + +#define SNMP_Notify_Filter_Get_Storage(N) ((N)->storage) +#define SNMP_Notify_Filter_Set_Storage(N, V) ((N)->storage = (bits16_t)(V)) + +#define SNMP_Notify_Filter_Get_Status(N) ((N)->status) +#define SNMP_Notify_Filter_Set_Status(N, V) ((N)->status = (bits16_t)(V)) + +#define SNMP_Notify_Filter_Get_Flags(N) ((N)->flags) +#define SNMP_Notify_Filter_Set_Flags(N, V) ((N)->flags = (bits16_t)(V)) + +extern void snmpNotifyEntry_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void snmpNotifyEntry_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void snmpNotifyEntry_test __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void snmpNotifyEntry_set __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void snmpNotifyFilterProfileEntry_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void snmpNotifyFilterProfileEntry_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void snmpNotifyFilterProfileEntry_test __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void snmpNotifyFilterProfileEntry_set __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void snmpNotifyFilterEntry_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void snmpNotifyFilterEntry_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void snmpNotifyFilterEntry_test __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void snmpNotifyFilterEntry_set __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +/* The leaf definitions for the method routines */ +#define LEAF_snmpNotifyName 1 +#define MINSIZE_snmpNotifyName 1L +#define MAXSIZE_snmpNotifyName 32L +#define LEAF_snmpNotifyTag 2 +#define MINSIZE_snmpNotifyTag 0L +#define MAXSIZE_snmpNotifyTag 255L +#define LEAF_snmpNotifyType 3 +#define VAL_snmpNotifyType_trap 1L +#define VAL_snmpNotifyType_inform 2L +#define LEAF_snmpNotifyStorageType 4 +#define VAL_snmpNotifyStorageType_other 1L +#define VAL_snmpNotifyStorageType_volatile 2L +#define VAL_snmpNotifyStorageType_nonVolatile 3L +#define VAL_snmpNotifyStorageType_permanent 4L +#define VAL_snmpNotifyStorageType_readOnly 5L +#define LEAF_snmpNotifyRowStatus 5 +#define VAL_snmpNotifyRowStatus_active 1L +#define VAL_snmpNotifyRowStatus_notInService 2L +#define VAL_snmpNotifyRowStatus_notReady 3L +#define VAL_snmpNotifyRowStatus_createAndGo 4L +#define VAL_snmpNotifyRowStatus_createAndWait 5L +#define VAL_snmpNotifyRowStatus_destroy 6L +#define LEAF_snmpNotifyFilterProfileName 1 +#define MINSIZE_snmpNotifyFilterProfileName 1L +#define MAXSIZE_snmpNotifyFilterProfileName 32L +#define LEAF_snmpNotifyFilterProfileStorType 2 +#define VAL_snmpNotifyFilterProfileStorType_other 1L +#define VAL_snmpNotifyFilterProfileStorType_volatile 2L +#define VAL_snmpNotifyFilterProfileStorType_nonVolatile 3L +#define VAL_snmpNotifyFilterProfileStorType_permanent 4L +#define VAL_snmpNotifyFilterProfileStorType_readOnly 5L +#define LEAF_snmpNotifyFilterProfileRowStatus 3 +#define VAL_snmpNotifyFilterProfileRowStatus_active 1L +#define VAL_snmpNotifyFilterProfileRowStatus_notInService 2L +#define VAL_snmpNotifyFilterProfileRowStatus_notReady 3L +#define VAL_snmpNotifyFilterProfileRowStatus_createAndGo 4L +#define VAL_snmpNotifyFilterProfileRowStatus_createAndWait 5L +#define VAL_snmpNotifyFilterProfileRowStatus_destroy 6L +#define LEAF_snmpNotifyFilterSubtree 1 +#define LEAF_snmpNotifyFilterMask 2 +#define MINSIZE_snmpNotifyFilterMask 0L +#define MAXSIZE_snmpNotifyFilterMask 16L +#define LEAF_snmpNotifyFilterType 3 +#define VAL_snmpNotifyFilterType_included 1L +#define VAL_snmpNotifyFilterType_excluded 2L +#define LEAF_snmpNotifyFilterStorageType 4 +#define VAL_snmpNotifyFilterStorageType_other 1L +#define VAL_snmpNotifyFilterStorageType_volatile 2L +#define VAL_snmpNotifyFilterStorageType_nonVolatile 3L +#define VAL_snmpNotifyFilterStorageType_permanent 4L +#define VAL_snmpNotifyFilterStorageType_readOnly 5L +#define LEAF_snmpNotifyFilterRowStatus 5 +#define VAL_snmpNotifyFilterRowStatus_active 1L +#define VAL_snmpNotifyFilterRowStatus_notInService 2L +#define VAL_snmpNotifyFilterRowStatus_notReady 3L +#define VAL_snmpNotifyFilterRowStatus_createAndGo 4L +#define VAL_snmpNotifyFilterRowStatus_createAndWait 5L +#define VAL_snmpNotifyFilterRowStatus_destroy 6L + +#ifdef __cplusplus +} +#endif + +#endif /* #if (!defined(v3_ntfy_inc))*/ diff --git a/h/wrn/wm/snmp/engine/v3_priv.h b/h/wrn/wm/snmp/engine/v3_priv.h new file mode 100644 index 0000000..727b35a --- /dev/null +++ b/h/wrn/wm/snmp/engine/v3_priv.h @@ -0,0 +1,137 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/v3_priv.h,v 1.2 2001/11/06 21:35:06 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: v3_priv.h,v $ + * Revision 1.2 2001/11/06 21:35:06 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:24 tneale + * Tornado shuffle + * + * Revision 9.4 2001/01/19 22:22:12 paul + * Update copyright. + * + * Revision 9.3 2000/03/17 19:48:46 meister + * Update copyright notice + * + * Revision 9.2 2000/03/09 20:58:36 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.1 2000/03/09 17:06:57 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.0 1998/10/16 22:10:26 sar + * Update version stamp to match release + * + * Revision 1.3 1998/08/12 04:52:17 sar + * revamp the initialization routines to limit the amount of + * code that might get pulled in. + * + * Revision 1.2 1998/05/27 22:53:53 sar + * Add routines to manipulate the auth and priv lists (add and find), + * as well as some specifics adds (md5, sha) + * + * Revision 1.1 1998/05/23 19:49:40 sar + * Include files for use with v3 code. They define the structures + * and entry points for the various pieces. + * acc: access and group information + * auth & priv: authentication and privacy + * con: context + * eng: engine ids, both this agents and any others it knows + * mth: method routines, for use with mib control files + * user: user info + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(v3_priv_inc)) +#define v3_priv_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1_inc)) +#include +#endif + +typedef ALENGTH_T (V3_PRIV_SIZE_T) __((ptr_t, ALENGTH_T)); +typedef int (V3_PRIV_ENCODE_T) __((bits8_t *, ALENGTH_T, sbits32_t, + bits8_t *, ALENGTH_T, + bits8_t *, bits8_t *)); +typedef int (V3_PRIV_DECODE_T) __((bits8_t *, ALENGTH_T, + bits8_t *, ALENGTH_T, + bits8_t *, bits8_t *)); + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +typedef struct SNMP_PRIV_S + { + struct SNMP_PRIV_S *next; + OBJ_ID_T name; /* name of the priv protocol */ + V3_PRIV_SIZE_T *size; /* routine to calculate the size */ + V3_PRIV_ENCODE_T *encode; /* routine to encode */ + V3_PRIV_DECODE_T *decode; /* routine to decode */ + ALENGTH_T need; /* space required for priv stuff */ + ALENGTH_T keysize; /* space required for the key */ + } SNMP_PRIV_T; + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + + +/* global root pointer for the auth list */ +extern SNMP_PRIV_T *v3_priv_root; + +extern SNMP_PRIV_T * SNMP_Priv_Find __((int, OIDC_T *)); +extern int SNMP_Priv_Add __((SNMP_PRIV_T *)); +extern int SNMP_Priv_Add_DES __((void)); + +#define SNMP_Priv_Size(P, PKT, SL) (((P)->size)((PKT), (SL))) +#define SNMP_Priv_Encode(P, K, KL, BT, B, BL, SP, OP) \ + (((P)->encode)((K), (KL), (BT), (B), (BL), (SP), (OP))) +#define SNMP_Priv_Decode(P, K, KL, B, BL, SP, OP) \ + (((P)->decode)((K), (KL), (B), (BL), (SP), (OP))) + +#define SNMP_Priv_Get_KeySize(P) ((P)->keysize) +#define SNMP_Priv_Get_Need(P) ((P)->need) + +#define SNMP_Priv_Get_Name(P) (&((P)->name)) + +extern OIDC_T v3_priv_nopriv[]; +extern int v3_priv_nopriv_size; + +extern SNMP_PRIV_T v3_priv_des; + +#ifdef __cplusplus +} +#endif + +#endif /* #if (!defined(v3_priv_inc)) */ diff --git a/h/wrn/wm/snmp/engine/v3_proxy.h b/h/wrn/wm/snmp/engine/v3_proxy.h new file mode 100644 index 0000000..419f2cf --- /dev/null +++ b/h/wrn/wm/snmp/engine/v3_proxy.h @@ -0,0 +1,280 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/v3_proxy.h,v 1.2 2001/11/06 21:35:07 josh Exp $ */ + +/* v3_proxy.h - definitions for RFC 2573 Proxy code */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * All rights reserved. + ****************************************************************************/ + +/* +modification history +-------------------- +01c,19apr05,job update copyright notices +01b,25nov03,ps copyright update +01a,25aug03,job fixing a prototype mismatch +$Log: v3_proxy.h,v $ +Revision 1.2 2001/11/06 21:35:07 josh +new revised path structure, first pass. Also removing useless +shell include files. + +Revision 1.1.1.1 2001/11/05 17:47:24 tneale +Tornado shuffle + +Revision 9.4.2.4 2001/09/21 19:16:07 josh +updating and expanding structures for use with coexistence + +Revision 9.4.2.3 2001/08/31 17:02:20 josh +clean up a few nits + +Revision 9.4.2.2 2001/08/24 14:31:24 josh +adding function prototypes for the proxy processing routines + +Revision 9.4.2.1 2001/06/28 18:22:57 josh +Seeding the Cormorant branch with the code from the old +cormorant branch + +Revision 9.3.2.1 2001/04/11 19:35:41 josh +moving cormorant-specific files onto the special +cormorant branch so they don't get in kingfisher's way + +Revision 9.3 2001/01/19 22:22:12 paul +Update copyright. + +Revision 9.2 2000/07/12 18:42:27 josh +definitions for proxy control block and associated flags and +structures + +Revision 9.1 2000/06/09 14:54:13 josh +modifications due to new installation options, new proxy code +moved some definitions from sendntfy.h into v3_trgt.h so they'd +be built with the target code + + +*/ + +#if (!defined(__INCv3Proxyh)) +#define __INCv3Proxyh + +#ifdef __cplusplus +extern"C" { +#endif /* __cplusplus */ + +#include +#include +#include +#include + +#define ETC_PROXY_NAME_MAX 32 + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +typedef struct SNMP_PROXY_S + { + struct SNMP_PROXY_S *next; /* next proxy object in list */ + struct EBUFFER_S proxy_name; /* the name of the proxy object */ + struct EBUFFER_S context_engine_id; /* engine id of this proxy */ + struct EBUFFER_S context_name; /* context name of proxy */ + struct EBUFFER_S target_params_in; /* for endpoint matching */ + struct EBUFFER_S single_target_out; /* for forwarding of requests */ + struct EBUFFER_S multiple_target_out; /* for forwarding of notifies */ + ETC_STORAGE_T storage; /* storage type of this object */ + ETC_STATUS_T status; /* row status of this object */ + bits8_t proxy_type; /* read, write, trap or inform */ + } SNMP_PROXY_T; + +/* global root pointer for target params list */ +extern SNMP_PROXY_T *root_proxy; + +#define SNMP_Proxy_Set_Defaults(P) \ + (MEMSET((P), 0, sizeof(SNMP_PROXY_T)), \ + EBufferInitialize(&((P)->proxy_name)), \ + EBufferInitialize(&((P)->context_engine_id)), \ + EBufferInitialize(&((P)->context_name)), \ + EBufferInitialize(&((P)->target_params_in)), \ + EBufferInitialize(&((P)->single_target_out)), \ + EBufferInitialize(&((P)->multiple_target_out)), \ + (P)->storage = ETC_STO_NONVOL, \ + (P)->status = ETC_RS_NREADY) + +/* values for the proxy_type field */ +#define PROXY_TYPE_READ 1 +#define PROXY_TYPE_WRITE 2 +#define PROXY_TYPE_TRAP 3 +#define PROXY_TYPE_INFORM 4 + +extern SNMP_PROXY_T * SNMP_Proxy_Create __((void)); +extern void SNMP_Proxy_Destroy __((SNMP_PROXY_T * proxy)); +extern envoy_err_t SNMP_Proxy_Install __((SNMP_PROXY_T * proxy, + bits8_t * proxy_name, + ALENGTH_T proxy_name_len)); +extern void SNMP_Proxy_Deinstall __((SNMP_PROXY_T * proxy)); +extern SNMP_PROXY_T * SNMP_Proxy_Lookup __((bits8_t * proxy_name, + ALENGTH_T proxy_name_len)); +extern SNMP_PROXY_T * SNMP_Proxy_Next __((int tcount, + OIDC_T * tlist)); +extern SNMP_PROXY_T * SNMP_Proxy_Next_Proxy __((SNMP_PROXY_T * proxy)); +extern void SNMP_Proxy_Name __((SNMP_PROXY_T * proxy, + bits8_t * proxy_name, + ALENGTH_T * proxy_name_len)); + +#define SNMP_Proxy_Get_Proxy_Name(P) (EBufferStart(&((P)->proxy_name))) +#define SNMP_Proxy_Get_Proxy_Name_Len(P) (EBufferUsed(&((P)->proxy_name))) + +#define SNMP_Proxy_Get_Proxy_Type(P) ((P)->proxy_type) +#define SNMP_Proxy_Set_Proxy_Type(P, V) ((P)->proxy_type = (bits16_t)(V)) + +#define SNMP_Proxy_Get_Context_Engine_ID(P) \ +(EBufferStart(&((P)->context_engine_id))) +#define SNMP_Proxy_Get_Context_Engine_ID_Len(P) \ + (EBufferUsed(&((P)->context_engine_id))) +#define SNMP_Proxy_Set_Context_Engine_ID(P, S, L, F) \ + (EBufferAllocateLoad((F), &((P)->context_engine_id), (S), (L))) + +#define SNMP_Proxy_Get_Context_Name(P) (EBufferStart(&((P)->context_name))) +#define SNMP_Proxy_Get_Context_Name_Len(P) (EBufferUsed(&((P)->context_name))) +#define SNMP_Proxy_Set_Context_Name(P, S, L, F) \ + (EBufferAllocateLoad((F), &((P)->context_name), (S), (L))) + +#define SNMP_Proxy_Get_Target_Params_In(P) \ + (EBufferStart(&((P)->target_params_in))) +#define SNMP_Proxy_Get_Target_Params_In_Len(P) \ + (EBufferUsed(&((P)->target_params_in))) +#define SNMP_Proxy_Set_Target_Params_In(P, S, L, F) \ + (EBufferAllocateLoad((F), &((P)->target_params_in), (S), (L))) + +#define SNMP_Proxy_Get_Single_Target_Out(P) \ + (EBufferStart(&((P)->single_target_out))) +#define SNMP_Proxy_Get_Single_Target_Out_Len(P) \ + (EBufferUsed(&((P)->single_target_out))) +#define SNMP_Proxy_Set_Single_Target_Out(P, S, L, F) \ + (EBufferAllocateLoad((F), &((P)->single_target_out), (S), (L))) + +#define SNMP_Proxy_Get_Multiple_Target_Out(P) \ + (EBufferStart(&((P)->multiple_target_out))) +#define SNMP_Proxy_Get_Multiple_Target_Out_Len(P) \ + (EBufferUsed(&((P)->multiple_target_out))) +#define SNMP_Proxy_Set_Multiple_Target_Out(P, S, L, F) \ + (EBufferAllocateLoad((F), &((P)->multiple_target_out), (S), (L))) + +#define SNMP_Proxy_Get_Storage(P) ((P)->storage) +#define SNMP_Proxy_Set_Storage(P, V) ((P)->storage = (bits16_t)(V)) + +#define SNMP_Proxy_Get_Status(P) ((P)->status) +#define SNMP_Proxy_Set_Status(P, V) ((P)->status = (bits16_t)(V)) + +#define SNMP_Proxy_Get_Flags(P) ((P)->flags) +#define SNMP_Proxy_Set_Flags(P, V) ((P)->flags = (bits16_t)(V)) + +/* User-definable stuff */ +#ifndef PROXY_SWEEP_TIME +#define PROXY_SWEEP_TIME 3000 +#endif + +#ifndef ENVOY_SNMP_SEND_PROXY +#define ENVOY_SNMP_SEND_PROXY(FOR, LOC, PKT, SIZ) +#endif + +/* structure definition for proxy control block */ +struct TARGET_LIST_S; + +typedef struct SNMP_PROXY_CB_S + { + struct SNMP_PROXY_CB_S * next; + struct TARGET_LIST_S * targetList; + SNMP_PKT_T * originalPkt; + EBUFFER_T contextEngineID; + EBUFFER_T contextName; + EBUFFER_T secName; + EBUFFER_T communityString; + bits32_t msgID; + bits32_t expires; + bits8_t flags; + } SNMP_PROXY_CB_T; + +#define SNMP_PROXY_FLAGS_EXPIRED 0x01 +#define SNMP_PROXY_FLAGS_RESPONDED 0x02 +#define SNMP_PROXY_FLAGS_VBLIST_COPIED 0x04 + +typedef struct SNMP_PROXY_CB_ROOT_S + { + SNMP_PROXY_CB_T * pcb; + bits32_t * nextMsgID; + ENVOY_TIMER_T timer; + } SNMP_PROXY_CB_ROOT_T; + +extern SNMP_PROXY_CB_ROOT_T root_proxy_block; + +extern envoy_err_t snmpProxyV3Request __((SNMP_PKT_T *)); + +extern envoy_err_t snmpProxyV3Notify __((SNMP_PKT_T *)); + +extern envoy_err_t snmpProxyV3Response __((SNMP_PKT_T *)); + +extern void snmpProxyEntry_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void snmpProxyEntry_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void snmpProxyEntry_test __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void snmpProxyEntry_set __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +/* Definitions of leaf nodes for MIB support */ + +#define LEAF_snmpProxyName 1 +#define MINSIZE_snmpProxyName 1L +#define MAXSIZE_snmpProxyName 32L +#define LEAF_snmpProxyType 2 +#define VAL_snmpProxyType_read 1L +#define VAL_snmpProxyType_write 2L +#define VAL_snmpProxyType_trap 3L +#define VAL_snmpProxyType_inform 4L +#define LEAF_snmpProxyContextEngineID 3 +#define MINSIZE_snmpProxyContextEngineID 5L +#define MAXSIZE_snmpProxyContextEngineID 32L +#define LEAF_snmpProxyContextName 4 +#define MINSIZE_snmpProxyContextName 0L +#define MAXSIZE_snmpProxyContextName 255L +#define LEAF_snmpProxyTargetParamsIn 5 +#define MINSIZE_snmpProxyTargetParamsIn 0L +#define MAXSIZE_snmpProxyTargetParamsIn 255L +#define LEAF_snmpProxySingleTargetOut 6 +#define MINSIZE_snmpProxySingleTargetOut 0L +#define MAXSIZE_snmpProxySingleTargetOut 255L +#define LEAF_snmpProxyMultipleTargetOut 7 +#define MINSIZE_snmpProxyMultipleTargetOut 0L +#define MAXSIZE_snmpProxyMultipleTargetOut 255L +#define LEAF_snmpProxyStorageType 8 +#define VAL_snmpProxyStorageType_other 1L +#define VAL_snmpProxyStorageType_volatile 2L +#define VAL_snmpProxyStorageType_nonVolatile 3L +#define VAL_snmpProxyStorageType_permanent 4L +#define VAL_snmpProxyStorageType_readOnly 5L +#define LEAF_snmpProxyRowStatus 9 +#define VAL_snmpProxyRowStatus_active 1L +#define VAL_snmpProxyRowStatus_notInService 2L +#define VAL_snmpProxyRowStatus_notReady 3L +#define VAL_snmpProxyRowStatus_createAndGo 4L +#define VAL_snmpProxyRowStatus_createAndWait 5L +#define VAL_snmpProxyRowStatus_destroy 6L + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __INCv3Proxyh */ diff --git a/h/wrn/wm/snmp/engine/v3_trgt.h b/h/wrn/wm/snmp/engine/v3_trgt.h new file mode 100644 index 0000000..46cb371 --- /dev/null +++ b/h/wrn/wm/snmp/engine/v3_trgt.h @@ -0,0 +1,417 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/v3_trgt.h,v 1.2 2001/11/06 21:35:07 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: v3_trgt.h,v $ + * Revision 1.2 2001/11/06 21:35:07 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:24 tneale + * Tornado shuffle + * + * Revision 9.8.4.2 2001/09/21 19:16:08 josh + * updating and expanding structures for use with coexistence + * + * Revision 9.8.4.1 2001/07/16 18:02:13 josh + * a first-round commit adding infrastructure support + * for the SNMPv3 Coexistence RFC (2576) + * + * Revision 9.8 2001/04/11 20:42:56 josh + * merge from the kingfisher branch + * + * Revision 9.7 2001/01/19 22:22:12 paul + * Update copyright. + * + * Revision 9.6 2000/06/09 14:54:13 josh + * modifications due to new installation options, new proxy code + * moved some definitions from sendntfy.h into v3_trgt.h so they'd + * be built with the target code + * + * Revision 9.5.2.2 2001/03/12 22:08:02 tneale + * Updated copyright + * + * Revision 9.5.2.1 2000/09/21 21:14:55 josh + * bringing branch include files in line with root + * + * Revision 9.5 2000/03/17 19:48:47 meister + * Update copyright notice + * + * Revision 9.4 2000/03/09 20:58:36 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.3 2000/03/09 17:07:15 tneale + * Added #ifdef for C++ to declare extern C if needed + * + * Revision 9.2 2000/02/04 21:54:25 josh + * prototyping functions that may need to be called by other modules + * this is done primarily to make the vxWorks compiler happy. + * Warning: the prototypes added may be duplicated by a mib_hand.h + * file generated by Emissary. + * + * Revision 9.1 2000/01/02 22:55:56 josh + * patching up a memory leak here, a broken compare there...per + * sar's comments + * + * Revision 9.0 1999/10/21 20:43:35 josh + * updating version stamps + * + * Revision 1.5 1999/10/21 19:13:09 josh + * adding flags for flags fields in various objects to help with row + * creation + * + * Revision 1.4 1999/10/15 17:47:26 josh + * included MIB leaf definitions and cleaned up useless macros + * + * Revision 1.3 1999/09/21 21:31:45 josh + * fixed a few structure access macros + * + * Revision 1.2 1999/09/14 19:35:26 josh + * updating default initialization per RFC 2573 + * + * Revision 1.1 1999/06/16 17:04:23 josh + * First step of adding RFC2573 Notify support. + * + * + */ + + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(v3_trgt_inc)) +#define v3_trgt_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1_inc)) +#include +#endif + +#if (!defined(buffer_inc)) +#include +#endif + +#if (!defined(smi_inc)) +#include +#endif + +#define ETC_TARGET_ADDR_MAX 32 +#define ETC_TARGET_PARAMS_MAX 32 + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +typedef struct SNMP_TARGET_ADDR_S + { + struct SNMP_TARGET_ADDR_S *next; + EBUFFER_T target_name; /* the name of the target */ + OBJ_ID_T tdomain; /* the transport domain */ + EBUFFER_T taddress; /* target address */ + EBUFFER_T tmask; /* target mask */ + sbits32_t timeout; /* interval between retr. */ + bits16_t retry_count; /* number of retrans. */ + bits32_t target_mms; /* max message size */ + EBUFFER_T tag_list; /* list of magic labels */ + EBUFFER_T params; /* name of SNMP_TARGET_PARAM_T */ + bits16_t storage; + bits16_t status; + bits16_t flags; + } SNMP_TARGET_ADDR_T; + +#define ETC_TADDR_TDOMAIN 0x01 +#define ETC_TADDR_TADDRESS 0x02 +#define ETC_TADDR_PARAMS 0x04 +#define ETC_TADDR_ALL_FLAGS 0x07 + +#define ETC_TADDR_TIMEOUT 1500 +#define ETC_TADDR_RETRY_COUNT 3 +#define ETC_TADDR_MMS 484 + +/* global root pointer for target params list */ +extern SNMP_TARGET_ADDR_T *root_target_addr; + +#define SNMP_Target_Addr_Set_Defaults(T) \ + (MEMSET((T), 0, sizeof(SNMP_TARGET_ADDR_T)), \ + EBufferInitialize(&((T)->target_name)), \ + EBufferInitialize(&((T)->taddress)), \ + EBufferInitialize(&((T)->tmask)), \ + EBufferInitialize(&((T)->tag_list)), \ + EBufferInitialize(&((T)->params)), \ + (T)->timeout = ETC_TADDR_TIMEOUT, \ + (T)->retry_count = ETC_TADDR_RETRY_COUNT, \ + (T)->target_mms = ETC_TADDR_MMS, \ + (T)->storage = ETC_STO_NONVOL, \ + (T)->status = ETC_RS_NREADY, \ + (T)->flags = 0) + +extern SNMP_TARGET_ADDR_T * SNMP_Target_Addr_Create __((void)); +extern void SNMP_Target_Addr_Destroy __((SNMP_TARGET_ADDR_T *)); +extern int SNMP_Target_Addr_Install __((SNMP_TARGET_ADDR_T *, bits8_t *, + ALENGTH_T)); +extern void SNMP_Target_Addr_Deinstall __((SNMP_TARGET_ADDR_T *)); +extern SNMP_TARGET_ADDR_T * SNMP_Target_Addr_Lookup __((bits8_t *, ALENGTH_T)); +extern SNMP_TARGET_ADDR_T * SNMP_Target_Addr_Next __((int, OIDC_T *)); +extern SNMP_TARGET_ADDR_T * SNMP_Target_Addr_Next_Addr __((SNMP_TARGET_ADDR_T *)); +extern void SNMP_Target_Addr_Name __((SNMP_TARGET_ADDR_T *, bits8_t *, + ALENGTH_T *)); + +#define SNMP_Target_Addr_Get_Name(T) (EBufferStart(&((T)->target_name))) +#define SNMP_Target_Addr_Get_Name_Len(T) (EBufferUsed(&((T)->target_name))) + +#define SNMP_Target_Addr_Get_TDomain(T) (&((T)->tdomain)) +#define SNMP_Target_Addr_Set_TDomain(T, D, L) \ + (build_object_id((L), (D), (&((T)->tdomain)))) + +#define SNMP_Target_Addr_Get_TAddress(T) (EBufferStart(&((T)->taddress))) +#define SNMP_Target_Addr_Get_TAddress_Len(T) (EBufferUsed(&((T)->taddress))) +#define SNMP_Target_Addr_Set_TAddress(T, S, L, F) \ + (EBufferAllocateLoad((F), &((T)->taddress), (S), (L))) + +#define SNMP_Target_Addr_Get_TMask(T) (EBufferStart(&((T)->tmask))) +#define SNMP_Target_Addr_Get_TMask_Len(T) (EBufferUsed(&((T)->tmask))) +#define SNMP_Target_Addr_Set_TMask(T, S, L, F) \ + (EBufferAllocateLoad((F), &((T)->tmask), (S), (L))) + +#define SNMP_Target_Addr_Get_Timeout(T) ((T)->timeout) +#define SNMP_Target_Addr_Set_Timeout(T, V) ((T)->timeout = (sbits32_t)(V)) + +#define SNMP_Target_Addr_Get_Retry_Count(T) ((T)->retry_count) +#define SNMP_Target_Addr_Set_Retry_Count(T, V) ((T)->retry_count = (bits16_t)(V)) + +#define SNMP_Target_Addr_Get_MMS(T) ((T)->target_mms) +#define SNMP_Target_Addr_Set_MMS(T, V) ((T)->target_mms = (bits16_t)(V)) + +#define SNMP_Target_Addr_Get_Tag_List(T) (EBufferStart(&((T)->tag_list))) +#define SNMP_Target_Addr_Get_Tag_List_Len(T) (EBufferUsed(&((T)->tag_list))) +#define SNMP_Target_Addr_Set_Tag_List(T, S, L, F) \ + (EBufferAllocateLoad((F), &((T)->tag_list), (S), (L))) + +#define SNMP_Target_Addr_Get_Params(T) (EBufferStart(&((T)->params))) +#define SNMP_Target_Addr_Get_Params_Len(T) (EBufferUsed(&((T)->params))) +#define SNMP_Target_Addr_Set_Params(T, S, L, F) \ + (EBufferAllocateLoad((F), &((T)->params), (S), (L))) + +#define SNMP_Target_Addr_Get_Storage(T) ((T)->storage) +#define SNMP_Target_Addr_Set_Storage(T, V) ((T)->storage = (bits16_t)(V)) + +#define SNMP_Target_Addr_Get_Status(T) ((T)->status) +#define SNMP_Target_Addr_Set_Status(T, V) ((T)->status = (bits16_t)(V)) + +#define SNMP_Target_Addr_Get_Flags(T) ((T)->flags) +#define SNMP_Target_Addr_Set_Flags(T, V) ((T)->flags = (bits16_t)(V)) + +typedef struct SNMP_TARGET_PARAMS_S + { + struct SNMP_TARGET_PARAMS_S *next; + EBUFFER_T params_name; /* name of the params object */ + sbits32_t mp_model; /* SNMP version, roughly */ + sbits32_t sec_model; /* security model */ + EBUFFER_T sec_name; /* security name, aka user */ + bits16_t sec_level; /* security level (auth/priv) */ + bits16_t storage; + bits16_t status; + bits16_t flags; + } SNMP_TARGET_PARAMS_T; + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + +#define ETC_TPARAM_MPMODEL 0x01 +#define ETC_TPARAM_SECMODEL 0x02 +#define ETC_TPARAM_SECNAME 0x04 +#define ETC_TPARAM_SECLEVEL 0x08 +#define ETC_TPARAM_ALL_FLAGS 0x0F + +/* global root pointer for target params list */ +extern SNMP_TARGET_PARAMS_T *root_target_params; + +#define SNMP_Target_Params_Set_Defaults(G) \ + (MEMSET((G), 0, sizeof(SNMP_TARGET_PARAMS_T)), \ + EBufferInitialize(&((G)->params_name)), \ + EBufferInitialize(&((G)->sec_name)), \ + (G)->storage = ETC_STO_NONVOL, \ + (G)->status = ETC_RS_NREADY, \ + (G)->flags = 0) + +extern SNMP_TARGET_PARAMS_T * SNMP_Target_Params_Create __((void)); +extern void SNMP_Target_Params_Destroy __((SNMP_TARGET_PARAMS_T *)); +extern int SNMP_Target_Params_Install __((SNMP_TARGET_PARAMS_T *, bits8_t *, + ALENGTH_T)); +extern void SNMP_Target_Params_Deinstall __((SNMP_TARGET_PARAMS_T *)); +extern SNMP_TARGET_PARAMS_T * SNMP_Target_Params_Lookup __((bits8_t *, + ALENGTH_T)); +extern SNMP_TARGET_PARAMS_T * SNMP_Target_Params_Next __((int, OIDC_T *)); +extern SNMP_TARGET_PARAMS_T * SNMP_Target_Params_Next_Params + __((SNMP_TARGET_PARAMS_T *)); +extern void SNMP_Target_Params_Name __((SNMP_TARGET_PARAMS_T *, + bits8_t *, ALENGTH_T *)); + +#define SNMP_Target_Params_Get_Name(T) (EBufferStart(&((T)->params_name))) +#define SNMP_Target_Params_Get_Name_Len(T) (EBufferUsed(&((T)->params_name))) + +#define SNMP_Target_Params_Get_MP_Model(T) ((T)->mp_model) +#define SNMP_Target_Params_Set_MP_Model(T, V) ((T)->mp_model = (sbits32_t)(V)) + +#define SNMP_Target_Params_Get_Sec_Model(T) ((T)->sec_model) +#define SNMP_Target_Params_Set_Sec_Model(T, V) ((T)->sec_model = (sbits32_t)(V)) + +#define SNMP_Target_Params_Get_Sec_Name(T) (EBufferStart(&((T)->sec_name))) +#define SNMP_Target_Params_Get_Sec_Name_Len(T) (EBufferUsed(&((T)->sec_name))) +#define SNMP_Target_Params_Set_Sec_Name(T, S, L, F) \ + (EBufferAllocateLoad((F), &((T)->sec_name), (S), (L))) + +#define SNMP_Target_Params_Get_Sec_Level(T) ((T)->sec_level) +#define SNMP_Target_Params_Set_Sec_Level(T, V) ((T)->sec_level = (bits16_t)(V)) + +#define SNMP_Target_Params_Get_Storage(T) ((T)->storage) +#define SNMP_Target_Params_Set_Storage(T, V) ((T)->storage = (bits16_t)(V)) + +#define SNMP_Target_Params_Get_Status(T) ((T)->status) +#define SNMP_Target_Params_Set_Status(T, V) ((T)->status = (bits16_t)(V)) + +#define SNMP_Target_Params_Get_Flags(T) ((T)->flags) +#define SNMP_Target_Params_Set_Flags(T, V) ((T)->flags = (bits16_t)(V)) + +extern sbits32_t v3_snmpTargetSpinLock; + +extern void snmpTargetAddrEntry_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void snmpTargetAddrEntry_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void snmpTargetAddrEntry_test __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void snmpTargetAddrEntry_set __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void snmpTargetParamsEntry_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void snmpTargetParamsEntry_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void snmpTargetParamsEntry_test __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void snmpTargetParamsEntry_set __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +#ifndef ENVOY_SNMPADDR_TO_TADDRESS +#define ENVOY_USE_DEFAULT_SNMPADDR 1 +#define ENVOY_SNMPADDR_TO_TADDRESS(A, D, T) \ + envoy_snmpaddr_to_taddress(A, D, T) + +extern int envoy_snmpaddr_to_taddress __((SNMPADDR_T *, OBJ_ID_T *, + EBUFFER_T *)); +#endif + +#ifndef ENVOY_TADDRESS_TO_SNMPADDR +#define ENVOY_USE_DEFAULT_TADDRESS 1 +#define ENVOY_TADDRESS_TO_SNMPADDR(A, D, T) \ + envoy_taddress_to_snmpaddr(A, D, T) + +extern int envoy_taddress_to_snmpaddr __((SNMPADDR_T *, OBJ_ID_T *, + EBUFFER_T *)); +#endif + +extern envoy_err_t copyVarBind __((VB_T *, int, SNMP_PKT_T *)); +extern int copyVarBindList __((VBL_T *, VBL_T *, sbits32_t)); +extern int SNMP_Convert_VB __((VBL_T *, OBJ_ID_T *, int *, + sbits32_t *, bits32_t *)); +extern envoy_err_t copyNotifyVarBindList __((SNMP_PKT_T *, SNMP_PKT_T *)); + +/* The leaf definitions for the method routines */ +#define LEAF_snmpTargetAddrName 1 +#define MINSIZE_snmpTargetAddrName 1L +#define MAXSIZE_snmpTargetAddrName 32L +#define LEAF_snmpTargetAddrTDomain 2 +#define LEAF_snmpTargetAddrTAddress 3 +#define MINSIZE_snmpTargetAddrTAddress 1L +#define MAXSIZE_snmpTargetAddrTAddress 255L +#define LEAF_snmpTargetAddrTimeout 4 +#define MIN_snmpTargetAddrTimeout 0L +#define MAX_snmpTargetAddrTimeout 2147483647L +#define LEAF_snmpTargetAddrRetryCount 5 +#define MIN_snmpTargetAddrRetryCount 0L +#define MAX_snmpTargetAddrRetryCount 255L +#define LEAF_snmpTargetAddrTagList 6 +#define MINSIZE_snmpTargetAddrTagList 0L +#define MAXSIZE_snmpTargetAddrTagList 255L +#define LEAF_snmpTargetAddrParams 7 +#define MINSIZE_snmpTargetAddrParams 1L +#define MAXSIZE_snmpTargetAddrParams 32L +#define LEAF_snmpTargetAddrStorageType 8 +#define VAL_snmpTargetAddrStorageType_other 1L +#define VAL_snmpTargetAddrStorageType_volatile 2L +#define VAL_snmpTargetAddrStorageType_nonVolatile 3L +#define VAL_snmpTargetAddrStorageType_permanent 4L +#define VAL_snmpTargetAddrStorageType_readOnly 5L +#define LEAF_snmpTargetAddrRowStatus 9 +#define VAL_snmpTargetAddrRowStatus_active 1L +#define VAL_snmpTargetAddrRowStatus_notInService 2L +#define VAL_snmpTargetAddrRowStatus_notReady 3L +#define VAL_snmpTargetAddrRowStatus_createAndGo 4L +#define VAL_snmpTargetAddrRowStatus_createAndWait 5L +#define VAL_snmpTargetAddrRowStatus_destroy 6L +#define LEAF_snmpTargetParamsName 1 +#define MINSIZE_snmpTargetParamsName 1L +#define MAXSIZE_snmpTargetParamsName 32L +#define LEAF_snmpTargetParamsMPModel 2 +#define MIN_snmpTargetParamsMPModel 0L +#define MAX_snmpTargetParamsMPModel 2147483647L +#define LEAF_snmpTargetParamsSecurityModel 3 +#define MIN_snmpTargetParamsSecurityModel 1L +#define MAX_snmpTargetParamsSecurityModel 2147483647L +#define LEAF_snmpTargetParamsSecurityName 4 +#define MINSIZE_snmpTargetParamsSecurityName 0L +#define MAXSIZE_snmpTargetParamsSecurityName 255L +#define LEAF_snmpTargetParamsSecurityLevel 5 +#define VAL_snmpTargetParamsSecurityLevel_noAuthNoPriv 1L +#define VAL_snmpTargetParamsSecurityLevel_authNoPriv 2L +#define VAL_snmpTargetParamsSecurityLevel_authPriv 3L +#define LEAF_snmpTargetParamsStorageType 6 +#define VAL_snmpTargetParamsStorageType_other 1L +#define VAL_snmpTargetParamsStorageType_volatile 2L +#define VAL_snmpTargetParamsStorageType_nonVolatile 3L +#define VAL_snmpTargetParamsStorageType_permanent 4L +#define VAL_snmpTargetParamsStorageType_readOnly 5L +#define LEAF_snmpTargetParamsRowStatus 7 +#define VAL_snmpTargetParamsRowStatus_active 1L +#define VAL_snmpTargetParamsRowStatus_notInService 2L +#define VAL_snmpTargetParamsRowStatus_notReady 3L +#define VAL_snmpTargetParamsRowStatus_createAndGo 4L +#define VAL_snmpTargetParamsRowStatus_createAndWait 5L +#define VAL_snmpTargetParamsRowStatus_destroy 6L + + +#ifdef __cplusplus +} +#endif + +#endif /* #if (!defined(v3_trgt_inc))*/ diff --git a/h/wrn/wm/snmp/engine/v3_user.h b/h/wrn/wm/snmp/engine/v3_user.h new file mode 100644 index 0000000..afd8ce2 --- /dev/null +++ b/h/wrn/wm/snmp/engine/v3_user.h @@ -0,0 +1,299 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/v3_user.h,v 1.2 2001/11/06 21:35:07 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: v3_user.h,v $ + * Revision 1.2 2001/11/06 21:35:07 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:24 tneale + * Tornado shuffle + * + * Revision 9.7 2001/01/19 22:22:13 paul + * Update copyright. + * + * Revision 9.6 2000/03/17 19:48:47 meister + * Update copyright notice + * + * Revision 9.5 2000/03/09 20:58:36 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.4 2000/03/09 17:14:06 tneale + * Added #ifdef for C++ to extern C if needed + * + * Revision 9.3 2000/02/04 21:54:26 josh + * prototyping functions that may need to be called by other modules + * this is done primarily to make the vxWorks compiler happy. + * Warning: the prototypes added may be duplicated by a mib_hand.h + * file generated by Emissary. + * + * Revision 9.2 1999/11/02 20:55:18 josh + * bringing usmUserTable into line with new spec: RFC 2574 + * allows changing of auth and priv protocols after clone, + * allows row creation without initial clone, and allows enabling of rows + * without keychange for unused protocols (no authkeychange required if + * not using auth, etc.) + * + * Revision 9.1 1999/09/30 21:56:14 josh + * change public field to public_data so as not to conflict with + * C++ compilers + * + * Revision 9.0 1998/10/16 22:10:27 sar + * Update version stamp to match release + * + * Revision 1.7 1998/08/12 04:52:17 sar + * revamp the initialization routines to limit the amount of + * code that might get pulled in. + * + * Revision 1.6 1998/08/01 17:28:37 sar + * Removed the id check flag + * + * Revision 1.5 1998/07/01 01:48:20 sar + * As part of the set_defaults macro do a memset to zero the memory + * + * Revision 1.4 1998/06/30 00:30:58 sar + * Added macros to get and set user flags (cloned, authed and prived) + * + * Revision 1.3 1998/06/16 05:30:38 sar + * modify the api for the next routine + * split the engine id into its own struct + * + * Revision 1.2 1998/05/30 02:52:07 sar + * Modifed the names used for max string length + * Updated user lookup + * + * Revision 1.1 1998/05/23 19:49:41 sar + * Include files for use with v3 code. They define the structures + * and entry points for the various pieces. + * acc: access and group information + * auth & priv: authentication and privacy + * con: context + * eng: engine ids, both this agents and any others it knows + * mth: method routines, for use with mib control files + * user: user info + * + */ + +/* [clearcase] +modification history +------------------- +01a,15apr05,AJS Diffie-Hellman work +01a,13apr05,AJS Diffie-Hellman work +*/ + + +#if (!defined(v3_user_inc)) +#define v3_user_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1_inc)) +#include +#endif + +#if (!defined(buffer_inc)) +#include +#endif + +#if (!defined(v3_auth_inc)) +#include +#endif + +#if (!defined(v3_priv_inc)) +#include +#endif + +#if (!defined(v3_eng_inc)) +#include +#endif + +#if (!defined(smi_inc)) +#include +#endif + +#if INSTALL_SNMP_V3_DIFFIE_HELLMAN +#include +#include +#endif /* INSTALL_SNMP_V3_DIFFIE_HELLMAN */ + +#define ETC_USER_USER_MAX 32 +#define ETC_USER_ENGINE_MAX 32 +#define ENGINE_MAXNAMELEN 32 + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +#if INSTALL_SNMP_V3_DIFFIE_HELLMAN + +#define LEAF_usmDHParameters 1 +#define LEAF_usmDHUserAuthKeyChange 1 +#define LEAF_usmDHUserOwnAuthKeyChange 2 +#define LEAF_usmDHUserPrivKeyChange 3 +#define LEAF_usmDHUserOwnPrivKeyChange 4 + +typedef struct SNMP_DH_S + { + EBUFFER_T DHpubAuthKey; /* DH public authentication key */ + EBUFFER_T DHpubPrivKey; /* DH public privacy key */ + DH *DHauthValues; /* DH values for the auth key */ + DH *DHprivValues; /* DH values for the priv key */ + } SNMP_DH_T; + +typedef struct SNMP_DH_PARAMS_S + { + BIGNUM *prime; /* Large prime */ + BIGNUM *base; /* Generator; typically 2 or 5 */ + int pvl; /* Private value length, in bits */ + EBUFFER_T encodedString; /* Encoded string with values above */ + } SNMP_DH_PARAMS_T; + +extern int SNMP_init_DH (void); + +#endif /* INSTALL_SNMP_V3_DIFFIE_HELLMAN */ + +typedef struct SNMP_USER_ENG_S + { + struct SNMP_USER_ENG_S *next; + bits8_t *id; + ALENGTH_T id_len; + struct SNMP_USER_S *user; + } SNMP_USER_ENG_T; + +typedef struct SNMP_USER_S + { + SNMP_USER_ENG_T *parent; + struct SNMP_USER_S *next; + bits8_t *uname; + ALENGTH_T uname_len; + SNMP_AUTH_T *auth; + bits8_t *authkey; + SNMP_PRIV_T *priv; + bits8_t *privkey; + EBUFFER_T public_data; + bits8_t maxsec; + sbits16_t storage; + sbits16_t status; + sbits16_t flags; +#if INSTALL_SNMP_V3_DIFFIE_HELLMAN + SNMP_DH_T DH_keys; +#endif /* INSTALL_SNMP_V3_DIFFIE_HELLMAN */ + } SNMP_USER_T; + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + +#define ETC_USER_CLONED 0x01 +#define ETC_USER_AUTHED 0x02 +#define ETC_USER_PRIVED 0x04 +#define ETC_USER_VALID_AUTHKEY 0x08 +#define ETC_USER_VALID_PRIVKEY 0x10 +#define ETC_USER_ALL_FLAGS 0x1F + +/* global root pointer for the user list */ +extern SNMP_USER_ENG_T *root_user; + +#if INSTALL_SNMP_V3_DIFFIE_HELLMAN +#define SNMP_User_Set_Defaults(U) (MEMSET((U), 0, sizeof(SNMP_USER_T)), \ + EBufferInitialize(&((U)->public_data)), \ + EBufferInitialize(&((U)->DH_keys.DHpubAuthKey)), \ + EBufferInitialize(&((U)->DH_keys.DHpubPrivKey)), \ + (U)->storage = ETC_STO_NONVOL, \ + (U)->status = ETC_RS_NREADY) +#else +#define SNMP_User_Set_Defaults(U) (MEMSET((U), 0, sizeof(SNMP_USER_T)), \ + EBufferInitialize(&((U)->public_data)), \ + (U)->storage = ETC_STO_NONVOL, \ + (U)->status = ETC_RS_NREADY) +#endif /* INSTALL_SNMP_V3_DIFFIE_HELLMAN */ + + +extern SNMP_USER_T * SNMP_User_Lookup __((bits8_t *, ALENGTH_T, + bits8_t *, ALENGTH_T)); +extern SNMP_USER_T * SNMP_User_Next __((int, OIDC_T *)); +extern SNMP_USER_T * SNMP_User_Next_User __((SNMP_USER_T *)); +extern void SNMP_User_Destroy __((SNMP_USER_T *)); +extern SNMP_USER_T * SNMP_User_Create __((SNMP_AUTH_T *, SNMP_PRIV_T *)); +extern int SNMP_User_Install __((SNMP_USER_T *, + bits8_t *, ALENGTH_T, + bits8_t *, ALENGTH_T)); +extern void SNMP_User_Deinstall __((SNMP_USER_T *)); +extern void SNMP_User_Name __((SNMP_USER_T *, + bits8_t *, ALENGTH_T *, + bits8_t *, ALENGTH_T *)); + +extern void SNMP_User_Get_Sec_Name __((SNMP_USER_T *, bits8_t *, + ALENGTH_T *)); +extern int SNMP_User_Set_AuthKey __((SNMP_USER_T *, bits8_t *, + ALENGTH_T)); +extern int SNMP_User_Set_PrivKey __((SNMP_USER_T *, bits8_t *, + ALENGTH_T)); +extern int SNMP_User_Swap_Users __((SNMP_USER_T *, SNMP_USER_T *)); + +#define SNMP_User_Compare_Names(U1, U2) (((U1) == (U2)) ? 0 : 1) + +#define SNMP_User_Get_Auth(U) ((U)->auth) +#define SNMP_User_Get_AuthKey(U) ((U)->authkey) +#define SNMP_User_Get_Priv(U) ((U)->priv) +#define SNMP_User_Get_PrivKey(U) ((U)->privkey) +#define SNMP_User_Get_Public(U) (EBufferStart(&((U)->public_data))) +#define SNMP_User_Get_Public_Len(U) (EBufferUsed(&((U)->public_data))) +#define SNMP_User_Get_MaxSec(U) ((U)->maxsec) +#define SNMP_User_Get_Storage(U) ((U)->storage) +#define SNMP_User_Set_Storage(U, V) ((U)->storage = (sbits16_t)(V)) +#define SNMP_User_Get_Status(U) ((U)->status) +#define SNMP_User_Set_Status(U, V) ((U)->status = (sbits16_t)(V)) +#define SNMP_User_Get_Flags(U) ((U)->flags) +#define SNMP_User_Set_Flags(U, F) ((U)->flags = (sbits16_t)(F)) + +/* These macros are for internal use only and should not be used + by customers. It makes use of internal knowledge of the user + structure which may change in the future, causing the macros + to become unsupportable. In this case any code calling these + macros will need to be updated. + currently the only mapping between name and security name + is the identity mapping */ +#define SNMP_User_Get_SName(U) ((U)->uname) +#define SNMP_User_Get_SName_Len(U) ((U)->uname_len) + +extern sbits32_t v3_usmUserSpinLock; + +extern void usertable_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void usertable_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void usertable_test __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void usertable_set __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +#ifdef __cplusplus +} +#endif + +#endif /* (!defined(user_inc)) */ + + diff --git a/h/wrn/wm/snmp/engine/vbdefs.h b/h/wrn/wm/snmp/engine/vbdefs.h new file mode 100644 index 0000000..9d73d66 --- /dev/null +++ b/h/wrn/wm/snmp/engine/vbdefs.h @@ -0,0 +1,295 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/vbdefs.h,v 1.3 2002/05/13 20:46:19 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1995-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: vbdefs.h,v $ + * Revision 1.3 2002/05/13 20:46:19 josh + * encoding process now checks for 16-bit overflows in + * calculating packet sizes + * + * Revision 1.2 2001/11/06 21:35:07 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:24 tneale + * Tornado shuffle + * + * Revision 9.7 2001/01/19 22:22:13 paul + * Update copyright. + * + * Revision 9.6 2000/03/17 19:48:48 meister + * Update copyright notice + * + * Revision 9.5 2000/03/09 20:58:37 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.4 2000/03/09 17:14:20 tneale + * Added #ifdef for C++ to extern C if needed + * + * Revision 9.3 2000/02/02 17:35:28 josh + * adding VBList_Free() API call + * + * Revision 9.2 1999/12/23 14:47:28 josh + * cleaning up code per Shawn's comments -- removing extraneous + * comments and doing proxy check before notify check + * + * Revision 9.1 1999/05/24 20:12:12 josh + * 'compc' and 'compl' have been replaced by 'tcount' and 'tlist' + * to avoid C++ compiler errors. + * + * Revision 9.0 1998/10/16 22:10:28 sar + * Update version stamp to match release + * + * Revision 8.1 1998/02/25 04:50:54 sra + * Update copyrights. + * + * Revision 8.0 1997/11/18 00:56:33 sar + * Updated revision to 8.0 + * + * Revision 7.6 1997/10/26 01:44:43 sar + * Always define the 64 bit counter and include it in the vb defintion + * instead of forgetting about it if we don't have v2 or v2 types installed. + * + * Revision 7.5 1997/10/22 03:07:28 sar + * Mofied the agentx and older subagent schemes install options + * + * Revision 7.4 1997/10/16 23:52:27 sar + * We changed the macro VB_GET_IP_ADDRESS to provide a more consistent + * type signature from compilers. Previously it could have been either + * a pointer to an array of bytes or a pointer to a byte. It should + * now resolve to a pointer to an array of bytes. + * + * Revision 7.3 1997/10/16 00:25:19 sar + * Primarily this set of modifications is for the agentx protocol. + * Most of the work was in the agentx.h and ax_mth.h files. Most + * other files (snmpdefs.h, vbdefs.h and mib.h) received updates + * to their structures and snmp got some new lock macros. + * + * One other change of note was the modification of continue + * processing. Previously we called a specific continue routine + * directly, now we store a pointer to the corret continue + * function in the snmp packet structure and call that. We include + * macros for backwards compatibility. + * + * Revision 7.2 1997/03/20 06:48:25 sra + * DFARS-safe copyright text. Zap! + * + * Revision 7.1 1997/02/25 10:49:26 sra + * Update copyright notice, dust under the bed. + * + * Revision 7.0 1996/03/18 20:17:33 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 6.2 1995/10/20 22:53:35 sar + * removed bitstring include file & macro + * removed nsapaddress + * added VT_BITS & VT_UNSIGNED32 + * + * Revision 6.1 1995/06/05 20:57:49 sar + * Added clean_vb_data. + * + * Revision 6.0 1995/05/31 21:46:57 sra + * Release 6.0. + * + * Revision 1.1 1995/03/20 23:07:47 sar + * Initial revision + * + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + +#if (!defined(vb_inc)) +#define vb_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(asn1_inc)) +#include +#endif + +#if (!defined(buffer_inc)) +#include +#endif + +#if (!defined(mib_inc)) +#include +#endif + +#if (!defined(ui64_inc)) +#include +#endif + +/* Definition for routine to free private vb space */ +typedef void VBPRIVPROC_T __((PTR_T)); + +/* Definition for routine to undo sets */ +struct VB_S; +typedef void UNDOPROC_T __((OIDC_T lastmatch, int tcount, OIDC_T *tlist, + struct SNMP_PKT_S *pktp, struct VB_S *vbp)); + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +/* Define the internal shape of a VarBind */ +typedef struct VB_S + { + struct VB_S * vb_link; /* For the user to use, usually */ + /* to build a list of related */ + /* VB_Ts. */ + ALENGTH_T vb_seq_size; /* Overall length of the VarBind */ + /* sequence when encoded. */ + OBJ_ID_T vb_obj_id; /* Object id for this VarBind */ + OCTET_T vb_data_flags_n_type; /* Class form & type of data */ + OCTET_T vb_flags; /* See below */ + ALENGTH_T vb_data_length; /* Length of the data when encode */ + MIBLOC_T vb_ml; /* The mib-leaf associated with */ + /* this VarBind. */ + union { + INT_32_T v_number; /* Integer kinds of things */ + UINT_32_T v_counter; /* Unsigned int things */ + EBUFFER_T v_string; /* Octetstring things */ + OBJ_ID_T v_object; /* Object id things */ + unsigned char v_network_address[4]; + UINT_64_T v_counter64; /* 64 bit unsigned things */ + } value_u; + + union { + ptr_t p_ptr; /* storage space for moving info */ + bits32_t p_int; /* between test and set routines */ + } priv; + + VBPRIVPROC_T * vb_free_priv; /* pointer to routine to free the */ + /* private storage space */ + UNDOPROC_T * undoproc; /* pointer to routine to undo sets*/ +#if (INSTALL_ENVOY_AGENTX) + OBJ_ID_T ax_search_end; + OCTET_T ax_flags; +#endif + } VB_T; +#define v_gauge v_counter +#define v_timeticks v_counter +#define v_uinteger32 v_counter +#define v_opaque v_string + +#define vb_priv priv.p_ptr +#define vb_int priv.p_int + +/* Values for vb_data_flags_n_type */ +#define VT_NUMBER A_INTEGER +#define VT_STRING A_OCTETSTRING +#define VT_BITS A_OCTETSTRING /* same as a string */ +#define VT_OBJECT A_OBJECTID +#define VT_EMPTY A_NULL +#define VT_IPADDRESS (A_APPLICATION | 0) +#define VT_COUNTER (A_APPLICATION | 1) +#define VT_GAUGE (A_APPLICATION | 2) +#define VT_UNSIGNED32 (A_APPLICATION | 2) /* same as a guage */ +#define VT_TIMETICKS (A_APPLICATION | 3) +#define VT_OPAQUE (A_APPLICATION | 4) +#define VT_COUNTER64 (A_APPLICATION | 6) +#define VT_UINTEGER32 (A_APPLICATION | 7) + +/* values for exception data types */ +#define VT_NOSUCHOBJ (A_CONTEXT | 0) +#define VT_NOSUCHINS (A_CONTEXT | 1) +#define VT_ENDOFMIB (A_CONTEXT | 2) + +/* Values for vb_flags */ +#define VFLAG_ALREADY_TEST 0x01 +#define VFLAG_ALREADY_SET 0x02 +#define VFLAG_ALREADY_GET 0x02 +#define VFLAG_SA_SENDIT 0x04 +#define VFLAG_SA_DOIT 0x08 + +/* more values for vb_flags some of them need to be alligned with the + already_* flags, the rest are put in as we have space */ + +#define VFLAG_TEST_STARTED 0x10 +#define VFLAG_TEST_DONE 0x01 +#define VFLAG_SET_STARTED 0x20 +#define VFLAG_SET_DONE 0x02 +#define VFLAG_UNDO_STARTED 0x40 +#define VFLAG_UNDO_DONE 0x80 +#define VFLAG_UNDO_BOTH (VFLAG_UNDO_STARTED | VFLAG_UNDO_DONE) + +#define VFLAG_GET_STARTED 0x20 +#define VFLAG_GET_DONE 0x02 + +#define VFLAG_NEXT_STARTED 0x20 +#define VFLAG_NEXT_DONE 0x02 +#define VFLAG_NEXT_REDO 0x10 +#define VFLAG_NEXT_VCREQ 0x40 +#define VFLAG_NEXT_VCDONE 0x80 +#define VFLAG_NEXT_INSTANCE 0x01 +#define VFLAG_NEXT_VCBITS (VFLAG_NEXT_VCREQ | VFLAG_NEXT_VCDONE) +#define VFLAG_NEXT_FLAGS 0xF3 + +#define ENVOY_AX_FLAGS_INCLUDE 0x01 +#define ENVOY_AX_FLAGS_CLEAN_LEAF 0x02 +#define ENVOY_AX_FLAGS_CLEAN_INDEX 0x04 + +/* Define the shape of the VarBindList */ +typedef struct VBL_S + { + ALENGTH_T vbl_length; /* Length of the VarBindList seq */ + int vbl_count; /* Number of Var Bind items */ + VB_T *vblist; + struct VBL_S *vblp; /* for get bulk chaining purposes */ + } VBL_T; + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + + +/* macros to get the data from a vbp */ +#define VB_GET_INT32(V) ((V)->value_u.v_number) +#define VB_GET_UINT32(V) ((V)->value_u.v_counter) +#define VB_GET_IP_ADDRESS(V) ((V)->value_u.v_network_address) +#define VB_GET_STRING(V) &((V)->value_u.v_string) +#define VB_GET_OBJECT_ID(V) &((V)->value_u.v_object) +#define VB_GET_UINT64(V) &((V)->value_u.v_counter64) + +/* macro to get a pointer to a cookie, so that the user + doesn't have to understand what a vb looks like */ +#define VB_TO_COOKIE(vbp) (vbp)->vb_ml.ml_leaf->user_cookie + +/* various vb utility routines */ +extern VB_T * VarBindList_Allocate __((int)); +extern VBL_T * VBList_Allocate __((int)); +extern bits32_t vbsize __((VB_T *)); +extern void Clean_vb_data __((VB_T *)); +extern void Clean_vb __((VB_T *)); +extern void Clean_vb_list __((VBL_T *)); +extern void VBList_Free __((VBL_T *)); + +#ifdef __cplusplus +} +#endif + +#endif /* (!defined(vb_inc)) */ diff --git a/h/wrn/wm/snmp/engine/version.h b/h/wrn/wm/snmp/engine/version.h new file mode 100644 index 0000000..699d67a --- /dev/null +++ b/h/wrn/wm/snmp/engine/version.h @@ -0,0 +1,85 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/version.h,v 1.1.1.1 2001/11/05 17:47:24 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1988-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: version.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:24 tneale + * Tornado shuffle + * + * Revision 9.3 2001/01/19 22:22:13 paul + * Update copyright. + * + * Revision 9.2 2000/03/17 19:48:48 meister + * Update copyright notice + * + * Revision 9.1 2000/03/07 15:17:42 josh + * updating version stamp to match release + * + * Revision 9.0 1998/10/16 22:10:30 sar + * Update version stamp to match release + * + * Revision 8.2 1998/05/23 20:25:07 sar + * Update major version to 9 in preperation for next release. + * + * Revision 8.1 1998/02/25 04:50:55 sra + * Update copyrights. + * + * Revision 8.0 1997/11/18 00:56:33 sar + * Updated revision to 8.0 + * + * Revision 7.4 1997/11/17 23:58:36 sar + * Update the version + * + * Revision 7.3 1997/03/20 06:48:26 sra + * DFARS-safe copyright text. Zap! + * + * Revision 7.2 1997/02/25 10:49:26 sra + * Update copyright notice, dust under the bed. + * + * Revision 7.1 1997/02/17 20:04:52 sar + * udpated version 7.2 + * + * Revision 7.0 1996/03/18 20:17:33 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 6.0 1995/05/31 21:59:46 sra + * Release 6.0. + * + * Revision 1.3 1995/05/29 03:59:37 sar + * Set the beta version define to 0 + * + * Revision 1.2 1995/03/24 19:47:02 sar + * Updated to version 6.0 beta + * + * Revision 1.1 1995/03/20 23:07:47 sar + * Initial revision + * + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + +#define ENVOY_VERSION_STRING "$Revision: 1.1.1.1 $" +#define ENVOY_MAJOR_VERSION 9 +#define ENVOY_MINOR_VERSION 1 +#define ENVOY_BETA_VERSION 0 + diff --git a/h/wrn/wm/snmp/engine/view.h b/h/wrn/wm/snmp/engine/view.h new file mode 100644 index 0000000..b913fd4 --- /dev/null +++ b/h/wrn/wm/snmp/engine/view.h @@ -0,0 +1,260 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/view.h,v 1.2 2001/11/06 21:35:08 josh Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1995-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: view.h,v $ + * Revision 1.2 2001/11/06 21:35:08 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:25 tneale + * Tornado shuffle + * + * Revision 9.5 2001/04/25 16:40:05 josh + * make sure the instance is thoroughly checked in the + * vacmViewTreeFamilyTable before trying to create a + * new row + * + * Revision 9.4 2001/01/19 22:22:13 paul + * Update copyright. + * + * Revision 9.3 2000/03/17 19:48:49 meister + * Update copyright notice + * + * Revision 9.2 2000/03/09 20:58:37 tneale + * All structure definitions are now bracketted with a test that + * potentially sets an alignment pragma. This is to maintain compatibility + * with the code base that had been distributed by Wind River. + * + * Revision 9.1 2000/03/09 17:14:33 tneale + * Added #ifdef for C++ to extern C if needed + * + * Revision 9.0 1998/10/16 22:10:31 sar + * Update version stamp to match release + * + * Revision 8.4 1998/06/20 17:49:44 sar + * Modified the names and calling sequences for snmp_rfc2275 functions + * + * Revision 8.3 1998/06/18 04:44:20 sar + * Update view index to directly point to the name instead of using + * an ebuffer + * + * Revision 8.2 1998/05/23 20:20:08 sar + * added code for rfc2275, updated types + * + * Revision 8.1 1998/02/25 04:50:57 sra + * Update copyrights. + * + * Revision 8.0 1997/11/18 00:56:33 sar + * Updated revision to 8.0 + * + * Revision 7.2 1997/03/20 06:48:27 sra + * DFARS-safe copyright text. Zap! + * + * Revision 7.1 1997/02/25 10:49:26 sra + * Update copyright notice, dust under the bed. + * + * Revision 7.0 1996/03/18 20:17:33 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 1.4 1995/11/14 22:42:26 sar + * Added the prototype defs for the view method routines. + * + * Revision 1.3 1995/11/11 00:05:52 sar + * removed use of rfc1445_view_routines + * + * Revision 1.2 1995/11/01 00:54:33 sar + * removed casts of 0 + * changed the default row status to be nis instead of rsne + * + * Revision 1.1 1995/10/20 22:53:35 sar + * Initial revision + * + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(view_inc)) +#define view_inc + +#ifdef __cplusplus +extern"C" { +#endif + +#if (!defined(snmpdefs_inc)) +#include +#endif + +#if (!defined(smi_inc)) +#include +#endif + +#define STO_OTHER 1 +#define STO_VOL 2 +#define STO_NONVOL 3 +#define STO_PERM 4 +#define STO_RONLY 5 + +#define RS_RSNE 0 +#define RS_ACTIVE 1 +#define RS_NIS 2 +#define RS_NREADY 3 +#define RS_CAGO 4 +#define RS_CAWAIT 5 +#define RS_DESTROY 6 + +/* define the view structures */ +#define VIEW_INCLUDED 1 +#define VIEW_EXCLUDED 2 +#define VIEW_INDETERMINATE 3 +#define VIEW_MAXMASKLEN 16 +#define VIEW_MAXINDEX 65535 +#define VIEW_MAXINDEXL 65535L + +#define ETC_VIEW_NAME_MIN 1 +#define ETC_VIEW_NAME_MAX 32 + +/* options for SNMP_View_Check */ +#define VIEW_CHECK_DET 0 +#define VIEW_CHECK_IND 1 + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 1 +#endif + +typedef struct VIEWLEAF_S + { + struct VIEWINDEX_S *parent; /* backpointer to parent, 0 if + this view isn't installed */ + bits16_t index; /* index of the view table, + this is the same as it's parents + view index used for admin */ + OBJ_ID_T subtree; /* the oid for this subtree */ + EBUFFER_T mask; /* wildcard string */ + int type; /* is this entry included or exc */ + int status; /* status of this entry */ + int storage; /* type of storage of this entry */ + struct VIEWLEAF_S * lexinext; /* list of leaves in lexi order */ + struct VIEWLEAF_S * masknext; /* list of leaves in mask order */ + } VIEWLEAF_T; + +typedef struct VIEWINDEX_S + { +#if (INSTALL_ENVOY_SNMP_RFC1445_VIEWS) + bits16_t index; /* index of the view table */ +#endif + +#if (INSTALL_ENVOY_SNMP_RFC2275_VIEWS) + bits8_t * name; /* name of the view table */ + ALENGTH_T name_len; /* length of name */ +#endif + + struct VIEWINDEX_S * next; /* next index in the chain */ + VIEWLEAF_T * lexilist; /* list of leaves in lexi order */ + VIEWLEAF_T * masklist; /* list of leaves in mask order */ + } VIEWINDEX_T; + +#ifdef WINDNET_STRUCT_ALIGN +#pragma align 0 +#endif + + +#if (INSTALL_ENVOY_SNMP_DYNAMIC_VIEWS) +extern int SNMP_View_Find_Family __((SNMP_PKT_T *)); +extern int SNMP_View_Family_Check __((SNMP_PKT_T *, OIDC_T *, int, int)); +extern int SNMP_View_Check __((SNMP_PKT_T *, OIDC_T *, int, int)); + +#define SNMP_View_Get_Type(V) ((V)->type) +#define SNMP_View_Set_Type(V, W) ((V)->type = (bits16_t)W) +#define SNMP_View_Get_Mask(V) (EBufferStart(&(V)->mask)) +#define SNMP_View_Get_MaskLen(V) (EBufferUsed(&(V)->mask)) +#define SNMP_View_Set_StorageType(V, W) ((V)->storage = (bits16_t)W) +#define SNMP_View_Get_StorageType(V) ((V)->storage) +#define SNMP_View_Set_Status(V, W) ((V)->status = (bits16_t)W) +#define SNMP_View_Get_Status(V) ((V)->status) +#define SNMP_View_Get_Subtree(V) ((V)->subtree.component_list) +#define SNMP_View_Get_Subtree_Len(V) ((V)->subtree.num_components) + +#define SNMP_View_Set_Defaults(V) ((V)->parent = 0, \ + EBufferInitialize(&(V)->mask), \ + (V)->masknext = 0, \ + (V)->lexinext = 0, \ + (V)->type = VIEW_INCLUDED, \ + (V)->storage = STO_NONVOL, \ + (V)->status = RS_NIS) + + +extern VIEWLEAF_T *SNMP_View_Create __((OIDC_T *, int)); +extern void SNMP_View_Delete __((VIEWLEAF_T *)); +extern VIEWLEAF_T *SNMP_View_Next __((VIEWLEAF_T *)); +extern int SNMP_View_Set_Mask __((VIEWLEAF_T *, bits8_t *, int)); + +#if (INSTALL_ENVOY_SNMP_RFC1445_VIEWS) +#define SNMP_View_Get_Index(V) ((V)->index) + +extern int SNMP_View_Install __((bits16_t, VIEWLEAF_T *)); +extern int SNMP_View_Name __((VIEWLEAF_T *, bits16_t *, + OIDC_T *, int)); +extern int SNMP_View_Deinstall __((bits16_t, OIDC_T *, int)); +extern VIEWLEAF_T *SNMP_View_Lookup __((bits16_t, OIDC_T *, int)); +#endif /* #if (INSTALL_ENVOY_SNMP_RFC1445_VIEWS) */ + +#if (INSTALL_ENVOY_SNMP_RFC2275_VIEWS) +/*#define SNMP_View_2275_Name(V) ((V)->parent ? (V)->parent->name : 0) +#define SNMP_View_2275_Name_Len(V) ((V)->parent ? (V)->parent->name_len : 0)*/ + +extern void SNMP_View_2275_Name __((VIEWLEAF_T *, bits8_t *, + ALENGTH_T *)); +extern int SNMP_View_2275_Install __((VIEWLEAF_T *, bits8_t *, + ALENGTH_T)); +extern int SNMP_View_2275_Full_Name __((VIEWLEAF_T *, OIDC_T *, int)); +extern void SNMP_View_2275_Deinstall __((VIEWLEAF_T *)); +extern VIEWLEAF_T *SNMP_View_2275_Lookup __((bits8_t *, ALENGTH_T, + OIDC_T *, int)); +extern sbits32_t v3_vacmViewSpinLock; +#endif /* #if (INSTALL_ENVOY_SNMP_RFC2275_VIEWS) */ + + +extern void viewtable_test __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void viewtable_get __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void viewtable_next __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +extern void viewtable_set __((OIDC_T, int, OIDC_T *, + SNMP_PKT_T *, VB_T *)); + +#endif /* (INSTALL_ENVOY_SNMP_DYNAMIC_VIEWS) */ + +extern VIEWINDEX_T *viewroot; + +#ifdef __cplusplus +} +#endif + +#endif /* view_inc */ + diff --git a/h/wrn/wm/snmp/engine/vxcmpnts.h b/h/wrn/wm/snmp/engine/vxcmpnts.h new file mode 100644 index 0000000..105690d --- /dev/null +++ b/h/wrn/wm/snmp/engine/vxcmpnts.h @@ -0,0 +1,84 @@ +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1994-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: vxcmpnts.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:25 tneale + * Tornado shuffle + * + * Revision 1.1.2.3 2001/11/02 23:37:02 meister + * prototype for usrSnmpInit + * + * Revision 1.1.2.2 2001/10/01 18:52:56 meister + * Add some prototypes. + * + * Revision 1.1.2.1 2001/08/29 15:47:08 meister + * declarations for vxworks snmpd component initialation functions + * and task priorities + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#ifndef _ENVOY_VXCMPNTS_H +# define _ENVOY_VXCMPNTS_H 1 + +/* + * vxcmpnts.h - this file contains labels for each configurable component + * for the SNMPD running under VxWorks. Each one is a bit in + * in a bit-mask + */ + +#define SNMPD_CORE_COMPONENT 0x1 +#define SNMPD_VERSION_3_COMPONENT (0x1 << 1) +#define SNMPD_AGENTX_MASTER_COMPONENT (0x1 << 2) +#define SNMPD_AGENTX_SUBAGENT_COMPONENT (0x1 << 3) + +/* + * delcarations for component init routines + */ + +void initAxMasterComponent (void); +void initAxSubagentComponent (void); +void initSnmpV3Component (void); +void snmpdInitConfigMsgQ (void); +void initSnmpd(void); + +void determineSnmpdComponents (void); +void envoy_dyncfg_init (void); + +/* + * priorities for the component startup tasks, if not specified by the user + */ + +#ifndef ENVOY_VXWORKS_SNMPD_INIT_PRIORITY +# define ENVOY_VXWORKS_SNMPD_INIT_PRIORITY 94 +#endif + +#ifndef ENVOY_VXWORKS_SNMPD_COMP_INIT_PRIORITY +# define ENVOY_VXWORKS_SNMPD_COMP_INIT_PRIORITY 95 +#endif + +#ifndef ENVOY_VXWORKS_SNMPD_PRIORITY +# define ENVOY_VXWORKS_SNMPD_PRIORITY 96 +#endif + +#endif /* _ENVOY_VXCMPNTS_H */ diff --git a/h/wrn/wm/snmp/engine/wkobj.h b/h/wrn/wm/snmp/engine/wkobj.h new file mode 100644 index 0000000..ab680c0 --- /dev/null +++ b/h/wrn/wm/snmp/engine/wkobj.h @@ -0,0 +1,138 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/engine/wkobj.h,v 1.1.1.1 2001/11/05 17:47:25 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: wkobj.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:25 tneale + * Tornado shuffle + * + * Revision 9.2 2001/01/19 22:22:14 paul + * Update copyright. + * + * Revision 9.1 2000/03/17 19:48:49 meister + * Update copyright notice + * + * Revision 9.0 1998/10/16 22:10:32 sar + * Update version stamp to match release + * + * Revision 8.1 1998/02/25 04:50:58 sra + * Update copyrights. + * + * Revision 8.0 1997/11/18 00:56:34 sar + * Updated revision to 8.0 + * + * Revision 7.2 1997/03/20 06:48:28 sra + * DFARS-safe copyright text. Zap! + * + * Revision 7.1 1997/02/25 10:49:26 sra + * Update copyright notice, dust under the bed. + * + * Revision 7.0 1996/03/18 20:17:33 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 6.0 1995/05/31 21:46:47 sra + * Release 6.0. + * + * Revision 5.0 1994/05/16 15:49:04 sar + * Updated revision to 5.0 and copyright to include 1994 + * + * Revision 4.0 1993/06/24 16:05:41 sar + * Updated rev to 4.0 and coypright to 93 + * + * Revision 1.2 1993/05/26 21:30:55 sar + * updated to work with the objid defined in the rfcs. + * + * Revision 1.1 1993/04/23 23:36:14 sar + * Initial revision + * + */ + +/* [clearcase] +modification history +------------------- +01a,19apr05,job update copyright notices +*/ + + +#if (!defined(wkobj_inc)) +#define wkobj_inc + +#define SNMP_INTERNET 1, 3, 6, 1 + +#define SNMP_DIRECTORY SNMP_INTERNET, 1 +#define SNMP_MGMT SNMP_INTERNET, 2 +#define SNMP_MIB2 SNMP_MGMT, 1 + +#define SNMP_EXPERIMENTAL SNMP_INTERNET, 3 +#define SNMP_PRIVATE SNMP_INTERNET, 4 +#define SNMP_ENTERPRISES SNMP_PRIVATE, 1 + +#define SNMP_SECURITY SNMP_INTERNET, 5 +#define SNMP_SNMPV2 SNMP_INTERNET, 6 + +/*#define SNMP_SNMPMAPPINGS SNMP_SNMPV2, 1*/ +/*#define SNMP_SNMPMODULES SNMP_SNMPV2, 4*/ + +/*#define SNMP_SNMPDOMAINS SNMP_SNMPMAPPINGS, 1*/ +#define SNMP_SNMPDOMAINS SNMP_SNMPV2, 1 +#define SNMP_UDPDOMAIN SNMP_SNMPDOMAINS, 1 +#define SNMP_CLNSDOMAIN SNMP_SNMPDOMAINS, 2 +#define SNMP_CONSDOMAIN SNMP_SNMPDOMAINS, 3 +#define SNMP_DDPDOMAIN SNMP_SNMPDOMAINS, 4 +#define SNMP_IPXDOMAIN SNMP_SNMPDOMAINS, 5 + +/*#define SNMP_SNMPPROXYS SNMP_SNMPMAPPINGS, 2*/ +#define SNMP_SNMPPROXYS SNMP_SNMPV2, 2 +#define SNMP_RFC1157PROXY SNMP_SNMPPROXYS, 1 +#define SNMP_RFC1157DOMAIN SNMP_RFC1157PROXY, 1 +#define SNMP_RFC1157NOAUTH SNMP_RFC1157PROXY, 2 + +#define SNMP_SNMPMODULES SNMP_SNMPV2, 3 +#define SNMP_SNMPMIB SNMP_SNMPMODULES, 1 +#define SNMP_SNMPMIBOBJECTS SNMP_SNMPMIB, 1 + +#define SNMP_SNMPTRAP SNMP_SNMPMIBOBJECTS, 4 +#define SNMP_SNMPTRAPOID SNMP_SNMPTRAP, 1 +#define SNMP_SNMPTRAPENTERPRISE SNMP_SNMPTRAP, 3 + +#define SNMP_SNMPTRAPS SNMP_SNMPMIBOBJECTS, 5 +#define SNMP_COLDSTART SNMP_SNMPTRAPS, 1 +#define SNMP_WARMSTART SNMP_SNMPTRAPS, 2 +#define SNMP_LINKDOWN SNMP_SNMPTRAPS, 3 +#define SNMP_LINKUP SNMP_SNMPTRAPS, 4 +#define SNMP_AUTHENTICATIONFAILURE SNMP_SNMPTRAPS, 5 +#define SNMP_EGPNEIGHBORLOSS SNMP_SNMPTRAPS, 6 + +#define SNMP_PARTYMIB SNMP_SNMPMODULES, 3 +#define SNMP_PARTYADMIN SNMP_PARTYMIB, 1 + +#define SNMP_PARTYPROTOCOLS SNMP_PARTYADMIN, 1 +#define SNMP_NOAUTH SNMP_PARTYPROTOCOLS, 1 +#define SNMP_NOPRIV SNMP_PARTYPROTOCOLS, 2 +#define SNMP_DESPRIV SNMP_PARTYPROTOCOLS, 3 +#define SNMP_MD5AUTH SNMP_PARTYPROTOCOLS, 4 + +#define SNMP_TEMPORALDOMAINS SNMP_PARTYADMIN, 2 +#define SNMP_CURRENTTIME SNMP_TEMPORALDOMAINS, 1 +#define SNMP_RESTARTTIME SNMP_TEMPORALDOMAINS, 2 +#define SNMP_CACHETIME SNMP_TEMPORALDOMAINS, 3 + +#define SNMP_INITIALPARTYID SNMP_PARTYADMIN, 3 +#define SNMP_INITIALCONTEXTID SNMP_PARTYADMIN, 4 + +#endif /* wkobj_inc */ diff --git a/h/wrn/wm/snmp/vxagent/axCfg.h b/h/wrn/wm/snmp/vxagent/axCfg.h new file mode 100644 index 0000000..98b72fc --- /dev/null +++ b/h/wrn/wm/snmp/vxagent/axCfg.h @@ -0,0 +1,128 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/vxagent/axCfg.h,v 1.9 2002/06/13 16:03:10 tneale Exp $ */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + +/**************************************************************************** + * Copyright 1994-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* +modification history +-------------------- +01d,19apr05,job update copyright notices +01c,25nov03,ps copyright update +01b,05dec2000,ten Added prototypes for subagent routines. +01a,03oct2000,josh written. +*/ + +#ifndef __INCaxCfgh +#define __INCaxCfgh + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include +#include + +#if INSTALL_ENVOY_AGENTX_MASTER + + /* defines */ + + #if ((CPU_FAMILY==I960) && (defined __GNUC__)) + #pragma align 1 /* tell gcc960 not to optimize alignments */ + #endif /* CPU_FAMILY==I960 */ + + typedef struct AX_CONN_S + { + int sockNum; /* Socket being used */ + int refCount; /* Number of handlers touching this block */ + ENVOY_AX_CHUNK_T chunk; /* AgentX chunk for collecting a PDU */ + bits32_t connectID; /* Connection ID */ + bits32_t createTime; /* Socket creation time */ + struct AX_CONN_S *next; /* Next block */ + } AX_CONN_T; + + #if ((CPU_FAMILY==I960) && (defined __GNUC__)) + #pragma align 0 /* turn off alignment requirement */ + #endif /* CPU_FAMILY==I960 */ + + /* Externs */ + + extern STATUS axMasterIoInit (void); + extern void snmpAxMonitorSpawn (void); + extern void masterAxCleanup (void); + extern bits32_t envoyGetSysUpTime (EBUFFER_T *); + +/* + * Use the following statement to turn off AgentX master code in the + * VxWorks agent when the SNMP library was built with AgentX master + * installed. This should only be used when dynamic configuration + * (using the Tornado project facility) is disabled. To turn off + * AgentX master support set the following to "0" + */ + #define INSTALL_AXMASTER 1 + +#else + + #define INSTALL_AXMASTER 0 + +#endif + + +#if INSTALL_ENVOY_AGENTX_SUB + + /* defines */ + + /* This is the address the subagent will use to communicate with an AgentX master */ + /* The default address is equivalent to INADDR_ANY and can be used when master */ + /* and subagent are are on the same target */ + #define WMSNMP_AXMAST_IP_ADDRESS "0.0.0.0" + + /* This is the OID subtree the subagent will register at boot-up */ + /* Remember to terminate the component list with a zero. This zero is not */ + /* included in the component count */ + #define WMSNMP_AXSUB_REGOID_LIST {1, 3, 6, 1, 4, 1, 0} + #define WMSNMP_AXSUB_REGOID_LEN 6 + + /* Externs */ + + extern int envoy_ax_sa_mib_root_node (ptr_t cookie, SNMP_PKT_T *pktp); + extern STATUS axSubagentIoInit ( void ); + extern void snmpAxSubagentSpawn (void); + extern void subagentAxCleanup (void); + +/* + * Use the following statement to turn off AgentX subagent code in the + * VxWorks agent when the SNMP library was built with AgentX subagent + * installed. This should only be used when dynamic configuration + * (using the Tornado project facility) is disabled. To turn off + * AgentX subagent support set the following to "0" + */ + #define INSTALL_AXSUB 1 + +#else + + #define INSTALL_AXSUB 0 + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCipcLibh */ diff --git a/h/wrn/wm/snmp/vxagent/namingScopes.h b/h/wrn/wm/snmp/vxagent/namingScopes.h new file mode 100644 index 0000000..57d359d --- /dev/null +++ b/h/wrn/wm/snmp/vxagent/namingScopes.h @@ -0,0 +1,100 @@ +/* namingScopes.h - register naming scopes functions */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + +/* +modification history +------------------- +01d,19apr05,job update copyright notices +01c,25nov03,ps copyright update +01b,18mar03,ism removed conditional prototypes after code review +01a,05dec02,ism written +*/ + +#ifndef __INCnamingScopesh +#define __INCnamingScopesh + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +/* Defines used for viewType field */ + +#define VIEW_TYPE_GET 0x01 +#define VIEW_TYPE_SET 0x02 + +#if defined(__STDC__) || defined(__cplusplus) + +extern void communityStringInit (bits32_t defaultVsNum); + +extern STATUS communityStringRegister (bits8_t * newCommunityString, + bits32_t stringLen, + bits8_t viewType, + bits8_t * viewName, + bits32_t nameLen, + bits32_t vsNum); + +extern STATUS communityStringDeregister (bits8_t * communityString, + bits32_t stringLen, + bits8_t viewType, + bits32_t vsNum); + +extern bits32_t communityStringFind (EBUFFER_T searchCommunity, + bits8_t viewType, + EBUFFER_T * viewName); + + +#if INSTALL_ENVOY_SNMP_VERSION_3 + +extern void contextNameInit (bits32_t defaultVsNum); + +extern STATUS contextNameRegister (bits8_t * newContextName, + bits32_t stringLen, + bits8_t viewType, + bits8_t * viewName, + bits32_t nameLen, + bits32_t vsNum); + +extern STATUS contextNameDeregister (bits8_t * contextName, + bits32_t stringLen, + bits8_t viewType, + bits32_t vsNum); + +extern bits32_t contextNameFind (EBUFFER_T searchContext, + bits8_t viewType, + EBUFFER_T * viewName); + +#endif /* INSTALL_ENVOY_SNMP_VERSION_3 */ + +#else /* __STDC__ */ + +extern void communityStringInit (); +extern STATUS communityStringRegister (); +extern STATUS communityStringDeregister (); +extern bits32_t communityStringFind (); + +#if INSTALL_ENVOY_SNMP_VERSION_3 + +extern void contextNameInit (); +extern STATUS contextNameRegister (); +extern STATUS contextNameDeregister (); +extern bits32_t contextNameFind (); + +#endif /* INSTALL_ENVOY_SNMP_VERSION_3 */ + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCnamingScopesh */ diff --git a/h/wrn/wm/snmp/vxagent/snmpIoLib.h b/h/wrn/wm/snmp/vxagent/snmpIoLib.h new file mode 100644 index 0000000..2e8e9f9 --- /dev/null +++ b/h/wrn/wm/snmp/vxagent/snmpIoLib.h @@ -0,0 +1,86 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/vxagent/snmpIoLib.h,v 1.1.1.1 2001/11/05 17:47:27 tneale Exp $ */ + +/* snmpdLib.h - VxWorks SNMP Agent */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + +/* +modification history +-------------------- +01f,19apr05,job update copyright notices +01e,25nov03,ps copyright update +01d,30apr98,ann Changed copyright +01c,11nov96,jag Cleaned up file header. +01b,01may96,rjc Added copyright header +01a,10mar96,rjc written. +*/ + + +/* + * $Log: snmpIoLib.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:27 tneale + * Tornado shuffle + * + * Revision 1.5 2001/01/19 22:25:08 paul + * Update copyright. + * + * Revision 1.4 2000/03/09 17:42:28 josh + * setting up prototypes and includes where appropriate to eliminate + * build warnings + * + * Revision 1.3 2000/03/07 21:17:34 josh + * fixing log comments + * + * Revision 1.2 2000/03/07 20:58:38 josh + * putting CVS headers and logs into files that were lacking + * + * + */ + +#ifndef __INCsnmpIoh +#define __INCsnmpIoh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include + + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS snmpIoInit (void); +extern void snmpIoMain (void); +extern void snmpIoClose (void); +extern void snmpIoWrite (void *, char *, int, void *, void *); +void snmpIoTrapSend (int, int); +void snmpIoViewInit (void); + +#else /* __STDC__ */ + +extern STATUS snmpIoInit (); +extern void snmpIoMain (); +extern void snmpIoClose (); +extern void snmpIoWrite (); +void snmpIoTrapSend (); +void snmpIoViewInit (); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + + +#endif /* __INCsnmpIoh */ + diff --git a/h/wrn/wm/snmp/vxagent/snmpdInit.h b/h/wrn/wm/snmp/vxagent/snmpdInit.h new file mode 100644 index 0000000..5cb3b0d --- /dev/null +++ b/h/wrn/wm/snmp/vxagent/snmpdInit.h @@ -0,0 +1,100 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/vxagent/snmpdInit.h,v 1.1.1.1 2001/11/05 17:47:27 tneale Exp $ */ + +/* snmpInit.h - VxWorks SNMP Agent system initialization interface */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + +/* +modification history +-------------------- +01g,19apr05,job update copyright notices +01f,25nov03,ps copyright update +01e,30apr98,ann Added pragma aligns for I960 +01d,11nov96,jag Cleaned up file header. Changed loglevel to traceLevel in + snmpdInit(). +01c,12aug96,rjc removed memory partition options from snmpdInit (); +01b,10jun96,rjc removed extra { #ifdef'd under _cplusplus +01a,01may96,rjc Added copyright header +*/ + +/* + * $Log: snmpdInit.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:27 tneale + * Tornado shuffle + * + * Revision 1.5 2001/01/19 22:25:09 paul + * Update copyright. + * + * Revision 1.4 2000/03/09 17:42:28 josh + * setting up prototypes and includes where appropriate to eliminate + * build warnings + * + * Revision 1.3 2000/03/07 21:17:35 josh + * fixing log comments + * + * Revision 1.2 2000/03/07 20:58:39 josh + * putting CVS headers and logs into files that were lacking + * + */ + +#ifndef __INCsnmpdInith +#define __INCsnmpdInith + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* module structure */ + +typedef struct mib_module + { + FUNCPTR mibInitialize; /* initialization routine */ + FUNCPTR mibTerminate; /* termination routine */ + } MIB_MODULE; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* function declarations */ + + #if defined(__STDC__) || defined(__cplusplus) + +extern STATUS snmpdInit (MIB_MODULE * pModules, int traceLevel, int prio, + int stackSize); +extern void snmpdExit (void); +extern void generateTrap (int ifTrapType, int interfaceIndex, + void * pM2TrapRtnArg); + + +#else /* __STDC__ */ + +extern STATUS snmpdInit (); +extern void snmpdExit (); +extern void generateTrap (); + +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif + + +#endif /* __INCsnmpdInith */ + diff --git a/h/wrn/wm/snmp/vxagent/snmpdLib.h b/h/wrn/wm/snmp/vxagent/snmpdLib.h new file mode 100644 index 0000000..302264c --- /dev/null +++ b/h/wrn/wm/snmp/vxagent/snmpdLib.h @@ -0,0 +1,160 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/vxagent/snmpdLib.h,v 1.4 2001/12/20 21:41:07 meister Exp $ */ + +/* snmpdLib.h - VxWorks SNMP Agent */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + +/* +modification history +-------------------- +01h,19apr05,job update copyright notices +01g,25nov03,ps copyright update +01f,05nov03,ps merge from latest on ickthwa_devel_branch.nh +01e,02oct98,ann added missing function prototypes (SPR# 7017) +01d,30apr98,ann changed snmpVbPrivFree prototype to avoid + conflict with master-subagent. +01c,07jun96,rjc removed extra } #ifdef'd under _cplusplus +01b,16may96,rjc rewritten for snmp v1/v2c product +01a,18feb94,elh written. +*/ + +/* + * $Log: snmpdLib.h,v $ + * Revision 1.4 2001/12/20 21:41:07 meister + * Add some more prototypes + * + * Revision 1.2 2001/11/06 21:50:42 josh + * second (and hopefully final) pass of new path hacking + * + * Revision 1.1.1.1 2001/11/05 17:47:25 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:25:08 paul + * Update copyright. + * + * Revision 1.3 2000/03/08 20:09:17 josh + * Adding V3 support to vxWorks port + * + * Revision 1.2 2000/03/07 20:58:38 josh + * putting CVS headers and logs into files that were lacking + * + */ + +#ifndef __INCsnmpdLibh +#define __INCsnmpdLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "vxWorks.h" +#include +#include +#include +#include /* for htonl, ntohl etc */ + + +#define MAX_OID_LEN 128 /* Max no of components in an OID */ + +#define SNMP_ERROR 1 /* error messages */ +#define SNMP_WARN 2 /* warning messages */ +#define SNMP_INFO 3 /* information messages */ + +struct Timer_Block { +unsigned long when; +void (*what)(); +}; + +#define S_snmpdLib_VIEW_CREATE_FAILURE (M_snmpdLib | 1) +#define S_snmpdLib_VIEW_INSTALL_FAILURE (M_snmpdLib | 2) +#define S_snmpdLib_VIEW_MASK_FAILURE (M_snmpdLib | 3) +#define S_snmpdLib_VIEW_DEINSTALL_FAILURE (M_snmpdLib | 4) +#define S_snmpdLib_VIEW_LOOKUP_FAILURE (M_snmpdLib | 5) +#define S_snmpdLib_MIB_ADDITION_FAILURE (M_snmpdLib | 6) +#define S_snmpdLib_NODE_NOT_FOUND (M_snmpdLib | 7) +#define S_snmpdLib_INVALID_SNMP_VERSION (M_snmpdLib | 8) +#define S_snmpdLib_TRAP_CREATE_FAILURE (M_snmpdLib | 9) +#define S_snmpdLib_TRAP_BIND_FAILURE (M_snmpdLib | 10) +#define S_snmpdLib_TRAP_ENCODE_FAILURE (M_snmpdLib | 11) +#define S_snmpdLib_INVALID_OID_SYNTAX (M_snmpdLib | 12) + + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void snmpdPktProcess (int, char *, void *, void *, void *); +extern void snmpdLog (int, char *); +extern STATUS snmpdTreeAdd (char *, MIBNODE_T *); +extern void snmpdTreeRemove (char *); +extern STATUS snmpdViewEntrySet (OIDC_T *, int, UINT_16_T, uchar_t *, int, + int); +extern void snmpdViewEntryRemove (OIDC_T *, int, UINT_16_T); +extern STATUS snmpdView2275EntrySet (OIDC_T *, int, uchar_t *, ALENGTH_T, + uchar_t *, int, int); +extern void snmpdView2275EntryRemove (OIDC_T *, int, uchar_t *, ALENGTH_T); + +extern int snmpOidToIpHostOrder (int, OIDC_T *, ulong_t *); + +extern void snmpdTrapSend (void *, int, void **, void *, int, char *, + OIDC_T *, int, u_long *, int, int, int, FUNCPTR, + void *); +extern STATUS snmpNextIndex (int, const OIDC_T *, OIDC_T * , const OIDC_T *, int); +extern void snmpdGroupByGetprocAndInstance (SNMP_PKT_T *, VB_T *, int, OIDC_T *); +extern void snmpdContinue (SNMP_PKT_T *); +extern void snmpNextError (SNMP_PKT_T *, VB_T *); +extern void snmpVbPrivFree (VB_T *); +extern int snmpOidStrToArray (char *, OIDC_T *); +extern void snmpdInitFinish (VOIDFUNCPTR, FUNCPTR, FUNCPTR, FUNCPTR, FUNCPTR); +extern STATUS snmpdPktLockGet (SNMP_PKT_T *); +extern void initStartSnmpd (void); +extern void snmpdDyncfgInit (void); +extern void snmpdInitInstalledComponentsValue (void); +extern void snmpdShutdown (void); + +#else /* __STDC__ */ + +extern void snmpdPktProcess (); +extern void snmpdLog (); +extern STATUS snmpdTreeAdd (); +extern void snmpdTreeRemove (); +extern int snmpdViewEntrySet (); +extern void snmpdViewEntryRemove (); +extern int snmpdView2275EntrySet (); +extern void snmpdView2275EntryRemove (); +extern int snmpOidToIpHostOrder (); +extern void snmpdTrapSend (); +extern int snmpNextIndex (); +extern void groupVarBinds (); +extern void snmpNextError (); +extern void snmpVbPrivFree (); +extern int snmpOidStrToArray (); +extern void snmpdInitFinish (); +extern STATUS snmpdPktLockGet (); +extern void snmpdGroupByGetprocAndInstance (); +extern void snmpdContinue (); +extern void initStartSnmpd (); +extern void snmpdDyncfgInit (); +extern void snmpdInitInstalledComponentsValue (); +extern void snmpdShutdown (); + +#endif /* __STDC__ */ + + +#ifdef __cplusplus +} +#endif + + +#endif /* __INCsnmpdLibh */ + + diff --git a/h/wrn/wm/snmp/vxagent/tae_sa.h b/h/wrn/wm/snmp/vxagent/tae_sa.h new file mode 100644 index 0000000..b10f9f4 --- /dev/null +++ b/h/wrn/wm/snmp/vxagent/tae_sa.h @@ -0,0 +1,72 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/snmp/vxagent/tae_sa.h,v 1.2 2001/11/06 21:35:16 josh Exp $ */ +/* tae_sa.h - default IO routines for the SNMP AgentX subagent */ + +/* + * Copyright (C) 1999-2005 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + +/* +modification history +------------------------- +01c,19apr05,job update copyright notices +01b,25nov03,ps copyright update +01a,08Jan2001,tneale Created for TAE subagent + +*/ + +/* + * $Log: tae_sa.h,v $ + * Revision 1.2 2001/11/06 21:35:16 josh + * new revised path structure, first pass. Also removing useless + * shell include files. + * + * Revision 1.1.1.1 2001/11/05 17:47:27 tneale + * Tornado shuffle + * + * Revision 1.2 2001/04/16 19:38:45 josh + * merging the kingfisher branch onto the trunk + * + * Revision 1.1.2.2 2001/03/12 22:11:45 tneale + * Updated copyright + * + * Revision 1.1.2.1 2001/02/09 22:51:05 tneale + * Support for non-kernel device management in TAE using AgentX + * + * + */ + +#ifndef __INCtae_sah +#define __INCtae_sah + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ +#include +#include + + +#if defined(__STDC__) || defined(__cplusplus) + +extern void usrTaeSaInit (void); + +#else /* __STDC__ */ + +extern void usrTaeSaInit (); + +#endif + + +#ifdef __cpluplus +} +#endif + + +#endif /* __INCtae_sah */ + diff --git a/h/wrn/wm/snmp/vxagent/vxprotos.h b/h/wrn/wm/snmp/vxagent/vxprotos.h new file mode 100644 index 0000000..2c8bed5 --- /dev/null +++ b/h/wrn/wm/snmp/vxagent/vxprotos.h @@ -0,0 +1,111 @@ +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1994-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: vxprotos.h,v $ + * Revision 1.5 2002/03/19 19:32:01 josh + * add a prototype for function to dynamically add AgentX + * MIB to MIB tree + * + * Revision 1.4 2002/01/04 22:31:55 tneale + * Added prototype for ax_sub_dyncfg_init + * + * Revision 1.3 2001/12/20 21:41:08 meister + * Add some more prototypes + * + * Revision 1.2 2001/11/29 18:31:40 meister + * added prototype for _nvhard_read_v3proxy + * + * Revision 1.1.1.1 2001/11/05 17:47:25 tneale + * Tornado shuffle + * + * Revision 1.1.2.2 2001/10/16 19:53:33 meister + * Add initStartSnmpd() + * + * Revision 1.1.2.1 2001/10/16 19:25:35 meister + * added this file as a place for prototypes for functions specific to + * the vxWorks snmp agent + * + */ + +/* [clearcase] +modification history +------------------- +01b,21apr05,AJS Diffie-Hellman work +01a,19apr05,job update copyright notices +01a,13apr05,AJS Diffie-Hellman work +*/ + +#ifndef WMSNMP_VXPROTO_H +# define WMSNMP_VXPROTO_H 1 + +/* + * vxprotos.h - this file contains prototypes for functions in the vxWorks + * snmp agent. + */ + +#include + +#if (INSTALL_SNMP_VXWORKS_VIRTUAL_STACK) +extern STATUS usrVsSnmpUtilStart(void); +extern STATUS vsSnmpUtilVSRemove(int vsnum); + +#if (INSTALL_ENVOY_SNMP_VERSION_3) +extern int _nvhard_vs_add(int vsnum); +extern int _nvhard_vs_remove(int vsnum); +extern void _vs_v3engine_set(ENT_LOGICAL_T *); +#endif /* INSTALL_ENVOY_SNMP_VERSION_3 */ + +#endif /* INSTALL_SNMP_VXWORKS_VIRTUAL_STACK */ + +extern int _nvhard_read_v3myid (char *eng_id); +extern int _nvhard_read_v3users (void); +extern int _nvhard_read_v3groups (void); +extern int _nvhard_read_v3access (void); +extern int _nvhard_read_v3contexts (void); +extern int _nvhard_read_v3taddr (void); +extern int _nvhard_read_v3tparam (void); +extern int _nvhard_read_v3notify (void); +extern int _nvhard_read_v3nprof (void); +extern int _nvhard_read_v3nfilt (void); +extern int _nvhard_read_v3proxy (void); +extern int _nvhard_read_community (void); +extern int _nvhard_read_usmDHparams (void); + +extern void v3_add_v3_mibs (void); +extern void v3_user_dyncfg_init (void); +extern void ax_add_ax_mibs (void); +extern void ax_master_dyncfg_init (void); +extern void ax_sub_dyncfg_init (void); +extern void snmpCleanAgentXMaster (void); +extern void snmpCleanAgentXSubagent (void); + +extern void axSockClose (void); + +extern void initStartSnmpd (void); + +extern void snmpCleanUserTable (void); +extern void snmpCleanSecurityToGroupTable (void); +extern void snmpCleanAccessTable (void); +extern void snmpCleanContextTable (void); +extern void snmpCleanV3Tree (void); +extern void snmpCleanTargetTables (void); +extern void snmpCleanNotifyTables (void); +extern void snmpCleanCommunityTable (void); +extern void snmpCleanProxyTable (void); +extern int snmpDHrand (void); + +#endif /* WMSNMP_VXPROTO_H */ diff --git a/h/wrn/wm/util/layout/agentx.h b/h/wrn/wm/util/layout/agentx.h new file mode 100644 index 0000000..4cc9ef3 --- /dev/null +++ b/h/wrn/wm/util/layout/agentx.h @@ -0,0 +1,549 @@ +/* This file was automatically generated by Epilogue Technology's + * network datastructure layout tool. + * + * DO NOT MODIFY THIS FILE BY HAND. + * + * Source file information: + * Id: agentx.ldb,v 1.10 1998/02/25 15:21:38 sra Exp + */ + +#ifndef EPILOGUE_LAYOUT_AGENTX_H +#define EPILOGUE_LAYOUT_AGENTX_H + +#ifndef EPILOGUE_INSTALL_H +#include +#endif +#ifndef EPILOGUE_TYPES_H +#include +#endif +#ifndef EPILOGUE_LAYOUT_LDBGLUE_H +#include +#endif + +/* Definitions for AGENTX_PDU */ + +#define SIZEOF_AGENTX_PDU (20) +#define PTR_AGENTX_PDU_VERSION(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_AGENTX_PDU_VERSION(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_AGENTX_PDU_VERSION(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define PTR_AGENTX_PDU_TYPE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_AGENTX_PDU_TYPE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_AGENTX_PDU_TYPE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define AGENTX_PDU_TYPE_is_OPEN GLUE_CAST08(1L) +#define AGENTX_PDU_TYPE_is_CLOSE GLUE_CAST08(2L) +#define AGENTX_PDU_TYPE_is_REG GLUE_CAST08(3L) +#define AGENTX_PDU_TYPE_is_UNREG GLUE_CAST08(4L) +#define AGENTX_PDU_TYPE_is_GET GLUE_CAST08(5L) +#define AGENTX_PDU_TYPE_is_NEXT GLUE_CAST08(6L) +#define AGENTX_PDU_TYPE_is_BULK GLUE_CAST08(7L) +#define AGENTX_PDU_TYPE_is_TEST_SET GLUE_CAST08(8L) +#define AGENTX_PDU_TYPE_is_COMMIT_SET GLUE_CAST08(9L) +#define AGENTX_PDU_TYPE_is_UNDO_SET GLUE_CAST08(10L) +#define AGENTX_PDU_TYPE_is_CLEANUP_SET GLUE_CAST08(11L) +#define AGENTX_PDU_TYPE_is_NOTIFY GLUE_CAST08(12L) +#define AGENTX_PDU_TYPE_is_PING GLUE_CAST08(13L) +#define AGENTX_PDU_TYPE_is_INDEX_ALLOCATE GLUE_CAST08(14L) +#define AGENTX_PDU_TYPE_is_INDEX_DEALLOCATE GLUE_CAST08(15L) +#define AGENTX_PDU_TYPE_is_ADD_AGENT_CAPS GLUE_CAST08(16L) +#define AGENTX_PDU_TYPE_is_REMOVE_AGENT_CAPS GLUE_CAST08(17L) +#define AGENTX_PDU_TYPE_is_RESP GLUE_CAST08(18L) +#define PTR_AGENTX_PDU_FLAGS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_AGENTX_PDU_FLAGS(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) +#define SET_AGENTX_PDU_FLAGS(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST08(_V_)) +#define AGENTX_PDU_FLAGS_is_INSTANCE_REGISTRATION GLUE_CAST08(1L) +#define AGENTX_PDU_FLAGS_is_NEW_INDEX GLUE_CAST08(2L) +#define AGENTX_PDU_FLAGS_is_ANY_INDEX GLUE_CAST08(4L) +#define AGENTX_PDU_FLAGS_is_NON_DEFAULT_CONTEXT GLUE_CAST08(8L) +#define AGENTX_PDU_FLAGS_is_NETWORK_BYTE_ORDER GLUE_CAST08(16L) +/* Can't define PTR_AGENTX_PDU_FILL0 because: + Size 3 is not a multiple of 8. */ +#define GET_AGENTX_PDU_FILL0(_P_)\ + GLUE_CAST08(GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) >> 5) +#define SET_AGENTX_PDU_FILL0(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(2), (GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) & ~GLUE_CAST08(0xE0L)) | ((GLUE_CAST08(_V_) << 5) & GLUE_CAST08(0xE0L))) +/* Can't define PTR_AGENTX_PDU_NETWORK_BYTE_ORDER because: + Size 1 is not a multiple of 8. */ +#define GET_AGENTX_PDU_NETWORK_BYTE_ORDER(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) & GLUE_CAST08(0x10L)) +#define SET_AGENTX_PDU_NETWORK_BYTE_ORDER(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(2), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) | GLUE_CAST08(0x10L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) & ~GLUE_CAST08(0x10L))) +/* Can't define PTR_AGENTX_PDU_NON_DEFAULT_CONTEXT because: + Size 1 is not a multiple of 8. */ +#define GET_AGENTX_PDU_NON_DEFAULT_CONTEXT(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) & GLUE_CAST08(0x8L)) +#define SET_AGENTX_PDU_NON_DEFAULT_CONTEXT(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(2), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) | GLUE_CAST08(0x8L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) & ~GLUE_CAST08(0x8L))) +/* Can't define PTR_AGENTX_PDU_ANY_INDEX because: + Size 1 is not a multiple of 8. */ +#define GET_AGENTX_PDU_ANY_INDEX(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) & GLUE_CAST08(0x4L)) +#define SET_AGENTX_PDU_ANY_INDEX(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(2), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) | GLUE_CAST08(0x4L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) & ~GLUE_CAST08(0x4L))) +/* Can't define PTR_AGENTX_PDU_NEW_INDEX because: + Size 1 is not a multiple of 8. */ +#define GET_AGENTX_PDU_NEW_INDEX(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) & GLUE_CAST08(0x2L)) +#define SET_AGENTX_PDU_NEW_INDEX(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(2), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) | GLUE_CAST08(0x2L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) & ~GLUE_CAST08(0x2L))) +/* Can't define PTR_AGENTX_PDU_INSTANCE_REGISTRATION because: + Size 1 is not a multiple of 8. */ +#define GET_AGENTX_PDU_INSTANCE_REGISTRATION(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) & GLUE_CAST08(0x1L)) +#define SET_AGENTX_PDU_INSTANCE_REGISTRATION(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(2), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) | GLUE_CAST08(0x1L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) & ~GLUE_CAST08(0x1L))) +#define PTR_AGENTX_PDU_FILL1(_P_)\ + ((GLUE_CAST_PTR(_P_))+(3)) +#define GET_AGENTX_PDU_FILL1(_P_)\ + GLUE_GU08((GLUE_CAST_PTR(_P_))+(3)) +#define SET_AGENTX_PDU_FILL1(_P_, _V_)\ + GLUE_SU08((GLUE_CAST_PTR(_P_))+(3), GLUE_CAST08(_V_)) +#define PTR_AGENTX_PDU_SESSION_ID(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define SIZEOF_AGENTX_PDU_SESSION_ID (4) +#define PTR_AGENTX_PDU_SESSION_ID_B(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_AGENTX_PDU_SESSION_ID_B(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(4)) +#define SET_AGENTX_PDU_SESSION_ID_B(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST32(_V_)) +#define PTR_AGENTX_PDU_SESSION_ID_L(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_AGENTX_PDU_SESSION_ID_L(_P_)\ + GLUE_GL32((GLUE_CAST_PTR(_P_))+(4)) +#define SET_AGENTX_PDU_SESSION_ID_L(_P_, _V_)\ + GLUE_SL32((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST32(_V_)) +#define PTR_AGENTX_PDU_TRANS_ID(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define SIZEOF_AGENTX_PDU_TRANS_ID (4) +#define PTR_AGENTX_PDU_TRANS_ID_B(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define GET_AGENTX_PDU_TRANS_ID_B(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(8)) +#define SET_AGENTX_PDU_TRANS_ID_B(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(8), GLUE_CAST32(_V_)) +#define PTR_AGENTX_PDU_TRANS_ID_L(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define GET_AGENTX_PDU_TRANS_ID_L(_P_)\ + GLUE_GL32((GLUE_CAST_PTR(_P_))+(8)) +#define SET_AGENTX_PDU_TRANS_ID_L(_P_, _V_)\ + GLUE_SL32((GLUE_CAST_PTR(_P_))+(8), GLUE_CAST32(_V_)) +#define PTR_AGENTX_PDU_PACKET_ID(_P_)\ + ((GLUE_CAST_PTR(_P_))+(12)) +#define SIZEOF_AGENTX_PDU_PACKET_ID (4) +#define PTR_AGENTX_PDU_PACKET_ID_B(_P_)\ + ((GLUE_CAST_PTR(_P_))+(12)) +#define GET_AGENTX_PDU_PACKET_ID_B(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(12)) +#define SET_AGENTX_PDU_PACKET_ID_B(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(12), GLUE_CAST32(_V_)) +#define PTR_AGENTX_PDU_PACKET_ID_L(_P_)\ + ((GLUE_CAST_PTR(_P_))+(12)) +#define GET_AGENTX_PDU_PACKET_ID_L(_P_)\ + GLUE_GL32((GLUE_CAST_PTR(_P_))+(12)) +#define SET_AGENTX_PDU_PACKET_ID_L(_P_, _V_)\ + GLUE_SL32((GLUE_CAST_PTR(_P_))+(12), GLUE_CAST32(_V_)) +#define PTR_AGENTX_PDU_PAYLOAD_LEN(_P_)\ + ((GLUE_CAST_PTR(_P_))+(16)) +#define SIZEOF_AGENTX_PDU_PAYLOAD_LEN (4) +#define PTR_AGENTX_PDU_PAYLOAD_LEN_B(_P_)\ + ((GLUE_CAST_PTR(_P_))+(16)) +#define GET_AGENTX_PDU_PAYLOAD_LEN_B(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(16)) +#define SET_AGENTX_PDU_PAYLOAD_LEN_B(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(16), GLUE_CAST32(_V_)) +#define PTR_AGENTX_PDU_PAYLOAD_LEN_L(_P_)\ + ((GLUE_CAST_PTR(_P_))+(16)) +#define GET_AGENTX_PDU_PAYLOAD_LEN_L(_P_)\ + GLUE_GL32((GLUE_CAST_PTR(_P_))+(16)) +#define SET_AGENTX_PDU_PAYLOAD_LEN_L(_P_, _V_)\ + GLUE_SL32((GLUE_CAST_PTR(_P_))+(16), GLUE_CAST32(_V_)) + +/* Definitions for AGENTX_CLOSE */ + +#define SIZEOF_AGENTX_CLOSE (4) +#define PTR_AGENTX_CLOSE_REASON(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_AGENTX_CLOSE_REASON(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_AGENTX_CLOSE_REASON(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define AGENTX_CLOSE_REASON_is_OTHER GLUE_CAST08(1L) +#define AGENTX_CLOSE_REASON_is_PARSE_ERROR GLUE_CAST08(2L) +#define AGENTX_CLOSE_REASON_is_PROTOCOL_ERROR GLUE_CAST08(3L) +#define AGENTX_CLOSE_REASON_is_TIMEOUTS GLUE_CAST08(4L) +#define AGENTX_CLOSE_REASON_is_SHUTDOWN GLUE_CAST08(5L) +#define AGENTX_CLOSE_REASON_is_BY_MANAGER GLUE_CAST08(6L) +#define PTR_AGENTX_CLOSE_FILL0(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_AGENTX_CLOSE_FILL0(_P_)\ + GLUE_GU08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_AGENTX_CLOSE_FILL0(_P_, _V_)\ + GLUE_SU08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define PTR_AGENTX_CLOSE_FILL1(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_AGENTX_CLOSE_FILL1(_P_)\ + GLUE_GU16((GLUE_CAST_PTR(_P_))+(2)) +#define SET_AGENTX_CLOSE_FILL1(_P_, _V_)\ + GLUE_SU16((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST16(_V_)) + +/* Definitions for AGENTX_TYPE_CODE */ + +#define SIZEOF_AGENTX_TYPE_CODE (2) +#define GET_AGENTX_TYPE_CODE(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))) +#define SET_AGENTX_TYPE_CODE(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_)), GLUE_CAST16(_V_)) +#define AGENTX_TYPE_CODE_is_INTEGER GLUE_CAST16(2L) +#define AGENTX_TYPE_CODE_is_OCT_STR GLUE_CAST16(4L) +#define AGENTX_TYPE_CODE_is_NULL GLUE_CAST16(5L) +#define AGENTX_TYPE_CODE_is_OID GLUE_CAST16(6L) +#define AGENTX_TYPE_CODE_is_IP_ADDRESS GLUE_CAST16(64L) +#define AGENTX_TYPE_CODE_is_COUNTER32 GLUE_CAST16(65L) +#define AGENTX_TYPE_CODE_is_GAUGE32 GLUE_CAST16(66L) +#define AGENTX_TYPE_CODE_is_TIME_TICKS GLUE_CAST16(67L) +#define AGENTX_TYPE_CODE_is_OPAQUE GLUE_CAST16(68L) +#define AGENTX_TYPE_CODE_is_COUNTER64 GLUE_CAST16(70L) +#define AGENTX_TYPE_CODE_is_NO_SUCH_OBJECT GLUE_CAST16(128L) +#define AGENTX_TYPE_CODE_is_NO_SUCH_INSTANCE GLUE_CAST16(129L) +#define AGENTX_TYPE_CODE_is_END_OF_MIB_VIEW GLUE_CAST16(130L) + +/* Definitions for AGENTX_VARBIND */ + +#define SIZEOF_AGENTX_VARBIND (8) +#define PTR_AGENTX_VARBIND_TYPE(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_AGENTX_VARBIND_TYPE (2) +#define PTR_AGENTX_VARBIND_TYPE_B(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_AGENTX_VARBIND_TYPE_B(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))) +#define SET_AGENTX_VARBIND_TYPE_B(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_)), GLUE_CAST16(_V_)) +#define PTR_AGENTX_VARBIND_TYPE_L(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_AGENTX_VARBIND_TYPE_L(_P_)\ + GLUE_GL16((GLUE_CAST_PTR(_P_))) +#define SET_AGENTX_VARBIND_TYPE_L(_P_, _V_)\ + GLUE_SL16((GLUE_CAST_PTR(_P_)), GLUE_CAST16(_V_)) +#define PTR_AGENTX_VARBIND_FILL0(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_AGENTX_VARBIND_FILL0(_P_)\ + GLUE_GU16((GLUE_CAST_PTR(_P_))+(2)) +#define SET_AGENTX_VARBIND_FILL0(_P_, _V_)\ + GLUE_SU16((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST16(_V_)) +#define PTR_AGENTX_VARBIND_NAME(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) + +/* Definitions for AGENTX_UNSIGNED32 */ + +#define SIZEOF_AGENTX_UNSIGNED32 (4) +#define PTR_AGENTX_UNSIGNED32_B(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_AGENTX_UNSIGNED32_B(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))) +#define SET_AGENTX_UNSIGNED32_B(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_)), GLUE_CAST32(_V_)) +#define PTR_AGENTX_UNSIGNED32_L(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_AGENTX_UNSIGNED32_L(_P_)\ + GLUE_GL32((GLUE_CAST_PTR(_P_))) +#define SET_AGENTX_UNSIGNED32_L(_P_, _V_)\ + GLUE_SL32((GLUE_CAST_PTR(_P_)), GLUE_CAST32(_V_)) + +/* Definitions for AGENTX_UNREG */ + +#define SIZEOF_AGENTX_UNREG (8) +#define PTR_AGENTX_UNREG_FILL0(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_AGENTX_UNREG_FILL0(_P_)\ + GLUE_GU16((GLUE_CAST_PTR(_P_))) +#define SET_AGENTX_UNREG_FILL0(_P_, _V_)\ + GLUE_SU16((GLUE_CAST_PTR(_P_)), GLUE_CAST16(_V_)) +#define PTR_AGENTX_UNREG_RANGE_SUBID(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_AGENTX_UNREG_RANGE_SUBID(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) +#define SET_AGENTX_UNREG_RANGE_SUBID(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST08(_V_)) +#define PTR_AGENTX_UNREG_FILL1(_P_)\ + ((GLUE_CAST_PTR(_P_))+(3)) +#define GET_AGENTX_UNREG_FILL1(_P_)\ + GLUE_GU08((GLUE_CAST_PTR(_P_))+(3)) +#define SET_AGENTX_UNREG_FILL1(_P_, _V_)\ + GLUE_SU08((GLUE_CAST_PTR(_P_))+(3), GLUE_CAST08(_V_)) +#define PTR_AGENTX_UNREG_REGION(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) + +/* Definitions for AGENTX_UNSIGNED16 */ + +#define SIZEOF_AGENTX_UNSIGNED16 (2) +#define PTR_AGENTX_UNSIGNED16_B(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_AGENTX_UNSIGNED16_B(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))) +#define SET_AGENTX_UNSIGNED16_B(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_)), GLUE_CAST16(_V_)) +#define PTR_AGENTX_UNSIGNED16_L(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_AGENTX_UNSIGNED16_L(_P_)\ + GLUE_GL16((GLUE_CAST_PTR(_P_))) +#define SET_AGENTX_UNSIGNED16_L(_P_, _V_)\ + GLUE_SL16((GLUE_CAST_PTR(_P_)), GLUE_CAST16(_V_)) + +/* Definitions for AGENTX_UNSIGNED64 */ + +#define SIZEOF_AGENTX_UNSIGNED64 (8) +#define PTR_AGENTX_UNSIGNED64_B(_P_)\ + ((GLUE_CAST_PTR(_P_))) +/* Can't define (GET_AGENTX_UNSIGNED64_B SET_AGENTX_UNSIGNED64_B) because: + Size 64 is greater than 32. */ +#define PTR_AGENTX_UNSIGNED64_L(_P_)\ + ((GLUE_CAST_PTR(_P_))) +/* Can't define (GET_AGENTX_UNSIGNED64_L SET_AGENTX_UNSIGNED64_L) because: + Size 64 is greater than 32. */ + +/* Definitions for AGENTX_OCT_STR */ + +#define SIZEOF_AGENTX_OCT_STR (4) +#define PTR_AGENTX_OCT_STR_LEN(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_AGENTX_OCT_STR_LEN (4) +#define PTR_AGENTX_OCT_STR_LEN_B(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_AGENTX_OCT_STR_LEN_B(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))) +#define SET_AGENTX_OCT_STR_LEN_B(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_)), GLUE_CAST32(_V_)) +#define PTR_AGENTX_OCT_STR_LEN_L(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_AGENTX_OCT_STR_LEN_L(_P_)\ + GLUE_GL32((GLUE_CAST_PTR(_P_))) +#define SET_AGENTX_OCT_STR_LEN_L(_P_, _V_)\ + GLUE_SL32((GLUE_CAST_PTR(_P_)), GLUE_CAST32(_V_)) +#define PTR_AGENTX_OCT_STR_OCTETS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define SIZEOF_AGENTX_OCT_STR_OCTETS (0) +#define PTR_AGENTX_OCT_STR_OCTETS_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(4)+(_X0_)) +#define GET_AGENTX_OCT_STR_OCTETS_ELT(_P_, _X0_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(4)+(_X0_)) +#define SET_AGENTX_OCT_STR_OCTETS_ELT(_P_, _X0_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(4)+(_X0_), GLUE_CAST08(_V_)) + +/* Definitions for AGENTX_BULK */ + +#define SIZEOF_AGENTX_BULK (4) +#define PTR_AGENTX_BULK_NON_REP(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_AGENTX_BULK_NON_REP (2) +#define PTR_AGENTX_BULK_NON_REP_B(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_AGENTX_BULK_NON_REP_B(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))) +#define SET_AGENTX_BULK_NON_REP_B(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_)), GLUE_CAST16(_V_)) +#define PTR_AGENTX_BULK_NON_REP_L(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_AGENTX_BULK_NON_REP_L(_P_)\ + GLUE_GL16((GLUE_CAST_PTR(_P_))) +#define SET_AGENTX_BULK_NON_REP_L(_P_, _V_)\ + GLUE_SL16((GLUE_CAST_PTR(_P_)), GLUE_CAST16(_V_)) +#define PTR_AGENTX_BULK_MAX_REP(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define SIZEOF_AGENTX_BULK_MAX_REP (2) +#define PTR_AGENTX_BULK_MAX_REP_B(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_AGENTX_BULK_MAX_REP_B(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(2)) +#define SET_AGENTX_BULK_MAX_REP_B(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST16(_V_)) +#define PTR_AGENTX_BULK_MAX_REP_L(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_AGENTX_BULK_MAX_REP_L(_P_)\ + GLUE_GL16((GLUE_CAST_PTR(_P_))+(2)) +#define SET_AGENTX_BULK_MAX_REP_L(_P_, _V_)\ + GLUE_SL16((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST16(_V_)) + +/* Definitions for AGENTX_OPEN */ + +#define SIZEOF_AGENTX_OPEN (8) +#define PTR_AGENTX_OPEN_TIMEOUT(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_AGENTX_OPEN_TIMEOUT(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_AGENTX_OPEN_TIMEOUT(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define PTR_AGENTX_OPEN_FILL0(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_AGENTX_OPEN_FILL0(_P_)\ + GLUE_GU08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_AGENTX_OPEN_FILL0(_P_, _V_)\ + GLUE_SU08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define PTR_AGENTX_OPEN_FILL1(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_AGENTX_OPEN_FILL1(_P_)\ + GLUE_GU16((GLUE_CAST_PTR(_P_))+(2)) +#define SET_AGENTX_OPEN_FILL1(_P_, _V_)\ + GLUE_SU16((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST16(_V_)) +#define PTR_AGENTX_OPEN_OID(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) + +/* Definitions for AGENTX_OID */ + +#define SIZEOF_AGENTX_OID (4) +#define PTR_AGENTX_OID_N_SUBID(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_AGENTX_OID_N_SUBID(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_AGENTX_OID_N_SUBID(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define PTR_AGENTX_OID_PREFIX(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_AGENTX_OID_PREFIX(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_AGENTX_OID_PREFIX(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define PTR_AGENTX_OID_INCLUDE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_AGENTX_OID_INCLUDE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) +#define SET_AGENTX_OID_INCLUDE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST08(_V_)) +#define PTR_AGENTX_OID_FILL0(_P_)\ + ((GLUE_CAST_PTR(_P_))+(3)) +#define GET_AGENTX_OID_FILL0(_P_)\ + GLUE_GU08((GLUE_CAST_PTR(_P_))+(3)) +#define SET_AGENTX_OID_FILL0(_P_, _V_)\ + GLUE_SU08((GLUE_CAST_PTR(_P_))+(3), GLUE_CAST08(_V_)) +#define PTR_AGENTX_OID_SUBIDS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define SIZEOF_AGENTX_OID_SUBIDS (0) +#define PTR_AGENTX_OID_SUBIDS_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(4)+(4)*(_X0_)) +#define SIZEOF_AGENTX_OID_SUBIDS_ELT (4) +#define PTR_AGENTX_OID_SUBIDS_ELT_B(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(4)+(4)*(_X0_)) +#define GET_AGENTX_OID_SUBIDS_ELT_B(_P_, _X0_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(4)+(4)*(_X0_)) +#define SET_AGENTX_OID_SUBIDS_ELT_B(_P_, _X0_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(4)+(4)*(_X0_), GLUE_CAST32(_V_)) +#define PTR_AGENTX_OID_SUBIDS_ELT_L(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(4)+(4)*(_X0_)) +#define GET_AGENTX_OID_SUBIDS_ELT_L(_P_, _X0_)\ + GLUE_GL32((GLUE_CAST_PTR(_P_))+(4)+(4)*(_X0_)) +#define SET_AGENTX_OID_SUBIDS_ELT_L(_P_, _X0_, _V_)\ + GLUE_SL32((GLUE_CAST_PTR(_P_))+(4)+(4)*(_X0_), GLUE_CAST32(_V_)) + +/* Definitions for AGENTX_ERROR_CODE */ + +#define SIZEOF_AGENTX_ERROR_CODE (2) +#define GET_AGENTX_ERROR_CODE(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))) +#define SET_AGENTX_ERROR_CODE(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_)), GLUE_CAST16(_V_)) +#define AGENTX_ERROR_CODE_is_OPEN_FAILED GLUE_CAST16(256L) +#define AGENTX_ERROR_CODE_is_NOT_OPEN GLUE_CAST16(257L) +#define AGENTX_ERROR_CODE_is_INDEX_WRONG_TYPE GLUE_CAST16(258L) +#define AGENTX_ERROR_CODE_is_INDEX_ALREADY_ALLOCATED GLUE_CAST16(259L) +#define AGENTX_ERROR_CODE_is_INDEX_NONE_AVAILABLE GLUE_CAST16(260L) +#define AGENTX_ERROR_CODE_is_INDEX_NOT_ALLOCATED GLUE_CAST16(261L) +#define AGENTX_ERROR_CODE_is_UNSUPPORTED_CONTEXT GLUE_CAST16(262L) +#define AGENTX_ERROR_CODE_is_DUPLICATE_REGISTRATION GLUE_CAST16(263L) +#define AGENTX_ERROR_CODE_is_UNKNOWN_REGISTRATION GLUE_CAST16(264L) +#define AGENTX_ERROR_CODE_is_UNKNOWN_AGENT_CAPS GLUE_CAST16(265L) + +/* Definitions for AGENTX_RESP */ + +#define SIZEOF_AGENTX_RESP (8) +#define PTR_AGENTX_RESP_SYS_UPTIME(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_AGENTX_RESP_SYS_UPTIME (4) +#define PTR_AGENTX_RESP_SYS_UPTIME_B(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_AGENTX_RESP_SYS_UPTIME_B(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))) +#define SET_AGENTX_RESP_SYS_UPTIME_B(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_)), GLUE_CAST32(_V_)) +#define PTR_AGENTX_RESP_SYS_UPTIME_L(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_AGENTX_RESP_SYS_UPTIME_L(_P_)\ + GLUE_GL32((GLUE_CAST_PTR(_P_))) +#define SET_AGENTX_RESP_SYS_UPTIME_L(_P_, _V_)\ + GLUE_SL32((GLUE_CAST_PTR(_P_)), GLUE_CAST32(_V_)) +#define PTR_AGENTX_RESP_ERROR(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define SIZEOF_AGENTX_RESP_ERROR (2) +#define PTR_AGENTX_RESP_ERROR_B(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_AGENTX_RESP_ERROR_B(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(4)) +#define SET_AGENTX_RESP_ERROR_B(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST16(_V_)) +#define PTR_AGENTX_RESP_ERROR_L(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_AGENTX_RESP_ERROR_L(_P_)\ + GLUE_GL16((GLUE_CAST_PTR(_P_))+(4)) +#define SET_AGENTX_RESP_ERROR_L(_P_, _V_)\ + GLUE_SL16((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST16(_V_)) +#define PTR_AGENTX_RESP_INDEX(_P_)\ + ((GLUE_CAST_PTR(_P_))+(6)) +#define SIZEOF_AGENTX_RESP_INDEX (2) +#define PTR_AGENTX_RESP_INDEX_B(_P_)\ + ((GLUE_CAST_PTR(_P_))+(6)) +#define GET_AGENTX_RESP_INDEX_B(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(6)) +#define SET_AGENTX_RESP_INDEX_B(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(6), GLUE_CAST16(_V_)) +#define PTR_AGENTX_RESP_INDEX_L(_P_)\ + ((GLUE_CAST_PTR(_P_))+(6)) +#define GET_AGENTX_RESP_INDEX_L(_P_)\ + GLUE_GL16((GLUE_CAST_PTR(_P_))+(6)) +#define SET_AGENTX_RESP_INDEX_L(_P_, _V_)\ + GLUE_SL16((GLUE_CAST_PTR(_P_))+(6), GLUE_CAST16(_V_)) + +/* Definitions for AGENTX_REG */ + +#define SIZEOF_AGENTX_REG (8) +#define PTR_AGENTX_REG_TIMEOUT(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_AGENTX_REG_TIMEOUT(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_AGENTX_REG_TIMEOUT(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define PTR_AGENTX_REG_PRIORITY(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_AGENTX_REG_PRIORITY(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_AGENTX_REG_PRIORITY(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define PTR_AGENTX_REG_RANGE_SUBID(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_AGENTX_REG_RANGE_SUBID(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) +#define SET_AGENTX_REG_RANGE_SUBID(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST08(_V_)) +#define PTR_AGENTX_REG_FILL0(_P_)\ + ((GLUE_CAST_PTR(_P_))+(3)) +#define GET_AGENTX_REG_FILL0(_P_)\ + GLUE_GU08((GLUE_CAST_PTR(_P_))+(3)) +#define SET_AGENTX_REG_FILL0(_P_, _V_)\ + GLUE_SU08((GLUE_CAST_PTR(_P_))+(3), GLUE_CAST08(_V_)) +#define PTR_AGENTX_REG_REGION(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) + +/* Definitions for AGENTX_PDU_WITH_CONTEXT */ + +#define SIZEOF_AGENTX_PDU_WITH_CONTEXT (24) +#define PTR_AGENTX_PDU_WITH_CONTEXT_CONTEXT(_P_)\ + ((GLUE_CAST_PTR(_P_))+(20)) + +#endif /* EPILOGUE_LAYOUT_AGENTX_H */ diff --git a/h/wrn/wm/util/layout/agentx.ldb b/h/wrn/wm/util/layout/agentx.ldb new file mode 100644 index 0000000..5c76b86 --- /dev/null +++ b/h/wrn/wm/util/layout/agentx.ldb @@ -0,0 +1,338 @@ +; $Header: /usr/cvsroot/target/h/wrn/wm/util/layout/agentx.ldb,v 1.1.1.1 2001/11/05 17:47:19 tneale Exp $ +; Layout information for AgentX + +;**************************************************************************** +; +; *** Restricted Rights Legend *** +; +; The programs and information contained herein are licensed only +; pursuant to a license agreement that contains use, reverse +; engineering, disclosure, and other restrictions; accordingly, it +; is "Unpublished--all rights reserved under the applicable +; copyright laws". +; +; Use duplication, or disclosure by the Government is subject to +; restrictions as set forth in subparagraph (c)(1)(ii) of the Rights +; in Technical Data and Computer Licensed Programs clause of DFARS +; 52.227 7013. +; +; Copyright 2000-2001 Wind River Systems, Inc. +; Copyright 1997 Epilogue Technology Corporation. +; Copyright 1998 Integrated Systems, Inc. +; All rights reserved. +; +; *** Government Use *** +; +; The Licensed Programs and their documentation were developed at +; private expense and no part of them is in the public domain. +; +; The Licensed Programs are "Restricted Computer Software" as that +; term is defined in Clause 52.227-19 of the Federal Acquisition +; Regulations (FAR) and are "Commercial Computer Software" as that +; term is defined in Subpart 227.401 of the Department of Defense +; Federal Acquisition Regulation Supplement (DFARS). +; +; (i) If the licensed Programs are supplied to the Department of +; Defense (DoD), the Licensed Programs are classified as +; "Commercial Computer Software" and the Government is acquiring +; only "restricted rights" in the Licensed Programs and their +; documentation as that term is defined in Clause 52.227 +; 7013(c)(1) of the DFARS, and +; +; (ii) If the Licensed Programs are supplied to any unit or agency +; of the United States Government other than DoD, the +; Government's rights in the Licensed Programs and their +; documentation will be as defined in Clause 52.227-19(c)(2) of +; the FAR. +;**************************************************************************** + +; $Log: agentx.ldb,v $ +; Revision 1.1.1.1 2001/11/05 17:47:19 tneale +; Tornado shuffle +; +; Revision 1.11 2001/01/19 22:22:31 paul +; Update copyright. +; +; Revision 1.10 1998/02/25 15:21:38 sra +; Finish moving types.h, bug.h, and bugdef.h to common/h/. +; +; Revision 1.9 1998/02/25 04:53:42 sra +; Update copyrights. +; +; Revision 1.8 1997/09/26 20:21:12 alan +; Use features of new layout compiler: `use-layouts' and `C-include'. +; +; Revision 1.7 1997/06/12 00:09:53 alan +; Turn all the filler into named fields to make them easier to set to zero. +; +; Revision 1.6 1997/06/04 05:46:06 alan +; Fix RCS keywords. +; +; Revision 1.5 1997/06/03 22:59:27 alan +; Use `define-rcs-info'. +; +; Revision 1.4 1997/06/03 20:58:42 alan +; Stopt trying to have a description for each type of PDU. +; Instead, just define the layouts for those PDUs that have +; a fixed part beyond the header. (I.e. for OPEN, CLOSE, +; RESP, REG, UNREG and BULK). +; +; Revision 1.3 1997/06/03 19:08:48 alan +; Make some names shorter... +; +; Revision 1.2 1997/06/03 02:23:24 alan +; Add FLAGS field to AGENTX_PDU layout. +; +; Revision 1.1 1997/06/01 00:46:14 alan +; Initial version + +(define-rcs-info "$Id: agentx.ldb,v 1.1.1.1 2001/11/05 17:47:19 tneale Exp $") + +(C-include EPILOGUE_INSTALL_H ) +(C-include EPILOGUE_TYPES_H ) +(C-include EPILOGUE_LAYOUT_LDBGLUE_H ) + +(define-layout-macro (big-or-little integer) ; (big-or-little ) + (lambda (form) + `(union (field B (unsigned ,(cadr form))) + (field L (unsigned-8bit-little ,(cadr form)))))) + +(define-layout AGENTX_UNSIGNED16 + (big-or-little 16)) + +(define-layout AGENTX_UNSIGNED32 + (big-or-little 32)) + +(define-layout AGENTX_UNSIGNED64 + (big-or-little 64)) + +(define-layout AGENTX_OID + (struct (field N_SUBID (unsigned 8)) + (field PREFIX (unsigned 8)) + (field INCLUDE (unsigned 8)) + (field FILL0 (opaque 8)) + (field SUBIDS (array (count 0) + (type (big-or-little 32)))))) + +(define-layout AGENTX_OCT_STR + (struct (field LEN (big-or-little 32)) + (field OCTETS (array (count 0) + (type (unsigned 8)))))) + +(define-layout AGENTX_TYPE_CODE + ;; This is the type code -after- you've decoded the big-or-little encoding. + (enum (type (unsigned 16)) + (value INTEGER 2) + (value OCT_STR 4) + (value NULL 5) + (value OID 6) + (value IP_ADDRESS 64) + (value COUNTER32 65) + (value GAUGE32 66) + (value TIME_TICKS 67) + (value OPAQUE 68) + (value COUNTER64 70) + (value NO_SUCH_OBJECT 128) + (value NO_SUCH_INSTANCE 129) + (value END_OF_MIB_VIEW 130))) + +(define-layout AGENTX_VARBIND + (struct (field TYPE (big-or-little 16)) ; an AGENTX_TYPE_CODE + (field FILL0 (opaque 16)) + (field NAME AGENTX_OID) + ;; Followed by any data... + )) + +(define-layout AGENTX_PDU + (struct (size (* 5 32)) ; error check + (field VERSION (unsigned 8)) + (field TYPE (enum (type (unsigned 8)) + (value OPEN 1) + (value CLOSE 2) + (value REG 3) + (value UNREG 4) + (value GET 5) + (value NEXT 6) + (value BULK 7) + (value TEST_SET 8) + (value COMMIT_SET 9) + (value UNDO_SET 10) + (value CLEANUP_SET 11) + (value NOTIFY 12) + (value PING 13) + (value INDEX_ALLOCATE 14) + (value INDEX_DEALLOCATE 15) + (value ADD_AGENT_CAPS 16) + (value REMOVE_AGENT_CAPS 17) + (value RESP 18))) + (union (field FLAGS (enum (type (unsigned 8)) + (value NETWORK_BYTE_ORDER #x10) + (value NON_DEFAULT_CONTEXT #x08) + (value ANY_INDEX #x04) + (value NEW_INDEX #x02) + (value INSTANCE_REGISTRATION #x01) + )) + (struct (size 8) ; error check + (align 1) + (field FILL0 (unsigned 3)) + (field NETWORK_BYTE_ORDER (boolean 1)) + (field NON_DEFAULT_CONTEXT (boolean 1)) + (field ANY_INDEX (boolean 1)) + (field NEW_INDEX (boolean 1)) + (field INSTANCE_REGISTRATION (boolean 1)))) + (field FILL1 (opaque 8)) + (field SESSION_ID (big-or-little 32)) + (field TRANS_ID (big-or-little 32)) + (field PACKET_ID (big-or-little 32)) + (field PAYLOAD_LEN (big-or-little 32)) + )) + +(define-layout AGENTX_PDU_WITH_CONTEXT + (struct (fill (sizeof AGENTX_PDU)) + (field CONTEXT AGENTX_OCT_STR))) + +;(old) (define-layout AGENTX_OPEN +;(old) (struct (fill (sizeof AGENTX_PDU)) +;(old) )) +(define-layout AGENTX_OPEN + (struct (field TIMEOUT (unsigned 8)) + (field FILL0 (opaque 8)) + (field FILL1 (opaque 16)) + (field OID AGENTX_OID) + ;; Followed by an AGENTX_OCT_STR description + )) + +;(old) (define-layout AGENTX_CLOSE +;(old) (struct (fill (sizeof AGENTX_PDU)) +;(old) )) +(define-layout AGENTX_CLOSE + (struct (field REASON (enum (type (unsigned 8)) + (value OTHER 1) + (value PARSE_ERROR 2) + (value PROTOCOL_ERROR 3) + (value TIMEOUTS 4) + (value SHUTDOWN 5) + (value BY_MANAGER 6))) + (field FILL0 (opaque 8)) + (field FILL1 (opaque 16)) + )) + +;(old) (define-layout AGENTX_REG +;(old) (struct (fill (sizeof AGENTX_PDU)) +;(old) ;; Optional context (AGENTX_OCT_STR) +;(old) )) +(define-layout AGENTX_REG + (struct (field TIMEOUT (unsigned 8)) + (field PRIORITY (unsigned 8)) + (field RANGE_SUBID (unsigned 8)) + (field FILL0 (opaque 8)) + (field REGION AGENTX_OID) + ;; Followed by an additional upper bound SUBID + )) + +;(old) (define-layout AGENTX_UNREG +;(old) (struct (fill (sizeof AGENTX_PDU)) +;(old) ;; Optional context (AGENTX_OCT_STR) +;(old) )) +(define-layout AGENTX_UNREG + (struct (field FILL0 (opaque 16)) + (field RANGE_SUBID (unsigned 8)) + (field FILL1 (opaque 8)) + (field REGION AGENTX_OID) + ;; Followed by an additional upper bound SUBID + )) + +;(old) (define-layout AGENTX_GET +;(old) (struct (fill (sizeof AGENTX_PDU)) +;(old) ;; Optional context (AGENTX_OCT_STR) +;(old) ;; Followed by a series of ranges (pairs of AGENTX_OIDs) +;(old) )) + +;(old) (define-layout AGENTX_NEXT +;(old) (struct (fill (sizeof AGENTX_PDU)) +;(old) ;; Optional context (AGENTX_OCT_STR) +;(old) ;; Followed by a series of ranges (pairs of AGENTX_OIDs) +;(old) )) + +;(old) (define-layout AGENTX_BULK +;(old) (struct (fill (sizeof AGENTX_PDU)) +;(old) ;; Optional context (AGENTX_OCT_STR) +;(old) )) +(define-layout AGENTX_BULK + (struct (field NON_REP (big-or-little 16)) + (field MAX_REP (big-or-little 16)) + ;; Followed by a series of ranges (pairs of AGENTX_OIDs) + )) + +;(old) (define-layout AGENTX_TEST_SET +;(old) (struct (fill (sizeof AGENTX_PDU)) +;(old) ;; Optional context (AGENTX_OCT_STR) +;(old) ;; Followed by a series of AGENTX_VARBINDs +;(old) )) + +; +; COMMIT_SET, UNDO_SET and CLEANUP_SET have only the header. +; + +;(old) (define-layout AGENTX_NOTIFY +;(old) (struct (fill (sizeof AGENTX_PDU)) +;(old) ;; Optional context (AGENTX_OCT_STR) +;(old) ;; Followed by a series of AGENTX_VARBINDs +;(old) )) + +; +; PING has only the header, perhaps with context +; + +;(old) (define-layout AGENTX_INDEX_ALLOCATE +;(old) (struct (fill (sizeof AGENTX_PDU)) +;(old) ;; Optional context (AGENTX_OCT_STR) +;(old) ;; Followed by a series of AGENTX_VARBINDs +;(old) )) + +;(old) (define-layout AGENTX_INDEX_DEALLOCATE +;(old) (struct (fill (sizeof AGENTX_PDU)) +;(old) ;; Optional context (AGENTX_OCT_STR) +;(old) ;; Followed by a series of AGENTX_VARBINDs +;(old) )) + +;(old) (define-layout AGENTX_ADD_AGENT_CAPS +;(old) (struct (fill (sizeof AGENTX_PDU)) +;(old) ;; Optional context (AGENTX_OCT_STR) +;(old) ;; Followed an AGENTX_OID +;(old) ;; Followed an AGENTX_OCT_STR +;(old) )) + +;(old) (define-layout AGENTX_REMOVE_AGENT_CAPS +;(old) (struct (fill (sizeof AGENTX_PDU)) +;(old) ;; Optional context (AGENTX_OCT_STR) +;(old) ;; Followed an AGENTX_OID +;(old) )) + +(define-layout AGENTX_ERROR_CODE + ;; This is the error code -after- you've decoded the big-or-little encoding. + (enum (type (unsigned 16)) + (value OPEN_FAILED 256) + (value NOT_OPEN 257) + (value INDEX_WRONG_TYPE 258) + (value INDEX_ALREADY_ALLOCATED 259) + (value INDEX_NONE_AVAILABLE 260) + (value INDEX_NOT_ALLOCATED 261) + (value UNSUPPORTED_CONTEXT 262) + (value DUPLICATE_REGISTRATION 263) + (value UNKNOWN_REGISTRATION 264) + (value UNKNOWN_AGENT_CAPS 265))) + +;(old) (define-layout AGENTX_RESP +;(old) (struct (fill (sizeof AGENTX_PDU)) +;(old) )) +(define-layout AGENTX_RESP + (struct (field SYS_UPTIME (big-or-little 32)) + (field ERROR (big-or-little 16)) ; an AGENTX_ERROR_CODE + (field INDEX (big-or-little 16)) + ;; Followed by any data... + )) + +; Local Variables: +; mode: Scheme +; End: diff --git a/h/wrn/wm/util/layout/apple.h b/h/wrn/wm/util/layout/apple.h new file mode 100644 index 0000000..b1afdd1 --- /dev/null +++ b/h/wrn/wm/util/layout/apple.h @@ -0,0 +1,60 @@ +/* This file was automatically generated by Epilogue Technology's + * network datastructure layout tool. + * + * DO NOT MODIFY THIS FILE BY HAND. + * + * Source file information: + * Id: apple.ldb,v 1.8 1998/02/25 15:21:38 sra Exp + */ + +#ifndef EPILOGUE_LAYOUT_APPLE_H +#define EPILOGUE_LAYOUT_APPLE_H + +#ifndef EPILOGUE_INSTALL_H +#include +#endif +#ifndef EPILOGUE_TYPES_H +#include +#endif +#ifndef EPILOGUE_LAYOUT_LDBGLUE_H +#include +#endif + +/* Definitions for APPLE_LAP */ + +#define SIZEOF_APPLE_LAP (5) +#define PTR_APPLE_LAP_DESTINATION(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_APPLE_LAP_DESTINATION(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_APPLE_LAP_DESTINATION(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define PTR_APPLE_LAP_SOURCE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_APPLE_LAP_SOURCE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_APPLE_LAP_SOURCE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define PTR_APPLE_LAP_TYPE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_APPLE_LAP_TYPE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) +#define SET_APPLE_LAP_TYPE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST08(_V_)) +#define APPLE_LAP_TYPE_is_DDP_SHORT GLUE_CAST08(1L) +#define APPLE_LAP_TYPE_is_DDP_LONG GLUE_CAST08(2L) +#define APPLE_LAP_TYPE_is_ENQ GLUE_CAST08(129L) +#define APPLE_LAP_TYPE_is_ACK GLUE_CAST08(130L) +#define APPLE_LAP_TYPE_is_RTS GLUE_CAST08(132L) +#define APPLE_LAP_TYPE_is_CTS GLUE_CAST08(133L) +/* Can't define PTR_APPLE_LAP_DATA_LENGTH because: + Size 10 is not a multiple of 8. */ +#define GET_APPLE_LAP_DATA_LENGTH(_P_)\ + GLUE_CAST16(GLUE_GB16((GLUE_CAST_PTR(_P_))+(3)) & GLUE_CAST16(0x3FFL)) +#define SET_APPLE_LAP_DATA_LENGTH(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(3), (GLUE_GB16((GLUE_CAST_PTR(_P_))+(3)) & ~GLUE_CAST16(0x3FFL)) | (GLUE_CAST16(_V_) & GLUE_CAST16(0x3FFL))) +#define PTR_APPLE_LAP_DATA(_P_)\ + ((GLUE_CAST_PTR(_P_))+(5)) +#define SIZEOF_APPLE_LAP_DATA (0) + +#endif /* EPILOGUE_LAYOUT_APPLE_H */ diff --git a/h/wrn/wm/util/layout/apple.ldb b/h/wrn/wm/util/layout/apple.ldb new file mode 100644 index 0000000..65cabce --- /dev/null +++ b/h/wrn/wm/util/layout/apple.ldb @@ -0,0 +1,108 @@ +; $Header: /usr/cvsroot/target/h/wrn/wm/util/layout/apple.ldb,v 1.1.1.1 2001/11/05 17:47:19 tneale Exp $ +; Layout information for Apple protocols + +;**************************************************************************** +; +; *** Restricted Rights Legend *** +; +; The programs and information contained herein are licensed only +; pursuant to a license agreement that contains use, reverse +; engineering, disclosure, and other restrictions; accordingly, it +; is "Unpublished--all rights reserved under the applicable +; copyright laws". +; +; Use duplication, or disclosure by the Government is subject to +; restrictions as set forth in subparagraph (c)(1)(ii) of the Rights +; in Technical Data and Computer Licensed Programs clause of DFARS +; 52.227 7013. +; +; Copyright 2000-2001 Wind River Systems, Inc. +; Copyright 1995-1997 Epilogue Technology Corporation. +; Copyright 1998 Integrated Systems, Inc. +; All rights reserved. +; +; *** Government Use *** +; +; The Licensed Programs and their documentation were developed at +; private expense and no part of them is in the public domain. +; +; The Licensed Programs are "Restricted Computer Software" as that +; term is defined in Clause 52.227-19 of the Federal Acquisition +; Regulations (FAR) and are "Commercial Computer Software" as that +; term is defined in Subpart 227.401 of the Department of Defense +; Federal Acquisition Regulation Supplement (DFARS). +; +; (i) If the licensed Programs are supplied to the Department of +; Defense (DoD), the Licensed Programs are classified as +; "Commercial Computer Software" and the Government is acquiring +; only "restricted rights" in the Licensed Programs and their +; documentation as that term is defined in Clause 52.227 +; 7013(c)(1) of the DFARS, and +; +; (ii) If the Licensed Programs are supplied to any unit or agency +; of the United States Government other than DoD, the +; Government's rights in the Licensed Programs and their +; documentation will be as defined in Clause 52.227-19(c)(2) of +; the FAR. +;**************************************************************************** + +; $Log: apple.ldb,v $ +; Revision 1.1.1.1 2001/11/05 17:47:19 tneale +; Tornado shuffle +; +; Revision 1.9 2001/01/19 22:22:32 paul +; Update copyright. +; +; Revision 1.8 1998/02/25 15:21:38 sra +; Finish moving types.h, bug.h, and bugdef.h to common/h/. +; +; Revision 1.7 1998/02/25 04:53:44 sra +; Update copyrights. +; +; Revision 1.6 1997/09/26 20:21:13 alan +; Use features of new layout compiler: `use-layouts' and `C-include'. +; +; Revision 1.5 1997/06/04 05:46:14 alan +; Fix RCS keywords. +; +; Revision 1.4 1997/06/03 22:59:28 alan +; Use `define-rcs-info'. +; +; Revision 1.3 1997/04/22 20:58:11 alan +; Use `(struct (size 0))' where appropriate. +; +; Revision 1.2 1997/04/22 00:18:00 alan +; Fix copyright. +; +; Revision 1.1 1997/04/19 04:12:11 alan +; Move all .ldb files into the `layout' directory. +; +; Revision 1.1 1995/06/26 06:24:17 alan +; Initial revision + +(define-rcs-info "$Id: apple.ldb,v 1.1.1.1 2001/11/05 17:47:19 tneale Exp $") + +(C-include EPILOGUE_INSTALL_H ) +(C-include EPILOGUE_TYPES_H ) +(C-include EPILOGUE_LAYOUT_LDBGLUE_H ) + +(define-layout APPLE_LAP ; or something like this... + (struct (field DESTINATION (unsigned 8)) + (field SOURCE (unsigned 8)) + (field TYPE (enum (type (unsigned 8)) + (value DDP_SHORT #x01) + (value DDP_LONG #x02) + (value ENQ #x81) + (value ACK #x82) + (value RTS #x84) + (value CTS #x85))) + ;; ----- control packets (TYPE >= #x80) end here ----- + (struct (size 16) + (align 1) + (fill 6) + (field DATA_LENGTH (unsigned 10))) + (field DATA (struct (size 0))))) + +; Local Variables: +; mode: Scheme +; End: diff --git a/h/wrn/wm/util/layout/arp.h b/h/wrn/wm/util/layout/arp.h new file mode 100644 index 0000000..04b3349 --- /dev/null +++ b/h/wrn/wm/util/layout/arp.h @@ -0,0 +1,69 @@ +/* This file was automatically generated by Epilogue Technology's + * network datastructure layout tool. + * + * DO NOT MODIFY THIS FILE BY HAND. + * + * Source file information: + * Id: arp.ldb,v 1.10 1998/02/25 15:21:38 sra Exp + */ + +#ifndef EPILOGUE_LAYOUT_ARP_H +#define EPILOGUE_LAYOUT_ARP_H + +#ifndef EPILOGUE_INSTALL_H +#include +#endif +#ifndef EPILOGUE_TYPES_H +#include +#endif +#ifndef EPILOGUE_LAYOUT_LDBGLUE_H +#include +#endif + +/* Definitions for ARP_HEADER */ + +#define SIZEOF_ARP_HEADER (8) +#define PTR_ARP_HEADER_HARDWARE_TYPE(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_ARP_HEADER_HARDWARE_TYPE(_P_)\ + GLUE_GU16((GLUE_CAST_PTR(_P_))) +#define SET_ARP_HEADER_HARDWARE_TYPE(_P_, _V_)\ + GLUE_SU16((GLUE_CAST_PTR(_P_)), GLUE_CAST16(_V_)) +#define ARP_HEADER_HARDWARE_TYPE_is_ETHERNET GLUE_OPAQUE16(GLUE_CAST16(1L)) +#define ARP_HEADER_HARDWARE_TYPE_is_AX25 GLUE_OPAQUE16(GLUE_CAST16(3L)) +#define ARP_HEADER_HARDWARE_TYPE_is_PRONET GLUE_OPAQUE16(GLUE_CAST16(4L)) +#define ARP_HEADER_HARDWARE_TYPE_is_CHAOS GLUE_OPAQUE16(GLUE_CAST16(5L)) +#define ARP_HEADER_HARDWARE_TYPE_is_IEEE802 GLUE_OPAQUE16(GLUE_CAST16(6L)) +#define ARP_HEADER_HARDWARE_TYPE_is_ARCNET GLUE_OPAQUE16(GLUE_CAST16(7L)) +#define ARP_HEADER_HARDWARE_TYPE_is_HYPERCHANNEL GLUE_OPAQUE16(GLUE_CAST16(8L)) +#define ARP_HEADER_HARDWARE_TYPE_is_LANSTAR GLUE_OPAQUE16(GLUE_CAST16(9L)) +#define ARP_HEADER_HARDWARE_TYPE_is_AUTONET GLUE_OPAQUE16(GLUE_CAST16(10L)) +#define ARP_HEADER_HARDWARE_TYPE_is_SMDS GLUE_OPAQUE16(GLUE_CAST16(14L)) +#define PTR_ARP_HEADER_PROTOCOL_TYPE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_ARP_HEADER_PROTOCOL_TYPE(_P_)\ + GLUE_GU16((GLUE_CAST_PTR(_P_))+(2)) +#define SET_ARP_HEADER_PROTOCOL_TYPE(_P_, _V_)\ + GLUE_SU16((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST16(_V_)) +#define PTR_ARP_HEADER_HARDWARE_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_ARP_HEADER_HARDWARE_LENGTH(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(4)) +#define SET_ARP_HEADER_HARDWARE_LENGTH(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST08(_V_)) +#define PTR_ARP_HEADER_PROTOCOL_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(5)) +#define GET_ARP_HEADER_PROTOCOL_LENGTH(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(5)) +#define SET_ARP_HEADER_PROTOCOL_LENGTH(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(5), GLUE_CAST08(_V_)) +#define PTR_ARP_HEADER_OPCODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(6)) +#define GET_ARP_HEADER_OPCODE(_P_)\ + GLUE_GU16((GLUE_CAST_PTR(_P_))+(6)) +#define SET_ARP_HEADER_OPCODE(_P_, _V_)\ + GLUE_SU16((GLUE_CAST_PTR(_P_))+(6), GLUE_CAST16(_V_)) +#define ARP_HEADER_OPCODE_is_REQUEST GLUE_OPAQUE16(GLUE_CAST16(1L)) +#define ARP_HEADER_OPCODE_is_REPLY GLUE_OPAQUE16(GLUE_CAST16(2L)) + +#endif /* EPILOGUE_LAYOUT_ARP_H */ diff --git a/h/wrn/wm/util/layout/arp.ldb b/h/wrn/wm/util/layout/arp.ldb new file mode 100644 index 0000000..a5de3ab --- /dev/null +++ b/h/wrn/wm/util/layout/arp.ldb @@ -0,0 +1,138 @@ +; $Header: /usr/cvsroot/target/h/wrn/wm/util/layout/arp.ldb,v 1.1.1.1 2001/11/05 17:47:19 tneale Exp $ +; Layout information for ARP + +;**************************************************************************** +; +; *** Restricted Rights Legend *** +; +; The programs and information contained herein are licensed only +; pursuant to a license agreement that contains use, reverse +; engineering, disclosure, and other restrictions; accordingly, it +; is "Unpublished--all rights reserved under the applicable +; copyright laws". +; +; Use duplication, or disclosure by the Government is subject to +; restrictions as set forth in subparagraph (c)(1)(ii) of the Rights +; in Technical Data and Computer Licensed Programs clause of DFARS +; 52.227 7013. +; +; Copyright 2000-2001 Wind River Systems, Inc. +; Copyright 1995-1997 Epilogue Technology Corporation. +; Copyright 1998 Integrated Systems, Inc. +; All rights reserved. +; +; *** Government Use *** +; +; The Licensed Programs and their documentation were developed at +; private expense and no part of them is in the public domain. +; +; The Licensed Programs are "Restricted Computer Software" as that +; term is defined in Clause 52.227-19 of the Federal Acquisition +; Regulations (FAR) and are "Commercial Computer Software" as that +; term is defined in Subpart 227.401 of the Department of Defense +; Federal Acquisition Regulation Supplement (DFARS). +; +; (i) If the licensed Programs are supplied to the Department of +; Defense (DoD), the Licensed Programs are classified as +; "Commercial Computer Software" and the Government is acquiring +; only "restricted rights" in the Licensed Programs and their +; documentation as that term is defined in Clause 52.227 +; 7013(c)(1) of the DFARS, and +; +; (ii) If the Licensed Programs are supplied to any unit or agency +; of the United States Government other than DoD, the +; Government's rights in the Licensed Programs and their +; documentation will be as defined in Clause 52.227-19(c)(2) of +; the FAR. +;**************************************************************************** + +; $Log: arp.ldb,v $ +; Revision 1.1.1.1 2001/11/05 17:47:19 tneale +; Tornado shuffle +; +; Revision 1.11 2001/01/19 22:22:32 paul +; Update copyright. +; +; Revision 1.10 1998/02/25 15:21:38 sra +; Finish moving types.h, bug.h, and bugdef.h to common/h/. +; +; Revision 1.9 1998/02/25 04:53:47 sra +; Update copyrights. +; +; Revision 1.8 1998/02/20 04:02:36 sra +; Fix too-long layout macro names. +; +; Revision 1.7 1997/09/26 20:21:13 alan +; Use features of new layout compiler: `use-layouts' and `C-include'. +; +; Revision 1.6 1997/09/23 18:17:44 sra +; Comment out 3MB Ethernet to avoid breaking BCC 4.0. +; +; Revision 1.5 1997/06/04 05:46:17 alan +; Fix RCS keywords. +; +; Revision 1.4 1997/06/03 22:59:29 alan +; Use `define-rcs-info'. +; +; Revision 1.3 1997/05/19 21:18:44 alan +; Add more HARDWARE_TYPE values. +; +; Revision 1.2 1997/04/22 00:18:30 alan +; Fix copyright. +; +; Revision 1.1 1997/04/19 04:12:12 alan +; Move all .ldb files into the `layout' directory. +; +; Revision 1.2 1995/06/26 06:25:29 alan +; Comment on Apple protocols +; +; Revision 1.1 1995/05/23 07:16:45 alan +; Basic network layouts. + +(define-rcs-info "$Id: arp.ldb,v 1.1.1.1 2001/11/05 17:47:19 tneale Exp $") + +(C-include EPILOGUE_INSTALL_H ) +(C-include EPILOGUE_TYPES_H ) +(C-include EPILOGUE_LAYOUT_LDBGLUE_H ) + +; This same layout is used for RARP and several other related protocols... +; It also -almost- works for AppleTalk ARP (AARP), see below... + +(define-layout ARP_HEADER + (struct (field HARDWARE_TYPE (enum (type (opaque 16)) + (value ETHERNET 1) +; (value ETHERNET3MB 2) + (value AX25 3) + (value PRONET 4) + (value CHAOS 5) + (value IEEE802 6) + (value ARCNET 7) + (value HYPERCHANNEL 8) + (value LANSTAR 9) + (value AUTONET 10) +; (value LOCALTALK 11) +; (value LOCALNET 12) + (value SMDS 14) + )) + (field PROTOCOL_TYPE (opaque 16)) ; same values as ETHERNET_TYPE + (field HARDWARE_LENGTH (unsigned 8)) + (field PROTOCOL_LENGTH (unsigned 8)) + (field OPCODE (enum (type (opaque 16)) + (value REQUEST 1) + (value REPLY 2) +; (value REVERSE_REQUEST 3) + ;; Give 16-bits worth of opcode, why the + ;; hell did Apple choose 3 for this? + ;; (value APPLETALK_ARP_PROBE 3) +; (value REVERSE_REPLY 4) + )) + ;; After the header comes: + ;; sender's hardware address + ;; sender's protocol address + ;; target's hardware address + ;; target's protocol address + )) + +; Local Variables: +; mode: Scheme +; End: diff --git a/h/wrn/wm/util/layout/bgp.h b/h/wrn/wm/util/layout/bgp.h new file mode 100644 index 0000000..27420db --- /dev/null +++ b/h/wrn/wm/util/layout/bgp.h @@ -0,0 +1,412 @@ +/* This file was automatically generated by Epilogue Technology's + * network datastructure layout tool. + * + * DO NOT MODIFY THIS FILE BY HAND. + * + * Source file information: + * Id: bgp.ldb,v 1.8 1998/02/25 15:21:39 sra Exp + * --used -- + * Id: ip.ldb,v 1.17 1998/02/25 15:21:40 sra Exp + */ + +#ifndef EPILOGUE_LAYOUT_BGP_H +#define EPILOGUE_LAYOUT_BGP_H + +#ifndef EPILOGUE_INSTALL_H +#include +#endif +#ifndef EPILOGUE_TYPES_H +#include +#endif +#ifndef EPILOGUE_LAYOUT_LDBGLUE_H +#include +#endif + +/* Definitions for BGP_HEADER */ + +#define SIZEOF_BGP_HEADER (19) +#define PTR_BGP_HEADER_MARKER(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_BGP_HEADER_MARKER (16) +#define PTR_BGP_HEADER_MARKER_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(_X0_)) +#define GET_BGP_HEADER_MARKER_ELT(_P_, _X0_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(_X0_)) +#define SET_BGP_HEADER_MARKER_ELT(_P_, _X0_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(_X0_), GLUE_CAST08(_V_)) +#define PTR_BGP_HEADER_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(16)) +#define GET_BGP_HEADER_LENGTH(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(16)) +#define SET_BGP_HEADER_LENGTH(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(16), GLUE_CAST16(_V_)) +#define PTR_BGP_HEADER_TYPE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(18)) +#define GET_BGP_HEADER_TYPE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(18)) +#define SET_BGP_HEADER_TYPE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(18), GLUE_CAST08(_V_)) +#define BGP_HEADER_TYPE_is_OPEN GLUE_CAST08(1L) +#define BGP_HEADER_TYPE_is_UPDATE GLUE_CAST08(2L) +#define BGP_HEADER_TYPE_is_NOTIFICATION GLUE_CAST08(3L) +#define BGP_HEADER_TYPE_is_KEEPALIVE GLUE_CAST08(4L) + +/* Definitions for BGP_NOTIFY */ + +#define SIZEOF_BGP_NOTIFY (21) +#define PTR_BGP_NOTIFY_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(19)) +#define GET_BGP_NOTIFY_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(19)) +#define SET_BGP_NOTIFY_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(19), GLUE_CAST08(_V_)) +#define BGP_NOTIFY_CODE_is_HDR_ERR GLUE_CAST08(1L) +#define BGP_NOTIFY_CODE_is_OPEN_ERR GLUE_CAST08(2L) +#define BGP_NOTIFY_CODE_is_UPD_ERR GLUE_CAST08(3L) +#define BGP_NOTIFY_CODE_is_HOLD_TIMER GLUE_CAST08(4L) +#define BGP_NOTIFY_CODE_is_STATE_MACHINE GLUE_CAST08(5L) +#define BGP_NOTIFY_CODE_is_CEASE GLUE_CAST08(6L) +#define PTR_BGP_NOTIFY_HDR_ERR(_P_)\ + ((GLUE_CAST_PTR(_P_))+(20)) +#define GET_BGP_NOTIFY_HDR_ERR(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(20)) +#define SET_BGP_NOTIFY_HDR_ERR(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(20), GLUE_CAST08(_V_)) +#define BGP_NOTIFY_HDR_ERR_is_CONN_NOT_SYNC GLUE_CAST08(1L) +#define BGP_NOTIFY_HDR_ERR_is_BAD_LENGTH GLUE_CAST08(2L) +#define BGP_NOTIFY_HDR_ERR_is_BAD_TYPE GLUE_CAST08(3L) +#define PTR_BGP_NOTIFY_OPEN_ERR(_P_)\ + ((GLUE_CAST_PTR(_P_))+(20)) +#define GET_BGP_NOTIFY_OPEN_ERR(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(20)) +#define SET_BGP_NOTIFY_OPEN_ERR(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(20), GLUE_CAST08(_V_)) +#define BGP_NOTIFY_OPEN_ERR_is_VERSION_UNSUPPORTED GLUE_CAST08(1L) +#define BGP_NOTIFY_OPEN_ERR_is_BAD_AS GLUE_CAST08(2L) +#define BGP_NOTIFY_OPEN_ERR_is_BAD_IDENTIFIER GLUE_CAST08(3L) +#define BGP_NOTIFY_OPEN_ERR_is_PARAMETER_UNSUPPORTED GLUE_CAST08(4L) +#define BGP_NOTIFY_OPEN_ERR_is_AUTH_FAILURE GLUE_CAST08(5L) +#define BGP_NOTIFY_OPEN_ERR_is_BAD_HOLD_TIME GLUE_CAST08(6L) +#define PTR_BGP_NOTIFY_UPD_ERR(_P_)\ + ((GLUE_CAST_PTR(_P_))+(20)) +#define GET_BGP_NOTIFY_UPD_ERR(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(20)) +#define SET_BGP_NOTIFY_UPD_ERR(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(20), GLUE_CAST08(_V_)) +#define BGP_NOTIFY_UPD_ERR_is_BAD_ATTRIBUTES GLUE_CAST08(1L) +#define BGP_NOTIFY_UPD_ERR_is_UNRECOGNIZED_ATTRIBUTE GLUE_CAST08(2L) +#define BGP_NOTIFY_UPD_ERR_is_MISSING_ATTRIBUTE GLUE_CAST08(3L) +#define BGP_NOTIFY_UPD_ERR_is_BAD_FLAGS GLUE_CAST08(4L) +#define BGP_NOTIFY_UPD_ERR_is_BAD_LENGTH GLUE_CAST08(5L) +#define BGP_NOTIFY_UPD_ERR_is_BAD_ORIGIN GLUE_CAST08(6L) +#define BGP_NOTIFY_UPD_ERR_is_ROUTING_LOOP GLUE_CAST08(7L) +#define BGP_NOTIFY_UPD_ERR_is_BAD_NEXT_HOP GLUE_CAST08(8L) +#define BGP_NOTIFY_UPD_ERR_is_BAD_OPTIONAL_ATTRIBUTE GLUE_CAST08(9L) +#define BGP_NOTIFY_UPD_ERR_is_BAD_NETWORK GLUE_CAST08(10L) +#define BGP_NOTIFY_UPD_ERR_is_BAD_AS_PATH GLUE_CAST08(11L) +#define PTR_BGP_NOTIFY_DATA(_P_)\ + ((GLUE_CAST_PTR(_P_))+(21)) +#define SIZEOF_BGP_NOTIFY_DATA (0) +#define PTR_BGP_NOTIFY_DATA_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(21)+(_X0_)) +#define GET_BGP_NOTIFY_DATA_ELT(_P_, _X0_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(21)+(_X0_)) +#define SET_BGP_NOTIFY_DATA_ELT(_P_, _X0_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(21)+(_X0_), GLUE_CAST08(_V_)) + +/* Definitions for BGP_ADDRESS_PREFIX */ + +#define SIZEOF_BGP_ADDRESS_PREFIX (1) +#define PTR_BGP_ADDRESS_PREFIX_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_BGP_ADDRESS_PREFIX_LENGTH(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_BGP_ADDRESS_PREFIX_LENGTH(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define PTR_BGP_ADDRESS_PREFIX_PREFIX(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define SIZEOF_BGP_ADDRESS_PREFIX_PREFIX (0) +#define PTR_BGP_ADDRESS_PREFIX_PREFIX_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(1)+(_X0_)) +#define GET_BGP_ADDRESS_PREFIX_PREFIX_ELT(_P_, _X0_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)+(_X0_)) +#define SET_BGP_ADDRESS_PREFIX_PREFIX_ELT(_P_, _X0_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1)+(_X0_), GLUE_CAST08(_V_)) + +/* Definitions for BGP_UPDATE_REACHABLES */ + +#define SIZEOF_BGP_UPDATE_REACHABLES (0) +#define PTR_BGP_UPDATE_REACHABLES_PREFIXES(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_BGP_UPDATE_REACHABLES_PREFIXES (0) + +/* Definitions for AS_NUMBER */ + +#define SIZEOF_AS_NUMBER (2) +#define GET_AS_NUMBER(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))) +#define SET_AS_NUMBER(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_)), GLUE_CAST16(_V_)) + +/* Definitions for BGP_KEEPALIVE_MSG */ + +#define SIZEOF_BGP_KEEPALIVE_MSG (19) + +/* Definitions for BGP_LOCAL_PREF_ATTRIBUTE */ + +#define SIZEOF_BGP_LOCAL_PREF_ATTRIBUTE (4) +#define PTR_BGP_LOCAL_PREF_ATTRIBUTE_PREF(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_BGP_LOCAL_PREF_ATTRIBUTE_PREF(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))) +#define SET_BGP_LOCAL_PREF_ATTRIBUTE_PREF(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_)), GLUE_CAST32(_V_)) + +/* Definitions for BGP_UPDATE_UNFEASIBLES */ + +#define SIZEOF_BGP_UPDATE_UNFEASIBLES (2) +#define PTR_BGP_UPDATE_UNFEASIBLES_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_BGP_UPDATE_UNFEASIBLES_LENGTH(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))) +#define SET_BGP_UPDATE_UNFEASIBLES_LENGTH(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_)), GLUE_CAST16(_V_)) +#define PTR_BGP_UPDATE_UNFEASIBLES_PREFIXES(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define SIZEOF_BGP_UPDATE_UNFEASIBLES_PREFIXES (0) + +/* Definitions for BGP_UPDATE_ATTRIBUTES */ + +#define SIZEOF_BGP_UPDATE_ATTRIBUTES (2) +#define PTR_BGP_UPDATE_ATTRIBUTES_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_BGP_UPDATE_ATTRIBUTES_LENGTH(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))) +#define SET_BGP_UPDATE_ATTRIBUTES_LENGTH(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_)), GLUE_CAST16(_V_)) +#define PTR_BGP_UPDATE_ATTRIBUTES_ATTRIBUTES(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define SIZEOF_BGP_UPDATE_ATTRIBUTES_ATTRIBUTES (0) + +/* Definitions for BGP_OPEN_MSG */ + +#define SIZEOF_BGP_OPEN_MSG (29) +#define PTR_BGP_OPEN_MSG_VERSION(_P_)\ + ((GLUE_CAST_PTR(_P_))+(19)) +#define GET_BGP_OPEN_MSG_VERSION(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(19)) +#define SET_BGP_OPEN_MSG_VERSION(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(19), GLUE_CAST08(_V_)) +#define PTR_BGP_OPEN_MSG_MY_AS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(20)) +#define GET_BGP_OPEN_MSG_MY_AS(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(20)) +#define SET_BGP_OPEN_MSG_MY_AS(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(20), GLUE_CAST16(_V_)) +#define PTR_BGP_OPEN_MSG_HOLD_TIME(_P_)\ + ((GLUE_CAST_PTR(_P_))+(22)) +#define GET_BGP_OPEN_MSG_HOLD_TIME(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(22)) +#define SET_BGP_OPEN_MSG_HOLD_TIME(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(22), GLUE_CAST16(_V_)) +#define PTR_BGP_OPEN_MSG_IDENTIFIER(_P_)\ + ((GLUE_CAST_PTR(_P_))+(24)) +#define GET_BGP_OPEN_MSG_IDENTIFIER(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(24)) +#define SET_BGP_OPEN_MSG_IDENTIFIER(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(24), GLUE_CAST32(_V_)) +#define PTR_BGP_OPEN_MSG_PARAMETERS_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(28)) +#define GET_BGP_OPEN_MSG_PARAMETERS_LENGTH(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(28)) +#define SET_BGP_OPEN_MSG_PARAMETERS_LENGTH(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(28), GLUE_CAST08(_V_)) +#define PTR_BGP_OPEN_MSG_PARAMETERS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(29)) +#define SIZEOF_BGP_OPEN_MSG_PARAMETERS (0) + +/* Definitions for BGP_OPEN_PARAM */ + +#define SIZEOF_BGP_OPEN_PARAM (3) +#define PTR_BGP_OPEN_PARAM_TYPE(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_BGP_OPEN_PARAM_TYPE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_BGP_OPEN_PARAM_TYPE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define BGP_OPEN_PARAM_TYPE_is_AUTH GLUE_CAST08(1L) +#define PTR_BGP_OPEN_PARAM_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_BGP_OPEN_PARAM_LENGTH(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_BGP_OPEN_PARAM_LENGTH(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define PTR_BGP_OPEN_PARAM_AUTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define SIZEOF_BGP_OPEN_PARAM_AUTH (1) +#define PTR_BGP_OPEN_PARAM_AUTH_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_BGP_OPEN_PARAM_AUTH_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) +#define SET_BGP_OPEN_PARAM_AUTH_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST08(_V_)) +#define PTR_BGP_OPEN_PARAM_AUTH_DATA(_P_)\ + ((GLUE_CAST_PTR(_P_))+(3)) +#define SIZEOF_BGP_OPEN_PARAM_AUTH_DATA (0) +#define PTR_BGP_OPEN_PARAM_AUTH_DATA_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(3)+(_X0_)) +#define GET_BGP_OPEN_PARAM_AUTH_DATA_ELT(_P_, _X0_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(3)+(_X0_)) +#define SET_BGP_OPEN_PARAM_AUTH_DATA_ELT(_P_, _X0_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(3)+(_X0_), GLUE_CAST08(_V_)) + +/* Definitions for BGP_UPDATE_MSG */ + +#define SIZEOF_BGP_UPDATE_MSG (19) +#define PTR_BGP_UPDATE_MSG_INFO(_P_)\ + ((GLUE_CAST_PTR(_P_))+(19)) +#define SIZEOF_BGP_UPDATE_MSG_INFO (0) + +/* Definitions for BGP_ATOMIC_AGGREGATE_ATTRIBUTE */ + +#define SIZEOF_BGP_ATOMIC_AGGREGATE_ATTRIBUTE (0) + +/* Definitions for BGP_AS_PATH_ATTRIBUTE */ + +#define SIZEOF_BGP_AS_PATH_ATTRIBUTE (0) +#define PTR_BGP_AS_PATH_ATTRIBUTE_SEGMENTS(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_BGP_AS_PATH_ATTRIBUTE_SEGMENTS (0) + +/* Definitions for BGP_MULTI_EXIT_DISC_ATTRIBUTE */ + +#define SIZEOF_BGP_MULTI_EXIT_DISC_ATTRIBUTE (4) +#define PTR_BGP_MULTI_EXIT_DISC_ATTRIBUTE_METRIC(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_BGP_MULTI_EXIT_DISC_ATTRIBUTE_METRIC(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))) +#define SET_BGP_MULTI_EXIT_DISC_ATTRIBUTE_METRIC(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_)), GLUE_CAST32(_V_)) + +/* Definitions for BGP_ORIGIN_ATTRIBUTE */ + +#define SIZEOF_BGP_ORIGIN_ATTRIBUTE (1) +#define GET_BGP_ORIGIN_ATTRIBUTE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_BGP_ORIGIN_ATTRIBUTE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define BGP_ORIGIN_ATTRIBUTE_is_IGP GLUE_CAST08(0L) +#define BGP_ORIGIN_ATTRIBUTE_is_EGP GLUE_CAST08(1L) +#define BGP_ORIGIN_ATTRIBUTE_is_INCOMPLETE GLUE_CAST08(2L) + +/* Definitions for BGP_ATTRIBUTE */ + +#define SIZEOF_BGP_ATTRIBUTE (4) +/* Can't define PTR_BGP_ATTRIBUTE_OPTIONAL because: + Size 1 is not a multiple of 8. */ +#define GET_BGP_ATTRIBUTE_OPTIONAL(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))) & GLUE_CAST08(0x80L)) +#define SET_BGP_ATTRIBUTE_OPTIONAL(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))) | GLUE_CAST08(0x80L) : GLUE_GB08((GLUE_CAST_PTR(_P_))) & ~GLUE_CAST08(0x80L))) +/* Can't define PTR_BGP_ATTRIBUTE_TRANSITIVE because: + Size 1 is not a multiple of 8. */ +#define GET_BGP_ATTRIBUTE_TRANSITIVE(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))) & GLUE_CAST08(0x40L)) +#define SET_BGP_ATTRIBUTE_TRANSITIVE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))) | GLUE_CAST08(0x40L) : GLUE_GB08((GLUE_CAST_PTR(_P_))) & ~GLUE_CAST08(0x40L))) +/* Can't define PTR_BGP_ATTRIBUTE_PARTIAL because: + Size 1 is not a multiple of 8. */ +#define GET_BGP_ATTRIBUTE_PARTIAL(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))) & GLUE_CAST08(0x20L)) +#define SET_BGP_ATTRIBUTE_PARTIAL(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))) | GLUE_CAST08(0x20L) : GLUE_GB08((GLUE_CAST_PTR(_P_))) & ~GLUE_CAST08(0x20L))) +/* Can't define PTR_BGP_ATTRIBUTE_EXTENDED because: + Size 1 is not a multiple of 8. */ +#define GET_BGP_ATTRIBUTE_EXTENDED(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))) & GLUE_CAST08(0x10L)) +#define SET_BGP_ATTRIBUTE_EXTENDED(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))) | GLUE_CAST08(0x10L) : GLUE_GB08((GLUE_CAST_PTR(_P_))) & ~GLUE_CAST08(0x10L))) +#define PTR_BGP_ATTRIBUTE_TYPE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_BGP_ATTRIBUTE_TYPE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_BGP_ATTRIBUTE_TYPE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define BGP_ATTRIBUTE_TYPE_is_ORIGIN GLUE_CAST08(1L) +#define BGP_ATTRIBUTE_TYPE_is_AS_PATH GLUE_CAST08(2L) +#define BGP_ATTRIBUTE_TYPE_is_NEXT_HOP GLUE_CAST08(3L) +#define BGP_ATTRIBUTE_TYPE_is_MULTI_EXIT_DISC GLUE_CAST08(4L) +#define BGP_ATTRIBUTE_TYPE_is_LOCAL_PREF GLUE_CAST08(5L) +#define BGP_ATTRIBUTE_TYPE_is_ATOMIC_AGGREGATE GLUE_CAST08(6L) +#define BGP_ATTRIBUTE_TYPE_is_AGGREGATOR GLUE_CAST08(7L) +#define PTR_BGP_ATTRIBUTE_SHORT(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define SIZEOF_BGP_ATTRIBUTE_SHORT (1) +#define PTR_BGP_ATTRIBUTE_SHORT_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_BGP_ATTRIBUTE_SHORT_LENGTH(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) +#define SET_BGP_ATTRIBUTE_SHORT_LENGTH(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST08(_V_)) +#define PTR_BGP_ATTRIBUTE_SHORT_DATA(_P_)\ + ((GLUE_CAST_PTR(_P_))+(3)) +#define SIZEOF_BGP_ATTRIBUTE_SHORT_DATA (0) +#define PTR_BGP_ATTRIBUTE_LONG(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define SIZEOF_BGP_ATTRIBUTE_LONG (2) +#define PTR_BGP_ATTRIBUTE_LONG_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_BGP_ATTRIBUTE_LONG_LENGTH(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(2)) +#define SET_BGP_ATTRIBUTE_LONG_LENGTH(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST16(_V_)) +#define PTR_BGP_ATTRIBUTE_LONG_DATA(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define SIZEOF_BGP_ATTRIBUTE_LONG_DATA (0) + +/* Definitions for BGP_NEXT_HOP_ATTRIBUTE */ + +#define SIZEOF_BGP_NEXT_HOP_ATTRIBUTE (4) +#define PTR_BGP_NEXT_HOP_ATTRIBUTE_ROUTER(_P_)\ + ((GLUE_CAST_PTR(_P_))) + +/* Definitions for BGP_PATH_SEGMENT */ + +#define SIZEOF_BGP_PATH_SEGMENT (2) +#define PTR_BGP_PATH_SEGMENT_TYPE(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_BGP_PATH_SEGMENT_TYPE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_BGP_PATH_SEGMENT_TYPE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define BGP_PATH_SEGMENT_TYPE_is_AS_SET GLUE_CAST08(1L) +#define BGP_PATH_SEGMENT_TYPE_is_AS_SEQUENCE GLUE_CAST08(2L) +#define PTR_BGP_PATH_SEGMENT_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_BGP_PATH_SEGMENT_LENGTH(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_BGP_PATH_SEGMENT_LENGTH(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define PTR_BGP_PATH_SEGMENT_AS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define SIZEOF_BGP_PATH_SEGMENT_AS (0) +#define PTR_BGP_PATH_SEGMENT_AS_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(2)+(2)*(_X0_)) +#define GET_BGP_PATH_SEGMENT_AS_ELT(_P_, _X0_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(2)+(2)*(_X0_)) +#define SET_BGP_PATH_SEGMENT_AS_ELT(_P_, _X0_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(2)+(2)*(_X0_), GLUE_CAST16(_V_)) + +/* Definitions for BGP_AGGREGATOR_ATTRIBUTE */ + +#define SIZEOF_BGP_AGGREGATOR_ATTRIBUTE (6) +#define PTR_BGP_AGGREGATOR_ATTRIBUTE_AS(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_BGP_AGGREGATOR_ATTRIBUTE_AS(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))) +#define SET_BGP_AGGREGATOR_ATTRIBUTE_AS(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_)), GLUE_CAST16(_V_)) +#define PTR_BGP_AGGREGATOR_ATTRIBUTE_ADDRESS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) + +#endif /* EPILOGUE_LAYOUT_BGP_H */ diff --git a/h/wrn/wm/util/layout/bgp.ldb b/h/wrn/wm/util/layout/bgp.ldb new file mode 100644 index 0000000..89b2bdb --- /dev/null +++ b/h/wrn/wm/util/layout/bgp.ldb @@ -0,0 +1,273 @@ +; $Header: /usr/cvsroot/target/h/wrn/wm/util/layout/bgp.ldb,v 1.1.1.1 2001/11/05 17:47:19 tneale Exp $ +; Layout information for BGP + +;**************************************************************************** +; +; *** Restricted Rights Legend *** +; +; The programs and information contained herein are licensed only +; pursuant to a license agreement that contains use, reverse +; engineering, disclosure, and other restrictions; accordingly, it +; is "Unpublished--all rights reserved under the applicable +; copyright laws". +; +; Use duplication, or disclosure by the Government is subject to +; restrictions as set forth in subparagraph (c)(1)(ii) of the Rights +; in Technical Data and Computer Licensed Programs clause of DFARS +; 52.227 7013. +; +; Copyright 2000-2001 Wind River Systems, Inc. +; Copyright 1997 Epilogue Technology Corporation. +; Copyright 1998 Integrated Systems, Inc. +; All rights reserved. +; +; *** Government Use *** +; +; The Licensed Programs and their documentation were developed at +; private expense and no part of them is in the public domain. +; +; The Licensed Programs are "Restricted Computer Software" as that +; term is defined in Clause 52.227-19 of the Federal Acquisition +; Regulations (FAR) and are "Commercial Computer Software" as that +; term is defined in Subpart 227.401 of the Department of Defense +; Federal Acquisition Regulation Supplement (DFARS). +; +; (i) If the licensed Programs are supplied to the Department of +; Defense (DoD), the Licensed Programs are classified as +; "Commercial Computer Software" and the Government is acquiring +; only "restricted rights" in the Licensed Programs and their +; documentation as that term is defined in Clause 52.227 +; 7013(c)(1) of the DFARS, and +; +; (ii) If the Licensed Programs are supplied to any unit or agency +; of the United States Government other than DoD, the +; Government's rights in the Licensed Programs and their +; documentation will be as defined in Clause 52.227-19(c)(2) of +; the FAR. +;**************************************************************************** + +; $Log: bgp.ldb,v $ +; Revision 1.1.1.1 2001/11/05 17:47:19 tneale +; Tornado shuffle +; +; Revision 1.9 2001/01/19 22:22:32 paul +; Update copyright. +; +; Revision 1.8 1998/02/25 15:21:39 sra +; Finish moving types.h, bug.h, and bugdef.h to common/h/. +; +; Revision 1.7 1998/02/25 04:53:50 sra +; Update copyrights. +; +; Revision 1.6 1998/02/20 04:02:36 sra +; Fix too-long layout macro names. +; +; Revision 1.5 1997/09/26 20:21:13 alan +; Use features of new layout compiler: `use-layouts' and `C-include'. +; +; Revision 1.4 1997/06/04 05:46:20 alan +; Fix RCS keywords. +; +; Revision 1.3 1997/06/03 22:59:30 alan +; Use `define-rcs-info'. +; +; Revision 1.2 1997/04/22 20:59:25 alan +; Construction finished... +; +; Revision 1.1 1997/04/22 06:05:43 alan +; Still under construction. + +(define-rcs-info "$Id: bgp.ldb,v 1.1.1.1 2001/11/05 17:47:19 tneale Exp $") + +(use-layouts "ip.ldb") + +(C-include EPILOGUE_INSTALL_H ) +(C-include EPILOGUE_TYPES_H ) +(C-include EPILOGUE_LAYOUT_LDBGLUE_H ) + +; These layouts often use the convention that a `(struct (size 0))' usually +; signals a case where the layout language was unable to express something +; (usually having to do with lengths or offsets that vary). A nearby +; comment will usually explain what is going on. + +(define-layout AS_NUMBER (unsigned 16)) + +(define-layout BGP_HEADER + (struct (size (* 19 8)) + (field MARKER (array (count 16) + (type (unsigned 8)))) + (field LENGTH (unsigned 16)) + (field TYPE (enum (type (unsigned 8)) + (value OPEN 1) + (value UPDATE 2) + (value NOTIFICATION 3) + (value KEEPALIVE 4))))) + +; +; OPEN +; + +(define-layout BGP_OPEN_MSG + (struct (fill (sizeof BGP_HEADER)) + (field VERSION (unsigned 8)) ; Must be 4 + (field MY_AS AS_NUMBER) + (field HOLD_TIME (unsigned 16)) + (field IDENTIFIER (unsigned 32)) + (field PARAMETERS_LENGTH (unsigned 8)) + (field PARAMETERS (struct (size 0))))) + +; The PARAMETERS are a sequence of the following: + +(define-layout BGP_OPEN_PARAM + (struct (field TYPE (enum (type (unsigned 8)) + (value AUTH 1))) + (field LENGTH (unsigned 8)) + (union (field AUTH (struct (field CODE (unsigned 8)) + (field DATA (array (count 0) + (type (unsigned 8)))))) + ))) + +; +; KEEPALIVE +; + +(define-layout BGP_KEEPALIVE_MSG + (struct (fill (sizeof BGP_HEADER)) + )) + +; +; UPDATE +; + +(define-layout BGP_UPDATE_MSG + (struct (fill (sizeof BGP_HEADER)) + (field INFO (struct (size 0))))) + +; INFO consists of the following three sections, in this order: + +(define-layout BGP_UPDATE_UNFEASIBLES + (struct (field LENGTH (unsigned 16)) + (field PREFIXES (struct (size 0))))) + +(define-layout BGP_UPDATE_ATTRIBUTES + (struct (field LENGTH (unsigned 16)) + (field ATTRIBUTES (struct (size 0))))) + +(define-layout BGP_UPDATE_REACHABLES + (struct ;; LENGTH in this one is implicit + (field PREFIXES (struct (size 0))))) + +; PREFIXES are used in two of the above three sections: + +(define-layout BGP_ADDRESS_PREFIX + (struct (field LENGTH (unsigned 8)) + (field PREFIX (array (count 0) + (type (unsigned 8)))))) + +; ATTRIBUTES are used in the other: + +(define-layout BGP_ATTRIBUTE + (struct (struct (size 8) + (align 1) + (field OPTIONAL (boolean 1)) + (field TRANSITIVE (boolean 1)) + (field PARTIAL (boolean 1)) + (field EXTENDED (boolean 1)) + (fill 4) ; MBZ + ) + (field TYPE (enum (type (unsigned 8)) + (value ORIGIN 1) ; Len = 1 + (value AS_PATH 2) ; Len varies + (value NEXT_HOP 3) ; Len = 4 + (value MULTI_EXIT_DISC 4) ; Len = 4 + (value LOCAL_PREF 5) ; Len = 4 + (value ATOMIC_AGGREGATE 6) ; Len = 0 + (value AGGREGATOR 7) ; Len = 6 + )) + (union (field SHORT (struct (field LENGTH (unsigned 8)) + (field DATA (struct (size 0))))) + (field LONG (struct (field LENGTH (unsigned 16)) + (field DATA (struct (size 0)))))))) + +; Depending on TYPE, DATA is one of the following: +; (This -could- be written as a seven-way union...) + +(define-layout BGP_ORIGIN_ATTRIBUTE + (enum (type (unsigned 8)) + (value IGP 0) + (value EGP 1) + (value INCOMPLETE 2))) + +(define-layout BGP_NEXT_HOP_ATTRIBUTE + (struct (field ROUTER IP_ADDRESS))) + +(define-layout BGP_MULTI_EXIT_DISC_ATTRIBUTE + (struct (field METRIC (unsigned 32)))) + +(define-layout BGP_LOCAL_PREF_ATTRIBUTE + (struct (field PREF (unsigned 32)))) + +(define-layout BGP_ATOMIC_AGGREGATE_ATTRIBUTE + (struct (size 0))) ; This attribute really is empty. + +(define-layout BGP_AGGREGATOR_ATTRIBUTE + (struct (field AS AS_NUMBER) + (field ADDRESS IP_ADDRESS))) + +(define-layout BGP_AS_PATH_ATTRIBUTE + (struct (field SEGMENTS (struct (size 0))))) + +; The segments in a AS_PATH attribute are a sequence of the following: + +(define-layout BGP_PATH_SEGMENT + (struct (field TYPE (enum (type (unsigned 8)) + (value AS_SET 1) + (value AS_SEQUENCE 2))) + (field LENGTH (unsigned 8)) + (field AS (array (count 0) + (type AS_NUMBER))))) + +; +; NOTIFICATION +; + +(define-layout BGP_NOTIFY + (struct (fill (sizeof BGP_HEADER)) + (field CODE (enum (type (unsigned 8)) + (value HDR_ERR 1) + (value OPEN_ERR 2) + (value UPD_ERR 3) + (value HOLD_TIMER 4) + (value STATE_MACHINE 5) + (value CEASE 6))) + (union (size 8) ; error subcode + (field HDR_ERR (enum (type (unsigned 8)) + (value CONN_NOT_SYNC 1) + (value BAD_LENGTH 2) + (value BAD_TYPE 3))) + (field OPEN_ERR (enum (type (unsigned 8)) + (value VERSION_UNSUPPORTED 1) + (value BAD_AS 2) + (value BAD_IDENTIFIER 3) + (value PARAMETER_UNSUPPORTED 4) + (value AUTH_FAILURE 5) + (value BAD_HOLD_TIME 6))) + (field UPD_ERR (enum (type (unsigned 8)) + (value BAD_ATTRIBUTES 1) + (value UNRECOGNIZED_ATTRIBUTE 2) + (value MISSING_ATTRIBUTE 3) + (value BAD_FLAGS 4) + (value BAD_LENGTH 5) + (value BAD_ORIGIN 6) + (value ROUTING_LOOP 7) + (value BAD_NEXT_HOP 8) + (value BAD_OPTIONAL_ATTRIBUTE 9) + (value BAD_NETWORK 10) + (value BAD_AS_PATH 11)))) + (field DATA (array (count 0) + (type (unsigned 8)))) + )) + +; Local Variables: +; mode: Scheme +; End: diff --git a/h/wrn/wm/util/layout/chaos.h b/h/wrn/wm/util/layout/chaos.h new file mode 100644 index 0000000..01ef422 --- /dev/null +++ b/h/wrn/wm/util/layout/chaos.h @@ -0,0 +1,125 @@ +/* This file was automatically generated by Epilogue Technology's + * network datastructure layout tool. + * + * DO NOT MODIFY THIS FILE BY HAND. + * + * Source file information: + * Id: chaos.ldb,v 1.7 1998/02/25 15:21:39 sra Exp + */ + +#ifndef EPILOGUE_LAYOUT_CHAOS_H +#define EPILOGUE_LAYOUT_CHAOS_H + +#ifndef EPILOGUE_INSTALL_H +#include +#endif +#ifndef EPILOGUE_TYPES_H +#include +#endif +#ifndef EPILOGUE_LAYOUT_LDBGLUE_H +#include +#endif + +/* Definitions for CHAOS_PACKET */ + +#define SIZEOF_CHAOS_PACKET (16) +#define PTR_CHAOS_PACKET_OPCODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_CHAOS_PACKET_OPCODE(_P_)\ + GLUE_GL08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_CHAOS_PACKET_OPCODE(_P_, _V_)\ + GLUE_SL08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define CHAOS_PACKET_OPCODE_is_RFC GLUE_CAST08(01L) +#define CHAOS_PACKET_OPCODE_is_OPN GLUE_CAST08(02L) +#define CHAOS_PACKET_OPCODE_is_CLS GLUE_CAST08(03L) +#define CHAOS_PACKET_OPCODE_is_FWD GLUE_CAST08(04L) +#define CHAOS_PACKET_OPCODE_is_ANS GLUE_CAST08(05L) +#define CHAOS_PACKET_OPCODE_is_SNS GLUE_CAST08(06L) +#define CHAOS_PACKET_OPCODE_is_STS GLUE_CAST08(07L) +#define CHAOS_PACKET_OPCODE_is_RUT GLUE_CAST08(010L) +#define CHAOS_PACKET_OPCODE_is_LOS GLUE_CAST08(011L) +#define CHAOS_PACKET_OPCODE_is_LSN GLUE_CAST08(012L) +#define CHAOS_PACKET_OPCODE_is_MNT GLUE_CAST08(013L) +#define CHAOS_PACKET_OPCODE_is_EOF GLUE_CAST08(014L) +#define CHAOS_PACKET_OPCODE_is_UNC GLUE_CAST08(015L) +#define CHAOS_PACKET_OPCODE_is_BRD GLUE_CAST08(016L) +#define CHAOS_PACKET_OPCODE_is_DATA08 GLUE_CAST08(0200L) +#define CHAOS_PACKET_OPCODE_is_DATA16 GLUE_CAST08(0300L) +/* Can't define PTR_CHAOS_PACKET_DATA_COUNT because: + Size 12 is not a multiple of 8. */ +/* Can't define (GET_CHAOS_PACKET_DATA_COUNT SET_CHAOS_PACKET_DATA_COUNT) because: + Unaligned unsigned-8bit-little: offset 16 size 12 dope () */ +/* Can't define PTR_CHAOS_PACKET_FORWARDING_COUNT because: + Size 4 is not a multiple of 8. */ +/* Can't define (GET_CHAOS_PACKET_FORWARDING_COUNT SET_CHAOS_PACKET_FORWARDING_COUNT) because: + Unaligned unsigned-8bit-little: offset 28 size 4 dope () */ +#define PTR_CHAOS_PACKET_DESTINATION_ADDRESS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define PTR_CHAOS_PACKET_DESTINATION_INDEX(_P_)\ + ((GLUE_CAST_PTR(_P_))+(6)) +#define GET_CHAOS_PACKET_DESTINATION_INDEX(_P_)\ + GLUE_GU16((GLUE_CAST_PTR(_P_))+(6)) +#define SET_CHAOS_PACKET_DESTINATION_INDEX(_P_, _V_)\ + GLUE_SU16((GLUE_CAST_PTR(_P_))+(6), GLUE_CAST16(_V_)) +#define PTR_CHAOS_PACKET_SOURCE_ADDRESS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define PTR_CHAOS_PACKET_SOURCE_INDEX(_P_)\ + ((GLUE_CAST_PTR(_P_))+(10)) +#define GET_CHAOS_PACKET_SOURCE_INDEX(_P_)\ + GLUE_GU16((GLUE_CAST_PTR(_P_))+(10)) +#define SET_CHAOS_PACKET_SOURCE_INDEX(_P_, _V_)\ + GLUE_SU16((GLUE_CAST_PTR(_P_))+(10), GLUE_CAST16(_V_)) +#define PTR_CHAOS_PACKET_PACKET_NUMBER(_P_)\ + ((GLUE_CAST_PTR(_P_))+(12)) +#define GET_CHAOS_PACKET_PACKET_NUMBER(_P_)\ + GLUE_GL16((GLUE_CAST_PTR(_P_))+(12)) +#define SET_CHAOS_PACKET_PACKET_NUMBER(_P_, _V_)\ + GLUE_SL16((GLUE_CAST_PTR(_P_))+(12), GLUE_CAST16(_V_)) +#define PTR_CHAOS_PACKET_ACKNOWLEDGMENT(_P_)\ + ((GLUE_CAST_PTR(_P_))+(14)) +#define GET_CHAOS_PACKET_ACKNOWLEDGMENT(_P_)\ + GLUE_GL16((GLUE_CAST_PTR(_P_))+(14)) +#define SET_CHAOS_PACKET_ACKNOWLEDGMENT(_P_, _V_)\ + GLUE_SL16((GLUE_CAST_PTR(_P_))+(14), GLUE_CAST16(_V_)) +#define PTR_CHAOS_PACKET_DATA08(_P_)\ + ((GLUE_CAST_PTR(_P_))+(16)) +#define SIZEOF_CHAOS_PACKET_DATA08 (0) +#define PTR_CHAOS_PACKET_DATA08_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(16)+(_X0_)) +#define GET_CHAOS_PACKET_DATA08_ELT(_P_, _X0_)\ + GLUE_GL08((GLUE_CAST_PTR(_P_))+(16)+(_X0_)) +#define SET_CHAOS_PACKET_DATA08_ELT(_P_, _X0_, _V_)\ + GLUE_SL08((GLUE_CAST_PTR(_P_))+(16)+(_X0_), GLUE_CAST08(_V_)) +#define PTR_CHAOS_PACKET_DATA16(_P_)\ + ((GLUE_CAST_PTR(_P_))+(16)) +#define SIZEOF_CHAOS_PACKET_DATA16 (0) +#define PTR_CHAOS_PACKET_DATA16_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(16)+(2)*(_X0_)) +#define GET_CHAOS_PACKET_DATA16_ELT(_P_, _X0_)\ + GLUE_GL16((GLUE_CAST_PTR(_P_))+(16)+(2)*(_X0_)) +#define SET_CHAOS_PACKET_DATA16_ELT(_P_, _X0_, _V_)\ + GLUE_SL16((GLUE_CAST_PTR(_P_))+(16)+(2)*(_X0_), GLUE_CAST16(_V_)) + +/* Definitions for CHAOS_ADDRESS */ + +#define SIZEOF_CHAOS_ADDRESS (2) +#define PTR_CHAOS_ADDRESS_OPAQUE(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_CHAOS_ADDRESS_OPAQUE(_P_)\ + GLUE_GU16((GLUE_CAST_PTR(_P_))) +#define SET_CHAOS_ADDRESS_OPAQUE(_P_, _V_)\ + GLUE_SU16((GLUE_CAST_PTR(_P_)), GLUE_CAST16(_V_)) +#define PTR_CHAOS_ADDRESS_HOST(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_CHAOS_ADDRESS_HOST(_P_)\ + GLUE_GL08((GLUE_CAST_PTR(_P_))) +#define SET_CHAOS_ADDRESS_HOST(_P_, _V_)\ + GLUE_SL08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define PTR_CHAOS_ADDRESS_SUBNET(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_CHAOS_ADDRESS_SUBNET(_P_)\ + GLUE_GL08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_CHAOS_ADDRESS_SUBNET(_P_, _V_)\ + GLUE_SL08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) + +#endif /* EPILOGUE_LAYOUT_CHAOS_H */ diff --git a/h/wrn/wm/util/layout/chaos.ldb b/h/wrn/wm/util/layout/chaos.ldb new file mode 100644 index 0000000..bd5fb4d --- /dev/null +++ b/h/wrn/wm/util/layout/chaos.ldb @@ -0,0 +1,135 @@ +; $Header: /usr/cvsroot/target/h/wrn/wm/util/layout/chaos.ldb,v 1.1.1.1 2001/11/05 17:47:19 tneale Exp $ +; Layout information for CHAOS + +;**************************************************************************** +; +; *** Restricted Rights Legend *** +; +; The programs and information contained herein are licensed only +; pursuant to a license agreement that contains use, reverse +; engineering, disclosure, and other restrictions; accordingly, it +; is "Unpublished--all rights reserved under the applicable +; copyright laws". +; +; Use duplication, or disclosure by the Government is subject to +; restrictions as set forth in subparagraph (c)(1)(ii) of the Rights +; in Technical Data and Computer Licensed Programs clause of DFARS +; 52.227 7013. +; +; Copyright 2000-2001 Wind River Systems, Inc. +; Copyright 1995-1997 Epilogue Technology Corporation. +; Copyright 1998 Integrated Systems, Inc. +; All rights reserved. +; +; *** Government Use *** +; +; The Licensed Programs and their documentation were developed at +; private expense and no part of them is in the public domain. +; +; The Licensed Programs are "Restricted Computer Software" as that +; term is defined in Clause 52.227-19 of the Federal Acquisition +; Regulations (FAR) and are "Commercial Computer Software" as that +; term is defined in Subpart 227.401 of the Department of Defense +; Federal Acquisition Regulation Supplement (DFARS). +; +; (i) If the licensed Programs are supplied to the Department of +; Defense (DoD), the Licensed Programs are classified as +; "Commercial Computer Software" and the Government is acquiring +; only "restricted rights" in the Licensed Programs and their +; documentation as that term is defined in Clause 52.227 +; 7013(c)(1) of the DFARS, and +; +; (ii) If the Licensed Programs are supplied to any unit or agency +; of the United States Government other than DoD, the +; Government's rights in the Licensed Programs and their +; documentation will be as defined in Clause 52.227-19(c)(2) of +; the FAR. +;**************************************************************************** + +; $Log: chaos.ldb,v $ +; Revision 1.1.1.1 2001/11/05 17:47:19 tneale +; Tornado shuffle +; +; Revision 1.8 2001/01/19 22:22:32 paul +; Update copyright. +; +; Revision 1.7 1998/02/25 15:21:39 sra +; Finish moving types.h, bug.h, and bugdef.h to common/h/. +; +; Revision 1.6 1998/02/25 04:53:52 sra +; Update copyrights. +; +; Revision 1.5 1997/09/26 20:21:14 alan +; Use features of new layout compiler: `use-layouts' and `C-include'. +; +; Revision 1.4 1997/06/04 05:46:21 alan +; Fix RCS keywords. +; +; Revision 1.3 1997/06/03 22:59:31 alan +; Use `define-rcs-info'. +; +; Revision 1.2 1997/04/22 00:18:31 alan +; Fix copyright. +; +; Revision 1.1 1997/04/19 04:12:12 alan +; Move all .ldb files into the `layout' directory. +; +; Revision 1.3 1995/06/05 19:48:22 alan +; Be consistently littlendian. Unfortunately this breaks the ".h" file until +; a better theory of endianness come along. +; +; Revision 1.2 1995/05/25 23:53:32 alan +; Some enums have a `base' attribute -- some other tweaking. +; +; Revision 1.1 1995/05/23 07:16:56 alan +; Basic network layouts. + +(define-rcs-info "$Id: chaos.ldb,v 1.1.1.1 2001/11/05 17:47:19 tneale Exp $") + +(C-include EPILOGUE_INSTALL_H ) +(C-include EPILOGUE_TYPES_H ) +(C-include EPILOGUE_LAYOUT_LDBGLUE_H ) + +(define-layout CHAOS_ADDRESS + (union (size 16) + (field OPAQUE (opaque 16)) + (struct (size 16) + (field HOST (unsigned-8bit-little 8)) + (field SUBNET (unsigned-8bit-little 8))))) + +(define-layout CHAOS_PACKET + (struct (size (* 8 16)) + (align 16) + (struct (align 8) + (fill 8) + (field OPCODE + (enum (type (unsigned-8bit-little 8)) + (base 8) + (value RFC 1) (value OPN 2) (value CLS 3) + (value FWD 4) (value ANS 5) (value SNS 6) + (value STS 7) (value RUT 8) (value LOS 9) + (value LSN 10) (value MNT 11) (value EOF 12) + (value UNC 13) (value BRD 14) + (value DATA08 #o200) + (value DATA16 #o300) + ))) + (struct (align 4) + ;; There should be a better theory of endianness used + ;; here. The current kludge actually makes these two + ;; fields unusable from C... + (field DATA_COUNT (unsigned-8bit-little 12)) + (field FORWARDING_COUNT (unsigned-8bit-little 4))) + (field DESTINATION_ADDRESS CHAOS_ADDRESS) + (field DESTINATION_INDEX (opaque 16)) + (field SOURCE_ADDRESS CHAOS_ADDRESS) + (field SOURCE_INDEX (opaque 16)) + (field PACKET_NUMBER (unsigned-8bit-little 16)) + (field ACKNOWLEDGMENT (unsigned-8bit-little 16)) + (union (field DATA08 + (array (count 0) (type (unsigned-8bit-little 8)))) + (field DATA16 + (array (count 0) (type (unsigned-8bit-little 16))))))) + +; Local Variables: +; mode: Scheme +; End: diff --git a/h/wrn/wm/util/layout/dhcp.h b/h/wrn/wm/util/layout/dhcp.h new file mode 100644 index 0000000..7547124 --- /dev/null +++ b/h/wrn/wm/util/layout/dhcp.h @@ -0,0 +1,235 @@ +/* This file was automatically generated by Epilogue Technology's + * network datastructure layout tool. + * + * DO NOT MODIFY THIS FILE BY HAND. + * + * Source file information: + * Id: dhcp.ldb,v 1.1 1998/11/23 20:54:35 wes Exp + * --used -- + * Id: ip.ldb,v 1.17 1998/02/25 15:21:40 sra Exp + * Id: arp.ldb,v 1.10 1998/02/25 15:21:38 sra Exp + */ + +#ifndef EPILOGUE_LAYOUT_DHCP_H +#define EPILOGUE_LAYOUT_DHCP_H + +#ifndef EPILOGUE_INSTALL_H +#include +#endif +#ifndef EPILOGUE_TYPES_H +#include +#endif +#ifndef EPILOGUE_LAYOUT_LDBGLUE_H +#include +#endif + +/* Definitions for DHCP_MSG */ + +#define SIZEOF_DHCP_MSG (548) +#define PTR_DHCP_MSG_OPCODE(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_DHCP_MSG_OPCODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_DHCP_MSG_OPCODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define PTR_DHCP_MSG_HTYPE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_DHCP_MSG_HTYPE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_DHCP_MSG_HTYPE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define PTR_DHCP_MSG_HLEN(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_DHCP_MSG_HLEN(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) +#define SET_DHCP_MSG_HLEN(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST08(_V_)) +#define PTR_DHCP_MSG_HOPS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(3)) +#define GET_DHCP_MSG_HOPS(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(3)) +#define SET_DHCP_MSG_HOPS(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(3), GLUE_CAST08(_V_)) +#define PTR_DHCP_MSG_XID(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_DHCP_MSG_XID(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(4)) +#define SET_DHCP_MSG_XID(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST32(_V_)) +#define PTR_DHCP_MSG_SECS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define GET_DHCP_MSG_SECS(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(8)) +#define SET_DHCP_MSG_SECS(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(8), GLUE_CAST16(_V_)) +#define PTR_DHCP_MSG_FLAGS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(10)) +#define GET_DHCP_MSG_FLAGS(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(10)) +#define SET_DHCP_MSG_FLAGS(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(10), GLUE_CAST16(_V_)) +#define PTR_DHCP_MSG_CIADDR(_P_)\ + ((GLUE_CAST_PTR(_P_))+(12)) +#define PTR_DHCP_MSG_YIADDR(_P_)\ + ((GLUE_CAST_PTR(_P_))+(16)) +#define PTR_DHCP_MSG_SIADDR(_P_)\ + ((GLUE_CAST_PTR(_P_))+(20)) +#define PTR_DHCP_MSG_GIADDR(_P_)\ + ((GLUE_CAST_PTR(_P_))+(24)) +#define PTR_DHCP_MSG_CHADDR(_P_)\ + ((GLUE_CAST_PTR(_P_))+(28)) +#define SIZEOF_DHCP_MSG_CHADDR (16) +#define PTR_DHCP_MSG_CHADDR_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(28)+(_X0_)) +#define GET_DHCP_MSG_CHADDR_ELT(_P_, _X0_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(28)+(_X0_)) +#define SET_DHCP_MSG_CHADDR_ELT(_P_, _X0_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(28)+(_X0_), GLUE_CAST08(_V_)) +#define PTR_DHCP_MSG_SNAME(_P_)\ + ((GLUE_CAST_PTR(_P_))+(44)) +#define SIZEOF_DHCP_MSG_SNAME (64) +#define PTR_DHCP_MSG_SNAME_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(44)+(_X0_)) +#define GET_DHCP_MSG_SNAME_ELT(_P_, _X0_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(44)+(_X0_)) +#define SET_DHCP_MSG_SNAME_ELT(_P_, _X0_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(44)+(_X0_), GLUE_CAST08(_V_)) +#define PTR_DHCP_MSG_FILE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(108)) +#define SIZEOF_DHCP_MSG_FILE (128) +#define PTR_DHCP_MSG_FILE_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(108)+(_X0_)) +#define GET_DHCP_MSG_FILE_ELT(_P_, _X0_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(108)+(_X0_)) +#define SET_DHCP_MSG_FILE_ELT(_P_, _X0_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(108)+(_X0_), GLUE_CAST08(_V_)) +#define PTR_DHCP_MSG_COOKIE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(236)) +#define GET_DHCP_MSG_COOKIE(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(236)) +#define SET_DHCP_MSG_COOKIE(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(236), GLUE_CAST32(_V_)) +#define PTR_DHCP_MSG_OPTIONS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(236)) +#define SIZEOF_DHCP_MSG_OPTIONS (312) +#define PTR_DHCP_MSG_OPTIONS_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(236)+(_X0_)) +#define GET_DHCP_MSG_OPTIONS_ELT(_P_, _X0_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(236)+(_X0_)) +#define SET_DHCP_MSG_OPTIONS_ELT(_P_, _X0_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(236)+(_X0_), GLUE_CAST08(_V_)) + +/* Definitions for DHCP_OPTION_HDR */ + +#define SIZEOF_DHCP_OPTION_HDR (2) +#define PTR_DHCP_OPTION_HDR_TAG(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_DHCP_OPTION_HDR_TAG(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_DHCP_OPTION_HDR_TAG(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define PTR_DHCP_OPTION_HDR_length(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_DHCP_OPTION_HDR_length(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_DHCP_OPTION_HDR_length(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) + +/* Definitions for DHCP_MSGTYPE */ + +#define SIZEOF_DHCP_MSGTYPE (1) +#define GET_DHCP_MSGTYPE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_DHCP_MSGTYPE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define DHCP_MSGTYPE_is_DHCPDISCOVER GLUE_CAST08(1L) +#define DHCP_MSGTYPE_is_DHCPOFFER GLUE_CAST08(2L) +#define DHCP_MSGTYPE_is_DHCPREQUEST GLUE_CAST08(3L) +#define DHCP_MSGTYPE_is_DHCPDECLINE GLUE_CAST08(4L) +#define DHCP_MSGTYPE_is_DHCPACK GLUE_CAST08(5L) +#define DHCP_MSGTYPE_is_DHCPNAK GLUE_CAST08(6L) +#define DHCP_MSGTYPE_is_DHCPRELEASE GLUE_CAST08(7L) +#define DHCP_MSGTYPE_is_DHCPINFORM GLUE_CAST08(8L) + +/* Definitions for DHCP_TAG */ + +#define SIZEOF_DHCP_TAG (1) +#define GET_DHCP_TAG(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_DHCP_TAG(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define DHCP_TAG_is_PAD GLUE_CAST08(0L) +#define DHCP_TAG_is_SUBNET_MASK GLUE_CAST08(1L) +#define DHCP_TAG_is_TIMEOFFSET GLUE_CAST08(2L) +#define DHCP_TAG_is_ROUTER GLUE_CAST08(3L) +#define DHCP_TAG_is_TIMESERVER GLUE_CAST08(4L) +#define DHCP_TAG_is_IEN116SERVER GLUE_CAST08(5L) +#define DHCP_TAG_is_DNSSERVER GLUE_CAST08(6L) +#define DHCP_TAG_is_LOGSERVER GLUE_CAST08(7L) +#define DHCP_TAG_is_COOKIESERVER GLUE_CAST08(8L) +#define DHCP_TAG_is_LPRSERVER GLUE_CAST08(9L) +#define DHCP_TAG_is_IMPRESSSERVER GLUE_CAST08(10L) +#define DHCP_TAG_is_RLPSERVER GLUE_CAST08(11L) +#define DHCP_TAG_is_HOSTNAME GLUE_CAST08(12L) +#define DHCP_TAG_is_BOOTFILESIZE GLUE_CAST08(13L) +#define DHCP_TAG_is_MERITFILESIZE GLUE_CAST08(14L) +#define DHCP_TAG_is_DOMAINNAME GLUE_CAST08(15L) +#define DHCP_TAG_is_SWAPSERVER GLUE_CAST08(16L) +#define DHCP_TAG_is_ROOTPATH GLUE_CAST08(17L) +#define DHCP_TAG_is_EXTENSIONSPATH GLUE_CAST08(18L) +#define DHCP_TAG_is_IPFORWARD GLUE_CAST08(19L) +#define DHCP_TAG_is_SOURCEROUTE GLUE_CAST08(20L) +#define DHCP_TAG_is_POLICYFILT GLUE_CAST08(21L) +#define DHCP_TAG_is_MAX_REASSEMBLY GLUE_CAST08(22L) +#define DHCP_TAG_is_DEF_TTL GLUE_CAST08(23L) +#define DHCP_TAG_is_MTU_TIMEOUT GLUE_CAST08(24L) +#define DHCP_TAG_is_MTU_PLATEAUS GLUE_CAST08(25L) +#define DHCP_TAG_is_MTU_VALUE GLUE_CAST08(26L) +#define DHCP_TAG_is_MTU_SUBNETS_LOCAL GLUE_CAST08(27L) +#define DHCP_TAG_is_BROADCAST_ADDR GLUE_CAST08(28L) +#define DHCP_TAG_is_MASK_DISCOVER GLUE_CAST08(29L) +#define DHCP_TAG_is_MASK_SUPPLY GLUE_CAST08(30L) +#define DHCP_TAG_is_ROUTER_DISCOVER GLUE_CAST08(31L) +#define DHCP_TAG_is_ROUTER_SOLICIT_ADDR GLUE_CAST08(32L) +#define DHCP_TAG_is_STATIC_ROUTES GLUE_CAST08(33L) +#define DHCP_TAG_is_ARP_TRAILERS GLUE_CAST08(34L) +#define DHCP_TAG_is_ARP_TIMEOUT GLUE_CAST08(35L) +#define DHCP_TAG_is_ETHERNET_802_3 GLUE_CAST08(36L) +#define DHCP_TAG_is_TCP_TTL GLUE_CAST08(37L) +#define DHCP_TAG_is_TCP_KEEPALIVE_VALUE GLUE_CAST08(38L) +#define DHCP_TAG_is_TCP_KEEPALIVE_GARBAGE GLUE_CAST08(39L) +#define DHCP_TAG_is_NIS_DOMAIN GLUE_CAST08(40L) +#define DHCP_TAG_is_NIS_SERVERS GLUE_CAST08(41L) +#define DHCP_TAG_is_NTP_SERVERS GLUE_CAST08(42L) +#define DHCP_TAG_is_VENDOR_SPECIFIC GLUE_CAST08(43L) +#define DHCP_TAG_is_NB_NS GLUE_CAST08(44L) +#define DHCP_TAG_is_NB_DD GLUE_CAST08(45L) +#define DHCP_TAG_is_NB_NODETYPE GLUE_CAST08(46L) +#define DHCP_TAG_is_NB_SCOPE GLUE_CAST08(47L) +#define DHCP_TAG_is_X_FS GLUE_CAST08(48L) +#define DHCP_TAG_is_X_DM GLUE_CAST08(49L) +#define DHCP_TAG_is_REQ_ADDR GLUE_CAST08(50L) +#define DHCP_TAG_is_LEASE_TIME GLUE_CAST08(51L) +#define DHCP_TAG_is_OPT_OVERLOAD GLUE_CAST08(52L) +#define DHCP_TAG_is_MSG_TYPE GLUE_CAST08(53L) +#define DHCP_TAG_is_SERVER_ID GLUE_CAST08(54L) +#define DHCP_TAG_is_PARAMS_REQ GLUE_CAST08(55L) +#define DHCP_TAG_is_ERR_MESSAGE GLUE_CAST08(56L) +#define DHCP_TAG_is_MAX_MSG_SIZE GLUE_CAST08(57L) +#define DHCP_TAG_is_TIME_T1 GLUE_CAST08(58L) +#define DHCP_TAG_is_TIME_T2 GLUE_CAST08(59L) +#define DHCP_TAG_is_CLASS_ID GLUE_CAST08(60L) +#define DHCP_TAG_is_CLIENT_ID GLUE_CAST08(61L) +#define DHCP_TAG_is_END GLUE_CAST08(255L) + +/* Definitions for BOOTP_OPCODE */ + +#define SIZEOF_BOOTP_OPCODE (1) +#define GET_BOOTP_OPCODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_BOOTP_OPCODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define BOOTP_OPCODE_is_REQUEST GLUE_CAST08(1L) +#define BOOTP_OPCODE_is_REPLY GLUE_CAST08(2L) + +#endif /* EPILOGUE_LAYOUT_DHCP_H */ diff --git a/h/wrn/wm/util/layout/dhcp.ldb b/h/wrn/wm/util/layout/dhcp.ldb new file mode 100644 index 0000000..23c0c36 --- /dev/null +++ b/h/wrn/wm/util/layout/dhcp.ldb @@ -0,0 +1,139 @@ +(define-rcs-info "$Id: dhcp.ldb,v 1.1.1.1 2001/11/05 17:47:19 tneale Exp $") + +(use-layouts "ip.ldb") +(use-layouts "arp.ldb") + +(C-include EPILOGUE_INSTALL_H ) +(C-include EPILOGUE_TYPES_H ) +(C-include EPILOGUE_LAYOUT_LDBGLUE_H ) + +(define-layout BOOTP_OPCODE + (enum (type (unsigned 8)) + (value REQUEST 1) + (value REPLY 2))) + +;; option tags + +(define-layout DHCP_TAG + (enum (type (unsigned 8)) + ;; BOOTP-compatible + (value PAD 0) + (value SUBNET_MASK 1) + (value TIMEOFFSET 2) + (value ROUTER 3) + (value TIMESERVER 4) + (value IEN116SERVER 5) + (value DNSSERVER 6) + (value LOGSERVER 7) + (value COOKIESERVER 8) + (value LPRSERVER 9) + (value IMPRESSSERVER 10) + (value RLPSERVER 11) + (value HOSTNAME 12) + (value BOOTFILESIZE 13) + (value MERITFILESIZE 14) + (value DOMAINNAME 15) + (value SWAPSERVER 16) + (value ROOTPATH 17) + (value EXTENSIONSPATH 18) + ;; IP per-host parameters + (value IPFORWARD 19) + (value SOURCEROUTE 20) + (value POLICYFILT 21) + (value MAX_REASSEMBLY 22) + (value DEF_TTL 23) + (value MTU_TIMEOUT 24) + (value MTU_PLATEAUS 25) + (value MTU_VALUE 26) + (value MTU_SUBNETS_LOCAL 27) + (value BROADCAST_ADDR 28) + (value MASK_DISCOVER 29) + (value MASK_SUPPLY 30) + (value ROUTER_DISCOVER 31) + (value ROUTER_SOLICIT_ADDR 32) + (value STATIC_ROUTES 33) + ;; link layer per-interface parameters + (value ARP_TRAILERS 34) + (value ARP_TIMEOUT 35) + (value ETHERNET_802_3 36);; Ethernet encapsulation type + + ;; TCP per-interface parameters + (value TCP_TTL 37) + (value TCP_KEEPALIVE_VALUE 38) + (value TCP_KEEPALIVE_GARBAGE 39) + + ;; miscellaneous application parameters + (value NIS_DOMAIN 40) + (value NIS_SERVERS 41) + (value NTP_SERVERS 42) + (value VENDOR_SPECIFIC 43) + ;; NetBIOS + (value NB_NS 44) + (value NB_DD 45) + (value NB_NODETYPE 46) + (value NB_SCOPE 47) + ;; X Window System + (value X_FS 48) + (value X_DM 49) + ;; DHCP-specific options + (value REQ_ADDR 50) + (value LEASE_TIME 51) + (value OPT_OVERLOAD 52) + (value MSG_TYPE 53) + (value SERVER_ID 54) + (value PARAMS_REQ 55) + (value ERR_MESSAGE 56) + (value MAX_MSG_SIZE 57) + (value TIME_T1 58) + (value TIME_T2 59) + (value CLASS_ID 60) + (value CLIENT_ID 61) + + (value END 255))) + +;; values of message type -- for DHCP_TAG_is_MSG_TYPE + +(define-layout DHCP_MSGTYPE + (enum (type (unsigned 8)) + (value DHCPDISCOVER 1) + (value DHCPOFFER 2) + (value DHCPREQUEST 3) + (value DHCPDECLINE 4) + (value DHCPACK 5) + (value DHCPNAK 6) + (value DHCPRELEASE 7) + (value DHCPINFORM 8))) + +(define-layout DHCP_OPTION_HDR + (struct (field TAG DHCP_TAG) + (field length (unsigned 8)))) + +(define-layout DHCP_MSG + (struct (field OPCODE BOOTP_OPCODE) + (field HTYPE (unsigned 8)) ; same as ARP_HEADER_HARDWARE_TYPE + (field HLEN (unsigned 8)) ; hardware length + (field HOPS (unsigned 8)) ; number of ?agent? hops + (field XID (unsigned 32)) + (field SECS (unsigned 16)) + (field FLAGS (unsigned 16)) + (field CIADDR IP_ADDRESS) + (field YIADDR IP_ADDRESS) + (field SIADDR IP_ADDRESS) + (field GIADDR IP_ADDRESS) + (field CHADDR (array (count 16) + (type (unsigned 8)))) + (field SNAME (array (count 64) + (type (unsigned 8)))) + (field FILE (array (count 128) + (type (unsigned 8)))) + (union + (field COOKIE (unsigned 32)) + (field OPTIONS + (array (count 312) + (type (unsigned 8))))))) + + +; Local Variables: +; mode: Scheme +; End: + diff --git a/h/wrn/wm/util/layout/dns.h b/h/wrn/wm/util/layout/dns.h new file mode 100644 index 0000000..67f4ae9 --- /dev/null +++ b/h/wrn/wm/util/layout/dns.h @@ -0,0 +1,221 @@ +/* This file was automatically generated by Epilogue Technology's + * network datastructure layout tool. + * + * DO NOT MODIFY THIS FILE BY HAND. + * + * Source file information: + * Id: dns.ldb,v 1.7 1998/02/25 15:21:40 sra Exp + */ + +#ifndef EPILOGUE_LAYOUT_DNS_H +#define EPILOGUE_LAYOUT_DNS_H + +#ifndef EPILOGUE_INSTALL_H +#include +#endif +#ifndef EPILOGUE_TYPES_H +#include +#endif +#ifndef EPILOGUE_LAYOUT_LDBGLUE_H +#include +#endif + +/* Definitions for DNS_SOA */ + +#define SIZEOF_DNS_SOA (20) +#define PTR_DNS_SOA_SERIAL(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_DNS_SOA_SERIAL(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))) +#define SET_DNS_SOA_SERIAL(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_)), GLUE_CAST32(_V_)) +#define PTR_DNS_SOA_REFRESH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_DNS_SOA_REFRESH(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(4)) +#define SET_DNS_SOA_REFRESH(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST32(_V_)) +#define PTR_DNS_SOA_RETRY(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define GET_DNS_SOA_RETRY(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(8)) +#define SET_DNS_SOA_RETRY(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(8), GLUE_CAST32(_V_)) +#define PTR_DNS_SOA_EXPIRE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(12)) +#define GET_DNS_SOA_EXPIRE(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(12)) +#define SET_DNS_SOA_EXPIRE(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(12), GLUE_CAST32(_V_)) +#define PTR_DNS_SOA_MINIMUM(_P_)\ + ((GLUE_CAST_PTR(_P_))+(16)) +#define GET_DNS_SOA_MINIMUM(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(16)) +#define SET_DNS_SOA_MINIMUM(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(16), GLUE_CAST32(_V_)) + +/* Definitions for DNS_RR */ + +#define SIZEOF_DNS_RR (10) +#define PTR_DNS_RR_TYPE(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_DNS_RR_TYPE(_P_)\ + GLUE_GU16((GLUE_CAST_PTR(_P_))) +#define SET_DNS_RR_TYPE(_P_, _V_)\ + GLUE_SU16((GLUE_CAST_PTR(_P_)), GLUE_CAST16(_V_)) +#define PTR_DNS_RR_CLASS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_DNS_RR_CLASS(_P_)\ + GLUE_GU16((GLUE_CAST_PTR(_P_))+(2)) +#define SET_DNS_RR_CLASS(_P_, _V_)\ + GLUE_SU16((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST16(_V_)) +#define PTR_DNS_RR_TTL(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_DNS_RR_TTL(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(4)) +#define SET_DNS_RR_TTL(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST32(_V_)) +#define PTR_DNS_RR_RDLENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define GET_DNS_RR_RDLENGTH(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(8)) +#define SET_DNS_RR_RDLENGTH(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(8), GLUE_CAST16(_V_)) +#define PTR_DNS_RR_RDATA(_P_)\ + ((GLUE_CAST_PTR(_P_))+(10)) +#define SIZEOF_DNS_RR_RDATA (0) +#define PTR_DNS_RR_RDATA_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(10)+(_X0_)) +#define GET_DNS_RR_RDATA_ELT(_P_, _X0_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(10)+(_X0_)) +#define SET_DNS_RR_RDATA_ELT(_P_, _X0_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(10)+(_X0_), GLUE_CAST08(_V_)) + +/* Definitions for DNS_HEADER */ + +#define SIZEOF_DNS_HEADER (12) +#define PTR_DNS_HEADER_ID(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_DNS_HEADER_ID(_P_)\ + GLUE_GU16((GLUE_CAST_PTR(_P_))) +#define SET_DNS_HEADER_ID(_P_, _V_)\ + GLUE_SU16((GLUE_CAST_PTR(_P_)), GLUE_CAST16(_V_)) +/* Can't define PTR_DNS_HEADER_QR because: + Size 1 is not a multiple of 8. */ +#define GET_DNS_HEADER_QR(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) & GLUE_CAST08(0x80L)) +#define SET_DNS_HEADER_QR(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(2), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) | GLUE_CAST08(0x80L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) & ~GLUE_CAST08(0x80L))) +/* Can't define PTR_DNS_HEADER_OPCODE because: + Size 4 is not a multiple of 8. */ +#define GET_DNS_HEADER_OPCODE(_P_)\ + GLUE_CAST08((GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) & GLUE_CAST08(0x78L)) >> 3) +#define SET_DNS_HEADER_OPCODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(2), (GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) & ~GLUE_CAST08(0x78L)) | ((GLUE_CAST08(_V_) << 3) & GLUE_CAST08(0x78L))) +#define DNS_HEADER_OPCODE_is_QUERY GLUE_CAST08(0L) +#define DNS_HEADER_OPCODE_is_IQUERY GLUE_CAST08(1L) +#define DNS_HEADER_OPCODE_is_STATUS GLUE_CAST08(2L) +/* Can't define PTR_DNS_HEADER_AA because: + Size 1 is not a multiple of 8. */ +#define GET_DNS_HEADER_AA(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) & GLUE_CAST08(0x4L)) +#define SET_DNS_HEADER_AA(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(2), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) | GLUE_CAST08(0x4L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) & ~GLUE_CAST08(0x4L))) +/* Can't define PTR_DNS_HEADER_TC because: + Size 1 is not a multiple of 8. */ +#define GET_DNS_HEADER_TC(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) & GLUE_CAST08(0x2L)) +#define SET_DNS_HEADER_TC(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(2), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) | GLUE_CAST08(0x2L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) & ~GLUE_CAST08(0x2L))) +/* Can't define PTR_DNS_HEADER_RD because: + Size 1 is not a multiple of 8. */ +#define GET_DNS_HEADER_RD(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) & GLUE_CAST08(0x1L)) +#define SET_DNS_HEADER_RD(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(2), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) | GLUE_CAST08(0x1L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) & ~GLUE_CAST08(0x1L))) +/* Can't define PTR_DNS_HEADER_RA because: + Size 1 is not a multiple of 8. */ +#define GET_DNS_HEADER_RA(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(3)) & GLUE_CAST08(0x80L)) +#define SET_DNS_HEADER_RA(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(3), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(3)) | GLUE_CAST08(0x80L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(3)) & ~GLUE_CAST08(0x80L))) +/* Can't define PTR_DNS_HEADER_RCODE because: + Size 4 is not a multiple of 8. */ +#define GET_DNS_HEADER_RCODE(_P_)\ + GLUE_CAST08(GLUE_GB08((GLUE_CAST_PTR(_P_))+(3)) & GLUE_CAST08(0xFL)) +#define SET_DNS_HEADER_RCODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(3), (GLUE_GB08((GLUE_CAST_PTR(_P_))+(3)) & ~GLUE_CAST08(0xFL)) | (GLUE_CAST08(_V_) & GLUE_CAST08(0xFL))) +#define DNS_HEADER_RCODE_is_NO_ERROR GLUE_CAST08(0L) +#define DNS_HEADER_RCODE_is_FORMAT_ERROR GLUE_CAST08(1L) +#define DNS_HEADER_RCODE_is_SERVER_FAILURE GLUE_CAST08(2L) +#define DNS_HEADER_RCODE_is_NAME_ERROR GLUE_CAST08(3L) +#define DNS_HEADER_RCODE_is_NOT_IMPLEMENTED GLUE_CAST08(4L) +#define DNS_HEADER_RCODE_is_REFUSED GLUE_CAST08(5L) +#define PTR_DNS_HEADER_QDCOUNT(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_DNS_HEADER_QDCOUNT(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(4)) +#define SET_DNS_HEADER_QDCOUNT(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST16(_V_)) +#define PTR_DNS_HEADER_ANCOUNT(_P_)\ + ((GLUE_CAST_PTR(_P_))+(6)) +#define GET_DNS_HEADER_ANCOUNT(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(6)) +#define SET_DNS_HEADER_ANCOUNT(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(6), GLUE_CAST16(_V_)) +#define PTR_DNS_HEADER_NSCOUNT(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define GET_DNS_HEADER_NSCOUNT(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(8)) +#define SET_DNS_HEADER_NSCOUNT(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(8), GLUE_CAST16(_V_)) +#define PTR_DNS_HEADER_ARCOUNT(_P_)\ + ((GLUE_CAST_PTR(_P_))+(10)) +#define GET_DNS_HEADER_ARCOUNT(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(10)) +#define SET_DNS_HEADER_ARCOUNT(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(10), GLUE_CAST16(_V_)) + +/* Definitions for DNS_CLASS */ + +#define SIZEOF_DNS_CLASS (2) +#define GET_DNS_CLASS(_P_)\ + GLUE_GU16((GLUE_CAST_PTR(_P_))) +#define SET_DNS_CLASS(_P_, _V_)\ + GLUE_SU16((GLUE_CAST_PTR(_P_)), GLUE_CAST16(_V_)) +#define DNS_CLASS_is_IN GLUE_OPAQUE16(GLUE_CAST16(1L)) +#define DNS_CLASS_is_CS GLUE_OPAQUE16(GLUE_CAST16(2L)) +#define DNS_CLASS_is_CH GLUE_OPAQUE16(GLUE_CAST16(3L)) +#define DNS_CLASS_is_HS GLUE_OPAQUE16(GLUE_CAST16(4L)) +#define DNS_CLASS_is_WILD GLUE_OPAQUE16(GLUE_CAST16(255L)) + +/* Definitions for DNS_TYPE */ + +#define SIZEOF_DNS_TYPE (2) +#define GET_DNS_TYPE(_P_)\ + GLUE_GU16((GLUE_CAST_PTR(_P_))) +#define SET_DNS_TYPE(_P_, _V_)\ + GLUE_SU16((GLUE_CAST_PTR(_P_)), GLUE_CAST16(_V_)) +#define DNS_TYPE_is_A GLUE_OPAQUE16(GLUE_CAST16(1L)) +#define DNS_TYPE_is_NS GLUE_OPAQUE16(GLUE_CAST16(2L)) +#define DNS_TYPE_is_MD GLUE_OPAQUE16(GLUE_CAST16(3L)) +#define DNS_TYPE_is_MF GLUE_OPAQUE16(GLUE_CAST16(4L)) +#define DNS_TYPE_is_CNAME GLUE_OPAQUE16(GLUE_CAST16(5L)) +#define DNS_TYPE_is_SOA GLUE_OPAQUE16(GLUE_CAST16(6L)) +#define DNS_TYPE_is_MB GLUE_OPAQUE16(GLUE_CAST16(7L)) +#define DNS_TYPE_is_MG GLUE_OPAQUE16(GLUE_CAST16(8L)) +#define DNS_TYPE_is_MR GLUE_OPAQUE16(GLUE_CAST16(9L)) +#define DNS_TYPE_is_NULL GLUE_OPAQUE16(GLUE_CAST16(10L)) +#define DNS_TYPE_is_WKS GLUE_OPAQUE16(GLUE_CAST16(11L)) +#define DNS_TYPE_is_PTR GLUE_OPAQUE16(GLUE_CAST16(12L)) +#define DNS_TYPE_is_HINFO GLUE_OPAQUE16(GLUE_CAST16(13L)) +#define DNS_TYPE_is_MINFO GLUE_OPAQUE16(GLUE_CAST16(14L)) +#define DNS_TYPE_is_MX GLUE_OPAQUE16(GLUE_CAST16(15L)) +#define DNS_TYPE_is_TXT GLUE_OPAQUE16(GLUE_CAST16(16L)) +#define DNS_TYPE_is_AAAA GLUE_OPAQUE16(GLUE_CAST16(28L)) +#define DNS_TYPE_is_AXFR GLUE_OPAQUE16(GLUE_CAST16(252L)) +#define DNS_TYPE_is_MAILB GLUE_OPAQUE16(GLUE_CAST16(253L)) +#define DNS_TYPE_is_MAILA GLUE_OPAQUE16(GLUE_CAST16(254L)) +#define DNS_TYPE_is_WILD GLUE_OPAQUE16(GLUE_CAST16(255L)) + +#endif /* EPILOGUE_LAYOUT_DNS_H */ diff --git a/h/wrn/wm/util/layout/dns.ldb b/h/wrn/wm/util/layout/dns.ldb new file mode 100644 index 0000000..45e68c3 --- /dev/null +++ b/h/wrn/wm/util/layout/dns.ldb @@ -0,0 +1,187 @@ +; $Header: /usr/cvsroot/target/h/wrn/wm/util/layout/dns.ldb,v 1.1.1.1 2001/11/05 17:47:20 tneale Exp $ +; Layout information for DNS + +;**************************************************************************** +; +; *** Restricted Rights Legend *** +; +; The programs and information contained herein are licensed only +; pursuant to a license agreement that contains use, reverse +; engineering, disclosure, and other restrictions; accordingly, it +; is "Unpublished--all rights reserved under the applicable +; copyright laws". +; +; Use duplication, or disclosure by the Government is subject to +; restrictions as set forth in subparagraph (c)(1)(ii) of the Rights +; in Technical Data and Computer Licensed Programs clause of DFARS +; 52.227 7013. +; +; Copyright 2000-2001 Wind River Systems, Inc. +; Copyright 1996-1997 Epilogue Technology Corporation. +; Copyright 1998 Integrated Systems, Inc. +; All rights reserved. +; +; *** Government Use *** +; +; The Licensed Programs and their documentation were developed at +; private expense and no part of them is in the public domain. +; +; The Licensed Programs are "Restricted Computer Software" as that +; term is defined in Clause 52.227-19 of the Federal Acquisition +; Regulations (FAR) and are "Commercial Computer Software" as that +; term is defined in Subpart 227.401 of the Department of Defense +; Federal Acquisition Regulation Supplement (DFARS). +; +; (i) If the licensed Programs are supplied to the Department of +; Defense (DoD), the Licensed Programs are classified as +; "Commercial Computer Software" and the Government is acquiring +; only "restricted rights" in the Licensed Programs and their +; documentation as that term is defined in Clause 52.227 +; 7013(c)(1) of the DFARS, and +; +; (ii) If the Licensed Programs are supplied to any unit or agency +; of the United States Government other than DoD, the +; Government's rights in the Licensed Programs and their +; documentation will be as defined in Clause 52.227-19(c)(2) of +; the FAR. +;**************************************************************************** + +; $Log: dns.ldb,v $ +; Revision 1.1.1.1 2001/11/05 17:47:20 tneale +; Tornado shuffle +; +; Revision 1.8 2001/01/19 22:22:32 paul +; Update copyright. +; +; Revision 1.7 1998/02/25 15:21:40 sra +; Finish moving types.h, bug.h, and bugdef.h to common/h/. +; +; Revision 1.6 1998/02/25 04:53:54 sra +; Update copyrights. +; +; Revision 1.5 1997/09/26 20:21:14 alan +; Use features of new layout compiler: `use-layouts' and `C-include'. +; +; Revision 1.4 1997/06/04 05:46:23 alan +; Fix RCS keywords. +; +; Revision 1.3 1997/06/03 22:59:32 alan +; Use `define-rcs-info'. +; +; Revision 1.2 1997/04/22 00:18:31 alan +; Fix copyright. +; +; Revision 1.1 1997/04/19 04:12:13 alan +; Move all .ldb files into the `layout' directory. +; +; Revision 1.2 1996/12/03 07:51:11 alan +; Add AAAA type. +; +; Revision 1.1 1996/06/06 01:54:35 alan +; Added the file `dns.ldb'. + +(define-rcs-info "$Id: dns.ldb,v 1.1.1.1 2001/11/05 17:47:20 tneale Exp $") + +(C-include EPILOGUE_INSTALL_H ) +(C-include EPILOGUE_TYPES_H ) +(C-include EPILOGUE_LAYOUT_LDBGLUE_H ) + +(define-layout DNS_TYPE + (enum (type (opaque 16)) + (value A 1) + (value NS 2) + (value MD 3) + (value MF 4) + (value CNAME 5) + (value SOA 6) + (value MB 7) + (value MG 8) + (value MR 9) + (value NULL 10) + (value WKS 11) + (value PTR 12) + (value HINFO 13) + (value MINFO 14) + (value MX 15) + (value TXT 16) + (value AAAA 28) + ;; Following types can only be used in queries: + (value AXFR 252) + (value MAILB 253) + (value MAILA 254) + (value WILD 255) ; aka "*" + )) + +(define-layout DNS_CLASS + (enum (type (opaque 16)) + (value IN 1) + (value CS 2) + (value CH 3) + (value HS 4) + ;; Following types can only be used in queries: + (value WILD 255) ; aka "*" + )) + +(define-layout DNS_HEADER + (struct (size (* 6 16)) + (field ID (opaque 16)) + (struct (size 16) + (align 1) + (field QR (boolean 1)) + (field OPCODE (enum (type (unsigned 4)) + (value QUERY 0) + (value IQUERY 1) + (value STATUS 2))) + (field AA (boolean 1)) + (field TC (boolean 1)) + (field RD (boolean 1)) + (field RA (boolean 1)) + (fill 3) ; MBZ + (field RCODE (enum (type (unsigned 4)) + (value NO_ERROR 0) + (value FORMAT_ERROR 1) + (value SERVER_FAILURE 2) + (value NAME_ERROR 3) + (value NOT_IMPLEMENTED 4) + (value REFUSED 5) + )) + ) + (field QDCOUNT (unsigned 16)) + (field ANCOUNT (unsigned 16)) + (field NSCOUNT (unsigned 16)) + (field ARCOUNT (unsigned 16)) + )) + +;; *NOTE* Some of the time fields here might actually want to be -signed- +;; quantities. RFC1035 is sometimes unclear about this. Fortunately, we are +;; saved from having to worry about this here by the fact that the `layout' +;; tool doesn't support the signed types completely... + +(define-layout DNS_RR + (struct (size (* 5 16)) + ;; First comes NAME (a domain-name) + ;; and then these fixed fields: + (field TYPE DNS_TYPE) + (field CLASS DNS_CLASS) + ;; A Question would end here. + (field TTL (unsigned 32)) + (field RDLENGTH (unsigned 16)) + (field RDATA (array (count 0) + (type (unsigned 8)))) + )) + +(define-layout DNS_SOA + (struct (size (* 5 32)) + ;; First comes MNAME (a domain-name) + ;; and RNAME (a domain-name) + ;; and then these fixed fields: + (field SERIAL (unsigned 32)) + (field REFRESH (unsigned 32)) + (field RETRY (unsigned 32)) + (field EXPIRE (unsigned 32)) + (field MINIMUM (unsigned 32)) + )) + +; Local Variables: +; mode: Scheme +; End: diff --git a/h/wrn/wm/util/layout/doc.txt b/h/wrn/wm/util/layout/doc.txt new file mode 100644 index 0000000..007dd1c --- /dev/null +++ b/h/wrn/wm/util/layout/doc.txt @@ -0,0 +1,184 @@ + +BNF for layout language: + + := * + + := (define-layout
) + | (define-layout-macro ) + | (define-rcs-info ) + | (use-layouts ) + | (C-include ) + + := + := + + := + | + | ( *) + | (sizeof ) + + := + | - | * | octets + + := + | ( *) + | (enum *) + | (struct *) + | (union *) + | (array *) + + := opaque | boolean | signed | unsigned | + | signed-8bit-little | unsigned-8bit-little + + := (type ) + | (value ) + + := (field ) + | (fill ?) + | (union *) + | (struct *) + | (size ) + | (align ) + + := (count ) + | (type ) + | (size ) + | (align ) + | (spacing ) + + := ... any scheme constant ... + + := ... sequence of letters, digits and underscores ... + +----- + +Macros generated by `-makeh': + + (Note that if it is impossible for some reason to generate a macro that + performs as expected, a comment will be generated explaining why. For + example, since C doesn't support pointers to single bits, we can't + generate `PTR_...' macros for boolean fields!) + + SIZEOF_ + + The size in bytes of the type . + + PTR__(p) + GET__(p) + SET__(p, v) + + p should be a pointer. v will be cast to the appropriate type. + + Operate on the field of the type -- returning a pointer + to it or reading or writing its contents. + + _is_ + + The constants in the enumeration type . (Yes the word "is" + really is in lower case -- I'm open to alternate suggestions, but I + really like the look of `IP_PORT_is_DOMAIN'.) + +----- + +GLUE macros expected by `-makeh': + + GLUE_CAST_PTR(p) + + Convert p to bits8_t *. This could be a cast, or it could expand into + a call to a prototyped procedure if you wanted to enforce some type + safety. + + GLUE_Gennh(p) + + (Specifically: + GLUE_GB08, GLUE_GB16, GLUE_GB32, GLUE_GB32LS24, GLUE_GB32MS24, + GLUE_GL08, GLUE_GL16, GLUE_GL32, GLUE_GL32LS24, GLUE_GL32MS24, + GLUE_GU08, GLUE_GU16, GLUE_GU32, GLUE_GU32LS24, GLUE_GU32MS24.) + + p is of type bits8_t *. Returns the appropriate type for nn bit bytes. + e is B for big endian, L for little endian, or U for un-endian. + + h is LS24 or MS24 if the caller is only going to manipulate the least + significant 24 bits or most significant 24 bits. The macro may or may + not return the other byte in the 32 bit word. + + GLUE_Sennh(p, v) + + (Specifically: + GLUE_SB08, GLUE_SB16, GLUE_SB32, GLUE_SB32LS24, GLUE_SB32MS24, + GLUE_SL08, GLUE_SL16, GLUE_SL32, GLUE_SL32LS24, GLUE_SL32MS24, + GLUE_SU08, GLUE_SU16, GLUE_SU32, GLUE_SU32LS24, GLUE_SU32MS24.) + + p is of type bits8_t *. v is of the appropriate type for nn bit bytes. + e is B for big endian, L for little endian, or U for un-endian. + + h is LS24 or MS24 if the caller is only going to manipulate the least + significant 24 bits or most significant 24 bits. The macro may or may + not store the other byte in the 32 bit word. (But it -must- behave + consistent with the corresponding GLUE_G... macro!) + + GLUE_CASTnn(v) + + (Specifically: GLUE_CAST08, GLUE_CAST16, GLUE_CAST32.) + + Cast v to be the appropriate unsigned scalar type for nn bit bytes. + + GLUE_OPAQUEnn(v) + + (Specifically: GLUE_OPAQUE08, GLUE_OPAQUE16, GLUE_OPAQUE32.) + + These could be defined as: + + #define GLUE_OPAQUE08(v) (GLUE_SB08(scratch, v), GLUE_GU08(scratch)) + #define GLUE_OPAQUE16(v) (GLUE_SB16(scratch, v), GLUE_GU16(scratch)) + #define GLUE_OPAQUE32(v) (GLUE_SB32(scratch, v), GLUE_GU32(scratch)) + + Assuming scratch is a bits8_t * pointer to 4 bytes of temporary storage. + +----- + +Command line interface: + + ldbcomp [-define ] -- Obsolete! + [-makesch ] + [-makeh ] + [-include-check ] + [-unique-names ] + ... + + First all the files are loaded in the order they appeared in the + command line. Definitions made in these files are added to the + built-in definitions. No output will be generated for the definitions + made in any file. (Note that the `-define' option can usefully + be used multiple times.) NOTE: The `-define' option has been made + obsolete by the new `use-layouts' top-level form. + + Second, each is loaded. + + Third, if the `-makesch' option was specified, a Scheme->C header file + is generated named . + + Forth, if the `-makeh' option was specified, a C header file is + generated named . + + If `-include-check' was specified, the C header file will include code + to prevent multiple inclusion. is the prefix to use for the + macro that will be tested to perform this check. + + + `-unique-names' controls how many characters in an identifier are + significant to the pre-processor. By default, ldbcomp checks to be + certain that the first 31 characters of all macro names are unique. + + Example: + + ldbcomp -include-check "LAYOUT_" -define ip.ldb -makeh tcp.h tcp.ldb + + Loads `ip.ldb' and `tcp.ldb' and then writes `tcp.h'. `tcp.h' will + contain macro definitions for objects defined in `tcp.ldb'. + + `tcp.h' will test `#ifndef LAYOUT_TCP_H' to prevent multiple inclusion. + +----- + + $Source: /usr/cvsroot/target/h/wrn/wm/util/layout/doc.txt,v $ + $Id: doc.txt,v 1.1.1.1 2001/11/05 17:47:20 tneale Exp $ diff --git a/h/wrn/wm/util/layout/ethernet.h b/h/wrn/wm/util/layout/ethernet.h new file mode 100644 index 0000000..81af330 --- /dev/null +++ b/h/wrn/wm/util/layout/ethernet.h @@ -0,0 +1,116 @@ +/* This file was automatically generated by Epilogue Technology's + * network datastructure layout tool. + * + * DO NOT MODIFY THIS FILE BY HAND. + * + * Source file information: + * Id: ethernet.ldb,v 1.7 1998/02/25 15:21:40 sra Exp + */ + +#ifndef EPILOGUE_LAYOUT_ETHERNET_H +#define EPILOGUE_LAYOUT_ETHERNET_H + +#ifndef EPILOGUE_INSTALL_H +#include +#endif +#ifndef EPILOGUE_TYPES_H +#include +#endif +#ifndef EPILOGUE_LAYOUT_LDBGLUE_H +#include +#endif + +/* Definitions for IEEE802_HEADER */ + +#define SIZEOF_IEEE802_HEADER (22) +#define PTR_IEEE802_HEADER_DESTINATION_ADDRESS(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define PTR_IEEE802_HEADER_SOURCE_ADDRESS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(6)) +#define PTR_IEEE802_HEADER_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(12)) +#define GET_IEEE802_HEADER_LENGTH(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(12)) +#define SET_IEEE802_HEADER_LENGTH(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(12), GLUE_CAST16(_V_)) +#define PTR_IEEE802_HEADER_DSAP(_P_)\ + ((GLUE_CAST_PTR(_P_))+(14)) +#define GET_IEEE802_HEADER_DSAP(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(14)) +#define SET_IEEE802_HEADER_DSAP(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(14), GLUE_CAST08(_V_)) +#define PTR_IEEE802_HEADER_SSAP(_P_)\ + ((GLUE_CAST_PTR(_P_))+(15)) +#define GET_IEEE802_HEADER_SSAP(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(15)) +#define SET_IEEE802_HEADER_SSAP(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(15), GLUE_CAST08(_V_)) +#define PTR_IEEE802_HEADER_CONTROL(_P_)\ + ((GLUE_CAST_PTR(_P_))+(16)) +#define GET_IEEE802_HEADER_CONTROL(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(16)) +#define SET_IEEE802_HEADER_CONTROL(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(16), GLUE_CAST08(_V_)) +#define PTR_IEEE802_HEADER_ORGANIZATION(_P_)\ + ((GLUE_CAST_PTR(_P_))+(17)) +#define GET_IEEE802_HEADER_ORGANIZATION(_P_)\ + GLUE_CAST32(GLUE_GB32LS24((GLUE_CAST_PTR(_P_))+(16)) & GLUE_CAST32(0xFFFFFFL)) +#define SET_IEEE802_HEADER_ORGANIZATION(_P_, _V_)\ + GLUE_SB32LS24((GLUE_CAST_PTR(_P_))+(16), (GLUE_GB32LS24((GLUE_CAST_PTR(_P_))+(16)) & ~GLUE_CAST32(0xFFFFFFL)) | (GLUE_CAST32(_V_) & GLUE_CAST32(0xFFFFFFL))) +#define PTR_IEEE802_HEADER_TYPE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(20)) +#define GET_IEEE802_HEADER_TYPE(_P_)\ + GLUE_GU16((GLUE_CAST_PTR(_P_))+(20)) +#define SET_IEEE802_HEADER_TYPE(_P_, _V_)\ + GLUE_SU16((GLUE_CAST_PTR(_P_))+(20), GLUE_CAST16(_V_)) + +/* Definitions for ETHERNET_HEADER */ + +#define SIZEOF_ETHERNET_HEADER (14) +#define PTR_ETHERNET_HEADER_DESTINATION_ADDRESS(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define PTR_ETHERNET_HEADER_SOURCE_ADDRESS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(6)) +#define PTR_ETHERNET_HEADER_TYPE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(12)) +#define GET_ETHERNET_HEADER_TYPE(_P_)\ + GLUE_GU16((GLUE_CAST_PTR(_P_))+(12)) +#define SET_ETHERNET_HEADER_TYPE(_P_, _V_)\ + GLUE_SU16((GLUE_CAST_PTR(_P_))+(12), GLUE_CAST16(_V_)) + +/* Definitions for ETHERNET_TYPE */ + +#define SIZEOF_ETHERNET_TYPE (2) +#define GET_ETHERNET_TYPE(_P_)\ + GLUE_GU16((GLUE_CAST_PTR(_P_))) +#define SET_ETHERNET_TYPE(_P_, _V_)\ + GLUE_SU16((GLUE_CAST_PTR(_P_)), GLUE_CAST16(_V_)) +#define ETHERNET_TYPE_is_IP GLUE_OPAQUE16(GLUE_CAST16(0x800L)) +#define ETHERNET_TYPE_is_CHAOS GLUE_OPAQUE16(GLUE_CAST16(0x804L)) +#define ETHERNET_TYPE_is_ARP GLUE_OPAQUE16(GLUE_CAST16(0x806L)) +#define ETHERNET_TYPE_is_RARP GLUE_OPAQUE16(GLUE_CAST16(0x8035L)) +#define ETHERNET_TYPE_is_APPLETALK GLUE_OPAQUE16(GLUE_CAST16(0x809BL)) +#define ETHERNET_TYPE_is_APPLETALK_ARP GLUE_OPAQUE16(GLUE_CAST16(0x80F3L)) +#define ETHERNET_TYPE_is_IPV6 GLUE_OPAQUE16(GLUE_CAST16(0x86DDL)) +#define ETHERNET_TYPE_is_LOOPBACK GLUE_OPAQUE16(GLUE_CAST16(0x9000L)) + +/* Definitions for ETHERNET_ADDRESS */ + +#define SIZEOF_ETHERNET_ADDRESS (6) +/* Can't define PTR_ETHERNET_ADDRESS_MULTICAST because: + Size 1 is not a multiple of 8. */ +#define GET_ETHERNET_ADDRESS_MULTICAST(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))) & GLUE_CAST08(0x1L)) +#define SET_ETHERNET_ADDRESS_MULTICAST(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))) | GLUE_CAST08(0x1L) : GLUE_GB08((GLUE_CAST_PTR(_P_))) & ~GLUE_CAST08(0x1L))) +#define PTR_ETHERNET_ADDRESS_BYTES(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_ETHERNET_ADDRESS_BYTES (6) +#define PTR_ETHERNET_ADDRESS_BYTES_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(_X0_)) +#define GET_ETHERNET_ADDRESS_BYTES_ELT(_P_, _X0_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(_X0_)) +#define SET_ETHERNET_ADDRESS_BYTES_ELT(_P_, _X0_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(_X0_), GLUE_CAST08(_V_)) + +#endif /* EPILOGUE_LAYOUT_ETHERNET_H */ diff --git a/h/wrn/wm/util/layout/ethernet.ldb b/h/wrn/wm/util/layout/ethernet.ldb new file mode 100644 index 0000000..ea04c58 --- /dev/null +++ b/h/wrn/wm/util/layout/ethernet.ldb @@ -0,0 +1,138 @@ +; $Header: /usr/cvsroot/target/h/wrn/wm/util/layout/ethernet.ldb,v 1.1.1.1 2001/11/05 17:47:19 tneale Exp $ +; Layout information for Ethernets + +;**************************************************************************** +; +; *** Restricted Rights Legend *** +; +; The programs and information contained herein are licensed only +; pursuant to a license agreement that contains use, reverse +; engineering, disclosure, and other restrictions; accordingly, it +; is "Unpublished--all rights reserved under the applicable +; copyright laws". +; +; Use duplication, or disclosure by the Government is subject to +; restrictions as set forth in subparagraph (c)(1)(ii) of the Rights +; in Technical Data and Computer Licensed Programs clause of DFARS +; 52.227 7013. +; +; Copyright 2000-2001 Wind River Systems, Inc. +; Copyright 1995-1997 Epilogue Technology Corporation. +; Copyright 1998 Integrated Systems, Inc. +; All rights reserved. +; +; *** Government Use *** +; +; The Licensed Programs and their documentation were developed at +; private expense and no part of them is in the public domain. +; +; The Licensed Programs are "Restricted Computer Software" as that +; term is defined in Clause 52.227-19 of the Federal Acquisition +; Regulations (FAR) and are "Commercial Computer Software" as that +; term is defined in Subpart 227.401 of the Department of Defense +; Federal Acquisition Regulation Supplement (DFARS). +; +; (i) If the licensed Programs are supplied to the Department of +; Defense (DoD), the Licensed Programs are classified as +; "Commercial Computer Software" and the Government is acquiring +; only "restricted rights" in the Licensed Programs and their +; documentation as that term is defined in Clause 52.227 +; 7013(c)(1) of the DFARS, and +; +; (ii) If the Licensed Programs are supplied to any unit or agency +; of the United States Government other than DoD, the +; Government's rights in the Licensed Programs and their +; documentation will be as defined in Clause 52.227-19(c)(2) of +; the FAR. +;**************************************************************************** + +; $Log: ethernet.ldb,v $ +; Revision 1.1.1.1 2001/11/05 17:47:19 tneale +; Tornado shuffle +; +; Revision 1.8 2001/01/19 22:22:33 paul +; Update copyright. +; +; Revision 1.7 1998/02/25 15:21:40 sra +; Finish moving types.h, bug.h, and bugdef.h to common/h/. +; +; Revision 1.6 1998/02/25 04:53:56 sra +; Update copyrights. +; +; Revision 1.5 1997/09/26 20:21:14 alan +; Use features of new layout compiler: `use-layouts' and `C-include'. +; +; Revision 1.4 1997/06/04 05:46:24 alan +; Fix RCS keywords. +; +; Revision 1.3 1997/06/03 22:59:33 alan +; Use `define-rcs-info'. +; +; Revision 1.2 1997/04/22 00:18:32 alan +; Fix copyright. +; +; Revision 1.1 1997/04/19 04:12:14 alan +; Move all .ldb files into the `layout' directory. +; +; Revision 1.5 1997/03/05 00:51:44 alan +; Fix Copyright. +; +; Revision 1.4 1996/11/27 00:17:31 alan +; Add IPV6 type. +; +; Revision 1.3 1995/06/10 02:40:18 alan +; Add LOOPBACK ethernet type. +; +; Revision 1.2 1995/05/25 23:53:32 alan +; Some enums have a `base' attribute -- some other tweaking. +; +; Revision 1.1 1995/05/23 07:17:08 alan +; Basic network layouts. + +(define-rcs-info "$Id: ethernet.ldb,v 1.1.1.1 2001/11/05 17:47:19 tneale Exp $") + +(C-include EPILOGUE_INSTALL_H ) +(C-include EPILOGUE_TYPES_H ) +(C-include EPILOGUE_LAYOUT_LDBGLUE_H ) + +(define-layout ETHERNET_ADDRESS + (union (size (* 6 8)) + (struct (align 1) + (fill 7) + (field MULTICAST (boolean 1))) + (field BYTES + (array (count 6) + (type (unsigned 8)))))) + +(define-layout ETHERNET_TYPE + (enum (type (opaque 16)) + (base 16) + (value IP #x0800) + (value CHAOS #x0804) + (value ARP #x0806) + (value RARP #x8035) + (value APPLETALK #x809B) + (value APPLETALK_ARP #x80F3) + (value IPV6 #x86DD) + (value LOOPBACK #x9000) + )) + +(define-layout ETHERNET_HEADER + (struct (field DESTINATION_ADDRESS ETHERNET_ADDRESS) + (field SOURCE_ADDRESS ETHERNET_ADDRESS) + ;; type values less than #x0600 are probably 802.3 packets + (field TYPE ETHERNET_TYPE))) + +(define-layout IEEE802_HEADER + (struct (field DESTINATION_ADDRESS ETHERNET_ADDRESS) + (field SOURCE_ADDRESS ETHERNET_ADDRESS) + (field LENGTH (unsigned 16)) + (field DSAP (unsigned 8)) ; 170 + (field SSAP (unsigned 8)) ; 170 + (field CONTROL (unsigned 8)) ; 3 = Unnumbered Information + (field ORGANIZATION (unsigned 24)) + (field TYPE ETHERNET_TYPE))) + +; Local Variables: +; mode: Scheme +; End: diff --git a/h/wrn/wm/util/layout/ip.h b/h/wrn/wm/util/layout/ip.h new file mode 100644 index 0000000..7d6a955 --- /dev/null +++ b/h/wrn/wm/util/layout/ip.h @@ -0,0 +1,665 @@ +/* This file was automatically generated by Epilogue Technology's + * network datastructure layout tool. + * + * DO NOT MODIFY THIS FILE BY HAND. + * + * Source file information: + * Id: ip.ldb,v 1.18 1999/10/19 20:12:43 sar Exp + */ + +#ifndef EPILOGUE_LAYOUT_IP_H +#define EPILOGUE_LAYOUT_IP_H + +#ifndef EPILOGUE_INSTALL_H +#include +#endif +#ifndef EPILOGUE_TYPES_H +#include +#endif +#ifndef EPILOGUE_LAYOUT_LDBGLUE_H +#include +#endif + +/* Definitions for TCP_OPTION_MSS */ + +#define SIZEOF_TCP_OPTION_MSS (4) +#define PTR_TCP_OPTION_MSS_SIZE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_TCP_OPTION_MSS_SIZE(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(2)) +#define SET_TCP_OPTION_MSS_SIZE(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST16(_V_)) + +/* Definitions for TCP_OPTION_HEADER */ + +#define SIZEOF_TCP_OPTION_HEADER (2) +#define PTR_TCP_OPTION_HEADER_KIND(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_TCP_OPTION_HEADER_KIND(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_TCP_OPTION_HEADER_KIND(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define TCP_OPTION_HEADER_KIND_is_END GLUE_CAST08(0L) +#define TCP_OPTION_HEADER_KIND_is_NOOP GLUE_CAST08(1L) +#define TCP_OPTION_HEADER_KIND_is_MSS GLUE_CAST08(2L) +#define PTR_TCP_OPTION_HEADER_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_TCP_OPTION_HEADER_LENGTH(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_TCP_OPTION_HEADER_LENGTH(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) + +/* Definitions for TCP_HEADER */ + +#define SIZEOF_TCP_HEADER (20) +#define PTR_TCP_HEADER_SOURCE_PORT(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define PTR_TCP_HEADER_DESTINATION_PORT(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define PTR_TCP_HEADER_SEQUENCE_NUMBER(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_TCP_HEADER_SEQUENCE_NUMBER(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(4)) +#define SET_TCP_HEADER_SEQUENCE_NUMBER(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST32(_V_)) +#define PTR_TCP_HEADER_ACKNOWLEDGE_NUMBER(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define GET_TCP_HEADER_ACKNOWLEDGE_NUMBER(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(8)) +#define SET_TCP_HEADER_ACKNOWLEDGE_NUMBER(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(8), GLUE_CAST32(_V_)) +/* Can't define PTR_TCP_HEADER_DATA_OFFSET because: + Size 4 is not a multiple of 8. */ +#define GET_TCP_HEADER_DATA_OFFSET(_P_)\ + GLUE_CAST08(GLUE_GB08((GLUE_CAST_PTR(_P_))+(12)) >> 4) +#define SET_TCP_HEADER_DATA_OFFSET(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(12), (GLUE_GB08((GLUE_CAST_PTR(_P_))+(12)) & ~GLUE_CAST08(0xF0L)) | ((GLUE_CAST08(_V_) << 4) & GLUE_CAST08(0xF0L))) +/* Can't define PTR_TCP_HEADER_URG because: + Size 1 is not a multiple of 8. */ +#define GET_TCP_HEADER_URG(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(13)) & GLUE_CAST08(0x20L)) +#define SET_TCP_HEADER_URG(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(13), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(13)) | GLUE_CAST08(0x20L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(13)) & ~GLUE_CAST08(0x20L))) +/* Can't define PTR_TCP_HEADER_ACK because: + Size 1 is not a multiple of 8. */ +#define GET_TCP_HEADER_ACK(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(13)) & GLUE_CAST08(0x10L)) +#define SET_TCP_HEADER_ACK(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(13), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(13)) | GLUE_CAST08(0x10L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(13)) & ~GLUE_CAST08(0x10L))) +/* Can't define PTR_TCP_HEADER_PSH because: + Size 1 is not a multiple of 8. */ +#define GET_TCP_HEADER_PSH(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(13)) & GLUE_CAST08(0x8L)) +#define SET_TCP_HEADER_PSH(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(13), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(13)) | GLUE_CAST08(0x8L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(13)) & ~GLUE_CAST08(0x8L))) +/* Can't define PTR_TCP_HEADER_RST because: + Size 1 is not a multiple of 8. */ +#define GET_TCP_HEADER_RST(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(13)) & GLUE_CAST08(0x4L)) +#define SET_TCP_HEADER_RST(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(13), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(13)) | GLUE_CAST08(0x4L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(13)) & ~GLUE_CAST08(0x4L))) +/* Can't define PTR_TCP_HEADER_SYN because: + Size 1 is not a multiple of 8. */ +#define GET_TCP_HEADER_SYN(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(13)) & GLUE_CAST08(0x2L)) +#define SET_TCP_HEADER_SYN(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(13), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(13)) | GLUE_CAST08(0x2L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(13)) & ~GLUE_CAST08(0x2L))) +/* Can't define PTR_TCP_HEADER_FIN because: + Size 1 is not a multiple of 8. */ +#define GET_TCP_HEADER_FIN(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(13)) & GLUE_CAST08(0x1L)) +#define SET_TCP_HEADER_FIN(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(13), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(13)) | GLUE_CAST08(0x1L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(13)) & ~GLUE_CAST08(0x1L))) +#define PTR_TCP_HEADER_WINDOW(_P_)\ + ((GLUE_CAST_PTR(_P_))+(14)) +#define GET_TCP_HEADER_WINDOW(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(14)) +#define SET_TCP_HEADER_WINDOW(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(14), GLUE_CAST16(_V_)) +#define PTR_TCP_HEADER_CHECKSUM(_P_)\ + ((GLUE_CAST_PTR(_P_))+(16)) +#define GET_TCP_HEADER_CHECKSUM(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(16)) +#define SET_TCP_HEADER_CHECKSUM(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(16), GLUE_CAST16(_V_)) +#define PTR_TCP_HEADER_URGENT_POINTER(_P_)\ + ((GLUE_CAST_PTR(_P_))+(18)) +#define GET_TCP_HEADER_URGENT_POINTER(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(18)) +#define SET_TCP_HEADER_URGENT_POINTER(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(18), GLUE_CAST16(_V_)) +#define PTR_TCP_HEADER_OPTIONS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(20)) +#define SIZEOF_TCP_HEADER_OPTIONS (0) + +/* Definitions for UDP_HEADER */ + +#define SIZEOF_UDP_HEADER (8) +#define PTR_UDP_HEADER_SOURCE_PORT(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define PTR_UDP_HEADER_DESTINATION_PORT(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define PTR_UDP_HEADER_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_UDP_HEADER_LENGTH(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(4)) +#define SET_UDP_HEADER_LENGTH(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST16(_V_)) +#define PTR_UDP_HEADER_CHECKSUM(_P_)\ + ((GLUE_CAST_PTR(_P_))+(6)) +#define GET_UDP_HEADER_CHECKSUM(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(6)) +#define SET_UDP_HEADER_CHECKSUM(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(6), GLUE_CAST16(_V_)) + +/* Definitions for ICMP_MESSAGE */ + +#define SIZEOF_ICMP_MESSAGE (28) +#define PTR_ICMP_MESSAGE_TYPE(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_ICMP_MESSAGE_TYPE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_ICMP_MESSAGE_TYPE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define ICMP_MESSAGE_TYPE_is_ECHO_REPLY GLUE_CAST08(0L) +#define ICMP_MESSAGE_TYPE_is_DESTINATION_UNREACHABLE GLUE_CAST08(3L) +#define ICMP_MESSAGE_TYPE_is_SOURCE_QUENCH GLUE_CAST08(4L) +#define ICMP_MESSAGE_TYPE_is_REDIRECT GLUE_CAST08(5L) +#define ICMP_MESSAGE_TYPE_is_ECHO GLUE_CAST08(8L) +#define ICMP_MESSAGE_TYPE_is_ROUTER_ADVERTISEMENT GLUE_CAST08(9L) +#define ICMP_MESSAGE_TYPE_is_ROUTER_SOLICITATION GLUE_CAST08(10L) +#define ICMP_MESSAGE_TYPE_is_TIME_EXCEEDED GLUE_CAST08(11L) +#define ICMP_MESSAGE_TYPE_is_PARAMETER_PROBLEM GLUE_CAST08(12L) +#define ICMP_MESSAGE_TYPE_is_TIMESTAMP GLUE_CAST08(13L) +#define ICMP_MESSAGE_TYPE_is_TIMESTAMP_REPLY GLUE_CAST08(14L) +#define ICMP_MESSAGE_TYPE_is_INFO_REQUEST GLUE_CAST08(15L) +#define ICMP_MESSAGE_TYPE_is_INFO_REPLY GLUE_CAST08(16L) +#define PTR_ICMP_MESSAGE_CHECKSUM(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_ICMP_MESSAGE_CHECKSUM(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(2)) +#define SET_ICMP_MESSAGE_CHECKSUM(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST16(_V_)) +#define PTR_ICMP_MESSAGE_IDENTIFICATION(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_ICMP_MESSAGE_IDENTIFICATION(_P_)\ + GLUE_GU16((GLUE_CAST_PTR(_P_))+(4)) +#define SET_ICMP_MESSAGE_IDENTIFICATION(_P_, _V_)\ + GLUE_SU16((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST16(_V_)) +#define PTR_ICMP_MESSAGE_SEQUENCE_NUMBER(_P_)\ + ((GLUE_CAST_PTR(_P_))+(6)) +#define GET_ICMP_MESSAGE_SEQUENCE_NUMBER(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(6)) +#define SET_ICMP_MESSAGE_SEQUENCE_NUMBER(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(6), GLUE_CAST16(_V_)) +#define PTR_ICMP_MESSAGE_HEADER(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define PTR_ICMP_MESSAGE_MINIMUM_HEADER(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_ICMP_MESSAGE_MINIMUM_HEADER (8) +#define PTR_ICMP_MESSAGE_DU(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_ICMP_MESSAGE_DU (2) +#define PTR_ICMP_MESSAGE_DU_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_ICMP_MESSAGE_DU_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_ICMP_MESSAGE_DU_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define ICMP_MESSAGE_DU_CODE_is_NET GLUE_CAST08(0L) +#define ICMP_MESSAGE_DU_CODE_is_HOST GLUE_CAST08(1L) +#define ICMP_MESSAGE_DU_CODE_is_PROTOCOL GLUE_CAST08(2L) +#define ICMP_MESSAGE_DU_CODE_is_PORT GLUE_CAST08(3L) +#define ICMP_MESSAGE_DU_CODE_is_CANT_FRAGMENT GLUE_CAST08(4L) +#define ICMP_MESSAGE_DU_CODE_is_ROUTE_FAILED GLUE_CAST08(5L) +#define PTR_ICMP_MESSAGE_SQ(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_ICMP_MESSAGE_SQ (2) +#define PTR_ICMP_MESSAGE_SQ_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_ICMP_MESSAGE_SQ_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_ICMP_MESSAGE_SQ_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define ICMP_MESSAGE_SQ_CODE_is_ZERO GLUE_CAST08(0L) +#define PTR_ICMP_MESSAGE_RD(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_ICMP_MESSAGE_RD (8) +#define PTR_ICMP_MESSAGE_RD_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_ICMP_MESSAGE_RD_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_ICMP_MESSAGE_RD_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define ICMP_MESSAGE_RD_CODE_is_NET GLUE_CAST08(0L) +#define ICMP_MESSAGE_RD_CODE_is_HOST GLUE_CAST08(1L) +#define ICMP_MESSAGE_RD_CODE_is_TOS_NET GLUE_CAST08(2L) +#define ICMP_MESSAGE_RD_CODE_is_TOS_HOST GLUE_CAST08(3L) +#define PTR_ICMP_MESSAGE_RD_GATEWAY(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define PTR_ICMP_MESSAGE_TE(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_ICMP_MESSAGE_TE (2) +#define PTR_ICMP_MESSAGE_TE_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_ICMP_MESSAGE_TE_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_ICMP_MESSAGE_TE_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define ICMP_MESSAGE_TE_CODE_is_TTL GLUE_CAST08(0L) +#define ICMP_MESSAGE_TE_CODE_is_REASSEMBLY GLUE_CAST08(1L) +#define PTR_ICMP_MESSAGE_PP(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_ICMP_MESSAGE_PP (5) +#define PTR_ICMP_MESSAGE_PP_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_ICMP_MESSAGE_PP_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_ICMP_MESSAGE_PP_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define ICMP_MESSAGE_PP_CODE_is_ZERO GLUE_CAST08(0L) +#define PTR_ICMP_MESSAGE_PP_POINTER(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_ICMP_MESSAGE_PP_POINTER(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(4)) +#define SET_ICMP_MESSAGE_PP_POINTER(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST08(_V_)) +#define PTR_ICMP_MESSAGE_ECHO(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_ICMP_MESSAGE_ECHO (8) +#define PTR_ICMP_MESSAGE_ECHO_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_ICMP_MESSAGE_ECHO_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_ICMP_MESSAGE_ECHO_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define ICMP_MESSAGE_ECHO_CODE_is_ZERO GLUE_CAST08(0L) +#define PTR_ICMP_MESSAGE_ECHO_DATA(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define SIZEOF_ICMP_MESSAGE_ECHO_DATA (0) +#define PTR_ICMP_MESSAGE_ECHO_DATA_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(8)+(_X0_)) +#define GET_ICMP_MESSAGE_ECHO_DATA_ELT(_P_, _X0_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(8)+(_X0_)) +#define SET_ICMP_MESSAGE_ECHO_DATA_ELT(_P_, _X0_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(8)+(_X0_), GLUE_CAST08(_V_)) +#define PTR_ICMP_MESSAGE_TIMESTAMP(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_ICMP_MESSAGE_TIMESTAMP (20) +#define PTR_ICMP_MESSAGE_TIMESTAMP_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_ICMP_MESSAGE_TIMESTAMP_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_ICMP_MESSAGE_TIMESTAMP_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define ICMP_MESSAGE_TIMESTAMP_CODE_is_ZERO GLUE_CAST08(0L) +#define PTR_ICMP_MESSAGE_TIMESTAMP_ORIGINATE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define GET_ICMP_MESSAGE_TIMESTAMP_ORIGINATE(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(8)) +#define SET_ICMP_MESSAGE_TIMESTAMP_ORIGINATE(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(8), GLUE_CAST32(_V_)) +#define PTR_ICMP_MESSAGE_TIMESTAMP_RECEIVE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(12)) +#define GET_ICMP_MESSAGE_TIMESTAMP_RECEIVE(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(12)) +#define SET_ICMP_MESSAGE_TIMESTAMP_RECEIVE(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(12), GLUE_CAST32(_V_)) +#define PTR_ICMP_MESSAGE_TIMESTAMP_TRANSMIT(_P_)\ + ((GLUE_CAST_PTR(_P_))+(16)) +#define GET_ICMP_MESSAGE_TIMESTAMP_TRANSMIT(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(16)) +#define SET_ICMP_MESSAGE_TIMESTAMP_TRANSMIT(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(16), GLUE_CAST32(_V_)) +#define PTR_ICMP_MESSAGE_INFO(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_ICMP_MESSAGE_INFO (8) +#define PTR_ICMP_MESSAGE_INFO_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_ICMP_MESSAGE_INFO_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_ICMP_MESSAGE_INFO_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define ICMP_MESSAGE_INFO_CODE_is_ZERO GLUE_CAST08(0L) +#define PTR_ICMP_MESSAGE_RS(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_ICMP_MESSAGE_RS (8) +#define PTR_ICMP_MESSAGE_RS_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_ICMP_MESSAGE_RS_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_ICMP_MESSAGE_RS_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define ICMP_MESSAGE_RS_CODE_is_ZERO GLUE_CAST08(0L) +#define PTR_ICMP_MESSAGE_RS_RESERVED(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_ICMP_MESSAGE_RS_RESERVED(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(4)) +#define SET_ICMP_MESSAGE_RS_RESERVED(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST32(_V_)) +#define PTR_ICMP_MESSAGE_RA(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_ICMP_MESSAGE_RA (8) +#define PTR_ICMP_MESSAGE_RA_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_ICMP_MESSAGE_RA_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_ICMP_MESSAGE_RA_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define ICMP_MESSAGE_RA_CODE_is_ZERO GLUE_CAST08(0L) +#define PTR_ICMP_MESSAGE_RA_NUM_ADDRS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_ICMP_MESSAGE_RA_NUM_ADDRS(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(4)) +#define SET_ICMP_MESSAGE_RA_NUM_ADDRS(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST08(_V_)) +#define PTR_ICMP_MESSAGE_RA_ADDR_ENTRY_SIZE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(5)) +#define GET_ICMP_MESSAGE_RA_ADDR_ENTRY_SIZE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(5)) +#define SET_ICMP_MESSAGE_RA_ADDR_ENTRY_SIZE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(5), GLUE_CAST08(_V_)) +#define PTR_ICMP_MESSAGE_RA_LIFETIME(_P_)\ + ((GLUE_CAST_PTR(_P_))+(6)) +#define GET_ICMP_MESSAGE_RA_LIFETIME(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(6)) +#define SET_ICMP_MESSAGE_RA_LIFETIME(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(6), GLUE_CAST16(_V_)) +#define PTR_ICMP_MESSAGE_RA_ENTRY(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define SIZEOF_ICMP_MESSAGE_RA_ENTRY (0) +#define PTR_ICMP_MESSAGE_RA_ENTRY_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(8)+(8)*(_X0_)) +#define SIZEOF_ICMP_MESSAGE_RA_ENTRY_ELT (8) +#define PTR_ICMP_MESSAGE_RA_ENTRY_ELT_ADDRESS(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(8)+(8)*(_X0_)) +#define PTR_ICMP_MESSAGE_RA_ENTRY_ELT_PREFERENCE(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(12)+(8)*(_X0_)) +#define GET_ICMP_MESSAGE_RA_ENTRY_ELT_PREFERENCE(_P_, _X0_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(12)+(8)*(_X0_)) +#define SET_ICMP_MESSAGE_RA_ENTRY_ELT_PREFERENCE(_P_, _X0_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(12)+(8)*(_X0_), GLUE_CAST32(_V_)) + +/* Definitions for IGMP_MESSAGE */ + +#define SIZEOF_IGMP_MESSAGE (8) +/* Can't define PTR_IGMP_MESSAGE_VERSION because: + Size 4 is not a multiple of 8. */ +#define GET_IGMP_MESSAGE_VERSION(_P_)\ + GLUE_CAST08(GLUE_GB08((GLUE_CAST_PTR(_P_))) >> 4) +#define SET_IGMP_MESSAGE_VERSION(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), (GLUE_GB08((GLUE_CAST_PTR(_P_))) & ~GLUE_CAST08(0xF0L)) | ((GLUE_CAST08(_V_) << 4) & GLUE_CAST08(0xF0L))) +/* Can't define PTR_IGMP_MESSAGE_TYPE because: + Size 4 is not a multiple of 8. */ +#define GET_IGMP_MESSAGE_TYPE(_P_)\ + GLUE_CAST08(GLUE_GB08((GLUE_CAST_PTR(_P_))) & GLUE_CAST08(0xFL)) +#define SET_IGMP_MESSAGE_TYPE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), (GLUE_GB08((GLUE_CAST_PTR(_P_))) & ~GLUE_CAST08(0xFL)) | (GLUE_CAST08(_V_) & GLUE_CAST08(0xFL))) +#define IGMP_MESSAGE_TYPE_is_QUERY GLUE_CAST08(1L) +#define IGMP_MESSAGE_TYPE_is_REPORT GLUE_CAST08(2L) +#define PTR_IGMP_MESSAGE_CHECKSUM(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_IGMP_MESSAGE_CHECKSUM(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(2)) +#define SET_IGMP_MESSAGE_CHECKSUM(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST16(_V_)) +#define PTR_IGMP_MESSAGE_GROUP_ADDRESS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) + +/* Definitions for IP_PSEUDO_HEADER */ + +#define SIZEOF_IP_PSEUDO_HEADER (12) +#define PTR_IP_PSEUDO_HEADER_SOURCE_ADDRESS(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define PTR_IP_PSEUDO_HEADER_DESTINATION_ADDRESS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define PTR_IP_PSEUDO_HEADER_PROTOCOL(_P_)\ + ((GLUE_CAST_PTR(_P_))+(9)) +#define GET_IP_PSEUDO_HEADER_PROTOCOL(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(9)) +#define SET_IP_PSEUDO_HEADER_PROTOCOL(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(9), GLUE_CAST08(_V_)) +#define PTR_IP_PSEUDO_HEADER_PAYLOAD_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(10)) +#define GET_IP_PSEUDO_HEADER_PAYLOAD_LENGTH(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(10)) +#define SET_IP_PSEUDO_HEADER_PAYLOAD_LENGTH(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(10), GLUE_CAST16(_V_)) + +/* Definitions for IP_HEADER */ + +#define SIZEOF_IP_HEADER (20) +/* Can't define PTR_IP_HEADER_VERSION because: + Size 4 is not a multiple of 8. */ +#define GET_IP_HEADER_VERSION(_P_)\ + GLUE_CAST08(GLUE_GB08((GLUE_CAST_PTR(_P_))) >> 4) +#define SET_IP_HEADER_VERSION(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), (GLUE_GB08((GLUE_CAST_PTR(_P_))) & ~GLUE_CAST08(0xF0L)) | ((GLUE_CAST08(_V_) << 4) & GLUE_CAST08(0xF0L))) +#define IP_HEADER_VERSION_is_IPV4 GLUE_CAST08(4L) +#define IP_HEADER_VERSION_is_IPV6 GLUE_CAST08(6L) +/* Can't define PTR_IP_HEADER_HEADER_LENGTH because: + Size 4 is not a multiple of 8. */ +#define GET_IP_HEADER_HEADER_LENGTH(_P_)\ + GLUE_CAST08(GLUE_GB08((GLUE_CAST_PTR(_P_))) & GLUE_CAST08(0xFL)) +#define SET_IP_HEADER_HEADER_LENGTH(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), (GLUE_GB08((GLUE_CAST_PTR(_P_))) & ~GLUE_CAST08(0xFL)) | (GLUE_CAST08(_V_) & GLUE_CAST08(0xFL))) +#define PTR_IP_HEADER_TYPE_OF_SERVICE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_IP_HEADER_TYPE_OF_SERVICE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_IP_HEADER_TYPE_OF_SERVICE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define PTR_IP_HEADER_TOTAL_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_IP_HEADER_TOTAL_LENGTH(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(2)) +#define SET_IP_HEADER_TOTAL_LENGTH(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST16(_V_)) +#define PTR_IP_HEADER_IDENTIFICATION(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_IP_HEADER_IDENTIFICATION(_P_)\ + GLUE_GU16((GLUE_CAST_PTR(_P_))+(4)) +#define SET_IP_HEADER_IDENTIFICATION(_P_, _V_)\ + GLUE_SU16((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST16(_V_)) +#define PTR_IP_HEADER_FRAGMENT(_P_)\ + ((GLUE_CAST_PTR(_P_))+(6)) +#define SIZEOF_IP_HEADER_FRAGMENT (2) +/* Can't define PTR_IP_HEADER_FRAGMENT_DONT because: + Size 1 is not a multiple of 8. */ +#define GET_IP_HEADER_FRAGMENT_DONT(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(6)) & GLUE_CAST08(0x40L)) +#define SET_IP_HEADER_FRAGMENT_DONT(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(6), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(6)) | GLUE_CAST08(0x40L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(6)) & ~GLUE_CAST08(0x40L))) +/* Can't define PTR_IP_HEADER_FRAGMENT_MORE because: + Size 1 is not a multiple of 8. */ +#define GET_IP_HEADER_FRAGMENT_MORE(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(6)) & GLUE_CAST08(0x20L)) +#define SET_IP_HEADER_FRAGMENT_MORE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(6), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(6)) | GLUE_CAST08(0x20L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(6)) & ~GLUE_CAST08(0x20L))) +/* Can't define PTR_IP_HEADER_FRAGMENT_OFFSET because: + Size 13 is not a multiple of 8. */ +#define GET_IP_HEADER_FRAGMENT_OFFSET(_P_)\ + GLUE_CAST16(GLUE_GB16((GLUE_CAST_PTR(_P_))+(6)) & GLUE_CAST16(0x1FFFL)) +#define SET_IP_HEADER_FRAGMENT_OFFSET(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(6), (GLUE_GB16((GLUE_CAST_PTR(_P_))+(6)) & ~GLUE_CAST16(0x1FFFL)) | (GLUE_CAST16(_V_) & GLUE_CAST16(0x1FFFL))) +#define PTR_IP_HEADER_TIME_TO_LIVE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define GET_IP_HEADER_TIME_TO_LIVE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(8)) +#define SET_IP_HEADER_TIME_TO_LIVE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(8), GLUE_CAST08(_V_)) +#define PTR_IP_HEADER_PROTOCOL(_P_)\ + ((GLUE_CAST_PTR(_P_))+(9)) +#define GET_IP_HEADER_PROTOCOL(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(9)) +#define SET_IP_HEADER_PROTOCOL(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(9), GLUE_CAST08(_V_)) +#define PTR_IP_HEADER_HEADER_CHECKSUM(_P_)\ + ((GLUE_CAST_PTR(_P_))+(10)) +#define GET_IP_HEADER_HEADER_CHECKSUM(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(10)) +#define SET_IP_HEADER_HEADER_CHECKSUM(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(10), GLUE_CAST16(_V_)) +#define PTR_IP_HEADER_SOURCE_ADDRESS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(12)) +#define PTR_IP_HEADER_DESTINATION_ADDRESS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(16)) +#define PTR_IP_HEADER_OPTIONS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(20)) +#define SIZEOF_IP_HEADER_OPTIONS (0) +#define PTR_IP_HEADER_OPTIONS_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(20)+(_X0_)) +#define GET_IP_HEADER_OPTIONS_ELT(_P_, _X0_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(20)+(_X0_)) +#define SET_IP_HEADER_OPTIONS_ELT(_P_, _X0_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(20)+(_X0_), GLUE_CAST08(_V_)) +#define IP_HEADER_OPTIONS_ELT_is_END GLUE_CAST08(0L) +#define IP_HEADER_OPTIONS_ELT_is_NOOP GLUE_CAST08(1L) +#define IP_HEADER_OPTIONS_ELT_is_RECORD_ROUTE GLUE_CAST08(7L) +#define IP_HEADER_OPTIONS_ELT_is_TIMESTAMP GLUE_CAST08(68L) +#define IP_HEADER_OPTIONS_ELT_is_SECURITY GLUE_CAST08(130L) +#define IP_HEADER_OPTIONS_ELT_is_LSRR GLUE_CAST08(131L) +#define IP_HEADER_OPTIONS_ELT_is_STREAM_ID GLUE_CAST08(136L) +#define IP_HEADER_OPTIONS_ELT_is_SSRR GLUE_CAST08(137L) + +/* Definitions for IP4_TYPE_OF_SERVICE */ + +#define SIZEOF_IP4_TYPE_OF_SERVICE (1) +/* Can't define PTR_IP4_TYPE_OF_SERVICE_PRECEDENCE because: + Size 3 is not a multiple of 8. */ +#define GET_IP4_TYPE_OF_SERVICE_PRECEDENCE(_P_)\ + GLUE_CAST08(GLUE_GB08((GLUE_CAST_PTR(_P_))) >> 5) +#define SET_IP4_TYPE_OF_SERVICE_PRECEDENCE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), (GLUE_GB08((GLUE_CAST_PTR(_P_))) & ~GLUE_CAST08(0xE0L)) | ((GLUE_CAST08(_V_) << 5) & GLUE_CAST08(0xE0L))) +/* Can't define PTR_IP4_TYPE_OF_SERVICE_LOW_DELAY because: + Size 1 is not a multiple of 8. */ +#define GET_IP4_TYPE_OF_SERVICE_LOW_DELAY(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))) & GLUE_CAST08(0x10L)) +#define SET_IP4_TYPE_OF_SERVICE_LOW_DELAY(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))) | GLUE_CAST08(0x10L) : GLUE_GB08((GLUE_CAST_PTR(_P_))) & ~GLUE_CAST08(0x10L))) +/* Can't define PTR_IP4_TYPE_OF_SERVICE_HIGH_THROUGHPUT because: + Size 1 is not a multiple of 8. */ +#define GET_IP4_TYPE_OF_SERVICE_HIGH_THROUGHPUT(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))) & GLUE_CAST08(0x8L)) +#define SET_IP4_TYPE_OF_SERVICE_HIGH_THROUGHPUT(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))) | GLUE_CAST08(0x8L) : GLUE_GB08((GLUE_CAST_PTR(_P_))) & ~GLUE_CAST08(0x8L))) +/* Can't define PTR_IP4_TYPE_OF_SERVICE_HIGH_RELIABILITY because: + Size 1 is not a multiple of 8. */ +#define GET_IP4_TYPE_OF_SERVICE_HIGH_RELIABILITY(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))) & GLUE_CAST08(0x4L)) +#define SET_IP4_TYPE_OF_SERVICE_HIGH_RELIABILITY(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))) | GLUE_CAST08(0x4L) : GLUE_GB08((GLUE_CAST_PTR(_P_))) & ~GLUE_CAST08(0x4L))) + +/* Definitions for IP_PORT */ + +#define SIZEOF_IP_PORT (2) +#define PTR_IP_PORT_NUMBER(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_IP_PORT_NUMBER(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))) +#define SET_IP_PORT_NUMBER(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_)), GLUE_CAST16(_V_)) +#define PTR_IP_PORT_OPAQUE(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_IP_PORT_OPAQUE(_P_)\ + GLUE_GU16((GLUE_CAST_PTR(_P_))) +#define SET_IP_PORT_OPAQUE(_P_, _V_)\ + GLUE_SU16((GLUE_CAST_PTR(_P_)), GLUE_CAST16(_V_)) +#define IP_PORT_OPAQUE_is_ECHO GLUE_OPAQUE16(GLUE_CAST16(7L)) +#define IP_PORT_OPAQUE_is_DISCARD GLUE_OPAQUE16(GLUE_CAST16(9L)) +#define IP_PORT_OPAQUE_is_USERS GLUE_OPAQUE16(GLUE_CAST16(11L)) +#define IP_PORT_OPAQUE_is_DAYTIME GLUE_OPAQUE16(GLUE_CAST16(13L)) +#define IP_PORT_OPAQUE_is_QUOTE GLUE_OPAQUE16(GLUE_CAST16(17L)) +#define IP_PORT_OPAQUE_is_FTP GLUE_OPAQUE16(GLUE_CAST16(21L)) +#define IP_PORT_OPAQUE_is_SSH GLUE_OPAQUE16(GLUE_CAST16(22L)) +#define IP_PORT_OPAQUE_is_TELNET GLUE_OPAQUE16(GLUE_CAST16(23L)) +#define IP_PORT_OPAQUE_is_SMTP GLUE_OPAQUE16(GLUE_CAST16(25L)) +#define IP_PORT_OPAQUE_is_TIME GLUE_OPAQUE16(GLUE_CAST16(37L)) +#define IP_PORT_OPAQUE_is_DOMAIN GLUE_OPAQUE16(GLUE_CAST16(53L)) +#define IP_PORT_OPAQUE_is_TFTP GLUE_OPAQUE16(GLUE_CAST16(69L)) +#define IP_PORT_OPAQUE_is_GOPHER GLUE_OPAQUE16(GLUE_CAST16(70L)) +#define IP_PORT_OPAQUE_is_FINGER GLUE_OPAQUE16(GLUE_CAST16(79L)) +#define IP_PORT_OPAQUE_is_WWW GLUE_OPAQUE16(GLUE_CAST16(80L)) +#define IP_PORT_OPAQUE_is_SUPDUP GLUE_OPAQUE16(GLUE_CAST16(95L)) +#define IP_PORT_OPAQUE_is_SUNRPC GLUE_OPAQUE16(GLUE_CAST16(111L)) +#define IP_PORT_OPAQUE_is_NNTP GLUE_OPAQUE16(GLUE_CAST16(119L)) +#define IP_PORT_OPAQUE_is_NTP GLUE_OPAQUE16(GLUE_CAST16(123L)) +#define IP_PORT_OPAQUE_is_IMAP2 GLUE_OPAQUE16(GLUE_CAST16(143L)) +#define IP_PORT_OPAQUE_is_PCMAIL GLUE_OPAQUE16(GLUE_CAST16(158L)) +#define IP_PORT_OPAQUE_is_SNMP GLUE_OPAQUE16(GLUE_CAST16(161L)) +#define IP_PORT_OPAQUE_is_SNMP_TRAP GLUE_OPAQUE16(GLUE_CAST16(162L)) +#define IP_PORT_OPAQUE_is_BGP GLUE_OPAQUE16(GLUE_CAST16(179L)) +#define IP_PORT_OPAQUE_is_SMUX GLUE_OPAQUE16(GLUE_CAST16(199L)) +#define IP_PORT_OPAQUE_is_IMAP3 GLUE_OPAQUE16(GLUE_CAST16(220L)) +#define IP_PORT_OPAQUE_is_BSD_TCP_EXEC GLUE_OPAQUE16(GLUE_CAST16(512L)) +#define IP_PORT_OPAQUE_is_BSD_UDP_BIFF GLUE_OPAQUE16(GLUE_CAST16(512L)) +#define IP_PORT_OPAQUE_is_BSD_TCP_LOGIN GLUE_OPAQUE16(GLUE_CAST16(513L)) +#define IP_PORT_OPAQUE_is_BSD_UDP_WHO GLUE_OPAQUE16(GLUE_CAST16(513L)) +#define IP_PORT_OPAQUE_is_BSD_TCP_SHELL GLUE_OPAQUE16(GLUE_CAST16(514L)) +#define IP_PORT_OPAQUE_is_BSD_UDP_SYSLOG GLUE_OPAQUE16(GLUE_CAST16(514L)) +#define IP_PORT_OPAQUE_is_BSD_PRINTER GLUE_OPAQUE16(GLUE_CAST16(515L)) +#define IP_PORT_OPAQUE_is_BSD_TALK GLUE_OPAQUE16(GLUE_CAST16(517L)) +#define IP_PORT_OPAQUE_is_BSD_NTALK GLUE_OPAQUE16(GLUE_CAST16(518L)) +#define IP_PORT_OPAQUE_is_RIP GLUE_OPAQUE16(GLUE_CAST16(520L)) +#define IP_PORT_OPAQUE_is_BSD_TIMED GLUE_OPAQUE16(GLUE_CAST16(525L)) +#define IP_PORT_OPAQUE_is_BSD_TEMPO GLUE_OPAQUE16(GLUE_CAST16(526L)) +#define IP_PORT_OPAQUE_is_BSD_COURIER GLUE_OPAQUE16(GLUE_CAST16(530L)) +#define IP_PORT_OPAQUE_is_BSD_CONFERENCE GLUE_OPAQUE16(GLUE_CAST16(531L)) +#define IP_PORT_OPAQUE_is_BSD_NETNEWS GLUE_OPAQUE16(GLUE_CAST16(532L)) +#define IP_PORT_OPAQUE_is_BSD_NETWALL GLUE_OPAQUE16(GLUE_CAST16(533L)) +#define IP_PORT_OPAQUE_is_BSD_UUCP GLUE_OPAQUE16(GLUE_CAST16(540L)) +#define IP_PORT_OPAQUE_is_KLOGIN GLUE_OPAQUE16(GLUE_CAST16(543L)) +#define IP_PORT_OPAQUE_is_KSHELL GLUE_OPAQUE16(GLUE_CAST16(544L)) +#define IP_PORT_OPAQUE_is_BSD_REMOTEFS GLUE_OPAQUE16(GLUE_CAST16(556L)) +#define IP_PORT_OPAQUE_is_KERBEROS_ADM GLUE_OPAQUE16(GLUE_CAST16(749L)) +#define IP_PORT_OPAQUE_is_WEBSTER GLUE_OPAQUE16(GLUE_CAST16(765L)) + +/* Definitions for IP_ADDRESS */ + +#define SIZEOF_IP_ADDRESS (4) +#define PTR_IP_ADDRESS_BYTES(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_IP_ADDRESS_BYTES (4) +#define PTR_IP_ADDRESS_BYTES_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(_X0_)) +#define GET_IP_ADDRESS_BYTES_ELT(_P_, _X0_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(_X0_)) +#define SET_IP_ADDRESS_BYTES_ELT(_P_, _X0_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(_X0_), GLUE_CAST08(_V_)) +#define PTR_IP_ADDRESS_NUMBER(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_IP_ADDRESS_NUMBER(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))) +#define SET_IP_ADDRESS_NUMBER(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_)), GLUE_CAST32(_V_)) +#define PTR_IP_ADDRESS_OPAQUE(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_IP_ADDRESS_OPAQUE(_P_)\ + GLUE_GU32((GLUE_CAST_PTR(_P_))) +#define SET_IP_ADDRESS_OPAQUE(_P_, _V_)\ + GLUE_SU32((GLUE_CAST_PTR(_P_)), GLUE_CAST32(_V_)) + +/* Definitions for IP_PROTOCOL */ + +#define SIZEOF_IP_PROTOCOL (1) +#define GET_IP_PROTOCOL(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_IP_PROTOCOL(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define IP_PROTOCOL_is_HOP_BY_HOP_OPTIONS GLUE_CAST08(0L) +#define IP_PROTOCOL_is_ICMP GLUE_CAST08(1L) +#define IP_PROTOCOL_is_IGMP GLUE_CAST08(2L) +#define IP_PROTOCOL_is_IPV4 GLUE_CAST08(4L) +#define IP_PROTOCOL_is_TCP GLUE_CAST08(6L) +#define IP_PROTOCOL_is_UDP GLUE_CAST08(17L) +#define IP_PROTOCOL_is_IPV6 GLUE_CAST08(41L) +#define IP_PROTOCOL_is_ROUTING GLUE_CAST08(43L) +#define IP_PROTOCOL_is_FRAGMENT GLUE_CAST08(44L) +#define IP_PROTOCOL_is_ESP GLUE_CAST08(50L) +#define IP_PROTOCOL_is_AUTHENTICATION GLUE_CAST08(51L) +#define IP_PROTOCOL_is_ICMPV6 GLUE_CAST08(58L) +#define IP_PROTOCOL_is_NO_NEXT GLUE_CAST08(59L) +#define IP_PROTOCOL_is_DESTINATION_OPTIONS GLUE_CAST08(60L) +#define IP_PROTOCOL_is_OSPF GLUE_CAST08(89L) + +#endif /* EPILOGUE_LAYOUT_IP_H */ diff --git a/h/wrn/wm/util/layout/ip.ldb b/h/wrn/wm/util/layout/ip.ldb new file mode 100644 index 0000000..cc9b40d --- /dev/null +++ b/h/wrn/wm/util/layout/ip.ldb @@ -0,0 +1,447 @@ +; $Header: /usr/cvsroot/target/h/wrn/wm/util/layout/ip.ldb,v 1.1.1.1 2001/11/05 17:47:20 tneale Exp $ +; Layout information for IP protocols + +;**************************************************************************** +; +; *** Restricted Rights Legend *** +; +; The programs and information contained herein are licensed only +; pursuant to a license agreement that contains use, reverse +; engineering, disclosure, and other restrictions; accordingly, it +; is "Unpublished--all rights reserved under the applicable +; copyright laws". +; +; Use duplication, or disclosure by the Government is subject to +; restrictions as set forth in subparagraph (c)(1)(ii) of the Rights +; in Technical Data and Computer Licensed Programs clause of DFARS +; 52.227 7013. +; +; Copyright 2000-2001 Wind River Systems, Inc. +; Copyright 1995-1997 Epilogue Technology Corporation. +; Copyright 1998 Integrated Systems, Inc. +; All rights reserved. +; +; *** Government Use *** +; +; The Licensed Programs and their documentation were developed at +; private expense and no part of them is in the public domain. +; +; The Licensed Programs are "Restricted Computer Software" as that +; term is defined in Clause 52.227-19 of the Federal Acquisition +; Regulations (FAR) and are "Commercial Computer Software" as that +; term is defined in Subpart 227.401 of the Department of Defense +; Federal Acquisition Regulation Supplement (DFARS). +; +; (i) If the licensed Programs are supplied to the Department of +; Defense (DoD), the Licensed Programs are classified as +; "Commercial Computer Software" and the Government is acquiring +; only "restricted rights" in the Licensed Programs and their +; documentation as that term is defined in Clause 52.227 +; 7013(c)(1) of the DFARS, and +; +; (ii) If the Licensed Programs are supplied to any unit or agency +; of the United States Government other than DoD, the +; Government's rights in the Licensed Programs and their +; documentation will be as defined in Clause 52.227-19(c)(2) of +; the FAR. +;**************************************************************************** + +; $Log: ip.ldb,v $ +; Revision 1.1.1.1 2001/11/05 17:47:20 tneale +; Tornado shuffle +; +; Revision 1.19 2001/01/19 22:22:33 paul +; Update copyright. +; +; Revision 1.18 1999/10/19 20:12:43 sar +; Update ip and ip6 files with ip6 information +; +; Revision 1.17 1998/02/25 15:21:40 sra +; Finish moving types.h, bug.h, and bugdef.h to common/h/. +; +; Revision 1.16 1998/02/25 04:53:59 sra +; Update copyrights. +; +; Revision 1.15 1998/02/20 04:02:37 sra +; Fix too-long layout macro names. +; +; Revision 1.14 1998/01/20 23:03:23 mrf +; Added IP_PROTOCOL_is_IPV4 definition for tunnels +; +; Revision 1.13 1997/09/26 20:21:15 alan +; Use features of new layout compiler: `use-layouts' and `C-include'. +; +; Revision 1.12 1997/09/13 03:11:58 alan +; Add IGMP_MESSAGE, and ICMP messages of type Router Solicitation and +; Router Advertisement. +; +; Revision 1.11 1997/06/04 05:46:25 alan +; Fix RCS keywords. +; +; Revision 1.10 1997/06/03 22:59:34 alan +; Use `define-rcs-info'. +; +; Revision 1.9 1997/05/28 05:13:51 alan +; Fix ICMP layouts so that they no longer use internal unions. This makes +; the size of the variants be what people expect. +; +; Revision 1.8 1997/05/21 07:15:30 alan +; Split out IP4_TYPE_OF_SERVICE. +; +; Revision 1.7 1997/05/17 06:43:54 alan +; Add some more values to IP_PROTOCOL. +; +; Revision 1.6 1997/05/15 00:39:23 alan +; Generate: SIZEOF_ICMP_MESSAGE_MINIMUM_HEADER. +; +; Revision 1.5 1997/05/12 23:39:57 alan +; Add definitions: TCP_OPTION_HEADER and TCP_OPTION_MSS. +; +; Revision 1.4 1997/05/12 21:14:14 alan +; Add definition for `IP_PSEUDO_HEADER'. +; +; Revision 1.3 1997/04/22 21:06:02 alan +; Add BGP to IP_PORT enumeration. +; +; Revision 1.2 1997/04/22 00:08:57 alan +; Fix copyright. +; Update IP port numbers. +; +; Revision 1.1 1997/04/19 04:12:15 alan +; Move all .ldb files into the `layout' directory. +; +; Revision 1.6 1996/12/03 07:52:12 alan +; Some changes for IPv6. +; +; Revision 1.5 1995/08/19 06:22:50 alan +; Allow getting IP address as a number. +; +; Revision 1.4 1995/06/28 23:57:03 alan +; Add some more port numbers +; +; Revision 1.3 1995/06/04 18:35:38 alan +; Fix typo +; +; Revision 1.2 1995/05/25 23:53:33 alan +; Some enums have a `base' attribute -- some other tweaking. +; +; Revision 1.1 1995/05/23 07:17:19 alan +; Basic network layouts. + +(define-rcs-info "$Id: ip.ldb,v 1.1.1.1 2001/11/05 17:47:20 tneale Exp $") + +(C-include EPILOGUE_INSTALL_H ) +(C-include EPILOGUE_TYPES_H ) +(C-include EPILOGUE_LAYOUT_LDBGLUE_H ) + +(define-layout IP_PROTOCOL + (enum (type (unsigned 8)) + (value HOP_BY_HOP_OPTIONS 0) ; v6 + (value ICMP 1) + (value IGMP 2) + (value IPV4 4) + (value TCP 6) + (value UDP 17) + (value IPV6 41) + (value ROUTING 43) ; v6 + (value FRAGMENT 44) ; v6 + (value ESP 50) ; "Encapsulating Secure Payload" + (value AUTHENTICATION 51) + (value ICMPV6 58) ; v6 + (value NO_NEXT 59) ; v6 + (value DESTINATION_OPTIONS 60) ; v6 + (value OSPF 89) + )) + +(define-layout IP_ADDRESS + (union (size (* 4 8)) + (field BYTES (array (count 4) (type (unsigned 8)))) + (field NUMBER (unsigned (* 4 8))) + (field OPAQUE (opaque (* 4 8))))) + +(define-layout IP_PORT + (union (size 16) + (field NUMBER (unsigned 16)) + (field OPAQUE (enum (type (opaque 16)) + (value ECHO 7) + (value DISCARD 9) + (value USERS 11) + (value DAYTIME 13) + (value QUOTE 17) + (value FTP 21) + (value SSH 22) + (value TELNET 23) + (value SMTP 25) + (value TIME 37) + (value DOMAIN 53) + (value TFTP 69) + (value GOPHER 70) + (value FINGER 79) + (value WWW 80) + (value SUPDUP 95) + (value SUNRPC 111) + (value NNTP 119) + (value NTP 123) + (value IMAP2 143) + (value PCMAIL 158) + (value SNMP 161) + (value SNMP_TRAP 162) + (value BGP 179) + (value SMUX 199) + (value IMAP3 220) + (value BSD_TCP_EXEC 512) + (value BSD_UDP_BIFF 512) + (value BSD_TCP_LOGIN 513) + (value BSD_UDP_WHO 513) + (value BSD_TCP_SHELL 514) + (value BSD_UDP_SYSLOG 514) + (value BSD_PRINTER 515) + (value BSD_TALK 517) + (value BSD_NTALK 518) + (value RIP 520) + (value BSD_TIMED 525) + (value BSD_TEMPO 526) + (value BSD_COURIER 530) + (value BSD_CONFERENCE 531) + (value BSD_NETNEWS 532) + (value BSD_NETWALL 533) + (value BSD_UUCP 540) + (value BSD_REMOTEFS 556) + (value KLOGIN 543) + (value KSHELL 544) + (value KERBEROS_ADM 749) + (value WEBSTER 765))))) + +(define-layout IP4_TYPE_OF_SERVICE + (struct (size 8) + (align 1) + (field PRECEDENCE (unsigned 3)) + (field LOW_DELAY (boolean 1)) + (field HIGH_THROUGHPUT (boolean 1)) + (field HIGH_RELIABILITY (boolean 1)) + (fill 2) ; MBZ + )) + +(define-layout IP_HEADER + (struct (size (* 5 32)) ; error check + (struct (align 4) + (field VERSION + (enum (type (unsigned 4)) + (value IPV4 4) + (value IPV6 6))) + (field HEADER_LENGTH (unsigned 4))) + (field TYPE_OF_SERVICE (unsigned (sizeof IP4_TYPE_OF_SERVICE))) + (field TOTAL_LENGTH (unsigned 16)) + (field IDENTIFICATION (opaque 16)) + (field FRAGMENT + (struct (size 16) ; error check + (align 1) + (fill 1) ; MBZ + (field DONT (boolean 1)) + (field MORE (boolean 1)) + (field OFFSET (unsigned 13)))) + (field TIME_TO_LIVE (unsigned 8)) + (field PROTOCOL IP_PROTOCOL) + (field HEADER_CHECKSUM (unsigned 16)) + (field SOURCE_ADDRESS IP_ADDRESS) + (field DESTINATION_ADDRESS IP_ADDRESS) + (field OPTIONS + (array (count 0) + (type (enum (type (unsigned 8)) ; + (value END 0) ; 1 + (value NOOP 1) ; 1 + (value SECURITY 130) ; 11 + (value LSRR 131) + (value SSRR 137) + (value RECORD_ROUTE 7) + (value STREAM_ID 136) ; 4 + (value TIMESTAMP 68) + )))) + )) + +(define-layout IP_PSEUDO_HEADER + ;; for computing UDP or TCP checksums + (struct (size (* 3 32)) + (field SOURCE_ADDRESS IP_ADDRESS) + (field DESTINATION_ADDRESS IP_ADDRESS) + (fill 8) ; MBZ + (field PROTOCOL IP_PROTOCOL) + (field PAYLOAD_LENGTH (unsigned 16)))) + +(define-layout IGMP_MESSAGE + (struct (size (* 2 32)) ; error check + (struct (align 4) + (field VERSION (unsigned 4)) + (field TYPE (enum (type (unsigned 4)) + (value QUERY 1) + (value REPORT 2)))) + (fill 8) ; MBZ + (field CHECKSUM (unsigned 16)) + (field GROUP_ADDRESS IP_ADDRESS) + )) + +(define-layout ICMP_MESSAGE + (union (struct ;; Many ICMP messages share these fields: + (field TYPE (enum (type (unsigned 8)) + (value ECHO_REPLY 0) + (value DESTINATION_UNREACHABLE 3) + (value SOURCE_QUENCH 4) + (value REDIRECT 5) + (value ECHO 8) + (value ROUTER_ADVERTISEMENT 9) + (value ROUTER_SOLICITATION 10) + (value TIME_EXCEEDED 11) + (value PARAMETER_PROBLEM 12) + (value TIMESTAMP 13) + (value TIMESTAMP_REPLY 14) + (value INFO_REQUEST 15) + (value INFO_REPLY 16) + )) + (fill 8) ; the CODE + (field CHECKSUM (unsigned 16)) ; always + (field IDENTIFICATION (opaque 16)) ; sometimes + (field SEQUENCE_NUMBER (unsigned 16)) ; sometimes + (field HEADER IP_HEADER) ; sometimes + ) + + ;; Usefull size to know + (field MINIMUM_HEADER (struct (size (* 8 8)) ; error check + (fill 8) ; TYPE + (fill 8) ; CODE + (fill 16) ; CHECKSUM + (fill 16) ; IDENTIFICATION + (fill 16) ; SEQUENCE_NUMBER + )) + + ;; Destination Unreachable Message + (field DU (struct (fill 8) ; the TYPE + (field CODE (enum (type (unsigned 8)) + (value NET 0) + (value HOST 1) + (value PROTOCOL 2) + (value PORT 3) + (value CANT_FRAGMENT 4) + (value ROUTE_FAILED 5))) + ;; contains a datagram + )) + ;; Source Quench Message: + (field SQ (struct (fill 8) ; the TYPE + (field CODE (enum (type (unsigned 8)) + (value ZERO 0))) + ;; contains a datagram + )) + ;; Redirect Message: + (field RD (struct (fill 8) ; the TYPE + (field CODE (enum (type (unsigned 8)) + (value NET 0) + (value HOST 1) + (value TOS_NET 2) + (value TOS_HOST 3))) + (fill 16) ; checksum + (field GATEWAY IP_ADDRESS) + ;; contains a datagram + )) + ;; Time Exceeded Message: + (field TE (struct (fill 8) ; the TYPE + (field CODE (enum (type (unsigned 8)) + (value TTL 0) + (value REASSEMBLY 1))) + ;; contains a datagram + )) + ;; Parameter Problem Message: + (field PP (struct (fill 8) ; the TYPE + (field CODE (enum (type (unsigned 8)) + (value ZERO 0))) + (fill 16) ; checksum + (field POINTER (unsigned 8)) + ;; contains a datagram + )) + ;; Echo or Echo Reply Message: + (field ECHO (struct (fill 8) ; the TYPE + (field CODE (enum (type (unsigned 8)) + (value ZERO 0))) + (fill 48) ; checksum+ident+sequence + (field DATA (array (count 0) + (type (unsigned 8)))))) + ;; Timestamp or Timestamp Reply Message: + (field TIMESTAMP (struct (fill 8) ; the TYPE + (field CODE (enum (type (unsigned 8)) + (value ZERO 0))) + (fill 48) ; checksum+ident+sequence + (field ORIGINATE (unsigned 32)) + (field RECEIVE (unsigned 32)) + (field TRANSMIT (unsigned 32)))) + ;; Information Request or Information Reply Message: + (field INFO (struct (fill 8) ; the TYPE + (field CODE (enum (type (unsigned 8)) + (value ZERO 0))) + (fill 48) ; checksum+ident+sequence + )) + ;; Router Solicitation Message: + (field RS (struct (fill 8) ; the TYPE + (field CODE (enum (type (unsigned 8)) + (value ZERO 0))) + (fill 16) ; checksum + (field RESERVED (unsigned 32)))) + ;; Router Advertisement Message: + (field RA (struct (fill 8) ; the TYPE + (field CODE (enum (type (unsigned 8)) + (value ZERO 0))) + (fill 16) ; checksum + (field NUM_ADDRS (unsigned 8)) + (field ADDR_ENTRY_SIZE (unsigned 8)) + (field LIFETIME (unsigned 16)) + (field ENTRY + (array (count 0) + (type (struct (field ADDRESS + IP_ADDRESS) + (field PREFERENCE + (unsigned 32)) + )))) + )) + )) + +(define-layout UDP_HEADER + (struct (size (* 2 32)) ; error check + (field SOURCE_PORT IP_PORT) + (field DESTINATION_PORT IP_PORT) + (field LENGTH (unsigned 16)) + (field CHECKSUM (unsigned 16)))) + +(define-layout TCP_HEADER + (struct (size (* 5 32)) ; error check + (field SOURCE_PORT IP_PORT) + (field DESTINATION_PORT IP_PORT) + (field SEQUENCE_NUMBER (unsigned 32)) + (field ACKNOWLEDGE_NUMBER (unsigned 32)) + (struct (size 16) ; error check + (align 1) + (field DATA_OFFSET (unsigned 4)) + (fill 6) + (field URG (boolean 1)) + (field ACK (boolean 1)) + (field PSH (boolean 1)) + (field RST (boolean 1)) + (field SYN (boolean 1)) + (field FIN (boolean 1))) + (field WINDOW (unsigned 16)) + (field CHECKSUM (unsigned 16)) + (field URGENT_POINTER (unsigned 16)) + (field OPTIONS (struct (size 0))) + )) + +(define-layout TCP_OPTION_HEADER + (struct (field KIND (enum (type (unsigned 8)) ; + (value END 0) ; 1 + (value NOOP 1) ; 1 + (value MSS 2) ; 4 + )) + (field LENGTH (unsigned 8)))) + +(define-layout TCP_OPTION_MSS + (struct (fill (sizeof TCP_OPTION_HEADER)) + (field SIZE (unsigned 16)))) + +; Local Variables: +; mode: Scheme +; End: diff --git a/h/wrn/wm/util/layout/ip6.h b/h/wrn/wm/util/layout/ip6.h new file mode 100644 index 0000000..f7dd572 --- /dev/null +++ b/h/wrn/wm/util/layout/ip6.h @@ -0,0 +1,637 @@ +/* This file was automatically generated by Epilogue Technology's + * network datastructure layout tool. + * + * DO NOT MODIFY THIS FILE BY HAND. + * + * Source file information: + * Id: ip6.ldb,v 1.13 2000/12/02 20:22:20 sar Exp + * --used -- + * Id: ip.ldb,v 1.18 1999/10/19 20:12:43 sar Exp + */ + +#ifndef EPILOGUE_LAYOUT_IP6_H +#define EPILOGUE_LAYOUT_IP6_H + +#ifndef EPILOGUE_INSTALL_H +#include +#endif +#ifndef EPILOGUE_TYPES_H +#include +#endif +#ifndef EPILOGUE_LAYOUT_LDBGLUE_H +#include +#endif + +/* Definitions for IP6_ND_OPT */ + +#define SIZEOF_IP6_ND_OPT (48) +#define PTR_IP6_ND_OPT_TYPE(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_IP6_ND_OPT_TYPE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_IP6_ND_OPT_TYPE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define IP6_ND_OPT_TYPE_is_SOURCE_LINK_LAYER_ADDRESS GLUE_CAST08(1L) +#define IP6_ND_OPT_TYPE_is_TARGET_LINK_LAYER_ADDRESS GLUE_CAST08(2L) +#define IP6_ND_OPT_TYPE_is_PREFIX_INFORMATION GLUE_CAST08(3L) +#define IP6_ND_OPT_TYPE_is_REDIRECTED_HEADER GLUE_CAST08(4L) +#define IP6_ND_OPT_TYPE_is_MTU GLUE_CAST08(5L) +#define PTR_IP6_ND_OPT_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_IP6_ND_OPT_LENGTH(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_IP6_ND_OPT_LENGTH(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define PTR_IP6_ND_OPT_LINK_LAYER(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_IP6_ND_OPT_LINK_LAYER (2) +#define PTR_IP6_ND_OPT_LINK_LAYER_ADDR(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define SIZEOF_IP6_ND_OPT_LINK_LAYER_ADDR (0) +#define PTR_IP6_ND_OPT_LINK_LAYER_ADDR_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(2)+(_X0_)) +#define GET_IP6_ND_OPT_LINK_LAYER_ADDR_ELT(_P_, _X0_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)+(_X0_)) +#define SET_IP6_ND_OPT_LINK_LAYER_ADDR_ELT(_P_, _X0_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(2)+(_X0_), GLUE_CAST08(_V_)) +#define PTR_IP6_ND_OPT_PREFIX(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_IP6_ND_OPT_PREFIX (32) +#define PTR_IP6_ND_OPT_PREFIX_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_IP6_ND_OPT_PREFIX_LENGTH(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) +#define SET_IP6_ND_OPT_PREFIX_LENGTH(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST08(_V_)) +/* Can't define PTR_IP6_ND_OPT_PREFIX_ON_LINK_P because: + Size 1 is not a multiple of 8. */ +#define GET_IP6_ND_OPT_PREFIX_ON_LINK_P(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(3)) & GLUE_CAST08(0x80L)) +#define SET_IP6_ND_OPT_PREFIX_ON_LINK_P(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(3), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(3)) | GLUE_CAST08(0x80L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(3)) & ~GLUE_CAST08(0x80L))) +/* Can't define PTR_IP6_ND_OPT_PREFIX_AUTONOMOUS_P because: + Size 1 is not a multiple of 8. */ +#define GET_IP6_ND_OPT_PREFIX_AUTONOMOUS_P(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(3)) & GLUE_CAST08(0x40L)) +#define SET_IP6_ND_OPT_PREFIX_AUTONOMOUS_P(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(3), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(3)) | GLUE_CAST08(0x40L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(3)) & ~GLUE_CAST08(0x40L))) +#define PTR_IP6_ND_OPT_PREFIX_VALID_LIFETIME(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_IP6_ND_OPT_PREFIX_VALID_LIFETIME(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(4)) +#define SET_IP6_ND_OPT_PREFIX_VALID_LIFETIME(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST32(_V_)) +#define PTR_IP6_ND_OPT_PREFIX_PREFERRED_LIFETIME(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define GET_IP6_ND_OPT_PREFIX_PREFERRED_LIFETIME(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(8)) +#define SET_IP6_ND_OPT_PREFIX_PREFERRED_LIFETIME(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(8), GLUE_CAST32(_V_)) +#define PTR_IP6_ND_OPT_PREFIX_PREFIX(_P_)\ + ((GLUE_CAST_PTR(_P_))+(16)) +#define PTR_IP6_ND_OPT_REDIRECTED(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_IP6_ND_OPT_REDIRECTED (48) +#define PTR_IP6_ND_OPT_REDIRECTED_HEADER(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define PTR_IP6_ND_OPT_MTU(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_IP6_ND_OPT_MTU (8) +#define PTR_IP6_ND_OPT_MTU_MTU(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_IP6_ND_OPT_MTU_MTU(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(4)) +#define SET_IP6_ND_OPT_MTU_MTU(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST32(_V_)) + +/* Definitions for ICMP6_MSG */ + +#define SIZEOF_ICMP6_MSG (48) +/* Can't define PTR_ICMP6_MSG_INFO_P because: + Size 1 is not a multiple of 8. */ +#define GET_ICMP6_MSG_INFO_P(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))) & GLUE_CAST08(0x80L)) +#define SET_ICMP6_MSG_INFO_P(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))) | GLUE_CAST08(0x80L) : GLUE_GB08((GLUE_CAST_PTR(_P_))) & ~GLUE_CAST08(0x80L))) +#define PTR_ICMP6_MSG_TYPE(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_ICMP6_MSG_TYPE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_ICMP6_MSG_TYPE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define ICMP6_MSG_TYPE_is_DESTINATION_UNREACHABLE GLUE_CAST08(1L) +#define ICMP6_MSG_TYPE_is_PACKET_TOO_BIG GLUE_CAST08(2L) +#define ICMP6_MSG_TYPE_is_TIME_EXCEEDED GLUE_CAST08(3L) +#define ICMP6_MSG_TYPE_is_PARAMETER_PROBLEM GLUE_CAST08(4L) +#define ICMP6_MSG_TYPE_is_ECHO_REQUEST GLUE_CAST08(128L) +#define ICMP6_MSG_TYPE_is_ECHO_REPLY GLUE_CAST08(129L) +#define ICMP6_MSG_TYPE_is_GM_QUERY GLUE_CAST08(130L) +#define ICMP6_MSG_TYPE_is_GM_REPORT GLUE_CAST08(131L) +#define ICMP6_MSG_TYPE_is_GM_REDUCTION GLUE_CAST08(132L) +#define ICMP6_MSG_TYPE_is_ROUTER_SOLICITATION GLUE_CAST08(133L) +#define ICMP6_MSG_TYPE_is_ROUTER_ADVERTISEMENT GLUE_CAST08(134L) +#define ICMP6_MSG_TYPE_is_NEIGHBOR_SOLICITATION GLUE_CAST08(135L) +#define ICMP6_MSG_TYPE_is_NEIGHBOR_ADVERTISEMENT GLUE_CAST08(136L) +#define ICMP6_MSG_TYPE_is_REDIRECT GLUE_CAST08(137L) +#define PTR_ICMP6_MSG_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_ICMP6_MSG_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_ICMP6_MSG_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define PTR_ICMP6_MSG_CHECKSUM(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_ICMP6_MSG_CHECKSUM(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(2)) +#define SET_ICMP6_MSG_CHECKSUM(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST16(_V_)) +#define PTR_ICMP6_MSG_IDENTIFICATION(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_ICMP6_MSG_IDENTIFICATION(_P_)\ + GLUE_GU16((GLUE_CAST_PTR(_P_))+(4)) +#define SET_ICMP6_MSG_IDENTIFICATION(_P_, _V_)\ + GLUE_SU16((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST16(_V_)) +#define PTR_ICMP6_MSG_SEQUENCE_NUMBER(_P_)\ + ((GLUE_CAST_PTR(_P_))+(6)) +#define GET_ICMP6_MSG_SEQUENCE_NUMBER(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(6)) +#define SET_ICMP6_MSG_SEQUENCE_NUMBER(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(6), GLUE_CAST16(_V_)) +#define PTR_ICMP6_MSG_HEADER(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define PTR_ICMP6_MSG_MINIMUM_HEADER(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_ICMP6_MSG_MINIMUM_HEADER (8) +#define PTR_ICMP6_MSG_DU(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_ICMP6_MSG_DU (8) +#define PTR_ICMP6_MSG_DU_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_ICMP6_MSG_DU_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_ICMP6_MSG_DU_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define ICMP6_MSG_DU_CODE_is_NO_ROUTE GLUE_CAST08(0L) +#define ICMP6_MSG_DU_CODE_is_PROHIBITED GLUE_CAST08(1L) +#define ICMP6_MSG_DU_CODE_is_ADDRESS GLUE_CAST08(3L) +#define ICMP6_MSG_DU_CODE_is_PORT GLUE_CAST08(4L) +#define PTR_ICMP6_MSG_PTB(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_ICMP6_MSG_PTB (8) +#define PTR_ICMP6_MSG_PTB_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_ICMP6_MSG_PTB_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_ICMP6_MSG_PTB_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define PTR_ICMP6_MSG_PTB_MTU(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_ICMP6_MSG_PTB_MTU(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(4)) +#define SET_ICMP6_MSG_PTB_MTU(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST32(_V_)) +#define PTR_ICMP6_MSG_TE(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_ICMP6_MSG_TE (8) +#define PTR_ICMP6_MSG_TE_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_ICMP6_MSG_TE_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_ICMP6_MSG_TE_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define ICMP6_MSG_TE_CODE_is_HOPS GLUE_CAST08(0L) +#define ICMP6_MSG_TE_CODE_is_REASSEMBLY GLUE_CAST08(1L) +#define PTR_ICMP6_MSG_TE_MTU(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_ICMP6_MSG_TE_MTU(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(4)) +#define SET_ICMP6_MSG_TE_MTU(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST32(_V_)) +#define PTR_ICMP6_MSG_PP(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_ICMP6_MSG_PP (8) +#define PTR_ICMP6_MSG_PP_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_ICMP6_MSG_PP_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_ICMP6_MSG_PP_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define ICMP6_MSG_PP_CODE_is_ZERO GLUE_CAST08(0L) +#define ICMP6_MSG_PP_CODE_is_UNREC_HEADER GLUE_CAST08(1L) +#define ICMP6_MSG_PP_CODE_is_UNREC_OPTION GLUE_CAST08(2L) +#define PTR_ICMP6_MSG_PP_POINTER(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_ICMP6_MSG_PP_POINTER(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(4)) +#define SET_ICMP6_MSG_PP_POINTER(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST32(_V_)) +#define PTR_ICMP6_MSG_ECHO(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_ICMP6_MSG_ECHO (8) +#define PTR_ICMP6_MSG_ECHO_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_ICMP6_MSG_ECHO_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_ICMP6_MSG_ECHO_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define ICMP6_MSG_ECHO_CODE_is_ZERO GLUE_CAST08(0L) +#define PTR_ICMP6_MSG_ECHO_DATA(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define SIZEOF_ICMP6_MSG_ECHO_DATA (0) +#define PTR_ICMP6_MSG_ECHO_DATA_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(8)+(_X0_)) +#define GET_ICMP6_MSG_ECHO_DATA_ELT(_P_, _X0_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(8)+(_X0_)) +#define SET_ICMP6_MSG_ECHO_DATA_ELT(_P_, _X0_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(8)+(_X0_), GLUE_CAST08(_V_)) +#define PTR_ICMP6_MSG_GM(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_ICMP6_MSG_GM (24) +#define PTR_ICMP6_MSG_GM_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_ICMP6_MSG_GM_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_ICMP6_MSG_GM_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define ICMP6_MSG_GM_CODE_is_ZERO GLUE_CAST08(0L) +#define PTR_ICMP6_MSG_GM_DELAY(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_ICMP6_MSG_GM_DELAY(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(4)) +#define SET_ICMP6_MSG_GM_DELAY(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST16(_V_)) +#define PTR_ICMP6_MSG_GM_ADDRESS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define PTR_ICMP6_MSG_RS(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_ICMP6_MSG_RS (8) +#define PTR_ICMP6_MSG_RS_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_ICMP6_MSG_RS_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_ICMP6_MSG_RS_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define ICMP6_MSG_RS_CODE_is_ZERO GLUE_CAST08(0L) +#define PTR_ICMP6_MSG_RS_OPTIONS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define SIZEOF_ICMP6_MSG_RS_OPTIONS (0) +#define PTR_ICMP6_MSG_RS_OPTIONS_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(8)+(_X0_)) +#define GET_ICMP6_MSG_RS_OPTIONS_ELT(_P_, _X0_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(8)+(_X0_)) +#define SET_ICMP6_MSG_RS_OPTIONS_ELT(_P_, _X0_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(8)+(_X0_), GLUE_CAST08(_V_)) +#define PTR_ICMP6_MSG_RA(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_ICMP6_MSG_RA (16) +#define PTR_ICMP6_MSG_RA_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_ICMP6_MSG_RA_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_ICMP6_MSG_RA_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define ICMP6_MSG_RA_CODE_is_ZERO GLUE_CAST08(0L) +#define PTR_ICMP6_MSG_RA_HOP_LIMIT(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_ICMP6_MSG_RA_HOP_LIMIT(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(4)) +#define SET_ICMP6_MSG_RA_HOP_LIMIT(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST08(_V_)) +/* Can't define PTR_ICMP6_MSG_RA_MANAGED_P because: + Size 1 is not a multiple of 8. */ +#define GET_ICMP6_MSG_RA_MANAGED_P(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(5)) & GLUE_CAST08(0x80L)) +#define SET_ICMP6_MSG_RA_MANAGED_P(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(5), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(5)) | GLUE_CAST08(0x80L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(5)) & ~GLUE_CAST08(0x80L))) +/* Can't define PTR_ICMP6_MSG_RA_OTHER_P because: + Size 1 is not a multiple of 8. */ +#define GET_ICMP6_MSG_RA_OTHER_P(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(5)) & GLUE_CAST08(0x40L)) +#define SET_ICMP6_MSG_RA_OTHER_P(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(5), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(5)) | GLUE_CAST08(0x40L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(5)) & ~GLUE_CAST08(0x40L))) +#define PTR_ICMP6_MSG_RA_ROUTER_LIFETIME(_P_)\ + ((GLUE_CAST_PTR(_P_))+(6)) +#define GET_ICMP6_MSG_RA_ROUTER_LIFETIME(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(6)) +#define SET_ICMP6_MSG_RA_ROUTER_LIFETIME(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(6), GLUE_CAST16(_V_)) +#define PTR_ICMP6_MSG_RA_REACHABLE_TIME(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define GET_ICMP6_MSG_RA_REACHABLE_TIME(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(8)) +#define SET_ICMP6_MSG_RA_REACHABLE_TIME(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(8), GLUE_CAST32(_V_)) +#define PTR_ICMP6_MSG_RA_RETRANSMIT_TIME(_P_)\ + ((GLUE_CAST_PTR(_P_))+(12)) +#define GET_ICMP6_MSG_RA_RETRANSMIT_TIME(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(12)) +#define SET_ICMP6_MSG_RA_RETRANSMIT_TIME(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(12), GLUE_CAST32(_V_)) +#define PTR_ICMP6_MSG_RA_OPTIONS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(16)) +#define SIZEOF_ICMP6_MSG_RA_OPTIONS (0) +#define PTR_ICMP6_MSG_RA_OPTIONS_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(16)+(_X0_)) +#define GET_ICMP6_MSG_RA_OPTIONS_ELT(_P_, _X0_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(16)+(_X0_)) +#define SET_ICMP6_MSG_RA_OPTIONS_ELT(_P_, _X0_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(16)+(_X0_), GLUE_CAST08(_V_)) +#define PTR_ICMP6_MSG_NS(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_ICMP6_MSG_NS (24) +#define PTR_ICMP6_MSG_NS_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_ICMP6_MSG_NS_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_ICMP6_MSG_NS_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define ICMP6_MSG_NS_CODE_is_ZERO GLUE_CAST08(0L) +#define PTR_ICMP6_MSG_NS_ADDRESS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define PTR_ICMP6_MSG_NS_OPTIONS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(24)) +#define SIZEOF_ICMP6_MSG_NS_OPTIONS (0) +#define PTR_ICMP6_MSG_NS_OPTIONS_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(24)+(_X0_)) +#define GET_ICMP6_MSG_NS_OPTIONS_ELT(_P_, _X0_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(24)+(_X0_)) +#define SET_ICMP6_MSG_NS_OPTIONS_ELT(_P_, _X0_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(24)+(_X0_), GLUE_CAST08(_V_)) +#define PTR_ICMP6_MSG_NA(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_ICMP6_MSG_NA (24) +#define PTR_ICMP6_MSG_NA_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_ICMP6_MSG_NA_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_ICMP6_MSG_NA_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define ICMP6_MSG_NA_CODE_is_ZERO GLUE_CAST08(0L) +/* Can't define PTR_ICMP6_MSG_NA_ROUTER_P because: + Size 1 is not a multiple of 8. */ +#define GET_ICMP6_MSG_NA_ROUTER_P(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(4)) & GLUE_CAST08(0x80L)) +#define SET_ICMP6_MSG_NA_ROUTER_P(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(4), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(4)) | GLUE_CAST08(0x80L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(4)) & ~GLUE_CAST08(0x80L))) +/* Can't define PTR_ICMP6_MSG_NA_SOLICITED_P because: + Size 1 is not a multiple of 8. */ +#define GET_ICMP6_MSG_NA_SOLICITED_P(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(4)) & GLUE_CAST08(0x40L)) +#define SET_ICMP6_MSG_NA_SOLICITED_P(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(4), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(4)) | GLUE_CAST08(0x40L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(4)) & ~GLUE_CAST08(0x40L))) +/* Can't define PTR_ICMP6_MSG_NA_OVERRIDE_P because: + Size 1 is not a multiple of 8. */ +#define GET_ICMP6_MSG_NA_OVERRIDE_P(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(4)) & GLUE_CAST08(0x20L)) +#define SET_ICMP6_MSG_NA_OVERRIDE_P(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(4), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(4)) | GLUE_CAST08(0x20L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(4)) & ~GLUE_CAST08(0x20L))) +#define PTR_ICMP6_MSG_NA_ADDRESS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define PTR_ICMP6_MSG_NA_OPTIONS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(24)) +#define SIZEOF_ICMP6_MSG_NA_OPTIONS (0) +#define PTR_ICMP6_MSG_NA_OPTIONS_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(24)+(_X0_)) +#define GET_ICMP6_MSG_NA_OPTIONS_ELT(_P_, _X0_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(24)+(_X0_)) +#define SET_ICMP6_MSG_NA_OPTIONS_ELT(_P_, _X0_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(24)+(_X0_), GLUE_CAST08(_V_)) +#define PTR_ICMP6_MSG_RE(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_ICMP6_MSG_RE (40) +#define PTR_ICMP6_MSG_RE_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_ICMP6_MSG_RE_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_ICMP6_MSG_RE_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define ICMP6_MSG_RE_CODE_is_ZERO GLUE_CAST08(0L) +#define PTR_ICMP6_MSG_RE_TARGET_ADDRESS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define PTR_ICMP6_MSG_RE_DESTINATION_ADDRESS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(24)) +#define PTR_ICMP6_MSG_RE_OPTIONS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(40)) +#define SIZEOF_ICMP6_MSG_RE_OPTIONS (0) +#define PTR_ICMP6_MSG_RE_OPTIONS_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(40)+(_X0_)) +#define GET_ICMP6_MSG_RE_OPTIONS_ELT(_P_, _X0_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(40)+(_X0_)) +#define SET_ICMP6_MSG_RE_OPTIONS_ELT(_P_, _X0_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(40)+(_X0_), GLUE_CAST08(_V_)) + +/* Definitions for IP6_PSEUDO_HEADER */ + +#define SIZEOF_IP6_PSEUDO_HEADER (40) +#define PTR_IP6_PSEUDO_HEADER_SOURCE_ADDRESS(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define PTR_IP6_PSEUDO_HEADER_DESTINATION_ADDRESS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(16)) +#define PTR_IP6_PSEUDO_HEADER_PAYLOAD_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(32)) +#define GET_IP6_PSEUDO_HEADER_PAYLOAD_LENGTH(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(32)) +#define SET_IP6_PSEUDO_HEADER_PAYLOAD_LENGTH(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(32), GLUE_CAST32(_V_)) +#define PTR_IP6_PSEUDO_HEADER_NEXT_HEADER(_P_)\ + ((GLUE_CAST_PTR(_P_))+(39)) +#define GET_IP6_PSEUDO_HEADER_NEXT_HEADER(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(39)) +#define SET_IP6_PSEUDO_HEADER_NEXT_HEADER(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(39), GLUE_CAST08(_V_)) + +/* Definitions for IP6_FRAGMENT_HEADER */ + +#define SIZEOF_IP6_FRAGMENT_HEADER (8) +#define PTR_IP6_FRAGMENT_HEADER_NEXT_HEADER(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_IP6_FRAGMENT_HEADER_NEXT_HEADER(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_IP6_FRAGMENT_HEADER_NEXT_HEADER(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +/* Can't define PTR_IP6_FRAGMENT_HEADER_OFFSET because: + Size 13 is not a multiple of 8. */ +#define GET_IP6_FRAGMENT_HEADER_OFFSET(_P_)\ + GLUE_CAST16(GLUE_GB16((GLUE_CAST_PTR(_P_))+(2)) >> 3) +#define SET_IP6_FRAGMENT_HEADER_OFFSET(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(2), (GLUE_GB16((GLUE_CAST_PTR(_P_))+(2)) & ~GLUE_CAST16(0xFFF8L)) | ((GLUE_CAST16(_V_) << 3) & GLUE_CAST16(0xFFF8L))) +/* Can't define PTR_IP6_FRAGMENT_HEADER_MORE_P because: + Size 1 is not a multiple of 8. */ +#define GET_IP6_FRAGMENT_HEADER_MORE_P(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))+(3)) & GLUE_CAST08(0x1L)) +#define SET_IP6_FRAGMENT_HEADER_MORE_P(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(3), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))+(3)) | GLUE_CAST08(0x1L) : GLUE_GB08((GLUE_CAST_PTR(_P_))+(3)) & ~GLUE_CAST08(0x1L))) +#define PTR_IP6_FRAGMENT_HEADER_IDENTIFICATION(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_IP6_FRAGMENT_HEADER_IDENTIFICATION(_P_)\ + GLUE_GU32((GLUE_CAST_PTR(_P_))+(4)) +#define SET_IP6_FRAGMENT_HEADER_IDENTIFICATION(_P_, _V_)\ + GLUE_SU32((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST32(_V_)) + +/* Definitions for IP6_ROUTING_HEADER */ + +#define SIZEOF_IP6_ROUTING_HEADER (8) +#define PTR_IP6_ROUTING_HEADER_NEXT_HEADER(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_IP6_ROUTING_HEADER_NEXT_HEADER(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_IP6_ROUTING_HEADER_NEXT_HEADER(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define PTR_IP6_ROUTING_HEADER_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_IP6_ROUTING_HEADER_LENGTH(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_IP6_ROUTING_HEADER_LENGTH(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define PTR_IP6_ROUTING_HEADER_TYPE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_IP6_ROUTING_HEADER_TYPE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) +#define SET_IP6_ROUTING_HEADER_TYPE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST08(_V_)) +#define IP6_ROUTING_HEADER_TYPE_is_TYPE0 GLUE_CAST08(0L) +#define PTR_IP6_ROUTING_HEADER_SEGMENTS_LEFT(_P_)\ + ((GLUE_CAST_PTR(_P_))+(3)) +#define GET_IP6_ROUTING_HEADER_SEGMENTS_LEFT(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(3)) +#define SET_IP6_ROUTING_HEADER_SEGMENTS_LEFT(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(3), GLUE_CAST08(_V_)) +#define PTR_IP6_ROUTING_HEADER_STRICT(_P_)\ + ((GLUE_CAST_PTR(_P_))+(5)) +#define SIZEOF_IP6_ROUTING_HEADER_STRICT (3) +/* Can't define PTR_IP6_ROUTING_HEADER_STRICT_ELT because: + Size 1 is not a multiple of 8. */ +/* Can't define (GET_IP6_ROUTING_HEADER_STRICT_ELT SET_IP6_ROUTING_HEADER_STRICT_ELT) because: + Array elements are not aligned on octet boundaries: ((1 0 23)) */ +#define PTR_IP6_ROUTING_HEADER_HOP(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define SIZEOF_IP6_ROUTING_HEADER_HOP (0) +#define PTR_IP6_ROUTING_HEADER_HOP_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(8)+(16)*(_X0_)) + +/* Definitions for IP6_OPTION */ + +#define SIZEOF_IP6_OPTION (6) +/* Can't define PTR_IP6_OPTION_ACTION because: + Size 2 is not a multiple of 8. */ +#define GET_IP6_OPTION_ACTION(_P_)\ + GLUE_CAST08(GLUE_GB08((GLUE_CAST_PTR(_P_))) >> 6) +#define SET_IP6_OPTION_ACTION(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), (GLUE_GB08((GLUE_CAST_PTR(_P_))) & ~GLUE_CAST08(0xC0L)) | ((GLUE_CAST08(_V_) << 6) & GLUE_CAST08(0xC0L))) +#define IP6_OPTION_ACTION_is_IGNORE GLUE_CAST08(0L) +#define IP6_OPTION_ACTION_is_NEVER_COMPLAIN GLUE_CAST08(1L) +#define IP6_OPTION_ACTION_is_ALWAYS_COMPLAIN GLUE_CAST08(2L) +#define IP6_OPTION_ACTION_is_COMPLAIN GLUE_CAST08(3L) +/* Can't define PTR_IP6_OPTION_MAY_CHANGE_P because: + Size 1 is not a multiple of 8. */ +#define GET_IP6_OPTION_MAY_CHANGE_P(_P_)\ + (GLUE_GB08((GLUE_CAST_PTR(_P_))) & GLUE_CAST08(0x20L)) +#define SET_IP6_OPTION_MAY_CHANGE_P(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), ((_V_) ? GLUE_GB08((GLUE_CAST_PTR(_P_))) | GLUE_CAST08(0x20L) : GLUE_GB08((GLUE_CAST_PTR(_P_))) & ~GLUE_CAST08(0x20L))) +#define PTR_IP6_OPTION_TYPE(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_IP6_OPTION_TYPE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_IP6_OPTION_TYPE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define IP6_OPTION_TYPE_is_PAD1 GLUE_CAST08(0L) +#define IP6_OPTION_TYPE_is_PADN GLUE_CAST08(1L) +#define IP6_OPTION_TYPE_is_JUMBO GLUE_CAST08(194L) +#define PTR_IP6_OPTION_DATA_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_IP6_OPTION_DATA_LENGTH(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_IP6_OPTION_DATA_LENGTH(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define PTR_IP6_OPTION_JUMBO_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_IP6_OPTION_JUMBO_LENGTH(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(2)) +#define SET_IP6_OPTION_JUMBO_LENGTH(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST32(_V_)) + +/* Definitions for IP6_OPTIONS_HEADER */ + +#define SIZEOF_IP6_OPTIONS_HEADER (8) +#define PTR_IP6_OPTIONS_HEADER_NEXT_HEADER(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_IP6_OPTIONS_HEADER_NEXT_HEADER(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_IP6_OPTIONS_HEADER_NEXT_HEADER(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define PTR_IP6_OPTIONS_HEADER_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_IP6_OPTIONS_HEADER_LENGTH(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_IP6_OPTIONS_HEADER_LENGTH(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define PTR_IP6_OPTIONS_HEADER_OPTIONS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define SIZEOF_IP6_OPTIONS_HEADER_OPTIONS (6) +#define PTR_IP6_OPTIONS_HEADER_OPTIONS_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(2)+(_X0_)) +#define GET_IP6_OPTIONS_HEADER_OPTIONS_ELT(_P_, _X0_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)+(_X0_)) +#define SET_IP6_OPTIONS_HEADER_OPTIONS_ELT(_P_, _X0_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(2)+(_X0_), GLUE_CAST08(_V_)) + +/* Definitions for IP6_HEADER */ + +#define SIZEOF_IP6_HEADER (40) +/* Can't define PTR_IP6_HEADER_VERSION because: + Size 4 is not a multiple of 8. */ +#define GET_IP6_HEADER_VERSION(_P_)\ + GLUE_CAST08(GLUE_GB08((GLUE_CAST_PTR(_P_))) >> 4) +#define SET_IP6_HEADER_VERSION(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), (GLUE_GB08((GLUE_CAST_PTR(_P_))) & ~GLUE_CAST08(0xF0L)) | ((GLUE_CAST08(_V_) << 4) & GLUE_CAST08(0xF0L))) +#define IP6_HEADER_VERSION_is_IPV4 GLUE_CAST08(4L) +#define IP6_HEADER_VERSION_is_IPV6 GLUE_CAST08(6L) +/* Can't define PTR_IP6_HEADER_TRAFFIC_CLASS because: + Offset 4 is not a multiple of 8. */ +#define GET_IP6_HEADER_TRAFFIC_CLASS(_P_)\ + GLUE_CAST08((GLUE_GB16((GLUE_CAST_PTR(_P_))) & GLUE_CAST16(0xFF0L)) >> 4) +#define SET_IP6_HEADER_TRAFFIC_CLASS(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_)), (GLUE_GB16((GLUE_CAST_PTR(_P_))) & ~GLUE_CAST16(0xFF0L)) | ((GLUE_CAST16(_V_) << 4) & GLUE_CAST16(0xFF0L))) +/* Can't define PTR_IP6_HEADER_FLOW_LABEL because: + Size 20 is not a multiple of 8. */ +#define GET_IP6_HEADER_FLOW_LABEL(_P_)\ + GLUE_CAST32(GLUE_GB32LS24((GLUE_CAST_PTR(_P_))) & GLUE_CAST32(0xFFFFFL)) +#define SET_IP6_HEADER_FLOW_LABEL(_P_, _V_)\ + GLUE_SB32LS24((GLUE_CAST_PTR(_P_)), (GLUE_GB32LS24((GLUE_CAST_PTR(_P_))) & ~GLUE_CAST32(0xFFFFFL)) | (GLUE_CAST32(_V_) & GLUE_CAST32(0xFFFFFL))) +#define PTR_IP6_HEADER_PAYLOAD_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_IP6_HEADER_PAYLOAD_LENGTH(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(4)) +#define SET_IP6_HEADER_PAYLOAD_LENGTH(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST16(_V_)) +#define PTR_IP6_HEADER_NEXT_HEADER(_P_)\ + ((GLUE_CAST_PTR(_P_))+(6)) +#define GET_IP6_HEADER_NEXT_HEADER(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(6)) +#define SET_IP6_HEADER_NEXT_HEADER(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(6), GLUE_CAST08(_V_)) +#define PTR_IP6_HEADER_HOP_LIMIT(_P_)\ + ((GLUE_CAST_PTR(_P_))+(7)) +#define GET_IP6_HEADER_HOP_LIMIT(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(7)) +#define SET_IP6_HEADER_HOP_LIMIT(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(7), GLUE_CAST08(_V_)) +#define PTR_IP6_HEADER_SOURCE_ADDRESS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define PTR_IP6_HEADER_DESTINATION_ADDRESS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(24)) + +/* Definitions for IP6_ADDRESS */ + +#define SIZEOF_IP6_ADDRESS (16) +#define PTR_IP6_ADDRESS_BYTES(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define SIZEOF_IP6_ADDRESS_BYTES (16) +#define PTR_IP6_ADDRESS_BYTES_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(_X0_)) +#define GET_IP6_ADDRESS_BYTES_ELT(_P_, _X0_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(_X0_)) +#define SET_IP6_ADDRESS_BYTES_ELT(_P_, _X0_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(_X0_), GLUE_CAST08(_V_)) + +#endif /* EPILOGUE_LAYOUT_IP6_H */ diff --git a/h/wrn/wm/util/layout/ip6.ldb b/h/wrn/wm/util/layout/ip6.ldb new file mode 100644 index 0000000..96408fa --- /dev/null +++ b/h/wrn/wm/util/layout/ip6.ldb @@ -0,0 +1,452 @@ +; $Header: /usr/cvsroot/target/h/wrn/wm/util/layout/ip6.ldb,v 1.1.1.1 2001/11/05 17:47:20 tneale Exp $ +; Layout information for IPv6 protocols + +;**************************************************************************** +; +; *** Restricted Rights Legend *** +; +; The programs and information contained herein are licensed only +; pursuant to a license agreement that contains use, reverse +; engineering, disclosure, and other restrictions; accordingly, it +; is "Unpublished--all rights reserved under the applicable +; copyright laws". +; +; Use duplication, or disclosure by the Government is subject to +; restrictions as set forth in subparagraph (c)(1)(ii) of the Rights +; in Technical Data and Computer Licensed Programs clause of DFARS +; 52.227 7013. +; +; Copyright 2000-2001 Wind River Systems, Inc. +; Copyright 1996-1997 Epilogue Technology Corporation. +; Copyright 1998 Integrated Systems, Inc. +; All rights reserved. +; +; *** Government Use *** +; +; The Licensed Programs and their documentation were developed at +; private expense and no part of them is in the public domain. +; +; The Licensed Programs are "Restricted Computer Software" as that +; term is defined in Clause 52.227-19 of the Federal Acquisition +; Regulations (FAR) and are "Commercial Computer Software" as that +; term is defined in Subpart 227.401 of the Department of Defense +; Federal Acquisition Regulation Supplement (DFARS). +; +; (i) If the licensed Programs are supplied to the Department of +; Defense (DoD), the Licensed Programs are classified as +; "Commercial Computer Software" and the Government is acquiring +; only "restricted rights" in the Licensed Programs and their +; documentation as that term is defined in Clause 52.227 +; 7013(c)(1) of the DFARS, and +; +; (ii) If the Licensed Programs are supplied to any unit or agency +; of the United States Government other than DoD, the +; Government's rights in the Licensed Programs and their +; documentation will be as defined in Clause 52.227-19(c)(2) of +; the FAR. +;**************************************************************************** + +; $Log: ip6.ldb,v $ +; Revision 1.1.1.1 2001/11/05 17:47:20 tneale +; Tornado shuffle +; +; Revision 1.15 2001/01/19 22:22:33 paul +; Update copyright. +; +; Revision 1.14 2000/12/04 02:35:49 sar +; Removed a description of FLOW_LABEL that had been replaced but not +; previously removed. +; +; Revision 1.13 2000/12/02 20:22:20 sar +; Update the packet layouts this includes +; changing priority to traffic class +; modifying the size of flow label from 24 to 20 +; in v6 icmp message updating the CODE field +; in du message changing option 2 (not a neighbor) to reserved +; in ptb message removing the option types +; in te message adding checksum and mtu fields +; in pp message adding unrecognized header and option types +; changing redirect from RD to RE +; +; Revision 1.12 2000/03/13 21:21:48 paul +; Removed some code that we are no longer working on. +; +; Revision 1.9 1998/02/25 15:21:41 sra +; Finish moving types.h, bug.h, and bugdef.h to common/h/. +; +; Revision 1.8 1998/02/25 04:54:00 sra +; Update copyrights. +; +; Revision 1.7 1998/02/20 04:02:37 sra +; Fix too-long layout macro names. +; +; Revision 1.6 1997/09/26 20:21:15 alan +; Use features of new layout compiler: `use-layouts' and `C-include'. +; +; Revision 1.5 1997/06/04 05:46:27 alan +; Fix RCS keywords. +; +; Revision 1.4 1997/06/03 22:59:35 alan +; Use `define-rcs-info'. +; +; Revision 1.3 1997/05/28 05:13:54 alan +; Fix ICMP layouts so that they no longer use internal unions. This makes +; the size of the variants be what people expect. +; +; Revision 1.2 1997/04/22 00:18:33 alan +; Fix copyright. +; +; Revision 1.1 1997/04/19 04:12:16 alan +; Move all .ldb files into the `layout' directory. +; +; Revision 1.5 1997/04/18 22:50:01 alan +; Add ICMP6_MESSAGE_MINIMUM_HEADER ... +; +; Revision 1.4 1996/12/06 02:20:58 alan +; First supposedly working version. +; +; Revision 1.3 1996/12/04 19:57:42 alan +; Fix bugs... +; +; Revision 1.2 1996/12/03 07:52:46 alan +; A lot of this is now right. +; +; Revision 1.1 1996/12/02 19:28:26 alan +; Still bogus, but here it is... + +(define-rcs-info "$Id: ip6.ldb,v 1.1.1.1 2001/11/05 17:47:20 tneale Exp $") + +(use-layouts "ip.ldb") + +(C-include EPILOGUE_INSTALL_H ) +(C-include EPILOGUE_TYPES_H ) +(C-include EPILOGUE_LAYOUT_LDBGLUE_H ) + +(define-layout IP6_ADDRESS + (union (size 128) + (field BYTES (array (count 16) + (type (unsigned 8)))))) + +(define-layout IP6_HEADER + (struct (size (* 10 32)) ; error check + (struct (align 4) + (field VERSION + (enum (type (unsigned 4)) + (value IPV4 4) + (value IPV6 6))) + (field TRAFFIC_CLASS (unsigned 8)) + (field FLOW_LABEL (unsigned 20))) + (field PAYLOAD_LENGTH (unsigned 16)) + (field NEXT_HEADER IP_PROTOCOL) + (field HOP_LIMIT (unsigned 8)) + (field SOURCE_ADDRESS IP6_ADDRESS) + (field DESTINATION_ADDRESS IP6_ADDRESS) + )) + +; +; Hop-by-Hop or Destination Options Header +; + +(define-layout IP6_OPTIONS_HEADER + (struct (size (* 2 32)) + (field NEXT_HEADER IP_PROTOCOL) + (field LENGTH (unsigned 8)) + (field OPTIONS (array (count 6) + (type (unsigned 8)))))) + +(define-layout IP6_OPTION + (struct (union (size 8) + (struct (size 8) + (align 1) + (field ACTION (enum (type (unsigned 2)) + (value IGNORE 0) + (value NEVER_COMPLAIN 1) + (value ALWAYS_COMPLAIN 2) + (value COMPLAIN 3))) + (field MAY_CHANGE_P (boolean 1)) + (fill 5)) + (field TYPE (enum (type (unsigned 8)) + (value PAD1 0) ; special case: no data + (value PADN 1) + (value JUMBO 194) ; length = 4 + ))) + (field DATA_LENGTH (unsigned 8)) + (union (field JUMBO_LENGTH (unsigned 32)) + ))) + +; +; Routing Header +; + +(define-layout IP6_ROUTING_HEADER + (struct (field NEXT_HEADER IP_PROTOCOL) + (field LENGTH (unsigned 8)) + (field TYPE (enum (type (unsigned 8)) + (value TYPE0 0) ; name??? + )) + (field SEGMENTS_LEFT (unsigned 8)) + (union ;; Type 0: + (struct (fill 8) ; MBZ + (field STRICT (array (count 24) + (align 1) + (type (boolean 1)))) + (field HOP (array (count 0) + (type IP6_ADDRESS)))) + ))) + +; +; Fragment Header +; + +(define-layout IP6_FRAGMENT_HEADER + (struct (size (* 2 32)) + (field NEXT_HEADER IP_PROTOCOL) + (fill 8) ; MBZ + (struct (size 16) + (align 1) + (field OFFSET (unsigned 13)) + (fill 2) ; MBZ + (field MORE_P (boolean 1))) + (field IDENTIFICATION (opaque 32)))) + +; +; Etc. +; + +(define-layout IP6_PSEUDO_HEADER + ;; for computing ICMP, UDP or TCP checksums + (struct (size (* 10 32)) + (field SOURCE_ADDRESS IP6_ADDRESS) + (field DESTINATION_ADDRESS IP6_ADDRESS) + (field PAYLOAD_LENGTH (unsigned 32)) + (fill 24) ; MBZ + (field NEXT_HEADER IP_PROTOCOL))) + +; +; ICMPv6 +; + +(define-layout ICMP6_MSG + (union (struct ;; Many ICMP messages share these fields: + (union (size 8) + (struct (size 8) + (align 1) + (field INFO_P (boolean 1)) + (fill 7)) + (field TYPE + (enum (type (unsigned 8)) + (value DESTINATION_UNREACHABLE 1) + (value PACKET_TOO_BIG 2) + (value TIME_EXCEEDED 3) + (value PARAMETER_PROBLEM 4) + (value ECHO_REQUEST 128) + (value ECHO_REPLY 129) + (value GM_QUERY 130) + (value GM_REPORT 131) + (value GM_REDUCTION 132) + ;; Neighbor Discovery Types: + (value ROUTER_SOLICITATION 133) + (value ROUTER_ADVERTISEMENT 134) + (value NEIGHBOR_SOLICITATION 135) + (value NEIGHBOR_ADVERTISEMENT 136) + (value REDIRECT 137) + ))) + (field CODE (unsigned 8)) ; the CODE + (field CHECKSUM (unsigned 16)) ; always + (field IDENTIFICATION (opaque 16)) ; sometimes + (field SEQUENCE_NUMBER (unsigned 16)) ; sometimes + (field HEADER IP6_HEADER) ; sometimes + ) + + ;; Usefull size to know + (field MINIMUM_HEADER (struct (size (* 8 8)) ; error check + (fill 8) ; TYPE + (fill 8) ; CODE + (fill 16) ; CHECKSUM + (fill 16) ; IDENTIFICATION + (fill 16) ; SEQUENCE_NUMBER + )) + + ;; Destination Unreachable Message + (field DU (struct (fill 8) ; the TYPE + (field CODE (enum (type (unsigned 8)) + (value NO_ROUTE 0) + (value PROHIBITED 1) + ;; 2 is reserved + (value ADDRESS 3) + (value PORT 4))) + (fill 16) ; checksum + (fill 32) ; reserved + ;; contains a datagram + )) + + ;; Packet Too Big Message + (field PTB (struct (fill 8) ; the TYPE + (field CODE (enum (type (unsigned 8)) + ;; no types defined + )) + (fill 16) ; checksum + (field MTU (unsigned 32)) + ;; contains a datagram + )) + + ;; Time Exceeded Message: + (field TE (struct (fill 8) ; the TYPE + (field CODE (enum (type (unsigned 8)) + (value HOPS 0) + (value REASSEMBLY 1))) + (fill 16) ; checksum + (field MTU (unsigned 32)) + ;; contains a datagram + )) + + ;; Parameter Problem Message: + (field PP (struct (fill 8) ; the TYPE + (field CODE (enum (type (unsigned 8)) + (value ZERO 0) + (value UNREC_HEADER 1) + (value UNREC_OPTION 2))) + (fill 16) ; checksum + (field POINTER (unsigned 32)) + ;; contains a datagram + )) + + ;; Echo Request or Reply Message: + (field ECHO + (struct (size (* 8 8)) ; error check + (fill 8) ; the TYPE + (field CODE (enum (type (unsigned 8)) + (value ZERO 0))) + (fill 48) ; checksum+ident+sequence + (field DATA (array (count 0) + (type (unsigned 8)))))) + + ;; Group Membership Query, Report or Reduction Message: + (field GM + (struct (size (* 24 8)) ; error check + (fill 8) ; the TYPE + (field CODE (enum (type (unsigned 8)) + (value ZERO 0))) + (fill 16) ; checksum + (field DELAY (unsigned 16)) + (fill 16) ; MBZ + (field ADDRESS IP6_ADDRESS))) + + ;; ----- Neighbor Discovery Messages ----- + + ;; Router Solicitation Message: + (field RS + (struct (size (* 8 8)) ; error check + (fill 8) ; the TYPE + (field CODE (enum (type (unsigned 8)) + (value ZERO 0))) + (fill 16) ; checksum + (fill 32) ; MBZ + (field OPTIONS (array (count 0) + (type (unsigned 8)))))) + + ;; Router Advertisement Message: + (field RA + (struct (size (* 16 8)) ; error check + (fill 8) ; the TYPE + (field CODE (enum (type (unsigned 8)) + (value ZERO 0))) + (fill 16) ; checksum + (field HOP_LIMIT (unsigned 8)) + (struct (size 8) + (align 1) + (field MANAGED_P (boolean 1)) + (field OTHER_P (boolean 1)) + (fill 6) ; MBZ + ) + (field ROUTER_LIFETIME (unsigned 16)) + (field REACHABLE_TIME (unsigned 32)) + (field RETRANSMIT_TIME (unsigned 32)) + (field OPTIONS (array (count 0) + (type (unsigned 8)))))) + + ;; Neighbor Solicitation Message: + (field NS + (struct (size (* 24 8)) ; error check + (fill 8) ; the TYPE + (field CODE (enum (type (unsigned 8)) + (value ZERO 0))) + (fill 16) ; checksum + (fill 32) ; MBZ + (field ADDRESS IP6_ADDRESS) + (field OPTIONS (array (count 0) + (type (unsigned 8)))))) + + ;; Neighbor Advertisement Message: + (field NA + (struct (size (* 24 8)) ; error check + (fill 8) ; the TYPE + (field CODE (enum (type (unsigned 8)) + (value ZERO 0))) + (fill 16) ; checksum + (struct (size 32) + (align 1) + (field ROUTER_P (boolean 1)) + (field SOLICITED_P (boolean 1)) + (field OVERRIDE_P (boolean 1)) + (fill 29) ; MBZ + ) + (field ADDRESS IP6_ADDRESS) + (field OPTIONS (array (count 0) + (type (unsigned 8)))))) + + ;; Redirect Message: + (field RE + (struct (size (* 40 8)) ; error check + (fill 8) ; the TYPE + (field CODE (enum (type (unsigned 8)) + (value ZERO 0))) + (fill 16) ; checksum + (fill 32) ; MBZ + (field TARGET_ADDRESS IP6_ADDRESS) + (field DESTINATION_ADDRESS IP6_ADDRESS) + (field OPTIONS (array (count 0) + (type (unsigned 8)))))) + )) + +(define-layout IP6_ND_OPT + ;; for RS, RA, NS, NA and RE variants above... + (union (struct ;; All options share these fields: + (size 16) ; error check + (field TYPE + (enum (type (unsigned 8)) + (value SOURCE_LINK_LAYER_ADDRESS 1) + (value TARGET_LINK_LAYER_ADDRESS 2) + (value PREFIX_INFORMATION 3) ; length = 4 + (value REDIRECTED_HEADER 4) + (value MTU 5) ; length = 1 + )) + (field LENGTH (unsigned 8))) + (field LINK_LAYER (struct (fill 16) ; TYPE & LENGTH + (field ADDR + (array (count 0) + (type (unsigned 8)))))) + (field PREFIX (struct (size (* 32 8)) ; error check + (fill 16) ; TYPE & LENGTH + (field LENGTH (unsigned 8)) + (struct (size 8) + (align 1) + (field ON_LINK_P (boolean 1)) + (field AUTONOMOUS_P (boolean 1)) + (fill 6) ; MBZ + ) + (field VALID_LIFETIME (unsigned 32)) + (field PREFERRED_LIFETIME (unsigned 32)) + (fill 32) ; MBZ + (field PREFIX IP6_ADDRESS))) + (field REDIRECTED (struct (fill 16) ; TYPE & LENGTH + (fill (* 6 8)) + (field HEADER IP6_HEADER))) + (field MTU (struct (fill 16) ; TYPE & LENGTH + (fill 16) + (field MTU (unsigned 32)))) + )) + +; Local Variables: +; mode: Scheme +; End: diff --git a/h/wrn/wm/util/layout/layout.cfg b/h/wrn/wm/util/layout/layout.cfg new file mode 100644 index 0000000..0bb715e --- /dev/null +++ b/h/wrn/wm/util/layout/layout.cfg @@ -0,0 +1,55 @@ +; $Header: /usr/cvsroot/target/h/wrn/wm/util/layout/layout.cfg,v 1.1.1.1 2001/11/05 17:47:20 tneale Exp $ +; The standard configuration for the layout tool +; +; Don't modify this file. If you want to change any of these values, +; do so by putting overriding definitions into your main config file. + +;**************************************************************************** +; +; *** Restricted Rights Legend *** +; +; The programs and information contained herein are licensed only +; pursuant to a license agreement that contains use, reverse +; engineering, disclosure, and other restrictions; accordingly, it +; is "Unpublished--all rights reserved under the applicable +; copyright laws". +; +; Use duplication, or disclosure by the Government is subject to +; restrictions as set forth in subparagraph (c)(1)(ii) of the Rights +; in Technical Data and Computer Licensed Programs clause of DFARS +; 52.227 7013. +; +; Copyright 1997 Epilogue Technology Corporation. +; Copyright 1998 Integrated Systems, Inc. +; All rights reserved. +; +; *** Government Use *** +; +; The Licensed Programs and their documentation were developed at +; private expense and no part of them is in the public domain. +; +; The Licensed Programs are "Restricted Computer Software" as that +; term is defined in Clause 52.227-19 of the Federal Acquisition +; Regulations (FAR) and are "Commercial Computer Software" as that +; term is defined in Subpart 227.401 of the Department of Defense +; Federal Acquisition Regulation Supplement (DFARS). +; +; (i) If the licensed Programs are supplied to the Department of +; Defense (DoD), the Licensed Programs are classified as +; "Commercial Computer Software" and the Government is acquiring +; only "restricted rights" in the Licensed Programs and their +; documentation as that term is defined in Clause 52.227 +; 7013(c)(1) of the DFARS, and +; +; (ii) If the Licensed Programs are supplied to any unit or agency +; of the United States Government other than DoD, the +; Government's rights in the Licensed Programs and their +; documentation will be as defined in Clause 52.227-19(c)(2) of +; the FAR. +;**************************************************************************** + +; disabled by default, install in the OEM's config file if wanted +install LAYOUT + +; Default definition: where is scsh? +equate SCSH "scsh" diff --git a/h/wrn/wm/util/layout/ldbcomp/dumpit.scm b/h/wrn/wm/util/layout/ldbcomp/dumpit.scm new file mode 100644 index 0000000..85f3d33 --- /dev/null +++ b/h/wrn/wm/util/layout/ldbcomp/dumpit.scm @@ -0,0 +1,88 @@ +; $Header: /usr/cvsroot/target/h/wrn/wm/util/layout/ldbcomp/dumpit.scm,v 1.1.1.1 2001/11/05 17:47:21 tneale Exp $ +; Dump out an excutable for the layout tool. + +;**************************************************************************** +; +; *** Restricted Rights Legend *** +; +; The programs and information contained herein are licensed only +; pursuant to a license agreement that contains use, reverse +; engineering, disclosure, and other restrictions; accordingly, it +; is "Unpublished--all rights reserved under the applicable +; copyright laws". +; +; Use duplication, or disclosure by the Government is subject to +; restrictions as set forth in subparagraph (c)(1)(ii) of the Rights +; in Technical Data and Computer Licensed Programs clause of DFARS +; 52.227 7013. +; +; Copyright 2000-2001 Wind River Systems, Inc. +; Copyright 1997 Epilogue Technology Corporation. +; Copyright 1998 Integrated Systems, Inc. +; All rights reserved. +; +; *** Government Use *** +; +; The Licensed Programs and their documentation were developed at +; private expense and no part of them is in the public domain. +; +; The Licensed Programs are "Restricted Computer Software" as that +; term is defined in Clause 52.227-19 of the Federal Acquisition +; Regulations (FAR) and are "Commercial Computer Software" as that +; term is defined in Subpart 227.401 of the Department of Defense +; Federal Acquisition Regulation Supplement (DFARS). +; +; (i) If the licensed Programs are supplied to the Department of +; Defense (DoD), the Licensed Programs are classified as +; "Commercial Computer Software" and the Government is acquiring +; only "restricted rights" in the Licensed Programs and their +; documentation as that term is defined in Clause 52.227 +; 7013(c)(1) of the DFARS, and +; +; (ii) If the Licensed Programs are supplied to any unit or agency +; of the United States Government other than DoD, the +; Government's rights in the Licensed Programs and their +; documentation will be as defined in Clause 52.227-19(c)(2) of +; the FAR. +;**************************************************************************** + +(let ((target (nth command-line-arguments 0)) + (image (nth command-line-arguments 1))) + (let* ((psarg (format #F "ww~A" (pid))) + (scshvm (symbol->string (nth (run/sexps (ps ,psarg)) 11))) + (lscshvm (string-length scshvm))) + (unless (and (char=? #\/ (string-ref scshvm 0)) + (string=? "/scshvm" + (substring scshvm (- lscshvm 7) lscshvm))) + (err 'dumpit "Bad scshvm pathname: ~S" scshvm)) + (set! user-layouts-package (get-package 'user-layouts)) + (call-with-output-file target + (lambda (port) + (display "#!/bin/sh -" port) + (newline port) + (display scshvm port) + (display " -i " port) + (display image port) + (display " \"$@\"" port) + (newline port) + )) + (set-file-mode target #o755) + (set-err-should-exit? #T) + (dump-scsh-program do-layout-command-line image))) + +; $Log: dumpit.scm,v $ +; Revision 1.1.1.1 2001/11/05 17:47:21 tneale +; Tornado shuffle +; +; Revision 1.3 2001/01/19 22:22:35 paul +; Update copyright. +; +; Revision 1.2 1998/02/25 04:54:20 sra +; Update copyrights. +; +; Revision 1.1 1997/09/26 20:14:39 alan +; Initial Revision +; +; Local Variables: +; mode: Scheme +; End: diff --git a/h/wrn/wm/util/layout/ldbcomp/layout.scm b/h/wrn/wm/util/layout/ldbcomp/layout.scm new file mode 100644 index 0000000..b16ff98 --- /dev/null +++ b/h/wrn/wm/util/layout/ldbcomp/layout.scm @@ -0,0 +1,1414 @@ +; $Header: /usr/cvsroot/target/h/wrn/wm/util/layout/ldbcomp/layout.scm,v 1.1.1.1 2001/11/05 17:47:21 tneale Exp $ +; Describe the layout of a string of bits + +;**************************************************************************** +; +; *** Restricted Rights Legend *** +; +; The programs and information contained herein are licensed only +; pursuant to a license agreement that contains use, reverse +; engineering, disclosure, and other restrictions; accordingly, it +; is "Unpublished--all rights reserved under the applicable +; copyright laws". +; +; Use duplication, or disclosure by the Government is subject to +; restrictions as set forth in subparagraph (c)(1)(ii) of the Rights +; in Technical Data and Computer Licensed Programs clause of DFARS +; 52.227 7013. +; +; Copyright 2000-2001 Wind River Systems, Inc. +; Copyright 1997 Epilogue Technology Corporation. +; Copyright 1998 Integrated Systems, Inc. +; All rights reserved. +; +; *** Government Use *** +; +; The Licensed Programs and their documentation were developed at +; private expense and no part of them is in the public domain. +; +; The Licensed Programs are "Restricted Computer Software" as that +; term is defined in Clause 52.227-19 of the Federal Acquisition +; Regulations (FAR) and are "Commercial Computer Software" as that +; term is defined in Subpart 227.401 of the Department of Defense +; Federal Acquisition Regulation Supplement (DFARS). +; +; (i) If the licensed Programs are supplied to the Department of +; Defense (DoD), the Licensed Programs are classified as +; "Commercial Computer Software" and the Government is acquiring +; only "restricted rights" in the Licensed Programs and their +; documentation as that term is defined in Clause 52.227 +; 7013(c)(1) of the DFARS, and +; +; (ii) If the Licensed Programs are supplied to any unit or agency +; of the United States Government other than DoD, the +; Government's rights in the Licensed Programs and their +; documentation will be as defined in Clause 52.227-19(c)(2) of +; the FAR. +;**************************************************************************** + +(define-integrable (aligned? size align) + (= 0 (modulo size align))) + +; +; The Environment +; + +(define layout-working-env (make-symbol-hash-table 100)) +(define layout-used-env (make-symbol-hash-table 100)) +(define layout-fixed-env (make-symbol-hash-table 100)) + +(define layout-working-rcs-info (list '())) +(define layout-used-rcs-info (list '())) +(define layout-fixed-rcs-info (list '())) + +(define layout-working-C-includes (list '())) +(define layout-used-C-includes (list '())) + +(define layout-current-env layout-working-env) +(define layout-current-rcs-info layout-working-rcs-info) +(define layout-current-C-includes layout-working-C-includes) + +(define (layout-env-lookup name) + (hash-table/lookup layout-current-env name + (lambda (val) val) + (lambda () + (hash-table/lookup layout-used-env name + (lambda (val) val) + (lambda () + (hash-table/lookup layout-fixed-env name + (lambda (val) val) + (lambda () + (err 'layout "Undefined: ~S" name)))))))) + +(define (layout-env-set! name value) + (when (or (hash-table/get layout-working-env name #F) + (hash-table/get layout-used-env name #F) + (hash-table/get layout-fixed-env name #F)) + (format (error-output-port) "Warning: Redefining ~S~%" name)) + (hash-table/put! layout-current-env name value)) + +(defmac (define-layout name form) + (%define-layout 'name 'form)) + +(define (%define-layout name form) + (let ((val (layout-eval form))) + (when (and (eq? 'type (layout-val:kind val)) + (not (layout-type:name (layout-val:data val)))) + (set-layout-type:name (layout-val:data val) name)) + (layout-env-set! name val) + name)) + +(define (use-layouts file) + (unless (string? file) + (err 'layout "Invalid use-layouts file: ~S" file)) + (let ((saved-env layout-current-env) + (saved-rcs-info layout-current-rcs-info) + (saved-C-includes layout-current-C-includes)) + (set! layout-current-env layout-used-env) + (set! layout-current-rcs-info layout-used-rcs-info) + (set! layout-current-C-includes layout-used-C-includes) + (load-layouts file) + (set! layout-current-env saved-env) + (set! layout-current-rcs-info saved-rcs-info) + (set! layout-current-C-includes saved-C-includes))) + +(define (show-layout) ; for debugging + (hash-table/for-each layout-working-env + (lambda (name value) + (format #T "~S -> ~S~%" name value))) + (format #T " -- Used --~%") + (hash-table/for-each layout-used-env + (lambda (name value) + (format #T "~S -> ~S~%" name value))) + (format #T " -- Fixed --~%") + (hash-table/for-each layout-fixed-env + (lambda (name value) + (format #T "~S -> ~S~%" name value)))) + +(define (reset-layout) + (hash-table/clear! layout-working-env) + (hash-table/clear! layout-used-env) + (set-car! layout-working-rcs-info '()) + (set-car! layout-used-rcs-info '()) + (set-car! layout-working-C-includes '()) + (set-car! layout-used-C-includes '())) + +(define (fix-layout-env) + (hash-table/for-each layout-used-env + (lambda (name value) + (hash-table/put! layout-fixed-env name value))) + (hash-table/for-each layout-working-env + (lambda (name value) + (hash-table/put! layout-fixed-env name value))) + (set-car! layout-fixed-rcs-info + (append (car layout-working-rcs-info) + (car layout-used-rcs-info) + (car layout-fixed-rcs-info))) + (reset-layout)) + +(defmac (C-include test file) + (%C-include 'test 'file )) + +(define (%C-include test file) + (set-car! layout-current-C-includes + (cons (cons test file) + (car layout-current-C-includes)))) + +(define (define-rcs-info info) + (unless (and (string? info) + (char=? #\$ (string-ref info 0)) + (let ((end (- (string-length info) 1))) + (and (char=? #\$ (string-ref info end)) + (not (string-search-forwards #\$ info 1 end))))) + (err 'layout "Invalid RCS keyword string: ~S" info)) + (set-car! layout-current-rcs-info + (cons (substring info 1 (- (string-length info) 1)) + (car layout-current-rcs-info)))) + +(define (for-each-boilerplate-line proc) + (for-each proc + '("This file was automatically generated by Epilogue Technology's" + "network datastructure layout tool." + "" + "DO NOT MODIFY THIS FILE BY HAND." + "" + "Source file information:" + )) + (for-each (lambda (x) + (proc (string-append " " x))) + (reverse (car layout-working-rcs-info))) + (unless (null? (car layout-used-rcs-info)) + (proc " --used --") + (for-each (lambda (x) + (proc (string-append " " x))) + (reverse (car layout-used-rcs-info)))) + (unless (null? (car layout-fixed-rcs-info)) + (proc " -- fixed --") + (for-each (lambda (x) + (proc (string-append " " x))) + (reverse (car layout-fixed-rcs-info))))) + +; +; Evaluation +; + +(define (layout-eval form) + ((cond ((symbol? form) layout-env-lookup) + ((pair? form) + (layout-val:combination-handler (layout-eval (car form)))) + (else make-constant)) + form)) + +(define (bad-combination form) + (err 'layout "Bad combination: ~S" form)) + +(define (check-syntax pattern thing) + (unless (match? (cdr pattern) (cdr thing)) + (err 'layout "Bad syntax for ~S: ~S" (car pattern) thing))) + +(define (check-size form size) + (unless (and (integer? size) + (>= size 0)) + (err 'layout "Bad size ~S: ~S" size form))) + +(define-record layout-val + kind ; constant, type, operator + data + combination-handler + ((disclose self) + (list "Val" + (layout-val:kind self) + (layout-val:data self) + )) + ) + +(define (layout-eval-kind kind form) + (let ((v (layout-eval form))) + (unless (eq? kind (layout-val:kind v)) + (err 'layout "~S is not a ~S" form kind)) + (layout-val:data v))) + +(define-integrable (layout-eval-constant form) + (layout-eval-kind 'constant form)) + +(define (make-constant data) + (make-layout-val 'constant data bad-combination)) + +(define-integrable (layout-eval-type form) + (layout-eval-kind 'type form)) + +(define (make-type data) + (make-layout-val 'type data bad-combination)) + +; +; Types +; + +(define-record layout-type + name ; symbol or #F + kind ; enumeration, aggregate, array, or some scalar type + size ; size in bits + atrs ; alist of attributes, usually '(). + base ; base type for enumeration and array, else #F + data ; per-kind data: + ; aggregate: ((name offset type) ...) + ; enumeration: ((name value) ...) sorted by value + ; array: (offset (coefficient min max) ...) + ; else: #F + ((disclose self) + (list "Type" + (layout-type:name self) + (layout-type:kind self) + (layout-type:size self) + (layout-type:atrs self) + (layout-type:base self) + )) + ) + +; +; Operators in the layout language: +; + +(define (def-operator pattern proc) + (let ((name (car pattern))) + (hash-table/put! layout-current-env + name + (make-layout-val 'operator name + (lambda (form) + (check-syntax pattern form) + (proc form)))) + name)) + +(defmac (define-layout-macro pattern proc) + (%define-layout-macro 'pattern proc)) + +(define (%define-layout-macro pattern proc) + (def-operator pattern + (lambda (form) + (layout-eval (proc form))))) + +(def-operator '(sizeof any) + (lambda (form) + (make-constant (layout-type:size (layout-eval-type (cadr form)))))) + +; +; Simple operations on constants: +; + +(define (def-constant-operator pattern proc) + (def-operator pattern + (lambda (form) + (make-constant (apply proc (map layout-eval-constant (cdr form))))))) + +(def-constant-operator '(+ * any) +) +(def-constant-operator '(- + any) -) +(def-constant-operator '(* * any) *) + +(def-constant-operator '(octets * any) + (lambda args + (let loop ((l args) + (val 0.0)) + (if (null? l) + val + (loop (cdr l) + (bitwise-ior (car l) (arithmetic-shift val 8))))))) + +; +; Scalar type constructors: +; + +(define (def-type-constructor pattern proc) + (def-operator pattern + (lambda (form) + (make-type (apply proc form (map layout-eval-constant (cdr form))))))) + +(def-type-constructor '(boolean any) + (lambda (form size) + (check-size form size) + (unless (= size 1) + (err 'layout "Size ~S must be 1: ~S" size form)) + (make-layout-type #F 'boolean size '() #F #F))) + +(def-type-constructor '(opaque any) + (lambda (form size) + (check-size form size) + (make-layout-type #F 'opaque size '() #F #F))) + +(def-type-constructor '(signed any) + (lambda (form size) + (check-size form size) + (make-layout-type #F 'signed size '() #F #F))) + +(def-type-constructor '(unsigned any) + (lambda (form size) + (check-size form size) + (make-layout-type #F 'unsigned size '() #F #F))) + +(def-type-constructor '(signed-8bit-little any) + (lambda (form size) + (check-size form size) + (make-layout-type #F 'signed-8bit-little size '() #F #F))) + +(def-type-constructor '(unsigned-8bit-little any) + (lambda (form size) + (check-size form size) + (make-layout-type #F 'unsigned-8bit-little size '() #F #F))) + +; +; Helpers for things that have clauses (struct, union, array, enum): +; + +;NOTES. The general theory for things that have clauses is to -ignore- +; clauses that aren't defined. This lets you mark up layouts with +; information that isn't used now but might be used in the future. Of +; course you give up some error checking by doing this. Perhaps that makes +; it a bad idea? + +(define clause-patterns + '((struct * (symbol * any)) + (union * (symbol * any)) + (field symbol any) + (value symbol any) + (fill ? any) + (type any) + (size any) + (align any) + (count any) + (spacing any) + (base (or 8 10 16)))) + +(define (check-clause-syntax clause) + ;; Assuming `clause' is a cons whose car is a symbol. + (let ((pattern (assq (car clause) clause-patterns))) + (when pattern + (check-syntax pattern clause)))) + +(define (clause-value form key kind default? default) + (let loop ((clauses (cdr form))) + (cond ((null? clauses) + (unless default? + (err 'layout "Missing ~S clause: ~S" key form)) + default) + ((eq? key (caar clauses)) + (when (assq key (cdr clauses)) + (err 'layout "More than one ~S clause: ~S" key form)) + (if (eq? kind 'literal) + (cadar clauses) + (layout-eval-kind kind (cadar clauses)))) + (else + (loop (cdr clauses)))))) + +; +; Enumerations +; + +(define enumeration-processors (make-symbol-hash-table 25)) + +(def-operator '(enum * (symbol * any)) + (lambda (form) + (let* ((type (clause-value form 'type 'type #F #F)) + (process (or (hash-table/get enumeration-processors + (layout-type:kind type) + #F) + (err 'layout + "Don't know how to enumerate in this type: ~S" + form)))) + (let loop ((clauses (cdr form)) + (out '())) + (if (null? clauses) + (make-type (make-layout-type #F + 'enumeration + (layout-type:size type) + (list (cons 'base + (clause-value form + 'base + 'literal + #T + 10))) + type + ;; preserve original clause order for + ;; duplicate values: + (sort-list! (reverse! out) + (lambda (x y) + (< (cadr x) (cadr y)))))) + (let ((clause (car clauses))) + (check-clause-syntax clause) + (cond ((eq? (car clause) 'value) + (when (assq (cadr clause) out) + (err 'layout "Name ~S used more than once: ~S" + (cadr clause) form)) + (loop (cdr clauses) + (cons (list (cadr clause) + (process form + type + (cadr clause) + (layout-eval-constant + (caddr clause)))) + out))) + (else + (loop (cdr clauses) out))))))))) + +(define (process-unsigned-enumeration form type name val) + (let ((size (layout-type:size type))) + (unless (and (integer? val) + (<= 0 val) + (< val (expt 2 size))) + (err 'layout "Bad value ~S for ~S in: ~S" val name form)) + val)) + +(define (process-signed-enumeration form type name val) + (let ((size (layout-type:size type))) + (unless (and (integer? val) + (<= (- (expt 2 (- size 1))) val) + (< val (expt 2 (- size 1)))) + (err 'layout "Bad value ~S for ~S in: ~S" val name form)) + val)) + +(hash-table/put! enumeration-processors 'unsigned-8bit-little + process-unsigned-enumeration) + +(hash-table/put! enumeration-processors 'unsigned + process-unsigned-enumeration) + +(hash-table/put! enumeration-processors 'opaque + process-unsigned-enumeration) + +(hash-table/put! enumeration-processors 'signed-8bit-little + process-signed-enumeration) + +(hash-table/put! enumeration-processors 'signed + process-signed-enumeration) + +; +; Aggregates +; + +(define (process-aggregate form) + (let ((group (get-aggregate-group 8 form))) + (let loop ((specs (cdr group)) + (out '())) + (if (null? specs) + (make-type (make-layout-type #F 'aggregate (car group) '() #F out)) + (let ((spec (car specs))) + (when (assq (cadr spec) out) + (err 'layout "Field name ~S used more than once: ~S" + (cadr (car specs)) form)) + (loop (cdr specs) + (cons (list (cadr spec) (car spec) (caddr spec)) + out))))))) + +(def-operator '(struct * (symbol * any)) process-aggregate) +(def-operator '(union * (symbol * any)) process-aggregate) + +(define (get-aggregate-group align form) + ;; returns a "group", which is of the form: (size (offset name type) ...) + (for-each check-clause-syntax (cdr form)) + (let ((align (clause-value form 'align 'constant #T align))) + (define (process-clause clause) + (let* ((group (case (car clause) + ((struct union) + (get-aggregate-group align clause)) + ((fill) + (list (if (null? (cdr clause)) + #F + (layout-eval-constant (cadr clause))))) + ((field) + (let ((type (layout-eval-type (caddr clause)))) + (list (layout-type:size type) + (list 0 (cadr clause) type)))) + (else + (list 0)))) + (size (car group))) + (unless (or (not size) + (aligned? size align)) + (err 'layout "size ~S is not a multiple of ~S: ~S" + size align clause)) + group)) + (let* ((union? (eq? 'union (car form))) + (groups (map process-clause (cdr form))) + (minsize (reduce-map (if union? max +) + 0 + (lambda (group) (or (car group) 0)) + groups)) + (size (clause-value form 'size 'constant #T minsize))) + (unless (aligned? size align) + (err 'layout "requested size ~S is not a multiple of ~S: ~S" + size align form)) + (unless (>= size minsize) + (err 'layout "size ~S is smaller than the minimum of ~S: ~S" + size minsize form)) + (unless union? + (let ((p (assq #F groups))) + (cond (p (set-car! p (- size minsize))) + ((not (= size minsize)) + (err 'layout "size ~S is incorrect, computed size is ~S: ~S" + size minsize form))))) + (unless (not (assq #F groups)) + (err 'layout "too many unspecified fill clauses: ~S" form)) + (let loop ((groups groups) + (offset 0) + (specs '())) + (if (null? groups) + (cons size specs) + (loop (cdr groups) + (if union? + 0 + (+ offset (caar groups))) + (map* specs + (lambda (spec) + (cons (+ offset (car spec)) + (cdr spec))) + (cdar groups)))))))) + +; +; Arrays +; + +(def-operator '(array * (symbol * any)) + (lambda (form) + (for-each check-clause-syntax (cdr form)) + (let* ((align (clause-value form 'align 'constant #T 8)) + (type (clause-value form 'type 'type #F #F)) + (typesize (layout-type:size type)) + (spacing (clause-value form 'spacing 'constant #T typesize)) + (count (clause-value form 'count 'constant #F #F)) + (default-size (* spacing count)) + (minsize (- default-size (- spacing typesize))) + (size (clause-value form 'size 'constant #T default-size))) + (unless (>= spacing typesize) + (err 'layout "spacing ~S is smaller than the minimum of ~S: ~S" + spacing typesize form)) + (unless (aligned? spacing align) + (err 'layout "spacing of ~S is not a multiple of ~S: ~S" + spacing align form)) + (check-size form size) + (unless (>= size minsize) + (err 'layout "size ~S is smaller than the minimum of ~S: ~S" + size minsize form)) + (unless (aligned? size align) + (err 'layout "requested size ~S is not a multiple of ~S: ~S" + size align form)) + (make-type (make-layout-type #F 'array size '() type + (list 0 (list spacing 0 (- count 1)))))))) + +; +; Output driver loops +; + +; The new way: +(define (generate-layout-defs gen-def) + (hash-table/for-each layout-working-env + (lambda (name val) + (when (eq? 'type (layout-val:kind val)) + (gen-def name (generate-layout-defs-type (layout-val:data val))))))) + +(define (generate-layout-defs-subtype type) + (or (layout-type:name type) + (generate-layout-defs-type type))) + +(define (generate-layout-defs-type type) + ;; := + ;; + ;; ( ) + ;; (aggregate ( ) ...) + ;; (enumeration ( )) + ;; (array ( ) ...) + ;; Note that the array coefficients are in -reverse- order! + (let ((kind (layout-type:kind type)) + (base (layout-type:base type)) + (data (layout-type:data type))) + (cons* kind + (layout-type:size type) + (layout-type:atrs type) + (case kind + ((aggregate) + (map (lambda (triple) + (list (car triple) + (cadr triple) + (generate-layout-defs-subtype (caddr triple)))) + data)) + ((enumeration array) + (cons (generate-layout-defs-subtype base) + data)) + (else '()))))) + +; The old way: +(define (generate-layout gen-header gen-size gen-enum-defs gen-ptr gen-refset) + (hash-table/for-each layout-working-env + (lambda (name val) + (when (eq? 'type (layout-val:kind val)) + (let ((type (layout-val:data val))) + (when (eq? name (layout-type:name type)) + (gen-header name) + (let ((total-size (layout-type:size type))) + (define (recur path offset dope type) + (let ((recur? (or (null? path) + (not (layout-type:name type)))) + (kind (layout-type:kind type)) + (size (layout-type:size type)) + (atrs (layout-type:atrs type)) + (base (layout-type:base type)) + (data (layout-type:data type))) + (case kind + ((aggregate) + (when recur? + (gen-size name path size atrs) + (for-each (lambda (triple) + (let ((path (cons (car triple) path)) + (offset (+ offset (cadr triple))) + (type (caddr triple))) + (gen-ptr name path offset dope + (layout-type:size type) + (layout-type:atrs type)) + (recur path offset dope type))) + data))) + ((array) + (when recur? + + ;; Each element in `path' is either a field name + ;; symbol or the string "ELT" for an array + ;; reference. Each element in `dope' is a + ;; (coefficient min max) triple. Both lists are in + ;; reverse order. If you don't want to handle + ;; arrays, don't. + + (gen-size name path size atrs) + (let ((path (cons "ELT" path)) + (offset (+ offset (car data))) + (dope (append (cdr data) dope))) + (gen-ptr name path offset dope + (layout-type:size base) + (layout-type:atrs base)) + (recur path offset dope base)))) + ((enumeration) + (when (null? path) + (gen-size name path size atrs)) + (let ((kind (layout-type:kind base))) + (gen-refset name path offset dope kind + size atrs total-size) + (when recur? + (gen-enum-defs name path kind size atrs data)))) + (else + (when (null? path) + (gen-size name path size atrs)) + (gen-refset name path offset dope kind + size atrs total-size))))) + (recur '() 0 '() type)))))))) + +; +; Output Scheme->C header file: +; + +; The new way: +(define (generate-s2c-layout-definitions port schfile) + (for-each-boilerplate-line + (lambda (line) + (format port "; ~A~%" line))) + (newline port) + (generate-layout-defs (lambda (name type) + (write `(define-layout-macro ,name ,type) port) + (newline port)))) + +; The old way: +(define (generate-old-s2c-layout-definitions port) + + (define (out expr) + (write expr port) + (newline port)) + + (define (cant sym ctl . args) + (format port "; Can't define ~S because:~%; " sym) + (apply format port ctl args) + (newline port)) + + (define (mksym name path tail) + (let loop ((path path) + (tail tail)) + (cond ((null? path) + (apply symbol-append name tail)) + (else + (loop (cdr path) + (cons '/ (cons (car path) tail))))))) + + (define (mkixs l) + (let loop ((in l) + (out '()) + (n 0)) + (if (null? in) + out + (loop (cdr in) + (cons (symbol-append 'x n) out) + (+ 1 n))))) + + (define (mksum p const coeffs vars) + (let loop ((coeffs coeffs) + (vars vars) + (terms '())) + (cond ((not (null? coeffs)) + (loop (cdr coeffs) + (cdr vars) + (cond ((= 0 (car coeffs)) + terms) + ((= 1 (car coeffs)) + (cons (car vars) terms)) + ((= -1 (car coeffs)) + (cons `(- ,(car vars)) terms)) + (else + (cons `(* ,(car coeffs) ,(car vars)) terms))))) + ((not (= 0 const)) + `(+ ,p ,const ,@terms)) + ((not (null? terms)) `(+ ,p ,@terms)) + (else p)))) + + (define (gen-header name) + (format port "~%; Definitions for ~S~%~%" name)) + + (define (gen-size name path size atrs) + (let ((sym (mksym name path '(/size)))) + (if (aligned? size 8) + (out `(define-constant ,sym ,(/ size 8))) + (cant sym "Size ~S is not a multiple of 8." size)))) + + (define (gen-enum-defs name path kind size atrs pairs) + ;; In theory the `kind' and `size' can be used here to adjust the + ;; value of the constant. For example, if `kind' is `opaque' + ;; and `size' is 16, we might arrange here to byteswap the value + ;; (assuming that the `-ref' and `-set!' routines join in the + ;; conspiracy). In the Scheme->C version, we treat `opaque' just like + ;; `unsigned'. + (out `(define ,(mksym name path '(/values)) ',pairs)) + (for-each (lambda (pair) + (out `(define-constant ,(mksym name path (list '= (car pair))) + ,(cadr pair)))) + pairs)) + + (define (gen-ptr name path offset dope size atrs) + (let ((sym (mksym name path '(/ptr))) + (ixs (mkixs dope))) + (cond ((not (aligned? size 8)) + (cant sym "Size ~S is not a multiple of 8." size)) + ((not (aligned? offset 8)) + (cant sym "Offset ~S is not a multiple of 8." offset)) + ((there-exists? dope + (lambda (elt) + (not (aligned? (car elt) 8)))) + (cant sym + "Array elements are not aligned on octet boundaries: ~S" + dope)) + (else + ;; No bounds checking on arrays... + (out `(define-in-line (,sym p ,@(reverse ixs)) + ,(mksum 'p + (/ offset 8) + (map (lambda (elt) (/ (car elt) 8)) dope) + ixs))))))) + + (define (gen-refset name path offset dope kind size atrs total-size) + (let ((refsym (mksym name path '(/ref))) + (setsym (mksym name path '(/set!))) + (ixs (mkixs dope)) + (bytes? (and (aligned? size 8) + (aligned? offset 8) + (for-all? dope (lambda (elt) (aligned? (car elt) 8))))) + (signed? (memq kind '(signed signed-8bit-little))) + (littlendian? (memq kind + '(signed-8bit-little unsigned-8bit-little)))) + (cond ((not (memq kind '(opaque + boolean signed unsigned + signed-8bit-little unsigned-8bit-little))) + (cant (list refsym setsym) "Unsupported scalar type: ~S" kind)) + ((and littlendian? (not bytes?)) + (cant (list refsym setsym) + "Unaligned little endian: offset ~S size ~S dope ~S" + offset size dope)) + (bytes? + (let ((size (/ size 8)) + (pexpr (mksum 'p + (/ offset 8) + (map (lambda (elt) (/ (car elt) 8)) dope) + ixs))) + (out `(define-in-line (,refsym b p ,@(reverse ixs)) + (,(if signed? + (if littlendian? + `signed-littlendian-bytefield-ref + `signed-bigendian-bytefield-ref) + (if littlendian? + `unsigned-littlendian-bytefield-ref + `unsigned-bigendian-bytefield-ref)) + b ,pexpr ,size))) + (out `(define-in-line (,setsym b p ,@(reverse ixs) val) + (,(if littlendian? + `littlendian-bytefield-set! + `bigendian-bytefield-set!) + b ,pexpr ,size val))))) + (else + (let ((pexpr (mksum '(* 8 p) offset (map car dope) ixs))) + (out `(define-in-line (,refsym b p ,@(reverse ixs)) + (,(if signed? + (if littlendian? + `signed-littlendian-bitfield-ref + `signed-bigendian-bitfield-ref) + (if littlendian? + `unsigned-littlendian-bitfield-ref + `unsigned-bigendian-bitfield-ref)) + b ,pexpr ,size))) + (out `(define-in-line (,setsym b p ,@(reverse ixs) val) + (,(if littlendian? + `littlendian-bitfield-set! + `bigendian-bitfield-set!) + b ,pexpr ,size val)))))))) + + + (for-each-boilerplate-line + (lambda (line) + (format port "; ~A~%" line))) + (newline port) + (generate-layout gen-header gen-size gen-enum-defs gen-ptr gen-refset) + + ) + +; +; Check the uniqueness of generated names: +; + +(define name-length-limit 31) +(define name-length-table (make-string-hash-table 100)) + +(define (check-name-length name) + (hash-table/modify! + name-length-table + (if (> (string-length name) name-length-limit) + (substring name 0 name-length-limit) + name) + '() + (lambda (l) (cons name l))) + name) + +(define (first-difference s1 s2) + (let ((l1 (string-length s1)) + (l2 (string-length s2))) + (let ((stop (min l1 l2))) + (let loop ((i 0)) + (if (< i stop) + (if (char=? (string-ref s1 i) + (string-ref s2 i)) + (loop (+ 1 i)) + i) + (if (= l1 l2) + #F + i)))))) + +(define (write-n-chars n c port) + (let loop ((n n)) + (when (> n 0) + (write-char c port) + (loop (- n 1))))) + +(define (report-name-length-problems hfile) + (hash-table/for-each name-length-table + (lambda (prefix names) + (cond ((not (null? (cdr names))) + (format (error-output-port) + "Warning: In ~A, the first ~A characters are the same in:~%" + hfile name-length-limit) + (let loop ((names (sort-list! names stringstring (map (lambda (c) + (cond ((char-alphabetic? c) + (char-upcase c)) + ((char-numeric? c) + c) + (else #\_))) + (string->list (pathname-entry-name file))))) + + (define (namify x tail) + (cond ((symbol? x) + ;; -!- Should error check... + (cons* "_" (symbol->string x) tail)) + ((string? x) (cons* "_" x tail)) + ((null? x) tail) + ((pair? x) + ;; Lists are reversed to make it easy to deal with a `path': + (namify (cdr x) (namify (car x) tail))) + (else (err 'layout "Illegal name: ~S" x)))) + + (define (mknam . args) + (check-name-length (apply string-append (cdr (fold namify args))))) + + (define (mkixs l) + (let loop ((in l) + (out '()) + (n 0)) + (if (null? in) + out + (loop (cdr in) + (cons (mks "_X~S_" n) out) + (+ 1 n))))) + + (define (mksum p const coeffs vars) + (let loop ((coeffs coeffs) + (vars vars) + (terms "")) + (cond ((not (null? coeffs)) + (loop (cdr coeffs) + (cdr vars) + (cond ((= 0 (car coeffs)) + terms) + ((= 1 (car coeffs)) + (mks "+(~A)~A" (car vars) terms)) + ((= -1 (car coeffs)) + (mks "-(~A)~A" (car vars) terms)) + ((> 0 (car coeffs)) + (mks "-(~A)*(~A)~A" + (mknum (- (car coeffs))) + (car vars) + terms)) + (else + (mks "+(~A)*(~A)~A" + (mknum (car coeffs)) + (car vars) + terms))))) + ((= 0 const) + (mks "(~A)~A" p terms)) + ((> 0 const) + (mks "(~A)-(~A)~A" p (mknum (- const)) terms)) + (else + (mks "(~A)+(~A)~A" p (mknum const) terms))))) + + (define (mknum n) + (unless (integer? n) + (err 'layout "Not an integer: ~S" n)) + (encode-integer-in-base n 10 "0123456789")) + + (define (mksize size) + (cond ((<= size 8) "08") + ((<= size 16) "16") + ((<= size 32) "32") + (else (err 'layout "Size more than 32: ~S" size)))) + + (define (mkcast size x) + ;; The GLUE_CASTnn() family should cast the value to the same type that + ;; the GLUE_Gxnn() family returns. + (mks "GLUE_CAST~A(~A)" (mksize size) x)) + + (define (mkopaque size n base) + ;; The GLUE_OPAQUEnn() family should return the same type and values as + ;; GLUE_GUnn() returns. + (mks "GLUE_OPAQUE~A(~A)" + (mksize size) + (mkconst size n base))) + + (define (mkconst size n base) + ;; Caller's responsibility to cope with signed/unsigned issues + (mkcast size + (if (zero? n) + "0L" + (mks (case base + ((8) "0~AL") + ((10) "~AL") + ((16) "0x~AL") + (else (err 'layout "Bad base: ~S" base))) + (encode-integer-in-base n base "0123456789ABCDEF"))))) + + ;; The next four deal with extracting a field from a loaded value + + (define (mkldb shift size osize get) + (let ((mask (mkconst osize + (arithmetic-shift (- (arithmetic-shift 1 size) 1) + shift) + 16))) + (cond ((= osize size) get) + ((= 0 shift) + (mkcast size (mks "~A & ~A" + get mask))) + ((= osize (+ size shift)) + (mkcast size (mks "~A >> ~A" + get (mknum shift)))) + (else + (mkcast size (mks "(~A & ~A) >> ~A" + get mask (mknum shift))))))) + + (define (mkdpb shift size osize get val) + (let ((mask (mkconst osize + (arithmetic-shift (- (arithmetic-shift 1 size) 1) + shift) + 16)) + (val (mkcast osize val))) + (cond ((= osize size) val) + ((= 0 shift) + (mks "(~A & ~~~A) | (~A & ~A)" + get mask val mask)) + (else + (mks "(~A & ~~~A) | ((~A << ~A) & ~A)" + get mask val (mknum shift) mask))))) + + (define (mkldbool shift osize get) + (let ((mask (mkconst osize (arithmetic-shift 1 shift) 16))) + (mks "(~A & ~A)" get mask))) + + (define (mkdpbool shift osize get val) + (let ((mask (mkconst osize (arithmetic-shift 1 shift) 16))) + (mks "((~A) ? ~A | ~A : ~A & ~~~A)" val get mask get mask))) + + ;; If you mess with the next three, you better understand all the issues. + ;; These guys decide what bytes to load to obtain a given field. + + (define (byte-offset offset size tsize) + ;; Compute the byte offset most likely to result in an aligned + ;; reference to a quantity at the given offset and size. + ;; (While staying within the object (if possible).) + (let ((ldsize (+ size (modulo offset 8)))) + (cond ((<= ldsize 16) (quotient offset 8)) ;;; 1 or 2 bytes + ((<= ldsize 24) ;;; 3 bytes + (let ((boffset (* 2 (quotient offset 16)))) + ;; If the proposed 32-bit load would take us beyond the end of + ;; the object, and there is room to back up, then back up. + (if (and (> (+ 32 (* 8 boffset)) + tsize) + (>= offset 8)) + (- (quotient offset 8) 1) + boffset))) + ((<= ldsize 32) (quotient offset 8)) ;;; 4 bytes + (else #F)))) ;;; too many + + (define (outer-size offset size) + ;; Compute the size field to load + (let ((ldsize (+ size (modulo offset 8)))) + (cond ((<= ldsize 8) 8) ;;; 1 byte + ((<= ldsize 16) 16) ;;; 2 bytes + ((<= ldsize 32) 32) ;;; 3 or 4 bytes + (else #F)))) ;;; too many + + (define (bit-shift boffset osize offset size) + ;; Compute the bit offset within the loaded field + ;; Note that this is a little-endian quantity! + (- (+ osize (* 8 boffset)) + (+ size offset))) + + ;; Finally, the routines that are actually called by the driver: + + (define (gen-header name) + (out "~%/* Definitions for ~S */~%~%" name)) + + (define (gen-size name path size atrs) + (let ((nam (mknam "SIZEOF" name path))) + (if (aligned? size 8) + (out "#define ~A (~A)~%" nam (mknum (/ size 8))) + (cant nam "Size ~S is not a multiple of 8." size)))) + + (define (gen-enum-defs name path kind size atrs pairs) + ;; `kind' and `size' should be used here to adjust the + ;; value of the constant. For example, if `kind' is `opaque' + ;; and `size' is 16, we might arrange here to byteswap the value + ;; (assuming that the `_REF' and `_SET' routines join in the + ;; conspiracy). + (let ((base (cdr (assq 'base atrs)))) + (for-each (case kind + ((opaque) + (lambda (pair) + (out "#define ~A ~A~%" + (mknam name path "is" (car pair)) + (mkopaque size (cadr pair) base)))) + ((unsigned unsigned-8bit-little) + (lambda (pair) + (out "#define ~A ~A~%" + (mknam name path "is" (car pair)) + (mkconst size (cadr pair) base)))) + (else (cant (mknam name path "is" "*") + "Unsupported scalar type: ~S" kind))) + pairs))) + + (define (gen-ptr name path offset dope size atrs) + (let ((nam (mknam "PTR" name path)) + (ixs (mkixs dope))) + (cond ((not (aligned? size 8)) + (cant nam "Size ~S is not a multiple of 8." size)) + ((not (aligned? offset 8)) + (cant nam "Offset ~S is not a multiple of 8." offset)) + ((there-exists? dope + (lambda (elt) + (not (aligned? (car elt) 8)))) + (cant nam + "Array elements are not aligned on octet boundaries: ~S" + dope)) + (else + ;; No bounds checking on arrays... + (outdefmac nam ixs) + (out ")\\~% (~A)~%" + (mksum "GLUE_CAST_PTR(_P_)" + (/ offset 8) + (map (lambda (elt) (/ (car elt) 8)) dope) + ixs)))))) + + (define (gen-refset name path offset dope kind size atrs total-size) + (let ((getnam (mknam "GET" name path)) + (setnam (mknam "SET" name path)) + (ixs (mkixs dope)) + (boffset (byte-offset offset size total-size)) + (osize (outer-size offset size))) + (cond ((not (memq kind '(opaque boolean unsigned unsigned-8bit-little))) + (cant (list getnam setnam) "Unsupported scalar type: ~S" kind)) + ((> size 32) + (cant (list getnam setnam) + "Size ~S is greater than 32." size)) + ((not (and boffset osize)) + (cant (list getnam setnam) + "Requires load of more than 32 bits: offset ~S size ~S" + offset size)) + ((there-exists? dope + (lambda (elt) + (not (aligned? (car elt) 8)))) + (cant (list getnam setnam) + "Array elements are not aligned on octet boundaries: ~S" + dope)) + ;; For the cases that involve byte swapping in some form, don't + ;; get involved in shifting and masking later: + ((and (memq kind '(opaque unsigned-8bit-little)) + (not (and (aligned? offset 8) + (or (= size 8) + (= size 16) + (= size 32))))) + (cant (list getnam setnam) + "Unaligned ~S: offset ~S size ~S dope ~S" + kind offset size dope)) + (else + (let* ((shift (bit-shift boffset osize offset size)) + (kind-char (case kind + ((opaque) "U") + ((unsigned-8bit-little) "L") + (else "B"))) ; unsigned or boolean + (size-chars (mksize osize)) + (hint24 (cond ((not (= osize 32)) "") + ((<= 8 shift) "MS24") + ((>= 24 (+ shift size)) "LS24") + (else ""))) + (pexpr (mksum "GLUE_CAST_PTR(_P_)" + boffset + (map (lambda (elt) (/ (car elt) 8)) dope) + ixs)) + (getexpr (mks "GLUE_G~A~A~A(~A)" + kind-char size-chars hint24 pexpr))) + (outdefmac getnam ixs) + (out ")\\~% ~A~%" + (if (eq? kind 'boolean) + (mkldbool shift osize getexpr) + (mkldb shift size osize getexpr))) + (outdefmac setnam ixs) + (out ", _V_)\\~% GLUE_S~A~A~A(~A, ~A)~%" + kind-char size-chars hint24 pexpr + (if (eq? kind 'boolean) + (mkdpbool shift osize getexpr "_V_") + (mkdpb shift size osize getexpr "_V_"))) + ))))) + + (let ((h-name (include-check-name hfile)) + (first? #T)) + (for-each-boilerplate-line + (lambda (line) + (cond (first? + (out "/* ~A~%" line) + (set! first? #F)) + (else (out " * ~A~%" line))))) + (unless first? + (out " */~%")) + (when include-check + (out "~%#ifndef ~A~A~%#define ~A~A~%" + include-check h-name + include-check h-name)) + (unless (null? (car layout-working-C-includes)) + (newline port)) + (for-each (lambda (pair) + (if (car pair) + (out "#ifndef ~S~%#include ~S~%#endif~%" + (car pair) + (cdr pair)) + (out "#include ~S~%" (cdr pair)))) + (reverse (car layout-working-C-includes))) + (generate-layout gen-header gen-size gen-enum-defs gen-ptr gen-refset) + (when include-check + (out "~%#endif /* ~A~A */~%" + include-check h-name))) + + (report-name-length-problems hfile) + ) + +; +; Command line interface +; + +(define user-layouts-package #F) + +(define (load-layouts name) + (unless user-layouts-package + (set! user-layouts-package (get-package 'user-layouts))) + (with-interaction-environment user-layouts-package + (lambda () + (load name)))) + +(define (do-layout-command-line args) + (let ((alist (parse-options (cdr args) + '(("-define" arg defs) + ("-makesch" arg schfiles) + ("-makeoldsch" arg oldschfiles) + ("-makeh" arg hfiles) + ("-include-check" arg include-check) + ("-unique-names" arg unique-names))))) + (let ((unique-names (assq 'unique-names alist))) + (unless (null? (cdr unique-names)) + (set! name-length-limit + (string->number (car (last-pair (cdr unique-names))))))) + (for-each load-layouts (cdr (assq 'defs alist))) + (fix-layout-env) + (for-each load-layouts (cdr (assq 'args alist))) + (for-each (lambda (oldschfile) + (call-with-output-file oldschfile + generate-old-s2c-layout-definitions)) + (cdr (assq 'oldschfiles alist))) + (for-each (lambda (schfile) + (call-with-output-file schfile + (lambda (port) + (generate-s2c-layout-definitions port schfile)))) + (cdr (assq 'schfiles alist))) + (let ((include-check (let ((ic (assq 'include-check alist))) + (if (null? (cdr ic)) + #F + (car (last-pair (cdr ic))))))) + (for-each (lambda (hfile) + (call-with-output-file hfile + (lambda (port) + (generate-C-layout-definitions port + hfile + include-check)))) + (cdr (assq 'hfiles alist)))))) + +; $Log: layout.scm,v $ +; Revision 1.1.1.1 2001/11/05 17:47:21 tneale +; Tornado shuffle +; +; Revision 1.3 2001/01/19 22:22:35 paul +; Update copyright. +; +; Revision 1.2 1998/02/25 04:54:24 sra +; Update copyrights. +; +; Revision 1.1 1997/09/26 20:14:39 alan +; Initial Revision +; +; At this point, we migrated from Scheme->C to scsh +; +; Revision 1.17 1997/06/03 22:49:35 alan +; Add support for `define-rcs-info' and boilerplate printing. +; +; Revision 1.16 1997/06/03 02:35:18 alan +; Add `define-layout-macro' so people can define macros in the layout +; language. +; +; Revision 1.15 1997/05/10 20:44:36 alan +; Add `-include-check'. +; +; Revision 1.14 1995/06/08 18:42:43 alan +; Sort enumeration values. +; +; Revision 1.13 1995/06/05 19:51:21 alan +; Totally new output format for -makesch files. -makeoldsch-makeoldsch gets +; the previous format. Less error checking of littlendian scalars -- a +; better theory is needed. +; +; Revision 1.12 1995/05/25 23:51:32 alan +; Types have attribues. Enums have a `base' attribute that controls how +; their constants look in a `.h' file. +; +; Revision 1.11 1995/05/17 22:15:03 alan +; New scheme: .sch files include each other using the directory name +; +; Revision 1.10 1995/05/09 04:33:13 alan +; Be more careful about 24 bit cases. +; +; Revision 1.9 1995/04/24 18:16:34 alan +; Fix "can't" comment. +; +; Revision 1.8 1995/04/19 08:01:42 alan +; Seems to be a working .h file generator. +; Still needs more error checking. +; Only opaque and little-endian of size 8, 16 and 32 actually work. +; +; Revision 1.7 1995/04/09 11:53:11 alan +; First working command line version. +; +; Revision 1.6 1995/04/06 23:19:46 alan +; `generate-s2c-layout-definitions' now works +; +; Revision 1.5 1995/04/05 21:19:23 alan +; More work on `generate-scheme-layout-definitions'. +; +; Revision 1.4 1995/04/03 07:55:55 alan +; Still undebugged... +; +; Revision 1.3 1995/03/31 21:52:38 alan +; First crack at output driver loop -- undebugged +; +; Revision 1.2 1995/03/29 01:09:02 alan +; Tweak format. Redefinition warnings. +; Slot for base type. Boolean type. +; +; Revision 1.1 1995/03/28 19:42:00 alan +; Initial revision + +; Local Variables: +; mode: Scheme +; eval: (put 'sort-list! 'scheme-indent-hook 1) +; eval: (put 'generate-layout 'scheme-indent-hook 0) +; eval: (put 'for-each-boilerplate-line 'scheme-indent-hook 0) +; eval: (put 'with-interaction-environment 'scheme-indent-hook 1) +; End: diff --git a/h/wrn/wm/util/layout/ldbcomp/lists.scm b/h/wrn/wm/util/layout/ldbcomp/lists.scm new file mode 100644 index 0000000..6327b93 --- /dev/null +++ b/h/wrn/wm/util/layout/ldbcomp/lists.scm @@ -0,0 +1,228 @@ +; $Header: /usr/cvsroot/target/h/wrn/wm/util/layout/ldbcomp/lists.scm,v 1.1.1.1 2001/11/05 17:47:21 tneale Exp $ +; List manipulation, mapping, folding, reducing... + +;**************************************************************************** +; +; *** Restricted Rights Legend *** +; +; The programs and information contained herein are licensed only +; pursuant to a license agreement that contains use, reverse +; engineering, disclosure, and other restrictions; accordingly, it +; is "Unpublished--all rights reserved under the applicable +; copyright laws". +; +; Use duplication, or disclosure by the Government is subject to +; restrictions as set forth in subparagraph (c)(1)(ii) of the Rights +; in Technical Data and Computer Licensed Programs clause of DFARS +; 52.227 7013. +; +; Copyright 2000-2001 Wind River Systems, Inc. +; Copyright 1997 Epilogue Technology Corporation. +; Copyright 1998 Integrated Systems, Inc. +; All rights reserved. +; +; *** Government Use *** +; +; The Licensed Programs and their documentation were developed at +; private expense and no part of them is in the public domain. +; +; The Licensed Programs are "Restricted Computer Software" as that +; term is defined in Clause 52.227-19 of the Federal Acquisition +; Regulations (FAR) and are "Commercial Computer Software" as that +; term is defined in Subpart 227.401 of the Department of Defense +; Federal Acquisition Regulation Supplement (DFARS). +; +; (i) If the licensed Programs are supplied to the Department of +; Defense (DoD), the Licensed Programs are classified as +; "Commercial Computer Software" and the Government is acquiring +; only "restricted rights" in the Licensed Programs and their +; documentation as that term is defined in Clause 52.227 +; 7013(c)(1) of the DFARS, and +; +; (ii) If the Licensed Programs are supplied to any unit or agency +; of the United States Government other than DoD, the +; Government's rights in the Licensed Programs and their +; documentation will be as defined in Clause 52.227-19(c)(2) of +; the FAR. +;**************************************************************************** + +(define (last-pair l) + (let loop ((cell l) + (next (cdr l))) + (if (pair? next) + (loop next (cdr next)) + cell))) + +(define (cons* first . rest) + (cond ((null? rest) first) + ((null? (cdr rest)) (cons first (car rest))) + (else (let loop ((a rest) + (b (cdr rest)) + (c (cddr rest))) + (if (null? c) + (set-cdr! a (car b)) + (loop b c (cdr c)))) + (cons first rest)))) + +(define (reverse! lst) + (reverse*! lst '())) + +(define (reverse*! lst tail) + (let loop ((in lst) (out tail)) + (cond ((null? in) out) + ((pair? in) + (let ((x (cdr in))) + (set-cdr! in out) + (loop x in))) + (else (err 'reverse*! "Not a proper list: ~S" in))))) + +(define (reverse* lst tail) + (let loop ((in lst) (out tail)) + (cond ((null? in) out) + ((pair? in) (loop (cdr in) (cons (car in) out))) + (else (err 'reverse* "Not a proper list: ~S" lst))))) + +(define (append! lst tail) + (cond ((pair? lst) + (let loop ((prev lst) (l (cdr lst))) + (if (pair? l) + (loop l (cdr l)) + (set-cdr! prev tail))) + lst) + (else tail))) + +(define (map* tail proc lst) + (let loop ((l lst)) + (cond ((null? l) tail) + ((pair? l) + (cons (proc (car l)) + (loop (cdr l)))) + (else (err 'map* "Not a proper list: ~S" lst))))) + +(define (append-map proc lst) (append-map* '() proc lst)) + +(define (append-map* tail proc lst) + (let loop ((l lst)) + (cond ((null? l) tail) + ((pair? l) + (append (proc (car l)) + (loop (cdr l)))) + (else (err 'append-map* "Not a proper list: ~S" lst))))) + +(define (append-map! proc lst) (append-map*! '() proc lst)) + +(define (append-map*! tail proc lst) + (let loop ((l lst)) + (cond ((null? l) tail) + ((pair? l) + (append! (proc (car l)) + (loop (cdr l)))) + (else (err 'append-map*! "Not a proper list: ~S" lst))))) + +(define (there-exists? list predicate) + (let loop ((list list)) + (and (not (null? list)) + (or (predicate (car list)) + (loop (cdr list)))))) + +(define (for-all? list predicate) + (let loop ((list list)) + (or (null? list) + (and (predicate (car list)) + (loop (cdr list)))))) + +(define (reduce procedure initial list) + (if (null? list) + initial + (let loop ((val (car list)) + (l (cdr list))) + (if (null? l) + val + (loop (procedure val (car l)) + (cdr l)))))) + +(define (reduce-right procedure initial list) + (if (null? list) + initial + (let loop ((first (car list)) + (rest (cdr list))) + (if (null? rest) + first + (procedure first (loop (car rest) (cdr rest))))))) + +(define (reduce-map reduce-proc initial map-proc lst) + (if (null? lst) + initial + (let loop ((val (map-proc (car lst))) + (l (cdr lst))) + (if (null? l) + val + (loop (reduce-proc val (map-proc (car l))) (cdr l)))))) + +(define (reduce-right-map reduce-proc initial map-proc lst) + (if (null? lst) + initial + (let loop ((val (map-proc (car lst))) + (l (cdr lst))) + (if (null? l) + val + (reduce-proc val (loop (map-proc (car l)) (cdr l))))))) + +(define (fold fold-proc lst) + (fold* fold-proc '() lst)) + +(define (fold* fold-proc tail lst) + (let loop ((l lst)) + (cond ((null? l) tail) + ((pair? l) (fold-proc (car l) (loop (cdr l)))) + (else (err 'fold* "Not a proper list: ~S" lst))))) + +(define (fold-map fold-proc map-proc lst) + (fold-map* fold-proc '() map-proc lst)) + +(define (fold-map* fold-proc tail map-proc lst) + (let loop ((l lst)) + (cond ((null? l) tail) + ((pair? l) + (fold-proc (map-proc (car l)) + (loop (cdr l)))) + (else (err 'fold-map* "Not a proper list: ~S" lst))))) + +(define (fold-reverse fold-proc lst) + (fold-reverse* fold-proc '() lst)) + +(define (fold-reverse* fold-proc tail lst) + (let loop ((l lst) + (v tail)) + (cond ((null? l) v) + ((pair? l) (loop (cdr l) (fold-proc (car l) v))) + (else (err 'fold-reverse* "Not a proper list: ~S" lst))))) + +(define (fold-reverse-map fold-proc map-proc lst) + (fold-reverse-map* fold-proc '() map-proc lst)) + +(define (fold-reverse-map* fold-proc tail map-proc lst) + (let loop ((l lst) + (v tail)) + (cond ((null? l) v) + ((pair? l) (loop (cdr l) (fold-proc (map-proc (car l)) v))) + (else (err 'fold-reverse-map* "Not a proper list: ~S" lst))))) + +; $Log: lists.scm,v $ +; Revision 1.1.1.1 2001/11/05 17:47:21 tneale +; Tornado shuffle +; +; Revision 1.3 2001/01/19 22:22:35 paul +; Update copyright. +; +; Revision 1.2 1998/02/25 04:54:27 sra +; Update copyrights. +; +; Revision 1.1 1997/09/26 20:14:40 alan +; Initial Revision +; +; Local Variables: +; mode: Scheme +; eval: (put 'for-all\? 'scheme-indent-hook 1) +; eval: (put 'there-exists\? 'scheme-indent-hook 1) +; End: diff --git a/h/wrn/wm/util/layout/ldbcomp/makefile.cfg b/h/wrn/wm/util/layout/ldbcomp/makefile.cfg new file mode 100644 index 0000000..ceebb80 --- /dev/null +++ b/h/wrn/wm/util/layout/ldbcomp/makefile.cfg @@ -0,0 +1,22 @@ +# +# Make the layout compiler +# + +$#equate(PRODUCTH) + +$#makefile-init() + +$#equate(SCMFILES packages.scm dumpit.scm + utils.scm lists.scm strings.scm match.scm layout.scm) + +all: ldbcomp $#dummy() + +ldbcomp: $(SCMFILES) + $(SCSH) -lm packages.scm -m layout-language -s \ + dumpit.scm $@ $#filepath($(SRCDIR) layout ldbcomp ldbcomp.img) + +sizes: $#dummy() + +clean: $#dummy() + -$(RM) ldbcomp ldbcomp.img +$#clean() diff --git a/h/wrn/wm/util/layout/ldbcomp/match.scm b/h/wrn/wm/util/layout/ldbcomp/match.scm new file mode 100644 index 0000000..25fa2af --- /dev/null +++ b/h/wrn/wm/util/layout/ldbcomp/match.scm @@ -0,0 +1,137 @@ +; $Header: /usr/cvsroot/target/h/wrn/wm/util/layout/ldbcomp/match.scm,v 1.1.1.1 2001/11/05 17:47:21 tneale Exp $ +; Simple matcher + +;**************************************************************************** +; +; *** Restricted Rights Legend *** +; +; The programs and information contained herein are licensed only +; pursuant to a license agreement that contains use, reverse +; engineering, disclosure, and other restrictions; accordingly, it +; is "Unpublished--all rights reserved under the applicable +; copyright laws". +; +; Use duplication, or disclosure by the Government is subject to +; restrictions as set forth in subparagraph (c)(1)(ii) of the Rights +; in Technical Data and Computer Licensed Programs clause of DFARS +; 52.227 7013. +; +; Copyright 2000-2001 Wind River Systems, Inc. +; Copyright 1997 Epilogue Technology Corporation. +; Copyright 1998 Integrated Systems, Inc. +; All rights reserved. +; +; *** Government Use *** +; +; The Licensed Programs and their documentation were developed at +; private expense and no part of them is in the public domain. +; +; The Licensed Programs are "Restricted Computer Software" as that +; term is defined in Clause 52.227-19 of the Federal Acquisition +; Regulations (FAR) and are "Commercial Computer Software" as that +; term is defined in Subpart 227.401 of the Department of Defense +; Federal Acquisition Regulation Supplement (DFARS). +; +; (i) If the licensed Programs are supplied to the Department of +; Defense (DoD), the Licensed Programs are classified as +; "Commercial Computer Software" and the Government is acquiring +; only "restricted rights" in the Licensed Programs and their +; documentation as that term is defined in Clause 52.227 +; 7013(c)(1) of the DFARS, and +; +; (ii) If the Licensed Programs are supplied to any unit or agency +; of the United States Government other than DoD, the +; Government's rights in the Licensed Programs and their +; documentation will be as defined in Clause 52.227-19(c)(2) of +; the FAR. +;**************************************************************************** + +(define (match? pat x) + (cond ((pair? pat) + ((case (car pat) + ((quote) match-quote) + ((?) match-?) + ((*) match-*) + ((+) match-+) + ((or) match-or) + ((and) match-and) + ((not) match-not) + (else match-pair)) + pat x)) + ((symbol? pat) + (case pat + ((any anything) #T) + ((symbol) (symbol? x)) + ((string) (string? x)) + ((symbol/string) (or (symbol? x) (string? x))) ; very common + ((number) (number? x)) + ((integer) (integer? x)) + ((char) (char? x)) + ((pair) (pair? x)) + ((list) (list? x)) + ((boolean) (boolean? x)) + ((vector) (vector? x)) + ;; ((record) (record? x)) + (else (err 'match "Bad pattern: ~S" pat)))) + ((procedure? pat) (pat x)) + (else (eqv? pat x)))) + +(define (match-quote pat x) + (equal? (cadr pat) x)) + +(define (match-? pat x) + (or (and (pair? x) + (match? (cadr pat) (car x)) + (match? (cddr pat) (cdr x))) + (match? (cddr pat) x))) + +(define (match-* pat x) + (let ((p1 (cadr pat)) + (p2 (cddr pat))) + (let loop ((x x)) + (or (match? p2 x) + (and (pair? x) + (match? p1 (car x)) + (loop (cdr x))))))) + +(define (match-+ pat x) + (and (pair? x) + (match? (cadr pat) (car x)) + (match-* pat (cdr x)))) + +(define (match-pair pat x) + (and (pair? x) + (match? (car pat) (car x)) + (match? (cdr pat) (cdr x)))) + +(define (match-or pat x) + (let loop ((l (cdr pat))) + (and (not (null? l)) + (or (match? (car l) x) + (loop (cdr l)))))) + +(define (match-and pat x) + (let loop ((l (cdr pat))) + (or (null? l) + (and (match? (car l) x) + (loop (cdr l)))))) + +(define (match-not pat x) + (not (match? (cadr pat) x))) + +; $Log: match.scm,v $ +; Revision 1.1.1.1 2001/11/05 17:47:21 tneale +; Tornado shuffle +; +; Revision 1.3 2001/01/19 22:22:35 paul +; Update copyright. +; +; Revision 1.2 1998/02/25 04:54:29 sra +; Update copyrights. +; +; Revision 1.1 1997/09/26 20:14:40 alan +; Initial Revision +; +; Local Variables: +; mode: Scheme +; End: diff --git a/h/wrn/wm/util/layout/ldbcomp/packages.scm b/h/wrn/wm/util/layout/ldbcomp/packages.scm new file mode 100644 index 0000000..8dd6573 --- /dev/null +++ b/h/wrn/wm/util/layout/ldbcomp/packages.scm @@ -0,0 +1,167 @@ +; $Header: /usr/cvsroot/target/h/wrn/wm/util/layout/ldbcomp/packages.scm,v 1.1.1.1 2001/11/05 17:47:21 tneale Exp $ +; Package definitions for the layout tool. + +;**************************************************************************** +; +; *** Restricted Rights Legend *** +; +; The programs and information contained herein are licensed only +; pursuant to a license agreement that contains use, reverse +; engineering, disclosure, and other restrictions; accordingly, it +; is "Unpublished--all rights reserved under the applicable +; copyright laws". +; +; Use duplication, or disclosure by the Government is subject to +; restrictions as set forth in subparagraph (c)(1)(ii) of the Rights +; in Technical Data and Computer Licensed Programs clause of DFARS +; 52.227 7013. +; +; Copyright 2000-2001 Wind River Systems, Inc. +; Copyright 1997 Epilogue Technology Corporation. +; Copyright 1998 Integrated Systems, Inc. +; All rights reserved. +; +; *** Government Use *** +; +; The Licensed Programs and their documentation were developed at +; private expense and no part of them is in the public domain. +; +; The Licensed Programs are "Restricted Computer Software" as that +; term is defined in Clause 52.227-19 of the Federal Acquisition +; Regulations (FAR) and are "Commercial Computer Software" as that +; term is defined in Subpart 227.401 of the Department of Defense +; Federal Acquisition Regulation Supplement (DFARS). +; +; (i) If the licensed Programs are supplied to the Department of +; Defense (DoD), the Licensed Programs are classified as +; "Commercial Computer Software" and the Government is acquiring +; only "restricted rights" in the Licensed Programs and their +; documentation as that term is defined in Clause 52.227 +; 7013(c)(1) of the DFARS, and +; +; (ii) If the Licensed Programs are supplied to any unit or agency +; of the United States Government other than DoD, the +; Government's rights in the Licensed Programs and their +; documentation will be as defined in Clause 52.227-19(c)(2) of +; the FAR. +;**************************************************************************** + +(define-structure utils + (export (defmac :syntax) + (comment :syntax) + (define-constant :syntax) + (define-in-line :syntax) + (define-integrable :syntax) + (when :syntax) (unless :syntax) + set-err-should-exit? + err + make-string-hash-table + make-symbol-hash-table + hash-table/lookup + hash-table/get hash-table/put! hash-table/modify! + hash-table/clear! hash-table/for-each + parse-options + ) + ;; Eventually weed some of these out... + (open defrec-package + scsh ; order matters + ;;signals + ;;conditions + ;;handle + tables + ;;sort + scheme + ) + (files utils + )) + +(define-structure lists + (export last-pair cons* + reverse! reverse*! reverse* append! + map* append-map append-map* append-map! append-map*! + there-exists? for-all? + reduce reduce-right reduce-map reduce-right-map + fold fold* fold-map fold-map* + fold-reverse fold-reverse* fold-reverse-map fold-reverse-map* + ) + (open utils + scheme + ) + (files lists + )) + +(define-structure strings + (export string-search-forwards string-ci-search-forwards + string-search-forwards-not string-ci-search-forwards-not + string-search-backwards string-ci-search-backwards + string-search-backwards-not string-ci-search-backwards-not + string-downcase string-downcase! + string-upcase string-upcase! + string-capitalize string-capitalize! + pathname-entry-name pathname-directory-name + pathname-append + pathname-relative? + pathname->list + list->pathname + canonicalize-pathname-list + canonicalize-pathname + symbol-append + encode-integer-in-base + ) + (open lists + utils + scheme + ) + (files strings + )) + +(define-structure match (export match?) + (open utils + scheme + ) + (files match + )) + +(define-structure layout-language (export (define-layout :syntax) + (define-layout-macro :syntax) + define-rcs-info + use-layouts + (C-include :syntax) + ) + (open match + strings + lists + utils + defrec-package + scsh ; order matters + sort + evaluation ; Ick + environments ; Yuck! + package-commands-internal ; Gag!! + scheme + ) + (files layout + )) + +; This is the package we actually load .ldb files into: +(define-structure user-layouts (export) + (open layout-language + scheme + )) + +; $Log: packages.scm,v $ +; Revision 1.1.1.1 2001/11/05 17:47:21 tneale +; Tornado shuffle +; +; Revision 1.3 2001/01/19 22:22:36 paul +; Update copyright. +; +; Revision 1.2 1998/02/25 04:54:31 sra +; Update copyrights. +; +; Revision 1.1 1997/09/26 20:14:41 alan +; Initial Revision +; +; Local Variables: +; mode: Scheme +; End: diff --git a/h/wrn/wm/util/layout/ldbcomp/strings.scm b/h/wrn/wm/util/layout/ldbcomp/strings.scm new file mode 100644 index 0000000..9b67fb9 --- /dev/null +++ b/h/wrn/wm/util/layout/ldbcomp/strings.scm @@ -0,0 +1,302 @@ +; $Header: /usr/cvsroot/target/h/wrn/wm/util/layout/ldbcomp/strings.scm,v 1.1.1.1 2001/11/05 17:47:21 tneale Exp $ +; Strings and pathnames + +;**************************************************************************** +; +; *** Restricted Rights Legend *** +; +; The programs and information contained herein are licensed only +; pursuant to a license agreement that contains use, reverse +; engineering, disclosure, and other restrictions; accordingly, it +; is "Unpublished--all rights reserved under the applicable +; copyright laws". +; +; Use duplication, or disclosure by the Government is subject to +; restrictions as set forth in subparagraph (c)(1)(ii) of the Rights +; in Technical Data and Computer Licensed Programs clause of DFARS +; 52.227 7013. +; +; Copyright 2000-2001 Wind River Systems, Inc. +; Copyright 1997 Epilogue Technology Corporation. +; Copyright 1998 Integrated Systems, Inc. +; All rights reserved. +; +; *** Government Use *** +; +; The Licensed Programs and their documentation were developed at +; private expense and no part of them is in the public domain. +; +; The Licensed Programs are "Restricted Computer Software" as that +; term is defined in Clause 52.227-19 of the Federal Acquisition +; Regulations (FAR) and are "Commercial Computer Software" as that +; term is defined in Subpart 227.401 of the Department of Defense +; Federal Acquisition Regulation Supplement (DFARS). +; +; (i) If the licensed Programs are supplied to the Department of +; Defense (DoD), the Licensed Programs are classified as +; "Commercial Computer Software" and the Government is acquiring +; only "restricted rights" in the Licensed Programs and their +; documentation as that term is defined in Clause 52.227 +; 7013(c)(1) of the DFARS, and +; +; (ii) If the Licensed Programs are supplied to any unit or agency +; of the United States Government other than DoD, the +; Government's rights in the Licensed Programs and their +; documentation will be as defined in Clause 52.227-19(c)(2) of +; the FAR. +;**************************************************************************** + +; +; Case +; + +(define (string-upcase str) + (let* ((len (string-length str)) + (new (make-string len))) + (do ((i (- len 1) (- i 1))) + ((< i 0)) + (string-set! new i (char-upcase (string-ref str i)))) + new)) + +(define (string-downcase str) + (let* ((len (string-length str)) + (new (make-string len))) + (do ((i (- len 1) (- i 1))) + ((< i 0)) + (string-set! new i (char-downcase (string-ref str i)))) + new)) + +(define (string-upcase! str) + (do ((i (- (string-length str) 1) (- i 1))) + ((< i 0)) + (string-set! str i (char-upcase (string-ref str i)))) + str) + +(define (string-downcase! str) + (do ((i (- (string-length str) 1) (- i 1))) + ((< i 0)) + (string-set! str i (char-downcase (string-ref str i)))) + str) + +(define (string-capitalize str) + (let* ((len (string-length str)) + (new (make-string len))) + (let loop ((i 0) + (last-alpha? #F)) + (when (< i len) + (let ((c (string-ref str i))) + (string-set! new i (if last-alpha? + (char-downcase c) + (char-upcase c))) + (loop (+ i 1) (char-alphabetic? c))))) + new)) + +(define (string-capitalize! str) + (let ((len (string-length str))) + (let loop ((i 0) + (last-alpha? #F)) + (when (< i len) + (let ((c (string-ref str i))) + (string-set! str i (if last-alpha? + (char-downcase c) + (char-upcase c))) + (loop (+ i 1) (char-alphabetic? c))))) + str)) + +; +; Searching +; + +; These all assume that you won't pass bogus values of `beg' and `end'. +; It is safe to compare characters using `eq?' in Scheme48... + +(define (string-search-forwards chr str beg end) + (let loop ((i beg)) + (cond ((>= i end) #F) + ((eq? chr (string-ref str i)) i) + (else (loop (+ i 1)))))) + +(define (string-search-forwards-not chr str beg end) + (let loop ((i beg)) + (cond ((>= i end) #F) + ((not (eq? chr (string-ref str i))) i) + (else (loop (+ i 1)))))) + +(define (string-search-backwards chr str beg end) + (let loop ((i (- end 1))) + (cond ((< i beg) #F) + ((eq? chr (string-ref str i)) i) + (else (loop (- i 1)))))) + +(define (string-search-backwards-not chr str beg end) + (let loop ((i (- end 1))) + (cond ((< i beg) #F) + ((not (eq? chr (string-ref str i))) i) + (else (loop (- i 1)))))) + +; And the -ci versions: + +(define (string-ci-search-forwards chr str beg end) + (let loop ((i beg)) + (cond ((>= i end) #F) + ((char-ci=? chr (string-ref str i)) i) + (else (loop (+ i 1)))))) + +(define (string-ci-search-forwards-not chr str beg end) + (let loop ((i beg)) + (cond ((>= i end) #F) + ((not (char-ci=? chr (string-ref str i))) i) + (else (loop (+ i 1)))))) + +(define (string-ci-search-backwards chr str beg end) + (let loop ((i (- end 1))) + (cond ((< i beg) #F) + ((char-ci=? chr (string-ref str i)) i) + (else (loop (- i 1)))))) + +(define (string-ci-search-backwards-not chr str beg end) + (let loop ((i (- end 1))) + (cond ((< i beg) #F) + ((not (char-ci=? chr (string-ref str i))) i) + (else (loop (- i 1)))))) + +; +; Pathnames +; + +(define (pathname-entry-name pathname) + (let* ((len (string-length pathname)) + (j (string-search-backwards-not #\/ pathname 0 len))) + (if (not j) + "." + (let ((i (string-search-backwards #\/ pathname 0 j))) + (if (not i) + (substring pathname 0 (+ 1 j)) + (substring pathname (+ 1 i) (+ 1 j))))))) + +(define (pathname-directory-name pathname) + ;; Always ends with a "/", both for convenience in concatenation, and so + ;; that the root directory has a non-empty name. + (let* ((len (string-length pathname)) + (j (string-search-backwards-not #\/ pathname 0 len))) + (if (not j) + "/" + (let ((i (string-search-backwards #\/ pathname 0 j))) + (if (not i) + "./" + (let ((h (string-search-backwards-not #\/ pathname 0 i))) + (if (not h) + "/" + (substring pathname 0 (+ h 2))))))))) + +(define (pathname-append pn1 pn2) + (let ((len1 (string-length pn1)) + (len2 (string-length pn2))) + (cond ((= 0 len1) pn2) + ((= 0 len2) pn1) + ((eq? #\/ (string-ref pn2 0)) pn2) + ((eq? #\/ (string-ref pn1 (- len1 1))) + (string-append pn1 pn2)) + (else (string-append pn1 "/" pn2))))) + +(define (pathname-relative? pn) + (or (= 0 (string-length pn)) + (not (eq? #\/ (string-ref pn 0))))) + +(define (pathname->list pathname) + (let ((end (string-length pathname))) + (if (= 0 end) + '(relative) + (cons (if (eq? #\/ (string-ref pathname 0)) + 'absolute + 'relative) + (let loop ((beg 0)) + (let ((i (string-search-forwards-not #\/ pathname beg end))) + (if (not i) + '() + (let ((j (string-search-forwards #\/ pathname i end))) + (if (not j) + (list (substring pathname i end)) + (cons (substring pathname i j) + (loop j))))))))))) + +(define (list->pathname lst) + (define (process lst) + (if (null? lst) + '() + (cons* "/" (car lst) (process (cdr lst))))) + (case (car lst) + ((absolute) + (if (null? (cdr lst)) + "/" + (apply string-append (process (cdr lst))))) + ((relative) + (if (null? (cdr lst)) + "." + (apply string-append (cdr (process (cdr lst)))))) + (else (err 'list->pathname "Bad pathname list: ~S" lst)))) + +(define (canonicalize-pathname-list lst) + (let loop ((l (cdr lst)) + (p '()) + (r '())) + (cond ((null? l) + (cons (car lst) (append! p (reverse! r)))) + ((string=? "." (car l)) + (loop (cdr l) p r)) + ((string=? ".." (car l)) + (if (null? r) + (loop (cdr l) (cons ".." p) r) + (loop (cdr l) p (cdr r)))) + (else + (loop (cdr l) p (cons (car l) r)))))) + +(define (canonicalize-pathname pathname) + (list->pathname (canonicalize-pathname-list (pathname->list pathname)))) + +; +; Making things into strings +; +(define (symbol-append . args) + (define (->string arg) + (cond ((string? arg) arg) + ((symbol? arg) (symbol->string arg)) + ((char? arg) (string arg)) + ((and (integer? arg) (exact? arg)) + (number->string arg 10)) + (else (err 'symbol-append "Don't know how to use: ~S" arg)))) + (string->symbol (apply string-append (map ->string args)))) + +(define (encode-integer-in-base n base digits) + (define (loop n l) + (if (< n base) + (cons (string-ref digits n) l) + (loop (quotient n base) + (cons (string-ref digits (modulo n base)) l)))) + (unless (integer? n) + (err 'encode-integer-in-base "Not an integer: ~S" n)) + (unless (and (integer? base) (> base 1)) + (err 'encode-integer-in-base "Bad base: ~S" base)) + (unless (<= base (string-length digits)) + (err 'encode-integer-in-base "Not enough digits for base ~S: ~S" + base digits)) + (list->string (if (< n 0) + (cons #\- (loop (- n) '())) + (loop n '())))) + +; $Log: strings.scm,v $ +; Revision 1.1.1.1 2001/11/05 17:47:21 tneale +; Tornado shuffle +; +; Revision 1.3 2001/01/19 22:22:36 paul +; Update copyright. +; +; Revision 1.2 1998/02/25 04:54:33 sra +; Update copyrights. +; +; Revision 1.1 1997/09/26 20:14:41 alan +; Initial Revision +; +; Local Variables: +; mode: Scheme +; End: diff --git a/h/wrn/wm/util/layout/ldbcomp/utils.scm b/h/wrn/wm/util/layout/ldbcomp/utils.scm new file mode 100644 index 0000000..0b58940 --- /dev/null +++ b/h/wrn/wm/util/layout/ldbcomp/utils.scm @@ -0,0 +1,233 @@ +; $Header: /usr/cvsroot/target/h/wrn/wm/util/layout/ldbcomp/utils.scm,v 1.1.1.1 2001/11/05 17:47:21 tneale Exp $ +; Utilities for the layout tool. + +;**************************************************************************** +; +; *** Restricted Rights Legend *** +; +; The programs and information contained herein are licensed only +; pursuant to a license agreement that contains use, reverse +; engineering, disclosure, and other restrictions; accordingly, it +; is "Unpublished--all rights reserved under the applicable +; copyright laws". +; +; Use duplication, or disclosure by the Government is subject to +; restrictions as set forth in subparagraph (c)(1)(ii) of the Rights +; in Technical Data and Computer Licensed Programs clause of DFARS +; 52.227 7013. +; +; Copyright 2000-2001 Wind River Systems, Inc. +; Copyright 1997 Epilogue Technology Corporation. +; Copyright 1998 Integrated Systems, Inc. +; All rights reserved. +; +; *** Government Use *** +; +; The Licensed Programs and their documentation were developed at +; private expense and no part of them is in the public domain. +; +; The Licensed Programs are "Restricted Computer Software" as that +; term is defined in Clause 52.227-19 of the Federal Acquisition +; Regulations (FAR) and are "Commercial Computer Software" as that +; term is defined in Subpart 227.401 of the Department of Defense +; Federal Acquisition Regulation Supplement (DFARS). +; +; (i) If the licensed Programs are supplied to the Department of +; Defense (DoD), the Licensed Programs are classified as +; "Commercial Computer Software" and the Government is acquiring +; only "restricted rights" in the Licensed Programs and their +; documentation as that term is defined in Clause 52.227 +; 7013(c)(1) of the DFARS, and +; +; (ii) If the Licensed Programs are supplied to any unit or agency +; of the United States Government other than DoD, the +; Government's rights in the Licensed Programs and their +; documentation will be as defined in Clause 52.227-19(c)(2) of +; the FAR. +;**************************************************************************** + +; +; Macrology +; + +(define-syntax defmac + (syntax-rules () + ((defmac (name . bvl) def) + (define-syntax name + (syntax-rules () + ((name . bvl) def)))))) + +(defmac (comment . stuff) + (quote (comment))) + +(defmac (define-constant . stuff) + (define . stuff)) + +(defmac (define-in-line (name . bvl) expr) + (define-syntax name + (syntax-rules () + ((name . bvl) expr)))) + +(defmac (define-integrable . stuff) + (define . stuff)) + +(defmac (when test first . rest) + (if test (begin first . rest))) + +(defmac (unless test first . rest) + (if (not test) (begin first . rest))) + +; +; Errors +; + +(define err-should-exit? #F) + +(define (set-err-should-exit? flag) + (set! err-should-exit? flag)) + +(define (err id format-string . format-args) + (format (error-output-port) "layout: ") + (unless (eq? id 'layout) + (format (error-output-port) "~A: " id)) + (apply format (error-output-port) format-string format-args) + (cond (err-should-exit? + (newline (error-output-port)) + (exit 1)) + (else + (apply error format-string format-args)))) + +; +; (Hash) Tables +; + +(define-record hash-table + table + init + ) + +(define (make-string-hash-table initial-size) + (make-hash-table (make-string-table) make-string-table)) + +(define (make-symbol-hash-table initial-size) + (make-hash-table (make-symbol-table) make-symbol-table)) + +(define (hash-table/clear! table) + (set-hash-table:table table ((hash-table:init table)))) + +(define (hash-table/get table key default) + (let ((cell (table-ref (hash-table:table table) key))) + (if cell (car cell) default))) + +(define (hash-table/put! table key value) + (let* ((table (hash-table:table table)) + (cell (table-ref table key))) + (if cell + (set-car! cell value) + (table-set! table key (list value))))) + +(define (hash-table/modify! table key default proc) + (let* ((table (hash-table:table table)) + (cell (table-ref table key))) + (if cell + (set-car! cell (proc (car cell))) + (table-set! table key (list (proc default)))))) + +(define (hash-table/lookup table key win lose) + (let ((cell (table-ref (hash-table:table table) key))) + (if cell + (win (car cell)) + (lose)))) + +(define (hash-table/for-each table procedure) + (table-walk (lambda (key cell) + (procedure key (car cell))) + (hash-table:table table))) + +; +; Operating system interface +; + +(define (parse-options args specs) + ;; each spec is of the form: ("-foo" foo) + ;; "--" is understood + ;; Possible s: + ;; #F or FLAG boolean flag + ;; #T or ARG next argument is the value + ;; EXEC arguments up to ";" are values + ;; (like "find ... -exec ... \;". Yuck!) + (let ((alist (let loop ((alist '()) + (specs specs)) + (if (null? specs) + alist + (case (cadr (car specs)) + ((#F flag) + (loop alist (cdr specs))) + ((arg #T exec) + (loop (cons (cons (caddr (car specs)) '()) alist) + (cdr specs))) + (else + (err 'parse-options "bad spec: ~S" (car specs)))))))) + (define (add prop vals) + (let ((p (assq prop alist))) + (if p + (set-cdr! p (append (cdr p) vals)) + (set! alist (cons (cons prop vals) alist))))) + (let loop ((args args)) + (if (null? args) + (add 'args '()) + (let ((opt (car args))) + (if (and (<= 2 (string-length opt)) + (char=? #\- (string-ref opt 0))) + (let ((spec (assoc opt specs))) + (cond (spec + (case (cadr spec) + ((#F flag) + (add (caddr spec) '()) + (loop (cdr args))) + ((#T arg) + (when (null? (cdr args)) + (err 'parse-options + "option requires argument: ~A" opt)) + (add (caddr spec) (list (cadr args))) + (loop (cddr args))) + ((exec) + (let l ((args (cdr args)) + (vals '())) + (cond ((null? args) + (err 'parse-options + "missing `;': ~A" opt)) + ((string=? ";" (car args)) + (add (caddr spec) (list (reverse vals))) + (loop (cdr args))) + (else + (l (cdr args) (cons (car args) vals)))))) + (else + (err 'parse-options + "unknown option type: ~A" (cadr spec))))) + ((string=? opt "--") + (add 'args (cdr args))) + (else + (err 'parse-options "unknown option: ~A" opt)))) + (add 'args args))))) + alist)) + +; $Log: utils.scm,v $ +; Revision 1.1.1.1 2001/11/05 17:47:21 tneale +; Tornado shuffle +; +; Revision 1.3 2001/01/19 22:22:36 paul +; Update copyright. +; +; Revision 1.2 1998/02/25 04:54:36 sra +; Update copyrights. +; +; Revision 1.1 1997/09/26 20:14:41 alan +; Initial Revision +; +; Local Variables: +; mode: Scheme +; eval: (put 'hash-table/modify! 'scheme-indent-hook 3) +; eval: (put 'hash-table/lookup 'scheme-indent-hook 2) +; eval: (put 'hash-table/for-each 'scheme-indent-hook 1) +; End: diff --git a/h/wrn/wm/util/layout/ldbglue.h b/h/wrn/wm/util/layout/ldbglue.h new file mode 100644 index 0000000..7bdba47 --- /dev/null +++ b/h/wrn/wm/util/layout/ldbglue.h @@ -0,0 +1,272 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/layout/ldbglue.h,v 1.2 2003/01/15 14:00:24 josh Exp $ + * Byte manipulation glue macros + */ + +/**************************************************************************** + * + * *** Restricted Rights Legend *** + * + * The programs and information contained herein are licensed only + * pursuant to a license agreement that contains use, reverse + * engineering, disclosure, and other restrictions; accordingly, it + * is "Unpublished--all rights reserved under the applicable + * copyright laws". + * + * Use duplication, or disclosure by the Government is subject to + * restrictions as set forth in subparagraph (c)(1)(ii) of the Rights + * in Technical Data and Computer Licensed Programs clause of DFARS + * 52.227 7013. + * + * Copyright 2000-2001 Wind River Systems, Inc. + * Copyright 1995-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + * + * *** Government Use *** + * + * The Licensed Programs and their documentation were developed at + * private expense and no part of them is in the public domain. + * + * The Licensed Programs are "Restricted Computer Software" as that + * term is defined in Clause 52.227-19 of the Federal Acquisition + * Regulations (FAR) and are "Commercial Computer Software" as that + * term is defined in Subpart 227.401 of the Department of Defense + * Federal Acquisition Regulation Supplement (DFARS). + * + * (i) If the licensed Programs are supplied to the Department of + * Defense (DoD), the Licensed Programs are classified as + * "Commercial Computer Software" and the Government is acquiring + * only "restricted rights" in the Licensed Programs and their + * documentation as that term is defined in Clause 52.227 + * 7013(c)(1) of the DFARS, and + * + * (ii) If the Licensed Programs are supplied to any unit or agency + * of the United States Government other than DoD, the + * Government's rights in the Licensed Programs and their + * documentation will be as defined in Clause 52.227-19(c)(2) of + * the FAR. + ****************************************************************************/ + +/* + * $Log: ldbglue.h,v $ + * Revision 1.2 2003/01/15 14:00:24 josh + * directory structure shifting + * + * Revision 1.1.1.1 2001/11/05 17:47:20 tneale + * Tornado shuffle + * + * Revision 1.12 2001/01/23 01:42:59 paul + * Reworked 'set' macros to avoid evaluating arguments multiple times. + * + * Revision 1.11 2001/01/19 22:22:33 paul + * Update copyright. + * + * Revision 1.10 2000/03/17 00:16:06 meister + * Update copyright message + * + * Revision 1.9 1998/06/08 18:00:42 sra + * Get rid of some lingering references. + * + * Revision 1.8 1998/02/25 04:54:04 sra + * Update copyrights. + * + * Revision 1.7 1997/09/26 20:23:39 alan + * Be certain about install.h and types.h + * + * Revision 1.6 1997/06/04 05:46:28 alan + * Fix RCS keywords. + * + * Revision 1.5 1997/06/03 23:02:48 alan + * Fix RCS keywords. + * + * Revision 1.4 1997/05/16 03:47:17 alan + * Add extra casts for bogus compilers. + * + * Revision 1.3 1997/05/14 06:30:56 alan + * Multiple inclusion check. + * + * Revision 1.2 1997/04/22 00:18:34 alan + * Fix copyright. + * + * Revision 1.1 1997/04/19 03:56:16 alan + * Layout glue macros. + * + * Revision 1.2 1997/01/24 22:21:42 alan + * Add extra parens for bogus compilers. + * + * Revision 1.1 1995/08/19 06:35:30 alan + * Add `glue.h' -- generic byte manipulation glue macros + */ + +#ifndef EPILOGUE_LAYOUT_LDBGLUE_H +#define EPILOGUE_LAYOUT_LDBGLUE_H + +#ifndef EPILOGUE_INSTALL_H +#include +#endif + +#ifndef EPILOGUE_TYPES_H +#include +#endif + +#if (INSTALL_OEM_LAYOUT_GLUE_MACROS + INSTALL_UNALIGNED_BIGENDIAN_LAYOUT_GLUE_MACROS + INSTALL_TYPECHECKING_LAYOUT_GLUE_MACROS) > 1 +#error "You can only ask for -one- kind of layout glue macros." +#endif + +#if INSTALL_OEM_LAYOUT_GLUE_MACROS + +#include + +#elif INSTALL_UNALIGNED_BIGENDIAN_LAYOUT_GLUE_MACROS + +#error "Need to write unaligned bigendian layout glue macros." + +#elif INSTALL_TYPECHECKING_LAYOUT_GLUE_MACROS + +#error "Need to write typechecking layout glue macros." + +#else /* INSTALL_(generic)_LAYOUT_GLUE_MACROS */ + +/* Here are the completely generic layout glue macros. + * These should work on -any- hardware. + */ + +#define GLUE_CAST_PTR(p) ((bits8_t *) (p)) +#define GLUE_CAST08(v) ((ldb_int8_t) (v)) +#define GLUE_CAST16(v) ((ldb_int16_t) (v)) +#define GLUE_CAST32(v) ((ldb_int32_t) (v)) + +/* ---- Generic Get ---- */ + +/* Seemingly redundant parentheses are needed for some buggy compilers + * (irix 5.2). Leave them alone! + */ + +#define GLUE_GB08(p) ((ldb_int8_t)((p)[0])) + +#define GLUE_GB16(p) ( ((ldb_int16_t)((p)[0]) << 8) \ + | ((ldb_int16_t)((p)[1]) )) + +#define GLUE_GB32(p) ( ((ldb_int32_t)((p)[0]) << 24) \ + | ((ldb_int32_t)((p)[1]) << 16) \ + | ((ldb_int32_t)((p)[2]) << 8) \ + | ((ldb_int32_t)((p)[3]) )) + +#define GLUE_GB32LS24(p) ( ((ldb_int32_t)((p)[1]) << 16) \ + | ((ldb_int32_t)((p)[2]) << 8) \ + | ((ldb_int32_t)((p)[3]) )) + +#define GLUE_GB32MS24(p) ( ((ldb_int32_t)((p)[0]) << 24) \ + | ((ldb_int32_t)((p)[1]) << 16) \ + | ((ldb_int32_t)((p)[2]) << 8)) + +#define GLUE_GL08(p) ((ldb_int8_t)((p)[0])) + +#define GLUE_GL16(p) ( ((ldb_int16_t)((p)[1]) << 8) \ + | ((ldb_int16_t)((p)[0]) )) + +#define GLUE_GL32(p) ( ((ldb_int32_t)((p)[3]) << 24) \ + | ((ldb_int32_t)((p)[2]) << 16) \ + | ((ldb_int32_t)((p)[1]) << 8) \ + | ((ldb_int32_t)((p)[0]) )) + +#define GLUE_GL32LS24(p) ( ((ldb_int32_t)((p)[2]) << 16) \ + | ((ldb_int32_t)((p)[1]) << 8) \ + | ((ldb_int32_t)((p)[0]) )) + +#define GLUE_GL32MS24(p) ( ((ldb_int32_t)((p)[3]) << 24) \ + | ((ldb_int32_t)((p)[2]) << 16) \ + | ((ldb_int32_t)((p)[1]) << 8)) + +/* ---- Generic Set ---- */ + +/* Seemingly unnecessary casts to bits8_t are needed for some + * buggy compilers (GCC 2.6.3). Leave them alone! + */ + +#define GLUE_SB08(p, v) ((p)[0] = ((bits8_t) (v))) + +#define GLUE_SB16(p, v) do { \ + bits16_t _v_ = (bits16_t)(v); \ + (p)[0] = ((bits8_t) ((_v_) >> 8)); \ + (p)[1] = ((bits8_t) ((_v_) )); \ + } while (0) + +#define GLUE_SB32(p, v) do { \ + bits32_t _v_ = (bits32_t)(v); \ + (p)[0] = ((bits8_t) ((_v_) >> 24)); \ + (p)[1] = ((bits8_t) ((_v_) >> 16)); \ + (p)[2] = ((bits8_t) ((_v_) >> 8)); \ + (p)[3] = ((bits8_t) ((_v_) )); \ + } while (0) + +#define GLUE_SB32LS24(p, v) do { \ + bits32_t _v_ = (bits32_t)(v); \ + (p)[1] = ((bits8_t) ((_v_) >> 16)); \ + (p)[2] = ((bits8_t) ((_v_) >> 8)); \ + (p)[3] = ((bits8_t) ((_v_) )); \ + } while (0) + +#define GLUE_SB32MS24(p, v) do { \ + bits32_t _v_ = (bits32_t)(v); \ + (p)[0] = ((bits8_t) ((v) >> 24)); \ + (p)[1] = ((bits8_t) ((v) >> 16)); \ + (p)[2] = ((bits8_t) ((v) >> 8)); \ + } while (0) + +#define GLUE_SL08(p, v) ((p)[0] = ((bits8_t) (v))) + +#define GLUE_SL16(p, v) do { \ + bits16_t _v_ = (bits16_t)(v); \ + (p)[1] = ((bits8_t) ((_v_) >> 8)); \ + (p)[0] = ((bits8_t) ((_v_) )); \ + } while (0) + +#define GLUE_SL32(p, v) do { \ + bits32_t _v_ = (bits32_t)(v); \ + (p)[3] = ((bits8_t) ((_v_) >> 24)); \ + (p)[2] = ((bits8_t) ((_v_) >> 16)); \ + (p)[1] = ((bits8_t) ((_v_) >> 8)); \ + (p)[0] = ((bits8_t) ((_v_) )); \ + } while (0) + +#define GLUE_SL32LS24(p, v) do { \ + bits32_t _v_ = (bits32_t)(v); \ + (p)[2] = ((bits8_t) ((_v_) >> 16)); \ + (p)[1] = ((bits8_t) ((_v_) >> 8)); \ + (p)[0] = ((bits8_t) ((_v_) )); \ + } while (0) + +#define GLUE_SL32MS24(p, v) do { \ + bits32_t _v_ = (bits32_t)(v); \ + (p)[3] = ((bits8_t) ((_v_) >> 24)); \ + (p)[2] = ((bits8_t) ((_v_) >> 16)); \ + (p)[1] = ((bits8_t) ((_v_) >> 8)); \ + } while (0) + +/* ---- Generic Opaque values ---- */ + +/* Since the GLUE_OPAQUEnn macros are defined to take bigendian arguments, + * the easiest implementation of opaque values is to just define + * them to be the same as bigendian values! + */ + +#define GLUE_GU08 GLUE_GB08 +#define GLUE_GU16 GLUE_GB16 +#define GLUE_GU32 GLUE_GB32 +#define GLUE_GU32LS24 GLUE_GB32LS24 +#define GLUE_GU32MS24 GLUE_GB32MS24 + +#define GLUE_SU08 GLUE_SB08 +#define GLUE_SU16 GLUE_SB16 +#define GLUE_SU32 GLUE_SB32 +#define GLUE_SU32LS24 GLUE_SB32LS24 +#define GLUE_SU32MS24 GLUE_SB32MS24 + +#define GLUE_OPAQUE08(v) (v) +#define GLUE_OPAQUE16(v) (v) +#define GLUE_OPAQUE32(v) (v) + +#endif /* INSTALL_(whatever)_LAYOUT_GLUE_MACROS */ + +#endif /* EPILOGUE_LAYOUT_LDBGLUE_H */ diff --git a/h/wrn/wm/util/layout/makefile.cfg b/h/wrn/wm/util/layout/makefile.cfg new file mode 100644 index 0000000..deb64cc --- /dev/null +++ b/h/wrn/wm/util/layout/makefile.cfg @@ -0,0 +1,55 @@ +# +# Top-level makefile for layouts +# + +$#equate(LAYOUT_DIRS ldbcomp) + +$##make-makefiles($#@($#(LAYOUT_DIRS))) + +$#equate(HFILES agentx.h apple.h arp.h bgp.h chaos.h dhcp.h dns.h + ethernet.h ip.h ip6.h netime.h ppp.h rip.h + secure.h tftp.h) + +$#equate(LDBCOMP $#filepath(ldbcomp ldbcomp)) + +$#equate(PRODUCTH) + +$#makefile-init() + +.SUFFIXES: .ldb + +.ldb.h: + $(LDBCOMP) -include-check "EPILOGUE_LAYOUT_" -makeh $@ $*.ldb + +all: subdirs $(HFILES) $#objs(test) $#dummy() + +subdirs: $#dummy() +$##make-all($#@($#(LAYOUT_DIRS))) + +sizes: $#dummy() +$##make-sizes($#@($#(LAYOUT_DIRS))) + +clean: $#dummy() + -$(RM) $#objs(test) +$#clean()$##make-clean($#@($#(LAYOUT_DIRS))) + +realclean: $#dummy() + -$(RM) $(HFILES) + +agentx.h: agentx.ldb +apple.h: apple.ldb +arp.h: arp.ldb +bgp.h: bgp.ldb ip.ldb +chaos.h: chaos.ldb +dhcp.h: dhcp.ldb +dns.h: dns.ldb +ethernet.h: ethernet.ldb +ip.h: ip.ldb +ip6.h: ip6.ldb ip.ldb +netime.h: netime.ldb +ppp.h: ppp.ldb +rip.h: rip.ldb ip.ldb +secure.h: secure.ldb ip.ldb +tftp.h: tftp.ldb + +$#objs(test): test.c $#filepath($(SRCDIR) install.h) $#filepath($(SRCDIR) common h types.h) ldbglue.h $(HFILES) diff --git a/h/wrn/wm/util/layout/netime.h b/h/wrn/wm/util/layout/netime.h new file mode 100644 index 0000000..3bbd786 --- /dev/null +++ b/h/wrn/wm/util/layout/netime.h @@ -0,0 +1,33 @@ +/* This file was automatically generated by Epilogue Technology's + * network datastructure layout tool. + * + * DO NOT MODIFY THIS FILE BY HAND. + * + * Source file information: + * Id: netime.ldb,v 1.1 1998/04/08 17:01:14 wes Exp + */ + +#ifndef EPILOGUE_LAYOUT_NETIME_H +#define EPILOGUE_LAYOUT_NETIME_H + +#ifndef EPILOGUE_INSTALL_H +#include +#endif +#ifndef EPILOGUE_TYPES_H +#include +#endif +#ifndef EPILOGUE_LAYOUT_LDBGLUE_H +#include +#endif + +/* Definitions for NETIME_MESSAGE */ + +#define SIZEOF_NETIME_MESSAGE (4) +#define PTR_NETIME_MESSAGE_TIMESTAMP(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_NETIME_MESSAGE_TIMESTAMP(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))) +#define SET_NETIME_MESSAGE_TIMESTAMP(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_)), GLUE_CAST32(_V_)) + +#endif /* EPILOGUE_LAYOUT_NETIME_H */ diff --git a/h/wrn/wm/util/layout/netime.ldb b/h/wrn/wm/util/layout/netime.ldb new file mode 100644 index 0000000..05ec05b --- /dev/null +++ b/h/wrn/wm/util/layout/netime.ldb @@ -0,0 +1,14 @@ +(define-rcs-info "$Id: netime.ldb,v 1.1.1.1 2001/11/05 17:47:20 tneale Exp $") + +(C-include EPILOGUE_INSTALL_H ) +(C-include EPILOGUE_TYPES_H ) +(C-include EPILOGUE_LAYOUT_LDBGLUE_H ) + +(define-layout NETIME_MESSAGE + (struct (field TIMESTAMP (unsigned 32)))) + + +; Local Variables: +; mode: Scheme +; End: + diff --git a/h/wrn/wm/util/layout/ppp.h b/h/wrn/wm/util/layout/ppp.h new file mode 100644 index 0000000..8b64779 --- /dev/null +++ b/h/wrn/wm/util/layout/ppp.h @@ -0,0 +1,202 @@ +/* This file was automatically generated by Epilogue Technology's + * network datastructure layout tool. + * + * DO NOT MODIFY THIS FILE BY HAND. + * + * Source file information: + * Id: ppp.ldb,v 1.4 1999/08/16 18:53:32 bala Exp + */ + +#ifndef EPILOGUE_LAYOUT_PPP_H +#define EPILOGUE_LAYOUT_PPP_H + +#ifndef EPILOGUE_INSTALL_H +#include +#endif +#ifndef EPILOGUE_TYPES_H +#include +#endif +#ifndef EPILOGUE_LAYOUT_LDBGLUE_H +#include +#endif + +/* Definitions for PPP_STRING */ + +#define SIZEOF_PPP_STRING (1) +#define PTR_PPP_STRING_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_PPP_STRING_LENGTH(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_PPP_STRING_LENGTH(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define PTR_PPP_STRING_VALUE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define SIZEOF_PPP_STRING_VALUE (0) + +/* Definitions for PPP_CHAP_HDR */ + +#define SIZEOF_PPP_CHAP_HDR (4) +#define PTR_PPP_CHAP_HDR_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_PPP_CHAP_HDR_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_PPP_CHAP_HDR_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define PPP_CHAP_HDR_CODE_is_CHALLENGE GLUE_CAST08(1L) +#define PPP_CHAP_HDR_CODE_is_RESPONSE GLUE_CAST08(2L) +#define PPP_CHAP_HDR_CODE_is_SUCCESS GLUE_CAST08(3L) +#define PPP_CHAP_HDR_CODE_is_FAILURE GLUE_CAST08(4L) +#define PTR_PPP_CHAP_HDR_ID(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_PPP_CHAP_HDR_ID(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_PPP_CHAP_HDR_ID(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define PTR_PPP_CHAP_HDR_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_PPP_CHAP_HDR_LENGTH(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(2)) +#define SET_PPP_CHAP_HDR_LENGTH(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST16(_V_)) +#define PTR_PPP_CHAP_HDR_DATA(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define SIZEOF_PPP_CHAP_HDR_DATA (0) + +/* Definitions for PPP_LCP_OPT_AUTH_CHAP */ + +#define SIZEOF_PPP_LCP_OPT_AUTH_CHAP (5) +#define PTR_PPP_LCP_OPT_AUTH_CHAP_ALGORITHM(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_PPP_LCP_OPT_AUTH_CHAP_ALGORITHM(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(4)) +#define SET_PPP_LCP_OPT_AUTH_CHAP_ALGORITHM(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST08(_V_)) +#define PPP_LCP_OPT_AUTH_CHAP_ALGORITHM_is_MD5 GLUE_CAST08(5L) +#define PPP_LCP_OPT_AUTH_CHAP_ALGORITHM_is_MSCHAP GLUE_CAST08(128L) + +/* Definitions for PPP_PAP_HDR */ + +#define SIZEOF_PPP_PAP_HDR (4) +#define PTR_PPP_PAP_HDR_CODE(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_PPP_PAP_HDR_CODE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_PPP_PAP_HDR_CODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define PPP_PAP_HDR_CODE_is_REQUEST GLUE_CAST08(1L) +#define PPP_PAP_HDR_CODE_is_ACK GLUE_CAST08(2L) +#define PPP_PAP_HDR_CODE_is_NAK GLUE_CAST08(3L) +#define PTR_PPP_PAP_HDR_ID(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_PPP_PAP_HDR_ID(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_PPP_PAP_HDR_ID(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define PTR_PPP_PAP_HDR_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_PPP_PAP_HDR_LENGTH(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(2)) +#define SET_PPP_PAP_HDR_LENGTH(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST16(_V_)) +#define PTR_PPP_PAP_HDR_DATA(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define SIZEOF_PPP_PAP_HDR_DATA (0) + +/* Definitions for PPP_LCP_OPT_AUTH_PAP */ + +#define SIZEOF_PPP_LCP_OPT_AUTH_PAP (4) + +/* Definitions for PPP_LCP_OPT_ACFC */ + +#define SIZEOF_PPP_LCP_OPT_ACFC (2) + +/* Definitions for PPP_LCP_OPT_PFC */ + +#define SIZEOF_PPP_LCP_OPT_PFC (2) + +/* Definitions for PPP_LCP_OPT_MAGIC_NUMBER */ + +#define SIZEOF_PPP_LCP_OPT_MAGIC_NUMBER (6) +#define PTR_PPP_LCP_OPT_MAGIC_NUMBER_NUMBER(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_PPP_LCP_OPT_MAGIC_NUMBER_NUMBER(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(2)) +#define SET_PPP_LCP_OPT_MAGIC_NUMBER_NUMBER(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST32(_V_)) + +/* Definitions for PPP_LCP_OPT_QUALITY */ + +#define SIZEOF_PPP_LCP_OPT_QUALITY (4) +#define PTR_PPP_LCP_OPT_QUALITY_PROTO(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_PPP_LCP_OPT_QUALITY_PROTO(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(2)) +#define SET_PPP_LCP_OPT_QUALITY_PROTO(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST16(_V_)) +#define PPP_LCP_OPT_QUALITY_PROTO_is_LQR GLUE_CAST16(49189L) +#define PTR_PPP_LCP_OPT_QUALITY_DATA(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define SIZEOF_PPP_LCP_OPT_QUALITY_DATA (0) + +/* Definitions for PPP_LCP_OPT_AUTH */ + +#define SIZEOF_PPP_LCP_OPT_AUTH (4) +#define PTR_PPP_LCP_OPT_AUTH_PROTO(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_PPP_LCP_OPT_AUTH_PROTO(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(2)) +#define SET_PPP_LCP_OPT_AUTH_PROTO(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST16(_V_)) +#define PPP_LCP_OPT_AUTH_PROTO_is_PAP GLUE_CAST16(49187L) +#define PPP_LCP_OPT_AUTH_PROTO_is_CHAP GLUE_CAST16(49699L) +#define PTR_PPP_LCP_OPT_AUTH_DATA(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define SIZEOF_PPP_LCP_OPT_AUTH_DATA (0) + +/* Definitions for PPP_LCP_OPT_ACCM */ + +#define SIZEOF_PPP_LCP_OPT_ACCM (6) +#define PTR_PPP_LCP_OPT_ACCM_ACCM(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_PPP_LCP_OPT_ACCM_ACCM(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(2)) +#define SET_PPP_LCP_OPT_ACCM_ACCM(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST32(_V_)) + +/* Definitions for PPP_LCP_OPT_MRU */ + +#define SIZEOF_PPP_LCP_OPT_MRU (4) +#define PTR_PPP_LCP_OPT_MRU_MRU(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_PPP_LCP_OPT_MRU_MRU(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(2)) +#define SET_PPP_LCP_OPT_MRU_MRU(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST16(_V_)) + +/* Definitions for PPP_LCP_OPT */ + +#define SIZEOF_PPP_LCP_OPT (2) +#define PTR_PPP_LCP_OPT_TYPE(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_PPP_LCP_OPT_TYPE(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_PPP_LCP_OPT_TYPE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define PPP_LCP_OPT_TYPE_is_MRU GLUE_CAST08(1L) +#define PPP_LCP_OPT_TYPE_is_ACCM GLUE_CAST08(2L) +#define PPP_LCP_OPT_TYPE_is_AUTH GLUE_CAST08(3L) +#define PPP_LCP_OPT_TYPE_is_QUALITY GLUE_CAST08(4L) +#define PPP_LCP_OPT_TYPE_is_MAGIC_NUMBER GLUE_CAST08(5L) +#define PPP_LCP_OPT_TYPE_is_PFC GLUE_CAST08(7L) +#define PPP_LCP_OPT_TYPE_is_ACFC GLUE_CAST08(8L) +#define PTR_PPP_LCP_OPT_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_PPP_LCP_OPT_LENGTH(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_PPP_LCP_OPT_LENGTH(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define PTR_PPP_LCP_OPT_DATA(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define SIZEOF_PPP_LCP_OPT_DATA (0) + +#endif /* EPILOGUE_LAYOUT_PPP_H */ diff --git a/h/wrn/wm/util/layout/ppp.ldb b/h/wrn/wm/util/layout/ppp.ldb new file mode 100644 index 0000000..06deeae --- /dev/null +++ b/h/wrn/wm/util/layout/ppp.ldb @@ -0,0 +1,198 @@ +; $Header: /usr/cvsroot/target/h/wrn/wm/util/layout/ppp.ldb,v 1.1.1.1 2001/11/05 17:47:20 tneale Exp $ + +;**************************************************************************** +; +; *** Restricted Rights Legend *** +; +; The programs and information contained herein are licensed only +; pursuant to a license agreement that contains use, reverse +; engineering, disclosure, and other restrictions; accordingly, it +; is "Unpublished--all rights reserved under the applicable +; copyright laws". +; +; Use duplication, or disclosure by the Government is subject to +; restrictions as set forth in subparagraph (c)(1)(ii) of the Rights +; in Technical Data and Computer Licensed Programs clause of DFARS +; 52.227 7013. +; +; Copyright 2000-2001 Wind River Systems, Inc. +; Copyright 1997 Epilogue Technology Corporation. +; Copyright 1998 Integrated Systems, Inc. +; All rights reserved. +; +; *** Government Use *** +; +; The Licensed Programs and their documentation were developed at +; private expense and no part of them is in the public domain. +; +; The Licensed Programs are "Restricted Computer Software" as that +; term is defined in Clause 52.227-19 of the Federal Acquisition +; Regulations (FAR) and are "Commercial Computer Software" as that +; term is defined in Subpart 227.401 of the Department of Defense +; Federal Acquisition Regulation Supplement (DFARS). +; +; (i) If the licensed Programs are supplied to the Department of +; Defense (DoD), the Licensed Programs are classified as +; "Commercial Computer Software" and the Government is acquiring +; only "restricted rights" in the Licensed Programs and their +; documentation as that term is defined in Clause 52.227 +; 7013(c)(1) of the DFARS, and +; +; (ii) If the Licensed Programs are supplied to any unit or agency +; of the United States Government other than DoD, the +; Government's rights in the Licensed Programs and their +; documentation will be as defined in Clause 52.227-19(c)(2) of +; the FAR. +;**************************************************************************** + +; $Log: ppp.ldb,v $ +; Revision 1.1.1.1 2001/11/05 17:47:20 tneale +; Tornado shuffle +; +; Revision 1.7 2001/01/19 22:22:33 paul +; Update copyright. +; +; Revision 1.6 2000/10/16 19:21:14 paul +; Restore Bala's new PPP. +; +; Revision 1.5 2000/03/13 21:21:50 paul +; Removed some code that we are no longer working on. +; +; Revision 1.4 1999/08/16 18:53:32 bala +; MSCHAP option value added +; +; Revision 1.3 1998/02/25 15:21:41 sra +; Finish moving types.h, bug.h, and bugdef.h to common/h/. +; +; Revision 1.2 1998/02/25 04:54:06 sra +; Update copyrights. +; +; Revision 1.1 1997/11/18 03:18:34 sra +; Brand new PAP and CHAP code for PPP. +; + +(define-rcs-info "$Id: ppp.ldb,v 1.1.1.1 2001/11/05 17:47:20 tneale Exp $") + +(C-include EPILOGUE_INSTALL_H ) +(C-include EPILOGUE_TYPES_H ) +(C-include EPILOGUE_LAYOUT_LDBGLUE_H ) + +; Eventually this should include all the header definitions +; for PPP, for now it's just the ones I need, primarily PAP and CHAP. +; +; I'm trying a new idiom for nested headers, using (fill (sizeof ...)) +; as a form of class inheritance instead of the N-level-deep unions of +; structs that we've used elsewhere. Dunno if it'll work, but if it +; does perhaps it'll be easier to understand. + +; LCP option negotiations + +(define-layout PPP_LCP_OPT + (struct (size (* 2 8)) + (field TYPE (enum (type (unsigned 8)) + (value MRU 1) + (value ACCM 2) + (value AUTH 3) + (value QUALITY 4) + (value MAGIC_NUMBER 5) + (value PFC 7) + (value ACFC 8) + )) + (field LENGTH (unsigned 8)) + (field DATA (struct (size 0))))) + +(define-layout PPP_LCP_OPT_MRU + (struct (size (* 4 8)) + (fill (sizeof PPP_LCP_OPT)) + (field MRU (unsigned 16)))) + +(define-layout PPP_LCP_OPT_ACCM + (struct (size (* 6 8)) + (fill (sizeof PPP_LCP_OPT)) + (field ACCM (unsigned 32)))) + +(define-layout PPP_LCP_OPT_AUTH + (struct (size (* 4 8)) + (fill (sizeof PPP_LCP_OPT)) + (field PROTO (enum (type (unsigned 16)) + (value PAP #xC023) + (value CHAP #xC223))) + (field DATA (struct (size 0))))) + +(define-layout PPP_LCP_OPT_QUALITY + (struct (size (* 4 8)) + (fill (sizeof PPP_LCP_OPT)) + (field PROTO (enum (type (unsigned 16)) + (value LQR #xc025))) + (field DATA (struct (size 0))))) + +(define-layout PPP_LCP_OPT_MAGIC_NUMBER + (struct (size (* 6 8)) + (fill (sizeof PPP_LCP_OPT)) + (field NUMBER (unsigned 32)))) + +(define-layout PPP_LCP_OPT_PFC + (struct (size (* 2 8)) + (fill (sizeof PPP_LCP_OPT)))) + +(define-layout PPP_LCP_OPT_ACFC + (struct (size (* 2 8)) + (fill (sizeof PPP_LCP_OPT)))) + +; Authentication protocol headers + +; Password Authentication Protocol (RFC-1334) + +(define-layout PPP_LCP_OPT_AUTH_PAP + (struct (size (* 4 8)) + (fill (sizeof PPP_LCP_OPT_AUTH)))) + +(define-layout PPP_PAP_HDR + (struct (size (* 4 8)) + (field CODE (enum (type (unsigned 8)) + (value REQUEST 1) + (value ACK 2) + (value NAK 3))) + (field ID (unsigned 8)) + (field LENGTH (unsigned 16)) + (field DATA (struct (size 0))) + ; Rest of packet is variable format + )) + +; Challenge Handshake Authentication Protococl (RFC-1994) + +(define-layout PPP_LCP_OPT_AUTH_CHAP + (struct (size (* 5 8)) + (fill (sizeof PPP_LCP_OPT_AUTH)) + (field ALGORITHM (enum (type (unsigned 8)) + (value MD5 5) + (value MSCHAP #x80))))) +(define-layout PPP_CHAP_HDR + (struct (size (* 4 8)) + (field CODE (enum (type (unsigned 8)) + (value CHALLENGE 1) + (value RESPONSE 2) + (value SUCCESS 3) + (value FAILURE 4))) + (field ID (unsigned 8)) + (field LENGTH (unsigned 16)) + (field DATA (struct (size 0))) + ; Rest of packet is variable format + )) + + +; Random data type + +(define-layout PPP_STRING + ; This is a bit of a crock, but better than the alternatives. + ; To make things even more crockish, the various PPP options + ; aren't consistant about whether they use this format or just + ; expect you to figure out the length from the packet size. + (struct (size (* 1 8)) + (field LENGTH (unsigned 8)) + (field VALUE (struct (size 0))))) + + +; Local Variables: +; mode: Scheme +; End: diff --git a/h/wrn/wm/util/layout/rip.h b/h/wrn/wm/util/layout/rip.h new file mode 100644 index 0000000..1aebb1c --- /dev/null +++ b/h/wrn/wm/util/layout/rip.h @@ -0,0 +1,137 @@ +/* This file was automatically generated by Epilogue Technology's + * network datastructure layout tool. + * + * DO NOT MODIFY THIS FILE BY HAND. + * + * Source file information: + * Id: rip.ldb,v 1.7 1998/02/25 15:21:41 sra Exp + * --used -- + * Id: ip.ldb,v 1.17 1998/02/25 15:21:40 sra Exp + */ + +#ifndef EPILOGUE_LAYOUT_RIP_H +#define EPILOGUE_LAYOUT_RIP_H + +#ifndef EPILOGUE_INSTALL_H +#include +#endif +#ifndef EPILOGUE_TYPES_H +#include +#endif +#ifndef EPILOGUE_LAYOUT_LDBGLUE_H +#include +#endif + +/* Definitions for TRIGGER_RIP_HEADER */ + +#define SIZEOF_TRIGGER_RIP_HEADER (8) +#define PTR_TRIGGER_RIP_HEADER_VERSION(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_TRIGGER_RIP_HEADER_VERSION(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(4)) +#define SET_TRIGGER_RIP_HEADER_VERSION(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST08(_V_)) +#define PTR_TRIGGER_RIP_HEADER_FLUSH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(5)) +#define GET_TRIGGER_RIP_HEADER_FLUSH(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(5)) +#define SET_TRIGGER_RIP_HEADER_FLUSH(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(5), GLUE_CAST08(_V_)) +#define PTR_TRIGGER_RIP_HEADER_SEQUENCE_NUMBER(_P_)\ + ((GLUE_CAST_PTR(_P_))+(6)) +#define GET_TRIGGER_RIP_HEADER_SEQUENCE_NUMBER(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(6)) +#define SET_TRIGGER_RIP_HEADER_SEQUENCE_NUMBER(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(6), GLUE_CAST16(_V_)) +#define PTR_TRIGGER_RIP_HEADER_ENTRIES(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define SIZEOF_TRIGGER_RIP_HEADER_ENTRIES (0) +#define PTR_TRIGGER_RIP_HEADER_ENTRIES_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(8)+(20)*(_X0_)) + +/* Definitions for RIP_HEADER */ + +#define SIZEOF_RIP_HEADER (4) +#define PTR_RIP_HEADER_CMD(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_RIP_HEADER_CMD(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_RIP_HEADER_CMD(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define RIP_HEADER_CMD_is_REQUEST GLUE_CAST08(1L) +#define RIP_HEADER_CMD_is_RESPONSE GLUE_CAST08(2L) +#define RIP_HEADER_CMD_is_TRACEON GLUE_CAST08(3L) +#define RIP_HEADER_CMD_is_TRACEOFF GLUE_CAST08(4L) +#define RIP_HEADER_CMD_is_SUN_RESERVED GLUE_CAST08(5L) +#define RIP_HEADER_CMD_is_UPDATE_REQUEST GLUE_CAST08(9L) +#define RIP_HEADER_CMD_is_UPDATE_RESPONSE GLUE_CAST08(10L) +#define RIP_HEADER_CMD_is_UPDATE_ACKNOWLEDGE GLUE_CAST08(11L) +#define PTR_RIP_HEADER_VERSION(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_RIP_HEADER_VERSION(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_RIP_HEADER_VERSION(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define PTR_RIP_HEADER_UNUSED(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_RIP_HEADER_UNUSED(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(2)) +#define SET_RIP_HEADER_UNUSED(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST16(_V_)) +#define PTR_RIP_HEADER_ENTRIES(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define SIZEOF_RIP_HEADER_ENTRIES (0) +#define PTR_RIP_HEADER_ENTRIES_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(4)+(20)*(_X0_)) + +/* Definitions for RIP_AUTH_ENTRY */ + +#define SIZEOF_RIP_AUTH_ENTRY (20) +#define PTR_RIP_AUTH_ENTRY_AUTHENTICATION_TYPE(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_RIP_AUTH_ENTRY_AUTHENTICATION_TYPE(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(2)) +#define SET_RIP_AUTH_ENTRY_AUTHENTICATION_TYPE(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST16(_V_)) +#define RIP_AUTH_ENTRY_AUTHENTICATION_TYPE_is_PASSWORD GLUE_CAST16(2L) +#define PTR_RIP_AUTH_ENTRY_DATA(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define SIZEOF_RIP_AUTH_ENTRY_DATA (16) +#define PTR_RIP_AUTH_ENTRY_DATA_ELT(_P_, _X0_)\ + ((GLUE_CAST_PTR(_P_))+(4)+(_X0_)) +#define GET_RIP_AUTH_ENTRY_DATA_ELT(_P_, _X0_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(4)+(_X0_)) +#define SET_RIP_AUTH_ENTRY_DATA_ELT(_P_, _X0_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(4)+(_X0_), GLUE_CAST08(_V_)) + +/* Definitions for RIP_ENTRY */ + +#define SIZEOF_RIP_ENTRY (20) +#define PTR_RIP_ENTRY_ADDRESS_FAMILY(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_RIP_ENTRY_ADDRESS_FAMILY(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))) +#define SET_RIP_ENTRY_ADDRESS_FAMILY(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_)), GLUE_CAST16(_V_)) +#define RIP_ENTRY_ADDRESS_FAMILY_is_IP GLUE_CAST16(2L) +#define RIP_ENTRY_ADDRESS_FAMILY_is_AUTHENTICATION GLUE_CAST16(65535L) +#define PTR_RIP_ENTRY_ROUTE_TAG(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_RIP_ENTRY_ROUTE_TAG(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(2)) +#define SET_RIP_ENTRY_ROUTE_TAG(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST16(_V_)) +#define PTR_RIP_ENTRY_ADDRESS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define PTR_RIP_ENTRY_MASK(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define PTR_RIP_ENTRY_NEXT_HOP(_P_)\ + ((GLUE_CAST_PTR(_P_))+(12)) +#define PTR_RIP_ENTRY_METRIC(_P_)\ + ((GLUE_CAST_PTR(_P_))+(16)) +#define GET_RIP_ENTRY_METRIC(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(16)) +#define SET_RIP_ENTRY_METRIC(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(16), GLUE_CAST32(_V_)) + +#endif /* EPILOGUE_LAYOUT_RIP_H */ diff --git a/h/wrn/wm/util/layout/rip.ldb b/h/wrn/wm/util/layout/rip.ldb new file mode 100644 index 0000000..2a1dd62 --- /dev/null +++ b/h/wrn/wm/util/layout/rip.ldb @@ -0,0 +1,140 @@ +; $Header: /usr/cvsroot/target/h/wrn/wm/util/layout/rip.ldb,v 1.1.1.1 2001/11/05 17:47:20 tneale Exp $ +; Layout information for RIP + +;**************************************************************************** +; +; *** Restricted Rights Legend *** +; +; The programs and information contained herein are licensed only +; pursuant to a license agreement that contains use, reverse +; engineering, disclosure, and other restrictions; accordingly, it +; is "Unpublished--all rights reserved under the applicable +; copyright laws". +; +; Use duplication, or disclosure by the Government is subject to +; restrictions as set forth in subparagraph (c)(1)(ii) of the Rights +; in Technical Data and Computer Licensed Programs clause of DFARS +; 52.227 7013. +; +; Copyright 2000-2001 Wind River Systems, Inc. +; Copyright 1997 Epilogue Technology Corporation. +; Copyright 1998 Integrated Systems, Inc. +; All rights reserved. +; +; *** Government Use *** +; +; The Licensed Programs and their documentation were developed at +; private expense and no part of them is in the public domain. +; +; The Licensed Programs are "Restricted Computer Software" as that +; term is defined in Clause 52.227-19 of the Federal Acquisition +; Regulations (FAR) and are "Commercial Computer Software" as that +; term is defined in Subpart 227.401 of the Department of Defense +; Federal Acquisition Regulation Supplement (DFARS). +; +; (i) If the licensed Programs are supplied to the Department of +; Defense (DoD), the Licensed Programs are classified as +; "Commercial Computer Software" and the Government is acquiring +; only "restricted rights" in the Licensed Programs and their +; documentation as that term is defined in Clause 52.227 +; 7013(c)(1) of the DFARS, and +; +; (ii) If the Licensed Programs are supplied to any unit or agency +; of the United States Government other than DoD, the +; Government's rights in the Licensed Programs and their +; documentation will be as defined in Clause 52.227-19(c)(2) of +; the FAR. +;**************************************************************************** + +; $Log: rip.ldb,v $ +; Revision 1.1.1.1 2001/11/05 17:47:20 tneale +; Tornado shuffle +; +; Revision 1.8 2001/01/19 22:22:34 paul +; Update copyright. +; +; Revision 1.7 1998/02/25 15:21:41 sra +; Finish moving types.h, bug.h, and bugdef.h to common/h/. +; +; Revision 1.6 1998/02/25 04:54:09 sra +; Update copyrights. +; +; Revision 1.5 1998/02/20 04:02:38 sra +; Fix too-long layout macro names. +; +; Revision 1.4 1997/09/26 20:21:16 alan +; Use features of new layout compiler: `use-layouts' and `C-include'. +; +; Revision 1.3 1997/06/04 05:46:30 alan +; Fix RCS keywords. +; +; Revision 1.2 1997/06/03 22:59:36 alan +; Use `define-rcs-info'. +; +; Revision 1.1 1997/04/22 00:07:00 alan +; Initial Revision + +(define-rcs-info "$Id: rip.ldb,v 1.1.1.1 2001/11/05 17:47:20 tneale Exp $") + +(use-layouts "ip.ldb") + +(C-include EPILOGUE_INSTALL_H ) +(C-include EPILOGUE_TYPES_H ) +(C-include EPILOGUE_LAYOUT_LDBGLUE_H ) + +(define-layout RIP_ENTRY + (struct (size (* 5 32)) ; error check + (field ADDRESS_FAMILY (enum (type (unsigned 16)) + (value IP 2) + (value AUTHENTICATION #xFFFF))) + (field ROUTE_TAG (unsigned 16)) ; MBZ in v1 + (field ADDRESS IP_ADDRESS) + (field MASK IP_ADDRESS) ; MBZ in v1 + (field NEXT_HOP IP_ADDRESS) ; MBZ in v1 + (field METRIC (unsigned 32)) ; 0 .. 16, where 16 = infinity... + )) + +(define-layout RIP_AUTH_ENTRY + (struct (size (sizeof RIP_ENTRY)) ; error check + (fill 16) ; #xFFFF + (field AUTHENTICATION_TYPE (enum (type (unsigned 16)) + (value PASSWORD 2))) + (field DATA (array (count 16) (type (unsigned 8)))) + )) + +(define-layout RIP_HEADER + (struct (size 32) ; error check + (field CMD (enum (type (unsigned 8)) + (value REQUEST 1) + (value RESPONSE 2) + (value TRACEON 3) ; obsolete + (value TRACEOFF 4) ; obsolete + (value SUN_RESERVED 5) ; Ask SUN... + ;; What happened to 6, 7 & 8? + (value UPDATE_REQUEST 9) + (value UPDATE_RESPONSE 10) + (value UPDATE_ACKNOWLEDGE 11) + )) + (field VERSION (unsigned 8)) + (field UNUSED (unsigned 16)) ; MBZ in verison 1 + (field ENTRIES (array (count 0) + (type RIP_ENTRY))))) + +; A TRIGGER_RIP_HEADER is used in the case where the +; COMMAND is one of the UPDATE_* cases. It is defined to include +; the word that contains the plain RIP_HEADER, so that you don't +; have to do any additional pointer gyrations to get at the values +; in the update header. + +(define-layout TRIGGER_RIP_HEADER + (struct (size (* 2 32)) ; error check + (fill (sizeof RIP_HEADER)) + (field VERSION (unsigned 8)) + (field FLUSH (unsigned 8)) + (field SEQUENCE_NUMBER (unsigned 16)) + (field ENTRIES (array (count 0) + (type RIP_ENTRY))))) + +; Local Variables: +; mode: Scheme +; End: diff --git a/h/wrn/wm/util/layout/secure.h b/h/wrn/wm/util/layout/secure.h new file mode 100644 index 0000000..9e4a62c --- /dev/null +++ b/h/wrn/wm/util/layout/secure.h @@ -0,0 +1,63 @@ +/* This file was automatically generated by Epilogue Technology's + * network datastructure layout tool. + * + * DO NOT MODIFY THIS FILE BY HAND. + * + * Source file information: + * Id: secure.ldb,v 1.8 1998/02/25 15:21:42 sra Exp + * --used -- + * Id: ip.ldb,v 1.17 1998/02/25 15:21:40 sra Exp + */ + +#ifndef EPILOGUE_LAYOUT_SECURE_H +#define EPILOGUE_LAYOUT_SECURE_H + +#ifndef EPILOGUE_INSTALL_H +#include +#endif +#ifndef EPILOGUE_TYPES_H +#include +#endif +#ifndef EPILOGUE_LAYOUT_LDBGLUE_H +#include +#endif + +/* Definitions for IP_ESP_HEADER */ + +#define SIZEOF_IP_ESP_HEADER (4) +#define PTR_IP_ESP_HEADER_SPI(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_IP_ESP_HEADER_SPI(_P_)\ + GLUE_GU32((GLUE_CAST_PTR(_P_))) +#define SET_IP_ESP_HEADER_SPI(_P_, _V_)\ + GLUE_SU32((GLUE_CAST_PTR(_P_)), GLUE_CAST32(_V_)) +#define PTR_IP_ESP_HEADER_DATA(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define SIZEOF_IP_ESP_HEADER_DATA (0) + +/* Definitions for IP_AUTH_HEADER */ + +#define SIZEOF_IP_AUTH_HEADER (8) +#define PTR_IP_AUTH_HEADER_NEXT_HEADER(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_IP_AUTH_HEADER_NEXT_HEADER(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))) +#define SET_IP_AUTH_HEADER_NEXT_HEADER(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), GLUE_CAST08(_V_)) +#define PTR_IP_AUTH_HEADER_LENGTH(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_IP_AUTH_HEADER_LENGTH(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_IP_AUTH_HEADER_LENGTH(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define PTR_IP_AUTH_HEADER_SPI(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_IP_AUTH_HEADER_SPI(_P_)\ + GLUE_GU32((GLUE_CAST_PTR(_P_))+(4)) +#define SET_IP_AUTH_HEADER_SPI(_P_, _V_)\ + GLUE_SU32((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST32(_V_)) +#define PTR_IP_AUTH_HEADER_DATA(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define SIZEOF_IP_AUTH_HEADER_DATA (0) + +#endif /* EPILOGUE_LAYOUT_SECURE_H */ diff --git a/h/wrn/wm/util/layout/secure.ldb b/h/wrn/wm/util/layout/secure.ldb new file mode 100644 index 0000000..7d2937d --- /dev/null +++ b/h/wrn/wm/util/layout/secure.ldb @@ -0,0 +1,108 @@ +; $Header: /usr/cvsroot/target/h/wrn/wm/util/layout/secure.ldb,v 1.1.1.1 2001/11/05 17:47:20 tneale Exp $ +; Layout information for IP Security protocols (AH, ESP, ...) + +;**************************************************************************** +; +; *** Restricted Rights Legend *** +; +; The programs and information contained herein are licensed only +; pursuant to a license agreement that contains use, reverse +; engineering, disclosure, and other restrictions; accordingly, it +; is "Unpublished--all rights reserved under the applicable +; copyright laws". +; +; Use duplication, or disclosure by the Government is subject to +; restrictions as set forth in subparagraph (c)(1)(ii) of the Rights +; in Technical Data and Computer Licensed Programs clause of DFARS +; 52.227 7013. +; +; Copyright 2000-2001 Wind River Systems, Inc. +; Copyright 1996-1997 Epilogue Technology Corporation. +; Copyright 1998 Integrated Systems, Inc. +; All rights reserved. +; +; *** Government Use *** +; +; The Licensed Programs and their documentation were developed at +; private expense and no part of them is in the public domain. +; +; The Licensed Programs are "Restricted Computer Software" as that +; term is defined in Clause 52.227-19 of the Federal Acquisition +; Regulations (FAR) and are "Commercial Computer Software" as that +; term is defined in Subpart 227.401 of the Department of Defense +; Federal Acquisition Regulation Supplement (DFARS). +; +; (i) If the licensed Programs are supplied to the Department of +; Defense (DoD), the Licensed Programs are classified as +; "Commercial Computer Software" and the Government is acquiring +; only "restricted rights" in the Licensed Programs and their +; documentation as that term is defined in Clause 52.227 +; 7013(c)(1) of the DFARS, and +; +; (ii) If the Licensed Programs are supplied to any unit or agency +; of the United States Government other than DoD, the +; Government's rights in the Licensed Programs and their +; documentation will be as defined in Clause 52.227-19(c)(2) of +; the FAR. +;**************************************************************************** + +; $Log: secure.ldb,v $ +; Revision 1.1.1.1 2001/11/05 17:47:20 tneale +; Tornado shuffle +; +; Revision 1.9 2001/01/19 22:22:34 paul +; Update copyright. +; +; Revision 1.8 1998/02/25 15:21:42 sra +; Finish moving types.h, bug.h, and bugdef.h to common/h/. +; +; Revision 1.7 1998/02/25 04:54:11 sra +; Update copyrights. +; +; Revision 1.6 1997/09/26 20:21:16 alan +; Use features of new layout compiler: `use-layouts' and `C-include'. +; +; Revision 1.5 1997/06/04 05:46:31 alan +; Fix RCS keywords. +; +; Revision 1.4 1997/06/03 22:59:37 alan +; Use `define-rcs-info'. +; +; Revision 1.3 1997/04/22 20:58:12 alan +; Use `(struct (size 0))' where appropriate. +; +; Revision 1.2 1997/04/22 00:18:35 alan +; Fix copyright. +; +; Revision 1.1 1997/04/19 04:12:17 alan +; Move all .ldb files into the `layout' directory. +; +; Revision 1.1 1996/12/02 22:16:58 alan +; Initial Revision + +(define-rcs-info "$Id: secure.ldb,v 1.1.1.1 2001/11/05 17:47:20 tneale Exp $") + +(use-layouts "ip.ldb") + +(C-include EPILOGUE_INSTALL_H ) +(C-include EPILOGUE_TYPES_H ) +(C-include EPILOGUE_LAYOUT_LDBGLUE_H ) + +(define-layout IP_AUTH_HEADER + (struct (size (* 2 32)) ; error check + (field NEXT_HEADER IP_PROTOCOL) + (field LENGTH (unsigned 8)) + (fill 16) ; MBZ + (field SPI (opaque 32)) ; or unsigned? + (field DATA (struct (size 0))) + )) + +(define-layout IP_ESP_HEADER + (struct (size (* 1 32)) ; error check + (field SPI (opaque 32)) ; or unsigned? + (field DATA (struct (size 0))) + )) + +; Local Variables: +; mode: Scheme +; End: diff --git a/h/wrn/wm/util/layout/sntp.h b/h/wrn/wm/util/layout/sntp.h new file mode 100644 index 0000000..0732bfa --- /dev/null +++ b/h/wrn/wm/util/layout/sntp.h @@ -0,0 +1,142 @@ +/* This file was automatically generated by Epilogue Technology's + * network datastructure layout tool. + * + * DO NOT MODIFY THIS FILE BY HAND. + * + * Source file information: + */ + +#ifndef EPILOGUE_LAYOUT_SNTP_H +#define EPILOGUE_LAYOUT_SNTP_H + +#ifndef EPILOGUE_INSTALL_H +#include +#endif +#ifndef EPILOGUE_TYPES_H +#include +#endif +#ifndef EPILOGUE_LAYOUT_LDBGLUE_H +#include +#endif + +/* Definitions for SNTP */ + +#define SIZEOF_SNTP (48) +/* Can't define PTR_SNTP_LEAP_INDICATOR because: + Size 2 is not a multiple of 8. */ +#define GET_SNTP_LEAP_INDICATOR(_P_)\ + GLUE_CAST08(GLUE_GB08((GLUE_CAST_PTR(_P_))) >> 6) +#define SET_SNTP_LEAP_INDICATOR(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), (GLUE_GB08((GLUE_CAST_PTR(_P_))) & ~GLUE_CAST08(0xC0L)) | ((GLUE_CAST08(_V_) << 6) & GLUE_CAST08(0xC0L))) +#define SNTP_LEAP_INDICATOR_is_NOWARNING GLUE_CAST08(0L) +#define SNTP_LEAP_INDICATOR_is_61_IN_LAST_MINUTE GLUE_CAST08(1L) +#define SNTP_LEAP_INDICATOR_is_59_IN_LAST_MINUTE GLUE_CAST08(2L) +#define SNTP_LEAP_INDICATOR_is_ALARM GLUE_CAST08(3L) +/* Can't define PTR_SNTP_VERSION because: + Size 3 is not a multiple of 8. */ +#define GET_SNTP_VERSION(_P_)\ + GLUE_CAST08((GLUE_GB08((GLUE_CAST_PTR(_P_))) & GLUE_CAST08(0x38L)) >> 3) +#define SET_SNTP_VERSION(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), (GLUE_GB08((GLUE_CAST_PTR(_P_))) & ~GLUE_CAST08(0x38L)) | ((GLUE_CAST08(_V_) << 3) & GLUE_CAST08(0x38L))) +/* Can't define PTR_SNTP_MODE because: + Size 3 is not a multiple of 8. */ +#define GET_SNTP_MODE(_P_)\ + GLUE_CAST08(GLUE_GB08((GLUE_CAST_PTR(_P_))) & GLUE_CAST08(0x7L)) +#define SET_SNTP_MODE(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_)), (GLUE_GB08((GLUE_CAST_PTR(_P_))) & ~GLUE_CAST08(0x7L)) | (GLUE_CAST08(_V_) & GLUE_CAST08(0x7L))) +#define SNTP_MODE_is_RESERVED GLUE_CAST08(0L) +#define SNTP_MODE_is_SYMMETRIC_ACTIVE GLUE_CAST08(1L) +#define SNTP_MODE_is_SYMMETRIC_PASSIVE GLUE_CAST08(2L) +#define SNTP_MODE_is_CLIENT GLUE_CAST08(3L) +#define SNTP_MODE_is_SERVER GLUE_CAST08(4L) +#define SNTP_MODE_is_BROADCAST GLUE_CAST08(5L) +#define SNTP_MODE_is_RESERVED_NTP GLUE_CAST08(6L) +#define SNTP_MODE_is_RESERVED_PRIVATE GLUE_CAST08(7L) +#define PTR_SNTP_STRATUM(_P_)\ + ((GLUE_CAST_PTR(_P_))+(1)) +#define GET_SNTP_STRATUM(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(1)) +#define SET_SNTP_STRATUM(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(1), GLUE_CAST08(_V_)) +#define SNTP_STRATUM_is_UNSPECIFIED GLUE_CAST08(0L) +#define SNTP_STRATUM_is_PRIMARY_REFERENCE GLUE_CAST08(1L) +#define PTR_SNTP_POLL_INTERVAL(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_SNTP_POLL_INTERVAL(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) +#define SET_SNTP_POLL_INTERVAL(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST08(_V_)) +#define PTR_SNTP_PRECISION(_P_)\ + ((GLUE_CAST_PTR(_P_))+(3)) +#define GET_SNTP_PRECISION(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(3)) +#define SET_SNTP_PRECISION(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(3), GLUE_CAST08(_V_)) +#define PTR_SNTP_ROOT_DELAY(_P_)\ + ((GLUE_CAST_PTR(_P_))+(4)) +#define GET_SNTP_ROOT_DELAY(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(4)) +#define SET_SNTP_ROOT_DELAY(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(4), GLUE_CAST32(_V_)) +#define PTR_SNTP_ROOT_DISPERSION(_P_)\ + ((GLUE_CAST_PTR(_P_))+(8)) +#define GET_SNTP_ROOT_DISPERSION(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(8)) +#define SET_SNTP_ROOT_DISPERSION(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(8), GLUE_CAST32(_V_)) +#define PTR_SNTP_REFERENCE_ID(_P_)\ + ((GLUE_CAST_PTR(_P_))+(12)) +#define GET_SNTP_REFERENCE_ID(_P_)\ + GLUE_GU32((GLUE_CAST_PTR(_P_))+(12)) +#define SET_SNTP_REFERENCE_ID(_P_, _V_)\ + GLUE_SU32((GLUE_CAST_PTR(_P_))+(12), GLUE_CAST32(_V_)) +#define PTR_SNTP_REFERENCE_TIMESTAMP_SECONDS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(16)) +#define GET_SNTP_REFERENCE_TIMESTAMP_SECONDS(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(16)) +#define SET_SNTP_REFERENCE_TIMESTAMP_SECONDS(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(16), GLUE_CAST32(_V_)) +#define PTR_SNTP_REFERENCE_TIMESTAMP_FRACTIONS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(20)) +#define GET_SNTP_REFERENCE_TIMESTAMP_FRACTIONS(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(20)) +#define SET_SNTP_REFERENCE_TIMESTAMP_FRACTIONS(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(20), GLUE_CAST32(_V_)) +#define PTR_SNTP_ORIGINATE_TIMESTAMP_SECONDS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(24)) +#define GET_SNTP_ORIGINATE_TIMESTAMP_SECONDS(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(24)) +#define SET_SNTP_ORIGINATE_TIMESTAMP_SECONDS(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(24), GLUE_CAST32(_V_)) +#define PTR_SNTP_ORIGINATE_TIMESTAMP_FRACTIONS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(28)) +#define GET_SNTP_ORIGINATE_TIMESTAMP_FRACTIONS(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(28)) +#define SET_SNTP_ORIGINATE_TIMESTAMP_FRACTIONS(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(28), GLUE_CAST32(_V_)) +#define PTR_SNTP_RECEIVE_TIMESTAMP_SECONDS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(32)) +#define GET_SNTP_RECEIVE_TIMESTAMP_SECONDS(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(32)) +#define SET_SNTP_RECEIVE_TIMESTAMP_SECONDS(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(32), GLUE_CAST32(_V_)) +#define PTR_SNTP_RECEIVE_TIMESTAMP_FRACTIONS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(36)) +#define GET_SNTP_RECEIVE_TIMESTAMP_FRACTIONS(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(36)) +#define SET_SNTP_RECEIVE_TIMESTAMP_FRACTIONS(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(36), GLUE_CAST32(_V_)) +#define PTR_SNTP_TRANSMIT_TIMESTAMP_SECONDS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(40)) +#define GET_SNTP_TRANSMIT_TIMESTAMP_SECONDS(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(40)) +#define SET_SNTP_TRANSMIT_TIMESTAMP_SECONDS(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(40), GLUE_CAST32(_V_)) +#define PTR_SNTP_TRANSMIT_TIMESTAMP_FRACTIONS(_P_)\ + ((GLUE_CAST_PTR(_P_))+(44)) +#define GET_SNTP_TRANSMIT_TIMESTAMP_FRACTIONS(_P_)\ + GLUE_GB32((GLUE_CAST_PTR(_P_))+(44)) +#define SET_SNTP_TRANSMIT_TIMESTAMP_FRACTIONS(_P_, _V_)\ + GLUE_SB32((GLUE_CAST_PTR(_P_))+(44), GLUE_CAST32(_V_)) + +#endif /* EPILOGUE_LAYOUT_SNTP_H */ diff --git a/h/wrn/wm/util/layout/sntp.ldb b/h/wrn/wm/util/layout/sntp.ldb new file mode 100644 index 0000000..7a1e9d7 --- /dev/null +++ b/h/wrn/wm/util/layout/sntp.ldb @@ -0,0 +1,111 @@ +; $Header: /usr/cvsroot/target/h/wrn/wm/util/layout/sntp.ldb,v 1.1.1.1 2001/11/05 17:47:20 tneale Exp $ +; Layout information for SNTP + +;**************************************************************************** +; +; *** Restricted Rights Legend *** +; +; The programs and information contained herein are licensed only +; pursuant to a license agreement that contains use, reverse +; engineering, disclosure, and other restrictions; accordingly, it +; is "Unpublished--all rights reserved under the applicable +; copyright laws". +; +; Use duplication, or disclosure by the Government is subject to +; restrictions as set forth in subparagraph (c)(1)(ii) of the Rights +; in Technical Data and Computer Licensed Programs clause of DFARS +; 52.227 7013. +; +; Copyright 2000-2001 Wind River Systems, Inc. +; Copyright 1995-1997 Epilogue Technology Corporation. +; Copyright 1998 Integrated Systems, Inc. +; All rights reserved. +; +; *** Government Use *** +; +; The Licensed Programs and their documentation were developed at +; private expense and no part of them is in the public domain. +; +; The Licensed Programs are "Restricted Computer Software" as that +; term is defined in Clause 52.227-19 of the Federal Acquisition +; Regulations (FAR) and are "Commercial Computer Software" as that +; term is defined in Subpart 227.401 of the Department of Defense +; Federal Acquisition Regulation Supplement (DFARS). +; +; (i) If the licensed Programs are supplied to the Department of +; Defense (DoD), the Licensed Programs are classified as +; "Commercial Computer Software" and the Government is acquiring +; only "restricted rights" in the Licensed Programs and their +; documentation as that term is defined in Clause 52.227 +; 7013(c)(1) of the DFARS, and +; +; (ii) If the Licensed Programs are supplied to any unit or agency +; of the United States Government other than DoD, the +; Government's rights in the Licensed Programs and their +; documentation will be as defined in Clause 52.227-19(c)(2) of +; the FAR. +;**************************************************************************** + +; $Log: sntp.ldb,v $ +; Revision 1.1.1.1 2001/11/05 17:47:20 tneale +; Tornado shuffle +; +; Revision 1.4 2001/01/19 22:22:34 paul +; Update copyright. +; +; Revision 1.3 1998/02/25 15:21:42 sra +; Finish moving types.h, bug.h, and bugdef.h to common/h/. +; +; Revision 1.2 1998/02/25 04:54:13 sra +; Update copyrights. +; +; Revision 1.1 1998/01/20 22:57:26 mrf +; Initial revision +; + +(C-include EPILOGUE_INSTALL_H ) +(C-include EPILOGUE_TYPES_H ) +(C-include EPILOGUE_LAYOUT_LDBGLUE_H ) + +(define-layout SNTP + (struct (align 1) + (field LEAP_INDICATOR (enum (type (unsigned 2)) + (value NOWARNING 0) + (value 61_IN_LAST_MINUTE 1) + (value 59_IN_LAST_MINUTE 2) + (value ALARM 3) + )) + (field VERSION (unsigned 3)) + (field MODE (enum (type (unsigned 3)) + (value RESERVED 0) + (value SYMMETRIC_ACTIVE 1) + (value SYMMETRIC_PASSIVE 2) + (value CLIENT 3) + (value SERVER 4) + (value BROADCAST 5) + (value RESERVED_NTP 6) + (value RESERVED_PRIVATE 7) + )) + (field STRATUM (enum (type (unsigned 8)) + (value UNSPECIFIED 0) + (value PRIMARY_REFERENCE 1) + )) + (field POLL_INTERVAL (unsigned 8)) + (field PRECISION (unsigned 8)) + (field ROOT_DELAY (unsigned 32)) + (field ROOT_DISPERSION (unsigned 32)) + (field REFERENCE_ID (opaque 32)) + (field REFERENCE_TIMESTAMP_SECONDS (unsigned 32)) + (field REFERENCE_TIMESTAMP_FRACTIONS (unsigned 32)) + (field ORIGINATE_TIMESTAMP_SECONDS (unsigned 32)) + (field ORIGINATE_TIMESTAMP_FRACTIONS (unsigned 32)) + (field RECEIVE_TIMESTAMP_SECONDS (unsigned 32)) + (field RECEIVE_TIMESTAMP_FRACTIONS (unsigned 32)) + (field TRANSMIT_TIMESTAMP_SECONDS (unsigned 32)) + (field TRANSMIT_TIMESTAMP_FRACTIONS (unsigned 32)) + ;Optional Authenticator field follows + )) + +; Local Variables: +; mode: Scheme +; End: diff --git a/h/wrn/wm/util/layout/test.c b/h/wrn/wm/util/layout/test.c new file mode 100644 index 0000000..828062c --- /dev/null +++ b/h/wrn/wm/util/layout/test.c @@ -0,0 +1,134 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/layout/test.c,v 1.1.1.1 2001/11/05 17:47:20 tneale Exp $ */ + +/**************************************************************************** + * + * *** Restricted Rights Legend *** + * + * The programs and information contained herein are licensed only + * pursuant to a license agreement that contains use, reverse + * engineering, disclosure, and other restrictions; accordingly, it + * is "Unpublished--all rights reserved under the applicable + * copyright laws". + * + * Use duplication, or disclosure by the Government is subject to + * restrictions as set forth in subparagraph (c)(1)(ii) of the Rights + * in Technical Data and Computer Licensed Programs clause of DFARS + * 52.227 7013. + * + * Copyright 2000-2001 Wind River Systems, Inc. + * Copyright 1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + * + * *** Government Use *** + * + * The Licensed Programs and their documentation were developed at + * private expense and no part of them is in the public domain. + * + * The Licensed Programs are "Restricted Computer Software" as that + * term is defined in Clause 52.227-19 of the Federal Acquisition + * Regulations (FAR) and are "Commercial Computer Software" as that + * term is defined in Subpart 227.401 of the Department of Defense + * Federal Acquisition Regulation Supplement (DFARS). + * + * (i) If the licensed Programs are supplied to the Department of + * Defense (DoD), the Licensed Programs are classified as + * "Commercial Computer Software" and the Government is acquiring + * only "restricted rights" in the Licensed Programs and their + * documentation as that term is defined in Clause 52.227 + * 7013(c)(1) of the DFARS, and + * + * (ii) If the Licensed Programs are supplied to any unit or agency + * of the United States Government other than DoD, the + * Government's rights in the Licensed Programs and their + * documentation will be as defined in Clause 52.227-19(c)(2) of + * the FAR. + ****************************************************************************/ + +/* + * Test the .h files generated from .ldb files. + */ + +/* + * $Log: test.c,v $ + * Revision 1.1.1.1 2001/11/05 17:47:20 tneale + * Tornado shuffle + * + * Revision 1.10 2001/01/19 22:22:34 paul + * Update copyright. + * + * Revision 1.9 2000/03/17 00:16:06 meister + * Update copyright message + * + * Revision 1.8 1998/11/23 20:54:36 wes + * Add layout-macro description for DHCP packets. + * + * Revision 1.7 1998/04/09 21:49:12 wes + * Make netime use layout macros + * + * Revision 1.6 1998/04/08 17:01:13 wes + * Add TFTP layout macros + * + * Revision 1.5 1998/02/25 04:54:15 sra + * Update copyrights. + * + * Revision 1.4 1997/11/18 03:18:35 sra + * Brand new PAP and CHAP code for PPP. + * + * Revision 1.3 1997/10/30 19:29:20 sra + * Silence a silly warning. + * + * Revision 1.2 1997/09/26 20:37:47 alan + * Don't include types.h and ldbglue.h -- let other files pull + * them in... + * + * Revision 1.1 1997/09/10 07:42:37 alan + * I've been using this file myself for a while -- others may find it useful + * in the future. + * + */ + +/* Include -all- of the automatically generated .h files. + * This catches bugs like duplicated names, + * and perhaps (in some environments) names that are too long. + * We explicitly do -not- include ldbglue.h, types.h, etc. here + * because we want to make sure that the .h files do it right + * themselves. + */ + +#include "agentx.h" +#include "apple.h" +#include "arp.h" +#include "bgp.h" +#include "chaos.h" +#include "dhcp.h" +#include "dns.h" +#include "ethernet.h" +#include "ip.h" +#include "ip6.h" +#include "netime.h" +#include "ppp.h" +#include "rip.h" +#include "secure.h" +#include "tftp.h" + +/* Now some test code. + * Currently we are only interested in whether this code compiles. + * Someday, to do a complete test you may have to actually -run- + * the executable. + */ + +int +main(int argc, char **argv) +{ + bits8_t buffer[1000]; + + /* Once upon a time, this generated some code that caused certain recent + * versions of GCC (2.6.3 at least) to issue an (incorrect) warning. + * There is a comment in ldbglue.h about this. + * Make sure that never happens again. + */ + SET_ETHERNET_HEADER_TYPE(buffer, ETHERNET_TYPE_is_IPV6); + + return 0; +} diff --git a/h/wrn/wm/util/layout/tftp.h b/h/wrn/wm/util/layout/tftp.h new file mode 100644 index 0000000..af0d44f --- /dev/null +++ b/h/wrn/wm/util/layout/tftp.h @@ -0,0 +1,64 @@ +/* This file was automatically generated by Epilogue Technology's + * network datastructure layout tool. + * + * DO NOT MODIFY THIS FILE BY HAND. + * + * Source file information: + * Id: ip6.ldb,v 1.9 1998/02/25 15:21:41 sra Exp + */ + +#ifndef EPILOGUE_LAYOUT_TFTP_H +#define EPILOGUE_LAYOUT_TFTP_H + +#ifndef EPILOGUE_INSTALL_H +#include +#endif +#ifndef EPILOGUE_TYPES_H +#include +#endif +#ifndef EPILOGUE_LAYOUT_LDBGLUE_H +#include +#endif + +/* Definitions for TFTP_MESSAGE */ + +#define SIZEOF_TFTP_MESSAGE (4) +#define PTR_TFTP_MESSAGE_OPCODE(_P_)\ + ((GLUE_CAST_PTR(_P_))) +#define GET_TFTP_MESSAGE_OPCODE(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))) +#define SET_TFTP_MESSAGE_OPCODE(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_)), GLUE_CAST16(_V_)) +#define TFTP_MESSAGE_OPCODE_is_OP_RRQ GLUE_CAST16(1L) +#define TFTP_MESSAGE_OPCODE_is_OP_WRQ GLUE_CAST16(2L) +#define TFTP_MESSAGE_OPCODE_is_OP_DATA GLUE_CAST16(3L) +#define TFTP_MESSAGE_OPCODE_is_OP_ACK GLUE_CAST16(4L) +#define TFTP_MESSAGE_OPCODE_is_OP_ERROR GLUE_CAST16(5L) +#define PTR_TFTP_MESSAGE_FILENAME(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_TFTP_MESSAGE_FILENAME(_P_)\ + GLUE_GB08((GLUE_CAST_PTR(_P_))+(2)) +#define SET_TFTP_MESSAGE_FILENAME(_P_, _V_)\ + GLUE_SB08((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST08(_V_)) +#define PTR_TFTP_MESSAGE_BLOCK(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_TFTP_MESSAGE_BLOCK(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(2)) +#define SET_TFTP_MESSAGE_BLOCK(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST16(_V_)) +#define PTR_TFTP_MESSAGE_ERROR(_P_)\ + ((GLUE_CAST_PTR(_P_))+(2)) +#define GET_TFTP_MESSAGE_ERROR(_P_)\ + GLUE_GB16((GLUE_CAST_PTR(_P_))+(2)) +#define SET_TFTP_MESSAGE_ERROR(_P_, _V_)\ + GLUE_SB16((GLUE_CAST_PTR(_P_))+(2), GLUE_CAST16(_V_)) +#define TFTP_MESSAGE_ERROR_is_ERR_USEMSG GLUE_CAST16(0L) +#define TFTP_MESSAGE_ERROR_is_ERR_NOFILE GLUE_CAST16(1L) +#define TFTP_MESSAGE_ERROR_is_ERR_ACCESS GLUE_CAST16(2L) +#define TFTP_MESSAGE_ERROR_is_ERR_DISKFULL GLUE_CAST16(3L) +#define TFTP_MESSAGE_ERROR_is_ERR_ILLEGALOP GLUE_CAST16(4L) +#define TFTP_MESSAGE_ERROR_is_ERR_BADTID GLUE_CAST16(5L) +#define TFTP_MESSAGE_ERROR_is_ERR_EXISTS GLUE_CAST16(6L) +#define TFTP_MESSAGE_ERROR_is_ERR_NOUSER GLUE_CAST16(7L) + +#endif /* EPILOGUE_LAYOUT_TFTP_H */ diff --git a/h/wrn/wm/util/layout/tftp.ldb b/h/wrn/wm/util/layout/tftp.ldb new file mode 100644 index 0000000..af70333 --- /dev/null +++ b/h/wrn/wm/util/layout/tftp.ldb @@ -0,0 +1,48 @@ +(define-rcs-info "$Id: tftp.ldb,v 1.1.1.1 2001/11/05 17:47:21 tneale Exp $") + +(C-include EPILOGUE_INSTALL_H ) +(C-include EPILOGUE_TYPES_H ) +(C-include EPILOGUE_LAYOUT_LDBGLUE_H ) + +(define-layout TFTP_MESSAGE + (union (struct + (field OPCODE (enum (type (unsigned 16)) + (value OP_RRQ 1) + (value OP_WRQ 2) + (value OP_DATA 3) + (value OP_ACK 4) + (value OP_ERROR 5))) + ) + (struct + ;; OP_RRQ/OP_WRQ + (fill 16) ;opcode + (field FILENAME (unsigned 8)) ; well, not really, but.... + ) + (struct + ;; OP_DATA/OP_ACK + (fill 16) ;opcode + (field BLOCK (unsigned 16)) + ;; followed by data + ) + (struct + ;; OP_ERROR + (fill 16) ;opcode + (field ERROR (enum (type (unsigned 16)) + (value ERR_USEMSG 0) + (value ERR_NOFILE 1) + (value ERR_ACCESS 2) + (value ERR_DISKFULL 3) + (value ERR_ILLEGALOP 4) + (value ERR_BADTID 5) + (value ERR_EXISTS 6) + (value ERR_NOUSER 7))) + ;;; rest of packet is error message + ))) + + + + +; Local Variables: +; mode: Scheme +; End: + diff --git a/h/wrn/wm/util/port/bsd44/attache.h b/h/wrn/wm/util/port/bsd44/attache.h new file mode 100644 index 0000000..9b5684d --- /dev/null +++ b/h/wrn/wm/util/port/bsd44/attache.h @@ -0,0 +1,375 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/bsd44/attache.h,v 1.3 2003/01/15 14:00:25 josh Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: attache.h,v $ + * Revision 1.3 2003/01/15 14:00:25 josh + * directory structure shifting + * + * Revision 1.2 2002/02/26 18:22:52 josh + * updating paths in port files + * + * Revision 1.1.1.1 2001/11/05 17:47:08 tneale + * Tornado shuffle + * + * Revision 1.20 2001/01/19 22:22:53 paul + * Update copyright. + * + * Revision 1.19 2000/11/16 21:29:38 paul + * Moved glue_set_deferred_io_handler to sockport.h. + * + * Revision 1.18 2000/10/16 19:21:44 paul + * Restore sockets and mempool code. + * + * Revision 1.17 2000/03/17 00:08:56 meister + * Update copyright message + * + * Revision 1.16 2000/03/15 19:39:49 paul + * Whoops, we actually needed one of those revs. + * + * Revision 1.15 2000/03/13 21:21:52 paul + * Removed some code that we are no longer working on. + * + * Revision 1.14 1999/06/13 19:38:20 mrf + * Add attache/h/packet.h include for glue function with packet parameter + * + * Revision 1.13 1999/03/31 23:18:40 wes + * Minimal hooks for pool sanity checking.. + * + * Revision 1.12 1999/02/18 04:41:25 wes + * Sockets merge: Everything Else + * - memory pools + * - thread support + * - port-specific headers + * + * Revision 1.11.4.3 1999/02/01 23:15:34 paul + * added GLUE_ALLOC_FROM_POOL, GLUE_FREE_TO_POOL + * + * Revision 1.11.4.2 1998/10/22 21:09:55 wes + * Change glue_set_deferred_io_handler prototype; add it to other ports. + * (oops, missed this the other day). + * + * Revision 1.11.4.1 1998/09/23 19:16:56 wes + * Merge socket-branch-1 changes to socket-branch-2 + * + * Revision 1.11 1998/09/06 08:11:06 sra + * Packet filtering hooks in Attache, rudimentary firewall + * implementation in Snark. + * + * Revision 1.10 1998/03/12 18:23:43 meister + * GLUE_IPSEC_RCV_SA_NOTUNNEL() + * + * Revision 1.9 1998/03/10 00:36:59 meister + * Added back all my IPSEC glue functions which seem to have disappeared + * when Mrf made her last update. + * + * Revision 1.8 1998/03/03 20:37:52 mrf + * Change GLUE_SNTP_SET_TIME macro to take packet pointer + * + * Revision 1.7 1998/03/03 15:26:16 mrf + * Comment out PRINTF declarations. + * + * Revision 1.6 1998/02/25 04:56:45 sra + * Update copyrights. + * + * Revision 1.5 1998/02/18 22:34:58 sra + * Add ip_loopback(), eradicate glue_pkt_handle(). + * + * Revision 1.4 1998/02/13 00:42:46 mrf + * Add conditionalized SNTP Client macro + * + * Revision 1.3 1997/09/15 15:48:26 sra + * GLUE_NOW() migration version skew. + * + * Revision 1.2 1997/08/21 17:23:44 sra + * Begin moving configuration stuff that's common to all products to common.h + * Minor cleanups to common/lib/prng.c. Add pnrg seed function to snarkbsd. + * + * Revision 1.1 1997/08/13 15:17:29 mrf + * added def for MAX_HW_ADDRESS_LEN for ipv6 nd + * + * Revision 1.0 1997/08/08 22:11:10 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.8 1997/08/07 23:01:26 meister + * Added a do-nothing comment to attache.h + * + * Revision 0.7 1997/07/01 04:37:59 mrf + * add commented-out PRINTF definition + * + * Revision 0.6 1997/05/14 06:22:12 sra + * Enable inline byteswapping to silence some warnings. + * + * Revision 0.5 1997/04/15 06:00:14 sra + * Update debugging code, add default TCP timeout handler. + * + * Revision 0.4 1997/03/20 06:57:57 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.3 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.2 1996/10/30 04:51:35 sra + * Move glue stuff down to postamble section. + * + * Revision 0.1 1996/10/23 00:18:21 sar + * *** empty log message *** + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + +/* previous revision history when this was netbsd/attache.h + * + * Revision 2.7 1996/10/16 16:44:02 sar + * Added ifndefs around the memory and string functions so we + * don't get compiler warnings. + * + * Revision 2.6 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 2.5 1996/02/13 21:07:54 sra + * Fun with BUG() macros. + * + * Revision 2.4 1995/07/20 11:24:01 sra + * More fun and games with optimized byte swapping. + * + * Revision 2.3 1995/06/28 19:41:56 sra + * Add cookie argument to BUG() macro. Change inline byteswap macros to + * use GCC expression statements. + * + * Revision 2.2 1995/06/27 23:57:33 sra + * Add BUG() definition for testing. + * + * Revision 2.1 1995/06/22 05:29:06 sra + * Preliminary changes for multicast and OSPF. + * + * Revision 2.0 1995/05/10 22:38:15 sra + * Attache release 3.0. + * + * Revision 1.6 1995/05/01 20:59:29 sra + * Have to test CONFIG_PREAMBLE with #ifdef, not #if. + * + * Revision 1.5 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 1.4 1994/12/20 22:13:08 sra + * Fix signature for crufty glue_pkt_handle() declaration. + * + * Revision 1.3 1994/09/04 23:55:50 sra + * Get rid of most of the ancient NO_PP cruft. + * + * Revision 1.2 1994/09/04 06:13:38 sra + * Clean up antique type names and install macros. + * + * Revision 1.1 1993/07/05 21:54:24 sra + * Initial revision + * + */ +/* comment to test CVS */ +#ifdef CONFIG_PREAMBLE + +#include +#include +#include + +#define MAX_PACKETS 20 +#define IP_MAX_PKTSIZE 1536 + +#define TCP_MAXCONN 128 +#define TCP_DEFAULT_MAX_RETRANSMISSIONS 0 + +/* include PRINTF definition to enable printing/debugging code +#ifndef PRINTF +#define PRINTF printf +#endif +*/ + +/* + * Fun with our new run-time debugging facility. + * This is still experimental, and defaults to uninstalled. + */ +#if defined(INSTALL_SNARK_BUG_CONF) && INSTALL_SNARK_BUG_CONF +#include +#endif + +/* + * Backwards compatability with old braindamage can be a real pain. + * Since this port file is strictly for debugging, we set a couple + * of configuration parameters to more reasonable values here. + */ + +/* Please do install a retransmission timeout handler */ +#define TCP_DEFAULT_MAX_RETRANSMISSIONS 0 + +/* Please buffer a reasonable number of ahead-of-sequence segments */ +#define TCP_AHEAD_Q_MAX_DEFAULT 25 + +/* Maximum hardware address length, in bytes */ +#define ATTACHE_MAX_HW_ADDRESS_LEN 6 + +#else /* CONFIG_PREAMBLE */ + +#include +#include + +#ifndef GLUE_NOW +#define GLUE_NOW() glue_now() +extern bits32_t glue_now (void); +#endif + +#ifndef GLUE_ALLOC +#define GLUE_ALLOC(x) ((void *) malloc(x)) +#endif +#ifndef GLUE_FREE +#define GLUE_FREE(x) free((char *) (x)) +#endif + +#define GLUE_CKSUM(x, y) glue_cksum((bits16_t *)(x), (y)) +#define GLUE_CALLIN(x, y) glue_callin(x, y) + +/* define the GLUE_SNTP_SET_TIME macro if using SNTP Client */ +#if INSTALL_ATTACHE_MULTICAST && INSTALL_ATTACHE_SNTP_CLIENT +#ifndef GLUE_SNTP_SET_TIME +#define GLUE_SNTP_SET_TIME(p, s, f) glue_set_time((p),(s),(f)) +#endif +#endif + +/* + * Fun with optimized ways of swapping bytes in GCC. + */ + +#if 1 + +/* + * "Safe" inline swap expressions using GCC "statement expressions". + * Don't try these unless you're using GCC... + */ + +#define GLUE_SWAP32(x) \ + ({ bits32_t _x_ = (x);\ + ((((_x_ & 0x000000ff) << 24) & 0xff000000)|\ + (((_x_ & 0x0000ff00) << 8) & 0x00ff0000)|\ + (((_x_ & 0x00ff0000) >> 8) & 0x0000ff00)|\ + (((_x_ & 0xff000000) >> 24) & 0x000000ff)); }) + +#define GLUE_SWAP16(x) \ + ({ bits16_t _x_ = (x);\ + ((((_x_ & 0x00ff) << 8) & 0xff00)|\ + (((_x_ & 0xff00) >> 8) & 0x00ff)); }) + +#else + +static __inline__ bits32_t GLUE_SWAP32(bits32_t x) +{ + return ((((x & 0x000000ff) << 24) & 0xff000000)| + (((x & 0x0000ff00) << 8) & 0x00ff0000)| + (((x & 0x00ff0000) >> 8) & 0x0000ff00)| + (((x & 0xff000000) >> 24) & 0x000000ff)); +} + +static __inline__ bits16_t GLUE_SWAP16(bits16_t x) +{ + return ((((x & 0x00ff) << 8) & 0xff00)| + (((x & 0xff00) >> 8) & 0x00ff)); +} + +#endif + +extern int glue_intlock (int); +extern bits16_t glue_cksum (bits16_t *, unsigned); +extern void glue_callin (bits32_t, void (*)(void)); +extern void glue_set_time(packet *, bits32_t, bits32_t); + +#ifndef PRINTF +#define PRINTF printf +#endif + +#ifdef ATTACHE_IPSEC_H +#define GLUE_IPSEC_SA_EXPIRED(W,X,Y,Z) \ + glue_ipsec_sa_expired(W,X,Y,Z) +extern void glue_ipsec_sa_expired (ipsec_sa_dir_t, ipaddr_t *, + bits32_t, bits8_t); +#define GLUE_IPSEC_SND_PKT_DENIED(W,X,Y,Z) \ + glue_ipsec_snd_pkt_denied((W),(X),(Y),(Z)) + +extern void glue_ipsec_snd_pkt_denied(packet *, ipaddr_t *, ipaddr_t *, int); + + +#define GLUE_IPSEC_RCV_PKT_BADSPI(V,W,X,Y,Z) \ + glue_ipsec_rcv_pkt_badspi((V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_pkt_badspi(packet *, ipaddr_t *, ipaddr_t *, + bits32_t, bits8_t); + +#define GLUE_IPSEC_RCV_PKT_NOTPARTY(V,W,X,Y,Z) \ + glue_ipsec_rcv_pkt_notparty((V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_pkt_notparty(packet *, ipaddr_t *, ipaddr_t *, + bits32_t, bits8_t); + + +#define GLUE_IPSEC_RCV_SA_NOTUNNEL(V,W,X,Y,Z) \ + glue_ipsec_rcv_sa_notunnel((V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_sa_notunnel(packet *, ipaddr_t *, ipaddr_t *, + bits32_t, bits8_t); + + +#define GLUE_IPSEC_RCV_TUNPKT_NOTIP(U,V,W,X,Y,Z) \ + glue_ipsec_rcv_tunpkt_notip((U),(V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_tunpkt_notip(packet *, packet *, ipaddr_t *, + ipaddr_t *, bits32_t, bits8_t); + +#define GLUE_IPSEC_RCV_TUNPKT_NOTPARTY(S,T,U,V,W,X,Y,Z) \ + glue_ipsec_rcv_tunpkt_notparty((S),(T),(U),(V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_tunpkt_notparty(packet *, ipaddr_t *, ipaddr_t *, + packet *, ipaddr_t *, ipaddr_t *, + bits32_t, bits8_t); + + +#define GLUE_IPSEC_RCV_PKT_BADAH(V,W,X,Y) \ + glue_ipsec_rcv_pkt_badah((V),(W),(X),(Y)) + +extern void glue_ipsec_rcv_pkt_badah(packet *, ipaddr_t *, ipaddr_t *, + bits32_t); + +#define GLUE_IPSEC_RCV_PKT_DENIED(V,W,X,Y,Z) \ + glue_ipsec_rcv_pkt_denied((V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_pkt_denied(packet *, ipaddr_t *, ipaddr_t *, + ipsec_policy_flags_t, bits16_t); + + +#endif /* ATTACHE_IPSEC_H */ + +/* + * Fun with our new firewall toy. This is experimental and defaults to uninstalled. + */ +#if defined(INSTALL_SNARK_FIREWALL) && INSTALL_SNARK_FIREWALL +#include +#endif + +#endif /* CONFIG_PREAMBLE */ diff --git a/h/wrn/wm/util/port/bsd44/common.h b/h/wrn/wm/util/port/bsd44/common.h new file mode 100644 index 0000000..f74e29a --- /dev/null +++ b/h/wrn/wm/util/port/bsd44/common.h @@ -0,0 +1,73 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/bsd44/common.h,v 1.1.1.1 2001/11/05 17:47:08 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: common.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:08 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:22:53 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:08:56 meister + * Update copyright message + * + * Revision 1.2 1998/02/25 04:56:46 sra + * Update copyrights. + * + * Revision 1.1 1997/08/21 17:23:45 sra + * Begin moving configuration stuff that's common to all products to common.h + * Minor cleanups to common/lib/prng.c. Add pnrg seed function to snarkbsd. + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + +/* + * Common definitions for all Epilogue products on 4.4-BSD derived systems. + */ + +#ifdef CONFIG_PREAMBLE + +#include + +#ifndef STRICMP +#define STRICMP(x, y) strcasecmp(x, y) +#endif + +#ifndef STRNICMP +#define STRNICMP(x, y, z) strncasecmp(x, y, z) +#endif + +#else /* CONFIG_PREAMBLE */ + +#ifndef GLUE_NOW +#define GLUE_NOW() glue_now() +extern bits32_t glue_now (void); +#endif + +#ifndef GLUE_SEED_PRNG +#define GLUE_SEED_PRNG(x,y) glue_seed_prng(x,y) +extern unsigned glue_seed_prng(bits8_t *, unsigned); +#endif + +#endif /* CONFIG_PREAMBLE */ diff --git a/h/wrn/wm/util/port/bsd44/decorum.h b/h/wrn/wm/util/port/bsd44/decorum.h new file mode 100644 index 0000000..274e290 --- /dev/null +++ b/h/wrn/wm/util/port/bsd44/decorum.h @@ -0,0 +1,195 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/bsd44/decorum.h,v 1.3 2003/01/15 14:00:25 josh Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1996-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: decorum.h,v $ + * Revision 1.3 2003/01/15 14:00:25 josh + * directory structure shifting + * + * Revision 1.2 2002/02/26 18:22:52 josh + * updating paths in port files + * + * Revision 1.1.1.1 2001/11/05 17:47:08 tneale + * Tornado shuffle + * + * Revision 2.4 2001/01/19 22:22:54 paul + * Update copyright. + * + * Revision 2.3 2000/03/17 00:08:56 meister + * Update copyright message + * + * Revision 2.2 1998/02/25 04:56:46 sra + * Update copyrights. + * + * Revision 2.1 1998/02/16 21:33:42 josh + * decorum port file now uses epilogue_char_t where appropriate + * + * Revision 2.0 1997/09/11 15:06:30 josh + * updating version numbers for release + * + * Revision 1.0 1997/08/08 22:11:11 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.12 1997/08/07 23:03:46 meister + * added do-nothing comment to decorum.h + * + * Revision 0.11 1997/07/27 19:41:56 alan + * Add ETC_STDIO_WRITE. + * + * Revision 0.10 1997/07/24 21:15:11 alan + * Decorum now has: DECORUM_MAX_PACKET_SIZE, DECORUM_DEFAULT_RECEIVE_BUFLEN + * + * Revision 0.9 1997/07/23 07:10:49 alan + * Add support for ETC_STDIO_LAST_MODIFIED_TIME(). + * + * Revision 0.8 1997/07/17 04:46:48 alan + * New in here: DECORUM_ALLOC, DECORUM_FREE + * New conditionalization: INSTALL_DECORUM_PROXY + * + * Revision 0.7 1997/03/20 06:57:58 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.6 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.5 1996/10/29 23:01:55 sar + * added some includes to keep the compilers happy + * + * Revision 0.4 1996/10/28 17:49:31 sar + * added use of decorum_size_t + * + * Revision 0.3 1996/10/27 16:49:10 lowell + * ETC_STDIO_SIZE + * + * Revision 0.3 1996/10/17 18:00:17 sar + * Added read mode for etc stdio + * + * Revision 0.2 1996/10/16 16:44:56 sar + * Added decorum_get_rawtime + * + * Revision 0.1 1996/10/15 17:26:43 sar + * initial version + * + */ +/* +/* [clearcase] +modification history +------------------- +*/ + +/* do-nothing comment to test CVS */ +#if (!defined(decorum_inc)) +#define decorum_inc + +#include +#include +#include +#include +#include + +#ifndef DECORUM_ALLOC +#define DECORUM_ALLOC(x) ((void *) malloc(x)) +#endif +#ifndef DECORUM_FREE +#define DECORUM_FREE(x) (free((char *) (x))) +#endif + +/* This first should be the same as SNMP_MAX_PACKET_SIZE in envoy.h */ +#define DECORUM_MAX_PACKET_SIZE (1400) +#define DECORUM_DEFAULT_RECEIVE_BUFLEN (512) + +/* needed for OIDC_T definition */ +#if INSTALL_DECORUM_PROXY && (!defined(asn1conf_inc)) +#include +#endif + +/* Some input routines, these are provided but may be replaced with + more efficient implentations if desired */ +extern sbits16_t decorum_parse_sbits32 (epilogue_char_t *, + epilogue_char_t **, + sbits32_t *); +extern sbits16_t decorum_parse_bits32 (epilogue_char_t *, + epilogue_char_t **, + bits32_t *); +extern sbits16_t decorum_parse_hexstring (epilogue_char_t *, + epilogue_char_t *, + decorum_size_t); +#define ETC_STRING_GET_SBITS32 decorum_parse_sbits32 +#define ETC_STRING_GET_BITS32 decorum_parse_bits32 +#define ETC_STRING_GET_HEXSTRING decorum_parse_hexstring + +/* a routine to output a number to a byte string, used to create + file/stream names */ +#define ETC_STDIO_SPRINTF(buf, num, str) sprintf(buf, "%lu%s", num, str) + +/* Define the structure that will be used for holding output + until we are done */ +typedef FILE etc_stdio_t; + +/* Macros for opening, closing and removing a stream */ +#define ETC_STDIO_MODE_READ "r" +#define ETC_STDIO_MODE_WRITE "w+" + +#define ETC_STDIO_OPEN(fname, how) fopen(fname, how) +#define ETC_STDIO_CLOSE(outstream) fclose(outstream) +#define ETC_STDIO_REMOVE(fname) unlink(fname) +/* READ returns number of bytes read */ +#define ETC_STDIO_READ(instream, size, buf) \ + fread((buf), 1, (size), (instream)) +#define ETC_STDIO_WRITE(outstream, size, buf) \ + fwrite((buf), 1, (size), (outstream)) +extern bits32_t file_size_32(char * fname); +#define ETC_STDIO_SIZE(fname) (file_size_32(fname)) +struct decorum_rawtime; +extern void file_last_modified_time(char *, struct decorum_rawtime *); +#define ETC_STDIO_LAST_MODIFIED_TIME(fname, tvp) \ + (file_last_modified_time((fname), (tvp))) + +/* Define the base output routines */ +extern sbits16_t decorum_put_string (etc_stdio_t *, epilogue_char_t *, + decorum_size_t); +extern sbits16_t decorum_put_sbits32 (etc_stdio_t *, sbits32_t); +extern sbits16_t decorum_put_bits32 (etc_stdio_t *, bits32_t); +extern sbits16_t decorum_put_hex_string (etc_stdio_t *, bits8_t *, + decorum_size_t); +#define ETC_STDIO_PUT_STRING decorum_put_string +#define ETC_STDIO_PUT_SBITS32 decorum_put_sbits32 +#define ETC_STDIO_PUT_BITS32 decorum_put_bits32 +#define ETC_STDIO_PUT_HEX_STRING decorum_put_hex_string + +#if INSTALL_DECORUM_PROXY +/* Define a more complex output routine, this may use the + base routines (as the example code does) or may be more direct */ +extern sbits16_t decorum_put_oid (etc_stdio_t *, OIDC_T *, decorum_size_t); +#define ETC_STDIO_PUT_OID decorum_put_oid +#endif /* INSTALL_DECORUM_PROXY */ + +/* Define a string comparison routine */ +#define ETC_STRING_STRCASECMP strcasecmp + +/* Define a string length routine */ +#define ETC_STRING_STRLEN strlen + +/* Define a routine that gets the current time. */ +#define DECORUM_GET_RAWTIME(timeval_p) unix_glue_getime ((timeval_p)); +/* Define a routine that figgers out how big a buffer to use for a chunk + * of outgoing data. */ +#define DECORUM_SENDBUF_LEN(http_sb) (512) + +#endif /* #if (!defined(decorum_inc)) */ diff --git a/h/wrn/wm/util/port/bsd44/emissary.h b/h/wrn/wm/util/port/bsd44/emissary.h new file mode 100644 index 0000000..7e04fb0 --- /dev/null +++ b/h/wrn/wm/util/port/bsd44/emissary.h @@ -0,0 +1,109 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/bsd44/emissary.h,v 1.3 2003/01/15 14:00:26 josh Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1996-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: emissary.h,v $ + * Revision 1.3 2003/01/15 14:00:26 josh + * directory structure shifting + * + * Revision 1.2 2002/02/26 18:22:52 josh + * updating paths in port files + * + * Revision 1.1.1.1 2001/11/05 17:47:08 tneale + * Tornado shuffle + * + * Revision 1.7 2001/01/19 22:22:54 paul + * Update copyright. + * + * Revision 1.6 2000/10/16 19:21:44 paul + * Restore sockets and mempool code. + * + * Revision 1.5 2000/03/17 00:08:56 meister + * Update copyright message + * + * Revision 1.4 2000/03/13 21:21:53 paul + * Removed some code that we are no longer working on. + * + * Revision 1.3 1999/04/09 15:43:11 wes + * Call a kludge a kludge.. + * + * Revision 1.2 1999/02/18 04:41:25 wes + * Sockets merge: Everything Else + * - memory pools + * - thread support + * - port-specific headers + * + * Revision 1.1.10.2 1998/11/17 20:12:57 wes + * one more SNARK->ATTACHE_THREADS change.. + * + * Revision 1.1.10.1 1998/09/23 19:16:57 wes + * Merge socket-branch-1 changes to socket-branch-2 + * + * Revision 1.1.8.1 1998/08/19 13:25:51 wes + * Merge sockets-pthreads work to shared branch + * + * Revision 1.1.2.1 1998/08/04 19:47:39 wes + * XXX XXX work around bug in mit-pthreads on NetBSD + * + * Revision 1.1 1998/02/25 04:56:47 sra + * Update copyrights. + * + * Revision 1.0 1997/08/08 22:11:11 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.3 1997/03/20 06:57:59 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.1 1996/10/23 00:18:21 sar + * *** empty log message *** + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if INSTALL_EMISSARY_THREAD_KLUDGE +/* + * Work around bug in mit-pthreads on NetBSD which requires + * threads library to be inited even if they're not in use.. + */ +#include +#define EMISSARY_OS_DEPENDENT_INIT(argc,argv) GLUE_THREAD_INIT() +#endif diff --git a/h/wrn/wm/util/port/bsd44/envoy.h b/h/wrn/wm/util/port/bsd44/envoy.h new file mode 100644 index 0000000..d6554a6 --- /dev/null +++ b/h/wrn/wm/util/port/bsd44/envoy.h @@ -0,0 +1,209 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/bsd44/envoy.h,v 1.2 2002/02/26 18:22:52 josh Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: envoy.h,v $ + * Revision 1.2 2002/02/26 18:22:52 josh + * updating paths in port files + * + * Revision 1.1.1.1 2001/11/05 17:47:08 tneale + * Tornado shuffle + * + * Revision 1.11 2001/01/19 22:22:54 paul + * Update copyright. + * + * Revision 1.10 2000/03/17 00:08:57 meister + * Update copyright message + * + * Revision 1.9 1998/06/21 21:53:04 sar + * Moved the porting stuff that is common to all of our demos to generic/envoy.h + * and included that file here. + * + * Revision 1.8 1998/06/17 04:58:43 sar + * Restore the 1445 view macos + * Tidy up the rest of the file to bring it in line with the + * other envoy.h files + * + * Revision 1.7 1998/06/07 02:05:34 sar + * Remove attache specific define for ENVOY_NOW, instead we expect + * envoy_now() to be defined, if using attache just make it call + * glue_now(). + * + * Revision 1.6 1998/06/03 20:20:19 sar + * Moved nvutils.h to snark/h to allow it to be shared. + * Changed the style for the string routines. They are now hidden + * behind a macro that the user can define. If the user doesn't + * have them they can install them in the common library using makmak + * + * Revision 1.5 1998/05/28 18:39:28 sar + * Added options for v3 + * + * Revision 1.4 1998/02/25 04:56:47 sra + * Update copyrights. + * + * Revision 1.3 1997/11/04 00:29:35 sar + * Changed the agentx sub agent timeout period from 10000 (10 seconds) + * which was used for testing to 1000 (1 second). + * + * Revision 1.2 1997/10/22 03:01:21 sar + * Changed ENVOY_MASTER_AGENT to ENVOY_EPI_MASTER for clarity, + * + * Started using ENVOY_AGENTX_MASTER & ENVOY_AGENTX_SUB for better + * granularity + * + * Revision 1.1 1997/10/21 03:00:28 sar + * Added agentx macro defintions + * + * Revision 1.0 1997/08/08 22:11:12 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.5 1997/07/24 21:15:13 alan + * Decorum now has: DECORUM_MAX_PACKET_SIZE, DECORUM_DEFAULT_RECEIVE_BUFLEN + * + * Revision 0.4 1997/03/20 06:57:59 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.3 1997/03/18 23:30:10 sar + * Made use of glue_now or envoy_now depend on Attache being + * installed. + * + * Revision 0.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.1 1996/10/23 00:18:21 sar + * *** empty log message *** + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + +/* previous revision history when this was netbsd/envoy.h + * + * Revision 2.6 1996/10/16 00:10:00 sar + * Corrected proxy_release_private to use a pointer. + * + * Revision 2.5 1996/10/15 20:13:59 sar + * Added declaration for proxy release + * + * Revision 2.4 1996/10/15 17:37:53 sar + * Added proxy release and timer routine definitions. + * + * Revision 2.3 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 2.2 1996/02/27 00:04:18 sar + * removed validate_address, made v2 use validate_community and + * updated partytime to be usectime. + * + * Revision 2.1 1995/05/23 23:22:33 sar + * Added some more lock macros. + * + * Revision 2.0 1995/05/10 22:38:15 sra + * Attache release 3.0. + * + * Revision 1.10 1995/05/03 01:00:11 sar + * Added default envoy timer macros. + * + * Revision 1.9 1995/05/01 21:27:13 sar + * Put ifdef statements around the example lock macros + * + * Revision 1.8 1995/05/01 20:59:29 sra + * Have to test CONFIG_PREAMBLE with #ifdef, not #if. + * + * Revision 1.7 1995/04/26 08:03:12 sra + * Back out to pre-NVutil version until the NVutil changes + * compile correctly in this configuration. Sorry, SAR. + * + * Revision 1.6 1995/03/24 17:01:35 sar + * Updated to have definitions for the nvutils code and the timer code. + * + * Revision 1.5 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 1.4 1994/10/20 19:21:21 sar + * Added resetsysuptime and a simple lock scheme to allow the lock code + * to be compiled. + * + * Revision 1.3 1994/09/04 23:55:50 sra + * Get rid of most of the ancient NO_PP cruft. + * + * Revision 1.2 1993/08/03 22:03:39 sra + * Don't use defined() to test install options. + * + * Revision 1.1 1993/07/05 21:54:24 sra + * Initial revision + * + */ + +/***************************************************************** + + This is the platform specific part of envoy.h for use with the + example code. It contains only the platform specific pieces of + the port code. The common porting code is in generic/envoy.h. + + In general customers will have one envoy.h file per platform + that combines this file and the platform specific information, + we use two files as there is a lot of shared code between our + demos. + +*****************************************************************/ + +#ifdef CONFIG_PREAMBLE + +/***************************************************************** + + System Includes: + + Envoy uses memcpy(), memset(), and strlen(). The appropriate + include file should be put here to see that these routines are + properly declared. If no such include file exists on the system + then declare memcpy() and memset() here directly. Envoy also + uses min() and max(). Include the system's definition or use the + macros supplied below. +*****************************************************************/ + +#include + +/***************************************************************** + Memory allocation routines. Envoy needs to allocate memory to + decode the packet into and also to store the response data + + Make sure that the routines used by the SNMP_memory_alloc() and + SNMP_memory_free() macros are declared. If system memory routines + are used (e.g. malloc() and free()) then include the appropriate + system header file here. +*****************************************************************/ + +/* Get malloc and free declarations */ +#include + +#define SNMP_memory_alloc(need) malloc(need) +#define SNMP_memory_free(buf) free(buf) + +#include + +#else /* config preamble */ + +#include + +#endif /* CONFIG_PREAMBLE */ diff --git a/h/wrn/wm/util/port/bsd44/liaison.h b/h/wrn/wm/util/port/bsd44/liaison.h new file mode 100644 index 0000000..996cfea --- /dev/null +++ b/h/wrn/wm/util/port/bsd44/liaison.h @@ -0,0 +1,48 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/bsd44/liaison.h,v 1.1.1.1 2001/11/05 17:47:08 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1996-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: liaison.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:08 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:22:54 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:08:57 meister + * Update copyright message + * + * Revision 1.2 1998/02/25 04:56:48 sra + * Update copyrights. + * + * Revision 1.1 1997/11/18 19:59:33 josh + * liaison.h is a dummy file for now, but it will probably have stuff + * in the future + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + +#if (!defined(liaison_inc)) +#define liaison_inc + +#endif /* #if (!defined(liaison_inc)) */ diff --git a/h/wrn/wm/util/port/bsd44/oemtypes.h b/h/wrn/wm/util/port/bsd44/oemtypes.h new file mode 100644 index 0000000..5f950a7 --- /dev/null +++ b/h/wrn/wm/util/port/bsd44/oemtypes.h @@ -0,0 +1,61 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/bsd44/oemtypes.h,v 1.1.1.1 2001/11/05 17:47:08 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: oemtypes.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:08 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:22:54 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:08:57 meister + * Update copyright message + * + * Revision 1.2 1999/05/13 00:31:06 wes + * kludge around some header-ordering issues. + * + * Revision 1.1 1998/02/25 04:56:49 sra + * Update copyrights. + * + * Revision 1.0 1997/08/08 22:11:12 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.3 1997/03/20 06:58:00 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + +/* + * We need to supply size_t. Everything else in works on NetBSD. + */ + +#include +#ifdef __NetBSD__ +#include +#endif diff --git a/h/wrn/wm/util/port/bsd44/snark.h b/h/wrn/wm/util/port/bsd44/snark.h new file mode 100644 index 0000000..65ab642 --- /dev/null +++ b/h/wrn/wm/util/port/bsd44/snark.h @@ -0,0 +1,83 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/bsd44/snark.h,v 1.2 2002/02/27 21:41:34 josh Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: snark.h,v $ + * Revision 1.2 2002/02/27 21:41:34 josh + * a little hack for BSD/OS + * + * Revision 1.1.1.1 2001/11/05 17:47:08 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:22:55 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:08:57 meister + * Update copyright message + * + * Revision 1.2 1998/02/25 04:56:49 sra + * Update copyrights. + * + * Revision 1.1 1997/08/21 17:23:45 sra + * Begin moving configuration stuff that's common to all products to common.h + * Minor cleanups to common/lib/prng.c. Add pnrg seed function to snarkbsd. + * + * Revision 1.0 1997/08/08 22:11:13 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.4 1997/03/20 06:58:00 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.3 1997/03/09 18:37:03 sra + * Add STRICMP(). + * + * Revision 0.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.1 1996/10/23 00:18:21 sar + * *** empty log message *** + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + +#include +#include + +#ifndef GLUE_ALLOC +#define GLUE_ALLOC(x) ((void *) malloc(x)) +#endif +#ifndef GLUE_FREE +#define GLUE_FREE(x) free((char *) (x)) +#endif + +#ifndef STRICMP +#define STRICMP(x, y) strcasecmp(x, y) +#endif +#ifndef STRNICMP +#define STRNICMP(x, y, z) strncasecmp(x, y, z) +#endif + +#if INSTALL_on_bsdos +#define NO_ETHADDR_STRUCT 1 +#endif diff --git a/h/wrn/wm/util/port/bsd44/snmptalk.h b/h/wrn/wm/util/port/bsd44/snmptalk.h new file mode 100644 index 0000000..0f25255 --- /dev/null +++ b/h/wrn/wm/util/port/bsd44/snmptalk.h @@ -0,0 +1,71 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/bsd44/snmptalk.h,v 1.1.1.1 2001/11/05 17:47:08 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1995-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: snmptalk.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:08 tneale + * Tornado shuffle + * + * Revision 1.5 2001/01/19 22:22:55 paul + * Update copyright. + * + * Revision 1.4 2000/03/17 00:08:57 meister + * Update copyright message + * + * Revision 1.3 1998/06/07 02:06:34 sar + * Add include of unistd.h + * + * Revision 1.2 1998/06/03 20:20:20 sar + * Moved nvutils.h to snark/h to allow it to be shared. + * Changed the style for the string routines. They are now hidden + * behind a macro that the user can define. If the user doesn't + * have them they can install them in the common library using makmak + * + * Revision 1.1 1998/02/25 04:56:49 sra + * Update copyrights. + * + * Revision 1.0 1997/08/08 22:11:14 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.4 1997/03/20 06:58:01 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.3 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +#include +#include +#include + +/* defines for nvutils for file manipulation */ +#define SNMP_READONLY "r" +#define SNMP_READPLUS "r+" +#define SNMP_WRITEPLUS "w+" +#define SNMP_REMOVE_FILE(fname) unlink(fname) + +#include diff --git a/h/wrn/wm/util/port/bsd44/sockport.h b/h/wrn/wm/util/port/bsd44/sockport.h new file mode 100644 index 0000000..ff736a2 --- /dev/null +++ b/h/wrn/wm/util/port/bsd44/sockport.h @@ -0,0 +1,152 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/bsd44/sockport.h,v 1.1.1.1 2001/11/05 17:47:08 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998-1999 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: sockport.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:08 tneale + * Tornado shuffle + * + * Revision 1.12 2001/05/24 20:35:12 paul + * Include errno.h if needed. + * + * Revision 1.11 2001/05/17 19:10:32 paul + * Added SOCKTABLE_MIN_FD. + * + * Revision 1.10 2001/01/19 22:22:55 paul + * Update copyright. + * + * Revision 1.9 2000/11/16 21:30:04 paul + * Moved glue_set_deferred_io_handler from attache.h. + * Removed stuff that is now defaulted in attache/sockets/sockintl.h. + * + * Revision 1.8 2000/10/16 19:21:45 paul + * Restore sockets and mempool code. + * + * Revision 1.6 2000/03/17 00:08:57 meister + * Update copyright message + * + * Revision 1.5 1999/05/14 20:31:19 paul + * Moved send[to]/recv[from] wrappers from sockets.c to socktop.c. Now + * the mainline sockets code only has entry points for sendmsg/recvmsg. + * + * Revision 1.4 1999/05/12 19:03:17 paul + * Added socktable_iterate. + * + * Revision 1.3 1999/03/04 15:43:32 paul + * added sockets_shutdown, socktable_dump + * + * Revision 1.2 1999/02/18 04:41:26 wes + * Sockets merge: Everything Else + * - memory pools + * - thread support + * - port-specific headers + * + * Revision 1.1.4.10 1999/02/05 20:17:24 paul + * Changed DEFAULT_* to SOCK_DFLT_*, moved fallback definitions to sockintl.h. + * Changed SETERROR to SOCK_SET_ERRNO to reduce possibility of name + * collision with customer code. + * + * Revision 1.1.4.9 1999/02/02 23:44:08 wes + * GLUE_ALLOC is Just Wrong(tm) for GLUE_ALLOC_SOCKPIO since the units are + * wrong. use glue_alloc_sockpio() instead. + * + * Revision 1.1.4.8 1999/02/01 23:12:31 paul + * removed GLUE_ALLOC_SOCKPROTO + * added GLUE_ALLOC_SOCKPIO, GLUE_FREE_SOCKPIO + * + * Revision 1.1.4.7 1999/01/29 06:34:21 paul + * 1) Added a new internal API to facilitate calling through a syscall + * interface; these sock_* functions carry an opaque cookie pointer, + * which may be used to for task- or thread-specific data. This cookie + * is passed to the SOCKTABLE functions. + * 2) Added SETERROR; moved errno here from sockets.h. + * 3) Added GLUE_ALLOC_SOCKPROTO (allocate a protocol-specific + * structure). + * + * Revision 1.1.4.6 1999/01/22 19:49:39 paul + * removed GLUE_SOCKALLOC/GLUE_SOCKFREE + * + * Revision 1.1.4.5 1998/11/09 21:43:31 paul + * Added copyright notice. + * + */ + +/* [clearcase] +modification history +------------------- +*/ + +#ifndef _SOCKPORT_H +#define _SOCKPORT_H + +#if !INSTALL_ATTACHE_SOCKETS_DEFINE_ERRORS +#include +#endif + +extern int errno; /* needs to be per-thread/per-task */ +#define SOCK_SET_ERRNO(x) (errno = (x)) + +void glue_set_deferred_io_handler (void (*first)(void), void (*handler)(void)); +#define GLUE_SET_DEFERRED_IO_HANDLER(x,y) glue_set_deferred_io_handler(x,y) + +/* Other things you can set here: + * + * If you are using the built-in socket table code: + * SOCKTABLE_MIN_FD + * SOCKTABLE_MAX_FDS + * SOCKTABLE_HASH_BUCKETS + * + * If you are supplying your own socket table code: + * SOCKTABLE_INIT + * SOCKTABLE_LOOKUP + * SOCKTABLE_ADD + * SOCKTABLE_DEL + * SOCKTABLE_ITERATE + * SOCKTABLE_DUMP + * + * If you want to insert your own system-call type interface between + * the user socket library and the real sockets code: + * SOCK_SOCKETS_INIT + * SOCK_SOCKETS_SHUTDOWN + * SOCK_SOCKET + * SOCK_BIND + * SOCK_LISTEN + * SOCK_ACCEPT + * SOCK_CONNECT + * SOCK_GETSOCKNAME + * SOCK_GETPEERNAME + * SOCK_SHUTDOWN + * SOCK_CLOSE + * SOCK_SENDMSG + * SOCK_RECVMSG + * SOCK_SELECT + * SOCK_SETSOCKOPT + * SOCK_GETSOCKOPT + * SOCK_IOCTL + * + * Default parameters for sending and receiving: + * SOCK_DFLT_UDP_SNDBUF + * SOCK_DFLT_TCP_SNDBUF + * SOCK_DFLT_RAW_SNDBUF + * SOCK_DFLT_UDP_RCVBUF + * SOCK_DFLT_TCP_RCVBUF + * SOCK_DFLT_RAW_RCVBUF + * SOCK_DFLT_SNDLOWAT + * SOCK_DFLT_RCVLOWAT + */ + +#endif /* _SOCKPORT_H */ diff --git a/h/wrn/wm/util/port/bsd44/telnet.h b/h/wrn/wm/util/port/bsd44/telnet.h new file mode 100644 index 0000000..3c72fbd --- /dev/null +++ b/h/wrn/wm/util/port/bsd44/telnet.h @@ -0,0 +1,77 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/bsd44/telnet.h,v 1.1.1.1 2001/11/05 17:47:08 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: telnet.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:08 tneale + * Tornado shuffle + * + * Revision 1.3 2001/01/19 22:22:55 paul + * Update copyright. + * + * Revision 1.2 2000/03/17 00:08:57 meister + * Update copyright message + * + * Revision 1.1 1998/02/25 04:56:50 sra + * Update copyrights. + * + * Revision 1.0 1997/08/08 22:11:15 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.3 1997/03/20 06:57:56 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.1 1996/10/23 00:18:21 sar + * *** empty log message *** + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* + * Use '\n' for local newline convention in both directions. + */ + +#define TN_LOCAL_NEWLINE '\n' + +/* + * All the windowing stuff for server telnet connections is controlled + * by the sty code, so shunt the decisions off to the sty_tn interface module. + * + * For client telnet connections we're not buffering output, so we just + * return a constant window size. + */ + +#define TN_INITIAL_ACTIVE_WINDOW_SIZE (4096) +#define TN_INITIAL_PASSIVE_WINDOW_SIZE (stytn_space_initial) + +#define GLUE_TN_WINDOW_SIZE(_tn_) \ + (tn_get_flags((_tn_), TN_FLG_ACT_AS_SERVER) \ + ? stytn_space_left((_tn_)) \ + : TN_INITIAL_ACTIVE_WINDOW_SIZE) + +extern unsigned stytn_space_initial, stytn_space_left(); diff --git a/h/wrn/wm/util/port/bsd44/thdport.h b/h/wrn/wm/util/port/bsd44/thdport.h new file mode 100644 index 0000000..5f09a12 --- /dev/null +++ b/h/wrn/wm/util/port/bsd44/thdport.h @@ -0,0 +1,93 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/bsd44/thdport.h,v 1.1.1.1 2001/11/05 17:47:08 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998-1999 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: thdport.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:08 tneale + * Tornado shuffle + * + * Revision 1.9 2001/03/22 16:54:16 paul + * Removed GLUE_COND_TIMEDWAIT(). + * + * Revision 1.8 2001/03/20 17:11:15 paul + * Removed unused timeout macros. + * + * Revision 1.7 2001/01/19 22:22:56 paul + * Update copyright. + * + * Revision 1.6 2000/10/16 19:21:45 paul + * Restore sockets and mempool code. + * + * Revision 1.4 2000/03/17 00:08:58 meister + * Update copyright message + * + * Revision 1.3 1999/11/08 19:16:06 paul + * Added copyright. + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + +#include + +/* !!! checking return codes here? */ + +#define GLUE_MUTEX_PRIO_MAX 100 +#define GLUE_MUTEX_PRIO_HIGH 80 +#define GLUE_MUTEX_PRIO_MID 40 +#define GLUE_MUTEX_PRIO_LOW 20 +#define GLUE_MUTEX_PRIO_MIN 10 + +typedef pthread_mutex_t glue_mutex_t; + +typedef pthread_cond_t glue_cond_t; + +typedef pthread_t glue_thread_t; + +#define GLUE_MUTEX_INIT(lock, prio) pthread_mutex_init(lock, NULL) +#define GLUE_MUTEX_INIT_MAGIC(lock) pthread_mutex_init(lock, NULL) +#define GLUE_MUTEX_LOCK(lock, prio) pthread_mutex_lock(lock) +#define GLUE_MUTEX_UNLOCK(lock, prio) pthread_mutex_unlock(lock) +#define GLUE_MUTEX_TRYLOCK(lock, prio) pthread_mutex_trylock(lock) +#define GLUE_MUTEX_DESTROY(lock) pthread_mutex_destroy(lock) + +#define GLUE_COND_INIT(cond, mutex) pthread_cond_init(cond, NULL) +#define GLUE_COND_WAIT(cond, mutex) pthread_cond_wait(cond, mutex) +#define GLUE_COND_WAKEUP(cond, mutex) pthread_cond_signal(cond) +#define GLUE_COND_BROADCAST(cond, mutex) pthread_cond_broadcast(cond) +#define GLUE_COND_DESTROY(cond) pthread_cond_destroy(cond) + +#define GLUE_THD_SELF() pthread_self() +#define GLUE_THD_YIELD() pthread_yield() + +#define GLUE_THD_CREATE(thread, func, arg) pthread_create(thread, NULL, func, arg) +#define GLUE_THD_WAIT(thread) pthread_join(thread, NULL) +#define GLUE_THD_EXIT() pthread_exit(NULL) + +#define GLUE_THREAD_INIT() pthread_init() + +pthread_key_t debug_state_key; + +#define GLUE_THD_COOKIE_INIT(freertn) pthread_key_create (&debug_state_key, freertn); + +#define GLUE_THD_COOKIE_GET(y) *(y) = pthread_getspecific(debug_state_key) +#define GLUE_THD_COOKIE_SET(x) pthread_setspecific(debug_state_key, x) + diff --git a/h/wrn/wm/util/port/cygnusnt/common.h b/h/wrn/wm/util/port/cygnusnt/common.h new file mode 100644 index 0000000..05a89d8 --- /dev/null +++ b/h/wrn/wm/util/port/cygnusnt/common.h @@ -0,0 +1,73 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/cygnusnt/common.h,v 1.1.1.1 2001/11/05 17:47:08 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: common.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:08 tneale + * Tornado shuffle + * + * Revision 1.1 2000/07/10 15:55:14 mrf + * Add configuration for Cygnus NT environment with associated changes. + * + * Revision 1.3 2000/03/17 00:08:56 meister + * Update copyright message + * + * Revision 1.2 1998/02/25 04:56:46 sra + * Update copyrights. + * + * Revision 1.1 1997/08/21 17:23:45 sra + * Begin moving configuration stuff that's common to all products to common.h + * Minor cleanups to common/lib/prng.c. Add pnrg seed function to snarkbsd. + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + +/* + * Common definitions for all Epilogue products on 4.4-BSD derived systems. + */ + +#ifdef CONFIG_PREAMBLE + +#include + +#ifndef STRICMP +#define STRICMP(x, y) strcasecmp(x, y) +#endif + +#ifndef STRNICMP +#define STRNICMP(x, y, z) strncasecmp(x, y, z) +#endif + +#else /* CONFIG_PREAMBLE */ + +#ifndef GLUE_NOW +#define GLUE_NOW() glue_now() +extern bits32_t glue_now (void); +#endif + +#ifndef GLUE_SEED_PRNG +#define GLUE_SEED_PRNG(x,y) glue_seed_prng(x,y) +extern unsigned glue_seed_prng(bits8_t *, unsigned); +#endif + +#endif /* CONFIG_PREAMBLE */ diff --git a/h/wrn/wm/util/port/cygnusnt/emissary.h b/h/wrn/wm/util/port/cygnusnt/emissary.h new file mode 100644 index 0000000..ef10633 --- /dev/null +++ b/h/wrn/wm/util/port/cygnusnt/emissary.h @@ -0,0 +1,70 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/cygnusnt/emissary.h,v 1.1.1.1 2001/11/05 17:47:08 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1996-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: emissary.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:08 tneale + * Tornado shuffle + * + * Revision 1.1 2000/07/10 15:55:14 mrf + * Add configuration for Cygnus NT environment with associated changes. + * + * Revision 1.5 2000/03/17 00:08:56 meister + * Update copyright message + * + * Revision 1.4 2000/03/13 21:21:53 paul + * Removed some code that we are no longer working on. + * + * Revision 1.1 1998/02/25 04:56:47 sra + * Update copyrights. + * + * Revision 1.0 1997/08/08 22:11:11 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.3 1997/03/20 06:57:59 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.1 1996/10/23 00:18:21 sar + * *** empty log message *** + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/h/wrn/wm/util/port/cygnusnt/envoy.h b/h/wrn/wm/util/port/cygnusnt/envoy.h new file mode 100644 index 0000000..0a5fc04 --- /dev/null +++ b/h/wrn/wm/util/port/cygnusnt/envoy.h @@ -0,0 +1,206 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/cygnusnt/envoy.h,v 1.1.1.1 2001/11/05 17:47:09 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: envoy.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:09 tneale + * Tornado shuffle + * + * Revision 1.1 2000/07/10 15:55:14 mrf + * Add configuration for Cygnus NT environment with associated changes. + * + * Revision 1.10 2000/03/17 00:08:57 meister + * Update copyright message + * + * Revision 1.9 1998/06/21 21:53:04 sar + * Moved the porting stuff that is common to all of our demos to generic/envoy.h + * and included that file here. + * + * Revision 1.8 1998/06/17 04:58:43 sar + * Restore the 1445 view macos + * Tidy up the rest of the file to bring it in line with the + * other envoy.h files + * + * Revision 1.7 1998/06/07 02:05:34 sar + * Remove attache specific define for ENVOY_NOW, instead we expect + * envoy_now() to be defined, if using attache just make it call + * glue_now(). + * + * Revision 1.6 1998/06/03 20:20:19 sar + * Moved nvutils.h to snark/h to allow it to be shared. + * Changed the style for the string routines. They are now hidden + * behind a macro that the user can define. If the user doesn't + * have them they can install them in the common library using makmak + * + * Revision 1.5 1998/05/28 18:39:28 sar + * Added options for v3 + * + * Revision 1.4 1998/02/25 04:56:47 sra + * Update copyrights. + * + * Revision 1.3 1997/11/04 00:29:35 sar + * Changed the agentx sub agent timeout period from 10000 (10 seconds) + * which was used for testing to 1000 (1 second). + * + * Revision 1.2 1997/10/22 03:01:21 sar + * Changed ENVOY_MASTER_AGENT to ENVOY_EPI_MASTER for clarity, + * + * Started using ENVOY_AGENTX_MASTER & ENVOY_AGENTX_SUB for better + * granularity + * + * Revision 1.1 1997/10/21 03:00:28 sar + * Added agentx macro defintions + * + * Revision 1.0 1997/08/08 22:11:12 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.5 1997/07/24 21:15:13 alan + * Decorum now has: DECORUM_MAX_PACKET_SIZE, DECORUM_DEFAULT_RECEIVE_BUFLEN + * + * Revision 0.4 1997/03/20 06:57:59 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.3 1997/03/18 23:30:10 sar + * Made use of glue_now or envoy_now depend on Attache being + * installed. + * + * Revision 0.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.1 1996/10/23 00:18:21 sar + * *** empty log message *** + * + */ + +/* previous revision history when this was netbsd/envoy.h + * + * Revision 2.6 1996/10/16 00:10:00 sar + * Corrected proxy_release_private to use a pointer. + * + * Revision 2.5 1996/10/15 20:13:59 sar + * Added declaration for proxy release + * + * Revision 2.4 1996/10/15 17:37:53 sar + * Added proxy release and timer routine definitions. + * + * Revision 2.3 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 2.2 1996/02/27 00:04:18 sar + * removed validate_address, made v2 use validate_community and + * updated partytime to be usectime. + * + * Revision 2.1 1995/05/23 23:22:33 sar + * Added some more lock macros. + * + * Revision 2.0 1995/05/10 22:38:15 sra + * Attache release 3.0. + * + * Revision 1.10 1995/05/03 01:00:11 sar + * Added default envoy timer macros. + * + * Revision 1.9 1995/05/01 21:27:13 sar + * Put ifdef statements around the example lock macros + * + * Revision 1.8 1995/05/01 20:59:29 sra + * Have to test CONFIG_PREAMBLE with #ifdef, not #if. + * + * Revision 1.7 1995/04/26 08:03:12 sra + * Back out to pre-NVutil version until the NVutil changes + * compile correctly in this configuration. Sorry, SAR. + * + * Revision 1.6 1995/03/24 17:01:35 sar + * Updated to have definitions for the nvutils code and the timer code. + * + * Revision 1.5 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 1.4 1994/10/20 19:21:21 sar + * Added resetsysuptime and a simple lock scheme to allow the lock code + * to be compiled. + * + * Revision 1.3 1994/09/04 23:55:50 sra + * Get rid of most of the ancient NO_PP cruft. + * + * Revision 1.2 1993/08/03 22:03:39 sra + * Don't use defined() to test install options. + * + * Revision 1.1 1993/07/05 21:54:24 sra + * Initial revision + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + +/***************************************************************** + + This is the platform specific part of envoy.h for use with the + example code. It contains only the platform specific pieces of + the port code. The common porting code is in generic/envoy.h. + + In general customers will have one envoy.h file per platform + that combines this file and the platform specific information, + we use two files as there is a lot of shared code between our + demos. + +*****************************************************************/ + +#ifdef CONFIG_PREAMBLE + +/***************************************************************** + + System Includes: + + Envoy uses memcpy(), memset(), and strlen(). The appropriate + include file should be put here to see that these routines are + properly declared. If no such include file exists on the system + then declare memcpy() and memset() here directly. Envoy also + uses min() and max(). Include the system's definition or use the + macros supplied below. +*****************************************************************/ + +#include + +/***************************************************************** + Memory allocation routines. Envoy needs to allocate memory to + decode the packet into and also to store the response data + + Make sure that the routines used by the SNMP_memory_alloc() and + SNMP_memory_free() macros are declared. If system memory routines + are used (e.g. malloc() and free()) then include the appropriate + system header file here. +*****************************************************************/ + +/* Get malloc and free declarations */ +#include + +#define SNMP_memory_alloc(need) malloc(need) +#define SNMP_memory_free(buf) free(buf) + +#include + +#else /* config preamble */ + +#include + +#endif /* CONFIG_PREAMBLE */ diff --git a/h/wrn/wm/util/port/cygnusnt/oemtypes.h b/h/wrn/wm/util/port/cygnusnt/oemtypes.h new file mode 100644 index 0000000..1ca8c28 --- /dev/null +++ b/h/wrn/wm/util/port/cygnusnt/oemtypes.h @@ -0,0 +1,61 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/cygnusnt/oemtypes.h,v 1.1.1.1 2001/11/05 17:47:09 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: oemtypes.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:09 tneale + * Tornado shuffle + * + * Revision 1.1 2000/07/10 15:55:15 mrf + * Add configuration for Cygnus NT environment with associated changes. + * + * Revision 1.3 2000/03/17 00:08:57 meister + * Update copyright message + * + * Revision 1.2 1999/05/13 00:31:06 wes + * kludge around some header-ordering issues. + * + * Revision 1.1 1998/02/25 04:56:49 sra + * Update copyrights. + * + * Revision 1.0 1997/08/08 22:11:12 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.3 1997/03/20 06:58:00 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + +/* + * We need to supply size_t. Everything else in works on NetBSD. + */ + +#include +#ifdef __NetBSD__ +#include +#endif diff --git a/h/wrn/wm/util/port/cygnusnt/snark.h b/h/wrn/wm/util/port/cygnusnt/snark.h new file mode 100644 index 0000000..036b268 --- /dev/null +++ b/h/wrn/wm/util/port/cygnusnt/snark.h @@ -0,0 +1,78 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/cygnusnt/snark.h,v 1.1.1.1 2001/11/05 17:47:09 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: snark.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:09 tneale + * Tornado shuffle + * + * Revision 1.1 2000/07/10 15:55:15 mrf + * Add configuration for Cygnus NT environment with associated changes. + * + * Revision 1.3 2000/03/17 00:08:57 meister + * Update copyright message + * + * Revision 1.2 1998/02/25 04:56:49 sra + * Update copyrights. + * + * Revision 1.1 1997/08/21 17:23:45 sra + * Begin moving configuration stuff that's common to all products to common.h + * Minor cleanups to common/lib/prng.c. Add pnrg seed function to snarkbsd. + * + * Revision 1.0 1997/08/08 22:11:13 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.4 1997/03/20 06:58:00 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.3 1997/03/09 18:37:03 sra + * Add STRICMP(). + * + * Revision 0.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.1 1996/10/23 00:18:21 sar + * *** empty log message *** + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + +#include +#include + +#ifndef GLUE_ALLOC +#define GLUE_ALLOC(x) ((void *) malloc(x)) +#endif +#ifndef GLUE_FREE +#define GLUE_FREE(x) free((char *) (x)) +#endif + +#ifndef STRICMP +#define STRICMP(x, y) strcasecmp(x, y) +#endif +#ifndef STRNICMP +#define STRNICMP(x, y, z) strncasecmp(x, y, z) +#endif + +#define NO_ETHADDR_STRUCT 1 diff --git a/h/wrn/wm/util/port/cygnusnt/snmptalk.h b/h/wrn/wm/util/port/cygnusnt/snmptalk.h new file mode 100644 index 0000000..7acf18c --- /dev/null +++ b/h/wrn/wm/util/port/cygnusnt/snmptalk.h @@ -0,0 +1,71 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/cygnusnt/snmptalk.h,v 1.1.1.1 2001/11/05 17:47:09 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1995-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: snmptalk.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:09 tneale + * Tornado shuffle + * + * Revision 1.1 2000/07/10 15:55:15 mrf + * Add configuration for Cygnus NT environment with associated changes. + * + * Revision 1.4 2000/03/17 00:08:57 meister + * Update copyright message + * + * Revision 1.3 1998/06/07 02:06:34 sar + * Add include of unistd.h + * + * Revision 1.2 1998/06/03 20:20:20 sar + * Moved nvutils.h to snark/h to allow it to be shared. + * Changed the style for the string routines. They are now hidden + * behind a macro that the user can define. If the user doesn't + * have them they can install them in the common library using makmak + * + * Revision 1.1 1998/02/25 04:56:49 sra + * Update copyrights. + * + * Revision 1.0 1997/08/08 22:11:14 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.4 1997/03/20 06:58:01 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.3 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +#include +#include +#include + +/* defines for nvutils for file manipulation */ +#define SNMP_READONLY "r" +#define SNMP_READPLUS "r+" +#define SNMP_WRITEPLUS "w+" +#define SNMP_REMOVE_FILE(fname) unlink(fname) + +#include diff --git a/h/wrn/wm/util/port/envtest/envoy.h b/h/wrn/wm/util/port/envtest/envoy.h new file mode 100644 index 0000000..31086bd --- /dev/null +++ b/h/wrn/wm/util/port/envtest/envoy.h @@ -0,0 +1,332 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/envtest/envoy.h,v 1.1.1.1 2001/11/05 17:47:09 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * Configuration for Envoy on MSDOS with Attache. + */ + +/* + * $Log: envoy.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:09 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:22:56 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:09:53 meister + * Update copyright message + * + * Revision 1.2 1998/02/25 04:56:50 sra + * Update copyrights. + * + * Revision 1.1 1997/10/29 01:31:28 sar + * Updated the master agent installation option. + * + * Revision 1.0 1997/08/08 22:11:15 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.3 1997/03/20 06:58:09 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.1 1996/10/28 19:57:20 sar + * Initial Version + * + * Revision 7.0 1996/03/18 20:25:57 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 6.1 1995/11/06 20:05:58 sar + * removed validate_community's dependency on install v1 + * + * Revision 6.0 1995/05/31 22:00:34 sra + * Release 6.0. + * + * Revision 5.4 1995/05/22 19:39:49 sar + * Modified the lock code to add some new macros. + * + * Revision 5.3 1995/05/05 22:30:05 sar + * Added some default macros for the timer code. + * + * Revision 5.2 1995/05/01 21:57:42 sar + * Put the example lock macros in an if def block. + * + * Revision 5.1 1994/10/25 20:03:13 sar + * Added some simple lock code for testing and as an example, also + * added a definition for snmpresetsysuptime. + * + * Revision 5.0 1994/05/16 17:24:02 sar + * Updated revision to 5.0 and copyright to include 1994 + * + * Revision 4.0 1993/06/24 17:47:40 sar + * Updated rev to 4.0 and copyright to 93 + * + * Revision 1.1 1993/06/09 20:37:06 sar + * Initial revision + */ + +/* [clearcase] +modification history +------------------- +*/ + + +#if defined(CONFIG_PREAMBLE) + +/***************************************************************** + * + * System Includes: + * + * The SNMP uses memcpy(), memset(), and strlen(). The appropriate + * include file should be put here to see that these routines are + * properly declared. If no such include file exists on the system + * then declare memcpy() and memset() here directly. + *****************************************************************/ +/* zortech, watcom and intel 960 don't have a memory.h so away it goes */ +#if (!defined(INSTALL_on_ztc) && !defined(INSTALL_on_watcom) && !defined(INSTALL_on_i960)) +#include +#endif /* INSTALL_on_ztc */ + +#include + +/***************************************************************** + * Memory allocation routines. The SNMP needs to allocate memory to + * decode the packet into and also to store the response data for GET's + * and GET-NEXT's. + *****************************************************************/ + +/* Fix up mach 386's improper declaration of the mem* routines */ +#if defined(INSTALL_on_mach386) +#define MEMCPY(dst, src, n) memcpy((char *)(dst), (char *)(src), n) +#define MEMSET(dst, val, n) memset((char *)(dst), val, n) +#define MEMCMP(dst, src, n) memcmp((char *)(dst), (char *)(src), n) +#endif + +/*---------------------------------------------------------------- + * Make sure that the routines used by the SNMP_memory_alloc() and + * SNMP_memory_free() macros are declared. If system memory routines + * are used (e.g. malloc() and free()) then include the appropriate + * system header file here. + ----------------------------------------------------------------*/ + +/* The memory allocation macros */ +#if defined(INSTALL_on_unix) +extern void *malloc __((unsigned)); +extern void free __((void *)); +#endif +#if defined(INSTALL_on_msdos) +#include +#endif + +#define SNMP_memory_alloc(need) malloc(need) +#define SNMP_memory_free(buf) free(buf) + +/* Define the maximum packet size this implementation will accept. */ +/* There is no hard upper limit. SNMP_MAX_PACKET_SIZE should not be */ +/* reduced below the value of SNMP_MIN_PACKET_SIZE. */ +#define SNMP_MAX_PACKET_SIZE 1400 +#define SNMP_MIN_PACKET_SIZE 484 /* shouldn't change */ + +/* Say what is the maximum number of components of an object identifer */ +/* which we can handle, including those in the instance. */ +#define MAX_OID_COUNT 32 + +#if (INSTALL_ENVOY_SNMP_LOCK) +typedef struct ENVOY_LOCK_S + { + int readers; + int writers; + } ENVOY_LOCK_T; +#endif + +#else /* CONFIG_PREAMBLE */ + +/* + * Here goes all the user exit macro definitions and function declarations + * to match. + */ + +/***************************************************************** + * + * The following macro definitions allow access to the user configurable + * part of the SNMP code. + * + *****************************************************************/ + +/***************************************************************** + * Include any declarations needed for the routines specified below + * by the macros. + *****************************************************************/ + +extern int validate_SNMP_community __((SNMP_PKT_T *, SNMPADDR_T *, + SNMPADDR_T *)); +/*---------------------------------------------------------------- + SNMP_validate_community -- Check an operation against the community name. + +Parameters: + SNMP_PKT_T *pkt The received packet (decoded format) + SNMPADDR_T *src Source of the packet + SNMPADDR_T *dst Destination of the packet (most likely + the address of the machine on which this + code is running.) + +Returns: + This procedure should return 0 if happy with the community string + and 1 if not. + + This routine should fill in the packet structure with the mib + view mask associated with the community string. + This routine may hang additional data onto the "private" field of + the packet structure. The user will be given the opportinity to + release that memory via SNMP_release_private(). + + ----------------------------------------------------------------*/ +#define SNMP_validate_community(pkt, src, dst) \ + validate_SNMP_community(pkt, src, dst) + +#if defined(INSTALL_ENVOY_SNMP_VERSION_2) +/* The time routine, this must be defined */ + +#define SNMP_PARTYTIME (UINT_32_T)0L + +#endif /* INSTALL_ENVOY_SNMP_VERSION_2 */ + +#if (INSTALL_ENVOY_EPI_MASTER) +#define SNMP_RESETSYSUPTIME +#endif + +/*---------------------------------------------------------------- + SNMP_release_private -- Get rid of a any private data attached to the packet + structure. May be left undefined in which case nothing + is done with the private field when the SNMP packet + structure is freed. + + Parameters: + SNMP_PKT_T *pkt The packet itself + + Returns: Nothing + ----------------------------------------------------------------*/ +/* #define SNMP_release_private(pkt) release_private(pkt) */ + + +/*---------------------------------------------------------------- + SNMP_user_get_encode_buffer -- Allows the user the opportunity to get the + buffer that the SNMP packet will be encoded into. + If not used then leave undefined. + + Parameters: + SNMP_PKT_T *pkt The packet being encoded. + unsigned int need The amount of storage needed. + EBUFFER_T *ebuffp The ebuffer to fill in with the actual + buffer. + + Returns: + 0 successful + 1 not successful + ----------------------------------------------------------------*/ +/* #define SNMP_user_get_encode_buffer(pkt, need, ebuffp) 0 */ + + +/*---------------------------------------------------------------- + SNMP_trace_input + SNMP_trace_output + -- for implementing packet tracing through the + SNMP code. If not used then define as nothing. + + Parameters: + SNMP_PKT_T *pkt The packet being traced + + Returns: Nothing + ----------------------------------------------------------------*/ +#define SNMP_TRACE_INPUT(pkt) +#define SNMP_TRACE_OUTPUT(pkt) + +/***************************************************************** + * The next series of macros are hooks into the processing of SET PDUs. + * For most uses you should be able to leave these undefined. + *****************************************************************/ + +/*---------------------------------------------------------------- + SNMP_validate_set_pdu -- Perform a global validation of a SET PDU. + May be left undefined. + + Parameters: + SNMP_PKT_T *pkt The packet itself + + Returns: + -1 If the PDU is bad and should be rejected with a GEN_ERR. + 0 If the PDU is good and normal handling should proceed. + +1 If the PDU is good and this routine has performed all of + the set operations internally. + ----------------------------------------------------------------*/ +/* #define SNMP_validate_set_pdu(pkt) validate_set_pdu(pkt) */ + +/*---------------------------------------------------------------- + SNMP_user_pre_set -- Perform a global validation of a SET PDU after all of the + test procedures have been called and given the "go ahead". + May be left undefined. + + Parameters: + SNMP_PKT_T *pkt The packet itself + + Returns: + -1 If the PDU is bad and should be rejected with a GEN_ERR. + 0 If the PDU is good and normal handling should proceed. + +1 If the PDU is good and this routine has performed all of + the set operations internally. + ----------------------------------------------------------------*/ +/* #define SNMP_user_pre_set(pkt) user_pre_set(pkt) */ + +/*---------------------------------------------------------------- + SNMP_user_post_set -- Perform any final activities after all of the set + procedures have been called. May be left undefined. + + Parameters: + SNMP_PKT_T *pkt The packet itself + + Returns: Nothing + ----------------------------------------------------------------*/ +/* #define SNMP_user_post_set(pkt) user_post_set(pkt) */ + +#if (INSTALL_ENVOY_SNMP_LOCK) +/* Here's a simple example to test the locking code, a lock is 2 uints + one for reading, one for writing. When a routine gets a lock the + value is incremented by 1, when a routine frees a lock it is decremented + by 1. We are allowed multiple readers and 1 writer. This code + won't block so if a lock can't be an error is returned */ + +#define ENVOY_SNMP_LOCK(name) ENVOY_LOCK_T name = {0, 0} +#define ENVOY_SNMP_LOCK_EXTERN(name) extern ENVOY_LOCK_T name + +#define ENVOY_SNMP_INIT_LOCK(name) ((name).readers = 0, (name).writers = 0) + +#define ENVOY_SNMP_GET_READ_LOCK(name) \ + (((name).writers) ? 1 : ((name).readers++, 0)) +#define ENVOY_SNMP_RELEASE_READ_LOCK(name) ((name).readers--) + +#define ENVOY_SNMP_GET_WRITE_LOCK(name) \ + (((name).readers || (name).writers) ? 1 : ((name).writers++, 0)) +#define ENVOY_SNMP_RELEASE_WRITE_LOCK(name) ((name).writers--) +#endif /* (INSTALL_ENVOY_SNMP_LOCK) */ + +#define ENVOY_CALL_TIMER(T, H) +#define ENVOY_NOW() 0 + +#endif /* CONFIG_PREAMBLE */ diff --git a/h/wrn/wm/util/port/envtest/oemtypes.h b/h/wrn/wm/util/port/envtest/oemtypes.h new file mode 100644 index 0000000..9ddb083 --- /dev/null +++ b/h/wrn/wm/util/port/envtest/oemtypes.h @@ -0,0 +1,77 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/envtest/oemtypes.h,v 1.1.1.1 2001/11/05 17:47:09 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: oemtypes.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:09 tneale + * Tornado shuffle + * + * Revision 1.3 2001/01/19 22:22:56 paul + * Update copyright. + * + * Revision 1.2 2000/03/17 00:09:53 meister + * Update copyright message + * + * Revision 1.1 1998/02/25 04:56:51 sra + * Update copyrights. + * + * Revision 1.0 1997/08/08 22:11:15 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.3 1997/03/20 06:58:09 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.1 1996/10/28 19:57:20 sar + * Initial Version + * + * Revision 7.0 1996/03/18 20:25:57 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 6.0 1995/05/31 21:51:00 sra + * Release 6.0. + * + * Revision 5.0 1994/05/16 17:24:02 sar + * Updated revision to 5.0 and copyright to include 1994 + * + * Revision 4.0 1993/06/24 17:47:40 sar + * Updated rev to 4.0 and copyright to 93 + * + * Revision 1.1 1993/06/09 20:37:06 sar + * Initial revision + */ + +/* [clearcase] +modification history +------------------- +*/ + + +/* We need to supply size_t. Everything else in will + * work fine on with MSDOS compilers. + */ + +#if defined(INSTALL_on_unix) +#include +#endif +#if defined(INSTALL_on_msdos) +#include +#endif diff --git a/h/wrn/wm/util/port/generic/envoy.h b/h/wrn/wm/util/port/generic/envoy.h new file mode 100644 index 0000000..ffa0282 --- /dev/null +++ b/h/wrn/wm/util/port/generic/envoy.h @@ -0,0 +1,667 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/generic/envoy.h,v 1.3 2002/05/23 18:51:11 josh Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: envoy.h,v $ + * Revision 1.3 2002/05/23 18:51:11 josh + * code modifications to support the entity MIB + * + * Revision 1.2 2001/11/07 15:58:50 tneale + * Update for newest file layout + * + * Revision 1.1.1.1 2001/11/05 17:47:09 tneale + * Tornado shuffle + * + * Revision 1.10.4.3 2001/09/21 18:30:05 josh + * updating porting files with new information for proxy and + * coexistence + * + * Revision 1.10.4.2 2001/08/24 15:35:19 josh + * add nonvolatile access definitions for proxy and community tables + * + * Revision 1.10.4.1 2001/08/24 14:59:45 josh + * definition for generic (unix) proxy send routine + * + * Revision 1.10 2001/01/19 22:22:57 paul + * Update copyright. + * + * Revision 1.9 2000/06/09 14:57:34 josh + * updating header files to correspond with new installation options and + * new code + * + * Revision 1.8 2000/03/17 00:09:56 meister + * Update copyright message + * + * Revision 1.7 1999/11/10 22:16:33 josh + * adding prototype for envoy_ax_translate_context() + * + * Revision 1.6 1999/10/19 15:15:28 josh + * added NV macros for Notify code + * + * Revision 1.5 1999/05/27 16:16:30 josh + * added context translation userexit, ENVOY_AX_TRANSLATE_CONTEXT + * + * Revision 1.4 1998/07/20 01:49:37 sar + * Add () to the FINISHED and ENVOY_TIME macros + * + * Revision 1.3 1998/07/06 01:06:53 sar + * Add a void to make compilers happy + * + * Revision 1.2 1998/07/01 17:06:55 josh + * include snark/h/bug_conf.h when appropriate + * + * Revision 1.1 1998/06/21 21:48:47 sar + * first revision + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* + * Fun with our new run-time debugging facility. + * This is still experimental, and defaults to uninstalled. + */ +#if defined(INSTALL_SNARK_BUG_CONF) && INSTALL_SNARK_BUG_CONF +#include +#endif + +/***************************************************************** + + This is a generic version of envoy.h for use with the example + code. It contains all the macros and definitions that are + common to all of the demo code. Any platform specific information + should be placed in the platforme specific files. The platform + specific files should include this file twice, once when the + preamble flag is on and once when it isn't. + + In general customers will have one envoy.h file per platform + that combines this file and the platform specific information, + we use two files as there is a lot of shared code between our + demos. + +*****************************************************************/ + +#ifdef CONFIG_PREAMBLE + +/***************************************************************** + + System Includes: + + Envoy uses memcpy(), memset(), and strlen(). The appropriate + include file should be put here to see that these routines are + properly declared. If no such include file exists on the system + then declare memcpy() and memset() here directly. Envoy also + uses min() and max(). Include the system's definition or use the + macros supplied below. + + If necessary these should be in the platform specific files +*****************************************************************/ + + +/***************************************************************** + Memory allocation routines. Envoy needs to allocate memory to + decode the packet into and also to store the response data + + Make sure that the routines used by the SNMP_memory_alloc() and + SNMP_memory_free() macros are declared. If system memory routines + are used (e.g. malloc() and free()) then include the appropriate + system header file here. + + If necessary these should be defined in the platform specific files. +*****************************************************************/ + + +/***************************************************************** + Size limitations. + Define the maximum packet size this implementation will accept. + There is no hard upper limit. SNMP_MAX_PACKET_SIZE should not + be reduced below the value of SNMP_MIN_PACKET_SIZE, and + SNMP_MIN_PACKET_SIZE shouldn't be changed. + Also define the maximum number of components for an object identifer + which we should be able to handle, including those in the instance. + + The first, MAX, should be the same as DECORUM_MAX_PACKET_SIZE in decorum.h +*****************************************************************/ + +#define SNMP_MAX_PACKET_SIZE 8192 +#define SNMP_MIN_PACKET_SIZE 484 +#define MAX_OID_COUNT 32 + +/***************************************************************** + Demo lock structure. This lock is for testing purposes only. + You will probably want to change this to suit your system. +*****************************************************************/ +#if (INSTALL_ENVOY_SNMP_LOCK) +typedef struct ENVOY_LOCK_S + { + int readers; + int writers; + } ENVOY_LOCK_T; +#endif + +#else /* config preamble */ + +/***************************************************************** + The following macro definitions allow access to the user configurable + part of the SNMP code. + Include any declarations needed for the routines specified below + by the macros. Don't put here because this file is + included by that one. + We start with the more generic macros and then get into macros + required by specific options. +*****************************************************************/ + +/**************************************************************** + SNMP_release_private + Get rid of a any private data attached to the packet + structure. May be left undefined in which case nothing + is done with the private field when the SNMP packet + structure is freed. + + proxy_release_private is part of the code for demoing + proxies + + Parameters: SNMP_PKT_T *pkt The packet itself + + Returns: Nothing + + #define SNMP_release_private(pkt) release_private(pkt) +*****************************************************************/ + +#if (INSTALL_ENVOY_SNMP_PROXY) +extern void proxy_release_private __((SNMP_PKT_T *)); +#define SNMP_release_private(pkt) proxy_release_private(pkt) +#endif + +/***************************************************************** + SNMP_user_get_encode_buffer + Allows the user the opportunity to get the buffer that the SNMP + packet will be encoded into. If not used then leave undefined. + + Parameters: + SNMP_PKT_T *pkt The packet being encoded. + unsigned int need The amount of storage needed. + EBUFFER_T *ebuffp The ebuffer to fill in with the actual + buffer. + + Returns: + 0 successful + 1 not successful + + #define SNMP_user_get_encode_buffer(pkt, need, ebuffp) 0 +****************************************************************/ + + +/***************************************************************** + SNMP_trace_input + SNMP_trace_output + for implementing packet tracing through the SNMP code. + May not be left undefined but may instead be defined as nothing. + + Parameters: + SNMP_PKT_T *pkt The packet being traced + + Returns: Nothing +****************************************************************/ +#define SNMP_TRACE_INPUT(pkt) +#define SNMP_TRACE_OUTPUT(pkt) + + +/***************************************************************** + The next series of macros are hooks into the processing of SET PDUs. + For most uses you should be able to leave these undefined. + + SNMP_validate_set_pdu -- Perform a global validation of a SET PDU. + SNMP_user_pre_set -- Perform a global validation of a SET PDU + after all of the test procedures have been + called and given the "go ahead". + SNMP_user_post_set -- Perform any final activities after all + the set procedures have been called. + + Parameters: SNMP_PKT_T *pkt The packet itself + + Returns for SNMP_Validate_set_pdu and SNMP_user_pre_set: + -1 If the PDU is bad and should be rejected with a GEN_ERR. + 0 If the PDU is good and normal handling should proceed. + +1 If the PDU is good and this routine has performed all of + the set operations internally. + + Returns for SNMP_user_post_set: nothing + + #define SNMP_validate_set_pdu(pkt) validate_set_pdu(pkt) + #define SNMP_user_pre_set(pkt) user_pre_set(pkt) + #define SNMP_user_post_set(pkt) user_post_set(pkt) +*****************************************************************/ + +/***************************************************************** + Timer routines. These connect the Envoy timer routines to the + system. These are required for some of the options. + + ENVOY_CALL_TIMER - this routine should cause the system to call + the handler routine in the specified number + of milliseconds. + + ENVOY_NOW - this routine returns a clock with millisecond + granularity. If attache is installed it can + be defined to be glue_now. We don't do that + here so that this file can be used by multiple + demos. Instead we define envoy_now() which + may be the real function or may simply be a shim. +*****************************************************************/ +extern void envoy_call_timer __((bits32_t, void (*)(void))); +#define ENVOY_CALL_TIMER(T, H) envoy_call_timer(T, H) + +extern bits32_t envoy_now __((void)); +#define ENVOY_NOW() envoy_now() + + +/****************************************************************** + SNMP_validate_community + Check an operation against the community name. If the community + is accepted this routine must set the view mask, number or name + (depending on the view scheme in use) and attach the source and + destination addresses to the packet. It may attach proxy information + to the packet or choose a non-default mib tree for use with the + give community. + + This routine may hang additional data onto the "private" field of + the packet structure. The user will be given the opportinity to + release that memory via SNMP_release_private(). + +Parameters: + SNMP_PKT_T *pkt The received packet (decoded format) + SNMPADDR_T *src Source of the packet + SNMPADDR_T *dst Destination of the packet (most likely + the address of the machine on which this + code is running.) + +Returns: + 0 - community is ok and processing should continue + 1 - community isn't okay, drop the packet, any stats have been updated + 2 - community isn't okay, drop the packet, update BadCommunityNames + 3 - community isn't okay, drop the packet, update BadCommunityUses +*****************************************************************/ +extern int validate_SNMP_community __((SNMP_PKT_T *, + SNMPADDR_T *, + SNMPADDR_T *)); +#define SNMP_validate_community(p, s, d) validate_SNMP_community(p, s, d) + + +/***************************************************************** + The following are a series of macros that will connect the method + routines we supplied for the RFC1445 or RFC2275 view schemes to + your non-volatile storage areas. You should consult the manuals + for more information about these macros. +*****************************************************************/ +#if (INSTALL_ENVOY_SNMP_RFC1445_VIEWS) +#include + +#define SNMP_VIEW_CREATE_TEST(PKT, NEW) SNMP_NV_View_Add_Mod(NEW, 0) +#define SNMP_VIEW_UPDATE_TEST(PKT, OLD, NEW) SNMP_NV_View_Add_Mod(NEW, 0) +#define SNMP_VIEW_DESTROY_TEST(PKT, OLD) SNMP_NV_View_Add_Mod(OLD, 1) +#define SNMP_VIEW_BACKOUT_HOOK(NEW) SNMP_NV_Clean() +#define SNMP_VIEW_CREATE_UNDO(NEW) (SNMP_NV_Clean(), 0) +#define SNMP_VIEW_UPDATE_UNDO(OLD, NEW) (SNMP_NV_Clean(), 0) +#define SNMP_VIEW_DESTROY_UNDO(OLD) (SNMP_NV_Clean(), 0) +#define SNMP_VIEW_DESTROY_BACKOUT(OLD) SNMP_NV_Clean() +#define SNMP_VIEW_FINISHED SNMP_NV_Doit() + +#endif /* #if (INSTALL_ENVOY_SNMP_RFC1445_VIEWS) */ + + +#if (INSTALL_ENVOY_SNMP_RFC2275_VIEWS) +#include + +#define SNMP_VIEW_2275_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_View_2275_Add_Mod(CUR, NEW, NV_MOD_DESTROY) +#define SNMP_VIEW_2275_CREATE_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_View_2275_Add_Mod(CUR, NEW, 0) +#define SNMP_VIEW_2275_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_View_2275_Add_Mod(CUR, NEW, 0) + +#define SNMP_VIEW_2275_DESTROY_BACKOUT(CUR, NEW) SNMP_NV_Clean() +#define SNMP_VIEW_2275_CREATE_BACKOUT(CUR, NEW) SNMP_NV_Clean() +#define SNMP_VIEW_2275_UPDATE_BACKOUT(CUR, NEW) SNMP_NV_Clean() + +#define SNMP_VIEW_2275_CREATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) +#define SNMP_VIEW_2275_UPDATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) +#define SNMP_VIEW_2275_DESTROY_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) + +#define SNMP_VIEW_2275_FINISHED() SNMP_NV_Doit() + +#endif /* #if (INSTALL_ENVOY_SNMP_RFC2275_VIEWS) */ + + +/***************************************************************** + If version 3 is installed we may need the following macros. + + ENVOY_TIME - returns a clock with a granularity of seconds + PARAMETERS: none + returns: bits32_t + + SNMP_validate_address + This routine gives the user a chance to examine the address + information as well as most of the packet itself before a v3 + packet is processed. The routine must attach the address + information to the packet. It may attach a non-default mib + tree if desired. Note: in some error cases the packet will + not be decoded when this routine is called. + + Parameters: + SNMP_PKT_T *pkt The received packet (decoded format) + SNMPADDR_T *src Source of the packet + SNMPADDR_T *dst Destination of the packet (most likely + the address of the machine on which this + code is running.) + returns: + 0 - ok + 1 - failure, drop the packet + + Lastly are are a series of macros that will connect the method + routines we supplied for the v3 tables to your non-volatile + storage areas. You should consult the manuals for more information + about these macros. +*****************************************************************/ +#if INSTALL_ENVOY_SNMP_VERSION_3 +#include + +extern long time(long *); +#define ENVOY_TIME() (time((long *) 0)) + +extern int validate_SNMP_V3_address __((SNMP_PKT_T *, + SNMPADDR_T *, + SNMPADDR_T *)); +#define SNMP_validate_address(p, s, d) validate_SNMP_V3_address(p, s, d) + +#define SNMP_V3_GROUP_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_Group_Add_Mod(CUR, NEW, NV_MOD_DESTROY) +#define SNMP_V3_GROUP_CREATE_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_Group_Add_Mod(CUR, NEW, 0) +#define SNMP_V3_GROUP_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_Group_Add_Mod(CUR, NEW, 0) + +#define SNMP_V3_GROUP_DESTROY_BACKOUT(CUR, NEW) SNMP_NV_Clean() +#define SNMP_V3_GROUP_CREATE_BACKOUT(CUR, NEW) SNMP_NV_Clean() +#define SNMP_V3_GROUP_UPDATE_BACKOUT(CUR, NEW) SNMP_NV_Clean() + +#define SNMP_V3_GROUP_CREATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) +#define SNMP_V3_GROUP_UPDATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) +#define SNMP_V3_GROUP_DESTROY_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) + +#define SNMP_V3_GROUP_FINISHED() SNMP_NV_Doit() + + +#define SNMP_V3_ACCESS_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_Access_Add_Mod(CUR, NEW, NV_MOD_DESTROY) +#define SNMP_V3_ACCESS_CREATE_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_Access_Add_Mod(CUR, NEW, 0) +#define SNMP_V3_ACCESS_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_Access_Add_Mod(CUR, NEW, 0) + +#define SNMP_V3_ACCESS_DESTROY_BACKOUT(CUR, NEW) SNMP_NV_Clean() +#define SNMP_V3_ACCESS_CREATE_BACKOUT(CUR, NEW) SNMP_NV_Clean() +#define SNMP_V3_ACCESS_UPDATE_BACKOUT(CUR, NEW) SNMP_NV_Clean() + +#define SNMP_V3_ACCESS_CREATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) +#define SNMP_V3_ACCESS_UPDATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) +#define SNMP_V3_ACCESS_DESTROY_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) + +#define SNMP_V3_ACCESS_FINISHED() SNMP_NV_Doit() + +#define SNMP_V3_USER_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_User_Add_Mod(CUR, NEW, NV_MOD_DESTROY) +#define SNMP_V3_USER_CREATE_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_User_Add_Mod(CUR, NEW, 0) +#define SNMP_V3_USER_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_User_Add_Mod(CUR, NEW, 0) + +#define SNMP_V3_USER_DESTROY_BACKOUT(CUR, NEW) SNMP_NV_Clean() +#define SNMP_V3_USER_CREATE_BACKOUT(CUR, NEW) SNMP_NV_Clean() +#define SNMP_V3_USER_UPDATE_BACKOUT(CUR, NEW) SNMP_NV_Clean() + +#define SNMP_V3_USER_CREATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) +#define SNMP_V3_USER_UPDATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) +#define SNMP_V3_USER_DESTROY_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) + +#define SNMP_V3_USER_FINISHED() SNMP_NV_Doit() + +#define SNMP_V3_TADDR_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_TAddr_Add_Mod(CUR, NEW, NV_MOD_DESTROY) +#define SNMP_V3_TADDR_CREATE_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_TAddr_Add_Mod(CUR, NEW, 0) +#define SNMP_V3_TADDR_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_TAddr_Add_Mod(CUR, NEW, 0) + +#define SNMP_V3_TADDR_DESTROY_BACKOUT(CUR, NEW) SNMP_NV_Clean() +#define SNMP_V3_TADDR_CREATE_BACKOUT(CUR, NEW) SNMP_NV_Clean() +#define SNMP_V3_TADDR_UPDATE_BACKOUT(CUR, NEW) SNMP_NV_Clean() + +#define SNMP_V3_TADDR_CREATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) +#define SNMP_V3_TADDR_UPDATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) +#define SNMP_V3_TADDR_DESTROY_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) + +#define SNMP_V3_TADDR_FINISHED() SNMP_NV_Doit() + +#define SNMP_V3_TPARAM_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_TParam_Add_Mod(CUR, NEW, NV_MOD_DESTROY) +#define SNMP_V3_TPARAM_CREATE_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_TParam_Add_Mod(CUR, NEW, 0) +#define SNMP_V3_TPARAM_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_TParam_Add_Mod(CUR, NEW, 0) + +#define SNMP_V3_TPARAM_DESTROY_BACKOUT(CUR, NEW) SNMP_NV_Clean() +#define SNMP_V3_TPARAM_CREATE_BACKOUT(CUR, NEW) SNMP_NV_Clean() +#define SNMP_V3_TPARAM_UPDATE_BACKOUT(CUR, NEW) SNMP_NV_Clean() + +#define SNMP_V3_TPARAM_CREATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) +#define SNMP_V3_TPARAM_UPDATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) +#define SNMP_V3_TPARAM_DESTROY_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) + +#define SNMP_V3_TPARAM_FINISHED() SNMP_NV_Doit() + +#define SNMP_V3_NOTIFY_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_Notify_Add_Mod(CUR, NEW, NV_MOD_DESTROY) +#define SNMP_V3_NOTIFY_CREATE_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_Notify_Add_Mod(CUR, NEW, 0) +#define SNMP_V3_NOTIFY_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_Notify_Add_Mod(CUR, NEW, 0) + +#define SNMP_V3_NOTIFY_DESTROY_BACKOUT(CUR, NEW) SNMP_NV_Clean() +#define SNMP_V3_NOTIFY_CREATE_BACKOUT(CUR, NEW) SNMP_NV_Clean() +#define SNMP_V3_NOTIFY_UPDATE_BACKOUT(CUR, NEW) SNMP_NV_Clean() + +#define SNMP_V3_NOTIFY_CREATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) +#define SNMP_V3_NOTIFY_UPDATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) +#define SNMP_V3_NOTIFY_DESTROY_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) + +#define SNMP_V3_NOTIFY_FINISHED() SNMP_NV_Doit() + +#define SNMP_V3_NPROF_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_NProf_Add_Mod(CUR, NEW, NV_MOD_DESTROY) +#define SNMP_V3_NPROF_CREATE_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_NProf_Add_Mod(CUR, NEW, 0) +#define SNMP_V3_NPROF_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_NProf_Add_Mod(CUR, NEW, 0) + +#define SNMP_V3_NPROF_DESTROY_BACKOUT(CUR, NEW) SNMP_NV_Clean() +#define SNMP_V3_NPROF_CREATE_BACKOUT(CUR, NEW) SNMP_NV_Clean() +#define SNMP_V3_NPROF_UPDATE_BACKOUT(CUR, NEW) SNMP_NV_Clean() + +#define SNMP_V3_NPROF_CREATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) +#define SNMP_V3_NPROF_UPDATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) +#define SNMP_V3_NPROF_DESTROY_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) + +#define SNMP_V3_NPROF_FINISHED() SNMP_NV_Doit() + +#define SNMP_V3_NFILT_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_NFilt_Add_Mod(CUR, NEW, NV_MOD_DESTROY) +#define SNMP_V3_NFILT_CREATE_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_NFilt_Add_Mod(CUR, NEW, 0) +#define SNMP_V3_NFILT_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_NFilt_Add_Mod(CUR, NEW, 0) + +#define SNMP_V3_NFILT_DESTROY_BACKOUT(CUR, NEW) SNMP_NV_Clean() +#define SNMP_V3_NFILT_CREATE_BACKOUT(CUR, NEW) SNMP_NV_Clean() +#define SNMP_V3_NFILT_UPDATE_BACKOUT(CUR, NEW) SNMP_NV_Clean() + +#define SNMP_V3_NFILT_CREATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) +#define SNMP_V3_NFILT_UPDATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) +#define SNMP_V3_NFILT_DESTROY_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) + +#define SNMP_V3_NFILT_FINISHED() SNMP_NV_Doit() + +#define SNMP_V3_PROXY_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_Proxy_Add_Mod(CUR, NEW, NV_MOD_DESTROY) +#define SNMP_V3_PROXY_CREATE_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_Proxy_Add_Mod(CUR, NEW, 0) +#define SNMP_V3_PROXY_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_V3_Proxy_Add_Mod(CUR, NEW, 0) + +#define SNMP_V3_PROXY_DESTROY_BACKOUT(CUR, NEW) SNMP_NV_Clean() +#define SNMP_V3_PROXY_CREATE_BACKOUT(CUR, NEW) SNMP_NV_Clean() +#define SNMP_V3_PROXY_UPDATE_BACKOUT(CUR, NEW) SNMP_NV_Clean() + +#define SNMP_V3_PROXY_CREATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) +#define SNMP_V3_PROXY_UPDATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) +#define SNMP_V3_PROXY_DESTROY_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) + +#define SNMP_V3_PROXY_FINISHED() SNMP_NV_Doit() + +#define SNMP_V3_COMM_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_Community_Add_Mod(CUR, NEW, NV_MOD_DESTROY) +#define SNMP_V3_COMM_CREATE_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_Community_Add_Mod(CUR, NEW, 0) +#define SNMP_V3_COMM_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + SNMP_NV_Community_Add_Mod(CUR, NEW, 0) + +#define SNMP_V3_COMM_DESTROY_BACKOUT(CUR, NEW) SNMP_NV_Clean() +#define SNMP_V3_COMM_CREATE_BACKOUT(CUR, NEW) SNMP_NV_Clean() +#define SNMP_V3_COMM_UPDATE_BACKOUT(CUR, NEW) SNMP_NV_Clean() + +#define SNMP_V3_COMM_CREATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) +#define SNMP_V3_COMM_UPDATE_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) +#define SNMP_V3_COMM_DESTROY_UNDO(PKT, VBP, CUR, SAV) (SNMP_NV_Clean(), 0) + +#define SNMP_V3_COMM_FINISHED() SNMP_NV_Doit() + +#if INSTALL_ENVOY_SNMP_V3_PROXY +#if INSTALL_ATTACHE +void envoy_snmp_send_proxy __((SNMPADDR_T *, SNMPADDR_T *, + PTR_T, ALENGTH_T)); + +#define ENVOY_SNMP_SEND_PROXY(FOR, LOC, PKT, SIZ) \ + envoy_snmp_send_proxy((FOR), (LOC), (PKT), (SIZ)) +#endif +#endif /* #if INSTALL_ENVOY_SNMP_V3_PROXY */ +#endif /* #if INSTALL_ENVOY_SNMP_VERSION_3 */ + +/***************************************************************** + If usec is installed we may need the following macros. + NOTE WELL: usec was an experimental protocol for providing security + to snmp. It has been superseeded by v3. It should not be used and + will be removed in a future release. + + SNMP_USECTIME - returns a clock with a granularity of seconds +*****************************************************************/ +#if (INSTALL_ENVOY_SNMP_VERSION_USEC) +typedef long USECTIME_T; +extern long time(long *); +#define SNMP_USECTIME ((USECTIME_T)time((long *)0)) +#endif /* INSTALL_ENVOY_SNMP_VERSION_USEC */ + +/***************************************************************** +A macro for use with the epilogue master agent. +*****************************************************************/ +#if (INSTALL_ENVOY_EPI_MASTER) +#define SNMP_RESETSYSUPTIME +#endif + +#if (INSTALL_ENVOY_AGENTX_MASTER) || (INSTALL_ENVOY_ENTITY_MIB) +extern bits32_t envoy_get_sysuptime(void); + +#define ENVOY_GET_SYSUPTIME(CON) envoy_get_sysuptime() +#endif /* #if (INSTALL_ENVOY_AGENTX_MASTER) || (INSTALL_ENVOY_ENTITY_MIB) */ + +/***************************************************************** + AgentX routines and macros for the master + + Defaults are fine for the following macros: + #define ENVOY_AX_DEFAULT_TIMEOUT 1 + + #define ENVOY_AX_FIND_MIB(CONTEXT) (EBufferUsed(CONTEXT) ? 0 : &mib_root_node) + + #define ENVOY_AX_MA_AC_ADD(PKTP, MIBROOT) GEN_ERR + #define ENVOY_AX_MA_AC_REMOVE(PKTP, MIBROOT) GEN_ERR + #define ENVOY_AX_MA_AC_CLEAN(SESS_ID) +*****************************************************************/ +#if INSTALL_ENVOY_AGENTX_MASTER +extern sbits32_t envoy_ax_transport_type(ptr_t); +extern int envoy_ax_transport_string(ptr_t, ALENGTH_T *, + bits8_t **, int *); +extern void envoy_ax_translate_context(SNMP_PKT_T *pktp, + struct ENVOY_AX_PKT_S *query_pkt); + +#define ENVOY_AX_TRANSPORT_TYPE(COOKIE) envoy_ax_transport_type(COOKIE) +#define ENVOY_AX_TRANSPORT_STRING(COOKIE, NEED, BUF, DYN) \ + envoy_ax_transport_string(COOKIE, NEED, BUF, DYN) +#define ENVOY_AX_TRANSPORTS_SUPPORTED {0} +#define ENVOY_AX_TRANSLATE_CONTEXT(PKT, AX_PKT) \ + envoy_ax_translate_context(PKT, AX_PKT) +#endif /* #if INSTALL_ENVOY_AGENTX_MASTER */ + +/***************************************************************** + AgentX routines and macros for the sub agent + + Defaults are fine for the following macros: + #define ENVOY_AX_SA_MIB_ROOT_NODE(CKE, PKT) 0 + #define ENVOY_AX_SA_TIMEOUT 1000 +*****************************************************************/ + +/***************************************************************** + Lock Test Code: + The following macros define a simple example to test the locking + code. NOTE WELL: this code doesn't block and so is not acceptable + for use as the locking code, it is only here for test purposes. + + A lock is 2 uints one for reading and one for writing. When a + routine gets a lock the value is incremented by 1, when a routine + frees a lock it is decremented by 1. We are allowing multiple + readers and one writer. As this code can't block we simply return + an error if we can't get a lock, real locking code must block in + that case. +*****************************************************************/ +#if (INSTALL_ENVOY_SNMP_LOCK) +#define ENVOY_SNMP_LOCK(name) ENVOY_LOCK_T name = {0, 0} +#define ENVOY_SNMP_LOCK_EXTERN(name) extern ENVOY_LOCK_T name + +#define ENVOY_SNMP_INIT_LOCK(name) ((name).readers = 0, (name).writers = 0) + +#define ENVOY_SNMP_GET_READ_LOCK(name) \ + (((name).writers) ? 1 : ((name).readers++, 0)) +#define ENVOY_SNMP_RELEASE_READ_LOCK(name) ((name).readers--) + +#define ENVOY_SNMP_GET_WRITE_LOCK(name) \ + (((name).readers || (name).writers) ? 1 : ((name).writers++, 0)) +#define ENVOY_SNMP_RELEASE_WRITE_LOCK(name) ((name).writers--) +#endif /* (INSTALL_ENVOY_SNMP_LOCK) */ + +#endif /* CONFIG_PREAMBLE */ diff --git a/h/wrn/wm/util/port/isisnmp/arm250/drv_conf.h b/h/wrn/wm/util/port/isisnmp/arm250/drv_conf.h new file mode 100644 index 0000000..9d1ad9e --- /dev/null +++ b/h/wrn/wm/util/port/isisnmp/arm250/drv_conf.h @@ -0,0 +1,1247 @@ +/* @(#) pSOSystem: apps/inetutil/drv_conf.c (&U&) 1.1 00/01/19 16:15:15 */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/* [clearcase] +modification history +------------------- +*/ + +/***********************************************************************/ +/* */ +/* MODULE: drv_conf.c */ +/* DATE: 00/01/19 */ +/* PURPOSE: pSOSystem driver configuration and initialization */ +/* */ +/* These are the functions in this file: */ +/* */ +/* SetUpDrivers to setup drivers except for Network drivers*/ +/* DrvSysStartCO to setup Initial Device Name Table */ +/* SetUpNI to setup Network drivers */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* Copyright 1991 - 1999, Integrated Systems, Inc. */ +/* ALL RIGHTS RESERVED */ +/* */ +/* Permission is hereby granted to licensees of Integrated Systems, */ +/* Inc. products to use or abstract this computer program for the */ +/* sole purpose of implementing a product based on Integrated */ +/* Systems, Inc. products. No other rights to reproduce, use, */ +/* or disseminate this computer program, whether in part or in */ +/* whole, are granted. */ +/* */ +/* Integrated Systems, Inc. makes no representation or warranties */ +/* with respect to the performance of this computer program, and */ +/* specifically disclaims any responsibility for any damages, */ +/* special or consequential, connected with the use of this program. */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* */ +/* */ +/***********************************************************************/ +#include "sys_conf.h" +#include "bsp.h" +#include +#include +#include +#include + +#if SC_DEV_SPI + #include "spi.h" +#endif + +#if (SC_PSE) +#include +#include +#endif + +#if (SC_DEV_DLPI) +#include +#endif + +#if (SC_DEV_NULL) +extern void NullDevInit(struct ioparms *); +extern void NullDevRead(struct ioparms *); +extern void NullDevWrite(struct ioparms *); +extern void NullDevCntrl(struct ioparms *); +#endif + +#define NULLF (void *) ((void (*)(struct ioparms *)) 0) + +#if (SC_PNA || SC_PNET) +static const char RarpErrTimeout[] = + "RARP request failed: Check for a RARP server"; +static const char RarpErrNet[] = + "RARP request failed: Network Error"; +#endif + +#if (SC_DEV_TFTP || SC_DEV_NTFTP) +ULONG NumTftpChans = SC_MAX_TFTP_CHAN; +#endif + +#if (SC_DEV_HTTP) +ULONG NumHttpChans = SC_MAX_HTTP_CHAN; +#endif + +#if (SC_DEV_PIPE) +unsigned long NumPipeChans = SC_MAX_PIPE_CHAN; +#endif + +#if (SC_DEV_PSCONSOLE) +ULONG NumPsConsoleSharedChan = SC_PSCNSL_SHARED_CHAN; +ULONG NumPsConsolePrivateChan = SC_PSCNSL_PRIVATE_CHAN; +ULONG NumPsConsoleCustomModule = SC_PSCNSL_MAX_CUSTOM; +#endif + +#if (defined(BSP_NEW_SERIAL) && !(BSP_NEW_SERIAL) && (BSP_SERIAL)) +extern UCHAR *CnslSetup(UCHAR *FreeMem, ULONG defbaud, USHORT defcons); +#endif + +#if SC_PSOS || SC_PSOSM +/***********************************************************************/ +/* SetUpDrivers: installs drivers in PsosIO table via a call to */ +/* InstallDriver and then calls driver setup function if */ +/* needed. NOTE: If the driver is to be part of the */ +/* Network Interface then it should be placed in the */ +/* SetUpNI function. */ +/* */ +/* INPUT: FreeMemPtr = A pointer to unused memory that can be */ +/* used to allocate space for a driver. */ +/* NOTE: Be sure to advance FreeMemPtr if */ +/* memory is allocates! */ +/* */ +/* RETURNS: The new address of free memory after the drivers have */ +/* allocated space. */ +/* */ +/* NOTE: This function does many precompile checks so errors */ +/* can be found during compile-time rather then at run- */ +/* time. */ +/* */ +/* To add a non-Network driver to pSOSystem, call InstallDriver(). */ +/* This adds a device driver to the PsosIO table. InstallDriver() */ +/* takes the following arguments: */ +/* */ +/* unsigned short major_number device major number */ +/* void (*dev_init)() device init procedure */ +/* void (*dev_open)() device open procedure */ +/* void (*dev_close)() device close procedure */ +/* void (*dev_read)() device read procedure */ +/* void (*dev_write)() device write procedure */ +/* void (*dev_ioctl)() device control procedure */ +/* unsigned long dev_param Used for STREAMS modules */ +/* unsigned short rsvd2 reserved */ +/* unsigned short flags If set to IO_AUTOINIT pSOS will */ +/* automatically call the */ +/* drivers initialization */ +/* function. The SC_AUTOINIT */ +/* #define which is set in */ +/* sys_conf.h can be used to set */ +/* this element. */ +/* */ +/* InstallDriver() does not return a value. InstallDriver() assumes */ +/* SC_DEVMAX is defined in sys_conf.h and is useful only before pSOS+ */ +/* has been initialized. */ +/* */ +/* If you are adding a driver that needs to be initialized before */ +/* either pSOS+ is initialized or the driver's init function is */ +/* called, then you can call a setup function (that you create) for */ +/* the driver. If your initialization function needs to allocate */ +/* memory, you may pass it the FreeMemPtr. The function should return */ +/* a new FreeMemPtr which points to the end of the memory it has */ +/* allocated. */ +/* */ +/* When adding code to install a new driver, it is a good idea to add */ +/* precompile checks so errors can be found during compile-time rather */ +/* then at run-time. Precompile checks are used, for example, in the */ +/* code that installs the pSOSystem serial device driver below. */ +/* */ +/***********************************************************************/ +UCHAR *SetUpDrivers(UCHAR *FreeMemPtr) +{ +extern ULONG PsosNumDntEnts; + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem serial device driver. */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SERIAL && BSP_SERIAL && BSP_NEW_SERIAL) + #if(SC_DEV_SERIAL > SC_DEVMAX) + #error "SC_DEV_SERIAL cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SERIAL, TermInit, TermOpen, TermClose,TermRead, + TermWrite, TermIoctl, 0, 0, IO_CHAR_DEV | SC_AUTOINIT); + PsosNumDntEnts++; + +/*---------------------------------------------------------------------*/ +/* This section is provided for backward compatibility only. */ +/* It will be removed completely in the next version of pSOSystem. */ +/*---------------------------------------------------------------------*/ +#elif (SC_DEV_SERIAL && BSP_SERIAL) + #if(SC_DEV_SERIAL > SC_DEVMAX) + #error "SC_DEV_SERIAL cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SERIAL, CnslInit, NULLF, NULLF,CnslRead, + CnslWrite, CnslCntrl, 0, 0, IO_CHAR_DEV | SC_AUTOINIT); + FreeMemPtr = CnslSetup(FreeMemPtr, SysVars.DefBaud, SC_APP_CONSOLE); + PsosNumDntEnts++; + +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSEUDO console driver */ +/*---------------------------------------------------------------------*/ +#if (DEV_PSCONSOLE) + InstallDriver(SC_DEV_PSCONSOLE, NULLF, PsConsoleOpen, + PsConsoleClose, PsConsoleRead, PsConsoleWrite, + PsConsoleCntrl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts +=4; +#endif + +/*--------------------------------------------------------------------*/ +/* Install the Memory Log driver. */ +/*--------------------------------------------------------------------*/ +#if SC_DEV_MEMLOG + InstallDriver(SC_DEV_MEMLOG, MemLogInit, NULLF, + NULLF, MemLogRead, MemLogWrite, + MemLogCntrl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*--------------------------------------------------------------------*/ +/* Install the Memory pROBE+ Remote debugger driver (RDIO). */ +/*--------------------------------------------------------------------*/ +#if SC_DEV_RDIO + InstallDriver(SC_DEV_RDIO, NULLF, NULLF, + NULLF, RdioRead, RdioWrite, + 0, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*--------------------------------------------------------------------*/ +/* Setup pSOSystem PC console device driver */ +/*--------------------------------------------------------------------*/ +#if (SC_DEV_CONSOLE && BSP_CONSOLE) + #if (SC_DEV_CONSOLE >SC_DEVMAX) + #error "SC_DEV_CONSOLE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_CONSOLE, PcCnslInit, NULLF, NULLF, + PcCnslRead, PcCnslWrite, PcCnslCntrl, 0, 0, + IO_CHAR_DEV | SC_AUTOINIT); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem tick timer. */ +/*---------------------------------------------------------------------*/ +#if SC_DEV_TIMER + #if(SC_DEV_TIMER > SC_DEVMAX) + #error "SC_DEV_TIMER cannot be > SC_DEVMAX" + #endif + #if (!SC_PSOS && !SC_PSOSM) + #error "Must have pSOS+ or pSOS+m in system to use tick timer!" + #endif + InstallDriver(SC_DEV_TIMER, RtcInit, NULLF, NULLF, NULLF, NULLF, + NULLF, 0, 0, IO_CHAR_DEV | SC_AUTOINIT); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install DevNull driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_NULL) + InstallDriver(SC_DEV_NULL, NullDevInit, NULLF, NULLF,NullDevRead, + NullDevWrite, NullDevCntrl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem ramdisk driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if SC_DEV_RAMDISK + #if(SC_DEV_RAMDISK > SC_DEVMAX) + #error "SC_DEV_RAMDISK cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_RAMDISK, RdskInit, RdskOpen, RdskClose, RdskRead, + RdskWrite, RdskCntrl, 0, 0, IO_BLOCK_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem PIPE driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization feature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if SC_DEV_PIPE + #if(SC_DEV_PIPE > SC_DEVMAX) + #error "SC_DEV_PIPE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_PIPE, PipeInit, PipeOpen, PipeClose, PipeRead, + PipeWrite, PipeCntl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem SCSI driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SCSI && BSP_SCSI) + #if(SC_DEV_SCSI > SC_DEVMAX) + #error "SC_DEV_SCSI cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SCSI, SdrvInit, SdskOpen, SdskClose, SdskRead, + SdskWrite, SdrvCntrl, 0, 0, IO_BLOCK_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem SCSI Tape driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SCSI_TAPE && BSP_SCSI_TAPE) + #if(SC_DEV_SCSI_TAPE > SC_DEVMAX) + #error "SC_DEV_SCSI_TAPE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SCSI_TAPE, SdrvInit, StapeOpen, StapeClose, + StapeRead, StapeWrite, SdrvCntrl, 0, 0, IO_BLOCK_DEV); + + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem CMOS clock driver */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_CMOS && BSP_CLOCK) + #if (SC_DEV_CMOS >SC_DEVMAX) + #error "SC_DEV_CMOS cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_CMOS, NULLF, NULLF, NULLF, CmcRead, + CmcWrite, NULLF, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem printer driver */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_PARALLEL && BSP_PARALLEL) + #if (SC_DEV_PARALLEL >SC_DEVMAX) + #error "SC_DEV_PARALLEL cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_PARALLEL, ParInit, ParOpen, ParClose, NULLF, + ParWrite, ParCntrl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem floppy diskette driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_FLOPPY && BSP_FLOPPY) + #if (SC_DEV_FLOPPY >SC_DEVMAX) + #error "SC_DEV_FLOPPY cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_FLOPPY, FlpInit, NULLF, NULLF, FlpRead, + FlpWrite, FlpCntrl, 0, 0, IO_BLOCK_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem IDE disk driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_IDE && BSP_IDE) + #if (SC_DEV_IDE >SC_DEVMAX) + #error "SC_DEV_IDE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_IDE, IDEInit, NULLF, NULLF, IDERead, + IDEWrite, IDECntrl, 0, 0, IO_BLOCK_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem TFTP driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_TFTP) + #if(SC_DEV_TFTP > SC_DEVMAX) + #error "SC_DEV_TFTP cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_TFTP, TftpInit, TftpOpen, TftpClose, TftpRead, + NULLF, TftpCntl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem New TFTP driver that follows the new interface*/ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_NTFTP) + #if(SC_DEV_NTFTP > SC_DEVMAX) + #error "SC_DEV_NTFTP cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_NTFTP, TftpInit, StdTftpOpen, TftpClose, TftpRead, + NULLF, TftpCntl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem HTTP driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_HTTP) + #if(SC_DEV_HTTP > SC_DEVMAX) + #error "SC_DEV_HTTP cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_HTTP, HttpInit, HttpOpen, HttpClose, HttpRead, + NULLF, HttpCntl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the SPI driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SPI) + #if(SC_DEV_SPI > SC_DEVMAX) + #error "SC_DEV_SPI cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SPI, SPI_init, SPI_open, SPI_close, NULLF, + NULLF, SPI_io, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install DLPI drivers */ +/*---------------------------------------------------------------------*/ + +#if (SC_DEV_DLPI || SC_DEV_PPP || SC_DEV_SLIP) + { +#include "enetcfg.h" + +int dlpi_setinitroutine = 0; +int dlpi_nicount = 0; /* number of ni's below this DLPI */ +void (*init_fn)(); /* Ethernet driver initialization routine */ + /* Call this function only once */ +char *DlpiErrMsg = "DlpiAddNI failed: NI Error"; + +#if (SC_DEV_DLPI) + { + #if(SC_DEV_DLPI> SC_DEVMAX) + #error "SC_DEV_DLPI cannot be > SC_DEVMAX" + #endif + static const psedrvparam_t eth0param = {"eth0", DT_CLONE, &enetinfo, 0, 0}; + init_fn = NULLF; + if (!dlpi_setinitroutine) + { + init_fn = (void (*)())enetinit; + dlpi_setinitroutine = 1; + } + InstallDriver(SC_DEV_DLPI, init_fn, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)ð0param, 0, IO_STREAM_DEV); + dlpi_nicount++; + PsosNumDntEnts++; + } +#endif /* SC_DEV_DLPI */ + +#if SC_DEV_DLPI_PPP + { + #if(SC_DEV_DLPI_PPP > SC_DEVMAX) + #error "SC_DEV_DLPI_PPP cannot be > SC_DEVMAX" + #endif + static const psedrvparam_t pppparam = {"ppp", DT_CLONE, &enetinfo, 0, 0}; + init_fn = NULLF; + if (!dlpi_setinitroutine) + { + init_fn = (void (*)())enetinit; + dlpi_setinitroutine = 1; + } + InstallDriver(SC_DEV_DLPI_PPP, init_fn, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&pppparam, 0, IO_STREAM_DEV); + dlpi_nicount++; + PsosNumDntEnts++; + } +#endif /* SC_DEV_DLPI_PPP */ + +#if SC_DEV_DLPI_SLIP + { + #if(SC_DEV_DLPI_SLIP > SC_DEVMAX) + #error "SC_DEV_DLPI_SLIP cannot be > SC_DEVMAX" + #endif + static const psedrvparam_t slipparam = {"slip", DT_CLONE, &enetinfo, 0, 0}; + init_fn = NULLF; + if (!dlpi_setinitroutine) + { + init_fn = (void (*)())enetinit; + dlpi_setinitroutine = 1; + } + InstallDriver(SC_DEV_DLPI_SLIP, init_fn, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&slipparam, 0, IO_STREAM_DEV); + dlpi_nicount++; + PsosNumDntEnts++; + } +#endif /* SC_DEV_DLPI_SLIP */ + +/* + * User has defined other DLPI drivers locally. Include user + * file drv_conf.idl that installs user's own ENETDLPI drivers + */ +#if SC_DEV_DLPI_OTHER +#include "drv_conf.idl" +#endif + + /*-------------------------------------------------------------*/ + /* Call DlpiInit to initialize the Streams DLPI driver */ + /* Arguments passed to DlpiInit are: */ + /* 1. Free memory address */ + /* 2. Maximum NI interface number */ + /* 3. Maximum number of streams per interface */ + /*-------------------------------------------------------------*/ + FreeMemPtr = DlpiInit(FreeMemPtr, dlpi_nicount, SE_DLPI_MAXSTR_PERNI); + + /*-------------------------------------------------------------*/ + /* Call DlpiAddNI to add an NI interface to the Streams DLPI */ + /* driver. DlpiAddNI must be called for each NI driver */ + /* interface used with the Streams DLPI driver. */ + /* Arguments passed to DlpiAddNI are: */ + /* 1. NI interface number (should correspond to the pNA+ */ + /* interface number if driver is shared with pNA+) */ + /* 2. NI entry point */ + /* 3. NI flags */ + /* DLPI_IFF_SELFLOOP 0x0001 loopback for selfaddress */ + /* DLPI_IFF_POLL_NI 0x0002 driver must be polled */ + /* DLPI_IFF_RAWMEM 0x2000 driver accepts mblk */ + /* DLPI_IFF_NONIINIT 0x4000 Don't send NI_INIT */ + /* during enetinit() call */ + /* 4. NI major device number */ + /* 5. NI multicast address (NOT SUPPORTED) */ + /* 6. NI poll frequency (every # of elapsed ticks) */ + /*-------------------------------------------------------------*/ + +#if (SC_DEV_DLPI) + /* + * If this lan NI is not shared, use a loopback DLPI with interface + * number 0. NI entry point is set to DlpiNullNI(). + */ +#if (SE_SHARE_NI) + if (DlpiAddNI(SE_DLPI_ETH_IFNO, (long(*)())BSP_LAN1_ENTRY, + SE_DLPI_ETH_IFFLAGS, SC_DEV_DLPI, 0, SE_DLPI_ETH_POLLFREQ)) + SysInitFail(DlpiErrMsg); +#else + if (DlpiAddNI(0, (long(*)())DlpiNullNI, 0, SC_DEV_DLPI, 0, 0)) + SysInitFail(DlpiErrMsg); +#endif /* SE_SHARE_NI */ + +#endif /* SC_DEV_DLPI */ + +#if (SC_DEV_DLPI_PPP) + if (DlpiAddNI(SE_DLPI_PPP_IFNO, SE_DLPI_PPP_ENTRY, SE_DLPI_PPP_IFFLAGS, + SC_DEV_DLPI_PPP, 0, SE_DLPI_PPP_POLLFREQ)) + SysInitFail(DlpiErrMsg); + if (DlpiAddParams(SE_DLPI_PPP_IFNO, SE_DLPI_PPP_ADDRSIZE, + SE_DLPI_PPP_MAXMTU, SE_DLPI_PPP_MINMTU, (char *)NULL)) + SysInitFail(DlpiErrMsg); +#endif /* SC_DEV_DLPI_PPP */ + +#if (SC_DEV_DLPI_SLIP) + if (DlpiAddNI(SE_DLPI_SLIP_IFNO,SE_DLPI_SLIP_ENTRY, SE_DLPI_SLIP_IFFLAGS, + SC_DEV_DLPI_SLIP, 0, SE_DLPI_SLIP_POLLFREQ)) + SysInitFail(DlpiErrMsg); + if (DlpiAddParams(SE_DLPI_SLIP_IFNO, SE_DLPI_SLIP_ADDRSIZE, + SE_DLPI_SLIP_MAXMTU, SE_DLPI_SLIP_MINMTU, (char *)NULL)) + SysInitFail(DlpiErrMsg); +#endif /* SC_DEV_DLPI_SLIP */ + +/* + * User has defined other DLPI drivers locally. Include user + * file drv_conf.adl that adds user Dlpi drivers to the system. + */ +#if SC_DEV_DLPI_OTHER +#include "drv_conf.adl" +#endif + + } +#endif /* (SC_DEV_DLPI || SC_DEV_PPP || SC_DEV_SLIP) */ + +#if (SC_DEV_LOG) + { + extern void loginit(); + extern struct streamtab loginfo; + static const psedrvparam_t log_drv = {"log", DT_DRIVER|DS_SVR4_STYLE, + &loginfo, 0, 0}; + + InstallDriver(SC_DEV_LOG, loginit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&log_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; + } +#endif + +/*-------------------------------------------------------------------*/ +/* Install pSOSystem Watchdog driver */ +/*-------------------------------------------------------------------*/ +#if (SC_DEV_WATCHDOG) + #if(SC_DEV_WATCHDOG > SC_DEVMAX) + #error "SC_DEV_WATCHDOG cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_WATCHDOG, WdtInit, NULLF, NULLF, NULLF, + NULLF, NULLF, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +#if (SC_DEV_OTCP) + { +extern void otcp_ipspace_init(), otcp_arpspace_init(), otcp_rawspace_init(), + otcp_udpspace_init(), otcp_tcpspace_init(), otcp_loopspace_init(); +extern struct streamtab otcp_ipinfo, otcp_arpinfo, otcp_rawinfo, otcp_udpinfo, + otcp_tcpinfo, otcp_loopinfo; + +#if (SC_IP) + static const psedrvparam_t ip_drv = {"ip", DT_CLONE, &otcp_ipinfo, 0, 0}; +#endif +#if (SC_ARP) + static const psedrvparam_t arp_drv = {"arp", DT_CLONE, &otcp_arpinfo, 0, 0}; +#endif +#if (SC_TCP) + static const psedrvparam_t tcp_drv = {"tcp", DT_CLONE, &otcp_tcpinfo, 0, 0}; +#endif +#if (SC_UDP) + static const psedrvparam_t udp_drv = {"udp", DT_CLONE, &otcp_udpinfo, 0, 0}; +#endif +#if (SC_RAW) + static const psedrvparam_t raw_drv = {"raw", DT_CLONE, &otcp_rawinfo, 0, 0}; +#endif +#if (SC_LOOP) + static const psedrvparam_t loop_drv = {"loop", DT_CLONE, &otcp_loopinfo, 0, 0}; +#endif + +#if (SC_IP) + InstallDriver(SC_IP, otcp_ipspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&ip_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_ARP) + InstallDriver(SC_ARP, otcp_arpspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&arp_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_RAW) + InstallDriver(SC_RAW, otcp_rawspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&raw_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_UDP) + InstallDriver(SC_UDP, otcp_udpspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&udp_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_TCP) + InstallDriver(SC_TCP, otcp_tcpspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&tcp_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_LOOP) + InstallDriver(SC_LOOP, otcp_loopspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&loop_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif + + } +#endif /* (SC_DEV_OTCP) */ + +#if (SC_DEV_OLAP) + { + extern struct streamtab phpiinfo, twfrinfo ; + extern void phpiinit(), twfrinit(); +#if (SC_PHPI) + static const psedrvparam_t phpiparam={"phpi",DT_CLONE,&phpiinfo, 0, 0}; +#endif +#if (SC_LAPB) + static const psedrvparam_t lapbparam ={"lapb", DT_REGULAR,&twfrinfo,0, 0}; +#endif + +#if (SC_PHPI) + InstallDriver(SC_PHPI, phpiinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&phpiparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_LAPB) + InstallDriver(SC_LAPB, twfrinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&lapbparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif + } +#endif + +#if (SC_DEV_OX25) + { + extern struct streamtab phpiinfo, twfrinfo, twpkinfo, twsninfo, ipconvinfo; + extern void twpkinit(), twsninit(), tcpsninit(); +#if (SC_X25) + static const psedrvparam_t x25param ={"x25", DT_DRIVER, &twpkinfo, 0, 0}; +#endif +#if (SC_SNDCF) + static const psedrvparam_t sndfparam ={"sndf", DT_REGULAR, &twsninfo, 0, 0}; +#endif +#if (SC_IPCONV) + static const psedrvparam_t ipconvparam={"ipsn",DT_REGULAR, &ipconvinfo, 0, 0}; +#endif + +#if (SC_X25) + InstallDriver(SC_X25, twpkinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&x25param, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_SNDCF) + InstallDriver(SC_SNDCF, twsninit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&sndfparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_IPCONV) + InstallDriver(SC_IPCONV, tcpsninit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&ipconvparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif + } +#endif + +#if (SC_DEV_ISDN) + { + extern struct streamtab phinfo, q921info, ipcdinfo ; + extern void q921init(), phinit(); + +#if (SC_PH) + static const psedrvparam_t phpiparam={"ph",DT_REGULAR,&phinfo, 0, 0}; +#endif +#if (SC_LAPD) + static const psedrvparam_t lapbparam={"q921",DT_REGULAR,&q921info,0,0}; +#endif +#if (SC_IPCD) + static const psedrvparam_t ipcdparam={"ipcd",DT_REGULAR,&ipcdinfo,0,0}; +#endif + +#if (SC_PH) + InstallDriver(SC_PH, phinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&phpiparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_LAPD) + InstallDriver(SC_LAPD, q921init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&lapbparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_IPCD) + InstallDriver(SC_IPCD, NULLF, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&ipcdparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif + } +#endif + +#if (SC_DEV_MLPP) + { + extern struct streamtab frmuxtab, pppstream, Spimtab; + extern void frmuxinit(); + +#if (SC_FRMUX) + static const psedrvparam_t fmuxparam ={"cfmux",DT_REGULAR,&frmuxtab,0,0}; +#endif +#if (SC_PPP) + static const psedrvparam_t pppparam ={"cppp",DT_REGULAR,&pppstream,0,0}; +#endif +#if (SC_PIM) + static const psedrvparam_t pimparam ={"cpim",DT_REGULAR,&Spimtab,0,0}; +#endif + +#if (SC_FRMUX) + InstallDriver(SC_FRMUX, frmuxinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&fmuxparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_PPP) + InstallDriver(SC_PPP, NULLF, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&pppparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_PIM) + InstallDriver(SC_PIM, NULLF, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&pimparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif + } +#endif + +#if defined(SC_DEV_PSMUX) && SC_DEV_PSMUX +#include "drv_conf.app" +#endif + +/*---------------------------------------------------------------------*/ +/* Additional drivers may be installed here. */ +/*---------------------------------------------------------------------*/ + +return FreeMemPtr; +} + +/***********************************************************************/ +/* DrvSysStartCO : This is called from sysinit.c "SysStartCO". */ +/* */ +/* INPUTS: None */ +/* */ +/* RETURNS: None */ +/* OUTPUTS: None */ +/* NOTE(S): Currently used to set-up the Initial Device Name Table */ +/* Additional code can be added here to clean-up the */ +/* driver specific data area. */ +/* */ +/***********************************************************************/ +void DrvSysStartCO() +{ + +/*---------------------------------------------------------------------*/ +/* Following are the call-outs which will be called. If your driver */ +/* needs pSOS+ "GS" (Warm Startup) notification to clear your driver */ +/* data structures, register here, so that it will be called. */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SERIAL && BSP_SERIAL) + DevSerialCO(); +#endif + +#if (SC_DEV_CONSOLE && BSP_CONSOLE) + DevPCConsoleCO(); +#endif + +/*---------------------------------------------------------------------*/ +/* Default CONSOLE is passed as the DEFAULT CONSOLE for Re-Direction */ +/* CONSOLE can be either DEV_CONSOLE or DEV_SERIAL. */ +/*---------------------------------------------------------------------*/ +#if SC_DEV_PSCONSOLE + PsConsoleSysStartCo(SC_PSCNSL_DEFAULT_DEV, SC_PSCNSL_DEFAULT_DEV); +#endif + +#if SC_DEV_RDIO + RdioSysStartCo(); +#endif + +#if SC_DEV_SCSI && BSP_SCSI + DevScsiCO(); +#endif + +#if SC_DEV_SCSI_TAPE && BSP_SCSI_TAPE + DevScsiCO(); +#endif + +#if SC_DEV_IDE && BSP_IDE + DevIdeCO(); +#endif + +#if SC_DEV_PARALLEL + DevParallelCO(); +#endif + +#if SC_DEV_FLOPPY && BSP_FLOPPY + DevFloppyCO(); +#endif + +#if (SC_DEV_TFTP || SC_DEV_NTFTP) + DevTftpCO(); +#endif + +#if SC_DEV_HTTP + DevHttpCO(); +#endif + +#if SC_DEV_PIPE + DevPipeCO(); +#endif + +/*---------------------------------------------------------------------*/ +/* This code is used to build the initial table of device names used */ +/* in the pSOSystem. */ +/*---------------------------------------------------------------------*/ +/*-----------------------------------------------------------------*/ +/* Make one name for the entrie pSOSystem Serial channels. */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_SERIAL && BSP_SERIAL) + dnt_add("tty", DEV_SERIAL); +#endif /* SC_DEV_SERIAL */ + +/*-----------------------------------------------------------------*/ +/* Make one name for the PC Console Driver. (PC-Monitor). */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_CONSOLE && BSP_CONSOLE) + dnt_add("pcconsole", DEV_CONSOLE); +#endif + +/*-----------------------------------------------------------------*/ +/* Null Driver. */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_NULL + dnt_add("null", DEV_NULL); +#endif + +/*-----------------------------------------------------------------*/ +/* There is only one timer in the system. Make a name for it. */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_TIMER + dnt_add("timer", DEV_TIMER); +#endif /* SC_DEV_TIMER */ + +/*-----------------------------------------------------------------*/ +/* Add DNT entries for all pSEUDO console minor devices */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_PSCONSOLE + dnt_add("psconsole", DEV_PSCONSOLE + SYSCONSOLE_DEV); + dnt_add("stdin", DEV_PSCONSOLE + STDIN_DEV); + dnt_add("stdout", DEV_PSCONSOLE + STDOUT_DEV); + dnt_add("stderr", DEV_PSCONSOLE + STDERR_DEV); +#endif + +#if SC_DEV_MEMLOG + dnt_add("memlog", DEV_MEMLOG); +#endif + +#if SC_DEV_RDIO + dnt_add("rdio", DEV_RDIO); +#endif + + +/*-----------------------------------------------------------------*/ +/* Add the name for the RAMDISK driver as "ramdisk". */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_RAMDISK + dnt_add("ramdisk", DEV_RAMDISK); +#endif /* SC_DEV_RAMDISK */ + +/*-----------------------------------------------------------------*/ +/* Add the name for the PIPE drivers as "pipe". */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_PIPE + dnt_add("pipe", DEV_PIPE); +#endif /* SC_DEV_PIPE */ + +/*-----------------------------------------------------------------*/ +/* Add the name for the SCSI driver as "scsi". */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_SCSI && BSP_SCSI) + dnt_add("scsi", DEV_SCSI); +#endif /* SC_DEV_SCSI && BSP_SCSI */ + +/*-----------------------------------------------------------------*/ +/* Add the name for the SCSI-TAPE driver as "tape". */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_SCSI_TAPE && BSP_SCSI_TAPE) + dnt_add("tape", DEV_SCSI_TAPE); +#endif /* SC_DEV_SCSI_TAPE && BSP_SCSI_TAPE */ + +/*-----------------------------------------------------------------*/ +/* Add the name for the IDE driver as "ide". */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_IDE && BSP_IDE) + dnt_add("ide", DEV_IDE); +#endif /* SC_DEV_IDE && BSP_IDE */ + +/*-----------------------------------------------------------------*/ +/* There is only one parallel driver in the system. Make a name */ +/* for it. */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_PARALLEL + dnt_add("printer", DEV_PARALLEL); +#endif /* SC_DEV_PARALLEL */ + +/*-----------------------------------------------------------------*/ +/* Add the name for the floppy driver in the system. */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_FLOPPY && BSP_FLOPPY) + dnt_add("floppy", DEV_FLOPPY); +#endif /* SC_DEV_FLOPPY */ + +/*-----------------------------------------------------------------*/ +/* There is only one watchdog driver in the system. Make a name */ +/* for it. */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_WATCHDOG + dnt_add("watchdog", DEV_WATCHDOG); +#endif /* SC_DEV_WATCHDOG */ + +/*-----------------------------------------------------------------*/ +/* There is only one cmos driver in the system. Make a name for it.*/ +/*-----------------------------------------------------------------*/ +#if SC_DEV_CMOS + dnt_add("cmos", DEV_CMOS); +#endif /* SC_DEV_CMOS */ + +/*-----------------------------------------------------------------*/ +/* Make the name for TFTP driver as "tftp". */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_TFTP) + dnt_add("tftp", DEV_TFTP); +#endif /* SC_DEV_TFTP */ + +/*-----------------------------------------------------------------*/ +/* Make the name for NTFTP driver as "ntftp". */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_NTFTP) + dnt_add("ntftp", DEV_NTFTP); +#endif /* SC_DEV_NTFTP */ + +/*-----------------------------------------------------------------*/ +/* Make default name for the HTTP pseudo device. */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_HTTP + dnt_add("http" , DEV_HTTP); +#endif /* SC_DEV_HTTP */ + +#if (SC_DEV_DLPI || SC_DEV_PPP || SC_DEV_SLIP) +/*-----------------------------------------------------------------*/ +/* There is only one enetdlpi driver in the system. */ +/* Make a name for it. */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_DLPI + dnt_add("dlpi", DEV_DLPI); +#endif /* SC_DEV_DLPI */ + +/*-----------------------------------------------------------------*/ +/* There is only one enetslip driver in the system. Make a name for it.*/ +/*-----------------------------------------------------------------*/ +#if SC_DEV_DLPI_SLIP + dnt_add("dlslip", DEV_DLPI_SLIP); +#endif /* SC_DEV_DLPI_SLIP */ + +/*-----------------------------------------------------------------*/ +/* There is only one enetppp driver in the system. Make a name for it.*/ +/*-----------------------------------------------------------------*/ +#if SC_DEV_DLPI_PPP + dnt_add("dlppp", DEV_DLPI_PPP); +#endif /* SC_DEV_DLPI_PPP */ + +#endif + +#if (SC_DEV_LOG) + dnt_add("log", DEV_LOG); +#endif + +#if (SC_DEV_OTCP) + +#if (SC_IP) + dnt_add("ip", DEV_IP); +#endif +#if (SC_ARP) + dnt_add("arp", DEV_ARP); +#endif +#if (SC_TCP) + dnt_add("tcp", DEV_TCP); +#endif +#if (SC_UDP) + dnt_add("udp", DEV_UDP); +#endif +#if (SC_RAW) + dnt_add("raw", DEV_RAW); +#endif +#if (SC_LOOP) + dnt_add("loop", DEV_LOOP); +#endif + +#endif + + +#if (SC_DEV_OLAP) + +#if (SC_PHPI) + dnt_add("phpi", DEV_PHPI); +#endif + +#if (SC_LAPB) + dnt_add("lapb", DEV_LAPB); +#endif + +#endif + +#if (SC_DEV_OX25) + +#if (SC_X25) + dnt_add("x25", DEV_X25); +#endif + +#if (SC_SNDCF) + dnt_add("sndcf", DEV_SNDCF); +#endif + +#if (SC_IPCONV) + dnt_add("ipconv", DEV_IPCONV); +#endif + +#endif + +#if (SC_DEV_ISDN) + +#if (SC_PH) + dnt_add("ph", DEV_PH); +#endif + +#if (SC_LAPD) + dnt_add("q921", DEV_LAPD); +#endif + +#if (SC_IPCD) + dnt_add("ipcd", DEV_IPCD); +#endif + +#endif + +#if (SC_DEV_MLPP) + +#if (SC_FRMUX) + dnt_add("cfmux", DEV_FRMUX); +#endif + +#if (SC_PIM) + dnt_add("cpim", DEV_PIM); +#endif + +#if (SC_PPP) + dnt_add("cppp", DEV_PPP); +#endif + +#endif +/*-----------------------------------------------------------------*/ +/* Names for additional drivers may be added here. */ +/*-----------------------------------------------------------------*/ + +} +#endif /* SC_PSOS || SC_PSOSM */ + +#if (SC_PNA || SC_PNET) +/***********************************************************************/ +/* SetUpNI: Set up Network Interfaces for pNA+ */ +/* */ +/* INPUT: FreeMemPtr = A pointer to unused memory that can be */ +/* used to allocate space for a driver. */ +/* NOTE: Be sure to advance FreeMemPtr if */ +/* memory is allocates! */ +/* */ +/* RETURNS: The new address of free memory after the drivers have */ +/* allocated space. */ +/* */ +/* NOTES: This function does many precompile checks so errors */ +/* can be found during compile-time rather then at run- */ +/* time. */ +/* */ +/* Also, the Network Interface Table must be allocated */ +/* before this function can be called. There cannot be */ +/* more then NC_NNI entries in this table. NC_NNI is set */ +/* in sys_conf.h. Before adding another interface, be */ +/* sure to check sys_conf.h to see if NC_NNI is set to */ +/* accommodate another one! */ +/* */ +/* See the pSOSystem Programmers Reference Manual */ +/* for more information. */ +/* */ +/* To add a Network driver to pSOSystem, call InstallNi(). This adds */ +/* the Network Interface to the pNA+ Network Interface Table. */ +/* InstallNi() takes the following arguments: */ +/* */ +/* int (*entry)(); address of NI entry point */ +/* int ipadd; IP address */ +/* int mtu; maximum transmission length */ +/* int hwalen; length of hardware address */ +/* int flags; intErface flags */ +/* int subnetaddr; subnet mask */ +/* int dstipaddr; destination ip address */ +/* */ +/* See pSOSystem Programmer`s Reference Manual, Configuration Tables */ +/* Section, for more information about the Network Interface Table. */ +/* InstallNi() does not return a value. */ +/* */ +/* If you are adding a driver that needs to be initialized before */ +/* either pSOS+ is initialized or the driver's init function is */ +/* called, then you can call a setup function (that you create) for */ +/* the driver. If your initialization function needs to allocate */ +/* memory, you may pass it the FreeMemPtr. The function should return */ +/* a new FreeMemPtr which points to the end of the memory it has */ +/* allocated. */ +/* */ +/* When adding code to install a new driver, it is a good idea to add */ +/* precompile checks so errors can be found during compile-time rather */ +/* then at run-time. Precompile checks are used, for example, in the */ +/* code that installs the pSOSystem serial device driver below. */ +/* */ +/***********************************************************************/ +UCHAR *SetUpNI(UCHAR *FreeMemPtr) +{ +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem NI. */ +/*---------------------------------------------------------------------*/ +#if BSP_LAN1 + if (SysVars.Lan1) + { + register int IPaddr; + register long (*NiLanPtr)(ULONG, union nientry *); + + #if (SC_DEV_DLPI && SE_SHARE_NI) + NiLanPtr = (long (*)(ULONG, union nientry *))DlpiEnet; + #else + NiLanPtr = (long (*)(ULONG, union nientry *))BSP_LAN1_ENTRY; + #endif + + /*-------------------------------------------------------------*/ + /* If RARP is specified for the IP address, use it now to */ + /* obtain the IP address for this interface. */ + /*-------------------------------------------------------------*/ + if (SysVars.Lan1IP == USE_RARP) + { + IPaddr = RarpEth(NiLanPtr); + + if (IPaddr == 0) + SysInitFail(RarpErrTimeout); + if (IPaddr == -1) + SysInitFail(RarpErrNet); + } + else + IPaddr = SysVars.Lan1IP; + + InstallNi(NiLanPtr, IPaddr, BSP_LAN1_MTU, BSP_LAN1_HWALEN, + BSP_LAN1_FLAGS, SysVars.Lan1SubnetMask, 0); + } +#endif + +/*---------------------------------------------------------------------*/ +/* Install the shared memory NI. */ +/*---------------------------------------------------------------------*/ +#if BSP_SMEM + #if ((SC_NISM_LEVEL != 1) && (SC_NISM_LEVEL != 2)) + #error "Illegal value for SC_NISM_LEVEL" + #endif + + if (SysVars.Nism) + { + InstallNi(NiSmem, SysVars.NismIP, NISM_MTU, 4, 0x8002, + SysVars.NismSubnetMask, 0); + } +#endif + +/*---------------------------------------------------------------------*/ +/* Additional Network drivers may be installed here. */ +/*---------------------------------------------------------------------*/ + +return FreeMemPtr; +} + +#endif /* (SC_PNA || SC_PNET) */ diff --git a/h/wrn/wm/util/port/isisnmp/arm250/sys_conf.h b/h/wrn/wm/util/port/isisnmp/arm250/sys_conf.h new file mode 100644 index 0000000..9a53259 --- /dev/null +++ b/h/wrn/wm/util/port/isisnmp/arm250/sys_conf.h @@ -0,0 +1,1126 @@ +/* @(#) pSOSystem: apps/inetutil/sys_conf.h (&U&) 1.2 00/01/27 15:24:03 */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/* [clearcase] +modification history +------------------- +*/ + +/***********************************************************************/ +/* */ +/* MODULE: sys_conf.h */ +/* DATE: 00/01/27 */ +/* PURPOSE: pSOSystem configuration definitions */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* Copyright 1991 - 2000, Integrated Systems, Inc. */ +/* ALL RIGHTS RESERVED */ +/* */ +/* Permission is hereby granted to licensees of Integrated Systems, */ +/* Inc. products to use or abstract this computer program for the */ +/* sole purpose of implementing a product based on Integrated */ +/* Systems, Inc. products. No other rights to reproduce, use, */ +/* or disseminate this computer program, whether in part or in */ +/* whole, are granted. */ +/* */ +/* Integrated Systems, Inc. makes no representation or warranties */ +/* with respect to the performance of this computer program, and */ +/* specifically disclaims any responsibility for any damages, */ +/* special or consequential, connected with the use of this program. */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* This is a header file which defines all of the system-level */ +/* parameters that are likely to need changing. */ +/* */ +/* It has been set up to be as close as possible to the settings */ +/* which are appropriate for this application. However, you may */ +/* need to make some changes to parameters to reflect your */ +/* environment, such as IP addresses, etc. */ +/* */ +/* The "Configuration and Startup" section of the "Programmer's */ +/* Reference" manual in pSOSystem contains a complete description */ +/* of the symbols that are defined in this file. */ +/* */ +/***********************************************************************/ +#ifndef _SYS_CONF_H +#define _SYS_CONF_H + +#ifdef __cplusplus +extern "C" { +#endif + +/***********************************************************************/ +/* */ +/* SC_APP_PARMS must be defined before you include sysvars.h file. */ +/* Since "sysvars.h" file depends on SC_APP_PARMS and BSP_PARMS */ +/* to define the Storage Parms Structure. */ +/* */ +/* Defining this variable to a Non-Zero Value will create a space in */ +/* the Storage Parms corresponding to the value. The total space */ +/* allocated is the sum of the BSP_PARMS and SC_APP_PARMS. */ +/* */ +/* SC_APP_NAME define controls the application name string that will */ +/* be displayed during the boot dialog. */ +/* */ +/***********************************************************************/ +#define SC_APP_PARMS 0 +#define SC_APP_NAME "inetutil Application" + +/*---------------------------------------------------------------------*/ +/* sys/types.h contains common definitions, (example YES, NO and more) */ +/*---------------------------------------------------------------------*/ +#include + +/*---------------------------------------------------------------------*/ +/* sysvars.h contains the structures and definitions for the system */ +/* variables that are stored in NVRAM. These structures and */ +/* definitions are also used when creating the boot ROM for the */ +/* target system. By using the same sysvars.h file it will ensure */ +/* consistency of the values stored by the boot ROM and the downloaded */ +/* RAM application. */ +/*---------------------------------------------------------------------*/ +#include + +/*---------------------------------------------------------------------*/ +/* psos.h header file defines IO_AUTOINIT and IO_NOAUTOINIT */ +/*---------------------------------------------------------------------*/ +#include + +/*---------------------------------------------------------------------*/ +/* If USE_RARP is set to YES, then the IP address is obtained from the */ +/* network. */ +/*---------------------------------------------------------------------*/ +#define USE_RARP NO + +/***********************************************************************/ +/* */ +/* B A S I C P A R A M E T E R S */ +/* */ +/* The parameters in this section determine the fashion in which */ +/* many of the other parameters in this file will be used. */ +/* */ +/* Many of the parameters in this file have names beginning with */ +/* either "SC_" or "SD_". Those beginning with "SC_" are ALWAYS */ +/* controlled by the values you set in this file. The values of */ +/* the "SD_" parameters can be determined either by the definitions */ +/* given in this file, or by the data found in the target board's */ +/* parameter storage area. SC_SD_PARAMETERS determines this. If */ +/* SC_SD_PARAMETERS is "SYS_CONF", then the values given in this */ +/* file will be used for the SD_ parameters. If SC_SD_PARAMETERS */ +/* is "STORAGE", then pSOSystem will attempt to use the values found */ +/* in the board's parameter storage area for the SD_ variables. If */ +/* the parameter storage area has not been initialized or has been */ +/* corrupted, then the values given in this file will be used. They */ +/* will also be written to the storage area. */ +/* */ +/* If SC_SD_PARAMETERS is STORAGE, you may enable a "startup dialog" */ +/* which will allow you to view, and optionally change, the */ +/* parameter values found in the storage area. The dialog is enabled */ +/* by setting SC_STARTUP_DIALOG to YES. In this case, */ +/* SD_STARTUP_DELAY specifies the number of seconds that the dialog */ +/* will wait for input before proceeding to boot the system. */ +/* */ +/* The SC_STARTUP_DIALOG define either enables the boot dialog if set */ +/* to YES, or disables the boot dialog if set to NO. */ +/* */ +/* SC_BOOT_ROM when set to YES, configures the application as a */ +/* ROMable application. If set to NO, treats it as a RAM application. */ +/* */ +/* SC_SD_DEBUG_MODE determines the mode of the system, as follows: */ +/* */ +/* DBG_SA: Boot pROBE+ in standalone mode. */ +/* */ +/* DBG_XS: Boot into pROBE+ and wait for the host debugger */ +/* via a serial connection */ +/* */ +/* DBG_XN: Boot into pROBE+ and wait for the host debugger */ +/* via a network connection */ +/* */ +/* DBG_AP: Same as DBG_SA, but also does a pROBE+ "silent startup",*/ +/* meaning that pROBE+ initializes itself without */ +/* printing a startup banner. pROBE+ then initializes */ +/* pSOS+ and starts the application running. This mode */ +/* was created to simplify implementation of the pSOSystem */ +/* Boot ROMs. Note that when this mode is used, SMODE_MASK */ +/* in TD_FLAGS is always set. (See pROBE+ configuration */ +/* parameters below.) */ +/* */ +/* STORAGE: Use the mode (DBG_SA, DBG_XS, or DBG_XN) found in the */ +/* parameter storage area. If a valid mode is not found, */ +/* then use DBG_SA. */ +/* */ +/* An important consequence of using SC_SD_DEBUG_MODE=STORAGE should */ +/* be noted. If you use the TFTP bootloader in the pSOSystem ROMs */ +/* to download and start your system, you will be setting */ +/* SC_SD_DEBUG_MODE = DBG_AP in your target board's parameter storage */ +/* area. Thus, if you have left SC_SD_DEBUG_MODE set to STORAGE in */ +/* this file, your downloaded system will also use DBG_AP, meaning */ +/* that the application will begin running immediately after the */ +/* TFTP bootloader has loaded and started your system. */ +/* */ +/* */ +/***********************************************************************/ + +#define SC_SD_PARAMETERS STORAGE +#define SC_STARTUP_DIALOG NO +#define SC_BOOT_ROM NO +#define SD_STARTUP_DELAY 60 +#define SC_SD_DEBUG_MODE STORAGE + +/***********************************************************************/ +/* */ +/* O P E R A T I N G S Y S T E M C O M P O N E N T S */ +/* */ +/* Setting the definition line to YES will cause that component to */ +/* be built into the system. NO means the component will NOT be */ +/* put into the system. */ +/*---------------------------------------------------------------------*/ +/* pSOS+: It is an error to specify both SC_PSOS and SC_PSOSM as */ +/* present! */ +/* */ +/*---------------------------------------------------------------------*/ +/* pROBE+: The following set of macros control which features will be */ +/* built in to the pROBE+ Target Agent. pROBE+ can run either in */ +/* console mode (dumb terminal) or as a back-end to a Source Level */ +/* Debugger on the host. Not all modules are needed for all cases.*/ +/* By eliminating modules you can save memory. The definition of */ +/* the modules are as follows: */ +/* */ +/* SC_PROBE - pROBE+ core module. This must always be present if */ +/* any part of pROBE+ is to be used. Setting this to NO will */ +/* force all other pROBE+ modules to NO (even if they say YES */ +/* in this file). */ +/* */ +/* SC_PROBE_CIE - pROBE+ Console Executive. Set this to YES if you */ +/* wish to control pROBE+ from a dumb terminal. If you only */ +/* use a source debugger and/or pRISM+, you can save memory by */ +/* setting it to NO. If it is YES, you also need to sepcify the */ +/* serial port used by the pROBE+ via SC_PROBE_CONSOLE. */ +/* */ +/* SC_PROBE_DISSAM - pROBE+ Console Dissassembler. If you set */ +/* SC_PROBE_CIE to YES and wish to view disassembled memory, set */ +/* this to YES as well. If you are using a host debugger and/or */ +/* pRISM+, you can save memory by setting this to NO. */ +/* */ +/* SC_PROBE_QUERY - pROBE+ Query Services which provides the pSOS+ */ +/* awareness. This module allows you to query the information */ +/* about pSOS+ obejects, issue a console-induced manual break */ +/* or halt-request from the host debugger, set the task-specific */ +/* breakpoints, service call breakpoints and task-dispatch */ +/* breakpoints. Unless you have severe memory restrictions or */ +/* your application does not use pSOS+ kernel, it is suggested */ +/* that you set this to YES. */ +/* */ +/* SC_PROBE_DEBUG - pROBE+ Remote Debug Module. This module is */ +/* used to enable communication between a host based source */ +/* debugger and/or pRISM+ to the pROBE+ target agent using a */ +/* light weight binary protocol. This must be set to YES to */ +/* enable pROBE+ to communicate with a source debugger or the */ +/* pRISM+ host tools. It can be set to NO if you only use the */ +/* pROBE+ console (dumb terminal) mode. If it is YES and the */ +/* host debuuger is connected the target via network, you have */ +/* to set the SC_PNET or SC_PNA to YES. If the host debugger */ +/* is using the serial connection, you have to select the proper */ +/* serial port via SC_RBUG_PORT. Note if a serial port is used */ +/* by the pROBE+ for the host debugger connection, this port */ +/* should not be used by the application except for */ +/* SC_PROBE_CONSOLE. For example, you should not set */ +/* SC_RBUG_PORT and SC_APP_CONSOLE to the same serial port */ +/* unless you don't use the host debugger when the application */ +/* is running. */ +/* */ +/* SC_PROBE_HELP - pROBE+ online help module. Setting this define */ +/* to YES provides the user with pROBE+ commands, when in */ +/* stand-alone mode. */ +/*---------------------------------------------------------------------*/ +/* SC_PHILE through SC_POSIX_TIMERS - Setting the definition line to*/ +/* YES will cause that component to be built into the system. */ +/* Setting it to NO means the component will NOT be put into the */ +/* system. */ +/* */ +/***********************************************************************/ +#define SC_PSOS YES /* pSOS+ real-time kernel */ +#define SC_PSOSM NO /* pSOS+ real-time multiproc kernel */ +#define SC_PSOS_QUERY NO /* pSOS+ Query Services */ +#define SC_PROBE YES /* pROBE+ (processor svcs) */ +#define SC_PROBE_DISASM YES /* pROBE+ (disassembler) */ +#define SC_PROBE_CIE YES /* pROBE+ (console executive) */ +#define SC_PROBE_QUERY YES /* pROBE+ (query services) */ +#define SC_PROBE_DEBUG YES /* pROBE+ (debug interface executive) */ +#define SC_PROBE_HELP YES /* pROBE+ Help command Handler. */ +#define SC_PHILE NO /* pHILE+ file system manager */ +#define SC_PHILE_PHILE YES /* pHILE+ (pHILE+ real-time file sys) */ +#define SC_PHILE_MSDOS YES /* pHILE+ (MS-DOS FAT file system) */ +#define SC_PHILE_NFS NO /* pHILE+ (NFS client) */ +#define SC_PHILE_CDROM NO /* pHILE+ (ISO 9660 CD-ROM file sys) */ +#define SC_PREPC YES /* pREPC+ C run-time library */ +#define SC_PNA YES /* pNA+ TCP/IP networking manager */ +#define SC_PNET NO /* pNET Library for BOOT ROMS */ +#define SC_PRPC NO /* pRPC+ RPC component */ +#define SC_PSE_PRPC NO /* pRPC+ RPC component Over pSE+ */ +#define SC_PSE NO /* pSE+ streams component */ +#define SC_PSKT NO /* pSKT+ SKT library component */ +#define SC_PTLI NO /* pTLI+ TLI library component */ +#define SC_PMONT NO /* pMONT+ */ +#define SC_PLM NO /* pLM+ Shared library manager */ +#define SC_PROFILER NO /* RTA profiler configuration */ +#define SC_RTEC NO /* RTA run-time error checker library */ +#define SC_CXX_PKG NO /* C++ Support Package */ +#define SC_POSIX NO /* POSIX component (core) */ +#define SC_POSIX_MESSAGE_PASSING NO /* POSIX (Message Queue svcs) */ +#define SC_POSIX_SEMAPHORES NO /* POSIX (semaphore svcs) */ +#define SC_POSIX_THREADS NO /* POSIX (pthread svcs) */ +#define SC_POSIX_TIMERS NO /* POSIX (clock and timer svcs)*/ + +/*---------------------------------------------------------------------*/ +/* If SC_QBIND is set to YES then the Quick bindings for pSOS+ System */ +/* calls will be used. If it is set to NO then the normal bindings */ +/* will be used. */ +/* */ +/* Quick bindings will not be supported for the applications with */ +/* USER mode Tasks. So make sure your Application does not have any */ +/* USER mode Tasks. */ +/*---------------------------------------------------------------------*/ +#define SC_QBIND NO /* Quick bindings for pSOSystem calls*/ + +/*---------------------------------------------------------------------*/ +/* If set to IO_AUTOINIT device drivers that are installed be the */ +/* InstallDriver function will have their autoinit field set. This */ +/* will cause pSOS+ call the drivers initialization function when */ +/* pSOS+ starts up. The de_init call will not have to be called for */ +/* each driver if this is done. */ +/* */ +/* NOTE: This Auto Initialization will not work on all drivers. */ +/* Setting IO_AUTOINIT only effects drivers that can use the Auto */ +/* Initialization feature. */ +/* */ +/* If set to IO_NOAUTOINIT no automatic driver initialization will */ +/* happen. */ +/*---------------------------------------------------------------------*/ +#define SC_AUTOINIT IO_AUTOINIT + +/*---------------------------------------------------------------------*/ +/* If SC_PMONT SC_AUTOINIT will always be set to 1 because pMONT needs */ +/* drivers to be automatically initialized. */ +/*---------------------------------------------------------------------*/ +#if SC_PMONT + #undef SC_AUTOINIT + #define SC_AUTOINIT IO_AUTOINIT +#endif + +/***********************************************************************/ +/* */ +/* S E R I A L C H A N N E L C O N F I G U R A T I O N */ +/* */ +/* * SD_DEF_BAUD specifies the default baud rate to be used for the */ +/* serial channels */ +/* * SC_APP_CONSOLE specifies the serial channel number (starting */ +/* from 1) which should be used for the application's "console". */ +/* * SC_PROBE_CONSOLE specifies the serial channel number (starting */ +/* from 1) which pROBE+ should use to display output and receive */ +/* commands, or to communicate with the host debugger. */ +/* * SC_RBUG_PORT specifies the serial channel number (starting */ +/* from 1) which will be used for the connnect between the host */ +/* debugger and the pROBE+ on the target. This is not needed if */ +/* the host debugger is using the network connection. It can be */ +/* disabled by using a value of 0. Note the port specified by */ +/* SC_RBUG_PORT port should not be used by the application except */ +/* for SC_PROBE_CONSOLE. For example, you should not set */ +/* SC_RBUG_PORT and SC_APP_CONSOLE to the same serial channel */ +/* unless you don't use the host debugger when the application is */ +/* running. */ +/* */ +/* Above three macros SC_PROBE_CONSOLE, SC_APP_CONSOLE and */ +/* SC_RBUG_PORT uses SERIAL_DRVRNUM(0) as default. This means that */ +/* the Low-Level Serial Driver 0 (1) is being used default. */ +/* */ +/* If you need to use another driver for any of the above macros */ +/* and another macro for pMONT PM_DEV, You need to change "0" to */ +/* the driver number you want. Consult the "README" file in BSP */ +/* directory for number of different drivers supported and for the */ +/* SERIAL_DRVRNUM mapping for those drivers. */ +/* */ +/***********************************************************************/ +#define SD_DEF_BAUD 9600 +#define SC_APP_CONSOLE (1 + SERIAL_DRVRNUM(0)) +#define SC_PROBE_CONSOLE (1 + SERIAL_DRVRNUM(0)) +#define SC_RBUG_PORT (1 + SERIAL_DRVRNUM(0)) + +/***********************************************************************/ +/* SC_NumNon_pSOSChan is the number of non-pSOS users of the serial */ +/* channels. These are users that will be initiated before pSOS, */ +/* such as pROBE. */ +/* */ +/* NOTE: These channels will not be closed on a soft reset. */ +/***********************************************************************/ +#if (SC_RBUG_PORT && SC_PROBE_CONSOLE && (SC_PROBE_CONSOLE != PCCON)) +#define SC_NumNon_pSOSChan 2 +#else +#define SC_NumNon_pSOSChan 1 +#endif + +/***********************************************************************/ +/* */ +/* L A N C O N F I G U R A T I O N */ +/* */ +/* */ +/***********************************************************************/ +#define SD_LAN1 NO /* Enable the LAN interface */ +#define SD_LAN1_IP 0x00000000 /* target IP */ +#define SD_LAN1_SUBNET_MASK 0x00000000 /* subnet mask for the node */ + +/*---------------------------------------------------------------------*/ +/* Maximum number of multicast addresses to be used by the lan */ +/* interface. Must not exceed maximum supported by the lan driver. */ +/*---------------------------------------------------------------------*/ +#define SC_LAN1_NMCAST 0 + +/***********************************************************************/ +/* */ +/* B U S C O N F I G U R A T I O N */ +/* */ +/* */ +/***********************************************************************/ +#define SD_VME_BASE_ADDR 0x01000000 /* VME bus base address */ + +/***********************************************************************/ +/* */ +/* S H A R E D M E M O R Y C O N F I G U R A T I O N */ +/* */ +/* */ +/***********************************************************************/ + +/*---------------------------------------------------------------------*/ +/* If you want to build a "Shared Memory Interface" for the network or */ +/* multi-processing pSOS+m, set SD_SM_NODE to the node number of this */ +/* node ( a non-zero value). */ +/*---------------------------------------------------------------------*/ +#define SD_SM_NODE 0 /* Node number for this node */ + +/*---------------------------------------------------------------------*/ +/* Shared memory network interface (SMNI) - SC_NISM_LEVEL should be 1 */ +/* if this will be the FIRST system to use the SMNI on this board. It */ +/* should be 2 if this will not be the first system to use SMNI on this*/ +/* board. Usually this means that SC_NISM_LEVEL should be 1 if you */ +/* are building Boot ROMs, and 2 for a system that will be downloaded */ +/* and started using the Boot ROMs. See the comments at the beginning */ +/* of drivers/ni_smem.c for more explanation. */ +/*---------------------------------------------------------------------*/ +#define SD_NISM NO /* Disable/Enable Shared Mem NI */ +#define SD_NISM_IP 0x00000000 /* IP address of this node */ +#define SD_NISM_DIRADDR 0x00000400 /* Bus addr of SMNI directory */ +#define SC_NISM_BUFFS 30 /* Num of buffers for SMNI */ +#define SC_NISM_LEVEL 2 /* SMNI Level, 1 if first node */ +#define SD_NISM_SUBNET_MASK 0x00000000 /* Subnet mask for the SMNI */ + + +/*---------------------------------------------------------------------*/ +/* If you want to build a multi-node pSOS+m system, set SD_KISM */ +/* to the number of nodes in the system. */ +/*---------------------------------------------------------------------*/ +#define SD_KISM 0 /* Num of nodes that will use the SMKI */ +/*---------------------------------------------------------------------*/ +/* Bus Address of the system-wide directory structure that all nodes */ +/* in the system have access to. */ +/*---------------------------------------------------------------------*/ +#define SD_KISM_DIRADDR 0x00000580 +#define SC_KISM_BUFFS 100 /* Num of buffers for SMKI */ + + +/***********************************************************************/ +/* */ +/* M I S C E L L A N E O U S N E T W O R K I N G */ +/* P A R A M E T E R S */ +/* */ +/***********************************************************************/ +#define SD_DEF_GTWY_IP 0x00000000 + + +/***********************************************************************/ +/* SC_RAM_SIZE define controls the end of RAM as seen by pSOSystem. */ +/* If it is set to zero, then pSOSystem uses ALL of the memory */ +/* remaining on a board for dynamic allocation ("region 0"). You may */ +/* override this by setting SC_RAM_SIZE to a non-zero value. If you do,*/ +/* pSOSystem will not touch any memory after the specified address. */ +/* */ +/* NOTE: This is useful when making a BOOT ROM and you want to ensure */ +/* that the ROM's RAM area does not overflow the space allocated for it*/ +/***********************************************************************/ +#define SC_RAM_SIZE 0 + +/***********************************************************************/ +/* */ +/* I / O D E V I C E S */ +/* */ +/* Each device may be included in the system by specifying a major */ +/* number for it, which determines its slot in the pSOS+ I/O switch */ +/* table. To leave a device driver out of the system, use NO for */ +/* the major number. */ +/* */ +/* Note the following: */ +/* */ +/* * Major device 0 is reserved and cannot be used for any of these */ +/* devices. Setting a device number to 0 here is the same as NO. */ +/* */ +/* * No device number may be higher than SC_DEVMAX (SC_DEVMAX may */ +/* be increased, if desired) */ +/* */ +/* * The lines defining the symbols DEV_SERIAL, DEV_TIMER, etc, */ +/* should not be changed. These are for use by application */ +/* programs as the "device number" parameter on de_* calls. */ +/* */ +/***********************************************************************/ +#define SC_DEV_SERIAL 1 /* Serial driver */ +#define SC_DEV_TIMER 2 /* Periodic tick timer */ +#define SC_DEV_RAMDISK 3 /* RAM disk */ +#define SC_DEV_CONSOLE NO /* PC-Console driver */ +#define SC_DEV_SCSI 5 /* SCSI bus */ +#define SC_DEV_SCSI_TAPE 6 /* SCSI bus, tape device */ +#define SC_DEV_IDE 7 /* IDE Driver */ +#define SC_DEV_FLOPPY 8 /* Floppy Driver */ +#define SC_DEV_NTFTP 9 /* New TFTP pseudo driver */ +#define SC_DEV_TFTP 10 /* TFTP pseudo driver */ +#define SC_DEV_HTTP NO /* HTTP pseudo driver */ +#define SC_DEV_SPI NO /* SPI driver */ +#define SC_DEV_DLPI NO /* DLPI pseudo driver */ +#define SC_DEV_OTCP NO /* 14 TCP/IP for OpEN */ +#define SC_IP SC_DEV_OTCP /* 14 IP */ +#define SC_ARP NO /* 15 ARP */ +#define SC_TCP NO /* 16 TCP */ +#define SC_UDP NO /* 17 UDP */ +#define SC_RAW NO /* 18 RAW */ +#define SC_LOOP NO /* 19 LOOP = (SC_DEV_OTCP + 5) */ +#define SC_DEV_SOSI NO /* 20 OSI for OpEN */ +#define SC_DEV_PSCONSOLE 21 /* Pseudo Console driver */ +#define SC_DEV_MEMLOG 22 /* Memory log driver */ +#define SC_DEV_RDIO 23 /* pROBE+ RDIO driver */ +#define SC_DEV_NULL 24 /* Null Device Driver */ +#define SC_DEV_PARALLEL NO /* Parallel Port Driver */ +#define SC_DEV_CMOS NO /* CMOS Driver */ +#define SC_DEV_WATCHDOG NO /* Watchdog Driver */ +#define SC_DEV_OLAP NO /* LAP Drivers */ +#define SC_PHPI (SC_DEV_OLAP) /* Phpi driver */ +#define SC_LAPB (SC_DEV_OLAP + 0)/* LAPB driver Change 0 to 1 */ +#define SC_DEV_OX25 NO /* X25 Drivers */ +#define SC_X25 (SC_DEV_OX25) /* X.25 plp driver */ +#define SC_SNDCF NO /* sndcf driver */ +#define SC_IPCONV NO /* ip convergence driver */ +#define SC_DEV_ISDN NO /* ISDN Drivers */ +#define SC_PH (SC_DEV_ISDN) /* PH driver */ +#define SC_LAPD (SC_DEV_ISDN + 0)/* LAPD driver Change 0 to 1 */ +#define SC_IPCD (SC_DEV_ISDN + 0)/* IPCD driver Change 0 to 2 */ +#define SC_DEV_MLPP NO /* MultiLink PPP Drivers */ +#define SC_FRMUX (SC_DEV_MLPP) /* FRMUX driver */ +#define SC_PPP (SC_DEV_MLPP + 0)/* PPP driver Change 0 to 1 */ +#define SC_PIM (SC_DEV_MLPP + 0)/* PIM driver Change 0 to 2 */ +#define SC_DEV_LOG NO /* STREAMS log driver */ +#define SC_DEV_PSMUX NO /* Sample Mux driver */ +#define SC_DEV_PSLWR NO /* Sample loopback driver */ +#define SC_DEV_SLLWR NO /* Sample loopback driver */ +#define SC_DEV_PIPE 43 /* Pipe Driver. */ + +#define SC_DEVMAX 44 /* Maximum device number */ + +#define DEV_SERIAL (SC_DEV_SERIAL << 16) +#define DEV_PARALLEL (SC_DEV_PARALLEL << 16) +#define DEV_TIMER (SC_DEV_TIMER << 16) +#define DEV_RAMDISK (SC_DEV_RAMDISK << 16) +#define DEV_SCSI (SC_DEV_SCSI << 16) +#define DEV_SCSI_TAPE (SC_DEV_SCSI_TAPE << 16) +#define DEV_PSCONSOLE (SC_DEV_PSCONSOLE << 16) +#define DEV_SYSCONSOLE ((SC_DEV_PSCONSOLE << 16) + SYSCONSOLE_DEV) +#define DEV_PSEUDO ((SC_DEV_PSCONSOLE << 16) + PSEUDO_DEV) +#define DEV_STDIN ((SC_DEV_PSCONSOLE << 16) + STDIN_DEV) +#define DEV_STDOUT ((SC_DEV_PSCONSOLE << 16) + STDOUT_DEV) +#define DEV_STDERR ((SC_DEV_PSCONSOLE << 16) + STDERR_DEV) +#define DEV_NULL (SC_DEV_NULL << 16) +#define DEV_MEMLOG (SC_DEV_MEMLOG << 16) +#define DEV_RDIO (SC_DEV_RDIO << 16) +#define DEV_DLPI (SC_DEV_DLPI << 16) +#define DEV_TFTP (SC_DEV_TFTP << 16) +#define DEV_NTFTP (SC_DEV_NTFTP << 16) +#define DEV_HTTP (SC_DEV_HTTP << 16) +#define DEV_SPI (SC_DEV_SPI << 16) +#define DEV_WATCHDOG (SC_DEV_WATCHDOG << 16) +#define DEV_FLOPPY (SC_DEV_FLOPPY << 16) +#define DEV_IDE (SC_DEV_IDE << 16) +#define DEV_CMOS (SC_DEV_CMOS << 16) +#define DEV_CONSOLE (SC_DEV_CONSOLE << 16) +#define DEV_IP (SC_IP << 16) +#define DEV_ARP (SC_ARP << 16) +#define DEV_TCP (SC_TCP << 16) +#define DEV_UDP (SC_UDP << 16) +#define DEV_RAW (SC_RAW << 16) +#define DEV_LOOP (SC_LOOP << 16) +#define DEV_PHPI (SC_PHPI << 16) +#define DEV_LAPB (SC_LAPB << 16) +#define DEV_X25 (SC_X25 << 16) +#define DEV_SNDCF (SC_SNDCF << 16) +#define DEV_IPCONV (SC_IPCONV << 16) +#define DEV_PH (SC_PH << 16) +#define DEV_LAPD (SC_LAPD << 16) +#define DEV_IPCD (SC_IPCD << 16) +#define DEV_FRMUX (SC_FRMUX << 16) +#define DEV_PIM (SC_PIM << 16) +#define DEV_PPP (SC_PPP << 16) +#define DEV_LOG (SC_DEV_LOG << 16) +#define DEV_PSMUX (SC_DEV_PSMUX << 16) +#define DEV_PSLWR (SC_DEV_PSLWR << 16) +#define DEV_SLLWR (SC_DEV_SLLWR << 16) +#define DEV_PIPE (SC_DEV_PIPE << 16) + +#if (BSP_CPUFAMILY == FAMILY_X86) && (SC_APP_CONSOLE == PCCON) + #define CONSOLE DEV_CONSOLE +#else + #define CONSOLE DEV_SERIAL +#endif + +/***********************************************************************/ +/* p S E U D O D R I V E R D E F I N E S */ +/* */ +/* The defines below control the behavour of the pSEUDO driver if the */ +/* SC_DEV_PSCONSOLE is enabled. */ +/* */ +/***********************************************************************/ +#define SC_PSCNSL_SHARED_CHAN 2 /* Num of shared channels */ +#define SC_PSCNSL_PRIVATE_CHAN 4 /* Number of private channels */ +#define SC_PSCNSL_MAX_CUSTOM 1 /* NUmber of custome device */ +#define SC_PSCNSL_DEFAULT_DEV CONSOLE /* Default console device */ + +/***********************************************************************/ +/* T F T P D R I V E R C O N F I G U R A T I O N */ +/* */ +/* The defines below define the Configuration Parameters needed by the */ +/* TFTP driver. */ +/* */ +/***********************************************************************/ +#define SC_MAX_TFTP_CHAN 8 /* Maximum number of TFTP channels */ + +/***********************************************************************/ +/* H T T P S E R V E R C O N F I G U R A T I O N */ +/* */ +/* The SC_MAX_HTTP_CHAN define controls the maximum number of HTTP */ +/* channels in the system. */ +/* */ +/***********************************************************************/ +#define SC_MAX_HTTP_CHAN 1 + +/***********************************************************************/ +/* P I P E D R I V E R C O N F I G U R A T I O N */ +/* */ +/* The SC_MAX_PIPE_CHAN define controls the maximum number of PIPE */ +/* channels that will be configured in the system. */ +/* */ +/***********************************************************************/ +#define SC_MAX_PIPE_CHAN 1 + +/***********************************************************************/ +/* */ +/* M M U L I B R A R Y P A R A M S */ +/* */ +/* The SC_MMULIB define controls the MMU library call-outs when pROBE+ */ +/* is entered. Setting this to YES enables the callouts, while setting */ +/* this to NO disables the callouts when pROBE+ is entered and BSP_MMU */ +/* is enabled. */ +/* */ +/***********************************************************************/ +#define SC_MMULIB NO + +/***********************************************************************/ +/* */ +/* C O M P O N E N T C O N F I G U R A T I O N P A R A M E T E R S */ +/* */ +/* These parameters should work as is for this application. You */ +/* may want to change some of them if you start customizing this */ +/* application. */ +/* */ +/***********************************************************************/ + +/*---------------------------------------------------------------------*/ +/* pSOS+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define KC_RN0USIZE 0x100 /* region 0 unit size */ +#define KC_NTASK 40 /* max number of tasks */ +#define KC_NQUEUE 25 /* max number of message queues */ +#define KC_NSEMA4 30 /* max number of semaphores */ +#define KC_NTIMER 20 /* max number of timers */ +#define KC_NMUTEX 20 /* Max number of mutexes */ +#define KC_NCVAR 20 /* Max number of condition variables */ +#define KC_NTVAR 5 /* Max number of task variables */ +#define KC_NCOCB 5 /* Max number of callouts */ +#define KC_NTSD 5 /* Max # of Task Specific Data entries */ +#define KC_NLOCOBJ 100 /* max number of local objects */ +#define KC_NMSGBUF 256 /* max number of message buffers */ +#define KC_TICKS2SEC 100 /* clock tick interrupt frequency */ +#define KC_TICKS2SLICE 10 /* time slice quantum, in ticks */ +#define KC_MAXDNTENT 10 /* max number of device names in DNT */ +#define KC_DNLEN 10 /* max length of a device name in DNT */ +#define KC_SYSSTK 0x1000 /* pSOS+ system stack size (bytes) */ +#define KC_ROOTSSTK 0x2000 /* ROOT supervisor stack size */ +#define KC_IDLESTK 0x0400 /* IDLE stack size */ +#define KC_ROOTUSTK 0 /* ROOT user stack size */ +#define KC_ROOTMODE (T_SUPV | T_ISR) /* ROOT initial mode */ +#define KC_ROOTPRI 230 /* ROOT task priority */ +#define KC_NIO (SC_DEVMAX+1) /* # of devices in initial iojtab */ +#define KC_MAXIO (SC_DEVMAX+1) /* Max # of devices in the system */ + +/*---------------------------------------------------------------------*/ +/* The following are examples for modifying the following defines */ +/* */ +/* To configure a user written routine as a fatal error handler, you */ +/* need to do the following: */ +/* */ +/* extern void MyHandler (void); */ +/* #define KC_FATAL ((void (*)()) MyHandler) */ +/* */ +/*---------------------------------------------------------------------*/ +#define KC_STARTCO 0 /* callout at task activation */ +#define KC_DELETECO 0 /* callout at task deletion */ +#define KC_SWITCHCO 0 /* callout at task switch */ + +#define KC_FATAL 0 /* fatal error handler address */ +#define KC_IDLECO 0 /* Idle Task Callout */ + +/*---------------------------------------------------------------------*/ +/* pSOS+m configuration parameters */ +/*---------------------------------------------------------------------*/ +#define MC_NGLBOBJ 8 /* size of gbl obj table */ +#define MC_NAGENT 10 /* number of RPC agents in this node */ +#define MC_FLAGS SEQWRAP_ON /* operating mode flags */ + +/*---------------------------------------------------------------------*/ +/* The following are examples for modifying the following definition */ +/* */ +/* Using a user written routine as a roster change handler */ +/* extern void MyHandler (void); */ +/* #define MC_ROSTER ((void (*)()) MyHandler) */ +/* */ +/*---------------------------------------------------------------------*/ +#define MC_ROSTER 0 /* addr of user roster change callout */ +#define MC_KIMAXBUF 100 /* maximum KI packet buffer length */ +#define MC_ASYNCERR 0 /* asynchronous calls error callout */ + +/*---------------------------------------------------------------------*/ +/* pROBE+ configuration parameters */ +/* */ +/* NOTE: The SMODE_MASK bit in TD_FLAGS is set as */ +/* SC_SD_DEBUG_MODE = DBG_AP. */ +/*---------------------------------------------------------------------*/ +#define TD_BRKOPC 0xe6000010/* Instruction break opcode (INT 3) */ +#define TD_BRKOPC_16 0xde00 /* Thumb undefined inst */ +#define TD_DBGPRI 244 /* Debugger task priority */ +#define TD_ILEV (MAX_ILEV << 12) /* pROBE+ interrupt mask */ +#define TD_FLAGS (NODOTS_MASK | TD_ILEV | NOTUPD_MASK)/* flags */ + +/*---------------------------------------------------------------------*/ +/* The variable defined below should be set to the Starting address */ +/* for pROBE+ DATA AREA. This is required by all the smaller boards. */ +/* NOTE: */ +/* Setting of this value should be a variable which is a array */ +/* of characters with atleast 0x4400 bytes free space. */ +/*---------------------------------------------------------------------*/ +#define TD_DATASTART 0x0 + +/*---------------------------------------------------------------------*/ +/* pHILE+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define FC_LOGBSIZE 9 /* Block size (base-2 exponent) */ +#define FC_NBUF 6 /* Number of cache buffers */ +#define FC_NMOUNT 3 /* Max # of mounted volumes */ +#define FC_NFCB 10 /* Max # of opened files per system */ +#define FC_NCFILE 2 /* Max # of opened files per task */ +#define FC_NDNLC 0 /* Max # of cached directory entries */ + +/*---------------------------------------------------------------------*/ +/* pHILE+ DATA AREA definitions. */ +/*---------------------------------------------------------------------*/ +#define FC_DATA 0 /* pHILE+ Data Area Starting Address */ +#define FC_DATASIZE 0 /* pHILE+ Data Area Size */ + +/*---------------------------------------------------------------------*/ +/* Set the FC_ERRCO define to install the callout handler for I/O */ +/* errors. The callout handler provided in FC_ERRCO will be called if */ +/* there is an error during an I/O operation on the Volume. */ +/* */ +/* To install the error callout handler: Follow the syntax below */ +/* */ +/* #include */ +/* extern user_fcerrco(int, ULONG, const struct buffer_header *) */ +/* #define FC_ERRCO user_fcerrco */ +/* */ +/*---------------------------------------------------------------------*/ +#define FC_ERRCO 0 /* I/O error call-out */ + +/*---------------------------------------------------------------------*/ +/* pLM+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define LM_MAXREG 8 /* Max # of registered libraries */ +#define LM_DATA 0 /* pLM+ data area */ +#define LM_DATASIZE 0 /* pLM+ data area size */ + +/*---------------------------------------------------------------------*/ +/* Set LM_DEFAULT_COUTS to YES if you need to use the pSOSystem Default*/ +/* pLM Callouts. Set it to NO if you are providing the callouts. */ +/* */ +/* Setting LM_DEFAULT_COUTS to NO needs "LM_LOADCO" and "LM_UNLOADCO" */ +/* definitions to be valid address (Function address). */ +/*---------------------------------------------------------------------*/ +#define LM_DEFAULT_COUTS YES + +/*---------------------------------------------------------------------*/ +/* */ +/* The following callouts needs to be defined by user, If users wants */ +/* their callouts to be used instead of pSOSystem default Callouts. */ +/* */ +/* If we are using pSOSystem default callouts, Users needs to add their*/ +/* callouts to the pSOSystem callouts table using PssRegister_pLM_couts*/ +/* and remove using PssDeregister_pLM_couts. */ +/* */ +/* To have user callouts follow the syntax below: */ +/* */ +/* #include */ +/* extern ULONG user_load_co(const char *libname, ULONG scope, */ +/* ULONG version, const void *libinfo, */ +/* sl_attrib *attr); */ +/* extern ULONG user_unload_co(const sl_attrib *attr); */ +/* */ +/* #define LM_LOADCO user_load_co */ +/* #define LM_UNLOADCO user_unload_co */ +/* */ +/*---------------------------------------------------------------------*/ +#define LM_LOADCO 0 +#define LM_UNLOADCO 0 + +/*---------------------------------------------------------------------*/ +/* pREPC+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define LC_BUFSIZ (1 << FC_LOGBSIZE) /* I/O buffer size */ +#define LC_NUMFILES 5 /* Max number of open files per task */ +#define LC_WAITOPT 0 /* Wait option for memory allocation */ +#define LC_TIMEOPT 0 /* Timeout option for mem allocation */ + +/*---------------------------------------------------------------------*/ +/* pREPC+ stdin, stdout and stderr device mapping. */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_PSCONSOLE) +#define LC_STDIN "///dev/stdin" /* The default STDIN device */ +#define LC_STDOUT "///dev/stdout" /* The default STDOUT device */ +#define LC_STDERR "///dev/stderr" /* The default STDERR device */ + +#elif (BSP_CPUFAMILY == FAMILY_X86) && (SC_APP_CONSOLE == PCCON) +#define LC_STDIN "///dev/pcconsole" /* Make PCCON as STDIN device */ +#define LC_STDOUT "///dev/pcconsole" /* Make PCCON as STDOUT device */ +#define LC_STDERR "///dev/pcconsole" /* Make PCCON as STDERR device */ + +#elif (SC_DEV_SERIAL) +#define LC_STDIN "///dev/tty" /* Make TTY the STDIN device */ +#define LC_STDOUT "///dev/tty" /* Make TTY the STDOUT device */ +#define LC_STDERR "///dev/tty" /* Make TTY the STDERR device */ + +#else +#define LC_STDIN "///dev/null" /* Make NULL the STDIN device */ +#define LC_STDOUT "///dev/null" /* Make NULL the STDOUT device */ +#define LC_STDERR "///dev/null" /* Make NULL the STDERR device */ +#endif + +#if (SC_DEV_RAMDISK) +#define LC_TEMPDIR DEV_RAMDISK /* The default TEMPDIR device */ + +#elif (SC_DEV_SCSI) +#define LC_TEMPDIR DEV_SCSI /* The default TEMPDIR device */ + +#elif (SC_DEV_IDE) +#define LC_TEMPDIR DEV_IDE /* The default TEMPDIR device */ + +#elif (SC_DEV_FLOPPY) +#define LC_TEMPDIR DEV_FLOPPY /* The default TEMPDIR device */ + +#else +#define LC_TEMPDIR 0 /* The default TEMPDIR device */ +#endif + + +/*---------------------------------------------------------------------*/ +/* pNA+ configuration parameters */ +/* */ +/* NOTE: If you get pNA+ errno 5F01 FAT_INSUFFMEM you may need to */ +/* decrease the number of buffers allocated here for pNA+. */ +/* In general this error means pNA+ could not allocate enough */ +/* memory from Region 0 for the number of buffers requested. */ +/*---------------------------------------------------------------------*/ +#define NC_NNI 5 /* size of pNA NI Table */ +#define NC_NROUTE 10 /* size of pNA Routing Table */ +#define NC_NARP 20 /* size of pNA ARP table */ +#define NC_DEFUID 0 /* Default User ID of a task */ +#define NC_DEFGID 0 /* Default Group ID of a task */ +#define NC_HOSTNAME "scg" /* Hostname of the node */ +#define NC_NHENTRY 8 /* Number of Host table entries */ + +#define NC_NMCSOCS 0 /* Number of IP multicast sockets */ +#define NC_NMCMEMB 0 /* Number of distict IP multicast */ + /* group memberships per interface */ + +#define NC_NNODEID 0 /* Network NODE ID for unnumbered link */ + +#define NC_NSOCKETS 64 /* Number of sockets in the system */ +#define NC_NDESCS 8 /* # of socket descriptors/task */ +#define NC_MBLKS 300 /* # of message blocks in the system */ + +#define NC_BUFS_0 64 /* number of 0 length buffers */ +#define NC_BUFS_32 0 /* number of 32 length buffers */ +#define NC_BUFS_64 0 /* number of 64 length buffers */ +#define NC_BUFS_128 256 /* number of 128 byte buffers */ +#define NC_BUFS_256 0 /* number of 256 byte buffers */ +#define NC_BUFS_512 0 /* number of 512 byte buffers */ +#define NC_BUFS_1024 16 /* number of 1k byte buffers */ +#define NC_BUFS_2048 48 /* number of 2k byte buffers */ +#define NC_BUFS_4096 0 /* number of 4k byte buffers */ + +#define NC_MAX_BUFS 9 /* max number of NC_BUFS types */ + +#define NC_PNAMEM_NEWSCHEME YES /* apply new pNA MEM management scheme*/ + +#define NC_BUFS_XX_INTERNAL 20 /* # of buffers for internal pNA usage */ +#define NC_MBLKS_INT_PERCENT 15 /* % of mblks reserved for pNA internal */ +#define NC_MBLKS_TX_PERCENT 40 /* % of mblks reserved for Tx Mem Pool */ + +#define NC_BUFS_0_TX_PERCENT 50 /* % of 0 length buffers used for Tx */ +#define NC_BUFS_32_TX_PERCENT 50 /* % of 32 length buffers used for Tx */ +#define NC_BUFS_64_TX_PERCENT 50 /* % of 64 length buffers used for Tx */ +#define NC_BUFS_128_TX_PERCENT 50 /* % of 128 byte buffers used for Tx */ +#define NC_BUFS_256_TX_PERCENT 50 /* % of 256 byte buffers used for Tx */ +#define NC_BUFS_512_TX_PERCENT 50 /* % of 512 byte buffers used for Tx */ +#define NC_BUFS_1024_TX_PERCENT 50 /* % of 1k byte buffers used for Tx */ +#define NC_BUFS_2048_TX_PERCENT 50 /* % of 2k byte buffers used for Tx */ +#define NC_BUFS_4096_TX_PERCENT 50 /* % of 4k byte buffers used for Tx */ + +/*---------------------------------------------------------------------*/ +/* pNA+ daemon task configuration parameters */ +/*---------------------------------------------------------------------*/ +#define NC_DTASK_SSTKSZ 0x800 /* pNAD daemon task sstack size*/ +#define NC_DTASK_USTKSZ 0x400 /* pNAD daemon task ustack size*/ +#define NC_DTASK_PRIO 255 /* pNAD daemon task priority */ +#define NC_NEW_MULTITASK_SYNC YES /* deploy new pNA+ sync scheme */ +#define NC_USE_MUTEX YES /* use pSOS MUTEX primitive */ + +/*---------------------------------------------------------------------*/ +/* pNA+ DATA AREA definitions. */ +/*---------------------------------------------------------------------*/ +#define NC_DATA 0 /* pNA+ Data Area Starting Addr*/ +#define NC_DATASIZE 0 /* pNA+ Data Area Size */ + +/*---------------------------------------------------------------------*/ +/* The following are examples for modifying the following defines */ +/* */ +/* Using a user written routine as a pNA+ Signal Handler */ +/* extern void MySigHandler (void); */ +/* #define NC_SIGNAL ((void (*)()) MySigHandler) */ +/* */ +/*---------------------------------------------------------------------*/ +#define NC_SIGNAL 0 /* pNA+ Signal Hdlr */ + +/*---------------------------------------------------------------------*/ +/* pRPC+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define NR_PMAP_PRIO 254 /* task priority */ +#define NR_PMAP_SSTACK 0x2000 /* supervisor stack size */ +#define NR_PMAP_USTACK 0x100 /* user stack size */ +#define NR_PMAP_FLAGS T_LOCAL /* t_create flags */ +#define NR_PMAP_MODE T_SUPV /* t_start mode */ +#define NR_DEBUG_FLAG NO /* Turns on debug msgs from PMAP task */ + +/*---------------------------------------------------------------------*/ +/* pRPC+ DATA AREA definitions. */ +/*---------------------------------------------------------------------*/ +#define NR_DATA 0 /* pRPC+ Data Area Starting Address */ +#define NR_DATASIZE 0 /* pRPC+ Data Area Size */ + +/*---------------------------------------------------------------------*/ +/* User can change these TWO defines to have their own handlers. */ +/*---------------------------------------------------------------------*/ +#define NR_GETHOSTNAME nr_gethostname /* Function to get local */ + /* host name */ +#define NR_GET_HENTBYNAME nr_get_hentbyname /* Function to map host */ + /* name to it's IP Addr */ + +/*---------------------------------------------------------------------*/ +/* pSE+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define SE_NBUFS_0 64 /* number of 0 length buffers */ +#define SE_NBUFS_32 128 /* number of 32 byte buffers */ +#define SE_NBUFS_64 128 /* number of 64 byte buffers */ +#define SE_NBUFS_128 256 /* number of 128 byte buffers */ +#define SE_NBUFS_256 32 /* number of 256 byte buffers */ +#define SE_NBUFS_512 32 /* number of 512 byte buffers */ +#define SE_NBUFS_1024 16 /* number of 1k byte buffers */ +#define SE_NBUFS_2048 16 /* number of 2k byte buffers */ +#define SE_NBUFS_4096 8 /* number of 4k byte buffers */ +#define SE_MAX_BUFS 9 /* max number of stream buffer types */ + +#define SE_MAX_MODULES 4 /* max number of streams modules */ +#define SE_SHARE_NI NO /* LAN-NI with streams? */ + +#define SE_DATA_SIZE 0x1000 /* size of pSE data area */ + /* (must be at least 3K) */ +#define SE_TASK_PRIO 250 /* priority for pSE task */ +#define SE_STACK_SIZE 0x2000 /* stack size for pSE task */ +#define SE_DEF_UID 0 /* default user id */ +#define SE_DEF_GID 0 /* default group id */ +#define SE_N_FDS 32 /* max # of system-wide */ + /* stream descriptors */ +#define SE_N_TASKFDS 8 /* max # of per-task stream */ + /* descriptors */ +#define SE_N_LINKS 32 /* max # of multiplexing links */ +#define SE_N_TIMEOUTS 32 /* max # of timeout requests */ +#define SE_N_BUFCALLS 32 /* max # of bufcall requests */ +#define SE_N_QUEUES 256 /* # of queues */ +#define SE_N_QBANDS (SE_N_QUEUES * 2) /* # of qbands */ +#define SE_N_MBLKS 512 /* # of message blocks */ +#define SE_PRI_BANDS NO /* Whether priority bands are desired */ +#define SE_STRLOG YES /* Whether the log facility is cnfgrd */ +#define SE_TMO_RES 2 /* pSE Timer resolution in ticks */ +#define SE_MAX_AUTOPUSH 10 /* Max # of autopush entries */ +#define SE_SIGHANDLER NULL /* pSE global signal handler */ +#define SE_LOG_BUFSIZE 100 /* Maximum size of the log message */ +#define SE_NUM_LOG_BUFFERS 25 /* Number of log buffs to be allocated*/ +#define SE_BUF_BORROW_LEVEL 0 /* The buffer borrowing level desired */ +#define SE_NO_GLOBAL_LOCKING NO /* Whether global locking is desired */ +#define SE_PCRASH_BUF_SIZE 8192 /* default pcrash buffer size */ +#define SE_HI_BUF_RESVN_PERCENT 12 /* Hi buffer reservation % */ +#define SE_MED_BUF_RESVN_PERCENT 13 /* Med buffer reservation % */ +#define SE_USE_MUTEX YES /* Use mutex locks */ +#define SE_GETTICKS_FN tm_getticks /* Use the default tm_getticks*/ + /* function. */ +#define SE_COMPAT_MODE 2 /* Compatibility mode Level. */ + +/*---------------------------------------------------------------------*/ +/* Following macro SE_PRINTF uses printf as the default print function.*/ +/* If User needs to use different function, then change the proto-type.*/ +/*---------------------------------------------------------------------*/ +extern int printf(const char *, ...); +#define SE_PRINTF printf /* pSE printf function */ + +/*---------------------------------------------------------------------*/ +/* Loader configuration parameters */ +/* */ +/* YES indicates for each module to be linked in. NO means do not link */ +/* object module loader into this application. */ +/* */ +/*---------------------------------------------------------------------*/ +#define LD_MAX_LOAD 0 /* Max. # of active loads */ +#define LD_ELF_MODULE YES /* ELF object-load-module */ +#define LD_SREC_MODULE YES /* SREC object-load-module */ +#define LD_COFF_MODULE NO /* COFF object-load-module */ +#define LD_IEEE_MODULE NO /* IEEE object-load-module */ +#define LD_IHEX_MODULE NO /* IHEX object-load-module */ + +/*---------------------------------------------------------------------*/ +/* pMONT+ configuration parameters - note that PM_DEV and PM_BAUD are */ +/* only relevant to serial communication (PM_CMODE = 2) */ +/*---------------------------------------------------------------------*/ +#define PM_CMODE 1 /* 1 = networking, 2 = serial */ + +/*---------------------------------------------------------------------*/ +/* PM_DEV down uses a macro to calculate the channel number, which is */ +/* SERIAL_DRVRNUM(0). This means Low-Level Driver 0 (1) is used for */ +/* default PM_DEV. If you need to change this to another Low-Level */ +/* Serial Driver, change "0" in the macro SERIAL_DRVRNUM(0) to the */ +/* number of the driver you want. */ +/* */ +/* Consult the "README" file in BSP directory for number of different */ +/* drivers supported and for the SERIAL_DRVRNUM mapping for those */ +/* drivers. */ +/*---------------------------------------------------------------------*/ +#define PM_DEV (2 + SERIAL_DRVRNUM(0)) + /* Minor Device number for serial */ + /* channel if used */ + +#define PM_BAUD 9600 /* Baud rate for serial chnl */ +#define PM_TRACE_BUFF 0 /* Address of trace buffer -- */ + /* Allocated by pSOSystem if 0 */ +#define PM_TRACE_SIZE 0x6000 /* Size of trace buffer */ +#define PM_TIMER NO /* 2nd timer for finer time */ + /* within data collection */ + +/*---------------------------------------------------------------------*/ +/* General Serial Block Configuration Parameters */ +/* */ +/* GS_MBLKS defines the number of the message blocks. To allocate a */ +/* data block (GS buffer), a message block is needed. Usually, the */ +/* number of the message blocks will be the same as the total number */ +/* of the data blocks, but it can be differenet. If GS_MBLKS is not */ +/* defined or it is zero, the GSblkSetup() will use the total number */ +/* of the data blocks as the number of the message blocks. */ +/*---------------------------------------------------------------------*/ +#define GS_BUFS_0 64 /* number of 0 length buffers */ +#define GS_BUFS_32 128 /* number of 32 byte buffers */ +#define GS_BUFS_64 128 /* number of 64 byte buffers */ +#define GS_BUFS_128 256 /* number of 128 byte buffers */ +#define GS_BUFS_256 32 /* number of 256 byte buffers */ +#define GS_BUFS_512 32 /* number of 512 byte buffers */ +#define GS_BUFS_1024 16 /* number of 1k byte buffers */ +#define GS_BUFS_2048 16 /* number of 2k byte buffers */ +#define GS_BUFS_4096 8 /* number of 4k byte buffers */ + +#define GS_MBLKS 680 /* number of message blocks */ +#define GS_MAX_BUFS 9 /* max number of serial buffer types */ + +/***********************************************************************/ +/* */ +/* TCP/IP for OpEN configuration parameters */ +/* */ +/***********************************************************************/ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for the Network layer (IP) */ +/*---------------------------------------------------------------------*/ +#define OTCP_IPMAX 8 /* Max # of open IP device */ +#define OTCP_IPNINTERFACES 4 /* Max # of network interfaces */ +#define OTCP_IPNROUTES 64 /* Max #of routing tbl entries */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for ARP */ +/*---------------------------------------------------------------------*/ +#define OTCP_ARPMAX 8 /* Max # of open ARP device */ +#define OTCP_ARPNINTERFACES 4 /* Max # of ARP interfaces */ +#define OTCP_ARPNENTRIES 32 /* Max # of ARP table entries */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for TCP */ +/*---------------------------------------------------------------------*/ +#define OTCP_TCPMAX 64 /* Max # of open TCP device */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for UDP */ +/*---------------------------------------------------------------------*/ +#define OTCP_UDPMAX 32 /* Max # of open UDP device */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for RAW */ +/*---------------------------------------------------------------------*/ +#define OTCP_RAWMAX 32 /* Max # of open RAW device */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for LOOP */ +/*---------------------------------------------------------------------*/ +#define OTCP_LOOPMAX 2 /* Max # of open LOOP device */ + + + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_CONF_H */ + diff --git a/h/wrn/wm/util/port/isisnmp/common.h b/h/wrn/wm/util/port/isisnmp/common.h new file mode 100644 index 0000000..85054c8 --- /dev/null +++ b/h/wrn/wm/util/port/isisnmp/common.h @@ -0,0 +1,56 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/isisnmp/common.h,v 1.1.1.1 2001/11/05 17:47:09 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: common.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:09 tneale + * Tornado shuffle + * + * Revision 1.3 2001/01/19 22:22:57 paul + * Update copyright. + * + * Revision 1.2 2000/03/17 00:10:00 meister + * Update copyright message + * + * Revision 1.1 1998/06/28 21:18:27 josh + * updating/bugfixing for SNMp + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + +/* + * NIY.... + */ + +#ifdef CONFIG_PREAMBLE + +#if INSTALL_BUG +#define BUG_OUT stdout +#define BUG(w,x,y,z) fprintf z; fprintf (stdout, "\n"); +#endif + +#else /* CONFIG_PREAMBLE */ + +#endif /* CONFIG_PREAMBLE */ + + diff --git a/h/wrn/wm/util/port/isisnmp/envoy.h b/h/wrn/wm/util/port/isisnmp/envoy.h new file mode 100644 index 0000000..9e49717 --- /dev/null +++ b/h/wrn/wm/util/port/isisnmp/envoy.h @@ -0,0 +1,815 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/isisnmp/envoy.h,v 1.2 2001/11/09 17:45:08 josh Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: envoy.h,v $ + * Revision 1.2 2001/11/09 17:45:08 josh + * pSOS-related path fixes + * + * Revision 1.1.1.1 2001/11/05 17:47:09 tneale + * Tornado shuffle + * + * Revision 1.13.4.1 2001/09/21 18:30:06 josh + * updating porting files with new information for proxy and + * coexistence + * + * Revision 1.13 2001/01/19 22:22:57 paul + * Update copyright. + * + * Revision 1.12 2000/06/09 14:57:35 josh + * updating header files to correspond with new installation options and + * new code + * + * Revision 1.11 2000/04/05 19:40:51 josh + * clearing up some additional warnings for pSOS+ 3.0 + * + * Revision 1.10 2000/03/17 00:10:01 meister + * Update copyright message + * + * Revision 1.9 1999/11/10 22:15:31 josh + * adding support for the envoy_ax_translate_context userexit + * + * Revision 1.8 1999/11/10 18:28:05 josh + * adding notification support to pSOS Envoy and fixing a few bugs + * + * Revision 1.7 1998/09/22 03:28:35 sar + * correct a typo in a type + * + * Revision 1.6 1998/09/16 19:54:30 sar + * Fixed up some user exits to allow binary customers a standard api + * + * Revision 1.5 1998/08/19 20:03:16 josh + * removing extraneous () from things + * + * Revision 1.4 1998/08/13 22:56:05 josh + * bringing in line with latest code changes + * + * Revision 1.3 1998/08/13 20:11:31 josh + * updates for pSOS + * + * Revision 1.2 1998/06/28 21:18:28 josh + * updating/bugfixing for SNMp + * + * Revision 1.1 1998/06/19 16:09:05 josh + * port files for building SNMp + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + +#if INSTALL_ON_ISIX86 +#ifndef NVRAM_START +#define NVRAM_START 0xf000 +#endif +#ifndef P386 +#define P386 1 +#endif +#endif + +#ifdef CONFIG_PREAMBLE + +#include + +extern void * SNMP_memory_alloc(int ); +extern void SNMP_memory_free(void *); +/* pSOS port */ +extern int max_packet_size; +extern int max_oid_count; +extern int protect_critical_section; + +/*----------------------------------------------------------------------*/ +/* To tailor snmp for different applications */ +/*----------------------------------------------------------------------*/ +typedef struct snmp_cfg + { + /*--------------------------------------------------------------------*/ + /* Maximum snmp packet size this entity allows. */ + /*--------------------------------------------------------------------*/ + int max_packet_size; + /*--------------------------------------------------------------------*/ + /* Maximum number of oid components allowed in a valid object id. */ + /*--------------------------------------------------------------------*/ + int max_oid_count; + /*--------------------------------------------------------------------*/ + /* snmp enters critical section before the testproc and leaves it */ + /* after it has returned from the setproc/getproc. Application should*/ + /* indicate whether to turn off task preemption globally when entering*/ + /* the critical section and to turn it back on at exit. If this is */ + /* set to FALSE, then the testproc/setproc/getproc for each individual*/ + /* mib object should properly implement the necessary locking */ + /* mechanism to ensure the atomicity of the GET/SET operations. */ + /*--------------------------------------------------------------------*/ + int protect_critical_section; /* TRUE/FALSE */ + } snmp_cfg; + +extern void SNMP_Init(snmp_cfg *); + +/* pSOS port */ +/*----------------------------------------------------------------------*/ +/* locks for local databases access */ +/*----------------------------------------------------------------------*/ +typedef struct + { + unsigned char type; /* READLOCK or WRITELOCK */ +#define NO_LOCK 0x0 +#define READLOCK 0x1 +#define WRITELOCK 0x2 + unsigned long sema; /* Semaphore id */ + int count; /* how many readlocks obtained */ + } LOCK_T; + +#define ENVOY_LOCK_T LOCK_T + +#else + +/* This first should be the same as DECORUM_MAX_PACKET_SIZE in decorum.h */ +#define SNMP_MAX_PACKET_SIZE max_packet_size +#define SNMP_MIN_PACKET_SIZE 484 + +#define MAX_OID_COUNT max_oid_count + +#define validate_SNMP_version(x) ((x) == SNMP_VERSION_1) + +extern int validate_SNMP_community + __((SNMP_PKT_T *, SNMPADDR_T *, SNMPADDR_T *)); + +/*---------------------------------------------------------------- + SNMP_validate_community -- Check an operation against the community name. + +Parameters: + SNMP_PKT_T *pkt The received packet (decoded format) + SNMPADDR_T *src Source of the packet + SNMPADDR_T *dst Destination of the packet (most likely + the address of the machine on which this + code is running.) + +Returns: + This procedure should return 0 if happy with the community and + 1 if not. + + This routine should fill in the packet structure with the mib + view mask associated with the community string. + This routine may hang additional data onto the "private" field of + the packet structure. The user will be given the opportinity to + release that memory via SNMP_release_private(). + + ----------------------------------------------------------------*/ +#define SNMP_validate_community(x, y, z) validate_SNMP_community(x,y,z) + +/*---------------------------------------------------------------- + SNMP_release_private -- Get rid of a any private data attached to the packet + structure. May be left undefined in which case nothing + is done with the private field when the SNMP packet + structure is freed. + + Parameters: + SNMP_PKT_T *pkt The packet itself + + Returns: Nothing + ----------------------------------------------------------------*/ +extern void release_private __((SNMP_PKT_T *)); +#define SNMP_release_private(pkt) release_private(pkt) + +/*---------------------------------------------------------------- + SNMP_user_get_encode_buffer -- Allows the user the opportunity to get the + buffer that the SNMP packet will be encoded into. + If not used then leave undefined. + + Parameters: + SNMP_PKT_T *pkt The packet being encoded. + unsigned int need The amount of storage needed. + EBUFFER_T *ebuffp The ebuffer to fill in with the actual + buffer. + + Returns: + 0 successful + 1 not successful + ----------------------------------------------------------------*/ +extern int user_get_encode_buffer(SNMP_PKT_T *, unsigned int, EBUFFER_T *); +#define SNMP_user_get_encode_buffer(pkt, need, ebuffp) \ + user_get_encode_buffer(pkt, need, ebuffp) + + +/*---------------------------------------------------------------- + SNMP_trace_input + SNMP_trace_output + -- for implementing packet tracing through the + SNMP code. May not be left undefined but may + instead be defined as nothing. + + Parameters: + SNMP_PKT_T *pkt The packet being traced + + Returns: Nothing + ----------------------------------------------------------------*/ +extern void TRACE_INPUT(SNMP_PKT_T *pkt); +extern void TRACE_OUTPUT(SNMP_PKT_T *pkt); +#define SNMP_TRACE_INPUT(pkt) TRACE_INPUT(pkt) +#define SNMP_TRACE_OUTPUT(pkt) TRACE_OUTPUT(pkt) + +/***************************************************************** + * The next series of macros are hooks into the processing of SET PDUs. + * For most uses you should be able to leave these undefined. + *****************************************************************/ + +/*---------------------------------------------------------------- + SNMP_validate_set_pdu -- Perform a global validation of a SET PDU. + + Parameters: + SNMP_PKT_T *pkt The packet itself + + Returns: + -1 If the PDU is bad and should be rejected with a GEN_ERR. + 0 If the PDU is good and normal handling should proceed. + +1 If the PDU is good and this routine has performed all of + the set operations internally. + ----------------------------------------------------------------*/ +extern int validate_set_pdu(SNMP_PKT_T *pkt); +#define SNMP_validate_set_pdu(pkt) validate_set_pdu(pkt) + +/*---------------------------------------------------------------- + SNMP_user_pre_set -- Perform a global validation of a SET PDU after all of the + test procedures have been called and given the "go ahead". + + Parameters: + SNMP_PKT_T *pkt The packet itself + + Returns: + -1 If the PDU is bad and should be rejected with a GEN_ERR. + 0 If the PDU is good and normal handling should proceed. + +1 If the PDU is good and this routine has performed all of + the set operations internally. + ----------------------------------------------------------------*/ +extern int user_pre_set(SNMP_PKT_T *pkt); +#define SNMP_user_pre_set(pkt) user_pre_set(pkt) + +/*---------------------------------------------------------------- + SNMP_user_post_set -- Perform any final activities after all of the set + procedures have been called. + + Parameters: + SNMP_PKT_T *pkt The packet itself + + Returns: Nothing + ----------------------------------------------------------------*/ +extern void user_post_set(SNMP_PKT_T *pkt); +#define SNMP_user_post_set(pkt) user_post_set(pkt) + +/***************************************************************** + The following are a series of macros that will connect the method + routines we supplied for the RFC1445 or RFC2275 view schemes to + your non-volatile storage areas. You should consult the manuals + for more information about these macros. +*****************************************************************/ +#if (INSTALL_ENVOY_SNMP_RFC1445_VIEWS) +#include + +#define SNMP_VIEW_CREATE_TEST(PKT, NEW) SNMP_NV_View_Add_Mod(NEW, 0) +#define SNMP_VIEW_UPDATE_TEST(PKT, OLD, NEW) SNMP_NV_View_Add_Mod(NEW, 0) +#define SNMP_VIEW_DESTROY_TEST(PKT, OLD) SNMP_NV_View_Add_Mod(OLD, 1) +#define SNMP_VIEW_BACKOUT_HOOK(NEW) SNMP_NV_Clean() +#define SNMP_VIEW_CREATE_UNDO(NEW) (SNMP_NV_Clean(), 0) +#define SNMP_VIEW_UPDATE_UNDO(OLD, NEW) (SNMP_NV_Clean(), 0) +#define SNMP_VIEW_DESTROY_UNDO(OLD) (SNMP_NV_Clean(), 0) +#define SNMP_VIEW_DESTROY_BACKOUT(OLD) SNMP_NV_Clean() +#define SNMP_VIEW_FINISHED SNMP_NV_Doit() + +#endif /* #if (INSTALL_ENVOY_SNMP_RFC1445_VIEWS) */ + +#if (INSTALL_ENVOY_SNMP_RFC2275_VIEWS) +#include + +#define SNMP_VIEW_2275_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_view_2275_test(PKT, VBP, CUR, NEW) +#define SNMP_VIEW_2275_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_view_2275_test(PKT, VBP, CUR, NEW) +#define SNMP_VIEW_2275_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_view_2275_test(PKT, VBP, CUR, NEW) + +#define SNMP_VIEW_2275_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_view_2275_set(PKT, VBP, CUR, NEW) +#define SNMP_VIEW_2275_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_view_2275_set(PKT, VBP, CUR, NEW) +#define SNMP_VIEW_2275_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_view_2275_set(PKT, VBP, CUR, NEW) + +#define SNMP_VIEW_2275_DESTROY_BACKOUT(CUR, NEW) \ + snmp_view_2275_backout(CUR, NEW) +#define SNMP_VIEW_2275_CREATE_BACKOUT(CUR, NEW) \ + snmp_view_2275_backout(CUR, NEW) +#define SNMP_VIEW_2275_UPDATE_BACKOUT(CUR, NEW) \ + snmp_view_2275_backout(CUR, NEW) + +#define SNMP_VIEW_2275_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_view_2275_undo(PKT, VBP, CUR, SAV) +#define SNMP_VIEW_2275_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_view_2275_undo(PKT, VBP, CUR, SAV) +#define SNMP_VIEW_2275_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_view_2275_undo(PKT, VBP, CUR, SAV) + +#define SNMP_VIEW_2275_FINISHED() snmp_view_2275_finished() + +#endif /* #if (INSTALL_ENVOY_SNMP_RFC2275_VIEWS) */ + + +/***************************************************************** + If version 3 is installed we may need the following macros. + + ENVOY_TIME - returns a clock with a granularity of seconds + PARAMETERS: none + returns: bits32_t + + SNMP_validate_address + This routine gives the user a chance to examine the address + information as well as most of the packet itself before a v3 + packet is processed. The routine must attach the address + information to the packet. It may attach a non-default mib + tree if desired. Note: in some error cases the packet will + not be decoded when this routine is called. + + Parameters: + SNMP_PKT_T *pkt The received packet (decoded format) + SNMPADDR_T *src Source of the packet + SNMPADDR_T *dst Destination of the packet (most likely + the address of the machine on which this + code is running.) + returns: + 0 - ok + 1 - failure, drop the packet + + + Lastly are are a series of macros that will connect the method + routines we supplied for the v3 tables to your non-volatile + storage areas. You should consult the manuals for more information + about these macros. +*****************************************************************/ +#if INSTALL_ENVOY_SNMP_VERSION_3 +#include + +extern bits32_t get_curtime(void); +#define ENVOY_TIME() get_curtime() + +extern int validate_SNMP_address __((SNMP_PKT_T *, + SNMPADDR_T *, + SNMPADDR_T *)); +#define SNMP_validate_address(p, s, d) validate_SNMP_address(p, s, d) + +#if INSTALL_ENVOY_SNMP_V3_TARGET + +extern int envoy_snmpaddr_to_taddress __((SNMPADDR_T *, OBJ_ID_T *, + EBUFFER_T *)); +extern int envoy_taddress_to_snmpaddr __((SNMPADDR_T *, OBJ_ID_T *, + EBUFFER_T *)); + +#define ENVOY_TADDRESS_TO_SNMPADDR(A, D, T) \ + envoy_taddress_to_snmpaddr(A, D, T) +#define ENVOY_SNMPADDR_TO_TADDRESS(A, D, T) \ + envoy_snmpaddr_to_taddress(A, D, T) +#endif + +#define SNMP_V3_GROUP_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_group_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_GROUP_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_group_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_GROUP_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_group_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_GROUP_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_group_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_GROUP_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_group_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_GROUP_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_group_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_GROUP_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_group_backout(CUR, NEW) +#define SNMP_V3_GROUP_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_group_backout(CUR, NEW) +#define SNMP_V3_GROUP_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_group_backout(CUR, NEW) + +#define SNMP_V3_GROUP_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_group_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_GROUP_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_group_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_GROUP_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_group_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_GROUP_FINISHED() snmp_v3_group_finished() + + +#define SNMP_V3_ACCESS_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_access_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_ACCESS_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_access_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_ACCESS_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_access_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_ACCESS_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_access_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_ACCESS_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_access_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_ACCESS_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_access_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_ACCESS_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_access_backout(CUR, NEW) +#define SNMP_V3_ACCESS_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_access_backout(CUR, NEW) +#define SNMP_V3_ACCESS_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_access_backout(CUR, NEW) + +#define SNMP_V3_ACCESS_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_access_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_ACCESS_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_access_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_ACCESS_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_access_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_ACCESS_FINISHED() snmp_v3_access_finished() + + +#define SNMP_V3_USER_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_user_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_USER_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_user_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_USER_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_user_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_USER_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_user_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_USER_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_user_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_USER_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_user_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_USER_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_user_backout(CUR, NEW) +#define SNMP_V3_USER_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_user_backout(CUR, NEW) +#define SNMP_V3_USER_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_user_backout(CUR, NEW) + +#define SNMP_V3_USER_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_user_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_USER_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_user_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_USER_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_user_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_USER_FINISHED() snmp_v3_user_finished() + +#define SNMP_V3_TADDR_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_taddr_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_TADDR_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_taddr_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_TADDR_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_taddr_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_TADDR_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_taddr_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_TADDR_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_taddr_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_TADDR_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_taddr_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_TADDR_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_taddr_backout(CUR, NEW) +#define SNMP_V3_TADDR_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_taddr_backout(CUR, NEW) +#define SNMP_V3_TADDR_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_taddr_backout(CUR, NEW) + +#define SNMP_V3_TADDR_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_taddr_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_TADDR_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_taddr_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_TADDR_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_taddr_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_TADDR_FINISHED() snmp_v3_taddr_finished() + +#define SNMP_V3_TPARAM_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_tparam_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_TPARAM_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_tparam_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_TPARAM_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_tparam_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_TPARAM_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_tparam_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_TPARAM_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_tparam_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_TPARAM_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_tparam_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_TPARAM_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_tparam_backout(CUR, NEW) +#define SNMP_V3_TPARAM_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_tparam_backout(CUR, NEW) +#define SNMP_V3_TPARAM_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_tparam_backout(CUR, NEW) + +#define SNMP_V3_TPARAM_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_tparam_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_TPARAM_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_tparam_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_TPARAM_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_tparam_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_TPARAM_FINISHED() snmp_v3_tparam_finished() + +#define SNMP_V3_NOTIFY_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_notify_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_NOTIFY_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_notify_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_NOTIFY_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_notify_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_NOTIFY_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_notify_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_NOTIFY_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_notify_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_NOTIFY_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_notify_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_NOTIFY_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_notify_backout(CUR, NEW) +#define SNMP_V3_NOTIFY_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_notify_backout(CUR, NEW) +#define SNMP_V3_NOTIFY_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_notify_backout(CUR, NEW) + +#define SNMP_V3_NOTIFY_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_notify_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_NOTIFY_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_notify_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_NOTIFY_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_notify_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_NOTIFY_FINISHED() snmp_v3_notify_finished() + +#define SNMP_V3_NPROF_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_nprof_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_NPROF_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_nprof_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_NPROF_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_nprof_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_NPROF_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_nprof_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_NPROF_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_nprof_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_NPROF_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_nprof_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_NPROF_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_nprof_backout(CUR, NEW) +#define SNMP_V3_NPROF_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_nprof_backout(CUR, NEW) +#define SNMP_V3_NPROF_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_nprof_backout(CUR, NEW) + +#define SNMP_V3_NPROF_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_nprof_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_NPROF_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_nprof_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_NPROF_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_nprof_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_NPROF_FINISHED() snmp_v3_nprof_finished() + +#define SNMP_V3_NFILT_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_nfilt_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_NFILT_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_nfilt_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_NFILT_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_nfilt_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_NFILT_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_nfilt_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_NFILT_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_nfilt_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_NFILT_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_nfilt_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_NFILT_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_nfilt_backout(CUR, NEW) +#define SNMP_V3_NFILT_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_nfilt_backout(CUR, NEW) +#define SNMP_V3_NFILT_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_nfilt_backout(CUR, NEW) + +#define SNMP_V3_NFILT_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_nfilt_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_NFILT_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_nfilt_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_NFILT_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_nfilt_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_NFILT_FINISHED() snmp_v3_nfilt_finished() + +#define SNMP_V3_PROXY_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_proxy_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_PROXY_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_proxy_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_PROXY_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_proxy_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_PROXY_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_proxy_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_PROXY_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_proxy_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_PROXY_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_proxy_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_PROXY_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_proxy_backout(CUR, NEW) +#define SNMP_V3_PROXY_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_proxy_backout(CUR, NEW) +#define SNMP_V3_PROXY_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_proxy_backout(CUR, NEW) + +#define SNMP_V3_PROXY_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_proxy_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_PROXY_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_proxy_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_PROXY_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_proxy_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_PROXY_FINISHED() snmp_v3_proxy_finished() + +#define SNMP_V3_COMM_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_community_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_COMM_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_community_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_COMM_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_community_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_COMM_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_community_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_COMM_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_community_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_COMM_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_community_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_COMM_DESTROY_BACKOUT(CUR, NEW) \ + snmp_community_backout(CUR, NEW) +#define SNMP_V3_COMM_CREATE_BACKOUT(CUR, NEW) \ + snmp_community_backout(CUR, NEW) +#define SNMP_V3_COMM_UPDATE_BACKOUT(CUR, NEW) \ + snmp_community_backout(CUR, NEW) + +#define SNMP_V3_COMM_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_community_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_COMM_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_community_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_COMM_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_community_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_COMM_FINISHED() snmp_community_finished() + +#endif /* #if INSTALL_ENVOY_SNMP_VERSION_3 */ + +#if (INSTALL_ENVOY_EPI_MASTER) +#define SNMP_RESETSYSUPTIME +#endif + +/***************************************************************** + AgentX routines and macros for the master + + Defaults are fine for the following macros: + #define ENVOY_AX_DEFAULT_TIMEOUT 1 + + #define ENVOY_AX_FIND_MIB(CONTEXT) (EBufferUsed(CONTEXT) ? 0 : &mib_root_node) + + #define ENVOY_AX_MA_AC_ADD(PKTP, MIBROOT) GEN_ERR + #define ENVOY_AX_MA_AC_REMOVE(PKTP, MIBROOT) GEN_ERR + #define ENVOY_AX_MA_AC_CLEAN(SESS_ID) +*****************************************************************/ +#if INSTALL_ENVOY_AGENTX_MASTER + + +#if 0 +extern bits32_t envoy_get_sysuptime(); +extern sbits32_t envoy_ax_transport_type(ptr_t); +extern int envoy_ax_transport_string(ptr_t, ALENGTH_T *, + bits8_t **, int *); + +#define ENVOY_GET_SYSUPTIME(CON) envoy_get_sysuptime() +#define ENVOY_AX_TRANSPORT_TYPE(COOKIE) envoy_ax_transport_type(COOKIE) +#define ENVOY_AX_TRANSPORT_STRING(COOKIE, NEED, BUF, DYN) \ + envoy_ax_transport_string(COOKIE, NEED, BUF, DYN) +#define ENVOY_AX_TRANSPORTS_SUPPORTED {0} +#endif + +extern bits32_t ENVOY_GET_SYSUPTIME(EBUFFER_T *); +extern sbits32_t ENVOY_AX_TRANSPORT_TYPE(ptr_t); +extern int ENVOY_AX_TRANSPORT_STRING(ptr_t, ALENGTH_T *, + bits8_t **, int *); +#define ENVOY_AX_TRANSPORTS_SUPPORTED {0} + +extern struct MIBNODE_S * ENVOY_AX_FIND_MIB(EBUFFER_T *); +extern bits16_t ENVOY_AX_MA_AC_ADD(struct ENVOY_AX_PKT_S *, + struct MIBNODE_S *); +extern bits16_t ENVOY_AX_MA_AC_REMOVE(struct ENVOY_AX_PKT_S *, + struct MIBNODE_S *); +extern void ENVOY_AX_MA_AC_CLEAN(bits32_t); + +extern void envoy_ax_translate_context(SNMP_PKT_T *, + struct ENVOY_AX_PKT_S *query_pkt); +#define ENVOY_AX_TRANSLATE_CONTEXT(PKT, AX_PKT) \ + envoy_ax_translate_context((PKT), (AX_PKT)) +#endif /* #if INSTALL_ENVOY_AGENTX_MASTER */ + +/***************************************************************** + AgentX routines and macros for the sub agent + + Defaults are fine for the following macros: + #define ENVOY_AX_SA_MIB_ROOT_NODE(CKE, PKT) 0 + #define ENVOY_AX_SA_TIMEOUT 1000 +*****************************************************************/ + + +#if (INSTALL_ENVOY_SNMP_LOCK) +/* Implemented as user exit routines */ +extern int get_read_lock(LOCK_T *); +extern void release_lock(LOCK_T *, unsigned char ); +extern int get_write_lock(LOCK_T *); +extern int init_rw_lock(LOCK_T *, char *); + + +/* Don't use the lock stuff if the user doesn't define it */ +#define ENVOY_SNMP_LOCK(lock) LOCK_T lock = {0,0,0} + +#define ENVOY_SNMP_LOCK_EXTERN(lock) extern LOCK_T lock + +#define ENVOY_SNMP_INIT_LOCK_TAG(lock,str) init_rw_lock(&lock, str) + +#define ENVOY_SNMP_GET_READ_LOCK(lock) get_read_lock(&lock) + +#define ENVOY_SNMP_RELEASE_READ_LOCK(lock) release_lock(&lock, READLOCK) + +#define ENVOY_SNMP_GET_WRITE_LOCK(lock) get_write_lock(&lock) + +#define ENVOY_SNMP_RELEASE_WRITE_LOCK(lock) release_lock(&lock, WRITELOCK) + +#define ENVOY_SNMP_LOCK_AND_1ARGS(get, lock, com1) \ + if (get(lock)) { com1; } + +#define ENVOY_SNMP_LOCK_AND_2ARGS(get, lock, com1, com2) \ + if (get(lock)) { com1; com2; } + +#define ENVOY_SNMP_LOCK_AND_3ARGS(get, lock, com1, com2, com3) \ + if (get(lock)) { com1; com2; com3; } + +#define ENVOY_SNMP_LOCK_AND_4ARGS(get, lock, com1, com2, com3, com4) \ + if (get(lock)) { com1; com2; com3; com4; } + +/* + * declare all Lock externs here + */ +ENVOY_SNMP_LOCK_EXTERN(SNMP_CoarseLock); +ENVOY_SNMP_LOCK_EXTERN(SNMP_SubagentLock); + +#if INSTALL_ENVOY_SNMP_VERSION_2 +ENVOY_SNMP_LOCK_EXTERN(SNMP_TimeStampLock); +#endif +#if INSTALL_ENVOY_SNMP_PROXY +ENVOY_SNMP_LOCK_EXTERN(SNMP_ProxyLock); +#endif +ENVOY_SNMP_LOCK_EXTERN(SNMP_TimerLock); + +#endif /* (INSTALL_ENVOY_SNMP_LOCK) */ + +/* Prototypes for these functions, just to keep things clear. */ + +extern bits32_t ENVOY_NOW(void); +extern void ENVOY_CALL_TIMER(bits32_t when, void (*what)()); + +/* If SC_SOCAKDDR hasn't been defined by now, define it. */ +#ifndef SC_SOCKADDR +#define SC_SOCKADDR sockaddr_in +#endif + + +#endif /* CONFIG_PREAMBLE */ diff --git a/h/wrn/wm/util/port/isisnmp/mcf250/config.mk b/h/wrn/wm/util/port/isisnmp/mcf250/config.mk new file mode 100644 index 0000000..3ae1629 --- /dev/null +++ b/h/wrn/wm/util/port/isisnmp/mcf250/config.mk @@ -0,0 +1,444 @@ +#* @(#) pSOSystem PowerPC/V2.5.0-BETA2: configs/ppc/config.mk 4.2 98/07/01 08:29:48 * +#*********************************************************************** +#* * +#* MODULE: configs/std/config.mk * +#* DATE: 98/07/01 * +#* PURPOSE: Macro definitions, linker commands, etc, for "make" * +#* * +#*---------------------------------------------------------------------* +#* * +#* Copyright 1991 - 1998, Integrated Systems, Inc. * +#* ALL RIGHTS RESERVED * +#* * +#* Permission is hereby granted to licensees of Integrated Systems, * +#* Inc. products to use or abstract this computer program for the * +#* sole purpose of implementing a product based on Integrated * +#* Systems, Inc. products. No other rights to reproduce, use, * +#* or disseminate this computer program, whether in part or in * +#* whole, are granted. * +#* * +#* Integrated Systems, Inc. makes no representation or warranties * +#* with respect to the performance of this computer program, and * +#* specifically disclaims any responsibility for any damages, * +#* special or consequential, connected with the use of this program. * +#* * +#*---------------------------------------------------------------------* +#*********************************************************************** +# +#------------------------------------------------------------------------ +# Compiler commands and command-line options +#------------------------------------------------------------------------ +# Add following option to COPTS_FILE2 to generate listing files +# -W:as:,-l -Xpass-source +#------------------------------------------------------------------------ +CC = dcc +CXX = dplus +COMP_OPTS1 = -O -t$(DTARGET)E$(DFP):psos -Xstruct-best-align=0 +COMP_OPTS2 = -Xstrict-ansi $(PSS_APPCOPTS) -D__DIAB -DPPC +COPTS_FILE1 = -I. $(PSS_APPINCS) -I$(PSS_ROOT)/include -I$(PSS_BSP) +COPTS_FILE2 = -I$(PSS_ROOT)/bsps/devices $(PSS_VINCLUDE) -I@ -c +CXX_OPTS = -Xexception +COPTS = -@c.opt +CXXOPTS = -@cxx.opt + +#------------------------------------------------------------------------ +# Assembler command-line options +#------------------------------------------------------------------------ +AS = das + +#------------------------------------------------------------------------ +# Added target switch for the assembler +# The target definition is located in bsp.mk of the bsp you are using +#------------------------------------------------------------------------ +# Add following option to AOPTS_FILE1 to generate listing files -l +#------------------------------------------------------------------------ +AOPTS_FILE1 = -I. $(PSS_APPINCS) -I$(PSS_ROOT)/include -I$(PSS_BSP) +AOPTS_FILE2 = -I$(PSS_ROOT)/bsps/devices $(PSS_VINCLUDE) -I@ +AOPTS_FILE3 = -t$(DTARGET)E$(DFP) +AOPTS = -@a.opt + +#------------------------------------------------------------------------ +# Linker command name +#------------------------------------------------------------------------ +LD = dld +LOPTS = -t$(DTARGET)E$(DFP) -Xsupress-dot -Xreloc-bug -m2 $(PSS_APPLOPTS) + +#------------------------------------------------------------------------ +# Librarian command name and options +#------------------------------------------------------------------------ +LIB = dar +LIBOPTS = -qf +LIBOPTS_SORT = -sR + +#======================================================================== +# Link everything together +#======================================================================== +CFG1_OBJS= bspcfg.o philecfg.o pnacfg.o prepccfg.o dialog.o rarp.o +CFG2_OBJS= probecfg.o prpccfg.o psecfg.o psoscfg.o pmontcfg.o +CFG3_OBJS= pollio.o sysinit.o gsblkcfg.o plmcfg.o pnetcfg.o ldcfg.o + +ram.elf: cxx.opt c.opt a.opt ill.opt begin.o \ + makefile \ + $(CFG1_OBJS) \ + $(CFG2_OBJS) \ + $(CFG3_OBJS) \ + $(PSS_DRVOBJS) \ + $(PSS_APPOBJS) \ + $(PSS_BSP)/libbsp.a \ + $(PSS_ROOT)/sys/os/libsys.a \ + $(PSS_ROOT)/sys/libc/libprepc$(DFP).a \ + $(PSS_ROOT)/sys/libc/libpnet.a \ + $(PSS_BSP)/anchor.lnk \ + $(PSS_BSP)/ram.lnk + @cat $(PSS_BSP)/ram.lnk >cmd.lnk + @cat $(PSS_BSP)/anchor.lnk >>cmd.lnk + @echo $(LOPTS) -o ram.elf -Wm cmd.lnk begin.o > l.opt + @echo -L $(PSS_BSP) -L $(PSS_ROOT)/sys/os >> l.opt + @echo -L $(PSS_ROOT)/sys/libc $(PSS_APPLINKS) >> l.opt + @echo $(PSS_VLINK) >> l.opt + @echo $(CFG1_OBJS) >> l.opt + @echo $(CFG2_OBJS) >> l.opt + @echo $(CFG3_OBJS) >> l.opt + @echo $(PSS_APPOBJS) >> l.opt + @echo -m3 $(APP_LIB1) >> l.opt + @echo -m3 $(APP_LIB2) >> l.opt + @echo -m3 $(APP_LIB3) >> l.opt + @echo -m3 $(APP_LIB4) >> l.opt + @echo -m3 $(APP_LIB5) >> l.opt + @echo $(PSS_DRVOBJS) >> l.opt + @echo -m3 $(DRV_LIB1) >> l.opt + @echo -m3 $(DRV_LIB2) >> l.opt + @echo -m3 $(DRV_LIB3) >> l.opt + @echo -m3 $(DRV_LIB4) >> l.opt + @echo -m3 $(DRV_LIB5) >> l.opt + @echo -lbsp >> l.opt + @echo -lsys >> l.opt + @echo -lprepc$(DFP) -lpnet -lquery >> l.opt + @echo -m3 $(FIX_LIB) >> l.opt + @echo $(PSS_COMPLIB) >> l.opt + $(LD) -@l.opt > ram.map + ddump -tv ram.elf >> ram.map + +ram.hex: ram.elf + ddump -Rv ram.elf -o ram.hex + +rom.elf: cxx.opt c.opt a.opt ill.opt begin.o \ + makefile \ + $(CFG1_OBJS) \ + $(CFG2_OBJS) \ + $(CFG3_OBJS) \ + $(PSS_DRVOBJS) \ + $(PSS_BSP)/libbsp.a \ + $(PSS_APPOBJS) \ + $(PSS_ROOT)/sys/os/libsys.a \ + $(PSS_ROOT)/sys/libc/libprepc$(DFP).a \ + $(PSS_ROOT)/sys/libc/libpnet.a \ + $(PSS_BSP)/anchor.lnk \ + $(PSS_BSP)/rom.lnk + @cat $(PSS_BSP)/rom.lnk >cmd.lnk + @cat $(PSS_BSP)/anchor.lnk >>cmd.lnk + @echo $(LOPTS) -o rom.elf -Wm cmd.lnk begin.o > l.opt + @echo -L $(PSS_BSP) -L $(PSS_ROOT)/sys/os >> l.opt + @echo -L $(PSS_ROOT)/sys/libc $(PSS_APPLINKS) >> l.opt + @echo $(PSS_VLINK) >> l.opt + @echo $(CFG1_OBJS) >> l.opt + @echo $(CFG2_OBJS) >> l.opt + @echo $(CFG3_OBJS) >> l.opt + @echo $(PSS_APPOBJS) >> l.opt + @echo -m3 $(APP_LIB1) >> l.opt + @echo -m3 $(APP_LIB2) >> l.opt + @echo -m3 $(APP_LIB3) >> l.opt + @echo -m3 $(APP_LIB4) >> l.opt + @echo -m3 $(APP_LIB5) >> l.opt + @echo $(PSS_DRVOBJS) >> l.opt + @echo -m3 $(DRV_LIB1) >> l.opt + @echo -m3 $(DRV_LIB2) >> l.opt + @echo -m3 $(DRV_LIB3) >> l.opt + @echo -m3 $(DRV_LIB4) >> l.opt + @echo -m3 $(DRV_LIB5) >> l.opt + @echo -lbsp >> l.opt + @echo -lsys >> l.opt + @echo -lprepc$(DFP) -lpnet -lquery >> l.opt + @echo -m3 $(FIX_LIB) >> l.opt + @echo $(PSS_COMPLIB) >> l.opt + $(LD) -@l.opt > rom.map + ddump -tv rom.elf >> rom.map + +rom.hex: rom.elf + ddump -Rv rom.elf -o rom.hex + +os.elf: cxx.opt c.opt a.opt ill.opt begin.o \ + makefile \ + $(CFG1_OBJS) \ + $(CFG2_OBJS) \ + $(CFG3_OBJS) \ + $(PSS_DRVOBJS) \ + $(PSS_BSP)/libbsp.a \ + $(PSS_ROOT)/sys/os/libsys.a \ + $(PSS_ROOT)/sys/libc/libprepc$(DFP).a \ + $(PSS_ROOT)/sys/libc/libpnet.a \ + $(PSS_BSP)/anchor.lnk \ + $(PSS_BSP)/os.lnk + @cat $(PSS_BSP)/os.lnk >cmd.lnk + @cat $(PSS_BSP)/anchor.lnk >>cmd.lnk + @echo $(LOPTS) -o os.elf -Wm cmd.lnk begin.o > l.opt + @echo -L $(PSS_BSP) -L $(PSS_ROOT)/sys/os >> l.opt + @echo -L $(PSS_ROOT)/sys/libc $(PSS_APPLINKS) >> l.opt + @echo $(PSS_VLINK) >> l.opt + @echo $(CFG1_OBJS) >> l.opt + @echo $(CFG2_OBJS) >> l.opt + @echo $(CFG3_OBJS) >> l.opt + @echo $(PSS_DRVOBJS) >> l.opt + @echo -m3 $(DRV_LIB1) >> l.opt + @echo -m3 $(DRV_LIB2) >> l.opt + @echo -m3 $(DRV_LIB3) >> l.opt + @echo -m3 $(DRV_LIB4) >> l.opt + @echo -m3 $(DRV_LIB5) >> l.opt + @echo -lbsp >> l.opt + @echo -lsys >> l.opt + @echo -lprepc$(DFP) -lpnet -lquery >> l.opt + @echo -m3 $(FIX_LIB) >> l.opt + @echo $(PSS_COMPLIB) >> l.opt + $(LD) -@l.opt > os.map + ddump -tv os.elf >> os.map + +os.hex: os.elf + ddump -Rv os.elf -o os.hex + +app.elf: cxx.opt c.opt a.opt ill.opt beginapp.o bspcalls.o \ + makefile \ + $(PSS_APPOBJS) \ + $(PSS_ROOT)/sys/os/libsys.a \ + $(PSS_ROOT)/sys/libc/libprepc$(DFP).a \ + $(PSS_BSP)/anchor.lnk \ + $(PSS_BSP)/app.lnk + @cat $(PSS_BSP)/app.lnk >cmd.lnk + @cat $(PSS_BSP)/anchor.lnk >>cmd.lnk + @echo $(LOPTS) -o app.elf -Wm cmd.lnk beginapp.o > l.opt + @echo bspcalls.o >> l.opt + @echo -L $(PSS_BSP) -L $(PSS_ROOT)/sys/os >> l.opt + @echo -L $(PSS_ROOT)/sys/libc $(PSS_APPLINKS) >> l.opt + @echo $(PSS_VLINK) >> l.opt + @echo $(PSS_APPOBJS) >> l.opt + @echo -m3 $(APP_LIB1) >> l.opt + @echo -m3 $(APP_LIB2) >> l.opt + @echo -m3 $(APP_LIB3) >> l.opt + @echo -m3 $(APP_LIB4) >> l.opt + @echo -m3 $(APP_LIB5) >> l.opt + @echo -lsys >> l.opt + @echo -lprepc$(DFP) -lquery >> l.opt + @echo -m3 $(FIX_LIB) >> l.opt + @echo $(PSS_COMPLIB) >> l.opt + $(LD) -@l.opt > app.map + ddump -tv app.elf >> app.map + +app_ld.elf: app.elf + @echo $(PSS_LDBOPTS) -p 180 -n LDBL -mAT -u 1024 -s 4096 > ld_prep.def + @ld_prep -v -d ld_prep.def -o app_ld.elf app.elf + @rm -f ld_prep.def + +app.hex: app.elf + ddump -Rv app.elf -o app.hex + +app_ld.hex: app.hex + @echo $(PSS_LDBOPTS) -p 180 -n LDBL -mAT -u 1024 -s 4096 > ld_prep.def + @ld_prep -v -d ld_prep.def -o app_ld.hex app.hex + @rm -f ld_prep.def + +driver.elf: cxx.opt c.opt a.opt ill.opt lddriver.o bspcalls.o \ + ldblcfg.o \ + makefile \ + $(PSS_APPOBJS) \ + $(PSS_ROOT)/sys/os/libsys.a \ + $(PSS_ROOT)/sys/libc/libprepc$(DFP).a \ + $(PSS_BSP)/anchor.lnk \ + $(PSS_BSP)/app.lnk + @cat $(PSS_BSP)/app.lnk >cmd.lnk + @cat $(PSS_BSP)/anchor.lnk >>cmd.lnk + @echo $(LOPTS) -o driver.elf cmd.lnk lddriver.o > l.opt + @echo bspcalls.o >> l.opt + @echo -L $(PSS_BSP) -L $(PSS_ROOT)/sys/os >> l.opt + @echo -L $(PSS_ROOT)/sys/libc $(PSS_APPLINKS) >> l.opt + @echo $(PSS_VLINK) >> l.opt + @echo $(PSS_APPOBJS) >> l.opt + @echo -m3 $(APP_LIB1) >> l.opt + @echo -m3 $(APP_LIB2) >> l.opt + @echo -m3 $(APP_LIB3) >> l.opt + @echo -m3 $(APP_LIB4) >> l.opt + @echo -m3 $(APP_LIB5) >> l.opt + @echo -lsys >> l.opt + @echo -lprepc$(DFP) >> l.opt + @echo -m3 $(FIX_LIB) >> l.opt + @echo $(PSS_COMPLIB) >> l.opt + $(LD) -@l.opt > driver.map + @ddump -tv driver.elf >> driver.map + +lddriver.elf: driver.elf + @echo $(PSS_LDBOPTS) -p 180 -n LDBL -mAT -u 1024 -s 4096 > ld_prep.def + @ld_prep -v -d ld_prep.def -o lddriver.elf driver.elf + @rm -f ld_prep.def + +lib.elf: cxx.opt c.opt a.opt ill.opt bspcalls.o \ + makefile \ + $(PSS_APPOBJS) \ + $(PSS_ROOT)/sys/os/libsys.a \ + $(PSS_ROOT)/sys/libc/libprepc$(DFP).a \ + $(PSS_BSP)/anchor.lnk \ + $(PSS_BSP)/app.lnk + @cat $(PSS_BSP)/app.lnk >cmd.lnk + @cat $(PSS_BSP)/anchor.lnk >>cmd.lnk + @echo $(LOPTS) -o lib.elf cmd.lnk > l.opt + @echo bspcalls.o >> l.opt + @echo -L $(PSS_BSP) -L $(PSS_ROOT)/sys/os >> l.opt + @echo -L $(PSS_ROOT)/sys/libc $(PSS_APPLINKS) >> l.opt + @echo $(PSS_VLINK) >> l.opt + @echo $(PSS_APPOBJS) >> l.opt + @echo -m3 $(APP_LIB1) >> l.opt + @echo -m3 $(APP_LIB2) >> l.opt + @echo -m3 $(APP_LIB3) >> l.opt + @echo -m3 $(APP_LIB4) >> l.opt + @echo -m3 $(APP_LIB5) >> l.opt + @echo -lsys >> l.opt + @echo -lprepc$(DFP) -lquery >> l.opt + @echo -m3 $(FIX_LIB) >> l.opt + @echo $(PSS_COMPLIB) >> l.opt + $(LD) -@l.opt > lib.map + @ddump -tv lib.elf >> lib.map + +lib_ld.elf: lib.elf + @echo $(PSS_LDBOPTS) > ld_prep.def + @ld_prep -v -d ld_prep.def -o lib_ld.elf lib.elf + @rm -f ld_prep.def + +lib.hex: lib.elf + ddump -Rv lib.elf -o lib.hex + +lib_ld.hex: lib.hex + @echo $(PSS_LDBOPTS) > ld_prep.def + @ld_prep -v -d ld_prep.def -o lib_ld.hex lib.hex + @rm -f ld_prep.def + +#------------------------------------------------------------------------ +# Compile or assemble modules which are always used. +#------------------------------------------------------------------------ +begin.o: makefile $(PSS_CONFIG)/config.mk +begin.o: $(PSS_CONFIG)/begin.s + $(AS) $(AOPTS) -o $@ $< + +beginapp.o: makefile $(PSS_CONFIG)/config.mk +beginapp.o: $(PSS_CONFIG)/beginapp.s + $(AS) $(AOPTS) -o $@ $< + +lddriver.o: makefile $(PSS_CONFIG)/config.mk +lddriver.o: $(PSS_CONFIG)/lddriver.s + $(AS) $(AOPTS) -o $@ $< + +bspcalls.o: makefile $(PSS_CONFIG)/config.mk +bspcalls.o: $(PSS_BSP)/bspcalls.s + $(AS) $(AOPTS) -o $@ $< + +gsblkcfg.o: makefile $(PSS_CONFIG)/config.mk sys_conf.h +gsblkcfg.o: $(PSS_CONFIG)/gsblkcfg.c + $(CC) $(COPTS) -o $@ $< + +sysinit.o: qpsos.tmp \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h +sysinit.o: $(PSS_CONFIG)/sysinit.c + $(CC) $(COPTS) -o sysinit.tmp $< + @$(LD) $(LOPTS) -r -Xsupress-dot -Xreloc-bug -o sysinit.o sysinit.tmp qpsos.tmp > qpsos.map + @rm -f sysinit.tmp qpsos.o qpsos.map + +qpsos.tmp: $(PSS_ROOT)/sys/os/qpsos.s + @$(AS) $(AOPTS) -o qpsos.o $< + @$(LIB) r qpsos.tmp qpsos.o + +philecfg.o: makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h +philecfg.o: $(PSS_CONFIG)/philecfg.c + $(CC) $(COPTS) -o $@ $< + +pnacfg.o: makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h +pnacfg.o: $(PSS_CONFIG)/pnacfg.c + $(CC) $(COPTS) -o $@ $< + +pnetcfg.o: makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h +pnetcfg.o: $(PSS_CONFIG)/pnetcfg.c + $(CC) $(COPTS) -o $@ $< + +prepccfg.o: makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h +prepccfg.o: $(PSS_CONFIG)/prepccfg.c + $(CC) $(COPTS) -o $@ $< + +probecfg.o: makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h +probecfg.o: $(PSS_CONFIG)/probecfg.c + $(CC) $(COPTS) -o $@ $< + +prpccfg.o: makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h +prpccfg.o: $(PSS_CONFIG)/prpccfg.c + $(CC) $(COPTS) -o $@ $< + +psecfg.o: makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h +psecfg.o: $(PSS_CONFIG)/psecfg.c + $(CC) $(COPTS) -o $@ $< + +psoscfg.o: makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h +psoscfg.o: $(PSS_CONFIG)/psoscfg.c + $(CC) $(COPTS) -o $@ $< + +pmontcfg.o: makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h +pmontcfg.o: $(PSS_CONFIG)/pmontcfg.c + $(CC) $(COPTS) -o $@ $< + +dialog.o: makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h +dialog.o: $(PSS_CONFIG)/dialog.c + $(CC) $(COPTS) -o $@ $< + +pollio.o: makefile $(PSS_CONFIG)/config.mk \ + $(PSS_BSP)/bsp.h +pollio.o: $(PSS_CONFIG)/pollio.c + $(CC) $(COPTS) -o $@ $< + +bspcfg.o: makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h +bspcfg.o: $(PSS_BSP)/bspcfg.c + $(CC) $(COPTS) -o $@ $< + +plmcfg.o: makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h +plmcfg.o: $(PSS_CONFIG)/plmcfg.c + $(CC) $(COPTS) -o $@ $< + +ldcfg.o: makefile $(PSS_CONFIG)/config.mk sys_conf.h +ldcfg.o: $(PSS_CONFIG)/ldcfg.c + $(CC) $(COPTS) -o $@ $< + +c.opt: makefile $(PSS_CONFIG)/config.mk + @echo $(COMP_OPTS1) > c.opt + @echo $(COMP_OPTS2) >> c.opt + @echo $(COPTS_FILE1) >> c.opt + @echo $(COPTS_FILE2) >> c.opt + +cxx.opt: makefile $(PSS_CONFIG)/config.mk + @echo $(COMP_OPTS1) > cxx.opt + @echo $(COMP_OPTS2) >> cxx.opt + @echo $(COPTS_FILE1) >> cxx.opt + @echo $(COPTS_FILE2) >> cxx.opt + @echo $(CXX_OPTS) >> cxx.opt + +a.opt: makefile $(PSS_CONFIG)/config.mk + @echo $(AOPTS_FILE1) > a.opt + @echo $(AOPTS_FILE2) >> a.opt + @echo $(AOPTS_FILE3) >> a.opt + +ill.opt: makefile $(PSS_CONFIG)/config.mk + @echo $(LOPTS) > ill.opt diff --git a/h/wrn/wm/util/port/isisnmp/mcf250/drv_conf.h b/h/wrn/wm/util/port/isisnmp/mcf250/drv_conf.h new file mode 100644 index 0000000..c0703e9 --- /dev/null +++ b/h/wrn/wm/util/port/isisnmp/mcf250/drv_conf.h @@ -0,0 +1,1272 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/isisnmp/mcf250/drv_conf.h,v 1.1.1.1 2001/11/05 17:47:10 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: drv_conf.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:10 tneale + * Tornado shuffle + * + * Revision 1.1 2000/02/24 16:05:55 josh + * configuration files for pSOS for ColdFire + * + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + +/* @(#) pSOSystem PowerPC/V2.5.0-BETA1: apps.v22/xxxx/drv_conf.c 3.24 (snmpsa) 98/06/03 15:46:01 */ +/***********************************************************************/ +/* */ +/* MODULE: drv_conf.c */ +/* DATE: 98/06/03 */ +/* PURPOSE: pSOSystem driver configuration and initialization */ +/* */ +/* There are two functions in this file: */ +/* */ +/* SetUpDrivers to setup drivers except for Network drivers */ +/* SetUpNI to setup Network drivers */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* Copyright 1993 - 1997, Integrated Systems, Inc. */ +/* ALL RIGHTS RESERVED */ +/* */ +/* Permission is hereby granted to licensees of Integrated Systems, */ +/* Inc. products to use or abstract this computer program for the */ +/* sole purpose of implementing a product based on Integrated */ +/* Systems, Inc. products. No other rights to reproduce, use, */ +/* or disseminate this computer program, whether in part or in */ +/* whole, are granted. */ +/* */ +/* Integrated Systems, Inc. makes no representation or warranties */ +/* with respect to the performance of this computer program, and */ +/* specifically disclaims any responsibility for any damages, */ +/* special or consequential, connected with the use of this program. */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* */ +/* */ +/***********************************************************************/ +#include +#include "bsp.h" +#include +#include +#include +#include + +#ifdef SC_INIT_DNTABLE +#include +static long GenerateString(char *dest, char *format, ...); +#endif + +#if SC_DEV_SPI + #include "spi.h" +#endif + +#if (SC_PSE) +#include +#include +#endif + +#if (SC_DEV_DLPI) +#include +#endif + +#if (SC_DEV_NULL) +extern void NullDevInit(struct ioparms *); +extern void NullDevRead(struct ioparms *); +extern void NullDevWrite(struct ioparms *); +extern void NullDevCntrl(struct ioparms *); +#endif + +#define NULLF (ULONG) ((void (*)()) 0) + +static const char RarpErrTimeout[] = + "RARP request failed: Check for a RARP server"; +static const char RarpErrNet[] = + "RARP request failed: Network Error"; + +#if SC_PSOS || SC_PSOSM +/***********************************************************************/ +/* SetUpDrivers: installs drivers in PsosIO table via a call to */ +/* InstallDriver and then calls driver setup function if */ +/* needed. NOTE: If the driver is to be part of the */ +/* Network Interface then it should be placed in the */ +/* SetUpNI function. */ +/* */ +/* INPUT: FreeMemPtr = A pointer to unused memory that can be */ +/* used to allocate space for a driver. */ +/* NOTE: Be sure to advance FreeMemPtr if */ +/* memory is allocates! */ +/* */ +/* RETURNS: The new address of free memory after the drivers have */ +/* allocated space. */ +/* */ +/* NOTE: This function does many precompile checks so errors */ +/* can be found during compile-time rather then at run- */ +/* time. */ +/* */ +/* To add a non-Network driver to pSOSystem, call InstallDriver(). */ +/* This adds a device driver to the PsosIO table. InstallDriver() */ +/* takes the following arguments: */ +/* */ +/* unsigned short major_number device major number */ +/* void (*dev_init)(), device init procedure */ +/* void (*dev_open)(), device open procedure */ +/* void (*dev_close)(), device close procedure */ +/* void (*dev_read)(), device read procedure */ +/* void (*dev_write)(), device write procedure */ +/* void (*dev_ioctl)(), device control procedure */ +/* unsigned long dev_param, Used for STREAMS modules */ +/* unsigned short rsvd2) reserved */ +/* unsigned short flags; If set to IO_AUTOINIT pSOS will */ +/* automatically call the */ +/* drivers initialization */ +/* function. The SC_AUTOINIT */ +/* #define which is set in */ +/* sys_conf.h can be used to set */ +/* this element. */ +/* */ +/* InstallDriver() does not return a value. InstallDriver() assumes */ +/* SC_DEVMAX is defined in sys_conf.h and is useful only before pSOS+ */ +/* has been initialized. */ +/* */ +/* If you are adding a driver that needs to be initialized before */ +/* either pSOS+ is initialized or the driver's init function is */ +/* called, then you can call a setup function (that you create) for */ +/* the driver (for example, see the CnslSetup call for the serial */ +/* device driver). If your initialization function needs to allocate */ +/* memory, you may pass it the FreeMemPtr. The function should return */ +/* a new FreeMemPtr which points to the end of the memory it has */ +/* allocated. */ +/* */ +/* When adding code to install a new driver, it is a good idea to add */ +/* precompile checks so errors can be found during compile-time rather */ +/* then at run-time. Precompile checks are used, for example, in the */ +/* code that installs the pSOSystem serial device driver below. */ +/* */ +/***********************************************************************/ +UCHAR *SetUpDrivers(UCHAR *FreeMemPtr) +{ +extern ULONG PsosNumDntEnts; + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem serial device driver. */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SERIAL && BSP_SERIAL) + #if(SC_DEV_SERIAL > SC_DEVMAX) + #error "SC_DEV_SERIAL cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SERIAL, CnslInit, NULLF, NULLF,CnslRead, + CnslWrite, CnslCntrl, 0, 0, SC_AUTOINIT); + FreeMemPtr = CnslSetup(FreeMemPtr, SysVars.DefBaud, + SC_APP_CONSOLE); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSEUDO console driver */ +/*---------------------------------------------------------------------*/ +#if (DEV_PSCONSOLE) + InstallDriver(SC_DEV_PSCONSOLE, PsConsoleInit, PsConsoleOpen, + PsConsoleClose, PsConsoleRead, PsConsoleWrite, + PsConsoleCntrl, 0, 0, 0); + PsosNumDntEnts +=4; +#endif + +/*--------------------------------------------------------------------*/ +/* Setup pSOSystem PC console device driver */ +/*--------------------------------------------------------------------*/ +#if (SC_DEV_CONSOLE && BSP_CONSOLE) + #if (SC_DEV_CONSOLE >SC_DEVMAX) + #error "SC_DEV_CONSOLE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_CONSOLE, PcCnslInit, NULLF, NULLF, + PcCnslRead, PcCnslWrite, PcCnslCntrl, 0, 0, + SC_AUTOINIT); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem tick timer. */ +/*---------------------------------------------------------------------*/ +#if SC_DEV_TIMER + #if(SC_DEV_TIMER > SC_DEVMAX) + #error "SC_DEV_TIMER cannot be > SC_DEVMAX" + #endif + #if (!SC_PSOS && !SC_PSOSM) + #error "Must have pSOS+ or pSOS+m in system to use tick timer!" + #endif + InstallDriver(SC_DEV_TIMER, RtcInit, NULLF, NULLF, NULLF, NULLF, + NULLF, 0, 0, SC_AUTOINIT); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install DevNull driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_NULL) + InstallDriver(SC_DEV_NULL, NullDevInit, NULLF, NULLF,NullDevRead, + NullDevWrite, NullDevCntrl, 0, 0, 0); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem ramdisk driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if SC_DEV_RAMDISK + #if(SC_DEV_RAMDISK > SC_DEVMAX) + #error "SC_DEV_RAMDISK cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_RAMDISK, RdskInit, RdskOpen, RdskClose, RdskRead, + RdskWrite, RdskCntrl, 0, 0, 0); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem SCSI driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SCSI && BSP_SCSI) + #if(SC_DEV_SCSI > SC_DEVMAX) + #error "SC_DEV_SCSI cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SCSI, SdrvInit, SdskOpen, SdskClose, SdskRead, + SdskWrite, SdrvCntrl, 0, 0, 0); + PsosNumDntEnts += (8*5); +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem SCSI Tape driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SCSI_TAPE && BSP_SCSI_TAPE) + #if(SC_DEV_SCSI_TAPE > SC_DEVMAX) + #error "SC_DEV_SCSI_TAPE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SCSI_TAPE, SdrvInit, StapeOpen, StapeClose, + StapeRead, StapeWrite, SdrvCntrl, 0, 0, 0); + + PsosNumDntEnts += 8; + /*-----------------------------------------------------------------*/ + /* Don't need to call SdrvSetup this time since it was done before */ + /*-----------------------------------------------------------------*/ + /* SdrvSetup(); */ +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem CMOS clock driver */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_CMOS && BSP_CLOCK) + #if (SC_DEV_CMOS >SC_DEVMAX) + #error "SC_DEV_CMOS cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_CMOS, NULLF, NULLF, NULLF, CmcRead, + CmcWrite, NULLF, 0, 0, 0); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem printer driver */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_PARALLEL && BSP_PARALLEL) + #if (SC_DEV_PARALLEL >SC_DEVMAX) + #error "SC_DEV_PARALLEL cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_PARALLEL, ParInit, ParOpen, ParClose, NULLF, + ParWrite, ParCntrl, 0, 0, 0); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem floppy diskette driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_FLOPPY && BSP_FLOPPY) + #if (SC_DEV_FLOPPY >SC_DEVMAX) + #error "SC_DEV_FLOPPY cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_FLOPPY, FlpInit, NULLF, NULLF, FlpRead, + FlpWrite, NULLF, 0, 0, 0); + PsosNumDntEnts += 2; +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem IDE disk driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_IDE && BSP_IDE) + #if (SC_DEV_IDE >SC_DEVMAX) + #error "SC_DEV_IDE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_IDE, IDEInit, NULLF, NULLF, IDERead, + IDEWrite, IDECntrl, 0, 0, 0); + PsosNumDntEnts += (4*5); +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem TFTP driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_TFTP) + #if(SC_DEV_TFTP > SC_DEVMAX) + #error "SC_DEV_TFTP cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_TFTP, TftpInit, TftpOpen, TftpClose, TftpRead, + NULLF, TftpCntl, 0, 0, 0); + PsosNumDntEnts += SC_MAX_TFTP_CHAN; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the SPI driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SPI) + #if(SC_DEV_SPI > SC_DEVMAX) + #error "SC_DEV_SPI cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SPI, SPI_init, SPI_open, SPI_close, NULLF, + NULLF, SPI_io, 0, 0, 0); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install DLPI drivers */ +/*---------------------------------------------------------------------*/ + +#if (SC_DEV_DLPI || SC_DEV_PPP || SC_DEV_SLIP) + { +#include "enetcfg.h" + +int dlpi_setinitroutine = 0; +int dlpi_nicount = 0; /* number of ni's below this DLPI */ +void (*init_fn)(); /* Ethernet driver initialization routine */ + /* Call this function only once */ +char *DlpiErrMsg = "DlpiAddNI failed: NI Error"; + +#if (SC_DEV_DLPI) + { + #if(SC_DEV_DLPI> SC_DEVMAX) + #error "SC_DEV_DLPI cannot be > SC_DEVMAX" + #endif + static const psedrvparam_t eth0param = {"eth0", DT_CLONE, &enetinfo, 0, 0}; + init_fn = NULLF; + if (!dlpi_setinitroutine) + { + init_fn = (void (*)())enetinit; + dlpi_setinitroutine = 1; + } + InstallDriver(SC_DEV_DLPI, init_fn, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)ð0param, 0, 0); + dlpi_nicount++; + PsosNumDntEnts++; + } +#endif /* SC_DEV_DLPI */ + +#if SC_DEV_DLPI_PPP + { + #if(SC_DEV_DLPI_PPP > SC_DEVMAX) + #error "SC_DEV_DLPI_PPP cannot be > SC_DEVMAX" + #endif + static const psedrvparam_t pppparam = {"ppp", DT_CLONE, &enetinfo, 0, 0}; + init_fn = NULLF; + if (!dlpi_setinitroutine) + { + init_fn = (void (*)())enetinit; + dlpi_setinitroutine = 1; + } + InstallDriver(SC_DEV_DLPI_PPP, init_fn, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&pppparam, 0, 0); + dlpi_nicount++; + PsosNumDntEnts++; + } +#endif /* SC_DEV_DLPI_PPP */ + +#if SC_DEV_DLPI_SLIP + { + #if(SC_DEV_DLPI_SLIP > SC_DEVMAX) + #error "SC_DEV_DLPI_SLIP cannot be > SC_DEVMAX" + #endif + static const psedrvparam_t slipparam = {"slip", DT_CLONE, &enetinfo, 0, 0}; + init_fn = NULLF; + if (!dlpi_setinitroutine) + { + init_fn = (void (*)())enetinit; + dlpi_setinitroutine = 1; + } + InstallDriver(SC_DEV_DLPI_SLIP, init_fn, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&slipparam, 0, 0); + dlpi_nicount++; + PsosNumDntEnts++; + } +#endif /* SC_DEV_DLPI_SLIP */ + +/* + * User has defined other DLPI drivers locally. Include user + * file drv_conf.idl that installs user's own ENETDLPI drivers + */ +#if SC_DEV_DLPI_OTHER +#include "drv_conf.idl" +#endif + + /*-------------------------------------------------------------*/ + /* Call DlpiInit to initialize the Streams DLPI driver */ + /* Arguments passed to DlpiInit are: */ + /* 1. Free memory address */ + /* 2. Maximum NI interface number */ + /* 3. Maximum number of streams per interface */ + /*-------------------------------------------------------------*/ + FreeMemPtr = DlpiInit(FreeMemPtr, dlpi_nicount, SE_DLPI_MAXSTR_PERNI); + + /*-------------------------------------------------------------*/ + /* Call DlpiAddNI to add an NI interface to the Streams DLPI */ + /* driver. DlpiAddNI must be called for each NI driver */ + /* interface used with the Streams DLPI driver. */ + /* Arguments passed to DlpiAddNI are: */ + /* 1. NI interface number (should correspond to the pNA+ */ + /* interface number if driver is shared with pNA+) */ + /* 2. NI entry point */ + /* 3. NI flags */ + /* DLPI_IFF_SELFLOOP 0x0001 loopback for selfaddress */ + /* DLPI_IFF_POLL_NI 0x0002 driver must be polled */ + /* DLPI_IFF_RAWMEM 0x2000 driver accepts mblk */ + /* DLPI_IFF_NONIINIT 0x4000 Don't send NI_INIT */ + /* during enetinit() call */ + /* 4. NI major device number */ + /* 5. NI multicast address (NOT SUPPORTED) */ + /* 6. NI poll frequency (every # of elapsed ticks) */ + /*-------------------------------------------------------------*/ + +#if (SC_DEV_DLPI) + /* + * If this lan NI is not shared, use a loopback DLPI with interface + * number 0. NI entry point is set to DlpiNullNI(). + */ +#if (SE_SHARE_NI) + if (DlpiAddNI(SE_DLPI_ETH_IFNO, (long(*)())BSP_LAN1_ENTRY, + SE_DLPI_ETH_IFFLAGS, SC_DEV_DLPI, 0, SE_DLPI_ETH_POLLFREQ)) + SysInitFail(DlpiErrMsg); +#else + if (DlpiAddNI(0, (long(*)())DlpiNullNI, 0, SC_DEV_DLPI, 0, 0)) + SysInitFail(DlpiErrMsg); +#endif /* SE_SHARE_NI */ + +#endif /* SC_DEV_DLPI */ + +#if (SC_DEV_DLPI_PPP) + if (DlpiAddNI(SE_DLPI_PPP_IFNO, SE_DLPI_PPP_ENTRY, SE_DLPI_PPP_IFFLAGS, + SC_DEV_DLPI_PPP, 0, SE_DLPI_PPP_POLLFREQ)) + SysInitFail(DlpiErrMsg); + if (DlpiAddParams(SE_DLPI_PPP_IFNO, SE_DLPI_PPP_ADDRSIZE, + SE_DLPI_PPP_MAXMTU, SE_DLPI_PPP_MINMTU, (char *)NULL)) + SysInitFail(DlpiErrMsg); +#endif /* SC_DEV_DLPI_PPP */ + +#if (SC_DEV_DLPI_SLIP) + if (DlpiAddNI(SE_DLPI_SLIP_IFNO,SE_DLPI_SLIP_ENTRY, SE_DLPI_SLIP_IFFLAGS, + SC_DEV_DLPI_SLIP, 0, SE_DLPI_SLIP_POLLFREQ)) + SysInitFail(DlpiErrMsg); + if (DlpiAddParams(SE_DLPI_SLIP_IFNO, SE_DLPI_SLIP_ADDRSIZE, + SE_DLPI_SLIP_MAXMTU, SE_DLPI_SLIP_MINMTU, (char *)NULL)) + SysInitFail(DlpiErrMsg); +#endif /* SC_DEV_DLPI_SLIP */ + +/* + * User has defined other DLPI drivers locally. Include user + * file drv_conf.adl that adds user Dlpi drivers to the system. + */ +#if SC_DEV_DLPI_OTHER +#include "drv_conf.adl" +#endif + + } +#endif /* (SC_DEV_DLPI || SC_DEV_PPP || SC_DEV_SLIP) */ + +#if (SC_DEV_LOG) + { + extern void loginit(); + extern struct streamtab loginfo; + static const psedrvparam_t log_drv = {"log", DT_CLONE, &loginfo, 0, 0}; + + InstallDriver(SC_DEV_LOG, loginit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&log_drv, 0, 0); + PsosNumDntEnts++; + } +#endif + +/*-------------------------------------------------------------------*/ +/* Install pSOSystem Watchdog driver */ +/*-------------------------------------------------------------------*/ +#if (SC_DEV_WATCHDOG) + #if(SC_DEV_WATCHDOG > SC_DEVMAX) + #error "SC_DEV_WATCHDOG cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_WATCHDOG, WdtInit, NULLF, NULLF, NULLF, + NULLF, NULLF, 0, 0, 0); + PsosNumDntEnts++; +#endif + +#if (SC_DEV_OTCP) + { +extern void otcp_ipspace_init(), otcp_arpspace_init(), otcp_rawspace_init(), + otcp_udpspace_init(), otcp_tcpspace_init(), otcp_loopspace_init(); +extern struct streamtab otcp_ipinfo, otcp_arpinfo, otcp_rawinfo, otcp_udpinfo, + otcp_tcpinfo, otcp_loopinfo; + +#if (SC_IP) + static const psedrvparam_t ip_drv = {"ip", DT_CLONE, &otcp_ipinfo, 0, 0}; +#endif +#if (SC_ARP) + static const psedrvparam_t arp_drv = {"arp", DT_CLONE, &otcp_arpinfo, 0, 0}; +#endif +#if (SC_TCP) + static const psedrvparam_t tcp_drv = {"tcp", DT_CLONE, &otcp_tcpinfo, 0, 0}; +#endif +#if (SC_UDP) + static const psedrvparam_t udp_drv = {"udp", DT_CLONE, &otcp_udpinfo, 0, 0}; +#endif +#if (SC_RAW) + static const psedrvparam_t raw_drv = {"raw", DT_CLONE, &otcp_rawinfo, 0, 0}; +#endif +#if (SC_LOOP) + static const psedrvparam_t loop_drv = {"loop", DT_CLONE, &otcp_loopinfo, 0, 0}; +#endif + +#if (SC_IP) + InstallDriver(SC_IP, otcp_ipspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&ip_drv, 0, 0); + PsosNumDntEnts++; +#endif +#if (SC_ARP) + InstallDriver(SC_ARP, otcp_arpspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&arp_drv, 0, 0); + PsosNumDntEnts++; +#endif +#if (SC_RAW) + InstallDriver(SC_RAW, otcp_rawspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&raw_drv, 0, 0); + PsosNumDntEnts++; +#endif +#if (SC_UDP) + InstallDriver(SC_UDP, otcp_udpspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&udp_drv, 0, 0); + PsosNumDntEnts++; +#endif +#if (SC_TCP) + InstallDriver(SC_TCP, otcp_tcpspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&tcp_drv, 0, 0); + PsosNumDntEnts++; +#endif +#if (SC_LOOP) + InstallDriver(SC_LOOP, otcp_loopspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&loop_drv, 0, 0); + PsosNumDntEnts++; +#endif + + } +#endif /* (SC_DEV_OTCP) */ + +#if (SC_DEV_OLAP) + { + extern struct streamtab phpiinfo, twfrinfo ; + extern void phpiinit(), twfrinit(); +#if (SC_PHPI) + static const psedrvparam_t phpiparam={"phpi",DT_CLONE,&phpiinfo, 0, 0}; +#endif +#if (SC_LAPB) + static const psedrvparam_t lapbparam ={"lapb", DT_REGULAR,&twfrinfo,0, 0}; +#endif + +#if (SC_PHPI) + InstallDriver(SC_PHPI, phpiinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&phpiparam, 0, 0); + PsosNumDntEnts++; +#endif +#if (SC_LAPB) + InstallDriver(SC_LAPB, twfrinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&lapbparam, 0, 0); + PsosNumDntEnts++; +#endif + } +#endif + +#if (SC_DEV_OX25) + { + extern struct streamtab phpiinfo, twfrinfo, twpkinfo, twsninfo, ipconvinfo; + extern void twpkinit(), twsninit(), tcpsninit(); +#if (SC_X25) + static const psedrvparam_t x25param ={"x25", DT_DRIVER, &twpkinfo, 0, 0}; +#endif +#if (SC_SNDCF) + static const psedrvparam_t sndfparam ={"sndf", DT_REGULAR, &twsninfo, 0, 0}; +#endif +#if (SC_IPCONV) + static const psedrvparam_t ipconvparam={"ipsn",DT_REGULAR, &ipconvinfo, 0, 0}; +#endif + +#if (SC_X25) + InstallDriver(SC_X25, twpkinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&x25param, 0, 0); + PsosNumDntEnts++; +#endif +#if (SC_SNDCF) + InstallDriver(SC_SNDCF, twsninit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&sndfparam, 0, 0); + PsosNumDntEnts++; +#endif +#if (SC_IPCONV) + InstallDriver(SC_IPCONV, tcpsninit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&ipconvparam, 0, 0); + PsosNumDntEnts++; +#endif + } +#endif + +#if (SC_DEV_ISDN) + { + extern struct streamtab phinfo, q921info, ipcdinfo ; + extern void q921init(), phinit(); + +#if (SC_PH) + static const psedrvparam_t phpiparam={"ph",DT_REGULAR,&phinfo, 0, 0}; +#endif +#if (SC_LAPD) + static const psedrvparam_t lapbparam={"q921",DT_REGULAR,&q921info,0,0}; +#endif +#if (SC_IPCD) + static const psedrvparam_t ipcdparam={"ipcd",DT_REGULAR,&ipcdinfo,0,0}; +#endif + +#if (SC_PH) + InstallDriver(SC_PH, phinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&phpiparam, 0, 0); + PsosNumDntEnts++; +#endif +#if (SC_LAPD) + InstallDriver(SC_LAPD, q921init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&lapbparam, 0, 0); + PsosNumDntEnts++; +#endif +#if (SC_IPCD) + InstallDriver(SC_IPCD, NULLF, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&ipcdparam, 0, 0); + PsosNumDntEnts++; +#endif + } +#endif + +#if (SC_DEV_MLPP) + { + extern struct streamtab frmuxtab, pppstream, Spimtab; + extern void frmuxinit(); + +#if (SC_FRMUX) + static const psedrvparam_t fmuxparam ={"cfmux",DT_REGULAR,&frmuxtab,0,0}; +#endif +#if (SC_PPP) + static const psedrvparam_t pppparam ={"cppp",DT_REGULAR,&pppstream,0,0}; +#endif +#if (SC_PIM) + static const psedrvparam_t pimparam ={"cpim",DT_REGULAR,&Spimtab,0,0}; +#endif + +#if (SC_FRMUX) + InstallDriver(SC_FRMUX, frmuxinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&fmuxparam, 0, 0); +#endif +#if (SC_PPP) + InstallDriver(SC_PPP, NULLF, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&pppparam, 0, 0); +#endif +#if (SC_PIM) + InstallDriver(SC_PIM, NULLF, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&pimparam, 0, 0); +#endif + } +#endif + +#if defined(SC_DEV_PSMUX) && SC_DEV_PSMUX +#include "drv_conf.app" +#endif + +/*---------------------------------------------------------------------*/ +/* Additional drivers may be installed here. */ +/*---------------------------------------------------------------------*/ + +return FreeMemPtr; +} + +/***********************************************************************/ +/* DrvSysStartCO : This is called from sysinit.c "SysStartCO". */ +/* */ +/* INPUTS: None */ +/* */ +/* RETURNS: None */ +/* OUTPUTS: None */ +/* NOTE(S): Currently used to set-up the Initial Device Name Table */ +/* Additional code can be added here to clean-up the */ +/* driver specific data area. */ +/* */ +/***********************************************************************/ +void DrvSysStartCO() +{ + long i, j; + char namebuf[KC_DNLEN+1]; + +/*---------------------------------------------------------------------*/ +/* Following are the call-outs which will be called. If your driver */ +/* needs pSOS+ "GS" (Warm Startup) notification to clear your driver */ +/* data structures, register here, so that it will be called. */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SERIAL && BSP_SERIAL) + DevSerialCO(); +#endif + +/*---------------------------------------------------------------------*/ +/* Default DEV_SERIAL is passed as the DEFAULT CONSOLE for Re-Direction*/ +/*---------------------------------------------------------------------*/ +#if SC_DEV_PSCONSOLE + PsConsoleSysStartCo(DEV_SERIAL); +#endif + +#if SC_DEV_SCSI && BSP_SCSI + DevScsiCO(); +#endif + +#if SC_DEV_SCSI_TAPE && BSP_SCSI_TAPE + DevScsiCO(); +#endif + +#if SC_DEV_IDE && BSP_IDE + DevIdeCO(); +#endif + +#if SC_DEV_PARALLEL + DevParallelCO(); +#endif + +#if SC_DEV_FLOPPY && BSP_FLOPPY + DevFloppyCO(); +#endif + +#if SC_DEV_TFTP + DevTftpCO(); +#endif + +#if SC_DEV_PSEUDO + DevPseudoCO(); +#endif + +/*---------------------------------------------------------------------*/ +/* This code is used to build the initial table of device names used */ +/* in the pSOSystem. */ +/*---------------------------------------------------------------------*/ +#if SC_INIT_DNTABLE + /*-----------------------------------------------------------------*/ + /* Make one name for the entrie pSOSystem Serial channels. */ + /*-----------------------------------------------------------------*/ + #if (SC_DEV_SERIAL && BSP_SERIAL) + dnt_add("tty", DEV_SERIAL); + #endif /* SC_DEV_SERIAL */ + + /*-----------------------------------------------------------------*/ + /* Null Driver. */ + /*-----------------------------------------------------------------*/ + #if SC_DEV_NULL + dnt_add("null", DEV_NULL); + #endif + + /*-----------------------------------------------------------------*/ + /* There is only one timer in the system. Make a name for it. */ + /*-----------------------------------------------------------------*/ + #if SC_DEV_TIMER + dnt_add("timer", DEV_TIMER + 0); + #endif /* SC_DEV_TIMER */ + + /*-----------------------------------------------------------------*/ + /* Add DNT entries for all pSEUDO console minor devices */ + /*-----------------------------------------------------------------*/ + #if SC_DEV_PSCONSOLE + dnt_add("psconsole", DEV_PSCONSOLE + SYSCONSOLE); + dnt_add("stdin", DEV_PSCONSOLE + STDIN_DEV); + dnt_add("stdout", DEV_PSCONSOLE + STDOUT_DEV); + dnt_add("stderr", DEV_PSCONSOLE + STDERR_DEV); + #endif + + /*-----------------------------------------------------------------*/ + /* There is only one ramdisk in the system. Make a name for it. */ + /*-----------------------------------------------------------------*/ + #if SC_DEV_RAMDISK + dnt_add("ramdisk", DEV_RAMDISK + 0); + #endif /* SC_DEV_RAMDISK */ + + /*-----------------------------------------------------------------*/ + /* Make the default names for the SCSI disks supported by */ + /* pSOSystem. The names are specified as rsdXYZZ, where X is a */ + /* single hex digit specifying the SCSI bus number (currently */ + /* pSOSystem only supports one SCSI bus) 0-f, Y is a single hex */ + /* digit specifying the drive number on a given SCSI bus 0-f, and */ + /* ZZ is two hex digits specifying the partion number 00-ff. A */ + /* partition number of zero specifies an unpartition drive. All */ + /* the hex digits are lower case. */ + /*-----------------------------------------------------------------*/ + #if SC_DEV_SCSI && BSP_SCSI + for (i=0; i<8; i++) + for (j=0; j<5; j++) + { + GenerateString(namebuf, "rsd%x%x%.2x", 0, i, j); + dnt_add(namebuf, DEV_SCSI + ((j << 8) + i)); + } + #endif /* SC_DEV_SCSI && BSP_SCSI */ + + /*-----------------------------------------------------------------*/ + /* Make the default names for the SCSI tape drives supported by */ + /* pSOSystem. The names are specified as rstXY, where X is a */ + /* single hex digit specifying the SCSI bus number (currently */ + /* pSOSystem only supports one SCSI bus) 0-f, Y is a single hex */ + /* digit specifying the drive number on a given SCSI bus 0-f. */ + /*-----------------------------------------------------------------*/ + #if SC_DEV_SCSI_TAPE && BSP_SCSI_TAPE + for (i=0; i<8; i++) + { + GenerateString(namebuf, "rst%x%x", 0, i); + dnt_add(namebuf, DEV_SCSI_TAPE + i); + } + #endif /* SC_DEV_SCSI_TAPE && BSP_SCSI_TAPE */ + + /*-----------------------------------------------------------------*/ + /* Make the default names for the IDE disks supported by */ + /* pSOSystem. The names are specified as ideYZZ, where Y is a */ + /* single hex digit specifying the drive number on the IDE bus */ + /* 0-f, and ZZ is two hex digits specifying the partion number */ + /* 00-ff. A partition number of zero specifies an unpartition */ + /* drive. All the hex digits are lower case. */ + /*-----------------------------------------------------------------*/ + #if SC_DEV_IDE && BSP_IDE + for (i=0; i<2; i++) + for (j=0; j<5; j++) + { + GenerateString(namebuf, "ide%x%.2x", i, j); + dnt_add(namebuf, DEV_IDE + ((j << 8) + i)); + } + #endif /* SC_DEV_IDE && BSP_IDE */ + + /*-----------------------------------------------------------------*/ + /* There is only one parallel driver in the system. Make a name */ + /* for it. */ + /*-----------------------------------------------------------------*/ + #if SC_DEV_PARALLEL + dnt_add("printer", DEV_PARALLEL); + #endif /* SC_DEV_PARALLEL */ + + /*-----------------------------------------------------------------*/ + /* Add the names for the first and second floppy drives in the */ + /* system. */ + /*-----------------------------------------------------------------*/ + #if SC_DEV_FLOPPY && BSP_FLOPPY + dnt_add("rfd0", DEV_FLOPPY); + dnt_add("rfd1", (DEV_FLOPPY) | 1); + #endif /* SC_DEV_FLOPPY */ + + /*-----------------------------------------------------------------*/ + /* There is only one watchdog driver in the system. Make a name */ + /* for it. */ + /*-----------------------------------------------------------------*/ + #if SC_DEV_WATCHDOG + dnt_add("watchdog", DEV_WATCHDOG); + #endif /* SC_DEV_WATCHDOG */ + + /*-----------------------------------------------------------------*/ + /* There is only one cmos driver in the system. Make a name for it.*/ + /*-----------------------------------------------------------------*/ + #if SC_DEV_CMOS + dnt_add("cmos", DEV_CMOS); + #endif /* SC_DEV_CMOS */ + + /*-----------------------------------------------------------------*/ + /* Make default names for the TFTP pseudo device. Add names for */ + /* the eight channels supported by default. If the number of */ + /* channels supported is changed, add or subtract names as needed. */ + /*-----------------------------------------------------------------*/ + #if SC_DEV_TFTP + for (i=0; ix . <1-8> means a single digit in the range */ +/* 1 through 8. Also unlike a real sprintf the number of */ +/* digits output is exactlyspecified by ., not the */ +/* minimum number. For example: */ +/* GenerateString(MyDest, "%.1x", 0x1234); */ +/* will only place the single digit '4' into the */ +/* destination string (and the null terminator). %x is */ +/* the same as %.1x . */ +/* */ +/* The result of specifying a '%' without a valid */ +/* conversion type following it is unspecified. */ +/* */ +/***********************************************************************/ +static long GenerateString(char *dest, char *format, ...) +{ +register ULONG value, position; +register char ch; +va_list ap; +const char NibbleToHex[17] = "0123456789abcdef"; + +va_start(ap, format); +while ((ch = *format++) != NULL) + { + if (ch != '%') + { + /*-------------------------------------------------------------*/ + /* If the current character isn't a '%' just copy it. */ + /*-------------------------------------------------------------*/ + *dest++ = ch; + } + else + { + /*-------------------------------------------------------------*/ + /* The current character is a '%'. See if it is one of the */ + /* supported formatting options. */ + /*-------------------------------------------------------------*/ + switch (ch = *format++) + { + case 'x': + /*-----------------------------------------------------*/ + /* Output a single nibble. */ + /*-----------------------------------------------------*/ + value = va_arg(ap, ULONG); + *dest++ = NibbleToHex[value & 0xf]; + break; + + case '.': + /*-----------------------------------------------------*/ + /* Have %. so far. See if the next characters are a */ + /* digit (1 through 8) and an 'x'. */ + /*-----------------------------------------------------*/ + if ((ch = *format) == 0) + break; + + position = ch - '0'; + ch = *(++format); + + if ((position < 1) || (position > 8) || + (ch == 0) || (ch != 'x')) + break; + + /*-----------------------------------------------------*/ + /* Output the requested number of nibbles, from most */ + /* to least significant. */ + /*-----------------------------------------------------*/ + value = va_arg(ap, ULONG); + while (position-- > 0) + *dest++ = NibbleToHex[(value>>(position<<2)) & 0xf]; + + format++; + break; + + default: + if (ch != 0) + *dest++ = ch; + else + format--; + break; + } + } + } +*dest = 0; +va_end(ap); +} +#endif /* SC_INIT_DNTABLE */ + diff --git a/h/wrn/wm/util/port/isisnmp/mcf250/sys_conf.h b/h/wrn/wm/util/port/isisnmp/mcf250/sys_conf.h new file mode 100644 index 0000000..c2e5c19 --- /dev/null +++ b/h/wrn/wm/util/port/isisnmp/mcf250/sys_conf.h @@ -0,0 +1,979 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/isisnmp/mcf250/sys_conf.h,v 1.1.1.1 2001/11/05 17:47:10 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: sys_conf.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:10 tneale + * Tornado shuffle + * + * Revision 1.1 2000/02/24 16:05:56 josh + * configuration files for pSOS for ColdFire + * + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + +/* @(#) pSOSystem PowerPC/V2.5.0-BETA1: apps.v22/xxxx/sys_conf.h (snmpsa ppc) 3.72 98/06/05 11:02:22 */ +/***********************************************************************/ +/* */ +/* MODULE: sys_conf.h */ +/* DATE: 98/06/05 */ +/* PURPOSE: pSOSystem configuration definitions */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* Copyright 1991 - 1997, Integrated Systems, Inc. */ +/* ALL RIGHTS RESERVED */ +/* */ +/* Permission is hereby granted to licensees of Integrated Systems, */ +/* Inc. products to use or abstract this computer program for the */ +/* sole purpose of implementing a product based on Integrated */ +/* Systems, Inc. products. No other rights to reproduce, use, */ +/* or disseminate this computer program, whether in part or in */ +/* whole, are granted. */ +/* */ +/* Integrated Systems, Inc. makes no representation or warranties */ +/* with respect to the performance of this computer program, and */ +/* specifically disclaims any responsibility for any damages, */ +/* special or consequential, connected with the use of this program. */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* This is a header file which defines all of the system-level */ +/* parameters that are likely to need changing. */ +/* */ +/* It has been set up to be as close as possible to the settings */ +/* which are appropriate for this application. However, you may */ +/* need to make some changes to parameters to reflect your */ +/* environment, such as IP addresses, etc. */ +/* */ +/* Chapter 7 of the pSOSystem Getting Started manual contains a */ +/* complete description of the symbols that are defined in this */ +/* file. */ +/* */ +/***********************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _SYS_CONF_H +#define _SYS_CONF_H + +/***********************************************************************/ +/* */ +/* SC_APP_PARMS Must be defined before you include sysvars.h file. */ +/* Since "sysvars.h" file depends on SC_APP_PARMS and BSP_PARMS */ +/* to define the Storage Parms Structure. */ +/* */ +/* Defining this variable to a Non-Zero Value will create a space in */ +/* the Storage Parms. structure for your application use. */ +/* */ +/***********************************************************************/ +#define SC_APP_PARMS 0 +#define SC_APP_NAME "snmpsa Application" + +/*---------------------------------------------------------------------*/ +/* types.h contains common definitions for example YES and NO */ +/*---------------------------------------------------------------------*/ +#include + +/***********************************************************************/ +/* sysvars.h contains the structures and definitions for the system */ +/* variables that are stored in NVRAM. These structures and */ +/* definitions are also used when creating the boot rom for the */ +/* target system. By using the same sysvars.h file it will insure the */ +/* consistency of the values stored by the boot rom and later read by */ +/* the downloaded application. */ +/***********************************************************************/ +#include + +/*---------------------------------------------------------------------*/ +/* include psos.h for defines IO_AUTOINIT and IO_NOAUTOINIT */ +/*---------------------------------------------------------------------*/ +#include + +/***********************************************************************/ +/* */ +/* These symbols are used to define other symbols in this file. */ +/* They should never be changed. */ +/* */ +/***********************************************************************/ +#define USE_RARP 0 + + +/***********************************************************************/ +/* */ +/* B A S I C P A R A M E T E R S */ +/* */ +/* The parameters in this section determine the fashion in which */ +/* many of the other parameters in this file will be used. */ +/* */ +/* Many of the parameters in this file have names beginning with */ +/* either "SC_" or "SD_". Those beginning with "SC_" are ALWAYS */ +/* controlled by the values you set in this file. The values of */ +/* the "SD_" parameters can be determined either by the definitions */ +/* given in this file, or by the data found in the target board's */ +/* parameter storage area. SC_SD_PARAMETERS determines this. If */ +/* SC_SD_PARAMETERS is "SYS_CONF", then the values given in this */ +/* file will be used for the SD_ parameters. If SC_SD_PARAMETERS */ +/* is "STORAGE", then pSOSystem will attempt to use the values found */ +/* in the board's parameter storage area for the SD_ variables. If */ +/* the parameter storage area has not been initialized or has been */ +/* corrupted, then the values given in this file will be used. They */ +/* will also be written to the storage area. */ +/* */ +/* If SC_SD_PARAMETERS is STORAGE, you may enable a "startup dialog" */ +/* which will allow you to view, and optionally change, the */ +/* parameter values found in the storage area. The dialog is enabled */ +/* by setting SC_STARTUP_DIALOG to YES. In this case, */ +/* SD_STARTUP_DELAY specifies the number of seconds that the dialog */ +/* will wait for input before proceeding to boot the system. */ +/* */ +/* SC_SD_DEBUG_MODE determines how the system will operate, as follows:*/ +/* */ +/* DBG_SA: Boot pROBE+ in standalone mode. */ +/* */ +/* DBG_XS: Boot into pROBE+ and wait for the host debugger */ +/* via a serial connection */ +/* */ +/* DBG_XN: Boot into pROBE+ and wait for the host debugger */ +/* via a network connection */ +/* */ +/* DBG_AP: Same as DBG_SA, but also does a pROBE+ "silent startup",*/ +/* meaning that pROBE+ initializes itself without */ +/* printing a startup banner. pROBE+ then initializes */ +/* pSOS+ and starts the application running. This mode */ +/* was created to simplify implementation of the pSOSystem */ +/* Boot ROMs. Note that when this mode is used, the value */ +/* you specify for RC_SMODE (see "pROBE+ Configuration */ +/* Parameters", below) is overridden. */ +/* */ +/* STORAGE: Use the mode (DBG_SA, DBG_XS, or DBG_XN) found in the */ +/* parameter storage area. If a valid mode is not found, */ +/* then use DBG_SA. */ +/* */ +/* An important consequence of using SC_SD_DEBUG_MODE=STORAGE should */ +/* be noted. If you use the TFTP bootloader in the pSOSystem ROMs */ +/* to download and start your system, you will be setting */ +/* SC_SD_DEBUG_MODE = DBG_AP in your target board's parameter storage */ +/* area. Thus, if you have left SC_SD_DEBUG_MODE set to STORAGE in */ +/* this file, your downloaded system will also use DBG_AP, meaning */ +/* that the application will begin running immediately after the */ +/* TFTP bootloader has loaded and started your system. */ +/* */ +/***********************************************************************/ +#define SC_SD_PARAMETERS STORAGE +#define SC_STARTUP_DIALOG NO +#define SC_BOOT_ROM NO +#define SD_STARTUP_DELAY 60 +#define SC_SD_DEBUG_MODE STORAGE + +/***********************************************************************/ +/* */ +/* O P E R A T I N G S Y S T E M C O M P O N E N T S */ +/* */ +/* Setting the definition line to YES will cause that component to */ +/* be built into the system. NO means the component will NOT be */ +/* put into the system. It is an error to specify both SC_PSOS */ +/* and SC_PSOSM as present! */ +/* */ +/***********************************************************************/ +#define SC_PSOS YES /* pSOS+ real-time kernel */ +#define SC_PSOSM NO /* pSOS+ real-time multiproc kernel */ +#define SC_PSOS_QUERY NO /* pSOS+ Query Services */ +#define SC_PROBE NO /* pROBE+ (processor svcs) */ +#define SC_PROBE_DISASM NO /* pROBE+ (disassembler) */ +#define SC_PROBE_CIE NO /* pROBE+ (console executive) */ +#define SC_PROBE_QUERY NO /* pROBE+ (query services) */ +#define SC_PROBE_DEBUG NO /* pROBE+ (debug interface executive) */ +#define SC_PROBE_HELP NO /* pROBE+ Help command Handler. */ +#define SC_PHILE YES /* pHILE+ file system manager */ +#define SC_PHILE_PHILE YES /* pHILE+ (pHILE+ real-time file sys) */ +#define SC_PHILE_MSDOS NO /* pHILE+ (MS-DOS FAT file system) */ +#define SC_PHILE_NFS NO /* pHILE+ (NFS client) */ +#define SC_PHILE_CDROM NO /* pHILE+ (ISO 9660 CD-ROM file sys) */ +#define SC_PREPC YES /* pREPC+ C run-time library */ +#define SC_PNA YES /* pNA+ TCP/IP networking manager */ +#define SC_PNET NO /* pNET Library for BOOT ROMS */ +#define SC_PRPC NO /* pRPC+ RPC component */ +#define SC_PSE_PRPC NO /* pRPC+ RPC component Over pSE+ */ +#define SC_PSE NO /* pSE+ streams component */ +#define SC_PSKT NO /* pSKT+ SKT library component */ +#define SC_PTLI NO /* pTLI+ TLI library component */ +#define SC_PMONT NO /* pMONT+ */ +#define SC_PLM NO /* pLM+ Shared library manager */ +#define SC_PROFILER NO /* Profiler is enabled/Disabled */ +#define SC_RTEC NO /* Diab's Run time error checker */ + +/*---------------------------------------------------------------------*/ +/* If SC_QBIND is set to YES then the Quick bindings for pSOS+ System */ +/* calls will be used. If it is set to NO then the normal bindings */ +/* will be used. */ +/* */ +/* Quick bindings will not be supported for the applications with */ +/* USER mode Tasks. So make sure your Application does not have any */ +/* USER mode Tasks. */ +/*---------------------------------------------------------------------*/ +#define SC_QBIND NO /* Quick bindings for pSOSystem calls*/ + +/*---------------------------------------------------------------------*/ +/* If set to IO_AUTOINIT device drivers that are installed be the */ +/* InstallDriver function will have their autoinit field set. This */ +/* will cause pSOS+ call the drivers initialization function when */ +/* pSOS+ starts up. The de_init call will not have to be called for */ +/* each driver if this is done. */ +/* */ +/* NOTE: This Auto Initialization will not work on all drivers. */ +/* Setting IO_AUTOINIT only effects drivers that can use the Auto */ +/* Initialization feature. */ +/* */ +/* If set to IO_NOAUTOINIT no automatic driver initialization will */ +/* happen. */ +/*---------------------------------------------------------------------*/ +#define SC_AUTOINIT IO_AUTOINIT + +/*---------------------------------------------------------------------*/ +/* If SC_PMONT SC_AUTOINIT will always be set to 1 because pMONT needs */ +/* drivers to be automatically initialized. */ +/*---------------------------------------------------------------------*/ +#if SC_PMONT + #undef SC_AUTOINIT + #define SC_AUTOINIT IO_AUTOINIT +#endif + +/*---------------------------------------------------------------------*/ +/* If set to YES, an initial devices name table is set-up to contain */ +/* Deivce names for all the Drivers configured in the system. */ +/* */ +/* NOTE: Any initial device name table enteries are in addition to the */ +/* KC_MAXDNTENT value specified below in pSOS+ configuration params. */ +/*---------------------------------------------------------------------*/ +#define SC_INIT_DNTABLE YES + +/***********************************************************************/ +/* */ +/* S E R I A L C H A N N E L C O N F I G U R A T I O N */ +/* */ +/* * SD_DEF_BAUD specifies the default baud rate to be used for the */ +/* serial channels */ +/* * SC_APP_CONSOLE specifies the serial channel number (starting */ +/* from 1) which should be used for the application's "console". */ +/* * SC_PROBE_CONSOLE specifies the serial channel number (starting */ +/* from 1) which pROBE+ should use to display output and receive */ +/* commands, or to communicate with the host debugger. */ +/* * SC_RBUG_PORT specifies the serial channel number (starting */ +/* from 1) which should be used for the pROBE+ REMOTE channel. */ +/* This is not normally required, so it can be disabled by */ +/* using a value of 0. */ +/* */ +/* Above three macros SC_PROBE_CONSOLE, SC_APP_CONSOLE and */ +/* SC_RBUG_PORT uses SERIAL_DRVRNUM(0) as default. This means that */ +/* the Low-Level Serial Driver 0 (1) is being used default. */ +/* */ +/* If you need to use another driver for any of the above macros */ +/* and another macro for pMONT PM_DEV, You need to change "0" to */ +/* the driver number you want. Consult the "README" file in BSP */ +/* directory for number of different drivers supported and for the */ +/* SERIAL_DRVRNUM mapping for those drivers. */ +/* */ +/***********************************************************************/ +#define SD_DEF_BAUD 9600 +#define SC_APP_CONSOLE (1 + SERIAL_DRVRNUM(0)) +#define SC_PROBE_CONSOLE (1 + SERIAL_DRVRNUM(0)) +#define SC_RBUG_PORT (0 + SERIAL_DRVRNUM(0)) + +/***********************************************************************/ +/* SC_NumNon_pSOSChan is the number of non pSOS users of serial */ +/* channels. These are users that will be initiated before pSOS */ +/* such as pROBE. */ +/* NOTE: These channels will not be closed on a soft reset. */ +/***********************************************************************/ +#if (SC_RBUG_PORT && SC_PROBE_CONSOLE && (SC_PROBE_CONSOLE != PCCON)) +#define SC_NumNon_pSOSChan 2 +#else +#define SC_NumNon_pSOSChan 1 +#endif + +/***********************************************************************/ +/* */ +/* L A N C O N F I G U R A T I O N */ +/* */ +/* */ +/***********************************************************************/ +#define SD_LAN1 YES /* Disable the LAN interface */ +#define SD_LAN1_IP 0x80E0C1A3 /* (REC) IP address of the node */ +#define SD_LAN1_SUBNET_MASK 0xFFFFFF00 + +/*---------------------------------------------------------------------*/ +/* Maximum number of multicast addresses to be used by the lan */ +/* interface. Must not exceed maximum supported by the lan driver. */ +/*---------------------------------------------------------------------*/ +#define SC_LAN1_NMCAST 0 + +/***********************************************************************/ +/* */ +/* S H A R E D M E M O R Y C O N F I G U R A T I O N */ +/* */ +/* */ +/***********************************************************************/ + +/***********************************************************************/ +/* */ +/* B U S C O N F I G U R A T I O N */ +/* */ +/* */ +/***********************************************************************/ +#define SD_VME_BASE_ADDR 0x01000000 + +/*---------------------------------------------------------------------*/ +/* If you want to build a Shared Memory Interface for the network or */ +/* multi-processing pSOS+m, set SD_SM_NODE (a non-zero value) to the */ +/* node number of THIS node. */ +/*---------------------------------------------------------------------*/ +#define SD_SM_NODE 0 + +/*---------------------------------------------------------------------*/ +/* Shared memory network interface - SC_NISM_LEVEL should be 1 if this */ +/* will be the FIRST system to use the SMNI on this board. It should */ +/* be 2 if this will not be the first system to use the SMNI on this */ +/* board. Usually this means that SC_NISM_LEVEL should be 1 if you */ +/* are building Boot ROMs, and 2 for a system that will be downloaded */ +/* and started using the Boot ROMs. See the comments at the beginning */ +/* of drivers/ni_smem.c for more explanation. */ +/*---------------------------------------------------------------------*/ +#define SD_NISM NO +#define SD_NISM_IP 0x00000000 +#define SD_NISM_DIRADDR 0x00000400 +#define SC_NISM_BUFFS 30 +#define SC_NISM_LEVEL 2 +#define SD_NISM_SUBNET_MASK 0x00000000 + + +/*---------------------------------------------------------------------*/ +/* If you want to build a multi-node pSOS+m system, set SD_KISM */ +/* to the number of nodes in the system. */ +/*---------------------------------------------------------------------*/ +#define SD_KISM 0 +#define SD_KISM_DIRADDR 0x00000580 +#define SC_KISM_BUFFS 100 + + +/***********************************************************************/ +/* */ +/* M I S C E L L A N E O U S N E T W O R K I N G */ +/* P A R A M E T E R S */ +/* */ +/***********************************************************************/ +#define SD_DEF_GTWY_IP 0x80E0C105 + + +/***********************************************************************/ +/* SC_RAM_SIZE */ +/* */ +/* Normally, pSOSystem uses ALL of the memory remaining on a board for */ +/* dynamic allocation ("region 0"). You may override this by setting */ +/* SC_RAM_SIZE to a non-zero value. If you do, pSOSystem will not */ +/* touch any memory after address (BSP_RAM_BASE + SC_RAM_SIZE - 1). */ +/* */ +/* NOTE: This is useful when making a BOOT ROM and you want to ensure */ +/* that the ROM's RAM area does not overflow the space alloted for it. */ +/***********************************************************************/ +#define SC_RAM_SIZE 0 + +/***********************************************************************/ +/* */ +/* I / O D E V I C E S */ +/* */ +/* Each device may be included in the system by specifying a major */ +/* number for it, which determines its slot in the pSOS+ I/O switch */ +/* table. To leave a device driver out of the system, use NO for */ +/* the major number. */ +/* */ +/* Note the following: */ +/* * Major device 0 is reserved and cannot be used for any of these */ +/* devices. Setting a device number to 0 here is the same as NO. */ +/* * No device number may be higher than SC_DEVMAX (SC_DEVMAX may */ +/* be increased, if desired) */ +/* * The lines defining the symbols DEV_SERIAL, DEV_TIMER, etc, */ +/* should not be changed. These are for use by application */ +/* programs as the "device number" parameter on de_* calls. */ +/* */ +/***********************************************************************/ +#define SC_DEV_SERIAL 1 /* Serial driver */ +#define SC_DEV_TIMER 2 /* Periodic tick timer */ +#define SC_DEV_RAMDISK NO /* RAM disk */ +#define SC_DEV_CONSOLE NO /* PC-Console driver */ +#define SC_DEV_SCSI NO /* SCSI bus */ +#define SC_DEV_SCSI_TAPE NO /* SCSI bus, tape device */ +#define SC_DEV_IDE NO /* IDE Driver */ +#define SC_DEV_FLOPPY NO /* Floppy Driver */ +#define SC_DEV_TFTP NO /* TFTP pseudo driver */ +#define SC_DEV_SPI NO /* SPI driver */ +#define SC_DEV_DLPI NO /* DLPI pseudo driver */ +#define SC_DEV_OTCP NO /* 12 TCP/IP for OpEN */ +#define SC_IP SC_DEV_OTCP /* 12 IP */ +#define SC_ARP NO /* 13 ARP */ +#define SC_TCP NO /* 14 TCP */ +#define SC_UDP NO /* 15 UDP */ +#define SC_RAW NO /* 16 RAW */ +#define SC_LOOP NO /* 17 LOOP = (SC_DEV_OTCP + 5) */ +#define SC_DEV_SOSI NO /* 18 OSI for OpEN */ +#define SC_DEV_PSCONSOLE NO /* Pseudo Console driver */ +#define SC_DEV_NULL NO /* Null Device Driver */ +#define SC_DEV_PARALLEL NO /* Parallel Port Driver */ +#define SC_DEV_CMOS NO /* CMOS Driver */ +#define SC_DEV_WATCHDOG NO /* Watchdog Driver */ +#define SC_DEV_OLAP NO /* LAP Drivers */ +#define SC_PHPI (SC_DEV_OLAP) /* Phpi driver */ +#define SC_LAPB (SC_DEV_OLAP + 0)/* LAPB driver Change 0 to 1 */ +#define SC_DEV_OX25 NO /* X25 Drivers */ +#define SC_X25 (SC_DEV_OX25) /* X.25 plp driver */ +#define SC_SNDCF NO /* sndcf driver */ +#define SC_IPCONV NO /* ip convergence driver */ +#define SC_DEV_ISDN NO /* ISDN Drivers */ +#define SC_PH (SC_DEV_ISDN) /* PH driver */ +#define SC_LAPD (SC_DEV_ISDN + 0)/* LAPD driver Change 0 to 1 */ +#define SC_IPCD (SC_DEV_ISDN + 0)/* IPCD driver Change 0 to 2 */ +#define SC_DEV_MLPP NO /* MultiLink PPP Drivers */ +#define SC_FRMUX (SC_DEV_MLPP) /* FRMUX driver */ +#define SC_PPP (SC_DEV_MLPP + 0)/* PPP driver Change 0 to 1 */ +#define SC_PIM (SC_DEV_MLPP + 0)/* PIM driver Change 0 to 2 */ +#define SC_DEV_LOG NO +#define SC_DEV_PSMUX NO /* Sample Mux driver */ +#define SC_DEV_PSLWR NO /* Sample loopback driver */ +#define SC_DEV_SLLWR NO /* Sample loopback driver */ + +#define SC_DEVMAX 39 /* Maximum device number */ + +#define DEV_SERIAL (SC_DEV_SERIAL << 16) +#define DEV_PARALLEL (SC_DEV_PARALLEL << 16) +#define DEV_TIMER (SC_DEV_TIMER << 16) +#define DEV_RAMDISK (SC_DEV_RAMDISK << 16) +#define DEV_SCSI (SC_DEV_SCSI << 16) +#define DEV_SCSI_TAPE (SC_DEV_SCSI_TAPE << 16) +#define DEV_PSCONSOLE (SC_DEV_PSCONSOLE << 16) +#define DEV_NULL (SC_DEV_NULL << 16) +#define DEV_SYSCONSOLE ((SC_DEV_PSCONSOLE << 16) + SYSCONSOLE_DEV) +#define DEV_PSEUDO ((SC_DEV_PSCONSOLE << 16) + PSEUDO_DEV) +#define DEV_DLPI (SC_DEV_DLPI << 16) +#define DEV_TFTP (SC_DEV_TFTP << 16) +#define DEV_SPI (SC_DEV_SPI << 16) +#define DEV_WATCHDOG (SC_DEV_WATCHDOG << 16) +#define DEV_FLOPPY (SC_DEV_FLOPPY << 16) +#define DEV_IDE (SC_DEV_IDE << 16) +#define DEV_CMOS (SC_DEV_CMOS << 16) +#define DEV_CONSOLE (SC_DEV_CONSOLE << 16) +#define DEV_IP (SC_IP << 16) +#define DEV_ARP (SC_ARP << 16) +#define DEV_TCP (SC_TCP << 16) +#define DEV_UDP (SC_UDP << 16) +#define DEV_RAW (SC_RAW << 16) +#define DEV_LOOP (SC_LOOP << 16) +#define DEV_PHPI (SC_PHPI << 16) +#define DEV_LAPB (SC_LAPB << 16) +#define DEV_X25 (SC_X25 << 16) +#define DEV_SNDCF (SC_SNDCF << 16) +#define DEV_IPCONV (SC_IPCONV << 16) +#define DEV_PH (SC_PH << 16) +#define DEV_LAPD (SC_LAPD << 16) +#define DEV_IPCD (SC_IPCD << 16) +#define DEV_FRMUX (SC_FRMUX << 16) +#define DEV_PIM (SC_PIM << 16) +#define DEV_PPP (SC_PPP << 16) +#define DEV_LOG (SC_DEV_LOG << 16) +#define DEV_PSMUX (SC_DEV_PSMUX << 16) +#define DEV_PSLWR (SC_DEV_PSLWR << 16) +#define DEV_SLLWR (SC_DEV_SLLWR << 16) + +#if (BSP_CPUFAMILY == FAMILY_X86) && (SC_APP_CONSOLE == PCCON) + #define CONSOLE DEV_CONSOLE +#else + #define CONSOLE DEV_SERIAL +#endif + +/***********************************************************************/ +/* TFTP Configuration Parameters. */ +/***********************************************************************/ +#if DEV_TFTP +#define SC_MAX_TFTP_CHAN 1 +#endif + +/***********************************************************************/ +/* */ +/* M E M O R Y M A N A G E M E N T L I B R A R Y P A R A M S */ +/* */ +/***********************************************************************/ +#define SC_MMULIB NO + +/***********************************************************************/ +/* */ +/* C O M P O N E N T C O N F I G U R A T I O N P A R A M E T E R S */ +/* */ +/* These parameters should work as is for this application. You */ +/* may want to change some of them if you start customizing this */ +/* application. */ +/* */ +/***********************************************************************/ + +/*---------------------------------------------------------------------*/ +/* pSOS+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define KC_RN0USIZE 0x100 /* region 0 unit size */ +#define KC_NTASK 25 /* max number of tasks */ +#define KC_NQUEUE 10 /* max number of message queues */ +#define KC_NSEMA4 30 /* max number of semaphores */ +#define KC_NMSGBUF 256 /* max number of message buffers */ +#define KC_NTIMER 10 /* max number of timers */ +#define KC_NLOCOBJ 50 /* max number of local objects */ +#define KC_TICKS2SEC 100 /* clock tick interrupt frequency */ +#define KC_TICKS2SLICE 10 /* time slice quantum, in ticks */ +#define KC_SYSSTK 0x1000 /* pSOS+ system stack size (bytes) */ +#define KC_ROOTSSTK 0x2000 /* ROOT supervisor stack size */ +#define KC_ROOTUSTK 0 /* ROOT user stack size */ +#define KC_ROOTMODE (T_SUPV | T_ISR) /* ROOT initial mode */ +#define KC_ROOTPRI 230 /* ROOT task priority */ +#define KC_NMUTEX 0 /* Max number of Mutex's */ +#define KC_NCVAR 0 /* Max number of condition variables */ +#define KC_NTVAR 0 /* Max number of task variable */ +#define KC_NCOCB 1 /* Max number of callouts */ +#define KC_IDLESTK 0x1000 /* IDLE stack size */ +#define KC_MAXDNTENT 0 /* max number of device names in DNT */ +#define KC_DNLEN 10 /* max length of a device name in DNT */ +#define KC_NTSD 0 /* Max # of TSD entries */ +#define KC_MAXIO (SC_DEVMAX+1) /* Max # of devices in the system */ + + +/*---------------------------------------------------------------------*/ +/* The following are examples for modifying the following defines */ +/* */ +/* Using a pSOSystem routine as a fatal error handler */ +/* #define KC_FATAL ((void (*)()) SysInitFail) */ +/* */ +/* Using a user written routine as a fatal error handler */ +/* extern void MyHandler (void); */ +/* #define KC_FATAL ((void (*)()) MyHandler) */ +/* */ +/*---------------------------------------------------------------------*/ +#define KC_STARTCO 0 /* callout at task activation */ +#define KC_DELETECO 0 /* callout at task deletion */ +#define KC_SWITCHCO 0 /* callout at task switch */ + +#define KC_FATAL 0 /* fatal error handler address */ +#define KC_IDLECO 0 /* Idle Task Callout */ +#define KC_RTCINITCO 0 /* RTC INIT Callout */ + +/*---------------------------------------------------------------------*/ +/* pSOS+m configuration parameters */ +/*---------------------------------------------------------------------*/ +#define MC_NGLBOBJ 8 /* size of gbl obj table */ +#define MC_NAGENT 10 /* number of RPC agents in this node */ +#define MC_FLAGS SEQWRAP_ON /* operating mode flags */ + +/*---------------------------------------------------------------------*/ +/* The following are examples for modifying the following definition */ +/* */ +/* Using a pSOSystem routine as a roster change handler */ +/* #define MC_ROSTER ((void (*)()) SysInitFail) */ +/* */ +/* Using a user written routine as a roster change handler */ +/* extern void MyHandler (void); */ +/* #define MC_ROSTER ((void (*)()) MyHandler) */ +/* */ +/*---------------------------------------------------------------------*/ +#define MC_ROSTER 0 /* addr of user roster change callout */ +#define MC_KIMAXBUF 100 /* maximum KI packet buffer length */ +#define MC_ASYNCERR 0 /* asynchronous calls error callout */ + +/*---------------------------------------------------------------------*/ +/* pROBE configuration parameters - note that the SMODE flag bits are */ +/* irrelevant if SC_SD_DEBUG_MODE = DBG_AP. */ +/*---------------------------------------------------------------------*/ +#define TD_BRKOPC 0 /* Instruction break opcode */ +#define TD_ILEV (MAX_ILEV << 12) /* pROBE+ interrupt mask */ +#define TD_FLAGS (NODOTS_MASK | TD_ILEV | NOTUPD_MASK)/* flags */ +#define TD_DBGPRI 244 /* Debugger task priority */ + +/*---------------------------------------------------------------------*/ +/* The variable defined down should be set to the Starting address for */ +/* for pROBE+ DATA AREA. This is required by all the smaller boards. */ +/* NOTE: */ +/* Setting of this value should have atleast 0x4400 bytes Free */ +/* Space from that location. */ +/*---------------------------------------------------------------------*/ +#define TD_DATASTART 0x0 + +/*---------------------------------------------------------------------*/ +/* pHILE+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define FC_LOGBSIZE 9 /* Block size (base-2 exponent) */ +#define FC_NBUF 6 /* Number of cache buffers */ +#define FC_NMOUNT 3 /* Max # of mounted volumes */ +#define FC_NFCB 10 /* Max # of opened files per system */ +#define FC_NCFILE 2 /* Max # of opened files per task */ +#define FC_NDNLC 0 /* Max # of cached directory entries */ + +/*---------------------------------------------------------------------*/ +/* Set the value for FC_ERRCO. It will be called if there is an error */ +/* during IO operation on the Volume */ +/* */ +/* Sample call-out is defined below (fc_errco). */ +/*---------------------------------------------------------------------*/ +#if SC_PHILE +#include /* pHILE+ types definitions for FC_ERRCO */ + +extern ULONG +fc_errco(int direction, ULONG err_code, const struct buffer_header *buffer); + +#define FC_ERRCO 0 /* I/O error call-out */ +#endif /* SC_PHILE */ + +/*---------------------------------------------------------------------*/ +/* pLM+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#if SC_PLM +#include /* pLM+ type definitions */ + +#define LM_MAXREG 8 /* Max # of registered libraries */ +#define LM_DATA 0 /* pLM+ data area */ +#define LM_DATASIZE 0 /* pLM+ data area size */ + +/***********************************************************************/ +/* Setting the LM_DEFAULT_COUTS to YES will use the default Callout */ +/* mechanism provided by pSOSystem. Else */ +/* It needs to be defined by the User. */ +/* If User is not defining the call outs then pLM+ will jump to ZERO */ +/* Address for execution. */ +/***********************************************************************/ +#define LM_DEFAULT_COUTS YES + +#if LM_DEFAULT_COUTS + +extern ULONG lm_loadco(const char *libname, ULONG scope, ULONG version, + const void *libinfo, /* Out */ sl_attrib *attr); + +extern ULONG lm_unloadco(const sl_attrib *attr); + +#define LM_LOADCO lm_loadco /* sl_acquire() Load call-out */ +#define LM_UNLOADCO lm_unloadco /* sl_release() Unload call-out */ + +#else /* LM_DEFAULT_COUTS == NO */ + +#define LM_LOADCO 0 +#define LM_UNLOADCO 0 + +#endif + +#endif + +/*---------------------------------------------------------------------*/ +/* pREPC+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define LC_BUFSIZ (1 << FC_LOGBSIZE) /* I/O buffer size */ +#define LC_NUMFILES 5 /* Max number of open files per task */ +#define LC_WAITOPT 0 /* Wait option for memory allocation */ +#define LC_TIMEOPT 0 /* Timeout option for mem allocation */ +#define LC_SSIZE 512 /* Size of print buffer */ + +/*---------------------------------------------------------------------*/ +/* pREPC+ stdin, stdout and stderr device mapping. */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_PSCONSOLE) +#define LC_STDIN "///dev/stdin" /* The default STDIN device */ +#define LC_STDOUT "///dev/stdout" /* The default STDOUT device */ +#define LC_STDERR "///dev/stderr" /* The default STDERR device */ + +#elif (BSP_CPUFAMILY == FAMILY_X86) && (SC_APP_CONSOLE == PCCON) +#define LC_STDIN "///dev/pcconsole" /* Make PCCON as STDIN device */ +#define LC_STDOUT "///dev/pcconsole" /* Make PCCON as STDOUT device */ +#define LC_STDERR "///dev/pcconsole" /* Make PCCON as STDERR device */ + +#elif (SC_DEV_SERIAL) +#define LC_STDIN "///dev/tty" /* Make TTY the STDIN device */ +#define LC_STDOUT "///dev/tty" /* Make TTY the STDOUT device */ +#define LC_STDERR "///dev/tty" /* Make TTY the STDERR device */ + +#elif (SC_DEV_SIMCONSOLE) +#define LC_STDIN "///dev/simconsole" /* Make simconsole STDIN */ +#define LC_STDOUT "///dev/simconsole" /* Make simconsole STDOUT */ +#define LC_STDERR "///dev/simconsole" /* Make simconsole STDERR */ + +#else +#define LC_STDIN "///dev/null" /* Make NULL the STDIN device */ +#define LC_STDOUT "///dev/null" /* Make NULL the STDOUT device */ +#define LC_STDERR "///dev/null" /* Make NULL the STDERR device */ +#endif + +#if (SC_DEV_RAMDISK) +#define LC_TEMPDIR DEV_RAMDISK /* The default TEMPDIR device */ + +#elif (SC_DEV_SCSI) +#define LC_TEMPDIR DEV_SCSI /* The default TEMPDIR device */ + +#elif (SC_DEV_IDE) +#define LC_TEMPDIR DEV_IDE /* The default TEMPDIR device */ + +#elif (SC_DEV_FLOPPY) +#define LC_TEMPDIR DEV_FLOPPY /* The default TEMPDIR device */ + +#else +#define LC_TEMPDIR 0 /* The default TEMPDIR device */ +#endif +/*---------------------------------------------------------------------*/ +/* pNA+ configuration parameters */ +/* */ +/* NOTE: If you get pNA+ errno 5F01 FAT_INSUFFMEM you may need to */ +/* decrease the number of buffers allocated here for pNA+. */ +/* In general this error means pNA+ could not allocate enough */ +/* memory from Region 0 for the number of buffers requested. */ +/*---------------------------------------------------------------------*/ +#define NC_NNI 5 /* size of pNA NI Table */ +#define NC_NROUTE 10 /* size of pNA Routing Table */ +#define NC_NARP 20 /* size of pNA ARP table */ +#define NC_DEFUID 0 /* Default User ID of a task */ +#define NC_DEFGID 0 /* Default Group ID of a task */ +#define NC_HOSTNAME "scg" /* Hostname of the node */ +#define NC_NHENTRY 8 /* Number of Host table entries */ + +#define NC_NMCSOCS 0 /* Number of IP multicast sockets */ +#define NC_NMCMEMB 0 /* Number of distict IP multicast */ + /* group memberships per interface */ + +#define NC_NNODEID 0 /* Network NODE ID for unnumbered link */ + +#define NC_NSOCKETS 4 /* Number of sockets in the system */ +#define NC_NDESCS 4 /* # of socket descriptors/task */ +#define NC_MBLKS 300 /* # of message blocks in the system */ + +#define NC_BUFS_0 64 /* number of 0 length buffers */ +#define NC_BUFS_32 0 /* number of 32 length buffers */ +#define NC_BUFS_64 0 /* number of 64 length buffers */ +#define NC_BUFS_128 256 /* number of 128 byte buffers */ +#define NC_BUFS_256 0 /* number of 256 byte buffers */ +#define NC_BUFS_512 0 /* number of 512 byte buffers */ +#define NC_BUFS_1024 16 /* number of 1k byte buffers */ +#define NC_BUFS_2048 48 /* number of 2k byte buffers */ +#define NC_BUFS_4096 0 /* number of 4k byte buffers */ + +#define NC_MAX_BUFS 9 /* max number of NC_BUFS types */ + +#define NC_PNAMEM_NEWSCHEME YES /* apply new pNA MEM management scheme*/ + +#define NC_BUFS_XX_INTERNAL 20 /* # of buffers for internal pNA usage */ +#define NC_MBLKS_INT_PERCENT 15 /* % of mblks reserved for pNA internal */ +#define NC_MBLKS_TX_PERCENT 40 /* % of mblks reserved for Tx Mem Pool */ + +#define NC_BUFS_0_TX_PERCENT 50 /* % of 0 length buffers used for Tx */ +#define NC_BUFS_32_TX_PERCENT 50 /* % of 32 length buffers used for Tx */ +#define NC_BUFS_64_TX_PERCENT 50 /* % of 64 length buffers used for Tx */ +#define NC_BUFS_128_TX_PERCENT 50 /* % of 128 byte buffers used for Tx */ +#define NC_BUFS_256_TX_PERCENT 50 /* % of 256 byte buffers used for Tx */ +#define NC_BUFS_512_TX_PERCENT 50 /* % of 512 byte buffers used for Tx */ +#define NC_BUFS_1024_TX_PERCENT 50 /* % of 1k byte buffers used for Tx */ +#define NC_BUFS_2048_TX_PERCENT 50 /* % of 2k byte buffers used for Tx */ +#define NC_BUFS_4096_TX_PERCENT 50 /* % of 4k byte buffers used for Tx */ + +/*---------------------------------------------------------------------*/ +/* pNA+ daemon task configuration parameters */ +/*---------------------------------------------------------------------*/ +#define NC_DTASK_STKSZ 0x800 /* pNAD daemon task stack size */ +#define NC_DTASK_PRIO 255 /* pNAD daemon task priority */ +#define NC_REENTRANT YES /* pNA+ reentrant */ + +/*---------------------------------------------------------------------*/ +/* The following are examples for modifying the following defines */ +/* */ +/* Using a user written routine as a pNA+ Signal Handler */ +/* extern void MySigHandler (void); */ +/* #define NC_SIGNAL ((void (*)()) MySigHandler) */ +/* */ +/*---------------------------------------------------------------------*/ +#define NC_SIGNAL 0 /* pNA+ Signal Hdlr */ + +/*---------------------------------------------------------------------*/ +/* pRPC+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define NR_PMAP_PRIO 254 /* task priority */ +#define NR_PMAP_SSTACK 0x2000 /* supervisor stack size */ +#define NR_PMAP_USTACK 0x100 /* user stack size */ +#define NR_PMAP_FLAGS T_LOCAL /* t_create flags */ +#define NR_PMAP_MODE T_SUPV /* t_start mode */ +#define NR_OPEN_SOCKET SC_PSE_PRPC /* open socket, if open rpc */ + +/*---------------------------------------------------------------------*/ +/* User can change these TWO defines to have their own handlers. */ +/*---------------------------------------------------------------------*/ +#define NR_GETHOSTNAME nr_gethostname /* Function to get local */ + /* host name */ +#define NR_GET_HENTBYNAME nr_get_hentbyname /* Function to map host */ + /* name to it's IP Addr */ + +/*---------------------------------------------------------------------*/ +/* pSE+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define SE_NBUFS_0 64 /* number of 0 length buffers */ +#define SE_NBUFS_32 128 /* number of 32 byte buffers */ +#define SE_NBUFS_64 128 /* number of 64 byte buffers */ +#define SE_NBUFS_128 256 /* number of 128 byte buffers */ +#define SE_NBUFS_256 32 /* number of 256 byte buffers */ +#define SE_NBUFS_512 32 /* number of 512 byte buffers */ +#define SE_NBUFS_1024 16 /* number of 1k byte buffers */ +#define SE_NBUFS_2048 16 /* number of 2k byte buffers */ +#define SE_NBUFS_4096 8 /* number of 4k byte buffers */ +#define SE_MAX_BUFS 9 /* max number of stream buffer types */ + +#define SE_MAX_MODULES 4 /* max number of streams modules */ +#define SE_SHARE_NI NO /* LAN-NI with streams? */ + +#define SE_DATA_SIZE 0x1000 /* size of pSE data area */ + /* (must be at least 3K) */ +#define SE_TASK_PRIO 250 /* priority for pSE task */ +#define SE_STACK_SIZE 0x2000 /* stack size for pSE task */ +#define SE_DEF_UID 0 /* default user id */ +#define SE_DEF_GID 0 /* default group id */ +#define SE_N_FDS 32 /* max # of system-wide */ + /* stream descriptors */ +#define SE_N_TASKFDS 8 /* max # of per-task stream */ + /* descriptors */ +#define SE_N_LINKS 32 /* max # of multiplexing links */ +#define SE_N_TIMEOUTS 32 /* max # of timeout requests */ +#define SE_N_BUFCALLS 32 /* max # of bufcall requests */ +#define SE_N_QUEUES 256 /* # of queues */ +#define SE_N_QBANDS (SE_N_QUEUES * 2) /* # of qbands */ +#define SE_N_MBLKS 512 /* # of message blocks */ +#define SE_PRI_BANDS NO /* Whether priority bands are desired */ +#define SE_STRLOG YES /* Whether the log facility is cnfgrd */ +#define SE_TMO_RES 2 /* pSE Timer resolution in ticks */ +#define SE_MAX_AUTOPUSH 10 /* Max # of autopush entries */ +#define SE_SIGHANDLER NULL /* pSE global signal handler */ +#define SE_PRINTF printf /* pSE printf function */ +#define SE_LOG_BUFSIZE 100 /* Maximum size of the log message */ +#define SE_NUM_LOG_BUFFERS 25 /* Number of log buffs to be allocated*/ +#define SE_BUF_BORROW_LEVEL 0 /* The buffer borrowing level desired */ +#define SE_NO_GLOBAL_LOCKING NO /* Whether global locking is desired */ +#define SE_PCRASH_BUF_SIZE 8192 /* default pcrash buffer size */ +#define SE_HI_BUF_RESVN_PERCENT 12 /* Hi buffer reservation % */ +#define SE_MED_BUF_RESVN_PERCENT 13 /* Med buffer reservation % */ + + +/*---------------------------------------------------------------------*/ +/* Loader configuration parameters */ +/* */ +/* YES indicates for each module to be linked in. NO means do not link */ +/* object module loader into this application. */ +/* */ +/*---------------------------------------------------------------------*/ +#define LD_MAX_LOAD 8 /* Max. # of active loads */ +#define LD_ELF_MODULE NO /* ELF object-load-module */ +#define LD_SREC_MODULE NO /* SREC object-load-module */ +#define LD_COFF_MODULE NO /* COFF object-load-module */ +#define LD_IEEE_MODULE NO /* IEEE object-load-module */ +#define LD_IHEX_MODULE NO /* IHEX object-load-module */ + +/*---------------------------------------------------------------------*/ +/* pMONT+ configuration parameters - note that PM_DEV and PM_BAUD are */ +/* only relevant to serial communication (PM_CMODE = 2) */ +/*---------------------------------------------------------------------*/ +#define PM_CMODE 1 /* 1 = networking, 2 = serial */ + +/*---------------------------------------------------------------------*/ +/* PM_DEV down uses a macro to calculate the channel number, which is */ +/* SERIAL_DRVRNUM(0). This means Low-Level Driver 0 (1) is used for */ +/* default PM_DEV. If you need to change this to another Low-Level */ +/* Serial Driver, change "0" in the macro SERIAL_DRVRNUM(0) to the */ +/* number of the driver you want. */ +/* */ +/* Consult the "README" file in BSP directory for number of different */ +/* drivers supported and for the SERIAL_DRVRNUM mapping for those */ +/* drivers. */ +/*---------------------------------------------------------------------*/ +#define PM_DEV (2 + SERIAL_DRVRNUM(0)) + /* Minor Device number for serial */ + /* channel if used */ + +#define PM_BAUD 9600 /* Baud rate for serial chnl */ +#define PM_TRACE_BUFF 0 /* Address of trace buffer -- */ + /* Allocated by pSOSystem if 0 */ +#define PM_TRACE_SIZE 0x6000 /* Size of trace buffer */ +#define PM_TIMER YES /* 2nd timer for finer time */ + /* within data collection */ + +/*---------------------------------------------------------------------*/ +/* General Serial Block Configuration Parameters */ +/*---------------------------------------------------------------------*/ +#define GS_BUFS_0 64 /* number of 0 length buffers */ +#define GS_BUFS_32 128 /* number of 32 byte buffers */ +#define GS_BUFS_64 128 /* number of 64 byte buffers */ +#define GS_BUFS_128 256 /* number of 128 byte buffers */ +#define GS_BUFS_256 32 /* number of 256 byte buffers */ +#define GS_BUFS_512 32 /* number of 512 byte buffers */ +#define GS_BUFS_1024 16 /* number of 1k byte buffers */ +#define GS_BUFS_2048 16 /* number of 2k byte buffers */ +#define GS_BUFS_4096 8 /* number of 4k byte buffers */ + +#define GS_MBLKS 680 +#define GS_MAX_BUFS 9 /* max number of serial buffer types */ + +/*---------------------------------------------------------------------*/ +/* TCP/IP for OpEN configuration parameters */ +/*---------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for the Network layer (IP) */ +/*---------------------------------------------------------------------*/ +#define OTCP_IPMAX 8 /* Max # of open IP device */ +#define OTCP_IPNINTERFACES 4 /* Max # of network interfaces */ +#define OTCP_IPNROUTES 64 /* Max #of routing tbl entries */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for ARP */ +/*---------------------------------------------------------------------*/ +#define OTCP_ARPMAX 8 /* Max # of open ARP device */ +#define OTCP_ARPNINTERFACES 4 /* Max # of ARP interfaces */ +#define OTCP_ARPNENTRIES 32 /* Max # of ARP table entries */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for TCP */ +/*---------------------------------------------------------------------*/ +#define OTCP_TCPMAX 64 /* Max # of open TCP device */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for UDP */ +/*---------------------------------------------------------------------*/ +#define OTCP_UDPMAX 32 /* Max # of open UDP device */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for RAW */ +/*---------------------------------------------------------------------*/ +#define OTCP_RAWMAX 32 /* Max # of open RAW device */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for LOOP */ +/*---------------------------------------------------------------------*/ +#define OTCP_LOOPMAX 2 /* Max # of open LOOP device */ + + + +#endif /* _SYS_CONF_H */ + +#ifdef __cplusplus +} +#endif diff --git a/h/wrn/wm/util/port/isisnmp/oemtypes.h b/h/wrn/wm/util/port/isisnmp/oemtypes.h new file mode 100644 index 0000000..005d288 --- /dev/null +++ b/h/wrn/wm/util/port/isisnmp/oemtypes.h @@ -0,0 +1,53 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/isisnmp/oemtypes.h,v 1.1.1.1 2001/11/05 17:47:09 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: oemtypes.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:09 tneale + * Tornado shuffle + * + * Revision 1.6 2001/01/19 22:22:58 paul + * Update copyright. + * + * Revision 1.5 2000/03/17 00:10:01 meister + * Update copyright message + * + * Revision 1.4 2000/02/17 16:38:08 josh + * removing obsolete definitions + * + * Revision 1.3 1998/08/13 20:11:31 josh + * updates for pSOS + * + * Revision 1.2 1998/06/28 21:18:28 josh + * updating/bugfixing for SNMp + * + * Revision 1.1 1998/06/19 16:09:06 josh + * port files for building SNMp + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + +#include + + + diff --git a/h/wrn/wm/util/port/isisnmp/ppc222/config.mk b/h/wrn/wm/util/port/isisnmp/ppc222/config.mk new file mode 100644 index 0000000..95a2582 --- /dev/null +++ b/h/wrn/wm/util/port/isisnmp/ppc222/config.mk @@ -0,0 +1,376 @@ +#* @(#) pSOSystem PowerPC/V2.2.2: configs/ppc/config.mk 1.59 97/09/12 10:00:37 * +#*********************************************************************** +#* * +#* MODULE: config.mk * +#* DATE: 97/09/12 * +#* PURPOSE: Macro definitions, linker commands, etc, for "make" * +#* * +#*---------------------------------------------------------------------* +#* * +#* Copyright 2000-2001 Wind River Systems, Inc. +#* Copyright 1991 - 1997, Integrated Systems, Inc. * +#* ALL RIGHTS RESERVED * +#* * +#* Permission is hereby granted to licensees of Integrated Systems, * +#* Inc. products to use or abstract this computer program for the * +#* sole purpose of implementing a product based on Integrated * +#* Systems, Inc. products. No other rights to reproduce, use, * +#* or disseminate this computer program, whether in part or in * +#* whole, are granted. * +#* * +#* Integrated Systems, Inc. makes no representation or warranties * +#* with respect to the performance of this computer program, and * +#* specifically disclaims any responsibility for any damages, * +#* special or consequential, connected with the use of this program. * +#* * +#*---------------------------------------------------------------------* +#*********************************************************************** +# +#------------------------------------------------------------------------ +# Compiler commands and command-line options +#------------------------------------------------------------------------ +# Add following option to COPTS_FILE2 to generate listing files +# -W:as:,-l -Xpass-source +#------------------------------------------------------------------------ +CC = dcc +COMP_OPTS1 = -O -t$(DTARGET)E$(DFP):psos -Xsmall-data=8 +COMP_OPTS2 = -Xstruct-best-align=0 -Xansi -D__DIAB -DPPC +COPTS_FILE1 = -I. -I$(PSS_BSP) -I$(PSS_ROOT)/include +COPTS_FILE2 = $(PSS_APPINCS) -c +COPTS = -@c.opt + +#------------------------------------------------------------------------ +# Assembler command-line options +#------------------------------------------------------------------------ +AS = das + +#------------------------------------------------------------------------ +# Added target switch for the assembler +# The target definition is located in bsp.mk of the bsp you are using +#------------------------------------------------------------------------ +# Add following option to AOPTS_FILE1 to generate listing files -l +#------------------------------------------------------------------------ +AOPTS_FILE1 = -I. -I$(PSS_BSP) -I$(PSS_ROOT)/include +AOPTS_FILE2 = $(PSS_APPINCS) -t$(DTARGET)E$(DFP) +AOPTS = -@a.opt + +#------------------------------------------------------------------------ +# Linker command name +#------------------------------------------------------------------------ +LD = dcc +LOPTS = -Ws -t$(DTARGET)E$(DFP) -Wl,-Xsupress-dot -Xreloc-bug -m2 + +#------------------------------------------------------------------------ +# Librarian command name and options +#------------------------------------------------------------------------ +LIB = dar +LIBOPTS = -qf +LIBOPTS_SORT = -sR + +#======================================================================== +# Link everything together +#======================================================================== +CFG1_OBJS= sysinit.o philecfg.o pnacfg.o prepccfg.o dialog.o +CFG2_OBJS= probecfg.o prpccfg.o psecfg.o psoscfg.o pmontcfg.o +CFG3_OBJS= pollio.o bspcfg.o gsblkcfg.o rdi_ser.o + +ram.elf: c.opt a.opt begin.o \ + makefile \ + $(CFG1_OBJS) \ + $(CFG2_OBJS) \ + $(CFG3_OBJS) \ + prepcv.o \ + $(PSS_DRVOBJS) \ + $(DRV_LIB1) $(DRV_LIB2) $(DRV_LIB3) $(DRV_LIB4) $(DRV_LIB5) \ + $(PSS_APPOBJS) \ + $(APP_LIB1) $(APP_LIB2) $(APP_LIB3) $(APP_LIB4) $(APP_LIB5) \ + $(PSS_BSP)/libbsp.a \ + $(PSS_ROOT)/sys/os/libsys.a \ + $(PSS_BSP)/ram_di.lnk + @cat $(PSS_BSP)/ram_di.lnk >cmd.lnk + @echo $(LOPTS) -o ram.elf -Wm cmd.lnk begin.o > l.opt + @echo $(CFG1_OBJS) >> l.opt + @echo $(CFG2_OBJS) >> l.opt + @echo $(CFG3_OBJS) >> l.opt + @echo prepcv.o >> l.opt + @echo $(PSS_APPOBJS) >> l.opt + @echo -m3 $(APP_LIB1) >> l.opt + @echo -m3 $(APP_LIB2) >> l.opt + @echo -m3 $(APP_LIB3) >> l.opt + @echo -m3 $(APP_LIB4) >> l.opt + @echo -m3 $(APP_LIB5) >> l.opt + @echo $(PSS_DRVOBJS) >> l.opt + @echo -m3 $(DRV_LIB1) >> l.opt + @echo -m3 $(DRV_LIB2) >> l.opt + @echo -m3 $(DRV_LIB3) >> l.opt + @echo -m3 $(DRV_LIB4) >> l.opt + @echo -m3 $(DRV_LIB5) >> l.opt + @echo $(PSS_BSP)/libbsp.a >> l.opt + @echo $(PSS_ROOT)/sys/os/libsys.a >> l.opt + @echo -L $(PSS_ROOT)/sys/libc -lprepc >> l.opt + @echo -m3 $(FIX_LIB) >> l.opt + @echo $(PSS_COMPLIB) >> l.opt + $(LD) -@l.opt > ram.map + ddump -tv ram.elf >> ram.map + +ram.hex: ram.elf + ddump -Rv ram.elf -o ram.hex + +rom.elf: c.opt a.opt begin.o \ + makefile \ + $(CFG1_OBJS) \ + $(CFG2_OBJS) \ + $(CFG3_OBJS) \ + prepcv.o \ + $(PSS_DRVOBJS) \ + $(DRV_LIB1) $(DRV_LIB2) $(DRV_LIB3) $(DRV_LIB4) $(DRV_LIB5) \ + $(APP_LIB1) $(APP_LIB2) $(APP_LIB3) $(APP_LIB4) $(APP_LIB5) \ + $(PSS_BSP)/libbsp.a \ + $(PSS_APPOBJS) \ + $(PSS_ROOT)/sys/os/libsys.a \ + $(PSS_BSP)/rom_di.lnk + @cat $(PSS_BSP)/rom_di.lnk >cmd.lnk + @echo $(LOPTS) -o rom.elf -Wm cmd.lnk begin.o > l.opt + @echo $(CFG1_OBJS) >> l.opt + @echo $(CFG2_OBJS) >> l.opt + @echo $(CFG3_OBJS) >> l.opt + @echo prepcv.o >> l.opt + @echo $(PSS_APPOBJS) >> l.opt + @echo -m3 $(APP_LIB1) >> l.opt + @echo -m3 $(APP_LIB2) >> l.opt + @echo -m3 $(APP_LIB3) >> l.opt + @echo -m3 $(APP_LIB4) >> l.opt + @echo -m3 $(APP_LIB5) >> l.opt + @echo $(PSS_DRVOBJS) >> l.opt + @echo -m3 $(DRV_LIB1) >> l.opt + @echo -m3 $(DRV_LIB2) >> l.opt + @echo -m3 $(DRV_LIB3) >> l.opt + @echo -m3 $(DRV_LIB4) >> l.opt + @echo -m3 $(DRV_LIB5) >> l.opt + @echo $(PSS_BSP)/libbsp.a >> l.opt + @echo $(PSS_ROOT)/sys/os/libsys.a >> l.opt + @echo -L $(PSS_ROOT)/sys/libc -lprepc >> l.opt + @echo -m3 $(FIX_LIB) >> l.opt + @echo $(PSS_COMPLIB) >> l.opt + $(LD) -@l.opt > rom.map + ddump -tv rom.elf >> rom.map + +rom.hex: rom.elf + ddump -Rv rom.elf -o rom.hex + +os.elf: c.opt a.opt begin.o \ + makefile \ + $(CFG1_OBJS) \ + $(CFG2_OBJS) \ + $(CFG3_OBJS) \ + prepcv.o \ + $(PSS_DRVOBJS) \ + $(DRV_LIB1) $(DRV_LIB2) $(DRV_LIB3) $(DRV_LIB4) $(DRV_LIB5) \ + $(PSS_BSP)/libbsp.a \ + $(PSS_ROOT)/sys/os/libsys.a \ + $(PSS_BSP)/os.lnk + @cat $(PSS_BSP)/os.lnk >cmd.lnk + @echo $(LOPTS) -o os.elf -Wm cmd.lnk begin.o > l.opt + @echo $(CFG1_OBJS) >> l.opt + @echo $(CFG2_OBJS) >> l.opt + @echo $(CFG3_OBJS) >> l.opt + @echo prepcv.o >> l.opt + @echo $(PSS_DRVOBJS) >> l.opt + @echo -m3 $(DRV_LIB1) >> l.opt + @echo -m3 $(DRV_LIB2) >> l.opt + @echo -m3 $(DRV_LIB3) >> l.opt + @echo -m3 $(DRV_LIB4) >> l.opt + @echo -m3 $(DRV_LIB5) >> l.opt + @echo $(PSS_BSP)/libbsp.a >> l.opt + @echo $(PSS_ROOT)/sys/os/libsys.a >> l.opt + @echo -L $(PSS_ROOT)/sys/libc -lprepc >> l.opt + @echo -m3 $(FIX_LIB) >> l.opt + @echo $(PSS_COMPLIB) >> l.opt + $(LD) -@l.opt > os.map + ddump -tv os.elf >> os.map + +os.hex: os.elf + ddump -Rv os.elf -o os.hex + +app.elf: c.opt a.opt begina.o \ + makefile \ + $(PSS_APPOBJS) \ + $(APP_LIB1) $(APP_LIB2) $(APP_LIB3) $(APP_LIB4) $(APP_LIB5) \ + prepcv.o \ + $(PSS_ROOT)/sys/os/libsys.a \ + $(PSS_BSP)/app.lnk + @cat $(PSS_BSP)/app.lnk >cmd.lnk + @echo $(LOPTS) -o app.elf -Wm cmd.lnk begina.o > l.opt + @echo $(PSS_APPOBJS) >> l.opt + @echo -m3 $(APP_LIB1) >> l.opt + @echo -m3 $(APP_LIB2) >> l.opt + @echo -m3 $(APP_LIB3) >> l.opt + @echo -m3 $(APP_LIB4) >> l.opt + @echo -m3 $(APP_LIB5) >> l.opt + @echo prepcv.o >> l.opt + @echo $(PSS_ROOT)/sys/os/libsys.a >> l.opt + @echo -L $(PSS_ROOT)/sys/libc -lprepc >> l.opt + @echo -m3 $(FIX_LIB) >> l.opt + @echo $(PSS_COMPLIB) >> l.opt + $(LD) -@l.opt > app.map + ddump -tv app.elf >> app.map + +app.hex: app.elf + ddump -Rv app.elf -o app.hex + + +#------------------------------------------------------------------------ +# Compile or assemble modules which are always used. +#------------------------------------------------------------------------ +begin.o: $(PSS_CONFIG)/begin.s makefile \ + $(PSS_CONFIG)/config.mk + $(AS) $(AOPTS) -o begin.o $(PSS_CONFIG)/begin.s + +begina.o: $(PSS_CONFIG)/begina.s makefile \ + $(PSS_CONFIG)/config.mk + $(AS) $(AOPTS) -o begina.o $(PSS_CONFIG)/begina.s + +gsblkcfg.o: $(PSS_CONFIG)/gsblkcfg.c \ + makefile \ + $(PSS_ROOT)/include/gsblk.h \ + $(PSS_CONFIG)/config.mk \ + sys_conf.h + $(CC) $(COPTS) $(PSS_CONFIG)/gsblkcfg.c + +sysinit.o: $(PSS_CONFIG)/sysinit.c \ + makefile \ + sys_conf.h \ + $(PSS_BSP)/bsp.h \ + $(PSS_ROOT)/include/bspfuncs.h \ + $(PSS_ROOT)/include/apdialog.h \ + $(PSS_ROOT)/include/pna.h \ + $(PSS_ROOT)/include/configs.h \ + $(PSS_ROOT)/include/sysvars.h \ + $(PSS_CONFIG)/config.mk + $(CC) $(COPTS) $(PSS_CONFIG)/sysinit.c + +philecfg.o: $(PSS_CONFIG)/philecfg.c \ + makefile \ + sys_conf.h \ + $(PSS_ROOT)/include/configs.h \ + $(PSS_BSP)/bsp.h \ + $(PSS_ROOT)/include/bspfuncs.h \ + $(PSS_CONFIG)/config.mk + $(CC) $(COPTS) $(PSS_CONFIG)/philecfg.c + +pnacfg.o: $(PSS_CONFIG)/pnacfg.c \ + makefile \ + sys_conf.h \ + $(PSS_BSP)/bsp.h \ + $(PSS_ROOT)/include/bspfuncs.h \ + $(PSS_ROOT)/include/pna.h \ + $(PSS_ROOT)/include/configs.h \ + $(PSS_ROOT)/include/sysvars.h \ + $(PSS_CONFIG)/config.mk + $(CC) $(COPTS) $(PSS_CONFIG)/pnacfg.c + +prepccfg.o: $(PSS_CONFIG)/prepccfg.c \ + makefile \ + sys_conf.h \ + $(PSS_BSP)/bsp.h \ + $(PSS_ROOT)/include/bspfuncs.h \ + $(PSS_ROOT)/include/configs.h \ + $(PSS_CONFIG)/config.mk + $(CC) $(COPTS) $(PSS_CONFIG)/prepccfg.c + +probecfg.o: $(PSS_CONFIG)/probecfg.c \ + makefile \ + sys_conf.h \ + $(PSS_BSP)/bsp.h \ + $(PSS_ROOT)/include/bspfuncs.h \ + $(PSS_ROOT)/include/configs.h \ + $(PSS_ROOT)/include/sysvars.h \ + $(PSS_CONFIG)/config.mk + $(CC) $(COPTS) $(PSS_CONFIG)/probecfg.c + +prpccfg.o: $(PSS_CONFIG)/prpccfg.c \ + makefile \ + sys_conf.h \ + $(PSS_BSP)/bsp.h \ + $(PSS_ROOT)/include/bspfuncs.h \ + $(PSS_ROOT)/include/configs.h \ + $(PSS_CONFIG)/config.mk + $(CC) $(COPTS) $(PSS_CONFIG)/prpccfg.c + +psecfg.o: $(PSS_CONFIG)/psecfg.c \ + makefile \ + sys_conf.h \ + $(PSS_BSP)/bsp.h \ + $(PSS_ROOT)/include/bspfuncs.h \ + $(PSS_ROOT)/include/configs.h \ + $(PSS_CONFIG)/config.mk + $(CC) $(COPTS) $(PSS_CONFIG)/psecfg.c + +psoscfg.o: $(PSS_CONFIG)/psoscfg.c \ + makefile \ + sys_conf.h \ + $(PSS_BSP)/bsp.h \ + $(PSS_ROOT)/include/bspfuncs.h \ + $(PSS_ROOT)/include/configs.h \ + $(PSS_ROOT)/include/sysvars.h \ + $(PSS_CONFIG)/config.mk + $(CC) $(COPTS) $(PSS_CONFIG)/psoscfg.c + +pmontcfg.o: $(PSS_CONFIG)/pmontcfg.c \ + makefile \ + sys_conf.h \ + $(PSS_BSP)/bsp.h \ + $(PSS_ROOT)/include/bspfuncs.h \ + $(PSS_ROOT)/include/configs.h \ + $(PSS_CONFIG)/config.mk + $(CC) $(COPTS) $(PSS_CONFIG)/pmontcfg.c + +dialog.o: $(PSS_CONFIG)/dialog.c \ + makefile \ + sys_conf.h \ + $(PSS_BSP)/bsp.h \ + $(PSS_ROOT)/include/bspfuncs.h \ + $(PSS_ROOT)/include/apdialog.h \ + $(PSS_ROOT)/include/sysvars.h \ + $(PSS_ROOT)/include/version.h \ + $(PSS_ROOT)/include/stdarg.h \ + $(PSS_ROOT)/include/pna.h \ + $(PSS_CONFIG)/config.mk + $(CC) $(COPTS) $(PSS_CONFIG)/dialog.c + +pollio.o: $(PSS_CONFIG)/pollio.c makefile \ + $(PSS_BSP)/bsp.h \ + $(PSS_ROOT)/include/stdarg.h \ + $(PSS_CONFIG)/config.mk + $(CC) $(COPTS) $(PSS_CONFIG)/pollio.c + +prepcv.o: $(PSS_ROOT)/sys/os/prepcv.c makefile \ + $(PSS_CONFIG)/config.mk + $(CC) $(COPTS) $(PSS_ROOT)/sys/os/prepcv.c + +bspcfg.o: $(PSS_BSP)/bspcfg.c makefile \ + $(PSS_CONFIG)/config.mk \ + sys_conf.h \ + $(PSS_BSP)/bsp.h + @echo -I$(PSS_ROOT)/bsps/devices > bsp.opt + $(CC) $(COPTS) -@bsp.opt $(PSS_BSP)/bspcfg.c + @rm bsp.opt + +rdi_ser.o: $(PSS_CONFIG)/rdi_ser.c makefile \ + sys_conf.h \ + $(PSS_BSP)/bsp.h \ + $(PSS_ROOT)/include/bspfuncs.h \ + $(PSS_ROOT)/include/configs.h \ + $(PSS_ROOT)/include/sysvars.h \ + $(PSS_CONFIG)/config.mk + $(CC) $(COPTS) $(PSS_CONFIG)/rdi_ser.c + +c.opt: makefile + @echo $(COMP_OPTS1) > c.opt + @echo $(COMP_OPTS2) >> c.opt + @echo $(COPTS_FILE1) >> c.opt + @echo $(COPTS_FILE2) >> c.opt + +a.opt: makefile + @echo $(AOPTS_FILE1) > a.opt + @echo $(AOPTS_FILE2) >> a.opt diff --git a/h/wrn/wm/util/port/isisnmp/ppc222/drv_conf.h b/h/wrn/wm/util/port/isisnmp/ppc222/drv_conf.h new file mode 100644 index 0000000..591048f --- /dev/null +++ b/h/wrn/wm/util/port/isisnmp/ppc222/drv_conf.h @@ -0,0 +1,536 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/isisnmp/ppc222/drv_conf.h,v 1.1.1.1 2001/11/05 17:47:10 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: drv_conf.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:10 tneale + * Tornado shuffle + * + * Revision 1.5 2001/01/19 22:22:58 paul + * Update copyright. + * + * Revision 1.4 2000/03/17 00:10:04 meister + * Update copyright message + * + * Revision 1.3 1998/08/20 18:01:19 josh + * sys_conf.h cleanup + * + * Revision 1.2 1998/08/19 21:38:31 josh + * adding copyright stuff. + * + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* @(#) pSOSystem x86/V2.2.6: apps.v22/xxxx/drv_conf.c 3.3 (snmpv2) 98/01/09 12:28:00 */ +/***********************************************************************/ +/* */ +/* MODULE: drv_conf.c */ +/* DATE: 98/01/09 */ +/* PURPOSE: pSOSystem driver configuration and initialization */ +/* */ +/* There are two functions in this file: */ +/* */ +/* SetUpDrivers to setup drivers except for Network drivers */ +/* SetUpNI to setup Network drivers */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* Copyright 1993 - 1997, Integrated Systems, Inc. */ +/* ALL RIGHTS RESERVED */ +/* */ +/* Permission is hereby granted to licensees of Integrated Systems, */ +/* Inc. products to use or abstract this computer program for the */ +/* sole purpose of implementing a product based on Integrated */ +/* Systems, Inc. products. No other rights to reproduce, use, */ +/* or disseminate this computer program, whether in part or in */ +/* whole, are granted. */ +/* */ +/* Integrated Systems, Inc. makes no representation or warranties */ +/* with respect to the performance of this computer program, and */ +/* specifically disclaims any responsibility for any damages, */ +/* special or consequential, connected with the use of this program. */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* */ +/* */ +/***********************************************************************/ +#include +#include "bsp.h" +#include +#include +#include +#include +#if SC_DEV_SPI + #include "spi.h" +#endif +#if (SC_PSE) +#include +#include +#endif +#if (SC_DEV_DLPI) +extern long DlpiEnet(); +#endif + +#define NULLF (ULONG) ((void (*)()) 0) + +void InstallNi(int (*entry)(), int, int, int, int, int, int); + +static const char RarpErrTimeout[] = + "RARP request failed: Check for a RARP server"; +static const char RarpErrNet[] = + "RARP request failed: Network Error"; + +#if SC_PSOS || SC_PSOSM +/***********************************************************************/ +/* SetUpDrivers: installs drivers in PsosIO table via a call to */ +/* InstallDriver and then calls driver setup function if */ +/* needed. NOTE: If the driver is to be part of the */ +/* Network Interface then it should be placed in the */ +/* SetUpNI function. */ +/* */ +/* INPUT: FreeMemPtr = A pointer to unused memory that can be */ +/* used to allocate space for a driver. */ +/* NOTE: Be sure to advance FreeMemPtr if */ +/* memory is allocates! */ +/* */ +/* RETURNS: The new address of free memory after the drivers have */ +/* allocated space. */ +/* */ +/* NOTE: This function does many precompile checks so errors */ +/* can be found during compile-time rather then at run- */ +/* time. */ +/* */ +/* To add a non-Network driver to pSOSystem, call InstallDriver(). */ +/* This adds a device driver to the PsosIO table. InstallDriver() */ +/* takes the following arguments: */ +/* */ +/* unsigned short major_number device major number */ +/* void (*dev_init)(), device init procedure */ +/* void (*dev_open)(), device open procedure */ +/* void (*dev_close)(), device close procedure */ +/* void (*dev_read)(), device read procedure */ +/* void (*dev_write)(), device write procedure */ +/* void (*dev_ioctl)(), device control procedure */ +/* unsigned long rsvd1, reserved */ +/* unsigned short rsvd2) reserved */ +/* unsigned short flags; If set to IO_AUTOINIT pSOS will */ +/* automatically call the */ +/* drivers initialization */ +/* function. The SC_AUTOINIT */ +/* #define which is set in */ +/* sys_conf.h can be used to set */ +/* this element. */ +/* */ +/* InstallDriver() does not return a value. InstallDriver() assumes */ +/* SC_DEVMAX is defined in sys_conf.h and is useful only before pSOS+ */ +/* has been initialized. */ +/* */ +/* If you are adding a driver that needs to be initialized before */ +/* either pSOS+ is initialized or the driver's init function is */ +/* called, then you can call a setup function (that you create) for */ +/* the driver (for example, see the CnslSetup call for the serial */ +/* device driver). If your initialization function needs to allocate */ +/* memory, you may pass it the FreeMemPtr. The function should return */ +/* a new FreeMemPtr which points to the end of the memory it has */ +/* allocated. */ +/* */ +/* When adding code to install a new driver, it is a good idea to add */ +/* precompile checks so errors can be found during compile-time rather */ +/* then at run-time. Precompile checks are used, for example, in the */ +/* code that installs the pSOSystem serial device driver below. */ +/* */ +/***********************************************************************/ +UCHAR *SetUpDrivers(UCHAR *FreeMemPtr) +{ +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem serial device driver. */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SERIAL && BSP_SERIAL) + #if(SC_DEV_SERIAL > SC_DEVMAX) + #error "SC_DEV_SERIAL cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SERIAL, CnslInit, NULLF, NULLF,CnslRead, + CnslWrite, CnslCntrl, 0, 0, SC_AUTOINIT); + FreeMemPtr = CnslSetup(FreeMemPtr, SysVars.DefBaud, + SC_APP_CONSOLE); +#endif + +/*---------------------------------------------------------------------*/ +/* Install Pseudo driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_PSEUDO) + InstallDriver(SC_DEV_PSEUDO, PseudoIOInit, NULLF, NULLF, + PseudoIORead, PseudoIOWrite, PseudoIOCntrl, 0, 0, 0); +#endif + +/*--------------------------------------------------------------------*/ +/* Setup pSOSystem PC console device driver */ +/*--------------------------------------------------------------------*/ +#if (SC_DEV_CONSOLE && BSP_CONSOLE) + #if (SC_DEV_CONSOLE >SC_DEVMAX) + #error "SC_DEV_CONSOLE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_CONSOLE, PcCnslInit, NULLF, NULLF, + PcCnslRead, PcCnslWrite, PcCnslCntrl, 0, 0, + SC_AUTOINIT); +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem tick timer. */ +/*---------------------------------------------------------------------*/ +#if SC_DEV_TIMER + #if(SC_DEV_TIMER > SC_DEVMAX) + #error "SC_DEV_TIMER cannot be > SC_DEVMAX" + #endif + #if (!SC_PSOS && !SC_PSOSM) + #error "Must have pSOS+ or pSOS+m in system to use tick timer!" + #endif + InstallDriver(SC_DEV_TIMER, RtcInit, NULLF, NULLF, NULLF, NULLF, + NULLF, 0, 0, SC_AUTOINIT); +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem ramdisk driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if SC_DEV_RAMDISK + #if(SC_DEV_RAMDISK > SC_DEVMAX) + #error "SC_DEV_RAMDISK cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_RAMDISK, RdskInit, NULLF, NULLF, RdskRead, + RdskWrite, NULLF, 0, 0, 0); +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem SCSI driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SCSI && BSP_SCSI) + #if(SC_DEV_SCSI > SC_DEVMAX) + #error "SC_DEV_SCSI cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SCSI, SdrvInit, NULLF, NULLF, SdskRead, + SdskWrite, SdrvCntrl, 0, 0, 0); +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem SCSI Tape driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SCSI_TAPE && BSP_SCSI_TAPE) + #if(SC_DEV_SCSI_TAPE > SC_DEVMAX) + #error "SC_DEV_SCSI_TAPE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SCSI_TAPE, SdrvInit, StapeOpen, StapeClose, + StapeRead, StapeWrite, SdrvCntrl, 0, 0, 0); + + /*-----------------------------------------------------------------*/ + /* Don't need to call SdrvSetup this time since it was done before */ + /*-----------------------------------------------------------------*/ + /* SdrvSetup(); */ +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem CMOS clock driver */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_CMOS && BSP_CLOCK) + #if (SC_DEV_CMOS >SC_DEVMAX) + #error "SC_DEV_CMOS cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_CMOS, NULLF, NULLF, NULLF, CmcRead, + CmcWrite, NULLF, 0, 0, 0); +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem printer driver */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_PARALLEL && BSP_PARALLEL) + #if (SC_DEV_PARALLEL >SC_DEVMAX) + #error "SC_DEV_PARALLEL cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_PARALLEL, ParInit, ParOpen, ParClose, NULLF, + ParWrite, ParCntrl, 0, 0, 0); +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem floppy diskette driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_FLOPPY && BSP_FLOPPY) + #if (SC_DEV_FLOPPY >SC_DEVMAX) + #error "SC_DEV_FLOPPY cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_FLOPPY, FlpInit, NULLF, NULLF, FlpRead, + FlpWrite, NULLF, 0, 0, 0); +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem IDE disk driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_IDE && BSP_IDE) + #if (SC_DEV_IDE >SC_DEVMAX) + #error "SC_DEV_IDE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_IDE, IDEInit, NULLF, NULLF, IDERead, + IDEWrite, IDECntrl, 0, 0, 0); +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem TFTP driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_TFTP) + #if(SC_DEV_TFTP > SC_DEVMAX) + #error "SC_DEV_TFTP cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_TFTP, TftpInit, TftpOpen, TftpClose, TftpRead, + NULLF, TftpCntl, 0, 0, 0); +#endif + +/*---------------------------------------------------------------------*/ +/* Install the SPI driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SPI) + #if(SC_DEV_SPI > SC_DEVMAX) + #error "SC_DEV_SPI cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SPI, SPI_init, SPI_open, SPI_close, NULLF, + NULLF, SPI_io, 0, 0, 0); +#endif + +/*---------------------------------------------------------------------*/ +/* Install pSE DLPI driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_DLPI) + { + #if(SC_DEV_DLPI > SC_DEVMAX) + #error "SC_DEV_DLPI cannot be > SC_DEVMAX" + #endif + extern long DlpiNullNI(); + extern UCHAR *DlpiInit(UCHAR *, long, long); + extern int DlpiAddNI(long, long(*)(), long, long, char *, long); + extern void enetinit(); + extern struct streamtab enetinfo; + char *DlpiErrMsg = "DlpiAddNI failed: NI Error"; + static const psedrvparam_t eth0param = {"eth0", DT_CLONE, + &enetinfo, 0, 0}; + + InstallDriver(SC_DEV_DLPI, enetinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)ð0param, 0, 0); + + /*-------------------------------------------------------------*/ + /* Call DlpiInit to initialize the Streams DLPI driver */ + /* Arguments passed to DlpiInit are: */ + /* 1. Free memory address */ + /* 2. Maximum NI interface number */ + /* 3. Maximum number of streams per interface */ + /*-------------------------------------------------------------*/ + FreeMemPtr = DlpiInit(FreeMemPtr, 1, 6); + + /*-------------------------------------------------------------*/ + /* Call DlpiAddNI to add an NI interface to the Streams DLPI */ + /* driver. DlpiAddNI must be called for each NI driver */ + /* interface used with the Streams DLPI driver. */ + /* Arguments passed to DlpiAddNI are: */ + /* 1. NI interface number (should correspond to the pNA+ */ + /* interface number if driver is shared with pNA+) */ + /* 2. NI entry point */ + /* 3. NI flags */ + /* IFF_SELFLOOP 0x0001 loopback for self-address */ + /* IFF_POLL_NI 0x0002 driver must be polled */ + /* IFF_RAWMEM 0x2000 driver accepts mblk link list */ + /* 4. NI major device number */ + /* 5. NI multicast address */ + /* 6. NI poll frequency (every # of elapsed ticks) */ + /*-------------------------------------------------------------*/ + #if (BSP_LAN1 && SE_SHARE_NI) + if (DlpiAddNI(1, (long(*)())BSP_LAN1_ENTRY, 0x2000, + SC_DEV_DLPI, 0, 0)) + SysInitFail(DlpiErrMsg); + #else + if (DlpiAddNI(0, (long(*)())DlpiNullNI, 0, SC_DEV_DLPI, 0, 0)) + SysInitFail(DlpiErrMsg); + #endif + } +#endif + +/*-------------------------------------------------------------------*/ +/* Install pSOSystem Watchdog driver */ +/*-------------------------------------------------------------------*/ +#if (SC_DEV_WATCHDOG) + #if(SC_DEV_WATCHDOG > SC_DEVMAX) + #error "SC_DEV_WATCHDOG cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_WATCHDOG, WdtInit, NULLF, NULLF, NULLF, + NULLF, NULLF, 0, 0, 0); +#endif + +/*---------------------------------------------------------------------*/ +/* Additional drivers may be installed here. */ +/*---------------------------------------------------------------------*/ + +return FreeMemPtr; +} +#endif /* SC_PSOS || SC_PSOSM */ + +#if SC_PNA +/***********************************************************************/ +/* SetUpNI: Set up Network Interfaces for pNA+ */ +/* */ +/* INPUT: FreeMemPtr = A pointer to unused memory that can be */ +/* used to allocate space for a driver. */ +/* NOTE: Be sure to advance FreeMemPtr if */ +/* memory is allocates! */ +/* */ +/* RETURNS: The new address of free memory after the drivers have */ +/* allocated space. */ +/* */ +/* NOTES: This function does many precompile checks so errors */ +/* can be found during compile-time rather then at run- */ +/* time. */ +/* */ +/* Also, the Network Interface Table must be allocated */ +/* before this function can be called. There cannot be */ +/* more then NC_NNI entries in this table. NC_NNI is set */ +/* in sys_conf.h. Before adding another interface, be */ +/* sure to check sys_conf.h to see if NC_NNI is set to */ +/* accommodate another one! */ +/* */ +/* See the pSOSystem Programmers Reference Manual */ +/* for more information. */ +/* */ +/* To add a Network driver to pSOSystem, call InstallNi(). This adds */ +/* the Network Interface to the pNA+ Network Interface Table. */ +/* InstallNi() takes the following arguments: */ +/* */ +/* int (*entry)(); address of NI entry point */ +/* int ipadd; IP address */ +/* int mtu; maximum transmission length */ +/* int hwalen; length of hardware address */ +/* int flags; intErface flags */ +/* int subnetaddr; subnet mask */ +/* int dstipaddr; destination ip address */ +/* */ +/* See pSOSystem Programmer`s Reference Manual, Configuration Tables */ +/* Section, for more information about the Network Interface Table. */ +/* InstallNi() does not return a value. */ +/* */ +/* If you are adding a driver that needs to be initialized before */ +/* either pSOS+ is initialized or the driver's init function is */ +/* called, then you can call a setup function (that you create) for */ +/* the driver (for example, see the CnslSetup call for the serial */ +/* device driver). If your initialization function needs to allocate */ +/* memory, you may pass it the FreeMemPtr. The function should return */ +/* a new FreeMemPtr which points to the end of the memory it has */ +/* allocated. */ +/* */ +/* When adding code to install a new driver, it is a good idea to add */ +/* precompile checks so errors can be found during compile-time rather */ +/* then at run-time. Precompile checks are used, for example, in the */ +/* code that installs the pSOSystem serial device driver below. */ +/* */ +/***********************************************************************/ +UCHAR *SetUpNI(UCHAR *FreeMemPtr) +{ +int IPaddr; + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem NI. */ +/*---------------------------------------------------------------------*/ +#if BSP_LAN1 + if (SysVars.Lan1) + { + /*-------------------------------------------------------------*/ + /* If RARP is specified for the IP address, use it now to */ + /* obtain the IP address for this interface. */ + /*-------------------------------------------------------------*/ + if (SysVars.Lan1IP == USE_RARP) + { + #if (SC_DEV_DLPI && SE_SHARE_NI) + IPaddr = RarpEth((long (*)())DlpiEnet); + #else + IPaddr = RarpEth((long (*)())BSP_LAN1_ENTRY); + #endif + if (IPaddr == 0) + SysInitFail(RarpErrTimeout); + if (IPaddr == -1) + SysInitFail(RarpErrNet); + } + else + IPaddr = SysVars.Lan1IP; + + #if (SC_DEV_DLPI && SE_SHARE_NI) + InstallNi((int (*)())DlpiEnet, IPaddr, + #else + InstallNi((int (*)())BSP_LAN1_ENTRY, IPaddr, + #endif + BSP_LAN1_MTU, BSP_LAN1_HWALEN, BSP_LAN1_FLAGS, + SysVars.Lan1SubnetMask, 0); + } +#endif + +/*---------------------------------------------------------------------*/ +/* Install the shared memory NI. */ +/*---------------------------------------------------------------------*/ +#if BSP_SMEM + #if ((SC_NISM_LEVEL != 1) && (SC_NISM_LEVEL != 2)) + #error "Illegal value for SC_NISM_LEVEL" + #endif + + if (SysVars.Nism) + { + InstallNi((int (*)())NiSmem, SysVars.NismIP, NISM_MTU, 4, 0x8002, + SysVars.NismSubnetMask, 0); + + /*-------------------------------------------------------------*/ + /* Set up the NI Shared Memory driver by calling its function */ + /* "NiSmemSetup". */ + /*-------------------------------------------------------------*/ + FreeMemPtr = NiSmemSetup(SC_NISM_BUFFS, FreeMemPtr, + SC_NISM_LEVEL); + } +#endif +/*---------------------------------------------------------------------*/ +/* Additional Network drivers may be installed here. */ +/*---------------------------------------------------------------------*/ + +return FreeMemPtr; +} + +#endif diff --git a/h/wrn/wm/util/port/isisnmp/ppc222/sys_conf.h b/h/wrn/wm/util/port/isisnmp/ppc222/sys_conf.h new file mode 100644 index 0000000..a296065 --- /dev/null +++ b/h/wrn/wm/util/port/isisnmp/ppc222/sys_conf.h @@ -0,0 +1,734 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/isisnmp/ppc222/sys_conf.h,v 1.1.1.1 2001/11/05 17:47:10 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: sys_conf.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:10 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:22:59 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:10:05 meister + * Update copyright message + * + * Revision 1.2 1998/08/19 21:38:32 josh + * adding copyright stuff. + * + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + +/* @(#) pSOSystem x86/V2.2.6: apps.v22/xxxx/sys_conf.h (snmpv2 386) 3.21 98/01/12 10:03:13 */ +/***********************************************************************/ +/* */ +/* MODULE: sys_conf.h */ +/* DATE: 98/01/12 */ +/* PURPOSE: pSOSystem configuration definitions */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* Copyright 1991 - 1997, Integrated Systems, Inc. */ +/* ALL RIGHTS RESERVED */ +/* */ +/* Permission is hereby granted to licensees of Integrated Systems, */ +/* Inc. products to use or abstract this computer program for the */ +/* sole purpose of implementing a product based on Integrated */ +/* Systems, Inc. products. No other rights to reproduce, use, */ +/* or disseminate this computer program, whether in part or in */ +/* whole, are granted. */ +/* */ +/* Integrated Systems, Inc. makes no representation or warranties */ +/* with respect to the performance of this computer program, and */ +/* specifically disclaims any responsibility for any damages, */ +/* special or consequential, connected with the use of this program. */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* This is a header file which defines all of the system-level */ +/* parameters that are likely to need changing. */ +/* */ +/* It has been set up to be as close as possible to the settings */ +/* which are appropriate for this application. However, you may */ +/* need to make some changes to parameters to reflect your */ +/* environment, such as IP addresses, etc. */ +/* */ +/* Chapter 7 of the pSOSystem Getting Started manual contains a */ +/* complete description of the symbols that are defined in this */ +/* file. */ +/* */ +/***********************************************************************/ +#if __cplusplus +extern "C" { +#endif + +#ifndef _SYS_CONF_H +#define _SYS_CONF_H + +/***********************************************************************/ +/* */ +/* SC_APP_PARMS Must be defined before you include sysvars.h file. */ +/* Since "sysvars.h" file depends on SC_APP_PARMS and BSP_PARMS */ +/* to define the Storage Parms Structure. */ +/* */ +/* Defining this variable to a Non-Zero Value will create a space in */ +/* the Storage Parms. structure for your application use. */ +/* */ +/***********************************************************************/ +#define SC_APP_PARMS 0 +#define SC_APP_NAME "snmpv2 Application" + +/*---------------------------------------------------------------------*/ +/* types.h contains common definitions for example YES and NO */ +/*---------------------------------------------------------------------*/ +#include + +/***********************************************************************/ +/* sysvars.h contains the structures and definitions for the system */ +/* variables that are stored in NVRAM. These structures and */ +/* definitions are also used when creating the boot rom for the */ +/* target system. By using the same sysvars.h file it will insure the */ +/* consistency of the values stored by the boot rom and later read by */ +/* the downloaded application. */ +/***********************************************************************/ +#include + +/*---------------------------------------------------------------------*/ +/* include psos.h for defines IO_AUTOINIT and IO_NOAUTOINIT */ +/*---------------------------------------------------------------------*/ +#include + +/***********************************************************************/ +/* */ +/* These symbols are used to define other symbols in this file. */ +/* They should never be changed. */ +/* */ +/***********************************************************************/ +#define USE_RARP 0 + + +/***********************************************************************/ +/* */ +/* B A S I C P A R A M E T E R S */ +/* */ +/* The parameters in this section determine the fashion in which */ +/* many of the other parameters in this file will be used. */ +/* */ +/* Many of the parameters in this file have names beginning with */ +/* either "SC_" or "SD_". Those beginning with "SC_" are ALWAYS */ +/* controlled by the values you set in this file. The values of */ +/* the "SD_" parameters can be determined either by the definitions */ +/* given in this file, or by the data found in the target board's */ +/* parameter storage area. SC_SD_PARAMETERS determines this. If */ +/* SC_SD_PARAMETERS is "SYS_CONF", then the values given in this */ +/* file will be used for the SD_ parameters. If SC_SD_PARAMETERS */ +/* is "STORAGE", then pSOSystem will attempt to use the values found */ +/* in the board's parameter storage area for the SD_ variables. If */ +/* the parameter storage area has not been initialized or has been */ +/* corrupted, then the values given in this file will be used. They */ +/* will also be written to the storage area. */ +/* */ +/* If SC_SD_PARAMETERS is STORAGE, you may enable a "startup dialog" */ +/* which will allow you to view, and optionally change, the */ +/* parameter values found in the storage area. The dialog is enabled */ +/* by setting SC_STARTUP_DIALOG to YES. In this case, */ +/* SD_STARTUP_DELAY specifies the number of seconds that the dialog */ +/* will wait for input before proceeding to boot the system. */ +/* */ +/* SC_SD_DEBUG_MODE determines how the system will operate, as follows:*/ +/* */ +/* DBG_SA: Boot pROBE+ in standalone mode. */ +/* */ +/* DBG_XS: Boot into pROBE+ and wait for the host debugger */ +/* via a serial connection */ +/* */ +/* DBG_XN: Boot into pROBE+ and wait for the host debugger */ +/* via a network connection */ +/* */ +/* DBG_AP: Same as DBG_SA, but also does a pROBE+ "silent startup",*/ +/* meaning that pROBE+ initializes itself without */ +/* printing a startup banner. pROBE+ then initializes */ +/* pSOS+ and starts the application running. This mode */ +/* was created to simplify implementation of the pSOSystem */ +/* Boot ROMs. Note that when this mode is used, the value */ +/* you specify for RC_SMODE (see "pROBE+ Configuration */ +/* Parameters", below) is overridden. */ +/* */ +/* STORAGE: Use the mode (DBG_SA, DBG_XS, or DBG_XN) found in the */ +/* parameter storage area. If a valid mode is not found, */ +/* then use DBG_SA. */ +/* */ +/* An important consequence of using SC_SD_DEBUG_MODE=STORAGE should */ +/* be noted. If you use the TFTP bootloader in the pSOSystem ROMs */ +/* to download and start your system, you will be setting */ +/* SC_SD_DEBUG_MODE = DBG_AP in your target board's parameter storage */ +/* area. Thus, if you have left SC_SD_DEBUG_MODE set to STORAGE in */ +/* this file, your downloaded system will also use DBG_AP, meaning */ +/* that the application will begin running immediately after the */ +/* TFTP bootloader has loaded and started your system. */ +/* */ +/***********************************************************************/ +#define SC_SD_PARAMETERS STORAGE +#define SC_STARTUP_DIALOG NO +#define SC_BOOT_ROM NO +#define SD_STARTUP_DELAY 60 +#define SC_SD_DEBUG_MODE STORAGE + +/***********************************************************************/ +/* */ +/* O P E R A T I N G S Y S T E M C O M P O N E N T S */ +/* */ +/* Setting the definition line to YES will cause that component to */ +/* be built into the system. NO means the component will NOT be */ +/* put into the system. It is an error to specify both SC_PSOS */ +/* and SC_PSOSM as present! */ +/* */ +/***********************************************************************/ +#define SC_PSOS YES /* pSOS+ real-time kernel */ +#define SC_PSOSM NO /* pSOS+ real-time multiproc kernel */ +#define SC_PROBE YES /* pROBE+ (processor svcs) */ +#define SC_PROBE_DISASM YES /* pROBE+ (disassembler) */ +#define SC_PROBE_DASM_INTEL NO /* pROBE+ (Intel format disassembler) */ + /* for x86 Targets Only */ +#define SC_PROBE_CIE YES /* pROBE+ (console executive) */ +#define SC_PROBE_QUERY YES /* pROBE+ (query services) */ +#define SC_PROBE_DEBUG YES /* pROBE+ (debug interface executive) */ +#define SC_PHILE YES /* pHILE+ file system manager */ +#define SC_PREPC YES /* pREPC+ C run-time library */ +#define SC_PNA YES /* pNA+ TCP/IP networking manager */ +#define SC_PRPC YES /* pRPC+ RPC component */ +#define SC_PSE NO /* pSE+ streams component */ +#define SC_PSKT NO /* pSKT+ SKT library component */ +#define SC_PTLI NO /* pTLI+ TLI library component */ +#define SC_PMONT NO /* pMONT+ */ +#define SC_PROFILER NO /* Profiler is enabled/Disabled */ + +/*---------------------------------------------------------------------*/ +/* If set to IO_AUTOINIT device drivers that are installed be the */ +/* InstallDriver function will have their autoinit field set. This */ +/* will cause pSOS+ call the drivers initialization function when */ +/* pSOS+ starts up. The de_init call will not have to be called for */ +/* each driver if this is done. */ +/* */ +/* NOTE: This Auto Initialization will not work on all drivers. */ +/* Setting IO_AUTOINIT only effects drivers that can use the Auto */ +/* Initialization feature. */ +/* */ +/* If set to IO_NOAUTOINIT no automatic driver initialization will */ +/* happen. */ +/*---------------------------------------------------------------------*/ +#define SC_AUTOINIT IO_AUTOINIT + +/*---------------------------------------------------------------------*/ +/* If SC_PMONT SC_AUTOINIT will always be set to 1 because pMONT needs */ +/* drivers to be automatically initialized. */ +/*---------------------------------------------------------------------*/ +#if SC_PMONT + #undef SC_AUTOINIT + #define SC_AUTOINIT IO_AUTOINIT +#endif + +/***********************************************************************/ +/* */ +/* S E R I A L C H A N N E L C O N F I G U R A T I O N */ +/* */ +/* * SD_DEF_BAUD specifies the default baud rate to be used for the */ +/* serial channels */ +/* * SC_APP_CONSOLE specifies the serial channel number (starting */ +/* from 1) which should be used for the application's "console". */ +/* * SC_PROBE_CONSOLE specifies the serial channel number (starting */ +/* from 1) which pROBE+ should use to display output and receive */ +/* commands, or to communicate with the host debugger. */ +/* * SC_PROBE_HOST specifies the serial channel number (starting */ +/* from 1) which should be used for the pROBE+ "host" channel. */ +/* This is not normally required, so it can be disabled by */ +/* using a value of 0. The host channel is explained in the */ +/* pROBE+ User's Manual. */ +/* */ +/***********************************************************************/ +#define SD_DEF_BAUD 9600 +#define SC_APP_CONSOLE 1 +#define SC_PROBE_CONSOLE 1 +#define SC_RBUG_PORT 0 + +/***********************************************************************/ +/* SC_NumNon_pSOSChan is the number of non pSOS users of serial */ +/* channels. These are users that will be initiated before pSOS */ +/* such as pROBE. */ +/* NOTE: These channels will not be closed on a soft reset. */ +/***********************************************************************/ +#if (SC_RBUG_PORT && SC_PROBE_CONSOLE && (SC_PROBE_CONSOLE != PCCON)) +#define SC_NumNon_pSOSChan 2 +#else +#define SC_NumNon_pSOSChan 1 +#endif + +/***********************************************************************/ +/* */ +/* L A N C O N F I G U R A T I O N */ +/* */ +/* */ +/***********************************************************************/ +#define SD_LAN1 YES +#define SD_LAN1_IP 0x80e001b7 +#define SD_LAN1_SUBNET_MASK 0xffffff00 + +/*---------------------------------------------------------------------*/ +/* Maximum number of multicast addresses to be used by the lan */ +/* interface. Must not exceed maximum supported by the lan driver. */ +/*---------------------------------------------------------------------*/ +#define SC_LAN1_NMCAST 0 + +/***********************************************************************/ +/* */ +/* S H A R E D M E M O R Y C O N F I G U R A T I O N */ +/* */ +/* */ +/***********************************************************************/ + +/***********************************************************************/ +/* */ +/* B U S C O N F I G U R A T I O N */ +/* */ +/* */ +/***********************************************************************/ +#define SD_VME_BASE_ADDR 0x01000000 + +/*---------------------------------------------------------------------*/ +/* If you want to build a Shared Memory Interface for the network or */ +/* multi-processing pSOS+m, set SD_SM_NODE (a non-zero value) to the */ +/* node number of THIS node. */ +/*---------------------------------------------------------------------*/ +#define SD_SM_NODE 0 + +/*---------------------------------------------------------------------*/ +/* Shared memory network interface - SC_NISM_LEVEL should be 1 if this */ +/* will be the FIRST system to use the SMNI on this board. It should */ +/* be 2 if this will not be the first system to use the SMNI on this */ +/* board. Usually this means that SC_NISM_LEVEL should be 1 if you */ +/* are building Boot ROMs, and 2 for a system that will be downloaded */ +/* and started using the Boot ROMs. See the comments at the beginning */ +/* of drivers/ni_smem.c for more explanation. */ +/*---------------------------------------------------------------------*/ +#define SD_NISM NO +#define SD_NISM_IP 0x00000000 +#define SD_NISM_DIRADDR 0x00000400 +#define SC_NISM_BUFFS 30 +#define SC_NISM_LEVEL 2 +#define SD_NISM_SUBNET_MASK 0 + + +/*---------------------------------------------------------------------*/ +/* If you want to build a multi-node pSOS+m system, set SD_KISM */ +/* to the number of nodes in the system. */ +/*---------------------------------------------------------------------*/ +#define SD_KISM 0 +#define SD_KISM_DIRADDR 0x00000580 + + +/***********************************************************************/ +/* */ +/* M I S C E L L A N E O U S N E T W O R K I N G */ +/* P A R A M E T E R S */ +/* */ +/***********************************************************************/ +#define SD_DEF_GTWY_IP 0 + + +/***********************************************************************/ +/* SC_RAM_SIZE */ +/* */ +/* Normally, pSOSystem uses ALL of the memory remaining on a board for */ +/* dynamic allocation ("region 0"). You may override this by setting */ +/* SC_RAM_SIZE to a non-zero value. If you do, pSOSystem will not */ +/* touch any memory after address (BSP_RAM_BASE + SC_RAM_SIZE - 1). */ +/* */ +/* NOTE: This is useful when making a BOOT ROM and you want to ensure */ +/* that the ROM's RAM area does not overflow the space alloted for it. */ +/***********************************************************************/ +#define SC_RAM_SIZE 0 + +/***********************************************************************/ +/* */ +/* I / O D E V I C E S */ +/* */ +/* Each device may be included in the system by specifying a major */ +/* number for it, which determines its slot in the pSOS+ I/O switch */ +/* table. To leave a device driver out of the system, use NO for */ +/* the major number. */ +/* */ +/* Note the following: */ +/* * Major device 0 is reserved and cannot be used for any of these */ +/* devices. Setting a device number to 0 here is the same as NO. */ +/* * No device number may be higher than SC_DEVMAX (SC_DEVMAX may */ +/* be increased, if desired) */ +/* * The lines defining the symbols DEV_SERIAL, DEV_TIMER, etc, */ +/* should not be changed. These are for use by application */ +/* programs as the "device number" parameter on de_* calls. */ +/* */ +/***********************************************************************/ +#define SC_DEV_SERIAL 1 /* Serial driver */ +#define SC_DEV_TIMER 2 /* Periodic tick timer */ +#define SC_DEV_RAMDISK NO /* RAM disk */ +#define SC_DEV_CONSOLE 4 /* PC-Console driver */ +#define SC_DEV_SCSI NO /* SCSI bus */ +#define SC_DEV_SCSI_TAPE NO /* SCSI bus, tape device */ +#define SC_DEV_IDE NO /* IDE Driver */ +#define SC_DEV_FLOPPY NO /* Floppy Driver */ +#define SC_DEV_TFTP NO /* TFTP pseudo driver */ +#define SC_DEV_SPI NO /* SPI driver */ +#define SC_DEV_DLPI NO /* DLPI pseudo driver */ +#define SC_DEV_OTCP NO /* 12 TCP/IP for OpEN */ +#define SC_IP SC_DEV_OTCP /* 12 IP */ +#define SC_ARP NO /* 13 ARP */ +#define SC_TCP NO /* 14 TCP */ +#define SC_UDP NO /* 15 UDP */ +#define SC_RAW NO /* 16 RAW */ +#define SC_LOOP NO /* 17 LOOP = (SC_DEV_OTCP + 5) */ +#define SC_DEV_SOSI NO /* 18 OSI for OpEN */ +#define SC_DEV_PSEUDO NO /* PSEUDO driver */ +#define SC_DEV_PARALLEL NO /* Parallel Port Driver */ +#define SC_DEV_CMOS NO /* CMOS Driver */ +#define SC_DEV_WATCHDOG NO /* Watchdog Driver */ +#define SC_DEV_OLAP NO /* LAP Driver */ +#define SC_PHPI (SC_DEV_OLAP) /* Phpi driver */ +#define SC_LAPB (SC_DEV_OLAP + 0)/* LAPB driver Change 0 to 1 */ +#define SC_CLAPB (SC_DEV_OLAP + 0)/* LAPB driver Change 0 to 2 */ +#define SC_DEV_OX25 (SC_DEV_OLAP + 0)/* LAPB driver Change 0 to 3 */ +#define SC_X25 (SC_DEV_OX25) /* X25 driver */ +#define SC_CX25 (SC_DEV_OX25 + 0)/* X25 driver Change 0 to 1 */ +#define SC_SNDCF NO /* sndcf driver */ +#define SC_CSNDCF NO /* csndcf driver */ +#define SC_IPCONV NO +#define SC_CIPCONV NO + +#define SC_DEVMAX 32 /* Maximum device number */ + +#define DEV_SERIAL (SC_DEV_SERIAL << 16) +#define DEV_PARALLEL (SC_DEV_PARALLEL << 16) +#define DEV_TIMER (SC_DEV_TIMER << 16) +#define DEV_RAMDISK (SC_DEV_RAMDISK << 16) +#define DEV_SCSI (SC_DEV_SCSI << 16) +#define DEV_SCSI_TAPE (SC_DEV_SCSI_TAPE << 16) +#define DEV_PSEUDO (SC_DEV_PSEUDO << 16) +#define DEV_DLPI (SC_DEV_DLPI << 16) +#define DEV_TFTP (SC_DEV_TFTP << 16) +#define DEV_SPI (SC_DEV_SPI << 16) +#define DEV_WATCHDOG (SC_DEV_WATCHDOG << 16) +#define DEV_FLOPPY (SC_DEV_FLOPPY << 16) +#define DEV_IDE (SC_DEV_IDE << 16) +#define DEV_CMOS (SC_DEV_CMOS << 16) +#define DEV_CONSOLE (SC_DEV_CONSOLE << 16) + +#if (BSP_CPUFAMILY == FAMILY_X86) && (SC_APP_CONSOLE == PCCON) + #define CONSOLE DEV_CONSOLE +#else + #define CONSOLE DEV_SERIAL +#endif + +/***********************************************************************/ +/* */ +/* M E M O R Y M A N A G E M E N T L I B R A R Y P A R A M S */ +/* */ +/***********************************************************************/ +#define SC_MMULIB NO + +/***********************************************************************/ +/* */ +/* C O M P O N E N T C O N F I G U R A T I O N P A R A M E T E R S */ +/* */ +/* These parameters should work as is for this application. You */ +/* may want to change some of them if you start customizing this */ +/* application. */ +/* */ +/***********************************************************************/ + +/*---------------------------------------------------------------------*/ +/* pSOS+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define KC_RN0USIZE 0x100 /* region 0 unit size */ +#define KC_NTASK 25 /* max number of tasks */ +#define KC_NQUEUE 10 /* max number of message queues */ +#define KC_NSEMA4 30 /* max number of semaphores */ +#define KC_NMSGBUF 256 /* max number of message buffers */ +#define KC_NTIMER 10 /* max number of timers */ +#define KC_NLOCOBJ 50 /* max number of local objects */ +#define KC_TICKS2SEC 100 /* clock tick interrupt frequency */ +#define KC_TICKS2SLICE 10 /* time slice quantum, in ticks */ +#define KC_INTSTK 0x2000 /* interrupt stack size */ +#define KC_SYSSTK 0x2000 /* pSOS+ system stack size (bytes) */ +#define KC_ROOTSSTK 0x4000 /* ROOT supervisor stack size */ +#define KC_ROOTUSTK 0 /* ROOT user stack size */ +#define KC_ROOTMODE (T_SUPV | T_ISR) /* ROOT initial mode */ +#define KC_ROOTPRI 230 /* ROOT task priority */ + +/*---------------------------------------------------------------------*/ +/* The following are examples for modifying the following defines */ +/* */ +/* Using a pSOSystem routine as a fatal error handler */ +/* #define KC_FATAL ((void (*)()) SysInitFail) */ +/* */ +/* Using a user written routine as a fatal error handler */ +/* extern void MyHandler (void); */ +/* #define KC_FATAL ((void (*)()) MyHandler) */ +/* */ +/*---------------------------------------------------------------------*/ +#define KC_STARTCO 0 /* callout at task activation */ +#define KC_DELETECO 0 /* callout at task deletion */ +#define KC_SWITCHCO 0 /* callout at task switch */ + +#define KC_FATAL 0 /* fatal error handler address */ +#define KC_IDLECO 0 /* Idle Task Callout */ +#define KC_RTCINITCO 0 /* RTC INIT Callout */ + +/*---------------------------------------------------------------------*/ +/* pSOS+m configuration parameters */ +/*---------------------------------------------------------------------*/ +#define MC_NGLBOBJ 8 /* size of gbl obj table */ +#define MC_NAGENT 10 /* number of RPC agents in this node */ +#define MC_FLAGS SEQWRAP_ON /* operating mode flags */ + +/*---------------------------------------------------------------------*/ +/* The following are examples for modifying the following definition */ +/* */ +/* Using a pSOSystem routine as a roster change handler */ +/* #define MC_ROSTER ((void (*)()) SysInitFail) */ +/* */ +/* Using a user written routine as a roster change handler */ +/* extern void MyHandler (void); */ +/* #define MC_ROSTER ((void (*)()) MyHandler) */ +/* */ +/*---------------------------------------------------------------------*/ +#define MC_ROSTER 0 /* addr of user roster change callout */ +#define MC_KIMAXBUF 100 /* maximum KI packet buffer length */ +#define MC_ASYNCERR 0 /* asynchronous calls error callout */ + +/*---------------------------------------------------------------------*/ +/* pROBE configuration parameters - note that the SMODE flag bits are */ +/* irrelevant if SC_SD_DEBUG_MODE = DBG_AP. */ +/*---------------------------------------------------------------------*/ +#define TD_BRKOPC 0xCC /* Instruction break opcode */ +#define TD_ILEV (1 << 12)/* pROBE+ interrupt mask */ +#define TD_FLAGS (NODOTS_MASK | TD_ILEV | NOTUPD_MASK)/* flags */ +#define TD_DBGPRI 244 /* Debugger task priority */ + +/*---------------------------------------------------------------------*/ +/* The variable defined down should be set to the Starting address for */ +/* for pROBE+ DATA AREA. This is required by all the smaller boards. */ +/* NOTE: */ +/* Setting of this value should have atleast 0x4400 bytes Free */ +/* Space from that location. */ +/*---------------------------------------------------------------------*/ +#define TD_DATASTART 0x0 + +/*---------------------------------------------------------------------*/ +/* pHILE+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define FC_LOGBSIZE 9 /* Block size (base-2 exponent) */ +#define FC_NBUF 6 /* Number of cache buffers */ +#define FC_NMOUNT 3 /* Max # of mounted volumes */ +#define FC_NFCB 10 /* Max # of opened files per system */ +#define FC_NCFILE 2 /* Max # of opened files per task */ +#define FC_NDNLC 0 /* Max # of cached directory entries */ +#define FC_MSDOS 1 /* MS-DOS volume mount flag */ +#define FC_CDROM 0 /* CD-ROM volume mount flag */ + +/*---------------------------------------------------------------------*/ +/* pREPC+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define LC_BUFSIZ 128 /* I/O buffer size */ +#define LC_NUMFILES 5 /* Max number of open files per task */ +#define LC_WAITOPT 0 /* Wait option for memory allocation */ +#define LC_TIMEOPT 0 /* Timeout option for mem allocation */ +#define LC_SSIZE 512 /* Size of print buffer */ + +/*---------------------------------------------------------------------*/ +/* pNA+ configuration parameters */ +/* */ +/* NOTE: If you get pNA+ errno 5F01 FAT_INSUFFMEM you may need to */ +/* decrease the number of buffers allocated here for pNA+. */ +/* In general this error means pNA+ could not allocate enough */ +/* memory from Region 0 for the number of buffers requested. */ +/*---------------------------------------------------------------------*/ +#define NC_NNI 5 /* size of pNA NI Table */ +#define NC_NROUTE 10 /* size of pNA Routing Table */ +#define NC_NARP 20 /* size of pNA ARP table */ +#define NC_DEFUID 0 /* Default User ID of a task */ +#define NC_DEFGID 0 /* Default Group ID of a task */ +#define NC_HOSTNAME "scg" /* Hostname of the node */ +#define NC_NHENTRY 8 /* Number of Host table entries */ + +#define NC_NMCSOCS 0 /* Number of IP multicast sockets */ +#define NC_NMCMEMB 0 /* Number of distict IP multicast */ + /* group memberships per interface */ + +#define NC_NNODEID 0 /* Network NODE ID for unnumbered link */ + +#define NC_NSOCKETS 128 /* Number of sockets in the system */ +#define NC_NDESCS 128 /* # of socket descriptors/task */ +#define NC_MBLKS 300 /* # of message blocks in the system */ + +#define NC_BUFS_0 64 /* number of 0 length buffers */ +#define NC_BUFS_32 0 /* number of 32 length buffers */ +#define NC_BUFS_64 0 /* number of 64 length buffers */ +#define NC_BUFS_128 256 /* number of 128 byte buffers */ +#define NC_BUFS_256 0 /* number of 256 byte buffers */ +#define NC_BUFS_512 0 /* number of 512 byte buffers */ +#define NC_BUFS_1024 16 /* number of 1k byte buffers */ +#define NC_BUFS_2048 48 /* number of 2k byte buffers */ +#define NC_BUFS_4096 0 /* number of 4k byte buffers */ + +#define NC_MAX_BUFS 9 /* max number of NC_BUFS types */ + +/*---------------------------------------------------------------------*/ +/* The following are examples for modifying the following defines */ +/* */ +/* Using a user written routine as a pNA+ Signal Handler */ +/* extern void MySigHandler (void); */ +/* #define NC_SIGNAL ((void (*)()) MySigHandler) */ +/* */ +/*---------------------------------------------------------------------*/ +#define NC_SIGNAL 0 /* pNA+ Signal Hdlr */ + +/*---------------------------------------------------------------------*/ +/* pSE+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define SE_NBUFS_0 64 /* number of 0 length buffers */ +#define SE_NBUFS_32 128 /* number of 32 byte buffers */ +#define SE_NBUFS_64 128 /* number of 64 byte buffers */ +#define SE_NBUFS_128 256 /* number of 128 byte buffers */ +#define SE_NBUFS_256 32 /* number of 256 byte buffers */ +#define SE_NBUFS_512 32 /* number of 512 byte buffers */ +#define SE_NBUFS_1024 16 /* number of 1k byte buffers */ +#define SE_NBUFS_2048 16 /* number of 2k byte buffers */ +#define SE_NBUFS_4096 8 /* number of 4k byte buffers */ +#define SE_MAX_BUFS 9 /* max number of stream buffer types */ + +#define SE_MAX_MODULES 3 /* max number of streams modules */ +#define SE_SHARE_NI NO /* LAN-NI with streams? */ + +#define SE_DATA_SIZE 0x0C00 /* size of pSE data area */ + /* (must be at least 3K) */ +#define SE_TASK_PRIO 250 /* priority for pSE task */ +#define SE_STACK_SIZE 0x2000 /* stack size for pSE task */ +#define SE_DEF_UID 0 /* default user id */ +#define SE_DEF_GID 0 /* default group id */ +#define SE_N_FDS 32 /* max # of system-wide */ + /* stream descriptors */ +#define SE_N_TASKFDS 8 /* max # of per-task stream */ + /* descriptors */ +#define SE_N_LINKS 32 /* max # of multiplexing links */ +#define SE_N_TIMEOUTS 32 /* max # of timeout requests */ +#define SE_N_BUFCALLS 32 /* max # of bufcall requests */ +#define SE_N_QUEUES 256 /* # of queues */ +#define SE_N_MBLKS 512 /* reserved for future use, must be 0 */ + +/*---------------------------------------------------------------------*/ +/* Loader configuration parameters */ +/* */ +/* YES indicates for each module to be linked in. NO means do not link */ +/* object module loader into this application. */ +/* */ +/*---------------------------------------------------------------------*/ +#define LD_MAX_LOAD 8 /* Max. # of active loads */ +#define LD_ELF_MODULE NO /* ELF object-load-module */ +#define LD_SREC_MODULE NO /* SREC object-load-module */ +#define LD_COFF_MODULE NO /* COFF object-load-module */ +#define LD_IEEE_MODULE NO /* IEEE object-load-module */ +#define LD_IHEX_MODULE NO /* IHEX object-load-module */ + +/*---------------------------------------------------------------------*/ +/* pMONT+ configuration parameters - note that PM_DEV and PM_BAUD are */ +/* only relevant to serial communication (PM_CMODE = 2) */ +/*---------------------------------------------------------------------*/ +#define PM_CMODE 1 /* 1 = networking, 2 = serial */ +#define PM_DEV 2 /* Minor Device number for */ + /* serial channel if used */ +#define PM_BAUD 9600 /* Baud rate for serial chnl */ +#define PM_TRACE_BUFF 0 /* Address of trace buffer -- */ + /* Allocated by pSOSystem if 0 */ +#define PM_TRACE_SIZE 0x6000 /* Size of trace buffer */ +#define PM_TIMER NO /* 2nd timer for finer time */ + /* within data collection */ + +/*---------------------------------------------------------------------*/ +/* General Serial Block Configuration Parameters */ +/*---------------------------------------------------------------------*/ +#define GS_BUFS_0 64 /* number of 0 length buffers */ +#define GS_BUFS_32 128 /* number of 32 byte buffers */ +#define GS_BUFS_64 128 /* number of 64 byte buffers */ +#define GS_BUFS_128 256 /* number of 128 byte buffers */ +#define GS_BUFS_256 32 /* number of 256 byte buffers */ +#define GS_BUFS_512 32 /* number of 512 byte buffers */ +#define GS_BUFS_1024 16 /* number of 1k byte buffers */ +#define GS_BUFS_2048 16 /* number of 2k byte buffers */ +#define GS_BUFS_4096 8 /* number of 4k byte buffers */ + +#define GS_MBLKS 680 +#define GS_MAX_BUFS 9 /* max number of serial buffer types */ + +/*---------------------------------------------------------------------*/ +/* TCP/IP for OpEN configuration parameters */ +/*---------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for the Network layer (IP) */ +/*---------------------------------------------------------------------*/ +#define OTCP_IPMAX 8 /* Max # of open IP device */ +#define OTCP_IPNINTERFACES 4 /* Max # of network interfaces */ +#define OTCP_IPNROUTES 64 /* Max #of routing tbl entries */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for ARP */ +/*---------------------------------------------------------------------*/ +#define OTCP_ARPMAX 8 /* Max # of open ARP device */ +#define OTCP_ARPNINTERFACES 4 /* Max # of ARP interfaces */ +#define OTCP_ARPNENTRIES 32 /* Max # of ARP table entries */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for TCP */ +/*---------------------------------------------------------------------*/ +#define OTCP_TCPMAX 64 /* Max # of open TCP device */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for UDP */ +/*---------------------------------------------------------------------*/ +#define OTCP_UDPMAX 32 /* Max # of open UDP device */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for RAW */ +/*---------------------------------------------------------------------*/ +#define OTCP_RAWMAX 32 /* Max # of open RAW device */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for LOOP */ +/*---------------------------------------------------------------------*/ +#define OTCP_LOOPMAX 2 /* Max # of open LOOP device */ + + + +#endif /* _SYS_CONF_H */ + +#if __cplusplus +} +#endif diff --git a/h/wrn/wm/util/port/isisnmp/ppc250/config.mk b/h/wrn/wm/util/port/isisnmp/ppc250/config.mk new file mode 100644 index 0000000..a99f58f --- /dev/null +++ b/h/wrn/wm/util/port/isisnmp/ppc250/config.mk @@ -0,0 +1,499 @@ +#* @(#) pSOSystem PowerPC/V2.5.0: configs/ppc/config.mk 4.23 98/11/11 06:51:23 * +#*********************************************************************** +#* * +#* MODULE: configs/std/config.mk * +#* DATE: 98/11/11 * +#* PURPOSE: Macro definitions, linker commands, etc, for "make" * +#* * +#*---------------------------------------------------------------------* +#* * +#* Copyright 2000-2001 Wind River Systems, Inc. +#* Copyright 1991 - 1998, Integrated Systems, Inc. * +#* ALL RIGHTS RESERVED * +#* * +#* Permission is hereby granted to licensees of Integrated Systems, * +#* Inc. products to use or abstract this computer program for the * +#* sole purpose of implementing a product based on Integrated * +#* Systems, Inc. products. No other rights to reproduce, use, * +#* or disseminate this computer program, whether in part or in * +#* whole, are granted. * +#* * +#* Integrated Systems, Inc. makes no representation or warranties * +#* with respect to the performance of this computer program, and * +#* specifically disclaims any responsibility for any damages, * +#* special or consequential, connected with the use of this program. * +#* * +#*---------------------------------------------------------------------* +#*********************************************************************** +# +#------------------------------------------------------------------------ +# Compiler commands and command-line options +#------------------------------------------------------------------------ +# Add following option to COPTS_FILE2 to generate listing files +# -W:as:,-l -Xpass-source +#------------------------------------------------------------------------ +CC = @echo "Making $@ \tfrom $<";dcc +CXX = @echo "Making $@ \tfrom $<";dplus +COMP_OPTS1 = -O -t$(DTARGET)E$(DFP):psos -Xstruct-best-align=0 +COMP_OPTS2 = -Xstrict-ansi $(PSS_APPCOPTS) -D__DIAB -DPPC +COPTS_FILE1 = -I. -I$(PSS_ROOT)/include -I$(PSS_BSP) $(PSS_APPINCS) +COPTS_FILE2 = -I$(PSS_ROOT)/bsps/devices $(PSS_VINCLUDE) -I@ -c +CXX_OPTS = -Xexception +#------------------------------------------------------------------------ +# COPT_PER_FILE is used to provide a convenient way to add per +# file compile options. If a .cop file for a source file exist then +# content of this file is passed as the compile options. +#------------------------------------------------------------------------ +COPT_PER_FILE=`if [ -f ./$(*F).cop ]; then cat ./$(*F).cop; fi` + +COPTS = -@c.opt $(COPT_PER_FILE) +CXXOPTS = -@cxx.opt $(COPT_PER_FILE) + +#------------------------------------------------------------------------ +# TARGET_CPU is used in application makefiles to pass on to incremental +# linking and other tools. +#------------------------------------------------------------------------ +TARGET_CPU = -t$(DTARGET)E$(DFP):psos + +#------------------------------------------------------------------------ +# Assembler command-line options +#------------------------------------------------------------------------ +AS = @echo "Making $@ \tfrom $<";das + +#------------------------------------------------------------------------ +# Added target switch for the assembler +# The target definition is located in bsp.mk of the bsp you are using +#------------------------------------------------------------------------ +# Add following option to AOPTS_FILE1 to generate listing files -l +#------------------------------------------------------------------------ +AOPTS_FILE1 = -I. $(PSS_APPINCS) -I$(PSS_ROOT)/include -I$(PSS_BSP) +AOPTS_FILE2 = -I$(PSS_ROOT)/bsps/devices $(PSS_VINCLUDE) -I@ +AOPTS_FILE3 = -t$(DTARGET)E$(DFP) +AOPTS = -@a.opt $(COPT_PER_FILE) + +#------------------------------------------------------------------------ +# Linker command name +#------------------------------------------------------------------------ +LD = dld +LOPTS = -t$(DTARGET)E$(DFP) -Xsuppress-dot -Xreloc-bug -m2 $(PSS_APPLOPTS) + +#------------------------------------------------------------------------ +# Librarian command name and options +#------------------------------------------------------------------------ +LIB = dar +LIBOPTS = -qf +LIBOPTS_SORT = -sR + +#======================================================================== +# Link everything together +#======================================================================== +CFG1_OBJS= sysinit.o bspcfg.o pnacfg.o prepccfg.o dialog.o +CFG2_OBJS= probecfg.o prpccfg.o psecfg.o psoscfg.o pmontcfg.o +CFG3_OBJS= pollio.o philecfg.o gsblkcfg.o plmcfg.o pnetcfg.o +CFG4_OBJS= ldcfg.o posixcfg.o rtacfg.o + +ram.elf: cxx.opt c.opt a.opt ill.opt begin.o \ + makefile \ + ram.dld \ + $(CFG1_OBJS) \ + $(CFG2_OBJS) \ + $(CFG3_OBJS) \ + $(CFG4_OBJS) \ + $(PSS_DRVOBJS) \ + $(PSS_APPOBJS) \ + $(PSS_BSP)/libbsp.a \ + $(PSS_ROOT)/sys/os/libsys.a \ + $(PSS_ROOT)/sys/libc/libprepc$(DFP).a \ + $(PSS_ROOT)/sys/libc/libpnet.a + @echo $(LOPTS) -o ram.elf -Wm ram.dld begin.o > l.opt + @echo -L $(PSS_BSP) -L $(PSS_ROOT)/sys/os >> l.opt + @echo -L $(PSS_ROOT)/sys/libc $(PSS_APPLINKS) >> l.opt + @echo $(PSS_VLINK) >> l.opt + @echo $(CFG1_OBJS) >> l.opt + @echo $(CFG2_OBJS) >> l.opt + @echo $(CFG3_OBJS) >> l.opt + @echo $(CFG4_OBJS) >> l.opt + @echo $(PSS_APPOBJS) >> l.opt + @echo -m3 $(APP_LIB1) >> l.opt + @echo -m3 $(APP_LIB2) >> l.opt + @echo -m3 $(APP_LIB3) >> l.opt + @echo -m3 $(APP_LIB4) >> l.opt + @echo -m3 $(APP_LIB5) >> l.opt + @echo $(PSS_DRVOBJS) >> l.opt + @echo -m3 $(DRV_LIB1) >> l.opt + @echo -m3 $(DRV_LIB2) >> l.opt + @echo -m3 $(DRV_LIB3) >> l.opt + @echo -m3 $(DRV_LIB4) >> l.opt + @echo -m3 $(DRV_LIB5) >> l.opt + @echo -lbsp -ldrv >> l.opt + @echo -lsys >> l.opt + @echo -lprepc$(DFP) -lpnet -lquery >> l.opt + @echo -m3 $(FIX_LIB) >> l.opt + @echo $(PSS_COMPLIB) >> l.opt + $(LD) -@l.opt > ram.map + ddump -tv ram.elf >> ram.map + +ram.dld: $(PSS_BSP)/anchor.dld \ + $(PSS_BSP)/ram.dld + @cat $(PSS_BSP)/ram.dld > ram.dld + @cat $(PSS_BSP)/anchor.dld >> ram.dld + +ram.hex: ram.elf + ddump -Rv ram.elf -o ram.hex + +rom.elf: cxx.opt c.opt a.opt ill.opt begin.o \ + makefile \ + rom.dld \ + $(CFG1_OBJS) \ + $(CFG2_OBJS) \ + $(CFG3_OBJS) \ + $(CFG4_OBJS) \ + $(PSS_DRVOBJS) \ + $(PSS_BSP)/libbsp.a \ + $(PSS_APPOBJS) \ + $(PSS_ROOT)/sys/os/libsys.a \ + $(PSS_ROOT)/sys/libc/libprepc$(DFP).a \ + $(PSS_ROOT)/sys/libc/libpnet.a + @echo $(LOPTS) -o rom.elf -Wm rom.dld begin.o > l.opt + @echo -L $(PSS_BSP) -L $(PSS_ROOT)/sys/os >> l.opt + @echo -L $(PSS_ROOT)/sys/libc $(PSS_APPLINKS) >> l.opt + @echo $(PSS_VLINK) >> l.opt + @echo $(CFG1_OBJS) >> l.opt + @echo $(CFG2_OBJS) >> l.opt + @echo $(CFG3_OBJS) >> l.opt + @echo $(CFG4_OBJS) >> l.opt + @echo $(PSS_APPOBJS) >> l.opt + @echo -m3 $(APP_LIB1) >> l.opt + @echo -m3 $(APP_LIB2) >> l.opt + @echo -m3 $(APP_LIB3) >> l.opt + @echo -m3 $(APP_LIB4) >> l.opt + @echo -m3 $(APP_LIB5) >> l.opt + @echo $(PSS_DRVOBJS) >> l.opt + @echo -m3 $(DRV_LIB1) >> l.opt + @echo -m3 $(DRV_LIB2) >> l.opt + @echo -m3 $(DRV_LIB3) >> l.opt + @echo -m3 $(DRV_LIB4) >> l.opt + @echo -m3 $(DRV_LIB5) >> l.opt + @echo -lbsp -ldrv >> l.opt + @echo -lsys >> l.opt + @echo -lprepc$(DFP) -lpnet -lquery >> l.opt + @echo -m3 $(FIX_LIB) >> l.opt + @echo $(PSS_COMPLIB) >> l.opt + $(LD) -@l.opt > rom.map + ddump -tv rom.elf >> rom.map + +rom.dld: $(PSS_BSP)/anchor.dld \ + $(PSS_BSP)/rom.dld + @cat $(PSS_BSP)/rom.dld > rom.dld + @cat $(PSS_BSP)/anchor.dld >> rom.dld + +rom.hex: rom.elf + ddump -Rv rom.elf -o rom.hex + +os.elf: cxx.opt c.opt a.opt ill.opt begin.o \ + makefile \ + os.dld \ + $(CFG1_OBJS) \ + $(CFG2_OBJS) \ + $(CFG3_OBJS) \ + $(CFG4_OBJS) \ + $(PSS_DRVOBJS) \ + $(PSS_BSP)/libbsp.a \ + $(PSS_ROOT)/sys/os/libsys.a \ + $(PSS_ROOT)/sys/libc/libprepc$(DFP).a \ + $(PSS_ROOT)/sys/libc/libpnet.a + @echo $(LOPTS) -o os.elf -Wm os.dld begin.o > l.opt + @echo -L $(PSS_BSP) -L $(PSS_ROOT)/sys/os >> l.opt + @echo -L $(PSS_ROOT)/sys/libc $(PSS_APPLINKS) >> l.opt + @echo $(PSS_VLINK) >> l.opt + @echo $(CFG1_OBJS) >> l.opt + @echo $(CFG2_OBJS) >> l.opt + @echo $(CFG3_OBJS) >> l.opt + @echo $(CFG4_OBJS) >> l.opt + @echo $(PSS_DRVOBJS) >> l.opt + @echo -m3 $(DRV_LIB1) >> l.opt + @echo -m3 $(DRV_LIB2) >> l.opt + @echo -m3 $(DRV_LIB3) >> l.opt + @echo -m3 $(DRV_LIB4) >> l.opt + @echo -m3 $(DRV_LIB5) >> l.opt + @echo -lbsp -ldrv >> l.opt + @echo -lsys >> l.opt + @echo -lprepc$(DFP) -lpnet -lquery >> l.opt + @echo -m3 $(FIX_LIB) >> l.opt + @echo $(PSS_COMPLIB) >> l.opt + $(LD) -@l.opt > os.map + ddump -tv os.elf >> os.map + +os.dld: $(PSS_BSP)/anchor.dld \ + $(PSS_BSP)/os.dld + @cat $(PSS_BSP)/os.dld > os.dld + @cat $(PSS_BSP)/anchor.dld >> os.dld + +os.hex: os.elf + ddump -Rv os.elf -o os.hex + +app.elf: cxx.opt c.opt a.opt ill.opt beginapp.o bspcalls.o \ + makefile \ + app.dld \ + $(PSS_APPOBJS) \ + $(PSS_ROOT)/sys/os/libsys.a \ + $(PSS_ROOT)/sys/libc/libprepc$(DFP).a + @echo $(LOPTS) -o app.elf -Wm app.dld beginapp.o > l.opt + @echo bspcalls.o >> l.opt + @echo -L $(PSS_BSP) -L $(PSS_ROOT)/sys/os >> l.opt + @echo -L $(PSS_ROOT)/sys/libc $(PSS_APPLINKS) >> l.opt + @echo $(PSS_VLINK) >> l.opt + @echo $(PSS_APPOBJS) >> l.opt + @echo -m3 $(APP_LIB1) >> l.opt + @echo -m3 $(APP_LIB2) >> l.opt + @echo -m3 $(APP_LIB3) >> l.opt + @echo -m3 $(APP_LIB4) >> l.opt + @echo -m3 $(APP_LIB5) >> l.opt + @echo -lsys >> l.opt + @echo -lprepc$(DFP) -lquery >> l.opt + @echo -m3 $(FIX_LIB) >> l.opt + @echo $(PSS_COMPLIB) >> l.opt + $(LD) -@l.opt > app.map + ddump -tv app.elf >> app.map + +app.dld: $(PSS_BSP)/anchor.dld \ + $(PSS_BSP)/app.dld + @cat $(PSS_BSP)/app.dld > app.dld + @cat $(PSS_BSP)/anchor.dld >> app.dld + +app_ld.elf: app.elf + @echo $(PSS_LDBOPTS) -p 180 -n LDBL -mAT -u 1024 -s 4096 > ld_prep.def + @ld_prep -v -d ld_prep.def -o app_ld.elf app.elf + @rm -f ld_prep.def + +app.hex: app.elf + ddump -Rv app.elf -o app.hex + +app_ld.hex: app.hex + @echo $(PSS_LDBOPTS) -p 180 -n LDBL -mAT -u 1024 -s 4096 > ld_prep.def + @ld_prep -v -d ld_prep.def -o app_ld.hex app.hex + @rm -f ld_prep.def + +driver.elf: cxx.opt c.opt a.opt ill.opt lddriver.o bspcalls.o \ + ldblcfg.o \ + makefile \ + driver.dld \ + $(PSS_APPOBJS) \ + $(PSS_ROOT)/sys/os/libsys.a \ + $(PSS_ROOT)/sys/libc/libprepc$(DFP).a + @echo $(LOPTS) -o driver.elf driver.dld lddriver.o > l.opt + @echo bspcalls.o >> l.opt + @echo -L $(PSS_BSP) -L $(PSS_ROOT)/sys/os >> l.opt + @echo -L $(PSS_ROOT)/sys/libc $(PSS_APPLINKS) >> l.opt + @echo $(PSS_VLINK) >> l.opt + @echo $(PSS_APPOBJS) >> l.opt + @echo -m3 $(APP_LIB1) >> l.opt + @echo -m3 $(APP_LIB2) >> l.opt + @echo -m3 $(APP_LIB3) >> l.opt + @echo -m3 $(APP_LIB4) >> l.opt + @echo -m3 $(APP_LIB5) >> l.opt + @echo -lsys >> l.opt + @echo -lprepc$(DFP) >> l.opt + @echo -m3 $(FIX_LIB) >> l.opt + @echo $(PSS_COMPLIB) >> l.opt + $(LD) -@l.opt > driver.map + @ddump -tv driver.elf >> driver.map + +driver.dld: $(PSS_BSP)/anchor.dld \ + $(PSS_BSP)/app.dld + @cat $(PSS_BSP)/app.dld > driver.dld + @cat $(PSS_BSP)/anchor.dld >> driver.dld + +lddriver.elf: driver.elf + @echo $(PSS_LDBOPTS) -p 180 -n LDBL -mAT -u 1024 -s 4096 > ld_prep.def + @ld_prep -v -d ld_prep.def -o lddriver.elf driver.elf + @rm -f ld_prep.def + +lib.elf: cxx.opt c.opt a.opt ill.opt bspcalls.o \ + makefile \ + lib.dld \ + $(PSS_APPOBJS) \ + $(PSS_ROOT)/sys/os/libsys.a \ + $(PSS_ROOT)/sys/libc/libprepc$(DFP).a + @echo $(LOPTS) -o lib.elf lib.dld > l.opt + @echo bspcalls.o >> l.opt + @echo -L $(PSS_BSP) -L $(PSS_ROOT)/sys/os >> l.opt + @echo -L $(PSS_ROOT)/sys/libc $(PSS_APPLINKS) >> l.opt + @echo $(PSS_VLINK) >> l.opt + @echo $(PSS_APPOBJS) >> l.opt + @echo -m3 $(APP_LIB1) >> l.opt + @echo -m3 $(APP_LIB2) >> l.opt + @echo -m3 $(APP_LIB3) >> l.opt + @echo -m3 $(APP_LIB4) >> l.opt + @echo -m3 $(APP_LIB5) >> l.opt + @echo -lsys >> l.opt + @echo -lprepc$(DFP) -lquery >> l.opt + @echo -m3 $(FIX_LIB) >> l.opt + @echo $(PSS_COMPLIB) >> l.opt + $(LD) -@l.opt > lib.map + @ddump -tv lib.elf >> lib.map + +lib.dld: $(PSS_BSP)/anchor.dld \ + $(PSS_BSP)/app.dld + @cat $(PSS_BSP)/app.dld > lib.dld + @cat $(PSS_BSP)/anchor.dld >> lib.dld + +lib_ld.elf: lib.elf + @echo $(PSS_LDBOPTS) > ld_prep.def + @ld_prep -v -d ld_prep.def -o lib_ld.elf lib.elf + @rm -f ld_prep.def + +lib.hex: lib.elf + ddump -Rv lib.elf -o lib.hex + +lib_ld.hex: lib.hex + @echo $(PSS_LDBOPTS) > ld_prep.def + @ld_prep -v -d ld_prep.def -o lib_ld.hex lib.hex + @rm -f ld_prep.def + +#------------------------------------------------------------------------ +# Compile or assemble modules which are always used. +#------------------------------------------------------------------------ +begin.o: $(PSS_CONFIG)/begin.s \ + makefile $(PSS_CONFIG)/config.mk + $(AS) $(AOPTS) -o $@ $< + +beginapp.o: $(PSS_CONFIG)/beginapp.s \ + makefile $(PSS_CONFIG)/config.mk + $(AS) $(AOPTS) -o $@ $< + +lddriver.o: $(PSS_CONFIG)/lddriver.s \ + makefile $(PSS_CONFIG)/config.mk + $(AS) $(AOPTS) -o $@ $< + +bspcalls.o: $(PSS_BSP)/bspcalls.s \ + makefile $(PSS_CONFIG)/config.mk + $(AS) $(AOPTS) -o $@ $< + +gsblkcfg.o: $(PSS_CONFIG)/gsblkcfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h + $(CC) $(COPTS) -o $@ $< + +sysinit.o: $(PSS_CONFIG)/sysinit.c \ + qpsos.tmp \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o sysinit.tmp $< + @$(LD) $(LOPTS) -r -Xsuppress-dot -Xreloc-bug -o sysinit.o sysinit.tmp qpsos.tmp > qpsos.map + @rm -f qpsos.o qmpsos.o qpsos.map sysinit.tmp + +qpsos.tmp: $(PSS_ROOT)/sys/os/qpsos.s + @echo "UNIPROC=1" > qpsos_tmp.s + @cat $< >> qpsos_tmp.s + @$(AS) $(AOPTS) -o qpsos.o qpsos_tmp.s + @echo "UNIPROC=0" > qpsos_tmp.s + @cat $< >> qpsos_tmp.s + @das $(AOPTS) -I$(PSS_ROOT)/sys/os -o qmpsos.o qpsos_tmp.s + @rm -f qpsos.tmp qpsos_tmp.s + @$(LIB) cr qpsos.tmp qpsos.o qmpsos.o + +philecfg.o: $(PSS_CONFIG)/philecfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +pnacfg.o: $(PSS_CONFIG)/pnacfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +pnetcfg.o: $(PSS_CONFIG)/pnetcfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +prepccfg.o: $(PSS_CONFIG)/prepccfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +probecfg.o: $(PSS_CONFIG)/probecfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +prpccfg.o: $(PSS_CONFIG)/prpccfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +psecfg.o: $(PSS_CONFIG)/psecfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +psoscfg.o: $(PSS_CONFIG)/psoscfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +pmontcfg.o: $(PSS_CONFIG)/pmontcfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +dialog.o: $(PSS_CONFIG)/dialog.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +pollio.o: $(PSS_CONFIG)/pollio.c \ + makefile $(PSS_CONFIG)/config.mk \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +bspcfg.o: $(PSS_BSP)/bspcfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +plmcfg.o: $(PSS_CONFIG)/plmcfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +ldcfg.o: $(PSS_CONFIG)/ldcfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h + $(CC) $(COPTS) -o $@ $< + +posixcfg.o: $(PSS_CONFIG)/posixcfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +rtacfg.o: $(PSS_CONFIG)/rtacfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +c.opt: makefile $(PSS_CONFIG)/config.mk + @echo $(COMP_OPTS1) > c.opt + @echo $(COMP_OPTS2) >> c.opt + @echo $(COPTS_FILE1) >> c.opt + @echo $(COPTS_FILE2) >> c.opt + +cxx.opt: makefile $(PSS_CONFIG)/config.mk + @echo $(COMP_OPTS1) > cxx.opt + @echo $(COMP_OPTS2) >> cxx.opt + @echo $(COPTS_FILE1) >> cxx.opt + @echo $(COPTS_FILE2) >> cxx.opt + @echo $(CXX_OPTS) >> cxx.opt + +a.opt: makefile $(PSS_CONFIG)/config.mk + @echo $(AOPTS_FILE1) > a.opt + @echo $(AOPTS_FILE2) >> a.opt + @echo $(AOPTS_FILE3) >> a.opt + +ill.opt: makefile $(PSS_CONFIG)/config.mk + @echo $(LOPTS) > ill.opt + +#------------------------------------------------------------------------ +# Following target is used in psosmake to ensure that .opt files exist +# when target for a single file is made. +#------------------------------------------------------------------------ +create_opt_files: c.opt cxx.opt a.opt $(PSS_APP_OPTFILES) diff --git a/h/wrn/wm/util/port/isisnmp/ppc250/drv_conf.h b/h/wrn/wm/util/port/isisnmp/ppc250/drv_conf.h new file mode 100644 index 0000000..8f6866d --- /dev/null +++ b/h/wrn/wm/util/port/isisnmp/ppc250/drv_conf.h @@ -0,0 +1,1251 @@ +/* @(#) pSOSystem PowerPC/V2.5.0: apps/xxxx/drv_conf.c 4.22 (&U&) 98/12/08 14:17:14 */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/* [clearcase] +modification history +------------------- +*/ + +/***********************************************************************/ +/* */ +/* MODULE: drv_conf.c */ +/* DATE: 98/12/08 */ +/* PURPOSE: pSOSystem driver configuration and initialization */ +/* */ +/* These are the functions in this file: */ +/* */ +/* SetUpDrivers to setup drivers except for Network drivers*/ +/* DrvSysStartCO to setup Initial Device Name Table */ +/* SetUpNI to setup Network drivers */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* Copyright 2000-2001 Wind River Systems, Inc. */ +/* Copyright 1991 - 1998, Integrated Systems, Inc. */ +/* ALL RIGHTS RESERVED */ +/* */ +/* Permission is hereby granted to licensees of Integrated Systems, */ +/* Inc. products to use or abstract this computer program for the */ +/* sole purpose of implementing a product based on Integrated */ +/* Systems, Inc. products. No other rights to reproduce, use, */ +/* or disseminate this computer program, whether in part or in */ +/* whole, are granted. */ +/* */ +/* Integrated Systems, Inc. makes no representation or warranties */ +/* with respect to the performance of this computer program, and */ +/* specifically disclaims any responsibility for any damages, */ +/* special or consequential, connected with the use of this program. */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* */ +/* */ +/***********************************************************************/ +#include "sys_conf.h" +#include "bsp.h" +#include +#include +#include +#include + +#if SC_DEV_SPI + #include "spi.h" +#endif + +#if (SC_PSE) +#include +#include +#endif + +#if (SC_DEV_DLPI) +#include +#endif + +#if (SC_DEV_NULL) +extern void NullDevInit(struct ioparms *); +extern void NullDevRead(struct ioparms *); +extern void NullDevWrite(struct ioparms *); +extern void NullDevCntrl(struct ioparms *); +#endif + +#define NULLF (ULONG) ((void (*)()) 0) + +void InstallNi(int (*entry)(), int, int, int, int, int, int); + +#if (SC_PNA || SC_PNET) +static const char RarpErrTimeout[] = + "RARP request failed: Check for a RARP server"; +static const char RarpErrNet[] = + "RARP request failed: Network Error"; +#endif + +#if (SC_DEV_TFTP || SC_DEV_NTFTP) +ULONG NumTftpChans = SC_MAX_TFTP_CHAN; +#endif + +#if (SC_DEV_HTTP) +ULONG NumHttpChans = SC_MAX_HTTP_CHAN; +#endif + +#if (SC_DEV_PIPE) +unsigned long NumPipeChans = SC_MAX_PIPE_CHAN; +#endif + +#if (SC_DEV_PSCONSOLE) +ULONG NumPsConsoleSharedChan = SC_PSCNSL_SHARED_CHAN; +ULONG NumPsConsolePrivateChan = SC_PSCNSL_PRIVATE_CHAN; +ULONG NumPsConsoleCustomModule = SC_PSCNSL_MAX_CUSTOM; +#endif + +#if (defined(BSP_NEW_SERIAL) && !(BSP_NEW_SERIAL) && (BSP_SERIAL)) +extern UCHAR *CnslSetup(UCHAR *FreeMem, ULONG defbaud, USHORT defcons); +#endif + +#if SC_PSOS || SC_PSOSM +/***********************************************************************/ +/* SetUpDrivers: installs drivers in PsosIO table via a call to */ +/* InstallDriver and then calls driver setup function if */ +/* needed. NOTE: If the driver is to be part of the */ +/* Network Interface then it should be placed in the */ +/* SetUpNI function. */ +/* */ +/* INPUT: FreeMemPtr = A pointer to unused memory that can be */ +/* used to allocate space for a driver. */ +/* NOTE: Be sure to advance FreeMemPtr if */ +/* memory is allocates! */ +/* */ +/* RETURNS: The new address of free memory after the drivers have */ +/* allocated space. */ +/* */ +/* NOTE: This function does many precompile checks so errors */ +/* can be found during compile-time rather then at run- */ +/* time. */ +/* */ +/* To add a non-Network driver to pSOSystem, call InstallDriver(). */ +/* This adds a device driver to the PsosIO table. InstallDriver() */ +/* takes the following arguments: */ +/* */ +/* unsigned short major_number device major number */ +/* void (*dev_init)(), device init procedure */ +/* void (*dev_open)(), device open procedure */ +/* void (*dev_close)(), device close procedure */ +/* void (*dev_read)(), device read procedure */ +/* void (*dev_write)(), device write procedure */ +/* void (*dev_ioctl)(), device control procedure */ +/* unsigned long dev_param, Used for STREAMS modules */ +/* unsigned short rsvd2) reserved */ +/* unsigned short flags; If set to IO_AUTOINIT pSOS will */ +/* automatically call the */ +/* drivers initialization */ +/* function. The SC_AUTOINIT */ +/* #define which is set in */ +/* sys_conf.h can be used to set */ +/* this element. */ +/* */ +/* InstallDriver() does not return a value. InstallDriver() assumes */ +/* SC_DEVMAX is defined in sys_conf.h and is useful only before pSOS+ */ +/* has been initialized. */ +/* */ +/* If you are adding a driver that needs to be initialized before */ +/* either pSOS+ is initialized or the driver's init function is */ +/* called, then you can call a setup function (that you create) for */ +/* the driver. If your initialization function needs to allocate */ +/* memory, you may pass it the FreeMemPtr. The function should return */ +/* a new FreeMemPtr which points to the end of the memory it has */ +/* allocated. */ +/* */ +/* When adding code to install a new driver, it is a good idea to add */ +/* precompile checks so errors can be found during compile-time rather */ +/* then at run-time. Precompile checks are used, for example, in the */ +/* code that installs the pSOSystem serial device driver below. */ +/* */ +/***********************************************************************/ +UCHAR *SetUpDrivers(UCHAR *FreeMemPtr) +{ +extern ULONG PsosNumDntEnts; + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem serial device driver. */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SERIAL && BSP_SERIAL && BSP_NEW_SERIAL) + #if(SC_DEV_SERIAL > SC_DEVMAX) + #error "SC_DEV_SERIAL cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SERIAL, TermInit, TermOpen, TermClose,TermRead, + TermWrite, TermIoctl, 0, 0, IO_CHAR_DEV | SC_AUTOINIT); + PsosNumDntEnts++; + +/*---------------------------------------------------------------------*/ +/* This section is provided for backward compatibility only. */ +/* It will be removed completely in the next version of pSOSystem. */ +/*---------------------------------------------------------------------*/ +#elif (SC_DEV_SERIAL && BSP_SERIAL) + #if(SC_DEV_SERIAL > SC_DEVMAX) + #error "SC_DEV_SERIAL cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SERIAL, CnslInit, NULLF, NULLF,CnslRead, + CnslWrite, CnslCntrl, 0, 0, IO_CHAR_DEV | SC_AUTOINIT); + FreeMemPtr = CnslSetup(FreeMemPtr, SysVars.DefBaud, SC_APP_CONSOLE); + PsosNumDntEnts++; + +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSEUDO console driver */ +/*---------------------------------------------------------------------*/ +#if (DEV_PSCONSOLE) + InstallDriver(SC_DEV_PSCONSOLE, NULLF, PsConsoleOpen, + PsConsoleClose, PsConsoleRead, PsConsoleWrite, + PsConsoleCntrl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts +=4; +#endif + +/*--------------------------------------------------------------------*/ +/* Install the Memory Log driver. */ +/*--------------------------------------------------------------------*/ +#if SC_DEV_MEMLOG + InstallDriver(SC_DEV_MEMLOG, MemLogInit, NULLF, + NULLF, MemLogRead, MemLogWrite, + MemLogCntrl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*--------------------------------------------------------------------*/ +/* Install the Memory pROBE+ Remote debugger driver (RDIO). */ +/*--------------------------------------------------------------------*/ +#if SC_DEV_RDIO + InstallDriver(SC_DEV_RDIO, NULLF, NULLF, + NULLF, RdioRead, RdioWrite, + 0, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*--------------------------------------------------------------------*/ +/* Setup pSOSystem PC console device driver */ +/*--------------------------------------------------------------------*/ +#if (SC_DEV_CONSOLE && BSP_CONSOLE) + #if (SC_DEV_CONSOLE >SC_DEVMAX) + #error "SC_DEV_CONSOLE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_CONSOLE, PcCnslInit, NULLF, NULLF, + PcCnslRead, PcCnslWrite, PcCnslCntrl, 0, 0, + IO_CHAR_DEV | SC_AUTOINIT); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem tick timer. */ +/*---------------------------------------------------------------------*/ +#if SC_DEV_TIMER + #if(SC_DEV_TIMER > SC_DEVMAX) + #error "SC_DEV_TIMER cannot be > SC_DEVMAX" + #endif + #if (!SC_PSOS && !SC_PSOSM) + #error "Must have pSOS+ or pSOS+m in system to use tick timer!" + #endif + InstallDriver(SC_DEV_TIMER, RtcInit, NULLF, NULLF, NULLF, NULLF, + NULLF, 0, 0, IO_CHAR_DEV | SC_AUTOINIT); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install DevNull driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_NULL) + InstallDriver(SC_DEV_NULL, NullDevInit, NULLF, NULLF,NullDevRead, + NullDevWrite, NullDevCntrl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem ramdisk driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if SC_DEV_RAMDISK + #if(SC_DEV_RAMDISK > SC_DEVMAX) + #error "SC_DEV_RAMDISK cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_RAMDISK, RdskInit, RdskOpen, RdskClose, RdskRead, + RdskWrite, RdskCntrl, 0, 0, IO_BLOCK_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem PIPE driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization feature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if SC_DEV_PIPE + #if(SC_DEV_PIPE > SC_DEVMAX) + #error "SC_DEV_PIPE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_PIPE, PipeInit, PipeOpen, PipeClose, PipeRead, + PipeWrite, PipeCntl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem SCSI driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SCSI && BSP_SCSI) + #if(SC_DEV_SCSI > SC_DEVMAX) + #error "SC_DEV_SCSI cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SCSI, SdrvInit, SdskOpen, SdskClose, SdskRead, + SdskWrite, SdrvCntrl, 0, 0, IO_BLOCK_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem SCSI Tape driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SCSI_TAPE && BSP_SCSI_TAPE) + #if(SC_DEV_SCSI_TAPE > SC_DEVMAX) + #error "SC_DEV_SCSI_TAPE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SCSI_TAPE, SdrvInit, StapeOpen, StapeClose, + StapeRead, StapeWrite, SdrvCntrl, 0, 0, IO_BLOCK_DEV); + + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem CMOS clock driver */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_CMOS && BSP_CLOCK) + #if (SC_DEV_CMOS >SC_DEVMAX) + #error "SC_DEV_CMOS cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_CMOS, NULLF, NULLF, NULLF, CmcRead, + CmcWrite, NULLF, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem printer driver */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_PARALLEL && BSP_PARALLEL) + #if (SC_DEV_PARALLEL >SC_DEVMAX) + #error "SC_DEV_PARALLEL cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_PARALLEL, ParInit, ParOpen, ParClose, NULLF, + ParWrite, ParCntrl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem floppy diskette driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_FLOPPY && BSP_FLOPPY) + #if (SC_DEV_FLOPPY >SC_DEVMAX) + #error "SC_DEV_FLOPPY cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_FLOPPY, FlpInit, NULLF, NULLF, FlpRead, + FlpWrite, NULLF, 0, 0, IO_BLOCK_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem IDE disk driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_IDE && BSP_IDE) + #if (SC_DEV_IDE >SC_DEVMAX) + #error "SC_DEV_IDE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_IDE, IDEInit, NULLF, NULLF, IDERead, + IDEWrite, IDECntrl, 0, 0, IO_BLOCK_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem TFTP driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_TFTP) + #if(SC_DEV_TFTP > SC_DEVMAX) + #error "SC_DEV_TFTP cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_TFTP, TftpInit, TftpOpen, TftpClose, TftpRead, + NULLF, TftpCntl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem New TFTP driver that follows the new interface*/ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_NTFTP) + #if(SC_DEV_NTFTP > SC_DEVMAX) + #error "SC_DEV_NTFTP cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_NTFTP, TftpInit, StdTftpOpen, TftpClose, TftpRead, + NULLF, TftpCntl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem HTTP driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_HTTP) + #if(SC_DEV_HTTP > SC_DEVMAX) + #error "SC_DEV_HTTP cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_HTTP, HttpInit, HttpOpen, HttpClose, HttpRead, + NULLF, HttpCntl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the SPI driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SPI) + #if(SC_DEV_SPI > SC_DEVMAX) + #error "SC_DEV_SPI cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SPI, SPI_init, SPI_open, SPI_close, NULLF, + NULLF, SPI_io, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install DLPI drivers */ +/*---------------------------------------------------------------------*/ + +#if (SC_DEV_DLPI || SC_DEV_PPP || SC_DEV_SLIP) + { +#include "enetcfg.h" + +int dlpi_setinitroutine = 0; +int dlpi_nicount = 0; /* number of ni's below this DLPI */ +void (*init_fn)(); /* Ethernet driver initialization routine */ + /* Call this function only once */ +char *DlpiErrMsg = "DlpiAddNI failed: NI Error"; + +#if (SC_DEV_DLPI) + { + #if(SC_DEV_DLPI> SC_DEVMAX) + #error "SC_DEV_DLPI cannot be > SC_DEVMAX" + #endif + static const psedrvparam_t eth0param = {"eth0", DT_CLONE, &enetinfo, 0, 0}; + init_fn = NULLF; + if (!dlpi_setinitroutine) + { + init_fn = (void (*)())enetinit; + dlpi_setinitroutine = 1; + } + InstallDriver(SC_DEV_DLPI, init_fn, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)ð0param, 0, IO_STREAM_DEV); + dlpi_nicount++; + PsosNumDntEnts++; + } +#endif /* SC_DEV_DLPI */ + +#if SC_DEV_DLPI_PPP + { + #if(SC_DEV_DLPI_PPP > SC_DEVMAX) + #error "SC_DEV_DLPI_PPP cannot be > SC_DEVMAX" + #endif + static const psedrvparam_t pppparam = {"ppp", DT_CLONE, &enetinfo, 0, 0}; + init_fn = NULLF; + if (!dlpi_setinitroutine) + { + init_fn = (void (*)())enetinit; + dlpi_setinitroutine = 1; + } + InstallDriver(SC_DEV_DLPI_PPP, init_fn, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&pppparam, 0, IO_STREAM_DEV); + dlpi_nicount++; + PsosNumDntEnts++; + } +#endif /* SC_DEV_DLPI_PPP */ + +#if SC_DEV_DLPI_SLIP + { + #if(SC_DEV_DLPI_SLIP > SC_DEVMAX) + #error "SC_DEV_DLPI_SLIP cannot be > SC_DEVMAX" + #endif + static const psedrvparam_t slipparam = {"slip", DT_CLONE, &enetinfo, 0, 0}; + init_fn = NULLF; + if (!dlpi_setinitroutine) + { + init_fn = (void (*)())enetinit; + dlpi_setinitroutine = 1; + } + InstallDriver(SC_DEV_DLPI_SLIP, init_fn, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&slipparam, 0, IO_STREAM_DEV); + dlpi_nicount++; + PsosNumDntEnts++; + } +#endif /* SC_DEV_DLPI_SLIP */ + +/* + * User has defined other DLPI drivers locally. Include user + * file drv_conf.idl that installs user's own ENETDLPI drivers + */ +#if SC_DEV_DLPI_OTHER +#include "drv_conf.idl" +#endif + + /*-------------------------------------------------------------*/ + /* Call DlpiInit to initialize the Streams DLPI driver */ + /* Arguments passed to DlpiInit are: */ + /* 1. Free memory address */ + /* 2. Maximum NI interface number */ + /* 3. Maximum number of streams per interface */ + /*-------------------------------------------------------------*/ + FreeMemPtr = DlpiInit(FreeMemPtr, dlpi_nicount, SE_DLPI_MAXSTR_PERNI); + + /*-------------------------------------------------------------*/ + /* Call DlpiAddNI to add an NI interface to the Streams DLPI */ + /* driver. DlpiAddNI must be called for each NI driver */ + /* interface used with the Streams DLPI driver. */ + /* Arguments passed to DlpiAddNI are: */ + /* 1. NI interface number (should correspond to the pNA+ */ + /* interface number if driver is shared with pNA+) */ + /* 2. NI entry point */ + /* 3. NI flags */ + /* DLPI_IFF_SELFLOOP 0x0001 loopback for selfaddress */ + /* DLPI_IFF_POLL_NI 0x0002 driver must be polled */ + /* DLPI_IFF_RAWMEM 0x2000 driver accepts mblk */ + /* DLPI_IFF_NONIINIT 0x4000 Don't send NI_INIT */ + /* during enetinit() call */ + /* 4. NI major device number */ + /* 5. NI multicast address (NOT SUPPORTED) */ + /* 6. NI poll frequency (every # of elapsed ticks) */ + /*-------------------------------------------------------------*/ + +#if (SC_DEV_DLPI) + /* + * If this lan NI is not shared, use a loopback DLPI with interface + * number 0. NI entry point is set to DlpiNullNI(). + */ +#if (SE_SHARE_NI) + if (DlpiAddNI(SE_DLPI_ETH_IFNO, (long(*)())BSP_LAN1_ENTRY, + SE_DLPI_ETH_IFFLAGS, SC_DEV_DLPI, 0, SE_DLPI_ETH_POLLFREQ)) + SysInitFail(DlpiErrMsg); +#else + if (DlpiAddNI(0, (long(*)())DlpiNullNI, 0, SC_DEV_DLPI, 0, 0)) + SysInitFail(DlpiErrMsg); +#endif /* SE_SHARE_NI */ + +#endif /* SC_DEV_DLPI */ + +#if (SC_DEV_DLPI_PPP) + if (DlpiAddNI(SE_DLPI_PPP_IFNO, SE_DLPI_PPP_ENTRY, SE_DLPI_PPP_IFFLAGS, + SC_DEV_DLPI_PPP, 0, SE_DLPI_PPP_POLLFREQ)) + SysInitFail(DlpiErrMsg); + if (DlpiAddParams(SE_DLPI_PPP_IFNO, SE_DLPI_PPP_ADDRSIZE, + SE_DLPI_PPP_MAXMTU, SE_DLPI_PPP_MINMTU, (char *)NULL)) + SysInitFail(DlpiErrMsg); +#endif /* SC_DEV_DLPI_PPP */ + +#if (SC_DEV_DLPI_SLIP) + if (DlpiAddNI(SE_DLPI_SLIP_IFNO,SE_DLPI_SLIP_ENTRY, SE_DLPI_SLIP_IFFLAGS, + SC_DEV_DLPI_SLIP, 0, SE_DLPI_SLIP_POLLFREQ)) + SysInitFail(DlpiErrMsg); + if (DlpiAddParams(SE_DLPI_SLIP_IFNO, SE_DLPI_SLIP_ADDRSIZE, + SE_DLPI_SLIP_MAXMTU, SE_DLPI_SLIP_MINMTU, (char *)NULL)) + SysInitFail(DlpiErrMsg); +#endif /* SC_DEV_DLPI_SLIP */ + +/* + * User has defined other DLPI drivers locally. Include user + * file drv_conf.adl that adds user Dlpi drivers to the system. + */ +#if SC_DEV_DLPI_OTHER +#include "drv_conf.adl" +#endif + + } +#endif /* (SC_DEV_DLPI || SC_DEV_PPP || SC_DEV_SLIP) */ + +#if (SC_DEV_LOG) + { + extern void loginit(); + extern struct streamtab loginfo; + static const psedrvparam_t log_drv = {"log", DT_CLONE, &loginfo, 0, 0}; + + InstallDriver(SC_DEV_LOG, loginit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&log_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; + } +#endif + +/*-------------------------------------------------------------------*/ +/* Install pSOSystem Watchdog driver */ +/*-------------------------------------------------------------------*/ +#if (SC_DEV_WATCHDOG) + #if(SC_DEV_WATCHDOG > SC_DEVMAX) + #error "SC_DEV_WATCHDOG cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_WATCHDOG, WdtInit, NULLF, NULLF, NULLF, + NULLF, NULLF, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +#if (SC_DEV_OTCP) + { +extern void otcp_ipspace_init(), otcp_arpspace_init(), otcp_rawspace_init(), + otcp_udpspace_init(), otcp_tcpspace_init(), otcp_loopspace_init(); +extern struct streamtab otcp_ipinfo, otcp_arpinfo, otcp_rawinfo, otcp_udpinfo, + otcp_tcpinfo, otcp_loopinfo; + +#if (SC_IP) + static const psedrvparam_t ip_drv = {"ip", DT_CLONE, &otcp_ipinfo, 0, 0}; +#endif +#if (SC_ARP) + static const psedrvparam_t arp_drv = {"arp", DT_CLONE, &otcp_arpinfo, 0, 0}; +#endif +#if (SC_TCP) + static const psedrvparam_t tcp_drv = {"tcp", DT_CLONE, &otcp_tcpinfo, 0, 0}; +#endif +#if (SC_UDP) + static const psedrvparam_t udp_drv = {"udp", DT_CLONE, &otcp_udpinfo, 0, 0}; +#endif +#if (SC_RAW) + static const psedrvparam_t raw_drv = {"raw", DT_CLONE, &otcp_rawinfo, 0, 0}; +#endif +#if (SC_LOOP) + static const psedrvparam_t loop_drv = {"loop", DT_CLONE, &otcp_loopinfo, 0, 0}; +#endif + +#if (SC_IP) + InstallDriver(SC_IP, otcp_ipspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&ip_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_ARP) + InstallDriver(SC_ARP, otcp_arpspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&arp_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_RAW) + InstallDriver(SC_RAW, otcp_rawspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&raw_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_UDP) + InstallDriver(SC_UDP, otcp_udpspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&udp_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_TCP) + InstallDriver(SC_TCP, otcp_tcpspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&tcp_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_LOOP) + InstallDriver(SC_LOOP, otcp_loopspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&loop_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif + + } +#endif /* (SC_DEV_OTCP) */ + +#if (SC_DEV_OLAP) + { + extern struct streamtab phpiinfo, twfrinfo ; + extern void phpiinit(), twfrinit(); +#if (SC_PHPI) + static const psedrvparam_t phpiparam={"phpi",DT_CLONE,&phpiinfo, 0, 0}; +#endif +#if (SC_LAPB) + static const psedrvparam_t lapbparam ={"lapb", DT_REGULAR,&twfrinfo,0, 0}; +#endif + +#if (SC_PHPI) + InstallDriver(SC_PHPI, phpiinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&phpiparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_LAPB) + InstallDriver(SC_LAPB, twfrinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&lapbparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif + } +#endif + +#if (SC_DEV_OX25) + { + extern struct streamtab phpiinfo, twfrinfo, twpkinfo, twsninfo, ipconvinfo; + extern void twpkinit(), twsninit(), tcpsninit(); +#if (SC_X25) + static const psedrvparam_t x25param ={"x25", DT_DRIVER, &twpkinfo, 0, 0}; +#endif +#if (SC_SNDCF) + static const psedrvparam_t sndfparam ={"sndf", DT_REGULAR, &twsninfo, 0, 0}; +#endif +#if (SC_IPCONV) + static const psedrvparam_t ipconvparam={"ipsn",DT_REGULAR, &ipconvinfo, 0, 0}; +#endif + +#if (SC_X25) + InstallDriver(SC_X25, twpkinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&x25param, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_SNDCF) + InstallDriver(SC_SNDCF, twsninit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&sndfparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_IPCONV) + InstallDriver(SC_IPCONV, tcpsninit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&ipconvparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif + } +#endif + +#if (SC_DEV_ISDN) + { + extern struct streamtab phinfo, q921info, ipcdinfo ; + extern void q921init(), phinit(); + +#if (SC_PH) + static const psedrvparam_t phpiparam={"ph",DT_REGULAR,&phinfo, 0, 0}; +#endif +#if (SC_LAPD) + static const psedrvparam_t lapbparam={"q921",DT_REGULAR,&q921info,0,0}; +#endif +#if (SC_IPCD) + static const psedrvparam_t ipcdparam={"ipcd",DT_REGULAR,&ipcdinfo,0,0}; +#endif + +#if (SC_PH) + InstallDriver(SC_PH, phinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&phpiparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_LAPD) + InstallDriver(SC_LAPD, q921init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&lapbparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_IPCD) + InstallDriver(SC_IPCD, NULLF, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&ipcdparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif + } +#endif + +#if (SC_DEV_MLPP) + { + extern struct streamtab frmuxtab, pppstream, Spimtab; + extern void frmuxinit(); + +#if (SC_FRMUX) + static const psedrvparam_t fmuxparam ={"cfmux",DT_REGULAR,&frmuxtab,0,0}; +#endif +#if (SC_PPP) + static const psedrvparam_t pppparam ={"cppp",DT_REGULAR,&pppstream,0,0}; +#endif +#if (SC_PIM) + static const psedrvparam_t pimparam ={"cpim",DT_REGULAR,&Spimtab,0,0}; +#endif + +#if (SC_FRMUX) + InstallDriver(SC_FRMUX, frmuxinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&fmuxparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_PPP) + InstallDriver(SC_PPP, NULLF, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&pppparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_PIM) + InstallDriver(SC_PIM, NULLF, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&pimparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif + } +#endif + +#if defined(SC_DEV_PSMUX) && SC_DEV_PSMUX +#include "drv_conf.app" +#endif + +/*---------------------------------------------------------------------*/ +/* Additional drivers may be installed here. */ +/*---------------------------------------------------------------------*/ + +return FreeMemPtr; +} + +/***********************************************************************/ +/* DrvSysStartCO : This is called from sysinit.c "SysStartCO". */ +/* */ +/* INPUTS: None */ +/* */ +/* RETURNS: None */ +/* OUTPUTS: None */ +/* NOTE(S): Currently used to set-up the Initial Device Name Table */ +/* Additional code can be added here to clean-up the */ +/* driver specific data area. */ +/* */ +/***********************************************************************/ +void DrvSysStartCO() +{ + long i, j; + char namebuf[KC_DNLEN+1]; + +/*---------------------------------------------------------------------*/ +/* Following are the call-outs which will be called. If your driver */ +/* needs pSOS+ "GS" (Warm Startup) notification to clear your driver */ +/* data structures, register here, so that it will be called. */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SERIAL && BSP_SERIAL) + DevSerialCO(); +#endif + +#if (SC_DEV_CONSOLE && BSP_CONSOLE) + DevPCConsoleCO(); +#endif + +/*---------------------------------------------------------------------*/ +/* Default CONSOLE is passed as the DEFAULT CONSOLE for Re-Direction */ +/* CONSOLE can be either DEV_CONSOLE or DEV_SERIAL. */ +/*---------------------------------------------------------------------*/ +#if SC_DEV_PSCONSOLE + PsConsoleSysStartCo(SC_PSCNSL_DEFAULT_DEV, SC_PSCNSL_DEFAULT_DEV); +#endif + +#if SC_DEV_RDIO + RdioSysStartCo(); +#endif + +#if SC_DEV_SCSI && BSP_SCSI + DevScsiCO(); +#endif + +#if SC_DEV_SCSI_TAPE && BSP_SCSI_TAPE + DevScsiCO(); +#endif + +#if SC_DEV_IDE && BSP_IDE + DevIdeCO(); +#endif + +#if SC_DEV_PARALLEL + DevParallelCO(); +#endif + +#if SC_DEV_FLOPPY && BSP_FLOPPY + DevFloppyCO(); +#endif + +#if (SC_DEV_TFTP || SC_DEV_NTFTP) + DevTftpCO(); +#endif + +#if SC_DEV_HTTP + DevHttpCO(); +#endif + +#if SC_DEV_PIPE + DevPipeCO(); +#endif + +/*---------------------------------------------------------------------*/ +/* This code is used to build the initial table of device names used */ +/* in the pSOSystem. */ +/*---------------------------------------------------------------------*/ +/*-----------------------------------------------------------------*/ +/* Make one name for the entrie pSOSystem Serial channels. */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_SERIAL && BSP_SERIAL) + dnt_add("tty", DEV_SERIAL); +#endif /* SC_DEV_SERIAL */ + +/*-----------------------------------------------------------------*/ +/* Make one name for the PC Console Driver. (PC-Monitor). */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_CONSOLE && BSP_CONSOLE) + dnt_add("pcconsole", DEV_CONSOLE); +#endif + +/*-----------------------------------------------------------------*/ +/* Null Driver. */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_NULL + dnt_add("null", DEV_NULL); +#endif + +/*-----------------------------------------------------------------*/ +/* There is only one timer in the system. Make a name for it. */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_TIMER + dnt_add("timer", DEV_TIMER); +#endif /* SC_DEV_TIMER */ + +/*-----------------------------------------------------------------*/ +/* Add DNT entries for all pSEUDO console minor devices */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_PSCONSOLE + dnt_add("psconsole", DEV_PSCONSOLE + SYSCONSOLE_DEV); + dnt_add("stdin", DEV_PSCONSOLE + STDIN_DEV); + dnt_add("stdout", DEV_PSCONSOLE + STDOUT_DEV); + dnt_add("stderr", DEV_PSCONSOLE + STDERR_DEV); +#endif + +#if SC_DEV_MEMLOG + dnt_add("memlog", DEV_MEMLOG); +#endif + +#if SC_DEV_RDIO + dnt_add("rdio", DEV_RDIO); +#endif + + +/*-----------------------------------------------------------------*/ +/* Add the name for the RAMDISK driver as "ramdisk". */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_RAMDISK + dnt_add("ramdisk", DEV_RAMDISK); +#endif /* SC_DEV_RAMDISK */ + +/*-----------------------------------------------------------------*/ +/* Add the name for the PIPE drivers as "pipe". */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_PIPE + dnt_add("pipe", DEV_PIPE); +#endif /* SC_DEV_PIPE */ + +/*-----------------------------------------------------------------*/ +/* Add the name for the SCSI driver as "scsi". */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_SCSI && BSP_SCSI) + dnt_add("scsi", DEV_SCSI); +#endif /* SC_DEV_SCSI && BSP_SCSI */ + +/*-----------------------------------------------------------------*/ +/* Add the name for the SCSI-TAPE driver as "tape". */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_SCSI_TAPE && BSP_SCSI_TAPE) + dnt_add("tape", DEV_SCSI_TAPE); +#endif /* SC_DEV_SCSI_TAPE && BSP_SCSI_TAPE */ + +/*-----------------------------------------------------------------*/ +/* Add the name for the IDE driver as "ide". */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_IDE && BSP_IDE) + dnt_add("ide", DEV_IDE); +#endif /* SC_DEV_IDE && BSP_IDE */ + +/*-----------------------------------------------------------------*/ +/* There is only one parallel driver in the system. Make a name */ +/* for it. */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_PARALLEL + dnt_add("printer", DEV_PARALLEL); +#endif /* SC_DEV_PARALLEL */ + +/*-----------------------------------------------------------------*/ +/* Add the name for the floppy driver in the system. */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_FLOPPY && BSP_FLOPPY) + dnt_add("floppy", DEV_FLOPPY); +#endif /* SC_DEV_FLOPPY */ + +/*-----------------------------------------------------------------*/ +/* There is only one watchdog driver in the system. Make a name */ +/* for it. */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_WATCHDOG + dnt_add("watchdog", DEV_WATCHDOG); +#endif /* SC_DEV_WATCHDOG */ + +/*-----------------------------------------------------------------*/ +/* There is only one cmos driver in the system. Make a name for it.*/ +/*-----------------------------------------------------------------*/ +#if SC_DEV_CMOS + dnt_add("cmos", DEV_CMOS); +#endif /* SC_DEV_CMOS */ + +/*-----------------------------------------------------------------*/ +/* Make the name for TFTP driver as "tftp". */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_TFTP) + dnt_add("tftp", DEV_TFTP); +#endif /* SC_DEV_TFTP */ + +/*-----------------------------------------------------------------*/ +/* Make the name for NTFTP driver as "ntftp". */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_NTFTP) + dnt_add("ntftp", DEV_NTFTP); +#endif /* SC_DEV_NTFTP */ + +/*-----------------------------------------------------------------*/ +/* Make default name for the HTTP pseudo device. */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_HTTP + dnt_add("http" , DEV_HTTP); +#endif /* SC_DEV_HTTP */ + +#if (SC_DEV_DLPI || SC_DEV_PPP || SC_DEV_SLIP) +/*-----------------------------------------------------------------*/ +/* There is only one enetdlpi driver in the system. */ +/* Make a name for it. */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_DLPI + dnt_add("dlpi", DEV_DLPI); +#endif /* SC_DEV_DLPI */ + +/*-----------------------------------------------------------------*/ +/* There is only one enetslip driver in the system. Make a name for it.*/ +/*-----------------------------------------------------------------*/ +#if SC_DEV_DLPI_SLIP + dnt_add("dlslip", DEV_DLPI_SLIP); +#endif /* SC_DEV_DLPI_SLIP */ + +/*-----------------------------------------------------------------*/ +/* There is only one enetppp driver in the system. Make a name for it.*/ +/*-----------------------------------------------------------------*/ +#if SC_DEV_DLPI_PPP + dnt_add("dlppp", DEV_DLPI_PPP); +#endif /* SC_DEV_DLPI_PPP */ + +#endif + +#if (SC_DEV_LOG) + dnt_add("log", DEV_LOG); +#endif + +#if (SC_DEV_OTCP) + +#if (SC_IP) + dnt_add("ip", DEV_IP); +#endif +#if (SC_ARP) + dnt_add("arp", DEV_ARP); +#endif +#if (SC_TCP) + dnt_add("tcp", DEV_TCP); +#endif +#if (SC_UDP) + dnt_add("udp", DEV_UDP); +#endif +#if (SC_RAW) + dnt_add("raw", DEV_RAW); +#endif +#if (SC_LOOP) + dnt_add("loop", DEV_LOOP); +#endif + +#endif + + +#if (SC_DEV_OLAP) + +#if (SC_PHPI) + dnt_add("phpi", DEV_PHPI); +#endif + +#if (SC_LAPB) + dnt_add("lapb", DEV_LAPB); +#endif + +#endif + +#if (SC_DEV_OX25) + +#if (SC_X25) + dnt_add("x25", DEV_X25); +#endif + +#if (SC_SNDCF) + dnt_add("sndcf", DEV_SNDCF); +#endif + +#if (SC_IPCONV) + dnt_add("ipconv", DEV_IPCONV); +#endif + +#endif + +#if (SC_DEV_ISDN) + +#if (SC_PH) + dnt_add("ph", DEV_PH); +#endif + +#if (SC_LAPD) + dnt_add("q921", DEV_LAPD); +#endif + +#if (SC_IPCD) + dnt_add("ipcd", DEV_IPCD); +#endif + +#endif + +#if (SC_DEV_MLPP) + +#if (SC_FRMUX) + dnt_add("cfmux", DEV_FRMUX); +#endif + +#if (SC_PIM) + dnt_add("cpim", DEV_PIM); +#endif + +#if (SC_PPP) + dnt_add("cppp", DEV_PPP); +#endif + +#endif +/*-----------------------------------------------------------------*/ +/* Names for additional drivers may be added here. */ +/*-----------------------------------------------------------------*/ + +} +#endif /* SC_PSOS || SC_PSOSM */ + +#if (SC_PNA || SC_PNET) +/***********************************************************************/ +/* SetUpNI: Set up Network Interfaces for pNA+ */ +/* */ +/* INPUT: FreeMemPtr = A pointer to unused memory that can be */ +/* used to allocate space for a driver. */ +/* NOTE: Be sure to advance FreeMemPtr if */ +/* memory is allocates! */ +/* */ +/* RETURNS: The new address of free memory after the drivers have */ +/* allocated space. */ +/* */ +/* NOTES: This function does many precompile checks so errors */ +/* can be found during compile-time rather then at run- */ +/* time. */ +/* */ +/* Also, the Network Interface Table must be allocated */ +/* before this function can be called. There cannot be */ +/* more then NC_NNI entries in this table. NC_NNI is set */ +/* in sys_conf.h. Before adding another interface, be */ +/* sure to check sys_conf.h to see if NC_NNI is set to */ +/* accommodate another one! */ +/* */ +/* See the pSOSystem Programmers Reference Manual */ +/* for more information. */ +/* */ +/* To add a Network driver to pSOSystem, call InstallNi(). This adds */ +/* the Network Interface to the pNA+ Network Interface Table. */ +/* InstallNi() takes the following arguments: */ +/* */ +/* int (*entry)(); address of NI entry point */ +/* int ipadd; IP address */ +/* int mtu; maximum transmission length */ +/* int hwalen; length of hardware address */ +/* int flags; intErface flags */ +/* int subnetaddr; subnet mask */ +/* int dstipaddr; destination ip address */ +/* */ +/* See pSOSystem Programmer`s Reference Manual, Configuration Tables */ +/* Section, for more information about the Network Interface Table. */ +/* InstallNi() does not return a value. */ +/* */ +/* If you are adding a driver that needs to be initialized before */ +/* either pSOS+ is initialized or the driver's init function is */ +/* called, then you can call a setup function (that you create) for */ +/* the driver. If your initialization function needs to allocate */ +/* memory, you may pass it the FreeMemPtr. The function should return */ +/* a new FreeMemPtr which points to the end of the memory it has */ +/* allocated. */ +/* */ +/* When adding code to install a new driver, it is a good idea to add */ +/* precompile checks so errors can be found during compile-time rather */ +/* then at run-time. Precompile checks are used, for example, in the */ +/* code that installs the pSOSystem serial device driver below. */ +/* */ +/***********************************************************************/ +UCHAR *SetUpNI(UCHAR *FreeMemPtr) +{ +int IPaddr; + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem NI. */ +/*---------------------------------------------------------------------*/ +#if BSP_LAN1 + if (SysVars.Lan1) + { + /*-------------------------------------------------------------*/ + /* If RARP is specified for the IP address, use it now to */ + /* obtain the IP address for this interface. */ + /*-------------------------------------------------------------*/ + if (SysVars.Lan1IP == USE_RARP) + { + #if (SC_DEV_DLPI && SE_SHARE_NI) + IPaddr = RarpEth((long (*)())DlpiEnet); + #else + IPaddr = RarpEth((long (*)())BSP_LAN1_ENTRY); + #endif + if (IPaddr == 0) + SysInitFail(RarpErrTimeout); + if (IPaddr == -1) + SysInitFail(RarpErrNet); + } + else + IPaddr = SysVars.Lan1IP; + + #if (SC_DEV_DLPI && SE_SHARE_NI) + InstallNi((int (*)())DlpiEnet, IPaddr, + #else + InstallNi((int (*)())BSP_LAN1_ENTRY, IPaddr, + #endif + BSP_LAN1_MTU, BSP_LAN1_HWALEN, BSP_LAN1_FLAGS, + SysVars.Lan1SubnetMask, 0); + } +#endif + +/*---------------------------------------------------------------------*/ +/* Install the shared memory NI. */ +/*---------------------------------------------------------------------*/ +#if BSP_SMEM + #if ((SC_NISM_LEVEL != 1) && (SC_NISM_LEVEL != 2)) + #error "Illegal value for SC_NISM_LEVEL" + #endif + + if (SysVars.Nism) + { + InstallNi((int (*)())NiSmem, SysVars.NismIP, NISM_MTU, 4, 0x8002, + SysVars.NismSubnetMask, 0); + } +#endif +/*---------------------------------------------------------------------*/ +/* Additional Network drivers may be installed here. */ +/*---------------------------------------------------------------------*/ + +return FreeMemPtr; +} + +#endif /* (SC_PNA || SC_PNET) */ diff --git a/h/wrn/wm/util/port/isisnmp/ppc250/sys_conf.h b/h/wrn/wm/util/port/isisnmp/ppc250/sys_conf.h new file mode 100644 index 0000000..415c8bc --- /dev/null +++ b/h/wrn/wm/util/port/isisnmp/ppc250/sys_conf.h @@ -0,0 +1,1123 @@ +/* @(#) pSOSystem PowerPC/V2.5.0: apps/xxxx/sys_conf.h (netutils ppc) 4.68 98/11/17 16:51:28 */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/* [clearcase] +modification history +------------------- +*/ + +/***********************************************************************/ +/* */ +/* MODULE: sys_conf.h */ +/* DATE: 98/11/17 */ +/* PURPOSE: pSOSystem configuration definitions */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* Copyright 1991 - 1998, Integrated Systems, Inc. */ +/* ALL RIGHTS RESERVED */ +/* */ +/* Permission is hereby granted to licensees of Integrated Systems, */ +/* Inc. products to use or abstract this computer program for the */ +/* sole purpose of implementing a product based on Integrated */ +/* Systems, Inc. products. No other rights to reproduce, use, */ +/* or disseminate this computer program, whether in part or in */ +/* whole, are granted. */ +/* */ +/* Integrated Systems, Inc. makes no representation or warranties */ +/* with respect to the performance of this computer program, and */ +/* specifically disclaims any responsibility for any damages, */ +/* special or consequential, connected with the use of this program. */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* This is a header file which defines all of the system-level */ +/* parameters that are likely to need changing. */ +/* */ +/* It has been set up to be as close as possible to the settings */ +/* which are appropriate for this application. However, you may */ +/* need to make some changes to parameters to reflect your */ +/* environment, such as IP addresses, etc. */ +/* */ +/* The "Configuration and Startup" section of the "Programmer's */ +/* Reference" manual in pSOSystem contains a complete description */ +/* of the symbols that are defined in this file. */ +/* */ +/***********************************************************************/ +#ifndef _SYS_CONF_H +#define _SYS_CONF_H + +#ifdef __cplusplus +extern "C" { +#endif + +/***********************************************************************/ +/* */ +/* SC_APP_PARMS must be defined before you include sysvars.h file. */ +/* Since "sysvars.h" file depends on SC_APP_PARMS and BSP_PARMS */ +/* to define the Storage Parms Structure. */ +/* */ +/* Defining this variable to a Non-Zero Value will create a space in */ +/* the Storage Parms corresponding to the value. The total space */ +/* allocated is the sum of the BSP_PARMS and SC_APP_PARMS. */ +/* */ +/* SC_APP_NAME define controls the application name string that will */ +/* be displayed during the boot dialog. */ +/* */ +/***********************************************************************/ +#define SC_APP_PARMS 0 +#define SC_APP_NAME "inetutil Application" + +/*---------------------------------------------------------------------*/ +/* sys/types.h contains common definitions, (example YES, NO and more) */ +/*---------------------------------------------------------------------*/ +#include + +/*---------------------------------------------------------------------*/ +/* sysvars.h contains the structures and definitions for the system */ +/* variables that are stored in NVRAM. These structures and */ +/* definitions are also used when creating the boot ROM for the */ +/* target system. By using the same sysvars.h file it will ensure */ +/* consistency of the values stored by the boot ROM and the downloaded */ +/* RAM application. */ +/*---------------------------------------------------------------------*/ +#include + +/*---------------------------------------------------------------------*/ +/* psos.h header file defines IO_AUTOINIT and IO_NOAUTOINIT */ +/*---------------------------------------------------------------------*/ +#include + +/*---------------------------------------------------------------------*/ +/* If USE_RARP is set to YES, then the IP address is obtained from the */ +/* network. */ +/*---------------------------------------------------------------------*/ +#define USE_RARP NO + +/***********************************************************************/ +/* */ +/* B A S I C P A R A M E T E R S */ +/* */ +/* The parameters in this section determine the fashion in which */ +/* many of the other parameters in this file will be used. */ +/* */ +/* Many of the parameters in this file have names beginning with */ +/* either "SC_" or "SD_". Those beginning with "SC_" are ALWAYS */ +/* controlled by the values you set in this file. The values of */ +/* the "SD_" parameters can be determined either by the definitions */ +/* given in this file, or by the data found in the target board's */ +/* parameter storage area. SC_SD_PARAMETERS determines this. If */ +/* SC_SD_PARAMETERS is "SYS_CONF", then the values given in this */ +/* file will be used for the SD_ parameters. If SC_SD_PARAMETERS */ +/* is "STORAGE", then pSOSystem will attempt to use the values found */ +/* in the board's parameter storage area for the SD_ variables. If */ +/* the parameter storage area has not been initialized or has been */ +/* corrupted, then the values given in this file will be used. They */ +/* will also be written to the storage area. */ +/* */ +/* If SC_SD_PARAMETERS is STORAGE, you may enable a "startup dialog" */ +/* which will allow you to view, and optionally change, the */ +/* parameter values found in the storage area. The dialog is enabled */ +/* by setting SC_STARTUP_DIALOG to YES. In this case, */ +/* SD_STARTUP_DELAY specifies the number of seconds that the dialog */ +/* will wait for input before proceeding to boot the system. */ +/* */ +/* The SC_STARTUP_DIALOG define either enables the boot dialog if set */ +/* to YES, or disables the boot dialog if set to NO. */ +/* */ +/* SC_BOOT_ROM when set to YES, configures the application as a */ +/* ROMable application. If set to NO, treats it as a RAM application. */ +/* */ +/* SC_SD_DEBUG_MODE determines the mode of the system, as follows: */ +/* */ +/* DBG_SA: Boot pROBE+ in standalone mode. */ +/* */ +/* DBG_XS: Boot into pROBE+ and wait for the host debugger */ +/* via a serial connection */ +/* */ +/* DBG_XN: Boot into pROBE+ and wait for the host debugger */ +/* via a network connection */ +/* */ +/* DBG_AP: Same as DBG_SA, but also does a pROBE+ "silent startup",*/ +/* meaning that pROBE+ initializes itself without */ +/* printing a startup banner. pROBE+ then initializes */ +/* pSOS+ and starts the application running. This mode */ +/* was created to simplify implementation of the pSOSystem */ +/* Boot ROMs. Note that when this mode is used, SMODE_MASK */ +/* in TD_FLAGS is always set. (See pROBE+ configuration */ +/* parameters below.) */ +/* */ +/* STORAGE: Use the mode (DBG_SA, DBG_XS, or DBG_XN) found in the */ +/* parameter storage area. If a valid mode is not found, */ +/* then use DBG_SA. */ +/* */ +/* An important consequence of using SC_SD_DEBUG_MODE=STORAGE should */ +/* be noted. If you use the TFTP bootloader in the pSOSystem ROMs */ +/* to download and start your system, you will be setting */ +/* SC_SD_DEBUG_MODE = DBG_AP in your target board's parameter storage */ +/* area. Thus, if you have left SC_SD_DEBUG_MODE set to STORAGE in */ +/* this file, your downloaded system will also use DBG_AP, meaning */ +/* that the application will begin running immediately after the */ +/* TFTP bootloader has loaded and started your system. */ +/* */ +/* */ +/***********************************************************************/ +#define SC_SD_PARAMETERS STORAGE +#define SC_STARTUP_DIALOG NO +#define SC_BOOT_ROM NO +#define SD_STARTUP_DELAY 60 +#define SC_SD_DEBUG_MODE STORAGE + +/***********************************************************************/ +/* */ +/* O P E R A T I N G S Y S T E M C O M P O N E N T S */ +/* */ +/* Setting the definition line to YES will cause that component to */ +/* be built into the system. NO means the component will NOT be */ +/* put into the system. */ +/*---------------------------------------------------------------------*/ +/* pSOS+: It is an error to specify both SC_PSOS and SC_PSOSM as */ +/* present! */ +/* */ +/*---------------------------------------------------------------------*/ +/* pROBE+: The following set of macros control which features will be */ +/* built in to the pROBE+ Target Agent. pROBE+ can run either in */ +/* console mode (dumb terminal) or as a back-end to a Source Level */ +/* Debugger on the host. Not all modules are needed for all cases.*/ +/* By eliminating modules you can save memory. The definition of */ +/* the modules are as follows: */ +/* */ +/* SC_PROBE - pROBE+ core module. This must always be present if */ +/* any part of pROBE+ is to be used. Setting this to NO will */ +/* force all other pROBE+ modules to NO (even if they say YES */ +/* in this file). */ +/* */ +/* SC_PROBE_CIE - pROBE+ Console Executive. Set this to YES if you */ +/* wish to control pROBE+ from a dumb terminal. If you only */ +/* use a source debugger and/or pRISM+, you can save memory by */ +/* setting it to NO. If it is YES, you also need to sepcify the */ +/* serial port used by the pROBE+ via SC_PROBE_CONSOLE. */ +/* */ +/* SC_PROBE_DISSAM - pROBE+ Console Dissassembler. If you set */ +/* SC_PROBE_CIE to YES and wish to view disassembled memory, set */ +/* this to YES as well. If you are using a host debugger and/or */ +/* pRISM+, you can save memory by setting this to NO. */ +/* */ +/* SC_PROBE_QUERY - pROBE+ Query Services which provides the pSOS+ */ +/* awareness. This module allows you to query the information */ +/* about pSOS+ obejects, issue a console-induced manual break */ +/* or halt-request from the host debugger, set the task-specific */ +/* breakpoints, service call breakpoints and task-dispatch */ +/* breakpoints. Unless you have severe memory restrictions or */ +/* your application does not use pSOS+ kernel, it is suggested */ +/* that you set this to YES. */ +/* */ +/* SC_PROBE_DEBUG - pROBE+ Remote Debug Module. This module is */ +/* used to enable communication between a host based source */ +/* debugger and/or pRISM+ to the pROBE+ target agent using a */ +/* light weight binary protocol. This must be set to YES to */ +/* enable pROBE+ to communicate with a source debugger or the */ +/* pRISM+ host tools. It can be set to NO if you only use the */ +/* pROBE+ console (dumb terminal) mode. If it is YES and the */ +/* host debuuger is connected the target via network, you have */ +/* to set the SC_PNET or SC_PNA to YES. If the host debugger */ +/* is using the serial connection, you have to select the proper */ +/* serial port via SC_RBUG_PORT. Note if a serial port is used */ +/* by the pROBE+ for the host debugger connection, this port */ +/* should not be used by the application except for */ +/* SC_PROBE_CONSOLE. For example, you should not set */ +/* SC_RBUG_PORT and SC_APP_CONSOLE to the same serial port */ +/* unless you don't use the host debugger when the application */ +/* is running. */ +/* */ +/* SC_PROBE_HELP - pROBE+ online help module. Setting this define */ +/* to YES provides the user with pROBE+ commands, when in */ +/* stand-alone mode. */ +/*---------------------------------------------------------------------*/ +/* SC_PHILE through SC_POSIX_TIMERS - Setting the definition line to*/ +/* YES will cause that component to be built into the system. */ +/* Setting it to NO means the component will NOT be put into the */ +/* system. */ +/* */ +/***********************************************************************/ +#define SC_PSOS YES /* pSOS+ real-time kernel */ +#define SC_PSOSM NO /* pSOS+ real-time multiproc kernel */ +#define SC_PSOS_QUERY NO /* pSOS+ Query Services */ +#define SC_PROBE YES /* pROBE+ (processor svcs) */ +#define SC_PROBE_DISASM YES /* pROBE+ (disassembler) */ +#define SC_PROBE_CIE YES /* pROBE+ (console executive) */ +#define SC_PROBE_QUERY YES /* pROBE+ (query services) */ +#define SC_PROBE_DEBUG YES /* pROBE+ (debug interface executive) */ +#define SC_PROBE_HELP YES /* pROBE+ Help command Handler. */ +#define SC_PHILE YES /* pHILE+ file system manager */ +#define SC_PHILE_PHILE YES /* pHILE+ (pHILE+ real-time file sys) */ +#define SC_PHILE_MSDOS YES /* pHILE+ (MS-DOS FAT file system) */ +#define SC_PHILE_NFS YES /* pHILE+ (NFS client) */ +#define SC_PHILE_CDROM NO /* pHILE+ (ISO 9660 CD-ROM file sys) */ +#define SC_PREPC YES /* pREPC+ C run-time library */ +#define SC_PNA YES /* pNA+ TCP/IP networking manager */ +#define SC_PNET NO /* pNET Library for BOOT ROMS */ +#define SC_PRPC YES /* pRPC+ RPC component */ +#define SC_PSE_PRPC NO /* pRPC+ RPC component Over pSE+ */ +#define SC_PSE NO /* pSE+ streams component */ +#define SC_PSKT NO /* pSKT+ SKT library component */ +#define SC_PTLI NO /* pTLI+ TLI library component */ +#define SC_PMONT NO /* pMONT+ */ +#define SC_PLM NO /* pLM+ Shared library manager */ +#define SC_PROFILER NO /* RTA profiler configuration */ +#define SC_RTEC NO /* RTA run-time error checker library */ +#define SC_POSIX NO /* POSIX component (core) */ +#define SC_POSIX_MESSAGE_PASSING NO /* POSIX (Message Queue svcs) */ +#define SC_POSIX_SEMAPHORES NO /* POSIX (semaphore svcs) */ +#define SC_POSIX_THREADS YES /* POSIX (pthread svcs) */ +#define SC_POSIX_TIMERS NO /* POSIX (clock and timer svcs)*/ + +/*---------------------------------------------------------------------*/ +/* If SC_QBIND is set to YES then the Quick bindings for pSOS+ System */ +/* calls will be used. If it is set to NO then the normal bindings */ +/* will be used. */ +/* */ +/* Quick bindings will not be supported for the applications with */ +/* USER mode Tasks. So make sure your Application does not have any */ +/* USER mode Tasks. */ +/*---------------------------------------------------------------------*/ +#define SC_QBIND NO /* Quick bindings for pSOSystem calls*/ + +/*---------------------------------------------------------------------*/ +/* If set to IO_AUTOINIT device drivers that are installed be the */ +/* InstallDriver function will have their autoinit field set. This */ +/* will cause pSOS+ call the drivers initialization function when */ +/* pSOS+ starts up. The de_init call will not have to be called for */ +/* each driver if this is done. */ +/* */ +/* NOTE: This Auto Initialization will not work on all drivers. */ +/* Setting IO_AUTOINIT only effects drivers that can use the Auto */ +/* Initialization feature. */ +/* */ +/* If set to IO_NOAUTOINIT no automatic driver initialization will */ +/* happen. */ +/*---------------------------------------------------------------------*/ +#define SC_AUTOINIT IO_AUTOINIT + +/*---------------------------------------------------------------------*/ +/* If SC_PMONT SC_AUTOINIT will always be set to 1 because pMONT needs */ +/* drivers to be automatically initialized. */ +/*---------------------------------------------------------------------*/ +#if SC_PMONT + #undef SC_AUTOINIT + #define SC_AUTOINIT IO_AUTOINIT +#endif + +/***********************************************************************/ +/* */ +/* S E R I A L C H A N N E L C O N F I G U R A T I O N */ +/* */ +/* * SD_DEF_BAUD specifies the default baud rate to be used for the */ +/* serial channels */ +/* * SC_APP_CONSOLE specifies the serial channel number (starting */ +/* from 1) which should be used for the application's "console". */ +/* * SC_PROBE_CONSOLE specifies the serial channel number (starting */ +/* from 1) which pROBE+ should use to display output and receive */ +/* commands, or to communicate with the host debugger. */ +/* * SC_RBUG_PORT specifies the serial channel number (starting */ +/* from 1) which will be used for the connnect between the host */ +/* debugger and the pROBE+ on the target. This is not needed if */ +/* the host debugger is using the network connection. It can be */ +/* disabled by using a value of 0. Note the port specified by */ +/* SC_RBUG_PORT port should not be used by the application except */ +/* for SC_PROBE_CONSOLE. For example, you should not set */ +/* SC_RBUG_PORT and SC_APP_CONSOLE to the same serial channel */ +/* unless you don't use the host debugger when the application is */ +/* running. */ +/* */ +/* Above three macros SC_PROBE_CONSOLE, SC_APP_CONSOLE and */ +/* SC_RBUG_PORT uses SERIAL_DRVRNUM(0) as default. This means that */ +/* the Low-Level Serial Driver 0 (1) is being used default. */ +/* */ +/* If you need to use another driver for any of the above macros */ +/* and another macro for pMONT PM_DEV, You need to change "0" to */ +/* the driver number you want. Consult the "README" file in BSP */ +/* directory for number of different drivers supported and for the */ +/* SERIAL_DRVRNUM mapping for those drivers. */ +/* */ +/***********************************************************************/ +#define SD_DEF_BAUD 9600 +#define SC_APP_CONSOLE (1 + SERIAL_DRVRNUM(0)) +#define SC_PROBE_CONSOLE (1 + SERIAL_DRVRNUM(0)) +#define SC_RBUG_PORT (0 + SERIAL_DRVRNUM(0)) + +/***********************************************************************/ +/* SC_NumNon_pSOSChan is the number of non-pSOS users of the serial */ +/* channels. These are users that will be initiated before pSOS, */ +/* such as pROBE. */ +/* */ +/* NOTE: These channels will not be closed on a soft reset. */ +/***********************************************************************/ +#if (SC_RBUG_PORT && SC_PROBE_CONSOLE && (SC_PROBE_CONSOLE != PCCON)) +#define SC_NumNon_pSOSChan 2 +#else +#define SC_NumNon_pSOSChan 1 +#endif + +/***********************************************************************/ +/* */ +/* L A N C O N F I G U R A T I O N */ +/* */ +/* */ +/***********************************************************************/ +#define SD_LAN1 NO /* Disable the LAN interface */ +#define SD_LAN1_IP 0x00000000 /* IP address of the node */ +#define SD_LAN1_SUBNET_MASK 0x00000000 /* subnet mask for the node */ + +/*---------------------------------------------------------------------*/ +/* Maximum number of multicast addresses to be used by the lan */ +/* interface. Must not exceed maximum supported by the lan driver. */ +/*---------------------------------------------------------------------*/ +#define SC_LAN1_NMCAST 0 + +/***********************************************************************/ +/* */ +/* B U S C O N F I G U R A T I O N */ +/* */ +/* */ +/***********************************************************************/ +#define SD_VME_BASE_ADDR 0x01000000 /* VME bus base address */ + +/***********************************************************************/ +/* */ +/* S H A R E D M E M O R Y C O N F I G U R A T I O N */ +/* */ +/* */ +/***********************************************************************/ + +/*---------------------------------------------------------------------*/ +/* If you want to build a "Shared Memory Interface" for the network or */ +/* multi-processing pSOS+m, set SD_SM_NODE to the node number of this */ +/* node ( a non-zero value). */ +/*---------------------------------------------------------------------*/ +#define SD_SM_NODE 0 /* Node number for this node */ + +/*---------------------------------------------------------------------*/ +/* Shared memory network interface (SMNI) - SC_NISM_LEVEL should be 1 */ +/* if this will be the FIRST system to use the SMNI on this board. It */ +/* should be 2 if this will not be the first system to use SMNI on this*/ +/* board. Usually this means that SC_NISM_LEVEL should be 1 if you */ +/* are building Boot ROMs, and 2 for a system that will be downloaded */ +/* and started using the Boot ROMs. See the comments at the beginning */ +/* of drivers/ni_smem.c for more explanation. */ +/*---------------------------------------------------------------------*/ +#define SD_NISM NO /* Disable/Enable Shared Mem NI */ +#define SD_NISM_IP 0x00000000 /* IP address of this node */ +#define SD_NISM_DIRADDR 0x00000400 /* Bus addr of SMNI directory */ +#define SC_NISM_BUFFS 30 /* Num of buffers for SMNI */ +#define SC_NISM_LEVEL 2 /* SMNI Level, 1 if first node */ +#define SD_NISM_SUBNET_MASK 0x00000000 /* Subnet mask for the SMNI */ + + +/*---------------------------------------------------------------------*/ +/* If you want to build a multi-node pSOS+m system, set SD_KISM */ +/* to the number of nodes in the system. */ +/*---------------------------------------------------------------------*/ +#define SD_KISM 0 /* Num of nodes that will use the SMKI */ +/*---------------------------------------------------------------------*/ +/* Bus Address of the system-wide directory structure that all nodes */ +/* in the system have access to. */ +/*---------------------------------------------------------------------*/ +#define SD_KISM_DIRADDR 0x00000580 +#define SC_KISM_BUFFS 100 /* Num of buffers for SMKI */ + + +/***********************************************************************/ +/* */ +/* M I S C E L L A N E O U S N E T W O R K I N G */ +/* P A R A M E T E R S */ +/* */ +/***********************************************************************/ +#define SD_DEF_GTWY_IP 0x00000000 /* Default gateway IP address*/ + + +/***********************************************************************/ +/* SC_RAM_SIZE define controls the end of RAM as seen by pSOSystem. */ +/* If it is set to zero, then pSOSystem uses ALL of the memory */ +/* remaining on a board for dynamic allocation ("region 0"). You may */ +/* override this by setting SC_RAM_SIZE to a non-zero value. If you do,*/ +/* pSOSystem will not touch any memory after the specified address. */ +/* */ +/* NOTE: This is useful when making a BOOT ROM and you want to ensure */ +/* that the ROM's RAM area does not overflow the space allocated for it*/ +/***********************************************************************/ +#define SC_RAM_SIZE 0 + +/***********************************************************************/ +/* */ +/* I / O D E V I C E S */ +/* */ +/* Each device may be included in the system by specifying a major */ +/* number for it, which determines its slot in the pSOS+ I/O switch */ +/* table. To leave a device driver out of the system, use NO for */ +/* the major number. */ +/* */ +/* Note the following: */ +/* */ +/* * Major device 0 is reserved and cannot be used for any of these */ +/* devices. Setting a device number to 0 here is the same as NO. */ +/* */ +/* * No device number may be higher than SC_DEVMAX (SC_DEVMAX may */ +/* be increased, if desired) */ +/* */ +/* * The lines defining the symbols DEV_SERIAL, DEV_TIMER, etc, */ +/* should not be changed. These are for use by application */ +/* programs as the "device number" parameter on de_* calls. */ +/* */ +/***********************************************************************/ +#define SC_DEV_SERIAL 1 /* Serial driver */ +#define SC_DEV_TIMER 2 /* Periodic tick timer */ +#define SC_DEV_RAMDISK 3 /* RAM disk */ +#define SC_DEV_CONSOLE NO /* PC-Console driver */ +#define SC_DEV_SCSI 5 /* SCSI bus */ +#define SC_DEV_SCSI_TAPE 6 /* SCSI bus, tape device */ +#define SC_DEV_IDE 7 /* IDE Driver */ +#define SC_DEV_FLOPPY 8 /* Floppy Driver */ +#define SC_DEV_NTFTP 9 /* New TFTP pseudo driver */ +#define SC_DEV_TFTP 10 /* TFTP pseudo driver */ +#define SC_DEV_HTTP NO /* HTTP pseudo driver */ +#define SC_DEV_SPI NO /* SPI driver */ +#define SC_DEV_DLPI NO /* DLPI pseudo driver */ +#define SC_DEV_OTCP NO /* 14 TCP/IP for OpEN */ +#define SC_IP SC_DEV_OTCP /* 14 IP */ +#define SC_ARP NO /* 15 ARP */ +#define SC_TCP NO /* 16 TCP */ +#define SC_UDP NO /* 17 UDP */ +#define SC_RAW NO /* 18 RAW */ +#define SC_LOOP NO /* 19 LOOP = (SC_DEV_OTCP + 5) */ +#define SC_DEV_SOSI NO /* 20 OSI for OpEN */ +#define SC_DEV_PSCONSOLE 21 /* Pseudo Console driver */ +#define SC_DEV_MEMLOG 22 /* Memory log driver */ +#define SC_DEV_RDIO 23 /* pROBE+ RDIO driver */ +#define SC_DEV_NULL 24 /* Null Device Driver */ +#define SC_DEV_PARALLEL NO /* Parallel Port Driver */ +#define SC_DEV_CMOS NO /* CMOS Driver */ +#define SC_DEV_WATCHDOG NO /* Watchdog Driver */ +#define SC_DEV_OLAP NO /* LAP Drivers */ +#define SC_PHPI (SC_DEV_OLAP) /* Phpi driver */ +#define SC_LAPB (SC_DEV_OLAP + 0)/* LAPB driver Change 0 to 1 */ +#define SC_DEV_OX25 NO /* X25 Drivers */ +#define SC_X25 (SC_DEV_OX25) /* X.25 plp driver */ +#define SC_SNDCF NO /* sndcf driver */ +#define SC_IPCONV NO /* ip convergence driver */ +#define SC_DEV_ISDN NO /* ISDN Drivers */ +#define SC_PH (SC_DEV_ISDN) /* PH driver */ +#define SC_LAPD (SC_DEV_ISDN + 0)/* LAPD driver Change 0 to 1 */ +#define SC_IPCD (SC_DEV_ISDN + 0)/* IPCD driver Change 0 to 2 */ +#define SC_DEV_MLPP NO /* MultiLink PPP Drivers */ +#define SC_FRMUX (SC_DEV_MLPP) /* FRMUX driver */ +#define SC_PPP (SC_DEV_MLPP + 0)/* PPP driver Change 0 to 1 */ +#define SC_PIM (SC_DEV_MLPP + 0)/* PIM driver Change 0 to 2 */ +#define SC_DEV_LOG NO /* STREAMS log driver */ +#define SC_DEV_PSMUX NO /* Sample Mux driver */ +#define SC_DEV_PSLWR NO /* Sample loopback driver */ +#define SC_DEV_SLLWR NO /* Sample loopback driver */ +#define SC_DEV_PIPE 43 /* Pipe Driver. */ + +#define SC_DEVMAX 44 /* Maximum device number */ + +#define DEV_SERIAL (SC_DEV_SERIAL << 16) +#define DEV_PARALLEL (SC_DEV_PARALLEL << 16) +#define DEV_TIMER (SC_DEV_TIMER << 16) +#define DEV_RAMDISK (SC_DEV_RAMDISK << 16) +#define DEV_SCSI (SC_DEV_SCSI << 16) +#define DEV_SCSI_TAPE (SC_DEV_SCSI_TAPE << 16) +#define DEV_PSCONSOLE (SC_DEV_PSCONSOLE << 16) +#define DEV_SYSCONSOLE ((SC_DEV_PSCONSOLE << 16) + SYSCONSOLE_DEV) +#define DEV_PSEUDO ((SC_DEV_PSCONSOLE << 16) + PSEUDO_DEV) +#define DEV_STDIN ((SC_DEV_PSCONSOLE << 16) + STDIN_DEV) +#define DEV_STDOUT ((SC_DEV_PSCONSOLE << 16) + STDOUT_DEV) +#define DEV_STDERR ((SC_DEV_PSCONSOLE << 16) + STDERR_DEV) +#define DEV_NULL (SC_DEV_NULL << 16) +#define DEV_MEMLOG (SC_DEV_MEMLOG << 16) +#define DEV_RDIO (SC_DEV_RDIO << 16) +#define DEV_DLPI (SC_DEV_DLPI << 16) +#define DEV_TFTP (SC_DEV_TFTP << 16) +#define DEV_NTFTP (SC_DEV_NTFTP << 16) +#define DEV_HTTP (SC_DEV_HTTP << 16) +#define DEV_SPI (SC_DEV_SPI << 16) +#define DEV_WATCHDOG (SC_DEV_WATCHDOG << 16) +#define DEV_FLOPPY (SC_DEV_FLOPPY << 16) +#define DEV_IDE (SC_DEV_IDE << 16) +#define DEV_CMOS (SC_DEV_CMOS << 16) +#define DEV_CONSOLE (SC_DEV_CONSOLE << 16) +#define DEV_IP (SC_IP << 16) +#define DEV_ARP (SC_ARP << 16) +#define DEV_TCP (SC_TCP << 16) +#define DEV_UDP (SC_UDP << 16) +#define DEV_RAW (SC_RAW << 16) +#define DEV_LOOP (SC_LOOP << 16) +#define DEV_PHPI (SC_PHPI << 16) +#define DEV_LAPB (SC_LAPB << 16) +#define DEV_X25 (SC_X25 << 16) +#define DEV_SNDCF (SC_SNDCF << 16) +#define DEV_IPCONV (SC_IPCONV << 16) +#define DEV_PH (SC_PH << 16) +#define DEV_LAPD (SC_LAPD << 16) +#define DEV_IPCD (SC_IPCD << 16) +#define DEV_FRMUX (SC_FRMUX << 16) +#define DEV_PIM (SC_PIM << 16) +#define DEV_PPP (SC_PPP << 16) +#define DEV_LOG (SC_DEV_LOG << 16) +#define DEV_PSMUX (SC_DEV_PSMUX << 16) +#define DEV_PSLWR (SC_DEV_PSLWR << 16) +#define DEV_SLLWR (SC_DEV_SLLWR << 16) +#define DEV_PIPE (SC_DEV_PIPE << 16) + +#if (BSP_CPUFAMILY == FAMILY_X86) && (SC_APP_CONSOLE == PCCON) + #define CONSOLE DEV_CONSOLE +#else + #define CONSOLE DEV_SERIAL +#endif + +/***********************************************************************/ +/* p S E U D O D R I V E R D E F I N E S */ +/* */ +/* The defines below control the behavour of the pSEUDO driver if the */ +/* SC_DEV_PSCONSOLE is enabled. */ +/* */ +/***********************************************************************/ +#define SC_PSCNSL_SHARED_CHAN 2 /* Num of shared channels */ +#define SC_PSCNSL_PRIVATE_CHAN 4 /* Number of private channels */ +#define SC_PSCNSL_MAX_CUSTOM 1 /* NUmber of custome device */ +#define SC_PSCNSL_DEFAULT_DEV CONSOLE /* Default console device */ + +/***********************************************************************/ +/* T F T P D R I V E R C O N F I G U R A T I O N */ +/* */ +/* The defines below define the Configuration Parameters needed by the */ +/* TFTP driver. */ +/* */ +/***********************************************************************/ +#define SC_MAX_TFTP_CHAN 8 /* Maximum number of TFTP channels */ + +/***********************************************************************/ +/* H T T P S E R V E R C O N F I G U R A T I O N */ +/* */ +/* The SC_MAX_HTTP_CHAN define controls the maximum number of HTTP */ +/* channels in the system. */ +/* */ +/***********************************************************************/ +#define SC_MAX_HTTP_CHAN 1 + +/***********************************************************************/ +/* P I P E D R I V E R C O N F I G U R A T I O N */ +/* */ +/* The SC_MAX_PIPE_CHAN define controls the maximum number of PIPE */ +/* channels that will be configured in the system. */ +/* */ +/***********************************************************************/ +#define SC_MAX_PIPE_CHAN 1 + +/***********************************************************************/ +/* */ +/* M M U L I B R A R Y P A R A M S */ +/* */ +/* The SC_MMULIB define controls the MMU library call-outs when pROBE+ */ +/* is entered. Setting this to YES enables the callouts, while setting */ +/* this to NO disables the callouts when pROBE+ is entered and BSP_MMU */ +/* is enabled. */ +/* */ +/***********************************************************************/ +#define SC_MMULIB NO + +/***********************************************************************/ +/* */ +/* C O M P O N E N T C O N F I G U R A T I O N P A R A M E T E R S */ +/* */ +/* These parameters should work as is for this application. You */ +/* may want to change some of them if you start customizing this */ +/* application. */ +/* */ +/***********************************************************************/ + +/*---------------------------------------------------------------------*/ +/* pSOS+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define KC_RN0USIZE 0x100 /* region 0 unit size */ +#define KC_NTASK 40 /* max number of tasks */ +#define KC_NQUEUE 25 /* max number of message queues */ +#define KC_NSEMA4 30 /* max number of semaphores */ +#define KC_NTIMER 20 /* max number of timers */ +#define KC_NMUTEX 20 /* Max number of mutexes */ +#define KC_NCVAR 20 /* Max number of condition variables */ +#define KC_NTVAR 5 /* Max number of task variables */ +#define KC_NCOCB 5 /* Max number of callouts */ +#define KC_NTSD 5 /* Max # of Task Specific Data entries */ +#define KC_NLOCOBJ 100 /* max number of local objects */ +#define KC_NMSGBUF 256 /* max number of message buffers */ +#define KC_TICKS2SEC 100 /* clock tick interrupt frequency */ +#define KC_TICKS2SLICE 10 /* time slice quantum, in ticks */ +#define KC_MAXDNTENT 10 /* max number of device names in DNT */ +#define KC_DNLEN 10 /* max length of a device name in DNT */ +#define KC_SYSSTK 0x1000 /* pSOS+ system stack size (bytes) */ +#define KC_ROOTSSTK 0x2000 /* ROOT supervisor stack size */ +#define KC_IDLESTK 0x0400 /* IDLE stack size */ +#define KC_ROOTUSTK 0 /* ROOT user stack size */ +#define KC_ROOTMODE (T_SUPV | T_ISR) /* ROOT initial mode */ +#define KC_ROOTPRI 230 /* ROOT task priority */ +#define KC_NIO (SC_DEVMAX+1) /* # of devices in initial iojtab */ +#define KC_MAXIO (SC_DEVMAX+1) /* Max # of devices in the system */ + +/*---------------------------------------------------------------------*/ +/* The following are examples for modifying the following defines */ +/* */ +/* To configure a user written routine as a fatal error handler, you */ +/* need to do the following: */ +/* */ +/* extern void MyHandler (void); */ +/* #define KC_FATAL ((void (*)()) MyHandler) */ +/* */ +/*---------------------------------------------------------------------*/ +#define KC_STARTCO 0 /* callout at task activation */ +#define KC_DELETECO 0 /* callout at task deletion */ +#define KC_SWITCHCO 0 /* callout at task switch */ + +#define KC_FATAL 0 /* fatal error handler address */ +#define KC_IDLECO 0 /* Idle Task Callout */ + +/*---------------------------------------------------------------------*/ +/* pSOS+m configuration parameters */ +/*---------------------------------------------------------------------*/ +#define MC_NGLBOBJ 8 /* size of gbl obj table */ +#define MC_NAGENT 10 /* number of RPC agents in this node */ +#define MC_FLAGS SEQWRAP_ON /* operating mode flags */ + +/*---------------------------------------------------------------------*/ +/* The following are examples for modifying the following definition */ +/* */ +/* Using a user written routine as a roster change handler */ +/* extern void MyHandler (void); */ +/* #define MC_ROSTER ((void (*)()) MyHandler) */ +/* */ +/*---------------------------------------------------------------------*/ +#define MC_ROSTER 0 /* addr of user roster change callout */ +#define MC_KIMAXBUF 100 /* maximum KI packet buffer length */ +#define MC_ASYNCERR 0 /* asynchronous calls error callout */ + +/*---------------------------------------------------------------------*/ +/* pROBE+ configuration parameters */ +/* */ +/* NOTE: The SMODE_MASK bit in TD_FLAGS is set as */ +/* SC_SD_DEBUG_MODE = DBG_AP. */ +/*---------------------------------------------------------------------*/ +#define TD_BRKOPC 0 /* Instruction break opcode */ +#define TD_DBGPRI 244 /* Debugger task priority */ +#define TD_ILEV (MAX_ILEV << 12) /* pROBE+ interrupt mask */ +#define TD_FLAGS (NODOTS_MASK | TD_ILEV | NOTUPD_MASK)/* flags */ + +/*---------------------------------------------------------------------*/ +/* The variable defined below should be set to the Starting address */ +/* for pROBE+ DATA AREA. This is required by all the smaller boards. */ +/* NOTE: */ +/* Setting of this value should be a variable which is a array */ +/* of characters with atleast 0x4400 bytes free space. */ +/*---------------------------------------------------------------------*/ +#define TD_DATASTART 0x0 + +/*---------------------------------------------------------------------*/ +/* pHILE+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define FC_LOGBSIZE 9 /* Block size (base-2 exponent) */ +#define FC_NBUF 6 /* Number of cache buffers */ +#define FC_NMOUNT 3 /* Max # of mounted volumes */ +#define FC_NFCB 10 /* Max # of opened files per system */ +#define FC_NCFILE 2 /* Max # of opened files per task */ +#define FC_NDNLC 0 /* Max # of cached directory entries */ + +/*---------------------------------------------------------------------*/ +/* pHILE+ DATA AREA definitions. */ +/*---------------------------------------------------------------------*/ +#define FC_DATA 0 /* pHILE+ Data Area Starting Address */ +#define FC_DATASIZE 0 /* pHILE+ Data Area Size */ + +/*---------------------------------------------------------------------*/ +/* Set the FC_ERRCO define to install the callout handler for I/O */ +/* errors. The callout handler provided in FC_ERRCO will be called if */ +/* there is an error during an I/O operation on the Volume. */ +/* */ +/* To install the error callout handler: Follow the syntax below */ +/* */ +/* #include */ +/* extern user_fcerrco(int, ULONG, const struct buffer_header *) */ +/* #define FC_ERRCO user_fcerrco */ +/* */ +/*---------------------------------------------------------------------*/ +#define FC_ERRCO 0 /* I/O error call-out */ + +/*---------------------------------------------------------------------*/ +/* pLM+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define LM_MAXREG 8 /* Max # of registered libraries */ +#define LM_DATA 0 /* pLM+ data area */ +#define LM_DATASIZE 0 /* pLM+ data area size */ + +/*---------------------------------------------------------------------*/ +/* Set LM_DEFAULT_COUTS to YES if you need to use the pSOSystem Default*/ +/* pLM Callouts. Set it to NO if you are providing the callouts. */ +/* */ +/* Setting LM_DEFAULT_COUTS to NO needs "LM_LOADCO" and "LM_UNLOADCO" */ +/* definitions to be valid address (Function address). */ +/*---------------------------------------------------------------------*/ +#define LM_DEFAULT_COUTS YES + +/*---------------------------------------------------------------------*/ +/* */ +/* The following callouts needs to be defined by user, If users wants */ +/* their callouts to be used instead of pSOSystem default Callouts. */ +/* */ +/* If we are using pSOSystem default callouts, Users needs to add their*/ +/* callouts to the pSOSystem callouts table using PssRegister_pLM_couts*/ +/* and remove using PssDeregister_pLM_couts. */ +/* */ +/* To have user callouts follow the syntax below: */ +/* */ +/* #include */ +/* extern ULONG user_load_co(const char *libname, ULONG scope, */ +/* ULONG version, const void *libinfo, */ +/* sl_attrib *attr); */ +/* extern ULONG user_unload_co(const sl_attrib *attr); */ +/* */ +/* #define LM_LOADCO user_load_co */ +/* #define LM_UNLOADCO user_unload_co */ +/* */ +/*---------------------------------------------------------------------*/ +#define LM_LOADCO 0 +#define LM_UNLOADCO 0 + +/*---------------------------------------------------------------------*/ +/* pREPC+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define LC_BUFSIZ (1 << FC_LOGBSIZE) /* I/O buffer size */ +#define LC_NUMFILES 5 /* Max number of open files per task */ +#define LC_WAITOPT 0 /* Wait option for memory allocation */ +#define LC_TIMEOPT 0 /* Timeout option for mem allocation */ + +/*---------------------------------------------------------------------*/ +/* pREPC+ stdin, stdout and stderr device mapping. */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_PSCONSOLE) +#define LC_STDIN "///dev/stdin" /* The default STDIN device */ +#define LC_STDOUT "///dev/stdout" /* The default STDOUT device */ +#define LC_STDERR "///dev/stderr" /* The default STDERR device */ + +#elif (BSP_CPUFAMILY == FAMILY_X86) && (SC_APP_CONSOLE == PCCON) +#define LC_STDIN "///dev/pcconsole" /* Make PCCON as STDIN device */ +#define LC_STDOUT "///dev/pcconsole" /* Make PCCON as STDOUT device */ +#define LC_STDERR "///dev/pcconsole" /* Make PCCON as STDERR device */ + +#elif (SC_DEV_SERIAL) +#define LC_STDIN "///dev/tty" /* Make TTY the STDIN device */ +#define LC_STDOUT "///dev/tty" /* Make TTY the STDOUT device */ +#define LC_STDERR "///dev/tty" /* Make TTY the STDERR device */ + +#else +#define LC_STDIN "///dev/null" /* Make NULL the STDIN device */ +#define LC_STDOUT "///dev/null" /* Make NULL the STDOUT device */ +#define LC_STDERR "///dev/null" /* Make NULL the STDERR device */ +#endif + +#if (SC_DEV_RAMDISK) +#define LC_TEMPDIR DEV_RAMDISK /* The default TEMPDIR device */ + +#elif (SC_DEV_SCSI) +#define LC_TEMPDIR DEV_SCSI /* The default TEMPDIR device */ + +#elif (SC_DEV_IDE) +#define LC_TEMPDIR DEV_IDE /* The default TEMPDIR device */ + +#elif (SC_DEV_FLOPPY) +#define LC_TEMPDIR DEV_FLOPPY /* The default TEMPDIR device */ + +#else +#define LC_TEMPDIR 0 /* The default TEMPDIR device */ +#endif + + +/*---------------------------------------------------------------------*/ +/* pNA+ configuration parameters */ +/* */ +/* NOTE: If you get pNA+ errno 5F01 FAT_INSUFFMEM you may need to */ +/* decrease the number of buffers allocated here for pNA+. */ +/* In general this error means pNA+ could not allocate enough */ +/* memory from Region 0 for the number of buffers requested. */ +/*---------------------------------------------------------------------*/ +#define NC_NNI 5 /* size of pNA NI Table */ +#define NC_NROUTE 10 /* size of pNA Routing Table */ +#define NC_NARP 20 /* size of pNA ARP table */ +#define NC_DEFUID 0 /* Default User ID of a task */ +#define NC_DEFGID 0 /* Default Group ID of a task */ +#define NC_HOSTNAME "scg" /* Hostname of the node */ +#define NC_NHENTRY 8 /* Number of Host table entries */ + +#define NC_NMCSOCS 0 /* Number of IP multicast sockets */ +#define NC_NMCMEMB 0 /* Number of distict IP multicast */ + /* group memberships per interface */ + +#define NC_NNODEID 0 /* Network NODE ID for unnumbered link */ + +#define NC_NSOCKETS 64 /* Number of sockets in the system */ +#define NC_NDESCS 8 /* # of socket descriptors/task */ +#define NC_MBLKS 300 /* # of message blocks in the system */ + +#define NC_BUFS_0 64 /* number of 0 length buffers */ +#define NC_BUFS_32 0 /* number of 32 length buffers */ +#define NC_BUFS_64 0 /* number of 64 length buffers */ +#define NC_BUFS_128 256 /* number of 128 byte buffers */ +#define NC_BUFS_256 0 /* number of 256 byte buffers */ +#define NC_BUFS_512 0 /* number of 512 byte buffers */ +#define NC_BUFS_1024 16 /* number of 1k byte buffers */ +#define NC_BUFS_2048 48 /* number of 2k byte buffers */ +#define NC_BUFS_4096 0 /* number of 4k byte buffers */ + +#define NC_MAX_BUFS 9 /* max number of NC_BUFS types */ + +#define NC_PNAMEM_NEWSCHEME YES /* apply new pNA MEM management scheme*/ + +#define NC_BUFS_XX_INTERNAL 20 /* # of buffers for internal pNA usage */ +#define NC_MBLKS_INT_PERCENT 15 /* % of mblks reserved for pNA internal */ +#define NC_MBLKS_TX_PERCENT 40 /* % of mblks reserved for Tx Mem Pool */ + +#define NC_BUFS_0_TX_PERCENT 50 /* % of 0 length buffers used for Tx */ +#define NC_BUFS_32_TX_PERCENT 50 /* % of 32 length buffers used for Tx */ +#define NC_BUFS_64_TX_PERCENT 50 /* % of 64 length buffers used for Tx */ +#define NC_BUFS_128_TX_PERCENT 50 /* % of 128 byte buffers used for Tx */ +#define NC_BUFS_256_TX_PERCENT 50 /* % of 256 byte buffers used for Tx */ +#define NC_BUFS_512_TX_PERCENT 50 /* % of 512 byte buffers used for Tx */ +#define NC_BUFS_1024_TX_PERCENT 50 /* % of 1k byte buffers used for Tx */ +#define NC_BUFS_2048_TX_PERCENT 50 /* % of 2k byte buffers used for Tx */ +#define NC_BUFS_4096_TX_PERCENT 50 /* % of 4k byte buffers used for Tx */ + +/*---------------------------------------------------------------------*/ +/* pNA+ daemon task configuration parameters */ +/*---------------------------------------------------------------------*/ +#define NC_DTASK_SSTKSZ 0x800 /* pNAD daemon task sstack size*/ +#define NC_DTASK_USTKSZ 0x400 /* pNAD daemon task ustack size*/ +#define NC_DTASK_PRIO 255 /* pNAD daemon task priority */ +#define NC_NEW_MULTITASK_SYNC YES /* deploy new pNA+ sync scheme */ +#define NC_USE_MUTEX YES /* use pSOS MUTEX primitive */ + +/*---------------------------------------------------------------------*/ +/* pNA+ DATA AREA definitions. */ +/*---------------------------------------------------------------------*/ +#define NC_DATA 0 /* pNA+ Data Area Starting Addr*/ +#define NC_DATASIZE 0 /* pNA+ Data Area Size */ + +/*---------------------------------------------------------------------*/ +/* The following are examples for modifying the following defines */ +/* */ +/* Using a user written routine as a pNA+ Signal Handler */ +/* extern void MySigHandler (void); */ +/* #define NC_SIGNAL ((void (*)()) MySigHandler) */ +/* */ +/*---------------------------------------------------------------------*/ +#define NC_SIGNAL 0 /* pNA+ Signal Hdlr */ + +/*---------------------------------------------------------------------*/ +/* pRPC+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define NR_PMAP_PRIO 254 /* task priority */ +#define NR_PMAP_SSTACK 0x2000 /* supervisor stack size */ +#define NR_PMAP_USTACK 0x100 /* user stack size */ +#define NR_PMAP_FLAGS T_LOCAL /* t_create flags */ +#define NR_PMAP_MODE T_SUPV /* t_start mode */ +#define NR_DEBUG_FLAG NO /* Turns on debug msgs from PMAP task */ + +/*---------------------------------------------------------------------*/ +/* pRPC+ DATA AREA definitions. */ +/*---------------------------------------------------------------------*/ +#define NR_DATA 0 /* pRPC+ Data Area Starting Address */ +#define NR_DATASIZE 0 /* pRPC+ Data Area Size */ + +/*---------------------------------------------------------------------*/ +/* User can change these TWO defines to have their own handlers. */ +/*---------------------------------------------------------------------*/ +#define NR_GETHOSTNAME nr_gethostname /* Function to get local */ + /* host name */ +#define NR_GET_HENTBYNAME nr_get_hentbyname /* Function to map host */ + /* name to it's IP Addr */ + +/*---------------------------------------------------------------------*/ +/* pSE+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define SE_NBUFS_0 64 /* number of 0 length buffers */ +#define SE_NBUFS_32 128 /* number of 32 byte buffers */ +#define SE_NBUFS_64 128 /* number of 64 byte buffers */ +#define SE_NBUFS_128 256 /* number of 128 byte buffers */ +#define SE_NBUFS_256 32 /* number of 256 byte buffers */ +#define SE_NBUFS_512 32 /* number of 512 byte buffers */ +#define SE_NBUFS_1024 16 /* number of 1k byte buffers */ +#define SE_NBUFS_2048 16 /* number of 2k byte buffers */ +#define SE_NBUFS_4096 8 /* number of 4k byte buffers */ +#define SE_MAX_BUFS 9 /* max number of stream buffer types */ + +#define SE_MAX_MODULES 4 /* max number of streams modules */ +#define SE_SHARE_NI NO /* LAN-NI with streams? */ + +#define SE_DATA_SIZE 0x1000 /* size of pSE data area */ + /* (must be at least 3K) */ +#define SE_TASK_PRIO 250 /* priority for pSE task */ +#define SE_STACK_SIZE 0x2000 /* stack size for pSE task */ +#define SE_DEF_UID 0 /* default user id */ +#define SE_DEF_GID 0 /* default group id */ +#define SE_N_FDS 32 /* max # of system-wide */ + /* stream descriptors */ +#define SE_N_TASKFDS 8 /* max # of per-task stream */ + /* descriptors */ +#define SE_N_LINKS 32 /* max # of multiplexing links */ +#define SE_N_TIMEOUTS 32 /* max # of timeout requests */ +#define SE_N_BUFCALLS 32 /* max # of bufcall requests */ +#define SE_N_QUEUES 256 /* # of queues */ +#define SE_N_QBANDS (SE_N_QUEUES * 2) /* # of qbands */ +#define SE_N_MBLKS 512 /* # of message blocks */ +#define SE_PRI_BANDS NO /* Whether priority bands are desired */ +#define SE_STRLOG YES /* Whether the log facility is cnfgrd */ +#define SE_TMO_RES 2 /* pSE Timer resolution in ticks */ +#define SE_MAX_AUTOPUSH 10 /* Max # of autopush entries */ +#define SE_SIGHANDLER NULL /* pSE global signal handler */ +#define SE_LOG_BUFSIZE 100 /* Maximum size of the log message */ +#define SE_NUM_LOG_BUFFERS 25 /* Number of log buffs to be allocated*/ +#define SE_BUF_BORROW_LEVEL 0 /* The buffer borrowing level desired */ +#define SE_NO_GLOBAL_LOCKING NO /* Whether global locking is desired */ +#define SE_PCRASH_BUF_SIZE 8192 /* default pcrash buffer size */ +#define SE_HI_BUF_RESVN_PERCENT 12 /* Hi buffer reservation % */ +#define SE_MED_BUF_RESVN_PERCENT 13 /* Med buffer reservation % */ +#define SE_USE_MUTEX YES /* Use mutex locks */ +#define SE_GETTICKS_FN tm_getticks /* Use the default tm_getticks*/ + /* function. */ +#define SE_COMPAT_MODE 2 /* Compatibility mode Level. */ + +/*---------------------------------------------------------------------*/ +/* Following macro SE_PRINTF uses printf as the default print function.*/ +/* If User needs to use different function, then change the proto-type.*/ +/*---------------------------------------------------------------------*/ +extern int printf(const char *, ...); +#define SE_PRINTF printf /* pSE printf function */ + +/*---------------------------------------------------------------------*/ +/* Loader configuration parameters */ +/* */ +/* YES indicates for each module to be linked in. NO means do not link */ +/* object module loader into this application. */ +/* */ +/*---------------------------------------------------------------------*/ +#define LD_MAX_LOAD 8 /* Max. # of active loads */ +#define LD_ELF_MODULE NO /* ELF object-load-module */ +#define LD_SREC_MODULE NO /* SREC object-load-module */ +#define LD_COFF_MODULE NO /* COFF object-load-module */ +#define LD_IEEE_MODULE NO /* IEEE object-load-module */ +#define LD_IHEX_MODULE NO /* IHEX object-load-module */ + +/*---------------------------------------------------------------------*/ +/* pMONT+ configuration parameters - note that PM_DEV and PM_BAUD are */ +/* only relevant to serial communication (PM_CMODE = 2) */ +/*---------------------------------------------------------------------*/ +#define PM_CMODE 1 /* 1 = networking, 2 = serial */ + +/*---------------------------------------------------------------------*/ +/* PM_DEV down uses a macro to calculate the channel number, which is */ +/* SERIAL_DRVRNUM(0). This means Low-Level Driver 0 (1) is used for */ +/* default PM_DEV. If you need to change this to another Low-Level */ +/* Serial Driver, change "0" in the macro SERIAL_DRVRNUM(0) to the */ +/* number of the driver you want. */ +/* */ +/* Consult the "README" file in BSP directory for number of different */ +/* drivers supported and for the SERIAL_DRVRNUM mapping for those */ +/* drivers. */ +/*---------------------------------------------------------------------*/ +#define PM_DEV (2 + SERIAL_DRVRNUM(0)) + /* Minor Device number for serial */ + /* channel if used */ + +#define PM_BAUD 9600 /* Baud rate for serial chnl */ +#define PM_TRACE_BUFF 0 /* Address of trace buffer -- */ + /* Allocated by pSOSystem if 0 */ +#define PM_TRACE_SIZE 0x6000 /* Size of trace buffer */ +#define PM_TIMER YES /* 2nd timer for finer time */ + /* within data collection */ + +/*---------------------------------------------------------------------*/ +/* General Serial Block Configuration Parameters */ +/* */ +/* GS_MBLKS defines the number of the message blocks. To allocate a */ +/* data block (GS buffer), a message block is needed. Usually, the */ +/* number of the message blocks will be the same as the total number */ +/* of the data blocks, but it can be differenet. If GS_MBLKS is not */ +/* defined or it is zero, the GSblkSetup() will use the total number */ +/* of the data blocks as the number of the message blocks. */ +/*---------------------------------------------------------------------*/ +#define GS_BUFS_0 64 /* number of 0 length buffers */ +#define GS_BUFS_32 128 /* number of 32 byte buffers */ +#define GS_BUFS_64 128 /* number of 64 byte buffers */ +#define GS_BUFS_128 256 /* number of 128 byte buffers */ +#define GS_BUFS_256 32 /* number of 256 byte buffers */ +#define GS_BUFS_512 32 /* number of 512 byte buffers */ +#define GS_BUFS_1024 16 /* number of 1k byte buffers */ +#define GS_BUFS_2048 16 /* number of 2k byte buffers */ +#define GS_BUFS_4096 8 /* number of 4k byte buffers */ + +#define GS_MBLKS 680 /* number of message blocks */ +#define GS_MAX_BUFS 9 /* max number of serial buffer types */ + +/***********************************************************************/ +/* */ +/* TCP/IP for OpEN configuration parameters */ +/* */ +/***********************************************************************/ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for the Network layer (IP) */ +/*---------------------------------------------------------------------*/ +#define OTCP_IPMAX 8 /* Max # of open IP device */ +#define OTCP_IPNINTERFACES 4 /* Max # of network interfaces */ +#define OTCP_IPNROUTES 64 /* Max #of routing tbl entries */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for ARP */ +/*---------------------------------------------------------------------*/ +#define OTCP_ARPMAX 8 /* Max # of open ARP device */ +#define OTCP_ARPNINTERFACES 4 /* Max # of ARP interfaces */ +#define OTCP_ARPNENTRIES 32 /* Max # of ARP table entries */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for TCP */ +/*---------------------------------------------------------------------*/ +#define OTCP_TCPMAX 64 /* Max # of open TCP device */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for UDP */ +/*---------------------------------------------------------------------*/ +#define OTCP_UDPMAX 32 /* Max # of open UDP device */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for RAW */ +/*---------------------------------------------------------------------*/ +#define OTCP_RAWMAX 32 /* Max # of open RAW device */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for LOOP */ +/*---------------------------------------------------------------------*/ +#define OTCP_LOOPMAX 2 /* Max # of open LOOP device */ + + + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_CONF_H */ + diff --git a/h/wrn/wm/util/port/isisnmp/ppc300/drv_conf.h b/h/wrn/wm/util/port/isisnmp/ppc300/drv_conf.h new file mode 100644 index 0000000..1bf60c3 --- /dev/null +++ b/h/wrn/wm/util/port/isisnmp/ppc300/drv_conf.h @@ -0,0 +1,1239 @@ +/* @(#) pSOSystem :$RCSfile: drv_conf.h,v $ $Revision: 1.1.1.1 $ (&U&) $Date: 2001/11/05 17:47:11 $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/* [clearcase] +modification history +------------------- +*/ + +/***********************************************************************/ +/* */ +/* MODULE: drv_conf.c */ +/* DATE: $Date: 2001/11/05 17:47:11 $ */ +/* PURPOSE: pSOSystem driver configuration and initialization */ +/* */ +/* These are the functions in this file: */ +/* */ +/* SetUpDrivers to setup drivers except for Network drivers*/ +/* DrvSysStartCO to setup Initial Device Name Table */ +/* SetUpNI to setup Network drivers */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* Copyright 1991 - 1999, Integrated Systems, Inc. */ +/* ALL RIGHTS RESERVED */ +/* */ +/* Permission is hereby granted to licensees of Integrated Systems, */ +/* Inc. products to use or abstract this computer program for the */ +/* sole purpose of implementing a product based on Integrated */ +/* Systems, Inc. products. No other rights to reproduce, use, */ +/* or disseminate this computer program, whether in part or in */ +/* whole, are granted. */ +/* */ +/* Integrated Systems, Inc. makes no representation or warranties */ +/* with respect to the performance of this computer program, and */ +/* specifically disclaims any responsibility for any damages, */ +/* special or consequential, connected with the use of this program. */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* */ +/* */ +/***********************************************************************/ +#include "sys_conf.h" +#include "bsp.h" +#include +#include +#include +#include + +#if SC_DEV_SPI + #include "spi.h" +#endif + +#if (SC_PSE) +#include +#include +#endif + +#if (SC_DEV_DLPI) +#include +#endif + +#if (SC_DEV_NULL) +extern void NullDevInit(struct ioparms *); +extern void NullDevRead(struct ioparms *); +extern void NullDevWrite(struct ioparms *); +extern void NullDevCntrl(struct ioparms *); +#endif + +#define NULLF ((void (*)(struct ioparms *)) 0) + +#if (SC_PNA || SC_PNET) +static const char RarpErrTimeout[] = + "RARP request failed: Check for a RARP server"; +static const char RarpErrNet[] = + "RARP request failed: Network Error"; +#endif + +#if (SC_DEV_TFTP || SC_DEV_NTFTP) +ULONG NumTftpChans = SC_MAX_TFTP_CHAN; +#endif + +#if (SC_DEV_HTTP) +ULONG NumHttpChans = SC_MAX_HTTP_CHAN; +#endif + +#if (SC_DEV_PIPE) +unsigned long NumPipeChans = SC_MAX_PIPE_CHAN; +#endif + +#if (SC_DEV_PSCONSOLE) +ULONG NumPsConsoleSharedChan = SC_PSCNSL_SHARED_CHAN; +ULONG NumPsConsolePrivateChan = SC_PSCNSL_PRIVATE_CHAN; +ULONG NumPsConsoleCustomModule = SC_PSCNSL_MAX_CUSTOM; +#endif + +#if (SC_PSOS || SC_PSOSP) +/***********************************************************************/ +/* SetUpDrivers: Installs drivers in PsosIO table via a call to */ +/* InstallDriver and then calls driver setup function if */ +/* needed. NOTE: If the driver is to be part of the */ +/* Network Interface then it should be placed in the */ +/* SetUpNI function. */ +/* */ +/* INPUT: None */ +/* */ +/* RETURNS: None */ +/* */ +/* NOTE: This function does many precompile checks so errors */ +/* can be found during compile-time rather then at run- */ +/* time. */ +/* */ +/* To add a non-Network driver to pSOSystem, call InstallDriver(). */ +/* This adds a device driver to the PsosIO table. InstallDriver() */ +/* takes the following arguments: */ +/* */ +/* unsigned short major_number device major number */ +/* void (*dev_init)() device init procedure */ +/* void (*dev_open)() device open procedure */ +/* void (*dev_close)() device close procedure */ +/* void (*dev_read)() device read procedure */ +/* void (*dev_write)() device write procedure */ +/* void (*dev_ioctl)() device control procedure */ +/* unsigned long dev_param Used for STREAMS modules */ +/* unsigned short rsvd2 reserved */ +/* unsigned short flags If set to IO_AUTOINIT pSOS will */ +/* automatically call the */ +/* drivers initialization */ +/* function. The SC_AUTOINIT */ +/* #define which is set in */ +/* sys_conf.h can be used to set */ +/* this element. */ +/* */ +/* InstallDriver() does not return a value. InstallDriver() assumes */ +/* SC_DEVMAX is defined in sys_conf.h and is useful only before pSOS+ */ +/* has been initialized. */ +/* */ +/* If you are adding a driver that needs to be initialized before */ +/* either pSOS+ is initialized or the driver's init function is */ +/* called, then you can call a setup function (that you create) for */ +/* the driver. */ +/* */ +/* When adding code to install a new driver, it is a good idea to add */ +/* precompile checks so errors can be found during compile-time rather */ +/* then at run-time. Precompile checks are used, for example, in the */ +/* code that installs the pSOSystem serial device driver below. */ +/* */ +/***********************************************************************/ +void SetUpDrivers(void) +{ +extern ULONG PsosNumDntEnts; + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem serial device driver. */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SERIAL && BSP_SERIAL && BSP_NEW_SERIAL) + #if(SC_DEV_SERIAL > SC_DEVMAX) + #error "SC_DEV_SERIAL cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SERIAL, TermInit, TermOpen, TermClose,TermRead, + TermWrite, TermIoctl, 0, 0, IO_CHAR_DEV | SC_AUTOINIT); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSEUDO console driver */ +/*---------------------------------------------------------------------*/ +#if (DEV_PSCONSOLE) + InstallDriver(SC_DEV_PSCONSOLE, NULLF, PsConsoleOpen, + PsConsoleClose, PsConsoleRead, PsConsoleWrite, + PsConsoleCntrl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts +=4; +#endif + +/*--------------------------------------------------------------------*/ +/* Install the Memory Log driver. */ +/*--------------------------------------------------------------------*/ +#if SC_DEV_MEMLOG + InstallDriver(SC_DEV_MEMLOG, MemLogInit, NULLF, + NULLF, MemLogRead, MemLogWrite, + MemLogCntrl, 0, 0, IO_CHAR_DEV|SC_AUTOINIT); + PsosNumDntEnts++; +#endif + +/*--------------------------------------------------------------------*/ +/* Install the Memory pROBE+ Remote debugger driver (RDIO). */ +/*--------------------------------------------------------------------*/ +#if SC_DEV_RDIO + InstallDriver(SC_DEV_RDIO, NULLF, NULLF, + NULLF, RdioRead, RdioWrite, + 0, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*--------------------------------------------------------------------*/ +/* Setup pSOSystem PC console device driver */ +/*--------------------------------------------------------------------*/ +#if (SC_DEV_CONSOLE && BSP_CONSOLE) + #if (SC_DEV_CONSOLE >SC_DEVMAX) + #error "SC_DEV_CONSOLE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_CONSOLE, PcCnslInit, NULLF, NULLF, + PcCnslRead, PcCnslWrite, PcCnslCntrl, 0, 0, + IO_CHAR_DEV | SC_AUTOINIT); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* For pSOSim only - Install the pSOSim Console driver */ +/*---------------------------------------------------------------------*/ +#if (DEV_SIMCONSOLE) + #if(SC_DEV_SIMCONSOLE > SC_DEVMAX) + #error "SC_DEV_SIMCONSOLE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SIMCONSOLE, SimConsoleInit, NULLF, + NULLF, SimConsoleRead, SimConsoleWrite, + 0, 0, 0, IO_CHAR_DEV | SC_AUTOINIT); + PsosNumDntEnts ++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem tick timer. */ +/*---------------------------------------------------------------------*/ +#if SC_DEV_TIMER + #if(SC_DEV_TIMER > SC_DEVMAX) + #error "SC_DEV_TIMER cannot be > SC_DEVMAX" + #endif + #if (!SC_PSOS && !SC_PSOSP) + #error "Must have pSOS+ or pSOS+m in system to use tick timer!" + #endif + InstallDriver(SC_DEV_TIMER, RtcInit, NULLF, NULLF, NULLF, NULLF, + NULLF, 0, 0, IO_CHAR_DEV | SC_AUTOINIT); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install DevNull driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_NULL) + InstallDriver(SC_DEV_NULL, NullDevInit, NULLF, NULLF,NullDevRead, + NullDevWrite, NullDevCntrl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem ramdisk driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if SC_DEV_RAMDISK + #if(SC_DEV_RAMDISK > SC_DEVMAX) + #error "SC_DEV_RAMDISK cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_RAMDISK, RdskInit, RdskOpen, RdskClose, RdskRead, + RdskWrite, RdskCntrl, 0, 0, IO_BLOCK_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem PIPE driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization feature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if SC_DEV_PIPE + #if(SC_DEV_PIPE > SC_DEVMAX) + #error "SC_DEV_PIPE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_PIPE, PipeInit, PipeOpen, PipeClose, PipeRead, + PipeWrite, PipeCntl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem SCSI driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SCSI && BSP_SCSI) + #if(SC_DEV_SCSI > SC_DEVMAX) + #error "SC_DEV_SCSI cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SCSI, SdrvInit, SdskOpen, SdskClose, SdskRead, + SdskWrite, SdrvCntrl, 0, 0, IO_BLOCK_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem SCSI Tape driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SCSI_TAPE && BSP_SCSI_TAPE) + #if(SC_DEV_SCSI_TAPE > SC_DEVMAX) + #error "SC_DEV_SCSI_TAPE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SCSI_TAPE, SdrvInit, StapeOpen, StapeClose, + StapeRead, StapeWrite, SdrvCntrl, 0, 0, IO_BLOCK_DEV); + + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem CMOS clock driver */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_CMOS && BSP_CLOCK) + #if (SC_DEV_CMOS >SC_DEVMAX) + #error "SC_DEV_CMOS cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_CMOS, NULLF, NULLF, NULLF, CmcRead, + CmcWrite, NULLF, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem printer driver */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_PARALLEL && BSP_PARALLEL) + #if (SC_DEV_PARALLEL >SC_DEVMAX) + #error "SC_DEV_PARALLEL cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_PARALLEL, ParInit, ParOpen, ParClose, NULLF, + ParWrite, ParCntrl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem floppy diskette driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_FLOPPY && BSP_FLOPPY) + #if (SC_DEV_FLOPPY >SC_DEVMAX) + #error "SC_DEV_FLOPPY cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_FLOPPY, FlpInit, NULLF, NULLF, FlpRead, + FlpWrite, FlpCntrl, 0, 0, IO_BLOCK_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem IDE disk driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_IDE && BSP_IDE) + #if (SC_DEV_IDE >SC_DEVMAX) + #error "SC_DEV_IDE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_IDE, IDEInit, NULLF, NULLF, IDERead, + IDEWrite, IDECntrl, 0, 0, IO_BLOCK_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem TFTP driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_TFTP) + #if(SC_DEV_TFTP > SC_DEVMAX) + #error "SC_DEV_TFTP cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_TFTP, TftpInit, TftpOpen, TftpClose, TftpRead, + NULLF, TftpCntl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem New TFTP driver that follows the new interface*/ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_NTFTP) + #if(SC_DEV_NTFTP > SC_DEVMAX) + #error "SC_DEV_NTFTP cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_NTFTP, TftpInit, StdTftpOpen, TftpClose, TftpRead, + NULLF, TftpCntl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem HTTP driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_HTTP) + #if(SC_DEV_HTTP > SC_DEVMAX) + #error "SC_DEV_HTTP cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_HTTP, HttpInit, HttpOpen, HttpClose, HttpRead, + NULLF, HttpCntl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the SPI driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SPI) + #if(SC_DEV_SPI > SC_DEVMAX) + #error "SC_DEV_SPI cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SPI, SPI_init, SPI_open, SPI_close, NULLF, + NULLF, SPI_io, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install DLPI drivers */ +/*---------------------------------------------------------------------*/ + +#if (SC_DEV_DLPI || SC_DEV_PPP || SC_DEV_SLIP) + { +#include "enetcfg.h" + +int dlpi_setinitroutine = 0; +int dlpi_nicount = 0; /* number of ni's below this DLPI */ +void (*init_fn)(); /* Ethernet driver initialization routine */ + /* Call this function only once */ +char *DlpiErrMsg = "DlpiAddNI failed: NI Error"; + +#if (SC_DEV_DLPI) + { + #if(SC_DEV_DLPI> SC_DEVMAX) + #error "SC_DEV_DLPI cannot be > SC_DEVMAX" + #endif + static const psedrvparam_t eth0param = {"eth0", DT_CLONE, &enetinfo, 0, 0}; + init_fn = NULLF; + if (!dlpi_setinitroutine) + { + init_fn = (void (*)())enetinit; + dlpi_setinitroutine = 1; + } + InstallDriver(SC_DEV_DLPI, init_fn, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)ð0param, 0, IO_STREAM_DEV); + dlpi_nicount++; + PsosNumDntEnts++; + } +#endif /* SC_DEV_DLPI */ + +#if SC_DEV_DLPI_PPP + { + #if(SC_DEV_DLPI_PPP > SC_DEVMAX) + #error "SC_DEV_DLPI_PPP cannot be > SC_DEVMAX" + #endif + static const psedrvparam_t pppparam = {"ppp", DT_CLONE, &enetinfo, 0, 0}; + init_fn = NULLF; + if (!dlpi_setinitroutine) + { + init_fn = (void (*)())enetinit; + dlpi_setinitroutine = 1; + } + InstallDriver(SC_DEV_DLPI_PPP, init_fn, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&pppparam, 0, IO_STREAM_DEV); + dlpi_nicount++; + PsosNumDntEnts++; + } +#endif /* SC_DEV_DLPI_PPP */ + +#if SC_DEV_DLPI_SLIP + { + #if(SC_DEV_DLPI_SLIP > SC_DEVMAX) + #error "SC_DEV_DLPI_SLIP cannot be > SC_DEVMAX" + #endif + static const psedrvparam_t slipparam = {"slip", DT_CLONE, &enetinfo, 0, 0}; + init_fn = NULLF; + if (!dlpi_setinitroutine) + { + init_fn = (void (*)())enetinit; + dlpi_setinitroutine = 1; + } + InstallDriver(SC_DEV_DLPI_SLIP, init_fn, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&slipparam, 0, IO_STREAM_DEV); + dlpi_nicount++; + PsosNumDntEnts++; + } +#endif /* SC_DEV_DLPI_SLIP */ + +/* + * User has defined other DLPI drivers locally. Include user + * file drv_conf.idl that installs user's own ENETDLPI drivers + */ +#if SC_DEV_DLPI_OTHER +#include "drv_conf.idl" +#endif + + /*-------------------------------------------------------------*/ + /* Call DlpiInit to initialize the Streams DLPI driver */ + /* Arguments passed to DlpiInit are: */ + /* 1. Maximum NI interface number */ + /* 2. Maximum number of streams per interface */ + /*-------------------------------------------------------------*/ + DlpiInit(dlpi_nicount, SE_DLPI_MAXSTR_PERNI); + + /*-------------------------------------------------------------*/ + /* Call DlpiAddNI to add an NI interface to the Streams DLPI */ + /* driver. DlpiAddNI must be called for each NI driver */ + /* interface used with the Streams DLPI driver. */ + /* Arguments passed to DlpiAddNI are: */ + /* 1. NI interface number (should correspond to the pNA+ */ + /* interface number if driver is shared with pNA+) */ + /* 2. NI entry point */ + /* 3. NI flags */ + /* DLPI_IFF_SELFLOOP 0x0001 loopback for selfaddress */ + /* DLPI_IFF_POLL_NI 0x0002 driver must be polled */ + /* DLPI_IFF_RAWMEM 0x2000 driver accepts mblk */ + /* DLPI_IFF_NONIINIT 0x4000 Don't send NI_INIT */ + /* during enetinit() call */ + /* 4. NI major device number */ + /* 5. NI multicast address (NOT SUPPORTED) */ + /* 6. NI poll frequency (every # of elapsed ticks) */ + /*-------------------------------------------------------------*/ + +#if (SC_DEV_DLPI) + /* + * If this lan NI is not shared, use a loopback DLPI with interface + * number 0. NI entry point is set to DlpiNullNI(). + */ +#if (SE_SHARE_NI) + if (DlpiAddNI(SE_DLPI_ETH_IFNO, (long(*)())BSP_LAN1_ENTRY, + SE_DLPI_ETH_IFFLAGS, SC_DEV_DLPI, 0, SE_DLPI_ETH_POLLFREQ)) + SysInitFail(DlpiErrMsg); +#else + if (DlpiAddNI(0, (long(*)())DlpiNullNI, 0, SC_DEV_DLPI, 0, 0)) + SysInitFail(DlpiErrMsg); +#endif /* SE_SHARE_NI */ + +#endif /* SC_DEV_DLPI */ + +#if (SC_DEV_DLPI_PPP) + if (DlpiAddNI(SE_DLPI_PPP_IFNO, SE_DLPI_PPP_ENTRY, SE_DLPI_PPP_IFFLAGS, + SC_DEV_DLPI_PPP, 0, SE_DLPI_PPP_POLLFREQ)) + SysInitFail(DlpiErrMsg); + if (DlpiAddParams(SE_DLPI_PPP_IFNO, SE_DLPI_PPP_ADDRSIZE, + SE_DLPI_PPP_MAXMTU, SE_DLPI_PPP_MINMTU, (char *)NULL)) + SysInitFail(DlpiErrMsg); +#endif /* SC_DEV_DLPI_PPP */ + +#if (SC_DEV_DLPI_SLIP) + if (DlpiAddNI(SE_DLPI_SLIP_IFNO,SE_DLPI_SLIP_ENTRY, SE_DLPI_SLIP_IFFLAGS, + SC_DEV_DLPI_SLIP, 0, SE_DLPI_SLIP_POLLFREQ)) + SysInitFail(DlpiErrMsg); + if (DlpiAddParams(SE_DLPI_SLIP_IFNO, SE_DLPI_SLIP_ADDRSIZE, + SE_DLPI_SLIP_MAXMTU, SE_DLPI_SLIP_MINMTU, (char *)NULL)) + SysInitFail(DlpiErrMsg); +#endif /* SC_DEV_DLPI_SLIP */ + +/* + * User has defined other DLPI drivers locally. Include user + * file drv_conf.adl that adds user Dlpi drivers to the system. + */ +#if SC_DEV_DLPI_OTHER +#include "drv_conf.adl" +#endif + + } +#endif /* (SC_DEV_DLPI || SC_DEV_PPP || SC_DEV_SLIP) */ + +#if (SC_DEV_LOG) + { + extern void loginit(); + extern struct streamtab loginfo; + static const psedrvparam_t log_drv = {"log", DT_DRIVER|DS_SVR4_STYLE, + &loginfo, 0, 0}; + + InstallDriver(SC_DEV_LOG, loginit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&log_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; + } +#endif + +/*-------------------------------------------------------------------*/ +/* Install pSOSystem Watchdog driver */ +/*-------------------------------------------------------------------*/ +#if (SC_DEV_WATCHDOG) + #if(SC_DEV_WATCHDOG > SC_DEVMAX) + #error "SC_DEV_WATCHDOG cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_WATCHDOG, WdtInit, NULLF, NULLF, NULLF, + NULLF, NULLF, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +#if (SC_DEV_OTCP) + { +extern void otcp_ipspace_init(), otcp_arpspace_init(), otcp_rawspace_init(), + otcp_udpspace_init(), otcp_tcpspace_init(), otcp_loopspace_init(); +extern struct streamtab otcp_ipinfo, otcp_arpinfo, otcp_rawinfo, otcp_udpinfo, + otcp_tcpinfo, otcp_loopinfo; + +#if (SC_IP) + static const psedrvparam_t ip_drv = {"ip", DT_CLONE, &otcp_ipinfo, 0, 0}; +#endif +#if (SC_ARP) + static const psedrvparam_t arp_drv = {"arp", DT_CLONE, &otcp_arpinfo, 0, 0}; +#endif +#if (SC_TCP) + static const psedrvparam_t tcp_drv = {"tcp", DT_CLONE, &otcp_tcpinfo, 0, 0}; +#endif +#if (SC_UDP) + static const psedrvparam_t udp_drv = {"udp", DT_CLONE, &otcp_udpinfo, 0, 0}; +#endif +#if (SC_RAW) + static const psedrvparam_t raw_drv = {"raw", DT_CLONE, &otcp_rawinfo, 0, 0}; +#endif +#if (SC_LOOP) + static const psedrvparam_t loop_drv = {"loop", DT_CLONE, &otcp_loopinfo, 0, 0}; +#endif + +#if (SC_IP) + InstallDriver(SC_IP, otcp_ipspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&ip_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_ARP) + InstallDriver(SC_ARP, otcp_arpspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&arp_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_RAW) + InstallDriver(SC_RAW, otcp_rawspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&raw_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_UDP) + InstallDriver(SC_UDP, otcp_udpspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&udp_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_TCP) + InstallDriver(SC_TCP, otcp_tcpspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&tcp_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_LOOP) + InstallDriver(SC_LOOP, otcp_loopspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&loop_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif + + } +#endif /* (SC_DEV_OTCP) */ + +#if (SC_DEV_OLAP) + { + extern struct streamtab phpiinfo, twfrinfo ; + extern void phpiinit(), twfrinit(); +#if (SC_PHPI) + static const psedrvparam_t phpiparam={"phpi",DT_CLONE,&phpiinfo, 0, 0}; +#endif +#if (SC_LAPB) + static const psedrvparam_t lapbparam ={"lapb", DT_REGULAR,&twfrinfo,0, 0}; +#endif + +#if (SC_PHPI) + InstallDriver(SC_PHPI, phpiinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&phpiparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_LAPB) + InstallDriver(SC_LAPB, twfrinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&lapbparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif + } +#endif + +#if (SC_DEV_OX25) + { + extern struct streamtab phpiinfo, twfrinfo, twpkinfo, twsninfo, ipconvinfo; + extern void twpkinit(), twsninit(), tcpsninit(); +#if (SC_X25) + static const psedrvparam_t x25param ={"x25", DT_DRIVER, &twpkinfo, 0, 0}; +#endif +#if (SC_SNDCF) + static const psedrvparam_t sndfparam ={"sndf", DT_REGULAR, &twsninfo, 0, 0}; +#endif +#if (SC_IPCONV) + static const psedrvparam_t ipconvparam={"ipsn",DT_REGULAR, &ipconvinfo, 0, 0}; +#endif + +#if (SC_X25) + InstallDriver(SC_X25, twpkinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&x25param, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_SNDCF) + InstallDriver(SC_SNDCF, twsninit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&sndfparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_IPCONV) + InstallDriver(SC_IPCONV, tcpsninit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&ipconvparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif + } +#endif + +#if (SC_DEV_ISDN) + { + extern struct streamtab phinfo, q921info, ipcdinfo ; + extern void q921init(), phinit(); + +#if (SC_PH) + static const psedrvparam_t phpiparam={"ph",DT_REGULAR,&phinfo, 0, 0}; +#endif +#if (SC_LAPD) + static const psedrvparam_t lapbparam={"q921",DT_REGULAR,&q921info,0,0}; +#endif +#if (SC_IPCD) + static const psedrvparam_t ipcdparam={"ipcd",DT_REGULAR,&ipcdinfo,0,0}; +#endif + +#if (SC_PH) + InstallDriver(SC_PH, phinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&phpiparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_LAPD) + InstallDriver(SC_LAPD, q921init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&lapbparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_IPCD) + InstallDriver(SC_IPCD, NULLF, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&ipcdparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif + } +#endif + +#if (SC_DEV_MLPP) + { + extern struct streamtab frmuxtab, pppstream, Spimtab; + extern void frmuxinit(); + +#if (SC_FRMUX) + static const psedrvparam_t fmuxparam ={"cfmux",DT_REGULAR,&frmuxtab,0,0}; +#endif +#if (SC_PPP) + static const psedrvparam_t pppparam ={"cppp",DT_REGULAR,&pppstream,0,0}; +#endif +#if (SC_PIM) + static const psedrvparam_t pimparam ={"cpim",DT_REGULAR,&Spimtab,0,0}; +#endif + +#if (SC_FRMUX) + InstallDriver(SC_FRMUX, frmuxinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&fmuxparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_PPP) + InstallDriver(SC_PPP, NULLF, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&pppparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_PIM) + InstallDriver(SC_PIM, NULLF, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&pimparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif + } +#endif + +#if defined(SC_DEV_PSMUX) && SC_DEV_PSMUX +#include "drv_conf.app" +#endif + +/*---------------------------------------------------------------------*/ +/* Additional drivers may be installed here. */ +/*---------------------------------------------------------------------*/ + +} + +/***********************************************************************/ +/* DrvSysStartCO : This is called from sysinit.c "SysStartCO". */ +/* */ +/* INPUTS: None */ +/* */ +/* RETURNS: None */ +/* OUTPUTS: None */ +/* NOTE(S): Currently used to set-up the Initial Device Name Table */ +/* Additional code can be added here to clean-up the */ +/* driver specific data area. */ +/* */ +/***********************************************************************/ +void DrvSysStartCO() +{ + +/*---------------------------------------------------------------------*/ +/* Following are the call-outs which will be called. If your driver */ +/* needs pSOS+ "GS" (Warm Startup) notification to clear your driver */ +/* data structures, register here, so that it will be called. */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SERIAL && BSP_SERIAL) + DevSerialCO(); +#endif + +#if (SC_DEV_CONSOLE && BSP_CONSOLE) + DevPCConsoleCO(); +#endif + +/*---------------------------------------------------------------------*/ +/* Default CONSOLE is passed as the DEFAULT CONSOLE for Re-Direction */ +/* CONSOLE can be either DEV_CONSOLE or DEV_SERIAL. */ +/*---------------------------------------------------------------------*/ +#if SC_DEV_PSCONSOLE + PsConsoleSysStartCo(SC_PSCNSL_DEFAULT_DEV, SC_PSCNSL_DEFAULT_DEV); +#endif + +#if SC_DEV_RDIO + RdioSysStartCo(); +#endif + +#if SC_DEV_SCSI && BSP_SCSI + DevScsiCO(); +#endif + +#if SC_DEV_SCSI_TAPE && BSP_SCSI_TAPE + DevScsiCO(); +#endif + +#if SC_DEV_IDE && BSP_IDE + DevIdeCO(); +#endif + +#if SC_DEV_PARALLEL + DevParallelCO(); +#endif + +#if SC_DEV_FLOPPY && BSP_FLOPPY + DevFloppyCO(); +#endif + +#if (SC_DEV_TFTP || SC_DEV_NTFTP) + DevTftpCO(); +#endif + +#if SC_DEV_HTTP + DevHttpCO(); +#endif + +#if SC_DEV_PIPE + DevPipeCO(); +#endif + +/*---------------------------------------------------------------------*/ +/* This code is used to build the initial table of device names used */ +/* in the pSOSystem. */ +/*---------------------------------------------------------------------*/ +/*-----------------------------------------------------------------*/ +/* Make one name for the entrie pSOSystem Serial channels. */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_SERIAL && BSP_SERIAL) + dnt_add("tty", DEV_SERIAL); +#endif /* SC_DEV_SERIAL */ + +/*-----------------------------------------------------------------*/ +/* Make one name for the PC Console Driver. (PC-Monitor). */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_CONSOLE && BSP_CONSOLE) + dnt_add("pcconsole", DEV_CONSOLE); +#endif + +/*-----------------------------------------------------------------*/ +/* pSOSim Console driver */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_SIMCONSOLE + dnt_add("simconsole", DEV_SIMCONSOLE); +#endif + +/*-----------------------------------------------------------------*/ +/* Null Driver. */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_NULL + dnt_add("null", DEV_NULL); +#endif + +/*-----------------------------------------------------------------*/ +/* There is only one timer in the system. Make a name for it. */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_TIMER + dnt_add("timer", DEV_TIMER); +#endif /* SC_DEV_TIMER */ + +/*-----------------------------------------------------------------*/ +/* Add DNT entries for all pSEUDO console minor devices */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_PSCONSOLE + dnt_add("psconsole", DEV_PSCONSOLE + SYSCONSOLE_DEV); + dnt_add("stdin", DEV_PSCONSOLE + STDIN_DEV); + dnt_add("stdout", DEV_PSCONSOLE + STDOUT_DEV); + dnt_add("stderr", DEV_PSCONSOLE + STDERR_DEV); +#endif + +#if SC_DEV_MEMLOG + dnt_add("memlog", DEV_MEMLOG); +#endif + +#if SC_DEV_RDIO + dnt_add("rdio", DEV_RDIO); +#endif + + +/*-----------------------------------------------------------------*/ +/* Add the name for the RAMDISK driver as "ramdisk". */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_RAMDISK + dnt_add("ramdisk", DEV_RAMDISK); +#endif /* SC_DEV_RAMDISK */ + +/*-----------------------------------------------------------------*/ +/* Add the name for the PIPE drivers as "pipe". */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_PIPE + dnt_add("pipe", DEV_PIPE); +#endif /* SC_DEV_PIPE */ + +/*-----------------------------------------------------------------*/ +/* Add the name for the SCSI driver as "scsi". */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_SCSI && BSP_SCSI) + dnt_add("scsi", DEV_SCSI); +#endif /* SC_DEV_SCSI && BSP_SCSI */ + +/*-----------------------------------------------------------------*/ +/* Add the name for the SCSI-TAPE driver as "tape". */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_SCSI_TAPE && BSP_SCSI_TAPE) + dnt_add("tape", DEV_SCSI_TAPE); +#endif /* SC_DEV_SCSI_TAPE && BSP_SCSI_TAPE */ + +/*-----------------------------------------------------------------*/ +/* Add the name for the IDE driver as "ide". */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_IDE && BSP_IDE) + dnt_add("ide", DEV_IDE); +#endif /* SC_DEV_IDE && BSP_IDE */ + +/*-----------------------------------------------------------------*/ +/* There is only one parallel driver in the system. Make a name */ +/* for it. */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_PARALLEL + dnt_add("printer", DEV_PARALLEL); +#endif /* SC_DEV_PARALLEL */ + +/*-----------------------------------------------------------------*/ +/* Add the name for the floppy driver in the system. */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_FLOPPY && BSP_FLOPPY) + dnt_add("floppy", DEV_FLOPPY); +#endif /* SC_DEV_FLOPPY */ + +/*-----------------------------------------------------------------*/ +/* There is only one watchdog driver in the system. Make a name */ +/* for it. */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_WATCHDOG + dnt_add("watchdog", DEV_WATCHDOG); +#endif /* SC_DEV_WATCHDOG */ + +/*-----------------------------------------------------------------*/ +/* There is only one cmos driver in the system. Make a name for it.*/ +/*-----------------------------------------------------------------*/ +#if SC_DEV_CMOS + dnt_add("cmos", DEV_CMOS); +#endif /* SC_DEV_CMOS */ + +/*-----------------------------------------------------------------*/ +/* Make the name for TFTP driver as "tftp". */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_TFTP) + dnt_add("tftp", DEV_TFTP); +#endif /* SC_DEV_TFTP */ + +/*-----------------------------------------------------------------*/ +/* Make the name for NTFTP driver as "ntftp". */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_NTFTP) + dnt_add("ntftp", DEV_NTFTP); +#endif /* SC_DEV_NTFTP */ + +/*-----------------------------------------------------------------*/ +/* Make default name for the HTTP pseudo device. */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_HTTP + dnt_add("http" , DEV_HTTP); +#endif /* SC_DEV_HTTP */ + +#if (SC_DEV_DLPI || SC_DEV_PPP || SC_DEV_SLIP) +/*-----------------------------------------------------------------*/ +/* There is only one enetdlpi driver in the system. */ +/* Make a name for it. */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_DLPI + dnt_add("dlpi", DEV_DLPI); +#endif /* SC_DEV_DLPI */ + +/*-----------------------------------------------------------------*/ +/* There is only one enetslip driver in the system. Make a name for it.*/ +/*-----------------------------------------------------------------*/ +#if SC_DEV_DLPI_SLIP + dnt_add("dlslip", DEV_DLPI_SLIP); +#endif /* SC_DEV_DLPI_SLIP */ + +/*-----------------------------------------------------------------*/ +/* There is only one enetppp driver in the system. Make a name for it.*/ +/*-----------------------------------------------------------------*/ +#if SC_DEV_DLPI_PPP + dnt_add("dlppp", DEV_DLPI_PPP); +#endif /* SC_DEV_DLPI_PPP */ + +#endif + +#if (SC_DEV_LOG) + dnt_add("log", DEV_LOG); +#endif + +#if (SC_DEV_OTCP) + +#if (SC_IP) + dnt_add("ip", DEV_IP); +#endif +#if (SC_ARP) + dnt_add("arp", DEV_ARP); +#endif +#if (SC_TCP) + dnt_add("tcp", DEV_TCP); +#endif +#if (SC_UDP) + dnt_add("udp", DEV_UDP); +#endif +#if (SC_RAW) + dnt_add("raw", DEV_RAW); +#endif +#if (SC_LOOP) + dnt_add("loop", DEV_LOOP); +#endif + +#endif + + +#if (SC_DEV_OLAP) + +#if (SC_PHPI) + dnt_add("phpi", DEV_PHPI); +#endif + +#if (SC_LAPB) + dnt_add("lapb", DEV_LAPB); +#endif + +#endif + +#if (SC_DEV_OX25) + +#if (SC_X25) + dnt_add("x25", DEV_X25); +#endif + +#if (SC_SNDCF) + dnt_add("sndcf", DEV_SNDCF); +#endif + +#if (SC_IPCONV) + dnt_add("ipconv", DEV_IPCONV); +#endif + +#endif + +#if (SC_DEV_ISDN) + +#if (SC_PH) + dnt_add("ph", DEV_PH); +#endif + +#if (SC_LAPD) + dnt_add("q921", DEV_LAPD); +#endif + +#if (SC_IPCD) + dnt_add("ipcd", DEV_IPCD); +#endif + +#endif + +#if (SC_DEV_MLPP) + +#if (SC_FRMUX) + dnt_add("cfmux", DEV_FRMUX); +#endif + +#if (SC_PIM) + dnt_add("cpim", DEV_PIM); +#endif + +#if (SC_PPP) + dnt_add("cppp", DEV_PPP); +#endif + +#endif +/*-----------------------------------------------------------------*/ +/* Names for additional drivers may be added here. */ +/*-----------------------------------------------------------------*/ + +} +#endif /* SC_PSOS || SC_PSOSP*/ + +#if (SC_PNA || SC_PNET) +/***********************************************************************/ +/* SetUpNI: Set up Network Interfaces for pNA+ */ +/* */ +/* INPUT: None */ +/* */ +/* RETURNS: None */ +/* */ +/* NOTES: This function does many precompile checks so errors */ +/* can be found during compile-time rather then at run- */ +/* time. */ +/* */ +/* Also, the Network Interface Table must be allocated */ +/* before this function can be called. There cannot be */ +/* more then NC_NNI entries in this table. NC_NNI is set */ +/* in sys_conf.h. Before adding another interface, be */ +/* sure to check sys_conf.h to see if NC_NNI is set to */ +/* accommodate another one! */ +/* */ +/* See the pSOSystem Programmers Reference Manual */ +/* for more information. */ +/* */ +/* To add a Network driver to pSOSystem, call InstallNi(). This adds */ +/* the Network Interface to the pNA+ Network Interface Table. */ +/* InstallNi() takes the following arguments: */ +/* */ +/* int (*entry)(); address of NI entry point */ +/* int ipadd; IP address */ +/* int mtu; maximum transmission length */ +/* int hwalen; length of hardware address */ +/* int flags; intErface flags */ +/* int subnetaddr; subnet mask */ +/* int dstipaddr; destination ip address */ +/* */ +/* See pSOSystem Programmer`s Reference Manual, Configuration Tables */ +/* Section, for more information about the Network Interface Table. */ +/* InstallNi() does not return a value. */ +/* */ +/* If you are adding a driver that needs to be initialized before */ +/* either pSOS+ is initialized or the driver's init function is */ +/* called, then you can call a setup function (that you create) for */ +/* the driver. */ +/* */ +/* When adding code to install a new driver, it is a good idea to add */ +/* precompile checks so errors can be found during compile-time rather */ +/* then at run-time. Precompile checks are used, for example, in the */ +/* code that installs the pSOSystem serial device driver below. */ +/* */ +/***********************************************************************/ +void SetUpNI(void) +{ +void (*InstallNi_func)( int (*entry)(ULONG, union nientry *), int, int, + int, int, int, int ); + + InstallNi_func = InstallNi; + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem NI. */ +/*---------------------------------------------------------------------*/ +#if BSP_LAN1 + if (SysVars.Lan1) + { + register int IPaddr; + register int (*NiLanPtr)(ULONG, union nientry *); + + #if (SC_DEV_DLPI && SE_SHARE_NI) + NiLanPtr = (int (*)(ULONG, union nientry *))DlpiEnet; + #else + NiLanPtr = (int (*)(ULONG, union nientry *))BSP_LAN1_ENTRY; + #endif + + /*-------------------------------------------------------------*/ + /* If RARP is specified for the IP address, use it now to */ + /* obtain the IP address for this interface. */ + /*-------------------------------------------------------------*/ + if (SysVars.Lan1IP == USE_RARP) + { + IPaddr = RarpEth((long (*)())NiLanPtr); + + if (IPaddr == 0) + SysInitFail(RarpErrTimeout); + if (IPaddr == -1) + SysInitFail(RarpErrNet); + } + else + IPaddr = SysVars.Lan1IP; + + InstallNi_func( + NiLanPtr, IPaddr, BSP_LAN1_MTU, BSP_LAN1_HWALEN, + BSP_LAN1_FLAGS, SysVars.Lan1SubnetMask, 0); + } +#endif + +/*---------------------------------------------------------------------*/ +/* Install the shared memory NI. */ +/*---------------------------------------------------------------------*/ +#if BSP_SMEM + #if ((SC_NISM_LEVEL != 1) && (SC_NISM_LEVEL != 2)) + #error "Illegal value for SC_NISM_LEVEL" + #endif + + if (SysVars.Nism) + { + InstallNi_func((int (*)(unsigned long, union nientry *))NiSmem, + SysVars.NismIP, NISM_MTU, 4, 0x8002, + SysVars.NismSubnetMask, 0); + } +#endif + +/*---------------------------------------------------------------------*/ +/* Additional Network drivers may be installed here. */ +/*---------------------------------------------------------------------*/ + +} + +#endif /* (SC_PNA || SC_PNET) */ diff --git a/h/wrn/wm/util/port/isisnmp/ppc300/sys_conf.h b/h/wrn/wm/util/port/isisnmp/ppc300/sys_conf.h new file mode 100644 index 0000000..e5225b3 --- /dev/null +++ b/h/wrn/wm/util/port/isisnmp/ppc300/sys_conf.h @@ -0,0 +1,1153 @@ +/* @(#) pSOSystem : $RCSfile: sys_conf.h,v $ $Revision: 1.1.1.1 $ $Date: 2001/11/05 17:47:11 $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/* [clearcase] +modification history +------------------- +*/ + +/***********************************************************************/ +/* */ +/* MODULE: sys_conf.h */ +/* $Date: 2001/11/05 17:47:11 $ */ +/* PURPOSE: pSOSystem configuration definitions */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* Copyright 1991 - 2000, Integrated Systems, Inc. */ +/* ALL RIGHTS RESERVED */ +/* */ +/* Permission is hereby granted to licensees of Integrated Systems, */ +/* Inc. products to use or abstract this computer program for the */ +/* sole purpose of implementing a product based on Integrated */ +/* Systems, Inc. products. No other rights to reproduce, use, */ +/* or disseminate this computer program, whether in part or in */ +/* whole, are granted. */ +/* */ +/* Integrated Systems, Inc. makes no representation or warranties */ +/* with respect to the performance of this computer program, and */ +/* specifically disclaims any responsibility for any damages, */ +/* special or consequential, connected with the use of this program. */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* This is a header file which defines all of the system-level */ +/* parameters that are likely to need changing. */ +/* */ +/* It has been set up to be as close as possible to the settings */ +/* which are appropriate for this application. However, you may */ +/* need to make some changes to parameters to reflect your */ +/* environment, such as IP addresses, etc. */ +/* */ +/* The "Configuration and Startup" section of the "Programmer's */ +/* Reference" manual in pSOSystem contains a complete description */ +/* of the symbols that are defined in this file. */ +/* */ +/***********************************************************************/ +#ifndef _SYS_CONF_H +#define _SYS_CONF_H + +#ifdef __cplusplus +extern "C" { +#endif + +/***********************************************************************/ +/* */ +/* SC_APP_PARMS must be defined before you include sysvars.h file. */ +/* Since "sysvars.h" file depends on SC_APP_PARMS and BSP_PARMS */ +/* to define the Storage Parms Structure. */ +/* */ +/* Defining this variable to a Non-Zero Value will create a space in */ +/* the Storage Parms corresponding to the value. The total space */ +/* allocated is the sum of the BSP_PARMS and SC_APP_PARMS. */ +/* */ +/* SC_APP_NAME define controls the application name string that will */ +/* be displayed during the boot dialog. */ +/* */ +/***********************************************************************/ +#define SC_APP_PARMS 0 +#define SC_APP_NAME "SNMP Applications" + +/*---------------------------------------------------------------------*/ +/* sys/types.h contains common definitions, (example YES, NO and more) */ +/*---------------------------------------------------------------------*/ +#include + +/*---------------------------------------------------------------------*/ +/* sysvars.h contains the structures and definitions for the system */ +/* variables that are stored in NVRAM. These structures and */ +/* definitions are also used when creating the boot ROM for the */ +/* target system. By using the same sysvars.h file it will ensure */ +/* consistency of the values stored by the boot ROM and the downloaded */ +/* RAM application. */ +/*---------------------------------------------------------------------*/ +#include + +/*---------------------------------------------------------------------*/ +/* psos.h header file defines IO_AUTOINIT and IO_NOAUTOINIT */ +/*---------------------------------------------------------------------*/ +#include + +/*---------------------------------------------------------------------*/ +/* bsp_conf.h header file for CPU specific defines */ +/*---------------------------------------------------------------------*/ +#include + +/*---------------------------------------------------------------------*/ +/* If USE_RARP is set to YES, then the IP address is obtained from the */ +/* network. */ +/*---------------------------------------------------------------------*/ +#define USE_RARP NO + +/*---------------------------------------------------------------------*/ +/* SC_VERSION specifies the revision level of the application. */ +/*---------------------------------------------------------------------*/ +#define SC_VERSION 300 + +/***********************************************************************/ +/* */ +/* B A S I C P A R A M E T E R S */ +/* */ +/* The parameters in this section determine the fashion in which */ +/* many of the other parameters in this file will be used. */ +/* */ +/* Many of the parameters in this file have names beginning with */ +/* either "SC_" or "SD_". Those beginning with "SC_" are ALWAYS */ +/* controlled by the values you set in this file. The values of */ +/* the "SD_" parameters can be determined either by the definitions */ +/* given in this file, or by the data found in the target board's */ +/* parameter storage area. SC_SD_PARAMETERS determines this. If */ +/* SC_SD_PARAMETERS is "SYS_CONF", then the values given in this */ +/* file will be used for the SD_ parameters. If SC_SD_PARAMETERS */ +/* is "STORAGE", then pSOSystem will attempt to use the values found */ +/* in the board's parameter storage area for the SD_ variables. If */ +/* the parameter storage area has not been initialized or has been */ +/* corrupted, then the values given in this file will be used. They */ +/* will also be written to the storage area. */ +/* */ +/* If SC_SD_PARAMETERS is STORAGE, you may enable a "startup dialog" */ +/* which will allow you to view, and optionally change, the */ +/* parameter values found in the storage area. The dialog is enabled */ +/* by setting SC_STARTUP_DIALOG to YES. In this case, */ +/* SD_STARTUP_DELAY specifies the number of seconds that the dialog */ +/* will wait for input before proceeding to boot the system. */ +/* */ +/* The SC_STARTUP_DIALOG define either enables the boot dialog if set */ +/* to YES, or disables the boot dialog if set to NO. */ +/* */ +/* SC_BOOT_ROM when set to YES, configures the application as a */ +/* ROMable application. If set to NO, treats it as a RAM application. */ +/* */ +/* SC_SD_DEBUG_MODE determines the mode of the system, as follows: */ +/* */ +/* DBG_SA: Boot pROBE+ in standalone mode. */ +/* */ +/* DBG_XS: Boot into pROBE+ and wait for the host debugger */ +/* via a serial connection */ +/* */ +/* DBG_XN: Boot into pROBE+ and wait for the host debugger */ +/* via a network connection */ +/* */ +/* DBG_AP: Same as DBG_SA, but also does a pROBE+ "silent startup",*/ +/* meaning that pROBE+ initializes itself without */ +/* printing a startup banner. pROBE+ then initializes */ +/* pSOS+ and starts the application running. This mode */ +/* was created to simplify implementation of the pSOSystem */ +/* Boot ROMs. Note that when this mode is used, SMODE_MASK */ +/* in TD_FLAGS is always set. (See pROBE+ configuration */ +/* parameters below.) */ +/* */ +/* STORAGE: Use the mode (DBG_SA, DBG_XS, or DBG_XN) found in the */ +/* parameter storage area. If a valid mode is not found, */ +/* then use DBG_SA. */ +/* */ +/* An important consequence of using SC_SD_DEBUG_MODE=STORAGE should */ +/* be noted. If you use the TFTP bootloader in the pSOSystem ROMs */ +/* to download and start your system, you will be setting */ +/* SC_SD_DEBUG_MODE = DBG_AP in your target board's parameter storage */ +/* area. Thus, if you have left SC_SD_DEBUG_MODE set to STORAGE in */ +/* this file, your downloaded system will also use DBG_AP, meaning */ +/* that the application will begin running immediately after the */ +/* TFTP bootloader has loaded and started your system. */ +/* */ +/***********************************************************************/ +#define SC_SD_PARAMETERS STORAGE +#define SC_STARTUP_DIALOG NO +#define SC_BOOT_ROM NO +#define SD_STARTUP_DELAY 60 +#define SC_SD_DEBUG_MODE STORAGE + +/***********************************************************************/ +/* */ +/* O P E R A T I N G S Y S T E M C O M P O N E N T S */ +/* */ +/* Setting the definition line to YES will cause that component to */ +/* be built into the system. NO means the component will NOT be */ +/* put into the system. */ +/*---------------------------------------------------------------------*/ +/* pSOS+: The following set of macros control which type of kernel */ +/* will be added to the system and also controls if we need to use */ +/* the kernel from ROM instead of downloading each time. */ +/* SC_PSOS : For single processor, unprotected kernel */ +/* Valuse can be NO/YES/USEROM */ +/* SC_PSOSP: For single processor, protected kernel */ +/* Valuse can be NO/YES/USEROM */ +/* */ +/*---------------------------------------------------------------------*/ +/* pROBE+: The following set of macros control which features will be */ +/* built in to the pROBE+ Target Agent. pROBE+ can run either in */ +/* console mode (dumb terminal) or as a back-end to a Source Level */ +/* Debugger on the host. Not all modules are needed for all cases.*/ +/* By eliminating modules you can save memory. The definition of */ +/* the modules are as follows: */ +/* */ +/* SC_PROBE - pROBE+ core module. This must always be present if */ +/* any part of pROBE+ is to be used. Setting this to NO will */ +/* force all other pROBE+ modules to NO (even if they say YES */ +/* in this file). */ +/* */ +/* SC_PROBE_CIE - pROBE+ Console Executive. Set this to YES if you */ +/* wish to control pROBE+ from a dumb terminal. If you only */ +/* use a source debugger and/or pRISM+, you can save memory by */ +/* setting it to NO. If it is YES, you also need to sepcify the */ +/* serial port used by the pROBE+ via SC_PROBE_CONSOLE. */ +/* */ +/* SC_PROBE_DISSAM - pROBE+ Console Dissassembler. If you set */ +/* SC_PROBE_CIE to YES and wish to view disassembled memory, set */ +/* this to YES as well. If you are using a host debugger and/or */ +/* pRISM+, you can save memory by setting this to NO. */ +/* */ +/* SC_PROBE_QUERY - pROBE+ Query Services which provides the pSOS+ */ +/* awareness. This module allows you to query the information */ +/* about pSOS+ obejects, issue a console-induced manual break */ +/* or halt-request from the host debugger, set the task-specific */ +/* breakpoints, service call breakpoints and task-dispatch */ +/* breakpoints. Unless you have severe memory restrictions or */ +/* your application does not use pSOS+ kernel, it is suggested */ +/* that you set this to YES. */ +/* */ +/* SC_PROBE_DEBUG - pROBE+ Remote Debug Module. This module is */ +/* used to enable communication between a host based source */ +/* debugger and/or pRISM+ to the pROBE+ target agent using a */ +/* light weight binary protocol. This must be set to YES to */ +/* enable pROBE+ to communicate with a source debugger or the */ +/* pRISM+ host tools. It can be set to NO if you only use the */ +/* pROBE+ console (dumb terminal) mode. If it is YES, the */ +/* Target Agent Manager module SC_TAM must be set to YES. */ +/* */ +/* SC_PROBE_HELP - pROBE+ online help module. Setting this define */ +/* to YES provides the user with pROBE+ commands, when in */ +/* stand-alone mode. */ +/*---------------------------------------------------------------------*/ +/* SC_TAM - Target Agent Manager. This module is used to enable */ +/* communication between a host and the target agents. The */ +/* target agents are SC_PROBE_DEBUG, and TAM_HOSTIO_AGENT. */ +/* SC_TAM must be set to YES to use any of the target agents. */ +/* */ +/* IF SC_TAM is YES and the host is connected to the target */ +/* via network, you must set SC_PNET to YES. If the host is */ +/* connected to the target via a serial connection, must */ +/* select the proper serial port via SC_RBUG_PORT. Note if a */ +/* serial port is used by the TAM for the host connection, */ +/* this port should not be used by the application except for */ +/* SC_PROBE_CONSOLE. For example, you should not set */ +/* SC_RBUG_PORT and SC_APP_CONSOLE to the same serial port */ +/* unless you don't use the host debugger when the */ +/* application is running. */ +/*---------------------------------------------------------------------*/ +/* SC_PHILE through SC_EVLOG - Setting the definition line to */ +/* YES will cause that component to be built into the system. */ +/* Setting it to NO means the component will NOT be put into the */ +/* system. */ +/* */ +/***********************************************************************/ +#define SC_PSOS YES /* pSOS+ real-time kernel */ +#define SC_PSOSP NO /* pSOS+ real-time protected kernel */ +#define SC_PSOS_QUERY NO /* pSOS+ Query Services */ +#define SC_PROBE YES /* pROBE+ (processor svcs) */ +#define SC_PROBE_DISASM YES /* pROBE+ (disassembler) */ +#define SC_PROBE_CIE YES /* pROBE+ (console executive) */ +#define SC_PROBE_QUERY YES /* pROBE+ (query services) */ +#define SC_PROBE_DEBUG YES /* pROBE+ (debug interface agent) */ +#define SC_PROBE_HELP YES /* pROBE+ Help command Handler. */ +#define SC_TAM YES /* Target Agent Manager. */ +#define SC_PHILE NO /* pHILE+ file system manager */ +#define SC_PHILE_PHILE NO /* pHILE+ (pHILE+ real-time file sys) */ +#define SC_PHILE_MSDOS NO /* pHILE+ (MS-DOS FAT file system) */ +#define SC_PHILE_NFS NO /* pHILE+ (NFS client) */ +#define SC_PHILE_CDROM NO /* pHILE+ (ISO 9660 CD-ROM file sys) */ +#define SC_PREPC YES /* pREPC+ C run-time library */ +#define SC_PNA YES /* pNA+ TCP/IP networking manager */ +#define SC_PNET YES /* pNET Library for BOOT ROMS */ +#define SC_PRPC NO /* pRPC+ RPC component */ +#define SC_PSE_PRPC NO /* pRPC+ RPC component Over pSE+ */ +#define SC_PSE NO /* pSE+ streams component */ +#define SC_PSKT NO /* pSKT+ SKT library component */ +#define SC_PTLI NO /* pTLI+ TLI library component */ +#define SC_PMONT YES /* pMONT+ */ +#define SC_PLM NO /* pLM+ Shared library manager */ +#define SC_PROFILER NO /* RTA profiler configuration */ +#define SC_RTEC NO /* RTA run-time error checker library */ +#define SC_CXX_PKG NO /* C++ Support Package. */ +#define SC_IOSTREAM NO /* C++ I/O streams package. */ +#define SC_POSIX NO /* POSIX component (core) */ +#define SC_POSIX_MESSAGE_PASSING NO /* POSIX Named Message Queues */ +#define SC_POSIX_SEMAPHORES NO /* POSIX Named Semaphores */ +#define SC_EXM NO /* Exception Manager */ +#define SC_EVLOG NO /* Event Log Services */ + +/*---------------------------------------------------------------------*/ +/* If SC_QBIND is set to YES then the Quick bindings for pSOS+ System */ +/* calls will be used. If it is set to NO then the normal bindings */ +/* will be used. */ +/* */ +/* Quick bindings will not be supported for the applications with */ +/* USER mode Tasks. So make sure your Application does not have any */ +/* USER mode Tasks. */ +/*---------------------------------------------------------------------*/ +#define SC_QBIND NO /* Quick bindings for pSOSystem calls*/ + +/*---------------------------------------------------------------------*/ +/* If SC_ADDRCHK is set to YES, then address validation takes place */ +/* in the bindings before making system calls. If set to NO, no */ +/* validation takes place. */ +/*---------------------------------------------------------------------*/ +#define SC_ADDRCHK NO /* Address validation for system calls*/ + +/*---------------------------------------------------------------------*/ +/* System wide maximum name length. */ +/*---------------------------------------------------------------------*/ +#define SC_NAMELEN 8 + +/*---------------------------------------------------------------------*/ +/* If set to IO_AUTOINIT device drivers that are installed be the */ +/* InstallDriver function will have their autoinit field set. This */ +/* will cause pSOS+ call the drivers initialization function when */ +/* pSOS+ starts up. The de_init call will not have to be called for */ +/* each driver if this is done. */ +/* */ +/* NOTE: This Auto Initialization will not work on all drivers. */ +/* Setting IO_AUTOINIT only effects drivers that can use the Auto */ +/* Initialization feature. */ +/* */ +/* If set to IO_NOAUTOINIT no automatic driver initialization will */ +/* happen. */ +/* */ +/* If SC_PMONT SC_AUTOINIT will be automatically redefined to 1 because*/ +/* pMONT needs drivers to be automatically initialized. */ +/* */ +/*---------------------------------------------------------------------*/ +#define SC_AUTOINIT IO_AUTOINIT + +/***********************************************************************/ +/* */ +/* S E R I A L C H A N N E L C O N F I G U R A T I O N */ +/* */ +/* * SD_DEF_BAUD specifies the default baud rate to be used for the */ +/* serial channels */ +/* * SC_APP_CONSOLE specifies the serial channel number (starting */ +/* from 1) which should be used for the application's "console". */ +/* * SC_PROBE_CONSOLE specifies the serial channel number (starting */ +/* from 1) which pROBE+ should use to display output and receive */ +/* commands, or to communicate with the host debugger. */ +/* * SC_RBUG_PORT specifies the serial channel number (starting */ +/* from 1) which will be used for the connnect between the host */ +/* debugger and the pROBE+ on the target. This is not needed if */ +/* the host debugger is using the network connection. It can be */ +/* disabled by using a value of 0. Note the port specified by */ +/* SC_RBUG_PORT port should not be used by the application except */ +/* for SC_PROBE_CONSOLE. For example, you should not set */ +/* SC_RBUG_PORT and SC_APP_CONSOLE to the same serial channel */ +/* unless you don't use the host debugger when the application is */ +/* running. */ +/* */ +/* Above three macros SC_PROBE_CONSOLE, SC_APP_CONSOLE and */ +/* SC_RBUG_PORT uses SERIAL_DRVRNUM(0) as default. This means that */ +/* the Low-Level Serial Driver 0 (1) is being used default. */ +/* */ +/* If you need to use another driver for any of the above macros, */ +/* you need to change "0" to the driver number you want. Consult */ +/* the "README" file in BSP directory for number of different */ +/* drivers supported and for the SERIAL_DRVRNUM mapping for those */ +/* drivers. */ +/* */ +/***********************************************************************/ +#define SD_DEF_BAUD 9600 +#define SC_APP_CONSOLE (1 + SERIAL_DRVRNUM(0)) +#define SC_PROBE_CONSOLE (1 + SERIAL_DRVRNUM(0)) +#define SC_RBUG_PORT (0 + SERIAL_DRVRNUM(0)) + +/***********************************************************************/ +/* SC_NumNon_pSOSChan is the number of non-pSOS users of the serial */ +/* channels. These are users that will be initiated before pSOS, */ +/* such as pROBE. */ +/* */ +/* NOTE: These channels will not be closed on a soft reset. */ +/***********************************************************************/ +#if (SC_RBUG_PORT && SC_PROBE_CONSOLE && (SC_PROBE_CONSOLE != PCCON)) +#define SC_NumNon_pSOSChan 2 +#else +#define SC_NumNon_pSOSChan 1 +#endif + +/***********************************************************************/ +/* */ +/* L A N C O N F I G U R A T I O N */ +/* */ +/* */ +/***********************************************************************/ +#define SD_LAN1 NO /* Disable the LAN interface */ +#define SD_LAN1_IP 0x00000000 /* IP address of the node */ +#define SD_LAN1_SUBNET_MASK 0x00000000 /* subnet mask for the node */ + +/***********************************************************************/ +/* */ +/* B U S C O N F I G U R A T I O N */ +/* */ +/* */ +/***********************************************************************/ +#define SD_VME_BASE_ADDR 0x01000000 /* VME bus base address */ + +/***********************************************************************/ +/* */ +/* S H A R E D M E M O R Y C O N F I G U R A T I O N */ +/* */ +/* */ +/***********************************************************************/ + +/*---------------------------------------------------------------------*/ +/* If you want to build a "Shared Memory Interface" for the network */ +/* set SD_SM_NODE to the node number of this node ( a non-zero value). */ +/*---------------------------------------------------------------------*/ +#define SD_SM_NODE 0 /* Node number for this node */ + +/*---------------------------------------------------------------------*/ +/* Shared memory network interface (SMNI) - SC_NISM_LEVEL should be 1 */ +/* if this will be the FIRST system to use the SMNI on this board. It */ +/* should be 2 if this will not be the first system to use SMNI on this*/ +/* board. Usually this means that SC_NISM_LEVEL should be 1 if you */ +/* are building Boot ROMs, and 2 for a system that will be downloaded */ +/* and started using the Boot ROMs. See the comments at the beginning */ +/* of drivers/ni_smem.c for more explanation. */ +/*---------------------------------------------------------------------*/ +#define SD_NISM NO /* Disable/Enable Shared Mem NI */ +#define SD_NISM_IP 0x00000000 /* IP address of this node */ +#define SD_NISM_DIRADDR 0x00000400 /* Bus addr of SMNI directory */ +#define SC_NISM_BUFFS 30 /* Num of buffers for SMNI */ +#define SC_NISM_LEVEL 2 /* SMNI Level, 1 if first node */ +#define SD_NISM_SUBNET_MASK 0x00000000 /* Subnet mask for the SMNI */ + +/***********************************************************************/ +/* */ +/* M I S C E L L A N E O U S N E T W O R K I N G */ +/* P A R A M E T E R S */ +/* */ +/***********************************************************************/ +#define SD_DEF_GTWY_IP 0x00000000 /* Default gateway IP address*/ + +/***********************************************************************/ +/* SC_RAM_SIZE define controls the end of RAM as seen by pSOSystem. */ +/* If it is set to zero, then pSOSystem uses ALL of the memory */ +/* remaining on a board for dynamic allocation ("region 0"). You may */ +/* override this by setting SC_RAM_SIZE to a non-zero value. If you do,*/ +/* pSOSystem will not touch any memory after the specified address. */ +/* */ +/* NOTE: This is useful when making a BOOT ROM and you want to ensure */ +/* that the ROM's RAM area does not overflow the space allocated for it*/ +/***********************************************************************/ +#define SC_RAM_SIZE 0 + +/***********************************************************************/ +/* */ +/* I / O D E V I C E S */ +/* */ +/* Each device may be included in the system by specifying a major */ +/* number for it, which determines its slot in the pSOS+ I/O switch */ +/* table. To leave a device driver out of the system, use NO for */ +/* the major number. */ +/* */ +/* Note the following: */ +/* */ +/* * Major device 0 is reserved and cannot be used for any of these */ +/* devices. Setting a device number to 0 here is the same as NO. */ +/* */ +/* * No device number may be higher than SC_DEVMAX (SC_DEVMAX may */ +/* be increased, if desired) */ +/* */ +/* * The lines defining the symbols DEV_SERIAL, DEV_TIMER, etc, */ +/* should not be changed. These are for use by application */ +/* programs as the "device number" parameter on de_* calls. */ +/* */ +/***********************************************************************/ +#define SC_DEV_SERIAL 1 /* 1 Serial driver */ +#define SC_DEV_TIMER 2 /* 2 Periodic tick timer */ +#define SC_DEV_RAMDISK NO /* 3 RAM disk */ +#define SC_DEV_CONSOLE NO /* 4 PC-Console driver */ +#define SC_DEV_SCSI NO /* 5 SCSI bus */ +#define SC_DEV_SCSI_TAPE NO /* 6 SCSI bus, tape device */ +#define SC_DEV_IDE NO /* 7 IDE Driver */ +#define SC_DEV_FLOPPY NO /* 8 Floppy Driver */ +#define SC_DEV_NTFTP NO /* 9 New TFTP pseudo driver */ +#define SC_DEV_TFTP NO /* 10 TFTP pseudo driver */ +#define SC_DEV_HTTP NO /* 11 HTTP pseudo driver */ +#define SC_DEV_SPI NO /* 12 SPI driver */ +#define SC_DEV_DLPI NO /* 13 DLPI pseudo driver */ +#define SC_DEV_PSCONSOLE NO /* 14 Pseudo Console driver */ +#define SC_DEV_MEMLOG NO /* 15 Memory log driver */ +#define SC_DEV_RDIO NO /* 16 pROBE+ RDIO driver */ +#define SC_DEV_NULL 17 /* 17 Null Device Driver */ +#define SC_DEV_PARALLEL NO /* 18 Parallel Port Driver */ +#define SC_DEV_CMOS NO /* 19 CMOS Driver */ +#define SC_DEV_WATCHDOG NO /* 20 Watchdog Driver */ +#define SC_DEV_LOG NO /* 21 STREAMS log driver */ +#define SC_DEV_PSMUX NO /* 22 Sample Mux driver */ +#define SC_DEV_PSLWR NO /* 23 Sample loopback driver */ +#define SC_DEV_SLLWR NO /* 24 Sample loopback driver */ +#define SC_DEV_PIPE NO /* 25 Pipe Driver */ +#define SC_DEV_SIMCONSOLE NO /* 26 pSOSim Console Driver */ + +#define SC_DEVMAX 26 /* Maximum device number */ + +#define DEV_SERIAL (SC_DEV_SERIAL << 16) +#define DEV_PARALLEL (SC_DEV_PARALLEL << 16) +#define DEV_TIMER (SC_DEV_TIMER << 16) +#define DEV_RAMDISK (SC_DEV_RAMDISK << 16) +#define DEV_SCSI (SC_DEV_SCSI << 16) +#define DEV_SCSI_TAPE (SC_DEV_SCSI_TAPE << 16) +#define DEV_PSCONSOLE (SC_DEV_PSCONSOLE << 16) +#define DEV_SYSCONSOLE ((SC_DEV_PSCONSOLE << 16) + SYSCONSOLE_DEV) +#define DEV_PSEUDO ((SC_DEV_PSCONSOLE << 16) + PSEUDO_DEV) +#define DEV_STDIN ((SC_DEV_PSCONSOLE << 16) + STDIN_DEV) +#define DEV_STDOUT ((SC_DEV_PSCONSOLE << 16) + STDOUT_DEV) +#define DEV_STDERR ((SC_DEV_PSCONSOLE << 16) + STDERR_DEV) +#define DEV_NULL (SC_DEV_NULL << 16) +#define DEV_MEMLOG (SC_DEV_MEMLOG << 16) +#define DEV_RDIO (SC_DEV_RDIO << 16) +#define DEV_DLPI (SC_DEV_DLPI << 16) +#define DEV_TFTP (SC_DEV_TFTP << 16) +#define DEV_NTFTP (SC_DEV_NTFTP << 16) +#define DEV_HTTP (SC_DEV_HTTP << 16) +#define DEV_SPI (SC_DEV_SPI << 16) +#define DEV_WATCHDOG (SC_DEV_WATCHDOG << 16) +#define DEV_FLOPPY (SC_DEV_FLOPPY << 16) +#define DEV_IDE (SC_DEV_IDE << 16) +#define DEV_CMOS (SC_DEV_CMOS << 16) +#define DEV_CONSOLE (SC_DEV_CONSOLE << 16) +#define DEV_LOG (SC_DEV_LOG << 16) +#define DEV_PSMUX (SC_DEV_PSMUX << 16) +#define DEV_PSLWR (SC_DEV_PSLWR << 16) +#define DEV_SLLWR (SC_DEV_SLLWR << 16) +#define DEV_PIPE (SC_DEV_PIPE << 16) +#define DEV_SIMCONSOLE (SC_DEV_SIMCONSOLE << 16) + +/***********************************************************************/ +/* p S E U D O D R I V E R D E F I N E S */ +/* */ +/* The defines below control the behavour of the pSEUDO driver if the */ +/* SC_DEV_PSCONSOLE is enabled. */ +/* */ +/***********************************************************************/ +#define SC_PSCNSL_SHARED_CHAN 2 /* Num of shared channels */ +#define SC_PSCNSL_PRIVATE_CHAN 4 /* Number of private channels */ +#define SC_PSCNSL_MAX_CUSTOM 1 /* NUmber of custome device */ +#define SC_PSCNSL_DEFAULT_DEV CONSOLE /* Default console device */ + +/***********************************************************************/ +/* T F T P D R I V E R C O N F I G U R A T I O N */ +/* */ +/* The defines below define the Configuration Parameters needed by the */ +/* TFTP driver. */ +/* */ +/***********************************************************************/ +#define SC_MAX_TFTP_CHAN 1 /* Maximum number of TFTP channels */ + +/***********************************************************************/ +/* H T T P S E R V E R C O N F I G U R A T I O N */ +/* */ +/* The SC_MAX_HTTP_CHAN define controls the maximum number of HTTP */ +/* channels in the system. */ +/* */ +/***********************************************************************/ +#define SC_MAX_HTTP_CHAN 1 + +/***********************************************************************/ +/* P I P E D R I V E R C O N F I G U R A T I O N */ +/* */ +/* The SC_MAX_PIPE_CHAN define controls the maximum number of PIPE */ +/* channels that will be configured in the system. */ +/* */ +/***********************************************************************/ +#define SC_MAX_PIPE_CHAN 1 + +/***********************************************************************/ +/* */ +/* M M U L I B R A R Y P A R A M S */ +/* */ +/* The SC_MMULIB define controls the MMU library call-outs when pROBE+ */ +/* is entered. Setting this to YES enables the callouts, while setting */ +/* this to NO disables the callouts when pROBE+ is entered and BSP_MMU */ +/* is enabled. */ +/* */ +/***********************************************************************/ +#define SC_MMULIB NO + +/***********************************************************************/ +/* */ +/* C O M P O N E N T C O N F I G U R A T I O N P A R A M E T E R S */ +/* */ +/* These parameters should work as is for this application. You */ +/* may want to change some of them if you start customizing this */ +/* application. */ +/* */ +/***********************************************************************/ + +/*---------------------------------------------------------------------*/ +/* pSOS+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define KC_RN0USIZE 0x100 /* region 0 unit size */ +#define KC_NTASK 12 /* max number of tasks */ +#define KC_NQUEUE 10 /* max number of message queues */ +#define KC_NSEMA4 30 /* max number of semaphores */ +#define KC_NTIMER 10 /* max number of timers */ +#define KC_NMUTEX 10 /* Max number of mutexes */ +#define KC_NCVAR 5 /* Max number of condition variables */ +#define KC_NTVAR 5 /* Max number of task variables */ +#define KC_NCOCB 5 /* Max number of callouts */ +#define KC_NTSD 5 /* Max # of Task Specific Data entries */ +#define KC_NLOCOBJ 50 /* max number of local objects */ +#define KC_NMSGBUF 256 /* max number of message buffers */ +#define KC_NSIGACT 5 /* max number of SIGACT structures */ +#define KC_TICKS2SEC 100 /* clock tick interrupt frequency */ +#define KC_TICKS2SLICE 10 /* time slice quantum, in ticks */ +#define KC_MAXDNTENT 10 /* max number of device names in DNT */ +#define KC_DNLEN 10 /* max length of a device name in DNT */ +#define KC_SYSSTK 0x0C00 /* pSOS+ system stack size (bytes) */ +#define KC_ROOTSSTK 0x0800 /* ROOT supervisor stack size */ +#define KC_IDLESTK 0x0400 /* IDLE stack size */ +#define KC_ROOTUSTK 0 /* ROOT user stack size */ +#define KC_ROOTMODE (T_SUPV | T_ISR) /* ROOT initial mode */ +#define KC_ROOTPRI 230 /* ROOT task priority */ +#define KC_NIO (SC_DEVMAX+1) /* # of devices in initial iojtab */ +#define KC_MAXIO (SC_DEVMAX+1) /* Max # of devices in the system */ + +#define KC_STK_UNDERFLOW NO /* Stack underflow detection be enabled*/ +#define KC_STK_OVERFLOW YES /* Stack overflow detection be enabled */ +#define KC_GUARD_PAGES 1 /* Guard size (in pagesize) for stack */ + /* underflow and overflow detection */ +#define KC_NDYNOBJ 0 /* Number of dynamic objects */ + +/*---------------------------------------------------------------------*/ +/* User and Supervisor stack lengths that are used by the MMU library */ +/* to create page table entries for the stack region in the virtual */ +/* space. */ +/*---------------------------------------------------------------------*/ +#define KC_USTKMAPLEN 0x100000 +#define KC_SSTKMAPLEN 0x100000 + +/*---------------------------------------------------------------------*/ +/* Default stack sizes to use if t_create values are 0. */ +/*---------------------------------------------------------------------*/ +#define KC_DFTSSTK 8096 /* Default supervisor-mode stack size */ +#define KC_DFTUSTK 8096 /* Default user-mode stack size */ + +/*---------------------------------------------------------------------*/ +/* The following are examples for modifying the following defines */ +/* */ +/* To configure a user written routine as a fatal error handler, you */ +/* need to do the following: */ +/* */ +/* extern void MyHandler (void); */ +/* #define KC_FATAL ((void (*)()) MyHandler) */ +/* */ +/* except KC_RMONCO which should be of type: */ +/* ULONG (*)(ULONG, ULONG, ULONG, void *, ULONG, struct hrt_count *) */ +/* */ +/* You should add the partial structure definition: */ +/* struct hrt_count; */ +/* to prevent compiler warnings, unless you include hrtimer.h. */ +/*---------------------------------------------------------------------*/ +#define KC_STARTCO 0 /* callout at task activation */ +#define KC_DELETECO 0 /* callout at task deletion */ +#define KC_SWITCHCO 0 /* callout at task switch */ +#define KC_FATAL 0 /* fatal error handler address */ +#define KC_IDLECO 0 /* Idle Task Callout */ + +#define KC_RMONCO 0 /* Resource Monitoring Callout */ + +/*---------------------------------------------------------------------*/ +/* Example KC_SYSERRCO definition: */ +/* extern void MyCallout(void *TCB, ULONG Tid, ULONG Error, */ +/* ULONG ErrorAddr) */ +/* #define KC_SYSERRCO (MyCallout) */ +/*---------------------------------------------------------------------*/ +#define KC_SYSERRCO 0 /* System call error callout address */ + +/*---------------------------------------------------------------------*/ +/* Example KC_SIGDFTACO definition: */ +/* extern void MyCallout(ULONG sig) */ +/* #define KC_SIGDFTACO (MyCallout) */ +/*---------------------------------------------------------------------*/ +#define KC_SIGDFTACO 0 /* POSIX signal default action callout */ + +/*---------------------------------------------------------------------*/ +/* pROBE+ configuration parameters */ +/* */ +/* NOTE: The SMODE_MASK bit in TD_FLAGS is set as */ +/* SC_SD_DEBUG_MODE = DBG_AP. */ +/*---------------------------------------------------------------------*/ +#define TD_ILEV (MAX_ILEV << 12) /* pROBE+ interrupt mask */ +#define TD_FLAGS (STK_USAGE_MASK | STK_CHECK_MASK | NODOTS_MASK | TD_ILEV | NOTUPD_MASK) /* flags */ + +/*---------------------------------------------------------------------*/ +/* The variable defined below should be set to the Starting address */ +/* for pROBE+ DATA AREA. This is required by all the smaller boards. */ +/* NOTE: */ +/* Setting of this value should be a variable which is a array */ +/* of characters with atleast 0x4400 bytes free space. */ +/*---------------------------------------------------------------------*/ +#define TD_DATASTART 0x0 + +/*---------------------------------------------------------------------*/ +/* Example for how to modify TD_URCOM_HANDLER to add user-written */ +/* handler to handle the user-defined commands from pROBE+ console: */ +/* */ +/* extern long probe_user_cmd_handler(UCHAR *); */ +/* #define TD_URCOM_HANDLER probe_user_cmd_handler */ +/*---------------------------------------------------------------------*/ +#define TD_URCOM_HANDLER 0 /* user-defined cammand handler. */ + +/*---------------------------------------------------------------------*/ +/* pHILE+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define FC_LOGBSIZE 9 /* Block size (base-2 exponent) */ +#define FC_NBUF 6 /* Number of cache buffers */ +#define FC_NMOUNT 3 /* Max # of mounted volumes */ +#define FC_NFCB 10 /* Max # of opened files per system */ +#define FC_NCFILE 2 /* Max # of opened files per task */ +#define FC_NDNLC 0 /* Max # of cached directory entries */ + +/*---------------------------------------------------------------------*/ +/* pHILE+ DATA AREA definitions. */ +/*---------------------------------------------------------------------*/ +#define FC_DATA 0 /* pHILE+ Data Area Starting Address */ +#define FC_DATASIZE 0 /* pHILE+ Data Area Size */ + +/*---------------------------------------------------------------------*/ +/* Set the FC_ERRCO define to install the callout handler for I/O */ +/* errors. The callout handler provided in FC_ERRCO will be called if */ +/* there is an error during an I/O operation on the Volume. */ +/* */ +/* To install the error callout handler: Follow the syntax below */ +/* */ +/* #include */ +/* extern user_fcerrco(int, ULONG, const struct buffer_header *) */ +/* #define FC_ERRCO user_fcerrco */ +/* */ +/*---------------------------------------------------------------------*/ +#define FC_ERRCO 0 /* I/O error call-out */ + +/*---------------------------------------------------------------------*/ +/* pLM+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define LM_MAXREG 8 /* Max # of registered libraries */ +#define LM_DATA 0 /* pLM+ data area */ +#define LM_DATASIZE 0 /* pLM+ data area size */ + +/*---------------------------------------------------------------------*/ +/* Set LM_DEFAULT_COUTS to YES if you need to use the pSOSystem Default*/ +/* pLM Callouts. Set it to NO if you are providing the callouts. */ +/* */ +/* Setting LM_DEFAULT_COUTS to NO needs "LM_LOADCO" and "LM_UNLOADCO" */ +/* definitions to be valid address (Function address). */ +/*---------------------------------------------------------------------*/ +#define LM_DEFAULT_COUTS YES + +/*---------------------------------------------------------------------*/ +/* */ +/* The following callouts needs to be defined by user, If users wants */ +/* their callouts to be used instead of pSOSystem default Callouts. */ +/* */ +/* If we are using pSOSystem default callouts, Users needs to add their*/ +/* callouts to the pSOSystem callouts table using PssRegister_pLM_couts*/ +/* and remove using PssDeregister_pLM_couts. */ +/* */ +/* To have user callouts follow the syntax below: */ +/* */ +/* #include */ +/* extern ULONG user_load_co(const char *libname, ULONG scope, */ +/* ULONG version, const void *libinfo, */ +/* sl_attrib *attr); */ +/* extern ULONG user_unload_co(const sl_attrib *attr); */ +/* */ +/* #define LM_LOADCO user_load_co */ +/* #define LM_UNLOADCO user_unload_co */ +/* */ +/*---------------------------------------------------------------------*/ +#define LM_LOADCO 0 +#define LM_UNLOADCO 0 + +/*---------------------------------------------------------------------*/ +/* Target Agent Manager (TAM) configuration parameters */ +/*---------------------------------------------------------------------*/ +#define TAM_MAX_AGENTS 6 /* Specify number of target agents */ +#define TAM_MAX_BUFFS 10 /* Specify number of buffers. */ +#define TAM_MAX_HDRS 50 /* Specify number of Tx. Headers. */ +#define TAM_NON_OS NO /* Is TAM running for Non-OS platform */ +#define TAM_MIN_TIMEOUT 0 /* Minimum timeout used in TAM before */ + /* Re-trying the packet in System mode*/ +#define TAM_IN_TASK_PRI 255 /* TAM Input Task priority. */ +#define TAM_OUT_TASK_PRI 255 /* TAM Output Task priority. */ + +/*---------------------------------------------------------------------*/ +/* Is there a User Configurable Escape Sequence Characters */ +/* This value should be multiple of 2. */ +/*---------------------------------------------------------------------*/ +#define TAM_NESC_CHARS 0 /* Number of escape Chars. */ + +/*---------------------------------------------------------------------*/ +/* If TAM_NESC_CHARS is non-zero, the following variable needs to */ +/* set to point to a "unsigned char *". */ +/* */ +/* The character array should contain values in the format given below */ +/* */ +/* CHAR1, ESC_CHAR1, CHAR2, ESC_CHAR2, .... */ +/* */ +/* Where CHAR1 is the character that needs to be converted when sent */ +/* on wire, with ESC and ESC_CHAR1. */ +/* */ +/* The syantax to set will be: */ +/* */ +/* extern UCHAR escseq[]; */ +/* #define TAM_ESCSEQ escseq */ +/* */ +/*---------------------------------------------------------------------*/ +#define TAM_ESCSEQ 0 + +/*---------------------------------------------------------------------*/ +/* Target Agents */ +/*---------------------------------------------------------------------*/ +#define TAM_HOSTIO_AGENT YES /* Host I/O via db_input/db_output */ + +/*---------------------------------------------------------------------*/ +/* Exception Manager configuration parameters */ +/*---------------------------------------------------------------------*/ +/* Examples for how to modify EXM_SYSHNDL/EXM_TASKHNDL/EXM_SIGMAP */ +/* */ +/* To configure a user written routine as a system or default task */ +/* exception handler, you need, for example, to modify and add the */ +/* following lines: */ +/* */ +/* extern long my_system_excp_handler(); */ +/* #define EXM_SYSHNDL my_system_excp_handler */ +/* */ +/* extern long my_default_task_excp_handler(); */ +/* #define EXM_SYSHNDL my_default_task_excp_handler */ +/* */ +/* To assign a mapping table to map exception to signal, you need, for */ +/* example, modify and add the following lines: */ +/* */ +/* extern ULONG my_exmSignalMapping[]; */ +/* #define EXM_SIGMAP my_exmSignalMapping */ +/* */ +/* Here my_exmSignalMapping must be an array of */ +/* ULONG[EXM_MAX_GROUPS+1]. */ +/*---------------------------------------------------------------------*/ +#define EXM_SYSHNDL 0 /* system exception handler */ +#define EXM_TASKHNDL 0 /* default task exception handler */ +#define EXM_SIGMAP 0 /* signal to exception mapping table */ +#define EXM_SVCERR_MASK 0 /* syscall error exception mask */ + + +/*---------------------------------------------------------------------*/ +/* Event Log Services Configuration Parameters */ +/*---------------------------------------------------------------------*/ +#define EVLC_RECSZ 48 /* System wide max event log record size */ +#define EVLC_STDBUFSZ 256 /* Standard event log buffer size */ +#define EVLC_STDSVRTY 2 /* Standard event log severity level */ + +/*---------------------------------------------------------------------*/ +/* pREPC+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define LC_BUFSIZ (1 << FC_LOGBSIZE) /* I/O buffer size */ +#define LC_NUMFILES 5 /* Max number of open files per task */ +#define LC_WAITOPT 0 /* Wait option for memory allocation */ +#define LC_TIMEOPT 0 /* Timeout option for mem allocation */ + +/*---------------------------------------------------------------------*/ +/* pREPC+ stdin, stdout and stderr device mapping. */ +/*---------------------------------------------------------------------*/ +#ifndef LC_STDIN /* If stdin, stdout and stderr not defined in CPU + specific header file */ +#if (SC_DEV_PSCONSOLE) +#define LC_STDIN "///dev/stdin" /* The default STDIN device */ +#define LC_STDOUT "///dev/stdout" /* The default STDOUT device */ +#define LC_STDERR "///dev/stderr" /* The default STDERR device */ + +#elif (SC_DEV_SERIAL) +#define LC_STDIN "///dev/tty" /* Make TTY the STDIN device */ +#define LC_STDOUT "///dev/tty" /* Make TTY the STDOUT device */ +#define LC_STDERR "///dev/tty" /* Make TTY the STDERR device */ + +#elif (SC_DEV_SIMCONSOLE) +#define LC_STDIN "///dev/simconsole" /* Make simconsole STDIN */ +#define LC_STDOUT "///dev/simconsole" /* Make simconsole STDOUT */ +#define LC_STDERR "///dev/simconsole" /* Make simconsole STDERR */ + +#else +#define LC_STDIN "///dev/null" /* Make NULL the STDIN device */ +#define LC_STDOUT "///dev/null" /* Make NULL the STDOUT device */ +#define LC_STDERR "///dev/null" /* Make NULL the STDERR device */ +#endif +#endif /* #ifndef LC_STDIN */ + +#if (SC_DEV_RAMDISK) +#define LC_TEMPDIR DEV_RAMDISK /* The default TEMPDIR device */ + +#elif (SC_DEV_SCSI) +#define LC_TEMPDIR DEV_SCSI /* The default TEMPDIR device */ + +#elif (SC_DEV_IDE) +#define LC_TEMPDIR DEV_IDE /* The default TEMPDIR device */ + +#elif (SC_DEV_FLOPPY) +#define LC_TEMPDIR DEV_FLOPPY /* The default TEMPDIR device */ + +#else +#define LC_TEMPDIR 0 /* The default TEMPDIR device */ +#endif + +/*---------------------------------------------------------------------*/ +/* pNET configuration parameters */ +/*---------------------------------------------------------------------*/ +#define PNET_PORT 2 + +/*---------------------------------------------------------------------*/ +/* pNA+ configuration parameters */ +/* */ +/* NOTE: If you get pNA+ errno 5F01 FAT_INSUFFMEM you may need to */ +/* decrease the number of buffers allocated here for pNA+. */ +/* In general this error means pNA+ could not allocate enough */ +/* memory from Region 0 for the number of buffers requested. */ +/*---------------------------------------------------------------------*/ +#define NC_NNI 5 /* size of pNA NI Table */ +#define NC_NROUTE 10 /* size of pNA Routing Table */ +#define NC_NARP 20 /* size of pNA ARP table */ +#define NC_DEFUID 0 /* Default User ID of a task */ +#define NC_DEFGID 0 /* Default Group ID of a task */ +#define NC_HOSTNAME "scg" /* Hostname of the node */ +#define NC_NHENTRY 8 /* Number of Host table entries */ + +#define NC_NMCSOCS 0 /* Number of IP multicast sockets */ +#define NC_NMCMEMB 0 /* Number of distict IP multicast */ + /* group memberships per interface */ +#define NC_NNODEID 0 /* Network NODE ID for unnumbered link */ +#define NC_NSOCKETS 4 /* Number of sockets in the system */ +#define NC_NDESCS 4 /* # of socket descriptors/task */ +#define NC_MBLKS 300 /* # of message blocks in the system */ +#define NC_BUFS_0 64 /* number of 0 length buffers */ +#define NC_BUFS_32 0 /* number of 32 length buffers */ +#define NC_BUFS_64 0 /* number of 64 length buffers */ +#define NC_BUFS_128 256 /* number of 128 byte buffers */ +#define NC_BUFS_256 0 /* number of 256 byte buffers */ +#define NC_BUFS_512 0 /* number of 512 byte buffers */ +#define NC_BUFS_1024 16 /* number of 1k byte buffers */ +#define NC_BUFS_2048 48 /* number of 2k byte buffers */ +#define NC_BUFS_4096 0 /* number of 4k byte buffers */ +#define NC_BUFS_8500 2 /* number of 8500 byte buffers. These */ + /* buffers are used for reassembling */ + /* fragmented packets */ + +#define NC_MAX_BUFS 9 /* max number of NC_BUFS types */ + +#define NC_PNAMEM_NEWSCHEME YES /* apply new pNA MEM management scheme*/ + +#define NC_BUFS_XX_INTERNAL 20 /* # of buffers for internal pNA usage */ +#define NC_MBLKS_INT_PERCENT 15 /* % of mblks reserved for pNA internal */ +#define NC_MBLKS_TX_PERCENT 40 /* % of mblks reserved for Tx Mem Pool */ + +#define NC_BUFS_0_TX_PERCENT 50 /* % of 0 length buffers used for Tx */ +#define NC_BUFS_32_TX_PERCENT 50 /* % of 32 length buffers used for Tx */ +#define NC_BUFS_64_TX_PERCENT 50 /* % of 64 length buffers used for Tx */ +#define NC_BUFS_128_TX_PERCENT 50 /* % of 128 byte buffers used for Tx */ +#define NC_BUFS_256_TX_PERCENT 50 /* % of 256 byte buffers used for Tx */ +#define NC_BUFS_512_TX_PERCENT 50 /* % of 512 byte buffers used for Tx */ +#define NC_BUFS_1024_TX_PERCENT 50 /* % of 1k byte buffers used for Tx */ +#define NC_BUFS_2048_TX_PERCENT 50 /* % of 2k byte buffers used for Tx */ +#define NC_BUFS_4096_TX_PERCENT 50 /* % of 4k byte buffers used for Tx */ + +/*---------------------------------------------------------------------*/ +/* pNA+ daemon task configuration parameters */ +/*---------------------------------------------------------------------*/ +#define NC_DTASK_SSTKSZ 0x800 /* pNAD daemon task sstack size*/ +#define NC_DTASK_USTKSZ 0x400 /* pNAD daemon task ustack size*/ +#define NC_DTASK_PRIO 255 /* pNAD daemon task priority */ +#define NC_NEW_MULTITASK_SYNC YES /* deploy new pNA+ sync scheme */ +#define NC_USE_MUTEX YES /* use pSOS MUTEX primitive */ +#define NC_NO_ZCOPY_USERMODE YES /* disable zero-copy from user-mode */ + +/*---------------------------------------------------------------------*/ +/* pNA+ DATA AREA definitions. */ +/*---------------------------------------------------------------------*/ +#define NC_DATA 0 /* pNA+ Data Area Starting Addr*/ +#define NC_DATASIZE 0 /* pNA+ Data Area Size */ + +/*---------------------------------------------------------------------*/ +/* The following are examples for modifying the following defines */ +/* */ +/* Using a user written routine as a pNA+ Signal Handler */ +/* extern void MySigHandler (void); */ +/* #define NC_SIGNAL ((void (*)()) MySigHandler) */ +/* */ +/*---------------------------------------------------------------------*/ +#define NC_SIGNAL NULL /* pNA+ Signal Hdlr */ + +/*---------------------------------------------------------------------*/ +/* pRPC+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define NR_PMAP_PRIO 254 /* task priority */ +#define NR_PMAP_SSTACK 0x2000 /* supervisor stack size */ +#define NR_PMAP_USTACK 0x100 /* user stack size */ +#define NR_PMAP_FLAGS T_LOCAL /* t_create flags */ +#define NR_PMAP_MODE T_SUPV /* t_start mode */ +#define NR_DEBUG_FLAG NO /* Turns on debug msgs from PMAP task */ + +/*---------------------------------------------------------------------*/ +/* pRPC+ DATA AREA definitions. */ +/*---------------------------------------------------------------------*/ +#define NR_DATA 0 /* pRPC+ Data Area Starting Address */ +#define NR_DATASIZE 0 /* pRPC+ Data Area Size */ + +/*---------------------------------------------------------------------*/ +/* User can change these TWO defines to have their own handlers. */ +/*---------------------------------------------------------------------*/ +#define NR_GETHOSTNAME nr_gethostname /* Function to get local */ + /* host name */ +#define NR_GET_HENTBYNAME nr_get_hentbyname /* Function to map host */ + /* name to it's IP Addr */ + +/*---------------------------------------------------------------------*/ +/* pSE+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define SE_NBUFS_0 64 /* number of 0 length buffers */ +#define SE_NBUFS_32 128 /* number of 32 byte buffers */ +#define SE_NBUFS_64 128 /* number of 64 byte buffers */ +#define SE_NBUFS_128 256 /* number of 128 byte buffers */ +#define SE_NBUFS_256 32 /* number of 256 byte buffers */ +#define SE_NBUFS_512 32 /* number of 512 byte buffers */ +#define SE_NBUFS_1024 16 /* number of 1k byte buffers */ +#define SE_NBUFS_2048 16 /* number of 2k byte buffers */ +#define SE_NBUFS_4096 8 /* number of 4k byte buffers */ +#define SE_MAX_BUFS 9 /* max number of stream buffer types */ +#define SE_MAX_MODULES 4 /* max number of streams modules */ +#define SE_SHARE_NI NO /* LAN-NI with streams? */ +#define SE_DATA_SIZE 0x1000 /* size of pSE data area */ + /* (must be at least 3K) */ +#define SE_TASK_PRIO 250 /* priority for pSE task */ +#define SE_STACK_SIZE 0x2000 /* stack size for pSE task */ +#define SE_DEF_UID 0 /* default user id */ +#define SE_DEF_GID 0 /* default group id */ +#define SE_N_FDS 32 /* max # of system-wide */ + /* stream descriptors */ +#define SE_N_TASKFDS 8 /* max # of per-task stream */ + /* descriptors */ +#define SE_N_LINKS 32 /* max # of multiplexing links */ +#define SE_N_TIMEOUTS 32 /* max # of timeout requests */ +#define SE_N_BUFCALLS 32 /* max # of bufcall requests */ +#define SE_N_QUEUES 256 /* # of queues */ +#define SE_N_QBANDS (SE_N_QUEUES * 2) /* # of qbands */ +#define SE_N_MBLKS 512 /* # of message blocks */ +#define SE_PRI_BANDS NO /* Whether priority bands are desired */ +#define SE_STRLOG YES /* Whether the log facility is cnfgrd */ +#define SE_TMO_RES 2 /* pSE Timer resolution in ticks */ +#define SE_MAX_AUTOPUSH 10 /* Max # of autopush entries */ +#define SE_SIGHANDLER NULL /* pSE global signal handler */ +#define SE_LOG_BUFSIZE 100 /* Maximum size of the log message */ +#define SE_NUM_LOG_BUFFERS 25 /* Number of log buffs to be allocated*/ +#define SE_BUF_BORROW_LEVEL 0 /* The buffer borrowing level desired */ +#define SE_NO_GLOBAL_LOCKING NO /* Whether global locking is desired */ +#define SE_PCRASH_BUF_SIZE 8192 /* default pcrash buffer size */ +#define SE_HI_BUF_RESVN_PERCENT 12 /* Hi buffer reservation % */ +#define SE_MED_BUF_RESVN_PERCENT 13 /* Med buffer reservation % */ +#define SE_USE_MUTEX YES /* Use mutex locks */ +#define SE_GETTICKS_FN tm_getticks /* Use the default tm_getticks*/ + /* function. */ +#define SE_COMPAT_MODE 2 /* Compatibility mode Level. */ +#define SE_NO_ZCOPY_USERMODE NO /* disable zero-copy from user-mode */ + +/*---------------------------------------------------------------------*/ +/* Following macro SE_PRINTF uses printf as the default print function.*/ +/* If User needs to use different function, then change the proto-type.*/ +/*---------------------------------------------------------------------*/ +extern int printf(const char *, ...); +#define SE_PRINTF printf /* pSE printf function */ + +/*---------------------------------------------------------------------*/ +/* Loader configuration parameters */ +/* */ +/* YES indicates for each module to be linked in. NO means do not link */ +/* object module loader into this application. */ +/* */ +/*---------------------------------------------------------------------*/ +#define LD_MAX_LOAD 8 /* Max. # of active loads */ +#define LD_ELF_MODULE NO /* ELF object-load-module */ +#define LD_SREC_MODULE NO /* SREC object-load-module */ +#define LD_COFF_MODULE NO /* COFF object-load-module */ +#define LD_IEEE_MODULE NO /* IEEE object-load-module */ +#define LD_IHEX_MODULE NO /* IHEX object-load-module */ + +/*---------------------------------------------------------------------*/ +/* pMONT+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define PM_TRACE_BUFF 0 /* Address of trace buffer -- */ + /* Allocated by pSOSystem if 0 */ +#define PM_TRACE_SIZE 0x6000 /* Size of trace buffer */ +#define PM_TIMER YES /* 2nd timer for finer time */ + /* within data collection */ + +/*---------------------------------------------------------------------*/ +/* General Serial Block Configuration Parameters */ +/* */ +/* GS_MBLKS defines the number of the message blocks. To allocate a */ +/* data block (GS buffer), a message block is needed. Usually, the */ +/* number of the message blocks will be the same as the total number */ +/* of the data blocks, but it can be differenet. If GS_MBLKS is not */ +/* defined or it is zero, the GSblkSetup() will use the total number */ +/* of the data blocks as the number of the message blocks. */ +/*---------------------------------------------------------------------*/ +#define GS_BUFS_0 16 /* number of 0 byte buffers */ +#define GS_BUFS_32 16 /* number of 32 byte buffers */ +#define GS_BUFS_64 0 /* number of 64 byte buffers */ +#define GS_BUFS_128 16 /* number of 128 byte buffers */ +#define GS_BUFS_256 0 /* number of 256 byte buffers */ +#define GS_BUFS_512 0 /* number of 512 byte buffers */ +#define GS_BUFS_1024 0 /* number of 1k byte buffers */ +#define GS_BUFS_2048 0 /* number of 2k byte buffers */ +#define GS_BUFS_4096 1 /* number of 4k byte buffers */ + +#define GS_MBLKS 48 /* number of message blocks */ +#define GS_MAX_BUFS 9 /* max number of serial buffer types */ + +#ifdef __cplusplus +} +#endif + +/*---------------------------------------------------------------------*/ +/* components.h will perform a check of the available components for */ +/* pSOSystem and automatically disable the components which are not */ +/* available. This allows an application to be common to all pSOSystem */ +/* targets. Applications that rely on the presence of a given */ +/* component will obviously not function on a target without that */ +/* component. */ +/*---------------------------------------------------------------------*/ +#include + +#endif /* _SYS_CONF_H */ diff --git a/h/wrn/wm/util/port/isisnmp/snmptalk.h b/h/wrn/wm/util/port/isisnmp/snmptalk.h new file mode 100644 index 0000000..14d3ae0 --- /dev/null +++ b/h/wrn/wm/util/port/isisnmp/snmptalk.h @@ -0,0 +1,51 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/isisnmp/snmptalk.h,v 1.1.1.1 2001/11/05 17:47:09 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: snmptalk.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:09 tneale + * Tornado shuffle + * + * Revision 1.3 2001/01/19 22:22:58 paul + * Update copyright. + * + * Revision 1.2 2000/03/17 00:10:01 meister + * Update copyright message + * + * Revision 1.1 1998/08/17 21:47:13 josh + * adding a new file to the port directory + * + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* defines for nvutils for file manipulation */ +#define SNMP_READONLY "r" +#define SNMP_READPLUS "r+" +#define SNMP_WRITEPLUS "w+" +#define SNMP_REMOVE_FILE(fname) remove_f(fname) + +#define NEEDS_STRDUP +#define NEEDS_STRICMP + diff --git a/h/wrn/wm/util/port/isisnmp/spl250/config.mk b/h/wrn/wm/util/port/isisnmp/spl250/config.mk new file mode 100644 index 0000000..f3a41fa --- /dev/null +++ b/h/wrn/wm/util/port/isisnmp/spl250/config.mk @@ -0,0 +1,611 @@ +#* @(#) pSOSystem SPL/V2.5.0-F8: configs/spl/config.mk 4.7 00/02/03 14:36:27 * +#*********************************************************************** +#* * +#* MODULE: configs/std/config.mk * +#* DATE: 00/02/03 * +#* PURPOSE: Macro definitions, linker commands, etc, for "make" * +#* * +#*---------------------------------------------------------------------* +#* * +#* Copyright 1991 - 2000, Integrated Systems, Inc. * +#* ALL RIGHTS RESERVED * +#* * +#* Permission is hereby granted to licensees of Integrated Systems, * +#* Inc. products to use or abstract this computer program for the * +#* sole purpose of implementing a product based on Integrated * +#* Systems, Inc. products. No other rights to reproduce, use, * +#* or disseminate this computer program, whether in part or in * +#* whole, are granted. * +#* * +#* Integrated Systems, Inc. makes no representation or warranties * +#* with respect to the performance of this computer program, and * +#* specifically disclaims any responsibility for any damages, * +#* special or consequential, connected with the use of this program. * +#* * +#*---------------------------------------------------------------------* +#*********************************************************************** +# +#------------------------------------------------------------------------ +# Compiler commands and command-line options +#------------------------------------------------------------------------ + +#------------------------------------------------------------------------ +# Note the CC and CXX commands are continued on several lines. +# +# Only echo the "Making..." string if the silent flags was not given. +# +# The command `echo ${MAKEFLAGS} | sed 's/[^s]//g'` echoes the make flags +# to the standard input of the sed command. The sed command replaces +# every character that is not an s with nothing. So if the silent flag +# was given the left side of the equals results in "Xs". If the silent +# flag was not given it would result in "X". +#------------------------------------------------------------------------ +CC = @if [ "X`echo ${MAKEFLAGS} | sed 's/[^s]//g'`" = "X" ]; \ + then \ + echo "Making $@ \tfrom $<"; \ + fi; \ + dcc + +CXX = @if [ "X`echo ${MAKEFLAGS} | sed 's/[^s]//g'`" = "X" ]; \ + then \ + echo "Making $@ \tfrom $<"; \ + fi; \ + dplus + +#------------------------------------------------------------------------ +# Add following option to COPTS_FILE2 to generate listing files +# -W:as:,-l -Xpass-source +#------------------------------------------------------------------------ +COMP_OPTS1 = -O -g -t$(DTARGET)E$(DFP):psos -Xstruct-best-align=0 +COMP_OPTS2 = -Xforce-prototypes -Xstrict-ansi $(PSS_APPCOPTS) -D__DIAB -DSPL +COPTS_FILE1 = -I. -I$(PSS_ROOT)/include -I$(PSS_BSP) $(PSS_APPINCS) +COPTS_FILE2 = -I$(PSS_ROOT)/bsps/devices $(PSS_VINCLUDE) -I@ -c +CXX_OPTS = -Xexception + +#------------------------------------------------------------------------ +# COPT_PER_FILE is used to provide a convenient way to add per +# file compile options. If a .cop file for a source file exist then +# content of this file is passed as the compile options. +#------------------------------------------------------------------------ +COPT_PER_FILE=`if [ -f ./$(*F).cop ]; then cat ./$(*F).cop; fi` + +COPTS = -@c.opt $(COPT_PER_FILE) +CXXOPTS = -@cxx.opt $(COPT_PER_FILE) + +#------------------------------------------------------------------------ +# TARGET_CPU is used in application makefiles to pass on to incremental +# linking and other tools. +#------------------------------------------------------------------------ +TARGET_CPU = -t$(DTARGET)E$(DFP):psos + +#------------------------------------------------------------------------ +# DEVICES_CPU_DIR is used by application makefiles to make them generic +# across platforms. +#------------------------------------------------------------------------ +DEVICES_CPU_DIR = $(PSS_ROOT)/bsps/devices/powerpc + +#------------------------------------------------------------------------ +# Assembler command-line options +# +# Note the AS command is continued on several lines. +# +# Only echo the "Making..." string if the silent flags was not given. +# +# The command `echo ${MAKEFLAGS} | sed 's/[^s]//g'` echoes the make flags +# to the standard input of the sed command. The sed command replaces +# every character that is not an s with nothing. So if the silent flag +# was given the left side of the equals results in "Xs". If the silent +# flag was not given it would result in "X". +#------------------------------------------------------------------------ +AS = @if [ "X`echo ${MAKEFLAGS} | sed 's/[^s]//g'`" = "X" ]; \ + then \ + echo "Making $@ \tfrom $<"; \ + fi; \ + das + +#------------------------------------------------------------------------ +# Added target switch for the assembler +# The target definition is located in bsp.mk of the bsp you are using +#------------------------------------------------------------------------ +# Add following option to AOPTS_FILE1 to generate listing files -l +#------------------------------------------------------------------------ +AOPTS_FILE1 = -I. $(PSS_APPINCS) -I$(PSS_ROOT)/include -I$(PSS_BSP) +AOPTS_FILE2 = -I$(PSS_ROOT)/bsps/devices $(PSS_VINCLUDE) -I@ +AOPTS_FILE3 = -t$(DTARGET)E$(DFP):psos +AOPTS = -@a.opt $(COPT_PER_FILE) + +#------------------------------------------------------------------------ +# Linker command name +#------------------------------------------------------------------------ +LD = dld +LOPTS = -t$(DTARGET)E$(DFP):psos -Xsuppress-dot -Xreloc-bug -m2 $(PSS_APPLOPTS) + +#------------------------------------------------------------------------ +# Librarian command name and options +#------------------------------------------------------------------------ +LIB = dar +LIBOPTS = -qf +LIBOPTS_SORT = -sR + +#======================================================================== +# Link everything together +#======================================================================== +CFG1_OBJS= sysinit.o bspcfg.o pnacfg.o prepccfg.o dialog.o +CFG2_OBJS= probecfg.o prpccfg.o psecfg.o psoscfg.o pmontcfg.o +CFG3_OBJS= pollio.o philecfg.o gsblkcfg.o plmcfg.o pnetcfg.o +CFG4_OBJS= ldcfg.o posixcfg.o rtacfg.o + +ram.elf: cxx.opt c.opt a.opt ill.opt begin.o compiler.o \ + makefile \ + ram.dld \ + $(CFG1_OBJS) \ + $(CFG2_OBJS) \ + $(CFG3_OBJS) \ + $(CFG4_OBJS) \ + $(PSS_DRVOBJS) \ + $(PSS_APPOBJS) \ + $(PSS_BSP)/libbsp.a \ + $(PSS_ROOT)/sys/os/libsys.a \ + $(PSS_ROOT)/sys/libc/libprepc$(DFP).a \ + $(PSS_ROOT)/sys/libc/libpnet.a + @echo $(LOPTS) -o ram.elf -Wm ram.dld begin.o > l.opt + @echo -L $(PSS_BSP) -L $(PSS_ROOT)/sys/os >> l.opt + @echo -L $(PSS_ROOT)/sys/libc $(PSS_APPLINKS) >> l.opt + @echo $(PSS_VLINK) >> l.opt + @echo compiler.o >> l.opt + @echo $(CFG1_OBJS) >> l.opt + @echo $(CFG2_OBJS) >> l.opt + @echo $(CFG3_OBJS) >> l.opt + @echo $(CFG4_OBJS) >> l.opt + @echo $(PSS_APPOBJS) >> l.opt + @echo $(APP_LIB1) >> l.opt + @echo $(APP_LIB2) >> l.opt + @echo $(APP_LIB3) >> l.opt + @echo $(APP_LIB4) >> l.opt + @echo $(APP_LIB5) >> l.opt + @echo $(PSS_DRVOBJS) >> l.opt + @echo $(DRV_LIB1) >> l.opt + @echo $(DRV_LIB2) >> l.opt + @echo $(DRV_LIB3) >> l.opt + @echo $(DRV_LIB4) >> l.opt + @echo $(DRV_LIB5) >> l.opt + @echo -lbsp -ldrv >> l.opt + @echo -lsys >> l.opt + @echo -lprepc$(DFP) -lpnet -lquery >> l.opt + @echo $(FIX_LIB) >> l.opt + @echo $(PSS_COMPLIB) >> l.opt + $(LD) -@l.opt > ram.map + ddump -tv ram.elf >> ram.map + +ram.dld: $(PSS_BSP)/anchor.dld \ + $(PSS_BSP)/ram.dld + @cat $(PSS_BSP)/ram.dld > ram.dld + @cat $(PSS_BSP)/anchor.dld >> ram.dld + +ram.hex: ram.elf + ddump -Rv ram.elf -o ram.hex + +rom.elf: cxx.opt c.opt a.opt ill.opt rombegin.o compiler.o \ + makefile \ + rom.dld \ + $(CFG1_OBJS) \ + $(CFG2_OBJS) \ + $(CFG3_OBJS) \ + $(CFG4_OBJS) \ + $(PSS_DRVOBJS) \ + $(PSS_BSP)/libbsp.a \ + $(PSS_APPOBJS) \ + $(PSS_ROOT)/sys/os/libsys.a \ + $(PSS_ROOT)/sys/libc/libprepc$(DFP).a \ + $(PSS_ROOT)/sys/libc/libpnet.a + @echo $(LOPTS) -o rom.elf -Wm rom.dld rombegin.o > l.opt + @echo -L $(PSS_BSP) -L $(PSS_ROOT)/sys/os >> l.opt + @echo -L $(PSS_ROOT)/sys/libc $(PSS_APPLINKS) >> l.opt + @echo $(PSS_VLINK) >> l.opt + @echo compiler.o >> l.opt + @echo $(CFG1_OBJS) >> l.opt + @echo $(CFG2_OBJS) >> l.opt + @echo $(CFG3_OBJS) >> l.opt + @echo $(CFG4_OBJS) >> l.opt + @echo $(PSS_APPOBJS) >> l.opt + @echo $(APP_LIB1) >> l.opt + @echo $(APP_LIB2) >> l.opt + @echo $(APP_LIB3) >> l.opt + @echo $(APP_LIB4) >> l.opt + @echo $(APP_LIB5) >> l.opt + @echo $(PSS_DRVOBJS) >> l.opt + @echo $(DRV_LIB1) >> l.opt + @echo $(DRV_LIB2) >> l.opt + @echo $(DRV_LIB3) >> l.opt + @echo $(DRV_LIB4) >> l.opt + @echo $(DRV_LIB5) >> l.opt + @echo -lbsp -ldrv >> l.opt + @echo -lsys >> l.opt + @echo -lprepc$(DFP) -lpnet -lquery >> l.opt + @echo $(FIX_LIB) >> l.opt + @echo $(PSS_COMPLIB) >> l.opt + $(LD) -@l.opt > rom.map + ddump -tv rom.elf >> rom.map + +rom.dld: $(PSS_BSP)/anchor.dld \ + $(PSS_BSP)/rom.dld + @cat $(PSS_BSP)/rom.dld > rom.dld + @cat $(PSS_BSP)/anchor.dld >> rom.dld + +rom.hex: rom.elf + ddump -Rv rom.elf -o rom.hex + +os.elf: cxx.opt c.opt a.opt ill.opt begin.o \ + makefile \ + os.dld \ + $(CFG1_OBJS) \ + $(CFG2_OBJS) \ + $(CFG3_OBJS) \ + $(CFG4_OBJS) \ + $(PSS_DRVOBJS) \ + $(PSS_BSP)/libbsp.a \ + $(PSS_ROOT)/sys/os/libsys.a \ + $(PSS_ROOT)/sys/libc/libprepc$(DFP).a \ + $(PSS_ROOT)/sys/libc/libpnet.a + @echo $(LOPTS) -o os.elf -Wm os.dld begin.o > l.opt + @echo -L $(PSS_BSP) -L $(PSS_ROOT)/sys/os >> l.opt + @echo -L $(PSS_ROOT)/sys/libc $(PSS_APPLINKS) >> l.opt + @echo $(PSS_VLINK) >> l.opt + @echo $(CFG1_OBJS) >> l.opt + @echo $(CFG2_OBJS) >> l.opt + @echo $(CFG3_OBJS) >> l.opt + @echo $(CFG4_OBJS) >> l.opt + @echo $(PSS_DRVOBJS) >> l.opt + @echo $(DRV_LIB1) >> l.opt + @echo $(DRV_LIB2) >> l.opt + @echo $(DRV_LIB3) >> l.opt + @echo $(DRV_LIB4) >> l.opt + @echo $(DRV_LIB5) >> l.opt + @echo -lbsp -ldrv >> l.opt + @echo -lsys >> l.opt + @echo -lprepc$(DFP) -lpnet -lquery >> l.opt + @echo $(FIX_LIB) >> l.opt + @echo $(PSS_COMPLIB) >> l.opt + $(LD) -@l.opt > os.map + ddump -tv os.elf >> os.map + +os.dld: $(PSS_BSP)/anchor.dld \ + $(PSS_BSP)/os.dld + @cat $(PSS_BSP)/os.dld > os.dld + @cat $(PSS_BSP)/anchor.dld >> os.dld + +os.hex: os.elf + ddump -Rv os.elf -o os.hex + +app.elf: cxx.opt c.opt a.opt ill.opt beginapp.o bspcalls.o compiler.o \ + makefile \ + app.dld \ + $(PSS_APPOBJS) \ + $(PSS_ROOT)/sys/os/libsys.a \ + $(PSS_ROOT)/sys/libc/libprepc$(DFP).a + @echo $(LOPTS) -o app.elf -Wm app.dld beginapp.o > l.opt + @echo bspcalls.o >> l.opt + @echo -L $(PSS_BSP) -L $(PSS_ROOT)/sys/os >> l.opt + @echo -L $(PSS_ROOT)/sys/libc $(PSS_APPLINKS) >> l.opt + @echo $(PSS_VLINK) >> l.opt + @echo compiler.o >> l.opt + @echo $(PSS_APPOBJS) >> l.opt + @echo $(APP_LIB1) >> l.opt + @echo $(APP_LIB2) >> l.opt + @echo $(APP_LIB3) >> l.opt + @echo $(APP_LIB4) >> l.opt + @echo $(APP_LIB5) >> l.opt + @echo -lsys >> l.opt + @echo -lprepc$(DFP) -lquery >> l.opt + @echo $(FIX_LIB) >> l.opt + @echo $(PSS_COMPLIB) >> l.opt + $(LD) -@l.opt > app.map + ddump -tv app.elf >> app.map + +app.dld: $(PSS_BSP)/anchor.dld \ + $(PSS_BSP)/app.dld + @cat $(PSS_BSP)/app.dld > app.dld + @cat $(PSS_BSP)/anchor.dld >> app.dld + +app.hex: app.elf + ddump -R app.elf -o app.hex + +app_ld.elf: cxx.opt c.opt a.opt ill.opt ldbegin.o bspcalls.o compiler.o \ + ldblcfg.o makefile \ + app_ld.dld \ + $(PSS_APPOBJS) \ + $(PSS_ROOT)/sys/os/libsys.a \ + $(PSS_ROOT)/sys/libc/libprepc$(DFP).a + @echo $(LOPTS) -o app_tmp.elf -Wm app_ld.dld > l.opt + @echo ldbegin.o bspcalls.o >> l.opt + @echo -L $(PSS_BSP) -L $(PSS_ROOT)/sys/os >> l.opt + @echo -L $(PSS_ROOT)/sys/libc $(PSS_APPLINKS) >> l.opt + @echo $(PSS_VLINK) >> l.opt + @echo compiler.o >> l.opt + @echo $(PSS_APPOBJS) >> l.opt + @echo $(APP_LIB1) >> l.opt + @echo $(APP_LIB2) >> l.opt + @echo $(APP_LIB3) >> l.opt + @echo $(APP_LIB4) >> l.opt + @echo $(APP_LIB5) >> l.opt + @echo -lsys >> l.opt + @echo -lprepc$(DFP) -lquery >> l.opt + @echo $(FIX_LIB) >> l.opt + @echo $(PSS_COMPLIB) >> l.opt + $(LD) -@l.opt > app_ld.map + ddump -tv app_tmp.elf >> app_ld.map + @echo $(PSS_LDBOPTS) -p 180 -n LDBL -mAT -u 1024 -s 8192 > ld_prep.def + @ld_prep -v -d ld_prep.def -o app_ld.elf app_tmp.elf + @rm -f ld_prep.def + +app_ld.hex: cxx.opt c.opt a.opt ill.opt ldbegin.o bspcalls.o compiler.o \ + ldblcfg.o makefile \ + app_ld.dld \ + $(PSS_APPOBJS) \ + $(PSS_ROOT)/sys/os/libsys.a \ + $(PSS_ROOT)/sys/libc/libprepc$(DFP).a + @echo $(LOPTS) -o app_tmp.elf -Wm app_ld.dld > l.opt + @echo ldbegin.o bspcalls.o >> l.opt + @echo -L $(PSS_BSP) -L $(PSS_ROOT)/sys/os >> l.opt + @echo -L $(PSS_ROOT)/sys/libc $(PSS_APPLINKS) >> l.opt + @echo $(PSS_VLINK) >> l.opt + @echo compiler.o >> l.opt + @echo $(PSS_APPOBJS) >> l.opt + @echo $(APP_LIB1) >> l.opt + @echo $(APP_LIB2) >> l.opt + @echo $(APP_LIB3) >> l.opt + @echo $(APP_LIB4) >> l.opt + @echo $(APP_LIB5) >> l.opt + @echo -lsys >> l.opt + @echo -lprepc$(DFP) -lquery >> l.opt + @echo $(FIX_LIB) >> l.opt + @echo $(PSS_COMPLIB) >> l.opt + $(LD) -@l.opt > app_ld.map + ddump -tv app_tmp.elf >> app_ld.map + ddump -R app_tmp.elf -o app_tmp.hex + @echo $(PSS_LDBOPTS) -p 180 -n LDBL -mAT -u 1024 -s 8192 > ld_prep.def + @ld_prep -v -d ld_prep.def -o app_ld.hex app_tmp.hex + @rm -f ld_prep.def + +app_ld.dld: $(PSS_BSP)/anchor.dld \ + $(PSS_BSP)/app.dld + @cat $(PSS_BSP)/app.dld > app_ld.dld + @cat $(PSS_BSP)/anchor.dld >> app_ld.dld + +driver.elf: cxx.opt c.opt a.opt ill.opt lddriver.o bspcalls.o compiler.o \ + ldblcfg.o \ + makefile \ + driver.dld \ + $(PSS_APPOBJS) \ + $(PSS_ROOT)/sys/os/libsys.a \ + $(PSS_ROOT)/sys/libc/libprepc$(DFP).a + @echo $(LOPTS) -o driver.elf driver.dld lddriver.o > l.opt + @echo bspcalls.o >> l.opt + @echo -L $(PSS_BSP) -L $(PSS_ROOT)/sys/os >> l.opt + @echo -L $(PSS_ROOT)/sys/libc $(PSS_APPLINKS) >> l.opt + @echo $(PSS_VLINK) >> l.opt + @echo compiler.o >> l.opt + @echo $(PSS_APPOBJS) >> l.opt + @echo $(APP_LIB1) >> l.opt + @echo $(APP_LIB2) >> l.opt + @echo $(APP_LIB3) >> l.opt + @echo $(APP_LIB4) >> l.opt + @echo $(APP_LIB5) >> l.opt + @echo -lsys >> l.opt + @echo -lprepc$(DFP) >> l.opt + @echo $(FIX_LIB) >> l.opt + @echo $(PSS_COMPLIB) >> l.opt + $(LD) -@l.opt > driver.map + @ddump -tv driver.elf >> driver.map + +driver.dld: $(PSS_BSP)/anchor.dld \ + $(PSS_BSP)/app.dld + @cat $(PSS_BSP)/app.dld > driver.dld + @cat $(PSS_BSP)/anchor.dld >> driver.dld + +lddriver.elf: driver.elf + @echo $(PSS_LDBOPTS) -p 180 -n LDBL -mAT -u 1024 -s 4096 > ld_prep.def + @ld_prep -v -d ld_prep.def -o lddriver.elf driver.elf + @rm -f ld_prep.def + +lib.elf: cxx.opt c.opt a.opt ill.opt bspcalls.o compiler.o \ + makefile \ + lib.dld \ + $(PSS_APPOBJS) \ + $(PSS_ROOT)/sys/os/libsys.a \ + $(PSS_ROOT)/sys/libc/libprepc$(DFP).a + @echo $(LOPTS) -o lib.elf lib.dld > l.opt + @echo bspcalls.o >> l.opt + @echo -L $(PSS_BSP) -L $(PSS_ROOT)/sys/os >> l.opt + @echo -L $(PSS_ROOT)/sys/libc $(PSS_APPLINKS) >> l.opt + @echo $(PSS_VLINK) >> l.opt + @echo compiler.o >> l.opt + @echo $(PSS_APPOBJS) >> l.opt + @echo $(APP_LIB1) >> l.opt + @echo $(APP_LIB2) >> l.opt + @echo $(APP_LIB3) >> l.opt + @echo $(APP_LIB4) >> l.opt + @echo $(APP_LIB5) >> l.opt + @echo -lsys >> l.opt + @echo -lprepc$(DFP) -lquery >> l.opt + @echo $(FIX_LIB) >> l.opt + @echo $(PSS_COMPLIB) >> l.opt + $(LD) -@l.opt > lib.map + @ddump -tv lib.elf >> lib.map + +lib.dld: $(PSS_BSP)/anchor.dld \ + $(PSS_BSP)/app.dld + @cat $(PSS_BSP)/app.dld > lib.dld + @cat $(PSS_BSP)/anchor.dld >> lib.dld + +lib_ld.elf: lib.elf + @echo $(PSS_LDBOPTS) > ld_prep.def + @ld_prep -v -d ld_prep.def -o lib_ld.elf lib.elf + @rm -f ld_prep.def + +lib.hex: lib.elf + ddump -R lib.elf -o lib.hex + +lib_ld.hex: lib.hex + @echo $(PSS_LDBOPTS) > ld_prep.def + @ld_prep -v -d ld_prep.def -o lib_ld.hex lib.hex + @rm -f ld_prep.def + +#------------------------------------------------------------------------ +# Compile or assemble modules which are always used. +#------------------------------------------------------------------------ +begin.o: $(PSS_CONFIG)/begin.s \ + makefile $(PSS_CONFIG)/config.mk + $(AS) $(AOPTS) -o $@ $< + +rombegin.o: $(PSS_CONFIG)/rombegin.s \ + makefile $(PSS_CONFIG)/config.mk + $(AS) $(AOPTS) -o $@ $< + +beginapp.o: $(PSS_CONFIG)/beginapp.s \ + makefile $(PSS_CONFIG)/config.mk + $(AS) $(AOPTS) -o $@ $< + +ldbegin.o: $(PSS_CONFIG)/ldbegin.s \ + makefile $(PSS_CONFIG)/config.mk + $(AS) $(AOPTS) -o $@ $< + +lddriver.o: $(PSS_CONFIG)/lddriver.s \ + makefile $(PSS_CONFIG)/config.mk + $(AS) $(AOPTS) -o $@ $< + +bspcalls.o: $(PSS_BSP)/bspcalls.s \ + makefile $(PSS_CONFIG)/config.mk + $(AS) $(AOPTS) -o $@ $< + +gsblkcfg.o: $(PSS_CONFIG)/gsblkcfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h + $(CC) $(COPTS) -o $@ $< + +sysinit.o: $(PSS_CONFIG)/sysinit.c \ + qpsos.tmp \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o sysinit.tmp $< + @$(LD) $(LOPTS) -r -Xsuppress-dot -Xreloc-bug -o sysinit.o sysinit.tmp qpsos.tmp > qpsos.map + @rm -f qpsos.o qmpsos.o qpsos.map sysinit.tmp + +qpsos.tmp: $(PSS_ROOT)/sys/os/qpsos.s + @echo "UNIPROC=1" > qpsos_tmp.s + @cat $< >> qpsos_tmp.s + @$(AS) $(AOPTS) -o qpsos.o qpsos_tmp.s + @echo "UNIPROC=0" > qpsos_tmp.s + @cat $< >> qpsos_tmp.s + @das $(AOPTS) -I$(PSS_ROOT)/sys/os -o qmpsos.o qpsos_tmp.s + @rm -f qpsos.tmp qpsos_tmp.s + @$(LIB) cr qpsos.tmp qpsos.o qmpsos.o + +philecfg.o: $(PSS_CONFIG)/philecfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +pnacfg.o: $(PSS_CONFIG)/pnacfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +pnetcfg.o: $(PSS_CONFIG)/pnetcfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +prepccfg.o: $(PSS_CONFIG)/prepccfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +probecfg.o: $(PSS_CONFIG)/probecfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +prpccfg.o: $(PSS_CONFIG)/prpccfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +psecfg.o: $(PSS_CONFIG)/psecfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +psoscfg.o: $(PSS_CONFIG)/psoscfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +pmontcfg.o: $(PSS_CONFIG)/pmontcfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +dialog.o: $(PSS_CONFIG)/dialog.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +pollio.o: $(PSS_CONFIG)/pollio.c \ + makefile $(PSS_CONFIG)/config.mk \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +bspcfg.o: $(PSS_BSP)/bspcfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +plmcfg.o: $(PSS_CONFIG)/plmcfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +ldcfg.o: $(PSS_CONFIG)/ldcfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h + $(CC) $(COPTS) -o $@ $< + +compiler.o: $(PSS_CONFIG)/compiler.c \ + makefile $(PSS_CONFIG)/config.mk + $(CC) $(COPTS) -o $@ $< + +posixcfg.o: $(PSS_CONFIG)/posixcfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +rtacfg.o: $(PSS_CONFIG)/rtacfg.c \ + makefile $(PSS_CONFIG)/config.mk sys_conf.h \ + $(PSS_BSP)/bsp.h + $(CC) $(COPTS) -o $@ $< + +c.opt: makefile $(PSS_CONFIG)/config.mk + @echo $(COMP_OPTS1) > c.opt + @echo $(COMP_OPTS2) >> c.opt + @echo $(COPTS_FILE1) >> c.opt + @echo $(COPTS_FILE2) >> c.opt + +cxx.opt: makefile $(PSS_CONFIG)/config.mk + @echo $(COMP_OPTS1) > cxx.opt + @echo $(COMP_OPTS2) >> cxx.opt + @echo $(COPTS_FILE1) >> cxx.opt + @echo $(COPTS_FILE2) >> cxx.opt + @echo $(CXX_OPTS) >> cxx.opt + +a.opt: makefile $(PSS_CONFIG)/config.mk + @echo $(AOPTS_FILE1) > a.opt + @echo $(AOPTS_FILE2) >> a.opt + @echo $(AOPTS_FILE3) >> a.opt + +ill.opt: makefile $(PSS_CONFIG)/config.mk + @echo $(LOPTS) > ill.opt + +#------------------------------------------------------------------------ +# Following target is used in psosmake to ensure that .opt files exist +# when target for a single file is made. +#------------------------------------------------------------------------ +create_opt_files: c.opt cxx.opt a.opt $(PSS_APP_OPTFILES) diff --git a/h/wrn/wm/util/port/isisnmp/x86226/drv_conf.h b/h/wrn/wm/util/port/isisnmp/x86226/drv_conf.h new file mode 100644 index 0000000..f39f7dd --- /dev/null +++ b/h/wrn/wm/util/port/isisnmp/x86226/drv_conf.h @@ -0,0 +1,535 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/isisnmp/x86226/drv_conf.h,v 1.1.1.1 2001/11/05 17:47:11 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: drv_conf.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:11 tneale + * Tornado shuffle + * + * Revision 1.5 2001/01/19 22:23:00 paul + * Update copyright. + * + * Revision 1.4 2000/03/17 00:10:13 meister + * Update copyright message + * + * Revision 1.3 1998/08/20 18:01:21 josh + * sys_conf.h cleanup + * + * Revision 1.2 1998/08/19 21:38:34 josh + * adding copyright stuff. + * + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + +/* @(#) pSOSystem x86/V2.2.6: apps.v22/xxxx/drv_conf.c 3.3 (snmpv2) 98/01/09 12:28:00 */ +/***********************************************************************/ +/* */ +/* MODULE: drv_conf.c */ +/* DATE: 98/01/09 */ +/* PURPOSE: pSOSystem driver configuration and initialization */ +/* */ +/* There are two functions in this file: */ +/* */ +/* SetUpDrivers to setup drivers except for Network drivers */ +/* SetUpNI to setup Network drivers */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* Copyright 1993 - 1997, Integrated Systems, Inc. */ +/* ALL RIGHTS RESERVED */ +/* */ +/* Permission is hereby granted to licensees of Integrated Systems, */ +/* Inc. products to use or abstract this computer program for the */ +/* sole purpose of implementing a product based on Integrated */ +/* Systems, Inc. products. No other rights to reproduce, use, */ +/* or disseminate this computer program, whether in part or in */ +/* whole, are granted. */ +/* */ +/* Integrated Systems, Inc. makes no representation or warranties */ +/* with respect to the performance of this computer program, and */ +/* specifically disclaims any responsibility for any damages, */ +/* special or consequential, connected with the use of this program. */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* */ +/* */ +/***********************************************************************/ +#include +#include "bsp.h" +#include +#include +#include +#include +#if SC_DEV_SPI + #include "spi.h" +#endif +#if (SC_PSE) +#include +#include +#endif +#if (SC_DEV_DLPI) +extern long DlpiEnet(); +#endif + +#define NULLF (ULONG) ((void (*)()) 0) + +void InstallNi(int (*entry)(), int, int, int, int, int, int); + +static const char RarpErrTimeout[] = + "RARP request failed: Check for a RARP server"; +static const char RarpErrNet[] = + "RARP request failed: Network Error"; + +#if SC_PSOS || SC_PSOSM +/***********************************************************************/ +/* SetUpDrivers: installs drivers in PsosIO table via a call to */ +/* InstallDriver and then calls driver setup function if */ +/* needed. NOTE: If the driver is to be part of the */ +/* Network Interface then it should be placed in the */ +/* SetUpNI function. */ +/* */ +/* INPUT: FreeMemPtr = A pointer to unused memory that can be */ +/* used to allocate space for a driver. */ +/* NOTE: Be sure to advance FreeMemPtr if */ +/* memory is allocates! */ +/* */ +/* RETURNS: The new address of free memory after the drivers have */ +/* allocated space. */ +/* */ +/* NOTE: This function does many precompile checks so errors */ +/* can be found during compile-time rather then at run- */ +/* time. */ +/* */ +/* To add a non-Network driver to pSOSystem, call InstallDriver(). */ +/* This adds a device driver to the PsosIO table. InstallDriver() */ +/* takes the following arguments: */ +/* */ +/* unsigned short major_number device major number */ +/* void (*dev_init)(), device init procedure */ +/* void (*dev_open)(), device open procedure */ +/* void (*dev_close)(), device close procedure */ +/* void (*dev_read)(), device read procedure */ +/* void (*dev_write)(), device write procedure */ +/* void (*dev_ioctl)(), device control procedure */ +/* unsigned long rsvd1, reserved */ +/* unsigned short rsvd2) reserved */ +/* unsigned short flags; If set to IO_AUTOINIT pSOS will */ +/* automatically call the */ +/* drivers initialization */ +/* function. The SC_AUTOINIT */ +/* #define which is set in */ +/* sys_conf.h can be used to set */ +/* this element. */ +/* */ +/* InstallDriver() does not return a value. InstallDriver() assumes */ +/* SC_DEVMAX is defined in sys_conf.h and is useful only before pSOS+ */ +/* has been initialized. */ +/* */ +/* If you are adding a driver that needs to be initialized before */ +/* either pSOS+ is initialized or the driver's init function is */ +/* called, then you can call a setup function (that you create) for */ +/* the driver (for example, see the CnslSetup call for the serial */ +/* device driver). If your initialization function needs to allocate */ +/* memory, you may pass it the FreeMemPtr. The function should return */ +/* a new FreeMemPtr which points to the end of the memory it has */ +/* allocated. */ +/* */ +/* When adding code to install a new driver, it is a good idea to add */ +/* precompile checks so errors can be found during compile-time rather */ +/* then at run-time. Precompile checks are used, for example, in the */ +/* code that installs the pSOSystem serial device driver below. */ +/* */ +/***********************************************************************/ +UCHAR *SetUpDrivers(UCHAR *FreeMemPtr) +{ +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem serial device driver. */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SERIAL && BSP_SERIAL) + #if(SC_DEV_SERIAL > SC_DEVMAX) + #error "SC_DEV_SERIAL cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SERIAL, CnslInit, NULLF, NULLF,CnslRead, + CnslWrite, CnslCntrl, 0, 0, SC_AUTOINIT); + FreeMemPtr = CnslSetup(FreeMemPtr, SysVars.DefBaud, + SC_APP_CONSOLE); +#endif + +/*---------------------------------------------------------------------*/ +/* Install Pseudo driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_PSEUDO) + InstallDriver(SC_DEV_PSEUDO, PseudoIOInit, NULLF, NULLF, + PseudoIORead, PseudoIOWrite, PseudoIOCntrl, 0, 0, 0); +#endif + +/*--------------------------------------------------------------------*/ +/* Setup pSOSystem PC console device driver */ +/*--------------------------------------------------------------------*/ +#if (SC_DEV_CONSOLE && BSP_CONSOLE) + #if (SC_DEV_CONSOLE >SC_DEVMAX) + #error "SC_DEV_CONSOLE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_CONSOLE, PcCnslInit, NULLF, NULLF, + PcCnslRead, PcCnslWrite, PcCnslCntrl, 0, 0, + SC_AUTOINIT); +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem tick timer. */ +/*---------------------------------------------------------------------*/ +#if SC_DEV_TIMER + #if(SC_DEV_TIMER > SC_DEVMAX) + #error "SC_DEV_TIMER cannot be > SC_DEVMAX" + #endif + #if (!SC_PSOS && !SC_PSOSM) + #error "Must have pSOS+ or pSOS+m in system to use tick timer!" + #endif + InstallDriver(SC_DEV_TIMER, RtcInit, NULLF, NULLF, NULLF, NULLF, + NULLF, 0, 0, SC_AUTOINIT); +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem ramdisk driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if SC_DEV_RAMDISK + #if(SC_DEV_RAMDISK > SC_DEVMAX) + #error "SC_DEV_RAMDISK cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_RAMDISK, RdskInit, NULLF, NULLF, RdskRead, + RdskWrite, NULLF, 0, 0, 0); +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem SCSI driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SCSI && BSP_SCSI) + #if(SC_DEV_SCSI > SC_DEVMAX) + #error "SC_DEV_SCSI cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SCSI, SdrvInit, NULLF, NULLF, SdskRead, + SdskWrite, SdrvCntrl, 0, 0, 0); +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem SCSI Tape driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SCSI_TAPE && BSP_SCSI_TAPE) + #if(SC_DEV_SCSI_TAPE > SC_DEVMAX) + #error "SC_DEV_SCSI_TAPE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SCSI_TAPE, SdrvInit, StapeOpen, StapeClose, + StapeRead, StapeWrite, SdrvCntrl, 0, 0, 0); + + /*-----------------------------------------------------------------*/ + /* Don't need to call SdrvSetup this time since it was done before */ + /*-----------------------------------------------------------------*/ + /* SdrvSetup(); */ +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem CMOS clock driver */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_CMOS && BSP_CLOCK) + #if (SC_DEV_CMOS >SC_DEVMAX) + #error "SC_DEV_CMOS cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_CMOS, NULLF, NULLF, NULLF, CmcRead, + CmcWrite, NULLF, 0, 0, 0); +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem printer driver */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_PARALLEL && BSP_PARALLEL) + #if (SC_DEV_PARALLEL >SC_DEVMAX) + #error "SC_DEV_PARALLEL cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_PARALLEL, ParInit, ParOpen, ParClose, NULLF, + ParWrite, ParCntrl, 0, 0, 0); +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem floppy diskette driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_FLOPPY && BSP_FLOPPY) + #if (SC_DEV_FLOPPY >SC_DEVMAX) + #error "SC_DEV_FLOPPY cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_FLOPPY, FlpInit, NULLF, NULLF, FlpRead, + FlpWrite, NULLF, 0, 0, 0); +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem IDE disk driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_IDE && BSP_IDE) + #if (SC_DEV_IDE >SC_DEVMAX) + #error "SC_DEV_IDE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_IDE, IDEInit, NULLF, NULLF, IDERead, + IDEWrite, IDECntrl, 0, 0, 0); +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem TFTP driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_TFTP) + #if(SC_DEV_TFTP > SC_DEVMAX) + #error "SC_DEV_TFTP cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_TFTP, TftpInit, TftpOpen, TftpClose, TftpRead, + NULLF, TftpCntl, 0, 0, 0); +#endif + +/*---------------------------------------------------------------------*/ +/* Install the SPI driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SPI) + #if(SC_DEV_SPI > SC_DEVMAX) + #error "SC_DEV_SPI cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SPI, SPI_init, SPI_open, SPI_close, NULLF, + NULLF, SPI_io, 0, 0, 0); +#endif + +/*---------------------------------------------------------------------*/ +/* Install pSE DLPI driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_DLPI) + { + #if(SC_DEV_DLPI > SC_DEVMAX) + #error "SC_DEV_DLPI cannot be > SC_DEVMAX" + #endif + extern long DlpiNullNI(); + extern UCHAR *DlpiInit(UCHAR *, long, long); + extern int DlpiAddNI(long, long(*)(), long, long, char *, long); + extern void enetinit(); + extern struct streamtab enetinfo; + char *DlpiErrMsg = "DlpiAddNI failed: NI Error"; + static const psedrvparam_t eth0param = {"eth0", DT_CLONE, + &enetinfo, 0, 0}; + + InstallDriver(SC_DEV_DLPI, enetinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)ð0param, 0, 0); + + /*-------------------------------------------------------------*/ + /* Call DlpiInit to initialize the Streams DLPI driver */ + /* Arguments passed to DlpiInit are: */ + /* 1. Free memory address */ + /* 2. Maximum NI interface number */ + /* 3. Maximum number of streams per interface */ + /*-------------------------------------------------------------*/ + FreeMemPtr = DlpiInit(FreeMemPtr, 1, 6); + + /*-------------------------------------------------------------*/ + /* Call DlpiAddNI to add an NI interface to the Streams DLPI */ + /* driver. DlpiAddNI must be called for each NI driver */ + /* interface used with the Streams DLPI driver. */ + /* Arguments passed to DlpiAddNI are: */ + /* 1. NI interface number (should correspond to the pNA+ */ + /* interface number if driver is shared with pNA+) */ + /* 2. NI entry point */ + /* 3. NI flags */ + /* IFF_SELFLOOP 0x0001 loopback for self-address */ + /* IFF_POLL_NI 0x0002 driver must be polled */ + /* IFF_RAWMEM 0x2000 driver accepts mblk link list */ + /* 4. NI major device number */ + /* 5. NI multicast address */ + /* 6. NI poll frequency (every # of elapsed ticks) */ + /*-------------------------------------------------------------*/ + #if (BSP_LAN1 && SE_SHARE_NI) + if (DlpiAddNI(1, (long(*)())BSP_LAN1_ENTRY, 0x2000, + SC_DEV_DLPI, 0, 0)) + SysInitFail(DlpiErrMsg); + #else + if (DlpiAddNI(0, (long(*)())DlpiNullNI, 0, SC_DEV_DLPI, 0, 0)) + SysInitFail(DlpiErrMsg); + #endif + } +#endif + +/*-------------------------------------------------------------------*/ +/* Install pSOSystem Watchdog driver */ +/*-------------------------------------------------------------------*/ +#if (SC_DEV_WATCHDOG) + #if(SC_DEV_WATCHDOG > SC_DEVMAX) + #error "SC_DEV_WATCHDOG cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_WATCHDOG, WdtInit, NULLF, NULLF, NULLF, + NULLF, NULLF, 0, 0, 0); +#endif + +/*---------------------------------------------------------------------*/ +/* Additional drivers may be installed here. */ +/*---------------------------------------------------------------------*/ + +return FreeMemPtr; +} +#endif /* SC_PSOS || SC_PSOSM */ + +#if SC_PNA +/***********************************************************************/ +/* SetUpNI: Set up Network Interfaces for pNA+ */ +/* */ +/* INPUT: FreeMemPtr = A pointer to unused memory that can be */ +/* used to allocate space for a driver. */ +/* NOTE: Be sure to advance FreeMemPtr if */ +/* memory is allocates! */ +/* */ +/* RETURNS: The new address of free memory after the drivers have */ +/* allocated space. */ +/* */ +/* NOTES: This function does many precompile checks so errors */ +/* can be found during compile-time rather then at run- */ +/* time. */ +/* */ +/* Also, the Network Interface Table must be allocated */ +/* before this function can be called. There cannot be */ +/* more then NC_NNI entries in this table. NC_NNI is set */ +/* in sys_conf.h. Before adding another interface, be */ +/* sure to check sys_conf.h to see if NC_NNI is set to */ +/* accommodate another one! */ +/* */ +/* See the pSOSystem Programmers Reference Manual */ +/* for more information. */ +/* */ +/* To add a Network driver to pSOSystem, call InstallNi(). This adds */ +/* the Network Interface to the pNA+ Network Interface Table. */ +/* InstallNi() takes the following arguments: */ +/* */ +/* int (*entry)(); address of NI entry point */ +/* int ipadd; IP address */ +/* int mtu; maximum transmission length */ +/* int hwalen; length of hardware address */ +/* int flags; intErface flags */ +/* int subnetaddr; subnet mask */ +/* int dstipaddr; destination ip address */ +/* */ +/* See pSOSystem Programmer`s Reference Manual, Configuration Tables */ +/* Section, for more information about the Network Interface Table. */ +/* InstallNi() does not return a value. */ +/* */ +/* If you are adding a driver that needs to be initialized before */ +/* either pSOS+ is initialized or the driver's init function is */ +/* called, then you can call a setup function (that you create) for */ +/* the driver (for example, see the CnslSetup call for the serial */ +/* device driver). If your initialization function needs to allocate */ +/* memory, you may pass it the FreeMemPtr. The function should return */ +/* a new FreeMemPtr which points to the end of the memory it has */ +/* allocated. */ +/* */ +/* When adding code to install a new driver, it is a good idea to add */ +/* precompile checks so errors can be found during compile-time rather */ +/* then at run-time. Precompile checks are used, for example, in the */ +/* code that installs the pSOSystem serial device driver below. */ +/* */ +/***********************************************************************/ +UCHAR *SetUpNI(UCHAR *FreeMemPtr) +{ +int IPaddr; + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem NI. */ +/*---------------------------------------------------------------------*/ +#if BSP_LAN1 + if (SysVars.Lan1) + { + /*-------------------------------------------------------------*/ + /* If RARP is specified for the IP address, use it now to */ + /* obtain the IP address for this interface. */ + /*-------------------------------------------------------------*/ + if (SysVars.Lan1IP == USE_RARP) + { + #if (SC_DEV_DLPI && SE_SHARE_NI) + IPaddr = RarpEth((long (*)())DlpiEnet); + #else + IPaddr = RarpEth((long (*)())BSP_LAN1_ENTRY); + #endif + if (IPaddr == 0) + SysInitFail(RarpErrTimeout); + if (IPaddr == -1) + SysInitFail(RarpErrNet); + } + else + IPaddr = SysVars.Lan1IP; + + #if (SC_DEV_DLPI && SE_SHARE_NI) + InstallNi((int (*)())DlpiEnet, IPaddr, + #else + InstallNi((int (*)())BSP_LAN1_ENTRY, IPaddr, + #endif + BSP_LAN1_MTU, BSP_LAN1_HWALEN, BSP_LAN1_FLAGS, + SysVars.Lan1SubnetMask, 0); + } +#endif + +/*---------------------------------------------------------------------*/ +/* Install the shared memory NI. */ +/*---------------------------------------------------------------------*/ +#if BSP_SMEM + #if ((SC_NISM_LEVEL != 1) && (SC_NISM_LEVEL != 2)) + #error "Illegal value for SC_NISM_LEVEL" + #endif + + if (SysVars.Nism) + { + InstallNi((int (*)())NiSmem, SysVars.NismIP, NISM_MTU, 4, 0x8002, + SysVars.NismSubnetMask, 0); + + /*-------------------------------------------------------------*/ + /* Set up the NI Shared Memory driver by calling its function */ + /* "NiSmemSetup". */ + /*-------------------------------------------------------------*/ + FreeMemPtr = NiSmemSetup(SC_NISM_BUFFS, FreeMemPtr, + SC_NISM_LEVEL); + } +#endif +/*---------------------------------------------------------------------*/ +/* Additional Network drivers may be installed here. */ +/*---------------------------------------------------------------------*/ + +return FreeMemPtr; +} + +#endif diff --git a/h/wrn/wm/util/port/isisnmp/x86226/sys_conf.h b/h/wrn/wm/util/port/isisnmp/x86226/sys_conf.h new file mode 100644 index 0000000..33cba05 --- /dev/null +++ b/h/wrn/wm/util/port/isisnmp/x86226/sys_conf.h @@ -0,0 +1,734 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/isisnmp/x86226/sys_conf.h,v 1.1.1.1 2001/11/05 17:47:11 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: sys_conf.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:11 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:23:00 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:10:13 meister + * Update copyright message + * + * Revision 1.2 1998/08/19 21:38:35 josh + * adding copyright stuff. + * + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + +/* @(#) pSOSystem x86/V2.2.6: apps.v22/xxxx/sys_conf.h (snmpv2 386) 3.21 98/01/12 10:03:13 */ +/***********************************************************************/ +/* */ +/* MODULE: sys_conf.h */ +/* DATE: 98/01/12 */ +/* PURPOSE: pSOSystem configuration definitions */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* Copyright 1991 - 1997, Integrated Systems, Inc. */ +/* ALL RIGHTS RESERVED */ +/* */ +/* Permission is hereby granted to licensees of Integrated Systems, */ +/* Inc. products to use or abstract this computer program for the */ +/* sole purpose of implementing a product based on Integrated */ +/* Systems, Inc. products. No other rights to reproduce, use, */ +/* or disseminate this computer program, whether in part or in */ +/* whole, are granted. */ +/* */ +/* Integrated Systems, Inc. makes no representation or warranties */ +/* with respect to the performance of this computer program, and */ +/* specifically disclaims any responsibility for any damages, */ +/* special or consequential, connected with the use of this program. */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* This is a header file which defines all of the system-level */ +/* parameters that are likely to need changing. */ +/* */ +/* It has been set up to be as close as possible to the settings */ +/* which are appropriate for this application. However, you may */ +/* need to make some changes to parameters to reflect your */ +/* environment, such as IP addresses, etc. */ +/* */ +/* Chapter 7 of the pSOSystem Getting Started manual contains a */ +/* complete description of the symbols that are defined in this */ +/* file. */ +/* */ +/***********************************************************************/ +#if __cplusplus +extern "C" { +#endif + +#ifndef _SYS_CONF_H +#define _SYS_CONF_H + +/***********************************************************************/ +/* */ +/* SC_APP_PARMS Must be defined before you include sysvars.h file. */ +/* Since "sysvars.h" file depends on SC_APP_PARMS and BSP_PARMS */ +/* to define the Storage Parms Structure. */ +/* */ +/* Defining this variable to a Non-Zero Value will create a space in */ +/* the Storage Parms. structure for your application use. */ +/* */ +/***********************************************************************/ +#define SC_APP_PARMS 0 +#define SC_APP_NAME "snmpv2 Application" + +/*---------------------------------------------------------------------*/ +/* types.h contains common definitions for example YES and NO */ +/*---------------------------------------------------------------------*/ +#include + +/***********************************************************************/ +/* sysvars.h contains the structures and definitions for the system */ +/* variables that are stored in NVRAM. These structures and */ +/* definitions are also used when creating the boot rom for the */ +/* target system. By using the same sysvars.h file it will insure the */ +/* consistency of the values stored by the boot rom and later read by */ +/* the downloaded application. */ +/***********************************************************************/ +#include + +/*---------------------------------------------------------------------*/ +/* include psos.h for defines IO_AUTOINIT and IO_NOAUTOINIT */ +/*---------------------------------------------------------------------*/ +#include + +/***********************************************************************/ +/* */ +/* These symbols are used to define other symbols in this file. */ +/* They should never be changed. */ +/* */ +/***********************************************************************/ +#define USE_RARP 0 + + +/***********************************************************************/ +/* */ +/* B A S I C P A R A M E T E R S */ +/* */ +/* The parameters in this section determine the fashion in which */ +/* many of the other parameters in this file will be used. */ +/* */ +/* Many of the parameters in this file have names beginning with */ +/* either "SC_" or "SD_". Those beginning with "SC_" are ALWAYS */ +/* controlled by the values you set in this file. The values of */ +/* the "SD_" parameters can be determined either by the definitions */ +/* given in this file, or by the data found in the target board's */ +/* parameter storage area. SC_SD_PARAMETERS determines this. If */ +/* SC_SD_PARAMETERS is "SYS_CONF", then the values given in this */ +/* file will be used for the SD_ parameters. If SC_SD_PARAMETERS */ +/* is "STORAGE", then pSOSystem will attempt to use the values found */ +/* in the board's parameter storage area for the SD_ variables. If */ +/* the parameter storage area has not been initialized or has been */ +/* corrupted, then the values given in this file will be used. They */ +/* will also be written to the storage area. */ +/* */ +/* If SC_SD_PARAMETERS is STORAGE, you may enable a "startup dialog" */ +/* which will allow you to view, and optionally change, the */ +/* parameter values found in the storage area. The dialog is enabled */ +/* by setting SC_STARTUP_DIALOG to YES. In this case, */ +/* SD_STARTUP_DELAY specifies the number of seconds that the dialog */ +/* will wait for input before proceeding to boot the system. */ +/* */ +/* SC_SD_DEBUG_MODE determines how the system will operate, as follows:*/ +/* */ +/* DBG_SA: Boot pROBE+ in standalone mode. */ +/* */ +/* DBG_XS: Boot into pROBE+ and wait for the host debugger */ +/* via a serial connection */ +/* */ +/* DBG_XN: Boot into pROBE+ and wait for the host debugger */ +/* via a network connection */ +/* */ +/* DBG_AP: Same as DBG_SA, but also does a pROBE+ "silent startup",*/ +/* meaning that pROBE+ initializes itself without */ +/* printing a startup banner. pROBE+ then initializes */ +/* pSOS+ and starts the application running. This mode */ +/* was created to simplify implementation of the pSOSystem */ +/* Boot ROMs. Note that when this mode is used, the value */ +/* you specify for RC_SMODE (see "pROBE+ Configuration */ +/* Parameters", below) is overridden. */ +/* */ +/* STORAGE: Use the mode (DBG_SA, DBG_XS, or DBG_XN) found in the */ +/* parameter storage area. If a valid mode is not found, */ +/* then use DBG_SA. */ +/* */ +/* An important consequence of using SC_SD_DEBUG_MODE=STORAGE should */ +/* be noted. If you use the TFTP bootloader in the pSOSystem ROMs */ +/* to download and start your system, you will be setting */ +/* SC_SD_DEBUG_MODE = DBG_AP in your target board's parameter storage */ +/* area. Thus, if you have left SC_SD_DEBUG_MODE set to STORAGE in */ +/* this file, your downloaded system will also use DBG_AP, meaning */ +/* that the application will begin running immediately after the */ +/* TFTP bootloader has loaded and started your system. */ +/* */ +/***********************************************************************/ +#define SC_SD_PARAMETERS STORAGE +#define SC_STARTUP_DIALOG NO +#define SC_BOOT_ROM NO +#define SD_STARTUP_DELAY 60 +#define SC_SD_DEBUG_MODE STORAGE + +/***********************************************************************/ +/* */ +/* O P E R A T I N G S Y S T E M C O M P O N E N T S */ +/* */ +/* Setting the definition line to YES will cause that component to */ +/* be built into the system. NO means the component will NOT be */ +/* put into the system. It is an error to specify both SC_PSOS */ +/* and SC_PSOSM as present! */ +/* */ +/***********************************************************************/ +#define SC_PSOS YES /* pSOS+ real-time kernel */ +#define SC_PSOSM NO /* pSOS+ real-time multiproc kernel */ +#define SC_PROBE YES /* pROBE+ (processor svcs) */ +#define SC_PROBE_DISASM YES /* pROBE+ (disassembler) */ +#define SC_PROBE_DASM_INTEL NO /* pROBE+ (Intel format disassembler) */ + /* for x86 Targets Only */ +#define SC_PROBE_CIE YES /* pROBE+ (console executive) */ +#define SC_PROBE_QUERY YES /* pROBE+ (query services) */ +#define SC_PROBE_DEBUG YES /* pROBE+ (debug interface executive) */ +#define SC_PHILE YES /* pHILE+ file system manager */ +#define SC_PREPC YES /* pREPC+ C run-time library */ +#define SC_PNA YES /* pNA+ TCP/IP networking manager */ +#define SC_PRPC YES /* pRPC+ RPC component */ +#define SC_PSE NO /* pSE+ streams component */ +#define SC_PSKT NO /* pSKT+ SKT library component */ +#define SC_PTLI NO /* pTLI+ TLI library component */ +#define SC_PMONT NO /* pMONT+ */ +#define SC_PROFILER NO /* Profiler is enabled/Disabled */ + +/*---------------------------------------------------------------------*/ +/* If set to IO_AUTOINIT device drivers that are installed be the */ +/* InstallDriver function will have their autoinit field set. This */ +/* will cause pSOS+ call the drivers initialization function when */ +/* pSOS+ starts up. The de_init call will not have to be called for */ +/* each driver if this is done. */ +/* */ +/* NOTE: This Auto Initialization will not work on all drivers. */ +/* Setting IO_AUTOINIT only effects drivers that can use the Auto */ +/* Initialization feature. */ +/* */ +/* If set to IO_NOAUTOINIT no automatic driver initialization will */ +/* happen. */ +/*---------------------------------------------------------------------*/ +#define SC_AUTOINIT IO_AUTOINIT + +/*---------------------------------------------------------------------*/ +/* If SC_PMONT SC_AUTOINIT will always be set to 1 because pMONT needs */ +/* drivers to be automatically initialized. */ +/*---------------------------------------------------------------------*/ +#if SC_PMONT + #undef SC_AUTOINIT + #define SC_AUTOINIT IO_AUTOINIT +#endif + +/***********************************************************************/ +/* */ +/* S E R I A L C H A N N E L C O N F I G U R A T I O N */ +/* */ +/* * SD_DEF_BAUD specifies the default baud rate to be used for the */ +/* serial channels */ +/* * SC_APP_CONSOLE specifies the serial channel number (starting */ +/* from 1) which should be used for the application's "console". */ +/* * SC_PROBE_CONSOLE specifies the serial channel number (starting */ +/* from 1) which pROBE+ should use to display output and receive */ +/* commands, or to communicate with the host debugger. */ +/* * SC_PROBE_HOST specifies the serial channel number (starting */ +/* from 1) which should be used for the pROBE+ "host" channel. */ +/* This is not normally required, so it can be disabled by */ +/* using a value of 0. The host channel is explained in the */ +/* pROBE+ User's Manual. */ +/* */ +/***********************************************************************/ +#define SD_DEF_BAUD 9600 +#define SC_APP_CONSOLE PCCON +#define SC_PROBE_CONSOLE PCCON +#define SC_RBUG_PORT 0 + +/***********************************************************************/ +/* SC_NumNon_pSOSChan is the number of non pSOS users of serial */ +/* channels. These are users that will be initiated before pSOS */ +/* such as pROBE. */ +/* NOTE: These channels will not be closed on a soft reset. */ +/***********************************************************************/ +#if (SC_RBUG_PORT && SC_PROBE_CONSOLE && (SC_PROBE_CONSOLE != PCCON)) +#define SC_NumNon_pSOSChan 2 +#else +#define SC_NumNon_pSOSChan 1 +#endif + +/***********************************************************************/ +/* */ +/* L A N C O N F I G U R A T I O N */ +/* */ +/* */ +/***********************************************************************/ +#define SD_LAN1 YES +#define SD_LAN1_IP 0x80e001b7 +#define SD_LAN1_SUBNET_MASK 0xffffff00 + +/*---------------------------------------------------------------------*/ +/* Maximum number of multicast addresses to be used by the lan */ +/* interface. Must not exceed maximum supported by the lan driver. */ +/*---------------------------------------------------------------------*/ +#define SC_LAN1_NMCAST 0 + +/***********************************************************************/ +/* */ +/* S H A R E D M E M O R Y C O N F I G U R A T I O N */ +/* */ +/* */ +/***********************************************************************/ + +/***********************************************************************/ +/* */ +/* B U S C O N F I G U R A T I O N */ +/* */ +/* */ +/***********************************************************************/ +#define SD_VME_BASE_ADDR 0x01000000 + +/*---------------------------------------------------------------------*/ +/* If you want to build a Shared Memory Interface for the network or */ +/* multi-processing pSOS+m, set SD_SM_NODE (a non-zero value) to the */ +/* node number of THIS node. */ +/*---------------------------------------------------------------------*/ +#define SD_SM_NODE 0 + +/*---------------------------------------------------------------------*/ +/* Shared memory network interface - SC_NISM_LEVEL should be 1 if this */ +/* will be the FIRST system to use the SMNI on this board. It should */ +/* be 2 if this will not be the first system to use the SMNI on this */ +/* board. Usually this means that SC_NISM_LEVEL should be 1 if you */ +/* are building Boot ROMs, and 2 for a system that will be downloaded */ +/* and started using the Boot ROMs. See the comments at the beginning */ +/* of drivers/ni_smem.c for more explanation. */ +/*---------------------------------------------------------------------*/ +#define SD_NISM NO +#define SD_NISM_IP 0x00000000 +#define SD_NISM_DIRADDR 0x00000400 +#define SC_NISM_BUFFS 30 +#define SC_NISM_LEVEL 2 +#define SD_NISM_SUBNET_MASK 0 + + +/*---------------------------------------------------------------------*/ +/* If you want to build a multi-node pSOS+m system, set SD_KISM */ +/* to the number of nodes in the system. */ +/*---------------------------------------------------------------------*/ +#define SD_KISM 0 +#define SD_KISM_DIRADDR 0x00000580 + + +/***********************************************************************/ +/* */ +/* M I S C E L L A N E O U S N E T W O R K I N G */ +/* P A R A M E T E R S */ +/* */ +/***********************************************************************/ +#define SD_DEF_GTWY_IP 0 + + +/***********************************************************************/ +/* SC_RAM_SIZE */ +/* */ +/* Normally, pSOSystem uses ALL of the memory remaining on a board for */ +/* dynamic allocation ("region 0"). You may override this by setting */ +/* SC_RAM_SIZE to a non-zero value. If you do, pSOSystem will not */ +/* touch any memory after address (BSP_RAM_BASE + SC_RAM_SIZE - 1). */ +/* */ +/* NOTE: This is useful when making a BOOT ROM and you want to ensure */ +/* that the ROM's RAM area does not overflow the space alloted for it. */ +/***********************************************************************/ +#define SC_RAM_SIZE 0 + +/***********************************************************************/ +/* */ +/* I / O D E V I C E S */ +/* */ +/* Each device may be included in the system by specifying a major */ +/* number for it, which determines its slot in the pSOS+ I/O switch */ +/* table. To leave a device driver out of the system, use NO for */ +/* the major number. */ +/* */ +/* Note the following: */ +/* * Major device 0 is reserved and cannot be used for any of these */ +/* devices. Setting a device number to 0 here is the same as NO. */ +/* * No device number may be higher than SC_DEVMAX (SC_DEVMAX may */ +/* be increased, if desired) */ +/* * The lines defining the symbols DEV_SERIAL, DEV_TIMER, etc, */ +/* should not be changed. These are for use by application */ +/* programs as the "device number" parameter on de_* calls. */ +/* */ +/***********************************************************************/ +#define SC_DEV_SERIAL 1 /* Serial driver */ +#define SC_DEV_TIMER 2 /* Periodic tick timer */ +#define SC_DEV_RAMDISK NO /* RAM disk */ +#define SC_DEV_CONSOLE 4 /* PC-Console driver */ +#define SC_DEV_SCSI NO /* SCSI bus */ +#define SC_DEV_SCSI_TAPE NO /* SCSI bus, tape device */ +#define SC_DEV_IDE NO /* IDE Driver */ +#define SC_DEV_FLOPPY NO /* Floppy Driver */ +#define SC_DEV_TFTP NO /* TFTP pseudo driver */ +#define SC_DEV_SPI NO /* SPI driver */ +#define SC_DEV_DLPI NO /* DLPI pseudo driver */ +#define SC_DEV_OTCP NO /* 12 TCP/IP for OpEN */ +#define SC_IP SC_DEV_OTCP /* 12 IP */ +#define SC_ARP NO /* 13 ARP */ +#define SC_TCP NO /* 14 TCP */ +#define SC_UDP NO /* 15 UDP */ +#define SC_RAW NO /* 16 RAW */ +#define SC_LOOP NO /* 17 LOOP = (SC_DEV_OTCP + 5) */ +#define SC_DEV_SOSI NO /* 18 OSI for OpEN */ +#define SC_DEV_PSEUDO NO /* PSEUDO driver */ +#define SC_DEV_PARALLEL NO /* Parallel Port Driver */ +#define SC_DEV_CMOS NO /* CMOS Driver */ +#define SC_DEV_WATCHDOG NO /* Watchdog Driver */ +#define SC_DEV_OLAP NO /* LAP Driver */ +#define SC_PHPI (SC_DEV_OLAP) /* Phpi driver */ +#define SC_LAPB (SC_DEV_OLAP + 0)/* LAPB driver Change 0 to 1 */ +#define SC_CLAPB (SC_DEV_OLAP + 0)/* LAPB driver Change 0 to 2 */ +#define SC_DEV_OX25 (SC_DEV_OLAP + 0)/* LAPB driver Change 0 to 3 */ +#define SC_X25 (SC_DEV_OX25) /* X25 driver */ +#define SC_CX25 (SC_DEV_OX25 + 0)/* X25 driver Change 0 to 1 */ +#define SC_SNDCF NO /* sndcf driver */ +#define SC_CSNDCF NO /* csndcf driver */ +#define SC_IPCONV NO +#define SC_CIPCONV NO + +#define SC_DEVMAX 32 /* Maximum device number */ + +#define DEV_SERIAL (SC_DEV_SERIAL << 16) +#define DEV_PARALLEL (SC_DEV_PARALLEL << 16) +#define DEV_TIMER (SC_DEV_TIMER << 16) +#define DEV_RAMDISK (SC_DEV_RAMDISK << 16) +#define DEV_SCSI (SC_DEV_SCSI << 16) +#define DEV_SCSI_TAPE (SC_DEV_SCSI_TAPE << 16) +#define DEV_PSEUDO (SC_DEV_PSEUDO << 16) +#define DEV_DLPI (SC_DEV_DLPI << 16) +#define DEV_TFTP (SC_DEV_TFTP << 16) +#define DEV_SPI (SC_DEV_SPI << 16) +#define DEV_WATCHDOG (SC_DEV_WATCHDOG << 16) +#define DEV_FLOPPY (SC_DEV_FLOPPY << 16) +#define DEV_IDE (SC_DEV_IDE << 16) +#define DEV_CMOS (SC_DEV_CMOS << 16) +#define DEV_CONSOLE (SC_DEV_CONSOLE << 16) + +#if (BSP_CPUFAMILY == FAMILY_X86) && (SC_APP_CONSOLE == PCCON) + #define CONSOLE DEV_CONSOLE +#else + #define CONSOLE DEV_SERIAL +#endif + +/***********************************************************************/ +/* */ +/* M E M O R Y M A N A G E M E N T L I B R A R Y P A R A M S */ +/* */ +/***********************************************************************/ +#define SC_MMULIB NO + +/***********************************************************************/ +/* */ +/* C O M P O N E N T C O N F I G U R A T I O N P A R A M E T E R S */ +/* */ +/* These parameters should work as is for this application. You */ +/* may want to change some of them if you start customizing this */ +/* application. */ +/* */ +/***********************************************************************/ + +/*---------------------------------------------------------------------*/ +/* pSOS+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define KC_RN0USIZE 0x100 /* region 0 unit size */ +#define KC_NTASK 25 /* max number of tasks */ +#define KC_NQUEUE 10 /* max number of message queues */ +#define KC_NSEMA4 30 /* max number of semaphores */ +#define KC_NMSGBUF 256 /* max number of message buffers */ +#define KC_NTIMER 10 /* max number of timers */ +#define KC_NLOCOBJ 50 /* max number of local objects */ +#define KC_TICKS2SEC 100 /* clock tick interrupt frequency */ +#define KC_TICKS2SLICE 10 /* time slice quantum, in ticks */ +#define KC_INTSTK 0x2000 /* interrupt stack size */ +#define KC_SYSSTK 0x2000 /* pSOS+ system stack size (bytes) */ +#define KC_ROOTSSTK 0x4000 /* ROOT supervisor stack size */ +#define KC_ROOTUSTK 0 /* ROOT user stack size */ +#define KC_ROOTMODE (T_SUPV | T_ISR) /* ROOT initial mode */ +#define KC_ROOTPRI 230 /* ROOT task priority */ + +/*---------------------------------------------------------------------*/ +/* The following are examples for modifying the following defines */ +/* */ +/* Using a pSOSystem routine as a fatal error handler */ +/* #define KC_FATAL ((void (*)()) SysInitFail) */ +/* */ +/* Using a user written routine as a fatal error handler */ +/* extern void MyHandler (void); */ +/* #define KC_FATAL ((void (*)()) MyHandler) */ +/* */ +/*---------------------------------------------------------------------*/ +#define KC_STARTCO 0 /* callout at task activation */ +#define KC_DELETECO 0 /* callout at task deletion */ +#define KC_SWITCHCO 0 /* callout at task switch */ + +#define KC_FATAL 0 /* fatal error handler address */ +#define KC_IDLECO 0 /* Idle Task Callout */ +#define KC_RTCINITCO 0 /* RTC INIT Callout */ + +/*---------------------------------------------------------------------*/ +/* pSOS+m configuration parameters */ +/*---------------------------------------------------------------------*/ +#define MC_NGLBOBJ 8 /* size of gbl obj table */ +#define MC_NAGENT 10 /* number of RPC agents in this node */ +#define MC_FLAGS SEQWRAP_ON /* operating mode flags */ + +/*---------------------------------------------------------------------*/ +/* The following are examples for modifying the following definition */ +/* */ +/* Using a pSOSystem routine as a roster change handler */ +/* #define MC_ROSTER ((void (*)()) SysInitFail) */ +/* */ +/* Using a user written routine as a roster change handler */ +/* extern void MyHandler (void); */ +/* #define MC_ROSTER ((void (*)()) MyHandler) */ +/* */ +/*---------------------------------------------------------------------*/ +#define MC_ROSTER 0 /* addr of user roster change callout */ +#define MC_KIMAXBUF 100 /* maximum KI packet buffer length */ +#define MC_ASYNCERR 0 /* asynchronous calls error callout */ + +/*---------------------------------------------------------------------*/ +/* pROBE configuration parameters - note that the SMODE flag bits are */ +/* irrelevant if SC_SD_DEBUG_MODE = DBG_AP. */ +/*---------------------------------------------------------------------*/ +#define TD_BRKOPC 0xCC /* Instruction break opcode */ +#define TD_ILEV (1 << 12)/* pROBE+ interrupt mask */ +#define TD_FLAGS (NODOTS_MASK | TD_ILEV | NOTUPD_MASK)/* flags */ +#define TD_DBGPRI 244 /* Debugger task priority */ + +/*---------------------------------------------------------------------*/ +/* The variable defined down should be set to the Starting address for */ +/* for pROBE+ DATA AREA. This is required by all the smaller boards. */ +/* NOTE: */ +/* Setting of this value should have atleast 0x4400 bytes Free */ +/* Space from that location. */ +/*---------------------------------------------------------------------*/ +#define TD_DATASTART 0x0 + +/*---------------------------------------------------------------------*/ +/* pHILE+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define FC_LOGBSIZE 9 /* Block size (base-2 exponent) */ +#define FC_NBUF 6 /* Number of cache buffers */ +#define FC_NMOUNT 3 /* Max # of mounted volumes */ +#define FC_NFCB 10 /* Max # of opened files per system */ +#define FC_NCFILE 2 /* Max # of opened files per task */ +#define FC_NDNLC 0 /* Max # of cached directory entries */ +#define FC_MSDOS 1 /* MS-DOS volume mount flag */ +#define FC_CDROM 0 /* CD-ROM volume mount flag */ + +/*---------------------------------------------------------------------*/ +/* pREPC+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define LC_BUFSIZ 128 /* I/O buffer size */ +#define LC_NUMFILES 5 /* Max number of open files per task */ +#define LC_WAITOPT 0 /* Wait option for memory allocation */ +#define LC_TIMEOPT 0 /* Timeout option for mem allocation */ +#define LC_SSIZE 512 /* Size of print buffer */ + +/*---------------------------------------------------------------------*/ +/* pNA+ configuration parameters */ +/* */ +/* NOTE: If you get pNA+ errno 5F01 FAT_INSUFFMEM you may need to */ +/* decrease the number of buffers allocated here for pNA+. */ +/* In general this error means pNA+ could not allocate enough */ +/* memory from Region 0 for the number of buffers requested. */ +/*---------------------------------------------------------------------*/ +#define NC_NNI 5 /* size of pNA NI Table */ +#define NC_NROUTE 10 /* size of pNA Routing Table */ +#define NC_NARP 20 /* size of pNA ARP table */ +#define NC_DEFUID 0 /* Default User ID of a task */ +#define NC_DEFGID 0 /* Default Group ID of a task */ +#define NC_HOSTNAME "scg" /* Hostname of the node */ +#define NC_NHENTRY 8 /* Number of Host table entries */ + +#define NC_NMCSOCS 0 /* Number of IP multicast sockets */ +#define NC_NMCMEMB 0 /* Number of distict IP multicast */ + /* group memberships per interface */ + +#define NC_NNODEID 0 /* Network NODE ID for unnumbered link */ + +#define NC_NSOCKETS 128 /* Number of sockets in the system */ +#define NC_NDESCS 128 /* # of socket descriptors/task */ +#define NC_MBLKS 300 /* # of message blocks in the system */ + +#define NC_BUFS_0 64 /* number of 0 length buffers */ +#define NC_BUFS_32 0 /* number of 32 length buffers */ +#define NC_BUFS_64 0 /* number of 64 length buffers */ +#define NC_BUFS_128 256 /* number of 128 byte buffers */ +#define NC_BUFS_256 0 /* number of 256 byte buffers */ +#define NC_BUFS_512 0 /* number of 512 byte buffers */ +#define NC_BUFS_1024 16 /* number of 1k byte buffers */ +#define NC_BUFS_2048 48 /* number of 2k byte buffers */ +#define NC_BUFS_4096 0 /* number of 4k byte buffers */ + +#define NC_MAX_BUFS 9 /* max number of NC_BUFS types */ + +/*---------------------------------------------------------------------*/ +/* The following are examples for modifying the following defines */ +/* */ +/* Using a user written routine as a pNA+ Signal Handler */ +/* extern void MySigHandler (void); */ +/* #define NC_SIGNAL ((void (*)()) MySigHandler) */ +/* */ +/*---------------------------------------------------------------------*/ +#define NC_SIGNAL 0 /* pNA+ Signal Hdlr */ + +/*---------------------------------------------------------------------*/ +/* pSE+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define SE_NBUFS_0 64 /* number of 0 length buffers */ +#define SE_NBUFS_32 128 /* number of 32 byte buffers */ +#define SE_NBUFS_64 128 /* number of 64 byte buffers */ +#define SE_NBUFS_128 256 /* number of 128 byte buffers */ +#define SE_NBUFS_256 32 /* number of 256 byte buffers */ +#define SE_NBUFS_512 32 /* number of 512 byte buffers */ +#define SE_NBUFS_1024 16 /* number of 1k byte buffers */ +#define SE_NBUFS_2048 16 /* number of 2k byte buffers */ +#define SE_NBUFS_4096 8 /* number of 4k byte buffers */ +#define SE_MAX_BUFS 9 /* max number of stream buffer types */ + +#define SE_MAX_MODULES 3 /* max number of streams modules */ +#define SE_SHARE_NI NO /* LAN-NI with streams? */ + +#define SE_DATA_SIZE 0x0C00 /* size of pSE data area */ + /* (must be at least 3K) */ +#define SE_TASK_PRIO 250 /* priority for pSE task */ +#define SE_STACK_SIZE 0x2000 /* stack size for pSE task */ +#define SE_DEF_UID 0 /* default user id */ +#define SE_DEF_GID 0 /* default group id */ +#define SE_N_FDS 32 /* max # of system-wide */ + /* stream descriptors */ +#define SE_N_TASKFDS 8 /* max # of per-task stream */ + /* descriptors */ +#define SE_N_LINKS 32 /* max # of multiplexing links */ +#define SE_N_TIMEOUTS 32 /* max # of timeout requests */ +#define SE_N_BUFCALLS 32 /* max # of bufcall requests */ +#define SE_N_QUEUES 256 /* # of queues */ +#define SE_N_MBLKS 512 /* reserved for future use, must be 0 */ + +/*---------------------------------------------------------------------*/ +/* Loader configuration parameters */ +/* */ +/* YES indicates for each module to be linked in. NO means do not link */ +/* object module loader into this application. */ +/* */ +/*---------------------------------------------------------------------*/ +#define LD_MAX_LOAD 8 /* Max. # of active loads */ +#define LD_ELF_MODULE NO /* ELF object-load-module */ +#define LD_SREC_MODULE NO /* SREC object-load-module */ +#define LD_COFF_MODULE NO /* COFF object-load-module */ +#define LD_IEEE_MODULE NO /* IEEE object-load-module */ +#define LD_IHEX_MODULE NO /* IHEX object-load-module */ + +/*---------------------------------------------------------------------*/ +/* pMONT+ configuration parameters - note that PM_DEV and PM_BAUD are */ +/* only relevant to serial communication (PM_CMODE = 2) */ +/*---------------------------------------------------------------------*/ +#define PM_CMODE 1 /* 1 = networking, 2 = serial */ +#define PM_DEV 2 /* Minor Device number for */ + /* serial channel if used */ +#define PM_BAUD 9600 /* Baud rate for serial chnl */ +#define PM_TRACE_BUFF 0 /* Address of trace buffer -- */ + /* Allocated by pSOSystem if 0 */ +#define PM_TRACE_SIZE 0x6000 /* Size of trace buffer */ +#define PM_TIMER NO /* 2nd timer for finer time */ + /* within data collection */ + +/*---------------------------------------------------------------------*/ +/* General Serial Block Configuration Parameters */ +/*---------------------------------------------------------------------*/ +#define GS_BUFS_0 64 /* number of 0 length buffers */ +#define GS_BUFS_32 128 /* number of 32 byte buffers */ +#define GS_BUFS_64 128 /* number of 64 byte buffers */ +#define GS_BUFS_128 256 /* number of 128 byte buffers */ +#define GS_BUFS_256 32 /* number of 256 byte buffers */ +#define GS_BUFS_512 32 /* number of 512 byte buffers */ +#define GS_BUFS_1024 16 /* number of 1k byte buffers */ +#define GS_BUFS_2048 16 /* number of 2k byte buffers */ +#define GS_BUFS_4096 8 /* number of 4k byte buffers */ + +#define GS_MBLKS 680 +#define GS_MAX_BUFS 9 /* max number of serial buffer types */ + +/*---------------------------------------------------------------------*/ +/* TCP/IP for OpEN configuration parameters */ +/*---------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for the Network layer (IP) */ +/*---------------------------------------------------------------------*/ +#define OTCP_IPMAX 8 /* Max # of open IP device */ +#define OTCP_IPNINTERFACES 4 /* Max # of network interfaces */ +#define OTCP_IPNROUTES 64 /* Max #of routing tbl entries */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for ARP */ +/*---------------------------------------------------------------------*/ +#define OTCP_ARPMAX 8 /* Max # of open ARP device */ +#define OTCP_ARPNINTERFACES 4 /* Max # of ARP interfaces */ +#define OTCP_ARPNENTRIES 32 /* Max # of ARP table entries */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for TCP */ +/*---------------------------------------------------------------------*/ +#define OTCP_TCPMAX 64 /* Max # of open TCP device */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for UDP */ +/*---------------------------------------------------------------------*/ +#define OTCP_UDPMAX 32 /* Max # of open UDP device */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for RAW */ +/*---------------------------------------------------------------------*/ +#define OTCP_RAWMAX 32 /* Max # of open RAW device */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for LOOP */ +/*---------------------------------------------------------------------*/ +#define OTCP_LOOPMAX 2 /* Max # of open LOOP device */ + + + +#endif /* _SYS_CONF_H */ + +#if __cplusplus +} +#endif diff --git a/h/wrn/wm/util/port/isisnmp/x86250/drv_conf.h b/h/wrn/wm/util/port/isisnmp/x86250/drv_conf.h new file mode 100644 index 0000000..79999d8 --- /dev/null +++ b/h/wrn/wm/util/port/isisnmp/x86250/drv_conf.h @@ -0,0 +1,1267 @@ +/* @(#) pSOSystem x86/V2.5.0: apps/xxxx/drv_conf.c 4.30 (&U&) 99/05/19 13:16:14 */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/* [clearcase] +modification history +------------------- +*/ + +/***********************************************************************/ +/* */ +/* MODULE: drv_conf.c */ +/* DATE: 99/05/19 */ +/* PURPOSE: pSOSystem driver configuration and initialization */ +/* */ +/* These are the functions in this file: */ +/* */ +/* SetUpDrivers to setup drivers except for Network drivers*/ +/* DrvSysStartCO to setup Initial Device Name Table */ +/* SetUpNI to setup Network drivers */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* Copyright 1991 - 1999, Integrated Systems, Inc. */ +/* ALL RIGHTS RESERVED */ +/* */ +/* Permission is hereby granted to licensees of Integrated Systems, */ +/* Inc. products to use or abstract this computer program for the */ +/* sole purpose of implementing a product based on Integrated */ +/* Systems, Inc. products. No other rights to reproduce, use, */ +/* or disseminate this computer program, whether in part or in */ +/* whole, are granted. */ +/* */ +/* Integrated Systems, Inc. makes no representation or warranties */ +/* with respect to the performance of this computer program, and */ +/* specifically disclaims any responsibility for any damages, */ +/* special or consequential, connected with the use of this program. */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* */ +/* */ +/***********************************************************************/ +#include "sys_conf.h" +#include "bsp.h" +#include +#include +#include +#include + +#if SC_DEV_SPI + #include "spi.h" +#endif + +#if (SC_PSE) +#include +#include +#endif + +#if (SC_DEV_DLPI) +#include +#endif + +#if (SC_DEV_NULL) +extern void NullDevInit(struct ioparms *); +extern void NullDevRead(struct ioparms *); +extern void NullDevWrite(struct ioparms *); +extern void NullDevCntrl(struct ioparms *); +#endif + +#define NULLF (ULONG) ((void (*)()) 0) + +#if (SC_PNA || SC_PNET) +static const char RarpErrTimeout[] = + "RARP request failed: Check for a RARP server"; +static const char RarpErrNet[] = + "RARP request failed: Network Error"; +#endif + +#if (SC_DEV_TFTP || SC_DEV_NTFTP) +ULONG NumTftpChans = SC_MAX_TFTP_CHAN; +#endif + +#if (SC_DEV_HTTP) +ULONG NumHttpChans = SC_MAX_HTTP_CHAN; +#endif + +#if (SC_DEV_PIPE) +unsigned long NumPipeChans = SC_MAX_PIPE_CHAN; +#endif + +#if (SC_DEV_PSCONSOLE) +ULONG NumPsConsoleSharedChan = SC_PSCNSL_SHARED_CHAN; +ULONG NumPsConsolePrivateChan = SC_PSCNSL_PRIVATE_CHAN; +ULONG NumPsConsoleCustomModule = SC_PSCNSL_MAX_CUSTOM; +#endif + +#if (defined(BSP_NEW_SERIAL) && !(BSP_NEW_SERIAL) && (BSP_SERIAL)) +extern UCHAR *CnslSetup(UCHAR *FreeMem, ULONG defbaud, USHORT defcons); +#endif + +#if SC_PSOS || SC_PSOSM +/***********************************************************************/ +/* SetUpDrivers: installs drivers in PsosIO table via a call to */ +/* InstallDriver and then calls driver setup function if */ +/* needed. NOTE: If the driver is to be part of the */ +/* Network Interface then it should be placed in the */ +/* SetUpNI function. */ +/* */ +/* INPUT: FreeMemPtr = A pointer to unused memory that can be */ +/* used to allocate space for a driver. */ +/* NOTE: Be sure to advance FreeMemPtr if */ +/* memory is allocates! */ +/* */ +/* RETURNS: The new address of free memory after the drivers have */ +/* allocated space. */ +/* */ +/* NOTE: This function does many precompile checks so errors */ +/* can be found during compile-time rather then at run- */ +/* time. */ +/* */ +/* To add a non-Network driver to pSOSystem, call InstallDriver(). */ +/* This adds a device driver to the PsosIO table. InstallDriver() */ +/* takes the following arguments: */ +/* */ +/* unsigned short major_number device major number */ +/* void (*dev_init)() device init procedure */ +/* void (*dev_open)() device open procedure */ +/* void (*dev_close)() device close procedure */ +/* void (*dev_read)() device read procedure */ +/* void (*dev_write)() device write procedure */ +/* void (*dev_ioctl)() device control procedure */ +/* unsigned long dev_param Used for STREAMS modules */ +/* unsigned short rsvd2 reserved */ +/* unsigned short flags If set to IO_AUTOINIT pSOS will */ +/* automatically call the */ +/* drivers initialization */ +/* function. The SC_AUTOINIT */ +/* #define which is set in */ +/* sys_conf.h can be used to set */ +/* this element. */ +/* */ +/* InstallDriver() does not return a value. InstallDriver() assumes */ +/* SC_DEVMAX is defined in sys_conf.h and is useful only before pSOS+ */ +/* has been initialized. */ +/* */ +/* If you are adding a driver that needs to be initialized before */ +/* either pSOS+ is initialized or the driver's init function is */ +/* called, then you can call a setup function (that you create) for */ +/* the driver. If your initialization function needs to allocate */ +/* memory, you may pass it the FreeMemPtr. The function should return */ +/* a new FreeMemPtr which points to the end of the memory it has */ +/* allocated. */ +/* */ +/* When adding code to install a new driver, it is a good idea to add */ +/* precompile checks so errors can be found during compile-time rather */ +/* then at run-time. Precompile checks are used, for example, in the */ +/* code that installs the pSOSystem serial device driver below. */ +/* */ +/***********************************************************************/ +UCHAR *SetUpDrivers(UCHAR *FreeMemPtr) +{ +extern ULONG PsosNumDntEnts; + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem serial device driver. */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SERIAL && BSP_SERIAL && BSP_NEW_SERIAL) + #if(SC_DEV_SERIAL > SC_DEVMAX) + #error "SC_DEV_SERIAL cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SERIAL, TermInit, TermOpen, TermClose,TermRead, + TermWrite, TermIoctl, 0, 0, IO_CHAR_DEV | SC_AUTOINIT); + PsosNumDntEnts++; + +/*---------------------------------------------------------------------*/ +/* This section is provided for backward compatibility only. */ +/* It will be removed completely in the next version of pSOSystem. */ +/*---------------------------------------------------------------------*/ +#elif (SC_DEV_SERIAL && BSP_SERIAL) + #if(SC_DEV_SERIAL > SC_DEVMAX) + #error "SC_DEV_SERIAL cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SERIAL, CnslInit, NULLF, NULLF,CnslRead, + CnslWrite, CnslCntrl, 0, 0, IO_CHAR_DEV | SC_AUTOINIT); + FreeMemPtr = CnslSetup(FreeMemPtr, SysVars.DefBaud, SC_APP_CONSOLE); + PsosNumDntEnts++; + +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSEUDO console driver */ +/*---------------------------------------------------------------------*/ +#if (DEV_PSCONSOLE) + InstallDriver(SC_DEV_PSCONSOLE, NULLF, PsConsoleOpen, + PsConsoleClose, PsConsoleRead, PsConsoleWrite, + PsConsoleCntrl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts +=4; +#endif + +/*--------------------------------------------------------------------*/ +/* Install the Memory Log driver. */ +/*--------------------------------------------------------------------*/ +#if SC_DEV_MEMLOG + InstallDriver(SC_DEV_MEMLOG, MemLogInit, NULLF, + NULLF, MemLogRead, MemLogWrite, + MemLogCntrl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*--------------------------------------------------------------------*/ +/* Install the Memory pROBE+ Remote debugger driver (RDIO). */ +/*--------------------------------------------------------------------*/ +#if SC_DEV_RDIO + InstallDriver(SC_DEV_RDIO, NULLF, NULLF, + NULLF, RdioRead, RdioWrite, + 0, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*--------------------------------------------------------------------*/ +/* Setup pSOSystem PC console device driver */ +/*--------------------------------------------------------------------*/ +#if (SC_DEV_CONSOLE && BSP_CONSOLE) + #if (SC_DEV_CONSOLE >SC_DEVMAX) + #error "SC_DEV_CONSOLE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_CONSOLE, PcCnslInit, NULLF, NULLF, + PcCnslRead, PcCnslWrite, PcCnslCntrl, 0, 0, + IO_CHAR_DEV | SC_AUTOINIT); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* For pSOSim only - Install the pSOSim Console driver */ +/*---------------------------------------------------------------------*/ +#if (DEV_SIMCONSOLE) + #if(SC_DEV_SIMCONSOLE > SC_DEVMAX) + #error "SC_DEV_SIMCONSOLE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SIMCONSOLE, SimConsoleInit, NULLF, + NULLF, SimConsoleRead, SimConsoleWrite, + 0, 0, 0, IO_CHAR_DEV | SC_AUTOINIT); + PsosNumDntEnts ++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem tick timer. */ +/*---------------------------------------------------------------------*/ +#if SC_DEV_TIMER + #if(SC_DEV_TIMER > SC_DEVMAX) + #error "SC_DEV_TIMER cannot be > SC_DEVMAX" + #endif + #if (!SC_PSOS && !SC_PSOSM) + #error "Must have pSOS+ or pSOS+m in system to use tick timer!" + #endif + InstallDriver(SC_DEV_TIMER, RtcInit, NULLF, NULLF, NULLF, NULLF, + NULLF, 0, 0, IO_CHAR_DEV | SC_AUTOINIT); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install DevNull driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_NULL) + InstallDriver(SC_DEV_NULL, NullDevInit, NULLF, NULLF,NullDevRead, + NullDevWrite, NullDevCntrl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem ramdisk driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if SC_DEV_RAMDISK + #if(SC_DEV_RAMDISK > SC_DEVMAX) + #error "SC_DEV_RAMDISK cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_RAMDISK, RdskInit, RdskOpen, RdskClose, RdskRead, + RdskWrite, RdskCntrl, 0, 0, IO_BLOCK_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem PIPE driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization feature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if SC_DEV_PIPE + #if(SC_DEV_PIPE > SC_DEVMAX) + #error "SC_DEV_PIPE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_PIPE, PipeInit, PipeOpen, PipeClose, PipeRead, + PipeWrite, PipeCntl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem SCSI driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SCSI && BSP_SCSI) + #if(SC_DEV_SCSI > SC_DEVMAX) + #error "SC_DEV_SCSI cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SCSI, SdrvInit, SdskOpen, SdskClose, SdskRead, + SdskWrite, SdrvCntrl, 0, 0, IO_BLOCK_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem SCSI Tape driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SCSI_TAPE && BSP_SCSI_TAPE) + #if(SC_DEV_SCSI_TAPE > SC_DEVMAX) + #error "SC_DEV_SCSI_TAPE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SCSI_TAPE, SdrvInit, StapeOpen, StapeClose, + StapeRead, StapeWrite, SdrvCntrl, 0, 0, IO_BLOCK_DEV); + + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem CMOS clock driver */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_CMOS && BSP_CLOCK) + #if (SC_DEV_CMOS >SC_DEVMAX) + #error "SC_DEV_CMOS cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_CMOS, NULLF, NULLF, NULLF, CmcRead, + CmcWrite, NULLF, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem printer driver */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_PARALLEL && BSP_PARALLEL) + #if (SC_DEV_PARALLEL >SC_DEVMAX) + #error "SC_DEV_PARALLEL cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_PARALLEL, ParInit, ParOpen, ParClose, NULLF, + ParWrite, ParCntrl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem floppy diskette driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_FLOPPY && BSP_FLOPPY) + #if (SC_DEV_FLOPPY >SC_DEVMAX) + #error "SC_DEV_FLOPPY cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_FLOPPY, FlpInit, NULLF, NULLF, FlpRead, + FlpWrite, FlpCntrl, 0, 0, IO_BLOCK_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Setup pSOSystem IDE disk driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_IDE && BSP_IDE) + #if (SC_DEV_IDE >SC_DEVMAX) + #error "SC_DEV_IDE cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_IDE, IDEInit, NULLF, NULLF, IDERead, + IDEWrite, IDECntrl, 0, 0, IO_BLOCK_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem TFTP driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_TFTP) + #if(SC_DEV_TFTP > SC_DEVMAX) + #error "SC_DEV_TFTP cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_TFTP, TftpInit, TftpOpen, TftpClose, TftpRead, + NULLF, TftpCntl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem New TFTP driver that follows the new interface*/ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_NTFTP) + #if(SC_DEV_NTFTP > SC_DEVMAX) + #error "SC_DEV_NTFTP cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_NTFTP, TftpInit, StdTftpOpen, TftpClose, TftpRead, + NULLF, TftpCntl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem HTTP driver. */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_HTTP) + #if(SC_DEV_HTTP > SC_DEVMAX) + #error "SC_DEV_HTTP cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_HTTP, HttpInit, HttpOpen, HttpClose, HttpRead, + NULLF, HttpCntl, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install the SPI driver */ +/* NOTE: This driver must be called from a task it cannot use the */ +/* auto initialization freature of pSOS+ */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SPI) + #if(SC_DEV_SPI > SC_DEVMAX) + #error "SC_DEV_SPI cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_SPI, SPI_init, SPI_open, SPI_close, NULLF, + NULLF, SPI_io, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +/*---------------------------------------------------------------------*/ +/* Install DLPI drivers */ +/*---------------------------------------------------------------------*/ + +#if (SC_DEV_DLPI || SC_DEV_PPP || SC_DEV_SLIP) + { +#include "enetcfg.h" + +int dlpi_setinitroutine = 0; +int dlpi_nicount = 0; /* number of ni's below this DLPI */ +void (*init_fn)(); /* Ethernet driver initialization routine */ + /* Call this function only once */ +char *DlpiErrMsg = "DlpiAddNI failed: NI Error"; + +#if (SC_DEV_DLPI) + { + #if(SC_DEV_DLPI> SC_DEVMAX) + #error "SC_DEV_DLPI cannot be > SC_DEVMAX" + #endif + static const psedrvparam_t eth0param = {"eth0", DT_CLONE, &enetinfo, 0, 0}; + init_fn = NULLF; + if (!dlpi_setinitroutine) + { + init_fn = (void (*)())enetinit; + dlpi_setinitroutine = 1; + } + InstallDriver(SC_DEV_DLPI, init_fn, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)ð0param, 0, IO_STREAM_DEV); + dlpi_nicount++; + PsosNumDntEnts++; + } +#endif /* SC_DEV_DLPI */ + +#if SC_DEV_DLPI_PPP + { + #if(SC_DEV_DLPI_PPP > SC_DEVMAX) + #error "SC_DEV_DLPI_PPP cannot be > SC_DEVMAX" + #endif + static const psedrvparam_t pppparam = {"ppp", DT_CLONE, &enetinfo, 0, 0}; + init_fn = NULLF; + if (!dlpi_setinitroutine) + { + init_fn = (void (*)())enetinit; + dlpi_setinitroutine = 1; + } + InstallDriver(SC_DEV_DLPI_PPP, init_fn, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&pppparam, 0, IO_STREAM_DEV); + dlpi_nicount++; + PsosNumDntEnts++; + } +#endif /* SC_DEV_DLPI_PPP */ + +#if SC_DEV_DLPI_SLIP + { + #if(SC_DEV_DLPI_SLIP > SC_DEVMAX) + #error "SC_DEV_DLPI_SLIP cannot be > SC_DEVMAX" + #endif + static const psedrvparam_t slipparam = {"slip", DT_CLONE, &enetinfo, 0, 0}; + init_fn = NULLF; + if (!dlpi_setinitroutine) + { + init_fn = (void (*)())enetinit; + dlpi_setinitroutine = 1; + } + InstallDriver(SC_DEV_DLPI_SLIP, init_fn, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&slipparam, 0, IO_STREAM_DEV); + dlpi_nicount++; + PsosNumDntEnts++; + } +#endif /* SC_DEV_DLPI_SLIP */ + +/* + * User has defined other DLPI drivers locally. Include user + * file drv_conf.idl that installs user's own ENETDLPI drivers + */ +#if SC_DEV_DLPI_OTHER +#include "drv_conf.idl" +#endif + + /*-------------------------------------------------------------*/ + /* Call DlpiInit to initialize the Streams DLPI driver */ + /* Arguments passed to DlpiInit are: */ + /* 1. Free memory address */ + /* 2. Maximum NI interface number */ + /* 3. Maximum number of streams per interface */ + /*-------------------------------------------------------------*/ + FreeMemPtr = DlpiInit(FreeMemPtr, dlpi_nicount, SE_DLPI_MAXSTR_PERNI); + + /*-------------------------------------------------------------*/ + /* Call DlpiAddNI to add an NI interface to the Streams DLPI */ + /* driver. DlpiAddNI must be called for each NI driver */ + /* interface used with the Streams DLPI driver. */ + /* Arguments passed to DlpiAddNI are: */ + /* 1. NI interface number (should correspond to the pNA+ */ + /* interface number if driver is shared with pNA+) */ + /* 2. NI entry point */ + /* 3. NI flags */ + /* DLPI_IFF_SELFLOOP 0x0001 loopback for selfaddress */ + /* DLPI_IFF_POLL_NI 0x0002 driver must be polled */ + /* DLPI_IFF_RAWMEM 0x2000 driver accepts mblk */ + /* DLPI_IFF_NONIINIT 0x4000 Don't send NI_INIT */ + /* during enetinit() call */ + /* 4. NI major device number */ + /* 5. NI multicast address (NOT SUPPORTED) */ + /* 6. NI poll frequency (every # of elapsed ticks) */ + /*-------------------------------------------------------------*/ + +#if (SC_DEV_DLPI) + /* + * If this lan NI is not shared, use a loopback DLPI with interface + * number 0. NI entry point is set to DlpiNullNI(). + */ +#if (SE_SHARE_NI) + if (DlpiAddNI(SE_DLPI_ETH_IFNO, (long(*)())BSP_LAN1_ENTRY, + SE_DLPI_ETH_IFFLAGS, SC_DEV_DLPI, 0, SE_DLPI_ETH_POLLFREQ)) + SysInitFail(DlpiErrMsg); +#else + if (DlpiAddNI(0, (long(*)())DlpiNullNI, 0, SC_DEV_DLPI, 0, 0)) + SysInitFail(DlpiErrMsg); +#endif /* SE_SHARE_NI */ + +#endif /* SC_DEV_DLPI */ + +#if (SC_DEV_DLPI_PPP) + if (DlpiAddNI(SE_DLPI_PPP_IFNO, SE_DLPI_PPP_ENTRY, SE_DLPI_PPP_IFFLAGS, + SC_DEV_DLPI_PPP, 0, SE_DLPI_PPP_POLLFREQ)) + SysInitFail(DlpiErrMsg); + if (DlpiAddParams(SE_DLPI_PPP_IFNO, SE_DLPI_PPP_ADDRSIZE, + SE_DLPI_PPP_MAXMTU, SE_DLPI_PPP_MINMTU, (char *)NULL)) + SysInitFail(DlpiErrMsg); +#endif /* SC_DEV_DLPI_PPP */ + +#if (SC_DEV_DLPI_SLIP) + if (DlpiAddNI(SE_DLPI_SLIP_IFNO,SE_DLPI_SLIP_ENTRY, SE_DLPI_SLIP_IFFLAGS, + SC_DEV_DLPI_SLIP, 0, SE_DLPI_SLIP_POLLFREQ)) + SysInitFail(DlpiErrMsg); + if (DlpiAddParams(SE_DLPI_SLIP_IFNO, SE_DLPI_SLIP_ADDRSIZE, + SE_DLPI_SLIP_MAXMTU, SE_DLPI_SLIP_MINMTU, (char *)NULL)) + SysInitFail(DlpiErrMsg); +#endif /* SC_DEV_DLPI_SLIP */ + +/* + * User has defined other DLPI drivers locally. Include user + * file drv_conf.adl that adds user Dlpi drivers to the system. + */ +#if SC_DEV_DLPI_OTHER +#include "drv_conf.adl" +#endif + + } +#endif /* (SC_DEV_DLPI || SC_DEV_PPP || SC_DEV_SLIP) */ + +#if (SC_DEV_LOG) + { + extern void loginit(); + extern struct streamtab loginfo; + static const psedrvparam_t log_drv = {"log", DT_DRIVER|DS_SVR4_STYLE, + &loginfo, 0, 0}; + + InstallDriver(SC_DEV_LOG, loginit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&log_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; + } +#endif + +/*-------------------------------------------------------------------*/ +/* Install pSOSystem Watchdog driver */ +/*-------------------------------------------------------------------*/ +#if (SC_DEV_WATCHDOG) + #if(SC_DEV_WATCHDOG > SC_DEVMAX) + #error "SC_DEV_WATCHDOG cannot be > SC_DEVMAX" + #endif + InstallDriver(SC_DEV_WATCHDOG, WdtInit, NULLF, NULLF, NULLF, + NULLF, NULLF, 0, 0, IO_CHAR_DEV); + PsosNumDntEnts++; +#endif + +#if (SC_DEV_OTCP) + { +extern void otcp_ipspace_init(), otcp_arpspace_init(), otcp_rawspace_init(), + otcp_udpspace_init(), otcp_tcpspace_init(), otcp_loopspace_init(); +extern struct streamtab otcp_ipinfo, otcp_arpinfo, otcp_rawinfo, otcp_udpinfo, + otcp_tcpinfo, otcp_loopinfo; + +#if (SC_IP) + static const psedrvparam_t ip_drv = {"ip", DT_CLONE, &otcp_ipinfo, 0, 0}; +#endif +#if (SC_ARP) + static const psedrvparam_t arp_drv = {"arp", DT_CLONE, &otcp_arpinfo, 0, 0}; +#endif +#if (SC_TCP) + static const psedrvparam_t tcp_drv = {"tcp", DT_CLONE, &otcp_tcpinfo, 0, 0}; +#endif +#if (SC_UDP) + static const psedrvparam_t udp_drv = {"udp", DT_CLONE, &otcp_udpinfo, 0, 0}; +#endif +#if (SC_RAW) + static const psedrvparam_t raw_drv = {"raw", DT_CLONE, &otcp_rawinfo, 0, 0}; +#endif +#if (SC_LOOP) + static const psedrvparam_t loop_drv = {"loop", DT_CLONE, &otcp_loopinfo, 0, 0}; +#endif + +#if (SC_IP) + InstallDriver(SC_IP, otcp_ipspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&ip_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_ARP) + InstallDriver(SC_ARP, otcp_arpspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&arp_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_RAW) + InstallDriver(SC_RAW, otcp_rawspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&raw_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_UDP) + InstallDriver(SC_UDP, otcp_udpspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&udp_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_TCP) + InstallDriver(SC_TCP, otcp_tcpspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&tcp_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_LOOP) + InstallDriver(SC_LOOP, otcp_loopspace_init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&loop_drv, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif + + } +#endif /* (SC_DEV_OTCP) */ + +#if (SC_DEV_OLAP) + { + extern struct streamtab phpiinfo, twfrinfo ; + extern void phpiinit(), twfrinit(); +#if (SC_PHPI) + static const psedrvparam_t phpiparam={"phpi",DT_CLONE,&phpiinfo, 0, 0}; +#endif +#if (SC_LAPB) + static const psedrvparam_t lapbparam ={"lapb", DT_REGULAR,&twfrinfo,0, 0}; +#endif + +#if (SC_PHPI) + InstallDriver(SC_PHPI, phpiinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&phpiparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_LAPB) + InstallDriver(SC_LAPB, twfrinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&lapbparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif + } +#endif + +#if (SC_DEV_OX25) + { + extern struct streamtab phpiinfo, twfrinfo, twpkinfo, twsninfo, ipconvinfo; + extern void twpkinit(), twsninit(), tcpsninit(); +#if (SC_X25) + static const psedrvparam_t x25param ={"x25", DT_DRIVER, &twpkinfo, 0, 0}; +#endif +#if (SC_SNDCF) + static const psedrvparam_t sndfparam ={"sndf", DT_REGULAR, &twsninfo, 0, 0}; +#endif +#if (SC_IPCONV) + static const psedrvparam_t ipconvparam={"ipsn",DT_REGULAR, &ipconvinfo, 0, 0}; +#endif + +#if (SC_X25) + InstallDriver(SC_X25, twpkinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&x25param, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_SNDCF) + InstallDriver(SC_SNDCF, twsninit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&sndfparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_IPCONV) + InstallDriver(SC_IPCONV, tcpsninit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&ipconvparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif + } +#endif + +#if (SC_DEV_ISDN) + { + extern struct streamtab phinfo, q921info, ipcdinfo ; + extern void q921init(), phinit(); + +#if (SC_PH) + static const psedrvparam_t phpiparam={"ph",DT_REGULAR,&phinfo, 0, 0}; +#endif +#if (SC_LAPD) + static const psedrvparam_t lapbparam={"q921",DT_REGULAR,&q921info,0,0}; +#endif +#if (SC_IPCD) + static const psedrvparam_t ipcdparam={"ipcd",DT_REGULAR,&ipcdinfo,0,0}; +#endif + +#if (SC_PH) + InstallDriver(SC_PH, phinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&phpiparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_LAPD) + InstallDriver(SC_LAPD, q921init, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&lapbparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_IPCD) + InstallDriver(SC_IPCD, NULLF, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&ipcdparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif + } +#endif + +#if (SC_DEV_MLPP) + { + extern struct streamtab frmuxtab, pppstream, Spimtab; + extern void frmuxinit(); + +#if (SC_FRMUX) + static const psedrvparam_t fmuxparam ={"cfmux",DT_REGULAR,&frmuxtab,0,0}; +#endif +#if (SC_PPP) + static const psedrvparam_t pppparam ={"cppp",DT_REGULAR,&pppstream,0,0}; +#endif +#if (SC_PIM) + static const psedrvparam_t pimparam ={"cpim",DT_REGULAR,&Spimtab,0,0}; +#endif + +#if (SC_FRMUX) + InstallDriver(SC_FRMUX, frmuxinit, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&fmuxparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_PPP) + InstallDriver(SC_PPP, NULLF, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&pppparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif +#if (SC_PIM) + InstallDriver(SC_PIM, NULLF, NULLF, NULLF, NULLF, + NULLF, NULLF, (long)&pimparam, 0, IO_STREAM_DEV); + PsosNumDntEnts++; +#endif + } +#endif + +#if defined(SC_DEV_PSMUX) && SC_DEV_PSMUX +#include "drv_conf.app" +#endif + +/*---------------------------------------------------------------------*/ +/* Additional drivers may be installed here. */ +/*---------------------------------------------------------------------*/ + +return FreeMemPtr; +} + +/***********************************************************************/ +/* DrvSysStartCO : This is called from sysinit.c "SysStartCO". */ +/* */ +/* INPUTS: None */ +/* */ +/* RETURNS: None */ +/* OUTPUTS: None */ +/* NOTE(S): Currently used to set-up the Initial Device Name Table */ +/* Additional code can be added here to clean-up the */ +/* driver specific data area. */ +/* */ +/***********************************************************************/ +void DrvSysStartCO() +{ + +/*---------------------------------------------------------------------*/ +/* Following are the call-outs which will be called. If your driver */ +/* needs pSOS+ "GS" (Warm Startup) notification to clear your driver */ +/* data structures, register here, so that it will be called. */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_SERIAL && BSP_SERIAL) + DevSerialCO(); +#endif + +#if (SC_DEV_CONSOLE && BSP_CONSOLE) + DevPCConsoleCO(); +#endif + +/*---------------------------------------------------------------------*/ +/* Default CONSOLE is passed as the DEFAULT CONSOLE for Re-Direction */ +/* CONSOLE can be either DEV_CONSOLE or DEV_SERIAL. */ +/*---------------------------------------------------------------------*/ +#if SC_DEV_PSCONSOLE + PsConsoleSysStartCo(SC_PSCNSL_DEFAULT_DEV, SC_PSCNSL_DEFAULT_DEV); +#endif + +#if SC_DEV_RDIO + RdioSysStartCo(); +#endif + +#if SC_DEV_SCSI && BSP_SCSI + DevScsiCO(); +#endif + +#if SC_DEV_SCSI_TAPE && BSP_SCSI_TAPE + DevScsiCO(); +#endif + +#if SC_DEV_IDE && BSP_IDE + DevIdeCO(); +#endif + +#if SC_DEV_PARALLEL + DevParallelCO(); +#endif + +#if SC_DEV_FLOPPY && BSP_FLOPPY + DevFloppyCO(); +#endif + +#if (SC_DEV_TFTP || SC_DEV_NTFTP) + DevTftpCO(); +#endif + +#if SC_DEV_HTTP + DevHttpCO(); +#endif + +#if SC_DEV_PIPE + DevPipeCO(); +#endif + +/*---------------------------------------------------------------------*/ +/* This code is used to build the initial table of device names used */ +/* in the pSOSystem. */ +/*---------------------------------------------------------------------*/ +/*-----------------------------------------------------------------*/ +/* Make one name for the entrie pSOSystem Serial channels. */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_SERIAL && BSP_SERIAL) + dnt_add("tty", DEV_SERIAL); +#endif /* SC_DEV_SERIAL */ + +/*-----------------------------------------------------------------*/ +/* Make one name for the PC Console Driver. (PC-Monitor). */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_CONSOLE && BSP_CONSOLE) + dnt_add("pcconsole", DEV_CONSOLE); +#endif + +/*-----------------------------------------------------------------*/ +/* pSOSim Console driver */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_SIMCONSOLE + dnt_add("simconsole", DEV_SIMCONSOLE); +#endif + +/*-----------------------------------------------------------------*/ +/* Null Driver. */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_NULL + dnt_add("null", DEV_NULL); +#endif + +/*-----------------------------------------------------------------*/ +/* There is only one timer in the system. Make a name for it. */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_TIMER + dnt_add("timer", DEV_TIMER); +#endif /* SC_DEV_TIMER */ + +/*-----------------------------------------------------------------*/ +/* Add DNT entries for all pSEUDO console minor devices */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_PSCONSOLE + dnt_add("psconsole", DEV_PSCONSOLE + SYSCONSOLE_DEV); + dnt_add("stdin", DEV_PSCONSOLE + STDIN_DEV); + dnt_add("stdout", DEV_PSCONSOLE + STDOUT_DEV); + dnt_add("stderr", DEV_PSCONSOLE + STDERR_DEV); +#endif + +#if SC_DEV_MEMLOG + dnt_add("memlog", DEV_MEMLOG); +#endif + +#if SC_DEV_RDIO + dnt_add("rdio", DEV_RDIO); +#endif + + +/*-----------------------------------------------------------------*/ +/* Add the name for the RAMDISK driver as "ramdisk". */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_RAMDISK + dnt_add("ramdisk", DEV_RAMDISK); +#endif /* SC_DEV_RAMDISK */ + +/*-----------------------------------------------------------------*/ +/* Add the name for the PIPE drivers as "pipe". */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_PIPE + dnt_add("pipe", DEV_PIPE); +#endif /* SC_DEV_PIPE */ + +/*-----------------------------------------------------------------*/ +/* Add the name for the SCSI driver as "scsi". */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_SCSI && BSP_SCSI) + dnt_add("scsi", DEV_SCSI); +#endif /* SC_DEV_SCSI && BSP_SCSI */ + +/*-----------------------------------------------------------------*/ +/* Add the name for the SCSI-TAPE driver as "tape". */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_SCSI_TAPE && BSP_SCSI_TAPE) + dnt_add("tape", DEV_SCSI_TAPE); +#endif /* SC_DEV_SCSI_TAPE && BSP_SCSI_TAPE */ + +/*-----------------------------------------------------------------*/ +/* Add the name for the IDE driver as "ide". */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_IDE && BSP_IDE) + dnt_add("ide", DEV_IDE); +#endif /* SC_DEV_IDE && BSP_IDE */ + +/*-----------------------------------------------------------------*/ +/* There is only one parallel driver in the system. Make a name */ +/* for it. */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_PARALLEL + dnt_add("printer", DEV_PARALLEL); +#endif /* SC_DEV_PARALLEL */ + +/*-----------------------------------------------------------------*/ +/* Add the name for the floppy driver in the system. */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_FLOPPY && BSP_FLOPPY) + dnt_add("floppy", DEV_FLOPPY); +#endif /* SC_DEV_FLOPPY */ + +/*-----------------------------------------------------------------*/ +/* There is only one watchdog driver in the system. Make a name */ +/* for it. */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_WATCHDOG + dnt_add("watchdog", DEV_WATCHDOG); +#endif /* SC_DEV_WATCHDOG */ + +/*-----------------------------------------------------------------*/ +/* There is only one cmos driver in the system. Make a name for it.*/ +/*-----------------------------------------------------------------*/ +#if SC_DEV_CMOS + dnt_add("cmos", DEV_CMOS); +#endif /* SC_DEV_CMOS */ + +/*-----------------------------------------------------------------*/ +/* Make the name for TFTP driver as "tftp". */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_TFTP) + dnt_add("tftp", DEV_TFTP); +#endif /* SC_DEV_TFTP */ + +/*-----------------------------------------------------------------*/ +/* Make the name for NTFTP driver as "ntftp". */ +/*-----------------------------------------------------------------*/ +#if (SC_DEV_NTFTP) + dnt_add("ntftp", DEV_NTFTP); +#endif /* SC_DEV_NTFTP */ + +/*-----------------------------------------------------------------*/ +/* Make default name for the HTTP pseudo device. */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_HTTP + dnt_add("http" , DEV_HTTP); +#endif /* SC_DEV_HTTP */ + +#if (SC_DEV_DLPI || SC_DEV_PPP || SC_DEV_SLIP) +/*-----------------------------------------------------------------*/ +/* There is only one enetdlpi driver in the system. */ +/* Make a name for it. */ +/*-----------------------------------------------------------------*/ +#if SC_DEV_DLPI + dnt_add("dlpi", DEV_DLPI); +#endif /* SC_DEV_DLPI */ + +/*-----------------------------------------------------------------*/ +/* There is only one enetslip driver in the system. Make a name for it.*/ +/*-----------------------------------------------------------------*/ +#if SC_DEV_DLPI_SLIP + dnt_add("dlslip", DEV_DLPI_SLIP); +#endif /* SC_DEV_DLPI_SLIP */ + +/*-----------------------------------------------------------------*/ +/* There is only one enetppp driver in the system. Make a name for it.*/ +/*-----------------------------------------------------------------*/ +#if SC_DEV_DLPI_PPP + dnt_add("dlppp", DEV_DLPI_PPP); +#endif /* SC_DEV_DLPI_PPP */ + +#endif + +#if (SC_DEV_LOG) + dnt_add("log", DEV_LOG); +#endif + +#if (SC_DEV_OTCP) + +#if (SC_IP) + dnt_add("ip", DEV_IP); +#endif +#if (SC_ARP) + dnt_add("arp", DEV_ARP); +#endif +#if (SC_TCP) + dnt_add("tcp", DEV_TCP); +#endif +#if (SC_UDP) + dnt_add("udp", DEV_UDP); +#endif +#if (SC_RAW) + dnt_add("raw", DEV_RAW); +#endif +#if (SC_LOOP) + dnt_add("loop", DEV_LOOP); +#endif + +#endif + + +#if (SC_DEV_OLAP) + +#if (SC_PHPI) + dnt_add("phpi", DEV_PHPI); +#endif + +#if (SC_LAPB) + dnt_add("lapb", DEV_LAPB); +#endif + +#endif + +#if (SC_DEV_OX25) + +#if (SC_X25) + dnt_add("x25", DEV_X25); +#endif + +#if (SC_SNDCF) + dnt_add("sndcf", DEV_SNDCF); +#endif + +#if (SC_IPCONV) + dnt_add("ipconv", DEV_IPCONV); +#endif + +#endif + +#if (SC_DEV_ISDN) + +#if (SC_PH) + dnt_add("ph", DEV_PH); +#endif + +#if (SC_LAPD) + dnt_add("q921", DEV_LAPD); +#endif + +#if (SC_IPCD) + dnt_add("ipcd", DEV_IPCD); +#endif + +#endif + +#if (SC_DEV_MLPP) + +#if (SC_FRMUX) + dnt_add("cfmux", DEV_FRMUX); +#endif + +#if (SC_PIM) + dnt_add("cpim", DEV_PIM); +#endif + +#if (SC_PPP) + dnt_add("cppp", DEV_PPP); +#endif + +#endif +/*-----------------------------------------------------------------*/ +/* Names for additional drivers may be added here. */ +/*-----------------------------------------------------------------*/ + +} +#endif /* SC_PSOS || SC_PSOSM */ + +#if (SC_PNA || SC_PNET) +/***********************************************************************/ +/* SetUpNI: Set up Network Interfaces for pNA+ */ +/* */ +/* INPUT: FreeMemPtr = A pointer to unused memory that can be */ +/* used to allocate space for a driver. */ +/* NOTE: Be sure to advance FreeMemPtr if */ +/* memory is allocates! */ +/* */ +/* RETURNS: The new address of free memory after the drivers have */ +/* allocated space. */ +/* */ +/* NOTES: This function does many precompile checks so errors */ +/* can be found during compile-time rather then at run- */ +/* time. */ +/* */ +/* Also, the Network Interface Table must be allocated */ +/* before this function can be called. There cannot be */ +/* more then NC_NNI entries in this table. NC_NNI is set */ +/* in sys_conf.h. Before adding another interface, be */ +/* sure to check sys_conf.h to see if NC_NNI is set to */ +/* accommodate another one! */ +/* */ +/* See the pSOSystem Programmers Reference Manual */ +/* for more information. */ +/* */ +/* To add a Network driver to pSOSystem, call InstallNi(). This adds */ +/* the Network Interface to the pNA+ Network Interface Table. */ +/* InstallNi() takes the following arguments: */ +/* */ +/* int (*entry)(); address of NI entry point */ +/* int ipadd; IP address */ +/* int mtu; maximum transmission length */ +/* int hwalen; length of hardware address */ +/* int flags; intErface flags */ +/* int subnetaddr; subnet mask */ +/* int dstipaddr; destination ip address */ +/* */ +/* See pSOSystem Programmer`s Reference Manual, Configuration Tables */ +/* Section, for more information about the Network Interface Table. */ +/* InstallNi() does not return a value. */ +/* */ +/* If you are adding a driver that needs to be initialized before */ +/* either pSOS+ is initialized or the driver's init function is */ +/* called, then you can call a setup function (that you create) for */ +/* the driver. If your initialization function needs to allocate */ +/* memory, you may pass it the FreeMemPtr. The function should return */ +/* a new FreeMemPtr which points to the end of the memory it has */ +/* allocated. */ +/* */ +/* When adding code to install a new driver, it is a good idea to add */ +/* precompile checks so errors can be found during compile-time rather */ +/* then at run-time. Precompile checks are used, for example, in the */ +/* code that installs the pSOSystem serial device driver below. */ +/* */ +/***********************************************************************/ +UCHAR *SetUpNI(UCHAR *FreeMemPtr) +{ +/*---------------------------------------------------------------------*/ +/* Install the pSOSystem NI. */ +/*---------------------------------------------------------------------*/ +#if BSP_LAN1 + if (SysVars.Lan1) + { + register int IPaddr; + register long (*NiLanPtr)(ULONG, union nientry *); + + #if (SC_DEV_DLPI && SE_SHARE_NI) + NiLanPtr = (long (*)(ULONG, union nientry *))DlpiEnet; + #else + NiLanPtr = (long (*)(ULONG, union nientry *))BSP_LAN1_ENTRY; + #endif + + /*-------------------------------------------------------------*/ + /* If RARP is specified for the IP address, use it now to */ + /* obtain the IP address for this interface. */ + /*-------------------------------------------------------------*/ + if (SysVars.Lan1IP == USE_RARP) + { + IPaddr = RarpEth(NiLanPtr); + + if (IPaddr == 0) + SysInitFail(RarpErrTimeout); + if (IPaddr == -1) + SysInitFail(RarpErrNet); + } + else + IPaddr = SysVars.Lan1IP; + + InstallNi(NiLanPtr, IPaddr, BSP_LAN1_MTU, BSP_LAN1_HWALEN, + BSP_LAN1_FLAGS, SysVars.Lan1SubnetMask, 0); + } +#endif + +/*---------------------------------------------------------------------*/ +/* Install the shared memory NI. */ +/*---------------------------------------------------------------------*/ +#if BSP_SMEM + #if ((SC_NISM_LEVEL != 1) && (SC_NISM_LEVEL != 2)) + #error "Illegal value for SC_NISM_LEVEL" + #endif + + if (SysVars.Nism) + { + InstallNi(NiSmem, SysVars.NismIP, NISM_MTU, 4, 0x8002, + SysVars.NismSubnetMask, 0); + } +#endif + +/*---------------------------------------------------------------------*/ +/* Additional Network drivers may be installed here. */ +/*---------------------------------------------------------------------*/ + +return FreeMemPtr; +} + +#endif /* (SC_PNA || SC_PNET) */ diff --git a/h/wrn/wm/util/port/isisnmp/x86250/sys_conf.h b/h/wrn/wm/util/port/isisnmp/x86250/sys_conf.h new file mode 100644 index 0000000..794ce4f --- /dev/null +++ b/h/wrn/wm/util/port/isisnmp/x86250/sys_conf.h @@ -0,0 +1,1124 @@ +/* @(#) pSOSystem x86/V2.5.0: apps/xxxx/sys_conf.h (netutils_386 386) 4.76 99/05/25 18:23:38 */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/* [clearcase] +modification history +------------------- +*/ + +/***********************************************************************/ +/* */ +/* MODULE: sys_conf.h */ +/* DATE: 99/05/25 */ +/* PURPOSE: pSOSystem configuration definitions */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* Copyright 1991 - 1999, Integrated Systems, Inc. */ +/* ALL RIGHTS RESERVED */ +/* */ +/* Permission is hereby granted to licensees of Integrated Systems, */ +/* Inc. products to use or abstract this computer program for the */ +/* sole purpose of implementing a product based on Integrated */ +/* Systems, Inc. products. No other rights to reproduce, use, */ +/* or disseminate this computer program, whether in part or in */ +/* whole, are granted. */ +/* */ +/* Integrated Systems, Inc. makes no representation or warranties */ +/* with respect to the performance of this computer program, and */ +/* specifically disclaims any responsibility for any damages, */ +/* special or consequential, connected with the use of this program. */ +/* */ +/*---------------------------------------------------------------------*/ +/* */ +/* This is a header file which defines all of the system-level */ +/* parameters that are likely to need changing. */ +/* */ +/* It has been set up to be as close as possible to the settings */ +/* which are appropriate for this application. However, you may */ +/* need to make some changes to parameters to reflect your */ +/* environment, such as IP addresses, etc. */ +/* */ +/* The "Configuration and Startup" section of the "Programmer's */ +/* Reference" manual in pSOSystem contains a complete description */ +/* of the symbols that are defined in this file. */ +/* */ +/***********************************************************************/ +#ifndef _SYS_CONF_H +#define _SYS_CONF_H + +#ifdef __cplusplus +extern "C" { +#endif + +/***********************************************************************/ +/* */ +/* SC_APP_PARMS must be defined before you include sysvars.h file. */ +/* Since "sysvars.h" file depends on SC_APP_PARMS and BSP_PARMS */ +/* to define the Storage Parms Structure. */ +/* */ +/* Defining this variable to a Non-Zero Value will create a space in */ +/* the Storage Parms corresponding to the value. The total space */ +/* allocated is the sum of the BSP_PARMS and SC_APP_PARMS. */ +/* */ +/* SC_APP_NAME define controls the application name string that will */ +/* be displayed during the boot dialog. */ +/* */ +/***********************************************************************/ +#define SC_APP_PARMS 0 +#define SC_APP_NAME "inetutil Application" + +/*---------------------------------------------------------------------*/ +/* sys/types.h contains common definitions, (example YES, NO and more) */ +/*---------------------------------------------------------------------*/ +#include + +/*---------------------------------------------------------------------*/ +/* sysvars.h contains the structures and definitions for the system */ +/* variables that are stored in NVRAM. These structures and */ +/* definitions are also used when creating the boot ROM for the */ +/* target system. By using the same sysvars.h file it will ensure */ +/* consistency of the values stored by the boot ROM and the downloaded */ +/* RAM application. */ +/*---------------------------------------------------------------------*/ +#include + +/*---------------------------------------------------------------------*/ +/* psos.h header file defines IO_AUTOINIT and IO_NOAUTOINIT */ +/*---------------------------------------------------------------------*/ +#include + +/*---------------------------------------------------------------------*/ +/* If USE_RARP is set to YES, then the IP address is obtained from the */ +/* network. */ +/*---------------------------------------------------------------------*/ +#define USE_RARP NO + +/***********************************************************************/ +/* */ +/* B A S I C P A R A M E T E R S */ +/* */ +/* The parameters in this section determine the fashion in which */ +/* many of the other parameters in this file will be used. */ +/* */ +/* Many of the parameters in this file have names beginning with */ +/* either "SC_" or "SD_". Those beginning with "SC_" are ALWAYS */ +/* controlled by the values you set in this file. The values of */ +/* the "SD_" parameters can be determined either by the definitions */ +/* given in this file, or by the data found in the target board's */ +/* parameter storage area. SC_SD_PARAMETERS determines this. If */ +/* SC_SD_PARAMETERS is "SYS_CONF", then the values given in this */ +/* file will be used for the SD_ parameters. If SC_SD_PARAMETERS */ +/* is "STORAGE", then pSOSystem will attempt to use the values found */ +/* in the board's parameter storage area for the SD_ variables. If */ +/* the parameter storage area has not been initialized or has been */ +/* corrupted, then the values given in this file will be used. They */ +/* will also be written to the storage area. */ +/* */ +/* If SC_SD_PARAMETERS is STORAGE, you may enable a "startup dialog" */ +/* which will allow you to view, and optionally change, the */ +/* parameter values found in the storage area. The dialog is enabled */ +/* by setting SC_STARTUP_DIALOG to YES. In this case, */ +/* SD_STARTUP_DELAY specifies the number of seconds that the dialog */ +/* will wait for input before proceeding to boot the system. */ +/* */ +/* The SC_STARTUP_DIALOG define either enables the boot dialog if set */ +/* to YES, or disables the boot dialog if set to NO. */ +/* */ +/* SC_BOOT_ROM when set to YES, configures the application as a */ +/* ROMable application. If set to NO, treats it as a RAM application. */ +/* */ +/* SC_SD_DEBUG_MODE determines the mode of the system, as follows: */ +/* */ +/* DBG_SA: Boot pROBE+ in standalone mode. */ +/* */ +/* DBG_XS: Boot into pROBE+ and wait for the host debugger */ +/* via a serial connection */ +/* */ +/* DBG_XN: Boot into pROBE+ and wait for the host debugger */ +/* via a network connection */ +/* */ +/* DBG_AP: Same as DBG_SA, but also does a pROBE+ "silent startup",*/ +/* meaning that pROBE+ initializes itself without */ +/* printing a startup banner. pROBE+ then initializes */ +/* pSOS+ and starts the application running. This mode */ +/* was created to simplify implementation of the pSOSystem */ +/* Boot ROMs. Note that when this mode is used, SMODE_MASK */ +/* in TD_FLAGS is always set. (See pROBE+ configuration */ +/* parameters below.) */ +/* */ +/* STORAGE: Use the mode (DBG_SA, DBG_XS, or DBG_XN) found in the */ +/* parameter storage area. If a valid mode is not found, */ +/* then use DBG_SA. */ +/* */ +/* An important consequence of using SC_SD_DEBUG_MODE=STORAGE should */ +/* be noted. If you use the TFTP bootloader in the pSOSystem ROMs */ +/* to download and start your system, you will be setting */ +/* SC_SD_DEBUG_MODE = DBG_AP in your target board's parameter storage */ +/* area. Thus, if you have left SC_SD_DEBUG_MODE set to STORAGE in */ +/* this file, your downloaded system will also use DBG_AP, meaning */ +/* that the application will begin running immediately after the */ +/* TFTP bootloader has loaded and started your system. */ +/* */ +/* */ +/***********************************************************************/ +#define SC_SD_PARAMETERS STORAGE +#define SC_STARTUP_DIALOG YES +#define SC_BOOT_ROM YES +#define SD_STARTUP_DELAY 60 +#define SC_SD_DEBUG_MODE STORAGE + +/***********************************************************************/ +/* */ +/* O P E R A T I N G S Y S T E M C O M P O N E N T S */ +/* */ +/* Setting the definition line to YES will cause that component to */ +/* be built into the system. NO means the component will NOT be */ +/* put into the system. */ +/*---------------------------------------------------------------------*/ +/* pSOS+: It is an error to specify both SC_PSOS and SC_PSOSM as */ +/* present! */ +/* */ +/*---------------------------------------------------------------------*/ +/* pROBE+: The following set of macros control which features will be */ +/* built in to the pROBE+ Target Agent. pROBE+ can run either in */ +/* console mode (dumb terminal) or as a back-end to a Source Level */ +/* Debugger on the host. Not all modules are needed for all cases.*/ +/* By eliminating modules you can save memory. The definition of */ +/* the modules are as follows: */ +/* */ +/* SC_PROBE - pROBE+ core module. This must always be present if */ +/* any part of pROBE+ is to be used. Setting this to NO will */ +/* force all other pROBE+ modules to NO (even if they say YES */ +/* in this file). */ +/* */ +/* SC_PROBE_CIE - pROBE+ Console Executive. Set this to YES if you */ +/* wish to control pROBE+ from a dumb terminal. If you only */ +/* use a source debugger and/or pRISM+, you can save memory by */ +/* setting it to NO. If it is YES, you also need to sepcify the */ +/* serial port used by the pROBE+ via SC_PROBE_CONSOLE. */ +/* */ +/* SC_PROBE_DISSAM - pROBE+ Console Dissassembler. If you set */ +/* SC_PROBE_CIE to YES and wish to view disassembled memory, set */ +/* this to YES as well. If you are using a host debugger and/or */ +/* pRISM+, you can save memory by setting this to NO. */ +/* */ +/* SC_PROBE_QUERY - pROBE+ Query Services which provides the pSOS+ */ +/* awareness. This module allows you to query the information */ +/* about pSOS+ obejects, issue a console-induced manual break */ +/* or halt-request from the host debugger, set the task-specific */ +/* breakpoints, service call breakpoints and task-dispatch */ +/* breakpoints. Unless you have severe memory restrictions or */ +/* your application does not use pSOS+ kernel, it is suggested */ +/* that you set this to YES. */ +/* */ +/* SC_PROBE_DEBUG - pROBE+ Remote Debug Module. This module is */ +/* used to enable communication between a host based source */ +/* debugger and/or pRISM+ to the pROBE+ target agent using a */ +/* light weight binary protocol. This must be set to YES to */ +/* enable pROBE+ to communicate with a source debugger or the */ +/* pRISM+ host tools. It can be set to NO if you only use the */ +/* pROBE+ console (dumb terminal) mode. If it is YES and the */ +/* host debuuger is connected the target via network, you have */ +/* to set the SC_PNET or SC_PNA to YES. If the host debugger */ +/* is using the serial connection, you have to select the proper */ +/* serial port via SC_RBUG_PORT. Note if a serial port is used */ +/* by the pROBE+ for the host debugger connection, this port */ +/* should not be used by the application except for */ +/* SC_PROBE_CONSOLE. For example, you should not set */ +/* SC_RBUG_PORT and SC_APP_CONSOLE to the same serial port */ +/* unless you don't use the host debugger when the application */ +/* is running. */ +/* */ +/* SC_PROBE_HELP - pROBE+ online help module. Setting this define */ +/* to YES provides the user with pROBE+ commands, when in */ +/* stand-alone mode. */ +/*---------------------------------------------------------------------*/ +/* SC_PHILE through SC_POSIX_TIMERS - Setting the definition line to*/ +/* YES will cause that component to be built into the system. */ +/* Setting it to NO means the component will NOT be put into the */ +/* system. */ +/* */ +/***********************************************************************/ +#define SC_PSOS YES /* pSOS+ real-time kernel */ +#define SC_PSOSM NO /* pSOS+ real-time multiproc kernel */ +#define SC_PSOS_QUERY NO /* pSOS+ Query Services */ +#define SC_PROBE NO /* pROBE+ (processor svcs) */ +#define SC_PROBE_DISASM NO /* pROBE+ (AT&T format disassembler) */ +#define SC_PROBE_DASM_INTEL NO /* pROBE+ (Intel format disassembler) */ +#define SC_PROBE_CIE NO /* pROBE+ (console executive) */ +#define SC_PROBE_QUERY NO /* pROBE+ (query services) */ +#define SC_PROBE_DEBUG NO /* pROBE+ (debug interface executive) */ +#define SC_PROBE_HELP NO /* pROBE+ Help command Handler. */ +#define SC_PHILE NO /* pHILE+ file system manager */ +#define SC_PHILE_PHILE NO /* pHILE+ (pHILE+ real-time file sys) */ +#define SC_PHILE_MSDOS NO /* pHILE+ (MS-DOS FAT file system) */ +#define SC_PHILE_NFS NO /* pHILE+ (NFS client) */ +#define SC_PHILE_CDROM NO /* pHILE+ (ISO 9660 CD-ROM file sys) */ +#define SC_PREPC YES /* pREPC+ C run-time library */ +#define SC_PNA YES /* pNA+ TCP/IP networking manager */ +#define SC_PNET NO /* pNET Library for BOOT ROMS */ +#define SC_PRPC NO /* pRPC+ RPC component */ +#define SC_PSE_PRPC NO /* pRPC+ RPC component Over pSE+ */ +#define SC_PSE NO /* pSE+ streams component */ +#define SC_PSKT NO /* pSKT+ SKT library component */ +#define SC_PTLI NO /* pTLI+ TLI library component */ +#define SC_PMONT NO /* pMONT+ */ +#define SC_PLM NO /* pLM+ Shared library manager */ +#define SC_PROFILER NO /* RTA profiler configuration */ +#define SC_RTEC NO /* RTA run-time error checker library */ +#define SC_POSIX NO /* POSIX component (core) */ +#define SC_POSIX_MESSAGE_PASSING NO /* POSIX (Message Queue svcs) */ +#define SC_POSIX_SEMAPHORES NO /* POSIX (semaphore svcs) */ +#define SC_POSIX_THREADS YES /* POSIX (pthread svcs) */ +#define SC_POSIX_TIMERS NO /* POSIX (clock and timer svcs)*/ + +/*---------------------------------------------------------------------*/ +/* If SC_QBIND is set to YES then the Quick bindings for pSOS+ System */ +/* calls will be used. If it is set to NO then the normal bindings */ +/* will be used. */ +/* */ +/* Quick bindings will not be supported for the applications with */ +/* USER mode Tasks. So make sure your Application does not have any */ +/* USER mode Tasks. */ +/*---------------------------------------------------------------------*/ +#define SC_QBIND NO /* Quick bindings for pSOSystem calls*/ + +/*---------------------------------------------------------------------*/ +/* If set to IO_AUTOINIT device drivers that are installed be the */ +/* InstallDriver function will have their autoinit field set. This */ +/* will cause pSOS+ call the drivers initialization function when */ +/* pSOS+ starts up. The de_init call will not have to be called for */ +/* each driver if this is done. */ +/* */ +/* NOTE: This Auto Initialization will not work on all drivers. */ +/* Setting IO_AUTOINIT only effects drivers that can use the Auto */ +/* Initialization feature. */ +/* */ +/* If set to IO_NOAUTOINIT no automatic driver initialization will */ +/* happen. */ +/*---------------------------------------------------------------------*/ +#define SC_AUTOINIT IO_AUTOINIT + +/*---------------------------------------------------------------------*/ +/* If SC_PMONT SC_AUTOINIT will always be set to 1 because pMONT needs */ +/* drivers to be automatically initialized. */ +/*---------------------------------------------------------------------*/ +#if SC_PMONT + #undef SC_AUTOINIT + #define SC_AUTOINIT IO_AUTOINIT +#endif + +/***********************************************************************/ +/* */ +/* S E R I A L C H A N N E L C O N F I G U R A T I O N */ +/* */ +/* * SD_DEF_BAUD specifies the default baud rate to be used for the */ +/* serial channels */ +/* * SC_APP_CONSOLE specifies the serial channel number (starting */ +/* from 1) which should be used for the application's "console". */ +/* * SC_PROBE_CONSOLE specifies the serial channel number (starting */ +/* from 1) which pROBE+ should use to display output and receive */ +/* commands, or to communicate with the host debugger. */ +/* * SC_RBUG_PORT specifies the serial channel number (starting */ +/* from 1) which will be used for the connnect between the host */ +/* debugger and the pROBE+ on the target. This is not needed if */ +/* the host debugger is using the network connection. It can be */ +/* disabled by using a value of 0. Note the port specified by */ +/* SC_RBUG_PORT port should not be used by the application except */ +/* for SC_PROBE_CONSOLE. For example, you should not set */ +/* SC_RBUG_PORT and SC_APP_CONSOLE to the same serial channel */ +/* unless you don't use the host debugger when the application is */ +/* running. */ +/* */ +/* Above three macros SC_PROBE_CONSOLE, SC_APP_CONSOLE and */ +/* SC_RBUG_PORT uses SERIAL_DRVRNUM(0) as default. This means that */ +/* the Low-Level Serial Driver 0 (1) is being used default. */ +/* */ +/* If you need to use another driver for any of the above macros */ +/* and another macro for pMONT PM_DEV, You need to change "0" to */ +/* the driver number you want. Consult the "README" file in BSP */ +/* directory for number of different drivers supported and for the */ +/* SERIAL_DRVRNUM mapping for those drivers. */ +/* */ +/***********************************************************************/ +#define SD_DEF_BAUD 9600 +#define SC_APP_CONSOLE PCCON +#define SC_PROBE_CONSOLE PCCON +#define SC_RBUG_PORT 0 + +/***********************************************************************/ +/* SC_NumNon_pSOSChan is the number of non-pSOS users of the serial */ +/* channels. These are users that will be initiated before pSOS, */ +/* such as pROBE. */ +/* */ +/* NOTE: These channels will not be closed on a soft reset. */ +/***********************************************************************/ +#if (SC_RBUG_PORT && SC_PROBE_CONSOLE && (SC_PROBE_CONSOLE != PCCON)) +#define SC_NumNon_pSOSChan 2 +#else +#define SC_NumNon_pSOSChan 1 +#endif + +/***********************************************************************/ +/* */ +/* L A N C O N F I G U R A T I O N */ +/* */ +/* */ +/***********************************************************************/ +#define SD_LAN1 NO /* Disable the LAN interface */ +#define SD_LAN1_IP 0x00000000 /* IP address of the node */ +#define SD_LAN1_SUBNET_MASK 0x00000000 /* subnet mask for the node */ + +/*---------------------------------------------------------------------*/ +/* Maximum number of multicast addresses to be used by the lan */ +/* interface. Must not exceed maximum supported by the lan driver. */ +/*---------------------------------------------------------------------*/ +#define SC_LAN1_NMCAST 0 + +/***********************************************************************/ +/* */ +/* B U S C O N F I G U R A T I O N */ +/* */ +/* */ +/***********************************************************************/ +#define SD_VME_BASE_ADDR 0x01000000 /* VME bus base address */ + +/***********************************************************************/ +/* */ +/* S H A R E D M E M O R Y C O N F I G U R A T I O N */ +/* */ +/* */ +/***********************************************************************/ + +/*---------------------------------------------------------------------*/ +/* If you want to build a "Shared Memory Interface" for the network or */ +/* multi-processing pSOS+m, set SD_SM_NODE to the node number of this */ +/* node ( a non-zero value). */ +/*---------------------------------------------------------------------*/ +#define SD_SM_NODE 0 /* Node number for this node */ + +/*---------------------------------------------------------------------*/ +/* Shared memory network interface (SMNI) - SC_NISM_LEVEL should be 1 */ +/* if this will be the FIRST system to use the SMNI on this board. It */ +/* should be 2 if this will not be the first system to use SMNI on this*/ +/* board. Usually this means that SC_NISM_LEVEL should be 1 if you */ +/* are building Boot ROMs, and 2 for a system that will be downloaded */ +/* and started using the Boot ROMs. See the comments at the beginning */ +/* of drivers/ni_smem.c for more explanation. */ +/*---------------------------------------------------------------------*/ +#define SD_NISM NO /* Disable/Enable Shared Mem NI */ +#define SD_NISM_IP 0x00000000 /* IP address of this node */ +#define SD_NISM_DIRADDR 0x00000400 /* Bus addr of SMNI directory */ +#define SC_NISM_BUFFS 30 /* Num of buffers for SMNI */ +#define SC_NISM_LEVEL 2 /* SMNI Level, 1 if first node */ +#define SD_NISM_SUBNET_MASK 0x00000000 /* Subnet mask for the SMNI */ + + +/*---------------------------------------------------------------------*/ +/* If you want to build a multi-node pSOS+m system, set SD_KISM */ +/* to the number of nodes in the system. */ +/*---------------------------------------------------------------------*/ +#define SD_KISM 0 /* Num of nodes that will use the SMKI */ +/*---------------------------------------------------------------------*/ +/* Bus Address of the system-wide directory structure that all nodes */ +/* in the system have access to. */ +/*---------------------------------------------------------------------*/ +#define SD_KISM_DIRADDR 0x00000580 +#define SC_KISM_BUFFS 100 /* Num of buffers for SMKI */ + + +/***********************************************************************/ +/* */ +/* M I S C E L L A N E O U S N E T W O R K I N G */ +/* P A R A M E T E R S */ +/* */ +/***********************************************************************/ +#define SD_DEF_GTWY_IP 0x00000000 /* Default gateway IP address*/ + + +/***********************************************************************/ +/* SC_RAM_SIZE define controls the end of RAM as seen by pSOSystem. */ +/* If it is set to zero, then pSOSystem uses ALL of the memory */ +/* remaining on a board for dynamic allocation ("region 0"). You may */ +/* override this by setting SC_RAM_SIZE to a non-zero value. If you do,*/ +/* pSOSystem will not touch any memory after the specified address. */ +/* */ +/* NOTE: This is useful when making a BOOT ROM and you want to ensure */ +/* that the ROM's RAM area does not overflow the space allocated for it*/ +/***********************************************************************/ +#define SC_RAM_SIZE 0 + +/***********************************************************************/ +/* */ +/* I / O D E V I C E S */ +/* */ +/* Each device may be included in the system by specifying a major */ +/* number for it, which determines its slot in the pSOS+ I/O switch */ +/* table. To leave a device driver out of the system, use NO for */ +/* the major number. */ +/* */ +/* Note the following: */ +/* */ +/* * Major device 0 is reserved and cannot be used for any of these */ +/* devices. Setting a device number to 0 here is the same as NO. */ +/* */ +/* * No device number may be higher than SC_DEVMAX (SC_DEVMAX may */ +/* be increased, if desired) */ +/* */ +/* * The lines defining the symbols DEV_SERIAL, DEV_TIMER, etc, */ +/* should not be changed. These are for use by application */ +/* programs as the "device number" parameter on de_* calls. */ +/* */ +/***********************************************************************/ +#define SC_DEV_SERIAL 1 /* Serial driver */ +#define SC_DEV_TIMER 2 /* Periodic tick timer */ +#define SC_DEV_RAMDISK 3 /* RAM disk */ +#define SC_DEV_CONSOLE 4 /* PC-Console driver */ +#define SC_DEV_SCSI 5 /* SCSI bus */ +#define SC_DEV_SCSI_TAPE 6 /* SCSI bus, tape device */ +#define SC_DEV_IDE 7 /* IDE Driver */ +#define SC_DEV_FLOPPY 8 /* Floppy Driver */ +#define SC_DEV_NTFTP 9 /* New TFTP pseudo driver */ +#define SC_DEV_TFTP 10 /* TFTP pseudo driver */ +#define SC_DEV_HTTP NO /* HTTP pseudo driver */ +#define SC_DEV_SPI NO /* SPI driver */ +#define SC_DEV_DLPI NO /* DLPI pseudo driver */ +#define SC_DEV_OTCP NO /* 14 TCP/IP for OpEN */ +#define SC_IP SC_DEV_OTCP /* 14 IP */ +#define SC_ARP NO /* 15 ARP */ +#define SC_TCP NO /* 16 TCP */ +#define SC_UDP NO /* 17 UDP */ +#define SC_RAW NO /* 18 RAW */ +#define SC_LOOP NO /* 19 LOOP = (SC_DEV_OTCP + 5) */ +#define SC_DEV_SOSI NO /* 20 OSI for OpEN */ +#define SC_DEV_PSCONSOLE 21 /* Pseudo Console driver */ +#define SC_DEV_MEMLOG 22 /* Memory log driver */ +#define SC_DEV_RDIO 23 /* pROBE+ RDIO driver */ +#define SC_DEV_NULL 24 /* Null Device Driver */ +#define SC_DEV_PARALLEL NO /* Parallel Port Driver */ +#define SC_DEV_CMOS NO /* CMOS Driver */ +#define SC_DEV_WATCHDOG NO /* Watchdog Driver */ +#define SC_DEV_OLAP NO /* LAP Drivers */ +#define SC_PHPI (SC_DEV_OLAP) /* Phpi driver */ +#define SC_LAPB (SC_DEV_OLAP + 0)/* LAPB driver Change 0 to 1 */ +#define SC_DEV_OX25 NO /* X25 Drivers */ +#define SC_X25 (SC_DEV_OX25) /* X.25 plp driver */ +#define SC_SNDCF NO /* sndcf driver */ +#define SC_IPCONV NO /* ip convergence driver */ +#define SC_DEV_ISDN NO /* ISDN Drivers */ +#define SC_PH (SC_DEV_ISDN) /* PH driver */ +#define SC_LAPD (SC_DEV_ISDN + 0)/* LAPD driver Change 0 to 1 */ +#define SC_IPCD (SC_DEV_ISDN + 0)/* IPCD driver Change 0 to 2 */ +#define SC_DEV_MLPP NO /* MultiLink PPP Drivers */ +#define SC_FRMUX (SC_DEV_MLPP) /* FRMUX driver */ +#define SC_PPP (SC_DEV_MLPP + 0)/* PPP driver Change 0 to 1 */ +#define SC_PIM (SC_DEV_MLPP + 0)/* PIM driver Change 0 to 2 */ +#define SC_DEV_LOG NO /* STREAMS log driver */ +#define SC_DEV_PSMUX NO /* Sample Mux driver */ +#define SC_DEV_PSLWR NO /* Sample loopback driver */ +#define SC_DEV_SLLWR NO /* Sample loopback driver */ +#define SC_DEV_PIPE 43 /* Pipe Driver. */ +#define SC_DEV_SIMCONSOLE NO /* pSOSim Console Driver */ + +#define SC_DEVMAX 45 /* Maximum device number */ + +#define DEV_SERIAL (SC_DEV_SERIAL << 16) +#define DEV_PARALLEL (SC_DEV_PARALLEL << 16) +#define DEV_TIMER (SC_DEV_TIMER << 16) +#define DEV_RAMDISK (SC_DEV_RAMDISK << 16) +#define DEV_SCSI (SC_DEV_SCSI << 16) +#define DEV_SCSI_TAPE (SC_DEV_SCSI_TAPE << 16) +#define DEV_PSCONSOLE (SC_DEV_PSCONSOLE << 16) +#define DEV_SYSCONSOLE ((SC_DEV_PSCONSOLE << 16) + SYSCONSOLE_DEV) +#define DEV_PSEUDO ((SC_DEV_PSCONSOLE << 16) + PSEUDO_DEV) +#define DEV_STDIN ((SC_DEV_PSCONSOLE << 16) + STDIN_DEV) +#define DEV_STDOUT ((SC_DEV_PSCONSOLE << 16) + STDOUT_DEV) +#define DEV_STDERR ((SC_DEV_PSCONSOLE << 16) + STDERR_DEV) +#define DEV_NULL (SC_DEV_NULL << 16) +#define DEV_MEMLOG (SC_DEV_MEMLOG << 16) +#define DEV_RDIO (SC_DEV_RDIO << 16) +#define DEV_DLPI (SC_DEV_DLPI << 16) +#define DEV_TFTP (SC_DEV_TFTP << 16) +#define DEV_NTFTP (SC_DEV_NTFTP << 16) +#define DEV_HTTP (SC_DEV_HTTP << 16) +#define DEV_SPI (SC_DEV_SPI << 16) +#define DEV_WATCHDOG (SC_DEV_WATCHDOG << 16) +#define DEV_FLOPPY (SC_DEV_FLOPPY << 16) +#define DEV_IDE (SC_DEV_IDE << 16) +#define DEV_CMOS (SC_DEV_CMOS << 16) +#define DEV_CONSOLE (SC_DEV_CONSOLE << 16) +#define DEV_IP (SC_IP << 16) +#define DEV_ARP (SC_ARP << 16) +#define DEV_TCP (SC_TCP << 16) +#define DEV_UDP (SC_UDP << 16) +#define DEV_RAW (SC_RAW << 16) +#define DEV_LOOP (SC_LOOP << 16) +#define DEV_PHPI (SC_PHPI << 16) +#define DEV_LAPB (SC_LAPB << 16) +#define DEV_X25 (SC_X25 << 16) +#define DEV_SNDCF (SC_SNDCF << 16) +#define DEV_IPCONV (SC_IPCONV << 16) +#define DEV_PH (SC_PH << 16) +#define DEV_LAPD (SC_LAPD << 16) +#define DEV_IPCD (SC_IPCD << 16) +#define DEV_FRMUX (SC_FRMUX << 16) +#define DEV_PIM (SC_PIM << 16) +#define DEV_PPP (SC_PPP << 16) +#define DEV_LOG (SC_DEV_LOG << 16) +#define DEV_PSMUX (SC_DEV_PSMUX << 16) +#define DEV_PSLWR (SC_DEV_PSLWR << 16) +#define DEV_SLLWR (SC_DEV_SLLWR << 16) +#define DEV_PIPE (SC_DEV_PIPE << 16) +#define DEV_SIMCONSOLE (SC_DEV_SIMCONSOLE << 16) + +#if (BSP_CPUFAMILY == FAMILY_X86) && (SC_APP_CONSOLE == PCCON) + #define CONSOLE DEV_CONSOLE +#elif (BSP_CPUFAMILY == FAMILY_PSOSIM) + #define CONSOLE DEV_SIMCONSOLE +#else + #define CONSOLE DEV_SERIAL +#endif + +/***********************************************************************/ +/* p S E U D O D R I V E R D E F I N E S */ +/* */ +/* The defines below control the behavour of the pSEUDO driver if the */ +/* SC_DEV_PSCONSOLE is enabled. */ +/* */ +/***********************************************************************/ +#define SC_PSCNSL_SHARED_CHAN 2 /* Num of shared channels */ +#define SC_PSCNSL_PRIVATE_CHAN 4 /* Number of private channels */ +#define SC_PSCNSL_MAX_CUSTOM 1 /* NUmber of custome device */ +#define SC_PSCNSL_DEFAULT_DEV CONSOLE /* Default console device */ + +/***********************************************************************/ +/* T F T P D R I V E R C O N F I G U R A T I O N */ +/* */ +/* The defines below define the Configuration Parameters needed by the */ +/* TFTP driver. */ +/* */ +/***********************************************************************/ +#define SC_MAX_TFTP_CHAN 8 /* Maximum number of TFTP channels */ + +/***********************************************************************/ +/* H T T P S E R V E R C O N F I G U R A T I O N */ +/* */ +/* The SC_MAX_HTTP_CHAN define controls the maximum number of HTTP */ +/* channels in the system. */ +/* */ +/***********************************************************************/ +#define SC_MAX_HTTP_CHAN 1 + +/***********************************************************************/ +/* P I P E D R I V E R C O N F I G U R A T I O N */ +/* */ +/* The SC_MAX_PIPE_CHAN define controls the maximum number of PIPE */ +/* channels that will be configured in the system. */ +/* */ +/***********************************************************************/ +#define SC_MAX_PIPE_CHAN 1 + +/***********************************************************************/ +/* */ +/* M M U L I B R A R Y P A R A M S */ +/* */ +/* The SC_MMULIB define controls the MMU library call-outs when pROBE+ */ +/* is entered. Setting this to YES enables the callouts, while setting */ +/* this to NO disables the callouts when pROBE+ is entered and BSP_MMU */ +/* is enabled. */ +/* */ +/***********************************************************************/ +#define SC_MMULIB NO + +/***********************************************************************/ +/* */ +/* C O M P O N E N T C O N F I G U R A T I O N P A R A M E T E R S */ +/* */ +/* These parameters should work as is for this application. You */ +/* may want to change some of them if you start customizing this */ +/* application. */ +/* */ +/***********************************************************************/ + +/*---------------------------------------------------------------------*/ +/* pSOS+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define KC_RN0USIZE 0x100 /* region 0 unit size */ +#define KC_NTASK 40 /* max number of tasks */ +#define KC_NQUEUE 25 /* max number of message queues */ +#define KC_NSEMA4 30 /* max number of semaphores */ +#define KC_NTIMER 20 /* max number of timers */ +#define KC_NMUTEX 20 /* Max number of mutexes */ +#define KC_NCVAR 20 /* Max number of condition variables */ +#define KC_NTVAR 5 /* Max number of task variables */ +#define KC_NCOCB 5 /* Max number of callouts */ +#define KC_NTSD 5 /* Max # of Task Specific Data entries */ +#define KC_NLOCOBJ 100 /* max number of local objects */ +#define KC_NMSGBUF 256 /* max number of message buffers */ +#define KC_TICKS2SEC 100 /* clock tick interrupt frequency */ +#define KC_TICKS2SLICE 10 /* time slice quantum, in ticks */ +#define KC_MAXDNTENT 10 /* max number of device names in DNT */ +#define KC_DNLEN 10 /* max length of a device name in DNT */ +#define KC_SYSSTK 0x1000 /* pSOS+ system stack size (bytes) */ +#define KC_ROOTSSTK 0x2000 /* ROOT supervisor stack size */ +#define KC_IDLESTK 0x0400 /* IDLE stack size */ +#define KC_ROOTUSTK 0 /* ROOT user stack size */ +#define KC_ROOTMODE (T_SUPV | T_ISR) /* ROOT initial mode */ +#define KC_ROOTPRI 230 /* ROOT task priority */ +#define KC_NIO (SC_DEVMAX+1) /* # of devices in initial iojtab */ +#define KC_MAXIO (SC_DEVMAX+1) /* Max # of devices in the system */ + +/*---------------------------------------------------------------------*/ +/* The following are examples for modifying the following defines */ +/* */ +/* To configure a user written routine as a fatal error handler, you */ +/* need to do the following: */ +/* */ +/* extern void MyHandler (void); */ +/* #define KC_FATAL ((void (*)()) MyHandler) */ +/* */ +/*---------------------------------------------------------------------*/ +#define KC_STARTCO 0 /* callout at task activation */ +#define KC_DELETECO 0 /* callout at task deletion */ +#define KC_SWITCHCO 0 /* callout at task switch */ + +#define KC_FATAL 0 /* fatal error handler address */ +#define KC_IDLECO 0 /* Idle Task Callout */ + +/*---------------------------------------------------------------------*/ +/* pSOS+m configuration parameters */ +/*---------------------------------------------------------------------*/ +#define MC_NGLBOBJ 8 /* size of gbl obj table */ +#define MC_NAGENT 10 /* number of RPC agents in this node */ +#define MC_FLAGS SEQWRAP_ON /* operating mode flags */ + +/*---------------------------------------------------------------------*/ +/* The following are examples for modifying the following definition */ +/* */ +/* Using a user written routine as a roster change handler */ +/* extern void MyHandler (void); */ +/* #define MC_ROSTER ((void (*)()) MyHandler) */ +/* */ +/*---------------------------------------------------------------------*/ +#define MC_ROSTER 0 /* addr of user roster change callout */ +#define MC_KIMAXBUF 100 /* maximum KI packet buffer length */ +#define MC_ASYNCERR 0 /* asynchronous calls error callout */ + +/*---------------------------------------------------------------------*/ +/* pROBE+ configuration parameters */ +/* */ +/* NOTE: The SMODE_MASK bit in TD_FLAGS is set as */ +/* SC_SD_DEBUG_MODE = DBG_AP. */ +/*---------------------------------------------------------------------*/ +#define TD_BRKOPC 0xCC /* Instruction break opcode */ +#define TD_DBGPRI 244 /* Debugger task priority */ +#define TD_ILEV (1 << 12) /* pROBE+ interrupt mask */ +#define TD_FLAGS (NODOTS_MASK | TD_ILEV | NOTUPD_MASK)/* flags */ + +/*---------------------------------------------------------------------*/ +/* pHILE+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define FC_LOGBSIZE 9 /* Block size (base-2 exponent) */ +#define FC_NBUF 6 /* Number of cache buffers */ +#define FC_NMOUNT 3 /* Max # of mounted volumes */ +#define FC_NFCB 10 /* Max # of opened files per system */ +#define FC_NCFILE 2 /* Max # of opened files per task */ +#define FC_NDNLC 0 /* Max # of cached directory entries */ + +/*---------------------------------------------------------------------*/ +/* pHILE+ DATA AREA definitions. */ +/*---------------------------------------------------------------------*/ +#define FC_DATA 0 /* pHILE+ Data Area Starting Address */ +#define FC_DATASIZE 0 /* pHILE+ Data Area Size */ + +/*---------------------------------------------------------------------*/ +/* Set the FC_ERRCO define to install the callout handler for I/O */ +/* errors. The callout handler provided in FC_ERRCO will be called if */ +/* there is an error during an I/O operation on the Volume. */ +/* */ +/* To install the error callout handler: Follow the syntax below */ +/* */ +/* #include */ +/* extern user_fcerrco(int, ULONG, const struct buffer_header *) */ +/* #define FC_ERRCO user_fcerrco */ +/* */ +/*---------------------------------------------------------------------*/ +#define FC_ERRCO 0 /* I/O error call-out */ + +/*---------------------------------------------------------------------*/ +/* pLM+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define LM_MAXREG 8 /* Max # of registered libraries */ +#define LM_DATA 0 /* pLM+ data area */ +#define LM_DATASIZE 0 /* pLM+ data area size */ + +/*---------------------------------------------------------------------*/ +/* Set LM_DEFAULT_COUTS to YES if you need to use the pSOSystem Default*/ +/* pLM Callouts. Set it to NO if you are providing the callouts. */ +/* */ +/* Setting LM_DEFAULT_COUTS to NO needs "LM_LOADCO" and "LM_UNLOADCO" */ +/* definitions to be valid address (Function address). */ +/*---------------------------------------------------------------------*/ +#define LM_DEFAULT_COUTS YES + +/*---------------------------------------------------------------------*/ +/* */ +/* The following callouts needs to be defined by user, If users wants */ +/* their callouts to be used instead of pSOSystem default Callouts. */ +/* */ +/* If we are using pSOSystem default callouts, Users needs to add their*/ +/* callouts to the pSOSystem callouts table using PssRegister_pLM_couts*/ +/* and remove using PssDeregister_pLM_couts. */ +/* */ +/* To have user callouts follow the syntax below: */ +/* */ +/* #include */ +/* extern ULONG user_load_co(const char *libname, ULONG scope, */ +/* ULONG version, const void *libinfo, */ +/* sl_attrib *attr); */ +/* extern ULONG user_unload_co(const sl_attrib *attr); */ +/* */ +/* #define LM_LOADCO user_load_co */ +/* #define LM_UNLOADCO user_unload_co */ +/* */ +/*---------------------------------------------------------------------*/ +#define LM_LOADCO 0 +#define LM_UNLOADCO 0 + +/*---------------------------------------------------------------------*/ +/* pREPC+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define LC_BUFSIZ (1 << FC_LOGBSIZE) /* I/O buffer size */ +#define LC_NUMFILES 5 /* Max number of open files per task */ +#define LC_WAITOPT 0 /* Wait option for memory allocation */ +#define LC_TIMEOPT 0 /* Timeout option for mem allocation */ + +/*---------------------------------------------------------------------*/ +/* pREPC+ stdin, stdout and stderr device mapping. */ +/*---------------------------------------------------------------------*/ +#if (SC_DEV_PSCONSOLE) +#define LC_STDIN "///dev/stdin" /* The default STDIN device */ +#define LC_STDOUT "///dev/stdout" /* The default STDOUT device */ +#define LC_STDERR "///dev/stderr" /* The default STDERR device */ + +#elif (BSP_CPUFAMILY == FAMILY_X86) && (SC_APP_CONSOLE == PCCON) +#define LC_STDIN "///dev/pcconsole" /* Make PCCON as STDIN device */ +#define LC_STDOUT "///dev/pcconsole" /* Make PCCON as STDOUT device */ +#define LC_STDERR "///dev/pcconsole" /* Make PCCON as STDERR device */ + +#elif (SC_DEV_SERIAL) +#define LC_STDIN "///dev/tty" /* Make TTY the STDIN device */ +#define LC_STDOUT "///dev/tty" /* Make TTY the STDOUT device */ +#define LC_STDERR "///dev/tty" /* Make TTY the STDERR device */ + +#elif (SC_DEV_SIMCONSOLE) +#define LC_STDIN "///dev/simconsole" /* Make simconsole STDIN */ +#define LC_STDOUT "///dev/simconsole" /* Make simconsole STDOUT */ +#define LC_STDERR "///dev/simconsole" /* Make simconsole STDERR */ + +#else +#define LC_STDIN "///dev/null" /* Make NULL the STDIN device */ +#define LC_STDOUT "///dev/null" /* Make NULL the STDOUT device */ +#define LC_STDERR "///dev/null" /* Make NULL the STDERR device */ +#endif + +#if (SC_DEV_RAMDISK) +#define LC_TEMPDIR DEV_RAMDISK /* The default TEMPDIR device */ + +#elif (SC_DEV_SCSI) +#define LC_TEMPDIR DEV_SCSI /* The default TEMPDIR device */ + +#elif (SC_DEV_IDE) +#define LC_TEMPDIR DEV_IDE /* The default TEMPDIR device */ + +#elif (SC_DEV_FLOPPY) +#define LC_TEMPDIR DEV_FLOPPY /* The default TEMPDIR device */ + +#else +#define LC_TEMPDIR 0 /* The default TEMPDIR device */ +#endif + + +/*---------------------------------------------------------------------*/ +/* pNA+ configuration parameters */ +/* */ +/* NOTE: If you get pNA+ errno 5F01 FAT_INSUFFMEM you may need to */ +/* decrease the number of buffers allocated here for pNA+. */ +/* In general this error means pNA+ could not allocate enough */ +/* memory from Region 0 for the number of buffers requested. */ +/*---------------------------------------------------------------------*/ +#define NC_NNI 5 /* size of pNA NI Table */ +#define NC_NROUTE 10 /* size of pNA Routing Table */ +#define NC_NARP 20 /* size of pNA ARP table */ +#define NC_DEFUID 0 /* Default User ID of a task */ +#define NC_DEFGID 0 /* Default Group ID of a task */ +#define NC_HOSTNAME "scg" /* Hostname of the node */ +#define NC_NHENTRY 8 /* Number of Host table entries */ + +#define NC_NMCSOCS 0 /* Number of IP multicast sockets */ +#define NC_NMCMEMB 0 /* Number of distict IP multicast */ + /* group memberships per interface */ + +#define NC_NNODEID 0 /* Network NODE ID for unnumbered link */ + +#define NC_NSOCKETS 64 /* Number of sockets in the system */ +#define NC_NDESCS 8 /* # of socket descriptors/task */ +#define NC_MBLKS 300 /* # of message blocks in the system */ + +#define NC_BUFS_0 64 /* number of 0 length buffers */ +#define NC_BUFS_32 0 /* number of 32 length buffers */ +#define NC_BUFS_64 0 /* number of 64 length buffers */ +#define NC_BUFS_128 256 /* number of 128 byte buffers */ +#define NC_BUFS_256 0 /* number of 256 byte buffers */ +#define NC_BUFS_512 0 /* number of 512 byte buffers */ +#define NC_BUFS_1024 16 /* number of 1k byte buffers */ +#define NC_BUFS_2048 48 /* number of 2k byte buffers */ +#define NC_BUFS_4096 0 /* number of 4k byte buffers */ + +#define NC_MAX_BUFS 9 /* max number of NC_BUFS types */ + +#define NC_PNAMEM_NEWSCHEME YES /* apply new pNA MEM management scheme*/ + +#define NC_BUFS_XX_INTERNAL 20 /* # of buffers for internal pNA usage */ +#define NC_MBLKS_INT_PERCENT 15 /* % of mblks reserved for pNA internal */ +#define NC_MBLKS_TX_PERCENT 40 /* % of mblks reserved for Tx Mem Pool */ + +#define NC_BUFS_0_TX_PERCENT 50 /* % of 0 length buffers used for Tx */ +#define NC_BUFS_32_TX_PERCENT 50 /* % of 32 length buffers used for Tx */ +#define NC_BUFS_64_TX_PERCENT 50 /* % of 64 length buffers used for Tx */ +#define NC_BUFS_128_TX_PERCENT 50 /* % of 128 byte buffers used for Tx */ +#define NC_BUFS_256_TX_PERCENT 50 /* % of 256 byte buffers used for Tx */ +#define NC_BUFS_512_TX_PERCENT 50 /* % of 512 byte buffers used for Tx */ +#define NC_BUFS_1024_TX_PERCENT 50 /* % of 1k byte buffers used for Tx */ +#define NC_BUFS_2048_TX_PERCENT 50 /* % of 2k byte buffers used for Tx */ +#define NC_BUFS_4096_TX_PERCENT 50 /* % of 4k byte buffers used for Tx */ + +/*---------------------------------------------------------------------*/ +/* pNA+ daemon task configuration parameters */ +/*---------------------------------------------------------------------*/ +#define NC_DTASK_SSTKSZ 0x800 /* pNAD daemon task sstack size*/ +#define NC_DTASK_USTKSZ 0x400 /* pNAD daemon task ustack size*/ +#define NC_DTASK_PRIO 255 /* pNAD daemon task priority */ +#define NC_NEW_MULTITASK_SYNC YES /* deploy new pNA+ sync scheme */ +#define NC_USE_MUTEX YES /* use pSOS MUTEX primitive */ + +/*---------------------------------------------------------------------*/ +/* pNA+ DATA AREA definitions. */ +/*---------------------------------------------------------------------*/ +#define NC_DATA 0 /* pNA+ Data Area Starting Addr*/ +#define NC_DATASIZE 0 /* pNA+ Data Area Size */ + +/*---------------------------------------------------------------------*/ +/* The following are examples for modifying the following defines */ +/* */ +/* Using a user written routine as a pNA+ Signal Handler */ +/* extern void MySigHandler (void); */ +/* #define NC_SIGNAL ((void (*)()) MySigHandler) */ +/* */ +/*---------------------------------------------------------------------*/ +#define NC_SIGNAL 0 /* pNA+ Signal Hdlr */ + +/*---------------------------------------------------------------------*/ +/* pRPC+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define NR_PMAP_PRIO 254 /* task priority */ +#define NR_PMAP_SSTACK 0x2000 /* supervisor stack size */ +#define NR_PMAP_USTACK 0x100 /* user stack size */ +#define NR_PMAP_FLAGS T_LOCAL /* t_create flags */ +#define NR_PMAP_MODE T_SUPV /* t_start mode */ +#define NR_DEBUG_FLAG NO /* Turns on debug msgs from PMAP task */ + +/*---------------------------------------------------------------------*/ +/* pRPC+ DATA AREA definitions. */ +/*---------------------------------------------------------------------*/ +#define NR_DATA 0 /* pRPC+ Data Area Starting Address */ +#define NR_DATASIZE 0 /* pRPC+ Data Area Size */ + +/*---------------------------------------------------------------------*/ +/* User can change these TWO defines to have their own handlers. */ +/*---------------------------------------------------------------------*/ +#define NR_GETHOSTNAME nr_gethostname /* Function to get local */ + /* host name */ +#define NR_GET_HENTBYNAME nr_get_hentbyname /* Function to map host */ + /* name to it's IP Addr */ + +/*---------------------------------------------------------------------*/ +/* pSE+ configuration parameters */ +/*---------------------------------------------------------------------*/ +#define SE_NBUFS_0 64 /* number of 0 length buffers */ +#define SE_NBUFS_32 128 /* number of 32 byte buffers */ +#define SE_NBUFS_64 128 /* number of 64 byte buffers */ +#define SE_NBUFS_128 256 /* number of 128 byte buffers */ +#define SE_NBUFS_256 32 /* number of 256 byte buffers */ +#define SE_NBUFS_512 32 /* number of 512 byte buffers */ +#define SE_NBUFS_1024 16 /* number of 1k byte buffers */ +#define SE_NBUFS_2048 16 /* number of 2k byte buffers */ +#define SE_NBUFS_4096 8 /* number of 4k byte buffers */ +#define SE_MAX_BUFS 9 /* max number of stream buffer types */ + +#define SE_MAX_MODULES 4 /* max number of streams modules */ +#define SE_SHARE_NI NO /* LAN-NI with streams? */ + +#define SE_DATA_SIZE 0x1000 /* size of pSE data area */ + /* (must be at least 3K) */ +#define SE_TASK_PRIO 250 /* priority for pSE task */ +#define SE_STACK_SIZE 0x2000 /* stack size for pSE task */ +#define SE_DEF_UID 0 /* default user id */ +#define SE_DEF_GID 0 /* default group id */ +#define SE_N_FDS 32 /* max # of system-wide */ + /* stream descriptors */ +#define SE_N_TASKFDS 8 /* max # of per-task stream */ + /* descriptors */ +#define SE_N_LINKS 32 /* max # of multiplexing links */ +#define SE_N_TIMEOUTS 32 /* max # of timeout requests */ +#define SE_N_BUFCALLS 32 /* max # of bufcall requests */ +#define SE_N_QUEUES 256 /* # of queues */ +#define SE_N_QBANDS (SE_N_QUEUES * 2) /* # of qbands */ +#define SE_N_MBLKS 512 /* # of message blocks */ +#define SE_PRI_BANDS NO /* Whether priority bands are desired */ +#define SE_STRLOG YES /* Whether the log facility is cnfgrd */ +#define SE_TMO_RES 2 /* pSE Timer resolution in ticks */ +#define SE_MAX_AUTOPUSH 10 /* Max # of autopush entries */ +#define SE_SIGHANDLER NULL /* pSE global signal handler */ +#define SE_LOG_BUFSIZE 100 /* Maximum size of the log message */ +#define SE_NUM_LOG_BUFFERS 25 /* Number of log buffs to be allocated*/ +#define SE_BUF_BORROW_LEVEL 0 /* The buffer borrowing level desired */ +#define SE_NO_GLOBAL_LOCKING NO /* Whether global locking is desired */ +#define SE_PCRASH_BUF_SIZE 8192 /* default pcrash buffer size */ +#define SE_HI_BUF_RESVN_PERCENT 12 /* Hi buffer reservation % */ +#define SE_MED_BUF_RESVN_PERCENT 13 /* Med buffer reservation % */ +#define SE_USE_MUTEX YES /* Use mutex locks */ +#define SE_GETTICKS_FN tm_getticks /* Use the default tm_getticks*/ + /* function. */ +#define SE_COMPAT_MODE 2 /* Compatibility mode Level. */ + +/*---------------------------------------------------------------------*/ +/* Following macro SE_PRINTF uses printf as the default print function.*/ +/* If User needs to use different function, then change the proto-type.*/ +/*---------------------------------------------------------------------*/ +extern int printf(const char *, ...); +#define SE_PRINTF printf /* pSE printf function */ + +/*---------------------------------------------------------------------*/ +/* Loader configuration parameters */ +/* */ +/* YES indicates for each module to be linked in. NO means do not link */ +/* object module loader into this application. */ +/* */ +/*---------------------------------------------------------------------*/ +#define LD_MAX_LOAD 8 /* Max. # of active loads */ +#define LD_ELF_MODULE NO /* ELF object-load-module */ +#define LD_SREC_MODULE NO /* SREC object-load-module */ +#define LD_COFF_MODULE NO /* COFF object-load-module */ +#define LD_IEEE_MODULE NO /* IEEE object-load-module */ +#define LD_IHEX_MODULE NO /* IHEX object-load-module */ + +/*---------------------------------------------------------------------*/ +/* pMONT+ configuration parameters - note that PM_DEV and PM_BAUD are */ +/* only relevant to serial communication (PM_CMODE = 2) */ +/*---------------------------------------------------------------------*/ +#define PM_CMODE 1 /* 1 = networking, 2 = serial */ + +/*---------------------------------------------------------------------*/ +/* PM_DEV down uses a macro to calculate the channel number, which is */ +/* SERIAL_DRVRNUM(0). This means Low-Level Driver 0 (1) is used for */ +/* default PM_DEV. If you need to change this to another Low-Level */ +/* Serial Driver, change "0" in the macro SERIAL_DRVRNUM(0) to the */ +/* number of the driver you want. */ +/* */ +/* Consult the "README" file in BSP directory for number of different */ +/* drivers supported and for the SERIAL_DRVRNUM mapping for those */ +/* drivers. */ +/*---------------------------------------------------------------------*/ +#define PM_DEV (2 + SERIAL_DRVRNUM(0)) + /* Minor Device number for serial */ + /* channel if used */ + +#define PM_BAUD 9600 /* Baud rate for serial chnl */ +#define PM_TRACE_BUFF 0 /* Address of trace buffer -- */ + /* Allocated by pSOSystem if 0 */ +#define PM_TRACE_SIZE 0x6000 /* Size of trace buffer */ +#define PM_TIMER NO /* 2nd timer for finer time */ + /* within data collection */ + +/*---------------------------------------------------------------------*/ +/* General Serial Block Configuration Parameters */ +/* */ +/* GS_MBLKS defines the number of the message blocks. To allocate a */ +/* data block (GS buffer), a message block is needed. Usually, the */ +/* number of the message blocks will be the same as the total number */ +/* of the data blocks, but it can be differenet. If GS_MBLKS is not */ +/* defined or it is zero, the GSblkSetup() will use the total number */ +/* of the data blocks as the number of the message blocks. */ +/*---------------------------------------------------------------------*/ +#define GS_BUFS_0 64 /* number of 0 length buffers */ +#define GS_BUFS_32 128 /* number of 32 byte buffers */ +#define GS_BUFS_64 128 /* number of 64 byte buffers */ +#define GS_BUFS_128 256 /* number of 128 byte buffers */ +#define GS_BUFS_256 32 /* number of 256 byte buffers */ +#define GS_BUFS_512 32 /* number of 512 byte buffers */ +#define GS_BUFS_1024 16 /* number of 1k byte buffers */ +#define GS_BUFS_2048 16 /* number of 2k byte buffers */ +#define GS_BUFS_4096 8 /* number of 4k byte buffers */ + +#define GS_MBLKS 680 /* number of message blocks */ +#define GS_MAX_BUFS 9 /* max number of serial buffer types */ + +/***********************************************************************/ +/* */ +/* TCP/IP for OpEN configuration parameters */ +/* */ +/***********************************************************************/ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for the Network layer (IP) */ +/*---------------------------------------------------------------------*/ +#define OTCP_IPMAX 8 /* Max # of open IP device */ +#define OTCP_IPNINTERFACES 4 /* Max # of network interfaces */ +#define OTCP_IPNROUTES 64 /* Max #of routing tbl entries */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for ARP */ +/*---------------------------------------------------------------------*/ +#define OTCP_ARPMAX 8 /* Max # of open ARP device */ +#define OTCP_ARPNINTERFACES 4 /* Max # of ARP interfaces */ +#define OTCP_ARPNENTRIES 32 /* Max # of ARP table entries */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for TCP */ +/*---------------------------------------------------------------------*/ +#define OTCP_TCPMAX 64 /* Max # of open TCP device */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for UDP */ +/*---------------------------------------------------------------------*/ +#define OTCP_UDPMAX 32 /* Max # of open UDP device */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for RAW */ +/*---------------------------------------------------------------------*/ +#define OTCP_RAWMAX 32 /* Max # of open RAW device */ + +/*---------------------------------------------------------------------*/ +/* Configurable parameters for LOOP */ +/*---------------------------------------------------------------------*/ +#define OTCP_LOOPMAX 2 /* Max # of open LOOP device */ + + + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_CONF_H */ + diff --git a/h/wrn/wm/util/port/mac/emissary.h b/h/wrn/wm/util/port/mac/emissary.h new file mode 100644 index 0000000..b45c00d --- /dev/null +++ b/h/wrn/wm/util/port/mac/emissary.h @@ -0,0 +1,113 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/mac/emissary.h,v 1.1.1.1 2001/11/05 17:47:12 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1992-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: emissary.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:12 tneale + * Tornado shuffle + * + * Revision 1.3 2001/01/19 22:23:01 paul + * Update copyright. + * + * Revision 1.2 2000/03/17 00:10:15 meister + * Update copyright message + * + * Revision 1.1 1998/02/25 04:56:52 sra + * Update copyrights. + * + * Revision 1.0 1997/08/08 22:11:16 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.3 1997/03/20 06:57:56 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.1 1996/10/28 20:35:56 sar + * Initial version + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Pathname separator character. + */ +#define EMISSARY_PATH_SEPARATOR ':' + +#if __option(profile) +#include +#endif + +/* + * I don't understand how the Macintosh works well enough to know + * if these are the right values in all cases. Change them if not. + * + * If you don't want the file type and file creator stuff at all, + * define these macros to expand to nothing. + */ +#if 1 +#define EMISSARY_MACINTOSH_SET_FILE_TYPE \ + { extern long _ftype; _ftype = 'TEXT'; } +#define EMISSARY_MACINTOSH_SET_FILE_CREATOR \ + { extern long _fcreator; _fcreator = 'MPS '; } +#else +#define EMISSARY_MACINTOSH_SET_FILE_TYPE +#define EMISSARY_MACINTOSH_SET_FILE_CREATOR +#endif + +/* + * OS-specific initialization code for the Macintosh with Think C. + * This is ugly, if you can think of a better way to do it that + * doesn't embed Mac-specific code in the guts of the MIB compiler, + * tell us. + */ + +#if __option(profile) +#define EMISSARY_MACINTOSH_INITPROFILE InitProfile(512, 200) +#else +#define EMISSARY_MACINTOSH_INITPROFILE +#endif + +#define EMISSARY_OS_DEPENDENT_INIT(argc,argv) \ + do { \ + extern struct __copt console_options; \ + console_options.nrows = 25; \ + argc = ccommand(&argv); \ + EMISSARY_MACINTOSH_INITPROFILE; \ + EMISSARY_MACINTOSH_SET_FILE_TYPE; \ + EMISSARY_MACINTOSH_SET_FILE_CREATOR; \ + } while (0) diff --git a/h/wrn/wm/util/port/mach386/attache.h b/h/wrn/wm/util/port/mach386/attache.h new file mode 100644 index 0000000..efadfd7 --- /dev/null +++ b/h/wrn/wm/util/port/mach386/attache.h @@ -0,0 +1,297 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/mach386/attache.h,v 1.1.1.1 2001/11/05 17:47:12 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: attache.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:12 tneale + * Tornado shuffle + * + * Revision 1.7 2001/01/19 22:23:01 paul + * Update copyright. + * + * Revision 1.6 2000/03/17 00:10:19 meister + * Update copyright message + * + * Revision 1.5 1998/03/12 18:23:43 meister + * GLUE_IPSEC_RCV_SA_NOTUNNEL() + * + * Revision 1.4 1998/03/11 21:11:12 meister + * Added some parameters to some IPSEC glue functions + * + * Revision 1.3 1998/02/27 22:30:09 meister + * Added IPSEC glue function defs + * + * Revision 1.2 1998/02/25 04:56:52 sra + * Update copyrights. + * + * Revision 1.1 1998/02/18 22:34:58 sra + * Add ip_loopback(), eradicate glue_pkt_handle(). + * + * Revision 1.0 1997/08/08 22:11:16 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.3 1997/03/20 06:58:06 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.1 1996/10/28 20:30:07 sar + * Initial version + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* Previous revision history from mach386/attache.h + * with release update messages removed + * + * Revision 2.4 1994/12/20 21:19:11 lowell + * worked around problems between Mach's memory.h and + * the builtin versions provided by GCC... + * + * Revision 2.3 1994/09/04 23:55:50 sra + * Get rid of most of the ancient NO_PP cruft. + * + * Revision 2.2 1994/09/04 06:13:38 sra + * Clean up antique type names and install macros. + * + * Revision 1.6 1993/08/03 23:40:54 dab + * CONFIG_PREAMBLE is either defined or not, so use #ifdef + * + * Revision 1.5 1993/08/02 21:58:54 dab + * moved MEM* and STR* to the first section + * + * Revision 1.4 1993/04/21 15:30:10 dab + * Default configuration moved to + * + * Revision 1.2 1993/02/28 17:25:09 dab + * If set SGRP to 1 instead of just on then matches what happens in + * envoy/h/asn1conf.h. + * + */ + +#ifdef CONFIG_PREAMBLE + +/* Things which MAY be defined in here: + * + * MAX_PACKETS + * STATIC_PACKETS + * MAX_ARP_ENTRIES + * ARP_EXPIRATION + * ARP_TIMER_FREQUENCY + * ARP_TIMEOUT + * PRINTF + * DEFAULT_IP_TTL + * MAX_REASM + * IP_REASM_TIMEOUT + * TFTP_TIMEOUT + */ + +/* Define MAX_PACKETS in order to preallocate packets using glue_alloc(). + * MAX_PACKETS value is the number of packets to preallocate. + * + * Define STATIC_PACKETS to have MAX_PACKETS packet buffers allocated + * from a static array. STATIC_PACKETS should be the packet size + * to allocate. + */ +#define MAX_PACKETS 20 +/*#define STATIC_PACKETS 1536 */ + +/* Define IP_MAX_PKTSIZE to be the maximum reassembly buffer size. + * This isn't the largest packet that can be reassembled because some of the + * buffer space is taken up with other things. + * Also, ptcp_init() will preallocate packets of this size at startup + */ +#ifdef STATIC_PACKETS +#define IP_MAX_PKTSIZE STATIC_PACKETS +#else +#define IP_MAX_PKTSIZE 1536 +#endif + +/* Declarations for various standard C functions needed by Attache. + * These later may be declared by just including system include files + * or the functions may be explcitly declared here. The standard C + * functions needed by Attache are: + * + * memcpy memcmp memset strcmp strcpy strlen + * + */ + +/* The standard C functions provided by Mach 386 are declared with + * char* instead of void*. Rather than using Mach's declarations, + * we'll use gcc's builtin functions where they're available: + * memset() isn't a builtin, so we'll just define it here, gcc-style. */ +void * memset(void *, int, size_t); + + +#include + +/* If you're using Attache along with Envoy, these macros will be + * needed in envoy.h as well. Make sure they are identical so the + * C-preprocessor doesn't complain about them being redefined. */ +#define MEMCPY(dst, src, n) memcpy((char *)(dst), (char *)(src), n) +#define MEMCMP(s1, s2, n) memcmp((char *)(s1), (char *)(s2), n) +#define MEMSET(dst, val, n) memset((char *)(dst), val, n) + + +#else /* CONFIG_PREAMBLE */ + + +/* glue routines to interface to the outside world. + */ +int glue_intlock (int); /* lock interrupts, return old state */ + +/* generic memory allocation routines + */ +#define GLUE_ALLOC(len) malloc(len) +#define GLUE_FREE(mem) free(mem) + +/* Define this one if you want your own packet allocation routine. Both + * GLUE_PKTALLOC() and GLUE_PKTFREE() must be defined or undefined. + */ +/* #define GLUE_PKTALLOC(len) gettapkt(len) */ +/* #define GLUE_PKTFREE(p) givepkt(p) */ + +/* Define GLUE_PKTPRIVATE_FREE(x) to be a routine to free the pkt_private + * value, if you need to do that. + */ +/* #define GLUE_PKTPRIVATE_FREE(x) priv_free(x) */ + +/* Define GLUE_CKSUM to be a function that computes the IP checksum + * We provide a C routine in mach386/glue.c + */ +#define GLUE_CKSUM(buf, word_count) cksum((bits16_t *)(buf), (word_count)) + +/* Define GLUE_SWAP16 and GLUE_SWAP32 iff your machine is little endian and + * thus SWAP16 and SWAP32 are defined. These functions are provided in + * mach386/glue.c + */ +#ifdef SWAP16 +#define GLUE_SWAP16(x) swap16(x) +#endif /* SWAP16 */ + +#ifdef SWAP32 +#define GLUE_SWAP32(x) swap32(x) +#endif /* SWAP32 */ + +/* GLUE time functions + * + * GLUE_NOW() returns a 32 bit number in milliseconds. It's used as a + * relative, not absolute, number. Just keep it to whatever resolution is + * convenient, but make sure it is a monotonically increasing number. + */ +#define GLUE_NOW() glue_now() + +/* GLUE_CALLIN() schedules a function to be called in ms milliseconds. + * It only has to remember one function; when it is called while a call is + * already scheduled, the previous settings can be forgotten. + * It should guarantee that when the function is called, GLUE_NOW() will + * be at least ms greater than it was when GLUE_CALLIN() was called (ie: + * make sure you call later rather than earlier) + * Also, be sure that from whatever context handler is called, it's + * safe to make calls into the protocol stack, for instance, into udp_sendto() + * or similar functions. + */ +#define GLUE_CALLIN(ms, handler) callin(ms, handler) + +/* Declare all the previously used glue functions */ +bits16_t cksum (bits16_t *, unsigned); +bits16_t swap16 (bits16_t); +bits32_t swap32 (bits32_t); +bits32_t glue_now (void); +void callin (bits32_t, void (*)(void)); +void *malloc (unsigned); +void free (void *); + + +#ifdef ATTACHE_IPSEC_H +#define GLUE_IPSEC_SA_EXPIRED(W,X,Y,Z) \ + glue_ipsec_sa_expired(W,X,Y,Z) +extern void glue_ipsec_sa_expired (ipsec_sa_dir_t, ipaddr_t *, + bits32_t, bits8_t); + +#define GLUE_IPSEC_SND_PKT_DENIED(W,X,Y,Z) \ + glue_ipsec_snd_pkt_denied((W),(X),(Y),(Z)) + +extern void glue_ipsec_snd_pkt_denied(packet *, ipaddr_t *, ipaddr_t *, int); + + +#define GLUE_IPSEC_RCV_PKT_BADSPI(V,W,X,Y,Z) \ + glue_ipsec_rcv_pkt_badspi((V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_pkt_badspi(packet *, ipaddr_t *, ipaddr_t *, + bits32_t, bits8_t); + +#define GLUE_IPSEC_RCV_PKT_NOTPARTY(V,W,X,Y,Z) \ + glue_ipsec_rcv_pkt_notparty((V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_pkt_notparty(packet *, ipaddr_t *, ipaddr_t *, + bits32_t, bits8_t); + + +#define GLUE_IPSEC_RCV_TUNPKT_NOTIP(U,V,W,X,Y,Z) \ + glue_ipsec_rcv_tunpkt_notip((U),(V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_tunpkt_notip(packet *, packet *, ipaddr_t *, + ipaddr_t *, bits32_t, bits8_t); + +#define GLUE_IPSEC_RCV_TUNPKT_NOTPARTY(S,T,U,V,W,X,Y,Z) \ + glue_ipsec_rcv_tunpkt_notparty((S),(T),(U),(V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_tunpkt_notparty(packet *, ipaddr_t *, ipaddr_t *, + packet *, ipaddr_t *, ipaddr_t *, + bits32_t, bits8_t); + + +#define GLUE_IPSEC_RCV_SA_NOTUNNEL(V,W,X,Y,Z) \ + glue_ipsec_rcv_sa_notunnel((V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_sa_notunnel(packet *, ipaddr_t *, ipaddr_t *, + bits32_t, bits8_t); + + +#define GLUE_IPSEC_RCV_PKT_BADAH(V,W,X,Y) \ + glue_ipsec_rcv_pkt_badah((V),(W),(X),(Y)) + +extern void glue_ipsec_rcv_pkt_badah(packet *, ipaddr_t *, ipaddr_t *, + bits32_t); + +#define GLUE_IPSEC_RCV_PKT_DENIED(V,W,X,Y,Z) \ + glue_ipsec_rcv_pkt_denied((V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_pkt_denied(packet *, ipaddr_t *, ipaddr_t *, + ipsec_policy_flags_t, bits16_t); + +#endif /* ATTACHE_IPSEC */ + + +#endif /* CONFIG_PREAMBLE */ + + + + + + + diff --git a/h/wrn/wm/util/port/mach386/common.h b/h/wrn/wm/util/port/mach386/common.h new file mode 100644 index 0000000..db9d195 --- /dev/null +++ b/h/wrn/wm/util/port/mach386/common.h @@ -0,0 +1,54 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/mach386/common.h,v 1.1.1.1 2001/11/05 17:47:12 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: common.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:12 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:23:01 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:10:19 meister + * Update copyright message + * + * Revision 1.2 1998/02/25 04:56:53 sra + * Update copyrights. + * + * Revision 1.1 1997/08/21 17:23:45 sra + * Begin moving configuration stuff that's common to all products to common.h + * Minor cleanups to common/lib/prng.c. Add pnrg seed function to snarkbsd. + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* + * NIY.... + */ + +#ifdef CONFIG_PREAMBLE + +#else /* CONFIG_PREAMBLE */ + +#endif /* CONFIG_PREAMBLE */ diff --git a/h/wrn/wm/util/port/mach386/emissary.h b/h/wrn/wm/util/port/mach386/emissary.h new file mode 100644 index 0000000..efd19f1 --- /dev/null +++ b/h/wrn/wm/util/port/mach386/emissary.h @@ -0,0 +1,129 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/mach386/emissary.h,v 1.1.1.1 2001/11/05 17:47:12 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1992-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: emissary.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:12 tneale + * Tornado shuffle + * + * Revision 1.3 2001/01/19 22:23:02 paul + * Update copyright. + * + * Revision 1.2 2000/03/17 00:10:19 meister + * Update copyright message + * + * Revision 1.1 1998/02/25 04:56:53 sra + * Update copyrights. + * + * Revision 1.0 1997/08/08 22:11:17 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.3 1997/03/20 06:58:06 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.1 1996/10/28 20:30:07 sar + * Initial version + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* + * The headers for this system are really screwed up, particularly + * when dealing with two different versions of gcc in ANSI mode. + * This will never be pretty, just grit your teeth. + */ + +#define __GCC2__ (defined(__GNUC__) && __GNUC__ >= 2) + +#include +#include +#include + +#if !__GCC2__ +#include +#endif + +#include + +#if !__GCC2__ +#include +#endif + +#include +#include +#include +#include +#include + +#ifndef SEEK_SET +#define SEEK_SET 0 +#endif + +/* + * This is a pain, but the Mach386 header files don't declare this stuff + * if you're compiling with -traditional, and we want to avoid getting + * compiler warnings. It seems to be kind of arbitrary as to which functions + * are actually declared in the header files in this case. + */ +#if !__STDC__ +extern int fflush(FILE*); +extern void exit(int); +extern int ungetc(int, FILE*); +extern int atoi(char *); +extern void perror(char *); +extern int fclose(FILE*); +extern int printf(char*,...); +extern int access(char *, int); +extern int _filbuf(FILE*); +extern void free(void *); +#endif /* !__STDC__ */ + +/* + * Definitions to suppress warnings from dumb system header files. + */ +#define MEMCPY(x,y,z) memcpy((char *) (x), (const char *) (y), (int) (z)) +#define MEMSET(x,y,z) memset((char *) (x), (int) (y), (int) (z)) +#define MEMCMP(x,y,z) memcmp((const char *) (x), (const char *) (y), (int) (z)) +#define MEMCHR(x,y,z) memchr((const char *) (x), (int) (y), (int) (z)) + +/* + * These should be in the files , , and , + * but the versions of those that gcc-2.5.5 generated on Mach386 have + * everything conditionalized for C++ only, so they're useless. Sigh. + */ +#if __GCC2__ +extern void *memchr(const void *, int, long unsigned int); +extern int memcmp(const void *, const void *, long unsigned int); +extern void *memcpy(void *, const void *, long unsigned int); +extern void *memset(void *, int, long unsigned int); +extern char *getenv (const char *); +extern int atoi(const char *); +extern void *malloc(long unsigned int); +extern void free(void *); +extern void *realloc(void *, long unsigned int); +#endif diff --git a/h/wrn/wm/util/port/mach386/envoy.h b/h/wrn/wm/util/port/mach386/envoy.h new file mode 100644 index 0000000..d67112a --- /dev/null +++ b/h/wrn/wm/util/port/mach386/envoy.h @@ -0,0 +1,206 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/mach386/envoy.h,v 1.1.1.1 2001/11/05 17:47:12 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: envoy.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:12 tneale + * Tornado shuffle + * + * Revision 1.7 2001/01/19 22:23:02 paul + * Update copyright. + * + * Revision 1.6 2000/03/17 00:10:19 meister + * Update copyright message + * + * Revision 1.5 1998/06/21 21:53:05 sar + * Moved the porting stuff that is common to all of our demos to generic/envoy.h + * and included that file here. + * + * Revision 1.4 1998/06/20 18:29:20 sar + * Update for use with v3, also made it similar to other envoy.h files + * + * Revision 1.3 1998/02/25 04:56:54 sra + * Update copyrights. + * + * Revision 1.2 1997/11/04 00:29:36 sar + * Changed the agentx sub agent timeout period from 10000 (10 seconds) + * which was used for testing to 1000 (1 second). + * + * Revision 1.1 1997/10/29 01:31:29 sar + * Updated the master agent installation option. + * + * Revision 1.0 1997/08/08 22:11:17 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.4 1997/03/20 06:58:07 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.3 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.2 1997/01/15 22:13:32 sar + * moved the location of nvutils.h to snark/snmptalk + * + * Revision 0.1 1996/10/28 20:30:07 sar + * Initial version + * + * Revision 3.2 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 3.1 1995/09/27 21:21:17 lowell + * Ifdeffed the example locking code so it won't conflict with the defaults + * if we don't have locking turned on. + * (per sar's changes to the msdos example code) + * + * Revision 3.0 1995/05/10 22:37:24 sra + * Release 3.0. + * + * Revision 2.9 1995/05/01 20:59:29 sra + * Have to test CONFIG_PREAMBLE with #ifdef, not #if. + * + * Revision 2.8 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 2.7 1994/12/20 21:19:11 lowell + * worked around problems between Mach's memory.h and + * the builtin versions provided by GCC... + * + * Revision 2.6 1994/11/01 18:02:55 sar + * Updated *_add_mod to include a flags argument. + * + * Revision 2.5 1994/10/18 15:52:03 sar + * Modfied the calls for the new nvutils routines. + * + * Revision 2.4 1994/09/04 23:55:50 sra + * Get rid of most of the ancient NO_PP cruft. + * + * Revision 2.3 1994/05/12 17:28:21 sar + * moved the include for nvutils.h so it is available to all who need it. + * + * Revision 2.2 1994/05/10 20:43:24 sar + * Moved some view stuff around so it is available in other than v2 settings. + * + * Revision 2.1 1993/08/06 22:03:40 sra + * Release 2.0. + * + * Revision 1.8 1993/08/02 22:05:36 dab + * don't use #ifdef for INSTALL_ options + * + * Revision 1.7 1993/06/02 23:24:44 dab + * make MEMCMP identical to attache.h so the compiler doesn't complain. + * + * Revision 1.6 1993/05/13 22:27:54 sar + * added MEMCMP + * + * Revision 1.5 1993/05/13 18:47:44 sar + * Added macros for managing file impelementation of non volatile memory. + * + * Revision 1.4 1993/04/22 22:58:03 sar + * Got rid of pread and pwrite and some other macros, modified TIME + * to be SNMP_PARTYTIME + * + * Revision 1.3 1993/03/01 18:38:08 dab + * Added MEMSET and MEMCPY macros. + * + * Revision 1.2 1993/03/01 17:20:43 dab + * Added include of to get strlen() declaration. + * + * Revision 1.1 1993/02/26 22:06:21 dab + * Initial revision + * + * Revision 1.1 1993/02/26 17:26:21 dab + * Initial revision + * + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/***************************************************************** + + This is the platform specific part of envoy.h for use with the + example code. It contains only the platform specific pieces of + the port code. The common porting code is in generic/envoy.h. + + In general customers will have one envoy.h file per platform + that combines this file and the platform specific information, + we use two files as there is a lot of shared code between our + demos. + +*****************************************************************/ + +#ifdef CONFIG_PREAMBLE + +/***************************************************************** + + System Includes: + + Envoy uses memcpy(), memset(), and strlen(). The appropriate + include file should be put here to see that these routines are + properly declared. If no such include file exists on the system + then declare memcpy() and memset() here directly. Envoy also + uses min() and max(). Include the system's definition or use the + macros supplied below. +*****************************************************************/ + +void * memset(void *, int, size_t); +#include + +/***************************************************************** + Memory allocation routines. Envoy needs to allocate memory to + decode the packet into and also to store the response data + + Make sure that the routines used by the SNMP_memory_alloc() and + SNMP_memory_free() macros are declared. If system memory routines + are used (e.g. malloc() and free()) then include the appropriate + system header file here. + + On MACH 386 the system include files don't pass gcc's -pedentic + switch. This is just too painful to watch so I just declare malloc + and free myself. +*****************************************************************/ + +extern void *malloc (unsigned); +extern void free (void *); + +#define SNMP_memory_alloc(need) malloc(need) +#define SNMP_memory_free(buf) free(buf) + +/***************************************************************** + These macros fix up Mach 386's improper declaration of the mem* + routines. If you're using Envoy with Attache then these same macros + need to be defined in attache.h as well. Make sure they are identical + otherwise the C-preprocessor will complain about redefining them. +*****************************************************************/ +#define MEMCPY(dst, src, n) memcpy((char *)(dst), (char *)(src), n) +#define MEMSET(dst, val, n) memset((char *)(dst), val, n) +#define MEMCMP(dst, src, n) memcmp((char *)(dst), (char *)(src), n) + +#include + +#else /* config preamble */ + +#include + +#endif /* CONFIG_PREAMBLE */ diff --git a/h/wrn/wm/util/port/mach386/oemtypes.h b/h/wrn/wm/util/port/mach386/oemtypes.h new file mode 100644 index 0000000..9227d98 --- /dev/null +++ b/h/wrn/wm/util/port/mach386/oemtypes.h @@ -0,0 +1,69 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/mach386/oemtypes.h,v 1.1.1.1 2001/11/05 17:47:12 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: oemtypes.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:12 tneale + * Tornado shuffle + * + * Revision 1.3 2001/01/19 22:23:02 paul + * Update copyright. + * + * Revision 1.2 2000/03/17 00:10:19 meister + * Update copyright message + * + * Revision 1.1 1998/02/25 04:56:54 sra + * Update copyrights. + * + * Revision 1.0 1997/08/08 22:11:18 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.3 1997/03/20 06:58:07 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.1 1996/10/28 20:30:07 sar + * Initial version + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* + * We need to supply size_t. Everything else in will + * work fine on Mach386. + */ + +#include + +/* + * For use with Emissary. + */ + +#define __GCC2__ (defined(__GNUC__) && __GNUC__ >= 2) +#if __GCC2__ +#include +#endif diff --git a/h/wrn/wm/util/port/mach386/snmptalk.h b/h/wrn/wm/util/port/mach386/snmptalk.h new file mode 100644 index 0000000..1cb286c --- /dev/null +++ b/h/wrn/wm/util/port/mach386/snmptalk.h @@ -0,0 +1,71 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/mach386/snmptalk.h,v 1.1.1.1 2001/11/05 17:47:12 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: snmptalk.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:12 tneale + * Tornado shuffle + * + * Revision 1.3 2001/01/19 22:23:02 paul + * Update copyright. + * + * Revision 1.2 2000/03/17 00:10:19 meister + * Update copyright message + * + * Revision 1.1 1998/02/25 04:56:55 sra + * Update copyrights. + * + * Revision 1.0 1997/08/08 22:11:18 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.4 1997/03/20 06:58:08 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.3 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.2 1996/10/30 22:08:57 sar + * removed bsd_release + * + * Revision 0.1 1996/10/28 20:30:07 sar + * Initial version + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + +#include + +/* defines for nvutils for file manipulation */ +#define SNMP_READONLY "r" +#define SNMP_READPLUS "r+" +#define SNMP_WRITEPLUS "w+" +#define SNMP_REMOVE_FILE(fname) unlink(fname) + +/* Mach doesn't have these routines so we provide them. */ +#define NEEDS_STRDUP +#define NEEDS_STRTOL +#define NEEDS_STRTOUL + +#define strnicmp strncasecmp +#define stricmp strcasecmp diff --git a/h/wrn/wm/util/port/mach386/telnet.h b/h/wrn/wm/util/port/mach386/telnet.h new file mode 100644 index 0000000..3c6fe43 --- /dev/null +++ b/h/wrn/wm/util/port/mach386/telnet.h @@ -0,0 +1,64 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/mach386/telnet.h,v 1.1.1.1 2001/11/05 17:47:12 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: telnet.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:12 tneale + * Tornado shuffle + * + * Revision 1.3 2001/01/19 22:23:02 paul + * Update copyright. + * + * Revision 1.2 2000/03/17 00:10:20 meister + * Update copyright message + * + * Revision 1.1 1998/02/25 04:56:55 sra + * Update copyrights. + * + * Revision 1.0 1997/08/08 22:11:18 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.3 1997/03/20 06:58:02 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* Things which MAY be defined in here: + * + * TN_LOCAL_NEWLINE + * TN_RECV_LOCAL_NEWLINE + * TN_SEND_LOCAL_NEWLINE + * TN_INITIAL_ACTIVE_WINDOW_SIZE + * TN_INITIAL_PASSIVE_WINDOW_SIZE + * GLUE_TN_WINDOW_SIZE + */ + +/* + * All of the defaults are in attache/h/tnconfig.h. + */ diff --git a/h/wrn/wm/util/port/msdos/attache.h b/h/wrn/wm/util/port/msdos/attache.h new file mode 100644 index 0000000..660d30d --- /dev/null +++ b/h/wrn/wm/util/port/msdos/attache.h @@ -0,0 +1,356 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/msdos/attache.h,v 1.2 2002/02/26 18:22:53 josh Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: attache.h,v $ + * Revision 1.2 2002/02/26 18:22:53 josh + * updating paths in port files + * + * Revision 1.1.1.1 2001/11/05 17:47:12 tneale + * Tornado shuffle + * + * Revision 1.12 2001/01/19 22:23:03 paul + * Update copyright. + * + * Revision 1.11 2000/03/17 00:10:25 meister + * Update copyright message + * + * Revision 1.10 1999/04/28 23:53:25 sra + * Clean up various minor installation option glitches. + * + * Revision 1.9 1998/09/06 08:11:06 sra + * Packet filtering hooks in Attache, rudimentary firewall + * implementation in Snark. + * + * Revision 1.8 1998/03/12 18:23:42 meister + * GLUE_IPSEC_RCV_SA_NOTUNNEL() + * + * Revision 1.7 1998/03/11 21:08:28 meister + * Added extra parameters to a couple of IPSEC glue macros + * + * Revision 1.6 1998/03/03 15:26:16 mrf + * Comment out PRINTF declarations. + * + * Revision 1.5 1998/02/28 01:40:00 meister + * Added stdio and a PRINTF + * + * Revision 1.4 1998/02/27 22:31:01 meister + * Added ipsec glue functions + * + * Revision 1.3 1998/02/25 04:56:56 sra + * Update copyrights. + * + * Revision 1.2 1998/02/18 22:34:59 sra + * Add ip_loopback(), eradicate glue_pkt_handle(). + * + * Revision 1.1 1997/09/15 15:48:27 sra + * GLUE_NOW() migration version skew. + * + * Revision 1.0 1997/08/08 22:11:19 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.5 1997/03/20 06:57:47 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.4 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.3 1997/01/08 01:08:19 sar + * as part of changing snmptalk to use the snark suite we can remove + * the ifdefs for snark in this file. + * + * Revision 0.2 1996/10/26 00:43:57 sar + * put the #else for config_preamble in the right place + * + * Revision 0.1 1996/10/23 00:12:55 sar + * *** empty log message *** + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* previous history from attache/port/msdos/attache.h + * + * Revision 3.1 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 3.0 1995/05/10 22:37:24 sra + * Release 3.0. + * + * Revision 2.4 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 2.3 1994/09/04 23:55:50 sra + * Get rid of most of the ancient NO_PP cruft. + * + * Revision 2.2 1994/09/04 06:13:38 sra + * Clean up antique type names and install macros. + * + * Revision 2.1 1993/08/06 22:03:43 sra + * Release 2.0. + * + * Revision 1.8 1993/08/03 23:19:38 dab + * CONFIG_PREAMBLE is either defined or not, so use ifdef + * + * Revision 1.7 1993/08/02 21:59:13 dab + * moved MEM* and STR* to the first section + * + * Revision 1.6 1993/05/20 20:22:21 sar + * Removed memory.h if the compiler is watcom or intel 960 + * + * Revision 1.5 1993/05/17 20:11:55 sar + * Added an ifdef for zortech to remove the include of memory.h and + * to add the define of NEEDS_STR{DUP ICMP NICMP} as they weren't + * available. + * + * Revision 1.4 1993/04/21 15:30:59 dab + * Default configuration moved to + * + * Revision 1.3 1993/02/28 18:28:38 dab + * Changed "#define SGRP" to "#define SGRP 1" so it matches envoy/h/asn1conf.h + * so we don't get warnings. + * Added include of and . + * + * Revision 1.2 1993/02/27 17:31:59 dab + * Merged in stuff from glue.h + * + * Revision 1.1 1993/02/18 21:50:33 dab + * Initial revision + */ + +#ifdef CONFIG_PREAMBLE + + +/* Things which MAY be defined in here: + * + * MAX_PACKETS + * STATIC_PACKETS + * MAX_ARP_ENTRIES + * ARP_EXPIRATION + * ARP_TIMER_FREQUENCY + * ARP_TIMEOUT + * PRINTF + * DEFAULT_IP_TTL + * MAX_REASM + * IP_REASM_TIMEOUT + * TFTP_TIMEOUT + */ + + +/* Define MAX_PACKETS in order to preallocate packets using glue_alloc(). + * MAX_PACKETS value is the number of packets to preallocate. + * + * Define STATIC_PACKETS to have MAX_PACKETS packet buffers allocated + * from a static array. STATIC_PACKETS should be the packet size + * to allocate. + */ +#define MAX_PACKETS 20 +/*#define STATIC_PACKETS 1536 */ + + +/* Define IP_MAX_PKTSIZE to be the maximum reassembly buffer size. + * This isn't the largest packet that can be reassembled because some of the + * buffer space is taken up with other things. + * Also, ptcp_init() will preallocate packets of this size at startup + */ +#ifdef STATIC_PACKETS +#define IP_MAX_PKTSIZE STATIC_PACKETS +#else +#define IP_MAX_PKTSIZE 1536 +#endif + +#define TCP_DEFAULT_MAX_RETRANSMISSIONS 0 + +#else /* CONFIG_PREAMBLE */ + +/* Declarations for various standard C functions needed by Attache. + * These later may be declared by just including system include files + * or the functions may be explcitly declared here. The standard C + * functions needed by Attache are: + * + * memcpy memcmp memset strcmp strcpy strlen + * + */ +/* microsoft and borland have a memory.h so include it */ +#if defined(INSTALL_on_microsoft) || defined(INSTALL_on_bcc) +#include +#endif + +#include +#include + +/* glue routines to interface to the outside world. */ + +/* lock interrupts, return old state */ +extern int glue_intlock (int); + +/* generic memory allocation routines */ +#define GLUE_ALLOC(len) ((void *) malloc(len)) +#define GLUE_FREE(mem) free((char *)(mem)) + +/* Define this one if you want your own packet allocation routine. Both + * GLUE_PKTALLOC() and GLUE_PKTFREE() must be defined or undefined. + */ +/* #define GLUE_PKTALLOC(len) gettapkt(len) */ +/* #define GLUE_PKTFREE(p) givepkt(p) */ + +/* Define GLUE_PKTPRIVATE_FREE(x) to be a routine to free the pkt_private + * value, if you need to do that. + */ +/* #define GLUE_PKTPRIVATE_FREE(x) priv_free(x) */ + +/* Define GLUE_CKSUM to be a function that computes the IP checksum + */ +#define GLUE_CKSUM(x, y) glue_cksum((bits16_t *)(x), (y)) + +/* Define GLUE_SWAP16 and GLUE_SWAP32 iff your machine is little endian and + * thus SWAP16 and SWAP32 are defined. Supplied are definitions for PC-DOS. + */ +#define GLUE_SWAP16(x) glue_swap16(x) +#define GLUE_SWAP32(x) glue_swap32(x) + +/* GLUE time functions + * + * GLUE_NOW() returns a 32 bit number in milliseconds. It's used as a + * relative, not absolute, number. Just keep it to whatever resolution is + * convenient, but make sure it is a monotonically increasing number. + */ +#ifndef GLUE_NOW +#define GLUE_NOW() glue_now() +#endif + +/* GLUE_CALLIN() schedules a function to be called in ms milliseconds. + * It only has to remember one function; when it is called while a call is + * already scheduled, the previous settings can be forgotten. + * It should guarantee that when the function is called, GLUE_NOW() will + * be at least ms greater than it was when GLUE_CALLIN() was called (ie: + * make sure you call later rather than earlier) + * Also, be sure that from whatever context handler is called, it's + * safe to make calls into the protocol stack, for instance, into udp_sendto() + * or similar functions. + */ +#define GLUE_CALLIN(x, y) glue_callin(x, y) + +/* here we include files that define functions (like malloc(), for instance) + * that may be glue routines or declare the functions directly + */ +#include + +extern bits32_t glue_now (void); + +extern bits16_t glue_cksum (bits16_t *, unsigned); +extern void glue_callin (bits32_t, void (*)(void)); +extern bits16_t glue_swap16 (bits16_t); +extern bits32_t glue_swap32 (bits32_t); + +#ifndef MEMCPY +#define MEMCPY(x, y, z) memcpy(x, y, z) +#endif +#ifndef MEMCMP +#define MEMCMP(x, y, z) memcmp(x, y, z) +#endif +#ifndef MEMSET +#define MEMSET(x, y, z) memset(x, y, z) +#endif +#ifndef STRCMP +#define STRCMP(x, y) strcmp(x, y) +#endif +#ifndef STRCPY +#define STRCPY(x, y) strcpy(x, y) +#endif +#ifndef STRLEN +#define STRLEN(x) strlen(x) +#endif + +/* Define PRINTF to build debugging/printing code +#ifndef PRINTF +#define PRINTF printf +#endif +*/ + +#ifdef ATTACHE_IPSEC_H + +#define GLUE_IPSEC_SA_EXPIRED(W,X,Y,Z) \ + glue_ipsec_sa_expired(W,X,Y,Z) +extern void glue_ipsec_sa_expired (ipsec_sa_dir_t, ipaddr_t *, + bits32_t, bits8_t); + +#define GLUE_IPSEC_SND_PKT_DENIED(W,X,Y,Z) \ + glue_ipsec_snd_pkt_denied((W),(X),(Y),(Z)) + +extern void glue_ipsec_snd_pkt_denied(packet *, ipaddr_t *, ipaddr_t *, int); + + +#define GLUE_IPSEC_RCV_PKT_BADSPI(V,W,X,Y,Z) \ + glue_ipsec_rcv_pkt_badspi((V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_pkt_badspi(packet *, ipaddr_t *, ipaddr_t *, + bits32_t, bits8_t); + +#define GLUE_IPSEC_RCV_PKT_NOTPARTY(V,W,X,Y,Z) \ + glue_ipsec_rcv_pkt_notparty((V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_pkt_notparty(packet *, ipaddr_t *, ipaddr_t *, + bits32_t, bits8_t); + +#define GLUE_IPSEC_RCV_SA_NOTUNNEL(V,W,X,Y,Z) \ + glue_ipsec_rcv_sa_notunnel((V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_sa_notunnel(packet *, ipaddr_t *, ipaddr_t *, + bits32_t, bits8_t); + + +#define GLUE_IPSEC_RCV_TUNPKT_NOTIP(U,V,W,X,Y,Z) \ + glue_ipsec_rcv_tunpkt_notip((U),(V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_tunpkt_notip(packet *, packet *, ipaddr_t *, + ipaddr_t *, bits32_t, bits8_t); + +#define GLUE_IPSEC_RCV_TUNPKT_NOTPARTY(S,T,U,V,W,X,Y,Z) \ + glue_ipsec_rcv_tunpkt_notparty((S),(T),(U),(V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_tunpkt_notparty(packet *, ipaddr_t *, ipaddr_t *, + packet *, ipaddr_t *, ipaddr_t *, + bits32_t, bits8_t); + +#define GLUE_IPSEC_RCV_PKT_BADAH(V,W,X,Y) \ + glue_ipsec_rcv_pkt_badah((V),(W),(X),(Y)) + +extern void glue_ipsec_rcv_pkt_badah(packet *, ipaddr_t *, ipaddr_t *, + bits32_t); + +#define GLUE_IPSEC_RCV_PKT_DENIED(V,W,X,Y,Z) \ + glue_ipsec_rcv_pkt_denied((V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_pkt_denied(packet *, ipaddr_t *, ipaddr_t *, + ipsec_policy_flags_t, bits16_t); + + +#endif /* ATTACHE_IPSEC */ + +#if defined(INSTALL_SNARK_FIREWALL) && INSTALL_SNARK_FIREWALL +#include +#endif + +#endif /* CONFIG_PREAMBLE */ diff --git a/h/wrn/wm/util/port/msdos/common.h b/h/wrn/wm/util/port/msdos/common.h new file mode 100644 index 0000000..5189478 --- /dev/null +++ b/h/wrn/wm/util/port/msdos/common.h @@ -0,0 +1,90 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/msdos/common.h,v 1.1.1.1 2001/11/05 17:47:12 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: common.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:12 tneale + * Tornado shuffle + * + * Revision 1.7 2001/01/19 22:23:03 paul + * Update copyright. + * + * Revision 1.6 2000/03/17 00:10:27 meister + * Update copyright message + * + * Revision 1.5 1998/06/21 21:43:51 sar + * Dos compilers seem to use stricmp and strnicmp instead of casecmp + * + * Revision 1.4 1998/02/25 04:56:57 sra + * Update copyrights. + * + * Revision 1.3 1997/12/02 16:15:15 mrf + * add GLUE_NOW definition to make prng.c build on DOS + * + * Revision 1.2 1997/10/29 20:32:33 sar + * Added memory.h for some compilers to get prototypes for mem functions. + * + * Revision 1.1 1997/08/21 17:23:46 sra + * Begin moving configuration stuff that's common to all products to common.h + * Minor cleanups to common/lib/prng.c. Add pnrg seed function to snarkbsd. + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* + * NIY.... + */ + +#ifdef CONFIG_PREAMBLE + +/* zortech, watcom and intel 960 don't have a memory.h so away it goes */ +#if (!defined(INSTALL_on_ztc) && !defined(INSTALL_on_watcom) && !defined(INSTALL_on_i960)) +#include +#endif /* INSTALL_on_ztc */ + +#ifndef STRICMP +#define STRICMP(x, y) stricmp(x, y) +#endif + +#ifndef STRNICMP +#define STRNICMP(x, y, z) strnicmp(x, y, z) +#endif + +#else /* CONFIG_PREAMBLE */ + +#ifndef GLUE_NOW +#define GLUE_NOW() glue_now() +extern bits32_t glue_now (void); +#endif + +#endif /* CONFIG_PREAMBLE */ + + + + + + + + + diff --git a/h/wrn/wm/util/port/msdos/decorum.h b/h/wrn/wm/util/port/msdos/decorum.h new file mode 100644 index 0000000..f38a05e --- /dev/null +++ b/h/wrn/wm/util/port/msdos/decorum.h @@ -0,0 +1,197 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/msdos/decorum.h,v 1.3 2003/01/15 14:00:26 josh Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1996-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: decorum.h,v $ + * Revision 1.3 2003/01/15 14:00:26 josh + * directory structure shifting + * + * Revision 1.2 2002/02/26 18:22:53 josh + * updating paths in port files + * + * Revision 1.1.1.1 2001/11/05 17:47:12 tneale + * Tornado shuffle + * + * Revision 2.7 2001/01/19 22:23:03 paul + * Update copyright. + * + * Revision 2.6 2000/03/17 00:10:27 meister + * Update copyright message + * + * Revision 2.5 1998/03/12 20:59:46 josh + * added string.h to prevent some compiler warnings + * + * Revision 2.4 1998/02/25 04:56:57 sra + * Update copyrights. + * + * Revision 2.3 1998/02/16 21:33:43 josh + * decorum port file now uses epilogue_char_t where appropriate + * + * Revision 2.2 1997/11/04 00:23:34 sar + * added memory.h for some compilers to get rid of some warnings. + * + * Revision 2.1 1997/09/15 22:32:59 josh + * include stdlib.h so we know how malloc() and free() are defined + * + * Revision 2.0 1997/09/11 15:08:17 josh + * updating version numbers for release + * + * Revision 1.0 1997/08/08 22:11:19 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.8 1997/08/05 19:23:36 josh + * updated for Decorum 2.0 -- new stuff added + * + * Revision 0.7 1997/03/20 06:57:48 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.6 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.5 1997/02/12 19:17:12 lowell + * refer to DECORUM_GET_RAWTIME + * + * Revision 0.4 1996/10/28 17:49:00 sar + * Added use of decorum_size_t + * + * Revision 0.3 1996/10/27 16:54:09 lowell + * ETC_STDIO_SIZE + * + * Revision 0.2 1996/10/26 23:03:18 lowell + * DECORUM_SENDBUF_LEN and ETC_STDIO_READ + * + * Revision 0.1 1996/10/23 00:12:55 sar + * *** empty log message *** + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +#if (!defined(decorum_inc)) +#define decorum_inc + +/* zortech, watcom and intel 960 don't have a memory.h so away it goes */ +#if (!defined(INSTALL_on_ztc) && !defined(INSTALL_on_watcom) && !defined(INSTALL_on_i960)) +#include +#endif /* INSTALL_on_ztc */ + +#include +#include +#include + +#include + +#ifndef DECORUM_ALLOC +#define DECORUM_ALLOC(x) ((void *) malloc(x)) +#endif +#ifndef DECORUM_FREE +#define DECORUM_FREE(x) (free((char *) (x))) +#endif + +/* This first should be the same as SNMP_MAX_PACKET_SIZE in envoy.h */ +#define DECORUM_MAX_PACKET_SIZE (1400) +#define DECORUM_DEFAULT_RECEIVE_BUFLEN (512) + +/* needed for OIDC_T definition */ +#if INSTALL_DECORUM_PROXY && (!defined(asn1conf_inc)) +#include +#endif + +/* Some input routines, these are provided but may be replaced with + more efficient implentations if desired */ +extern sbits16_t decorum_parse_sbits32 (epilogue_char_t *, + epilogue_char_t **, + sbits32_t *); +extern sbits16_t decorum_parse_bits32 (epilogue_char_t *, + epilogue_char_t **, + bits32_t *); +extern sbits16_t decorum_parse_hexstring (epilogue_char_t *, + epilogue_char_t *, + decorum_size_t); +#define ETC_STRING_GET_SBITS32 decorum_parse_sbits32 +#define ETC_STRING_GET_BITS32 decorum_parse_bits32 +#define ETC_STRING_GET_HEXSTRING decorum_parse_hexstring + +/* a routine to output a number to a byte string, used to create + file/stream names */ +#define ETC_STDIO_SPRINTF(buf, num, str) sprintf(buf, "%lu%s", num, str) + +/* Define the structure that will be used for holding output + until we are done */ +typedef FILE etc_stdio_t; + +/* Macros for opening, closing and removing a stream */ +#define ETC_STDIO_MODE_READ "r" +#define ETC_STDIO_MODE_WRITE "w+" + +#define ETC_STDIO_OPEN(fname, how) fopen(fname, how) +#define ETC_STDIO_CLOSE(outstream) fclose(outstream) +#define ETC_STDIO_REMOVE(fname) remove(fname) +#define ETC_STDIO_READ(instream, size, buf) \ + fread((buf), 1, (size), (instream)) +#define ETC_STDIO_WRITE(outstream, size, buf) \ + fwrite((buf), 1, (size), (outstream)) +extern bits32_t file_size_32(char * fname); +#define ETC_STDIO_SIZE(fname) (file_size_32(fname)) +#if 0 +extern void file_last_modified_time(char *, struct decorum_rawtime *); +#define ETC_STDIO_LAST_MODIFIED_TIME(fname, tvp) \ + (file_last_modified_time((fname), (tvp))) +#endif + +/* Define the base output routines */ +extern sbits16_t decorum_put_string (etc_stdio_t *, epilogue_char_t *, + decorum_size_t); +extern sbits16_t decorum_put_sbits32 (etc_stdio_t *, sbits32_t); +extern sbits16_t decorum_put_bits32 (etc_stdio_t *, bits32_t); +extern sbits16_t decorum_put_hex_string (etc_stdio_t *, bits8_t *, + decorum_size_t); +#define ETC_STDIO_PUT_STRING decorum_put_string +#define ETC_STDIO_PUT_SBITS32 decorum_put_sbits32 +#define ETC_STDIO_PUT_BITS32 decorum_put_bits32 +#define ETC_STDIO_PUT_HEX_STRING decorum_put_hex_string + +#if INSTALL_DECORUM_PROXY +/* Define a more complex output routine, this may use the + base routines (as the example code does) or may be more direct */ +extern sbits16_t decorum_put_oid (etc_stdio_t *, OIDC_T *, decorum_size_t); +#define ETC_STDIO_PUT_OID decorum_put_oid +#endif /* INSTALL_DECORUM_PROXY */ + +/* Define a string comparison routine */ +#define ETC_STRING_STRCASECMP stricmp + +/* Define a string length routine */ +#define ETC_STRING_STRLEN strlen + +/* Define a routine that gets the current time. */ +/* This is compiler dependent on MS-DOS. */ +#if 0 +#define DECORUM_GET_RAWTIME(timeval_p) msdos_glue_getime ((timeval_p)); +#endif +/* Define a routine that figgers out how big a buffer to use for a chunk + * of outgoing data. */ +#define DECORUM_SENDBUF_LEN(http_sb) (256) + +#endif /* #if (!defined(decorum_inc)) */ diff --git a/h/wrn/wm/util/port/msdos/emissary.h b/h/wrn/wm/util/port/msdos/emissary.h new file mode 100644 index 0000000..1acde3d --- /dev/null +++ b/h/wrn/wm/util/port/msdos/emissary.h @@ -0,0 +1,113 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/msdos/emissary.h,v 1.1.1.1 2001/11/05 17:47:12 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1992-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: emissary.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:12 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:23:03 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:10:27 meister + * Update copyright message + * + * Revision 1.2 1998/10/08 19:31:45 paul + * small syntax cleanup + * + * Revision 1.1 1998/02/25 04:56:57 sra + * Update copyrights. + * + * Revision 1.0 1997/08/08 22:11:20 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.4 1997/03/20 06:57:48 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.3 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.2 1996/10/28 17:42:54 mrf + * undefine MEM_AVAIL if we are on msvc4.0 (which has no _memavl()) + * + * Revision 0.1 1996/10/23 00:12:55 sar + * *** empty log message *** + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * WATCOM C/C++ 9.5 warns about constructs like "defined(foo) && foo", + * so explicitly zero all the compiler install tests we know it will find. + */ + +#ifndef INSTALL_on_bcc +#define INSTALL_on_bcc 0 +#endif + +#ifndef INSTALL_on_microsoft +#define INSTALL_on_microsoft 0 +#endif + +#ifndef INSTALL_on_microsoft +#define INSTALL_on_microsoft 0 +#endif + +#ifndef INSTALL_on_msvc40 +#define INSTALL_on_msvc40 0 +#endif + +#ifndef INSTALL_on_ztc +#define INSTALL_on_ztc 0 +#endif + +#if INSTALL_on_bcc +#include +#include +#define MEM_AVAIL() ((unsigned long) coreleft()) +#endif + +#if INSTALL_on_microsoft +#include +#include +#define MEM_AVAIL() ((unsigned long) _memavl()) +#endif + +/* No _memavl() on msvc40 */ +#if INSTALL_on_msvc40 +#undef MEM_AVAIL +#endif diff --git a/h/wrn/wm/util/port/msdos/envoy.h b/h/wrn/wm/util/port/msdos/envoy.h new file mode 100644 index 0000000..b972999 --- /dev/null +++ b/h/wrn/wm/util/port/msdos/envoy.h @@ -0,0 +1,228 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/msdos/envoy.h,v 1.1.1.1 2001/11/05 17:47:12 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: envoy.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:12 tneale + * Tornado shuffle + * + * Revision 1.6 2001/01/19 22:23:04 paul + * Update copyright. + * + * Revision 1.5 2000/03/17 00:10:27 meister + * Update copyright message + * + * Revision 1.4 1998/06/21 21:53:06 sar + * Moved the porting stuff that is common to all of our demos to generic/envoy.h + * and included that file here. + * + * Revision 1.3 1998/02/25 04:56:58 sra + * Update copyrights. + * + * Revision 1.2 1997/11/04 00:29:36 sar + * Changed the agentx sub agent timeout period from 10000 (10 seconds) + * which was used for testing to 1000 (1 second). + * + * Revision 1.1 1997/10/29 01:29:59 sar + * Added the agentx options and modified the older sub agent options + * + * Revision 1.0 1997/08/08 22:11:20 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.6 1997/03/20 06:57:49 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.5 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.4 1997/01/15 22:14:49 sar + * moved the location of nvutils.h to snark/snmptalk + * + * Revision 0.3 1996/10/30 04:41:43 sra + * Fix nested comment. + * + * Revision 0.2 1996/10/25 21:05:12 sar + * corrected install_envoy_proxy to install_envoy_snmp_proxy + * + * Revision 0.1 1996/10/23 00:12:55 sar + * *** empty log message *** + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* previous revision history from attache/port/msdos/envoy.h + * + * Revision 3.6 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 3.5 1996/01/26 22:07:27 sar + * changed partytime to usectime and ifdeffed it off of version_usec + * + * Revision 3.4 1995/11/10 23:58:18 sar + * stopped using the pre & post set user exits for the nvview stuff + * + * Revision 3.3 1995/11/06 20:03:42 sar + * Removed validate_community's dependency on install v1 + * Remvoed validate_address & validate_version + * + * Revision 3.2 1995/10/20 23:19:42 sar + * removed party, context and acl macros + * modifed the install options for the view scheme inclusions. + * + * Revision 3.1 1995/05/22 19:38:28 sar + * Modified the lock code to add some new macros. + * + * Revision 3.0 1995/05/10 22:37:24 sra + * Release 3.0. + * + * Revision 2.10 1995/05/01 20:54:06 sar + * Added undo macros for the party mib for use with the async scheme. + * + * Revision 2.9 1995/03/24 16:39:14 sar + * Ifdeffed the example locking code so it won't conflict with the defaults + * if we don't have locking turned on. + * Added the envoy timer support routines. + * + * Revision 2.8 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 2.7 1994/11/01 18:00:30 sar + * *_add_mod now takes a flag as well as a data pointer. + * + * Revision 2.6 1994/10/18 15:54:01 sar + * Modified some macros for use with the new nvutils routines. + * + * Revision 2.5 1994/09/04 23:55:50 sra + * Get rid of most of the ancient NO_PP cruft. + * + * Revision 2.4 1994/05/12 17:25:20 sar + * moved include for nvutils.h so it is availble when needed. + * + * Revision 2.3 1994/05/10 20:22:11 sar + * moved view defines around so they are availabel in other than v2 settings. + * + * Revision 2.2 1994/05/09 21:07:17 sar + * added define for SNMP_RESETSYSUPTIME to be nothing. + * + * Revision 2.1 1993/08/06 22:03:43 sra + * Release 2.0. + * + * Revision 1.8 1993/08/02 22:06:06 dab + * don't use #ifdef for INSTALL_ optios + * + * Revision 1.7 1993/05/20 20:22:21 sar + * Removed memory.h if the compiler is watcom or intel 960. + * checked to see if config_preamble is defined rather than what it is. + * + * Revision 1.6 1993/05/17 20:11:55 sar + * Added an ifdef for zortech to remove the include of memory.h and + * to add the define of NEEDS_STR{DUP ICMP NICMP} as they weren't + * available. + * + * Revision 1.5 1993/05/13 18:51:39 sar + * Added macros for managing the file implementation of non volatile memory. + * + * Revision 1.4 1993/04/22 22:59:03 sar + * Got rid of pread and pwrite and some other macros, modified TIME + * to be SNMP_PARTYTIME and TIME_T to be PARTYTIME_T. + * + * Revision 1.3 1993/03/05 03:59:57 dab + * function declarations to keep the compiler happy + * + * Revision 1.2 1993/03/01 17:21:07 dab + * Added include of to get strlen() declaration. + * + * Revision 1.1 1993/02/27 17:27:42 dab + * Initial revision + * + */ + +/***************************************************************** + + This is the platform specific part of envoy.h for use with the + example code. It contains only the platform specific pieces of + the port code. The common porting code is in generic/envoy.h. + + In general customers will have one envoy.h file per platform + that combines this file and the platform specific information, + we use two files as there is a lot of shared code between our + demos. + +*****************************************************************/ + +#if defined(CONFIG_PREAMBLE) + +/***************************************************************** + * + * System Includes: + * + * The SNMP uses memcpy(), memset(), and strlen(). The appropriate + * include file should be put here to see that these routines are + * properly declared. If no such include file exists on the system + * then declare memcpy() and memset() here directly. + *****************************************************************/ + +/***************************************************************** + + System Includes: + + Envoy uses memcpy(), memset(), and strlen(). The appropriate + include file should be put here to see that these routines are + properly declared. If no such include file exists on the system + then declare memcpy() and memset() here directly. Envoy also + uses min() and max(). Include the system's definition or use the + macros supplied below. +*****************************************************************/ + +/* zortech, watcom and intel 960 don't have a memory.h so away it goes */ +#if (!defined(INSTALL_on_ztc) && !defined(INSTALL_on_watcom) && !defined(INSTALL_on_i960)) +#include +#endif /* INSTALL_on_ztc */ + +#include + +/***************************************************************** + Memory allocation routines. Envoy needs to allocate memory to + decode the packet into and also to store the response data + + Make sure that the routines used by the SNMP_memory_alloc() and + SNMP_memory_free() macros are declared. If system memory routines + are used (e.g. malloc() and free()) then include the appropriate + system header file here. + +*****************************************************************/ + +PTR_T SNMP_mem_alloc (unsigned int); +void SNMP_mem_free (PTR_T); + +#define SNMP_memory_alloc(need) SNMP_mem_alloc(need) +#define SNMP_memory_free(buf) SNMP_mem_free(buf) + +#include + +#else /* CONFIG_PREAMBLE */ + +#include + +#endif /* CONFIG_PREAMBLE */ diff --git a/h/wrn/wm/util/port/msdos/liaison.h b/h/wrn/wm/util/port/msdos/liaison.h new file mode 100644 index 0000000..3cee019 --- /dev/null +++ b/h/wrn/wm/util/port/msdos/liaison.h @@ -0,0 +1,49 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/msdos/liaison.h,v 1.1.1.1 2001/11/05 17:47:13 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1996-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: liaison.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:13 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:23:04 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:10:27 meister + * Update copyright message + * + * Revision 1.2 1998/02/25 04:56:59 sra + * Update copyrights. + * + * Revision 1.1 1997/11/18 19:59:33 josh + * liaison.h is a dummy file for now, but it will probably have stuff + * in the future + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +#if (!defined(liaison_inc)) +#define liaison_inc + +#endif /* #if (!defined(liaison_inc)) */ diff --git a/h/wrn/wm/util/port/msdos/snark.h b/h/wrn/wm/util/port/msdos/snark.h new file mode 100644 index 0000000..d6c7de3 --- /dev/null +++ b/h/wrn/wm/util/port/msdos/snark.h @@ -0,0 +1,105 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/msdos/snark.h,v 1.1.1.1 2001/11/05 17:47:13 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: snark.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:13 tneale + * Tornado shuffle + * + * Revision 1.5 2001/01/19 22:23:04 paul + * Update copyright. + * + * Revision 1.4 2000/03/17 00:10:27 meister + * Update copyright message + * + * Revision 1.3 1999/05/21 16:45:28 sra + * vsnprintf() => VSNPRINTF(). + * + * Revision 1.2 1998/02/25 04:56:59 sra + * Update copyrights. + * + * Revision 1.1 1997/11/10 23:58:17 sar + * ifdef the include for memory.h to make some compilers happy + * + * Revision 1.0 1997/08/08 22:11:21 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.5 1997/07/11 12:59:07 mrf + * make definitions of GLUE_FREE in attache.h and snark.h match exactly + * + * Revision 0.4 1997/03/20 06:57:49 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.3 1997/03/09 18:37:16 sra + * Add STRICMP(). + * + * Revision 0.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.1 1996/10/23 00:12:55 sar + * *** empty log message *** + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* zortech, watcom and intel 960 don't have a memory.h so away it goes */ +#if (!defined(INSTALL_on_ztc) && !defined(INSTALL_on_watcom) && !defined(INSTALL_on_i960)) +#include +#endif /* INSTALL_on_ztc */ + +#include +#include + +#ifndef GLUE_ALLOC +#define GLUE_ALLOC(len) ((void *) malloc(len)) +#endif +#ifndef GLUE_FREE +#define GLUE_FREE(mem) free((char *)(mem)) +#endif + +#ifndef MEMCPY +#define MEMCPY(x, y, z) memcpy(x, y, z) +#endif +#ifndef MEMCMP +#define MEMCMP(x, y, z) memcmp(x, y, z) +#endif +#ifndef MEMSET +#define MEMSET(x, y, z) memset(x, y, z) +#endif +#ifndef STRCMP +#define STRCMP(x, y) strcmp(x, y) +#endif +#ifndef STRCPY +#define STRCPY(x, y) strcpy(x, y) +#endif +#ifndef STRLEN +#define STRLEN(x) strlen(x) +#endif +#ifndef STRICMP +#define STRICMP(x, y) stricmp(x, y) +#endif +#ifndef STRNICMP +#define STRNICMP(x, y, z) strnicmp(x, y, z) +#endif diff --git a/h/wrn/wm/util/port/msdos/snmptalk.h b/h/wrn/wm/util/port/msdos/snmptalk.h new file mode 100644 index 0000000..d458bc1 --- /dev/null +++ b/h/wrn/wm/util/port/msdos/snmptalk.h @@ -0,0 +1,87 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/msdos/snmptalk.h,v 1.1.1.1 2001/11/05 17:47:13 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1995-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: snmptalk.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:13 tneale + * Tornado shuffle + * + * Revision 1.3 2001/01/19 22:23:04 paul + * Update copyright. + * + * Revision 1.2 2000/03/17 00:10:28 meister + * Update copyright message + * + * Revision 1.1 1998/02/25 04:57:00 sra + * Update copyrights. + * + * Revision 1.0 1997/08/08 22:11:21 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.5 1997/03/20 06:57:50 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.4 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.3 1996/10/30 22:09:46 sar + * removed bsd_release + * + * Revision 0.2 1996/10/28 17:50:30 mrf + * add winsock definitions if we're building for winsock. + * + * Revision 0.1 1996/10/23 00:12:55 sar + * *** empty log message *** + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* System include files or function declarations for MS-DOS. */ + +#include +#include + +#define PTCP_STDFUNC_H +#define ATTACHE + +/* defines for nvutils for file manipulation */ +#define SNMP_READONLY "r" +#define SNMP_READPLUS "r+" +#define SNMP_WRITEPLUS "w+" +#define SNMP_REMOVE_FILE(fname) remove(fname) + +/* defines for missing string items */ +/* currently only needed for zortech */ +#if defined(INSTALL_on_ztc) +#define NEEDS_STRDUP 1 +#define NEEDS_STRICMP 1 +#define NEEDS_STRNICMP 1 +#endif /* INSTALL_on_ztc */ + +#if defined(INSTALL_on_winsock) +#define DESIRED_WINSOCK_VERSION 0x0101 +#define MINIMUM_WINSOCK_VERSION 0x0001 +#define SOCKET_TIMEOUT 20L /* time to wait to for selects */ +#endif /* INSTALL_on_winsock */ diff --git a/h/wrn/wm/util/port/msdos/telnet.h b/h/wrn/wm/util/port/msdos/telnet.h new file mode 100644 index 0000000..b90b262 --- /dev/null +++ b/h/wrn/wm/util/port/msdos/telnet.h @@ -0,0 +1,89 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/msdos/telnet.h,v 1.1.1.1 2001/11/05 17:47:13 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: telnet.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:13 tneale + * Tornado shuffle + * + * Revision 1.3 2001/01/19 22:23:04 paul + * Update copyright. + * + * Revision 1.2 2000/03/17 00:10:28 meister + * Update copyright message + * + * Revision 1.1 1998/02/25 04:57:00 sra + * Update copyrights. + * + * Revision 1.0 1997/08/08 22:11:21 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.3 1997/03/20 06:57:46 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.1 1996/10/23 00:12:55 sar + * *** empty log message *** + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* Things which MAY be defined in here, + * the defaults are in attache/h/tnconfig.h. + * + * TN_LOCAL_NEWLINE + * TN_RECV_LOCAL_NEWLINE + * TN_SEND_LOCAL_NEWLINE + * TN_INITIAL_ACTIVE_WINDOW_SIZE + * TN_INITIAL_PASSIVE_WINDOW_SIZE + * GLUE_TN_WINDOW_SIZE + */ + +/* + * Use '\n' for local newline convention in both directions. + */ + +#define TN_LOCAL_NEWLINE '\n' + +/* + * All the windowing stuff for server telnet connections is controlled + * by the sty code, so shunt the decisions off to the sty_tn interface module. + * + * For client telnet connections we're not buffering output, so we just + * return a constant window size. + */ + +#define TN_INITIAL_ACTIVE_WINDOW_SIZE (4096) +#define TN_INITIAL_PASSIVE_WINDOW_SIZE (stytn_space_initial) + +#define GLUE_TN_WINDOW_SIZE(_tn_) \ + (tn_get_flags((_tn_), TN_FLG_ACT_AS_SERVER) \ + ? stytn_space_left((_tn_)) \ + : TN_INITIAL_ACTIVE_WINDOW_SIZE) + +extern unsigned stytn_space_initial; +extern unsigned stytn_space_left (struct tn_connection *); diff --git a/h/wrn/wm/util/port/solaris/attache.h b/h/wrn/wm/util/port/solaris/attache.h new file mode 100644 index 0000000..39d7b80 --- /dev/null +++ b/h/wrn/wm/util/port/solaris/attache.h @@ -0,0 +1,273 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/solaris/attache.h,v 1.3 2003/01/15 14:00:27 josh Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1994-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + *****************************************************************************/ + +/* + * $Log: attache.h,v $ + * Revision 1.3 2003/01/15 14:00:27 josh + * directory structure shifting + * + * Revision 1.2 2001/11/07 15:58:29 tneale + * Updated for newest file layout + * + * Revision 1.1.1.1 2001/11/05 17:47:15 tneale + * Tornado shuffle + * + * Revision 1.11 2001/06/25 19:43:11 markadam + * Remove the gcc only inline code for MEMCMP. This forces the compiler to + * use the definition in glue.h, which aliases a call to etc_memcmp. + * + * Revision 1.10 2001/01/19 22:23:14 paul + * Update copyright. + * + * Revision 1.9 2000/11/16 21:29:39 paul + * Moved glue_set_deferred_io_handler to sockport.h. + * + * Revision 1.8 2000/10/16 19:21:47 paul + * Restore sockets and mempool code. + * + * Revision 1.7 2000/03/17 00:10:53 meister + * Update copyright message + * + * Revision 1.6 2000/03/15 19:30:35 paul + * Whoops, we actually needed one of those revs. + * + * Revision 1.5 2000/03/13 21:21:56 paul + * Removed some code that we are no longer working on. + * + * Revision 1.4 1999/11/03 19:26:41 paul + * Add attache/h/packet.h include for glue function with packet parameter + * + * Revision 1.3 1999/02/18 04:41:28 wes + * Sockets merge: Everything Else + * - memory pools + * - thread support + * - port-specific headers + * + * Revision 1.2.6.1 1998/10/22 21:09:57 wes + * Change glue_set_deferred_io_handler prototype; add it to other ports. + * (oops, missed this the other day). + * + * Revision 1.2 1998/07/29 20:54:46 wes + * First cut of the Solaris port. + * (DLPI support, termios, minor tweaks to libraries and port header files) + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* Previous revision history when this was snark/port/attache.h + * + * Revision 2.2 1996/10/16 16:49:55 sar + * Added ifndefs around the memory and string routines + * to keep compilers happy. + * + * Revision 2.1 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 2.0 1995/05/10 22:38:15 sra + * Attache release 3.0. + * + * Revision 1.6 1995/05/01 20:59:29 sra + * Have to test CONFIG_PREAMBLE with #ifdef, not #if. + * + * Revision 1.5 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 1.4 1994/12/20 22:13:46 sra + * Fix signature for crufty glue_pkt_handle() declaration. + * + * Revision 1.3 1994/09/04 23:55:50 sra + * Get rid of most of the ancient NO_PP cruft. + * + * Revision 1.2 1994/09/04 06:13:38 sra + * Clean up antique type names and install macros. + * + * Revision 1.1 1994/01/09 23:57:29 sra + * Add support for NIT under SunOS 4.1.2. + * + */ + +#ifdef CONFIG_PREAMBLE + +#include +#include +#include +#include +#include + +#define MAX_PACKETS 50 +#define IP_MAX_PKTSIZE 1536 + +#define TCP_MAXCONN 128 + +#ifndef MEMCPY +#define MEMCPY(x, y, z) memcpy(x, y, z) +#endif + +#ifndef MEMSET +#define MEMSET(x, y, z) memset(x, y, z) +#endif + +#ifndef STRCMP +#define STRCMP(x, y) strcmp(x, y) +#endif + +#ifndef STRCPY +#define STRCPY(x, y) strcpy(x, y) +#endif + +#ifndef STRLEN +#define STRLEN(x) strlen(x) +#endif + +/* + * Fun with our new run-time debugging facility. + * This is still experimental, and defaults to uninstalled. + */ +#if defined(INSTALL_SNARK_BUG_CONF) && INSTALL_SNARK_BUG_CONF +#include +#endif + +/* + * Backwards compatability with old braindamage can be a real pain. + * Since this port file is strictly for debugging, we set a couple + * of configuration parameters to more reasonable values here. + */ + +/* Please do install a retransmission timeout handler */ +#define TCP_DEFAULT_MAX_RETRANSMISSIONS 0 + +/* Please buffer a reasonable number of ahead-of-sequence segments */ +#define TCP_AHEAD_Q_MAX_DEFAULT 25 + +#else /* CONFIG_PREAMBLE */ + +#include +#include + +#include +#include + +#ifdef htons +#undef htons +#endif + +#ifdef htonl +#undef htonl +#endif + +extern unsigned short htons (unsigned short); +extern unsigned long htonl (unsigned long); + +#define GLUE_ALLOC(x) ((void *) malloc(x)) +#define GLUE_FREE(x) free((char *) (x)) +#define GLUE_CKSUM(x, y) glue_cksum((bits16_t *)(x), (y)) +#define GLUE_SWAP16(x) ((bits16_t) htons((unsigned short) (x))) +#define GLUE_SWAP32(x) ((bits32_t) htonl((unsigned long) (x))) +#define GLUE_CALLIN(x, y) glue_callin(x, y) + +extern int glue_intlock (int); +extern bits16_t glue_cksum (bits16_t *, unsigned); +extern void glue_callin (bits32_t, void (*)(void)); + +#ifndef GLUE_NOW +#define GLUE_NOW() glue_now() +extern bits32_t glue_now (void); +#endif + +/* define the GLUE_SNTP_SET_TIME macro if using SNTP Client */ +#if INSTALL_ATTACHE_MULTICAST && INSTALL_ATTACHE_SNTP_CLIENT +#ifndef GLUE_SNTP_SET_TIME +#define GLUE_SNTP_SET_TIME(p, s, f) glue_set_time((p),(s),(f)) +extern void glue_set_time(packet *, bits32_t, bits32_t); +#endif +#endif + +/* Define PRINTF for debugging and printing code +#ifndef PRINTF +#define PRINTF printf +#endif +*/ + +#ifdef ATTACHE_IPSEC_H + +#define GLUE_IPSEC_SA_EXPIRED(W,X,Y,Z) \ + glue_ipsec_sa_expired(W,X,Y,Z) +extern void glue_ipsec_sa_expired (ipsec_sa_dir_t, ipaddr_t *, + bits32_t, bits8_t); + +#define GLUE_IPSEC_SND_PKT_DENIED(W,X,Y,Z) \ + glue_ipsec_snd_pkt_denied((W),(X),(Y),(Z)) + +extern void glue_ipsec_snd_pkt_denied(packet *, ipaddr_t *, ipaddr_t *, int); + + +#define GLUE_IPSEC_RCV_PKT_BADSPI(V,W,X,Y,Z) \ + glue_ipsec_rcv_pkt_badspi((V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_pkt_badspi(packet *, ipaddr_t *, ipaddr_t *, + bits32_t, bits8_t); + +#define GLUE_IPSEC_RCV_PKT_NOTPARTY(V,W,X,Y,Z) \ + glue_ipsec_rcv_pkt_notparty((V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_pkt_notparty(packet *, ipaddr_t *, ipaddr_t *, + bits32_t, bits8_t); + + +#define GLUE_IPSEC_RCV_TUNPKT_NOTIP(U,V,W,X,Y,Z) \ + glue_ipsec_rcv_tunpkt_notip((U),(V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_tunpkt_notip(packet *, packet *, ipaddr_t *, + ipaddr_t *, bits32_t, bits8_t); + +#define GLUE_IPSEC_RCV_TUNPKT_NOTPARTY(S,T,U,V,W,X,Y,Z) \ + glue_ipsec_rcv_tunpkt_notparty((S),(T),(U),(V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_tunpkt_notparty(packet *, ipaddr_t *, ipaddr_t *, + packet *, ipaddr_t *, ipaddr_t *, + bits32_t, bits8_t); + +#define GLUE_IPSEC_RCV_SA_NOTUNNEL(V,W,X,Y,Z) \ + glue_ipsec_rcv_sa_notunnel((V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_sa_notunnel(packet *, ipaddr_t *, ipaddr_t *, + bits32_t, bits8_t); + + +#define GLUE_IPSEC_RCV_PKT_BADAH(V,W,X,Y) \ + glue_ipsec_rcv_pkt_badah((V),(W),(X),(Y)) + +extern void glue_ipsec_rcv_pkt_badah(packet *, ipaddr_t *, ipaddr_t *, + bits32_t); + +#define GLUE_IPSEC_RCV_PKT_DENIED(V,W,X,Y,Z) \ + glue_ipsec_rcv_pkt_denied((V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_pkt_denied(packet *, ipaddr_t *, ipaddr_t *, + ipsec_policy_flags_t, bits16_t); + + +#endif /* ATTACHE_IPSEC */ + +#endif /* CONFIG_PREAMBLE */ diff --git a/h/wrn/wm/util/port/solaris/common.h b/h/wrn/wm/util/port/solaris/common.h new file mode 100644 index 0000000..7e63927 --- /dev/null +++ b/h/wrn/wm/util/port/solaris/common.h @@ -0,0 +1,80 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/solaris/common.h,v 1.1.1.1 2001/11/05 17:47:15 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: common.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:15 tneale + * Tornado shuffle + * + * Revision 1.5 2001/06/25 19:43:11 markadam + * Remove the gcc only inline code for MEMCMP. This forces the compiler to + * use the definition in glue.h, which aliases a call to etc_memcmp. + * + * Revision 1.4 2001/01/19 22:23:15 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:10:53 meister + * Update copyright message + * + * Revision 1.2 1998/07/29 20:54:47 wes + * First cut of the Solaris port. + * (DLPI support, termios, minor tweaks to libraries and port header files) + * + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* + * Common definitions for all Epilogue products on Solaris. + */ + +#ifdef CONFIG_PREAMBLE + +#include +#include + +/* things that should be in some system header file but don't seem to be */ +extern int strncasecmp(); + +#ifndef STRICMP +#define STRICMP(x, y) strcasecmp(x, y) +#endif + +#ifndef STRNICMP +#define STRNICMP(x, y, z) strncasecmp(x, y, z) +#endif + +#else /* CONFIG_PREAMBLE */ + +#ifndef GLUE_NOW +#define GLUE_NOW() glue_now() +extern bits32_t glue_now (void); +#endif + +#ifndef GLUE_SEED_PRNG +#define GLUE_SEED_PRNG(x,y) glue_seed_prng(x,y) +extern unsigned glue_seed_prng(bits8_t *, unsigned); +#endif + +#endif /* CONFIG_PREAMBLE */ diff --git a/h/wrn/wm/util/port/solaris/decorum.h b/h/wrn/wm/util/port/solaris/decorum.h new file mode 100644 index 0000000..b3d2ecf --- /dev/null +++ b/h/wrn/wm/util/port/solaris/decorum.h @@ -0,0 +1,143 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/solaris/decorum.h,v 1.3 2003/01/15 14:00:27 josh Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1996-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: decorum.h,v $ + * Revision 1.3 2003/01/15 14:00:27 josh + * directory structure shifting + * + * Revision 1.2 2001/11/07 15:58:29 tneale + * Updated for newest file layout + * + * Revision 1.1.1.1 2001/11/05 17:47:15 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:23:15 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:10:53 meister + * Update copyright message + * + * Revision 1.2 1998/07/29 20:54:47 wes + * First cut of the Solaris port. + * (DLPI support, termios, minor tweaks to libraries and port header files) + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +#if (!defined(decorum_inc)) +#define decorum_inc + +#include +#include +#include +#include +#include + +#ifndef DECORUM_ALLOC +#define DECORUM_ALLOC(x) ((void *) malloc(x)) +#endif +#ifndef DECORUM_FREE +#define DECORUM_FREE(x) (free((char *) (x))) +#endif + +/* This first should be the same as SNMP_MAX_PACKET_SIZE in envoy.h */ +#define DECORUM_MAX_PACKET_SIZE (1400) +#define DECORUM_DEFAULT_RECEIVE_BUFLEN (512) + +/* needed for OIDC_T definition */ +#if INSTALL_DECORUM_PROXY && (!defined(asn1conf_inc)) +#include +#endif + +/* Some input routines, these are provided but may be replaced with + more efficient implentations if desired */ +extern sbits16_t decorum_parse_sbits32 (epilogue_char_t *, + epilogue_char_t **, + sbits32_t *); +extern sbits16_t decorum_parse_bits32 (epilogue_char_t *, + epilogue_char_t **, + bits32_t *); +extern sbits16_t decorum_parse_hexstring (epilogue_char_t *, + epilogue_char_t *, + decorum_size_t); +#define ETC_STRING_GET_SBITS32 decorum_parse_sbits32 +#define ETC_STRING_GET_BITS32 decorum_parse_bits32 +#define ETC_STRING_GET_HEXSTRING decorum_parse_hexstring + +/* a routine to output a number to a byte string, used to create + file/stream names */ +#define ETC_STDIO_SPRINTF(buf, num, str) sprintf(buf, "%lu%s", num, str) + +/* Define the structure that will be used for holding output + until we are done */ +typedef FILE etc_stdio_t; + +/* Macros for opening, closing and removing a stream */ +#define ETC_STDIO_MODE_READ "r" +#define ETC_STDIO_MODE_WRITE "w+" + +#define ETC_STDIO_OPEN(fname, how) fopen(fname, how) +#define ETC_STDIO_CLOSE(outstream) fclose(outstream) +#define ETC_STDIO_REMOVE(fname) unlink(fname) +#define ETC_STDIO_READ(instream, size, buf) \ + fread((buf), 1, (size), (instream)) +#define ETC_STDIO_WRITE(outstream, size, buf) \ + fwrite((buf), 1, (size), (outstream)) +extern bits32_t file_size_32(char * fname); +#define ETC_STDIO_SIZE(fname) (file_size_32(fname)) + +/* Define the base output routines */ +extern sbits16_t decorum_put_string (etc_stdio_t *, epilogue_char_t *, + decorum_size_t); +extern sbits16_t decorum_put_sbits32 (etc_stdio_t *, sbits32_t); +extern sbits16_t decorum_put_bits32 (etc_stdio_t *, bits32_t); +extern sbits16_t decorum_put_hex_string (etc_stdio_t *, bits8_t *, + decorum_size_t); +#define ETC_STDIO_PUT_STRING decorum_put_string +#define ETC_STDIO_PUT_SBITS32 decorum_put_sbits32 +#define ETC_STDIO_PUT_BITS32 decorum_put_bits32 +#define ETC_STDIO_PUT_HEX_STRING decorum_put_hex_string + +#if INSTALL_DECORUM_PROXY +/* Define a more complex output routine, this may use the + base routines (as the example code does) or may be more direct */ +extern sbits16_t decorum_put_oid (etc_stdio_t *, OIDC_T *, decorum_size_t); +#define ETC_STDIO_PUT_OID decorum_put_oid +#endif /* INSTALL_DECORUM_PROXY */ + +/* Define a string comparison routine */ +#define ETC_STRING_STRCASECMP strcasecmp +extern int strcasecmp(); + +/* Define a string length routine */ +#define ETC_STRING_STRLEN strlen + +/* Define a routine that gets the current time. */ +#define DECORUM_GET_RAWTIME(timeval_p) unix_glue_getime ((timeval_p)); +/* Define a routine that figgers out how big a buffer to use for a chunk + * of outgoing data. */ +#define DECORUM_SENDBUF_LEN(http_sb) (512) + +#endif /* #if (!defined(decorum_inc)) */ diff --git a/h/wrn/wm/util/port/solaris/emissary.h b/h/wrn/wm/util/port/solaris/emissary.h new file mode 100644 index 0000000..0ddbb3b --- /dev/null +++ b/h/wrn/wm/util/port/solaris/emissary.h @@ -0,0 +1,77 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/solaris/emissary.h,v 1.1.1.1 2001/11/05 17:47:15 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1992-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: emissary.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:15 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:23:15 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:10:53 meister + * Update copyright message + * + * Revision 1.2 1998/07/29 20:54:47 wes + * First cut of the Solaris port. + * (DLPI support, termios, minor tweaks to libraries and port header files) + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/* + * The following declarations shouldn't be necessary, particularly the ones + * that are stdio internal functions, but GCC whines without them. Should + * be harmless in any case. + */ +extern char *getenv (const char *); +extern int _filbuf (FILE *); +extern int _flsbuf (unsigned int, FILE *); +extern int fclose (FILE *); +extern int fprintf (FILE *, const char *, ...); +extern int fputs (const char *, FILE *); +extern int fseek (FILE *, long int, int); +extern int tolower (int); +extern int ungetc (int, FILE *); +extern long time (long *); +extern size_t fwrite (const void *,size_t,size_t,FILE *); +extern void perror (const char *); diff --git a/h/wrn/wm/util/port/solaris/envoy.h b/h/wrn/wm/util/port/solaris/envoy.h new file mode 100644 index 0000000..bcc8af4 --- /dev/null +++ b/h/wrn/wm/util/port/solaris/envoy.h @@ -0,0 +1,150 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/solaris/envoy.h,v 1.2 2001/11/07 16:55:52 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: envoy.h,v $ + * Revision 1.2 2001/11/07 16:55:52 tneale + * Added path to target/h + * + * Revision 1.1.1.1 2001/11/05 17:47:15 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:23:15 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:10:53 meister + * Update copyright message + * + * Revision 1.2 1998/07/29 20:54:48 wes + * First cut of the Solaris port. + * (DLPI support, termios, minor tweaks to libraries and port header files) + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* previous revision history when this was envoy/port/sunos/envoy.h + * with rev and copyright updates removed + * + * Revision 6.5 1996/02/27 00:03:03 sar + * Updated partytime to be usectime + * + * Revision 6.4 1995/11/14 22:37:59 sar + * If proxy is installed release_private is proxy_release_private + * + * Revision 6.3 1995/11/10 23:59:08 sar + * stopped using the pre & post set user exits for the nvview stuff + * + * Revision 6.2 1995/11/06 20:05:22 sar + * Removed validate_community's dependency on install v1 + * removed validate_address & validate_vesion + * + * Revision 6.1 1995/10/20 23:15:55 sar + * removed party, context and acl macros + * + * Revision 5.6 1995/05/22 19:39:24 sar + * Modified the lock code to add some new macros. + * + * Revision 5.5 1995/05/02 23:39:31 sar + * Added the envoy timer macros. + * + * Revision 5.4 1995/05/01 21:58:15 sar + * Put the example lock macros in an ifdef block + * + * Revision 5.3 1995/05/01 20:59:29 sra + * Have to test CONFIG_PPREAMBLE with #ifdef, not #if. + * + * Revision 5.2 1994/11/01 17:59:04 sar + * *_add_mod routines now take a flag as well as an data block. + * + * Revision 5.1 1994/09/29 20:39:39 sar + * added macros for a simple locking scheme to test the compiliation of + * our code + * Modified the macros for use with the non volatile storage stuff to + * use the new (as of fall 94) scheme. + * + * Revision 4.3 1994/05/12 17:24:05 sar + * moved the include for nvutils.h to make it available for everybody + * that needs it. + * + * Revision 4.2 1994/05/10 20:21:45 sar + * moved view defines aroudn so they are available in other than v2 settings. + * + * Revision 4.1 1994/05/09 21:06:41 sar + * Added define for SNMP_RESETSYSUPTIME to be nothing. + * + */ + +/***************************************************************** + + This is the platform specific part of envoy.h for use with the + example code. It contains only the platform specific pieces of + the port code. The common porting code is in generic/envoy.h. + + In general customers will have one envoy.h file per platform + that combines this file and the platform specific information, + we use two files as there is a lot of shared code between our + demos. + +*****************************************************************/ + +#ifdef CONFIG_PREAMBLE + +/***************************************************************** + + System Includes: + + Envoy uses memcpy(), memset(), and strlen(). The appropriate + include file should be put here to see that these routines are + properly declared. If no such include file exists on the system + then declare memcpy() and memset() here directly. Envoy also + uses min() and max(). Include the system's definition or use the + macros supplied below. +*****************************************************************/ + +#include +#include + +/***************************************************************** + Memory allocation routines. Envoy needs to allocate memory to + decode the packet into and also to store the response data + + Make sure that the routines used by the SNMP_memory_alloc() and + SNMP_memory_free() macros are declared. If system memory routines + are used (e.g. malloc() and free()) then include the appropriate + system header file here. +*****************************************************************/ + +/* Get malloc and free declarations */ +#include + +#define SNMP_memory_alloc(need) malloc(need) +#define SNMP_memory_free(buf) free(buf) + +#include + +#else /* config preamble */ + +#include + +#endif /* CONFIG_PREAMBLE */ diff --git a/h/wrn/wm/util/port/solaris/liaison.h b/h/wrn/wm/util/port/solaris/liaison.h new file mode 100644 index 0000000..94ac086 --- /dev/null +++ b/h/wrn/wm/util/port/solaris/liaison.h @@ -0,0 +1,46 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/solaris/liaison.h,v 1.1.1.1 2001/11/05 17:47:15 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1996-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: liaison.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:15 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:23:15 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:10:53 meister + * Update copyright message + * + * Revision 1.2 1998/07/29 20:54:49 wes + * First cut of the Solaris port. + * (DLPI support, termios, minor tweaks to libraries and port header files) + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +#if (!defined(liaison_inc)) +#define liaison_inc + +#endif /* #if (!defined(liaison_inc)) */ diff --git a/h/wrn/wm/util/port/solaris/oemtypes.h b/h/wrn/wm/util/port/solaris/oemtypes.h new file mode 100644 index 0000000..21186d6 --- /dev/null +++ b/h/wrn/wm/util/port/solaris/oemtypes.h @@ -0,0 +1,57 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/solaris/oemtypes.h,v 1.1.1.1 2001/11/05 17:47:15 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: oemtypes.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:15 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:23:16 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:10:54 meister + * Update copyright message + * + * Revision 1.2 1998/07/29 20:54:49 wes + * First cut of the Solaris port. + * (DLPI support, termios, minor tweaks to libraries and port header files) + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* get the size_t construct */ +#include + +#if 0 +/* The sun compiler doesn't understand the `signed' keyword */ + +#define __TYPES_HAVE_sbits8_t_ 1 +typedef char sbits8_t; /* signed 8 bits */ +#define __TYPES_HAVE_sbits16_t_ 1 +typedef short sbits16_t; /* signed 16 bits */ +#define __TYPES_HAVE_sbits32_t_ 1 +typedef long sbits32_t; /* signed 32 bits */ +#endif + +#define __TYPES_HAVE_boolean_t_ 1 diff --git a/h/wrn/wm/util/port/solaris/snark.h b/h/wrn/wm/util/port/solaris/snark.h new file mode 100644 index 0000000..2b8accf --- /dev/null +++ b/h/wrn/wm/util/port/solaris/snark.h @@ -0,0 +1,97 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/solaris/snark.h,v 1.1.1.1 2001/11/05 17:47:15 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1994-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: snark.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:15 tneale + * Tornado shuffle + * + * Revision 1.5 2001/01/19 22:23:16 paul + * Update copyright. + * + * Revision 1.4 2000/03/17 00:10:54 meister + * Update copyright message + * + * Revision 1.3 1999/05/21 16:45:25 sra + * vsnprintf() => VSNPRINTF(). + * + * Revision 1.2 1998/07/29 20:54:50 wes + * First cut of the Solaris port. + * (DLPI support, termios, minor tweaks to libraries and port header files) + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +#include +#include +#include +#include +#include + +#define SNARK_ATTACHE_MAXLNH 20 + +#ifndef GLUE_ALLOC +#define GLUE_ALLOC(x) ((void *) malloc(x)) +#endif + +#ifndef GLUE_FREE +#define GLUE_FREE(x) free((char *) (x)) +#endif + +#ifndef MEMCPY +#define MEMCPY(x, y, z) memcpy(x, y, z) +#endif + +#ifndef MEMCMP +#define MEMCMP(x, y, z) memcmp(x, y, z) +#endif + +#ifndef MEMSET +#define MEMSET(x, y, z) memset(x, y, z) +#endif + +#ifndef STRCMP +#define STRCMP(x, y) strcmp(x, y) +#endif + +#ifndef STRCPY +#define STRCPY(x, y) strcpy(x, y) +#endif + +#ifndef STRLEN +#define STRLEN(x) strlen(x) +#endif + +#ifndef STRNICMP +#define STRNICMP(x, y, z) strncasecmp(x, y, z) +#endif + +#ifndef STRICMP +#define STRICMP(x, y) strcasecmp(x, y) +#endif + +#define stricmp STRICMP +#define strnicmp STRNICMP + + diff --git a/h/wrn/wm/util/port/solaris/snmptalk.h b/h/wrn/wm/util/port/solaris/snmptalk.h new file mode 100644 index 0000000..44b2313 --- /dev/null +++ b/h/wrn/wm/util/port/solaris/snmptalk.h @@ -0,0 +1,51 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/solaris/snmptalk.h,v 1.1.1.1 2001/11/05 17:47:15 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: snmptalk.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:15 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:23:16 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:10:54 meister + * Update copyright message + * + * Revision 1.2 1998/07/29 20:54:50 wes + * First cut of the Solaris port. + * (DLPI support, termios, minor tweaks to libraries and port header files) + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + + +#include +#include + +/* defines for nvutils for file manipulation */ +#define SNMP_READONLY "r" +#define SNMP_READPLUS "r+" +#define SNMP_WRITEPLUS "w+" +#define SNMP_REMOVE_FILE(fname) unlink(fname) diff --git a/h/wrn/wm/util/port/solaris/sockport.h b/h/wrn/wm/util/port/solaris/sockport.h new file mode 100644 index 0000000..741f4f5 --- /dev/null +++ b/h/wrn/wm/util/port/solaris/sockport.h @@ -0,0 +1,134 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/solaris/sockport.h,v 1.1.1.1 2001/11/05 17:47:16 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998-1999 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: sockport.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:16 tneale + * Tornado shuffle + * + * Revision 1.12 2001/05/29 19:13:51 masashi + * Include errno.h if needed. + * + * Revision 1.11 2001/05/17 19:10:32 paul + * Added SOCKTABLE_MIN_FD. + * + * Revision 1.10 2001/01/19 22:23:16 paul + * Update copyright. + * + * Revision 1.9 2000/11/16 21:30:05 paul + * Moved glue_set_deferred_io_handler from attache.h. + * Removed stuff that is now defaulted in attache/sockets/sockintl.h. + * + * Revision 1.8 2000/10/16 19:21:47 paul + * Restore sockets and mempool code. + * + * Revision 1.6 2000/03/17 00:10:54 meister + * Update copyright message + * + * Revision 1.5 1999/05/14 20:31:20 paul + * Moved send[to]/recv[from] wrappers from sockets.c to socktop.c. Now + * the mainline sockets code only has entry points for sendmsg/recvmsg. + * + * Revision 1.4 1999/05/12 19:03:18 paul + * Added socktable_iterate. + * + * Revision 1.3 1999/03/04 17:08:35 paul + * added sockets_shutdown, socktable_dump + * + * Revision 1.2 1999/02/18 04:41:29 wes + * Sockets merge: Everything Else + * - memory pools + * - thread support + * - port-specific headers + * + * Revision 1.1.4.8 1999/02/05 20:17:45 paul + * Changed DEFAULT_* to SOCK_DFLT_*, moved fallback definitions to sockintl.h. + * Changed SETERROR to SOCK_SET_ERRNO to reduce possibility of name + * collision with customer code. + * + * Revision 1.1.4.7 1999/02/05 18:34:18 paul + * Updated to match the bsd44 version. + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +#ifndef _SOCKPORT_H +#define _SOCKPORT_H + +#if !INSTALL_ATTACHE_SOCKETS_DEFINE_ERRORS +#include +#endif + +extern int errno; /* needs to be per-thread/per-task */ +#define SOCK_SET_ERRNO(x) (errno = (x)) + +void glue_set_deferred_io_handler (void (*first)(void), void (*handler)(void)); +#define GLUE_SET_DEFERRED_IO_HANDLER(x,y) glue_set_deferred_io_handler(x,y) + +/* Other things you can set here: + * + * If you are using the built-in socket table code: + * SOCKTABLE_MIN_FD + * SOCKTABLE_MAX_FDS + * SOCKTABLE_HASH_BUCKETS + * + * If you are supplying your own socket table code: + * SOCKTABLE_INIT + * SOCKTABLE_LOOKUP + * SOCKTABLE_ADD + * SOCKTABLE_DEL + * SOCKTABLE_ITERATE + * SOCKTABLE_DUMP + * + * If you want to insert your own system-call type interface between + * the user socket library and the real sockets code: + * SOCK_SOCKETS_INIT + * SOCK_SOCKETS_SHUTDOWN + * SOCK_SOCKET + * SOCK_BIND + * SOCK_LISTEN + * SOCK_ACCEPT + * SOCK_CONNECT + * SOCK_GETSOCKNAME + * SOCK_GETPEERNAME + * SOCK_SHUTDOWN + * SOCK_CLOSE + * SOCK_SENDMSG + * SOCK_RECVMSG + * SOCK_SELECT + * SOCK_SETSOCKOPT + * SOCK_GETSOCKOPT + * SOCK_IOCTL + * + * Default parameters for sending and receiving: + * SOCK_DFLT_UDP_SNDBUF + * SOCK_DFLT_TCP_SNDBUF + * SOCK_DFLT_RAW_SNDBUF + * SOCK_DFLT_UDP_RCVBUF + * SOCK_DFLT_TCP_RCVBUF + * SOCK_DFLT_RAW_RCVBUF + * SOCK_DFLT_SNDLOWAT + * SOCK_DFLT_RCVLOWAT + */ + +#endif /* _SOCKPORT_H */ diff --git a/h/wrn/wm/util/port/solaris/telnet.h b/h/wrn/wm/util/port/solaris/telnet.h new file mode 100644 index 0000000..4f8aacf --- /dev/null +++ b/h/wrn/wm/util/port/solaris/telnet.h @@ -0,0 +1,66 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/solaris/telnet.h,v 1.1.1.1 2001/11/05 17:47:16 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1994-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: telnet.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:16 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:23:16 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:10:54 meister + * Update copyright message + * + * Revision 1.2 1998/07/29 20:54:50 wes + * First cut of the Solaris port. + * (DLPI support, termios, minor tweaks to libraries and port header files) + * + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* + * Use '\n' for local newline convention in both directions. + */ + +#define TN_LOCAL_NEWLINE '\n' + +/* + * All the windowing stuff for server telnet connections is controlled + * by the sty code, so shunt the decisions off to the sty_tn interface module. + * + * For client telnet connections we're not buffering output, so we just + * return a constant window size. + */ + +#define TN_INITIAL_ACTIVE_WINDOW_SIZE (4096) +#define TN_INITIAL_PASSIVE_WINDOW_SIZE (stytn_space_initial) + +#define GLUE_TN_WINDOW_SIZE(_tn_) \ + (tn_get_flags((_tn_), TN_FLG_ACT_AS_SERVER) \ + ? stytn_space_left((_tn_)) \ + : TN_INITIAL_ACTIVE_WINDOW_SIZE) + +extern unsigned stytn_space_initial, stytn_space_left(); diff --git a/h/wrn/wm/util/port/solaris/thdport.h b/h/wrn/wm/util/port/solaris/thdport.h new file mode 100644 index 0000000..6a07853 --- /dev/null +++ b/h/wrn/wm/util/port/solaris/thdport.h @@ -0,0 +1,86 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/solaris/thdport.h,v 1.1.1.1 2001/11/05 17:47:16 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998-1999 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: thdport.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:16 tneale + * Tornado shuffle + * + * Revision 1.9 2001/06/12 08:06:21 paul + * Removed errchk() wrappers - install THREAD_DEBUG if you want debugging. + * + * Revision 1.8 2001/03/22 16:54:17 paul + * Removed GLUE_COND_TIMEDWAIT(). + * + * Revision 1.7 2001/03/20 17:11:16 paul + * Removed unused timeout macros. + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +#include + +/* !!! checking return codes here? */ + +#define GLUE_MUTEX_PRIO_MAX 100 +#define GLUE_MUTEX_PRIO_HIGH 80 +#define GLUE_MUTEX_PRIO_MID 40 +#define GLUE_MUTEX_PRIO_LOW 20 +#define GLUE_MUTEX_PRIO_MIN 10 + +typedef pthread_mutex_t glue_mutex_t; + +typedef pthread_cond_t glue_cond_t; + +typedef pthread_t glue_thread_t; + +#define GLUE_MUTEX_INIT(lock, prio) pthread_mutex_init(lock, NULL) +#define GLUE_MUTEX_INIT_MAGIC(lock) pthread_mutex_init(lock, NULL) +#define GLUE_MUTEX_LOCK(lock, prio) pthread_mutex_lock(lock) +#define GLUE_MUTEX_UNLOCK(lock, prio) pthread_mutex_unlock(lock) +#define GLUE_MUTEX_TRYLOCK(lock, prio) pthread_mutex_trylock(lock) +#define GLUE_MUTEX_DESTROY(lock) pthread_mutex_destroy(lock) + +#define GLUE_COND_INIT(cond, mutex) pthread_cond_init(cond, NULL) +#define GLUE_COND_WAIT(cond, mutex) pthread_cond_wait(cond, mutex) +#define GLUE_COND_WAKEUP(cond, mutex) pthread_cond_signal(cond) +#define GLUE_COND_BROADCAST(cond, mutex) pthread_cond_broadcast(cond) +#define GLUE_COND_DESTROY(cond) pthread_cond_destroy(cond) + +#define GLUE_THD_SELF() pthread_self() +#define GLUE_THD_YIELD() sched_yield() +#define GLUE_THD_CREATE(thread, func, arg) pthread_create(thread, NULL, func, arg) +#define GLUE_THD_WAIT(thread) pthread_join(thread, NULL) +#define GLUE_THD_EXIT() pthread_exit(NULL) + +/* pthread_init() doesn't exist on solaris.. */ +#define GLUE_THREAD_INIT() + +pthread_key_t debug_state_key; + +#define GLUE_THD_COOKIE_INIT(freertn) pthread_key_create (&debug_state_key, freertn); + +#define GLUE_THD_COOKIE_GET(y) *(y) = pthread_getspecific(debug_state_key) +#define GLUE_THD_COOKIE_SET(x) pthread_setspecific(debug_state_key, x) + + diff --git a/h/wrn/wm/util/port/sunos/attache.h b/h/wrn/wm/util/port/sunos/attache.h new file mode 100644 index 0000000..8664ad5 --- /dev/null +++ b/h/wrn/wm/util/port/sunos/attache.h @@ -0,0 +1,330 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/sunos/attache.h,v 1.3 2003/01/15 14:00:28 josh Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1994-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + *****************************************************************************/ + +/* + * $Log: attache.h,v $ + * Revision 1.3 2003/01/15 14:00:28 josh + * directory structure shifting + * + * Revision 1.2 2002/02/26 18:22:54 josh + * updating paths in port files + * + * Revision 1.1.1.1 2001/11/05 17:47:16 tneale + * Tornado shuffle + * + * Revision 1.15 2001/01/19 22:23:17 paul + * Update copyright. + * + * Revision 1.14 2000/03/17 00:10:59 meister + * Update copyright message + * + * Revision 1.13 2000/03/15 19:52:54 paul + * Add attache/h/packet.h include for glue function with packet parameter + * + * Revision 1.12 1998/03/12 18:23:44 meister + * GLUE_IPSEC_RCV_SA_NOTUNNEL() + * + * Revision 1.11 1998/03/11 21:10:04 meister + * Added some parameters to IPSEC glue macros + * + * Revision 1.10 1998/03/11 20:20:49 mrf + * Comment out PRINTF declaration (again) + * + * Revision 1.9 1998/03/03 20:36:43 mrf + * Change GLUE_SNTP_SET_TIME macro to pass packet pointer + * + * Revision 1.8 1998/03/03 15:26:16 mrf + * Comment out PRINTF declarations. + * + * Revision 1.7 1998/02/27 23:38:12 meister + * Add stdio.h + * + * Revision 1.6 1998/02/27 22:30:36 meister + * Added ipsec glue functions + * + * Revision 1.5 1998/02/25 04:57:07 sra + * Update copyrights. + * + * Revision 1.4 1998/02/18 22:34:59 sra + * Add ip_loopback(), eradicate glue_pkt_handle(). + * + * Revision 1.3 1998/02/16 17:43:08 mrf + * Add prototype for glue_set_time() + * + * Revision 1.2 1998/02/13 17:49:37 mrf + * Add conditionalized SNTP set-time macro. + * + * Revision 1.1 1997/09/15 15:48:28 sra + * GLUE_NOW() migration version skew. + * + * Revision 1.0 1997/08/08 22:11:22 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.9 1997/05/01 23:11:55 sra + * Work around broken SunOS memcmp(). + * + * Revision 0.8 1997/03/20 06:57:51 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.7 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.6 1997/02/25 07:59:40 sra + * Comment out glue_pkt_handle(), we don't need it anymore. + * + * Revision 0.5 1997/02/24 00:56:59 sra + * Support for run-time configuration of BUG() macros. + * + * Revision 0.4 1997/01/17 23:11:38 sra + * Fiddle configuration parameters to make this configuration a little + * more suitable for performance testing. + * + * Revision 0.3 1996/10/30 18:28:52 sra + * The curse of htonx() strikes again. + * + * Revision 0.2 1996/10/30 04:54:49 sra + * Move glue stuff down to postamble section. + * + * Revision 0.1 1996/10/23 00:14:56 sar + * *** empty log message *** + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* Previous revision history when this was snark/port/attache.h + * + * Revision 2.2 1996/10/16 16:49:55 sar + * Added ifndefs around the memory and string routines + * to keep compilers happy. + * + * Revision 2.1 1996/03/22 10:05:39 sra + * Update copyrights prior to Attache 3.2 release. + * + * Revision 2.0 1995/05/10 22:38:15 sra + * Attache release 3.0. + * + * Revision 1.6 1995/05/01 20:59:29 sra + * Have to test CONFIG_PREAMBLE with #ifdef, not #if. + * + * Revision 1.5 1995/01/06 00:52:48 sra + * Update copyright notice for 2.1 release. + * + * Revision 1.4 1994/12/20 22:13:46 sra + * Fix signature for crufty glue_pkt_handle() declaration. + * + * Revision 1.3 1994/09/04 23:55:50 sra + * Get rid of most of the ancient NO_PP cruft. + * + * Revision 1.2 1994/09/04 06:13:38 sra + * Clean up antique type names and install macros. + * + * Revision 1.1 1994/01/09 23:57:29 sra + * Add support for NIT under SunOS 4.1.2. + * + */ + +#ifdef CONFIG_PREAMBLE + +#include +#include +#include +#include +#include + +#define MAX_PACKETS 50 +#define IP_MAX_PKTSIZE 1536 + +#define TCP_MAXCONN 128 + +#ifndef MEMCPY +#define MEMCPY(x, y, z) memcpy(x, y, z) +#endif + +/* + * SunOS 4.1.4's memcmp() does signed character comparision, so replace it. + * This inline code will only work with gcc, but this particular port file + * is only used for testing and demos anyway, so what the heck. + */ +#ifndef MEMCMP +#define MEMCMP(x, y, z) \ + ({ \ + register unsigned char *_x_ = (void *) (x), *_y_ = (void *) (y); \ + register unsigned _z_ = (z); \ + int _r_ = 0; \ + while (_z_-- > 0) \ + if ((_r_ = (*_x_++) - (*_y_++)) != 0) \ + break; \ + _r_; \ + }) +#endif + +#ifndef MEMSET +#define MEMSET(x, y, z) memset(x, y, z) +#endif + +#ifndef STRCMP +#define STRCMP(x, y) strcmp(x, y) +#endif + +#ifndef STRCPY +#define STRCPY(x, y) strcpy(x, y) +#endif + +#ifndef STRLEN +#define STRLEN(x) strlen(x) +#endif + +/* + * Fun with our new run-time debugging facility. + * This is still experimental, and defaults to uninstalled. + */ +#if defined(INSTALL_SNARK_BUG_CONF) && INSTALL_SNARK_BUG_CONF +#include +#endif + +/* + * Backwards compatability with old braindamage can be a real pain. + * Since this port file is strictly for debugging, we set a couple + * of configuration parameters to more reasonable values here. + */ + +/* Please do install a retransmission timeout handler */ +#define TCP_DEFAULT_MAX_RETRANSMISSIONS 0 + +/* Please buffer a reasonable number of ahead-of-sequence segments */ +#define TCP_AHEAD_Q_MAX_DEFAULT 25 + +#else /* CONFIG_PREAMBLE */ + +#include +#include + +#include +#include + +#ifdef htons +#undef htons +#endif + +#ifdef htonl +#undef htonl +#endif + +extern unsigned short htons (unsigned short); +extern unsigned long htonl (unsigned long); + +#define GLUE_ALLOC(x) ((void *) malloc(x)) +#define GLUE_FREE(x) free((char *) (x)) +#define GLUE_CKSUM(x, y) glue_cksum((bits16_t *)(x), (y)) +#define GLUE_SWAP16(x) ((bits16_t) htons((unsigned short) (x))) +#define GLUE_SWAP32(x) ((bits32_t) htonl((unsigned long) (x))) +#define GLUE_CALLIN(x, y) glue_callin(x, y) + +extern int glue_intlock (int); +extern bits16_t glue_cksum (bits16_t *, unsigned); +extern void glue_callin (bits32_t, void (*)(void)); + +#ifndef GLUE_NOW +#define GLUE_NOW() glue_now() +extern bits32_t glue_now (void); +#endif + +/* define the GLUE_SNTP_SET_TIME macro if using SNTP Client */ +#if INSTALL_ATTACHE_MULTICAST && INSTALL_ATTACHE_SNTP_CLIENT +#ifndef GLUE_SNTP_SET_TIME +#define GLUE_SNTP_SET_TIME(p, s, f) glue_set_time((p),(s),(f)) +extern void glue_set_time(packet *, bits32_t, bits32_t); +#endif +#endif + +/* Define PRINTF for debugging and printing code +#ifndef PRINTF +#define PRINTF printf +#endif +*/ + +#ifdef ATTACHE_IPSEC_H + +#define GLUE_IPSEC_SA_EXPIRED(W,X,Y,Z) \ + glue_ipsec_sa_expired(W,X,Y,Z) +extern void glue_ipsec_sa_expired (ipsec_sa_dir_t, ipaddr_t *, + bits32_t, bits8_t); + +#define GLUE_IPSEC_SND_PKT_DENIED(W,X,Y,Z) \ + glue_ipsec_snd_pkt_denied((W),(X),(Y),(Z)) + +extern void glue_ipsec_snd_pkt_denied(packet *, ipaddr_t *, ipaddr_t *, int); + + +#define GLUE_IPSEC_RCV_PKT_BADSPI(V,W,X,Y,Z) \ + glue_ipsec_rcv_pkt_badspi((V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_pkt_badspi(packet *, ipaddr_t *, ipaddr_t *, + bits32_t, bits8_t); + +#define GLUE_IPSEC_RCV_PKT_NOTPARTY(V,W,X,Y,Z) \ + glue_ipsec_rcv_pkt_notparty((V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_pkt_notparty(packet *, ipaddr_t *, ipaddr_t *, + bits32_t, bits8_t); + + +#define GLUE_IPSEC_RCV_TUNPKT_NOTIP(U,V,W,X,Y,Z) \ + glue_ipsec_rcv_tunpkt_notip((U),(V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_tunpkt_notip(packet *, packet *, ipaddr_t *, + ipaddr_t *, bits32_t, bits8_t); + +#define GLUE_IPSEC_RCV_TUNPKT_NOTPARTY(S,T,U,V,W,X,Y,Z) \ + glue_ipsec_rcv_tunpkt_notparty((S),(T),(U),(V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_tunpkt_notparty(packet *, ipaddr_t *, ipaddr_t *, + packet *, ipaddr_t *, ipaddr_t *, + bits32_t, bits8_t); + +#define GLUE_IPSEC_RCV_SA_NOTUNNEL(V,W,X,Y,Z) \ + glue_ipsec_rcv_sa_notunnel((V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_sa_notunnel(packet *, ipaddr_t *, ipaddr_t *, + bits32_t, bits8_t); + + +#define GLUE_IPSEC_RCV_PKT_BADAH(V,W,X,Y) \ + glue_ipsec_rcv_pkt_badah((V),(W),(X),(Y)) + +extern void glue_ipsec_rcv_pkt_badah(packet *, ipaddr_t *, ipaddr_t *, + bits32_t); + +#define GLUE_IPSEC_RCV_PKT_DENIED(V,W,X,Y,Z) \ + glue_ipsec_rcv_pkt_denied((V),(W),(X),(Y),(Z)) + +extern void glue_ipsec_rcv_pkt_denied(packet *, ipaddr_t *, ipaddr_t *, + ipsec_policy_flags_t, bits16_t); + + +#endif /* ATTACHE_IPSEC */ + + +#endif /* CONFIG_PREAMBLE */ diff --git a/h/wrn/wm/util/port/sunos/common.h b/h/wrn/wm/util/port/sunos/common.h new file mode 100644 index 0000000..477c531 --- /dev/null +++ b/h/wrn/wm/util/port/sunos/common.h @@ -0,0 +1,107 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/sunos/common.h,v 1.1.1.1 2001/11/05 17:47:16 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: common.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:16 tneale + * Tornado shuffle + * + * Revision 1.7 2001/01/19 22:23:17 paul + * Update copyright. + * + * Revision 1.6 2000/03/17 00:11:00 meister + * Update copyright message + * + * Revision 1.5 1998/06/19 19:28:46 sar + * added a memcmp macro to deal with the fact that the sunos memcmp + * uses signed comparisons. This is the macro from attache.h, it is + * added here so other products can use it. + * + * Revision 1.4 1998/06/10 16:39:04 sar + * Added the memory.h include file + * + * Revision 1.3 1998/02/25 04:57:07 sra + * Update copyrights. + * + * Revision 1.2 1997/08/22 16:30:45 sra + * Flesh out SunOS-specific stuff. + * + * Revision 1.1 1997/08/21 17:23:47 sra + * Begin moving configuration stuff that's common to all products to common.h + * Minor cleanups to common/lib/prng.c. Add pnrg seed function to snarkbsd. + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* + * Common definitions for all Epilogue products on 4.4-BSD derived systems. + */ + +#ifdef CONFIG_PREAMBLE + +#include +#include + +/* things that should be in some system header file but don't seem to be */ +extern int strncasecmp(); + +#ifndef STRICMP +#define STRICMP(x, y) strcasecmp(x, y) +#endif + +#ifndef STRNICMP +#define STRNICMP(x, y, z) strncasecmp(x, y, z) +#endif + +/* + * SunOS 4.1.4's memcmp() does signed character comparision, so replace it. + * This inline code will only work with gcc, but this particular port file + * is only used for testing and demos anyway, so what the heck. + */ +#ifndef MEMCMP +#define MEMCMP(x, y, z) \ + ({ \ + register unsigned char *_x_ = (void *) (x), *_y_ = (void *) (y); \ + register unsigned _z_ = (z); \ + int _r_ = 0; \ + while (_z_-- > 0) \ + if ((_r_ = (*_x_++) - (*_y_++)) != 0) \ + break; \ + _r_; \ + }) +#endif + +#else /* CONFIG_PREAMBLE */ + +#ifndef GLUE_NOW +#define GLUE_NOW() glue_now() +extern bits32_t glue_now (void); +#endif + +#ifndef GLUE_SEED_PRNG +#define GLUE_SEED_PRNG(x,y) glue_seed_prng(x,y) +extern unsigned glue_seed_prng(bits8_t *, unsigned); +#endif + +#endif /* CONFIG_PREAMBLE */ diff --git a/h/wrn/wm/util/port/sunos/decorum.h b/h/wrn/wm/util/port/sunos/decorum.h new file mode 100644 index 0000000..056d9ac --- /dev/null +++ b/h/wrn/wm/util/port/sunos/decorum.h @@ -0,0 +1,190 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/sunos/decorum.h,v 1.3 2003/01/15 14:00:28 josh Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1996-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: decorum.h,v $ + * Revision 1.3 2003/01/15 14:00:28 josh + * directory structure shifting + * + * Revision 1.2 2002/02/26 18:22:55 josh + * updating paths in port files + * + * Revision 1.1.1.1 2001/11/05 17:47:16 tneale + * Tornado shuffle + * + * Revision 2.5 2001/01/19 22:23:17 paul + * Update copyright. + * + * Revision 2.4 2000/03/17 00:11:00 meister + * Update copyright message + * + * Revision 2.3 1998/02/25 04:57:08 sra + * Update copyrights. + * + * Revision 2.2 1998/02/16 21:33:44 josh + * decorum port file now uses epilogue_char_t where appropriate + * + * Revision 2.1 1997/09/17 18:37:41 josh + * include malloc.h so malloc() and free() will be defined + * + * Revision 2.0 1997/09/11 15:08:18 josh + * updating version numbers for release + * + * Revision 1.2 1997/09/08 14:55:05 josh + * a few constants that were left out... + * + * Revision 1.1 1997/08/11 18:50:28 josh + * added ETC_STDIO_WRITE + * + * Revision 1.0 1997/08/08 22:11:22 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.9 1997/07/18 20:56:41 josh + * modifications for the recently adapted HTTPD. Nothing big, + * just added a couple of macros and changed to + * + * + * Revision 0.8 1997/05/17 23:08:52 sra + * Clean up some SunOS/gcc warnings. + * + * Revision 0.7 1997/03/20 06:57:52 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.6 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.5 1996/10/29 23:02:34 sar + * added some includes to keep compilers happy + * + * Revision 0.4 1996/10/28 17:49:14 sar + * added use of decorum_size_t + * + * Revision 0.3 1996/10/27 16:54:09 lowell + * ETC_STDIO_SIZE + * + * Revision 0.2 1996/10/26 23:22:27 lowell + * DECORUM_SENDBUF_LEN and ETC_STDIO_READ + * + * Revision 0.1 1996/10/23 00:14:56 sar + * *** empty log message *** + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +#if (!defined(decorum_inc)) +#define decorum_inc + +#include +#include +#include +#include +#include + +#ifndef DECORUM_ALLOC +#define DECORUM_ALLOC(x) ((void *) malloc(x)) +#endif +#ifndef DECORUM_FREE +#define DECORUM_FREE(x) (free((char *) (x))) +#endif + +/* This first should be the same as SNMP_MAX_PACKET_SIZE in envoy.h */ +#define DECORUM_MAX_PACKET_SIZE (1400) +#define DECORUM_DEFAULT_RECEIVE_BUFLEN (512) + +/* needed for OIDC_T definition */ +#if INSTALL_DECORUM_PROXY && (!defined(asn1conf_inc)) +#include +#endif + +/* Some input routines, these are provided but may be replaced with + more efficient implentations if desired */ +extern sbits16_t decorum_parse_sbits32 (epilogue_char_t *, + epilogue_char_t **, + sbits32_t *); +extern sbits16_t decorum_parse_bits32 (epilogue_char_t *, + epilogue_char_t **, + bits32_t *); +extern sbits16_t decorum_parse_hexstring (epilogue_char_t *, + epilogue_char_t *, + decorum_size_t); +#define ETC_STRING_GET_SBITS32 decorum_parse_sbits32 +#define ETC_STRING_GET_BITS32 decorum_parse_bits32 +#define ETC_STRING_GET_HEXSTRING decorum_parse_hexstring + +/* a routine to output a number to a byte string, used to create + file/stream names */ +#define ETC_STDIO_SPRINTF(buf, num, str) sprintf(buf, "%lu%s", num, str) + +/* Define the structure that will be used for holding output + until we are done */ +typedef FILE etc_stdio_t; + +/* Macros for opening, closing and removing a stream */ +#define ETC_STDIO_MODE_READ "r" +#define ETC_STDIO_MODE_WRITE "w+" + +#define ETC_STDIO_OPEN(fname, how) fopen(fname, how) +#define ETC_STDIO_CLOSE(outstream) fclose(outstream) +#define ETC_STDIO_REMOVE(fname) unlink(fname) +#define ETC_STDIO_READ(instream, size, buf) \ + fread((buf), 1, (size), (instream)) +#define ETC_STDIO_WRITE(outstream, size, buf) \ + fwrite((buf), 1, (size), (outstream)) +extern bits32_t file_size_32(char * fname); +#define ETC_STDIO_SIZE(fname) (file_size_32(fname)) + +/* Define the base output routines */ +extern sbits16_t decorum_put_string (etc_stdio_t *, epilogue_char_t *, + decorum_size_t); +extern sbits16_t decorum_put_sbits32 (etc_stdio_t *, sbits32_t); +extern sbits16_t decorum_put_bits32 (etc_stdio_t *, bits32_t); +extern sbits16_t decorum_put_hex_string (etc_stdio_t *, bits8_t *, + decorum_size_t); +#define ETC_STDIO_PUT_STRING decorum_put_string +#define ETC_STDIO_PUT_SBITS32 decorum_put_sbits32 +#define ETC_STDIO_PUT_BITS32 decorum_put_bits32 +#define ETC_STDIO_PUT_HEX_STRING decorum_put_hex_string + +#if INSTALL_DECORUM_PROXY +/* Define a more complex output routine, this may use the + base routines (as the example code does) or may be more direct */ +extern sbits16_t decorum_put_oid (etc_stdio_t *, OIDC_T *, decorum_size_t); +#define ETC_STDIO_PUT_OID decorum_put_oid +#endif /* INSTALL_DECORUM_PROXY */ + +/* Define a string comparison routine */ +#define ETC_STRING_STRCASECMP strcasecmp +extern int strcasecmp(); + +/* Define a string length routine */ +#define ETC_STRING_STRLEN strlen + +/* Define a routine that gets the current time. */ +#define DECORUM_GET_RAWTIME(timeval_p) unix_glue_getime ((timeval_p)); +/* Define a routine that figgers out how big a buffer to use for a chunk + * of outgoing data. */ +#define DECORUM_SENDBUF_LEN(http_sb) (512) + +#endif /* #if (!defined(decorum_inc)) */ diff --git a/h/wrn/wm/util/port/sunos/emissary.h b/h/wrn/wm/util/port/sunos/emissary.h new file mode 100644 index 0000000..32a43c6 --- /dev/null +++ b/h/wrn/wm/util/port/sunos/emissary.h @@ -0,0 +1,89 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/sunos/emissary.h,v 1.1.1.1 2001/11/05 17:47:16 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1992-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: emissary.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:16 tneale + * Tornado shuffle + * + * Revision 1.3 2001/01/19 22:23:18 paul + * Update copyright. + * + * Revision 1.2 2000/03/17 00:11:00 meister + * Update copyright message + * + * Revision 1.1 1998/02/25 04:57:08 sra + * Update copyrights. + * + * Revision 1.0 1997/08/08 22:11:23 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.3 1997/03/20 06:57:52 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.1 1996/10/23 00:14:56 sar + * *** empty log message *** + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/* + * The following declarations shouldn't be necessary, particularly the ones + * that are stdio internal functions, but GCC whines without them. Should + * be harmless in any case. + */ +extern char *getenv (const char *); +extern int _filbuf (FILE *); +extern int _flsbuf (unsigned int, FILE *); +extern int fclose (FILE *); +extern int fprintf (FILE *, const char *, ...); +extern int fputs (const char *, FILE *); +extern int fseek (FILE *, long int, int); +extern int tolower (int); +extern int ungetc (int, FILE *); +extern long time (long *); +extern unsigned long fwrite (const void *,unsigned long,unsigned long,FILE *); +extern void perror (const char *); diff --git a/h/wrn/wm/util/port/sunos/envoy.h b/h/wrn/wm/util/port/sunos/envoy.h new file mode 100644 index 0000000..e8f3e10 --- /dev/null +++ b/h/wrn/wm/util/port/sunos/envoy.h @@ -0,0 +1,183 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/sunos/envoy.h,v 1.1.1.1 2001/11/05 17:47:16 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: envoy.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:16 tneale + * Tornado shuffle + * + * Revision 1.8 2001/01/19 22:23:18 paul + * Update copyright. + * + * Revision 1.7 2000/03/17 00:11:00 meister + * Update copyright message + * + * Revision 1.6 1998/06/22 01:05:52 sar + * Moved common porting stuff to generic/envoy.h + * + * Revision 1.5 1998/06/17 05:05:30 sar + * Tidy up some macros for views + * + * Revision 1.4 1998/06/10 19:22:12 sar + * Added V3 macros and routines and rearranged the whole file + * to be more readable (at least to me). + * + * Revision 1.3 1998/02/25 04:57:09 sra + * Update copyrights. + * + * Revision 1.2 1997/11/04 00:29:37 sar + * Changed the agentx sub agent timeout period from 10000 (10 seconds) + * which was used for testing to 1000 (1 second). + * + * Revision 1.1 1997/10/23 06:21:30 sar + * Updates for agentx, this includes some new installation options and + * renaming the older ones for the older subagent scheme + * + * Revision 1.0 1997/08/08 22:11:23 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.5 1997/03/20 06:57:53 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.4 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.3 1997/01/15 22:30:42 sar + * moved location of nvutils.h to snark/snmptalk + * + * Revision 0.2 1996/10/28 02:44:53 sra + * Fix missing comment marker. + * + * Revision 0.1 1996/10/23 00:14:56 sar + * *** empty log message *** + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* previous revision history when this was envoy/port/sunos/envoy.h + * with rev and copyright updates removed + * + * Revision 6.5 1996/02/27 00:03:03 sar + * Updated partytime to be usectime + * + * Revision 6.4 1995/11/14 22:37:59 sar + * If proxy is installed release_private is proxy_release_private + * + * Revision 6.3 1995/11/10 23:59:08 sar + * stopped using the pre & post set user exits for the nvview stuff + * + * Revision 6.2 1995/11/06 20:05:22 sar + * Removed validate_community's dependency on install v1 + * removed validate_address & validate_vesion + * + * Revision 6.1 1995/10/20 23:15:55 sar + * removed party, context and acl macros + * + * Revision 5.6 1995/05/22 19:39:24 sar + * Modified the lock code to add some new macros. + * + * Revision 5.5 1995/05/02 23:39:31 sar + * Added the envoy timer macros. + * + * Revision 5.4 1995/05/01 21:58:15 sar + * Put the example lock macros in an ifdef block + * + * Revision 5.3 1995/05/01 20:59:29 sra + * Have to test CONFIG_PPREAMBLE with #ifdef, not #if. + * + * Revision 5.2 1994/11/01 17:59:04 sar + * *_add_mod routines now take a flag as well as an data block. + * + * Revision 5.1 1994/09/29 20:39:39 sar + * added macros for a simple locking scheme to test the compiliation of + * our code + * Modified the macros for use with the non volatile storage stuff to + * use the new (as of fall 94) scheme. + * + * Revision 4.3 1994/05/12 17:24:05 sar + * moved the include for nvutils.h to make it available for everybody + * that needs it. + * + * Revision 4.2 1994/05/10 20:21:45 sar + * moved view defines aroudn so they are available in other than v2 settings. + * + * Revision 4.1 1994/05/09 21:06:41 sar + * Added define for SNMP_RESETSYSUPTIME to be nothing. + * + */ + +/***************************************************************** + + This is the platform specific part of envoy.h for use with the + example code. It contains only the platform specific pieces of + the port code. The common porting code is in generic/envoy.h. + + In general customers will have one envoy.h file per platform + that combines this file and the platform specific information, + we use two files as there is a lot of shared code between our + demos. + +*****************************************************************/ + +#ifdef CONFIG_PREAMBLE + +/***************************************************************** + + System Includes: + + Envoy uses memcpy(), memset(), and strlen(). The appropriate + include file should be put here to see that these routines are + properly declared. If no such include file exists on the system + then declare memcpy() and memset() here directly. Envoy also + uses min() and max(). Include the system's definition or use the + macros supplied below. +*****************************************************************/ + +#include +#include + +/***************************************************************** + Memory allocation routines. Envoy needs to allocate memory to + decode the packet into and also to store the response data + + Make sure that the routines used by the SNMP_memory_alloc() and + SNMP_memory_free() macros are declared. If system memory routines + are used (e.g. malloc() and free()) then include the appropriate + system header file here. +*****************************************************************/ + +/* Get malloc and free declarations */ +#include + +#define SNMP_memory_alloc(need) malloc(need) +#define SNMP_memory_free(buf) free(buf) + +#include + +#else /* config preamble */ + +#include + +#endif /* CONFIG_PREAMBLE */ diff --git a/h/wrn/wm/util/port/sunos/liaison.h b/h/wrn/wm/util/port/sunos/liaison.h new file mode 100644 index 0000000..2400a0a --- /dev/null +++ b/h/wrn/wm/util/port/sunos/liaison.h @@ -0,0 +1,49 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/sunos/liaison.h,v 1.1.1.1 2001/11/05 17:47:16 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1996-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: liaison.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:16 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:23:18 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:11:00 meister + * Update copyright message + * + * Revision 1.2 1998/02/25 04:57:10 sra + * Update copyrights. + * + * Revision 1.1 1997/11/18 19:59:35 josh + * liaison.h is a dummy file for now, but it will probably have stuff + * in the future + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +#if (!defined(liaison_inc)) +#define liaison_inc + +#endif /* #if (!defined(liaison_inc)) */ diff --git a/h/wrn/wm/util/port/sunos/oemtypes.h b/h/wrn/wm/util/port/sunos/oemtypes.h new file mode 100644 index 0000000..2851d11 --- /dev/null +++ b/h/wrn/wm/util/port/sunos/oemtypes.h @@ -0,0 +1,69 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/sunos/oemtypes.h,v 1.1.1.1 2001/11/05 17:47:16 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: oemtypes.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:16 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:23:18 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:11:00 meister + * Update copyright message + * + * Revision 1.2 1998/06/10 16:37:21 sar + * Added stdtypes to get the size_t construct + * + * Revision 1.1 1998/02/25 04:57:10 sra + * Update copyrights. + * + * Revision 1.0 1997/08/08 22:11:24 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.3 1997/03/20 06:57:54 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.1 1996/10/23 00:14:56 sar + * *** empty log message *** + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* get the size_t construct */ +#include + +/* The sun compiler doesn't understand the `signed' keyword */ + +#define __TYPES_HAVE_sbits8_t_ 1 +typedef char sbits8_t; /* signed 8 bits */ +#define __TYPES_HAVE_sbits16_t_ 1 +typedef short sbits16_t; /* signed 16 bits */ +#define __TYPES_HAVE_sbits32_t_ 1 +typedef long sbits32_t; /* signed 32 bits */ + diff --git a/h/wrn/wm/util/port/sunos/snark.h b/h/wrn/wm/util/port/sunos/snark.h new file mode 100644 index 0000000..94eb72f --- /dev/null +++ b/h/wrn/wm/util/port/sunos/snark.h @@ -0,0 +1,119 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/sunos/snark.h,v 1.1.1.1 2001/11/05 17:47:16 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1994-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: snark.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:16 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:23:18 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:11:01 meister + * Update copyright message + * + * Revision 1.2 1999/05/21 16:45:24 sra + * vsnprintf() => VSNPRINTF(). + * + * Revision 1.1 1998/02/25 04:57:11 sra + * Update copyrights. + * + * Revision 1.0 1997/08/08 22:11:24 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.6 1997/05/17 23:08:53 sra + * Clean up some SunOS/gcc warnings. + * + * Revision 0.5 1997/03/20 06:57:54 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.4 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.3 1997/02/24 00:56:59 sra + * Support for run-time configuration of BUG() macros. + * + * Revision 0.2 1997/02/19 08:10:29 sra + * More fun merging snmptalk into snark, general snark cleanup. + * + * Revision 0.1 1996/10/23 00:14:56 sar + * *** empty log message *** + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +#include +#include +#include +#include + +#define SNARK_ATTACHE_MAXLNH 20 + +#ifndef GLUE_ALLOC +#define GLUE_ALLOC(x) ((void *) malloc(x)) +#endif + +#ifndef GLUE_FREE +#define GLUE_FREE(x) free((char *) (x)) +#endif + +#ifndef MEMCPY +#define MEMCPY(x, y, z) memcpy(x, y, z) +#endif + +#ifndef MEMCMP +#define MEMCMP(x, y, z) memcmp(x, y, z) +#endif + +#ifndef MEMSET +#define MEMSET(x, y, z) memset(x, y, z) +#endif + +#ifndef STRCMP +#define STRCMP(x, y) strcmp(x, y) +#endif + +#ifndef STRCPY +#define STRCPY(x, y) strcpy(x, y) +#endif + +#ifndef STRLEN +#define STRLEN(x) strlen(x) +#endif + +#ifndef STRNICMP +#define STRNICMP(x, y, z) strncasecmp(x, y, z) +#endif + +#ifndef STRICMP +#define STRICMP(x, y) strcasecmp(x, y) +#endif + +#define stricmp STRICMP +#define strnicmp STRNICMP + +/* This stuff all should be defined in some system header file or another, but I don't see it. */ +extern int strcasecmp(), strncasecmp(), gettimeofday(), ioctl(), bzero(), select(); +extern int setlinebuf(), sendto(), random(), recv(), socket(), bind(); diff --git a/h/wrn/wm/util/port/sunos/snmptalk.h b/h/wrn/wm/util/port/sunos/snmptalk.h new file mode 100644 index 0000000..eca90fe --- /dev/null +++ b/h/wrn/wm/util/port/sunos/snmptalk.h @@ -0,0 +1,72 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/sunos/snmptalk.h,v 1.1.1.1 2001/11/05 17:47:16 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: snmptalk.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:16 tneale + * Tornado shuffle + * + * Revision 1.4 2001/01/19 22:23:19 paul + * Update copyright. + * + * Revision 1.3 2000/03/17 00:11:01 meister + * Update copyright message + * + * Revision 1.2 1998/06/10 16:40:37 sar + * removed needs_strtol, this is now handled by an install option + * + * Revision 1.1 1998/02/25 04:57:11 sra + * Update copyrights. + * + * Revision 1.0 1997/08/08 22:11:24 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.5 1997/05/17 23:08:54 sra + * Clean up some SunOS/gcc warnings. + * + * Revision 0.4 1997/03/20 06:57:55 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.3 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.2 1996/10/30 22:10:02 sar + * removed bsd_release + * + * Revision 0.1 1996/10/23 00:14:56 sar + * *** empty log message *** + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + + +#include +#include + +/* defines for nvutils for file manipulation */ +#define SNMP_READONLY "r" +#define SNMP_READPLUS "r+" +#define SNMP_WRITEPLUS "w+" +#define SNMP_REMOVE_FILE(fname) unlink(fname) diff --git a/h/wrn/wm/util/port/sunos/telnet.h b/h/wrn/wm/util/port/sunos/telnet.h new file mode 100644 index 0000000..4151419 --- /dev/null +++ b/h/wrn/wm/util/port/sunos/telnet.h @@ -0,0 +1,77 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/sunos/telnet.h,v 1.1.1.1 2001/11/05 17:47:16 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1994-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: telnet.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:16 tneale + * Tornado shuffle + * + * Revision 1.3 2001/01/19 22:23:19 paul + * Update copyright. + * + * Revision 1.2 2000/03/17 00:11:01 meister + * Update copyright message + * + * Revision 1.1 1998/02/25 04:57:11 sra + * Update copyrights. + * + * Revision 1.0 1997/08/08 22:11:25 meister + * Bumped revision number to 1.0 to hopfully get rid of the spurious + * added files weirdness + * + * Revision 0.3 1997/03/20 06:57:51 sra + * DFARS-safe copyright text. Zap! + * + * Revision 0.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 0.1 1996/10/23 00:14:56 sar + * *** empty log message *** + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* + * Use '\n' for local newline convention in both directions. + */ + +#define TN_LOCAL_NEWLINE '\n' + +/* + * All the windowing stuff for server telnet connections is controlled + * by the sty code, so shunt the decisions off to the sty_tn interface module. + * + * For client telnet connections we're not buffering output, so we just + * return a constant window size. + */ + +#define TN_INITIAL_ACTIVE_WINDOW_SIZE (4096) +#define TN_INITIAL_PASSIVE_WINDOW_SIZE (stytn_space_initial) + +#define GLUE_TN_WINDOW_SIZE(_tn_) \ + (tn_get_flags((_tn_), TN_FLG_ACT_AS_SERVER) \ + ? stytn_space_left((_tn_)) \ + : TN_INITIAL_ACTIVE_WINDOW_SIZE) + +extern unsigned stytn_space_initial, stytn_space_left(); diff --git a/h/wrn/wm/util/port/vxworks/common.h b/h/wrn/wm/util/port/vxworks/common.h new file mode 100644 index 0000000..ec1bfd9 --- /dev/null +++ b/h/wrn/wm/util/port/vxworks/common.h @@ -0,0 +1,108 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/vxworks/common.h,v 1.3 2003/01/15 14:00:28 josh Exp $ */ + + +/* + * Copyright (C) 1999-2003 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + +/* + * + * Copyright 1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + * + */ + +/* + * $Log: common.h,v $ + * Revision 1.3 2003/01/15 14:00:28 josh + * directory structure shifting + * + * Revision 1.2 2001/11/07 14:26:53 tneale + * Added wm to include path + * + * Revision 1.1.1.1 2001/11/05 17:47:17 tneale + * Tornado shuffle + * + * Revision 1.3 2000/02/04 21:49:29 josh + * modified header files for clean builds of vxWorks demo + * + * Revision 1.2 2000/01/28 23:09:25 josh + * make sure we're really using memcmp() when we intend to + * + * Revision 1.1 2000/01/27 18:25:29 josh + * initial checkin of porting files for vxWorks + * + * + */ + +/* +modification history +------------------- +01a,06oct04,job draw processor alignment from vxWorks header files +*/ + +#include + +#include + +#ifdef INSTALL_ON_BIG_ENDIAN +#undef INSTALL_ON_BIG_ENDIAN +#endif + +#ifdef INSTALL_ON_LITTLE_ENDIAN +#undef INSTALL_ON_LITTLE_ENDIAN +#endif + +#if (_BYTE_ORDER == _BIG_ENDIAN) +#define INSTALL_ON_BIG_ENDIAN 1 +#define INSTALL_ON_LITTLE_ENDIAN 0 +#elif (_BYTE_ORDER == _LITTLE_ENDIAN) +#define INSTALL_ON_LITTLE_ENDIAN 1 +#define INSTALL_ON_BIT_ENDIAN 0 +#endif + +#ifdef CONFIG_PREAMBLE + +/* This is a sample of how one might use the BUG() macros for simple + * debugging. You can almost certainly do better than this, see the + * comments in common/h/bug.h for details. This definition suffices + * for simple (and very verbose) debugging. + */ + +#if 0 && defined(INSTALL_BUG) && INSTALL_BUG + +#define BUG_OUT stdout + +#define BUG(w,x,y,z) \ + do {\ + fprintf z;\ + fprintf (BUG_OUT, "\n");\ + if ((x) == BUG_FATAL)\ + t_suspend(0L);\ + } while (0) + +#include + +#endif /* defined(INSTALL_BUG) && INSTALL_BUG */ + +/* + * Fun with our new run-time debugging facility. + * This is still experimental, and defaults to uninstalled. + */ +#if defined(INSTALL_SNARK_BUG_CONF) && INSTALL_SNARK_BUG_CONF +#include +#endif + +#else /* CONFIG_PREAMBLE */ + +#define GLUE_ALLOC(x) ((void *) malloc(x)) +#define GLUE_FREE(x) free((char *) (x)) +#define GLUE_NOW() glue_now() + +#endif /* CONFIG_PREAMBLE */ diff --git a/h/wrn/wm/util/port/vxworks/envoy.h b/h/wrn/wm/util/port/vxworks/envoy.h new file mode 100644 index 0000000..a3c7265 --- /dev/null +++ b/h/wrn/wm/util/port/vxworks/envoy.h @@ -0,0 +1,988 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/vxworks/envoy.h,v 1.6 2002/05/23 19:42:41 josh Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1994-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* +modification history +-------------------- +01g,02may05,job vxWorks-specific definition of SNMP_DH_RAND moves here +01f,06oct04,job draw processor alignment from vxWorks header files +01e,26nov03,ps copyright update +01d,05nov03,ps merge from latest on ickthwa_devel_branch.nh +01c,19apr98,ann changed ENVOY_SNMP_INIT_LOCK macro +01b,04jun96,rjc changed #if defined to #if +01a,01may96,rjc Added copyright header +*/ + +/* envoy/port/sunos/envoy.h + * configuration for Envoy on VxWorks + */ + +/* + * $Date: 2002/05/23 19:42:41 $ + * $Revision: 1.6 $ + * $Author: josh $ + * + * $Log: envoy.h,v $ + * Revision 1.6 2002/05/23 19:42:41 josh + * updates to support the entity MIB + * + * Revision 1.5 2002/04/05 13:45:18 andre + * Add ENVOY_AX_GET_CONNID user-exit. + * + * Revision 1.4 2002/04/04 15:23:15 andre + * Clean up; change enum params to int. + * + * Revision 1.2 2001/11/07 14:26:53 tneale + * Added wm to include path + * + * Revision 1.1.1.1 2001/11/05 17:47:17 tneale + * Tornado shuffle + * + * Revision 1.7.4.3 2001/10/29 21:42:50 josh + * adding a spot for the proxy forwarding routine + * + * Revision 1.7.4.2 2001/09/24 16:44:39 josh + * add a prototype for a function + * + * Revision 1.7.4.1 2001/08/24 15:35:20 josh + * add nonvolatile access definitions for proxy and community tables + * + * Revision 1.7 2001/04/13 18:09:25 josh + * merging in changes from kingfisher branch + * + * Revision 1.6 2000/07/26 19:39:31 josh + * fixing a broken comment + * + * Revision 1.5 2000/06/09 14:57:35 josh + * updating header files to correspond with new installation options and + * new code + * + * Revision 1.4.2.5 2001/03/12 22:09:03 tneale + * Updated copyright + * + * Revision 1.4.2.4 2000/12/07 22:09:56 tneale + * Added definition for ENVOY_AX_SA_MIB_ROOT_NODE + * + * Revision 1.4.2.3 2000/10/26 21:36:00 josh + * fixing a few bugs in the vxWorks AgentX master agent + * + * Revision 1.4.2.2 2000/10/18 20:05:41 josh + * added a definition for ENVOY_SNMP_FREE_LOCK_TAG() and removed + * responsibility for cleaning continue lock from + * snmpHookPrivRelease() + * + * Revision 1.4.2.1 2000/10/13 21:33:16 josh + * AgentX updates + * + * Revision 1.4 2000/03/08 20:01:13 josh + * SNMPv3 support for the vxWorks port of Envoy + * + * Revision 1.3 2000/03/07 21:23:37 josh + * overwriting old envoy.h withnew one corresponding to new demo + * + * Revision 7.0 1996/03/18 20:25:29 sar + * Updated rev to 7.0 and copyright ot 96 + * + * Revision 6.5 1996/02/27 00:03:03 sar + * Updated partytime to be usectime + * + * Revision 6.4 1995/11/14 22:37:59 sar + * If proxy is installed release_private is proxy_release_private + * + * Revision 6.3 1995/11/10 23:59:08 sar + * stopped using the pre & post set user exits for the nvview stuff + * + * Revision 6.2 1995/11/06 20:05:22 sar + * Removed validate_community's dependency on install v1 + * removed validate_address & validate_vesion + * + * Revision 6.1 1995/10/20 23:15:55 sar + * remvoed party, context and acl macros + * + * Revision 6.0 1995/05/31 22:00:33 sra + * Release 6.0. + * + * Revision 5.6 1995/05/22 19:39:24 sar + * Modified the lock code to add some new macros. + * + * Revision 5.5 1995/05/02 23:39:31 sar + * Added the envoy timer macros. + * + * Revision 5.4 1995/05/01 21:58:15 sar + * Put the example lock macros in an ifdef block + * + * Revision 5.3 1995/05/01 20:59:29 sra + * Have to test CONFIG_PREAMBLE with #ifdef, not #if. + * + * Revision 5.2 1994/11/01 17:59:04 sar + * *_add_mod routines now take a flag as well as an data block. + * + * Revision 5.1 1994/09/29 20:39:39 sar + * added macros for a simple locking scheme to test the compiliation of + * our code + * Modified the macros for use with the non volatile storage stuff to + * use the new (as of fall 94) scheme. + * + * Revision 5.0 1994/05/16 16:47:41 sar + * Updated revision to 5.0 and copyright to include 1994 + * + * Revision 4.3 1994/05/12 17:24:05 sar + * moved the include for nvutils.h to make it available for everybody + * that needs it. + * + * Revision 4.2 1994/05/10 20:21:45 sar + * moved view defines aroudn so they are available in other than v2 settings. + * + * Revision 4.1 1994/05/09 21:06:41 sar + * Added define for SNMP_RESETSYSUPTIME to be nothing. + * + * Revision 4.0 1993/06/24 17:44:26 sar + * Updated rev to 4.0 and copyright to 93 + * + * Revision 1.1 1993/06/09 19:33:45 dab + * Initial revision + * + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include + +#ifdef INSTALL_ON_BIG_ENDIAN +#undef INSTALL_ON_BIG_ENDIAN +#endif + +#ifdef INSTALL_ON_LITTLE_ENDIAN +#undef INSTALL_ON_LITTLE_ENDIAN +#endif + +#if (_BYTE_ORDER == _BIG_ENDIAN) +#define INSTALL_ON_BIG_ENDIAN 1 +#define INSTALL_ON_LITTLE_ENDIAN 0 +#elif (_BYTE_ORDER == _LITTLE_ENDIAN) +#define INSTALL_ON_LITTLE_ENDIAN 1 +#define INSTALL_ON_BIT_ENDIAN 0 +#endif + +#ifdef INSTALL_ENVOY_SNMP_LOCK +#include +#endif /* INSTALL_ENVOY_SNMP_LOCK */ + + +#ifdef CONFIG_PREAMBLE + +/***************************************************************** + * + * System Includes: + * + * The SNMP uses memcpy(), memset(), and strlen(). The appropriate + * include file should be put here to see that these routines are + * properly declared. If no such include file exists on the system + * then declare memcpy() and memset() here directly. The SNMP also + * uses min() and max(). Include the system's definition or use the + * macros supplied below. + *****************************************************************/ +#include + + + +/***************************************************************** + * Memory allocation routines. The SNMP needs to allocate memory to + * decode the packet into and also to store the response data for GET's + * and GET-NEXT's. + *****************************************************************/ + +/*---------------------------------------------------------------- + * Make sure that the routines used by the SNMP_memory_alloc() and + * SNMP_memory_free() macros are declared. If system memory routines + * are used (e.g. malloc() and free()) then include the appropriate + * system header file here. + ----------------------------------------------------------------*/ +extern void * snmpdMemoryAlloc (size_t); +extern void snmpdMemoryFree (void *); + +#define SNMP_memory_alloc(p) snmpdMemoryAlloc (p) +#define SNMP_memory_free(p) snmpdMemoryFree (p) + + + + +/* Define the maximum packet size this implementation will accept. */ +/* There is no hard upper limit. SNMP_MAX_PACKET_SIZE should not be */ +/* reduced below the value of SNMP_MIN_PACKET_SIZE. */ + +/* xxxxxxxxxxxxxxxxxxxxxxxxxxx*/ + +#define SNMP_MAX_PACKET_SIZE (8*1024) +#define SNMP_MIN_PACKET_SIZE 484 /* shouldn't change */ + +/* Say what is the maximum number of components of an object identifer */ +/* which we can handle, including those in the instance. */ +#define MAX_OID_COUNT 32 + +#if (INSTALL_ENVOY_SNMP_LOCK) +typedef SEM_ID ENVOY_LOCK_T; +#endif + + +#define ENVOY_SA_SET_TIMEOUT 100000 + +#else /* CONFIG_PREAMBLE */ + +/***************************************************************** + * + * The following macro definitions allow access to the user configurable + * part of the SNMP code. + * + *****************************************************************/ + +/***************************************************************** + * Include any declarations needed for the routines specified below + * by the macros. Don't put here because this file is + * included by that one. + *****************************************************************/ + +/*---------------------------------------------------------------- + SNMP_validate_community -- Check an operation against the community name. + +Parameters: + SNMP_PKT_T *pkt The received packet (decoded format) + SNMPADDR_T *src Source of the packet + SNMPADDR_T *dst Destination of the packet (most likely + the address of the machine on which this + code is running.) + +Returns: + This procedure should return 0 if happy with the community and + 1 if not. + + This routine should fill in the packet structure with the mib + view mask associated with the community string. + This routine may hang additional data onto the "private" field of + the packet structure. The user will be given the opportinity to + release that memory via SNMP_release_private(). + + ----------------------------------------------------------------*/ + +extern int snmpIoCommunityValidate __((SNMP_PKT_T *, SNMPADDR_T *, \ + SNMPADDR_T *)); +#define SNMP_validate_community(pkt, src, dst) \ + snmpIoCommunityValidate (pkt, src, dst) + +#if (INSTALL_ENVOY_SNMP_RFC1445_VIEWS) + +#if 0 /* not supported for vxWorks agent */ + +#include + +#define SNMP_VIEW_CREATE_TEST(PKT, NEW) SNMP_NV_View_Add_Mod(NEW, 0) +#define SNMP_VIEW_UPDATE_TEST(PKT, OLD, NEW) SNMP_NV_View_Add_Mod(NEW, 0) +#define SNMP_VIEW_DESTROY_TEST(PKT, OLD) SNMP_NV_View_Add_Mod(OLD, 1) +#define SNMP_VIEW_BACKOUT_HOOK(NEW) SNMP_NV_Clean() +#define SNMP_VIEW_CREATE_UNDO(NEW) (SNMP_NV_Clean(), 0) +#define SNMP_VIEW_UPDATE_UNDO(OLD, NEW) (SNMP_NV_Clean(), 0) +#define SNMP_VIEW_DESTROY_UNDO(OLD) (SNMP_NV_Clean(), 0) +#define SNMP_VIEW_DESTROY_BACKOUT(OLD) SNMP_NV_Clean() +#define SNMP_VIEW_FINISHED SNMP_NV_Doit() + + +#endif /* 0 (not supported for vxWorks agent) */ + +#endif /* version2, master agent, v2 views */ + +#if (INSTALL_ENVOY_SNMP_RFC2275_VIEWS) +#include + +#define SNMP_VIEW_2275_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_view_2275_test(PKT, VBP, CUR, NEW) +#define SNMP_VIEW_2275_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_view_2275_test(PKT, VBP, CUR, NEW) +#define SNMP_VIEW_2275_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_view_2275_test(PKT, VBP, CUR, NEW) + +#define SNMP_VIEW_2275_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_view_2275_set(PKT, VBP, CUR, NEW) +#define SNMP_VIEW_2275_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_view_2275_set(PKT, VBP, CUR, NEW) +#define SNMP_VIEW_2275_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_view_2275_set(PKT, VBP, CUR, NEW) + +#define SNMP_VIEW_2275_DESTROY_BACKOUT(CUR, NEW) \ + snmp_view_2275_backout(CUR, NEW) +#define SNMP_VIEW_2275_CREATE_BACKOUT(CUR, NEW) \ + snmp_view_2275_backout(CUR, NEW) +#define SNMP_VIEW_2275_UPDATE_BACKOUT(CUR, NEW) \ + snmp_view_2275_backout(CUR, NEW) + +#define SNMP_VIEW_2275_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_view_2275_undo(PKT, VBP, CUR, SAV) +#define SNMP_VIEW_2275_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_view_2275_undo(PKT, VBP, CUR, SAV) +#define SNMP_VIEW_2275_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_view_2275_undo(PKT, VBP, CUR, SAV) + +#define SNMP_VIEW_2275_FINISHED() snmp_view_2275_finished() + +#endif /* #if (INSTALL_ENVOY_SNMP_RFC2275_VIEWS) */ + + +/***************************************************************** + If version 3 is installed we may need the following macros. + + ENVOY_TIME - returns a clock with a granularity of seconds + PARAMETERS: none + returns: bits32_t + + SNMP_validate_address + This routine gives the user a chance to examine the address + information as well as most of the packet itself before a v3 + packet is processed. The routine must attach the address + information to the packet. It may attach a non-default mib + tree if desired. Note: in some error cases the packet will + not be decoded when this routine is called. + + Parameters: + SNMP_PKT_T *pkt The received packet (decoded format) + SNMPADDR_T *src Source of the packet + SNMPADDR_T *dst Destination of the packet (most likely + the address of the machine on which this + code is running.) + returns: + 0 - ok + 1 - failure, drop the packet + + + Lastly are are a series of macros that will connect the method + routines we supplied for the v3 tables to your non-volatile + storage areas. You should consult the manuals for more information + about these macros. +*****************************************************************/ +#if INSTALL_ENVOY_SNMP_VERSION_3 +#include + +extern bits32_t snmpSecsGet(void); +#define ENVOY_TIME() snmpSecsGet() + + +extern int snmpIoAddressValidate __((SNMP_PKT_T *, SNMPADDR_T *, \ + SNMPADDR_T *)); +#define SNMP_validate_address(pkt, src, dst) \ + snmpIoAddressValidate (pkt, src, dst) +#if INSTALL_ENVOY_SNMP_V3_NOTIFY + +extern int envoy_taddress_to_snmpaddr(SNMPADDR_T *, OBJ_ID_T *, EBUFFER_T *); +extern int envoy_snmpaddr_to_taddress(SNMPADDR_T *, OBJ_ID_T *, EBUFFER_T *); + +#define ENVOY_TADDRESS_TO_SNMPADDR(A, D, T) \ + envoy_taddress_to_snmpaddr(A, D, T) + + +#define ENVOY_SNMPADDR_TO_TADDRESS(A, D, T) \ + envoy_snmpaddr_to_taddress(A, D, T) +#endif + +#define SNMP_V3_GROUP_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_group_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_GROUP_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_group_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_GROUP_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_group_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_GROUP_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_group_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_GROUP_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_group_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_GROUP_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_group_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_GROUP_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_group_backout(CUR, NEW) +#define SNMP_V3_GROUP_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_group_backout(CUR, NEW) +#define SNMP_V3_GROUP_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_group_backout(CUR, NEW) + +#define SNMP_V3_GROUP_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_group_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_GROUP_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_group_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_GROUP_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_group_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_GROUP_FINISHED() snmp_v3_group_finished() + + +#define SNMP_V3_ACCESS_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_access_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_ACCESS_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_access_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_ACCESS_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_access_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_ACCESS_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_access_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_ACCESS_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_access_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_ACCESS_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_access_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_ACCESS_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_access_backout(CUR, NEW) +#define SNMP_V3_ACCESS_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_access_backout(CUR, NEW) +#define SNMP_V3_ACCESS_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_access_backout(CUR, NEW) + +#define SNMP_V3_ACCESS_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_access_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_ACCESS_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_access_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_ACCESS_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_access_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_ACCESS_FINISHED() snmp_v3_access_finished() + + +#define SNMP_V3_USER_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_user_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_USER_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_user_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_USER_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_user_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_USER_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_user_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_USER_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_user_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_USER_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_user_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_USER_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_user_backout(CUR, NEW) +#define SNMP_V3_USER_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_user_backout(CUR, NEW) +#define SNMP_V3_USER_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_user_backout(CUR, NEW) + +#define SNMP_V3_USER_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_user_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_USER_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_user_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_USER_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_user_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_USER_FINISHED() snmp_v3_user_finished() + +#define SNMP_V3_TADDR_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_taddr_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_TADDR_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_taddr_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_TADDR_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_taddr_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_TADDR_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_taddr_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_TADDR_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_taddr_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_TADDR_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_taddr_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_TADDR_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_taddr_backout(CUR, NEW) +#define SNMP_V3_TADDR_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_taddr_backout(CUR, NEW) +#define SNMP_V3_TADDR_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_taddr_backout(CUR, NEW) + +#define SNMP_V3_TADDR_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_taddr_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_TADDR_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_taddr_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_TADDR_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_taddr_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_TADDR_FINISHED() snmp_v3_taddr_finished() + +#define SNMP_V3_TPARAM_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_tparam_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_TPARAM_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_tparam_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_TPARAM_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_tparam_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_TPARAM_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_tparam_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_TPARAM_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_tparam_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_TPARAM_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_tparam_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_TPARAM_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_tparam_backout(CUR, NEW) +#define SNMP_V3_TPARAM_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_tparam_backout(CUR, NEW) +#define SNMP_V3_TPARAM_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_tparam_backout(CUR, NEW) + +#define SNMP_V3_TPARAM_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_tparam_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_TPARAM_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_tparam_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_TPARAM_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_tparam_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_TPARAM_FINISHED() snmp_v3_tparam_finished() + +#define SNMP_V3_NOTIFY_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_notify_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_NOTIFY_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_notify_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_NOTIFY_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_notify_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_NOTIFY_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_notify_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_NOTIFY_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_notify_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_NOTIFY_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_notify_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_NOTIFY_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_notify_backout(CUR, NEW) +#define SNMP_V3_NOTIFY_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_notify_backout(CUR, NEW) +#define SNMP_V3_NOTIFY_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_notify_backout(CUR, NEW) + +#define SNMP_V3_NOTIFY_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_notify_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_NOTIFY_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_notify_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_NOTIFY_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_notify_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_NOTIFY_FINISHED() snmp_v3_notify_finished() + +#define SNMP_V3_NPROF_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_nprof_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_NPROF_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_nprof_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_NPROF_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_nprof_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_NPROF_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_nprof_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_NPROF_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_nprof_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_NPROF_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_nprof_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_NPROF_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_nprof_backout(CUR, NEW) +#define SNMP_V3_NPROF_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_nprof_backout(CUR, NEW) +#define SNMP_V3_NPROF_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_nprof_backout(CUR, NEW) + +#define SNMP_V3_NPROF_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_nprof_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_NPROF_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_nprof_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_NPROF_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_nprof_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_NPROF_FINISHED() snmp_v3_nprof_finished() + +#define SNMP_V3_NFILT_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_nfilt_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_NFILT_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_nfilt_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_NFILT_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_nfilt_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_NFILT_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_nfilt_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_NFILT_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_nfilt_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_NFILT_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_nfilt_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_NFILT_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_nfilt_backout(CUR, NEW) +#define SNMP_V3_NFILT_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_nfilt_backout(CUR, NEW) +#define SNMP_V3_NFILT_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_nfilt_backout(CUR, NEW) + +#define SNMP_V3_NFILT_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_nfilt_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_NFILT_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_nfilt_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_NFILT_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_nfilt_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_NFILT_FINISHED() snmp_v3_nfilt_finished() + +#define SNMP_V3_PROXY_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_proxy_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_PROXY_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_proxy_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_PROXY_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_v3_proxy_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_PROXY_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_proxy_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_PROXY_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_proxy_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_PROXY_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_v3_proxy_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_PROXY_DESTROY_BACKOUT(CUR, NEW) \ + snmp_v3_proxy_backout(CUR, NEW) +#define SNMP_V3_PROXY_CREATE_BACKOUT(CUR, NEW) \ + snmp_v3_proxy_backout(CUR, NEW) +#define SNMP_V3_PROXY_UPDATE_BACKOUT(CUR, NEW) \ + snmp_v3_proxy_backout(CUR, NEW) + +#define SNMP_V3_PROXY_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_proxy_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_PROXY_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_proxy_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_PROXY_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_v3_proxy_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_PROXY_FINISHED() snmp_v3_proxy_finished() + +#define SNMP_V3_COMM_DESTROY_TEST(PKT, VBP, CUR, NEW) \ + snmp_community_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_COMM_CREATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_community_test(PKT, VBP, CUR, NEW) +#define SNMP_V3_COMM_UPDATE_TEST(PKT, VBP, CUR, NEW) \ + snmp_community_test(PKT, VBP, CUR, NEW) + +#define SNMP_V3_COMM_DESTROY_SET(PKT, VBP, CUR, NEW) \ + snmp_community_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_COMM_CREATE_SET(PKT, VBP, CUR, NEW) \ + snmp_community_set(PKT, VBP, CUR, NEW) +#define SNMP_V3_COMM_UPDATE_SET(PKT, VBP, CUR, NEW) \ + snmp_community_set(PKT, VBP, CUR, NEW) + +#define SNMP_V3_COMM_DESTROY_BACKOUT(CUR, NEW) \ + snmp_community_backout(CUR, NEW) +#define SNMP_V3_COMM_CREATE_BACKOUT(CUR, NEW) \ + snmp_community_backout(CUR, NEW) +#define SNMP_V3_COMM_UPDATE_BACKOUT(CUR, NEW) \ + snmp_community_backout(CUR, NEW) + +#define SNMP_V3_COMM_CREATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_community_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_COMM_UPDATE_UNDO(PKT, VBP, CUR, SAV) \ + snmp_community_undo(PKT, VBP, CUR, SAV) +#define SNMP_V3_COMM_DESTROY_UNDO(PKT, VBP, CUR, SAV) \ + snmp_community_undo(PKT, VBP, CUR, SAV) + +#define SNMP_V3_COMM_FINISHED() snmp_community_finished() + +#if INSTALL_ENVOY_SNMP_V3_PROXY +void snmpSendProxyPkt __((SNMPADDR_T *, SNMPADDR_T *, + PTR_T, ALENGTH_T)); + +#define ENVOY_SNMP_SEND_PROXY(FOR, LOC, PKT, SIZ) \ + snmpSendProxyPkt((FOR), (LOC), (PKT), (SIZ)) +#endif /* #if INSTALL_ENVOY_SNMP_V3_PROXY */ + +#if INSTALL_SNMP_V3_DIFFIE_HELLMAN +#define SNMP_DH_RAND() snmpDHRand() +#endif + +#endif /* #if INSTALL_ENVOY_SNMP_VERSION_3 */ + +#if (INSTALL_ENVOY_EPI_MASTER) +#define SNMP_RESETSYSUPTIME +#endif + +#if (INSTALL_ENVOY_AGENTX_MASTER) || (INSTALL_ENVOY_ENTITY_MIB) +extern bits32_t envoyGetSysUpTime(); + +#define ENVOY_GET_SYSUPTIME(CON) envoyGetSysUpTime(CON) +#endif /* #if (INSTALL_ENVOY_AGENTX_MASTER) || (INSTALL_ENVOY_ENTITY_MIB) */ + +/* Routines required by agentx */ +#if INSTALL_ENVOY_AGENTX_MASTER + +/* This placeholders eliminate need to include axapi.h and */ +/* the attendant duplicate definitions that can occur. */ + +struct AX_CONNENT_S; +struct AX_CONN_S; + +/* Master agent routines and macros */ +extern bits32_t envoyAxConnEntry (bits32_t axConnID, int matchFlag, struct AX_CONNENT_S *pConnEntry); +extern bits32_t envoyAxGetConnID (struct AX_CONN_S *pCE); + +#define ENVOY_AX_CONN_ENTRY(INDEX, MATCH_TYPE, P_CONNENT) envoyAxConnEntry(INDEX, MATCH_TYPE, P_CONNENT) +#define ENVOY_AX_GET_CONNID(CONN_ENTRY) envoyAxGetConnID(CONN_ENTRY) + +#endif /* #if INSTALL_ENVOY_AGENTX_MASTER */ + +#if INSTALL_ENVOY_AGENTX_SUB +/* then we do the subagent agentx macros */ + +extern int envoy_ax_sa_mib_root_node __((PTR_T, SNMP_PKT_T *)); + +#define ENVOY_AX_SA_MIB_ROOT_NODE(CKE, PKT) envoy_ax_sa_mib_root_node(CKE, PKT) +#define ENVOY_AX_SA_TIMEOUT 1000 + +#endif /* #if INSTALL_ENVOY_AGENTX_SUB */ + + + +/*---------------------------------------------------------------- + SNMP_release_private -- Get rid of a any private data attached to the packet + structure. May be left undefined in which case nothing + is done with the private field when the SNMP packet + structure is freed. + + Parameters: + SNMP_PKT_T *pkt The packet itself + + Returns: Nothing + ----------------------------------------------------------------*/ + +extern void snmpHookPrivRelease __((SNMP_PKT_T*)); +#define SNMP_release_private(pkt) snmpHookPrivRelease (pkt) + + + +#if (INSTALL_ENVOY_SNMP_PROXY) +extern void proxy_release_private __((SNMP_PKT_T *)); +#define SNMP_release_private(pkt) proxy_release_private(pkt) +#endif /* (INSTALL_ENVOY_SNMP_PROXY) */ + + + +/*---------------------------------------------------------------- + SNMP_user_get_encode_buffer -- Allows the user the opportunity to get the + buffer that the SNMP packet will be encoded into. + If not used then leave undefined. + + Parameters: + SNMP_PKT_T *pkt The packet being encoded. + unsigned int need The amount of storage needed. + EBUFFER_T *ebuffp The ebuffer to fill in with the actual + buffer. + + Returns: + 0 successful + 1 not successful + ----------------------------------------------------------------*/ +/* #define SNMP_user_get_encode_buffer(pkt, need, ebuffp) 0 */ + + +/*---------------------------------------------------------------- + SNMP_trace_input + SNMP_trace_output + -- for implementing packet tracing through the + SNMP code. May not be left undefined but may + instead be defined as nothing. + + Parameters: + SNMP_PKT_T *pkt The packet being traced + + Returns: Nothing + + ----------------------------------------------------------------*/ + +extern void snmpTraceInput (SNMP_PKT_T *); + +#define SNMP_TRACE_INPUT(pkt) snmpTraceInput (pkt) +#define SNMP_TRACE_OUTPUT(pkt) + +/***************************************************************** + * The next series of macros are hooks into the processing of SET PDUs. + * For most uses you should be able to leave these undefined. + *****************************************************************/ + +/*---------------------------------------------------------------- + SNMP_validate_set_pdu -- Perform a global validation of a SET PDU. + + Parameters: + SNMP_PKT_T *pkt The packet itself + + Returns: + -1 If the PDU is bad and should be rejected with a GEN_ERR. + 0 If the PDU is good and normal handling should proceed. + +1 If the PDU is good and this routine has performed all of + the set operations internally. + ----------------------------------------------------------------*/ + +extern int snmpHookSetPduValidate __((SNMP_PKT_T*)); +#define SNMP_validate_set_pdu(pkt) snmpHookSetPduValidate (pkt) + + +/*---------------------------------------------------------------- + SNMP_user_pre_set -- Perform a global validation of a SET PDU after all of the + test procedures have been called and given the "go ahead". + + Parameters: + SNMP_PKT_T *pkt The packet itself + + Returns: + -1 If the PDU is bad and should be rejected with a GEN_ERR. + 0 If the PDU is good and normal handling should proceed. + +1 If the PDU is good and this routine has performed all of + the set operations internally. + ----------------------------------------------------------------*/ + + +extern int snmpHookPreSet __((SNMP_PKT_T*)); +#define SNMP_user_pre_set(pkt) snmpHookPreSet(pkt) + + + + +/*---------------------------------------------------------------- + SNMP_user_post_set -- Perform any final activities after all of the set + procedures have been called. + + Parameters: + SNMP_PKT_T *pkt The packet itself + + Returns: Nothing + ----------------------------------------------------------------*/ + + +extern int snmpHookPostSet __((SNMP_PKT_T*)); +#define SNMP_user_post_set snmpHookPostSet + +/************************************************************************************* +* set failed routine +*/ + +extern int snmpHookSetFailed __((SNMP_PKT_T*)); +#define SNMP_user_set_failed snmpHookSetFailed + + + + +#if (INSTALL_ENVOY_SNMP_LOCK) + +#define ENVOY_SNMP_LOCK(name) ENVOY_LOCK_T name +#define ENVOY_SNMP_LOCK_EXTERN(name) extern ENVOY_LOCK_T name + +#define ENVOY_SNMP_INIT_LOCK(name) (name) = semBCreate (SEM_Q_PRIORITY, SEM_FULL) + +#define ENVOY_SNMP_FREE_LOCK_TAG(name, tag) semDelete ((name)) + +#define ENVOY_SNMP_GET_READ_LOCK(name) semTake (name, WAIT_FOREVER) +#define ENVOY_SNMP_GET_WRITE_LOCK(name) semTake (name, WAIT_FOREVER) +#define ENVOY_SNMP_RELEASE_READ_LOCK(name) semGive (name) +#define ENVOY_SNMP_RELEASE_WRITE_LOCK(name) semGive (name) + +#endif /* (INSTALL_ENVOY_SNMP_LOCK) */ + + +extern void envoy_call_timer __((bits32_t, void (*)(void))); +extern bits32_t envoy_now __((void)); + +#define ENVOY_CALL_TIMER(T, H) envoy_call_timer(T, H) +#define ENVOY_NOW() envoy_now() + +/* Definitions for use with the Virtual Stack features. + * SNMP_VIRTUAL_STACK_NUM specifies the number of virtual stacks for whcih we + * should add community and context information. + * SNMP_SET_VIRTUAL_STACK specifies the function to call to actually change + * the virtual stack we wish to use + * NAMING_SCOPE_PREFIX specifies the string to be prepended to the stack number + * for use within a community string or context name. + * ENT_LOGICAL_DESCR specifies the string to be prepended to the description in + * the entity table + * ENT_LOGICAL_TADDRESS specifies the address to be used in the entity table + */ + +#if INSTALL_SNMP_VXWORKS_VIRTUAL_STACK + +#define SNMP_VIRTUAL_STACK_NUM 2 +#define SNMP_SET_VIRTUAL_STACK virtualStackNumTaskIdSet + +#define NAMING_SCOPE_PREFIX "VS" + +#if INSTALL_SNMP_VXWORKS_VS_ENTITY +#define ENT_LOGICAL_DESCR "Virtual Stack #" +#define ENT_LOGICAL_TADDRESS "192.168.0.52" +#endif /* INSTALL_SNMP_VXWORKS_VS_ENTITY */ + + +/* Routines for use with the dynamic naming features. This feature allows + * community strings or context names to be dynamically configured instead + * of being statically built at compile time. This feature is useful with + * the virtual stack option to allow new community strings or context names + * to be added (removed) as a virtual is created (destroyed). + */ + +extern void defaultCommunityStringsRegister __((bits32_t)); + +#define DEFAULT_COMMUNITIES_REGISTER(vsNum) \ + defaultCommunityStringsRegister (vsNum) + +extern void vsCommunityStringsRegister __((int)); + +#define VS_COMMUNITY_REGISTER(vsNum) \ + vsCommunityStringsRegister (vsNum) + + +#if INSTALL_ENVOY_SNMP_VERSION_3 + +extern void defaultContextNamesRegister __((bits32_t)); + +#define DEFAULT_CONTEXTS_REGISTER(vsNum) \ + defaultContextNamesRegister (vsNum) + +extern void vsContextNameRegister __((int)); + +#define VS_CONTEXT_REGISTER(vsNum) \ + vsContextNameRegister (vsNum) + +#endif /* INSTALL_ENVOY_SNMP_VERSION_3 */ + +#endif /* INSTALL_SNMP_VXWORKS_VIRTUAL_STACK */ + + +#define snmpdGroupByGetprocAndInstance group_by_getproc_and_instance +#define snmpdVbRowLooseExtract vb_extract_row_loose +#define snmpdVbRowExtract vb_extract_row +#define snmpdContinue SNMP_Continue_function +#define SNMP_user_set_failed snmpHookSetFailed + + + +#endif /* CONFIG_PREAMBLE */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ diff --git a/h/wrn/wm/util/port/vxworks/oemtypes.h b/h/wrn/wm/util/port/vxworks/oemtypes.h new file mode 100644 index 0000000..a72c55d --- /dev/null +++ b/h/wrn/wm/util/port/vxworks/oemtypes.h @@ -0,0 +1,47 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/vxworks/oemtypes.h,v 1.1.1.1 2001/11/05 17:47:17 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: oemtypes.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:17 tneale + * Tornado shuffle + * + * Revision 1.1 2000/01/27 18:25:29 josh + * initial checkin of porting files for vxWorks + * + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +#include +#include + +/* The sun compiler doesn't understand the `signed' keyword */ + +#define __TYPES_HAVE_sbits8_t_ 1 +typedef char sbits8_t; /* signed 8 bits */ +#define __TYPES_HAVE_sbits16_t_ 1 +typedef short sbits16_t; /* signed 16 bits */ +#define __TYPES_HAVE_sbits32_t_ 1 +typedef long sbits32_t; /* signed 32 bits */ + diff --git a/h/wrn/wm/util/port/vxworks/snark.h b/h/wrn/wm/util/port/vxworks/snark.h new file mode 100644 index 0000000..999ca62 --- /dev/null +++ b/h/wrn/wm/util/port/vxworks/snark.h @@ -0,0 +1,39 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/vxworks/snark.h,v 1.1.1.1 2001/11/05 17:47:17 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: snark.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:17 tneale + * Tornado shuffle + * + * Revision 1.1 2000/01/27 18:25:30 josh + * initial checkin of porting files for vxWorks + * + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +#include + +#define vsnprintf(w, x, y, z) vsprintf(w, y, z) + diff --git a/h/wrn/wm/util/port/vxworks/snmptalk.h b/h/wrn/wm/util/port/vxworks/snmptalk.h new file mode 100644 index 0000000..e2bc4a3 --- /dev/null +++ b/h/wrn/wm/util/port/vxworks/snmptalk.h @@ -0,0 +1,46 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/vxworks/snmptalk.h,v 1.1.1.1 2001/11/05 17:47:17 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: snmptalk.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:17 tneale + * Tornado shuffle + * + * Revision 1.1 2000/02/04 21:49:31 josh + * modified header files for clean builds of vxWorks demo + * + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + + +#include +#include +#include + +/* defines for nvutils for file manipulation */ +#define SNMP_READONLY "r" +#define SNMP_READPLUS "r+" +#define SNMP_WRITEPLUS "w+" +#define SNMP_REMOVE_FILE(fname) unlink(fname) + diff --git a/h/wrn/wm/util/port/winsock/common.h b/h/wrn/wm/util/port/winsock/common.h new file mode 100644 index 0000000..5189478 --- /dev/null +++ b/h/wrn/wm/util/port/winsock/common.h @@ -0,0 +1,90 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/msdos/common.h,v 1.1.1.1 2001/11/05 17:47:12 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: common.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:12 tneale + * Tornado shuffle + * + * Revision 1.7 2001/01/19 22:23:03 paul + * Update copyright. + * + * Revision 1.6 2000/03/17 00:10:27 meister + * Update copyright message + * + * Revision 1.5 1998/06/21 21:43:51 sar + * Dos compilers seem to use stricmp and strnicmp instead of casecmp + * + * Revision 1.4 1998/02/25 04:56:57 sra + * Update copyrights. + * + * Revision 1.3 1997/12/02 16:15:15 mrf + * add GLUE_NOW definition to make prng.c build on DOS + * + * Revision 1.2 1997/10/29 20:32:33 sar + * Added memory.h for some compilers to get prototypes for mem functions. + * + * Revision 1.1 1997/08/21 17:23:46 sra + * Begin moving configuration stuff that's common to all products to common.h + * Minor cleanups to common/lib/prng.c. Add pnrg seed function to snarkbsd. + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* + * NIY.... + */ + +#ifdef CONFIG_PREAMBLE + +/* zortech, watcom and intel 960 don't have a memory.h so away it goes */ +#if (!defined(INSTALL_on_ztc) && !defined(INSTALL_on_watcom) && !defined(INSTALL_on_i960)) +#include +#endif /* INSTALL_on_ztc */ + +#ifndef STRICMP +#define STRICMP(x, y) stricmp(x, y) +#endif + +#ifndef STRNICMP +#define STRNICMP(x, y, z) strnicmp(x, y, z) +#endif + +#else /* CONFIG_PREAMBLE */ + +#ifndef GLUE_NOW +#define GLUE_NOW() glue_now() +extern bits32_t glue_now (void); +#endif + +#endif /* CONFIG_PREAMBLE */ + + + + + + + + + diff --git a/h/wrn/wm/util/port/winsock/envoy.h b/h/wrn/wm/util/port/winsock/envoy.h new file mode 100644 index 0000000..ffa5e7e --- /dev/null +++ b/h/wrn/wm/util/port/winsock/envoy.h @@ -0,0 +1,153 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/winsock/envoy.h,v 1.1.1.1 2001/11/05 17:47:17 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * Configuration for Envoy on MSDOS with Attache. + */ + +/* + * modification history + * -------------------- + * 01a,25jun03,ps remove bad format clearcase history comment + */ + +/* + * $Log: envoy.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:17 tneale + * Tornado shuffle + * + * Revision 1.7 2001/01/19 22:23:19 paul + * Update copyright. + * + * Revision 1.6 2000/03/17 00:11:05 meister + * Update copyright message + * + * Revision 1.5 1998/02/25 04:57:12 sra + * Update copyrights. + * + * Revision 1.4 1997/10/29 01:31:30 sar + * Updated the master agent installation option. + * + * Revision 1.3 1997/03/20 06:58:11 sra + * DFARS-safe copyright text. Zap! + * + * Revision 1.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 1.1 1996/10/30 17:32:19 mrf + * Initial revision + * + * Revision 1.1 1996/07/02 19:55:38 mrf + * Initial revision + * + * Revision 7.0 1996/03/18 20:25:57 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 6.1 1995/11/06 20:05:58 sar + * removed validate_community's dependency on install v1 + * + * Revision 6.0 1995/05/31 22:00:34 sra + * Release 6.0. + * + * Revision 5.4 1995/05/22 19:39:49 sar + * Modified the lock code to add some new macros. + * + * Revision 5.3 1995/05/05 22:30:05 sar + * Added some default macros for the timer code. + * + * Revision 5.2 1995/05/01 21:57:42 sar + * Put the example lock macros in an if def block. + * + * Revision 5.1 1994/10/25 20:03:13 sar + * Added some simple lock code for testing and as an example, also + * added a definition for snmpresetsysuptime. + * + * Revision 5.0 1994/05/16 17:24:02 sar + * Updated revision to 5.0 and copyright to include 1994 + * + * Revision 4.0 1993/06/24 17:47:40 sar + * Updated rev to 4.0 and copyright to 93 + * + * Revision 1.1 1993/06/09 20:37:06 sar + * Initial revision + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +#if defined(CONFIG_PREAMBLE) + +/***************************************************************** + * + * System Includes: + * + * The SNMP uses memcpy(), memset(), and strlen(). The appropriate + * include file should be put here to see that these routines are + * properly declared. If no such include file exists on the system + * then declare memcpy() and memset() here directly. + *****************************************************************/ +/* zortech, watcom and intel 960 don't have a memory.h so away it goes */ +#if (!defined(INSTALL_on_ztc) && !defined(INSTALL_on_watcom) && !defined(INSTALL_on_i960)) +#include +#endif /* INSTALL_on_ztc */ + +#include + +/***************************************************************** + * Memory allocation routines. The SNMP needs to allocate memory to + * decode the packet into and also to store the response data for GET's + * and GET-NEXT's. + *****************************************************************/ + +/* Fix up mach 386's improper declaration of the mem* routines */ +#if defined(INSTALL_on_mach386) +#define MEMCPY(dst, src, n) memcpy((char *)(dst), (char *)(src), n) +#define MEMSET(dst, val, n) memset((char *)(dst), val, n) +#define MEMCMP(dst, src, n) memcmp((char *)(dst), (char *)(src), n) +#endif + +/*---------------------------------------------------------------- + * Make sure that the routines used by the SNMP_memory_alloc() and + * SNMP_memory_free() macros are declared. If system memory routines + * are used (e.g. malloc() and free()) then include the appropriate + * system header file here. + ----------------------------------------------------------------*/ + +/* The memory allocation macros */ +#if defined(INSTALL_on_unix) +extern void *malloc __((unsigned)); +extern void free __((void *)); +#endif +#if defined(INSTALL_on_msdos) +#include +#endif + +#define SNMP_memory_alloc(need) malloc(need) +#define SNMP_memory_free(buf) free(buf) + +#include + +#else /* CONFIG_PREAMBLE */ + +#include + +#endif /* CONFIG_PREAMBLE */ diff --git a/h/wrn/wm/util/port/winsock/oemtypes.h b/h/wrn/wm/util/port/winsock/oemtypes.h new file mode 100644 index 0000000..42b4465 --- /dev/null +++ b/h/wrn/wm/util/port/winsock/oemtypes.h @@ -0,0 +1,78 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/winsock/oemtypes.h,v 1.1.1.1 2001/11/05 17:47:17 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: oemtypes.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:17 tneale + * Tornado shuffle + * + * Revision 1.6 2001/01/19 22:23:19 paul + * Update copyright. + * + * Revision 1.5 2000/03/17 00:11:05 meister + * Update copyright message + * + * Revision 1.4 1998/02/25 04:57:12 sra + * Update copyrights. + * + * Revision 1.3 1997/03/20 06:58:10 sra + * DFARS-safe copyright text. Zap! + * + * Revision 1.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 1.1 1996/10/30 17:32:19 mrf + * Initial revision + * + * Revision 1.1 1996/07/02 19:55:38 mrf + * Initial revision + * + * Revision 7.0 1996/03/18 20:25:57 sar + * Updated rev to 7.0 and copyright to 96 + * + * Revision 6.0 1995/05/31 21:51:00 sra + * Release 6.0. + * + * Revision 5.0 1994/05/16 17:24:02 sar + * Updated revision to 5.0 and copyright to include 1994 + * + * Revision 4.0 1993/06/24 17:47:40 sar + * Updated rev to 4.0 and copyright to 93 + * + * Revision 1.1 1993/06/09 20:37:06 sar + * Initial revision + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* + * We need to supply size_t. Everything else in will + * work fine on with MSDOS compilers. + */ + +#if defined(INSTALL_on_unix) +#include +#endif +#if defined(INSTALL_on_msdos) +#include +#endif diff --git a/h/wrn/wm/util/port/winsock/snark.h b/h/wrn/wm/util/port/winsock/snark.h new file mode 100644 index 0000000..203fe95 --- /dev/null +++ b/h/wrn/wm/util/port/winsock/snark.h @@ -0,0 +1,72 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/winsock/snark.h,v 1.1 2002/03/20 16:43:52 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * $Log: snark.h,v $ + * Revision 1.1 2002/03/20 16:43:52 tneale + * To start with this is the same as snark.h in port/msdos + * + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + +/* zortech, watcom and intel 960 don't have a memory.h so away it goes */ +#if (!defined(INSTALL_on_ztc) && !defined(INSTALL_on_watcom) && !defined(INSTALL_on_i960)) +#include +#endif /* INSTALL_on_ztc */ + +#include +#include + +#ifndef GLUE_ALLOC +#define GLUE_ALLOC(len) ((void *) malloc(len)) +#endif +#ifndef GLUE_FREE +#define GLUE_FREE(mem) free((char *)(mem)) +#endif + +#ifndef MEMCPY +#define MEMCPY(x, y, z) memcpy(x, y, z) +#endif +#ifndef MEMCMP +#define MEMCMP(x, y, z) memcmp(x, y, z) +#endif +#ifndef MEMSET +#define MEMSET(x, y, z) memset(x, y, z) +#endif +#ifndef STRCMP +#define STRCMP(x, y) strcmp(x, y) +#endif +#ifndef STRCPY +#define STRCPY(x, y) strcpy(x, y) +#endif +#ifndef STRLEN +#define STRLEN(x) strlen(x) +#endif +#ifndef STRICMP +#define STRICMP(x, y) stricmp(x, y) +#endif +#ifndef STRNICMP +#define STRNICMP(x, y, z) strnicmp(x, y, z) +#endif diff --git a/h/wrn/wm/util/port/winsock/snmptalk.h b/h/wrn/wm/util/port/winsock/snmptalk.h new file mode 100644 index 0000000..455f6f1 --- /dev/null +++ b/h/wrn/wm/util/port/winsock/snmptalk.h @@ -0,0 +1,87 @@ +/* $Header: /usr/cvsroot/target/h/wrn/wm/util/port/winsock/snmptalk.h,v 1.1.1.1 2001/11/05 17:47:17 tneale Exp $ */ + +/* + * Copyright (C) 1999-2004 Wind River Systems, Inc. + * All rights reserved. Provided under license only. + * Distribution or other use of this software is only + * permitted pursuant to the terms of a license agreement + * from Wind River Systems (and is otherwise prohibited). + * Refer to that license agreement for terms of use. + */ + + +/**************************************************************************** + * Copyright 1993-1997 Epilogue Technology Corporation. + * Copyright 1998 Integrated Systems, Inc. + * All rights reserved. + ****************************************************************************/ + +/* + * Configuration for snmptalk on SunOS. + */ + +/* + * $Log: snmptalk.h,v $ + * Revision 1.1.1.1 2001/11/05 17:47:17 tneale + * Tornado shuffle + * + * Revision 1.6 2001/01/19 22:23:20 paul + * Update copyright. + * + * Revision 1.5 2000/03/17 00:11:05 meister + * Update copyright message + * + * Revision 1.4 1998/02/25 04:57:13 sra + * Update copyrights. + * + * Revision 1.3 1997/03/20 06:58:11 sra + * DFARS-safe copyright text. Zap! + * + * Revision 1.2 1997/02/25 10:58:16 sra + * Update copyright notice, dust under the bed. + * + * Revision 1.1 1996/10/30 17:32:19 mrf + * Initial revision + * + * Revision 1.1 1996/07/02 19:55:38 mrf + * Initial revision + * + * Revision 7.0 1996/03/18 20:25:29 sar + * Updated rev to 7.0 and copyright ot 96 + * + * Revision 6.0 1995/05/31 21:51:00 sra + * Release 6.0. + * + * Revision 5.0 1994/05/16 16:47:41 sar + * Updated revision to 5.0 and copyright to include 1994 + * + * Revision 4.0 1993/06/24 17:44:26 sar + * Updated rev to 4.0 and copyright to 93 + * + * Revision 1.1 1993/06/09 19:33:45 dab + * Initial revision + * + */ + +/* [clearcase] +modification history +------------------- +*/ + + + + +#include +#include + +/* defines for nvutils for file manipulation */ +#define SNMP_READONLY "r" +#define SNMP_READPLUS "r+" +#define SNMP_WRITEPLUS "w+" +#define SNMP_REMOVE_FILE(fname) unlink(fname) + +#define BSD_RELEASE 43 + +#define DESIRED_WINSOCK_VERSION 0x0101 +#define MINIMUM_WINSOCK_VERSION 0x0001 +#define SOCKET_TIMEOUT 20L /* time to wait to for selects */ diff --git a/h/wtx.h b/h/wtx.h new file mode 100644 index 0000000..785ea4a --- /dev/null +++ b/h/wtx.h @@ -0,0 +1,1439 @@ +/* wtx.h - wtx protocol header file */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +05s,12oct04,jeg added wtxLastRuntimeErrorGet() API declaration +05r,03sep04,jeg added wtxTargetHasDspGet() declarations. +05q,18jun04,x_p Add addOptions to wtxProcessCreate +05p,16mar04,x_p Handle I/O redirection in wtxProcessCreate +05o,26feb04,mil Added SPE support for PPC85XX. +05n,15apr03,sn added wtxDemanglerStyleGet, obsoleted wtxDefaultDemanglerStyle +05m,29aug03,x_p Changed prototype +05l,04mar03,fle fixed (again ?) wtxEnvironRegistryOptionsGet() declaration +05k,21feb03,fle fixed wtxEnvironRegistryOptionsGet() declaration +05j,18feb03,p_b merge from T22-latest +05i,12feb03,elg Fix compilation error. +05h,13dec02,p_b changed TGT_XXX by WTX_TGT_XXX +05g,21nov02,p_b merging margaux/T3, 64 bits support +05f,07nov02,fle removed wtxSymAddWithGroup () +05e,18mar02,x_p Updated wtxPdCreate for handling env vars +05d,24jan02,x_p Added wtxPdInfoSet / Get +05c,27nov01,x_p Added wtxPdTasksListGet +05b,22aug01,x_p Merge from bsdos.temp +05a,12sep00,c_c Added wtxTargetToolNameGet, wtxTargetBspShortNameGet, + wtxTargetRtNameGet. Removed wtxTargetRtTypeGet. +04z,08aug00,mts Added wtxLoadModeGet +04z,08aug00,mts Added wtxLoadModeGet +04y,18may00,fle added wtx log options for registry to + wtxEnvironRegistryOptionsGet() +04x,06apr00,fle added wtxToolOnHostAttach() that attaches to a target server + registered on a remote rgistry +04w,13mar00,p_b handled load and run facility. +04v,03mar00,fle renamed wtxTgtsvrLogGet() into wtxTsLogGet() for API + consistency +04u,17feb00,fle added wtxLogGet() routine +04t,01feb00,fle made pFunc parameter of wtxAsyncNotifyEnable() be a + WTX_EVENT_HANDLER rather than a FUNCPTR +04s,26jan00,dbt Added user service routines prototypes. +04r,15dec99,p_b fixed wrong typos in comments. +04q,26nov99,fle made wtxCpuInfoGet() return a char pointer, not a const char + pointer aymore +04p,26oct99,fle moved registry related routines declarations into + wtxRegistry.h +04o,21oct99,p_b Removed wtxEach(),wtxServiceAdd(). Renamed wtxModuleListFree() + in wtxObjModuleListFree(). Fixed wrong comments in wtxContext.. + structure definitions. (Beware that it explicitly appears in + the documentation). Changed many "char *" to "const char *". + Removed wtxSymAddWithGroup (). Updated wtxPdCreate() profile. + Renamed wtxObjModuleList() in wtxObjModuleListGet(). +04n,15oct99,fle exported wtxDescDuplicate() since it is now used in several + files + + history cleanup +04m,13oct99,fle made include of wtxRegistry.h into ifdef HOST +04l,07oct99,fle added new registry related APIs declarations +04k,06oct99,pad Replaced WTX_SYMBOL_TYPE with UINT32 in wtxSym...() routines. +04j,04oct99,pad Added prototype of wtxSymRegister(). +04i,21sep99,c_c Added Context Stop service. +04h,27aug99,fle added wtxPdCurrentSet(), wtxPdCurrentGet() and wtxPdRemove() + routines declarations + + changed wtxPdCreateAt() into wtxPdCreate() +04g,22jul99,p_b changed wtxSymFind, wtxSymListGet, wtxObjModuleListGet apis. +04f,20jul99,fle memory leaks fixes +04e,19jul99,fle made the pdId parameters be WTX_TGT_ADDR_T and not UINT32 anymore +04d,16jul99,p_b added wtxModuleListFree (). Change wtxSymListFree () interface. +04c,16jul99,c_c Modified wtxMemMove. +04b,09jul99,fle moved N_DASM_INST_DEFAULT from here to wtxtypes.h +04a,08jul99,p_b Added wtxVioLink () & wtxVioUnlink (). Removed wtxConsoleXxx(). +03z,07jul99,p_b Changed wtxSymListByModuleIdGet & wtxSymListByModuleNameGet. +03y,06jul99,c_c Added an option to wtxContextKill. +03x,05jul99,p_b Modified wtxSymFind, wtxSymListGet, wtxObjModuleListGet. +03w,05jul99,c_c Implemented PD context definition. +03v,02jul99,c_c Removed WTX_EVENTPOINT_LIST references. +03u,01jul99,c_c Modified wtxObjModuleLoad return value. +03t,30jun99,fle added wtxPdInfoQGet() routine declaration +03s,25jun99,fle added pdIds to all wtxMem calls +03r,21jun99,fle added wtxFreeAdd() routine declaration +03q,01jun99,c_c WTX for Protection Domain implementation: moved all type + definition to wtxtypes.h +03p,25may99,fle added WTX_SVR_TYPE enum +03o,23feb99,c_c Implemented an API to get the target IP address (SPR #25044). +03n,22sep98,l_k Removed wtxFindExecutable. +03m,21sep98,l_k Implement wtxFindExecutable. +03l,18sep98,pcn Implement wtxObjModuleInfoAndPathGet. +03k,18aug98,pcn Use WTX_MSG_EVTPT_LIST_2. +03j,20jul98,pcn Added evtptNum and toolId in the wtxEventpointListGet return + list. +03i,06jul98,pcn Removed wtxObjModuleUndefSymAdd from API. +03h,19jun98,pcn Added wtxObjModuleLoadStart, wtxObjModuleLoadProgressReport, + wtxObjModuleLoadCancel. +03g,11jun98,pcn Added an input parameter at wtxEventListGet. +03f,09jun98,jmp added wtxAsyncResultFree and wtxAsyncEventGet(). +03e,03jun98,pcn Added 2 requests: wtxSymListByModuleNameGet and + wtxSymListByModuleIdGet. +03d,25may98,pcn Changed wtxTsLock in wtxTsTimedLock, wtxEventpointList_2 in + wtxEventpointListGet, wtxObjModuleUnload_2 in + wtxObjModuleUnloadByName. +03c,30apr98,dbt added wtxHwBreakpointAdd and wtxEventpointAdd. +03b,28apr98,pcn Removed wtxCommandSend. +03a,23apr98,fle added CPU name retrieving to wtxCpuInfoGet +02z,21apr98,fle added wtxCpuInfoGet() +02y,26mar98,pcn WTX 2: added a new parameter in wtxLogging. +02x,03mar98,fle got rid of wtxRegistryPing() function declaration +02w,02mar98,pcn WTX 2: moved WTX_LD_M_FILE_DESC in wtxMsg.h. Added + WTX_EVTPT_LIST_2 definition. Added wtxAsyncNotifyEnable, + wtxAsyncNotifyDisable, wtxCacheTextUpdate, wtxCommandSend, + wtxEventListGet, wtxEventpointList_2, wtxLogging, + wtxMemWidthRead, wtxMemWidthWrite, wtxObjModuleChecksum, + wtxObjModuleLoad_2, wtxObjModuleUnloa wtxUnregisterForEvent. + Changed wtxTargetRtTypeGet, wtxTargetCpuTypeGet return type. +02v,29jan98,fle added wtxRegistryPing() declaration + + added WTX_REGISTRY_PING_INTERVAL definition +02u,28jan98,c_c Packed all wtxEvtxxxStringGet routines into one. +01a,06oct94,p_m written. +*/ + +#ifndef __INCwtxh +#define __INCwtxh 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HOST +#include +#else +#include "vxWorks.h" +#include "setjmp.h" +#include "string.h" +#include "stdio.h" +#include "stdlib.h" +#include "bootLib.h" +#endif /* HOST */ + +#include "wtxtypes.h" +#include "wtxmsg.h" +#include "wtxerr.h" +#include "demanglerTypes.h" +#ifdef HOST + #include "wtxRegistry.h" +#endif /* HOST */ + +/* defines */ + +#define WTX_ALL_EVENTS ~0 /* number of events returned */ +#define WTX_LOG_NO_LIMIT 0 /* no max size for the log file */ +#define WTX_LOCK_FOREVER 0 /* lock indefinitely the target server */ + +#define LOAD_MODULE_INFO_ONLY 0x1000000 /* module synchronization */ + +#define WTX_TRY(hWtx) \ +{\ + WTX_HANDLER_T errHandler;\ + jmp_buf jumpBuf;\ +\ + wtxErrClear (hWtx);\ + errHandler = wtxErrHandlerAdd (hWtx, &wtxErrExceptionFunc, &jumpBuf);\ + if (setjmp (jumpBuf) == 0) + +#define WTX_CATCH(hWtx, errCode) else if (wtxErrGet (hWtx) == errCode) +#define WTX_CATCH_ALL(hWtx) else + +#define WTX_TRY_END(hWtx) \ + wtxErrHandlerRemove (hWtx, errHandler);\ +} + +#define WTX_THROW(hWtx, errCode) wtxErrDispatch (hWtx, errCode) + + +#ifndef HOST +/* externals */ + +extern BOOT_PARAMS sysBootParams; +#endif /* HOST */ + + +/* function declarations */ + +extern char * wtxCpuInfoGet /* get target CPU information from DB */ + ( + int cpuNum, /* CPU number to get info on */ + CPU_INFO cpuInfoType /* CPU info type to get */ + ); + +extern STATUS wtxInitialize /* init to be called by WTX client */ + ( + HWTX * phWtx /* handle to use in next API calls */ + ); + +extern WTX_TGT_ADDR_T wtxPdCurrentGet /* gets the current Protection Domain */ + ( + HWTX hWtx /* WTX session handler */ + ); + +extern STATUS wtxPdCurrentSet /* sets the current Protection Domain */ + ( + HWTX hWtx, /* WTX session handler */ + WTX_TGT_ID_T pdId /* protection domain ID to be set */ + ); + +extern STATUS wtxPdDelete /* deletes given Protection Domain */ + ( + HWTX hWtx, /* WTX session handler */ + WTX_TGT_ID_T pdId, /* protection domain ID to delete */ + WTX_CTX_KILL_OPT options /* protection domain deletion options */ + ); + +extern STATUS wtxProcessDelete /* deletes given Protection Domain */ + ( + HWTX hWtx, /* WTX session handler */ + WTX_TGT_ID_T pdId, /* protection domain ID to delete */ + WTX_CTX_KILL_OPT options /* protection domain deletion options */ + ); + +extern WTX_TGT_ADDR_T wtxPdKernelGet /* get kernel Protection Domain ID */ + ( + HWTX hWtx /* WTX session handler */ + ); + +extern WTX_PD_DESC_Q * wtxPdInfoQGet /* get the list of allocated PDs */ + ( + HWTX hWtx /* WTX session handler */ + ); + +extern STATUS wtxProbe /* probe to see if registry is alive */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern STATUS wtxTerminate /* terminate use of WTX client handle */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern STATUS wtxTimeoutSet /* set WTX timeout */ + ( + HWTX hWtx, /* WTX API handle */ + UINT32 msec /* new timeout value in milliseconds */ + ); + +extern STATUS wtxTimeoutGet /* get the current timeout */ + ( + HWTX hWtx, /* WTX API handle */ + UINT32 * pMsec /* pointer to timeout value in ms */ + ); + +extern STATUS wtxAgentModeSet /* set the mode of the target agent */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_AGENT_MODE_TYPE agentMode /* debug agent mode */ + ); + +extern WTX_AGENT_MODE_TYPE wtxAgentModeGet /* get agent mode */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern STATUS wtxAsyncNotifyEnable /* start async. event notification */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_EVENT_HANDLER pFunc /* user defined function */ + ); + +extern STATUS wtxAsyncNotifyDisable /* stop async. event notification */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern WTX_EVENT_DESC * wtxAsyncEventGet + ( + HWTX hWtx /* WTX API handle */ + ); + +extern STATUS wtxAsyncResultFree + ( + HWTX hWtx, /* WTX API handle */ + WTX_EVENT_DESC * pEventDesc /* pointer to structure to free */ + ); + +extern WTX_TGT_ID_T wtxBreakpointAdd /* create a new event point */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_CONTEXT * pContext, + WTX_TGT_ADDR_T tgtAddr /* breakpoint address */ + ); + +extern STATUS wtxCacheTextUpdate /* update the target text cache */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ADDR_T addr, /* start address */ + UINT32 nBytes /* number of bytes to update */ + ); + +extern STATUS wtxClientDataGet /* get the client data */ + ( + HWTX hWtx, /* WTX API handle */ + void ** ppClientData /* pointer to client data pointer */ + ); + +extern STATUS wtxClientDataSet /* set client data */ + ( + HWTX hWtx, /* WTX API handle */ + void * pClientData /* value to associate with handle */ + ); + +extern STATUS wtxContextStop /* stop execution of target context */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_CONTEXT * pContext + ); + +extern STATUS wtxContextCont /* continue execution of target ctxt */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_CONTEXT * pContext + ); + +extern WTX_CONTEXT_ID_T wtxContextCreate /* create a context on target */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_CONTEXT_DESC * pContextDesc /* context descriptor */ + ); + +extern WTX_TGT_ID_T wtxContextExitNotifyAdd /* add exit evpt notification */ + ( + HWTX hWTx, /* WTX API handle */ + WTX_CONTEXT * pContext + ); + +extern STATUS wtxContextKill /* kill a target context */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_CONTEXT * pContext, + UINT32 options /* option for the kill operation */ + ); + +extern STATUS wtxContextResume /* resume execution of a target ctxt */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_CONTEXT * pContext + ); + +extern STATUS wtxContextStep /* single step exec of target ctxt */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_CONTEXT * pContext, + WTX_TGT_ADDR_T stepStart, /* stepStart PC value */ + WTX_TGT_ADDR_T stepEnd /* stepEnd PC value */ + ); + +extern WTX_CONTEXT_STATUS wtxContextStatusGet /* get status of a context */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_CONTEXT * pContext + ); + +extern STATUS wtxContextSuspend /* suspend a target context */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_CONTEXT * pContext + ); + +extern STATUS wtxErrClear /* clear any error for the tool */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern WTX_ERROR_T wtxErrGet /* return the last error for a handle */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern STATUS wtxErrSet /* set the error code for the handle */ + ( + HWTX hWtx, /* WTX API handle */ + UINT32 errCode /* error value to set */ + ); + +extern const char * wtxErrMsgGet /* fetch last WTX API error string */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern const char * wtxErrToMsg /* convert error code to string */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_ERROR_T errCode /* error code to convert */ + ); + +extern STATUS wtxErrDispatch /* dispatch error with supplied code */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_ERROR_T errCode /* error code to register */ + ); + +extern BOOL32 wtxErrExceptionFunc /* a function to handle an error */ + ( + HWTX hWtx, /* WTX API handle */ + void * pClientData, /* pointer to a jump buffer */ + void * pCallData /* error code to return via setjmp() */ + ); + +extern WTX_HANDLER_T wtxErrHandlerAdd /* add an error handler */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_HANDLER_FUNC pFunc, /* function to call on error */ + void * pClientData /* data to pass function */ + ); + +extern STATUS wtxErrHandlerRemove /* remove error handler for WTX handle*/ + ( + HWTX hWtx, /* WTX API handle */ + WTX_HANDLER_T pHandler /* error handler */ + ); + +extern STATUS wtxEventAdd /* send an event to the target server */ + ( + HWTX hWtx, /* WTX API handle */ + const char * event, /* event string to send */ + UINT32 addlDataLen, /* length of addl data block in bytes */ + const void * pAddlData /* pointer to additional data */ + ); + +extern WTX_EVENT_DESC * wtxEventGet /* get an event from the target */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern WTX_EVENT_NODE * wtxEventListGet /* get all the events in one call */ + ( + HWTX hWtx, /* WTX API handle */ + UINT32 nEvents /* number of events to return */ + ); + +extern WTX_TGT_ID_T wtxEventpointAdd /* create a new event point */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_EVTPT * pEvtpt /* eventpoint descriptor */ + ); + +extern WTX_TGT_ID_T wtxHwBreakpointAdd /* create a new hardware breakpoint */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_CONTEXT * pContext, + WTX_TGT_ADDR_T tgtAddr, /* breakpoint address */ + WTX_TGT_INT_T type /* access type (arch dependant) */ + ); +extern STATUS wtxEventpointDelete /* delete eventpoint from the target */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T evtptId /* ID of eventpoint to delete */ + ); + +extern WTX_EVTPT_LIST * wtxEventpointListGet /* list event points on TS */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern STATUS wtxFileClose /* close a file on the target server */ + ( + HWTX hWtx, /* WTX API handle */ + INT32 fileDescriptor /* file to close descriptor */ + ); + +extern WTX_TGT_ID_T wtxFileOpen /* open a file on the target server */ + ( + HWTX hWtx, /* WTX API handle */ + const char * fileName, /* file name */ + WTX_OPEN_FLAG flags, /* unix style flags */ + INT32 mode, /* unix style mode */ + INT32 channel /* channel id for redirection */ + ); + +extern STATUS wtxFreeAdd /* adds a pointer to free list */ + ( + HWTX hWtx, /* WTX session handler */ + void * pToFree, /* pointer to add to the free list */ + FUNCPTR pFreeRtn, /* pointer to freeing routine */ + void * pMsgToFree, /* message pointer containing pToFree */ + FUNCPTR pMsgFreeRtn /* routine to use to free pMsgToFree */ + ); + +extern WTX_CONTEXT_ID_T wtxFuncCall /* call a function on the target */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TASK_CONTEXT_DEF *pTaskContextDef /* pointer to call descriptor */ + ); + +extern STATUS wtxDirectCall /* call func on target within agent */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ADDR_T entry, /* function address */ + void * pRetVal, /* pointer to return value */ + UINT32 argc, /* argument count */ + ... /* argument list */ + ); + +extern WTX_GOPHER_TAPE * wtxGopherEval /* evaluate Gopher string on target */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId, /* targeted PD */ + const char * inputString /* gopher program to evaluate */ + ); + +extern STATUS wtxLogging /* WDB/WTX logging facilities */ + ( + HWTX hWtx, /* WTX API handle */ + int type, /* WDB or WTX logging */ + int action, /* logging ON or OFF */ + const char * fileName, /* logging file name */ + int maxSize, /* log file max size */ + const char * filter /* request filter */ + ); + +extern WTX_MEM_INFO * wtxMemInfoGet /* get info about memory pool */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId /* PD into which we want to operate */ + ); + +extern STATUS wtxMemAddToPool /* add memory to the agent pool */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId, /* PD ID to look into */ + WTX_TGT_ADDR_T address, /* base of memory block to add */ + UINT32 size /* size of memory block to add */ + ); + +extern WTX_TGT_ADDR_T wtxMemAlign /* allocate aligned target memory */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId, /* PD into which we want to operate */ + WTX_TGT_ADDR_T alignment, /* alignment boundary */ + UINT32 numBytes /* size of block to allocate */ + ); + +extern WTX_TGT_ADDR_T wtxMemAlloc /* alloc blocks in memory pool */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId, /* PD into which we want to operate */ + UINT32 numBytes /* size to allocate in bytes */ + ); + +extern UINT32 wtxMemChecksum /* perform checksum on target memory */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId, /* PD ID to look into */ + WTX_TGT_ADDR_T startAddr, /* remote addr to start checksum at */ + UINT32 numBytes /* number of bytes to checksum */ + ); + +extern WTX_DASM_INST_LIST * wtxMemDisassemble /* disassemble memory */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ADDR_T pdId, /* PD ID to look into */ + WTX_TGT_ADDR_T startAddr, /* inst address to match */ + UINT32 nInst, /* number of instructions to get */ + WTX_TGT_ADDR_T endAddr, /* last address to match */ + BOOL32 printAddr, /* if instruction's address appended */ + BOOL32 printOpcodes, /* if instruction's opcodes appended */ + BOOL32 hexaAddr /* for HEX address representation */ + ); + +extern STATUS wtxMemFree /* free a block of target memory */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId, /* PD into which we want to operate */ + WTX_TGT_ADDR_T address /* target mem block address to free */ + ); + +extern STATUS wtxMemMove /* move a block of target memory */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T srcPdId, /* source PD */ + WTX_TGT_ADDR_T srcAddr, /* remote addr to move from */ + WTX_TGT_ID_T dstPdId, /* destination PD */ + WTX_TGT_ADDR_T destAddr, /* remote addr to move to */ + UINT32 numBytes /* number of bytes to move */ + ); + +extern UINT32 wtxMemRead /* read memory from the target */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId, /* PD ID to look into */ + WTX_TGT_ADDR_T fromAddr, /* target addr to read from */ + void * toAddr, /* local addr to read to */ + UINT32 numBytes, /* bytes to read */ + UINT32 options /* memory read options */ + ); + +extern UINT32 wtxMemWidthRead /* read memory on bytes */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId, /* PD ID to look into */ + WTX_TGT_ADDR_T fromAddr, /* target addr to read from */ + void * toAddr, /* local addr to read to */ + UINT32 numBytes, /* bytes to read */ + UINT8 width, /* width to read */ + UINT32 options /* memory read options */ + ); + +extern WTX_TGT_ADDR_T wtxMemRealloc /* reallocate a block of target mem */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId, /* PD into which we want to operate */ + WTX_TGT_ADDR_T address, /* memory block to reallocate */ + UINT32 numBytes /* new size */ + ); + +extern UINT32 wtxMemSet /* set target memory to given value */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId, /* PD ID to look into */ + WTX_TGT_ADDR_T addr, /* remote addr to write to */ + UINT32 numBytes, /* number of bytes to set */ + UINT32 val /* value to set */ + ); + +extern STATUS wtxMemScan /* scan target memory for pattern */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId, /* PD ID to look into */ + BOOL32 match, /* match/Not-match pattern boolean */ + WTX_TGT_ADDR_T startAddr, /* target address to start scan */ + WTX_TGT_ADDR_T endAddr, /* target address to finish scan */ + UINT32 numBytes, /* number of bytes in pattern */ + void * pattern, /* pointer to pattern to search for */ + WTX_TGT_ADDR_T * pResult /* pointer to result address */ + ); + +extern UINT32 wtxMemWrite /* write memory on the target */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId, /* PD ID to look into */ + void * fromAddr, /* local addr to write from */ + WTX_TGT_ADDR_T toAddr, /* remote addr to write to */ + UINT32 numBytes, /* bytes to read */ + UINT32 options /* memory write options */ + ); + +extern UINT32 wtxMemWidthWrite /* write memory on the target */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId, /* PD ID to look into */ + void * fromAddr, /* local addr to write from */ + WTX_TGT_ADDR_T toAddr, /* remote addr to write to */ + UINT32 numBytes, /* number of bytes to read */ + UINT8 width, /* width to read */ + UINT32 options /* memory write options */ + ); + +extern STATUS wtxObjModuleChecksum /* checks validity of target memory */ + ( + HWTX hWtx, /* WTX API handler */ + WTX_TGT_ID_T pdId, /* protection domain ID to look into */ + WTX_TGT_ID_T moduleId, /* module ID to check */ + char * moduleName /* module name to check */ + ); + +extern char * wtxObjModuleFindName /* find module name given its ID */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId, /* protection domain in which to look */ + WTX_TGT_ID_T moduleId /* module ID to get name from */ + ); + +extern WTX_TGT_ID_T wtxObjModuleFindId /* find obj module ID from name */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId, /* protection domain in which to look */ + const char * moduleName /* module name to get ID from */ + ); + +extern WTX_MODULE_INFO * wtxObjModuleInfoGet /* give info on obj module */ + ( + HWTX hWtx, /* WTX API handler */ + WTX_TGT_ID_T pdId, /* protection domain to look into */ + WTX_TGT_ID_T moduleId /* module ID to get name from */ + ); + +extern WTX_MODULE_INFO * wtxObjModuleInfoAndPathGet /* give info on obj mod */ + ( + HWTX hWtx, /* WTX API handler */ + WTX_TGT_ID_T pdId, /* protection domain to look into */ + WTX_TGT_ID_T moduleId /* module ID to get name from */ + ); + +extern WTX_MODULE_LIST * wtxObjModuleListGet /* list loaded obj modules */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_MOD_FIND_CRITERIA * pCriteria /* search criteria */ + ); + +extern UINT32 wtxLoadModeGet /* get host loader load mode */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern WTX_MODULE_INFO * wtxObjModuleLoad /* load a new object module */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId, /* PD we want to load in */ + WTX_MODULE_FILE_DESC * pFileDesc, /* module descriptor */ + UINT32 loadOptions /* load options */ + ); + +extern STATUS wtxObjModuleLoadStart /* asynchronous load */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId, /* PD we want to load in */ + WTX_MODULE_FILE_DESC * pFileDesc, /* module descriptor */ + UINT32 loadOptions /* load options */ + ); + +extern WTX_LOAD_REPORT_INFO * wtxObjModuleLoadProgressReport /* load status */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern STATUS wtxObjModuleLoadCancel /* cancel an async. load */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern STATUS wtxObjModuleUnload /* unload an obj module from target */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId, /* PD into which we want to operate */ + UINT32 option, /* unload option */ + WTX_TGT_ID_T modId /* ID of module to unload */ + ); + +extern STATUS wtxObjModuleByNameUnload /* unload an obj. mod. from target */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId, /* PD into which we want to operate */ + UINT32 option, /* unload option */ + const char * name /* name of module to look for */ + ); + +extern WTX_TGT_ADDR_T wtxProcessCreate + ( + HWTX hWtx, /* WTX API handle */ + const char * name, /* name of the PD to be created */ + int options, /* options of the PD */ + int addOptions, /* additionnal options */ + int stackSize, /* heap size */ + UINT32 uid, /* UID */ + UINT32 gid, /* GID */ + UINT32 priority, /* Priority */ + UINT32 redirIn, /* RedirIn */ + UINT32 redirOut, /* RedirOut */ + UINT32 redirErr, /* RedirErr */ + int argc, /* argc number */ + char ** argv, /* argv for process */ + int envc, /* envc number */ + char ** envv /* envv for process */ + ); + +extern WTX_TGT_ADDR_T wtxPdCreate + ( + HWTX hWtx, /* WTX API handle */ + const char * name, /* name of the PD to be created */ + int options, /* options of the PD */ + int heapSize, /* heap size */ + int lowPriority, /* lowest priority a task may have */ + int highPriority, /* highest priority a task may have */ + WTX_TGT_ADDR_T pagePoolList, /* a list of page pools for the PD */ + const char * linkPath /* link path to specify for the PD */ + ); + +extern STATUS wtxRegisterForEvent /* send events matching expression */ + ( + HWTX hWtx, /* WTX API handle */ + const char * regExp /* regular expr to select events */ + ); + +extern STATUS wtxRegsGet /* read register data from the target */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_CONTEXT * pContext, + WTX_REG_SET_TYPE regSet, /* type of register set */ + UINT32 firstByte, /* first byte of register set */ + UINT32 numBytes, /* number of bytes of register set */ + void * regMemory /* place holder for reg. values */ + ); + +extern STATUS wtxRegsSet /* write to registers on the target */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_CONTEXT * pContext, + WTX_REG_SET_TYPE regSet, /* type of register set */ + UINT32 firstByte, /* first byte of reg. set */ + UINT32 numBytes, /* number of bytes in reg. set. */ + void * regMemory /* register contents */ + ); + +extern void wtxSymListFree /* free a wtx symbol list */ + ( + WTX_SYM_LIST * pSymList /* symbol list to free */ + ); + +extern void wtxObjModuleListFree /* free a wtx module list */ + ( + WTX_MODULE_LIST * pModList /* module list to free */ + ); + +extern STATUS wtxResultFree /* free mem allocated by WTX API call */ + ( + HWTX hWtx, /* WTX API handle */ + void * pResult /* pointer to WTX result structure */ + ); + +extern WTX_TGT_ADDR_T wtxStrToTgtAddr /* convert str to a WTX_TGT_ADDR_T */ + ( + HWTX hWtx, /* WTX API handle */ + const char * str /* string to convert */ + ); + +extern INT32 wtxStrToInt32 /* convert str to an INT32 */ + ( + HWTX hWtx, /* WTX API handle */ + const char * str /* string to convert */ + ); + +extern WTX_CONTEXT_ID_T wtxStrToContextId /* convert str to ctxt ID */ + ( + HWTX hWtx, /* WTX API handle */ + const char * str /* string to convert */ + ); + +extern WTX_CONTEXT_TYPE wtxStrToContextType /* convert str ton ctxt type */ + ( + HWTX hWtx, /* WTX API handle */ + const char * str /* string to convert */ + ); + +extern WTX_EVENT_TYPE wtxStrToEventType /* convert string to event type */ + ( + HWTX hWtx, /* WTX API handle */ + const char * str /* string to convert */ + ); + +const char * wtxEventToStrType /* convert event type to a string */ + ( + WTX_EVENT_TYPE event /* WTX Event */ + ); + +extern STATUS wtxSymAdd /* add symbol with given params */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId, /* PD into which we want operate */ + const char * symName, /* name of symbol to add */ + WTX_TGT_ADDR_T symValue, /* value of symbol to add */ + UINT32 symType /* type of symbol to add */ + ); + +extern WTX_SYMBOL * wtxSymFind /* find a symbol in the symbol table */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_SYM_FIND_CRITERIA * pCriteria /* criteria structure */ + ); + +extern WTX_SYM_LIST * wtxSymListGet /* find a symbol in the symbol table */ + ( + HWTX hWtx, /* WTX API handler */ + WTX_SYM_FIND_CRITERIA * pCriteria /* criteria structure */ + ); + +extern WTX_SYM_LIST * wtxSymListByModuleIdGet /* get list of symbols */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId, /* protection domain ID to look into */ + const char * string, /* string to match */ + WTX_TGT_ID_T moduleId, /* module ID to search in */ + WTX_TGT_ADDR_T value, /* symbol value to match */ + BOOL32 listUnknown /* list unknown symbols only flag */ + ); + +extern WTX_SYM_LIST * wtxSymListByModuleNameGet /* get list of symbols */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId, /* protection domain ID to look into */ + const char * string, /* string to match */ + const char * moduleName, /* module name to search in */ + WTX_TGT_ADDR_T value, /* symbol value to match */ + BOOL32 listUnknown /* list unknown symbols only flag */ + ); + +extern STATUS wtxSymRegister /* registers a new syymbol */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId, /* PD into which we want to operate */ + const char * name, /* name of symbol to add */ + WTX_TGT_ADDR_T value, /* value of symbol to add */ + UINT32 symRef, /* reference of the symbol */ + UINT32 type, /* type of symbol to add */ +#ifdef HOST /* XXX */ + UINT32 execMode, /* execution mode (entry points only) */ + GROUP_ID apiGroup /* API group of the symbol */ +#else /* HOST */ + UINT32 execMode /* execution mode (entry points only) */ +#endif /* HOST */ + ); + +extern STATUS wtxSymRemove /* remove a symbol from sym table */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId, /* PD into which we want operate */ + const char * symName, /* name of symbol to remove */ + UINT32 symType /* type of symbol to remove */ + ); + +extern WTX_SYM_TBL_INFO * wtxSymTblInfoGet /* return sym table info */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId /* PD into which we want to look at */ + ); + +extern const char * wtxTargetRtNameGet /* get the target-runtime name */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern const char * wtxTargetRtVersionGet /* get target-runtime version */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern INT32 wtxTargetCpuTypeGet /* get the target CPU type code */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern BOOL32 wtxTargetHasFppGet /* check for floating point processor */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern BOOL32 wtxTargetHasAltivecGet /* check for altivec processor */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern BOOL32 wtxTargetHasSpeGet /* check for SPE processor */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern BOOL32 wtxTargetHasDspGet /* check for DSP prcessor */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern WTX_ENDIAN_T wtxTargetEndianGet /* get edianness of target */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern const char * wtxTargetBootlineGet /* get target boot line info */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern const char * wtxTargetBspNameGet /* get the BSP name string */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern const char * wtxTargetBspShortNameGet /* get the BSP_NAME value */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern const char * wtxTargetToolNameGet/* get the tool used to build the tgt */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern STATUS wtxTargetReset /* reset the target */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern UINT32 wtxTargetIpAddressGet /* get the target IP address */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern STATUS wtxTargetAttach /* reattach to the target */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern STATUS wtxToolAttach /* connect client to target server */ + ( + HWTX hWtx, /* WTX API handle */ + const char * targetName, /* target Server name */ + const char * toolName /* tool name */ + ); + +extern STATUS wtxToolOnHostAttach /* attach to a remote target server */ + ( + HWTX hWtx, /* WTX API handle */ + const char * serverName, /* target server name */ + const char * toolName, /* tool name */ + char * host /* host to ask for tgtsvr */ + ); + +extern const char * wtxToolNameGet /* return name of current tool */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern BOOL32 wtxToolConnected /* check tool connection to server */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern STATUS wtxToolDetach /* detach from the target server */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern WTX_TGT_ID_T wtxToolIdGet /* return tool ID of current tool */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern WTX_TS_INFO * wtxTsInfoGet /* get info about target and server */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern STATUS wtxTsKill /* kill the target server */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern STATUS wtxTsLock /* lock server for exclusive access */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern STATUS wtxTsTimedLock /* lock target server a limited time */ + ( + HWTX hWtx, /* WTX API handle */ + UINT32 seconds /* duration of lock */ + ); + +extern const char * wtxTsNameGet /* get target server name */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern STATUS wtxTsRestart /* restart the target server */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern STATUS wtxTsUnlock /* unlock the connected target server */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern STATUS wtxUnregisterForEvent /* unregister for some events */ + ( + HWTX hWtx, /* WTX API handle */ + const char * regExp /* regexp for the unwanted events */ + ); + +extern BOOL32 wtxVerify /* verify WTX handle is valid for use */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern INT32 wtxVioChanGet /* get a virtual I/O channel number */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern STATUS wtxVioChanRelease /* release a virtual I/O channel */ + ( + HWTX hWtx, /* WTX API handle */ + INT32 channel /* the channel number to release */ + ); + +extern STATUS wtxVioCtl /* perform control operation on VIO */ + ( + HWTX hWtx, /* WTX API handle */ + INT32 channel, /* channel to do control operation on */ + UINT32 request, /* control operation to perform */ + UINT32 arg /* argument for call */ + ); + +extern WTX_VIO_FILE_DESC ** wtxVioFileListGet /* list server files */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern UINT32 wtxVioWrite /* write data to a VIO channel */ + ( + HWTX hWtx, /* WTX API handle */ + INT32 channel, /* channel to write to */ + void * pData, /* pointer to data to write */ + UINT32 numBytes /* number of bytes of data to write */ + ); + +extern STATUS wtxVioLink + ( + HWTX hWtx, /* WTX API handle */ + WTX_VIO_LINK_DESC *vioLinkDesc /* VIO link descriptor */ + ); + +extern STATUS wtxVioUnlink + ( + HWTX hWtx, /* WTX API handle */ + WTX_VIO_LINK_DESC *vioLinkDesc /* VIO link descriptor */ + ); + +extern const char * wtxTsVersionGet /* return the Tornado version */ + ( + HWTX hWtx /* WTX API handle */ + ); + +extern STATUS wtxMsgObjModuleLoad + ( + HWTX hWtx, /* WTX API handle */ + WTX_MSG_FILE_LOAD_DESC *pfileLoadDescIn, + WTX_MSG_FILE_LOAD_DESC *pfileLoadDescOut + ); + +extern STATUS wtxUsrSvcAdd + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T svcId, /* id to attribute to new service, */ + /* 0 = use the id returned by this */ + /* request */ + WTX_TGT_ADDR_T entry, /* service function address */ + WTX_TGT_ADDR_T initRtn, /* service init routine address */ + WTX_TGT_INT_T initRtnArg, /* service init routine argument */ + WTX_TGT_ID_T * pSvcId /* pointer to service id */ + ); + +extern STATUS wtxUsrSvcFind + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ADDR_T entry, /* service function address */ + WTX_TGT_ID_T * pSvcId /* pointer to service id */ + ); + +extern STATUS wtxUsrSvcRemove + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T svcId, /* id of service to remove */ + WTX_TGT_ADDR_T stopRtn, /* service stop routine address */ + WTX_TGT_INT_T stopRtnArg /* service stop routine argument */ + ); + +WTX_MEM_XFER * wtxUsrSvcCall + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T svcId, /* id of service to call */ + void * buffer, /* service arguments */ + UINT32 nBytes /* number of bytes in buffer */ + ); + +extern char * wtxTsLogGet + ( + HWTX hWtx, /* WTX current session handle */ + char * svrName, /* target server to get log from */ + int seek, /* seek to apply on target server log file */ + char * host /* host on which registry is running */ + ); + +extern STATUS wtxShlibAddrGet /* Get address of sharedlib */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T shlibPdId, /* PD of the sharedlib */ + WTX_TGT_ID_T prPdId, /* Process PD. 0 is current process */ + WTX_TGT_ADDR_T * pRetVal /* Return address */ + ); + +extern STATUS wtxTargetFileCopy /* Do a remote file copy */ + ( + HWTX hWtx, /* WTX API handle */ + char * srcPathname, /* Host source pathname */ + char * dstPathname, /* Destination pathname */ + UINT32 options /* Copy options */ + ); + +extern STATUS wtxTargetFileRemove /* Do a remote file copy */ + ( + HWTX hWtx, /* WTX API handle */ + char * fileName, /* Host source pathname */ + UINT32 options /* Remove options */ + ); + +extern STATUS wtxContextAttach + ( + HWTX hWtx, /* WTX API handle */ + WTX_CONTEXT * pContext + ); + +extern STATUS wtxContextDetach + ( + HWTX hWtx, /* WTX API handle */ + WTX_CONTEXT * pContext + ); + +/* --------------------------- Environment settings ------------------------- */ + +extern char * wtxTgtsvrEnvGet /* Get environment string */ + ( + HWTX hWtx, /* WTX API handle */ + char * envVariable /* Environment variable to get */ + ); + +extern STATUS wtxTgtsvrEnvSet /* Set environment string */ + ( + HWTX hWtx, /* WTX API handle */ + char * envVariable, /* Environment variable to set */ + char * envValue /* Value to set */ + ); + +extern STATUS wtxLastRuntimeErrorGet + ( + HWTX hWtx, /* WTX API handle */ + char * pRetVal /* last runtime errno string */ + ); + +/* --------------------------- kernel modules utilities --------------------- */ + +extern STATUS wtxModulesInfoSynchro /* Update kernel modules symbols */ + ( + HWTX hWtx, /* WTX API handle */ + UINT32 * pRetVal /* Number of synchronized modules */ + ); + +/* --------------------------- Target filesystem IO ------------------------ */ +extern STATUS wtxTgtfsMkdir + ( + HWTX hWtx, /* WTX API handle */ + char * pathname, /* Pathname */ + WTX_TGTFS_INODE_MODE_TYPE mode /* Mode */ + ); + +extern STATUS wtxTgtfsRmdir + ( + HWTX hWtx, /* WTX API handle */ + char * pathname /* Pathname */ + ); + +extern STATUS wtxTgtfsMv + ( + HWTX hWtx, /* WTX API handle */ + char * oldPath, /* Pathname */ + char * newPath /* Pathname */ + ); + +extern STATUS wtxTgtfsRm + ( + HWTX hWtx, /* WTX API handle */ + char * pathname /* Pathname */ + ); + +extern STATUS wtxTgtfsLink + ( + HWTX hWtx, /* WTX API handle */ + char * oldPath, /* Pathname */ + char * newPath /* Pathname */ + ); + +extern STATUS wtxTgtfsSymlink + ( + HWTX hWtx, /* WTX API handle */ + char * oldPath, /* Pathname */ + char * newPath /* Pathname */ + ); + +extern STATUS wtxTgtfsCp + ( + HWTX hWtx, /* WTX API handle */ + char * oldPath, /* Pathname */ + char * newPath /* Pathname */ + ); + +extern STATUS wtxTgtfsMknod + ( + HWTX hWtx, /* WTX API handle */ + char * pathname, /* Pathname */ + WTX_TGTFS_INODE_MODE_TYPE mode, /* Mode */ + UINT32 major, /* Major */ + UINT32 minor /* Minor */ + ); + +extern STATUS wtxTgtfsReaddir + ( + HWTX hWtx, /* WTX API handle */ + char * pathname,/* Pathname (in) */ + WTX_TGTFS_INODE_CTRL_OPT option, /* Option (in) */ + WTX_TGTFS_INODE_READDIR_LIST * pReaddirList /* Pointer to result list */ + ); + +extern STATUS wtxTgtfsSetdir + ( + HWTX hWtx, /* WTX API handle */ + char * pathname, /* Pathname */ + char ** ppCurrentDir /* New pathname */ + ); + +extern STATUS wtxTgtfsGetdir + ( + HWTX hWtx, /* WTX API handle */ + char ** ppCurrentDir /* New pathname */ + ); + +extern STATUS wtxTgtfsStat + ( + HWTX hWtx, /* WTX API handle */ + char * pathname, /* Structure dirp (in) */ + WTX_TGTFS_INODE_STAT_RES ** ppStatInfo /* Pointer to info */ + ); + +extern STATUS wtxTgtfsLstat + ( + HWTX hWtx, /* WTX API handle */ + char * pathname, /* Structure dirp (in) */ + WTX_TGTFS_INODE_STAT_RES ** ppStatInfo /* Pointer to info */ + ); + +extern UINT32 wtxOsErrCodeGet + ( + HWTX hWtx /* WTX API handle */ + ); + +extern STATUS wtxTgtfsChmod + ( + HWTX hWtx, /* WTX API handle */ + char * pathname, /* Pathname */ + WTX_TGTFS_INODE_MODE_TYPE mode /* Mode */ + ); + +extern STATUS wtxTgtfsChown + ( + HWTX hWtx, /* WTX API handle */ + char * pathname, /* Pathname */ + UINT32 uid, /* UID */ + UINT32 gid + ); + +extern STATUS wtxTgtfsUmask + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGTFS_INODE_MODE_TYPE umask, /* Mode to set to */ + WTX_TGTFS_INODE_MODE_TYPE * pPrevValue /* Previous value */ + ); + +extern STATUS wtxReaddirFree + ( + WTX_TGTFS_INODE_READDIR_RES *pList + ); + +extern STATUS wtxTgtfsReadlink + ( + HWTX hWtx, /* WTX API handle */ + char * pathname, /* Pathname */ + char ** ppCurrentLink /* Points to (out) */ + ); + +/* ------------------------PD threads ------------------------------------ */ +extern WTX_TASKS_INFO_DESC * wtxPdTasksListGet + ( + HWTX hWtx, /* WTX API handle */ + WTX_CONTEXT * pContext /* Input : Context */ + ); + +extern STATUS wtxPdInfoSet + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId, /* pdId */ + UINT32 options /* Options */ + ); + + +extern WTX_PD_INFO_OPT wtxPdInfoGet + ( + HWTX hWtx, /* WTX API handle */ + WTX_TGT_ID_T pdId /* pdId */ + ); + +/* --------------------------- exported utilities --------------------------- */ + +extern WTX_DESC * wtxDescDuplicate /* duplicate a WTX_DESC */ + ( + HWTX hWtx, /* current WTX session handler */ + WTX_DESC * pDesc /* WTX_DESC to duplicate */ + ); + +#ifdef HOST +extern const char * wtxTargetToolFamilyGet + /* returns toolchain family (e.g. "gnu" or "diab") */ + ( + HWTX hWtx /* WTX API handle */ + ); +#endif + +#ifdef WIN32 +long wtxEnvironRegistryOptionsGet + ( + HKEY hKey, /* Win32 registry key handler */ + char * dbDir, /* Tornado registry DB directory */ + int * pPingDelay, /* target server ping delay */ + int * pNUnsuccessPing, /* target server max unsuccess ping */ + int * pConnectionTimeout, /* inter-registry timeout (seconds) */ + char ** pWtxLogFileName, /* wtx log file path */ + int * pWtxLogMaxSize, /* wtx log file max size */ + char ** pWtxLogFilter, /* wtx log filter regexp */ + int * pWtxLogLevel /* wtx log level */ + ); + +#endif /* WIN32 */ + +#ifdef HOST +extern DEMANGLER_STYLE wtxMsgDemanglerStyleGet + ( + HWTX hWtx /* WTX API handle */ + ); + +#define wtxDemanglerStyleGet wtxMsgDemanglerStyleGet +#define wtxDefaultDemanglerStyleGet wtxMsgDemanglerStyleGet +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwtxh */ diff --git a/h/wtxerr.h b/h/wtxerr.h new file mode 100644 index 0000000..3b6a48c --- /dev/null +++ b/h/wtxerr.h @@ -0,0 +1,331 @@ +/* wtxerr.h - wtx error header file */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02w,22sep04,x_p Added linux launch errors +02v,08apr03,lcs Add error WTX_ERR_SVR_CANT_CONNECT_LICENSE_DAEMON. +02u,06mar03,fle added WTX_ERR_REGISTRY_REMOTE_TIMEOUT error +02t,12jul02,x_p Added error codes +02s,22aug01,x_p Error code for Margaux +02r,15jun00,fle added some new message for registry parameters errors +02q,23may00,fle added some new message for registry parameters errors +02p,18may00,fle added registry log errors +02o,21jan00,dbt Added WDB_ERR_USR_SVC_EXHAUSTED and + WDB_ERR_USR_SVC_ALREADY_USED. +02n,11jan00,bpn Added WTX_ERR_SVR_BKEND_VERSION error value. +02m,19nov99,bpn Added WTX_ERR_URL_ERROR error value. +02l,28oct99,c_c Added INVALID_PARTITION error. +02k,29sep99,fle added registry new features erelated error codes +02j,29sep99,c_c Added linkPath related errors. +02i,25aug99,fle added PD related error codes +02h,22jun98,c_c asynchronous loader implementation. +02g,02apr98,pcn WTX 2: added new error codes for C API. +02f,20mar98,fle got rid of the WTX_ERR_REGISTRY_PING_INFO_ERROR error value +02e,17mar98,pcn WTX 2: added WTX_ERR_SVR_BAD_TARGET_CHECKSUM and + WTX_ERR_SVR_DIFFERENT_CHECKSUM. +02d,10mar98,dbt added WTX_ERR_AGENT_HW_REGS_EXHAUSTED and + WTX_ERR_AGENT_INVALID_HW_BP error numbers. +02c,03mar98,fle added WTX_ERR_SVR_DOESNT_RESPOND error number +02b,02mar98,pcn WTX 2: added WTX_ERR_SVR_BKEND_LOG_IN_USE, + WTX_ERR_SVR_WTX_LOG_IN_USE. +02a,03feb98,fle changed WTX_ERR_REGISTRY_SVR_IS_DEAD code value +01z,23jan98,fle added WTX_ERR_REGISTRY_SVR_IS_DEAD error message +01y,22jan98,c_c Added WTX_ERR_LOADER_NO_VERIFICATION_ROUTINE error. +01x,24nov97,fle added WTX_ERR_REGISTRY_DB_FILE_CORRUPTED + WTX_ERR_REGISTRY_DIR_NOT_FOUND and + WTX_ERR_REGISTRY_FILE_NOT_FOUND error codes +01w,03mar97,wmd added comment to alert that corresponding changes must also + be made in resource/tcl/wtxerrdb.tcl. +01v,28feb97,wmd added WTX_ERR_SVR_INVALID_LICENSE. +01u,30sep96,elp put in share/src/wtx (SPR# 6775). +01t,11sep96,pad added WTX_ERR_LOADER_MAX_MODULES_LOADED (SPR #7133). +01s,15may96,pad added WTX_ERR_LOADER_SYMBOL_NOT_FROM_SDA_SECTION. +01r,26mar96,pad added WTX_ERR_LOADER_RELOCATION_OFFSET_TOO_LARGE. +01q,17jan96,p_m added WTX_ERR_SYMTBL_SYMBOL_NAME_TOO_LONG. +01p,16oct95,pad added WTX_ERR_SVR_CANT_CONNECT_LICENSE_DAEMON. +01o,31aug95,pad added WTX_ERR_LOADER_OBJ_MODULE_NOT_APPROPRIATE (SPR #4533). + Fixed WTX_ERR_AGENT_MEM_ACCESS_ERROR. +01n,12jul95,pad added WTX_ERR_LOADER_CANT_ATTACH_OMF_MANAGER. +01m,11jun95,p_m added WTX_ERR_SVR_TARGET_UNKNOWN and + WTX_ERR_SVR_INVALID_DEVICE. +01l,09jun95,p_m added WTX_ERR_AGENT_PATTERN_NOT_FOUND. +01k,01jun95,c_s added AGENT_GOPHER_SYNTAX error. +01j,22may95,jcf name revision. +01i,19may95,p_m added WTX_ERR_NO_VIO_CHANNEL + + tpr changed WTX_ERR_AGENT_XXX name following new WDB error code. +01h,17may95,s_w changed exchange and C API errors +01g,11may95,pas added WTX_ERR_SYMTBL_NO_SUCH_MODULE +01f,04may95,s_w added errors for C API and exchange errors and WTX_ERR_LAST +01e,29mar95,p_m added agent errors. +01d,01mar95,pad added error code for OBJ_XXX stuff. +01c,23feb95,p_m made all _TGT_SVR_ errors be _SVR_. leave unused numbers + between error classes. + changed _WPWRD_ errors to _REGISTRY_. +01b,21feb95,pad added error codes for DLL and WTX service addition. +01a,15feb95,p_m written. +*/ + +#ifndef __INCwtxerrh +#define __INCwtxerrh 1 + +#define WTX_ERR_NONE 0 + +/************************************************************************ +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + NOTE: under UNIX execute the following procedure: + + first check out the ../../resource/tcl/wtxerrdb.tcl file + go to /wind/river/host/src/foundation/wtxtcl directory + then type : + wtxtcl mkErrDb.tcl ../../../include/wtxerr.h > \ + ../../../resource/tcl/wtxerrdb.tcl + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +*/ + +/* wtx status codes */ + +#define WTXERR_BASE_NUM 0x10000 /* XXX P_M for now */ + +typedef enum wtx_error_t + { + /* Target Server Errors */ + + WTX_ERR_SVR_TARGET_NOT_ATTACHED = (WTXERR_BASE_NUM | 1), + WTX_ERR_SVR_INVALID_EVENTPOINT = (WTXERR_BASE_NUM | 2), + WTX_ERR_SVR_FILE_NOT_FOUND = (WTXERR_BASE_NUM | 3), + WTX_ERR_SVR_INVALID_FIND_REQUEST = (WTXERR_BASE_NUM | 4), + WTX_ERR_SVR_INVALID_FLAGS = (WTXERR_BASE_NUM | 5), + WTX_ERR_SVR_INVALID_FILE_DESCRIPTOR = (WTXERR_BASE_NUM | 6), + WTX_ERR_SVR_EINVAL = (WTXERR_BASE_NUM | 7), + + + WTX_ERR_SVR_NO_SCALABLE_AGENT = (WTXERR_BASE_NUM | 10), + WTX_ERR_SVR_CANT_ADD_WTX_SERVICE = (WTXERR_BASE_NUM | 11), + WTX_ERR_SVR_NO_VIO_CHANNEL = (WTXERR_BASE_NUM | 12), + WTX_ERR_SVR_BKEND_LOG_IN_USE = (WTXERR_BASE_NUM | 13), + WTX_ERR_SVR_WTX_LOG_IN_USE = (WTXERR_BASE_NUM | 14), + WTX_ERR_SVR_DOESNT_RESPOND = (WTXERR_BASE_NUM | 15), + WTX_ERR_SVR_IS_DEAD = (WTXERR_BASE_NUM | 16), + WTX_ERR_SVR_BAD_TARGET_CHECKSUM = (WTXERR_BASE_NUM | 17), + WTX_ERR_SVR_CHECKSUM_MISMATCH = (WTXERR_BASE_NUM | 18), + WTX_ERR_SVR_BKEND_VERSION = (WTXERR_BASE_NUM | 19), + + /* Common Server Errors */ + + WTX_ERR_SVR_NOT_ENOUGH_MEMORY = (WTXERR_BASE_NUM | 20), + WTX_ERR_SVR_ACCESS_DENIED = (WTXERR_BASE_NUM | 21), + WTX_ERR_SVR_WIND_BASE_NOT_SET = (WTXERR_BASE_NUM | 22), + WTX_ERR_SVR_SERVICE_NOT_AVAILABLE = (WTXERR_BASE_NUM | 23), + WTX_ERR_SVR_INVALID_CLIENT_ID = (WTXERR_BASE_NUM | 24), + WTX_ERR_SVR_CLIENT_NOT_ATTACHED = (WTXERR_BASE_NUM | 25), + WTX_ERR_SVR_TARGET_UNKNOWN = (WTXERR_BASE_NUM | 26), + WTX_ERR_SVR_INVALID_DEVICE = (WTXERR_BASE_NUM | 27), + WTX_ERR_SVR_CANT_CONNECT_LICENSE_DAEMON = (WTXERR_BASE_NUM | 28), + + /* Registry Errors */ + + WTX_ERR_REGISTRY_NAME_NOT_FOUND = (WTXERR_BASE_NUM | 30), + WTX_ERR_REGISTRY_BAD_PATTERN = (WTXERR_BASE_NUM | 31), + WTX_ERR_REGISTRY_NAME_CLASH = (WTXERR_BASE_NUM | 32), + WTX_ERR_REGISTRY_DB_DIR_NOT_FOUND = (WTXERR_BASE_NUM | 33), + WTX_ERR_REGISTRY_DB_FILE_ERROR = (WTXERR_BASE_NUM | 34), + WTX_ERR_REGISTRY_INVALID_ARG = (WTXERR_BASE_NUM | 35), + WTX_ERR_REGISTRY_TGTSVR_NOT_FOUND = (WTXERR_BASE_NUM | 36), + WTX_ERR_REGISTRY_MEMALLOC = (WTXERR_BASE_NUM | 37), + WTX_ERR_REGISTRY_INVALID_HOST = (WTXERR_BASE_NUM | 38), + WTX_ERR_REGISTRY_INVALID_PORT = (WTXERR_BASE_NUM | 39), + + /* Object Module Management Errors */ + + WTX_ERR_LOADER_TEXT_IN_USE = (WTXERR_BASE_NUM | 40), + WTX_ERR_LOADER_ILLEGAL_FLAGS_COMBINATION = (WTXERR_BASE_NUM | 41), + WTX_ERR_LOADER_NO_RELOCATION_ROUTINE = (WTXERR_BASE_NUM | 42), + WTX_ERR_LOADER_CANT_GET_SEGMENT_ADDRESSES = (WTXERR_BASE_NUM | 43), + WTX_ERR_LOADER_UNKNOWN_RELOCATION_ENTRY = (WTXERR_BASE_NUM | 44), + WTX_ERR_LOADER_UNKNOWN_COMMAND_FLAG = (WTXERR_BASE_NUM | 45), + WTX_ERR_LOADER_UNKNOWN_OBJ_MODULE_FORMAT = (WTXERR_BASE_NUM | 46), + WTX_ERR_LOADER_NULL_SIZE_OBJ_MODULE = (WTXERR_BASE_NUM | 47), + WTX_ERR_LOADER_OBJ_MODULE_NOT_FOUND = (WTXERR_BASE_NUM | 48), + WTX_ERR_LOADER_BAD_CHECKSUM = (WTXERR_BASE_NUM | 49), + WTX_ERR_LOADER_CANT_ATTACH_OMF_MANAGER = (WTXERR_BASE_NUM | 50), + WTX_ERR_LOADER_OBJ_MODULE_NOT_APPROPRIATE = (WTXERR_BASE_NUM | 51), + WTX_ERR_LOADER_RELOCATION_OFFSET_TOO_LARGE = (WTXERR_BASE_NUM | 52), + WTX_ERR_LOADER_SYMBOL_NOT_FROM_SDA_SECTION = (WTXERR_BASE_NUM | 53), + WTX_ERR_LOADER_MAX_MODULES_LOADED = (WTXERR_BASE_NUM | 54), + WTX_ERR_LOADER_RELOCATION_ERROR = (WTXERR_BASE_NUM | 55), + WTX_ERR_LOADER_NO_VERIFICATION_ROUTINE = (WTXERR_BASE_NUM | 56), + WTX_ERR_LOADER_LOAD_CANCELED = (WTXERR_BASE_NUM | 57), + WTX_ERR_LOADER_LOAD_IN_PROGRESS = (WTXERR_BASE_NUM | 58), + WTX_ERR_LOADER_ALREADY_LOADED = (WTXERR_BASE_NUM | 59), + + /* Symbol Management Errors */ + + WTX_ERR_SYMTBL_INVALID_SYMTBL = (WTXERR_BASE_NUM | 60), + WTX_ERR_SYMTBL_SYMBOL_NOT_FOUND = (WTXERR_BASE_NUM | 61), + WTX_ERR_SYMTBL_TABLE_NOT_EMPTY = (WTXERR_BASE_NUM | 62), + WTX_ERR_SYMTBL_NAME_CLASH = (WTXERR_BASE_NUM | 63), + WTX_ERR_SYMTBL_NO_SUCH_MODULE = (WTXERR_BASE_NUM | 64), + + /* Target Memory Management Errors */ + + WTX_ERR_TGTMEM_NOT_ENOUGH_MEMORY = (WTXERR_BASE_NUM | 70), + WTX_ERR_TGTMEM_INVALID_POOL_SIZE = (WTXERR_BASE_NUM | 71), + WTX_ERR_TGTMEM_INVALID_BLOCK = (WTXERR_BASE_NUM | 72), + WTX_ERR_TGTMEM_PAGE_SIZE_UNAVAILABLE = (WTXERR_BASE_NUM | 73), + WTX_ERR_TGTMEM_BLOCK_CONFLICT = (WTXERR_BASE_NUM | 74), + + WTX_ERR_TGTMEM_UNMAPPED_MEMORY = (WTXERR_BASE_NUM | 76), + WTX_ERR_TGTMEM_INVALID_PARTITION = (WTXERR_BASE_NUM | 77), + + /* generic DLL error codes */ + + WTX_ERR_DLL_CANT_OPEN_SHARED_FILE = (WTXERR_BASE_NUM | 100), + WTX_ERR_DLL_CANT_BIND_FUNCTION = (WTXERR_BASE_NUM | 101), + WTX_ERR_DLL_CANT_CLOSE_SHARED_FILE = (WTXERR_BASE_NUM | 102), + + /* Internal object error codes */ + + WTX_ERR_OBJ_INVALID_OBJECT = (WTXERR_BASE_NUM | 110), + + /* Agent error codes */ + + WTX_ERR_AGENT_UNSUPPORTED_REQUEST = (WTXERR_BASE_NUM | 200), + WTX_ERR_AGENT_INVALID_PARAMS = (WTXERR_BASE_NUM | 201), + WTX_ERR_AGENT_MEM_ACCESS_ERROR = (WTXERR_BASE_NUM | 202), + WTX_ERR_AGENT_AGENT_MODE_ERROR = (WTXERR_BASE_NUM | 203), + WTX_ERR_AGENT_RT_ERROR = (WTXERR_BASE_NUM | 204), + WTX_ERR_AGENT_INVALID_CONTEXT = (WTXERR_BASE_NUM | 205), + WTX_ERR_AGENT_INVALID_VIO_CHANNEL = (WTXERR_BASE_NUM | 206), + WTX_ERR_AGENT_INVALID_EVENT = (WTXERR_BASE_NUM | 207), + WTX_ERR_AGENT_INVALID_EVENTPOINT = (WTXERR_BASE_NUM | 208), + WTX_ERR_AGENT_GOPHER_FAULT = (WTXERR_BASE_NUM | 209), + WTX_ERR_AGENT_GOPHER_TRUNCATED = (WTXERR_BASE_NUM | 210), + WTX_ERR_AGENT_EVENTPOINT_TABLE_FULL = (WTXERR_BASE_NUM | 211), + WTX_ERR_AGENT_NO_AGENT_PROC = (WTXERR_BASE_NUM | 212), + WTX_ERR_AGENT_NO_RT_PROC = (WTXERR_BASE_NUM | 213), + WTX_ERR_AGENT_PROC_FAILED = (WTXERR_BASE_NUM | 214), + WTX_ERR_AGENT_PATTERN_NOT_FOUND = (WTXERR_BASE_NUM | 215), + WTX_ERR_AGENT_HW_BP_REGS_EXHAUSTED = (WTXERR_BASE_NUM | 216), + WTX_ERR_AGENT_INVALID_HW_BP = (WTXERR_BASE_NUM | 217), + + + WTX_ERR_AGENT_NO_CONNECTION = (WTXERR_BASE_NUM | 220), + WTX_ERR_AGENT_CONNECTION_BUSY = (WTXERR_BASE_NUM | 221), + WTX_ERR_AGENT_COMMUNICATION_ERROR = (WTXERR_BASE_NUM | 222), + WTX_ERR_AGENT_GOPHER_SYNTAX = (WTXERR_BASE_NUM | 223), + + + + + + + WTX_ERR_AGENT_USR_SVC_EXHAUSTED = (WTXERR_BASE_NUM | 230), + WTX_ERR_AGENT_USR_SVC_ALREADY_USED = (WTXERR_BASE_NUM | 231), + + /* WTX C API error codes */ + + WTX_ERR_API = (WTXERR_BASE_NUM | 300), + WTX_ERR_API_MEMALLOC = (WTXERR_BASE_NUM | 301), + WTX_ERR_API_HANDLER_NOT_FOUND = (WTXERR_BASE_NUM | 302), + WTX_ERR_API_NOT_CONNECTED = (WTXERR_BASE_NUM | 303), + WTX_ERR_API_INVALID_ARG = (WTXERR_BASE_NUM | 304), + WTX_ERR_API_SERVER_NOT_FOUND = (WTXERR_BASE_NUM | 305), + WTX_ERR_API_ALREADY_CONNECTED = (WTXERR_BASE_NUM | 306), + WTX_ERR_API_AMBIGUOUS_SERVER_NAME = (WTXERR_BASE_NUM | 307), + WTX_ERR_API_REGS_GET_PARTIAL_READ = (WTXERR_BASE_NUM | 308), + WTX_ERR_API_INVALID_HANDLE = (WTXERR_BASE_NUM | 309), + WTX_ERR_API_REGISTRY_UNREACHABLE = (WTXERR_BASE_NUM | 310), + WTX_ERR_API_SERVICE_NOT_REGISTERED = (WTXERR_BASE_NUM | 311), + WTX_ERR_API_SERVICE_ALREADY_REGISTERED = (WTXERR_BASE_NUM | 312), + WTX_ERR_API_TOOL_DISCONNECTED = (WTXERR_BASE_NUM | 313), + WTX_ERR_API_REQUEST_FAILED = (WTXERR_BASE_NUM | 314), + WTX_ERR_API_REQUEST_TIMED_OUT = (WTXERR_BASE_NUM | 315), + WTX_ERR_API_FILE_NOT_FOUND = (WTXERR_BASE_NUM | 316), + WTX_ERR_API_SERVICE_ALREADY_STARTED = (WTXERR_BASE_NUM | 317), + WTX_ERR_API_CANT_OPEN_SOCKET = (WTXERR_BASE_NUM | 318), + WTX_ERR_API_CANT_GET_HOSTNAME = (WTXERR_BASE_NUM | 319), + WTX_ERR_API_FILE_NOT_ACCESSIBLE = (WTXERR_BASE_NUM | 320), + WTX_ERR_API_NULL_SIZE_FILE = (WTXERR_BASE_NUM | 321), + WTX_ERR_API_CANT_READ_FROM_FILE = (WTXERR_BASE_NUM | 322), + + WTX_ERR_API_TARGET_ALREADY_CONNECTED = (WTXERR_BASE_NUM | 324), + WTX_ERR_API_TARGET_RESERVED = (WTXERR_BASE_NUM | 325), + WTX_ERR_API_TARGET_DOWN = (WTXERR_BASE_NUM | 326), + WTX_ERR_API_TARGET_NOT_FOUND = (WTXERR_BASE_NUM | 327), + WTX_ERR_API_INVALID_SVR_NAME = (WTXERR_BASE_NUM | 328), + WTX_ERR_API_INVALID_SVR_CMDLINE = (WTXERR_BASE_NUM | 329), + WTX_ERR_API_INVALID_ENTRY_NAME = (WTXERR_BASE_NUM | 330), + WTX_ERR_API_INVALID_ENTRY_TYPE = (WTXERR_BASE_NUM | 331), + WTX_ERR_API_INVALID_ENTRY_KEY = (WTXERR_BASE_NUM | 332), + + /* WTX Exchange Error Codes */ + + WTX_ERR_EXCHANGE = (WTXERR_BASE_NUM | 400), + WTX_ERR_EXCHANGE_INVALID_HANDLE = (WTXERR_BASE_NUM | 401), + WTX_ERR_EXCHANGE_DATA = (WTXERR_BASE_NUM | 402), + WTX_ERR_EXCHANGE_MEMALLOC = (WTXERR_BASE_NUM | 403), + WTX_ERR_EXCHANGE_NO_SERVER = (WTXERR_BASE_NUM | 404), + WTX_ERR_EXCHANGE_INVALID_ARG = (WTXERR_BASE_NUM | 405), + WTX_ERR_EXCHANGE_MARSHALPTR = (WTXERR_BASE_NUM | 406), + WTX_ERR_EXCHANGE_TIMEOUT = (WTXERR_BASE_NUM | 407), + WTX_ERR_EXCHANGE_BAD_KEY = (WTXERR_BASE_NUM | 408), + WTX_ERR_EXCHANGE_REQUEST_UNSUPPORTED = (WTXERR_BASE_NUM | 409), + WTX_ERR_EXCHANGE_TRANSPORT_UNSUPPORTED = (WTXERR_BASE_NUM | 410), + WTX_ERR_EXCHANGE_TRANSPORT_ERROR = (WTXERR_BASE_NUM | 411), + WTX_ERR_EXCHANGE_TRANSPORT_DISCONNECT = (WTXERR_BASE_NUM | 412), + WTX_ERR_EXCHANGE_NO_TRANSPORT = (WTXERR_BASE_NUM | 413), + + /* other registry errors */ + + WTX_ERR_REGISTRY_REMOTE_UNREACHABLE = (WTXERR_BASE_NUM | 420), + WTX_ERR_REGISTRY_INVALID_TARGET = (WTXERR_BASE_NUM | 421), + WTX_ERR_REGISTRY_INVALID_SESSION = (WTXERR_BASE_NUM | 422), + WTX_ERR_REGISTRY_LOG_FILE_OPEN = (WTXERR_BASE_NUM | 423), + WTX_ERR_REGISTRY_LOG_SEM_CREATE = (WTXERR_BASE_NUM | 424), + WTX_ERR_REGISTRY_REMOTE_TIMEOUT = (WTXERR_BASE_NUM | 425), + + /* Protection domain errors */ + + WTX_ERR_PD_INVALID_PD = (WTXERR_BASE_NUM | 500), + WTX_ERR_PD_KERNEL_NOT_FOUND = (WTXERR_BASE_NUM | 501), + + /* linkPathLib errors */ + + WTX_ERR_LINKPATH_BINDING_REQUEST_REFUSED = (WTXERR_BASE_NUM | 550), + WTX_ERR_LINKPATH_INVALID_REQUEST = (WTXERR_BASE_NUM | 551), + WTX_ERR_LINKPATH_INVALID_LINK_PATH = (WTXERR_BASE_NUM | 552), + + /* URL errors */ + + WTX_ERR_URL_ERROR = (WTXERR_BASE_NUM | 560), + + /* TARGET_FILE_COPY errors */ + WTX_ERR_TARGET_FILE_COPY_INVALID_HOSTPATHNAME = (WTXERR_BASE_NUM | 570), + WTX_ERR_TARGET_FILE_COPY_WRITE_FAILED = (WTXERR_BASE_NUM | 571), + WTX_ERR_TARGET_FILE_COPY_READ_FAILED = (WTXERR_BASE_NUM | 572), + WTX_ERR_TARGET_FILE_COPY_NO_MEMORY = (WTXERR_BASE_NUM | 573), + WTX_ERR_TARGET_FILE_COPY_FILE_EXISTS = (WTXERR_BASE_NUM | 574), + + /* TARGET_FILE_REMOVE errors */ + WTX_ERR_TARGET_FILE_REMOVE_FAILED = (WTXERR_BASE_NUM | 580), + WTX_ERR_TARGET_FILE_REMOVE_NO_HOST_COPY = (WTXERR_BASE_NUM | 581), + + /* BSDOS + LINUX SPECIFIC */ + WTX_ERR_BSDOS_NOT_AVAILABLE = (WTXERR_BASE_NUM | 590), + WTX_ERR_TARGET_RUNTIME_ERROR = (WTXERR_BASE_NUM | 591), + WTX_ERR_NO_HOST_DEBUG_COPY = (WTXERR_BASE_NUM | 592), + WTX_ERR_NO_TARGET_FILE = (WTXERR_BASE_NUM | 593), + + /* LINUX ERROR CODE */ + WTX_ERR_LINUX_SHARED_LIB_ISSUE = (WTXERR_BASE_NUM | 600), + WTX_ERR_LINUX_PROCESS_DIED = (WTXERR_BASE_NUM | 601), + WTX_ERR_LINUX_CANT_GET_PROCESS_NAME = (WTXERR_BASE_NUM | 602), + WTX_ERR_LAST = (WTXERR_BASE_NUM | 0xFFFF) + } WTX_ERROR_T; + +#endif diff --git a/h/wtxexch.h b/h/wtxexch.h new file mode 100644 index 0000000..c53444d --- /dev/null +++ b/h/wtxexch.h @@ -0,0 +1,103 @@ +/* wtxexch.h - wtx message exchange header file */ + +/* Copyright 1984-2003 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,01apr03,fle added wtxExchangeSvcAdd() routine +01d,05jan00,fle added usePMap parameter to wtxExchangeCreate() +01c,21oct99,fle added declaration of wtxEchangeTimeoutSet() routine +01b,11may99,fle changed wtxExchangeInstall declaration since wtxRpcExchange + changes +01a,30sep96,elp put in share/src/wtx (SPR# 6775). +01a,15may95s_w written. Based on original design by John Fogelin +*/ + +#ifndef __INCwtxexchh +#define __INCwtxexchh 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#include "wtxtypes.h" +#include "wtxerr.h" + +/* defines */ + +#define WTX_EXCHANGE_CTL_TIMEOUT_GET 1 +#define WTX_EXCHANGE_CTL_TIMEOUT_SET 2 +#define WTX_EXCHANGE_CTL_TRANSPORT_ERR_GET 3 + +/* typedefs */ + +typedef struct _wtx_exchange * WTX_XID; + +/* function declarations */ + +STATUS wtxExchangeInitialize (WTX_XID * pXid); + +STATUS wtxExchangeInstall /* install exchange marshall funcs for handle */ + ( + WTX_XID xid, + STATUS (*xCreate) /* connect the exchange id to a WTX server */ + ( + WTX_XID, /* WTX exchange ID to create */ + const char *, /* server key string */ + BOOL /* do we use port mapper for connection ? */ + ), + STATUS (*xDelete) /* disconnect exchange id from a WTX server */ + ( + WTX_XID /* WTX exchange ID */ + ), + STATUS (*xExchange) /* perform an exchange request */ + ( + WTX_XID, /* WTX exchange ID */ + WTX_REQUEST, /* exchange request number */ + void *, /* pointer to input arg message */ + void * /* pointer to output arg (result) message */ + ), + WTX_ERROR_T (*xFree) /* free result of exchange request */ + ( + WTX_REQUEST, /* WTX request number */ + void * /* pointer to result message */ + ), + STATUS (*xControl) /* perform misccontrol requests on exchange */ + ( + WTX_XID, /* WTX exchange ID */ + UINT32, /* control request number */ + void * /* pointer to control request arg data */ + ), + STATUS (*xSvcAdd) /* add a service to this transport */ + ( + WTX_XID, /* WTX exchange ID */ + WTX_REQUEST, /* service number to add to services table */ + FUNCPTR, /* new service input routine */ + FUNCPTR /* new service output routine */ + ) + ); + +WTX_ERROR_T wtxExchangeErrGet (WTX_XID xid); +STATUS wtxExchangeErrClear (WTX_XID xid); +STATUS wtxExchangeTerminate (WTX_XID xid); + +STATUS wtxExchange (WTX_XID xid, WTX_REQUEST request, void * pIn, void * pOut); +STATUS wtxExchangeFree (WTX_XID xid, WTX_REQUEST request, void * pData); +STATUS wtxExchangeControl (WTX_XID xid, UINT32 ctlRequest, void * pArg); +STATUS wtxExchangeCreate (WTX_XID xid, const char * key, BOOL usePMap); +STATUS wtxExchangeDelete (WTX_XID xid); +STATUS wtxExchangeSvcAdd (WTX_XID xid, WTX_REQUEST request, FUNCPTR fIn, + FUNCPTR fOut); + +extern STATUS wtxExchangeTimeoutSet /* set the exchage timeout value */ + ( + WTX_XID xid, /* transport handle to set timeout of */ + int timeout /* timeout value to be set */ + ); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwtxexchh */ diff --git a/h/wtxmsg.h b/h/wtxmsg.h new file mode 100644 index 0000000..e2c0d8a --- /dev/null +++ b/h/wtxmsg.h @@ -0,0 +1,1818 @@ +/* wtxmsg.h - WTX message definition */ + +/* Copyright 1984-2000 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +04s,24sep04,fle Added WTX_REGISTRY_HEARTBEAT message +04r,25may04,fle Added wtxMsgRegistryHostSet() +04q,05jan04,x_p Fix wtxMsgTargetFileCopy +04p,22apr03,p_b added -cachebypass to wtxMemDisassemble +04o,26mar03,x_p Removed V3_OFFSET +04n,05feb03,p_b merging T2.2 +04m,28jan03,p_b canceled some changes (64 bits) +04l,13dec02,p_b changed TGT_XXX by WTX_TGT_XXX +04k,20nov02,p_b merging margaux/T3 +04j,24jul02,x_p Removed BSD_TARGET for documentation +04i,22jan02,x_p Added WTX_MSG_PD_INFO_SET / GET +04h,27nov01,x_p Added threads +04g,22aug01,x_p Merge from bsdos.temp +04f,25aug00,p_b updated a bad comment. +04e,05jun00,mts Added wtxMsgPdNameGet +04d,26may00,fle changed pUnusedIn into pWtxMsgParam for wtxMsgRegistryConnect +04c,09mar00,p_b added load and run handling facility. +04b,29feb00,fle added message number for WTX_LOG +04a,11feb00,fle changed WTX_MSG_WTXREGD_LOG action from a pointer to a + structure for easier use +03z,01feb00,fle moved HWTX declaration from here to wtxtypes.h +03y,20jan00,dbt Added user service facility headers and structures. +03x,05jan00,fle added wtxMsgInitialize() routine + + removed _wtx structure from here for visibility issues +03w,10dec99,bpn Added wtxMsgKernelPdIdGet() definition. +03v,25nov99,fle doc : fixed expand of WTX_MSG_WTXREGD_LOG +03u,22oct99,fle added WTX_REGISTRY_ENTRY_UPDATE message +03t,21oct99,p_b removed service management structures. Made some clean up. +03s,21oct99,fle added the registryTimeout field in the HWTX structure (for host + side only) +03r,13oct99,c_c Added WTX2 compatibility. +03q,29sep99,fle added WTX_MSG_REG_TGTSVR_ACTION and WTX_MSG_REG_LOG_ACTION + registry new messages +03p,29sep99,c_c Added ModuleFind and SymFind. +03o,14sep99,c_c Added wtxContextCont routine and modified wtxGopherEval. +03n,25aug99,fle added pdId to HWTX structure +03m,16jul99,fle removed wtxMsgObjModuleUndefSymAdd and related variables + + moved HWTX definition from wtxp.h to here +03l,16jul99,c_c Modified WTX_MSG_MEM_MOVE_DESC structure. +03k,09jul99,fle removed references to wtxMsgConsoleKill and + wtxMsgConsoleCreate +03j,08jul99,p_b removed WTX_CONSOLE_XXX. +03i,07jul99,fle removed wtxSymFind since philb changes +03h,06jul99,c_c Added wtx_msg_kill_context struct. +03g,05jul99,p_b Rewritten wtxMsgSymListGet (), wtxMsgSymFind (). +03f,05jul99,c_c Implemented PD context definition. +03e,02jul99,c_c Removed WTX_EVENTPOINT_LIST references. +03d,29jun99,fle added WTX_MSG_DESC_Q message +03c,25jun99,fle added pdIds in all WTX_MSG_MEM related messages +03b,23jun99,c_c changed UINT32 to WTX_TGT_ADDR_T for pdId +03a,04jun99,fle made all the pdIds have the same type +02z,02jun99,fle added WTX_NULLPROC definition +02y,01jun99,fle added declarations of new wtxMsgXxx() routines +02x,18aug98,pcn Moved WTX_SVC_TYPE and renamed WTX_MSG_EVTPT_LIST_GET. +02w,28jul98,lcs Change TOOL_ID field of WTX_EVTPT_INFO structure to a uint32 +02v,20jul98,pcn Added evtptNum and toolId in the wtxEventpointListGet return + list. +02u,19jun98,pcn Added new fields in WTX_MSG_FILE_LOAD_DESC structure. +02t,26may98,pcn Changed WTX_MSG_EVTPT_LIST_2 in WTX_MSG_EVTPT_LIST_GET. +02s,08apr98,fle doc: limit element comment to column 75 for manual generation + purpose +02r,07apr98,fle doc: changed wtx_dasm_desc in wtx_msg_dasm_desc for mangen +02q,24mar98,dbt added WTX_CONTEXT_STATUS_GET. +02p,03mar98,fle got rid of WTX_REGISTRY_PING service +02o,02mar98,pcn WTX 2: added WTX_EVENTPOINT_ADD_2, WTX_EVENTPOINT_LIST_2, + WTX_CACHE_TEXT_UPDATE, WTX_MEM_WIDTH_READ, + WTX_MEM_WIDTH_WRITE, WTX_OBJ_MODULE_CHECKSUM, + WTX_OBJ_MODULE_LOAD_2, WTX_OBJ_MODULE_UNLOAD_2, + WTX_UNREGISTER_FOR_EVENT, WTX_EVENT_LIST_GET, + WTX_COMMAND_SEND. Removed WTX_UN_REGIS_FOR_EVENT. Added + WTX_MSG_MEM_WIDTH_READ_DESC, WTX_MSG_MEM_WIDTH_COPY_DESC, + WTX_SVC_TYPE, WTX_MSG_LOG_CTRL, WTX_EVENT_NODE, + WTX_MSG_EVENT_LIST, WTX_LD_M_FILE_DESC, + WTX_MSG_FILE_LOAD_DESC, WTX_EVENT_2, WTX_EVTPT_2, + WTX_MSG_EVTPT_DESC_2, WTX_MSG_EVTPT_LIST_2. +02n,26jan98,fle added WTX_REGISTRY_PING service number +02m,29aug97,fle Adding the WTX_MEM_DISASSEMBLE service : creating + WTX_MSG_DASM_INST_LIST, WTX_DASM_INST_LIST and + WTX_MSG_DASM_DESC structures. +02l,06dec96,dgp doc: correct spelling +02k,30sep96,elp put in share/, added WTX_OBJ_MODULE_UNDEF_SYM_ADD (SPR# 6775). +02j,17jun96,p_m changed flags type in WTX_MSG_OPEN_DESC (SPR# 4941). +02i,10jun96,elp re-installed WTX_MSG_SYM_TBL_INFO type to prevent + compatibility problems. +02h,20may96,elp added WTX_SYM_TBL_INFO type (SPR# 6502). +02g,25oct95,p_m added WTX_AGENT_MODE_GET service (SPR# 5231) and + WTX_DIRECT_CALL. +02f,17jul95,p_m cleaned comments for manual generation. +02d,06jun95,p_m replaced moduleNameOrId in WTX_MSG_SYM_MATCH_DESC by an union. +02c,01jun95,p_m removed WTX_MSG_CALL_PARAM. added returnType and pReserved + and replaced isText by contextType in WTX_MSG_CONTEXT_DESC. +02b,30may95,p_m completed WTX_MEM_SCAN and WTX_MEM_MOVE implementation. +02a,26may95,p_m added match field in WTX_MSG_MEM_SCAN_DESC. +01z,23may95,p_m made missing name changes. +01y,22may95,jcf name revision. +01x,18may95,p_m added WTX_VIO_CHAN_GET and WTX_VIO_CHAN_RELEASE. + removed DETECTION in enventpoint. +01w,16may95,p_m added WTX_MSG_KILL_DESC and WTX_TARGET_ATTACH. +01v,10may95,pad modified WTX_MSG_SYM_LIST and WTX_MSG_SYM_MATCH_DESC to get + defined or unknown symbols associated with a module. +01u,09may95,p_m added wtxregd related messages. added Target Server version + in WTX_MSG_TS_INFO. +01t,04may95,s_w Put in WTX_xxx message numbers previously in private/wtxp.h +01s,02may95,pad changed WTX_MSG_MODULE_INFO format field from UINT32 to char * +01r,04apr95,p_m fixed WTX_MSG_CONTEXT_DESC.stackBase comment. +01q,29mar95,p_m added comments. removed #include "comtypes.h". + changed addr type in OBJ_SEGMENT to WTX_TGT_ADDR_T. +01p,28mar95,p_m took care of comments line length for manual generation. +01o,24mar95,p_m changed addr type in LD_M_SECTION to WTX_TGT_ADDR_T. +01n,19mar95,c_s updated gopher structures. +01m,20mar95,f_v fix few syntax error to work with mgtools +01l,16mar95,p_m added WTX_MSG_VIO_FILE_LIST. +01k,15mar95,p_m changed #include "vxWorks.h" to #include "host.h". +01j,10mar95,p_m made endian field a UINT32. +01i,03mar95,p_m replaced WRAPSTRING by char *. + added gopher structure for WTX. +01h,27feb95,p_m cleanup up WTX_MSG_MEM_SCAN_DESC. + added symTblId to WTX_MSG_SYM_TBL_INFO. + simplified WTX_WDB_SERVICE_DESC. +01g,25feb95,jcf extended WTX_TS_INFO. converted spaces to tabs. +01f,20feb95,pad added WTX_WTX_SERVICE_DESC type. Modified type + WTX_MSG_SERVICE_DESC. +01e,09feb95,p_m renamed structures for more coherency. + get rid of structures shared with WDB. + added comments and cleanup. +01d,08feb95,p_m added loadFlag in WTX_MODULE_INFO. +01c,30jan95,p_m added additional routines and filenames in SERVICE_DESC. + changed rtnObjFile to svcObjFile in SERVICE_DESC. + added WTX_MEM_XFER; added WTX_MEM_SET_DESC; + added WTX_REG_WRITE; +01b,22jan95,p_m added TOOL_DESC field in WTX_TS_INFO. + replaced #include "wdb/wdbtypes.h" by #include "wdbtypes.h". + replaced rtnName with initRtnName in SERVICE_DESC. +01a,20jan95,p_m written. +*/ + +#ifndef __INCwtxmsgh +#define __INCwtxmsgh + +#ifdef __cplusplus + extern "C" { +#endif + +#ifdef HOST + #include "host.h" +#else + #include "vxWorks.h" +#endif /* HOST */ + +#include "wtxtypes.h" /* basic wtx types */ + +/* WTX requests */ + +/* + * This offset determines if a call was a pre V3 call or not. + * If a call goes to the tgtsvr, and its number is less than the offset value, + * then it will be routed to the backward compat shared lib. + */ + + +#define WTX_NULLPROC (0) +#define WTX_TOOL_ATTACH (1) +#define WTX_TOOL_DETACH (2) +#define WTX_TS_INFO_GET (3) +#define WTX_TARGET_RESET (4) +#define WTX_TS_LOCK (5) +#define WTX_TS_UNLOCK (6) +#define WTX_TARGET_ATTACH (7) + +#define WTX_CONTEXT_CREATE (10) +#define WTX_CONTEXT_KILL (11) +#define WTX_CONTEXT_SUSPEND (12) +#define WTX_CONTEXT_CONT (13) +#define WTX_CONTEXT_RESUME (14) +#define WTX_CONTEXT_STEP (15) +#define WTX_CONTEXT_STATUS_GET (16) +#define WTX_CONTEXT_STOP (17) +#define WTX_CONTEXT_ATTACH (18) +#define WTX_CONTEXT_DETACH (19) + +#define WTX_EVENTPOINT_ADD (20) +#define WTX_EVENTPOINT_DELETE (21) +#define WTX_EVENTPOINT_LIST_GET (22) +#define WTX_EVENTPOINT_LIST (23) + +#define WTX_MEM_CHECKSUM (30) +#define WTX_MEM_READ (31) +#define WTX_MEM_WRITE (32) +#define WTX_MEM_SET (33) +#define WTX_MEM_SCAN (34) +#define WTX_MEM_MOVE (35) +#define WTX_MEM_ALLOC (36) +#define WTX_MEM_FREE (37) +#define WTX_MEM_INFO_GET (38) +#define WTX_MEM_ALIGN (39) +#define WTX_MEM_REALLOC (40) +#define WTX_MEM_ADD_TO_POOL (41) +#define WTX_MEM_DISASSEMBLE (42) +#define WTX_CACHE_TEXT_UPDATE (43) + +#define WTX_REGS_GET (50) +#define WTX_REGS_SET (51) + +#define WTX_OPEN (60) +#define WTX_VIO_READ (61) +#define WTX_VIO_WRITE (62) +#define WTX_CLOSE (63) +#define WTX_VIO_CTL (64) +#define WTX_VIO_FILE_LIST (65) +#define WTX_VIO_CHAN_GET (66) +#define WTX_VIO_CHAN_RELEASE (67) + +#define WTX_OBJ_MODULE_LOAD (70) +#define WTX_OBJ_MODULE_UNLOAD (71) +#define WTX_OBJ_MODULE_LIST (72) +#define WTX_OBJ_MODULE_INFO_GET (73) +#define WTX_OBJ_MODULE_FIND (74) +#define WTX_OBJ_MODULE_CHECKSUM (75) + +#define WTX_SYM_TBL_CREATE (80) +#define WTX_SYM_TBL_DELETE (81) +#define WTX_SYM_TBL_LIST_GET (82) +#define WTX_SYM_LIST_GET (83) +#define WTX_SYM_TBL_INFO_GET (84) +#define WTX_SYM_FIND (85) +#define WTX_SYM_ADD (86) +#define WTX_SYM_REMOVE (87) + +#define WTX_EVENT_GET (100) +#define WTX_REGISTER_FOR_EVENT (101) +#define WTX_UNREGISTER_FOR_EVENT (102) +#define WTX_EVENT_ADD (103) +#define WTX_EVENT_LIST_GET (104) + +#define WTX_GOPHER_EVAL (110) +#define WTX_FUNC_CALL (111) +#define WTX_SERVICE_ADD (112) +#define WTX_WTX_SERVICE_LIST (113) +#define WTX_WDB_SERVICE_LIST (114) +#define WTX_AGENT_MODE_SET (117) +#define WTX_AGENT_MODE_GET (118) +#define WTX_DIRECT_CALL (119) + +#define WTX_OBJ_KILL (120) +#define WTX_OBJ_RESTART (121) +#define WTX_COMMAND_SEND (122) +#define WTX_LOG (123) + +#define WTX_PD_INFO_Q_GET (130) + +#define WTX_TARGET_FILE_COPY (140) +#define WTX_TARGET_FILE_REMOVE (141) + +#define WTX_TGTFS_INODE_CTRL (150) + +#define WTX_PD_TASKS_LIST (160) +#define WTX_PD_INFO_SET (161) +#define WTX_PD_INFO_GET (162) + +#define WTX_REGISTER (201) +#define WTX_UNREGISTER (202) +#define WTX_INFO_GET (203) +#define WTX_INFO_Q_GET (204) +#define WTX_WTXREGD_TGTSVR_ACTION (205) +#define WTX_WTXREGD_LOG (206) +#define WTX_REGISTRY_ENTRY_ADD (207) +#define WTX_REGISTRY_ENTRY_REMOVE (208) +#define WTX_REGISTRY_ENTRY_GET (209) +#define WTX_REGISTRY_ENTRY_LIST_GET (210) +#define WTX_REGISTRY_ENTRY_UPDATE (211) +#define WTX_REGISTRY_HEARTBEAT (212) + +#define WTX_USR_SVC_CTRL (220) +#define WTX_USR_SVC_CALL (221) + +/* typedefs */ + +typedef struct wtx_msg_result /* Simple request result */ + { + WTX_CORE wtxCore; /* WTX message core */ + + WTX_VALUE val; /* Result value of call */ + } WTX_MSG_RESULT; + +typedef struct wtx_msg_param /* Simple request parameter */ + { + WTX_CORE wtxCore; /* WTX message core */ + + WTX_VALUE param; /* Param value of call */ + } WTX_MSG_PARAM; + +typedef struct wtx_msg_param_with_pd /* simple request parameter with PDID */ + { + WTX_CORE wtxCore; /* WTX message core */ + + WTX_VALUE_WITH_PD param; /* parameter with PD ID */ + } WTX_MSG_PARAM_WITH_PD; + +/* -------------------------------- registry -------------------------------- */ + +typedef struct wtx_msg_wtxregd_pattern /* wtxregd pattern */ + { + WTX_CORE wtxCore; /* WTX message core */ + char * name; /* Pattern to match wpwrName */ + char * type; /* Pattern to match wpwrType */ + char * key; /* Pattern to match wpwrKey */ + } WTX_MSG_WTXREGD_PATTERN; + +typedef struct wtx_msg_wtxregd_info /* wtxregd info with host name/IP */ + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_WTXREGD_INFO regdInfo; /* registry info/match desc */ + } WTX_MSG_WTXREGD_INFO; + +typedef struct wtx_msg_wtxregd_item /* registry item desc per name */ + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_WTXREGD_ITEM regdItem; /* exact item short desc (name/IP) */ + } WTX_MSG_WTXREGD_ITEM; + +typedef struct wtx_msg_tgtsvr_action /* target server action desc */ + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_TGTSVR_ACTION * pAction; /* action type to perform */ + } WTX_MSG_TGTSVR_ACTION; + +typedef struct wtx_msg_svr_desc /* Server descriptor message */ + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_SVR_DESC wtxSvrDesc; /* Server Descriptor */ + } WTX_MSG_SVR_DESC; + +typedef struct wtx_msg_svr_desc_q /* Server desc. queue message */ + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_SVR_DESC_Q wtxSvrDescQ; /* Server Descriptor Queue */ + } WTX_MSG_SVR_DESC_Q; + +typedef struct wtx_msg_wtxregd_log /* wtxregd log action */ + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_LOG_ACTION action; /* log action to perform */ + } WTX_MSG_WTXREGD_LOG; + +typedef struct wtx_msg_desc_q + { + WTX_CORE wtxCore; /* wtx message core */ + WTX_DESC_Q * pDescQ; /* wtx desc queue */ + } WTX_MSG_DESC_Q; + +/* --------------------------------- server --------------------------------- */ + +typedef struct wtx_msg_ts_info /* TS information message */ + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_TS_INFO tsInfo; /* TS info structure */ + } WTX_MSG_TS_INFO; + +typedef struct wtx_msg_ts_lock /* Lock message */ + { + WTX_CORE wtxCore; /* WTX message core */ + UINT32 lockType; /* Lock type to use */ + } WTX_MSG_TS_LOCK; + +typedef struct wtx_msg_ts_unlock /* Unlock message */ + { + WTX_CORE wtxCore; /* WTX message core */ + + BOOL32 force; /* Force unlock type to use */ + } WTX_MSG_TS_UNLOCK; + +typedef struct wtx_msg_tool_desc /* Tool desc. message */ + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_TOOL_DESC wtxToolDesc; /* Tool descriptor */ + } WTX_MSG_TOOL_DESC; + +typedef struct wtx_msg_tool_id /* Tool identifier message */ + { + WTX_CORE wtxCore; /* WTX message core */ + } WTX_MSG_TOOL_ID; + +typedef struct wtx_msg_kill_desc /* Kill descriptor message */ + { + WTX_CORE wtxCore; /* WTX message core */ + + UINT32 request; /* Object kill flag */ + WTX_VALUE arg; /* Object kill additional arg */ + } WTX_MSG_KILL_DESC; + +typedef struct wtx_msg_log_ctrl /* Logging control message */ + { + WTX_CORE wtxCore; /* WTX message core */ + + WTX_SVC_TYPE svcDesc; /* Service type and action */ + WTX_VALUE svcParam; /* Parameter needed */ + int svcValue; /* Extra parameter */ + } WTX_MSG_LOG_CTRL; + +/* --------------------------- symbol operations ---------------------------- */ + +typedef struct wtx_msg_symbol_desc /* Symbol message */ + { + WTX_CORE wtxCore; /* WTX message core */ + + WTX_SYMBOL symbol; /* Symbol */ + } WTX_MSG_SYMBOL_DESC; + +typedef struct wtx_msg_sym_list /* Symbol list message */ + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_TGT_ID_T pdId; /* Prot. Dom Id */ + + WTX_SYM_LIST symList; /* Symbol list */ + BOOL32 moreToCome; /* TRUE if symbols are remaining */ + } WTX_MSG_SYM_LIST; + +typedef struct wtx_msg_sym_tbl_info /* Symbol table information */ + { + WTX_CORE wtxCore; /* WTX message core */ + + WTX_TGT_ID_T symTblId; /* Symbol table identifier */ + UINT32 symNum; /* Number of symbols */ + BOOL32 sameNameOk; /* Name clash policy */ + } WTX_MSG_SYM_TBL_INFO; + +typedef struct wtx_msg_sym_match_desc /* Symbol lookup descriptor */ + { + WTX_CORE wtxCore; /* WTX message core */ + + WTX_SYM_FIND_CRITERIA criteria; /* criteria struct */ + BOOL32 giveMeNext; /* TRUE for a follow-up req */ + } WTX_MSG_SYM_MATCH_DESC; + +/* --------------------------- VIO operations ------------------------------- */ + +typedef struct wtx_msg_open_desc /* File opening descriptor */ + { + WTX_CORE wtxCore; /* WTX message core */ + + char * filename; /* Filename */ + WTX_OPEN_FLAG flags; /* Unix style open flags */ + INT32 mode; /* Unix style mode */ + INT32 channel; /* Channel id for redirection */ + } WTX_MSG_OPEN_DESC; + +typedef struct wtx_msg_vio_ctl_desc /* VIO control descriptor */ + { + WTX_CORE wtxCore; /* WTX message core */ + + INT32 channel; /* VIO channel number */ + UINT32 request; /* Control operation */ + UINT32 arg; /* Control argument */ + } WTX_MSG_VIO_CTL_DESC; + +typedef struct wtx_msg_vio_copy_desc /* Virtual I/O data */ + { + WTX_CORE wtxCore; /* WTX message core */ + + UINT32 channel; /* Virtual I/O channel */ + UINT32 maxBytes; /* Maximum bytes to transfer */ + void * baseAddr; /* Base address of data */ + } WTX_MSG_VIO_COPY_DESC; + +typedef struct wtx_msg_vio_file_list /* VIO files list message */ + { + WTX_CORE wtxCore; /* WTX message core */ + + WTX_VIO_FILE_DESC * pVioFileList; /* VIO file list */ + } WTX_MSG_VIO_FILE_LIST; + +/* ------------------------- Target Disk operation ---------------------------*/ + +typedef struct wtx_msg_target_file_copy_desc + { + WTX_CORE wtxCore; /* WTX message core */ + char * srcPathname; /* Host source Pathname */ + char * dstPathname; /* Target destination Pathname */ + UINT32 options; /* load options. Any combination of: + * - WTX_TARGET_FILE_COPY_NOMKDIR + * - WTX_TARGET_FILE_COPY_CHECK + */ + } WTX_MSG_TARGET_FILE_COPY_DESC; + +typedef struct wtx_msg_target_file_remove_desc + { + WTX_CORE wtxCore; /* WTX message core */ + char * fileName; /* Target file to erase */ + UINT32 options; /* load options. Any combination of: + * - WTX_TARGET_FILE_REMOVE_FORCE + */ + } WTX_MSG_TARGET_FILE_REMOVE_DESC; + +/* ------------------------- load operation ----------------------------------*/ + +typedef struct wtx_msg_file_load_desc /* Object module load desc. */ + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_TGT_ID_T pdId; /* Prot. Dom. Id in which we load */ + UINT32 loadOpt; /* load options. Any combination of: + * - WTX_LOAD_ASYNCHRONOUSLY + * - WTX_LOAD_FROM_TOOL + */ + WTX_LOAD_COMMAND loadCmd; /* load subcommand */ + union wtx_load_subcommand + { + WTX_MODULE_FILE_DESC moduleDesc; /* module descriptor */ + WTX_UPLOAD_BUF loadBuffer; /* upload buffer */ + WTX_LOAD_PROGRESS_INFO progressInfo; /* async load progress infos */ + WTX_MODULE_INFO moduleInfo; /* module info when loaded */ + } wtxLoadCmdInfo; + } WTX_MSG_FILE_LOAD_DESC; + +/* ------------------------- module operation --------------------------------*/ + +typedef struct wtx_msg_module_list /* Object module list */ + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_TGT_ID_T pdId; /* owning Prot. Dom. */ + + WTX_MODULE_LIST moduleList; /* Module list struct */ + } WTX_MSG_MODULE_LIST; + +typedef struct wtx_msg_module_info /* Object module information */ + { + WTX_CORE wtxCore; /* WTX message core */ + + WTX_MODULE_INFO moduleInfo; /* object module information */ + } WTX_MSG_MODULE_INFO; + +typedef struct wtx_msg_mod_name_or_id /* Module name or identifier */ + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_TGT_ID_T pdId; /* Prot. Dom. Id in which we look */ + + WTX_TGT_ID_T moduleId; /* Module Id */ + char * filename; /* Module file name */ + UINT32 option; /* option field to carry misc info */ + } WTX_MSG_MOD_NAME_OR_ID; + +typedef struct wtx_msg_mod_match_desc /* Symbol lookup descriptor */ + { + WTX_CORE wtxCore; /* WTX message core */ + + WTX_MOD_FIND_CRITERIA criteria; /* criteria struct */ + } WTX_MSG_MOD_MATCH_DESC; + +/* -------------------------- event operation --------------------------------*/ + +typedef struct wtx_msg_event_desc /* Event message */ + { + WTX_CORE wtxCore; /* WTX message core */ + + WTX_EVENT_DESC eventDesc; /* Event descriptor */ + } WTX_MSG_EVENT_DESC; + +typedef struct wtx_msg_event_reg_desc /* WTX event register desc. */ + { + WTX_CORE wtxCore; /* WTX message core */ + + char * evtRegExp; /* Register event reg. expr. */ + } WTX_MSG_EVENT_REG_DESC; + +typedef struct wtx_msg_evtpt_desc /* Eventpoint message */ + { + WTX_CORE wtxCore; /* WTX message core */ + + WTX_EVTPT wtxEvtpt; /* Eventpoint */ + } WTX_MSG_EVTPT_DESC; + +typedef struct wtx_msg_event_list /* Message for all events */ + { + WTX_CORE wtxCore; /* WTX message core */ + + WTX_EVENT_NODE * pEventList; /* List of events */ + } WTX_MSG_EVENT_LIST; + +typedef struct wtx_msg_evtpt_list /* Eventpoint list message */ + { + WTX_CORE wtxCore; /* WTX message core */ + + UINT32 nEvtpt; /* Num. eventpoint in list */ + WTX_EVTPT_INFO * pEvtptInfo; /* Eventpoint info list */ + } WTX_MSG_EVTPT_LIST; + +/* -------------------------- memory operations ------------------------------*/ + +typedef struct wtx_msg_mem_info /* Memory information */ + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_MEM_INFO wtxMemInfo; /* memory information */ + } WTX_MSG_MEM_INFO; + +typedef struct wtx_msg_mem_xfer_desc /* Memory transfer message */ + { + WTX_CORE wtxCore; /* WTX message core */ + + WTX_MEM_XFER memXfer; /* Mem. transfer desc. */ + } WTX_MSG_MEM_XFER_DESC; + +typedef struct wtx_msg_reg_write /* Register(s) to set */ + { + WTX_CORE wtxCore; /* WTX message core */ + + WTX_REG_SET_TYPE regSetType; /* Type of register set */ + WTX_CONTEXT context; /* Associated context */ + WTX_MEM_XFER memXfer; /* New value of register(s) */ + } WTX_MSG_REG_WRITE; + +typedef struct wtx_msg_reg_read /* Register(s) to get */ + { + WTX_CORE wtxCore; /* WTX message core */ + + WTX_REG_SET_TYPE regSetType; /* Type of register set */ + WTX_CONTEXT context; /* Associated context */ + WTX_MEM_REGION memRegion; /* Register block subregion */ + } WTX_MSG_REG_READ; + +typedef struct wtx_msg_mem_block_desc /* Target memory block */ + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_TGT_ID_T pdId; /* Prot. Dom from which we want to */ + + WTX_TGT_ADDR_T startAddr; /* Blocks starts from here */ + UINT32 numBytes; /* Number of bytes in block */ + } WTX_MSG_MEM_BLOCK_DESC; + +typedef struct wtx_msg_mem_scan_desc /* Target memory scan desc. */ + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_TGT_ID_T pdId; /* Protection Domain ID to look into */ + + BOOL32 match; /* TRUE for matching pattern */ + WTX_TGT_ADDR_T startAddr; /* Start addr. for scanning */ + WTX_TGT_ADDR_T endAddr; /* End addr. for scanning */ + UINT32 numBytes; /* Number of bytes in pattern */ + void * pattern; /* Byte pattern to look for */ + } WTX_MSG_MEM_SCAN_DESC; + +typedef struct wtx_msg_mem_move_desc /* Target memory move desc. */ + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_TGT_ID_T srcPdId; /* source Protection Domain */ + WTX_TGT_ADDR_T source; /* Copy from here */ + WTX_TGT_ID_T dstPdId; /* destination Protection Domain */ + WTX_TGT_ADDR_T destination; /* To there */ + UINT32 numBytes; /* Number of bytes to copy */ + } WTX_MSG_MEM_MOVE_DESC; + +typedef struct wtx_msg_mem_set_desc /* Memory setting desc. */ + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_TGT_ID_T pdId; /* PD ID to look into */ + + UINT32 value; /* Value to set */ + UINT8 width; /* Value width 1, 2, 4 or 8 bytes */ + WTX_TGT_ADDR_T startAddr; /* Set from here */ + UINT32 numItems; /* Number of items to set */ + } WTX_MSG_MEM_SET_DESC; + +typedef struct wtx_msg_mem_copy_desc /* Target memory copy desc. */ + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_TGT_ID_T pdId; /* PD ID to look into */ + + BOOL32 hostToTgt; /* it is a host to target mem copy */ + UINT32 hostAddr; /* host memory address */ + WTX_TGT_ADDR_T tgtAddr; /* target memory address */ + UINT32 numBytes; /* Bytes to copy/bytes copied */ + UINT8 width; /* Value width 1, 2, 4 or 8 bytes */ + UINT32 options; /* memory operations options */ + } WTX_MSG_MEM_COPY_DESC; + +/* -------------------------- context operations -----------------------------*/ + +typedef struct wtx_msg_context /* Context message */ + { + WTX_CORE wtxCore; /* WTX message core */ + + WTX_CONTEXT_TYPE contextType; /* Type of context */ + WTX_CONTEXT_ID_T contextId; /* Context ID */ + WTX_CONTEXT_ID_T contextSubId; /* context Sub ID */ + } WTX_MSG_CONTEXT; + +typedef struct wtx_msg_kill_context /* kill context desc. */ + { + WTX_CORE wtxCore; /* WTX message core */ + + WTX_KILL_CONTEXT wtxKillContext; /* Context to kill */ + } WTX_MSG_KILL_CONTEXT; + +typedef struct wtx_msg_context_desc /* Context creation desc. */ + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_CONTEXT_DESC wtxContextDesc; /* WTX context description */ + } WTX_MSG_CONTEXT_DESC; + +typedef struct wtx_msg_context_step_desc /* Single step desc. */ + { + WTX_CORE wtxCore; /* WTX message core */ + + WTX_CONTEXT context; /* Context to step */ + WTX_TGT_ADDR_T startAddr; /* Lower bound of step range */ + WTX_TGT_ADDR_T endAddr; /* Upper bound of step range */ + } WTX_MSG_CONTEXT_STEP_DESC; + +/* -------------------------- gopher operations ------------------------------*/ + +typedef struct wtx_msg_gopher_tape /* Gopher tape message */ + { + WTX_CORE wtxCore; /* WTX message core */ + + WTX_GOPHER_TAPE tape; /* Gopher tape */ + } WTX_MSG_GOPHER_TAPE; + +/* -------------------------- disassembler operations ----------------------- */ + +typedef struct wtx_msg_dasm_desc /* Instructions desc. to match */ + { + WTX_CORE wtxCore; /* WTX message core */ + + WTX_TGT_ID_T pdId; /* PD in which we want to work */ + WTX_TGT_ADDR_T startAddr; /* Disassembling start address */ + WTX_TGT_ADDR_T endAddr; /* Disassembling end address */ + UINT32 nInst; /* Number of instructions to get */ + BOOL32 printAddr; /* Prepends instruction address */ + BOOL32 printOpcodes; /* Prepends instruction opcodes */ + BOOL32 giveMeNext; /* TRUE for a follow-up req */ + BOOL32 hexAddr; /* Turn off "symbolic + offset" */ + BOOL32 cacheByPass; /* bypass cache ? */ + } WTX_MSG_DASM_DESC; + +typedef struct wtx_msg_dasm_inst_list /* Instructions list message */ + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_TGT_ID_T pdId; /* Protection Domain ID to look into */ + + WTX_DASM_INST_LIST instList; /* Symbol list */ + BOOL32 moreToCome; /* TRUE if instructions remain */ + } WTX_MSG_DASM_INST_LIST; + +/* ---------------------- Protection domain operations ---------------------- */ + +typedef struct wtx_msg_pd_desc_q + { + WTX_CORE wtxCore; /* WTX message core */ + + WTX_PD_DESC_Q wtxPdDescQ; /* WTX protection domain queue */ + } WTX_MSG_PD_DESC_Q; + +typedef struct wtx_msg_pd_info_set_desc + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_TGT_ID_T pdId; /* Protection Domain ID to set option */ + WTX_PD_INFO_OPT options; /* Options */ + } WTX_MSG_PD_INFO_SET_DESC; + +typedef struct wtx_msg_pd_info_get_desc + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_TGT_ID_T pdId; /* Protection Domain ID to set option */ + } WTX_MSG_PD_INFO_GET_DESC; + +/* ---------------------- User service operations --------------------------- */ + +typedef struct wtx_msg_usr_svc_ctrl_info /* user service control information */ + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_TGT_INT_T numInts; /* depends on opcode */ + WTX_TGT_ID_T svcId; /* command Id */ + WTX_USR_SVC_CTRL_CMD opcode; /* operation to perform */ + union + { + WTX_USR_SVC_ADD_INFO add; /* specific params to add a service */ + WTX_USR_SVC_REM_INFO rem; /* specific params to remove a service */ + WTX_USR_SVC_FIND_INFO find; /* specific params to find a service */ + } extra; + } WTX_MSG_USR_SVC_CTRL_INFO; + +/* ---------------------- Target filesystem IO --------------------------- */ + +typedef struct wtx_msg_tgtfs_inode_ctrl_info /* I-node operations */ + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_TGTFS_INODE_CTRL_CMD opcode; /* operation to perform */ + WTX_TGTFS_INODE_CTRL_OPT options; /* options */ + union + { + WTX_MSG_TGTFS_INODE_MKDIR_DESC mkdir; /* mkdir */ + WTX_MSG_TGTFS_INODE_RMDIR_DESC rmdir; /* rmdir */ + WTX_MSG_TGTFS_INODE_MV_DESC mv; /* mv */ + WTX_MSG_TGTFS_INODE_RM_DESC rm; /* rm */ + WTX_MSG_TGTFS_INODE_LINK_DESC link; /* link */ + WTX_MSG_TGTFS_INODE_LINK_DESC symlink; /* symlink */ + WTX_MSG_TGTFS_INODE_CP_DESC cp; /* cp */ + WTX_MSG_TGTFS_INODE_MKNOD_DESC mknod; /* mknod */ + WTX_MSG_TGTFS_INODE_READDIR_DESC readdir; /* readdir */ + WTX_MSG_TGTFS_INODE_SETDIR_DESC setdir; /* setdir */ + WTX_MSG_TGTFS_INODE_STAT_DESC stats; /* stat */ + WTX_MSG_TGTFS_INODE_CHMOD_DESC chmod; /* chmod */ + WTX_MSG_TGTFS_INODE_CHOWN_DESC chown; /* chown */ + WTX_MSG_TGTFS_INODE_UMASK_DESC umask; /* umask */ + WTX_MSG_TGTFS_INODE_READLINK_DESC readlink; /* readlink */ + } params; + } WTX_MSG_TGTFS_INODE_CTRL_INFO; + +typedef struct wtx_msg_tgtfs_inode_ctrl_result /* Simple request result */ + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_TGTFS_INODE_CTRL_CMD opcode; /* operation to perform */ + WTX_VALUE val; /* Result value of call */ + union + { + WTX_TGTFS_INODE_READDIR_LIST readdir; /* readdir element list */ + WTX_TGTFS_INODE_STAT_RES * pStat; /* stat result */ + } extras; + } WTX_MSG_TGTFS_INODE_CTRL_RESULT; + +/* ---------------------- Theads (PD/TASKS) --------------------------------- */ +typedef struct wtx_msg_tasks_info_desc + { + WTX_CORE wtxCore; /* WTX message core */ + WTX_TASKS_INFO_DESC res; /* Result */ + } WTX_MSG_TASKS_INFO_DESC; + +/* ----------------------- End of messages definition ----------------------- */ + +/* forward declarations */ + +extern WTX_TGT_ID_T wtxMsgKernelPdIdGet + ( + HWTX hWtx /* wtx API handler */ + ); + +extern STATUS wtxMsgAgentModeGet + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_TOOL_ID * pWtxMsgToolId, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgAgentModeSet + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_PARAM * pWtxMsgParam, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgCacheTextUpdate + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_MEM_BLOCK_DESC * pWtxMsgMemBlockDesc, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgClose + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_PARAM * pWtxMsgParam, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgCommandSend + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_PARAM * pWtxMsgParam, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgContextStop + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_CONTEXT * pWtxMsgContext, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgContextCont + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_CONTEXT * pWtxMsgContext, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgContextCreate + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_CONTEXT_DESC * pWtxMsgContextDesc, /* Input msg. desc. */ + WTX_MSG_CONTEXT * pWtxMsgContext /* Output msg. result */ + ); + +extern STATUS wtxMsgContextKill + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_KILL_CONTEXT * pWtxMsgContext, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgContextResume + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_CONTEXT * pWtxMsgContext, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgContextStatusGet + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_CONTEXT * pWtxMsgContext, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgContextStep + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_CONTEXT_STEP_DESC * pWtxMsgContextStepDesc, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgContextSuspend + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_CONTEXT * pWtxMsgContext, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgDirectCall + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_CONTEXT_DESC * pWtxMsgContextDesc, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgErrDispatch /* dispatch error for given handle */ + ( + HWTX hWtx, /* WTX API handler */ + WTX_ERROR_T errCode, /* error code pointer */ + void * pUnused /* unused yet */ + ); + +extern STATUS wtxMsgEventpointAdd + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_EVTPT_DESC * pWtxMsgEvtptDesc, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgEventpointDelete + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_PARAM * pWtxMsgParam, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgEventpointListGet + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_TOOL_ID * pWtxMsgToolId, /* Input msg. desc. */ + WTX_MSG_EVTPT_LIST * pWtxMsgEvtptList /* Output msg. result */ + ); + +extern STATUS wtxMsgEventAdd + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_EVENT_DESC * pWtxMsgEventDesc, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgEventGet + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_TOOL_ID * pWtxMsgToolId, /* Input msg. desc. */ + WTX_MSG_EVENT_DESC * pWtxMsgEventDesc /* Output msg. result */ + ); + +extern STATUS wtxMsgEventListGet + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_PARAM * pWtxMsgParam, /* Input msg. desc. */ + WTX_MSG_EVENT_LIST * pWtxMsgEventList /* Output msg. result */ + ); + +extern STATUS wtxMsgExchangeControl /* sends a CTL event to exch */ + ( + HWTX hWtx, /* WTX API handle */ + WTX_EXCHANGE_DESC * pExchangeDescIn, /* description of ctl to send */ + WTX_EXCHANGE_DESC * pExchangeDescOut /* result of ctl action */ + ); + +extern STATUS wtxMsgFreeAdd + ( + HWTX hWtx, /* wtx session handler */ + void * pToFree, /* pointer to be freed */ + FUNCPTR pFreeRtn, /* routine to use to free pToFree */ + void * pMsgToFree, /* message to free if needed */ + WTX_REQUEST svcNum /* service num to free if needed */ + ); + +extern STATUS wtxMsgFreeListSearch /* searches for pointer in free list */ + ( + HWTX hWtx, /* wtx session handler */ + void * pToFind, /* pointer to find in list */ + void * pUnused /* unused pointer */ + ); + +extern STATUS wtxMsgFreeListUpdate /* updates a free node in list */ + ( + HWTX hWtx, /* wtx session handler */ + WTX_FREE_DESC * pWtxFreeDesc, /* description of pointer to free */ + void * pUnused /* unused pointer */ + ); + +extern STATUS wtxMsgFuncCall + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_CONTEXT_DESC * pWtxMsgContextDesc, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgGopherEval + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_PARAM_WITH_PD * pWtxMsgParam, /* Input msg. desc. */ + WTX_MSG_GOPHER_TAPE * pWtxMsgGopherTape /* Output msg. result */ + ); + +extern STATUS wtxMsgInitialize /* initialize a WTX handle for a new session */ + ( + HWTX * phWtx /* WTX handle pointer to initialise */ + ); + +extern STATUS wtxMsgInfoGet + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_PARAM * pWtxMsgParam, /* Input msg. desc. */ + WTX_MSG_SVR_DESC * pWtxMsgSvrDesc /* Output msg. result */ + ); + +extern STATUS wtxMsgMemAddToPool + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_MEM_BLOCK_DESC * pWtxMsgMemBlockDesc, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgMemAlign + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_MEM_BLOCK_DESC * pWtxMsgMemBlockDesc, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgMemAlloc + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_PARAM_WITH_PD * pWtxMsgParamWithPD, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgMemChecksum + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_MEM_SET_DESC * pWtxMsgMemSetDesc, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgMemDisassemble + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_DASM_DESC * pWtxMsgDasmDesc, /* Input msg. desc. */ + WTX_MSG_DASM_INST_LIST * pWtxMsgDasmInstList /* Output msg. result */ + ); + +extern STATUS wtxMsgMemFree + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_PARAM_WITH_PD * pWtxMsgParamWithPD, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgMemInfoGet + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_PARAM * pWtxMsgParam, /* Input msg. desc. */ + WTX_MSG_MEM_INFO * pWtxMsgMemInfo /* Output msg. result */ + ); + +extern STATUS wtxMsgMemMove + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_MEM_MOVE_DESC * pWtxMsgMemMoveDesc, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgMemRealloc + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_MEM_BLOCK_DESC * pWtxMsgMemBlockDesc, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgMemScan + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_MEM_SCAN_DESC * pWtxMsgMemScanDesc, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgMemSet + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_MEM_SET_DESC * pWtxMsgMemSetDesc, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgMemRead + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_MEM_COPY_DESC * pWtxMsgMemCopyDescIn, /* Input msg. desc. */ + WTX_MSG_MEM_COPY_DESC * pWtxMsgMemCopyDescOut /* Output msg. res. */ + ); + +extern STATUS wtxMsgMemWrite + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_MEM_COPY_DESC * pWtxMsgMemCopyDesc, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. res. */ + ); + +extern STATUS wtxMsgNullProc + ( + HWTX hWtx, /* WTX API handler */ + WTX_SVR_TYPE * pWtxSvrType, /* Input msg. desc. */ + void * pVoidOut /* Output msg. result */ + ); + +extern STATUS wtxMsgPdInfoQGet + ( + HWTX hWtx, /* WTX session handler */ + WTX_MSG_PARAM * pWtxMsgParam, /* unused (valid) pointer */ + WTX_MSG_PD_DESC_Q * pWtxMsgPdDescQ /* list of protection domains */ + ); + +extern STATUS wtxMsgObjKill + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_KILL_DESC * pWtxMsgKillDesc, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgObjModuleChecksum + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_MOD_MATCH_DESC * pWtxMsgModMatchDesc, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgObjModuleInfoGet + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_MOD_MATCH_DESC * pWtxMsgModMatchDesc, /* Input msg. desc. */ + WTX_MSG_MODULE_INFO * pWtxMsgModuleInfo /* Output msg. result */ + ); + +extern STATUS wtxMsgObjModuleFind + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_MOD_MATCH_DESC * pWtxMsgModMatchDesc, /* Input msg. desc. */ + WTX_MSG_MODULE_LIST * pWtxMsgModuleList /* Output msg. result */ + ); + +extern STATUS wtxMsgObjModuleListGet + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_MOD_MATCH_DESC * pWtxMsgModMatchDesc, /* Input msg. desc. */ + WTX_MSG_MODULE_LIST * pWtxMsgModuleList /* Output msg. result */ + ); + +extern STATUS wtxMsgObjModuleLoad + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_FILE_LOAD_DESC * pWtxMsgFileLoadDescIn, /* Input msg. desc. */ + WTX_MSG_FILE_LOAD_DESC * pWtxMsgFileLoadDescOut /* Output msg. result */ + ); + +extern STATUS wtxMsgObjModuleUnload + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_MOD_NAME_OR_ID * pWtxMsgModNameOrId, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgOpen + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_OPEN_DESC * pWtxMsgOpenDesc, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgRegisterForEvent + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_EVENT_REG_DESC * pWtxMsgEventRegDesc, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgRegistryConnect /* setting up registry exchange */ + ( + HWTX hWtx, /* handle to connect to registry */ + WTX_MSG_PARAM * pWtxMsgParam, /* Input message desc */ + void * pUnusedOut /* output pointer, not used yet */ + ); + +extern void wtxMsgRegistryDisconnect /* closing registry exchange */ + ( + HWTX hWtx, /* handle to disconnect registry */ + void * pUnusedIn, /* input message pointer (not used) */ + void * pUnusedOut /* output message pointer (not used) */ + ); + +extern STATUS wtxMsgRegsGet + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_REG_READ * pWtxMsgRegRead, /* Input msg. desc. */ + WTX_MSG_MEM_XFER_DESC * pWtxMsgMemXferDesc /* Output msg. result */ + ); + +extern STATUS wtxMsgRegsSet + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_REG_WRITE * pWtxMsgRegWrite, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgResultFree + ( + HWTX hWtx, /* WTX API handler */ + void * pToFree, /* pointer to free from list */ + void * pUnused /* unused value yet */ + ); + +extern STATUS wtxMsgSvrDescGet + ( + HWTX hWtx, /* WTX session handler */ + char * serverName, /* target server name to set */ + char * hostName, /* registry host name */ + WTX_DESC * pWtxDesc /* target server full desc */ + ); + +extern STATUS wtxMsgSvrSet + ( + HWTX hWtx, /* current wtx session handle */ + WTX_DESC * pWtxDesc, /* registry item desc */ + void * pUnused /* unused parameter yet */ + ); + +extern STATUS wtxMsgSymAdd + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_SYMBOL_DESC * pWtxMsgSymbolDesc, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgSymFind + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_SYM_MATCH_DESC * pWtxMsgSymMatchDesc, /* Input msg. desc. */ + WTX_MSG_SYM_LIST * pWtxMsgSymList /* Output msg. result */ + ); + +extern STATUS wtxMsgSymListGet + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_SYM_MATCH_DESC * pWtxMsgSymMatchDesc, /* Input msg. desc. */ + WTX_MSG_SYM_LIST * pWtxMsgSymList /* Output msg. result */ + ); + +extern STATUS wtxMsgSymRemove + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_SYMBOL_DESC * pWtxMsgSymbolDesc, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgSymTblInfoGet + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_PARAM * pWtxMsgParam, /* Input msg. desc. */ + WTX_MSG_SYM_TBL_INFO * pWtxMsgSymTblInfo /* Output msg. result */ + ); + +extern STATUS wtxMsgTargetAttach + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_TOOL_ID * pWtxMsgToolId, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgTargetPing + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_TOOL_ID * pWtxMsgToolId, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgTargetReset + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_TOOL_ID * pWtxMsgToolId, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgTerminate + ( + HWTX hWtx, /* WTX API handler */ + void * pUnusedIn, /* unused yet */ + void * pUnusedOut /* unused yet */ + ); + +extern STATUS wtxMsgToolAttach + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_TOOL_DESC * pWtxMsgToolDescIn, /* Input msg. desc. */ + WTX_MSG_TOOL_DESC * pWtxMsgToolDescOut /* Output msg. result */ + ); + +extern STATUS wtxMsgToolCleanup + ( + HWTX hWtx, /* WTX API handler */ + void * pUnusedIn, /* input : unused yet */ + void * pUnusedOut /* output : unused yet */ + ); + +extern STATUS wtxMsgToolDetach + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_TOOL_ID * pWtxMsgToolId, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgTsInfoGet + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_TOOL_ID * pWtxMsgToolId, /* Input msg. desc. */ + WTX_MSG_TS_INFO * pWtxMsgTsInfo /* Output msg. result */ + ); + +extern STATUS wtxMsgTsLock + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_TS_LOCK * pWtxMsgTsLock, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgTsUnlock + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_TS_UNLOCK * pWtxMsgTsUnlock, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgUnregisterForEvent + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_EVENT_REG_DESC * pWtxMsgEventRegDesc, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgVioChanGet + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_TOOL_ID * pWtxMsgToolId, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgVioChanRelease + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_PARAM * pWtxMsgParam, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgVioCtl + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_VIO_CTL_DESC * pWtxMsgVioCtlDesc, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgVioFileListGet + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_TOOL_ID * pWtxMsgToolId, /* Input msg. desc. */ + WTX_MSG_VIO_FILE_LIST * pWtxMsgVioFileList /* Output msg. result */ + ); + +extern STATUS wtxMsgVioRead + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_VIO_COPY_DESC * pWtxMsgVioCopyDescIn, /* Input msg. desc. */ + WTX_MSG_VIO_COPY_DESC * pWtxMsgVioCopyDescOut /* Output msg. result */ + ); + +extern STATUS wtxMsgVioWrite + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_VIO_COPY_DESC * pWtxMsgVioCopyDesc, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgContextAttach + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_CONTEXT * pWtxMsgContext, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgContextDetach + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_CONTEXT * pWtxMsgContext, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +/* ----------------------- registry related routines ------------------------ */ + +extern STATUS wtxMsgInfoGet + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_PARAM * pWtxMsgParam, /* Input msg. desc. */ + WTX_MSG_SVR_DESC * pWtxMsgSvrDesc /* Output msg. result */ + ); + +extern STATUS wtxMsgInfoQGet + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_WTXREGD_PATTERN * pWtxMsgWtxregdPattern, /* Input msg. desc. */ + WTX_MSG_SVR_DESC_Q * pWtxMsgSvrDescQ /* Output msg. result */ + ); + +extern STATUS wtxMsgRegistryEntryGet + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_WTXREGD_ITEM * pWtxMsgWtxregdItem, /* Input msg. desc. */ + WTX_MSG_SVR_DESC * pWtxMsgSvrDesc /* Output msg. result */ + ); + +extern STATUS wtxMsgRegistryEntryListGet + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_WTXREGD_INFO * pMasWtxregdItem, /* Input msg. desc. */ + WTX_MSG_DESC_Q * pWtxMsgDescQ /* Output msg. result */ + ); + +extern STATUS wtxMsgRegistryEntryAdd + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_WTXREGD_INFO * pWtxMsgWtxregInfo, /* Input msg. desc. */ + WTX_MSG_SVR_DESC * pWtxMsgSvrDescOut /* Output msg. result */ + ); + +extern STATUS wtxMsgRegistryEntryUpdate + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_WTXREGD_INFO * pWtxMsgWtxregInfo, /* Input msg. desc. */ + WTX_MSG_SVR_DESC * pWtxMsgSvrDesc /* Output msg. result */ + ); + +extern STATUS wtxMsgRegistryEntryRemove + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_WTXREGD_ITEM * pWtxMsgWtxregdItem, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgRegistryLogAction /* log action request */ + ( + HWTX hWtx, /* session handler */ + WTX_MSG_WTXREGD_LOG * pWtxMsgWtxregdLogIn, /* input parameter */ + WTX_MSG_WTXREGD_LOG * pWtxMsgWtxregdLogOut /* result decription */ + ); + +extern STATUS wtxMsgRegister + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_SVR_DESC * pWtxMsgSvrDescIn, /* Input msg. desc. */ + WTX_MSG_SVR_DESC * pWtxMsgSvrDescOut /* Output msg. result */ + ); + +extern STATUS wtxMsgTgtsvrAction + ( + HWTX hWtx, /* session handler */ + WTX_MSG_TGTSVR_ACTION * pWtxMsgTgtsvrAction, /* input parameter */ + WTX_MSG_RESULT * pWtxMsgResult /* result secription */ + ); + +extern STATUS wtxMsgUnregister + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_PARAM * pWtxMsgParam, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgRegistryHeartbeat + ( + HWTX hWtx, /* WTX API handler */ + WTX_MSG_WTXREGD_ITEM * pWtxMsgWtxregdItem, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +/* ---------------------- WTX message utility routines ---------------------- */ + +extern BOOL wtxMsgIsAttached + ( + HWTX hWtx /* WTX session handler */ + ); + + +extern STATUS wtxMsgAttachFree + ( + HWTX hWtx /* WTX session handler */ + ); + +extern STATUS wtxMsgToolDescSet + ( + HWTX hWtx, /* current WTX session handler */ + WTX_TOOL_DESC * pToolDesc /* value to init WTX tool desc to */ + ); + +extern STATUS wtxMsgToolIdSet + ( + HWTX hWtx, /* current WTX session handler */ + WTX_TGT_ID_T toolId /* new tool Id to set */ + ); + +extern BOOL32 wtxMsgToolConnected + ( + HWTX hWtx /* current WTX session handler */ + ); + +extern STATUS wtxMsgAsyncHandleSet + ( + HWTX hWtx, /* current WTX session handler */ + WTX_ASYNC_HANDLE asyncHAndle /* new async handler to set to */ + ); + +extern STATUS wtxMsgToolIdGet + ( + HWTX hWtx, /* current WTX session handler */ + WTX_MSG_TOOL_ID * pMsgToolId /* returned message tool ID pointer */ + ); + +extern STATUS wtxMsgErrSet + ( + HWTX hWtx, /* current WTX session handler */ + WTX_ERROR_T errCode /* error code to set to */ + ); + +extern WTX_ERROR_T wtxMsgErrGet + ( + HWTX hWtx /* current WTX session handler */ + ); + +extern STATUS wtxMsgErrHandlerGet + ( + HWTX hWtx, /* current WTX session handler */ + WTX_HANDLER_T * pErrHandler /* returned WTX error handler */ + ); + +extern STATUS wtxMsgErrHandlerSet + ( + HWTX hWtx, /* current WTX session handler */ + WTX_HANDLER_T * pErrHandler /* WTX error handler to set to */ + ); + +extern char * wtxMsgErrMsgGet + ( + HWTX hWtx /* current WTX session handler */ + ); + +extern void * wtxMsgClientDataGet + ( + HWTX hWtx /* current WTX session handler */ + ); + +extern STATUS wtxMsgErrMsgSet + ( + HWTX hWtx, /* current WTX session handler */ + const char * errMsg /* error message to set to */ + ); + + +extern STATUS wtxMsgClientDataSet + ( + HWTX hWtx, /* current WTX session handler */ + void ** ppClientData /* client data to set to */ + ); + +extern WTX_TGT_ID_T wtxMsgPdIdGet + ( + HWTX hWtx /* current WTX session handler */ + ); + +extern STATUS wtxMsgPdNameGet + ( + HWTX hWtx, /* current WTX session handler */ + WTX_TGT_ID_T targetPdId, /* the PD ID that we want the name of */ + char ** pdName /* The string to store the PD name result */ + ); + +extern STATUS wtxMsgPdIdSet + ( + HWTX hWtx, /* current WTX session handler */ + WTX_TGT_ID_T pdId /* PD ID to set to */ + ); + +extern WTX_DESC * wtxMsgCurrentSvrDescGet + ( + HWTX hWtx /* current WTX session handler */ + ); + +extern WTX_TS_INFO * wtxMsgCurrentTsInfoGet + ( + HWTX hWtx /* current WTX session handler */ + ); + +extern WTX_TOOL_DESC * wtxMsgCurrentToolDescGet + ( + HWTX hWtx /* current WTX session handler */ + ); + +extern HWTX * wtxMsgSelfGet + ( + HWTX hWtx /* current WTX session handler */ + ); + +extern STATUS wtxMsgVioLinkDescSemTake + ( + HWTX hWtx, /* current WTX session handler */ + int timeout /* semTake wait timeout */ + ); + +extern STATUS wtxMsgVioLinkDescSemGive + ( + HWTX hWtx /* current WTX session handler */ + ); + +extern STATUS wtxMsgVioLinkDescListAdd + ( + HWTX hWtx, /* current WTX session handler */ + NODE * pNode /* node to add to list */ + ); + +extern WTX_TOOL_DESC * wtxMsgToolDescGet + ( + HWTX hWtx /* current WTX session handler */ + ); + +extern BOOL wtxMsgAsyncNotifyIsStarted + ( + HWTX hWtx /* current WTX session handler */ + ); + +extern STATUS wtxMsgAsyncHandleAlloc + ( + HWTX hWtx /* current WTX session handler */ + ); + +extern WTX_ASYNC_HANDLE wtxMsgAsyncHandleGet + ( + HWTX hWtx /* current WTX session handler */ + ); + +extern STATUS wtxMsgAsyncNotifyStart + ( + HWTX hWtx /* current WTX session handler */ + ); + +extern STATUS wtxMsgAsyncNotifyStop + ( + HWTX hWtx /* current WTX session handler */ + ); + +extern STATUS wtxMsgRegistryTimeoutSet + ( + HWTX hWtx, /* current WTX session handler */ + int timeout /* timeout value to set to */ + ); + +extern int wtxMsgRegistryTimeoutGet + ( + HWTX hWtx /* current WTX session handler */ + ); + +extern WTX_DESC * wtxMsgSelfDescGet + ( + HWTX hWtx /* current WTX session handler */ + ); + +extern STATUS wtxMsgSelfDescSet + ( + HWTX hWtx, /* current WTX session handler */ + WTX_DESC * pSelfDesc /* seld desc to set to */ + ); + +extern WTX_TGT_ID_T wtxMsgObjIdGet + ( + HWTX hWtx /* current WTX session handler */ + ); + +extern STATUS wtxMsgUsrSvcCtrl + ( + HWTX hWtx, /* WTX session handle */ + WTX_MSG_USR_SVC_CTRL_INFO * pUsrSvcCtrlInfo, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgUsrSvcCall + ( + HWTX hWtx, /* WTX session handle */ + WTX_MSG_MEM_XFER_DESC * pWtxMsgMemXferInDesc, /* Input msg. desc. */ + WTX_MSG_MEM_XFER_DESC * pWtxMsgMemXferOutDesc /* Output msg. result */ + ); + +STATUS wtxMsgTsLogAction /* action on tsvr log */ + ( + HWTX hWtx, /* session handler */ + WTX_MSG_WTXREGD_LOG * pWtxMsgWtxregdLogIn, /* input parameter */ + WTX_MSG_WTXREGD_LOG * pWtxMsgWtxregdLogOut /* result decription */ + ); + +extern STATUS wtxMsgRegistryHostSet + ( + HWTX hWtx, /* wtx session handle */ + const char * host /* remote registry host name or IP */ + ); + +/* ------------------------ WTX target file routines ------------------------ */ + +extern STATUS wtxMsgTargetFileCopy + ( + HWTX hWtx, /* current session handler */ + WTX_MSG_TARGET_FILE_COPY_DESC * pWtxMsgTargetFileCopyInDesc, + WTX_MSG_RESULT * pWtxMsgTargetFileCopyOutDesc + ); + +extern STATUS wtxMsgTargetFileRemove + ( + HWTX hWtx, /* current session handler */ + WTX_MSG_TARGET_FILE_REMOVE_DESC * pWtxMsgTargetFileRemoveInDesc, + WTX_MSG_RESULT * pUnusedOut /* output ptr, not used yet*/ + ); + +/* --------------------- WTX target filesystem routines --------------------- */ + +extern STATUS wtxMsgTgtfsInodeCtrl + ( + HWTX hWtx, /* current session handler */ + WTX_MSG_TGTFS_INODE_CTRL_INFO * pWtxMsgTgtfsInodeCtrlInfo, + WTX_MSG_TGTFS_INODE_CTRL_RESULT * pResult /* output ptr, not used yet */ + ); + +extern UINT32 wtxMsgOsErrCodeGet + ( + HWTX hWtx /* current WTX session handler */ + ); + +extern STATUS wtxMsgOsErrCodeSet + ( + HWTX hWtx, /* current WTX session handler */ + UINT32 osErrCode /* error code to set to */ + ); + +extern UINT32 wtxMsgWtxVersionGet + ( + HWTX hWtx /* current WTX session handler */ + ); + +extern STATUS wtxMsgWtxVersionSet + ( + HWTX hWtx, /* current WTX session handler */ + UINT32 version /* version to set */ + ); + +/* ---------------------- Threads handling ---------------------------------- */ + +extern STATUS wtxMsgPdTasksListGet + ( + HWTX hWtx, /* current session handler */ + WTX_MSG_CONTEXT * pWtxMsgContext, /* Input msg. desc */ + WTX_MSG_TASKS_INFO_DESC * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgPdInfoSet + ( + HWTX hWtx, /* current session handler */ + WTX_MSG_PD_INFO_SET_DESC * pWtxMsgIn, /* Input msg. desc. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +extern STATUS wtxMsgPdInfoGet + ( + HWTX hWtx, /* current session handler */ + WTX_MSG_PD_INFO_GET_DESC * pWtxMsgIn, /* Input msg. */ + WTX_MSG_RESULT * pWtxMsgResult /* Output msg. result */ + ); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwtxmsgh */ diff --git a/h/wtxrpc.h b/h/wtxrpc.h new file mode 100644 index 0000000..e648da2 --- /dev/null +++ b/h/wtxrpc.h @@ -0,0 +1,166 @@ +/* wtxrpc.h - wtx rpc header file */ + +/* Copyright 1984-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01p,26oct04,jeg added remoteServerPing() prototye +01o,01apr03,fle added wtxRpcExchangeSvcAdd() routine +01n,26mar03,x_p Set version to 4 +01m,21nov01,c_c Changedrpc include location. +01l,05jan00,fle added usePMap to wtxRpcExchangeCreate() routine parameters +01k,25oct99,fle added wtxRpcKeyIPListUpdate() routine declaration +01j,11may99,fle changed wtxRpcExchangeFree - removed xid from parameters and + turned it into a WTX_ERROR_T +01i,06apr98,c_c Changed the registry listenning port for the official one. +01h,24mar98,c_c Get rid of portmapper. +01g,30sep96,elp put in share/src/wtx (SPR# 6775). +01f,30may95,c_s added ipAddr to WTX_RPC_SPLIT_KEY. +01e,17may95,s_w update functions to form RPC implementation of exchange + protocol. Key management functions unchanged. +01d,05may95,p_m changed WTX_RPC_PROG to differentiate Beta from SDK release. +01c,04may95,s_w changes to make this the central include file for RPC based + implementation files. Moved in defines of WTX_SVC_BASE, + WTX_FIRST_ADDL_PROC_NUM, typedef of WTX_ID. Added include of + . +01b,26jan95,p_m added UNIX style authentication. +01a,15jan95,p_m written. +*/ + +#ifndef __INCwtxrpch +#define __INCwtxrpch 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#include "wtxexch.h" +#ifdef SUN4_SOLARIS2 +#define PORTMAP /* for backward compatibility */ +#endif +#include "rpc/rpc.h" + +/* defines */ + +#define WTX_RPC_PROG 0x55555551 /* WTX RPC program number */ +#define WTX_RPC_VERSION 4 /* WTX RPC version number */ + +#define WTX_RPC_MAX_VERSION 4 /* Maximum WTX version handled */ + +#define WTX_SVC_BASE 0x22000000 /* base service number */ + +/* "official" registry port number */ + +#define REGISTRY_PORT ((unsigned short)2340) + +/* + * Valid service numbers range between 0 and 500. Standard service have numbers + * 0 to 300. Additionnal services have numbers 301 to 500. + */ + +#define WTX_FIRST_ADDL_PROC_NUM 301 + +/* typedefs */ + +typedef struct wtx_rpc_split_key + { + int progNum; /* rpc program number */ + int version; /* rpc version number */ + int protocol; /* rpc protocol type */ + unsigned short port; /* rpc protocol type */ + char host [32]; /* host where service resides */ + char ** ipAddrList; /* IP addr list in a.b.c.d form */ + } WTX_RPC_SPLIT_KEY; + +/* function declarations */ + + +/* Basic exchange functions */ + +extern STATUS wtxRpcExchangeCreate /* create new exchange clnt using RPC */ + ( + WTX_XID xid, /* Exchange handle */ + const char * key, /* Key for server to connect to */ + BOOL usePMap /* do we use port mapper to connect ? */ + ); + +extern STATUS wtxRpcExchangeDelete /* delete exchange handle */ + ( + WTX_XID xid /* Exchange handle */ + ); + +extern STATUS wtxRpcExchange /* do a WTX call via exchange */ + ( + WTX_XID xid, /* Exchange handle */ + WTX_REQUEST reqId, /* exchange service number */ + void * pIn, /* exchange service in args */ + void * pOut /* exchange service out args */ + ); + +extern WTX_ERROR_T wtxRpcExchangeFree /* free a exchange call result message*/ + ( + WTX_REQUEST reqId, /* service ID to free */ + void * pMsg /* pointer to result message to free */ + ); + +extern STATUS wtxRpcExchangeControl /* perform exchange control functions */ + ( + WTX_XID xid, /* Exchange handle */ + UINT32 request, /* Exchange control request number */ + void * arg /* Pointer to request argument */ + ); + +extern STATUS wtxRpcExchangeSvcAdd /* adds a new service */ + ( + WTX_XID xid, /* exchange handle */ + WTX_REQUEST request, /* request number to add to services */ + FUNCPTR fIn, /* service input function */ + FUNCPTR fOut /* service output functions */ + ); + +extern STATUS wtxRemoteServerPing /* ping the remote server */ + ( + const struct sockaddr_in * pAddr /* address to ping */ + ); + +/* RPC key utilities exported for convenience */ + +extern STATUS wtxRpcKeySplit /* split RPC key string in components */ + ( + const char * rpcKey, /* key to split */ + WTX_RPC_SPLIT_KEY * pSplitKey /* split key */ + ); + +extern STATUS wtxRpcKeySplitFree /* free a splitted RPC key members */ + ( + WTX_RPC_SPLIT_KEY * pRpcSplitKey /* RPC key to free members of */ + ); + +extern STATUS wtxRpcSvcUnregister /* performs svc_unregister using RPC */ + ( + const char * rpcKey /* service key of service to unreg */ + ); + +extern char * wtxRpcKey /* construt an RPC key given params */ + ( + UINT32 progNum, /* rpc prog number, or NULL TBA */ + UINT32 version, /* rpc version number */ + UINT32 protocol, /* IPPROTO_TCP or IPPROTO_UDP */ + void (*dispatch) /* rpc dispatch routine */ + (struct svc_req *, SVCXPRT *), + BOOL register2pmap, /* Register to the local portmapper ? */ + SVCXPRT ** ppNewXprt /* where to return transport */ + ); + +char * wtxRpcKeyIPListUpdate /* update an RPC key address list */ + ( + const char * rpcKeyStr, /* rpc Key string to update with IP */ + int ipNum /* IP address num to set as default */ + ); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwtxrpch */ diff --git a/h/wtxtypes.h b/h/wtxtypes.h new file mode 100644 index 0000000..19d5059 --- /dev/null +++ b/h/wtxtypes.h @@ -0,0 +1,1693 @@ +/* wtxtypes.h - WTX fundamental type definition */ + +/* Copyright 1984-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +06w,11oct04,fle Added WTX_HEARTBEAT_PERIOD definition +06v,30sep04,jeg removed the field added in WTX_TOOL_DESC +06u,16sep04,jeg updated WTX_TOOL_DESC structure to add lastTargetError field. + Added MAX_ERRNO_STR_LEN macro. +06t,03sep04,jeg added WTX_COPROC_INFO_GET relative macros. +06s,21jul04,x_p Symbols types are real bitfields +06r,18jun04,x_p Added addOptions to wtx_process_context_def +06q,07jun04,x_p Added segment descriptor +06p,26apr04,x_p Changed WTX_ACTION_TYPE +06o,14apr04,x_p Changed REG_SET_TYPE to integer +06n,29mar04,fle Added REGD_START_FILTER definition +06m,16mar04,x_p Added cpuVariant / cpuFamilly +06n,26feb04,mil Added SPE support for PPC85XX. +06m,17nov03,p_b expanded WTX_TS_INFO +06l,15apr03,sn Added WTX_DEMANGLER_STYLE_GET_CMD +06k,28aug03,x_p Changed envBuf in ProcessCreate to envc,envv +06j,25jun03,x_p Changed status values for better vxWorks compatibility +06i,29apr03,x_p Changed WTX_SYMBOL_UNDEF to 0x10000000 +06h,11apr03,lcs Add new types required by windsh. Restore symbol types to T2.2 + values. +06g,19feb03,p_b fixed INT64 location in WTX_VALUE_T +06f,18feb03,p_b wtx2 TCL compatibility and merge from T22-latest +06e,17feb03,x_p Avoid warning if MAX_HOST_NAME already defined +06d,14feb03,c_c reinstated coprocessor support. +06c,13feb03,elg Add MAX_HOST_NAME definition. +06b,12feb03,elg Fix compilation errors. +06a,06feb03,p_b fixed PD_ID definition +05z,27jan03,p_b canceled some changes (64 bits) +05y,16dec02,p_b added WTX_TGTINFO_xxx types +05x,13dec02,p_b changed TGT_XXX by WTX_TGT_XXX +05w,20nov02,p_b merging margaux/T3. 64 bits support +05v,25apr02,x_p Handle exceptions and core +05u,27mar02,x_p Added WTX_EVENT_AGENT_MODE_TASK, WTX_EVENT_AGENT_MODE_EXTERN +05t,26mar02,x_p Added WTX_EVENT_CTX_REGS_SET +05s,22mar02,x_p Added WTX_EVENT_CTX_STEP,CONT,STOP +05r,19mar02,x_p Changed NO_PARSE to NO_FILE_PARSING +05q,15mar02,x_p Added env variables for pdCreate, option NO_PARSE +05p,20feb02,x_p Added WTX_EVENT_CTX_DUMP +05o,12feb02,x_p Added size in WTX_SYMBOL +05n,06feb02,x_p Added WTX_SYMBOL_TRAMPOLINE +05m,01feb02,x_p Added option WTX_BREAK_AT_INIT in WTX_PD_INFO_OPT +05l,22jan02,x_p Added WTX_PD_INFO_OPT +05k,27nov01,x_p Added threads list +05j,13nov01,x_p Added new types for threads +05i,30oct01,x_p Changed status values +05h,29oct01,x_p Typo correction +05g,23oct01,x_p Avoid conflit in status +05f,10oct01,x_p Added event CTX_ATTACH/CTX_DETACH +05e,11sep01,x_p Added CONTEXT_RUNNING for BSD +05d,22aug01,x_p Merge from bsdos.temp +05c,18jun01,x_p Changed BSD_TARGET/BSD_TARGET to BSD_TARGET +05b,29mar01,x_p Added READLINK for tgtfs + Added CONTEXT_BSD type +05a,28feb01,x_p Added umask per tool for tgtfs +04z,26feb01,x_p Added WTX_TGTFS_OPT_FOLLOW_LINK option + lstat +04y,20feb01,x_p Added WTX_SYM_FIND_IN_SHLIB type +04x,05feb01,x_p Added new types for target filesystem ios +04w,23jan01,x_p Merge from FCS +04v,22dec00,x_p Added WTX_MODULES_INFO_SYNCHRO +04u,13dec00,x_p Added WTX_TGTSVR_ENV_GET/SET types +04t,28nov00,x_p Added WTX_TARGET_FILE_REMOVE_FORCE flag +04s,28nov00,x_p Added WTX_TARGET_FILE_COPY_NOMKDIR flag +04r,20nov00,x_p Added WTX_SHLIB_ADDR_GET for Linux Targets +04q,18sep00,mts Changed WTX_SYMBOL_UNDEF value from 0 to 0x10000000 +04p,12sep00,c_c Modified wtx_vxworks_info and wtx_rt_info struct. +04o,31aug00,bpn Added WTX_EVENT_PD_INITIALIZED event. +04n,25aug00,p_b added missing WTX_LOAD options. +04m,09aug00,bpn Added pdInitialized field in WTX_TS_INFO structure for the + emulators. +04l,07aug00,mts Added WTX_LOADER_LOAD_MODE_GET_CMD define +04k,28jul00,bpn Removed WTX_LOAD_STRICT_ORDER_LOAD. Added WTX_UNLOAD_FORCE, + WTX_MEM_WRITE_FORCE constants and wtx_load_mode enum type. +04j,19jun00,c_c Updated doc. +04i,16jun00,c_c Added referencing module array in WTX_SYMBOL. +04h,30may00,p_b added VIO_CLOSE_ON_EXIT feature. +04g,04may00,fle fixed WTX_FLAGS values +04f,30mar00,mts Renamed CPU_THUMB in CPU_SIM (small instruction mode) +04e,23mar00,mts Added CPU_THUMB +04d,10mar00,c_c Added new fields to allow support load and run and C++. +04c,10mar00,elg Modify WTX_RT_INFO. +04b,25feb00,fle moved WTXREGD_TGTSVR_ARGS from wtxregd.c to here in + WTX_TGTSVR_ARGS for the wtxMsg layer to be able to start a + target server +04a,23feb00,bpn Added linkPath and pdAttachTo fields in WTX_PD_DESC structure. + Added WTX_EVENT_CTX_UPDATE. +03z,23feb00,p_b Added WTX2.0 out of order load compatibility. +03y,10feb00,fle added a host field to the WTX_LOG_ACTION +03x,01feb00,bpn Added WTX_EVENT_TGT_RECOVERED. +03w,01feb00,fle made pFunc parameter of wtxAsyncNotifyEnable() be a + WTX_EVENT_HANDLER rather than a FUNCPTR +03v,20jan00,dbt Added user service facility. +03u,13jan00,bpn Added WTX_EVENT_TGT_LOST and WTX_EVENT_TS_POSTMORTEM. +03t,20dec99,wkn Added WTX_SYMBOL_SECTION +03s,14dec99,p_b changed wtx_pd_context_desc in wtx_pd_context_def. + fixed typos & expanded many comments for DOC clarification. +03r,13dec99,mts Added new LOAD and SYMBOL enum +03q,25nov99,fle implemented registry log facility +03p,23nov99,elg Add float support in WDB_FUNC_CALL. +03o,19nov99,c_c Added WTX_MEM_CACHE_BYPASS define. +03n,12nov99,kk update PD options +03m,28oct99,dbt Added support for trigger eventpoints. +03l,27oct99,fle added new WTX PD types since new PD types values in pdLib.h +03k,25oct99,c_s fix dubious enum syntax +03j,21oct99,p_b removed service management structures. + added WTX_SYM_FIND_IN_ALL_PD. +03i,21oct99,fle added definition of WTX_CONNECTION_TIMEOUT value. +03h,29sep99,fle added the WTX_TGTSVR_ACTION_TYPE and WTX_REG_LOG_ACTION_TYPE + new type for registry +03g,29sep99,c_c Added SYMBOL_PENDING symbol type. +o3f,25aug99,p_b added WTX_SYM_FIND_BY_EXACT_VALUE. +03e,19aug99,fle added nElSymbols to the WTX_SYM_FIND_CRITERIA structure +03d,27jul99,p_b added WTX_SYMBOL_XXX. +03c,23jul99,fle changed the PD_ID in WTX_TOOL_DESC into a WTX_TGT_ADDR_T +03b,23jul99,p_b added comments. +03a,22jul99,fle made WTX_MOD_FIND_CRITERIA pdId a WTX_TGT_ADDR_T +02z,20jul99,fle made vmutex include in HOST define +02y,16jul99,fle moved part of the old wtxp.h in here +02x,09jul99,fle added WTX_SYMBOL_TYPE enum + + moved N_DASM_INST_DEFAULT from wtx.h to here + + defined WTX_PROT_VERSION for xdrs +02w,08jul99,p_b Added WTX_VIO_LINK_CMD, WTX_VIO_UNLINK_CMD, WTX_SOCKET, + WTX_TOOL_NUM_GET_CMD, WTX_VIO_LINK_DESC. +02v,07jul99,p_b added WTX_SYM_UNDF, WTX_MODULE, WTX_MODULE_LIST. +02u,07jul99,fle renamed WTX_PD_FLAGS into WTX_PD_TYPE +02t,06jul99,c_c Added wtx_kill_context struct. +02s,30jun99,p_b Added WTX_MOD_FIND_CRITERIA struct. +02r,29jun99,p_b Added WTX_SYM_FIND_CRITERIA struct. +02t,05jul99,c_c Implemented PD context definition. +02s,02jul99,c_c Changed some WTX_LOAD_COMMAND values. +02r,29jun99,fle added WTX_PD_DESC and WTX_PD_DESC_Q definitions + + added WTX_PD_FLAGS enum +02q,28jun99,fle added wtxMsgExchangeControl() related types +02p,23jun99,c_c changed UINT32 to WTX_TGT_ADDR_T for pdId +02o,22jun99,c_c Added lastError in TOOL_DESC struct. +02n,14jun99,fle added WTX_VALUE_WITH_PD type to transfer values with a PD ID +02m,07jun99,c_c Added a PD_ID in the TOOL_DESC structure. +02l,02jun99,c_c some ptr implementation. +02k,23feb99,c_c Implemented an API to get the target IP address (SPR #25044). +02j,29jan99,dbt doc: indicate which elements of WTX_CONTEXT_TYPE are + implemented. +02i,12jan99,dbt indicated that WTX_ACTION_STOP_ALL is not implemented (SPR + #22081). +02h,18sep98,pcn Implement wtxObjModuleInfoAndPathGet. +02g,04sep98,pcn Added WTX_EVENT_EVTPT_ADDED, WTX_EVENT_EVTPT_DELETED. +02f,18aug98,pcn Add WTX_SVC_TYPE description. +02e,19jun98,pcn Added new flags for the asynchronous load. +02d,16jun98,pcn Changed separator character from "_" to " ". +02c,24apr98,pcn Changed WTX_ASYNC_HEADER_SIZE. +02b,03apr98,pcn WTX 2: added WTX_EVENT_TS_KILLED used by the asynchronous + notification. +02a,24mar98,dbt added WTX context status type. +01z,17mar98,pcn WTX 2: changed WTX_ALL_MODULE_CHECK, MTU. Removed new event + types. +01y,12mar98,pcn WTX 2: added new wtx_event_type. +01x,02mar98,pcn WTX 2: defined strings for WTX_COMMAND_SEND, + WTX_OBJ_MODULE_CHECKSUM, OBJ_MODULE_LOAD_2, WTX_ASYNC_NOTIFY. + Changed WTX_EVENT_BREAKPOINT in WTX_EVENT_HW_BP. +01w,29aug97,fle Adding WTX_MAX_DASM_INST_CNT constant. +01v,31dec96,dgp doc: more spelling corrections +01u,06dec96,dgp doc: correct spelling +01t,30sep96,elp put in share/ (SPR# 6775). +01s,04sep96,dgp doc: removed WTX_O_RDWR from WTX_OPEN_FLAG since no longer + supported per SPR #5959 +01r,17jun96,p_m added flags for WTX_OPEN (SPR# 4941). +01q,26may95,p_m added WTX_MAX_PATTERN_LEN. +01p,23may95,p_m changed WTX_CTX... and WTX_REG_SET... values. Took care + of wtx_event_type comments length for manual generation. +01o,19may95,tpr moved WTX_TGT_ADDR_T and WTX_TGT_ARG_T in host.h. + + p_m removed DETECTION related stuff. +01m,17may95,s_w extended WTX_EVENT_TYPE to have all Target Server generated + events. Because WTX_EVENT_TYPE is mapped to WDB_EVENT_TYPE + in the Target Server event numbering was made to match + for event types 0 through 8. +01l,16may95,p_m added object kill operations defines. +01k,09may95,p_m removed WTX_CORE from WTX_DESC and WTX_DESC_Q. +01j,05may95,p_m changed WTX_STATUS and WTX_REQUEST type to unsigned long. + added protocol version number in WTX_CORE. +01i,04may95,s_w removed include of and typedef of WTX_ID. Added + WTX_MAX_xxx limit defines that were in wtx.h. Remove HWTX + definition that belongs in wtx.h +01h,20apr95,p_m integrated more WIN32 changes. +01g,08apr95,p_m added HWTX and _WTX. +01f,04apr95,p_m added WTX agent mode type. +01e,03apr95,p_m get rid 0f 0x0 in wtx_action_type. +01d,30mar95,p_m added new types to completely separate WTX from the + agent protocols. removed #include "comtypes.h". +01c,15mar95,p_m changed #include "vxWorks.h" to #include "host.h". +01b,10jan95,p_m added basic types. added #include "comtypes.h" and + #include "wtxerr.h". cleanup. +01a,20jan95,p_m written. +*/ + +#ifndef __INCwtxtypesh +#define __INCwtxtypesh + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HOST +# include "host.h" +# include "vmutex.h" +# ifdef WIN32 +# include +# endif /* WIN32 */ +#else +# include "vxWorks.h" +# include "wdb/wdb.h" +# define WTX_OK 0 +# define WTX_ERROR (-1) +#endif /* HOST */ + +#include "lstLib.h" +#include "sllLib.h" +#include "wtxerr.h" + +/* limits */ + +#define WTX_MAX_SYM_CNT 256 /* maximum symbols in list */ +#define WTX_MAX_DASM_INST_CNT 256 /* maximum instructions in list */ +#define WTX_MAX_EVTPT_CNT 256 /* maximum eventpoints in list */ +#define WTX_MAX_MODULE_CNT 1000 /* maximum modules in list */ +#define WTX_MAX_SERVICE_CNT 500 /* valid service numbers: 0 to 500 */ +#define WTX_MAX_ARG_CNT 10 /* maximum arguments for func calls */ +#define WTX_MAX_SYM_TBL_CNT 256 /* maximum symbol tables */ +#define WTX_MAX_VIO_DATA 512 /* maximum bytes per VIO transaction */ + /* this number should be the same */ + /* as the buffer size used on WDB */ + /* virtual I/O devices */ +#define WTX_MAX_PATTERN_LEN 512 /* maximum length of pattern for */ + /* WTX_MEM_SCAN service */ +#define WTX_MAX_FILENAME_LEN 80 /* max length of a filename */ +#define WTX_MAX_OBJ_SEG_CNT 40 /* maximum num of segment in a module */ +#define WTX_MAX_SECTION_CNT 40 /* maximum num of section in an */ + /* object file */ + +#define WTX_MAX_WDB_SVC_CNT 10 /* maximum num of WDB services in an */ + /* WDB service object module */ + +#ifdef MAXHOSTNAMELEN /* FIXME - elg: temporary compilation */ +#ifndef MAX_HOST_NAME +#define MAX_HOST_NAME MAXHOSTNAMELEN +#endif +#else /* error fix */ +#ifndef MAX_HOST_NAME +#define MAX_HOST_NAME 64 +#endif +#endif +#define MAX_ERRNO_STR_LEN 80 /* maximum length of an errno string */ + +/* coprocessor data macros */ + +#define WTX_COPROC_HAS_FPP 1 +#define WTX_COPROC_HAS_ALTIVEC 2 +#define WTX_COPROC_HAS_SPE 3 +#define WTX_COPROC_HAS_DSP 4 + +/* virtual I/O control operations */ + +#define WTX_CTL_VIO_REDIRECT 1 +#define WTX_CTL_VIO_CLOSE_ON_EXIT 2 + +/* object kill operations */ + +#define WTX_OBJ_KILL_DESTROY 1 /* terminate */ +#define WTX_OBJ_KILL_RESTART 2 /* start again */ + +/* load options */ + +#define WTX_LOAD_FROM_TOOL 0x1 /* tool uploads object to tgtsvr */ +#define WTX_LOAD_FROM_TARGET_SERVER 0x2 /* target server uploads the obj */ +#define WTX_LOAD_ASYNCHRONOUSLY 0x4 /* load is done asynchronously */ +#define WTX_LOAD_NO_UNLOAD_EXISTING 0x10 /* does not unload a module if */ + /* already loaded */ + +/* unload options */ + +#define WTX_UNLOAD_KEEP_BREAKPOINTS 0x1 /* don't delete breakpoints on */ + /* unload */ +#define WTX_UNLOAD_FORCE 0x2 /* unload module even if it is */ + /* used */ +#define WTX_UNLOAD_COMP_NO_TERM 0x10 /* don't call termination rtn */ +#define WTX_UNLOAD_CPLUS_XTOR_AUTO 0x20 /* automatically call destructor */ +#define WTX_UNLOAD_CPLUS_XTOR_MANUAL 0x40 /* manually call destructor */ + +#define WTX_UNLOAD_SYNC 0x10000 /* internal use only */ + +/* Target File Copy options */ +#define WTX_TARGET_FILE_COPY_NOMKDIR 0x1 /* Do not create subdirs on target */ +#define WTX_TARGET_FILE_COPY_CHECK 0x2 /* Check for existing file */ + +/* Target File Remove options */ +#define WTX_TARGET_FILE_REMOVE_FORCE 0x1 /* Force deletion even if not in WINDHOME_BASE */ + +/* strings passed in WTX_COMMAND_SEND */ + +#define SEPARATOR " " +#define WDB_LOGGING_ON_CMD "wdbLoggingOn" +#define WDB_LOGGING_OFF_CMD "wdbLoggingOff" +#define WTX_LOGGING_ON_CMD "wtxLoggingOn" +#define WTX_LOGGING_OFF_CMD "wtxLoggingOff" +#define ALL_LOGGING_OFF_CMD "allLoggingOff" +#define WTX_ASYNC_NOTIFY_ENABLE_CMD "wtxAsyncNotifyEnable" +#define WTX_ASYNC_NOTIFY_DISABLE_CMD "wtxAsyncNotifyDisable" +#define WTX_OBJ_KILL_CMD "wtxObjKill" +#define WTX_OBJ_KILL_DESTROY_CMD "wtxObjKillDestroy" +#define WTX_OBJ_KILL_RESTART_CMD "wtxObjKillRestart" +#define WTX_TS_LOCK_CMD "wtxTsLock" +#define WTX_TS_LOG_GET_CMD "wtxTsLogGet" +#define WTX_TS_UNLOCK_CMD "wtxTsUnlock" +#define WTX_TARGET_RESET_CMD "wtxTargetReset" +#define WTX_LOADER_LOAD_MODE_GET_CMD "wtxLoadModeGet" +#define WTX_LOAD_CANCEL_CMD "wtxObjModuleLoadCancel" +#define WTX_TARGET_IP_ADDRESS_CMD "wtxTargetIpAddressGet" +#define WTX_TOOL_NUM_GET_CMD "wtxToolNumGet" +#define WTX_VIO_LINK_CMD "wtxVioLink" +#define WTX_VIO_UNLINK_CMD "wtxVioUnlink" +#define WTX_SHLIB_ADDR_GET "wtxShlibAddrGet" +#define WTX_COPROC_INFO_GET "wtxCoprocInfoGet" +#define WTX_COPROC_TO_STRING_GET "wtxCoprocToStringGet" +#define WTX_TGTSVR_ENV_GET "wtxTgtsvrEnvGet" +#define WTX_TGTSVR_ENV_SET "wtxTgtsvrEnvSet" +#define WTX_MODULES_INFO_SYNCHRO "wtxModulesInfoSynchro" +#define WTX_TARGET_TOOLNAME_GET_CMD "wtxTargetToolNameGet" +#define WTX_DEMANGLER_STYLE_GET_CMD "wtxDemanglerStyleGet" +#define WTX_LAST_RUNTIME_ERROR_GET "wtxLastRuntimeErrorGet" + +#ifdef WIN32 +#define WTX_SOCKET SOCKET +#else +#define WTX_SOCKET int +#endif + +#define LOG_WDB 0 +#define LOG_WTX 1 +#define LOG_ALL 2 +#define LOG_OFF 0 +#define LOG_ON 1 + +#define WTX_ALL_MODULE_CHECK "WTX_ALL_MODULE_CHECK" +#define WTX_ALL_MODULE_ID 1 /* for WTX_OBJ_MODULE_CHECKSUM */ +#define WTX_FILE_SLICE_SIZE 8192 /* for WTX_OBJ_MODULE_LOAD */ + +#define WTX_MTU 1460 /* for WTX_OBJ_MODULE_LOAD */ +#define WTX_ASYNC_HEADER_SIZE 36 /* for WTX_ASYNC_NOTIFY */ + +/* load module flags */ + + + +#define WTX_LOAD_NO_SYMBOLS 0x1 /* No symbols added to the target */ + /* symbol table */ +#define WTX_LOAD_LOCAL_SYMBOLS 0x2 /* Only internal symbols added to */ + /* the target symbol table */ +#define WTX_LOAD_GLOBAL_SYMBOLS 0x4 /* Only external symbols added to */ + /* the target symbol table */ + /* All symbols added to the target */ + /* symbol table */ +#define WTX_LOAD_SYMS_AS_ENTRIES 0x8 +#define WTX_LOAD_HIDDEN_MODULE 0x10 /* Don't display module info with */ + /* moduleShow() */ +#define WTX_LOAD_FULLY_LINKED 0x20 /* No relocation required */ +#define WTX_LOAD_NO_DOWNLOAD 0x40 /* No relocation required, nothing */ + /* downloaded to the target memory */ +#define WTX_LOAD_COMMON_MATCH_NONE 0x100 /* Only alloc, no search (default) */ +#define WTX_LOAD_COMMON_MATCH_USER 0x200 /* Core file excluded from search */ +#define WTX_LOAD_COMMON_MATCH_ALL 0x400 /* Core file included in search */ +#define WTX_LOAD_COMMON_MATCH_GLOB 0x800 +#define WTX_LOAD_BAL_OPTIM 0x1000 /* set i960 branch-and-link optim. */ +#define WTX_LOAD_NO_AUTORUN 0x4000 +#define WTX_LOAD_COMP_NO_INIT 0x8000 +#define WTX_LOAD_FILE_OUTPUT 0x10000 /* write segments in a file (testing )*/ +#define WTX_LOAD_MODULE_REPLACED 0x20000 +#define WTX_LOAD_CPLUS_XTOR_AUTO 0x100000 /* Automatic C++ ctor/dtor strategy */ +#define WTX_LOAD_CPLUS_XTOR_MANUAL 0x200000 /* Manual off C++ ctor/dtor strategy */ +#define WTX_LOAD_MODULE_INFO_ONLY 0x1000000 /* module synchronization */ +#define WTX_LOAD_LOADED_BY_TGTSVR 0x2000000 /* module synchronization */ + +#define WTX_LOAD_ALL_SYMBOLS (WTX_LOAD_LOCAL_SYMBOLS|WTX_LOAD_GLOBAL_SYMBOLS) +#define WTX_LOAD_CORE_FILE (WTX_LOAD_FULLY_LINKED|WTX_LOAD_NO_DOWNLOAD) +#define WTX_LOAD_SYMTAB_FILE (WTX_LOAD_FULLY_LINKED|WTX_LOAD_NO_DOWNLOAD) + +/* load progress flags */ + +#define WTX_LOAD_INIT 0x1 /* initializations are done */ +#define WTX_LOAD_RELOC 0x2 /* relocation phase */ +#define WTX_LOAD_DOWNLOAD 0x4 /* download to the Target */ +#define WTX_LOAD_DONE 0x8 /* load done */ +#define WTX_LOAD_ERROR 0x10 /* error during the load */ + +/* find critreria flags for wtxSymFind() & wtxSymListGet() */ + +#define WTX_SYM_FIND_IN_ALL_PD ((UINT32)-1) +#define WTX_SYM_FIND_BY_NAME 0x2 +#define WTX_SYM_FIND_BY_VALUE 0x4 +#define WTX_SYM_FIND_BY_EXACT_NAME 0x8 +#define WTX_SYM_FIND_BY_EXACT_VALUE 0x10 +#define WTX_SYM_FILTER_ON_MODULE_NAME 0x20 +#define WTX_SYM_FILTER_ON_MODULE_ID 0x40 +#define WTX_SYM_FILTER_ON_TYPE 0x80 +#define WTX_SYM_FILTER_ON_REFERENCE 0x100 +#define WTX_SYM_FIND_IN_SHLIB 0x200 + +/* symbol mask for text, data, bss, abs, comm */ + +#define WTX_SYM_BASE_MASK 0x0000001e + +/* find critreria flags for wtxObjModuleList() & wtxObjModuleFind() */ + +#define WTX_MOD_FIND_IN_ALL_PD ((UINT32)-1) +#define WTX_MOD_FIND_ALL 0x0 +#define WTX_MOD_FIND_BY_NAME 0x2 +#define WTX_MOD_FIND_BY_ID 0x4 +#define WTX_MOD_FILTER_ON_REF 0x8 + +/* WTX_OBJ_MODULE_INFO_GET constant */ + +#define WTX_OBJ_MODULE_PATHNAME_GET "WTX_OBJ_MODULE_PATHNAME_GET" + +/* PD related constants */ + +#define WTX_PD_ALL ((WTX_TGT_ADDR_T)(-1)) /* specify all PDs */ +#define WTX_PD_CURRENT ((WTX_TGT_ADDR_T)(0)) /* specify current PD */ + +#define N_DASM_INST_DEFAULT 10 /* default # of disassembled insts */ +#define WTX_PROT_VERSION 4 /* protocol version 4 */ + +/* connection defines */ + +#define WTX_CONNECTION_TIMEOUT 30000 /* rPC connection timeout : 30 secs */ + +/* memory operations options */ + +#define WTX_MEM_CACHE_BYPASS 0x1 /* don't use Tgtsvr cache for reading */ +#define WTX_MEM_WRITE_FORCE 0x2 /* force the write protection */ + +/* wtxregd start filter */ + +#define REGD_START_FILTER "([^ \t]*tgtsvr(.exe)?[ \t\n$]+)|"\ + "([^ \t]*dfwserver(.exe)?[ \t\n$]+)" + +/* wtxregd/tgtsvr heartbeat period */ + +#define WTX_HEARTBEAT_PERIOD 10 + +/* typedefs */ + +typedef unsigned long WTX_TGT_ADDR_T; /* target address */ +typedef unsigned long WTX_TGT_ARG_T; /* target function argument */ +typedef unsigned long WTX_TGT_ID_T; /* target identifier */ +typedef long WTX_TGT_INT_T; /* target function integer */ + +typedef enum cpu_info /* available cpu information types */ + { + CPU_INFO_NONE = 0, /* no information needed */ + ARCH_DIR = 1, /* target architecture directory */ + LEADING_CHAR = 2, /* symbols prepended character */ + DEMANGLER = 3, /* target symbol demangler name */ + CPU_NAME = 4, /* target CPU name */ + CPU_SIM = 5, /* target small instruction mode */ + ARCH_OBJ_DIR = 6 /* target architecture object dir */ + } CPU_INFO; + +typedef struct cpu_info_type /* CPU information type */ + { + CPU_INFO param; /* parameter value */ + char * string; /* parameter associated string */ + char * section; /* parameter section */ + } CPU_INFO_TYPE; + +typedef enum wtx_endian_t + { + WTX_ENDIAN_BIG = 0, + WTX_ENDIAN_LITTLE = 1, + WTX_ENDIAN_UNKNOWN = WTX_ERROR + } WTX_ENDIAN_T; + +typedef enum wtx_symbol_type + { + WTX_SYMBOL_GLOBAL = 0x00000001, /* global (external) (ORed) */ + WTX_SYMBOL_ABS = 0x00000002, /* absolute */ + WTX_SYMBOL_TEXT = 0x00000004, /* text */ + WTX_SYMBOL_DATA = 0x00000008, /* data */ + WTX_SYMBOL_BSS = 0x00000010, /* bss */ + WTX_SYMBOL_COMM = 0x00000020, /* common symbol */ + WTX_SYMBOL_LOCAL = 0x00000040, /* local */ + WTX_SYMBOL_THUMB = 0x00000080, /* thumb function */ + WTX_SYMBOL_UNDEF = 0x00000100, /* symbol that is not already resolved */ + WTX_SYMBOL_BAL_ENTRY = 0x00000200, /* i80960 BAL entrypoint to func, obs. */ + WTX_SYMBOL_SDA = 0x00000400, /* symbols related to a PPCSDA section */ + WTX_SYMBOL_SDA2 = 0x00000800, /* symbols related to a PPCSDA2 section*/ + WTX_SYMBOL_MIPS16 = 0x00001000, /* mips16 function - unlikely clash */ + WTX_SYMBOL_LTE = 0x00002000, /* linkage table entry */ + WTX_SYMBOL_ENTRY = 0x00004000, /* entry Point */ + WTX_SYMBOL_INIT = 0x00008000, /* initialization routine */ + WTX_SYMBOL_TERM = 0x00010000, /* termination routine */ + WTX_SYMBOL_SYSPAGE = 0x00020000, /* symbols related to the system page */ + WTX_SYMBOL_WEAK = 0x00040000, /* weak symbol */ + WTX_SYMBOL_SECTION = 0x00080000, /* section descriptor */ + WTX_SYMBOL_TRAMPOLINE= 0x00100000, /* trampoline descriptor */ + WTX_SYMBOL_HOST = 0x00200000, /* used by host shell for host funcs */ + WTX_SYMBOL_UPDATE_REL= 0x00400000, /* symbol that has some new reloc info */ + WTX_SYMBOL_UPDATE = 0x00800000, /* symbol to update (symbol table sync)*/ + WTX_SYMBOL_PENDING = 0x01000000, /* pending symbol (Out of Order Load) */ + WTX_SYMBOL_EXTENTED = 0x80000000 /* For future use */ + } WTX_SYMBOL_TYPE; + +typedef enum wtx_async_load_info_state + { + WTX_LOAD_PENDING = 0, + WTX_LOAD_INITIALIZED = 1, + WTX_LOAD_DOWNLOADING = 3 + } WTX_ASYNC_LOAD_INFO_STATE; + +/* ----------------------- registry related typedefs ------------------------ */ + +typedef enum wtx_tgtsvr_action_type + { + WTX_TGTSVR_START = 0x01, /* tell Registry to start a Tgtsvr */ + WTX_TGTSVR_STOP = 0x02, /* tell Registry to stop a Tgtsvr */ + WTX_TGTSVR_REMOTE_START = 0x03, /* internal use for Registry */ + WTX_TGTSVR_REMOTE_STOP = 0x04 /* internal use for Registry */ + } WTX_TGTSVR_ACTION_TYPE; + +typedef enum wtx_log_action_type /* log related actions (OR-able) */ + { + WTX_LOG_GET = 0x01, /* get part of the log */ + WTX_LOG_UPDATE = 0x02, /* get an update of the log */ + WTX_LOG_SET = 0x04 /* set part of the log */ + } WTX_LOG_ACTION_TYPE; + +/* ------------------------- free related typedefs -------------------------- */ + +typedef struct wtx_free_desc /* WTXResultFree parameters */ + { + void * pToFree; /* pointer to free */ + FUNCPTR pFreeRtn; /* function that should free pointer */ + void * pMsgToFree; /* message pointer containing pToFree */ + FUNCPTR pMsgFreeRtn; /* routine to use to free pMsgToFree */ + } WTX_FREE_DESC; + +/* ------------------------- WTX handler definitions ------------------------ */ + +typedef long BOOL32; /* boolean */ +typedef unsigned long WTX_STATUS; /* WTX status value */ +typedef unsigned long WTX_REQUEST; /* WTX request number */ + +#define WTX_FPP_MASK 0x0001 +#define WTX_ALTIVEC_MASK 0x0002 +#define WTX_DSP_MASK 0x0004 +#define WTX_SPE_MASK 0x0008 + +typedef enum wtx_coprocessor_bitshift + { + WTX_FPP_BITSHIFT = 0, + WTX_ALTIVEC_BITSHIFT= 1, + WTX_DSP_BITSHIFT = 2, + WTX_SPE_BITSHIFT = 3, + WTX_LAST_BITSHIFT = 16 + } WTX_COPROCESSOR_BITSHIFT; + +typedef BOOL32 (*WTX_HANDLER_FUNC) (); +typedef struct _wtx_handler_t * WTX_HANDLER_T; +typedef struct _wtx_handler_t + { + WTX_HANDLER_FUNC pFunc; /* WTX error handler function pointer */ + void * pClientData; /* client data descriptor */ + WTX_HANDLER_T prev; /* previous handler in list */ + } _WTX_HANDLER_T; + +/* ------------------------- wtx handler definition ------------------------- */ + +typedef struct _wtx * HWTX; /* WTX Handle */ + +/* ----------------------------- useful typedefs ---------------------------- */ + +/* + * WTX_EVENT_TYPE - The class of events that can be generated by the + * Target Server. User defined event types start at 0x100, event types + * numbered 22 through 255 are reserved for future use. + */ + +typedef enum wtx_event_type + { + WTX_EVENT_NONE = 0, /* no event */ + WTX_EVENT_CTX_START = 1, /* a target context was created */ + WTX_EVENT_CTX_EXIT = 2, /* a target context was deleted */ + WTX_EVENT_TEXT_ACCESS = 3, /* a target text access (breakpoint) */ + WTX_EVENT_DATA_ACCESS = 4, /* a target data access (watchpoint) */ + WTX_EVENT_EXCEPTION = 5, /* a target exception occurred */ + WTX_EVENT_VIO_WRITE = 6, /* a target VIO write occurred */ + WTX_EVENT_HW_BP = 7, /* a target breakpoint: obsolete, use */ + /* WTX_EVENT_TEXT_ACCESS instead */ + WTX_EVENT_CALL_RETURN = 8, /* a target function call returned */ + WTX_EVENT_USER = 9, /* a target agent user defined event */ + WTX_EVENT_UNKNOWN = 10, /* an unknown target event */ + WTX_EVENT_TGT_RESET = 11, /* the Target was reset */ + WTX_EVENT_SYM_ADDED = 12, /* a symbol added to the symbol table */ + WTX_EVENT_SYM_REMOVED = 13, /* a symbol removed from the symbol table */ + WTX_EVENT_OBJ_LOADED = 14, /* an object file was loaded */ + WTX_EVENT_OBJ_UNLOADED = 15, /* an object file was unloaded */ + WTX_EVENT_TOOL_ATTACH = 16, /* a tool attached to Target Server */ + WTX_EVENT_TOOL_DETACH = 17, /* a tool detached from Target Server */ + WTX_EVENT_TOOL_MSG = 18, /* a tool to tool message */ + WTX_EVENT_TS_KILLED = 19, /* the Target Server was reset */ + WTX_EVENT_EVTPT_ADDED = 20, /* a new event point is added */ + WTX_EVENT_EVTPT_DELETED= 21, /* an event point had been deleted */ + WTX_EVENT_TRIGGER = 22, /* a trigger has been hit on the Target */ + WTX_EVENT_TGT_LOST = 23, /* contact with the target is lost */ + WTX_EVENT_TS_POSTMORTEM= 24, /* target server in postmortem mode */ + WTX_EVENT_TGT_RECOVERED= 25, /* contact with the target is recovered */ + WTX_EVENT_CTX_UPDATE = 26, /* a target context has changed */ + WTX_EVENT_PD_INITIALIZED = 27, /* the pdList is now initialized */ + WTX_EVENT_CTX_ATTACH = 28, /* Attach on a process */ + WTX_EVENT_CTX_DETACH = 29, /* Detach from a process */ + WTX_EVENT_CTX_DUMP = 30, /* Catch when a process dumps */ + WTX_EVENT_CTX_STOP = 31, /* A context is stopped */ + WTX_EVENT_CTX_CONT = 32, /* A context is continued */ + WTX_EVENT_CTX_STEP = 33, /* A context is stepped */ + WTX_EVENT_CTX_REGS_SET = 34, /* A context has registers set */ + WTX_EVENT_AGENT_MODE_TASK = 35, /* User mode has been set */ + WTX_EVENT_AGENT_MODE_EXTERN = 36, /* System mode has been set */ + WTX_EVENT_TS_RESTART = 37, /* Target server will restart */ + WTX_EVENT_OTHER = 0x100, /* user defined or unrecognized event */ + WTX_EVENT_INVALID = WTX_ERROR /* invalid/unidentifiable event */ + } WTX_EVENT_TYPE; + +typedef enum wtx_context_type /* types of context */ + { + WTX_CONTEXT_SYSTEM = 0, /* system mode */ + WTX_CONTEXT_GROUP = 1, /* process group (not implemented) */ + WTX_CONTEXT_ANY = 2, /* any context (not implemented) */ + WTX_CONTEXT_TASK = 3, /* specific task or process */ + WTX_CONTEXT_ANY_TASK = 4, /* any task */ + WTX_CONTEXT_ISR = 5, /* specific ISR (not implemented) */ + WTX_CONTEXT_ISR_ANY = 6, /* any ISR (not implemented) */ + WTX_CONTEXT_PD = 7, /* specific Protection Domain */ + WTX_CONTEXT_PROCESS = 8 /* BSD process/thread/kernel module */ + } WTX_CONTEXT_TYPE; + +typedef enum wtx_ctx_kill_opt /* options for context deletion */ + { + WTX_PD_DELETE_OPTION_NONE = 0, /* no option given */ + WTX_PD_NOT_CALL_TERM_RTN = 1, /* don't not call termination routine */ + WTX_PD_FORCE_DELETE = 2 /* force deletion */ + } WTX_CTX_KILL_OPT; + +typedef enum wtx_pd_type /* values for WTX PDs */ + { + WTX_PD_APPLICATION = 0x00000001, /* application PD */ + WTX_PD_SHARED_LIB = 0x00000002, /* shared library PD */ + WTX_PD_SHARED_DATA = 0x00000004, /* shared data PD */ + WTX_PD_AUTO_DELETE = 0x00000010, /* PD auto terminate */ + WTX_PD_HEAP_GROWTH = 0x00000020, /* PD supports heap growth */ + WTX_PD_DELETE_SAFE = 0x00000040, /* PD is not deletable */ + WTX_PD_PRIVILEGED = 0x00000080, /* PD is privileged */ + WTX_PD_PRE_MAPPED = 0x00000100, /* pre-mapped phys mem in PD */ + WTX_PD_KERNEL = 0x00001000, /* kernel PD */ + WTX_PD_SYS_SHARED_LIB = 0x00002000, /* system shared lib */ + WTX_PD_UNPROTECTED = 0x00004000, /* no protected linkage */ + WTX_PD_PROTECTED = 0x00008000, /* protected linkages allowed */ + WTX_PD_ERROR_RESERVED = 0x80000000 /* reserved for errors */ + } WTX_PD_TYPE; + +typedef WTX_TGT_ID_T WTX_CONTEXT_ID_T; /* context ID type */ + +/* + * WTX_ACTION_TYPE - Type of actions to perform when an event occurs. + * These action types can be bit-wise or-ed together. If the function called + * in an WTX_ACTION_CALL returns TRUE, then any other actions specified are + * cancelled. User defined actions use the high order 16 bits of the + * WTX_ACTION_TYPE. + * + * For AExxx products, WTX_ACTION_PD_STOP is replaced by ACTION_ALL_STOP + */ + +typedef enum wtx_action_type /* type of actions */ + { + WTX_ACTION_CALL = 1, /* call a function */ + WTX_ACTION_NOTIFY = 2, /* post the event to the Host */ + WTX_ACTION_STOP = 4, /* stop the context */ + WTX_ACTION_SYS_STOP = 8, /* stop and goes in system mode */ + WTX_ACTION_ALL_STOP = 16 /* stop all threads/tasks */ + } WTX_ACTION_TYPE; + +typedef enum wtx_return_type /* return value type */ + { + WTX_RETURN_TYPE_INT = 0, /* integer return format */ + WTX_RETURN_TYPE_DOUBLE = 1, /* double return format */ + WTX_RETURN_TYPE_FLOAT = 2 /* float return format */ + } WTX_RETURN_TYPE; + +typedef enum wtx_svc_type /* ID for service type & action */ + { + WDB_LOGGING_ON = 0, /* turn on WDB logging request */ + WDB_LOGGING_OFF = 1, /* turn off WDB logging request */ + WTX_LOGGING_ON = 2, /* turn on WTX logging request */ + WTX_LOGGING_OFF = 3, /* turn off WTX logging request */ + ALL_LOGGING_OFF = 4 /* turn off WDB & WTX logging request */ + } WTX_SVC_TYPE; + +typedef enum wtx_compat_reg_set_type /* types of registers */ + { + WTX_REG_SET_IU = 0, /* integer unit register set */ + WTX_REG_SET_FPU = 1, /* floating point unit register set */ + WTX_REG_SET_MMU = 2, /* memory management unit register set*/ + WTX_REG_SET_CU = 3, /* cache unit register set */ + WTX_REG_SET_TPU = 4, /* time process unit register set */ + WTX_REG_SET_SYS = 5, /* system registers */ + WTX_REG_SET_DSP = 6, /* DSP registers */ + WTX_REG_SET_AV = 7, /* altivec registers */ + WTX_REG_SET_SPE = 8, /* SPE registers */ + WTX_REG_SET_LAST = 9 /* 1 + last used REG_SET number */ + } WTX_COMPAT_REG_SET_TYPE; + +typedef UINT32 WTX_REG_SET_TYPE; + +typedef enum wtx_agent_mode_type /* debug agent running mode */ + { + WTX_AGENT_MODE_TASK = 1, /* run in task mode */ + WTX_AGENT_MODE_EXTERN = 2, /* run in system mode */ + WTX_AGENT_MODE_BI = 3 /* bimodal agent */ + } WTX_AGENT_MODE_TYPE; + +typedef enum wtx_context_status /* context status */ + { + /* VxWorks states */ + + WTX_CONTEXT_RUNNING = 0x0, /* context is running (system mode) */ + WTX_CONTEXT_SUSPENDED = 0x1, /* context is suspended (system mode) */ + + /* BSD OS Process status */ + + WTX_CONTEXT_SIDL = 0x100, /* Process being created by fork. */ + WTX_CONTEXT_SRUN = 0x200, /* Currently runnable. */ + WTX_CONTEXT_SSLEEP = 0x400, /* Sleeping on an address. */ + WTX_CONTEXT_SSTOP = 0x800, /* Process debugging or suspension. */ + WTX_CONTEXT_SEXIT = 0x1000, /* Process is exiting/cleaning up */ + WTX_CONTEXT_SZOMB = 0x2000, /* Awaiting collection by parent. */ + WTX_CONTEXT_EXCEPTION = 0x4000, /* Exception */ + WTX_CONTEXT_CORE = 0x8000, /* Core dumps */ + WTX_CONTEXT_SSUSPEND = 0x10000, + WTX_CONTEXT_SDEBUG = 0x20000, + WTX_CONTEXT_SBREAK = 0x40000, + + /* BSD/OS Threads status */ + + WTX_CONTEXT_PS_DEAD = 0x80000, + WTX_CONTEXT_PS_JOIN_WAIT = 0x100000, + WTX_CONTEXT_PS_SIG_WAIT = 0x200000, + WTX_CONTEXT_PS_WAIT_WAIT = 0x400000, + WTX_CONTEXT_PS_SLEEP_WAIT = 0x800000, + WTX_CONTEXT_PS_SELECT_WAIT = 0x1000000, + WTX_CONTEXT_PS_CLOSE_WAIT = 0x2000000, + WTX_CONTEXT_PS_IO_WAIT = 0x4000000, + WTX_CONTEXT_PS_COND_WAIT = 0x8000000, + WTX_CONTEXT_PS_MUTEX_WAIT = 0x10000000, + WTX_CONTEXT_PS_SUSPENDED = 0x20000000, + WTX_CONTEXT_PS_RUNNABLE = 0x40000000, + WTX_CONTEXT_PS_RUNNING = 0x80000000 + + + } WTX_CONTEXT_STATUS; + +typedef enum wtx_open_flag /* flag for WTX_OPEN */ + { + WTX_O_RDONLY = 0x1000, /* open for reading only */ + WTX_O_WRONLY = 0x2000, /* open for writing only */ + WTX_O_CREAT = 0x4000 /* open with file create */ + } WTX_OPEN_FLAG; + +typedef enum wtx_pd_info_opt + { + WTX_CONTINUE_CHILDREN = 0x01, /* Auto resume of children */ + WTX_CONTINUE_THREADS = 0x02, /* Auto resume of threads */ + WTX_BREAK_AT_INIT = 0x04, /* Break at _init */ + WTX_NO_FILE_PARSING = 0x08 /* No parsing on host side */ + } WTX_PD_INFO_OPT; + +typedef struct wtx_core /* WTX message core */ + { + WTX_TGT_ID_T objId; /* identifier */ + WTX_ERROR_T errCode; /* service error code */ + UINT32 protVersion; /* WTX protocol version */ + WTX_TGT_ADDR_T defaultPd; /* default Protection Domain */ + UINT32 osErrCode; /* OS specific error code */ + } WTX_CORE; + +typedef enum wtx_value_t /* simple types definitions */ + { + V_INT8 = 0, /* 8 bits signed integer */ + V_INT16 = 1, /* 16 bits signed integer */ + V_INT32 = 2, /* 32 bits signed integer */ + V_UINT8 = 3, /* 8 bits unsigned integer */ + V_UINT16 = 4, /* 16 bits unsigned integer */ + V_UINT32 = 5, /* 32 bits unsigned integer */ + V_DOUBLE = 6, /* double floating point */ + V_BOOL32 = 7, /* 32 bits boolean */ + V_PCHAR = 8, /* character pointer */ + V_PVOID = 9, /* void pointer */ + V_TGT_ADDR = 10, /* target address */ + V_TGT_ARG = 11, /* target task argument */ + V_INT64 = 12, /* 64 bits signed integer */ + V_UINT64 = 13 /* 64 bits unsigned integer */ + } WTX_VALUE_T; + +typedef struct wtx_value /* simple type value */ + { + WTX_VALUE_T valueType; /* value type */ + union + { + INT8 v_int8; /* 8 bit signed value */ + INT16 v_int16; /* 16 bit signed value */ + INT32 v_int32; /* 32 bit signed value */ + UINT8 v_uint8; /* 8 bit unsigned value */ + UINT16 v_uint16; /* 16 bit unsigned value */ + UINT32 v_uint32; /* 32 bit unsigned value */ + double v_double; /* double value */ + BOOL32 v_bool32; /* 32 bit boolean value */ + char * v_pchar; /* string value */ + void * v_pvoid; /* void pointer value */ + WTX_TGT_ADDR_T v_tgt_addr; /* target address value */ + WTX_TGT_ARG_T v_tgt_arg; /* target task argument value */ + INT64 v_int64; /* 64 bit signed value */ + UINT64 v_uint64; /* 64 bit unsigned value */ + } value_u; + } WTX_VALUE; + +typedef struct wtx_value_with_pd /* WTX value with PD ID */ + { + WTX_TGT_ID_T pdId; /* protection domain ID */ + WTX_VALUE value; /* simple parameter value */ + } WTX_VALUE_WITH_PD; + +/* -------------------------- asynchronous typedefs ------------------------- */ + +typedef struct wtx_event_desc /* WTX event descriptor */ + { + char * event; /* event descriptor */ + INT32 addlDataLen; /* additional data length */ + char * addlData; /* additional data (VIO) */ + } WTX_EVENT_DESC; + +typedef void (*WTX_EVENT_HANDLER) + ( + WTX_EVENT_DESC *, /* event received by target server */ + HWTX /* current WTX session handler */ + ); + +typedef struct wtx_async_context + { + void * objId; /* object address */ + WTX_EVENT_HANDLER wrapperFunc; /* user routine */ + LIST wtxEventList; /* global event list */ + SEM_ID wtxEventListMutex; /* guarding Mutex for event list */ + SEM_ID fullListSem; /* guarding semaphore for event list */ + SEM_ID syncSema; /* synchronization semaphore */ + SEM_ID prodMutex; /* producer Mutex */ + SEM_ID consMutex; /* consumer Mutex */ + WTX_SOCKET serverSockFd; /* socket file descriptor */ + WTX_SOCKET serverNewSockFd; /* socket file descriptor */ + BOOL32 asyncNotifyStarted; /* asynchronous notification flag */ + } WTX_ASYNC_CONTEXT; /* asynchronous notification context */ + +typedef WTX_ASYNC_CONTEXT * WTX_ASYNC_HANDLE; /* asynch. notif. handle */ + +/* -------------------------------- registry -------------------------------- */ + +typedef struct wtx_tgtsvr_action + { + WTX_TGTSVR_ACTION_TYPE actionType; /* action type to perform */ + char * tgtsvrName; /* name of Tgtsvr to address */ + char * cmdLine; /* tgtsvr command line */ + char * execIP; /* IP address of exec host */ + } WTX_TGTSVR_ACTION; + +typedef struct wtx_log_action + { + char * host; /* application's host */ + char * svrName; /* server name to get log */ + WTX_LOG_ACTION_TYPE actionType; /* logging action type */ + unsigned long int seek; /* file position cursor */ + char * log; /* logging file content */ + } WTX_LOG_ACTION; + +typedef struct wtx_wtxregd_info + { + char * name; /* registry element name / pattern */ + char * type; /* registry element type / pattern */ + char * key; /* registry element key / pattern */ + char * host; /* registry host name / IP address */ + } WTX_WTXREGD_INFO; + +typedef struct wtx_wtxregd_item + { + char * name; /* exact name of item to retrieve */ + char * host; /* registry host name or IP address */ + } WTX_WTXREGD_ITEM; + +/* ----------------------- server/registry ---------------------------------- */ + +typedef struct wtx_desc /* server descriptor queue */ + { + char * wpwrName; /* name of wpwr service */ + char * wpwrType; /* type of service */ + char * wpwrKey; /* unique service key */ + struct wtx_desc_q * pNext; /* next descriptor */ + } WTX_DESC; + +typedef struct wtx_desc_q /* server descriptor queue */ + { + char * wpwrName; /* name of wpwr service */ + char * wpwrType; /* type of service */ + char * wpwrKey; /* unique service key */ + struct wtx_desc_q * pNext; /* next descriptor */ + } WTX_DESC_Q; + +typedef struct wtx_svr_desc /* server descriptor */ + { + char * wpwrName; /* name of wpwr service */ + char * wpwrType; /* type of service */ + char * wpwrKey; /* unique service key */ + } WTX_SVR_DESC; + +typedef struct wtx_svr_desc_q /* server descriptor queue */ + { + WTX_SVR_DESC wtxSvrDesc; /* server Descriptor */ + struct wtx_svr_desc_q * pNext; /* next descriptor */ + } WTX_SVR_DESC_Q; + +typedef struct wtx_vio_file_desc /* virtual file descriptor */ + { + char * name; /* file or device name */ + INT32 fd; /* file descriptor */ + INT32 channel; /* channel for redirection */ + INT32 fp; /* file pointer for streams */ + INT32 type; /* file type */ + INT32 mode; /* open mode (O_RDONLY, ...) */ + INT32 status; /* opened or closed */ + INT64 addlInfo; /* extra information (eg: process ID) */ + struct wtx_vio_file_desc * next; /* ptr to next descriptor for list */ + } WTX_VIO_FILE_DESC; + +typedef struct wtx_vio_link_desc /* virtual IO link descriptor */ + { + NODE node; /* node used to link */ + UINT32 channel; /* target vio channel */ + WTX_SOCKET fdIn; /* socket file descriptor (input) */ + WTX_SOCKET fdOut; /* socket file descriptor (output) */ + void * tsNode; /* target Server descriptor node */ + } WTX_VIO_LINK_DESC; + +typedef struct wtx_mem_region /* memory region descriptor */ + { + WTX_TGT_ADDR_T baseAddr; /* memory region base address */ + UINT32 size; /* memory region size */ + UINT32 attribute; /* memory region attributes */ + } WTX_MEM_REGION; + +typedef struct wtx_vxworks_info /* vxWorks specific information */ + { + WTX_TGT_ADDR_T pdList; /* pointer on Protection Domain list */ + } WTX_VXWORKS_INFO; + + +typedef struct wtx_rt_info /* target runtime information */ + { + char * rtName; /* runtime name */ + char * rtVersion; /* runtime version */ + UINT32 cpuType; /* target processor type */ + char * cpuVariant; /* cpu variant */ + UINT32 hasCoprocessor; /* Coprocessors: see below */ + UINT32 hasWriteProtect;/* Text write protect avail. */ + UINT32 pageSize; /* size of a page */ + UINT32 endian; /* endianness (LITTLE or BIG) */ + char * bspName; /* board support package name */ + char * bspShortName; /* build tool's BSP_NAME macro value */ + char * toolName; /* tool used to build this target */ + char * bootline; /* boot file name */ + WTX_TGT_ADDR_T memBase; /* target main memory base address */ + UINT32 memSize; /* target main memory size */ + UINT32 numRegions; /* number of memory regions */ + WTX_MEM_REGION * memRegion; /* memory region descriptor(s) */ + WTX_TGT_ADDR_T hostPoolBase; /* tgtsvr memory pool base address */ + UINT32 hostPoolSize; /* target Server memory pool size */ + UINT32 numInts; /* RT specific union length */ + union + { + WTX_VXWORKS_INFO vxWorksInfo; /* vxWorks specific information */ + } rtSpecific; + } WTX_RT_INFO; + +/* + * The hasCoprocessor field is bit-significant, see definitions of + * WTX_FPP_MASK etc. in wtxtypes.h + */ + +typedef struct wtx_agent_info /* target agent information */ + { + char * agentVersion; /* WDB agent version */ + UINT32 mtu; /* maximum transfer size (bytes) */ + UINT32 mode; /* available agent modes */ + } WTX_AGENT_INFO; + +typedef struct wtx_tgt_info /* target information */ + { + WTX_AGENT_INFO agentInfo; /* information on the agent */ + WTX_RT_INFO rtInfo; /* information on the runtime system */ + } WTX_TGT_INFO; + +typedef struct wtx_tgt_link_desc /* link descriptor */ + { + char * name; /* target/Host link name */ + UINT32 type; /* target/Host link type */ + UINT32 speed; /* target/Host link speed */ + } WTX_TGT_LINK_DESC; + +typedef struct wtx_tool_desc /* tool descriptor */ + { + WTX_TGT_ID_T id; /* unique tool identifier */ + char * toolName; /* tool name */ + char * toolArgv; /* tool argv parameters */ + char * toolVersion; /* tool version */ + char * userName; /* user name */ + WTX_TGT_ADDR_T clientPd; /* tool's current PD ID */ + UINT32 lastError; /* tool's last error seen */ + void * pendingContext; /* non atomic requests contexts */ + char * currentDir; /* Current directory */ + UINT32 umask; /* Current umask */ + void * pReserved; /* reserved */ + struct wtx_tool_desc * next; /* pointer to next tool descriptor */ + } WTX_TOOL_DESC; + +typedef WTX_TOOL_DESC * TOOL_ID; + +typedef struct wtx_tgtsvr_args /* tgtsvr starting args */ + { + int argc; /* arguments number */ + char ** argv; /* arguments vector */ + } WTX_TGTSVR_ARGS; + +typedef struct wtx_ts_info /* target Server information message */ + { + WTX_TGT_LINK_DESC tgtLinkDesc; /* target link descriptor */ + WTX_TGT_INFO tgtInfo; /* information retrieved from Target */ + WTX_TOOL_DESC * pWtxToolDesc; /* information about attached Tools */ + char * version; /* target Server version */ + char * userName; /* target Server user name */ + UINT32 startTime; /* target Server start time */ + UINT32 accessTime; /* target Server access time */ + char * lockMsg; /* lock/authorization message one of: */ + /* - "authorized" : you are not in the allowed users list */ + /* - "locked" : another user has locked this session */ + /* - "available" : you may connect to this session */ + /* - "restricted" : this session is restricted for your own use */ + + BOOL32 pdInitialized; /* TRUE if the PDs are initialized */ + WTX_TGTSVR_ARGS tgtsvrArgs; /* target Server command line */ + void * pReserved; /* reserved */ + } WTX_TS_INFO; + +/* --------------------------- memory operations ---------------------------- */ + +typedef struct wtx_mem_info /* memory information */ + { + UINT32 curBytesFree; /* number of free bytes */ + UINT32 curBytesAllocated; /* current number of allocated bytes */ + UINT32 cumBytesAllocated; /* cumm. number of allocated bytes */ + UINT32 curBlocksFree; /* current number of free blocks */ + UINT32 curBlocksAlloc; /* current number of blocks allocated */ + UINT32 cumBlocksAlloc; /* cumm. number of allocated blocks */ + UINT32 avgFreeBlockSize; /* average free blocks size */ + UINT32 avgAllocBlockSize; /* average allocated blocks size */ + UINT32 cumAvgAllocBlockSize; /* cumm. average allocated block size */ + UINT32 biggestBlockSize; /* size of biggest block */ + void * pReserved; /* reserved */ + } WTX_MEM_INFO; + +typedef struct wtx_mem_xfer /* memory transfer */ + { + UINT32 numBytes; /* number of bytes to transfer */ + WTX_TGT_ADDR_T destination; /* destination address */ + char * source; /* source address */ + } WTX_MEM_XFER; + +/* --------------------------- contexts ------------------------------------- */ + +typedef struct wtx_context /* context descriptor */ + { + WTX_CONTEXT_TYPE contextType; /* type of context */ + WTX_CONTEXT_ID_T contextId; /* context ID */ + WTX_CONTEXT_ID_T contextSubId; /* context Sub ID */ + } WTX_CONTEXT; + +typedef struct wtx_kill_context /* context descriptor */ + { + WTX_CONTEXT wtxContext; /* type of context */ + WTX_CTX_KILL_OPT killOpt; /* kill options */ + } WTX_KILL_CONTEXT; + +typedef struct wtx_task_context_def /* task creation descriptor */ + { + WTX_TGT_ID_T pdId; /* context Protection Domain ID */ + WTX_RETURN_TYPE returnType; /* integer or double */ + char * name; /* task name */ + UINT32 priority; /* priority */ + UINT32 options; /* options */ + WTX_TGT_ADDR_T stackBase; /* base of stack address */ + UINT32 stackSize; /* stack size */ + WTX_TGT_ADDR_T entry; /* context entry point */ + WTX_TGT_ID_T redirIn; /* redirection in file or NULL */ + WTX_TGT_ID_T redirOut; /* redirection out file or NULL */ + WTX_TGT_ID_T redirErr; /* redirection error file or NULL */ + UINT32 argc; /* number of arguments in argv */ + WTX_TGT_ARG_T * argv; /* arguments array */ + } WTX_TASK_CONTEXT_DEF; + +typedef struct wtx_pd_context_def /* PD creation descriptor */ + { + char * name; /* PD name */ + UINT32 options; /* options */ + UINT32 heapSize; /* size of the PD's heap */ + UINT32 lowPriority; /* lowest task's priority */ + UINT32 highPriority; /* highest task's priority */ + WTX_TGT_ADDR_T pagePoolList; /* page pool list name to use */ + WTX_TGT_ADDR_T destroyRtn; /* rtn. address to call on deletion */ + char * linkPath; /* initial link path for this PD */ + WTX_TGT_ID_T redirIn; /* redirection in file or NULL */ + WTX_TGT_ID_T redirOut; /* redirection out file or NULL */ + WTX_TGT_ID_T redirErr; /* redirection error file or NULL */ + UINT32 argc; /* extra argument count (in argv) */ + WTX_TGT_ARG_T * argv; /* extra argument array */ + } WTX_PD_CONTEXT_DEF; + +typedef struct wtx_process_context_def /* Process descriptor */ + { + char * name; /* Process name */ + UINT32 options; /* options */ + UINT32 addOptions; /* Additionnal options */ + UINT32 heapSize; /* size of the Process's heap */ + WTX_TGT_ID_T redirIn; /* redirection in file or NULL */ + WTX_TGT_ID_T redirOut; /* redirection out file or NULL */ + WTX_TGT_ID_T redirErr; /* redirection error file or NULL */ + UINT32 argc; /* extra argument count (in argv) */ + char ** argv; /* extra argument string array */ + UINT32 uid; /* uid */ + UINT32 gid; /* gid */ + UINT32 priority; /* priority */ + int envc; /* Number of environment string */ + char ** envv; /* Environment strings array */ + UINT32 stackSize; /* Stack size */ + } WTX_PROCESS_CONTEXT_DEF; + +typedef struct wtx_context_desc /* context creation descriptor */ + { + WTX_CONTEXT_TYPE wtxContextType; /* type of context */ + union wtx_context_def + { + WTX_TASK_CONTEXT_DEF wtxTaskContextDef; /* task context definition */ + WTX_PD_CONTEXT_DEF wtxPdContextDef; /* PD context definition */ + WTX_PROCESS_CONTEXT_DEF wtxProcessContextDef; /* process ctx def. */ + } wtxContextDef; + } WTX_CONTEXT_DESC; + +/* --------------------------- symbols -------------------------------------- */ + +typedef struct wtx_symbol /* symbol descriptor */ + { + UINT32 status; /* returned value for find request */ + WTX_TGT_ID_T pdId; /* protection domain ID */ + char * name; /* symbol name */ + BOOL32 exactName; /* fALSE if symbol name prefixed by _ */ + WTX_TGT_ADDR_T value; /* symbol value */ + UINT32 size; /* symbol size */ + UINT32 type; /* symbol type */ + UINT32 typeMask; /* symbol type mask for lookup */ + WTX_TGT_ADDR_T reference; /* symbol reference */ + char * moduleName; /* module name */ + UINT32 execMode; /* entry point execution mode as above*/ +#ifdef HOST + GROUP_ID apiGroup; /* entry point API group */ +#endif + UINT32 nPendModules; /* # modules depending on this symbol */ + WTX_TGT_ID_T * pPendModuleId; /* depending modules array */ + void * pReserved; /* reserved */ + struct wtx_symbol * next; /* pointer to the next symbol in list */ + } WTX_SYMBOL; + +typedef struct wtx_sym_list /* symbol list */ + { + WTX_SYMBOL * pSymbol; /* head of symbol list */ + } WTX_SYM_LIST; + +typedef struct wtx_sym_tbl_info + { + WTX_TGT_ID_T pdId; /* protection domain ID */ + UINT32 symNum; /* number of symbols */ + BOOL32 sameNameOk; /* name clash policy */ + } WTX_SYM_TBL_INFO; + +typedef struct wtx_sym_find_criteria + { + UINT32 options; /* option flag */ + WTX_TGT_ID_T pdId; /* PD ID or WTX_SYM_FIND_IN_ALL_PD */ + char * findName; /* symbol name (regular expression) */ + WTX_TGT_ADDR_T findValue; /* symbol value (address) */ + UINT32 nSymbols; /* number of symbols to get by value */ + UINT32 type; /* type value */ + WTX_TGT_ADDR_T ref; /* reference value */ + WTX_TGT_ID_T moduleId; /* module ID value */ + char * moduleName; /* module name value */ + } WTX_SYM_FIND_CRITERIA; + +/* --------------------------- module/segment ------------------------------- */ + +typedef enum wtx_section_type /* kind of section handled */ + { + WTX_SECTION_UNKNOWN = 0, + WTX_SECTION_RODATA = 1, /* read-only data section */ + WTX_SECTION_TEXT = 2, /* text section */ + WTX_SECTION_DATA = 3, /* data section */ + WTX_SECTION_BSS = 4 /* bSS section */ + } WTX_SECTION_TYPE; + +typedef struct wtx_section_desc /* object module section descriptor */ + { + WTX_TGT_ID_T id; /* section id */ + char * name; /* section name */ + WTX_SECTION_TYPE type; /* section type */ + UINT32 flags; /* section flags */ + WTX_TGT_ADDR_T baseAddr; /* section base address */ + WTX_TGT_ADDR_T partId; /* dedicated memory partition Id */ + UINT32 length; /* section length */ + UINT32 checksum; /* checksum value for section */ + } WTX_SECTION_DESC; + +typedef enum wtx_seg_type + { + WTX_SEGMENT_TEXT = 2, + WTX_SEGMENT_DATA = 4, + WTX_SEGMENT_BSS = 8 + } WTX_SEG_TYPE; + +typedef struct wtx_segment_desc + { + WTX_SEG_TYPE type; /* Segment type */ + WTX_TGT_ADDR_T addr; /* Segment location */ + UINT32 length; /* Segment length */ + UINT32 flags; /* Segment flags */ + } WTX_SEGMENT_DESC; + +typedef struct wtx_module_file_desc /* object module file descriptor */ + { + char * filename; /* object file name */ + WTX_TGT_ID_T moduleId; /* module ID */ + INT32 loadFlag; /* behavior control flags */ + UINT32 nSections; /* number of sections */ + WTX_SECTION_DESC * section; /* section description */ + UINT32 nArgs; /* # args given for the load and run */ + WTX_TGT_ADDR_T * pArgs; /* args array */ + } WTX_MODULE_FILE_DESC; + +typedef struct wtx_module_info /* object module information */ + { + WTX_TGT_ID_T pdId; /* protection domain ID */ + WTX_TGT_ID_T moduleId; /* module ID */ + char * moduleName; /* module name (with path) */ + UINT32 format; /* object file format */ + int loadFlag; /* flags used to load module */ + WTX_TGT_ADDR_T vxCompRtn; /* component init/term routine */ + WTX_TGT_ADDR_T userInitRtn; /* user-supplied init routine */ + UINT32 commTotalSize; /* memory used by common symbols */ + UINT32 nSections; /* number of sections */ + WTX_SECTION_DESC * section; /* section description */ + WTX_SYM_LIST undefSymList; /* list of undefined symbols */ + void * pReserved; /* reserved */ + UINT32 group; /* Group */ + UINT32 nSegments; /* number of segments */ + WTX_SEGMENT_DESC * segment; /* segment descriptions */ + } WTX_MODULE_INFO; + +typedef struct wtx_module + { + WTX_TGT_ID_T pdId; /* protection domain ID */ + WTX_TGT_ID_T moduleId; /* module ID */ + char * moduleName; /* module name (with path) */ + struct wtx_module * next; /* pointer to the next module in list */ + } WTX_MODULE; + +typedef struct wtx_module_list /* object module list */ + { + WTX_MODULE * pModule; /* list of object module ID */ + } WTX_MODULE_LIST; + +typedef struct wtx_mod_find_criteria /* criteria descriptor */ + { + UINT32 options; /* options flag */ + WTX_TGT_ID_T pdId; /* PD ID or WTX_MOD_FIND_IN_ALL_PD */ + WTX_TGT_ID_T moduleId; /* module ID value */ + char * moduleName; /* module name value */ + WTX_TGT_ADDR_T ref; /* reference value */ + } WTX_MOD_FIND_CRITERIA; + +typedef enum wtx_svr_type /* type of server to connect to */ + { + WTX_SVR_NONE = 0, /* no server to connect to */ + WTX_SVR_SERVER = 1, /* server is a Target Server */ + WTX_SVR_REGISTRY = 2 /* server is the Registry */ + } WTX_SVR_TYPE; + +typedef enum wtx_ctl_request /* request for WTX exchange controls */ + { + WTX_CTL_NONE = 0, /* no request */ + WTX_CTL_TIMEOUT_SET = 1, /* set exchange timeout value */ + WTX_CTL_TIMEOUT_GET = 2, /* get exchange timeout value */ + WTX_CTL_ERROR_GET = 3 /* get exchange error code */ + } WTX_CTL_REQUEST; + +typedef struct wtx_exchange_desc /* exchange layer descriptor */ + { + WTX_SVR_TYPE svrType; /* exchange server to address */ + WTX_CTL_REQUEST request; /* request to address to server */ + union req_val + { + UINT32 timeout; /* value to control is a timeout */ + WTX_ERROR_T error; /* value to control is a WTX error */ + } reqVal; + } WTX_EXCHANGE_DESC; + +/* --------------------------- load operation ------------------------------- */ + +typedef enum wtx_load_mode + { + WTX_LOADER_NO_LOAD_MODE = 0, /* no load mode */ + WTX_LOADER_STRICT_MODE = 1, /* strict mode */ + WTX_LOADER_INCREMENTAL_MODE = 2, /* incremental mode */ + WTX_LOADER_OUT_OF_ORDER_MODE= 3 /* OOOL mode */ + } WTX_LOAD_MODE; + +typedef enum wtx_async_load_state + { + WTX_LOAD_IN_PROGRESS = 2, /* load in progress MUST BE EQUAL TO + * LOAD_PROGRESS enum */ + WTX_LOAD_FINISHED = 4 /* load finished MUST BE EQUAL TO + * LOAD_MODULE_DONE enum */ + } WTX_ASYNC_LOAD_STATE; + +typedef struct wtx_upload_buf + { + UINT32 fileSize; /* file size */ + UINT32 numBuffer; /* current buffer # */ + UINT32 bufSize; /* current buffer size */ + void * buffer; /* the buffer itself */ + } WTX_UPLOAD_BUF; + +typedef struct wtx_load_progress_info /* async load progress report infos */ + { + UINT32 state; /* current load state */ + UINT32 maxValue; /* max value for this state */ + UINT32 currentValue; /* current value for this state */ + UINT32 loadErrno; /* load error number */ + } WTX_LOAD_PROGRESS_INFO; + +typedef enum wtx_load_command /* load sub-commands */ + { + LOAD_MODULE = 0, /* (async)load (start) */ + LOAD_UPLOAD = 1, /* upload object module */ + LOAD_PROGRESS = 2, /* get asynchronous load status */ + LOAD_CANCEL = 3, /* cancel an asynchronous load */ + LOAD_MODULE_DONE = 4 /* synchronous load done */ + } WTX_LOAD_COMMAND; + +typedef struct wtx_load_report_info /* progress info for async. loads */ + { + WTX_ASYNC_LOAD_STATE loadState; /* + * two values : + * LOAD_IN_PROGRESS : + * - informations available in + * WTX_LOAD_PROGRESS_INFO struct. + * LOAD_DONE : + * - informations available in + * WTX_MODULE_FILE_DESC struct. + */ + union state_info + { + WTX_MODULE_INFO moduleInfo; + WTX_LOAD_PROGRESS_INFO progressInfo; + } stateInfo; + } WTX_LOAD_REPORT_INFO; + +/* --------------------------- gopher tape ---------------------------------- */ + +typedef struct wtx_gopher_tape /* gopher tape */ + { + UINT16 len; /* length of tape */ + char * data; /* tape data */ + } WTX_GOPHER_TAPE; + +/* ---------------------------- disassembler -------------------------------- */ + +typedef struct wtx_dasm_inst_list /* instructions list */ + { + char * pInst; /* start of instructions list */ + UINT32 nextInst; /* next instruction address */ + UINT32 listSize; /* list size */ + } WTX_DASM_INST_LIST; + +/* ---------------------------- Event/Eventpoint ---------------------------- */ + +typedef struct wtx_action /* action descriptor */ + { + WTX_ACTION_TYPE actionType; /* action type to perform */ + UINT32 actionArg; /* action dependent argument */ + WTX_TGT_ADDR_T callRtn; /* function to ACTION_CALL */ + WTX_TGT_ARG_T callArg; /* function argument */ + } WTX_ACTION; + +typedef struct wtx_event_node /* WTX event node descriptor */ + { + struct wtx_event_desc event; /* event descriptor */ + struct wtx_event_node * pNext; /* pointer to the next event */ + } WTX_EVENT_NODE; + +typedef struct wtx_event /* target event */ + { + WTX_EVENT_TYPE eventType; /* type of event */ + UINT32 numArgs; /* number of arguments */ + WTX_TGT_ARG_T * args; /* list of arguments */ + } WTX_EVENT; + +typedef struct wtx_evtpt /* eventpoint descriptor */ + { + WTX_EVENT event; /* event to detect */ + WTX_CONTEXT context; /* context descriptor */ + WTX_ACTION action; /* action to perform */ + } WTX_EVTPT; + +typedef struct wtx_evtpt_info /* eventpoint information */ + { + WTX_EVTPT wtxEvtpt; /* eventpoint descriptor */ + WTX_TGT_ID_T toolId; /* tool identifier */ + UINT32 evtptNum; /* eventpoint identifier */ + void * pReserved1; /* reserved */ + void * pReserved2; /* reserved */ + } WTX_EVTPT_INFO; + +typedef struct wtx_evtpt_list /* eventpoint list message */ + { + UINT32 nEvtpt; /* number of eventpoints in list */ + WTX_EVTPT_INFO * pEvtptInfo; /* eventpoint information list */ + } WTX_EVTPT_LIST; + +/* ---------------------- Protection domain definitions --------------------- */ + +typedef struct wtx_pd_desc + { + WTX_TGT_ID_T pdId; /* protection domain ID */ + char * pdName; /* protection domain name */ + UINT32 pdFlags; /* protection domain flags */ + char * pdLinkPathStr; /* link path string */ + UINT32 pdLinkPathCount;/* number of PD in linkpath */ + WTX_TGT_ADDR_T * pdLinkPath; /* PD ids of the linkpath PDs */ + UINT32 pdAttachToCount; + WTX_TGT_ADDR_T * pdAttachTo; + } WTX_PD_DESC; + +typedef struct wtx_pd_desc_q /* WTX Protection Domain list */ + { + WTX_PD_DESC wtxPdDesc; /* PD descriptor */ + struct wtx_pd_desc_q * pNext; /* next PD in queue */ + } WTX_PD_DESC_Q; + +/* ---------------------- User service definitions ---------------------------*/ + +typedef struct wtx_usr_svc_add_info /* extra field for WTX_USR_SVC_ADD */ + { + WTX_TGT_INT_T func; /* routine associated with service */ + WTX_TGT_INT_T initRtn; /* init routine for the new service */ + WTX_TGT_INT_T initRtnArg; /* argument for init routine */ + } WTX_USR_SVC_ADD_INFO; + +typedef struct wtx_usr_svc_rem_info /* extra field for WTX_USR_SVC_REM */ + { + WTX_TGT_INT_T stopRtn; /* routine to call to stop the */ + /* command service */ + WTX_TGT_INT_T stopRtnArg; /* argument for stop command service */ + } WTX_USR_SVC_REM_INFO; + +typedef struct wtx_usr_svc_find_info /* extra field for WTX_USR_SVC_FIND */ + { + WTX_TGT_INT_T func; /* routine associated with service */ + } WTX_USR_SVC_FIND_INFO; + +typedef enum wtx_usr_svc_ctrl_cmd /* user service sub-commands */ + { + WTX_USR_SVC_ADD = 0, /* add a user service */ + WTX_USR_SVC_REMOVE = 1, /* remove a user service */ + WTX_USR_SVC_FIND = 2 /* find a user service */ + } WTX_USR_SVC_CTRL_CMD; + +/* ---------------------- Target Filesystem I/O ---------------------------*/ + +typedef enum wtx_tgtfs_inode_ctrl_cmd /* target filesystem sub-commands */ + { + WTX_TGTFS_MKDIR = 0, /* mkdir */ + WTX_TGTFS_RMDIR = 1, /* rmdir */ + WTX_TGTFS_MV = 2, /* rename */ + WTX_TGTFS_RM = 3, /* remove file */ + WTX_TGTFS_LINK = 4, /* link */ + WTX_TGTFS_CP = 5, /* local copy */ + WTX_TGTFS_MKNOD = 6, /* mknod */ + WTX_TGTFS_SYMLNK = 7, /* symlink */ + WTX_TGTFS_READDIR = 8, /* readdir */ + WTX_TGTFS_SETDIR = 9, /* Set current directory */ + WTX_TGTFS_GETDIR = 10, /* Get current directory */ + WTX_TGTFS_STAT = 11, /* Stat file */ + WTX_TGTFS_CHMOD = 12, /* Chmod */ + WTX_TGTFS_CHOWN = 13, /* Chown */ + WTX_TGTFS_LSTAT = 14, /* lstat */ + WTX_TGTFS_UMASK = 15, /* Umask */ + WTX_TGTFS_READLINK = 16 /* Readlink */ + } WTX_TGTFS_INODE_CTRL_CMD; + +typedef enum wtx_tgtfs_inode_ctrl_opt /* target filesystem commands options */ + { + WTX_TGTFS_OPT_READDIR_LONG = 1, /* Full informations on readdir */ + WTX_TGTFS_OPT_FOLLOW_LINK = 2 /* Follow links */ + } WTX_TGTFS_INODE_CTRL_OPT; + +typedef enum wtx_tgtfs_inode_mode_type + { + WTX_TGTFS_INODE_MODE_S_IFMT = 0170000, + WTX_TGTFS_INODE_MODE_S_IFSOCK = 0140000, + WTX_TGTFS_INODE_MODE_S_IFLNK = 0120000, + WTX_TGTFS_INODE_MODE_S_IFREG = 0100000, + WTX_TGTFS_INODE_MODE_S_IFBLK = 060000, + WTX_TGTFS_INODE_MODE_S_IFDIR = 040000, + WTX_TGTFS_INODE_MODE_S_IFCHR = 020000, + WTX_TGTFS_INODE_MODE_S_IFIFO = 010000, + WTX_TGTFS_INODE_MODE_S_ISUID = 04000, + WTX_TGTFS_INODE_MODE_S_ISGID = 02000, + WTX_TGTFS_INODE_MODE_S_ISVTX = 01000, + WTX_TGTFS_INODE_MODE_S_IRWXU = 0700, + WTX_TGTFS_INODE_MODE_S_IRUSR = 0400, + WTX_TGTFS_INODE_MODE_S_IWUSR = 0200, + WTX_TGTFS_INODE_MODE_S_IXUSR = 0100, + WTX_TGTFS_INODE_MODE_S_IRWXG = 070, + WTX_TGTFS_INODE_MODE_S_IRGRP = 040, + WTX_TGTFS_INODE_MODE_S_IWGRP = 020, + WTX_TGTFS_INODE_MODE_S_IXGRP = 010, + WTX_TGTFS_INODE_MODE_S_IRWXO = 07, + WTX_TGTFS_INODE_MODE_S_IROTH = 04, + WTX_TGTFS_INODE_MODE_S_IWOTH = 02, + WTX_TGTFS_INODE_MODE_S_IXOTH = 01 + } WTX_TGTFS_INODE_MODE_TYPE; + +typedef struct wtx_msg_tgtfs_inode_mkdir_desc + { + char * pathname; /* filename to UNIX convention */ + WTX_TGTFS_INODE_MODE_TYPE mode; + } WTX_MSG_TGTFS_INODE_MKDIR_DESC; + +typedef struct wtx_msg_tgtfs_inode_chmod_desc + { + char * pathname; /* filename to UNIX convention */ + WTX_TGTFS_INODE_MODE_TYPE mode; + } WTX_MSG_TGTFS_INODE_CHMOD_DESC; + +typedef struct wtx_msg_tgtfs_inode_chown_desc + { + char * pathname; /* filename to UNIX convention */ + UINT32 uid; + UINT32 gid; + } WTX_MSG_TGTFS_INODE_CHOWN_DESC; + +typedef struct wtx_msg_tgtfs_inode_rmdir_desc + { + char * pathname; /* filename to UNIX convention */ + } WTX_MSG_TGTFS_INODE_RMDIR_DESC; + +typedef struct wtx_msg_tgtfs_inode_mv_desc + { + char * oldPath; + char * newPath; + } WTX_MSG_TGTFS_INODE_MV_DESC; + +typedef struct wtx_msg_tgtfs_inode_rm_desc + { + char * pathname; /* filename to UNIX convention */ + } WTX_MSG_TGTFS_INODE_RM_DESC; + +typedef struct wtx_msg_tgtfs_inode_link_desc + { + char * oldPath; + char * newPath; + } WTX_MSG_TGTFS_INODE_LINK_DESC; + +typedef struct wtx_msg_tgtfs_inode_cp_desc + { + char * oldPath; + char * newPath; + UINT32 copyOpt; + } WTX_MSG_TGTFS_INODE_CP_DESC; + +typedef struct wtx_msg_tgtfs_inode_mknod_desc + { + char * pathname; + WTX_TGTFS_INODE_MODE_TYPE mode; + UINT32 major; + UINT32 minor; + } WTX_MSG_TGTFS_INODE_MKNOD_DESC; + +typedef struct wtx_msg_tgtfs_inode_readdir_desc + { + char * pathname; + } WTX_MSG_TGTFS_INODE_READDIR_DESC; + +typedef struct wtx_msg_tgtfs_inode_setdir_desc + { + char * pathname; + } WTX_MSG_TGTFS_INODE_SETDIR_DESC; + +typedef struct wtx_msg_tgtfs_inode_stat_res + { + UINT32 st_dev[2]; + UINT32 st_inode; + WTX_TGTFS_INODE_MODE_TYPE st_mode; + UINT32 st_nlink; + UINT32 st_uid; + UINT32 st_gid; + UINT32 st_rdev[2]; + UINT32 st_size; + UINT32 st_blksize; + UINT32 st_blocks; + UINT32 st_atim; + UINT32 st_mtim; + UINT32 st_ctim; + } WTX_TGTFS_INODE_STAT_RES; + +typedef struct wtx_msg_tgtfs_inode_readdir_res + { + char * dname; + struct wtx_msg_tgtfs_inode_stat_res *pStat; + struct wtx_msg_tgtfs_inode_readdir_res *next; + } WTX_TGTFS_INODE_READDIR_RES; + +typedef struct wtx_msg_tgtfs_inode_readdir_list + { + WTX_TGTFS_INODE_READDIR_RES * pDir; + UINT32 count; + } WTX_TGTFS_INODE_READDIR_LIST; + +typedef struct wtx_msg_tgtfs_inode_stat_desc + { + char * pathname; + } WTX_MSG_TGTFS_INODE_STAT_DESC; + +typedef struct wtx_msg_tgtfs_inode_umask_desc + { + WTX_TGTFS_INODE_MODE_TYPE umask; + } WTX_MSG_TGTFS_INODE_UMASK_DESC; + +typedef struct wtx_msg_tgtfs_inode_readlink_desc + { + char * pathname; + } WTX_MSG_TGTFS_INODE_READLINK_DESC; + +/* ---------------------- Threads / PD (Added for Bsd/OS) --------------------*/ +typedef struct wtx_task_desc + { + WTX_TGT_ID_T taskId; + WTX_CONTEXT_STATUS taskStatus; + } WTX_TASK_DESC; + +typedef struct wtx_tasks_info_desc + { + UINT32 nTasks; /* Number of tasks */ + WTX_TASK_DESC * pTask; /* Tasks description */ + } WTX_TASKS_INFO_DESC; + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwtxtypesh */ diff --git a/h/wtxxdr.h b/h/wtxxdr.h new file mode 100644 index 0000000..3d90e8d --- /dev/null +++ b/h/wtxxdr.h @@ -0,0 +1,557 @@ +/* wtxxdr.h - wtx xdr header file */ + +/* Copyright 1984-1999 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02m,13dec02,p_b changed TGT_XXX by WTX_TGT_XXX +02l,22jan02,x_p Added wtxPdInfoSet /wtxPdInfoGet +02k,27nov01,x_p Threads handling +02j,21nov01,c_c Changedrpc include location. +02i,22aug01,x_p Bsd/OS adaptation (Merge from pil1_x) +02h,20jan00,dbt Added xdr_WTX_MSG_USR_SVC_CTRL_INFO prototype. +02g,21oct99,p_b removed WTX_MSG_SERVICE_DESC WTX_MSG_CONSOLE_DESC +02f,13oct99,fle made some of the XDR filters visible for WTX 2.0 bacward + compatibility +02e,06sep99,fle added new XDR filters declarations for + WTX_MSG_REG_TGTSVR_ACTION and WTX_MSG_REG_LOG_ACTION new + services +02d,06jul99,c_c Added wtxMsgContextKill +02c,05jul99,p_b Added xdr_WTX_MSG_MOD_MATCH_DESC. +02b,05jul99,c_c Implemented PD context definition. +02a,29jun99,fle added xdr_WTX_MSG_PD_LIST XDR filter declaration +01z,14jun99,fle added xdr_WTX_MSG_PARAM_WITH_PD declaration +01y,01jun99,fle removed all _2 references for new WTX protocol model +01x,12feb99,dbt include wtxmsg.h header file since we use types declared in + this file. +01w,18aug98,pcn Re-use WTX_MSG_EVTPT_LIST_2. +01v,20jul98,pcn Added evtptNum and toolId in the wtxEventpointListGet return + list. +01u,26may98,pcn Changed WTX_MSG_EVTPT_LIST_2 in WTX_MSG_EVTPT_LIST_GET. +01t,02mar98,pcn WTX 2: added xdr_WTX_EVENT_NODE, xdr_WTX_MSG_EVENT_LIST, + xdr_WTX_LD_M_FILE_DESC, xdr_WTX_MSG_FILE_LOAD_DESC, + xdr_MEM_WIDTH_COPY_ALLOC, xdr_WTX_MSG_MEM_WIDTH_READ_DESC, + xdr_WTX_MSG_MEM_WIDTH_COPY_DESC, xdr_WTX_EVENT_2, + xdr_WTX_EVTPT_2, xdr_WTX_MSG_EVTPT_DESC_2, + xdr_WTX_MSG_EVTPT_LIST_2. +01s,29aug97,fle Adding the WTX_MEM_DISASSEMBLE service. i.e. adding + xdr_WTX_MSG_DASM_DESC and xdr_WTX_MSG_DASM_INST_LIST routines +01s,22aug97,c_c Try to remove warnings during compilation. +01r,30sep96,elp put in share/src/wtx (SPR# 6775). +01q,02feb96,elp added declaration of xdr_WTX_TGT_ADDR_T(). +01p,01jun95,p_m removed xdr_WTX_MSG_CALL_PARAM. +01o,30may95,pad don't include rpc/rpc.h for PARISC_HPUX9. +01n,30may95,p_m completed WTX_MEM_SCAN and WTX_MEM_MOVE implementation. +01m,23may95,p_m made missing name changes. +01l,22may95,jcf name revision. +01k,16may95,p_m added xdr_WTX_MSG_KILL_DESC(). +01j,09may95,p_m re-implemented wtxregd related XDR procedures. + removed unneeded prototypes. +01i,04may95,s_w change include of rpc/rpc.h to wtxrpc.h +01h,24mar95,p_m added xdr_WTX_MSG_MEM_BLOCK_DESC. +01g,16mar95,p_m added xdr_WTX_MSG_VIO_FILE_LIST. +01f,03mar95,p_m added xdr_WTX_MSG_GOPHER_TAPE. +01e,27feb95,p_m added xdr_WTX_MSG_MEM_SCAN_DESC. +01d,25feb95,jcf added xdr_WTX_MSG_TS_[UN]LOCK. +01c,15feb95,p_m changed names to xdr_WTX_MSG and added xdr routines + to suppress coupling with WDB xdr routines. + added #include . +01b,31jan95,p_m added xdr_WTX_MEM_XFER(), xdr_WTX_REG_WRITE() and + xdr_WTX_MEM_SET_DESC(). +01a,15jan95,p_m written. +*/ + +#ifndef __INCwtxxdrh +#define __INCwtxxdrh 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#include "rpc/rpc.h" +#include "wtxmsg.h" + + +/* function declarations */ + +/* ------------ XDR internal for WTX 2.0 backward compatibility ------------- */ + +extern bool_t xdr_WRAPSTRING /* XDR string filter */ + ( + XDR * xdrs, /* XDR information */ + char ** string /* string to transfer */ + ); + +extern bool_t xdr_WTX_VALUE /* transfers a wtx value through XDR */ + ( + XDR * xdrs, /* XDR information */ + WTX_VALUE * objp /* pointer to wtx value to transfer */ + ); + +extern bool_t xdr_WTX_SVR_DESC /* wtx server desc XDR filter */ + ( + XDR * xdrs, /* XDR information */ + WTX_SVR_DESC * objp /* wtx server desc to transfer */ + ); + +extern bool_t xdr_WTX_SVR_DESC_Q /* wtx server queue XDR filter */ + ( + XDR * xdrs, /* XDR information */ + WTX_SVR_DESC_Q * objp /* wtx server desc queue to transfer */ + ); + +/* -------------------------------------------------------------------------- */ + +extern bool_t xdr_WTX_TGT_ADDR_T /* transfer a WTX_TGT_ADDR_T data */ + ( + XDR * xdrs, /* XDR information */ + WTX_TGT_ADDR_T * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_TOOL_ID /* transfer a WTX_MSG_TOOL_ID data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_TOOL_ID * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_TOOL_DESC /* tranfer a WTX_MSG_TOOL_DESC data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_TOOL_DESC * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_RESULT /* transfer a WTX_MSG_RESULT data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_RESULT * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_PARAM /* transfer a WTX_MSG_PARAM data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_PARAM * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_PARAM_WITH_PD /* transfer a WTX_MSG_PARAM_WITH_PD */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_PARAM_WITH_PD * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_PD_DESC_Q /* transfers a PD list message */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_PD_DESC_Q * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_TS_INFO /* tranfer a WTX_MSG_TS_INFO data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_TS_INFO * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_TS_LOCK /* transfer a WTX_MSG_TS_LOCK data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_TS_LOCK * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_TS_UNLOCK /* transfer a WTX_MSG_TS_UNLOCK data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_TS_UNLOCK * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_EVTPT_LIST /* transfer a WTX_MSG_EVTPT_LIST data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_EVTPT_LIST * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_SYM_TBL_INFO /* transfer WTX_MSG_SYM_TBL_INFO data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_SYM_TBL_INFO * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_SYMBOL_DESC /* transfer WTX_MSG_SYMBOL_DESC data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_SYMBOL_DESC * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_SYM_LIST /* transfer a WTX_MSG_SYM_LIST data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_SYM_LIST * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_SYM_MATCH_DESC /* WTX_MSG_SYM_MATCH_DESC xdr */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_SYM_MATCH_DESC * objp /* criteria struct */ + ); + +extern bool_t xdr_WTX_MSG_MOD_MATCH_DESC /* WTX_MSG_SYM_MATCH_DESC xdr */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_MOD_MATCH_DESC * objp /* criteria struct */ + ); + +extern bool_t xdr_WTX_MSG_VIO_CTL_DESC /* tranfer WTX_MSG_VIO_CTL_DESC data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_VIO_CTL_DESC * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_OPEN_DESC /* tranfer WTX_MSG_OPEN_DESC */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_OPEN_DESC * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_VIO_COPY_DESC /* transfer WTX_MSG_VIO_COPY_DESC data*/ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_VIO_COPY_DESC * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_VIO_FILE_LIST /* transfer WTX_MSG_VIO_FILE_LIST data*/ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_VIO_FILE_LIST * objp /* pointer to object to transfer */ + ); + + +extern bool_t xdr_WTX_MSG_FILE_LOAD_DESC /* WTX_MSG_FILE_LOAD_DESC xdr */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_FILE_LOAD_DESC * objp /* pointer to obj to transfer */ + ); + +extern bool_t xdr_WTX_MSG_MODULE_LIST /* transfer WTX_MSG_MODULE_LIST data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_MODULE_LIST * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_MODULE_INFO /* transfer WTX_MSG_MODULE_INFO data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_MODULE_INFO * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_MOD_NAME_OR_ID /* WTX_MSG_MOD_NAME_OR_ID xdr */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_MOD_NAME_OR_ID * objp /* pointer to obj to transfer */ + ); + +extern bool_t xdr_WTX_TASK_CONTEXT_DEF /* transfer WTX_TASK_CONTEXT_DEF data */ + ( + XDR * xdrs, /* xdr handle */ + WTX_TASK_CONTEXT_DEF * objp + ); + +extern bool_t xdr_WTX_PD_CONTEXT_DEF /* transfer WTX_PD_CONTEXT_DEF data */ + ( + XDR * xdrs, /* xdr handle */ + WTX_PD_CONTEXT_DEF * objp /* protection domain definition */ + ); + +extern bool_t xdr_WTX_CONTEXT_DESC /* transfer WTX_CONTEXT_DESC data */ + ( + XDR * xdrs, /* xdr handle */ + WTX_CONTEXT_DESC * objp /* context query desc */ + ); + +extern bool_t xdr_WTX_MSG_CONTEXT_DESC /* transfer WTX_MSG_CONTEXT_DESC data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_CONTEXT_DESC * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_KILL_CONTEXT /* transfer WTX_MSG_KILL_CONTEXT data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_KILL_CONTEXT * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_CONTEXT /* transfer WTX_MSG_CONTEXT data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_CONTEXT * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_CONTEXT_STEP_DESC /* WTX_MSG_CONTEXT_STEP_DESC */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_CONTEXT_STEP_DESC * objp /* pointer to obj to transfer */ + ); + + +extern bool_t xdr_WTX_MSG_EVENT_DESC /* transfer WTX_MSG_EVENT_DESC data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_EVENT_DESC * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_EVENT_LIST /* transfer WTX_MSG_EVENT_LIST data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_EVENT_LIST * objp /* pointer to object to transfert */ + ); + +extern bool_t xdr_WTX_MSG_EVENT_REG_DESC /* WTX_MSG_EVENT_REG_DESC xdr */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_EVENT_REG_DESC * objp /* pointer to obj to transfer */ + ); + +extern bool_t xdr_WTX_MSG_EVTPT_DESC /* transfer WTX_MSG_EVTPT_DESC data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_EVTPT_DESC * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_FILE_LOAD_DESC /* WTX_MSG_FILE_LOAD_DESC xdr */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_FILE_LOAD_DESC * objp /* pointer to the object to */ + /* transfer */ + ); + +extern bool_t xdr_WTX_MSG_FILE_LOAD_DESC /* transfer WTX_MSG_FILE_LOAD_DESC */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_FILE_LOAD_DESC * objp /* pointer to the object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_KILL_DESC /* transfer WTX_MSG_KILL_DESC data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_KILL_DESC * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_MEM_INFO /* transfer WTX_MSG_MEM_INFO data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_MEM_INFO * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_MEM_COPY_ALLOC /* transfer WTX_MSG_MEM_COPY_DESC data*/ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_MEM_COPY_DESC * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_MEM_XFER_DESC /* transfer WTX_MSG_MEM_XFER_DESC data*/ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_MEM_XFER_DESC * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_MEM_SCAN_DESC /* transfer WTX_MSG_MEM_SCAN_DESC data*/ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_MEM_SCAN_DESC * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_MEM_MOVE_DESC /* transfer WTX_MSG_MEM_MOVE_DESC data*/ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_MEM_MOVE_DESC * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_MEM_SET_DESC /* transfer WTX_MSG_MEM_SET_DESC data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_MEM_SET_DESC * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_MEM_COPY_DESC /* transfer WTX_MSG_MEM_COPY_DESC data*/ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_MEM_COPY_DESC * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_MEM_BLOCK_DESC /* WTX_MSG_MEM_BLOCK_DESC xdr */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_MEM_BLOCK_DESC * objp /* pointer to obj to transfer */ + ); + +extern bool_t xdr_WTX_MSG_DASM_DESC /* transfer WTX_MSG_DASM_DESC data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_DASM_DESC * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_DASM_INST_LIST /* WTX_MSG_DASM_INST_LIST xdr */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_DASM_INST_LIST * objp /* pointer to obj to transfer */ + ); + + +extern bool_t xdr_WTX_MSG_REG_WRITE /* transfer WTX_MSG_REG_WRITE data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_REG_WRITE * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_REG_READ /* transfer WTX_MSG_REG_READ data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_REG_READ * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_GOPHER_TAPE /* transfer WTX_MSG_GOPHER_TAPE data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_GOPHER_TAPE * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_CORE /* transfer WTX_CORE data */ + ( + XDR * xdrs, /* XDR information */ + WTX_CORE * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_SVR_DESC /* transfer WTX_MSG_SVR_DESC data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_SVR_DESC * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_SVR_DESC_Q /* transfer WTX_MSG_SVR_DESC_Q data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_SVR_DESC_Q * objp /* pointer to object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_WTXREGD_PATTERN /* WTX_MSG_WTXREGD_PATTERN xdr*/ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_WTXREGD_PATTERN * objp /* pointer to obj to transfer */ + ); + +extern bool_t xdr_WTX_EVENT /* transfer WTX_EVENT data */ + ( + XDR * xdrs, /* XDR information */ + WTX_EVENT * objp /* pointer to the object to transfer */ + ); + +extern bool_t xdr_WTX_EVTPT /* transfer WTX_EVTPT data */ + ( + XDR * xdrs, /* XDR information */ + WTX_EVTPT * objp /* pointer to the object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_EVTPT_DESC /* transfer WTX_MSG_EVTPT_DESC data */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_EVTPT_DESC * objp /* pointer to the object to transfer */ + ); + +extern bool_t xdr_WTX_EVTPT_INFO /* transfer WTX_EVTPT_INFO data */ + ( + XDR * xdrs, /* XDR information */ + WTX_EVTPT_INFO * objp /* Pointer to the object to transfer */ + ); + +extern bool_t xdr_WTX_MSG_EVTPT_LIST /* transfer WTX_MSG_EVTPT_LIST */ + ( + XDR * xdrs, /* XDR information */ + WTX_MSG_EVTPT_LIST * objp /* pointer to the object to transfer */ + ); + +/* ----------------------- registry messages filters ------------------------ */ + +extern bool_t xdr_WTX_MSG_DESC_Q /* filter a registry desc queue msg */ + ( + XDR * xdrs, /* xdrs to use to transfer message */ + WTX_MSG_DESC_Q * objp /* registry returned info queue */ + ); + +extern bool_t xdr_WTX_MSG_TGTSVR_ACTION /* filter tgtsvr action */ + ( + XDR * xdrs, /* xdrs to use to transfer message */ + WTX_MSG_TGTSVR_ACTION * objp /* target server action message */ + ); + +extern bool_t xdr_WTX_MSG_WTXREGD_LOG /* wtxregd log filter */ + ( + XDR * xdrs, /* xdrs to use to transfer message */ + WTX_MSG_WTXREGD_LOG * objp /* registry log action message */ + ); + +extern bool_t xdr_WTX_MSG_WTXREGD_INFO /* wtxregd info message filter */ + ( + XDR * xdrs, /* xdrs to use to transfer message */ + WTX_MSG_WTXREGD_INFO * objp /* registry info message to transfer */ + ); + +extern bool_t xdr_WTX_MSG_WTXREGD_ITEM /* wtxregd item message filter */ + ( + XDR * xdrs, /* xdrs to use to transfer message */ + WTX_MSG_WTXREGD_ITEM * objp /* registry item message to transfer */ + ); + +extern BOOL xdr_WTX_MSG_USR_SVC_CTRL_INFO + ( + XDR * xdrs, /* xdr handle */ + WTX_MSG_USR_SVC_CTRL_INFO * objp /* pointer to the object to process */ + ); + +/* ----------------------- Target File messages filters ------------------------ */ +extern BOOL xdr_WTX_MSG_TARGET_FILE_COPY_DESC + ( + XDR * xdrs, /* xdr handle */ + WTX_MSG_TARGET_FILE_COPY_DESC * objp /* pointer to the object to process */ + ); + +extern BOOL xdr_WTX_MSG_TARGET_FILE_REMOVE_DESC + ( + XDR * xdrs, /* xdr handle */ + WTX_MSG_TARGET_FILE_REMOVE_DESC * objp /* pointer to the object to process */ + ); + +/* ----------------------- Target Filesystem ios filters ------------------- */ +extern BOOL xdr_WTX_MSG_TGTFS_INODE_CTRL_INFO + ( + XDR * xdrs, /* xdr handle */ + WTX_MSG_TGTFS_INODE_CTRL_INFO * objp /* pointer to the object to process */ + ); + +extern BOOL xdr_WTX_MSG_TGTFS_INODE_CTRL_RESULT + ( + XDR * xdrs, + WTX_MSG_TGTFS_INODE_CTRL_RESULT * objp + ); + +/* ----------------------- Threads (PD / TASKS) --------------------------- */ +extern BOOL xdr_WTX_MSG_TASKS_INFO_DESC + ( + XDR * xdrs, /* xdr handle */ + WTX_MSG_TASKS_INFO_DESC * objp + ); + +extern BOOL xdr_WTX_MSG_PD_INFO_SET_DESC + ( + XDR * xdrs, /* xdr handle */ + WTX_MSG_PD_INFO_SET_DESC * objp + ); + +extern BOOL xdr_WTX_MSG_PD_INFO_GET_DESC + ( + XDR * xdrs, /* xdr handle */ + WTX_MSG_PD_INFO_GET_DESC * objp + ); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwtxxdrh */ diff --git a/h/wvLib.h b/h/wvLib.h new file mode 100644 index 0000000..43831fc --- /dev/null +++ b/h/wvLib.h @@ -0,0 +1,150 @@ +/* wvLib.h - event log header */ + +/* Copyright 1994-2004 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01x,29apr04,ymz added definition of wvSalInst. +01x,25mar04,tcr add wvObjInstModeSet(), backward compatible OBJ_ defines +01w,05nov03,tcr add parameter to wvObjNameBuffAdd() +01v,17oct03,tcr code review changes +01u,15oct03,tcr add wvAllObjsSet() prototype; change INSTRUMENT_xx defines + change prototype for wvObjInst() and similar +01t,01oct03,tcr wvEvtLogStart() verifies evtBuffer; add wvLogCountGet() +01s,18sep03,tcr modify prototypes +01r,10sep03,tcr change prototype of wvObjInst(), fix obj type defines +01q,17jul03,tcr make hash table more generic, base6 changes +01p,13may98,cth added protype for wvUploadTaskConfig +01o,20apr98,cth added protypes for wvLogHeaderCreate/Upload, modified + wvEvtLogInit definition, changed wvUploadTaskPriority to 01l +01n,17apr98,cth changed prototype of wvEvtLogInit +01m,15apr98,cth added prototypes for task name storage, and wvEvtBufferGet, + renamed wvContinuousUploadStop to wvUploadStop +01l,17mar98,pr added memory instrumentation support +01k,27jan98,cth added wvEvtLogInit function declaration, updated copyright +01j,18dec97,cth removed temporary references used for WV2.0 integration, + updated include files, removed wvOn/Off, fixed prototypes +01i,16nov97,cth more work for WindView 2.0 +01h,30jul97,nps major rework for WindView 2.0. +01g,08mar94,smb changed prototype for OSE functionality + removed PASSIVE_MODE +01f,04mar94,smb changed prototype for wvHostInfoInit (SPR #3089) +01e,22feb94,smb changed typedef EVENT_TYPE to event_t (SPR #3064) +01d,15feb94,smb renamed collection modes +01c,19jan94,smb removed wvEvtLog, added wvEvtLogEnable and wvEvtLogEnable + removed ALL_LEVELS and changed OBJECT_STATE to OBJECT_STATUS + added wvOn(), wvOff(), and wvEvtLogStop(). +01b,30dec93,c_s changed prototype of wvServerInit (). SPR #2790. +01a,10dec93,smb written. +*/ + +#ifndef __INCwvlibh +#define __INCwvlibh + +#include "vxWorks.h" + +#include "rBuffLib.h" + +#include "private/wvLibP.h" +#include "private/wvBufferP.h" +#include "private/wvUploadPathP.h" + +#include "private/eventP.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/* defines */ + +/* define the old object types in terms of the new ones */ + +#define OBJ_TASK windTaskClass /* task objects */ +#define OBJ_SEM windSemClass /* semaphore objects */ +#define OBJ_MSG windMsgQClass /* message queue objects */ +#define OBJ_WD windWdClass /* watch-dog timer objects */ +#define OBJ_MEM windMemPartClass /* memory objects */ + + +#define INSTRUMENT_OFF 0 /* create objects with instrumentation off */ +#define INSTRUMENT_ON 1 /* create objects with instrumentation on */ + + +/* types */ + +typedef struct wvUploadTaskDescriptor * WV_UPLOADTASK_ID; + +/* globals */ + +extern char * wvLogMsgString1; +extern char * wvLogMsgString2; +extern char * wvUploadName; + +extern int wvMaximumLogs; + +extern FUNCPTR _func_wvOnUploadPathCreate; +extern FUNCPTR _func_wvOnUploadPathClose; + +/* function declarations */ + +extern void wvLibInit (void); +extern void wvLibInit2 (void); +extern STATUS wvEvtLogInit (WV_LOG * pWvLog); + +extern STATUS wvEvtLogStart (void); +extern void wvEvtLogStop (void); + +extern void wvEvtClassSet (UINT32 classDescription); +extern UINT32 wvEvtClassGet (void); +extern void wvEvtClassClear (UINT32 classDescription); +extern void wvEvtClassClearAll (void); +extern int wvObjInst (enum windObjClassType type, void *objId, + BOOL evtLoggingOn); +extern int wvEventInst (int mode); +extern int wvSigInst (int mode); +extern int wvSalInst (int mode); +extern void wvAllObjsSet (int mode); +extern STATUS wvObjInstModeSet (int mode); + + + +extern BUFFER_ID wvEvtBufferGet (void); +extern void wvUploadTaskConfig (int stackSize, int priority); +extern STATUS wvUploadStop (WV_UPLOADTASK_ID upTaskId); +extern WV_UPLOADTASK_ID wvUploadStart (WV_LOG * bufId, UPLOAD_ID pathId, + BOOL uploadContinuously); + +extern PART_ID wvPartitionGet (void); +extern void wvPartitionSet (PART_ID part); + +extern WV_LOG_LIST * wvCurrentLogListGet (void); +extern void wvCurrentLogListSet (WV_LOG_LIST * pWvLogList); + +extern WV_LOG * wvLogCreate (BUFFER_ID evtBuffer); +extern STATUS wvLogDelete (WV_LOG_LIST * pWvLogList, + WV_LOG * pWvLog); +extern WV_LOG * wvCurrentLogGet (void); +extern void wvCurrentLogSet (WV_LOG * pWvLog); + +extern WV_LOG * wvLogFirstGet (void); +extern WV_LOG * wvLogNextGet (WV_LOG * pWvLog); +extern int wvLogCountGet (void); + + + +extern WV_LOG_LIST * wvLogListCreate (void); +extern STATUS wvLogListDelete (WV_LOG_LIST * pLogList); + + +extern STATUS wvEvent (event_t usrEventId, char *buffer, + size_t bufSize); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwvlibh*/ + diff --git a/h/wvNetLib.h b/h/wvNetLib.h new file mode 100644 index 0000000..bf50b3e --- /dev/null +++ b/h/wvNetLib.h @@ -0,0 +1,1032 @@ +/* wvNetLib.h - header file for WindView networking events */ + +/* Copyright 1984 - 2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,20feb01,ham added declaration of wvNetInit() (SPR #63241). +01a,12jan00,spm written +*/ + +#ifndef __INCwvNetLibh +#define __INCwvNetLibh + +#ifdef __cplusplus +extern "C" { +#endif + +#include "private/eventP.h" /* Macros for testing WindView status. */ +#include "private/wvNetEventP.h" /* Macros to generate networking events. */ + +typedef struct eventmask + { + UCHAR bitmap [8]; /* Map indicating selection status of events. */ + } +EVENT_MASK; + +IMPORT UCHAR wvNetLevel; +IMPORT UCHAR wvNetFilterId; +IMPORT EVENT_MASK * pWvNetEventMap; + +#define WV_NET_ID 0x30 /* + * Arbitrary 8-bit prefix for + * network subsystem events. + */ + +/* + * Class definitions - move to private/eventP.h when WindView 2.0 changes + * are visible with tor2_0_x cspec. + */ + +#define WV_NET_CORE_CLASS 0x00000008 /* Core network events */ +#define WV_NET_AUX_CLASS 0x00000010 /* Auxiliary network events */ + +#define NET_CORE_EVENT WV_NET_CORE_CLASS +#define NET_AUX_EVENT WV_NET_AUX_CLASS + +/* + * The WV_BLOCK_START macro prevents wasted cycles by determining if + * WindView is running and if the given class has been selected. It + * provides a header before any code which reports network events to + * WindView. The classId is either NET_CORE_EVENT or NET_AUX_EVENT. + */ + +#define WV_BLOCK_START(classId) \ + if (ACTION_IS_SET) \ + { \ + if (WV_EVTCLASS_IS_SET (classId | WV_ON)) \ + { + +/* + * The WV_BLOCK_END provides a footer for all code which reports network + * events to WindView. It closes the open scopes caused by WV_BLOCK_START. + * The classId parameter is not used, but is included for symmetry. + */ + +#define WV_BLOCK_END(classId) \ + } \ + } + +/* + * The WV_NET_ADDR_FILTER_TEST and WV_NET_PORT_FILTER_TEST macros will check + * the given data against predefined address or port numbers by calling the + * appropriate routine. Each macro is only valid within a test conditional. + */ + +#define WV_NET_ADDR_FILTER_TEST(filterType,targetType,srcAddr,dstAddr) \ + wvNetAddressFilterTest (filterType, targetType, srcAddr, dstAddr) + +#define WV_NET_PORT_FILTER_TEST(filterType, srcPort, dstPort) \ + wvNetPortFilterTest (filterType, srcPort, dstPort) + +/* + * The WV_NET_EVENT_SET macro constructs a WindView event identifier using + * the following structure: + * + * ::::: + * (8 bits) (8 bits) (4 bits) (2 bits) (2 bits) (8 bits) + * + * The first 20 bits are intended for use when instrumenting any VxWorks + * module. The three fields indicate the VxWorks subsystem, library, and + * event priority values. The component ID is a fixed value for all networking + * code, and the remaining two fields use the constants defined below. The + * final 12 bits apply specifically to networking events. The first two fields + * encode the transmission direction and packet filter for the event, if + * applicable. The packet filter type is assigned using a local variable + * defined within each module. The final field is a unique identifier for + * each event within a given module. Currently, this organization of event + * identifiers is ignored by the host-based parser, but it may be used for + * refined event filtering someday. + * + * The resulting event identifier is stored in the ULONG variable wvNetEventId. + * It is only valid in a scope where that variable exists. The macro also + * references variables for the "Module ID" and "Filter ID" fields so that the + * parameters only supply values for the event priority, transmission + * direction and event tag, all of which change frequently. + */ + +#define WV_NET_EVENT_SET(eventLevel,status,tag) \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (status << 10) \ + | (wvNetLocalFilter << 8) | tag + +/* + * The WV_NET_MARKER_SET macro constructs identifiers for events which do + * not involve data transfer. It is a special case of the WV_NET_EVENT_SET + * macro which omits one parameter since the transmission direction (i.e. - + * status) field is always 0. + */ + +#define WV_NET_MARKER_SET(eventLevel,tag) \ + wvNetEventId = (WV_NET_ID << 24) | (wvNetModuleId << 16) \ + | (eventLevel << 12) | (wvNetLocalFilter << 8) | tag + +#define WV_NET_NONE 0 /* Placeholder for any unused event fields. */ + +/* 8-bit component identifiers (unused alternatives to WV_NET_ID). */ + +#define WV_NET_CORE_BLOCK 0 /* Unscalable network processing. */ +#define WV_NET_ICMP_BLOCK 1 /* ICMP protocol */ +#define WV_NET_IGMP_BLOCK 2 /* IGMP protocol */ +#define WV_NET_UDP_BLOCK 3 /* UDP protocol */ +#define WV_NET_TCP_BLOCK 4 /* TCP protocol */ + +/* 8-bit module identifiers */ + + /* module identifiers for netinet directory */ + +#define WV_NET_IF_MODULE 0 /* if.c source file */ +#define WV_NET_IFETHER_MODULE 1 /* if_ether.c source file */ +#define WV_NET_IFSUBR_MODULE 2 /* if_subr.c source file */ +#define WV_NET_IGMP_MODULE 3 /* igmp.c source file */ +#define WV_NET_IN_MODULE 4 /* in.c source file */ +#define WV_NET_INCKSUM_MODULE 5 /* in_cksum.c source file */ +#define WV_NET_INPCB_MODULE 6 /* in_pcb.c source file */ +#define WV_NET_INPROTO_MODULE 7 /* in_proto.c source file */ +#define WV_NET_IPICMP_MODULE 8 /* ip_icmp.c source file */ +#define WV_NET_IPINPUT_MODULE 9 /* ip_input.c source file */ +#define WV_NET_IPMROUTE_MODULE 10 /* ip_mroute.c source file */ +#define WV_NET_IPOUTPUT_MODULE 11 /* ip_output.c source file */ +#define WV_NET_RADIX_MODULE 12 /* radix.c source file */ +#define WV_NET_RAWCB_MODULE 13 /* raw_cb.c source file */ +#define WV_NET_RAWIP_MODULE 14 /* raw_ip.c source file */ +#define WV_NET_RAWREQ_MODULE 15 /* raw_usrreq.c source file */ +#define WV_NET_ROUTE_MODULE 16 /* route.c source file */ +#define WV_NET_RTSOCK_MODULE 17 /* rtsock.c source file */ +#define WV_NET_SLCOMP_MODULE 18 /* sl_compress.c source file */ +#define WV_NET_SYSSOCK_MODULE 19 /* sys_socket.c source file */ +#define WV_NET_TCPDEBUG_MODULE 20 /* tcp_debug.c source file */ +#define WV_NET_TCPINPUT_MODULE 21 /* tcp_input.c source file */ +#define WV_NET_TCPOUT_MODULE 22 /* tcp_output.c source file */ +#define WV_NET_TCPSUBR_MODULE 23 /* tcp_subr.c source file */ +#define WV_NET_TCPTIMER_MODULE 24 /* tcp_timer.c source file */ +#define WV_NET_TCPREQ_MODULE 25 /* tcp_usrreq.c source file */ +#define WV_NET_UDPREQ_MODULE 26 /* udp_usrreq.c source file */ +#define WV_NET_UIDOM_MODULE 27 /* uipc_dom.c source file */ +#define WV_NET_UIMBUF_MODULE 28 /* uipc_mbuf.c source file */ +#define WV_NET_UISOCK_MODULE 29 /* uipc_sock.c source file */ +#define WV_NET_UISOCK2_MODULE 30 /* uipc_sock2.c source file */ +#define WV_NET_UNIXLIB_MODULE 31 /* unixLib.c source file */ + + /* module identifiers for netwrs directory */ + +#define WV_NET_IPPROTO_MODULE 32 /* ipProto.c source file */ + +/* + * 4-bit level identifiers for event priority. The user can block + * all event reporting even if WindView is active and a network class + * is set by specifying the WV_NET_NONE constant in a call to the + * wvNetLevelSet() routine. That "priority" is not used by any events. + */ + +#define WV_NET_EMERGENCY 1 +#define WV_NET_ALERT 2 +#define WV_NET_CRITICAL 3 +#define WV_NET_ERROR 4 +#define WV_NET_WARNING 5 +#define WV_NET_NOTICE 6 +#define WV_NET_INFO 7 +#define WV_NET_VERBOSE 8 + +/* Data transfer status (WV_NET_NONE is used if not applicable). */ + +#define WV_NET_SEND 1 +#define WV_NET_RECV 2 + +/* OSI protocol layer for event (WV_NET_NONE is used for other processing). */ + +#define WV_NET_NETWORK 1 +#define WV_NET_TRANSPORT 2 +#define WV_NET_SESSION 3 +#define WV_NET_APP 4 + +/* Packet filter for event (or WV_NET_NONE if unfiltered). */ + +#define WV_NET_SADDR_FILTER 1 /* Source address comparison */ +#define WV_NET_DADDR_FILTER 2 /* Destination address comparison */ +#define WV_NET_SPORT_FILTER 3 /* Source port comparison */ +#define WV_NET_DPORT_FILTER 4 /* Destination port comparison */ +#define WV_NET_SOCK_FILTER 5 /* Socket value comparison */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern void wvNetInit (void); +extern void wvNetEnable (int); +extern void wvNetDisable (void); + +#else /* __STDC__ */ + +extern void wvNetInit (); +extern void wvNetEnable (); +extern void wvNetDisable (); + +#endif /* __STDC__ */ + + +/* + * Individual Events. All events contain the integer parameter + * wvNetEventId as their first argument. Additional parameters, + * if any, are listed with each event. + */ + +/* The following events are defined in if.c */ + +#define WV_NETEVENT_IFINIT_START 20000 /* ID: 0x30008008 */ + +#define WV_NETEVENT_IFRESET_START 20001 /* ID: 0x30008009 */ + +#define WV_NETEVENT_IFATTACH_START 20002 /* ID: 0x3000800a */ + /* Param: + * struct ifnet * pIf + */ + +#define WV_NETEVENT_IFDETACH_START 20003 /* ID: 0x3000800b */ + /* Param: + * struct ifnet * pIf + */ + +#define WV_NETEVENT_IFAFREE_PANIC 20004 /* 0x30001001 */ + +#define WV_NETEVENT_LINKRTREQ_FAIL 20005 /* ID: 0x30005005 */ + +#define WV_NETEVENT_IFDOWN_START 20006 /* ID: 0x3000800c */ + /* UINT32 pIf */ + +#define WV_NETEVENT_IFUP_START 20007 /* ID: 0x3000800d */ + /* UINT32 pIf */ + +#define WV_NETEVENT_IFWATCHDOG 20008 /* 0x30007006 */ + /* UINT32 pIf */ + +#define WV_NETEVENT_IFIOCTL_START 20009 /* 0x30007007 */ + /* UINT32 sockFd + UINT32 command */ + +#define WV_NETEVENT_IFIOCTL_BADIFNAME 20010 /* 0x30004003 */ + /* UINT32 sockFd + UINT32 command */ + +#define WV_NETEVENT_IFIOCTL_NOPROTO 20011 /* 0x30004004 */ + /* UINT32 sockFd + UINT32 command */ + +#define WV_NETEVENT_IFPROMISC_START 20012 /* 0x3000800e */ + /* UINT32 pIf + UINT32 setting */ + +#define WV_NETEVENT_IFPROMISC_FAIL 20013 /* 0x30003002 */ + /* UINT32 pIf + UINT32 setting */ + +/* The following events are defined in if_ether.c */ + +#define WV_NETEVENT_ARPTIMER_FREE 20014 /* 0x3001700f */ + +#define WV_NETEVENT_ARPRTREQ_START 20015 /* 0x30018011 */ + /* UINT32 request */ + +#define WV_NETEVENT_ARPRTREQ_BADGATE 20016 /* 0x30015008 */ + /* UINT32 gateFamily + UINT32 gateLength */ + +#define WV_NETEVENT_ARPRTREQ_FAIL 20017 /* 0x30011001 */ + +#define WV_NETEVENT_ARPREQ_SEND 20018 /* 0x30018012 */ + +#define WV_NETEVENT_ARPREQ_FAIL 20019 /* 0x30011402 */ + +#define WV_NETEVENT_ARPRESOLV_START 20020 /* 0x30018013 */ + /* UINT32 destAddr */ + +#define WV_NETEVENT_ARPLOOK_FAIL 20021 /* 0x30011003 */ + /* UINT32 destAddr */ + +#define WV_NETEVENT_ARPINTR_START 20022 /* 0x30018014 */ + +#define WV_NETEVENT_ARPINTR_FAIL 20023 /* 0x300111004 */ + +#define WV_NETEVENT_ARPIN_START 20024 /* 0x3001680c */ + +#define WV_NETEVENT_ARPIN_BADADDR 20025 /* 0x30015809 */ + /* UINT32 srcAddr */ + +#define WV_NETEVENT_ARPIN_BADADDR2 20026 /* 0x3001580a */ + /* UINT32 srcAddr */ + +#define WV_NETEVENT_ARPIN_BADADDR3 20027 /* 0x3001580b */ + /* UINT32 srcAddr */ + +#define WV_NETEVENT_ARPIN_DELAYEDSEND 20028 /* 0x3001640d */ + /* UINT32 dstAddr */ + +#define WV_NETEVENT_ARPIN_REPLYSEND 20029 /* 0x3001640e */ + /* UINT32 srcAddr + UINT32 dstAddr */ + +#define WV_NETEVENT_ARPTFREE_PANIC 20030 /* 0x30011005 */ + +#define WV_NETEVENT_ARPIOCTL_NOTSUPP 20031 /* 0x30014007 */ + /* UINT32 wvNetEventId + UINT32 reqProtoFamily + UINT32 reqHwFamily */ + +#define WV_NETEVENT_ARPIOCTL_START 20032 /* 0x30017010 */ + /* UINT32 request */ + +#define WV_NETEVENT_ARPIOCTL_SEARCHFAIL 20033 /* 0x30013006 */ + /* UINT32 request + UINT32 ipAddr */ + +/* The following events are defined in if_subr.c */ + +#define WV_NETEVENT_ETHEROUT_IFDOWN 20034 /* 0x30023003 */ + /* UINT32 pIf */ + +#define WV_NETEVENT_ETHEROUT_NOROUTE 20035 /* 0x30023005 */ + /* UINT32 ipAddr */ + +#define WV_NETEVENT_ETHEROUT_RTREJECT 20036 /* 0x30023006 */ + +#define WV_NETEVENT_ETHEROUT_NOBUFS 20037 /* 0x30023004 */ + +#define WV_NETEVENT_ETHEROUT_AFNOTSUPP 20038 /* 0x30024007 */ + /* UINT32 addrFamily */ + +#define WV_NETEVENT_ETHEROUT_FINISH 20039 /* 0x3002600c */ + /* UINT32 pIf + UINT32 result */ + +#define WV_NETEVENT_ETHERIN_START 20040 /* 0x3002600d */ + /* UINT32 pIf */ + +#define WV_NETEVENT_ETHERIFATTACH_START 20041 /* 0x3002800e */ + /* UINT32 pIf */ + +#define WV_NETEVENT_ADDMULT_START 20042 /* 0x3002800f */ + /* UINT32 pIf */ + +#define WV_NETEVENT_ADDMULT_AFNOTSUPP 20043 /* 0x30024008 */ + /* UINT32 addrFamily */ + +#define WV_NETEVENT_ADDMULT_BADADDR 20044 /* 0x30024009 */ + /* UINT32 pIf */ + +#define WV_NETEVENT_ADDMULT_NOBUFS 20045 /* 0x30021001 */ + +#define WV_NETEVENT_DELMULT_START 20046 /* 0x30028010 */ + /* UINT32 pIf */ + +#define WV_NETEVENT_DELMULT_AFNOTSUPP 20047 /* 0x3002400a */ + /* UINT32 addrFamily */ + +#define WV_NETEVENT_DELMULT_BADADDR 20048 /* 0x3002400b */ + /* UINT32 pIf */ + +#define WV_NETEVENT_ETHERATTACH_START 20049 /* 0x30028011 */ + /* UINT32 pIf */ + +#define WV_NETEVENT_TYPEADD_FAIL 20050 /* 0x30021002 */ + /* UINT32 etherType */ + +/* The following events are defined in igmp.c */ + +#define WV_NETEVENT_IGMPINIT_START 20051 /* 0x30038008 */ + +#define WV_NETEVENT_IGMPIN_SHORTMSG 20052 /* 0x30033802 */ + +#define WV_NETEVENT_IGMPIN_BADSUM 20053 /* 0x30033803 */ + +#define WV_NETEVENT_IGMPIN_BADADDR 20054 /* 0x30035804 */ + /* UINT32 igmpType + UINT32 ipAddr */ + +#define WV_NETEVENT_IGMPIN_FINISH 20055 /* 0x30036805 */ + /* UINT32 srcAddr + UINT32 dstAddr */ + +#define WV_NETEVENT_IGMPJOIN_START 20056 /* 0x30038009 */ + +#define WV_NETEVENT_IGMPLEAVE_START 20057 /* 0x3003800a */ + +#define WV_NETEVENT_IGMPFASTTIMER_START 20058 /* 0x30037007 */ + +#define WV_NETEVENT_IGMPSENDREP_NOBUFS 20059 /* 0x30031001 */ + +#define WV_NETEVENT_IGMPSENDREP_FINISH 20060 /* 0x30036406 */ + /* UINT32 dstAddr */ + +/* The following events are defined in in.c */ + +#define WV_NETEVENT_INCTRL_START 20061 /* 0x30048007 */ + /* UINT32 request */ + +#define WV_NETEVENT_INCTRL_SEARCHFAIL 20062 /* 0x30044004 */ + /* UINT32 request + UINT32 pIf */ + +#define WV_NETEVENT_INCTRL_BADSOCK 20063 /* 0x30045006 */ + /* UINT32 request */ + +#define WV_NETEVENT_INCTRL_PANIC 20064 /* 0x30041001 */ + /* UINT32 request */ + +#define WV_NETEVENT_INCTRL_NOBUFS 20065 /* 0x30041002 */ + /* UINT32 request */ + +#define WV_NETEVENT_INCTRL_BADFLAGS 20066 /* 0x30044005 */ + /* UINT32 request + UINT32 pIf */ + +#define WV_NETEVENT_INROUTEDEL_START 20067 /* 0x30048008 */ + /* UINT32 pIf */ + +#define WV_NETEVENT_INIFINIT_START 20068 /* 0x30048009 */ + /* UINT32 pIf */ + +#define WV_NETEVENT_INIFADDRDEL_START 20069 /* 0x3004800a */ + +#define WV_NETEVENT_INADDMULT_START 20070 /* 0x3004800b */ + /* UINT32 ipAddr + UINT32 pIf */ + +#define WV_NETEVENT_INADDMULT_NOBUFS 20071 /* 0x30041003 */ + /* UINT32 ipAddr + UINT32 pIf */ + +#define WV_NETEVENT_INDELMULT_START 20072 /* 0x3004800c */ + +/* The following events are defined in in_pcb.c */ + +#define WV_NETEVENT_PCBALLOC_NOBUFS 20073 /* 0x30061001 */ + /* UINT32 sockNum */ + +#define WV_NETEVENT_PCBBIND_NOADDR 20074 /* 0x30064002 */ + /* UINT32 sockNum */ + +#define WV_NETEVENT_PCBBIND_BADSOCK 20075 /* 0x30064003 */ + /* UINT32 sockNum + UINT32 localAddr + UINT32 localPort */ + +#define WV_NETEVENT_PCBBIND_BADADDRLEN 20076 /* 0x30064004 */ + /* UINT32 sockNum + UINT32 addrLen */ + +#define WV_NETEVENT_PCBBIND_BADADDR 20077 /* 0x30064005 */ + /* UINT32 sockNum + UINT32 destAddr */ + +#define WV_NETEVENT_PCBBIND_BADPORT 20078 /* 0x30064006 */ + /* UINT32 sockNum + UINT32 localPort */ + +#define WV_NETEVENT_PCBLADDR_BADADDR 20079 /* 0x30064007 */ + /* UINT32 sockNum + UINT32 addrLen + UINT32 addrFam + UINT32 addrPort */ + +#define WV_NETEVENT_PCBLADDR_BADIF 20080 /* 0x30064008 */ + /* UINT32 sockNum */ + +#define WV_NETEVENT_PCBCONNECT_BADADDR 20081 /* 0x30064009 */ + /* UINT32 sockNum + UINT32 destAddr + UINT32 localAddr + UINT32 localPort */ + +#define WV_NETEVENT_TCPTIMER_ROUTEDROP 20082 /* 0x3006500a */ + +#define WV_NETEVENT_PCBBIND_START 20083 /* 0x3006800b */ + /* UINT32 sockNum */ + +#define WV_NETEVENT_PCBCONNECT_START 20084 /* 0x3006800c */ + /* UINT32 sockNum */ + +#define WV_NETEVENT_PCBDISCONN_START 20085 /* 0x3006800d */ + /* UINT32 sockNum */ + +#define WV_NETEVENT_PCBNOTIFY_START 20086 /* 0x3006800e */ + /* UINT32 request + UINT32 localAddr + UINT32 destAddr */ + +/* The following events are defined in ip_icmp.c */ + +/* + * The icmp_error routine might be classified as an emergency event, + * depending on the type of error detected. ICMP errors which are not + * emergencies use the critical category for the identical event. + */ + +#define WV_NETEVENT_ICMPERR_START 20087 /* 0x30081002 OR 0x30083002 */ + /* UINT32 errType + UINT32 errCode */ + +#define WV_NETEVENT_ICMPERR_PANIC 20088 /* 0x30081001 */ + /* UINT32 errType */ + +#define WV_NETEVENT_ICMPIN_SHORTMSG 20089 /* 0x30083803 */ + +#define WV_NETEVENT_ICMPIN_BADSUM 20090 /* 0x30083804 */ + +#define WV_NETEVENT_ICMPIN_BADLEN 20091 /* 0x30083805 */ + /* UINT32 msgLen + UINT32 ipHdrLen */ + +#define WV_NETEVENT_ICMPCTRL_BADLEN 20092 /* 0x30084006 */ + /* UINT32 namelen */ + +#define WV_NETEVENT_ICMPCTRL_BADCMD 20093 /* 0x30084007 */ + /* UINT32 ctrlType */ + +#define WV_NETEVENT_ICMPIN_START 20094 /* 0x30086808 */ + +#define WV_NETEVENT_ICMPREFLECT_START 20095 /* 0x30086409 */ + +#define WV_NETEVENT_ICMPSEND_START 20096 /* 0x3008640a */ + +#define WV_NETEVENT_ICMPCTRL_START 20097 /* 0x3008700b */ + /* UINT32 ctrlType */ + +/* The following events are defined in ip_input.c */ + +#define WV_NETEVENT_IPINIT_PANIC 20098 /* 0x30091001 */ + +#define WV_NETEVENT_IPIN_PANIC 20099 /* 0x30091802 */ + +#define WV_NETEVENT_IPIN_SHORTMSG 20100 /* 0x30093803 */ + +#define WV_NETEVENT_IPIN_BADVERS 20101 /* 0x30093804 */ + /* UINT32 version */ + +#define WV_NETEVENT_IPIN_BADHLEN 20102 /* 0x30093805 */ + /* UINT32 hdrLength */ + +#define WV_NETEVENT_IPIN_BADSUM 20103 /* 0x30093806 */ + +#define WV_NETEVENT_IPIN_BADLEN 20104 /* 0x30093807 */ + /* UINT32 ipLength */ + +#define WV_NETEVENT_IPIN_BADMBLK 20105 /* 0x30093808 */ + /* UINT32 mblkLength */ + +#define WV_NETEVENT_IPIN_BADOPT 20106 /* 0x30093809 */ + /* UINT32 errType + UINT32 errCode */ + +#define WV_NETEVENT_IPFWD_BADADDR 20107 /* 0x3009380a */ + /* UINT32 dstAddr */ + +#define WV_NETEVENT_IPCTRL_BADCMDLEN 20108 /* 0x3009400b */ + /* UINT32 namelen */ + +#define WV_NETEVENT_IPCTRL_BADCMD 20109 /* 0x3009400c */ + /* UINT32 ctrlType */ + +#define WV_NETEVENT_IPIN_FRAGDROP 20110 /* 0x3009580d */ + /* UINT32 overlapFlag - address of fragment, or 0 if out of memory. */ + +#define WV_NETEVENT_IPIN_FINISH 20111 /* 0x3009580e */ + +#define WV_NETEVENT_IPFWD_STATUS 20112 /* 0x3009640f */ + /* UINT32 result */ + +#define WV_NETEVENT_IPIN_GOODMBLK 20113 /* 0x30097810 */ + +#define WV_NETEVENT_IPFRAGFREE_START 20114 /* 0x30097011 */ + +#define WV_NETEVENT_IPTIMER_FRAGFREE 20115 /* 0x30097012 */ + +#define WV_NETEVENT_IPCTRL_START 20116 /* 0x30097013 */ + /* UINT32 ctrlType */ + +#define WV_NETEVENT_IPINIT_START 20117 /* 0x30098014 */ + +/* The following events are defined in ip_mroute.c */ + +#define WV_NETEVENT_ADDMRT_NOBUFS 20118 /* 0x300a1001 */ + +#define WV_NETEVENT_IPMRT_NOTINIT 20119 /* 0x300a4002 */ + +#define WV_NETEVENT_IPMRT_BADCMD 20120 /* 0x300a4003 */ + /* UINT32 request */ + +#define WV_NETEVENT_ADDVIF_BADINDEX 20121 /* 0x300a4004 */ + +#define WV_NETEVENT_ADDVIF_BADENTRY 20122 /* 0x300a4005 */ + /* UINT32 localAddr */ + +#define WV_NETEVENT_ADDVIF_SEARCHFAIL 20123 /* 0x300a4006 */ + /* UINT32 sockNum + UINT32 destAddr */ + +#define WV_NETEVENT_ADDVIF_BADFLAGS 20124 /* 0x300a4007 */ + /* UINT32 pIf */ + +#define WV_NETEVENT_DELVIF_BADINDEX 20125 /* 0x300a4008 */ + +#define WV_NETEVENT_DELVIF_BADENTRY 20126 /* 0x300a4009 */ + /* UINT32 index */ + +#define WV_NETEVENT_TUNNEL_STATUS 20127 /* 0x300a640a */ + /* UINT32 result */ + +#define WV_NETEVENT_PHYINT_STATUS 20128 /* 0x300a640b */ + /* UINT32 result */ + +#define WV_NETEVENT_IPMRT_START 20129 /* 0x300a700c */ + /* UINT32 request */ + +/* The following events are defined in ip_output.c */ + +#define WV_NETEVENT_IPOUT_BADADDR 20130 /* 0x300b3401 */ + /* UINT32 dstAddr */ + +#define WV_NETEVENT_IPOUT_BADFLAGS 20131 /* 0x300b3402 */ + /* UINT32 dstAddr */ + +#define WV_NETEVENT_IPOUT_CANTFRAG 20132 /* 0x300b3403 */ + /* UINT32 dstAddr + UINT32 pIf */ + +#define WV_NETEVENT_IPOUT_SHORTMSG 20133 /* 0x300b3404 */ + /* UINT32 dstAddr + UINT32 pIf */ + +#define WV_NETEVENT_IPOUTCTRL_BADCMD 20134 /* 0x300b3405 */ + /* UINT32 sockNum + UINT32 request */ + +#define WV_NETEVENT_IPOUTCTRL_START 20135 /* 0x300b7006 */ + /* UINT32 sockNum + UINT32 request */ + +#define WV_NETEVENT_IPMLOOP_START 20136 /* 0x300b7807 */ + +#define WV_NETEVENT_IPOUT_CACHEMISS 20294 /* 0x300b8408 */ + +#define WV_NETEVENT_IPOUT_FINISH 20295 /* 0x300b4409 */ + +#define WV_NETEVENT_IPOUT_SENDALL 20296 /* 0x300b740a */ + +#define WV_NETEVENT_IPOUT_SENDFRAG 20297 /* 0x300b740b */ + +/* The following events are defined in radix.c */ + +#define WV_NETEVENT_RNINIT_PANIC 20137 /* ID: 0x300c1001 */ + +#define WV_NETEVENT_RNADD_BADMASK 20138 /* ID: 0x300c2002 */ + +#define WV_NETEVENT_RNADD_NOMASK 20139 /* ID: 0x300c2003 */ + +#define WV_NETEVENT_RNADD_BADROUTE 20140 /* ID: 0x300c2004 */ + +#define WV_NETEVENT_RNDEL_BADREFCNT 20141 /* ID: 0x300c2005 */ + +#define WV_NETEVENT_RNDEL_BADMASK 20142 /* ID: 0x300c2006 */ + +#define WV_NETEVENT_RNDEL_SEARCHFAIL 20143 /* ID: 0x300c2007 */ + +#define WV_NETEVENT_RNDEL_KEYSEARCHFAIL 20144 /* ID: 0x300c2008 */ + +#define WV_NETEVENT_RNDEL_EXTRAMASK 20145 /* ID: 0x300c2009 */ + +/* The following events are defined in raw_cb.c */ + +#define WV_NETEVENT_RAWATTACH_NOPCBMEM 20146 /* 0x300d3001 */ + +#define WV_NETEVENT_RAWATTACH_NOSOCKBUFMEM 20147 /* 0x300d3002 */ + +#define WV_NETEVENT_RAWBIND_NOIF 20148 /* 0x300d4003 */ + +#define WV_NETEVENT_RAWATTACH_START 20149 /* 0x300d8004 */ + +#define WV_NETEVENT_RAWDETACH_START 20150 /* 0x300d8005 */ + +#define WV_NETEVENT_RAWBIND_START 20151 /* 0x300d8006 */ + +/* The following events are defined in raw_ip.c */ + +#define WV_NETEVENT_RAWIPREQ_PANIC 20152 /* 0x300e1001 */ + +#define WV_NETEVENT_RAWCTLOUT_BADLEVEL 20153 /* 0x300e4002 */ + +#define WV_NETEVENT_RAWCTLOUT_BADMEM 20154 /* 0x300e4003 */ + +#define WV_NETEVENT_RAWIPREQ_FAIL 20155 /* 0x300e4004 */ + +#define WV_NETEVENT_RAWIPIN_NOSOCK 20156 /* 0x300e4805 */ + +#define WV_NETEVENT_RAWIPIN_LOST 20157 /* 0x300e5806 */ + +#define WV_NETEVENT_RAWIPIN_START 20158 /* 0x300e6807 */ + +#define WV_NETEVENT_RAWIPOUT_FINISH 20159 /* 0x300e6408 */ + +#define WV_NETEVENT_RAWCTLOUT_START 20160 /* 0x300e7009 */ + +#define WV_NETEVENT_RAWIPREQ_START 20161 /* 0x300e700a */ + +#define WV_NETEVENT_RAWIPINIT_START 20162 /* 0x300e800b */ + +/* The following events are defined in raw_usrreq.c */ + +#define WV_NETEVENT_RAWREQ_PANIC 20163 /* 0x300f1001 */ + +#define WV_NETEVENT_RAWREQ_FAIL 20164 /* 0x300f4002 */ + +#define WV_NETEVENT_RAWIN_LOST 20165 /* 0x300f5803 */ + +#define WV_NETEVENT_RAWIN_START 20166 /* 0x300f6804 */ + +#define WV_NETEVENT_RAWCTLIN_START 20167 /* 0x300f7005 */ + +#define WV_NETEVENT_RAWREQ_START 20168 /* 0x300f7006 */ + +#define WV_NETEVENT_RAWINIT_START 20169 /* 0x300f8007 */ + +/* The following events are defined in route.c */ + +#define WV_NETEVENT_RTFREE_PANIC 20170 /* 0x30101001 */ + +#define WV_NETEVENT_RTREQ_PANIC 20171 /* 0x30101002 */ + +#define WV_NETEVENT_RTSET_NOBUFS 20172 /* 0x30101003 */ + +#define WV_NETEVENT_RTFREE_BADREFCNT 20173 /* 0x30102004 */ + +#define WV_NETEVENT_RTALLOC_SEARCHFAIL 20174 /* 0x30103005 */ + +#define WV_NETEVENT_RTRESET_BADDEST 20175 /* 0x30103006 */ + +#define WV_NETEVENT_RTREQ_BADROUTE 20176 /* 0x30103007 */ + +#define WV_NETEVENT_RTIOCTL_BADREQ 20177 /* 0x30104008 */ + +#define WV_NETEVENT_RTALLOC_CLONE 20178 /* 0x30107009 */ + +#define WV_NETEVENT_RTALLOC_SEARCHGOOD 20179 /* 0x3010700a */ + +#define WV_NETEVENT_RTFREE_START 20180 /* 0x3010700b */ + +#define WV_NETEVENT_RTIOCTL_START 20181 /* 0x3010700c */ + +#define WV_NETEVENT_ROUTEINIT_START 20182 /* 0x3010800d */ + +#define WV_NETEVENT_RTRESET_STATUS 20183 /* 0x3010800e */ + +#define WV_NETEVENT_RTINIT_START 20184 /* 0x3010800f */ + +/* The following events are defined in rtsock.c */ + +#define WV_NETEVENT_RTOUT_BADMSG 20185 /* 0x30111401 */ + +#define WV_NETEVENT_RTOUT_PANIC 20186 /* 0x30111402 */ + +#define WV_NETEVENT_COPYDATA_PANIC 20187 /* 0x30111003 */ + +#define WV_NETEVENT_RTOUTPUT_FAIL 20188 /* 0x30113404 */ + +#define WV_NETEVENT_RTOUTPUT_START 20189 /* 0x30116405 */ + +#define WV_NETEVENT_ROUTEREQ_START 20190 /* 0x30117006 */ + +#define WV_NETEVENT_ROUTEWALK_START 20191 /* 0x30117007 */ + +#define WV_NETEVENT_RTSOCKINIT_START 20192 /* 0x30118008 */ + +/* The following events are defined in sys_socket.c */ + +#define WV_NETEVENT_SOCKIOCTL_START 20193 /* 0x30137001 */ + +#define WV_NETEVENT_SOCKSELECT_START 20194 /* 0x30137002 */ + +#define WV_NETEVENT_SOCKUNSELECT_START 20195 /* 0x30137003 */ + +/* The following events are defined in tcp_input.c */ + +#define WV_NETEVENT_TCPOOB_PANIC 20196 /* 0x30151801 */ + +#define WV_NETEVENT_TCPIN_BADSUM 20197 /* 0x30153802 */ + +#define WV_NETEVENT_TCPIN_BADSEG 20198 /* 0x30153803 */ + +#define WV_NETEVENT_TCPIN_SEARCHFAIL 20199 /* 0x30155804 */ + +#define WV_NETEVENT_TCPIN_BADSYNC 20200 /* 0x30155805 */ + +#define WV_NETEVENT_TCPIN_SENDFAIL 20201 /* 0x30155806 */ + +#define WV_NETEVENT_TCPIN_START 20202 /* 0x30156807 */ + +#define WV_NETEVENT_TCPIN_DUPSEG 20203 /* 0x30157808 */ + +#define WV_NETEVENT_TCPIN_PUREACK 20204 /* 0x30157809 */ + +#define WV_NETEVENT_TCPIN_PUREDATA 20205 /* 0x3015780a */ + +#define WV_NETEVENT_TCPIN_ACCEPT 20206 /* 0x3015780b */ + +#define WV_NETEVENT_TCPIN_CONNECT 20207 /* 0x3015780c */ + +#define WV_NETEVENT_TCPIN_DATACLOSED 20208 /* 0x3015780d */ + +#define WV_NETEVENT_TCPIN_RESET 20209 /* 0x3015780e */ + +#define WV_NETEVENT_TCPIN_SENDCLOSED 20210 /* 0x3015780f */ + +#define WV_NETEVENT_TCPIN_CLOSEWAIT 20211 /* 0x30157810 */ + +#define WV_NETEVENT_TCPIN_RECVCLOSED 20212 /* 0x30157811 */ + +#define WV_NETEVENT_TCPIN_CLOSING 20213 /* 0x30157812 */ + +#define WV_NETEVENT_TCPIN_CLOSE_RESTART 20214 /* 0x30157813 */ + +#define WV_NETEVENT_TCPIN_DUPDATA 20215 /* 0x30158814 */ + +#define WV_NETEVENT_TCPIN_SHORTSEG 20216 /* 0x30158815 */ + +/* The following events are defined in tcp_output.c */ + +#define WV_NETEVENT_TCPOUT_HDRPANIC 20217 /* 0x30161401 */ + +#define WV_NETEVENT_TCPOUT_PANIC 20218 /* 0x30161402 */ + +#define WV_NETEVENT_TCPOUT_FINISH 20219 /* 0x30166403 */ + +/* The following events are defined in tcp_subr.c */ + +#define WV_NETEVENT_TCPINIT_HDRPANIC 20220 /* 0x30171001 */ + +#define WV_NETEVENT_TCPRESPOND_START 20221 /* 0x30176402 */ + +#define WV_NETEVENT_TCPDROP_START 20222 /* 0x30177003 */ + +#define WV_NETEVENT_TCPCLOSE_START 20223 /* 0x30177004 */ + +#define WV_NETEVENT_TCPNOTIFY_IGNORE 20224 /* 0x30177005 */ + +#define WV_NETEVENT_TCPNOTIFY_KILL 20225 /* 0x30177006 */ + +#define WV_NETEVENT_TCPNOTIFY_ERROR 20226 /* 0x30177005 */ + +#define WV_NETEVENT_TCPCTLIN_START 20227 /* 0x30177008 */ + +#define WV_NETEVENT_TCPINIT_START 20228 /* 0x30178009 */ + +/* The following events are defined in tcp_subr.c */ + +#define WV_NETEVENT_TCPFASTTIMER_START 20229 /* 0x30177001 */ + +#define WV_NETEVENT_TCPSLOWTIMER_START 20230 /* 0x30177002 */ + +#define WV_NETEVENT_TCPTIMER_START 20231 /* 0x30188003 */ + +/* The following events are defined in tcp_usrreq.c */ + +#define WV_NETEVENT_TCPREQ_PANIC 20232 /* 0x30191001 */ + +#define WV_NETEVENT_TCPCTLOUT_NOPCB 20233 /* 0x30193002 */ + +#define WV_NETEVENT_TCPATTACH_NOBUFS 20234 /* 0x30193003 */ + +#define WV_NETEVENT_TCPREQ_BADMEM 20235 /* 0x30194004 */ + +#define WV_NETEVENT_TCPREQ_NOPCB 20236 /* 0x30194005 */ + +#define WV_NETEVENT_TCPREQ_FAIL 20237 /* 0x30194006 */ + +#define WV_NETEVENT_TCPCTLOUT_START 20238 /* 0x30197007 */ + +#define WV_NETEVENT_TCPREQ_START 20239 /* 0x30197008 */ + +#define WV_NETEVENT_TCPATTACH_START 20240 /* 0x30198009 */ + +#define WV_NETEVENT_TCPDISCONN_START 20241 /* 0x3019800a */ + +/* The following events are defined in udp_usrreq.c */ + +#define WV_NETEVENT_UDPREQ_PANIC 20242 /* 0x301a1001 */ + +#define WV_NETEVENT_UDPOUT_FAIL 20243 /* 0x301a4402 */ + +#define WV_NETEVENT_UDPREQ_NOPCB 20244 /* 0x301a4003 */ + +#define WV_NETEVENT_UDPIN_SHORTPKTHDR 20245 /* 0x301a5804 */ + +#define WV_NETEVENT_UDPIN_BADLEN 20246 /* 0x301a5805 */ + +#define WV_NETEVENT_UDPIN_BADSUM 20247 /* 0x301a5806 */ + +#define WV_NETEVENT_UDPIN_FULLSOCK 20248 /* 0x301a5807 */ + +#define WV_NETEVENT_UDPIN_SEARCHFAIL 20249 /* 0x301a5808 */ + +#define WV_NETEVENT_UDPIN_NOPORT 20250 /* 0x301a5809 */ + +#define WV_NETEVENT_UDPIN_START 20251 /* 0x301a680a */ + +#define WV_NETEVENT_UDPOUT_FINISH 20252 /* 0x301a640b */ + +#define WV_NETEVENT_UDPNOTIFY_START 20253 /* 0x301a700c */ + +#define WV_NETEVENT_UDPCTLIN_START 20254 /* 0x301a700d */ + +#define WV_NETEVENT_UDPREQ_START 20255 /* 0x301a700e */ + +#define WV_NETEVENT_UDPCTRL_START 20256 /* 0x301a700f */ + +#define WV_NETEVENT_UDPINIT_START 20257 /* 0x301a8010 */ + +#define WV_NETEVENT_UDPIN_CACHEMISS 20258 /* 0x301a8811 */ + +#define WV_NETEVENT_UDPIN_PCBGOOD 20293 /* 0x301a7812 */ + +/* The following events are defined in uipc_mbuf.c */ + +#define WV_NETEVENT_POOLINIT_PANIC 20259 /* 0x301c1001 */ + +#define WV_NETEVENT_MEMINIT_PANIC 20260 /* 0x301c1002 */ + +#define WV_NETEVENT_DEVMEM_PANIC 20261 /* 0x301c1003 */ + +#define WV_NETEVENT_MEMCOPY_PANIC 20262 /* 0x301c1004 */ + +#define WV_NETEVENT_MEMFREE_PANIC 20263 /* 0x301c1005 */ + +/* The following events are defined in uipc_sock.c */ + +#define WV_NETEVENT_SOFREE_PANIC 20264 /* 0x301d1001 */ + +#define WV_NETEVENT_SOCLOSE_PANIC 20265 /* 0x301d1002 */ + +#define WV_NETEVENT_SOACCEPT_PANIC 20266 /* 0x301d1003 */ + +#define WV_NETEVENT_SOSEND_FAIL 20267 /* 0x301d3404 */ + +#define WV_NETEVENT_SORECV_FAIL 20268 /* 0x301d3805 */ + +#define WV_NETEVENT_SOCREATE_SEARCHFAIL 20269 /* 0x301d4006 */ + +#define WV_NETEVENT_SOCREATE_BADTYPE 20270 /* 0x301d4007 */ + +#define WV_NETEVENT_SOCONNECT_BADSOCK 20271 /* 0x301d4008 */ + +#define WV_NETEVENT_SODISCONN_STATUS 20272 /* 0x301d4009 */ + +#define WV_NETEVENT_SOCLOSE_WAIT 20273 /* 0x301d700a */ + +#define WV_NETEVENT_SOCREATE_START 20274 /* 0x301d800b */ + +#define WV_NETEVENT_SOBIND_START 20275 /* 0x301d800c */ + +#define WV_NETEVENT_SOLISTEN_START 20276 /* 0x301d800d */ + +#define WV_NETEVENT_SOFREE_START 20277 /* 0x301d800e */ + +#define WV_NETEVENT_SOCLOSE_START 20278 /* 0x301d800f */ + +#define WV_NETEVENT_SOABORT_START 20279 /* 0x301d8010 */ + +#define WV_NETEVENT_SOACCEPT_START 20280 /* 0x301d8011 */ + +#define WV_NETEVENT_SOCONNECT_START 20281 /* 0x301d8012 */ + +#define WV_NETEVENT_SOCONNECT2_START 20282 /* 0x301d8013 */ + +#define WV_NETEVENT_SOSEND_FINISH 20283 /* 0x301d8014 */ + +#define WV_NETEVENT_SORECV_FINISH 20284 /* 0x301d8015 */ + +#define WV_NETEVENT_SOSHUTDOWN_START 20285 /* 0x301d8016 */ + +/* The following events are defined in uipc_sock2.c */ + +#define WV_NETEVENT_SBAPPENDADDR_PANIC 20286 /* 0x301e1801 */ + +#define WV_NETEVENT_SBAPPENDCTRL_PANIC 20287 /* 0x301e1002 */ + +#define WV_NETEVENT_SBFLUSH_PANIC 20288 /* 0x301e1003 */ + +#define WV_NETEVENT_SBDROP_PANIC 20289 /* 0x301e1004 */ + +#define WV_NETEVENT_SBWAIT_SLEEP 20290 /* 0x301e7005 */ + +#define WV_NETEVENT_SBWAKEUP_START 20291 /* 0x301e7006 */ + +/* The following events are defined in unixLib.c */ + +#define WV_NETEVENT_HASHINIT_PANIC 20292 /* 0x301f1001 */ + +/* end of VxWorks networking events */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwvNetLibh */ diff --git a/h/wvTmrLib.h b/h/wvTmrLib.h new file mode 100644 index 0000000..f9b1062 --- /dev/null +++ b/h/wvTmrLib.h @@ -0,0 +1,40 @@ +/* wvTmrLib.h - timer library header */ + +/* Copyright 1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,10dec93,smb written. +*/ + +#ifndef __INCwvtmrlibh +#define __INCwvtmrlibh + +/* typedefs */ + +typedef unsigned int (*UINTFUNCPTR) (); + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) || defined(__cplusplus) + +void wvTmrRegister (UINTFUNCPTR wvTmrRtn, UINTFUNCPTR wvTmrLockRtn, + FUNCPTR wvTmrEnable, FUNCPTR wvTmrDisable, + FUNCPTR wvTmrConnect, UINTFUNCPTR wvTmrPeriod, + UINTFUNCPTR wvTmrFreq); + +#else /* __STDC__ */ + +void wvTmrRegister (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCwvtmrlibh*/ + diff --git a/h/xbdBlkDev.h b/h/xbdBlkDev.h new file mode 100644 index 0000000..e5f472a --- /dev/null +++ b/h/xbdBlkDev.h @@ -0,0 +1,33 @@ +/* xbdBlkDev.h - BLK_DEV to XBD interface converter */ + +/* + * Copyright (c) 2005 Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01d,25aug05,pcm added xbdBlkDevCreateSync() +01c,15jul05,pcm added xbdBlkDevDelete() +01b,08mar05,pcm added xbdBlkDevLibInit() +01a,31jan05,rfr Fixed inclusion of xbd.h +*/ + +#ifndef __INCxbdBlkDevh +#define __INCxbdBlkDevh + + +#include +#include + + +extern STATUS xbdBlkDevLibInit (void); +extern device_t xbdBlkDevCreate (BLK_DEV *bd, const char *name); +extern device_t xbdBlkDevCreateSync (BLK_DEV *bd, const char *name); +extern STATUS xbdBlkDevDelete (device_t d, BLK_DEV ** ppbd); + +#endif diff --git a/h/xbdPartition.h b/h/xbdPartition.h new file mode 100644 index 0000000..65a80bb --- /dev/null +++ b/h/xbdPartition.h @@ -0,0 +1,29 @@ +/* xbdPartition.h - XBD partition manager */ + +/* +* Copyright (c) 2005 Wind River Systems, Inc. +* +* The right to copy, distribute, modify or otherwise make use +* of this software may be licensed only pursuant to the terms +* of an applicable Wind River license agreement. +*/ + +/* +modification history +-------------------- +01b,15sep05,pcm added xbdCreatePartition() +01a,xxXXX05,xxx written +*/ + +#ifndef __INCxbdPartitionh +#define __INCxbdPartitionh + + +#include + + +extern device_t xbdPartitionDevCreate (device_t subDev); +extern STATUS xbdCreatePartition (char * pathName, int nPart, + int size1, int size2, int size3); + +#endif diff --git a/h/xbdRamDisk.h b/h/xbdRamDisk.h new file mode 100644 index 0000000..6613086 --- /dev/null +++ b/h/xbdRamDisk.h @@ -0,0 +1,31 @@ +/* xbdRamDisk.h - Ramdisk Block Device conforming to the XBD interface */ + +/* + * Copyright 2005 - Wind River Systems, Inc. + * + * The right to copy, distribute, modify or otherwise make use + * of this software may be licensed only pursuant to the terms + * of an applicable Wind River license agreement. + */ + +/* +modification history +-------------------- +01c,26jul05,jlk Updated xbdRamDiskDevCreate() prototype to take an extra + parameter. +01b,11jul05,jlk Added xbdRamDiskDevDelete() prototype +01a,31jan05,rfr Fixed inclusion of xbd.h +*/ + +#ifndef __INCxbdRamDiskh +#define __INCxbdRamDiskh + + +#include + + +extern device_t xbdRamDiskDevCreate(unsigned BlockSize, unsigned TotalSize, + BOOL flag, const char *name); +extern STATUS xbdRamDiskDevDelete(device_t d); + +#endif diff --git a/h/xdr_bool_t.h b/h/xdr_bool_t.h new file mode 100644 index 0000000..7a01ac2 --- /dev/null +++ b/h/xdr_bool_t.h @@ -0,0 +1,40 @@ +/* xdr_bool_t.h - header file for xdr_bool_t.c */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +02b,22sep92,rrr added support for c++ +02a,04jul92,jcf cleaned up. +01c,26may92,rrr the tree shuffle +01b,04oct91,rrr passed through the ansification filter + -fixed #else and #endif + -changed copyright notice +01a,05oct90,shl created. +*/ + +#ifndef __INCxdr_bool_th +#define __INCxdr_bool_th + +#ifdef __cplusplus +extern "C" { +#endif + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern int xdr_bool_t (XDR *xdrs, int *objp); + +#else /* __STDC__ */ + +extern int xdr_bool_t (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCxdr_bool_th */ diff --git a/h/xdr_mnt.h b/h/xdr_mnt.h new file mode 100644 index 0000000..bac0f45 --- /dev/null +++ b/h/xdr_mnt.h @@ -0,0 +1,23 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +/* +modification history +-------------------- +01a,01jul04,dlk Make this header include xdr_mnt1.h and xdr_mnt3.h. + Remove other contents. +*/ + +#ifndef xdr_mnth +#define xdr_mnth + +#if 0 +#error xdr_mnt.h is obsolete. Use xdr_mnt1.h or xdr_mnt3.h or xdr_mnt_common.h. +#endif + +#include +#include + +#endif /* xdr_mnth */ diff --git a/h/xdr_nfs.h b/h/xdr_nfs.h new file mode 100644 index 0000000..512d55d --- /dev/null +++ b/h/xdr_nfs.h @@ -0,0 +1,23 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +/* +modification history +-------------------- +01a,01jul04,dlk Make this header include xdr_nfs2.h and xdr_nfs3.h. + Remove other contents. +*/ + +#ifndef nfs_protH +#define nfs_protH + +#if 0 +#error xdr_nfs.h is obsolete. Use xdr_nfs2.h or xdr_nfs3.h or xdr_nfs_common.h. +#endif + +#include +#include + +#endif /* nfs_protH */ diff --git a/h/xdr_nfsserv.h b/h/xdr_nfsserv.h new file mode 100644 index 0000000..54a07c4 --- /dev/null +++ b/h/xdr_nfsserv.h @@ -0,0 +1,23 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +/* +modification history +-------------------- +01a,01jul04,dlk Make this header include xdr_mnt1.h and xdr_mnt3.h. + Remove other contents. +*/ + +#ifndef mountH +#define mountH + +#if 0 +#error xdr_nfsserv.h is obsolete. Use xdr_mnt1.h or xdr_mnt3.h or xdr_mnt_common.h. +#endif + +#include +#include + +#endif /* mountH */ diff --git a/h/zbufLib.h b/h/zbufLib.h new file mode 100644 index 0000000..8bc3e93 --- /dev/null +++ b/h/zbufLib.h @@ -0,0 +1,133 @@ +/* zbufLib.h - zeroCopy buffer interface library header */ + +/* Copyright 1984-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,08nov94,dzb written. +*/ + +#ifndef __INCzbufLibh +#define __INCzbufLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "limits.h" +#include "private/semLibP.h" + +/* typedefs */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +/* HIDDEN */ + +typedef struct /* ZBUF_FUNC */ + { + FUNCPTR createRtn; /* zbufCreate() */ + FUNCPTR deleteRtn; /* zbufDelete() */ + FUNCPTR insertRtn; /* zbufInsert() */ + FUNCPTR insertBufRtn; /* zbufInsertBuf() */ + FUNCPTR insertCopyRtn; /* zbufInsertCopy() */ + FUNCPTR extractCopyRtn; /* zbufExtractCopy() */ + FUNCPTR cutRtn; /* zbufCut() */ + FUNCPTR splitRtn; /* zbufSplit() */ + FUNCPTR dupRtn; /* zbufDup() */ + FUNCPTR lengthRtn; /* zbufLength() */ + FUNCPTR segFindRtn; /* zbufSegFind() */ + FUNCPTR segNextRtn; /* zbufSegNext() */ + FUNCPTR segPrevRtn; /* zbufSegPrev() */ + FUNCPTR segDataRtn; /* zbufSegData() */ + FUNCPTR segLengthRtn; /* zbufSegLength() */ + } ZBUF_FUNC; + +/* Pools not used */ + +typedef struct zbufBlockId /* ZBUF_BLOCK_ID */ + { + int length; + void * segFree; + struct zbufPoolId * zbufPoolId; + struct zbufBlockId * blockNext; + } *ZBUF_BLOCK_ID; + +typedef struct zbufPoolId /* ZBUF_POOL_ID */ + { + int use; + SEMAPHORE poolSem; + SEMAPHORE waitSem; + struct zbufBlockId * blockHead; + } *ZBUF_POOL_ID; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +typedef void * ZBUF_ID; +typedef void * ZBUF_SEG; + +/* END_HIDDEN */ + +/* defines */ + +#define ZBUF_BEGIN -INT_MAX /* shortcut for prepending */ +#define ZBUF_END INT_MAX /* shortcut for appending */ +#define ZBUF_NONE ((ZBUF_SEG) NONE) /* cut past zbuf */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS zbufLibInit (FUNCPTR libInitRtn); +extern ZBUF_ID zbufCreate (void); +extern STATUS zbufDelete (ZBUF_ID zbufId); +extern ZBUF_SEG zbufInsert (ZBUF_ID zbufId1, ZBUF_SEG zbufSeg, int offset, + ZBUF_ID zbufId2); +extern ZBUF_SEG zbufInsertBuf (ZBUF_ID zbufId, ZBUF_SEG zbufSeg, int offset, + caddr_t buf, int len, VOIDFUNCPTR freeRtn, int freeArg); +extern ZBUF_SEG zbufInsertCopy (ZBUF_ID zbufId, ZBUF_SEG zbufSeg, + int offset, caddr_t buf, int len); +extern int zbufExtractCopy (ZBUF_ID zbufId, ZBUF_SEG zbufSeg, + int offset, caddr_t buf, int len); +extern ZBUF_SEG zbufCut (ZBUF_ID zbufId, ZBUF_SEG zbufSeg, int offset, int len); +extern ZBUF_ID zbufSplit (ZBUF_ID zbufId, ZBUF_SEG zbufSeg, int offset); +extern ZBUF_ID zbufDup (ZBUF_ID zbufId, ZBUF_SEG zbufSeg, int offset, int len); +extern int zbufLength (ZBUF_ID zbufId); +extern ZBUF_SEG zbufSegFind (ZBUF_ID zbufId, ZBUF_SEG zbufSeg, int *pOffset); +extern ZBUF_SEG zbufSegNext (ZBUF_ID zbufId, ZBUF_SEG zbufSeg); +extern ZBUF_SEG zbufSegPrev (ZBUF_ID zbufId, ZBUF_SEG zbufSeg); +extern caddr_t zbufSegData (ZBUF_ID zbufId, ZBUF_SEG zbufSeg); +extern int zbufSegLength (ZBUF_ID zbufId, ZBUF_SEG zbufSeg); + +#else /* __STDC__ */ + +extern STATUS zbufLibInit (); +extern ZBUF_ID zbufCreate (); +extern STATUS zbufDelete (); +extern ZBUF_SEG zbufInsert (); +extern ZBUF_SEG zbufInsertBuf (); +extern ZBUF_SEG zbufInsertCopy (); +extern int zbufExtractCopy (); +extern ZBUF_SEG zbufCut (); +extern ZBUF_ID zbufSplit (); +extern ZBUF_ID zbufDup (); +extern int zbufLength (); +extern ZBUF_SEG zbufSegFind (); +extern ZBUF_SEG zbufSegNext (); +extern ZBUF_SEG zbufSegPrev (); +extern caddr_t zbufSegData (); +extern int zbufSegLength (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCzbufLibh */ diff --git a/h/zbufSockLib.h b/h/zbufSockLib.h new file mode 100644 index 0000000..0f61cd3 --- /dev/null +++ b/h/zbufSockLib.h @@ -0,0 +1,77 @@ +/* zbufSockLib.h - zeroCopy buffer socket interface library header */ + +/* Copyright 1984-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,08nov94,dzb written. +*/ + +#ifndef __INCzbufSockLibh +#define __INCzbufSockLibh + +#ifdef __cplusplus +extern "C" { +#endif + +/* includes */ + +#include "zbufLib.h" +#include "sys/socket.h" + +/* typedefs */ + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 1 /* tell gcc960 not to optimize alignments */ +#endif /* CPU_FAMILY==I960 */ + +typedef struct /* ZBUF_SOCK_FUNC */ + { + FUNCPTR libInitRtn; /* zbufLibInit() */ + FUNCPTR sendRtn; /* zbufSockSend() */ + FUNCPTR sendtoRtn; /* zbufSockSendto() */ + FUNCPTR bufSendRtn; /* zbufSockBufSend() */ + FUNCPTR bufSendtoRtn; /* zbufSockBufSend() */ + FUNCPTR recvRtn; /* zbufSockRecv() */ + FUNCPTR recvfromRtn; /* zbufSockRecvfrom() */ + } ZBUF_SOCK_FUNC; + +#if ((CPU_FAMILY==I960) && (defined __GNUC__)) +#pragma align 0 /* turn off alignment requirement */ +#endif /* CPU_FAMILY==I960 */ + +/* function declarations */ + +#if defined(__STDC__) || defined(__cplusplus) + +extern STATUS zbufSockLibInit (void); +extern int zbufSockSend (int s, ZBUF_ID zbufId, int zbufLen, int flags); +extern int zbufSockSendto (int s, ZBUF_ID zbufId, int zbufLen, int flags, + struct sockaddr *to, int tolen); +extern int zbufSockBufSend (int s, char *buf, int bufLen, + VOIDFUNCPTR freeRtn, int freeArg, int flags); +extern int zbufSockBufSendto (int s, char *buf, int bufLen, + VOIDFUNCPTR freeRtn, int freeArg, int flags, + struct sockaddr *to, int tolen); +extern ZBUF_ID zbufSockRecv (int s, int flags, int *pLen); +extern ZBUF_ID zbufSockRecvfrom (int s, int flags, int *pLen, + struct sockaddr *from, int *pFromLen); + +#else /* __STDC__ */ + +extern STATUS zbufSockLibInit (); +extern int zbufSockSend (); +extern int zbufSockSendto (); +extern int zbufSockBufSend (); +extern int zbufSockBufSendto (); +extern ZBUF_ID zbufSockRecv (); +extern ZBUF_ID zbufSockRecvfrom (); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __INCzbufSockLibh */ diff --git a/libc/Makefile b/libc/Makefile new file mode 100644 index 0000000..4e15d68 --- /dev/null +++ b/libc/Makefile @@ -0,0 +1,15 @@ +# Makefile - makefile for vw/src/libc +# +# modification history +# -------------------- +# 01a,18jun96,yp created from 01j of MakeSkel +# +# DESCRIPTION +# This file contains the makefile rules for building the vx library +# +#*/ + +TGT_DIR=$(WIND_BASE)/target + +include $(TGT_DIR)/h/make/rules.library + diff --git a/libc/assert/Makefile b/libc/assert/Makefile new file mode 100644 index 0000000..8533c9c --- /dev/null +++ b/libc/assert/Makefile @@ -0,0 +1,22 @@ +# Makefile - makefile for vw/src/libc/ctype +# +# modification history +# -------------------- +# 01b,12oct01,tam added repackaging support +# 01a,18jun96,yp created from 01c of MakeSkel +# +# DESCRIPTION +# This file contains the makefile rules for building the vx library +# +#*/ + +TGT_DIR=$(WIND_BASE)/target + +LIB_BASE_NAME = os + +DOC_FILES= ansiAssert.c + +OBJS= assert.o + +include $(TGT_DIR)/h/make/rules.library + diff --git a/libc/assert/ansiAssert.c b/libc/assert/ansiAssert.c new file mode 100644 index 0000000..c054357 --- /dev/null +++ b/libc/assert/ansiAssert.c @@ -0,0 +1,54 @@ +/* ansiAssert.c - ANSI 'assert' documentation */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,24oct92,smb written. +*/ + +/* +DESCRIPTION +The header assert.h defines the assert() macro and refers to another +macro, NDEBUG, which is not defined by assert.h. If NDEBUG is defined +as a macro at the point in the source file where assert.h is included, +the assert() macro is defined simply as: +.CS + #define assert(ignore) ((void)0) +.CE +ANSI specifies that assert() should be implemented as a macro, not as a +routine. If the macro definition is suppressed in order to access an +actual routine, the behavior is undefined. + +INCLUDE FILES: stdio.h, stdlib.h, assert.h + +SEE ALSO: American National Standard X3.159-1989 +*/ + +/****************************************************************************** +* +* assert - put diagnostics into programs (ANSI) +* +* If an expression is false (that is, equal to zero), the assert() macro +* writes information about the failed call to standard error in an +* implementation-defined format. It then calls abort(). +* The diagnostic information includes: +* - the text of the argument +* - the name of the source file (value of preprocessor macro __FILE__) +* - the source line number (value of preprocessor macro __LINE__) +* +* INCLUDE: stdio.h, stdlib.h, assert.h +* +* RETURNS: N/A +* +*/ + +void assert + ( + int a + ) + + { + /* This is a dummy for documentation purposes */ + } diff --git a/libc/assert/assert.c b/libc/assert/assert.c new file mode 100644 index 0000000..5a2a8af --- /dev/null +++ b/libc/assert/assert.c @@ -0,0 +1,43 @@ +/* assert.c - ANSI standard assert function */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,24oct92,smb removed some redundant documentation. +01b,20sep92,smb documentation additions. +01a,20jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: stdio.h, stdlib.h, assert.h + +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "assert.h" +#include "stdio.h" +#include "stdlib.h" + +/****************************************************************************** +* +* __assert - function called by the assert macro. +* +* INCLUDE: stdio.h assert.h +* +* RETURNS: never returns +* NOMANUAL +*/ +void __assert + ( + const char *msg /* message string */ + ) + { + fdprintf(2, "%s\n", CHAR_FROM_CONST (msg)); /* print msg to error stream */ + abort(); + } diff --git a/libc/ctype/Makefile b/libc/ctype/Makefile new file mode 100644 index 0000000..521c90f --- /dev/null +++ b/libc/ctype/Makefile @@ -0,0 +1,31 @@ +# Makefile - makefile for vw/src/libc/ctype +# +# modification history +# -------------------- +# 01b,12oct01,tam added repackaging support +# 01a,18jun96,yp created from 01c of MakeSkel +# +# DESCRIPTION +# This file contains the makefile rules for building the vx library +# +#*/ + +TGT_DIR=$(WIND_BASE)/target + +LIB_BASE_NAME = os + +DOC_FILES= ansiCtype.c + +## ansiCtype.c includes the following files +# isalnum.c isalpha.c iscntrl.c isdigit.c isgraph.c +# islower.c isprint.c ispunct.c isspace.c isupper.c +# isxdigit.c tolower.c toupper.c + + + +OBJS= __ctype_tab.o isalnum.o isalpha.o iscntrl.o isdigit.o isgraph.o \ + islower.o isprint.o ispunct.o isspace.o isupper.o isxdigit.o \ + tolower.o toupper.o + +include $(TGT_DIR)/h/make/rules.library + diff --git a/libc/ctype/__ctype_tab.c b/libc/ctype/__ctype_tab.c new file mode 100644 index 0000000..c554ae2 --- /dev/null +++ b/libc/ctype/__ctype_tab.c @@ -0,0 +1,163 @@ +/* ctype - ctype library routines */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,20sep92,smb documentation additions. +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb written +*/ + +/* +DESCRIPTION +This table contains character attributes for all ASCII-coded characters. +A character's integer value is used as an index into the +table where the character's attributes are or'd together. + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ctype.h" + +static const unsigned char __ctype_tab[257] = + { + /* 0 */ 0, /* dummy */ + /* 80 */ _C_B, /* nul */ + /* 80 */ _C_B, /* soh */ + /* 80 */ _C_B, /* stx */ + /* 80 */ _C_B, /* etx */ + /* 80 */ _C_B, /* eot */ + /* 80 */ _C_B, /* enq */ + /* 80 */ _C_B, /* ack */ + /* 80 */ _C_B, /* bel */ + /* 80 */ _C_B, /* bs */ + /* 20 */ _C_CONTROL, /* ht */ + /* 20 */ _C_CONTROL, /* nl */ + /* 20 */ _C_CONTROL, /* vt */ + /* 20 */ _C_CONTROL, /* np */ + /* 20 */ _C_CONTROL, /* cr */ + /* 80 */ _C_B, /* so */ + /* 80 */ _C_B, /* si */ + /* 80 */ _C_B, /* dle */ + /* 80 */ _C_B, /* dc1 */ + /* 80 */ _C_B, /* dc2 */ + /* 80 */ _C_B, /* dc3 */ + /* 80 */ _C_B, /* dc4 */ + /* 80 */ _C_B, /* nak */ + /* 80 */ _C_B, /* syn */ + /* 80 */ _C_B, /* etb */ + /* 80 */ _C_B, /* can */ + /* 80 */ _C_B, /* em */ + /* 80 */ _C_B, /* sub */ + /* 80 */ _C_B, /* esc */ + /* 80 */ _C_B, /* fs */ + /* 80 */ _C_B, /* gs */ + /* 80 */ _C_B, /* rs */ + /* 80 */ _C_B, /* us */ + /* 08 */ _C_WHITE_SPACE, /* space */ + /* 10 */ _C_PUNCT, /* ! */ + /* 10 */ _C_PUNCT, /* " */ + /* 10 */ _C_PUNCT, /* # */ + /* 10 */ _C_PUNCT, /* $ */ + /* 10 */ _C_PUNCT, /* % */ + /* 10 */ _C_PUNCT, /* & */ + /* 10 */ _C_PUNCT, /* ' */ + /* 10 */ _C_PUNCT, /* ( */ + /* 10 */ _C_PUNCT, /* ) */ + /* 10 */ _C_PUNCT, /* * */ + /* 10 */ _C_PUNCT, /* + */ + /* 10 */ _C_PUNCT, /* , */ + /* 10 */ _C_PUNCT, /* - */ + /* 10 */ _C_PUNCT, /* . */ + /* 10 */ _C_PUNCT, /* / */ + /* 44 */ _C_NUMBER | _C_HEX_NUMBER, /* 0 */ + /* 44 */ _C_NUMBER | _C_HEX_NUMBER, /* 1 */ + /* 44 */ _C_NUMBER | _C_HEX_NUMBER, /* 2 */ + /* 44 */ _C_NUMBER | _C_HEX_NUMBER, /* 3 */ + /* 44 */ _C_NUMBER | _C_HEX_NUMBER, /* 4 */ + /* 44 */ _C_NUMBER | _C_HEX_NUMBER, /* 5 */ + /* 44 */ _C_NUMBER | _C_HEX_NUMBER, /* 6 */ + /* 44 */ _C_NUMBER | _C_HEX_NUMBER, /* 7 */ + /* 44 */ _C_NUMBER | _C_HEX_NUMBER, /* 8 */ + /* 44 */ _C_NUMBER | _C_HEX_NUMBER, /* 9 */ + /* 10 */ _C_PUNCT, /* : */ + /* 10 */ _C_PUNCT, /* ; */ + /* 10 */ _C_PUNCT, /* < */ + /* 10 */ _C_PUNCT, /* = */ + /* 10 */ _C_PUNCT, /* > */ + /* 10 */ _C_PUNCT, /* ? */ + /* 10 */ _C_PUNCT, /* @ */ + /* 41 */ _C_UPPER | _C_HEX_NUMBER, /* A */ + /* 41 */ _C_UPPER | _C_HEX_NUMBER, /* B */ + /* 41 */ _C_UPPER | _C_HEX_NUMBER, /* C */ + /* 41 */ _C_UPPER | _C_HEX_NUMBER, /* D */ + /* 41 */ _C_UPPER | _C_HEX_NUMBER, /* E */ + /* 41 */ _C_UPPER | _C_HEX_NUMBER, /* F */ + /* 01 */ _C_UPPER, /* G */ + /* 01 */ _C_UPPER, /* H */ + /* 01 */ _C_UPPER, /* I */ + /* 01 */ _C_UPPER, /* J */ + /* 01 */ _C_UPPER, /* K */ + /* 01 */ _C_UPPER, /* L */ + /* 01 */ _C_UPPER, /* M */ + /* 01 */ _C_UPPER, /* N */ + /* 01 */ _C_UPPER, /* O */ + /* 01 */ _C_UPPER, /* P */ + /* 01 */ _C_UPPER, /* Q */ + /* 01 */ _C_UPPER, /* R */ + /* 01 */ _C_UPPER, /* S */ + /* 01 */ _C_UPPER, /* T */ + /* 01 */ _C_UPPER, /* U */ + /* 01 */ _C_UPPER, /* V */ + /* 01 */ _C_UPPER, /* W */ + /* 01 */ _C_UPPER, /* X */ + /* 01 */ _C_UPPER, /* Y */ + /* 01 */ _C_UPPER, /* Z */ + /* 10 */ _C_PUNCT, /* [ */ + /* 10 */ _C_PUNCT, /* \ */ + /* 10 */ _C_PUNCT, /* ] */ + /* 10 */ _C_PUNCT, /* ^ */ + /* 10 */ _C_PUNCT, /* _ */ + /* 10 */ _C_PUNCT, /* ` */ + /* 42 */ _C_LOWER | _C_HEX_NUMBER, /* a */ + /* 42 */ _C_LOWER | _C_HEX_NUMBER, /* b */ + /* 42 */ _C_LOWER | _C_HEX_NUMBER, /* c */ + /* 42 */ _C_LOWER | _C_HEX_NUMBER, /* d */ + /* 42 */ _C_LOWER | _C_HEX_NUMBER, /* e */ + /* 42 */ _C_LOWER | _C_HEX_NUMBER, /* f */ + /* 02 */ _C_LOWER, /* g */ + /* 02 */ _C_LOWER, /* h */ + /* 02 */ _C_LOWER, /* i */ + /* 02 */ _C_LOWER, /* j */ + /* 02 */ _C_LOWER, /* k */ + /* 02 */ _C_LOWER, /* l */ + /* 02 */ _C_LOWER, /* m */ + /* 02 */ _C_LOWER, /* n */ + /* 02 */ _C_LOWER, /* o */ + /* 02 */ _C_LOWER, /* p */ + /* 02 */ _C_LOWER, /* q */ + /* 02 */ _C_LOWER, /* r */ + /* 02 */ _C_LOWER, /* s */ + /* 02 */ _C_LOWER, /* t */ + /* 02 */ _C_LOWER, /* u */ + /* 02 */ _C_LOWER, /* v */ + /* 02 */ _C_LOWER, /* w */ + /* 02 */ _C_LOWER, /* x */ + /* 02 */ _C_LOWER, /* y */ + /* 02 */ _C_LOWER, /* z */ + /* 10 */ _C_PUNCT, /* { */ + /* 10 */ _C_PUNCT, /* | */ + /* 10 */ _C_PUNCT, /* } */ + /* 10 */ _C_PUNCT, /* ~ */ + /* 80 */ _C_B /* del */ + }; + +const unsigned char *__ctype = &__ctype_tab[1]; + diff --git a/libc/ctype/ansiCtype.c b/libc/ctype/ansiCtype.c new file mode 100644 index 0000000..3122a49 --- /dev/null +++ b/libc/ctype/ansiCtype.c @@ -0,0 +1,718 @@ +/* ansiCtype.c - ANSI `ctype' documentation */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,03mar93,jdi more documentation cleanup for 5.1. +01b,07feb93,jdi documentation cleanup for 5.1. +01a,24oct92,smb written +*/ + +/* +DESCRIPTION +The header ctype.h declares several functions useful for testing and +mapping characters. In all cases, the argument is an `int', the value of +which is representable as an `unsigned char' or is equal to the +value of the macro EOF. If the argument has any other value, the +behavior is undefined. + +The behavior of the 'ctype' functions is affected by the current locale. +VxWorks supports only the "C" locale. + +The term "printing character" refers to a member of an implementation-defined +set of characters, each of which occupies one printing position on a +display device; the term "control character" refers to a member of an +implementation-defined set of characters that are not printing characters. + +INCLUDE FILES: ctype.h + +SEE ALSO: American National Standard X3.159-1989 +*/ + +/* +INTERNAL DOCUMENTATION + If locale additions are necessary the arrays of unsigned char will + not be large enough. Type short should be used instead. Also two + extra character classifications will be needed. _C_EXTRA_SPACE and + _C_EXTRA_ALPHA. + + Two extra tables may be necessary for completeness but at the moment they + are too large. Adding them is not difficult. The tables are defined in + __tolower_tab.c __toupper_tab.c + + extern const unsigned char *_Tolower; + extern const unsigned char *_Toupper; + + __ctype_tab.c is a table of character classifications and is used to + determine to what class a character belongs. + +NOMANUAL + +INTERNAL +This documentation module is built by appending the following files: + + isalnum.c + isalpha.c + iscntrl.c + isdigit.c + isgraph.c + islower.c + isprint.c + ispunct.c + isspace.c + isupper.c + isxdigit.c + tolower.c + toupper.c + +*/ + + +/* isalnum.c - character classification */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03mar93,jdi more documentation cleanup for 5.1. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions. +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ctype.h" + + +#undef isalnum +/******************************************************************************* +* +* isalnum - test whether a character is alphanumeric (ANSI) +* +* This routine tests whether is a character for which isalpha() or +* isdigit() returns true. +* +* INCLUDE FILES: ctype.h +* +* RETURNS: Non-zero if and only if is alphanumeric. +*/ + +int isalnum + ( + int c /* character to test */ + ) + { + return __isalnum(c); + } +/* isalpha.c - character classification and conversion macros */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03mar93,jdi more documentation cleanup for 5.1. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions. +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ctype.h" + + +#undef isalpha +/******************************************************************************* +* +* isalpha - test whether a character is a letter (ANSI) +* +* This routine tests whether is a character +* for which isupper() or islower() returns true. +* +* INCLUDE FILES: ctype.h +* +* RETURNS: Non-zero if and only if is a letter. +*/ + +int isalpha + ( + int c /* character to test */ + ) + { + return __isalpha(c); + } + +/* iscntrl.c - character classification */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03mar93,jdi more documentation cleanup for 5.1. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ctype.h" + + +#undef iscntrl +/******************************************************************************* +* +* iscntrl - test whether a character is a control character (ANSI) +* +* This routine tests whether is a control character. +* +* INCLUDE FILES: ctype.h +* +* RETURNS: Non-zero if and only if is a control character. +*/ + +int iscntrl + ( + int c /* character to test */ + ) + { + return __iscntrl(c); + } +/* isdigit.c - character classification */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03mar93,jdi more documentation cleanup for 5.1. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ctype.h" + + +#undef isdigit +/******************************************************************************* +* +* isdigit - test whether a character is a decimal digit (ANSI) +* +* This routine tests whether is a decimal-digit character. +* +* INCLUDE FILES: ctype.h +* +* RETURNS: Non-zero if and only if is a decimal digit. +*/ + +int isdigit + ( + int c /* character to test */ + ) + { + return __isdigit(c); + } +/* isgraph.c - character classification and conversion macros */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03mar93,jdi more documentation cleanup for 5.1. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ctype.h" + + +#undef isgraph +/******************************************************************************* +* +* isgraph - test whether a character is a printing, non-white-space character (ANSI) +* +* This routine returns true if is a printing character, and not a +* character for which isspace() returns true. +* +* INCLUDE FILES: ctype.h +* +* RETURNS: +* Non-zero if and only if is a printable, non-white-space character. +* +* SEE ALSO: isspace() +*/ + +int isgraph + ( + int c /* character to test */ + ) + { + return __isgraph(c); + } +/* islower.c - character conversion macros */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03mar93,jdi more documentation cleanup for 5.1. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ctype.h" + + +#undef islower +/******************************************************************************* +* +* islower - test whether a character is a lower-case letter (ANSI) +* +* This routine tests whether is a lower-case letter. +* +* INCLUDE FILES: ctype.h +* +* RETURNS: Non-zero if and only if is a lower-case letter. +*/ + +int islower + ( + int c /* character to test */ + ) + { + return __islower(c); + } + +/* isprint.c - character classification and conversion macros */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03mar93,jdi more documentation cleanup for 5.1. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ctype.h" + +#undef isprint +/******************************************************************************* +* +* isprint - test whether a character is printable, including the space character (ANSI) +* +* This routine returns true if is a printing character or the space +* character. +* +* INCLUDE FILES: ctype.h +* +* RETURNS: Non-zero if and only if is printable, including the space +* character. +*/ + +int isprint + ( + int c /* character to test */ + ) + { + return __isprint(c); + } +/* ispunct.c - character classification and conversion macros */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03mar93,jdi more documentation cleanup for 5.1. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ctype.h" + + +#undef ispunct +/******************************************************************************* +* +* ispunct - test whether a character is punctuation (ANSI) +* +* This routine tests whether a character is punctuation, i.e., a printing +* character for which neither isspace() nor isalnum() is true. +* +* INCLUDE FILES: ctype.h +* +* RETURNS: Non-zero if and only if is a punctuation character. +*/ + +int ispunct + ( + int c /* character to test */ + ) + { + return __ispunct(c); + } +/* isspace.c - character classification and conversion macros */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03mar93,jdi more documentation cleanup for 5.1. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL + +*/ + +#include "vxWorks.h" +#include "ctype.h" + + +#undef isspace +/******************************************************************************* +* +* isspace - test whether a character is a white-space character (ANSI) +* +* This routine tests whether a character is one of +* the standard white-space characters, as follows: +* +* .TS +* tab(|); +* l l. +* space | "\0" +* horizontal tab | \et +* vertical tab | \ev +* carriage return | \er +* new-line | \en +* form-feed | \ef +* .TE +* +* INCLUDE FILES: ctype.h +* +* RETURNS: Non-zero if and only if is a space, tab, carriage return, +* new-line, or form-feed character. +*/ + +int isspace + ( + int c /* character to test */ + ) + { + return __isspace(c); + } +/* isupper.c - character classification and conversion macros */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03mar93,jdi more documentation cleanup for 5.1. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ctype.h" + + +#undef isupper +/******************************************************************************* +* +* isupper - test whether a character is an upper-case letter (ANSI) +* +* This routine tests whether is an upper-case letter. +* +* INCLUDE FILES: ctype.h +* +* RETURNS: Non-zero if and only if is an upper-case letter. +* +*/ + +int isupper + ( + int c /* character to test */ + ) + { + return __isupper(c); + } + +/* isxdigit.c - character classification and conversion macros */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03mar93,jdi more documentation cleanup for 5.1. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ctype.h" + + +#undef isxdigit +/******************************************************************************* +* +* isxdigit - test whether a character is a hexadecimal digit (ANSI) +* +* This routine tests whether is a hexadecimal-digit character. +* +* INCLUDE FILES: ctype.h +* +* RETURNS: Non-zero if and only if is a hexadecimal digit. +*/ + +int isxdigit + ( + int c /* character to test */ + ) + { + return __isxdigit(c); + } + +/* tolower.c - character classification and conversion macros */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,03mar93,jdi more documentation cleanup for 5.1. +01e,07feb93,jdi documentation cleanup for 5.1. +01d,13oct92,jdi mangen fixes. +01c,20sep92,smb documentation additions +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ctype.h" + + +#undef tolower +/******************************************************************************* +* +* tolower - convert an upper-case letter to its lower-case equivalent (ANSI) +* +* This routine converts an upper-case letter to the corresponding lower-case +* letter. +* +* INCLUDE FILES: ctype.h +* +* RETURNS: +* If is an upper-case letter, it returns the lower-case equivalent; +* otherwise, it returns the argument unchanged. +*/ + +int tolower + ( + int c /* character to convert */ + ) + { + return __tolower(c); + } + +/* toupper.c - character classification and conversion macros */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03mar93,jdi more documentation cleanup for 5.1. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ctype.h" + + +#undef toupper +/******************************************************************************* +* +* toupper - convert a lower-case letter to its upper-case equivalent (ANSI) +* +* This routine converts a lower-case letter to the corresponding upper-case +* letter. +* +* INCLUDE FILES: ctype.h +* +* RETURNS: +* If is a lower-case letter, it returns the upper-case equivalent; +* otherwise, it returns the argument unchanged. +*/ + +int toupper + ( + int c /* character to convert */ + ) + { + return __toupper(c); + } diff --git a/libc/ctype/isalnum.c b/libc/ctype/isalnum.c new file mode 100644 index 0000000..4e6da62 --- /dev/null +++ b/libc/ctype/isalnum.c @@ -0,0 +1,48 @@ +/* isalnum.c - character classification */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03mar93,jdi more documentation cleanup for 5.1. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions. +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ctype.h" + + +#undef isalnum +/******************************************************************************* +* +* isalnum - test whether a character is alphanumeric (ANSI) +* +* This routine tests whether is a character for which isalpha() or +* isdigit() returns true. +* +* INCLUDE FILES: ctype.h +* +* RETURNS: Non-zero if and only if is alphanumeric. +*/ + +int isalnum + ( + int c /* character to test */ + ) + { + return __isalnum(c); + } diff --git a/libc/ctype/isalpha.c b/libc/ctype/isalpha.c new file mode 100644 index 0000000..be4df2f --- /dev/null +++ b/libc/ctype/isalpha.c @@ -0,0 +1,49 @@ +/* isalpha.c - character classification and conversion macros */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03mar93,jdi more documentation cleanup for 5.1. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions. +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ctype.h" + + +#undef isalpha +/******************************************************************************* +* +* isalpha - test whether a character is a letter (ANSI) +* +* This routine tests whether is a character +* for which isupper() or islower() returns true. +* +* INCLUDE FILES: ctype.h +* +* RETURNS: Non-zero if and only if is a letter. +*/ + +int isalpha + ( + int c /* character to test */ + ) + { + return __isalpha(c); + } + diff --git a/libc/ctype/iscntrl.c b/libc/ctype/iscntrl.c new file mode 100644 index 0000000..7e774d8 --- /dev/null +++ b/libc/ctype/iscntrl.c @@ -0,0 +1,47 @@ +/* iscntrl.c - character classification */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03mar93,jdi more documentation cleanup for 5.1. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ctype.h" + + +#undef iscntrl +/******************************************************************************* +* +* iscntrl - test whether a character is a control character (ANSI) +* +* This routine tests whether is a control character. +* +* INCLUDE FILES: ctype.h +* +* RETURNS: Non-zero if and only if is a control character. +*/ + +int iscntrl + ( + int c /* character to test */ + ) + { + return __iscntrl(c); + } diff --git a/libc/ctype/isdigit.c b/libc/ctype/isdigit.c new file mode 100644 index 0000000..dca7a0e --- /dev/null +++ b/libc/ctype/isdigit.c @@ -0,0 +1,47 @@ +/* isdigit.c - character classification */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03mar93,jdi more documentation cleanup for 5.1. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ctype.h" + + +#undef isdigit +/******************************************************************************* +* +* isdigit - test whether a character is a decimal digit (ANSI) +* +* This routine tests whether is a decimal-digit character. +* +* INCLUDE FILES: ctype.h +* +* RETURNS: Non-zero if and only if is a decimal digit. +*/ + +int isdigit + ( + int c /* character to test */ + ) + { + return __isdigit(c); + } diff --git a/libc/ctype/isgraph.c b/libc/ctype/isgraph.c new file mode 100644 index 0000000..fde3a01 --- /dev/null +++ b/libc/ctype/isgraph.c @@ -0,0 +1,51 @@ +/* isgraph.c - character classification and conversion macros */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03mar93,jdi more documentation cleanup for 5.1. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ctype.h" + + +#undef isgraph +/******************************************************************************* +* +* isgraph - test whether a character is a printing, non-white-space character (ANSI) +* +* This routine returns true if is a printing character, and not a +* character for which isspace() returns true. +* +* INCLUDE FILES: ctype.h +* +* RETURNS: +* Non-zero if and only if is a printable, non-white-space character. +* +* SEE ALSO: isspace() +*/ + +int isgraph + ( + int c /* character to test */ + ) + { + return __isgraph(c); + } diff --git a/libc/ctype/islower.c b/libc/ctype/islower.c new file mode 100644 index 0000000..7ef9901 --- /dev/null +++ b/libc/ctype/islower.c @@ -0,0 +1,48 @@ +/* islower.c - character conversion macros */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03mar93,jdi more documentation cleanup for 5.1. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ctype.h" + + +#undef islower +/******************************************************************************* +* +* islower - test whether a character is a lower-case letter (ANSI) +* +* This routine tests whether is a lower-case letter. +* +* INCLUDE FILES: ctype.h +* +* RETURNS: Non-zero if and only if is a lower-case letter. +*/ + +int islower + ( + int c /* character to test */ + ) + { + return __islower(c); + } + diff --git a/libc/ctype/isprint.c b/libc/ctype/isprint.c new file mode 100644 index 0000000..c3b9b65 --- /dev/null +++ b/libc/ctype/isprint.c @@ -0,0 +1,48 @@ +/* isprint.c - character classification and conversion macros */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03mar93,jdi more documentation cleanup for 5.1. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ctype.h" + +#undef isprint +/******************************************************************************* +* +* isprint - test whether a character is printable, including the space character (ANSI) +* +* This routine returns true if is a printing character or the space +* character. +* +* INCLUDE FILES: ctype.h +* +* RETURNS: Non-zero if and only if is printable, including the space +* character. +*/ + +int isprint + ( + int c /* character to test */ + ) + { + return __isprint(c); + } diff --git a/libc/ctype/ispunct.c b/libc/ctype/ispunct.c new file mode 100644 index 0000000..bba5cd4 --- /dev/null +++ b/libc/ctype/ispunct.c @@ -0,0 +1,48 @@ +/* ispunct.c - character classification and conversion macros */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03mar93,jdi more documentation cleanup for 5.1. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ctype.h" + + +#undef ispunct +/******************************************************************************* +* +* ispunct - test whether a character is punctuation (ANSI) +* +* This routine tests whether a character is punctuation, i.e., a printing +* character for which neither isspace() nor isalnum() is true. +* +* INCLUDE FILES: ctype.h +* +* RETURNS: Non-zero if and only if is a punctuation character. +*/ + +int ispunct + ( + int c /* character to test */ + ) + { + return __ispunct(c); + } diff --git a/libc/ctype/isspace.c b/libc/ctype/isspace.c new file mode 100644 index 0000000..d14ef2f --- /dev/null +++ b/libc/ctype/isspace.c @@ -0,0 +1,61 @@ +/* isspace.c - character classification and conversion macros */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03mar93,jdi more documentation cleanup for 5.1. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL + +*/ + +#include "vxWorks.h" +#include "ctype.h" + + +#undef isspace +/******************************************************************************* +* +* isspace - test whether a character is a white-space character (ANSI) +* +* This routine tests whether a character is one of +* the standard white-space characters, as follows: +* +* .TS +* tab(|); +* l l. +* space | "\0" +* horizontal tab | \et +* vertical tab | \ev +* carriage return | \er +* new-line | \en +* form-feed | \ef +* .TE +* +* INCLUDE FILES: ctype.h +* +* RETURNS: Non-zero if and only if is a space, tab, carriage return, +* new-line, or form-feed character. +*/ + +int isspace + ( + int c /* character to test */ + ) + { + return __isspace(c); + } diff --git a/libc/ctype/isupper.c b/libc/ctype/isupper.c new file mode 100644 index 0000000..52c1ff8 --- /dev/null +++ b/libc/ctype/isupper.c @@ -0,0 +1,49 @@ +/* isupper.c - character classification and conversion macros */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03mar93,jdi more documentation cleanup for 5.1. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ctype.h" + + +#undef isupper +/******************************************************************************* +* +* isupper - test whether a character is an upper-case letter (ANSI) +* +* This routine tests whether is an upper-case letter. +* +* INCLUDE FILES: ctype.h +* +* RETURNS: Non-zero if and only if is an upper-case letter. +* +*/ + +int isupper + ( + int c /* character to test */ + ) + { + return __isupper(c); + } + diff --git a/libc/ctype/isxdigit.c b/libc/ctype/isxdigit.c new file mode 100644 index 0000000..c0c39d4 --- /dev/null +++ b/libc/ctype/isxdigit.c @@ -0,0 +1,48 @@ +/* isxdigit.c - character classification and conversion macros */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03mar93,jdi more documentation cleanup for 5.1. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ctype.h" + + +#undef isxdigit +/******************************************************************************* +* +* isxdigit - test whether a character is a hexadecimal digit (ANSI) +* +* This routine tests whether is a hexadecimal-digit character. +* +* INCLUDE FILES: ctype.h +* +* RETURNS: Non-zero if and only if is a hexadecimal digit. +*/ + +int isxdigit + ( + int c /* character to test */ + ) + { + return __isxdigit(c); + } + diff --git a/libc/ctype/tolower.c b/libc/ctype/tolower.c new file mode 100644 index 0000000..1f20c82 --- /dev/null +++ b/libc/ctype/tolower.c @@ -0,0 +1,52 @@ +/* tolower.c - character classification and conversion macros */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,03mar93,jdi more documentation cleanup for 5.1. +01e,07feb93,jdi documentation cleanup for 5.1. +01d,13oct92,jdi mangen fixes. +01c,20sep92,smb documentation additions +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ctype.h" + + +#undef tolower +/******************************************************************************* +* +* tolower - convert an upper-case letter to its lower-case equivalent (ANSI) +* +* This routine converts an upper-case letter to the corresponding lower-case +* letter. +* +* INCLUDE FILES: ctype.h +* +* RETURNS: +* If is an upper-case letter, it returns the lower-case equivalent; +* otherwise, it returns the argument unchanged. +*/ + +int tolower + ( + int c /* character to convert */ + ) + { + return __tolower(c); + } + diff --git a/libc/ctype/toupper.c b/libc/ctype/toupper.c new file mode 100644 index 0000000..6e2047f --- /dev/null +++ b/libc/ctype/toupper.c @@ -0,0 +1,50 @@ +/* toupper.c - character classification and conversion macros */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,03mar93,jdi more documentation cleanup for 5.1. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions +01b,04jul92,smb added vxWorks.h and extra documentation +01a,24mar92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: ctype.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ctype.h" + + +#undef toupper +/******************************************************************************* +* +* toupper - convert a lower-case letter to its upper-case equivalent (ANSI) +* +* This routine converts a lower-case letter to the corresponding upper-case +* letter. +* +* INCLUDE FILES: ctype.h +* +* RETURNS: +* If is a lower-case letter, it returns the upper-case equivalent; +* otherwise, it returns the argument unchanged. +*/ + +int toupper + ( + int c /* character to convert */ + ) + { + return __toupper(c); + } diff --git a/libc/locale/Makefile b/libc/locale/Makefile new file mode 100644 index 0000000..1de9608 --- /dev/null +++ b/libc/locale/Makefile @@ -0,0 +1,26 @@ +# Makefile - makefile for vw/src/libc/locale +# +# modification history +# -------------------- +# 01b,12oct01,tam added repackaging support +# 01a,18jun96,yp created from 01d of MakeSkel +# +# DESCRIPTION +# This file contains the makefile rules for building the vx library +# +#*/ + +TGT_DIR=$(WIND_BASE)/target + +LIB_BASE_NAME = os + +DOC_FILES= ansiLocale.c + +## ansiLocale.c includes localeconv.c setlocale.c +# + +OBJS= localeconv.o setlocale.o + + +include $(TGT_DIR)/h/make/rules.library + diff --git a/libc/locale/ansiLocale.c b/libc/locale/ansiLocale.c new file mode 100644 index 0000000..72017a2 --- /dev/null +++ b/libc/locale/ansiLocale.c @@ -0,0 +1,331 @@ +/* ansiLocale.c - ANSI `locale' documentation */ + +/* Copyright 1992-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,10jul97,dgp doc: fix SPR 6145, clarify setlocale() functionalitY +01d,11feb95,jdi doc tweaks. +01c,14mar93,jdi fixed typo. +01b,07feb93,jdi documentation cleanup for 5.1. +01a,24oct92,smb written. +*/ + +/* +DESCRIPTION +The header locale.h declares two functions and one type, and defines several +macros. The type is: +.iP "`struct lconv'" 15 +contains members related to the formatting of numeric values. The +structure should contain at least the members defined in locale.h, +in any order. + +SEE ALSO: localeconv(), setlocale(), American National Standard X3.159-1989 + +INTERNAL: +This documentation module is built by appending the following files: + + localeconv.c + setlocale.c +*/ + + +/* localeconv.c - ANSI locale */ + +/* Copyright 1992-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,11feb95,jdi doc tweaks. +01e,14mar93,jdi fixed typo. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions +01b,12jul92,smb changed definition of localeconv for MIPS cpp. +01a,08jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: locale.h limits.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "locale.h" +#include "limits.h" + +/* locals */ + +static char null[] = ""; + +struct lconv __locale = + { + /* LC_NUMERIC */ + ".", /* decimal_point */ + null, /* thousands_sep */ + null, /* grouping */ + /* LC_MONETARY */ + null, /* int_curr_symbol */ + null, /* currency_symbol */ + null, /* mon_decimal_point */ + null, /* mon_thousands_sep */ + null, /* mon_grouping */ + null, /* positive_sign */ + null, /* negative_sign */ + CHAR_MAX, /* int_frac_digits */ + CHAR_MAX, /* frac_digits */ + CHAR_MAX, /* p_cs_precedes */ + CHAR_MAX, /* p_sep_by_space */ + CHAR_MAX, /* n_cs_precedes */ + CHAR_MAX, /* n_sep_by_space */ + CHAR_MAX, /* p_sign_posn */ + CHAR_MAX /* n_sign_posn */ + }; + + +#undef localeconv +/******************************************************************************* +* +* localeconv - set the components of an object with type `lconv' (ANSI) +* +* This routine sets the components of an object with type `struct lconv' +* with values appropriate for the formatting of numeric quantities +* (monetary and otherwise) according to the rules of the current locale. +* +* The members of the structure with type `char *' are pointers to strings +* any of which (except `decimal_point') can point to "" to indicate that +* the value is not available in the current locale or is of zero length. +* The members with type `char' are nonnegative numbers, any of which can be +* CHAR_MAX to indicate that the value is not available in the current locale. +* The members include the following: +* .iP "char *decimal_point" "" 3 +* The decimal-point character used to format nonmonetary quantities. +* .iP "char *thousands_sep" +* The character used to separate groups of digits before the +* decimal-point character in formatted nonmonetary quantities. +* .iP "char *grouping" +* A string whose elements indicate the size of each group of +* digits in formatted nonmonetary quantities. +* .iP "char *int_curr_symbol" +* The international currency symbol applicable to the current +* locale. The first three characters contain the alphabetic international +* currency symbol in accordance with those specified in ISO 4217:1987. +* The fourth character (immediately preceding the null character) is the +* character used to separate the international currency symbol from +* the monetary quantity. +* .iP "char *currency_symbol" +* The local currency symbol applicable to the current locale. +* .iP "char *mon_decimal_point" +* The decimal-point used to format monetary quantities. +* .iP "char *mon_thousands_sep" +* The separator for groups of digits before the decimal-point in +* formatted monetary quantities. +* .iP "char *mon_grouping" +* A string whose elements indicate the size of each group of digits in +* formatted monetary quantities. +* .iP "char *positive_sign" +* The string used to indicate a nonnegative-valued formatted monetary +* quantity. +* .iP "char *negative_sign" +* The string used to indicate a negative-valued formatted monetary +* quantity. +* .iP "char int_frac_digits" +* The number of fractional digits (those after the decimal-point) +* to be displayed in an internationally formatted monetary quantity. +* .iP "char frac_digits" +* The number of fractional digits (those after the decimal-point) +* to be displayed in a formatted monetary quantity. +* .iP "char p_cs_precedes" +* Set to 1 or 0 if the `currency_symbol' respectively precedes or +* succeeds the value for a nonnegative formatted monetary quantity. +* .iP "char p_sep_by_space" +* Set to 1 or 0 if the `currency_symbol' respectively is or is not +* separated by a space from the value for a nonnegative formatted +* monetary quantity. +* .iP "char n_cs_precedes" +* Set to 1 or 0 if the `currency_symbol' respectively precedes or +* succeeds the value for a negative formatted monetary quantity. +* .iP "char n_sep_by_space" +* Set to 1 or 0 if the `currency_symbol' respectively is or is not +* separated by a space from the value for a negative formatted monetary +* quantity. +* .iP "char p_sign_posn" +* Set to a value indicating the positioning of the `positive_sign' +* for a nonnegative formatted monetary quantity. +* .iP "char n_sign_posn" +* Set to a value indicating the positioning of the `negative_sign' +* for a negative formatted monetary quantity. +* +* .LP +* The elements of `grouping' and `mon_grouping' are interpreted according +* to the following: +* .iP "CHAR_MAX" "" 1 +* No further grouping is to be performed. +* .iP "0" +* The previous element is to be repeatedly used for the remainder of the digits. +* .iP "other" +* The integer value is the number of the digits that comprise the current +* group. The next element is examined to determined the size of the next +* group of digits before the current group. +* +* .LP +* The values of `p_sign_posn' and `n_sign_posn' are interpreted according to +* the following: +* .iP "0" +* Parentheses surround the quantity and `currency_symbol'. +* .iP "1" +* The sign string precedes the quantity and `currency_symbol'. +* .iP "2" +* The sign string succeeds the quantity and `currency_symbol'. +* .iP "3" +* The sign string immediately precedes the `currency_symbol'. +* .iP "4" +* The sign string immediately succeeds the `currency_symbol'. +* +* .LP +* The implementation behaves as if no library function calls localeconv(). +* +* The localeconv() routine returns a pointer to the filled-in object. The +* structure pointed to by the return value is not modified by the +* program, but may be overwritten by a subsequent call to localeconv(). +* In addition, calls to setlocale() with categories LC_ALL, LC_MONETARY, +* or LC_NUMERIC may overwrite the contents of the structure. +* +* INCLUDE FILES: locale.h, limits.h +* +* RETURNS: A pointer to the structure `lconv'. +*/ + +struct lconv *localeconv (void) + { + return (&__locale); + } + + +/* setlocale.c - ANSI locale */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,30aug93,jmm fixed null pointer dereference in setlocale() (spr 2490) +01e,07feb93,jdi documentation cleanup for 5.1. +01d,28sep92,smb added ANSI to function description +01c,20sep92,smb documentation additions +01b,14sep92,smb added some minor error checking. +01a,08jul92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: locale.h string.h stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "locale.h" +#include "string.h" +#include "stdlib.h" +#include "ctype.h" +#include "private/localeP.h" + +LOCAL char *currentName = "C"; /* current locale name */ +__linfo __clocale = + { + "C" + }; + + +/******************************************************************************* +* +* setlocale - set the appropriate locale (ANSI) +* +* This function is included for ANSI compatibility. Only the default is +* implemented. At program start-up, the equivalent of the following is +* executed: +* .CS +* setlocale (LC_ALL, "C"); +* .CE +* This specifies the program's entire locale and the minimal environment +* for C translation. +* +* INTERNAL +* This function selects the appropriate portion of the program's locale as +* specified by the and arguments. This routine can +* be used to change or query the program's entire current locale or portions +* thereof. +* +* Values for affect the locale as follows: +* .iP LC_ALL +* specifies the program's entire locale. +* .iP LC_COLLATE +* affects the behavior of the strcoll() and strxfrm() functions. +* .iP LC_CTYPE +* affects the behavior of the character-handling functions and the multi-byte +* functions. +* .iP LC_MONETARY +* affects the monetary-formatting information returned by localeconv(). +* .iP LC_NUMERIC +* affects the decimal-point character for the formatted input/output +* functions and the string-conversion functions, as well as the +* nonmonetary-formatting information returned by localeconv(). +* .iP LC_TIME +* affects the behavior of the strftime() function. +* .LP +* +* A value of "C" for specifies the minimal environment for C +* translation; a value of "" specifies the implementation-defined native +* environment. Other implementation-defined strings may be passed as the +* second argument. +* +* At program start-up, the equivalent of the following is executed: +* .CS +* setlocale (LC_ALL, "C"); +* .CE +* +* The implementation behaves as if no library function calls setlocale(). +* +* If is a pointer to a string and the selection can be +* honored, setlocale() returns a pointer to the string associated with the +* specified category for the new locale. If the selection cannot be +* honored, it returns a null pointer and the program's locale is unchanged. +* +* If is null pointer, setlocale() returns a pointer to the +* string associated with the category for the program's current locale; the +* program's locale is unchanged. +* +* The string pointer returned by setlocale() is such that a subsequent call +* with that string value and its associated category will restore that part +* of the program's locale. The string is not modified by the program, but +* may be overwritten by a subsequent call to setlocale(). +* +* INCLUDE FILES: locale.h, string.h, stdlib.h +* +* RETURNS: A pointer to the string "C". +*/ + +char *setlocale + ( + int category, /* category to change */ + const char *localeName /* locale name */ + ) + { + if (localeName != NULL && + (strcmp (localeName, currentName) != 0) && + (strcmp (localeName, "") != 0)) + return (NULL); + + return (CHAR_FROM_CONST(currentName)); + } + diff --git a/libc/locale/localeconv.c b/libc/locale/localeconv.c new file mode 100644 index 0000000..24213c0 --- /dev/null +++ b/libc/locale/localeconv.c @@ -0,0 +1,175 @@ +/* localeconv.c - ANSI locale */ + +/* Copyright 1992-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,11feb95,jdi doc tweaks. +01e,14mar93,jdi fixed typo. +01d,07feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions +01b,12jul92,smb changed definition of localeconv for MIPS cpp. +01a,08jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: locale.h limits.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "locale.h" +#include "limits.h" + +/* locals */ + +static char null[] = ""; + +struct lconv __locale = + { + /* LC_NUMERIC */ + ".", /* decimal_point */ + null, /* thousands_sep */ + null, /* grouping */ + /* LC_MONETARY */ + null, /* int_curr_symbol */ + null, /* currency_symbol */ + null, /* mon_decimal_point */ + null, /* mon_thousands_sep */ + null, /* mon_grouping */ + null, /* positive_sign */ + null, /* negative_sign */ + CHAR_MAX, /* int_frac_digits */ + CHAR_MAX, /* frac_digits */ + CHAR_MAX, /* p_cs_precedes */ + CHAR_MAX, /* p_sep_by_space */ + CHAR_MAX, /* n_cs_precedes */ + CHAR_MAX, /* n_sep_by_space */ + CHAR_MAX, /* p_sign_posn */ + CHAR_MAX /* n_sign_posn */ + }; + + +#undef localeconv +/******************************************************************************* +* +* localeconv - set the components of an object with type `lconv' (ANSI) +* +* This routine sets the components of an object with type `struct lconv' +* with values appropriate for the formatting of numeric quantities +* (monetary and otherwise) according to the rules of the current locale. +* +* The members of the structure with type `char *' are pointers to strings +* any of which (except `decimal_point') can point to "" to indicate that +* the value is not available in the current locale or is of zero length. +* The members with type `char' are nonnegative numbers, any of which can be +* CHAR_MAX to indicate that the value is not available in the current locale. +* The members include the following: +* .iP "char *decimal_point" "" 3 +* The decimal-point character used to format nonmonetary quantities. +* .iP "char *thousands_sep" +* The character used to separate groups of digits before the +* decimal-point character in formatted nonmonetary quantities. +* .iP "char *grouping" +* A string whose elements indicate the size of each group of +* digits in formatted nonmonetary quantities. +* .iP "char *int_curr_symbol" +* The international currency symbol applicable to the current +* locale. The first three characters contain the alphabetic international +* currency symbol in accordance with those specified in ISO 4217:1987. +* The fourth character (immediately preceding the null character) is the +* character used to separate the international currency symbol from +* the monetary quantity. +* .iP "char *currency_symbol" +* The local currency symbol applicable to the current locale. +* .iP "char *mon_decimal_point" +* The decimal-point used to format monetary quantities. +* .iP "char *mon_thousands_sep" +* The separator for groups of digits before the decimal-point in +* formatted monetary quantities. +* .iP "char *mon_grouping" +* A string whose elements indicate the size of each group of digits in +* formatted monetary quantities. +* .iP "char *positive_sign" +* The string used to indicate a nonnegative-valued formatted monetary +* quantity. +* .iP "char *negative_sign" +* The string used to indicate a negative-valued formatted monetary +* quantity. +* .iP "char int_frac_digits" +* The number of fractional digits (those after the decimal-point) +* to be displayed in an internationally formatted monetary quantity. +* .iP "char frac_digits" +* The number of fractional digits (those after the decimal-point) +* to be displayed in a formatted monetary quantity. +* .iP "char p_cs_precedes" +* Set to 1 or 0 if the `currency_symbol' respectively precedes or +* succeeds the value for a nonnegative formatted monetary quantity. +* .iP "char p_sep_by_space" +* Set to 1 or 0 if the `currency_symbol' respectively is or is not +* separated by a space from the value for a nonnegative formatted +* monetary quantity. +* .iP "char n_cs_precedes" +* Set to 1 or 0 if the `currency_symbol' respectively precedes or +* succeeds the value for a negative formatted monetary quantity. +* .iP "char n_sep_by_space" +* Set to 1 or 0 if the `currency_symbol' respectively is or is not +* separated by a space from the value for a negative formatted monetary +* quantity. +* .iP "char p_sign_posn" +* Set to a value indicating the positioning of the `positive_sign' +* for a nonnegative formatted monetary quantity. +* .iP "char n_sign_posn" +* Set to a value indicating the positioning of the `negative_sign' +* for a negative formatted monetary quantity. +* +* .LP +* The elements of `grouping' and `mon_grouping' are interpreted according +* to the following: +* .iP "CHAR_MAX" "" 1 +* No further grouping is to be performed. +* .iP "0" +* The previous element is to be repeatedly used for the remainder of the digits. +* .iP "other" +* The integer value is the number of the digits that comprise the current +* group. The next element is examined to determined the size of the next +* group of digits before the current group. +* +* .LP +* The values of `p_sign_posn' and `n_sign_posn' are interpreted according to +* the following: +* .iP "0" +* Parentheses surround the quantity and `currency_symbol'. +* .iP "1" +* The sign string precedes the quantity and `currency_symbol'. +* .iP "2" +* The sign string succeeds the quantity and `currency_symbol'. +* .iP "3" +* The sign string immediately precedes the `currency_symbol'. +* .iP "4" +* The sign string immediately succeeds the `currency_symbol'. +* +* .LP +* The implementation behaves as if no library function calls localeconv(). +* +* The localeconv() routine returns a pointer to the filled-in object. The +* structure pointed to by the return value is not modified by the +* program, but may be overwritten by a subsequent call to localeconv(). +* In addition, calls to setlocale() with categories LC_ALL, LC_MONETARY, +* or LC_NUMERIC may overwrite the contents of the structure. +* +* INCLUDE FILES: locale.h, limits.h +* +* RETURNS: A pointer to the structure `lconv'. +*/ + +struct lconv *localeconv (void) + { + return (&__locale); + } diff --git a/libc/locale/setlocale.c b/libc/locale/setlocale.c new file mode 100644 index 0000000..fd51b50 --- /dev/null +++ b/libc/locale/setlocale.c @@ -0,0 +1,113 @@ +/* setlocale.c - ANSI locale */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,30aug93,jmm fixed null pointer dereference in setlocale() (spr 2490) +01e,07feb93,jdi documentation cleanup for 5.1. +01d,28sep92,smb added ANSI to function description +01c,20sep92,smb documentation additions +01b,14sep92,smb added some minor error checking. +01a,08jul92,smb written +*/ + +/* +DESCRIPTION + +INCLUDE FILE: locale.h string.h stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "locale.h" +#include "string.h" +#include "stdlib.h" +#include "ctype.h" +#include "private/localeP.h" + +LOCAL char *currentName = "C"; /* current locale name */ +__linfo __clocale = + { + "C" + }; + + +/******************************************************************************* +* +* setlocale - set the appropriate locale (ANSI) +* +* This function selects the appropriate portion of the program's locale as +* specified by the and arguments. This routine can +* be used to change or query the program's entire current locale or portions +* thereof. +* +* Values for affect the locale as follows: +* .iP LC_ALL +* specifies the program's entire locale. +* .iP LC_COLLATE +* affects the behavior of the strcoll() and strxfrm() functions. +* .iP LC_CTYPE +* affects the behavior of the character-handling functions and the multi-byte +* functions. +* .iP LC_MONETARY +* affects the monetary-formatting information returned by localeconv(). +* .iP LC_NUMERIC +* affects the decimal-point character for the formatted input/output +* functions and the string-conversion functions, as well as the +* nonmonetary-formatting information returned by localeconv(). +* .iP LC_TIME +* affects the behavior of the strftime() function. +* .LP +* +* A value of "C" for specifies the minimal environment for C +* translation; a value of "" specifies the implementation-defined native +* environment. Other implementation-defined strings may be passed as the +* second argument. +* +* At program start-up, the equivalent of the following is executed: +* .CS +* setlocale (LC_ALL, "C"); +* .CE +* +* The implementation behaves as if no library function calls setlocale(). +* +* If is a pointer to a string and the selection can be +* honored, setlocale() returns a pointer to the string associated with the +* specified category for the new locale. If the selection cannot be +* honored, it returns a null pointer and the program's locale is unchanged. +* +* If is null pointer, setlocale() returns a pointer to the +* string associated with the category for the program's current locale; the +* program's locale is unchanged. +* +* The string pointer returned by setlocale() is such that a subsequent call +* with that string value and its associated category will restore that part +* of the program's locale. The string is not modified by the program, but +* may be overwritten by a subsequent call to setlocale(). +* +* Currently, only the "C" locale is implemented in this library. +* +* INCLUDE FILES: locale.h, string.h, stdlib.h +* +* RETURNS: A pointer to the string "C". +*/ + +char *setlocale + ( + int category, /* category to change */ + const char *localeName /* locale name */ + ) + { + if (localeName != NULL && + (strcmp (localeName, currentName) != 0) && + (strcmp (localeName, "") != 0)) + return (NULL); + + return (CHAR_FROM_CONST(currentName)); + } + diff --git a/libc/math/Makefile b/libc/math/Makefile new file mode 100644 index 0000000..14a5ae7 --- /dev/null +++ b/libc/math/Makefile @@ -0,0 +1,195 @@ +# Makefile - makefile for vw/src/libc/math +# +# modification history +# -------------------- +# 02d,27mar02,to disable build for ARM again +# 02c,18dec01,to add ARMARCH5(_T) support +# 02b,06dec01,pfl enabled build of support.o for all archs. +# 02a,23aug01,pch Add PPC440 +# 01m,24oct01,tam updated for repackaging +# 01l,09oct01,jb re-enabling gnu math lib for ARMARCH4/STRONGARM/XSCALE +# 01k,05sep01,hdn added hyperbolic routines for I80X86 (spr 25654) +# 01k,23jul01,scm change XScale name to conform to coding standards... +# 01j,23jul01,to removed ARMARCH4, STRONGARM and XScale in favor of fplib +# from ARM ltd. +# 01j,16aug01,hdn added PENTIUM2/3/4 support +# 01i,26oct00,s_m renamed PPC405 cpu types +# 01h,12oct00,sm added list of objects for PPC405 and PPC405F +# 01l,08feb01,roz use libc math functions for mips32 and 64 +# 01n,04may01,scm add STRONGARM support... +# 01m,09oct00,dh MCF5400 support (coldfire v4) +# 01l,14jul00,dra use pow() for vr5400 +# 01k,13jan00,yvp adding OBJS_FR500 for Fujitsu FR-V (a.k.a Venus) family +# 01j,21mar00,dra added ColdFire support. +# 01i,07sep99,myz added CW4000_16 support. +# 01g,24apr98,ur added M.CORE CPU1* support. +# 01i,20dec99,dra Updated VR4100 support. +# 01h,19jan99,dra added CW4000, CW4011, VR4100, VR5000 and VR5400 support. +# 01h,06jun99,dra added SPARCV9 support. +# 01j,20mar01,zl removed obsolete SH CPU types. +# 01i,20oct00,hk changed OBJS_SH7750 empty to use optimized math library. +# 01h,03mar00,zl merged SH support from T1 +# 01k,06feb01,roz add pow function for all mips32, mips64 +# 01j,01feb01,roz include pow for vr5400 only +# 01i,31jan01,sru add fabs.o to MIPS32 and MIPS64 soft float libraries +# 01h,25jan01,mem update MIPS entries. +# 01g,18aug98,tpr added PowerPC EC 603 support. +# 01j,30jun98,cym added SIMNT support. +# 01i,09apr98,hdn added Pentium support. +# 01h,26mar97,cdp added ARM7TDMI_T support. +# 01g,02dec96,cdp added OBJS_ARM*. +# 01f,16dec96,kkk added R4650 support. +# 01e,07dec96,tpr reworked PPC403 and PPC860 rules. +# 01d,07dec96,tpr added supporty.o to I960KB rule. +# 01c,03dec96,tpr reworked I960 rules. +# 01b,16oct96,tam modified OBJS_PPC603 and OBJS_PPC604. +# 01a,18jun96,yp created from 02c of MakeSkel +# +# DESCRIPTION +# This file contains the makefile rules for building the portable +# ANSI C math routines. +# +# Each cpu architecture requires a specific list of these functions. +# In many cases, some subset of the ANSI functions are defined in the +# /math directories, so not all files in this directory are +# required. Files from this directory should be specified to provide +# all functions which are not supplied in an architecture-specific form. +# +# Note: modf() is required by portions of the ANSI C I/O libraries +# and should therefore be included for all architectures. +# +#*/ + +TGT_DIR=$(WIND_BASE)/target + +DOC_FILES= ansiMath.c + +## ansiMath.c includes the following files +# asincos.c atan.c atan2.c ceil.c +# cosh.c exp.c fabs.c floor.c fmod.c frexp.c ldexp.c log.c +# log10.c modf.c pow.c sincos.c sinh.c sqrt.c tan.c tanh.c + +LIB_BASE_NAME = os + +OBJS_MIN= frexp.o ldexp.o modf.o +OBJS_CPU32 = $(OBJS_MIN) +OBJS_I960CA = ceil.o floor.o +OBJS_I960HX = $(OBJS_I960CA) +OBJS_I960JX = $(OBJS_I960CA) +OBJS_I960KA = $(OBJS_I960CA) +OBJS_I960KB = support.o +OBJS_MC68000 = $(OBJS_MIN) +OBJS_MC68010 = $(OBJS_MIN) +OBJS_MC68020 = $(OBJS_MIN) support.o +OBJS_MC68040 = $(OBJS_MIN) fmod.o pow.o support.o log__L.o exp__E.o +OBJS_MC68LC040 = $(OBJS_MIN) fmod.o pow.o support.o log__L.o exp__E.o +OBJS_MC68060 = $(OBJS_MIN) fmod.o pow.o support.o log__L.o exp__E.o +OBJS_MCF5200 = $(OBJS_MIN) acosh.o asincos.o asinh.o atan.o atan2.o \ + atanh.o ceil.o cosh.o exp.o exp__E.o expm1.o floor.o \ + fmod.o log.o log10.o log1p.o log__L.o pow.o sincos.o \ + sinh.o sqrt.o support.o tan.o tanh.o fabs.o +OBJS_MCF5400 = $(OBJS_MIN) acosh.o asincos.o asinh.o atan.o atan2.o \ + atanh.o ceil.o cosh.o exp.o exp__E.o expm1.o floor.o \ + fmod.o log.o log10.o log1p.o log__L.o pow.o sincos.o \ + sinh.o sqrt.o support.o tan.o tanh.o fabs.o +OBJS_MIPS32 = $(OBJS_MIN) acosh.o asincos.o asinh.o atan.o atan2.o \ + atanh.o ceil.o cosh.o exp.o exp__E.o expm1.o fabs.o floor.o \ + fmod.o log.o log10.o log1p.o log__L.o pow.o sincos.o \ + sinh.o sqrt.o support.o tan.o tanh.o +OBJS_MIPS64 = $(OBJS_MIN) acosh.o asincos.o asinh.o atan.o atan2.o \ + atanh.o ceil.o cosh.o exp.o exp__E.o expm1.o fabs.o floor.o \ + fmod.o log.o log10.o log1p.o log__L.o pow.o sincos.o \ + sinh.o sqrt.o support.o tan.o tanh.o +OBJS_SPARC = $(OBJS_MIN) acosh.o asincos.o asinh.o atan.o atan2.o \ + atanh.o ceil.o cosh.o exp.o exp__E.o expm1.o floor.o \ + fmod.o log.o log10.o log1p.o log__L.o pow.o sincos.o \ + sinh.o sqrt.o support.o tan.o tanh.o +OBJS_SPARClite = acosh.o asinh.o atanh.o exp__E.o expm1.o log1p.o log__L.o \ + support.o +OBJS_ULTRASPARC = $(OBJS_MIN) acosh.o asincos.o asinh.o atan.o atan2.o \ + atanh.o ceil.o cosh.o exp.o exp__E.o expm1.o floor.o \ + fmod.o log.o log10.o log1p.o log__L.o pow.o sincos.o \ + sinh.o sqrt.o support.o tan.o tanh.o +OBJS_SIMSPARCSOLARIS = $(OBJS_MIN) acosh.o asincos.o asinh.o atan.o atan2.o \ + atanh.o ceil.o cosh.o exp.o exp__E.o expm1.o fabs.o floor.o \ + fmod.o log.o log10.o log1p.o log__L.o pow.o sincos.o \ + sinh.o sqrt.o support.o tan.o tanh.o +OBJS_SIMSPARCSUNOS = $(OBJS_MIN) acosh.o asincos.o asinh.o atan.o atan2.o \ + atanh.o ceil.o cosh.o exp.o exp__E.o expm1.o fabs.o floor.o \ + fmod.o log.o log10.o log1p.o log__L.o pow.o sincos.o \ + sinh.o sqrt.o support.o tan.o tanh.o +OBJS_SIMHPPA = $(OBJS_MIN) acosh.o asincos.o asinh.o atan.o atan2.o \ + atanh.o ceil.o cosh.o exp.o exp__E.o expm1.o fabs.o floor.o \ + fmod.o log.o log10.o log1p.o log__L.o pow.o sincos.o \ + sinh.o sqrt.o support.o tan.o tanh.o +OBJS_SIMNT = $(OBJS_MIN) acosh.o asincos.o asinh.o atan.o atan2.o \ + atanh.o ceil.o cosh.o exp.o exp__E.o expm1.o fabs.o floor.o \ + fmod.o log.o log10.o log1p.o log__L.o pow.o sincos.o \ + sinh.o sqrt.o support.o tan.o tanh.o +OBJS_I80386 = $(OBJS_MIN) cosh.o sinh.o tanh.o support.o expm1.o \ + exp__E.o exp.o +OBJS_I80486 = $(OBJS_MIN) cosh.o sinh.o tanh.o support.o expm1.o \ + exp__E.o exp.o +OBJS_PENTIUM = $(OBJS_MIN) cosh.o sinh.o tanh.o support.o expm1.o \ + exp__E.o exp.o +OBJS_PENTIUM2 = $(OBJS_MIN) cosh.o sinh.o tanh.o support.o expm1.o \ + exp__E.o exp.o +OBJS_PENTIUM3 = $(OBJS_MIN) cosh.o sinh.o tanh.o support.o expm1.o \ + exp__E.o exp.o +OBJS_PENTIUM4 = $(OBJS_MIN) cosh.o sinh.o tanh.o support.o expm1.o \ + exp__E.o exp.o +OBJS_AM29030 = acosh.o asinh.o exp__E.o expm1.o log1p.o log__L.o support.o +OBJS_AM29200 = $(OBJS_AM29030) + +OBJS_PPC403 = support.o +OBJS_PPC405 = $(OBJS_PPC403) +OBJS_PPC405F = $(OBJS_MIN) acosh.o asincos.o asinh.o atanh.o ceil.o cosh.o \ + exp__E.o expm1.o floor.o fmod.o log1p.o log__L.o sinh.o \ + support.o tan.o tanh.o fabs.o sqrt.o atan2.o exp.o atan.o \ + sincos.o log.o log10.o pow.o +OBJS_PPC440 = $(OBJS_PPC403) +OBJS_PPC505 = $(OBJS_PPC403) +OBJS_PPC509 = $(OBJS_PPC603) +OBJS_PPC555 = $(OBJS_PPC603) +OBJS_PPC601 = $(OBJS_PPC403) +OBJS_PPC603 = $(OBJS_MIN) acosh.o asincos.o asinh.o atanh.o ceil.o cosh.o \ + exp__E.o expm1.o floor.o fmod.o log1p.o log__L.o sinh.o \ + support.o tan.o tanh.o fabs.o +OBJS_PPCEC603 = $(OBJS_PPC403) +OBJS_PPC604 = $(OBJS_PPC603) +OBJS_PPC860 = $(OBJS_PPC403) + +OBJS_MCORE10 = acosh.o asincos.o asinh.o atan.o atan2.o \ + atanh.o ceil.o cosh.o exp.o exp__E.o expm1.o fabs.o \ + floor.o fmod.o frexp.o ldexp.o log.o log10.o log1p.o \ + log__L.o modf.o pow.o sincos.o sinh.o sqrt.o support.o \ + tan.o tanh.o +OBJS_MCORE15 = $(OBJS_MCORE10) + +OBJS_ARM = $(OBJS_MIN) acosh.o asincos.o asinh.o atan.o atan2.o \ + atanh.o ceil.o cosh.o exp.o exp__E.o expm1.o floor.o \ + fmod.o log.o log10.o log1p.o log__L.o pow.o sincos.o \ + sinh.o sqrt.o support.o tan.o tanh.o fabs.o +OBJS_ARMARCH4 = +OBJS_ARMARCH4_T = $(OBJS_ARM) +OBJS_ARMARCH5 = +OBJS_ARMARCH5_T = $(OBJS_ARM) +OBJS_STRONGARM = +OBJS_XSCALE = + +OBJS_FRV = acosh.o asincos.o asinh.o atan.o atan2.o atanh.o ceil.o \ + cosh.o exp.o exp__E.o expm1.o floor.o fabs.o floor.o \ + fmod.o frexp.o ldexp.o log.o log10.o log1p.o log__L.o \ + modf.o pow.o sincos.o sinh.o sqrt.o support.o tan.o tanh.o +OBJS_FR500 = $(OBJS_FRV) + +OBJS_SH7000 = support.o +OBJS_SH7600 = $(OBJS_SH7000) +OBJS_SH7700 = $(OBJS_SH7000) +OBJS_SH7750 = $(OBJS_SH7000) + +OBJS= $(OBJS_$(CPU)) + + +include $(TGT_DIR)/h/make/rules.library + diff --git a/libc/math/acosh.c b/libc/math/acosh.c new file mode 100644 index 0000000..09202e1 --- /dev/null +++ b/libc/math/acosh.c @@ -0,0 +1,114 @@ +/* acosh.c - ANSI math routines */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,14oct92,jdi made acosh() nomanual. +01c,13oct92,jdi mangen fixes +01b,20sep92,smb documentation additions +01a,08jul92,smb documentation +*/ + +/* +DESCRIPTION +* Copyright (c) 1985 Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms are permitted +* provided that the above copyright notice and this paragraph are +* duplicated in all such forms and that any documentation, +* advertising materials, and other materials related to such +* distribution and use acknowledge that the software was developed +* by the University of California, Berkeley. The name of the +* University may not be used to endorse or promote products derived +* from this software without specific prior written permission. +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +* +* All recipients should regard themselves as participants in an ongoing +* research project and hence should feel obligated to report their +* experiences (good or bad) with these elementary function codes, using +* the sendbug(8) program, to the authors. +* +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" + + +#if defined(vax)||defined(tahoe) /* VAX D format */ +#ifdef vax +#define _0x(A,B) 0x/**/A/**/B +#else /* vax */ +#define _0x(A,B) 0x/**/B/**/A +#endif /* vax */ +/* static double */ +/* ln2hi = 6.9314718055829871446E-1 , Hex 2^ 0 * .B17217F7D00000 */ +/* ln2lo = 1.6465949582897081279E-12 ; Hex 2^-39 * .E7BCD5E4F1D9CC */ +static long ln2hix[] = { _0x(7217,4031), _0x(0000,f7d0)}; +static long ln2lox[] = { _0x(bcd5,2ce7), _0x(d9cc,e4f1)}; +#define ln2hi (*(double*)ln2hix) +#define ln2lo (*(double*)ln2lox) +#else /* defined(vax)||defined(tahoe) */ +static double +ln2hi = 6.9314718036912381649E-1 , /*Hex 2^ -1 * 1.62E42FEE00000 */ +ln2lo = 1.9082149292705877000E-10 ; /*Hex 2^-33 * 1.A39EF35793C76 */ +#endif /* defined(vax)||defined(tahoe) */ + +/***************************************************************************** +* +* acosh - compute the inverse hyperbolic cosine of +* +* This routine returns the inverse hyperbolic cosine of +* in double precision (VAX D Format 56 BITS, IEEE Double 53 BITS). +* +* Required system support function: sqrt() +* +* Required kernel function: +* .CS +* log1p(x) ...return log(1+x) +* .CE +* +* Based on acosh(x) = log [ x + sqrt(x*x-1) ] we have +* .CS +* acosh(x) := log1p(x)+ln2, if (x > 1.0E20); else +* acosh(x) := log1p( sqrt(x-1) * (sqrt(x-1) + sqrt(x+1)) ) . +* .CE +* These formulae avoid the over/underflow complication. +* +* Special cases are acosh(x) is NaN with signal if x<1 and acosh(NaN) +* is NaN without signal. +* +* RETURNS: The inverse hyperbolic cosine of . +* It returns the exact inverse hyperbolic cosine of nearly +* rounded. In a test run with 512,000 random arguments on a VAX, the +* maximum observed error was 3.30 ulps (units of the last place) at +* x=1.0070493753568216. +* +* INTERNAL +* Coded IN C BY K.C. NG, 2/16/85; +* Revised BY K.C. NG on 3/6/85, 3/24/85, 4/16/85, 8/17/85. +* +* NOMANUAL +*/ + +double acosh(x) +double x; +{ + double log1p(),sqrt(),t,big=1.E20; /* big+1==big */ + +#if !defined(vax)&&!defined(tahoe) + if(x!=x) return(x); /* x is NaN */ +#endif /* !defined(vax)&&!defined(tahoe) */ + + /* return log1p(x) + log(2) if x is large */ + if(x>big) {t=log1p(x)+ln2lo; return(t+ln2hi);} + + t=sqrt(x-1.0); + return(log1p(t*(t+sqrt(x+1.0)))); +} diff --git a/libc/math/ansiMath.c b/libc/math/ansiMath.c new file mode 100644 index 0000000..f5a4ed9 --- /dev/null +++ b/libc/math/ansiMath.c @@ -0,0 +1,2726 @@ +/* ansiMath.c - ANSI `math' documentation */ + +/* Copyright 1992-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,23may01,to doc fix for frexp() +01j,03jan01,pes Fix compiler warnings. +01i,04feb99,dgp document errno values. +01h,19mar95,dvs removed TRON reference - no longer supported. +01g,10feb95,rhp update from subsidiary files +01f,16jan95,rhp library man page: correct spelling of HUGE_VAL +01e,13mar93,jdi doc tweak. +01d,05feb93,jdi doc changes based on kdl review. +01c,02dec92,jdi doc tweaks. +01b,28oct92,jdi updated with new versions of .c files +01a,24oct92,smb documentation +*/ + +/* +DESCRIPTION +The header math.h declares several mathematical functions and defines one +macro. The functions take double arguments and return double values. + +The macro defined is: +.iP `HUGE_VAL' 15 +expands to a positive double expression, not necessarily representable +as a float. +.LP + +The behavior of each of these functions is defined for all representable +values of their input arguments. Each function executes as if it were a +single operation, without generating any externally visible exceptions. + +For all functions, a domain error occurs if an input argument is outside +the domain over which the mathematical function is defined. The +description of each function lists any applicable domain errors. On a +domain error, the function returns an implementation-defined value; the +value EDOM is stored in `errno'. + +Similarly, a range error occurs if the result of the function cannot be +represented as a double value. If the result overflows (the magnitude of +the result is so large that it cannot be represented in an object of the +specified type), the function returns the value HUGE_VAL, with the same +sign (except for the tan() function) as the correct value of the function; +the value ERANGE is stored in `errno'. If the result underflows (the +type), the function returns zero; whether the integer expression `errno' +acquires the value ERANGE is implementation defined. + +INCLUDE FILES: math.h + +SEE ALSO: mathALib, American National Standard X3.159-1989 + +INTERNAL +When generating man pages, the man pages from this library should be +built AFTER those from arch/mc68k/math/mathALib. Thus, where there are +equivalent man pages in both ansiMath and mathALib, the ones in ansiMath +will overwrite those from mathALib, which is the correct behavior. +This ordering is set up in the overall makefile system. + +INTERNAL +This module is built by appending the following files: + asincos.c + atan.c + atan2.c + ceil.c + cosh.c + exp.c + fabs.c + floor.c + fmod.c + frexp.c + ldexp.c + log.c + log10.c + modf.c + pow.c + sincos.c + sinh.c + sqrt.c + tan.c + tanh.c +*/ + + +/* asincos.c - inverse sine and cosine math routines */ + +/* Copyright 1992-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,09dec94,rhp fix man pages for inverse trig fns +01g,05feb93,jdi doc changes based on kdl review. +01f,02dec92,jdi doc tweaks. +01e,28oct92,jdi documentation cleanup. +01d,13oct92,jdi mangen fixes. +01c,21sep92,smb corrected file name in first line of file. +01b,20sep92,smb documentation additions +01a,08jul92,smb documentation +*/ + +/* +DESCRIPTION + + * Copyright (c) 1985 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * All recipients should regard themselves as participants in an ongoing + * research project and hence should feel obligated to report their + * experiences (good or bad) with these elementary function codes, using + * the sendbug(8) program, to the authors. + +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" + +/******************************************************************************* +* +* asin - compute an arc sine (ANSI) +* +* This routine returns the principal value of the arc sine of +* in double precision (IEEE double, 53 bits). +* If is the sine of an angle , this function returns . +* +* A domain error occurs for arguments not in the range [-1,+1]. +* +* INTERNAL +* Method: +* asin(x) = atan2(x,sqrt(1-x*x)) +* For better accuracy, 1-x*x is computed as follows: +* 1-x*x if x < 0.5, +* 2*(1-|x|)-(1-|x|)*(1-|x|) if x >= 0.5. +* +* INCLUDE FILES: math.h +* +* RETURNS: +* The double-precision arc sine of in the range [-pi/2,pi/2] radians. +* +* Special cases: +* If is NaN, asin() returns . +* If |x|>1, it returns NaN. +* +* SEE ALSO: mathALib +* +* INTERNAL +* Coded in C by K.C. Ng, 4/16/85, REVISED ON 6/10/85. +*/ + +double asin + ( + double x /* number between -1 and 1 */ + ) + + { + double s,t,copysign(),atan2(),sqrt(),one=1.0; +#if !defined(vax)&&!defined(tahoe) + if(x!=x) return(x); /* x is NaN */ +#endif /* !defined(vax)&&!defined(tahoe) */ + s=copysign(x,one); + if(s <= 0.5) + return(atan2(x,sqrt(one-x*x))); + else + { t=one-s; s=t+t; return(atan2(x,sqrt(s-t*t))); } + + } + +/******************************************************************************* +* +* acos - compute an arc cosine (ANSI) +* +* This routine returns principal value of the arc cosine of +* in double precision (IEEE double, 53 bits). +* If is the cosine of an angle , this function returns . +* +* A domain error occurs for arguments not in the range [-1,+1]. +* +* INTERNAL +* Method: +* ________ +* / 1 - x +* acos(x) = 2*atan2( / -------- , 1 ) . +* \/ 1 + x +* +* INCLUDE FILES: math.h +* +* RETURNS: +* The double-precision arc cosine of in the range [0,pi] radians. +* +* Special cases: +* If is NaN, acos() returns . +* If |x|>1, it returns NaN. +* +* SEE ALSO: mathALib +* +* INTERNAL +* Coded in C by K.C. Ng, 4/16/85, revised on 6/10/85. +*/ + +double acos + ( + double x /* number between -1 and 1 */ + ) + + { + double t,copysign(),atan2(),sqrt(),one=1.0; +#if !defined(vax)&&!defined(tahoe) + if(x!=x) return(x); +#endif /* !defined(vax)&&!defined(tahoe) */ + if( x != -1.0) + t=atan2(sqrt((one-x)/(one+x)),one); + else + t=atan2(one,0.0); /* t = PI/2 */ + return(t+t); + } +/* atan.c - math routines */ + +/* Copyright 1992-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,09dec94,rhp fix man pages for inverse trig fns +01e,05feb93,jdi doc changes based on kdl review. +01d,02dec92,jdi doc tweaks. +01c,28oct92,jdi documentation cleanup. +01b,20sep92,smb documentation additions +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +* Copyright (c) 1985 Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms are permitted +* provided that the above copyright notice and this paragraph are +* duplicated in all such forms and that any documentation, +* advertising materials, and other materials related to such +* distribution and use acknowledge that the software was developed +* by the University of California, Berkeley. The name of the +* University may not be used to endorse or promote products derived +* from this software without specific prior written permission. +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +* +* All recipients should regard themselves as participants in an ongoing +* research project and hence should feel obligated to report their +* experiences (good or bad) with these elementary function codes, using +* the sendbug(8) program, to the authors. + +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" + + +/******************************************************************************* +* +* atan - compute an arc tangent (ANSI) +* +* This routine returns the principal value of the arc tangent of in +* double precision (IEEE double, 53 bits). +* If is the tangent of an angle , this function returns +* (in radians). +* +* INCLUDE FILES: math.h +* +* RETURNS: +* The double-precision arc tangent of in the range [-pi/2,pi/2] radians. +* Special case: if is NaN, atan() returns itself. +* +* SEE ALSO: mathALib +* +* INTERNAL: +* Coded in C by K.C. Ng, 4/16/85, revised on 6/10/85. +*/ + +double atan + ( + double x /* tangent of an angle */ + ) + + { + double atan2(),one=1.0; + return(atan2(x,one)); + } +/* atan2.c - math routines */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,05feb93,jdi doc changes based on kdl review. +01d,02dec92,jdi doc tweaks. +01c,28oct92,jdi documentation cleanup. +01b,20sep92,smb documentation additions +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +* Copyright (c) 1985 Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms are permitted +* provided that the above copyright notice and this paragraph are +* duplicated in all such forms and that any documentation, +* advertising materials, and other materials related to such +* distribution and use acknowledge that the software was developed +* by the University of California, Berkeley. The name of the +* University may not be used to endorse or promote products derived +* from this software without specific prior written permission. +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +* +* All recipients should regard themselves as participants in an ongoing +* research project and hence should feel obligated to report their +* experiences (good or bad) with these elementary function codes, using +* the sendbug(8) program, to the authors. +* +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" + +#if defined(vax)||defined(tahoe) /* VAX D format */ +#ifdef vax +#define _0x(A,B) 0x/**/A/**/B +#else /* vax */ +#define _0x(A,B) 0x/**/B/**/A +#endif /* vax */ +/*static double */ +/*athfhi = 4.6364760900080611433E-1 ,*//*Hex 2^ -1 * .ED63382B0DDA7B */ +/*athflo = 1.9338828231967579916E-19 ,*//*Hex 2^-62 * .E450059CFE92C0 */ +/*PIo4 = 7.8539816339744830676E-1 ,*//*Hex 2^ 0 * .C90FDAA22168C2 */ +/*at1fhi = 9.8279372324732906796E-1 ,*//*Hex 2^ 0 * .FB985E940FB4D9 */ +/*at1flo = -3.5540295636764633916E-18 ,*//*Hex 2^-57 * -.831EDC34D6EAEA */ +/*PIo2 = 1.5707963267948966135E0 ,*//*Hex 2^ 1 * .C90FDAA22168C2 */ +/*PI = 3.1415926535897932270E0 ,*//*Hex 2^ 2 * .C90FDAA22168C2 */ +/*a1 = 3.3333333333333473730E-1 ,*//*Hex 2^ -1 * .AAAAAAAAAAAB75 */ +/*a2 = -2.0000000000017730678E-1 ,*//*Hex 2^ -2 * -.CCCCCCCCCD946E */ +/*a3 = 1.4285714286694640301E-1 ,*//*Hex 2^ -2 * .92492492744262 */ +/*a4 = -1.1111111135032672795E-1 ,*//*Hex 2^ -3 * -.E38E38EBC66292 */ +/*a5 = 9.0909091380563043783E-2 ,*//*Hex 2^ -3 * .BA2E8BB31BD70C */ +/*a6 = -7.6922954286089459397E-2 ,*//*Hex 2^ -3 * -.9D89C827C37F18 */ +/*a7 = 6.6663180891693915586E-2 ,*//*Hex 2^ -3 * .8886B4AE379E58 */ +/*a8 = -5.8772703698290408927E-2 ,*//*Hex 2^ -4 * -.F0BBA58481A942 */ +/*a9 = 5.2170707402812969804E-2 ,*//*Hex 2^ -4 * .D5B0F3A1AB13AB */ +/*a10 = -4.4895863157820361210E-2 ,*//*Hex 2^ -4 * -.B7E4B97FD1048F */ +/*a11 = 3.3006147437343875094E-2 ,*//*Hex 2^ -4 * .8731743CF72D87 */ +/*a12 = -1.4614844866464185439E-2 ;*//*Hex 2^ -6 * -.EF731A2F3476D9 */ +static long athfhix[] = { _0x(6338,3fed), _0x(da7b,2b0d)}; +#define athfhi (*(double *)athfhix) +static long athflox[] = { _0x(5005,2164), _0x(92c0,9cfe)}; +#define athflo (*(double *)athflox) +static long PIo4x[] = { _0x(0fda,4049), _0x(68c2,a221)}; +#define PIo4 (*(double *)PIo4x) +static long at1fhix[] = { _0x(985e,407b), _0x(b4d9,940f)}; +#define at1fhi (*(double *)at1fhix) +static long at1flox[] = { _0x(1edc,a383), _0x(eaea,34d6)}; +#define at1flo (*(double *)at1flox) +static long PIo2x[] = { _0x(0fda,40c9), _0x(68c2,a221)}; +#define PIo2 (*(double *)PIo2x) +static long PIx[] = { _0x(0fda,4149), _0x(68c2,a221)}; +#define PI (*(double *)PIx) +static long a1x[] = { _0x(aaaa,3faa), _0x(ab75,aaaa)}; +#define a1 (*(double *)a1x) +static long a2x[] = { _0x(cccc,bf4c), _0x(946e,cccd)}; +#define a2 (*(double *)a2x) +static long a3x[] = { _0x(4924,3f12), _0x(4262,9274)}; +#define a3 (*(double *)a3x) +static long a4x[] = { _0x(8e38,bee3), _0x(6292,ebc6)}; +#define a4 (*(double *)a4x) +static long a5x[] = { _0x(2e8b,3eba), _0x(d70c,b31b)}; +#define a5 (*(double *)a5x) +static long a6x[] = { _0x(89c8,be9d), _0x(7f18,27c3)}; +#define a6 (*(double *)a6x) +static long a7x[] = { _0x(86b4,3e88), _0x(9e58,ae37)}; +#define a7 (*(double *)a7x) +static long a8x[] = { _0x(bba5,be70), _0x(a942,8481)}; +#define a8 (*(double *)a8x) +static long a9x[] = { _0x(b0f3,3e55), _0x(13ab,a1ab)}; +#define a9 (*(double *)a9x) +static long a10x[] = { _0x(e4b9,be37), _0x(048f,7fd1)}; +#define a10 (*(double *)a10x) +static long a11x[] = { _0x(3174,3e07), _0x(2d87,3cf7)}; +#define a11 (*(double *)a11x) +static long a12x[] = { _0x(731a,bd6f), _0x(76d9,2f34)}; +#define a12 (*(double *)a12x) +#else /* defined(vax)||defined(tahoe) */ +static double +athfhi = 4.6364760900080609352E-1 , /*Hex 2^ -2 * 1.DAC670561BB4F */ +athflo = 4.6249969567426939759E-18 , /*Hex 2^-58 * 1.5543B8F253271 */ +PIo4 = 7.8539816339744827900E-1 , /*Hex 2^ -1 * 1.921FB54442D18 */ +at1fhi = 9.8279372324732905408E-1 , /*Hex 2^ -1 * 1.F730BD281F69B */ +at1flo = -2.4407677060164810007E-17 , /*Hex 2^-56 * -1.C23DFEFEAE6B5 */ +PIo2 = 1.5707963267948965580E0 , /*Hex 2^ 0 * 1.921FB54442D18 */ +PI = 3.1415926535897931160E0 , /*Hex 2^ 1 * 1.921FB54442D18 */ +a1 = 3.3333333333333942106E-1 , /*Hex 2^ -2 * 1.55555555555C3 */ +a2 = -1.9999999999979536924E-1 , /*Hex 2^ -3 * -1.9999999997CCD */ +a3 = 1.4285714278004377209E-1 , /*Hex 2^ -3 * 1.24924921EC1D7 */ +a4 = -1.1111110579344973814E-1 , /*Hex 2^ -4 * -1.C71C7059AF280 */ +a5 = 9.0908906105474668324E-2 , /*Hex 2^ -4 * 1.745CE5AA35DB2 */ +a6 = -7.6919217767468239799E-2 , /*Hex 2^ -4 * -1.3B0FA54BEC400 */ +a7 = 6.6614695906082474486E-2 , /*Hex 2^ -4 * 1.10DA924597FFF */ +a8 = -5.8358371008508623523E-2 , /*Hex 2^ -5 * -1.DE125FDDBD793 */ +a9 = 4.9850617156082015213E-2 , /*Hex 2^ -5 * 1.9860524BDD807 */ +a10 = -3.6700606902093604877E-2 , /*Hex 2^ -5 * -1.2CA6C04C6937A */ +a11 = 1.6438029044759730479E-2 ; /*Hex 2^ -6 * 1.0D52174A1BB54 */ +#endif /* defined(vax)||defined(tahoe) */ + +/******************************************************************************* +* +* atan2 - compute the arc tangent of y/x (ANSI) +* +* This routine returns the principal value of the arc tangent of / in +* double precision (IEEE double, 53 bits). +* This routine uses the signs of both arguments to determine the quadrant of the +* return value. A domain error may occur if both arguments are zero. +* +* INTERNAL: +* (1) Reduce to positive by: +* +* atan2(y,x)=-atan2(-y,x) +* +* (2) Reduce to positive by (if and are unexceptional): +* +* ARG (x+iy) = arctan(y/x) ... if x > 0 +* ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0 +* +* (3) According to the integer k=4t+0.25 truncated , t=y/x, the argument +* is further reduced to one of the following intervals and the +* arc tangent of y/x is evaluated by the corresponding formula: +* +* [0,7/16] atan(y/x) = t - t^3*(a1+t^2*(a2+...(a10+t^2*a11)...) +* [7/16,11/16] atan(y/x) = atan(1/2) + atan( (y-x/2)/(x+y/2) ) +* [11/16.19/16] atan(y/x) = atan( 1 ) + atan( (y-x)/(x+y) ) +* [19/16,39/16] atan(y/x) = atan(3/2) + atan( (y-1.5x)/(x+1.5y) ) +* [39/16,INF] atan(y/x) = atan(INF) + atan( -x/y ) +* +* INCLUDE FILES: math.h +* +* RETURNS: +* The double-precision arc tangent of /, in the range [-pi,pi] radians. +* +* Special cases: +* Notations: atan2(y,x) == ARG (x+iy) == ARG(x,y). +* +* .TS +* tab(|); +* l0 c0 l. +* ARG(NAN, (anything)) | is | NaN +* ARG((anything), NaN) | is | NaN +* ARG(+(anything but NaN), +-0) | is | +-0 +* ARG(-(anything but NaN), +-0) | is | +-PI +* ARG(0, +-(anything but 0 and NaN)) | is | +-PI/2 +* ARG(+INF, +-(anything but INF and NaN)) | is | +-0 +* ARG(-INF, +-(anything but INF and NaN)) | is | +-PI +* ARG(+INF, +-INF) | is | +-PI/4 +* ARG(-INF, +-INF) | is | +-3PI/4 +* ARG((anything but 0, NaN, and INF),+-INF) | is | +-PI/2 +* .TE +* +* SEE ALSO: mathALib +* +* INTERNAL: +* Coded in C by K.C. Ng, 1/8/85; +* Revised by K.C. Ng on 2/7/85, 2/13/85, 3/7/85, 3/30/85, 6/29/85. +*/ + +double atan2 + ( + double y, /* numerator */ + double x /* denominator */ + ) + + { + static double zero=0, one=1, small=1.0E-9, big=1.0E18; + double copysign(),logb(),scalb(),t,z,signy,signx,hi,lo; + int finite(), k,m; + +#if !defined(vax)&&!defined(tahoe) + /* if x or y is NAN */ + if(x!=x) return(x); if(y!=y) return(y); +#endif /* !defined(vax)&&!defined(tahoe) */ + + /* copy down the sign of y and x */ + signy = copysign(one,y) ; + signx = copysign(one,x) ; + + /* if x is 1.0, goto begin */ + if(x==1) { y=copysign(y,one); t=y; if(finite(t)) goto begin;} + + /* when y = 0 */ + if(y==zero) return((signx==one)?y:copysign(PI,signy)); + + /* when x = 0 */ + if(x==zero) return(copysign(PIo2,signy)); + + /* when x is INF */ + if(!finite(x)) + if(!finite(y)) + return(copysign((signx==one)?PIo4:3*PIo4,signy)); + else + return(copysign((signx==one)?zero:PI,signy)); + + /* when y is INF */ + if(!finite(y)) return(copysign(PIo2,signy)); + + /* compute y/x */ + x=copysign(x,one); + y=copysign(y,one); + if((m=(k=logb(y))-logb(x)) > 60) t=big+big; + else if(m < -80 ) t=y/x; + else { t = y/x ; y = scalb(y,-k); x=scalb(x,-k); } + + /* begin argument reduction */ +begin: + if (t < 2.4375) { + + /* truncate 4(t+1/16) to integer for branching */ + k = 4 * (t+0.0625); + switch (k) { + + /* t is in [0,7/16] */ + case 0: + case 1: + if (t < small) + { big + small ; /* raise inexact flag */ + return (copysign((signx>zero)?t:PI-t,signy)); } + + hi = zero; lo = zero; break; + + /* t is in [7/16,11/16] */ + case 2: + hi = athfhi; lo = athflo; + z = x+x; + t = ( (y+y) - x ) / ( z + y ); break; + + /* t is in [11/16,19/16] */ + case 3: + case 4: + hi = PIo4; lo = zero; + t = ( y - x ) / ( x + y ); break; + + /* t is in [19/16,39/16] */ + default: + hi = at1fhi; lo = at1flo; + z = y-x; y=y+y+y; t = x+x; + t = ( (z+z)-x ) / ( t + y ); break; + } + } + /* end of if (t < 2.4375) */ + + else + { + hi = PIo2; lo = zero; + + /* t is in [2.4375, big] */ + if (t <= big) t = - x / y; + + /* t is in [big, INF] */ + else + { big+small; /* raise inexact flag */ + t = zero; } + } + /* end of argument reduction */ + + /* compute atan(t) for t in [-.4375, .4375] */ + z = t*t; +#if defined(vax)||defined(tahoe) + z = t*(z*(a1+z*(a2+z*(a3+z*(a4+z*(a5+z*(a6+z*(a7+z*(a8+ + z*(a9+z*(a10+z*(a11+z*a12)))))))))))); +#else /* defined(vax)||defined(tahoe) */ + z = t*(z*(a1+z*(a2+z*(a3+z*(a4+z*(a5+z*(a6+z*(a7+z*(a8+ + z*(a9+z*(a10+z*a11))))))))))); +#endif /* defined(vax)||defined(tahoe) */ + z = lo - z; z += t; z += hi; + + return(copysign((signx>zero)?z:PI-z,signy)); + } +/* ceil.c - ceil math routine */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,05feb93,jdi doc changes based on kdl review. +01e,02dec92,jdi doc tweaks. +01d,28oct92,jdi documentation cleanup. +01c,20sep92,smb documentation additions +01b,30jul92,kdl changed _d_type() calls to fpTypeGet(). +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" +#include "stddef.h" +#include "errno.h" +#include "private/mathP.h" + + +/******************************************************************************* +* +* ceil - compute the smallest integer greater than or equal to a specified value (ANSI) +* +* This routine returns the smallest integer greater than or equal to , +* in double precision. +* +* INCLUDE FILES: math.h +* +* RETURNS: The smallest integral value greater than or equal to , in +* double precision. +* +* SEE ALSO: mathALib +*/ + +double ceil + ( + double v /* value to find the ceiling of */ + ) + + { + double r; + + switch (fpTypeGet (v, &r)) /* get the type of v */ + { + case ZERO: /* ZERO */ + case INF: /* INFINITY */ + return (0.0); + + case NAN: /* NOT A NUMBER */ + return (v); + + case INTEGER: /* INTEGER */ + return (v); + + case REAL: /* REAL */ + return (((v < 0.0) || (v == r)) ? r : r + 1.0); + + default: + return (0.0); /* this should never happen */ + } + } +/* cosh.c - hyperbolic routines */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,05feb93,jdi doc changes based on kdl review. +01d,02dec92,jdi doc tweaks. +01c,28oct92,jdi documentation cleanup. +01b,20sep92,smb documentation additions +01a,08jul92,smb documentation +*/ + +/* +DESCRIPTION +* Copyright (c) 1985 Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms are permitted +* provided that the above copyright notice and this paragraph are +* duplicated in all such forms and that any documentation, +* advertising materials, and other materials related to such +* distribution and use acknowledge that the software was developed +* by the University of California, Berkeley. The name of the +* University may not be used to endorse or promote products derived +* from this software without specific prior written permission. +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +* +* All recipients should regard themselves as participants in an ongoing +* research project and hence should feel obligated to report their +* experiences (good or bad) with these elementary function codes, using +* the sendbug(8) program, to the authors. +* +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" + +#if defined(vax)||defined(tahoe) +#ifdef vax +#define _0x(A,B) 0x/**/A/**/B +#else /* vax */ +#define _0x(A,B) 0x/**/B/**/A +#endif /* vax */ +/* static double */ +/* mln2hi = 8.8029691931113054792E1 , Hex 2^ 7 * .B00F33C7E22BDB */ +/* mln2lo = -4.9650192275318476525E-16 , Hex 2^-50 * -.8F1B60279E582A */ +/* lnovfl = 8.8029691931113053016E1 ; Hex 2^ 7 * .B00F33C7E22BDA */ +static long mln2hix[] = { _0x(0f33,43b0), _0x(2bdb,c7e2)}; +static long mln2lox[] = { _0x(1b60,a70f), _0x(582a,279e)}; +static long lnovflx[] = { _0x(0f33,43b0), _0x(2bda,c7e2)}; +#define mln2hi (*(double*)mln2hix) +#define mln2lo (*(double*)mln2lox) +#define lnovfl (*(double*)lnovflx) +#else /* defined(vax)||defined(tahoe) */ +static double +mln2hi = 7.0978271289338397310E2 , /*Hex 2^ 10 * 1.62E42FEFA39EF */ +mln2lo = 2.3747039373786107478E-14 , /*Hex 2^-45 * 1.ABC9E3B39803F */ +lnovfl = 7.0978271289338397310E2 ; /*Hex 2^ 9 * 1.62E42FEFA39EF */ +#endif /* defined(vax)||defined(tahoe) */ + +#if defined(vax)||defined(tahoe) +static max = 126 ; +#else /* defined(vax)||defined(tahoe) */ +static max = 1023 ; +#endif /* defined(vax)||defined(tahoe) */ + +/******************************************************************************* +* +* cosh - compute a hyperbolic cosine (ANSI) +* +* This routine returns the hyperbolic cosine of in +* double precision (IEEE double, 53 bits). +* +* A range error occurs if is too large. +* +* INTERNAL: +* Method: +* (1) Replace by |x|. +* (2) +* [ exp(x) - 1 ]^2 +* 0 <= x <= 0.3465 : cosh(x) := 1 + ------------------- +* 2*exp(x) +* +* exp(x) + 1/exp(x) +* 0.3465 <= x <= 22 : cosh(x) := ------------------- +* 2 +* 22 <= x <= lnovfl : cosh(x) := exp(x)/2 +* lnovfl <= x <= lnovfl+log(2) +* : cosh(x) := exp(x)/2 (avoid overflow) +* log(2)+lnovfl < x < INF: overflow to INF +* +* Note: .3465 is a number near one half of ln2. +* +* INCLUDE FILES: math.h +* +* RETURNS: +* The double-precision hyperbolic cosine of . +* +* Special cases: +* If is +INF, -INF, or NaN, cosh() returns . +* +* SEE ALSO: mathALib +* +* INTERNAL: +* Coded in C by K.C. Ng, 1/8/85; +* Revised by K.C. Ng on 2/8/85, 2/23/85, 3/7/85, 3/29/85, 4/16/85. +*/ + +double cosh + ( + double x /* value to compute the hyperbolic cosine of */ + ) + + { + static double half=1.0/2.0,one=1.0, small=1.0E-18; /* fl(1+small)==1 */ + double scalb(),copysign(),exp(),exp__E(),t; + +#if !defined(vax)&&!defined(tahoe) + if(x!=x) return(x); /* x is NaN */ +#endif /* !defined(vax)&&!defined(tahoe) */ + if((x=copysign(x,one)) <= 22) + if(x<0.3465) + if(x in +* double precision (IEEE double, 53 bits). +* +* A range error occurs if is too large. +* +* INTERNAL: +* Method: +* (1) Argument Reduction: given the input , find and integer +* such that: +* +* x = k*ln2 + r, |r| <= 0.5*ln2 +* +* will be represented as r := z+c for better accuracy. +* +* (2) Compute exp(r) by +* +* exp(r) = 1 + r + r*R1/(2-R1) +* +* where: +* +* R1 = x - x^2*(p1+x^2*(p2+x^2*(p3+x^2*(p4+p5*x^2)))) +* +* (3) exp(x) = 2^k * exp(r) +* +* INCLUDE FILES: math.h +* +* RETURNS: The double-precision exponential value of . +* +* Special cases: +* If is +INF or NaN, exp() returns . +* If is -INF, it returns 0. +* +* SEE ALSO: mathALib +* +* INTERNAL: +* Coded in C by K.C. Ng, 1/19/85; +* Revised by K.C. Ng on 2/6/85, 2/15/85, 3/7/85, 3/24/85, 4/16/85, 6/14/86. +*/ + +double exp + ( + double x /* exponent */ + ) + + { + double scalb(), copysign(), z,hi,lo,c; + int k,finite(); + +#if !defined(vax)&&!defined(tahoe) + if(x!=x) return(x); /* x is NaN */ +#endif /* !defined(vax)&&!defined(tahoe) */ + if( x <= lnhuge ) { + if( x >= lntiny ) { + + /* argument reduction : x --> x - k*ln2 */ + + k=invln2*x+copysign(0.5,x); /* k=NINT(x/ln2) */ + + /* express x-k*ln2 as hi-lo and let x=hi-lo rounded */ + + hi=x-k*ln2hi; + x=hi-(lo=k*ln2lo); + + /* return 2^k*[1+x+x*c/(2+c)] */ + z=x*x; + c= x - z*(p1+z*(p2+z*(p3+z*(p4+z*p5)))); + return scalb(1.0+(hi-(lo-(x*c)/(2.0-c))),k); + + } + /* end of x > lntiny */ + + else + /* exp(-big#) underflows to zero */ + if(finite(x)) return(scalb(1.0,-5000)); + + /* exp(-INF) is zero */ + else return(0.0); + } + /* end of x < lnhuge */ + + else + /* exp(INF) is INF, exp(+big#) overflows to INF */ + return( finite(x) ? scalb(1.0,5000) : x); + } +/* fabs.c - fabs math routine */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,05feb93,jdi doc changes based on kdl review. +01e,02dec92,jdi doc tweaks. +01d,28oct92,jdi documentation cleanup. +01c,20sep92,smb documentation additions +01b,30jul92,kdl changed _d_type() calls to fpTypeGet(). +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" +#include "stddef.h" +#include "errno.h" +#include "private/mathP.h" + + +/******************************************************************************* +* +* fabs - compute an absolute value (ANSI) +* +* This routine returns the absolute value of in double precision. +* +* INCLUDE FILES: math.h +* +* RETURNS: The double-precision absolute value of . +* +* ERRNO: EDOM, ERANGE +* +* SEE ALSO: mathALib +*/ + +double fabs + ( + double v /* number to return the absolute value of */ + ) + + { + switch (fpTypeGet (v, NULL)) + { + case ZERO: /* ZERO */ + return (0.0); + + case NAN: /* NOT A NUMBER */ + errno = EDOM; + return (v); + + case INF: /* INFINITE */ + errno = ERANGE; + + case INTEGER: /* INTEGER */ + case REAL: /* REAL */ + return ((v < 0.0) ? - v : v); + + default: + return (0.0); + } + } +/* floor.c - floor math routine */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,05feb93,jdi doc changes based on kdl review. +01e,02dec92,jdi doc tweaks. +01d,28oct92,jdi documentation cleanup. +01c,20sep92,smb documentation additions +01b,30jul92,kdl changed _d_type() calls to fpTypeGet(). +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" +#include "stddef.h" +#include "errno.h" +#include "private/mathP.h" + + +/******************************************************************************* +* +* floor - compute the largest integer less than or equal to a specified value (ANSI) +* +* This routine returns the largest integer less than or equal to , in +* double precision. +* +* INCLUDE FILES: math.h +* +* RETURNS: +* The largest integral value less than or equal to , in double precision. +* +* SEE ALSO: mathALib +*/ + +double floor + ( + double v /* value to find the floor of */ + ) + + { + double r; + + switch (fpTypeGet (v, &r)) /* find out the type of v */ + { + case ZERO: + case INF: return (0); + + case NAN: return (v); + + case INTEGER: return (v); + + case REAL: return (((v < 0.0) && (v != r)) ? (r - 1.0) : (r)); + + default: return (0); /* this should never happen */ + } + } +/* fmod.c - fmod math routine */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,05feb93,jdi doc changes based on kdl review. +01e,02dec92,jdi doc tweaks. +01d,28oct92,jdi documentation cleanup. +01c,20sep92,smb documentation additions +01b,30jul92,kdl changed _d_type() calls to fpTypeGet(). +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" +#include "stddef.h" +#include "errno.h" +#include "private/mathP.h" + + +/******************************************************************************* +* +* fmod - compute the remainder of x/y (ANSI) +* +* This routine returns the remainder of / with the sign of , +* in double precision. +* +* INCLUDE FILES: math.h +* +* RETURNS: The value - * , for some integer . If is +* non-zero, the result has the same sign as and magnitude less than the +* magnitude of . If is zero, fmod() returns zero. +* +* ERRNO: EDOM +* +* SEE ALSO: mathALib +*/ + +double fmod + ( + double x, /* numerator */ + double y /* denominator */ + ) + + { + double t; + short negative = 0; + int errx = fpTypeGet (x, NULL); /* determine number type */ + int erry = fpTypeGet (y, NULL); /* determine number type */ + + if (errx == NAN || erry == NAN || errx == INF || erry == ZERO) + { + errno = EDOM; /* Domain error */ + return ((errx == NAN) ? (x) : ((erry == NAN) ? (y) : (0))); + } + + if (errx == ZERO || erry == INF) + return (x); + + /* make x and y absolute */ + + if (y < 0.0) + y = -y; + + if (x < 0.0) + { + x = -x; + negative = 1; + } + + /* loop substracting y from x until a value less than y remains */ + + for (t = x; t > y; t -= y) + ; + + return ((t == y) ? (0.0) : ((negative) ? (-t) : (t))); + } +/* frexp.c - frexp math routine */ + +/* Copyright 1992-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,05aug96,dbt frexp now returned a value >= 0.5 and strictly less than 1.0. + (SPR #4280). + Updated copyright. +01g,05feb93,jdi doc changes based on kdl review. +01f,02dec92,jdi doc tweaks. +01e,28oct92,jdi documentation cleanup. +01d,21sep92,smb replaced orignal versions. +01c,20sep92,smb documentation additions +01b,30jul92,kdl replaced routine contents with frexp() from floatLib.c. +01a,08jul92,smb written, documentation. +*/ + +/* +DESCRIPTION + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "math.h" +#include "stddef.h" +#include "errno.h" +#include "private/mathP.h" + +/******************************************************************************* +* +* frexp - break a floating-point number into a normalized fraction and power of 2 (ANSI) +* +* This routine breaks a double-precision number into a normalized +* fraction and integral power of 2. It stores the integer exponent in . +* +* INCLUDE FILES: math.h +* +* RETURNS: +* The double-precision value , such that the magnitude of is +* in the interval [1/2,1) or zero, and equals times +* 2 to the power of . If is zero, both parts of the result +* are zero. +* +* ERRNO: EDOM +* +*/ +double frexp + ( + double value, /* number to be normalized */ + int *pexp /* pointer to the exponent */ + ) + + { + double r; + + *pexp = 0; + + /* determine number type */ + + switch (fpTypeGet(value, &r)) + { + case NAN: /* NOT A NUMBER */ + case INF: /* INFINITE */ + errno = EDOM; + return (value); + + case ZERO: /* ZERO */ + return (0.0); + + default: + /* + * return value must be strictly less than 1.0 and >=0.5 . + */ + if ((r = fabs(value)) >= 1.0) + for(; (r >= 1.0); (*pexp)++, r /= 2.0); + else + for(; (r < 0.5); (*pexp)--, r *= 2.0); + + return (value < 0 ? -r : r); + } + } +/* ldexp.c - ldexp math routine */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,05feb93,jdi doc changes based on kdl review. +01f,02dec92,jdi doc tweaks. +01e,28oct92,jdi documentation cleanup. +01d,21sep92,smb replaced original version. +01c,20sep92,smb documentation additions +01b,30jul92,kdl replaced routine contents with ldexp() from floatLib.c. +01a,08jul92,smb written, documentation. +*/ + +/* +DESCRIPTION + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "math.h" +#include "stddef.h" +#include "errno.h" +#include "private/mathP.h" + + +/******************************************************************************* +* +* ldexp - multiply a number by an integral power of 2 (ANSI) +* +* This routine multiplies a floating-point number by an integral power of 2. +* A range error may occur. +* +* INCLUDE FILES: math.h +* +* RETURNS: The double-precision value of times 2 to the power of . +* +*/ + +double ldexp + ( + double v, /* a floating point number */ + int xexp /* exponent */ + ) + + { + double zero = 0.0; + + switch (fpTypeGet (v, NULL)) + { + case NAN: /* NOT A NUMBER */ + errno = EDOM; + break; + + case INF: /* INFINITE */ + errno = ERANGE; + break; + + case ZERO: /* ZERO */ + return (zero); + + default: + if (xexp >= 0) + for(; (xexp > 0); xexp--, v *= 2.0); + else + for(; (xexp < 0); xexp++, v /= 2.0); + + return (v); + } + + return (zero); + } +/* log.c - math routines */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,05feb93,jdi doc changes based on kdl review. +01e,02dec92,jdi doc tweaks. +01d,28oct92,jdi documentation cleanup. +01c,13oct92,jdi mangen fixes. +01b,20sep92,smb documentation additions +01a,08jul92,smb documentation +*/ + +/* +DESCRIPTION +* Copyright (c) 1985 Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms are permitted +* provided that the above copyright notice and this paragraph are +* duplicated in all such forms and that any documentation, +* advertising materials, and other materials related to such +* distribution and use acknowledge that the software was developed +* by the University of California, Berkeley. The name of the +* University may not be used to endorse or promote products derived +* from this software without specific prior written permission. +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +* +* All recipients should regard themselves as participants in an ongoing +* research project and hence should feel obligated to report their +* experiences (good or bad) with these elementary function codes, using +* the sendbug(8) program, to the authors. +* +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" + +#if defined(vax)||defined(tahoe) /* VAX D format */ +#include +#ifdef vax +#define _0x(A,B) 0x/**/A/**/B +#else /* vax */ +#define _0x(A,B) 0x/**/B/**/A +#endif /* vax */ +/* static double */ +/* ln2hi = 6.9314718055829871446E-1 , Hex 2^ 0 * .B17217F7D00000 */ +/* ln2lo = 1.6465949582897081279E-12 , Hex 2^-39 * .E7BCD5E4F1D9CC */ +/* sqrt2 = 1.4142135623730950622E0 ; Hex 2^ 1 * .B504F333F9DE65 */ +static long ln2hix[] = { _0x(7217,4031), _0x(0000,f7d0)}; +static long ln2lox[] = { _0x(bcd5,2ce7), _0x(d9cc,e4f1)}; +static long sqrt2x[] = { _0x(04f3,40b5), _0x(de65,33f9)}; +#define ln2hi (*(double*)ln2hix) +#define ln2lo (*(double*)ln2lox) +#define sqrt2 (*(double*)sqrt2x) +#else /* defined(vax)||defined(tahoe) */ +static double +ln2hi = 6.9314718036912381649E-1 , /*Hex 2^ -1 * 1.62E42FEE00000 */ +ln2lo = 1.9082149292705877000E-10 , /*Hex 2^-33 * 1.A39EF35793C76 */ +sqrt2 = 1.4142135623730951455E0 ; /*Hex 2^ 0 * 1.6A09E667F3BCD */ +#endif /* defined(vax)||defined(tahoe) */ + +/******************************************************************************* +* +* log - compute a natural logarithm (ANSI) +* +* This routine returns the natural logarithm of +* in double precision (IEEE double, 53 bits). +* +* A domain error occurs if the argument is negative. A range error may occur +* if the argument is zero. +* +* INTERNAL: +* Method: +* (1) Argument Reduction: find and such that: +* +* x = 2^k * (1+f) +* +* where: +* +* sqrt(2)/2 < 1+f < sqrt(2) +* +* (2) Let s = f/(2+f); based on: +* +* log(1+f) = log(1+s) - log(1-s) = 2s + 2/3 s**3 + 2/5 s**5 + ..... +* +* log(1+f) is computed by: +* +* log(1+f) = 2s + s*log__L(s*s) +* +* where: +* +* log__L(z) = z*(L1 + z*(L2 + z*(... (L6 + z*L7)...))) +* +* (3) Finally: +* +* log(x) = k*ln2 + log(1+f) +* +* (Here n*ln2 will be stored +* in two floating-point numbers: n*ln2hi + n*ln2lo; n*ln2hi is exact +* since the last 20 bits of ln2hi is 0.) +* +* INCLUDE FILES: math.h +* +* RETURNS: The double-precision natural logarithm of . +* +* Special cases: +* If < 0 (including -INF), it returns NaN with signal. +* If is +INF, it returns with no signal. +* If is 0, it returns -INF with signal. +* If is NaN it returns with no signal. +* +* SEE ALSO: mathALib +* +* INTERNAL +* Coded in C by K.C. Ng, 1/19/85; +* Revised by K.C. Ng on 2/7/85, 3/7/85, 3/24/85, 4/16/85. +*/ + +double log + ( + double x /* value to compute the natural logarithm of */ + ) + + { + static double zero=0.0, negone= -1.0, half=1.0/2.0; + double logb(),scalb(),copysign(),log__L(),s,z,t; + int k,n,finite(); + +#if !defined(vax)&&!defined(tahoe) + if(x!=x) return(x); /* x is NaN */ +#endif /* !defined(vax)&&!defined(tahoe) */ + if(finite(x)) { + if( x > zero ) { + + /* argument reduction */ + k=logb(x); x=scalb(x,-k); + if(k == -1022) /* subnormal no. */ + {n=logb(x); x=scalb(x,-n); k+=n;} + if(x >= sqrt2 ) {k += 1; x *= half;} + x += negone ; + + /* compute log(1+x) */ + s=x/(2+x); t=x*x*half; + z=k*ln2lo+s*(t+log__L(s*s)); + x += (z - t) ; + + return(k*ln2hi+x); + } + /* end of if (x > zero) */ + + else { +#if defined(vax)||defined(tahoe) + extern double infnan(); + if ( x == zero ) + return (infnan(-ERANGE)); /* -INF */ + else + return (infnan(EDOM)); /* NaN */ +#else /* defined(vax)||defined(tahoe) */ + /* zero argument, return -INF with signal */ + if ( x == zero ) + return( negone/zero ); + + /* negative argument, return NaN with signal */ + else + return ( zero / zero ); +#endif /* defined(vax)||defined(tahoe) */ + } + } + /* end of if (finite(x)) */ + /* NOTREACHED if defined(vax)||defined(tahoe) */ + + /* log(-INF) is NaN with signal */ + else if (x<0) + return(zero/zero); + + /* log(+INF) is +INF */ + else return(x); + + } +/* log10.c - math routine */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,05feb93,jdi doc changes based on kdl review. +01d,02dec92,jdi doc tweaks. +01c,28oct92,jdi documentation cleanup. +01b,20sep92,smb documentation additions +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +* Copyright (c) 1985 Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms are permitted +* provided that the above copyright notice and this paragraph are +* duplicated in all such forms and that any documentation, +* advertising materials, and other materials related to such +* distribution and use acknowledge that the software was developed +* by the University of California, Berkeley. The name of the +* University may not be used to endorse or promote products derived +* from this software without specific prior written permission. +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +* +* All recipients should regard themselves as participants in an ongoing +* research project and hence should feel obligated to report their +* experiences (good or bad) with these elementary function codes, using +* the sendbug(8) program, to the authors. +* +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" + +#if defined(vax)||defined(tahoe) /* VAX D format (56 bits) */ +#ifdef vax +#define _0x(A,B) 0x/**/A/**/B +#else /* vax */ +#define _0x(A,B) 0x/**/B/**/A +#endif /* vax */ +/* static double */ +/* ln10hi = 2.3025850929940456790E0 ; Hex 2^ 2 * .935D8DDDAAA8AC */ +static long ln10hix[] = { _0x(5d8d,4113), _0x(a8ac,ddaa)}; +#define ln10hi (*(double*)ln10hix) +#else /* defined(vax)||defined(tahoe) */ +static double +ivln10 = 4.3429448190325181667E-1 ; /*Hex 2^ -2 * 1.BCB7B1526E50E */ +#endif /* defined(vax)||defined(tahoe) */ + +/******************************************************************************* +* +* log10 - compute a base-10 logarithm (ANSI) +* +* This routine returns the base 10 logarithm of in +* double precision (IEEE double, 53 bits). +* +* A domain error occurs if the argument is negative. A range error may +* if the argument is zero. +* +* INTERNAL: +* Method: +* log(x) +* log10(x) = --------- or [1/log(10)]*log(x) +* log(10) +* +* [log(10)] rounded to 56 bits has error .0895 ulps, +* [1/log(10)] rounded to 53 bits has error .198 ulps; +* therefore, for better accuracy, in VAX D format, we divide +* log(x) by log(10), but in IEEE Double format, we multiply +* log(x) by [1/log(10)]. +* +* INCLUDE FILES: math.h +* +* RETURNS: The double-precision base-10 logarithm of . +* +* Special cases: +* If < 0, log10() returns NaN with signal. +* if is +INF, it returns with no signal. +* if is 0, it returns -INF with signal. +* if is NaN it returns with no signal. +* +* SEE ALSO: mathALib +* +* INTERNAL: +* Coded in C by K.C. Ng, 1/20/85; +* Revised by K.C. Ng on 1/23/85, 3/7/85, 4/16/85. +*/ + +double log10 + ( + double x /* value to compute the base-10 logarithm of */ + ) + + { + double log(); + +#if defined(vax)||defined(tahoe) + return(log(x)/ln10hi); +#else /* defined(vax)||defined(tahoe) */ + return(ivln10*log(x)); +#endif /* defined(vax)||defined(tahoe) */ + } +/* modf.c - separate floating-point number into integer and fraction parts */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,05feb93,jdi doc changes based on kdl review. +01h,02dec92,jdi doc tweaks. +01g,28oct92,jdi documentation cleanup. +01f,20sep92,smb documentation additions +01e,10sep92,wmd changed dummy function for i960KB from printf to bcopy. +01d,04sep92,wmd restored to rev 1b, instead modified mathP.h using _BYTE_ORDER + conditionals to flip the contents of struct DOUBLE. Added a dummy + printf() in order to force compiler to compile code correctly for i960kb. +01c,03sep92,wmd modified modf() for the i960, word order for DOUBLE is reversed. +01b,25jul92,kdl replaced modf() routine contents with version from floatLib.c; + deleted isnan(), iszero(), isinf(), _d_type(). +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" +#include "stddef.h" +#include "errno.h" +#include "private/mathP.h" + + + +/******************************************************************************* +* +* modf - separate a floating-point number into integer and fraction parts (ANSI) +* +* This routine stores the integer portion of +* in and returns the fractional portion. +* Both parts are double precision and will have the same sign as . +* +* INCLUDE FILES: math.h +* +* RETURNS: The double-precision fractional portion of . +* +* SEE ALSO: frexp(), ldexp() +*/ + +double modf + ( + double value, /* value to split */ + double *pIntPart /* where integer portion is stored */ + ) + { + DOUBLE dat; + FAST int exp; + FAST double fracPart; + FAST double intPart; + int negflag = (value < 0); + + if (negflag) + value = -value; /* make it positive */ + + dat.ddat = value; + + /* Separate the exponent, and change it from biased to 2's comp. */ + exp = ((dat.ldat.l1 & 0x7ff00000) >> 20) - 1023; + +#if CPU==I960KB + bcopy ((char *)&negflag, (char *)&negflag, 0); +#endif /* CPU==I960KB - to force gcc960 to compile correct code for the i960kb */ + + if (exp <= -1) + { + /* If exponent is negative, fracPart == |value|, and intPart == 0. */ + + fracPart = value; + intPart = 0.; + } + + /* clear the fractional part in dat */ + + else if (exp <= 20) + { + dat.ldat.l1 &= (-1 << (20 - exp)); + dat.ldat.l2 = 0; + intPart = dat.ddat; + fracPart = value - intPart; + } + + else if (exp <= 52) + { + dat.ldat.l2 &= (-1 << (52 - exp)); + intPart = dat.ddat; + fracPart = value - intPart; + } + + else + { + fracPart = 0.; + intPart = value; + } + + *pIntPart = (negflag ? -intPart : intPart); + return (negflag ? -fracPart : fracPart); + } + +/* pow.c - math routines */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,05feb93,jdi doc changes based on kdl review. +01d,02dec92,jdi doc tweaks. +01c,28oct92,jdi documentation cleanup. +01b,20sep92,smb documentation additions +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +* Copyright (c) 1985 Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms are permitted +* provided that the above copyright notice and this paragraph are +* duplicated in all such forms and that any documentation, +* advertising materials, and other materials related to such +* distribution and use acknowledge that the software was developed +* by the University of California, Berkeley. The name of the +* University may not be used to endorse or promote products derived +* from this software without specific prior written permission. +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +* +* All recipients should regard themselves as participants in an ongoing +* research project and hence should feel obligated to report their +* experiences (good or bad) with these elementary function codes, using +* the sendbug(8) program, to the authors. +* +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" +#include "private/mathP.h" + +#if defined(vax)||defined(tahoe) /* VAX D format */ +#include +extern double infnan(); +#ifdef vax +#define _0x(A,B) 0x/**/A/**/B +#else /* vax */ +#define _0x(A,B) 0x/**/B/**/A +#endif /* vax */ +/* static double */ +/* ln2hi = 6.9314718055829871446E-1 , Hex 2^ 0 * .B17217F7D00000 */ +/* ln2lo = 1.6465949582897081279E-12 , Hex 2^-39 * .E7BCD5E4F1D9CC */ +/* invln2 = 1.4426950408889634148E0 , Hex 2^ 1 * .B8AA3B295C17F1 */ +/* sqrt2 = 1.4142135623730950622E0 ; Hex 2^ 1 * .B504F333F9DE65 */ +static long ln2hix[] = { _0x(7217,4031), _0x(0000,f7d0)}; +static long ln2lox[] = { _0x(bcd5,2ce7), _0x(d9cc,e4f1)}; +static long invln2x[] = { _0x(aa3b,40b8), _0x(17f1,295c)}; +static long sqrt2x[] = { _0x(04f3,40b5), _0x(de65,33f9)}; +#define ln2hi (*(double*)ln2hix) +#define ln2lo (*(double*)ln2lox) +#define invln2 (*(double*)invln2x) +#define sqrt2 (*(double*)sqrt2x) +#else /* defined(vax)||defined(tahoe) */ +static double +ln2hi = 6.9314718036912381649E-1 , /*Hex 2^ -1 * 1.62E42FEE00000 */ +ln2lo = 1.9082149292705877000E-10 , /*Hex 2^-33 * 1.A39EF35793C76 */ +invln2 = 1.4426950408889633870E0 , /*Hex 2^ 0 * 1.71547652B82FE */ +sqrt2 = 1.4142135623730951455E0 ; /*Hex 2^ 0 * 1.6A09E667F3BCD */ +#endif /* defined(vax)||defined(tahoe) */ + +static double zero=0.0, half=1.0/2.0, one=1.0, two=2.0, negone= -1.0; + +/******************************************************************************* +* +* pow - compute the value of a number raised to a specified power (ANSI) +* +* This routine returns to the power of in +* double precision (IEEE double, 53 bits). +* +* A domain error occurs if is negative and is not an integral value. +* A domain error occurs if the result cannot be represented when is zero +* and is less than or equal to zero. A range error may occur. +* +* INTERNAL: +* Method: +* (1) Compute and return log(x) in three pieces: +* +* log(x) = n*ln2 + hi + lo +* +* where is an integer. +* +* (2) Perform y*log(x) by simulating multi-precision arithmetic and +* return the answer in three pieces: +* +* y*log(x) = m*ln2 + hi + lo +* +* where is an integer. +* +* (3) Return: +* +* x**y = exp(y*log(x)) = 2^m * ( exp(hi+lo) ) +* +* INCLUDE FILES: math.h +* +* RETURNS: The double-precision value of to the power of . +* +* Special cases: +* .TS +* tab(|); +* l0 c0 l. +* (anything) ** 0 | is | 1 +* (anything) ** 1 | is | itself +* (anything) ** NaN | is | NaN +* NaN ** (anything except 0) | is | NaN +* +-(anything > 1) ** +INF | is | +INF +* +-(anything > 1) ** -INF | is | +0 +* +-(anything < 1) ** +INF | is | +0 +* +-(anything < 1) ** -INF | is | +INF +* +-1 ** +-INF | is | NaN, signal INVALID +* +0 ** +(anything non-0, NaN) | is | +0 +* -0 ** +(anything non-0, NaN, odd int) | is | +0 +* +0 ** -(anything non-0, NaN) | is | +INF, signal DIV-BY-ZERO +* -0 ** -(anything non-0, NaN, odd int) | is | +INF with signal +* -0 ** (odd integer) | = | -(+0 ** (odd integer)) +* +INF ** +(anything except 0, NaN) | is | +INF +* +INF ** -(anything except 0, NaN) | is | +0 +* -INF ** (odd integer) | = | -(+INF ** (odd integer)) +* -INF ** (even integer) | = | (+INF ** (even integer)) +* -INF ** -(any non-integer, NaN) | is | NaN with signal +* -(x=anything) ** (k=integer) | is | (-1)**k * (x ** k) +* -(anything except 0) ** (non-integer) | is | NaN with signal +* .TE +* +* SEE ALSO: mathALib +* +* INTERNAL: +* Coded in C by K.C. Ng, 1/8/85; +* Revised by K.C. Ng on 7/10/85. +*/ + +double pow + ( + double x, /* operand */ + double y /* exponent */ + ) + + { + double drem(),pow_p(),copysign(),t; + int finite(); + + if (y==zero) return(one); + else if(y==one +#if !defined(vax)&&!defined(tahoe) + ||x!=x +#endif /* !defined(vax)&&!defined(tahoe) */ + ) return( x ); /* if x is NaN or y=1 */ +#if !defined(vax)&&!defined(tahoe) + else if(y!=y) return( y ); /* if y is NaN */ +#endif /* !defined(vax)&&!defined(tahoe) */ + else if(!finite(y)) /* if y is INF */ + if((t=copysign(x,one))==one) return(zero/zero); + else if(t>one) return((y>zero)?y:zero); + else return((yzero)?-x:one/(-x)); + else { /* return NaN */ +#if defined(vax)||defined(tahoe) + return (infnan(EDOM)); /* NaN */ +#else /* defined(vax)||defined(tahoe) */ + return(zero/zero); +#endif /* defined(vax)||defined(tahoe) */ + } + } + +/**************************************************************************** +* +* pow_p - +* +* pow_p(x,y) return x**y for x with sign=1 and finite y * +* +* RETURN: +* NOMANUAL +*/ + +double pow_p(x,y) +double x,y; +{ + double logb(),scalb(),copysign(),log__L(),exp__E(); + double c,s,t,z,tx,ty; +#ifdef tahoe + double tahoe_tmp; +#endif /* tahoe */ + float sx,sy; + long k=0; + int n,m; + + if(x==zero||!finite(x)) { /* if x is +INF or +0 */ +#if defined(vax)||defined(tahoe) + return((y>zero)?x:infnan(ERANGE)); /* if yzero)?x:one/x); +#endif /* defined(vax)||defined(tahoe) */ + } + if(x==1.0) return(x); /* if x=1.0, return 1 since y is finite */ + + /* reduce x to z in [sqrt(1/2)-1, sqrt(2)-1] */ + z=scalb(x,-(n=logb(x))); +#if !defined(vax)&&!defined(tahoe) /* IEEE double; subnormal number */ + if(n <= -1022) {n += (m=logb(z)); z=scalb(z,-m);} +#endif /* !defined(vax)&&!defined(tahoe) */ + if(z >= sqrt2 ) {n += 1; z *= half;} z -= one ; + + /* log(x) = nlog2+log(1+z) ~ nlog2 + t + tx */ + s=z/(two+z); c=z*z*half; tx=s*(c+log__L(s*s)); + t= z-(c-tx); tx += (z-t)-c; + + /* if y*log(x) is neither too big nor too small */ + if((s=logb(y)+logb(n+t)) < 12.0) + if(s>-60.0) { + + /* compute y*log(x) ~ mlog2 + t + c */ + s=y*(n+invln2*t); + m=s+copysign(half,s); /* m := nint(y*log(x)) */ + k=y; + if((double)k==y) { /* if y is an integer */ + k = m-k*n; + sx=t; tx+=(t-sx); } + else { /* if y is not an integer */ + k =m; + tx+=n*ln2lo; + sx=(c=n*ln2hi)+t; tx+=(c-sx)+t; } + /* end of checking whether k==y */ + + sy=y; ty=y-sy; /* y ~ sy + ty */ +#ifdef tahoe + s = (tahoe_tmp = sx)*sy-k*ln2hi; +#else /* tahoe */ + s=(double)sx*sy-k*ln2hi; /* (sy+ty)*(sx+tx)-kln2 */ +#endif /* tahoe */ + z=(tx*ty-k*ln2lo); + tx=tx*sy; ty=sx*ty; + t=ty+z; t+=tx; t+=s; + c= -((((t-s)-tx)-ty)-z); + + /* return exp(y*log(x)) */ + t += exp__E(t,c); return(scalb(one+t,m)); + } + /* end of if log(y*log(x)) > -60.0 */ + + else + /* exp(+- tiny) = 1 with inexact flag */ + {ln2hi+ln2lo; return(one);} + else if(copysign(one,y)*(n+invln2*t) in double precision. +* The angle is expressed in radians. +* +* INCLUDE FILES: math.h +* +* RETURNS: The double-precision sine of . +* +* SEE ALSO: mathALib +*/ + +double sin + ( + double x /* angle in radians */ + ) + + { + double a,c,z; + + if(!finite(x)) /* sin(NaN) and sin(INF) must be NaN */ + return x-x; + x=drem(x,PI2); /* reduce x into [-PI,PI] */ + a=copysign(x,one); + if (a >= PIo4) { + if(a >= PI3o4) /* ... in [3PI/4,PI] */ + x = copysign((a = PI-a),x); + else { /* ... in [PI/4,3PI/4] */ + a = PIo2-a; /* rtn. sign(x)*C(PI/2-|x|) */ + z = a*a; + c = cos__C(z); + z *= half; + a = (z >= thresh ? half-((z-half)-c) : one-(z-c)); + return copysign(a,x); + } + } + + if (a < small) { /* rtn. S(x) */ + big+a; + return x; + } + return x+x*sin__S(x*x); + } + +/******************************************************************************* +* +* cos - compute a cosine (ANSI) +* +* This routine computes the cosine of in double precision. +* The angle is expressed in radians. +* +* INCLUDE FILES: math.h +* +* RETURNS: The double-precision cosine of . +* +* SEE ALSO: mathALib +*/ + +double cos + ( + double x /* angle in radians */ + ) + + { + double a,c,z,s = 1.0; + + if(!finite(x)) /* cos(NaN) and cos(INF) must be NaN */ + return x-x; + x=drem(x,PI2); /* reduce x into [-PI,PI] */ + a=copysign(x,one); + if (a >= PIo4) { + if (a >= PI3o4) { /* ... in [3PI/4,PI] */ + a = PI-a; + s = negone; + } + else { /* ... in [PI/4,3PI/4] */ + a = PIo2-a; + return a+a*sin__S(a*a); /* rtn. S(PI/2-|x|) */ + } + } + if (a < small) { + big+a; + return s; /* rtn. s*C(a) */ + } + z = a*a; + c = cos__C(z); + z *= half; + a = (z >= thresh ? half-((z-half)-c) : one-(z-c)); + return copysign(a,s); + } +/* sinh.c - math routine */ + +/* Copyright 1992-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,09dec94,rhp fix descriptions of hyperbolic fns. +01e,05feb93,jdi doc changes based on kdl review. +01d,02dec92,jdi doc tweaks. +01c,28oct92,jdi documentation cleanup. +01b,20sep92,smb documentation additions +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +* Copyright (c) 1985 Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms are permitted +* provided that the above copyright notice and this paragraph are +* duplicated in all such forms and that any documentation, +* advertising materials, and other materials related to such +* distribution and use acknowledge that the software was developed +* by the University of California, Berkeley. The name of the +* University may not be used to endorse or promote products derived +* from this software without specific prior written permission. +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +* +* All recipients should regard themselves as participants in an ongoing +* research project and hence should feel obligated to report their +* experiences (good or bad) with these elementary function codes, using +* the sendbug(8) program, to the authors. +* +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" + +#if defined(vax)||defined(tahoe) +#ifdef vax +#define _0x(A,B) 0x/**/A/**/B +#else /* vax */ +#define _0x(A,B) 0x/**/B/**/A +#endif /* vax */ +/* static double */ +/* mln2hi = 8.8029691931113054792E1 , Hex 2^ 7 * .B00F33C7E22BDB */ +/* mln2lo = -4.9650192275318476525E-16 , Hex 2^-50 * -.8F1B60279E582A */ +/* lnovfl = 8.8029691931113053016E1 ; Hex 2^ 7 * .B00F33C7E22BDA */ +static long mln2hix[] = { _0x(0f33,43b0), _0x(2bdb,c7e2)}; +static long mln2lox[] = { _0x(1b60,a70f), _0x(582a,279e)}; +static long lnovflx[] = { _0x(0f33,43b0), _0x(2bda,c7e2)}; +#define mln2hi (*(double*)mln2hix) +#define mln2lo (*(double*)mln2lox) +#define lnovfl (*(double*)lnovflx) +#else /* defined(vax)||defined(tahoe) */ +static double +mln2hi = 7.0978271289338397310E2 , /*Hex 2^ 10 * 1.62E42FEFA39EF */ +mln2lo = 2.3747039373786107478E-14 , /*Hex 2^-45 * 1.ABC9E3B39803F */ +lnovfl = 7.0978271289338397310E2 ; /*Hex 2^ 9 * 1.62E42FEFA39EF */ +#endif /* defined(vax)||defined(tahoe) */ + +#if defined(vax)||defined(tahoe) +static max = 126 ; +#else /* defined(vax)||defined(tahoe) */ +static max = 1023 ; +#endif /* defined(vax)||defined(tahoe) */ + +/******************************************************************************* +* +* sinh - compute a hyperbolic sine (ANSI) +* +* This routine returns the hyperbolic sine of in +* double precision (IEEE double, 53 bits). +* +* A range error occurs if is too large. +* +* INTERNAL: +* Method: +* +* (1) Reduce to non-negative by sinh(-x) = - sinh(x). +* +* (2) +* expm1(x) + expm1(x)/(expm1(x)+1) +* 0 <= x <= lnovfl : sinh(x) := -------------------------------- +* 2 +* lnovfl <= x <= lnovfl+ln2 : sinh(x) := expm1(x)/2 (avoid overflow) +* lnovfl+ln2 < x < INF : overflow to INF +* +* INCLUDE FILES: math.h +* +* RETURNS: +* The double-precision hyperbolic sine of . +* +* Special cases: +* If is +INF, -INF, or NaN, sinh() returns . +* +* SEE ALSO: mathALib +*/ + +double sinh + ( + double x /* number whose hyperbolic sine is required */ + ) + + { + static double one=1.0, half=1.0/2.0 ; + double expm1(), t, scalb(), copysign(), sign; +#if !defined(vax)&&!defined(tahoe) + if(x!=x) return(x); /* x is NaN */ +#endif /* !defined(vax)&&!defined(tahoe) */ + sign=copysign(one,x); + x=copysign(x,one); + if(x in double +* precision. A domain error occurs if the argument is negative. +* +* INCLUDE FILES: math.h +* +* RETURNS: The double-precision square root of or 0 if is negative. +* +* ERRNO: EDOM +* +* SEE ALSO: mathALib +*/ + +double sqrt + ( + double x /* value to compute the square root of */ + ) + + { + double q,s,b,r; + double t,zero=0.0; + int m,n,i; + +#if defined(vax)||defined(tahoe) + int k=54; +#else /* defined(vax)||defined(tahoe) */ + int k=51; +#endif /* defined(vax)||defined(tahoe) */ + +#if (CPU_FAMILY == SPARC) /* Select hardware/software square root */ + extern BOOL sparcHardSqrt; + + if (sparcHardSqrt == TRUE) + { + double sqrtHw(); + + return (sqrtHw (x)); + } +#endif /* (CPU_FAMILY == SPARC) */ + + /* sqrt(NaN) is NaN, sqrt(+-0) = +-0 */ + if(x!=x||x==zero) return(x); + + /* sqrt(negative) is invalid */ + if(x1.0) t=1; /* b>1 : Round-to-(+INF) */ + if(t>=0) q+=r; } /* else: Round-to-nearest */ + else { + s *= 2; x *= 4; + t = (x-s)-1; + b=1.0+3*r/4; if(b==1.0) goto end; + b=1.0+r/4; if(b>1.0) t=1; + if(t>=0) q+=r; } + +end: return(scalb(q,n)); + } +/* tan.c - math routines */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,05feb93,jdi doc changes based on kdl review. +01e,02dec92,jdi doc tweaks. +01d,28oct92,jdi documentation cleanup. +01c,21sep92,smb changed function header for mg. +01b,20sep92,smb documentation additions +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +* Copyright (c) 1987 Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms are permitted +* provided that the above copyright notice and this paragraph are +* duplicated in all such forms and that any documentation, +* advertising materials, and other materials related to such +* distribution and use acknowledge that the software was developed +* by the University of California, Berkeley. The name of the +* University may not be used to endorse or promote products derived +* from this software without specific prior written permission. +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +* +* All recipients should regard themselves as participants in an ongoing +* research project and hence should feel obligated to report their +* experiences (good or bad) with these elementary function codes, using +* the sendbug(8) program, to the authors. +* +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" +#include "private/trigP.h" + +/******************************************************************************* +* +* tan - compute a tangent (ANSI) +* +* This routine computes the tangent of in double precision. +* The angle is expressed in radians. +* +* INCLUDE FILES: math.h +* +* RETURNS: The double-precision tangent of . +* +* SEE ALSO: mathALib +*/ + +double tan + ( + double x /* angle in radians */ + ) + + { + double a,z,ss,cc,c; + int k; + + if(!finite(x)) /* tan(NaN) and tan(INF) must be NaN */ + return x-x; + x = drem(x,PI); /* reduce x into [-PI/2, PI/2] */ + a = copysign(x,one); /* ... = abs(x) */ + if (a >= PIo4) { + k = 1; + x = copysign(PIo2-a,x); + } + else { + k = 0; + if (a < small) { + big+a; + return x; + } + } + z = x*x; + cc = cos__C(z); + ss = sin__S(z); + z *= half; /* Next get c = cos(x) accurately */ + c = (z >= thresh ? half-((z-half)-cc) : one-(z-cc)); + if (k == 0) + return x+(x*(z-(cc-ss)))/c; /* ... sin/cos */ +#ifdef national + else if (x == zero) + return copysign(fmax,x); /* no inf on 32k */ +#endif /* national */ + else + return c/(x+x*ss); /* ... cos/sin */ + } +/* tanh.c - math routines */ + +/* Copyright 1992-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,09dec94,rhp fix man pages for hyperbolic fns. +01e,05feb93,jdi doc changes based on kdl review. +01d,02dec92,jdi doc tweaks. +01c,28oct92,jdi documentation cleanup. +01b,20sep92,smb documentation additions +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +* Copyright (c) 1985 Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms are permitted +* provided that the above copyright notice and this paragraph are +* duplicated in all such forms and that any documentation, +* advertising materials, and other materials related to such +* distribution and use acknowledge that the software was developed +* by the University of California, Berkeley. The name of the +* University may not be used to endorse or promote products derived +* from this software without specific prior written permission. +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +* +* All recipients should regard themselves as participants in an ongoing +* research project and hence should feel obligated to report their +* experiences (good or bad) with these elementary function codes, using +* the sendbug(8) program, to the authors. +* +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" + +/******************************************************************************* +* +* tanh - compute a hyperbolic tangent (ANSI) +* +* This routine returns the hyperbolic tangent of in +* double precision (IEEE double, 53 bits). +* +* INTERNAL: +* Method: +* +* (1) Reduce to non-negative by: +* +* tanh(-x) = - tanh(x) +* +* (2) +* 0 < x <= 1.e-10 : tanh(x) := x +* +* -expm1(-2x) +* 1.e-10 < x <= 1 : tanh(x) := -------------- +* expm1(-2x) + 2 +* +* 2 +* 1 <= x <= 22.0 : tanh(x) := 1 - --------------- +* expm1(2x) + 2 +* 22.0 < x <= INF : tanh(x) := 1. +* +* Note: 22 was chosen so that fl(1.0+2/(expm1(2*22)+2)) == 1. +* +* INCLUDE FILES: math.h +* +* RETURNS: +* The double-precision hyperbolic tangent of . +* +* Special cases: +* If is NaN, tanh() returns NaN. +* +* SEE ALSO: mathALib +* +* INTERNAL: +* Coded in C by K.C. Ng, 1/8/85; +* Revised by K.C. Ng on 2/8/85, 2/11/85, 3/7/85, 3/24/85. +*/ + +double tanh + ( + double x /* number whose hyperbolic tangent is required */ + ) + + { + static double one=1.0, two=2.0, small = 1.0e-10, big = 1.0e10; + double expm1(), t, copysign(), sign; + int finite(); + +#if !defined(vax)&&!defined(tahoe) + if(x!=x) return(x); /* x is NaN */ +#endif /* !defined(vax)&&!defined(tahoe) */ + + sign=copysign(one,x); + x=copysign(x,one); + if(x < 22.0) + if( x > one ) + return(copysign(one-two/(expm1(x+x)+two),sign)); + else if ( x > small ) + {t= -expm1(-(x+x)); return(copysign(t/(two-t),sign));} + else /* raise the INEXACT flag for non-zero x */ + {big+x; return(copysign(x,sign));} + else if(finite(x)) + return (sign+1.0E-37); /* raise the INEXACT flag */ + else + return(sign); /* x is +- INF */ + } diff --git a/libc/math/asincos.c b/libc/math/asincos.c new file mode 100644 index 0000000..58b6f0a --- /dev/null +++ b/libc/math/asincos.c @@ -0,0 +1,145 @@ +/* asincos.c - inverse sine and cosine math routines */ + +/* Copyright 1992-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,09dec94,rhp fix man pages for inverse trig fns +01g,05feb93,jdi doc changes based on kdl review. +01f,02dec92,jdi doc tweaks. +01e,28oct92,jdi documentation cleanup. +01d,13oct92,jdi mangen fixes. +01c,21sep92,smb corrected file name in first line of file. +01b,20sep92,smb documentation additions +01a,08jul92,smb documentation +*/ + +/* +DESCRIPTION + + * Copyright (c) 1985 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * All recipients should regard themselves as participants in an ongoing + * research project and hence should feel obligated to report their + * experiences (good or bad) with these elementary function codes, using + * the sendbug(8) program, to the authors. + +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" + +/******************************************************************************* +* +* asin - compute an arc sine (ANSI) +* +* This routine returns the principal value of the arc sine of +* in double precision (IEEE double, 53 bits). +* If is the sine of an angle , this function returns . +* +* A domain error occurs for arguments not in the range [-1,+1]. +* +* INTERNAL +* Method: +* asin(x) = atan2(x,sqrt(1-x*x)) +* For better accuracy, 1-x*x is computed as follows: +* 1-x*x if x < 0.5, +* 2*(1-|x|)-(1-|x|)*(1-|x|) if x >= 0.5. +* +* INCLUDE FILES: math.h +* +* RETURNS: +* The double-precision arc sine of in the range [-pi/2,pi/2] radians. +* +* Special cases: +* If is NaN, asin() returns . +* If |x|>1, it returns NaN. +* +* SEE ALSO: mathALib +* +* INTERNAL +* Coded in C by K.C. Ng, 4/16/85, REVISED ON 6/10/85. +*/ + +double asin + ( + double x /* number between -1 and 1 */ + ) + + { + double s,t,copysign(),atan2(),sqrt(),one=1.0; +#if !defined(vax)&&!defined(tahoe) + if(x!=x) return(x); /* x is NaN */ +#endif /* !defined(vax)&&!defined(tahoe) */ + s=copysign(x,one); + if(s <= 0.5) + return(atan2(x,sqrt(one-x*x))); + else + { t=one-s; s=t+t; return(atan2(x,sqrt(s-t*t))); } + + } + +/******************************************************************************* +* +* acos - compute an arc cosine (ANSI) +* +* This routine returns principal value of the arc cosine of +* in double precision (IEEE double, 53 bits). +* If is the cosine of an angle , this function returns . +* +* A domain error occurs for arguments not in the range [-1,+1]. +* +* INTERNAL +* Method: +* ________ +* / 1 - x +* acos(x) = 2*atan2( / -------- , 1 ) . +* \/ 1 + x +* +* INCLUDE FILES: math.h +* +* RETURNS: +* The double-precision arc cosine of in the range [0,pi] radians. +* +* Special cases: +* If is NaN, acos() returns . +* If |x|>1, it returns NaN. +* +* SEE ALSO: mathALib +* +* INTERNAL +* Coded in C by K.C. Ng, 4/16/85, revised on 6/10/85. +*/ + +double acos + ( + double x /* number between -1 and 1 */ + ) + + { + double t,copysign(),atan2(),sqrt(),one=1.0; +#if !defined(vax)&&!defined(tahoe) + if(x!=x) return(x); +#endif /* !defined(vax)&&!defined(tahoe) */ + if( x != -1.0) + t=atan2(sqrt((one-x)/(one+x)),one); + else + t=atan2(one,0.0); /* t = PI/2 */ + return(t+t); + } diff --git a/libc/math/asinh.c b/libc/math/asinh.c new file mode 100644 index 0000000..d46f1b1 --- /dev/null +++ b/libc/math/asinh.c @@ -0,0 +1,117 @@ +/* asinh.c - math routines */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,14oct92,jdi made asinh() nomanual. +01b,20sep92,smb documentation additions +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION + + * Copyright (c) 1985 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * All recipients should regard themselves as participants in an ongoing + * research project and hence should feel obligated to report their + * experiences (good or bad) with these elementary function codes, using + * the sendbug(8) program, to the authors. + +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" + + +#if defined(vax)||defined(tahoe) /* VAX/TAHOE D format */ +#ifdef vax +#define _0x(A,B) 0x/**/A/**/B +#else /* vax */ +#define _0x(A,B) 0x/**/B/**/A +#endif /* vax */ +/* static double */ +/* ln2hi = 6.9314718055829871446E-1 , Hex 2^ 0 * .B17217F7D00000 */ +/* ln2lo = 1.6465949582897081279E-12 ; Hex 2^-39 * .E7BCD5E4F1D9CC */ +static long ln2hix[] = { _0x(7217,4031), _0x(0000,f7d0)}; +static long ln2lox[] = { _0x(bcd5,2ce7), _0x(d9cc,e4f1)}; +#define ln2hi (*(double*)ln2hix) +#define ln2lo (*(double*)ln2lox) +#else /* defined(vax)||defined(tahoe) */ +static double +ln2hi = 6.9314718036912381649E-1 , /*Hex 2^ -1 * 1.62E42FEE00000 */ +ln2lo = 1.9082149292705877000E-10 ; /*Hex 2^-33 * 1.A39EF35793C76 */ +#endif /* defined(vax)||defined(tahoe) */ + +/***************************************************************************** +* asinh - compute the inverse hyperbolic sine of +* +* ASINH(X) +* RETURN THE INVERSE HYPERBOLIC SINE OF X +* DOUBLE PRECISION (VAX D format 56 bits, IEEE DOUBLE 53 BITS) +* CODED IN C BY K.C. NG, 2/16/85; +* REVISED BY K.C. NG on 3/7/85, 3/24/85, 4/16/85. +* +* Required system supported functions are copysign(x,y) and sqrt(x). +* +* Required kernel function is log1p(x) ...return log(1+x) +* +* Method : +* Based on +* .CS +* asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ] +* .CE +* we have +* .CS +* asinh(x) := x if 1+x*x=1, +* := sign(x)*(log1p(x)+ln2)) if sqrt(1+x*x)=x, else +* := sign(x)*log1p(|x| + |x|/(1/|x| + sqrt(1+(1/|x|)^2)) ) +* .CE +* +* asinh(x) returns the exact inverse hyperbolic sine of x nearly rounded. +* In a test run with 52,000 random arguments on a VAX, the maximum +* observed error was 1.58 ulps (units in the last place). +* The hexadecimal values are the intended ones for the following constants. +* The decimal values may be used, provided that the compiler will convert +* from decimal to binary accurately enough to produce the hexadecimal values +* shown. +* +* NOMANUAL +*/ + +double asinh(x) +double x; +{ + double copysign(),log1p(),sqrt(),t,s; + static double small=1.0E-10, /* fl(1+small*small) == 1 */ + big =1.0E20, /* fl(1+big) == big */ + one =1.0 ; + +#if !defined(vax)&&!defined(tahoe) + if(x!=x) return(x); /* x is NaN */ +#endif /* !defined(vax)&&!defined(tahoe) */ + if((t=copysign(x,one))>small) + if(t big */ + {s=log1p(t)+ln2lo; return(copysign(s+ln2hi,x));} + else /* if |x| < small */ + return(x); +} diff --git a/libc/math/atan.c b/libc/math/atan.c new file mode 100644 index 0000000..7b3e287 --- /dev/null +++ b/libc/math/atan.c @@ -0,0 +1,75 @@ +/* atan.c - math routines */ + +/* Copyright 1992-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,09dec94,rhp fix man pages for inverse trig fns +01e,05feb93,jdi doc changes based on kdl review. +01d,02dec92,jdi doc tweaks. +01c,28oct92,jdi documentation cleanup. +01b,20sep92,smb documentation additions +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +* Copyright (c) 1985 Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms are permitted +* provided that the above copyright notice and this paragraph are +* duplicated in all such forms and that any documentation, +* advertising materials, and other materials related to such +* distribution and use acknowledge that the software was developed +* by the University of California, Berkeley. The name of the +* University may not be used to endorse or promote products derived +* from this software without specific prior written permission. +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +* +* All recipients should regard themselves as participants in an ongoing +* research project and hence should feel obligated to report their +* experiences (good or bad) with these elementary function codes, using +* the sendbug(8) program, to the authors. + +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" + + +/******************************************************************************* +* +* atan - compute an arc tangent (ANSI) +* +* This routine returns the principal value of the arc tangent of in +* double precision (IEEE double, 53 bits). +* If is the tangent of an angle , this function returns +* (in radians). +* +* INCLUDE FILES: math.h +* +* RETURNS: +* The double-precision arc tangent of in the range [-pi/2,pi/2] radians. +* Special case: if is NaN, atan() returns itself. +* +* SEE ALSO: mathALib +* +* INTERNAL: +* Coded in C by K.C. Ng, 4/16/85, revised on 6/10/85. +*/ + +double atan + ( + double x /* tangent of an angle */ + ) + + { + double atan2(),one=1.0; + return(atan2(x,one)); + } diff --git a/libc/math/atan2.c b/libc/math/atan2.c new file mode 100644 index 0000000..cfda393 --- /dev/null +++ b/libc/math/atan2.c @@ -0,0 +1,300 @@ +/* atan2.c - math routines */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,03jan01,pes Fix compiler warnings +01e,05feb93,jdi doc changes based on kdl review. +01d,02dec92,jdi doc tweaks. +01c,28oct92,jdi documentation cleanup. +01b,20sep92,smb documentation additions +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +* Copyright (c) 1985 Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms are permitted +* provided that the above copyright notice and this paragraph are +* duplicated in all such forms and that any documentation, +* advertising materials, and other materials related to such +* distribution and use acknowledge that the software was developed +* by the University of California, Berkeley. The name of the +* University may not be used to endorse or promote products derived +* from this software without specific prior written permission. +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +* +* All recipients should regard themselves as participants in an ongoing +* research project and hence should feel obligated to report their +* experiences (good or bad) with these elementary function codes, using +* the sendbug(8) program, to the authors. +* +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" + +#if defined(vax)||defined(tahoe) /* VAX D format */ +#ifdef vax +#define _0x(A,B) 0x/**/A/**/B +#else /* vax */ +#define _0x(A,B) 0x/**/B/**/A +#endif /* vax */ +/*static double */ +/*athfhi = 4.6364760900080611433E-1 ,*//*Hex 2^ -1 * .ED63382B0DDA7B */ +/*athflo = 1.9338828231967579916E-19 ,*//*Hex 2^-62 * .E450059CFE92C0 */ +/*PIo4 = 7.8539816339744830676E-1 ,*//*Hex 2^ 0 * .C90FDAA22168C2 */ +/*at1fhi = 9.8279372324732906796E-1 ,*//*Hex 2^ 0 * .FB985E940FB4D9 */ +/*at1flo = -3.5540295636764633916E-18 ,*//*Hex 2^-57 * -.831EDC34D6EAEA */ +/*PIo2 = 1.5707963267948966135E0 ,*//*Hex 2^ 1 * .C90FDAA22168C2 */ +/*PI = 3.1415926535897932270E0 ,*//*Hex 2^ 2 * .C90FDAA22168C2 */ +/*a1 = 3.3333333333333473730E-1 ,*//*Hex 2^ -1 * .AAAAAAAAAAAB75 */ +/*a2 = -2.0000000000017730678E-1 ,*//*Hex 2^ -2 * -.CCCCCCCCCD946E */ +/*a3 = 1.4285714286694640301E-1 ,*//*Hex 2^ -2 * .92492492744262 */ +/*a4 = -1.1111111135032672795E-1 ,*//*Hex 2^ -3 * -.E38E38EBC66292 */ +/*a5 = 9.0909091380563043783E-2 ,*//*Hex 2^ -3 * .BA2E8BB31BD70C */ +/*a6 = -7.6922954286089459397E-2 ,*//*Hex 2^ -3 * -.9D89C827C37F18 */ +/*a7 = 6.6663180891693915586E-2 ,*//*Hex 2^ -3 * .8886B4AE379E58 */ +/*a8 = -5.8772703698290408927E-2 ,*//*Hex 2^ -4 * -.F0BBA58481A942 */ +/*a9 = 5.2170707402812969804E-2 ,*//*Hex 2^ -4 * .D5B0F3A1AB13AB */ +/*a10 = -4.4895863157820361210E-2 ,*//*Hex 2^ -4 * -.B7E4B97FD1048F */ +/*a11 = 3.3006147437343875094E-2 ,*//*Hex 2^ -4 * .8731743CF72D87 */ +/*a12 = -1.4614844866464185439E-2 ;*//*Hex 2^ -6 * -.EF731A2F3476D9 */ +static long athfhix[] = { _0x(6338,3fed), _0x(da7b,2b0d)}; +#define athfhi (*(double *)athfhix) +static long athflox[] = { _0x(5005,2164), _0x(92c0,9cfe)}; +#define athflo (*(double *)athflox) +static long PIo4x[] = { _0x(0fda,4049), _0x(68c2,a221)}; +#define PIo4 (*(double *)PIo4x) +static long at1fhix[] = { _0x(985e,407b), _0x(b4d9,940f)}; +#define at1fhi (*(double *)at1fhix) +static long at1flox[] = { _0x(1edc,a383), _0x(eaea,34d6)}; +#define at1flo (*(double *)at1flox) +static long PIo2x[] = { _0x(0fda,40c9), _0x(68c2,a221)}; +#define PIo2 (*(double *)PIo2x) +static long PIx[] = { _0x(0fda,4149), _0x(68c2,a221)}; +#define PI (*(double *)PIx) +static long a1x[] = { _0x(aaaa,3faa), _0x(ab75,aaaa)}; +#define a1 (*(double *)a1x) +static long a2x[] = { _0x(cccc,bf4c), _0x(946e,cccd)}; +#define a2 (*(double *)a2x) +static long a3x[] = { _0x(4924,3f12), _0x(4262,9274)}; +#define a3 (*(double *)a3x) +static long a4x[] = { _0x(8e38,bee3), _0x(6292,ebc6)}; +#define a4 (*(double *)a4x) +static long a5x[] = { _0x(2e8b,3eba), _0x(d70c,b31b)}; +#define a5 (*(double *)a5x) +static long a6x[] = { _0x(89c8,be9d), _0x(7f18,27c3)}; +#define a6 (*(double *)a6x) +static long a7x[] = { _0x(86b4,3e88), _0x(9e58,ae37)}; +#define a7 (*(double *)a7x) +static long a8x[] = { _0x(bba5,be70), _0x(a942,8481)}; +#define a8 (*(double *)a8x) +static long a9x[] = { _0x(b0f3,3e55), _0x(13ab,a1ab)}; +#define a9 (*(double *)a9x) +static long a10x[] = { _0x(e4b9,be37), _0x(048f,7fd1)}; +#define a10 (*(double *)a10x) +static long a11x[] = { _0x(3174,3e07), _0x(2d87,3cf7)}; +#define a11 (*(double *)a11x) +static long a12x[] = { _0x(731a,bd6f), _0x(76d9,2f34)}; +#define a12 (*(double *)a12x) +#else /* defined(vax)||defined(tahoe) */ +static double +athfhi = 4.6364760900080609352E-1 , /*Hex 2^ -2 * 1.DAC670561BB4F */ +athflo = 4.6249969567426939759E-18 , /*Hex 2^-58 * 1.5543B8F253271 */ +PIo4 = 7.8539816339744827900E-1 , /*Hex 2^ -1 * 1.921FB54442D18 */ +at1fhi = 9.8279372324732905408E-1 , /*Hex 2^ -1 * 1.F730BD281F69B */ +at1flo = -2.4407677060164810007E-17 , /*Hex 2^-56 * -1.C23DFEFEAE6B5 */ +PIo2 = 1.5707963267948965580E0 , /*Hex 2^ 0 * 1.921FB54442D18 */ +PI = 3.1415926535897931160E0 , /*Hex 2^ 1 * 1.921FB54442D18 */ +a1 = 3.3333333333333942106E-1 , /*Hex 2^ -2 * 1.55555555555C3 */ +a2 = -1.9999999999979536924E-1 , /*Hex 2^ -3 * -1.9999999997CCD */ +a3 = 1.4285714278004377209E-1 , /*Hex 2^ -3 * 1.24924921EC1D7 */ +a4 = -1.1111110579344973814E-1 , /*Hex 2^ -4 * -1.C71C7059AF280 */ +a5 = 9.0908906105474668324E-2 , /*Hex 2^ -4 * 1.745CE5AA35DB2 */ +a6 = -7.6919217767468239799E-2 , /*Hex 2^ -4 * -1.3B0FA54BEC400 */ +a7 = 6.6614695906082474486E-2 , /*Hex 2^ -4 * 1.10DA924597FFF */ +a8 = -5.8358371008508623523E-2 , /*Hex 2^ -5 * -1.DE125FDDBD793 */ +a9 = 4.9850617156082015213E-2 , /*Hex 2^ -5 * 1.9860524BDD807 */ +a10 = -3.6700606902093604877E-2 , /*Hex 2^ -5 * -1.2CA6C04C6937A */ +a11 = 1.6438029044759730479E-2 ; /*Hex 2^ -6 * 1.0D52174A1BB54 */ +#endif /* defined(vax)||defined(tahoe) */ + +/******************************************************************************* +* +* atan2 - compute the arc tangent of y/x (ANSI) +* +* This routine returns the principal value of the arc tangent of / in +* double precision (IEEE double, 53 bits). +* This routine uses the signs of both arguments to determine the quadrant of the +* return value. A domain error may occur if both arguments are zero. +* +* INTERNAL: +* (1) Reduce to positive by: +* +* atan2(y,x)=-atan2(-y,x) +* +* (2) Reduce to positive by (if and are unexceptional): +* +* ARG (x+iy) = arctan(y/x) ... if x > 0 +* ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0 +* +* (3) According to the integer k=4t+0.25 truncated , t=y/x, the argument +* is further reduced to one of the following intervals and the +* arc tangent of y/x is evaluated by the corresponding formula: +* +* [0,7/16] atan(y/x) = t - t^3*(a1+t^2*(a2+...(a10+t^2*a11)...) +* [7/16,11/16] atan(y/x) = atan(1/2) + atan( (y-x/2)/(x+y/2) ) +* [11/16.19/16] atan(y/x) = atan( 1 ) + atan( (y-x)/(x+y) ) +* [19/16,39/16] atan(y/x) = atan(3/2) + atan( (y-1.5x)/(x+1.5y) ) +* [39/16,INF] atan(y/x) = atan(INF) + atan( -x/y ) +* +* INCLUDE FILES: math.h +* +* RETURNS: +* The double-precision arc tangent of /, in the range [-pi,pi] radians. +* +* Special cases: +* Notations: atan2(y,x) == ARG (x+iy) == ARG(x,y). +* +* .TS +* tab(|); +* l0 c0 l. +* ARG(NAN, (anything)) | is | NaN +* ARG((anything), NaN) | is | NaN +* ARG(+(anything but NaN), +-0) | is | +-0 +* ARG(-(anything but NaN), +-0) | is | +-PI +* ARG(0, +-(anything but 0 and NaN)) | is | +-PI/2 +* ARG(+INF, +-(anything but INF and NaN)) | is | +-0 +* ARG(-INF, +-(anything but INF and NaN)) | is | +-PI +* ARG(+INF, +-INF) | is | +-PI/4 +* ARG(-INF, +-INF) | is | +-3PI/4 +* ARG((anything but 0, NaN, and INF),+-INF) | is | +-PI/2 +* .TE +* +* SEE ALSO: mathALib +* +* INTERNAL: +* Coded in C by K.C. Ng, 1/8/85; +* Revised by K.C. Ng on 2/7/85, 2/13/85, 3/7/85, 3/30/85, 6/29/85. +*/ + +double atan2 + ( + double y, /* numerator */ + double x /* denominator */ + ) + + { + static double zero=0, one=1, small=1.0E-9, big=1.0E18; + double copysign(),logb(),scalb(),t,z,signy,signx,hi,lo; + int finite(), k,m; + +#if !defined(vax)&&!defined(tahoe) + /* if x or y is NAN */ + if(x!=x) return(x); if(y!=y) return(y); +#endif /* !defined(vax)&&!defined(tahoe) */ + + /* copy down the sign of y and x */ + signy = copysign(one,y) ; + signx = copysign(one,x) ; + + /* if x is 1.0, goto begin */ + if(x==1) { y=copysign(y,one); t=y; if(finite(t)) goto begin;} + + /* when y = 0 */ + if(y==zero) return((signx==one)?y:copysign(PI,signy)); + + /* when x = 0 */ + if(x==zero) return(copysign(PIo2,signy)); + + /* when x is INF */ + if(!finite(x)) + if(!finite(y)) + return(copysign((signx==one)?PIo4:3*PIo4,signy)); + else + return(copysign((signx==one)?zero:PI,signy)); + + /* when y is INF */ + if(!finite(y)) return(copysign(PIo2,signy)); + + /* compute y/x */ + x=copysign(x,one); + y=copysign(y,one); + if((m=(k=logb(y))-logb(x)) > 60) t=big+big; + else if(m < -80 ) t=y/x; + else { t = y/x ; y = scalb(y,-k); x=scalb(x,-k); } + + /* begin argument reduction */ +begin: + if (t < 2.4375) { + + /* truncate 4(t+1/16) to integer for branching */ + k = 4 * (t+0.0625); + switch (k) { + + /* t is in [0,7/16] */ + case 0: + case 1: + if (t < small) + { big + small ; /* raise inexact flag */ + return (copysign((signx>zero)?t:PI-t,signy)); } + + hi = zero; lo = zero; break; + + /* t is in [7/16,11/16] */ + case 2: + hi = athfhi; lo = athflo; + z = x+x; + t = ( (y+y) - x ) / ( z + y ); break; + + /* t is in [11/16,19/16] */ + case 3: + case 4: + hi = PIo4; lo = zero; + t = ( y - x ) / ( x + y ); break; + + /* t is in [19/16,39/16] */ + default: + hi = at1fhi; lo = at1flo; + z = y-x; y=y+y+y; t = x+x; + t = ( (z+z)-x ) / ( t + y ); break; + } + } + /* end of if (t < 2.4375) */ + + else + { + hi = PIo2; lo = zero; + + /* t is in [2.4375, big] */ + if (t <= big) t = - x / y; + + /* t is in [big, INF] */ + else + { big+small; /* raise inexact flag */ + t = zero; } + } + /* end of argument reduction */ + + /* compute atan(t) for t in [-.4375, .4375] */ + z = t*t; +#if defined(vax)||defined(tahoe) + z = t*(z*(a1+z*(a2+z*(a3+z*(a4+z*(a5+z*(a6+z*(a7+z*(a8+ + z*(a9+z*(a10+z*(a11+z*a12)))))))))))); +#else /* defined(vax)||defined(tahoe) */ + z = t*(z*(a1+z*(a2+z*(a3+z*(a4+z*(a5+z*(a6+z*(a7+z*(a8+ + z*(a9+z*(a10+z*a11))))))))))); +#endif /* defined(vax)||defined(tahoe) */ + z = lo - z; z += t; z += hi; + + return(copysign((signx>zero)?z:PI-z,signy)); + } diff --git a/libc/math/atanh.c b/libc/math/atanh.c new file mode 100644 index 0000000..164ff1b --- /dev/null +++ b/libc/math/atanh.c @@ -0,0 +1,93 @@ +/* atanh.c - math routines */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,14oct92,jdi made atanh() nomanual. +01b,20sep92,smb documentation additions +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +* Copyright (c) 1985 Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms are permitted +* provided that the above copyright notice and this paragraph are +* duplicated in all such forms and that any documentation, +* advertising materials, and other materials related to such +* distribution and use acknowledge that the software was developed +* by the University of California, Berkeley. The name of the +* University may not be used to endorse or promote products derived +* from this software without specific prior written permission. +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +* +* All recipients should regard themselves as participants in an ongoing +* research project and hence should feel obligated to report their +* experiences (good or bad) with these elementary function codes, using +* the sendbug(8) program, to the authors. +* +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" +#if defined(vax)||defined(tahoe) +#include +#endif /* defined(vax)||defined(tahoe) */ + +/***************************************************************************** +* +* atanh - +* +* ATANH(X) +* RETURN THE HYPERBOLIC ARC TANGENT OF X +* DOUBLE PRECISION (VAX D format 56 bits, IEEE DOUBLE 53 BITS) +* CODED IN C BY K.C. NG, 1/8/85; +* REVISED BY K.C. NG on 2/7/85, 3/7/85, 8/18/85. +* +* Required kernel function: +* .CS +* log1p(x) ...return log(1+x) +* .CE +* +* Method : +* .CS +* Return +* 1 2x x +* atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------) +* 2 1 - x 1 - x +* .CE +* +* Special cases are if atanh(x) is NaN if |x| > 1 with signal; atanh(NaN) is +* that NaN with no signal; or if atanh(+-1) is +-INF with signal. +* +* atanh(x) returns the exact hyperbolic arc tangent of x nearly rounded. +* In a test run with 512,000 random arguments on a VAX, the maximum +* observed error was 1.87 ulps (units in the last place) at +* x= -3.8962076028810414000e-03. +* +* NOMANUAL +*/ + +double atanh(x) +double x; +{ + double copysign(),log1p(),z; + z = copysign(0.5,x); + x = copysign(x,1.0); +#if defined(vax)||defined(tahoe) + if (x == 1.0) { + extern double infnan(); + return(copysign(1.0,z)*infnan(ERANGE)); /* sign(x)*INF */ + } +#endif /* defined(vax)||defined(tahoe) */ + x = x/(1.0-x); + return( z*log1p(x+x) ); +} diff --git a/libc/math/ceil.c b/libc/math/ceil.c new file mode 100644 index 0000000..4898528 --- /dev/null +++ b/libc/math/ceil.c @@ -0,0 +1,71 @@ +/* ceil.c - ceil math routine */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,27oct98,yh return itself if it is ZERO or INF. +01f,05feb93,jdi doc changes based on kdl review. +01e,02dec92,jdi doc tweaks. +01d,28oct92,jdi documentation cleanup. +01c,20sep92,smb documentation additions +01b,30jul92,kdl changed _d_type() calls to fpTypeGet(). +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" +#include "stddef.h" +#include "errno.h" +#include "private/mathP.h" + + +/******************************************************************************* +* +* ceil - compute the smallest integer greater than or equal to a specified value (ANSI) +* +* This routine returns the smallest integer greater than or equal to , +* in double precision. +* +* INCLUDE FILES: math.h +* +* RETURNS: The smallest integral value greater than or equal to , in +* double precision. +* +* SEE ALSO: mathALib +*/ + +double ceil + ( + double v /* value to find the ceiling of */ + ) + + { + double r; + + switch (fpTypeGet (v, &r)) /* get the type of v */ + { + case ZERO: /* ZERO */ + case INF: /* INFINITY */ + return (v); + + case NAN: /* NOT A NUMBER */ + return (v); + + case INTEGER: /* INTEGER */ + return (v); + + case REAL: /* REAL */ + return (((v < 0.0) || (v == r)) ? r : r + 1.0); + + default: + return (0.0); /* this should never happen */ + } + } diff --git a/libc/math/cosh.c b/libc/math/cosh.c new file mode 100644 index 0000000..b03e62e --- /dev/null +++ b/libc/math/cosh.c @@ -0,0 +1,143 @@ +/* cosh.c - hyperbolic routines */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,05feb93,jdi doc changes based on kdl review. +01d,02dec92,jdi doc tweaks. +01c,28oct92,jdi documentation cleanup. +01b,20sep92,smb documentation additions +01a,08jul92,smb documentation +*/ + +/* +DESCRIPTION +* Copyright (c) 1985 Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms are permitted +* provided that the above copyright notice and this paragraph are +* duplicated in all such forms and that any documentation, +* advertising materials, and other materials related to such +* distribution and use acknowledge that the software was developed +* by the University of California, Berkeley. The name of the +* University may not be used to endorse or promote products derived +* from this software without specific prior written permission. +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +* +* All recipients should regard themselves as participants in an ongoing +* research project and hence should feel obligated to report their +* experiences (good or bad) with these elementary function codes, using +* the sendbug(8) program, to the authors. +* +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" + +#if defined(vax)||defined(tahoe) +#ifdef vax +#define _0x(A,B) 0x/**/A/**/B +#else /* vax */ +#define _0x(A,B) 0x/**/B/**/A +#endif /* vax */ +/* static double */ +/* mln2hi = 8.8029691931113054792E1 , Hex 2^ 7 * .B00F33C7E22BDB */ +/* mln2lo = -4.9650192275318476525E-16 , Hex 2^-50 * -.8F1B60279E582A */ +/* lnovfl = 8.8029691931113053016E1 ; Hex 2^ 7 * .B00F33C7E22BDA */ +static long mln2hix[] = { _0x(0f33,43b0), _0x(2bdb,c7e2)}; +static long mln2lox[] = { _0x(1b60,a70f), _0x(582a,279e)}; +static long lnovflx[] = { _0x(0f33,43b0), _0x(2bda,c7e2)}; +#define mln2hi (*(double*)mln2hix) +#define mln2lo (*(double*)mln2lox) +#define lnovfl (*(double*)lnovflx) +#else /* defined(vax)||defined(tahoe) */ +static double +mln2hi = 7.0978271289338397310E2 , /*Hex 2^ 10 * 1.62E42FEFA39EF */ +mln2lo = 2.3747039373786107478E-14 , /*Hex 2^-45 * 1.ABC9E3B39803F */ +lnovfl = 7.0978271289338397310E2 ; /*Hex 2^ 9 * 1.62E42FEFA39EF */ +#endif /* defined(vax)||defined(tahoe) */ + +#if defined(vax)||defined(tahoe) +static max = 126 ; +#else /* defined(vax)||defined(tahoe) */ +static max = 1023 ; +#endif /* defined(vax)||defined(tahoe) */ + +/******************************************************************************* +* +* cosh - compute a hyperbolic cosine (ANSI) +* +* This routine returns the hyperbolic cosine of in +* double precision (IEEE double, 53 bits). +* +* A range error occurs if is too large. +* +* INTERNAL: +* Method: +* (1) Replace by |x|. +* (2) +* [ exp(x) - 1 ]^2 +* 0 <= x <= 0.3465 : cosh(x) := 1 + ------------------- +* 2*exp(x) +* +* exp(x) + 1/exp(x) +* 0.3465 <= x <= 22 : cosh(x) := ------------------- +* 2 +* 22 <= x <= lnovfl : cosh(x) := exp(x)/2 +* lnovfl <= x <= lnovfl+log(2) +* : cosh(x) := exp(x)/2 (avoid overflow) +* log(2)+lnovfl < x < INF: overflow to INF +* +* Note: .3465 is a number near one half of ln2. +* +* INCLUDE FILES: math.h +* +* RETURNS: +* The double-precision hyperbolic cosine of . +* +* Special cases: +* If is +INF, -INF, or NaN, cosh() returns . +* +* SEE ALSO: mathALib +* +* INTERNAL: +* Coded in C by K.C. Ng, 1/8/85; +* Revised by K.C. Ng on 2/8/85, 2/23/85, 3/7/85, 3/29/85, 4/16/85. +*/ + +double cosh + ( + double x /* value to compute the hyperbolic cosine of */ + ) + + { + static double half=1.0/2.0,one=1.0, small=1.0E-18; /* fl(1+small)==1 */ + double scalb(),copysign(),exp(),exp__E(),t; + +#if !defined(vax)&&!defined(tahoe) + if(x!=x) return(x); /* x is NaN */ +#endif /* !defined(vax)&&!defined(tahoe) */ + if((x=copysign(x,one)) <= 22) + if(x<0.3465) + if(x in +* double precision (IEEE double, 53 bits). +* +* A range error occurs if is too large. +* +* INTERNAL: +* Method: +* (1) Argument Reduction: given the input , find and integer +* such that: +* +* x = k*ln2 + r, |r| <= 0.5*ln2 +* +* will be represented as r := z+c for better accuracy. +* +* (2) Compute exp(r) by +* +* exp(r) = 1 + r + r*R1/(2-R1) +* +* where: +* +* R1 = x - x^2*(p1+x^2*(p2+x^2*(p3+x^2*(p4+p5*x^2)))) +* +* (3) exp(x) = 2^k * exp(r) +* +* INCLUDE FILES: math.h +* +* RETURNS: The double-precision exponential value of . +* +* Special cases: +* If is +INF or NaN, exp() returns . +* If is -INF, it returns 0. +* +* SEE ALSO: mathALib +* +* INTERNAL: +* Coded in C by K.C. Ng, 1/19/85; +* Revised by K.C. Ng on 2/6/85, 2/15/85, 3/7/85, 3/24/85, 4/16/85, 6/14/86. +*/ + +double exp + ( + double x /* exponent */ + ) + + { + double scalb(), copysign(), z,hi,lo,c; + int k,finite(); + +#if !defined(vax)&&!defined(tahoe) + if(x!=x) return(x); /* x is NaN */ +#endif /* !defined(vax)&&!defined(tahoe) */ + if( x <= lnhuge ) { + if( x >= lntiny ) { + + /* argument reduction : x --> x - k*ln2 */ + + k=invln2*x+copysign(0.5,x); /* k=NINT(x/ln2) */ + + /* express x-k*ln2 as hi-lo and let x=hi-lo rounded */ + + hi=x-k*ln2hi; + x=hi-(lo=k*ln2lo); + + /* return 2^k*[1+x+x*c/(2+c)] */ + z=x*x; + c= x - z*(p1+z*(p2+z*(p3+z*(p4+z*p5)))); + return scalb(1.0+(hi-(lo-(x*c)/(2.0-c))),k); + + } + /* end of x > lntiny */ + + else + /* exp(-big#) underflows to zero */ + if(finite(x)) return(scalb(1.0,-5000)); + + /* exp(-INF) is zero */ + else return(0.0); + } + /* end of x < lnhuge */ + + else + /* exp(INF) is INF, exp(+big#) overflows to INF */ + return( finite(x) ? scalb(1.0,5000) : x); + } diff --git a/libc/math/exp__E.c b/libc/math/exp__E.c new file mode 100644 index 0000000..e3e652d --- /dev/null +++ b/libc/math/exp__E.c @@ -0,0 +1,153 @@ +/* exp__E.c - math routines */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,20sep92,smb documentation additions. +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +* Copyright (c) 1985 Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms are permitted +* provided that the above copyright notice and this paragraph are +* duplicated in all such forms and that any documentation, +* advertising materials, and other materials related to such +* distribution and use acknowledge that the software was developed +* by the University of California, Berkeley. The name of the +* University may not be used to endorse or promote products derived +* from this software without specific prior written permission. +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +* +* All recipients should regard themselves as participants in an ongoing +* research project and hence should feel obligated to report their +* experiences (good or bad) with these elementary function codes, using +* the sendbug(8) program, to the authors. +* +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" + +#if defined(vax)||defined(tahoe) /* VAX D format */ +#ifdef vax +#define _0x(A,B) 0x/**/A/**/B +#else /* vax */ +#define _0x(A,B) 0x/**/B/**/A +#endif /* vax */ +/* static double */ +/* p1 = 1.5150724356786683059E-2 , Hex 2^ -6 * .F83ABE67E1066A */ +/* p2 = 6.3112487873718332688E-5 , Hex 2^-13 * .845B4248CD0173 */ +/* q1 = 1.1363478204690669916E-1 , Hex 2^ -3 * .E8B95A44A2EC45 */ +/* q2 = 1.2624568129896839182E-3 , Hex 2^ -9 * .A5790572E4F5E7 */ +/* q3 = 1.5021856115869022674E-6 ; Hex 2^-19 * .C99EB4604AC395 */ +static long p1x[] = { _0x(3abe,3d78), _0x(066a,67e1)}; +static long p2x[] = { _0x(5b42,3984), _0x(0173,48cd)}; +static long q1x[] = { _0x(b95a,3ee8), _0x(ec45,44a2)}; +static long q2x[] = { _0x(7905,3ba5), _0x(f5e7,72e4)}; +static long q3x[] = { _0x(9eb4,36c9), _0x(c395,604a)}; +#define p1 (*(double*)p1x) +#define p2 (*(double*)p2x) +#define q1 (*(double*)q1x) +#define q2 (*(double*)q2x) +#define q3 (*(double*)q3x) +#else /* defined(vax)||defined(tahoe) */ +static double +p1 = 1.3887401997267371720E-2 , /*Hex 2^ -7 * 1.C70FF8B3CC2CF */ +p2 = 3.3044019718331897649E-5 , /*Hex 2^-15 * 1.15317DF4526C4 */ +q1 = 1.1110813732786649355E-1 , /*Hex 2^ -4 * 1.C719538248597 */ +q2 = 9.9176615021572857300E-4 ; /*Hex 2^-10 * 1.03FC4CB8C98E8 */ +#endif /* defined(vax)||defined(tahoe) */ + +/******************************************************************************* +* +* exp_E - +* +* exp__E(x,c) +* ASSUMPTION: c << x SO THAT fl(x+c)=x. +* (c is the correction term for x) +* exp__E RETURNS +* +* / exp(x+c) - 1 - x , 1E-19 < |x| < .3465736 +* exp__E(x,c) = | +* \ 0 , |x| < 1E-19. +* +* DOUBLE PRECISION (IEEE 53 bits, VAX D FORMAT 56 BITS) +* KERNEL FUNCTION OF EXP, EXPM1, POW FUNCTIONS +* CODED IN C BY K.C. NG, 1/31/85; +* REVISED BY K.C. NG on 3/16/85, 4/16/85. +* +* Required system supported function: +* copysign(x,y) +* +* Method: +* 1. Rational approximation. Let r=x+c. +* Based on +* 2 * sinh(r/2) +* exp(r) - 1 = ---------------------- , +* cosh(r/2) - sinh(r/2) +* exp__E(r) is computed using +* x*x (x/2)*W - ( Q - ( 2*P + x*P ) ) +* --- + (c + x*[---------------------------------- + c ]) +* 2 1 - W +* where P := p1*x^2 + p2*x^4, +* Q := q1*x^2 + q2*x^4 (for 56 bits precision, add q3*x^6) +* W := x/2-(Q-x*P), +* +* (See the listing below for the values of p1,p2,q1,q2,q3. The poly- +* nomials P and Q may be regarded as the approximations to sinh +* and cosh : +* sinh(r/2) = r/2 + r * P , cosh(r/2) = 1 + Q . ) +* +* The coefficients were obtained by a special Remez algorithm. +* +* Approximation error: +* +* | exp(x) - 1 | 2**(-57), (IEEE double) +* | ------------ - (exp__E(x,0)+x)/x | <= +* | x | 2**(-69). (VAX D) +* +* Constants: +* The hexadecimal values are the intended ones for the following constants. +* The decimal values may be used, provided that the compiler will convert +* from decimal to binary accurately enough to produce the hexadecimal values +* shown. +NOMANUAL +*/ + +double exp__E(x,c) +double x,c; +{ + static double zero=0.0, one=1.0, half=1.0/2.0, small=1.0E-19; + double copysign(),z,p,q,xp,xh,w; + if(copysign(x,one)>small) { + z = x*x ; + p = z*( p1 +z* p2 ); +#if defined(vax)||defined(tahoe) + q = z*( q1 +z*( q2 +z* q3 )); +#else /* defined(vax)||defined(tahoe) */ + q = z*( q1 +z* q2 ); +#endif /* defined(vax)||defined(tahoe) */ + xp= x*p ; + xh= x*half ; + w = xh-(q-xp) ; + p = p+p; + c += x*((xh*w-(q-(p+xp)))/(one-w)+c); + return(z*half+c); + } + /* end of |x| > small */ + + else { + if(x!=zero) one+small; /* raise the inexact flag */ + return(copysign(zero,x)); + } +} diff --git a/libc/math/expm1.c b/libc/math/expm1.c new file mode 100644 index 0000000..b3b9b60 --- /dev/null +++ b/libc/math/expm1.c @@ -0,0 +1,188 @@ +/* expm1.c - math routines */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,20sep92,smb documentation additions. +01b,30jul92,kdl marked routine NOMANUAL. +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +* +* This file includes a support routine (expm1()) which is used by +* other portions of the UCB ANSI C library. +* +* Copyright (c) 1985 Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms are permitted +* provided that the above copyright notice and this paragraph are +* duplicated in all such forms and that any documentation, +* advertising materials, and other materials related to such +* distribution and use acknowledge that the software was developed +* by the University of California, Berkeley. The name of the +* University may not be used to endorse or promote products derived +* from this software without specific prior written permission. +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +* +* All recipients should regard themselves as participants in an ongoing +* research project and hence should feel obligated to report their +* experiences (good or bad) with these elementary function codes, using +* the sendbug(8) program, to the authors. +* +* SEE ALSO: American National Standard X3.159-1989 +* +* NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" + +#if defined(vax)||defined(tahoe) /* VAX D format */ +#ifdef vax +#define _0x(A,B) 0x/**/A/**/B +#else /* vax */ +#define _0x(A,B) 0x/**/B/**/A +#endif /* vax */ +/* static double */ +/* ln2hi = 6.9314718055829871446E-1 , Hex 2^ 0 * .B17217F7D00000 */ +/* ln2lo = 1.6465949582897081279E-12 , Hex 2^-39 * .E7BCD5E4F1D9CC */ +/* lnhuge = 9.4961163736712506989E1 , Hex 2^ 7 * .BDEC1DA73E9010 */ +/* invln2 = 1.4426950408889634148E0 ; Hex 2^ 1 * .B8AA3B295C17F1 */ +static long ln2hix[] = { _0x(7217,4031), _0x(0000,f7d0)}; +static long ln2lox[] = { _0x(bcd5,2ce7), _0x(d9cc,e4f1)}; +static long lnhugex[] = { _0x(ec1d,43bd), _0x(9010,a73e)}; +static long invln2x[] = { _0x(aa3b,40b8), _0x(17f1,295c)}; +#define ln2hi (*(double*)ln2hix) +#define ln2lo (*(double*)ln2lox) +#define lnhuge (*(double*)lnhugex) +#define invln2 (*(double*)invln2x) +#else /* defined(vax)||defined(tahoe) */ +static double +ln2hi = 6.9314718036912381649E-1 , /*Hex 2^ -1 * 1.62E42FEE00000 */ +ln2lo = 1.9082149292705877000E-10 , /*Hex 2^-33 * 1.A39EF35793C76 */ +lnhuge = 7.1602103751842355450E2 , /*Hex 2^ 9 * 1.6602B15B7ECF2 */ +invln2 = 1.4426950408889633870E0 ; /*Hex 2^ 0 * 1.71547652B82FE */ +#endif /* defined(vax)||defined(tahoe) */ + +/***************************************************************************** +* expm1 - +* +* EXPM1(X) +* RETURN THE EXPONENTIAL OF X MINUS ONE +* DOUBLE PRECISION (IEEE 53 BITS, VAX D FORMAT 56 BITS) +* CODED IN C BY K.C. NG, 1/19/85; +* REVISED BY K.C. NG on 2/6/85, 3/7/85, 3/21/85, 4/16/85. +* +* Required system supported functions: +* scalb(x,n) +* copysign(x,y) +* finite(x) +* +* Kernel function: +* exp__E(x,c) +* +* Method: +* 1. Argument Reduction: given the input x, find r and integer k such +* that +* x = k*ln2 + r, |r| <= 0.5*ln2 . +* r will be represented as r := z+c for better accuracy. +* +* 2. Compute EXPM1(r)=exp(r)-1 by +* +* EXPM1(r=z+c) := z + exp__E(z,c) +* +* 3. EXPM1(x) = 2^k * ( EXPM1(r) + 1-2^-k ). +* +* Remarks: +* 1. When k=1 and z < -0.25, we use the following formula for +* better accuracy: +* EXPM1(x) = 2 * ( (z+0.5) + exp__E(z,c) ) +* 2. To avoid rounding error in 1-2^-k where k is large, we use +* EXPM1(x) = 2^k * { [z+(exp__E(z,c)-2^-k )] + 1 } +* when k>56. +* +* Special cases: +* EXPM1(INF) is INF, EXPM1(NaN) is NaN; +* EXPM1(-INF)= -1; +* for finite argument, only EXPM1(0)=0 is exact. +* +* Accuracy: +* EXPM1(x) returns the exact (exp(x)-1) nearly rounded. In a test run with +* 1,166,000 random arguments on a VAX, the maximum observed error was +* .872 ulps (units of the last place). +* +* Constants: +* The hexadecimal values are the intended ones for the following constants. +* The decimal values may be used, provided that the compiler will convert +* from decimal to binary accurately enough to produce the hexadecimal values +* shown. +* +* NOMANUAL +*/ + +double expm1(x) +double x; +{ + static double one=1.0, half=1.0/2.0; + double scalb(), copysign(), exp__E(), z,hi,lo,c; + int k,finite(); +#if defined(vax)||defined(tahoe) + static prec=56; +#else /* defined(vax)||defined(tahoe) */ + static prec=53; +#endif /* defined(vax)||defined(tahoe) */ +#if !defined(vax)&&!defined(tahoe) + if(x!=x) return(x); /* x is NaN */ +#endif /* !defined(vax)&&!defined(tahoe) */ + + if( x <= lnhuge ) { + if( x >= -40.0 ) { + + /* argument reduction : x - k*ln2 */ + k= invln2 *x+copysign(0.5,x); /* k=NINT(x/ln2) */ + hi=x-k*ln2hi ; + z=hi-(lo=k*ln2lo); + c=(hi-z)-lo; + + if(k==0) return(z+exp__E(z,c)); + if(k==1) + if(z< -0.25) + {x=z+half;x +=exp__E(z,c); return(x+x);} + else + {z+=exp__E(z,c); x=half+z; return(x+x);} + /* end of k=1 */ + + else { + if(k<=prec) + { x=one-scalb(one,-k); z += exp__E(z,c);} + else if(k<100) + { x = exp__E(z,c)-scalb(one,-k); x+=z; z=one;} + else + { x = exp__E(z,c)+z; z=one;} + + return (scalb(x+z,k)); + } + } + /* end of x > lnunfl */ + + else + /* expm1(-big#) rounded to -1 (inexact) */ + if(finite(x)) + { ln2hi+ln2lo; return(-one);} + + /* expm1(-INF) is -1 */ + else return(-one); + } + /* end of x < lnhuge */ + + else + /* expm1(INF) is INF, expm1(+big#) overflows to INF */ + return( finite(x) ? scalb(one,5000) : x); +} diff --git a/libc/math/fabs.c b/libc/math/fabs.c new file mode 100644 index 0000000..e7bdf42 --- /dev/null +++ b/libc/math/fabs.c @@ -0,0 +1,70 @@ +/* fabs.c - fabs math routine */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,05feb99,dgp document errno values +01f,05feb93,jdi doc changes based on kdl review. +01e,02dec92,jdi doc tweaks. +01d,28oct92,jdi documentation cleanup. +01c,20sep92,smb documentation additions +01b,30jul92,kdl changed _d_type() calls to fpTypeGet(). +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" +#include "stddef.h" +#include "errno.h" +#include "private/mathP.h" + + +/******************************************************************************* +* +* fabs - compute an absolute value (ANSI) +* +* This routine returns the absolute value of in double precision. +* +* INCLUDE FILES: math.h +* +* RETURNS: The double-precision absolute value of . +* +* ERRNO: EDOM, ERANGE +* +* SEE ALSO: mathALib +*/ + +double fabs + ( + double v /* number to return the absolute value of */ + ) + + { + switch (fpTypeGet (v, NULL)) + { + case ZERO: /* ZERO */ + return (0.0); + + case NAN: /* NOT A NUMBER */ + errno = EDOM; + return (v); + + case INF: /* INFINITE */ + errno = ERANGE; + + case INTEGER: /* INTEGER */ + case REAL: /* REAL */ + return ((v < 0.0) ? - v : v); + + default: + return (0.0); + } + } diff --git a/libc/math/floor.c b/libc/math/floor.c new file mode 100644 index 0000000..258a5d4 --- /dev/null +++ b/libc/math/floor.c @@ -0,0 +1,67 @@ +/* floor.c - floor math routine */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,17nov00,tkt return itself if it is ZERO or INF. +01g,04may01,agf fix return value of INF +01f,05feb93,jdi doc changes based on kdl review. +01e,02dec92,jdi doc tweaks. +01d,28oct92,jdi documentation cleanup. +01c,20sep92,smb documentation additions +01b,30jul92,kdl changed _d_type() calls to fpTypeGet(). +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" +#include "stddef.h" +#include "errno.h" +#include "private/mathP.h" + + +/******************************************************************************* +* +* floor - compute the largest integer less than or equal to a specified value (ANSI) +* +* This routine returns the largest integer less than or equal to , in +* double precision. +* +* INCLUDE FILES: math.h +* +* RETURNS: +* The largest integral value less than or equal to , in double precision. +* +* SEE ALSO: mathALib +*/ + +double floor + ( + double v /* value to find the floor of */ + ) + + { + double r; + + switch (fpTypeGet (v, &r)) /* find out the type of v */ + { + case ZERO: return (0); + + case INF: + case NAN: return (v); + + case INTEGER: return (v); + + case REAL: return (((v < 0.0) && (v != r)) ? (r - 1.0) : (r)); + + default: return (0); /* this should never happen */ + } + } diff --git a/libc/math/fmod.c b/libc/math/fmod.c new file mode 100644 index 0000000..8a3a4be --- /dev/null +++ b/libc/math/fmod.c @@ -0,0 +1,174 @@ +/* fmod.c - fmod math routine */ + +/* Copyright 1992-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +03b,01apr02,pfl clean up fix for SPR 20486 plus + ISO/IEC 9899:1999 conformance +02a,31oct01,md3 +gkc +ycl rewrite: fixed SPR #20486. +01f,05feb93,jdi doc changes based on kdl review. +01e,02dec92,jdi doc tweaks. +01d,28oct92,jdi documentation cleanup. +01c,20sep92,smb documentation additions +01b,30jul92,kdl changed _d_type() calls to fpTypeGet(). +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" +#include "stddef.h" +#include "errno.h" +#include "private/mathP.h" +#include "errnoLib.h" + +/* mask to extract exponent part of a double */ + +#define MASK_DB_EXP 0x7ff00000 + +/* mask to extract high 20 significant bits */ + +#define MASK_DB_HI20 0x000fffff + +/* mask to filter exponent part of double */ + +#define MASK_DB_MANT 0x800fffff + +/* for big endian machine */ + +#if (_BYTE_ORDER==_BIG_ENDIAN) + +/* high 32 bits of Db - 1-bit sign + 11-bits exponent + 20-bit significant */ + +#define DB_HI(d) ((unsigned int) *((int*)&d)) + +/* hi 20 bits of a double's significant */ + +#define DB_HI_SIG(d) ((unsigned int) *((int*)&d) & MASK_DB_HI20) + +/* lower 32 bits of double's significant */ + +#define DB_LO_SIG(d) ((unsigned int) *(1+(int*)&d)) + +/* for little endian machine */ + +#else /* (_BYTE_ORDER != _BIG_ENDIAN) */ + +/* high 32 bits of Db - 1-bit sign + 11-bits exponent + 20-bit significant */ + +#define DB_HI(d) ((unsigned int) *(1+(int*)&d)) + +/* hi 20 bits of a double's significant */ + +#define DB_HI_SIG(d) ((unsigned int) *(1+(int*)&d) & MASK_DB_HI20) + +/* lower 32 bits of double's significant */ + +#define DB_LO_SIG(d) ((unsigned int) *((int*)&d)) + +#endif /* (_BYTE_ORDER==_BIG_ENDIAN) */ + +/* return (significant of d1) > (significant of d2) */ + +#define DB_GT_SIG(d1,d2) \ + ((DB_HI_SIG(d1) > DB_HI_SIG(d2)) || \ + ((DB_HI_SIG(d1) == DB_HI_SIG(d2)) && (DB_LO_SIG(d1) > DB_LO_SIG(d2)))) + +/* NAN value */ + +#define NAN_VAL(d) {*(int *)(&d) = 0xffffffff; *(1+(int *)&d)=0xffffffff;} + +/******************************************************************************* +* +* fmod - compute the remainder of x/y (ANSI) +* +* This routine returns the remainder of / with the sign of , +* in double precision. +* +* INCLUDE FILES: math.h +* +* RETURNS: The value - * , for some integer . If is +* non-zero, the result has the same sign as and magnitude less than the +* magnitude of . If is zero, fmod() returns zero. +* +* ERRNO: EDOM +* +* SEE ALSO: mathALib +*/ + +double fmod + ( + double x, /* numerator */ + double y /* denominator */ + ) + { + double negative = 1.0; /* used for sign of return */ + double yMult2n; /* computed next decrement */ + unsigned int zeroExp_y; /* factor for next decrement */ + + int errx = fpTypeGet (x, NULL); /* determine number type */ + int erry = fpTypeGet (y, NULL); /* determine number type */ + + /* + * Per ISO/IEC 9899:1999, ANSI/IEEE 754-1985 + * fmod ( +-0, y) = +-0 (if y != 0) + * fmod ( x, y) = NAN (if x = INF or y = 0) + * fmod ( x, +-INF) = x (if x != INF) + */ + + /* check for boundary conditions returning NAN */ + + if (errx == NAN || erry == NAN || errx == INF || erry == ZERO) + { + errnoSet(EDOM); /* Domain error is set to maintain backward + compatibility with ANSI X3.159-1989 */ + NAN_VAL(x); + return (x); /* return NAN */ + } + + /* check for boundary conditions returning X */ + + if (errx == ZERO || erry == INF) + return (x); + + /* make Y absolute */ + + if (y < 0.0) + y = -y; + + /* make X absolute, record sign for return. */ + + if (x < 0.0) + { + x = -x; + negative = -1.0; + } + + /* initial decrementing conditions */ + + yMult2n = y; + zeroExp_y= MASK_DB_MANT & (DB_HI(y)); + + /* compute fmod by subtracting estimated decrementations */ + + while (x>=y) + { + if (DB_GT_SIG(y,x)) + { + (DB_HI(yMult2n)) = ( (DB_HI(x)-0x100000) & MASK_DB_EXP ) | zeroExp_y; + } + else + { + (DB_HI(yMult2n)) = ( DB_HI(x) & MASK_DB_EXP ) | zeroExp_y; + } + x-= yMult2n ; + } + return (negative*x); + } diff --git a/libc/math/frexp.c b/libc/math/frexp.c new file mode 100644 index 0000000..ce4a7b0 --- /dev/null +++ b/libc/math/frexp.c @@ -0,0 +1,87 @@ +/* frexp.c - frexp math routine */ + +/* Copyright 1992-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,23may01,to doc fix +01i,05feb99,dgp document errno values +01h,05aug96,dbt frexp now returned a value >= 0.5 and strictly less than 1.0. + (SPR #4280). + Updated copyright. +01g,05feb93,jdi doc changes based on kdl review. +01f,02dec92,jdi doc tweaks. +01e,28oct92,jdi documentation cleanup. +01d,21sep92,smb replaced orignal versions. +01c,20sep92,smb documentation additions +01b,30jul92,kdl replaced routine contents with frexp() from floatLib.c. +01a,08jul92,smb written, documentation. +*/ + +/* +DESCRIPTION + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "math.h" +#include "stddef.h" +#include "errno.h" +#include "private/mathP.h" + +/******************************************************************************* +* +* frexp - break a floating-point number into a normalized fraction and power of 2 (ANSI) +* +* This routine breaks a double-precision number into a normalized +* fraction and integral power of 2. It stores the integer exponent in . +* +* INCLUDE FILES: math.h +* +* RETURNS: +* The double-precision value , such that the magnitude of is +* in the interval [1/2,1) or zero, and equals times +* 2 to the power of . If is zero, both parts of the result +* are zero. +* +* ERRNO: EDOM +* +*/ +double frexp + ( + double value, /* number to be normalized */ + int *pexp /* pointer to the exponent */ + ) + + { + double r; + + *pexp = 0; + + /* determine number type */ + + switch (fpTypeGet(value, &r)) + { + case NAN: /* NOT A NUMBER */ + case INF: /* INFINITE */ + errno = EDOM; + return (value); + + case ZERO: /* ZERO */ + return (0.0); + + default: + /* + * return value must be strictly less than 1.0 and >=0.5 . + */ + if ((r = fabs(value)) >= 1.0) + for(; (r >= 1.0); (*pexp)++, r /= 2.0); + else + for(; (r < 0.5); (*pexp)--, r *= 2.0); + + return (value < 0 ? -r : r); + } + } diff --git a/libc/math/ldexp.c b/libc/math/ldexp.c new file mode 100644 index 0000000..8cde7ea --- /dev/null +++ b/libc/math/ldexp.c @@ -0,0 +1,79 @@ +/* ldexp.c - ldexp math routine */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01h,05feb99,dgp document errno values +01g,05feb93,jdi doc changes based on kdl review. +01f,02dec92,jdi doc tweaks. +01e,28oct92,jdi documentation cleanup. +01d,21sep92,smb replaced original version. +01c,20sep92,smb documentation additions +01b,30jul92,kdl replaced routine contents with ldexp() from floatLib.c. +01a,08jul92,smb written, documentation. +*/ + +/* +DESCRIPTION + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "math.h" +#include "stddef.h" +#include "errno.h" +#include "private/mathP.h" + + +/******************************************************************************* +* +* ldexp - multiply a number by an integral power of 2 (ANSI) +* +* This routine multiplies a floating-point number by an integral power of 2. +* A range error may occur. +* +* INCLUDE FILES: math.h +* +* RETURNS: The double-precision value of times 2 to the power of . +* +* ERRNO: EDOM, ERANGE +* +*/ + +double ldexp + ( + double v, /* a floating point number */ + int xexp /* exponent */ + ) + + { + double zero = 0.0; + + switch (fpTypeGet (v, NULL)) + { + case NAN: /* NOT A NUMBER */ + errno = EDOM; + break; + + case INF: /* INFINITE */ + errno = ERANGE; + break; + + case ZERO: /* ZERO */ + return (zero); + + default: + if (xexp >= 0) + for(; (xexp > 0); xexp--, v *= 2.0); + else + for(; (xexp < 0); xexp++, v /= 2.0); + + return (v); + } + + return (zero); + } diff --git a/libc/math/log.c b/libc/math/log.c new file mode 100644 index 0000000..3484316 --- /dev/null +++ b/libc/math/log.c @@ -0,0 +1,186 @@ +/* log.c - math routines */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,05feb93,jdi doc changes based on kdl review. +01e,02dec92,jdi doc tweaks. +01d,28oct92,jdi documentation cleanup. +01c,13oct92,jdi mangen fixes. +01b,20sep92,smb documentation additions +01a,08jul92,smb documentation +*/ + +/* +DESCRIPTION +* Copyright (c) 1985 Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms are permitted +* provided that the above copyright notice and this paragraph are +* duplicated in all such forms and that any documentation, +* advertising materials, and other materials related to such +* distribution and use acknowledge that the software was developed +* by the University of California, Berkeley. The name of the +* University may not be used to endorse or promote products derived +* from this software without specific prior written permission. +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +* +* All recipients should regard themselves as participants in an ongoing +* research project and hence should feel obligated to report their +* experiences (good or bad) with these elementary function codes, using +* the sendbug(8) program, to the authors. +* +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" + +#if defined(vax)||defined(tahoe) /* VAX D format */ +#include +#ifdef vax +#define _0x(A,B) 0x/**/A/**/B +#else /* vax */ +#define _0x(A,B) 0x/**/B/**/A +#endif /* vax */ +/* static double */ +/* ln2hi = 6.9314718055829871446E-1 , Hex 2^ 0 * .B17217F7D00000 */ +/* ln2lo = 1.6465949582897081279E-12 , Hex 2^-39 * .E7BCD5E4F1D9CC */ +/* sqrt2 = 1.4142135623730950622E0 ; Hex 2^ 1 * .B504F333F9DE65 */ +static long ln2hix[] = { _0x(7217,4031), _0x(0000,f7d0)}; +static long ln2lox[] = { _0x(bcd5,2ce7), _0x(d9cc,e4f1)}; +static long sqrt2x[] = { _0x(04f3,40b5), _0x(de65,33f9)}; +#define ln2hi (*(double*)ln2hix) +#define ln2lo (*(double*)ln2lox) +#define sqrt2 (*(double*)sqrt2x) +#else /* defined(vax)||defined(tahoe) */ +static double +ln2hi = 6.9314718036912381649E-1 , /*Hex 2^ -1 * 1.62E42FEE00000 */ +ln2lo = 1.9082149292705877000E-10 , /*Hex 2^-33 * 1.A39EF35793C76 */ +sqrt2 = 1.4142135623730951455E0 ; /*Hex 2^ 0 * 1.6A09E667F3BCD */ +#endif /* defined(vax)||defined(tahoe) */ + +/******************************************************************************* +* +* log - compute a natural logarithm (ANSI) +* +* This routine returns the natural logarithm of +* in double precision (IEEE double, 53 bits). +* +* A domain error occurs if the argument is negative. A range error may occur +* if the argument is zero. +* +* INTERNAL: +* Method: +* (1) Argument Reduction: find and such that: +* +* x = 2^k * (1+f) +* +* where: +* +* sqrt(2)/2 < 1+f < sqrt(2) +* +* (2) Let s = f/(2+f); based on: +* +* log(1+f) = log(1+s) - log(1-s) = 2s + 2/3 s**3 + 2/5 s**5 + ..... +* +* log(1+f) is computed by: +* +* log(1+f) = 2s + s*log__L(s*s) +* +* where: +* +* log__L(z) = z*(L1 + z*(L2 + z*(... (L6 + z*L7)...))) +* +* (3) Finally: +* +* log(x) = k*ln2 + log(1+f) +* +* (Here n*ln2 will be stored +* in two floating-point numbers: n*ln2hi + n*ln2lo; n*ln2hi is exact +* since the last 20 bits of ln2hi is 0.) +* +* INCLUDE FILES: math.h +* +* RETURNS: The double-precision natural logarithm of . +* +* Special cases: +* If < 0 (including -INF), it returns NaN with signal. +* If is +INF, it returns with no signal. +* If is 0, it returns -INF with signal. +* If is NaN it returns with no signal. +* +* SEE ALSO: mathALib +* +* INTERNAL +* Coded in C by K.C. Ng, 1/19/85; +* Revised by K.C. Ng on 2/7/85, 3/7/85, 3/24/85, 4/16/85. +*/ + +double log + ( + double x /* value to compute the natural logarithm of */ + ) + + { + static double zero=0.0, negone= -1.0, half=1.0/2.0; + double logb(),scalb(),copysign(),log__L(),s,z,t; + int k,n,finite(); + +#if !defined(vax)&&!defined(tahoe) + if(x!=x) return(x); /* x is NaN */ +#endif /* !defined(vax)&&!defined(tahoe) */ + if(finite(x)) { + if( x > zero ) { + + /* argument reduction */ + k=logb(x); x=scalb(x,-k); + if(k == -1022) /* subnormal no. */ + {n=logb(x); x=scalb(x,-n); k+=n;} + if(x >= sqrt2 ) {k += 1; x *= half;} + x += negone ; + + /* compute log(1+x) */ + s=x/(2+x); t=x*x*half; + z=k*ln2lo+s*(t+log__L(s*s)); + x += (z - t) ; + + return(k*ln2hi+x); + } + /* end of if (x > zero) */ + + else { +#if defined(vax)||defined(tahoe) + extern double infnan(); + if ( x == zero ) + return (infnan(-ERANGE)); /* -INF */ + else + return (infnan(EDOM)); /* NaN */ +#else /* defined(vax)||defined(tahoe) */ + /* zero argument, return -INF with signal */ + if ( x == zero ) + return( negone/zero ); + + /* negative argument, return NaN with signal */ + else + return ( zero / zero ); +#endif /* defined(vax)||defined(tahoe) */ + } + } + /* end of if (finite(x)) */ + /* NOTREACHED if defined(vax)||defined(tahoe) */ + + /* log(-INF) is NaN with signal */ + else if (x<0) + return(zero/zero); + + /* log(+INF) is +INF */ + else return(x); + + } diff --git a/libc/math/log10.c b/libc/math/log10.c new file mode 100644 index 0000000..39dc1db --- /dev/null +++ b/libc/math/log10.c @@ -0,0 +1,111 @@ +/* log10.c - math routine */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,05feb93,jdi doc changes based on kdl review. +01d,02dec92,jdi doc tweaks. +01c,28oct92,jdi documentation cleanup. +01b,20sep92,smb documentation additions +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +* Copyright (c) 1985 Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms are permitted +* provided that the above copyright notice and this paragraph are +* duplicated in all such forms and that any documentation, +* advertising materials, and other materials related to such +* distribution and use acknowledge that the software was developed +* by the University of California, Berkeley. The name of the +* University may not be used to endorse or promote products derived +* from this software without specific prior written permission. +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +* +* All recipients should regard themselves as participants in an ongoing +* research project and hence should feel obligated to report their +* experiences (good or bad) with these elementary function codes, using +* the sendbug(8) program, to the authors. +* +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" + +#if defined(vax)||defined(tahoe) /* VAX D format (56 bits) */ +#ifdef vax +#define _0x(A,B) 0x/**/A/**/B +#else /* vax */ +#define _0x(A,B) 0x/**/B/**/A +#endif /* vax */ +/* static double */ +/* ln10hi = 2.3025850929940456790E0 ; Hex 2^ 2 * .935D8DDDAAA8AC */ +static long ln10hix[] = { _0x(5d8d,4113), _0x(a8ac,ddaa)}; +#define ln10hi (*(double*)ln10hix) +#else /* defined(vax)||defined(tahoe) */ +static double +ivln10 = 4.3429448190325181667E-1 ; /*Hex 2^ -2 * 1.BCB7B1526E50E */ +#endif /* defined(vax)||defined(tahoe) */ + +/******************************************************************************* +* +* log10 - compute a base-10 logarithm (ANSI) +* +* This routine returns the base 10 logarithm of in +* double precision (IEEE double, 53 bits). +* +* A domain error occurs if the argument is negative. A range error may +* if the argument is zero. +* +* INTERNAL: +* Method: +* log(x) +* log10(x) = --------- or [1/log(10)]*log(x) +* log(10) +* +* [log(10)] rounded to 56 bits has error .0895 ulps, +* [1/log(10)] rounded to 53 bits has error .198 ulps; +* therefore, for better accuracy, in VAX D format, we divide +* log(x) by log(10), but in IEEE Double format, we multiply +* log(x) by [1/log(10)]. +* +* INCLUDE FILES: math.h +* +* RETURNS: The double-precision base-10 logarithm of . +* +* Special cases: +* If < 0, log10() returns NaN with signal. +* if is +INF, it returns with no signal. +* if is 0, it returns -INF with signal. +* if is NaN it returns with no signal. +* +* SEE ALSO: mathALib +* +* INTERNAL: +* Coded in C by K.C. Ng, 1/20/85; +* Revised by K.C. Ng on 1/23/85, 3/7/85, 4/16/85. +*/ + +double log10 + ( + double x /* value to compute the base-10 logarithm of */ + ) + + { + double log(); + +#if defined(vax)||defined(tahoe) + return(log(x)/ln10hi); +#else /* defined(vax)||defined(tahoe) */ + return(ivln10*log(x)); +#endif /* defined(vax)||defined(tahoe) */ + } diff --git a/libc/math/log1p.c b/libc/math/log1p.c new file mode 100644 index 0000000..68fb469 --- /dev/null +++ b/libc/math/log1p.c @@ -0,0 +1,197 @@ +/* log1p.c - math routines */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,30jul92,kdl marked routine NOMANUAL. +01a,08jul92,smb documentation. +*/ + +/* +* DESCRIPTION +* +* This file includes a support routine (log1p()) which is used by +* other portions of the UCB ANSI C library. +* +* +* Copyright (c) 1985 Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms are permitted +* provided that the above copyright notice and this paragraph are +* duplicated in all such forms and that any documentation, +* advertising materials, and other materials related to such +* distribution and use acknowledge that the software was developed +* by the University of California, Berkeley. The name of the +* University may not be used to endorse or promote products derived +* from this software without specific prior written permission. +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +* +* All recipients should regard themselves as participants in an ongoing +* research project and hence should feel obligated to report their +* experiences (good or bad) with these elementary function codes, using +* the sendbug(8) program, to the authors. +* +* #ifndef lint +* static char sccsid[] = "@(#)log1p.c 5.3 (Berkeley) 6/30/88"; +* #endif * not lint * +* +* SEE ALSO: American National Standard X3.159-1989 +* +* NOMANUAL +* +*/ + +#include "vxWorks.h" +#include "math.h" + +#if defined(vax)||defined(tahoe) /* VAX D format */ +#include +#ifdef vax +#define _0x(A,B) 0x/**/A/**/B +#else /* vax */ +#define _0x(A,B) 0x/**/B/**/A +#endif /* vax */ +/* static double */ +/* ln2hi = 6.9314718055829871446E-1 , Hex 2^ 0 * .B17217F7D00000 */ +/* ln2lo = 1.6465949582897081279E-12 , Hex 2^-39 * .E7BCD5E4F1D9CC */ +/* sqrt2 = 1.4142135623730950622E0 ; Hex 2^ 1 * .B504F333F9DE65 */ +static long ln2hix[] = { _0x(7217,4031), _0x(0000,f7d0)}; +static long ln2lox[] = { _0x(bcd5,2ce7), _0x(d9cc,e4f1)}; +static long sqrt2x[] = { _0x(04f3,40b5), _0x(de65,33f9)}; +#define ln2hi (*(double*)ln2hix) +#define ln2lo (*(double*)ln2lox) +#define sqrt2 (*(double*)sqrt2x) +#else /* defined(vax)||defined(tahoe) */ +static double +ln2hi = 6.9314718036912381649E-1 , /*Hex 2^ -1 * 1.62E42FEE00000 */ +ln2lo = 1.9082149292705877000E-10 , /*Hex 2^-33 * 1.A39EF35793C76 */ +sqrt2 = 1.4142135623730951455E0 ; /*Hex 2^ 0 * 1.6A09E667F3BCD */ +#endif /* defined(vax)||defined(tahoe) */ + +/************************************************************************** +* log1p - +* +* LOG1P(x) +* RETURN THE LOGARITHM OF 1+x +* DOUBLE PRECISION (VAX D FORMAT 56 bits, IEEE DOUBLE 53 BITS) +* CODED IN C BY K.C. NG, 1/19/85; +* REVISED BY K.C. NG on 2/6/85, 3/7/85, 3/24/85, 4/16/85. +* +* Required system supported functions: +* scalb(x,n) +* copysign(x,y) +* logb(x) +* finite(x) +* +* Required kernel function: +* log__L(z) +* +* Method : +* 1. Argument Reduction: find k and f such that +* 1+x = 2^k * (1+f), +* where sqrt(2)/2 < 1+f < sqrt(2) . +* +* 2. Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s) +* = 2s + 2/3 s**3 + 2/5 s**5 + ....., +* log(1+f) is computed by +* +* log(1+f) = 2s + s*log__L(s*s) +* where +* log__L(z) = z*(L1 + z*(L2 + z*(... (L6 + z*L7)...))) +* +* See log__L() for the values of the coefficients. +* +* 3. Finally, log(1+x) = k*ln2 + log(1+f). +* +* Remarks 1. In step 3 n*ln2 will be stored in two floating point numbers +* n*ln2hi + n*ln2lo, where ln2hi is chosen such that the last +* 20 bits (for VAX D format), or the last 21 bits ( for IEEE +* double) is 0. This ensures n*ln2hi is exactly representable. +* 2. In step 1, f may not be representable. A correction term c +* for f is computed. It follows that the correction term for +* f - t (the leading term of log(1+f) in step 2) is c-c*x. We +* add this correction term to n*ln2lo to attenuate the error. +* +* +* Special cases: +* log1p(x) is NaN with signal if x < -1; log1p(NaN) is NaN with no signal; +* log1p(INF) is +INF; log1p(-1) is -INF with signal; +* only log1p(0)=0 is exact for finite argument. +* +* Accuracy: +* log1p(x) returns the exact log(1+x) nearly rounded. In a test run +* with 1,536,000 random arguments on a VAX, the maximum observed +* error was .846 ulps (units in the last place). +* +* Constants: +* The hexadecimal values are the intended ones for the following constants. +* The decimal values may be used, provided that the compiler will convert +* from decimal to binary accurately enough to produce the hexadecimal values +* shown. +* +* NOMANUAL +*/ + +double log1p(x) +double x; +{ + static double zero=0.0, negone= -1.0, one=1.0, + half=1.0/2.0, small=1.0E-20; /* 1+small == 1 */ + double logb(),copysign(),scalb(),log__L(),z,s,t,c; + int k,finite(); + +#if !defined(vax)&&!defined(tahoe) + if(x!=x) return(x); /* x is NaN */ +#endif /* !defined(vax)&&!defined(tahoe) */ + + if(finite(x)) { + if( x > negone ) { + + /* argument reduction */ + if(copysign(x,one)= sqrt2 ) + { k += 1 ; z *= half; t *= half; } + t += negone; x = z + t; + c = (t-x)+z ; /* correction term for x */ + + /* compute log(1+x) */ + s = x/(2+x); t = x*x*half; + c += (k*ln2lo-c*x); + z = c+s*(t+log__L(s*s)); + x += (z - t) ; + + return(k*ln2hi+x); + } + /* end of if (x > negone) */ + + else { +#if defined(vax)||defined(tahoe) + extern double infnan(); + if ( x == negone ) + return (infnan(-ERANGE)); /* -INF */ + else + return (infnan(EDOM)); /* NaN */ +#else /* defined(vax)||defined(tahoe) */ + /* x = -1, return -INF with signal */ + if ( x == negone ) return( negone/zero ); + + /* negative argument for log, return NaN with signal */ + else return ( zero / zero ); +#endif /* defined(vax)||defined(tahoe) */ + } + } + /* end of if (finite(x)) */ + + /* log(-INF) is NaN */ + else if(x<0) + return(zero/zero); + + /* log(+INF) is INF */ + else return(x); +} diff --git a/libc/math/log__L.c b/libc/math/log__L.c new file mode 100644 index 0000000..84d5eca --- /dev/null +++ b/libc/math/log__L.c @@ -0,0 +1,128 @@ +/* log__L.c - math routine */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +* Copyright (c) 1985 Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms are permitted +* provided that the above copyright notice and this paragraph are +* duplicated in all such forms and that any documentation, +* advertising materials, and other materials related to such +* distribution and use acknowledge that the software was developed +* by the University of California, Berkeley. The name of the +* University may not be used to endorse or promote products derived +* from this software without specific prior written permission. +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +* +* All recipients should regard themselves as participants in an ongoing +* research project and hence should feel obligated to report their +* experiences (good or bad) with these elementary function codes, using +* the sendbug(8) program, to the authors. +* +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" + +#if defined(vax)||defined(tahoe) /* VAX D format (56 bits) */ +#ifdef vax +#define _0x(A,B) 0x/**/A/**/B +#else /* vax */ +#define _0x(A,B) 0x/**/B/**/A +#endif /* vax */ +/* static double */ +/* L1 = 6.6666666666666703212E-1 , Hex 2^ 0 * .AAAAAAAAAAAAC5 */ +/* L2 = 3.9999999999970461961E-1 , Hex 2^ -1 * .CCCCCCCCCC2684 */ +/* L3 = 2.8571428579395698188E-1 , Hex 2^ -1 * .92492492F85782 */ +/* L4 = 2.2222221233634724402E-1 , Hex 2^ -2 * .E38E3839B7AF2C */ +/* L5 = 1.8181879517064680057E-1 , Hex 2^ -2 * .BA2EB4CC39655E */ +/* L6 = 1.5382888777946145467E-1 , Hex 2^ -2 * .9D8551E8C5781D */ +/* L7 = 1.3338356561139403517E-1 , Hex 2^ -2 * .8895B3907FCD92 */ +/* L8 = 1.2500000000000000000E-1 , Hex 2^ -2 * .80000000000000 */ +static long L1x[] = { _0x(aaaa,402a), _0x(aac5,aaaa)}; +static long L2x[] = { _0x(cccc,3fcc), _0x(2684,cccc)}; +static long L3x[] = { _0x(4924,3f92), _0x(5782,92f8)}; +static long L4x[] = { _0x(8e38,3f63), _0x(af2c,39b7)}; +static long L5x[] = { _0x(2eb4,3f3a), _0x(655e,cc39)}; +static long L6x[] = { _0x(8551,3f1d), _0x(781d,e8c5)}; +static long L7x[] = { _0x(95b3,3f08), _0x(cd92,907f)}; +static long L8x[] = { _0x(0000,3f00), _0x(0000,0000)}; +#define L1 (*(double*)L1x) +#define L2 (*(double*)L2x) +#define L3 (*(double*)L3x) +#define L4 (*(double*)L4x) +#define L5 (*(double*)L5x) +#define L6 (*(double*)L6x) +#define L7 (*(double*)L7x) +#define L8 (*(double*)L8x) +#else /* defined(vax)||defined(tahoe) */ +static double +L1 = 6.6666666666667340202E-1 , /*Hex 2^ -1 * 1.5555555555592 */ +L2 = 3.9999999999416702146E-1 , /*Hex 2^ -2 * 1.999999997FF24 */ +L3 = 2.8571428742008753154E-1 , /*Hex 2^ -2 * 1.24924941E07B4 */ +L4 = 2.2222198607186277597E-1 , /*Hex 2^ -3 * 1.C71C52150BEA6 */ +L5 = 1.8183562745289935658E-1 , /*Hex 2^ -3 * 1.74663CC94342F */ +L6 = 1.5314087275331442206E-1 , /*Hex 2^ -3 * 1.39A1EC014045B */ +L7 = 1.4795612545334174692E-1 ; /*Hex 2^ -3 * 1.2F039F0085122 */ +#endif /* defined(vax)||defined(tahoe) */ + +/***************************************************************************** +* log__l - +* +* log__L(Z) +* LOG(1+X) - 2S X +* RETURN --------------- WHERE Z = S*S, S = ------- , 0 <= Z <= .0294... +* S 2 + X +* +* DOUBLE PRECISION (VAX D FORMAT 56 bits or IEEE DOUBLE 53 BITS) +* KERNEL FUNCTION FOR LOG; TO BE USED IN LOG1P, LOG, AND POW FUNCTIONS +* CODED IN C BY K.C. NG, 1/19/85; +* REVISED BY K.C. Ng, 2/3/85, 4/16/85. +* +* Method : +* 1. Polynomial approximation: let s = x/(2+x). +* Based on log(1+x) = log(1+s) - log(1-s) +* = 2s + 2/3 s**3 + 2/5 s**5 + ....., +* +* (log(1+x) - 2s)/s is computed by +* +* z*(L1 + z*(L2 + z*(... (L7 + z*L8)...))) +* +* where z=s*s. (See the listing below for Lk's values.) The +* coefficients are obtained by a special Remez algorithm. +* +* Accuracy: +* Assuming no rounding error, the maximum magnitude of the approximation +* error (absolute) is 2**(-58.49) for IEEE double, and 2**(-63.63) +* for VAX D format. +* +* Constants: +* The hexadecimal values are the intended ones for the following constants. +* The decimal values may be used, provided that the compiler will convert +* from decimal to binary accurately enough to produce the hexadecimal values +* shown. +NOMANUAL +*/ + +double log__L(z) +double z; +{ +#if defined(vax)||defined(tahoe) + return(z*(L1+z*(L2+z*(L3+z*(L4+z*(L5+z*(L6+z*(L7+z*L8)))))))); +#else /* defined(vax)||defined(tahoe) */ + return(z*(L1+z*(L2+z*(L3+z*(L4+z*(L5+z*(L6+z*L7))))))); +#endif /* defined(vax)||defined(tahoe) */ +} diff --git a/libc/math/modf.c b/libc/math/modf.c new file mode 100644 index 0000000..2c4c22e --- /dev/null +++ b/libc/math/modf.c @@ -0,0 +1,112 @@ +/* modf.c - separate floating-point number into integer and fraction parts */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,19mar95,dvs removed TRON ifdef - no longer supported. +01i,05feb93,jdi doc changes based on kdl review. +01h,02dec92,jdi doc tweaks. +01g,28oct92,jdi documentation cleanup. +01f,20sep92,smb documentation additions +01e,10sep92,wmd changed dummy function for i960KB from printf to bcopy. +01d,04sep92,wmd restored to rev 1b, instead modified mathP.h using _BYTE_ORDER + conditionals to flip the contents of struct DOUBLE. Added a dummy + printf() in order to force compiler to compile code correctly for i960kb. +01c,03sep92,wmd modified modf() for the i960, word order for DOUBLE is reversed. +01b,25jul92,kdl replaced modf() routine contents with version from floatLib.c; + deleted isnan(), iszero(), isinf(), _d_type(). +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" +#include "stddef.h" +#include "errno.h" +#include "private/mathP.h" + + + +/******************************************************************************* +* +* modf - separate a floating-point number into integer and fraction parts (ANSI) +* +* This routine stores the integer portion of +* in and returns the fractional portion. +* Both parts are double precision and will have the same sign as . +* +* INCLUDE FILES: math.h +* +* RETURNS: The double-precision fractional portion of . +* +* SEE ALSO: frexp(), ldexp() +*/ + +double modf + ( + double value, /* value to split */ + double *pIntPart /* where integer portion is stored */ + ) + { + DOUBLE dat; + FAST int exp; + FAST double fracPart; + FAST double intPart; + int negflag = (value < 0); + + if (negflag) + value = -value; /* make it positive */ + + dat.ddat = value; + + /* Separate the exponent, and change it from biased to 2's comp. */ + exp = ((dat.ldat.l1 & 0x7ff00000) >> 20) - 1023; + +#if CPU==I960KB + bcopy ((char *)&negflag, (char *)&negflag, 0); +#endif /* CPU==I960KB - to force gcc960 to compile correct code for the i960kb */ + + if (exp <= -1) + { + /* If exponent is negative, fracPart == |value|, and intPart == 0. */ + + fracPart = value; + intPart = 0.; + } + + /* clear the fractional part in dat */ + + else if (exp <= 20) + { + dat.ldat.l1 &= (-1 << (20 - exp)); + dat.ldat.l2 = 0; + intPart = dat.ddat; + fracPart = value - intPart; + } + + else if (exp <= 52) + { + dat.ldat.l2 &= (-1 << (52 - exp)); + intPart = dat.ddat; + fracPart = value - intPart; + } + + else + { + fracPart = 0.; + intPart = value; + } + + *pIntPart = (negflag ? -intPart : intPart); + return (negflag ? -fracPart : fracPart); + } + diff --git a/libc/math/pow.c b/libc/math/pow.c new file mode 100644 index 0000000..bb2c108 --- /dev/null +++ b/libc/math/pow.c @@ -0,0 +1,277 @@ +/* pow.c - math routines */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,05feb93,jdi doc changes based on kdl review. +01d,02dec92,jdi doc tweaks. +01c,28oct92,jdi documentation cleanup. +01b,20sep92,smb documentation additions +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +* Copyright (c) 1985 Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms are permitted +* provided that the above copyright notice and this paragraph are +* duplicated in all such forms and that any documentation, +* advertising materials, and other materials related to such +* distribution and use acknowledge that the software was developed +* by the University of California, Berkeley. The name of the +* University may not be used to endorse or promote products derived +* from this software without specific prior written permission. +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +* +* All recipients should regard themselves as participants in an ongoing +* research project and hence should feel obligated to report their +* experiences (good or bad) with these elementary function codes, using +* the sendbug(8) program, to the authors. +* +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" +#include "private/mathP.h" + +#if defined(vax)||defined(tahoe) /* VAX D format */ +#include +extern double infnan(); +#ifdef vax +#define _0x(A,B) 0x/**/A/**/B +#else /* vax */ +#define _0x(A,B) 0x/**/B/**/A +#endif /* vax */ +/* static double */ +/* ln2hi = 6.9314718055829871446E-1 , Hex 2^ 0 * .B17217F7D00000 */ +/* ln2lo = 1.6465949582897081279E-12 , Hex 2^-39 * .E7BCD5E4F1D9CC */ +/* invln2 = 1.4426950408889634148E0 , Hex 2^ 1 * .B8AA3B295C17F1 */ +/* sqrt2 = 1.4142135623730950622E0 ; Hex 2^ 1 * .B504F333F9DE65 */ +static long ln2hix[] = { _0x(7217,4031), _0x(0000,f7d0)}; +static long ln2lox[] = { _0x(bcd5,2ce7), _0x(d9cc,e4f1)}; +static long invln2x[] = { _0x(aa3b,40b8), _0x(17f1,295c)}; +static long sqrt2x[] = { _0x(04f3,40b5), _0x(de65,33f9)}; +#define ln2hi (*(double*)ln2hix) +#define ln2lo (*(double*)ln2lox) +#define invln2 (*(double*)invln2x) +#define sqrt2 (*(double*)sqrt2x) +#else /* defined(vax)||defined(tahoe) */ +static double +ln2hi = 6.9314718036912381649E-1 , /*Hex 2^ -1 * 1.62E42FEE00000 */ +ln2lo = 1.9082149292705877000E-10 , /*Hex 2^-33 * 1.A39EF35793C76 */ +invln2 = 1.4426950408889633870E0 , /*Hex 2^ 0 * 1.71547652B82FE */ +sqrt2 = 1.4142135623730951455E0 ; /*Hex 2^ 0 * 1.6A09E667F3BCD */ +#endif /* defined(vax)||defined(tahoe) */ + +static double zero=0.0, half=1.0/2.0, one=1.0, two=2.0, negone= -1.0; + +/******************************************************************************* +* +* pow - compute the value of a number raised to a specified power (ANSI) +* +* This routine returns to the power of in +* double precision (IEEE double, 53 bits). +* +* A domain error occurs if is negative and is not an integral value. +* A domain error occurs if the result cannot be represented when is zero +* and is less than or equal to zero. A range error may occur. +* +* INTERNAL: +* Method: +* (1) Compute and return log(x) in three pieces: +* +* log(x) = n*ln2 + hi + lo +* +* where is an integer. +* +* (2) Perform y*log(x) by simulating multi-precision arithmetic and +* return the answer in three pieces: +* +* y*log(x) = m*ln2 + hi + lo +* +* where is an integer. +* +* (3) Return: +* +* x**y = exp(y*log(x)) = 2^m * ( exp(hi+lo) ) +* +* INCLUDE FILES: math.h +* +* RETURNS: The double-precision value of to the power of . +* +* Special cases: +* .TS +* tab(|); +* l0 c0 l. +* (anything) ** 0 | is | 1 +* (anything) ** 1 | is | itself +* (anything) ** NaN | is | NaN +* NaN ** (anything except 0) | is | NaN +* +-(anything > 1) ** +INF | is | +INF +* +-(anything > 1) ** -INF | is | +0 +* +-(anything < 1) ** +INF | is | +0 +* +-(anything < 1) ** -INF | is | +INF +* +-1 ** +-INF | is | NaN, signal INVALID +* +0 ** +(anything non-0, NaN) | is | +0 +* -0 ** +(anything non-0, NaN, odd int) | is | +0 +* +0 ** -(anything non-0, NaN) | is | +INF, signal DIV-BY-ZERO +* -0 ** -(anything non-0, NaN, odd int) | is | +INF with signal +* -0 ** (odd integer) | = | -(+0 ** (odd integer)) +* +INF ** +(anything except 0, NaN) | is | +INF +* +INF ** -(anything except 0, NaN) | is | +0 +* -INF ** (odd integer) | = | -(+INF ** (odd integer)) +* -INF ** (even integer) | = | (+INF ** (even integer)) +* -INF ** -(any non-integer, NaN) | is | NaN with signal +* -(x=anything) ** (k=integer) | is | (-1)**k * (x ** k) +* -(anything except 0) ** (non-integer) | is | NaN with signal +* .TE +* +* SEE ALSO: mathALib +* +* INTERNAL: +* Coded in C by K.C. Ng, 1/8/85; +* Revised by K.C. Ng on 7/10/85. +*/ + +double pow + ( + double x, /* operand */ + double y /* exponent */ + ) + + { + double drem(),pow_p(),copysign(),t; + int finite(); + + if (y==zero) return(one); + else if(y==one +#if !defined(vax)&&!defined(tahoe) + ||x!=x +#endif /* !defined(vax)&&!defined(tahoe) */ + ) return( x ); /* if x is NaN or y=1 */ +#if !defined(vax)&&!defined(tahoe) + else if(y!=y) return( y ); /* if y is NaN */ +#endif /* !defined(vax)&&!defined(tahoe) */ + else if(!finite(y)) /* if y is INF */ + if((t=copysign(x,one))==one) return(zero/zero); + else if(t>one) return((y>zero)?y:zero); + else return((yzero)?-x:one/(-x)); + else { /* return NaN */ +#if defined(vax)||defined(tahoe) + return (infnan(EDOM)); /* NaN */ +#else /* defined(vax)||defined(tahoe) */ + return(zero/zero); +#endif /* defined(vax)||defined(tahoe) */ + } + } + +/**************************************************************************** +* +* pow_p - +* +* pow_p(x,y) return x**y for x with sign=1 and finite y * +* +* RETURN: +* NOMANUAL +*/ + +double pow_p(x,y) +double x,y; +{ + double logb(),scalb(),copysign(),log__L(),exp__E(); + double c,s,t,z,tx,ty; +#ifdef tahoe + double tahoe_tmp; +#endif /* tahoe */ + float sx,sy; + long k=0; + int n,m; + + if(x==zero||!finite(x)) { /* if x is +INF or +0 */ +#if defined(vax)||defined(tahoe) + return((y>zero)?x:infnan(ERANGE)); /* if yzero)?x:one/x); +#endif /* defined(vax)||defined(tahoe) */ + } + if(x==1.0) return(x); /* if x=1.0, return 1 since y is finite */ + + /* reduce x to z in [sqrt(1/2)-1, sqrt(2)-1] */ + z=scalb(x,-(n=logb(x))); +#if !defined(vax)&&!defined(tahoe) /* IEEE double; subnormal number */ + if(n <= -1022) {n += (m=logb(z)); z=scalb(z,-m);} +#endif /* !defined(vax)&&!defined(tahoe) */ + if(z >= sqrt2 ) {n += 1; z *= half;} z -= one ; + + /* log(x) = nlog2+log(1+z) ~ nlog2 + t + tx */ + s=z/(two+z); c=z*z*half; tx=s*(c+log__L(s*s)); + t= z-(c-tx); tx += (z-t)-c; + + /* if y*log(x) is neither too big nor too small */ + if((s=logb(y)+logb(n+t)) < 12.0) + if(s>-60.0) { + + /* compute y*log(x) ~ mlog2 + t + c */ + s=y*(n+invln2*t); + m=s+copysign(half,s); /* m := nint(y*log(x)) */ + k=y; + if((double)k==y) { /* if y is an integer */ + k = m-k*n; + sx=t; tx+=(t-sx); } + else { /* if y is not an integer */ + k =m; + tx+=n*ln2lo; + sx=(c=n*ln2hi)+t; tx+=(c-sx)+t; } + /* end of checking whether k==y */ + + sy=y; ty=y-sy; /* y ~ sy + ty */ +#ifdef tahoe + s = (tahoe_tmp = sx)*sy-k*ln2hi; +#else /* tahoe */ + s=(double)sx*sy-k*ln2hi; /* (sy+ty)*(sx+tx)-kln2 */ +#endif /* tahoe */ + z=(tx*ty-k*ln2lo); + tx=tx*sy; ty=sx*ty; + t=ty+z; t+=tx; t+=s; + c= -((((t-s)-tx)-ty)-z); + + /* return exp(y*log(x)) */ + t += exp__E(t,c); return(scalb(one+t,m)); + } + /* end of if log(y*log(x)) > -60.0 */ + + else + /* exp(+- tiny) = 1 with inexact flag */ + {ln2hi+ln2lo; return(one);} + else if(copysign(one,y)*(n+invln2*t) in double precision. +* The angle is expressed in radians. +* +* INCLUDE FILES: math.h +* +* RETURNS: The double-precision sine of . +* +* SEE ALSO: mathALib +*/ + +double sin + ( + double x /* angle in radians */ + ) + + { + double a,c,z; + + if(!finite(x)) /* sin(NaN) and sin(INF) must be NaN */ + return x-x; + x=drem(x,PI2); /* reduce x into [-PI,PI] */ + a=copysign(x,one); + if (a >= PIo4) { + if(a >= PI3o4) /* ... in [3PI/4,PI] */ + x = copysign((a = PI-a),x); + else { /* ... in [PI/4,3PI/4] */ + a = PIo2-a; /* rtn. sign(x)*C(PI/2-|x|) */ + z = a*a; + c = cos__C(z); + z *= half; + a = (z >= thresh ? half-((z-half)-c) : one-(z-c)); + return copysign(a,x); + } + } + + if (a < small) { /* rtn. S(x) */ + big+a; + return x; + } + return x+x*sin__S(x*x); + } + +/******************************************************************************* +* +* cos - compute a cosine (ANSI) +* +* This routine computes the cosine of in double precision. +* The angle is expressed in radians. +* +* INCLUDE FILES: math.h +* +* RETURNS: The double-precision cosine of . +* +* SEE ALSO: mathALib +*/ + +double cos + ( + double x /* angle in radians */ + ) + + { + double a,c,z,s = 1.0; + + if(!finite(x)) /* cos(NaN) and cos(INF) must be NaN */ + return x-x; + x=drem(x,PI2); /* reduce x into [-PI,PI] */ + a=copysign(x,one); + if (a >= PIo4) { + if (a >= PI3o4) { /* ... in [3PI/4,PI] */ + a = PI-a; + s = negone; + } + else { /* ... in [PI/4,3PI/4] */ + a = PIo2-a; + return a+a*sin__S(a*a); /* rtn. S(PI/2-|x|) */ + } + } + if (a < small) { + big+a; + return s; /* rtn. s*C(a) */ + } + z = a*a; + c = cos__C(z); + z *= half; + a = (z >= thresh ? half-((z-half)-c) : one-(z-c)); + return copysign(a,s); + } diff --git a/libc/math/sinh.c b/libc/math/sinh.c new file mode 100644 index 0000000..b635bac --- /dev/null +++ b/libc/math/sinh.c @@ -0,0 +1,129 @@ +/* sinh.c - math routine */ + +/* Copyright 1992-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,09dec94,rhp fix descriptions of hyperbolic fns. +01e,05feb93,jdi doc changes based on kdl review. +01d,02dec92,jdi doc tweaks. +01c,28oct92,jdi documentation cleanup. +01b,20sep92,smb documentation additions +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +* Copyright (c) 1985 Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms are permitted +* provided that the above copyright notice and this paragraph are +* duplicated in all such forms and that any documentation, +* advertising materials, and other materials related to such +* distribution and use acknowledge that the software was developed +* by the University of California, Berkeley. The name of the +* University may not be used to endorse or promote products derived +* from this software without specific prior written permission. +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +* +* All recipients should regard themselves as participants in an ongoing +* research project and hence should feel obligated to report their +* experiences (good or bad) with these elementary function codes, using +* the sendbug(8) program, to the authors. +* +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" + +#if defined(vax)||defined(tahoe) +#ifdef vax +#define _0x(A,B) 0x/**/A/**/B +#else /* vax */ +#define _0x(A,B) 0x/**/B/**/A +#endif /* vax */ +/* static double */ +/* mln2hi = 8.8029691931113054792E1 , Hex 2^ 7 * .B00F33C7E22BDB */ +/* mln2lo = -4.9650192275318476525E-16 , Hex 2^-50 * -.8F1B60279E582A */ +/* lnovfl = 8.8029691931113053016E1 ; Hex 2^ 7 * .B00F33C7E22BDA */ +static long mln2hix[] = { _0x(0f33,43b0), _0x(2bdb,c7e2)}; +static long mln2lox[] = { _0x(1b60,a70f), _0x(582a,279e)}; +static long lnovflx[] = { _0x(0f33,43b0), _0x(2bda,c7e2)}; +#define mln2hi (*(double*)mln2hix) +#define mln2lo (*(double*)mln2lox) +#define lnovfl (*(double*)lnovflx) +#else /* defined(vax)||defined(tahoe) */ +static double +mln2hi = 7.0978271289338397310E2 , /*Hex 2^ 10 * 1.62E42FEFA39EF */ +mln2lo = 2.3747039373786107478E-14 , /*Hex 2^-45 * 1.ABC9E3B39803F */ +lnovfl = 7.0978271289338397310E2 ; /*Hex 2^ 9 * 1.62E42FEFA39EF */ +#endif /* defined(vax)||defined(tahoe) */ + +#if defined(vax)||defined(tahoe) +static max = 126 ; +#else /* defined(vax)||defined(tahoe) */ +static max = 1023 ; +#endif /* defined(vax)||defined(tahoe) */ + +/******************************************************************************* +* +* sinh - compute a hyperbolic sine (ANSI) +* +* This routine returns the hyperbolic sine of in +* double precision (IEEE double, 53 bits). +* +* A range error occurs if is too large. +* +* INTERNAL: +* Method: +* +* (1) Reduce to non-negative by sinh(-x) = - sinh(x). +* +* (2) +* expm1(x) + expm1(x)/(expm1(x)+1) +* 0 <= x <= lnovfl : sinh(x) := -------------------------------- +* 2 +* lnovfl <= x <= lnovfl+ln2 : sinh(x) := expm1(x)/2 (avoid overflow) +* lnovfl+ln2 < x < INF : overflow to INF +* +* INCLUDE FILES: math.h +* +* RETURNS: +* The double-precision hyperbolic sine of . +* +* Special cases: +* If is +INF, -INF, or NaN, sinh() returns . +* +* SEE ALSO: mathALib +*/ + +double sinh + ( + double x /* number whose hyperbolic sine is required */ + ) + + { + static double one=1.0, half=1.0/2.0 ; + double expm1(), t, scalb(), copysign(), sign; +#if !defined(vax)&&!defined(tahoe) + if(x!=x) return(x); /* x is NaN */ +#endif /* !defined(vax)&&!defined(tahoe) */ + sign=copysign(one,x); + x=copysign(x,one); + if(x in double +* precision. A domain error occurs if the argument is negative. +* +* INCLUDE FILES: math.h +* +* RETURNS: The double-precision square root of . +* +* ERROR: EDOM +* +* SEE ALSO: mathALib +*/ + +double sqrt + ( + double x /* value to compute the square root of */ + ) + + { + double q,s,b,r; + double t,zero=0.0; + int m,n,i; + +#if defined(vax)||defined(tahoe) + int k=54; +#else /* defined(vax)||defined(tahoe) */ + int k=51; +#endif /* defined(vax)||defined(tahoe) */ + + /* Select hardware/software square root */ +#if (CPU_FAMILY == SPARC) || (CPU_FAMILY == SPARCV9) + extern BOOL sparcHardSqrt; + + if (sparcHardSqrt == TRUE) + { + double sqrtHw(); + + return (sqrtHw (x)); + } +#endif /* (CPU_FAMILY == SPARC) */ + + /* sqrt(NaN) is NaN, sqrt(+-0) = +-0 */ + if(x!=x||x==zero) return(x); + + /* sqrt(negative) is invalid */ + if(x1.0) t=1; /* b>1 : Round-to-(+INF) */ + if(t>=0) q+=r; } /* else: Round-to-nearest */ + else { + s *= 2; x *= 4; + t = (x-s)-1; + b=1.0+3*r/4; if(b==1.0) goto end; + b=1.0+r/4; if(b>1.0) t=1; + if(t>=0) q+=r; } + +end: return(scalb(q,n)); + } diff --git a/libc/math/support.c b/libc/math/support.c new file mode 100644 index 0000000..f9bd5e4 --- /dev/null +++ b/libc/math/support.c @@ -0,0 +1,325 @@ +/* support.c - math routines */ + +/* Copyright 1991-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01j,03oct01,to use IEEE little endian for ARM +01i,20apr01,h_k fixed P_INDEX for ARM big_endian. +01h,11jan99,dra removed non-ANSI aliasing code. +01g,12feb97,jpd added support for ARM with early Cygnus release. +01f,23sep92,kdl removed define of sparcHardSqrt (now in sqrt.c). +01e,23sep92,kdl removed sqrt(), placed in sqrt.c. +01d,20sep92,smb documentation additions. +01c,08jul92,smb merged with ANSI and documentation. + set EDOM in sqrt(). +01b,02jul92,jwt changed sysHardSqrt to sparcHardSqrt; removed warnings. +01a,25jun91,jwt created sqrt() function select - hard versus soft. +*/ + +/* +DESCRIPTION +* Copyright (c) 1985 Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms are permitted +* provided that the above copyright notice and this paragraph are +* duplicated in all such forms and that any documentation, +* advertising materials, and other materials related to such +* distribution and use acknowledge that the software was developed +* by the University of California, Berkeley. The name of the +* University may not be used to endorse or promote products derived +* from this software without specific prior written permission. +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +* +* All recipients should regard themselves as participants in an ongoing +* research project and hence should feel obligated to report their +* experiences (good or bad) with these elementary function codes, using +* the sendbug(8) program, to the authors. +* +* Some IEEE standard 754 recommended functions and remainder and sqrt for +* supporting the C elementary functions. +****************************************************************************** +* WARNING: +* These codes are developed (in double) to support the C elementary +* functions temporarily. They are not universal, and some of them are very +* slow (in particular, drem and sqrt is extremely inefficient). Each +* computer system should have its implementation of these functions using +* its own assembler. +****************************************************************************** +* +* IEEE 754 required operations: +* drem(x,p) +* returns x REM y = x - [x/y]*y , where [x/y] is the integer +* nearest x/y; in half way case, choose the even one. +* sqrt(x) +* returns the square root of x correctly rounded according to +* the rounding mod. +* +* IEEE 754 recommended functions: +* (a) copysign(x,y) +* returns x with the sign of y. +* (b) scalb(x,N) +* returns x * (2**N), for integer values N. +* (c) logb(x) +* returns the unbiased exponent of x, a signed integer in +* double precision, except that logb(0) is -INF, logb(INF) +* is +INF, and logb(NAN) is that NAN. +* (d) finite(x) +* returns the value TRUE if -INF < x < +INF and returns +* FALSE otherwise. +* +* +* CODED IN C BY K.C. NG, 11/25/84; +* REVISED BY K.C. NG on 1/22/85, 2/13/85, 3/24/85. +* +* 25jun91,jwt created sqrt() function select - hard versus soft +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" +#include "private/mathP.h" +#include "errno.h" + +#if (_BYTE_ORDER == _LITTLE_ENDIAN) +#define P_INDEX 3 +#else /* little_endian */ +#define P_INDEX 0 +#endif /* little_endian */ + +typedef union + { + unsigned short s[4]; + double d; + } tdouble; + +#if defined(vax)||defined(tahoe) /* VAX D format */ +#include + static unsigned short msign=0x7fff , mexp =0x7f80 ; + static short prep1=57, gap=7, bias=129 ; + static double novf=1.7E38, nunf=3.0E-39, zero=0.0 ; +#else /* defined(vax)||defined(tahoe) */ + static unsigned short msign=0x7fff, mexp =0x7ff0 ; + static short prep1=54, gap=4, bias=1023 ; + static double novf=1.7E308, nunf=3.0E-308,zero=0.0; +#endif /* defined(vax)||defined(tahoe) */ + +/***************************************************************************** +* scalb - +* +* RETURN: +* NOMANUAL +*/ + +double scalb(x,N) +double x; int N; +{ + int k; + double scalb(); + tdouble y; + + y.d = x; + if( y.d == zero ) + return(y.d); + +#if defined(vax)||defined(tahoe) + if( (k= y.s[P_INDEX] & mexp ) != ~msign ) + { + if (N < -260) + return(nunf*nunf); + else if (N > 260) { + extern double infnan(),copysign(); + return(copysign(infnan(ERANGE),y.d)); + } +#else /* defined(vax)||defined(tahoe) */ + if( (k= y.s[P_INDEX] & mexp ) != mexp ) + { + if( N<-2100) + return(nunf*nunf); + else if(N>2100) + return(novf+novf); + if( k == 0 ) + { + y.d *= scalb(1.0,(int)prep1); + N -= prep1; + return(scalb(y.d,N)); + } +#endif /* defined(vax)||defined(tahoe) */ + + if((k = (k>>gap)+ N) > 0 ) + if( k < (mexp>>gap) ) + y.s[P_INDEX] = (y.s[P_INDEX]&~mexp) | (k< -prep1 ) + /* gradual underflow */ + { + y.s[P_INDEX]=(y.s[P_INDEX]&~mexp)|(short)(1<>gap)-bias); +#else /* defined(vax)||defined(tahoe) */ + if( (k= a.s[P_INDEX] & mexp ) != mexp ) + if ( k != 0 ) + return ( (k>>gap) - bias ); + else if( a.d != zero) + return ( -1022.0 ); + else + return(-(1.0/zero)); + else if(a.d != a.d) + return(a.d); + else + {a.s[P_INDEX] &= msign; return(a.d);} +#endif /* defined(vax)||defined(tahoe) */ +} + +/***************************************************************************** +* finite - the finite value for this machine +* +* RETURN: +* NOMANUAL +*/ + +int finite(x) +double x; +{ + tdouble a; + a.d = x; +#if defined(vax)||defined(tahoe) + return(1); +#else /* defined(vax)||defined(tahoe) */ + return( ( a.s[P_INDEX] & mexp ) != mexp ); +#endif /* defined(vax)||defined(tahoe) */ +} + +/***************************************************************************** +* drem - remainder +* +* RETURN: +* NOMANUAL +*/ + +double drem(x,p) +double x,p; +{ + short sign; + double hp, drem(),scalb(); + tdouble tmp, xd, pd, dp; + unsigned short k; + + xd.d = x; + pd.d = p; + + pd.s[P_INDEX] &= msign; + +#if defined(vax)||defined(tahoe) + if( ( xd.s[P_INDEX] & mexp ) == ~msign ) /* is x a reserved operand? */ +#else /* defined(vax)||defined(tahoe) */ + if( ( xd.s[P_INDEX] & mexp ) == mexp ) +#endif /* defined(vax)||defined(tahoe) */ + return (xd.d-pd.d)-(xd.d-pd.d); /* create nan if x is inf */ + if (pd.d == zero) { +#if defined(vax)||defined(tahoe) + extern double infnan(); + return(infnan(EDOM)); +#else /* defined(vax)||defined(tahoe) */ + return zero/zero; +#endif /* defined(vax)||defined(tahoe) */ + } + +#if defined(vax)||defined(tahoe) + if( ( pd.s[P_INDEX] & mexp ) == ~msign ) /* is p a reserved operand? */ +#else /* defined(vax)||defined(tahoe) */ + if( ( pd.s[P_INDEX] & mexp ) == mexp ) +#endif /* defined(vax)||defined(tahoe) */ + { if (pd.d != pd.d) return pd.d; else return xd.d;} + + else if ( ((pd.s[P_INDEX] & mexp)>>gap) <= 1 ) + /* subnormal p, or almost subnormal p */ + { double b; b=scalb(1.0,(int)prep1); + pd.d *= b; xd.d = drem(xd.d,pd.d); xd.d *= b; return(drem(xd.d,pd.d)/b);} + else if ( pd.d >= novf/2) + { pd.d /= 2 ; xd.d /= 2; return(drem(xd.d,pd.d)*2);} + else + { + dp.d=pd.d+pd.d; + hp=pd.d/2; + sign= xd.s[P_INDEX] & ~msign ; + xd.s[P_INDEX] &= msign ; + while ( xd.d > dp.d ) + { + k=(xd.s[P_INDEX] & mexp) - (dp.s[P_INDEX] & mexp) ; + tmp.d = dp.d ; + tmp.s[P_INDEX] += k ; + +#if defined(vax)||defined(tahoe) + if( xd.d < tmp.d ) tmp.s[P_INDEX] -= 128 ; +#else /* defined(vax)||defined(tahoe) */ + if( xd.d < tmp.d ) tmp.s[P_INDEX] -= 16 ; +#endif /* defined(vax)||defined(tahoe) */ + + xd.d -= tmp.d ; + } + if ( xd.d > hp ) + { xd.d -= pd.d ; if ( xd.d >= hp ) xd.d -= pd.d ; } + +#if defined(vax)||defined(tahoe) + if (xd.d) +#endif /* defined(vax)||defined(tahoe) */ + xd.s[P_INDEX] ^= sign; + return( xd.d); + + } +} + diff --git a/libc/math/tan.c b/libc/math/tan.c new file mode 100644 index 0000000..543550f --- /dev/null +++ b/libc/math/tan.c @@ -0,0 +1,97 @@ +/* tan.c - math routines */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,05feb93,jdi doc changes based on kdl review. +01e,02dec92,jdi doc tweaks. +01d,28oct92,jdi documentation cleanup. +01c,21sep92,smb changed function header for mg. +01b,20sep92,smb documentation additions +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +* Copyright (c) 1987 Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms are permitted +* provided that the above copyright notice and this paragraph are +* duplicated in all such forms and that any documentation, +* advertising materials, and other materials related to such +* distribution and use acknowledge that the software was developed +* by the University of California, Berkeley. The name of the +* University may not be used to endorse or promote products derived +* from this software without specific prior written permission. +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +* +* All recipients should regard themselves as participants in an ongoing +* research project and hence should feel obligated to report their +* experiences (good or bad) with these elementary function codes, using +* the sendbug(8) program, to the authors. +* +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" +#include "private/trigP.h" + +/******************************************************************************* +* +* tan - compute a tangent (ANSI) +* +* This routine computes the tangent of in double precision. +* The angle is expressed in radians. +* +* INCLUDE FILES: math.h +* +* RETURNS: The double-precision tangent of . +* +* SEE ALSO: mathALib +*/ + +double tan + ( + double x /* angle in radians */ + ) + + { + double a,z,ss,cc,c; + int k; + + if(!finite(x)) /* tan(NaN) and tan(INF) must be NaN */ + return x-x; + x = drem(x,PI); /* reduce x into [-PI/2, PI/2] */ + a = copysign(x,one); /* ... = abs(x) */ + if (a >= PIo4) { + k = 1; + x = copysign(PIo2-a,x); + } + else { + k = 0; + if (a < small) { + big+a; + return x; + } + } + z = x*x; + cc = cos__C(z); + ss = sin__S(z); + z *= half; /* Next get c = cos(x) accurately */ + c = (z >= thresh ? half-((z-half)-cc) : one-(z-cc)); + if (k == 0) + return x+(x*(z-(cc-ss)))/c; /* ... sin/cos */ +#ifdef national + else if (x == zero) + return copysign(fmax,x); /* no inf on 32k */ +#endif /* national */ + else + return c/(x+x*ss); /* ... cos/sin */ + } diff --git a/libc/math/tanh.c b/libc/math/tanh.c new file mode 100644 index 0000000..5024cb7 --- /dev/null +++ b/libc/math/tanh.c @@ -0,0 +1,115 @@ +/* tanh.c - math routines */ + +/* Copyright 1992-1994 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,09dec94,rhp fix man pages for hyperbolic fns. +01e,05feb93,jdi doc changes based on kdl review. +01d,02dec92,jdi doc tweaks. +01c,28oct92,jdi documentation cleanup. +01b,20sep92,smb documentation additions +01a,08jul92,smb documentation. +*/ + +/* +DESCRIPTION +* Copyright (c) 1985 Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms are permitted +* provided that the above copyright notice and this paragraph are +* duplicated in all such forms and that any documentation, +* advertising materials, and other materials related to such +* distribution and use acknowledge that the software was developed +* by the University of California, Berkeley. The name of the +* University may not be used to endorse or promote products derived +* from this software without specific prior written permission. +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +* +* All recipients should regard themselves as participants in an ongoing +* research project and hence should feel obligated to report their +* experiences (good or bad) with these elementary function codes, using +* the sendbug(8) program, to the authors. +* +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL +*/ + +#include "vxWorks.h" +#include "math.h" + +/******************************************************************************* +* +* tanh - compute a hyperbolic tangent (ANSI) +* +* This routine returns the hyperbolic tangent of in +* double precision (IEEE double, 53 bits). +* +* INTERNAL: +* Method: +* +* (1) Reduce to non-negative by: +* +* tanh(-x) = - tanh(x) +* +* (2) +* 0 < x <= 1.e-10 : tanh(x) := x +* +* -expm1(-2x) +* 1.e-10 < x <= 1 : tanh(x) := -------------- +* expm1(-2x) + 2 +* +* 2 +* 1 <= x <= 22.0 : tanh(x) := 1 - --------------- +* expm1(2x) + 2 +* 22.0 < x <= INF : tanh(x) := 1. +* +* Note: 22 was chosen so that fl(1.0+2/(expm1(2*22)+2)) == 1. +* +* INCLUDE FILES: math.h +* +* RETURNS: +* The double-precision hyperbolic tangent of . +* +* Special cases: +* If is NaN, tanh() returns NaN. +* +* SEE ALSO: mathALib +* +* INTERNAL: +* Coded in C by K.C. Ng, 1/8/85; +* Revised by K.C. Ng on 2/8/85, 2/11/85, 3/7/85, 3/24/85. +*/ + +double tanh + ( + double x /* number whose hyperbolic tangent is required */ + ) + + { + static double one=1.0, two=2.0, small = 1.0e-10, big = 1.0e10; + double expm1(), t, copysign(), sign; + int finite(); + +#if !defined(vax)&&!defined(tahoe) + if(x!=x) return(x); /* x is NaN */ +#endif /* !defined(vax)&&!defined(tahoe) */ + + sign=copysign(one,x); + x=copysign(x,one); + if(x < 22.0) + if( x > one ) + return(copysign(one-two/(expm1(x+x)+two),sign)); + else if ( x > small ) + {t= -expm1(-(x+x)); return(copysign(t/(two-t),sign));} + else /* raise the INEXACT flag for non-zero x */ + {big+x; return(copysign(x,sign));} + else if(finite(x)) + return (sign+1.0E-37); /* raise the INEXACT flag */ + else + return(sign); /* x is +- INF */ + } diff --git a/libc/setjmp/Makefile b/libc/setjmp/Makefile new file mode 100644 index 0000000..4b2c0ae --- /dev/null +++ b/libc/setjmp/Makefile @@ -0,0 +1,22 @@ +# Makefile - makefile for vw/src/libc/setjmp +# +# modification history +# -------------------- +# 01b,12oct01,tam added repackaging support +# 01a,18jun96,yp created from 01b of MakeSkel +# +# DESCRIPTION +# This file contains the makefile rules for building the vx library +# +#*/ + +TGT_DIR=$(WIND_BASE)/target + +LIB_BASE_NAME = os + +DOC_FILES= ansiSetjmp.c + +OBJS= longjmp.o + +include $(TGT_DIR)/h/make/rules.library + diff --git a/libc/setjmp/ansiSetjmp.c b/libc/setjmp/ansiSetjmp.c new file mode 100644 index 0000000..4c37c0f --- /dev/null +++ b/libc/setjmp/ansiSetjmp.c @@ -0,0 +1,115 @@ +/* ansiSetjmp.c - ANSI 'setjmp' documentation */ + +/* Copyright 1984-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,27oct95,jdi doc: setjmp() no longer a macro (SPR 5300). +01d,27feb95,rhp updated and reconciled with longjmp.c comments +01c,16feb95,jdi doc style change. +01b,18jan95,rhp describe ISR restrictions (SPR#3277) +01a,24oct92,smb written. +*/ + +/* +DESCRIPTION +The header setjmp.h defines functions and +one type for bypassing the normal function call and return discipline. + +The type declared is: +.iP `jmp_buf' 12 +an array type suitable for holding the information needed to restore +a calling environment. +.LP + +The ANSI C standard does not specify whether setjmp() is a subroutine +or a macro. + +SEE ALSO: American National Standard X3.159-1989 +*/ + +/******************************************************************************* +* +* setjmp - save the calling environment in a `jmp_buf' argument (ANSI) +* +* This routine saves the calling environment in , in order to permit +* a longjmp() call to restore that environment (thus performing a +* non-local goto). +* +* .SS "Constraints on Calling Environment" +* The setjmp() routine may only be used in the following +* contexts: +* .iP +* as the entire controlling expression of a selection or iteration statement; +* .iP +* as one operand of a relational or equality operator, in the +* controlling expression of a selection or iteration statement; +* .iP +* as the operand of a single-argument `!' operator, in the controlling +* expression of a selection or iteration statement; or +* .iP +* as a complete C statement statement containing nothing other than +* the setjmp() call (though the result may be cast to `void'). +* +* RETURNS +* From a direct invocation, setjmp() returns zero. From a call +* to longjmp(), it returns a non-zero value specified as an argument +* to longjmp(). +* +* SEE ALSO +* longjmp() +*/ + +int setjmp + ( + jmp_buf env + ) + + { + } + +/******************************************************************************* +* +* longjmp - perform non-local goto by restoring saved environment (ANSI) +* +* This routine restores the environment saved by the most recent +* invocation of the setjmp() routine that used the same `jmp_buf' +* specified in the argument . The restored environment includes +* the program counter, thus transferring control to the setjmp() +* caller. +* +* If there was no corresponding setjmp() call, or if the function +* containing the corresponding setjmp() routine call has already +* returned, the behavior of longjmp() is unpredictable. +* +* All accessible objects in memory retain their values as of the time +* longjmp() was called, with one exception: local objects on the C +* stack that are not declared `volatile', and have been changed +* between the setjmp() invocation and the longjmp() call, have +* unpredictable values. +* +* The longjmp() function executes correctly in contexts of signal +* handlers and any of their associated functions (but not from interrupt +* handlers). +* +* WARNING: Do not use longjmp() or setjmp() from an ISR. +* +* RETURNS: +* This routine does not return to its caller. +* Instead, it causes setjmp() to return , unless is 0; in +* that case setjmp() returns 1. +* +* SEE ALSO +* setjmp() +*/ + +void longjmp + ( + jmp_buf env, + int val + ) + + { + } + diff --git a/libc/setjmp/longjmp.c b/libc/setjmp/longjmp.c new file mode 100644 index 0000000..0ea350d --- /dev/null +++ b/libc/setjmp/longjmp.c @@ -0,0 +1,118 @@ +/* longjmp.c - non local goto function */ + +/* Copyright 1984-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,27dec95,mem restored use of longjmp for VxSim hppa. +01e,27oct95,jdi doc: setjmp() no longer a macro (SPR 5300). +01d,27feb95,rhp reconcile comments with ansiSetjmp.c documentation +01c,12may94,ms removed longjmp for VxSIm hppa (use macro instead). +01b,20sep92,smb documentation additions +01a,31aug92,rrr written. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: setjmp.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "setjmp.h" +#include "private/sigLibP.h" +#include "taskLib.h" + +#define JMP_DATA(env) ((int *) \ + (((char *)env) + sizeof(jmp_buf) - 2*sizeof(int))) + +/******************************************************************************* +* +* _setjmpSetup - portable part of setjmp +* +* RETURNS: Nothing. +* +* NOMANUAL +*/ +void _setjmpSetup + ( + jmp_buf env, + int val + ) + { + int *p; + + p = JMP_DATA(env); + + p[0] = (int)taskIdCurrent; + + if (val) + { + p[0] |= 1; + p[1] = (taskIdCurrent->pSignalInfo == NULL) ? + 0 : taskIdCurrent->pSignalInfo->sigt_blocked; + } + } + +/******************************************************************************* +* +* longjmp - perform non-local goto (ANSI) +* +* longjmp - perform non-local goto by restoring saved environment (ANSI) +* +* This routine restores the environment saved by the most recent +* invocation of the setjmp() routine that used the same `jmp_buf' +* specified in the argument . The restored environment includes +* the program counter, thus transferring control to the setjmp() +* caller. +* +* If there was no corresponding setjmp() call, or if the function +* containing the corresponding setjmp() routine call has already +* returned, the behavior of longjmp() is unpredictable. +* +* All accessible objects in memory retain their values as of the time +* longjmp() was called, with one exception: local objects on the C +* stack that are not declared `volatile', and have been changed +* between the setjmp() invocation and the longjmp() call, have +* unpredictable values. +* +* The longjmp() function executes correctly in contexts of signal +* handlers and any of their associated functions (but not from interrupt +* handlers). +* +* WARNING: Do not use longjmp() or setjmp() from an ISR. +* +* RETURNS: +* This routine does not return to its caller. +* Instead, it causes setjmp() to return , unless is 0; in +* that case setjmp() returns 1. +* +* SEE ALSO +* setjmp() +* +* SEE ALSO: setjmp() +*/ +void longjmp + ( + jmp_buf env, + int val + ) + { + int *p; + + p = JMP_DATA(env); + + if ((p[0] & ~1) != (int)taskIdCurrent) + taskSuspend(0); + + if ((p[0] & 1) && (_func_sigprocmask != NULL)) + _func_sigprocmask(SIG_SETMASK, &p[1], 0); + + _sigCtxRtnValSet((REG_SET *)env, val == 0 ? 1 : val); + _sigCtxLoad((REG_SET *)env); + } diff --git a/libc/stdarg/Makefile b/libc/stdarg/Makefile new file mode 100644 index 0000000..060c855 --- /dev/null +++ b/libc/stdarg/Makefile @@ -0,0 +1,22 @@ +# Makefile - makefile for vw/src/libc/stdarg +# +# modification history +# -------------------- +# 01b,12oct01,tam added repackaging support +# 01a,18jun96,yp created from 10a of MakeSkel +# +# DESCRIPTION +# This file contains the makefile rules for building the vx library +# +#*/ + +TGT_DIR=$(WIND_BASE)/target + +LIB_BASE_NAME = os + +DOC_FILES= ansiStdarg.c + +OBJS= + +include $(TGT_DIR)/h/make/rules.library + diff --git a/libc/stdarg/ansiStdarg.c b/libc/stdarg/ansiStdarg.c new file mode 100644 index 0000000..6e1f828 --- /dev/null +++ b/libc/stdarg/ansiStdarg.c @@ -0,0 +1,126 @@ +/* ansiStdarg.c - ANSI `stdarg' documentation */ + +/* Copyright 1984-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,16mar93,jdi documentation cleanup for 5.1. +01a,24oct92,smb written. +*/ + +/* +DESCRIPTION +The header stdarg.h declares a type and defines three macros for advancing +through a list of arguments whose number and types are not known to the +called function when it is translated. + +A function may be called with a variable number of arguments of varying types. +The rightmost parameter plays a special role in the access mechanism, and +is designated in this description. + +The type declared is: +.iP `va_list' 12 +a type suitable for holding information needed by the macros +va_start(), va_arg(), and va_end(). +.LP + +To access the varying arguments, the called function shall declare an object +having type `va_list'. The object (referred to here as ) may be +passed as an argument to another function; if that function invokes the +va_arg() macro with parameter , the value of in the calling +function is indeterminate and is passed to the va_end() macro prior +to any further reference to . + +va_start() and va_arg() have been implemented as macros, not as +functions. The va_start() and va_end() macros should be invoked in the +function accepting a varying number of arguments, if access to the varying +arguments is desired. + +The use of these macros is documented here as if they were architecture-generic. +However, depending on the compilation environment, different macro versions are +included by vxWorks.h. + +SEE ALSO: American National Standard X3.159-1989 +*/ + +/******************************************************************************* +* +* va_start - initialize a `va_list' object for use by va_arg() and va_end() +* +* This macro initializes an object of type `va_list' () for subsequent +* use by va_arg() and va_end(). The parameter is the identifier of +* the rightmost parameter in the variable parameter list in the function +* definition (the one just before the , ...). If is declared with +* the register storage class with a function or array type, or with a type +* that is not compatible with the type that results after application of the +* default argument promotions, the behavior is undefined. +* +* RETURNS: N/A +*/ + +void va_start + ( + ap, /* list of type va_list */ + parmN /* rightmost parameter */ + ) + + { + /* dummy function for documenation purposes */ + } + +/******************************************************************************* +* +* va_arg - expand to an expression having the type and value of the call's next argument +* +* Each invocation of this macro modifies an object of type `va_list' () +* so that the values of successive arguments are returned in turn. The +* parameter is a type name specified such that the type of a pointer +* to an object that has the specified type can be obtained simply by +* postfixing a * to . If there is no actual next argument, or if +* is not compatible with the type of the actual next argument (as +* promoted according to the default argument promotions), the behavior is +* undefined. +* +* RETURNS: +* The first invocation of va_arg() after va_start() returns the value of the +* argument after that specified by (the rightmost parameter). +* Successive invocations return the value of the remaining arguments in +* succession. +*/ + +void va_arg + ( + ap, /* list of type va_list */ + type /* type */ + ) + + { + /* dummy function for documenation purposes */ + } + +/******************************************************************************* +* +* va_end - facilitate a normal return from a routine using a `va_list' object +* +* This macro facilitates a normal return from the function whose variable +* argument list was referred to by the expansion of va_start() that +* initialized the `va_list' object. +* +* va_end() may modify the `va_list' object so that it is no longer +* usable (without an intervening invocation of va_start()). If there is no +* corresponding invocation of the va_start() macro, or if the va_end() macro +* is not invoked before the return, the behavior is undefined. +* +* RETURNS: N/A +*/ + +void va_end + ( + ap /* list of type va_list */ + ) + + { + /* dummy function for documenation purposes */ + } + diff --git a/libc/stdio/Makefile b/libc/stdio/Makefile new file mode 100644 index 0000000..abfb898 --- /dev/null +++ b/libc/stdio/Makefile @@ -0,0 +1,39 @@ +# Makefile - makefile for vw/src/libc/stdio +# +# modification history +# -------------------- +# 01b,12oct01,tam added repackaging support +# 01a,18jun96,yp created from 01d of MakeSkel +# +# DESCRIPTION +# This file contains the makefile rules for building the vx library +# +#*/ + +TGT_DIR=$(WIND_BASE)/target + +LIB_BASE_NAME = os + +DOC_FILES= ansiStdio.c + +## ansiStdio.c includes the following files +# clearerr.c fclose.c fdopen.c feof.c ferror.c fflush.c +# fgetc.c fgetpos.c fgets.c fileno.c fopen.c fprintf.c +# fputc.c fputs.c fread.c freopen.c fscanf.c fseek.c +# fsetpos.c ftell.c fvwrite.c fwrite.c getc.c getchar.c +# gets.c getw.c perror.c putc.c putchar.c puts.c putw.c +# rewind.c scanf.c setbuf.c setbuffer.c setvbuf.c stdioLib.c +# stdioShow.c tmpfile.c tmpnam.c ungetc.c vfprintf.c + + +OBJS= clearerr.o fclose.o fdopen.o feof.o ferror.o fflush.o fgetc.o \ + fgetpos.o fgets.o fileno.o flags.o fopen.o fprintf.o \ + fputc.o fputs.o fread.o freopen.o fscanf.o fseek.o fsetpos.o \ + ftell.o fvwrite.o fwrite.o getc.o getchar.o gets.o getw.o \ + makebuf.o perror.o putc.o putchar.o putw.o puts.o refill.o \ + rewind.o rget.o scanf.o setbuf.o setbuffer.o setvbuf.o \ + stdio.o stdioLib.o stdioShow.o tmpnam.o tmpfile.o ungetc.o \ + wbuf.o wsetup.o vfprintf.o + +include $(TGT_DIR)/h/make/rules.library + diff --git a/libc/stdio/ansiStdio.c b/libc/stdio/ansiStdio.c new file mode 100644 index 0000000..0833d0b --- /dev/null +++ b/libc/stdio/ansiStdio.c @@ -0,0 +1,5467 @@ +/* ansiStdio.c - ANSI `stdio' documentation */ + +/* Copyright 1984-2002 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01j,21jan02,jkf SPR#72774, fread is checking for NULL on wrong arg +01i,12dec01,jkf fixing SPR#72128, fread should check for NULL before bcopy. +01h,11nov01,jkf SPR#70967, fread() returns wrong value when 3rd arg == 0 +01g,17mar99,jdi doc: updated w/ info about proj facility (SPR 25727). +01f,04feb99,dgp document errno values +01e,10feb95,jdi doc format tweak in fopen() and update for rhp changes in 01d. +01d,24jan95,rhp doc: avoid 'L' in fprintf() and fscanf(), no long doubles + in VxWorks (see SPR#3886) +01c,19jul94,dvs doc tweak (SPR #2512) +01b,05mar93,jdi documentation cleanup for 5.1. +01a,24oct92,smb created. +*/ + +/* +DESCRIPTION +The header stdio.h declares three types, several macros, and many functions +for performing input and output. +.SS Types +The types declared are `size_t' and: +.iP `FILE' 12 +object type capable of recording all the information needed to +control a stream, including its file position indicator, a pointer to its +associated buffer (if any), an error indicator that records whether a +read/write error has occurred, and an end-of-file indicator that records +whether the end of the file has been reached. +.iP `fpos_t' +object type capable of recording all the information needed to +specify uniquely every position within a file. +.SS Macros +The macros are NULL and: +.iP "_IOFBF, _IOLBF, _IONBF" 12 3 +expand to integral constant expressions with distinct values, suitable +for use as the third argument to setvbuf(). +.iP BUFSIZ +expands to an integral constant expression that is the size of the +buffer used by setbuf(). +.iP EOF +expands to a negative integral constant expression that is returned by +several functions to indicate `end-of-file', that is, no more input from a +stream. +.iP FOPEN_MAX +expands to an integral constant expression that is the minimum number of +the files that the system guarantees can be open simultaneously. +.iP FILENAME_MAX +expands to an integral constant expression that is the size needed for an +array of `char' large enough to hold the longest file name string that +can be used. +.iP L_tmpnam +expands to an integral constant expression that is the size needed for +an array of `char' large enough to hold a temporary file name string +generated by tmpnam(). +.iP "SEEK_CUR, SEEK_END, SEEK_SET" +expand to integral constant expressions with distinct values suitable +for use as the third argument to fseek(). +.iP TMP_MAX +expands to an integral constant expression that is the minimum number of +file names generated by tmpnam() that will be unique. +.iP "`stderr', `stdin', `stdout'" +expressions of type "pointer to FILE" that point to the FILE objects +associated, respectively, with the standard error, input, and output streams. + +STREAMS +Input and output, whether to or from physical devices such as terminals and +tape drives, or whether to or from files supported on structured storage +devices, are mapped into logical data streams, whose properties are more +uniform than their various inputs and outputs. Two forms of mapping are +supported: for text streams and for binary streams. + +A text stream is an ordered sequence of characters composed into lines, +each line consisting of zero or more characters plus a terminating new-line +character. Characters may have to be added, altered, or deleted +on input and output to conform to differing conventions for representing +text in the host environment. Thus, there is no need for a one-to-one +correspondence between the characters in a stream and those in the external +representation. Data read in from a text stream will necessarily compare +equal to the data that were earlier written out to that stream only if: +the data consists only of printable characters and the control characters +horizontal tab and new-line; no new-line character is immediately preceded +by space characters; and the last character is a new-line character. +Space characters are written out immediately before a new-line character +appears. + +A binary stream is an ordered sequence of characters that can transparently +record internal data. Data read in from a binary stream should compare +equal to the data that was earlier written out to that stream, under the +same implementation. However, such a stream may have a +number of null characters appended to the end of the stream. +.SS "Environmental Limits" +VxWorks supports text files with lines containing at least 254 characters, +including the terminating new-line character. The value of the macro +BUFSIZ is 1024. + +FILES +A stream is associated with an external file (which may be a physical +device) by opening a file, which may involve creating a new file. +Creating an existing file causes its former contents to be discarded, if +necessary. If a file can support positioning requests (such as a disk +file, as opposed to a terminal), then a file position indicator associated +with the stream is positioned at the start (character number zero) of the +file. The file position indicator is maintained by subsequent reads, +writes, and positioning requests, to facilitate an orderly progression +through the file. All input takes place as if characters were read by +successive calls to fgetc(); all output takes place as if characters were +written by successive calls to fputc(). + +Binary files are not truncated, except as defined in fopen() documentation. + +When a stream is unbuffered, characters are intended to appear from the +source or at the destination as soon as possible. Otherwise characters +may be accumulated and transmitted to or from the host environment as a +block. When a stream is fully buffered, characters are intended to be +transmitted to or from the host environment as a block when the buffer is +filled. When a stream is line buffered, characters are intended to be +transmitted to or from the host environment as a block when a new-line +character is encountered. Furthermore, characters are intended to be +transmitted as a block to the host environment when a buffer is filled, +when input is requested on an unbuffered stream, or when input is requested on +a line-buffered stream that requires the transmission of characters from +the host environment. VxWorks supports these characteristics via the +setbuf() and setvbuf() functions. + +A file may be disassociated from a controlling stream by closing the file. +Output streams are flushed (any unwritten buffer contents are transmitted +to the host environment) before the stream is disassociated from the file. +The value of a pointer to a FILE object is indeterminate after the associated +file is closed (including the standard text streams). + +The file may be subsequently reopened, by the same or another program +execution, and its contents reclaimed or modified (if it can be repositioned +at its start). + +TASK TERMINATION +ANSI specifies that if the main function returns to its original caller or +if exit() is called, all open files are closed (and hence all output +streams are flushed) before program termination. This does \f3not\fP +happen in VxWorks. The exit() function does not close all files opened +for that task. A file opened by one task may be used and closed by another. +Unlike in UNIX, when a VxWorks task exits, it is the responsibility of the +task to fclose() its file pointers, except `stdin', `stdout', and +`stderr'. If a task is to be terminated asynchronously, use kill() and +arrange for a signal handler to clean up. + +The address of the FILE object used to control a stream may be significant; +a copy of a FILE object may not necessarily serve in place of the original. + +At program startup, three text streams are predefined and need not be opened +explicitly: standard input (for reading conventional input), standard output +(for writing conventional output), and standard error (for writing diagnostic +output). When opened, the standard error stream is not fully buffered; the +standard input and standard output streams are fully buffered if and only if +the stream can be determined not to refer to an interactive device. + +Functions that open additional (non-temporary) files require a file name, +which is a string. VxWorks allows the same file to be open multiple times +simultaneously. It is up to the user to maintain synchronization between +different tasks accessing the same file. + +FIOLIB +Several routines normally considered part of standard I/O -- printf(), +sprintf(), vprintf(), vsprintf(), and sscanf() -- are not implemented as part +of the buffered standard I/O library; they are +instead implemented in fioLib. They do not use the standard I/O buffering +scheme. They are self-contained, formatted, but unbuffered I/O +functions. This allows a limited amount of formatted I/O to be achieved +without the overhead of the standard I/O library. + +SEE ALSO: +fioLib, +.I "American National Standard for Information Systems -" +.I "Programming Language - C, ANSI X3.159-1989: Input/Output (stdio.h) + +INTERNAL +This documentation module is built by appending the following files: + + clearerr.c + fclose.c + fdopen.c + feof.c + ferror.c + fflush.c + fgetc.c + fgetpos.c + fgets.c + fileno.c + fopen.c + fprintf.c + fputc.c + fputs.c + fread.c + freopen.c + fscanf.c + fseek.c + fsetpos.c + ftell.c + fwrite.c + getc.c + getchar.c + gets.c + getw.c + perror.c + putc.c + putchar.c + puts.c + putw.c + rewind.c + scanf.c + setbuf.c + setbuffer.c + setvbuf.c + stdioLib.c + stdioShow.c + tmpfile.c + tmpnam.c + ungetc.c + vfprintf.c +*/ + +/* clearerr.c - clear error file for stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,05mar93,jdi documentation cleanup for 5.1. +01c,21sep92,smb corrected first line of file. +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION +* Copyright (c) 1990 The Regents of the University of California. +* All rights reserved. +* +* This code is derived from software contributed to Berkeley by +* Chris Torek. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* 1. Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* 2. Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* 3. All advertising materials mentioning features or use of this software +* must display the following acknowledgement: +* This product includes software developed by the University of +* California, Berkeley and its contributors. +* 4. Neither the name of the University nor the names of its contributors +* may be used to endorse or promote products derived from this software +* without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +* SUCH DAMAGE. +* +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" + +#undef clearerr + +/****************************************************************************** +* +* clearerr - clear end-of-file and error flags for a stream (ANSI) +* +* This routine clears the end-of-file and error flags for a specified stream. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: N/A +* +* SEE ALSO: feof(), ferror() +*/ + +void clearerr + ( + FILE * fp /* stream to clear EOF and ERROR flags for */ + ) + { + __sclearerr(fp); + } +/* fclose.c - close file stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf added OBJ_VERIFY and memory reclaimation. + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, stdlib.h, error.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "errno.h" +#include "stdlib.h" +#include "objLib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* fclose - close a stream (ANSI) +* +* This routine flushes a specified stream and closes the associated file. +* Any unwritten buffered data is delivered to the host environment to be +* written to the file; any unread buffered data is discarded. The stream +* is disassociated from the file. If the associated buffer was allocated +* automatically, it is deallocated. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* Zero if the stream is closed successfully, or EOF if errors occur. +* +* ERRNO: EBADF +* +* SEE ALSO: fflush() +*/ + +int fclose + ( + FAST FILE * fp /* stream to close */ + ) + { + FAST int r; + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (EOF); + + if (fp->_flags == 0) /* not open! */ + { + errno = EBADF; + return (EOF); + } + + r = (fp->_flags & __SWR) ? (__sflush(fp)) : (0); + + if (__sclose (fp) < 0) + r = EOF; + + if (fp->_flags & __SMBF) + free ((char *)fp->_bf._base); + + if (HASUB(fp)) /* ungetc buffer? */ + FREEUB(fp); + + if (HASLB(fp)) /* fgetline buffer? */ + FREELB(fp); + + fp->_flags = 0; /* release this FILE for reuse */ + stdioFpDestroy (fp); /* destroy the file pointer */ + + return (r); + } +/* fdopen.c - open file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,07jul93,jmm fixed fdopen to validate the fd (spr 2197) +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: sys/types.h, fcntl.h, unistd.h, stdio.h, errno.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "sys/types.h" +#include "fcntl.h" +#include "unistd.h" +#include "errno.h" +#include "objLib.h" +#include "iosLib.h" +#include "private/stdioP.h" + + +/******************************************************************************* +* +* fdopen - open a file specified by a file descriptor (POSIX) +* +* This routine opens the file specified by the file descriptor and +* associates a stream with it. +* The argument is used just as in the fopen() function. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: A pointer to a stream, or a null pointer if an error occurs, +* with `errno' set to indicate the error. +* +* ERRNO: EINVAL +* +* SEE ALSO: fopen(), freopen(), +* .br +* .I "Information Technology - POSIX - Part 1:" +* .I "System API [C Language], IEEE Std 1003.1" +*/ + +FILE * fdopen + ( + int fd, /* file descriptor */ + const char * mode /* mode to open with */ + ) + { + FAST FILE * fp; + int flags; + int oflags; + + /* validate the file descriptor */ + + if (iosFdValue (fd) == ERROR) + return (NULL); + + if ((flags = __sflags(mode, &oflags)) == 0) + return (NULL); + + /* Make sure the mode the user wants is a subset of the actual mode. */ + +#if FALSE /* XXX */ + if ((fdflags = fcntl(fd, F_GETFL, 0)) < 0) + return (NULL); + + tmp = fdflags & O_ACCMODE; + + if (tmp != O_RDWR && (tmp != (oflags & O_ACCMODE))) + { + errno = EINVAL; + return (NULL); + } +#endif + + if ((fp = stdioFpCreate()) == NULL) + return (NULL); + + fp->_flags = flags; + + /* + * If opened for appending, but underlying descriptor does not have + * O_APPEND bit set, assert __SAPP so that __swrite() will lseek to + * end before each write. + */ + + if ((oflags & O_APPEND) /* XXX && !(fdflags & O_APPEND) */ ) + fp->_flags |= __SAPP; + + fp->_file = fd; + + return (fp); + } +/* feof.c - end of file indicator function. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,05mar93,jdi documentation cleanup for 5.1. +01c,21sep92,smb tweaks for mg +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" + +#undef feof + +/****************************************************************************** +* +* feof - test the end-of-file indicator for a stream (ANSI) +* +* This routine tests the end-of-file indicator for a specified stream. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* Non-zero if the end-of-file indicator is set for . +* +* SEE ALSO: clearerr() +*/ + +int feof + ( + FILE * fp /* stream to test */ + ) + { + return (__sfeof(fp)); + } +/* ferror.c - file error indicator function for stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" + +#undef ferror + +/****************************************************************************** +* +* ferror - test the error indicator for a file pointer (ANSI) +* +* This routine tests the error indicator for the stream pointed to by . +* +* INCLUDE FILES: stdio.h +* +* RETURNS: Non-zero if the error indicator is set for . +* +* SEE ALSO: clearerr() +*/ + +int ferror + ( + FILE * fp /* stream to test */ + ) + { + return (__sferror(fp)); + } +/* fflush.c - flush file stdio.h */ + +/* Copyright 1992-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,20jan95,ism changed FIOFLUSH to FIOSYNC +01d,03oct94,ism added FIOFLUSH ioctl to __sflush() as per SPR#2548 +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, error.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "errno.h" +#include "objLib.h" +#include "private/stdioP.h" +#include "sys/ioctl.h" +#include "ioLib.h" + +/****************************************************************************** +* +* fflush - flush a stream (ANSI) +* +* This routine writes to the file any unwritten data for a specified output +* or update stream for which the most recent operation was not input; for an +* input stream the behavior is undefined. +* +* CAVEAT +* ANSI specifies that if is a null pointer, fflush() performs the +* flushing action on all streams for which the behavior is defined; however, +* this is not implemented in VxWorks. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: Zero, or EOF if a write error occurs. +* +* ERRNO: EBADF +* +* SEE ALSO: fclose() +*/ + +int fflush + ( + FAST FILE * fp /* stream to flush */ + ) + { + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (EOF); + + /* ANSI specifies that fflush (NULL) will flush all task's file pointers. + * The problem is that we don't keep such a list today so we return EOF + * for now. + */ + + if ((fp == NULL) || + ((fp->_flags & __SWR) == 0)) + { + errno = EBADF; + return (EOF); + } + + return (__sflush(fp)); + } + +/****************************************************************************** +* +* __sflush - flush stream pointed to by fp. +* +* INCLUDE: stdio.h +* +* RETURNS: ZERO or EOF +* NOMANUAL +*/ + +int __sflush + ( + FAST FILE *fp + ) + { + FAST unsigned char *p; + FAST int n; + FAST int t; + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (EOF); + + t = fp->_flags; + + if ((t & __SWR) == 0) + return (0); + + if ((p = fp->_bf._base) == NULL) + return (0); + + n = fp->_p - p; /* write this much */ + + /* Set these immediately to avoid problems with longjmp and to allow + * exchange buffering (via setvbuf) in user write function. + */ + + fp->_p = p; + fp->_w = (t & (__SLBF|__SNBF)) ? (0) : (fp->_bf._size); + + for (; n > 0; n -= t, p += t) + { + t = __swrite (fp, (char *)p, n); + if (t <= 0) + { + fp->_flags |= __SERR; + return (EOF); + } + } + + (void)ioctl(fileno(fp), FIOSYNC, 0); + + return (0); + } +/* fgetc.c - get character from file -- stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +------------------- +01d,05mar93,jdi documentation cleanup for 5.1. +01c,13oct92,jdi mangen fixes. +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "private/stdioP.h" + +/****************************************************************************** +* +* fgetc - return the next character from a stream (ANSI) +* +* This routine returns the next character (converted to an `int') from the +* specified stream, and advances the file position indicator for the stream. +* +* If the stream is at end-of-file, the end-of-file indicator for the stream is +* set; if a read error occurs, the error indicator is set. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The next character from the stream, or EOF if the stream is at end-of-file +* or a read error occurs. +* +* SEE ALSO: fgets(), getc() +*/ + +int fgetc + ( + FILE * fp /* stream to read from */ + ) + { + return (getc(fp)); + } +/* fgetpos.c - get position in file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "objLib.h" + + +/****************************************************************************** +* +* fgetpos - store the current value of the file position indicator for a stream (ANSI) +* +* This routine stores the current value of the file position indicator for a +* specified stream in the object pointed to by . The value stored +* contains unspecified information usable by fsetpos() for repositioning +* the stream to its position at the time fgetpos() was called. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* Zero, or non-zero if unsuccessful, with `errno' set to indicate the error. +* +* SEE ALSO: fsetpos() +*/ + +int fgetpos + ( + FILE * fp, /* stream */ + fpos_t * pos /* where to store position */ + ) + { + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (ERROR); + + return (!((*pos = ftell (fp)) != (fpos_t) -1)); + } +/* fgets.c - Read lines of text from a stream. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "string.h" +#include "objLib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* fgets - read a specified number of characters from a stream (ANSI) +* +* This routine stores in the array up to -1 characters from a +* specified stream. No additional characters are read after a new-line or +* end-of-line. A null character is written immediately after the last +* character read into the array. +* +* If end-of-file is encountered and no characters have been read, the +* contents of the array remain unchanged. If a read error occurs, the array +* contents are indeterminate. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* A pointer to , or a null pointer if an error occurs or end-of-file is +* encountered and no characters have been read. +* +* SEE ALSO: fread(), fgetc() +*/ + +char * fgets + ( + char * buf, /* where to store characters */ + FAST size_t n, /* no. of bytes to read + 1 */ + FAST FILE * fp /* stream to read from */ + ) + { + FAST size_t len; + FAST char * s; + FAST uchar_t * p; + FAST uchar_t * t; + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (NULL); + + if (n < 2) /* sanity check */ + return (NULL); + + s = buf; + n--; /* leave space for NULL */ + + do + { + if ((len = fp->_r) <= 0) /* If the buffer is empty, refill it */ + { + if (__srefill(fp)) /* EOF/error: partial or no line */ + { + if (s == buf) + return (NULL); + break; + } + len = fp->_r; + } + + p = fp->_p; + + /* + * Scan through at most n bytes of the current buffer, + * looking for '\n'. If found, copy up to and including + * newline, and stop. Otherwise, copy entire chunk + * and loop. + */ + + if (len > n) + len = n; + + t = memchr ((void *)p, '\n', len); + + if (t != NULL) + { + len = ++t - p; + fp->_r -= len; + fp->_p = t; + (void) bcopy ((void *)p, (void *)s, len); + s[len] = 0; + + return (buf); + } + + fp->_r -= len; + fp->_p += len; + + (void) bcopy ((void *)p, (void *)s, len); + + s += len; + + } while ((n -= len) != 0); + + *s = 0; + + return (buf); + } +/* fileno.c - determine file number for stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "objLib.h" +#include "private/stdioP.h" + +#undef fileno + +/****************************************************************************** +* +* fileno - return the file descriptor for a stream (POSIX) +* +* This routine returns the file descriptor associated with a specified +* stream. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The file descriptor, or -1 if an error occurs, with `errno' set to indicate +* the error. +* +* SEE ALSO: +* .br +* .I "Information Technology - POSIX - Part 1:" +* .I "System API [C Language], IEEE Std 1003.1" +*/ + +int fileno + ( + FILE * fp /* stream */ + ) + { + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (ERROR); + + return (__sfileno(fp)); + } +/* fopen.c - open a file. stdio.h */ + +/* Copyright 1992-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,10feb95,jdi doc format tweak. +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf modified to use stdioFpCreate and close memory leaks. + smb taken from UCB stdio. +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, error.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "sys/types.h" +#include "sys/stat.h" +#include "ioLib.h" +#include "fcntl.h" +#include "errno.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* fopen - open a file specified by name (ANSI) +* +* This routine opens a file whose name is the string pointed to by +* and associates a stream with it. +* The argument points to a string beginning with one of the following +* sequences: +* .iP r "" 3 +* open text file for reading +* .iP w +* truncate to zero length or create text file for writing +* .iP a +* append; open or create text file for writing at end-of-file +* .iP rb +* open binary file for reading +* .iP wb +* truncate to zero length or create binary file for writing +* .iP ab +* append; open or create binary file for writing at end-of-file +* .iP r+ +* open text file for update (reading and writing) +* .iP w+ +* truncate to zero length or create text file for update. +* .iP a+ +* append; open or create text file for update, writing at end-of-file +* .iP "r+b / rb+" +* open binary file for update (reading and writing) +* .iP "w+b / wb+" +* truncate to zero length or create binary file for update +* .iP "a+b / ab+" +* append; open or create binary file for update, writing at end-of-file +* .LP +* +* Opening a file with read mode (`r' as the first character in the +* argument) fails if the file does not exist or cannot be read. +* +* Opening a file with append mode (`a' as the first character in the +* argument) causes all subsequent writes to the file to be forced to the +* then current end-of-file, regardless of intervening calls to fseek(). In +* some implementations, opening a binary file with append mode (`b' as the +* second or third character in the argument) may initially position +* the file position indicator for the stream beyond the last data written, +* because of null character padding. In VxWorks, whether append mode is +* supported is device-specific. +* +* When a file is opened with update mode (`+' as the second or third +* character in the argument), both input and output may be performed +* on the associated stream. However, output may not be directly followed by +* input without an intervening call to fflush() or to a file positioning +* function (fseek(), fsetpos(), or rewind()), and input may not be directly +* followed by output without an intervening call to a file positioning +* function, unless the input operation encounters end-of-file. Opening (or +* creating) a text file with update mode may instead open (or create) a +* binary stream in some implementations. +* +* When opened, a stream is fully buffered if and only if it can be determined +* not to refer to an interactive device. The error and end-of-file +* indicators for the stream are cleared. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* A pointer to the object controlling the stream, or a null pointer if the +* operation fails. +* +* SEE ALSO: fdopen(), freopen() +*/ + +FILE * fopen + ( + const char * file, /* name of file */ + const char * mode /* mode */ + ) + { + FAST FILE * fp; + FAST int f; + int flags; + int oflags; + + if ((flags = __sflags (mode, &oflags)) == 0) + return (NULL); + + if ((fp = stdioFpCreate ()) == NULL) + return (NULL); + + if ((f = open (file, oflags, DEFFILEMODE )) < 0) + { + fp->_flags = 0x0; /* release */ + stdioFpDestroy (fp); /* destroy file pointer */ + return (NULL); + } + + fp->_file = f; + fp->_flags = flags; + + /* + * When opening in append mode, even though we use O_APPEND, + * we need to seek to the end so that ftell() gets the right + * answer. If the user then alters the seek pointer, or + * the file extends, this will fail, but there is not much + * we can do about this. (We could set __SAPP and check in + * fseek and ftell.) + */ + + if (oflags & O_APPEND) + (void) __sseek ((void *)fp, (fpos_t)0, SEEK_END); + + return (fp); + } +/* fprintf.c - print to a file. stdio.h */ + +/* Copyright 1992-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,24jan95,rhp doc: avoid 'L' in fprintf(), no long doubles + in VxWorks (see SPR#3886) +01d,19jul94,dvs doc tweak (SPR #2512). +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, stdarg.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdarg.h" +#include "fioLib.h" +#include "objLib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* fprintf - write a formatted string to a stream (ANSI) +* +* This routine writes output to a specified stream under control of the string +* . The string contains ordinary characters, which are written +* unchanged, plus conversion specifications, which cause the arguments that +* follow to be converted and printed as part of the formatted string. +* +* The number of arguments for the format is arbitrary, but they must +* correspond to the conversion specifications in . If there are +* insufficient arguments, the behavior is undefined. If the format is +* exhausted while arguments remain, the excess arguments are evaluated but +* otherwise ignored. The routine returns when the end of the format string +* is encountered. +* +* The format is a multibyte character sequence, beginning and ending in its +* initial shift state. The format is composed of zero or more directives: +* ordinary multibyte characters (not `%') that are copied unchanged to the +* output stream; and conversion specification, each of which results in +* fetching zero or more subsequent arguments. Each conversion specification +* is introduced by the `%' character. After the `%', the following appear in +* sequence: +* .iP "" 4 +* Zero or more flags (in any order) that modify the meaning of the +* conversion specification. +* .iP +* An optional minimum field width. If the converted value has fewer +* characters than the field width, it will be padded with spaces (by +* default) on the left (or right, if the left adjustment flag, +* described later, has been given) to the field width. The field +* width takes the form of an asterisk (`*') (described later) or a decimal +* integer. +* .iP +* An optional precision that gives the minimum number of digits to +* appear for the `d', `i', `o', `u', `x', and `X' conversions, the number of +* digits to appear after the decimal-point character for `e', `E', and `f' +* conversions, the maximum number of significant digits for the `g' and +* `G' conversions, or the maximum number of characters to be written +* from a string in the `s' conversion. The precision takes the form of a +* period (`.') followed either by an asterisk (`*') (described later) or by +* an optional decimal integer; if only the period is specified, the +* precision is taken as zero. If a precision appears with any other +* conversion specifier, the behavior is undefined. +* .iP +* An optional `h' specifying that a following `d', `i', `o', `u', `x', and +* `X' conversion specifier applies to a `short int' or `unsigned short int' +* argument (the argument will have been promoted according to the integral +* promotions, and its value converted to `short int' or +* `unsigned short int' before printing); an optional `h' specifying that a +* following `n' conversion specifier applies to a pointer to a `short int' +* argument; an optional `l' (el) specifying that a following `d', `i', `o', +* `u', `x', and `X' conversion specifier applies to a `long int' or +* `unsigned long int' argument; or an optional `l' specifying that a following +* `n' conversion specifier applies to a pointer to a `long int' +* argument. If an `h' or `l' appears with any other conversion +* specifier, the behavior is undefined. +* +* \&WARNING: ANSI C also specifies an optional `L' in some of the same +* contexts as `l' above, corresponding to a `long double' argument. +* However, the current release of the VxWorks libraries does not support +* `long double' data; using the optional `L' gives unpredictable results. +* .iP +* A character that specifies the type of conversion to be applied. +* .LP +* +* As noted above, a field width, or precision, or both, can be indicated by +* an asterisk (`*'). In this case, an `int' argument supplies the field width +* or precision. The arguments specifying field width, or precision, or both, +* should appear (in that order) before the argument (if any) to be converted. +* A negative field width argument is taken as a `-' flag followed by a positive +* field width. A negative precision argument is taken as if the precision +* were omitted. +* +* The flag characters and their meanings are: +* .iP `-' +* The result of the conversion will be left-justified within the field. +* (it will be right-justified if this flag is not specified.) +* .iP `+' +* The result of a signed conversion will always begin with a plus or +* minus sign. (It will begin with a sign only when a negative value +* is converted if this flag is not specified.) +* .iP `space' +* If the first character of a signed conversion is not a sign, or +* if a signed conversion results in no characters, a space will be +* prefixed to the result. If the `space' and `+' flags both appear, the +* `space' flag will be ignored. +* .iP `#' +* The result is to be converted to an "alternate form." For `o' conversion +* it increases the precision to force the first digit of the result to be a +* zero. For `x' (or `X') conversion, a non-zero result will have "0x" (or +* "0X") prefixed to it. For `e', `E', `f', `g', and `G' conversions, the +* result will always contain a decimal-point character, even if no digits +* follow it. (Normally, a decimal-point character appears in the result of +* these conversions only if no digit follows it). For `g' and `G' +* conversions, trailing zeros will not be removed from the result. For +* other conversions, the behavior is undefined. +* .iP `0' +* For `d', `i', `o', `u', `x', `X', `e', `E', `f', `g', and `G' conversions, +* leading zeros (following any indication of sign or base) are used to pad +* to the field width; no space padding is performed. If the `0' and `-' +* flags both appear, the `0' flag will be ignored. For `d', `i', `o', `u', +* `x', and `X' conversions, if a precision is specified, the `0' flag will +* be ignored. For other conversions, the behavior is undefined. +* .LP +* +* The conversion specifiers and their meanings are: +* .iP "`d', `i'" +* The `int' argument is converted to signed decimal in the style +* `[-]dddd'. The precision specifies the minimum number of digits +* to appear; if the value being converted can be represented in +* fewer digits, it will be expanded with leading zeros. The +* default precision is 1. The result of converting a zero value +* with a precision of zero is no characters. +* .iP "`o', `u', `x', `X'" +* The `unsigned int' argument is converted to unsigned octal (`o'), +* unsigned decimal (`u'), or unsigned hexadecimal notation (`x' or `X') +* in the style `dddd'; the letters abcdef are used for `x' conversion +* and the letters ABCDEF for `X' conversion. The precision specifies +* the minimum number of digits to appear; if the value being +* converted can be represented in fewer digits, it will be +* expanded with leading zeros. The default precision is 1. The +* result of converting a zero value with a precision of zero is +* no characters. +* .iP `f' +* The `double' argument is converted to decimal notation in the +* style `[-]ddd.ddd', where the number of digits after the decimal +* point character is equal to the precision specification. If the +* precision is missing, it is taken as 6; if the precision is zero +* and the `#' flag is not specified, no decimal-point character +* appears. If a decimal-point character appears, at least one +* digit appears before it. The value is rounded to the appropriate +* number of digits. +* .iP "`e', `E'" +* The `double' argument is converted in the style `[-]d.ddde+/-dd', +* where there is one digit before the decimal-point character +* (which is non-zero if the argument is non-zero) and the number +* of digits after it is equal to the precision; if the precision +* is missing, it is taken as 6; if the precision is zero and the +* `#' flag is not specified, no decimal-point character appears. The +* value is rounded to the appropriate number of digits. The `E' +* conversion specifier will produce a number with `E' instead of `e' +* introducing the exponent. The exponent always contains at least +* two digits. If the value is zero, the exponent is zero. +* .iP "`g', `G'" +* The `double' argument is converted in style `f' or `e' (or in style +* `E' in the case of a `G' conversion specifier), with the precision +* specifying the number of significant digits. If the precision +* is zero, it is taken as 1. The style used depends on the +* value converted; style `e' (or `E') will be used only if the +* exponent resulting from such a conversion is less than -4 or +* greater than or equal to the precision. Trailing zeros are +* removed from the fractional portion of the result; a decimal-point +* character appears only if it is followed by a digit. +* .iP `c' +* The `int' argument is converted to an `unsigned char', and the +* resulting character is written. +* .iP `s' +* The argument should be a pointer to an array of character type. +* Characters from the array are written up to (but not including) +* a terminating null character; if the precision is specified, +* no more than that many characters are written. If the precision +* is not specified or is greater than the size of the array, the +* array will contain a null character. +* .iP `p' +* The argument should be a pointer to `void'. The value of the +* pointer is converted to a sequence of printable characters, +* in hexadecimal representation (prefixed with "0x"). +* .iP `n' +* The argument should be a pointer to an integer into which +* the number of characters written to the output stream +* so far by this call to fprintf() is written. No argument is converted. +* .iP `%' +* A `%' is written. No argument is converted. The complete +* conversion specification is %%. +* .LP +* +* If a conversion specification is invalid, the behavior is undefined. +* +* If any argument is, or points to, a union or an aggregate (except for an +* array of character type using `s' conversion, or a pointer using `p' +* conversion), the behavior is undefined. +* +* In no case does a non-existent or small field width cause truncation of a +* field if the result of a conversion is wider than the field width, the +* field is expanded to contain the conversion result. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The number of characters written, or a negative value if an +* output error occurs. +* +* SEE ALSO: printf() +*/ + +int fprintf + ( + FILE * fp, /* stream to write to */ + const char * fmt, /* format string */ + ... /* optional arguments to format string */ + ) + { + int ret; + va_list vaList; + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (ERROR); + + va_start (vaList, fmt); + + ret = vfprintf (fp, fmt, vaList); + + va_end (vaList); + + return (ret); + } +/* fputc.c - put a character to a file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* fputc - write a character to a stream (ANSI) +* +* This routine writes a character to a specified stream, at the +* position indicated by the stream's file position indicator +* (if defined), and advances the indicator appropriately. +* +* If the file cannot support positioning requests, or if the stream was opened +* in append mode, the character is appended to the output stream. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The character written, or EOF if a write error occurs, with the error +* indicator set for the stream. +* +* SEE ALSO: fputs(), putc() +*/ + +int fputc + ( + int c, /* character to write */ + FAST FILE * fp /* stream to write to */ + ) + { + return (putc (c, fp)); + } +/* fputs.c - put a string of characters to a file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "string.h" +#include "objLib.h" +#include "private/fvwriteP.h" + + +/****************************************************************************** +* +* fputs - write a string to a stream (ANSI) +* +* This routine writes the string , minus the terminating NULL character, +* to a specified stream. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* A non-negative value, or EOF if a write error occurs. +* +* SEE ALSO: fputc() +*/ + +int fputs + ( + const char * s, /* string */ + FILE * fp /* stream to write to */ + ) + { + struct __suio uio; + struct __siov iov; + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (EOF); + + iov.iov_base = (void *)s; + iov.iov_len = uio.uio_resid = strlen (s); + uio.uio_iov = &iov; + uio.uio_iovcnt = 1; + + return (__sfvwrite (fp, &uio)); + } + +/* fread.c - read a file. stdio.h */ + +/* Copyright 1992-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,21jan02,jkf SPR#72774, fread is checking for NULL on wrong arg +01e,12dec01,jkf fixing SPR#72128, fread should check for NULL before bcopy +01d,10nov01,jkf SPR#70967, fread returns wrong value when 3rd arg == 0 +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "string.h" +#include "objLib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* fread - read data into an array (ANSI) +* +* This routine reads, into the array , up to elements of size +* , from a specified stream . The file position indicator for the +* stream (if defined) is advanced by the number of characters successfully +* read. If an error occurs, the resulting value of the file position +* indicator for the stream is indeterminate. If a partial element is read, +* its value is indeterminate. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The number of elements successfully read, which may be less than +* if a read error or end-of-file is encountered; or zero if or +* is zero, with the contents of the array and the state of the +* stream remaining unchanged. +*/ + +int fread + ( + void * buf, /* where to copy data */ + size_t size, /* element size */ + size_t count, /* no. of elements */ + FAST FILE * fp /* stream to read from */ + ) + { + FAST size_t resid; + FAST char * p; + FAST int r; + size_t total; + + /* SPR#72128, check for NULL args before bcopy */ + + if ((NULL == fp) || (NULL == buf)) + { + return (0); + } + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (0); + + /* + * SPR#70967: fread returns wrong value when 3rd arg == 0 + * + * ANSI specification declares fread() returns zero if size + * _or_ count is zero. But the vxWorks implementation returned + * non-zero given the following input case: + * + * fread ( buf , 0 ,1 ,fp ); + * + * Old (broken) code: + * + * if ((resid = (count * size)) == 0) + * return (count); + * + * New (fixed) code: + * + * if (0 == (resid = (count * size))) + * return (0); + */ + + if (0 == (resid = (count * size))) + return (0); + + if (fp->_r < 0) + fp->_r = 0; + + total = resid; + p = buf; + + while (resid > (r = fp->_r)) + { + (void) bcopy ((void *)fp->_p, (void *)p, (size_t)r); + + fp->_p += r; + p += r; + resid -= r; + + if (__srefill (fp)) /* fp->_r = 0 is done */ + return ((total - resid) / size); /* partial result */ + } + + (void) bcopy ((void *)fp->_p, (void *)p, resid); + + fp->_r -= resid; + fp->_p += resid; + + return (count); + } + +/* freopen.c - reopen a file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf added memory reclaimation. + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, sys/types.h, sys/stat.h, fcntl.h, error.h, unistd.h, + stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "ioLib.h" +#include "sys/types.h" +#include "sys/stat.h" +#include "fcntl.h" +#include "errno.h" +#include "unistd.h" +#include "stdlib.h" +#include "objLib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* freopen - open a file specified by name (ANSI) +* +* This routine opens a file whose name is the string pointed to by +* and associates it with a specified stream . +* The argument is used just as in the fopen() function. +* +* This routine first attempts to close any file that is associated +* with the specified stream. Failure to close the file successfully is +* ignored. The error and end-of-file indicators for the stream are cleared. +* +* Typically, freopen() is used to attach the already-open streams +* `stdin', `stdout', and `stderr' to other files. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The value of , or a null pointer if the open operation fails. +* +* SEE ALSO: fopen() +*/ + +FILE * freopen + ( + const char * file, /* name of file */ + const char * mode, /* mode */ + FAST FILE * fp /* stream */ + ) + { + FAST int f; + int flags; + int oflags; + int sverrno; + BOOL isopen = TRUE; /* its already open */ + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (NULL); + + if ((flags = __sflags (mode, &oflags)) == 0) + { + (void) fclose (fp); + return (NULL); + } + + /* + * There are actually programs that depend on being able to "freopen" + * descriptors that weren't originally open. Keep this from breaking. + * Remember whether the stream was open to begin with, and which file + * descriptor (if any) was associated with it. If it was attached to + * a descriptor, defer closing it; freopen("/dev/stdin", "r", stdin) + * should work. This is unnecessary if it was not a Unix file. + */ + + if (fp->_flags & __SWR) /* flush the stream though */ + (void) __sflush(fp); /* ANSI doesn't require this */ + + if (fp->_file < 0) /* need to close the fp? */ + { + (void) __sclose (fp); + isopen = FALSE; + } + + /* Get a new descriptor to refer to the new file. */ + + f = open (file, oflags, DEFFILEMODE); + + if ((f < 0) && isopen) + { + /* If out of fd's close the old one and try again. */ + + if ((errno == ENFILE) || (errno == EMFILE)) + { + (void) __sclose (fp); + isopen = FALSE; + f = open (file, oflags, DEFFILEMODE); + } + } + + sverrno = errno; + + /* + * Finish closing fp. Even if the open succeeded above, we cannot + * keep fp->_base: it may be the wrong size. This loses the effect + * of any setbuffer calls, but stdio has always done this before. + */ + + if (isopen) + (void) __sclose (fp); + + if (fp->_flags & __SMBF) + free ((char *)fp->_bf._base); + + fp->_w = 0; + fp->_r = 0; + fp->_p = NULL; + fp->_bf._base = NULL; + fp->_bf._size = 0; + fp->_lbfsize = 0; + + if (HASUB(fp)) + FREEUB(fp); + + fp->_ub._size = 0; + + if (HASLB(fp)) + FREELB(fp); + + fp->_lb._size = 0; + + if ((f < 0) && (fp->_flags != 0)) + { /* did not get it after all */ + fp->_flags = 0; /* set it free */ + stdioFpDestroy (fp); /* destroy file pointer */ + errno = sverrno; /* restore in case _close clobbered */ + return (NULL); + } + + fp->_flags = flags; + fp->_file = f; + + return (fp); + } +/* fscanf.c - scan a file. stdio.h */ + +/* Copyright 1992-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,24jan95,rhp doc: avoid 'L' in fscanf(), no long doubles + in VxWorks (see SPR#3886) +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, stdarg.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "fioLib.h" +#include "stdarg.h" +#include "objLib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* fscanf - read and convert characters from a stream (ANSI) +* +* This routine reads characters from a specified stream, and interprets them +* according to format specifications in the string , which specifies +* the admissible input sequences and how they are to be converted for +* assignment, using subsequent arguments as pointers to the objects to +* receive the converted input. +* +* If there are insufficient arguments for the format, the behavior is +* undefined. If the format is exhausted while arguments remain, the excess +* arguments are evaluated but are otherwise ignored. +* +* The format is a multibyte character sequence, beginning and ending in +* its initial shift state. The format is composed of zero or more directives: +* one or more white-space characters; an ordinary multibyte character (neither +* `%' nor a white-space character); or a conversion specification. Each +* conversion specification is introduced by the `%' character. After the `%', +* the following appear in sequence: +* +* .iP "" 4 +* An optional assignment-suppressing character `*'. +* .iP +* An optional non-zero decimal integer that specifies the maximum field +* width. +* .iP +* An optional `h' or `l' (el) indicating the size of the receiving +* object. The conversion specifiers `d', `i', and `n' should be preceded by +* `h' if the corresponding argument is a pointer to `short int' rather +* than a pointer to `int', or by `l' if it is a pointer to `long int'. +* Similarly, the conversion specifiers `o', `u', and `x' shall be preceded +* by `h' if the corresponding argument is a pointer to `unsigned short int' +* rather than a pointer to `unsigned int', or by `l' if it is a pointer to +* `unsigned long int'. Finally, the conversion specifiers `e', `f', and `g' +* shall be preceded by `l' if the corresponding argument is a pointer to +* `double' rather than a pointer to `float'. If an `h' or `l' appears +* with any other conversion specifier, the behavior is undefined. +* +* \&WARNING: ANSI C also specifies an optional `L' in some of the same +* contexts as `l' above, corresponding to a `long double *' argument. +* However, the current release of the VxWorks libraries does not support +* `long double' data; using the optional `L' gives unpredictable results. +* .iP +* A character that specifies the type of conversion to be applied. The +* valid conversion specifiers are described below. +* .LP +* +* The fscanf() routine executes each directive of the format in turn. If a +* directive fails, as detailed below, fscanf() returns. Failures +* are described as input failures (due to the unavailability of input +* characters), or matching failures (due to inappropriate input). +* +* A directive composed of white-space character(s) is executed by reading +* input up to the first non-white-space character (which remains unread), +* or until no more characters can be read. +* +* A directive that is an ordinary multibyte character is executed by reading +* the next characters of the stream. If one of the characters differs from +* one comprising the directive, the directive fails, and the differing and +* subsequent characters remain unread. +* +* A directive that is a conversion specification defines a set of matching +* input sequences, as described below for each specifier. A conversion +* specification is executed in the following steps: +* +* Input white-space characters (as specified by the isspace() function) are +* skipped, unless the specification includes a `[', `c', or `n' specifier. +* +* An input item is read from the stream, unless the specification includes +* an `n' specifier. An input item is defined as the longest matching +* sequence of input characters, unless that exceeds a specified field width, +* in which case it is the initial subsequence of that length in the +* sequence. The first character, if any, after the input item remains +* unread. If the length of the input item is zero, the execution of the +* directive fails: this condition is a matching failure, unless an error +* prevented input from the stream, in which case it is an input failure. +* +* Except in the case of a `%' specifier, the input item is converted to a +* type appropriate to the conversion specifier. If the input item is not a +* matching sequence, the execution of the directive fails: this condition +* is a matching failure. Unless assignment suppression was indicated by a +* `*', the result of the conversion is placed in the object pointed to by +* the first argument following the argument that has not already +* received a conversion result. If this object does not have an appropriate +* type, or if the result of the conversion cannot be represented in the +* space provided, the behavior is undefined. +* +* The following conversion specifiers are valid: +* +* .iP `d' +* Matches an optionally signed decimal integer whose format is +* the same as expected for the subject sequence of the strtol() +* function with the value 10 for the argument. The +* corresponding argument should be a pointer to `int'. +* .iP `i' +* Matches an optionally signed integer, whose format is the +* same as expected for the subject sequence of the strtol() +* function with the value 0 for the argument. The +* corresponding argument should be a pointer to `int'. +* .iP `o' +* Matches an optionally signed octal integer, whose format is the +* same as expected for the subject sequence of the strtoul() +* function with the value 8 for the argument. The +* corresponding argument should be a pointer to `unsigned int'. +* .iP `u' +* Matches an optionally signed decimal integer, whose format is +* the same as expected for the subject sequence of the strtoul() +* function with the value 10 for the argument. The +* corresponding argument should be a pointer to `unsigned int'. +* .iP `x' +* Matches an optionally signed hexadecimal integer, whose format is +* the same as expected for the subject sequence of the strtoul() +* function with the value 16 for the argument. The +* corresponding argument should be a pointer to `unsigned int'. +* .iP "`e', `f', `g'" +* Match an optionally signed floating-point number, whose format +* is the same as expected for the subject string of the strtod() +* function. The corresponding argument should be a pointer to `float'. +* .iP `s' +* Matches a sequence of non-white-space characters. The +* corresponding argument should be a pointer to the initial +* character of an array large enough to accept the sequence +* and a terminating null character, which will be added +* automatically. +* .iP `[' +* Matches a non-empty sequence of characters from a set of +* expected characters (the `scanset'). The corresponding argument +* should be a pointer to the initial character of an array large +* enough to accept the sequence and a terminating null character, +* which is added automatically. The conversion specifier +* includes all subsequent character in the format string, up to +* and including the matching right bracket (`]'). The characters +* between the brackets (the `scanlist') comprise the scanset, +* unless the character after the left bracket is a circumflex (`^') +* in which case the scanset contains all characters that do not +* appear in the scanlist between the circumflex and the right +* bracket. If the conversion specifier begins with "[]" or "[^]", the +* right bracket character is in the scanlist and the next +* right bracket character is the matching right bracket that ends +* the specification; otherwise the first right bracket character +* is the one that ends the specification. +* .iP `c' +* Matches a sequence of characters of the number specified by the +* field width (1 if no field width is present in the directive). +* The corresponding argument should be a pointer to the initial +* character of an array large enough to accept the sequence. +* No null character is added. +* .iP `p' +* Matches an implementation-defined set of sequences, which should be +* the same as the set of sequences that may be produced by the %p +* conversion of the fprintf() function. The corresponding argument +* should be a pointer to a pointer to `void'. VxWorks defines its +* pointer input field to be consistent with pointers written by the +* fprintf() function ("0x" hexadecimal notation). If the input item is +* a value converted earlier during the same program execution, the +* pointer that results should compare equal to that value; otherwise +* the behavior of the %p conversion is undefined. +* .iP `n' +* No input is consumed. The corresponding argument should be a pointer to +* `int' into which the number of characters read from the input stream so +* far by this call to fscanf() is written. Execution of a %n directive does +* not increment the assignment count returned when fscanf() completes +* execution. +* .iP `%' +* Matches a single `%'; no conversion or assignment occurs. The +* complete conversion specification is %%. +* .LP +* +* If a conversion specification is invalid, the behavior is undefined. +* +* The conversion specifiers `E', `G', and `X' are also valid and behave the +* same as `e', `g', and `x', respectively. +* +* If end-of-file is encountered during input, conversion is terminated. If +* end-of-file occurs before any characters matching the current directive +* have been read (other than leading white space, where permitted), execution +* of the current directive terminates with an input failure; otherwise, unless +* execution of the current directive is terminated with a matching failure, +* execution of the following directive (if any) is terminated with an input +* failure. +* +* If conversion terminates on a conflicting input character, the offending +* input character is left unread in the input stream. Trailing white space +* (including new-line characters) is left unread unless matched by a +* directive. The success of literal matches and suppressed assignments is +* not directly determinable other than via the %n directive. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The number of input items assigned, which can be fewer than provided for, +* or even zero, in the event of an early matching failure; or EOF if an +* input failure occurs before any conversion. +* +* SEE ALSO: scanf(), sscanf() +*/ + +int fscanf + ( + FILE * fp, /* stream to read from */ + char const * fmt, /* format string */ + ... /* arguments to format string */ + ) + { + int nArgs; + int unget; + va_list vaList; /* vararg list */ + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (EOF); + + va_start (vaList, fmt); + nArgs = fioScanV (fmt, fgetc, (int) fp, &unget, vaList); + va_end (vaList); + + if (unget != -1) + ungetc (unget, fp); + + return (nArgs); + } +/* fseek.c - seek a position in a file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + +smb taken from UCB stdio, removed fstat(). +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, sys/types.h, sys/stat.h, fcntl.h, stdlib.h, errno.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "ioLib.h" +#include "sys/types.h" +#include "sys/stat.h" +#include "fcntl.h" +#include "stdlib.h" +#include "errno.h" +#include "objLib.h" +#include "private/stdioP.h" + +#define POS_ERR (-(fpos_t)1) + + +/****************************************************************************** +* +* fseek - set the file position indicator for a stream (ANSI) +* +* This routine sets the file position indicator for a specified stream. +* For a binary stream, the new position, measured in characters from the +* beginning of the file, is obtained by adding to the position +* specified by , whose possible values are: +* .iP SEEK_SET 16 +* the beginning of the file. +* .iP SEEK_CUR +* the current value of the file position indicator. +* .iP SEEK_END +* the end of the file. +* .LP +* A binary stream does not meaningfully +* support fseek() calls with a value of SEEK_END. +* +* For a text stream, either is zero, or is a value +* returned by an earlier call to ftell() on the stream, in which case +* should be SEEK_SET. +* +* A successful call to fseek() clears the end-of-file indicator for the +* stream and undoes any effects of ungetc() on the same stream. After an +* fseek() call, the next operation on an update stream can be either input +* or output. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: Non-zero only for a request that cannot be satisfied. +* +* ERRNO: EINVAL +* +* SEE ALSO: ftell() +*/ + +int fseek + ( + FAST FILE * fp, /* stream */ + long offset, /* offset from */ + int whence /* position to offset from: */ + /* SEEK_SET = beginning */ + /* SEEK_CUR = current position */ + /* SEEK_END = end-of-file */ + ) + { + fpos_t target; + fpos_t curoff; + size_t n; + struct stat st; + int havepos; + BOOL doStat; + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (ERROR); + + /* + * Change any SEEK_CUR to SEEK_SET, and check `whence' argument. + * After this, whence is either SEEK_SET or SEEK_END. + */ + + switch (whence) + { + case SEEK_CUR: + /* + * In order to seek relative to the current stream offset, + * we have to first find the current stream offset a la + * ftell (see ftell for details). + */ + if (fp->_flags & __SOFF) + curoff = fp->_offset; + else + { + curoff = __sseek (fp, (fpos_t)0, SEEK_CUR); + if (curoff == -1L) + return (EOF); + } + + if (fp->_flags & __SRD) + { + curoff -= fp->_r; + if (HASUB(fp)) + curoff -= fp->_ur; + } + else if (fp->_flags & __SWR && fp->_p != NULL) + curoff += fp->_p - fp->_bf._base; + + offset += curoff; + whence = SEEK_SET; + havepos = 1; + break; + + case SEEK_SET: + case SEEK_END: + curoff = 0; /* XXX just to keep gcc quiet */ + havepos = 0; + break; + + default: + errno = EINVAL; + return (EOF); + } + + /* + * Can only optimise if: + * reading (and not reading-and-writing); + * not unbuffered; and + * this is a `regular' Unix file (and hence seekfn==__sseek). + * We must check __NBF first, because it is possible to have __NBF + * and __SOPT both set. + */ + + if (fp->_bf._base == NULL) + __smakebuf (fp); + + if (fp->_flags & (__SWR | __SRW | __SNBF | __SNPT)) + goto dumb; + + + doStat = ioctl (fp->_file, FIOFSTATGET, (int)&st); + + if ((fp->_flags & __SOPT) == 0) + { + if ((fp->_file < 0 || (doStat) || + (st.st_mode & S_IFMT) != S_IFREG)) + { + fp->_flags |= __SNPT; + goto dumb; + } + + fp->_blksize = st.st_blksize; + fp->_flags |= __SOPT; + } + + /* + * We are reading; we can try to optimise. + * Figure out where we are going and where we are now. + */ + + if (whence == SEEK_SET) + target = offset; + else + { + if (doStat) + goto dumb; + + target = st.st_size + offset; + } + + if (!havepos) + { + if (fp->_flags & __SOFF) + curoff = fp->_offset; + else + { + curoff = __sseek (fp, 0L, SEEK_CUR); + + if (curoff == POS_ERR) + goto dumb; + } + + curoff -= fp->_r; + + if (HASUB(fp)) + curoff -= fp->_ur; + } + + /* + * Compute the number of bytes in the input buffer (pretending + * that any ungetc() input has been discarded). Adjust current + * offset backwards by this count so that it represents the + * file offset for the first byte in the current input buffer. + */ + + if (HASUB(fp)) + { + n = fp->_up - fp->_bf._base; + curoff -= n; + n += fp->_ur; + } + else + { + n = fp->_p - fp->_bf._base; + curoff -= n; + n += fp->_r; + } + + /* + * If the target offset is within the current buffer, + * simply adjust the pointers, clear EOF, undo ungetc(), + * and return. (If the buffer was modified, we have to + * skip this; see fgetline.c.) + */ + + if (((fp->_flags & __SMOD) == 0) && + (target >= curoff) && + (target < (curoff + n))) + { + FAST int o = target - curoff; + + fp->_p = fp->_bf._base + o; + fp->_r = n - o; + + if (HASUB(fp)) + FREEUB(fp); + + fp->_flags &= ~__SEOF; + + return (0); + } + + /* + * The place we want to get to is not within the current buffer, + * but we can still be kind to the kernel copyout mechanism. + * By aligning the file offset to a block boundary, we can let + * the kernel use the VM hardware to map pages instead of + * copying bytes laboriously. Using a block boundary also + * ensures that we only read one block, rather than two. + */ + + curoff = target & ~(fp->_blksize - 1); + + if (__sseek (fp, curoff, SEEK_SET) == POS_ERR) + goto dumb; + + fp->_r = 0; + + if (HASUB(fp)) + FREEUB(fp); + + fp->_flags &= ~__SEOF; + n = target - curoff; + + if (n) + { + if (__srefill (fp) || fp->_r < n) + goto dumb; + fp->_p += n; + fp->_r -= n; + } + + return (0); + + /* + * We get here if we cannot optimise the seek ... just + * do it. Allow the seek function to change fp->_bf._base. + */ +dumb: + if ((__sflush (fp)) || (__sseek (fp, offset, whence) == POS_ERR)) + return (EOF); + + /* success: clear EOF indicator and discard ungetc() data */ + + if (HASUB(fp)) + FREEUB(fp); + + fp->_p = fp->_bf._base; + fp->_r = 0; + + /* fp->_w = 0; */ /* unnecessary (I think...) */ + + fp->_flags &= ~__SEOF; + + return (0); + } +/* fsetpos.c - set a position in a file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" + + +/****************************************************************************** +* +* fsetpos - set the file position indicator for a stream (ANSI) +* +* This routine sets the file position indicator for a specified stream +* according to the value of the object pointed to by , which is a value +* obtained from an earlier call to fgetpos() on the same stream. +* +* A successful call to fsetpos() clears the end-of-file indicator for the +* stream and undoes any effects of ungetc() on the same stream. After an +* fsetpos() call, the next operation on an update stream may be either input +* or output. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* Zero, or non-zero if the call fails, with `errno' set to indicate the error. +* +* SEE ALSO: fgetpos() +*/ + +int fsetpos + ( + FILE * iop, /* stream */ + const fpos_t * pos /* position, obtained by fgetpos() */ + ) + { + return (fseek (iop, (long)*pos, SEEK_SET)); + } +/* ftell.c - remember a position in a file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, error.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "errno.h" +#include "objLib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* ftell - return the current value of the file position indicator for a stream (ANSI) +* +* This routine returns the current value of the file position indicator for +* a specified stream. For a binary stream, the value is the number of +* characters from the beginning of the file. For a text stream, the file +* position indicator contains unspecified information, usable by fseek() for +* returning the file position indicator to its position at the time of the +* ftell() call; the difference between two such return values is not +* necessary a meaningful measure of the number of characters written or read. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The current value of the file position indicator, +* or -1L if unsuccessful, with `errno' set to indicate the error. +* +* SEE ALSO: fseek() +*/ + +long ftell + ( + FAST FILE * fp /* stream */ + ) + { + FAST fpos_t pos; + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (ERROR); + + /* + * Find offset of underlying I/O object, then + * adjust for buffered bytes. + */ + + if (fp->_flags & __SOFF) + pos = fp->_offset; + else + { + pos = __sseek (fp, (fpos_t)0, SEEK_CUR); + + if (pos == -1L) + return (pos); + } + + if (fp->_flags & __SRD) + { + /* + * Reading. Any unread characters (including + * those from ungetc) cause the position to be + * smaller than that in the underlying object. + */ + + pos -= fp->_r; + + if (HASUB(fp)) + pos -= fp->_ur; + } + else if (fp->_flags & __SWR && fp->_p != NULL) + { + /* + * Writing. Any buffered characters cause the + * position to be greater than that in the + * underlying object. + */ + + pos += fp->_p - fp->_bf._base; + } + + return (pos); + } +/* fwrite.c - write to a file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "objLib.h" +#include "private/stdioP.h" +#include "private/fvwriteP.h" + + +/****************************************************************************** +* +* fwrite - write from a specified array (ANSI) +* +* This routine writes, from the array , up to elements whose +* size is , to a specified stream. The file position indicator for +* the stream (if defined) is advanced by the number of characters +* successfully written. If an error occurs, the resulting value of the file +* position indicator for the stream is indeterminate. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The number of elements successfully written, which will be less than +* only if a write error is encountered. +*/ + +int fwrite + ( + const void * buf, /* where to copy from */ + size_t size, /* element size */ + size_t count, /* no. of elements */ + FILE * fp /* stream to write to */ + ) + { + size_t n; + struct __suio uio; + struct __siov iov; + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (0); + + iov.iov_base = (void *)buf; + uio.uio_resid = iov.iov_len = n = (count * size); + uio.uio_iov = &iov; + uio.uio_iovcnt = 1; + + /* The usual case is success (__sfvwrite returns 0); + * skip the divide if this happens, since divides are + * generally slow and since this occurs whenever size==0. + */ + + if (__sfvwrite(fp, &uio) == 0) + return (count); + + return ((n - uio.uio_resid) / size); + } +/* getc.c - get a character from a file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "objLib.h" +#include "private/stdioP.h" + +#undef getc + +/****************************************************************************** +* +* getc - return the next character from a stream (ANSI) +* +* This routine is equivalent to fgetc(), except that if it is implemented as +* a macro, it may evaluate more than once; thus the argument should +* never be an expression with side effects. +* +* If the stream is at end-of-file, the end-of-file indicator for the stream is +* set; if a read error occurs, the error indicator is set. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The next character from the stream, or EOF if the stream is at end-of-file +* or a read error occurs. +* +* SEE ALSO: fgetc() +*/ + +int getc + ( + FILE * fp /* input stream */ + ) + { + int ch; + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (EOF); + + if ((ch = __sgetc(fp)) == EOF) + fp->_flags |= __SEOF; + + return (ch); + } +/* getchar.c - get a character from a file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "private/stdioP.h" + +#undef getchar + +/****************************************************************************** +* +* getchar - return the next character from the standard input stream (ANSI) +* +* This routine returns the next character from the standard input stream +* and advances the file position indicator. +* +* It is equivalent to getc() with the stream argument `stdin'. +* +* If the stream is at end-of-file, the end-of-file indicator is +* set; if a read error occurs, the error indicator is set. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The next character from the standard input stream, or EOF if the stream is +* at end-of-file or a read error occurs. +* +* SEE ALSO: getc(), fgetc() +*/ + +int getchar (void) + { + return (getc (stdin)); + } +/* gets.c - get a string of characters from a file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, unistd.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "unistd.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* gets - read characters from the standard input stream (ANSI) +* +* This routine reads characters from the standard input stream into the +* array until end-of-file is encountered or a new-line is read. +* Any new-line character is discarded, and a null character is written +* immediately after the last character read into the array. +* +* If end-of-file is encountered and no characters have been read, +* the contents of the array remain unchanged. If a read error +* occurs, the array contents are indeterminate. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* A pointer to , or a null pointer if (1) end-of-file is encountered +* and no characters have been read, or (2) there is a read error. +*/ + +char * gets + ( + char * buf /* output array */ + ) + { + FAST int c; + FAST char * s; + + for (s = buf; (c = getchar()) != '\n';) + { + if (c == EOF) + { + if (s == buf) + return (NULL); + else + break; + } + else + *s++ = c; + } + + *s = EOS; + + return (buf); + } +/* getw.c - get a word. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: stdio.h, string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" + +/****************************************************************************** +* +* getw - read the next word (32-bit integer) from a stream +* +* This routine reads the next 32-bit quantity from a specified stream. +* It returns EOF on end-of-file or an error; however, this is also a +* valid integer, thus feof() and ferror() must be used to check for +* a true end-of-file. +* +* This routine is provided for compatibility with earlier VxWorks releases. +* +* INCLUDE FILES: stdio.h +* +* RETURN: A 32-bit number from the stream, or EOF on either end-of-file +* or an error. +* +* SEE ALSO: putw() +*/ + +int getw + ( + FILE * fp /* stream to read from */ + ) + { + int x; + + return (fread ((void *)&x, sizeof (x), 1, fp) == 1 ? x : EOF); + } +/* perror.c - print error value. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: stdio.h, error.h, string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "string.h" +#include "errno.h" + + +/****************************************************************************** +* +* perror - map an error number in `errno' to an error message (ANSI) +* +* This routine maps the error number in the integer expression `errno' to an +* error message. It writes a sequence of characters to the standard error +* stream as follows: first (if <__s> is not a null pointer and the character +* pointed to by <__s> is not the null character), the string pointed to by +* <__s> followed by a colon (:) and a space; then an appropriate error +* message string followed by a new-line character. The contents of the +* error message strings are the same as those returned by strerror() with +* the argument `errno'. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: N/A +* +* SEE ALSO: strerror() +*/ + +void perror + ( + const char * __s /* error string */ + ) + { + if ((__s) && (*__s != EOS)) + fprintf (stderr, "%s: ", __s); + + fprintf (stderr, "%s\n", strerror (errno)); + } +/* putc.c - put a character. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "private/stdioP.h" + +#undef putc + +/****************************************************************************** +* +* putc - write a character to a stream (ANSI) +* +* This routine writes a character to a specified stream, at the +* position indicated by the stream's file position indicator +* (if defined), and advances the indicator appropriately. +* +* This routine is equivalent to fputc(), except that if it is implemented as +* a macro, it may evaluate more than once; thus, the argument should +* never be an expression with side effects. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The character written, or EOF if a write error occurs, with the error +* indicator set for the stream. +* +* SEE ALSO: fputc() +*/ + +int putc + ( + int c, /* character to write */ + FAST FILE * fp /* stream to write to */ + ) + { + return (__sputc(c, fp)); + } +/* putchar.c - put a character to standard output. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "private/stdioP.h" + +#undef putchar + +/****************************************************************************** +* +* putchar - write a character to the standard output stream (ANSI) +* +* This routine writes a character to the standard output stream, at the +* position indicated by the stream's file position indicator +* (if defined), and advances the indicator appropriately. +* +* This routine is equivalent to putc() with a second argument of `stdout'. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The character written, or EOF if a write error occurs, with the error +* indicator set for the standard output stream. +* +* SEE ALSO: putc(), fputc() +*/ + +int putchar + ( + int c /* character to write */ + ) + { + return (__sputc(c, stdout)); + } +/* puts.c - put a string of characters. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "string.h" +#include "private/fvwriteP.h" + + +/****************************************************************************** +* +* puts - write a string to the standard output stream (ANSI) +* +* This routine writes to the standard output stream a specified string , +* minus the terminating null character, and appends a new-line character to +* the output. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* A non-negative value, or EOF if a write error occurs. +* +* SEE ALSO: fputs() +*/ + +int puts + ( + char const * s /* string to write */ + ) + { + size_t c = strlen (s); + struct __suio uio; + struct __siov iov [2]; + + iov[0].iov_base = (void *)s; + iov[0].iov_len = c; + iov[1].iov_base = "\n"; + iov[1].iov_len = 1; + + uio.uio_resid = c + 1; + uio.uio_iov = &iov [0]; + uio.uio_iovcnt = 2; + + return ((__sfvwrite (stdout, &uio)) ? (EOF) : ('\n')); + } +/* putw.c - put a word. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,05mar93,jdi documentation cleanup for 5.1. +01c,21sep92,smb tweaks for mg +01b,20sep92,smb documentation additions +01a,29jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: stdio.h, string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" + +/****************************************************************************** +* +* putw - write a word (32-bit integer) to a stream +* +* This routine appends the 32-bit quantity to a specified stream. +* +* This routine is provided for compatibility with earlier VxWorks releases. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: The value written. +*/ + +int putw + ( + int w, /* word (32-bit integer) */ + FILE * fp /* output stream */ + ) + { + return (fwrite ((void *) &w, sizeof (int), 1, fp) == 1 ? w : EOF); + } +/* rewind.c - rewind a stream. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, error.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "objLib.h" +#include "errno.h" + + +/****************************************************************************** +* +* rewind - set the file position indicator to the beginning of a file (ANSI) +* +* This routine sets the file position indicator for a specified stream to +* the beginning of the file. +* +* It is equivalent to: +* .CS +* (void) fseek (fp, 0L, SEEK_SET); +* .CE +* except that the error indicator for the stream is cleared. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: N/A +* +* SEE ALSO: fseek(), ftell() +*/ + +void rewind + ( + FILE * fp /* stream */ + ) + { + if (OBJ_VERIFY (fp, fpClassId) != OK) + return; + + (void) fseek (fp, 0L, SEEK_SET); + clearerr(fp); + } +/* scanf.c - scan a file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf rewritten to usr fioScanV() + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, stdarg.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdarg.h" +#include "fioLib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* scanf - read and convert characters from the standard input stream (ANSI) +* +* This routine reads input from the standard input stream under the control +* of the string . It is equivalent to fscanf() with an argument +* of `stdin'. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The number of input items assigned, which can be fewer than provided for, +* or even zero, in the event of an early matching failure; or EOF if an +* input failure occurs before any conversion. +* +* SEE ALSO: fscanf(), sscanf() +*/ + +int scanf + ( + char const * fmt, /* format string */ + ... /* arguments to format string */ + ) + { + int nArgs; + int unget; + va_list vaList; /* vararg list */ + + va_start (vaList, fmt); + nArgs = fioScanV (fmt, fgetc, (int) stdin, &unget, vaList); + va_end (vaList); + + if (unget != -1) + ungetc (unget, stdin); + + return (nArgs); + } +/* setbuf.c - set buffered mode. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "objLib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* setbuf - specify the buffering for a stream (ANSI) +* +* Except that it returns no value, this routine is equivalent to setvbuf() +* invoked with the _IOFBF (full buffering) and BUFSIZ, or (if +* is a null pointer), with the _IONBF (no buffering). +* +* INCLUDE FILES: stdio.h +* +* RETURNS: N/A +* +* SEE ALSO: setvbuf() +*/ + +void setbuf + ( + FILE * fp, /* stream to set buffering for */ + char * buf /* buffer to use */ + ) + { + if (OBJ_VERIFY (fp, fpClassId) != OK) + return; + + (void) setvbuf (fp, buf, ((buf) ? (_IOFBF) : (_IONBF)), BUFSIZ); + } +/* setbuffer.c- file for stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "objLib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* setbuffer - specify buffering for a stream +* +* This routine specifies a buffer to be used for a stream in place of the +* automatically allocated buffer. If is NULL, the stream is unbuffered. +* This routine should be called only after the stream has been associated with +* an open file and before any other operation is performed on the stream. +* +* This routine is provided for compatibility with earlier VxWorks releases. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: N/A +* +* SEE ALSO: setvbuf() +*/ + +void setbuffer + ( + FAST FILE * fp, /* stream to set buffering for */ + char * buf, /* buffer to use */ + int size /* buffer size */ + ) + { + if (OBJ_VERIFY (fp, fpClassId) != OK) + return; + + (void) setvbuf (fp, buf, ((buf) ? (_IOFBF) : (_IONBF)), size); + } + +/****************************************************************************** +* +* setlinebuf - set line buffering for standard output or standard error +* +* This routine changes `stdout' or `stderr' streams from block-buffered or +* unbuffered to line-buffered. Unlike setbuf(), setbuffer(), or setvbuf(), it +* can be used at any time the stream is active. +* +* A stream can be changed from unbuffered or line-buffered to fully buffered +* using freopen(). A stream can be changed from fully buffered or +* line-buffered to unbuffered using freopen() followed by setbuf() with a +* buffer argument of NULL. +* +* This routine is provided for compatibility with earlier VxWorks releases. +* +* INCLUDE: stdio.h +* +* RETURNS: OK, or ERROR if is not a valid stream. +*/ + +int setlinebuf + ( + FILE * fp /* stream - stdout or stderr */ + ) + { + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (ERROR); + + (void) setvbuf (fp, (char *)NULL, _IOLBF, (size_t)0); + return (OK); /* ??? */ + } +/* setvbuf.c - set buffered mode. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "stdlib.h" +#include "objLib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* setvbuf - specify buffering for a stream (ANSI) +* +* This routine sets the buffer size and buffering mode for a specified +* stream. It should be called only after the stream has been associated +* with an open file and before any other operation is performed on the +* stream. The argument determines how the stream will be buffered, +* as follows: +* .iP _IOFBF 12 +* input/output is to be fully buffered. +* .iP _IOLBF +* input/output is to be line buffered. +* .iP _IONBF +* input/output is to be unbuffered. +* .LP +* +* If is not a null pointer, the array it points to may be used instead +* of a buffer allocated by setvbuf(). The argument specifies +* the size of the array. The contents of the array at any time are +* indeterminate. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* Zero, or non-zero if is invalid or the request cannot be honored. +*/ + +int setvbuf + ( + FAST FILE * fp, /* stream to set buffering for */ + char * buf, /* buffer to use (optional) */ + FAST int mode, /* _IOFBF = fully buffered */ + /* _IOLBF = line buffered */ + /* _IONBF = unbuffered */ + FAST size_t size /* buffer size */ + ) + { + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (ERROR); + + /* + * Verify arguments. The `int' limit on `size' is due to this + * particular implementation. + */ + + if (((mode != _IOFBF) && (mode != _IOLBF) && (mode != _IONBF)) || + ((int)size < 0)) + return (EOF); + + /* + * Write current buffer, if any; drop read count, if any. + * Make sure putc() will not think fp is line buffered. + * Free old buffer if it was from malloc(). Clear line and + * non buffer flags, and clear malloc flag. + */ + + (void) __sflush (fp); + + fp->_r = 0; + fp->_lbfsize = 0; + + if (fp->_flags & __SMBF) + free ((void *)fp->_bf._base); + + fp->_flags &= ~(__SLBF | __SNBF | __SMBF); + + /* + * Now put back whichever flag is needed, and fix _lbfsize + * if line buffered. Ensure output flush on exit if the + * stream will be buffered at all. + */ + + switch (mode) + { + case _IONBF: + fp->_flags |= __SNBF; + fp->_bf._base = fp->_p = fp->_nbuf; + fp->_bf._size = 1; + break; + + case _IOLBF: + fp->_flags |= __SLBF; + fp->_lbfsize = -size; + /* FALLTHROUGH */ + + case _IOFBF: + /* no flag */ + fp->_bf._base = fp->_p = (unsigned char *)buf; + fp->_bf._size = size; + break; + default: + break; + } + + /* + * Patch up write count if necessary. + */ + + if (fp->_flags & __SWR) + fp->_w = (fp->_flags & (__SLBF | __SNBF)) ? (0) : (size); + + return (0); + } +/* stdioLib.c - standard I/O library */ + +/* Copyright 1984-1995 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +02i,11feb95,jdi doc tweak. +02h,05mar93,jdi documentation cleanup for 5.1. +02g,13nov92,dnw added __std{in,out,err} (SPR #1770) + made stdInitStd() be LOCAL. + changed stdioFp() create FILE if it doesn't already exist. +02f,20sep92,smb documentation additions +02e,29jul92,smb added stdioFp(). + Modified the documentation for the new stdio library. +02d,29jul92,jcf taken from stdioLib.c +02c,26may92,rrr the tree shuffle +02b,02apr92,jmm added free() of memory if bad options passed to fdopen() + SPR # 1396 +02a,27mar92,jmm changed fopen() to free memory if the open() fails, SPR #1115 +01z,25nov91,rrr cleanup of some ansi warnings. +01y,12nov91,rrr removed VARARG_OK, no longer needed with ansi c. +01x,07oct91,rrr junk for r3000 braindamage. +01w,04oct91,rrr passed through the ansification filter + -changed functions to ansi style + -changed includes to have absolute path from h/ + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01v,18may91,gae fixed varargs for 960 with conditional VARARG_OK, + namely: fscanf, fprintf, and scanf. +01u,04apr91,jdi documentation cleanup; doc review by dnw. +01t,10aug90,dnw added forward declaration of stdioExitStd (). +01s,08aug90,dnw changed incorrect forward declaration for stdioCreateHook(). +01r,10jun90,dnw changed to call fioFormatV and fioScanV directly with + appropriate handling of varargs (removed doscan and doprnt) + moved all routine implementations of stdio macros to end of + module so that macros would be used in rest of code + spr 640: fprintf returns number of chars printed instead of OK + spr 754: vararg routines no longer limited to 16 args + fixed coercions to allow void to be defined as void one day. +01q,26jun90,jcf lint. +01p,12mar90,jcf changed std{in,out,err} to macros to fps in tcbx. +01o,16feb90,dab fixed bug in doscan() that wouldn't match characters between + the input stream and the format specification. +01n,03aug89,dab removed call to creat() in fopen(). +01m,08apr89,dnw changed stdioInit() to call taskVarInit(). +01l,23mar89,dab changed numerical constants to appropriate defines. + fixed fseek() to return only OK or ERROR. +01k,15nov88,dnw documentation touchup. +01j,23sep88,gae documentation touchup. +01i,13sep88,gae removed ifdef'd sprintf which got into documentation. +01h,06sep88,gae adjusted some argument declarations to please f2cgen. +01g,20aug88,gae documentation. +01f,07jul88,jcf changed malloc to match new declaration. +01e,29jun88,gae documentation. Added error messages in stioInit(). +01d,22jun88,dnw name tweaks. +01c,30may88,dnw changed to v4 names. +01b,28may88,dnw removed routines that had been excluded with "#if FALSE". + made stdioFlushBuf LOCAL. + cleaned up stdio{Init,Exit}Task; improved error msgs. +01a,28mar88,gae created. +*/ + +/* +DESCRIPTION +This library provides a complete UNIX compatible standard I/O buffering +scheme. It is beyond the scope of this manual entry to describe all aspects +of the buffering -- see the +.I "VxWorks Programmer's Guide: I/O System" +and the Kernighan & Ritchie C manual. This manual entry primarily highlights +the differences between the UNIX and VxWorks standard I/O. + +FILE POINTERS +The routine fopen() creates a file pointer. Use of the file pointer follows +conventional UNIX usage. In a shared address space, however, and perhaps more +critically, with the VxWorks system symbol table, tasks may not use each +others' file pointers, at least not without some interlocking mechanism. If it +is necessary to use the same name for a file pointer but have incarnations for +each task, then use task variables; see the manual entry for taskVarLib. + +FIOLIB +Several routines normally considered part of standard I/O -- printf(), +sscanf(), and sprintf() -- are not implemented in stdio; they are +instead implemented in fioLib. They do not use the standard I/O buffering +scheme. They are self-contained, formatted, but unbuffered I/O +functions. This allows a limited amount of formatted I/O to be achieved +without the overhead of the stdio library. + +TASK TERMINATION +When a task exits, unlike in UNIX, it is the responsibility of the task to +fclose() its file pointers, except `stdin', `stdout', and `stderr'. If a +task is to be terminated asynchronously, use kill() and arrange for a +signal handler to clean up. + +INCLUDE FILES +stdio.h, taskLib.h + +All the macros defined in stdio.h are also implemented as real functions so +that they are available from the VxWorks shell. + +SEE ALSO +fioLib, ioLib, taskVarLib, sigLib, Kernighan & Ritchie C manual, +.pG "I/O System" + +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "sys/types.h" +#include "ctype.h" +#include "ioLib.h" +#include "stdlib.h" +#include "taskLib.h" +#include "taskHookLib.h" +#include "stdarg.h" +#include "logLib.h" +#include "fcntl.h" +#include "unistd.h" +#include "errnoLib.h" +#include "string.h" +#include "fioLib.h" +#include "classLib.h" +#include "private/objLibP.h" +#include "private/stdioP.h" +#include "private/funcBindP.h" + +/* locals */ + +LOCAL OBJ_CLASS fpClass; /* file object class */ +LOCAL BOOL stdioInitialized = FALSE; + +/* global variables */ + +CLASS_ID fpClassId = &fpClass; /* file class id */ + + +/******************************************************************************* +* +* stdioInit - initialize standard I/O support +* +* This routine installs standard I/O support. It must be called before +* using `stdio' buffering. If INCLUDE_STDIO is defined in configAll.h, it +* is called automatically by the root task usrRoot() in usrConfig.c. +* +* RETURNS: +* OK, or ERROR if the standard I/O facilities cannot be installed. +*/ + +STATUS stdioInit (void) + { + if ((!stdioInitialized) && + (classInit (fpClassId, sizeof (FILE), OFFSET (FILE, objCore), + (FUNCPTR) NULL, (FUNCPTR) NULL, (FUNCPTR) NULL) == OK)) + { + _func_fclose = fclose; /* attach fclose vfunc to taskLib */ + stdioInitialized = TRUE; /* we've finished the initialization */ + } + + return (OK); + } + +/******************************************************************************* +* +* stdioFpCreate - allocate a new FILE structure +* +* RETURNS: +* The pointer to newly created file, or NULL if out of memory. +* +* NOMANUAL +*/ + +FILE *stdioFpCreate (void) + { + FAST FILE *fp = NULL; + + if ((stdioInit () == OK) && + ((fp = (FILE *)objAlloc (fpClassId)) != NULL)) + { + fp->_p = NULL; /* no current pointer */ + fp->_r = 0; + fp->_w = 0; /* nothing to read or write */ + fp->_flags = 1; /* caller sets real flags */ + fp->_file = -1; /* no file */ + fp->_bf._base = NULL; /* no buffer */ + fp->_bf._size = 0; + fp->_lbfsize = 0; /* not line buffered */ + fp->_ub._base = NULL; /* no ungetc buffer */ + fp->_ub._size = 0; + fp->_lb._base = NULL; /* no line buffer */ + fp->_lb._size = 0; + fp->_blksize = 0; + fp->_offset = 0; + fp->taskId = (int) taskIdCurrent; /* task id might be useful */ + + objCoreInit (&fp->objCore, fpClassId); /* validate file object */ + } + + return (fp); + } + +/******************************************************************************* +* +* stdioFpDestroy - destroy and reclaim resources of specified file pointer +* +* RETURNS: +* OK, or ERROR if file pointer could not be destroyed. +* +* NOMANUAL +*/ + +STATUS stdioFpDestroy + ( + FILE *fp + ) + { + /* fclose() deallocates any buffers associated with the file pointer */ + + objCoreTerminate (&fp->objCore); /* invalidate file pointer */ + + return (objFree (fpClassId, (char *) fp)); /* deallocate file pointer */ + } + +/******************************************************************************* +* +* stdioInitStd - initialize use of a standard file +*/ + +LOCAL STATUS stdioInitStd + ( + int stdFd /* standard file descriptor to initialize (0,1,2) */ + ) + { + FILE *fp; + + if ((fp = stdioFpCreate ()) == NULL) + return (ERROR); + + switch (stdFd) + { + case STD_IN: fp->_flags = __SRD; break; /* read only */ + case STD_OUT: fp->_flags = __SWR; break; /* write only */ + case STD_ERR: fp->_flags = __SWRNBF; break; /* write only unbuf'd */ + } + + fp->_file = stdFd; /* standard fd */ + + taskIdCurrent->taskStdFp[stdFd] = fp; /* init private file pointer */ + + return (OK); + } + +/****************************************************************************** +* +* stdioFp - return the standard input/output/error FILE of the current task +* +* This routine returns the specified standard FILE structure address of the +* current task. It is provided primarily to give access to standard input, +* standard output, and standard error from the shell, where the usual +* `stdin', `stdout', `stderr' macros cannot be used. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: The standard FILE structure address of the specified file +* descriptor, for the current task. +*/ + +FILE * stdioFp + ( + int stdFd /* fd of standard FILE to return (0,1,2) */ + ) + { + if (taskIdCurrent->taskStdFp [stdFd] == NULL) + stdioInitStd (stdFd); + + return (taskIdCurrent->taskStdFp [stdFd]); + } + +/******************************************************************************* +* +* __stdin - get pointer to current task's stdin +* +* This function returns a pointer to the current task's stdin. If the +* current task does not have a stdin then one is created. +* +* NOMANUAL +*/ + +FILE ** __stdin (void) + { + if (taskIdCurrent->taskStdFp [STD_IN] == NULL) + stdioInitStd (STD_IN); + + return (&taskIdCurrent->taskStdFp [STD_IN]); + } + +/******************************************************************************* +* +* __stdout - get pointer to current task's stdout +* +* This function returns a pointer to the current task's stdout. If the +* current task does not have a stdout then one is created. +* +* NOMANUAL +*/ + +FILE ** __stdout (void) + { + if (taskIdCurrent->taskStdFp [STD_OUT] == NULL) + stdioInitStd (STD_OUT); + + return (&taskIdCurrent->taskStdFp [STD_OUT]); + } + +/******************************************************************************* +* +* __stderr - get pointer to current task's stderr +* +* This function returns a pointer to the current task's stderr. If the +* current task does not have a stderr then one is created. +* +* NOMANUAL +*/ + +FILE ** __stderr (void) + { + if (taskIdCurrent->taskStdFp [STD_ERR] == NULL) + stdioInitStd (STD_ERR); + + return (&taskIdCurrent->taskStdFp [STD_ERR]); + } + +/* stdioShow.c - standard I/O show library */ + +/* Copyright 1984-1993 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01f,17mar99,jdi doc: updated w/ info about proj facility (SPR 25727). +01e,16sep93,jmm cleaned up warnings about printf args +01d,15sep93,kdl fixed man page for stdioShowInit() (SPR #2244). +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf created. +*/ + +/* +DESCRIPTION +This library provides a show routine for file pointers. + +NOMANUAL +*/ + + +#include "vxWorks.h" +#include "stdio.h" +#include "sys/types.h" +#include "stdlib.h" +#include "taskLib.h" +#include "fioLib.h" +#include "classLib.h" +#include "errnoLib.h" +#include "private/objLibP.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* stdioShowInit - initialize the standard I/O show facility +* +* This routine links the file pointer show routine into the VxWorks system. +* It is called automatically when this show facility is +* configured into VxWorks using either of the following methods: +* .iP +* If you use the configuration header files, define +* INCLUDE_SHOW_ROUTINES in config.h. +* .iP +* If you use the Tornado project facility, select INCLUDE_STDIO_SHOW. +* +* RETURNS: OK, or ERROR if an error occurs installing the file pointer show +* routine. +*/ + +STATUS stdioShowInit (void) + { + classShowConnect (fpClassId, (FUNCPTR)stdioShow); + + return (OK); + } +/******************************************************************************* +* +* stdioShow - display file pointer internals +* +* This routine displays information about a specified stream. +* +* RETURNS: OK, or ERROR if the file pointer is invalid. +*/ + +STATUS stdioShow + ( + FAST FILE * fp, /* stream */ + int level /* level */ + ) + { + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (ERROR); /* invalid file pointer */ + + printf ("%-20s: %#-10x\n", "Owning Task", fp->taskId); + printf ("%-20s: %-10hd\n", "File Descriptor", fp->_file); + printf ("%-20s: %#-10x\n", "Current Position", (unsigned int) fp->_p); + printf ("%-20s: %#-10x\n", "Read Space Left", fp->_r); + printf ("%-20s: %#-10x\n", "Write Space Left", fp->_w); + printf ("%-20s: %#-10x\n", "Buffer Base", (unsigned int) fp->_bf._base); + printf ("%-20s: %#-10x\n", "Buffer Size", fp->_bf._size); + printf ("%-20s: %#-10x\n", "Ungetc Buffer Base", + (unsigned int) fp->_ub._base); + printf ("%-20s: %#-10x\n", "Ungetc Buffer Size", fp->_ub._size); + printf ("%-20s: %#-10x\n", "Line Buffer Base", (unsigned int) fp->_lb._base); + printf ("%-20s: %#-10x\n", "Line Buffer Size", fp->_lb._size); + printf ("%-20s: %#-10x\n", "stat.st_blksize", fp->_blksize); + printf ("%-20s: %#-10x\n", "lseek Offset", fp->_offset); + printf ("%-20s: %#-10hx\n", "Flags", fp->_flags); + + /* someday display the buffer contents with level >= 1 */ + + return (OK); + } +/* tmpfile.c - creat a temporary file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,05mar93,jdi documentation cleanup for 5.1. +01c,21sep92,smb tweaks for mg. +01b,20sep92,smb documentation additions +01a,29jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: stdio.h, string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" + +/******************************************************************************* +* +* tmpfile - create a temporary binary file (Unimplemented) (ANSI) +* +* This routine is not be implemented +* because VxWorks does not close all open files at task exit. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: NULL +*/ + +FILE * tmpfile (void) + { + return (NULL); + } +/* tmpnam.c - devise a temporary name. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,23sep93,jmm made tmpnam()'s buffer static (spr 2525) +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: stdio.h, string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "string.h" + +/****************************************************************************** +* +* tmpnam - generate a temporary file name (ANSI) +* +* This routine generates a string that is a valid file name and not the same +* as the name of an existing file. It generates a different string each +* time it is called, up to TMP_MAX times. +* +* If the argument is a null pointer, tmpnam() leaves its +* result in an internal static object and returns a pointer to that +* object. Subsequent calls to tmpnam() may modify the same +* object. If the argument is not a null pointer, it is assumed to +* point to an array of at least L_tmpnam chars; tmpnam() writes +* its result in that array and returns the argument as its value. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: A pointer to the file name. +*/ + +char * tmpnam + ( + char * s /* name buffer */ + ) + { + int index; + char * pos; + ushort_t t; + static char buf [L_tmpnam]; /* internal buffer for name */ + static ushort_t seed = 0; /* used to generate unique name */ + + /* if parameter is NULL use internal buffer */ + if (s == NULL) + s = buf; + + /* generate unique name */ + + strcpy (s, "tmp"); + + /* fill up the name buffer from the last position */ + index = 5; + pos = s + strlen (s) + index; + *pos = '\0'; + + seed++; + for (t = seed; 0 <= --index; t >>= 3) + *--pos = '0' + (t & 07); + + /* return name buffer */ + return (s); + } +/* ungetc.c - return a character to a stream. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, stdlib.h, string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "stdlib.h" +#include "string.h" +#include "objLib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* __submore - internal routine +* +* Expand the ungetc buffer `in place'. That is, adjust fp->_p when +* the buffer moves, so that it points the same distance from the end, +* and move the bytes in the buffer around as necessary so that they +* are all at the end (stack-style). +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* NOMANUAL +*/ + +static int __submore + ( + FAST FILE *fp + ) + { + FAST int i; + FAST uchar_t * p; + + if (fp->_ub._base == fp->_ubuf) + { + /* Get a new buffer (rather than expanding the old one) */ + + if ((p = malloc ((size_t)BUFSIZ)) == NULL) + return (EOF); + + fp->_ub._base = p; + fp->_ub._size = BUFSIZ; + + p += BUFSIZ - sizeof(fp->_ubuf); + + for (i = sizeof(fp->_ubuf); --i >= 0;) + p[i] = fp->_ubuf[i]; + + fp->_p = p; + + return (0); + } + + i = fp->_ub._size; + + p = realloc (fp->_ub._base, i << 1); + + if (p == NULL) + return (EOF); + + (void) bcopy ((void *)p, (void *)(p + i), (size_t)i); + + fp->_p = p + i; + fp->_ub._base = p; + fp->_ub._size = i << 1; + + return (0); + } + +/****************************************************************************** +* +* ungetc - push a character back into an input stream (ANSI) +* +* This routine pushes a character (converted to an `unsigned char') back +* into the specified input stream. The pushed-back characters will be +* returned by subsequent reads on that stream in the reverse order of their +* pushing. A successful intervening call on the stream to a file +* positioning function (fseek(), fsetpos(), or rewind()) discards any +* pushed-back characters for the stream. The external storage corresponding +* to the stream is unchanged. +* +* One character of push-back is guaranteed. If ungetc() is called too many +* times on the same stream without an intervening read or file positioning +* operation, the operation may fail. +* +* If the value of equals EOF, the operation fails and the +* input stream is unchanged. +* +* A successful call to ungetc() clears the end-of-file indicator for the +* stream. The value of the file position indicator for the stream after +* reading or discarding all pushed-back characters is the same as it was +* before the character were pushed back. For a text stream, the value of +* its file position indicator after a successful call to ungetc() is +* unspecified until all pushed-back characters are read or discarded. +* For a binary stream, the file position indicator is decremented by each +* successful call to ungetc(); if its value was zero before a call, it is +* indeterminate after the call. +* +* INCLUDE: stdio.h +* +* RETURNS: +* The pushed-back character after conversion, or EOF if the operation fails. +* +* SEE ALSO: getc(), fgetc() +*/ + +int ungetc + ( + int c, /* character to push */ + FAST FILE * fp /* input stream */ + ) + { + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (EOF); + + if (c == EOF) + return (EOF); + + if ((fp->_flags & __SRD) == 0) + { + /* + * Not already reading: no good unless reading-and-writing. + * Otherwise, flush any current write stuff. + */ + + if ((fp->_flags & __SRW) == 0) + return (EOF); + + if (fp->_flags & __SWR) + { + if (__sflush(fp)) + return (EOF); + + fp->_flags &= ~__SWR; + fp->_w = 0; + fp->_lbfsize = 0; + } + fp->_flags |= __SRD; + } + + c = (uchar_t) c; + + /* + * If we are in the middle of ungetc'ing, just continue. + * This may require expanding the current ungetc buffer. + */ + + if (HASUB(fp)) + { + if (fp->_r >= fp->_ub._size && __submore(fp)) + return (EOF); + + *--fp->_p = c; + fp->_r++; + + return (c); + } + + /* + * If we can handle this by simply backing up, do so, + * but never replace the original character. + * (This makes sscanf() work when scanning `const' data.) + */ + + if ((fp->_bf._base != NULL) && + (fp->_p > fp->_bf._base) && + (fp->_p[-1] == c)) + { + fp->_p--; + fp->_r++; + + return (c); + } + + /* + * Create an ungetc buffer. + * Initially, we will use the `reserve' buffer. + */ + + fp->_ur = fp->_r; + fp->_up = fp->_p; + fp->_ub._base = fp->_ubuf; + fp->_ub._size = sizeof(fp->_ubuf); + fp->_ubuf[sizeof(fp->_ubuf) - 1] = c; + fp->_p = &fp->_ubuf[sizeof(fp->_ubuf) - 1]; + fp->_r = 1; + + return (c); + } +/* vfprintf.c - print to a file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY, use fioFormatV() + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, stdarg.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdarg.h" +#include "fioLib.h" +#include "objLib.h" +#include "private/stdioP.h" + +/* forward declarations */ + +LOCAL STATUS putbuf (char *buffer, int nbytes, FILE *fp); + + +/******************************************************************************* +* +* vfprintf - write a formatted string to a stream (ANSI) +* +* This routine is equivalent to fprintf(), except that it takes the variable +* arguments to be formatted from a list of type `va_list' rather +* than from in-line arguments. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The number of characters written, or a negative value if an +* output error occurs. +* +* SEE ALSO: fprintf() +*/ + +int vfprintf + ( + FILE * fp, /* stream to write to */ + const char * fmt, /* format string */ + va_list vaList /* arguments to format string */ + ) + { + uchar_t localbuf[BUFSIZE]; + int ret; + FILE fake; + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (EOF); + + if (cantwrite (fp)) + return (EOF); + + if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) && fp->_file >= 0) + { + /* + * This optimizes an fprintf to unbuffered unix file by creating a + * temporary buffer. This avoids worries about ungetc buffers and + * so forth. It is particularly useful for stderr. + */ + + fake._flags = fp->_flags & ~__SNBF; /* turn on buffering */ + fake._file = fp->_file; /* store fd */ + fake._bf._base = fake._p = localbuf; /* set up the buffer */ + fake._bf._size = fake._w = sizeof(localbuf); /* initialize size */ + fake._lbfsize = 0; /* init to be safe */ + fake._r = 0; /* init to be safe */ + fake._ub._base = NULL; /* init to be safe */ + fake._ub._size = 0; /* init to be safe */ + fake._lb._base = NULL; /* init to be safe */ + fake._lb._size = 0; /* init to be safe */ + objCoreInit (&fake.objCore, fpClassId); /* validate fake fp */ + + ret = fioFormatV (fmt, vaList, putbuf, (int) &fake); + + if ((ret >= 0) && fflush (&fake)) + ret = EOF; + + if (fake._flags & __SERR) + fp->_flags |= __SERR; + + objCoreTerminate (&fake.objCore); /* invalidate fp */ + } + else + { + ret = fioFormatV (fmt, vaList, putbuf, (int) fp); + ret = (ferror (fp)) ? EOF : ret; + } + + return (ret); + } + +/******************************************************************************* +* +* putbuf - put a buffer on an output stream +* NOMANUAL +*/ + +LOCAL STATUS putbuf + ( + char * buffer, /* source */ + int nbytes, /* number of bytes in source */ + FILE * fp /* stream */ + ) + { + FAST int ix; + + for (ix = 0; ix < nbytes; ix++) + putc (buffer [ix], fp); + + return (OK); + } diff --git a/libc/stdio/clearerr.c b/libc/stdio/clearerr.c new file mode 100644 index 0000000..9077b9d --- /dev/null +++ b/libc/stdio/clearerr.c @@ -0,0 +1,77 @@ +/* clearerr.c - clear error file for stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,05mar93,jdi documentation cleanup for 5.1. +01c,21sep92,smb corrected first line of file. +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION +* Copyright (c) 1990 The Regents of the University of California. +* All rights reserved. +* +* This code is derived from software contributed to Berkeley by +* Chris Torek. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* 1. Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* 2. Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* 3. All advertising materials mentioning features or use of this software +* must display the following acknowledgement: +* This product includes software developed by the University of +* California, Berkeley and its contributors. +* 4. Neither the name of the University nor the names of its contributors +* may be used to endorse or promote products derived from this software +* without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +* SUCH DAMAGE. +* +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" + +#undef clearerr + +/****************************************************************************** +* +* clearerr - clear end-of-file and error flags for a stream (ANSI) +* +* This routine clears the end-of-file and error flags for a specified stream. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: N/A +* +* SEE ALSO: feof(), ferror() +*/ + +void clearerr + ( + FILE * fp /* stream to clear EOF and ERROR flags for */ + ) + { + __sclearerr(fp); + } diff --git a/libc/stdio/fclose.c b/libc/stdio/fclose.c new file mode 100644 index 0000000..1ef712e --- /dev/null +++ b/libc/stdio/fclose.c @@ -0,0 +1,121 @@ +/* fclose.c - close file stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,05feb99,dgp document errno values +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf added OBJ_VERIFY and memory reclaimation. + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, stdlib.h, error.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "errno.h" +#include "stdlib.h" +#include "objLib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* fclose - close a stream (ANSI) +* +* This routine flushes a specified stream and closes the associated file. +* Any unwritten buffered data is delivered to the host environment to be +* written to the file; any unread buffered data is discarded. The stream +* is disassociated from the file. If the associated buffer was allocated +* automatically, it is deallocated. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* Zero if the stream is closed successfully, or EOF if errors occur. +* +* ERRNO: EBADF +* +* SEE ALSO: fflush() +*/ + +int fclose + ( + FAST FILE * fp /* stream to close */ + ) + { + FAST int r; + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (EOF); + + if (fp->_flags == 0) /* not open! */ + { + errno = EBADF; + return (EOF); + } + + r = (fp->_flags & __SWR) ? (__sflush(fp)) : (0); + + if (__sclose (fp) < 0) + r = EOF; + + if (fp->_flags & __SMBF) + free ((char *)fp->_bf._base); + + if (HASUB(fp)) /* ungetc buffer? */ + FREEUB(fp); + + if (HASLB(fp)) /* fgetline buffer? */ + FREELB(fp); + + fp->_flags = 0; /* release this FILE for reuse */ + stdioFpDestroy (fp); /* destroy the file pointer */ + + return (r); + } diff --git a/libc/stdio/fdopen.c b/libc/stdio/fdopen.c new file mode 100644 index 0000000..c2ac4b8 --- /dev/null +++ b/libc/stdio/fdopen.c @@ -0,0 +1,141 @@ +/* fdopen.c - open file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,05feb99,dgp document errno values +01d,07jul93,jmm fixed fdopen to validate the fd (spr 2197) +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: sys/types.h, fcntl.h, unistd.h, stdio.h, errno.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "sys/types.h" +#include "fcntl.h" +#include "unistd.h" +#include "errno.h" +#include "objLib.h" +#include "iosLib.h" +#include "private/stdioP.h" + + +/******************************************************************************* +* +* fdopen - open a file specified by a file descriptor (POSIX) +* +* This routine opens the file specified by the file descriptor and +* associates a stream with it. +* The argument is used just as in the fopen() function. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: A pointer to a stream, or a null pointer if an error occurs, +* with `errno' set to indicate the error. +* +* ERRNO: EINVAL +* +* SEE ALSO: fopen(), freopen(), +* .br +* .I "Information Technology - POSIX - Part 1:" +* .I "System API [C Language], IEEE Std 1003.1" +*/ + +FILE * fdopen + ( + int fd, /* file descriptor */ + const char * mode /* mode to open with */ + ) + { + FAST FILE * fp; + int flags; + int oflags; + + /* validate the file descriptor */ + + if (iosFdValue (fd) == ERROR) + return (NULL); + + if ((flags = __sflags(mode, &oflags)) == 0) + return (NULL); + + /* Make sure the mode the user wants is a subset of the actual mode. */ + +#if FALSE /* XXX */ + if ((fdflags = fcntl(fd, F_GETFL, 0)) < 0) + return (NULL); + + tmp = fdflags & O_ACCMODE; + + if (tmp != O_RDWR && (tmp != (oflags & O_ACCMODE))) + { + errno = EINVAL; + return (NULL); + } +#endif + + if ((fp = stdioFpCreate()) == NULL) + return (NULL); + + fp->_flags = flags; + + /* + * If opened for appending, but underlying descriptor does not have + * O_APPEND bit set, assert __SAPP so that __swrite() will lseek to + * end before each write. + */ + + if ((oflags & O_APPEND) /* XXX && !(fdflags & O_APPEND) */ ) + fp->_flags |= __SAPP; + + fp->_file = fd; + + return (fp); + } diff --git a/libc/stdio/feof.c b/libc/stdio/feof.c new file mode 100644 index 0000000..29355d8 --- /dev/null +++ b/libc/stdio/feof.c @@ -0,0 +1,79 @@ +/* feof.c - end of file indicator function. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,05mar93,jdi documentation cleanup for 5.1. +01c,21sep92,smb tweaks for mg +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" + +#undef feof + +/****************************************************************************** +* +* feof - test the end-of-file indicator for a stream (ANSI) +* +* This routine tests the end-of-file indicator for a specified stream. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* Non-zero if the end-of-file indicator is set for . +* +* SEE ALSO: clearerr() +*/ + +int feof + ( + FILE * fp /* stream to test */ + ) + { + return (__sfeof(fp)); + } diff --git a/libc/stdio/ferror.c b/libc/stdio/ferror.c new file mode 100644 index 0000000..48c9f22 --- /dev/null +++ b/libc/stdio/ferror.c @@ -0,0 +1,77 @@ +/* ferror.c - file error indicator function for stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" + +#undef ferror + +/****************************************************************************** +* +* ferror - test the error indicator for a file pointer (ANSI) +* +* This routine tests the error indicator for the stream pointed to by . +* +* INCLUDE FILES: stdio.h +* +* RETURNS: Non-zero if the error indicator is set for . +* +* SEE ALSO: clearerr() +*/ + +int ferror + ( + FILE * fp /* stream to test */ + ) + { + return (__sferror(fp)); + } diff --git a/libc/stdio/fflush.c b/libc/stdio/fflush.c new file mode 100644 index 0000000..e981fa7 --- /dev/null +++ b/libc/stdio/fflush.c @@ -0,0 +1,165 @@ +/* fflush.c - flush file stdio.h */ + +/* Copyright 1992-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,05feb99,dgp document errno values +01f,10mar95,ism removed SPR#2548 changes. +01e,20jan95,ism changed FIOFLUSH to FIOSYNC +01d,03oct94,ism added FIOFLUSH ioctl to __sflush() as per SPR#2548 +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, error.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "errno.h" +#include "objLib.h" +#include "private/stdioP.h" +#include "sys/ioctl.h" +#include "ioLib.h" + +/****************************************************************************** +* +* fflush - flush a stream (ANSI) +* +* This routine writes to the file any unwritten data for a specified output +* or update stream for which the most recent operation was not input; for an +* input stream the behavior is undefined. +* +* CAVEAT +* ANSI specifies that if is a null pointer, fflush() performs the +* flushing action on all streams for which the behavior is defined; however, +* this is not implemented in VxWorks. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: Zero, or EOF if a write error occurs. +* +* ERRNO: EBADF +* +* SEE ALSO: fclose() +*/ + +int fflush + ( + FAST FILE * fp /* stream to flush */ + ) + { + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (EOF); + + /* ANSI specifies that fflush (NULL) will flush all task's file pointers. + * The problem is that we don't keep such a list today so we return EOF + * for now. + */ + + if ((fp == NULL) || + ((fp->_flags & __SWR) == 0)) + { + errno = EBADF; + return (EOF); + } + + return (__sflush(fp)); + } + +/****************************************************************************** +* +* __sflush - flush stream pointed to by fp. +* +* INCLUDE: stdio.h +* +* RETURNS: ZERO or EOF +* NOMANUAL +*/ + +int __sflush + ( + FAST FILE *fp + ) + { + FAST unsigned char *p; + FAST int n; + FAST int t; + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (EOF); + + t = fp->_flags; + + if ((t & __SWR) == 0) + return (0); + + if ((p = fp->_bf._base) == NULL) + return (0); + + n = fp->_p - p; /* write this much */ + + /* Set these immediately to avoid problems with longjmp and to allow + * exchange buffering (via setvbuf) in user write function. + */ + + fp->_p = p; + fp->_w = (t & (__SLBF|__SNBF)) ? (0) : (fp->_bf._size); + + for (; n > 0; n -= t, p += t) + { + t = __swrite (fp, (char *)p, n); + if (t <= 0) + { + fp->_flags |= __SERR; + return (EOF); + } + } + + return (0); + } diff --git a/libc/stdio/fgetc.c b/libc/stdio/fgetc.c new file mode 100644 index 0000000..e1aa37f --- /dev/null +++ b/libc/stdio/fgetc.c @@ -0,0 +1,86 @@ +/* fgetc.c - get character from file -- stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +------------------- +01d,05mar93,jdi documentation cleanup for 5.1. +01c,13oct92,jdi mangen fixes. +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "private/stdioP.h" + +/****************************************************************************** +* +* fgetc - return the next character from a stream (ANSI) +* +* This routine returns the next character (converted to an `int') from the +* specified stream, and advances the file position indicator for the stream. +* +* If the stream is at end-of-file, the end-of-file indicator for the stream is +* set; if a read error occurs, the error indicator is set. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The next character from the stream, or EOF if the stream is at end-of-file +* or a read error occurs. +* +* SEE ALSO: fgets(), getc() +*/ + +int fgetc + ( + FILE * fp /* stream to read from */ + ) + { + return (getc(fp)); + } diff --git a/libc/stdio/fgetpos.c b/libc/stdio/fgetpos.c new file mode 100644 index 0000000..7f950bc --- /dev/null +++ b/libc/stdio/fgetpos.c @@ -0,0 +1,56 @@ +/* fgetpos.c - get position in file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "objLib.h" + + +/****************************************************************************** +* +* fgetpos - store the current value of the file position indicator for a stream (ANSI) +* +* This routine stores the current value of the file position indicator for a +* specified stream in the object pointed to by . The value stored +* contains unspecified information usable by fsetpos() for repositioning +* the stream to its position at the time fgetpos() was called. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* Zero, or non-zero if unsuccessful, with `errno' set to indicate the error. +* +* SEE ALSO: fsetpos() +*/ + +int fgetpos + ( + FILE * fp, /* stream */ + fpos_t * pos /* where to store position */ + ) + { + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (ERROR); + + return (!((*pos = ftell (fp)) != (fpos_t) -1)); + } diff --git a/libc/stdio/fgets.c b/libc/stdio/fgets.c new file mode 100644 index 0000000..350c6a5 --- /dev/null +++ b/libc/stdio/fgets.c @@ -0,0 +1,158 @@ +/* fgets.c - Read lines of text from a stream. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "string.h" +#include "objLib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* fgets - read a specified number of characters from a stream (ANSI) +* +* This routine stores in the array up to -1 characters from a +* specified stream. No additional characters are read after a new-line or +* end-of-line. A null character is written immediately after the last +* character read into the array. +* +* If end-of-file is encountered and no characters have been read, the +* contents of the array remain unchanged. If a read error occurs, the array +* contents are indeterminate. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* A pointer to , or a null pointer if an error occurs or end-of-file is +* encountered and no characters have been read. +* +* SEE ALSO: fread(), fgetc() +*/ + +char * fgets + ( + char * buf, /* where to store characters */ + FAST size_t n, /* no. of bytes to read + 1 */ + FAST FILE * fp /* stream to read from */ + ) + { + FAST size_t len; + FAST char * s; + FAST uchar_t * p; + FAST uchar_t * t; + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (NULL); + + if (n < 2) /* sanity check */ + return (NULL); + + s = buf; + n--; /* leave space for NULL */ + + do + { + if ((len = fp->_r) <= 0) /* If the buffer is empty, refill it */ + { + if (__srefill(fp)) /* EOF/error: partial or no line */ + { + if (s == buf) + return (NULL); + break; + } + len = fp->_r; + } + + p = fp->_p; + + /* + * Scan through at most n bytes of the current buffer, + * looking for '\n'. If found, copy up to and including + * newline, and stop. Otherwise, copy entire chunk + * and loop. + */ + + if (len > n) + len = n; + + t = memchr ((void *)p, '\n', len); + + if (t != NULL) + { + len = ++t - p; + fp->_r -= len; + fp->_p = t; + (void) bcopy ((void *)p, (void *)s, len); + s[len] = 0; + + return (buf); + } + + fp->_r -= len; + fp->_p += len; + + (void) bcopy ((void *)p, (void *)s, len); + + s += len; + + } while ((n -= len) != 0); + + *s = 0; + + return (buf); + } diff --git a/libc/stdio/fileno.c b/libc/stdio/fileno.c new file mode 100644 index 0000000..46b2a3c --- /dev/null +++ b/libc/stdio/fileno.c @@ -0,0 +1,92 @@ +/* fileno.c - determine file number for stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "objLib.h" +#include "private/stdioP.h" + +#undef fileno + +/****************************************************************************** +* +* fileno - return the file descriptor for a stream (POSIX) +* +* This routine returns the file descriptor associated with a specified +* stream. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The file descriptor, or -1 if an error occurs, with `errno' set to indicate +* the error. +* +* SEE ALSO: +* .br +* .I "Information Technology - POSIX - Part 1:" +* .I "System API [C Language], IEEE Std 1003.1" +*/ + +int fileno + ( + FILE * fp /* stream */ + ) + { + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (ERROR); + + return (__sfileno(fp)); + } diff --git a/libc/stdio/flags.c b/libc/stdio/flags.c new file mode 100644 index 0000000..d83028f --- /dev/null +++ b/libc/stdio/flags.c @@ -0,0 +1,142 @@ +/* flags.c - internal routines for flags manipulation. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,27feb93,smb added error checking for incorrect modes +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, sys/types.h, errno.h, fcntl.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "sys/types.h" +#include "errno.h" +#include "fcntl.h" + + +/****************************************************************************** +* +* __sflags - return flags for a given mode. +* +* Return the (stdio) flags for a given mode. Store the flags +* to be passed to an open() syscall through *optr. +* Return 0 on error. +* +* INCLUDE: stdio.h +* +* RETURNS: flags or ZERO +* NOMANUAL +*/ + +int __sflags + ( + FAST char * mode, + int * optr + ) + { + FAST int ret; + FAST int m; + FAST int o; + + switch (*mode++) + { + case 'r': /* open for reading */ + ret = __SRD; + m = O_RDONLY; + o = 0; + break; + + case 'w': /* open for writing */ + ret = __SWR; + m = O_WRONLY; + o = O_CREAT | O_TRUNC; + break; + + case 'a': /* open for appending */ + ret = __SWR; + m = O_WRONLY; + o = O_CREAT | O_APPEND; + break; + + default: /* illegal mode */ + errno = EINVAL; + return (0); + } + + /* [rwa]\+ or [rwa]b\+ means read and write */ + + if ((*mode == '+') || (*mode == 'b' && mode[1] == '+')) + { + ret = __SRW; + m = O_RDWR; + } + + *optr = m | o; + + /* check for garbage in second character */ + if ((*mode != '+') && (*mode != 'b') && (*mode != '\0')) + return (0); + + /* check for garbage in third character */ + if (*mode++ == '\0') + return (ret); /* no third char */ + + if ((*mode != '+') && (*mode != 'b') && (*mode != '\0')) + return (0); + + /* check for garbage in fourth character */ + if (*mode++ == '\0') + return (ret); /* no fourth char */ + + if (*mode != '\0') + return (0); + else + return (ret); + } diff --git a/libc/stdio/fopen.c b/libc/stdio/fopen.c new file mode 100644 index 0000000..a5a4dc4 --- /dev/null +++ b/libc/stdio/fopen.c @@ -0,0 +1,177 @@ +/* fopen.c - open a file. stdio.h */ + +/* Copyright 1992-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,10feb95,jdi doc format tweak. +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf modified to use stdioFpCreate and close memory leaks. + smb taken from UCB stdio. +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, error.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "sys/types.h" +#include "sys/stat.h" +#include "ioLib.h" +#include "fcntl.h" +#include "errno.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* fopen - open a file specified by name (ANSI) +* +* This routine opens a file whose name is the string pointed to by +* and associates a stream with it. +* The argument points to a string beginning with one of the following +* sequences: +* .iP r "" 3 +* open text file for reading +* .iP w +* truncate to zero length or create text file for writing +* .iP a +* append; open or create text file for writing at end-of-file +* .iP rb +* open binary file for reading +* .iP wb +* truncate to zero length or create binary file for writing +* .iP ab +* append; open or create binary file for writing at end-of-file +* .iP r+ +* open text file for update (reading and writing) +* .iP w+ +* truncate to zero length or create text file for update. +* .iP a+ +* append; open or create text file for update, writing at end-of-file +* .iP "r+b / rb+" +* open binary file for update (reading and writing) +* .iP "w+b / wb+" +* truncate to zero length or create binary file for update +* .iP "a+b / ab+" +* append; open or create binary file for update, writing at end-of-file +* .LP +* +* Opening a file with read mode (`r' as the first character in the +* argument) fails if the file does not exist or cannot be read. +* +* Opening a file with append mode (`a' as the first character in the +* argument) causes all subsequent writes to the file to be forced to the +* then current end-of-file, regardless of intervening calls to fseek(). In +* some implementations, opening a binary file with append mode (`b' as the +* second or third character in the argument) may initially position +* the file position indicator for the stream beyond the last data written, +* because of null character padding. In VxWorks, whether append mode is +* supported is device-specific. +* +* When a file is opened with update mode (`+' as the second or third +* character in the argument), both input and output may be performed +* on the associated stream. However, output may not be directly followed by +* input without an intervening call to fflush() or to a file positioning +* function (fseek(), fsetpos(), or rewind()), and input may not be directly +* followed by output without an intervening call to a file positioning +* function, unless the input operation encounters end-of-file. Opening (or +* creating) a text file with update mode may instead open (or create) a +* binary stream in some implementations. +* +* When opened, a stream is fully buffered if and only if it can be determined +* not to refer to an interactive device. The error and end-of-file +* indicators for the stream are cleared. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* A pointer to the object controlling the stream, or a null pointer if the +* operation fails. +* +* SEE ALSO: fdopen(), freopen() +*/ + +FILE * fopen + ( + const char * file, /* name of file */ + const char * mode /* mode */ + ) + { + FAST FILE * fp; + FAST int f; + int flags; + int oflags; + + if ((flags = __sflags (mode, &oflags)) == 0) + return (NULL); + + if ((fp = stdioFpCreate ()) == NULL) + return (NULL); + + if ((f = open (file, oflags, DEFFILEMODE )) < 0) + { + fp->_flags = 0x0; /* release */ + stdioFpDestroy (fp); /* destroy file pointer */ + return (NULL); + } + + fp->_file = f; + fp->_flags = flags; + + /* + * When opening in append mode, even though we use O_APPEND, + * we need to seek to the end so that ftell() gets the right + * answer. If the user then alters the seek pointer, or + * the file extends, this will fail, but there is not much + * we can do about this. (We could set __SAPP and check in + * fseek and ftell.) + */ + + if (oflags & O_APPEND) + (void) __sseek ((void *)fp, (fpos_t)0, SEEK_END); + + return (fp); + } diff --git a/libc/stdio/fprintf.c b/libc/stdio/fprintf.c new file mode 100644 index 0000000..0c90e87 --- /dev/null +++ b/libc/stdio/fprintf.c @@ -0,0 +1,283 @@ +/* fprintf.c - print to a file. stdio.h */ + +/* Copyright 1992-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,24jan95,rhp doc: avoid 'L' in fprintf(), no long doubles + in VxWorks (see SPR#3886) +01d,19jul94,dvs doc tweak (SPR #2512). +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, stdarg.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdarg.h" +#include "fioLib.h" +#include "objLib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* fprintf - write a formatted string to a stream (ANSI) +* +* This routine writes output to a specified stream under control of the string +* . The string contains ordinary characters, which are written +* unchanged, plus conversion specifications, which cause the arguments that +* follow to be converted and printed as part of the formatted string. +* +* The number of arguments for the format is arbitrary, but they must +* correspond to the conversion specifications in . If there are +* insufficient arguments, the behavior is undefined. If the format is +* exhausted while arguments remain, the excess arguments are evaluated but +* otherwise ignored. The routine returns when the end of the format string +* is encountered. +* +* The format is a multibyte character sequence, beginning and ending in its +* initial shift state. The format is composed of zero or more directives: +* ordinary multibyte characters (not `%') that are copied unchanged to the +* output stream; and conversion specification, each of which results in +* fetching zero or more subsequent arguments. Each conversion specification +* is introduced by the `%' character. After the `%', the following appear in +* sequence: +* .iP "" 4 +* Zero or more flags (in any order) that modify the meaning of the +* conversion specification. +* .iP +* An optional minimum field width. If the converted value has fewer +* characters than the field width, it will be padded with spaces (by +* default) on the left (or right, if the left adjustment flag, +* described later, has been given) to the field width. The field +* width takes the form of an asterisk (`*') (described later) or a decimal +* integer. +* .iP +* An optional precision that gives the minimum number of digits to +* appear for the `d', `i', `o', `u', `x', and `X' conversions, the number of +* digits to appear after the decimal-point character for `e', `E', and `f' +* conversions, the maximum number of significant digits for the `g' and +* `G' conversions, or the maximum number of characters to be written +* from a string in the `s' conversion. The precision takes the form of a +* period (`.') followed either by an asterisk (`*') (described later) or by +* an optional decimal integer; if only the period is specified, the +* precision is taken as zero. If a precision appears with any other +* conversion specifier, the behavior is undefined. +* .iP +* An optional `h' specifying that a following `d', `i', `o', `u', `x', and +* `X' conversion specifier applies to a `short int' or `unsigned short int' +* argument (the argument will have been promoted according to the integral +* promotions, and its value converted to `short int' or +* `unsigned short int' before printing); an optional `h' specifying that a +* following `n' conversion specifier applies to a pointer to a `short int' +* argument; an optional `l' (el) specifying that a following `d', `i', `o', +* `u', `x', and `X' conversion specifier applies to a `long int' or +* `unsigned long int' argument; or an optional `l' specifying that a following +* `n' conversion specifier applies to a pointer to a `long int' +* argument. If an `h' or `l' appears with any other conversion +* specifier, the behavior is undefined. +* +* \&WARNING: ANSI C also specifies an optional `L' in some of the same +* contexts as `l' above, corresponding to a `long double' argument. +* However, the current release of the VxWorks libraries does not support +* `long double' data; using the optional `L' gives unpredictable results. +* .iP +* A character that specifies the type of conversion to be applied. +* .LP +* +* As noted above, a field width, or precision, or both, can be indicated by +* an asterisk (`*'). In this case, an `int' argument supplies the field width +* or precision. The arguments specifying field width, or precision, or both, +* should appear (in that order) before the argument (if any) to be converted. +* A negative field width argument is taken as a `-' flag followed by a positive +* field width. A negative precision argument is taken as if the precision +* were omitted. +* +* The flag characters and their meanings are: +* .iP `-' +* The result of the conversion will be left-justified within the field. +* (it will be right-justified if this flag is not specified.) +* .iP `+' +* The result of a signed conversion will always begin with a plus or +* minus sign. (It will begin with a sign only when a negative value +* is converted if this flag is not specified.) +* .iP `space' +* If the first character of a signed conversion is not a sign, or +* if a signed conversion results in no characters, a space will be +* prefixed to the result. If the `space' and `+' flags both appear, the +* `space' flag will be ignored. +* .iP `#' +* The result is to be converted to an "alternate form." For `o' conversion +* it increases the precision to force the first digit of the result to be a +* zero. For `x' (or `X') conversion, a non-zero result will have "0x" (or +* "0X") prefixed to it. For `e', `E', `f', `g', and `G' conversions, the +* result will always contain a decimal-point character, even if no digits +* follow it. (Normally, a decimal-point character appears in the result of +* these conversions only if no digit follows it). For `g' and `G' +* conversions, trailing zeros will not be removed from the result. For +* other conversions, the behavior is undefined. +* .iP `0' +* For `d', `i', `o', `u', `x', `X', `e', `E', `f', `g', and `G' conversions, +* leading zeros (following any indication of sign or base) are used to pad +* to the field width; no space padding is performed. If the `0' and `-' +* flags both appear, the `0' flag will be ignored. For `d', `i', `o', `u', +* `x', and `X' conversions, if a precision is specified, the `0' flag will +* be ignored. For other conversions, the behavior is undefined. +* .LP +* +* The conversion specifiers and their meanings are: +* .iP "`d', `i'" +* The `int' argument is converted to signed decimal in the style +* `[-]dddd'. The precision specifies the minimum number of digits +* to appear; if the value being converted can be represented in +* fewer digits, it will be expanded with leading zeros. The +* default precision is 1. The result of converting a zero value +* with a precision of zero is no characters. +* .iP "`o', `u', `x', `X'" +* The `unsigned int' argument is converted to unsigned octal (`o'), +* unsigned decimal (`u'), or unsigned hexadecimal notation (`x' or `X') +* in the style `dddd'; the letters abcdef are used for `x' conversion +* and the letters ABCDEF for `X' conversion. The precision specifies +* the minimum number of digits to appear; if the value being +* converted can be represented in fewer digits, it will be +* expanded with leading zeros. The default precision is 1. The +* result of converting a zero value with a precision of zero is +* no characters. +* .iP `f' +* The `double' argument is converted to decimal notation in the +* style `[-]ddd.ddd', where the number of digits after the decimal +* point character is equal to the precision specification. If the +* precision is missing, it is taken as 6; if the precision is zero +* and the `#' flag is not specified, no decimal-point character +* appears. If a decimal-point character appears, at least one +* digit appears before it. The value is rounded to the appropriate +* number of digits. +* .iP "`e', `E'" +* The `double' argument is converted in the style `[-]d.ddde+/-dd', +* where there is one digit before the decimal-point character +* (which is non-zero if the argument is non-zero) and the number +* of digits after it is equal to the precision; if the precision +* is missing, it is taken as 6; if the precision is zero and the +* `#' flag is not specified, no decimal-point character appears. The +* value is rounded to the appropriate number of digits. The `E' +* conversion specifier will produce a number with `E' instead of `e' +* introducing the exponent. The exponent always contains at least +* two digits. If the value is zero, the exponent is zero. +* .iP "`g', `G'" +* The `double' argument is converted in style `f' or `e' (or in style +* `E' in the case of a `G' conversion specifier), with the precision +* specifying the number of significant digits. If the precision +* is zero, it is taken as 1. The style used depends on the +* value converted; style `e' (or `E') will be used only if the +* exponent resulting from such a conversion is less than -4 or +* greater than or equal to the precision. Trailing zeros are +* removed from the fractional portion of the result; a decimal-point +* character appears only if it is followed by a digit. +* .iP `c' +* The `int' argument is converted to an `unsigned char', and the +* resulting character is written. +* .iP `s' +* The argument should be a pointer to an array of character type. +* Characters from the array are written up to (but not including) +* a terminating null character; if the precision is specified, +* no more than that many characters are written. If the precision +* is not specified or is greater than the size of the array, the +* array will contain a null character. +* .iP `p' +* The argument should be a pointer to `void'. The value of the +* pointer is converted to a sequence of printable characters, +* in hexadecimal representation (prefixed with "0x"). +* .iP `n' +* The argument should be a pointer to an integer into which +* the number of characters written to the output stream +* so far by this call to fprintf() is written. No argument is converted. +* .iP `%' +* A `%' is written. No argument is converted. The complete +* conversion specification is %%. +* .LP +* +* If a conversion specification is invalid, the behavior is undefined. +* +* If any argument is, or points to, a union or an aggregate (except for an +* array of character type using `s' conversion, or a pointer using `p' +* conversion), the behavior is undefined. +* +* In no case does a non-existent or small field width cause truncation of a +* field if the result of a conversion is wider than the field width, the +* field is expanded to contain the conversion result. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The number of characters written, or a negative value if an +* output error occurs. +* +* SEE ALSO: printf() +*/ + +int fprintf + ( + FILE * fp, /* stream to write to */ + const char * fmt, /* format string */ + ... /* optional arguments to format string */ + ) + { + int ret; + va_list vaList; + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (ERROR); + + va_start (vaList, fmt); + + ret = vfprintf (fp, fmt, vaList); + + va_end (vaList); + + return (ret); + } diff --git a/libc/stdio/fputc.c b/libc/stdio/fputc.c new file mode 100644 index 0000000..656b7ab --- /dev/null +++ b/libc/stdio/fputc.c @@ -0,0 +1,87 @@ +/* fputc.c - put a character to a file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* fputc - write a character to a stream (ANSI) +* +* This routine writes a character to a specified stream, at the +* position indicated by the stream's file position indicator +* (if defined), and advances the indicator appropriately. +* +* If the file cannot support positioning requests, or if the stream was opened +* in append mode, the character is appended to the output stream. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The character written, or EOF if a write error occurs, with the error +* indicator set for the stream. +* +* SEE ALSO: fputs(), putc() +*/ + +int fputc + ( + int c, /* character to write */ + FAST FILE * fp /* stream to write to */ + ) + { + return (putc (c, fp)); + } diff --git a/libc/stdio/fputs.c b/libc/stdio/fputs.c new file mode 100644 index 0000000..f33da1a --- /dev/null +++ b/libc/stdio/fputs.c @@ -0,0 +1,97 @@ +/* fputs.c - put a string of characters to a file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "string.h" +#include "objLib.h" +#include "private/fvwriteP.h" + + +/****************************************************************************** +* +* fputs - write a string to a stream (ANSI) +* +* This routine writes the string , minus the terminating NULL character, +* to a specified stream. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* A non-negative value, or EOF if a write error occurs. +* +* SEE ALSO: fputc() +*/ + +int fputs + ( + const char * s, /* string */ + FILE * fp /* stream to write to */ + ) + { + struct __suio uio; + struct __siov iov; + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (EOF); + + iov.iov_base = (void *)s; + iov.iov_len = uio.uio_resid = strlen (s); + uio.uio_iov = &iov; + uio.uio_iovcnt = 1; + + return (__sfvwrite (fp, &uio)); + } diff --git a/libc/stdio/fread.c b/libc/stdio/fread.c new file mode 100644 index 0000000..c73cf80 --- /dev/null +++ b/libc/stdio/fread.c @@ -0,0 +1,157 @@ +/* fread.c - read a file. stdio.h */ + +/* Copyright 1992-2002 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,21jan02,jkf SPR#72774, fread is checking for NULL on wrong arg +01e,12dec01,jkf fixing SPR#72128, fread should check for NULL before bcopy +01d,10nov01,jkf SPR#70967, fread returns wrong value when 3rd arg == 0 +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "string.h" +#include "objLib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* fread - read data into an array (ANSI) +* +* This routine reads, into the array , up to elements of size +* , from a specified stream . The file position indicator for the +* stream (if defined) is advanced by the number of characters successfully +* read. If an error occurs, the resulting value of the file position +* indicator for the stream is indeterminate. If a partial element is read, +* its value is indeterminate. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The number of elements successfully read, which may be less than +* if a read error or end-of-file is encountered; or zero if or +* is zero, with the contents of the array and the state of the +* stream remaining unchanged. +*/ + +int fread + ( + void * buf, /* where to copy data */ + size_t size, /* element size */ + size_t count, /* no. of elements */ + FAST FILE * fp /* stream to read from */ + ) + { + FAST size_t resid; + FAST char * p; + FAST int r; + size_t total; + + /* SPR#72128, check for NULL args before bcopy */ + + if ((NULL == fp) || (NULL == buf)) + { + return (0); + } + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (0); + + /* + * SPR#70967: fread returns wrong value when 3rd arg == 0 + * + * ANSI specification declares fread() returns zero if size + * _or_ count is zero. But the vxWorks implementation returned + * non-zero given the following input case: + * + * fread ( buf , 0 ,1 ,fp ); + * + * Old (broken) code: + * + * if ((resid = (count * size)) == 0) + * return (count); + * + * New (fixed) code: + * + * if (0 == (resid = (count * size))) + * return (0); + */ + + if (0 == (resid = (count * size))) + return (0); + + if (fp->_r < 0) + fp->_r = 0; + + total = resid; + p = buf; + + while (resid > (r = fp->_r)) + { + (void) bcopy ((void *)fp->_p, (void *)p, (size_t)r); + + fp->_p += r; + p += r; + resid -= r; + + if (__srefill (fp)) /* fp->_r = 0 is done */ + return ((total - resid) / size); /* partial result */ + } + + (void) bcopy ((void *)fp->_p, (void *)p, resid); + + fp->_r -= resid; + fp->_p += resid; + + return (count); + } diff --git a/libc/stdio/freopen.c b/libc/stdio/freopen.c new file mode 100644 index 0000000..ec2fb8a --- /dev/null +++ b/libc/stdio/freopen.c @@ -0,0 +1,193 @@ +/* freopen.c - reopen a file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf added memory reclaimation. + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, sys/types.h, sys/stat.h, fcntl.h, error.h, unistd.h, + stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "ioLib.h" +#include "sys/types.h" +#include "sys/stat.h" +#include "fcntl.h" +#include "errno.h" +#include "unistd.h" +#include "stdlib.h" +#include "objLib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* freopen - open a file specified by name (ANSI) +* +* This routine opens a file whose name is the string pointed to by +* and associates it with a specified stream . +* The argument is used just as in the fopen() function. +* +* This routine first attempts to close any file that is associated +* with the specified stream. Failure to close the file successfully is +* ignored. The error and end-of-file indicators for the stream are cleared. +* +* Typically, freopen() is used to attach the already-open streams +* `stdin', `stdout', and `stderr' to other files. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The value of , or a null pointer if the open operation fails. +* +* SEE ALSO: fopen() +*/ + +FILE * freopen + ( + const char * file, /* name of file */ + const char * mode, /* mode */ + FAST FILE * fp /* stream */ + ) + { + FAST int f; + int flags; + int oflags; + int sverrno; + BOOL isopen = TRUE; /* its already open */ + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (NULL); + + if ((flags = __sflags (mode, &oflags)) == 0) + { + (void) fclose (fp); + return (NULL); + } + + /* + * There are actually programs that depend on being able to "freopen" + * descriptors that weren't originally open. Keep this from breaking. + * Remember whether the stream was open to begin with, and which file + * descriptor (if any) was associated with it. If it was attached to + * a descriptor, defer closing it; freopen("/dev/stdin", "r", stdin) + * should work. This is unnecessary if it was not a Unix file. + */ + + if (fp->_flags & __SWR) /* flush the stream though */ + (void) __sflush(fp); /* ANSI doesn't require this */ + + if (fp->_file < 0) /* need to close the fp? */ + { + (void) __sclose (fp); + isopen = FALSE; + } + + /* Get a new descriptor to refer to the new file. */ + + f = open (file, oflags, DEFFILEMODE); + + if ((f < 0) && isopen) + { + /* If out of fd's close the old one and try again. */ + + if ((errno == ENFILE) || (errno == EMFILE)) + { + (void) __sclose (fp); + isopen = FALSE; + f = open (file, oflags, DEFFILEMODE); + } + } + + sverrno = errno; + + /* + * Finish closing fp. Even if the open succeeded above, we cannot + * keep fp->_base: it may be the wrong size. This loses the effect + * of any setbuffer calls, but stdio has always done this before. + */ + + if (isopen) + (void) __sclose (fp); + + if (fp->_flags & __SMBF) + free ((char *)fp->_bf._base); + + fp->_w = 0; + fp->_r = 0; + fp->_p = NULL; + fp->_bf._base = NULL; + fp->_bf._size = 0; + fp->_lbfsize = 0; + + if (HASUB(fp)) + FREEUB(fp); + + fp->_ub._size = 0; + + if (HASLB(fp)) + FREELB(fp); + + fp->_lb._size = 0; + + if ((f < 0) && (fp->_flags != 0)) + { /* did not get it after all */ + fp->_flags = 0; /* set it free */ + stdioFpDestroy (fp); /* destroy file pointer */ + errno = sverrno; /* restore in case _close clobbered */ + return (NULL); + } + + fp->_flags = flags; + fp->_file = f; + + return (fp); + } diff --git a/libc/stdio/fscanf.c b/libc/stdio/fscanf.c new file mode 100644 index 0000000..5ade6de --- /dev/null +++ b/libc/stdio/fscanf.c @@ -0,0 +1,286 @@ +/* fscanf.c - scan a file. stdio.h */ + +/* Copyright 1992-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,24jan95,rhp doc: avoid 'L' in fscanf(), no long doubles + in VxWorks (see SPR#3886) +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, stdarg.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "fioLib.h" +#include "stdarg.h" +#include "objLib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* fscanf - read and convert characters from a stream (ANSI) +* +* This routine reads characters from a specified stream, and interprets them +* according to format specifications in the string , which specifies +* the admissible input sequences and how they are to be converted for +* assignment, using subsequent arguments as pointers to the objects to +* receive the converted input. +* +* If there are insufficient arguments for the format, the behavior is +* undefined. If the format is exhausted while arguments remain, the excess +* arguments are evaluated but are otherwise ignored. +* +* The format is a multibyte character sequence, beginning and ending in +* its initial shift state. The format is composed of zero or more directives: +* one or more white-space characters; an ordinary multibyte character (neither +* `%' nor a white-space character); or a conversion specification. Each +* conversion specification is introduced by the `%' character. After the `%', +* the following appear in sequence: +* +* .iP "" 4 +* An optional assignment-suppressing character `*'. +* .iP +* An optional non-zero decimal integer that specifies the maximum field +* width. +* .iP +* An optional `h' or `l' (el) indicating the size of the receiving +* object. The conversion specifiers `d', `i', and `n' should be preceded by +* `h' if the corresponding argument is a pointer to `short int' rather +* than a pointer to `int', or by `l' if it is a pointer to `long int'. +* Similarly, the conversion specifiers `o', `u', and `x' shall be preceded +* by `h' if the corresponding argument is a pointer to `unsigned short int' +* rather than a pointer to `unsigned int', or by `l' if it is a pointer to +* `unsigned long int'. Finally, the conversion specifiers `e', `f', and `g' +* shall be preceded by `l' if the corresponding argument is a pointer to +* `double' rather than a pointer to `float'. If an `h' or `l' appears +* with any other conversion specifier, the behavior is undefined. +* +* \&WARNING: ANSI C also specifies an optional `L' in some of the same +* contexts as `l' above, corresponding to a `long double *' argument. +* However, the current release of the VxWorks libraries does not support +* `long double' data; using the optional `L' gives unpredictable results. +* .iP +* A character that specifies the type of conversion to be applied. The +* valid conversion specifiers are described below. +* .LP +* +* The fscanf() routine executes each directive of the format in turn. If a +* directive fails, as detailed below, fscanf() returns. Failures +* are described as input failures (due to the unavailability of input +* characters), or matching failures (due to inappropriate input). +* +* A directive composed of white-space character(s) is executed by reading +* input up to the first non-white-space character (which remains unread), +* or until no more characters can be read. +* +* A directive that is an ordinary multibyte character is executed by reading +* the next characters of the stream. If one of the characters differs from +* one comprising the directive, the directive fails, and the differing and +* subsequent characters remain unread. +* +* A directive that is a conversion specification defines a set of matching +* input sequences, as described below for each specifier. A conversion +* specification is executed in the following steps: +* +* Input white-space characters (as specified by the isspace() function) are +* skipped, unless the specification includes a `[', `c', or `n' specifier. +* +* An input item is read from the stream, unless the specification includes +* an `n' specifier. An input item is defined as the longest matching +* sequence of input characters, unless that exceeds a specified field width, +* in which case it is the initial subsequence of that length in the +* sequence. The first character, if any, after the input item remains +* unread. If the length of the input item is zero, the execution of the +* directive fails: this condition is a matching failure, unless an error +* prevented input from the stream, in which case it is an input failure. +* +* Except in the case of a `%' specifier, the input item is converted to a +* type appropriate to the conversion specifier. If the input item is not a +* matching sequence, the execution of the directive fails: this condition +* is a matching failure. Unless assignment suppression was indicated by a +* `*', the result of the conversion is placed in the object pointed to by +* the first argument following the argument that has not already +* received a conversion result. If this object does not have an appropriate +* type, or if the result of the conversion cannot be represented in the +* space provided, the behavior is undefined. +* +* The following conversion specifiers are valid: +* +* .iP `d' +* Matches an optionally signed decimal integer whose format is +* the same as expected for the subject sequence of the strtol() +* function with the value 10 for the argument. The +* corresponding argument should be a pointer to `int'. +* .iP `i' +* Matches an optionally signed integer, whose format is the +* same as expected for the subject sequence of the strtol() +* function with the value 0 for the argument. The +* corresponding argument should be a pointer to `int'. +* .iP `o' +* Matches an optionally signed octal integer, whose format is the +* same as expected for the subject sequence of the strtoul() +* function with the value 8 for the argument. The +* corresponding argument should be a pointer to `unsigned int'. +* .iP `u' +* Matches an optionally signed decimal integer, whose format is +* the same as expected for the subject sequence of the strtoul() +* function with the value 10 for the argument. The +* corresponding argument should be a pointer to `unsigned int'. +* .iP `x' +* Matches an optionally signed hexadecimal integer, whose format is +* the same as expected for the subject sequence of the strtoul() +* function with the value 16 for the argument. The +* corresponding argument should be a pointer to `unsigned int'. +* .iP "`e', `f', `g'" +* Match an optionally signed floating-point number, whose format +* is the same as expected for the subject string of the strtod() +* function. The corresponding argument should be a pointer to `float'. +* .iP `s' +* Matches a sequence of non-white-space characters. The +* corresponding argument should be a pointer to the initial +* character of an array large enough to accept the sequence +* and a terminating null character, which will be added +* automatically. +* .iP `[' +* Matches a non-empty sequence of characters from a set of +* expected characters (the `scanset'). The corresponding argument +* should be a pointer to the initial character of an array large +* enough to accept the sequence and a terminating null character, +* which is added automatically. The conversion specifier +* includes all subsequent character in the format string, up to +* and including the matching right bracket (`]'). The characters +* between the brackets (the `scanlist') comprise the scanset, +* unless the character after the left bracket is a circumflex (`^') +* in which case the scanset contains all characters that do not +* appear in the scanlist between the circumflex and the right +* bracket. If the conversion specifier begins with "[]" or "[^]", the +* right bracket character is in the scanlist and the next +* right bracket character is the matching right bracket that ends +* the specification; otherwise the first right bracket character +* is the one that ends the specification. +* .iP `c' +* Matches a sequence of characters of the number specified by the +* field width (1 if no field width is present in the directive). +* The corresponding argument should be a pointer to the initial +* character of an array large enough to accept the sequence. +* No null character is added. +* .iP `p' +* Matches an implementation-defined set of sequences, which should be +* the same as the set of sequences that may be produced by the %p +* conversion of the fprintf() function. The corresponding argument +* should be a pointer to a pointer to `void'. VxWorks defines its +* pointer input field to be consistent with pointers written by the +* fprintf() function ("0x" hexadecimal notation). If the input item is +* a value converted earlier during the same program execution, the +* pointer that results should compare equal to that value; otherwise +* the behavior of the %p conversion is undefined. +* .iP `n' +* No input is consumed. The corresponding argument should be a pointer to +* `int' into which the number of characters read from the input stream so +* far by this call to fscanf() is written. Execution of a %n directive does +* not increment the assignment count returned when fscanf() completes +* execution. +* .iP `%' +* Matches a single `%'; no conversion or assignment occurs. The +* complete conversion specification is %%. +* .LP +* +* If a conversion specification is invalid, the behavior is undefined. +* +* The conversion specifiers `E', `G', and `X' are also valid and behave the +* same as `e', `g', and `x', respectively. +* +* If end-of-file is encountered during input, conversion is terminated. If +* end-of-file occurs before any characters matching the current directive +* have been read (other than leading white space, where permitted), execution +* of the current directive terminates with an input failure; otherwise, unless +* execution of the current directive is terminated with a matching failure, +* execution of the following directive (if any) is terminated with an input +* failure. +* +* If conversion terminates on a conflicting input character, the offending +* input character is left unread in the input stream. Trailing white space +* (including new-line characters) is left unread unless matched by a +* directive. The success of literal matches and suppressed assignments is +* not directly determinable other than via the %n directive. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The number of input items assigned, which can be fewer than provided for, +* or even zero, in the event of an early matching failure; or EOF if an +* input failure occurs before any conversion. +* +* SEE ALSO: scanf(), sscanf() +*/ + +int fscanf + ( + FILE * fp, /* stream to read from */ + char const * fmt, /* format string */ + ... /* arguments to format string */ + ) + { + int nArgs; + int unget; + va_list vaList; /* vararg list */ + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (EOF); + + va_start (vaList, fmt); + nArgs = fioScanV (fmt, fgetc, (int) fp, &unget, vaList); + va_end (vaList); + + if (unget != -1) + ungetc (unget, fp); + + return (nArgs); + } diff --git a/libc/stdio/fseek.c b/libc/stdio/fseek.c new file mode 100644 index 0000000..d16050d --- /dev/null +++ b/libc/stdio/fseek.c @@ -0,0 +1,336 @@ +/* fseek.c - seek a position in a file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,05feb99,dgp document errno values +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + +smb taken from UCB stdio, removed fstat(). +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, sys/types.h, sys/stat.h, fcntl.h, stdlib.h, errno.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "ioLib.h" +#include "sys/types.h" +#include "sys/stat.h" +#include "fcntl.h" +#include "stdlib.h" +#include "errno.h" +#include "objLib.h" +#include "private/stdioP.h" + +#define POS_ERR (-(fpos_t)1) + + +/****************************************************************************** +* +* fseek - set the file position indicator for a stream (ANSI) +* +* This routine sets the file position indicator for a specified stream. +* For a binary stream, the new position, measured in characters from the +* beginning of the file, is obtained by adding to the position +* specified by , whose possible values are: +* .iP SEEK_SET 16 +* the beginning of the file. +* .iP SEEK_CUR +* the current value of the file position indicator. +* .iP SEEK_END +* the end of the file. +* .LP +* A binary stream does not meaningfully +* support fseek() calls with a value of SEEK_END. +* +* For a text stream, either is zero, or is a value +* returned by an earlier call to ftell() on the stream, in which case +* should be SEEK_SET. +* +* A successful call to fseek() clears the end-of-file indicator for the +* stream and undoes any effects of ungetc() on the same stream. After an +* fseek() call, the next operation on an update stream can be either input +* or output. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: Non-zero only for a request that cannot be satisfied. +* +* ERRNO: EINVAL +* +* SEE ALSO: ftell() +*/ + +int fseek + ( + FAST FILE * fp, /* stream */ + long offset, /* offset from */ + int whence /* position to offset from: */ + /* SEEK_SET = beginning */ + /* SEEK_CUR = current position */ + /* SEEK_END = end-of-file */ + ) + { + fpos_t target; + fpos_t curoff; + size_t n; + struct stat st; + int havepos; + BOOL doStat; + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (ERROR); + + /* + * Change any SEEK_CUR to SEEK_SET, and check `whence' argument. + * After this, whence is either SEEK_SET or SEEK_END. + */ + + switch (whence) + { + case SEEK_CUR: + /* + * In order to seek relative to the current stream offset, + * we have to first find the current stream offset a la + * ftell (see ftell for details). + */ + if (fp->_flags & __SOFF) + curoff = fp->_offset; + else + { + curoff = __sseek (fp, (fpos_t)0, SEEK_CUR); + if (curoff == -1L) + return (EOF); + } + + if (fp->_flags & __SRD) + { + curoff -= fp->_r; + if (HASUB(fp)) + curoff -= fp->_ur; + } + else if (fp->_flags & __SWR && fp->_p != NULL) + curoff += fp->_p - fp->_bf._base; + + offset += curoff; + whence = SEEK_SET; + havepos = 1; + break; + + case SEEK_SET: + case SEEK_END: + curoff = 0; /* XXX just to keep gcc quiet */ + havepos = 0; + break; + + default: + errno = EINVAL; + return (EOF); + } + + /* + * Can only optimise if: + * reading (and not reading-and-writing); + * not unbuffered; and + * this is a `regular' Unix file (and hence seekfn==__sseek). + * We must check __NBF first, because it is possible to have __NBF + * and __SOPT both set. + */ + + if (fp->_bf._base == NULL) + __smakebuf (fp); + + if (fp->_flags & (__SWR | __SRW | __SNBF | __SNPT)) + goto dumb; + + + doStat = ioctl (fp->_file, FIOFSTATGET, (int)&st); + + if ((fp->_flags & __SOPT) == 0) + { + if ((fp->_file < 0 || (doStat) || + (st.st_mode & S_IFMT) != S_IFREG)) + { + fp->_flags |= __SNPT; + goto dumb; + } + + fp->_blksize = st.st_blksize; + fp->_flags |= __SOPT; + } + + /* + * We are reading; we can try to optimise. + * Figure out where we are going and where we are now. + */ + + if (whence == SEEK_SET) + target = offset; + else + { + if (doStat) + goto dumb; + + target = st.st_size + offset; + } + + if (!havepos) + { + if (fp->_flags & __SOFF) + curoff = fp->_offset; + else + { + curoff = __sseek (fp, 0L, SEEK_CUR); + + if (curoff == POS_ERR) + goto dumb; + } + + curoff -= fp->_r; + + if (HASUB(fp)) + curoff -= fp->_ur; + } + + /* + * Compute the number of bytes in the input buffer (pretending + * that any ungetc() input has been discarded). Adjust current + * offset backwards by this count so that it represents the + * file offset for the first byte in the current input buffer. + */ + + if (HASUB(fp)) + { + n = fp->_up - fp->_bf._base; + curoff -= n; + n += fp->_ur; + } + else + { + n = fp->_p - fp->_bf._base; + curoff -= n; + n += fp->_r; + } + + /* + * If the target offset is within the current buffer, + * simply adjust the pointers, clear EOF, undo ungetc(), + * and return. (If the buffer was modified, we have to + * skip this; see fgetline.c.) + */ + + if (((fp->_flags & __SMOD) == 0) && + (target >= curoff) && + (target < (curoff + n))) + { + FAST int o = target - curoff; + + fp->_p = fp->_bf._base + o; + fp->_r = n - o; + + if (HASUB(fp)) + FREEUB(fp); + + fp->_flags &= ~__SEOF; + + return (0); + } + + /* + * The place we want to get to is not within the current buffer, + * but we can still be kind to the kernel copyout mechanism. + * By aligning the file offset to a block boundary, we can let + * the kernel use the VM hardware to map pages instead of + * copying bytes laboriously. Using a block boundary also + * ensures that we only read one block, rather than two. + */ + + curoff = target & ~(fp->_blksize - 1); + + if (__sseek (fp, curoff, SEEK_SET) == POS_ERR) + goto dumb; + + fp->_r = 0; + + if (HASUB(fp)) + FREEUB(fp); + + fp->_flags &= ~__SEOF; + n = target - curoff; + + if (n) + { + if (__srefill (fp) || fp->_r < n) + goto dumb; + fp->_p += n; + fp->_r -= n; + } + + return (0); + + /* + * We get here if we cannot optimise the seek ... just + * do it. Allow the seek function to change fp->_bf._base. + */ +dumb: + if ((__sflush (fp)) || (__sseek (fp, offset, whence) == POS_ERR)) + return (EOF); + + /* success: clear EOF indicator and discard ungetc() data */ + + if (HASUB(fp)) + FREEUB(fp); + + fp->_p = fp->_bf._base; + fp->_r = 0; + + /* fp->_w = 0; */ /* unnecessary (I think...) */ + + fp->_flags &= ~__SEOF; + + return (0); + } diff --git a/libc/stdio/fsetpos.c b/libc/stdio/fsetpos.c new file mode 100644 index 0000000..0897317 --- /dev/null +++ b/libc/stdio/fsetpos.c @@ -0,0 +1,88 @@ +/* fsetpos.c - set a position in a file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" + + +/****************************************************************************** +* +* fsetpos - set the file position indicator for a stream (ANSI) +* +* This routine sets the file position indicator for a specified stream +* according to the value of the object pointed to by , which is a value +* obtained from an earlier call to fgetpos() on the same stream. +* +* A successful call to fsetpos() clears the end-of-file indicator for the +* stream and undoes any effects of ungetc() on the same stream. After an +* fsetpos() call, the next operation on an update stream may be either input +* or output. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* Zero, or non-zero if the call fails, with `errno' set to indicate the error. +* +* SEE ALSO: fgetpos() +*/ + +int fsetpos + ( + FILE * iop, /* stream */ + const fpos_t * pos /* position, obtained by fgetpos() */ + ) + { + return (fseek (iop, (long)*pos, SEEK_SET)); + } diff --git a/libc/stdio/ftell.c b/libc/stdio/ftell.c new file mode 100644 index 0000000..8de248c --- /dev/null +++ b/libc/stdio/ftell.c @@ -0,0 +1,135 @@ +/* ftell.c - remember a position in a file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, error.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "errno.h" +#include "objLib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* ftell - return the current value of the file position indicator for a stream (ANSI) +* +* This routine returns the current value of the file position indicator for +* a specified stream. For a binary stream, the value is the number of +* characters from the beginning of the file. For a text stream, the file +* position indicator contains unspecified information, usable by fseek() for +* returning the file position indicator to its position at the time of the +* ftell() call; the difference between two such return values is not +* necessary a meaningful measure of the number of characters written or read. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The current value of the file position indicator, +* or -1L if unsuccessful, with `errno' set to indicate the error. +* +* SEE ALSO: fseek() +*/ + +long ftell + ( + FAST FILE * fp /* stream */ + ) + { + FAST fpos_t pos; + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (ERROR); + + /* + * Find offset of underlying I/O object, then + * adjust for buffered bytes. + */ + + if (fp->_flags & __SOFF) + pos = fp->_offset; + else + { + pos = __sseek (fp, (fpos_t)0, SEEK_CUR); + + if (pos == -1L) + return (pos); + } + + if (fp->_flags & __SRD) + { + /* + * Reading. Any unread characters (including + * those from ungetc) cause the position to be + * smaller than that in the underlying object. + */ + + pos -= fp->_r; + + if (HASUB(fp)) + pos -= fp->_ur; + } + else if (fp->_flags & __SWR && fp->_p != NULL) + { + /* + * Writing. Any buffered characters cause the + * position to be greater than that in the + * underlying object. + */ + + pos += fp->_p - fp->_bf._base; + } + + return (pos); + } diff --git a/libc/stdio/fvwrite.c b/libc/stdio/fvwrite.c new file mode 100644 index 0000000..c7656b9 --- /dev/null +++ b/libc/stdio/fvwrite.c @@ -0,0 +1,246 @@ +/* fvwrite.c - internal routine for puts function. stdio.h */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "string.h" +#include "private/stdioP.h" +#include "private/fvwriteP.h" + +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#define COPY(n) (void) bcopy ((void *)p, (void *)fp->_p, (size_t)(n)); + +#define GETIOV(extra_work) \ + while (len == 0) \ + { \ + extra_work; \ + p = iov->iov_base; \ + len = iov->iov_len; \ + iov++; \ + } + + +/****************************************************************************** +* +* __sfvwrite - internal function used by the write ANSI functions. +* +* INCLUDE: stdio.h +* +* RETURNS: zero on success, EOF on error +* NOMANUAL +*/ + +int __sfvwrite + ( + FAST FILE * fp, + FAST struct __suio * uio + ) + { + FAST size_t len; + FAST char * p; + FAST struct __siov * iov; + FAST int w; + FAST int s; + char * nl; + int nlknown; + int nldist; + + if ((len = uio->uio_resid) == 0) + return (0); + + if (cantwrite (fp)) /* make sure we can write */ + return (EOF); + + iov = uio->uio_iov; + p = iov->iov_base; + len = iov->iov_len; + iov++; + + if (fp->_flags & __SNBF) + { + /* Unbuffered: write up to BUFSIZ bytes at a time */ + do + { + GETIOV(;); + + w = __swrite (fp, p, MIN(len, BUFSIZ)); + + if (w <= 0) + goto err; + + p += w; + len -= w; + + } while ((uio->uio_resid -= w) != 0); + } + else if ((fp->_flags & __SLBF) == 0) + { + /* + * Fully buffered: fill partially full buffer, if any, + * and then flush. If there is no partial buffer, write + * one _bf._size byte chunk directly (without copying). + * + * String output is a special case: write as many bytes + * as fit, but pretend we wrote everything. This makes + * snprintf() return the number of bytes needed, rather + * than the number used, and avoids its write function + * (so that the write function can be invalid). + */ + do + { + GETIOV(;); + w = fp->_w; + + if (fp->_flags & __SSTR) + { + if (len < w) + w = len; + + COPY(w); /* copy MIN(fp->_w,len), */ + fp->_w -= w; + fp->_p += w; + w = len; /* but pretend copied all */ + } + else if (fp->_p > fp->_bf._base && len > w) + { + COPY(w); /* fill */ + fp->_p += w; /* fp->_w -= w; unneeded */ + if (fflush(fp)) /* flush */ + goto err; + } + else if (len >= (w = fp->_bf._size)) + { + w = __swrite (fp, p, w); /* write directly */ + if (w <= 0) + goto err; + } + else + { + w = len; + COPY(w); /* fill and done */ + fp->_w -= w; + fp->_p += w; + } + p += w; + len -= w; + } while ((uio->uio_resid -= w) != 0); + + } + else + { + /* + * Line buffered: like fully buffered, but we + * must check for newlines. Compute the distance + * to the first newline (including the newline), + * or `infinity' if there is none, then pretend + * that the amount to write is MIN(len,nldist). + */ + + nlknown = 0; + nldist = 0; + + do + { + GETIOV(nlknown = 0); + if (!nlknown) + { + nl = memchr ((void *)p, '\n', len); + nldist = (nl) ? (nl + 1 - p) : (len + 1); + nlknown = 1; + } + + s = MIN(len, nldist); + w = fp->_w + fp->_bf._size; + + if (fp->_p > fp->_bf._base && s > w) + { + COPY(w); + fp->_p += w; /* fp->_w -= w; unneeded */ + if (fflush (fp)) + goto err; + } + else if (s >= (w = fp->_bf._size)) + { + w = __swrite (fp, p, w); + if (w <= 0) + goto err; + } + else + { + w = s; + COPY(w); + fp->_w -= w; + fp->_p += w; + } + + if ((nldist -= w) == 0) + { + if (fflush (fp)) /* copied newline: flush and forget */ + goto err; + nlknown = 0; + } + + p += w; + len -= w; + + } while ((uio->uio_resid -= w) != 0); + } + + return (0); + +err: + fp->_flags |= __SERR; + + return (EOF); + } diff --git a/libc/stdio/fwrite.c b/libc/stdio/fwrite.c new file mode 100644 index 0000000..b1516a0 --- /dev/null +++ b/libc/stdio/fwrite.c @@ -0,0 +1,109 @@ +/* fwrite.c - write to a file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "objLib.h" +#include "private/stdioP.h" +#include "private/fvwriteP.h" + + +/****************************************************************************** +* +* fwrite - write from a specified array (ANSI) +* +* This routine writes, from the array , up to elements whose +* size is , to a specified stream. The file position indicator for +* the stream (if defined) is advanced by the number of characters +* successfully written. If an error occurs, the resulting value of the file +* position indicator for the stream is indeterminate. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The number of elements successfully written, which will be less than +* only if a write error is encountered. +*/ + +int fwrite + ( + const void * buf, /* where to copy from */ + size_t size, /* element size */ + size_t count, /* no. of elements */ + FILE * fp /* stream to write to */ + ) + { + size_t n; + struct __suio uio; + struct __siov iov; + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (0); + + iov.iov_base = (void *)buf; + uio.uio_resid = iov.iov_len = n = (count * size); + uio.uio_iov = &iov; + uio.uio_iovcnt = 1; + + /* The usual case is success (__sfvwrite returns 0); + * skip the divide if this happens, since divides are + * generally slow and since this occurs whenever size==0. + */ + + if (__sfvwrite(fp, &uio) == 0) + return (count); + + return ((n - uio.uio_resid) / size); + } diff --git a/libc/stdio/getc.c b/libc/stdio/getc.c new file mode 100644 index 0000000..6715ce2 --- /dev/null +++ b/libc/stdio/getc.c @@ -0,0 +1,98 @@ +/* getc.c - get a character from a file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "objLib.h" +#include "private/stdioP.h" + +#undef getc + +/****************************************************************************** +* +* getc - return the next character from a stream (ANSI) +* +* This routine is equivalent to fgetc(), except that if it is implemented as +* a macro, it may evaluate more than once; thus the argument should +* never be an expression with side effects. +* +* If the stream is at end-of-file, the end-of-file indicator for the stream is +* set; if a read error occurs, the error indicator is set. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The next character from the stream, or EOF if the stream is at end-of-file +* or a read error occurs. +* +* SEE ALSO: fgetc() +*/ + +int getc + ( + FILE * fp /* input stream */ + ) + { + int ch; + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (EOF); + + if ((ch = __sgetc(fp)) == EOF) + fp->_flags |= __SEOF; + + return (ch); + } diff --git a/libc/stdio/getchar.c b/libc/stdio/getchar.c new file mode 100644 index 0000000..47b8eee --- /dev/null +++ b/libc/stdio/getchar.c @@ -0,0 +1,85 @@ +/* getchar.c - get a character from a file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "private/stdioP.h" + +#undef getchar + +/****************************************************************************** +* +* getchar - return the next character from the standard input stream (ANSI) +* +* This routine returns the next character from the standard input stream +* and advances the file position indicator. +* +* It is equivalent to getc() with the stream argument `stdin'. +* +* If the stream is at end-of-file, the end-of-file indicator is +* set; if a read error occurs, the error indicator is set. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The next character from the standard input stream, or EOF if the stream is +* at end-of-file or a read error occurs. +* +* SEE ALSO: getc(), fgetc() +*/ + +int getchar (void) + { + return (getc (stdin)); + } diff --git a/libc/stdio/gets.c b/libc/stdio/gets.c new file mode 100644 index 0000000..231bcff --- /dev/null +++ b/libc/stdio/gets.c @@ -0,0 +1,105 @@ +/* gets.c - get a string of characters from a file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, unistd.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "unistd.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* gets - read characters from the standard input stream (ANSI) +* +* This routine reads characters from the standard input stream into the +* array until end-of-file is encountered or a new-line is read. +* Any new-line character is discarded, and a null character is written +* immediately after the last character read into the array. +* +* If end-of-file is encountered and no characters have been read, +* the contents of the array remain unchanged. If a read error +* occurs, the array contents are indeterminate. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* A pointer to , or a null pointer if (1) end-of-file is encountered +* and no characters have been read, or (2) there is a read error. +*/ + +char * gets + ( + char * buf /* output array */ + ) + { + FAST int c; + FAST char * s; + + for (s = buf; (c = getchar()) != '\n';) + { + if (c == EOF) + { + if (s == buf) + return (NULL); + else + break; + } + else + *s++ = c; + } + + *s = EOS; + + return (buf); + } diff --git a/libc/stdio/getw.c b/libc/stdio/getw.c new file mode 100644 index 0000000..1855a37 --- /dev/null +++ b/libc/stdio/getw.c @@ -0,0 +1,53 @@ +/* getw.c - get a word. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: stdio.h, string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" + +/****************************************************************************** +* +* getw - read the next word (32-bit integer) from a stream +* +* This routine reads the next 32-bit quantity from a specified stream. +* It returns EOF on end-of-file or an error; however, this is also a +* valid integer, thus feof() and ferror() must be used to check for +* a true end-of-file. +* +* This routine is provided for compatibility with earlier VxWorks releases. +* +* INCLUDE FILES: stdio.h +* +* RETURN: A 32-bit number from the stream, or EOF on either end-of-file +* or an error. +* +* SEE ALSO: putw() +*/ + +int getw + ( + FILE * fp /* stream to read from */ + ) + { + int x; + + return (fread ((void *)&x, sizeof (x), 1, fp) == 1 ? x : EOF); + } diff --git a/libc/stdio/makebuf.c b/libc/stdio/makebuf.c new file mode 100644 index 0000000..7e858f0 --- /dev/null +++ b/libc/stdio/makebuf.c @@ -0,0 +1,144 @@ +/* makebuf.c - make a file buffer. stdio.h */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio, removed fstat(). +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, sys/types.h, sys/stat.h, unistd.h, stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "ioLib.h" +#include "stdio.h" +#include "sys/types.h" +#include "sys/stat.h" +#include "unistd.h" +#include "stdlib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* __smakebuf - Allocate a file buffer, or switch to unbuffered I/O. +* +* As a side effect, we set __SOPT or __SNPT (en/dis-able fseek +* optimisation) right after the fstat() that finds the buffer size. +* +* INCLUDE: stdio.h +* +* RETURNS: +* NOMANUAL +*/ + +void __smakebuf + ( + FAST FILE *fp + ) + { + FAST size_t size; + FAST BOOL couldBeTty; + FAST void * p; + struct stat st; + + if (fp->_flags & __SNBF) /* is buffering disabled? */ + { + fp->_bf._base = fp->_nbuf; /* base of single character buf */ + fp->_p = fp->_nbuf; /* point to character buf */ + fp->_bf._size = 1; /* length of buf is one */ + return; /* RETURN */ + } + + if (fp->_file < 0) /* has fd been associated with file? */ + { + couldBeTty = FALSE; /* can't be a tty */ + size = BUFSIZ; /* standard buffer size */ + fp->_flags |= __SNPT; /* don't optimize fseek() */ + } + /* get blksize hint from driver */ + else if ((ioctl (fp->_file, FIOFSTATGET, (int)&st)) < 0) + { + couldBeTty = TRUE; /* tyLib does not support fstat! */ + size = BUFSIZ; /* standard buffer size */ + fp->_flags |= __SNPT; /* do not try to optimise fseek() */ + } + else + { + couldBeTty = ((st.st_mode & S_IFMT) == S_IFCHR); + + size = (st.st_blksize <= 0) ? (BUFSIZ) : (st.st_blksize); + + /* + * Optimise fseek() only if it is a regular file. + * (The test for __sseek is mainly paranoia.) + */ + + if ((st.st_mode & S_IFMT) == S_IFREG) + { + fp->_flags |= __SOPT; + fp->_blksize = st.st_blksize; + } + else + fp->_flags |= __SNPT; + } + + if ((p = malloc (size)) == NULL) /* if malloc fails, disable buffering */ + { + fp->_flags |= __SNBF; + fp->_bf._base = fp->_p = fp->_nbuf; + fp->_bf._size = 1; + } + else + { + fp->_flags |= __SMBF; /* mark buffer as malloced to reclaim */ + fp->_bf._base = fp->_p = p; + fp->_bf._size = size; + + if (couldBeTty && isatty (fp->_file)) + fp->_flags |= __SLBF; /* turn on line buffering if tty */ + } + } diff --git a/libc/stdio/perror.c b/libc/stdio/perror.c new file mode 100644 index 0000000..abfa0be --- /dev/null +++ b/libc/stdio/perror.c @@ -0,0 +1,58 @@ +/* perror.c - print error value. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: stdio.h, error.h, string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "string.h" +#include "errno.h" + + +/****************************************************************************** +* +* perror - map an error number in `errno' to an error message (ANSI) +* +* This routine maps the error number in the integer expression `errno' to an +* error message. It writes a sequence of characters to the standard error +* stream as follows: first (if <__s> is not a null pointer and the character +* pointed to by <__s> is not the null character), the string pointed to by +* <__s> followed by a colon (:) and a space; then an appropriate error +* message string followed by a new-line character. The contents of the +* error message strings are the same as those returned by strerror() with +* the argument `errno'. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: N/A +* +* SEE ALSO: strerror() +*/ + +void perror + ( + const char * __s /* error string */ + ) + { + if ((__s) && (*__s != EOS)) + fprintf (stderr, "%s: ", __s); + + fprintf (stderr, "%s\n", strerror (errno)); + } diff --git a/libc/stdio/putc.c b/libc/stdio/putc.c new file mode 100644 index 0000000..46eecfc --- /dev/null +++ b/libc/stdio/putc.c @@ -0,0 +1,90 @@ +/* putc.c - put a character. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "private/stdioP.h" + +#undef putc + +/****************************************************************************** +* +* putc - write a character to a stream (ANSI) +* +* This routine writes a character to a specified stream, at the +* position indicated by the stream's file position indicator +* (if defined), and advances the indicator appropriately. +* +* This routine is equivalent to fputc(), except that if it is implemented as +* a macro, it may evaluate more than once; thus, the argument should +* never be an expression with side effects. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The character written, or EOF if a write error occurs, with the error +* indicator set for the stream. +* +* SEE ALSO: fputc() +*/ + +int putc + ( + int c, /* character to write */ + FAST FILE * fp /* stream to write to */ + ) + { + return (__sputc(c, fp)); + } diff --git a/libc/stdio/putchar.c b/libc/stdio/putchar.c new file mode 100644 index 0000000..553b342 --- /dev/null +++ b/libc/stdio/putchar.c @@ -0,0 +1,87 @@ +/* putchar.c - put a character to standard output. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "private/stdioP.h" + +#undef putchar + +/****************************************************************************** +* +* putchar - write a character to the standard output stream (ANSI) +* +* This routine writes a character to the standard output stream, at the +* position indicated by the stream's file position indicator +* (if defined), and advances the indicator appropriately. +* +* This routine is equivalent to putc() with a second argument of `stdout'. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The character written, or EOF if a write error occurs, with the error +* indicator set for the standard output stream. +* +* SEE ALSO: putc(), fputc() +*/ + +int putchar + ( + int c /* character to write */ + ) + { + return (__sputc(c, stdout)); + } diff --git a/libc/stdio/puts.c b/libc/stdio/puts.c new file mode 100644 index 0000000..7cf5d84 --- /dev/null +++ b/libc/stdio/puts.c @@ -0,0 +1,97 @@ +/* puts.c - put a string of characters. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "string.h" +#include "private/fvwriteP.h" + + +/****************************************************************************** +* +* puts - write a string to the standard output stream (ANSI) +* +* This routine writes to the standard output stream a specified string , +* minus the terminating null character, and appends a new-line character to +* the output. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* A non-negative value, or EOF if a write error occurs. +* +* SEE ALSO: fputs() +*/ + +int puts + ( + char const * s /* string to write */ + ) + { + size_t c = strlen (s); + struct __suio uio; + struct __siov iov [2]; + + iov[0].iov_base = (void *)s; + iov[0].iov_len = c; + iov[1].iov_base = "\n"; + iov[1].iov_len = 1; + + uio.uio_resid = c + 1; + uio.uio_iov = &iov [0]; + uio.uio_iovcnt = 2; + + return ((__sfvwrite (stdout, &uio)) ? (EOF) : ('\n')); + } diff --git a/libc/stdio/putw.c b/libc/stdio/putw.c new file mode 100644 index 0000000..a0952bb --- /dev/null +++ b/libc/stdio/putw.c @@ -0,0 +1,47 @@ +/* putw.c - put a word. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,05mar93,jdi documentation cleanup for 5.1. +01c,21sep92,smb tweaks for mg +01b,20sep92,smb documentation additions +01a,29jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: stdio.h, string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" + +/****************************************************************************** +* +* putw - write a word (32-bit integer) to a stream +* +* This routine appends the 32-bit quantity to a specified stream. +* +* This routine is provided for compatibility with earlier VxWorks releases. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: The value written. +*/ + +int putw + ( + int w, /* word (32-bit integer) */ + FILE * fp /* output stream */ + ) + { + return (fwrite ((void *) &w, sizeof (int), 1, fp) == 1 ? w : EOF); + } diff --git a/libc/stdio/refill.c b/libc/stdio/refill.c new file mode 100644 index 0000000..15bbf1c --- /dev/null +++ b/libc/stdio/refill.c @@ -0,0 +1,183 @@ +/* refill.c - file for stdio.h */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,20sep92,smb documentation additions +01a,29jul92,jcf Flush only the current fp. + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, error.h, stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "errno.h" +#include "stdlib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* lflush - internal routine. +* +* INCLUDE: stdio.h +* +* RETURNS: +* NOMANUAL +*/ + +LOCAL int lflush + ( + FILE *fp + ) + { + if ((fp->_flags & (__SLBF | __SWR)) == (__SLBF | __SWR)) + return (__sflush (fp)); + + return (0); + } + +/****************************************************************************** +* +* __srefill - refill a stdio buffer. +* +* INCLUDE: stdio.h +* +* RETURNS: EOF on eof or error, 0 otherwise. +* NOMANUAL +*/ + +int __srefill + ( + FAST FILE *fp + ) + { + fp->_r = 0; /* largely a convenience for callers */ + + /* SysV does not make this test; take it out for compatibility */ + + if (fp->_flags & __SEOF) + return (EOF); + + /* if not already reading, have to be reading and writing */ + + if ((fp->_flags & __SRD) == 0) + { + if ((fp->_flags & __SRW) == 0) + { + errno = EBADF; + return (EOF); + } + + if (fp->_flags & __SWR) /* switch to reading */ + { + if (__sflush (fp)) + return (EOF); + + fp->_flags &= ~__SWR; + fp->_w = 0; + fp->_lbfsize = 0; + } + fp->_flags |= __SRD; + } + else + { + /* + * We were reading. If there is an ungetc buffer, + * we must have been reading from that. Drop it, + * restoring the previous buffer (if any). If there + * is anything in that buffer, return. + */ + + if (HASUB(fp)) + { + FREEUB(fp); + + if ((fp->_r = fp->_ur) != 0) + { + fp->_p = fp->_up; + + return (0); + } + } + } + + if (fp->_bf._base == NULL) + __smakebuf (fp); + + /* + * Before reading from a line buffered or unbuffered file, + * flush all line buffered output files, per the ANSI C + * standard. + */ + + if (fp->_flags & (__SLBF|__SNBF)) + lflush(fp); /* flush at least current fp */ + + /* XXX lflush(stdin); Someday we could flush these */ + /* XXX lflush(stdout); Someday we could flush these */ + /* XXX lflush(stderr); Someday we could flush these */ + + fp->_p = fp->_bf._base; + fp->_r = __sread (fp, (char *)fp->_p, fp->_bf._size); + fp->_flags &= ~__SMOD; /* buffer contents are again pristine */ + + if (fp->_r <= 0) + { + if (fp->_r == 0) + fp->_flags |= __SEOF; + else + { + fp->_r = 0; + fp->_flags |= __SERR; + } + + return (EOF); + } + + return (0); + } diff --git a/libc/stdio/rewind.c b/libc/stdio/rewind.c new file mode 100644 index 0000000..06e01c7 --- /dev/null +++ b/libc/stdio/rewind.c @@ -0,0 +1,93 @@ +/* rewind.c - rewind a stream. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, error.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "objLib.h" +#include "errno.h" + + +/****************************************************************************** +* +* rewind - set the file position indicator to the beginning of a file (ANSI) +* +* This routine sets the file position indicator for a specified stream to +* the beginning of the file. +* +* It is equivalent to: +* .CS +* (void) fseek (fp, 0L, SEEK_SET); +* .CE +* except that the error indicator for the stream is cleared. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: N/A +* +* SEE ALSO: fseek(), ftell() +*/ + +void rewind + ( + FILE * fp /* stream */ + ) + { + if (OBJ_VERIFY (fp, fpClassId) != OK) + return; + + (void) fseek (fp, 0L, SEEK_SET); + clearerr(fp); + } diff --git a/libc/stdio/rget.c b/libc/stdio/rget.c new file mode 100644 index 0000000..09a478e --- /dev/null +++ b/libc/stdio/rget.c @@ -0,0 +1,84 @@ +/* rget.c - file for stdio.h */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* __srget - Handle getc() when the buffer ran out: +* Refill, then return the first character +* in the newly-filled buffer. +* +* INCLUDE: stdio.h +* +* NOMANUAL +* RETURNS: +*/ + +int __srget + ( + FAST FILE *fp + ) + { + if (__srefill (fp) == 0) + { + fp->_r--; + return (*fp->_p++); + } + + return (EOF); + } diff --git a/libc/stdio/scanf.c b/libc/stdio/scanf.c new file mode 100644 index 0000000..b7745d3 --- /dev/null +++ b/libc/stdio/scanf.c @@ -0,0 +1,99 @@ +/* scanf.c - scan a file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf rewritten to usr fioScanV() + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, stdarg.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdarg.h" +#include "fioLib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* scanf - read and convert characters from the standard input stream (ANSI) +* +* This routine reads input from the standard input stream under the control +* of the string . It is equivalent to fscanf() with an argument +* of `stdin'. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The number of input items assigned, which can be fewer than provided for, +* or even zero, in the event of an early matching failure; or EOF if an +* input failure occurs before any conversion. +* +* SEE ALSO: fscanf(), sscanf() +*/ + +int scanf + ( + char const * fmt, /* format string */ + ... /* arguments to format string */ + ) + { + int nArgs; + int unget; + va_list vaList; /* vararg list */ + + va_start (vaList, fmt); + nArgs = fioScanV (fmt, fgetc, (int) stdin, &unget, vaList); + va_end (vaList); + + if (unget != -1) + ungetc (unget, stdin); + + return (nArgs); + } diff --git a/libc/stdio/setbuf.c b/libc/stdio/setbuf.c new file mode 100644 index 0000000..909f413 --- /dev/null +++ b/libc/stdio/setbuf.c @@ -0,0 +1,88 @@ +/* setbuf.c - set buffered mode. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "objLib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* setbuf - specify the buffering for a stream (ANSI) +* +* Except that it returns no value, this routine is equivalent to setvbuf() +* invoked with the _IOFBF (full buffering) and BUFSIZ, or (if +* is a null pointer), with the _IONBF (no buffering). +* +* INCLUDE FILES: stdio.h +* +* RETURNS: N/A +* +* SEE ALSO: setvbuf() +*/ + +void setbuf + ( + FILE * fp, /* stream to set buffering for */ + char * buf /* buffer to use */ + ) + { + if (OBJ_VERIFY (fp, fpClassId) != OK) + return; + + (void) setvbuf (fp, buf, ((buf) ? (_IOFBF) : (_IONBF)), BUFSIZ); + } diff --git a/libc/stdio/setbuffer.c b/libc/stdio/setbuffer.c new file mode 100644 index 0000000..495851f --- /dev/null +++ b/libc/stdio/setbuffer.c @@ -0,0 +1,123 @@ +/* setbuffer.c- file for stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "objLib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* setbuffer - specify buffering for a stream +* +* This routine specifies a buffer to be used for a stream in place of the +* automatically allocated buffer. If is NULL, the stream is unbuffered. +* This routine should be called only after the stream has been associated with +* an open file and before any other operation is performed on the stream. +* +* This routine is provided for compatibility with earlier VxWorks releases. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: N/A +* +* SEE ALSO: setvbuf() +*/ + +void setbuffer + ( + FAST FILE * fp, /* stream to set buffering for */ + char * buf, /* buffer to use */ + int size /* buffer size */ + ) + { + if (OBJ_VERIFY (fp, fpClassId) != OK) + return; + + (void) setvbuf (fp, buf, ((buf) ? (_IOFBF) : (_IONBF)), size); + } + +/****************************************************************************** +* +* setlinebuf - set line buffering for standard output or standard error +* +* This routine changes `stdout' or `stderr' streams from block-buffered or +* unbuffered to line-buffered. Unlike setbuf(), setbuffer(), or setvbuf(), it +* can be used at any time the stream is active. +* +* A stream can be changed from unbuffered or line-buffered to fully buffered +* using freopen(). A stream can be changed from fully buffered or +* line-buffered to unbuffered using freopen() followed by setbuf() with a +* buffer argument of NULL. +* +* This routine is provided for compatibility with earlier VxWorks releases. +* +* INCLUDE: stdio.h +* +* RETURNS: OK, or ERROR if is not a valid stream. +*/ + +int setlinebuf + ( + FILE * fp /* stream - stdout or stderr */ + ) + { + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (ERROR); + + (void) setvbuf (fp, (char *)NULL, _IOLBF, (size_t)0); + return (OK); /* ??? */ + } diff --git a/libc/stdio/setvbuf.c b/libc/stdio/setvbuf.c new file mode 100644 index 0000000..29e37e8 --- /dev/null +++ b/libc/stdio/setvbuf.c @@ -0,0 +1,167 @@ +/* setvbuf.c - set buffered mode. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "stdlib.h" +#include "objLib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* setvbuf - specify buffering for a stream (ANSI) +* +* This routine sets the buffer size and buffering mode for a specified +* stream. It should be called only after the stream has been associated +* with an open file and before any other operation is performed on the +* stream. The argument determines how the stream will be buffered, +* as follows: +* .iP _IOFBF 12 +* input/output is to be fully buffered. +* .iP _IOLBF +* input/output is to be line buffered. +* .iP _IONBF +* input/output is to be unbuffered. +* .LP +* +* If is not a null pointer, the array it points to may be used instead +* of a buffer allocated by setvbuf(). The argument specifies +* the size of the array. The contents of the array at any time are +* indeterminate. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* Zero, or non-zero if is invalid or the request cannot be honored. +*/ + +int setvbuf + ( + FAST FILE * fp, /* stream to set buffering for */ + char * buf, /* buffer to use (optional) */ + FAST int mode, /* _IOFBF = fully buffered */ + /* _IOLBF = line buffered */ + /* _IONBF = unbuffered */ + FAST size_t size /* buffer size */ + ) + { + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (ERROR); + + /* + * Verify arguments. The `int' limit on `size' is due to this + * particular implementation. + */ + + if (((mode != _IOFBF) && (mode != _IOLBF) && (mode != _IONBF)) || + ((int)size < 0)) + return (EOF); + + /* + * Write current buffer, if any; drop read count, if any. + * Make sure putc() will not think fp is line buffered. + * Free old buffer if it was from malloc(). Clear line and + * non buffer flags, and clear malloc flag. + */ + + (void) __sflush (fp); + + fp->_r = 0; + fp->_lbfsize = 0; + + if (fp->_flags & __SMBF) + free ((void *)fp->_bf._base); + + fp->_flags &= ~(__SLBF | __SNBF | __SMBF); + + /* + * Now put back whichever flag is needed, and fix _lbfsize + * if line buffered. Ensure output flush on exit if the + * stream will be buffered at all. + */ + + switch (mode) + { + case _IONBF: + fp->_flags |= __SNBF; + fp->_bf._base = fp->_p = fp->_nbuf; + fp->_bf._size = 1; + break; + + case _IOLBF: + fp->_flags |= __SLBF; + fp->_lbfsize = -size; + /* FALLTHROUGH */ + + case _IOFBF: + /* no flag */ + fp->_bf._base = fp->_p = (unsigned char *)buf; + fp->_bf._size = size; + break; + default: + break; + } + + /* + * Patch up write count if necessary. + */ + + if (fp->_flags & __SWR) + fp->_w = (fp->_flags & (__SLBF | __SNBF)) ? (0) : (size); + + return (0); + } diff --git a/libc/stdio/stdio.c b/libc/stdio/stdio.c new file mode 100644 index 0000000..15e4e04 --- /dev/null +++ b/libc/stdio/stdio.c @@ -0,0 +1,198 @@ +/* stdio.c - internal misc. routines for stdio.h */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + *DESCRIPTION OF STDIO STATE VARIABLES + * + * stdio state variables. + * + * The following always hold: + * + * if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR), + * _lbfsize is -_bf._size, else _lbfsize is 0 + * if _flags&__SRD, _w is 0 + * if _flags&__SWR, _r is 0 + * + * This ensures that the getc and putc macros (or inline functions) never + * try to write or read from a file that is in `read' or `write' mode. + * (Moreover, they can, and do, automatically switch from read mode to + * write mode, and back, on "r+" and "w+" files.) + * + * _lbfsize is used only to make the inline line-buffered output stream + * code as compact as possible. + * + * _ub, _up, and _ur are used when ungetc() pushes back more characters + * than fit in the current _bf, or when ungetc() pushes back a character + * that does not match the previous one in _bf. When this happens, + * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff + * _ub._base!=NULL) and _up and _ur save the current values of _p and _r. + + +INCLUDE FILE: stdio.h, fcntl.h, unistd.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "fcntl.h" +#include "unistd.h" +#include "private/stdioP.h" + +/****************************************************************************** +* +* __sread - internal routine +* +* INCLUDE: stdio.h +* +* RETURNS: +* NOMANUAL +*/ + +int __sread + ( + FAST FILE * fp, + char * buf, + int n + ) + { + FAST int ret; + + ret = read (fp->_file, buf, n); + + if (ret >= 0) /* if read succeeded, update current offset */ + fp->_offset += ret; + else + fp->_flags &= ~__SOFF; /* paranoia */ + + return (ret); + } + + +/****************************************************************************** +* +* __swrite - internal routine +* +* INCLUDE: stdio.h +* +* RETURNS: +* NOMANUAL +*/ + +int __swrite + ( + register FILE * fp, + char const * buf, + int n + ) + { + if (fp->_flags & __SAPP) + (void) lseek (fp->_file, (off_t)0, SEEK_END); + + fp->_flags &= ~__SOFF; /* in case FAPPEND mode is set */ + + return (write (fp->_file, CHAR_FROM_CONST(buf), n)); + } + +/****************************************************************************** +* +* __sseek - internal routine +* +* INCLUDE: stdio.h +* +* RETURNS: +* NOMANUAL +*/ + +fpos_t __sseek + ( + FAST FILE * fp, + fpos_t offset, + int whence + ) + { + FAST off_t ret; + + ret = lseek (fp->_file, (off_t)offset, whence); + + if (ret == -1L) + fp->_flags &= ~__SOFF; + else + { + fp->_flags |= __SOFF; + fp->_offset = ret; + } + + return (ret); + } + +/****************************************************************************** +* +* __sclose - internal routine +* +* INCLUDE: stdio.h +* +* RETURNS: +* NOMANUAL +*/ + +int __sclose + ( + FILE * fp + ) + { + int result = 0; + int fd = fp->_file; + + if ((fd >= 0) && (fd < 3)) /* careful of closing standard fds! */ + result = 0; + else if (close (fd) < 0) + result = EOF; + + return (result); + } diff --git a/libc/stdio/stdioLib.c b/libc/stdio/stdioLib.c new file mode 100644 index 0000000..346936f --- /dev/null +++ b/libc/stdio/stdioLib.c @@ -0,0 +1,376 @@ +/* stdioLib.c - standard I/O library */ + +/* Copyright 1984-1995 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +02j,10feb97,tam reclaimed resources from the standard file pointers (SPR #7915) +02i,11feb95,jdi doc tweak. +02h,05mar93,jdi documentation cleanup for 5.1. +02g,13nov92,dnw added __std{in,out,err} (SPR #1770) + made stdInitStd() be LOCAL. + changed stdioFp() create FILE if it doesn't already exist. +02f,20sep92,smb documentation additions +02e,29jul92,smb added stdioFp(). + Modified the documentation for the new stdio library. +02d,29jul92,jcf taken from stdioLib.c +02c,26may92,rrr the tree shuffle +02b,02apr92,jmm added free() of memory if bad options passed to fdopen() + SPR # 1396 +02a,27mar92,jmm changed fopen() to free memory if the open() fails, SPR #1115 +01z,25nov91,rrr cleanup of some ansi warnings. +01y,12nov91,rrr removed VARARG_OK, no longer needed with ansi c. +01x,07oct91,rrr junk for r3000 braindamage. +01w,04oct91,rrr passed through the ansification filter + -changed functions to ansi style + -changed includes to have absolute path from h/ + -fixed #else and #endif + -changed VOID to void + -changed copyright notice +01v,18may91,gae fixed varargs for 960 with conditional VARARG_OK, + namely: fscanf, fprintf, and scanf. +01u,04apr91,jdi documentation cleanup; doc review by dnw. +01t,10aug90,dnw added forward declaration of stdioExitStd (). +01s,08aug90,dnw changed incorrect forward declaration for stdioCreateHook(). +01r,10jun90,dnw changed to call fioFormatV and fioScanV directly with + appropriate handling of varargs (removed doscan and doprnt) + moved all routine implementations of stdio macros to end of + module so that macros would be used in rest of code + spr 640: fprintf returns number of chars printed instead of OK + spr 754: vararg routines no longer limited to 16 args + fixed coercions to allow void to be defined as void one day. +01q,26jun90,jcf lint. +01p,12mar90,jcf changed std{in,out,err} to macros to fps in tcbx. +01o,16feb90,dab fixed bug in doscan() that wouldn't match characters between + the input stream and the format specification. +01n,03aug89,dab removed call to creat() in fopen(). +01m,08apr89,dnw changed stdioInit() to call taskVarInit(). +01l,23mar89,dab changed numerical constants to appropriate defines. + fixed fseek() to return only OK or ERROR. +01k,15nov88,dnw documentation touchup. +01j,23sep88,gae documentation touchup. +01i,13sep88,gae removed ifdef'd sprintf which got into documentation. +01h,06sep88,gae adjusted some argument declarations to please f2cgen. +01g,20aug88,gae documentation. +01f,07jul88,jcf changed malloc to match new declaration. +01e,29jun88,gae documentation. Added error messages in stioInit(). +01d,22jun88,dnw name tweaks. +01c,30may88,dnw changed to v4 names. +01b,28may88,dnw removed routines that had been excluded with "#if FALSE". + made stdioFlushBuf LOCAL. + cleaned up stdio{Init,Exit}Task; improved error msgs. +01a,28mar88,gae created. +*/ + +/* +DESCRIPTION +This library provides a complete UNIX compatible standard I/O buffering +scheme. It is beyond the scope of this manual entry to describe all aspects +of the buffering -- see the +.I "VxWorks Programmer's Guide: I/O System" +and the Kernighan & Ritchie C manual. This manual entry primarily highlights +the differences between the UNIX and VxWorks standard I/O. + +FILE POINTERS +The routine fopen() creates a file pointer. Use of the file pointer follows +conventional UNIX usage. In a shared address space, however, and perhaps more +critically, with the VxWorks system symbol table, tasks may not use each +others' file pointers, at least not without some interlocking mechanism. If it +is necessary to use the same name for a file pointer but have incarnations for +each task, then use task variables; see the manual entry for taskVarLib. + +FIOLIB +Several routines normally considered part of standard I/O -- printf(), +sscanf(), and sprintf() -- are not implemented in stdio; they are +instead implemented in fioLib. They do not use the standard I/O buffering +scheme. They are self-contained, formatted, but unbuffered I/O +functions. This allows a limited amount of formatted I/O to be achieved +without the overhead of the stdio library. + +TASK TERMINATION +When a task exits, unlike in UNIX, it is the responsibility of the task to +fclose() its file pointers, except `stdin', `stdout', and `stderr'. If a +task is to be terminated asynchronously, use kill() and arrange for a +signal handler to clean up. + +INCLUDE FILES +stdio.h, taskLib.h + +All the macros defined in stdio.h are also implemented as real functions so +that they are available from the VxWorks shell. + +SEE ALSO +fioLib, ioLib, taskVarLib, sigLib, Kernighan & Ritchie C manual, +.pG "I/O System" + +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "sys/types.h" +#include "ctype.h" +#include "ioLib.h" +#include "stdlib.h" +#include "taskLib.h" +#include "taskHookLib.h" +#include "stdarg.h" +#include "logLib.h" +#include "fcntl.h" +#include "unistd.h" +#include "errnoLib.h" +#include "string.h" +#include "fioLib.h" +#include "classLib.h" +#include "private/objLibP.h" +#include "private/stdioP.h" +#include "private/funcBindP.h" + +/* locals */ + +LOCAL OBJ_CLASS fpClass; /* file object class */ +LOCAL BOOL stdioInitialized = FALSE; +LOCAL BOOL stdioFpCleanupHookDone = FALSE; + +/* global variables */ + +CLASS_ID fpClassId = &fpClass; /* file class id */ + + +/******************************************************************************* +* +* stdioInit - initialize standard I/O support +* +* This routine installs standard I/O support. It must be called before +* using `stdio' buffering. If INCLUDE_STDIO is defined in configAll.h, it +* is called automatically by the root task usrRoot() in usrConfig.c. +* +* RETURNS: +* OK, or ERROR if the standard I/O facilities cannot be installed. +*/ + +STATUS stdioInit (void) + { + if ((!stdioInitialized) && + (classInit (fpClassId, sizeof (FILE), OFFSET (FILE, objCore), + (FUNCPTR) NULL, (FUNCPTR) NULL, (FUNCPTR) NULL) == OK)) + { + _func_fclose = fclose; /* attach fclose vfunc to taskLib */ + stdioInitialized = TRUE; /* we've finished the initialization */ + } + + return (OK); + } + +/******************************************************************************* +* +* stdioFpCreate - allocate a new FILE structure +* +* RETURNS: +* The pointer to newly created file, or NULL if out of memory. +* +* NOMANUAL +*/ + +FILE *stdioFpCreate (void) + { + FAST FILE *fp = NULL; + + if ((stdioInit () == OK) && + ((fp = (FILE *)objAlloc (fpClassId)) != NULL)) + { + fp->_p = NULL; /* no current pointer */ + fp->_r = 0; + fp->_w = 0; /* nothing to read or write */ + fp->_flags = 1; /* caller sets real flags */ + fp->_file = -1; /* no file */ + fp->_bf._base = NULL; /* no buffer */ + fp->_bf._size = 0; + fp->_lbfsize = 0; /* not line buffered */ + fp->_ub._base = NULL; /* no ungetc buffer */ + fp->_ub._size = 0; + fp->_lb._base = NULL; /* no line buffer */ + fp->_lb._size = 0; + fp->_blksize = 0; + fp->_offset = 0; + fp->taskId = (int) taskIdCurrent; /* task id might be useful */ + + objCoreInit (&fp->objCore, fpClassId); /* validate file object */ + } + + return (fp); + } + +/******************************************************************************* +* +* stdioFpDestroy - destroy and reclaim resources of specified file pointer +* +* RETURNS: +* OK, or ERROR if file pointer could not be destroyed. +* +* NOMANUAL +*/ + +STATUS stdioFpDestroy + ( + FILE *fp + ) + { + /* fclose() deallocates any buffers associated with the file pointer */ + + objCoreTerminate (&fp->objCore); /* invalidate file pointer */ + + return (objFree (fpClassId, (char *) fp)); /* deallocate file pointer */ + } + +/******************************************************************************* +* +* stdioStdfpCleanup - reclaim resources from the standard file pointers. +* +* RETURNS: N/A +* +* NOMANUAL +*/ + +LOCAL void stdioStdfpCleanup + ( + WIND_TCB *pTcb /* address of task's TCB */ + ) + { + int ix; + + /* close standard file pointers (stdin, stdout, stderr) if present */ + + for (ix = 0; ix < 3; ++ix) + if (pTcb->taskStdFp[ix] != NULL) + fclose (pTcb->taskStdFp[ix]); + } + +/******************************************************************************* +* +* stdioInitStd - initialize use of a standard file +*/ + +LOCAL STATUS stdioInitStd + ( + int stdFd /* standard file descriptor to initialize (0,1,2) */ + ) + { + FILE *fp; + + if ((fp = stdioFpCreate ()) == NULL) + return (ERROR); + + switch (stdFd) + { + case STD_IN: fp->_flags = __SRD; break; /* read only */ + case STD_OUT: fp->_flags = __SWR; break; /* write only */ + case STD_ERR: fp->_flags = __SWRNBF; break; /* write only unbuf'd */ + } + + fp->_file = stdFd; /* standard fd */ + + taskIdCurrent->taskStdFp[stdFd] = fp; /* init private file pointer */ + + /* + * need to deallocated stdout, stdin and stderr FILE structures and + * ressources when a task exits or is deleted. Ressources are reclaimed + * via the taskDeleteHook facility. + */ + + if (!stdioFpCleanupHookDone && + ((fp == stdout) || (fp == stdin) || (fp == stderr))) + { + /* initialize task hook facility if necessary */ + + if (_func_taskDeleteHookAdd == NULL) + taskHookInit (); + + taskDeleteHookAdd ((FUNCPTR) stdioStdfpCleanup); + stdioFpCleanupHookDone = TRUE; + } + + return (OK); + } + +/****************************************************************************** +* +* stdioFp - return the standard input/output/error FILE of the current task +* +* This routine returns the specified standard FILE structure address of the +* current task. It is provided primarily to give access to standard input, +* standard output, and standard error from the shell, where the usual +* `stdin', `stdout', `stderr' macros cannot be used. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: The standard FILE structure address of the specified file +* descriptor, for the current task. +*/ + +FILE * stdioFp + ( + int stdFd /* fd of standard FILE to return (0,1,2) */ + ) + { + if (taskIdCurrent->taskStdFp [stdFd] == NULL) + stdioInitStd (stdFd); + + return (taskIdCurrent->taskStdFp [stdFd]); + } + +/******************************************************************************* +* +* __stdin - get pointer to current task's stdin +* +* This function returns a pointer to the current task's stdin. If the +* current task does not have a stdin then one is created. +* +* NOMANUAL +*/ + +FILE ** __stdin (void) + { + if (taskIdCurrent->taskStdFp [STD_IN] == NULL) + stdioInitStd (STD_IN); + + return (&taskIdCurrent->taskStdFp [STD_IN]); + } + +/******************************************************************************* +* +* __stdout - get pointer to current task's stdout +* +* This function returns a pointer to the current task's stdout. If the +* current task does not have a stdout then one is created. +* +* NOMANUAL +*/ + +FILE ** __stdout (void) + { + if (taskIdCurrent->taskStdFp [STD_OUT] == NULL) + stdioInitStd (STD_OUT); + + return (&taskIdCurrent->taskStdFp [STD_OUT]); + } + +/******************************************************************************* +* +* __stderr - get pointer to current task's stderr +* +* This function returns a pointer to the current task's stderr. If the +* current task does not have a stderr then one is created. +* +* NOMANUAL +*/ + +FILE ** __stderr (void) + { + if (taskIdCurrent->taskStdFp [STD_ERR] == NULL) + stdioInitStd (STD_ERR); + + return (&taskIdCurrent->taskStdFp [STD_ERR]); + } + diff --git a/libc/stdio/stdioShow.c b/libc/stdio/stdioShow.c new file mode 100644 index 0000000..ec82bdc --- /dev/null +++ b/libc/stdio/stdioShow.c @@ -0,0 +1,97 @@ +/* stdioShow.c - standard I/O show library */ + +/* Copyright 1984-1993 Wind River Systems, Inc. */ +#include "copyright_wrs.h" + +/* +modification history +-------------------- +01f,17mar99,jdi doc: updated w/ info about proj facility (SPR 25727). +01e,16sep93,jmm cleaned up warnings about printf args +01d,15sep93,kdl fixed man page for stdioShowInit() (SPR #2244). +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf created. +*/ + +/* +DESCRIPTION +This library provides a show routine for file pointers. + +NOMANUAL +*/ + + +#include "vxWorks.h" +#include "stdio.h" +#include "sys/types.h" +#include "stdlib.h" +#include "taskLib.h" +#include "fioLib.h" +#include "classLib.h" +#include "errnoLib.h" +#include "private/objLibP.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* stdioShowInit - initialize the standard I/O show facility +* +* This routine links the file pointer show routine into the VxWorks system. +* It is called automatically when this show facility is +* configured into VxWorks using either of the following methods: +* .iP +* If you use the configuration header files, define +* INCLUDE_SHOW_ROUTINES in config.h. +* .iP +* If you use the Tornado project facility, select INCLUDE_STDIO_SHOW. +* +* RETURNS: OK, or ERROR if an error occurs installing the file pointer show +* routine. +*/ + +STATUS stdioShowInit (void) + { + classShowConnect (fpClassId, (FUNCPTR)stdioShow); + + return (OK); + } +/******************************************************************************* +* +* stdioShow - display file pointer internals +* +* This routine displays information about a specified stream. +* +* RETURNS: OK, or ERROR if the file pointer is invalid. +*/ + +STATUS stdioShow + ( + FAST FILE * fp, /* stream */ + int level /* level */ + ) + { + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (ERROR); /* invalid file pointer */ + + printf ("%-20s: %#-10x\n", "Owning Task", fp->taskId); + printf ("%-20s: %-10hd\n", "File Descriptor", fp->_file); + printf ("%-20s: %#-10x\n", "Current Position", (unsigned int) fp->_p); + printf ("%-20s: %#-10x\n", "Read Space Left", fp->_r); + printf ("%-20s: %#-10x\n", "Write Space Left", fp->_w); + printf ("%-20s: %#-10x\n", "Buffer Base", (unsigned int) fp->_bf._base); + printf ("%-20s: %#-10x\n", "Buffer Size", fp->_bf._size); + printf ("%-20s: %#-10x\n", "Ungetc Buffer Base", + (unsigned int) fp->_ub._base); + printf ("%-20s: %#-10x\n", "Ungetc Buffer Size", fp->_ub._size); + printf ("%-20s: %#-10x\n", "Line Buffer Base", (unsigned int) fp->_lb._base); + printf ("%-20s: %#-10x\n", "Line Buffer Size", fp->_lb._size); + printf ("%-20s: %#-10x\n", "stat.st_blksize", fp->_blksize); + printf ("%-20s: %#-10x\n", "lseek Offset", fp->_offset); + printf ("%-20s: %#-10hx\n", "Flags", fp->_flags); + + /* someday display the buffer contents with level >= 1 */ + + return (OK); + } diff --git a/libc/stdio/tmpfile.c b/libc/stdio/tmpfile.c new file mode 100644 index 0000000..c7665f1 --- /dev/null +++ b/libc/stdio/tmpfile.c @@ -0,0 +1,42 @@ +/* tmpfile.c - creat a temporary file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,05mar93,jdi documentation cleanup for 5.1. +01c,21sep92,smb tweaks for mg. +01b,20sep92,smb documentation additions +01a,29jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: stdio.h, string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" + +/******************************************************************************* +* +* tmpfile - create a temporary binary file (Unimplemented) (ANSI) +* +* This routine is not be implemented +* because VxWorks does not close all open files at task exit. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: NULL +*/ + +FILE * tmpfile (void) + { + return (NULL); + } diff --git a/libc/stdio/tmpnam.c b/libc/stdio/tmpnam.c new file mode 100644 index 0000000..767ef9c --- /dev/null +++ b/libc/stdio/tmpnam.c @@ -0,0 +1,78 @@ +/* tmpnam.c - devise a temporary name. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,23sep93,jmm made tmpnam()'s buffer static (spr 2525) +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: stdio.h, string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "string.h" + +/****************************************************************************** +* +* tmpnam - generate a temporary file name (ANSI) +* +* This routine generates a string that is a valid file name and not the same +* as the name of an existing file. It generates a different string each +* time it is called, up to TMP_MAX times. +* +* If the argument is a null pointer, tmpnam() leaves its +* result in an internal static object and returns a pointer to that +* object. Subsequent calls to tmpnam() may modify the same +* object. If the argument is not a null pointer, it is assumed to +* point to an array of at least L_tmpnam chars; tmpnam() writes +* its result in that array and returns the argument as its value. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: A pointer to the file name. +*/ + +char * tmpnam + ( + char * s /* name buffer */ + ) + { + int index; + char * pos; + ushort_t t; + static char buf [L_tmpnam]; /* internal buffer for name */ + static ushort_t seed = 0; /* used to generate unique name */ + + /* if parameter is NULL use internal buffer */ + if (s == NULL) + s = buf; + + /* generate unique name */ + + strcpy (s, "tmp"); + + /* fill up the name buffer from the last position */ + index = 5; + pos = s + strlen (s) + index; + *pos = '\0'; + + seed++; + for (t = seed; 0 <= --index; t >>= 3) + *--pos = '0' + (t & 07); + + /* return name buffer */ + return (s); + } diff --git a/libc/stdio/ungetc.c b/libc/stdio/ungetc.c new file mode 100644 index 0000000..5dc912d --- /dev/null +++ b/libc/stdio/ungetc.c @@ -0,0 +1,243 @@ +/* ungetc.c - return a character to a stream. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, stdlib.h, string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "stdlib.h" +#include "string.h" +#include "objLib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* __submore - internal routine +* +* Expand the ungetc buffer `in place'. That is, adjust fp->_p when +* the buffer moves, so that it points the same distance from the end, +* and move the bytes in the buffer around as necessary so that they +* are all at the end (stack-style). +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* NOMANUAL +*/ + +static int __submore + ( + FAST FILE *fp + ) + { + FAST int i; + FAST uchar_t * p; + + if (fp->_ub._base == fp->_ubuf) + { + /* Get a new buffer (rather than expanding the old one) */ + + if ((p = malloc ((size_t)BUFSIZ)) == NULL) + return (EOF); + + fp->_ub._base = p; + fp->_ub._size = BUFSIZ; + + p += BUFSIZ - sizeof(fp->_ubuf); + + for (i = sizeof(fp->_ubuf); --i >= 0;) + p[i] = fp->_ubuf[i]; + + fp->_p = p; + + return (0); + } + + i = fp->_ub._size; + + p = realloc (fp->_ub._base, i << 1); + + if (p == NULL) + return (EOF); + + (void) bcopy ((void *)p, (void *)(p + i), (size_t)i); + + fp->_p = p + i; + fp->_ub._base = p; + fp->_ub._size = i << 1; + + return (0); + } + +/****************************************************************************** +* +* ungetc - push a character back into an input stream (ANSI) +* +* This routine pushes a character (converted to an `unsigned char') back +* into the specified input stream. The pushed-back characters will be +* returned by subsequent reads on that stream in the reverse order of their +* pushing. A successful intervening call on the stream to a file +* positioning function (fseek(), fsetpos(), or rewind()) discards any +* pushed-back characters for the stream. The external storage corresponding +* to the stream is unchanged. +* +* One character of push-back is guaranteed. If ungetc() is called too many +* times on the same stream without an intervening read or file positioning +* operation, the operation may fail. +* +* If the value of equals EOF, the operation fails and the +* input stream is unchanged. +* +* A successful call to ungetc() clears the end-of-file indicator for the +* stream. The value of the file position indicator for the stream after +* reading or discarding all pushed-back characters is the same as it was +* before the character were pushed back. For a text stream, the value of +* its file position indicator after a successful call to ungetc() is +* unspecified until all pushed-back characters are read or discarded. +* For a binary stream, the file position indicator is decremented by each +* successful call to ungetc(); if its value was zero before a call, it is +* indeterminate after the call. +* +* INCLUDE: stdio.h +* +* RETURNS: +* The pushed-back character after conversion, or EOF if the operation fails. +* +* SEE ALSO: getc(), fgetc() +*/ + +int ungetc + ( + int c, /* character to push */ + FAST FILE * fp /* input stream */ + ) + { + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (EOF); + + if (c == EOF) + return (EOF); + + if ((fp->_flags & __SRD) == 0) + { + /* + * Not already reading: no good unless reading-and-writing. + * Otherwise, flush any current write stuff. + */ + + if ((fp->_flags & __SRW) == 0) + return (EOF); + + if (fp->_flags & __SWR) + { + if (__sflush(fp)) + return (EOF); + + fp->_flags &= ~__SWR; + fp->_w = 0; + fp->_lbfsize = 0; + } + fp->_flags |= __SRD; + } + + c = (uchar_t) c; + + /* + * If we are in the middle of ungetc'ing, just continue. + * This may require expanding the current ungetc buffer. + */ + + if (HASUB(fp)) + { + if (fp->_r >= fp->_ub._size && __submore(fp)) + return (EOF); + + *--fp->_p = c; + fp->_r++; + + return (c); + } + + /* + * If we can handle this by simply backing up, do so, + * but never replace the original character. + * (This makes sscanf() work when scanning `const' data.) + */ + + if ((fp->_bf._base != NULL) && + (fp->_p > fp->_bf._base) && + (fp->_p[-1] == c)) + { + fp->_p--; + fp->_r++; + + return (c); + } + + /* + * Create an ungetc buffer. + * Initially, we will use the `reserve' buffer. + */ + + fp->_ur = fp->_r; + fp->_up = fp->_p; + fp->_ub._base = fp->_ubuf; + fp->_ub._size = sizeof(fp->_ubuf); + fp->_ubuf[sizeof(fp->_ubuf) - 1] = c; + fp->_p = &fp->_ubuf[sizeof(fp->_ubuf) - 1]; + fp->_r = 1; + + return (c); + } diff --git a/libc/stdio/vfprintf.c b/libc/stdio/vfprintf.c new file mode 100644 index 0000000..61956b6 --- /dev/null +++ b/libc/stdio/vfprintf.c @@ -0,0 +1,160 @@ +/* vfprintf.c - print to a file. stdio.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05mar93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,29jul92,jcf Added OBJ_VERIFY, use fioFormatV() + +smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, stdarg.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdarg.h" +#include "fioLib.h" +#include "objLib.h" +#include "private/stdioP.h" + +/* forward declarations */ + +LOCAL STATUS putbuf (char *buffer, int nbytes, FILE *fp); + + +/******************************************************************************* +* +* vfprintf - write a formatted string to a stream (ANSI) +* +* This routine is equivalent to fprintf(), except that it takes the variable +* arguments to be formatted from a list of type `va_list' rather +* than from in-line arguments. +* +* INCLUDE FILES: stdio.h +* +* RETURNS: +* The number of characters written, or a negative value if an +* output error occurs. +* +* SEE ALSO: fprintf() +*/ + +int vfprintf + ( + FILE * fp, /* stream to write to */ + const char * fmt, /* format string */ + va_list vaList /* arguments to format string */ + ) + { + uchar_t localbuf[BUFSIZE]; + int ret; + FILE fake; + + if (OBJ_VERIFY (fp, fpClassId) != OK) + return (EOF); + + if (cantwrite (fp)) + return (EOF); + + if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) && fp->_file >= 0) + { + /* + * This optimizes an fprintf to unbuffered unix file by creating a + * temporary buffer. This avoids worries about ungetc buffers and + * so forth. It is particularly useful for stderr. + */ + + fake._flags = fp->_flags & ~__SNBF; /* turn on buffering */ + fake._file = fp->_file; /* store fd */ + fake._bf._base = fake._p = localbuf; /* set up the buffer */ + fake._bf._size = fake._w = sizeof(localbuf); /* initialize size */ + fake._lbfsize = 0; /* init to be safe */ + fake._r = 0; /* init to be safe */ + fake._ub._base = NULL; /* init to be safe */ + fake._ub._size = 0; /* init to be safe */ + fake._lb._base = NULL; /* init to be safe */ + fake._lb._size = 0; /* init to be safe */ + objCoreInit (&fake.objCore, fpClassId); /* validate fake fp */ + + ret = fioFormatV (fmt, vaList, putbuf, (int) &fake); + + if ((ret >= 0) && fflush (&fake)) + ret = EOF; + + if (fake._flags & __SERR) + fp->_flags |= __SERR; + + objCoreTerminate (&fake.objCore); /* invalidate fp */ + } + else + { + ret = fioFormatV (fmt, vaList, putbuf, (int) fp); + ret = (ferror (fp)) ? EOF : ret; + } + + return (ret); + } + +/******************************************************************************* +* +* putbuf - put a buffer on an output stream +* NOMANUAL +*/ + +LOCAL STATUS putbuf + ( + char * buffer, /* source */ + int nbytes, /* number of bytes in source */ + FILE * fp /* stream */ + ) + { + FAST int ix; + + for (ix = 0; ix < nbytes; ix++) + putc (buffer [ix], fp); + + return (OK); + } diff --git a/libc/stdio/wbuf.c b/libc/stdio/wbuf.c new file mode 100644 index 0000000..7afc788 --- /dev/null +++ b/libc/stdio/wbuf.c @@ -0,0 +1,125 @@ +/* wbuf.c - file for stdio.h */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* __swbuf - +* +* Write the given character into the (probably full) buffer for +* the given file. Flush the buffer out if it is or becomes full, +* or if c=='\n' and the file is line buffered. +* +* INCLUDE: stdio.h +* +* RETURNS: +* NOMANAUL +*/ + +int __swbuf + ( + FAST int c, + FAST FILE * fp + ) + { + FAST int n; + + /* + * In case we cannot write, or longjmp takes us out early, + * make sure _w is 0 (if fully- or un-buffered) or -_bf._size + * (if line buffered) so that we will get called again. + * If we did not do this, a sufficient number of putc() + * calls might wrap _w from negative to positive. + */ + + fp->_w = fp->_lbfsize; + + if (cantwrite (fp)) + return (EOF); + + c = (uchar_t)c; + + /* + * If it is completely full, flush it out. Then, in any case, + * stuff c into the buffer. If this causes the buffer to fill + * completely, or if c is '\n' and the file is line buffered, + * flush it (perhaps a second time). The second flush will always + * happen on unbuffered streams, where _bf._size==1; fflush() + * guarantees that putc() will always call wbuf() by setting _w + * to 0, so we need not do anything else. + */ + + n = fp->_p - fp->_bf._base; + + if (n >= fp->_bf._size) + { + if (fflush (fp)) + return (EOF); + + n = 0; + } + + fp->_w--; + *fp->_p++ = c; + + if ((++n == fp->_bf._size) || (fp->_flags & __SLBF && c == '\n')) + if (fflush (fp)) + return (EOF); + + return (c); + } diff --git a/libc/stdio/wsetup.c b/libc/stdio/wsetup.c new file mode 100644 index 0000000..222d979 --- /dev/null +++ b/libc/stdio/wsetup.c @@ -0,0 +1,121 @@ +/* wsetbuf.c - file for stdio.h */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,20sep92,smb documentation additions +01a,29jul92,smb taken from UCB stdio +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILE: stdio.h, stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdio.h" +#include "stdlib.h" +#include "private/stdioP.h" + + +/****************************************************************************** +* +* __swsetup - +* +* Various output routines call wsetup to be sure it is safe to write, +* because either _flags does not include __SWR, or _buf is NULL. +* _wsetup returns 0 if OK to write, nonzero otherwise. +* +* +* INCLUDE: stdio.h +* +* RETURNS: +* NOMANUAL +*/ + +int __swsetup + ( + FAST FILE *fp + ) + { + /* If we are not writing, we had better be reading and writing */ + + if ((fp->_flags & __SWR) == 0) + { + if ((fp->_flags & __SRW) == 0) + return (EOF); + + if (fp->_flags & __SRD) + { + /* clobber any ungetc data */ + if (HASUB(fp)) + FREEUB(fp); + + fp->_flags &= ~(__SRD|__SEOF); + fp->_r = 0; + fp->_p = fp->_bf._base; + } + + fp->_flags |= __SWR; + } + + /* Make a buffer if necessary, then set _w */ + + if (fp->_bf._base == NULL) + __smakebuf (fp); + + if (fp->_flags & __SLBF) + { + /* + * It is line buffered, so make _lbfsize be -_bufsize + * for the putc() macro. We will change _lbfsize back + * to 0 whenever we turn off __SWR. + */ + fp->_w = 0; + fp->_lbfsize = -fp->_bf._size; + } + else + fp->_w = fp->_flags & __SNBF ? 0 : fp->_bf._size; + + return (0); + } diff --git a/libc/stdlib/Makefile b/libc/stdlib/Makefile new file mode 100644 index 0000000..1a8583c --- /dev/null +++ b/libc/stdlib/Makefile @@ -0,0 +1,28 @@ +# Makefile - makefile for vw/src/libc/ctype +# +# modification history +# -------------------- +# 01b,12oct01,tam added repackaging support +# 01a,18jun96,yp created from 01d of MakeSkel +# +# DESCRIPTION +# This file contains the makefile rules for building the vx library +# +#*/ + +TGT_DIR=$(WIND_BASE)/target + +LIB_BASE_NAME = os + +DOC_FILES= ansiStdlib.c + +## ansiStdlib.c includes the following files +# abort.c abs.c atexit.c atof.c atoi.c atol.c bsearch.c div.c +# labs.c ldiv.c multibyte.c qsort.c rand.c strtod.c strtol.c +# strtoul.c system.c + +OBJS= abort.o abs.o atexit.o atof.o atoi.o atol.o bsearch.o div.o labs.o \ + ldiv.o multibyte.o qsort.o rand.o strtod.o strtol.o strtoul.o system.o + +include $(TGT_DIR)/h/make/rules.library + diff --git a/libc/stdlib/abort.c b/libc/stdlib/abort.c new file mode 100644 index 0000000..f7a1ef6 --- /dev/null +++ b/libc/stdlib/abort.c @@ -0,0 +1,50 @@ +/* abort.c - abort file for stdlib */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,08feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions. +01b,27jul92,smb abort now raises an abort signal. +01a,19jul92,smb Phase 1 of ANSI merge. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: stdlib.h, signal.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" +#include "signal.h" + +/****************************************************************************** +* +* abort - cause abnormal program termination (ANSI) +* +* This routine causes abnormal program termination, unless the signal +* SIGABRT is being caught and the signal handler does not return. VxWorks +* does not flush output streams, close open streams, or remove temporary +* files. abort() returns unsuccessful status termination to the host +* environment by calling: +* .CS +* raise (SIGABRT); +* .CE +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: This routine cannot return to the caller. +*/ + +void abort (void) + { + raise (SIGABRT); + exit (EXIT_FAILURE); + } diff --git a/libc/stdlib/abs.c b/libc/stdlib/abs.c new file mode 100644 index 0000000..fdd13e3 --- /dev/null +++ b/libc/stdlib/abs.c @@ -0,0 +1,44 @@ +/* abs.c - abs file for stdlib */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,08feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions. +01a,19jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" + +/******************************************************************************* +* +* abs - compute the absolute value of an integer (ANSI) +* +* This routine computes the absolute value of a specified integer. If the +* result cannot be represented, the behavior is undefined. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: The absolute value of . +*/ + +int abs + ( + int i /* integer for which to return absolute value */ + ) + { + return (i >= 0 ? i : -i); + } diff --git a/libc/stdlib/ansiStdlib.c b/libc/stdlib/ansiStdlib.c new file mode 100644 index 0000000..77ce2a0 --- /dev/null +++ b/libc/stdlib/ansiStdlib.c @@ -0,0 +1,2045 @@ +/* ansiStdlib.c - ANSI 'stdlib' documentation */ + +/* Copyright 1992-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,11jul97,dgp doc: SPR 7651 and 7677, specify non-reentrant functions +01c,10feb95,jdi doc tweaks for div_r(), strtod(), strtol(). +01b,08feb93,jdi documentation cleanup for 5.1. +01a,24oct92,smb written and documented. +*/ + +/* +DESCRIPTION +This library includes several standard ANSI routines. Note that where +there is a pair of routines, such as div() and div_r(), only the routine +xxx_r() is reentrant. The xxx() routine is not reentrant. + +The header stdlib.h declares four types and several functions of general +utility, and defines several macros. + +.SS Types +The types declared are `size_t', `wchar_t', and: +.iP `div_t' 12 +is the structure type of the value returned by the div(). +.iP `ldiv_t' +is the structure type of the value returned by the ldiv_t(). + +.SS Macros +The macros defined are NULL and: +.iP "`EXIT_FAILURE', `EXIT_SUCCESS'" 12 +expand to integral constant expressions that may be used as the +argument to exit() to return unsuccessful or successful termination +status, respectively, to the host environment. +.iP `RAND_MAX' +expands to a positive integer expression whose value is the maximum +number of bytes on a multibyte character for the extended character set +specified by the current locale, and whose value is never greater +than MB_LEN_MAX. +.LP + +INCLUDE FILES: stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +INTERNAL +This module is built by appending the following files: + abort.c + abs.c + atexit.c + atof.c + atoi.c + atol.c + bsearch.c + div.c + labs.c + ldiv.c + multibyte.c + qsort.c + rand.c + strtod.c + strtol.c + strtoul.c + system.c +*/ + +/* abort.c - abort file for stdlib */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,08feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions. +01b,27jul92,smb abort now raises an abort signal. +01a,19jul92,smb Phase 1 of ANSI merge. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: stdlib.h, signal.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" +#include "signal.h" + +/****************************************************************************** +* +* abort - cause abnormal program termination (ANSI) +* +* This routine causes abnormal program termination, unless the signal +* SIGABRT is being caught and the signal handler does not return. VxWorks +* does not flush output streams, close open streams, or remove temporary +* files. abort() returns unsuccessful status termination to the host +* environment by calling: +* .CS +* raise (SIGABRT); +* .CE +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: This routine cannot return to the caller. +*/ + +void abort (void) + { + raise (SIGABRT); + exit (EXIT_FAILURE); + } +/* abs.c - abs file for stdlib */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,08feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions. +01a,19jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" + +/******************************************************************************* +* +* abs - compute the absolute value of an integer (ANSI) +* +* This routine computes the absolute value of a specified integer. If the +* result cannot be represented, the behavior is undefined. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: The absolute value of . +*/ + +int abs + ( + int i /* integer for which to return absolute value */ + ) + { + return (i >= 0 ? i : -i); + } +/* atexit.c - atexit file for stdlib */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,08feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions. +01a,19jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: stdlib.h, signal.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" + +/******************************************************************************* +* +* atexit - call a function at program termination (Unimplemented) (ANSI) +* +* This routine is unimplemented. VxWorks task exit hooks +* provide this functionality. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: ERROR, always. +* +* SEE ALSO: taskHookLib +*/ + +int atexit + ( + void (*__func)(void) /* pointer to a function */ + ) + { + return (ERROR); + } + +/* atof.c - atof files for stdlib */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,08feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions. +01a,19jul92,smb written and documentation. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" + +/******************************************************************************* +* +* atof - convert a string to a `double' (ANSI) +* +* This routine converts the initial portion of the string +* to double-precision representation. +* +* Its behavior is equivalent to: +* .CS +* strtod (s, (char **)NULL); +* .CE +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: The converted value in double-precision representation. +*/ + +double atof + ( + const char * s /* pointer to string */ + ) + { + return (strtod (s, (char **) NULL)); + } +/* atoi.c - atoi files for stdlib */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,08feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions. +01a,19jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" + +/****************************************************************************** +* +* atoi - convert a string to an `int' (ANSI) +* +* This routine converts the initial portion of the string +* to `int' representation. +* +* Its behavior is equivalent to: +* .CS +* (int) strtol (s, (char **) NULL, 10); +* .CE +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: The converted value represented as an `int'. +*/ + +int atoi + ( + const char * s /* pointer to string */ + ) + { + return (int) strtol (s, (char **) NULL, 10); + } +/* atol.c - atol files for stdlib */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,08feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions. +01a,19jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" + +/***************************************************************************** +* +* atol - convert a string to a `long' (ANSI) +* +* This routine converts the initial portion of the string +* to long integer representation. +* +* Its behavior is equivalent to: +* .CS +* strtol (s, (char **)NULL, 10); +* .CE +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: The converted value represented as a `long'. +*/ + +long atol + ( + const register char * s /* pointer to string */ + ) + { + return strtol (s, (char **) NULL, 10); + } +/* bsearch.c - bsearch routine for the stdlib ANSI library */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,08feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions. +01a,19jul92,smb written and documented +*/ + +/* +DESCRIPTION + +INCLUDE FILE: stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" + +/****************************************************************************** +* +* bsearch - perform a binary search (ANSI) +* +* This routine searches an array of objects, the initial element of +* which is pointed to by , for an element that matches the object +* pointed to by . The of each element of the array is specified +* by . +* +* The comparison function pointed to by is called with two arguments +* that point to the object and to an array element, in that order. The +* function shall return an integer less than, equal to, or greater than zero if +* the object is considered, respectively, to be less than, to match, or +* to be greater than the array element. The array shall consist of all the +* elements that compare greater than the object, in that order. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: +* A pointer to a matching element of the array, or a NULL pointer +* if no match is found. If two elements compare as equal, which element +* is matched is unspecified. +*/ + +void * bsearch + ( + FAST const void * key, /* element to match */ + const void * base0, /* initial element in array */ + size_t nmemb, /* array to search */ + FAST size_t size, /* size of array element */ + FAST int (*compar) (const void *, const void *) /* comparison function */ + ) + { + FAST const char * base = base0; + FAST const void * p; + FAST int lim; + FAST int cmp; + + for (lim = nmemb; lim != 0; lim >>= 1) + { + p = base + (lim >> 1) * size; + cmp = (*compar)(key, p); + + if (cmp == 0) + return (CHAR_FROM_CONST (p)); + + if (cmp > 0) + { /* key > p: move right */ + base = (CHAR_FROM_CONST (p) + size); + lim--; + } + } + + return (NULL); + } +/* div.c - div file for stdlib */ + +/* Copyright 1992-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,10feb95,jdi doc format tweak. +01e,08feb93,jdi documentation cleanup for 5.1. +01d,20sep92,smb documentation additions. +01c,24jul92,smb corrected parameter ordering. +01b,24jul92,smb added reentrant version for div() +01a,19jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" + +/******************************************************************************* +* +* div - compute a quotient and remainder (ANSI) +* +* This routine computes the quotient and remainder of /. +* If the division is inexact, the resulting quotient is the integer of lesser +* magnitude that is the nearest to the algebraic quotient. If the result cannot +* be represented, the behavior is undefined; otherwise, `quot' * + `rem' +* equals . +* +* This routine is not reentrant. For a reentrant version, see div_r(). +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: +* A structure of type `div_t', containing both the quotient and the +* remainder. +* +* INTERNAL +* The structure shall contain the following members, in either order: +* int quot; * quotient * +* int rem; * remainder * +*/ + +div_t div + ( + int numer, /* numerator */ + int denom /* denominator */ + ) + { + static div_t divStruct; /* div_t structure */ + + div_r (numer, denom, &divStruct); + return (divStruct); + } + +/******************************************************************************* +* +* div_r - compute a quotient and remainder (reentrant) +* +* This routine computes the quotient and remainder of /. +* The quotient and remainder are stored in the `div_t' structure +* pointed to by . +* +* This routine is the reentrant version of div(). +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: N/A +*/ + +void div_r + ( + int numer, /* numerator */ + int denom, /* denominator */ + div_t * divStructPtr /* div_t structure */ + ) + { + /* calculate quotient */ + divStructPtr->quot = numer / denom; + + /* calculate remainder */ + divStructPtr->rem = numer - (denom * divStructPtr->quot); + + /* check for negative quotient */ + if ((divStructPtr->quot < 0) && (divStructPtr->rem > 0)) + { + divStructPtr->quot++; + divStructPtr->rem -= denom; + } + } +/* labs.c - labs file for stdlib */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,08feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions. +01a,19jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" + +/******************************************************************************* +* +* labs - compute the absolute value of a `long' (ANSI) +* +* This routine computes the absolute value of a specified `long'. If the +* result cannot be represented, the behavior is undefined. This routine is +* equivalent to abs(), except that the argument and return value are all of +* type `long'. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: The absolute value of . +*/ + +long labs + ( + long i /* long for which to return absolute value */ + ) + { + return (i >= 0 ? i : -i); + } + +/* ldiv.c - ldiv file for stdlib */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,08feb93,jdi documentation cleanup for 5.1. +01d,20sep92,smb documentation additions. +01c,24jul92,smb corrected parameter ordering. +01b,24jul92,smb added reentrant version of ldiv() +01a,19jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" + +/******************************************************************************* +* +* ldiv - compute the quotient and remainder of the division (ANSI) +* +* This routine computes the quotient and remainder of /. +* This routine is similar to div(), except that the arguments and the +* elements of the returned structure are all of type `long'. +* +* This routine is not reentrant. For a reentrant version, see ldiv_r(). +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: +* A structure of type `ldiv_t', containing both the quotient and the +* remainder. +*/ + +ldiv_t ldiv + ( + long numer, /* numerator */ + long denom /* denominator */ + ) + { + static ldiv_t divStruct; + + ldiv_r (numer, denom, &divStruct); + return (divStruct); + } + +/******************************************************************************* +* +* ldiv_r - compute a quotient and remainder (reentrant) +* +* This routine computes the quotient and remainder of /. +* The quotient and remainder are stored in the `ldiv_t' structure +* `divStructPtr'. +* +* This routine is the reentrant version of ldiv(). +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: N/A +*/ + +void ldiv_r + ( + long numer, /* numerator */ + long denom, /* denominator */ + ldiv_t * divStructPtr /* ldiv_t structure */ + ) + { + /* calculate quotient */ + divStructPtr->quot = numer / denom; + + /* calculate remainder */ + divStructPtr->rem = numer - (denom * divStructPtr->quot); + + /* check for negative quotient */ + if ((divStructPtr->quot < 0) && (divStructPtr->rem > 0)) + { + divStructPtr->quot++; + divStructPtr->rem -= denom; + } + } +/* multibyte.c - multibyte file for stdlib */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,08feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions. +01a,19jul92,smb written and documented. +*/ + +/* +DESCRIPTION +These ignore the current fixed ("C") locale and +always indicate that no multibyte characters are supported. + +INCLUDE FILES: stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" +#include "string.h" + +/****************************************************************************** +* +* mblen - calculate the length of a multibyte character (Unimplemented) (ANSI) +* +* This multibyte character function is unimplemented in VxWorks. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: OK, or ERROR if the parameters are invalid. +*/ + +int mblen + ( + const char * s, + size_t n + ) + { + if ((strcmp (s,NULL) == 0) && (n == 0) && (*s == EOS)) + return (ERROR); + + return (OK); + } + +/****************************************************************************** +* +* mbtowc - convert a multibyte character to a wide character (Unimplemented) (ANSI) +* +* This multibyte character function is unimplemented in VxWorks. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: OK, or ERROR if the parameters are invalid. +*/ + +int mbtowc + ( + wchar_t * pwc, + const char * s, + size_t n + ) + { + if ((strcmp (s,NULL) == 0) && (n == 0) && (*s == EOS)) + return (ERROR); + + return (OK); + } + +/****************************************************************************** +* +* wctomb - convert a wide character to a multibyte character (Unimplemented) (ANSI) +* +* This multibyte character function is unimplemented in VxWorks. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: OK, or ERROR if the parameters are invalid. +*/ + +int wctomb + ( + char * s, + wchar_t wchar + ) + { + if (strcmp (s,NULL) == 0) + return (ERROR); + + return (OK); + } + +/****************************************************************************** +* +* mbstowcs - convert a series of multibyte char's to wide char's (Unimplemented) (ANSI) +* +* This multibyte character function is unimplemented in VxWorks. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: OK, or ERROR if the parameters are invalid. +*/ + +size_t mbstowcs + ( + wchar_t * pwcs, + const char * s, + size_t n + ) + { + if ((strcmp (s,NULL) == 0) && (n == 0) && (*s == EOS)) + return (ERROR); + + return (OK); + } + +/****************************************************************************** +* +* wcstombs - convert a series of wide char's to multibyte char's (Unimplemented) (ANSI) +* +* This multibyte character function is unimplemented in VxWorks. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: OK, or ERROR if the parameters are invalid. +*/ + +size_t wcstombs + ( + char * s, + const wchar_t * pwcs, + size_t n + ) + { + if ((strcmp (pwcs,NULL) == 0) && (n == 0) && (*pwcs == (wchar_t) EOS)) + return (ERROR); + + return (OK); + } +/* qsort.c - qsort file for stdlib */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,01jul93,jmm fixed parameter order of quick_sort and insertion_sort (spr 2202) +01c,08feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions. +01a,19jul92,smb written and documented. +*/ + +/* +DESCRIPTION + * Copyright (c) 1980, 1983, 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * +INCLUDE FILES: stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" + +/* + * MTHRESH is the smallest partition for which we compare for a median + * value instead of using the middle value. + */ +#define MTHRESH 6 + +/* + * THRESH is the minimum number of entries in a partition for continued + * partitioning. + */ +#define THRESH 4 + +static void insertion_sort(), quick_sort(); + + +/* + * Swap two areas of size number of bytes. Although qsort(3) permits random + * blocks of memory to be sorted, sorting pointers is almost certainly the + * common case (and, were it not, could easily be made so). Regardless, it + * isn't worth optimizing; the SWAP's get sped up by the cache, and pointer + * arithmetic gets lost in the time required for comparison function calls. + */ +#define SWAP(a, b) \ + { \ + cnt = size; \ + do \ + { \ + ch = *a; \ + *a++ = *b; \ + *b++ = ch; \ + } while (--cnt); \ + } + +/* + * Knuth, Vol. 3, page 116, Algorithm Q, step b, argues that a single pass + * of straight insertion sort after partitioning is complete is better than + * sorting each small partition as it is created. This isn't correct in this + * implementation because comparisons require at least one (and often two) + * function calls and are likely to be the dominating expense of the sort. + * Doing a final insertion sort does more comparisons than are necessary + * because it compares the "edges" and medians of the partitions which are + * known to be already sorted. + * + * This is also the reasoning behind selecting a small THRESH value (see + * Knuth, page 122, equation 26), since the quicksort algorithm does less + * comparisons than the insertion sort. + */ +#define SORT(bot, n) \ + { \ + if (n > 1) \ + if (n == 2) \ + { \ + t1 = bot + size; \ + if (compar (t1, bot) < 0) \ + SWAP (t1, bot); \ + } \ + else \ + insertion_sort(bot, n, size, compar); \ + } + +/****************************************************************************** +* +* qsort - sort an array of objects (ANSI) +* +* This routine sorts an array of objects, the initial element of +* which is pointed to by . The size of each object is specified by +* . +* +* The contents of the array are sorted into ascending order according to a +* comparison function pointed to by , which is called with two +* arguments that point to the objects being compared. The function shall +* return an integer less than, equal to, or greater than zero if the first +* argument is considered to be respectively less than, equal to, or greater +* than the second. +* +* If two elements compare as equal, their order in the sorted array is +* unspecified. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: N/A +*/ +void qsort + ( + void * bot, /* initial element in array */ + size_t nmemb, /* no. of objects in array */ + size_t size, /* size of array element */ + int (*compar) (const void *, const void *) /* comparison function */ + ) + { + /* static void insertion_sort(), quick_sort(); */ + + if (nmemb <= 1) + return; + + if (nmemb >= THRESH) + quick_sort (bot, nmemb, size, compar); + else + insertion_sort (bot, nmemb, size, compar); + } + +/****************************************************************************** +* +* quick_sort - sort an array of objects. +* +* RETURNS: no value. +* NOMANUAL +*/ + +static void quick_sort + ( + FAST char * bot, + int nmemb, + FAST int size, + int (*compar)() + ) + { + FAST int cnt; + FAST uint_t ch; + FAST char * top; + FAST char * mid; + FAST char * t1; + FAST char * t2; + FAST int n1; + FAST int n2; + char * bsv; + + /* bot and nmemb must already be set. */ + +partition: + + /* find mid and top elements */ + mid = bot + size * (nmemb >> 1); + top = bot + (nmemb - 1) * size; + + /* + * Find the median of the first, last and middle element (see Knuth, + * Vol. 3, page 123, Eq. 28). This test order gets the equalities + * right. + */ + if (nmemb >= MTHRESH) + { + n1 = compar (bot, mid); + n2 = compar (mid, top); + + if ((n1 < 0) && (n2 > 0)) + t1 = compar (bot, top) < 0 ? top : bot; + else + if ((n1 > 0) && (n2 < 0)) + t1 = compar (bot, top) > 0 ? top : bot; + else + t1 = mid; + + /* if mid element not selected, swap selection there */ + if (t1 != mid) + { + SWAP (t1, mid); + mid -= size; + } + } + + /* Standard quicksort, Knuth, Vol. 3, page 116, Algorithm Q. */ +#define didswap n1 +#define newbot t1 +#define replace t2 + + didswap = 0; + bsv = bot; + + FOREVER + { + while ((bot < mid) && (compar (bot, mid) <= 0)) + { + bot += size; + } + + while (top > mid) + { + if (compar (mid, top) <= 0) + { + top -= size; + continue; + } + newbot = bot + size; /* value of bot after swap */ + + if (bot == mid) /* top <-> mid, mid == top */ + replace = mid = top; + else + { /* bot <-> top */ + replace = top; + top -= size; + } + goto swap; + } + + if (bot == mid) + break; + + /* bot <-> mid, mid == bot */ + replace = mid; + newbot = mid = bot; /* value of bot after swap */ + top -= size; + +swap: SWAP(bot, replace); + + bot = newbot; + didswap = 1; + } + + /* + * Quicksort behaves badly in the presence of data which is already + * sorted (see Knuth, Vol. 3, page 119) going from O N lg N to O N^2. + * To avoid this worst case behavior, if a re-partitioning occurs + * without swapping any elements, it is not further partitioned and + * is insert sorted. This wins big with almost sorted data sets and + * only loses if the data set is very strangely partitioned. A fix + * for those data sets would be to return prematurely if the insertion + * sort routine is forced to make an excessive number of swaps, and + * continue the partitioning. + */ + if (!didswap) + { + insertion_sort (bsv, nmemb, size, compar); + return; + } + + /* + * Re-partition or sort as necessary. Note that the mid element + * itself is correctly positioned and can be ignored. + */ +#define nlower n1 +#define nupper n2 + + bot = bsv; + nlower = (mid - bot) / size; /* size of lower partition */ + mid += size; + nupper = nmemb - nlower - 1; /* size of upper partition */ + + /* + * If must call recursively, do it on the smaller partition; this + * bounds the stack to lg N entries. + */ + if (nlower > nupper) + { + if (nupper >= THRESH) + quick_sort (mid, nupper, size, compar); + else + { + SORT (mid, nupper); + if (nlower < THRESH) + { + SORT (bot, nlower); + return; + } + } + nmemb = nlower; + } + else + { + if (nlower >= THRESH) + quick_sort (bot, nlower, size, compar); + else + { + SORT (bot, nlower); + if (nupper < THRESH) + { + SORT (mid, nupper); + return; + } + } + bot = mid; + nmemb = nupper; + } + goto partition; + /* NOTREACHED */ + } + +/****************************************************************************** +* +* insertion_sort - internal routine +* +* RETURNS: no value. +* NOMANUAL +*/ + +static void insertion_sort + ( + char * bot, + int nmemb, + FAST int size, + int (*compar)() + ) + { + FAST int cnt; + FAST uint_t ch; + FAST char * s1; + FAST char * s2; + FAST char * t1; + FAST char * t2; + FAST char * top; + + /* + * A simple insertion sort (see Knuth, Vol. 3, page 81, Algorithm + * S). Insertion sort has the same worst case as most simple sorts + * (O N^2). It gets used here because it is (O N) in the case of + * sorted data. + */ + top = bot + nmemb * size; + + for (t1 = bot + size; t1 < top;) + { + for (t2 = t1; ((t2 -= size) >= bot) && (compar (t1, t2) < 0);) + ; + if (t1 != (t2 += size)) + { + /* Bubble bytes up through each element. */ + for (cnt = size; cnt--; ++t1) + { + ch = *t1; + for (s1 = s2 = t1; (s2 -= size) >= t2; s1 = s2) + { + *s1 = *s2; + } + *s1 = ch; + } + } + else + t1 += size; + } + } +/* rand.c - rand, srand functions for stdlib */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,08feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions. +01a,19jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" + +ulong_t _Randseed = 1; + +/******************************************************************************* +* +* rand - generate a pseudo-random integer between 0 and RAND_MAX (ANSI) +* +* This routine generates a pseudo-random integer between 0 and RAND_MAX. +* The seed value for rand() can be reset with srand(). +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: A pseudo-random integer. +* +* SEE ALSO: srand() +*/ + +int rand (void) + { + _Randseed = _Randseed * 1103515245 + 12345; + return (uint_t) (_Randseed/65536) % (RAND_MAX + 1); + } + +/******************************************************************************* +* +* srand - reset the value of the seed used to generate random numbers (ANSI) +* +* This routine resets the seed value used by rand(). If srand() is then +* called with the same seed value, the sequence of pseudo-random numbers is +* repeated. If rand() is called before any calls to srand() have been made, +* the same sequence shall be generated as when srand() is first called with +* the seed value of 1. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: N/A +* +* SEE ALSO: rand() +*/ + +void * srand + ( + uint_t seed /* random number seed */ + ) + { + _Randseed = seed; + return (void *)0; + } +/* strtod.c function for stdlib */ + +/* Copyright 1992-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,11feb95,jdi doc fix. +01d,16aug93,dvs fixed value of endptr for strings that start with d, D, e, or E + (SPR #2229) +01c,08feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions. +01a,19jul92,smb written and documented +*/ + +/* +DESCRIPTION + +INCLUDE FILES: stdlib.h, math.h, assert.h, arrno.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" +#include "math.h" +#include "errno.h" + +#define Ise(c) ((c == 'e') || (c == 'E') || (c == 'd') || (c == 'D')) +#define Isdigit(c) ((c <= '9') && (c >= '0')) +#define Isspace(c) ((c == ' ') || (c == '\t') || (c=='\n') || (c=='\v') \ + || (c == '\r') || (c == '\f')) +#define Issign(c) ((c == '-') || (c == '+')) +#define Val(c) ((c - '0')) + +#define MAXE 308 +#define MINE (-308) + +static double powtab[] = {1.0, + 10.0, + 100.0, + 1000.0, + 10000.0}; + +/* flags */ +#define SIGN 0x01 +#define ESIGN 0x02 +#define DECP 0x04 + +/* locals */ + +int __ten_mul (double *acc, int digit); +double __adjust (double *acc, int dexp, int sign); +double __exp10 (uint_t x); + +/***************************************************************************** +* +* strtod - convert the initial portion of a string to a double (ANSI) +* +* This routine converts the initial portion of a specified string to a +* double. First, it decomposes the input string into three parts: an initial, +* possibly empty, sequence of white-space characters (as specified by the +* isspace() function); a subject sequence resembling a floating-point +* constant; and a final string of one or more unrecognized characters, +* including the terminating null character of the input string. Then, it +* attempts to convert the subject sequence to a floating-point number, and +* returns the result. +* +* The expected form of the subject sequence is an optional plus or minus +* decimal-point character, then an optional exponent part but no floating +* suffix. The subject sequence is defined as the longest initial +* subsequence of the input string, starting with the first non-white-space +* character, that is of the expected form. The subject sequence contains +* no characters if the input string is empty or consists entirely of +* white space, or if the first non-white-space character is other than a +* sign, a digit, or a decimal-point character. +* +* If the subject sequence has the expected form, the sequence of characters +* starting with the first digit or the decimal-point character (whichever +* occurs first) is interpreted as a floating constant, except that the +* decimal-point character is used in place of a period, and that if neither +* an exponent part nor a decimal-point character appears, a decimal point is +* assumed to follow the last digit in the string. If the subject sequence +* begins with a minus sign, the value resulting form the conversion is negated. +* A pointer to the final string is stored in the object pointed to by , +* provided that is not a null pointer. +* +* In other than the "C" locale, additional implementation-defined subject +* sequence forms may be accepted. VxWorks supports only the "C" locale. +* +* If the subject sequence is empty or does not have the expected form, no +* conversion is performed; the value of is stored in the object pointed +* to by , provided that is not a null pointer. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: +* The converted value, if any. If no conversion could be performed, it +* returns zero. If the correct value is outside the range of representable +* values, it returns plus or minus HUGE_VAL (according to the sign of the +* value), and stores the value of the macro ERANGE in `errno'. If the +* correct value would cause underflow, it returns zero and stores the value +* of the macro ERANGE in `errno'. +* +*/ + +double strtod + ( + const char * s, /* string to convert */ + char ** endptr /* ptr to final string */ + ) + { + /* Note that the point positioning is locale dependant */ + const char *start = s; + double accum = 0.0; + int flags = 0; + int texp = 0; + int e = 0; + BOOL conv_done = FALSE; + + while (Isspace (*s)) s++; + if (*s == EOS) + { /* just leading spaces */ + if (endptr != NULL) + *endptr = CHAR_FROM_CONST (start); + + return (0.0); + } + + if (Issign (*s)) + { + if (*s == '-') flags = SIGN; + + if (*++s == EOS) + { /* "+|-" : should be an error ? */ + if (endptr != NULL) + *endptr = CHAR_FROM_CONST (start); + + return (0.0); + } + } + + /* added code to fix problem with leading e, E, d, or D */ + + if ( !Isdigit (*s) && (*s != '.')) + { + if (endptr != NULL) + *endptr = CHAR_FROM_CONST (start); + + return (0.0); + } + + + for ( ; (Isdigit (*s) || (*s == '.')); s++) + { + conv_done = TRUE; + + if (*s == '.') + flags |= DECP; + else + { + if ( __ten_mul (&accum, Val(*s)) ) + texp++; + if (flags & DECP) + texp--; + } + } + + if (Ise (*s)) + { + conv_done = TRUE; + + if (*++s != EOS) /* skip e|E|d|D */ + { /* ! ([s]xxx[.[yyy]]e) */ + + while (Isspace (*s)) s++; /* Ansi allows spaces after e */ + if (*s != EOS) + { /* ! ([s]xxx[.[yyy]]e[space]) */ + if (Issign (*s)) + if (*s++ == '-') flags |= ESIGN; + + if (*s != EOS) + /* ! ([s]xxx[.[yyy]]e[s]) -- error?? */ + { + for(; Isdigit (*s); s++) + /* prevent from grossly overflowing */ + if (e < MAXE) + e = e*10 + Val (*s); + + /* dont care what comes after this */ + if (flags & ESIGN) + texp -= e; + else + texp += e; + } + } + } + } + + if (endptr != NULL) + *endptr = CHAR_FROM_CONST ((conv_done) ? s : start); + + return (__adjust (&accum, (int) texp, (int) (flags & SIGN))); + } + +/******************************************************************************* +* +* __ten_mul - +* +* multiply 64 bit accumulator by 10 and add digit. +* The KA/CA way to do this should be to use +* a 64-bit integer internally and use "adjust" to +* convert it to float at the end of processing. +* +* AUTHOR: +* Taken from cygnus. +* +* RETURNS: +* NOMANUAL +*/ + +LOCAL int __ten_mul + ( + double *acc, + int digit + ) + { + *acc *= 10; + *acc += digit; + + return (0); /* no overflow */ + } + +/******************************************************************************* +* +* __adjust - +* +* return (*acc) scaled by 10**dexp. +* +* AUTHOR: +* Taken from cygnus. +* +* RETURNS: +* NOMANUAL +*/ + +LOCAL double __adjust + ( + double *acc, /* *acc the 64 bit accumulator */ + int dexp, /* dexp decimal exponent */ + int sign /* sign sign flag */ + ) + { + double r; + + if (dexp > MAXE) + { + errno = ERANGE; + return (sign) ? -HUGE_VAL : HUGE_VAL; + } + else if (dexp < MINE) + { + errno = ERANGE; + return 0.0; + } + + r = *acc; + if (sign) + r = -r; + if (dexp==0) + return r; + + if (dexp < 0) + return r / __exp10 (abs (dexp)); + else + return r * __exp10 (dexp); + } + +/******************************************************************************* +* +* __exp10 - +* +* compute 10**x by successive squaring. +* +* AUTHOR: +* Taken from cygnus. +* +* RETURNS: +* NOMANUAL +*/ + +double __exp10 + ( + uint_t x + ) + { + if (x < (sizeof (powtab) / sizeof (double))) + return (powtab [x]); + else if (x & 1) + return (10.0 * __exp10 (x-1)); + else + return (__exp10 (x/2) * __exp10 (x/2)); + } +/* strtol.c - strtol file for stdlib */ + +/* Copyright 1992-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,11feb95,jdi doc fix. +01e,13oct93,caf ansi fix: added cast when assigning from a const. +01d,08feb93,jdi documentation cleanup for 5.1. +01c,21sep92,smb tweaks for mg +01b,20sep92,smb documentation additions. +01a,10jul92,smb written and documented. +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILES: stdlib.h, limits.h, ctype.h, errno.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" +#include "limits.h" +#include "ctype.h" +#include "errno.h" + +/***************************************************************************** +* +* strtol - convert a string to a long integer (ANSI) +* +* This routine converts the initial portion of a string to `long int' +* representation. First, it decomposes the input string into three parts: +* an initial, possibly empty, sequence of white-space characters (as +* specified by isspace()); a subject sequence resembling an integer +* represented in some radix determined by the value of ; and a final +* string of one or more unrecognized characters, including the terminating +* NULL character of the input string. Then, it attempts to convert the +* subject sequence to an integer number, and returns the result. +* +* If the value of is zero, the expected form of the subject sequence +* is that of an integer constant, optionally preceded by a plus or minus +* sign, but not including an integer suffix. If the value of is +* between 2 and 36, the expected form of the subject sequence is a sequence +* of letters and digits representing an integer with the radix specified by +* optionally preceded by a plus or minus sign, but not including an +* integer suffix. The letters from a (or A) through to z (or Z) are +* ascribed the values 10 to 35; only letters whose ascribed values are less +* than are premitted. If the value of is 16, the characters +* 0x or 0X may optionally precede the sequence of letters and digits, +* following the sign if present. +* +* The subject sequence is defined as the longest initial subsequence of the +* input string, starting with the first non-white-space character, that is of +* the expected form. The subject sequence contains no characters if the +* input string is empty or consists entirely of white space, or if the first +* non-white-space character is other than a sign or a permissible letter or +* digit. +* +* If the subject sequence has the expected form and the value of is +* zero, the sequence of characters starting with the first digit is +* interpreted as an integer constant. If the subject sequence has the +* expected form and the value of is between 2 and 36, it is used as +* the for conversion, ascribing to each latter its value as given +* above. If the subject sequence begins with a minus sign, the value +* resulting from the conversion is negated. A pointer to the final string +* is stored in the object pointed to by , provided that is +* not a NULL pointer. +* +* In other than the "C" locale, additional implementation-defined subject +* sequence forms may be accepted. VxWorks supports only the "C" locale; +* it assumes that the upper- and lower-case alphabets and digits are +* each contiguous. +* +* If the subject sequence is empty or does not have the expected form, no +* conversion is performed; the value of is stored in the object +* pointed to by , provided that is not a NULL pointer. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: +* The converted value, if any. If no conversion could be performed, it +* returns zero. If the correct value is outside the range of representable +* values, it returns LONG_MAX or LONG_MIN (according to the sign of the +* value), and stores the value of the macro ERANGE in `errno'. +*/ + +long strtol + ( + const char * nptr, /* string to convert */ + char ** endptr, /* ptr to final string */ + FAST int base /* radix */ + ) + { + FAST const char *s = nptr; + FAST ulong_t acc; + FAST int c; + FAST ulong_t cutoff; + FAST int neg = 0; + FAST int any; + FAST int cutlim; + + /* + * Skip white space and pick up leading +/- sign if any. + * If base is 0, allow 0x for hex and 0 for octal, else + * assume decimal; if base is already 16, allow 0x. + */ + do + { + c = *s++; + } while (isspace (c)); + + if (c == '-') + { + neg = 1; + c = *s++; + } + else if (c == '+') + c = *s++; + + if (((base == 0) || (base == 16)) && + (c == '0') && + ((*s == 'x') || (*s == 'X'))) + { + c = s[1]; + s += 2; + base = 16; + } + + if (base == 0) + base = (c == '0' ? 8 : 10); + + /* + * Compute the cutoff value between legal numbers and illegal + * numbers. That is the largest legal value, divided by the + * base. An input number that is greater than this value, if + * followed by a legal input character, is too big. One that + * is equal to this value may be valid or not; the limit + * between valid and invalid numbers is then based on the last + * digit. For instance, if the range for longs is + * [-2147483648..2147483647] and the input base is 10, + * cutoff will be set to 214748364 and cutlim to either + * 7 (neg==0) or 8 (neg==1), meaning that if we have accumulated + * a value > 214748364, or equal but the next digit is > 7 (or 8), + * the number is too big, and we will return a range error. + * + * Set any if any `digits' consumed; make it negative to indicate + * overflow. + */ + + cutoff = (neg ? -(ulong_t) LONG_MIN : LONG_MAX); + cutlim = cutoff % (ulong_t) base; + cutoff /= (ulong_t) base; + + for (acc = 0, any = 0;; c = *s++) + { + if (isdigit (c)) + c -= '0'; + else if (isalpha (c)) + c -= (isupper(c) ? 'A' - 10 : 'a' - 10); + else + break; + + if (c >= base) + break; + + if ((any < 0) || (acc > cutoff) || (acc == cutoff) && (c > cutlim)) + any = -1; + else + { + any = 1; + acc *= base; + acc += c; + } + } + + if (any < 0) + { + acc = (neg ? LONG_MIN : LONG_MAX); + errno = ERANGE; + } + else if (neg) + acc = -acc; + + if (endptr != 0) + *endptr = (any ? (char *) (s - 1) : (char *) nptr); + + return (acc); + } +/* strtoul.c - strtoul file for stdlib */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,08feb93,jdi documentation cleanup for 5.1. +01c,21sep92,smb tweaks for mg +01b,20sep92,smb documentation additions. +01a,10jul92,smb documented. +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILES: stdlib.h, limits.h, ctype.h, errno.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "limits.h" +#include "ctype.h" +#include "errno.h" +#include "stdlib.h" + +/***************************************************************************** +* +* strtoul - convert a string to an unsigned long integer (ANSI) +* +* This routine converts the initial portion of a string to +* `unsigned long int' representation. First, it decomposes the input +* string into three parts: an initial, possibly empty, sequence of +* white-space characters (as specified by isspace()); a subject sequence +* resembling an unsigned integer represented in some radix determined by +* the value ; and a final string of one or more unrecognized +* characters, including the terminating null character of the input string. +* Then, it attempts to convert the subject sequence to an unsigned integer, +* and returns the result. +* +* If the value of is zero, the expected form of the subject sequence +* is that of an integer constant, optionally preceded by a plus or minus +* sign, but not including an integer suffix. If the value of is +* between 2 and 36, the expected form of the subject sequence is a sequence +* of letters and digits representing an integer with the radix specified by +* letters from a (or A) through z (or Z) which are ascribed the values 10 to +* 35; only letters whose ascribed values are less than are +* premitted. If the value of is 16, the characters 0x or 0X may +* optionally precede the sequence of letters and digits, following the sign +* if present. +* +* The subject sequence is defined as the longest initial subsequence of the +* input string, starting with the first non-white-space character, that is +* of the expected form. The subject sequence contains no characters if the +* input string is empty or consists entirely of white space, or if the first +* non-white-space character is other than a sign or a permissible letter or +* digit. +* +* If the subject sequence has the expected form and the value of is +* zero, the sequence of characters starting with the first digit is +* interpreted as an integer constant. If the subject sequence has the +* expected form and the value of is between 2 and 36, it is used as +* the for conversion, ascribing to each letter its value as given +* above. If the subject sequence begins with a minus sign, the value +* resulting from the conversion is negated. A pointer to the final string +* is stored in the object pointed to by , provided that is +* not a null pointer. +* +* In other than the "C" locale, additional implementation-defined subject +* sequence forms may be accepted. VxWorks supports only the "C" locale; +* it assumes that the upper- and lower-case alphabets and digits are +* each contiguous. +* +* If the subject sequence is empty or does not have the expected form, no +* conversion is performed; the value of is stored in the object +* pointed to by , provided that is not a null pointer. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: +* The converted value, if any. If no conversion could be performed it +* returns zero. If the correct value is outside the range of representable +* values, it returns ULONG_MAX, and stores the value of the macro ERANGE in +* . +*/ + +ulong_t strtoul + ( + const char * nptr, /* string to convert */ + char ** endptr, /* ptr to final string */ + FAST int base /* radix */ + ) + { + FAST const char *s = nptr; + FAST ulong_t acc; + FAST int c; + FAST ulong_t cutoff; + FAST int neg = 0; + FAST int any; + FAST int cutlim; + + /* + * See strtol for comments as to the logic used. + */ + do + { + c = *s++; + } while (isspace (c)); + + if (c == '-') + { + neg = 1; + c = *s++; + } + else if (c == '+') + c = *s++; + + if (((base == 0) || (base == 16)) && + (c == '0') && + ((*s == 'x') || (*s == 'X'))) + { + c = s[1]; + s += 2; + base = 16; + } + + if (base == 0) + base = (c == '0' ? 8 : 10); + + cutoff = (ulong_t)ULONG_MAX / (ulong_t)base; + cutlim = (ulong_t)ULONG_MAX % (ulong_t)base; + + for (acc = 0, any = 0;; c = *s++) + { + if (isdigit (c)) + c -= '0'; + else if (isalpha (c)) + c -= (isupper (c) ? 'A' - 10 : 'a' - 10); + else + break; + + if (c >= base) + break; + + if ((any < 0) || (acc > cutoff) || (acc == cutoff) && (c > cutlim)) + any = -1; + else + { + any = 1; + acc *= base; + acc += c; + } + } + + if (any < 0) + { + acc = ULONG_MAX; + errno = ERANGE; + } + else if (neg) + acc = -acc; + + if (endptr != 0) + *endptr = (any ? CHAR_FROM_CONST (s - 1) : CHAR_FROM_CONST (nptr)); + + return (acc); + } +/* system.c - system file for stdlib */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,08feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions. +01a,25mar92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" + +/***************************************************************************** +* +* system - pass a string to a command processor (Unimplemented) (ANSI) +* +* This function is not applicable to VxWorks. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: OK, always. +*/ +int system + ( + const char * string /* pointer to string */ + ) + { + return (OK); + } diff --git a/libc/stdlib/atexit.c b/libc/stdlib/atexit.c new file mode 100644 index 0000000..356f0e6 --- /dev/null +++ b/libc/stdlib/atexit.c @@ -0,0 +1,47 @@ +/* atexit.c - atexit file for stdlib */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,08feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions. +01a,19jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: stdlib.h, signal.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" + +/******************************************************************************* +* +* atexit - call a function at program termination (Unimplemented) (ANSI) +* +* This routine is unimplemented. VxWorks task exit hooks +* provide this functionality. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: ERROR, always. +* +* SEE ALSO: taskHookLib +*/ + +int atexit + ( + void (*__func)(void) /* pointer to a function */ + ) + { + return (ERROR); + } + diff --git a/libc/stdlib/atof.c b/libc/stdlib/atof.c new file mode 100644 index 0000000..5b01b8d --- /dev/null +++ b/libc/stdlib/atof.c @@ -0,0 +1,49 @@ +/* atof.c - atof files for stdlib */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,08feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions. +01a,19jul92,smb written and documentation. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" + +/******************************************************************************* +* +* atof - convert a string to a `double' (ANSI) +* +* This routine converts the initial portion of the string +* to double-precision representation. +* +* Its behavior is equivalent to: +* .CS +* strtod (s, (char **)NULL); +* .CE +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: The converted value in double-precision representation. +*/ + +double atof + ( + const char * s /* pointer to string */ + ) + { + return (strtod (s, (char **) NULL)); + } diff --git a/libc/stdlib/atoi.c b/libc/stdlib/atoi.c new file mode 100644 index 0000000..7548d2c --- /dev/null +++ b/libc/stdlib/atoi.c @@ -0,0 +1,49 @@ +/* atoi.c - atoi files for stdlib */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,08feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions. +01a,19jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" + +/****************************************************************************** +* +* atoi - convert a string to an `int' (ANSI) +* +* This routine converts the initial portion of the string +* to `int' representation. +* +* Its behavior is equivalent to: +* .CS +* (int) strtol (s, (char **) NULL, 10); +* .CE +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: The converted value represented as an `int'. +*/ + +int atoi + ( + const char * s /* pointer to string */ + ) + { + return (int) strtol (s, (char **) NULL, 10); + } diff --git a/libc/stdlib/atol.c b/libc/stdlib/atol.c new file mode 100644 index 0000000..3eb465b --- /dev/null +++ b/libc/stdlib/atol.c @@ -0,0 +1,49 @@ +/* atol.c - atol files for stdlib */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,08feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions. +01a,19jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" + +/***************************************************************************** +* +* atol - convert a string to a `long' (ANSI) +* +* This routine converts the initial portion of the string +* to long integer representation. +* +* Its behavior is equivalent to: +* .CS +* strtol (s, (char **)NULL, 10); +* .CE +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: The converted value represented as a `long'. +*/ + +long atol + ( + const register char * s /* pointer to string */ + ) + { + return strtol (s, (char **) NULL, 10); + } diff --git a/libc/stdlib/bsearch.c b/libc/stdlib/bsearch.c new file mode 100644 index 0000000..419bf38 --- /dev/null +++ b/libc/stdlib/bsearch.c @@ -0,0 +1,80 @@ +/* bsearch.c - bsearch routine for the stdlib ANSI library */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,08feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions. +01a,19jul92,smb written and documented +*/ + +/* +DESCRIPTION + +INCLUDE FILE: stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" + +/****************************************************************************** +* +* bsearch - perform a binary search (ANSI) +* +* This routine searches an array of objects, the initial element of +* which is pointed to by , for an element that matches the object +* pointed to by . The of each element of the array is specified +* by . +* +* The comparison function pointed to by is called with two arguments +* that point to the object and to an array element, in that order. The +* function shall return an integer less than, equal to, or greater than zero if +* the object is considered, respectively, to be less than, to match, or +* to be greater than the array element. The array shall consist of all the +* elements that compare greater than the object, in that order. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: +* A pointer to a matching element of the array, or a NULL pointer +* if no match is found. If two elements compare as equal, which element +* is matched is unspecified. +*/ + +void * bsearch + ( + FAST const void * key, /* element to match */ + const void * base0, /* initial element in array */ + size_t nmemb, /* array to search */ + FAST size_t size, /* size of array element */ + FAST int (*compar) (const void *, const void *) /* comparison function */ + ) + { + FAST const char * base = base0; + FAST const void * p; + FAST int lim; + FAST int cmp; + + for (lim = nmemb; lim != 0; lim >>= 1) + { + p = base + (lim >> 1) * size; + cmp = (*compar)(key, p); + + if (cmp == 0) + return (CHAR_FROM_CONST (p)); + + if (cmp > 0) + { /* key > p: move right */ + base = (CHAR_FROM_CONST (p) + size); + lim--; + } + } + + return (NULL); + } diff --git a/libc/stdlib/div.c b/libc/stdlib/div.c new file mode 100644 index 0000000..7413488 --- /dev/null +++ b/libc/stdlib/div.c @@ -0,0 +1,98 @@ +/* div.c - div file for stdlib */ + +/* Copyright 1992-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,25sep01,gls fixed div_r to check for negative numerator (SPR #30636) +01f,10feb95,jdi doc format tweak. +01e,08feb93,jdi documentation cleanup for 5.1. +01d,20sep92,smb documentation additions. +01c,24jul92,smb corrected parameter ordering. +01b,24jul92,smb added reentrant version for div() +01a,19jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" + +/******************************************************************************* +* +* div - compute a quotient and remainder (ANSI) +* +* This routine computes the quotient and remainder of /. +* If the division is inexact, the resulting quotient is the integer of lesser +* magnitude that is the nearest to the algebraic quotient. If the result cannot +* be represented, the behavior is undefined; otherwise, `quot' * + `rem' +* equals . +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: +* A structure of type `div_t', containing both the quotient and the +* remainder. +* +* INTERNAL +* The structure shall contain the following members, in either order: +* int quot; * quotient * +* int rem; * remainder * +*/ + +div_t div + ( + int numer, /* numerator */ + int denom /* denominator */ + ) + { + static div_t divStruct; /* div_t structure */ + + div_r (numer, denom, &divStruct); + return (divStruct); + } + +/******************************************************************************* +* +* div_r - compute a quotient and remainder (reentrant) +* +* This routine computes the quotient and remainder of /. +* The quotient and remainder are stored in the `div_t' structure +* pointed to by . +* +* This routine is the reentrant version of div(). +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: N/A +*/ + +void div_r + ( + int numer, /* numerator */ + int denom, /* denominator */ + div_t * divStructPtr /* div_t structure */ + ) + { + /* calculate quotient */ + divStructPtr->quot = numer / denom; + + /* calculate remainder */ + divStructPtr->rem = numer - (denom * divStructPtr->quot); + + /* check for negative numerator */ + if ((numer < 0) && (divStructPtr->rem > 0)) + { + divStructPtr->quot++; + divStructPtr->rem -= denom; + } + } diff --git a/libc/stdlib/labs.c b/libc/stdlib/labs.c new file mode 100644 index 0000000..8678a45 --- /dev/null +++ b/libc/stdlib/labs.c @@ -0,0 +1,47 @@ +/* labs.c - labs file for stdlib */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,08feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions. +01a,19jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" + +/******************************************************************************* +* +* labs - compute the absolute value of a `long' (ANSI) +* +* This routine computes the absolute value of a specified `long'. If the +* result cannot be represented, the behavior is undefined. This routine is +* equivalent to abs(), except that the argument and return value are all of +* type `long'. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: The absolute value of . +*/ + +long labs + ( + long i /* long for which to return absolute value */ + ) + { + return (i >= 0 ? i : -i); + } + diff --git a/libc/stdlib/ldiv.c b/libc/stdlib/ldiv.c new file mode 100644 index 0000000..07fa787 --- /dev/null +++ b/libc/stdlib/ldiv.c @@ -0,0 +1,90 @@ +/* ldiv.c - ldiv file for stdlib */ + +/* Copyright 1992-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,25sep01,gls fixed ldiv_r to check for negative numerator (SPR #30636) +01e,08feb93,jdi documentation cleanup for 5.1. +01d,20sep92,smb documentation additions. +01c,24jul92,smb corrected parameter ordering. +01b,24jul92,smb added reentrant version of ldiv() +01a,19jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" + +/******************************************************************************* +* +* ldiv - compute the quotient and remainder of the division (ANSI) +* +* This routine computes the quotient and remainder of /. +* This routine is similar to div(), except that the arguments and the +* elements of the returned structure are all of type `long'. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: +* A structure of type `ldiv_t', containing both the quotient and the +* remainder. +*/ + +ldiv_t ldiv + ( + long numer, /* numerator */ + long denom /* denominator */ + ) + { + static ldiv_t divStruct; + + ldiv_r (numer, denom, &divStruct); + return (divStruct); + } + +/******************************************************************************* +* +* ldiv_r - compute a quotient and remainder (reentrant) +* +* This routine computes the quotient and remainder of /. +* The quotient and remainder are stored in the `ldiv_t' structure +* `divStructPtr'. +* +* This routine is the reentrant version of ldiv(). +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: N/A +*/ + +void ldiv_r + ( + long numer, /* numerator */ + long denom, /* denominator */ + ldiv_t * divStructPtr /* ldiv_t structure */ + ) + { + /* calculate quotient */ + divStructPtr->quot = numer / denom; + + /* calculate remainder */ + divStructPtr->rem = numer - (denom * divStructPtr->quot); + + /* check for negative numerator */ + if ((numer < 0) && (divStructPtr->rem > 0)) + { + divStructPtr->quot++; + divStructPtr->rem -= denom; + } + } diff --git a/libc/stdlib/multibyte.c b/libc/stdlib/multibyte.c new file mode 100644 index 0000000..f966e2a --- /dev/null +++ b/libc/stdlib/multibyte.c @@ -0,0 +1,145 @@ +/* multibyte.c - multibyte file for stdlib */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,08feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions. +01a,19jul92,smb written and documented. +*/ + +/* +DESCRIPTION +These ignore the current fixed ("C") locale and +always indicate that no multibyte characters are supported. + +INCLUDE FILES: stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" +#include "string.h" + +/****************************************************************************** +* +* mblen - calculate the length of a multibyte character (Unimplemented) (ANSI) +* +* This multibyte character function is unimplemented in VxWorks. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: OK, or ERROR if the parameters are invalid. +*/ + +int mblen + ( + const char * s, + size_t n + ) + { + if ((strcmp (s,NULL) == 0) && (n == 0) && (*s == EOS)) + return (ERROR); + + return (OK); + } + +/****************************************************************************** +* +* mbtowc - convert a multibyte character to a wide character (Unimplemented) (ANSI) +* +* This multibyte character function is unimplemented in VxWorks. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: OK, or ERROR if the parameters are invalid. +*/ + +int mbtowc + ( + wchar_t * pwc, + const char * s, + size_t n + ) + { + if ((strcmp (s,NULL) == 0) && (n == 0) && (*s == EOS)) + return (ERROR); + + return (OK); + } + +/****************************************************************************** +* +* wctomb - convert a wide character to a multibyte character (Unimplemented) (ANSI) +* +* This multibyte character function is unimplemented in VxWorks. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: OK, or ERROR if the parameters are invalid. +*/ + +int wctomb + ( + char * s, + wchar_t wchar + ) + { + if (strcmp (s,NULL) == 0) + return (ERROR); + + return (OK); + } + +/****************************************************************************** +* +* mbstowcs - convert a series of multibyte char's to wide char's (Unimplemented) (ANSI) +* +* This multibyte character function is unimplemented in VxWorks. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: OK, or ERROR if the parameters are invalid. +*/ + +size_t mbstowcs + ( + wchar_t * pwcs, + const char * s, + size_t n + ) + { + if ((strcmp (s,NULL) == 0) && (n == 0) && (*s == EOS)) + return (ERROR); + + return (OK); + } + +/****************************************************************************** +* +* wcstombs - convert a series of wide char's to multibyte char's (Unimplemented) (ANSI) +* +* This multibyte character function is unimplemented in VxWorks. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: OK, or ERROR if the parameters are invalid. +*/ + +size_t wcstombs + ( + char * s, + const wchar_t * pwcs, + size_t n + ) + { + if ((strcmp (pwcs,NULL) == 0) && (n == 0) && (*pwcs == (wchar_t) EOS)) + return (ERROR); + + return (OK); + } diff --git a/libc/stdlib/qsort.c b/libc/stdlib/qsort.c new file mode 100644 index 0000000..4285395 --- /dev/null +++ b/libc/stdlib/qsort.c @@ -0,0 +1,386 @@ +/* qsort.c - qsort file for stdlib */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,01jul93,jmm fixed parameter order of quick_sort and insertion_sort (spr 2202) +01c,08feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions. +01a,19jul92,smb written and documented. +*/ + +/* +DESCRIPTION + * Copyright (c) 1980, 1983, 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * +INCLUDE FILES: stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" + +/* + * MTHRESH is the smallest partition for which we compare for a median + * value instead of using the middle value. + */ +#define MTHRESH 6 + +/* + * THRESH is the minimum number of entries in a partition for continued + * partitioning. + */ +#define THRESH 4 + +static void insertion_sort(), quick_sort(); + + +/* + * Swap two areas of size number of bytes. Although qsort(3) permits random + * blocks of memory to be sorted, sorting pointers is almost certainly the + * common case (and, were it not, could easily be made so). Regardless, it + * isn't worth optimizing; the SWAP's get sped up by the cache, and pointer + * arithmetic gets lost in the time required for comparison function calls. + */ +#define SWAP(a, b) \ + { \ + cnt = size; \ + do \ + { \ + ch = *a; \ + *a++ = *b; \ + *b++ = ch; \ + } while (--cnt); \ + } + +/* + * Knuth, Vol. 3, page 116, Algorithm Q, step b, argues that a single pass + * of straight insertion sort after partitioning is complete is better than + * sorting each small partition as it is created. This isn't correct in this + * implementation because comparisons require at least one (and often two) + * function calls and are likely to be the dominating expense of the sort. + * Doing a final insertion sort does more comparisons than are necessary + * because it compares the "edges" and medians of the partitions which are + * known to be already sorted. + * + * This is also the reasoning behind selecting a small THRESH value (see + * Knuth, page 122, equation 26), since the quicksort algorithm does less + * comparisons than the insertion sort. + */ +#define SORT(bot, n) \ + { \ + if (n > 1) \ + if (n == 2) \ + { \ + t1 = bot + size; \ + if (compar (t1, bot) < 0) \ + SWAP (t1, bot); \ + } \ + else \ + insertion_sort(bot, n, size, compar); \ + } + +/****************************************************************************** +* +* qsort - sort an array of objects (ANSI) +* +* This routine sorts an array of objects, the initial element of +* which is pointed to by . The size of each object is specified by +* . +* +* The contents of the array are sorted into ascending order according to a +* comparison function pointed to by , which is called with two +* arguments that point to the objects being compared. The function shall +* return an integer less than, equal to, or greater than zero if the first +* argument is considered to be respectively less than, equal to, or greater +* than the second. +* +* If two elements compare as equal, their order in the sorted array is +* unspecified. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: N/A +*/ +void qsort + ( + void * bot, /* initial element in array */ + size_t nmemb, /* no. of objects in array */ + size_t size, /* size of array element */ + int (*compar) (const void *, const void *) /* comparison function */ + ) + { + /* static void insertion_sort(), quick_sort(); */ + + if (nmemb <= 1) + return; + + if (nmemb >= THRESH) + quick_sort (bot, nmemb, size, compar); + else + insertion_sort (bot, nmemb, size, compar); + } + +/****************************************************************************** +* +* quick_sort - sort an array of objects. +* +* RETURNS: no value. +* NOMANUAL +*/ + +static void quick_sort + ( + FAST char * bot, + int nmemb, + FAST int size, + int (*compar)() + ) + { + FAST int cnt; + FAST uint_t ch; + FAST char * top; + FAST char * mid; + FAST char * t1; + FAST char * t2; + FAST int n1; + FAST int n2; + char * bsv; + + /* bot and nmemb must already be set. */ + +partition: + + /* find mid and top elements */ + mid = bot + size * (nmemb >> 1); + top = bot + (nmemb - 1) * size; + + /* + * Find the median of the first, last and middle element (see Knuth, + * Vol. 3, page 123, Eq. 28). This test order gets the equalities + * right. + */ + if (nmemb >= MTHRESH) + { + n1 = compar (bot, mid); + n2 = compar (mid, top); + + if ((n1 < 0) && (n2 > 0)) + t1 = compar (bot, top) < 0 ? top : bot; + else + if ((n1 > 0) && (n2 < 0)) + t1 = compar (bot, top) > 0 ? top : bot; + else + t1 = mid; + + /* if mid element not selected, swap selection there */ + if (t1 != mid) + { + SWAP (t1, mid); + mid -= size; + } + } + + /* Standard quicksort, Knuth, Vol. 3, page 116, Algorithm Q. */ +#define didswap n1 +#define newbot t1 +#define replace t2 + + didswap = 0; + bsv = bot; + + FOREVER + { + while ((bot < mid) && (compar (bot, mid) <= 0)) + { + bot += size; + } + + while (top > mid) + { + if (compar (mid, top) <= 0) + { + top -= size; + continue; + } + newbot = bot + size; /* value of bot after swap */ + + if (bot == mid) /* top <-> mid, mid == top */ + replace = mid = top; + else + { /* bot <-> top */ + replace = top; + top -= size; + } + goto swap; + } + + if (bot == mid) + break; + + /* bot <-> mid, mid == bot */ + replace = mid; + newbot = mid = bot; /* value of bot after swap */ + top -= size; + +swap: SWAP(bot, replace); + + bot = newbot; + didswap = 1; + } + + /* + * Quicksort behaves badly in the presence of data which is already + * sorted (see Knuth, Vol. 3, page 119) going from O N lg N to O N^2. + * To avoid this worst case behavior, if a re-partitioning occurs + * without swapping any elements, it is not further partitioned and + * is insert sorted. This wins big with almost sorted data sets and + * only loses if the data set is very strangely partitioned. A fix + * for those data sets would be to return prematurely if the insertion + * sort routine is forced to make an excessive number of swaps, and + * continue the partitioning. + */ + if (!didswap) + { + insertion_sort (bsv, nmemb, size, compar); + return; + } + + /* + * Re-partition or sort as necessary. Note that the mid element + * itself is correctly positioned and can be ignored. + */ +#define nlower n1 +#define nupper n2 + + bot = bsv; + nlower = (mid - bot) / size; /* size of lower partition */ + mid += size; + nupper = nmemb - nlower - 1; /* size of upper partition */ + + /* + * If must call recursively, do it on the smaller partition; this + * bounds the stack to lg N entries. + */ + if (nlower > nupper) + { + if (nupper >= THRESH) + quick_sort (mid, nupper, size, compar); + else + { + SORT (mid, nupper); + if (nlower < THRESH) + { + SORT (bot, nlower); + return; + } + } + nmemb = nlower; + } + else + { + if (nlower >= THRESH) + quick_sort (bot, nlower, size, compar); + else + { + SORT (bot, nlower); + if (nupper < THRESH) + { + SORT (mid, nupper); + return; + } + } + bot = mid; + nmemb = nupper; + } + goto partition; + /* NOTREACHED */ + } + +/****************************************************************************** +* +* insertion_sort - internal routine +* +* RETURNS: no value. +* NOMANUAL +*/ + +static void insertion_sort + ( + char * bot, + int nmemb, + FAST int size, + int (*compar)() + ) + { + FAST int cnt; + FAST uint_t ch; + FAST char * s1; + FAST char * s2; + FAST char * t1; + FAST char * t2; + FAST char * top; + + /* + * A simple insertion sort (see Knuth, Vol. 3, page 81, Algorithm + * S). Insertion sort has the same worst case as most simple sorts + * (O N^2). It gets used here because it is (O N) in the case of + * sorted data. + */ + top = bot + nmemb * size; + + for (t1 = bot + size; t1 < top;) + { + for (t2 = t1; ((t2 -= size) >= bot) && (compar (t1, t2) < 0);) + ; + if (t1 != (t2 += size)) + { + /* Bubble bytes up through each element. */ + for (cnt = size; cnt--; ++t1) + { + ch = *t1; + for (s1 = s2 = t1; (s2 -= size) >= t2; s1 = s2) + { + *s1 = *s2; + } + *s1 = ch; + } + } + else + t1 += size; + } + } diff --git a/libc/stdlib/rand.c b/libc/stdlib/rand.c new file mode 100644 index 0000000..36db1f0 --- /dev/null +++ b/libc/stdlib/rand.c @@ -0,0 +1,72 @@ +/* rand.c - rand, srand functions for stdlib */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,08feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions. +01a,19jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" + +ulong_t _Randseed = 1; + +/******************************************************************************* +* +* rand - generate a pseudo-random integer between 0 and RAND_MAX (ANSI) +* +* This routine generates a pseudo-random integer between 0 and RAND_MAX. +* The seed value for rand() can be reset with srand(). +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: A pseudo-random integer. +* +* SEE ALSO: srand() +*/ + +int rand (void) + { + _Randseed = _Randseed * 1103515245 + 12345; + return (uint_t) (_Randseed/65536) % (RAND_MAX + 1); + } + +/******************************************************************************* +* +* srand - reset the value of the seed used to generate random numbers (ANSI) +* +* This routine resets the seed value used by rand(). If srand() is then +* called with the same seed value, the sequence of pseudo-random numbers is +* repeated. If rand() is called before any calls to srand() have been made, +* the same sequence shall be generated as when srand() is first called with +* the seed value of 1. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: N/A +* +* SEE ALSO: rand() +*/ + +void * srand + ( + uint_t seed /* random number seed */ + ) + { + _Randseed = seed; + return (void *)0; + } diff --git a/libc/stdlib/strtod.c b/libc/stdlib/strtod.c new file mode 100644 index 0000000..74168f9 --- /dev/null +++ b/libc/stdlib/strtod.c @@ -0,0 +1,305 @@ +/* strtod.c function for stdlib */ + +/* Copyright 1992-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,11feb95,jdi doc fix. +01d,16aug93,dvs fixed value of endptr for strings that start with d, D, e, or E + (SPR #2229) +01c,08feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions. +01a,19jul92,smb written and documented +*/ + +/* +DESCRIPTION + +INCLUDE FILES: stdlib.h, math.h, assert.h, arrno.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" +#include "math.h" +#include "errno.h" + +#define Ise(c) ((c == 'e') || (c == 'E') || (c == 'd') || (c == 'D')) +#define Isdigit(c) ((c <= '9') && (c >= '0')) +#define Isspace(c) ((c == ' ') || (c == '\t') || (c=='\n') || (c=='\v') \ + || (c == '\r') || (c == '\f')) +#define Issign(c) ((c == '-') || (c == '+')) +#define Val(c) ((c - '0')) + +#define MAXE 308 +#define MINE (-308) + +static double powtab[] = {1.0, + 10.0, + 100.0, + 1000.0, + 10000.0}; + +/* flags */ +#define SIGN 0x01 +#define ESIGN 0x02 +#define DECP 0x04 + +/* locals */ + +int __ten_mul (double *acc, int digit); +double __adjust (double *acc, int dexp, int sign); +double __exp10 (uint_t x); + +/***************************************************************************** +* +* strtod - convert the initial portion of a string to a double (ANSI) +* +* This routine converts the initial portion of a specified string to a +* double. First, it decomposes the input string into three parts: an initial, +* possibly empty, sequence of white-space characters (as specified by the +* isspace() function); a subject sequence resembling a floating-point +* constant; and a final string of one or more unrecognized characters, +* including the terminating null character of the input string. Then, it +* attempts to convert the subject sequence to a floating-point number, and +* returns the result. +* +* The expected form of the subject sequence is an optional plus or minus +* decimal-point character, then an optional exponent part but no floating +* suffix. The subject sequence is defined as the longest initial +* subsequence of the input string, starting with the first non-white-space +* character, that is of the expected form. The subject sequence contains +* no characters if the input string is empty or consists entirely of +* white space, or if the first non-white-space character is other than a +* sign, a digit, or a decimal-point character. +* +* If the subject sequence has the expected form, the sequence of characters +* starting with the first digit or the decimal-point character (whichever +* occurs first) is interpreted as a floating constant, except that the +* decimal-point character is used in place of a period, and that if neither +* an exponent part nor a decimal-point character appears, a decimal point is +* assumed to follow the last digit in the string. If the subject sequence +* begins with a minus sign, the value resulting form the conversion is negated. +* A pointer to the final string is stored in the object pointed to by , +* provided that is not a null pointer. +* +* In other than the "C" locale, additional implementation-defined subject +* sequence forms may be accepted. VxWorks supports only the "C" locale. +* +* If the subject sequence is empty or does not have the expected form, no +* conversion is performed; the value of is stored in the object pointed +* to by , provided that is not a null pointer. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: +* The converted value, if any. If no conversion could be performed, it +* returns zero. If the correct value is outside the range of representable +* values, it returns plus or minus HUGE_VAL (according to the sign of the +* value), and stores the value of the macro ERANGE in `errno'. If the +* correct value would cause underflow, it returns zero and stores the value +* of the macro ERANGE in `errno'. +* +*/ + +double strtod + ( + const char * s, /* string to convert */ + char ** endptr /* ptr to final string */ + ) + { + /* Note that the point positioning is locale dependant */ + const char *start = s; + double accum = 0.0; + int flags = 0; + int texp = 0; + int e = 0; + BOOL conv_done = FALSE; + + while (Isspace (*s)) s++; + if (*s == EOS) + { /* just leading spaces */ + if (endptr != NULL) + *endptr = CHAR_FROM_CONST (start); + + return (0.0); + } + + if (Issign (*s)) + { + if (*s == '-') flags = SIGN; + + if (*++s == EOS) + { /* "+|-" : should be an error ? */ + if (endptr != NULL) + *endptr = CHAR_FROM_CONST (start); + + return (0.0); + } + } + + /* added code to fix problem with leading e, E, d, or D */ + + if ( !Isdigit (*s) && (*s != '.')) + { + if (endptr != NULL) + *endptr = CHAR_FROM_CONST (start); + + return (0.0); + } + + + for ( ; (Isdigit (*s) || (*s == '.')); s++) + { + conv_done = TRUE; + + if (*s == '.') + flags |= DECP; + else + { + if ( __ten_mul (&accum, Val(*s)) ) + texp++; + if (flags & DECP) + texp--; + } + } + + if (Ise (*s)) + { + conv_done = TRUE; + + if (*++s != EOS) /* skip e|E|d|D */ + { /* ! ([s]xxx[.[yyy]]e) */ + + while (Isspace (*s)) s++; /* Ansi allows spaces after e */ + if (*s != EOS) + { /* ! ([s]xxx[.[yyy]]e[space]) */ + if (Issign (*s)) + if (*s++ == '-') flags |= ESIGN; + + if (*s != EOS) + /* ! ([s]xxx[.[yyy]]e[s]) -- error?? */ + { + for(; Isdigit (*s); s++) + /* prevent from grossly overflowing */ + if (e < MAXE) + e = e*10 + Val (*s); + + /* dont care what comes after this */ + if (flags & ESIGN) + texp -= e; + else + texp += e; + } + } + } + } + + if (endptr != NULL) + *endptr = CHAR_FROM_CONST ((conv_done) ? s : start); + + return (__adjust (&accum, (int) texp, (int) (flags & SIGN))); + } + +/******************************************************************************* +* +* __ten_mul - +* +* multiply 64 bit accumulator by 10 and add digit. +* The KA/CA way to do this should be to use +* a 64-bit integer internally and use "adjust" to +* convert it to float at the end of processing. +* +* AUTHOR: +* Taken from cygnus. +* +* RETURNS: +* NOMANUAL +*/ + +LOCAL int __ten_mul + ( + double *acc, + int digit + ) + { + *acc *= 10; + *acc += digit; + + return (0); /* no overflow */ + } + +/******************************************************************************* +* +* __adjust - +* +* return (*acc) scaled by 10**dexp. +* +* AUTHOR: +* Taken from cygnus. +* +* RETURNS: +* NOMANUAL +*/ + +LOCAL double __adjust + ( + double *acc, /* *acc the 64 bit accumulator */ + int dexp, /* dexp decimal exponent */ + int sign /* sign sign flag */ + ) + { + double r; + + if (dexp > MAXE) + { + errno = ERANGE; + return (sign) ? -HUGE_VAL : HUGE_VAL; + } + else if (dexp < MINE) + { + errno = ERANGE; + return 0.0; + } + + r = *acc; + if (sign) + r = -r; + if (dexp==0) + return r; + + if (dexp < 0) + return r / __exp10 (abs (dexp)); + else + return r * __exp10 (dexp); + } + +/******************************************************************************* +* +* __exp10 - +* +* compute 10**x by successive squaring. +* +* AUTHOR: +* Taken from cygnus. +* +* RETURNS: +* NOMANUAL +*/ + +double __exp10 + ( + uint_t x + ) + { + if (x < (sizeof (powtab) / sizeof (double))) + return (powtab [x]); + else if (x & 1) + return (10.0 * __exp10 (x-1)); + else + return (__exp10 (x/2) * __exp10 (x/2)); + } diff --git a/libc/stdlib/strtol.c b/libc/stdlib/strtol.c new file mode 100644 index 0000000..0589a8c --- /dev/null +++ b/libc/stdlib/strtol.c @@ -0,0 +1,223 @@ +/* strtol.c - strtol file for stdlib */ + +/* Copyright 1992-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,11feb95,jdi doc fix. +01e,13oct93,caf ansi fix: added cast when assigning from a const. +01d,08feb93,jdi documentation cleanup for 5.1. +01c,21sep92,smb tweaks for mg +01b,20sep92,smb documentation additions. +01a,10jul92,smb written and documented. +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILES: stdlib.h, limits.h, ctype.h, errno.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" +#include "limits.h" +#include "ctype.h" +#include "errno.h" + +/***************************************************************************** +* +* strtol - convert a string to a long integer (ANSI) +* +* This routine converts the initial portion of a string to `long int' +* representation. First, it decomposes the input string into three parts: +* an initial, possibly empty, sequence of white-space characters (as +* specified by isspace()); a subject sequence resembling an integer +* represented in some radix determined by the value of ; and a final +* string of one or more unrecognized characters, including the terminating +* NULL character of the input string. Then, it attempts to convert the +* subject sequence to an integer number, and returns the result. +* +* If the value of is zero, the expected form of the subject sequence +* is that of an integer constant, optionally preceded by a plus or minus +* sign, but not including an integer suffix. If the value of is +* between 2 and 36, the expected form of the subject sequence is a sequence +* of letters and digits representing an integer with the radix specified by +* optionally preceded by a plus or minus sign, but not including an +* integer suffix. The letters from a (or A) through to z (or Z) are +* ascribed the values 10 to 35; only letters whose ascribed values are less +* than are premitted. If the value of is 16, the characters +* 0x or 0X may optionally precede the sequence of letters and digits, +* following the sign if present. +* +* The subject sequence is defined as the longest initial subsequence of the +* input string, starting with the first non-white-space character, that is of +* the expected form. The subject sequence contains no characters if the +* input string is empty or consists entirely of white space, or if the first +* non-white-space character is other than a sign or a permissible letter or +* digit. +* +* If the subject sequence has the expected form and the value of is +* zero, the sequence of characters starting with the first digit is +* interpreted as an integer constant. If the subject sequence has the +* expected form and the value of is between 2 and 36, it is used as +* the for conversion, ascribing to each latter its value as given +* above. If the subject sequence begins with a minus sign, the value +* resulting from the conversion is negated. A pointer to the final string +* is stored in the object pointed to by , provided that is +* not a NULL pointer. +* +* In other than the "C" locale, additional implementation-defined subject +* sequence forms may be accepted. VxWorks supports only the "C" locale; +* it assumes that the upper- and lower-case alphabets and digits are +* each contiguous. +* +* If the subject sequence is empty or does not have the expected form, no +* conversion is performed; the value of is stored in the object +* pointed to by , provided that is not a NULL pointer. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: +* The converted value, if any. If no conversion could be performed, it +* returns zero. If the correct value is outside the range of representable +* values, it returns LONG_MAX or LONG_MIN (according to the sign of the +* value), and stores the value of the macro ERANGE in `errno'. +*/ + +long strtol + ( + const char * nptr, /* string to convert */ + char ** endptr, /* ptr to final string */ + FAST int base /* radix */ + ) + { + FAST const char *s = nptr; + FAST ulong_t acc; + FAST int c; + FAST ulong_t cutoff; + FAST int neg = 0; + FAST int any; + FAST int cutlim; + + /* + * Skip white space and pick up leading +/- sign if any. + * If base is 0, allow 0x for hex and 0 for octal, else + * assume decimal; if base is already 16, allow 0x. + */ + do + { + c = *s++; + } while (isspace (c)); + + if (c == '-') + { + neg = 1; + c = *s++; + } + else if (c == '+') + c = *s++; + + if (((base == 0) || (base == 16)) && + (c == '0') && + ((*s == 'x') || (*s == 'X'))) + { + c = s[1]; + s += 2; + base = 16; + } + + if (base == 0) + base = (c == '0' ? 8 : 10); + + /* + * Compute the cutoff value between legal numbers and illegal + * numbers. That is the largest legal value, divided by the + * base. An input number that is greater than this value, if + * followed by a legal input character, is too big. One that + * is equal to this value may be valid or not; the limit + * between valid and invalid numbers is then based on the last + * digit. For instance, if the range for longs is + * [-2147483648..2147483647] and the input base is 10, + * cutoff will be set to 214748364 and cutlim to either + * 7 (neg==0) or 8 (neg==1), meaning that if we have accumulated + * a value > 214748364, or equal but the next digit is > 7 (or 8), + * the number is too big, and we will return a range error. + * + * Set any if any `digits' consumed; make it negative to indicate + * overflow. + */ + + cutoff = (neg ? -(ulong_t) LONG_MIN : LONG_MAX); + cutlim = cutoff % (ulong_t) base; + cutoff /= (ulong_t) base; + + for (acc = 0, any = 0;; c = *s++) + { + if (isdigit (c)) + c -= '0'; + else if (isalpha (c)) + c -= (isupper(c) ? 'A' - 10 : 'a' - 10); + else + break; + + if (c >= base) + break; + + if ((any < 0) || (acc > cutoff) || (acc == cutoff) && (c > cutlim)) + any = -1; + else + { + any = 1; + acc *= base; + acc += c; + } + } + + if (any < 0) + { + acc = (neg ? LONG_MIN : LONG_MAX); + errno = ERANGE; + } + else if (neg) + acc = -acc; + + if (endptr != 0) + *endptr = (any ? (char *) (s - 1) : (char *) nptr); + + return (acc); + } diff --git a/libc/stdlib/strtoul.c b/libc/stdlib/strtoul.c new file mode 100644 index 0000000..ee7f546 --- /dev/null +++ b/libc/stdlib/strtoul.c @@ -0,0 +1,200 @@ +/* strtoul.c - strtoul file for stdlib */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,08feb93,jdi documentation cleanup for 5.1. +01c,21sep92,smb tweaks for mg +01b,20sep92,smb documentation additions. +01a,10jul92,smb documented. +*/ + +/* +DESCRIPTION + * Copyright (c) 1990 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + +INCLUDE FILES: stdlib.h, limits.h, ctype.h, errno.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "limits.h" +#include "ctype.h" +#include "errno.h" +#include "stdlib.h" + +/***************************************************************************** +* +* strtoul - convert a string to an unsigned long integer (ANSI) +* +* This routine converts the initial portion of a string to +* `unsigned long int' representation. First, it decomposes the input +* string into three parts: an initial, possibly empty, sequence of +* white-space characters (as specified by isspace()); a subject sequence +* resembling an unsigned integer represented in some radix determined by +* the value ; and a final string of one or more unrecognized +* characters, including the terminating null character of the input string. +* Then, it attempts to convert the subject sequence to an unsigned integer, +* and returns the result. +* +* If the value of is zero, the expected form of the subject sequence +* is that of an integer constant, optionally preceded by a plus or minus +* sign, but not including an integer suffix. If the value of is +* between 2 and 36, the expected form of the subject sequence is a sequence +* of letters and digits representing an integer with the radix specified by +* letters from a (or A) through z (or Z) which are ascribed the values 10 to +* 35; only letters whose ascribed values are less than are +* premitted. If the value of is 16, the characters 0x or 0X may +* optionally precede the sequence of letters and digits, following the sign +* if present. +* +* The subject sequence is defined as the longest initial subsequence of the +* input string, starting with the first non-white-space character, that is +* of the expected form. The subject sequence contains no characters if the +* input string is empty or consists entirely of white space, or if the first +* non-white-space character is other than a sign or a permissible letter or +* digit. +* +* If the subject sequence has the expected form and the value of is +* zero, the sequence of characters starting with the first digit is +* interpreted as an integer constant. If the subject sequence has the +* expected form and the value of is between 2 and 36, it is used as +* the for conversion, ascribing to each letter its value as given +* above. If the subject sequence begins with a minus sign, the value +* resulting from the conversion is negated. A pointer to the final string +* is stored in the object pointed to by , provided that is +* not a null pointer. +* +* In other than the "C" locale, additional implementation-defined subject +* sequence forms may be accepted. VxWorks supports only the "C" locale; +* it assumes that the upper- and lower-case alphabets and digits are +* each contiguous. +* +* If the subject sequence is empty or does not have the expected form, no +* conversion is performed; the value of is stored in the object +* pointed to by , provided that is not a null pointer. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: +* The converted value, if any. If no conversion could be performed it +* returns zero. If the correct value is outside the range of representable +* values, it returns ULONG_MAX, and stores the value of the macro ERANGE in +* . +*/ + +ulong_t strtoul + ( + const char * nptr, /* string to convert */ + char ** endptr, /* ptr to final string */ + FAST int base /* radix */ + ) + { + FAST const char *s = nptr; + FAST ulong_t acc; + FAST int c; + FAST ulong_t cutoff; + FAST int neg = 0; + FAST int any; + FAST int cutlim; + + /* + * See strtol for comments as to the logic used. + */ + do + { + c = *s++; + } while (isspace (c)); + + if (c == '-') + { + neg = 1; + c = *s++; + } + else if (c == '+') + c = *s++; + + if (((base == 0) || (base == 16)) && + (c == '0') && + ((*s == 'x') || (*s == 'X'))) + { + c = s[1]; + s += 2; + base = 16; + } + + if (base == 0) + base = (c == '0' ? 8 : 10); + + cutoff = (ulong_t)ULONG_MAX / (ulong_t)base; + cutlim = (ulong_t)ULONG_MAX % (ulong_t)base; + + for (acc = 0, any = 0;; c = *s++) + { + if (isdigit (c)) + c -= '0'; + else if (isalpha (c)) + c -= (isupper (c) ? 'A' - 10 : 'a' - 10); + else + break; + + if (c >= base) + break; + + if ((any < 0) || (acc > cutoff) || (acc == cutoff) && (c > cutlim)) + any = -1; + else + { + any = 1; + acc *= base; + acc += c; + } + } + + if (any < 0) + { + acc = ULONG_MAX; + errno = ERANGE; + } + else if (neg) + acc = -acc; + + if (endptr != 0) + *endptr = (any ? CHAR_FROM_CONST (s - 1) : CHAR_FROM_CONST (nptr)); + + return (acc); + } diff --git a/libc/stdlib/system.c b/libc/stdlib/system.c new file mode 100644 index 0000000..1384697 --- /dev/null +++ b/libc/stdlib/system.c @@ -0,0 +1,42 @@ +/* system.c - system file for stdlib */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,08feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions. +01a,25mar92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "stdlib.h" + +/***************************************************************************** +* +* system - pass a string to a command processor (Unimplemented) (ANSI) +* +* This function is not applicable to VxWorks. +* +* INCLUDE FILES: stdlib.h +* +* RETURNS: OK, always. +*/ +int system + ( + const char * string /* pointer to string */ + ) + { + return (OK); + } diff --git a/libc/string/Makefile b/libc/string/Makefile new file mode 100644 index 0000000..80d7bea --- /dev/null +++ b/libc/string/Makefile @@ -0,0 +1,32 @@ +# Makefile - makefile for vw/src/libc/string +# +# modification history +# -------------------- +# 01b,12oct01,tam added repackaging support +# 01a,18jun96,yp created from 01d of MakeSkel +# +# DESCRIPTION +# This file contains the makefile rules for building the vx library +# +#*/ + +TGT_DIR=$(WIND_BASE)/target + +LIB_BASE_NAME = os + +DOC_FILES= ansiString.c + +## ansiString.c includes the following files +# memchr.c memcmp.c memcpy.c memmove.c memset.c strcat.c +# strchr.c strcmp.c strcoll.c strcpy.c strcspn.c strerror.c +# string.c strlen.c strncat.c strncmp.c strncpy.c strpbrk.c +# strrchr.c strspn.c strstr.c strtok.c strtok_r.c strxfrm.c + + +OBJS= memchr.o memcmp.o memcpy.o memmove.o memset.o strcat.o strchr.o \ + strcmp.o strcoll.o strcpy.o strcspn.o strerror.o strlen.o strncat.o \ + strncmp.o strncpy.o strpbrk.o strrchr.o strspn.o strstr.o strtok.o \ + strtok_r.o strxfrm.o xstate.o + +include $(TGT_DIR)/h/make/rules.library + diff --git a/libc/string/ansiString.c b/libc/string/ansiString.c new file mode 100644 index 0000000..b3c67a6 --- /dev/null +++ b/libc/string/ansiString.c @@ -0,0 +1,1732 @@ +/* ansiString.c - ANSI `string' documentation */ + +/* Copyright 1992-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,11jul97,dgp doc: SPR 7651 need list of non-reentrant functions +01e,23oct95,jdi doc: incorporated changes for strtok() & strtok_r() (SPR 4874). +01d,11feb95,jdi fixed size parameter name in doc for memset(). +01c,25feb93,jdi documentation cleanup for 5.1. +01b,30nov92,jdi fixed doc for strerror() - SPR 1825. +01a,24oct92,smb written +*/ + +/* +DESCRIPTION +This library includes several standard ANSI routines. Note that where +there is a pair of routines, such as div() and div_r(), only the routine +xxx_r() is reentrant. The xxx() routine is not reentrant. + +The header string.h declares one type and several functions, and defines one +macro useful for manipulating arrays of character type and other objects +treated as array of character type. The type is `size_t' and the macro NULL. +Various methods are used for determining the lengths of the arrays, but in +all cases a `char *' or `void *' argument points to the initial (lowest +addressed) character of the array. If an array is accessed beyond the end +of an object, the behavior is undefined. + +SEE ALSO: American National Standard X3.159-1989 + +INTERNAL +This documentation module is built by appending the following files: + + memchr.c + memcmp.c + memcpy.c + memmove.c + memset.c + strcat.c + strchr.c + strcmp.c + strcoll.c + strcpy.c + strcspn.c + strerror.c + strlen.c + strncat.c + strncmp.c + strncpy.c + strpbrk.c + strrchr.c + strspn.c + strstr.c + strtok.c + strtok_r.c + strxfrm.c +*/ + + +/* memchr.c - search memory for a character, string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + +/******************************************************************************* +* +* memchr - search a block of memory for a character (ANSI) +* +* This routine searches for the first element of an array of `unsigned char', +* beginning at the address with size , that equals converted to +* an `unsigned char'. +* +* INCLUDE FILES: string.h +* +* RETURNS: If successful, it returns the address of the matching element; +* otherwise, it returns a null pointer. +*/ + +void * memchr + ( + const void * m, /* block of memory */ + int c, /* character to search for */ + size_t n /* size of memory to search */ + ) + { + uchar_t *p = (uchar_t *) CHAR_FROM_CONST(m); + + if (n != 0) + do + { + if (*p++ == (unsigned char) c) + return (VOID_FROM_CONST(p - 1)); + + } while (--n != 0); + + return (NULL); + } +/* memcmp.c - memory compare file for string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + +/******************************************************************************* +* +* memcmp - compare two blocks of memory (ANSI) +* +* This routine compares successive elements from two arrays of `unsigned char', +* beginning at the addresses and (both of size ), until it finds +* elements that are not equal. +* +* INCLUDE FILES: string.h +* +* RETURNS: +* If all elements are equal, zero. If elements differ and the differing +* element from is greater than the element from , the routine +* returns a positive number; otherwise, it returns a negative number. +*/ + +int memcmp + ( + const void * s1, /* array 1 */ + const void * s2, /* array 2 */ + size_t n /* size of memory to compare */ + ) + { + const unsigned char *p1; + const unsigned char *p2; + + /* size of memory is zero */ + + if (n == 0) + return (0); + + /* compare array 2 into array 1 */ + + p1 = s1; + p2 = s2; + + while (*p1++ == *p2++) + { + if (--n == 0) + return (0); + } + + return ((*--p1) - (*--p2)); + } +/* memcpy.c - memory copy file for string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,25feb93,jdi documentation cleanup for 5.1. +01f,20sep92,smb documentation additions +01e,14sep92,smb memcpy again uses bcopy +01d,07sep92,smb changed so that memcpy is seperate from bcopy. +01c,30jul92,smb changed to use bcopy. +01b,12jul92,smb changed post decrements to pre decrements. +01a,08jul92,smb written and documented. + +rrr +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/******************************************************************************* +* +* memcpy - copy memory from one location to another (ANSI) +* +* This routine copies characters from the object pointed +* to by into the object pointed to by . If copying +* takes place between objects that overlap, the behavior is undefined. +* +* INCLUDE FILES: string.h +* +* RETURNS: A pointer to . +*/ + +void * memcpy + ( + void * destination, /* destination of copy */ + const void * source, /* source of copy */ + size_t size /* size of memory to copy */ + ) + { + bcopy ((char *) source, (char *) destination, (size_t) size); + return (destination); + } + +/* memmove.c - memory move file for string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + +/******************************************************************************* +* +* memmove - copy memory from one location to another (ANSI) +* +* This routine copies characters from the memory location to +* the location . It ensures that the memory is not corrupted +* even if and overlap. +* +* INCLUDE FILES: string.h +* +* RETURNS: A pointer to . +*/ + +void * memmove + ( + void * destination, /* destination of copy */ + const void * source, /* source of copy */ + size_t size /* size of memory to copy */ + ) + { + char * dest; + const char *src; + + dest = destination; + src = source; + + if ((src < dest) && (dest < (src + size))) + { + for (dest += size, src += size; size > 0; --size) + *--dest = *--src; + } + else + { + while (size > 0) + { + size--; + *dest++ = *src++; + } + } + return (destination); + } +/* memset.c - set a block of memory, string */ + +/* Copyright 1992-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,11feb95,jdi fixed size parameter name in doc. +01f,25feb93,jdi documentation cleanup for 5.1. +01e,20sep92,smb documentation additions +01d,14sep92,smb changes back to use bfill. +01c,07sep92,smb changed so that memset is seperate from bfill +01b,30jul92,smb changes to use bfill. +01a,08jul92,smb written and documented. + +rrr +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + +/******************************************************************************* +* +* memset - set a block of memory (ANSI) +* +* This routine stores converted to an `unsigned char' in each of the +* elements of the array of `unsigned char' beginning at , with size . +* +* INCLUDE FILES: string.h +* +* RETURNS: A pointer to . +*/ + +void * memset + ( + void * m, /* block of memory */ + int c, /* character to store */ + size_t size /* size of memory */ + ) + { + bfill ((char *) m, (int) size, c); + return (m); + } +/* strcat.c - concatenate one string to another, string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/******************************************************************************* +* +* strcat - concatenate one string to another (ANSI) +* +* This routine appends a copy of string to the end of string +* . The resulting string is null-terminated. +* +* INCLUDE FILES: string.h +* +* RETURNS: A pointer to . +*/ + +char * strcat + ( + char * destination, /* string to be appended to */ + const char * append /* string to append to */ + ) + { + char *save = destination; + + while (*destination++ != '\0') /* find end of string */ + ; + + destination--; + + while ((*destination++ = *append++) != '\0') + ; + + return (save); + } +/* strchr.c - search string for character, string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/****************************************************************************** +* +* strchr - find the first occurrence of a character in a string (ANSI) +* +* This routine finds the first occurrence of character +* in string . The terminating null is considered to be part of the string. +* +* INCLUDE FILES: string.h +* +* RETURNS: +* The address of the located character, or NULL if the character is not found. +*/ + +char * strchr + ( + const char * s, /* string in which to search */ + int c /* character to find in string */ + ) + { + char *r = CHAR_FROM_CONST(s); + + while (*r != (char) c) /* search loop */ + { + if (*r++ == EOS) /* end of string */ + return (NULL); + } + + return (r); + } +/* strcmp.c - compare two strings, string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/******************************************************************************* +* +* strcmp - compare two strings lexicographically (ANSI) +* +* This routine compares string to string lexicographically. +* +* INCLUDE FILES: string.h +* +* RETURNS: An integer greater than, equal to, or less than 0, +* according to whether is lexicographically +* greater than, equal to, or less than , respectively. +*/ + +int strcmp + ( + const char * s1, /* string to compare */ + const char * s2 /* string to compare to */ + ) + { + while (*s1++ == *s2++) + if (s1 [-1] == EOS) + return (0); + + return ((s1 [-1]) - (s2 [-1])); + } +/* strcoll.c - string collate, string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "private/strxfrmP.h" + +/* The __sctl type describes a data object that holds the information + * needed to process each source string. The internal function getxfrm + * calls __strxfrm to update an sctl data object. + */ +typedef struct + { + char buf[32]; + const uchar_t *s1; + const uchar_t *s2; + const uchar_t *sout; + __cosave state; + } __sct1; + + +/*************************************************************************** +* +* getxfrm - get transformed characters +* +* A conparison loop within strcoll calls getxfrm for each source string that +* has no mapped characters in its sctl buffer. This ensures that each source +* string is represented by at least one mapped character, if any such +* character remains to be generated. +* +* RETURNS: the size of the transformed string +* NOMANUAL +*/ + +LOCAL size_t getxfrm + ( + __sct1 *p /* information needed to process each source string */ + ) + { + size_t sz; + + /* loop until chars delivered */ + do + { + p->sout = (const uchar_t *) p->buf; + + sz = __strxfrm (p->buf, &p->s1, sizeof (p->buf), &p->state); + + if ((sz > 0) && (p->buf [sz - 1] == EOS)) + return (sz - 1); + + if (*p->s1 == EOS) + p->s1 = p->s2; /* rescan */ + + } while (sz == 0); + + return (sz); + } + +/*************************************************************************** +* +* strcoll - compare two strings as appropriate to LC_COLLATE (ANSI) +* +* This routine compares two strings, both interpreted as appropriate to the +* LC_COLLATE category of the current locale. +* +* INCLUDE FILES: string.h +* +* RETURNS: +* An integer greater than, equal to, or less than zero, according to whether +* string is greater than, equal to, or less than string when both +* are interpreted as appropriate to the current locale. +*/ + +int strcoll + ( + const char * s1, /* string 1 */ + const char * s2 /* string 2 */ + ) + { + size_t n1 = 0; /* size of string 1 */ + size_t n2 = 0; /* size of string 2 */ + __sct1 st1; /* transform structure for string 1 */ + __sct1 st2; /* transform structure for string 2 */ + static const __cosave initial = + { + 0 + }; + + /* compare s1[], s2[] using locale-dependant rules */ + + st1.s1 = (const uchar_t *)s1; /* string transformation 1 */ + st1.s2 = (const uchar_t *)s1; + st1.state = initial; + + st2.s1 = (const uchar_t *)s2; /* string transformation 2 */ + st2.s2 = (const uchar_t *)s2; + st2.state = initial; + + FOREVER /* compare transformed characters */ + { + int ans; + size_t sz; + + if (n1 == 0) + n1 = getxfrm (&st1); /* string 1 */ + + if (n2 == 0) + n2 = getxfrm (&st2); /* string 2 */ + + sz = (n1 < n2) ? n1 : n2; + + if (sz == 0) + { + if (n1 == n2) + return (0); + + if (n2 > 0) + return (-1); + + return (1); + } + + if ((ans = memcmp (st1.sout, st2.sout, sz)) != 0) + return (ans); + + st1.sout += sz; + st2.sout += sz; + n1 -= sz; + n2 -= sz; + } + } +/* strcpy.c - string copy, string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/******************************************************************************* +* +* strcpy - copy one string to another (ANSI) +* +* This routine copies string (including EOS) to string . +* +* INCLUDE FILES: string.h +* +* RETURNS: A pointer to . +*/ + +char * strcpy + ( + char * s1, /* string to copy to */ + const char * s2 /* string to copy from */ + ) + { + char *save = s1; + + while ((*s1++ = *s2++) != EOS) + ; + + return (save); + } +/* strcspn.c - search string for character, string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/******************************************************************************* +* +* strcspn - return the string length up to the first character from a given set (ANSI) +* +* This routine computes the length of the maximum initial segment of string +* that consists entirely of characters not included in string . +* +* INCLUDE FILES: string.h +* +* RETURNS: +* The length of the string segment. +* +* SEE ALSO: strpbrk(), strspn() +*/ + +size_t strcspn + ( + const char * s1, /* string to search */ + const char * s2 /* set of characters to look for in */ + ) + { + const char *save; + const char *p; + char c1; + char c2; + + for (save = s1 + 1; (c1 = *s1++) != EOS; ) /* search for EOS */ + for (p = s2; (c2 = *p++) != EOS; ) /* search for first occurance */ + { + if (c1 == c2) + return (s1 - save); /* return index of substring */ + } + + return (s1 - save); + } +/* strerror.c - string error, string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,25feb93,jdi documentation cleanup for 5.1. +01c,30nov92,jdi fixed doc for strerror() - SPR 1825. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" +#include "errno.h" +#include "symLib.h" +#include "limits.h" +#include "stdio.h" +#include "sysSymTbl.h" +#include "private/funcBindP.h" + + +/* forward declarations */ + +LOCAL STATUS strerrorIf (int errcode, char *buf); + + +/******************************************************************************* +* +* strerror_r - map an error number to an error string (POSIX) +* +* This routine maps the error number in to an error message string. +* It stores the error string in . +* +* This routine is the POSIX reentrant version of strerror(). +* +* INCLUDE FILES: string.h +* +* RETURNS: OK or ERROR. +* +* SEE ALSO: strerror() +*/ + +STATUS strerror_r + ( + int errcode, /* error code */ + char * buffer /* string buffer */ + ) + { + return (strerrorIf (errcode, buffer)); + } + +/******************************************************************************* +* +* strerror - map an error number to an error string (ANSI) +* +* This routine maps the error number in to an error message string. +* It returns a pointer to a static buffer that holds the error string. +* +* This routine is not reentrant. For a reentrant version, see strerror_r(). +* +* INCLUDE: string.h +* +* RETURNS: A pointer to the buffer that holds the error string. +* +* SEE ALSO: strerror_r() +*/ + +char * strerror + ( + int errcode /* error code */ + ) + { + static char buffer [NAME_MAX]; + + (void) strerror_r (errcode, buffer); + + return (buffer); + } + +/******************************************************************************* +* +* strerrorIf - interface from libc to VxWorks for strerror_r +* +* RETURNS: OK, or ERROR if is null. +* NOMANUAL +*/ + +LOCAL STATUS strerrorIf + ( + int errcode, /* error code */ + char *buf /* string buffer */ + ) + { + int value; + SYM_TYPE type; + char statName [NAME_MAX]; + + if (buf == NULL) + return (ERROR); + + if (errcode == 0) + { + strcpy (buf, "OK"); + return (OK); + } + + if ((_func_symFindByValueAndType != (FUNCPTR) NULL) && (statSymTbl != NULL)) + { + (* _func_symFindByValueAndType) (statSymTbl, errcode, statName, &value, + &type, SYM_MASK_NONE, SYM_MASK_NONE); + if (value == errcode) + { + strcpy (buf, statName); + return (OK); + } + } + + sprintf (buf, "errno = %#x", errcode); + + return (OK); + } +/* strlen.c - file for string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/******************************************************************************* +* +* strlen - determine the length of a string (ANSI) +* +* This routine returns the number of characters in , not including EOS. +* +* INCLUDE FILES: string.h +* +* RETURNS: The number of non-null characters in the string. +*/ + +size_t strlen + ( + const char * s /* string */ + ) + { + const char *save = s + 1; + + while (*s++ != EOS) + ; + + return (s - save); + } +/* strncat.c - file for string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + +/******************************************************************************* +* +* strncat - concatenate characters from one string to another (ANSI) +* +* This routine appends up to characters from string to the +* end of string . +* +* INCLUDE FILES: string.h +* +* RETURNS: A pointer to the null-terminated string . +*/ + +char * strncat + ( + char * dst, /* string to append to */ + const char * src, /* string to append */ + size_t n /* max no. of characters to append */ + ) + { + if (n != 0) + { + char *d = dst; + + while (*d++ != EOS) /* find end of string */ + ; + + d--; /* rewind back of EOS */ + + while (((*d++ = *src++) != EOS) && (--n > 0)) + ; + + if (n == 0) + *d = EOS; /* NULL terminate string */ + } + + return (dst); + } +/* strncmp.c - string compare, string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/******************************************************************************* +* +* strncmp - compare the first characters of two strings (ANSI) +* +* This routine compares up to characters of string to string +* lexicographically. +* +* INCLUDE FILES: string.h +* +* RETURNS: +* An integer greater than, equal to, or less than 0, according to whether +* is lexicographically greater than, equal to, or less than , +* respectively. +*/ + +int strncmp + ( + const char * s1, /* string to compare */ + const char * s2, /* string to compare to */ + size_t n /* max no. of characters to compare */ + ) + { + if (n == 0) + return (0); + + while (*s1++ == *s2++) + { + if ((s1 [-1] == EOS) || (--n == 0)) + return (0); + } + + return ((s1 [-1]) - (s2 [-1])); + } +/* strncpy.c - string copy, string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/******************************************************************************* +* +* strncpy - copy characters from one string to another (ANSI) +* +* This routine copies characters from string to string . +* If is greater than the length of , nulls are added to . +* If is less than or equal to the length of , the target +* string will not be null-terminated. +* +* INCLUDE FILES: string.h +* +* RETURNS: A pointer to . +*/ + +char *strncpy + ( + char * s1, /* string to copy to */ + const char *s2, /* string to copy from */ + size_t n /* max no. of characters to copy */ + ) + { + FAST char *d = s1; + + if (n != 0) + { + while ((*d++ = *s2++) != 0) /* copy , checking size */ + { + if (--n == 0) + return (s1); + } + + while (--n > 0) + *d++ = EOS; /* NULL terminate string */ + } + + return (s1); + } +/* strpbrk.c - string search, string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/******************************************************************************* +* +* strpbrk - find the first occurrence in a string of a character from a given set (ANSI) +* +* This routine locates the first occurrence in string of any character +* from string . +* +* INCLUDE FILES: string.h +* +* RETURNS: +* A pointer to the character found in , or +* NULL if no character from occurs in . +* +* SEE ALSO: strcspn() +*/ + +char * strpbrk + ( + const char * s1, /* string to search */ + const char * s2 /* set of characters to look for in */ + ) + { + char *scanp; + int c; + int sc; + + while ((c = *s1++) != 0) /* wait until end of string */ + { + /* loop, searching for character */ + + for (scanp = CHAR_FROM_CONST(s2); (sc = *scanp++) != 0;) + { + if (sc == c) + return (CHAR_FROM_CONST(s1 - 1)); + } + } + + return (NULL); + } +/* strrchr.c - string search, string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/****************************************************************************** +* +* strrchr - find the last occurrence of a character in a string (ANSI) +* +* This routine locates the last occurrence of in the string pointed +* to by . The terminating null is considered to be part of the string. +* +* INCLUDE FILES: string.h +* +* RETURNS: +* A pointer to the last occurrence of the character, or +* NULL if the character is not found. +*/ + +char * strrchr + ( + const char * s, /* string to search */ + int c /* character to look for */ + ) + { + char *save = NULL; + + do /* loop, searching for character */ + { + if (*s == (char) c) + save = CHAR_FROM_CONST (s); + } while (*s++ != EOS); + + return (CHAR_FROM_CONST(save)); + } +/* strspn.c - string search, string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/****************************************************************************** +* +* strspn - return the string length up to the first character not in a given set (ANSI) +* +* This routine computes the length of the maximum initial segment of +* string that consists entirely of characters from the string . +* +* INCLUDE FILES: string.h +* +* RETURNS: +* The length of the string segment. +* +* SEE ALSO: strcspn() +*/ + +size_t strspn + ( + const char * s, /* string to search */ + const char * sep /* set of characters to look for in */ + ) + { + const char *save; + const char *p; + char c1; + char c2; + + for (save = s + 1; (c1 = *s++) != EOS; ) + for (p = sep; (c2 = *p++) != c1; ) + { + if (c2 == EOS) + return (s - save); + } + + return (s - save); + } +/* strstr.c - file for string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/****************************************************************************** +* +* strstr - find the first occurrence of a substring in a string (ANSI) +* +* This routine locates the first occurrence in string +* of the sequence of characters (excluding the terminating null character) +* in the string . +* +* INCLUDE FILES: string.h +* +* RETURNS: +* A pointer to the located substring, or if points to a +* zero-length string, or NULL if the string is not found. +*/ + +char * strstr + ( + const char * s, /* string to search */ + const char * find /* substring to look for */ + ) + { + char *t1; + char *t2; + char c; + char c2; + + if ((c = *find++) == EOS) /* an empty string */ + return (CHAR_FROM_CONST(s)); + + FOREVER + { + while (((c2 = *s++) != EOS) && (c2 != c)) + ; + + if (c2 == EOS) + return (NULL); + + t1 = CHAR_FROM_CONST(s); + t2 = CHAR_FROM_CONST(find); + + while (((c2 = *t2++) != 0) && (*t1++ == c2)) + ; + + if (c2 == EOS) + return (CHAR_FROM_CONST(s - 1)); + } + } +/* strtok.c - file for string */ + +/* Copyright 1992-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,23oct95,jdi doc: added comment that input string will be + changed (SPR 4874). +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/****************************************************************************** +* +* strtok - break down a string into tokens (ANSI) +* +* A sequence of calls to this routine breaks the string into a +* sequence of tokens, each of which is delimited by a character from the +* string . The first call in the sequence has as its +* first argument, and is followed by calls with a null pointer as their +* first argument. The separator string may be different from call to call. +* +* The first call in the sequence searches for the first character +* that is not contained in the current separator string. If the character +* is not found, there are no tokens in and strtok() returns a +* null pointer. If the character is found, it is the start of the first +* token. +* +* strtok() then searches from there for a character that is contained in the +* current separator string. If the character is not found, the current +* token expands to the end of the string pointed to by , and +* subsequent searches for a token will return a null pointer. If the +* character is found, it is overwritten by a null character, which +* terminates the current token. strtok() saves a pointer to the following +* character, from which the next search for a token will start. +* (Note that because the separator character is overwritten by a null +* character, the input string is modified as a result of this call.) +* +* Each subsequent call, with a null pointer as the value of the first +* argument, starts searching from the saved pointer and behaves as +* described above. +* +* The implementation behaves as if strtok() is called by no library functions. +* +* REENTRANCY +* This routine is not reentrant; the reentrant form is strtok_r(). +* +* INCLUDE FILES: string.h +* +* RETURNS +* A pointer to the first character of a token, or a NULL pointer if there is +* no token. +* +* SEE ALSO: strtok_r() +*/ + +char * strtok + ( + char * string, /* string */ + const char * separator /* separator indicator */ + ) + { + static char *last = NULL; + + return (strtok_r (string, separator, &last)); + } +/* strtok_r.c - file for string */ + +/* Copyright 1992-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,23oct95,jdi doc: added comment that input string will be + changed (SPR 4874). +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/***************************************************************************** +* +* strtok_r - break down a string into tokens (reentrant) (POSIX) +* +* This routine considers the null-terminated string as a sequence +* of zero or more text tokens separated by spans of one or more characters +* from the separator string . The argument points to a +* user-provided pointer which in turn points to the position within +* at which scanning should begin. +* +* In the first call to this routine, points to a null-terminated +* string; points to a null-terminated string of separator +* characters; and points to a NULL pointer. The function returns a +* pointer to the first character of the first token, writes a null character +* into immediately following the returned token, and updates the +* pointer to which points so that it points to the first character +* following the null written into . (Note that because the +* separator character is overwritten by a null character, the input string +* is modified as a result of this call.) +* +* In subsequent calls must be a NULL pointer and must +* be unchanged so that subsequent calls will move through the string , +* returning successive tokens until no tokens remain. The separator +* string may be different from call to call. When no token +* remains in , a NULL pointer is returned. +* +* INCLUDE FILES: string.h +* +* RETURNS +* A pointer to the first character of a token, +* or a NULL pointer if there is no token. +* +* SEE ALSO: strtok() +*/ + +char * strtok_r + ( + char * string, /* string to break into tokens */ + const char * separators, /* the separators */ + char ** ppLast /* pointer to serve as string index */ + ) + { + if ((string == NULL) && ((string = *ppLast) == NULL)) + return (NULL); + + if (*(string += strspn (string, separators)) == EOS) + return (*ppLast = NULL); + + if ((*ppLast = strpbrk (string, separators)) != NULL) + *(*ppLast)++ = EOS; + + return (string); + } +/* strxfrm.c - file for string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,25feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions +01b,13jul92,smb changed __cosave initialisation for MIPS. +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "limits.h" +#include "private/strxfrmP.h" + + +/******************************************************************************* +* +* strxfrm - transform up to characters of into (ANSI) +* +* This routine transforms string and places the resulting string in . +* The transformation is such that if strcmp() is applied to two transformed +* strings, it returns a value greater than, equal to, or less than zero, +* corresponding to the result of the strcoll() function applied to the same +* two original strings. No more than characters are placed into the +* resulting , including the terminating null character. If is zero, +* is permitted to be a NULL pointer. If copying takes place between +* objects that overlap, the behavior is undefined. +* +* INCLUDE FILES: string.h +* +* RETURNS: +* The length of the transformed string, not including the terminating null +* character. If the value is or more, the contents of are +* indeterminate. +* +* SEE ALSO: strcmp(), strcoll() +*/ + +size_t strxfrm + ( + char * s1, /* string out */ + const char * s2, /* string in */ + size_t n /* size of buffer */ + ) + { + size_t i; + size_t nx = 0; + const uchar_t *s = (const uchar_t *)s2; + char buf[32]; + __cosave state; + + /* stores state information */ + state.__state = EOS; + state.__wchar = 0; + + while (nx < n) /* translate and deliver */ + { + i = __strxfrm (s1, &s, nx - n, &state); + s1 += i; + nx += i; + + if ((i > 0) && (s1[-1] == EOS)) + return (nx - 1); + + if (*s == EOS) + s = (const uchar_t *) s2; + } + + FOREVER /* translate the rest */ + { + i = __strxfrm (buf, &s, sizeof (buf), &state); + + nx += i; + + if ((i > 0) && (buf [i - 1] == EOS)) + return (nx - 1); + + if (*s == EOS) + s = (const uchar_t *) s2; + } + } + +/******************************************************************************* +* +* __strxfrm - translates string into an easier form for strxfrm() and strcoll() +* +* This routine performs the mapping as a finite state machine executing +* the table __wcstate defined in xstate.h. +* +* NOMANUAL +*/ + +size_t __strxfrm + ( + char * sout, /* out string */ + const uchar_t ** ppsin, /* pointer to character within string */ + size_t size, /* size of string */ + __cosave * ps /* state information */ + ) + { + const ushort_t * stab; + ushort_t code; + char state = ps->__state; /* initial state */ + BOOL leave = FALSE; + int limit = 0; + int nout = 0; + const uchar_t * sin = *ppsin; /* in string */ + ushort_t wc = ps->__wchar; + + FOREVER /* do state transformation */ + { + if ((_NSTATE <= state) || + ((stab = __costate.__table [state]) == NULL) || + ((code = stab [*sin]) == 0)) + break; /* error */ + + state = (code & ST_STATE) >> ST_STOFF; + + if ( code & ST_FOLD) + wc = wc & ~UCHAR_MAX | code & ST_CH; + + if ( code & ST_ROTATE) + wc = wc >> CHAR_BIT & UCHAR_MAX | wc << CHAR_BIT; + + if ((code & ST_OUTPUT) && + (((sout[nout++] = code & ST_CH ? code : wc) == EOS) || + (size <= nout))) + leave = TRUE; + + if (code & ST_INPUT) + if (*sin != EOS) + { + ++sin; + limit = 0; + } + else + leave = TRUE; + + if (leave) + { /* save state and return */ + *ppsin = sin; + ps->__state = state; + ps->__wchar = wc; + return (nout); + } + } + + sout[nout++] = EOS; /* error */ + *ppsin = sin; + ps->__state = _NSTATE; + return (nout); + } diff --git a/libc/string/memchr.c b/libc/string/memchr.c new file mode 100644 index 0000000..b47e159 --- /dev/null +++ b/libc/string/memchr.c @@ -0,0 +1,58 @@ +/* memchr.c - search memory for a character, string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + +/******************************************************************************* +* +* memchr - search a block of memory for a character (ANSI) +* +* This routine searches for the first element of an array of `unsigned char', +* beginning at the address with size , that equals converted to +* an `unsigned char'. +* +* INCLUDE FILES: string.h +* +* RETURNS: If successful, it returns the address of the matching element; +* otherwise, it returns a null pointer. +*/ + +void * memchr + ( + const void * m, /* block of memory */ + int c, /* character to search for */ + size_t n /* size of memory to search */ + ) + { + uchar_t *p = (uchar_t *) CHAR_FROM_CONST(m); + + if (n != 0) + do + { + if (*p++ == (unsigned char) c) + return (VOID_FROM_CONST(p - 1)); + + } while (--n != 0); + + return (NULL); + } diff --git a/libc/string/memcmp.c b/libc/string/memcmp.c new file mode 100644 index 0000000..4896af7 --- /dev/null +++ b/libc/string/memcmp.c @@ -0,0 +1,69 @@ +/* memcmp.c - memory compare file for string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + +/******************************************************************************* +* +* memcmp - compare two blocks of memory (ANSI) +* +* This routine compares successive elements from two arrays of `unsigned char', +* beginning at the addresses and (both of size ), until it finds +* elements that are not equal. +* +* INCLUDE FILES: string.h +* +* RETURNS: +* If all elements are equal, zero. If elements differ and the differing +* element from is greater than the element from , the routine +* returns a positive number; otherwise, it returns a negative number. +*/ + +int memcmp + ( + const void * s1, /* array 1 */ + const void * s2, /* array 2 */ + size_t n /* size of memory to compare */ + ) + { + const unsigned char *p1; + const unsigned char *p2; + + /* size of memory is zero */ + + if (n == 0) + return (0); + + /* compare array 2 into array 1 */ + + p1 = s1; + p2 = s2; + + while (*p1++ == *p2++) + { + if (--n == 0) + return (0); + } + + return ((*--p1) - (*--p2)); + } diff --git a/libc/string/memcpy.c b/libc/string/memcpy.c new file mode 100644 index 0000000..6e8e8f5 --- /dev/null +++ b/libc/string/memcpy.c @@ -0,0 +1,55 @@ +/* memcpy.c - memory copy file for string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,25feb93,jdi documentation cleanup for 5.1. +01f,20sep92,smb documentation additions +01e,14sep92,smb memcpy again uses bcopy +01d,07sep92,smb changed so that memcpy is seperate from bcopy. +01c,30jul92,smb changed to use bcopy. +01b,12jul92,smb changed post decrements to pre decrements. +01a,08jul92,smb written and documented. + +rrr +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/******************************************************************************* +* +* memcpy - copy memory from one location to another (ANSI) +* +* This routine copies characters from the object pointed +* to by into the object pointed to by . If copying +* takes place between objects that overlap, the behavior is undefined. +* +* INCLUDE FILES: string.h +* +* RETURNS: A pointer to . +*/ + +void * memcpy + ( + void * destination, /* destination of copy */ + const void * source, /* source of copy */ + size_t size /* size of memory to copy */ + ) + { + bcopy ((char *) source, (char *) destination, (size_t) size); + return (destination); + } + diff --git a/libc/string/memmove.c b/libc/string/memmove.c new file mode 100644 index 0000000..2af086a --- /dev/null +++ b/libc/string/memmove.c @@ -0,0 +1,66 @@ +/* memmove.c - memory move file for string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + +/******************************************************************************* +* +* memmove - copy memory from one location to another (ANSI) +* +* This routine copies characters from the memory location to +* the location . It ensures that the memory is not corrupted +* even if and overlap. +* +* INCLUDE FILES: string.h +* +* RETURNS: A pointer to . +*/ + +void * memmove + ( + void * destination, /* destination of copy */ + const void * source, /* source of copy */ + size_t size /* size of memory to copy */ + ) + { + char * dest; + const char *src; + + dest = destination; + src = source; + + if ((src < dest) && (dest < (src + size))) + { + for (dest += size, src += size; size > 0; --size) + *--dest = *--src; + } + else + { + while (size > 0) + { + size--; + *dest++ = *src++; + } + } + return (destination); + } diff --git a/libc/string/memset.c b/libc/string/memset.c new file mode 100644 index 0000000..ed72f04 --- /dev/null +++ b/libc/string/memset.c @@ -0,0 +1,52 @@ +/* memset.c - set a block of memory, string */ + +/* Copyright 1992-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,11feb95,jdi fixed size parameter name in doc. +01f,25feb93,jdi documentation cleanup for 5.1. +01e,20sep92,smb documentation additions +01d,14sep92,smb changes back to use bfill. +01c,07sep92,smb changed so that memset is seperate from bfill +01b,30jul92,smb changes to use bfill. +01a,08jul92,smb written and documented. + +rrr +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + +/******************************************************************************* +* +* memset - set a block of memory (ANSI) +* +* This routine stores converted to an `unsigned char' in each of the +* elements of the array of `unsigned char' beginning at , with size . +* +* INCLUDE FILES: string.h +* +* RETURNS: A pointer to . +*/ + +void * memset + ( + void * m, /* block of memory */ + int c, /* character to store */ + size_t size /* size of memory */ + ) + { + bfill ((char *) m, (int) size, c); + return (m); + } diff --git a/libc/string/strcat.c b/libc/string/strcat.c new file mode 100644 index 0000000..3b4a74a --- /dev/null +++ b/libc/string/strcat.c @@ -0,0 +1,56 @@ +/* strcat.c - concatenate one string to another, string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/******************************************************************************* +* +* strcat - concatenate one string to another (ANSI) +* +* This routine appends a copy of string to the end of string +* . The resulting string is null-terminated. +* +* INCLUDE FILES: string.h +* +* RETURNS: A pointer to . +*/ + +char * strcat + ( + char * destination, /* string to be appended to */ + const char * append /* string to append to */ + ) + { + char *save = destination; + + while (*destination++ != '\0') /* find end of string */ + ; + + destination--; + + while ((*destination++ = *append++) != '\0') + ; + + return (save); + } diff --git a/libc/string/strchr.c b/libc/string/strchr.c new file mode 100644 index 0000000..1448fc5 --- /dev/null +++ b/libc/string/strchr.c @@ -0,0 +1,55 @@ +/* strchr.c - search string for character, string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/****************************************************************************** +* +* strchr - find the first occurrence of a character in a string (ANSI) +* +* This routine finds the first occurrence of character +* in string . The terminating null is considered to be part of the string. +* +* INCLUDE FILES: string.h +* +* RETURNS: +* The address of the located character, or NULL if the character is not found. +*/ + +char * strchr + ( + const char * s, /* string in which to search */ + int c /* character to find in string */ + ) + { + char *r = CHAR_FROM_CONST(s); + + while (*r != (char) c) /* search loop */ + { + if (*r++ == EOS) /* end of string */ + return (NULL); + } + + return (r); + } diff --git a/libc/string/strcmp.c b/libc/string/strcmp.c new file mode 100644 index 0000000..63ce7ad --- /dev/null +++ b/libc/string/strcmp.c @@ -0,0 +1,51 @@ +/* strcmp.c - compare two strings, string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/******************************************************************************* +* +* strcmp - compare two strings lexicographically (ANSI) +* +* This routine compares string to string lexicographically. +* +* INCLUDE FILES: string.h +* +* RETURNS: An integer greater than, equal to, or less than 0, +* according to whether is lexicographically +* greater than, equal to, or less than , respectively. +*/ + +int strcmp + ( + const char * s1, /* string to compare */ + const char * s2 /* string to compare to */ + ) + { + while (*s1++ == *s2++) + if (s1 [-1] == EOS) + return (0); + + return ((s1 [-1]) - (s2 [-1])); + } diff --git a/libc/string/strcoll.c b/libc/string/strcoll.c new file mode 100644 index 0000000..2e570cb --- /dev/null +++ b/libc/string/strcoll.c @@ -0,0 +1,155 @@ +/* strcoll.c - string collate, string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,26jun02,gls fixed infinite loop in strcoll() (SPR #78357) +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "private/strxfrmP.h" + +/* The __sctl type describes a data object that holds the information + * needed to process each source string. The internal function getxfrm + * calls __strxfrm to update an sctl data object. + */ +typedef struct + { + char buf[32]; + const uchar_t *s1; + const uchar_t *s2; + const uchar_t *sout; + __cosave state; + } __sct1; + + +/*************************************************************************** +* +* getxfrm - get transformed characters +* +* A conparison loop within strcoll calls getxfrm for each source string that +* has no mapped characters in its sctl buffer. This ensures that each source +* string is represented by at least one mapped character, if any such +* character remains to be generated. +* +* RETURNS: the size of the transformed string +* NOMANUAL +*/ + +LOCAL size_t getxfrm + ( + __sct1 *p /* information needed to process each source string */ + ) + { + size_t sz; + + /* loop until chars delivered */ + do + { + p->sout = (const uchar_t *) p->buf; + + sz = __strxfrm (p->buf, &p->s1, sizeof (p->buf), &p->state); + + if ((sz > 0) && (p->buf [sz - 1] == EOS)) + return (sz - 1); + + /* only reset the scan if the __strxfrm() call returned ERROR. */ + + if ((*p->s1 == EOS) && (p->state.__state == _NSTATE)) + { + p->s1 = p->s2; /* rescan */ + } + + } while (sz == 0); + + return (sz); + } + +/*************************************************************************** +* +* strcoll - compare two strings as appropriate to LC_COLLATE (ANSI) +* +* This routine compares two strings, both interpreted as appropriate to the +* LC_COLLATE category of the current locale. +* +* INCLUDE FILES: string.h +* +* RETURNS: +* An integer greater than, equal to, or less than zero, according to whether +* string is greater than, equal to, or less than string when both +* are interpreted as appropriate to the current locale. +*/ + +int strcoll + ( + const char * s1, /* string 1 */ + const char * s2 /* string 2 */ + ) + { + size_t n1 = 0; /* size of string 1 */ + size_t n2 = 0; /* size of string 2 */ + __sct1 st1; /* transform structure for string 1 */ + __sct1 st2; /* transform structure for string 2 */ + static const __cosave initial = + { + 0 + }; + + /* compare s1[], s2[] using locale-dependant rules */ + + st1.s1 = (const uchar_t *)s1; /* string transformation 1 */ + st1.s2 = (const uchar_t *)s1; + st1.state = initial; + + st2.s1 = (const uchar_t *)s2; /* string transformation 2 */ + st2.s2 = (const uchar_t *)s2; + st2.state = initial; + + FOREVER /* compare transformed characters */ + { + int ans; + size_t sz; + + if (n1 == 0) + n1 = getxfrm (&st1); /* string 1 */ + + if (n2 == 0) + n2 = getxfrm (&st2); /* string 2 */ + + sz = (n1 < n2) ? n1 : n2; + + if (sz == 0) + { + if (n1 == n2) + return (0); + + if (n2 > 0) + return (-1); + + return (1); + } + + if ((ans = memcmp (st1.sout, st2.sout, sz)) != 0) + return (ans); + + st1.sout += sz; + st2.sout += sz; + n1 -= sz; + n2 -= sz; + } + } diff --git a/libc/string/strcpy.c b/libc/string/strcpy.c new file mode 100644 index 0000000..f1f2959 --- /dev/null +++ b/libc/string/strcpy.c @@ -0,0 +1,50 @@ +/* strcpy.c - string copy, string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/******************************************************************************* +* +* strcpy - copy one string to another (ANSI) +* +* This routine copies string (including EOS) to string . +* +* INCLUDE FILES: string.h +* +* RETURNS: A pointer to . +*/ + +char * strcpy + ( + char * s1, /* string to copy to */ + const char * s2 /* string to copy from */ + ) + { + char *save = s1; + + while ((*s1++ = *s2++) != EOS) + ; + + return (save); + } diff --git a/libc/string/strcspn.c b/libc/string/strcspn.c new file mode 100644 index 0000000..623430d --- /dev/null +++ b/libc/string/strcspn.c @@ -0,0 +1,61 @@ +/* strcspn.c - search string for character, string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/******************************************************************************* +* +* strcspn - return the string length up to the first character from a given set (ANSI) +* +* This routine computes the length of the maximum initial segment of string +* that consists entirely of characters not included in string . +* +* INCLUDE FILES: string.h +* +* RETURNS: +* The length of the string segment. +* +* SEE ALSO: strpbrk(), strspn() +*/ + +size_t strcspn + ( + const char * s1, /* string to search */ + const char * s2 /* set of characters to look for in */ + ) + { + const char *save; + const char *p; + char c1; + char c2; + + for (save = s1 + 1; (c1 = *s1++) != EOS; ) /* search for EOS */ + for (p = s2; (c2 = *p++) != EOS; ) /* search for first occurance */ + { + if (c1 == c2) + return (s1 - save); /* return index of substring */ + } + + return (s1 - save); + } diff --git a/libc/string/strerror.c b/libc/string/strerror.c new file mode 100644 index 0000000..e599804 --- /dev/null +++ b/libc/string/strerror.c @@ -0,0 +1,143 @@ +/* strerror.c - string error, string */ + +/* Copyright 1992-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01e,16oct01,jn use symFindSymbol for symbol lookup (SPR #7453) +01d,25feb93,jdi documentation cleanup for 5.1. +01c,30nov92,jdi fixed doc for strerror() - SPR 1825. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" +#include "errno.h" +#include "symLib.h" +#include "limits.h" +#include "stdio.h" +#include "sysSymTbl.h" +#include "private/funcBindP.h" + +/* forward declarations */ + +LOCAL STATUS strerrorIf (int errcode, char *buf); + + +/******************************************************************************* +* +* strerror_r - map an error number to an error string +* +* This routine maps the error number in to an error message string. +* It stores the error string in . The size of should be +* NAME_MAX + 1 - using a smaller buffer may lead to stack corruption. NAME_MAX +* is defined in limits.h. +* +* This routine is the reentrant version of strerror(). +* +* INCLUDE FILES: string.h +* +* RETURNS: OK or ERROR. +* +* SEE ALSO: strerror() +*/ + +STATUS strerror_r + ( + int errcode, /* error code */ + char * buffer /* string buffer */ + ) + { + return (strerrorIf (errcode, buffer)); + } + +/******************************************************************************* +* +* strerror - map an error number to an error string (ANSI) +* +* This routine maps the error number in to an error message string. +* It returns a pointer to a static buffer that holds the error string. +* +* INCLUDE: string.h +* +* RETURNS: A pointer to the buffer that holds the error string. +* +* SEE ALSO: strerror_r() +*/ + +char * strerror + ( + int errcode /* error code */ + ) + { + static char buffer [NAME_MAX+1]; /* NAME_MAX doesn't count the EOS. */ + + (void) strerror_r (errcode, buffer); + + return (buffer); + } + +/******************************************************************************* +* +* strerrorIf - interface from libc to VxWorks for strerror_r +* +* RETURNS: OK, or ERROR if is null. +* NOMANUAL +*/ + +LOCAL STATUS strerrorIf + ( + int errcode, /* error code */ + char *buf /* string buffer */ + ) + { + void * value; + char * statName; + SYMBOL_ID symId; + + if (buf == NULL) + return (ERROR); + + if (errcode == 0) + { + strcpy (buf, "OK"); + return (OK); + } + + /* + * Only check one symLib function pointer (for performance's sake). + * All symLib functions are provided by the same library, by convention. + */ + + if ((_func_symFindSymbol != (FUNCPTR) NULL) && + (statSymTbl != NULL)) + { + + (* _func_symFindSymbol) (statSymTbl, NULL, (void *)errcode, + SYM_MASK_NONE, SYM_MASK_NONE, &symId); + (* _func_symNameGet) (symId, &statName); + (* _func_symValueGet) (symId, &value); + + if (value == (void *)errcode) + { + strncpy (buf, statName, NAME_MAX+1); + return (OK); + } + } + + sprintf (buf, "errno = %#x", errcode); + + return (OK); + } diff --git a/libc/string/string.c b/libc/string/string.c new file mode 100644 index 0000000..d0717ed --- /dev/null +++ b/libc/string/string.c @@ -0,0 +1,15 @@ +/* string.c - string functions (ANSI) */ + +/* Copyright 1984-1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01a,13oct92,jdi created. +*/ + +/* +DESCRIPTION +*** This is just a place holder for future string documentation. *** +NOMANUAL (for now) +*/ diff --git a/libc/string/strlen.c b/libc/string/strlen.c new file mode 100644 index 0000000..e3d3457 --- /dev/null +++ b/libc/string/strlen.c @@ -0,0 +1,49 @@ +/* strlen.c - file for string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/******************************************************************************* +* +* strlen - determine the length of a string (ANSI) +* +* This routine returns the number of characters in , not including EOS. +* +* INCLUDE FILES: string.h +* +* RETURNS: The number of non-null characters in the string. +*/ + +size_t strlen + ( + const char * s /* string */ + ) + { + const char *save = s + 1; + + while (*s++ != EOS) + ; + + return (s - save); + } diff --git a/libc/string/strncat.c b/libc/string/strncat.c new file mode 100644 index 0000000..9294d2e --- /dev/null +++ b/libc/string/strncat.c @@ -0,0 +1,62 @@ +/* strncat.c - file for string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + +/******************************************************************************* +* +* strncat - concatenate characters from one string to another (ANSI) +* +* This routine appends up to characters from string to the +* end of string . +* +* INCLUDE FILES: string.h +* +* RETURNS: A pointer to the null-terminated string . +*/ + +char * strncat + ( + char * dst, /* string to append to */ + const char * src, /* string to append */ + size_t n /* max no. of characters to append */ + ) + { + if (n != 0) + { + char *d = dst; + + while (*d++ != EOS) /* find end of string */ + ; + + d--; /* rewind back of EOS */ + + while (((*d++ = *src++) != EOS) && (--n > 0)) + ; + + if (n == 0) + *d = EOS; /* NULL terminate string */ + } + + return (dst); + } diff --git a/libc/string/strncmp.c b/libc/string/strncmp.c new file mode 100644 index 0000000..9740fb3 --- /dev/null +++ b/libc/string/strncmp.c @@ -0,0 +1,59 @@ +/* strncmp.c - string compare, string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/******************************************************************************* +* +* strncmp - compare the first characters of two strings (ANSI) +* +* This routine compares up to characters of string to string +* lexicographically. +* +* INCLUDE FILES: string.h +* +* RETURNS: +* An integer greater than, equal to, or less than 0, according to whether +* is lexicographically greater than, equal to, or less than , +* respectively. +*/ + +int strncmp + ( + const char * s1, /* string to compare */ + const char * s2, /* string to compare to */ + size_t n /* max no. of characters to compare */ + ) + { + if (n == 0) + return (0); + + while (*s1++ == *s2++) + { + if ((s1 [-1] == EOS) || (--n == 0)) + return (0); + } + + return ((s1 [-1]) - (s2 [-1])); + } diff --git a/libc/string/strncpy.c b/libc/string/strncpy.c new file mode 100644 index 0000000..07e03dd --- /dev/null +++ b/libc/string/strncpy.c @@ -0,0 +1,63 @@ +/* strncpy.c - string copy, string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/******************************************************************************* +* +* strncpy - copy characters from one string to another (ANSI) +* +* This routine copies characters from string to string . +* If is greater than the length of , nulls are added to . +* If is less than or equal to the length of , the target +* string will not be null-terminated. +* +* INCLUDE FILES: string.h +* +* RETURNS: A pointer to . +*/ + +char *strncpy + ( + char * s1, /* string to copy to */ + const char *s2, /* string to copy from */ + size_t n /* max no. of characters to copy */ + ) + { + FAST char *d = s1; + + if (n != 0) + { + while ((*d++ = *s2++) != 0) /* copy , checking size */ + { + if (--n == 0) + return (s1); + } + + while (--n > 0) + *d++ = EOS; /* NULL terminate string */ + } + + return (s1); + } diff --git a/libc/string/strpbrk.c b/libc/string/strpbrk.c new file mode 100644 index 0000000..91b37b4 --- /dev/null +++ b/libc/string/strpbrk.c @@ -0,0 +1,65 @@ +/* strpbrk.c - string search, string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/******************************************************************************* +* +* strpbrk - find the first occurrence in a string of a character from a given set (ANSI) +* +* This routine locates the first occurrence in string of any character +* from string . +* +* INCLUDE FILES: string.h +* +* RETURNS: +* A pointer to the character found in , or +* NULL if no character from occurs in . +* +* SEE ALSO: strcspn() +*/ + +char * strpbrk + ( + const char * s1, /* string to search */ + const char * s2 /* set of characters to look for in */ + ) + { + char *scanp; + int c; + int sc; + + while ((c = *s1++) != 0) /* wait until end of string */ + { + /* loop, searching for character */ + + for (scanp = CHAR_FROM_CONST(s2); (sc = *scanp++) != 0;) + { + if (sc == c) + return (CHAR_FROM_CONST(s1 - 1)); + } + } + + return (NULL); + } diff --git a/libc/string/strrchr.c b/libc/string/strrchr.c new file mode 100644 index 0000000..9b3c5c9 --- /dev/null +++ b/libc/string/strrchr.c @@ -0,0 +1,56 @@ +/* strrchr.c - string search, string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/****************************************************************************** +* +* strrchr - find the last occurrence of a character in a string (ANSI) +* +* This routine locates the last occurrence of in the string pointed +* to by . The terminating null is considered to be part of the string. +* +* INCLUDE FILES: string.h +* +* RETURNS: +* A pointer to the last occurrence of the character, or +* NULL if the character is not found. +*/ + +char * strrchr + ( + const char * s, /* string to search */ + int c /* character to look for */ + ) + { + char *save = NULL; + + do /* loop, searching for character */ + { + if (*s == (char) c) + save = CHAR_FROM_CONST (s); + } while (*s++ != EOS); + + return (CHAR_FROM_CONST(save)); + } diff --git a/libc/string/strspn.c b/libc/string/strspn.c new file mode 100644 index 0000000..30f7aaf --- /dev/null +++ b/libc/string/strspn.c @@ -0,0 +1,61 @@ +/* strspn.c - string search, string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/****************************************************************************** +* +* strspn - return the string length up to the first character not in a given set (ANSI) +* +* This routine computes the length of the maximum initial segment of +* string that consists entirely of characters from the string . +* +* INCLUDE FILES: string.h +* +* RETURNS: +* The length of the string segment. +* +* SEE ALSO: strcspn() +*/ + +size_t strspn + ( + const char * s, /* string to search */ + const char * sep /* set of characters to look for in */ + ) + { + const char *save; + const char *p; + char c1; + char c2; + + for (save = s + 1; (c1 = *s++) != EOS; ) + for (p = sep; (c2 = *p++) != c1; ) + { + if (c2 == EOS) + return (s - save); + } + + return (s - save); + } diff --git a/libc/string/strstr.c b/libc/string/strstr.c new file mode 100644 index 0000000..d1eb561 --- /dev/null +++ b/libc/string/strstr.c @@ -0,0 +1,73 @@ +/* strstr.c - file for string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/****************************************************************************** +* +* strstr - find the first occurrence of a substring in a string (ANSI) +* +* This routine locates the first occurrence in string +* of the sequence of characters (excluding the terminating null character) +* in the string . +* +* INCLUDE FILES: string.h +* +* RETURNS: +* A pointer to the located substring, or if points to a +* zero-length string, or NULL if the string is not found. +*/ + +char * strstr + ( + const char * s, /* string to search */ + const char * find /* substring to look for */ + ) + { + char *t1; + char *t2; + char c; + char c2; + + if ((c = *find++) == EOS) /* an empty string */ + return (CHAR_FROM_CONST(s)); + + FOREVER + { + while (((c2 = *s++) != EOS) && (c2 != c)) + ; + + if (c2 == EOS) + return (NULL); + + t1 = CHAR_FROM_CONST(s); + t2 = CHAR_FROM_CONST(find); + + while (((c2 = *t2++) != 0) && (*t1++ == c2)) + ; + + if (c2 == EOS) + return (CHAR_FROM_CONST(s - 1)); + } + } diff --git a/libc/string/strtok.c b/libc/string/strtok.c new file mode 100644 index 0000000..1555502 --- /dev/null +++ b/libc/string/strtok.c @@ -0,0 +1,82 @@ +/* strtok.c - file for string */ + +/* Copyright 1992-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,23oct95,jdi doc: added comment that input string will be + changed (SPR 4874). +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/****************************************************************************** +* +* strtok - break down a string into tokens (ANSI) +* +* A sequence of calls to this routine breaks the string into a +* sequence of tokens, each of which is delimited by a character from the +* string . The first call in the sequence has as its +* first argument, and is followed by calls with a null pointer as their +* first argument. The separator string may be different from call to call. +* +* The first call in the sequence searches for the first character +* that is not contained in the current separator string. If the character +* is not found, there are no tokens in and strtok() returns a +* null pointer. If the character is found, it is the start of the first +* token. +* +* strtok() then searches from there for a character that is contained in the +* current separator string. If the character is not found, the current +* token expands to the end of the string pointed to by , and +* subsequent searches for a token will return a null pointer. If the +* character is found, it is overwritten by a null character, which +* terminates the current token. strtok() saves a pointer to the following +* character, from which the next search for a token will start. +* (Note that because the separator character is overwritten by a null +* character, the input string is modified as a result of this call.) +* +* Each subsequent call, with a null pointer as the value of the first +* argument, starts searching from the saved pointer and behaves as +* described above. +* +* The implementation behaves as if strtok() is called by no library functions. +* +* REENTRANCY +* This routine is not reentrant; the reentrant form is strtok_r(). +* +* INCLUDE FILES: string.h +* +* RETURNS +* A pointer to the first character of a token, or a NULL pointer if there is +* no token. +* +* SEE ALSO: strtok_r() +*/ + +char * strtok + ( + char * string, /* string */ + const char * separator /* separator indicator */ + ) + { + static char *last = NULL; + + return (strtok_r (string, separator, &last)); + } diff --git a/libc/string/strtok_r.c b/libc/string/strtok_r.c new file mode 100644 index 0000000..fd46caa --- /dev/null +++ b/libc/string/strtok_r.c @@ -0,0 +1,81 @@ +/* strtok_r.c - file for string */ + +/* Copyright 1992-1995 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,23oct95,jdi doc: added comment that input string will be + changed (SPR 4874). +01c,25feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" + + +/***************************************************************************** +* +* strtok_r - break down a string into tokens (reentrant) (POSIX) +* +* This routine considers the null-terminated string as a sequence +* of zero or more text tokens separated by spans of one or more characters +* from the separator string . The argument points to a +* user-provided pointer which in turn points to the position within +* at which scanning should begin. +* +* In the first call to this routine, points to a null-terminated +* string; points to a null-terminated string of separator +* characters; and points to a NULL pointer. The function returns a +* pointer to the first character of the first token, writes a null character +* into immediately following the returned token, and updates the +* pointer to which points so that it points to the first character +* following the null written into . (Note that because the +* separator character is overwritten by a null character, the input string +* is modified as a result of this call.) +* +* In subsequent calls must be a NULL pointer and must +* be unchanged so that subsequent calls will move through the string , +* returning successive tokens until no tokens remain. The separator +* string may be different from call to call. When no token +* remains in , a NULL pointer is returned. +* +* INCLUDE FILES: string.h +* +* RETURNS +* A pointer to the first character of a token, +* or a NULL pointer if there is no token. +* +* SEE ALSO: strtok() +*/ + +char * strtok_r + ( + char * string, /* string to break into tokens */ + const char * separators, /* the separators */ + char ** ppLast /* pointer to serve as string index */ + ) + { + if ((string == NULL) && ((string = *ppLast) == NULL)) + return (NULL); + + if (*(string += strspn (string, separators)) == EOS) + return (*ppLast = NULL); + + if ((*ppLast = strpbrk (string, separators)) != NULL) + *(*ppLast)++ = EOS; + + return (string); + } diff --git a/libc/string/strxfrm.c b/libc/string/strxfrm.c new file mode 100644 index 0000000..5aab0f5 --- /dev/null +++ b/libc/string/strxfrm.c @@ -0,0 +1,165 @@ +/* strxfrm.c - file for string */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,25feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions +01b,13jul92,smb changed __cosave initialisation for MIPS. +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "limits.h" +#include "private/strxfrmP.h" + + +/******************************************************************************* +* +* strxfrm - transform up to characters of into (ANSI) +* +* This routine transforms string and places the resulting string in . +* The transformation is such that if strcmp() is applied to two transformed +* strings, it returns a value greater than, equal to, or less than zero, +* corresponding to the result of the strcoll() function applied to the same +* two original strings. No more than characters are placed into the +* resulting , including the terminating null character. If is zero, +* is permitted to be a NULL pointer. If copying takes place between +* objects that overlap, the behavior is undefined. +* +* INCLUDE FILES: string.h +* +* RETURNS: +* The length of the transformed string, not including the terminating null +* character. If the value is or more, the contents of are +* indeterminate. +* +* SEE ALSO: strcmp(), strcoll() +*/ + +size_t strxfrm + ( + char * s1, /* string out */ + const char * s2, /* string in */ + size_t n /* size of buffer */ + ) + { + size_t i; + size_t nx = 0; + const uchar_t *s = (const uchar_t *)s2; + char buf[32]; + __cosave state; + + /* stores state information */ + state.__state = EOS; + state.__wchar = 0; + + while (nx < n) /* translate and deliver */ + { + i = __strxfrm (s1, &s, nx - n, &state); + s1 += i; + nx += i; + + if ((i > 0) && (s1[-1] == EOS)) + return (nx - 1); + + if (*s == EOS) + s = (const uchar_t *) s2; + } + + FOREVER /* translate the rest */ + { + i = __strxfrm (buf, &s, sizeof (buf), &state); + + nx += i; + + if ((i > 0) && (buf [i - 1] == EOS)) + return (nx - 1); + + if (*s == EOS) + s = (const uchar_t *) s2; + } + } + +/******************************************************************************* +* +* __strxfrm - translates string into an easier form for strxfrm() and strcoll() +* +* This routine performs the mapping as a finite state machine executing +* the table __wcstate defined in xstate.h. +* +* NOMANUAL +*/ + +size_t __strxfrm + ( + char * sout, /* out string */ + const uchar_t ** ppsin, /* pointer to character within string */ + size_t size, /* size of string */ + __cosave * ps /* state information */ + ) + { + const ushort_t * stab; + ushort_t code; + char state = ps->__state; /* initial state */ + BOOL leave = FALSE; + int limit = 0; + int nout = 0; + const uchar_t * sin = *ppsin; /* in string */ + ushort_t wc = ps->__wchar; + + FOREVER /* do state transformation */ + { + if ((_NSTATE <= state) || + ((stab = __costate.__table [state]) == NULL) || + ((code = stab [*sin]) == 0)) + break; /* error */ + + state = (code & ST_STATE) >> ST_STOFF; + + if ( code & ST_FOLD) + wc = wc & ~UCHAR_MAX | code & ST_CH; + + if ( code & ST_ROTATE) + wc = wc >> CHAR_BIT & UCHAR_MAX | wc << CHAR_BIT; + + if ((code & ST_OUTPUT) && + (((sout[nout++] = code & ST_CH ? code : wc) == EOS) || + (size <= nout))) + leave = TRUE; + + if (code & ST_INPUT) + if (*sin != EOS) + { + ++sin; + limit = 0; + } + else + leave = TRUE; + + if (leave) + { /* save state and return */ + *ppsin = sin; + ps->__state = state; + ps->__wchar = wc; + return (nout); + } + } + + sout[nout++] = EOS; /* error */ + *ppsin = sin; + ps->__state = _NSTATE; + return (nout); + } diff --git a/libc/string/xstate.c b/libc/string/xstate.c new file mode 100644 index 0000000..2aef0d4 --- /dev/null +++ b/libc/string/xstate.c @@ -0,0 +1,88 @@ +/* xstate.c - file for string */ + +/* Copyright 1992 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01b,20sep92,smb documentation additions +01a,08jul92,smb written and documented. +*/ + +/* +DESCRIPTION + +INCLUDE FILES: string.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" +#include "limits.h" +#include "private/strStateP.h" + + +/* strxfrm works as a finite state machine executing the state table stored + * at __wcstate defined below. + */ + +#define X (ST_FOLD | ST_OUTPUT | ST_INPUT) + +static const ushort_t __table[257] = + { + 0, + X|0x00, X|0x01, X|0x02, X|0x03, X|0x04, X|0x05, X|0x06, X|0x07, + X|0x08, X|0x09, X|0x0a, X|0x0b, X|0x0c, X|0x0d, X|0x0e, X|0x0f, + X|0x10, X|0x11, X|0x12, X|0x13, X|0x14, X|0x15, X|0x16, X|0x17, + X|0x18, X|0x19, X|0x1a, X|0x1b, X|0x1c, X|0x1d, X|0x1e, X|0x1f, + X|0x20, X|0x21, X|0x22, X|0x23, X|0x24, X|0x25, X|0x26, X|0x27, + X|0x28, X|0x29, X|0x2a, X|0x2b, X|0x2c, X|0x2d, X|0x2e, X|0x2f, + X|0x30, X|0x31, X|0x32, X|0x33, X|0x34, X|0x35, X|0x36, X|0x37, + X|0x38, X|0x39, X|0x3a, X|0x3b, X|0x3c, X|0x3d, X|0x3e, X|0x3f, + X|0x40, X|0x41, X|0x42, X|0x43, X|0x44, X|0x45, X|0x46, X|0x47, + X|0x48, X|0x49, X|0x4a, X|0x4b, X|0x4c, X|0x4d, X|0x4e, X|0x4f, + X|0x50, X|0x51, X|0x52, X|0x53, X|0x54, X|0x55, X|0x56, X|0x57, + X|0x58, X|0x59, X|0x5a, X|0x5b, X|0x5c, X|0x5d, X|0x5e, X|0x5f, + X|0x60, X|0x61, X|0x62, X|0x63, X|0x64, X|0x65, X|0x66, X|0x67, + X|0x68, X|0x69, X|0x6a, X|0x6b, X|0x6c, X|0x6d, X|0x6e, X|0x6f, + X|0x70, X|0x71, X|0x72, X|0x73, X|0x74, X|0x75, X|0x76, X|0x77, + X|0x78, X|0x79, X|0x7a, X|0x7b, X|0x7c, X|0x7d, X|0x7e, X|0x7f, + X|0x80, X|0x81, X|0x82, X|0x83, X|0x84, X|0x85, X|0x86, X|0x87, + X|0x88, X|0x89, X|0x8a, X|0x8b, X|0x8c, X|0x8d, X|0x8e, X|0x8f, + X|0x90, X|0x91, X|0x92, X|0x93, X|0x94, X|0x95, X|0x96, X|0x97, + X|0x98, X|0x99, X|0x9a, X|0x9b, X|0x9c, X|0x9d, X|0x9e, X|0x9f, + X|0xa0, X|0xa1, X|0xa2, X|0xa3, X|0xa4, X|0xa5, X|0xa6, X|0xa7, + X|0xa8, X|0xa9, X|0xaa, X|0xab, X|0xac, X|0xad, X|0xae, X|0xaf, + X|0xb0, X|0xb1, X|0xb2, X|0xb3, X|0xb4, X|0xb5, X|0xb6, X|0xb7, + X|0xb8, X|0xb9, X|0xba, X|0xbb, X|0xbc, X|0xbd, X|0xbe, X|0xbf, + X|0xc0, X|0xc1, X|0xc2, X|0xc3, X|0xc4, X|0xc5, X|0xc6, X|0xc7, + X|0xc8, X|0xc9, X|0xca, X|0xcb, X|0xcc, X|0xcd, X|0xce, X|0xcf, + X|0xd0, X|0xd1, X|0xd2, X|0xd3, X|0xd4, X|0xd5, X|0xd6, X|0xd7, + X|0xd8, X|0xd9, X|0xda, X|0xdb, X|0xdc, X|0xdd, X|0xde, X|0xdf, + X|0xe0, X|0xe1, X|0xe2, X|0xe3, X|0xe4, X|0xe5, X|0xe6, X|0xe7, + X|0xe8, X|0xe9, X|0xea, X|0xeb, X|0xec, X|0xed, X|0xee, X|0xef, + X|0xf0, X|0xf1, X|0xf2, X|0xf3, X|0xf4, X|0xf5, X|0xf6, X|0xf7, + X|0xf8, X|0xf9, X|0xfa, X|0xfb, X|0xfc, X|0xfd, X|0xfe, X|0xff + }; + +__statetable __costate = + { + &__table[1] + }; + +#if FALSE /* NOT IMPLEMENTED */ + +__statetable __wcstate = + { + &__table[1] + }; + +__statetable __mbstate = + { + &__table[1] + }; + +#endif /* NOT IMPLEMENTED */ diff --git a/libc/time/Makefile b/libc/time/Makefile new file mode 100644 index 0000000..008d7be --- /dev/null +++ b/libc/time/Makefile @@ -0,0 +1,27 @@ +# Makefile - makefile for vw/src/libc/ctype +# +# modification history +# -------------------- +# 01b,12oct01,tam added repackaging support +# 01a,18jun96,yp created from 01d of MakeSkel +# +# DESCRIPTION +# This file contains the makefile rules for building the vx library +# +#*/ + +TGT_DIR=$(WIND_BASE)/target + +LIB_BASE_NAME = os + +DOC_FILES= ansiTime.c + +## ansiTime.c includes the following files +# asctime.c clock.c ctime.c difftime.c gmtime.c localtime.c +# mktime.c strftime.c time.c + +OBJS= locTime.o asctime.o clock.o ctime.o difftime.o gmtime.o localtime.o \ + mktime.o strftime.o time.o + +include $(TGT_DIR)/h/make/rules.library + diff --git a/libc/time/ansiTime.c b/libc/time/ansiTime.c new file mode 100644 index 0000000..11282ea --- /dev/null +++ b/libc/time/ansiTime.c @@ -0,0 +1,1662 @@ +/* ansiTime.c - ANSI `time' documentation */ + +/* Copyright 1992-2001 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01p,05oct01,dcb Fix SPR 9814, SPR 7736, SPR 62831 and SPR 7191. +01o,12mar99,p_m Fixed SPR 8225 by putting asctime output in uppercase. +01n,11jul97,dgp doc: SPR 7651 need list of non-reentrant functions +01m,20jan97,dbt modified comment for tm_sec (SPR #4436). +01l,15oct96,dbt Used reentrant version of ldiv in getTime (fixed SPR #3795). +01k,04oct96,dbt reworked the fix for SPR #7277. +01j,03oct96,dbt use memcpy with 'strlen + 1' instead of 'strlen' (SPR #7277) +01i,12aug96,dbt modified __getTime to treat time_t as an unsigned (SPR #6178). +01h,30jul96,dbt In function mktime, if tm_isdst flag is true substract one + hour from timeIs (SPR #6954). + Updated copyright. +01g,25jul96,dbt modified function __jullday (for leap year just test month > 1) + modified call to jullday in __getTime in order to give it a + year as found in a tm structure, e.g. "96" (SPR #4251) + corrected localtime_r (SPR #2521). + timeBuffer must be initialized before a call of __getDstInfo. + corrected __getDstInfo() (spr 2521) + Updated copyright. +01h,25jul96,dbt fixed warnings in mktime.c. +01g,16feb95,rhp doc tweaks, and synch with subsidiary files +01f,15sep94,rhp fixed TIMEZONE example in comment (related to SPR #3490); + reduced duplication between man page and comments +01e,17aug93,dvs changed TIME to TIMEO to fix conflicting defines (SPR #2249) +01d,13mar93,jdi doc tweak. +01c,05feb93,jdi doc: clarified TIMEZONE string - SPR 1977; + clarified that TIMEZONE is environment variable - SPR 1974. +01b,13nov92,dnw changed slong_t decls to long +01a,24oct92,smb written. +*/ + +/* +DESCRIPTION +The header time.h defines two macros and declares four types and several +functions for manipulating time. Many functions deal with a `calendar time' +that represents the current date (according to the Gregorian calendar) +and time. Some functions deal with `local time', which is the calendar +time expressed for some specific time zone, and with Daylight Saving Time, +which is a temporary change in the algorithm for determining local time. +The local time zone and Daylight Saving Time are implementation-defined. + +.SS Macros +The macros defined are NULL and: +.iP `CLOCKS_PER_SEC' 12 +the number of ticks per second. +.LP + +.SS Types +The types declared are `size_t' and: +.iP "`clock_t', `time_t'" 12 +arithmetic types capable of representing times. +.iP "`struct tm'" +holds the components of a calendar time in what is known as "broken-down time." +The structure contains at least the following members, in any order. +The semantics of the members and their normal ranges are expressed in the +comments. + +.TS +tab(|); +l1p9f3 l1 l. +int tm_sec; | seconds after the minute | - [0, 59] +int tm_min; | minutes after the hour | - [0, 59] +int tm_hour; | hours after midnight | - [0, 23] +int tm_mday; | day of the month | - [1, 31] +int tm_mon; | months since January | - [0, 11] +int tm_year; | years since 1900 +int tm_wday; | days since Sunday | - [0, 6] +int tm_yday; | days since January 1 | - [0, 365] +int tm_isdst; | Daylight Saving Time flag +.TE + +The value of `tm_isdst' is positive if Daylight Saving Time is in effect, zero +if Daylight Saving Time is not in effect, and negative if the information +is not available. +.LP + +If the environment variable TIMEZONE is set, the information is retrieved from +this variable, otherwise from the locale information. +TIMEZONE is of the form: + +.ft CB + :<(unused)>::: +.ft 1 + +To calculate local time, the value of is subtracted +from UTC; must be positive. + +Daylight information is expressed as mmddhh (month-day-hour), for +example: +.CS + UTC::0:040102:100102 +.CE + +REENTRANCY +Where there is a pair of routines, such as div() and div_r(), only the routine +xxx_r() is reentrant. The xxx() routine is not reentrant. + +INCLUDE FILES: time.h + +SEE ALSO: ansiLocale, American National Standard X3.159-1989 +*/ + +/* +Documentation for the ANSI C time library. +========================================== + +Locale Information +------------------ + +The time locale information is stored in the file __timeloc.c. This +structure consists of + + The days of the week in abbreviated form + + The days of the week + + Months of the year in abbreviated form + + Months of the year + + date and time representation for this locale + + representation for AM.PM + + Time zone information (discussed below ) + + Day light saving information (discussed below ) + +If you want to, for example, use the french translation for the days +of the week, then this file could be copied into another file +e.g. __frtimeloc.c and the days and months representation in french. A +full compile is neccessary. This means that when using strftime or +asctime the days and months will be in French! + +Maintaining a table of the possible locale variations would mean large +linked lists of tables and is not appropriate for this system. +Maybe later we can provide a mechanism for replacing this table by a +table defined by the user at system initialisation. + +The zone and daylight information may also be set to represent the +local environment. + +ZONE & Daylight Saving +---------------------- + +The first three fields of TIMEZONE are represented in the locale structure +by the time zone information area and the day light saving area of the +locale structure is of the same form as the last two fields. + +The TIMEZONE environment variable can be set by the user to reflect the locale +environment. + +SEE ALSO: American National Standard X3.159-1989 +NOMANUAL + +INTERNAL +This documentation module is built by appending the following files: + + asctime.c + clock.c + ctime.c + difftime.c + gmtime.c + localtime.c + mktime.c + strftime.c + time.c +*/ + + +/* asctime.c - asctime file for time.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,25jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: time.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "time.h" +#include "private/timeP.h" + +/**************************************************************************** +* +* asctime - convert broken-down time into a string (ANSI) +* +* This routine converts the broken-down time pointed to by into a +* string of the form: +* .CS +* SUN SEP 16 01:03:52 1973\en\e0 +* .CE +* +* This routine is not reentrant. For a reentrant version, see asctime_r(). +* +* INCLUDE FILES: time.h +* +* RETURNS: A pointer to the created string. +*/ + +char * asctime + ( + const struct tm *timeptr /* broken-down time */ + ) + { + size_t len = sizeof (ASCBUF); + static char asctimeBuf [sizeof (ASCBUF)]; + + asctime_r (timeptr, asctimeBuf, &len); + + return (asctimeBuf); + } + +/**************************************************************************** +* +* asctime_r - convert broken-down time into a string (POSIX) +* +* This routine converts the broken-down time pointed to by into a +* string of the form: +* .CS +* SUN SEP 16 01:03:52 1973\en\e0 +* .CE +* The string is copied to . +* +* This routine is the POSIX re-entrant version of asctime(). +* +* INCLUDE FILES: time.h +* +* RETURNS: The size of the created string. +*/ + +int asctime_r + ( + const struct tm *timeptr, /* broken-down time */ + char * asctimeBuf, /* buffer to contain string */ + size_t * buflen /* size of buffer */ + ) + { + size_t size; + + size = strftime (asctimeBuf, + *buflen, + "%a %b %d %H:%M:%S %Y\n\0", + timeptr); + + return ((int) size); + } +/* clock.c - clock file for time.h */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,05oct01,dcb Fix SPR 9814 and SPR 7736. +01c,05feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,25jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: time.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "time.h" + +/****************************************************************************** +* +* clock - determine the processor time in use (ANSI) +* +* This routine returns the implementation's best approximation of +* the processor time used by the program since the beginning of an +* implementation-defined era related only to the program invocation. +* To determine the time in seconds, the value returned by clock() +* should be divided by the value of the macro CLOCKS_PER_SEC. If the +* processor time used is not available or its value cannot be +* represented, clock() returns -1. +* +* NOTE: +* This routine always returns -1 in VxWorks. VxWorks does not track +* per-task time or system idle time. There is no method of determining +* how long a task or the entire system has been doing work. tickGet() +* can be used to query the number of system ticks since system start. +* clock_gettime() can be used to get the current clock time. +* +* INCLUDE FILES: time.h +* +* RETURNS: -1 +* +* SEE ALSO: tickGet(), clock_gettime() +*/ + +clock_t clock (void) + { + return ((clock_t) -1); + } + +/* ctime.c - ctime file for time */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01c,05feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,25jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: time.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "time.h" +#include "private/timeP.h" + +/******************************************************************************* +* +* ctime - convert time in seconds into a string (ANSI) +* +* This routine converts the calendar time pointed to by into local +* time in the form of a string. It is equivalent to: +* .CS +* asctime (localtime (timer)); +* .CE +* +* This routine is not reentrant. For a reentrant version, see ctime_r(). +* +* INCLUDE FILES: time.h +* +* RETURNS: +* The pointer returned by asctime() with local broken-down time as the +* argument. +* +* SEE ALSO: asctime(), localtime() +*/ + +char * ctime + ( + const time_t *timer /* calendar time in seconds */ + ) + { + size_t len = sizeof (ASCBUF); + static char asctimeBuf [sizeof (ASCBUF)]; + + return (ctime_r (timer, asctimeBuf, &len)); + } + +/******************************************************************************* +* +* ctime_r - convert time in seconds into a string (POSIX) +* +* This routine converts the calendar time pointed to by into local +* time in the form of a string. It is equivalent to: +* .CS +* asctime (localtime (timer)); +* .CE +* +* This routine is the POSIX re-entrant version of ctime(). +* +* INCLUDE FILES: time.h +* +* RETURNS: +* The pointer returned by asctime() with local broken-down time as the +* argument. +* +* SEE ALSO: asctime(), localtime() +*/ + +char * ctime_r + ( + const time_t * timer, /* calendar time in seconds */ + char * asctimeBuf, /* buffer to contain the string */ + size_t * buflen /* size of the buffer */ + ) + { + asctime_r (localtime (timer), asctimeBuf, buflen); + + return (asctimeBuf); + } +/* difftime.c - difftime file for time */ + +/* Copyright 1992-1993 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,04oct01,dcb Fix SPR 7191. Cast time1 and time2 before subtracting. +01c,05feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,25jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: time.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "time.h" + +/******************************************************************************* +* +* difftime - compute the difference between two calendar times (ANSI) +* +* This routine computes the difference between two calendar times: +* - . +* +* INCLUDE FILES: time.h +* +* RETURNS: The time difference in seconds, expressed as a double. +*/ + +double difftime + ( + time_t time1, /* later time, in seconds */ + time_t time0 /* earlier time, in seconds */ + ) + { + /* This function assumes that sizeof(time_t) is <= sizeof(double). */ + + return (double)time1 - (double)time0; + } + +/* gmtime.c - gmtime file for time */ + +/* Copyright 1992-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01g,15oct96,dbt Used reentrant version of ldiv in getTime (fixed SPR #3795). +01f,12aug96,dbt modified __getTime to treat time_t as an unsigned (SPR #6178). +01e,21jun96,dbt modified function __jullday (for leap year just test month > 1) + modified call to jullday in __getTime in order to give it a + year as found in a tm structure, e.g. "96" (SPR #4251) + Updated copyright. +01f,24aug94,ism fixed problem with bus error in time conversion (SPR #3542) + -fixed problem with negative time values + -fixed problem with leap year in negative years (SPR #3576) +01e,24sep93,jmm __julday() now checks for february 29th as a leap year +01d,05feb93,jdi documentation cleanup for 5.1. +01c,13nov92,dnw changed slong_t decls to long +01b,20sep92,smb documentation additions +01a,25jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: time.h, stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "time.h" +#include "stdlib.h" +#include "private/timeP.h" + +/**************************************************************************** +* +* gmtime - convert calendar time into UTC broken-down time (ANSI) +* +* This routine converts the calendar time pointed to by into +* broken-down time, expressed as Coordinated Universal Time (UTC). +* +* This routine is not reentrant. For a reentrant version, see gmtime_r(). +* +* INCLUDE FILES: time.h +* +* RETURNS: +* A pointer to a broken-down time structure (`tm'), or a null pointer +* if UTC is not available. +*/ + +struct tm *gmtime + ( + const time_t *timer /* calendar time in seconds */ + ) + { + static struct tm timeBuffer; + + gmtime_r (timer, &timeBuffer); + return (&timeBuffer); + } + +/**************************************************************************** +* +* gmtime_r - convert calendar time into broken-down time (POSIX) +* +* This routine converts the calendar time pointed to by into +* broken-down time, expressed as Coordinated Universal Time (UTC). +* The broken-down time is stored in . +* +* This routine is the POSIX re-entrant version of gmtime(). +* +* INCLUDE FILES: time.h +* +* RETURNS: OK. +*/ + +int gmtime_r + ( + const time_t *timer, /* calendar time in seconds */ + struct tm * timeBuffer /* buffer for broken down time */ + ) + { + return (__getTime (*timer, timeBuffer)); + } + +/************************************************************************ +* +* __getTime - convert calendar time into broken-down time +* +* internal routine. +* +* RETURNS: OK +* NOMANUAL +*/ + +int __getTime + ( + const time_t timer, /* time represented as seconds from epoch */ + struct tm * tmp /* pointer to broken-down time structure */ + ) + { + long days; + long timeOfDay; + long year; + long mon; + ldiv_t result; + + /* Calulate number of days since epoch */ + + days = timer / SECSPERDAY; + timeOfDay = timer % SECSPERDAY; + + /* If time of day is negative, subtract one day, and add SECSPERDAY + * to make it positive. + */ + + if(timeOfDay<0) + { + timeOfDay+=SECSPERDAY; + days-=1; + } + + /* Calulate number of years since epoch */ + + year = days / DAYSPERYEAR; + while ( __daysSinceEpoch (year, 0) > days ) + year--; + + /* Calulate the day of the week */ + + tmp->tm_wday = (days + EPOCH_WDAY) % DAYSPERWEEK; + + /* + * If there is a negative weekday, add DAYSPERWEEK to make it positive + */ + if(tmp->tm_wday<0) + tmp->tm_wday+=DAYSPERWEEK; + + /* Find year and remaining days */ + + days -= __daysSinceEpoch (year, 0); + year += EPOCH_YEAR; + + /* Find month */ + /* __jullday needs years since TM_YEAR_BASE (SPR 4251) */ + + for ( mon = 0; + (days >= __julday (year - TM_YEAR_BASE, mon + 1, 0)) && (mon < 11); + mon++ ) + ; + + /* Initialise tm structure */ + + tmp->tm_year = year - TM_YEAR_BASE; /* years since 1900 */ + tmp->tm_mon = mon; + tmp->tm_mday = (days - __julday (tmp->tm_year, mon, 0)) + 1; + tmp->tm_yday = __julday (tmp->tm_year, mon, tmp->tm_mday) - 1; + tmp->tm_hour = timeOfDay / SECSPERHOUR; + + timeOfDay %= SECSPERHOUR; + ldiv_r (timeOfDay, SECSPERMIN, &result); + tmp->tm_min = result.quot; + tmp->tm_sec = result.rem; + + return(OK); + } + +/************************************************************************ +* +* daysSinceEpoch - calculate number days since ANSI C epoch +* +* The (year + 1)/4 term accounts for leap years, the +* first of which was 1972 & should be added starting '73 +* +* RETURNS: +* NOMANUAL +*/ + +int __daysSinceEpoch + ( + int year, /* Years since epoch */ + int yday /* days since Jan 1 */ + ) + { + if(year>=0) /* 1970 + */ + return ( (365 * year) + (year + 1) / 4 + yday ); + else /* 1969 - */ + return ( (365 * year) + (year - 2) / 4 + yday ); + } + +/************************************************************************ +* +* julday - calculate Julian Day given year, month, day +* Inputs : year (years since 1900), month (0 - 11), +* day (1 - 31) +* Comment : Returns Julian day in range 1:366. +* Unix wants 0:365 +* RETURNS: Julian day +* NOMANUAL +*/ + +int __julday + ( + int yr, /* year */ + int mon, /* month */ + int day /* day */ + ) + { + static jdays[12] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; + int leap = 0; + + if (isleap (yr + TM_YEAR_BASE)) + { + /* + * If it is a leap year, leap only gets set if the day is + * after beginning of March (SPR #4251). + */ + if (mon > 1) + leap = 1; + } + + return (jdays [mon] + day + leap ); + + } + +/* localtime.c - localtime routine for the ANSI time library */ + +/* Copyright 1992-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01d,20jun96,dbt corrected localtime_r (SPR #2521). + timeBuffer must be initialized before a call of __getDstInfo. + Updated copyright. +01c,05feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,25jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: time.h, stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "time.h" +#include "stdlib.h" +#include "private/timeP.h" + +extern TIMELOCALE *__loctime; /* time locale information */ + +/**************************************************************************** +* +* localtime - convert calendar time into broken-down time (ANSI) +* +* This routine converts the calendar time pointed to by into +* broken-down time, expressed as local time. +* +* This routine is not reentrant. For a reentrant version, see localtime_r(). +* +* INCLUDE FILES: time.h +* +* RETURNS: +* A pointer to a `tm' structure containing the local broken-down time. +*/ + +struct tm *localtime + ( + const time_t * timer /* calendar time in seconds */ + ) + { + static struct tm timeBuffer; + + localtime_r (timer, &timeBuffer); + return (&timeBuffer); + } + +/**************************************************************************** +* +* localtime_r - convert calendar time into broken-down time (POSIX) +* +* This routine converts the calendar time pointed to by into +* broken-down time, expressed as local time. The broken-down time is +* stored in . +* +* This routine is the POSIX re-entrant version of localtime(). +* +* INCLUDE FILES: time.h +* +* RETURNS: OK. +*/ + +int localtime_r + ( + const time_t * timer, /* calendar time in seconds */ + struct tm * timeBuffer /* buffer for the broken-down time */ + ) + { + char zoneBuf [sizeof (ZONEBUFFER)]; + int dstOffset; + + /* First get the zone info */ + __getZoneInfo(zoneBuf, TIMEOFFSET, __loctime); + + /* Generate a broken-down time structure */ + __getTime (*timer - ((atoi (zoneBuf)) * SECSPERMIN), timeBuffer); + + /* is Daylight Saving Time in effect ? */ + dstOffset = __getDstInfo (timeBuffer,__loctime); + timeBuffer->tm_isdst = dstOffset; + + /* Correct the broken-down time structure if necessary */ + if (dstOffset) + __getTime ((*timer - ((atoi (zoneBuf)) * SECSPERMIN)) + + (dstOffset * SECSPERHOUR), timeBuffer); + + return (OK); /* __getTime always returns OK */ + } + +/* mktime.c - mktime file for time */ + +/* Copyright 1992-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01f,30jul96,dbt In function mktime, if tm_isdst flag is true substract one + hour from timeIs (SPR #6954). + Updated copyright. +01e,25jul96,dbt fixed warnings in mktime.c. +01d,24sep93,jmm _tmValidate() calls _julday() with the tm_mday parameter +01c,05feb93,jdi documentation cleanup for 5.1. +01b,20sep92,smb documentation additions +01a,25jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: time.h, stdlib.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "time.h" +#include "stdlib.h" +#include "private/timeP.h" + +extern TIMELOCALE *__loctime; /* locale time structure */ + +/* LOCAL */ +LOCAL void __tmNormalize (int *,int *,int); +LOCAL void __tmValidate (struct tm *); + +/******************************************************************************* +* +* mktime - convert broken-down time into calendar time (ANSI) +* +* This routine converts the broken-down time, expressed as local time, in +* the structure pointed to by into a calendar time value with the +* same encoding as that of the values returned by the time() function. The +* original values of the `tm_wday' and `tm_yday' components of the `tm' +* structure are ignored, and the original values of the other components are +* not restricted to the ranges indicated in time.h. On successful completion, +* the values of `tm_wday' and `tm_yday' are set appropriately, and the other +* components are set to represent the specified calendar time, but with +* their values forced to the ranges indicated in time.h; the final value of +* `tm_mday' is not set until `tm_mon' and `tm_year' are determined. +* +* INCLUDE FILES: time.h +* +* RETURNS: +* The calendar time in seconds, or ERROR (-1) +* if calendar time cannot be calculated. +*/ + +time_t mktime + ( + struct tm * timeptr /* pointer to broken-down structure */ + ) + { + time_t timeIs = 0; + int days = 0; + char zoneBuf [sizeof (ZONEBUFFER)]; + + /* Validate tm structure */ + __tmValidate (timeptr); + + /* Calulate time_t value */ + /* time */ + timeIs += (timeptr->tm_sec + + (timeptr->tm_min * SECSPERMIN) + + (timeptr->tm_hour * SECSPERHOUR)); + + /* date */ + days += __julday (timeptr->tm_year, timeptr->tm_mon, timeptr->tm_mday); + + timeptr->tm_yday = (days - 1); + + if ((timeptr->tm_year + TM_YEAR_BASE) < EPOCH_YEAR ) + return ((time_t) ERROR); + + /* days in previous years */ + days = __daysSinceEpoch (timeptr->tm_year - (EPOCH_YEAR - TM_YEAR_BASE), + timeptr->tm_yday ); + + timeptr->tm_wday = (days + EPOCH_WDAY) % DAYSPERWEEK; + + timeIs += (days * SECSPERDAY); + + /* correct for day light saving */ + /* validate again for the extra DST hour */ + if ((timeptr->tm_isdst = __getDstInfo (timeptr, __loctime))) + { + timeIs -= SECSPERHOUR; + __tmValidate (timeptr); + } + + /* correct for zone offset from UTC */ + __getZoneInfo (zoneBuf, TIMEOFFSET, __loctime); + timeIs += (atoi (zoneBuf) * SECSPERMIN); + + return(timeIs); + } + +/******************************************************************************* +* +* __tmValidate - validate the broken-down structure, tmptr. +* +* RETURNS: the validated structure. +* NOMANUAL +*/ +LOCAL void __tmValidate + ( + struct tm * tmptr /* pointer to broken-down structure */ + ) + { + struct tm tmStruct; + int jday; + int mon; + + /* Adjust timeptr to reflect a legal time + * Is it within range 1970-2038? + */ + + tmStruct = *tmptr; + + __tmNormalize (&tmStruct.tm_min, &tmStruct.tm_sec, SECSPERMIN); + __tmNormalize (&tmStruct.tm_hour, &tmStruct.tm_min, MINSPERHOUR); + __tmNormalize (&tmStruct.tm_mday, &tmStruct.tm_hour, HOURSPERDAY); + __tmNormalize (&tmStruct.tm_year, &tmStruct.tm_mon, MONSPERYEAR); + + /* tm_mday may not be in the correct range - check */ + + jday = __julday (tmStruct.tm_year, tmStruct.tm_mon , tmStruct.tm_mday); + + if (jday < 0) + { + tmStruct.tm_year--; + jday += DAYSPERYEAR; + } + + /* Calulate month and day */ + for (mon = 0; + (jday > __julday (tmStruct.tm_year, mon+1, 0)) && (mon < 11); + mon++ ) + ; + + tmStruct.tm_mon = mon; + tmStruct.tm_mday = jday - __julday (tmStruct.tm_year, mon, 0); + tmStruct.tm_wday = 0; + tmStruct.tm_yday = 0; + + *tmptr = tmStruct; + } + +/******************************************************************************* +* +* __tmNormalize - This function is used to reduce units to a range [0,base] +* tens is used to store the number of times units is divisable +* by base. +* +* total = (tens * base) + units +* +* RETURNS: no value +* NOMANUAL +*/ + +LOCAL void __tmNormalize + ( + int * tens, /* tens */ + int * units, /* units */ + int base /* base */ + ) + { + *tens += *units / base; + *units %= base; + + if ((*units % base ) < 0) + { + (*tens)--; + *units += base; + } + } + +/* strftime.c - strftime file for time */ + +/* Copyright 1991-1996 Wind River Systems, Inc. */ + +/* +modification history +-------------------- +01i,20jan97,dbt modified comment concerning seconds (SPR #4436). +01h,04oct96,dbt reworked the fix for SPR #7277. +01g,03oct96,dbt use memcpy with 'strlen + 1' instead of 'strlen' (SPR #7277) +01f,27jun96,dbt corrected __getDstInfo() (spr 2521) + Updated copyright. +01g,10feb95,rhp internal doc tweak from ansiTime.c +01f,15sep94,rhp fixed TIMEZONE example in comment (related to SPR #3490) +01e,17aug93,dvs changed TIME to TIMEO to fix conflicting defines (SPR #2249) +01d,05feb93,jdi documentation cleanup for 5.1. +01c,20sep92,smb documentation additions +01b,26jul92,rrr fixed decl of __weekOfYear to compile on mips. +01a,25jul92,smb written. +*/ + +/* +DESCRIPTION + +INCLUDE FILE: time.h, stdlib.h, string.h, locale.h + +SEE ALSO: American National Standard X3.159-1989 + +NOMANUAL +*/ + +#include "vxWorks.h" +#include "string.h" +#include "stdlib.h" +#include "locale.h" +#include "private/timeP.h" + +extern TIMELOCALE * __loctime; /* time locale information */ + +/* LOCAL */ + +LOCAL size_t strftime_r (char *, size_t, const char *, + const struct tm *, TIMELOCALE *); +LOCAL void __generateTime (char *, const struct tm *, + TIMELOCALE *, int *, const char *); +LOCAL void __getDay (char *, int, int, TIMELOCALE *, int *); +LOCAL void __getMonth (char *, int, int, TIMELOCALE *, int *); +LOCAL void __getLocale (char *, int, const struct tm *, TIMELOCALE *, int *); +LOCAL void __intToStr (char *, int, int); +LOCAL int __weekOfYear (int, int, int); + + +/******************************************************************************* +* +* strftime - convert broken-down time into a formatted string (ANSI) +* +* This routine formats the broken-down time in based on the conversion +* specified in the string , and places the result in the string . +* +* The format is a multibyte character sequence, beginning and ending in its +* initial state. The string consists of zero or more conversion +* specifiers and ordinary multibyte characters. A conversion specifier +* consists of a % character followed by a character that determines the +* behavior of the conversion. All ordinary multibyte characters (including +* the terminating NULL character) are copied unchanged to the array. If +* copying takes place between objects that overlap, the behavior is +* undefined. No more than characters are placed into the array. +* +* Each conversion specifier is replaced by appropriate characters as +* described in the following list. The appropriate characters are determined +* by the LC_TIME category of the current locale and by the values contained +* in the structure pointed to by . +* +* .iP %a +* the locale's abbreviated weekday name. +* .iP %A +* the locale's full weekday name. +* .iP %b +* the locale's abbreviated month name. +* .iP %B +* the locale's full month name. +* .iP %c +* the locale's appropriate date and time representation. +* .iP %d +* the day of the month as decimal number (01-31). +* .iP %H +* the hour (24-hour clock) as a decimal number (00-23). +* .iP %I +* the hour (12-hour clock) as a decimal number (01-12). +* .iP %j +* the day of the year as decimal number (001-366). +* .iP %m +* the month as a decimal number (01-12). +* .iP %M +* the minute as a decimal number (00-59). +* .iP %P +* the locale's equivalent of the AM/PM +* designations associated with a 12-hour clock. +* .iP %S +* the second as a decimal number (00-59). +* .iP %U +* the week number of the year (first Sunday +* as the first day of week 1) as a decimal number (00-53). +* .iP %w +* the weekday as a decimal number (0-6), where Sunday is 0. +* .iP %W +* the week number of the year (the first Monday +* as the first day of week 1) as a decimal number (00-53). +* .iP %x +* the locale's appropriate date representation. +* .iP %X +* the locale's appropriate time representation. +* .iP %y +* the year without century as a decimal number (00-99). +* .iP %Y +* the year with century as a decimal number. +* .iP %Z +* the time zone name or abbreviation, or by no +* characters if no time zone is determinable. +* .iP %% +* %. +* .LP +* +* For any other conversion specifier, the behavior is undefined. +* +* INCLUDE FILES: time.h +* +* RETURNS: +* The number of characters in , not including the terminating null +* character -- or zero if the number of characters in , including the null +* character, is more than (in which case the contents of are +* indeterminate). +*/ + +size_t strftime + ( + char * s, /* string array */ + size_t n, /* maximum size of array */ + const char * format, /* format of output string */ + const struct tm * tptr /* broken-down time */ + ) + { + return (strftime_r (s, n, format, tptr, __loctime)); + } + +/******************************************************************************* +* +* strftime_r - format time into a string (POSIX) +* +* Re-entrant version of strftime(). +* +* RETURNS: +*/ + +LOCAL size_t strftime_r + ( + char * bufHd, /* string array */ + size_t bufMaxSz, /* maximum size of array */ + const char * fmtHd, /* format of output string */ + const struct tm * tmptr, /* broken-down time */ + TIMELOCALE * timeInfo /* locale information */ + ) + { + const char * fmt = fmtHd; + char * buffer = bufHd; + char addOn[MaxBufferSize]; + int bufLen = 0; + int bufszNow = 0; + + FOREVER + { + while ((*fmt != '%') && (bufszNow != bufMaxSz) && (*fmt != EOS)) + { + bufszNow++; + *buffer++ = *fmt++; + } + + if (bufszNow == bufMaxSz) + break; + + if (*fmt++ != EOS) + { + __generateTime (addOn, tmptr, timeInfo, &bufLen, fmt); + if (bufLen >= 0) + { + if (bufMaxSz > (bufszNow + bufLen)) + { + memcpy (buffer, addOn, bufLen); + bufszNow += bufLen; + buffer += bufLen; + fmt++; + } /* endif */ + else + { + memcpy (buffer, addOn, bufMaxSz - bufszNow); + buffer += (bufMaxSz - bufszNow); + bufszNow = bufMaxSz; + break; + } + } + else + { /* process format strings */ + *(addOn + abs (bufLen)) = EOS; + + /* This is recursive - but should recurse ONCE only */ + bufLen = (int) strftime_r (buffer, + bufMaxSz - bufszNow, + addOn, + tmptr, + timeInfo); + buffer += bufLen; + bufszNow += bufLen; + fmt++; + } /* endif */ + } + else break; + } /* end forever */ + *buffer = EOS; + return (bufszNow); + } + +/******************************************************************************* +* +* __generateTime - generate a string representing the format indicator. +* +* Internal routine +* +* RETURNS: +* NOMANUAL +*/ + +LOCAL void __generateTime + ( + char * addOn, /* string buffer */ + const struct tm * tmptr, /* broken-down time */ + TIMELOCALE * timeInfo, /* locale information */ + int * pnum, /* position number for strftime string */ + const char * fmt /* format to be decoded */ + ) + { + switch (*fmt) + { + case 'a': /* day */ + __getDay (addOn, tmptr->tm_wday, ABBR, timeInfo, pnum); + break; + case 'A': /* day */ + __getDay (addOn, tmptr->tm_wday, FULL, timeInfo, pnum); + break; + case 'b': /* month */ + __getMonth (addOn, tmptr->tm_mon, ABBR, timeInfo, pnum); + break; + case 'B': /* month */ + __getMonth (addOn, tmptr->tm_mon, FULL, timeInfo, pnum); + break; + case 'c': /* date and time */ + __getLocale (addOn, DATETIME, tmptr, timeInfo, pnum); + *pnum = -*pnum; + break; + case 'd': /* day of month */ + __intToStr (addOn, tmptr->tm_mday, *pnum = 2); + break; + case 'H': /* hour */ + __intToStr (addOn, tmptr->tm_hour, *pnum = 2); + break; + case 'I': /* hour */ + __intToStr (addOn, tmptr->tm_hour % 12, *pnum = 2); + break; + case 'j': /* day of year */ + __intToStr (addOn, tmptr->tm_yday + 1, *pnum = 3); + break; + case 'm': /* month */ + __intToStr (addOn, tmptr->tm_mon + 1, *pnum = 2); + break; + case 'M': /* minute */ + __intToStr (addOn, tmptr->tm_min, *pnum = 2); + break; + case 'p': /* AP/PM */ + __getLocale (addOn, AMPM, tmptr, timeInfo, pnum); + break; + case 'S': /* second */ + __intToStr (addOn, tmptr->tm_sec, *pnum = 2); + break; + case 'U': /* week number */ + __intToStr (addOn, + __weekOfYear(TM_SUNDAY, tmptr->tm_wday, tmptr->tm_yday), + *pnum = 2); + break; + case 'w': /* weekday */ + __intToStr (addOn, tmptr->tm_wday, *pnum = 1); + break; + case 'W': /* week number */ + __intToStr (addOn, + __weekOfYear(TM_MONDAY, tmptr->tm_wday, tmptr->tm_yday), + *pnum = 2); + break; + case 'x': /* date */ + __getLocale (addOn, DATE, tmptr, timeInfo, pnum); + *pnum = -*pnum; + break; + case 'X': /* time */ + __getLocale (addOn, TIMEO, tmptr, timeInfo, pnum); + *pnum = -*pnum; + break; + case 'y': /* year */ + __intToStr (addOn, (tmptr->tm_year % CENTURY), *pnum = 2); + break; + case 'Y': /* year */ + __intToStr (addOn, (tmptr->tm_year + TM_YEAR_BASE), *pnum = 4); + break; + case 'Z': /* zone */ + __getLocale (addOn, ZONE, tmptr, timeInfo, pnum); + break; + case '%': /* % */ + memcpy (addOn, CHAR_FROM_CONST ("%"), 1); + *pnum = 1; + break; + default: + *pnum = 0; + break; + } + } + +/******************************************************************************* +* +* __weekOfYear - calulate week of year given julian day and week day. +* +* Internal routine +* The determins whether the week starts on Sunday or Monday. +* +* RETURNS: week of year +* NOMANUAL +*/ + +LOCAL int __weekOfYear + ( + int start, /* either TM_SUNDAY or TM_MONDAY */ + int wday, /* days since sunday */ + int yday /* days since Jan 1 */ + ) + { + wday = (wday - start + DAYSPERWEEK) % DAYSPERWEEK; + return ((yday - wday + 12) / DAYSPERWEEK - 1); + } + +/******************************************************************************* +* +* __getLocale - determine locale information given an indicator or the +* type of information needed. +* +* Internal routine +* +* RETURNS: void +* NOMANUAL +*/ + +LOCAL void __getLocale + ( + char * buffer, /* buffer for the string */ + int desc, /* descriptor */ + const struct tm * tmptr, /* broken-down time */ + TIMELOCALE * timeInfo, /* locale information */ + int * size /* size of array returned */ + ) + { + char * p = NULL; + char zoneBuf [sizeof (ZONEBUFFER)]; + + switch(desc) + { + case DATETIME: + p = timeInfo->_Format [DATETIME]; + break; + case DATE: + p = timeInfo->_Format [DATE]; + break; + case TIMEO: + p = timeInfo->_Format [TIMEO]; + break; + case AMPM: + p = timeInfo->_Ampm [(tmptr->tm_hour <= 12) ? 0 : 1]; + break; + case ZONE: + (void) __getZoneInfo (zoneBuf, NAME, timeInfo); + p = zoneBuf; + break; + } + + *size = strlen (p); + strcpy(buffer, p); + } + +/******************************************************************************* +* +* __intToStr - convert an integer into a string of size with leading +* zeroes if neccessary. +* +* Internal routine +* +* RETURNS: void +* NOMANUAL +*/ + +LOCAL void __intToStr + ( + char * buffer, /* buffer for return string */ + int number, /* the number to be converted */ + int size /* size of the string, maximum length of 4 */ + ) + { + if (number < 0) + number = 0; + + for (buffer += size; 0 <= --size; number /= 10) + { + *--buffer = number % 10 + '0'; + } + } + +/******************************************************************************* +* +* __getDay - determine the locale representation of the day of the week +* +* RETURNS: void +* NOMANUAL +*/ + +LOCAL void __getDay + ( + char * buffer, /* buffer for return string */ + int index, /* integer representation of day of the week */ + int abbr, /* abbrievation or full spelling */ + TIMELOCALE * timeInfo, /* locale information */ + int * size /* size of the string returned */ + ) + { + char * dayStr; + + index += (abbr == ABBR) ? 0 : DAYSPERWEEK; + *size = strlen (dayStr = timeInfo->_Days [index]); + + strcpy (buffer, dayStr); + } + +/******************************************************************************* +* +* __getMonth - determine the locale representation of the month of the year +* +* RETURNS: void +* NOMANUAL +*/ + +LOCAL void __getMonth + ( + char * buffer, /* buffer for return string */ + int index, /* integer representation of month of year */ + int abbr, /* abbrievation or full spelling */ + TIMELOCALE * timeInfo, /* locale information */ + int * size /* size of the string returned */ + ) + { + char * monStr; + + index += (abbr == ABBR) ? 0 : MONSPERYEAR; + *size = strlen (monStr = timeInfo->_Months [index]); + + strcpy (buffer, monStr); + } + +/****************************************************************************** +* +* __getDstInfo - determins whether day light savings is in effect. +* +* TIMEZONE is of the form +* ::